From: support Date: Tue, 28 Mar 2023 14:52:56 +0000 (+0000) Subject: Built motion from commit b0a9a629.|2.6.33 X-Git-Tag: 2.6.33 X-Git-Url: http://repos.xcallymotion.com/base//%22http:/www.gravatar.com/avatar/%7B%7Bhash%7D%7D/%22?a=commitdiff_plain;h=c5ec4f3be0e7f1f893000f685661edf16381041e;p=motion2.git Built motion from commit b0a9a629.|2.6.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c8fe67d..626c532 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.32", + "version": "2.6.33", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-27T11:23:55.365Z", + "time": "2023-03-28T14:44:58.093Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 319ee9b..d064439 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.32", + "version": "2.6.33", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-27T11:23:55.365Z", + "time": "2023-03-28T14:44:58.093Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 948a3ce..22e1ad1 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.32", + "version": "2.6.33", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index 8d1f0dd..b4c0db1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.32", + "version": "2.6.33", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 3b37ef1..6e1fdb7 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 _0x7126=['jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','integration'];(function(_0x5f1b9a,_0x3ebab2){var _0x5c4569=function(_0x410f68){while(--_0x410f68){_0x5f1b9a['push'](_0x5f1b9a['shift']());}};_0x5c4569(++_0x3ebab2);}(_0x7126,0xb9));var _0x6712=function(_0xc84e3,_0xd631b){_0xc84e3=_0xc84e3-0x0;var _0x437a90=_0x7126[_0xc84e3];return _0x437a90;};'use strict';var Sequelize=require(_0x6712('0x0'));module[_0x6712('0x1')]={'name':{'type':Sequelize[_0x6712('0x2')],'get':function(_0x2b53e0){return this[_0x6712('0x3')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x6712('0x4'),'motionbar',_0x6712('0x5'),_0x6712('0x6'),_0x6712('0x7'),_0x6712('0x8'),_0x6712('0x9')]],'msg':_0x6712('0xa')}},'comment':_0x6712('0xa')},'data1':{'type':Sequelize[_0x6712('0xb')](0x1000),'comment':_0x6712('0xc')},'data2':{'type':Sequelize[_0x6712('0xb')](0x1000),'comment':_0x6712('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x6712('0xe')},'data4':{'type':Sequelize[_0x6712('0xb')](0x1000),'comments':_0x6712('0xf')},'data5':{'type':Sequelize[_0x6712('0xb')](0x1000),'comments':_0x6712('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x6712('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0x6712('0x12')}}; \ No newline at end of file +var _0x3a10=['urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','action','contactManager','integration','jscripty','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)]','STRING','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x47a79a,_0x14c5f9){var _0x4a654d=function(_0x39b7c2){while(--_0x39b7c2){_0x47a79a['push'](_0x47a79a['shift']());}};_0x4a654d(++_0x14c5f9);}(_0x3a10,0x6f));var _0x03a1=function(_0x123eca,_0x4b4097){_0x123eca=_0x123eca-0x0;var _0x14b2f4=_0x3a10[_0x123eca];return _0x14b2f4;};'use strict';var Sequelize=require('sequelize');module[_0x03a1('0x0')]={'name':{'type':Sequelize[_0x03a1('0x1')],'get':function(_0x5da817){return this[_0x03a1('0x2')](_0x03a1('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x03a1('0x4'),_0x03a1('0x5'),'motionbar',_0x03a1('0x6'),'urlForward','browser',_0x03a1('0x7'),_0x03a1('0x8')]],'msg':_0x03a1('0x9')}},'comment':_0x03a1('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x03a1('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x03a1('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x03a1('0xc')},'data4':{'type':Sequelize[_0x03a1('0xd')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x03a1('0xd')](0x1000),'comments':_0x03a1('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0x03a1('0xf')},'data7':{'type':Sequelize[_0x03a1('0x10')],'comments':_0x03a1('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 95d3560..227d07c 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 _0x607c=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','body','Action','find','params','catch','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x26b090,_0x36eddf){var _0x39f64c=function(_0x5efac4){while(--_0x5efac4){_0x26b090['push'](_0x26b090['shift']());}};_0x39f64c(++_0x36eddf);}(_0x607c,0x84));var _0xc607=function(_0x36beb9,_0x50fb7f){_0x36beb9=_0x36beb9-0x0;var _0x112b4c=_0x607c[_0x36beb9];return _0x112b4c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc607('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc607('0x1'));var moment=require(_0xc607('0x2'));var BPromise=require(_0xc607('0x3'));var Mustache=require(_0xc607('0x4'));var util=require(_0xc607('0x5'));var path=require('path');var sox=require(_0xc607('0x6'));var csv=require(_0xc607('0x7'));var ejs=require(_0xc607('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc607('0x9'));var squel=require(_0xc607('0xa'));var crypto=require(_0xc607('0xb'));var jsforce=require(_0xc607('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc607('0xd'));var Papa=require(_0xc607('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc607('0xf'));var as=require(_0xc607('0x10'));var hardwareService=require(_0xc607('0x11'));var logger=require(_0xc607('0x12'))(_0xc607('0x13'));var utils=require(_0xc607('0x14'));var config=require(_0xc607('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc607('0x16'))['db'];function respondWithStatusCode(_0x3d9b77,_0x3bb249){_0x3bb249=_0x3bb249||0xcc;return function(_0x1ef741){if(_0x1ef741){return _0x3d9b77[_0xc607('0x17')](_0x3bb249);}return _0x3d9b77['status'](_0x3bb249)[_0xc607('0x18')]();};}function respondWithResult(_0x4e2e20,_0x55103d){_0x55103d=_0x55103d||0xc8;return function(_0x524929){if(_0x524929){return _0x4e2e20[_0xc607('0x19')](_0x55103d)[_0xc607('0x1a')](_0x524929);}};}function respondWithFilteredResult(_0x43d783,_0x5a56de){return function(_0x55a986){if(_0x55a986){var _0x2c8dc4=typeof _0x5a56de[_0xc607('0x1b')]===_0xc607('0x1c')&&typeof _0x5a56de['limit']===_0xc607('0x1c');var _0x3809a0=_0x55a986[_0xc607('0x1d')];var _0x279364=_0x2c8dc4?0x0:_0x5a56de[_0xc607('0x1b')];var _0x4adb14=_0x2c8dc4?_0x55a986[_0xc607('0x1d')]:_0x5a56de['offset']+_0x5a56de[_0xc607('0x1e')];var _0x7bc2ce;if(_0x4adb14>=_0x3809a0){_0x4adb14=_0x3809a0;_0x7bc2ce=0xc8;}else{_0x7bc2ce=0xce;}_0x43d783[_0xc607('0x19')](_0x7bc2ce);return _0x43d783['set'](_0xc607('0x1f'),_0x279364+'-'+_0x4adb14+'/'+_0x3809a0)[_0xc607('0x1a')](_0x55a986);}return null;};}function patchUpdates(_0x295b11){return function(_0x88acb2){try{jsonpatch[_0xc607('0x20')](_0x88acb2,_0x295b11,!![]);}catch(_0xf22cc7){return BPromise['reject'](_0xf22cc7);}return _0x88acb2[_0xc607('0x21')]();};}function saveUpdates(_0x28fa2c,_0x312abc){return function(_0x2fedea){if(_0x2fedea){return _0x2fedea[_0xc607('0x22')](_0x28fa2c)['then'](function(_0x55c523){return _0x55c523;});}return null;};}function removeEntity(_0x1e978c,_0x2c2789){return function(_0x391d78){if(_0x391d78){return _0x391d78[_0xc607('0x23')]()[_0xc607('0x24')](function(){_0x1e978c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b9448,_0x5288f1){return function(_0x18a07d){if(!_0x18a07d){_0x1b9448[_0xc607('0x17')](0x194);}return _0x18a07d;};}function handleError(_0x5fda36,_0x4e1afb){_0x4e1afb=_0x4e1afb||0x1f4;return function(_0x2e1af6){logger[_0xc607('0x25')](_0x2e1af6[_0xc607('0x26')]);if(_0x2e1af6[_0xc607('0x27')]){delete _0x2e1af6['name'];}_0x5fda36[_0xc607('0x19')](_0x4e1afb)[_0xc607('0x28')](_0x2e1af6);};}exports[_0xc607('0x22')]=function(_0x1f8ff8,_0x55f185){if(_0x1f8ff8[_0xc607('0x29')]['id']){delete _0x1f8ff8[_0xc607('0x29')]['id'];}return db[_0xc607('0x2a')][_0xc607('0x2b')]({'where':{'id':_0x1f8ff8[_0xc607('0x2c')]['id']}})[_0xc607('0x24')](handleEntityNotFound(_0x55f185,null))[_0xc607('0x24')](saveUpdates(_0x1f8ff8[_0xc607('0x29')],null))[_0xc607('0x24')](respondWithResult(_0x55f185,null))[_0xc607('0x2d')](handleError(_0x55f185,null));};exports['destroy']=function(_0x1c9243,_0x205dd4){return db[_0xc607('0x2a')][_0xc607('0x2b')]({'where':{'id':_0x1c9243['params']['id']}})[_0xc607('0x24')](handleEntityNotFound(_0x205dd4,null))['then'](removeEntity(_0x205dd4,null))[_0xc607('0x2d')](handleError(_0x205dd4,null));}; \ No newline at end of file +var _0x4166=['eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','update','body','Action','find','params','catch'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x4166,0x108));var _0x6416=function(_0x2333bb,_0x1d2025){_0x2333bb=_0x2333bb-0x0;var _0x3244a4=_0x4166[_0x2333bb];return _0x3244a4;};'use strict';var emlformat=require(_0x6416('0x0'));var rimraf=require(_0x6416('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6416('0x2'));var rp=require('request-promise');var moment=require(_0x6416('0x3'));var BPromise=require(_0x6416('0x4'));var Mustache=require(_0x6416('0x5'));var util=require(_0x6416('0x6'));var path=require(_0x6416('0x7'));var sox=require('sox');var csv=require(_0x6416('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6416('0x9'));var _=require(_0x6416('0xa'));var squel=require(_0x6416('0xb'));var crypto=require('crypto');var jsforce=require(_0x6416('0xc'));var deskjs=require(_0x6416('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6416('0xe'));var Papa=require(_0x6416('0xf'));var Redis=require('ioredis');var authService=require(_0x6416('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6416('0x11'));var hardwareService=require(_0x6416('0x12'));var logger=require(_0x6416('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6416('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6416('0x15'))['db'];function respondWithStatusCode(_0x22ebc8,_0x55a61f){_0x55a61f=_0x55a61f||0xcc;return function(_0x785570){if(_0x785570){return _0x22ebc8['sendStatus'](_0x55a61f);}return _0x22ebc8['status'](_0x55a61f)[_0x6416('0x16')]();};}function respondWithResult(_0x35de0e,_0x5d6efd){_0x5d6efd=_0x5d6efd||0xc8;return function(_0x2f529a){if(_0x2f529a){return _0x35de0e[_0x6416('0x17')](_0x5d6efd)[_0x6416('0x18')](_0x2f529a);}};}function respondWithFilteredResult(_0x46a9cc,_0x291497){return function(_0x24ea84){if(_0x24ea84){var _0xa20ae=typeof _0x291497[_0x6416('0x19')]===_0x6416('0x1a')&&typeof _0x291497['limit']===_0x6416('0x1a');var _0x222178=_0x24ea84[_0x6416('0x1b')];var _0x3596fd=_0xa20ae?0x0:_0x291497[_0x6416('0x19')];var _0x2f7a23=_0xa20ae?_0x24ea84[_0x6416('0x1b')]:_0x291497[_0x6416('0x19')]+_0x291497[_0x6416('0x1c')];var _0x3023c7;if(_0x2f7a23>=_0x222178){_0x2f7a23=_0x222178;_0x3023c7=0xc8;}else{_0x3023c7=0xce;}_0x46a9cc[_0x6416('0x17')](_0x3023c7);return _0x46a9cc['set'](_0x6416('0x1d'),_0x3596fd+'-'+_0x2f7a23+'/'+_0x222178)[_0x6416('0x18')](_0x24ea84);}return null;};}function patchUpdates(_0x14dc2e){return function(_0x565963){try{jsonpatch['apply'](_0x565963,_0x14dc2e,!![]);}catch(_0x55063e){return BPromise[_0x6416('0x1e')](_0x55063e);}return _0x565963[_0x6416('0x1f')]();};}function saveUpdates(_0x23bada,_0x425930){return function(_0x10e429){if(_0x10e429){return _0x10e429['update'](_0x23bada)[_0x6416('0x20')](function(_0x512993){return _0x512993;});}return null;};}function removeEntity(_0x259d77,_0x385608){return function(_0x94bd14){if(_0x94bd14){return _0x94bd14[_0x6416('0x21')]()[_0x6416('0x20')](function(){_0x259d77[_0x6416('0x17')](0xcc)[_0x6416('0x16')]();});}};}function handleEntityNotFound(_0x2ff5a7,_0x3ebf3a){return function(_0x29e3d3){if(!_0x29e3d3){_0x2ff5a7[_0x6416('0x22')](0x194);}return _0x29e3d3;};}function handleError(_0x32753b,_0x33c19b){_0x33c19b=_0x33c19b||0x1f4;return function(_0x54f9a4){logger['error'](_0x54f9a4[_0x6416('0x23')]);if(_0x54f9a4[_0x6416('0x24')]){delete _0x54f9a4[_0x6416('0x24')];}_0x32753b[_0x6416('0x17')](_0x33c19b)[_0x6416('0x25')](_0x54f9a4);};}exports[_0x6416('0x26')]=function(_0x15886c,_0x425448){if(_0x15886c[_0x6416('0x27')]['id']){delete _0x15886c[_0x6416('0x27')]['id'];}return db[_0x6416('0x28')][_0x6416('0x29')]({'where':{'id':_0x15886c[_0x6416('0x2a')]['id']}})[_0x6416('0x20')](handleEntityNotFound(_0x425448,null))['then'](saveUpdates(_0x15886c[_0x6416('0x27')],null))['then'](respondWithResult(_0x425448,null))[_0x6416('0x2b')](handleError(_0x425448,null));};exports[_0x6416('0x21')]=function(_0x247bec,_0x4eb1ac){return db[_0x6416('0x28')][_0x6416('0x29')]({'where':{'id':_0x247bec[_0x6416('0x2a')]['id']}})[_0x6416('0x20')](handleEntityNotFound(_0x4eb1ac,null))['then'](removeEntity(_0x4eb1ac,null))[_0x6416('0x2b')](handleError(_0x4eb1ac,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9634300..535d511 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 _0xcf01=['./action.attributes','exports','tools_actions','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x5c06b,_0x20564c){var _0x34c54c=function(_0x40be24){while(--_0x40be24){_0x5c06b['push'](_0x5c06b['shift']());}};_0x34c54c(++_0x20564c);}(_0xcf01,0x16b));var _0x1cf0=function(_0xe2cbd3,_0x678694){_0xe2cbd3=_0xe2cbd3-0x0;var _0x5155e3=_0xcf01[_0xe2cbd3];return _0x5155e3;};'use strict';var _=require(_0x1cf0('0x0'));var util=require(_0x1cf0('0x1'));var logger=require('../../config/logger')(_0x1cf0('0x2'));var moment=require(_0x1cf0('0x3'));var BPromise=require(_0x1cf0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cf0('0x5'));var rimraf=require(_0x1cf0('0x6'));var config=require('../../config/environment');var attributes=require(_0x1cf0('0x7'));module[_0x1cf0('0x8')]=function(_0x33605e,_0x343741){return _0x33605e['define']('Action',attributes,{'tableName':_0x1cf0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9563=['moment','bluebird','request-promise','../../config/environment','exports','define','tools_actions','lodash','util','api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9563,0x1e7));var _0x3956=function(_0x56e4a6,_0x20b7f8){_0x56e4a6=_0x56e4a6-0x0;var _0x56a6e5=_0x9563[_0x56e4a6];return _0x56a6e5;};'use strict';var _=require(_0x3956('0x0'));var util=require(_0x3956('0x1'));var logger=require('../../config/logger')(_0x3956('0x2'));var moment=require(_0x3956('0x3'));var BPromise=require(_0x3956('0x4'));var rp=require(_0x3956('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3956('0x6'));var attributes=require('./action.attributes');module[_0x3956('0x7')]=function(_0x332a45,_0x177a1a){return _0x332a45[_0x3956('0x8')]('Action',attributes,{'tableName':_0x3956('0x9'),'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 7024847..06156a7 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4980cb,_0x31d5e9){var _0x567f4a=function(_0x122885){while(--_0x122885){_0x4980cb['push'](_0x4980cb['shift']());}};_0x567f4a(++_0x31d5e9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x4975,0x86));var _0x5497=function(_0x125c98,_0x2072b2){_0x125c98=_0x125c98-0x0;var _0x12c301=_0x4975[_0x125c98];return _0x12c301;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 8ead71d..6c09797 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 _0x1ca6=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./action.controller','put','/:id','update','isAuthenticated','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ca6,0x158));var _0x61ca=function(_0x24861e,_0x429cb1){_0x24861e=_0x24861e-0x0;var _0x1cc27e=_0x1ca6[_0x24861e];return _0x1cc27e;};'use strict';var multer=require(_0x61ca('0x0'));var util=require(_0x61ca('0x1'));var path=require(_0x61ca('0x2'));var timeout=require(_0x61ca('0x3'));var express=require('express');var router=express[_0x61ca('0x4')]();var fs_extra=require(_0x61ca('0x5'));var auth=require(_0x61ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x61ca('0x7'));var controller=require(_0x61ca('0x8'));router[_0x61ca('0x9')](_0x61ca('0xa'),auth['isAuthenticated'](),controller[_0x61ca('0xb')]);router['delete'](_0x61ca('0xa'),auth[_0x61ca('0xc')](),controller[_0x61ca('0xd')]);module[_0x61ca('0xe')]=router; \ No newline at end of file +var _0x90dc=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','delete','/:id','destroy','path','connect-timeout'];(function(_0x19cd5f,_0x21102c){var _0x15f970=function(_0xe9199e){while(--_0xe9199e){_0x19cd5f['push'](_0x19cd5f['shift']());}};_0x15f970(++_0x21102c);}(_0x90dc,0x140));var _0xc90d=function(_0x1c8f39,_0x4634f6){_0x1c8f39=_0x1c8f39-0x0;var _0x2e3e83=_0x90dc[_0x1c8f39];return _0x2e3e83;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc90d('0x0'));var timeout=require(_0xc90d('0x1'));var express=require(_0xc90d('0x2'));var router=express[_0xc90d('0x3')]();var fs_extra=require(_0xc90d('0x4'));var auth=require(_0xc90d('0x5'));var interaction=require(_0xc90d('0x6'));var config=require(_0xc90d('0x7'));var controller=require(_0xc90d('0x8'));router[_0xc90d('0x9')]('/:id',auth[_0xc90d('0xa')](),controller['update']);router[_0xc90d('0xb')](_0xc90d('0xc'),auth[_0xc90d('0xa')](),controller[_0xc90d('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index cb03e6b..9a15cfc 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 _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x487ecb,_0x66f900){_0x487ecb=_0x487ecb-0x0;var _0x34d155=_0xb4c7[_0x487ecb];return _0x34d155;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file +var _0x71ab=['TEXT','exports','STRING'];(function(_0x25329f,_0x508987){var _0x5dc499=function(_0x185585){while(--_0x185585){_0x25329f['push'](_0x25329f['shift']());}};_0x5dc499(++_0x508987);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index e15d961..70d7aee 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 _0x2fe2=['startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','CustomReports','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','keys','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','getFields','Sequelize','ValidationErrorItem','alias','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','cdr','.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x44e697,_0x42ec0c){var _0x524e77=function(_0x2aa9ff){while(--_0x2aa9ff){_0x44e697['push'](_0x44e697['shift']());}};_0x524e77(++_0x42ec0c);}(_0x2fe2,0xae));var _0x22fe=function(_0x4c89c7,_0x380cdd){_0x4c89c7=_0x4c89c7-0x0;var _0x38fd81=_0x2fe2[_0x4c89c7];return _0x38fd81;};'use strict';var emlformat=require(_0x22fe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x22fe('0x1'));var jsonpatch=require(_0x22fe('0x2'));var rp=require(_0x22fe('0x3'));var moment=require('moment');var BPromise=require(_0x22fe('0x4'));var Mustache=require(_0x22fe('0x5'));var util=require(_0x22fe('0x6'));var path=require('path');var sox=require(_0x22fe('0x7'));var csv=require('to-csv');var ejs=require(_0x22fe('0x8'));var fs=require('fs');var fs_extra=require(_0x22fe('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x22fe('0xa'));var jsforce=require(_0x22fe('0xb'));var deskjs=require(_0x22fe('0xc'));var toCsv=require('to-csv');var querystring=require(_0x22fe('0xd'));var Papa=require('papaparse');var Redis=require(_0x22fe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x22fe('0xf'));var as=require(_0x22fe('0x10'));var hardwareService=require(_0x22fe('0x11'));var logger=require('../../config/logger')(_0x22fe('0x12'));var utils=require(_0x22fe('0x13'));var config=require(_0x22fe('0x14'));var licenseUtil=require(_0x22fe('0x15'));var db=require(_0x22fe('0x16'))['db'];var dbH=require(_0x22fe('0x16'))[_0x22fe('0x17')];function respondWithStatusCode(_0x2d387e,_0x4710f0){_0x4710f0=_0x4710f0||0xcc;return function(_0x2338fa){if(_0x2338fa){return _0x2d387e[_0x22fe('0x18')](_0x4710f0);}return _0x2d387e[_0x22fe('0x19')](_0x4710f0)['end']();};}function respondWithResult(_0x43046b,_0x406da4){_0x406da4=_0x406da4||0xc8;return function(_0x457bc3){if(_0x457bc3){return _0x43046b['status'](_0x406da4)[_0x22fe('0x1a')](_0x457bc3);}};}function respondWithFilteredResult(_0xf40b85,_0x529b64){return function(_0x22dea4){if(_0x22dea4){var _0x5d6a66=typeof _0x529b64[_0x22fe('0x1b')]===_0x22fe('0x1c')&&typeof _0x529b64[_0x22fe('0x1d')]===_0x22fe('0x1c');var _0x86445a=_0x22dea4[_0x22fe('0x1e')];var _0x22d18e=_0x5d6a66?0x0:_0x529b64[_0x22fe('0x1b')];var _0x4e708c=_0x5d6a66?_0x22dea4[_0x22fe('0x1e')]:_0x529b64[_0x22fe('0x1b')]+_0x529b64['limit'];var _0x516bf2;if(_0x4e708c>=_0x86445a){_0x4e708c=_0x86445a;_0x516bf2=0xc8;}else{_0x516bf2=0xce;}_0xf40b85[_0x22fe('0x19')](_0x516bf2);return _0xf40b85[_0x22fe('0x1f')](_0x22fe('0x20'),_0x22d18e+'-'+_0x4e708c+'/'+_0x86445a)[_0x22fe('0x1a')](_0x22dea4);}return null;};}function patchUpdates(_0x22cf74){return function(_0x37cde4){try{jsonpatch['apply'](_0x37cde4,_0x22cf74,!![]);}catch(_0x3dd364){return BPromise[_0x22fe('0x21')](_0x3dd364);}return _0x37cde4['save']();};}function saveUpdates(_0x9e348e,_0x1b6661){return function(_0x3817d7){if(_0x3817d7){return _0x3817d7[_0x22fe('0x22')](_0x9e348e)[_0x22fe('0x23')](function(_0x57c726){return _0x57c726;});}return null;};}function removeEntity(_0x2516fb,_0x258f0c){return function(_0x324f60){if(_0x324f60){return _0x324f60[_0x22fe('0x24')]()[_0x22fe('0x23')](function(){var _0x254e42=_0x324f60[_0x22fe('0x25')]({'plain':!![]});var _0x414c80=_0x22fe('0x26');return db['UserProfileResource'][_0x22fe('0x24')]({'where':{'type':_0x414c80,'resourceId':_0x254e42['id']}})[_0x22fe('0x23')](function(){return _0x324f60;});})['then'](function(){_0x2516fb[_0x22fe('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43aabc,_0x1009f4){return function(_0x574626){if(!_0x574626){_0x43aabc[_0x22fe('0x18')](0x194);}return _0x574626;};}function handleError(_0x2b8200,_0x5eb381){_0x5eb381=_0x5eb381||0x1f4;return function(_0xd0c050){logger[_0x22fe('0x27')](_0xd0c050[_0x22fe('0x28')]);if(_0xd0c050[_0x22fe('0x29')]){delete _0xd0c050[_0x22fe('0x29')];}_0x2b8200['status'](_0x5eb381)[_0x22fe('0x2a')](_0xd0c050);};}exports['index']=function(_0x316e2a,_0x1bba90){var _0x699645={},_0x75a3a8={},_0x3e5ff2={'count':0x0,'rows':[]};var _0x84d2a9=_[_0x22fe('0x2b')](db[_0x22fe('0x2c')][_0x22fe('0x2d')],function(_0xd3ccbf){return{'name':_0xd3ccbf[_0x22fe('0x2e')],'type':_0xd3ccbf[_0x22fe('0x2f')][_0x22fe('0x30')]};});_0x75a3a8[_0x22fe('0x31')]=_['map'](_0x84d2a9,_0x22fe('0x29'));_0x75a3a8[_0x22fe('0x32')]=_['keys'](_0x316e2a['query']);_0x75a3a8[_0x22fe('0x33')]=_[_0x22fe('0x34')](_0x75a3a8['model'],_0x75a3a8['query']);_0x699645[_0x22fe('0x35')]=_[_0x22fe('0x34')](_0x75a3a8[_0x22fe('0x31')],qs[_0x22fe('0x36')](_0x316e2a[_0x22fe('0x32')][_0x22fe('0x36')]));_0x699645['attributes']=_0x699645['attributes'][_0x22fe('0x37')]?_0x699645[_0x22fe('0x35')]:_0x75a3a8[_0x22fe('0x31')];if(!_0x316e2a[_0x22fe('0x32')][_0x22fe('0x38')](_0x22fe('0x39'))){_0x699645['limit']=qs[_0x22fe('0x1d')](_0x316e2a[_0x22fe('0x32')][_0x22fe('0x1d')]);_0x699645[_0x22fe('0x1b')]=qs[_0x22fe('0x1b')](_0x316e2a[_0x22fe('0x32')][_0x22fe('0x1b')]);}_0x699645[_0x22fe('0x3a')]=qs[_0x22fe('0x3b')](_0x316e2a[_0x22fe('0x32')][_0x22fe('0x3b')]);_0x699645[_0x22fe('0x3c')]=qs[_0x22fe('0x33')](_['pick'](_0x316e2a[_0x22fe('0x32')],_0x75a3a8[_0x22fe('0x33')]),_0x84d2a9);if(_0x316e2a[_0x22fe('0x32')][_0x22fe('0x3d')]){_0x699645[_0x22fe('0x3c')]=_[_0x22fe('0x3e')](_0x699645[_0x22fe('0x3c')],{'$or':_['map'](_0x84d2a9,function(_0x50c0d4){if(_0x50c0d4[_0x22fe('0x2f')]!==_0x22fe('0x3f')){var _0x5b3f25={};_0x5b3f25[_0x50c0d4['name']]={'$like':'%'+_0x316e2a[_0x22fe('0x32')][_0x22fe('0x3d')]+'%'};return _0x5b3f25;}})});}_0x699645=_[_0x22fe('0x3e')]({},_0x699645,_0x316e2a[_0x22fe('0x40')]);var _0x52c9de={'where':_0x699645[_0x22fe('0x3c')]};return db[_0x22fe('0x2c')]['count'](_0x52c9de)['then'](function(_0x4a44d0){_0x3e5ff2['count']=_0x4a44d0;if(_0x316e2a['query'][_0x22fe('0x41')]){_0x699645[_0x22fe('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x699645);})[_0x22fe('0x23')](function(_0xcc3437){_0x3e5ff2['rows']=_0xcc3437;return _0x3e5ff2;})[_0x22fe('0x23')](respondWithFilteredResult(_0x1bba90,_0x699645))[_0x22fe('0x43')](handleError(_0x1bba90,null));};exports['show']=function(_0x500e37,_0x2859ec){var _0x1d5e41={'raw':![],'where':{'id':_0x500e37['params']['id']}},_0x14ecbd={};_0x14ecbd[_0x22fe('0x31')]=_[_0x22fe('0x44')](db[_0x22fe('0x2c')][_0x22fe('0x2d')]);_0x14ecbd['query']=_[_0x22fe('0x44')](_0x500e37[_0x22fe('0x32')]);_0x14ecbd[_0x22fe('0x33')]=_['intersection'](_0x14ecbd[_0x22fe('0x31')],_0x14ecbd[_0x22fe('0x32')]);_0x1d5e41[_0x22fe('0x35')]=_[_0x22fe('0x34')](_0x14ecbd[_0x22fe('0x31')],qs[_0x22fe('0x36')](_0x500e37[_0x22fe('0x32')][_0x22fe('0x36')]));_0x1d5e41[_0x22fe('0x35')]=_0x1d5e41[_0x22fe('0x35')]['length']?_0x1d5e41[_0x22fe('0x35')]:_0x14ecbd['model'];if(_0x500e37[_0x22fe('0x32')][_0x22fe('0x41')]){_0x1d5e41['include']=[{'all':!![]}];}_0x1d5e41=_['merge']({},_0x1d5e41,_0x500e37['options']);return db[_0x22fe('0x2c')]['find'](_0x1d5e41)[_0x22fe('0x23')](handleEntityNotFound(_0x2859ec,null))[_0x22fe('0x23')](respondWithResult(_0x2859ec,null))[_0x22fe('0x43')](handleError(_0x2859ec,null));};exports['create']=function(_0x3ed86b,_0x3d1480){return db[_0x22fe('0x2c')]['create'](_0x3ed86b[_0x22fe('0x45')],{})[_0x22fe('0x23')](function(_0x1cfd7b){var _0x1192d5=_0x3ed86b[_0x22fe('0x46')][_0x22fe('0x25')]({'plain':!![]});if(!_0x1192d5)throw new Error(_0x22fe('0x47'));if(_0x1192d5[_0x22fe('0x48')]===_0x22fe('0x46')){var _0x4a489b=_0x1cfd7b['get']({'plain':!![]});var _0x5b6fd8=_0x22fe('0x49');return db['UserProfileSection'][_0x22fe('0x4a')]({'where':{'name':_0x5b6fd8,'userProfileId':_0x1192d5['userProfileId']},'raw':!![]})['then'](function(_0x179d8e){if(_0x179d8e&&_0x179d8e['autoAssociation']===0x0){return db['UserProfileResource'][_0x22fe('0x4b')]({'name':_0x4a489b[_0x22fe('0x29')],'resourceId':_0x4a489b['id'],'type':_0x22fe('0x26'),'sectionId':_0x179d8e['id']},{})[_0x22fe('0x23')](function(){return _0x1cfd7b;});}else{return _0x1cfd7b;}})[_0x22fe('0x43')](function(_0x2cc73e){logger['error'](_0x22fe('0x4c'),_0x2cc73e);throw _0x2cc73e;});}return _0x1cfd7b;})[_0x22fe('0x23')](respondWithResult(_0x3d1480,0xc9))[_0x22fe('0x43')](handleError(_0x3d1480,null));};exports['update']=function(_0x2e51aa,_0x373bdc){if(_0x2e51aa[_0x22fe('0x45')]['id']){delete _0x2e51aa['body']['id'];}return db[_0x22fe('0x2c')][_0x22fe('0x4a')]({'where':{'id':_0x2e51aa[_0x22fe('0x4d')]['id']}})['then'](handleEntityNotFound(_0x373bdc,null))[_0x22fe('0x23')](saveUpdates(_0x2e51aa[_0x22fe('0x45')],null))[_0x22fe('0x23')](respondWithResult(_0x373bdc,null))[_0x22fe('0x43')](handleError(_0x373bdc,null));};exports['destroy']=function(_0x529fef,_0x2f6e37){return db[_0x22fe('0x2c')][_0x22fe('0x4a')]({'where':{'id':_0x529fef[_0x22fe('0x4d')]['id']}})[_0x22fe('0x23')](handleEntityNotFound(_0x2f6e37,null))[_0x22fe('0x23')](removeEntity(_0x2f6e37,null))['catch'](handleError(_0x2f6e37,null));};exports[_0x22fe('0x4e')]=function(_0x29b466,_0x477ddb){var _0x4b3639=0xa;var _0x4171de=['join',_0x22fe('0x4f'),_0x22fe('0x50'),_0x22fe('0x51')];var _0x209373={'SUM':_0x22fe('0x52'),'COUNT':_0x22fe('0x53'),'COUNT DISTINCT':_0x22fe('0x54'),'MAX':_0x22fe('0x55'),'MIN':_0x22fe('0x56'),'AVG':_0x22fe('0x57'),'GROUP_CONCAT':_0x22fe('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x22fe('0x59')};var _0xea83ca={'SEC_TO_TIME':_0x22fe('0x5a'),'DATE':_0x22fe('0x5b'),'HOUR':_0x22fe('0x5c'),'ROUND':_0x22fe('0x5d'),'UNIX_TIMESTAMP':_0x22fe('0x5e')};var _0x428626=function(_0x235f27){return!_[_0x22fe('0x5f')]([_0x22fe('0x60'),_0x22fe('0x61'),_0x22fe('0x62'),_0x22fe('0x63')],_0x235f27);};var _0x5c0f6c=function(_0x42aff6){if(!_0x42aff6||!_0x42aff6[_0x22fe('0x64')][_0x22fe('0x37')]){return'';}for(var _0x26d9cb='(',_0x2ee90d=0x0;_0x2ee90d<_0x42aff6[_0x22fe('0x64')][_0x22fe('0x37')];_0x2ee90d+=0x1){_0x2ee90d>0x0&&(_0x26d9cb+='\x20'+_0x42aff6[_0x22fe('0x65')]+'\x20');_0x26d9cb+=_0x42aff6['rules'][_0x2ee90d][_0x22fe('0x66')]?_0x5c0f6c(_0x42aff6[_0x22fe('0x64')][_0x2ee90d][_0x22fe('0x66')]):_0x42aff6[_0x22fe('0x64')][_0x2ee90d][_0x22fe('0x67')]+'\x20'+_0x42aff6[_0x22fe('0x64')][_0x2ee90d][_0x22fe('0x68')]+(_0x428626(_0x42aff6[_0x22fe('0x64')][_0x2ee90d]['condition'])?'\x20'+_0x42aff6[_0x22fe('0x64')][_0x2ee90d]['value']:'');}return _0x26d9cb+')';};var _0x5483ab={'where':{'id':_0x29b466[_0x22fe('0x4d')]['id']}},_0x3c56a9,_0x2304c7,_0x545dd4,_0x46a9b6,_0x32831a;_0x5483ab=_[_0x22fe('0x3e')]({},_0x5483ab,_0x29b466['options']);return db[_0x22fe('0x2c')][_0x22fe('0x4a')](_0x5483ab)[_0x22fe('0x23')](function(_0x40fe4){if(_0x40fe4){_0x3c56a9=_0x40fe4;return _0x40fe4['getFields']();}return null;})[_0x22fe('0x23')](function(_0x3038a5){if(_0x3038a5){if(!_0x3038a5[_0x22fe('0x37')]){throw new db['Sequelize']['ValidationErrorItem'](_0x22fe('0x69'),0x193);}_0x2304c7=_0x3038a5;return db[_0x22fe('0x6a')][_0x22fe('0x6b')]({'raw':!![]});}return null;})[_0x22fe('0x23')](function(_0xa398d6){if(_0xa398d6){_0x545dd4=_[_0x22fe('0x6c')](_0xa398d6,'id');var _0x126883;var _0xb37d79=squel[_0x22fe('0x6d')]();_0xb37d79[_0x22fe('0x6e')](_0x3c56a9[_0x22fe('0x6f')]);for(var _0x4b1759=0x0;_0x4b1759<_0x2304c7[_0x22fe('0x37')];_0x4b1759+=0x1){_0x126883=_0x2304c7[_0x4b1759][_0x22fe('0x70')]?_0x545dd4[_0x2304c7[_0x4b1759][_0x22fe('0x70')]][_0x22fe('0x71')]:_0x2304c7[_0x4b1759][_0x22fe('0x67')];_0x126883=_0x2304c7[_0x4b1759][_0x22fe('0x72')]?_[_0x22fe('0x73')](_0x209373[_0x2304c7[_0x4b1759][_0x22fe('0x72')]],'%s',_0x126883):_0x126883;_0x126883=_0x2304c7[_0x4b1759][_0x22fe('0x74')]?_[_0x22fe('0x73')](_0xea83ca[_0x2304c7[_0x4b1759][_0x22fe('0x74')]],'%s',_0x126883):_0x126883;if(_0x2304c7[_0x4b1759][_0x22fe('0x75')]){_0xb37d79[_0x22fe('0x66')](_0x126883);}_0x2304c7[_0x4b1759][_0x22fe('0x76')]&&_0xb37d79[_0x22fe('0x3a')](_0x126883,_0x2304c7[_0x4b1759]['orderBy']===_0x22fe('0x77')?![]:!![]);_0xb37d79[_0x22fe('0x67')](_0x126883,_0x2304c7[_0x4b1759]['alias']||_0x126883);}if(_0x3c56a9[_0x22fe('0x78')]){_0x3c56a9[_0x22fe('0x78')]=JSON[_0x22fe('0x79')](_0x3c56a9['joins']);for(var _0x28b274=0x0;_0x28b274<_0x3c56a9[_0x22fe('0x78')][_0x22fe('0x37')];_0x28b274+=0x1){if(_0x3c56a9[_0x22fe('0x78')][_0x28b274]['type']&&_[_0x22fe('0x5f')](_0x4171de,_0x3c56a9[_0x22fe('0x78')][_0x28b274]['type'])&&_0x3c56a9[_0x22fe('0x78')][_0x28b274]['parentKey']&&_0x3c56a9[_0x22fe('0x78')][_0x28b274][_0x22fe('0x7a')]&&_0x3c56a9[_0x22fe('0x78')][_0x28b274][_0x22fe('0x7b')]){_0xb37d79[_0x3c56a9[_0x22fe('0x78')][_0x28b274][_0x22fe('0x2f')]](_0x3c56a9[_0x22fe('0x78')][_0x28b274][_0x22fe('0x7a')],null,util[_0x22fe('0x74')](_0x22fe('0x7c'),_0x3c56a9[_0x22fe('0x6f')],_0x3c56a9['joins'][_0x28b274][_0x22fe('0x7d')],_0x3c56a9['joins'][_0x28b274][_0x22fe('0x7a')],_0x3c56a9[_0x22fe('0x78')][_0x28b274]['foreignKey']));}}}if(_0x3c56a9[_0x22fe('0x7e')]){_0x3c56a9[_0x22fe('0x7e')]=JSON[_0x22fe('0x79')](_0x3c56a9[_0x22fe('0x7e')]);_0xb37d79['where'](_0x5c0f6c(_0x3c56a9[_0x22fe('0x7e')][_0x22fe('0x66')]));}_0x32831a=_0xb37d79[_0x22fe('0x7f')]();_0xb37d79[_0x22fe('0x1d')](_0x4b3639);_0xb37d79[_0x22fe('0x1b')](0x0);logger[_0x22fe('0x80')](_0x22fe('0x81'),_0xb37d79[_0x22fe('0x82')]());return dbH[_0x22fe('0x83')][_0x22fe('0x32')](_0xb37d79[_0x22fe('0x82')](),{'type':dbH['sequelize'][_0x22fe('0x84')][_0x22fe('0x85')]});}})[_0x22fe('0x23')](respondWithResult(_0x477ddb,null))['catch'](handleError(_0x477ddb,null));};function runReport(_0x38f72d,_0xaff805,_0x14f68e){var _0xd9bca=_0xaff805[_0x22fe('0x29')];var _0x2fbb72=0xa;var _0x1da6a3=[_0x22fe('0x86'),_0x22fe('0x4f'),_0x22fe('0x50'),_0x22fe('0x51')];var _0x1f7a3d={'SUM':'SUM(%s)','COUNT':_0x22fe('0x53'),'COUNT DISTINCT':_0x22fe('0x54'),'MAX':_0x22fe('0x55'),'MIN':'MIN(%s)','AVG':_0x22fe('0x57'),'GROUP_CONCAT':_0x22fe('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x22fe('0x59')};var _0x432cd7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x22fe('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x22fe('0x5d'),'UNIX_TIMESTAMP':_0x22fe('0x5e')};var _0x38ff96=function(_0x4a9c98){return!_['includes']([_0x22fe('0x60'),_0x22fe('0x61'),'IS\x20EMPTY',_0x22fe('0x63')],_0x4a9c98);};var _0x10ca33=function(_0x758692){if(!_0x758692||!_0x758692[_0x22fe('0x64')]['length']){return'';}for(var _0x2d205b='(',_0x3d0bf9=0x0;_0x3d0bf9<_0x758692[_0x22fe('0x64')]['length'];_0x3d0bf9+=0x1){_0x3d0bf9>0x0&&(_0x2d205b+='\x20'+_0x758692['operator']+'\x20');_0x2d205b+=_0x758692['rules'][_0x3d0bf9][_0x22fe('0x66')]?_0x10ca33(_0x758692[_0x22fe('0x64')][_0x3d0bf9]['group']):_0x758692[_0x22fe('0x64')][_0x3d0bf9][_0x22fe('0x67')]+'\x20'+_0x758692[_0x22fe('0x64')][_0x3d0bf9][_0x22fe('0x68')]+(_0x38ff96(_0x758692[_0x22fe('0x64')][_0x3d0bf9][_0x22fe('0x68')])?'\x20'+_0x758692['rules'][_0x3d0bf9]['value']:'');}return _0x2d205b+')';};var _0x4027c5={'where':{'id':_0x38f72d['id']}},_0x323172,_0x589786,_0x9bf74e,_0x34f9ea,_0x26ad96;_0x4027c5=_[_0x22fe('0x3e')]({},_0x4027c5,_0x14f68e);return db[_0x22fe('0x2c')][_0x22fe('0x4a')](_0x4027c5)[_0x22fe('0x23')](function(_0x3ea04d){if(_0x3ea04d){_0x323172=_0x3ea04d;return _0x3ea04d[_0x22fe('0x87')]();}return null;})[_0x22fe('0x23')](function(_0x3922cf){if(_0x3922cf){if(!_0x3922cf[_0x22fe('0x37')]){throw new db[(_0x22fe('0x88'))][(_0x22fe('0x89'))](_0x22fe('0x69'),0x193);}_0x589786=_0x3922cf;return db[_0x22fe('0x6a')][_0x22fe('0x6b')]({'raw':!![]});}return null;})['then'](function(_0x129ac9){if(_0x129ac9){_0x9bf74e=_[_0x22fe('0x6c')](_0x129ac9,'id');var _0x536afb;var _0x13d131=squel['select']();_0x13d131['from'](_0x323172[_0x22fe('0x6f')]);for(var _0x2ff55a=0x0;_0x2ff55a<_0x589786[_0x22fe('0x37')];_0x2ff55a+=0x1){_0x536afb=_0x589786[_0x2ff55a][_0x22fe('0x70')]?_0x9bf74e[_0x589786[_0x2ff55a][_0x22fe('0x70')]][_0x22fe('0x71')]:_0x589786[_0x2ff55a][_0x22fe('0x67')];_0x536afb=_0x589786[_0x2ff55a][_0x22fe('0x72')]?_[_0x22fe('0x73')](_0x1f7a3d[_0x589786[_0x2ff55a][_0x22fe('0x72')]],'%s',_0x536afb):_0x536afb;_0x536afb=_0x589786[_0x2ff55a][_0x22fe('0x74')]?_['replace'](_0x432cd7[_0x589786[_0x2ff55a][_0x22fe('0x74')]],'%s',_0x536afb):_0x536afb;if(_0x589786[_0x2ff55a][_0x22fe('0x75')]){_0x13d131[_0x22fe('0x66')](_0x536afb);}_0x589786[_0x2ff55a][_0x22fe('0x76')]&&_0x13d131[_0x22fe('0x3a')](_0x536afb,_0x589786[_0x2ff55a][_0x22fe('0x76')]===_0x22fe('0x77')?![]:!![]);_0x13d131['field'](_0x536afb,_0x589786[_0x2ff55a][_0x22fe('0x8a')]||_0x536afb);}if(_0x323172[_0x22fe('0x78')]){_0x323172[_0x22fe('0x78')]=JSON[_0x22fe('0x79')](_0x323172[_0x22fe('0x78')]);for(var _0x520bcf=0x0;_0x520bcf<_0x323172['joins']['length'];_0x520bcf+=0x1){if(_0x323172[_0x22fe('0x78')][_0x520bcf][_0x22fe('0x2f')]&&_['includes'](_0x1da6a3,_0x323172[_0x22fe('0x78')][_0x520bcf][_0x22fe('0x2f')])&&_0x323172[_0x22fe('0x78')][_0x520bcf][_0x22fe('0x7d')]&&_0x323172[_0x22fe('0x78')][_0x520bcf][_0x22fe('0x7a')]&&_0x323172[_0x22fe('0x78')][_0x520bcf]['foreignKey']){_0x13d131[_0x323172['joins'][_0x520bcf][_0x22fe('0x2f')]](_0x323172[_0x22fe('0x78')][_0x520bcf][_0x22fe('0x7a')],null,util[_0x22fe('0x74')]('%s.%s\x20=\x20%s.%s',_0x323172[_0x22fe('0x6f')],_0x323172['joins'][_0x520bcf][_0x22fe('0x7d')],_0x323172['joins'][_0x520bcf]['foreignTable'],_0x323172['joins'][_0x520bcf][_0x22fe('0x7b')]));}}}if(_0x323172[_0x22fe('0x7e')]){_0x323172[_0x22fe('0x7e')]=JSON[_0x22fe('0x79')](_0x323172[_0x22fe('0x7e')]);_0x13d131[_0x22fe('0x3c')](_0x10ca33(_0x323172[_0x22fe('0x7e')][_0x22fe('0x66')]));}_0x26ad96=_0x13d131[_0x22fe('0x7f')]();_0x13d131['limit'](_0x2fbb72);_0x13d131[_0x22fe('0x1b')](0x0);return;}})[_0x22fe('0x23')](function(){if(_0xaff805['output']==='web'){return null;}var _0x5706d5=_[_0x22fe('0x3e')](_0xaff805,{'name':_0xaff805[_0x22fe('0x8b')]||_0xaff805[_0x22fe('0x29')]||_0x323172[_0x22fe('0x29')],'basename':_0xd9bca,'savename':util[_0x22fe('0x74')](_0x22fe('0x8c'),_0xaff805['name']||_0x323172[_0x22fe('0x29')],require(_0x22fe('0x8d'))[_0x22fe('0x8e')](0x4),_0xaff805[_0x22fe('0x8f')]||_0x22fe('0x90')),'reportId':_0x323172['id'],'reportType':_0x22fe('0x91')});return db['AnalyticExtractedReport'][_0x22fe('0x4b')](_0x5706d5,{'raw':!![]});})[_0x22fe('0x23')](function(_0x548eea){if(_0x323172['table']===_0x22fe('0x92')){_0x26ad96['where'](_0x323172[_0x22fe('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xaff805['startDate'],_0xaff805['endDate']);}else{_0x26ad96['where'](_0x323172[_0x22fe('0x6f')]+_0x22fe('0x93'),_0xaff805[_0x22fe('0x94')],_0xaff805[_0x22fe('0x95')]);}if(_0x548eea){logger[_0x22fe('0x96')](_0x22fe('0x97'),_0x26ad96['toString']());require(_0x22fe('0x98'))[_0x22fe('0x99')](path['join'](__dirname,_0x22fe('0x9a'),_0x548eea['output']),[_0x548eea['id'],_0x26ad96[_0x22fe('0x82')](),path['join'](__dirname,'../../files/reports',_0x548eea[_0x22fe('0x9b')]),_0xd9bca]);return _0x548eea;}else{var _0x5166cd=squel['select']();_0x5166cd[_0x22fe('0x6e')]('('+_0x26ad96[_0x22fe('0x82')]()+')',_0x22fe('0x9c'));_0x5166cd[_0x22fe('0x67')](_0x22fe('0x9d'),_0x22fe('0x1e'));_0x26ad96[_0x22fe('0x1d')](_0xaff805[_0x22fe('0x1d')]||_0x2fbb72);_0x26ad96[_0x22fe('0x1b')](_0xaff805[_0x22fe('0x1b')]||0x0);return dbH[_0x22fe('0x83')][_0x22fe('0x32')](_0x5166cd[_0x22fe('0x82')](),{'type':dbH[_0x22fe('0x83')][_0x22fe('0x84')][_0x22fe('0x85')]})[_0x22fe('0x23')](function(_0x684b1e){if(!_0x684b1e[_0x22fe('0x37')]){_0x34f9ea=0x0;}else{_0x34f9ea=_0x684b1e[0x0]['count']||0x0;}return dbH['sequelize'][_0x22fe('0x32')](_0x26ad96[_0x22fe('0x82')](),{'type':dbH[_0x22fe('0x83')][_0x22fe('0x84')]['SELECT']});})[_0x22fe('0x23')](function(_0x1fe8b6){return{'rows':_0x1fe8b6||[],'count':_0x34f9ea};});}});}exports[_0x22fe('0x9e')]=function(_0x4c75fe,_0x3f4e57){return runReport(_0x4c75fe[_0x22fe('0x4d')],_0x4c75fe['query'],_0x4c75fe[_0x22fe('0x40')])[_0x22fe('0x23')](respondWithResult(_0x3f4e57,null))[_0x22fe('0x43')](handleError(_0x3f4e57,null));};exports[_0x22fe('0x9f')]=runReport;exports[_0x22fe('0x32')]=function(_0x1b7b87,_0x11d91e){var _0x2cb27a=0xa;var _0x180d29=[_0x22fe('0x86'),_0x22fe('0x4f'),_0x22fe('0x50'),_0x22fe('0x51')];var _0x391802={'SUM':_0x22fe('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x22fe('0x54'),'MAX':_0x22fe('0x55'),'MIN':_0x22fe('0x56'),'AVG':_0x22fe('0x57'),'GROUP_CONCAT':_0x22fe('0x58'),'GROUP_CONCAT ASC':_0x22fe('0xa0'),'GROUP_CONCAT DESC':_0x22fe('0x59')};var _0x7de659={'SEC_TO_TIME':_0x22fe('0x5a'),'DATE':_0x22fe('0x5b'),'HOUR':_0x22fe('0x5c'),'ROUND':_0x22fe('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c8842=function(_0x24d1cc){return!_[_0x22fe('0x5f')]([_0x22fe('0x60'),'IS\x20NOT\x20NULL',_0x22fe('0x62'),_0x22fe('0x63')],_0x24d1cc);};var _0x4ebca2=function(_0x168c2f){if(!_0x168c2f||!_0x168c2f['rules'][_0x22fe('0x37')]){return'';}for(var _0x3f2cf9='(',_0x91e443=0x0;_0x91e443<_0x168c2f[_0x22fe('0x64')][_0x22fe('0x37')];_0x91e443+=0x1){_0x91e443>0x0&&(_0x3f2cf9+='\x20'+_0x168c2f[_0x22fe('0x65')]+'\x20');_0x3f2cf9+=_0x168c2f['rules'][_0x91e443]['group']?_0x4ebca2(_0x168c2f[_0x22fe('0x64')][_0x91e443]['group']):_0x168c2f['rules'][_0x91e443][_0x22fe('0x67')]+'\x20'+_0x168c2f['rules'][_0x91e443][_0x22fe('0x68')]+(_0x1c8842(_0x168c2f[_0x22fe('0x64')][_0x91e443][_0x22fe('0x68')])?'\x20'+_0x168c2f[_0x22fe('0x64')][_0x91e443]['value']:'');}return _0x3f2cf9+')';};var _0x104fb4={'where':{'id':_0x1b7b87[_0x22fe('0x4d')]['id']}},_0x524ce1,_0x2ba773,_0x413187,_0x305202,_0x3b9fb7;_0x104fb4=_[_0x22fe('0x3e')]({},_0x104fb4,_0x1b7b87[_0x22fe('0x40')]);return db[_0x22fe('0x2c')][_0x22fe('0x4a')](_0x104fb4)[_0x22fe('0x23')](function(_0x4fcced){if(_0x4fcced){_0x524ce1=_0x4fcced;return _0x4fcced[_0x22fe('0x87')]();}return null;})[_0x22fe('0x23')](function(_0x5be570){if(_0x5be570){if(!_0x5be570['length']){throw new db[(_0x22fe('0x88'))][(_0x22fe('0x89'))](_0x22fe('0x69'),0x193);}_0x2ba773=_0x5be570;return db[_0x22fe('0x6a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x2dbdf6){if(_0x2dbdf6){_0x413187=_['keyBy'](_0x2dbdf6,'id');var _0x206086;var _0x2fb403=squel[_0x22fe('0x6d')]();_0x2fb403[_0x22fe('0x6e')](_0x524ce1['table']);for(var _0x326bb5=0x0;_0x326bb5<_0x2ba773[_0x22fe('0x37')];_0x326bb5+=0x1){_0x206086=_0x2ba773[_0x326bb5]['MetricId']?_0x413187[_0x2ba773[_0x326bb5][_0x22fe('0x70')]][_0x22fe('0x71')]:_0x2ba773[_0x326bb5][_0x22fe('0x67')];_0x206086=_0x2ba773[_0x326bb5][_0x22fe('0x72')]?_[_0x22fe('0x73')](_0x391802[_0x2ba773[_0x326bb5]['function']],'%s',_0x206086):_0x206086;_0x206086=_0x2ba773[_0x326bb5]['format']?_[_0x22fe('0x73')](_0x7de659[_0x2ba773[_0x326bb5][_0x22fe('0x74')]],'%s',_0x206086):_0x206086;if(_0x2ba773[_0x326bb5][_0x22fe('0x75')]){_0x2fb403['group'](_0x206086);}_0x2ba773[_0x326bb5][_0x22fe('0x76')]&&_0x2fb403['order'](_0x206086,_0x2ba773[_0x326bb5]['orderBy']===_0x22fe('0x77')?![]:!![]);_0x2fb403['field'](_0x206086,_0x2ba773[_0x326bb5][_0x22fe('0x8a')]||_0x206086);}if(_0x524ce1[_0x22fe('0x78')]){_0x524ce1[_0x22fe('0x78')]=JSON[_0x22fe('0x79')](_0x524ce1[_0x22fe('0x78')]);for(var _0x561d71=0x0;_0x561d71<_0x524ce1[_0x22fe('0x78')][_0x22fe('0x37')];_0x561d71+=0x1){if(_0x524ce1[_0x22fe('0x78')][_0x561d71]['type']&&_['includes'](_0x180d29,_0x524ce1[_0x22fe('0x78')][_0x561d71][_0x22fe('0x2f')])&&_0x524ce1['joins'][_0x561d71][_0x22fe('0x7d')]&&_0x524ce1['joins'][_0x561d71][_0x22fe('0x7a')]&&_0x524ce1[_0x22fe('0x78')][_0x561d71][_0x22fe('0x7b')]){_0x2fb403[_0x524ce1['joins'][_0x561d71][_0x22fe('0x2f')]](_0x524ce1['joins'][_0x561d71][_0x22fe('0x7a')],null,util[_0x22fe('0x74')](_0x22fe('0x7c'),_0x524ce1[_0x22fe('0x6f')],_0x524ce1[_0x22fe('0x78')][_0x561d71]['parentKey'],_0x524ce1[_0x22fe('0x78')][_0x561d71]['foreignTable'],_0x524ce1[_0x22fe('0x78')][_0x561d71]['foreignKey']));}}}if(_0x524ce1[_0x22fe('0x7e')]){_0x524ce1[_0x22fe('0x7e')]=JSON[_0x22fe('0x79')](_0x524ce1['conditions']);_0x2fb403[_0x22fe('0x3c')](_0x4ebca2(_0x524ce1[_0x22fe('0x7e')][_0x22fe('0x66')]));}_0x3b9fb7=_0x2fb403['clone']();_0x2fb403[_0x22fe('0x1d')](_0x2cb27a);_0x2fb403[_0x22fe('0x1b')](0x0);logger[_0x22fe('0x80')]('Limited\x20Query:',_0x2fb403['toString']());return dbH[_0x22fe('0x83')][_0x22fe('0x32')](_0x2fb403['toString'](),{'type':dbH[_0x22fe('0x83')][_0x22fe('0x84')][_0x22fe('0x85')]});}})[_0x22fe('0x23')](function(){return{'sql':_0x3b9fb7[_0x22fe('0x82')]()};})[_0x22fe('0x23')](respondWithResult(_0x11d91e,null))[_0x22fe('0x43')](handleError(_0x11d91e,null));}; \ No newline at end of file +var _0x52ad=['select','from','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','parse','joins','type','parentKey','foreignTable','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','getFields','%s.%s\x20=\x20%s.%s','foreignKey','output','web','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','DESC','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','filter','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy'];(function(_0x2a7c64,_0x426002){var _0x282583=function(_0x2e7326){while(--_0x2e7326){_0x2a7c64['push'](_0x2a7c64['shift']());}};_0x282583(++_0x426002);}(_0x52ad,0xd4));var _0xd52a=function(_0x377007,_0x4d6289){_0x377007=_0x377007-0x0;var _0x32458b=_0x52ad[_0x377007];return _0x32458b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd52a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd52a('0x1'));var moment=require(_0xd52a('0x2'));var BPromise=require(_0xd52a('0x3'));var Mustache=require('mustache');var util=require(_0xd52a('0x4'));var path=require('path');var sox=require(_0xd52a('0x5'));var csv=require(_0xd52a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd52a('0x7'));var _=require(_0xd52a('0x8'));var squel=require(_0xd52a('0x9'));var crypto=require(_0xd52a('0xa'));var jsforce=require(_0xd52a('0xb'));var deskjs=require(_0xd52a('0xc'));var toCsv=require(_0xd52a('0x6'));var querystring=require(_0xd52a('0xd'));var Papa=require(_0xd52a('0xe'));var Redis=require(_0xd52a('0xf'));var authService=require(_0xd52a('0x10'));var qs=require(_0xd52a('0x11'));var as=require(_0xd52a('0x12'));var hardwareService=require(_0xd52a('0x13'));var logger=require(_0xd52a('0x14'))(_0xd52a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd52a('0x16'));var db=require(_0xd52a('0x17'))['db'];var dbH=require(_0xd52a('0x17'))['dbH'];function respondWithStatusCode(_0x27cf1c,_0x4e5687){_0x4e5687=_0x4e5687||0xcc;return function(_0x2ed2e0){if(_0x2ed2e0){return _0x27cf1c[_0xd52a('0x18')](_0x4e5687);}return _0x27cf1c[_0xd52a('0x19')](_0x4e5687)[_0xd52a('0x1a')]();};}function respondWithResult(_0x21ace8,_0x586408){_0x586408=_0x586408||0xc8;return function(_0x522436){if(_0x522436){return _0x21ace8[_0xd52a('0x19')](_0x586408)[_0xd52a('0x1b')](_0x522436);}};}function respondWithFilteredResult(_0x35119b,_0x44b0c5){return function(_0x197f2b){if(_0x197f2b){var _0x47075d=typeof _0x44b0c5['offset']===_0xd52a('0x1c')&&typeof _0x44b0c5['limit']===_0xd52a('0x1c');var _0x50e946=_0x197f2b[_0xd52a('0x1d')];var _0x2f5283=_0x47075d?0x0:_0x44b0c5[_0xd52a('0x1e')];var _0x3f8ce3=_0x47075d?_0x197f2b[_0xd52a('0x1d')]:_0x44b0c5['offset']+_0x44b0c5['limit'];var _0x2124ff;if(_0x3f8ce3>=_0x50e946){_0x3f8ce3=_0x50e946;_0x2124ff=0xc8;}else{_0x2124ff=0xce;}_0x35119b['status'](_0x2124ff);return _0x35119b[_0xd52a('0x1f')]('Content-Range',_0x2f5283+'-'+_0x3f8ce3+'/'+_0x50e946)[_0xd52a('0x1b')](_0x197f2b);}return null;};}function patchUpdates(_0x5642cf){return function(_0x30a144){try{jsonpatch[_0xd52a('0x20')](_0x30a144,_0x5642cf,!![]);}catch(_0x43a578){return BPromise['reject'](_0x43a578);}return _0x30a144[_0xd52a('0x21')]();};}function saveUpdates(_0x2ffed9,_0x55e9ae){return function(_0x3fcf1e){if(_0x3fcf1e){return _0x3fcf1e[_0xd52a('0x22')](_0x2ffed9)[_0xd52a('0x23')](function(_0x2a781d){return _0x2a781d;});}return null;};}function removeEntity(_0x3d4e37,_0x26d258){return function(_0x2530ed){if(_0x2530ed){return _0x2530ed[_0xd52a('0x24')]()[_0xd52a('0x23')](function(){var _0x42e901=_0x2530ed['get']({'plain':!![]});var _0x1e41e3=_0xd52a('0x25');return db[_0xd52a('0x26')][_0xd52a('0x24')]({'where':{'type':_0x1e41e3,'resourceId':_0x42e901['id']}})[_0xd52a('0x23')](function(){return _0x2530ed;});})[_0xd52a('0x23')](function(){_0x3d4e37[_0xd52a('0x19')](0xcc)[_0xd52a('0x1a')]();});}};}function handleEntityNotFound(_0x1ac9c9,_0xf2e52d){return function(_0x5dacea){if(!_0x5dacea){_0x1ac9c9[_0xd52a('0x18')](0x194);}return _0x5dacea;};}function handleError(_0x51f5ad,_0x46c444){_0x46c444=_0x46c444||0x1f4;return function(_0x41b714){logger[_0xd52a('0x27')](_0x41b714[_0xd52a('0x28')]);if(_0x41b714['name']){delete _0x41b714[_0xd52a('0x29')];}_0x51f5ad[_0xd52a('0x19')](_0x46c444)[_0xd52a('0x2a')](_0x41b714);};}exports[_0xd52a('0x2b')]=function(_0x328bef,_0x21aec8){var _0x1654af={},_0x2200a2={},_0x3aee6d={'count':0x0,'rows':[]};var _0x4b5607=_[_0xd52a('0x2c')](db['AnalyticCustomReport'][_0xd52a('0x2d')],function(_0x228ca1){return{'name':_0x228ca1[_0xd52a('0x2e')],'type':_0x228ca1['type'][_0xd52a('0x2f')]};});_0x2200a2[_0xd52a('0x30')]=_[_0xd52a('0x2c')](_0x4b5607,'name');_0x2200a2[_0xd52a('0x31')]=_[_0xd52a('0x32')](_0x328bef[_0xd52a('0x31')]);_0x2200a2['filters']=_[_0xd52a('0x33')](_0x2200a2[_0xd52a('0x30')],_0x2200a2[_0xd52a('0x31')]);_0x1654af[_0xd52a('0x34')]=_[_0xd52a('0x33')](_0x2200a2[_0xd52a('0x30')],qs[_0xd52a('0x35')](_0x328bef[_0xd52a('0x31')][_0xd52a('0x35')]));_0x1654af[_0xd52a('0x34')]=_0x1654af[_0xd52a('0x34')][_0xd52a('0x36')]?_0x1654af[_0xd52a('0x34')]:_0x2200a2[_0xd52a('0x30')];if(!_0x328bef['query'][_0xd52a('0x37')](_0xd52a('0x38'))){_0x1654af['limit']=qs['limit'](_0x328bef['query'][_0xd52a('0x39')]);_0x1654af[_0xd52a('0x1e')]=qs[_0xd52a('0x1e')](_0x328bef[_0xd52a('0x31')][_0xd52a('0x1e')]);}_0x1654af['order']=qs[_0xd52a('0x3a')](_0x328bef[_0xd52a('0x31')][_0xd52a('0x3a')]);_0x1654af[_0xd52a('0x3b')]=qs[_0xd52a('0x3c')](_[_0xd52a('0x3d')](_0x328bef[_0xd52a('0x31')],_0x2200a2[_0xd52a('0x3c')]),_0x4b5607);if(_0x328bef[_0xd52a('0x31')]['filter']){_0x1654af[_0xd52a('0x3b')]=_[_0xd52a('0x3e')](_0x1654af[_0xd52a('0x3b')],{'$or':_[_0xd52a('0x2c')](_0x4b5607,function(_0x3a62e8){if(_0x3a62e8['type']!=='VIRTUAL'){var _0x1bc0cd={};_0x1bc0cd[_0x3a62e8[_0xd52a('0x29')]]={'$like':'%'+_0x328bef[_0xd52a('0x31')][_0xd52a('0x3f')]+'%'};return _0x1bc0cd;}})});}_0x1654af=_[_0xd52a('0x3e')]({},_0x1654af,_0x328bef[_0xd52a('0x40')]);var _0x51823f={'where':_0x1654af[_0xd52a('0x3b')]};return db[_0xd52a('0x41')][_0xd52a('0x1d')](_0x51823f)[_0xd52a('0x23')](function(_0x549a2f){_0x3aee6d['count']=_0x549a2f;if(_0x328bef[_0xd52a('0x31')][_0xd52a('0x42')]){_0x1654af[_0xd52a('0x43')]=[{'all':!![]}];}return db[_0xd52a('0x41')][_0xd52a('0x44')](_0x1654af);})[_0xd52a('0x23')](function(_0xdd2a62){_0x3aee6d[_0xd52a('0x45')]=_0xdd2a62;return _0x3aee6d;})['then'](respondWithFilteredResult(_0x21aec8,_0x1654af))[_0xd52a('0x46')](handleError(_0x21aec8,null));};exports[_0xd52a('0x47')]=function(_0x309fe7,_0x95f27a){var _0xe6db02={'raw':![],'where':{'id':_0x309fe7[_0xd52a('0x48')]['id']}},_0x1b7880={};_0x1b7880[_0xd52a('0x30')]=_[_0xd52a('0x32')](db[_0xd52a('0x41')][_0xd52a('0x2d')]);_0x1b7880[_0xd52a('0x31')]=_['keys'](_0x309fe7[_0xd52a('0x31')]);_0x1b7880[_0xd52a('0x3c')]=_[_0xd52a('0x33')](_0x1b7880[_0xd52a('0x30')],_0x1b7880[_0xd52a('0x31')]);_0xe6db02['attributes']=_[_0xd52a('0x33')](_0x1b7880[_0xd52a('0x30')],qs['fields'](_0x309fe7[_0xd52a('0x31')][_0xd52a('0x35')]));_0xe6db02['attributes']=_0xe6db02[_0xd52a('0x34')][_0xd52a('0x36')]?_0xe6db02['attributes']:_0x1b7880[_0xd52a('0x30')];if(_0x309fe7[_0xd52a('0x31')][_0xd52a('0x42')]){_0xe6db02[_0xd52a('0x43')]=[{'all':!![]}];}_0xe6db02=_[_0xd52a('0x3e')]({},_0xe6db02,_0x309fe7[_0xd52a('0x40')]);return db[_0xd52a('0x41')][_0xd52a('0x49')](_0xe6db02)[_0xd52a('0x23')](handleEntityNotFound(_0x95f27a,null))['then'](respondWithResult(_0x95f27a,null))[_0xd52a('0x46')](handleError(_0x95f27a,null));};exports[_0xd52a('0x4a')]=function(_0x3dad89,_0x103f51){return db[_0xd52a('0x41')]['create'](_0x3dad89[_0xd52a('0x4b')],{})[_0xd52a('0x23')](function(_0x1e4a7f){var _0x29119c=_0x3dad89[_0xd52a('0x4c')][_0xd52a('0x4d')]({'plain':!![]});if(!_0x29119c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29119c[_0xd52a('0x4e')]==='user'){var _0x43ca7e=_0x1e4a7f[_0xd52a('0x4d')]({'plain':!![]});var _0x1033c0='Reports';return db[_0xd52a('0x4f')][_0xd52a('0x49')]({'where':{'name':_0x1033c0,'userProfileId':_0x29119c['userProfileId']},'raw':!![]})[_0xd52a('0x23')](function(_0x498530){if(_0x498530&&_0x498530[_0xd52a('0x50')]===0x0){return db[_0xd52a('0x26')]['create']({'name':_0x43ca7e[_0xd52a('0x29')],'resourceId':_0x43ca7e['id'],'type':_0xd52a('0x25'),'sectionId':_0x498530['id']},{})[_0xd52a('0x23')](function(){return _0x1e4a7f;});}else{return _0x1e4a7f;}})['catch'](function(_0x42d5ff){logger[_0xd52a('0x27')](_0xd52a('0x51'),_0x42d5ff);throw _0x42d5ff;});}return _0x1e4a7f;})[_0xd52a('0x23')](respondWithResult(_0x103f51,0xc9))['catch'](handleError(_0x103f51,null));};exports['update']=function(_0x17b2a8,_0x30433e){if(_0x17b2a8[_0xd52a('0x4b')]['id']){delete _0x17b2a8[_0xd52a('0x4b')]['id'];}return db[_0xd52a('0x41')][_0xd52a('0x49')]({'where':{'id':_0x17b2a8['params']['id']}})['then'](handleEntityNotFound(_0x30433e,null))[_0xd52a('0x23')](saveUpdates(_0x17b2a8['body'],null))[_0xd52a('0x23')](respondWithResult(_0x30433e,null))[_0xd52a('0x46')](handleError(_0x30433e,null));};exports[_0xd52a('0x24')]=function(_0x2a4b15,_0x46661e){return db[_0xd52a('0x41')][_0xd52a('0x49')]({'where':{'id':_0x2a4b15[_0xd52a('0x48')]['id']}})['then'](handleEntityNotFound(_0x46661e,null))[_0xd52a('0x23')](removeEntity(_0x46661e,null))[_0xd52a('0x46')](handleError(_0x46661e,null));};exports[_0xd52a('0x52')]=function(_0x3e1be1,_0x1cfff8){var _0x1aa465=0xa;var _0x40a385=[_0xd52a('0x53'),'left_join',_0xd52a('0x54'),_0xd52a('0x55')];var _0x48f836={'SUM':_0xd52a('0x56'),'COUNT':_0xd52a('0x57'),'COUNT DISTINCT':_0xd52a('0x58'),'MAX':_0xd52a('0x59'),'MIN':_0xd52a('0x5a'),'AVG':_0xd52a('0x5b'),'GROUP_CONCAT':_0xd52a('0x5c'),'GROUP_CONCAT ASC':_0xd52a('0x5d'),'GROUP_CONCAT DESC':_0xd52a('0x5e')};var _0xa43632={'SEC_TO_TIME':_0xd52a('0x5f'),'DATE':_0xd52a('0x60'),'HOUR':_0xd52a('0x61'),'ROUND':_0xd52a('0x62'),'UNIX_TIMESTAMP':_0xd52a('0x63')};var _0xdb2a08=function(_0x5a7f1c){return!_[_0xd52a('0x64')]([_0xd52a('0x65'),_0xd52a('0x66'),_0xd52a('0x67'),_0xd52a('0x68')],_0x5a7f1c);};var _0x18cb63=function(_0x29bfe6){if(!_0x29bfe6||!_0x29bfe6[_0xd52a('0x69')][_0xd52a('0x36')]){return'';}for(var _0x3bf19f='(',_0x3ca657=0x0;_0x3ca657<_0x29bfe6[_0xd52a('0x69')][_0xd52a('0x36')];_0x3ca657+=0x1){_0x3ca657>0x0&&(_0x3bf19f+='\x20'+_0x29bfe6[_0xd52a('0x6a')]+'\x20');_0x3bf19f+=_0x29bfe6[_0xd52a('0x69')][_0x3ca657][_0xd52a('0x6b')]?_0x18cb63(_0x29bfe6[_0xd52a('0x69')][_0x3ca657][_0xd52a('0x6b')]):_0x29bfe6[_0xd52a('0x69')][_0x3ca657][_0xd52a('0x6c')]+'\x20'+_0x29bfe6[_0xd52a('0x69')][_0x3ca657][_0xd52a('0x6d')]+(_0xdb2a08(_0x29bfe6[_0xd52a('0x69')][_0x3ca657]['condition'])?'\x20'+_0x29bfe6['rules'][_0x3ca657][_0xd52a('0x6e')]:'');}return _0x3bf19f+')';};var _0xec14e7={'where':{'id':_0x3e1be1[_0xd52a('0x48')]['id']}},_0x5d5c84,_0x54bb18,_0x30167f,_0x3a086f,_0x584af1;_0xec14e7=_['merge']({},_0xec14e7,_0x3e1be1[_0xd52a('0x40')]);return db[_0xd52a('0x41')]['find'](_0xec14e7)[_0xd52a('0x23')](function(_0x3998cf){if(_0x3998cf){_0x5d5c84=_0x3998cf;return _0x3998cf['getFields']();}return null;})[_0xd52a('0x23')](function(_0x42c99a){if(_0x42c99a){if(!_0x42c99a[_0xd52a('0x36')]){throw new db[(_0xd52a('0x6f'))][(_0xd52a('0x70'))](_0xd52a('0x71'),0x193);}_0x54bb18=_0x42c99a;return db[_0xd52a('0x72')][_0xd52a('0x44')]({'raw':!![]});}return null;})[_0xd52a('0x23')](function(_0x544c63){if(_0x544c63){_0x30167f=_[_0xd52a('0x73')](_0x544c63,'id');var _0x733b69;var _0x4d7194=squel[_0xd52a('0x74')]();_0x4d7194[_0xd52a('0x75')](_0x5d5c84['table']);for(var _0x3d447a=0x0;_0x3d447a<_0x54bb18[_0xd52a('0x36')];_0x3d447a+=0x1){_0x733b69=_0x54bb18[_0x3d447a][_0xd52a('0x76')]?_0x30167f[_0x54bb18[_0x3d447a][_0xd52a('0x76')]][_0xd52a('0x77')]:_0x54bb18[_0x3d447a][_0xd52a('0x6c')];_0x733b69=_0x54bb18[_0x3d447a][_0xd52a('0x78')]?_[_0xd52a('0x79')](_0x48f836[_0x54bb18[_0x3d447a][_0xd52a('0x78')]],'%s',_0x733b69):_0x733b69;_0x733b69=_0x54bb18[_0x3d447a][_0xd52a('0x7a')]?_[_0xd52a('0x79')](_0xa43632[_0x54bb18[_0x3d447a][_0xd52a('0x7a')]],'%s',_0x733b69):_0x733b69;if(_0x54bb18[_0x3d447a][_0xd52a('0x7b')]){_0x4d7194[_0xd52a('0x6b')](_0x733b69);}_0x54bb18[_0x3d447a][_0xd52a('0x7c')]&&_0x4d7194[_0xd52a('0x7d')](_0x733b69,_0x54bb18[_0x3d447a][_0xd52a('0x7c')]==='DESC'?![]:!![]);_0x4d7194[_0xd52a('0x6c')](_0x733b69,_0x54bb18[_0x3d447a][_0xd52a('0x7e')]||_0x733b69);}if(_0x5d5c84['joins']){_0x5d5c84['joins']=JSON[_0xd52a('0x7f')](_0x5d5c84['joins']);for(var _0x374f61=0x0;_0x374f61<_0x5d5c84[_0xd52a('0x80')][_0xd52a('0x36')];_0x374f61+=0x1){if(_0x5d5c84[_0xd52a('0x80')][_0x374f61][_0xd52a('0x81')]&&_[_0xd52a('0x64')](_0x40a385,_0x5d5c84['joins'][_0x374f61][_0xd52a('0x81')])&&_0x5d5c84[_0xd52a('0x80')][_0x374f61][_0xd52a('0x82')]&&_0x5d5c84[_0xd52a('0x80')][_0x374f61][_0xd52a('0x83')]&&_0x5d5c84[_0xd52a('0x80')][_0x374f61]['foreignKey']){_0x4d7194[_0x5d5c84[_0xd52a('0x80')][_0x374f61][_0xd52a('0x81')]](_0x5d5c84['joins'][_0x374f61][_0xd52a('0x83')],null,util[_0xd52a('0x7a')]('%s.%s\x20=\x20%s.%s',_0x5d5c84[_0xd52a('0x84')],_0x5d5c84[_0xd52a('0x80')][_0x374f61][_0xd52a('0x82')],_0x5d5c84[_0xd52a('0x80')][_0x374f61]['foreignTable'],_0x5d5c84[_0xd52a('0x80')][_0x374f61]['foreignKey']));}}}if(_0x5d5c84[_0xd52a('0x85')]){_0x5d5c84[_0xd52a('0x85')]=JSON[_0xd52a('0x7f')](_0x5d5c84['conditions']);_0x4d7194['where'](_0x18cb63(_0x5d5c84['conditions']['group']));}_0x584af1=_0x4d7194[_0xd52a('0x86')]();_0x4d7194[_0xd52a('0x39')](_0x1aa465);_0x4d7194['offset'](0x0);logger[_0xd52a('0x87')](_0xd52a('0x88'),_0x4d7194[_0xd52a('0x89')]());return dbH[_0xd52a('0x8a')][_0xd52a('0x31')](_0x4d7194['toString'](),{'type':dbH['sequelize'][_0xd52a('0x8b')][_0xd52a('0x8c')]});}})[_0xd52a('0x23')](respondWithResult(_0x1cfff8,null))[_0xd52a('0x46')](handleError(_0x1cfff8,null));};function runReport(_0x35d522,_0xe62409,_0x23265f){var _0xe7dc7b=_0xe62409[_0xd52a('0x29')];var _0x59604a=0xa;var _0x4f48ca=[_0xd52a('0x53'),_0xd52a('0x8d'),_0xd52a('0x54'),_0xd52a('0x55')];var _0x55dd84={'SUM':_0xd52a('0x56'),'COUNT':_0xd52a('0x57'),'COUNT DISTINCT':_0xd52a('0x58'),'MAX':'MAX(%s)','MIN':_0xd52a('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd52a('0x5d'),'GROUP_CONCAT DESC':_0xd52a('0x5e')};var _0x3ffff4={'SEC_TO_TIME':_0xd52a('0x5f'),'DATE':_0xd52a('0x60'),'HOUR':_0xd52a('0x61'),'ROUND':_0xd52a('0x62'),'UNIX_TIMESTAMP':_0xd52a('0x63')};var _0x3b65d4=function(_0x511629){return!_[_0xd52a('0x64')]([_0xd52a('0x65'),_0xd52a('0x66'),'IS\x20EMPTY',_0xd52a('0x68')],_0x511629);};var _0x5c490f=function(_0x4b90c6){if(!_0x4b90c6||!_0x4b90c6[_0xd52a('0x69')][_0xd52a('0x36')]){return'';}for(var _0x59379b='(',_0x326602=0x0;_0x326602<_0x4b90c6[_0xd52a('0x69')][_0xd52a('0x36')];_0x326602+=0x1){_0x326602>0x0&&(_0x59379b+='\x20'+_0x4b90c6['operator']+'\x20');_0x59379b+=_0x4b90c6[_0xd52a('0x69')][_0x326602]['group']?_0x5c490f(_0x4b90c6[_0xd52a('0x69')][_0x326602][_0xd52a('0x6b')]):_0x4b90c6[_0xd52a('0x69')][_0x326602][_0xd52a('0x6c')]+'\x20'+_0x4b90c6['rules'][_0x326602][_0xd52a('0x6d')]+(_0x3b65d4(_0x4b90c6[_0xd52a('0x69')][_0x326602][_0xd52a('0x6d')])?'\x20'+_0x4b90c6[_0xd52a('0x69')][_0x326602]['value']:'');}return _0x59379b+')';};var _0x1c80e7={'where':{'id':_0x35d522['id']}},_0x2fad80,_0x502185,_0x72b725,_0x437171,_0x206bda;_0x1c80e7=_[_0xd52a('0x3e')]({},_0x1c80e7,_0x23265f);return db[_0xd52a('0x41')][_0xd52a('0x49')](_0x1c80e7)[_0xd52a('0x23')](function(_0x2d1508){if(_0x2d1508){_0x2fad80=_0x2d1508;return _0x2d1508[_0xd52a('0x8e')]();}return null;})[_0xd52a('0x23')](function(_0x37df04){if(_0x37df04){if(!_0x37df04[_0xd52a('0x36')]){throw new db[(_0xd52a('0x6f'))][(_0xd52a('0x70'))](_0xd52a('0x71'),0x193);}_0x502185=_0x37df04;return db[_0xd52a('0x72')][_0xd52a('0x44')]({'raw':!![]});}return null;})[_0xd52a('0x23')](function(_0x2d6b10){if(_0x2d6b10){_0x72b725=_[_0xd52a('0x73')](_0x2d6b10,'id');var _0xb1d32c;var _0x379518=squel[_0xd52a('0x74')]();_0x379518[_0xd52a('0x75')](_0x2fad80[_0xd52a('0x84')]);for(var _0x2e7809=0x0;_0x2e7809<_0x502185['length'];_0x2e7809+=0x1){_0xb1d32c=_0x502185[_0x2e7809][_0xd52a('0x76')]?_0x72b725[_0x502185[_0x2e7809]['MetricId']][_0xd52a('0x77')]:_0x502185[_0x2e7809]['field'];_0xb1d32c=_0x502185[_0x2e7809][_0xd52a('0x78')]?_['replace'](_0x55dd84[_0x502185[_0x2e7809]['function']],'%s',_0xb1d32c):_0xb1d32c;_0xb1d32c=_0x502185[_0x2e7809][_0xd52a('0x7a')]?_[_0xd52a('0x79')](_0x3ffff4[_0x502185[_0x2e7809][_0xd52a('0x7a')]],'%s',_0xb1d32c):_0xb1d32c;if(_0x502185[_0x2e7809][_0xd52a('0x7b')]){_0x379518[_0xd52a('0x6b')](_0xb1d32c);}_0x502185[_0x2e7809][_0xd52a('0x7c')]&&_0x379518['order'](_0xb1d32c,_0x502185[_0x2e7809][_0xd52a('0x7c')]==='DESC'?![]:!![]);_0x379518[_0xd52a('0x6c')](_0xb1d32c,_0x502185[_0x2e7809][_0xd52a('0x7e')]||_0xb1d32c);}if(_0x2fad80[_0xd52a('0x80')]){_0x2fad80[_0xd52a('0x80')]=JSON[_0xd52a('0x7f')](_0x2fad80[_0xd52a('0x80')]);for(var _0x33cf0b=0x0;_0x33cf0b<_0x2fad80[_0xd52a('0x80')][_0xd52a('0x36')];_0x33cf0b+=0x1){if(_0x2fad80['joins'][_0x33cf0b]['type']&&_['includes'](_0x4f48ca,_0x2fad80['joins'][_0x33cf0b][_0xd52a('0x81')])&&_0x2fad80[_0xd52a('0x80')][_0x33cf0b]['parentKey']&&_0x2fad80[_0xd52a('0x80')][_0x33cf0b][_0xd52a('0x83')]&&_0x2fad80[_0xd52a('0x80')][_0x33cf0b]['foreignKey']){_0x379518[_0x2fad80[_0xd52a('0x80')][_0x33cf0b]['type']](_0x2fad80['joins'][_0x33cf0b][_0xd52a('0x83')],null,util[_0xd52a('0x7a')](_0xd52a('0x8f'),_0x2fad80[_0xd52a('0x84')],_0x2fad80[_0xd52a('0x80')][_0x33cf0b][_0xd52a('0x82')],_0x2fad80[_0xd52a('0x80')][_0x33cf0b][_0xd52a('0x83')],_0x2fad80[_0xd52a('0x80')][_0x33cf0b][_0xd52a('0x90')]));}}}if(_0x2fad80['conditions']){_0x2fad80['conditions']=JSON['parse'](_0x2fad80[_0xd52a('0x85')]);_0x379518[_0xd52a('0x3b')](_0x5c490f(_0x2fad80[_0xd52a('0x85')][_0xd52a('0x6b')]));}_0x206bda=_0x379518[_0xd52a('0x86')]();_0x379518[_0xd52a('0x39')](_0x59604a);_0x379518[_0xd52a('0x1e')](0x0);return;}})[_0xd52a('0x23')](function(){if(_0xe62409[_0xd52a('0x91')]===_0xd52a('0x92')){return null;}var _0x94f620=_[_0xd52a('0x3e')](_0xe62409,{'name':_0xe62409['fullPath']||_0xe62409['name']||_0x2fad80['name'],'basename':_0xe7dc7b,'savename':util[_0xd52a('0x7a')](_0xd52a('0x93'),_0xe62409[_0xd52a('0x29')]||_0x2fad80['name'],require(_0xd52a('0x94'))['generate'](0x4),_0xe62409[_0xd52a('0x91')]||_0xd52a('0x95')),'reportId':_0x2fad80['id'],'reportType':_0xd52a('0x96')});return db[_0xd52a('0x97')]['create'](_0x94f620,{'raw':!![]});})[_0xd52a('0x23')](function(_0x4d3b03){if(_0x2fad80[_0xd52a('0x84')]===_0xd52a('0x98')){_0x206bda[_0xd52a('0x3b')](_0x2fad80[_0xd52a('0x84')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xe62409[_0xd52a('0x99')],_0xe62409['endDate']);}else{_0x206bda['where'](_0x2fad80[_0xd52a('0x84')]+_0xd52a('0x9a'),_0xe62409[_0xd52a('0x99')],_0xe62409['endDate']);}if(_0x4d3b03){logger[_0xd52a('0x9b')](_0xd52a('0x9c'),_0x206bda['toString']());require(_0xd52a('0x9d'))['fork'](path[_0xd52a('0x53')](__dirname,_0xd52a('0x9e'),_0x4d3b03[_0xd52a('0x91')]),[_0x4d3b03['id'],_0x206bda['toString'](),path[_0xd52a('0x53')](__dirname,_0xd52a('0x9f'),_0x4d3b03[_0xd52a('0xa0')]),_0xe7dc7b]);return _0x4d3b03;}else{var _0x530190=squel[_0xd52a('0x74')]();_0x530190[_0xd52a('0x75')]('('+_0x206bda[_0xd52a('0x89')]()+')',_0xd52a('0xa1'));_0x530190[_0xd52a('0x6c')](_0xd52a('0xa2'),_0xd52a('0x1d'));_0x206bda[_0xd52a('0x39')](_0xe62409[_0xd52a('0x39')]||_0x59604a);_0x206bda['offset'](_0xe62409[_0xd52a('0x1e')]||0x0);return dbH['sequelize'][_0xd52a('0x31')](_0x530190[_0xd52a('0x89')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']})[_0xd52a('0x23')](function(_0x31429c){if(!_0x31429c['length']){_0x437171=0x0;}else{_0x437171=_0x31429c[0x0][_0xd52a('0x1d')]||0x0;}return dbH[_0xd52a('0x8a')][_0xd52a('0x31')](_0x206bda[_0xd52a('0x89')](),{'type':dbH[_0xd52a('0x8a')][_0xd52a('0x8b')]['SELECT']});})['then'](function(_0x51402d){return{'rows':_0x51402d||[],'count':_0x437171};});}});}exports['run']=function(_0x2765f3,_0x36270a){return runReport(_0x2765f3[_0xd52a('0x48')],_0x2765f3['query'],_0x2765f3['options'])[_0xd52a('0x23')](respondWithResult(_0x36270a,null))[_0xd52a('0x46')](handleError(_0x36270a,null));};exports['runReport']=runReport;exports['query']=function(_0x1890cd,_0x47abe8){var _0x221bb0=0xa;var _0x1bcc53=[_0xd52a('0x53'),_0xd52a('0x8d'),_0xd52a('0x54'),'cross_join'];var _0x48cc30={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd52a('0x58'),'MAX':_0xd52a('0x59'),'MIN':_0xd52a('0x5a'),'AVG':_0xd52a('0x5b'),'GROUP_CONCAT':_0xd52a('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd52a('0x5e')};var _0x444804={'SEC_TO_TIME':_0xd52a('0x5f'),'DATE':'DATE(%s)','HOUR':_0xd52a('0x61'),'ROUND':_0xd52a('0x62'),'UNIX_TIMESTAMP':_0xd52a('0x63')};var _0x19a84a=function(_0x575144){return!_[_0xd52a('0x64')](['IS\x20NULL',_0xd52a('0x66'),_0xd52a('0x67'),'IS\x20NOT\x20EMPTY'],_0x575144);};var _0x49f5da=function(_0x33bba7){if(!_0x33bba7||!_0x33bba7[_0xd52a('0x69')][_0xd52a('0x36')]){return'';}for(var _0x3d27be='(',_0x282272=0x0;_0x282272<_0x33bba7[_0xd52a('0x69')][_0xd52a('0x36')];_0x282272+=0x1){_0x282272>0x0&&(_0x3d27be+='\x20'+_0x33bba7[_0xd52a('0x6a')]+'\x20');_0x3d27be+=_0x33bba7[_0xd52a('0x69')][_0x282272][_0xd52a('0x6b')]?_0x49f5da(_0x33bba7[_0xd52a('0x69')][_0x282272][_0xd52a('0x6b')]):_0x33bba7[_0xd52a('0x69')][_0x282272][_0xd52a('0x6c')]+'\x20'+_0x33bba7[_0xd52a('0x69')][_0x282272][_0xd52a('0x6d')]+(_0x19a84a(_0x33bba7[_0xd52a('0x69')][_0x282272][_0xd52a('0x6d')])?'\x20'+_0x33bba7[_0xd52a('0x69')][_0x282272]['value']:'');}return _0x3d27be+')';};var _0x3e47bb={'where':{'id':_0x1890cd[_0xd52a('0x48')]['id']}},_0x426031,_0x86bcaa,_0x42ab96,_0x25e010,_0x4ae9f3;_0x3e47bb=_[_0xd52a('0x3e')]({},_0x3e47bb,_0x1890cd[_0xd52a('0x40')]);return db[_0xd52a('0x41')][_0xd52a('0x49')](_0x3e47bb)[_0xd52a('0x23')](function(_0x3e1fb4){if(_0x3e1fb4){_0x426031=_0x3e1fb4;return _0x3e1fb4[_0xd52a('0x8e')]();}return null;})[_0xd52a('0x23')](function(_0x19587c){if(_0x19587c){if(!_0x19587c['length']){throw new db[(_0xd52a('0x6f'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x86bcaa=_0x19587c;return db[_0xd52a('0x72')][_0xd52a('0x44')]({'raw':!![]});}return null;})[_0xd52a('0x23')](function(_0x9e831){if(_0x9e831){_0x42ab96=_['keyBy'](_0x9e831,'id');var _0x3c7c61;var _0x4e07b5=squel['select']();_0x4e07b5['from'](_0x426031[_0xd52a('0x84')]);for(var _0x43d56c=0x0;_0x43d56c<_0x86bcaa[_0xd52a('0x36')];_0x43d56c+=0x1){_0x3c7c61=_0x86bcaa[_0x43d56c][_0xd52a('0x76')]?_0x42ab96[_0x86bcaa[_0x43d56c]['MetricId']][_0xd52a('0x77')]:_0x86bcaa[_0x43d56c]['field'];_0x3c7c61=_0x86bcaa[_0x43d56c][_0xd52a('0x78')]?_[_0xd52a('0x79')](_0x48cc30[_0x86bcaa[_0x43d56c][_0xd52a('0x78')]],'%s',_0x3c7c61):_0x3c7c61;_0x3c7c61=_0x86bcaa[_0x43d56c][_0xd52a('0x7a')]?_[_0xd52a('0x79')](_0x444804[_0x86bcaa[_0x43d56c][_0xd52a('0x7a')]],'%s',_0x3c7c61):_0x3c7c61;if(_0x86bcaa[_0x43d56c]['groupBy']){_0x4e07b5[_0xd52a('0x6b')](_0x3c7c61);}_0x86bcaa[_0x43d56c]['orderBy']&&_0x4e07b5[_0xd52a('0x7d')](_0x3c7c61,_0x86bcaa[_0x43d56c][_0xd52a('0x7c')]===_0xd52a('0xa3')?![]:!![]);_0x4e07b5[_0xd52a('0x6c')](_0x3c7c61,_0x86bcaa[_0x43d56c][_0xd52a('0x7e')]||_0x3c7c61);}if(_0x426031[_0xd52a('0x80')]){_0x426031[_0xd52a('0x80')]=JSON[_0xd52a('0x7f')](_0x426031[_0xd52a('0x80')]);for(var _0x1f94fd=0x0;_0x1f94fd<_0x426031['joins'][_0xd52a('0x36')];_0x1f94fd+=0x1){if(_0x426031[_0xd52a('0x80')][_0x1f94fd][_0xd52a('0x81')]&&_[_0xd52a('0x64')](_0x1bcc53,_0x426031[_0xd52a('0x80')][_0x1f94fd][_0xd52a('0x81')])&&_0x426031['joins'][_0x1f94fd][_0xd52a('0x82')]&&_0x426031[_0xd52a('0x80')][_0x1f94fd][_0xd52a('0x83')]&&_0x426031[_0xd52a('0x80')][_0x1f94fd][_0xd52a('0x90')]){_0x4e07b5[_0x426031['joins'][_0x1f94fd][_0xd52a('0x81')]](_0x426031['joins'][_0x1f94fd][_0xd52a('0x83')],null,util[_0xd52a('0x7a')](_0xd52a('0x8f'),_0x426031[_0xd52a('0x84')],_0x426031[_0xd52a('0x80')][_0x1f94fd][_0xd52a('0x82')],_0x426031[_0xd52a('0x80')][_0x1f94fd][_0xd52a('0x83')],_0x426031[_0xd52a('0x80')][_0x1f94fd]['foreignKey']));}}}if(_0x426031['conditions']){_0x426031[_0xd52a('0x85')]=JSON[_0xd52a('0x7f')](_0x426031[_0xd52a('0x85')]);_0x4e07b5[_0xd52a('0x3b')](_0x49f5da(_0x426031[_0xd52a('0x85')][_0xd52a('0x6b')]));}_0x4ae9f3=_0x4e07b5[_0xd52a('0x86')]();_0x4e07b5[_0xd52a('0x39')](_0x221bb0);_0x4e07b5[_0xd52a('0x1e')](0x0);logger[_0xd52a('0x87')]('Limited\x20Query:',_0x4e07b5[_0xd52a('0x89')]());return dbH[_0xd52a('0x8a')][_0xd52a('0x31')](_0x4e07b5[_0xd52a('0x89')](),{'type':dbH[_0xd52a('0x8a')][_0xd52a('0x8b')]['SELECT']});}})[_0xd52a('0x23')](function(){return{'sql':_0x4ae9f3['toString']()};})[_0xd52a('0x23')](respondWithResult(_0x47abe8,null))[_0xd52a('0x46')](handleError(_0x47abe8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index df4ab82..429cd03 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 _0xecdd=['rimraf','../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3d4b5f,_0x4921be){var _0x5129e2=function(_0x3fbec6){while(--_0x3fbec6){_0x3d4b5f['push'](_0x3d4b5f['shift']());}};_0x5129e2(++_0x4921be);}(_0xecdd,0x1c1));var _0xdecd=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xecdd[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xdecd('0x0'));var util=require('util');var logger=require(_0xdecd('0x1'))(_0xdecd('0x2'));var moment=require(_0xdecd('0x3'));var BPromise=require(_0xdecd('0x4'));var rp=require(_0xdecd('0x5'));var fs=require('fs');var path=require(_0xdecd('0x6'));var rimraf=require(_0xdecd('0x7'));var config=require(_0xdecd('0x8'));var attributes=require(_0xdecd('0x9'));module['exports']=function(_0x41b95e,_0x39f1af){return _0x41b95e[_0xdecd('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0xdecd('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdda=['exports','define','analytics_custom_reports','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfdda,0x1a5));var _0xafdd=function(_0x38136b,_0x35c34e){_0x38136b=_0x38136b-0x0;var _0x3b10b9=_0xfdda[_0x38136b];return _0x3b10b9;};'use strict';var _=require(_0xafdd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xafdd('0x1'));var moment=require(_0xafdd('0x2'));var BPromise=require(_0xafdd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafdd('0x4'));var rimraf=require(_0xafdd('0x5'));var config=require(_0xafdd('0x6'));var attributes=require(_0xafdd('0x7'));module[_0xafdd('0x8')]=function(_0x40a5fd,_0x475292){return _0x40a5fd[_0xafdd('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0xafdd('0xa'),'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 7ff02b5..b39d58c 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 _0xca71=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x17ee0e,_0x4193b7){var _0x519373=function(_0x5c6ec7){while(--_0x5c6ec7){_0x17ee0e['push'](_0x17ee0e['shift']());}};_0x519373(++_0x4193b7);}(_0xca71,0x10c));var _0x1ca7=function(_0x2b6f49,_0x3f5a45){_0x2b6f49=_0x2b6f49-0x0;var _0x26d444=_0xca71[_0x2b6f49];return _0x26d444;};'use strict';var _=require(_0x1ca7('0x0'));var util=require(_0x1ca7('0x1'));var moment=require(_0x1ca7('0x2'));var BPromise=require(_0x1ca7('0x3'));var rs=require(_0x1ca7('0x4'));var fs=require('fs');var Redis=require(_0x1ca7('0x5'));var db=require(_0x1ca7('0x6'))['db'];var utils=require(_0x1ca7('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1ca7('0x8'));var client=jayson[_0x1ca7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbca388,_0xf41e33,_0x439194){return new BPromise(function(_0x12c8b8,_0x5a085a){return client['request'](_0xbca388,_0x439194)[_0x1ca7('0xa')](function(_0x165c6b){logger['info'](_0x1ca7('0xb'),_0xf41e33,_0x1ca7('0xc'));logger[_0x1ca7('0xd')](_0x1ca7('0xe'),_0xf41e33,_0x1ca7('0xc'),JSON[_0x1ca7('0xf')](_0x165c6b));if(_0x165c6b[_0x1ca7('0x10')]){if(_0x165c6b[_0x1ca7('0x10')][_0x1ca7('0x11')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0xf41e33,_0x165c6b['error'][_0x1ca7('0x12')]);return _0x5a085a(_0x165c6b[_0x1ca7('0x10')][_0x1ca7('0x12')]);}logger[_0x1ca7('0x10')](_0x1ca7('0xb'),_0xf41e33,_0x165c6b['error'][_0x1ca7('0x12')]);return _0x12c8b8(_0x165c6b['error'][_0x1ca7('0x12')]);}else{logger[_0x1ca7('0x13')](_0x1ca7('0xb'),_0xf41e33,_0x1ca7('0xc'));_0x12c8b8(_0x165c6b[_0x1ca7('0x14')][_0x1ca7('0x12')]);}})[_0x1ca7('0x15')](function(_0x43be65){logger['error'](_0x1ca7('0xb'),_0xf41e33,_0x43be65);_0x5a085a(_0x43be65);});});} \ No newline at end of file +var _0x5ebc=['info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x1ec1ff,_0x1064d9){var _0x153fc0=function(_0x428b08){while(--_0x428b08){_0x1ec1ff['push'](_0x1ec1ff['shift']());}};_0x153fc0(++_0x1064d9);}(_0x5ebc,0x14f));var _0xc5eb=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x5ebc[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xc5eb('0x0'));var util=require(_0xc5eb('0x1'));var moment=require(_0xc5eb('0x2'));var BPromise=require(_0xc5eb('0x3'));var rs=require(_0xc5eb('0x4'));var fs=require('fs');var Redis=require(_0xc5eb('0x5'));var db=require(_0xc5eb('0x6'))['db'];var utils=require(_0xc5eb('0x7'));var logger=require(_0xc5eb('0x8'))(_0xc5eb('0x9'));var config=require('../../config/environment');var jayson=require(_0xc5eb('0xa'));var client=jayson[_0xc5eb('0xb')][_0xc5eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c10e0,_0x16718f,_0x15362c){return new BPromise(function(_0xd92d63,_0x1609d5){return client[_0xc5eb('0xd')](_0x5c10e0,_0x15362c)[_0xc5eb('0xe')](function(_0x469637){logger[_0xc5eb('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x16718f,'request\x20sent');logger[_0xc5eb('0x10')](_0xc5eb('0x11'),_0x16718f,_0xc5eb('0x12'),JSON['stringify'](_0x469637));if(_0x469637[_0xc5eb('0x13')]){if(_0x469637['error'][_0xc5eb('0x14')]===0x1f4){logger[_0xc5eb('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x16718f,_0x469637['error'][_0xc5eb('0x15')]);return _0x1609d5(_0x469637['error'][_0xc5eb('0x15')]);}logger[_0xc5eb('0x13')](_0xc5eb('0x16'),_0x16718f,_0x469637[_0xc5eb('0x13')]['message']);return _0xd92d63(_0x469637[_0xc5eb('0x13')]['message']);}else{logger[_0xc5eb('0xf')](_0xc5eb('0x16'),_0x16718f,_0xc5eb('0x12'));_0xd92d63(_0x469637[_0xc5eb('0x17')][_0xc5eb('0x15')]);}})[_0xc5eb('0x18')](function(_0x3e590e){logger[_0xc5eb('0x13')](_0xc5eb('0x16'),_0x16718f,_0x3e590e);_0x1609d5(_0x3e590e);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 7344d6b..eb240bb 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 _0x76e4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x552804,_0x3c3d1e){var _0x32be66=function(_0x14c213){while(--_0x14c213){_0x552804['push'](_0x552804['shift']());}};_0x32be66(++_0x3c3d1e);}(_0x76e4,0x7f));var _0x476e=function(_0x48b11d,_0x4a985f){_0x48b11d=_0x48b11d-0x0;var _0x508280=_0x76e4[_0x48b11d];return _0x508280;};'use strict';var multer=require(_0x476e('0x0'));var util=require(_0x476e('0x1'));var path=require(_0x476e('0x2'));var timeout=require(_0x476e('0x3'));var express=require(_0x476e('0x4'));var router=express[_0x476e('0x5')]();var fs_extra=require(_0x476e('0x6'));var auth=require(_0x476e('0x7'));var interaction=require(_0x476e('0x8'));var config=require(_0x476e('0x9'));var controller=require(_0x476e('0xa'));router[_0x476e('0xb')]('/',auth[_0x476e('0xc')](),controller[_0x476e('0xd')]);router[_0x476e('0xb')](_0x476e('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x476e('0xb')](_0x476e('0xf'),auth[_0x476e('0xc')](),controller[_0x476e('0x10')]);router[_0x476e('0xb')](_0x476e('0x11'),auth['isAuthenticated'](),controller[_0x476e('0x12')]);router[_0x476e('0xb')](_0x476e('0x13'),auth['isAuthenticated'](),controller['query']);router[_0x476e('0x14')]('/',auth[_0x476e('0xc')](),controller[_0x476e('0x15')]);router[_0x476e('0x16')](_0x476e('0xe'),auth[_0x476e('0xc')](),controller['update']);router[_0x476e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x476e('0x18')]);module[_0x476e('0x19')]=router; \ No newline at end of file +var _0xe45a=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','preview','/:id/run','run','post','create','put','delete'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0xe45a,0xf0));var _0xae45=function(_0x277557,_0x2f2fbe){_0x277557=_0x277557-0x0;var _0x1f82be=_0xe45a[_0x277557];return _0x1f82be;};'use strict';var multer=require(_0xae45('0x0'));var util=require(_0xae45('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae45('0x2')]();var fs_extra=require(_0xae45('0x3'));var auth=require(_0xae45('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0xae45('0x5')]('/',auth[_0xae45('0x6')](),controller['index']);router['get'](_0xae45('0x7'),auth[_0xae45('0x6')](),controller['show']);router[_0xae45('0x5')]('/:id/preview',auth[_0xae45('0x6')](),controller[_0xae45('0x8')]);router['get'](_0xae45('0x9'),auth['isAuthenticated'](),controller[_0xae45('0xa')]);router['get']('/:id/query',auth[_0xae45('0x6')](),controller['query']);router[_0xae45('0xb')]('/',auth['isAuthenticated'](),controller[_0xae45('0xc')]);router[_0xae45('0xd')](_0xae45('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xae45('0xe')](_0xae45('0x7'),auth[_0xae45('0x6')](),controller[_0xae45('0xf')]);module[_0xae45('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 22ad8f5..cf762f2 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 _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x32243d,_0x26d545){var _0x2cd858=function(_0x271b52){while(--_0x271b52){_0x32243d['push'](_0x32243d['shift']());}};_0x2cd858(++_0x26d545);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x5fc3[_0x5be7aa];return _0x215408;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file +var _0x71ab=['TEXT','exports','STRING'];(function(_0xb82082,_0x14b83f){var _0x6e9730=function(_0x24a9dc){while(--_0x24a9dc){_0xb82082['push'](_0xb82082['shift']());}};_0x6e9730(++_0x14b83f);}(_0x71ab,0x64));var _0xb71a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x71ab[_0x21a9d9];return _0x46adce;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 0ef2dee..f9dc45c 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 _0x187d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','limit','undefined','count','offset','set','json','save','update','then','get','destroy','error','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','order','sort','filter','where','merge','options','includeAll','rows','catch','include','create','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','IS\x20EMPTY','operator','AnalyticMetric','function','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','savename','select','countTable','QueryTypes','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x362742,_0xb47803){var _0x2b9159=function(_0x355dfc){while(--_0x355dfc){_0x362742['push'](_0x362742['shift']());}};_0x2b9159(++_0xb47803);}(_0x187d,0x93));var _0xd187=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x187d[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];var dbH=require(_0xd187('0x1a'))[_0xd187('0x1b')];function respondWithStatusCode(_0x59ee4a,_0x33e3d5){_0x33e3d5=_0x33e3d5||0xcc;return function(_0x18ce42){if(_0x18ce42){return _0x59ee4a[_0xd187('0x1c')](_0x33e3d5);}return _0x59ee4a[_0xd187('0x1d')](_0x33e3d5)['end']();};}function respondWithResult(_0x39a927,_0x2050d5){_0x2050d5=_0x2050d5||0xc8;return function(_0x45ab10){if(_0x45ab10){return _0x39a927[_0xd187('0x1d')](_0x2050d5)['json'](_0x45ab10);}};}function respondWithFilteredResult(_0x245d3e,_0x52a208){return function(_0x5cf218){if(_0x5cf218){var _0x40ed84=typeof _0x52a208['offset']==='undefined'&&typeof _0x52a208[_0xd187('0x1e')]===_0xd187('0x1f');var _0x374fe0=_0x5cf218[_0xd187('0x20')];var _0x21df74=_0x40ed84?0x0:_0x52a208[_0xd187('0x21')];var _0x12b388=_0x40ed84?_0x5cf218[_0xd187('0x20')]:_0x52a208[_0xd187('0x21')]+_0x52a208[_0xd187('0x1e')];var _0x170d5c;if(_0x12b388>=_0x374fe0){_0x12b388=_0x374fe0;_0x170d5c=0xc8;}else{_0x170d5c=0xce;}_0x245d3e[_0xd187('0x1d')](_0x170d5c);return _0x245d3e[_0xd187('0x22')]('Content-Range',_0x21df74+'-'+_0x12b388+'/'+_0x374fe0)[_0xd187('0x23')](_0x5cf218);}return null;};}function patchUpdates(_0x81b988){return function(_0xc5bba5){try{jsonpatch['apply'](_0xc5bba5,_0x81b988,!![]);}catch(_0x5a0360){return BPromise['reject'](_0x5a0360);}return _0xc5bba5[_0xd187('0x24')]();};}function saveUpdates(_0x33741d,_0x249a82){return function(_0x4f62c8){if(_0x4f62c8){return _0x4f62c8[_0xd187('0x25')](_0x33741d)['then'](function(_0x145771){return _0x145771;});}return null;};}function removeEntity(_0x5a7a23,_0x1047f4){return function(_0x54f340){if(_0x54f340){return _0x54f340['destroy']()[_0xd187('0x26')](function(){var _0x4d992b=_0x54f340[_0xd187('0x27')]({'plain':!![]});var _0x598aa4='DefaultReports';return db['UserProfileResource'][_0xd187('0x28')]({'where':{'type':_0x598aa4,'resourceId':_0x4d992b['id']}})[_0xd187('0x26')](function(){return _0x54f340;});})[_0xd187('0x26')](function(){_0x5a7a23[_0xd187('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20ed,_0x2875c8){return function(_0x5c8e52){if(!_0x5c8e52){_0x2a20ed[_0xd187('0x1c')](0x194);}return _0x5c8e52;};}function handleError(_0x1c87ee,_0x34febe){_0x34febe=_0x34febe||0x1f4;return function(_0x4c50a5){logger[_0xd187('0x29')](_0x4c50a5['stack']);if(_0x4c50a5[_0xd187('0x2a')]){delete _0x4c50a5[_0xd187('0x2a')];}_0x1c87ee[_0xd187('0x1d')](_0x34febe)[_0xd187('0x2b')](_0x4c50a5);};}exports['index']=function(_0x140e54,_0xb38778){var _0x5bba10={},_0x4cc587={},_0x1a1922={'count':0x0,'rows':[]};var _0x1836cf=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x2d8843){return{'name':_0x2d8843[_0xd187('0x2f')],'type':_0x2d8843[_0xd187('0x30')]['key']};});_0x4cc587[_0xd187('0x31')]=_[_0xd187('0x2c')](_0x1836cf,_0xd187('0x2a'));_0x4cc587['query']=_[_0xd187('0x32')](_0x140e54['query']);_0x4cc587[_0xd187('0x33')]=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],_0x4cc587['query']);_0x5bba10['attributes']=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],qs['fields'](_0x140e54[_0xd187('0x35')][_0xd187('0x36')]));_0x5bba10[_0xd187('0x37')]=_0x5bba10['attributes']['length']?_0x5bba10[_0xd187('0x37')]:_0x4cc587[_0xd187('0x31')];if(!_0x140e54['query']['hasOwnProperty']('nolimit')){_0x5bba10[_0xd187('0x1e')]=qs['limit'](_0x140e54[_0xd187('0x35')][_0xd187('0x1e')]);_0x5bba10['offset']=qs[_0xd187('0x21')](_0x140e54['query'][_0xd187('0x21')]);}_0x5bba10[_0xd187('0x38')]=qs['sort'](_0x140e54[_0xd187('0x35')][_0xd187('0x39')]);_0x5bba10['where']=qs[_0xd187('0x33')](_['pick'](_0x140e54['query'],_0x4cc587[_0xd187('0x33')]),_0x1836cf);if(_0x140e54[_0xd187('0x35')][_0xd187('0x3a')]){_0x5bba10[_0xd187('0x3b')]=_[_0xd187('0x3c')](_0x5bba10['where'],{'$or':_[_0xd187('0x2c')](_0x1836cf,function(_0xe090ad){if(_0xe090ad[_0xd187('0x30')]!=='VIRTUAL'){var _0x4b121c={};_0x4b121c[_0xe090ad['name']]={'$like':'%'+_0x140e54['query'][_0xd187('0x3a')]+'%'};return _0x4b121c;}})});}_0x5bba10=_[_0xd187('0x3c')]({},_0x5bba10,_0x140e54[_0xd187('0x3d')]);var _0x367303={'where':_0x5bba10[_0xd187('0x3b')]};return db[_0xd187('0x2d')][_0xd187('0x20')](_0x367303)[_0xd187('0x26')](function(_0x526060){_0x1a1922[_0xd187('0x20')]=_0x526060;if(_0x140e54[_0xd187('0x35')][_0xd187('0x3e')]){_0x5bba10['include']=[{'all':!![]}];}return db[_0xd187('0x2d')]['findAll'](_0x5bba10);})[_0xd187('0x26')](function(_0x406d29){_0x1a1922[_0xd187('0x3f')]=_0x406d29;return _0x1a1922;})[_0xd187('0x26')](respondWithFilteredResult(_0xb38778,_0x5bba10))[_0xd187('0x40')](handleError(_0xb38778,null));};exports['show']=function(_0x3f0484,_0x3d9e60){var _0x3215b1={'raw':!![],'where':{'id':_0x3f0484['params']['id']}},_0x3fa19c={};_0x3fa19c[_0xd187('0x31')]=_[_0xd187('0x32')](db['AnalyticDefaultReport'][_0xd187('0x2e')]);_0x3fa19c[_0xd187('0x35')]=_['keys'](_0x3f0484['query']);_0x3fa19c[_0xd187('0x33')]=_[_0xd187('0x34')](_0x3fa19c['model'],_0x3fa19c['query']);_0x3215b1['attributes']=_[_0xd187('0x34')](_0x3fa19c[_0xd187('0x31')],qs[_0xd187('0x36')](_0x3f0484[_0xd187('0x35')][_0xd187('0x36')]));_0x3215b1[_0xd187('0x37')]=_0x3215b1[_0xd187('0x37')]['length']?_0x3215b1[_0xd187('0x37')]:_0x3fa19c[_0xd187('0x31')];if(_0x3f0484[_0xd187('0x35')][_0xd187('0x3e')]){_0x3215b1[_0xd187('0x41')]=[{'all':!![]}];}_0x3215b1=_[_0xd187('0x3c')]({},_0x3215b1,_0x3f0484[_0xd187('0x3d')]);return db[_0xd187('0x2d')]['find'](_0x3215b1)[_0xd187('0x26')](handleEntityNotFound(_0x3d9e60,null))[_0xd187('0x26')](respondWithResult(_0x3d9e60,null))[_0xd187('0x40')](handleError(_0x3d9e60,null));};exports[_0xd187('0x42')]=function(_0x36b99d,_0x5ad646){return db[_0xd187('0x2d')][_0xd187('0x42')](_0x36b99d['body'],{})[_0xd187('0x26')](function(_0xd9635d){var _0x55fac6=_0x36b99d['user']['get']({'plain':!![]});if(!_0x55fac6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55fac6[_0xd187('0x43')]===_0xd187('0x44')){var _0x12d448=_0xd9635d[_0xd187('0x27')]({'plain':!![]});var _0x460202=_0xd187('0x45');return db[_0xd187('0x46')]['find']({'where':{'name':_0x460202,'userProfileId':_0x55fac6[_0xd187('0x47')]},'raw':!![]})[_0xd187('0x26')](function(_0x1b12c4){if(_0x1b12c4&&_0x1b12c4[_0xd187('0x48')]===0x0){return db['UserProfileResource'][_0xd187('0x42')]({'name':_0x12d448['name'],'resourceId':_0x12d448['id'],'type':'DefaultReports','sectionId':_0x1b12c4['id']},{})[_0xd187('0x26')](function(){return _0xd9635d;});}else{return _0xd9635d;}})['catch'](function(_0x1a1252){logger[_0xd187('0x29')](_0xd187('0x49'),_0x1a1252);throw _0x1a1252;});}return _0xd9635d;})[_0xd187('0x26')](respondWithResult(_0x5ad646,0xc9))[_0xd187('0x40')](handleError(_0x5ad646,null));};exports[_0xd187('0x25')]=function(_0x3c7ba6,_0x2b4f9d){if(_0x3c7ba6[_0xd187('0x4a')]['id']){delete _0x3c7ba6['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x4b')]({'where':{'id':_0x3c7ba6['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x2b4f9d,null))[_0xd187('0x26')](saveUpdates(_0x3c7ba6[_0xd187('0x4a')],null))['then'](respondWithResult(_0x2b4f9d,null))[_0xd187('0x40')](handleError(_0x2b4f9d,null));};exports[_0xd187('0x28')]=function(_0x50073d,_0x457da1){return db[_0xd187('0x2d')]['find']({'where':{'id':_0x50073d[_0xd187('0x4c')]['id']}})['then'](handleEntityNotFound(_0x457da1,null))[_0xd187('0x26')](removeEntity(_0x457da1,null))[_0xd187('0x40')](handleError(_0x457da1,null));};exports[_0xd187('0x4d')]=function(_0x508866,_0x100d64){var _0x2265fb=0xa;var _0x1675d9=['join',_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x56b36b={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':_0xd187('0x58'),'GROUP_CONCAT DESC':_0xd187('0x59')};var _0x2c7dd9={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':_0xd187('0x5b'),'HOUR':_0xd187('0x5c'),'ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0xaff1e6=function(_0x42fb32){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x42fb32);};var _0x48c82d=function(_0x13d118){if(!_0x13d118||!_0x13d118[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x4225e6='(',_0x51fbdb=0x0;_0x51fbdb<_0x13d118[_0xd187('0x63')][_0xd187('0x64')];_0x51fbdb+=0x1){_0x51fbdb>0x0&&(_0x4225e6+='\x20'+_0x13d118['operator']+'\x20');_0x4225e6+=_0x13d118['rules'][_0x51fbdb][_0xd187('0x65')]?_0x48c82d(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x65')]):_0x13d118[_0xd187('0x63')][_0x51fbdb]['field']+'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb]['condition']+(_0xaff1e6(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x66')])?'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x67')]:'');}return _0x4225e6+')';};var _0x57cad7={'where':{'id':_0x508866['params']['id']}},_0x2409a8,_0xaea7e0,_0xd12560,_0x9e82c,_0x151f3c;_0x57cad7=_['merge']({},_0x57cad7,_0x508866[_0xd187('0x3d')]);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x57cad7)[_0xd187('0x26')](function(_0x13e05a){if(_0x13e05a){_0x2409a8=_0x13e05a;return _0x13e05a[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1291cc){if(_0x1291cc){if(!_0x1291cc[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0xaea7e0=_0x1291cc;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x54e908){if(_0x54e908){_0xd12560=_[_0xd187('0x6d')](_0x54e908,'id');var _0x1a9979;var _0x4bec3e=squel['select']();_0x4bec3e[_0xd187('0x6e')](_0x2409a8[_0xd187('0x6f')]);for(var _0x2ac56f=0x0;_0x2ac56f<_0xaea7e0[_0xd187('0x64')];_0x2ac56f+=0x1){_0x1a9979=_0xaea7e0[_0x2ac56f]['MetricId']?_0xd12560[_0xaea7e0[_0x2ac56f][_0xd187('0x70')]][_0xd187('0x71')]:_0xaea7e0[_0x2ac56f]['field'];_0x1a9979=_0xaea7e0[_0x2ac56f]['function']?_[_0xd187('0x72')](_0x56b36b[_0xaea7e0[_0x2ac56f]['function']],'%s',_0x1a9979):_0x1a9979;_0x1a9979=_0xaea7e0[_0x2ac56f][_0xd187('0x73')]?_[_0xd187('0x72')](_0x2c7dd9[_0xaea7e0[_0x2ac56f]['format']],'%s',_0x1a9979):_0x1a9979;if(_0xaea7e0[_0x2ac56f][_0xd187('0x74')]){_0x4bec3e['group'](_0x1a9979);}_0xaea7e0[_0x2ac56f][_0xd187('0x75')]&&_0x4bec3e['order'](_0x1a9979,_0xaea7e0[_0x2ac56f]['orderBy']==='DESC'?![]:!![]);_0x4bec3e[_0xd187('0x76')](_0x1a9979,_0xaea7e0[_0x2ac56f][_0xd187('0x77')]||_0x1a9979);}if(_0x2409a8[_0xd187('0x78')]){_0x2409a8[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x78')]);for(var _0x11858e=0x0;_0x11858e<_0x2409a8[_0xd187('0x78')]['length'];_0x11858e+=0x1){if(_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x1675d9,_0x2409a8['joins'][_0x11858e][_0xd187('0x30')])&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7a')]&&_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable']&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7b')]){_0x4bec3e[_0x2409a8['joins'][_0x11858e][_0xd187('0x30')]](_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7c')],null,util[_0xd187('0x73')]('%s.%s\x20=\x20%s.%s',_0x2409a8[_0xd187('0x6f')],_0x2409a8[_0xd187('0x78')][_0x11858e]['parentKey'],_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable'],_0x2409a8['joins'][_0x11858e]['foreignKey']));}}}if(_0x2409a8[_0xd187('0x7d')]){_0x2409a8[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x7d')]);_0x4bec3e[_0xd187('0x3b')](_0x48c82d(_0x2409a8[_0xd187('0x7d')]['group']));}_0x151f3c=_0x4bec3e[_0xd187('0x7e')]();_0x4bec3e[_0xd187('0x1e')](_0x2265fb);_0x4bec3e['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x4bec3e[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x4bec3e[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes'][_0xd187('0x82')]});}})[_0xd187('0x26')](respondWithResult(_0x100d64,null))[_0xd187('0x40')](handleError(_0x100d64,null));};function runReport(_0xbc650f,_0x1da684,_0x2879ff){var _0x1982cd=_0x1da684[_0xd187('0x2a')];var _0x3d9b2f=0xa;var _0xf31fac=[_0xd187('0x83'),_0xd187('0x4e'),'right_join','cross_join'];var _0x3d7e97={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x520f86={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd187('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x1ccb17=function(_0x432995){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x84'),_0xd187('0x62')],_0x432995);};var _0x395e45=function(_0x1e8839){if(!_0x1e8839||!_0x1e8839[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x2101a3='(',_0x25fc08=0x0;_0x25fc08<_0x1e8839['rules'][_0xd187('0x64')];_0x25fc08+=0x1){_0x25fc08>0x0&&(_0x2101a3+='\x20'+_0x1e8839[_0xd187('0x85')]+'\x20');_0x2101a3+=_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x65')]?_0x395e45(_0x1e8839['rules'][_0x25fc08][_0xd187('0x65')]):_0x1e8839[_0xd187('0x63')][_0x25fc08]['field']+'\x20'+_0x1e8839['rules'][_0x25fc08][_0xd187('0x66')]+(_0x1ccb17(_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x66')])?'\x20'+_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x67')]:'');}return _0x2101a3+')';};var _0x475ea9={'where':{'id':_0xbc650f['id']}},_0x4dd0c7,_0x22900,_0x22424d,_0x5b7870,_0x3244dd;_0x475ea9=_[_0xd187('0x3c')]({},_0x475ea9,_0x2879ff);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x475ea9)['then'](function(_0x5be1c9){if(_0x5be1c9){_0x4dd0c7=_0x5be1c9;return _0x5be1c9[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1cd0d2){if(_0x1cd0d2){if(!_0x1cd0d2['length']){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x22900=_0x1cd0d2;return db[_0xd187('0x86')]['findAll']({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x4efb9f){if(_0x4efb9f){_0x22424d=_['keyBy'](_0x4efb9f,'id');var _0x4a9310;var _0x54bf98=squel['select']();_0x54bf98['from'](_0x4dd0c7['table']);for(var _0x323311=0x0;_0x323311<_0x22900[_0xd187('0x64')];_0x323311+=0x1){_0x4a9310=_0x22900[_0x323311]['MetricId']?_0x22424d[_0x22900[_0x323311][_0xd187('0x70')]][_0xd187('0x71')]:_0x22900[_0x323311][_0xd187('0x76')];_0x4a9310=_0x22900[_0x323311][_0xd187('0x87')]?_[_0xd187('0x72')](_0x3d7e97[_0x22900[_0x323311]['function']],'%s',_0x4a9310):_0x4a9310;_0x4a9310=_0x22900[_0x323311][_0xd187('0x73')]?_['replace'](_0x520f86[_0x22900[_0x323311][_0xd187('0x73')]],'%s',_0x4a9310):_0x4a9310;if(_0x22900[_0x323311][_0xd187('0x74')]){_0x54bf98[_0xd187('0x65')](_0x4a9310);}_0x22900[_0x323311][_0xd187('0x75')]&&_0x54bf98[_0xd187('0x38')](_0x4a9310,_0x22900[_0x323311][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x54bf98['field'](_0x4a9310,_0x22900[_0x323311][_0xd187('0x77')]||_0x4a9310);}if(_0x4dd0c7[_0xd187('0x78')]){_0x4dd0c7['joins']=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x78')]);for(var _0x5df926=0x0;_0x5df926<_0x4dd0c7[_0xd187('0x78')][_0xd187('0x64')];_0x5df926+=0x1){if(_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0xf31fac,_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')])&&_0x4dd0c7[_0xd187('0x78')][_0x5df926]['parentKey']&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')]&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]){_0x54bf98[_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]](_0x4dd0c7['joins'][_0x5df926]['foreignTable'],null,util[_0xd187('0x73')](_0xd187('0x89'),_0x4dd0c7['table'],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7a')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]));}}}if(_0x4dd0c7['conditions']){_0x4dd0c7[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x7d')]);_0x54bf98[_0xd187('0x3b')](_0x395e45(_0x4dd0c7[_0xd187('0x7d')][_0xd187('0x65')]));}_0x3244dd=_0x54bf98[_0xd187('0x7e')]();_0x54bf98[_0xd187('0x1e')](_0x3d9b2f);_0x54bf98[_0xd187('0x21')](0x0);return;}})['then'](function(){if(_0x1da684[_0xd187('0x8a')]===_0xd187('0x8b')){return null;}var _0x25a053=_['merge'](_0x1da684,{'name':_0x1da684[_0xd187('0x8c')]||_0x1da684[_0xd187('0x2a')]||_0x4dd0c7[_0xd187('0x2a')],'basename':_0x1982cd,'savename':util[_0xd187('0x73')](_0xd187('0x8d'),_0x1da684[_0xd187('0x2a')]||_0x4dd0c7['name'],require(_0xd187('0x8e'))[_0xd187('0x8f')](0x4),_0x1da684[_0xd187('0x8a')]||'csv'),'reportId':_0x4dd0c7['id'],'reportType':_0xd187('0x90')});return db[_0xd187('0x91')][_0xd187('0x42')](_0x25a053,{'raw':!![]});})[_0xd187('0x26')](function(_0x12599e){if(_0x4dd0c7[_0xd187('0x6f')]==='cdr'){_0x3244dd[_0xd187('0x3b')](_0x4dd0c7[_0xd187('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1da684[_0xd187('0x92')],_0x1da684[_0xd187('0x93')]);}else{_0x3244dd['where'](_0x4dd0c7[_0xd187('0x6f')]+_0xd187('0x94'),_0x1da684['startDate'],_0x1da684[_0xd187('0x93')]);}if(_0x12599e){logger[_0xd187('0x95')]('Run\x20Query:',_0x3244dd[_0xd187('0x80')]());require('child_process')[_0xd187('0x96')](path[_0xd187('0x83')](__dirname,_0xd187('0x97'),_0x12599e[_0xd187('0x8a')]),[_0x12599e['id'],_0x3244dd[_0xd187('0x80')](),path['join'](__dirname,'../../files/reports',_0x12599e[_0xd187('0x98')]),_0x1982cd]);return _0x12599e;}else{var _0x2a2c7f=squel[_0xd187('0x99')]();_0x2a2c7f[_0xd187('0x6e')]('('+_0x3244dd[_0xd187('0x80')]()+')',_0xd187('0x9a'));_0x2a2c7f[_0xd187('0x76')]('COUNT(*)',_0xd187('0x20'));_0x3244dd[_0xd187('0x1e')](_0x1da684[_0xd187('0x1e')]||_0x3d9b2f);_0x3244dd[_0xd187('0x21')](_0x1da684[_0xd187('0x21')]||0x0);return dbH[_0xd187('0x81')]['query'](_0x2a2c7f[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')][_0xd187('0x82')]})[_0xd187('0x26')](function(_0x38a7cd){if(!_0x38a7cd[_0xd187('0x64')]){_0x5b7870=0x0;}else{_0x5b7870=_0x38a7cd[0x0][_0xd187('0x20')]||0x0;}return dbH['sequelize'][_0xd187('0x35')](_0x3244dd['toString'](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')]['SELECT']});})[_0xd187('0x26')](function(_0x254e0a){return{'rows':_0x254e0a||[],'count':_0x5b7870};});}});}exports['run']=function(_0x1776c1,_0x497a94){return runReport(_0x1776c1[_0xd187('0x4c')],_0x1776c1['query'],_0x1776c1['options'])[_0xd187('0x26')](respondWithResult(_0x497a94,null))[_0xd187('0x40')](handleError(_0x497a94,null));};exports[_0xd187('0x9c')]=runReport;exports[_0xd187('0x35')]=function(_0x568f72,_0x357526){var _0x13ee40=0xa;var _0x20c269=[_0xd187('0x83'),_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x25ff89={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x28798f={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x56fcde=function(_0x37b1b0){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x37b1b0);};var _0x428e6c=function(_0x4524c3){if(!_0x4524c3||!_0x4524c3[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x3a2937='(',_0xf03f9a=0x0;_0xf03f9a<_0x4524c3['rules'][_0xd187('0x64')];_0xf03f9a+=0x1){_0xf03f9a>0x0&&(_0x3a2937+='\x20'+_0x4524c3['operator']+'\x20');_0x3a2937+=_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']?_0x428e6c(_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']):_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x76')]+'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a]['condition']+(_0x56fcde(_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x66')])?'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x67')]:'');}return _0x3a2937+')';};var _0x37405d={'where':{'id':_0x568f72[_0xd187('0x4c')]['id']}},_0xe84f78,_0x12b4a4,_0x3d09a6,_0x5acea7,_0x2a756f;_0x37405d=_[_0xd187('0x3c')]({},_0x37405d,_0x568f72['options']);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x37405d)[_0xd187('0x26')](function(_0x110af6){if(_0x110af6){_0xe84f78=_0x110af6;return _0x110af6[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x2e4db4){if(_0x2e4db4){if(!_0x2e4db4[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x12b4a4=_0x2e4db4;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x50d5b8){if(_0x50d5b8){_0x3d09a6=_[_0xd187('0x6d')](_0x50d5b8,'id');var _0x48ef98;var _0x2008e9=squel['select']();_0x2008e9[_0xd187('0x6e')](_0xe84f78[_0xd187('0x6f')]);for(var _0x9b8840=0x0;_0x9b8840<_0x12b4a4[_0xd187('0x64')];_0x9b8840+=0x1){_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x70')]?_0x3d09a6[_0x12b4a4[_0x9b8840]['MetricId']][_0xd187('0x71')]:_0x12b4a4[_0x9b8840][_0xd187('0x76')];_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x87')]?_[_0xd187('0x72')](_0x25ff89[_0x12b4a4[_0x9b8840][_0xd187('0x87')]],'%s',_0x48ef98):_0x48ef98;_0x48ef98=_0x12b4a4[_0x9b8840]['format']?_[_0xd187('0x72')](_0x28798f[_0x12b4a4[_0x9b8840][_0xd187('0x73')]],'%s',_0x48ef98):_0x48ef98;if(_0x12b4a4[_0x9b8840][_0xd187('0x74')]){_0x2008e9['group'](_0x48ef98);}_0x12b4a4[_0x9b8840]['orderBy']&&_0x2008e9[_0xd187('0x38')](_0x48ef98,_0x12b4a4[_0x9b8840][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x2008e9[_0xd187('0x76')](_0x48ef98,_0x12b4a4[_0x9b8840]['alias']||_0x48ef98);}if(_0xe84f78[_0xd187('0x78')]){_0xe84f78[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0xe84f78[_0xd187('0x78')]);for(var _0x4bff96=0x0;_0x4bff96<_0xe84f78[_0xd187('0x78')]['length'];_0x4bff96+=0x1){if(_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x20c269,_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')])&&_0xe84f78['joins'][_0x4bff96][_0xd187('0x7a')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96]['foreignKey']){_0x2008e9[_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]](_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],null,util[_0xd187('0x73')](_0xd187('0x89'),_0xe84f78[_0xd187('0x6f')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7a')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7b')]));}}}if(_0xe84f78['conditions']){_0xe84f78[_0xd187('0x7d')]=JSON['parse'](_0xe84f78[_0xd187('0x7d')]);_0x2008e9['where'](_0x428e6c(_0xe84f78[_0xd187('0x7d')][_0xd187('0x65')]));}_0x2a756f=_0x2008e9[_0xd187('0x7e')]();_0x2008e9[_0xd187('0x1e')](_0x13ee40);_0x2008e9['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x2008e9[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x2008e9[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes']['SELECT']});}})[_0xd187('0x26')](function(){return{'sql':_0x2a756f[_0xd187('0x80')]()};})[_0xd187('0x26')](respondWithResult(_0x357526,null))['catch'](handleError(_0x357526,null));}; \ No newline at end of file +var _0x1261=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','set','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','show','length','includeAll','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','AVG(%s)','DATE(%s)','value','keyBy','select','order','%s.%s\x20=\x20%s.%s','clone','web','fullPath','randomstring','generate','output','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','../../components/export/','savename','COUNT(*)','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Sequelize','debug'];(function(_0x1ea8a7,_0xf071fa){var _0x56c5b5=function(_0x42627c){while(--_0x42627c){_0x1ea8a7['push'](_0x1ea8a7['shift']());}};_0x56c5b5(++_0xf071fa);}(_0x1261,0x144));var _0x1126=function(_0x3b22e9,_0x354406){_0x3b22e9=_0x3b22e9-0x0;var _0x230314=_0x1261[_0x3b22e9];return _0x230314;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var dbH=require(_0x1126('0x17'))[_0x1126('0x18')];function respondWithStatusCode(_0xca0355,_0x3f10e9){_0x3f10e9=_0x3f10e9||0xcc;return function(_0xd8ca42){if(_0xd8ca42){return _0xca0355[_0x1126('0x19')](_0x3f10e9);}return _0xca0355[_0x1126('0x1a')](_0x3f10e9)['end']();};}function respondWithResult(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xc8;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1a')](_0x1af673)['json'](_0x154e20);}};}function respondWithFilteredResult(_0x45149c,_0x4794a7){return function(_0x35fe9f){if(_0x35fe9f){var _0x42f379=typeof _0x4794a7[_0x1126('0x1b')]==='undefined'&&typeof _0x4794a7[_0x1126('0x1c')]===_0x1126('0x1d');var _0x4a7b49=_0x35fe9f['count'];var _0x22ae0b=_0x42f379?0x0:_0x4794a7[_0x1126('0x1b')];var _0x58d11a=_0x42f379?_0x35fe9f['count']:_0x4794a7[_0x1126('0x1b')]+_0x4794a7['limit'];var _0x22ed37;if(_0x58d11a>=_0x4a7b49){_0x58d11a=_0x4a7b49;_0x22ed37=0xc8;}else{_0x22ed37=0xce;}_0x45149c[_0x1126('0x1a')](_0x22ed37);return _0x45149c[_0x1126('0x1e')]('Content-Range',_0x22ae0b+'-'+_0x58d11a+'/'+_0x4a7b49)[_0x1126('0x1f')](_0x35fe9f);}return null;};}function patchUpdates(_0x49d209){return function(_0x56efeb){try{jsonpatch[_0x1126('0x20')](_0x56efeb,_0x49d209,!![]);}catch(_0x3a9bed){return BPromise[_0x1126('0x21')](_0x3a9bed);}return _0x56efeb[_0x1126('0x22')]();};}function saveUpdates(_0x526ca1,_0x29ab60){return function(_0x477e6a){if(_0x477e6a){return _0x477e6a['update'](_0x526ca1)[_0x1126('0x23')](function(_0x59cd8e){return _0x59cd8e;});}return null;};}function removeEntity(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x24')]()[_0x1126('0x23')](function(){var _0x34bcf1=_0x2199d9[_0x1126('0x25')]({'plain':!![]});var _0x1b07a7=_0x1126('0x26');return db[_0x1126('0x27')]['destroy']({'where':{'type':_0x1b07a7,'resourceId':_0x34bcf1['id']}})[_0x1126('0x23')](function(){return _0x2199d9;});})[_0x1126('0x23')](function(){_0x529dd9[_0x1126('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541bc9,_0xeb7d89){return function(_0x39bf0e){if(!_0x39bf0e){_0x541bc9['sendStatus'](0x194);}return _0x39bf0e;};}function handleError(_0x2fb797,_0x23d2bc){_0x23d2bc=_0x23d2bc||0x1f4;return function(_0x4a334a){logger[_0x1126('0x28')](_0x4a334a['stack']);if(_0x4a334a[_0x1126('0x29')]){delete _0x4a334a['name'];}_0x2fb797[_0x1126('0x1a')](_0x23d2bc)['send'](_0x4a334a);};}exports[_0x1126('0x2a')]=function(_0x5f2611,_0x5252e0){var _0x4a53ab={},_0x17646e={},_0xa8906d={'count':0x0,'rows':[]};var _0x1cef48=_['map'](db[_0x1126('0x2b')][_0x1126('0x2c')],function(_0x56f7f8){return{'name':_0x56f7f8[_0x1126('0x2d')],'type':_0x56f7f8[_0x1126('0x2e')][_0x1126('0x2f')]};});_0x17646e[_0x1126('0x30')]=_['map'](_0x1cef48,'name');_0x17646e[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5f2611[_0x1126('0x31')]);_0x17646e[_0x1126('0x33')]=_['intersection'](_0x17646e[_0x1126('0x30')],_0x17646e[_0x1126('0x31')]);_0x4a53ab[_0x1126('0x34')]=_[_0x1126('0x35')](_0x17646e[_0x1126('0x30')],qs['fields'](_0x5f2611[_0x1126('0x31')][_0x1126('0x36')]));_0x4a53ab[_0x1126('0x34')]=_0x4a53ab[_0x1126('0x34')]['length']?_0x4a53ab['attributes']:_0x17646e[_0x1126('0x30')];if(!_0x5f2611[_0x1126('0x31')]['hasOwnProperty'](_0x1126('0x37'))){_0x4a53ab[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x5f2611['query']['limit']);_0x4a53ab[_0x1126('0x1b')]=qs[_0x1126('0x1b')](_0x5f2611[_0x1126('0x31')][_0x1126('0x1b')]);}_0x4a53ab['order']=qs[_0x1126('0x38')](_0x5f2611['query'][_0x1126('0x38')]);_0x4a53ab[_0x1126('0x39')]=qs[_0x1126('0x33')](_[_0x1126('0x3a')](_0x5f2611[_0x1126('0x31')],_0x17646e['filters']),_0x1cef48);if(_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]){_0x4a53ab[_0x1126('0x39')]=_[_0x1126('0x3c')](_0x4a53ab[_0x1126('0x39')],{'$or':_[_0x1126('0x3d')](_0x1cef48,function(_0x3052f9){if(_0x3052f9['type']!==_0x1126('0x3e')){var _0x154c28={};_0x154c28[_0x3052f9[_0x1126('0x29')]]={'$like':'%'+_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]+'%'};return _0x154c28;}})});}_0x4a53ab=_['merge']({},_0x4a53ab,_0x5f2611['options']);var _0x1c4f06={'where':_0x4a53ab[_0x1126('0x39')]};return db[_0x1126('0x2b')][_0x1126('0x3f')](_0x1c4f06)[_0x1126('0x23')](function(_0x276fd5){_0xa8906d['count']=_0x276fd5;if(_0x5f2611['query']['includeAll']){_0x4a53ab[_0x1126('0x40')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x1126('0x41')](_0x4a53ab);})[_0x1126('0x23')](function(_0x3584a3){_0xa8906d[_0x1126('0x42')]=_0x3584a3;return _0xa8906d;})['then'](respondWithFilteredResult(_0x5252e0,_0x4a53ab))['catch'](handleError(_0x5252e0,null));};exports[_0x1126('0x43')]=function(_0xa93167,_0x1d63b9){var _0x5f5d3a={'raw':!![],'where':{'id':_0xa93167['params']['id']}},_0x2f8551={};_0x2f8551[_0x1126('0x30')]=_['keys'](db[_0x1126('0x2b')][_0x1126('0x2c')]);_0x2f8551[_0x1126('0x31')]=_['keys'](_0xa93167[_0x1126('0x31')]);_0x2f8551[_0x1126('0x33')]=_[_0x1126('0x35')](_0x2f8551['model'],_0x2f8551['query']);_0x5f5d3a['attributes']=_[_0x1126('0x35')](_0x2f8551['model'],qs[_0x1126('0x36')](_0xa93167['query'][_0x1126('0x36')]));_0x5f5d3a[_0x1126('0x34')]=_0x5f5d3a[_0x1126('0x34')][_0x1126('0x44')]?_0x5f5d3a[_0x1126('0x34')]:_0x2f8551['model'];if(_0xa93167[_0x1126('0x31')][_0x1126('0x45')]){_0x5f5d3a['include']=[{'all':!![]}];}_0x5f5d3a=_[_0x1126('0x3c')]({},_0x5f5d3a,_0xa93167[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x5f5d3a)[_0x1126('0x23')](handleEntityNotFound(_0x1d63b9,null))['then'](respondWithResult(_0x1d63b9,null))[_0x1126('0x48')](handleError(_0x1d63b9,null));};exports[_0x1126('0x49')]=function(_0x213a76,_0x59656d){return db[_0x1126('0x2b')][_0x1126('0x49')](_0x213a76[_0x1126('0x4a')],{})[_0x1126('0x23')](function(_0x224456){var _0x2081f2=_0x213a76[_0x1126('0x4b')][_0x1126('0x25')]({'plain':!![]});if(!_0x2081f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2081f2[_0x1126('0x4c')]==='user'){var _0x40168e=_0x224456[_0x1126('0x25')]({'plain':!![]});var _0x4a1831='Reports';return db[_0x1126('0x4d')][_0x1126('0x47')]({'where':{'name':_0x4a1831,'userProfileId':_0x2081f2[_0x1126('0x4e')]},'raw':!![]})['then'](function(_0x3cb44c){if(_0x3cb44c&&_0x3cb44c[_0x1126('0x4f')]===0x0){return db[_0x1126('0x27')][_0x1126('0x49')]({'name':_0x40168e['name'],'resourceId':_0x40168e['id'],'type':_0x1126('0x26'),'sectionId':_0x3cb44c['id']},{})[_0x1126('0x23')](function(){return _0x224456;});}else{return _0x224456;}})['catch'](function(_0x4bcc08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bcc08);throw _0x4bcc08;});}return _0x224456;})[_0x1126('0x23')](respondWithResult(_0x59656d,0xc9))[_0x1126('0x48')](handleError(_0x59656d,null));};exports['update']=function(_0x16552b,_0x1c7a2b){if(_0x16552b[_0x1126('0x4a')]['id']){delete _0x16552b[_0x1126('0x4a')]['id'];}return db[_0x1126('0x2b')]['find']({'where':{'id':_0x16552b[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x1c7a2b,null))['then'](saveUpdates(_0x16552b[_0x1126('0x4a')],null))[_0x1126('0x23')](respondWithResult(_0x1c7a2b,null))[_0x1126('0x48')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x24')]=function(_0xc8a0f,_0x59c3d0){return db[_0x1126('0x2b')]['find']({'where':{'id':_0xc8a0f[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x59c3d0,null))[_0x1126('0x23')](removeEntity(_0x59c3d0,null))['catch'](handleError(_0x59c3d0,null));};exports[_0x1126('0x51')]=function(_0x2340f8,_0x5763b4){var _0x30812d=0xa;var _0x25038f=[_0x1126('0x52'),'left_join',_0x1126('0x53'),_0x1126('0x54')];var _0x22ab18={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x2a5422={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':'DATE(%s)','HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3767e4=function(_0x5246aa){return!_[_0x1126('0x60')]([_0x1126('0x61'),'IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0x5246aa);};var _0x375b76=function(_0x592960){if(!_0x592960||!_0x592960[_0x1126('0x64')]['length']){return'';}for(var _0x558b6e='(',_0xbdc58=0x0;_0xbdc58<_0x592960[_0x1126('0x64')][_0x1126('0x44')];_0xbdc58+=0x1){_0xbdc58>0x0&&(_0x558b6e+='\x20'+_0x592960[_0x1126('0x65')]+'\x20');_0x558b6e+=_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x66')]?_0x375b76(_0x592960[_0x1126('0x64')][_0xbdc58]['group']):_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x67')]+'\x20'+_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')]+(_0x3767e4(_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')])?'\x20'+_0x592960['rules'][_0xbdc58]['value']:'');}return _0x558b6e+')';};var _0x16a343={'where':{'id':_0x2340f8[_0x1126('0x50')]['id']}},_0x3921c2,_0x4bf2b3,_0x5ee130,_0x5e9260,_0x51a28d;_0x16a343=_[_0x1126('0x3c')]({},_0x16a343,_0x2340f8[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x16a343)[_0x1126('0x23')](function(_0x170bf0){if(_0x170bf0){_0x3921c2=_0x170bf0;return _0x170bf0[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x3f007b){if(_0x3f007b){if(!_0x3f007b[_0x1126('0x44')]){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4bf2b3=_0x3f007b;return db[_0x1126('0x6c')][_0x1126('0x41')]({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x56c003){if(_0x56c003){_0x5ee130=_['keyBy'](_0x56c003,'id');var _0x15cf3d;var _0x2643d7=squel['select']();_0x2643d7[_0x1126('0x6d')](_0x3921c2[_0x1126('0x6e')]);for(var _0x366675=0x0;_0x366675<_0x4bf2b3[_0x1126('0x44')];_0x366675+=0x1){_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x6f')]?_0x5ee130[_0x4bf2b3[_0x366675][_0x1126('0x6f')]][_0x1126('0x70')]:_0x4bf2b3[_0x366675][_0x1126('0x67')];_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x71')]?_[_0x1126('0x72')](_0x22ab18[_0x4bf2b3[_0x366675][_0x1126('0x71')]],'%s',_0x15cf3d):_0x15cf3d;_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x73')]?_[_0x1126('0x72')](_0x2a5422[_0x4bf2b3[_0x366675]['format']],'%s',_0x15cf3d):_0x15cf3d;if(_0x4bf2b3[_0x366675][_0x1126('0x74')]){_0x2643d7[_0x1126('0x66')](_0x15cf3d);}_0x4bf2b3[_0x366675][_0x1126('0x75')]&&_0x2643d7['order'](_0x15cf3d,_0x4bf2b3[_0x366675]['orderBy']===_0x1126('0x76')?![]:!![]);_0x2643d7[_0x1126('0x67')](_0x15cf3d,_0x4bf2b3[_0x366675][_0x1126('0x77')]||_0x15cf3d);}if(_0x3921c2[_0x1126('0x78')]){_0x3921c2['joins']=JSON['parse'](_0x3921c2['joins']);for(var _0x79afca=0x0;_0x79afca<_0x3921c2[_0x1126('0x78')][_0x1126('0x44')];_0x79afca+=0x1){if(_0x3921c2[_0x1126('0x78')][_0x79afca]['type']&&_[_0x1126('0x60')](_0x25038f,_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')])&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x79')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7b')]){_0x2643d7[_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')]](_0x3921c2['joins'][_0x79afca][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x3921c2[_0x1126('0x6e')],_0x3921c2[_0x1126('0x78')][_0x79afca]['parentKey'],_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')],_0x3921c2['joins'][_0x79afca]['foreignKey']));}}}if(_0x3921c2[_0x1126('0x7c')]){_0x3921c2[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x3921c2['conditions']);_0x2643d7['where'](_0x375b76(_0x3921c2['conditions'][_0x1126('0x66')]));}_0x51a28d=_0x2643d7['clone']();_0x2643d7['limit'](_0x30812d);_0x2643d7[_0x1126('0x1b')](0x0);logger['debug'](_0x1126('0x7e'),_0x2643d7[_0x1126('0x7f')]());return dbH['sequelize'][_0x1126('0x31')](_0x2643d7[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](respondWithResult(_0x5763b4,null))[_0x1126('0x48')](handleError(_0x5763b4,null));};function runReport(_0x426faa,_0x5679ec,_0xd182b1){var _0x2d6fcf=_0x5679ec[_0x1126('0x29')];var _0x2af2d0=0xa;var _0x2598a7=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x9a2af0={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':_0x1126('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x33cccf={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':'HOUR(%s)','ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5bdb30=function(_0xb1199b){return!_[_0x1126('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0xb1199b);};var _0x228552=function(_0x1ee970){if(!_0x1ee970||!_0x1ee970[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x2d7150='(',_0x35a9a4=0x0;_0x35a9a4<_0x1ee970[_0x1126('0x64')]['length'];_0x35a9a4+=0x1){_0x35a9a4>0x0&&(_0x2d7150+='\x20'+_0x1ee970[_0x1126('0x65')]+'\x20');_0x2d7150+=_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]?_0x228552(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]):_0x1ee970[_0x1126('0x64')][_0x35a9a4]['field']+'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')]+(_0x5bdb30(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')])?'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x86')]:'');}return _0x2d7150+')';};var _0x2418ca={'where':{'id':_0x426faa['id']}},_0x2d2dfc,_0x38eac6,_0xc3503b,_0x5d6edb,_0x50238d;_0x2418ca=_[_0x1126('0x3c')]({},_0x2418ca,_0xd182b1);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x2418ca)['then'](function(_0x4461ae){if(_0x4461ae){_0x2d2dfc=_0x4461ae;return _0x4461ae['getFields']();}return null;})[_0x1126('0x23')](function(_0x4fbd44){if(_0x4fbd44){if(!_0x4fbd44['length']){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x38eac6=_0x4fbd44;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0xe2f82d){if(_0xe2f82d){_0xc3503b=_[_0x1126('0x87')](_0xe2f82d,'id');var _0x5dfb8f;var _0x48f914=squel[_0x1126('0x88')]();_0x48f914['from'](_0x2d2dfc[_0x1126('0x6e')]);for(var _0x39d9a0=0x0;_0x39d9a0<_0x38eac6[_0x1126('0x44')];_0x39d9a0+=0x1){_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x6f')]?_0xc3503b[_0x38eac6[_0x39d9a0][_0x1126('0x6f')]]['metric']:_0x38eac6[_0x39d9a0]['field'];_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x71')]?_[_0x1126('0x72')](_0x9a2af0[_0x38eac6[_0x39d9a0][_0x1126('0x71')]],'%s',_0x5dfb8f):_0x5dfb8f;_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x73')]?_[_0x1126('0x72')](_0x33cccf[_0x38eac6[_0x39d9a0][_0x1126('0x73')]],'%s',_0x5dfb8f):_0x5dfb8f;if(_0x38eac6[_0x39d9a0][_0x1126('0x74')]){_0x48f914[_0x1126('0x66')](_0x5dfb8f);}_0x38eac6[_0x39d9a0][_0x1126('0x75')]&&_0x48f914[_0x1126('0x89')](_0x5dfb8f,_0x38eac6[_0x39d9a0][_0x1126('0x75')]==='DESC'?![]:!![]);_0x48f914[_0x1126('0x67')](_0x5dfb8f,_0x38eac6[_0x39d9a0]['alias']||_0x5dfb8f);}if(_0x2d2dfc[_0x1126('0x78')]){_0x2d2dfc['joins']=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x78')]);for(var _0x215d4d=0x0;_0x215d4d<_0x2d2dfc[_0x1126('0x78')]['length'];_0x215d4d+=0x1){if(_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x2e')]&&_['includes'](_0x2598a7,_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x2e')])&&_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x79')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7a')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7b')]){_0x48f914[_0x2d2dfc[_0x1126('0x78')][_0x215d4d]['type']](_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],null,util[_0x1126('0x73')](_0x1126('0x8a'),_0x2d2dfc[_0x1126('0x6e')],_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x79')],_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],_0x2d2dfc['joins'][_0x215d4d]['foreignKey']));}}}if(_0x2d2dfc['conditions']){_0x2d2dfc[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x7c')]);_0x48f914[_0x1126('0x39')](_0x228552(_0x2d2dfc['conditions'][_0x1126('0x66')]));}_0x50238d=_0x48f914[_0x1126('0x8b')]();_0x48f914[_0x1126('0x1c')](_0x2af2d0);_0x48f914[_0x1126('0x1b')](0x0);return;}})[_0x1126('0x23')](function(){if(_0x5679ec['output']===_0x1126('0x8c')){return null;}var _0x21c487=_['merge'](_0x5679ec,{'name':_0x5679ec[_0x1126('0x8d')]||_0x5679ec['name']||_0x2d2dfc['name'],'basename':_0x2d6fcf,'savename':util[_0x1126('0x73')]('%s-%s.%s',_0x5679ec[_0x1126('0x29')]||_0x2d2dfc[_0x1126('0x29')],require(_0x1126('0x8e'))[_0x1126('0x8f')](0x4),_0x5679ec[_0x1126('0x90')]||_0x1126('0x91')),'reportId':_0x2d2dfc['id'],'reportType':_0x1126('0x92')});return db[_0x1126('0x93')][_0x1126('0x49')](_0x21c487,{'raw':!![]});})['then'](function(_0x2577f5){if(_0x2d2dfc[_0x1126('0x6e')]===_0x1126('0x94')){_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+_0x1126('0x95'),_0x5679ec[_0x1126('0x96')],_0x5679ec[_0x1126('0x97')]);}else{_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5679ec['startDate'],_0x5679ec[_0x1126('0x97')]);}if(_0x2577f5){logger['info'](_0x1126('0x98'),_0x50238d[_0x1126('0x7f')]());require('child_process')['fork'](path[_0x1126('0x52')](__dirname,_0x1126('0x99'),_0x2577f5['output']),[_0x2577f5['id'],_0x50238d[_0x1126('0x7f')](),path[_0x1126('0x52')](__dirname,'../../files/reports',_0x2577f5[_0x1126('0x9a')]),_0x2d6fcf]);return _0x2577f5;}else{var _0x4a9941=squel[_0x1126('0x88')]();_0x4a9941[_0x1126('0x6d')]('('+_0x50238d[_0x1126('0x7f')]()+')','countTable');_0x4a9941[_0x1126('0x67')](_0x1126('0x9b'),_0x1126('0x3f'));_0x50238d[_0x1126('0x1c')](_0x5679ec[_0x1126('0x1c')]||_0x2af2d0);_0x50238d[_0x1126('0x1b')](_0x5679ec[_0x1126('0x1b')]||0x0);return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x4a9941[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]})[_0x1126('0x23')](function(_0x12ffa5){if(!_0x12ffa5[_0x1126('0x44')]){_0x5d6edb=0x0;}else{_0x5d6edb=_0x12ffa5[0x0][_0x1126('0x3f')]||0x0;}return dbH['sequelize'][_0x1126('0x31')](_0x50238d[_0x1126('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x82')]});})[_0x1126('0x23')](function(_0x35065c){return{'rows':_0x35065c||[],'count':_0x5d6edb};});}});}exports[_0x1126('0x9c')]=function(_0x5c0215,_0x444f94){return runReport(_0x5c0215[_0x1126('0x50')],_0x5c0215['query'],_0x5c0215[_0x1126('0x46')])['then'](respondWithResult(_0x444f94,null))[_0x1126('0x48')](handleError(_0x444f94,null));};exports[_0x1126('0x9d')]=runReport;exports['query']=function(_0x4d43ad,_0xa02d9e){var _0x548f9e=0xa;var _0x5edb83=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x4f29ce={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':'MIN(%s)','AVG':_0x1126('0x84'),'GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x17b25d={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':_0x1126('0x9e')};var _0x3a4a91=function(_0x55145f){return!_[_0x1126('0x60')](['IS\x20NULL',_0x1126('0x9f'),_0x1126('0x62'),_0x1126('0x63')],_0x55145f);};var _0x4c7dc7=function(_0x33a27b){if(!_0x33a27b||!_0x33a27b[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x578c1b='(',_0x1562b2=0x0;_0x1562b2<_0x33a27b[_0x1126('0x64')][_0x1126('0x44')];_0x1562b2+=0x1){_0x1562b2>0x0&&(_0x578c1b+='\x20'+_0x33a27b[_0x1126('0x65')]+'\x20');_0x578c1b+=_0x33a27b[_0x1126('0x64')][_0x1562b2]['group']?_0x4c7dc7(_0x33a27b['rules'][_0x1562b2][_0x1126('0x66')]):_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x67')]+'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')]+(_0x3a4a91(_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')])?'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x86')]:'');}return _0x578c1b+')';};var _0x2fb228={'where':{'id':_0x4d43ad[_0x1126('0x50')]['id']}},_0x2c95b6,_0x4a4b43,_0x588f4f,_0x5ac4d6,_0x1168a5;_0x2fb228=_['merge']({},_0x2fb228,_0x4d43ad['options']);return db[_0x1126('0x2b')][_0x1126('0x47')](_0x2fb228)[_0x1126('0x23')](function(_0x48b088){if(_0x48b088){_0x2c95b6=_0x48b088;return _0x48b088[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x5a28f9){if(_0x5a28f9){if(!_0x5a28f9[_0x1126('0x44')]){throw new db[(_0x1126('0xa0'))][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4a4b43=_0x5a28f9;return db[_0x1126('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x1140ec){if(_0x1140ec){_0x588f4f=_['keyBy'](_0x1140ec,'id');var _0x578f5c;var _0x559dae=squel[_0x1126('0x88')]();_0x559dae[_0x1126('0x6d')](_0x2c95b6[_0x1126('0x6e')]);for(var _0x9d7819=0x0;_0x9d7819<_0x4a4b43[_0x1126('0x44')];_0x9d7819+=0x1){_0x578f5c=_0x4a4b43[_0x9d7819]['MetricId']?_0x588f4f[_0x4a4b43[_0x9d7819][_0x1126('0x6f')]]['metric']:_0x4a4b43[_0x9d7819][_0x1126('0x67')];_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x71')]?_['replace'](_0x4f29ce[_0x4a4b43[_0x9d7819]['function']],'%s',_0x578f5c):_0x578f5c;_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x73')]?_[_0x1126('0x72')](_0x17b25d[_0x4a4b43[_0x9d7819]['format']],'%s',_0x578f5c):_0x578f5c;if(_0x4a4b43[_0x9d7819]['groupBy']){_0x559dae[_0x1126('0x66')](_0x578f5c);}_0x4a4b43[_0x9d7819][_0x1126('0x75')]&&_0x559dae[_0x1126('0x89')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x75')]===_0x1126('0x76')?![]:!![]);_0x559dae[_0x1126('0x67')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x77')]||_0x578f5c);}if(_0x2c95b6[_0x1126('0x78')]){_0x2c95b6[_0x1126('0x78')]=JSON[_0x1126('0x7d')](_0x2c95b6['joins']);for(var _0x4d6528=0x0;_0x4d6528<_0x2c95b6[_0x1126('0x78')][_0x1126('0x44')];_0x4d6528+=0x1){if(_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x2e')]&&_[_0x1126('0x60')](_0x5edb83,_0x2c95b6[_0x1126('0x78')][_0x4d6528]['type'])&&_0x2c95b6['joins'][_0x4d6528][_0x1126('0x79')]&&_0x2c95b6['joins'][_0x4d6528]['foreignTable']&&_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]){_0x559dae[_0x2c95b6['joins'][_0x4d6528][_0x1126('0x2e')]](_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x2c95b6[_0x1126('0x6e')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x79')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]));}}}if(_0x2c95b6['conditions']){_0x2c95b6[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2c95b6[_0x1126('0x7c')]);_0x559dae[_0x1126('0x39')](_0x4c7dc7(_0x2c95b6['conditions'][_0x1126('0x66')]));}_0x1168a5=_0x559dae[_0x1126('0x8b')]();_0x559dae['limit'](_0x548f9e);_0x559dae[_0x1126('0x1b')](0x0);logger[_0x1126('0xa1')](_0x1126('0x7e'),_0x559dae['toString']());return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x559dae[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](function(){return{'sql':_0x1168a5[_0x1126('0x7f')]()};})[_0x1126('0x23')](respondWithResult(_0xa02d9e,null))['catch'](handleError(_0xa02d9e,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 0f7f9c0..0a39e02 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 _0xeb9e=['exports','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xeb9e,0x1f2));var _0xeeb9=function(_0x293ca4,_0x57d8b5){_0x293ca4=_0x293ca4-0x0;var _0x554f34=_0xeb9e[_0x293ca4];return _0x554f34;};'use strict';var _=require('lodash');var util=require(_0xeeb9('0x0'));var logger=require(_0xeeb9('0x1'))(_0xeeb9('0x2'));var moment=require(_0xeeb9('0x3'));var BPromise=require(_0xeeb9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeeb9('0x5'));var rimraf=require(_0xeeb9('0x6'));var config=require(_0xeeb9('0x7'));var attributes=require(_0xeeb9('0x8'));module[_0xeeb9('0x9')]=function(_0xda8114,_0x2f3318){return _0xda8114[_0xeeb9('0xa')](_0xeeb9('0xb'),attributes,{'tableName':_0xeeb9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3637=['moment','bluebird','request-promise','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x3637,0x1ab));var _0x7363=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0x3637[_0x4a5f6c];return _0x281ffd;};'use strict';var _=require(_0x7363('0x0'));var util=require(_0x7363('0x1'));var logger=require(_0x7363('0x2'))('api');var moment=require(_0x7363('0x3'));var BPromise=require(_0x7363('0x4'));var rp=require(_0x7363('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x7363('0x6')]=function(_0x5688d8,_0x430719){return _0x5688d8[_0x7363('0x7')](_0x7363('0x8'),attributes,{'tableName':_0x7363('0x9'),'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 17eeec8..78ea51a 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 _0x8f22=['../../config/environment','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xc9527b,_0x56da87){var _0x453cae=function(_0x24df7b){while(--_0x24df7b){_0xc9527b['push'](_0xc9527b['shift']());}};_0x453cae(++_0x56da87);}(_0x8f22,0x75));var _0x28f2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f22[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x28f2('0x0'));var util=require(_0x28f2('0x1'));var moment=require(_0x28f2('0x2'));var BPromise=require(_0x28f2('0x3'));var rs=require(_0x28f2('0x4'));var fs=require('fs');var Redis=require(_0x28f2('0x5'));var db=require(_0x28f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x28f2('0x7'))(_0x28f2('0x8'));var config=require(_0x28f2('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x364cda,_0x64e1fb,_0x2a5055){return new BPromise(function(_0x3961fc,_0x4d69a9){return client[_0x28f2('0xa')](_0x364cda,_0x2a5055)[_0x28f2('0xb')](function(_0x46a0a2){logger[_0x28f2('0xc')](_0x28f2('0xd'),_0x64e1fb,_0x28f2('0xe'));logger[_0x28f2('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x64e1fb,_0x28f2('0xe'),JSON[_0x28f2('0x10')](_0x46a0a2));if(_0x46a0a2['error']){if(_0x46a0a2[_0x28f2('0x11')][_0x28f2('0x12')]===0x1f4){logger[_0x28f2('0x11')](_0x28f2('0xd'),_0x64e1fb,_0x46a0a2['error'][_0x28f2('0x13')]);return _0x4d69a9(_0x46a0a2[_0x28f2('0x11')][_0x28f2('0x13')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x64e1fb,_0x46a0a2['error'][_0x28f2('0x13')]);return _0x3961fc(_0x46a0a2['error'][_0x28f2('0x13')]);}else{logger['info'](_0x28f2('0xd'),_0x64e1fb,'request\x20sent');_0x3961fc(_0x46a0a2['result'][_0x28f2('0x13')]);}})[_0x28f2('0x14')](function(_0x210c1c){logger[_0x28f2('0x11')](_0x28f2('0xd'),_0x64e1fb,_0x210c1c);_0x4d69a9(_0x210c1c);});});} \ No newline at end of file +var _0xa768=['message','result','catch','util','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x338c63,_0x49c4f1){var _0x55e011=function(_0x1b890c){while(--_0x1b890c){_0x338c63['push'](_0x338c63['shift']());}};_0x55e011(++_0x49c4f1);}(_0xa768,0x147));var _0x8a76=function(_0x4c6b9a,_0x4ae81b){_0x4c6b9a=_0x4c6b9a-0x0;var _0x2f8515=_0xa768[_0x4c6b9a];return _0x2f8515;};'use strict';var _=require('lodash');var util=require(_0x8a76('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a76('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a76('0x2'));var logger=require('../../config/logger')(_0x8a76('0x3'));var config=require('../../config/environment');var jayson=require(_0x8a76('0x4'));var client=jayson[_0x8a76('0x5')][_0x8a76('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x39541d,_0x3532d8,_0x17c7dc){return new BPromise(function(_0x454826,_0x2bc8aa){return client[_0x8a76('0x7')](_0x39541d,_0x17c7dc)[_0x8a76('0x8')](function(_0x43ece3){logger[_0x8a76('0x9')](_0x8a76('0xa'),_0x3532d8,_0x8a76('0xb'));logger[_0x8a76('0xc')](_0x8a76('0xd'),_0x3532d8,_0x8a76('0xb'),JSON['stringify'](_0x43ece3));if(_0x43ece3[_0x8a76('0xe')]){if(_0x43ece3[_0x8a76('0xe')]['code']===0x1f4){logger[_0x8a76('0xe')](_0x8a76('0xa'),_0x3532d8,_0x43ece3['error'][_0x8a76('0xf')]);return _0x2bc8aa(_0x43ece3['error']['message']);}logger[_0x8a76('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3532d8,_0x43ece3[_0x8a76('0xe')][_0x8a76('0xf')]);return _0x454826(_0x43ece3[_0x8a76('0xe')]['message']);}else{logger[_0x8a76('0x9')](_0x8a76('0xa'),_0x3532d8,'request\x20sent');_0x454826(_0x43ece3[_0x8a76('0x10')][_0x8a76('0xf')]);}})[_0x8a76('0x11')](function(_0xf33424){logger[_0x8a76('0xe')](_0x8a76('0xa'),_0x3532d8,_0xf33424);_0x2bc8aa(_0xf33424);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 2abb12a..489b8ce 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 _0xf3c0=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/query','post'];(function(_0x260eef,_0x53fe7d){var _0x3ccd29=function(_0x1cc818){while(--_0x1cc818){_0x260eef['push'](_0x260eef['shift']());}};_0x3ccd29(++_0x53fe7d);}(_0xf3c0,0x1b6));var _0x0f3c=function(_0x108e26,_0x427f95){_0x108e26=_0x108e26-0x0;var _0x2ce506=_0xf3c0[_0x108e26];return _0x2ce506;};'use strict';var multer=require(_0x0f3c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0f3c('0x1'));var express=require(_0x0f3c('0x2'));var router=express[_0x0f3c('0x3')]();var fs_extra=require(_0x0f3c('0x4'));var auth=require(_0x0f3c('0x5'));var interaction=require(_0x0f3c('0x6'));var config=require(_0x0f3c('0x7'));var controller=require(_0x0f3c('0x8'));router[_0x0f3c('0x9')]('/',auth[_0x0f3c('0xa')](),controller[_0x0f3c('0xb')]);router[_0x0f3c('0x9')](_0x0f3c('0xc'),auth['isAuthenticated'](),controller[_0x0f3c('0xd')]);router[_0x0f3c('0x9')](_0x0f3c('0xe'),auth[_0x0f3c('0xa')](),controller[_0x0f3c('0xf')]);router[_0x0f3c('0x9')]('/:id/run',auth[_0x0f3c('0xa')](),controller['run']);router[_0x0f3c('0x9')](_0x0f3c('0x10'),auth[_0x0f3c('0xa')](),controller['query']);router[_0x0f3c('0x11')]('/',auth[_0x0f3c('0xa')](),controller[_0x0f3c('0x12')]);router[_0x0f3c('0x13')](_0x0f3c('0xc'),auth['isAuthenticated'](),controller[_0x0f3c('0x14')]);router[_0x0f3c('0x15')](_0x0f3c('0xc'),auth[_0x0f3c('0xa')](),controller[_0x0f3c('0x16')]);module[_0x0f3c('0x17')]=router; \ No newline at end of file +var _0x1e89=['../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','show','/:id/preview','/:id/run','isAuthenticated','run','query','post','create','put','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x565f80,_0x4b0eb4){var _0x331c76=function(_0x31df82){while(--_0x31df82){_0x565f80['push'](_0x565f80['shift']());}};_0x331c76(++_0x4b0eb4);}(_0x1e89,0x119));var _0x91e8=function(_0x422ba7,_0x3efc0c){_0x422ba7=_0x422ba7-0x0;var _0x3008f5=_0x1e89[_0x422ba7];return _0x3008f5;};'use strict';var multer=require(_0x91e8('0x0'));var util=require(_0x91e8('0x1'));var path=require('path');var timeout=require(_0x91e8('0x2'));var express=require(_0x91e8('0x3'));var router=express[_0x91e8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91e8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x91e8('0x6'));var controller=require(_0x91e8('0x7'));router[_0x91e8('0x8')]('/',auth['isAuthenticated'](),controller[_0x91e8('0x9')]);router[_0x91e8('0x8')](_0x91e8('0xa'),auth['isAuthenticated'](),controller[_0x91e8('0xb')]);router[_0x91e8('0x8')](_0x91e8('0xc'),auth['isAuthenticated'](),controller['preview']);router['get'](_0x91e8('0xd'),auth[_0x91e8('0xe')](),controller[_0x91e8('0xf')]);router[_0x91e8('0x8')]('/:id/query',auth[_0x91e8('0xe')](),controller[_0x91e8('0x10')]);router[_0x91e8('0x11')]('/',auth['isAuthenticated'](),controller[_0x91e8('0x12')]);router[_0x91e8('0x13')](_0x91e8('0xa'),auth[_0x91e8('0xe')](),controller[_0x91e8('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x91e8('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 56ed252..b54a3a0 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 _0x4698=['DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','xlsx'];(function(_0x32f5c3,_0x5d497a){var _0x2cc3eb=function(_0x5a6660){while(--_0x5a6660){_0x32f5c3['push'](_0x32f5c3['shift']());}};_0x2cc3eb(++_0x5d497a);}(_0x4698,0x8a));var _0x8469=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x4698[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x8469('0x0'));var moment=require(_0x8469('0x1'));module['exports']={'name':{'type':Sequelize[_0x8469('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x8469('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x8469('0x3')](_0x8469('0x4'),'pdf',_0x8469('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x8469('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x8469('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x8469('0x7')},'type':{'type':Sequelize[_0x8469('0x3')](_0x8469('0x8'),_0x8469('0x9')),'allowNull':![],'defaultValue':_0x8469('0x8')},'reportId':{'type':Sequelize[_0x8469('0xa')](0xb)[_0x8469('0xb')]},'reportType':{'type':Sequelize[_0x8469('0x2')]}}; \ No newline at end of file +var _0x620e=['csv','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x620e,0x1db));var _0xe620=function(_0x348ea4,_0x1b3329){_0x348ea4=_0x348ea4-0x0;var _0xcda143=_0x620e[_0x348ea4];return _0xcda143;};'use strict';var Sequelize=require(_0xe620('0x0'));var moment=require(_0xe620('0x1'));module[_0xe620('0x2')]={'name':{'type':Sequelize[_0xe620('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xe620('0x4')](_0xe620('0x5'),'pdf',_0xe620('0x6')),'allowNull':![],'defaultValue':_0xe620('0x5')},'savename':{'type':Sequelize[_0xe620('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xe620('0x7')]},'status':{'type':Sequelize[_0xe620('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xe620('0x4')](_0xe620('0x8'),_0xe620('0x9')),'allowNull':![],'defaultValue':_0xe620('0x8')},'reportId':{'type':Sequelize[_0xe620('0xa')](0xb)[_0xe620('0xb')]},'reportType':{'type':Sequelize[_0xe620('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 4cb646a..44a67c7 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 _0xcb4e=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','basename','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','join','format','%s.%s','output','eml-format','fast-json-patch','moment','bluebird','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x32255e,_0x385ff8){var _0x598fc1=function(_0x5d38de){while(--_0x5d38de){_0x32255e['push'](_0x32255e['shift']());}};_0x598fc1(++_0x385ff8);}(_0xcb4e,0xa2));var _0xecb4=function(_0x41fd4a,_0x168a17){_0x41fd4a=_0x41fd4a-0x0;var _0x269875=_0xcb4e[_0x41fd4a];return _0x269875;};'use strict';var emlformat=require(_0xecb4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xecb4('0x1'));var rp=require('request-promise');var moment=require(_0xecb4('0x2'));var BPromise=require(_0xecb4('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xecb4('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecb4('0x5'));var _=require(_0xecb4('0x6'));var squel=require('squel');var crypto=require(_0xecb4('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xecb4('0x8'));var toCsv=require('to-csv');var querystring=require(_0xecb4('0x9'));var Papa=require(_0xecb4('0xa'));var Redis=require(_0xecb4('0xb'));var authService=require(_0xecb4('0xc'));var qs=require(_0xecb4('0xd'));var as=require(_0xecb4('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xecb4('0xf'))(_0xecb4('0x10'));var utils=require(_0xecb4('0x11'));var config=require(_0xecb4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xecb4('0x13'))['db'];function respondWithStatusCode(_0x9f7ca6,_0x3f1007){_0x3f1007=_0x3f1007||0xcc;return function(_0x2450aa){if(_0x2450aa){return _0x9f7ca6[_0xecb4('0x14')](_0x3f1007);}return _0x9f7ca6[_0xecb4('0x15')](_0x3f1007)[_0xecb4('0x16')]();};}function respondWithResult(_0x1367fd,_0x2a7149){_0x2a7149=_0x2a7149||0xc8;return function(_0x10547c){if(_0x10547c){return _0x1367fd[_0xecb4('0x15')](_0x2a7149)[_0xecb4('0x17')](_0x10547c);}};}function respondWithFilteredResult(_0x346228,_0x4028fa){return function(_0xd7f045){if(_0xd7f045){var _0x45b2b6=typeof _0x4028fa[_0xecb4('0x18')]===_0xecb4('0x19')&&typeof _0x4028fa[_0xecb4('0x1a')]==='undefined';var _0x1195e4=_0xd7f045['count'];var _0x4bb5df=_0x45b2b6?0x0:_0x4028fa['offset'];var _0x2691b5=_0x45b2b6?_0xd7f045['count']:_0x4028fa['offset']+_0x4028fa[_0xecb4('0x1a')];var _0x348773;if(_0x2691b5>=_0x1195e4){_0x2691b5=_0x1195e4;_0x348773=0xc8;}else{_0x348773=0xce;}_0x346228['status'](_0x348773);return _0x346228[_0xecb4('0x1b')](_0xecb4('0x1c'),_0x4bb5df+'-'+_0x2691b5+'/'+_0x1195e4)['json'](_0xd7f045);}return null;};}function patchUpdates(_0x243283){return function(_0x395ed0){try{jsonpatch[_0xecb4('0x1d')](_0x395ed0,_0x243283,!![]);}catch(_0x142484){return BPromise[_0xecb4('0x1e')](_0x142484);}return _0x395ed0[_0xecb4('0x1f')]();};}function saveUpdates(_0x1402a6,_0x52ffb5){return function(_0x1325e0){if(_0x1325e0){return _0x1325e0[_0xecb4('0x20')](_0x1402a6)[_0xecb4('0x21')](function(_0x1ba9f7){return _0x1ba9f7;});}return null;};}function removeEntity(_0x428d67,_0x3001ef){return function(_0x28fe2e){if(_0x28fe2e){return _0x28fe2e[_0xecb4('0x22')]()[_0xecb4('0x21')](function(){var _0xcc6baf=_0x28fe2e['get']({'plain':!![]});var _0x539e62=_0xecb4('0x23');return db[_0xecb4('0x24')][_0xecb4('0x22')]({'where':{'type':_0x539e62,'resourceId':_0xcc6baf['id']}})['then'](function(){return _0x28fe2e;});})[_0xecb4('0x21')](function(){_0x428d67['status'](0xcc)[_0xecb4('0x16')]();});}};}function handleEntityNotFound(_0x39edda,_0x2faf96){return function(_0x5a14e9){if(!_0x5a14e9){_0x39edda[_0xecb4('0x14')](0x194);}return _0x5a14e9;};}function handleError(_0x3537da,_0x3dabfa){_0x3dabfa=_0x3dabfa||0x1f4;return function(_0x14f940){logger[_0xecb4('0x25')](_0x14f940[_0xecb4('0x26')]);if(_0x14f940[_0xecb4('0x27')]){delete _0x14f940[_0xecb4('0x27')];}_0x3537da[_0xecb4('0x15')](_0x3dabfa)['send'](_0x14f940);};}exports['index']=function(_0x4a9ee8,_0x3249a6){var _0x331f63={},_0x12bbc8={},_0x590791={'count':0x0,'rows':[]};var _0x2175e0=_[_0xecb4('0x28')](db[_0xecb4('0x29')][_0xecb4('0x2a')],function(_0x5a1226){return{'name':_0x5a1226[_0xecb4('0x2b')],'type':_0x5a1226[_0xecb4('0x2c')][_0xecb4('0x2d')]};});_0x12bbc8[_0xecb4('0x2e')]=_[_0xecb4('0x28')](_0x2175e0,_0xecb4('0x27'));_0x12bbc8['query']=_[_0xecb4('0x2f')](_0x4a9ee8[_0xecb4('0x30')]);_0x12bbc8[_0xecb4('0x31')]=_[_0xecb4('0x32')](_0x12bbc8[_0xecb4('0x2e')],_0x12bbc8[_0xecb4('0x30')]);_0x331f63[_0xecb4('0x33')]=_[_0xecb4('0x32')](_0x12bbc8['model'],qs[_0xecb4('0x34')](_0x4a9ee8[_0xecb4('0x30')]['fields']));_0x331f63[_0xecb4('0x33')]=_0x331f63[_0xecb4('0x33')][_0xecb4('0x35')]?_0x331f63['attributes']:_0x12bbc8[_0xecb4('0x2e')];if(!_0x4a9ee8[_0xecb4('0x30')][_0xecb4('0x36')](_0xecb4('0x37'))){_0x331f63[_0xecb4('0x1a')]=qs['limit'](_0x4a9ee8['query'][_0xecb4('0x1a')]);_0x331f63[_0xecb4('0x18')]=qs[_0xecb4('0x18')](_0x4a9ee8[_0xecb4('0x30')][_0xecb4('0x18')]);}_0x331f63[_0xecb4('0x38')]=qs[_0xecb4('0x39')](_0x4a9ee8[_0xecb4('0x30')][_0xecb4('0x39')]);_0x331f63[_0xecb4('0x3a')]=qs['filters'](_[_0xecb4('0x3b')](_0x4a9ee8[_0xecb4('0x30')],_0x12bbc8['filters']),_0x2175e0);if(_0x4a9ee8[_0xecb4('0x30')]['filter']){_0x331f63[_0xecb4('0x3a')]=_[_0xecb4('0x3c')](_0x331f63[_0xecb4('0x3a')],{'$or':_['map'](_0x2175e0,function(_0x5142f6){if(_0x5142f6[_0xecb4('0x2c')]!==_0xecb4('0x3d')){var _0x5ade9b={};_0x5ade9b[_0x5142f6['name']]={'$like':'%'+_0x4a9ee8[_0xecb4('0x30')][_0xecb4('0x3e')]+'%'};return _0x5ade9b;}})});}_0x331f63=_[_0xecb4('0x3c')]({},_0x331f63,_0x4a9ee8[_0xecb4('0x3f')]);var _0xb66534={'where':_0x331f63[_0xecb4('0x3a')]};return db[_0xecb4('0x29')]['count'](_0xb66534)[_0xecb4('0x21')](function(_0x565b5c){_0x590791['count']=_0x565b5c;if(_0x4a9ee8[_0xecb4('0x30')]['includeAll']){_0x331f63[_0xecb4('0x40')]=[{'all':!![]}];}return db[_0xecb4('0x29')]['findAll'](_0x331f63);})['then'](function(_0x21e0eb){_0x590791['rows']=_0x21e0eb;return _0x590791;})[_0xecb4('0x21')](respondWithFilteredResult(_0x3249a6,_0x331f63))[_0xecb4('0x41')](handleError(_0x3249a6,null));};exports[_0xecb4('0x42')]=function(_0x197412,_0x1b4882){var _0x18d9ec={'raw':!![],'where':{'id':_0x197412[_0xecb4('0x43')]['id']}},_0x584a89={};_0x584a89[_0xecb4('0x2e')]=_[_0xecb4('0x2f')](db['AnalyticExtractedReport'][_0xecb4('0x2a')]);_0x584a89[_0xecb4('0x30')]=_['keys'](_0x197412[_0xecb4('0x30')]);_0x584a89[_0xecb4('0x31')]=_[_0xecb4('0x32')](_0x584a89[_0xecb4('0x2e')],_0x584a89[_0xecb4('0x30')]);_0x18d9ec[_0xecb4('0x33')]=_['intersection'](_0x584a89[_0xecb4('0x2e')],qs[_0xecb4('0x34')](_0x197412['query'][_0xecb4('0x34')]));_0x18d9ec[_0xecb4('0x33')]=_0x18d9ec['attributes']['length']?_0x18d9ec[_0xecb4('0x33')]:_0x584a89['model'];if(_0x197412[_0xecb4('0x30')]['includeAll']){_0x18d9ec[_0xecb4('0x40')]=[{'all':!![]}];}_0x18d9ec=_['merge']({},_0x18d9ec,_0x197412[_0xecb4('0x3f')]);return db[_0xecb4('0x29')][_0xecb4('0x44')](_0x18d9ec)[_0xecb4('0x21')](handleEntityNotFound(_0x1b4882,null))[_0xecb4('0x21')](respondWithResult(_0x1b4882,null))[_0xecb4('0x41')](handleError(_0x1b4882,null));};exports[_0xecb4('0x45')]=function(_0x1517b8,_0x74969d){return db[_0xecb4('0x29')][_0xecb4('0x45')](_0x1517b8[_0xecb4('0x46')],{})['then'](function(_0x14ba7e){var _0x5cb29a=_0x1517b8[_0xecb4('0x47')][_0xecb4('0x48')]({'plain':!![]});if(!_0x5cb29a)throw new Error(_0xecb4('0x49'));if(_0x5cb29a[_0xecb4('0x4a')]===_0xecb4('0x47')){var _0xe5657c=_0x14ba7e[_0xecb4('0x48')]({'plain':!![]});var _0x713e38='ExtractedReports';return db[_0xecb4('0x4b')][_0xecb4('0x44')]({'where':{'name':_0x713e38,'userProfileId':_0x5cb29a['userProfileId']},'raw':!![]})['then'](function(_0x58f04c){if(_0x58f04c&&_0x58f04c[_0xecb4('0x4c')]===0x0){return db[_0xecb4('0x24')][_0xecb4('0x45')]({'name':_0xe5657c[_0xecb4('0x27')],'resourceId':_0xe5657c['id'],'type':_0x58f04c['name'],'sectionId':_0x58f04c['id']},{})[_0xecb4('0x21')](function(){return _0x14ba7e;});}else{return _0x14ba7e;}})['catch'](function(_0x48e0bc){logger[_0xecb4('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48e0bc);throw _0x48e0bc;});}return _0x14ba7e;})[_0xecb4('0x21')](respondWithResult(_0x74969d,0xc9))['catch'](handleError(_0x74969d,null));};exports[_0xecb4('0x20')]=function(_0x2b0f58,_0x12b79e){if(_0x2b0f58[_0xecb4('0x46')]['id']){delete _0x2b0f58[_0xecb4('0x46')]['id'];}return db[_0xecb4('0x29')]['find']({'where':{'id':_0x2b0f58[_0xecb4('0x43')]['id']}})[_0xecb4('0x21')](handleEntityNotFound(_0x12b79e,null))['then'](saveUpdates(_0x2b0f58[_0xecb4('0x46')],null))[_0xecb4('0x21')](respondWithResult(_0x12b79e,null))[_0xecb4('0x41')](handleError(_0x12b79e,null));};exports[_0xecb4('0x22')]=function(_0x4f6e1b,_0x484eed){return db['AnalyticExtractedReport'][_0xecb4('0x44')]({'where':{'id':_0x4f6e1b[_0xecb4('0x43')]['id']}})[_0xecb4('0x21')](handleEntityNotFound(_0x484eed,null))[_0xecb4('0x21')](removeEntity(_0x484eed,null))['catch'](handleError(_0x484eed,null));};exports['download']=function(_0x125fd2,_0x14c1b6,_0xa3b91f){return db['AnalyticExtractedReport'][_0xecb4('0x44')]({'where':{'id':_0x125fd2[_0xecb4('0x43')]['id']},'attributes':['name',_0xecb4('0x4d'),'savename','output'],'raw':!![]})['then'](handleEntityNotFound(_0x14c1b6,null))['then'](function(_0xd833b8){if(_0xd833b8){if(!fs['existsSync'](path['join'](config[_0xecb4('0x4e')],_0xecb4('0x4f'),_0xd833b8[_0xecb4('0x50')]))){throw new db[(_0xecb4('0x51'))][(_0xecb4('0x52'))](_0xecb4('0x53'));}if(_0x125fd2['query'][_0xecb4('0x54')]){return _0x14c1b6[_0xecb4('0x14')](0xc8);}return _0x14c1b6[_0xecb4('0x55')](path[_0xecb4('0x56')](config[_0xecb4('0x4e')],_0xecb4('0x4f'),_0xd833b8['savename']),util[_0xecb4('0x57')](_0xecb4('0x58'),_0xd833b8['basename']||_0xd833b8[_0xecb4('0x27')],_0xd833b8[_0xecb4('0x59')]['toLowerCase']()));}})['catch'](handleError(_0x14c1b6,null));}; \ No newline at end of file +var _0x25fe=['include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','download','savename','output','join','root','server/files/reports','Sequelize','ValidationError','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','show','params'];(function(_0x302099,_0xe61dca){var _0x24a042=function(_0x50b7fb){while(--_0x50b7fb){_0x302099['push'](_0x302099['shift']());}};_0x24a042(++_0xe61dca);}(_0x25fe,0x19d));var _0xe25f=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x25fe[_0x5471ec];return _0x121d4c;};'use strict';var emlformat=require(_0xe25f('0x0'));var rimraf=require(_0xe25f('0x1'));var zipdir=require(_0xe25f('0x2'));var jsonpatch=require(_0xe25f('0x3'));var rp=require(_0xe25f('0x4'));var moment=require('moment');var BPromise=require(_0xe25f('0x5'));var Mustache=require(_0xe25f('0x6'));var util=require('util');var path=require(_0xe25f('0x7'));var sox=require(_0xe25f('0x8'));var csv=require(_0xe25f('0x9'));var ejs=require(_0xe25f('0xa'));var fs=require('fs');var fs_extra=require(_0xe25f('0xb'));var _=require(_0xe25f('0xc'));var squel=require(_0xe25f('0xd'));var crypto=require(_0xe25f('0xe'));var jsforce=require(_0xe25f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe25f('0x9'));var querystring=require(_0xe25f('0x10'));var Papa=require(_0xe25f('0x11'));var Redis=require(_0xe25f('0x12'));var authService=require(_0xe25f('0x13'));var qs=require(_0xe25f('0x14'));var as=require(_0xe25f('0x15'));var hardwareService=require(_0xe25f('0x16'));var logger=require(_0xe25f('0x17'))(_0xe25f('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe25f('0x19'));var db=require(_0xe25f('0x1a'))['db'];function respondWithStatusCode(_0x12ac98,_0x364fe7){_0x364fe7=_0x364fe7||0xcc;return function(_0x439a76){if(_0x439a76){return _0x12ac98['sendStatus'](_0x364fe7);}return _0x12ac98['status'](_0x364fe7)[_0xe25f('0x1b')]();};}function respondWithResult(_0x5acd54,_0x1b4ab9){_0x1b4ab9=_0x1b4ab9||0xc8;return function(_0x2af5e9){if(_0x2af5e9){return _0x5acd54[_0xe25f('0x1c')](_0x1b4ab9)[_0xe25f('0x1d')](_0x2af5e9);}};}function respondWithFilteredResult(_0x5c2fce,_0x3cc95a){return function(_0xa0b7f){if(_0xa0b7f){var _0x33877b=typeof _0x3cc95a[_0xe25f('0x1e')]===_0xe25f('0x1f')&&typeof _0x3cc95a[_0xe25f('0x20')]===_0xe25f('0x1f');var _0x1e1010=_0xa0b7f[_0xe25f('0x21')];var _0xf5421a=_0x33877b?0x0:_0x3cc95a['offset'];var _0x4a4542=_0x33877b?_0xa0b7f[_0xe25f('0x21')]:_0x3cc95a[_0xe25f('0x1e')]+_0x3cc95a[_0xe25f('0x20')];var _0x3a3b03;if(_0x4a4542>=_0x1e1010){_0x4a4542=_0x1e1010;_0x3a3b03=0xc8;}else{_0x3a3b03=0xce;}_0x5c2fce['status'](_0x3a3b03);return _0x5c2fce[_0xe25f('0x22')]('Content-Range',_0xf5421a+'-'+_0x4a4542+'/'+_0x1e1010)[_0xe25f('0x1d')](_0xa0b7f);}return null;};}function patchUpdates(_0x567e25){return function(_0x3762d0){try{jsonpatch[_0xe25f('0x23')](_0x3762d0,_0x567e25,!![]);}catch(_0x493e84){return BPromise[_0xe25f('0x24')](_0x493e84);}return _0x3762d0[_0xe25f('0x25')]();};}function saveUpdates(_0x45a055,_0x335c15){return function(_0x45113d){if(_0x45113d){return _0x45113d['update'](_0x45a055)['then'](function(_0x224aef){return _0x224aef;});}return null;};}function removeEntity(_0xe8756f,_0x5c121b){return function(_0x3fceda){if(_0x3fceda){return _0x3fceda[_0xe25f('0x26')]()[_0xe25f('0x27')](function(){var _0x265d03=_0x3fceda[_0xe25f('0x28')]({'plain':!![]});var _0x1052fe=_0xe25f('0x29');return db[_0xe25f('0x2a')][_0xe25f('0x26')]({'where':{'type':_0x1052fe,'resourceId':_0x265d03['id']}})['then'](function(){return _0x3fceda;});})[_0xe25f('0x27')](function(){_0xe8756f[_0xe25f('0x1c')](0xcc)[_0xe25f('0x1b')]();});}};}function handleEntityNotFound(_0x4a5ba1,_0x1c3e8e){return function(_0x415638){if(!_0x415638){_0x4a5ba1[_0xe25f('0x2b')](0x194);}return _0x415638;};}function handleError(_0x4c89a4,_0xfed027){_0xfed027=_0xfed027||0x1f4;return function(_0x216b90){logger[_0xe25f('0x2c')](_0x216b90[_0xe25f('0x2d')]);if(_0x216b90[_0xe25f('0x2e')]){delete _0x216b90['name'];}_0x4c89a4[_0xe25f('0x1c')](_0xfed027)[_0xe25f('0x2f')](_0x216b90);};}exports[_0xe25f('0x30')]=function(_0x1b4fd6,_0x2e359c){var _0x2f8ca4={},_0x569b0f={},_0x3144e0={'count':0x0,'rows':[]};var _0x31c8f6=_[_0xe25f('0x31')](db[_0xe25f('0x32')][_0xe25f('0x33')],function(_0x49212c){return{'name':_0x49212c[_0xe25f('0x34')],'type':_0x49212c['type'][_0xe25f('0x35')]};});_0x569b0f[_0xe25f('0x36')]=_['map'](_0x31c8f6,_0xe25f('0x2e'));_0x569b0f[_0xe25f('0x37')]=_[_0xe25f('0x38')](_0x1b4fd6[_0xe25f('0x37')]);_0x569b0f[_0xe25f('0x39')]=_['intersection'](_0x569b0f[_0xe25f('0x36')],_0x569b0f[_0xe25f('0x37')]);_0x2f8ca4[_0xe25f('0x3a')]=_[_0xe25f('0x3b')](_0x569b0f[_0xe25f('0x36')],qs[_0xe25f('0x3c')](_0x1b4fd6['query'][_0xe25f('0x3c')]));_0x2f8ca4[_0xe25f('0x3a')]=_0x2f8ca4[_0xe25f('0x3a')][_0xe25f('0x3d')]?_0x2f8ca4[_0xe25f('0x3a')]:_0x569b0f['model'];if(!_0x1b4fd6[_0xe25f('0x37')][_0xe25f('0x3e')](_0xe25f('0x3f'))){_0x2f8ca4[_0xe25f('0x20')]=qs[_0xe25f('0x20')](_0x1b4fd6[_0xe25f('0x37')][_0xe25f('0x20')]);_0x2f8ca4[_0xe25f('0x1e')]=qs[_0xe25f('0x1e')](_0x1b4fd6['query'][_0xe25f('0x1e')]);}_0x2f8ca4[_0xe25f('0x40')]=qs[_0xe25f('0x41')](_0x1b4fd6[_0xe25f('0x37')][_0xe25f('0x41')]);_0x2f8ca4['where']=qs[_0xe25f('0x39')](_[_0xe25f('0x42')](_0x1b4fd6[_0xe25f('0x37')],_0x569b0f[_0xe25f('0x39')]),_0x31c8f6);if(_0x1b4fd6[_0xe25f('0x37')][_0xe25f('0x43')]){_0x2f8ca4['where']=_[_0xe25f('0x44')](_0x2f8ca4[_0xe25f('0x45')],{'$or':_['map'](_0x31c8f6,function(_0x4a174f){if(_0x4a174f['type']!==_0xe25f('0x46')){var _0x26cbfd={};_0x26cbfd[_0x4a174f['name']]={'$like':'%'+_0x1b4fd6[_0xe25f('0x37')][_0xe25f('0x43')]+'%'};return _0x26cbfd;}})});}_0x2f8ca4=_['merge']({},_0x2f8ca4,_0x1b4fd6[_0xe25f('0x47')]);var _0x1cdd21={'where':_0x2f8ca4['where']};return db[_0xe25f('0x32')][_0xe25f('0x21')](_0x1cdd21)['then'](function(_0x4c2f40){_0x3144e0[_0xe25f('0x21')]=_0x4c2f40;if(_0x1b4fd6[_0xe25f('0x37')][_0xe25f('0x48')]){_0x2f8ca4['include']=[{'all':!![]}];}return db[_0xe25f('0x32')][_0xe25f('0x49')](_0x2f8ca4);})[_0xe25f('0x27')](function(_0x4fe55b){_0x3144e0['rows']=_0x4fe55b;return _0x3144e0;})[_0xe25f('0x27')](respondWithFilteredResult(_0x2e359c,_0x2f8ca4))[_0xe25f('0x4a')](handleError(_0x2e359c,null));};exports[_0xe25f('0x4b')]=function(_0x1f992e,_0x5c19fe){var _0x33e014={'raw':!![],'where':{'id':_0x1f992e[_0xe25f('0x4c')]['id']}},_0x44ce10={};_0x44ce10['model']=_[_0xe25f('0x38')](db[_0xe25f('0x32')][_0xe25f('0x33')]);_0x44ce10['query']=_[_0xe25f('0x38')](_0x1f992e[_0xe25f('0x37')]);_0x44ce10[_0xe25f('0x39')]=_['intersection'](_0x44ce10[_0xe25f('0x36')],_0x44ce10[_0xe25f('0x37')]);_0x33e014[_0xe25f('0x3a')]=_['intersection'](_0x44ce10[_0xe25f('0x36')],qs[_0xe25f('0x3c')](_0x1f992e[_0xe25f('0x37')][_0xe25f('0x3c')]));_0x33e014['attributes']=_0x33e014[_0xe25f('0x3a')][_0xe25f('0x3d')]?_0x33e014[_0xe25f('0x3a')]:_0x44ce10[_0xe25f('0x36')];if(_0x1f992e[_0xe25f('0x37')][_0xe25f('0x48')]){_0x33e014[_0xe25f('0x4d')]=[{'all':!![]}];}_0x33e014=_['merge']({},_0x33e014,_0x1f992e[_0xe25f('0x47')]);return db[_0xe25f('0x32')]['find'](_0x33e014)[_0xe25f('0x27')](handleEntityNotFound(_0x5c19fe,null))['then'](respondWithResult(_0x5c19fe,null))[_0xe25f('0x4a')](handleError(_0x5c19fe,null));};exports[_0xe25f('0x4e')]=function(_0x3ea1ab,_0x457f49){return db[_0xe25f('0x32')]['create'](_0x3ea1ab[_0xe25f('0x4f')],{})['then'](function(_0x1e6d63){var _0x6e38f7=_0x3ea1ab[_0xe25f('0x50')][_0xe25f('0x28')]({'plain':!![]});if(!_0x6e38f7)throw new Error(_0xe25f('0x51'));if(_0x6e38f7[_0xe25f('0x52')]==='user'){var _0x473dd1=_0x1e6d63[_0xe25f('0x28')]({'plain':!![]});var _0x4c6a0b='ExtractedReports';return db[_0xe25f('0x53')]['find']({'where':{'name':_0x4c6a0b,'userProfileId':_0x6e38f7[_0xe25f('0x54')]},'raw':!![]})[_0xe25f('0x27')](function(_0x5afda3){if(_0x5afda3&&_0x5afda3['autoAssociation']===0x0){return db[_0xe25f('0x2a')][_0xe25f('0x4e')]({'name':_0x473dd1[_0xe25f('0x2e')],'resourceId':_0x473dd1['id'],'type':_0x5afda3[_0xe25f('0x2e')],'sectionId':_0x5afda3['id']},{})['then'](function(){return _0x1e6d63;});}else{return _0x1e6d63;}})[_0xe25f('0x4a')](function(_0x372d41){logger[_0xe25f('0x2c')](_0xe25f('0x55'),_0x372d41);throw _0x372d41;});}return _0x1e6d63;})['then'](respondWithResult(_0x457f49,0xc9))[_0xe25f('0x4a')](handleError(_0x457f49,null));};exports['update']=function(_0x570436,_0x49b0e1){if(_0x570436[_0xe25f('0x4f')]['id']){delete _0x570436['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x570436['params']['id']}})[_0xe25f('0x27')](handleEntityNotFound(_0x49b0e1,null))[_0xe25f('0x27')](saveUpdates(_0x570436[_0xe25f('0x4f')],null))[_0xe25f('0x27')](respondWithResult(_0x49b0e1,null))['catch'](handleError(_0x49b0e1,null));};exports[_0xe25f('0x26')]=function(_0x2b8e85,_0x22e23f){return db['AnalyticExtractedReport'][_0xe25f('0x56')]({'where':{'id':_0x2b8e85[_0xe25f('0x4c')]['id']}})[_0xe25f('0x27')](handleEntityNotFound(_0x22e23f,null))[_0xe25f('0x27')](removeEntity(_0x22e23f,null))[_0xe25f('0x4a')](handleError(_0x22e23f,null));};exports[_0xe25f('0x57')]=function(_0x15e58e,_0x11a190,_0x3eebe6){return db['AnalyticExtractedReport'][_0xe25f('0x56')]({'where':{'id':_0x15e58e[_0xe25f('0x4c')]['id']},'attributes':[_0xe25f('0x2e'),'basename',_0xe25f('0x58'),_0xe25f('0x59')],'raw':!![]})[_0xe25f('0x27')](handleEntityNotFound(_0x11a190,null))[_0xe25f('0x27')](function(_0x503667){if(_0x503667){if(!fs['existsSync'](path[_0xe25f('0x5a')](config[_0xe25f('0x5b')],_0xe25f('0x5c'),_0x503667[_0xe25f('0x58')]))){throw new db[(_0xe25f('0x5d'))][(_0xe25f('0x5e'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x15e58e[_0xe25f('0x37')]['exists']){return _0x11a190[_0xe25f('0x2b')](0xc8);}return _0x11a190[_0xe25f('0x57')](path[_0xe25f('0x5a')](config['root'],_0xe25f('0x5c'),_0x503667[_0xe25f('0x58')]),util[_0xe25f('0x5f')](_0xe25f('0x60'),_0x503667['basename']||_0x503667[_0xe25f('0x2e')],_0x503667[_0xe25f('0x59')][_0xe25f('0x61')]()));}})['catch'](handleError(_0x11a190,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 865f053..21ec644 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 _0x2184=['AnalyticExtractedReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x1c9871,_0x457ebf){var _0x2c30de=function(_0x35d057){while(--_0x35d057){_0x1c9871['push'](_0x1c9871['shift']());}};_0x2c30de(++_0x457ebf);}(_0x2184,0xdd));var _0x4218=function(_0x204175,_0x38e654){_0x204175=_0x204175-0x0;var _0x39e6aa=_0x2184[_0x204175];return _0x39e6aa;};'use strict';var _=require(_0x4218('0x0'));var util=require(_0x4218('0x1'));var logger=require(_0x4218('0x2'))(_0x4218('0x3'));var moment=require(_0x4218('0x4'));var BPromise=require('bluebird');var rp=require(_0x4218('0x5'));var fs=require('fs');var path=require(_0x4218('0x6'));var rimraf=require(_0x4218('0x7'));var config=require(_0x4218('0x8'));var attributes=require(_0x4218('0x9'));module['exports']=function(_0x500f28,_0x312a10){return _0x500f28['define'](_0x4218('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe099=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','analytics_extracted_reports'];(function(_0x5162ed,_0x386cb7){var _0x4c579b=function(_0x189260){while(--_0x189260){_0x5162ed['push'](_0x5162ed['shift']());}};_0x4c579b(++_0x386cb7);}(_0xe099,0xea));var _0x9e09=function(_0x4d851b,_0x562b0a){_0x4d851b=_0x4d851b-0x0;var _0x4f62d6=_0xe099[_0x4d851b];return _0x4f62d6;};'use strict';var _=require(_0x9e09('0x0'));var util=require(_0x9e09('0x1'));var logger=require(_0x9e09('0x2'))(_0x9e09('0x3'));var moment=require(_0x9e09('0x4'));var BPromise=require(_0x9e09('0x5'));var rp=require(_0x9e09('0x6'));var fs=require('fs');var path=require(_0x9e09('0x7'));var rimraf=require(_0x9e09('0x8'));var config=require(_0x9e09('0x9'));var attributes=require(_0x9e09('0xa'));module[_0x9e09('0xb')]=function(_0x29ff24,_0x43db2f){return _0x29ff24['define']('AnalyticExtractedReport',attributes,{'tableName':_0x9e09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index eb4bc82..0be6289 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 _0xa105=['info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x3d9921,_0x48927c){var _0x55f6a8=function(_0x5511eb){while(--_0x5511eb){_0x3d9921['push'](_0x3d9921['shift']());}};_0x55f6a8(++_0x48927c);}(_0xa105,0xe8));var _0x5a10=function(_0x4033c5,_0x4a299d){_0x4033c5=_0x4033c5-0x0;var _0x1d4bcd=_0xa105[_0x4033c5];return _0x1d4bcd;};'use strict';var _=require(_0x5a10('0x0'));var util=require(_0x5a10('0x1'));var moment=require(_0x5a10('0x2'));var BPromise=require(_0x5a10('0x3'));var rs=require(_0x5a10('0x4'));var fs=require('fs');var Redis=require(_0x5a10('0x5'));var db=require(_0x5a10('0x6'))['db'];var utils=require(_0x5a10('0x7'));var logger=require(_0x5a10('0x8'))(_0x5a10('0x9'));var config=require(_0x5a10('0xa'));var jayson=require(_0x5a10('0xb'));var client=jayson['client'][_0x5a10('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x403466,_0x3afbbf,_0x3c0386){return new BPromise(function(_0x2beceb,_0x56b633){return client['request'](_0x403466,_0x3c0386)[_0x5a10('0xd')](function(_0x180926){logger['info'](_0x5a10('0xe'),_0x3afbbf,'request\x20sent');logger[_0x5a10('0xf')](_0x5a10('0x10'),_0x3afbbf,_0x5a10('0x11'),JSON[_0x5a10('0x12')](_0x180926));if(_0x180926['error']){if(_0x180926[_0x5a10('0x13')]['code']===0x1f4){logger[_0x5a10('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3afbbf,_0x180926['error'][_0x5a10('0x14')]);return _0x56b633(_0x180926['error'][_0x5a10('0x14')]);}logger[_0x5a10('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3afbbf,_0x180926[_0x5a10('0x13')][_0x5a10('0x14')]);return _0x2beceb(_0x180926[_0x5a10('0x13')][_0x5a10('0x14')]);}else{logger[_0x5a10('0x15')](_0x5a10('0xe'),_0x3afbbf,_0x5a10('0x11'));_0x2beceb(_0x180926[_0x5a10('0x16')][_0x5a10('0x14')]);}})['catch'](function(_0x380ed2){logger['error'](_0x5a10('0xe'),_0x3afbbf,_0x380ed2);_0x56b633(_0x380ed2);});});} \ No newline at end of file +var _0x8e53=['rpc','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x575395,_0x23cc3e){var _0x223bf5=function(_0x5bbbab){while(--_0x5bbbab){_0x575395['push'](_0x575395['shift']());}};_0x223bf5(++_0x23cc3e);}(_0x8e53,0xb6));var _0x38e5=function(_0x4bda08,_0x3c2c11){_0x4bda08=_0x4bda08-0x0;var _0x1a02cc=_0x8e53[_0x4bda08];return _0x1a02cc;};'use strict';var _=require(_0x38e5('0x0'));var util=require('util');var moment=require(_0x38e5('0x1'));var BPromise=require(_0x38e5('0x2'));var rs=require(_0x38e5('0x3'));var fs=require('fs');var Redis=require(_0x38e5('0x4'));var db=require(_0x38e5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38e5('0x6'))(_0x38e5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x38e5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3a98,_0x4a7850,_0x5b6b61){return new BPromise(function(_0xcaa8fc,_0x2cca15){return client[_0x38e5('0x9')](_0x3e3a98,_0x5b6b61)[_0x38e5('0xa')](function(_0x412ed0){logger[_0x38e5('0xb')](_0x38e5('0xc'),_0x4a7850,_0x38e5('0xd'));logger[_0x38e5('0xe')](_0x38e5('0xf'),_0x4a7850,_0x38e5('0xd'),JSON[_0x38e5('0x10')](_0x412ed0));if(_0x412ed0[_0x38e5('0x11')]){if(_0x412ed0['error'][_0x38e5('0x12')]===0x1f4){logger[_0x38e5('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a7850,_0x412ed0[_0x38e5('0x11')][_0x38e5('0x13')]);return _0x2cca15(_0x412ed0[_0x38e5('0x11')][_0x38e5('0x13')]);}logger[_0x38e5('0x11')](_0x38e5('0xc'),_0x4a7850,_0x412ed0[_0x38e5('0x11')]['message']);return _0xcaa8fc(_0x412ed0[_0x38e5('0x11')]['message']);}else{logger[_0x38e5('0xb')](_0x38e5('0xc'),_0x4a7850,'request\x20sent');_0xcaa8fc(_0x412ed0[_0x38e5('0x14')][_0x38e5('0x13')]);}})['catch'](function(_0x4255d3){logger['error'](_0x38e5('0xc'),_0x4a7850,_0x4255d3);_0x2cca15(_0x4255d3);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e8eede2..1cd2eea 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 _0xfb1a=['express','fs-extra','../../components/interaction/service','./analyticExtractedReport.controller','get','index','/:id','show','/:id/download','isAuthenticated','download','post','create','put','update','destroy','multer','util'];(function(_0x1afe90,_0x13804a){var _0x5bcbae=function(_0x8e55b){while(--_0x8e55b){_0x1afe90['push'](_0x1afe90['shift']());}};_0x5bcbae(++_0x13804a);}(_0xfb1a,0x1ae));var _0xafb1=function(_0x1eb11c,_0x3f25f6){_0x1eb11c=_0x1eb11c-0x0;var _0x408a41=_0xfb1a[_0x1eb11c];return _0x408a41;};'use strict';var multer=require(_0xafb1('0x0'));var util=require(_0xafb1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xafb1('0x2'));var router=express['Router']();var fs_extra=require(_0xafb1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xafb1('0x4'));var config=require('../../config/environment');var controller=require(_0xafb1('0x5'));router[_0xafb1('0x6')]('/',auth['isAuthenticated'](),controller[_0xafb1('0x7')]);router[_0xafb1('0x6')](_0xafb1('0x8'),auth['isAuthenticated'](),controller[_0xafb1('0x9')]);router[_0xafb1('0x6')](_0xafb1('0xa'),auth[_0xafb1('0xb')](),controller[_0xafb1('0xc')]);router[_0xafb1('0xd')]('/',auth[_0xafb1('0xb')](),controller[_0xafb1('0xe')]);router[_0xafb1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xafb1('0x10')]);router['delete'](_0xafb1('0x8'),auth['isAuthenticated'](),controller[_0xafb1('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe24a=['download','post','create','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xe24a,0x1a9));var _0xae24=function(_0x3a9549,_0xc6e586){_0x3a9549=_0x3a9549-0x0;var _0x58d056=_0xe24a[_0x3a9549];return _0x58d056;};'use strict';var multer=require('multer');var util=require(_0xae24('0x0'));var path=require(_0xae24('0x1'));var timeout=require(_0xae24('0x2'));var express=require(_0xae24('0x3'));var router=express[_0xae24('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xae24('0x5'));var interaction=require(_0xae24('0x6'));var config=require(_0xae24('0x7'));var controller=require(_0xae24('0x8'));router[_0xae24('0x9')]('/',auth[_0xae24('0xa')](),controller[_0xae24('0xb')]);router['get'](_0xae24('0xc'),auth[_0xae24('0xa')](),controller[_0xae24('0xd')]);router[_0xae24('0x9')](_0xae24('0xe'),auth[_0xae24('0xa')](),controller[_0xae24('0xf')]);router[_0xae24('0x10')]('/',auth[_0xae24('0xa')](),controller[_0xae24('0x11')]);router['put']('/:id',auth[_0xae24('0xa')](),controller['update']);router[_0xae24('0x12')]('/:id',auth[_0xae24('0xa')](),controller[_0xae24('0x13')]);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 e2a9cca..6fbbb33 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 _0x028f=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x560c79,_0x5d468c){var _0x2c5c70=function(_0x577184){while(--_0x577184){_0x560c79['push'](_0x560c79['shift']());}};_0x2c5c70(++_0x5d468c);}(_0x028f,0x128));var _0xf028=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x028f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf028('0x0'));module[_0xf028('0x1')]={'field':{'type':Sequelize[_0xf028('0x2')]},'alias':{'type':Sequelize[_0xf028('0x3')]},'function':{'type':Sequelize[_0xf028('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xf028('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf028('0x3')]},'custom':{'type':Sequelize[_0xf028('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x321d=['exports','STRING','BOOLEAN'];(function(_0x3e58f2,_0xb41915){var _0x3a3169=function(_0x347112){while(--_0x347112){_0x3e58f2['push'](_0x3e58f2['shift']());}};_0x3a3169(++_0xb41915);}(_0x321d,0x141));var _0xd321=function(_0x3b6c74,_0xe0de9e){_0x3b6c74=_0x3b6c74-0x0;var _0x479312=_0x321d[_0x3b6c74];return _0x479312;};'use strict';var Sequelize=require('sequelize');module[_0xd321('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xd321('0x1')]},'function':{'type':Sequelize[_0xd321('0x1')]},'format':{'type':Sequelize[_0xd321('0x1')]},'groupBy':{'type':Sequelize[_0xd321('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd321('0x1')]},'custom':{'type':Sequelize[_0xd321('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 210180a..5d831ba 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 _0x3816=['model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','rows','catch','show','params','includeAll','find','create','body','bulkCreate','update','bulkDestroy','destroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','error','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type'];(function(_0x35bce3,_0x19b451){var _0x426644=function(_0x85a5f5){while(--_0x85a5f5){_0x35bce3['push'](_0x35bce3['shift']());}};_0x426644(++_0x19b451);}(_0x3816,0x113));var _0x6381=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x3816[_0x11a220];return _0x20d8fe;};'use strict';var emlformat=require(_0x6381('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6381('0x1'));var jsonpatch=require(_0x6381('0x2'));var rp=require(_0x6381('0x3'));var moment=require(_0x6381('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6381('0x5'));var util=require(_0x6381('0x6'));var path=require('path');var sox=require(_0x6381('0x7'));var csv=require('to-csv');var ejs=require(_0x6381('0x8'));var fs=require('fs');var fs_extra=require(_0x6381('0x9'));var _=require('lodash');var squel=require(_0x6381('0xa'));var crypto=require(_0x6381('0xb'));var jsforce=require(_0x6381('0xc'));var deskjs=require(_0x6381('0xd'));var toCsv=require(_0x6381('0xe'));var querystring=require(_0x6381('0xf'));var Papa=require('papaparse');var Redis=require(_0x6381('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6381('0x11'));var hardwareService=require(_0x6381('0x12'));var logger=require(_0x6381('0x13'))(_0x6381('0x14'));var utils=require(_0x6381('0x15'));var config=require(_0x6381('0x16'));var licenseUtil=require(_0x6381('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12c4e9,_0x388be3){_0x388be3=_0x388be3||0xcc;return function(_0x204296){if(_0x204296){return _0x12c4e9[_0x6381('0x18')](_0x388be3);}return _0x12c4e9[_0x6381('0x19')](_0x388be3)[_0x6381('0x1a')]();};}function respondWithResult(_0x15913c,_0x15efad){_0x15efad=_0x15efad||0xc8;return function(_0x75cb26){if(_0x75cb26){return _0x15913c[_0x6381('0x19')](_0x15efad)['json'](_0x75cb26);}};}function respondWithFilteredResult(_0x548329,_0x5a7d5a){return function(_0x24195f){if(_0x24195f){var _0x524c84=typeof _0x5a7d5a[_0x6381('0x1b')]===_0x6381('0x1c')&&typeof _0x5a7d5a[_0x6381('0x1d')]==='undefined';var _0x3ba7cc=_0x24195f['count'];var _0x4a0bff=_0x524c84?0x0:_0x5a7d5a[_0x6381('0x1b')];var _0x7e6f36=_0x524c84?_0x24195f[_0x6381('0x1e')]:_0x5a7d5a[_0x6381('0x1b')]+_0x5a7d5a['limit'];var _0x19f306;if(_0x7e6f36>=_0x3ba7cc){_0x7e6f36=_0x3ba7cc;_0x19f306=0xc8;}else{_0x19f306=0xce;}_0x548329[_0x6381('0x19')](_0x19f306);return _0x548329['set'](_0x6381('0x1f'),_0x4a0bff+'-'+_0x7e6f36+'/'+_0x3ba7cc)[_0x6381('0x20')](_0x24195f);}return null;};}function patchUpdates(_0x4bfb35){return function(_0x5d7e7e){try{jsonpatch[_0x6381('0x21')](_0x5d7e7e,_0x4bfb35,!![]);}catch(_0x3f4fff){return BPromise[_0x6381('0x22')](_0x3f4fff);}return _0x5d7e7e[_0x6381('0x23')]();};}function saveUpdates(_0x53d0c2,_0x11ff66){return function(_0x2cb1c8){if(_0x2cb1c8){return _0x2cb1c8['update'](_0x53d0c2)[_0x6381('0x24')](function(_0x776e47){return _0x776e47;});}return null;};}function removeEntity(_0x5437c5,_0xa39d94){return function(_0x36226b){if(_0x36226b){return _0x36226b['destroy']()[_0x6381('0x24')](function(){_0x5437c5['status'](0xcc)[_0x6381('0x1a')]();});}};}function handleEntityNotFound(_0x2ba7b6,_0x45dffb){return function(_0x103f76){if(!_0x103f76){_0x2ba7b6[_0x6381('0x18')](0x194);}return _0x103f76;};}function handleError(_0x5ab02e,_0x15fa60){_0x15fa60=_0x15fa60||0x1f4;return function(_0x2d3751){logger[_0x6381('0x25')](_0x2d3751['stack']);if(_0x2d3751[_0x6381('0x26')]){delete _0x2d3751[_0x6381('0x26')];}_0x5ab02e[_0x6381('0x19')](_0x15fa60)[_0x6381('0x27')](_0x2d3751);};}exports[_0x6381('0x28')]=function(_0x99663f,_0x4db035){var _0x49e1f8={},_0x544e41={},_0x407210={'count':0x0,'rows':[]};var _0x5f2129=_['map'](db[_0x6381('0x29')][_0x6381('0x2a')],function(_0x32d67e){return{'name':_0x32d67e[_0x6381('0x2b')],'type':_0x32d67e[_0x6381('0x2c')]['key']};});_0x544e41[_0x6381('0x2d')]=_[_0x6381('0x2e')](_0x5f2129,_0x6381('0x26'));_0x544e41[_0x6381('0x2f')]=_[_0x6381('0x30')](_0x99663f[_0x6381('0x2f')]);_0x544e41[_0x6381('0x31')]=_[_0x6381('0x32')](_0x544e41[_0x6381('0x2d')],_0x544e41[_0x6381('0x2f')]);_0x49e1f8[_0x6381('0x33')]=_[_0x6381('0x32')](_0x544e41[_0x6381('0x2d')],qs['fields'](_0x99663f['query'][_0x6381('0x34')]));_0x49e1f8[_0x6381('0x33')]=_0x49e1f8[_0x6381('0x33')][_0x6381('0x35')]?_0x49e1f8[_0x6381('0x33')]:_0x544e41['model'];if(!_0x99663f[_0x6381('0x2f')]['hasOwnProperty'](_0x6381('0x36'))){_0x49e1f8[_0x6381('0x1d')]=qs[_0x6381('0x1d')](_0x99663f[_0x6381('0x2f')][_0x6381('0x1d')]);_0x49e1f8[_0x6381('0x1b')]=qs[_0x6381('0x1b')](_0x99663f[_0x6381('0x2f')][_0x6381('0x1b')]);}_0x49e1f8[_0x6381('0x37')]=qs[_0x6381('0x38')](_0x99663f['query'][_0x6381('0x38')]);_0x49e1f8['where']=qs[_0x6381('0x31')](_['pick'](_0x99663f[_0x6381('0x2f')],_0x544e41[_0x6381('0x31')]),_0x5f2129);if(_0x99663f['query'][_0x6381('0x39')]){_0x49e1f8[_0x6381('0x3a')]=_[_0x6381('0x3b')](_0x49e1f8[_0x6381('0x3a')],{'$or':_['map'](_0x5f2129,function(_0x4326de){if(_0x4326de[_0x6381('0x2c')]!==_0x6381('0x3c')){var _0x334ae9={};_0x334ae9[_0x4326de[_0x6381('0x26')]]={'$like':'%'+_0x99663f[_0x6381('0x2f')][_0x6381('0x39')]+'%'};return _0x334ae9;}})});}_0x49e1f8=_[_0x6381('0x3b')]({},_0x49e1f8,_0x99663f[_0x6381('0x3d')]);var _0x467464={'where':_0x49e1f8[_0x6381('0x3a')]};return db[_0x6381('0x29')][_0x6381('0x1e')](_0x467464)[_0x6381('0x24')](function(_0x34d93e){_0x407210[_0x6381('0x1e')]=_0x34d93e;if(_0x99663f['query']['includeAll']){_0x49e1f8['include']=[{'all':!![]}];}return db[_0x6381('0x29')]['findAll'](_0x49e1f8);})[_0x6381('0x24')](function(_0x24aa83){_0x407210[_0x6381('0x3e')]=_0x24aa83;return _0x407210;})['then'](respondWithFilteredResult(_0x4db035,_0x49e1f8))[_0x6381('0x3f')](handleError(_0x4db035,null));};exports[_0x6381('0x40')]=function(_0x743255,_0x3d5ab9){var _0x48ca10={'raw':![],'where':{'id':_0x743255[_0x6381('0x41')]['id']}},_0x191099={};_0x191099[_0x6381('0x2d')]=_['keys'](db[_0x6381('0x29')][_0x6381('0x2a')]);_0x191099[_0x6381('0x2f')]=_[_0x6381('0x30')](_0x743255[_0x6381('0x2f')]);_0x191099[_0x6381('0x31')]=_[_0x6381('0x32')](_0x191099[_0x6381('0x2d')],_0x191099[_0x6381('0x2f')]);_0x48ca10[_0x6381('0x33')]=_['intersection'](_0x191099[_0x6381('0x2d')],qs[_0x6381('0x34')](_0x743255[_0x6381('0x2f')][_0x6381('0x34')]));_0x48ca10[_0x6381('0x33')]=_0x48ca10['attributes']['length']?_0x48ca10['attributes']:_0x191099['model'];if(_0x743255[_0x6381('0x2f')][_0x6381('0x42')]){_0x48ca10['include']=[{'all':!![]}];}_0x48ca10=_['merge']({},_0x48ca10,_0x743255[_0x6381('0x3d')]);return db[_0x6381('0x29')][_0x6381('0x43')](_0x48ca10)[_0x6381('0x24')](handleEntityNotFound(_0x3d5ab9,null))[_0x6381('0x24')](respondWithResult(_0x3d5ab9,null))[_0x6381('0x3f')](handleError(_0x3d5ab9,null));};exports[_0x6381('0x44')]=function(_0x1f800c,_0x3330c3){return db['AnalyticFieldReport']['create'](_0x1f800c[_0x6381('0x45')],{})['then'](respondWithResult(_0x3330c3,0xc9))[_0x6381('0x3f')](handleError(_0x3330c3,null));};exports['bulkCreate']=function(_0x381d03,_0x4d7de5){return db[_0x6381('0x29')][_0x6381('0x46')](_0x381d03[_0x6381('0x45')],{'raw':![],'individualHooks':!![]})[_0x6381('0x24')](respondWithResult(_0x4d7de5,0xc9))[_0x6381('0x3f')](handleError(_0x4d7de5,null));};exports[_0x6381('0x47')]=function(_0x162bde,_0x468583){if(_0x162bde['body']['id']){delete _0x162bde['body']['id'];}return db[_0x6381('0x29')][_0x6381('0x43')]({'where':{'id':_0x162bde['params']['id']}})[_0x6381('0x24')](handleEntityNotFound(_0x468583,null))[_0x6381('0x24')](saveUpdates(_0x162bde[_0x6381('0x45')],null))[_0x6381('0x24')](respondWithResult(_0x468583,null))[_0x6381('0x3f')](handleError(_0x468583,null));};exports['destroy']=function(_0x5b796a,_0x1e0a0e){return db[_0x6381('0x29')][_0x6381('0x43')]({'where':{'id':_0x5b796a['params']['id']}})[_0x6381('0x24')](handleEntityNotFound(_0x1e0a0e,null))[_0x6381('0x24')](removeEntity(_0x1e0a0e,null))[_0x6381('0x3f')](handleError(_0x1e0a0e,null));};exports[_0x6381('0x48')]=function(_0x21b8e1,_0x2edbfc){return db[_0x6381('0x29')][_0x6381('0x49')]({'where':{'id':_0x21b8e1[_0x6381('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x6381('0x24')](respondWithResult(_0x2edbfc,0xcc))['catch'](handleError(_0x2edbfc,null));};exports[_0x6381('0x4a')]=function(_0x51aca7,_0x3dcc64,_0x23e2b1){return db[_0x6381('0x4b')][_0x6381('0x4c')]({'where':{'id':_0x51aca7[_0x6381('0x41')]['id']}})[_0x6381('0x24')](handleEntityNotFound(_0x3dcc64,null))[_0x6381('0x24')](function(_0x22077b){if(_0x22077b){return db[_0x6381('0x4d')][_0x6381('0x4e')](function(_0x4bebe7){return db[_0x6381('0x29')]['destroy']({'where':{'CustomReportId':_0x51aca7[_0x6381('0x41')]['id']},'transaction':_0x4bebe7})[_0x6381('0x24')](function(_0x1f6aff){var _0xb3e1e6=_[_0x6381('0x2e')](_0x51aca7[_0x6381('0x45')],function(_0x832d34){delete _0x832d34['id'];_0x832d34['CustomReportId']=_0x51aca7[_0x6381('0x41')]['id'];return _0x832d34;});return db[_0x6381('0x29')][_0x6381('0x46')](_0xb3e1e6,{'transaction':_0x4bebe7});});})[_0x6381('0x24')](function(){return db['AnalyticFieldReport'][_0x6381('0x4f')]({'where':{'CustomReportId':_0x51aca7[_0x6381('0x41')]['id']}});});}})['then'](respondWithResult(_0x3dcc64,null))[_0x6381('0x3f')](handleError(_0x3dcc64,null));}; \ No newline at end of file +var _0x9851=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x15f533,_0x34949e){var _0x51b249=function(_0x11d90a){while(--_0x11d90a){_0x15f533['push'](_0x15f533['shift']());}};_0x51b249(++_0x34949e);}(_0x9851,0x160));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x1985('0x0'));var rimraf=require(_0x1985('0x1'));var zipdir=require(_0x1985('0x2'));var jsonpatch=require(_0x1985('0x3'));var rp=require(_0x1985('0x4'));var moment=require(_0x1985('0x5'));var BPromise=require(_0x1985('0x6'));var Mustache=require('mustache');var util=require(_0x1985('0x7'));var path=require(_0x1985('0x8'));var sox=require(_0x1985('0x9'));var csv=require(_0x1985('0xa'));var ejs=require(_0x1985('0xb'));var fs=require('fs');var fs_extra=require(_0x1985('0xc'));var _=require(_0x1985('0xd'));var squel=require('squel');var crypto=require(_0x1985('0xe'));var jsforce=require(_0x1985('0xf'));var deskjs=require(_0x1985('0x10'));var toCsv=require(_0x1985('0xa'));var querystring=require(_0x1985('0x11'));var Papa=require(_0x1985('0x12'));var Redis=require(_0x1985('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1985('0x14'));var as=require(_0x1985('0x15'));var hardwareService=require(_0x1985('0x16'));var logger=require(_0x1985('0x17'))(_0x1985('0x18'));var utils=require(_0x1985('0x19'));var config=require(_0x1985('0x1a'));var licenseUtil=require(_0x1985('0x1b'));var db=require(_0x1985('0x1c'))['db'];function respondWithStatusCode(_0xafb973,_0x4796f3){_0x4796f3=_0x4796f3||0xcc;return function(_0x2d3c88){if(_0x2d3c88){return _0xafb973['sendStatus'](_0x4796f3);}return _0xafb973['status'](_0x4796f3)[_0x1985('0x1d')]();};}function respondWithResult(_0x2ed3c5,_0x188ebc){_0x188ebc=_0x188ebc||0xc8;return function(_0x4582c7){if(_0x4582c7){return _0x2ed3c5[_0x1985('0x1e')](_0x188ebc)[_0x1985('0x1f')](_0x4582c7);}};}function respondWithFilteredResult(_0x4f2b98,_0x430945){return function(_0x21d9c6){if(_0x21d9c6){var _0x3a7983=typeof _0x430945[_0x1985('0x20')]===_0x1985('0x21')&&typeof _0x430945['limit']==='undefined';var _0x11692d=_0x21d9c6[_0x1985('0x22')];var _0x128641=_0x3a7983?0x0:_0x430945[_0x1985('0x20')];var _0x3678ce=_0x3a7983?_0x21d9c6['count']:_0x430945['offset']+_0x430945[_0x1985('0x23')];var _0x49bb8d;if(_0x3678ce>=_0x11692d){_0x3678ce=_0x11692d;_0x49bb8d=0xc8;}else{_0x49bb8d=0xce;}_0x4f2b98[_0x1985('0x1e')](_0x49bb8d);return _0x4f2b98[_0x1985('0x24')](_0x1985('0x25'),_0x128641+'-'+_0x3678ce+'/'+_0x11692d)[_0x1985('0x1f')](_0x21d9c6);}return null;};}function patchUpdates(_0x57aab4){return function(_0x19ea0a){try{jsonpatch[_0x1985('0x26')](_0x19ea0a,_0x57aab4,!![]);}catch(_0x2e6bad){return BPromise['reject'](_0x2e6bad);}return _0x19ea0a[_0x1985('0x27')]();};}function saveUpdates(_0x528667,_0xbd9c9){return function(_0x4a5794){if(_0x4a5794){return _0x4a5794[_0x1985('0x28')](_0x528667)[_0x1985('0x29')](function(_0x5f12d2){return _0x5f12d2;});}return null;};}function removeEntity(_0x35c47c,_0x3c5ed5){return function(_0xdd248f){if(_0xdd248f){return _0xdd248f[_0x1985('0x2a')]()[_0x1985('0x29')](function(){_0x35c47c[_0x1985('0x1e')](0xcc)[_0x1985('0x1d')]();});}};}function handleEntityNotFound(_0x2433b0,_0x3f8880){return function(_0x1f5b96){if(!_0x1f5b96){_0x2433b0[_0x1985('0x2b')](0x194);}return _0x1f5b96;};}function handleError(_0x3a08cd,_0x3f5ace){_0x3f5ace=_0x3f5ace||0x1f4;return function(_0x11a07f){logger[_0x1985('0x2c')](_0x11a07f[_0x1985('0x2d')]);if(_0x11a07f['name']){delete _0x11a07f[_0x1985('0x2e')];}_0x3a08cd['status'](_0x3f5ace)[_0x1985('0x2f')](_0x11a07f);};}exports[_0x1985('0x30')]=function(_0x34330c,_0x1b9993){var _0x2ee24e={},_0x52a31d={},_0x3da0a7={'count':0x0,'rows':[]};var _0x51c94f=_['map'](db[_0x1985('0x31')][_0x1985('0x32')],function(_0x509fb9){return{'name':_0x509fb9[_0x1985('0x33')],'type':_0x509fb9[_0x1985('0x34')][_0x1985('0x35')]};});_0x52a31d[_0x1985('0x36')]=_[_0x1985('0x37')](_0x51c94f,_0x1985('0x2e'));_0x52a31d['query']=_[_0x1985('0x38')](_0x34330c['query']);_0x52a31d[_0x1985('0x39')]=_[_0x1985('0x3a')](_0x52a31d[_0x1985('0x36')],_0x52a31d[_0x1985('0x3b')]);_0x2ee24e['attributes']=_[_0x1985('0x3a')](_0x52a31d['model'],qs[_0x1985('0x3c')](_0x34330c[_0x1985('0x3b')]['fields']));_0x2ee24e[_0x1985('0x3d')]=_0x2ee24e['attributes'][_0x1985('0x3e')]?_0x2ee24e[_0x1985('0x3d')]:_0x52a31d['model'];if(!_0x34330c[_0x1985('0x3b')][_0x1985('0x3f')](_0x1985('0x40'))){_0x2ee24e[_0x1985('0x23')]=qs[_0x1985('0x23')](_0x34330c[_0x1985('0x3b')]['limit']);_0x2ee24e[_0x1985('0x20')]=qs['offset'](_0x34330c[_0x1985('0x3b')][_0x1985('0x20')]);}_0x2ee24e[_0x1985('0x41')]=qs['sort'](_0x34330c[_0x1985('0x3b')][_0x1985('0x42')]);_0x2ee24e[_0x1985('0x43')]=qs[_0x1985('0x39')](_[_0x1985('0x44')](_0x34330c[_0x1985('0x3b')],_0x52a31d[_0x1985('0x39')]),_0x51c94f);if(_0x34330c[_0x1985('0x3b')][_0x1985('0x45')]){_0x2ee24e[_0x1985('0x43')]=_['merge'](_0x2ee24e[_0x1985('0x43')],{'$or':_[_0x1985('0x37')](_0x51c94f,function(_0x2c2272){if(_0x2c2272['type']!=='VIRTUAL'){var _0x3da811={};_0x3da811[_0x2c2272[_0x1985('0x2e')]]={'$like':'%'+_0x34330c['query'][_0x1985('0x45')]+'%'};return _0x3da811;}})});}_0x2ee24e=_[_0x1985('0x46')]({},_0x2ee24e,_0x34330c[_0x1985('0x47')]);var _0x8e35b0={'where':_0x2ee24e[_0x1985('0x43')]};return db[_0x1985('0x31')][_0x1985('0x22')](_0x8e35b0)[_0x1985('0x29')](function(_0x2bedf7){_0x3da0a7[_0x1985('0x22')]=_0x2bedf7;if(_0x34330c[_0x1985('0x3b')][_0x1985('0x48')]){_0x2ee24e[_0x1985('0x49')]=[{'all':!![]}];}return db[_0x1985('0x31')]['findAll'](_0x2ee24e);})[_0x1985('0x29')](function(_0x29cc67){_0x3da0a7[_0x1985('0x4a')]=_0x29cc67;return _0x3da0a7;})[_0x1985('0x29')](respondWithFilteredResult(_0x1b9993,_0x2ee24e))[_0x1985('0x4b')](handleError(_0x1b9993,null));};exports[_0x1985('0x4c')]=function(_0x37bc86,_0x2f1972){var _0x115e0d={'raw':![],'where':{'id':_0x37bc86[_0x1985('0x4d')]['id']}},_0xcabd00={};_0xcabd00[_0x1985('0x36')]=_[_0x1985('0x38')](db['AnalyticFieldReport'][_0x1985('0x32')]);_0xcabd00[_0x1985('0x3b')]=_['keys'](_0x37bc86[_0x1985('0x3b')]);_0xcabd00[_0x1985('0x39')]=_[_0x1985('0x3a')](_0xcabd00[_0x1985('0x36')],_0xcabd00[_0x1985('0x3b')]);_0x115e0d[_0x1985('0x3d')]=_[_0x1985('0x3a')](_0xcabd00[_0x1985('0x36')],qs[_0x1985('0x3c')](_0x37bc86[_0x1985('0x3b')][_0x1985('0x3c')]));_0x115e0d[_0x1985('0x3d')]=_0x115e0d[_0x1985('0x3d')][_0x1985('0x3e')]?_0x115e0d[_0x1985('0x3d')]:_0xcabd00[_0x1985('0x36')];if(_0x37bc86[_0x1985('0x3b')]['includeAll']){_0x115e0d[_0x1985('0x49')]=[{'all':!![]}];}_0x115e0d=_[_0x1985('0x46')]({},_0x115e0d,_0x37bc86['options']);return db[_0x1985('0x31')][_0x1985('0x4e')](_0x115e0d)[_0x1985('0x29')](handleEntityNotFound(_0x2f1972,null))[_0x1985('0x29')](respondWithResult(_0x2f1972,null))[_0x1985('0x4b')](handleError(_0x2f1972,null));};exports['create']=function(_0x165022,_0x4890de){return db[_0x1985('0x31')]['create'](_0x165022[_0x1985('0x4f')],{})['then'](respondWithResult(_0x4890de,0xc9))[_0x1985('0x4b')](handleError(_0x4890de,null));};exports[_0x1985('0x50')]=function(_0x4d10b4,_0x2893bd){return db[_0x1985('0x31')][_0x1985('0x50')](_0x4d10b4['body'],{'raw':![],'individualHooks':!![]})[_0x1985('0x29')](respondWithResult(_0x2893bd,0xc9))['catch'](handleError(_0x2893bd,null));};exports[_0x1985('0x28')]=function(_0x4aa1c3,_0x3b667f){if(_0x4aa1c3[_0x1985('0x4f')]['id']){delete _0x4aa1c3[_0x1985('0x4f')]['id'];}return db[_0x1985('0x31')][_0x1985('0x4e')]({'where':{'id':_0x4aa1c3['params']['id']}})['then'](handleEntityNotFound(_0x3b667f,null))['then'](saveUpdates(_0x4aa1c3[_0x1985('0x4f')],null))[_0x1985('0x29')](respondWithResult(_0x3b667f,null))[_0x1985('0x4b')](handleError(_0x3b667f,null));};exports[_0x1985('0x2a')]=function(_0xcf39a,_0x244333){return db['AnalyticFieldReport'][_0x1985('0x4e')]({'where':{'id':_0xcf39a['params']['id']}})['then'](handleEntityNotFound(_0x244333,null))[_0x1985('0x29')](removeEntity(_0x244333,null))['catch'](handleError(_0x244333,null));};exports[_0x1985('0x51')]=function(_0x1f5d36,_0x6d423a){return db['AnalyticFieldReport'][_0x1985('0x2a')]({'where':{'id':_0x1f5d36[_0x1985('0x3b')][_0x1985('0x52')]||[]},'raw':![],'individualHooks':!![]})[_0x1985('0x29')](respondWithResult(_0x6d423a,0xcc))[_0x1985('0x4b')](handleError(_0x6d423a,null));};exports[_0x1985('0x53')]=function(_0x429818,_0x16c260,_0x419e8c){return db[_0x1985('0x54')][_0x1985('0x55')]({'where':{'id':_0x429818['params']['id']}})[_0x1985('0x29')](handleEntityNotFound(_0x16c260,null))[_0x1985('0x29')](function(_0x1ed9fb){if(_0x1ed9fb){return db[_0x1985('0x56')][_0x1985('0x57')](function(_0x1b88c0){return db['AnalyticFieldReport'][_0x1985('0x2a')]({'where':{'CustomReportId':_0x429818[_0x1985('0x4d')]['id']},'transaction':_0x1b88c0})[_0x1985('0x29')](function(_0xac45be){var _0x9202af=_[_0x1985('0x37')](_0x429818[_0x1985('0x4f')],function(_0x15f229){delete _0x15f229['id'];_0x15f229[_0x1985('0x58')]=_0x429818['params']['id'];return _0x15f229;});return db['AnalyticFieldReport'][_0x1985('0x50')](_0x9202af,{'transaction':_0x1b88c0});});})[_0x1985('0x29')](function(){return db[_0x1985('0x31')][_0x1985('0x59')]({'where':{'CustomReportId':_0x429818[_0x1985('0x4d')]['id']}});});}})['then'](respondWithResult(_0x16c260,null))[_0x1985('0x4b')](handleError(_0x16c260,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a7da91c..1f5bf4c 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 _0xc203=['define','AnalyticFieldReport','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x5f2226,_0x4a2f89){var _0x19161a=function(_0x16e163){while(--_0x16e163){_0x5f2226['push'](_0x5f2226['shift']());}};_0x19161a(++_0x4a2f89);}(_0xc203,0x1ca));var _0x3c20=function(_0x26c8f2,_0x28a9f2){_0x26c8f2=_0x26c8f2-0x0;var _0xe521bb=_0xc203[_0x26c8f2];return _0xe521bb;};'use strict';var _=require(_0x3c20('0x0'));var util=require(_0x3c20('0x1'));var logger=require(_0x3c20('0x2'))('api');var moment=require(_0x3c20('0x3'));var BPromise=require(_0x3c20('0x4'));var rp=require(_0x3c20('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c20('0x6'));var config=require(_0x3c20('0x7'));var attributes=require(_0x3c20('0x8'));module[_0x3c20('0x9')]=function(_0x4f4eb4,_0x4080fd){return _0x4f4eb4[_0x3c20('0xa')](_0x3c20('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7d9=['path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','request-promise'];(function(_0x5b1c9e,_0x38bef1){var _0x4d2649=function(_0x5374a5){while(--_0x5374a5){_0x5b1c9e['push'](_0x5b1c9e['shift']());}};_0x4d2649(++_0x38bef1);}(_0xf7d9,0x188));var _0x9f7d=function(_0x45b7d5,_0x19dbf3){_0x45b7d5=_0x45b7d5-0x0;var _0x115feb=_0xf7d9[_0x45b7d5];return _0x115feb;};'use strict';var _=require(_0x9f7d('0x0'));var util=require('util');var logger=require(_0x9f7d('0x1'))('api');var moment=require(_0x9f7d('0x2'));var BPromise=require('bluebird');var rp=require(_0x9f7d('0x3'));var fs=require('fs');var path=require(_0x9f7d('0x4'));var rimraf=require('rimraf');var config=require(_0x9f7d('0x5'));var attributes=require(_0x9f7d('0x6'));module[_0x9f7d('0x7')]=function(_0x53f6d6,_0x4f3ed7){return _0x53f6d6[_0x9f7d('0x8')](_0x9f7d('0x9'),attributes,{'tableName':_0x9f7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 4377063..ed62b94 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 _0x65ab=['ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','bluebird','randomstring'];(function(_0x4f1488,_0x2e1958){var _0x487c03=function(_0x55bc13){while(--_0x55bc13){_0x4f1488['push'](_0x4f1488['shift']());}};_0x487c03(++_0x2e1958);}(_0x65ab,0x164));var _0xb65a=function(_0x19f568,_0x50baf4){_0x19f568=_0x19f568-0x0;var _0x525a6a=_0x65ab[_0x19f568];return _0x525a6a;};'use strict';var _=require(_0xb65a('0x0'));var util=require(_0xb65a('0x1'));var moment=require('moment');var BPromise=require(_0xb65a('0x2'));var rs=require(_0xb65a('0x3'));var fs=require('fs');var Redis=require(_0xb65a('0x4'));var db=require(_0xb65a('0x5'))['db'];var utils=require(_0xb65a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb65a('0x7')][_0xb65a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a7802,_0x56ee27,_0x2caa8b){return new BPromise(function(_0x3f0251,_0x4ff0b1){return client[_0xb65a('0x9')](_0x3a7802,_0x2caa8b)[_0xb65a('0xa')](function(_0x15e131){logger[_0xb65a('0xb')](_0xb65a('0xc'),_0x56ee27,_0xb65a('0xd'));logger[_0xb65a('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x56ee27,_0xb65a('0xd'),JSON['stringify'](_0x15e131));if(_0x15e131[_0xb65a('0xf')]){if(_0x15e131[_0xb65a('0xf')]['code']===0x1f4){logger[_0xb65a('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x56ee27,_0x15e131[_0xb65a('0xf')]['message']);return _0x4ff0b1(_0x15e131[_0xb65a('0xf')][_0xb65a('0x10')]);}logger['error'](_0xb65a('0xc'),_0x56ee27,_0x15e131[_0xb65a('0xf')][_0xb65a('0x10')]);return _0x3f0251(_0x15e131[_0xb65a('0xf')][_0xb65a('0x10')]);}else{logger[_0xb65a('0xb')](_0xb65a('0xc'),_0x56ee27,_0xb65a('0xd'));_0x3f0251(_0x15e131[_0xb65a('0x11')][_0xb65a('0x10')]);}})['catch'](function(_0x15f9a6){logger[_0xb65a('0xf')](_0xb65a('0xc'),_0x56ee27,_0x15f9a6);_0x4ff0b1(_0x15f9a6);});});} \ No newline at end of file +var _0x95a7=['jayson/promise','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x95a7,0x1f2));var _0x795a=function(_0x5ec427,_0x1c69d8){_0x5ec427=_0x5ec427-0x0;var _0x2ff482=_0x95a7[_0x5ec427];return _0x2ff482;};'use strict';var _=require(_0x795a('0x0'));var util=require(_0x795a('0x1'));var moment=require(_0x795a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x795a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x795a('0x4'));var logger=require(_0x795a('0x5'))(_0x795a('0x6'));var config=require(_0x795a('0x7'));var jayson=require(_0x795a('0x8'));var client=jayson['client'][_0x795a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3e9a,_0x2585b5,_0x22c8a4){return new BPromise(function(_0x3d1145,_0x30e8b4){return client[_0x795a('0xa')](_0x5b3e9a,_0x22c8a4)['then'](function(_0x5d5043){logger[_0x795a('0xb')](_0x795a('0xc'),_0x2585b5,'request\x20sent');logger[_0x795a('0xd')](_0x795a('0xe'),_0x2585b5,_0x795a('0xf'),JSON[_0x795a('0x10')](_0x5d5043));if(_0x5d5043[_0x795a('0x11')]){if(_0x5d5043[_0x795a('0x11')][_0x795a('0x12')]===0x1f4){logger[_0x795a('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2585b5,_0x5d5043['error']['message']);return _0x30e8b4(_0x5d5043[_0x795a('0x11')][_0x795a('0x13')]);}logger[_0x795a('0x11')](_0x795a('0xc'),_0x2585b5,_0x5d5043['error'][_0x795a('0x13')]);return _0x3d1145(_0x5d5043[_0x795a('0x11')][_0x795a('0x13')]);}else{logger[_0x795a('0xb')](_0x795a('0xc'),_0x2585b5,'request\x20sent');_0x3d1145(_0x5d5043[_0x795a('0x14')][_0x795a('0x13')]);}})[_0x795a('0x15')](function(_0xee0cc9){logger[_0x795a('0x11')](_0x795a('0xc'),_0x2585b5,_0xee0cc9);_0x30e8b4(_0xee0cc9);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index dcb5a64..8548222 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(_0x1775c5,_0x148e62){var _0x5358e9=function(_0x307b3e){while(--_0x307b3e){_0x1775c5['push'](_0x1775c5['shift']());}};_0x5358e9(++_0x148e62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x3c337d,_0x76f8f2){var _0x1f7883=function(_0x29a779){while(--_0x29a779){_0x3c337d['push'](_0x3c337d['shift']());}};_0x1f7883(++_0x76f8f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 abf2370..a2fcb27 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 _0xde56=['sequelize','STRING','name','TEXT'];(function(_0x59044c,_0x15ef1b){var _0x357399=function(_0x374420){while(--_0x374420){_0x59044c['push'](_0x59044c['shift']());}};_0x357399(++_0x15ef1b);}(_0xde56,0x144));var _0x6de5=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0xde56[_0x5d6e30];return _0x3d3f3b;};'use strict';var Sequelize=require(_0x6de5('0x0'));module['exports']={'name':{'type':Sequelize[_0x6de5('0x1')],'allowNull':![],'unique':_0x6de5('0x2')},'table':{'type':Sequelize[_0x6de5('0x1')]},'metric':{'type':Sequelize[_0x6de5('0x3')]},'description':{'type':Sequelize[_0x6de5('0x1')]}}; \ No newline at end of file +var _0x09dd=['STRING','name','TEXT','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09dd,0xb7));var _0xd09d=function(_0x22d68a,_0x3f6978){_0x22d68a=_0x22d68a-0x0;var _0x131c53=_0x09dd[_0x22d68a];return _0x131c53;};'use strict';var Sequelize=require(_0xd09d('0x0'));module[_0xd09d('0x1')]={'name':{'type':Sequelize[_0xd09d('0x2')],'allowNull':![],'unique':_0xd09d('0x3')},'table':{'type':Sequelize[_0xd09d('0x2')]},'metric':{'type':Sequelize[_0xd09d('0x4')]},'description':{'type':Sequelize[_0xd09d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index d7e3302..230827e 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 _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x2cf37f,_0x2217b7){var _0x1bd369=function(_0x12d071){while(--_0x12d071){_0x2cf37f['push'](_0x2cf37f['shift']());}};_0x1bd369(++_0x2217b7);}(_0x008c,0x188));var _0xc008=function(_0x1a3ce1,_0x40ed90){_0x1a3ce1=_0x1a3ce1-0x0;var _0x24aaae=_0x008c[_0x1a3ce1];return _0x24aaae;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file +var _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count'];(function(_0x4b0991,_0x5b2500){var _0x44a5f8=function(_0x1ad8bc){while(--_0x1ad8bc){_0x4b0991['push'](_0x4b0991['shift']());}};_0x44a5f8(++_0x5b2500);}(_0x3e74,0x175));var _0x43e7=function(_0x4f10ba,_0x226d88){_0x4f10ba=_0x4f10ba-0x0;var _0x305be7=_0x3e74[_0x4f10ba];return _0x305be7;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index cd0d323..c7fea8f 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 _0xab9f=['../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x3fef5e,_0x5c35f0){var _0x5dd93c=function(_0x459a15){while(--_0x459a15){_0x3fef5e['push'](_0x3fef5e['shift']());}};_0x5dd93c(++_0x5c35f0);}(_0xab9f,0x1bd));var _0xfab9=function(_0x56f3d4,_0xfc65dd){_0x56f3d4=_0x56f3d4-0x0;var _0x2c7ef0=_0xab9f[_0x56f3d4];return _0x2c7ef0;};'use strict';var _=require(_0xfab9('0x0'));var util=require('util');var logger=require(_0xfab9('0x1'))(_0xfab9('0x2'));var moment=require(_0xfab9('0x3'));var BPromise=require('bluebird');var rp=require(_0xfab9('0x4'));var fs=require('fs');var path=require(_0xfab9('0x5'));var rimraf=require('rimraf');var config=require(_0xfab9('0x6'));var attributes=require('./analyticMetric.attributes');module[_0xfab9('0x7')]=function(_0x54ae20,_0x1bfe77){return _0x54ae20[_0xfab9('0x8')](_0xfab9('0x9'),attributes,{'tableName':_0xfab9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbff5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','AnalyticMetric','analytics_metrics'];(function(_0xbd27c0,_0x1e1b84){var _0x56e8c1=function(_0x231995){while(--_0x231995){_0xbd27c0['push'](_0xbd27c0['shift']());}};_0x56e8c1(++_0x1e1b84);}(_0xbff5,0x1bc));var _0x5bff=function(_0x90363e,_0x4471e4){_0x90363e=_0x90363e-0x0;var _0x74f662=_0xbff5[_0x90363e];return _0x74f662;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var logger=require(_0x5bff('0x2'))(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var rp=require(_0x5bff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bff('0x7'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x5bff('0x8')]=function(_0x1d8650,_0x151add){return _0x1d8650[_0x5bff('0x9')](_0x5bff('0xa'),attributes,{'tableName':_0x5bff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 2f172da..c1538f4 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 _0xb7f5=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1a6f76,_0x514bd4){var _0x484c93=function(_0x49975a){while(--_0x49975a){_0x1a6f76['push'](_0x1a6f76['shift']());}};_0x484c93(++_0x514bd4);}(_0xb7f5,0x10e));var _0x5b7f=function(_0x532224,_0x21fb5b){_0x532224=_0x532224-0x0;var _0x225ab4=_0xb7f5[_0x532224];return _0x225ab4;};'use strict';var _=require('lodash');var util=require(_0x5b7f('0x0'));var moment=require(_0x5b7f('0x1'));var BPromise=require(_0x5b7f('0x2'));var rs=require(_0x5b7f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b7f('0x4'))['db'];var utils=require(_0x5b7f('0x5'));var logger=require('../../config/logger')(_0x5b7f('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b7f('0x7'));var client=jayson[_0x5b7f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x204806,_0x2fff66,_0x19c016){return new BPromise(function(_0x3c2feb,_0x5267c8){return client['request'](_0x204806,_0x19c016)['then'](function(_0x1b4c3a){logger[_0x5b7f('0x9')](_0x5b7f('0xa'),_0x2fff66,_0x5b7f('0xb'));logger[_0x5b7f('0xc')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2fff66,_0x5b7f('0xb'),JSON[_0x5b7f('0xd')](_0x1b4c3a));if(_0x1b4c3a[_0x5b7f('0xe')]){if(_0x1b4c3a['error'][_0x5b7f('0xf')]===0x1f4){logger['error'](_0x5b7f('0xa'),_0x2fff66,_0x1b4c3a['error']['message']);return _0x5267c8(_0x1b4c3a[_0x5b7f('0xe')]['message']);}logger[_0x5b7f('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x2fff66,_0x1b4c3a['error']['message']);return _0x3c2feb(_0x1b4c3a[_0x5b7f('0xe')][_0x5b7f('0x10')]);}else{logger[_0x5b7f('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x2fff66,_0x5b7f('0xb'));_0x3c2feb(_0x1b4c3a[_0x5b7f('0x11')][_0x5b7f('0x10')]);}})[_0x5b7f('0x12')](function(_0x333450){logger[_0x5b7f('0xe')](_0x5b7f('0xa'),_0x2fff66,_0x333450);_0x5267c8(_0x333450);});});} \ No newline at end of file +var _0xa302=['code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','stringify','error'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa302,0x1e9));var _0x2a30=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa302[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x2a30('0x0'));var util=require('util');var moment=require(_0x2a30('0x1'));var BPromise=require(_0x2a30('0x2'));var rs=require(_0x2a30('0x3'));var fs=require('fs');var Redis=require(_0x2a30('0x4'));var db=require(_0x2a30('0x5'))['db'];var utils=require(_0x2a30('0x6'));var logger=require(_0x2a30('0x7'))('rpc');var config=require(_0x2a30('0x8'));var jayson=require(_0x2a30('0x9'));var client=jayson['client'][_0x2a30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x417ce9,_0x5811ff,_0x41b3dd){return new BPromise(function(_0x2086ae,_0x441b04){return client[_0x2a30('0xb')](_0x417ce9,_0x41b3dd)[_0x2a30('0xc')](function(_0x4398de){logger[_0x2a30('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x5811ff,_0x2a30('0xe'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5811ff,_0x2a30('0xe'),JSON[_0x2a30('0xf')](_0x4398de));if(_0x4398de[_0x2a30('0x10')]){if(_0x4398de[_0x2a30('0x10')][_0x2a30('0x11')]===0x1f4){logger[_0x2a30('0x10')](_0x2a30('0x12'),_0x5811ff,_0x4398de['error'][_0x2a30('0x13')]);return _0x441b04(_0x4398de['error']['message']);}logger[_0x2a30('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x5811ff,_0x4398de[_0x2a30('0x10')][_0x2a30('0x13')]);return _0x2086ae(_0x4398de[_0x2a30('0x10')]['message']);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x5811ff,'request\x20sent');_0x2086ae(_0x4398de[_0x2a30('0x14')]['message']);}})[_0x2a30('0x15')](function(_0x4456ad){logger[_0x2a30('0x10')](_0x2a30('0x12'),_0x5811ff,_0x4456ad);_0x441b04(_0x4456ad);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index bc64ab8..b96493b 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 _0xedf2=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','Router'];(function(_0x4a7725,_0x4b41a5){var _0x137f3b=function(_0x2ccad1){while(--_0x2ccad1){_0x4a7725['push'](_0x4a7725['shift']());}};_0x137f3b(++_0x4b41a5);}(_0xedf2,0x1ac));var _0x2edf=function(_0x2b46b7,_0x1a97d2){_0x2b46b7=_0x2b46b7-0x0;var _0x10cf9a=_0xedf2[_0x2b46b7];return _0x10cf9a;};'use strict';var multer=require('multer');var util=require(_0x2edf('0x0'));var path=require(_0x2edf('0x1'));var timeout=require(_0x2edf('0x2'));var express=require('express');var router=express[_0x2edf('0x3')]();var fs_extra=require(_0x2edf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2edf('0x5'));var config=require(_0x2edf('0x6'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x2edf('0x7')](),controller[_0x2edf('0x8')]);router['get']('/:id',auth[_0x2edf('0x7')](),controller['show']);router[_0x2edf('0x9')]('/',auth['isAuthenticated'](),controller[_0x2edf('0xa')]);router[_0x2edf('0xb')](_0x2edf('0xc'),auth[_0x2edf('0x7')](),controller[_0x2edf('0xd')]);router[_0x2edf('0xe')](_0x2edf('0xc'),auth[_0x2edf('0x7')](),controller[_0x2edf('0xf')]);module['exports']=router; \ No newline at end of file +var _0x96e0=['multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','put','delete','exports'];(function(_0x3e38c4,_0x3c3a3e){var _0x526504=function(_0x5f5d1f){while(--_0x5f5d1f){_0x3e38c4['push'](_0x3e38c4['shift']());}};_0x526504(++_0x3c3a3e);}(_0x96e0,0x7e));var _0x096e=function(_0x59aaf6,_0x1d29d6){_0x59aaf6=_0x59aaf6-0x0;var _0x48d7f1=_0x96e0[_0x59aaf6];return _0x48d7f1;};'use strict';var multer=require(_0x096e('0x0'));var util=require('util');var path=require(_0x096e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x096e('0x2')]();var fs_extra=require(_0x096e('0x3'));var auth=require(_0x096e('0x4'));var interaction=require(_0x096e('0x5'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x096e('0x6')](),controller[_0x096e('0x7')]);router[_0x096e('0x8')](_0x096e('0x9'),auth[_0x096e('0x6')](),controller[_0x096e('0xa')]);router['post']('/',auth[_0x096e('0x6')](),controller['create']);router[_0x096e('0xb')](_0x096e('0x9'),auth[_0x096e('0x6')](),controller['update']);router[_0x096e('0xc')](_0x096e('0x9'),auth[_0x096e('0x6')](),controller['destroy']);module[_0x096e('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index d7dce75..827be63 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 _0x3301=['exports'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x3301,0x13a));var _0x1330=function(_0xdd45,_0x2daf10){_0xdd45=_0xdd45-0x0;var _0x106736=_0x3301[_0xdd45];return _0x106736;};'use strict';var Sequelize=require('sequelize');module[_0x1330('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xabab=['sequelize','exports'];(function(_0x3cbe3a,_0x78bfce){var _0x24ffc1=function(_0x103ae4){while(--_0x103ae4){_0x3cbe3a['push'](_0x3cbe3a['shift']());}};_0x24ffc1(++_0x78bfce);}(_0xabab,0x1ba));var _0xbaba=function(_0x261873,_0x29d06b){_0x261873=_0x261873-0x0;var _0x2112e4=_0xabab[_0x261873];return _0x2112e4;};'use strict';var Sequelize=require(_0xbaba('0x0'));module[_0xbaba('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 4afa59b..031e199 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 _0x398f=['body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','end','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0x398f,0x1bd));var _0xf398=function(_0x426e08,_0x3b7dbf){_0x426e08=_0x426e08-0x0;var _0x2688fe=_0x398f[_0x426e08];return _0x2688fe;};'use strict';var emlformat=require(_0xf398('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf398('0x1'));var jsonpatch=require(_0xf398('0x2'));var rp=require(_0xf398('0x3'));var moment=require('moment');var BPromise=require(_0xf398('0x4'));var Mustache=require(_0xf398('0x5'));var util=require(_0xf398('0x6'));var path=require('path');var sox=require(_0xf398('0x7'));var csv=require(_0xf398('0x8'));var ejs=require(_0xf398('0x9'));var fs=require('fs');var fs_extra=require(_0xf398('0xa'));var _=require(_0xf398('0xb'));var squel=require(_0xf398('0xc'));var crypto=require(_0xf398('0xd'));var jsforce=require(_0xf398('0xe'));var deskjs=require(_0xf398('0xf'));var toCsv=require(_0xf398('0x8'));var querystring=require('querystring');var Papa=require(_0xf398('0x10'));var Redis=require('ioredis');var authService=require(_0xf398('0x11'));var qs=require(_0xf398('0x12'));var as=require(_0xf398('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf398('0x14'))(_0xf398('0x15'));var utils=require(_0xf398('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf398('0x17'))['db'];function respondWithStatusCode(_0x191b48,_0x2ae63b){_0x2ae63b=_0x2ae63b||0xcc;return function(_0x130b8d){if(_0x130b8d){return _0x191b48[_0xf398('0x18')](_0x2ae63b);}return _0x191b48[_0xf398('0x19')](_0x2ae63b)['end']();};}function respondWithResult(_0xddddca,_0x31705f){_0x31705f=_0x31705f||0xc8;return function(_0x585ef6){if(_0x585ef6){return _0xddddca[_0xf398('0x19')](_0x31705f)[_0xf398('0x1a')](_0x585ef6);}};}function respondWithFilteredResult(_0x2c539f,_0x34a50c){return function(_0x45ce67){if(_0x45ce67){var _0x5b2236=typeof _0x34a50c['offset']===_0xf398('0x1b')&&typeof _0x34a50c[_0xf398('0x1c')]===_0xf398('0x1b');var _0x415a9c=_0x45ce67[_0xf398('0x1d')];var _0x3a37dd=_0x5b2236?0x0:_0x34a50c[_0xf398('0x1e')];var _0x41ae46=_0x5b2236?_0x45ce67[_0xf398('0x1d')]:_0x34a50c[_0xf398('0x1e')]+_0x34a50c[_0xf398('0x1c')];var _0x40a86a;if(_0x41ae46>=_0x415a9c){_0x41ae46=_0x415a9c;_0x40a86a=0xc8;}else{_0x40a86a=0xce;}_0x2c539f[_0xf398('0x19')](_0x40a86a);return _0x2c539f[_0xf398('0x1f')]('Content-Range',_0x3a37dd+'-'+_0x41ae46+'/'+_0x415a9c)[_0xf398('0x1a')](_0x45ce67);}return null;};}function patchUpdates(_0x335b56){return function(_0x475d76){try{jsonpatch[_0xf398('0x20')](_0x475d76,_0x335b56,!![]);}catch(_0x1edbe1){return BPromise[_0xf398('0x21')](_0x1edbe1);}return _0x475d76[_0xf398('0x22')]();};}function saveUpdates(_0x4e947c,_0xd23aa3){return function(_0x11a99d){if(_0x11a99d){return _0x11a99d['update'](_0x4e947c)[_0xf398('0x23')](function(_0x8954ea){return _0x8954ea;});}return null;};}function removeEntity(_0x101b85,_0x472030){return function(_0x347ee0){if(_0x347ee0){return _0x347ee0[_0xf398('0x24')]()['then'](function(){_0x101b85['status'](0xcc)[_0xf398('0x25')]();});}};}function handleEntityNotFound(_0x139294,_0xbace7d){return function(_0x3a3b81){if(!_0x3a3b81){_0x139294[_0xf398('0x18')](0x194);}return _0x3a3b81;};}function handleError(_0x1d0105,_0x544f82){_0x544f82=_0x544f82||0x1f4;return function(_0x462c7f){logger['error'](_0x462c7f[_0xf398('0x26')]);if(_0x462c7f[_0xf398('0x27')]){delete _0x462c7f[_0xf398('0x27')];}_0x1d0105[_0xf398('0x19')](_0x544f82)[_0xf398('0x28')](_0x462c7f);};}exports[_0xf398('0x29')]=function(_0x343cf0,_0x3933d1){var _0x33b1b8={},_0xb1cde6={},_0x2fe7cd={'count':0x0,'rows':[]};var _0x594a0f=_[_0xf398('0x2a')](db[_0xf398('0x2b')]['rawAttributes'],function(_0x1c50fd){return{'name':_0x1c50fd[_0xf398('0x2c')],'type':_0x1c50fd[_0xf398('0x2d')][_0xf398('0x2e')]};});_0xb1cde6[_0xf398('0x2f')]=_[_0xf398('0x2a')](_0x594a0f,_0xf398('0x27'));_0xb1cde6[_0xf398('0x30')]=_[_0xf398('0x31')](_0x343cf0[_0xf398('0x30')]);_0xb1cde6[_0xf398('0x32')]=_[_0xf398('0x33')](_0xb1cde6['model'],_0xb1cde6[_0xf398('0x30')]);_0x33b1b8['attributes']=_['intersection'](_0xb1cde6[_0xf398('0x2f')],qs[_0xf398('0x34')](_0x343cf0[_0xf398('0x30')]['fields']));_0x33b1b8[_0xf398('0x35')]=_0x33b1b8[_0xf398('0x35')][_0xf398('0x36')]?_0x33b1b8['attributes']:_0xb1cde6[_0xf398('0x2f')];if(!_0x343cf0[_0xf398('0x30')][_0xf398('0x37')](_0xf398('0x38'))){_0x33b1b8[_0xf398('0x1c')]=qs[_0xf398('0x1c')](_0x343cf0[_0xf398('0x30')][_0xf398('0x1c')]);_0x33b1b8[_0xf398('0x1e')]=qs[_0xf398('0x1e')](_0x343cf0[_0xf398('0x30')][_0xf398('0x1e')]);}_0x33b1b8[_0xf398('0x39')]=qs[_0xf398('0x3a')](_0x343cf0['query'][_0xf398('0x3a')]);_0x33b1b8[_0xf398('0x3b')]=qs[_0xf398('0x32')](_['pick'](_0x343cf0[_0xf398('0x30')],_0xb1cde6[_0xf398('0x32')]),_0x594a0f);if(_0x343cf0[_0xf398('0x30')][_0xf398('0x3c')]){_0x33b1b8[_0xf398('0x3b')]=_[_0xf398('0x3d')](_0x33b1b8['where'],{'$or':_[_0xf398('0x2a')](_0x594a0f,function(_0x3d079e){if(_0x3d079e[_0xf398('0x2d')]!==_0xf398('0x3e')){var _0x3eea4e={};_0x3eea4e[_0x3d079e[_0xf398('0x27')]]={'$like':'%'+_0x343cf0['query'][_0xf398('0x3c')]+'%'};return _0x3eea4e;}})});}_0x33b1b8=_[_0xf398('0x3d')]({},_0x33b1b8,_0x343cf0['options']);var _0x3b2b48={'where':_0x33b1b8[_0xf398('0x3b')]};return db[_0xf398('0x2b')][_0xf398('0x1d')](_0x3b2b48)['then'](function(_0x49dd0c){_0x2fe7cd[_0xf398('0x1d')]=_0x49dd0c;if(_0x343cf0[_0xf398('0x30')][_0xf398('0x3f')]){_0x33b1b8[_0xf398('0x40')]=[{'all':!![]}];}return db[_0xf398('0x2b')][_0xf398('0x41')](_0x33b1b8);})[_0xf398('0x23')](function(_0x372e26){_0x2fe7cd[_0xf398('0x42')]=_0x372e26;return _0x2fe7cd;})[_0xf398('0x23')](respondWithFilteredResult(_0x3933d1,_0x33b1b8))[_0xf398('0x43')](handleError(_0x3933d1,null));};exports['show']=function(_0x3065c1,_0x2a16db){var _0x8de5fc={'raw':!![],'where':{'id':_0x3065c1[_0xf398('0x44')]['id']}},_0x6ae1b2={};_0x6ae1b2['model']=_[_0xf398('0x31')](db[_0xf398('0x2b')][_0xf398('0x45')]);_0x6ae1b2['query']=_[_0xf398('0x31')](_0x3065c1['query']);_0x6ae1b2[_0xf398('0x32')]=_['intersection'](_0x6ae1b2[_0xf398('0x2f')],_0x6ae1b2['query']);_0x8de5fc[_0xf398('0x35')]=_[_0xf398('0x33')](_0x6ae1b2[_0xf398('0x2f')],qs[_0xf398('0x34')](_0x3065c1[_0xf398('0x30')][_0xf398('0x34')]));_0x8de5fc[_0xf398('0x35')]=_0x8de5fc[_0xf398('0x35')][_0xf398('0x36')]?_0x8de5fc[_0xf398('0x35')]:_0x6ae1b2['model'];if(_0x3065c1[_0xf398('0x30')][_0xf398('0x3f')]){_0x8de5fc[_0xf398('0x40')]=[{'all':!![]}];}_0x8de5fc=_[_0xf398('0x3d')]({},_0x8de5fc,_0x3065c1[_0xf398('0x46')]);return db[_0xf398('0x2b')][_0xf398('0x47')](_0x8de5fc)[_0xf398('0x23')](handleEntityNotFound(_0x2a16db,null))['then'](respondWithResult(_0x2a16db,null))[_0xf398('0x43')](handleError(_0x2a16db,null));};exports['create']=function(_0x5ae8aa,_0x3997d8){return db['AnalyticTreeReport'][_0xf398('0x48')](_0x5ae8aa[_0xf398('0x49')],{})[_0xf398('0x23')](respondWithResult(_0x3997d8,0xc9))[_0xf398('0x43')](handleError(_0x3997d8,null));};exports['update']=function(_0x412223,_0x41d449){if(_0x412223[_0xf398('0x49')]['id']){delete _0x412223[_0xf398('0x49')]['id'];}return db['AnalyticTreeReport'][_0xf398('0x47')]({'where':{'id':_0x412223[_0xf398('0x44')]['id']}})[_0xf398('0x23')](handleEntityNotFound(_0x41d449,null))[_0xf398('0x23')](saveUpdates(_0x412223[_0xf398('0x49')],null))['then'](respondWithResult(_0x41d449,null))[_0xf398('0x43')](handleError(_0x41d449,null));};exports['destroy']=function(_0x5de2bd,_0xb1f797){return db[_0xf398('0x2b')][_0xf398('0x47')]({'where':{'id':_0x5de2bd[_0xf398('0x44')]['id']}})[_0xf398('0x23')](handleEntityNotFound(_0xb1f797,null))[_0xf398('0x23')](removeEntity(_0xb1f797,null))[_0xf398('0x43')](handleError(_0xb1f797,null));}; \ No newline at end of file +var _0x2674=['sort','filters','filter','where','type','merge','options','includeAll','include','rows','catch','params','rawAttributes','create','body','find','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','send','index','map','AnalyticTreeReport','fieldName','model','name','query','keys','intersection','attributes','fields','nolimit','order'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2674,0x17e));var _0x4267=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x2674[_0x411add];return _0x238242;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4267('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4267('0x1'));var rp=require(_0x4267('0x2'));var moment=require(_0x4267('0x3'));var BPromise=require(_0x4267('0x4'));var Mustache=require(_0x4267('0x5'));var util=require(_0x4267('0x6'));var path=require(_0x4267('0x7'));var sox=require(_0x4267('0x8'));var csv=require(_0x4267('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4267('0xa'));var _=require('lodash');var squel=require(_0x4267('0xb'));var crypto=require(_0x4267('0xc'));var jsforce=require(_0x4267('0xd'));var deskjs=require(_0x4267('0xe'));var toCsv=require(_0x4267('0x9'));var querystring=require(_0x4267('0xf'));var Papa=require(_0x4267('0x10'));var Redis=require(_0x4267('0x11'));var authService=require(_0x4267('0x12'));var qs=require(_0x4267('0x13'));var as=require(_0x4267('0x14'));var hardwareService=require(_0x4267('0x15'));var logger=require('../../config/logger')(_0x4267('0x16'));var utils=require(_0x4267('0x17'));var config=require(_0x4267('0x18'));var licenseUtil=require(_0x4267('0x19'));var db=require(_0x4267('0x1a'))['db'];function respondWithStatusCode(_0x475e94,_0x2558eb){_0x2558eb=_0x2558eb||0xcc;return function(_0x3d0389){if(_0x3d0389){return _0x475e94[_0x4267('0x1b')](_0x2558eb);}return _0x475e94[_0x4267('0x1c')](_0x2558eb)[_0x4267('0x1d')]();};}function respondWithResult(_0xacae73,_0x283267){_0x283267=_0x283267||0xc8;return function(_0x46d7c8){if(_0x46d7c8){return _0xacae73['status'](_0x283267)['json'](_0x46d7c8);}};}function respondWithFilteredResult(_0x1307f0,_0x3017b7){return function(_0x3645b6){if(_0x3645b6){var _0x226126=typeof _0x3017b7[_0x4267('0x1e')]==='undefined'&&typeof _0x3017b7[_0x4267('0x1f')]===_0x4267('0x20');var _0x4b97bd=_0x3645b6['count'];var _0x474364=_0x226126?0x0:_0x3017b7[_0x4267('0x1e')];var _0x492673=_0x226126?_0x3645b6[_0x4267('0x21')]:_0x3017b7['offset']+_0x3017b7[_0x4267('0x1f')];var _0x139ccd;if(_0x492673>=_0x4b97bd){_0x492673=_0x4b97bd;_0x139ccd=0xc8;}else{_0x139ccd=0xce;}_0x1307f0[_0x4267('0x1c')](_0x139ccd);return _0x1307f0[_0x4267('0x22')]('Content-Range',_0x474364+'-'+_0x492673+'/'+_0x4b97bd)['json'](_0x3645b6);}return null;};}function patchUpdates(_0x3f2865){return function(_0x17e342){try{jsonpatch[_0x4267('0x23')](_0x17e342,_0x3f2865,!![]);}catch(_0x28a58b){return BPromise[_0x4267('0x24')](_0x28a58b);}return _0x17e342[_0x4267('0x25')]();};}function saveUpdates(_0x5a13ef,_0x277136){return function(_0x1ff2be){if(_0x1ff2be){return _0x1ff2be[_0x4267('0x26')](_0x5a13ef)[_0x4267('0x27')](function(_0x3c1da2){return _0x3c1da2;});}return null;};}function removeEntity(_0x5b1e51,_0x1a7a91){return function(_0x3f3fca){if(_0x3f3fca){return _0x3f3fca['destroy']()[_0x4267('0x27')](function(){_0x5b1e51[_0x4267('0x1c')](0xcc)[_0x4267('0x1d')]();});}};}function handleEntityNotFound(_0x397883,_0xdb440d){return function(_0x1b1684){if(!_0x1b1684){_0x397883[_0x4267('0x1b')](0x194);}return _0x1b1684;};}function handleError(_0x30cb92,_0x36ff5c){_0x36ff5c=_0x36ff5c||0x1f4;return function(_0x3605ff){logger[_0x4267('0x28')](_0x3605ff[_0x4267('0x29')]);if(_0x3605ff['name']){delete _0x3605ff['name'];}_0x30cb92['status'](_0x36ff5c)[_0x4267('0x2a')](_0x3605ff);};}exports[_0x4267('0x2b')]=function(_0xe4a22f,_0x1666d2){var _0x3164ff={},_0x4fac2d={},_0x278b96={'count':0x0,'rows':[]};var _0x44ba6d=_[_0x4267('0x2c')](db[_0x4267('0x2d')]['rawAttributes'],function(_0x37cff5){return{'name':_0x37cff5[_0x4267('0x2e')],'type':_0x37cff5['type']['key']};});_0x4fac2d[_0x4267('0x2f')]=_['map'](_0x44ba6d,_0x4267('0x30'));_0x4fac2d[_0x4267('0x31')]=_[_0x4267('0x32')](_0xe4a22f[_0x4267('0x31')]);_0x4fac2d['filters']=_[_0x4267('0x33')](_0x4fac2d[_0x4267('0x2f')],_0x4fac2d[_0x4267('0x31')]);_0x3164ff[_0x4267('0x34')]=_[_0x4267('0x33')](_0x4fac2d[_0x4267('0x2f')],qs[_0x4267('0x35')](_0xe4a22f[_0x4267('0x31')][_0x4267('0x35')]));_0x3164ff['attributes']=_0x3164ff[_0x4267('0x34')]['length']?_0x3164ff[_0x4267('0x34')]:_0x4fac2d[_0x4267('0x2f')];if(!_0xe4a22f[_0x4267('0x31')]['hasOwnProperty'](_0x4267('0x36'))){_0x3164ff[_0x4267('0x1f')]=qs['limit'](_0xe4a22f[_0x4267('0x31')][_0x4267('0x1f')]);_0x3164ff['offset']=qs[_0x4267('0x1e')](_0xe4a22f['query'][_0x4267('0x1e')]);}_0x3164ff[_0x4267('0x37')]=qs[_0x4267('0x38')](_0xe4a22f[_0x4267('0x31')][_0x4267('0x38')]);_0x3164ff['where']=qs[_0x4267('0x39')](_['pick'](_0xe4a22f[_0x4267('0x31')],_0x4fac2d[_0x4267('0x39')]),_0x44ba6d);if(_0xe4a22f['query'][_0x4267('0x3a')]){_0x3164ff['where']=_['merge'](_0x3164ff[_0x4267('0x3b')],{'$or':_[_0x4267('0x2c')](_0x44ba6d,function(_0x31c7e5){if(_0x31c7e5[_0x4267('0x3c')]!=='VIRTUAL'){var _0x5ea91e={};_0x5ea91e[_0x31c7e5[_0x4267('0x30')]]={'$like':'%'+_0xe4a22f['query'][_0x4267('0x3a')]+'%'};return _0x5ea91e;}})});}_0x3164ff=_[_0x4267('0x3d')]({},_0x3164ff,_0xe4a22f[_0x4267('0x3e')]);var _0x15375a={'where':_0x3164ff[_0x4267('0x3b')]};return db[_0x4267('0x2d')][_0x4267('0x21')](_0x15375a)[_0x4267('0x27')](function(_0x4f5d8f){_0x278b96[_0x4267('0x21')]=_0x4f5d8f;if(_0xe4a22f[_0x4267('0x31')][_0x4267('0x3f')]){_0x3164ff[_0x4267('0x40')]=[{'all':!![]}];}return db[_0x4267('0x2d')]['findAll'](_0x3164ff);})[_0x4267('0x27')](function(_0x43cfa3){_0x278b96[_0x4267('0x41')]=_0x43cfa3;return _0x278b96;})[_0x4267('0x27')](respondWithFilteredResult(_0x1666d2,_0x3164ff))[_0x4267('0x42')](handleError(_0x1666d2,null));};exports['show']=function(_0x41ff8e,_0x30eee7){var _0x459a14={'raw':!![],'where':{'id':_0x41ff8e[_0x4267('0x43')]['id']}},_0x411810={};_0x411810['model']=_[_0x4267('0x32')](db[_0x4267('0x2d')][_0x4267('0x44')]);_0x411810[_0x4267('0x31')]=_['keys'](_0x41ff8e['query']);_0x411810[_0x4267('0x39')]=_[_0x4267('0x33')](_0x411810[_0x4267('0x2f')],_0x411810[_0x4267('0x31')]);_0x459a14['attributes']=_[_0x4267('0x33')](_0x411810['model'],qs['fields'](_0x41ff8e[_0x4267('0x31')]['fields']));_0x459a14[_0x4267('0x34')]=_0x459a14[_0x4267('0x34')]['length']?_0x459a14[_0x4267('0x34')]:_0x411810[_0x4267('0x2f')];if(_0x41ff8e[_0x4267('0x31')]['includeAll']){_0x459a14['include']=[{'all':!![]}];}_0x459a14=_[_0x4267('0x3d')]({},_0x459a14,_0x41ff8e['options']);return db[_0x4267('0x2d')]['find'](_0x459a14)[_0x4267('0x27')](handleEntityNotFound(_0x30eee7,null))[_0x4267('0x27')](respondWithResult(_0x30eee7,null))[_0x4267('0x42')](handleError(_0x30eee7,null));};exports[_0x4267('0x45')]=function(_0x1b6ae6,_0x205071){return db['AnalyticTreeReport'][_0x4267('0x45')](_0x1b6ae6[_0x4267('0x46')],{})[_0x4267('0x27')](respondWithResult(_0x205071,0xc9))['catch'](handleError(_0x205071,null));};exports[_0x4267('0x26')]=function(_0x560c9e,_0x1ac524){if(_0x560c9e[_0x4267('0x46')]['id']){delete _0x560c9e[_0x4267('0x46')]['id'];}return db[_0x4267('0x2d')][_0x4267('0x47')]({'where':{'id':_0x560c9e[_0x4267('0x43')]['id']}})[_0x4267('0x27')](handleEntityNotFound(_0x1ac524,null))[_0x4267('0x27')](saveUpdates(_0x560c9e[_0x4267('0x46')],null))[_0x4267('0x27')](respondWithResult(_0x1ac524,null))[_0x4267('0x42')](handleError(_0x1ac524,null));};exports[_0x4267('0x48')]=function(_0x554066,_0x32afe5){return db[_0x4267('0x2d')][_0x4267('0x47')]({'where':{'id':_0x554066['params']['id']}})['then'](handleEntityNotFound(_0x32afe5,null))['then'](removeEntity(_0x32afe5,null))[_0x4267('0x42')](handleError(_0x32afe5,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 7f8db05..ff8d48e 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 _0x8dc4=['request-promise','path','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x58fae5,_0xea34ed){var _0x2c5345=function(_0x16879f){while(--_0x16879f){_0x58fae5['push'](_0x58fae5['shift']());}};_0x2c5345(++_0xea34ed);}(_0x8dc4,0xae));var _0x48dc=function(_0x276576,_0x13dcdf){_0x276576=_0x276576-0x0;var _0x2f4fd6=_0x8dc4[_0x276576];return _0x2f4fd6;};'use strict';var _=require(_0x48dc('0x0'));var util=require(_0x48dc('0x1'));var logger=require(_0x48dc('0x2'))(_0x48dc('0x3'));var moment=require(_0x48dc('0x4'));var BPromise=require(_0x48dc('0x5'));var rp=require(_0x48dc('0x6'));var fs=require('fs');var path=require(_0x48dc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x48dc('0x8'));module[_0x48dc('0x9')]=function(_0x38b86a,_0xd4a4b0){return _0x38b86a['define'](_0x48dc('0xa'),attributes,{'tableName':_0x48dc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8fc=['rimraf','../../config/environment','./analyticTreeReport.attributes','define','util','../../config/logger','api','moment','bluebird','path'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xc8fc,0x1da));var _0xcc8f=function(_0x4649b3,_0x1ca865){_0x4649b3=_0x4649b3-0x0;var _0x58fb00=_0xc8fc[_0x4649b3];return _0x58fb00;};'use strict';var _=require('lodash');var util=require(_0xcc8f('0x0'));var logger=require(_0xcc8f('0x1'))(_0xcc8f('0x2'));var moment=require(_0xcc8f('0x3'));var BPromise=require(_0xcc8f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc8f('0x5'));var rimraf=require(_0xcc8f('0x6'));var config=require(_0xcc8f('0x7'));var attributes=require(_0xcc8f('0x8'));module['exports']=function(_0xc7605d,_0x5174ae){return _0xc7605d[_0xcc8f('0x9')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index f2c21cd..5a0e267 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x381391,_0x2d11f7){var _0x304665=function(_0x57795a){while(--_0x57795a){_0x381391['push'](_0x381391['shift']());}};_0x304665(++_0x2d11f7);}(_0xdb28,0x106));var _0x8db2=function(_0x1cf23d,_0x593ac0){_0x1cf23d=_0x1cf23d-0x0;var _0x2dbda9=_0xdb28[_0x1cf23d];return _0x2dbda9;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0xd08d8a,_0x1dd99a){var _0x5eef20=function(_0x208e12){while(--_0x208e12){_0xd08d8a['push'](_0xd08d8a['shift']());}};_0x5eef20(++_0x1dd99a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f9b3473..1513bce 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 _0xae96=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x6d90a2,_0x636869){var _0x2e1a19=function(_0x4d9a90){while(--_0x4d9a90){_0x6d90a2['push'](_0x6d90a2['shift']());}};_0x2e1a19(++_0x636869);}(_0xae96,0x8e));var _0x6ae9=function(_0x4bfb4d,_0x1c7d06){_0x4bfb4d=_0x4bfb4d-0x0;var _0x119e92=_0xae96[_0x4bfb4d];return _0x119e92;};'use strict';var multer=require(_0x6ae9('0x0'));var util=require('util');var path=require(_0x6ae9('0x1'));var timeout=require(_0x6ae9('0x2'));var express=require(_0x6ae9('0x3'));var router=express[_0x6ae9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6ae9('0x5'));var config=require(_0x6ae9('0x6'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x6ae9('0x7')](),controller[_0x6ae9('0x8')]);router[_0x6ae9('0x9')](_0x6ae9('0xa'),auth[_0x6ae9('0x7')](),controller[_0x6ae9('0xb')]);router[_0x6ae9('0xc')]('/',auth[_0x6ae9('0x7')](),controller[_0x6ae9('0xd')]);router[_0x6ae9('0xe')](_0x6ae9('0xa'),auth[_0x6ae9('0x7')](),controller[_0x6ae9('0xf')]);router[_0x6ae9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6ae9('0x11')]);module[_0x6ae9('0x12')]=router; \ No newline at end of file +var _0x6f6f=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','create','put','/:id','update'];(function(_0x2995d1,_0x3fcca3){var _0x43fab8=function(_0x2eae52){while(--_0x2eae52){_0x2995d1['push'](_0x2995d1['shift']());}};_0x43fab8(++_0x3fcca3);}(_0x6f6f,0x122));var _0xf6f6=function(_0xd1d08c,_0x300f41){_0xd1d08c=_0xd1d08c-0x0;var _0x5263cf=_0x6f6f[_0xd1d08c];return _0x5263cf;};'use strict';var multer=require(_0xf6f6('0x0'));var util=require(_0xf6f6('0x1'));var path=require(_0xf6f6('0x2'));var timeout=require(_0xf6f6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf6f6('0x5'));var config=require(_0xf6f6('0x6'));var controller=require(_0xf6f6('0x7'));router[_0xf6f6('0x8')]('/',auth[_0xf6f6('0x9')](),controller[_0xf6f6('0xa')]);router[_0xf6f6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf6f6('0xb')]);router['post']('/',auth[_0xf6f6('0x9')](),controller[_0xf6f6('0xc')]);router[_0xf6f6('0xd')](_0xf6f6('0xe'),auth[_0xf6f6('0x9')](),controller[_0xf6f6('0xf')]);router['delete'](_0xf6f6('0xe'),auth[_0xf6f6('0x9')](),controller[_0xf6f6('0x10')]);module[_0xf6f6('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 ab7eb4f..b9a9c09 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 _0x383a=['STRING','exports'];(function(_0x26b53f,_0x528724){var _0x4dda26=function(_0x5acf06){while(--_0x5acf06){_0x26b53f['push'](_0x26b53f['shift']());}};_0x4dda26(++_0x528724);}(_0x383a,0x1ad));var _0xa383=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x383a[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0xa383('0x0')]={'name':{'type':Sequelize[_0xa383('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2cc1=['STRING','sequelize','exports'];(function(_0x123cd4,_0x46c48d){var _0x54642b=function(_0xc4d19b){while(--_0xc4d19b){_0x123cd4['push'](_0x123cd4['shift']());}};_0x54642b(++_0x46c48d);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x12130b,_0x1e5d98){_0x12130b=_0x12130b-0x0;var _0x398370=_0x2cc1[_0x12130b];return _0x398370;};'use strict';var Sequelize=require(_0x12cc('0x0'));module[_0x12cc('0x1')]={'name':{'type':Sequelize[_0x12cc('0x2')]},'basename':{'type':Sequelize[_0x12cc('0x2')]},'type':{'type':Sequelize[_0x12cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 4c13601..b52216d 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 _0xf633=['omit','createdAt','body','updatedAt','create','file','originalname','basename','type','download','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Attachment','rawAttributes','model','map','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','keys','includeAll','clone','params','find'];(function(_0x4a4b52,_0x3e5344){var _0x1ffa82=function(_0x2daadb){while(--_0x2daadb){_0x4a4b52['push'](_0x4a4b52['shift']());}};_0x1ffa82(++_0x3e5344);}(_0xf633,0x107));var _0x3f63=function(_0x13d462,_0x31ab91){_0x13d462=_0x13d462-0x0;var _0x2cc2a8=_0xf633[_0x13d462];return _0x2cc2a8;};'use strict';var emlformat=require(_0x3f63('0x0'));var rimraf=require(_0x3f63('0x1'));var zipdir=require(_0x3f63('0x2'));var jsonpatch=require(_0x3f63('0x3'));var rp=require(_0x3f63('0x4'));var moment=require(_0x3f63('0x5'));var BPromise=require(_0x3f63('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f63('0x7'));var sox=require('sox');var csv=require(_0x3f63('0x8'));var ejs=require(_0x3f63('0x9'));var fs=require('fs');var fs_extra=require(_0x3f63('0xa'));var _=require(_0x3f63('0xb'));var squel=require(_0x3f63('0xc'));var crypto=require(_0x3f63('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f63('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f63('0xf'));var logger=require(_0x3f63('0x10'))(_0x3f63('0x11'));var utils=require('../../config/utils');var config=require(_0x3f63('0x12'));var licenseUtil=require(_0x3f63('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e661b,_0x2df05f){_0x2df05f=_0x2df05f||0xcc;return function(_0x24d1e2){if(_0x24d1e2){return _0x1e661b[_0x3f63('0x14')](_0x2df05f);}return _0x1e661b['status'](_0x2df05f)[_0x3f63('0x15')]();};}function respondWithResult(_0x4d0c52,_0x1f6181){_0x1f6181=_0x1f6181||0xc8;return function(_0xe13746){if(_0xe13746){return _0x4d0c52[_0x3f63('0x16')](_0x1f6181)[_0x3f63('0x17')](_0xe13746);}};}function respondWithFilteredResult(_0x47db77,_0x426ec4){return function(_0x6d00ca){if(_0x6d00ca){var _0x2e1f09=typeof _0x426ec4[_0x3f63('0x18')]===_0x3f63('0x19')&&typeof _0x426ec4[_0x3f63('0x1a')]===_0x3f63('0x19');var _0x4cc258=_0x6d00ca['count'];var _0x149609=_0x2e1f09?0x0:_0x426ec4[_0x3f63('0x18')];var _0xdee62c=_0x2e1f09?_0x6d00ca['count']:_0x426ec4[_0x3f63('0x18')]+_0x426ec4[_0x3f63('0x1a')];var _0x4edb17;if(_0xdee62c>=_0x4cc258){_0xdee62c=_0x4cc258;_0x4edb17=0xc8;}else{_0x4edb17=0xce;}_0x47db77[_0x3f63('0x16')](_0x4edb17);return _0x47db77[_0x3f63('0x1b')](_0x3f63('0x1c'),_0x149609+'-'+_0xdee62c+'/'+_0x4cc258)[_0x3f63('0x17')](_0x6d00ca);}return null;};}function patchUpdates(_0x2eee68){return function(_0x40a887){try{jsonpatch[_0x3f63('0x1d')](_0x40a887,_0x2eee68,!![]);}catch(_0x48df5f){return BPromise[_0x3f63('0x1e')](_0x48df5f);}return _0x40a887[_0x3f63('0x1f')]();};}function saveUpdates(_0x1e5026,_0x2832a2){return function(_0x288143){if(_0x288143){return _0x288143[_0x3f63('0x20')](_0x1e5026)[_0x3f63('0x21')](function(_0x352fe6){return _0x352fe6;});}return null;};}function removeEntity(_0xed04ea,_0x7d8154){return function(_0x5664ce){if(_0x5664ce){return _0x5664ce[_0x3f63('0x22')]()[_0x3f63('0x21')](function(){_0xed04ea[_0x3f63('0x16')](0xcc)[_0x3f63('0x15')]();});}};}function handleEntityNotFound(_0x1e2e3a,_0x430f7b){return function(_0x3860de){if(!_0x3860de){_0x1e2e3a[_0x3f63('0x14')](0x194);}return _0x3860de;};}function handleError(_0x430828,_0x476b17){_0x476b17=_0x476b17||0x1f4;return function(_0x2ee2d7){logger['error'](_0x2ee2d7[_0x3f63('0x23')]);if(_0x2ee2d7['name']){delete _0x2ee2d7[_0x3f63('0x24')];}_0x430828[_0x3f63('0x16')](_0x476b17)[_0x3f63('0x25')](_0x2ee2d7);};}exports[_0x3f63('0x26')]=function(_0x307681,_0xb6d352){var _0x5f35e5={},_0x4384a8={},_0x520608={'count':0x0,'rows':[]};var _0x5cf785=_['map'](db[_0x3f63('0x27')][_0x3f63('0x28')],function(_0x4fd57b){return{'name':_0x4fd57b['fieldName'],'type':_0x4fd57b['type']['key']};});_0x4384a8[_0x3f63('0x29')]=_[_0x3f63('0x2a')](_0x5cf785,_0x3f63('0x24'));_0x4384a8['query']=_['keys'](_0x307681['query']);_0x4384a8[_0x3f63('0x2b')]=_['intersection'](_0x4384a8[_0x3f63('0x29')],_0x4384a8[_0x3f63('0x2c')]);_0x5f35e5['attributes']=_[_0x3f63('0x2d')](_0x4384a8[_0x3f63('0x29')],qs[_0x3f63('0x2e')](_0x307681[_0x3f63('0x2c')]['fields']));_0x5f35e5[_0x3f63('0x2f')]=_0x5f35e5['attributes'][_0x3f63('0x30')]?_0x5f35e5[_0x3f63('0x2f')]:_0x4384a8[_0x3f63('0x29')];if(!_0x307681['query'][_0x3f63('0x31')](_0x3f63('0x32'))){_0x5f35e5['limit']=qs['limit'](_0x307681['query'][_0x3f63('0x1a')]);_0x5f35e5['offset']=qs[_0x3f63('0x18')](_0x307681[_0x3f63('0x2c')][_0x3f63('0x18')]);}_0x5f35e5[_0x3f63('0x33')]=qs[_0x3f63('0x34')](_0x307681[_0x3f63('0x2c')][_0x3f63('0x34')]);_0x5f35e5[_0x3f63('0x35')]=qs['filters'](_[_0x3f63('0x36')](_0x307681['query'],_0x4384a8[_0x3f63('0x2b')]),_0x5cf785);if(_0x307681[_0x3f63('0x2c')][_0x3f63('0x37')]){_0x5f35e5[_0x3f63('0x35')]=_[_0x3f63('0x38')](_0x5f35e5[_0x3f63('0x35')],{'$or':_[_0x3f63('0x2a')](_0x5cf785,function(_0x579075){if(_0x579075['type']!==_0x3f63('0x39')){var _0x457c44={};_0x457c44[_0x579075[_0x3f63('0x24')]]={'$like':'%'+_0x307681[_0x3f63('0x2c')][_0x3f63('0x37')]+'%'};return _0x457c44;}})});}_0x5f35e5=_[_0x3f63('0x38')]({},_0x5f35e5,_0x307681[_0x3f63('0x3a')]);var _0x2cdbac={'where':_0x5f35e5[_0x3f63('0x35')]};return db['Attachment'][_0x3f63('0x3b')](_0x2cdbac)[_0x3f63('0x21')](function(_0x214845){_0x520608[_0x3f63('0x3b')]=_0x214845;if(_0x307681[_0x3f63('0x2c')]['includeAll']){_0x5f35e5[_0x3f63('0x3c')]=[{'all':!![]}];}return db['Attachment'][_0x3f63('0x3d')](_0x5f35e5);})['then'](function(_0x1f1fa3){_0x520608[_0x3f63('0x3e')]=_0x1f1fa3;return _0x520608;})['then'](respondWithFilteredResult(_0xb6d352,_0x5f35e5))[_0x3f63('0x3f')](handleError(_0xb6d352,null));};exports['show']=function(_0x8caf3b,_0x19dce9){var _0x59d137={'raw':!![],'where':{'id':_0x8caf3b['params']['id']}},_0x255d6e={};_0x255d6e[_0x3f63('0x29')]=_[_0x3f63('0x40')](db['Attachment']['rawAttributes']);_0x255d6e['query']=_[_0x3f63('0x40')](_0x8caf3b[_0x3f63('0x2c')]);_0x255d6e['filters']=_[_0x3f63('0x2d')](_0x255d6e[_0x3f63('0x29')],_0x255d6e['query']);_0x59d137['attributes']=_['intersection'](_0x255d6e['model'],qs[_0x3f63('0x2e')](_0x8caf3b[_0x3f63('0x2c')][_0x3f63('0x2e')]));_0x59d137[_0x3f63('0x2f')]=_0x59d137[_0x3f63('0x2f')]['length']?_0x59d137[_0x3f63('0x2f')]:_0x255d6e[_0x3f63('0x29')];if(_0x8caf3b[_0x3f63('0x2c')][_0x3f63('0x41')]){_0x59d137[_0x3f63('0x3c')]=[{'all':!![]}];}_0x59d137=_[_0x3f63('0x38')]({},_0x59d137,_0x8caf3b[_0x3f63('0x3a')]);return db[_0x3f63('0x27')]['find'](_0x59d137)[_0x3f63('0x21')](handleEntityNotFound(_0x19dce9,null))['then'](respondWithResult(_0x19dce9,null))['catch'](handleError(_0x19dce9,null));};exports[_0x3f63('0x42')]=function(_0x1b1371,_0xe685eb){var _0x4cc211={'where':{'id':_0x1b1371[_0x3f63('0x43')]['id']}},_0x20980e={};_0x20980e[_0x3f63('0x29')]=_[_0x3f63('0x40')](db[_0x3f63('0x27')]['rawAttributes']);_0x4cc211[_0x3f63('0x2f')]=_[_0x3f63('0x2d')](_0x20980e[_0x3f63('0x29')],qs[_0x3f63('0x2e')](_0x1b1371[_0x3f63('0x2c')]['fields']));_0x4cc211['attributes']=_0x4cc211[_0x3f63('0x2f')]['length']?_0x4cc211[_0x3f63('0x2f')]:_0x20980e[_0x3f63('0x29')];if(_0x1b1371[_0x3f63('0x2c')]['includeAll']){_0x4cc211[_0x3f63('0x3c')]=[{'all':!![]}];}_0x4cc211=_['merge']({},_0x4cc211,_0x1b1371[_0x3f63('0x3a')]);return db[_0x3f63('0x27')][_0x3f63('0x44')](_0x4cc211)[_0x3f63('0x21')](handleEntityNotFound(_0xe685eb,null))['then'](function(_0x1b6d23){if(_0x1b6d23){var _0x543bae=_0x1b6d23['get']({'plain':!![]});_0x543bae=qs[_0x3f63('0x45')](_0x543bae,['id',_0x3f63('0x46'),'updatedAt']);_0x1b1371[_0x3f63('0x47')]=_[_0x3f63('0x45')](_0x1b1371[_0x3f63('0x47')],['id',_0x3f63('0x46'),_0x3f63('0x48')]);return db[_0x3f63('0x27')][_0x3f63('0x49')](_[_0x3f63('0x38')](_0x543bae,_0x1b1371[_0x3f63('0x47')]),{'include':_0x1b1371[_0x3f63('0x2c')][_0x3f63('0x41')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0xe685eb,0xc9))[_0x3f63('0x3f')](handleError(_0xe685eb,null));};exports[_0x3f63('0x20')]=function(_0x2a7fe2,_0x48409e){if(_0x2a7fe2['body']['id']){delete _0x2a7fe2[_0x3f63('0x47')]['id'];}return db[_0x3f63('0x27')][_0x3f63('0x44')]({'where':{'id':_0x2a7fe2[_0x3f63('0x43')]['id']}})[_0x3f63('0x21')](handleEntityNotFound(_0x48409e,null))[_0x3f63('0x21')](saveUpdates(_0x2a7fe2[_0x3f63('0x47')],null))[_0x3f63('0x21')](respondWithResult(_0x48409e,null))[_0x3f63('0x3f')](handleError(_0x48409e,null));};exports[_0x3f63('0x22')]=function(_0x3337e3,_0x43e624){return db[_0x3f63('0x27')]['find']({'where':{'id':_0x3337e3[_0x3f63('0x43')]['id']}})[_0x3f63('0x21')](handleEntityNotFound(_0x43e624,null))[_0x3f63('0x21')](removeEntity(_0x43e624,null))[_0x3f63('0x3f')](handleError(_0x43e624,null));};exports['create']=function(_0x10853d,_0x4ebdae,_0x2cd3fc){_0x10853d['body']['name']=_0x10853d[_0x3f63('0x4a')][_0x3f63('0x4b')];_0x10853d[_0x3f63('0x47')][_0x3f63('0x4c')]=_0x10853d[_0x3f63('0x4a')]['filename'];_0x10853d[_0x3f63('0x47')][_0x3f63('0x4d')]=_0x10853d[_0x3f63('0x4a')]['mimetype'];return db[_0x3f63('0x27')][_0x3f63('0x49')](_0x10853d[_0x3f63('0x47')])[_0x3f63('0x21')](respondWithResult(_0x4ebdae,0xc9))['catch'](handleError(_0x4ebdae,null));};exports[_0x3f63('0x4e')]=function(_0x342bb2,_0x358780,_0x231904){return db[_0x3f63('0x27')]['findOne']({'where':{'id':_0x342bb2[_0x3f63('0x43')]['id']},'raw':!![]})[_0x3f63('0x21')](handleEntityNotFound(_0x358780,null))[_0x3f63('0x21')](function(_0x3a76dd){if(_0x3a76dd){var _0x1c0540=_0x3a76dd['ChatOfflineMessageId']!==null;var _0x294b80=path[_0x3f63('0x4f')](config[_0x3f63('0x50')],_0x3f63('0x51'));if(_0x1c0540){_0x294b80=path[_0x3f63('0x4f')](_0x294b80,_0x3f63('0x52'));}var _0x8e9432=path['join'](_0x294b80,_0x3a76dd[_0x3f63('0x4c')]);return _0x358780[_0x3f63('0x4e')](_0x8e9432);}})[_0x3f63('0x3f')](handleError(_0x358780,null));}; \ No newline at end of file +var _0x2e10=['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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','end','error','stack','send','index','map','Attachment','rawAttributes','fieldName','type','key','name','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','options','find','get','omit','updatedAt','body','createdAt','create','includeAll','update','destroy','file','originalname','basename','filename','mimetype','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','fs-extra','squel'];(function(_0x189246,_0xb069ba){var _0xddb915=function(_0x4e0bbc){while(--_0x4e0bbc){_0x189246['push'](_0x189246['shift']());}};_0xddb915(++_0xb069ba);}(_0x2e10,0x15f));var _0x02e1=function(_0x4904ca,_0x3f382a){_0x4904ca=_0x4904ca-0x0;var _0x4006df=_0x2e10[_0x4904ca];return _0x4006df;};'use strict';var emlformat=require(_0x02e1('0x0'));var rimraf=require(_0x02e1('0x1'));var zipdir=require(_0x02e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x02e1('0x3'));var moment=require('moment');var BPromise=require(_0x02e1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x02e1('0x5'));var csv=require(_0x02e1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x02e1('0x7'));var _=require('lodash');var squel=require(_0x02e1('0x8'));var crypto=require(_0x02e1('0x9'));var jsforce=require(_0x02e1('0xa'));var deskjs=require(_0x02e1('0xb'));var toCsv=require(_0x02e1('0x6'));var querystring=require('querystring');var Papa=require(_0x02e1('0xc'));var Redis=require(_0x02e1('0xd'));var authService=require(_0x02e1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x02e1('0xf'));var hardwareService=require(_0x02e1('0x10'));var logger=require(_0x02e1('0x11'))(_0x02e1('0x12'));var utils=require(_0x02e1('0x13'));var config=require(_0x02e1('0x14'));var licenseUtil=require(_0x02e1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x392005,_0x2c25d9){_0x2c25d9=_0x2c25d9||0xcc;return function(_0x177bd2){if(_0x177bd2){return _0x392005[_0x02e1('0x16')](_0x2c25d9);}return _0x392005['status'](_0x2c25d9)['end']();};}function respondWithResult(_0x3f8832,_0x287024){_0x287024=_0x287024||0xc8;return function(_0x266019){if(_0x266019){return _0x3f8832[_0x02e1('0x17')](_0x287024)['json'](_0x266019);}};}function respondWithFilteredResult(_0x37ab22,_0x900df8){return function(_0x140639){if(_0x140639){var _0x35a45e=typeof _0x900df8[_0x02e1('0x18')]===_0x02e1('0x19')&&typeof _0x900df8[_0x02e1('0x1a')]==='undefined';var _0x3e3088=_0x140639['count'];var _0x31cdd8=_0x35a45e?0x0:_0x900df8['offset'];var _0x1492f5=_0x35a45e?_0x140639[_0x02e1('0x1b')]:_0x900df8[_0x02e1('0x18')]+_0x900df8[_0x02e1('0x1a')];var _0x59f67a;if(_0x1492f5>=_0x3e3088){_0x1492f5=_0x3e3088;_0x59f67a=0xc8;}else{_0x59f67a=0xce;}_0x37ab22[_0x02e1('0x17')](_0x59f67a);return _0x37ab22[_0x02e1('0x1c')](_0x02e1('0x1d'),_0x31cdd8+'-'+_0x1492f5+'/'+_0x3e3088)[_0x02e1('0x1e')](_0x140639);}return null;};}function patchUpdates(_0x282734){return function(_0x4cc2a5){try{jsonpatch[_0x02e1('0x1f')](_0x4cc2a5,_0x282734,!![]);}catch(_0x1d8885){return BPromise[_0x02e1('0x20')](_0x1d8885);}return _0x4cc2a5[_0x02e1('0x21')]();};}function saveUpdates(_0x51b41a,_0x44ae74){return function(_0x59c3c6){if(_0x59c3c6){return _0x59c3c6['update'](_0x51b41a)[_0x02e1('0x22')](function(_0x2d1acf){return _0x2d1acf;});}return null;};}function removeEntity(_0x34c4a5,_0x5bda13){return function(_0x4f226b){if(_0x4f226b){return _0x4f226b['destroy']()[_0x02e1('0x22')](function(){_0x34c4a5[_0x02e1('0x17')](0xcc)[_0x02e1('0x23')]();});}};}function handleEntityNotFound(_0x311025,_0x15c1f1){return function(_0x17d642){if(!_0x17d642){_0x311025[_0x02e1('0x16')](0x194);}return _0x17d642;};}function handleError(_0x204905,_0x1dd19c){_0x1dd19c=_0x1dd19c||0x1f4;return function(_0x599d17){logger[_0x02e1('0x24')](_0x599d17[_0x02e1('0x25')]);if(_0x599d17['name']){delete _0x599d17['name'];}_0x204905['status'](_0x1dd19c)[_0x02e1('0x26')](_0x599d17);};}exports[_0x02e1('0x27')]=function(_0x582099,_0x5ae254){var _0x106d38={},_0x544e30={},_0x3add46={'count':0x0,'rows':[]};var _0x1a33f8=_[_0x02e1('0x28')](db[_0x02e1('0x29')][_0x02e1('0x2a')],function(_0x281065){return{'name':_0x281065[_0x02e1('0x2b')],'type':_0x281065[_0x02e1('0x2c')][_0x02e1('0x2d')]};});_0x544e30['model']=_[_0x02e1('0x28')](_0x1a33f8,_0x02e1('0x2e'));_0x544e30[_0x02e1('0x2f')]=_[_0x02e1('0x30')](_0x582099[_0x02e1('0x2f')]);_0x544e30[_0x02e1('0x31')]=_['intersection'](_0x544e30[_0x02e1('0x32')],_0x544e30[_0x02e1('0x2f')]);_0x106d38['attributes']=_[_0x02e1('0x33')](_0x544e30['model'],qs[_0x02e1('0x34')](_0x582099[_0x02e1('0x2f')][_0x02e1('0x34')]));_0x106d38[_0x02e1('0x35')]=_0x106d38[_0x02e1('0x35')][_0x02e1('0x36')]?_0x106d38[_0x02e1('0x35')]:_0x544e30[_0x02e1('0x32')];if(!_0x582099[_0x02e1('0x2f')][_0x02e1('0x37')](_0x02e1('0x38'))){_0x106d38[_0x02e1('0x1a')]=qs[_0x02e1('0x1a')](_0x582099[_0x02e1('0x2f')]['limit']);_0x106d38[_0x02e1('0x18')]=qs[_0x02e1('0x18')](_0x582099[_0x02e1('0x2f')][_0x02e1('0x18')]);}_0x106d38['order']=qs['sort'](_0x582099[_0x02e1('0x2f')][_0x02e1('0x39')]);_0x106d38[_0x02e1('0x3a')]=qs[_0x02e1('0x31')](_[_0x02e1('0x3b')](_0x582099[_0x02e1('0x2f')],_0x544e30[_0x02e1('0x31')]),_0x1a33f8);if(_0x582099['query'][_0x02e1('0x3c')]){_0x106d38[_0x02e1('0x3a')]=_[_0x02e1('0x3d')](_0x106d38[_0x02e1('0x3a')],{'$or':_[_0x02e1('0x28')](_0x1a33f8,function(_0x101072){if(_0x101072['type']!=='VIRTUAL'){var _0x2839e9={};_0x2839e9[_0x101072[_0x02e1('0x2e')]]={'$like':'%'+_0x582099[_0x02e1('0x2f')][_0x02e1('0x3c')]+'%'};return _0x2839e9;}})});}_0x106d38=_[_0x02e1('0x3d')]({},_0x106d38,_0x582099['options']);var _0x1f1071={'where':_0x106d38[_0x02e1('0x3a')]};return db['Attachment']['count'](_0x1f1071)[_0x02e1('0x22')](function(_0x4c804c){_0x3add46[_0x02e1('0x1b')]=_0x4c804c;if(_0x582099[_0x02e1('0x2f')]['includeAll']){_0x106d38[_0x02e1('0x3e')]=[{'all':!![]}];}return db[_0x02e1('0x29')][_0x02e1('0x3f')](_0x106d38);})[_0x02e1('0x22')](function(_0x2258d5){_0x3add46[_0x02e1('0x40')]=_0x2258d5;return _0x3add46;})['then'](respondWithFilteredResult(_0x5ae254,_0x106d38))[_0x02e1('0x41')](handleError(_0x5ae254,null));};exports[_0x02e1('0x42')]=function(_0x1b0d19,_0x4c9e37){var _0x31530d={'raw':!![],'where':{'id':_0x1b0d19[_0x02e1('0x43')]['id']}},_0xbadc37={};_0xbadc37['model']=_[_0x02e1('0x30')](db[_0x02e1('0x29')]['rawAttributes']);_0xbadc37['query']=_[_0x02e1('0x30')](_0x1b0d19['query']);_0xbadc37[_0x02e1('0x31')]=_[_0x02e1('0x33')](_0xbadc37['model'],_0xbadc37[_0x02e1('0x2f')]);_0x31530d['attributes']=_[_0x02e1('0x33')](_0xbadc37['model'],qs[_0x02e1('0x34')](_0x1b0d19['query'][_0x02e1('0x34')]));_0x31530d[_0x02e1('0x35')]=_0x31530d[_0x02e1('0x35')]['length']?_0x31530d['attributes']:_0xbadc37[_0x02e1('0x32')];if(_0x1b0d19['query']['includeAll']){_0x31530d[_0x02e1('0x3e')]=[{'all':!![]}];}_0x31530d=_[_0x02e1('0x3d')]({},_0x31530d,_0x1b0d19[_0x02e1('0x44')]);return db[_0x02e1('0x29')]['find'](_0x31530d)['then'](handleEntityNotFound(_0x4c9e37,null))['then'](respondWithResult(_0x4c9e37,null))['catch'](handleError(_0x4c9e37,null));};exports['clone']=function(_0x12d73c,_0x44a3aa){var _0x52f17a={'where':{'id':_0x12d73c[_0x02e1('0x43')]['id']}},_0x507849={};_0x507849[_0x02e1('0x32')]=_[_0x02e1('0x30')](db[_0x02e1('0x29')][_0x02e1('0x2a')]);_0x52f17a[_0x02e1('0x35')]=_[_0x02e1('0x33')](_0x507849[_0x02e1('0x32')],qs[_0x02e1('0x34')](_0x12d73c[_0x02e1('0x2f')][_0x02e1('0x34')]));_0x52f17a[_0x02e1('0x35')]=_0x52f17a[_0x02e1('0x35')]['length']?_0x52f17a['attributes']:_0x507849[_0x02e1('0x32')];if(_0x12d73c['query']['includeAll']){_0x52f17a['include']=[{'all':!![]}];}_0x52f17a=_['merge']({},_0x52f17a,_0x12d73c['options']);return db[_0x02e1('0x29')][_0x02e1('0x45')](_0x52f17a)['then'](handleEntityNotFound(_0x44a3aa,null))[_0x02e1('0x22')](function(_0x256e47){if(_0x256e47){var _0x58ba4e=_0x256e47[_0x02e1('0x46')]({'plain':!![]});_0x58ba4e=qs[_0x02e1('0x47')](_0x58ba4e,['id','createdAt',_0x02e1('0x48')]);_0x12d73c['body']=_[_0x02e1('0x47')](_0x12d73c[_0x02e1('0x49')],['id',_0x02e1('0x4a'),_0x02e1('0x48')]);return db[_0x02e1('0x29')][_0x02e1('0x4b')](_[_0x02e1('0x3d')](_0x58ba4e,_0x12d73c[_0x02e1('0x49')]),{'include':_0x12d73c[_0x02e1('0x2f')][_0x02e1('0x4c')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x44a3aa,0xc9))[_0x02e1('0x41')](handleError(_0x44a3aa,null));};exports[_0x02e1('0x4d')]=function(_0x1e461f,_0x15d2c3){if(_0x1e461f[_0x02e1('0x49')]['id']){delete _0x1e461f[_0x02e1('0x49')]['id'];}return db[_0x02e1('0x29')][_0x02e1('0x45')]({'where':{'id':_0x1e461f[_0x02e1('0x43')]['id']}})[_0x02e1('0x22')](handleEntityNotFound(_0x15d2c3,null))[_0x02e1('0x22')](saveUpdates(_0x1e461f[_0x02e1('0x49')],null))[_0x02e1('0x22')](respondWithResult(_0x15d2c3,null))[_0x02e1('0x41')](handleError(_0x15d2c3,null));};exports[_0x02e1('0x4e')]=function(_0x13f467,_0x156dca){return db[_0x02e1('0x29')]['find']({'where':{'id':_0x13f467['params']['id']}})['then'](handleEntityNotFound(_0x156dca,null))[_0x02e1('0x22')](removeEntity(_0x156dca,null))['catch'](handleError(_0x156dca,null));};exports[_0x02e1('0x4b')]=function(_0x4b118d,_0x938b1d,_0x44c9cf){_0x4b118d[_0x02e1('0x49')][_0x02e1('0x2e')]=_0x4b118d[_0x02e1('0x4f')][_0x02e1('0x50')];_0x4b118d[_0x02e1('0x49')][_0x02e1('0x51')]=_0x4b118d[_0x02e1('0x4f')][_0x02e1('0x52')];_0x4b118d['body'][_0x02e1('0x2c')]=_0x4b118d[_0x02e1('0x4f')][_0x02e1('0x53')];return db[_0x02e1('0x29')][_0x02e1('0x4b')](_0x4b118d[_0x02e1('0x49')])[_0x02e1('0x22')](respondWithResult(_0x938b1d,0xc9))[_0x02e1('0x41')](handleError(_0x938b1d,null));};exports['download']=function(_0x252b04,_0xebdd72,_0x265195){return db['Attachment']['findOne']({'where':{'id':_0x252b04['params']['id']},'raw':!![]})[_0x02e1('0x22')](handleEntityNotFound(_0xebdd72,null))[_0x02e1('0x22')](function(_0x173d7f){if(_0x173d7f){var _0x40d4b1=_0x173d7f[_0x02e1('0x54')]!==null;var _0x373c78=path[_0x02e1('0x55')](config[_0x02e1('0x56')],_0x02e1('0x57'));if(_0x40d4b1){_0x373c78=path[_0x02e1('0x55')](_0x373c78,_0x02e1('0x58'));}var _0x3277e5=path[_0x02e1('0x55')](_0x373c78,_0x173d7f['basename']);return _0xebdd72[_0x02e1('0x59')](_0x3277e5);}})[_0x02e1('0x41')](handleError(_0xebdd72,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 27dedfc..47ede7a 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 _0x27e4=['./attachment.attributes','exports','define','Attachment','attachments','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5d5bfd,_0x458ce6){var _0x542a3d=function(_0x29bc1a){while(--_0x29bc1a){_0x5d5bfd['push'](_0x5d5bfd['shift']());}};_0x542a3d(++_0x458ce6);}(_0x27e4,0x179));var _0x427e=function(_0x5663a5,_0x3d1be6){_0x5663a5=_0x5663a5-0x0;var _0x3821de=_0x27e4[_0x5663a5];return _0x3821de;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x427e('0x0'))(_0x427e('0x1'));var moment=require(_0x427e('0x2'));var BPromise=require(_0x427e('0x3'));var rp=require(_0x427e('0x4'));var fs=require('fs');var path=require(_0x427e('0x5'));var rimraf=require('rimraf');var config=require(_0x427e('0x6'));var attributes=require(_0x427e('0x7'));module[_0x427e('0x8')]=function(_0x9e6af7,_0x1a600a){return _0x9e6af7[_0x427e('0x9')](_0x427e('0xa'),attributes,{'tableName':_0x427e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66f7=['../../config/environment','exports','define','Attachment','attachments','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x4df9c2,_0x40c159){var _0x5bfd72=function(_0x25c407){while(--_0x25c407){_0x4df9c2['push'](_0x4df9c2['shift']());}};_0x5bfd72(++_0x40c159);}(_0x66f7,0x73));var _0x766f=function(_0x1ef48d,_0x203c73){_0x1ef48d=_0x1ef48d-0x0;var _0x450096=_0x66f7[_0x1ef48d];return _0x450096;};'use strict';var _=require('lodash');var util=require(_0x766f('0x0'));var logger=require(_0x766f('0x1'))(_0x766f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x766f('0x3'));var fs=require('fs');var path=require(_0x766f('0x4'));var rimraf=require(_0x766f('0x5'));var config=require(_0x766f('0x6'));var attributes=require('./attachment.attributes');module[_0x766f('0x7')]=function(_0x3aa7d3,_0x380e31){return _0x3aa7d3[_0x766f('0x8')](_0x766f('0x9'),attributes,{'tableName':_0x766f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 5738445..9a779ed 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 _0xf323=['create','options','raw','debug','CreateAttachment','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Attachment'];(function(_0x5b2610,_0x2479a0){var _0x5d631e=function(_0x13001e){while(--_0x13001e){_0x5b2610['push'](_0x5b2610['shift']());}};_0x5d631e(++_0x2479a0);}(_0xf323,0x1c6));var _0x3f32=function(_0x23235e,_0x364e5b){_0x23235e=_0x23235e-0x0;var _0x11945c=_0xf323[_0x23235e];return _0x11945c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f32('0x0'));var BPromise=require(_0x3f32('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f32('0x2'));var db=require(_0x3f32('0x3'))['db'];var utils=require(_0x3f32('0x4'));var logger=require(_0x3f32('0x5'))(_0x3f32('0x6'));var config=require('../../config/environment');var jayson=require(_0x3f32('0x7'));var client=jayson[_0x3f32('0x8')][_0x3f32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1134e9,_0x5c9dc2,_0x567ab1){return new BPromise(function(_0x34b93e,_0x109af2){return client[_0x3f32('0xa')](_0x1134e9,_0x567ab1)[_0x3f32('0xb')](function(_0x22a9d3){logger[_0x3f32('0xc')](_0x3f32('0xd'),_0x5c9dc2,_0x3f32('0xe'));logger['debug'](_0x3f32('0xf'),_0x5c9dc2,_0x3f32('0xe'),JSON[_0x3f32('0x10')](_0x22a9d3));if(_0x22a9d3['error']){if(_0x22a9d3[_0x3f32('0x11')][_0x3f32('0x12')]===0x1f4){logger[_0x3f32('0x11')](_0x3f32('0xd'),_0x5c9dc2,_0x22a9d3['error']['message']);return _0x109af2(_0x22a9d3[_0x3f32('0x11')][_0x3f32('0x13')]);}logger['error'](_0x3f32('0xd'),_0x5c9dc2,_0x22a9d3[_0x3f32('0x11')][_0x3f32('0x13')]);return _0x34b93e(_0x22a9d3['error']['message']);}else{logger[_0x3f32('0xc')](_0x3f32('0xd'),_0x5c9dc2,_0x3f32('0xe'));_0x34b93e(_0x22a9d3[_0x3f32('0x14')]['message']);}})['catch'](function(_0x352010){logger[_0x3f32('0x11')](_0x3f32('0xd'),_0x5c9dc2,_0x352010);_0x109af2(_0x352010);});});}exports['CreateAttachment']=function(_0x5c36d9){var _0x1697c9=this;return new Promise(function(_0x19ec90,_0x8d70ee){return db[_0x3f32('0x15')][_0x3f32('0x16')](_0x5c36d9['body'],{'raw':_0x5c36d9[_0x3f32('0x17')]?_0x5c36d9[_0x3f32('0x17')][_0x3f32('0x18')]===undefined?!![]:![]:!![]})[_0x3f32('0xb')](function(_0xbc366b){logger[_0x3f32('0xc')]('CreateAttachment',_0x5c36d9);logger[_0x3f32('0x19')](_0x3f32('0x1a'),_0x5c36d9,JSON['stringify'](_0xbc366b));_0x19ec90(_0xbc366b);})[_0x3f32('0x1b')](function(_0x21cf2e){logger[_0x3f32('0x11')](_0x3f32('0x1a'),_0x21cf2e['message'],_0x5c36d9);_0x8d70ee(_0x1697c9[_0x3f32('0x11')](0x1f4,_0x21cf2e[_0x3f32('0x13')]));});});}; \ No newline at end of file +var _0x524a=['../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateAttachment','Attachment','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x437aac,_0x7f0a20){var _0x4a3ee6=function(_0x503e9d){while(--_0x503e9d){_0x437aac['push'](_0x437aac['shift']());}};_0x4a3ee6(++_0x7f0a20);}(_0x524a,0xf5));var _0xa524=function(_0x1c0d7f,_0x56762b){_0x1c0d7f=_0x1c0d7f-0x0;var _0x204a61=_0x524a[_0x1c0d7f];return _0x204a61;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var BPromise=require(_0xa524('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa524('0x4'));var db=require(_0xa524('0x5'))['db'];var utils=require(_0xa524('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa524('0x7'));var jayson=require(_0xa524('0x8'));var client=jayson[_0xa524('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x460738,_0x56bd0e,_0x3a2dd6){return new BPromise(function(_0x11aa98,_0x56849e){return client[_0xa524('0xa')](_0x460738,_0x3a2dd6)[_0xa524('0xb')](function(_0x228ffe){logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,'request\x20sent');logger[_0xa524('0xe')](_0xa524('0xf'),_0x56bd0e,'request\x20sent',JSON['stringify'](_0x228ffe));if(_0x228ffe[_0xa524('0x10')]){if(_0x228ffe[_0xa524('0x10')][_0xa524('0x11')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')]['message']);return _0x56849e(_0x228ffe[_0xa524('0x10')]['message']);}logger[_0xa524('0x10')]('Attachment,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')][_0xa524('0x12')]);return _0x11aa98(_0x228ffe['error'][_0xa524('0x12')]);}else{logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,_0xa524('0x13'));_0x11aa98(_0x228ffe[_0xa524('0x14')][_0xa524('0x12')]);}})[_0xa524('0x15')](function(_0x4fc42f){logger[_0xa524('0x10')](_0xa524('0xd'),_0x56bd0e,_0x4fc42f);_0x56849e(_0x4fc42f);});});}exports[_0xa524('0x16')]=function(_0x3d6a0d){var _0x375277=this;return new Promise(function(_0x805b93,_0x562941){return db[_0xa524('0x17')]['create'](_0x3d6a0d[_0xa524('0x18')],{'raw':_0x3d6a0d[_0xa524('0x19')]?_0x3d6a0d[_0xa524('0x19')][_0xa524('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5510fa){logger[_0xa524('0xc')](_0xa524('0x16'),_0x3d6a0d);logger[_0xa524('0xe')](_0xa524('0x16'),_0x3d6a0d,JSON[_0xa524('0x1b')](_0x5510fa));_0x805b93(_0x5510fa);})[_0xa524('0x15')](function(_0x4abffe){logger[_0xa524('0x10')](_0xa524('0x16'),_0x4abffe[_0xa524('0x12')],_0x3d6a0d);_0x562941(_0x375277[_0xa524('0x10')](0x1f4,_0x4abffe[_0xa524('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5b933cb..71dd02e 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x591cf5,_0x31ff87){var _0x3c850c=function(_0x329aeb){while(--_0x329aeb){_0x591cf5['push'](_0x591cf5['shift']());}};_0x3c850c(++_0x31ff87);}(_0xadb5,0xad));var _0x5adb=function(_0x1a5ed0,_0x37fac4){_0x1a5ed0=_0x1a5ed0-0x0;var _0x18ff4e=_0xadb5[_0x1a5ed0];return _0x18ff4e;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x0b0e,0x187));var _0xe0b0=function(_0xfe26da,_0x5ac1b7){_0xfe26da=_0xfe26da-0x0;var _0x2abe6e=_0x0b0e[_0xfe26da];return _0x2abe6e;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index fc5ad61..9861225 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2aa0=['add','minutes','clearBlockUser','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','use','User','passport','passport-local','moment','activedirectory2','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blockedAt','online','admin','user','agent','domain','blocked'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0x2aa0,0x6c));var _0x02aa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2aa0[_0x57b54c];return _0x59cc19;};'use strict';var passport=require(_0x02aa('0x0'));var LocalStrategy=require(_0x02aa('0x1'))['Strategy'];var moment=require(_0x02aa('0x2'));var ActiveDirectory=require(_0x02aa('0x3'));var BPromise=require('bluebird');var util=require(_0x02aa('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x02aa('0x5'));var utils=require(_0x02aa('0x6'));var config=require(_0x02aa('0x7'));var logger=require(_0x02aa('0x8'))(_0x02aa('0x9'));function isActiveDirectoryConfigured(_0x386694){var _0x17e58f=![];if(typeof _0x386694[_0x02aa('0xa')]!==_0x02aa('0xb')){_0x17e58f=_0x386694[_0x02aa('0xa')][_0x02aa('0xc')]&&_0x386694['activedirectory'][_0x02aa('0xd')]&&_0x386694[_0x02aa('0xa')]['domain'];}return _0x17e58f;}function adAuthenticate(_0x6b4d7f,_0x1590b1,_0x410540){return new BPromise(function(_0x4a9912,_0x5da83a){try{var _0x26d443=new ActiveDirectory(_0x6b4d7f);_0x26d443[_0x02aa('0xe')](_0x1590b1,_0x410540,function(_0x2bc880,_0x1e6be1){if(_0x2bc880){logger[_0x02aa('0xf')]('Error\x20authenticate\x20%s:\x20%s',_0x1590b1,util['inspect'](_0x2bc880,{'showHidden':![],'depth':null}));_0x5da83a('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x1e6be1){logger[_0x02aa('0xf')](_0x02aa('0x10'),_0x1590b1);_0x5da83a(_0x02aa('0x11'));}else{_0x4a9912(_0x1e6be1);}});}catch(_0x24c2ce){_0x5da83a(_0x24c2ce);}});}function ActiveDirectoryAuthenticate(_0x2a00da,_0x191bd3,_0x119662,_0x32787){var _0x14988e,_0x3a0f8c;if(!isActiveDirectoryConfigured(config)){logger[_0x02aa('0xf')](_0x02aa('0x12'),_0x191bd3);return _0x32787(null,![],{'message':_0x02aa('0x11')});}return db[_0x02aa('0x13')][_0x02aa('0x14')]({'where':{'id':0x1},'attributes':[_0x02aa('0x15'),_0x02aa('0x16')],'raw':!![]})[_0x02aa('0x17')](function(_0xb0bc12){_0x14988e=_0xb0bc12;if(!_0x14988e[_0x02aa('0x15')]){logger['error'](_0x02aa('0x18'),_0x191bd3);throw new Error(_0x02aa('0x11'));}return _0x2a00da['findOne']({'attributes':['id',_0x02aa('0x19'),_0x02aa('0x1a'),_0x02aa('0x1b'),'role',_0x02aa('0x1c'),'blocked',_0x02aa('0x1d'),_0x02aa('0x1e')],'where':{'name':_0x191bd3,'role':{'$or':[_0x02aa('0x1f'),_0x02aa('0x20'),_0x02aa('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0xf74047){if(!_0xf74047||_0xf74047&&_0xf74047[_0x02aa('0x19')]!==_0x191bd3){throw new Error(_0x02aa('0x11'));}_0x3a0f8c=_0xf74047;var _0x1dcc4e=_0x3a0f8c[_0x02aa('0x19')]+'@'+config[_0x02aa('0xa')][_0x02aa('0x22')];return adAuthenticate(config[_0x02aa('0xa')],_0x1dcc4e,_0x119662);})[_0x02aa('0x17')](function(_0x3a4cf5){if(_0x3a0f8c[_0x02aa('0x1c')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x14988e[_0x02aa('0x16')]>0x0){if(_0x3a0f8c[_0x02aa('0x23')]){if(moment(_0x3a0f8c[_0x02aa('0x1d')])[_0x02aa('0x24')](_0x14988e[_0x02aa('0x16')],_0x02aa('0x25'))>moment()){throw new Error(_0x02aa('0x11'));}return utils[_0x02aa('0x26')](_0x3a0f8c,0x0,![],null)[_0x02aa('0x17')](function(){return utils['getLicense'](_0x3a0f8c);})[_0x02aa('0x17')](function(){return _0x32787(null,_0x3a0f8c);});}else{return utils['getLicense'](_0x3a0f8c)[_0x02aa('0x17')](function(){return _0x32787(null,_0x3a0f8c);});}}else{return utils['getLicense'](_0x3a0f8c)['then'](function(){return _0x32787(null,_0x3a0f8c);});}})['catch'](function(_0x57b1fc){return _0x32787(null,![],_0x57b1fc);});}function handleError(_0x20cf72,_0x1ccf22,_0xf93497){return _0x20cf72[_0x02aa('0x27')](_0x1ccf22||0x1f4)[_0x02aa('0x28')]({'message':_0xf93497?_0xf93497['message']||_0xf93497:''});}exports[_0x02aa('0x29')]=function(_0x2d4883,_0x444b79,_0x3a7508){passport[_0x02aa('0xe')](_0x02aa('0x2a'),function(_0x1fc70b,_0x22aac4,_0x125bee){var _0x5ecf18=_0x1fc70b||_0x125bee;if(_0x5ecf18){return handleError(_0x444b79,0x191,_0x5ecf18);}if(!_0x22aac4){return handleError(_0x444b79,0x194,{'message':_0x02aa('0x2b')});}else{var _0x560bf2={'payload':{'id':_0x22aac4['id'],'role':_0x22aac4[_0x02aa('0x2c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x560bf2)[_0x02aa('0x17')](function(_0x592f60){_0x444b79[_0x02aa('0x2d')]({'id':_0x22aac4['id'],'token':_0x592f60,'statusCall':'','isAlreadyLogged':_0x22aac4[_0x02aa('0x1e')]});});}})(_0x2d4883,_0x444b79,_0x3a7508);};passport[_0x02aa('0x2e')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x18f6e5,_0x4ee46c,_0x236418){return ActiveDirectoryAuthenticate(db[_0x02aa('0x2f')],_0x18f6e5,_0x4ee46c,_0x236418);})); \ No newline at end of file +var _0x84c7=['inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','then','name','password','disabled','blocked','blockedAt','admin','user','agent','add','blockDuration','clearBlockUser','getLicense','catch','status','send','authenticate','role','signToken','online','use','ad-login','User','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s'];(function(_0x1a046d,_0x3c2120){var _0x1dabe7=function(_0x123dec){while(--_0x123dec){_0x1a046d['push'](_0x1a046d['shift']());}};_0x1dabe7(++_0x3c2120);}(_0x84c7,0x10e));var _0x784c=function(_0x15f1d9,_0x48654d){_0x15f1d9=_0x15f1d9-0x0;var _0x1d00e4=_0x84c7[_0x15f1d9];return _0x1d00e4;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x784c('0x0'))[_0x784c('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x784c('0x2'));var BPromise=require(_0x784c('0x3'));var util=require(_0x784c('0x4'));var db=require(_0x784c('0x5'))['db'];var authService=require(_0x784c('0x6'));var utils=require(_0x784c('0x7'));var config=require(_0x784c('0x8'));var logger=require(_0x784c('0x9'))(_0x784c('0xa'));function isActiveDirectoryConfigured(_0x13c349){var _0x16b92b=![];if(typeof _0x13c349[_0x784c('0xb')]!==_0x784c('0xc')){_0x16b92b=_0x13c349[_0x784c('0xb')][_0x784c('0xd')]&&_0x13c349['activedirectory'][_0x784c('0xe')]&&_0x13c349[_0x784c('0xb')][_0x784c('0xf')];}return _0x16b92b;}function adAuthenticate(_0x29522a,_0x55e50d,_0x3750df){return new BPromise(function(_0xadc711,_0x4796fc){try{var _0x32fa73=new ActiveDirectory(_0x29522a);_0x32fa73['authenticate'](_0x55e50d,_0x3750df,function(_0x5a5ba7,_0x15c069){if(_0x5a5ba7){logger[_0x784c('0x10')](_0x784c('0x11'),_0x55e50d,util[_0x784c('0x12')](_0x5a5ba7,{'showHidden':![],'depth':null}));_0x4796fc(_0x784c('0x13'));}else if(!_0x15c069){logger['error'](_0x784c('0x14'),_0x55e50d);_0x4796fc(_0x784c('0x13'));}else{_0xadc711(_0x15c069);}});}catch(_0x12f4b0){_0x4796fc(_0x12f4b0);}});}function ActiveDirectoryAuthenticate(_0x29f9f2,_0x179f32,_0x489010,_0x29dbae){var _0x422a51,_0x31cc00;if(!isActiveDirectoryConfigured(config)){logger[_0x784c('0x10')](_0x784c('0x15'),_0x179f32);return _0x29dbae(null,![],{'message':_0x784c('0x13')});}return db[_0x784c('0x16')][_0x784c('0x17')]({'where':{'id':0x1},'attributes':[_0x784c('0x18'),'blockDuration'],'raw':!![]})[_0x784c('0x19')](function(_0x3e2717){_0x422a51=_0x3e2717;if(!_0x422a51[_0x784c('0x18')]){logger[_0x784c('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x179f32);throw new Error(_0x784c('0x13'));}return _0x29f9f2[_0x784c('0x17')]({'attributes':['id',_0x784c('0x1a'),_0x784c('0x1b'),'salt','role',_0x784c('0x1c'),_0x784c('0x1d'),_0x784c('0x1e'),'online'],'where':{'name':_0x179f32,'role':{'$or':[_0x784c('0x1f'),_0x784c('0x20'),_0x784c('0x21')]},'adSsoEnabled':!![]}});})[_0x784c('0x19')](function(_0x2c293d){if(!_0x2c293d||_0x2c293d&&_0x2c293d[_0x784c('0x1a')]!==_0x179f32){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x31cc00=_0x2c293d;var _0x115918=_0x31cc00['name']+'@'+config[_0x784c('0xb')]['domain'];return adAuthenticate(config['activedirectory'],_0x115918,_0x489010);})[_0x784c('0x19')](function(_0x41d515){if(_0x31cc00[_0x784c('0x1c')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x422a51['blockDuration']>0x0){if(_0x31cc00[_0x784c('0x1d')]){if(moment(_0x31cc00[_0x784c('0x1e')])[_0x784c('0x22')](_0x422a51[_0x784c('0x23')],'minutes')>moment()){throw new Error(_0x784c('0x13'));}return utils[_0x784c('0x24')](_0x31cc00,0x0,![],null)['then'](function(){return utils[_0x784c('0x25')](_0x31cc00);})[_0x784c('0x19')](function(){return _0x29dbae(null,_0x31cc00);});}else{return utils['getLicense'](_0x31cc00)['then'](function(){return _0x29dbae(null,_0x31cc00);});}}else{return utils[_0x784c('0x25')](_0x31cc00)[_0x784c('0x19')](function(){return _0x29dbae(null,_0x31cc00);});}})[_0x784c('0x26')](function(_0x1bc8da){return _0x29dbae(null,![],_0x1bc8da);});}function handleError(_0x5852fc,_0x5d832a,_0x136b6d){return _0x5852fc[_0x784c('0x27')](_0x5d832a||0x1f4)[_0x784c('0x28')]({'message':_0x136b6d?_0x136b6d['message']||_0x136b6d:''});}exports['login']=function(_0x110b7b,_0x4364f4,_0x249937){passport[_0x784c('0x29')]('ad-login',function(_0x270c34,_0x5793af,_0x27517e){var _0x4c43c4=_0x270c34||_0x27517e;if(_0x4c43c4){return handleError(_0x4364f4,0x191,_0x4c43c4);}if(!_0x5793af){return handleError(_0x4364f4,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4db964={'payload':{'id':_0x5793af['id'],'role':_0x5793af[_0x784c('0x2a')]},'options':{'expiresIn':0x15180}};return authService[_0x784c('0x2b')](_0x4db964)[_0x784c('0x19')](function(_0x4777d8){_0x4364f4['json']({'id':_0x5793af['id'],'token':_0x4777d8,'statusCall':'','isAlreadyLogged':_0x5793af[_0x784c('0x2c')]});});}})(_0x110b7b,_0x4364f4,_0x249937);};passport[_0x784c('0x2d')](_0x784c('0x2e'),new LocalStrategy({'usernameField':_0x784c('0x1a'),'passwordField':_0x784c('0x1b')},function(_0x1c66eb,_0x1ba0b1,_0x202f3f){return ActiveDirectoryAuthenticate(db[_0x784c('0x2f')],_0x1c66eb,_0x1ba0b1,_0x202f3f);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 00868d8..3ade51f 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac82=['./authActiveDirectory.controller','login','exports','express','Router'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xac82,0xdf));var _0x2ac8=function(_0x1d9555,_0x336f52){_0x1d9555=_0x1d9555-0x0;var _0x26e343=_0xac82[_0x1d9555];return _0x26e343;};'use strict';var express=require(_0x2ac8('0x0'));var router=express[_0x2ac8('0x1')]();var controller=require(_0x2ac8('0x2'));router['post']('/',controller[_0x2ac8('0x3')]);module[_0x2ac8('0x4')]=router; \ No newline at end of file +var _0x6b17=['Router','./authActiveDirectory.controller','post','login','express'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x6b17,0x1d0));var _0x76b1=function(_0x32f776,_0x1bf7e6){_0x32f776=_0x32f776-0x0;var _0xa9f55=_0x6b17[_0x32f776];return _0xa9f55;};'use strict';var express=require(_0x76b1('0x0'));var router=express[_0x76b1('0x1')]();var controller=require(_0x76b1('0x2'));router[_0x76b1('0x3')]('/',controller[_0x76b1('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 24c89c9..2346738 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x3bfe1e,_0x3facfa){var _0x26a601=function(_0xb7fb78){while(--_0xb7fb78){_0x3bfe1e['push'](_0x3bfe1e['shift']());}};_0x26a601(++_0x3facfa);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x56c7c0,_0x463d97){var _0x666b9a=function(_0x56e4a5){while(--_0x56e4a5){_0x56c7c0['push'](_0x56c7c0['shift']());}};_0x666b9a(++_0x463d97);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 25d5e4a..11186d3 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 _0x7c5b=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie'];(function(_0x4be698,_0x4f2da2){var _0x57dd6c=function(_0x2fb3d2){while(--_0x2fb3d2){_0x4be698['push'](_0x4be698['shift']());}};_0x57dd6c(++_0x4f2da2);}(_0x7c5b,0x11e));var _0xb7c5=function(_0x218922,_0xb7bf28){_0x218922=_0x218922-0x0;var _0x430b85=_0x7c5b[_0x218922];return _0x430b85;};'use strict';var express=require(_0xb7c5('0x0'));var passport=require(_0xb7c5('0x1'));var router=express[_0xb7c5('0x2')]();var controller=require(_0xb7c5('0x3'));var userController=require(_0xb7c5('0x4'));var authService=require(_0xb7c5('0x5'));router[_0xb7c5('0x6')]('/',controller[_0xb7c5('0x7')]);router[_0xb7c5('0x6')]('/callback',controller[_0xb7c5('0x8')],authService[_0xb7c5('0x9')],userController[_0xb7c5('0x7')],authService[_0xb7c5('0xa')]);module['exports']=router; \ No newline at end of file +var _0x7f36=['login','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','get','/callback','callback','isMiddleware'];(function(_0x193375,_0x46a470){var _0x278b3c=function(_0x4a42d6){while(--_0x4a42d6){_0x193375['push'](_0x193375['shift']());}};_0x278b3c(++_0x46a470);}(_0x7f36,0x1bf));var _0x67f3=function(_0x4f8593,_0x40b949){_0x4f8593=_0x4f8593-0x0;var _0x57fcfd=_0x7f36[_0x4f8593];return _0x57fcfd;};'use strict';var express=require(_0x67f3('0x0'));var passport=require(_0x67f3('0x1'));var router=express[_0x67f3('0x2')]();var controller=require(_0x67f3('0x3'));var userController=require(_0x67f3('0x4'));var authService=require('../../components/auth/service');router[_0x67f3('0x5')]('/',controller['login']);router['get'](_0x67f3('0x6'),controller[_0x67f3('0x7')],authService[_0x67f3('0x8')],userController[_0x67f3('0x9')],authService[_0x67f3('0xa')]);module[_0x67f3('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 2a4c036..408b62e 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 _0x6287=['role','disabled','blocked','blockedAt','agent','authenticate','loginAttempts','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','minutes','getLicense','catch','find','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','signToken','online','forgot','body','email','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','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','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','securePassword','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport-local','Strategy','jayson/promise','lodash','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password'];(function(_0xa1f3d,_0x1df2d7){var _0x514c56=function(_0x5f1c02){while(--_0x5f1c02){_0xa1f3d['push'](_0xa1f3d['shift']());}};_0x514c56(++_0x1df2d7);}(_0x6287,0x18b));var _0x7628=function(_0x52ca59,_0x279dda){_0x52ca59=_0x52ca59-0x0;var _0x1ab7e5=_0x6287[_0x52ca59];return _0x1ab7e5;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x7628('0x0'))[_0x7628('0x1')];var jayson=require(_0x7628('0x2'));var _=require(_0x7628('0x3'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x7628('0x4'))['db'];var authService=require(_0x7628('0x5'));var utils=require(_0x7628('0x6'));var client=jayson[_0x7628('0x7')][_0x7628('0x8')]({'port':0x232b});function localAuthenticate(_0x4c18e9,_0x5fe6fb,_0x4a8a03,_0x188209){var _0x3e37d5,_0x1f3210;return db['Setting'][_0x7628('0x9')]({'where':{'id':0x1},'attributes':[_0x7628('0xa'),_0x7628('0xb')],'raw':!![]})[_0x7628('0xc')](function(_0xfce202){_0x3e37d5=_0xfce202;return _0x4c18e9[_0x7628('0x9')]({'attributes':['id',_0x7628('0xd'),_0x7628('0xe'),'salt',_0x7628('0xf'),_0x7628('0x10'),_0x7628('0x11'),_0x7628('0x12'),'loginAttempts'],'where':{'name':_0x5fe6fb,'role':{'$or':['admin','user',_0x7628('0x13')]}}});})[_0x7628('0xc')](function(_0x6cbccb){if(!_0x6cbccb||_0x6cbccb&&_0x6cbccb[_0x7628('0xd')]!==_0x5fe6fb){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1f3210=_0x6cbccb;return _0x1f3210;}})[_0x7628('0xc')](function(){_0x1f3210[_0x7628('0x14')](_0x4a8a03,function(_0x40d380,_0x500eee){var _0x2fca1e=_0x1f3210[_0x7628('0x15')]+0x1;if(_0x40d380){return _0x188209(_0x40d380);}else if(!_0x500eee){if(_0x1f3210[_0x7628('0x10')]){return _0x188209(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3e37d5[_0x7628('0xa')]>0x0){if(_0x1f3210[_0x7628('0x11')]){if(_0x3e37d5['blockDuration']>0x0){if(moment(_0x1f3210[_0x7628('0x12')])[_0x7628('0x16')](_0x3e37d5['blockDuration'],'minutes')>moment()){return _0x188209(null,![],{'message':_0x7628('0x17')});}else{return utils[_0x7628('0x18')](_0x1f3210,_0x2fca1e,![],null)['then'](function(){return _0x188209(null,![],{'message':_0x7628('0x17')});});}}else{return _0x188209(null,![],{'message':_0x7628('0x17')});}}else{if(_0x2fca1e>=_0x3e37d5['allowedLoginAttempts']){return utils[_0x7628('0x18')](_0x1f3210,0x0,!![],moment())[_0x7628('0xc')](function(){return _0x188209(null,![],{'message':_0x7628('0x17')});});}else{return utils[_0x7628('0x18')](_0x1f3210,_0x2fca1e,![],null)[_0x7628('0xc')](function(){return _0x188209(null,![],{'message':_0x7628('0x17')});});}}}else{return _0x188209(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1f3210[_0x7628('0x10')]){return _0x188209(null,![],{'message':_0x7628('0x17')});}else if(_0x3e37d5['allowedLoginAttempts']>0x0){if(_0x1f3210['blocked']){if(_0x3e37d5['blockDuration']>0x0){if(moment(_0x1f3210[_0x7628('0x12')])[_0x7628('0x16')](_0x3e37d5[_0x7628('0xb')],_0x7628('0x19'))>moment()){return _0x188209(null,![],{'message':_0x7628('0x17')});}else{return utils[_0x7628('0x18')](_0x1f3210,0x0,![],null)[_0x7628('0xc')](function(){return utils[_0x7628('0x1a')](_0x1f3210);})[_0x7628('0xc')](function(){return _0x188209(null,_0x1f3210);});}}else{return _0x188209(null,![],{'message':_0x7628('0x17')});}}else{return utils[_0x7628('0x18')](_0x1f3210,0x0,![],null)['then'](function(){return utils[_0x7628('0x1a')](_0x1f3210);})['then'](function(){return _0x188209(null,_0x1f3210);})['catch'](function(_0x32ee64){return _0x188209(null,![],_0x32ee64);});}}else{if(_0x1f3210[_0x7628('0x11')]){return _0x188209(null,![],{'message':_0x7628('0x17')});}else{return utils[_0x7628('0x1a')](_0x1f3210)[_0x7628('0xc')](function(){return _0x188209(null,_0x1f3210);});}}}});})[_0x7628('0x1b')](function(_0x9bc89f){return _0x188209(null,![],_0x9bc89f);});}function sendServiceMail(_0x240874){return db['MailAccount'][_0x7628('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x7628('0xd'),'email'],'include':[{'model':db[_0x7628('0x1d')],'as':'Smtp','include':[{'model':db[_0x7628('0x1e')],'as':_0x7628('0x1e')}]}]})['then'](function(_0x472d14){if(!_0x472d14){throw new Error(_0x7628('0x1f'));}var _0x48980c=_0x472d14[_0x7628('0x20')]();var _0x497a0c={'account':_0x48980c,'message':_[_0x7628('0x21')]({'from':util[_0x7628('0x22')](_0x7628('0x23'),_0x472d14['name'],_0x472d14['email']||_0x472d14['Smtp'][_0x7628('0x24')])},_0x240874)};return client[_0x7628('0x25')](_0x7628('0x26'),_0x497a0c);})['then'](function(_0x4c7944){if(_0x4c7944[_0x7628('0x27')]){throw new Error(util[_0x7628('0x22')](_0x7628('0x28'),_0x4c7944['error'][_0x7628('0x29')]||JSON['stringify'](_0x4c7944['error'])));}return!![];});}function handleError(_0x289d40,_0x445b0b,_0x1c13b4){return _0x289d40[_0x7628('0x2a')](_0x445b0b||0x1f4)[_0x7628('0x2b')]({'message':_0x1c13b4?_0x1c13b4['message']||_0x1c13b4:''});}exports[_0x7628('0x2c')]=function(_0x3c1469,_0x520d4a,_0xb5dfa1){passport[_0x7628('0x14')](_0x7628('0x2d'),function(_0x315821,_0x22213,_0x3bf3d8){var _0x18e1c4=_0x315821||_0x3bf3d8;if(_0x18e1c4){return handleError(_0x520d4a,0x191,_0x18e1c4);}if(!_0x22213){return handleError(_0x520d4a,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x33540a={'payload':{'id':_0x22213['id'],'role':_0x22213[_0x7628('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x7628('0x2e')](_0x33540a)[_0x7628('0xc')](function(_0x291982){_0x520d4a['json']({'id':_0x22213['id'],'token':_0x291982,'statusCall':'','isAlreadyLogged':_0x22213[_0x7628('0x2f')]});});}})(_0x3c1469,_0x520d4a,_0xb5dfa1);};exports[_0x7628('0x30')]=function(_0x3b60bd,_0x97f650){if(!_0x3b60bd[_0x7628('0x31')][_0x7628('0x32')]){return handleError(_0x97f650,0x1f4,{'message':_0x7628('0x33')});}var _0x8ec66b=rs[_0x7628('0x34')]();_0x3b60bd['body']['email']=_0x3b60bd[_0x7628('0x31')][_0x7628('0x32')][_0x7628('0x35')]()[_0x7628('0x36')]();var _0x39a9bf;return db[_0x7628('0x37')][_0x7628('0x9')]({'where':{'id':0x1},'attributes':[_0x7628('0xa'),_0x7628('0xb')],'raw':!![]})[_0x7628('0xc')](function(_0x354c10){_0x39a9bf=_0x354c10;return db[_0x7628('0x38')][_0x7628('0x1c')]({'where':{'email':_0x3b60bd['body'][_0x7628('0x32')]}});})['then'](function(_0x1fd78c){if(!_0x1fd78c){throw new Error(_0x7628('0x39'));}if(_0x1fd78c[_0x7628('0x10')]){throw new Error(_0x7628('0x3a'));}if(_0x1fd78c[_0x7628('0x11')]){if(moment(_0x1fd78c[_0x7628('0x12')])[_0x7628('0x16')](_0x39a9bf[_0x7628('0xb')],_0x7628('0x19'))>moment()){throw new Error(_0x7628('0x3b'));}else{_0x1fd78c['blocked']=![];_0x1fd78c[_0x7628('0x12')]=null;}}_0x1fd78c[_0x7628('0x3c')]=_0x8ec66b;_0x1fd78c[_0x7628('0x3d')]=Date[_0x7628('0x3e')]()+0x36ee80;return _0x1fd78c[_0x7628('0x3f')]();})[_0x7628('0xc')](function(){return sendServiceMail({'to':_0x3b60bd[_0x7628('0x31')]['email'],'subject':_0x7628('0x40'),'text':_0x7628('0x41')+_0x7628('0x42')+_0x7628('0x43')+_0x3b60bd[_0x7628('0x44')][_0x7628('0x45')]+'/reset/'+_0x8ec66b+'\x0a\x0a'+_0x7628('0x46')});})[_0x7628('0xc')](function(){_0x97f650[_0x7628('0x2a')](0xc8)[_0x7628('0x2b')]({'message':_0x7628('0x47')});})[_0x7628('0x1b')](function(_0x5ed076){return handleError(_0x97f650,0x1f4,_0x5ed076);});};exports[_0x7628('0x48')]=function(_0x500a8a,_0x2860d9){return db[_0x7628('0x38')][_0x7628('0x1c')]({'where':{'resetPasswordToken':_0x500a8a[_0x7628('0x49')][_0x7628('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x7628('0x3e')]()}}})['then'](function(_0x22fc04){if(!_0x22fc04){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x7628('0x37')][_0x7628('0x9')]({'attributes':['id',_0x7628('0x4b'),'enforcePasswordHistory',_0x7628('0x4c')]})[_0x7628('0xc')](function(_0xd8c8a){if(_0xd8c8a['securePassword'])authService['validatePasswordPattern'](_0x500a8a[_0x7628('0x31')][_0x7628('0xe')]);if(!_0xd8c8a[_0x7628('0x4d')]||!_0x22fc04[_0x7628('0x4e')])return _0x22fc04;authService[_0x7628('0x4f')](_0x500a8a[_0x7628('0x31')][_0x7628('0xe')],_0x22fc04[_0x7628('0x4e')],_0xd8c8a[_0x7628('0x4c')]);return _0x22fc04;})['then'](function(){_0x22fc04['password']=_0x500a8a[_0x7628('0x31')][_0x7628('0xe')];_0x22fc04[_0x7628('0x3c')]=null;_0x22fc04[_0x7628('0x3d')]=null;return _0x22fc04[_0x7628('0x3f')]();});})[_0x7628('0xc')](function(){_0x2860d9['status'](0xc8)[_0x7628('0x2b')]({'message':_0x7628('0x50')});})[_0x7628('0x1b')](function(_0x13d8a2){return handleError(_0x2860d9,0x1f4,_0x13d8a2);});};passport[_0x7628('0x51')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0x7628('0xe')},function(_0x1b5641,_0x2837f4,_0x54d587){return localAuthenticate(db[_0x7628('0x38')],_0x1b5641,_0x2837f4,_0x54d587);})); \ No newline at end of file +var _0x8ea7=['catch','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','validatePasswordHistory','save','Password\x20reset!','util','passport-local','jayson/promise','lodash','randomstring','../../components/auth/service','client','http','Setting','blockDuration','then','findOne','role','disabled','blocked','blockedAt','loginAttempts','admin','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense'];(function(_0x58d331,_0x248f3e){var _0x40fdfc=function(_0x54b980){while(--_0x54b980){_0x58d331['push'](_0x58d331['shift']());}};_0x40fdfc(++_0x248f3e);}(_0x8ea7,0x82));var _0x78ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea7[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x78ea('0x0'));var passport=require('passport');var LocalStrategy=require(_0x78ea('0x1'))['Strategy'];var jayson=require(_0x78ea('0x2'));var _=require(_0x78ea('0x3'));var rs=require(_0x78ea('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x78ea('0x5'));var utils=require('../../config/utils');var client=jayson[_0x78ea('0x6')][_0x78ea('0x7')]({'port':0x232b});function localAuthenticate(_0x2e05df,_0x193f85,_0x5bdf0e,_0x55aaf9){var _0xb75bcd,_0x5b9217;return db[_0x78ea('0x8')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x78ea('0x9')],'raw':!![]})[_0x78ea('0xa')](function(_0x3913c6){_0xb75bcd=_0x3913c6;return _0x2e05df[_0x78ea('0xb')]({'attributes':['id','name','password','salt',_0x78ea('0xc'),_0x78ea('0xd'),_0x78ea('0xe'),_0x78ea('0xf'),_0x78ea('0x10')],'where':{'name':_0x193f85,'role':{'$or':[_0x78ea('0x11'),_0x78ea('0x12'),'agent']}}});})[_0x78ea('0xa')](function(_0x145a9e){if(!_0x145a9e||_0x145a9e&&_0x145a9e[_0x78ea('0x13')]!==_0x193f85){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5b9217=_0x145a9e;return _0x5b9217;}})[_0x78ea('0xa')](function(){_0x5b9217['authenticate'](_0x5bdf0e,function(_0xf7145b,_0x32fad6){var _0x260b78=_0x5b9217[_0x78ea('0x10')]+0x1;if(_0xf7145b){return _0x55aaf9(_0xf7145b);}else if(!_0x32fad6){if(_0x5b9217[_0x78ea('0xd')]){return _0x55aaf9(null,![],{'message':_0x78ea('0x14')});}else if(_0xb75bcd[_0x78ea('0x15')]>0x0){if(_0x5b9217[_0x78ea('0xe')]){if(_0xb75bcd[_0x78ea('0x9')]>0x0){if(moment(_0x5b9217[_0x78ea('0xf')])[_0x78ea('0x16')](_0xb75bcd[_0x78ea('0x9')],_0x78ea('0x17'))>moment()){return _0x55aaf9(null,![],{'message':_0x78ea('0x14')});}else{return utils[_0x78ea('0x18')](_0x5b9217,_0x260b78,![],null)[_0x78ea('0xa')](function(){return _0x55aaf9(null,![],{'message':_0x78ea('0x14')});});}}else{return _0x55aaf9(null,![],{'message':_0x78ea('0x14')});}}else{if(_0x260b78>=_0xb75bcd[_0x78ea('0x15')]){return utils['clearBlockUser'](_0x5b9217,0x0,!![],moment())[_0x78ea('0xa')](function(){return _0x55aaf9(null,![],{'message':_0x78ea('0x14')});});}else{return utils['clearBlockUser'](_0x5b9217,_0x260b78,![],null)[_0x78ea('0xa')](function(){return _0x55aaf9(null,![],{'message':_0x78ea('0x14')});});}}}else{return _0x55aaf9(null,![],{'message':_0x78ea('0x14')});}}else{if(_0x5b9217[_0x78ea('0xd')]){return _0x55aaf9(null,![],{'message':_0x78ea('0x14')});}else if(_0xb75bcd[_0x78ea('0x15')]>0x0){if(_0x5b9217[_0x78ea('0xe')]){if(_0xb75bcd[_0x78ea('0x9')]>0x0){if(moment(_0x5b9217[_0x78ea('0xf')])[_0x78ea('0x16')](_0xb75bcd[_0x78ea('0x9')],_0x78ea('0x17'))>moment()){return _0x55aaf9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x78ea('0x18')](_0x5b9217,0x0,![],null)[_0x78ea('0xa')](function(){return utils['getLicense'](_0x5b9217);})[_0x78ea('0xa')](function(){return _0x55aaf9(null,_0x5b9217);});}}else{return _0x55aaf9(null,![],{'message':_0x78ea('0x14')});}}else{return utils[_0x78ea('0x18')](_0x5b9217,0x0,![],null)[_0x78ea('0xa')](function(){return utils[_0x78ea('0x19')](_0x5b9217);})[_0x78ea('0xa')](function(){return _0x55aaf9(null,_0x5b9217);})[_0x78ea('0x1a')](function(_0x24ca09){return _0x55aaf9(null,![],_0x24ca09);});}}else{if(_0x5b9217['blocked']){return _0x55aaf9(null,![],{'message':_0x78ea('0x14')});}else{return utils['getLicense'](_0x5b9217)[_0x78ea('0xa')](function(){return _0x55aaf9(null,_0x5b9217);});}}}});})[_0x78ea('0x1a')](function(_0x1d4e8a){return _0x55aaf9(null,![],_0x1d4e8a);});}function sendServiceMail(_0x37c0b0){return db['MailAccount'][_0x78ea('0x1b')]({'where':{'service':!![]},'attributes':['id',_0x78ea('0x13'),_0x78ea('0x1c')],'include':[{'model':db[_0x78ea('0x1d')],'as':'Smtp','include':[{'model':db[_0x78ea('0x1e')],'as':_0x78ea('0x1e')}]}]})[_0x78ea('0xa')](function(_0x1e6724){if(!_0x1e6724){throw new Error(_0x78ea('0x1f'));}var _0x459107=_0x1e6724['getSmtpOptions']();var _0x6c01e7={'account':_0x459107,'message':_[_0x78ea('0x20')]({'from':util[_0x78ea('0x21')]('\x22%s\x22\x20<%s>',_0x1e6724[_0x78ea('0x13')],_0x1e6724[_0x78ea('0x1c')]||_0x1e6724[_0x78ea('0x22')][_0x78ea('0x12')])},_0x37c0b0)};return client[_0x78ea('0x23')](_0x78ea('0x24'),_0x6c01e7);})[_0x78ea('0xa')](function(_0x1c02f9){if(_0x1c02f9[_0x78ea('0x25')]){throw new Error(util['format'](_0x78ea('0x26'),_0x1c02f9['error'][_0x78ea('0x27')]||JSON[_0x78ea('0x28')](_0x1c02f9[_0x78ea('0x25')])));}return!![];});}function handleError(_0x1548a0,_0xc63f1a,_0x1504ab){return _0x1548a0[_0x78ea('0x29')](_0xc63f1a||0x1f4)[_0x78ea('0x2a')]({'message':_0x1504ab?_0x1504ab[_0x78ea('0x27')]||_0x1504ab:''});}exports[_0x78ea('0x2b')]=function(_0x4dff44,_0x702b15,_0x247c23){passport[_0x78ea('0x2c')](_0x78ea('0x2d'),function(_0x5548f8,_0xe2c62e,_0x3c5b77){var _0x115556=_0x5548f8||_0x3c5b77;if(_0x115556){return handleError(_0x702b15,0x191,_0x115556);}if(!_0xe2c62e){return handleError(_0x702b15,0x194,{'message':_0x78ea('0x2e')});}else{var _0x550907={'payload':{'id':_0xe2c62e['id'],'role':_0xe2c62e['role']},'options':{'expiresIn':0x15180}};return authService[_0x78ea('0x2f')](_0x550907)[_0x78ea('0xa')](function(_0x2652ed){_0x702b15[_0x78ea('0x30')]({'id':_0xe2c62e['id'],'token':_0x2652ed,'statusCall':'','isAlreadyLogged':_0xe2c62e[_0x78ea('0x31')]});});}})(_0x4dff44,_0x702b15,_0x247c23);};exports['forgot']=function(_0x2a395c,_0x2eb159){if(!_0x2a395c[_0x78ea('0x32')][_0x78ea('0x1c')]){return handleError(_0x2eb159,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4f1fb5=rs['generate']();_0x2a395c[_0x78ea('0x32')][_0x78ea('0x1c')]=_0x2a395c[_0x78ea('0x32')]['email'][_0x78ea('0x33')]()[_0x78ea('0x34')]();var _0x37aa6c;return db['Setting'][_0x78ea('0xb')]({'where':{'id':0x1},'attributes':[_0x78ea('0x15'),_0x78ea('0x9')],'raw':!![]})[_0x78ea('0xa')](function(_0x472e41){_0x37aa6c=_0x472e41;return db[_0x78ea('0x35')][_0x78ea('0x1b')]({'where':{'email':_0x2a395c[_0x78ea('0x32')][_0x78ea('0x1c')]}});})[_0x78ea('0xa')](function(_0x334780){if(!_0x334780){throw new Error(_0x78ea('0x36'));}if(_0x334780[_0x78ea('0xd')]){throw new Error(_0x78ea('0x37'));}if(_0x334780[_0x78ea('0xe')]){if(moment(_0x334780[_0x78ea('0xf')])[_0x78ea('0x16')](_0x37aa6c['blockDuration'],'minutes')>moment()){throw new Error(_0x78ea('0x38'));}else{_0x334780['blocked']=![];_0x334780[_0x78ea('0xf')]=null;}}_0x334780[_0x78ea('0x39')]=_0x4f1fb5;_0x334780[_0x78ea('0x3a')]=Date['now']()+0x36ee80;return _0x334780['save']();})[_0x78ea('0xa')](function(){return sendServiceMail({'to':_0x2a395c[_0x78ea('0x32')]['email'],'subject':_0x78ea('0x3b'),'text':_0x78ea('0x3c')+_0x78ea('0x3d')+_0x78ea('0x3e')+_0x2a395c['headers'][_0x78ea('0x3f')]+_0x78ea('0x40')+_0x4f1fb5+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x78ea('0xa')](function(){_0x2eb159[_0x78ea('0x29')](0xc8)[_0x78ea('0x2a')]({'message':'Reset\x20Email\x20sent!'});})[_0x78ea('0x1a')](function(_0x4f3c3a){return handleError(_0x2eb159,0x1f4,_0x4f3c3a);});};exports[_0x78ea('0x41')]=function(_0x352f9d,_0x16a522){return db['User']['find']({'where':{'resetPasswordToken':_0x352f9d[_0x78ea('0x42')][_0x78ea('0x43')],'resetPasswordExpires':{'$gt':Date[_0x78ea('0x44')]()}}})[_0x78ea('0xa')](function(_0x3fd549){if(!_0x3fd549){throw new Error(_0x78ea('0x45'));}return db[_0x78ea('0x8')]['findOne']({'attributes':['id',_0x78ea('0x46'),_0x78ea('0x47'),_0x78ea('0x48')]})['then'](function(_0x3194a4){if(_0x3194a4[_0x78ea('0x46')])authService[_0x78ea('0x49')](_0x352f9d['body'][_0x78ea('0x4a')]);if(!_0x3194a4[_0x78ea('0x47')]||!_0x3fd549['previousPasswords'])return _0x3fd549;authService[_0x78ea('0x4b')](_0x352f9d[_0x78ea('0x32')][_0x78ea('0x4a')],_0x3fd549['previousPasswords'],_0x3194a4[_0x78ea('0x48')]);return _0x3fd549;})[_0x78ea('0xa')](function(){_0x3fd549[_0x78ea('0x4a')]=_0x352f9d['body'][_0x78ea('0x4a')];_0x3fd549[_0x78ea('0x39')]=null;_0x3fd549[_0x78ea('0x3a')]=null;return _0x3fd549[_0x78ea('0x4c')]();});})['then'](function(){_0x16a522[_0x78ea('0x29')](0xc8)[_0x78ea('0x2a')]({'message':_0x78ea('0x4d')});})['catch'](function(_0x13a57d){return handleError(_0x16a522,0x1f4,_0x13a57d);});};passport['use'](_0x78ea('0x2d'),new LocalStrategy({'usernameField':_0x78ea('0x13'),'passwordField':_0x78ea('0x4a')},function(_0x3d44dd,_0x2363aa,_0x3a95ed){return localAuthenticate(db[_0x78ea('0x35')],_0x3d44dd,_0x2363aa,_0x3a95ed);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index bd48f38..b09a883 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 _0x657b=['login','/forgot','forgot','/reset/:token','reset','exports','express','./authLocal.controller','post'];(function(_0x47b9ca,_0x445ede){var _0x14179c=function(_0x353f61){while(--_0x353f61){_0x47b9ca['push'](_0x47b9ca['shift']());}};_0x14179c(++_0x445ede);}(_0x657b,0xf9));var _0xb657=function(_0x1f9b24,_0x43ec50){_0x1f9b24=_0x1f9b24-0x0;var _0x21a6e6=_0x657b[_0x1f9b24];return _0x21a6e6;};'use strict';var express=require(_0xb657('0x0'));var router=express['Router']();var controller=require(_0xb657('0x1'));router[_0xb657('0x2')]('/',controller[_0xb657('0x3')]);router[_0xb657('0x2')](_0xb657('0x4'),controller[_0xb657('0x5')]);router[_0xb657('0x2')](_0xb657('0x6'),controller[_0xb657('0x7')]);module[_0xb657('0x8')]=router; \ No newline at end of file +var _0xca1c=['reset','express','Router','./authLocal.controller','post','login','/forgot','/reset/:token'];(function(_0x3c5ba5,_0x43a289){var _0x2e5cbf=function(_0x2504bc){while(--_0x2504bc){_0x3c5ba5['push'](_0x3c5ba5['shift']());}};_0x2e5cbf(++_0x43a289);}(_0xca1c,0xb9));var _0xcca1=function(_0x436c01,_0x5629da){_0x436c01=_0x436c01-0x0;var _0x3d0a70=_0xca1c[_0x436c01];return _0x3d0a70;};'use strict';var express=require(_0xcca1('0x0'));var router=express[_0xcca1('0x1')]();var controller=require(_0xcca1('0x2'));router[_0xcca1('0x3')]('/',controller[_0xcca1('0x4')]);router['post'](_0xcca1('0x5'),controller['forgot']);router[_0xcca1('0x3')](_0xcca1('0x6'),controller[_0xcca1('0x7')]);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 de4add4..ca32d2e 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 _0x00e7=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x00e7,0x198));var _0x700e=function(_0x20aae1,_0x51efd4){_0x20aae1=_0x20aae1-0x0;var _0x510601=_0x00e7[_0x20aae1];return _0x510601;};'use strict';var Sequelize=require('sequelize');module[_0x700e('0x0')]={'name':{'type':Sequelize[_0x700e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x700e('0x1')]},'description':{'type':Sequelize[_0x700e('0x1')]},'status':{'type':Sequelize[_0x700e('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x700e('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x5c32=['sequelize','STRING','BOOLEAN'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5c32,0x108));var _0x25c3=function(_0x466e15,_0x41cd26){_0x466e15=_0x466e15-0x0;var _0x5867d1=_0x5c32[_0x466e15];return _0x5867d1;};'use strict';var Sequelize=require(_0x25c3('0x0'));module['exports']={'name':{'type':Sequelize[_0x25c3('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x25c3('0x1')]},'status':{'type':Sequelize[_0x25c3('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 166fb30..ebc2ee3 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 _0x7c81=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../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','Automation','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','Condition','addConditions','ids','omit','findOne','filter','getConditions','addActions','getActions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7c81,0xa6));var _0x17c8=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0x7c81[_0x888385];return _0x22d5c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x17c8('0x0'));var zipdir=require(_0x17c8('0x1'));var jsonpatch=require(_0x17c8('0x2'));var rp=require('request-promise');var moment=require(_0x17c8('0x3'));var BPromise=require(_0x17c8('0x4'));var Mustache=require(_0x17c8('0x5'));var util=require('util');var path=require(_0x17c8('0x6'));var sox=require(_0x17c8('0x7'));var csv=require('to-csv');var ejs=require(_0x17c8('0x8'));var fs=require('fs');var fs_extra=require(_0x17c8('0x9'));var _=require(_0x17c8('0xa'));var squel=require(_0x17c8('0xb'));var crypto=require(_0x17c8('0xc'));var jsforce=require(_0x17c8('0xd'));var deskjs=require(_0x17c8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x17c8('0xf'));var Papa=require(_0x17c8('0x10'));var Redis=require(_0x17c8('0x11'));var authService=require(_0x17c8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x17c8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17c8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x17c8('0x15'));var licenseUtil=require(_0x17c8('0x16'));var db=require(_0x17c8('0x17'))['db'];function respondWithStatusCode(_0x4f87fa,_0x4e16c){_0x4e16c=_0x4e16c||0xcc;return function(_0x21a8ee){if(_0x21a8ee){return _0x4f87fa[_0x17c8('0x18')](_0x4e16c);}return _0x4f87fa[_0x17c8('0x19')](_0x4e16c)[_0x17c8('0x1a')]();};}function respondWithResult(_0x2bbf82,_0x38c38d){_0x38c38d=_0x38c38d||0xc8;return function(_0x5a4bd5){if(_0x5a4bd5){return _0x2bbf82[_0x17c8('0x19')](_0x38c38d)[_0x17c8('0x1b')](_0x5a4bd5);}};}function respondWithFilteredResult(_0x58b9ef,_0x39b618){return function(_0x1b9cc2){if(_0x1b9cc2){var _0x229a98=typeof _0x39b618['offset']===_0x17c8('0x1c')&&typeof _0x39b618[_0x17c8('0x1d')]===_0x17c8('0x1c');var _0x392f98=_0x1b9cc2[_0x17c8('0x1e')];var _0x4f3283=_0x229a98?0x0:_0x39b618[_0x17c8('0x1f')];var _0x45d73b=_0x229a98?_0x1b9cc2[_0x17c8('0x1e')]:_0x39b618['offset']+_0x39b618[_0x17c8('0x1d')];var _0x72625d;if(_0x45d73b>=_0x392f98){_0x45d73b=_0x392f98;_0x72625d=0xc8;}else{_0x72625d=0xce;}_0x58b9ef[_0x17c8('0x19')](_0x72625d);return _0x58b9ef[_0x17c8('0x20')](_0x17c8('0x21'),_0x4f3283+'-'+_0x45d73b+'/'+_0x392f98)['json'](_0x1b9cc2);}return null;};}function patchUpdates(_0x4df3bb){return function(_0x5ca128){try{jsonpatch[_0x17c8('0x22')](_0x5ca128,_0x4df3bb,!![]);}catch(_0x456f07){return BPromise[_0x17c8('0x23')](_0x456f07);}return _0x5ca128[_0x17c8('0x24')]();};}function saveUpdates(_0x430dd3,_0x4860ce){return function(_0x2fd4df){if(_0x2fd4df){return _0x2fd4df[_0x17c8('0x25')](_0x430dd3)[_0x17c8('0x26')](function(_0x278224){return _0x278224;});}return null;};}function removeEntity(_0x451737,_0x42243b){return function(_0x32b7ae){if(_0x32b7ae){return _0x32b7ae[_0x17c8('0x27')]()['then'](function(){_0x451737[_0x17c8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30cbc2,_0x4e1e9b){return function(_0x1fae3b){if(!_0x1fae3b){_0x30cbc2[_0x17c8('0x18')](0x194);}return _0x1fae3b;};}function handleError(_0x3d9026,_0x1d89d5){_0x1d89d5=_0x1d89d5||0x1f4;return function(_0x447329){logger[_0x17c8('0x28')](_0x447329[_0x17c8('0x29')]);if(_0x447329[_0x17c8('0x2a')]){delete _0x447329[_0x17c8('0x2a')];}_0x3d9026[_0x17c8('0x19')](_0x1d89d5)[_0x17c8('0x2b')](_0x447329);};}exports[_0x17c8('0x2c')]=function(_0x4a5f16,_0x41d99b){var _0x2c1629={},_0x22f74d={},_0x56795e={'count':0x0,'rows':[]};var _0x48f085=_['map'](db[_0x17c8('0x2d')][_0x17c8('0x2e')],function(_0x14e9cd){return{'name':_0x14e9cd[_0x17c8('0x2f')],'type':_0x14e9cd[_0x17c8('0x30')][_0x17c8('0x31')]};});_0x22f74d[_0x17c8('0x32')]=_[_0x17c8('0x33')](_0x48f085,_0x17c8('0x2a'));_0x22f74d[_0x17c8('0x34')]=_[_0x17c8('0x35')](_0x4a5f16[_0x17c8('0x34')]);_0x22f74d[_0x17c8('0x36')]=_[_0x17c8('0x37')](_0x22f74d['model'],_0x22f74d[_0x17c8('0x34')]);_0x2c1629[_0x17c8('0x38')]=_[_0x17c8('0x37')](_0x22f74d['model'],qs[_0x17c8('0x39')](_0x4a5f16['query'][_0x17c8('0x39')]));_0x2c1629[_0x17c8('0x38')]=_0x2c1629[_0x17c8('0x38')][_0x17c8('0x3a')]?_0x2c1629[_0x17c8('0x38')]:_0x22f74d[_0x17c8('0x32')];if(!_0x4a5f16[_0x17c8('0x34')][_0x17c8('0x3b')](_0x17c8('0x3c'))){_0x2c1629[_0x17c8('0x1d')]=qs[_0x17c8('0x1d')](_0x4a5f16[_0x17c8('0x34')][_0x17c8('0x1d')]);_0x2c1629[_0x17c8('0x1f')]=qs['offset'](_0x4a5f16[_0x17c8('0x34')][_0x17c8('0x1f')]);}_0x2c1629[_0x17c8('0x3d')]=qs['sort'](_0x4a5f16[_0x17c8('0x34')][_0x17c8('0x3e')]);_0x2c1629['where']=qs['filters'](_[_0x17c8('0x3f')](_0x4a5f16['query'],_0x22f74d['filters']),_0x48f085);if(_0x4a5f16[_0x17c8('0x34')]['filter']){_0x2c1629[_0x17c8('0x40')]=_[_0x17c8('0x41')](_0x2c1629['where'],{'$or':_[_0x17c8('0x33')](_0x48f085,function(_0x16c559){if(_0x16c559[_0x17c8('0x30')]!==_0x17c8('0x42')){var _0x5ccbcd={};_0x5ccbcd[_0x16c559[_0x17c8('0x2a')]]={'$like':'%'+_0x4a5f16[_0x17c8('0x34')]['filter']+'%'};return _0x5ccbcd;}})});}_0x2c1629=_[_0x17c8('0x41')]({},_0x2c1629,_0x4a5f16[_0x17c8('0x43')]);var _0x39d795={'where':_0x2c1629[_0x17c8('0x40')]};return db['Automation'][_0x17c8('0x1e')](_0x39d795)[_0x17c8('0x26')](function(_0x54e95a){_0x56795e['count']=_0x54e95a;if(_0x4a5f16[_0x17c8('0x34')][_0x17c8('0x44')]){_0x2c1629[_0x17c8('0x45')]=[{'all':!![]}];}return db[_0x17c8('0x2d')][_0x17c8('0x46')](_0x2c1629);})['then'](function(_0x43f3b8){_0x56795e[_0x17c8('0x47')]=_0x43f3b8;return _0x56795e;})[_0x17c8('0x26')](respondWithFilteredResult(_0x41d99b,_0x2c1629))[_0x17c8('0x48')](handleError(_0x41d99b,null));};exports[_0x17c8('0x49')]=function(_0x1c655c,_0x1f0348){var _0x256de1={'raw':![],'where':{'id':_0x1c655c[_0x17c8('0x4a')]['id']}},_0x4e4de7={};_0x4e4de7[_0x17c8('0x32')]=_[_0x17c8('0x35')](db[_0x17c8('0x2d')][_0x17c8('0x2e')]);_0x4e4de7[_0x17c8('0x34')]=_['keys'](_0x1c655c[_0x17c8('0x34')]);_0x4e4de7['filters']=_['intersection'](_0x4e4de7['model'],_0x4e4de7[_0x17c8('0x34')]);_0x256de1[_0x17c8('0x38')]=_[_0x17c8('0x37')](_0x4e4de7[_0x17c8('0x32')],qs['fields'](_0x1c655c[_0x17c8('0x34')][_0x17c8('0x39')]));_0x256de1[_0x17c8('0x38')]=_0x256de1[_0x17c8('0x38')][_0x17c8('0x3a')]?_0x256de1['attributes']:_0x4e4de7[_0x17c8('0x32')];if(_0x1c655c[_0x17c8('0x34')][_0x17c8('0x44')]){_0x256de1[_0x17c8('0x45')]=[{'all':!![]}];}_0x256de1=_[_0x17c8('0x41')]({},_0x256de1,_0x1c655c[_0x17c8('0x43')]);return db[_0x17c8('0x2d')][_0x17c8('0x4b')](_0x256de1)[_0x17c8('0x26')](handleEntityNotFound(_0x1f0348,null))['then'](respondWithResult(_0x1f0348,null))[_0x17c8('0x48')](handleError(_0x1f0348,null));};exports['create']=function(_0x11cfbc,_0x58121c){return db[_0x17c8('0x2d')]['create'](_0x11cfbc[_0x17c8('0x4c')],{})['then'](respondWithResult(_0x58121c,0xc9))[_0x17c8('0x48')](handleError(_0x58121c,null));};exports[_0x17c8('0x25')]=function(_0x2c09ca,_0x301e44){if(_0x2c09ca['body']['id']){delete _0x2c09ca[_0x17c8('0x4c')]['id'];}return db['Automation'][_0x17c8('0x4b')]({'where':{'id':_0x2c09ca[_0x17c8('0x4a')]['id']}})[_0x17c8('0x26')](handleEntityNotFound(_0x301e44,null))[_0x17c8('0x26')](saveUpdates(_0x2c09ca[_0x17c8('0x4c')],null))[_0x17c8('0x26')](respondWithResult(_0x301e44,null))[_0x17c8('0x48')](handleError(_0x301e44,null));};exports[_0x17c8('0x27')]=function(_0x3faa44,_0x50da9c){return db[_0x17c8('0x2d')]['find']({'where':{'id':_0x3faa44[_0x17c8('0x4a')]['id']}})[_0x17c8('0x26')](handleEntityNotFound(_0x50da9c,null))[_0x17c8('0x26')](removeEntity(_0x50da9c,null))[_0x17c8('0x48')](handleError(_0x50da9c,null));};exports['addConditions']=function(_0x556b3e,_0xf161cc,_0x4b239b){return db[_0x17c8('0x4d')]['find']({'where':{'id':_0x556b3e[_0x17c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0xf161cc,null))[_0x17c8('0x26')](function(_0xd73a06){if(_0xd73a06){return _0xd73a06[_0x17c8('0x4e')](_0x556b3e[_0x17c8('0x4c')][_0x17c8('0x4f')],_[_0x17c8('0x50')](_0x556b3e['body'],[_0x17c8('0x4f'),'id'])||{});}})[_0x17c8('0x26')](respondWithResult(_0xf161cc,null))[_0x17c8('0x48')](handleError(_0xf161cc,null));};exports['getConditions']=function(_0x517e87,_0x4d1217,_0x1d41dd){var _0x19ec05={};var _0x28a1d8={};var _0xb97308;var _0x344448;return db[_0x17c8('0x2d')][_0x17c8('0x51')]({'where':{'id':_0x517e87['params']['id']}})['then'](handleEntityNotFound(_0x4d1217,null))[_0x17c8('0x26')](function(_0x4e1554){if(_0x4e1554){_0xb97308=_0x4e1554;_0x28a1d8[_0x17c8('0x32')]=_[_0x17c8('0x35')](db['Condition']['rawAttributes']);_0x28a1d8[_0x17c8('0x34')]=_['keys'](_0x517e87[_0x17c8('0x34')]);_0x28a1d8[_0x17c8('0x36')]=_[_0x17c8('0x37')](_0x28a1d8[_0x17c8('0x32')],_0x28a1d8[_0x17c8('0x34')]);_0x19ec05[_0x17c8('0x38')]=_[_0x17c8('0x37')](_0x28a1d8[_0x17c8('0x32')],qs[_0x17c8('0x39')](_0x517e87[_0x17c8('0x34')][_0x17c8('0x39')]));_0x19ec05[_0x17c8('0x38')]=_0x19ec05[_0x17c8('0x38')][_0x17c8('0x3a')]?_0x19ec05['attributes']:_0x28a1d8['model'];_0x19ec05[_0x17c8('0x3d')]=qs[_0x17c8('0x3e')](_0x517e87[_0x17c8('0x34')]['sort']);_0x19ec05[_0x17c8('0x40')]=qs['filters'](_['pick'](_0x517e87['query'],_0x28a1d8[_0x17c8('0x36')]));if(_0x517e87[_0x17c8('0x34')][_0x17c8('0x52')]){_0x19ec05[_0x17c8('0x40')]=_[_0x17c8('0x41')](_0x19ec05[_0x17c8('0x40')],{'$or':_[_0x17c8('0x33')](_0x19ec05[_0x17c8('0x38')],function(_0x5d8024){var _0x3204e6={};_0x3204e6[_0x5d8024]={'$like':'%'+_0x517e87[_0x17c8('0x34')][_0x17c8('0x52')]+'%'};return _0x3204e6;})});}_0x19ec05=_[_0x17c8('0x41')]({},_0x19ec05,_0x517e87[_0x17c8('0x43')]);return _0xb97308['getConditions'](_0x19ec05);}})['then'](function(_0x3b5f5c){if(_0x3b5f5c){_0x344448=_0x3b5f5c[_0x17c8('0x3a')];if(!_0x517e87[_0x17c8('0x34')][_0x17c8('0x3b')](_0x17c8('0x3c'))){_0x19ec05[_0x17c8('0x1d')]=qs[_0x17c8('0x1d')](_0x517e87[_0x17c8('0x34')][_0x17c8('0x1d')]);_0x19ec05[_0x17c8('0x1f')]=qs[_0x17c8('0x1f')](_0x517e87['query'][_0x17c8('0x1f')]);}return _0xb97308[_0x17c8('0x53')](_0x19ec05);}})['then'](function(_0x3c7c0a){if(_0x3c7c0a){return _0x3c7c0a?{'count':_0x344448,'rows':_0x3c7c0a}:null;}})[_0x17c8('0x26')](respondWithResult(_0x4d1217,null))['catch'](handleError(_0x4d1217,null));};exports[_0x17c8('0x54')]=function(_0x2008e4,_0x876059,_0x2adc81){return db['Action'][_0x17c8('0x4b')]({'where':{'id':_0x2008e4[_0x17c8('0x4a')]['id']}})[_0x17c8('0x26')](handleEntityNotFound(_0x876059,null))[_0x17c8('0x26')](function(_0x4609b9){if(_0x4609b9){return _0x4609b9[_0x17c8('0x54')](_0x2008e4[_0x17c8('0x4c')][_0x17c8('0x4f')],_[_0x17c8('0x50')](_0x2008e4[_0x17c8('0x4c')],['ids','id'])||{});}})['then'](respondWithResult(_0x876059,null))[_0x17c8('0x48')](handleError(_0x876059,null));};exports['getActions']=function(_0x2f4233,_0x18532c,_0x396b6a){var _0x2d893c={};var _0x1e8cbc={};var _0x3ea04e;var _0x54cbf7;return db[_0x17c8('0x2d')][_0x17c8('0x51')]({'where':{'id':_0x2f4233[_0x17c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x18532c,null))[_0x17c8('0x26')](function(_0x89e5fc){if(_0x89e5fc){_0x3ea04e=_0x89e5fc;_0x1e8cbc[_0x17c8('0x32')]=_['keys'](db['Action'][_0x17c8('0x2e')]);_0x1e8cbc[_0x17c8('0x34')]=_[_0x17c8('0x35')](_0x2f4233[_0x17c8('0x34')]);_0x1e8cbc['filters']=_['intersection'](_0x1e8cbc[_0x17c8('0x32')],_0x1e8cbc['query']);_0x2d893c[_0x17c8('0x38')]=_['intersection'](_0x1e8cbc['model'],qs[_0x17c8('0x39')](_0x2f4233[_0x17c8('0x34')][_0x17c8('0x39')]));_0x2d893c[_0x17c8('0x38')]=_0x2d893c['attributes'][_0x17c8('0x3a')]?_0x2d893c['attributes']:_0x1e8cbc['model'];_0x2d893c[_0x17c8('0x3d')]=qs['sort'](_0x2f4233[_0x17c8('0x34')][_0x17c8('0x3e')]);_0x2d893c[_0x17c8('0x40')]=qs[_0x17c8('0x36')](_[_0x17c8('0x3f')](_0x2f4233[_0x17c8('0x34')],_0x1e8cbc[_0x17c8('0x36')]));if(_0x2f4233[_0x17c8('0x34')]['filter']){_0x2d893c['where']=_[_0x17c8('0x41')](_0x2d893c[_0x17c8('0x40')],{'$or':_[_0x17c8('0x33')](_0x2d893c[_0x17c8('0x38')],function(_0x4baa5b){var _0x26dcf2={};_0x26dcf2[_0x4baa5b]={'$like':'%'+_0x2f4233[_0x17c8('0x34')][_0x17c8('0x52')]+'%'};return _0x26dcf2;})});}_0x2d893c=_[_0x17c8('0x41')]({},_0x2d893c,_0x2f4233[_0x17c8('0x43')]);return _0x3ea04e[_0x17c8('0x55')](_0x2d893c);}})[_0x17c8('0x26')](function(_0x40bbd3){if(_0x40bbd3){_0x54cbf7=_0x40bbd3[_0x17c8('0x3a')];if(!_0x2f4233[_0x17c8('0x34')]['hasOwnProperty'](_0x17c8('0x3c'))){_0x2d893c[_0x17c8('0x1d')]=qs[_0x17c8('0x1d')](_0x2f4233[_0x17c8('0x34')][_0x17c8('0x1d')]);_0x2d893c[_0x17c8('0x1f')]=qs[_0x17c8('0x1f')](_0x2f4233[_0x17c8('0x34')][_0x17c8('0x1f')]);}return _0x3ea04e[_0x17c8('0x55')](_0x2d893c);}})['then'](function(_0x44c35a){if(_0x44c35a){return _0x44c35a?{'count':_0x54cbf7,'rows':_0x44c35a}:null;}})['then'](respondWithResult(_0x18532c,null))['catch'](handleError(_0x18532c,null));}; \ No newline at end of file +var _0xcc46=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','Automation','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3d40a8,_0x423416){var _0x576d1f=function(_0x5326e4){while(--_0x5326e4){_0x3d40a8['push'](_0x3d40a8['shift']());}};_0x576d1f(++_0x423416);}(_0xcc46,0x13f));var _0x6cc4=function(_0x2977bd,_0x516984){_0x2977bd=_0x2977bd-0x0;var _0x458df2=_0xcc46[_0x2977bd];return _0x458df2;};'use strict';var emlformat=require(_0x6cc4('0x0'));var rimraf=require(_0x6cc4('0x1'));var zipdir=require(_0x6cc4('0x2'));var jsonpatch=require(_0x6cc4('0x3'));var rp=require(_0x6cc4('0x4'));var moment=require(_0x6cc4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6cc4('0x6'));var util=require(_0x6cc4('0x7'));var path=require('path');var sox=require(_0x6cc4('0x8'));var csv=require(_0x6cc4('0x9'));var ejs=require(_0x6cc4('0xa'));var fs=require('fs');var fs_extra=require(_0x6cc4('0xb'));var _=require('lodash');var squel=require(_0x6cc4('0xc'));var crypto=require(_0x6cc4('0xd'));var jsforce=require(_0x6cc4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6cc4('0x9'));var querystring=require(_0x6cc4('0xf'));var Papa=require(_0x6cc4('0x10'));var Redis=require('ioredis');var authService=require(_0x6cc4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6cc4('0x12'));var hardwareService=require(_0x6cc4('0x13'));var logger=require('../../config/logger')(_0x6cc4('0x14'));var utils=require('../../config/utils');var config=require(_0x6cc4('0x15'));var licenseUtil=require(_0x6cc4('0x16'));var db=require(_0x6cc4('0x17'))['db'];function respondWithStatusCode(_0x2c68fe,_0x50c2d7){_0x50c2d7=_0x50c2d7||0xcc;return function(_0x44292b){if(_0x44292b){return _0x2c68fe[_0x6cc4('0x18')](_0x50c2d7);}return _0x2c68fe[_0x6cc4('0x19')](_0x50c2d7)[_0x6cc4('0x1a')]();};}function respondWithResult(_0x1624ef,_0x416d0f){_0x416d0f=_0x416d0f||0xc8;return function(_0x5a95ef){if(_0x5a95ef){return _0x1624ef[_0x6cc4('0x19')](_0x416d0f)[_0x6cc4('0x1b')](_0x5a95ef);}};}function respondWithFilteredResult(_0x2ca37d,_0x43f699){return function(_0x1c6881){if(_0x1c6881){var _0x2ad0ce=typeof _0x43f699[_0x6cc4('0x1c')]===_0x6cc4('0x1d')&&typeof _0x43f699[_0x6cc4('0x1e')]===_0x6cc4('0x1d');var _0x5622ea=_0x1c6881['count'];var _0x121867=_0x2ad0ce?0x0:_0x43f699[_0x6cc4('0x1c')];var _0x5c7ba0=_0x2ad0ce?_0x1c6881[_0x6cc4('0x1f')]:_0x43f699[_0x6cc4('0x1c')]+_0x43f699[_0x6cc4('0x1e')];var _0x5400a3;if(_0x5c7ba0>=_0x5622ea){_0x5c7ba0=_0x5622ea;_0x5400a3=0xc8;}else{_0x5400a3=0xce;}_0x2ca37d[_0x6cc4('0x19')](_0x5400a3);return _0x2ca37d[_0x6cc4('0x20')](_0x6cc4('0x21'),_0x121867+'-'+_0x5c7ba0+'/'+_0x5622ea)['json'](_0x1c6881);}return null;};}function patchUpdates(_0x566208){return function(_0x5c6b5e){try{jsonpatch['apply'](_0x5c6b5e,_0x566208,!![]);}catch(_0x4480b1){return BPromise[_0x6cc4('0x22')](_0x4480b1);}return _0x5c6b5e[_0x6cc4('0x23')]();};}function saveUpdates(_0x4a972b,_0x48e914){return function(_0x3a986f){if(_0x3a986f){return _0x3a986f[_0x6cc4('0x24')](_0x4a972b)[_0x6cc4('0x25')](function(_0x339e13){return _0x339e13;});}return null;};}function removeEntity(_0x23579b,_0x116cdc){return function(_0x3349db){if(_0x3349db){return _0x3349db[_0x6cc4('0x26')]()[_0x6cc4('0x25')](function(){_0x23579b[_0x6cc4('0x19')](0xcc)[_0x6cc4('0x1a')]();});}};}function handleEntityNotFound(_0x306898,_0x46e837){return function(_0x377928){if(!_0x377928){_0x306898[_0x6cc4('0x18')](0x194);}return _0x377928;};}function handleError(_0x4add8b,_0xc39d7a){_0xc39d7a=_0xc39d7a||0x1f4;return function(_0x8e8b22){logger['error'](_0x8e8b22[_0x6cc4('0x27')]);if(_0x8e8b22['name']){delete _0x8e8b22[_0x6cc4('0x28')];}_0x4add8b[_0x6cc4('0x19')](_0xc39d7a)[_0x6cc4('0x29')](_0x8e8b22);};}exports[_0x6cc4('0x2a')]=function(_0xce60ab,_0x333d83){var _0x19f968={},_0x5a2982={},_0x26554e={'count':0x0,'rows':[]};var _0x39d54a=_[_0x6cc4('0x2b')](db[_0x6cc4('0x2c')][_0x6cc4('0x2d')],function(_0x530b5c){return{'name':_0x530b5c['fieldName'],'type':_0x530b5c[_0x6cc4('0x2e')][_0x6cc4('0x2f')]};});_0x5a2982[_0x6cc4('0x30')]=_[_0x6cc4('0x2b')](_0x39d54a,'name');_0x5a2982['query']=_[_0x6cc4('0x31')](_0xce60ab[_0x6cc4('0x32')]);_0x5a2982[_0x6cc4('0x33')]=_[_0x6cc4('0x34')](_0x5a2982[_0x6cc4('0x30')],_0x5a2982[_0x6cc4('0x32')]);_0x19f968[_0x6cc4('0x35')]=_[_0x6cc4('0x34')](_0x5a2982[_0x6cc4('0x30')],qs['fields'](_0xce60ab[_0x6cc4('0x32')]['fields']));_0x19f968[_0x6cc4('0x35')]=_0x19f968[_0x6cc4('0x35')][_0x6cc4('0x36')]?_0x19f968[_0x6cc4('0x35')]:_0x5a2982[_0x6cc4('0x30')];if(!_0xce60ab[_0x6cc4('0x32')][_0x6cc4('0x37')](_0x6cc4('0x38'))){_0x19f968[_0x6cc4('0x1e')]=qs['limit'](_0xce60ab[_0x6cc4('0x32')][_0x6cc4('0x1e')]);_0x19f968[_0x6cc4('0x1c')]=qs[_0x6cc4('0x1c')](_0xce60ab[_0x6cc4('0x32')][_0x6cc4('0x1c')]);}_0x19f968[_0x6cc4('0x39')]=qs['sort'](_0xce60ab[_0x6cc4('0x32')][_0x6cc4('0x3a')]);_0x19f968[_0x6cc4('0x3b')]=qs[_0x6cc4('0x33')](_[_0x6cc4('0x3c')](_0xce60ab[_0x6cc4('0x32')],_0x5a2982[_0x6cc4('0x33')]),_0x39d54a);if(_0xce60ab['query'][_0x6cc4('0x3d')]){_0x19f968[_0x6cc4('0x3b')]=_[_0x6cc4('0x3e')](_0x19f968[_0x6cc4('0x3b')],{'$or':_[_0x6cc4('0x2b')](_0x39d54a,function(_0x51d3f0){if(_0x51d3f0[_0x6cc4('0x2e')]!==_0x6cc4('0x3f')){var _0x4ddcf0={};_0x4ddcf0[_0x51d3f0[_0x6cc4('0x28')]]={'$like':'%'+_0xce60ab['query'][_0x6cc4('0x3d')]+'%'};return _0x4ddcf0;}})});}_0x19f968=_[_0x6cc4('0x3e')]({},_0x19f968,_0xce60ab[_0x6cc4('0x40')]);var _0x18b788={'where':_0x19f968['where']};return db[_0x6cc4('0x2c')][_0x6cc4('0x1f')](_0x18b788)[_0x6cc4('0x25')](function(_0x9d94a1){_0x26554e['count']=_0x9d94a1;if(_0xce60ab[_0x6cc4('0x32')][_0x6cc4('0x41')]){_0x19f968[_0x6cc4('0x42')]=[{'all':!![]}];}return db[_0x6cc4('0x2c')][_0x6cc4('0x43')](_0x19f968);})[_0x6cc4('0x25')](function(_0x18618c){_0x26554e[_0x6cc4('0x44')]=_0x18618c;return _0x26554e;})['then'](respondWithFilteredResult(_0x333d83,_0x19f968))[_0x6cc4('0x45')](handleError(_0x333d83,null));};exports[_0x6cc4('0x46')]=function(_0x1d860e,_0x4a72df){var _0xe4c482={'raw':![],'where':{'id':_0x1d860e[_0x6cc4('0x47')]['id']}},_0xb5b5c8={};_0xb5b5c8[_0x6cc4('0x30')]=_[_0x6cc4('0x31')](db[_0x6cc4('0x2c')][_0x6cc4('0x2d')]);_0xb5b5c8[_0x6cc4('0x32')]=_[_0x6cc4('0x31')](_0x1d860e['query']);_0xb5b5c8[_0x6cc4('0x33')]=_['intersection'](_0xb5b5c8[_0x6cc4('0x30')],_0xb5b5c8[_0x6cc4('0x32')]);_0xe4c482[_0x6cc4('0x35')]=_['intersection'](_0xb5b5c8[_0x6cc4('0x30')],qs[_0x6cc4('0x48')](_0x1d860e[_0x6cc4('0x32')][_0x6cc4('0x48')]));_0xe4c482['attributes']=_0xe4c482[_0x6cc4('0x35')][_0x6cc4('0x36')]?_0xe4c482['attributes']:_0xb5b5c8['model'];if(_0x1d860e[_0x6cc4('0x32')][_0x6cc4('0x41')]){_0xe4c482['include']=[{'all':!![]}];}_0xe4c482=_[_0x6cc4('0x3e')]({},_0xe4c482,_0x1d860e['options']);return db[_0x6cc4('0x2c')][_0x6cc4('0x49')](_0xe4c482)['then'](handleEntityNotFound(_0x4a72df,null))['then'](respondWithResult(_0x4a72df,null))[_0x6cc4('0x45')](handleError(_0x4a72df,null));};exports[_0x6cc4('0x4a')]=function(_0x5b71ee,_0x10b9cb){return db[_0x6cc4('0x2c')][_0x6cc4('0x4a')](_0x5b71ee['body'],{})['then'](respondWithResult(_0x10b9cb,0xc9))[_0x6cc4('0x45')](handleError(_0x10b9cb,null));};exports[_0x6cc4('0x24')]=function(_0xe6293d,_0x368dd2){if(_0xe6293d[_0x6cc4('0x4b')]['id']){delete _0xe6293d['body']['id'];}return db[_0x6cc4('0x2c')][_0x6cc4('0x49')]({'where':{'id':_0xe6293d[_0x6cc4('0x47')]['id']}})['then'](handleEntityNotFound(_0x368dd2,null))['then'](saveUpdates(_0xe6293d[_0x6cc4('0x4b')],null))['then'](respondWithResult(_0x368dd2,null))[_0x6cc4('0x45')](handleError(_0x368dd2,null));};exports[_0x6cc4('0x26')]=function(_0x427c78,_0xb083b1){return db['Automation']['find']({'where':{'id':_0x427c78[_0x6cc4('0x47')]['id']}})[_0x6cc4('0x25')](handleEntityNotFound(_0xb083b1,null))['then'](removeEntity(_0xb083b1,null))['catch'](handleError(_0xb083b1,null));};exports[_0x6cc4('0x4c')]=function(_0x1ebeb2,_0x323fc4,_0x40d244){return db[_0x6cc4('0x4d')][_0x6cc4('0x49')]({'where':{'id':_0x1ebeb2[_0x6cc4('0x47')]['id']}})['then'](handleEntityNotFound(_0x323fc4,null))[_0x6cc4('0x25')](function(_0x10220f){if(_0x10220f){return _0x10220f[_0x6cc4('0x4c')](_0x1ebeb2[_0x6cc4('0x4b')][_0x6cc4('0x4e')],_[_0x6cc4('0x4f')](_0x1ebeb2[_0x6cc4('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x323fc4,null))[_0x6cc4('0x45')](handleError(_0x323fc4,null));};exports[_0x6cc4('0x50')]=function(_0x45881b,_0xe3c917,_0x1e0a4a){var _0xdcdff1={};var _0x90e842={};var _0x495d27;var _0x421d57;return db['Automation'][_0x6cc4('0x51')]({'where':{'id':_0x45881b['params']['id']}})[_0x6cc4('0x25')](handleEntityNotFound(_0xe3c917,null))[_0x6cc4('0x25')](function(_0x355f42){if(_0x355f42){_0x495d27=_0x355f42;_0x90e842[_0x6cc4('0x30')]=_[_0x6cc4('0x31')](db[_0x6cc4('0x4d')][_0x6cc4('0x2d')]);_0x90e842[_0x6cc4('0x32')]=_[_0x6cc4('0x31')](_0x45881b[_0x6cc4('0x32')]);_0x90e842[_0x6cc4('0x33')]=_['intersection'](_0x90e842[_0x6cc4('0x30')],_0x90e842[_0x6cc4('0x32')]);_0xdcdff1['attributes']=_[_0x6cc4('0x34')](_0x90e842['model'],qs[_0x6cc4('0x48')](_0x45881b[_0x6cc4('0x32')]['fields']));_0xdcdff1[_0x6cc4('0x35')]=_0xdcdff1[_0x6cc4('0x35')][_0x6cc4('0x36')]?_0xdcdff1[_0x6cc4('0x35')]:_0x90e842[_0x6cc4('0x30')];_0xdcdff1[_0x6cc4('0x39')]=qs[_0x6cc4('0x3a')](_0x45881b[_0x6cc4('0x32')][_0x6cc4('0x3a')]);_0xdcdff1[_0x6cc4('0x3b')]=qs[_0x6cc4('0x33')](_['pick'](_0x45881b[_0x6cc4('0x32')],_0x90e842[_0x6cc4('0x33')]));if(_0x45881b[_0x6cc4('0x32')][_0x6cc4('0x3d')]){_0xdcdff1[_0x6cc4('0x3b')]=_[_0x6cc4('0x3e')](_0xdcdff1[_0x6cc4('0x3b')],{'$or':_[_0x6cc4('0x2b')](_0xdcdff1[_0x6cc4('0x35')],function(_0x2b77cf){var _0xb72574={};_0xb72574[_0x2b77cf]={'$like':'%'+_0x45881b[_0x6cc4('0x32')][_0x6cc4('0x3d')]+'%'};return _0xb72574;})});}_0xdcdff1=_['merge']({},_0xdcdff1,_0x45881b[_0x6cc4('0x40')]);return _0x495d27[_0x6cc4('0x50')](_0xdcdff1);}})[_0x6cc4('0x25')](function(_0x108e6c){if(_0x108e6c){_0x421d57=_0x108e6c['length'];if(!_0x45881b[_0x6cc4('0x32')][_0x6cc4('0x37')](_0x6cc4('0x38'))){_0xdcdff1[_0x6cc4('0x1e')]=qs[_0x6cc4('0x1e')](_0x45881b[_0x6cc4('0x32')][_0x6cc4('0x1e')]);_0xdcdff1[_0x6cc4('0x1c')]=qs[_0x6cc4('0x1c')](_0x45881b[_0x6cc4('0x32')][_0x6cc4('0x1c')]);}return _0x495d27[_0x6cc4('0x50')](_0xdcdff1);}})[_0x6cc4('0x25')](function(_0xd0df38){if(_0xd0df38){return _0xd0df38?{'count':_0x421d57,'rows':_0xd0df38}:null;}})['then'](respondWithResult(_0xe3c917,null))['catch'](handleError(_0xe3c917,null));};exports[_0x6cc4('0x52')]=function(_0x383481,_0x5b2581,_0x28caa4){return db[_0x6cc4('0x53')]['find']({'where':{'id':_0x383481[_0x6cc4('0x47')]['id']}})[_0x6cc4('0x25')](handleEntityNotFound(_0x5b2581,null))['then'](function(_0xb1978b){if(_0xb1978b){return _0xb1978b['addActions'](_0x383481[_0x6cc4('0x4b')]['ids'],_['omit'](_0x383481['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5b2581,null))['catch'](handleError(_0x5b2581,null));};exports[_0x6cc4('0x54')]=function(_0x638d6e,_0x5d0656,_0x14efde){var _0x2f7ead={};var _0x1959b7={};var _0x4324c4;var _0x3bbfb6;return db[_0x6cc4('0x2c')]['findOne']({'where':{'id':_0x638d6e[_0x6cc4('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d0656,null))[_0x6cc4('0x25')](function(_0x3e7b03){if(_0x3e7b03){_0x4324c4=_0x3e7b03;_0x1959b7[_0x6cc4('0x30')]=_[_0x6cc4('0x31')](db['Action'][_0x6cc4('0x2d')]);_0x1959b7[_0x6cc4('0x32')]=_['keys'](_0x638d6e['query']);_0x1959b7['filters']=_[_0x6cc4('0x34')](_0x1959b7['model'],_0x1959b7['query']);_0x2f7ead[_0x6cc4('0x35')]=_[_0x6cc4('0x34')](_0x1959b7[_0x6cc4('0x30')],qs[_0x6cc4('0x48')](_0x638d6e['query'][_0x6cc4('0x48')]));_0x2f7ead[_0x6cc4('0x35')]=_0x2f7ead[_0x6cc4('0x35')][_0x6cc4('0x36')]?_0x2f7ead['attributes']:_0x1959b7[_0x6cc4('0x30')];_0x2f7ead[_0x6cc4('0x39')]=qs[_0x6cc4('0x3a')](_0x638d6e[_0x6cc4('0x32')]['sort']);_0x2f7ead[_0x6cc4('0x3b')]=qs['filters'](_[_0x6cc4('0x3c')](_0x638d6e[_0x6cc4('0x32')],_0x1959b7[_0x6cc4('0x33')]));if(_0x638d6e[_0x6cc4('0x32')][_0x6cc4('0x3d')]){_0x2f7ead[_0x6cc4('0x3b')]=_[_0x6cc4('0x3e')](_0x2f7ead[_0x6cc4('0x3b')],{'$or':_[_0x6cc4('0x2b')](_0x2f7ead[_0x6cc4('0x35')],function(_0x178fe3){var _0x49aae6={};_0x49aae6[_0x178fe3]={'$like':'%'+_0x638d6e[_0x6cc4('0x32')][_0x6cc4('0x3d')]+'%'};return _0x49aae6;})});}_0x2f7ead=_[_0x6cc4('0x3e')]({},_0x2f7ead,_0x638d6e['options']);return _0x4324c4[_0x6cc4('0x54')](_0x2f7ead);}})[_0x6cc4('0x25')](function(_0x4ca51c){if(_0x4ca51c){_0x3bbfb6=_0x4ca51c['length'];if(!_0x638d6e[_0x6cc4('0x32')]['hasOwnProperty']('nolimit')){_0x2f7ead[_0x6cc4('0x1e')]=qs[_0x6cc4('0x1e')](_0x638d6e[_0x6cc4('0x32')][_0x6cc4('0x1e')]);_0x2f7ead['offset']=qs[_0x6cc4('0x1c')](_0x638d6e[_0x6cc4('0x32')]['offset']);}return _0x4324c4[_0x6cc4('0x54')](_0x2f7ead);}})[_0x6cc4('0x25')](function(_0x2a1ec0){if(_0x2a1ec0){return _0x2a1ec0?{'count':_0x3bbfb6,'rows':_0x2a1ec0}:null;}})[_0x6cc4('0x25')](respondWithResult(_0x5d0656,null))[_0x6cc4('0x45')](handleError(_0x5d0656,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2c892d6..2e5a9a9 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 _0xdbbc=['rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment'];(function(_0x51d3b0,_0x8a314b){var _0x60d8fd=function(_0x18ef02){while(--_0x18ef02){_0x51d3b0['push'](_0x51d3b0['shift']());}};_0x60d8fd(++_0x8a314b);}(_0xdbbc,0x1b7));var _0xcdbb=function(_0x2e0998,_0x2e4b2c){_0x2e0998=_0x2e0998-0x0;var _0x7ce4bc=_0xdbbc[_0x2e0998];return _0x7ce4bc;};'use strict';var _=require(_0xcdbb('0x0'));var util=require(_0xcdbb('0x1'));var logger=require(_0xcdbb('0x2'))(_0xcdbb('0x3'));var moment=require(_0xcdbb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcdbb('0x5'));var config=require(_0xcdbb('0x6'));var attributes=require(_0xcdbb('0x7'));module[_0xcdbb('0x8')]=function(_0x2955f9,_0x59e3bd){return _0x2955f9[_0xcdbb('0x9')](_0xcdbb('0xa'),attributes,{'tableName':_0xcdbb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07a0=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','Automation','tools_automations','lodash'];(function(_0x4e9183,_0xee995){var _0x1bdf3e=function(_0x374d4e){while(--_0x374d4e){_0x4e9183['push'](_0x4e9183['shift']());}};_0x1bdf3e(++_0xee995);}(_0x07a0,0xdb));var _0x007a=function(_0x32be82,_0x21b592){_0x32be82=_0x32be82-0x0;var _0x35aa04=_0x07a0[_0x32be82];return _0x35aa04;};'use strict';var _=require(_0x007a('0x0'));var util=require(_0x007a('0x1'));var logger=require(_0x007a('0x2'))(_0x007a('0x3'));var moment=require(_0x007a('0x4'));var BPromise=require(_0x007a('0x5'));var rp=require(_0x007a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x007a('0x7'));var attributes=require('./automation.attributes');module['exports']=function(_0x54e828,_0x852504){return _0x54e828[_0x007a('0x8')](_0x007a('0x9'),attributes,{'tableName':_0x007a('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 cb2655b..eb40f66 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 _0xa3fe=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0xd18d4f,_0x7e0a8){var _0x5e8d05=function(_0x459416){while(--_0x459416){_0xd18d4f['push'](_0xd18d4f['shift']());}};_0x5e8d05(++_0x7e0a8);}(_0xa3fe,0xd8));var _0xea3f=function(_0x489e5a,_0x30e893){_0x489e5a=_0x489e5a-0x0;var _0x4997a3=_0xa3fe[_0x489e5a];return _0x4997a3;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var moment=require(_0xea3f('0x1'));var BPromise=require(_0xea3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea3f('0x3'));var db=require(_0xea3f('0x4'))['db'];var utils=require(_0xea3f('0x5'));var logger=require('../../config/logger')(_0xea3f('0x6'));var config=require('../../config/environment');var jayson=require(_0xea3f('0x7'));var client=jayson[_0xea3f('0x8')][_0xea3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49e494,_0x56abd6,_0x187ce0){return new BPromise(function(_0x35ba50,_0x3c4807){return client['request'](_0x49e494,_0x187ce0)['then'](function(_0x464ad4){logger['info']('Automation,\x20%s,\x20%s',_0x56abd6,_0xea3f('0xa'));logger[_0xea3f('0xb')](_0xea3f('0xc'),_0x56abd6,'request\x20sent',JSON['stringify'](_0x464ad4));if(_0x464ad4['error']){if(_0x464ad4[_0xea3f('0xd')][_0xea3f('0xe')]===0x1f4){logger[_0xea3f('0xd')](_0xea3f('0xf'),_0x56abd6,_0x464ad4['error']['message']);return _0x3c4807(_0x464ad4['error'][_0xea3f('0x10')]);}logger[_0xea3f('0xd')]('Automation,\x20%s,\x20%s',_0x56abd6,_0x464ad4[_0xea3f('0xd')][_0xea3f('0x10')]);return _0x35ba50(_0x464ad4['error'][_0xea3f('0x10')]);}else{logger[_0xea3f('0x11')](_0xea3f('0xf'),_0x56abd6,_0xea3f('0xa'));_0x35ba50(_0x464ad4[_0xea3f('0x12')][_0xea3f('0x10')]);}})[_0xea3f('0x13')](function(_0x2585f1){logger[_0xea3f('0xd')](_0xea3f('0xf'),_0x56abd6,_0x2585f1);_0x3c4807(_0x2585f1);});});} \ No newline at end of file +var _0xda81=['then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x3bf1e0,_0x1580be){var _0x5a9ded=function(_0x229240){while(--_0x229240){_0x3bf1e0['push'](_0x3bf1e0['shift']());}};_0x5a9ded(++_0x1580be);}(_0xda81,0x1c3));var _0x1da8=function(_0x3f009c,_0x25f0bf){_0x3f009c=_0x3f009c-0x0;var _0x5bd481=_0xda81[_0x3f009c];return _0x5bd481;};'use strict';var _=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var moment=require(_0x1da8('0x2'));var BPromise=require('bluebird');var rs=require(_0x1da8('0x3'));var fs=require('fs');var Redis=require(_0x1da8('0x4'));var db=require(_0x1da8('0x5'))['db'];var utils=require(_0x1da8('0x6'));var logger=require('../../config/logger')(_0x1da8('0x7'));var config=require(_0x1da8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1da8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x891482,_0x2c2bb4,_0xea1eb1){return new BPromise(function(_0x1a3278,_0x11dc1e){return client[_0x1da8('0xa')](_0x891482,_0xea1eb1)[_0x1da8('0xb')](function(_0x17a7fc){logger[_0x1da8('0xc')]('Automation,\x20%s,\x20%s',_0x2c2bb4,_0x1da8('0xd'));logger[_0x1da8('0xe')](_0x1da8('0xf'),_0x2c2bb4,_0x1da8('0xd'),JSON[_0x1da8('0x10')](_0x17a7fc));if(_0x17a7fc['error']){if(_0x17a7fc[_0x1da8('0x11')]['code']===0x1f4){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x11dc1e(_0x17a7fc[_0x1da8('0x11')]['message']);}logger[_0x1da8('0x11')]('Automation,\x20%s,\x20%s',_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x1a3278(_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);}else{logger[_0x1da8('0xc')](_0x1da8('0x12'),_0x2c2bb4,'request\x20sent');_0x1a3278(_0x17a7fc[_0x1da8('0x14')][_0x1da8('0x13')]);}})[_0x1da8('0x15')](function(_0x197b09){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x197b09);_0x11dc1e(_0x197b09);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index dbce494..4d52cde 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 _0xb028=['multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','show','get','/:id/conditions','getConditions','post','create','addActions','/:id','update','delete','destroy','exports'];(function(_0x3f3ae9,_0x46b55c){var _0x2700d4=function(_0x227480){while(--_0x227480){_0x3f3ae9['push'](_0x3f3ae9['shift']());}};_0x2700d4(++_0x46b55c);}(_0xb028,0x72));var _0x8b02=function(_0x3af1ee,_0x2c54b1){_0x3af1ee=_0x3af1ee-0x0;var _0x49cbcf=_0xb028[_0x3af1ee];return _0x49cbcf;};'use strict';var multer=require(_0x8b02('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8b02('0x1'));var express=require('express');var router=express[_0x8b02('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8b02('0x3'));var interaction=require(_0x8b02('0x4'));var config=require('../../config/environment');var controller=require(_0x8b02('0x5'));router['get']('/',auth[_0x8b02('0x6')](),controller['index']);router['get']('/:id',auth[_0x8b02('0x6')](),controller[_0x8b02('0x7')]);router[_0x8b02('0x8')](_0x8b02('0x9'),auth[_0x8b02('0x6')](),controller[_0x8b02('0xa')]);router[_0x8b02('0x8')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x8b02('0xb')]('/',auth[_0x8b02('0x6')](),controller[_0x8b02('0xc')]);router[_0x8b02('0xb')](_0x8b02('0x9'),auth['isAuthenticated'](),controller['addConditions']);router[_0x8b02('0xb')]('/:id/actions',auth['isAuthenticated'](),controller[_0x8b02('0xd')]);router['put'](_0x8b02('0xe'),auth[_0x8b02('0x6')](),controller[_0x8b02('0xf')]);router[_0x8b02('0x10')](_0x8b02('0xe'),auth[_0x8b02('0x6')](),controller[_0x8b02('0x11')]);module[_0x8b02('0x12')]=router; \ No newline at end of file +var _0x8eac=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','create','addConditions','post','addActions','put','update','delete','destroy','exports','multer','path'];(function(_0x2ef8f1,_0x1280a3){var _0x17498d=function(_0xd20876){while(--_0xd20876){_0x2ef8f1['push'](_0x2ef8f1['shift']());}};_0x17498d(++_0x1280a3);}(_0x8eac,0x11c));var _0xc8ea=function(_0x2f66fe,_0x46be8b){_0x2f66fe=_0x2f66fe-0x0;var _0x1a1d22=_0x8eac[_0x2f66fe];return _0x1a1d22;};'use strict';var multer=require(_0xc8ea('0x0'));var util=require('util');var path=require(_0xc8ea('0x1'));var timeout=require(_0xc8ea('0x2'));var express=require(_0xc8ea('0x3'));var router=express[_0xc8ea('0x4')]();var fs_extra=require(_0xc8ea('0x5'));var auth=require(_0xc8ea('0x6'));var interaction=require(_0xc8ea('0x7'));var config=require(_0xc8ea('0x8'));var controller=require(_0xc8ea('0x9'));router[_0xc8ea('0xa')]('/',auth[_0xc8ea('0xb')](),controller['index']);router[_0xc8ea('0xa')](_0xc8ea('0xc'),auth[_0xc8ea('0xb')](),controller[_0xc8ea('0xd')]);router[_0xc8ea('0xa')](_0xc8ea('0xe'),auth[_0xc8ea('0xb')](),controller[_0xc8ea('0xf')]);router[_0xc8ea('0xa')](_0xc8ea('0x10'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0xc8ea('0x11')]);router['post'](_0xc8ea('0xe'),auth['isAuthenticated'](),controller[_0xc8ea('0x12')]);router[_0xc8ea('0x13')](_0xc8ea('0x10'),auth[_0xc8ea('0xb')](),controller[_0xc8ea('0x14')]);router[_0xc8ea('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc8ea('0x16')]);router[_0xc8ea('0x17')](_0xc8ea('0xc'),auth[_0xc8ea('0xb')](),controller[_0xc8ea('0x18')]);module[_0xc8ea('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 9e464fe..f50a799 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 _0xcac2=['DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x5cc685,_0x167b84){var _0x3d20e0=function(_0x3375b2){while(--_0x3375b2){_0x5cc685['push'](_0x5cc685['shift']());}};_0x3d20e0(++_0x167b84);}(_0xcac2,0x8e));var _0x2cac=function(_0x2436ad,_0x23e462){_0x2436ad=_0x2436ad-0x0;var _0x53a54a=_0xcac2[_0x2436ad];return _0x53a54a;};'use strict';var Sequelize=require(_0x2cac('0x0'));module[_0x2cac('0x1')]={'name':{'type':Sequelize[_0x2cac('0x2')],'unique':_0x2cac('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2cac('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x2cac('0x5')},'description':{'type':Sequelize[_0x2cac('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x2cac('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2cac('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2cac('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x2cac('0x6')](0x3)[_0x2cac('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cac('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2cac('0x6')](0x3)[_0x2cac('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cac('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2cac('0x6')](0x5)[_0x2cac('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cac('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x2cac('0x6')](0x3)[_0x2cac('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cac('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2cac('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cac('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2cac('0x8')],'defaultValue':0x3,'comment':_0x2cac('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2cac('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cac('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2cac('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x2cac('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2cac('0x2')],'defaultValue':_0x2cac('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x2cac('0x4')](_0x2cac('0x11'),_0x2cac('0x12'),_0x2cac('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x2cac('0x14')],'defaultValue':0x0,'comment':_0x2cac('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x2cac('0x6')](0x9)[_0x2cac('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x2cac('0x6')](0x9)[_0x2cac('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2cac('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2cac('0x6')](0x9)[_0x2cac('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2cac('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2cac('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2cac('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x2cac('0x6')](0x9)[_0x2cac('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2cac('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2cac('0x6')](0x9)[_0x2cac('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2cac('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2cac('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2cac('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2cac('0x6')](0x5)[_0x2cac('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2cac('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2cac('0x6')](0x9)[_0x2cac('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2cac('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2cac('0x4')](_0x2cac('0x1e'),_0x2cac('0x1f')),'defaultValue':_0x2cac('0x1e')},'dialPrefix':{'type':Sequelize[_0x2cac('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2cac('0x20')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2cac('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2cac('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cac('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2cac('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x2cac('0x6')](0x3)[_0x2cac('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cac('0x23')},'dialDropRetryFrequency':{'type':Sequelize[_0x2cac('0x6')](0x5)[_0x2cac('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cac('0x24')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2cac('0x6')](0x3)[_0x2cac('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cac('0x25')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2cac('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cac('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0x2cac('0x6')](0x3)[_0x2cac('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cac('0x27')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2cac('0x6')](0x5)[_0x2cac('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cac('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2cac('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cac('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2cac('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cac('0x2a')}}; \ No newline at end of file +var _0x57ab=['#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x4e7af4,_0x758572){var _0x2548f1=function(_0xa849c){while(--_0xa849c){_0x4e7af4['push'](_0x4e7af4['shift']());}};_0x2548f1(++_0x758572);}(_0x57ab,0x189));var _0xb57a=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x57ab[_0x3817a9];return _0x443f30;};'use strict';var Sequelize=require('sequelize');module[_0xb57a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb57a('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb57a('0x2')]('ivr'),'allowNull':![],'defaultValue':_0xb57a('0x3')},'description':{'type':Sequelize[_0xb57a('0x4')]},'active':{'type':Sequelize[_0xb57a('0x5')],'defaultValue':0x0,'comment':_0xb57a('0x6')},'limitCalls':{'type':Sequelize[_0xb57a('0x7')](0x4)[_0xb57a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xb57a('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb57a('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xb57a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb57a('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb57a('0x7')](0x3)[_0xb57a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb57a('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb57a('0x7')](0x5)[_0xb57a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb57a('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xb57a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb57a('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb57a('0x7')](0x5)[_0xb57a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb57a('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb57a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xb57a('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb57a('0x7')](0x5)[_0xb57a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb57a('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb57a('0x7')](0x3)[_0xb57a('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb57a('0x10')},'dialTimezone':{'type':Sequelize[_0xb57a('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb57a('0x4')],'defaultValue':_0xb57a('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xb57a('0x2')]('always',_0xb57a('0x12'),'onlyIfOpen'),'defaultValue':_0xb57a('0x13')},'dialAMDActive':{'type':Sequelize[_0xb57a('0x5')],'defaultValue':0x0,'comment':_0xb57a('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xb57a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xb57a('0x7')](0x9)[_0xb57a('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb57a('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb57a('0x7')](0x9)[_0xb57a('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb57a('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb57a('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb57a('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb57a('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb57a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb57a('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb57a('0x7')](0x9)[_0xb57a('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb57a('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb57a('0x7')](0x5)[_0xb57a('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb57a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb57a('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xb57a('0x1c'),_0xb57a('0x1d')),'defaultValue':_0xb57a('0x1c')},'dialPrefix':{'type':Sequelize[_0xb57a('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xb57a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xb57a('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb57a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb57a('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb57a('0x7')](0x5)[_0xb57a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb57a('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xb57a('0x7')](0x3)[_0xb57a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb57a('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb57a('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb57a('0x7')](0x3)[_0xb57a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb57a('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb57a('0x7')](0x5)[_0xb57a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb57a('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xb57a('0x7')](0x3)[_0xb57a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb57a('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb57a('0x7')](0x5)[_0xb57a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb57a('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb57a('0x7')](0x3)[_0xb57a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb57a('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb57a('0x7')](0x5)[_0xb57a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index ac73382..71b41a6 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 _0x4e52=['save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getHoppers','findOne','pick','CmHopper','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.item','ci.OrderBY','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','omit','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject'];(function(_0x2e13af,_0x17950f){var _0x20f109=function(_0x1e3925){while(--_0x1e3925){_0x2e13af['push'](_0x2e13af['shift']());}};_0x20f109(++_0x17950f);}(_0x4e52,0x6e));var _0x24e5=function(_0x2be7dd,_0x219f03){_0x2be7dd=_0x2be7dd-0x0;var _0x48f534=_0x4e52[_0x2be7dd];return _0x48f534;};'use strict';var emlformat=require(_0x24e5('0x0'));var rimraf=require(_0x24e5('0x1'));var zipdir=require(_0x24e5('0x2'));var jsonpatch=require(_0x24e5('0x3'));var rp=require(_0x24e5('0x4'));var moment=require('moment');var BPromise=require(_0x24e5('0x5'));var Mustache=require(_0x24e5('0x6'));var util=require(_0x24e5('0x7'));var path=require(_0x24e5('0x8'));var sox=require('sox');var csv=require(_0x24e5('0x9'));var ejs=require(_0x24e5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24e5('0xb'));var squel=require(_0x24e5('0xc'));var crypto=require(_0x24e5('0xd'));var jsforce=require(_0x24e5('0xe'));var deskjs=require(_0x24e5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x24e5('0x10'));var Papa=require(_0x24e5('0x11'));var Redis=require(_0x24e5('0x12'));var authService=require(_0x24e5('0x13'));var qs=require(_0x24e5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x24e5('0x15'))(_0x24e5('0x16'));var utils=require(_0x24e5('0x17'));var config=require(_0x24e5('0x18'));var licenseUtil=require(_0x24e5('0x19'));var db=require(_0x24e5('0x1a'))['db'];function respondWithStatusCode(_0x42994c,_0xe6ac25){_0xe6ac25=_0xe6ac25||0xcc;return function(_0x5dc4c7){if(_0x5dc4c7){return _0x42994c[_0x24e5('0x1b')](_0xe6ac25);}return _0x42994c[_0x24e5('0x1c')](_0xe6ac25)[_0x24e5('0x1d')]();};}function respondWithResult(_0x5668bd,_0xcdb684){_0xcdb684=_0xcdb684||0xc8;return function(_0x5594de){if(_0x5594de){return _0x5668bd[_0x24e5('0x1c')](_0xcdb684)[_0x24e5('0x1e')](_0x5594de);}};}function respondWithFilteredResult(_0x33f0ee,_0x2c2717){return function(_0x1829de){if(_0x1829de){var _0x4d0a39=typeof _0x2c2717['offset']===_0x24e5('0x1f')&&typeof _0x2c2717['limit']===_0x24e5('0x1f');var _0xf61099=_0x1829de['count'];var _0x42e79f=_0x4d0a39?0x0:_0x2c2717[_0x24e5('0x20')];var _0x232548=_0x4d0a39?_0x1829de[_0x24e5('0x21')]:_0x2c2717[_0x24e5('0x20')]+_0x2c2717[_0x24e5('0x22')];var _0x20e483;if(_0x232548>=_0xf61099){_0x232548=_0xf61099;_0x20e483=0xc8;}else{_0x20e483=0xce;}_0x33f0ee[_0x24e5('0x1c')](_0x20e483);return _0x33f0ee['set'](_0x24e5('0x23'),_0x42e79f+'-'+_0x232548+'/'+_0xf61099)[_0x24e5('0x1e')](_0x1829de);}return null;};}function patchUpdates(_0x461fb1){return function(_0x20fdaa){try{jsonpatch[_0x24e5('0x24')](_0x20fdaa,_0x461fb1,!![]);}catch(_0x3ef7db){return BPromise[_0x24e5('0x25')](_0x3ef7db);}return _0x20fdaa[_0x24e5('0x26')]();};}function saveUpdates(_0x35ee3d,_0x102157){return function(_0x3625f7){if(_0x3625f7){return _0x3625f7[_0x24e5('0x27')](_0x35ee3d)[_0x24e5('0x28')](function(_0xdebfcf){return _0xdebfcf;});}return null;};}function removeEntity(_0x4b45e0,_0x3dbb53){return function(_0x22e3aa){if(_0x22e3aa){return _0x22e3aa['destroy']()[_0x24e5('0x28')](function(){var _0x48703f=_0x22e3aa[_0x24e5('0x29')]({'plain':!![]});var _0x50d72e='IvrCampaigns';return db[_0x24e5('0x2a')][_0x24e5('0x2b')]({'where':{'type':_0x50d72e,'resourceId':_0x48703f['id']}})[_0x24e5('0x28')](function(){return _0x22e3aa;});})[_0x24e5('0x28')](function(){_0x4b45e0['status'](0xcc)[_0x24e5('0x1d')]();});}};}function handleEntityNotFound(_0x3d7e02,_0x55ddfb){return function(_0x18ac44){if(!_0x18ac44){_0x3d7e02['sendStatus'](0x194);}return _0x18ac44;};}function handleError(_0x295639,_0x45ea8e){_0x45ea8e=_0x45ea8e||0x1f4;return function(_0x2a81ff){logger[_0x24e5('0x2c')](_0x2a81ff[_0x24e5('0x2d')]);if(_0x2a81ff[_0x24e5('0x2e')]){delete _0x2a81ff[_0x24e5('0x2e')];}_0x295639[_0x24e5('0x1c')](_0x45ea8e)[_0x24e5('0x2f')](_0x2a81ff);};}exports[_0x24e5('0x30')]=function(_0x33325e,_0x161d91){var _0x428209={},_0x521e5b={},_0x3f4430={'count':0x0,'rows':[]};var _0xd20986=_['map'](db[_0x24e5('0x31')][_0x24e5('0x32')],function(_0x4bd71a){return{'name':_0x4bd71a[_0x24e5('0x33')],'type':_0x4bd71a[_0x24e5('0x34')][_0x24e5('0x35')]};});_0x521e5b[_0x24e5('0x36')]=_[_0x24e5('0x37')](_0xd20986,'name');_0x521e5b[_0x24e5('0x38')]=_[_0x24e5('0x39')](_0x33325e[_0x24e5('0x38')]);_0x521e5b[_0x24e5('0x3a')]=_['intersection'](_0x521e5b[_0x24e5('0x36')],_0x521e5b[_0x24e5('0x38')]);_0x428209['attributes']=_[_0x24e5('0x3b')](_0x521e5b[_0x24e5('0x36')],qs[_0x24e5('0x3c')](_0x33325e[_0x24e5('0x38')][_0x24e5('0x3c')]));_0x428209['attributes']=_0x428209['attributes'][_0x24e5('0x3d')]?_0x428209[_0x24e5('0x3e')]:_0x521e5b['model'];if(!_0x33325e['query'][_0x24e5('0x3f')](_0x24e5('0x40'))){_0x428209[_0x24e5('0x22')]=qs[_0x24e5('0x22')](_0x33325e[_0x24e5('0x38')][_0x24e5('0x22')]);_0x428209[_0x24e5('0x20')]=qs[_0x24e5('0x20')](_0x33325e['query']['offset']);}_0x428209[_0x24e5('0x41')]=qs[_0x24e5('0x42')](_0x33325e['query']['sort']);_0x428209[_0x24e5('0x43')]=qs['filters'](_['pick'](_0x33325e[_0x24e5('0x38')],_0x521e5b['filters']),_0xd20986);if(_0x33325e['query'][_0x24e5('0x44')]){_0x428209['where']=_['merge'](_0x428209[_0x24e5('0x43')],{'$or':_['map'](_0xd20986,function(_0xe07da2){if(_0xe07da2[_0x24e5('0x34')]!==_0x24e5('0x45')){var _0xd40f09={};_0xd40f09[_0xe07da2[_0x24e5('0x2e')]]={'$like':'%'+_0x33325e[_0x24e5('0x38')][_0x24e5('0x44')]+'%'};return _0xd40f09;}})});}_0x428209=_['merge']({},_0x428209,_0x33325e[_0x24e5('0x46')]);var _0x5c2977={'where':_0x428209[_0x24e5('0x43')]};return db[_0x24e5('0x31')]['count'](_0x5c2977)[_0x24e5('0x28')](function(_0x32bbfd){_0x3f4430['count']=_0x32bbfd;if(_0x33325e['query'][_0x24e5('0x47')]){_0x428209[_0x24e5('0x48')]=[{'all':!![]}];}return db['Campaign'][_0x24e5('0x49')](_0x428209);})[_0x24e5('0x28')](function(_0x394e6e){_0x3f4430[_0x24e5('0x4a')]=_0x394e6e;return _0x3f4430;})[_0x24e5('0x28')](respondWithFilteredResult(_0x161d91,_0x428209))[_0x24e5('0x4b')](handleError(_0x161d91,null));};exports['show']=function(_0x53b732,_0x5c0a83){var _0x1b1690={'raw':![],'where':{'id':_0x53b732['params']['id']}},_0x3f6c91={};_0x3f6c91[_0x24e5('0x36')]=_[_0x24e5('0x39')](db[_0x24e5('0x31')][_0x24e5('0x32')]);_0x3f6c91[_0x24e5('0x38')]=_[_0x24e5('0x39')](_0x53b732[_0x24e5('0x38')]);_0x3f6c91[_0x24e5('0x3a')]=_[_0x24e5('0x3b')](_0x3f6c91[_0x24e5('0x36')],_0x3f6c91[_0x24e5('0x38')]);_0x1b1690[_0x24e5('0x3e')]=_[_0x24e5('0x3b')](_0x3f6c91[_0x24e5('0x36')],qs['fields'](_0x53b732[_0x24e5('0x38')]['fields']));_0x1b1690['attributes']=_0x1b1690[_0x24e5('0x3e')]['length']?_0x1b1690['attributes']:_0x3f6c91[_0x24e5('0x36')];if(_0x53b732['query']['includeAll']){_0x1b1690[_0x24e5('0x48')]=[{'all':!![]}];}_0x1b1690=_[_0x24e5('0x4c')]({},_0x1b1690,_0x53b732['options']);return db[_0x24e5('0x31')][_0x24e5('0x4d')](_0x1b1690)[_0x24e5('0x28')](handleEntityNotFound(_0x5c0a83,null))[_0x24e5('0x28')](respondWithResult(_0x5c0a83,null))[_0x24e5('0x4b')](handleError(_0x5c0a83,null));};exports['create']=function(_0x11b0a1,_0x3bd018){return db[_0x24e5('0x31')][_0x24e5('0x4e')](_0x11b0a1[_0x24e5('0x4f')],{})[_0x24e5('0x28')](function(_0x179719){var _0x238c8d=_0x11b0a1[_0x24e5('0x50')][_0x24e5('0x29')]({'plain':!![]});if(!_0x238c8d)throw new Error(_0x24e5('0x51'));if(_0x238c8d[_0x24e5('0x52')]==='user'){var _0x52e3db=_0x179719[_0x24e5('0x29')]({'plain':!![]});var _0x31538c=_0x24e5('0x53');return db[_0x24e5('0x54')][_0x24e5('0x4d')]({'where':{'name':_0x31538c,'userProfileId':_0x238c8d[_0x24e5('0x55')]},'raw':!![]})[_0x24e5('0x28')](function(_0x2a8ae7){if(_0x2a8ae7&&_0x2a8ae7[_0x24e5('0x56')]===0x0){return db[_0x24e5('0x2a')]['create']({'name':_0x52e3db[_0x24e5('0x2e')],'resourceId':_0x52e3db['id'],'type':_0x2a8ae7[_0x24e5('0x2e')],'sectionId':_0x2a8ae7['id']},{})[_0x24e5('0x28')](function(){return _0x179719;});}else{return _0x179719;}})[_0x24e5('0x4b')](function(_0x5c0d48){logger[_0x24e5('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c0d48);throw _0x5c0d48;});}return _0x179719;})['then'](respondWithResult(_0x3bd018,0xc9))[_0x24e5('0x4b')](handleError(_0x3bd018,null));};exports['clone']=function(_0x42ae5d,_0x2be212){var _0x2ac17f={'where':{'id':_0x42ae5d['params']['id']}},_0x3a2528={};_0x3a2528[_0x24e5('0x36')]=_['keys'](db['Campaign'][_0x24e5('0x32')]);_0x2ac17f['attributes']=_[_0x24e5('0x3b')](_0x3a2528['model'],qs[_0x24e5('0x3c')](_0x42ae5d[_0x24e5('0x38')]['fields']));_0x2ac17f['attributes']=_0x2ac17f[_0x24e5('0x3e')][_0x24e5('0x3d')]?_0x2ac17f['attributes']:_0x3a2528[_0x24e5('0x36')];if(_0x42ae5d[_0x24e5('0x38')][_0x24e5('0x47')]){_0x2ac17f[_0x24e5('0x48')]=[{'all':!![]}];}_0x2ac17f=_[_0x24e5('0x4c')]({},_0x2ac17f,_0x42ae5d[_0x24e5('0x46')]);return db['Campaign'][_0x24e5('0x4d')](_0x2ac17f)[_0x24e5('0x28')](handleEntityNotFound(_0x2be212,null))['then'](function(_0x53a801){if(_0x53a801){var _0x588bf7=_0x53a801[_0x24e5('0x29')]({'plain':!![]});_0x588bf7=qs['omit'](_0x588bf7,['id',_0x24e5('0x57'),_0x24e5('0x58')]);_0x42ae5d[_0x24e5('0x4f')]=_['omit'](_0x42ae5d[_0x24e5('0x4f')],['id',_0x24e5('0x57'),'updatedAt']);return db[_0x24e5('0x31')][_0x24e5('0x4e')](_['merge'](_0x588bf7,_0x42ae5d[_0x24e5('0x4f')]),{'include':_0x42ae5d[_0x24e5('0x38')][_0x24e5('0x47')]?[{'all':!![]}]:undefined})[_0x24e5('0x28')](function(_0x19462f){var _0x441b70=_0x42ae5d[_0x24e5('0x50')][_0x24e5('0x29')]({'plain':!![]});if(!_0x441b70)throw new Error(_0x24e5('0x51'));if(_0x441b70[_0x24e5('0x52')]===_0x24e5('0x50')){var _0x10c768=_0x19462f['get']({'plain':!![]});var _0x1efd85=_0x24e5('0x53');return db[_0x24e5('0x54')]['find']({'where':{'name':_0x1efd85,'userProfileId':_0x441b70['userProfileId']},'raw':!![]})[_0x24e5('0x28')](function(_0x4172d9){if(_0x4172d9&&_0x4172d9['autoAssociation']===0x0){return db[_0x24e5('0x2a')][_0x24e5('0x4e')]({'name':_0x10c768[_0x24e5('0x2e')],'resourceId':_0x10c768['id'],'type':_0x4172d9['name'],'sectionId':_0x4172d9['id']},{})[_0x24e5('0x28')](function(){return _0x19462f;});}else{return _0x19462f;}})['catch'](function(_0x37eb19){logger[_0x24e5('0x2c')](_0x24e5('0x59'),_0x37eb19);throw _0x37eb19;});}return _0x19462f;});}})[_0x24e5('0x28')](respondWithResult(_0x2be212,0xc9))[_0x24e5('0x4b')](handleError(_0x2be212,null));};exports[_0x24e5('0x27')]=function(_0x5a4127,_0x33a660){if(_0x5a4127[_0x24e5('0x4f')]['id']){delete _0x5a4127[_0x24e5('0x4f')]['id'];}return db[_0x24e5('0x31')][_0x24e5('0x4d')]({'where':{'id':_0x5a4127[_0x24e5('0x5a')]['id']}})['then'](handleEntityNotFound(_0x33a660,null))[_0x24e5('0x28')](saveUpdates(_0x5a4127[_0x24e5('0x4f')],null))[_0x24e5('0x28')](respondWithResult(_0x33a660,null))[_0x24e5('0x4b')](handleError(_0x33a660,null));};exports['destroy']=function(_0x16e035,_0x4c8211){return db[_0x24e5('0x31')][_0x24e5('0x4d')]({'where':{'id':_0x16e035[_0x24e5('0x5a')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x4c8211,null))[_0x24e5('0x28')](removeEntity(_0x4c8211,null))[_0x24e5('0x4b')](handleError(_0x4c8211,null));};exports[_0x24e5('0x5b')]=function(_0x5ab4da,_0x5acf08,_0x2d6b9d){var _0x35864b={'raw':!![],'where':{}};var _0x1e66ad={};var _0x2f3af8={'count':0x0,'rows':[]};return db[_0x24e5('0x31')][_0x24e5('0x5c')]({'where':{'id':_0x5ab4da['params']['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x5acf08,null))['then'](function(_0x3ff91e){if(_0x3ff91e){_0x1e66ad[_0x24e5('0x36')]=_[_0x24e5('0x39')](db['CmHopper'][_0x24e5('0x32')]);_0x1e66ad['query']=_[_0x24e5('0x39')](_0x5ab4da[_0x24e5('0x38')]);_0x1e66ad['filters']=_['intersection'](_0x1e66ad['model'],_0x1e66ad[_0x24e5('0x38')]);_0x35864b[_0x24e5('0x3e')]=_[_0x24e5('0x3b')](_0x1e66ad[_0x24e5('0x36')],qs[_0x24e5('0x3c')](_0x5ab4da[_0x24e5('0x38')][_0x24e5('0x3c')]));_0x35864b['attributes']=_0x35864b['attributes'][_0x24e5('0x3d')]?_0x35864b[_0x24e5('0x3e')]:_0x1e66ad['model'];if(!_0x5ab4da[_0x24e5('0x38')][_0x24e5('0x3f')](_0x24e5('0x40'))){_0x35864b['limit']=qs['limit'](_0x5ab4da[_0x24e5('0x38')][_0x24e5('0x22')]);_0x35864b[_0x24e5('0x20')]=qs[_0x24e5('0x20')](_0x5ab4da[_0x24e5('0x38')][_0x24e5('0x20')]);}_0x35864b[_0x24e5('0x41')]=qs[_0x24e5('0x42')](_0x5ab4da[_0x24e5('0x38')][_0x24e5('0x42')]);_0x35864b['where']=qs[_0x24e5('0x3a')](_[_0x24e5('0x5d')](_0x5ab4da['query'],_0x1e66ad['filters']));_0x35864b[_0x24e5('0x43')]['CampaignId']=_0x3ff91e['id'];if(_0x5ab4da['query'][_0x24e5('0x44')]){_0x35864b[_0x24e5('0x43')]=_[_0x24e5('0x4c')](_0x35864b[_0x24e5('0x43')],{'$or':_[_0x24e5('0x37')](_0x35864b[_0x24e5('0x3e')],function(_0x4280a6){var _0xc74b9={};_0xc74b9[_0x4280a6]={'$like':'%'+_0x5ab4da['query'][_0x24e5('0x44')]+'%'};return _0xc74b9;})});}_0x35864b=_[_0x24e5('0x4c')]({},_0x35864b,_0x5ab4da['options']);return db[_0x24e5('0x5e')][_0x24e5('0x21')]({'where':_0x35864b[_0x24e5('0x43')]})[_0x24e5('0x28')](function(_0x5f5b92){_0x2f3af8['count']=_0x5f5b92;if(_0x5ab4da[_0x24e5('0x38')][_0x24e5('0x47')]){_0x35864b[_0x24e5('0x48')]=[{'all':!![]}];}return db[_0x24e5('0x5e')][_0x24e5('0x49')](_0x35864b);})[_0x24e5('0x28')](function(_0x5cfce0){_0x2f3af8['rows']=_0x5cfce0;return _0x2f3af8;});}})['then'](respondWithFilteredResult(_0x5acf08,_0x35864b))[_0x24e5('0x4b')](handleError(_0x5acf08,null));};exports['getHopperHistories']=function(_0x39b8c2,_0x51dfa5,_0xdfe9f3){var _0x245e3c={'raw':!![],'where':{}};var _0xc01c5d={};var _0x10bf1e={'count':0x0,'rows':[]};return db[_0x24e5('0x31')][_0x24e5('0x5c')]({'where':{'id':_0x39b8c2[_0x24e5('0x5a')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x51dfa5,null))['then'](function(_0x4b1d01){if(_0x4b1d01){_0xc01c5d['model']=_['keys'](db[_0x24e5('0x5f')][_0x24e5('0x32')]);_0xc01c5d[_0x24e5('0x38')]=_[_0x24e5('0x39')](_0x39b8c2['query']);_0xc01c5d[_0x24e5('0x3a')]=_[_0x24e5('0x3b')](_0xc01c5d[_0x24e5('0x36')],_0xc01c5d[_0x24e5('0x38')]);_0x245e3c[_0x24e5('0x3e')]=_[_0x24e5('0x3b')](_0xc01c5d[_0x24e5('0x36')],qs['fields'](_0x39b8c2[_0x24e5('0x38')][_0x24e5('0x3c')]));_0x245e3c['attributes']=_0x245e3c[_0x24e5('0x3e')][_0x24e5('0x3d')]?_0x245e3c[_0x24e5('0x3e')]:_0xc01c5d['model'];if(!_0x39b8c2[_0x24e5('0x38')][_0x24e5('0x3f')](_0x24e5('0x40'))){_0x245e3c['limit']=qs[_0x24e5('0x22')](_0x39b8c2['query'][_0x24e5('0x22')]);_0x245e3c['offset']=qs[_0x24e5('0x20')](_0x39b8c2['query']['offset']);}_0x245e3c[_0x24e5('0x41')]=qs[_0x24e5('0x42')](_0x39b8c2[_0x24e5('0x38')][_0x24e5('0x42')]);_0x245e3c[_0x24e5('0x43')]=qs[_0x24e5('0x3a')](_[_0x24e5('0x5d')](_0x39b8c2[_0x24e5('0x38')],_0xc01c5d[_0x24e5('0x3a')]));_0x245e3c[_0x24e5('0x43')][_0x24e5('0x60')]=_0x4b1d01['id'];if(_0x39b8c2[_0x24e5('0x38')][_0x24e5('0x44')]){_0x245e3c['where']=_[_0x24e5('0x4c')](_0x245e3c['where'],{'$or':_['map'](_0x245e3c['attributes'],function(_0x90ed70){var _0x31dc7a={};_0x31dc7a[_0x90ed70]={'$like':'%'+_0x39b8c2[_0x24e5('0x38')]['filter']+'%'};return _0x31dc7a;})});}_0x245e3c=_['merge']({},_0x245e3c,_0x39b8c2[_0x24e5('0x46')]);return db[_0x24e5('0x5f')][_0x24e5('0x21')]({'where':_0x245e3c[_0x24e5('0x43')]})[_0x24e5('0x28')](function(_0x4ff0ee){_0x10bf1e[_0x24e5('0x21')]=_0x4ff0ee;if(_0x39b8c2[_0x24e5('0x38')][_0x24e5('0x47')]){_0x245e3c['include']=[{'all':!![]}];}return db[_0x24e5('0x5f')][_0x24e5('0x49')](_0x245e3c);})[_0x24e5('0x28')](function(_0x5a34af){_0x10bf1e[_0x24e5('0x4a')]=_0x5a34af;return _0x10bf1e;});}})[_0x24e5('0x28')](respondWithFilteredResult(_0x51dfa5,_0x245e3c))[_0x24e5('0x4b')](handleError(_0x51dfa5,null));};exports[_0x24e5('0x61')]=function(_0x2dc9ca,_0x4e1914,_0x3ed4cd){var _0x5e9bb6={'raw':!![],'where':{}};var _0x20a884={};var _0x360ca0={'count':0x0,'rows':[]};return db[_0x24e5('0x31')][_0x24e5('0x5c')]({'where':{'id':_0x2dc9ca[_0x24e5('0x5a')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x4e1914,null))[_0x24e5('0x28')](function(_0x304012){if(_0x304012){_0x20a884[_0x24e5('0x36')]=_[_0x24e5('0x39')](db[_0x24e5('0x62')][_0x24e5('0x32')]);_0x20a884[_0x24e5('0x38')]=_[_0x24e5('0x39')](_0x2dc9ca[_0x24e5('0x38')]);_0x20a884[_0x24e5('0x3a')]=_[_0x24e5('0x3b')](_0x20a884[_0x24e5('0x36')],_0x20a884['query']);_0x5e9bb6[_0x24e5('0x3e')]=_[_0x24e5('0x3b')](_0x20a884[_0x24e5('0x36')],qs[_0x24e5('0x3c')](_0x2dc9ca[_0x24e5('0x38')][_0x24e5('0x3c')]));_0x5e9bb6[_0x24e5('0x3e')]=_0x5e9bb6['attributes']['length']?_0x5e9bb6[_0x24e5('0x3e')]:_0x20a884[_0x24e5('0x36')];if(!_0x2dc9ca[_0x24e5('0x38')]['hasOwnProperty'](_0x24e5('0x40'))){_0x5e9bb6[_0x24e5('0x22')]=qs[_0x24e5('0x22')](_0x2dc9ca[_0x24e5('0x38')][_0x24e5('0x22')]);_0x5e9bb6[_0x24e5('0x20')]=qs[_0x24e5('0x20')](_0x2dc9ca['query'][_0x24e5('0x20')]);}_0x5e9bb6[_0x24e5('0x41')]=qs[_0x24e5('0x42')](_0x2dc9ca[_0x24e5('0x38')][_0x24e5('0x42')]);_0x5e9bb6[_0x24e5('0x43')]=qs[_0x24e5('0x3a')](_[_0x24e5('0x5d')](_0x2dc9ca[_0x24e5('0x38')],_0x20a884[_0x24e5('0x3a')]));_0x5e9bb6['where']['CampaignId']=_0x304012['id'];if(_0x2dc9ca[_0x24e5('0x38')][_0x24e5('0x44')]){_0x5e9bb6[_0x24e5('0x43')]=_['merge'](_0x5e9bb6[_0x24e5('0x43')],{'$or':_[_0x24e5('0x37')](_0x5e9bb6[_0x24e5('0x3e')],function(_0x56e56e){var _0x4ace00={};_0x4ace00[_0x56e56e]={'$like':'%'+_0x2dc9ca[_0x24e5('0x38')]['filter']+'%'};return _0x4ace00;})});}_0x5e9bb6=_[_0x24e5('0x4c')]({},_0x5e9bb6,_0x2dc9ca[_0x24e5('0x46')]);return db[_0x24e5('0x62')][_0x24e5('0x21')]({'where':_0x5e9bb6[_0x24e5('0x43')]})['then'](function(_0x501198){_0x360ca0[_0x24e5('0x21')]=_0x501198;if(_0x2dc9ca['query'][_0x24e5('0x47')]){_0x5e9bb6['include']=[{'all':!![]}];}return db[_0x24e5('0x62')][_0x24e5('0x49')](_0x5e9bb6);})['then'](function(_0x43217f){_0x360ca0[_0x24e5('0x4a')]=_0x43217f;return _0x360ca0;});}})['then'](respondWithFilteredResult(_0x4e1914,_0x5e9bb6))[_0x24e5('0x4b')](handleError(_0x4e1914,null));};exports['getHopperBlacks']=function(_0x34a2a0,_0x5aa955,_0x20797d){var _0x3bf693={'raw':!![],'where':{}};var _0x2a48b5={};var _0x48174d={'count':0x0,'rows':[]};return db[_0x24e5('0x31')][_0x24e5('0x5c')]({'where':{'id':_0x34a2a0[_0x24e5('0x5a')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x5aa955,null))[_0x24e5('0x28')](function(_0x52d28c){if(_0x52d28c){_0x2a48b5['model']=_[_0x24e5('0x39')](db[_0x24e5('0x63')][_0x24e5('0x32')]);_0x2a48b5[_0x24e5('0x38')]=_[_0x24e5('0x39')](_0x34a2a0[_0x24e5('0x38')]);_0x2a48b5[_0x24e5('0x3a')]=_[_0x24e5('0x3b')](_0x2a48b5[_0x24e5('0x36')],_0x2a48b5['query']);_0x3bf693[_0x24e5('0x3e')]=_[_0x24e5('0x3b')](_0x2a48b5[_0x24e5('0x36')],qs['fields'](_0x34a2a0['query'][_0x24e5('0x3c')]));_0x3bf693['attributes']=_0x3bf693[_0x24e5('0x3e')][_0x24e5('0x3d')]?_0x3bf693['attributes']:_0x2a48b5['model'];if(!_0x34a2a0[_0x24e5('0x38')][_0x24e5('0x3f')](_0x24e5('0x40'))){_0x3bf693[_0x24e5('0x22')]=qs['limit'](_0x34a2a0['query']['limit']);_0x3bf693[_0x24e5('0x20')]=qs['offset'](_0x34a2a0[_0x24e5('0x38')][_0x24e5('0x20')]);}_0x3bf693[_0x24e5('0x41')]=qs['sort'](_0x34a2a0[_0x24e5('0x38')][_0x24e5('0x42')]);_0x3bf693['where']=qs['filters'](_[_0x24e5('0x5d')](_0x34a2a0[_0x24e5('0x38')],_0x2a48b5[_0x24e5('0x3a')]));_0x3bf693['where']['CampaignId']=_0x52d28c['id'];if(_0x34a2a0[_0x24e5('0x38')][_0x24e5('0x44')]){_0x3bf693[_0x24e5('0x43')]=_[_0x24e5('0x4c')](_0x3bf693['where'],{'$or':_['map'](_0x3bf693['attributes'],function(_0xdc169d){var _0x583669={};_0x583669[_0xdc169d]={'$like':'%'+_0x34a2a0[_0x24e5('0x38')][_0x24e5('0x44')]+'%'};return _0x583669;})});}_0x3bf693=_[_0x24e5('0x4c')]({},_0x3bf693,_0x34a2a0[_0x24e5('0x46')]);return db[_0x24e5('0x63')]['count']({'where':_0x3bf693[_0x24e5('0x43')]})['then'](function(_0x31b1f7){_0x48174d[_0x24e5('0x21')]=_0x31b1f7;if(_0x34a2a0[_0x24e5('0x38')]['includeAll']){_0x3bf693[_0x24e5('0x48')]=[{'all':!![]}];}return db[_0x24e5('0x63')][_0x24e5('0x49')](_0x3bf693);})['then'](function(_0x152ec2){_0x48174d['rows']=_0x152ec2;return _0x48174d;});}})['then'](respondWithFilteredResult(_0x5aa955,_0x3bf693))[_0x24e5('0x4b')](handleError(_0x5aa955,null));};exports[_0x24e5('0x64')]=function(_0x264a32,_0xd1cfc7,_0x56e8d9){var _0x2c6d9c={};var _0x5ab784={};var _0x767bdf;var _0x290de8;return db[_0x24e5('0x31')][_0x24e5('0x5c')]({'where':{'id':_0x264a32['params']['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0xd1cfc7,null))[_0x24e5('0x28')](function(_0xbc35d6){if(_0xbc35d6){_0x767bdf=_0xbc35d6;_0x5ab784[_0x24e5('0x36')]=_[_0x24e5('0x39')](db[_0x24e5('0x65')][_0x24e5('0x32')]);_0x5ab784[_0x24e5('0x38')]=_[_0x24e5('0x39')](_0x264a32[_0x24e5('0x38')]);_0x5ab784[_0x24e5('0x3a')]=_[_0x24e5('0x3b')](_0x5ab784[_0x24e5('0x36')],_0x5ab784[_0x24e5('0x38')]);_0x2c6d9c[_0x24e5('0x3e')]=_[_0x24e5('0x3b')](_0x5ab784[_0x24e5('0x36')],qs[_0x24e5('0x3c')](_0x264a32[_0x24e5('0x38')]['fields']));_0x2c6d9c[_0x24e5('0x3e')]=_0x2c6d9c[_0x24e5('0x3e')]['length']?_0x2c6d9c[_0x24e5('0x3e')]:_0x5ab784[_0x24e5('0x36')];_0x2c6d9c[_0x24e5('0x41')]=qs[_0x24e5('0x42')](_0x264a32[_0x24e5('0x38')][_0x24e5('0x42')]);_0x2c6d9c[_0x24e5('0x43')]=qs[_0x24e5('0x3a')](_[_0x24e5('0x5d')](_0x264a32[_0x24e5('0x38')],_0x5ab784['filters']));if(_0x264a32[_0x24e5('0x38')]['filter']){_0x2c6d9c['where']=_[_0x24e5('0x4c')](_0x2c6d9c['where'],{'$or':_[_0x24e5('0x37')](_0x2c6d9c[_0x24e5('0x3e')],function(_0x37b94d){var _0x53f194={};_0x53f194[_0x37b94d]={'$like':'%'+_0x264a32[_0x24e5('0x38')]['filter']+'%'};return _0x53f194;})});}_0x2c6d9c=_[_0x24e5('0x4c')]({},_0x2c6d9c,_0x264a32[_0x24e5('0x46')]);return _0x767bdf[_0x24e5('0x64')](_0x2c6d9c);}})['then'](function(_0x125368){if(_0x125368){_0x290de8=_0x125368[_0x24e5('0x3d')];if(!_0x264a32[_0x24e5('0x38')][_0x24e5('0x3f')](_0x24e5('0x40'))){_0x2c6d9c[_0x24e5('0x22')]=qs[_0x24e5('0x22')](_0x264a32[_0x24e5('0x38')][_0x24e5('0x22')]);_0x2c6d9c[_0x24e5('0x20')]=qs[_0x24e5('0x20')](_0x264a32[_0x24e5('0x38')][_0x24e5('0x20')]);}return _0x767bdf[_0x24e5('0x64')](_0x2c6d9c);}})[_0x24e5('0x28')](function(_0xc98ba){if(_0xc98ba){return _0xc98ba?{'count':_0x290de8,'rows':_0xc98ba}:null;}})[_0x24e5('0x28')](respondWithResult(_0xd1cfc7,null))[_0x24e5('0x4b')](handleError(_0xd1cfc7,null));};exports[_0x24e5('0x66')]=function(_0x40d19d,_0x1f75fa,_0x24ef30){var _0x3e0c41,_0x138817;var _0x175832=[];var _0x2d72ab=moment()[_0x24e5('0x67')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x24e5('0x31')][_0x24e5('0x4d')]({'where':{'id':_0x40d19d[_0x24e5('0x5a')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x1f75fa,null))[_0x24e5('0x28')](function(_0x7a7bef){if(_0x7a7bef){_0x138817=_0x7a7bef;return _0x7a7bef['addLists'](_0x40d19d[_0x24e5('0x4f')][_0x24e5('0x68')],_['omit'](_0x40d19d['body'],[_0x24e5('0x68'),'id'])||{});}return null;})[_0x24e5('0x69')](function(_0xb6afc3){var _0x505425;var _0x15377b;_0x3e0c41=_0xb6afc3||[];var _0x10ec0a=[];if(_0xb6afc3){for(var _0x36ccd5=0x0;_0x36ccd5<_0xb6afc3[_0x24e5('0x3d')];_0x36ccd5+=0x1){var _0x141be9=_0xb6afc3[_0x36ccd5][_0x24e5('0x29')]({'plain':!![]});_0x138817['dialCheckDuplicateType']=_0x40d19d['body'][_0x24e5('0x6a')]?_0x40d19d[_0x24e5('0x4f')]['dialCheckDuplicateType']:_0x138817['dialCheckDuplicateType'];switch(_0x138817[_0x24e5('0x6a')]){case _0x24e5('0x6b'):_0x505425=squel[_0x24e5('0x6c')]()[_0x24e5('0x6d')](_0x24e5('0x6e'))[_0x24e5('0x6f')]([_0x24e5('0x70'),_0x24e5('0x71'),'ContactId',_0x24e5('0x72'),_0x24e5('0x60'),_0x24e5('0x57'),_0x24e5('0x58')],squel[_0x24e5('0x73')]()['field'](_0x24e5('0x70'),'phone')[_0x24e5('0x74')](_0x24e5('0x75'),_0x24e5('0x71'))[_0x24e5('0x74')]('id',_0x24e5('0x76'))[_0x24e5('0x74')](_0x141be9[_0x24e5('0x77')][_0x24e5('0x78')](),'ListId')['field'](_0x40d19d[_0x24e5('0x5a')]['id']['toString'](),_0x24e5('0x60'))[_0x24e5('0x74')]('\x27'+_0x2d72ab+'\x27',_0x24e5('0x57'))['field']('\x27'+_0x2d72ab+'\x27',_0x24e5('0x58'))['from'](_0x24e5('0x79'))[_0x24e5('0x43')](_0x24e5('0x7a'))[_0x24e5('0x43')](_0x24e5('0x7b'),_0x141be9['CmListId'][_0x24e5('0x78')]())[_0x24e5('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x24e5('0x43')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x24e5('0x7c'))[_0x24e5('0x7d')](_0x24e5('0x7e'))[_0x24e5('0x43')](_0x24e5('0x7f'),_0x40d19d[_0x24e5('0x5a')]['id']['toString']()))[_0x24e5('0x43')](_0x24e5('0x80'),squel['select']()[_0x24e5('0x74')](_0x24e5('0x81'))['from']('cm_hopper')[_0x24e5('0x43')](_0x24e5('0x7f'),_0x40d19d[_0x24e5('0x5a')]['id']['toString']())))[_0x24e5('0x78')]();break;case _0x24e5('0x82'):_0x505425=squel[_0x24e5('0x6c')]()[_0x24e5('0x6d')](_0x24e5('0x6e'))[_0x24e5('0x6f')](['phone',_0x24e5('0x71'),_0x24e5('0x76'),_0x24e5('0x72'),_0x24e5('0x60'),_0x24e5('0x57'),'updatedAt'],squel[_0x24e5('0x73')]()[_0x24e5('0x74')]('phone','phone')[_0x24e5('0x74')]('NOW()','scheduledAt')['field']('id','ContactId')[_0x24e5('0x74')](_0x141be9[_0x24e5('0x77')][_0x24e5('0x78')](),'ListId')[_0x24e5('0x74')](_0x40d19d['params']['id']['toString'](),_0x24e5('0x60'))['field']('\x27'+_0x2d72ab+'\x27','createdAt')[_0x24e5('0x74')]('\x27'+_0x2d72ab+'\x27',_0x24e5('0x58'))[_0x24e5('0x7d')]('cm_contacts')[_0x24e5('0x43')]('deletedAt\x20IS\x20NULL')['where'](_0x24e5('0x7b'),_0x141be9['CmListId'][_0x24e5('0x78')]())[_0x24e5('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x24e5('0x43')](_0x24e5('0x80'),squel['select']()[_0x24e5('0x74')](_0x24e5('0x81'))['from'](_0x24e5('0x6e'))[_0x24e5('0x43')](_0x24e5('0x7f'),_0x40d19d[_0x24e5('0x5a')]['id'][_0x24e5('0x78')]())))[_0x24e5('0x78')]();break;default:_0x505425=squel['insert']()[_0x24e5('0x6d')](_0x24e5('0x6e'))['fromQuery']([_0x24e5('0x70'),_0x24e5('0x71'),_0x24e5('0x76'),'ListId','CampaignId',_0x24e5('0x57'),_0x24e5('0x58')],squel[_0x24e5('0x73')]()['field'](_0x24e5('0x70'),_0x24e5('0x70'))[_0x24e5('0x74')](_0x24e5('0x75'),'scheduledAt')[_0x24e5('0x74')]('id',_0x24e5('0x76'))[_0x24e5('0x74')](_0x141be9[_0x24e5('0x77')]['toString'](),_0x24e5('0x72'))[_0x24e5('0x74')](_0x40d19d[_0x24e5('0x5a')]['id'][_0x24e5('0x78')](),'CampaignId')[_0x24e5('0x74')]('\x27'+_0x2d72ab+'\x27',_0x24e5('0x57'))[_0x24e5('0x74')]('\x27'+_0x2d72ab+'\x27','updatedAt')[_0x24e5('0x7d')](_0x24e5('0x79'))[_0x24e5('0x43')]('deletedAt\x20IS\x20NULL')[_0x24e5('0x43')](_0x24e5('0x7b'),_0x141be9[_0x24e5('0x77')][_0x24e5('0x78')]())[_0x24e5('0x43')](_0x24e5('0x83')))[_0x24e5('0x78')]();}_0x15377b=squel[_0x24e5('0x6c')]()[_0x24e5('0x6d')](_0x24e5('0x84'))[_0x24e5('0x6f')]([_0x24e5('0x85'),'scheduledAt',_0x24e5('0x70'),_0x24e5('0x86'),'createdAt',_0x24e5('0x58')],squel[_0x24e5('0x73')]()[_0x24e5('0x74')]('h.id','id')[_0x24e5('0x74')](_0x24e5('0x75'),_0x24e5('0x71'))['field'](_0x24e5('0x87'),_0x24e5('0x70'))[_0x24e5('0x74')](_0x24e5('0x88'),_0x24e5('0x86'))['field']('\x27'+_0x2d72ab+'\x27',_0x24e5('0x57'))[_0x24e5('0x74')]('\x27'+_0x2d72ab+'\x27',_0x24e5('0x58'))[_0x24e5('0x7d')]('cm_contact_has_items','ci')['join'](_0x24e5('0x6e'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x24e5('0x43')](_0x24e5('0x89'),_0x141be9[_0x24e5('0x77')]['toString']())[_0x24e5('0x43')](_0x24e5('0x8a'),_0x40d19d[_0x24e5('0x5a')]['id'][_0x24e5('0x78')]())[_0x24e5('0x43')](_0x24e5('0x8b'),_0x2d72ab))[_0x24e5('0x78')]();_0x10ec0a[_0x24e5('0x8c')](db[_0x24e5('0x8d')][_0x24e5('0x38')](_0x505425));_0x175832[_0x24e5('0x8c')](db['sequelize']['query'](_0x15377b));}return BPromise[_0x24e5('0x8e')](_0x10ec0a);}})['then'](function(){return BPromise[_0x24e5('0x8e')](_0x175832);})[_0x24e5('0x28')](function(){return _0x3e0c41;})[_0x24e5('0x28')](respondWithResult(_0x1f75fa,null))[_0x24e5('0x4b')](handleError(_0x1f75fa,null));};exports['removeLists']=function(_0x30373f,_0x24e65e,_0x1dc76a){return db['Campaign'][_0x24e5('0x4d')]({'where':{'id':_0x30373f['params']['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x24e65e,null))[_0x24e5('0x28')](function(_0x2d31e7){if(_0x2d31e7){return _0x2d31e7['removeLists'](_0x30373f['query']['ids']);}})[_0x24e5('0x28')](function(_0x21ae00){if(_0x21ae00){return db[_0x24e5('0x5e')]['destroy']({'where':{'ListId':_0x30373f[_0x24e5('0x38')]['ids'],'CampaignId':_0x30373f[_0x24e5('0x5a')]['id']}})['then'](function(){return _0x21ae00;});}})['then'](respondWithStatusCode(_0x24e65e,null))[_0x24e5('0x4b')](handleError(_0x24e65e,null));};exports[_0x24e5('0x8f')]=function(_0x3ad3d9,_0x257754,_0x3dc8a1){var _0x504ca4={};var _0x41ee36={};var _0x361f86;var _0x446df2;return db['Campaign'][_0x24e5('0x5c')]({'where':{'id':_0x3ad3d9[_0x24e5('0x5a')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x257754,null))[_0x24e5('0x28')](function(_0x5de5b9){if(_0x5de5b9){_0x361f86=_0x5de5b9;_0x41ee36[_0x24e5('0x36')]=_[_0x24e5('0x39')](db[_0x24e5('0x65')][_0x24e5('0x32')]);_0x41ee36['query']=_[_0x24e5('0x39')](_0x3ad3d9[_0x24e5('0x38')]);_0x41ee36['filters']=_['intersection'](_0x41ee36['model'],_0x41ee36[_0x24e5('0x38')]);_0x504ca4[_0x24e5('0x3e')]=_['intersection'](_0x41ee36[_0x24e5('0x36')],qs[_0x24e5('0x3c')](_0x3ad3d9[_0x24e5('0x38')]['fields']));_0x504ca4['attributes']=_0x504ca4[_0x24e5('0x3e')][_0x24e5('0x3d')]?_0x504ca4['attributes']:_0x41ee36[_0x24e5('0x36')];_0x504ca4['order']=qs['sort'](_0x3ad3d9[_0x24e5('0x38')][_0x24e5('0x42')]);_0x504ca4[_0x24e5('0x43')]=qs['filters'](_[_0x24e5('0x5d')](_0x3ad3d9[_0x24e5('0x38')],_0x41ee36['filters']));if(_0x3ad3d9[_0x24e5('0x38')]['filter']){_0x504ca4[_0x24e5('0x43')]=_[_0x24e5('0x4c')](_0x504ca4[_0x24e5('0x43')],{'$or':_[_0x24e5('0x37')](_0x504ca4[_0x24e5('0x3e')],function(_0x112362){var _0x53e04e={};_0x53e04e[_0x112362]={'$like':'%'+_0x3ad3d9[_0x24e5('0x38')][_0x24e5('0x44')]+'%'};return _0x53e04e;})});}_0x504ca4=_[_0x24e5('0x4c')]({},_0x504ca4,_0x3ad3d9[_0x24e5('0x46')]);return _0x361f86[_0x24e5('0x8f')](_0x504ca4);}})[_0x24e5('0x28')](function(_0x5b4707){if(_0x5b4707){_0x446df2=_0x5b4707['length'];if(!_0x3ad3d9[_0x24e5('0x38')][_0x24e5('0x3f')](_0x24e5('0x40'))){_0x504ca4[_0x24e5('0x22')]=qs[_0x24e5('0x22')](_0x3ad3d9[_0x24e5('0x38')]['limit']);_0x504ca4[_0x24e5('0x20')]=qs['offset'](_0x3ad3d9['query']['offset']);}return _0x361f86['getBlackLists'](_0x504ca4);}})[_0x24e5('0x28')](function(_0x54968c){if(_0x54968c){return _0x54968c?{'count':_0x446df2,'rows':_0x54968c}:null;}})[_0x24e5('0x28')](respondWithResult(_0x257754,null))[_0x24e5('0x4b')](handleError(_0x257754,null));};exports['addBlackLists']=function(_0x117095,_0xe4778d,_0x2ae4cd){var _0x4dd00e,_0x3ad143;var _0x5ceae4=[];var _0x4eec48=moment()[_0x24e5('0x67')](_0x24e5('0x90'));return db[_0x24e5('0x31')][_0x24e5('0x4d')]({'where':{'id':_0x117095[_0x24e5('0x5a')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0xe4778d,null))[_0x24e5('0x28')](function(_0x3db992){if(_0x3db992){_0x3ad143=_0x3db992;return _0x3db992['addBlackLists'](_0x117095[_0x24e5('0x4f')][_0x24e5('0x68')],_[_0x24e5('0x91')](_0x117095[_0x24e5('0x4f')],[_0x24e5('0x68'),'id'])||{});}return null;})[_0x24e5('0x69')](function(_0x39f510){var _0x5aeaa7;var _0x243bf8;_0x4dd00e=_0x39f510||[];var _0x3c504c=[];if(_0x39f510){for(var _0x3ef4ad=0x0;_0x3ef4ad<_0x39f510[_0x24e5('0x3d')];_0x3ef4ad+=0x1){var _0x1bdaea=_0x39f510[_0x3ef4ad][_0x24e5('0x29')]({'plain':!![]});_0x5aeaa7=squel[_0x24e5('0x6c')]()[_0x24e5('0x6d')](_0x24e5('0x92'))[_0x24e5('0x6f')]([_0x24e5('0x70'),_0x24e5('0x76'),_0x24e5('0x72'),_0x24e5('0x60'),_0x24e5('0x57'),_0x24e5('0x58')],squel[_0x24e5('0x73')]()[_0x24e5('0x74')](_0x24e5('0x70'),'phone')['field']('id',_0x24e5('0x76'))[_0x24e5('0x74')](_0x1bdaea[_0x24e5('0x77')][_0x24e5('0x78')](),_0x24e5('0x72'))[_0x24e5('0x74')](_0x117095['params']['id']['toString'](),_0x24e5('0x60'))['field']('NOW()','createdAt')[_0x24e5('0x74')](_0x24e5('0x75'),_0x24e5('0x58'))['from'](_0x24e5('0x79'))['where'](_0x24e5('0x7a'))[_0x24e5('0x43')](_0x24e5('0x7b'),_0x1bdaea[_0x24e5('0x77')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3c504c[_0x24e5('0x8c')](db['sequelize'][_0x24e5('0x38')](_0x5aeaa7));}return BPromise[_0x24e5('0x8e')](_0x3c504c);}})[_0x24e5('0x28')](function(){return _0x4dd00e;})[_0x24e5('0x28')](respondWithResult(_0xe4778d,null))[_0x24e5('0x4b')](handleError(_0xe4778d,null));};exports[_0x24e5('0x93')]=function(_0x3f49bc,_0x266dc4,_0x1f5455){return db[_0x24e5('0x31')][_0x24e5('0x4d')]({'where':{'id':_0x3f49bc[_0x24e5('0x5a')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x266dc4,null))[_0x24e5('0x28')](function(_0x51d856){if(_0x51d856){return _0x51d856['removeBlackLists'](_0x3f49bc['query'][_0x24e5('0x68')]);}})['then'](function(_0x16a73c){if(_0x16a73c){return db[_0x24e5('0x63')][_0x24e5('0x2b')]({'where':{'ListId':_0x3f49bc[_0x24e5('0x38')][_0x24e5('0x68')],'CampaignId':_0x3f49bc[_0x24e5('0x5a')]['id']}})['then'](function(){return _0x16a73c;});}})[_0x24e5('0x28')](respondWithStatusCode(_0x266dc4,null))['catch'](handleError(_0x266dc4,null));}; \ No newline at end of file +var _0x5269=['getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','apply','save','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','map','Campaign','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','merge','autoAssociation','getHoppers','CmHopper','CampaignId','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack'];(function(_0x5ee67e,_0x1e10e5){var _0x47b30b=function(_0x4775f0){while(--_0x4775f0){_0x5ee67e['push'](_0x5ee67e['shift']());}};_0x47b30b(++_0x1e10e5);}(_0x5269,0x150));var _0x9526=function(_0x3e775c,_0x5879c2){_0x3e775c=_0x3e775c-0x0;var _0x24cc56=_0x5269[_0x3e775c];return _0x24cc56;};'use strict';var emlformat=require(_0x9526('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9526('0x1'));var BPromise=require(_0x9526('0x2'));var Mustache=require(_0x9526('0x3'));var util=require('util');var path=require('path');var sox=require(_0x9526('0x4'));var csv=require('to-csv');var ejs=require(_0x9526('0x5'));var fs=require('fs');var fs_extra=require(_0x9526('0x6'));var _=require(_0x9526('0x7'));var squel=require(_0x9526('0x8'));var crypto=require(_0x9526('0x9'));var jsforce=require(_0x9526('0xa'));var deskjs=require(_0x9526('0xb'));var toCsv=require(_0x9526('0xc'));var querystring=require(_0x9526('0xd'));var Papa=require(_0x9526('0xe'));var Redis=require(_0x9526('0xf'));var authService=require(_0x9526('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9526('0x11'));var hardwareService=require(_0x9526('0x12'));var logger=require('../../config/logger')(_0x9526('0x13'));var utils=require(_0x9526('0x14'));var config=require(_0x9526('0x15'));var licenseUtil=require(_0x9526('0x16'));var db=require(_0x9526('0x17'))['db'];function respondWithStatusCode(_0x1304f5,_0x14dde8){_0x14dde8=_0x14dde8||0xcc;return function(_0x487158){if(_0x487158){return _0x1304f5[_0x9526('0x18')](_0x14dde8);}return _0x1304f5[_0x9526('0x19')](_0x14dde8)['end']();};}function respondWithResult(_0x3f9751,_0x13ca39){_0x13ca39=_0x13ca39||0xc8;return function(_0x530a5b){if(_0x530a5b){return _0x3f9751['status'](_0x13ca39)['json'](_0x530a5b);}};}function respondWithFilteredResult(_0x271aa7,_0x5bf7ec){return function(_0x20e6c7){if(_0x20e6c7){var _0x37feda=typeof _0x5bf7ec[_0x9526('0x1a')]===_0x9526('0x1b')&&typeof _0x5bf7ec[_0x9526('0x1c')]===_0x9526('0x1b');var _0x53aace=_0x20e6c7['count'];var _0xb10ba6=_0x37feda?0x0:_0x5bf7ec[_0x9526('0x1a')];var _0x282b21=_0x37feda?_0x20e6c7['count']:_0x5bf7ec[_0x9526('0x1a')]+_0x5bf7ec['limit'];var _0x13c1c5;if(_0x282b21>=_0x53aace){_0x282b21=_0x53aace;_0x13c1c5=0xc8;}else{_0x13c1c5=0xce;}_0x271aa7[_0x9526('0x19')](_0x13c1c5);return _0x271aa7[_0x9526('0x1d')]('Content-Range',_0xb10ba6+'-'+_0x282b21+'/'+_0x53aace)['json'](_0x20e6c7);}return null;};}function patchUpdates(_0x3bb291){return function(_0x1bfb23){try{jsonpatch[_0x9526('0x1e')](_0x1bfb23,_0x3bb291,!![]);}catch(_0x3b0699){return BPromise['reject'](_0x3b0699);}return _0x1bfb23[_0x9526('0x1f')]();};}function saveUpdates(_0x552868,_0x230c4a){return function(_0x421382){if(_0x421382){return _0x421382['update'](_0x552868)['then'](function(_0x4fdc84){return _0x4fdc84;});}return null;};}function removeEntity(_0x18c11a,_0x57c330){return function(_0x12449e){if(_0x12449e){return _0x12449e[_0x9526('0x20')]()[_0x9526('0x21')](function(){var _0x578288=_0x12449e[_0x9526('0x22')]({'plain':!![]});var _0x309c99=_0x9526('0x23');return db[_0x9526('0x24')][_0x9526('0x20')]({'where':{'type':_0x309c99,'resourceId':_0x578288['id']}})[_0x9526('0x21')](function(){return _0x12449e;});})[_0x9526('0x21')](function(){_0x18c11a[_0x9526('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdc01fe,_0x205cbf){return function(_0x5a8713){if(!_0x5a8713){_0xdc01fe[_0x9526('0x18')](0x194);}return _0x5a8713;};}function handleError(_0x4ae9d2,_0x2f7b4d){_0x2f7b4d=_0x2f7b4d||0x1f4;return function(_0xfd0b7c){logger[_0x9526('0x25')](_0xfd0b7c[_0x9526('0x26')]);if(_0xfd0b7c[_0x9526('0x27')]){delete _0xfd0b7c[_0x9526('0x27')];}_0x4ae9d2[_0x9526('0x19')](_0x2f7b4d)[_0x9526('0x28')](_0xfd0b7c);};}exports['index']=function(_0x5729cf,_0x4e96dd){var _0x10dd77={},_0x3fe7ce={},_0x15a091={'count':0x0,'rows':[]};var _0x9601ed=_[_0x9526('0x29')](db[_0x9526('0x2a')][_0x9526('0x2b')],function(_0x19dc25){return{'name':_0x19dc25[_0x9526('0x2c')],'type':_0x19dc25['type']['key']};});_0x3fe7ce['model']=_[_0x9526('0x29')](_0x9601ed,_0x9526('0x27'));_0x3fe7ce[_0x9526('0x2d')]=_[_0x9526('0x2e')](_0x5729cf['query']);_0x3fe7ce[_0x9526('0x2f')]=_[_0x9526('0x30')](_0x3fe7ce[_0x9526('0x31')],_0x3fe7ce[_0x9526('0x2d')]);_0x10dd77[_0x9526('0x32')]=_['intersection'](_0x3fe7ce[_0x9526('0x31')],qs[_0x9526('0x33')](_0x5729cf[_0x9526('0x2d')][_0x9526('0x33')]));_0x10dd77[_0x9526('0x32')]=_0x10dd77[_0x9526('0x32')]['length']?_0x10dd77[_0x9526('0x32')]:_0x3fe7ce['model'];if(!_0x5729cf[_0x9526('0x2d')][_0x9526('0x34')](_0x9526('0x35'))){_0x10dd77[_0x9526('0x1c')]=qs['limit'](_0x5729cf['query'][_0x9526('0x1c')]);_0x10dd77[_0x9526('0x1a')]=qs[_0x9526('0x1a')](_0x5729cf['query'][_0x9526('0x1a')]);}_0x10dd77[_0x9526('0x36')]=qs[_0x9526('0x37')](_0x5729cf[_0x9526('0x2d')][_0x9526('0x37')]);_0x10dd77[_0x9526('0x38')]=qs[_0x9526('0x2f')](_[_0x9526('0x39')](_0x5729cf[_0x9526('0x2d')],_0x3fe7ce['filters']),_0x9601ed);if(_0x5729cf[_0x9526('0x2d')][_0x9526('0x3a')]){_0x10dd77[_0x9526('0x38')]=_['merge'](_0x10dd77[_0x9526('0x38')],{'$or':_['map'](_0x9601ed,function(_0x4153d5){if(_0x4153d5['type']!==_0x9526('0x3b')){var _0x43d2b1={};_0x43d2b1[_0x4153d5['name']]={'$like':'%'+_0x5729cf[_0x9526('0x2d')]['filter']+'%'};return _0x43d2b1;}})});}_0x10dd77=_['merge']({},_0x10dd77,_0x5729cf[_0x9526('0x3c')]);var _0xbb5ff5={'where':_0x10dd77[_0x9526('0x38')]};return db[_0x9526('0x2a')][_0x9526('0x3d')](_0xbb5ff5)[_0x9526('0x21')](function(_0x209f13){_0x15a091[_0x9526('0x3d')]=_0x209f13;if(_0x5729cf['query'][_0x9526('0x3e')]){_0x10dd77[_0x9526('0x3f')]=[{'all':!![]}];}return db['Campaign'][_0x9526('0x40')](_0x10dd77);})[_0x9526('0x21')](function(_0xa0ad19){_0x15a091[_0x9526('0x41')]=_0xa0ad19;return _0x15a091;})[_0x9526('0x21')](respondWithFilteredResult(_0x4e96dd,_0x10dd77))[_0x9526('0x42')](handleError(_0x4e96dd,null));};exports[_0x9526('0x43')]=function(_0x391b55,_0x423bfc){var _0x1e07c2={'raw':![],'where':{'id':_0x391b55[_0x9526('0x44')]['id']}},_0x4066c1={};_0x4066c1[_0x9526('0x31')]=_['keys'](db[_0x9526('0x2a')]['rawAttributes']);_0x4066c1[_0x9526('0x2d')]=_[_0x9526('0x2e')](_0x391b55['query']);_0x4066c1[_0x9526('0x2f')]=_[_0x9526('0x30')](_0x4066c1[_0x9526('0x31')],_0x4066c1[_0x9526('0x2d')]);_0x1e07c2['attributes']=_[_0x9526('0x30')](_0x4066c1[_0x9526('0x31')],qs[_0x9526('0x33')](_0x391b55[_0x9526('0x2d')]['fields']));_0x1e07c2[_0x9526('0x32')]=_0x1e07c2[_0x9526('0x32')][_0x9526('0x45')]?_0x1e07c2[_0x9526('0x32')]:_0x4066c1['model'];if(_0x391b55[_0x9526('0x2d')][_0x9526('0x3e')]){_0x1e07c2['include']=[{'all':!![]}];}_0x1e07c2=_['merge']({},_0x1e07c2,_0x391b55['options']);return db[_0x9526('0x2a')][_0x9526('0x46')](_0x1e07c2)['then'](handleEntityNotFound(_0x423bfc,null))[_0x9526('0x21')](respondWithResult(_0x423bfc,null))['catch'](handleError(_0x423bfc,null));};exports[_0x9526('0x47')]=function(_0xe580c9,_0x10a251){return db[_0x9526('0x2a')]['create'](_0xe580c9[_0x9526('0x48')],{})[_0x9526('0x21')](function(_0x507efe){var _0x28955a=_0xe580c9[_0x9526('0x49')][_0x9526('0x22')]({'plain':!![]});if(!_0x28955a)throw new Error(_0x9526('0x4a'));if(_0x28955a['role']===_0x9526('0x49')){var _0xc38a0=_0x507efe[_0x9526('0x22')]({'plain':!![]});var _0x36883d='IvrCampaigns';return db[_0x9526('0x4b')][_0x9526('0x46')]({'where':{'name':_0x36883d,'userProfileId':_0x28955a[_0x9526('0x4c')]},'raw':!![]})[_0x9526('0x21')](function(_0x4f28d1){if(_0x4f28d1&&_0x4f28d1['autoAssociation']===0x0){return db[_0x9526('0x24')][_0x9526('0x47')]({'name':_0xc38a0[_0x9526('0x27')],'resourceId':_0xc38a0['id'],'type':_0x4f28d1[_0x9526('0x27')],'sectionId':_0x4f28d1['id']},{})[_0x9526('0x21')](function(){return _0x507efe;});}else{return _0x507efe;}})['catch'](function(_0x3a564f){logger[_0x9526('0x25')](_0x9526('0x4d'),_0x3a564f);throw _0x3a564f;});}return _0x507efe;})[_0x9526('0x21')](respondWithResult(_0x10a251,0xc9))[_0x9526('0x42')](handleError(_0x10a251,null));};exports[_0x9526('0x4e')]=function(_0x5dd686,_0x16fa4b){var _0x1be7f9={'where':{'id':_0x5dd686['params']['id']}},_0x234099={};_0x234099[_0x9526('0x31')]=_[_0x9526('0x2e')](db[_0x9526('0x2a')][_0x9526('0x2b')]);_0x1be7f9[_0x9526('0x32')]=_[_0x9526('0x30')](_0x234099['model'],qs[_0x9526('0x33')](_0x5dd686[_0x9526('0x2d')][_0x9526('0x33')]));_0x1be7f9[_0x9526('0x32')]=_0x1be7f9['attributes'][_0x9526('0x45')]?_0x1be7f9[_0x9526('0x32')]:_0x234099['model'];if(_0x5dd686[_0x9526('0x2d')]['includeAll']){_0x1be7f9[_0x9526('0x3f')]=[{'all':!![]}];}_0x1be7f9=_['merge']({},_0x1be7f9,_0x5dd686[_0x9526('0x3c')]);return db[_0x9526('0x2a')][_0x9526('0x46')](_0x1be7f9)['then'](handleEntityNotFound(_0x16fa4b,null))['then'](function(_0x4ad123){if(_0x4ad123){var _0x4b8995=_0x4ad123[_0x9526('0x22')]({'plain':!![]});_0x4b8995=qs[_0x9526('0x4f')](_0x4b8995,['id',_0x9526('0x50'),_0x9526('0x51')]);_0x5dd686['body']=_[_0x9526('0x4f')](_0x5dd686['body'],['id',_0x9526('0x50'),_0x9526('0x51')]);return db[_0x9526('0x2a')][_0x9526('0x47')](_[_0x9526('0x52')](_0x4b8995,_0x5dd686['body']),{'include':_0x5dd686[_0x9526('0x2d')][_0x9526('0x3e')]?[{'all':!![]}]:undefined})[_0x9526('0x21')](function(_0x349dc5){var _0x166b70=_0x5dd686['user'][_0x9526('0x22')]({'plain':!![]});if(!_0x166b70)throw new Error(_0x9526('0x4a'));if(_0x166b70['role']===_0x9526('0x49')){var _0x10b844=_0x349dc5[_0x9526('0x22')]({'plain':!![]});var _0x37764d=_0x9526('0x23');return db[_0x9526('0x4b')][_0x9526('0x46')]({'where':{'name':_0x37764d,'userProfileId':_0x166b70[_0x9526('0x4c')]},'raw':!![]})['then'](function(_0x1f5de9){if(_0x1f5de9&&_0x1f5de9[_0x9526('0x53')]===0x0){return db[_0x9526('0x24')][_0x9526('0x47')]({'name':_0x10b844[_0x9526('0x27')],'resourceId':_0x10b844['id'],'type':_0x1f5de9[_0x9526('0x27')],'sectionId':_0x1f5de9['id']},{})[_0x9526('0x21')](function(){return _0x349dc5;});}else{return _0x349dc5;}})[_0x9526('0x42')](function(_0x1ef7b9){logger[_0x9526('0x25')](_0x9526('0x4d'),_0x1ef7b9);throw _0x1ef7b9;});}return _0x349dc5;});}})['then'](respondWithResult(_0x16fa4b,0xc9))[_0x9526('0x42')](handleError(_0x16fa4b,null));};exports['update']=function(_0x560e10,_0x22c7f7){if(_0x560e10[_0x9526('0x48')]['id']){delete _0x560e10['body']['id'];}return db['Campaign'][_0x9526('0x46')]({'where':{'id':_0x560e10['params']['id']}})['then'](handleEntityNotFound(_0x22c7f7,null))[_0x9526('0x21')](saveUpdates(_0x560e10[_0x9526('0x48')],null))[_0x9526('0x21')](respondWithResult(_0x22c7f7,null))['catch'](handleError(_0x22c7f7,null));};exports[_0x9526('0x20')]=function(_0x4eacf6,_0x361cea){return db['Campaign'][_0x9526('0x46')]({'where':{'id':_0x4eacf6[_0x9526('0x44')]['id']}})[_0x9526('0x21')](handleEntityNotFound(_0x361cea,null))[_0x9526('0x21')](removeEntity(_0x361cea,null))[_0x9526('0x42')](handleError(_0x361cea,null));};exports[_0x9526('0x54')]=function(_0x55b75c,_0x283531,_0x53dff8){var _0x294979={'raw':!![],'where':{}};var _0x5c3a08={};var _0x5f21f0={'count':0x0,'rows':[]};return db[_0x9526('0x2a')]['findOne']({'where':{'id':_0x55b75c['params']['id']}})[_0x9526('0x21')](handleEntityNotFound(_0x283531,null))['then'](function(_0x4592f9){if(_0x4592f9){_0x5c3a08[_0x9526('0x31')]=_[_0x9526('0x2e')](db[_0x9526('0x55')]['rawAttributes']);_0x5c3a08[_0x9526('0x2d')]=_[_0x9526('0x2e')](_0x55b75c['query']);_0x5c3a08[_0x9526('0x2f')]=_[_0x9526('0x30')](_0x5c3a08[_0x9526('0x31')],_0x5c3a08[_0x9526('0x2d')]);_0x294979[_0x9526('0x32')]=_[_0x9526('0x30')](_0x5c3a08[_0x9526('0x31')],qs['fields'](_0x55b75c[_0x9526('0x2d')][_0x9526('0x33')]));_0x294979[_0x9526('0x32')]=_0x294979['attributes'][_0x9526('0x45')]?_0x294979[_0x9526('0x32')]:_0x5c3a08[_0x9526('0x31')];if(!_0x55b75c[_0x9526('0x2d')][_0x9526('0x34')](_0x9526('0x35'))){_0x294979[_0x9526('0x1c')]=qs['limit'](_0x55b75c[_0x9526('0x2d')][_0x9526('0x1c')]);_0x294979[_0x9526('0x1a')]=qs[_0x9526('0x1a')](_0x55b75c['query'][_0x9526('0x1a')]);}_0x294979[_0x9526('0x36')]=qs['sort'](_0x55b75c['query'][_0x9526('0x37')]);_0x294979['where']=qs[_0x9526('0x2f')](_['pick'](_0x55b75c[_0x9526('0x2d')],_0x5c3a08[_0x9526('0x2f')]));_0x294979[_0x9526('0x38')][_0x9526('0x56')]=_0x4592f9['id'];if(_0x55b75c['query'][_0x9526('0x3a')]){_0x294979[_0x9526('0x38')]=_[_0x9526('0x52')](_0x294979[_0x9526('0x38')],{'$or':_[_0x9526('0x29')](_0x294979[_0x9526('0x32')],function(_0x1cc328){var _0x3b0ec8={};_0x3b0ec8[_0x1cc328]={'$like':'%'+_0x55b75c[_0x9526('0x2d')][_0x9526('0x3a')]+'%'};return _0x3b0ec8;})});}_0x294979=_[_0x9526('0x52')]({},_0x294979,_0x55b75c[_0x9526('0x3c')]);return db['CmHopper'][_0x9526('0x3d')]({'where':_0x294979[_0x9526('0x38')]})[_0x9526('0x21')](function(_0x2d12cd){_0x5f21f0[_0x9526('0x3d')]=_0x2d12cd;if(_0x55b75c[_0x9526('0x2d')][_0x9526('0x3e')]){_0x294979[_0x9526('0x3f')]=[{'all':!![]}];}return db[_0x9526('0x55')]['findAll'](_0x294979);})[_0x9526('0x21')](function(_0xb0c8cd){_0x5f21f0[_0x9526('0x41')]=_0xb0c8cd;return _0x5f21f0;});}})[_0x9526('0x21')](respondWithFilteredResult(_0x283531,_0x294979))[_0x9526('0x42')](handleError(_0x283531,null));};exports['getHopperHistories']=function(_0x173260,_0x5c1f1f,_0x869f8b){var _0xc4606a={'raw':!![],'where':{}};var _0x3482bd={};var _0x2cf73f={'count':0x0,'rows':[]};return db[_0x9526('0x2a')][_0x9526('0x57')]({'where':{'id':_0x173260[_0x9526('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c1f1f,null))['then'](function(_0x336d92){if(_0x336d92){_0x3482bd[_0x9526('0x31')]=_[_0x9526('0x2e')](db[_0x9526('0x58')][_0x9526('0x2b')]);_0x3482bd['query']=_['keys'](_0x173260[_0x9526('0x2d')]);_0x3482bd[_0x9526('0x2f')]=_[_0x9526('0x30')](_0x3482bd['model'],_0x3482bd[_0x9526('0x2d')]);_0xc4606a['attributes']=_[_0x9526('0x30')](_0x3482bd['model'],qs['fields'](_0x173260[_0x9526('0x2d')]['fields']));_0xc4606a[_0x9526('0x32')]=_0xc4606a['attributes'][_0x9526('0x45')]?_0xc4606a[_0x9526('0x32')]:_0x3482bd['model'];if(!_0x173260[_0x9526('0x2d')][_0x9526('0x34')](_0x9526('0x35'))){_0xc4606a[_0x9526('0x1c')]=qs[_0x9526('0x1c')](_0x173260[_0x9526('0x2d')]['limit']);_0xc4606a['offset']=qs[_0x9526('0x1a')](_0x173260[_0x9526('0x2d')]['offset']);}_0xc4606a[_0x9526('0x36')]=qs['sort'](_0x173260[_0x9526('0x2d')][_0x9526('0x37')]);_0xc4606a[_0x9526('0x38')]=qs[_0x9526('0x2f')](_['pick'](_0x173260[_0x9526('0x2d')],_0x3482bd['filters']));_0xc4606a['where'][_0x9526('0x56')]=_0x336d92['id'];if(_0x173260[_0x9526('0x2d')][_0x9526('0x3a')]){_0xc4606a[_0x9526('0x38')]=_[_0x9526('0x52')](_0xc4606a[_0x9526('0x38')],{'$or':_[_0x9526('0x29')](_0xc4606a[_0x9526('0x32')],function(_0x2b53dc){var _0x3babdf={};_0x3babdf[_0x2b53dc]={'$like':'%'+_0x173260[_0x9526('0x2d')]['filter']+'%'};return _0x3babdf;})});}_0xc4606a=_[_0x9526('0x52')]({},_0xc4606a,_0x173260[_0x9526('0x3c')]);return db[_0x9526('0x58')][_0x9526('0x3d')]({'where':_0xc4606a['where']})['then'](function(_0xb8ef03){_0x2cf73f[_0x9526('0x3d')]=_0xb8ef03;if(_0x173260[_0x9526('0x2d')][_0x9526('0x3e')]){_0xc4606a['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0xc4606a);})[_0x9526('0x21')](function(_0x4c5eb4){_0x2cf73f[_0x9526('0x41')]=_0x4c5eb4;return _0x2cf73f;});}})[_0x9526('0x21')](respondWithFilteredResult(_0x5c1f1f,_0xc4606a))[_0x9526('0x42')](handleError(_0x5c1f1f,null));};exports[_0x9526('0x59')]=function(_0x136cce,_0x190c5e,_0x34f2b6){var _0x177337={'raw':!![],'where':{}};var _0x2cf0f5={};var _0x5f1903={'count':0x0,'rows':[]};return db[_0x9526('0x2a')][_0x9526('0x57')]({'where':{'id':_0x136cce[_0x9526('0x44')]['id']}})['then'](handleEntityNotFound(_0x190c5e,null))['then'](function(_0x5ceddb){if(_0x5ceddb){_0x2cf0f5[_0x9526('0x31')]=_[_0x9526('0x2e')](db[_0x9526('0x5a')][_0x9526('0x2b')]);_0x2cf0f5['query']=_[_0x9526('0x2e')](_0x136cce[_0x9526('0x2d')]);_0x2cf0f5[_0x9526('0x2f')]=_['intersection'](_0x2cf0f5[_0x9526('0x31')],_0x2cf0f5['query']);_0x177337[_0x9526('0x32')]=_['intersection'](_0x2cf0f5[_0x9526('0x31')],qs[_0x9526('0x33')](_0x136cce[_0x9526('0x2d')][_0x9526('0x33')]));_0x177337[_0x9526('0x32')]=_0x177337[_0x9526('0x32')][_0x9526('0x45')]?_0x177337['attributes']:_0x2cf0f5['model'];if(!_0x136cce[_0x9526('0x2d')]['hasOwnProperty'](_0x9526('0x35'))){_0x177337[_0x9526('0x1c')]=qs[_0x9526('0x1c')](_0x136cce['query'][_0x9526('0x1c')]);_0x177337['offset']=qs['offset'](_0x136cce[_0x9526('0x2d')]['offset']);}_0x177337[_0x9526('0x36')]=qs[_0x9526('0x37')](_0x136cce[_0x9526('0x2d')][_0x9526('0x37')]);_0x177337[_0x9526('0x38')]=qs[_0x9526('0x2f')](_['pick'](_0x136cce[_0x9526('0x2d')],_0x2cf0f5['filters']));_0x177337[_0x9526('0x38')][_0x9526('0x56')]=_0x5ceddb['id'];if(_0x136cce[_0x9526('0x2d')][_0x9526('0x3a')]){_0x177337[_0x9526('0x38')]=_[_0x9526('0x52')](_0x177337[_0x9526('0x38')],{'$or':_[_0x9526('0x29')](_0x177337['attributes'],function(_0x84e72d){var _0x4e6fb6={};_0x4e6fb6[_0x84e72d]={'$like':'%'+_0x136cce[_0x9526('0x2d')][_0x9526('0x3a')]+'%'};return _0x4e6fb6;})});}_0x177337=_[_0x9526('0x52')]({},_0x177337,_0x136cce[_0x9526('0x3c')]);return db[_0x9526('0x5a')][_0x9526('0x3d')]({'where':_0x177337[_0x9526('0x38')]})[_0x9526('0x21')](function(_0x49ccec){_0x5f1903[_0x9526('0x3d')]=_0x49ccec;if(_0x136cce[_0x9526('0x2d')][_0x9526('0x3e')]){_0x177337['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x9526('0x40')](_0x177337);})[_0x9526('0x21')](function(_0x1d1aa1){_0x5f1903[_0x9526('0x41')]=_0x1d1aa1;return _0x5f1903;});}})['then'](respondWithFilteredResult(_0x190c5e,_0x177337))[_0x9526('0x42')](handleError(_0x190c5e,null));};exports[_0x9526('0x5b')]=function(_0x23043c,_0x42f427,_0xa88de0){var _0x1105f4={'raw':!![],'where':{}};var _0x48ce02={};var _0x291531={'count':0x0,'rows':[]};return db['Campaign'][_0x9526('0x57')]({'where':{'id':_0x23043c['params']['id']}})[_0x9526('0x21')](handleEntityNotFound(_0x42f427,null))[_0x9526('0x21')](function(_0x2a5243){if(_0x2a5243){_0x48ce02[_0x9526('0x31')]=_[_0x9526('0x2e')](db[_0x9526('0x5c')][_0x9526('0x2b')]);_0x48ce02[_0x9526('0x2d')]=_[_0x9526('0x2e')](_0x23043c[_0x9526('0x2d')]);_0x48ce02[_0x9526('0x2f')]=_[_0x9526('0x30')](_0x48ce02[_0x9526('0x31')],_0x48ce02[_0x9526('0x2d')]);_0x1105f4[_0x9526('0x32')]=_[_0x9526('0x30')](_0x48ce02[_0x9526('0x31')],qs[_0x9526('0x33')](_0x23043c[_0x9526('0x2d')][_0x9526('0x33')]));_0x1105f4[_0x9526('0x32')]=_0x1105f4['attributes'][_0x9526('0x45')]?_0x1105f4[_0x9526('0x32')]:_0x48ce02['model'];if(!_0x23043c[_0x9526('0x2d')][_0x9526('0x34')]('nolimit')){_0x1105f4['limit']=qs[_0x9526('0x1c')](_0x23043c[_0x9526('0x2d')][_0x9526('0x1c')]);_0x1105f4[_0x9526('0x1a')]=qs[_0x9526('0x1a')](_0x23043c[_0x9526('0x2d')][_0x9526('0x1a')]);}_0x1105f4[_0x9526('0x36')]=qs[_0x9526('0x37')](_0x23043c['query']['sort']);_0x1105f4[_0x9526('0x38')]=qs[_0x9526('0x2f')](_[_0x9526('0x39')](_0x23043c[_0x9526('0x2d')],_0x48ce02['filters']));_0x1105f4[_0x9526('0x38')][_0x9526('0x56')]=_0x2a5243['id'];if(_0x23043c[_0x9526('0x2d')][_0x9526('0x3a')]){_0x1105f4[_0x9526('0x38')]=_[_0x9526('0x52')](_0x1105f4[_0x9526('0x38')],{'$or':_['map'](_0x1105f4[_0x9526('0x32')],function(_0x5de08c){var _0xf47c33={};_0xf47c33[_0x5de08c]={'$like':'%'+_0x23043c[_0x9526('0x2d')][_0x9526('0x3a')]+'%'};return _0xf47c33;})});}_0x1105f4=_[_0x9526('0x52')]({},_0x1105f4,_0x23043c['options']);return db[_0x9526('0x5c')][_0x9526('0x3d')]({'where':_0x1105f4[_0x9526('0x38')]})[_0x9526('0x21')](function(_0x5d889e){_0x291531[_0x9526('0x3d')]=_0x5d889e;if(_0x23043c['query'][_0x9526('0x3e')]){_0x1105f4[_0x9526('0x3f')]=[{'all':!![]}];}return db[_0x9526('0x5c')][_0x9526('0x40')](_0x1105f4);})[_0x9526('0x21')](function(_0x42a6c8){_0x291531['rows']=_0x42a6c8;return _0x291531;});}})['then'](respondWithFilteredResult(_0x42f427,_0x1105f4))[_0x9526('0x42')](handleError(_0x42f427,null));};exports[_0x9526('0x5d')]=function(_0x206245,_0xa27735,_0x2ef658){var _0x2127bc={};var _0x4147c3={};var _0x45af0c;var _0x569065;return db[_0x9526('0x2a')][_0x9526('0x57')]({'where':{'id':_0x206245[_0x9526('0x44')]['id']}})['then'](handleEntityNotFound(_0xa27735,null))[_0x9526('0x21')](function(_0x257ca6){if(_0x257ca6){_0x45af0c=_0x257ca6;_0x4147c3['model']=_['keys'](db[_0x9526('0x5e')][_0x9526('0x2b')]);_0x4147c3['query']=_[_0x9526('0x2e')](_0x206245[_0x9526('0x2d')]);_0x4147c3['filters']=_[_0x9526('0x30')](_0x4147c3[_0x9526('0x31')],_0x4147c3[_0x9526('0x2d')]);_0x2127bc['attributes']=_['intersection'](_0x4147c3['model'],qs['fields'](_0x206245[_0x9526('0x2d')][_0x9526('0x33')]));_0x2127bc[_0x9526('0x32')]=_0x2127bc[_0x9526('0x32')][_0x9526('0x45')]?_0x2127bc[_0x9526('0x32')]:_0x4147c3[_0x9526('0x31')];_0x2127bc[_0x9526('0x36')]=qs[_0x9526('0x37')](_0x206245['query'][_0x9526('0x37')]);_0x2127bc[_0x9526('0x38')]=qs[_0x9526('0x2f')](_[_0x9526('0x39')](_0x206245[_0x9526('0x2d')],_0x4147c3[_0x9526('0x2f')]));if(_0x206245[_0x9526('0x2d')][_0x9526('0x3a')]){_0x2127bc['where']=_['merge'](_0x2127bc[_0x9526('0x38')],{'$or':_[_0x9526('0x29')](_0x2127bc[_0x9526('0x32')],function(_0x59c537){var _0x30294d={};_0x30294d[_0x59c537]={'$like':'%'+_0x206245['query']['filter']+'%'};return _0x30294d;})});}_0x2127bc=_[_0x9526('0x52')]({},_0x2127bc,_0x206245[_0x9526('0x3c')]);return _0x45af0c['getLists'](_0x2127bc);}})[_0x9526('0x21')](function(_0x4d64e7){if(_0x4d64e7){_0x569065=_0x4d64e7[_0x9526('0x45')];if(!_0x206245['query']['hasOwnProperty'](_0x9526('0x35'))){_0x2127bc[_0x9526('0x1c')]=qs[_0x9526('0x1c')](_0x206245[_0x9526('0x2d')][_0x9526('0x1c')]);_0x2127bc[_0x9526('0x1a')]=qs['offset'](_0x206245['query'][_0x9526('0x1a')]);}return _0x45af0c[_0x9526('0x5d')](_0x2127bc);}})['then'](function(_0x1cb15b){if(_0x1cb15b){return _0x1cb15b?{'count':_0x569065,'rows':_0x1cb15b}:null;}})[_0x9526('0x21')](respondWithResult(_0xa27735,null))[_0x9526('0x42')](handleError(_0xa27735,null));};exports[_0x9526('0x5f')]=function(_0x2394d8,_0x39c1bc,_0x280d0c){var _0x58dc92,_0x42bbb0;var _0x473cb3=[];var _0x393a7c=moment()[_0x9526('0x60')](_0x9526('0x61'));return db[_0x9526('0x2a')][_0x9526('0x46')]({'where':{'id':_0x2394d8[_0x9526('0x44')]['id']}})[_0x9526('0x21')](handleEntityNotFound(_0x39c1bc,null))['then'](function(_0x42ae7d){if(_0x42ae7d){_0x42bbb0=_0x42ae7d;return _0x42ae7d[_0x9526('0x5f')](_0x2394d8[_0x9526('0x48')][_0x9526('0x62')],_[_0x9526('0x4f')](_0x2394d8['body'],[_0x9526('0x62'),'id'])||{});}return null;})[_0x9526('0x63')](function(_0xcc0ce7){var _0x5e8c2b;var _0x2916e4;_0x58dc92=_0xcc0ce7||[];var _0x2a0c82=[];if(_0xcc0ce7){for(var _0x58c066=0x0;_0x58c066<_0xcc0ce7[_0x9526('0x45')];_0x58c066+=0x1){var _0x1360bd=_0xcc0ce7[_0x58c066][_0x9526('0x22')]({'plain':!![]});_0x42bbb0[_0x9526('0x64')]=_0x2394d8['body'][_0x9526('0x64')]?_0x2394d8[_0x9526('0x48')]['dialCheckDuplicateType']:_0x42bbb0[_0x9526('0x64')];switch(_0x42bbb0[_0x9526('0x64')]){case _0x9526('0x65'):_0x5e8c2b=squel[_0x9526('0x66')]()[_0x9526('0x67')](_0x9526('0x68'))['fromQuery']([_0x9526('0x69'),'scheduledAt',_0x9526('0x6a'),_0x9526('0x6b'),_0x9526('0x56'),'createdAt',_0x9526('0x51')],squel[_0x9526('0x6c')]()[_0x9526('0x6d')](_0x9526('0x69'),_0x9526('0x69'))[_0x9526('0x6d')](_0x9526('0x6e'),_0x9526('0x6f'))['field']('id',_0x9526('0x6a'))[_0x9526('0x6d')](_0x1360bd[_0x9526('0x70')][_0x9526('0x71')](),_0x9526('0x6b'))[_0x9526('0x6d')](_0x2394d8[_0x9526('0x44')]['id'][_0x9526('0x71')](),_0x9526('0x56'))[_0x9526('0x6d')]('\x27'+_0x393a7c+'\x27','createdAt')[_0x9526('0x6d')]('\x27'+_0x393a7c+'\x27',_0x9526('0x51'))[_0x9526('0x72')](_0x9526('0x73'))[_0x9526('0x38')](_0x9526('0x74'))[_0x9526('0x38')](_0x9526('0x75'),_0x1360bd['CmListId'][_0x9526('0x71')]())['where'](_0x9526('0x76'))[_0x9526('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9526('0x6c')]()[_0x9526('0x6d')](_0x9526('0x77'))['from'](_0x9526('0x78'))[_0x9526('0x38')]('CampaignId\x20=\x20?',_0x2394d8[_0x9526('0x44')]['id'][_0x9526('0x71')]()))[_0x9526('0x38')](_0x9526('0x79'),squel[_0x9526('0x6c')]()[_0x9526('0x6d')](_0x9526('0x7a'))[_0x9526('0x72')](_0x9526('0x68'))['where'](_0x9526('0x7b'),_0x2394d8[_0x9526('0x44')]['id'][_0x9526('0x71')]())))[_0x9526('0x71')]();break;case _0x9526('0x7c'):_0x5e8c2b=squel[_0x9526('0x66')]()['into'](_0x9526('0x68'))['fromQuery'](['phone',_0x9526('0x6f'),'ContactId',_0x9526('0x6b'),_0x9526('0x56'),'createdAt','updatedAt'],squel[_0x9526('0x6c')]()[_0x9526('0x6d')](_0x9526('0x69'),'phone')[_0x9526('0x6d')](_0x9526('0x6e'),_0x9526('0x6f'))[_0x9526('0x6d')]('id','ContactId')[_0x9526('0x6d')](_0x1360bd[_0x9526('0x70')][_0x9526('0x71')](),'ListId')[_0x9526('0x6d')](_0x2394d8[_0x9526('0x44')]['id']['toString'](),'CampaignId')[_0x9526('0x6d')]('\x27'+_0x393a7c+'\x27',_0x9526('0x50'))[_0x9526('0x6d')]('\x27'+_0x393a7c+'\x27',_0x9526('0x51'))[_0x9526('0x72')]('cm_contacts')[_0x9526('0x38')](_0x9526('0x74'))[_0x9526('0x38')](_0x9526('0x75'),_0x1360bd['CmListId'][_0x9526('0x71')]())[_0x9526('0x38')](_0x9526('0x76'))[_0x9526('0x38')](_0x9526('0x79'),squel['select']()[_0x9526('0x6d')](_0x9526('0x7a'))['from']('cm_hopper')[_0x9526('0x38')](_0x9526('0x7b'),_0x2394d8[_0x9526('0x44')]['id'][_0x9526('0x71')]())))[_0x9526('0x71')]();break;default:_0x5e8c2b=squel[_0x9526('0x66')]()[_0x9526('0x67')]('cm_hopper')[_0x9526('0x7d')]([_0x9526('0x69'),_0x9526('0x6f'),_0x9526('0x6a'),_0x9526('0x6b'),_0x9526('0x56'),_0x9526('0x50'),'updatedAt'],squel[_0x9526('0x6c')]()[_0x9526('0x6d')](_0x9526('0x69'),_0x9526('0x69'))['field'](_0x9526('0x6e'),_0x9526('0x6f'))[_0x9526('0x6d')]('id','ContactId')[_0x9526('0x6d')](_0x1360bd[_0x9526('0x70')][_0x9526('0x71')](),_0x9526('0x6b'))[_0x9526('0x6d')](_0x2394d8[_0x9526('0x44')]['id']['toString'](),_0x9526('0x56'))[_0x9526('0x6d')]('\x27'+_0x393a7c+'\x27',_0x9526('0x50'))[_0x9526('0x6d')]('\x27'+_0x393a7c+'\x27',_0x9526('0x51'))[_0x9526('0x72')](_0x9526('0x73'))[_0x9526('0x38')](_0x9526('0x74'))[_0x9526('0x38')](_0x9526('0x75'),_0x1360bd[_0x9526('0x70')][_0x9526('0x71')]())[_0x9526('0x38')](_0x9526('0x76')))[_0x9526('0x71')]();}_0x2916e4=squel[_0x9526('0x66')]()[_0x9526('0x67')]('cm_hopper_additional_phones')[_0x9526('0x7d')](['cmHopperId',_0x9526('0x6f'),_0x9526('0x69'),_0x9526('0x7e'),_0x9526('0x50'),_0x9526('0x51')],squel[_0x9526('0x6c')]()[_0x9526('0x6d')](_0x9526('0x7f'),'id')[_0x9526('0x6d')](_0x9526('0x6e'),_0x9526('0x6f'))['field'](_0x9526('0x80'),'phone')[_0x9526('0x6d')](_0x9526('0x81'),_0x9526('0x7e'))[_0x9526('0x6d')]('\x27'+_0x393a7c+'\x27',_0x9526('0x50'))[_0x9526('0x6d')]('\x27'+_0x393a7c+'\x27','updatedAt')[_0x9526('0x72')](_0x9526('0x82'),'ci')[_0x9526('0x83')](_0x9526('0x68'),'h',_0x9526('0x84'))['where']('h.ListId\x20=\x20?',_0x1360bd[_0x9526('0x70')][_0x9526('0x71')]())[_0x9526('0x38')](_0x9526('0x85'),_0x2394d8[_0x9526('0x44')]['id'][_0x9526('0x71')]())[_0x9526('0x38')](_0x9526('0x86'),_0x393a7c))[_0x9526('0x71')]();_0x2a0c82[_0x9526('0x87')](db['sequelize']['query'](_0x5e8c2b));_0x473cb3['push'](db[_0x9526('0x88')]['query'](_0x2916e4));}return BPromise[_0x9526('0x89')](_0x2a0c82);}})[_0x9526('0x21')](function(){return BPromise['all'](_0x473cb3);})[_0x9526('0x21')](function(){return _0x58dc92;})[_0x9526('0x21')](respondWithResult(_0x39c1bc,null))[_0x9526('0x42')](handleError(_0x39c1bc,null));};exports[_0x9526('0x8a')]=function(_0x4ec58c,_0x5e5afd,_0x2e6015){return db['Campaign'][_0x9526('0x46')]({'where':{'id':_0x4ec58c['params']['id']}})['then'](handleEntityNotFound(_0x5e5afd,null))[_0x9526('0x21')](function(_0x513bd3){if(_0x513bd3){return _0x513bd3[_0x9526('0x8a')](_0x4ec58c['query'][_0x9526('0x62')]);}})[_0x9526('0x21')](function(_0x4abe09){if(_0x4abe09){return db[_0x9526('0x55')]['destroy']({'where':{'ListId':_0x4ec58c[_0x9526('0x2d')][_0x9526('0x62')],'CampaignId':_0x4ec58c[_0x9526('0x44')]['id']}})[_0x9526('0x21')](function(){return _0x4abe09;});}})[_0x9526('0x21')](respondWithStatusCode(_0x5e5afd,null))['catch'](handleError(_0x5e5afd,null));};exports['getBlackLists']=function(_0x4fbd6d,_0x14213a,_0x137bf9){var _0x55b70f={};var _0x23460a={};var _0x2f2a3d;var _0x5cbe79;return db['Campaign'][_0x9526('0x57')]({'where':{'id':_0x4fbd6d[_0x9526('0x44')]['id']}})[_0x9526('0x21')](handleEntityNotFound(_0x14213a,null))[_0x9526('0x21')](function(_0x413cf7){if(_0x413cf7){_0x2f2a3d=_0x413cf7;_0x23460a['model']=_[_0x9526('0x2e')](db[_0x9526('0x5e')]['rawAttributes']);_0x23460a[_0x9526('0x2d')]=_[_0x9526('0x2e')](_0x4fbd6d[_0x9526('0x2d')]);_0x23460a['filters']=_[_0x9526('0x30')](_0x23460a['model'],_0x23460a[_0x9526('0x2d')]);_0x55b70f['attributes']=_[_0x9526('0x30')](_0x23460a[_0x9526('0x31')],qs[_0x9526('0x33')](_0x4fbd6d['query'][_0x9526('0x33')]));_0x55b70f[_0x9526('0x32')]=_0x55b70f[_0x9526('0x32')][_0x9526('0x45')]?_0x55b70f[_0x9526('0x32')]:_0x23460a[_0x9526('0x31')];_0x55b70f[_0x9526('0x36')]=qs[_0x9526('0x37')](_0x4fbd6d['query']['sort']);_0x55b70f[_0x9526('0x38')]=qs['filters'](_[_0x9526('0x39')](_0x4fbd6d[_0x9526('0x2d')],_0x23460a[_0x9526('0x2f')]));if(_0x4fbd6d['query']['filter']){_0x55b70f[_0x9526('0x38')]=_[_0x9526('0x52')](_0x55b70f[_0x9526('0x38')],{'$or':_[_0x9526('0x29')](_0x55b70f[_0x9526('0x32')],function(_0x44a3a6){var _0x251e6d={};_0x251e6d[_0x44a3a6]={'$like':'%'+_0x4fbd6d['query']['filter']+'%'};return _0x251e6d;})});}_0x55b70f=_['merge']({},_0x55b70f,_0x4fbd6d[_0x9526('0x3c')]);return _0x2f2a3d[_0x9526('0x8b')](_0x55b70f);}})[_0x9526('0x21')](function(_0x1016b2){if(_0x1016b2){_0x5cbe79=_0x1016b2[_0x9526('0x45')];if(!_0x4fbd6d[_0x9526('0x2d')]['hasOwnProperty'](_0x9526('0x35'))){_0x55b70f['limit']=qs['limit'](_0x4fbd6d[_0x9526('0x2d')]['limit']);_0x55b70f[_0x9526('0x1a')]=qs[_0x9526('0x1a')](_0x4fbd6d[_0x9526('0x2d')][_0x9526('0x1a')]);}return _0x2f2a3d[_0x9526('0x8b')](_0x55b70f);}})[_0x9526('0x21')](function(_0x43c05f){if(_0x43c05f){return _0x43c05f?{'count':_0x5cbe79,'rows':_0x43c05f}:null;}})['then'](respondWithResult(_0x14213a,null))[_0x9526('0x42')](handleError(_0x14213a,null));};exports[_0x9526('0x8c')]=function(_0x20661f,_0x47cc5f,_0x3bfc98){var _0x2102d0,_0x5c7f0c;var _0x2ee75f=[];var _0x21d2f8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0x9526('0x2a')]['find']({'where':{'id':_0x20661f[_0x9526('0x44')]['id']}})[_0x9526('0x21')](handleEntityNotFound(_0x47cc5f,null))[_0x9526('0x21')](function(_0x403128){if(_0x403128){_0x5c7f0c=_0x403128;return _0x403128[_0x9526('0x8c')](_0x20661f[_0x9526('0x48')][_0x9526('0x62')],_['omit'](_0x20661f[_0x9526('0x48')],[_0x9526('0x62'),'id'])||{});}return null;})[_0x9526('0x63')](function(_0x49ba38){var _0xa40d03;var _0x39c35f;_0x2102d0=_0x49ba38||[];var _0x49fb53=[];if(_0x49ba38){for(var _0x2ae9d0=0x0;_0x2ae9d0<_0x49ba38[_0x9526('0x45')];_0x2ae9d0+=0x1){var _0x161243=_0x49ba38[_0x2ae9d0][_0x9526('0x22')]({'plain':!![]});_0xa40d03=squel[_0x9526('0x66')]()[_0x9526('0x67')](_0x9526('0x8d'))[_0x9526('0x7d')]([_0x9526('0x69'),_0x9526('0x6a'),_0x9526('0x6b'),_0x9526('0x56'),'createdAt','updatedAt'],squel['select']()['field'](_0x9526('0x69'),_0x9526('0x69'))[_0x9526('0x6d')]('id',_0x9526('0x6a'))['field'](_0x161243[_0x9526('0x70')]['toString'](),_0x9526('0x6b'))[_0x9526('0x6d')](_0x20661f[_0x9526('0x44')]['id'][_0x9526('0x71')](),_0x9526('0x56'))[_0x9526('0x6d')](_0x9526('0x6e'),'createdAt')['field'](_0x9526('0x6e'),_0x9526('0x51'))[_0x9526('0x72')](_0x9526('0x73'))[_0x9526('0x38')]('deletedAt\x20IS\x20NULL')['where'](_0x9526('0x75'),_0x161243[_0x9526('0x70')][_0x9526('0x71')]())['where'](_0x9526('0x76')))[_0x9526('0x71')]();_0x49fb53[_0x9526('0x87')](db[_0x9526('0x88')]['query'](_0xa40d03));}return BPromise[_0x9526('0x89')](_0x49fb53);}})['then'](function(){return _0x2102d0;})[_0x9526('0x21')](respondWithResult(_0x47cc5f,null))[_0x9526('0x42')](handleError(_0x47cc5f,null));};exports[_0x9526('0x8e')]=function(_0x25aeb4,_0x51db5b,_0x2796e0){return db[_0x9526('0x2a')][_0x9526('0x46')]({'where':{'id':_0x25aeb4[_0x9526('0x44')]['id']}})[_0x9526('0x21')](handleEntityNotFound(_0x51db5b,null))[_0x9526('0x21')](function(_0x5bd539){if(_0x5bd539){return _0x5bd539[_0x9526('0x8e')](_0x25aeb4[_0x9526('0x2d')][_0x9526('0x62')]);}})['then'](function(_0x42d034){if(_0x42d034){return db[_0x9526('0x5c')][_0x9526('0x20')]({'where':{'ListId':_0x25aeb4[_0x9526('0x2d')][_0x9526('0x62')],'CampaignId':_0x25aeb4['params']['id']}})['then'](function(){return _0x42d034;});}})[_0x9526('0x21')](respondWithStatusCode(_0x51db5b,null))[_0x9526('0x42')](handleError(_0x51db5b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index c05a4c7..a8198e7 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(_0x4ae5e4,_0x101e79){var _0x46ba7b=function(_0x3c8b75){while(--_0x3c8b75){_0x4ae5e4['push'](_0x4ae5e4['shift']());}};_0x46ba7b(++_0x101e79);}(_0x7a54,0x106));var _0x47a5=function(_0x34f301,_0x3c1a5f){_0x34f301=_0x34f301-0x0;var _0x2af0de=_0x7a54[_0x34f301];return _0x2af0de;};'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(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 72dbe6f..d465d44 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 _0x45ea=['Campaign,\x20%s,\x20%s','result','catch','GetCampaign','Campaign','findAll','options','raw','where','limit','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x45ea,0x1f0));var _0xa45e=function(_0x189e5e,_0x2a2c91){_0x189e5e=_0x189e5e-0x0;var _0x1a2c79=_0x45ea[_0x189e5e];return _0x1a2c79;};'use strict';var _=require(_0xa45e('0x0'));var util=require(_0xa45e('0x1'));var moment=require(_0xa45e('0x2'));var BPromise=require(_0xa45e('0x3'));var rs=require(_0xa45e('0x4'));var fs=require('fs');var Redis=require(_0xa45e('0x5'));var db=require(_0xa45e('0x6'))['db'];var utils=require(_0xa45e('0x7'));var logger=require(_0xa45e('0x8'))(_0xa45e('0x9'));var config=require(_0xa45e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa45e('0xb')][_0xa45e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x573ff8,_0x53dd85,_0x479cd8){return new BPromise(function(_0x40befe,_0x350f60){return client[_0xa45e('0xd')](_0x573ff8,_0x479cd8)[_0xa45e('0xe')](function(_0x2d73b0){logger['info']('Campaign,\x20%s,\x20%s',_0x53dd85,_0xa45e('0xf'));logger[_0xa45e('0x10')](_0xa45e('0x11'),_0x53dd85,_0xa45e('0xf'),JSON['stringify'](_0x2d73b0));if(_0x2d73b0[_0xa45e('0x12')]){if(_0x2d73b0['error'][_0xa45e('0x13')]===0x1f4){logger[_0xa45e('0x12')]('Campaign,\x20%s,\x20%s',_0x53dd85,_0x2d73b0['error'][_0xa45e('0x14')]);return _0x350f60(_0x2d73b0['error'][_0xa45e('0x14')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x53dd85,_0x2d73b0['error'][_0xa45e('0x14')]);return _0x40befe(_0x2d73b0['error'][_0xa45e('0x14')]);}else{logger[_0xa45e('0x15')](_0xa45e('0x16'),_0x53dd85,_0xa45e('0xf'));_0x40befe(_0x2d73b0[_0xa45e('0x17')]['message']);}})[_0xa45e('0x18')](function(_0x1eeb1d){logger[_0xa45e('0x12')](_0xa45e('0x16'),_0x53dd85,_0x1eeb1d);_0x350f60(_0x1eeb1d);});});}exports[_0xa45e('0x19')]=function(_0x534e87){var _0x34b6c8=this;return new Promise(function(_0x8e85c1,_0xa7a6f4){return db[_0xa45e('0x1a')][_0xa45e('0x1b')]({'raw':_0x534e87[_0xa45e('0x1c')]?_0x534e87[_0xa45e('0x1c')][_0xa45e('0x1d')]===undefined?!![]:![]:!![],'where':_0x534e87['options']?_0x534e87[_0xa45e('0x1c')][_0xa45e('0x1e')]||null:null,'attributes':_0x534e87[_0xa45e('0x1c')]?_0x534e87['options']['attributes']||null:null,'limit':_0x534e87[_0xa45e('0x1c')]?_0x534e87['options'][_0xa45e('0x1f')]||null:null,'include':_0x534e87[_0xa45e('0x1c')]?_0x534e87[_0xa45e('0x1c')][_0xa45e('0x20')]?_[_0xa45e('0x21')](_0x534e87['options'][_0xa45e('0x20')],function(_0x54f14d){return{'model':db[_0x54f14d[_0xa45e('0x22')]],'as':_0x54f14d['as'],'attributes':_0x54f14d[_0xa45e('0x23')],'include':_0x54f14d['include']?_['map'](_0x54f14d[_0xa45e('0x20')],function(_0x5aec7d){return{'model':db[_0x5aec7d[_0xa45e('0x22')]],'as':_0x5aec7d['as'],'attributes':_0x5aec7d[_0xa45e('0x23')],'include':_0x5aec7d[_0xa45e('0x20')]?_['map'](_0x5aec7d['include'],function(_0x2c7c9e){return{'model':db[_0x2c7c9e[_0xa45e('0x22')]],'as':_0x2c7c9e['as'],'attributes':_0x2c7c9e[_0xa45e('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa45e('0xe')](function(_0x78a762){logger['info'](_0xa45e('0x19'),_0x534e87);logger[_0xa45e('0x10')]('GetCampaign',_0x534e87,JSON[_0xa45e('0x24')](_0x78a762));_0x8e85c1(_0x78a762);})['catch'](function(_0x552cb5){logger[_0xa45e('0x12')](_0xa45e('0x19'),_0x552cb5['message'],_0x534e87);_0xa7a6f4(_0x34b6c8['error'](0x1f4,_0x552cb5[_0xa45e('0x14')]));});});}; \ No newline at end of file +var _0x6e77=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','include','map','model','info','util'];(function(_0x1274f5,_0x3ddb6b){var _0x5542db=function(_0x225c69){while(--_0x225c69){_0x1274f5['push'](_0x1274f5['shift']());}};_0x5542db(++_0x3ddb6b);}(_0x6e77,0xef));var _0x76e7=function(_0x42ac42,_0x6e6a4b){_0x42ac42=_0x42ac42-0x0;var _0x50dc84=_0x6e77[_0x42ac42];return _0x50dc84;};'use strict';var _=require('lodash');var util=require(_0x76e7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x76e7('0x1'));var fs=require('fs');var Redis=require(_0x76e7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x76e7('0x3'));var logger=require(_0x76e7('0x4'))(_0x76e7('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76e7('0x6')][_0x76e7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xac49d0,_0x5a5e94,_0x433ae3){return new BPromise(function(_0x464a99,_0x4ab2ff){return client['request'](_0xac49d0,_0x433ae3)[_0x76e7('0x8')](function(_0x2b2f4f){logger['info'](_0x76e7('0x9'),_0x5a5e94,_0x76e7('0xa'));logger[_0x76e7('0xb')](_0x76e7('0xc'),_0x5a5e94,'request\x20sent',JSON[_0x76e7('0xd')](_0x2b2f4f));if(_0x2b2f4f[_0x76e7('0xe')]){if(_0x2b2f4f[_0x76e7('0xe')][_0x76e7('0xf')]===0x1f4){logger[_0x76e7('0xe')](_0x76e7('0x9'),_0x5a5e94,_0x2b2f4f[_0x76e7('0xe')][_0x76e7('0x10')]);return _0x4ab2ff(_0x2b2f4f[_0x76e7('0xe')][_0x76e7('0x10')]);}logger[_0x76e7('0xe')]('Campaign,\x20%s,\x20%s',_0x5a5e94,_0x2b2f4f[_0x76e7('0xe')]['message']);return _0x464a99(_0x2b2f4f[_0x76e7('0xe')][_0x76e7('0x10')]);}else{logger['info'](_0x76e7('0x9'),_0x5a5e94,_0x76e7('0xa'));_0x464a99(_0x2b2f4f[_0x76e7('0x11')][_0x76e7('0x10')]);}})[_0x76e7('0x12')](function(_0x333466){logger[_0x76e7('0xe')]('Campaign,\x20%s,\x20%s',_0x5a5e94,_0x333466);_0x4ab2ff(_0x333466);});});}exports[_0x76e7('0x13')]=function(_0x5d54fd){var _0x91d06e=this;return new Promise(function(_0x29424b,_0x31cec6){return db[_0x76e7('0x14')][_0x76e7('0x15')]({'raw':_0x5d54fd['options']?_0x5d54fd[_0x76e7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5d54fd[_0x76e7('0x16')]?_0x5d54fd[_0x76e7('0x16')][_0x76e7('0x17')]||null:null,'attributes':_0x5d54fd[_0x76e7('0x16')]?_0x5d54fd[_0x76e7('0x16')][_0x76e7('0x18')]||null:null,'limit':_0x5d54fd[_0x76e7('0x16')]?_0x5d54fd[_0x76e7('0x16')][_0x76e7('0x19')]||null:null,'include':_0x5d54fd[_0x76e7('0x16')]?_0x5d54fd[_0x76e7('0x16')][_0x76e7('0x1a')]?_[_0x76e7('0x1b')](_0x5d54fd[_0x76e7('0x16')]['include'],function(_0x11afe6){return{'model':db[_0x11afe6['model']],'as':_0x11afe6['as'],'attributes':_0x11afe6[_0x76e7('0x18')],'include':_0x11afe6[_0x76e7('0x1a')]?_[_0x76e7('0x1b')](_0x11afe6[_0x76e7('0x1a')],function(_0x4c1bf7){return{'model':db[_0x4c1bf7[_0x76e7('0x1c')]],'as':_0x4c1bf7['as'],'attributes':_0x4c1bf7[_0x76e7('0x18')],'include':_0x4c1bf7['include']?_[_0x76e7('0x1b')](_0x4c1bf7[_0x76e7('0x1a')],function(_0x38238c){return{'model':db[_0x38238c[_0x76e7('0x1c')]],'as':_0x38238c['as'],'attributes':_0x38238c['attributes']};}):[]};}):[]};}):[]:[]})[_0x76e7('0x8')](function(_0x1a3f15){logger[_0x76e7('0x1d')](_0x76e7('0x13'),_0x5d54fd);logger[_0x76e7('0xb')](_0x76e7('0x13'),_0x5d54fd,JSON[_0x76e7('0xd')](_0x1a3f15));_0x29424b(_0x1a3f15);})[_0x76e7('0x12')](function(_0x10d6c6){logger[_0x76e7('0xe')]('GetCampaign',_0x10d6c6[_0x76e7('0x10')],_0x5d54fd);_0x31cec6(_0x91d06e['error'](0x1f4,_0x10d6c6[_0x76e7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index c0325c0..9da9ec2 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 _0xa450=['index','get','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','post','create','/:id/clone','addLists','addBlackLists','put','/:id','update','delete','destroy','removeLists','/:id/blacklists','removeBlackLists','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','isAuthenticated'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa450,0x16d));var _0x0a45=function(_0x3bd05a,_0x273bb3){_0x3bd05a=_0x3bd05a-0x0;var _0x5c83c2=_0xa450[_0x3bd05a];return _0x5c83c2;};'use strict';var multer=require(_0x0a45('0x0'));var util=require(_0x0a45('0x1'));var path=require(_0x0a45('0x2'));var timeout=require(_0x0a45('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0a45('0x4'));var auth=require(_0x0a45('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0a45('0x6'));var controller=require(_0x0a45('0x7'));router['get']('/',auth[_0x0a45('0x8')](),controller[_0x0a45('0x9')]);router[_0x0a45('0xa')]('/:id',auth[_0x0a45('0x8')](),controller[_0x0a45('0xb')]);router[_0x0a45('0xa')](_0x0a45('0xc'),auth['isAuthenticated'](),controller[_0x0a45('0xd')]);router[_0x0a45('0xa')](_0x0a45('0xe'),auth[_0x0a45('0x8')](),controller[_0x0a45('0xf')]);router[_0x0a45('0xa')]('/:id/hopper_finals',auth[_0x0a45('0x8')](),controller[_0x0a45('0x10')]);router[_0x0a45('0xa')](_0x0a45('0x11'),auth[_0x0a45('0x8')](),controller[_0x0a45('0x12')]);router[_0x0a45('0xa')](_0x0a45('0x13'),auth[_0x0a45('0x8')](),controller['getLists']);router['get']('/:id/blacklists',auth[_0x0a45('0x8')](),controller['getBlackLists']);router[_0x0a45('0x14')]('/',auth[_0x0a45('0x8')](),controller[_0x0a45('0x15')]);router[_0x0a45('0x14')](_0x0a45('0x16'),auth[_0x0a45('0x8')](),controller['clone']);router[_0x0a45('0x14')](_0x0a45('0x13'),auth[_0x0a45('0x8')](),controller[_0x0a45('0x17')]);router[_0x0a45('0x14')]('/:id/blacklists',auth[_0x0a45('0x8')](),controller[_0x0a45('0x18')]);router[_0x0a45('0x19')](_0x0a45('0x1a'),auth[_0x0a45('0x8')](),controller[_0x0a45('0x1b')]);router[_0x0a45('0x1c')](_0x0a45('0x1a'),auth[_0x0a45('0x8')](),controller[_0x0a45('0x1d')]);router[_0x0a45('0x1c')](_0x0a45('0x13'),auth[_0x0a45('0x8')](),controller[_0x0a45('0x1e')]);router[_0x0a45('0x1c')](_0x0a45('0x1f'),auth[_0x0a45('0x8')](),controller[_0x0a45('0x20')]);module[_0x0a45('0x21')]=router; \ No newline at end of file +var _0xb16b=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/lists','/:id/blacklists','getBlackLists','post','clone','addBlackLists','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5201a7,_0x21f8bf){var _0x435d26=function(_0x167779){while(--_0x167779){_0x5201a7['push'](_0x5201a7['shift']());}};_0x435d26(++_0x21f8bf);}(_0xb16b,0x1ea));var _0xbb16=function(_0x537586,_0x28fa71){_0x537586=_0x537586-0x0;var _0x5545a8=_0xb16b[_0x537586];return _0x5545a8;};'use strict';var multer=require(_0xbb16('0x0'));var util=require(_0xbb16('0x1'));var path=require(_0xbb16('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb16('0x3'));var router=express[_0xbb16('0x4')]();var fs_extra=require(_0xbb16('0x5'));var auth=require(_0xbb16('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb16('0x7'));var controller=require(_0xbb16('0x8'));router[_0xbb16('0x9')]('/',auth[_0xbb16('0xa')](),controller[_0xbb16('0xb')]);router['get'](_0xbb16('0xc'),auth[_0xbb16('0xa')](),controller[_0xbb16('0xd')]);router['get'](_0xbb16('0xe'),auth[_0xbb16('0xa')](),controller[_0xbb16('0xf')]);router[_0xbb16('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb16('0x9')](_0xbb16('0x10'),auth['isAuthenticated'](),controller[_0xbb16('0x11')]);router['get']('/:id/hopper_black',auth[_0xbb16('0xa')](),controller['getHopperBlacks']);router[_0xbb16('0x9')](_0xbb16('0x12'),auth[_0xbb16('0xa')](),controller['getLists']);router[_0xbb16('0x9')](_0xbb16('0x13'),auth[_0xbb16('0xa')](),controller[_0xbb16('0x14')]);router[_0xbb16('0x15')]('/',auth[_0xbb16('0xa')](),controller['create']);router[_0xbb16('0x15')]('/:id/clone',auth['isAuthenticated'](),controller[_0xbb16('0x16')]);router[_0xbb16('0x15')](_0xbb16('0x12'),auth[_0xbb16('0xa')](),controller['addLists']);router[_0xbb16('0x15')](_0xbb16('0x13'),auth['isAuthenticated'](),controller[_0xbb16('0x17')]);router[_0xbb16('0x18')](_0xbb16('0xc'),auth[_0xbb16('0xa')](),controller[_0xbb16('0x19')]);router[_0xbb16('0x1a')](_0xbb16('0xc'),auth[_0xbb16('0xa')](),controller[_0xbb16('0x1b')]);router[_0xbb16('0x1a')](_0xbb16('0x12'),auth[_0xbb16('0xa')](),controller['removeLists']);router['delete']('/:id/blacklists',auth[_0xbb16('0xa')](),controller['removeBlackLists']);module[_0xbb16('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4953822..2c45d0f 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 _0xa1ae=['STRING','getDataValue','exports'];(function(_0x370338,_0x4178ec){var _0x2e10df=function(_0x109471){while(--_0x109471){_0x370338['push'](_0x370338['shift']());}};_0x2e10df(++_0x4178ec);}(_0xa1ae,0x146));var _0xea1a=function(_0x228305,_0x34b1fa){_0x228305=_0x228305-0x0;var _0x22c480=_0xa1ae[_0x228305];return _0x22c480;};'use strict';var Sequelize=require('sequelize');module[_0xea1a('0x0')]={'key':{'type':Sequelize[_0xea1a('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0xea1a('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xea1a('0x2')]('key');}}}; \ No newline at end of file +var _0xb786=['TEXT','medium','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb786,0x179));var _0x6b78=function(_0x1cb384,_0x59c92d){_0x1cb384=_0x1cb384-0x0;var _0x10e25e=_0xb786[_0x1cb384];return _0x10e25e;};'use strict';var Sequelize=require(_0x6b78('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x6b78('0x1')],'length':_0x6b78('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6b78('0x3')]},'name':{'type':Sequelize[_0x6b78('0x4')],'get':function(){return this[_0x6b78('0x5')](_0x6b78('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index acc6e57..dcc56eb 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 _0xfbd5=['undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','send','index','CannedAnswer','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','includeAll','body','find','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset'];(function(_0x3940f2,_0x1acf9d){var _0x682336=function(_0xad08eb){while(--_0xad08eb){_0x3940f2['push'](_0x3940f2['shift']());}};_0x682336(++_0x1acf9d);}(_0xfbd5,0x154));var _0x5fbd=function(_0x451ba5,_0x42bd04){_0x451ba5=_0x451ba5-0x0;var _0x46fc04=_0xfbd5[_0x451ba5];return _0x46fc04;};'use strict';var emlformat=require(_0x5fbd('0x0'));var rimraf=require(_0x5fbd('0x1'));var zipdir=require(_0x5fbd('0x2'));var jsonpatch=require(_0x5fbd('0x3'));var rp=require('request-promise');var moment=require(_0x5fbd('0x4'));var BPromise=require(_0x5fbd('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5fbd('0x6'));var sox=require(_0x5fbd('0x7'));var csv=require(_0x5fbd('0x8'));var ejs=require(_0x5fbd('0x9'));var fs=require('fs');var fs_extra=require(_0x5fbd('0xa'));var _=require(_0x5fbd('0xb'));var squel=require(_0x5fbd('0xc'));var crypto=require('crypto');var jsforce=require(_0x5fbd('0xd'));var deskjs=require(_0x5fbd('0xe'));var toCsv=require(_0x5fbd('0x8'));var querystring=require(_0x5fbd('0xf'));var Papa=require(_0x5fbd('0x10'));var Redis=require(_0x5fbd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5fbd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fbd('0x13'))(_0x5fbd('0x14'));var utils=require(_0x5fbd('0x15'));var config=require(_0x5fbd('0x16'));var licenseUtil=require(_0x5fbd('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d6505,_0x1b6c69){_0x1b6c69=_0x1b6c69||0xcc;return function(_0x200ded){if(_0x200ded){return _0x2d6505['sendStatus'](_0x1b6c69);}return _0x2d6505[_0x5fbd('0x18')](_0x1b6c69)[_0x5fbd('0x19')]();};}function respondWithResult(_0x2be67f,_0xe46830){_0xe46830=_0xe46830||0xc8;return function(_0x22195a){if(_0x22195a){return _0x2be67f[_0x5fbd('0x18')](_0xe46830)[_0x5fbd('0x1a')](_0x22195a);}};}function respondWithFilteredResult(_0x2d34a7,_0x989dc5){return function(_0x9e79aa){if(_0x9e79aa){var _0x3a16bb=typeof _0x989dc5[_0x5fbd('0x1b')]===_0x5fbd('0x1c')&&typeof _0x989dc5['limit']===_0x5fbd('0x1c');var _0x2bc46f=_0x9e79aa[_0x5fbd('0x1d')];var _0x3d7f71=_0x3a16bb?0x0:_0x989dc5[_0x5fbd('0x1b')];var _0x44fe5c=_0x3a16bb?_0x9e79aa[_0x5fbd('0x1d')]:_0x989dc5[_0x5fbd('0x1b')]+_0x989dc5[_0x5fbd('0x1e')];var _0x41ee23;if(_0x44fe5c>=_0x2bc46f){_0x44fe5c=_0x2bc46f;_0x41ee23=0xc8;}else{_0x41ee23=0xce;}_0x2d34a7[_0x5fbd('0x18')](_0x41ee23);return _0x2d34a7[_0x5fbd('0x1f')](_0x5fbd('0x20'),_0x3d7f71+'-'+_0x44fe5c+'/'+_0x2bc46f)[_0x5fbd('0x1a')](_0x9e79aa);}return null;};}function patchUpdates(_0x4618d8){return function(_0x26519d){try{jsonpatch[_0x5fbd('0x21')](_0x26519d,_0x4618d8,!![]);}catch(_0x66c585){return BPromise[_0x5fbd('0x22')](_0x66c585);}return _0x26519d[_0x5fbd('0x23')]();};}function saveUpdates(_0x5e259b,_0x895a60){return function(_0x3675db){if(_0x3675db){return _0x3675db[_0x5fbd('0x24')](_0x5e259b)['then'](function(_0x40535a){return _0x40535a;});}return null;};}function removeEntity(_0x16e533,_0x39815d){return function(_0x4d16ee){if(_0x4d16ee){return _0x4d16ee[_0x5fbd('0x25')]()[_0x5fbd('0x26')](function(){var _0x2b4c5b=_0x4d16ee[_0x5fbd('0x27')]({'plain':!![]});var _0x179eaa=_0x5fbd('0x28');return db[_0x5fbd('0x29')]['destroy']({'where':{'type':_0x179eaa,'resourceId':_0x2b4c5b['id']}})[_0x5fbd('0x26')](function(){return _0x4d16ee;});})['then'](function(){_0x16e533[_0x5fbd('0x18')](0xcc)[_0x5fbd('0x19')]();});}};}function handleEntityNotFound(_0x188d29,_0x1a59f7){return function(_0x38a7a0){if(!_0x38a7a0){_0x188d29[_0x5fbd('0x2a')](0x194);}return _0x38a7a0;};}function handleError(_0x4bdb0d,_0x2ab608){_0x2ab608=_0x2ab608||0x1f4;return function(_0x2aff60){logger[_0x5fbd('0x2b')](_0x2aff60[_0x5fbd('0x2c')]);if(_0x2aff60[_0x5fbd('0x2d')]){delete _0x2aff60[_0x5fbd('0x2d')];}_0x4bdb0d[_0x5fbd('0x18')](_0x2ab608)[_0x5fbd('0x2e')](_0x2aff60);};}exports[_0x5fbd('0x2f')]=function(_0x53cc40,_0x29fe36){var _0x45befd={},_0x1511e9={},_0x16f0db={'count':0x0,'rows':[]};var _0x3b44e4=_['map'](db[_0x5fbd('0x30')][_0x5fbd('0x31')],function(_0x4bd214){return{'name':_0x4bd214['fieldName'],'type':_0x4bd214[_0x5fbd('0x32')]['key']};});_0x1511e9[_0x5fbd('0x33')]=_['map'](_0x3b44e4,'name');_0x1511e9[_0x5fbd('0x34')]=_[_0x5fbd('0x35')](_0x53cc40['query']);_0x1511e9[_0x5fbd('0x36')]=_['intersection'](_0x1511e9[_0x5fbd('0x33')],_0x1511e9[_0x5fbd('0x34')]);_0x45befd['attributes']=_[_0x5fbd('0x37')](_0x1511e9[_0x5fbd('0x33')],qs[_0x5fbd('0x38')](_0x53cc40['query'][_0x5fbd('0x38')]));_0x45befd[_0x5fbd('0x39')]=_0x45befd[_0x5fbd('0x39')][_0x5fbd('0x3a')]?_0x45befd[_0x5fbd('0x39')]:_0x1511e9[_0x5fbd('0x33')];if(!_0x53cc40[_0x5fbd('0x34')][_0x5fbd('0x3b')](_0x5fbd('0x3c'))){_0x45befd[_0x5fbd('0x1e')]=qs[_0x5fbd('0x1e')](_0x53cc40[_0x5fbd('0x34')][_0x5fbd('0x1e')]);_0x45befd['offset']=qs[_0x5fbd('0x1b')](_0x53cc40[_0x5fbd('0x34')]['offset']);}_0x45befd['order']=qs[_0x5fbd('0x3d')](_0x53cc40['query'][_0x5fbd('0x3d')]);_0x45befd['where']=qs[_0x5fbd('0x36')](_[_0x5fbd('0x3e')](_0x53cc40['query'],_0x1511e9[_0x5fbd('0x36')]),_0x3b44e4);if(_0x53cc40[_0x5fbd('0x34')][_0x5fbd('0x3f')]){_0x45befd[_0x5fbd('0x40')]=_[_0x5fbd('0x41')](_0x45befd[_0x5fbd('0x40')],{'$or':[{'key':{'$like':'%'+_0x53cc40[_0x5fbd('0x34')][_0x5fbd('0x3f')]+'%'}},{'value':{'$like':'%'+_0x53cc40['query']['filter']+'%'}}]});}_0x45befd=_[_0x5fbd('0x41')]({},_0x45befd,_0x53cc40[_0x5fbd('0x42')]);var _0x32d4cc={'where':_0x45befd[_0x5fbd('0x40')]};return db[_0x5fbd('0x30')]['count'](_0x32d4cc)[_0x5fbd('0x26')](function(_0x4ad86c){_0x16f0db['count']=_0x4ad86c;if(_0x53cc40[_0x5fbd('0x34')]['includeAll']){_0x45befd[_0x5fbd('0x43')]=[{'all':!![]}];}return db[_0x5fbd('0x30')][_0x5fbd('0x44')](_0x45befd);})[_0x5fbd('0x26')](function(_0x15c18f){_0x16f0db[_0x5fbd('0x45')]=_0x15c18f;return _0x16f0db;})[_0x5fbd('0x26')](respondWithFilteredResult(_0x29fe36,_0x45befd))[_0x5fbd('0x46')](handleError(_0x29fe36,null));};exports[_0x5fbd('0x47')]=function(_0x1486c7,_0x329758){var _0x35c089={'raw':!![],'where':{'id':_0x1486c7[_0x5fbd('0x48')]['id']}},_0x521ac1={};_0x521ac1[_0x5fbd('0x33')]=_[_0x5fbd('0x35')](db[_0x5fbd('0x30')][_0x5fbd('0x31')]);_0x521ac1[_0x5fbd('0x34')]=_[_0x5fbd('0x35')](_0x1486c7[_0x5fbd('0x34')]);_0x521ac1[_0x5fbd('0x36')]=_['intersection'](_0x521ac1['model'],_0x521ac1[_0x5fbd('0x34')]);_0x35c089['attributes']=_[_0x5fbd('0x37')](_0x521ac1[_0x5fbd('0x33')],qs['fields'](_0x1486c7['query'][_0x5fbd('0x38')]));_0x35c089[_0x5fbd('0x39')]=_0x35c089[_0x5fbd('0x39')][_0x5fbd('0x3a')]?_0x35c089[_0x5fbd('0x39')]:_0x521ac1[_0x5fbd('0x33')];if(_0x1486c7[_0x5fbd('0x34')][_0x5fbd('0x49')]){_0x35c089[_0x5fbd('0x43')]=[{'all':!![]}];}_0x35c089=_['merge']({},_0x35c089,_0x1486c7[_0x5fbd('0x42')]);return db['CannedAnswer']['find'](_0x35c089)[_0x5fbd('0x26')](handleEntityNotFound(_0x329758,null))[_0x5fbd('0x26')](respondWithResult(_0x329758,null))['catch'](handleError(_0x329758,null));};exports[_0x5fbd('0x24')]=function(_0x656e1d,_0x4978ad){if(_0x656e1d['body']['id']){delete _0x656e1d[_0x5fbd('0x4a')]['id'];}return db[_0x5fbd('0x30')][_0x5fbd('0x4b')]({'where':{'id':_0x656e1d[_0x5fbd('0x48')]['id']}})[_0x5fbd('0x26')](handleEntityNotFound(_0x4978ad,null))[_0x5fbd('0x26')](saveUpdates(_0x656e1d[_0x5fbd('0x4a')],null))[_0x5fbd('0x26')](respondWithResult(_0x4978ad,null))[_0x5fbd('0x46')](handleError(_0x4978ad,null));};exports[_0x5fbd('0x25')]=function(_0x128a5f,_0x319f94){return db['CannedAnswer']['find']({'where':{'id':_0x128a5f[_0x5fbd('0x48')]['id']}})[_0x5fbd('0x26')](handleEntityNotFound(_0x319f94,null))[_0x5fbd('0x26')](removeEntity(_0x319f94,null))['catch'](handleError(_0x319f94,null));};exports[_0x5fbd('0x4c')]=function(_0x3c3e99,_0x3076e5){var _0x4f1ad9={'key':_0x3c3e99['body'][_0x5fbd('0x4d')]};if(_0x3c3e99[_0x5fbd('0x4a')][_0x5fbd('0x4e')]){_0x4f1ad9[_0x5fbd('0x4e')]=_0x3c3e99[_0x5fbd('0x4a')][_0x5fbd('0x4e')];}else if(_0x3c3e99[_0x5fbd('0x4a')][_0x5fbd('0x4f')]){_0x4f1ad9['SmsAccountId']=_0x3c3e99[_0x5fbd('0x4a')][_0x5fbd('0x4f')];}else if(_0x3c3e99[_0x5fbd('0x4a')][_0x5fbd('0x50')]){_0x4f1ad9[_0x5fbd('0x50')]=_0x3c3e99[_0x5fbd('0x4a')]['OpenchannelAccountId'];}else if(_0x3c3e99['body'][_0x5fbd('0x51')]){_0x4f1ad9[_0x5fbd('0x51')]=_0x3c3e99['body'][_0x5fbd('0x51')];}return db['CannedAnswer'][_0x5fbd('0x4b')]({'where':_0x4f1ad9})[_0x5fbd('0x26')](function(_0x295f6c){if(_0x295f6c){throw new db[(_0x5fbd('0x52'))][(_0x5fbd('0x53'))](_0x5fbd('0x54'));}return db[_0x5fbd('0x30')][_0x5fbd('0x4c')](_0x3c3e99[_0x5fbd('0x4a')]);})[_0x5fbd('0x26')](function(_0x4f0a84){var _0x2aed55=_0x3c3e99[_0x5fbd('0x55')][_0x5fbd('0x27')]({'plain':!![]});if(!_0x2aed55)throw new Error(_0x5fbd('0x56'));if(_0x2aed55[_0x5fbd('0x57')]==='user'){var _0x42d97b=_0x4f0a84['get']({'plain':!![]});return db[_0x5fbd('0x58')][_0x5fbd('0x4b')]({'where':{'name':_0x5fbd('0x28'),'userProfileId':_0x2aed55[_0x5fbd('0x59')]},'raw':!![]})[_0x5fbd('0x26')](function(_0x214647){if(_0x214647&&_0x214647[_0x5fbd('0x5a')]===0x0){return db[_0x5fbd('0x29')][_0x5fbd('0x4c')]({'name':_0x42d97b[_0x5fbd('0x2d')],'resourceId':_0x42d97b['id'],'type':_0x214647[_0x5fbd('0x2d')],'sectionId':_0x214647['id']},{})[_0x5fbd('0x26')](function(){return _0x4f0a84;});}else{return _0x4f0a84;}})[_0x5fbd('0x46')](function(_0x59fa52){logger[_0x5fbd('0x2b')](_0x5fbd('0x5b'),_0x59fa52);throw _0x59fa52;});}return _0x4f0a84;})['then'](respondWithResult(_0x3076e5,0xc9))[_0x5fbd('0x46')](handleError(_0x3076e5,null));}; \ No newline at end of file +var _0x0183=['CannedAnswers','destroy','error','name','index','map','CannedAnswer','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x0183,0xd7));var _0x3018=function(_0x2029f7,_0x53b3f1){_0x2029f7=_0x2029f7-0x0;var _0x5c6c6f=_0x0183[_0x2029f7];return _0x5c6c6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3018('0x0'));var zipdir=require(_0x3018('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3018('0x2'));var BPromise=require(_0x3018('0x3'));var Mustache=require(_0x3018('0x4'));var util=require(_0x3018('0x5'));var path=require('path');var sox=require(_0x3018('0x6'));var csv=require(_0x3018('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3018('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3018('0x9'));var jsforce=require(_0x3018('0xa'));var deskjs=require(_0x3018('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3018('0xc'));var Redis=require(_0x3018('0xd'));var authService=require(_0x3018('0xe'));var qs=require(_0x3018('0xf'));var as=require(_0x3018('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3018('0x11'));var utils=require('../../config/utils');var config=require(_0x3018('0x12'));var licenseUtil=require(_0x3018('0x13'));var db=require(_0x3018('0x14'))['db'];function respondWithStatusCode(_0x4bdb56,_0xc67e9f){_0xc67e9f=_0xc67e9f||0xcc;return function(_0x2f122d){if(_0x2f122d){return _0x4bdb56[_0x3018('0x15')](_0xc67e9f);}return _0x4bdb56[_0x3018('0x16')](_0xc67e9f)[_0x3018('0x17')]();};}function respondWithResult(_0x342e21,_0x78f558){_0x78f558=_0x78f558||0xc8;return function(_0x4e34be){if(_0x4e34be){return _0x342e21[_0x3018('0x16')](_0x78f558)[_0x3018('0x18')](_0x4e34be);}};}function respondWithFilteredResult(_0x17e626,_0x22b422){return function(_0x59f658){if(_0x59f658){var _0x5643cf=typeof _0x22b422['offset']==='undefined'&&typeof _0x22b422[_0x3018('0x19')]===_0x3018('0x1a');var _0x48bb71=_0x59f658[_0x3018('0x1b')];var _0x399124=_0x5643cf?0x0:_0x22b422['offset'];var _0x2f432c=_0x5643cf?_0x59f658['count']:_0x22b422[_0x3018('0x1c')]+_0x22b422[_0x3018('0x19')];var _0x446127;if(_0x2f432c>=_0x48bb71){_0x2f432c=_0x48bb71;_0x446127=0xc8;}else{_0x446127=0xce;}_0x17e626[_0x3018('0x16')](_0x446127);return _0x17e626[_0x3018('0x1d')]('Content-Range',_0x399124+'-'+_0x2f432c+'/'+_0x48bb71)[_0x3018('0x18')](_0x59f658);}return null;};}function patchUpdates(_0x62cdbd){return function(_0x54a25e){try{jsonpatch[_0x3018('0x1e')](_0x54a25e,_0x62cdbd,!![]);}catch(_0x19cd5a){return BPromise['reject'](_0x19cd5a);}return _0x54a25e[_0x3018('0x1f')]();};}function saveUpdates(_0x2697a4,_0x544217){return function(_0x408e79){if(_0x408e79){return _0x408e79[_0x3018('0x20')](_0x2697a4)[_0x3018('0x21')](function(_0x2fb58d){return _0x2fb58d;});}return null;};}function removeEntity(_0x5415bb,_0x33cf7d){return function(_0x3787d3){if(_0x3787d3){return _0x3787d3['destroy']()[_0x3018('0x21')](function(){var _0x58c3e4=_0x3787d3['get']({'plain':!![]});var _0x2a5517=_0x3018('0x22');return db['UserProfileResource'][_0x3018('0x23')]({'where':{'type':_0x2a5517,'resourceId':_0x58c3e4['id']}})[_0x3018('0x21')](function(){return _0x3787d3;});})['then'](function(){_0x5415bb['status'](0xcc)[_0x3018('0x17')]();});}};}function handleEntityNotFound(_0x4a9a79,_0x4c1385){return function(_0x484209){if(!_0x484209){_0x4a9a79[_0x3018('0x15')](0x194);}return _0x484209;};}function handleError(_0x46d8ef,_0x4aca11){_0x4aca11=_0x4aca11||0x1f4;return function(_0x5a7924){logger[_0x3018('0x24')](_0x5a7924['stack']);if(_0x5a7924[_0x3018('0x25')]){delete _0x5a7924[_0x3018('0x25')];}_0x46d8ef[_0x3018('0x16')](_0x4aca11)['send'](_0x5a7924);};}exports[_0x3018('0x26')]=function(_0x553578,_0x5ea590){var _0x3eb718={},_0x19dad7={},_0x1dff80={'count':0x0,'rows':[]};var _0xaa415=_[_0x3018('0x27')](db[_0x3018('0x28')][_0x3018('0x29')],function(_0x200bdd){return{'name':_0x200bdd['fieldName'],'type':_0x200bdd['type'][_0x3018('0x2a')]};});_0x19dad7[_0x3018('0x2b')]=_[_0x3018('0x27')](_0xaa415,_0x3018('0x25'));_0x19dad7[_0x3018('0x2c')]=_[_0x3018('0x2d')](_0x553578[_0x3018('0x2c')]);_0x19dad7[_0x3018('0x2e')]=_[_0x3018('0x2f')](_0x19dad7[_0x3018('0x2b')],_0x19dad7['query']);_0x3eb718[_0x3018('0x30')]=_[_0x3018('0x2f')](_0x19dad7[_0x3018('0x2b')],qs[_0x3018('0x31')](_0x553578['query'][_0x3018('0x31')]));_0x3eb718[_0x3018('0x30')]=_0x3eb718[_0x3018('0x30')]['length']?_0x3eb718[_0x3018('0x30')]:_0x19dad7[_0x3018('0x2b')];if(!_0x553578['query']['hasOwnProperty']('nolimit')){_0x3eb718[_0x3018('0x19')]=qs[_0x3018('0x19')](_0x553578['query'][_0x3018('0x19')]);_0x3eb718[_0x3018('0x1c')]=qs[_0x3018('0x1c')](_0x553578[_0x3018('0x2c')][_0x3018('0x1c')]);}_0x3eb718[_0x3018('0x32')]=qs[_0x3018('0x33')](_0x553578[_0x3018('0x2c')]['sort']);_0x3eb718[_0x3018('0x34')]=qs[_0x3018('0x2e')](_[_0x3018('0x35')](_0x553578[_0x3018('0x2c')],_0x19dad7[_0x3018('0x2e')]),_0xaa415);if(_0x553578[_0x3018('0x2c')]['filter']){_0x3eb718[_0x3018('0x34')]=_[_0x3018('0x36')](_0x3eb718[_0x3018('0x34')],{'$or':[{'key':{'$like':'%'+_0x553578['query']['filter']+'%'}},{'value':{'$like':'%'+_0x553578['query'][_0x3018('0x37')]+'%'}}]});}_0x3eb718=_['merge']({},_0x3eb718,_0x553578['options']);var _0x1a725d={'where':_0x3eb718[_0x3018('0x34')]};return db[_0x3018('0x28')][_0x3018('0x1b')](_0x1a725d)['then'](function(_0xfce8af){_0x1dff80[_0x3018('0x1b')]=_0xfce8af;if(_0x553578['query'][_0x3018('0x38')]){_0x3eb718[_0x3018('0x39')]=[{'all':!![]}];}return db[_0x3018('0x28')][_0x3018('0x3a')](_0x3eb718);})['then'](function(_0x4e0eaf){_0x1dff80[_0x3018('0x3b')]=_0x4e0eaf;return _0x1dff80;})[_0x3018('0x21')](respondWithFilteredResult(_0x5ea590,_0x3eb718))[_0x3018('0x3c')](handleError(_0x5ea590,null));};exports[_0x3018('0x3d')]=function(_0x24de8d,_0x67ad7b){var _0x14104e={'raw':!![],'where':{'id':_0x24de8d[_0x3018('0x3e')]['id']}},_0x6fe578={};_0x6fe578[_0x3018('0x2b')]=_[_0x3018('0x2d')](db[_0x3018('0x28')][_0x3018('0x29')]);_0x6fe578[_0x3018('0x2c')]=_[_0x3018('0x2d')](_0x24de8d[_0x3018('0x2c')]);_0x6fe578[_0x3018('0x2e')]=_[_0x3018('0x2f')](_0x6fe578[_0x3018('0x2b')],_0x6fe578[_0x3018('0x2c')]);_0x14104e[_0x3018('0x30')]=_[_0x3018('0x2f')](_0x6fe578[_0x3018('0x2b')],qs[_0x3018('0x31')](_0x24de8d[_0x3018('0x2c')][_0x3018('0x31')]));_0x14104e[_0x3018('0x30')]=_0x14104e[_0x3018('0x30')][_0x3018('0x3f')]?_0x14104e[_0x3018('0x30')]:_0x6fe578[_0x3018('0x2b')];if(_0x24de8d['query'][_0x3018('0x38')]){_0x14104e['include']=[{'all':!![]}];}_0x14104e=_[_0x3018('0x36')]({},_0x14104e,_0x24de8d[_0x3018('0x40')]);return db[_0x3018('0x28')][_0x3018('0x41')](_0x14104e)['then'](handleEntityNotFound(_0x67ad7b,null))[_0x3018('0x21')](respondWithResult(_0x67ad7b,null))[_0x3018('0x3c')](handleError(_0x67ad7b,null));};exports[_0x3018('0x20')]=function(_0x3e49ce,_0x82d4cc){if(_0x3e49ce[_0x3018('0x42')]['id']){delete _0x3e49ce['body']['id'];}return db[_0x3018('0x28')][_0x3018('0x41')]({'where':{'id':_0x3e49ce[_0x3018('0x3e')]['id']}})[_0x3018('0x21')](handleEntityNotFound(_0x82d4cc,null))[_0x3018('0x21')](saveUpdates(_0x3e49ce[_0x3018('0x42')],null))['then'](respondWithResult(_0x82d4cc,null))[_0x3018('0x3c')](handleError(_0x82d4cc,null));};exports[_0x3018('0x23')]=function(_0x490c8b,_0x323e25){return db[_0x3018('0x28')]['find']({'where':{'id':_0x490c8b[_0x3018('0x3e')]['id']}})['then'](handleEntityNotFound(_0x323e25,null))['then'](removeEntity(_0x323e25,null))[_0x3018('0x3c')](handleError(_0x323e25,null));};exports[_0x3018('0x43')]=function(_0x373478,_0x3ef05f){var _0x28dfe2={'key':_0x373478['body'][_0x3018('0x2a')]};if(_0x373478['body']['MailAccountId']){_0x28dfe2['MailAccountId']=_0x373478[_0x3018('0x42')][_0x3018('0x44')];}else if(_0x373478['body'][_0x3018('0x45')]){_0x28dfe2[_0x3018('0x45')]=_0x373478[_0x3018('0x42')][_0x3018('0x45')];}else if(_0x373478[_0x3018('0x42')][_0x3018('0x46')]){_0x28dfe2[_0x3018('0x46')]=_0x373478['body']['OpenchannelAccountId'];}else if(_0x373478[_0x3018('0x42')][_0x3018('0x47')]){_0x28dfe2['ChatWebsiteId']=_0x373478['body'][_0x3018('0x47')];}return db['CannedAnswer']['find']({'where':_0x28dfe2})['then'](function(_0x288e1b){if(_0x288e1b){throw new db[(_0x3018('0x48'))][(_0x3018('0x49'))](_0x3018('0x4a'));}return db[_0x3018('0x28')][_0x3018('0x43')](_0x373478[_0x3018('0x42')]);})[_0x3018('0x21')](function(_0x23c6af){var _0x1c7abb=_0x373478['user'][_0x3018('0x4b')]({'plain':!![]});if(!_0x1c7abb)throw new Error(_0x3018('0x4c'));if(_0x1c7abb[_0x3018('0x4d')]===_0x3018('0x4e')){var _0xf78791=_0x23c6af['get']({'plain':!![]});return db[_0x3018('0x4f')][_0x3018('0x41')]({'where':{'name':_0x3018('0x22'),'userProfileId':_0x1c7abb[_0x3018('0x50')]},'raw':!![]})[_0x3018('0x21')](function(_0x560784){if(_0x560784&&_0x560784[_0x3018('0x51')]===0x0){return db['UserProfileResource'][_0x3018('0x43')]({'name':_0xf78791[_0x3018('0x25')],'resourceId':_0xf78791['id'],'type':_0x560784[_0x3018('0x25')],'sectionId':_0x560784['id']},{})[_0x3018('0x21')](function(){return _0x23c6af;});}else{return _0x23c6af;}})[_0x3018('0x3c')](function(_0x9014d4){logger[_0x3018('0x24')](_0x3018('0x52'),_0x9014d4);throw _0x9014d4;});}return _0x23c6af;})[_0x3018('0x21')](respondWithResult(_0x3ef05f,0xc9))[_0x3018('0x3c')](handleError(_0x3ef05f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 342070f..077c5a2 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 _0xbf4a=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xbf4a,0x146));var _0xabf4=function(_0x28dd43,_0x2bcf5d){_0x28dd43=_0x28dd43-0x0;var _0x32eb86=_0xbf4a[_0x28dd43];return _0x32eb86;};'use strict';var _=require(_0xabf4('0x0'));var util=require(_0xabf4('0x1'));var logger=require(_0xabf4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xabf4('0x3'));var rp=require(_0xabf4('0x4'));var fs=require('fs');var path=require(_0xabf4('0x5'));var rimraf=require('rimraf');var config=require(_0xabf4('0x6'));var attributes=require(_0xabf4('0x7'));module[_0xabf4('0x8')]=function(_0x99ef14,_0x1d9403){return _0x99ef14[_0xabf4('0x9')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xabf4('0xa'),'collate':_0xabf4('0xb')});}; \ No newline at end of file +var _0xf875=['moment','request-promise','path','./cannedAnswer.attributes','exports','tools_canned_answers','lodash','../../config/logger','api'];(function(_0x142691,_0x281ee4){var _0x7ff861=function(_0x19f6a3){while(--_0x19f6a3){_0x142691['push'](_0x142691['shift']());}};_0x7ff861(++_0x281ee4);}(_0xf875,0x138));var _0x5f87=function(_0xe2421b,_0x456d1d){_0xe2421b=_0xe2421b-0x0;var _0x5aa147=_0xf875[_0xe2421b];return _0x5aa147;};'use strict';var _=require(_0x5f87('0x0'));var util=require('util');var logger=require(_0x5f87('0x1'))(_0x5f87('0x2'));var moment=require(_0x5f87('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f87('0x4'));var fs=require('fs');var path=require(_0x5f87('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5f87('0x6'));module[_0x5f87('0x7')]=function(_0x2753a7,_0x1ae2d8){return _0x2753a7['define']('CannedAnswer',attributes,{'tableName':_0x5f87('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 402e09e..4bb823c 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(_0x48a858,_0x3beaf2){var _0xd29d85=function(_0x499e0e){while(--_0x499e0e){_0x48a858['push'](_0x48a858['shift']());}};_0xd29d85(++_0x3beaf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x1c3e9a,_0x1b03e1){var _0x1ce0bd=function(_0x27a1f5){while(--_0x27a1f5){_0x1c3e9a['push'](_0x1c3e9a['shift']());}};_0x1ce0bd(++_0x1b03e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 62c57d0..3919ddf 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 _0x8df8=['../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8df8,0x9b));var _0x88df=function(_0x405790,_0x1fa7b8){_0x405790=_0x405790-0x0;var _0x250161=_0x8df8[_0x405790];return _0x250161;};'use strict';var multer=require('multer');var util=require(_0x88df('0x0'));var path=require(_0x88df('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x88df('0x2'));var auth=require(_0x88df('0x3'));var interaction=require(_0x88df('0x4'));var config=require(_0x88df('0x5'));var controller=require(_0x88df('0x6'));router[_0x88df('0x7')]('/',auth[_0x88df('0x8')](),controller[_0x88df('0x9')]);router[_0x88df('0x7')](_0x88df('0xa'),auth[_0x88df('0x8')](),controller['show']);router[_0x88df('0xb')]('/',auth['isAuthenticated'](),controller[_0x88df('0xc')]);router[_0x88df('0xd')](_0x88df('0xa'),auth[_0x88df('0x8')](),controller['update']);router[_0x88df('0xe')](_0x88df('0xa'),auth[_0x88df('0x8')](),controller['destroy']);module[_0x88df('0xf')]=router; \ No newline at end of file +var _0x1d43=['show','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated'];(function(_0x1aa0fd,_0x1a12e8){var _0x424d92=function(_0x217308){while(--_0x217308){_0x1aa0fd['push'](_0x1aa0fd['shift']());}};_0x424d92(++_0x1a12e8);}(_0x1d43,0xc4));var _0x31d4=function(_0x451b4b,_0x2f021f){_0x451b4b=_0x451b4b-0x0;var _0x27d1d9=_0x1d43[_0x451b4b];return _0x27d1d9;};'use strict';var multer=require(_0x31d4('0x0'));var util=require('util');var path=require(_0x31d4('0x1'));var timeout=require(_0x31d4('0x2'));var express=require(_0x31d4('0x3'));var router=express[_0x31d4('0x4')]();var fs_extra=require(_0x31d4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x31d4('0x6'));var config=require(_0x31d4('0x7'));var controller=require(_0x31d4('0x8'));router[_0x31d4('0x9')]('/',auth['isAuthenticated'](),controller[_0x31d4('0xa')]);router['get'](_0x31d4('0xb'),auth[_0x31d4('0xc')](),controller[_0x31d4('0xd')]);router[_0x31d4('0xe')]('/',auth[_0x31d4('0xc')](),controller['create']);router[_0x31d4('0xf')](_0x31d4('0xb'),auth['isAuthenticated'](),controller[_0x31d4('0x10')]);router[_0x31d4('0x11')](_0x31d4('0xb'),auth['isAuthenticated'](),controller[_0x31d4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4edbe17..93d4a61 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 _0x7914=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x7914,0x107));var _0x4791=function(_0x2d8dfe,_0x16a41d){_0x2d8dfe=_0x2d8dfe-0x0;var _0xd1665c=_0x7914[_0x2d8dfe];return _0xd1665c;};'use strict';var Sequelize=require(_0x4791('0x0'));module[_0x4791('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x4791('0x2')},'clid':{'type':Sequelize[_0x4791('0x3')]},'src':{'type':Sequelize[_0x4791('0x3')]},'dst':{'type':Sequelize[_0x4791('0x3')]},'dcontext':{'type':Sequelize[_0x4791('0x3')]},'channel':{'type':Sequelize[_0x4791('0x3')]},'dstchannel':{'type':Sequelize[_0x4791('0x3')]},'lastapp':{'type':Sequelize[_0x4791('0x3')]},'lastdata':{'type':Sequelize[_0x4791('0x3')]},'duration':{'type':Sequelize[_0x4791('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4791('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4791('0x3')]},'userfield':{'type':Sequelize[_0x4791('0x3')]},'uniqueid':{'type':Sequelize[_0x4791('0x3')]},'linkedid':{'type':Sequelize[_0x4791('0x3')]},'sequence':{'type':Sequelize[_0x4791('0x3')]},'peeraccount':{'type':Sequelize[_0x4791('0x3')]},'type':{'type':Sequelize[_0x4791('0x3')]},'tag':{'type':Sequelize[_0x4791('0x3')]}}; \ No newline at end of file +var _0x74a1=['sequelize','exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0x74a1,0xff));var _0x174a=function(_0x145880,_0x1365aa){_0x145880=_0x145880-0x0;var _0xd2f1c2=_0x74a1[_0x145880];return _0xd2f1c2;};'use strict';var Sequelize=require(_0x174a('0x0'));module[_0x174a('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x174a('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x174a('0x3')]},'dst':{'type':Sequelize[_0x174a('0x3')]},'dcontext':{'type':Sequelize[_0x174a('0x3')]},'channel':{'type':Sequelize[_0x174a('0x3')]},'dstchannel':{'type':Sequelize[_0x174a('0x3')]},'lastapp':{'type':Sequelize[_0x174a('0x3')]},'lastdata':{'type':Sequelize[_0x174a('0x3')]},'duration':{'type':Sequelize[_0x174a('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x174a('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x174a('0x3')]},'amaflags':{'type':Sequelize[_0x174a('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x174a('0x3')]},'userfield':{'type':Sequelize[_0x174a('0x3')]},'uniqueid':{'type':Sequelize[_0x174a('0x3')]},'linkedid':{'type':Sequelize[_0x174a('0x3')]},'sequence':{'type':Sequelize[_0x174a('0x3')]},'peeraccount':{'type':Sequelize[_0x174a('0x3')]},'type':{'type':Sequelize[_0x174a('0x3')]},'tag':{'type':Sequelize[_0x174a('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 093de45..ef92ab1 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 _0x0f4d=['query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','type','options','include','findAll','rows','catch','rawAttributes','find','create','body','params','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','Cdr','model'];(function(_0x5dd550,_0x5a93ab){var _0x4e28be=function(_0x29208f){while(--_0x29208f){_0x5dd550['push'](_0x5dd550['shift']());}};_0x4e28be(++_0x5a93ab);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x57c4a1,_0x5bfb7e){_0x57c4a1=_0x57c4a1-0x0;var _0x4530c4=_0x0f4d[_0x57c4a1];return _0x4530c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0f4('0x0'));var rp=require('request-promise');var moment=require(_0xd0f4('0x1'));var BPromise=require(_0xd0f4('0x2'));var Mustache=require(_0xd0f4('0x3'));var util=require(_0xd0f4('0x4'));var path=require(_0xd0f4('0x5'));var sox=require(_0xd0f4('0x6'));var csv=require(_0xd0f4('0x7'));var ejs=require(_0xd0f4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0f4('0x9'));var squel=require(_0xd0f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xd0f4('0xb'));var deskjs=require(_0xd0f4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd0f4('0xd'));var Papa=require(_0xd0f4('0xe'));var Redis=require('ioredis');var authService=require(_0xd0f4('0xf'));var qs=require(_0xd0f4('0x10'));var as=require(_0xd0f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd0f4('0x12'));var utils=require(_0xd0f4('0x13'));var config=require(_0xd0f4('0x14'));var licenseUtil=require(_0xd0f4('0x15'));var db=require(_0xd0f4('0x16'))['db'];function respondWithStatusCode(_0x64232c,_0x134492){_0x134492=_0x134492||0xcc;return function(_0x5679a7){if(_0x5679a7){return _0x64232c[_0xd0f4('0x17')](_0x134492);}return _0x64232c[_0xd0f4('0x18')](_0x134492)['end']();};}function respondWithResult(_0x104d48,_0x536d71){_0x536d71=_0x536d71||0xc8;return function(_0x828792){if(_0x828792){return _0x104d48['status'](_0x536d71)[_0xd0f4('0x19')](_0x828792);}};}function respondWithFilteredResult(_0x4d5aef,_0x4afe4d){return function(_0x54b806){if(_0x54b806){var _0x45b32e=typeof _0x4afe4d[_0xd0f4('0x1a')]===_0xd0f4('0x1b')&&typeof _0x4afe4d[_0xd0f4('0x1c')]===_0xd0f4('0x1b');var _0x10acbe=_0x54b806[_0xd0f4('0x1d')];var _0x35be48=_0x45b32e?0x0:_0x4afe4d[_0xd0f4('0x1a')];var _0x5de07b=_0x45b32e?_0x54b806[_0xd0f4('0x1d')]:_0x4afe4d[_0xd0f4('0x1a')]+_0x4afe4d[_0xd0f4('0x1c')];var _0xa0662;if(_0x5de07b>=_0x10acbe){_0x5de07b=_0x10acbe;_0xa0662=0xc8;}else{_0xa0662=0xce;}_0x4d5aef['status'](_0xa0662);return _0x4d5aef[_0xd0f4('0x1e')](_0xd0f4('0x1f'),_0x35be48+'-'+_0x5de07b+'/'+_0x10acbe)[_0xd0f4('0x19')](_0x54b806);}return null;};}function patchUpdates(_0x208a6f){return function(_0x4e1689){try{jsonpatch[_0xd0f4('0x20')](_0x4e1689,_0x208a6f,!![]);}catch(_0xda1d14){return BPromise[_0xd0f4('0x21')](_0xda1d14);}return _0x4e1689[_0xd0f4('0x22')]();};}function saveUpdates(_0x14ba70,_0x2a1df0){return function(_0x25ee43){if(_0x25ee43){return _0x25ee43['update'](_0x14ba70)[_0xd0f4('0x23')](function(_0x327696){return _0x327696;});}return null;};}function removeEntity(_0x20e0c8,_0x299904){return function(_0x4d49c0){if(_0x4d49c0){return _0x4d49c0[_0xd0f4('0x24')]()['then'](function(){_0x20e0c8[_0xd0f4('0x18')](0xcc)[_0xd0f4('0x25')]();});}};}function handleEntityNotFound(_0x1cf493,_0x567eb4){return function(_0x42d944){if(!_0x42d944){_0x1cf493[_0xd0f4('0x17')](0x194);}return _0x42d944;};}function handleError(_0x459931,_0x1ed6e2){_0x1ed6e2=_0x1ed6e2||0x1f4;return function(_0x366af6){logger['error'](_0x366af6[_0xd0f4('0x26')]);if(_0x366af6[_0xd0f4('0x27')]){delete _0x366af6[_0xd0f4('0x27')];}_0x459931[_0xd0f4('0x18')](_0x1ed6e2)[_0xd0f4('0x28')](_0x366af6);};}exports[_0xd0f4('0x29')]=function(_0x1d3246,_0x33eb58){var _0x3cb97c={},_0x4cff90={},_0x42a44f={'count':0x0,'rows':[]};var _0x2df1ed=_[_0xd0f4('0x2a')](db[_0xd0f4('0x2b')]['rawAttributes'],function(_0x4058d7){return{'name':_0x4058d7['fieldName'],'type':_0x4058d7['type']['key']};});_0x4cff90[_0xd0f4('0x2c')]=_[_0xd0f4('0x2a')](_0x2df1ed,_0xd0f4('0x27'));_0x4cff90[_0xd0f4('0x2d')]=_[_0xd0f4('0x2e')](_0x1d3246[_0xd0f4('0x2d')]);_0x4cff90[_0xd0f4('0x2f')]=_[_0xd0f4('0x30')](_0x4cff90['model'],_0x4cff90[_0xd0f4('0x2d')]);_0x3cb97c['attributes']=_[_0xd0f4('0x30')](_0x4cff90[_0xd0f4('0x2c')],qs['fields'](_0x1d3246['query'][_0xd0f4('0x31')]));_0x3cb97c['attributes']=_0x3cb97c[_0xd0f4('0x32')][_0xd0f4('0x33')]?_0x3cb97c['attributes']:_0x4cff90[_0xd0f4('0x2c')];if(!_0x1d3246[_0xd0f4('0x2d')]['hasOwnProperty']('nolimit')){_0x3cb97c[_0xd0f4('0x1c')]=qs[_0xd0f4('0x1c')](_0x1d3246['query'][_0xd0f4('0x1c')]);_0x3cb97c['offset']=qs[_0xd0f4('0x1a')](_0x1d3246[_0xd0f4('0x2d')]['offset']);}_0x3cb97c[_0xd0f4('0x34')]=qs[_0xd0f4('0x35')](_0x1d3246[_0xd0f4('0x2d')][_0xd0f4('0x35')]);_0x3cb97c[_0xd0f4('0x36')]=qs['filters'](_[_0xd0f4('0x37')](_0x1d3246[_0xd0f4('0x2d')],_0x4cff90[_0xd0f4('0x2f')]),_0x2df1ed);if(_0x1d3246[_0xd0f4('0x2d')]['filter']){_0x3cb97c[_0xd0f4('0x36')]=_[_0xd0f4('0x38')](_0x3cb97c[_0xd0f4('0x36')],{'$or':_[_0xd0f4('0x2a')](_0x2df1ed,function(_0xd109a4){if(_0xd109a4[_0xd0f4('0x39')]!=='VIRTUAL'){var _0x269629={};_0x269629[_0xd109a4[_0xd0f4('0x27')]]={'$like':'%'+_0x1d3246[_0xd0f4('0x2d')]['filter']+'%'};return _0x269629;}})});}_0x3cb97c=_[_0xd0f4('0x38')]({},_0x3cb97c,_0x1d3246[_0xd0f4('0x3a')]);var _0x4bebe8={'where':_0x3cb97c[_0xd0f4('0x36')]};return db[_0xd0f4('0x2b')]['count'](_0x4bebe8)['then'](function(_0x3bb4ab){_0x42a44f[_0xd0f4('0x1d')]=_0x3bb4ab;if(_0x1d3246[_0xd0f4('0x2d')]['includeAll']){_0x3cb97c[_0xd0f4('0x3b')]=[{'all':!![]}];}return db['Cdr'][_0xd0f4('0x3c')](_0x3cb97c);})['then'](function(_0x29439d){_0x42a44f[_0xd0f4('0x3d')]=_0x29439d;return _0x42a44f;})[_0xd0f4('0x23')](respondWithFilteredResult(_0x33eb58,_0x3cb97c))[_0xd0f4('0x3e')](handleError(_0x33eb58,null));};exports['show']=function(_0x10509e,_0x198e47){var _0xb02892={'raw':!![],'where':{'id':_0x10509e['params']['id']}},_0x4c8b9a={};_0x4c8b9a[_0xd0f4('0x2c')]=_[_0xd0f4('0x2e')](db[_0xd0f4('0x2b')][_0xd0f4('0x3f')]);_0x4c8b9a[_0xd0f4('0x2d')]=_[_0xd0f4('0x2e')](_0x10509e[_0xd0f4('0x2d')]);_0x4c8b9a[_0xd0f4('0x2f')]=_[_0xd0f4('0x30')](_0x4c8b9a[_0xd0f4('0x2c')],_0x4c8b9a[_0xd0f4('0x2d')]);_0xb02892[_0xd0f4('0x32')]=_['intersection'](_0x4c8b9a[_0xd0f4('0x2c')],qs[_0xd0f4('0x31')](_0x10509e['query'][_0xd0f4('0x31')]));_0xb02892[_0xd0f4('0x32')]=_0xb02892[_0xd0f4('0x32')][_0xd0f4('0x33')]?_0xb02892[_0xd0f4('0x32')]:_0x4c8b9a[_0xd0f4('0x2c')];if(_0x10509e[_0xd0f4('0x2d')]['includeAll']){_0xb02892[_0xd0f4('0x3b')]=[{'all':!![]}];}_0xb02892=_[_0xd0f4('0x38')]({},_0xb02892,_0x10509e[_0xd0f4('0x3a')]);return db['Cdr'][_0xd0f4('0x40')](_0xb02892)[_0xd0f4('0x23')](handleEntityNotFound(_0x198e47,null))[_0xd0f4('0x23')](respondWithResult(_0x198e47,null))[_0xd0f4('0x3e')](handleError(_0x198e47,null));};exports[_0xd0f4('0x41')]=function(_0x563759,_0x54bb8d){return db['Cdr'][_0xd0f4('0x41')](_0x563759[_0xd0f4('0x42')],{})[_0xd0f4('0x23')](respondWithResult(_0x54bb8d,0xc9))[_0xd0f4('0x3e')](handleError(_0x54bb8d,null));};exports['update']=function(_0x31db89,_0x1b1baa){if(_0x31db89['body']['id']){delete _0x31db89[_0xd0f4('0x42')]['id'];}return db[_0xd0f4('0x2b')][_0xd0f4('0x40')]({'where':{'id':_0x31db89[_0xd0f4('0x43')]['id']}})[_0xd0f4('0x23')](handleEntityNotFound(_0x1b1baa,null))[_0xd0f4('0x23')](saveUpdates(_0x31db89[_0xd0f4('0x42')],null))[_0xd0f4('0x23')](respondWithResult(_0x1b1baa,null))[_0xd0f4('0x3e')](handleError(_0x1b1baa,null));};exports[_0xd0f4('0x24')]=function(_0x431df3,_0x120c17){return db[_0xd0f4('0x2b')]['find']({'where':{'id':_0x431df3[_0xd0f4('0x43')]['id']}})[_0xd0f4('0x23')](handleEntityNotFound(_0x120c17,null))[_0xd0f4('0x23')](removeEntity(_0x120c17,null))['catch'](handleError(_0x120c17,null));};exports[_0xd0f4('0x44')]=function(_0x3f8bcc,_0x1d8543){return db['Cdr'][_0xd0f4('0x44')]()['then'](respondWithResult(_0x1d8543,null))[_0xd0f4('0x3e')](handleError(_0x1d8543,null));}; \ No newline at end of file +var _0x236d=['undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','destroy','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3d3590,_0x23bd12){var _0x1348ff=function(_0x26a61a){while(--_0x26a61a){_0x3d3590['push'](_0x3d3590['shift']());}};_0x1348ff(++_0x23bd12);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd236('0x0'));var rimraf=require(_0xd236('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd236('0x2'));var rp=require('request-promise');var moment=require(_0xd236('0x3'));var BPromise=require(_0xd236('0x4'));var Mustache=require(_0xd236('0x5'));var util=require(_0xd236('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd236('0x7'));var ejs=require(_0xd236('0x8'));var fs=require('fs');var fs_extra=require(_0xd236('0x9'));var _=require(_0xd236('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd236('0xb'));var deskjs=require(_0xd236('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd236('0xd'));var Papa=require(_0xd236('0xe'));var Redis=require('ioredis');var authService=require(_0xd236('0xf'));var qs=require(_0xd236('0x10'));var as=require(_0xd236('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd236('0x12'))(_0xd236('0x13'));var utils=require(_0xd236('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd236('0x15'));var db=require(_0xd236('0x16'))['db'];function respondWithStatusCode(_0x3d1076,_0x160cb1){_0x160cb1=_0x160cb1||0xcc;return function(_0x21f27b){if(_0x21f27b){return _0x3d1076[_0xd236('0x17')](_0x160cb1);}return _0x3d1076[_0xd236('0x18')](_0x160cb1)[_0xd236('0x19')]();};}function respondWithResult(_0x22435c,_0x3d7465){_0x3d7465=_0x3d7465||0xc8;return function(_0x348734){if(_0x348734){return _0x22435c[_0xd236('0x18')](_0x3d7465)[_0xd236('0x1a')](_0x348734);}};}function respondWithFilteredResult(_0x3b60a7,_0xd851b5){return function(_0x3b2535){if(_0x3b2535){var _0x2a076d=typeof _0xd851b5[_0xd236('0x1b')]===_0xd236('0x1c')&&typeof _0xd851b5[_0xd236('0x1d')]==='undefined';var _0x4f06c6=_0x3b2535[_0xd236('0x1e')];var _0x1b02a5=_0x2a076d?0x0:_0xd851b5['offset'];var _0x11c6ec=_0x2a076d?_0x3b2535[_0xd236('0x1e')]:_0xd851b5[_0xd236('0x1b')]+_0xd851b5['limit'];var _0x355b65;if(_0x11c6ec>=_0x4f06c6){_0x11c6ec=_0x4f06c6;_0x355b65=0xc8;}else{_0x355b65=0xce;}_0x3b60a7[_0xd236('0x18')](_0x355b65);return _0x3b60a7[_0xd236('0x1f')]('Content-Range',_0x1b02a5+'-'+_0x11c6ec+'/'+_0x4f06c6)[_0xd236('0x1a')](_0x3b2535);}return null;};}function patchUpdates(_0x3b0a27){return function(_0x26c758){try{jsonpatch[_0xd236('0x20')](_0x26c758,_0x3b0a27,!![]);}catch(_0x2f512d){return BPromise['reject'](_0x2f512d);}return _0x26c758[_0xd236('0x21')]();};}function saveUpdates(_0x30e7aa,_0x1e4ddb){return function(_0x3d1e4e){if(_0x3d1e4e){return _0x3d1e4e[_0xd236('0x22')](_0x30e7aa)['then'](function(_0x4a35d0){return _0x4a35d0;});}return null;};}function removeEntity(_0x257f27,_0x4be5ac){return function(_0x22924d){if(_0x22924d){return _0x22924d['destroy']()[_0xd236('0x23')](function(){_0x257f27[_0xd236('0x18')](0xcc)[_0xd236('0x19')]();});}};}function handleEntityNotFound(_0x49d822,_0x41049a){return function(_0x339b08){if(!_0x339b08){_0x49d822[_0xd236('0x17')](0x194);}return _0x339b08;};}function handleError(_0x13ba7a,_0x3a30d8){_0x3a30d8=_0x3a30d8||0x1f4;return function(_0x17f927){logger[_0xd236('0x24')](_0x17f927[_0xd236('0x25')]);if(_0x17f927[_0xd236('0x26')]){delete _0x17f927[_0xd236('0x26')];}_0x13ba7a[_0xd236('0x18')](_0x3a30d8)[_0xd236('0x27')](_0x17f927);};}exports[_0xd236('0x28')]=function(_0x23714d,_0x3108f4){var _0x28175d={},_0x436a19={},_0x471ed6={'count':0x0,'rows':[]};var _0x463fc8=_[_0xd236('0x29')](db[_0xd236('0x2a')][_0xd236('0x2b')],function(_0x3c1617){return{'name':_0x3c1617[_0xd236('0x2c')],'type':_0x3c1617[_0xd236('0x2d')][_0xd236('0x2e')]};});_0x436a19[_0xd236('0x2f')]=_[_0xd236('0x29')](_0x463fc8,_0xd236('0x26'));_0x436a19['query']=_[_0xd236('0x30')](_0x23714d['query']);_0x436a19[_0xd236('0x31')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],_0x436a19['query']);_0x28175d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x23714d[_0xd236('0x35')][_0xd236('0x34')]));_0x28175d[_0xd236('0x33')]=_0x28175d['attributes'][_0xd236('0x36')]?_0x28175d['attributes']:_0x436a19[_0xd236('0x2f')];if(!_0x23714d['query'][_0xd236('0x37')](_0xd236('0x38'))){_0x28175d[_0xd236('0x1d')]=qs[_0xd236('0x1d')](_0x23714d[_0xd236('0x35')][_0xd236('0x1d')]);_0x28175d[_0xd236('0x1b')]=qs[_0xd236('0x1b')](_0x23714d[_0xd236('0x35')][_0xd236('0x1b')]);}_0x28175d[_0xd236('0x39')]=qs[_0xd236('0x3a')](_0x23714d[_0xd236('0x35')]['sort']);_0x28175d[_0xd236('0x3b')]=qs[_0xd236('0x31')](_[_0xd236('0x3c')](_0x23714d['query'],_0x436a19[_0xd236('0x31')]),_0x463fc8);if(_0x23714d[_0xd236('0x35')][_0xd236('0x3d')]){_0x28175d[_0xd236('0x3b')]=_[_0xd236('0x3e')](_0x28175d[_0xd236('0x3b')],{'$or':_['map'](_0x463fc8,function(_0x696bed){if(_0x696bed[_0xd236('0x2d')]!==_0xd236('0x3f')){var _0x3c798f={};_0x3c798f[_0x696bed[_0xd236('0x26')]]={'$like':'%'+_0x23714d[_0xd236('0x35')]['filter']+'%'};return _0x3c798f;}})});}_0x28175d=_[_0xd236('0x3e')]({},_0x28175d,_0x23714d[_0xd236('0x40')]);var _0x2ba3ae={'where':_0x28175d['where']};return db[_0xd236('0x2a')]['count'](_0x2ba3ae)[_0xd236('0x23')](function(_0x5793bf){_0x471ed6['count']=_0x5793bf;if(_0x23714d[_0xd236('0x35')][_0xd236('0x41')]){_0x28175d[_0xd236('0x42')]=[{'all':!![]}];}return db[_0xd236('0x2a')][_0xd236('0x43')](_0x28175d);})['then'](function(_0x4d0d65){_0x471ed6[_0xd236('0x44')]=_0x4d0d65;return _0x471ed6;})[_0xd236('0x23')](respondWithFilteredResult(_0x3108f4,_0x28175d))['catch'](handleError(_0x3108f4,null));};exports[_0xd236('0x45')]=function(_0x342fd5,_0x2d815b){var _0x55007d={'raw':!![],'where':{'id':_0x342fd5['params']['id']}},_0x58a93a={};_0x58a93a[_0xd236('0x2f')]=_['keys'](db['Cdr'][_0xd236('0x2b')]);_0x58a93a[_0xd236('0x35')]=_[_0xd236('0x30')](_0x342fd5[_0xd236('0x35')]);_0x58a93a[_0xd236('0x31')]=_['intersection'](_0x58a93a['model'],_0x58a93a[_0xd236('0x35')]);_0x55007d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x58a93a[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x342fd5[_0xd236('0x35')]['fields']));_0x55007d[_0xd236('0x33')]=_0x55007d['attributes'][_0xd236('0x36')]?_0x55007d[_0xd236('0x33')]:_0x58a93a['model'];if(_0x342fd5['query']['includeAll']){_0x55007d['include']=[{'all':!![]}];}_0x55007d=_[_0xd236('0x3e')]({},_0x55007d,_0x342fd5[_0xd236('0x40')]);return db[_0xd236('0x2a')][_0xd236('0x46')](_0x55007d)[_0xd236('0x23')](handleEntityNotFound(_0x2d815b,null))['then'](respondWithResult(_0x2d815b,null))['catch'](handleError(_0x2d815b,null));};exports[_0xd236('0x47')]=function(_0x7c0650,_0xbf4ba9){return db[_0xd236('0x2a')][_0xd236('0x47')](_0x7c0650[_0xd236('0x48')],{})['then'](respondWithResult(_0xbf4ba9,0xc9))[_0xd236('0x49')](handleError(_0xbf4ba9,null));};exports['update']=function(_0x223a14,_0x2c8861){if(_0x223a14['body']['id']){delete _0x223a14[_0xd236('0x48')]['id'];}return db[_0xd236('0x2a')]['find']({'where':{'id':_0x223a14['params']['id']}})[_0xd236('0x23')](handleEntityNotFound(_0x2c8861,null))[_0xd236('0x23')](saveUpdates(_0x223a14[_0xd236('0x48')],null))[_0xd236('0x23')](respondWithResult(_0x2c8861,null))['catch'](handleError(_0x2c8861,null));};exports[_0xd236('0x4a')]=function(_0x43c12b,_0x3d8ca6){return db[_0xd236('0x2a')][_0xd236('0x46')]({'where':{'id':_0x43c12b[_0xd236('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d8ca6,null))['then'](removeEntity(_0x3d8ca6,null))[_0xd236('0x49')](handleError(_0x3d8ca6,null));};exports['describe']=function(_0xa39da6,_0x30c336){return db['Cdr'][_0xd236('0x4c')]()[_0xd236('0x23')](respondWithResult(_0x30c336,null))['catch'](handleError(_0x30c336,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2f336f5..6815330 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3b8bd6,_0x59e831){var _0x5ec756=function(_0x541603){while(--_0x541603){_0x3b8bd6['push'](_0x3b8bd6['shift']());}};_0x5ec756(++_0x59e831);}(_0x7a54,0x106));var _0x47a5=function(_0x2e1c96,_0x455a12){_0x2e1c96=_0x2e1c96-0x0;var _0x369e1d=_0x7a54[_0x2e1c96];return _0x369e1d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x4befcb,_0x5a9448){var _0x5b5428=function(_0x55ca1a){while(--_0x55ca1a){_0x4befcb['push'](_0x4befcb['shift']());}};_0x5b5428(++_0x5a9448);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 12c1aa5..109d81c 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 _0xb328=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','code','Cdr,\x20%s,\x20%s','message','result','catch','util','bluebird'];(function(_0x786fc7,_0x24fbd3){var _0x4c6107=function(_0x503e83){while(--_0x503e83){_0x786fc7['push'](_0x786fc7['shift']());}};_0x4c6107(++_0x24fbd3);}(_0xb328,0xbc));var _0x8b32=function(_0x3d13a1,_0x3872bc){_0x3d13a1=_0x3d13a1-0x0;var _0x35fc5b=_0xb328[_0x3d13a1];return _0x35fc5b;};'use strict';var _=require('lodash');var util=require(_0x8b32('0x0'));var moment=require('moment');var BPromise=require(_0x8b32('0x1'));var rs=require(_0x8b32('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b32('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b32('0x4'))(_0x8b32('0x5'));var config=require(_0x8b32('0x6'));var jayson=require(_0x8b32('0x7'));var client=jayson[_0x8b32('0x8')][_0x8b32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1966ae,_0x94a2b7,_0x14197c){return new BPromise(function(_0x2717a2,_0x406967){return client['request'](_0x1966ae,_0x14197c)[_0x8b32('0xa')](function(_0x51cb64){logger[_0x8b32('0xb')]('Cdr,\x20%s,\x20%s',_0x94a2b7,_0x8b32('0xc'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x94a2b7,_0x8b32('0xc'),JSON['stringify'](_0x51cb64));if(_0x51cb64[_0x8b32('0xd')]){if(_0x51cb64[_0x8b32('0xd')][_0x8b32('0xe')]===0x1f4){logger[_0x8b32('0xd')](_0x8b32('0xf'),_0x94a2b7,_0x51cb64[_0x8b32('0xd')][_0x8b32('0x10')]);return _0x406967(_0x51cb64['error']['message']);}logger[_0x8b32('0xd')](_0x8b32('0xf'),_0x94a2b7,_0x51cb64[_0x8b32('0xd')]['message']);return _0x2717a2(_0x51cb64[_0x8b32('0xd')][_0x8b32('0x10')]);}else{logger[_0x8b32('0xb')](_0x8b32('0xf'),_0x94a2b7,_0x8b32('0xc'));_0x2717a2(_0x51cb64[_0x8b32('0x11')]['message']);}})[_0x8b32('0x12')](function(_0x356129){logger[_0x8b32('0xd')](_0x8b32('0xf'),_0x94a2b7,_0x356129);_0x406967(_0x356129);});});} \ No newline at end of file +var _0x4b67=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','error','code','Cdr,\x20%s,\x20%s','message','info','result'];(function(_0x45e23d,_0x5be96d){var _0x1b82d1=function(_0x333cde){while(--_0x333cde){_0x45e23d['push'](_0x45e23d['shift']());}};_0x1b82d1(++_0x5be96d);}(_0x4b67,0x177));var _0x74b6=function(_0x306ea0,_0x2f7e6e){_0x306ea0=_0x306ea0-0x0;var _0x2dc13f=_0x4b67[_0x306ea0];return _0x2dc13f;};'use strict';var _=require('lodash');var util=require(_0x74b6('0x0'));var moment=require(_0x74b6('0x1'));var BPromise=require(_0x74b6('0x2'));var rs=require(_0x74b6('0x3'));var fs=require('fs');var Redis=require(_0x74b6('0x4'));var db=require(_0x74b6('0x5'))['db'];var utils=require(_0x74b6('0x6'));var logger=require('../../config/logger')(_0x74b6('0x7'));var config=require(_0x74b6('0x8'));var jayson=require(_0x74b6('0x9'));var client=jayson[_0x74b6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25345a,_0x17e9a5,_0x58ce2c){return new BPromise(function(_0xe9daa7,_0x4e21fa){return client[_0x74b6('0xb')](_0x25345a,_0x58ce2c)[_0x74b6('0xc')](function(_0x21b638){logger['info']('Cdr,\x20%s,\x20%s',_0x17e9a5,_0x74b6('0xd'));logger[_0x74b6('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x17e9a5,_0x74b6('0xd'),JSON['stringify'](_0x21b638));if(_0x21b638[_0x74b6('0xf')]){if(_0x21b638[_0x74b6('0xf')][_0x74b6('0x10')]===0x1f4){logger['error'](_0x74b6('0x11'),_0x17e9a5,_0x21b638[_0x74b6('0xf')][_0x74b6('0x12')]);return _0x4e21fa(_0x21b638[_0x74b6('0xf')][_0x74b6('0x12')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x17e9a5,_0x21b638[_0x74b6('0xf')][_0x74b6('0x12')]);return _0xe9daa7(_0x21b638[_0x74b6('0xf')]['message']);}else{logger[_0x74b6('0x13')](_0x74b6('0x11'),_0x17e9a5,_0x74b6('0xd'));_0xe9daa7(_0x21b638[_0x74b6('0x14')]['message']);}})[_0x74b6('0x15')](function(_0x2f35fb){logger[_0x74b6('0xf')](_0x74b6('0x11'),_0x17e9a5,_0x2f35fb);_0x4e21fa(_0x2f35fb);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index fed2fdb..8299d29 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x2f16e5,_0x2e75e0){var _0x5d082a=function(_0x13873b){while(--_0x13873b){_0x2f16e5['push'](_0x2f16e5['shift']());}};_0x5d082a(++_0x2e75e0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));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 54518d9..0570584 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 _0x7de1=['STRING','noop','TEXT','sequelize'];(function(_0x51ed37,_0x2b3b07){var _0x53bc4e=function(_0x217aa1){while(--_0x217aa1){_0x51ed37['push'](_0x51ed37['shift']());}};_0x53bc4e(++_0x2b3b07);}(_0x7de1,0x167));var _0x17de=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0x7de1[_0x54a9e3];return _0x247cce;};'use strict';var Sequelize=require(_0x17de('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x17de('0x1')],'allowNull':![],'defaultValue':_0x17de('0x2')},'appdata':{'type':Sequelize[_0x17de('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x17de('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5488=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x5d1201,_0x208c11){var _0x21f82d=function(_0x2c910c){while(--_0x2c910c){_0x5d1201['push'](_0x5d1201['shift']());}};_0x21f82d(++_0x208c11);}(_0x5488,0x11a));var _0x8548=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x5488[_0x3fc97b];return _0x3a0c82;};'use strict';var Sequelize=require(_0x8548('0x0'));module[_0x8548('0x1')]={'priority':{'type':Sequelize[_0x8548('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8548('0x3')],'allowNull':![],'defaultValue':_0x8548('0x4')},'appdata':{'type':Sequelize[_0x8548('0x5')]()},'description':{'type':Sequelize[_0x8548('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index e93e11c..5cb5a4b 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 _0xbf5c=['options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','includeAll','include','merge'];(function(_0x5743eb,_0x4f1ecd){var _0x4a2643=function(_0x20728c){while(--_0x20728c){_0x5743eb['push'](_0x5743eb['shift']());}};_0x4a2643(++_0x4f1ecd);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x246fa6,_0x1a4e76){_0x246fa6=_0x246fa6-0x0;var _0x455b7c=_0xbf5c[_0x246fa6];return _0x455b7c;};'use strict';var emlformat=require(_0xcbf5('0x0'));var rimraf=require(_0xcbf5('0x1'));var zipdir=require(_0xcbf5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcbf5('0x3'));var moment=require(_0xcbf5('0x4'));var BPromise=require(_0xcbf5('0x5'));var Mustache=require('mustache');var util=require(_0xcbf5('0x6'));var path=require(_0xcbf5('0x7'));var sox=require('sox');var csv=require(_0xcbf5('0x8'));var ejs=require(_0xcbf5('0x9'));var fs=require('fs');var fs_extra=require(_0xcbf5('0xa'));var _=require('lodash');var squel=require(_0xcbf5('0xb'));var crypto=require(_0xcbf5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcbf5('0x8'));var querystring=require(_0xcbf5('0xd'));var Papa=require(_0xcbf5('0xe'));var Redis=require('ioredis');var authService=require(_0xcbf5('0xf'));var qs=require(_0xcbf5('0x10'));var as=require(_0xcbf5('0x11'));var hardwareService=require(_0xcbf5('0x12'));var logger=require(_0xcbf5('0x13'))(_0xcbf5('0x14'));var utils=require('../../config/utils');var config=require(_0xcbf5('0x15'));var licenseUtil=require(_0xcbf5('0x16'));var db=require(_0xcbf5('0x17'))['db'];function respondWithStatusCode(_0x4a894b,_0x5e5307){_0x5e5307=_0x5e5307||0xcc;return function(_0x18c2fe){if(_0x18c2fe){return _0x4a894b['sendStatus'](_0x5e5307);}return _0x4a894b[_0xcbf5('0x18')](_0x5e5307)[_0xcbf5('0x19')]();};}function respondWithResult(_0x5cbcf6,_0x2e7536){_0x2e7536=_0x2e7536||0xc8;return function(_0x51b1d2){if(_0x51b1d2){return _0x5cbcf6['status'](_0x2e7536)[_0xcbf5('0x1a')](_0x51b1d2);}};}function respondWithFilteredResult(_0x550e21,_0x2c58ba){return function(_0x5348ce){if(_0x5348ce){var _0x4fc535=typeof _0x2c58ba[_0xcbf5('0x1b')]===_0xcbf5('0x1c')&&typeof _0x2c58ba[_0xcbf5('0x1d')]===_0xcbf5('0x1c');var _0x7f2153=_0x5348ce[_0xcbf5('0x1e')];var _0x462d46=_0x4fc535?0x0:_0x2c58ba['offset'];var _0xcf3d18=_0x4fc535?_0x5348ce[_0xcbf5('0x1e')]:_0x2c58ba[_0xcbf5('0x1b')]+_0x2c58ba[_0xcbf5('0x1d')];var _0x269b01;if(_0xcf3d18>=_0x7f2153){_0xcf3d18=_0x7f2153;_0x269b01=0xc8;}else{_0x269b01=0xce;}_0x550e21[_0xcbf5('0x18')](_0x269b01);return _0x550e21[_0xcbf5('0x1f')](_0xcbf5('0x20'),_0x462d46+'-'+_0xcf3d18+'/'+_0x7f2153)['json'](_0x5348ce);}return null;};}function patchUpdates(_0x155147){return function(_0x4e8874){try{jsonpatch[_0xcbf5('0x21')](_0x4e8874,_0x155147,!![]);}catch(_0x4c7b1e){return BPromise[_0xcbf5('0x22')](_0x4c7b1e);}return _0x4e8874[_0xcbf5('0x23')]();};}function saveUpdates(_0x2334f1,_0xf2360){return function(_0x3e9548){if(_0x3e9548){return _0x3e9548[_0xcbf5('0x24')](_0x2334f1)['then'](function(_0x17bbc8){return _0x17bbc8;});}return null;};}function removeEntity(_0x5602fd,_0x965482){return function(_0x1b59d4){if(_0x1b59d4){return _0x1b59d4[_0xcbf5('0x25')]()[_0xcbf5('0x26')](function(){_0x5602fd['status'](0xcc)[_0xcbf5('0x19')]();});}};}function handleEntityNotFound(_0x43e9af,_0x2aa7c){return function(_0x41d465){if(!_0x41d465){_0x43e9af[_0xcbf5('0x27')](0x194);}return _0x41d465;};}function handleError(_0x27557f,_0x149b61){_0x149b61=_0x149b61||0x1f4;return function(_0xe6742){logger['error'](_0xe6742[_0xcbf5('0x28')]);if(_0xe6742[_0xcbf5('0x29')]){delete _0xe6742[_0xcbf5('0x29')];}_0x27557f[_0xcbf5('0x18')](_0x149b61)[_0xcbf5('0x2a')](_0xe6742);};}exports['show']=function(_0x1293ab,_0x367eb0){var _0x9ce00={'raw':!![],'where':{'id':_0x1293ab[_0xcbf5('0x2b')]['id']}},_0x3389a1={};_0x3389a1[_0xcbf5('0x2c')]=_['keys'](db[_0xcbf5('0x2d')][_0xcbf5('0x2e')]);_0x3389a1[_0xcbf5('0x2f')]=_[_0xcbf5('0x30')](_0x1293ab[_0xcbf5('0x2f')]);_0x3389a1[_0xcbf5('0x31')]=_[_0xcbf5('0x32')](_0x3389a1['model'],_0x3389a1['query']);_0x9ce00[_0xcbf5('0x33')]=_['intersection'](_0x3389a1[_0xcbf5('0x2c')],qs[_0xcbf5('0x34')](_0x1293ab[_0xcbf5('0x2f')][_0xcbf5('0x34')]));_0x9ce00[_0xcbf5('0x33')]=_0x9ce00['attributes']['length']?_0x9ce00[_0xcbf5('0x33')]:_0x3389a1[_0xcbf5('0x2c')];if(_0x1293ab[_0xcbf5('0x2f')][_0xcbf5('0x35')]){_0x9ce00[_0xcbf5('0x36')]=[{'all':!![]}];}_0x9ce00=_[_0xcbf5('0x37')]({},_0x9ce00,_0x1293ab[_0xcbf5('0x38')]);return db['ChatApplication'][_0xcbf5('0x39')](_0x9ce00)[_0xcbf5('0x26')](handleEntityNotFound(_0x367eb0,null))[_0xcbf5('0x26')](respondWithResult(_0x367eb0,null))[_0xcbf5('0x3a')](handleError(_0x367eb0,null));};exports['update']=function(_0x4840fe,_0x3e180c){if(_0x4840fe['body']['id']){delete _0x4840fe[_0xcbf5('0x3b')]['id'];}return db[_0xcbf5('0x2d')]['find']({'where':{'id':_0x4840fe['params']['id']}})[_0xcbf5('0x26')](handleEntityNotFound(_0x3e180c,null))[_0xcbf5('0x26')](saveUpdates(_0x4840fe[_0xcbf5('0x3b')],null))[_0xcbf5('0x26')](respondWithResult(_0x3e180c,null))['catch'](handleError(_0x3e180c,null));};exports[_0xcbf5('0x25')]=function(_0x3c70e6,_0x11a8ea){return db[_0xcbf5('0x2d')]['find']({'where':{'id':_0x3c70e6[_0xcbf5('0x2b')]['id']}})[_0xcbf5('0x26')](handleEntityNotFound(_0x11a8ea,null))['then'](removeEntity(_0x11a8ea,null))['catch'](handleError(_0x11a8ea,null));}; \ No newline at end of file +var _0x5423=['rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','attributes','intersection','fields','include','merge','options','find','then','catch','body','ChatApplication','eml-format'];(function(_0x2ab6bc,_0x55819f){var _0x435777=function(_0x51eb57){while(--_0x51eb57){_0x2ab6bc['push'](_0x2ab6bc['shift']());}};_0x435777(++_0x55819f);}(_0x5423,0xe3));var _0x3542=function(_0x1260f3,_0x5e8cbc){_0x1260f3=_0x1260f3-0x0;var _0xa76db3=_0x5423[_0x1260f3];return _0xa76db3;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];function respondWithStatusCode(_0x1cf710,_0x43e977){_0x43e977=_0x43e977||0xcc;return function(_0x4ee86){if(_0x4ee86){return _0x1cf710[_0x3542('0x18')](_0x43e977);}return _0x1cf710[_0x3542('0x19')](_0x43e977)[_0x3542('0x1a')]();};}function respondWithResult(_0x15863d,_0x4bac5b){_0x4bac5b=_0x4bac5b||0xc8;return function(_0x14fe57){if(_0x14fe57){return _0x15863d['status'](_0x4bac5b)[_0x3542('0x1b')](_0x14fe57);}};}function respondWithFilteredResult(_0x13fe0b,_0xc33d42){return function(_0x546fbd){if(_0x546fbd){var _0x270312=typeof _0xc33d42[_0x3542('0x1c')]===_0x3542('0x1d')&&typeof _0xc33d42['limit']===_0x3542('0x1d');var _0x23b0de=_0x546fbd[_0x3542('0x1e')];var _0x3d5199=_0x270312?0x0:_0xc33d42['offset'];var _0x32df3f=_0x270312?_0x546fbd['count']:_0xc33d42[_0x3542('0x1c')]+_0xc33d42[_0x3542('0x1f')];var _0x4d93bc;if(_0x32df3f>=_0x23b0de){_0x32df3f=_0x23b0de;_0x4d93bc=0xc8;}else{_0x4d93bc=0xce;}_0x13fe0b[_0x3542('0x19')](_0x4d93bc);return _0x13fe0b[_0x3542('0x20')](_0x3542('0x21'),_0x3d5199+'-'+_0x32df3f+'/'+_0x23b0de)[_0x3542('0x1b')](_0x546fbd);}return null;};}function patchUpdates(_0x212950){return function(_0x4a7695){try{jsonpatch['apply'](_0x4a7695,_0x212950,!![]);}catch(_0x4c58f1){return BPromise[_0x3542('0x22')](_0x4c58f1);}return _0x4a7695['save']();};}function saveUpdates(_0x1d5488,_0x551645){return function(_0x1d5f1e){if(_0x1d5f1e){return _0x1d5f1e['update'](_0x1d5488)['then'](function(_0x3eacd0){return _0x3eacd0;});}return null;};}function removeEntity(_0xe3f983,_0x5ae097){return function(_0x5d05b2){if(_0x5d05b2){return _0x5d05b2[_0x3542('0x23')]()['then'](function(){_0xe3f983[_0x3542('0x19')](0xcc)[_0x3542('0x1a')]();});}};}function handleEntityNotFound(_0x1e0723,_0x2f2e63){return function(_0x298763){if(!_0x298763){_0x1e0723[_0x3542('0x18')](0x194);}return _0x298763;};}function handleError(_0x412184,_0x1e156e){_0x1e156e=_0x1e156e||0x1f4;return function(_0x18dc6c){logger[_0x3542('0x24')](_0x18dc6c[_0x3542('0x25')]);if(_0x18dc6c[_0x3542('0x26')]){delete _0x18dc6c[_0x3542('0x26')];}_0x412184[_0x3542('0x19')](_0x1e156e)[_0x3542('0x27')](_0x18dc6c);};}exports[_0x3542('0x28')]=function(_0x303412,_0x20eda1){var _0x3bd666={'raw':!![],'where':{'id':_0x303412[_0x3542('0x29')]['id']}},_0x5590a2={};_0x5590a2[_0x3542('0x2a')]=_[_0x3542('0x2b')](db['ChatApplication'][_0x3542('0x2c')]);_0x5590a2[_0x3542('0x2d')]=_[_0x3542('0x2b')](_0x303412[_0x3542('0x2d')]);_0x5590a2['filters']=_['intersection'](_0x5590a2[_0x3542('0x2a')],_0x5590a2[_0x3542('0x2d')]);_0x3bd666[_0x3542('0x2e')]=_[_0x3542('0x2f')](_0x5590a2[_0x3542('0x2a')],qs[_0x3542('0x30')](_0x303412[_0x3542('0x2d')]['fields']));_0x3bd666['attributes']=_0x3bd666[_0x3542('0x2e')]['length']?_0x3bd666['attributes']:_0x5590a2[_0x3542('0x2a')];if(_0x303412['query']['includeAll']){_0x3bd666[_0x3542('0x31')]=[{'all':!![]}];}_0x3bd666=_[_0x3542('0x32')]({},_0x3bd666,_0x303412[_0x3542('0x33')]);return db['ChatApplication'][_0x3542('0x34')](_0x3bd666)['then'](handleEntityNotFound(_0x20eda1,null))[_0x3542('0x35')](respondWithResult(_0x20eda1,null))[_0x3542('0x36')](handleError(_0x20eda1,null));};exports['update']=function(_0x3a0027,_0x487514){if(_0x3a0027[_0x3542('0x37')]['id']){delete _0x3a0027[_0x3542('0x37')]['id'];}return db[_0x3542('0x38')]['find']({'where':{'id':_0x3a0027[_0x3542('0x29')]['id']}})['then'](handleEntityNotFound(_0x487514,null))[_0x3542('0x35')](saveUpdates(_0x3a0027[_0x3542('0x37')],null))[_0x3542('0x35')](respondWithResult(_0x487514,null))[_0x3542('0x36')](handleError(_0x487514,null));};exports[_0x3542('0x23')]=function(_0x6cff91,_0x1f4d31){return db[_0x3542('0x38')][_0x3542('0x34')]({'where':{'id':_0x6cff91[_0x3542('0x29')]['id']}})[_0x3542('0x35')](handleEntityNotFound(_0x1f4d31,null))[_0x3542('0x35')](removeEntity(_0x1f4d31,null))[_0x3542('0x36')](handleError(_0x1f4d31,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 9ff8113..1beeab2 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 _0xcd63=['path','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xd5709b,_0x101823){var _0x3dc484=function(_0x28a409){while(--_0x28a409){_0xd5709b['push'](_0xd5709b['shift']());}};_0x3dc484(++_0x101823);}(_0xcd63,0xe4));var _0x3cd6=function(_0x51b9df,_0x6bbd74){_0x51b9df=_0x51b9df-0x0;var _0xf271f=_0xcd63[_0x51b9df];return _0xf271f;};'use strict';var _=require(_0x3cd6('0x0'));var util=require(_0x3cd6('0x1'));var logger=require(_0x3cd6('0x2'))(_0x3cd6('0x3'));var moment=require(_0x3cd6('0x4'));var BPromise=require('bluebird');var rp=require(_0x3cd6('0x5'));var fs=require('fs');var path=require(_0x3cd6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3cd6('0x7'));module[_0x3cd6('0x8')]=function(_0x17974e,_0x5d0192){return _0x17974e[_0x3cd6('0x9')](_0x3cd6('0xa'),attributes,{'tableName':_0x3cd6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3cd6('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1cbb=['bluebird','request-promise','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','lodash','util','api','moment'];(function(_0x91fec0,_0x1d08c6){var _0xa7f524=function(_0x359e9a){while(--_0x359e9a){_0x91fec0['push'](_0x91fec0['shift']());}};_0xa7f524(++_0x1d08c6);}(_0x1cbb,0x18f));var _0xb1cb=function(_0x278d73,_0x58c873){_0x278d73=_0x278d73-0x0;var _0x2c7399=_0x1cbb[_0x278d73];return _0x2c7399;};'use strict';var _=require(_0xb1cb('0x0'));var util=require(_0xb1cb('0x1'));var logger=require('../../config/logger')(_0xb1cb('0x2'));var moment=require(_0xb1cb('0x3'));var BPromise=require(_0xb1cb('0x4'));var rp=require(_0xb1cb('0x5'));var fs=require('fs');var path=require(_0xb1cb('0x6'));var rimraf=require('rimraf');var config=require(_0xb1cb('0x7'));var attributes=require(_0xb1cb('0x8'));module[_0xb1cb('0x9')]=function(_0x3555b0,_0x23254e){return _0x3555b0[_0xb1cb('0xa')](_0xb1cb('0xb'),attributes,{'tableName':_0xb1cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 449fa1b..4d2a307 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 _0x9ba1=['code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3d20b2,_0x5057a2){var _0x2ff3d1=function(_0x3aa32f){while(--_0x3aa32f){_0x3d20b2['push'](_0x3d20b2['shift']());}};_0x2ff3d1(++_0x5057a2);}(_0x9ba1,0x1bb));var _0x19ba=function(_0x1b62f1,_0xbff968){_0x1b62f1=_0x1b62f1-0x0;var _0x582f72=_0x9ba1[_0x1b62f1];return _0x582f72;};'use strict';var _=require('lodash');var util=require(_0x19ba('0x0'));var moment=require('moment');var BPromise=require(_0x19ba('0x1'));var rs=require(_0x19ba('0x2'));var fs=require('fs');var Redis=require(_0x19ba('0x3'));var db=require(_0x19ba('0x4'))['db'];var utils=require(_0x19ba('0x5'));var logger=require(_0x19ba('0x6'))(_0x19ba('0x7'));var config=require(_0x19ba('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37c867,_0x45548a,_0x575ab1){return new BPromise(function(_0x1d50c6,_0x17eb75){return client[_0x19ba('0x9')](_0x37c867,_0x575ab1)[_0x19ba('0xa')](function(_0x314ff2){logger[_0x19ba('0xb')](_0x19ba('0xc'),_0x45548a,_0x19ba('0xd'));logger['debug'](_0x19ba('0xe'),_0x45548a,_0x19ba('0xd'),JSON[_0x19ba('0xf')](_0x314ff2));if(_0x314ff2[_0x19ba('0x10')]){if(_0x314ff2[_0x19ba('0x10')][_0x19ba('0x11')]===0x1f4){logger[_0x19ba('0x10')]('ChatApplication,\x20%s,\x20%s',_0x45548a,_0x314ff2[_0x19ba('0x10')][_0x19ba('0x12')]);return _0x17eb75(_0x314ff2[_0x19ba('0x10')][_0x19ba('0x12')]);}logger[_0x19ba('0x10')](_0x19ba('0xc'),_0x45548a,_0x314ff2[_0x19ba('0x10')]['message']);return _0x1d50c6(_0x314ff2[_0x19ba('0x10')][_0x19ba('0x12')]);}else{logger[_0x19ba('0xb')](_0x19ba('0xc'),_0x45548a,_0x19ba('0xd'));_0x1d50c6(_0x314ff2[_0x19ba('0x13')][_0x19ba('0x12')]);}})['catch'](function(_0x6fb7f8){logger[_0x19ba('0x10')](_0x19ba('0xc'),_0x45548a,_0x6fb7f8);_0x17eb75(_0x6fb7f8);});});} \ No newline at end of file +var _0x0a8d=['jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x8b1872,_0x1609b2){var _0x576577=function(_0x956d3b){while(--_0x956d3b){_0x8b1872['push'](_0x8b1872['shift']());}};_0x576577(++_0x1609b2);}(_0x0a8d,0x86));var _0xd0a8=function(_0x5aa57f,_0x40419f){_0x5aa57f=_0x5aa57f-0x0;var _0x562389=_0x0a8d[_0x5aa57f];return _0x562389;};'use strict';var _=require(_0xd0a8('0x0'));var util=require(_0xd0a8('0x1'));var moment=require(_0xd0a8('0x2'));var BPromise=require(_0xd0a8('0x3'));var rs=require(_0xd0a8('0x4'));var fs=require('fs');var Redis=require(_0xd0a8('0x5'));var db=require(_0xd0a8('0x6'))['db'];var utils=require(_0xd0a8('0x7'));var logger=require('../../config/logger')(_0xd0a8('0x8'));var config=require(_0xd0a8('0x9'));var jayson=require(_0xd0a8('0xa'));var client=jayson['client'][_0xd0a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c10d7,_0x4f985a,_0x20381b){return new BPromise(function(_0x24960c,_0x263c35){return client[_0xd0a8('0xc')](_0x5c10d7,_0x20381b)[_0xd0a8('0xd')](function(_0x2001e2){logger[_0xd0a8('0xe')](_0xd0a8('0xf'),_0x4f985a,_0xd0a8('0x10'));logger['debug'](_0xd0a8('0x11'),_0x4f985a,'request\x20sent',JSON[_0xd0a8('0x12')](_0x2001e2));if(_0x2001e2['error']){if(_0x2001e2[_0xd0a8('0x13')][_0xd0a8('0x14')]===0x1f4){logger[_0xd0a8('0x13')](_0xd0a8('0xf'),_0x4f985a,_0x2001e2[_0xd0a8('0x13')][_0xd0a8('0x15')]);return _0x263c35(_0x2001e2[_0xd0a8('0x13')]['message']);}logger[_0xd0a8('0x13')](_0xd0a8('0xf'),_0x4f985a,_0x2001e2['error'][_0xd0a8('0x15')]);return _0x24960c(_0x2001e2[_0xd0a8('0x13')][_0xd0a8('0x15')]);}else{logger[_0xd0a8('0xe')](_0xd0a8('0xf'),_0x4f985a,_0xd0a8('0x10'));_0x24960c(_0x2001e2[_0xd0a8('0x16')][_0xd0a8('0x15')]);}})[_0xd0a8('0x17')](function(_0x37c17f){logger[_0xd0a8('0x13')](_0xd0a8('0xf'),_0x4f985a,_0x37c17f);_0x263c35(_0x37c17f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 367cccd..0e4ee4a 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 _0x1664=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','update','exports','multer','util','path','Router'];(function(_0x543881,_0x57a681){var _0x12311b=function(_0x1d3df9){while(--_0x1d3df9){_0x543881['push'](_0x543881['shift']());}};_0x12311b(++_0x57a681);}(_0x1664,0xf8));var _0x4166=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x1664[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x4166('0x0'));var util=require(_0x4166('0x1'));var path=require(_0x4166('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4166('0x3')]();var fs_extra=require(_0x4166('0x4'));var auth=require(_0x4166('0x5'));var interaction=require(_0x4166('0x6'));var config=require(_0x4166('0x7'));var controller=require(_0x4166('0x8'));router['get'](_0x4166('0x9'),auth[_0x4166('0xa')](),controller[_0x4166('0xb')]);router['put']('/:id',auth[_0x4166('0xa')](),controller[_0x4166('0xc')]);router['delete']('/:id',auth[_0x4166('0xa')](),controller['destroy']);module[_0x4166('0xd')]=router; \ No newline at end of file +var _0x288e=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','put','destroy'];(function(_0x3ef4e5,_0x2a67ad){var _0x231d32=function(_0x17e46b){while(--_0x17e46b){_0x3ef4e5['push'](_0x3ef4e5['shift']());}};_0x231d32(++_0x2a67ad);}(_0x288e,0xf8));var _0xe288=function(_0x121269,_0x4debc2){_0x121269=_0x121269-0x0;var _0x10b1d9=_0x288e[_0x121269];return _0x10b1d9;};'use strict';var multer=require('multer');var util=require(_0xe288('0x0'));var path=require(_0xe288('0x1'));var timeout=require(_0xe288('0x2'));var express=require(_0xe288('0x3'));var router=express[_0xe288('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe288('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe288('0x6'));var controller=require(_0xe288('0x7'));router['get'](_0xe288('0x8'),auth[_0xe288('0x9')](),controller['show']);router[_0xe288('0xa')](_0xe288('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe288('0x8'),auth['isAuthenticated'](),controller[_0xe288('0xb')]);module[_0xe288('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 5074eb4..65cbabd 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 _0x7567=['exports','STRING','BOOLEAN','sequelize'];(function(_0x94d812,_0x5c12a0){var _0x5a3482=function(_0x4a6bb9){while(--_0x4a6bb9){_0x94d812['push'](_0x94d812['shift']());}};_0x5a3482(++_0x5c12a0);}(_0x7567,0x143));var _0x7756=function(_0x5d4198,_0x5c17bc){_0x5d4198=_0x5d4198-0x0;var _0x11d48f=_0x7567[_0x5d4198];return _0x11d48f;};'use strict';var Sequelize=require(_0x7756('0x0'));module[_0x7756('0x1')]={'name':{'type':Sequelize[_0x7756('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7756('0x2')]},'write':{'type':Sequelize[_0x7756('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x30f9=['BOOLEAN','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x30f9,0xc5));var _0x930f=function(_0x1dd8f6,_0x3ea487){_0x1dd8f6=_0x1dd8f6-0x0;var _0xf083b7=_0x30f9[_0x1dd8f6];return _0xf083b7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x930f('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x930f('0x0')]},'write':{'type':Sequelize[_0x930f('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index cf9351d..2dcef54 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 _0x9a39=['socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','omit','ids','getMembers','User','order','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','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','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','redis','defaults'];(function(_0x2bc579,_0x5a54d1){var _0x88c913=function(_0x56ec98){while(--_0x56ec98){_0x2bc579['push'](_0x2bc579['shift']());}};_0x88c913(++_0x5a54d1);}(_0x9a39,0xaa));var _0x99a3=function(_0x2da15f,_0x5c12fe){_0x2da15f=_0x2da15f-0x0;var _0x49a15f=_0x9a39[_0x2da15f];return _0x49a15f;};'use strict';var emlformat=require(_0x99a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x99a3('0x1'));var jsonpatch=require(_0x99a3('0x2'));var rp=require(_0x99a3('0x3'));var moment=require(_0x99a3('0x4'));var BPromise=require(_0x99a3('0x5'));var Mustache=require(_0x99a3('0x6'));var util=require(_0x99a3('0x7'));var path=require(_0x99a3('0x8'));var sox=require(_0x99a3('0x9'));var csv=require(_0x99a3('0xa'));var ejs=require(_0x99a3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99a3('0xc'));var squel=require(_0x99a3('0xd'));var crypto=require('crypto');var jsforce=require(_0x99a3('0xe'));var deskjs=require(_0x99a3('0xf'));var toCsv=require(_0x99a3('0xa'));var querystring=require(_0x99a3('0x10'));var Papa=require(_0x99a3('0x11'));var Redis=require(_0x99a3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x99a3('0x13'));var as=require(_0x99a3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x99a3('0x15'));var utils=require(_0x99a3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x99a3('0x17'));var db=require('../../mysqldb')['db'];config[_0x99a3('0x18')]=_[_0x99a3('0x19')](config[_0x99a3('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x99a3('0x1a'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x99a3('0x1b')](socket);function respondWithStatusCode(_0x32e665,_0x2b5bcb){_0x2b5bcb=_0x2b5bcb||0xcc;return function(_0x56a0e7){if(_0x56a0e7){return _0x32e665[_0x99a3('0x1c')](_0x2b5bcb);}return _0x32e665[_0x99a3('0x1d')](_0x2b5bcb)['end']();};}function respondWithResult(_0x43642e,_0x23a048){_0x23a048=_0x23a048||0xc8;return function(_0x36dae4){if(_0x36dae4){return _0x43642e[_0x99a3('0x1d')](_0x23a048)[_0x99a3('0x1e')](_0x36dae4);}};}function respondWithFilteredResult(_0x481629,_0x4d943b){return function(_0x4f976c){if(_0x4f976c){var _0x1036ac=typeof _0x4d943b[_0x99a3('0x1f')]===_0x99a3('0x20')&&typeof _0x4d943b[_0x99a3('0x21')]===_0x99a3('0x20');var _0xd26e9e=_0x4f976c[_0x99a3('0x22')];var _0x633355=_0x1036ac?0x0:_0x4d943b[_0x99a3('0x1f')];var _0x1f5f85=_0x1036ac?_0x4f976c['count']:_0x4d943b[_0x99a3('0x1f')]+_0x4d943b['limit'];var _0x3e651d;if(_0x1f5f85>=_0xd26e9e){_0x1f5f85=_0xd26e9e;_0x3e651d=0xc8;}else{_0x3e651d=0xce;}_0x481629['status'](_0x3e651d);return _0x481629[_0x99a3('0x23')]('Content-Range',_0x633355+'-'+_0x1f5f85+'/'+_0xd26e9e)[_0x99a3('0x1e')](_0x4f976c);}return null;};}function patchUpdates(_0xc0c31){return function(_0x1d66e4){try{jsonpatch[_0x99a3('0x24')](_0x1d66e4,_0xc0c31,!![]);}catch(_0x14ba98){return BPromise[_0x99a3('0x25')](_0x14ba98);}return _0x1d66e4[_0x99a3('0x26')]();};}function saveUpdates(_0x3d3f2d,_0x5219ec){return function(_0x456489){if(_0x456489){return _0x456489[_0x99a3('0x27')](_0x3d3f2d)[_0x99a3('0x28')](function(_0x29e1cd){return _0x29e1cd;});}return null;};}function removeEntity(_0x5f9309,_0x5ef067){return function(_0x18e3d2){if(_0x18e3d2){return _0x18e3d2[_0x99a3('0x29')]()['then'](function(){_0x5f9309[_0x99a3('0x1d')](0xcc)[_0x99a3('0x2a')]();});}};}function handleEntityNotFound(_0x30876f,_0x404266){return function(_0x406741){if(!_0x406741){_0x30876f[_0x99a3('0x1c')](0x194);}return _0x406741;};}function handleError(_0xd4108,_0x15b56e){_0x15b56e=_0x15b56e||0x1f4;return function(_0x4b11b9){logger[_0x99a3('0x2b')](_0x4b11b9[_0x99a3('0x2c')]);if(_0x4b11b9['name']){delete _0x4b11b9[_0x99a3('0x2d')];}_0xd4108[_0x99a3('0x1d')](_0x15b56e)[_0x99a3('0x2e')](_0x4b11b9);};}exports['index']=function(_0x379374,_0x46fb04){var _0x13031c={},_0x89c746={},_0x38360f={'count':0x0,'rows':[]};var _0xc76ae5=_[_0x99a3('0x2f')](db[_0x99a3('0x30')][_0x99a3('0x31')],function(_0x1398f7){return{'name':_0x1398f7[_0x99a3('0x32')],'type':_0x1398f7['type'][_0x99a3('0x33')]};});_0x89c746[_0x99a3('0x34')]=_[_0x99a3('0x2f')](_0xc76ae5,_0x99a3('0x2d'));_0x89c746[_0x99a3('0x35')]=_[_0x99a3('0x36')](_0x379374[_0x99a3('0x35')]);_0x89c746[_0x99a3('0x37')]=_[_0x99a3('0x38')](_0x89c746[_0x99a3('0x34')],_0x89c746[_0x99a3('0x35')]);_0x13031c[_0x99a3('0x39')]=_['intersection'](_0x89c746[_0x99a3('0x34')],qs[_0x99a3('0x3a')](_0x379374[_0x99a3('0x35')]['fields']));_0x13031c[_0x99a3('0x39')]=_0x13031c[_0x99a3('0x39')]['length']?_0x13031c[_0x99a3('0x39')]:_0x89c746[_0x99a3('0x34')];if(!_0x379374[_0x99a3('0x35')][_0x99a3('0x3b')](_0x99a3('0x3c'))){_0x13031c['limit']=qs[_0x99a3('0x21')](_0x379374[_0x99a3('0x35')][_0x99a3('0x21')]);_0x13031c[_0x99a3('0x1f')]=qs['offset'](_0x379374[_0x99a3('0x35')][_0x99a3('0x1f')]);}_0x13031c['order']=qs[_0x99a3('0x3d')](_0x379374[_0x99a3('0x35')][_0x99a3('0x3d')]);_0x13031c[_0x99a3('0x3e')]=qs[_0x99a3('0x37')](_[_0x99a3('0x3f')](_0x379374[_0x99a3('0x35')],_0x89c746[_0x99a3('0x37')]),_0xc76ae5);if(_0x379374[_0x99a3('0x35')][_0x99a3('0x40')]){_0x13031c[_0x99a3('0x3e')]=_['merge'](_0x13031c[_0x99a3('0x3e')],{'$or':_[_0x99a3('0x2f')](_0xc76ae5,function(_0x6b8e60){if(_0x6b8e60[_0x99a3('0x41')]!==_0x99a3('0x42')){var _0x3b1d5c={};_0x3b1d5c[_0x6b8e60['name']]={'$like':'%'+_0x379374[_0x99a3('0x35')][_0x99a3('0x40')]+'%'};return _0x3b1d5c;}})});}_0x13031c=_[_0x99a3('0x43')]({},_0x13031c,_0x379374[_0x99a3('0x44')]);var _0x45a165={'where':_0x13031c[_0x99a3('0x3e')]};return db[_0x99a3('0x30')][_0x99a3('0x22')](_0x45a165)['then'](function(_0xc8d36d){_0x38360f['count']=_0xc8d36d;if(_0x379374[_0x99a3('0x35')][_0x99a3('0x45')]){_0x13031c[_0x99a3('0x46')]=[{'all':!![]}];}return db[_0x99a3('0x30')][_0x99a3('0x47')](_0x13031c);})['then'](function(_0x58f3c9){_0x38360f['rows']=_0x58f3c9;return _0x38360f;})[_0x99a3('0x28')](respondWithFilteredResult(_0x46fb04,_0x13031c))[_0x99a3('0x48')](handleError(_0x46fb04,null));};exports[_0x99a3('0x49')]=function(_0x59a904,_0x4e4a9f){var _0x8ae65a={'raw':!![],'where':{'id':_0x59a904[_0x99a3('0x4a')]['id']}},_0xb9e459={};_0xb9e459[_0x99a3('0x34')]=_[_0x99a3('0x36')](db[_0x99a3('0x30')][_0x99a3('0x31')]);_0xb9e459[_0x99a3('0x35')]=_[_0x99a3('0x36')](_0x59a904[_0x99a3('0x35')]);_0xb9e459[_0x99a3('0x37')]=_['intersection'](_0xb9e459['model'],_0xb9e459[_0x99a3('0x35')]);_0x8ae65a[_0x99a3('0x39')]=_['intersection'](_0xb9e459[_0x99a3('0x34')],qs['fields'](_0x59a904[_0x99a3('0x35')][_0x99a3('0x3a')]));_0x8ae65a[_0x99a3('0x39')]=_0x8ae65a['attributes'][_0x99a3('0x4b')]?_0x8ae65a[_0x99a3('0x39')]:_0xb9e459[_0x99a3('0x34')];if(_0x59a904['query'][_0x99a3('0x45')]){_0x8ae65a['include']=[{'all':!![]}];}_0x8ae65a=_['merge']({},_0x8ae65a,_0x59a904[_0x99a3('0x44')]);return db[_0x99a3('0x30')][_0x99a3('0x4c')](_0x8ae65a)[_0x99a3('0x28')](handleEntityNotFound(_0x4e4a9f,null))[_0x99a3('0x28')](respondWithResult(_0x4e4a9f,null))['catch'](handleError(_0x4e4a9f,null));};exports[_0x99a3('0x4d')]=function(_0x35917c,_0x5abce5){return db[_0x99a3('0x30')][_0x99a3('0x4d')](_0x35917c['body'],{})[_0x99a3('0x28')](respondWithResult(_0x5abce5,0xc9))[_0x99a3('0x48')](handleError(_0x5abce5,null));};exports['update']=function(_0x283d14,_0x3fb05f){if(_0x283d14[_0x99a3('0x4e')]['id']){delete _0x283d14[_0x99a3('0x4e')]['id'];}return db[_0x99a3('0x30')][_0x99a3('0x4c')]({'where':{'id':_0x283d14[_0x99a3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3fb05f,null))[_0x99a3('0x28')](saveUpdates(_0x283d14['body'],null))[_0x99a3('0x28')](respondWithResult(_0x3fb05f,null))[_0x99a3('0x48')](handleError(_0x3fb05f,null));};exports[_0x99a3('0x29')]=function(_0x302ea4,_0x2b47e4){return db[_0x99a3('0x30')][_0x99a3('0x4c')]({'where':{'id':_0x302ea4[_0x99a3('0x4a')]['id']}})[_0x99a3('0x28')](handleEntityNotFound(_0x2b47e4,null))[_0x99a3('0x28')](removeEntity(_0x2b47e4,null))[_0x99a3('0x48')](handleError(_0x2b47e4,null));};exports[_0x99a3('0x4f')]=function(_0x51dbd7,_0x25977c){return db[_0x99a3('0x30')][_0x99a3('0x4f')]()[_0x99a3('0x28')](respondWithResult(_0x25977c,null))['catch'](handleError(_0x25977c,null));};exports[_0x99a3('0x50')]=function(_0xdd9999,_0x35d7ca,_0x2f81c0){return db[_0x99a3('0x51')][_0x99a3('0x22')]({'where':{'ChatGroupId':_0xdd9999[_0x99a3('0x4a')]['id'],'ToId':_0xdd9999[_0x99a3('0x52')]['id'],'read':![]}})[_0x99a3('0x28')](function(_0x5218fc){return{'id':_['toInteger'](_0xdd9999[_0x99a3('0x4a')]['id']),'count':_0x5218fc};})['then'](respondWithResult(_0x35d7ca,null))[_0x99a3('0x48')](handleError(_0x35d7ca,null));};exports[_0x99a3('0x53')]=function(_0x3a42d0,_0x40c52b,_0x263d7e){return db[_0x99a3('0x30')][_0x99a3('0x4c')]({'where':{'id':_0x3a42d0[_0x99a3('0x4a')]['id']}})[_0x99a3('0x28')](handleEntityNotFound(_0x40c52b,null))[_0x99a3('0x28')](function(_0x29ca4c){if(_0x29ca4c){return _0x29ca4c[_0x99a3('0x53')](_0x3a42d0[_0x99a3('0x4e')]['ids'],_[_0x99a3('0x54')](_0x3a42d0[_0x99a3('0x4e')],[_0x99a3('0x55'),'id'])||{});}})['then'](respondWithResult(_0x40c52b,null))['catch'](handleError(_0x40c52b,null));};exports[_0x99a3('0x56')]=function(_0x5a3397,_0x28aec6,_0x2083d9){var _0x146f43={};var _0x5e153c={};var _0x2f6cad;var _0x3bc653;return db[_0x99a3('0x30')]['findOne']({'where':{'id':_0x5a3397[_0x99a3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x28aec6,null))['then'](function(_0x38bcc9){if(_0x38bcc9){_0x2f6cad=_0x38bcc9;_0x5e153c[_0x99a3('0x34')]=_[_0x99a3('0x36')](db[_0x99a3('0x57')][_0x99a3('0x31')]);_0x5e153c[_0x99a3('0x35')]=_[_0x99a3('0x36')](_0x5a3397[_0x99a3('0x35')]);_0x5e153c['filters']=_[_0x99a3('0x38')](_0x5e153c[_0x99a3('0x34')],_0x5e153c[_0x99a3('0x35')]);_0x146f43[_0x99a3('0x39')]=_['intersection'](_0x5e153c['model'],qs[_0x99a3('0x3a')](_0x5a3397[_0x99a3('0x35')][_0x99a3('0x3a')]));_0x146f43['attributes']=_0x146f43[_0x99a3('0x39')][_0x99a3('0x4b')]?_0x146f43[_0x99a3('0x39')]:_0x5e153c[_0x99a3('0x34')];_0x146f43[_0x99a3('0x58')]=qs[_0x99a3('0x3d')](_0x5a3397[_0x99a3('0x35')][_0x99a3('0x3d')]);_0x146f43[_0x99a3('0x3e')]=qs['filters'](_[_0x99a3('0x3f')](_0x5a3397[_0x99a3('0x35')],_0x5e153c[_0x99a3('0x37')]));if(_0x5a3397['query'][_0x99a3('0x40')]){_0x146f43[_0x99a3('0x3e')]=_['merge'](_0x146f43['where'],{'$or':_[_0x99a3('0x2f')](_0x146f43[_0x99a3('0x39')],function(_0x83e631){var _0xaf58e2={};_0xaf58e2[_0x83e631]={'$like':'%'+_0x5a3397[_0x99a3('0x35')]['filter']+'%'};return _0xaf58e2;})});}_0x146f43=_[_0x99a3('0x43')]({},_0x146f43,_0x5a3397['options']);return _0x2f6cad[_0x99a3('0x56')](_0x146f43);}})['then'](function(_0x2a5960){if(_0x2a5960){_0x3bc653=_0x2a5960[_0x99a3('0x4b')];if(!_0x5a3397['query']['hasOwnProperty']('nolimit')){_0x146f43[_0x99a3('0x21')]=qs[_0x99a3('0x21')](_0x5a3397[_0x99a3('0x35')][_0x99a3('0x21')]);_0x146f43[_0x99a3('0x1f')]=qs[_0x99a3('0x1f')](_0x5a3397[_0x99a3('0x35')]['offset']);}return _0x2f6cad[_0x99a3('0x56')](_0x146f43);}})['then'](function(_0xc4e50c){if(_0xc4e50c){return _0xc4e50c?{'count':_0x3bc653,'rows':_0xc4e50c}:null;}})[_0x99a3('0x28')](respondWithResult(_0x28aec6,null))[_0x99a3('0x48')](handleError(_0x28aec6,null));};exports[_0x99a3('0x59')]=function(_0x58423c,_0x4c8c6e,_0x108dbf){return db['ChatGroup'][_0x99a3('0x4c')]({'where':{'id':_0x58423c['params']['id']}})['then'](handleEntityNotFound(_0x4c8c6e,null))[_0x99a3('0x28')](function(_0x264a23){if(_0x264a23){return _0x264a23[_0x99a3('0x59')](_0x58423c[_0x99a3('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x4c8c6e,null))[_0x99a3('0x48')](handleError(_0x4c8c6e,null));};exports[_0x99a3('0x5a')]=function(_0x112433,_0x1993e5,_0x1bc67b){if(_0x112433[_0x99a3('0x4e')]['id']){delete _0x112433[_0x99a3('0x4e')]['id'];}return db[_0x99a3('0x30')]['find']({'where':{'id':_0x112433[_0x99a3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1993e5,null))['then'](function(_0x575218){if(_0x575218){_0x112433['body'][_0x99a3('0x5b')]=_0x575218['id'];return db[_0x99a3('0x51')][_0x99a3('0x4d')](_0x112433[_0x99a3('0x4e')]);}})['then'](respondWithResult(_0x1993e5,null))[_0x99a3('0x48')](handleError(_0x1993e5,null));};exports[_0x99a3('0x5c')]=function(_0x79560b,_0x25a320,_0x41eb95){var _0x1ce4b0={};var _0x2c9fd3={};var _0x4a94fe;var _0x4797d3;return db['ChatGroup'][_0x99a3('0x5d')]({'where':{'id':_0x79560b[_0x99a3('0x4a')]['id']}})[_0x99a3('0x28')](handleEntityNotFound(_0x25a320,null))[_0x99a3('0x28')](function(_0x176901){if(_0x176901){_0x4a94fe=_0x176901;_0x2c9fd3[_0x99a3('0x34')]=_[_0x99a3('0x36')](db[_0x99a3('0x51')][_0x99a3('0x31')]);_0x2c9fd3[_0x99a3('0x35')]=_[_0x99a3('0x36')](_0x79560b['query']);_0x2c9fd3['filters']=_[_0x99a3('0x38')](_0x2c9fd3[_0x99a3('0x34')],_0x2c9fd3[_0x99a3('0x35')]);_0x1ce4b0[_0x99a3('0x39')]=_[_0x99a3('0x38')](_0x2c9fd3['model'],qs[_0x99a3('0x3a')](_0x79560b['query'][_0x99a3('0x3a')]));_0x1ce4b0[_0x99a3('0x39')]=_0x1ce4b0[_0x99a3('0x39')]['length']?_0x1ce4b0['attributes']:_0x2c9fd3['model'];_0x1ce4b0['order']=qs['sort'](_0x79560b[_0x99a3('0x35')][_0x99a3('0x3d')]);_0x1ce4b0['where']=qs[_0x99a3('0x37')](_['pick'](_0x79560b[_0x99a3('0x35')],_0x2c9fd3[_0x99a3('0x37')]));if(_0x79560b[_0x99a3('0x35')]['filter']){_0x1ce4b0[_0x99a3('0x3e')]=_[_0x99a3('0x43')](_0x1ce4b0[_0x99a3('0x3e')],{'$or':_[_0x99a3('0x2f')](_0x1ce4b0['attributes'],function(_0x4fc72b){var _0x1f25b8={};_0x1f25b8[_0x4fc72b]={'$like':'%'+_0x79560b[_0x99a3('0x35')][_0x99a3('0x40')]+'%'};return _0x1f25b8;})});}if(_0x79560b[_0x99a3('0x35')][_0x99a3('0x5e')]){var _0x1002c2=_0x79560b[_0x99a3('0x35')]['$gte'][_0x99a3('0x5f')](',');var _0x5adf18={};_0x5adf18[_0x1002c2[0x0]]={'$gte':moment(_0x1002c2[0x1])[_0x99a3('0x60')](_0x99a3('0x61'))};_0x1ce4b0['where']=_['merge'](_0x1ce4b0[_0x99a3('0x3e')],_0x5adf18);}_0x1ce4b0=_['merge']({},_0x1ce4b0,_0x79560b[_0x99a3('0x44')]);return _0x4a94fe['getMessages'](_0x1ce4b0);}})[_0x99a3('0x28')](function(_0x2a996f){if(_0x2a996f){_0x4797d3=_0x2a996f[_0x99a3('0x4b')];if(!_0x79560b[_0x99a3('0x35')][_0x99a3('0x3b')](_0x99a3('0x3c'))){_0x1ce4b0[_0x99a3('0x21')]=qs['limit'](_0x79560b['query']['limit']);_0x1ce4b0[_0x99a3('0x1f')]=qs[_0x99a3('0x1f')](_0x79560b[_0x99a3('0x35')][_0x99a3('0x1f')]);}return _0x4a94fe[_0x99a3('0x5c')](_0x1ce4b0);}})[_0x99a3('0x28')](function(_0x5a0114){if(_0x5a0114){return _0x5a0114?{'count':_0x4797d3,'rows':_0x5a0114}:null;}})[_0x99a3('0x28')](respondWithResult(_0x25a320,null))[_0x99a3('0x48')](handleError(_0x25a320,null));}; \ No newline at end of file +var _0xa7e2=['user','toInteger','addMembers','ids','omit','getMembers','findOne','User','sort','hasOwnProperty','removeMembers','addMessage','ChatGroupId','create','getMessages','pick','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','find','body','update','destroy','params','describe','getUnread','ChatInternalMessage'];(function(_0x3eb450,_0x592b0a){var _0x2c4cfd=function(_0x34f5dc){while(--_0x34f5dc){_0x3eb450['push'](_0x3eb450['shift']());}};_0x2c4cfd(++_0x592b0a);}(_0xa7e2,0xd9));var _0x2a7e=function(_0x41e9c1,_0x217012){_0x41e9c1=_0x41e9c1-0x0;var _0x452dbb=_0xa7e2[_0x41e9c1];return _0x452dbb;};'use strict';var emlformat=require(_0x2a7e('0x0'));var rimraf=require(_0x2a7e('0x1'));var zipdir=require(_0x2a7e('0x2'));var jsonpatch=require(_0x2a7e('0x3'));var rp=require('request-promise');var moment=require(_0x2a7e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2a7e('0x5'));var util=require(_0x2a7e('0x6'));var path=require(_0x2a7e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2a7e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2a7e('0x9'));var jsforce=require(_0x2a7e('0xa'));var deskjs=require(_0x2a7e('0xb'));var toCsv=require(_0x2a7e('0xc'));var querystring=require(_0x2a7e('0xd'));var Papa=require(_0x2a7e('0xe'));var Redis=require(_0x2a7e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2a7e('0x10'));var hardwareService=require(_0x2a7e('0x11'));var logger=require(_0x2a7e('0x12'))(_0x2a7e('0x13'));var utils=require('../../config/utils');var config=require(_0x2a7e('0x14'));var licenseUtil=require(_0x2a7e('0x15'));var db=require(_0x2a7e('0x16'))['db'];config['redis']=_[_0x2a7e('0x17')](config[_0x2a7e('0x18')],{'host':_0x2a7e('0x19'),'port':0x18eb});var socket=require(_0x2a7e('0x1a'))(new Redis(config[_0x2a7e('0x18')]));require(_0x2a7e('0x1b'))[_0x2a7e('0x1c')](socket);function respondWithStatusCode(_0x4fe01e,_0x11d9c3){_0x11d9c3=_0x11d9c3||0xcc;return function(_0x513f1f){if(_0x513f1f){return _0x4fe01e[_0x2a7e('0x1d')](_0x11d9c3);}return _0x4fe01e[_0x2a7e('0x1e')](_0x11d9c3)['end']();};}function respondWithResult(_0xa3f16d,_0x2037f5){_0x2037f5=_0x2037f5||0xc8;return function(_0x22da37){if(_0x22da37){return _0xa3f16d[_0x2a7e('0x1e')](_0x2037f5)[_0x2a7e('0x1f')](_0x22da37);}};}function respondWithFilteredResult(_0x4ef669,_0x4c4082){return function(_0xbc4213){if(_0xbc4213){var _0xce6aa3=typeof _0x4c4082[_0x2a7e('0x20')]===_0x2a7e('0x21')&&typeof _0x4c4082[_0x2a7e('0x22')]==='undefined';var _0xb466a9=_0xbc4213[_0x2a7e('0x23')];var _0x387faf=_0xce6aa3?0x0:_0x4c4082[_0x2a7e('0x20')];var _0x19707b=_0xce6aa3?_0xbc4213['count']:_0x4c4082[_0x2a7e('0x20')]+_0x4c4082[_0x2a7e('0x22')];var _0x418606;if(_0x19707b>=_0xb466a9){_0x19707b=_0xb466a9;_0x418606=0xc8;}else{_0x418606=0xce;}_0x4ef669[_0x2a7e('0x1e')](_0x418606);return _0x4ef669[_0x2a7e('0x24')](_0x2a7e('0x25'),_0x387faf+'-'+_0x19707b+'/'+_0xb466a9)[_0x2a7e('0x1f')](_0xbc4213);}return null;};}function patchUpdates(_0x5a52be){return function(_0x14a347){try{jsonpatch[_0x2a7e('0x26')](_0x14a347,_0x5a52be,!![]);}catch(_0xe64802){return BPromise[_0x2a7e('0x27')](_0xe64802);}return _0x14a347['save']();};}function saveUpdates(_0x582806,_0x50ab8f){return function(_0x4c7774){if(_0x4c7774){return _0x4c7774['update'](_0x582806)[_0x2a7e('0x28')](function(_0x5d6bb2){return _0x5d6bb2;});}return null;};}function removeEntity(_0xce770e,_0x5588dd){return function(_0x187e64){if(_0x187e64){return _0x187e64['destroy']()[_0x2a7e('0x28')](function(){_0xce770e[_0x2a7e('0x1e')](0xcc)[_0x2a7e('0x29')]();});}};}function handleEntityNotFound(_0x236a71,_0x154d66){return function(_0x1c1640){if(!_0x1c1640){_0x236a71[_0x2a7e('0x1d')](0x194);}return _0x1c1640;};}function handleError(_0xc397e5,_0x57c1ea){_0x57c1ea=_0x57c1ea||0x1f4;return function(_0xabaf69){logger[_0x2a7e('0x2a')](_0xabaf69[_0x2a7e('0x2b')]);if(_0xabaf69[_0x2a7e('0x2c')]){delete _0xabaf69[_0x2a7e('0x2c')];}_0xc397e5[_0x2a7e('0x1e')](_0x57c1ea)[_0x2a7e('0x2d')](_0xabaf69);};}exports[_0x2a7e('0x2e')]=function(_0x4c6a72,_0x2a7d00){var _0x3b8e7e={},_0x2f7476={},_0x1954e7={'count':0x0,'rows':[]};var _0x58c35a=_[_0x2a7e('0x2f')](db[_0x2a7e('0x30')][_0x2a7e('0x31')],function(_0x291755){return{'name':_0x291755[_0x2a7e('0x32')],'type':_0x291755[_0x2a7e('0x33')]['key']};});_0x2f7476[_0x2a7e('0x34')]=_[_0x2a7e('0x2f')](_0x58c35a,_0x2a7e('0x2c'));_0x2f7476[_0x2a7e('0x35')]=_[_0x2a7e('0x36')](_0x4c6a72['query']);_0x2f7476['filters']=_['intersection'](_0x2f7476['model'],_0x2f7476['query']);_0x3b8e7e['attributes']=_[_0x2a7e('0x37')](_0x2f7476[_0x2a7e('0x34')],qs[_0x2a7e('0x38')](_0x4c6a72[_0x2a7e('0x35')][_0x2a7e('0x38')]));_0x3b8e7e['attributes']=_0x3b8e7e[_0x2a7e('0x39')][_0x2a7e('0x3a')]?_0x3b8e7e[_0x2a7e('0x39')]:_0x2f7476[_0x2a7e('0x34')];if(!_0x4c6a72['query']['hasOwnProperty'](_0x2a7e('0x3b'))){_0x3b8e7e[_0x2a7e('0x22')]=qs[_0x2a7e('0x22')](_0x4c6a72['query'][_0x2a7e('0x22')]);_0x3b8e7e[_0x2a7e('0x20')]=qs[_0x2a7e('0x20')](_0x4c6a72[_0x2a7e('0x35')][_0x2a7e('0x20')]);}_0x3b8e7e[_0x2a7e('0x3c')]=qs['sort'](_0x4c6a72['query']['sort']);_0x3b8e7e[_0x2a7e('0x3d')]=qs[_0x2a7e('0x3e')](_['pick'](_0x4c6a72[_0x2a7e('0x35')],_0x2f7476['filters']),_0x58c35a);if(_0x4c6a72[_0x2a7e('0x35')]['filter']){_0x3b8e7e[_0x2a7e('0x3d')]=_[_0x2a7e('0x3f')](_0x3b8e7e[_0x2a7e('0x3d')],{'$or':_[_0x2a7e('0x2f')](_0x58c35a,function(_0x1b9150){if(_0x1b9150[_0x2a7e('0x33')]!==_0x2a7e('0x40')){var _0x1a59c2={};_0x1a59c2[_0x1b9150['name']]={'$like':'%'+_0x4c6a72[_0x2a7e('0x35')][_0x2a7e('0x41')]+'%'};return _0x1a59c2;}})});}_0x3b8e7e=_['merge']({},_0x3b8e7e,_0x4c6a72[_0x2a7e('0x42')]);var _0x402a12={'where':_0x3b8e7e[_0x2a7e('0x3d')]};return db[_0x2a7e('0x30')]['count'](_0x402a12)[_0x2a7e('0x28')](function(_0x5cb37d){_0x1954e7['count']=_0x5cb37d;if(_0x4c6a72[_0x2a7e('0x35')][_0x2a7e('0x43')]){_0x3b8e7e[_0x2a7e('0x44')]=[{'all':!![]}];}return db[_0x2a7e('0x30')][_0x2a7e('0x45')](_0x3b8e7e);})[_0x2a7e('0x28')](function(_0x1a9361){_0x1954e7[_0x2a7e('0x46')]=_0x1a9361;return _0x1954e7;})[_0x2a7e('0x28')](respondWithFilteredResult(_0x2a7d00,_0x3b8e7e))[_0x2a7e('0x47')](handleError(_0x2a7d00,null));};exports['show']=function(_0x41a2bd,_0x1e0eb3){var _0x4e48f4={'raw':!![],'where':{'id':_0x41a2bd['params']['id']}},_0x477515={};_0x477515[_0x2a7e('0x34')]=_['keys'](db[_0x2a7e('0x30')]['rawAttributes']);_0x477515[_0x2a7e('0x35')]=_[_0x2a7e('0x36')](_0x41a2bd[_0x2a7e('0x35')]);_0x477515[_0x2a7e('0x3e')]=_['intersection'](_0x477515[_0x2a7e('0x34')],_0x477515[_0x2a7e('0x35')]);_0x4e48f4[_0x2a7e('0x39')]=_['intersection'](_0x477515['model'],qs[_0x2a7e('0x38')](_0x41a2bd[_0x2a7e('0x35')][_0x2a7e('0x38')]));_0x4e48f4['attributes']=_0x4e48f4[_0x2a7e('0x39')][_0x2a7e('0x3a')]?_0x4e48f4[_0x2a7e('0x39')]:_0x477515['model'];if(_0x41a2bd[_0x2a7e('0x35')][_0x2a7e('0x43')]){_0x4e48f4[_0x2a7e('0x44')]=[{'all':!![]}];}_0x4e48f4=_[_0x2a7e('0x3f')]({},_0x4e48f4,_0x41a2bd[_0x2a7e('0x42')]);return db[_0x2a7e('0x30')][_0x2a7e('0x48')](_0x4e48f4)[_0x2a7e('0x28')](handleEntityNotFound(_0x1e0eb3,null))[_0x2a7e('0x28')](respondWithResult(_0x1e0eb3,null))[_0x2a7e('0x47')](handleError(_0x1e0eb3,null));};exports['create']=function(_0xf12bed,_0x3a773f){return db[_0x2a7e('0x30')]['create'](_0xf12bed[_0x2a7e('0x49')],{})[_0x2a7e('0x28')](respondWithResult(_0x3a773f,0xc9))['catch'](handleError(_0x3a773f,null));};exports[_0x2a7e('0x4a')]=function(_0x35bc75,_0x2d6734){if(_0x35bc75[_0x2a7e('0x49')]['id']){delete _0x35bc75['body']['id'];}return db[_0x2a7e('0x30')][_0x2a7e('0x48')]({'where':{'id':_0x35bc75['params']['id']}})[_0x2a7e('0x28')](handleEntityNotFound(_0x2d6734,null))[_0x2a7e('0x28')](saveUpdates(_0x35bc75[_0x2a7e('0x49')],null))[_0x2a7e('0x28')](respondWithResult(_0x2d6734,null))[_0x2a7e('0x47')](handleError(_0x2d6734,null));};exports[_0x2a7e('0x4b')]=function(_0x5176d9,_0x3f583a){return db['ChatGroup'][_0x2a7e('0x48')]({'where':{'id':_0x5176d9[_0x2a7e('0x4c')]['id']}})[_0x2a7e('0x28')](handleEntityNotFound(_0x3f583a,null))[_0x2a7e('0x28')](removeEntity(_0x3f583a,null))[_0x2a7e('0x47')](handleError(_0x3f583a,null));};exports[_0x2a7e('0x4d')]=function(_0x1bd620,_0x372e80){return db[_0x2a7e('0x30')]['describe']()['then'](respondWithResult(_0x372e80,null))[_0x2a7e('0x47')](handleError(_0x372e80,null));};exports[_0x2a7e('0x4e')]=function(_0xe667e5,_0x275747,_0x1dc9dc){return db[_0x2a7e('0x4f')][_0x2a7e('0x23')]({'where':{'ChatGroupId':_0xe667e5[_0x2a7e('0x4c')]['id'],'ToId':_0xe667e5[_0x2a7e('0x50')]['id'],'read':![]}})[_0x2a7e('0x28')](function(_0xf41845){return{'id':_[_0x2a7e('0x51')](_0xe667e5[_0x2a7e('0x4c')]['id']),'count':_0xf41845};})['then'](respondWithResult(_0x275747,null))[_0x2a7e('0x47')](handleError(_0x275747,null));};exports[_0x2a7e('0x52')]=function(_0x9085ae,_0x4a8bf9,_0x3c417a){return db[_0x2a7e('0x30')][_0x2a7e('0x48')]({'where':{'id':_0x9085ae[_0x2a7e('0x4c')]['id']}})[_0x2a7e('0x28')](handleEntityNotFound(_0x4a8bf9,null))[_0x2a7e('0x28')](function(_0x265791){if(_0x265791){return _0x265791[_0x2a7e('0x52')](_0x9085ae['body'][_0x2a7e('0x53')],_[_0x2a7e('0x54')](_0x9085ae[_0x2a7e('0x49')],[_0x2a7e('0x53'),'id'])||{});}})[_0x2a7e('0x28')](respondWithResult(_0x4a8bf9,null))[_0x2a7e('0x47')](handleError(_0x4a8bf9,null));};exports[_0x2a7e('0x55')]=function(_0x2d689e,_0x1a46ae,_0x3349b1){var _0x2c4b6f={};var _0x592e09={};var _0x525676;var _0xb295c6;return db[_0x2a7e('0x30')][_0x2a7e('0x56')]({'where':{'id':_0x2d689e[_0x2a7e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a46ae,null))['then'](function(_0x1ec86f){if(_0x1ec86f){_0x525676=_0x1ec86f;_0x592e09[_0x2a7e('0x34')]=_[_0x2a7e('0x36')](db[_0x2a7e('0x57')][_0x2a7e('0x31')]);_0x592e09[_0x2a7e('0x35')]=_[_0x2a7e('0x36')](_0x2d689e['query']);_0x592e09[_0x2a7e('0x3e')]=_[_0x2a7e('0x37')](_0x592e09[_0x2a7e('0x34')],_0x592e09[_0x2a7e('0x35')]);_0x2c4b6f[_0x2a7e('0x39')]=_[_0x2a7e('0x37')](_0x592e09[_0x2a7e('0x34')],qs[_0x2a7e('0x38')](_0x2d689e[_0x2a7e('0x35')][_0x2a7e('0x38')]));_0x2c4b6f[_0x2a7e('0x39')]=_0x2c4b6f[_0x2a7e('0x39')][_0x2a7e('0x3a')]?_0x2c4b6f[_0x2a7e('0x39')]:_0x592e09['model'];_0x2c4b6f[_0x2a7e('0x3c')]=qs['sort'](_0x2d689e['query'][_0x2a7e('0x58')]);_0x2c4b6f['where']=qs[_0x2a7e('0x3e')](_['pick'](_0x2d689e[_0x2a7e('0x35')],_0x592e09[_0x2a7e('0x3e')]));if(_0x2d689e['query'][_0x2a7e('0x41')]){_0x2c4b6f[_0x2a7e('0x3d')]=_[_0x2a7e('0x3f')](_0x2c4b6f[_0x2a7e('0x3d')],{'$or':_[_0x2a7e('0x2f')](_0x2c4b6f[_0x2a7e('0x39')],function(_0x4008c3){var _0x5d573d={};_0x5d573d[_0x4008c3]={'$like':'%'+_0x2d689e[_0x2a7e('0x35')][_0x2a7e('0x41')]+'%'};return _0x5d573d;})});}_0x2c4b6f=_[_0x2a7e('0x3f')]({},_0x2c4b6f,_0x2d689e[_0x2a7e('0x42')]);return _0x525676['getMembers'](_0x2c4b6f);}})[_0x2a7e('0x28')](function(_0x242501){if(_0x242501){_0xb295c6=_0x242501[_0x2a7e('0x3a')];if(!_0x2d689e[_0x2a7e('0x35')][_0x2a7e('0x59')](_0x2a7e('0x3b'))){_0x2c4b6f[_0x2a7e('0x22')]=qs['limit'](_0x2d689e[_0x2a7e('0x35')][_0x2a7e('0x22')]);_0x2c4b6f[_0x2a7e('0x20')]=qs[_0x2a7e('0x20')](_0x2d689e[_0x2a7e('0x35')][_0x2a7e('0x20')]);}return _0x525676[_0x2a7e('0x55')](_0x2c4b6f);}})[_0x2a7e('0x28')](function(_0x15092a){if(_0x15092a){return _0x15092a?{'count':_0xb295c6,'rows':_0x15092a}:null;}})[_0x2a7e('0x28')](respondWithResult(_0x1a46ae,null))[_0x2a7e('0x47')](handleError(_0x1a46ae,null));};exports['removeMembers']=function(_0x56a5e4,_0x39984e,_0x344d95){return db[_0x2a7e('0x30')]['find']({'where':{'id':_0x56a5e4['params']['id']}})[_0x2a7e('0x28')](handleEntityNotFound(_0x39984e,null))[_0x2a7e('0x28')](function(_0x311b94){if(_0x311b94){return _0x311b94[_0x2a7e('0x5a')](_0x56a5e4[_0x2a7e('0x35')][_0x2a7e('0x53')]);}})[_0x2a7e('0x28')](respondWithStatusCode(_0x39984e,null))['catch'](handleError(_0x39984e,null));};exports[_0x2a7e('0x5b')]=function(_0x5f0ce0,_0x4e7c53,_0x45e3e1){if(_0x5f0ce0[_0x2a7e('0x49')]['id']){delete _0x5f0ce0[_0x2a7e('0x49')]['id'];}return db[_0x2a7e('0x30')]['find']({'where':{'id':_0x5f0ce0[_0x2a7e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e7c53,null))[_0x2a7e('0x28')](function(_0x33142b){if(_0x33142b){_0x5f0ce0['body'][_0x2a7e('0x5c')]=_0x33142b['id'];return db[_0x2a7e('0x4f')][_0x2a7e('0x5d')](_0x5f0ce0[_0x2a7e('0x49')]);}})[_0x2a7e('0x28')](respondWithResult(_0x4e7c53,null))[_0x2a7e('0x47')](handleError(_0x4e7c53,null));};exports[_0x2a7e('0x5e')]=function(_0x212e78,_0x1298ce,_0xb08a7a){var _0x58aba4={};var _0x248f97={};var _0x4eea5f;var _0x1c11c6;return db[_0x2a7e('0x30')][_0x2a7e('0x56')]({'where':{'id':_0x212e78[_0x2a7e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1298ce,null))[_0x2a7e('0x28')](function(_0x5806dd){if(_0x5806dd){_0x4eea5f=_0x5806dd;_0x248f97[_0x2a7e('0x34')]=_[_0x2a7e('0x36')](db[_0x2a7e('0x4f')][_0x2a7e('0x31')]);_0x248f97[_0x2a7e('0x35')]=_['keys'](_0x212e78['query']);_0x248f97[_0x2a7e('0x3e')]=_[_0x2a7e('0x37')](_0x248f97['model'],_0x248f97[_0x2a7e('0x35')]);_0x58aba4[_0x2a7e('0x39')]=_[_0x2a7e('0x37')](_0x248f97[_0x2a7e('0x34')],qs[_0x2a7e('0x38')](_0x212e78[_0x2a7e('0x35')]['fields']));_0x58aba4[_0x2a7e('0x39')]=_0x58aba4['attributes'][_0x2a7e('0x3a')]?_0x58aba4[_0x2a7e('0x39')]:_0x248f97[_0x2a7e('0x34')];_0x58aba4[_0x2a7e('0x3c')]=qs[_0x2a7e('0x58')](_0x212e78[_0x2a7e('0x35')][_0x2a7e('0x58')]);_0x58aba4[_0x2a7e('0x3d')]=qs[_0x2a7e('0x3e')](_[_0x2a7e('0x5f')](_0x212e78[_0x2a7e('0x35')],_0x248f97[_0x2a7e('0x3e')]));if(_0x212e78[_0x2a7e('0x35')][_0x2a7e('0x41')]){_0x58aba4[_0x2a7e('0x3d')]=_[_0x2a7e('0x3f')](_0x58aba4[_0x2a7e('0x3d')],{'$or':_['map'](_0x58aba4[_0x2a7e('0x39')],function(_0x5c57b3){var _0x1171bc={};_0x1171bc[_0x5c57b3]={'$like':'%'+_0x212e78['query'][_0x2a7e('0x41')]+'%'};return _0x1171bc;})});}if(_0x212e78[_0x2a7e('0x35')][_0x2a7e('0x60')]){var _0x4b8623=_0x212e78[_0x2a7e('0x35')][_0x2a7e('0x60')][_0x2a7e('0x61')](',');var _0xf0d597={};_0xf0d597[_0x4b8623[0x0]]={'$gte':moment(_0x4b8623[0x1])[_0x2a7e('0x62')]('YYYY-MM-DD\x20HH:mm:ss')};_0x58aba4[_0x2a7e('0x3d')]=_[_0x2a7e('0x3f')](_0x58aba4[_0x2a7e('0x3d')],_0xf0d597);}_0x58aba4=_[_0x2a7e('0x3f')]({},_0x58aba4,_0x212e78[_0x2a7e('0x42')]);return _0x4eea5f['getMessages'](_0x58aba4);}})[_0x2a7e('0x28')](function(_0x758262){if(_0x758262){_0x1c11c6=_0x758262[_0x2a7e('0x3a')];if(!_0x212e78[_0x2a7e('0x35')][_0x2a7e('0x59')](_0x2a7e('0x3b'))){_0x58aba4['limit']=qs['limit'](_0x212e78[_0x2a7e('0x35')]['limit']);_0x58aba4[_0x2a7e('0x20')]=qs[_0x2a7e('0x20')](_0x212e78[_0x2a7e('0x35')][_0x2a7e('0x20')]);}return _0x4eea5f[_0x2a7e('0x5e')](_0x58aba4);}})[_0x2a7e('0x28')](function(_0x15062a){if(_0x15062a){return _0x15062a?{'count':_0x1c11c6,'rows':_0x15062a}:null;}})[_0x2a7e('0x28')](respondWithResult(_0x1298ce,null))[_0x2a7e('0x47')](handleError(_0x1298ce,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index d589a3e..ea3f1b1 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 _0x10dc=['events','../../mysqldb','ChatGroup','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x10dc,0x90));var _0xc10d=function(_0x50148e,_0x4c99c7){_0x50148e=_0x50148e-0x0;var _0x446e9d=_0x10dc[_0x50148e];return _0x446e9d;};'use strict';var EventEmitter=require(_0xc10d('0x0'));var ChatGroup=require(_0xc10d('0x1'))['db'][_0xc10d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc10d('0x3')](0x0);var events={'afterCreate':_0xc10d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x503cbe){return function(_0x3687e3,_0x140715,_0x45911d){ChatGroupEvents[_0xc10d('0x5')](_0x503cbe+':'+_0x3687e3['id'],_0x3687e3);ChatGroupEvents['emit'](_0x503cbe,_0x3687e3);_0x45911d(null);};}for(var e in events){if(events[_0xc10d('0x6')](e)){var event=events[e];ChatGroup[_0xc10d('0x7')](e,emitEvent(event));}}module[_0xc10d('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xcdc2=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x2f8e66,_0x50a5b6){var _0x53cbf3=function(_0x4b9bbe){while(--_0x4b9bbe){_0x2f8e66['push'](_0x2f8e66['shift']());}};_0x53cbf3(++_0x50a5b6);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x21d5d7,_0x37b451){_0x21d5d7=_0x21d5d7-0x0;var _0x5218bc=_0xcdc2[_0x21d5d7];return _0x5218bc;};'use strict';var EventEmitter=require(_0x2cdc('0x0'));var ChatGroup=require(_0x2cdc('0x1'))['db'][_0x2cdc('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2cdc('0x3')](0x0);var events={'afterCreate':_0x2cdc('0x4'),'afterUpdate':_0x2cdc('0x5'),'afterDestroy':_0x2cdc('0x6')};function emitEvent(_0x159282){return function(_0x446b59,_0x174889,_0x3b8b54){ChatGroupEvents[_0x2cdc('0x7')](_0x159282+':'+_0x446b59['id'],_0x446b59);ChatGroupEvents['emit'](_0x159282,_0x446b59);_0x3b8b54(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x2cdc('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 a18e79e..3e64b73 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 _0x71fb=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x71fb,0x91));var _0xb71f=function(_0x6f8b40,_0xaed0f3){_0x6f8b40=_0x6f8b40-0x0;var _0x17f4d5=_0x71fb[_0x6f8b40];return _0x17f4d5;};'use strict';var _=require(_0xb71f('0x0'));var util=require(_0xb71f('0x1'));var logger=require(_0xb71f('0x2'))(_0xb71f('0x3'));var moment=require(_0xb71f('0x4'));var BPromise=require(_0xb71f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb71f('0x6'));var rimraf=require(_0xb71f('0x7'));var config=require(_0xb71f('0x8'));var attributes=require(_0xb71f('0x9'));module[_0xb71f('0xa')]=function(_0xb00c9d,_0x2d92ac){return _0xb00c9d[_0xb71f('0xb')](_0xb71f('0xc'),attributes,{'tableName':_0xb71f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fef=['../../config/environment','exports','define','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4fa021,_0x35037b){var _0x452887=function(_0x3903d5){while(--_0x3903d5){_0x4fa021['push'](_0x4fa021['shift']());}};_0x452887(++_0x35037b);}(_0x0fef,0x64));var _0xf0fe=function(_0x2ade68,_0x3c6b4f){_0x2ade68=_0x2ade68-0x0;var _0xd360b8=_0x0fef[_0x2ade68];return _0xd360b8;};'use strict';var _=require(_0xf0fe('0x0'));var util=require(_0xf0fe('0x1'));var logger=require(_0xf0fe('0x2'))(_0xf0fe('0x3'));var moment=require(_0xf0fe('0x4'));var BPromise=require(_0xf0fe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0fe('0x6'));var rimraf=require(_0xf0fe('0x7'));var config=require(_0xf0fe('0x8'));var attributes=require('./chatGroup.attributes');module[_0xf0fe('0x9')]=function(_0x4ed4cd,_0x1cd7c4){return _0x4ed4cd[_0xf0fe('0xa')]('ChatGroup',attributes,{'tableName':_0xf0fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index f2aa51c..c1c825f 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 _0xdbbe=['client','http','redis','localhost','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x531b1e,_0x301978){var _0x1208b6=function(_0x3af74a){while(--_0x3af74a){_0x531b1e['push'](_0x531b1e['shift']());}};_0x1208b6(++_0x301978);}(_0xdbbe,0x148));var _0xedbb=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xdbbe[_0x1f71d8];return _0x10b045;};'use strict';var _=require('lodash');var util=require(_0xedbb('0x0'));var moment=require(_0xedbb('0x1'));var BPromise=require(_0xedbb('0x2'));var rs=require(_0xedbb('0x3'));var fs=require('fs');var Redis=require(_0xedbb('0x4'));var db=require(_0xedbb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xedbb('0x6'))(_0xedbb('0x7'));var config=require(_0xedbb('0x8'));var jayson=require(_0xedbb('0x9'));var client=jayson[_0xedbb('0xa')][_0xedbb('0xb')]({'port':0x232a});config[_0xedbb('0xc')]=_['defaults'](config[_0xedbb('0xc')],{'host':_0xedbb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedbb('0xc')]));require('./chatGroup.socket')[_0xedbb('0xe')](socket);function respondWithRpcPromise(_0xcf5769,_0x3404ed,_0x4ea98b){return new BPromise(function(_0x7744b1,_0x52e248){return client[_0xedbb('0xf')](_0xcf5769,_0x4ea98b)[_0xedbb('0x10')](function(_0x37c5cb){logger[_0xedbb('0x11')]('ChatGroup,\x20%s,\x20%s',_0x3404ed,_0xedbb('0x12'));logger[_0xedbb('0x13')](_0xedbb('0x14'),_0x3404ed,_0xedbb('0x12'),JSON[_0xedbb('0x15')](_0x37c5cb));if(_0x37c5cb[_0xedbb('0x16')]){if(_0x37c5cb['error'][_0xedbb('0x17')]===0x1f4){logger[_0xedbb('0x16')](_0xedbb('0x18'),_0x3404ed,_0x37c5cb[_0xedbb('0x16')][_0xedbb('0x19')]);return _0x52e248(_0x37c5cb[_0xedbb('0x16')]['message']);}logger['error'](_0xedbb('0x18'),_0x3404ed,_0x37c5cb[_0xedbb('0x16')]['message']);return _0x7744b1(_0x37c5cb[_0xedbb('0x16')][_0xedbb('0x19')]);}else{logger[_0xedbb('0x11')]('ChatGroup,\x20%s,\x20%s',_0x3404ed,_0xedbb('0x12'));_0x7744b1(_0x37c5cb['result']['message']);}})['catch'](function(_0x54ec3f){logger[_0xedbb('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3404ed,_0x54ec3f);_0x52e248(_0x54ec3f);});});} \ No newline at end of file +var _0xc57c=['../../config/environment','client','http','defaults','redis','localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc57c,0x9f));var _0xcc57=function(_0x2933ca,_0x56a372){_0x2933ca=_0x2933ca-0x0;var _0x53f0bc=_0xc57c[_0x2933ca];return _0x53f0bc;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var moment=require(_0xcc57('0x1'));var BPromise=require(_0xcc57('0x2'));var rs=require(_0xcc57('0x3'));var fs=require('fs');var Redis=require(_0xcc57('0x4'));var db=require(_0xcc57('0x5'))['db'];var utils=require(_0xcc57('0x6'));var logger=require(_0xcc57('0x7'))(_0xcc57('0x8'));var config=require(_0xcc57('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcc57('0xa')][_0xcc57('0xb')]({'port':0x232a});config['redis']=_[_0xcc57('0xc')](config[_0xcc57('0xd')],{'host':_0xcc57('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc57('0xd')]));require(_0xcc57('0xf'))[_0xcc57('0x10')](socket);function respondWithRpcPromise(_0x3e6fcf,_0x16f4c0,_0xfe023b){return new BPromise(function(_0x1bbfdc,_0x5c6e53){return client[_0xcc57('0x11')](_0x3e6fcf,_0xfe023b)[_0xcc57('0x12')](function(_0x1a3e10){logger[_0xcc57('0x13')](_0xcc57('0x14'),_0x16f4c0,_0xcc57('0x15'));logger[_0xcc57('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x16f4c0,_0xcc57('0x15'),JSON[_0xcc57('0x17')](_0x1a3e10));if(_0x1a3e10[_0xcc57('0x18')]){if(_0x1a3e10[_0xcc57('0x18')][_0xcc57('0x19')]===0x1f4){logger[_0xcc57('0x18')](_0xcc57('0x14'),_0x16f4c0,_0x1a3e10['error'][_0xcc57('0x1a')]);return _0x5c6e53(_0x1a3e10[_0xcc57('0x18')][_0xcc57('0x1a')]);}logger[_0xcc57('0x18')](_0xcc57('0x14'),_0x16f4c0,_0x1a3e10[_0xcc57('0x18')][_0xcc57('0x1a')]);return _0x1bbfdc(_0x1a3e10[_0xcc57('0x18')]['message']);}else{logger[_0xcc57('0x13')](_0xcc57('0x14'),_0x16f4c0,_0xcc57('0x15'));_0x1bbfdc(_0x1a3e10['result'][_0xcc57('0x1a')]);}})[_0xcc57('0x1b')](function(_0x4df3c2){logger[_0xcc57('0x18')](_0xcc57('0x14'),_0x16f4c0,_0x4df3c2);_0x5c6e53(_0x4df3c2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index dd3ed98..9b55be7 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 _0xce5e=['update','register','length','chatGroup:','./chatGroup.events','remove'];(function(_0x3f209e,_0x3b9a96){var _0x1d9100=function(_0x1e73c4){while(--_0x1e73c4){_0x3f209e['push'](_0x3f209e['shift']());}};_0x1d9100(++_0x3b9a96);}(_0xce5e,0xee));var _0xece5=function(_0x2b4d01,_0xf17735){_0x2b4d01=_0x2b4d01-0x0;var _0x1e4d04=_0xce5e[_0x2b4d01];return _0x1e4d04;};'use strict';var ChatGroupEvents=require(_0xece5('0x0'));var events=['save',_0xece5('0x1'),_0xece5('0x2')];function createListener(_0x3ac5cb,_0x223ffa){return function(_0x30f812){_0x223ffa['emit'](_0x3ac5cb,_0x30f812);};}function removeListener(_0x5c49a5,_0x24ac93){return function(){ChatGroupEvents['removeListener'](_0x5c49a5,_0x24ac93);};}exports[_0xece5('0x3')]=function(_0x2ddbdb){for(var _0x40e504=0x0,_0x139836=events[_0xece5('0x4')];_0x40e504<_0x139836;_0x40e504++){var _0x1b29be=events[_0x40e504];var _0x2c7daa=createListener(_0xece5('0x5')+_0x1b29be,_0x2ddbdb);ChatGroupEvents['on'](_0x1b29be,_0x2c7daa);}}; \ No newline at end of file +var _0x1240=['emit','register','length','chatGroup:','remove','update'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0x1240,0x6a));var _0x0124=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x1240[_0xc4001c];return _0x49f7bc;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x0124('0x0'),_0x0124('0x1')];function createListener(_0x224cb7,_0x15f104){return function(_0x4e5df4){_0x15f104[_0x0124('0x2')](_0x224cb7,_0x4e5df4);};}function removeListener(_0x4fdacc,_0x37099b){return function(){ChatGroupEvents['removeListener'](_0x4fdacc,_0x37099b);};}exports[_0x0124('0x3')]=function(_0x8cc04b){for(var _0x421703=0x0,_0x15e450=events[_0x0124('0x4')];_0x421703<_0x15e450;_0x421703++){var _0x2db880=events[_0x421703];var _0x12f437=createListener(_0x0124('0x5')+_0x2db880,_0x8cc04b);ChatGroupEvents['on'](_0x2db880,_0x12f437);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1b107ac..478114d 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 _0xa812=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','put','destroy'];(function(_0x5713f3,_0x4df455){var _0x541456=function(_0x19ec8f){while(--_0x19ec8f){_0x5713f3['push'](_0x5713f3['shift']());}};_0x541456(++_0x4df455);}(_0xa812,0x180));var _0x2a81=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa812[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0x2a81('0x0'));var path=require('path');var timeout=require(_0x2a81('0x1'));var express=require(_0x2a81('0x2'));var router=express[_0x2a81('0x3')]();var fs_extra=require(_0x2a81('0x4'));var auth=require(_0x2a81('0x5'));var interaction=require(_0x2a81('0x6'));var config=require(_0x2a81('0x7'));var controller=require(_0x2a81('0x8'));router[_0x2a81('0x9')]('/',auth[_0x2a81('0xa')](),controller[_0x2a81('0xb')]);router[_0x2a81('0x9')]('/describe',auth[_0x2a81('0xa')](),controller[_0x2a81('0xc')]);router[_0x2a81('0x9')](_0x2a81('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x2a81('0x9')](_0x2a81('0xe'),auth[_0x2a81('0xa')](),controller[_0x2a81('0xf')]);router[_0x2a81('0x9')](_0x2a81('0x10'),auth['isAuthenticated'](),controller[_0x2a81('0x11')]);router[_0x2a81('0x9')](_0x2a81('0x12'),auth[_0x2a81('0xa')](),controller[_0x2a81('0x13')]);router[_0x2a81('0x14')]('/',auth[_0x2a81('0xa')](),controller[_0x2a81('0x15')]);router['post'](_0x2a81('0x10'),auth[_0x2a81('0xa')](),controller['addMembers']);router[_0x2a81('0x14')]('/:id/messages',auth[_0x2a81('0xa')](),controller['addMessage']);router[_0x2a81('0x16')](_0x2a81('0xd'),auth[_0x2a81('0xa')](),controller['update']);router['delete'](_0x2a81('0xd'),auth[_0x2a81('0xa')](),controller[_0x2a81('0x17')]);router['delete'](_0x2a81('0x10'),auth[_0x2a81('0xa')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file +var _0xb5b4=['post','create','addMembers','addMessage','put','/:id','update','destroy','delete','/:id/members','removeMembers','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages'];(function(_0xabc482,_0x142bc0){var _0x3a9e1a=function(_0x39d2da){while(--_0x39d2da){_0xabc482['push'](_0xabc482['shift']());}};_0x3a9e1a(++_0x142bc0);}(_0xb5b4,0x123));var _0x4b5b=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xb5b4[_0x59b439];return _0x521ea3;};'use strict';var multer=require('multer');var util=require(_0x4b5b('0x0'));var path=require('path');var timeout=require(_0x4b5b('0x1'));var express=require(_0x4b5b('0x2'));var router=express[_0x4b5b('0x3')]();var fs_extra=require(_0x4b5b('0x4'));var auth=require(_0x4b5b('0x5'));var interaction=require(_0x4b5b('0x6'));var config=require(_0x4b5b('0x7'));var controller=require(_0x4b5b('0x8'));router[_0x4b5b('0x9')]('/',auth['isAuthenticated'](),controller[_0x4b5b('0xa')]);router[_0x4b5b('0x9')](_0x4b5b('0xb'),auth[_0x4b5b('0xc')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4b5b('0xd')]);router['get'](_0x4b5b('0xe'),auth['isAuthenticated'](),controller[_0x4b5b('0xf')]);router[_0x4b5b('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x4b5b('0x10')]);router[_0x4b5b('0x9')](_0x4b5b('0x11'),auth[_0x4b5b('0xc')](),controller[_0x4b5b('0x12')]);router[_0x4b5b('0x13')]('/',auth['isAuthenticated'](),controller[_0x4b5b('0x14')]);router['post']('/:id/members',auth[_0x4b5b('0xc')](),controller[_0x4b5b('0x15')]);router[_0x4b5b('0x13')]('/:id/messages',auth[_0x4b5b('0xc')](),controller[_0x4b5b('0x16')]);router[_0x4b5b('0x17')](_0x4b5b('0x18'),auth[_0x4b5b('0xc')](),controller[_0x4b5b('0x19')]);router['delete'](_0x4b5b('0x18'),auth[_0x4b5b('0xc')](),controller[_0x4b5b('0x1a')]);router[_0x4b5b('0x1b')](_0x4b5b('0x1c'),auth[_0x4b5b('0xc')](),controller[_0x4b5b('0x1d')]);module[_0x4b5b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index c70c592..3c4f36c 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 _0xd3af=['BOOLEAN','INTEGER','ENUM','star','thumb','STRING','DATE','TEXT','long','out','sequelize','exports'];(function(_0x559a25,_0x181e7d){var _0x4fb485=function(_0xa5546f){while(--_0xa5546f){_0x559a25['push'](_0x559a25['shift']());}};_0x4fb485(++_0x181e7d);}(_0xd3af,0x142));var _0xfd3a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd3af[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xfd3a('0x0'));module[_0xfd3a('0x1')]={'closed':{'type':Sequelize[_0xfd3a('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xfd3a('0x3')]},'ratingType':{'type':Sequelize[_0xfd3a('0x4')](_0xfd3a('0x5'),_0xfd3a('0x6')),'defaultValue':_0xfd3a('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xfd3a('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfd3a('0x8')]},'disposition':{'type':Sequelize[_0xfd3a('0x7')]},'secondDisposition':{'type':Sequelize[_0xfd3a('0x7')]},'thirdDisposition':{'type':Sequelize[_0xfd3a('0x7')]},'note':{'type':Sequelize[_0xfd3a('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xfd3a('0x7')]},'osName':{'type':Sequelize[_0xfd3a('0x7')]},'osVersion':{'type':Sequelize[_0xfd3a('0x7')]},'deviceModel':{'type':Sequelize[_0xfd3a('0x7')]},'deviceVendor':{'type':Sequelize[_0xfd3a('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xfd3a('0x7')]},'formData':{'type':Sequelize[_0xfd3a('0x9')](_0xfd3a('0xa'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfd3a('0x4')]('in',_0xfd3a('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfd3a('0x7')]},'customerPort':{'type':Sequelize[_0xfd3a('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xfd3a('0x9')]},'autoreplyExecuted':{'type':Sequelize[_0xfd3a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9b8a=['thumb','TEXT','STRING','DATE','long','out','INTEGER','sequelize','exports','BOOLEAN','ENUM','star'];(function(_0x33b18a,_0x16c9ee){var _0x806121=function(_0x20f872){while(--_0x20f872){_0x33b18a['push'](_0x33b18a['shift']());}};_0x806121(++_0x16c9ee);}(_0x9b8a,0x193));var _0xa9b8=function(_0x4496c1,_0x103294){_0x4496c1=_0x4496c1-0x0;var _0xa2da11=_0x9b8a[_0x4496c1];return _0xa2da11;};'use strict';var Sequelize=require(_0xa9b8('0x0'));module[_0xa9b8('0x1')]={'closed':{'type':Sequelize[_0xa9b8('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa9b8('0x3')](_0xa9b8('0x4'),_0xa9b8('0x5')),'defaultValue':_0xa9b8('0x4')},'ratingMessage':{'type':Sequelize[_0xa9b8('0x6')]},'pathTranscript':{'type':Sequelize[_0xa9b8('0x6')]},'mailTranscript':{'type':Sequelize[_0xa9b8('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa9b8('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa9b8('0x7')]},'thirdDisposition':{'type':Sequelize[_0xa9b8('0x7')]},'note':{'type':Sequelize[_0xa9b8('0x7')]},'browserName':{'type':Sequelize[_0xa9b8('0x7')]},'browserVersion':{'type':Sequelize[_0xa9b8('0x7')]},'osName':{'type':Sequelize[_0xa9b8('0x7')]},'osVersion':{'type':Sequelize[_0xa9b8('0x7')]},'deviceModel':{'type':Sequelize[_0xa9b8('0x7')]},'deviceVendor':{'type':Sequelize[_0xa9b8('0x7')]},'deviceType':{'type':Sequelize[_0xa9b8('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa9b8('0x6')](_0xa9b8('0x9'))},'read1stAt':{'type':Sequelize[_0xa9b8('0x8')]},'lastMsgAt':{'type':Sequelize[_0xa9b8('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xa9b8('0x3')]('in',_0xa9b8('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xa9b8('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xa9b8('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xa9b8('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa9b8('0xb')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5899aca..fccfc1c 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 _0x8975=['https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','disposition','file','originalname','basename','filename','type','mimetype','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','offline-chat/','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','CmContact','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','sort','push','findAll','addTags','setTags','omit','Tag','color','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Owner','Account','createdAt','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','value','downloadInteraction.ejs','transcript-','.pdf','Chat','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','stack','name','send','render','merge','body','interaction','account','index','map','fieldName','key','getOptions','chat','query','catch','show','params','model','ChatInteraction','rawAttributes','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8975,0x7a));var _0x5897=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8975[_0x4565bf];return _0x5610ba;};'use strict';var rimraf=require(_0x5897('0x0'));var zipdir=require(_0x5897('0x1'));var rp=require('request-promise');var moment=require(_0x5897('0x2'));var BPromise=require(_0x5897('0x3'));var Mustache=require('mustache');var util=require(_0x5897('0x4'));var path=require(_0x5897('0x5'));var ejs=require(_0x5897('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x5897('0x7'));var interaction=require(_0x5897('0x8'));var qs=require(_0x5897('0x9'));var pdf=require(_0x5897('0xa'));var logger=require(_0x5897('0xb'))(_0x5897('0xc'));var config=require(_0x5897('0xd'));var db=require(_0x5897('0xe'))['db'];config[_0x5897('0xf')]=_[_0x5897('0x10')](config[_0x5897('0xf')],{'host':_0x5897('0x11'),'port':0x18eb});var socket=require(_0x5897('0x12'))(new Redis(config[_0x5897('0xf')]));require(_0x5897('0x13'))[_0x5897('0x14')](socket);var jayson=require(_0x5897('0x15'));var client=jayson[_0x5897('0x16')][_0x5897('0x17')]({'port':0x232b});var client9004=jayson[_0x5897('0x16')][_0x5897('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x5735cd,_0x583b35,_0x345c3b,_0x1e128f){return new BPromise(function(_0x5005df,_0x4d311f){var _0xf506c7=_0x1e128f||client;return _0xf506c7['request'](_0x5735cd,_0x345c3b)['then'](function(_0x551080){logger[_0x5897('0x18')](_0x5897('0x19'),_0x583b35,'request\x20sent');logger['debug'](_0x5897('0x1a'),_0x583b35,_0x5897('0x1b'),JSON[_0x5897('0x1c')](_0x551080));if(_0x551080['error']){if(_0x551080[_0x5897('0x1d')][_0x5897('0x1e')]===0x1f4){logger[_0x5897('0x1d')](_0x5897('0x19'),_0x583b35,_0x551080[_0x5897('0x1d')][_0x5897('0x1f')]);return _0x4d311f(_0x551080[_0x5897('0x1d')][_0x5897('0x1f')]);}logger[_0x5897('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x583b35,_0x551080['error'][_0x5897('0x1f')]);return _0x5005df(_0x551080[_0x5897('0x1d')]['message']);}else{logger[_0x5897('0x18')](_0x5897('0x19'),_0x583b35,_0x5897('0x1b'));_0x5005df(_0x551080[_0x5897('0x20')][_0x5897('0x1f')]);}})['catch'](function(_0x1c5ccc){logger['error'](_0x5897('0x19'),_0x583b35,_0x1c5ccc);_0x4d311f(_0x1c5ccc);});});}function respondWithStatusCode(_0x5045c2,_0x807e41){_0x807e41=_0x807e41||0xcc;return function(_0x4e11c9){if(_0x4e11c9){return _0x5045c2[_0x5897('0x21')](_0x807e41);}return _0x5045c2['status'](_0x807e41)[_0x5897('0x22')]();};}function respondWithResult(_0x3ad9a0,_0x236579){_0x236579=_0x236579||0xc8;return function(_0x2d62f8){if(_0x2d62f8){return _0x3ad9a0[_0x5897('0x23')](_0x236579)['json'](_0x2d62f8);}};}function respondWithFilteredResult(_0xf99c12,_0x33206b){return function(_0xad136d){if(_0xad136d){var _0x124e59=typeof _0x33206b[_0x5897('0x24')]===_0x5897('0x25')&&typeof _0x33206b[_0x5897('0x26')]==='undefined';var _0x18d5e7=_0xad136d['count'];var _0x248e12=_0x124e59?0x0:_0x33206b[_0x5897('0x24')];var _0x43014d=_0x124e59?_0xad136d[_0x5897('0x27')]:_0x33206b[_0x5897('0x24')]+_0x33206b[_0x5897('0x26')];var _0x1e9cb6;if(_0x43014d>=_0x18d5e7){_0x43014d=_0x18d5e7;_0x1e9cb6=0xc8;}else{_0x1e9cb6=0xce;}_0xf99c12[_0x5897('0x23')](_0x1e9cb6);return _0xf99c12[_0x5897('0x28')](_0x5897('0x29'),_0x248e12+'-'+_0x43014d+'/'+_0x18d5e7)[_0x5897('0x2a')](_0xad136d);}return null;};}function saveUpdates(_0x29ea60){return function(_0x25d1a3){if(_0x25d1a3){return _0x25d1a3[_0x5897('0x2b')](_0x29ea60)[_0x5897('0x2c')](function(_0x14adb1){return _0x14adb1;});}return null;};}function removeEntity(_0x180181){return function(_0x54c2ce){if(_0x54c2ce){return _0x54c2ce['destroy']()[_0x5897('0x2c')](function(){_0x180181[_0x5897('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e346b){return function(_0x12536c){if(!_0x12536c){_0x4e346b[_0x5897('0x21')](0x194);}return _0x12536c;};}function handleError(_0x224dcd,_0x394bdc){_0x394bdc=_0x394bdc||0x1f4;return function(_0x109319){logger[_0x5897('0x1d')](_0x109319[_0x5897('0x2d')]);if(_0x109319[_0x5897('0x2e')]){delete _0x109319[_0x5897('0x2e')];}_0x224dcd[_0x5897('0x23')](_0x394bdc)[_0x5897('0x2f')](_0x109319);};}function getMustacheRender(_0x2013d1,_0x1e5d69){return Mustache[_0x5897('0x30')](_0x2013d1,_[_0x5897('0x31')](_0x1e5d69[_0x5897('0x32')],{'contact':_0x1e5d69['contact'],'message':_0x1e5d69[_0x5897('0x1f')],'agent':_0x1e5d69['agent'],'interaction':_0x1e5d69[_0x5897('0x33')],'account':_0x1e5d69[_0x5897('0x34')]}))||'';}exports[_0x5897('0x35')]=function(_0x16a853,_0x47aeee){var _0x1e336d={};var _0x46e704=_[_0x5897('0x36')](db['ChatInteraction']['rawAttributes'],function(_0x1961a2){return{'name':_0x1961a2[_0x5897('0x37')],'type':_0x1961a2['type'][_0x5897('0x38')]};});_0x1e336d=qs[_0x5897('0x39')](_0x46e704,_0x16a853);return interaction['findAll'](_0x5897('0x3a'),_0x16a853[_0x5897('0x3b')],_0x16a853['user'],_0x1e336d,_0x46e704)[_0x5897('0x2c')](respondWithFilteredResult(_0x47aeee,_0x1e336d))[_0x5897('0x3c')](handleError(_0x47aeee,null));};exports[_0x5897('0x3d')]=function(_0x35ad00,_0x1d2865){var _0xd7428e={'raw':![],'where':{'id':_0x35ad00[_0x5897('0x3e')]['id']}},_0x119f7c={};_0x119f7c[_0x5897('0x3f')]=_['keys'](db[_0x5897('0x40')][_0x5897('0x41')]);_0x119f7c['query']=_[_0x5897('0x42')](_0x35ad00[_0x5897('0x3b')]);_0x119f7c[_0x5897('0x43')]=_[_0x5897('0x44')](_0x119f7c['model'],_0x119f7c[_0x5897('0x3b')]);_0xd7428e['attributes']=_[_0x5897('0x44')](_0x119f7c[_0x5897('0x3f')],qs[_0x5897('0x45')](_0x35ad00[_0x5897('0x3b')]['fields']));_0xd7428e[_0x5897('0x46')]=_0xd7428e[_0x5897('0x46')][_0x5897('0x47')]?_0xd7428e[_0x5897('0x46')]:_0x119f7c['model'];if(_0x35ad00['query'][_0x5897('0x48')]){_0xd7428e[_0x5897('0x49')]=[{'all':!![]}];}_0xd7428e=_['merge']({},_0xd7428e,_0x35ad00[_0x5897('0x4a')]);return db[_0x5897('0x40')][_0x5897('0x4b')](_0xd7428e)['then'](handleEntityNotFound(_0x1d2865,null))[_0x5897('0x2c')](respondWithResult(_0x1d2865,null))['catch'](handleError(_0x1d2865,null));};exports[_0x5897('0x4c')]=function(_0x42d02e,_0x23dc82){return db[_0x5897('0x40')][_0x5897('0x4c')](_0x42d02e[_0x5897('0x32')],{})[_0x5897('0x2c')](respondWithResult(_0x23dc82,0xc9))[_0x5897('0x3c')](handleError(_0x23dc82,null));};exports[_0x5897('0x2b')]=function(_0xa97a35,_0xeb9c73){if(_0xa97a35[_0x5897('0x32')]['id']){delete _0xa97a35[_0x5897('0x32')]['id'];}return db[_0x5897('0x40')][_0x5897('0x4b')]({'where':{'id':_0xa97a35[_0x5897('0x3e')]['id']}})[_0x5897('0x2c')](handleEntityNotFound(_0xeb9c73,null))[_0x5897('0x2c')](saveUpdates(_0xa97a35[_0x5897('0x32')],null))[_0x5897('0x2c')](respondWithResult(_0xeb9c73,null))['catch'](handleError(_0xeb9c73,null));};exports[_0x5897('0x4d')]=function(_0x1e8a46,_0x15e3ae){return db[_0x5897('0x40')]['find']({'where':{'id':_0x1e8a46[_0x5897('0x3e')]['id']}})['then'](handleEntityNotFound(_0x15e3ae,null))[_0x5897('0x2c')](removeEntity(_0x15e3ae,null))['catch'](handleError(_0x15e3ae,null));};exports[_0x5897('0x4e')]=function(_0x421a8d,_0x5e9774){return db['ChatInteraction']['describe']()[_0x5897('0x2c')](respondWithResult(_0x5e9774,null))[_0x5897('0x3c')](handleError(_0x5e9774,null));};exports[_0x5897('0x4f')]=function(_0x2ddceb,_0xee22ad){var _0x545505=_0x2ddceb['params']['id'];var _0x3d725e;var _0x30bde4;var _0x3f07c8;return db[_0x5897('0x40')][_0x5897('0x50')]({'where':{'id':_0x545505}})['then'](function(_0x47c8af){_0x3d725e=_0x47c8af;return db[_0x5897('0x51')][_0x5897('0x50')]({'where':{'id':_0x47c8af['ChatWebsiteId']},'attributes':['id',_0x5897('0x52'),_0x5897('0x53'),_0x5897('0x54'),_0x5897('0x55'),_0x5897('0x56')],'raw':!![]});})[_0x5897('0x2c')](function(_0x3b49cf){if(_0x3b49cf&&_0x3b49cf[_0x5897('0x52')]&&_0x3b49cf['vidaooEscalation']){_0x30bde4=_0x3b49cf;var _0x3a959c={'interaction':{'id':_0x545505},'agent':{'id':_0x2ddceb[_0x5897('0x57')]['id'],'name':_0x2ddceb[_0x5897('0x57')][_0x5897('0x2e')],'fullname':_0x2ddceb[_0x5897('0x57')][_0x5897('0x58')],'email':_0x2ddceb[_0x5897('0x57')][_0x5897('0x59')]},'contact':_0x2ddceb[_0x5897('0x32')]['contact'],'account':_0x2ddceb[_0x5897('0x32')]['account']};var _0x1c8bf9={'rejectUnauthorized':![],'method':'POST','url':_0x5897('0x5a'),'headers':{'X-APIKEY':_0x3b49cf[_0x5897('0x52')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2ddceb[_0x5897('0x57')][_0x5897('0x59')]],'buttons':null,'topic':_0x30bde4[_0x5897('0x54')],'note':_[_0x5897('0x5b')](_0x30bde4[_0x5897('0x55')])?null:getMustacheRender(_0x30bde4[_0x5897('0x55')],_0x3a959c),'metadata':null},'redirect':_0x5897('0x5c'),'json':!![]};try{if(!_[_0x5897('0x5b')](_0x30bde4[_0x5897('0x56')])){var _0x28d748=getMustacheRender(_0x30bde4['vidaooMetadata'],_0x3a959c);var _0x2011f8=JSON[_0x5897('0x5d')](_0x28d748);_0x1c8bf9[_0x5897('0x32')]['metadata']=_0x2011f8;}}catch(_0x1536d7){throw new db[(_0x5897('0x5e'))][(_0x5897('0x5f'))](_0x5897('0x60'));}return rp(_0x1c8bf9);}else{throw new db[(_0x5897('0x5e'))][(_0x5897('0x5f'))](_0x5897('0x61'));}})[_0x5897('0x2c')](function(_0x5c9a8d){_0x3f07c8=_0x5c9a8d;if(_0x3f07c8['id']){var _0x438f46={'body':_0x3f07c8['join_url'],'ChatWebsiteId':_0x30bde4['id'],'ChatInteractionId':_0x3d725e['id'],'direction':_0x5897('0x62'),'UserId':_0x2ddceb[_0x5897('0x57')]['id']};return db[_0x5897('0x63')][_0x5897('0x4c')](_0x438f46,{});}else{throw new db[(_0x5897('0x5e'))][(_0x5897('0x5f'))](_0x5897('0x64'));}})[_0x5897('0x2c')](function(){return _0x3d725e['updateAttributes']({'vidaooSessionId':_0x3f07c8['id']});})['then'](respondWithResult(_0xee22ad,null))[_0x5897('0x3c')](handleError(_0xee22ad,null));};exports[_0x5897('0x65')]=function(_0x5b0358,_0x4a1084){if(_0x5b0358[_0x5897('0x32')]['id']){delete _0x5b0358['body']['id'];}return db[_0x5897('0x40')][_0x5897('0x4b')]({'where':{'id':_0x5b0358[_0x5897('0x3e')]['id']},'include':[{'model':db['CmContact'],'as':_0x5897('0x66')}]})[_0x5897('0x2c')](handleEntityNotFound(_0x4a1084,null))['then'](saveUpdates(_0x5b0358[_0x5897('0x32')],null))[_0x5897('0x2c')](respondWithResult(_0x4a1084,null))['catch'](handleError(_0x4a1084,null));};exports[_0x5897('0x67')]=function(_0xd1dba1,_0x1f276c){if(_0xd1dba1[_0x5897('0x32')]['id']){delete _0xd1dba1[_0x5897('0x32')]['id'];}return db[_0x5897('0x40')][_0x5897('0x4b')]({'where':{'id':_0xd1dba1[_0x5897('0x3e')]['id']}})[_0x5897('0x2c')](function(_0x3603fc){if(!_0x3603fc){logger[_0x5897('0x1d')](_0x5897('0x68'),_0x5897('0x67'),0x194,'entity\x20not\x20found');_0x1f276c[_0x5897('0x21')](0x194);}else{if(_0x3603fc[_0x5897('0x69')]){throw new db[(_0x5897('0x5e'))]['ValidationError'](_0x5897('0x6a'));}}return _0x3603fc;})[_0x5897('0x2c')](function(_0x515940){if(_0x515940){return _0x515940[_0x5897('0x2b')]({'closed':_0xd1dba1[_0x5897('0x32')][_0x5897('0x6b')],'disposition':_0xd1dba1[_0x5897('0x32')][_0x5897('0x6c')]})['then'](function(_0x39c079){return _0x39c079;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0xd1dba1['body'],client9004);})[_0x5897('0x2c')](respondWithResult(_0x1f276c,null))[_0x5897('0x3c')](handleError(_0x1f276c,null));};exports['attachmentUpload']=function(_0x3843e8,_0x5f51b6){_0x3843e8[_0x5897('0x32')][_0x5897('0x2e')]=_0x3843e8[_0x5897('0x6d')][_0x5897('0x6e')];_0x3843e8[_0x5897('0x32')][_0x5897('0x6f')]=_0x3843e8[_0x5897('0x6d')][_0x5897('0x70')];_0x3843e8[_0x5897('0x32')][_0x5897('0x71')]=_0x3843e8[_0x5897('0x6d')][_0x5897('0x72')];return db[_0x5897('0x73')]['create'](_0x3843e8[_0x5897('0x32')])[_0x5897('0x2c')](respondWithResult(_0x5f51b6,0xc9))[_0x5897('0x3c')](handleError(_0x5f51b6,null));};exports[_0x5897('0x74')]=function(_0x1fecd0,_0x9f3333){return db[_0x5897('0x40')][_0x5897('0x50')]({'where':{'id':_0x1fecd0[_0x5897('0x3e')]['id']},'raw':!![]})[_0x5897('0x2c')](handleEntityNotFound(_0x9f3333,null))[_0x5897('0x2c')](function(_0x2dd2f0){if(_0x2dd2f0){if(_0x2dd2f0[_0x5897('0x6b')]){return _0x9f3333['status'](0x193)[_0x5897('0x2a')]({'status':0x193,'message':'Unauthorized'});}return db[_0x5897('0x73')][_0x5897('0x50')]({'where':{'id':_0x1fecd0['query'][_0x5897('0x75')]},'raw':!![]})[_0x5897('0x2c')](handleEntityNotFound(_0x9f3333,null));}})[_0x5897('0x2c')](function(_0x563cd2){if(_0x563cd2){var _0x2e818d=_0x563cd2[_0x5897('0x76')]!==null;var _0x2c7fb2=path[_0x5897('0x77')](config['root'],'server/files/attachments/');if(_0x2e818d){_0x2c7fb2=path[_0x5897('0x77')](_0x2c7fb2,_0x5897('0x78'));}var _0x428514=path[_0x5897('0x77')](_0x2c7fb2,_0x563cd2[_0x5897('0x6f')]);return _0x9f3333[_0x5897('0x79')](_0x428514);}})[_0x5897('0x3c')](handleError(_0x9f3333,null));};exports[_0x5897('0x7a')]=function(_0x502011,_0x42de6e){var _0x4632ee=null;var _0x5b67e0=null;var _0x43996a=null;if(_0x502011[_0x5897('0x32')]['id']){delete _0x502011[_0x5897('0x32')]['id'];}if(_0x502011['body'][_0x5897('0x7b')]){_0x43996a=path[_0x5897('0x77')](config[_0x5897('0x7c')],_0x5897('0x7d'),util[_0x5897('0x7e')](_0x5897('0x7f'),Date[_0x5897('0x80')]()));_0x502011[_0x5897('0x32')][_0x5897('0x81')]=_0x43996a;}return db[_0x5897('0x40')][_0x5897('0x4b')]({'where':{'id':_0x502011[_0x5897('0x3e')]['id']},'include':[{'model':db[_0x5897('0x63')],'as':_0x5897('0x82'),'include':[{'model':db[_0x5897('0x83')],'as':_0x5897('0x83')}]}]})['then'](handleEntityNotFound(_0x42de6e,null))[_0x5897('0x2c')](saveUpdates(_0x502011[_0x5897('0x32')],null))['then'](function(_0x2a8393){if(_0x2a8393){_0x4632ee=_0x2a8393;return db[_0x5897('0x51')][_0x5897('0x4b')]({'where':{'id':_0x4632ee[_0x5897('0x84')]}});}})['then'](function(_0x546108){if(_0x546108){_0x5b67e0=_0x546108;return db[_0x5897('0x85')][_0x5897('0x4b')]({'where':{'id':_0x4632ee[_0x5897('0x86')]}});}})['then'](function(_0x96c38f){if(_0x96c38f){if(_0x43996a){var _0x243989=null;for(var _0x383a61=0x1;_0x383a61<_0x4632ee[_0x5897('0x82')][_0x5897('0x47')];++_0x383a61){_0x243989=_0x4632ee[_0x5897('0x82')][_0x383a61];var _0x1ede10=_0x243989[_0x5897('0x69')]?util[_0x5897('0x7e')](_0x5897('0x87'),_0x5b67e0[_0x5897('0x88')],_0x243989['UserId']):_0x5897('0x89');var _0x5d3ca7=_0x502011[_0x5897('0x32')][_0x5897('0x8a')]||util['format'](_0x5897('0x87'),_0x5897('0x8b'),_0x243989[_0x5897('0x86')]);switch(_0x5b67e0[_0x5897('0x8c')]){case'website_alias':_0x1ede10=_0x243989[_0x5897('0x69')]?util['format'](_0x5897('0x87'),_0x5b67e0[_0x5897('0x88')],_0x243989[_0x5897('0x69')]):'System';break;case _0x5897('0x8d'):_0x1ede10=_0x243989['UserId']?_0x243989[_0x5897('0x83')][_0x5897('0x8e')]||_0x243989[_0x5897('0x83')][_0x5897('0x58')]:_0x5897('0x89');break;case _0x5897('0x8f'):_0x1ede10=_0x243989[_0x5897('0x69')]?_0x243989['User'][_0x5897('0x58')]:_0x5897('0x89');break;default:_0x1ede10=_0x243989['UserId']?util[_0x5897('0x7e')](_0x5897('0x87'),_0x5b67e0['agentAlias'],_0x243989[_0x5897('0x69')]):_0x5897('0x89');}var _0x1a28c4=util['format'](_0x5897('0x90'),moment(_0x243989['createdAt'])['format'](_0x5897('0x91')),_0x243989[_0x5897('0x92')]==='in'?_0x5d3ca7:_0x1ede10,_0x243989[_0x5897('0x32')]);if(!_0x243989[_0x5897('0x93')]){fs[_0x5897('0x94')](_0x43996a,_0x1a28c4);}}return db[_0x5897('0x95')][_0x5897('0x50')]({'where':{'service':!![]},'include':[{'model':db[_0x5897('0x96')],'as':_0x5897('0x97'),'raw':!![],'include':[{'model':db[_0x5897('0x98')],'as':_0x5897('0x98'),'raw':!![]}]}]});}}})[_0x5897('0x2c')](function(_0x173887){if(!_0x173887||!_0x173887['Smtp']||!_0x502011[_0x5897('0x32')])return _0x4632ee;var _0x576267=_0x173887[_0x5897('0x99')]();return respondWithRpcPromise(_0x5897('0x9a'),_0x5897('0x9b'),{'account':_0x576267,'message':{'from':util[_0x5897('0x7e')](_0x5897('0x9c'),_0x173887[_0x5897('0x2e')],_0x173887[_0x5897('0x59')]||_0x173887[_0x5897('0x97')][_0x5897('0x57')]),'to':_0x502011[_0x5897('0x32')]['mailTranscript'],'subject':_0x5897('0x9d'),'text':util[_0x5897('0x7e')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x502011['body'][_0x5897('0x7b')]),'attachments':[{'path':_0x43996a}]}})[_0x5897('0x2c')](function(){return _0x4632ee;})[_0x5897('0x3c')](function(_0x34a526){logger[_0x5897('0x1d')](_0x34a526);});})[_0x5897('0x2c')](respondWithStatusCode(_0x42de6e,0xc8))[_0x5897('0x3c')](handleError(_0x42de6e,null));};exports[_0x5897('0x9e')]=function(_0x5a6975,_0xe54c4d){return db[_0x5897('0x63')][_0x5897('0x4b')]({'where':{'id':_0x5a6975[_0x5897('0x3e')]['id']}})['then'](handleEntityNotFound(_0xe54c4d,null))[_0x5897('0x2c')](function(_0x21dab2){if(_0x21dab2){return _0x21dab2[_0x5897('0x9e')](_0x5a6975[_0x5897('0x32')]['ids'],_['omit'](_0x5a6975[_0x5897('0x32')],[_0x5897('0x9f'),'id'])||{});}})[_0x5897('0x2c')](respondWithResult(_0xe54c4d,null))['catch'](handleError(_0xe54c4d,null));};exports[_0x5897('0xa0')]=function(_0x1d480f,_0x557f07){var _0x4a68e0={'raw':![],'where':{}};var _0x135565={};var _0x24ab01={'count':0x0,'rows':[]};return db[_0x5897('0x40')][_0x5897('0x50')]({'where':{'id':_0x1d480f[_0x5897('0x3e')]['id']}})[_0x5897('0x2c')](handleEntityNotFound(_0x557f07,null))[_0x5897('0x2c')](function(_0x3fe1bc){if(_0x3fe1bc){_0x135565[_0x5897('0x3f')]=_[_0x5897('0x42')](db[_0x5897('0x63')][_0x5897('0x41')]);_0x135565[_0x5897('0x3b')]=_[_0x5897('0x42')](_0x1d480f['query']);_0x135565[_0x5897('0x43')]=_['intersection'](_0x135565[_0x5897('0x3f')],_0x135565[_0x5897('0x3b')]);_0x4a68e0[_0x5897('0x46')]=_[_0x5897('0x44')](_0x135565[_0x5897('0x3f')],qs[_0x5897('0x45')](_0x1d480f[_0x5897('0x3b')][_0x5897('0x45')]));_0x4a68e0[_0x5897('0x46')]=_0x4a68e0[_0x5897('0x46')]['length']?_0x4a68e0[_0x5897('0x46')]:_0x135565[_0x5897('0x3f')];if(!_0x1d480f['query'][_0x5897('0xa1')](_0x5897('0xa2'))){_0x4a68e0['limit']=qs[_0x5897('0x26')](_0x1d480f[_0x5897('0x3b')]['limit']);_0x4a68e0[_0x5897('0x24')]=qs[_0x5897('0x24')](_0x1d480f['query'][_0x5897('0x24')]);}_0x4a68e0[_0x5897('0xa3')]=qs['sort'](_0x1d480f[_0x5897('0x3b')]['sort']);_0x4a68e0[_0x5897('0xa4')]=qs['filters'](_[_0x5897('0xa5')](_0x1d480f[_0x5897('0x3b')],_0x135565[_0x5897('0x43')]));_0x4a68e0['where'][_0x5897('0xa6')]=_0x3fe1bc['id'];if(_0x1d480f[_0x5897('0x3b')][_0x5897('0xa7')]){_0x4a68e0[_0x5897('0xa4')]=_[_0x5897('0x31')](_0x4a68e0[_0x5897('0xa4')],{'$or':_[_0x5897('0x36')](_0x4a68e0[_0x5897('0x46')],function(_0x3b8d13){var _0x41cc4f={};_0x41cc4f[_0x3b8d13]={'$like':'%'+_0x1d480f[_0x5897('0x3b')][_0x5897('0xa7')]+'%'};return _0x41cc4f;})});}if(_0x1d480f[_0x5897('0x3b')][_0x5897('0xa8')]){var _0x235976=_0x1d480f[_0x5897('0x3b')][_0x5897('0xa8')]['split'](',');var _0x236856={};_0x236856[_0x235976[0x0]]={'$gte':moment(_0x235976[0x1])[_0x5897('0x7e')](_0x5897('0xa9'))};_0x4a68e0['where']=_[_0x5897('0x31')](_0x4a68e0[_0x5897('0xa4')],_0x236856);}_0x4a68e0=_['merge']({},_0x4a68e0,_0x1d480f[_0x5897('0x4a')]);return db[_0x5897('0x63')][_0x5897('0x27')]({'where':_0x4a68e0[_0x5897('0xa4')]})[_0x5897('0x2c')](function(_0x42e998){_0x24ab01['count']=_0x42e998;if(_0x1d480f[_0x5897('0x3b')][_0x5897('0x48')]){_0x4a68e0[_0x5897('0x49')]=[{'all':!![]}];}return db[_0x5897('0x63')]['findAll'](_0x4a68e0);})[_0x5897('0x2c')](function(_0xa0b3bc){_0x24ab01[_0x5897('0xaa')]=_0xa0b3bc;return _0x24ab01;});}})[_0x5897('0x2c')](respondWithFilteredResult(_0x557f07,_0x4a68e0))['catch'](handleError(_0x557f07,null));};exports[_0x5897('0xab')]=function(_0x322604,_0x3ff4d2){var _0x1b90b2={'where':{}},_0x55a584={},_0x543ba2={'count':0x0,'rows':[]};return db[_0x5897('0x40')][_0x5897('0x50')]({'where':{'id':_0x322604[_0x5897('0x3e')]['id']}})[_0x5897('0x2c')](handleEntityNotFound(_0x3ff4d2,null))[_0x5897('0x2c')](function(_0x52ed30){if(_0x52ed30){_0x55a584['model']=_[_0x5897('0x42')](db['ChatMessage'][_0x5897('0x41')]);_0x55a584[_0x5897('0x3b')]=_['keys'](_0x322604[_0x5897('0x3b')]);_0x55a584[_0x5897('0x43')]=_[_0x5897('0x44')](_0x55a584[_0x5897('0x3f')],_0x55a584[_0x5897('0x3b')]);_0x1b90b2['attributes']=_[_0x5897('0x44')](_0x55a584[_0x5897('0x3f')],qs[_0x5897('0x45')](_0x322604['query'][_0x5897('0x45')]));_0x1b90b2[_0x5897('0x46')]=_0x1b90b2[_0x5897('0x46')][_0x5897('0x47')]?_0x1b90b2[_0x5897('0x46')]:_0x55a584[_0x5897('0x3f')];if(!_0x322604[_0x5897('0x3b')][_0x5897('0xa1')]('nolimit')){_0x1b90b2[_0x5897('0x26')]=qs[_0x5897('0x26')](_0x322604[_0x5897('0x3b')]['limit']);_0x1b90b2[_0x5897('0x24')]=qs[_0x5897('0x24')](_0x322604[_0x5897('0x3b')][_0x5897('0x24')]);}_0x1b90b2[_0x5897('0xa3')]=qs[_0x5897('0xac')](_0x322604[_0x5897('0x3b')]['sort']);_0x1b90b2[_0x5897('0xa4')]=qs[_0x5897('0x43')](_[_0x5897('0xa5')](_0x322604['query'],_0x55a584[_0x5897('0x43')]));_0x1b90b2[_0x5897('0xa4')][_0x5897('0xa6')]=_0x52ed30['id'];if(_0x322604[_0x5897('0x3b')][_0x5897('0xa7')]){_0x1b90b2[_0x5897('0xa4')]=_['merge'](_0x1b90b2[_0x5897('0xa4')],{'$or':_[_0x5897('0x36')](_0x1b90b2[_0x5897('0x46')],function(_0x15c4a6){var _0x3305a1={};_0x3305a1[_0x15c4a6]={'$like':'%'+_0x322604['query'][_0x5897('0xa7')]+'%'};return _0x3305a1;})});}_0x1b90b2[_0x5897('0xa4')][_0x5897('0x93')]=![];if(_0x322604[_0x5897('0x3b')]['id']){_0x1b90b2[_0x5897('0xa4')]['id']={'$gt':_0x322604[_0x5897('0x3b')]['id']};}_0x1b90b2=_[_0x5897('0x31')]({},_0x1b90b2,_0x322604[_0x5897('0x4a')]);return db['ChatMessage']['count']({'where':_0x1b90b2['where']})['then'](function(_0x37f1fd){_0x543ba2['count']=_0x37f1fd;_0x1b90b2[_0x5897('0x49')]=[];if(_0x322604['query']['includeAgent']){_0x1b90b2[_0x5897('0x49')][_0x5897('0xad')]({'model':db[_0x5897('0x83')],'as':_0x5897('0x83'),'attributes':['id',_0x5897('0x58'),_0x5897('0x8e')]});}if(_0x322604[_0x5897('0x3b')][_0x5897('0x48')]){_0x1b90b2['include']=[{'all':!![]}];}return db['ChatMessage'][_0x5897('0xae')](_0x1b90b2);})['then'](function(_0x351fd3){_0x543ba2[_0x5897('0xaa')]=_0x351fd3;return _0x543ba2;});}})[_0x5897('0x2c')](respondWithFilteredResult(_0x3ff4d2,_0x1b90b2))[_0x5897('0x3c')](handleError(_0x3ff4d2,null));};exports[_0x5897('0xaf')]=function(_0x8e2cde,_0x3bd558){return db[_0x5897('0x40')][_0x5897('0x4b')]({'where':{'id':_0x8e2cde[_0x5897('0x3e')]['id']}})[_0x5897('0x2c')](handleEntityNotFound(_0x3bd558,null))[_0x5897('0x2c')](function(_0x5a05dd){if(_0x5a05dd){return _0x5a05dd[_0x5897('0xb0')](_0x8e2cde[_0x5897('0x32')][_0x5897('0x9f')],_[_0x5897('0xb1')](_0x8e2cde['body'],[_0x5897('0x9f'),'id'])||{})['spread'](function(){return db[_0x5897('0xb2')][_0x5897('0xae')]({'attributes':['id','name',_0x5897('0xb3')],'where':{'id':_0x8e2cde['body'][_0x5897('0x9f')]}});})[_0x5897('0x2c')](function(_0x36df09){socket['emit'](_0x5897('0xb4'),{'id':Number(_0x8e2cde[_0x5897('0x3e')]['id']),'tags':_0x36df09||[]});return{'id':Number(_0x8e2cde[_0x5897('0x3e')]['id']),'tags':_0x36df09||[]};});}})[_0x5897('0x2c')](respondWithResult(_0x3bd558,null))['catch'](handleError(_0x3bd558,null));};exports[_0x5897('0xb5')]=function(_0x43137b,_0x473327){return db[_0x5897('0x40')][_0x5897('0x4b')]({'where':{'id':_0x43137b[_0x5897('0x3e')]['id']}})[_0x5897('0x2c')](handleEntityNotFound(_0x473327,null))[_0x5897('0x2c')](function(_0x1879a4){if(_0x1879a4){return _0x1879a4[_0x5897('0xb5')](_0x43137b[_0x5897('0x3b')][_0x5897('0x9f')]);}})[_0x5897('0x2c')](respondWithStatusCode(_0x473327,null))[_0x5897('0x3c')](handleError(_0x473327,null));};exports[_0x5897('0x79')]=function(_0x528860,_0x338fcc){var _0xcf59d3=moment()[_0x5897('0xb6')]()[_0x5897('0xb7')]();var _0x31906b=path[_0x5897('0x77')](config['root'],_0x5897('0xb8'),_0x5897('0xb9'),_0x5897('0xba'));var _0x181a19=path[_0x5897('0x77')](config[_0x5897('0x7c')],_0x5897('0xb8'),'files',_0x5897('0xbb'));var _0x1330da=path[_0x5897('0x77')](_0x31906b,_0xcf59d3);var _0x111080=util[_0x5897('0x7e')](_0x5897('0xbc'),_0x528860[_0x5897('0x3e')]['id'],_0xcf59d3);var _0x174ccd=path[_0x5897('0x77')](_0x31906b,_0x111080);var _0x4d8518=[];_0x4d8518[_0x5897('0xad')]({'model':db[_0x5897('0x83')],'as':'User','attributes':['id',_0x5897('0x58')],'raw':!![]});_0x4d8518[_0x5897('0xad')]({'model':db[_0x5897('0x85')],'as':_0x5897('0x66'),'attributes':['id',_0x5897('0xbd'),_0x5897('0xbe')],'raw':!![]});if(_0x528860['query'][_0x5897('0xbb')]){_0x4d8518[_0x5897('0xad')]({'model':db[_0x5897('0x73')],'as':_0x5897('0x73'),'raw':!![]});}var _0x4a011e=[{'model':db['ChatMessage'],'as':_0x5897('0x82'),'attributes':['id','body','createdAt',_0x5897('0x92'),_0x5897('0x93'),'read'],'include':_0x4d8518}];_0x4a011e[_0x5897('0xad')]({'model':db[_0x5897('0x51')],'as':'Account','attributes':['id','name']});_0x4a011e[_0x5897('0xad')]({'model':db[_0x5897('0x83')],'as':_0x5897('0xbf'),'attributes':['id',_0x5897('0x58')]});return db['ChatInteraction'][_0x5897('0x4b')]({'where':{'id':_0x528860[_0x5897('0x3e')]['id']},'include':_0x4a011e})['then'](handleEntityNotFound(_0x338fcc,null))[_0x5897('0x2c')](function(_0x1310e8){if(_0x1310e8){var _0x49fa47=_0x1310e8['get']({'plain':!![]});fs['mkdirSync'](_0x1330da);var _0x43e331={'channel':'Chat','account':_0x49fa47[_0x5897('0xc0')][_0x5897('0x2e')],'agent':_0x49fa47[_0x5897('0xbf')]?_0x49fa47[_0x5897('0xbf')][_0x5897('0x58')]:'N.A.','createdAt':moment(_0x49fa47[_0x5897('0xc1')])[_0x5897('0x7e')](_0x5897('0xa9'))[_0x5897('0xb7')](),'closedAt':_0x49fa47['closed']?moment(_0x49fa47[_0x5897('0xc2')])['format'](_0x5897('0xa9'))['toString']():'','disposition':_0x49fa47['disposition'],'chatInfo':{'browser':_0x49fa47[_0x5897('0xc3')],'os':_0x49fa47[_0x5897('0xc4')],'referer':_0x49fa47[_0x5897('0xc5')],'customerIp':_0x49fa47[_0x5897('0xc6')],'customerPort':_0x49fa47[_0x5897('0xc7')]?_0x49fa47[_0x5897('0xc7')]:_0x5897('0xc8')},'messages':_(_0x49fa47[_0x5897('0x82')])[_0x5897('0xc9')]()[_0x5897('0xa7')]({'secret':![]})[_0x5897('0x36')](function(_0x35832b){if(_0x35832b['Attachment']){var _0x3c076d=path['join'](_0x181a19,_0x35832b[_0x5897('0x73')][_0x5897('0x6f')]);if(fs[_0x5897('0xca')](_0x3c076d)){fs[_0x5897('0xcb')](_0x3c076d)[_0x5897('0xcc')](fs['createWriteStream'](path[_0x5897('0x77')](_0x1330da,_0x35832b[_0x5897('0x73')]['basename'])));}}return{'date':moment(_0x35832b[_0x5897('0xc1')])['format'](_0x5897('0xa9'))['toString'](),'sender':_0x35832b[_0x5897('0x92')]===_0x5897('0x62')?_0x35832b[_0x5897('0x83')]?_0x35832b['User'][_0x5897('0x58')]:_0x5897('0x89'):_0x35832b[_0x5897('0x66')][_0x5897('0xbd')]+(_0x35832b[_0x5897('0x66')][_0x5897('0xbe')]?'\x20'+_0x35832b[_0x5897('0x66')]['lastName']:''),'body':_0x35832b[_0x5897('0x73')]?_0x35832b[_0x5897('0x73')][_0x5897('0x6f')]:_0x35832b[_0x5897('0x32')],'direction':_0x35832b['direction']===_0x5897('0x62')?'A':'C','secret':_0x35832b[_0x5897('0x93')],'read':_0x35832b['read'],'attachment':_0x35832b[_0x5897('0x73')]};})[_0x5897('0xcd')]()};return ejs['renderFile'](path[_0x5897('0x77')](config[_0x5897('0x7c')],'server','views',_0x5897('0xce')),{'interaction':_0x43e331})[_0x5897('0x2c')](function(_0x576de1){var _0xf4ea0b=path[_0x5897('0x77')](_0x1330da,_0x5897('0xcf')+_0x49fa47['id']+'-'+_0xcf59d3+_0x5897('0xd0'));var _0x123e8c={'path':_0xf4ea0b,'channel':_0x5897('0xd1'),'interactionId':_0x49fa47['id']};return pdf['createPdfFromHTML'](_0x576de1,_0x123e8c);})[_0x5897('0x2c')](function(){return new Promise(function(_0x2ebdb4,_0x288ec3){zipdir(_0x1330da,{'saveTo':_0x174ccd},function(_0x146091,_0x5ddba8){if(_0x146091)return _0x288ec3(_0x146091);return _0x2ebdb4(_0x5ddba8);});})[_0x5897('0x2c')](function(){return new BPromise(function(_0x5c8331,_0x1b73be){rimraf(_0x1330da,function(_0x182359){if(_0x182359)_0x1b73be(_0x182359);return _0x5c8331();});});})['then'](function(){return _0x338fcc[_0x5897('0x79')](_0x174ccd,_0x111080,function(_0x4d67d3){if(_0x4d67d3){logger[_0x5897('0x1d')](_0x5897('0xd2'),_0x4d67d3);}else{fs[_0x5897('0xd3')](_0x174ccd);}});});});}else{return _0x338fcc[_0x5897('0x21')](0xc8);}})['catch'](handleError(_0x338fcc,null));}; \ No newline at end of file +var _0x447e=['Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','type','mimetype','attachmentDownload','findOne','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','pathTranscript','User','CmContact','ContactId','Messages','format','%s%d','agentAlias','UserId','customer','Visitor','agentIdentifier','website_alias','System','alias','fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','rows','includeAgent','push','addTags','setTags','Tag','removeTags','toString','server','files','tmp','transcript-%d-%s.zip','Contact','firstName','attachments','read','Account','Owner','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','createWriteStream','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','map','ChatInteraction','rawAttributes','fieldName','key','getOptions','findAll','chat','query','user','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','options','find','create','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooMetadata','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','vidaooNote','follow','parse','metadata','Sequelize','ValidationError'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x447e,0x75));var _0xe447=function(_0x40b434,_0x1b71d8){_0x40b434=_0x40b434-0x0;var _0xbccbcc=_0x447e[_0x40b434];return _0xbccbcc;};'use strict';var rimraf=require(_0xe447('0x0'));var zipdir=require(_0xe447('0x1'));var rp=require(_0xe447('0x2'));var moment=require(_0xe447('0x3'));var BPromise=require(_0xe447('0x4'));var Mustache=require(_0xe447('0x5'));var util=require(_0xe447('0x6'));var path=require('path');var ejs=require(_0xe447('0x7'));var fs=require('fs');var _=require(_0xe447('0x8'));var Redis=require('ioredis');var interaction=require(_0xe447('0x9'));var qs=require(_0xe447('0xa'));var pdf=require(_0xe447('0xb'));var logger=require(_0xe447('0xc'))(_0xe447('0xd'));var config=require(_0xe447('0xe'));var db=require(_0xe447('0xf'))['db'];config[_0xe447('0x10')]=_[_0xe447('0x11')](config['redis'],{'host':_0xe447('0x12'),'port':0x18eb});var socket=require(_0xe447('0x13'))(new Redis(config[_0xe447('0x10')]));require(_0xe447('0x14'))[_0xe447('0x15')](socket);var jayson=require(_0xe447('0x16'));var client=jayson[_0xe447('0x17')][_0xe447('0x18')]({'port':0x232b});var client9004=jayson[_0xe447('0x17')]['http']({'port':0x232c});function respondWithRpcPromise(_0x498072,_0xf22741,_0x2a5383,_0x57ae3b){return new BPromise(function(_0x32f3ba,_0x14c77e){var _0x2f120e=_0x57ae3b||client;return _0x2f120e[_0xe447('0x19')](_0x498072,_0x2a5383)[_0xe447('0x1a')](function(_0x619e84){logger[_0xe447('0x1b')](_0xe447('0x1c'),_0xf22741,'request\x20sent');logger[_0xe447('0x1d')](_0xe447('0x1e'),_0xf22741,_0xe447('0x1f'),JSON[_0xe447('0x20')](_0x619e84));if(_0x619e84[_0xe447('0x21')]){if(_0x619e84[_0xe447('0x21')]['code']===0x1f4){logger['error'](_0xe447('0x1c'),_0xf22741,_0x619e84['error'][_0xe447('0x22')]);return _0x14c77e(_0x619e84[_0xe447('0x21')][_0xe447('0x22')]);}logger[_0xe447('0x21')](_0xe447('0x1c'),_0xf22741,_0x619e84[_0xe447('0x21')][_0xe447('0x22')]);return _0x32f3ba(_0x619e84[_0xe447('0x21')][_0xe447('0x22')]);}else{logger[_0xe447('0x1b')](_0xe447('0x1c'),_0xf22741,'request\x20sent');_0x32f3ba(_0x619e84[_0xe447('0x23')][_0xe447('0x22')]);}})[_0xe447('0x24')](function(_0x32c182){logger[_0xe447('0x21')](_0xe447('0x1c'),_0xf22741,_0x32c182);_0x14c77e(_0x32c182);});});}function respondWithStatusCode(_0x4fad17,_0x2ebd12){_0x2ebd12=_0x2ebd12||0xcc;return function(_0x9d499c){if(_0x9d499c){return _0x4fad17[_0xe447('0x25')](_0x2ebd12);}return _0x4fad17['status'](_0x2ebd12)[_0xe447('0x26')]();};}function respondWithResult(_0x54439e,_0x395a1a){_0x395a1a=_0x395a1a||0xc8;return function(_0x463fb2){if(_0x463fb2){return _0x54439e[_0xe447('0x27')](_0x395a1a)[_0xe447('0x28')](_0x463fb2);}};}function respondWithFilteredResult(_0x212ab7,_0xdaf354){return function(_0x1281fa){if(_0x1281fa){var _0x3d9f1f=typeof _0xdaf354[_0xe447('0x29')]===_0xe447('0x2a')&&typeof _0xdaf354[_0xe447('0x2b')]===_0xe447('0x2a');var _0x34019b=_0x1281fa[_0xe447('0x2c')];var _0x31deb1=_0x3d9f1f?0x0:_0xdaf354[_0xe447('0x29')];var _0x572b75=_0x3d9f1f?_0x1281fa[_0xe447('0x2c')]:_0xdaf354[_0xe447('0x29')]+_0xdaf354['limit'];var _0x5e1c15;if(_0x572b75>=_0x34019b){_0x572b75=_0x34019b;_0x5e1c15=0xc8;}else{_0x5e1c15=0xce;}_0x212ab7[_0xe447('0x27')](_0x5e1c15);return _0x212ab7['set'](_0xe447('0x2d'),_0x31deb1+'-'+_0x572b75+'/'+_0x34019b)[_0xe447('0x28')](_0x1281fa);}return null;};}function saveUpdates(_0x9d5f9f){return function(_0x2ea3d2){if(_0x2ea3d2){return _0x2ea3d2[_0xe447('0x2e')](_0x9d5f9f)[_0xe447('0x1a')](function(_0x1e52dd){return _0x1e52dd;});}return null;};}function removeEntity(_0x1dda62){return function(_0x3f2bd8){if(_0x3f2bd8){return _0x3f2bd8[_0xe447('0x2f')]()['then'](function(){_0x1dda62[_0xe447('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1984bd){return function(_0x15568c){if(!_0x15568c){_0x1984bd[_0xe447('0x25')](0x194);}return _0x15568c;};}function handleError(_0x5e15a7,_0xe2d068){_0xe2d068=_0xe2d068||0x1f4;return function(_0x11c2e){logger[_0xe447('0x21')](_0x11c2e[_0xe447('0x30')]);if(_0x11c2e[_0xe447('0x31')]){delete _0x11c2e[_0xe447('0x31')];}_0x5e15a7[_0xe447('0x27')](_0xe2d068)[_0xe447('0x32')](_0x11c2e);};}function getMustacheRender(_0x3fd972,_0x46d588){return Mustache[_0xe447('0x33')](_0x3fd972,_[_0xe447('0x34')](_0x46d588[_0xe447('0x35')],{'contact':_0x46d588[_0xe447('0x36')],'message':_0x46d588[_0xe447('0x22')],'agent':_0x46d588[_0xe447('0x37')],'interaction':_0x46d588[_0xe447('0x38')],'account':_0x46d588[_0xe447('0x39')]}))||'';}exports['index']=function(_0x44e55b,_0x4cc3a2){var _0x5ce1b1={};var _0x505dde=_[_0xe447('0x3a')](db[_0xe447('0x3b')][_0xe447('0x3c')],function(_0x54bb40){return{'name':_0x54bb40[_0xe447('0x3d')],'type':_0x54bb40['type'][_0xe447('0x3e')]};});_0x5ce1b1=qs[_0xe447('0x3f')](_0x505dde,_0x44e55b);return interaction[_0xe447('0x40')](_0xe447('0x41'),_0x44e55b[_0xe447('0x42')],_0x44e55b[_0xe447('0x43')],_0x5ce1b1,_0x505dde)[_0xe447('0x1a')](respondWithFilteredResult(_0x4cc3a2,_0x5ce1b1))[_0xe447('0x24')](handleError(_0x4cc3a2,null));};exports['show']=function(_0x506530,_0x16f5f1){var _0x1e2577={'raw':![],'where':{'id':_0x506530[_0xe447('0x44')]['id']}},_0x78829e={};_0x78829e[_0xe447('0x45')]=_[_0xe447('0x46')](db['ChatInteraction'][_0xe447('0x3c')]);_0x78829e[_0xe447('0x42')]=_[_0xe447('0x46')](_0x506530[_0xe447('0x42')]);_0x78829e[_0xe447('0x47')]=_['intersection'](_0x78829e[_0xe447('0x45')],_0x78829e[_0xe447('0x42')]);_0x1e2577[_0xe447('0x48')]=_[_0xe447('0x49')](_0x78829e['model'],qs[_0xe447('0x4a')](_0x506530['query']['fields']));_0x1e2577['attributes']=_0x1e2577[_0xe447('0x48')][_0xe447('0x4b')]?_0x1e2577[_0xe447('0x48')]:_0x78829e[_0xe447('0x45')];if(_0x506530[_0xe447('0x42')][_0xe447('0x4c')]){_0x1e2577[_0xe447('0x4d')]=[{'all':!![]}];}_0x1e2577=_[_0xe447('0x34')]({},_0x1e2577,_0x506530[_0xe447('0x4e')]);return db['ChatInteraction'][_0xe447('0x4f')](_0x1e2577)[_0xe447('0x1a')](handleEntityNotFound(_0x16f5f1,null))[_0xe447('0x1a')](respondWithResult(_0x16f5f1,null))['catch'](handleError(_0x16f5f1,null));};exports[_0xe447('0x50')]=function(_0x265f52,_0x38c725){return db[_0xe447('0x3b')][_0xe447('0x50')](_0x265f52[_0xe447('0x35')],{})[_0xe447('0x1a')](respondWithResult(_0x38c725,0xc9))[_0xe447('0x24')](handleError(_0x38c725,null));};exports[_0xe447('0x2e')]=function(_0x39b2f0,_0x11f2a2){if(_0x39b2f0[_0xe447('0x35')]['id']){delete _0x39b2f0[_0xe447('0x35')]['id'];}return db['ChatInteraction'][_0xe447('0x4f')]({'where':{'id':_0x39b2f0[_0xe447('0x44')]['id']}})[_0xe447('0x1a')](handleEntityNotFound(_0x11f2a2,null))[_0xe447('0x1a')](saveUpdates(_0x39b2f0[_0xe447('0x35')],null))[_0xe447('0x1a')](respondWithResult(_0x11f2a2,null))[_0xe447('0x24')](handleError(_0x11f2a2,null));};exports[_0xe447('0x2f')]=function(_0x815bbe,_0x21dea4){return db[_0xe447('0x3b')][_0xe447('0x4f')]({'where':{'id':_0x815bbe[_0xe447('0x44')]['id']}})[_0xe447('0x1a')](handleEntityNotFound(_0x21dea4,null))[_0xe447('0x1a')](removeEntity(_0x21dea4,null))[_0xe447('0x24')](handleError(_0x21dea4,null));};exports['describe']=function(_0x55be9b,_0x7314a5){return db[_0xe447('0x3b')]['describe']()[_0xe447('0x1a')](respondWithResult(_0x7314a5,null))[_0xe447('0x24')](handleError(_0x7314a5,null));};exports[_0xe447('0x51')]=function(_0x57d327,_0x289a65){var _0x5e96e2=_0x57d327['params']['id'];var _0x1af8b0;var _0x170d70;var _0x41d810;return db[_0xe447('0x3b')]['findOne']({'where':{'id':_0x5e96e2}})[_0xe447('0x1a')](function(_0x5e4804){_0x1af8b0=_0x5e4804;return db[_0xe447('0x52')]['findOne']({'where':{'id':_0x5e4804[_0xe447('0x53')]},'attributes':['id',_0xe447('0x54'),_0xe447('0x55'),'vidaooTopic','vidaooNote',_0xe447('0x56')],'raw':!![]});})[_0xe447('0x1a')](function(_0x4f919f){if(_0x4f919f&&_0x4f919f[_0xe447('0x54')]&&_0x4f919f['vidaooEscalation']){_0x170d70=_0x4f919f;var _0x138e28={'interaction':{'id':_0x5e96e2},'agent':{'id':_0x57d327[_0xe447('0x43')]['id'],'name':_0x57d327[_0xe447('0x43')][_0xe447('0x31')],'fullname':_0x57d327[_0xe447('0x43')]['fullname'],'email':_0x57d327[_0xe447('0x43')][_0xe447('0x57')]},'contact':_0x57d327[_0xe447('0x35')][_0xe447('0x36')],'account':_0x57d327[_0xe447('0x35')]['account']};var _0x460cd2={'rejectUnauthorized':![],'method':'POST','url':_0xe447('0x58'),'headers':{'X-APIKEY':_0x4f919f[_0xe447('0x54')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x57d327[_0xe447('0x43')]['email']],'buttons':null,'topic':_0x170d70[_0xe447('0x59')],'note':_[_0xe447('0x5a')](_0x170d70[_0xe447('0x5b')])?null:getMustacheRender(_0x170d70[_0xe447('0x5b')],_0x138e28),'metadata':null},'redirect':_0xe447('0x5c'),'json':!![]};try{if(!_[_0xe447('0x5a')](_0x170d70['vidaooMetadata'])){var _0x4d3b89=getMustacheRender(_0x170d70[_0xe447('0x56')],_0x138e28);var _0x4d10b6=JSON[_0xe447('0x5d')](_0x4d3b89);_0x460cd2['body'][_0xe447('0x5e')]=_0x4d10b6;}}catch(_0x47256f){throw new db[(_0xe447('0x5f'))][(_0xe447('0x60'))](_0xe447('0x61'));}return rp(_0x460cd2);}else{throw new db[(_0xe447('0x5f'))][(_0xe447('0x60'))](_0xe447('0x62'));}})['then'](function(_0x4908e6){_0x41d810=_0x4908e6;if(_0x41d810['id']){var _0x18a719={'body':_0x41d810[_0xe447('0x63')],'ChatWebsiteId':_0x170d70['id'],'ChatInteractionId':_0x1af8b0['id'],'direction':_0xe447('0x64'),'UserId':_0x57d327[_0xe447('0x43')]['id']};return db[_0xe447('0x65')]['create'](_0x18a719,{});}else{throw new db[(_0xe447('0x5f'))][(_0xe447('0x60'))](_0xe447('0x66'));}})[_0xe447('0x1a')](function(){return _0x1af8b0[_0xe447('0x67')]({'vidaooSessionId':_0x41d810['id']});})[_0xe447('0x1a')](respondWithResult(_0x289a65,null))['catch'](handleError(_0x289a65,null));};exports[_0xe447('0x68')]=function(_0x3affa2,_0x1c2fad){if(_0x3affa2[_0xe447('0x35')]['id']){delete _0x3affa2[_0xe447('0x35')]['id'];}return db[_0xe447('0x3b')]['find']({'where':{'id':_0x3affa2[_0xe447('0x44')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xe447('0x1a')](handleEntityNotFound(_0x1c2fad,null))[_0xe447('0x1a')](saveUpdates(_0x3affa2['body'],null))[_0xe447('0x1a')](respondWithResult(_0x1c2fad,null))[_0xe447('0x24')](handleError(_0x1c2fad,null));};exports[_0xe447('0x69')]=function(_0x3ec99c,_0x2964e6){if(_0x3ec99c[_0xe447('0x35')]['id']){delete _0x3ec99c[_0xe447('0x35')]['id'];}return db['ChatInteraction'][_0xe447('0x4f')]({'where':{'id':_0x3ec99c[_0xe447('0x44')]['id']}})[_0xe447('0x1a')](function(_0xb082ea){if(!_0xb082ea){logger[_0xe447('0x21')](_0xe447('0x6a'),_0xe447('0x69'),0x194,_0xe447('0x6b'));_0x2964e6['sendStatus'](0x194);}else{if(_0xb082ea['UserId']){throw new db[(_0xe447('0x5f'))][(_0xe447('0x60'))]('Interaction\x20already\x20assigned');}}return _0xb082ea;})[_0xe447('0x1a')](function(_0x1c4224){if(_0x1c4224){return _0x1c4224[_0xe447('0x2e')]({'closed':_0x3ec99c[_0xe447('0x35')][_0xe447('0x6c')],'disposition':_0x3ec99c[_0xe447('0x35')][_0xe447('0x6d')]})['then'](function(_0x5711b1){return _0x5711b1;});}})['then'](function(){return respondWithRpcPromise(_0xe447('0x6e'),'abandon',_0x3ec99c['body'],client9004);})[_0xe447('0x1a')](respondWithResult(_0x2964e6,null))[_0xe447('0x24')](handleError(_0x2964e6,null));};exports[_0xe447('0x6f')]=function(_0x1dd4a1,_0xe3095b){_0x1dd4a1[_0xe447('0x35')][_0xe447('0x31')]=_0x1dd4a1['file'][_0xe447('0x70')];_0x1dd4a1[_0xe447('0x35')][_0xe447('0x71')]=_0x1dd4a1[_0xe447('0x72')]['filename'];_0x1dd4a1[_0xe447('0x35')][_0xe447('0x73')]=_0x1dd4a1[_0xe447('0x72')][_0xe447('0x74')];return db['Attachment'][_0xe447('0x50')](_0x1dd4a1[_0xe447('0x35')])[_0xe447('0x1a')](respondWithResult(_0xe3095b,0xc9))[_0xe447('0x24')](handleError(_0xe3095b,null));};exports[_0xe447('0x75')]=function(_0xd56a0,_0x2fa340){return db[_0xe447('0x3b')][_0xe447('0x76')]({'where':{'id':_0xd56a0[_0xe447('0x44')]['id']},'raw':!![]})[_0xe447('0x1a')](handleEntityNotFound(_0x2fa340,null))[_0xe447('0x1a')](function(_0x21ee05){if(_0x21ee05){if(_0x21ee05['closed']){return _0x2fa340[_0xe447('0x27')](0x193)['json']({'status':0x193,'message':_0xe447('0x77')});}return db[_0xe447('0x78')][_0xe447('0x76')]({'where':{'id':_0xd56a0[_0xe447('0x42')][_0xe447('0x79')]},'raw':!![]})[_0xe447('0x1a')](handleEntityNotFound(_0x2fa340,null));}})[_0xe447('0x1a')](function(_0x23e649){if(_0x23e649){var _0x2daa1e=_0x23e649[_0xe447('0x7a')]!==null;var _0x596e11=path[_0xe447('0x7b')](config['root'],_0xe447('0x7c'));if(_0x2daa1e){_0x596e11=path[_0xe447('0x7b')](_0x596e11,_0xe447('0x7d'));}var _0x363314=path['join'](_0x596e11,_0x23e649['basename']);return _0x2fa340[_0xe447('0x7e')](_0x363314);}})[_0xe447('0x24')](handleError(_0x2fa340,null));};exports[_0xe447('0x7f')]=function(_0x126bcb,_0xf1ad6e){var _0x105e04=null;var _0x117176=null;var _0x34e426=null;if(_0x126bcb[_0xe447('0x35')]['id']){delete _0x126bcb['body']['id'];}if(_0x126bcb[_0xe447('0x35')][_0xe447('0x80')]){_0x34e426=path['join'](config[_0xe447('0x81')],_0xe447('0x82'),util['format'](_0xe447('0x83'),Date['now']()));_0x126bcb['body'][_0xe447('0x84')]=_0x34e426;}return db[_0xe447('0x3b')][_0xe447('0x4f')]({'where':{'id':_0x126bcb[_0xe447('0x44')]['id']},'include':[{'model':db[_0xe447('0x65')],'as':'Messages','include':[{'model':db['User'],'as':_0xe447('0x85')}]}]})['then'](handleEntityNotFound(_0xf1ad6e,null))[_0xe447('0x1a')](saveUpdates(_0x126bcb['body'],null))[_0xe447('0x1a')](function(_0x53670e){if(_0x53670e){_0x105e04=_0x53670e;return db[_0xe447('0x52')][_0xe447('0x4f')]({'where':{'id':_0x105e04[_0xe447('0x53')]}});}})[_0xe447('0x1a')](function(_0x24a92e){if(_0x24a92e){_0x117176=_0x24a92e;return db[_0xe447('0x86')][_0xe447('0x4f')]({'where':{'id':_0x105e04[_0xe447('0x87')]}});}})[_0xe447('0x1a')](function(_0x166a8c){if(_0x166a8c){if(_0x34e426){var _0x1f8a1f=null;for(var _0x972d28=0x1;_0x972d28<_0x105e04['Messages'][_0xe447('0x4b')];++_0x972d28){_0x1f8a1f=_0x105e04[_0xe447('0x88')][_0x972d28];var _0x22f395=_0x1f8a1f['UserId']?util[_0xe447('0x89')](_0xe447('0x8a'),_0x117176[_0xe447('0x8b')],_0x1f8a1f[_0xe447('0x8c')]):'System';var _0x3bd527=_0x126bcb[_0xe447('0x35')][_0xe447('0x8d')]||util[_0xe447('0x89')](_0xe447('0x8a'),_0xe447('0x8e'),_0x1f8a1f[_0xe447('0x87')]);switch(_0x117176[_0xe447('0x8f')]){case _0xe447('0x90'):_0x22f395=_0x1f8a1f[_0xe447('0x8c')]?util[_0xe447('0x89')](_0xe447('0x8a'),_0x117176[_0xe447('0x8b')],_0x1f8a1f[_0xe447('0x8c')]):_0xe447('0x91');break;case'agent_alias':_0x22f395=_0x1f8a1f['UserId']?_0x1f8a1f[_0xe447('0x85')][_0xe447('0x92')]||_0x1f8a1f['User'][_0xe447('0x93')]:'System';break;case'agent_fullname':_0x22f395=_0x1f8a1f[_0xe447('0x8c')]?_0x1f8a1f[_0xe447('0x85')]['fullname']:_0xe447('0x91');break;default:_0x22f395=_0x1f8a1f[_0xe447('0x8c')]?util['format'](_0xe447('0x8a'),_0x117176[_0xe447('0x8b')],_0x1f8a1f['UserId']):'System';}var _0x364c85=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x1f8a1f[_0xe447('0x94')])[_0xe447('0x89')](_0xe447('0x95')),_0x1f8a1f[_0xe447('0x96')]==='in'?_0x3bd527:_0x22f395,_0x1f8a1f[_0xe447('0x35')]);if(!_0x1f8a1f[_0xe447('0x97')]){fs['appendFileSync'](_0x34e426,_0x364c85);}}return db[_0xe447('0x98')][_0xe447('0x76')]({'where':{'service':!![]},'include':[{'model':db[_0xe447('0x99')],'as':_0xe447('0x9a'),'raw':!![],'include':[{'model':db[_0xe447('0x9b')],'as':_0xe447('0x9b'),'raw':!![]}]}]});}}})['then'](function(_0x4d1c8c){if(!_0x4d1c8c||!_0x4d1c8c[_0xe447('0x9a')]||!_0x126bcb[_0xe447('0x35')])return _0x105e04;var _0xb69fbc=_0x4d1c8c[_0xe447('0x9c')]();return respondWithRpcPromise('SendMail',_0xe447('0x9d'),{'account':_0xb69fbc,'message':{'from':util[_0xe447('0x89')](_0xe447('0x9e'),_0x4d1c8c['name'],_0x4d1c8c[_0xe447('0x57')]||_0x4d1c8c['Smtp'][_0xe447('0x43')]),'to':_0x126bcb['body'][_0xe447('0x80')],'subject':_0xe447('0x9f'),'text':util[_0xe447('0x89')](_0xe447('0xa0'),_0x126bcb[_0xe447('0x35')][_0xe447('0x80')]),'attachments':[{'path':_0x34e426}]}})[_0xe447('0x1a')](function(){return _0x105e04;})[_0xe447('0x24')](function(_0x2f0158){logger[_0xe447('0x21')](_0x2f0158);});})[_0xe447('0x1a')](respondWithStatusCode(_0xf1ad6e,0xc8))[_0xe447('0x24')](handleError(_0xf1ad6e,null));};exports[_0xe447('0xa1')]=function(_0x2d962b,_0x26f99c){return db[_0xe447('0x65')]['find']({'where':{'id':_0x2d962b[_0xe447('0x44')]['id']}})[_0xe447('0x1a')](handleEntityNotFound(_0x26f99c,null))[_0xe447('0x1a')](function(_0x689e93){if(_0x689e93){return _0x689e93[_0xe447('0xa1')](_0x2d962b[_0xe447('0x35')][_0xe447('0xa2')],_[_0xe447('0xa3')](_0x2d962b[_0xe447('0x35')],[_0xe447('0xa2'),'id'])||{});}})[_0xe447('0x1a')](respondWithResult(_0x26f99c,null))[_0xe447('0x24')](handleError(_0x26f99c,null));};exports[_0xe447('0xa4')]=function(_0x808e5e,_0x2e3f77){var _0x5cf7ba={'raw':![],'where':{}};var _0x3c1d05={};var _0x22928b={'count':0x0,'rows':[]};return db[_0xe447('0x3b')]['findOne']({'where':{'id':_0x808e5e[_0xe447('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e3f77,null))[_0xe447('0x1a')](function(_0x4ca406){if(_0x4ca406){_0x3c1d05[_0xe447('0x45')]=_['keys'](db[_0xe447('0x65')][_0xe447('0x3c')]);_0x3c1d05[_0xe447('0x42')]=_[_0xe447('0x46')](_0x808e5e['query']);_0x3c1d05[_0xe447('0x47')]=_[_0xe447('0x49')](_0x3c1d05['model'],_0x3c1d05[_0xe447('0x42')]);_0x5cf7ba[_0xe447('0x48')]=_[_0xe447('0x49')](_0x3c1d05['model'],qs[_0xe447('0x4a')](_0x808e5e['query']['fields']));_0x5cf7ba[_0xe447('0x48')]=_0x5cf7ba[_0xe447('0x48')][_0xe447('0x4b')]?_0x5cf7ba[_0xe447('0x48')]:_0x3c1d05[_0xe447('0x45')];if(!_0x808e5e[_0xe447('0x42')][_0xe447('0xa5')](_0xe447('0xa6'))){_0x5cf7ba['limit']=qs[_0xe447('0x2b')](_0x808e5e[_0xe447('0x42')][_0xe447('0x2b')]);_0x5cf7ba[_0xe447('0x29')]=qs[_0xe447('0x29')](_0x808e5e[_0xe447('0x42')][_0xe447('0x29')]);}_0x5cf7ba[_0xe447('0xa7')]=qs[_0xe447('0xa8')](_0x808e5e[_0xe447('0x42')][_0xe447('0xa8')]);_0x5cf7ba[_0xe447('0xa9')]=qs[_0xe447('0x47')](_[_0xe447('0xaa')](_0x808e5e[_0xe447('0x42')],_0x3c1d05[_0xe447('0x47')]));_0x5cf7ba[_0xe447('0xa9')][_0xe447('0xab')]=_0x4ca406['id'];if(_0x808e5e[_0xe447('0x42')][_0xe447('0xac')]){_0x5cf7ba[_0xe447('0xa9')]=_[_0xe447('0x34')](_0x5cf7ba[_0xe447('0xa9')],{'$or':_[_0xe447('0x3a')](_0x5cf7ba['attributes'],function(_0x268429){var _0x1116fb={};_0x1116fb[_0x268429]={'$like':'%'+_0x808e5e['query'][_0xe447('0xac')]+'%'};return _0x1116fb;})});}if(_0x808e5e[_0xe447('0x42')][_0xe447('0xad')]){var _0x19f1fa=_0x808e5e[_0xe447('0x42')][_0xe447('0xad')][_0xe447('0xae')](',');var _0x5c9113={};_0x5c9113[_0x19f1fa[0x0]]={'$gte':moment(_0x19f1fa[0x1])[_0xe447('0x89')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5cf7ba[_0xe447('0xa9')]=_[_0xe447('0x34')](_0x5cf7ba[_0xe447('0xa9')],_0x5c9113);}_0x5cf7ba=_[_0xe447('0x34')]({},_0x5cf7ba,_0x808e5e[_0xe447('0x4e')]);return db[_0xe447('0x65')][_0xe447('0x2c')]({'where':_0x5cf7ba[_0xe447('0xa9')]})[_0xe447('0x1a')](function(_0x513a84){_0x22928b[_0xe447('0x2c')]=_0x513a84;if(_0x808e5e[_0xe447('0x42')][_0xe447('0x4c')]){_0x5cf7ba[_0xe447('0x4d')]=[{'all':!![]}];}return db[_0xe447('0x65')][_0xe447('0x40')](_0x5cf7ba);})[_0xe447('0x1a')](function(_0x50ccdd){_0x22928b[_0xe447('0xaf')]=_0x50ccdd;return _0x22928b;});}})['then'](respondWithFilteredResult(_0x2e3f77,_0x5cf7ba))[_0xe447('0x24')](handleError(_0x2e3f77,null));};exports['getMyMessages']=function(_0xd51aa,_0x4de4e9){var _0x2d4397={'where':{}},_0x2e580f={},_0x1c6833={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xe447('0x76')]({'where':{'id':_0xd51aa['params']['id']}})[_0xe447('0x1a')](handleEntityNotFound(_0x4de4e9,null))[_0xe447('0x1a')](function(_0x6561bf){if(_0x6561bf){_0x2e580f['model']=_['keys'](db[_0xe447('0x65')][_0xe447('0x3c')]);_0x2e580f[_0xe447('0x42')]=_['keys'](_0xd51aa['query']);_0x2e580f[_0xe447('0x47')]=_[_0xe447('0x49')](_0x2e580f[_0xe447('0x45')],_0x2e580f[_0xe447('0x42')]);_0x2d4397[_0xe447('0x48')]=_[_0xe447('0x49')](_0x2e580f[_0xe447('0x45')],qs[_0xe447('0x4a')](_0xd51aa['query'][_0xe447('0x4a')]));_0x2d4397['attributes']=_0x2d4397[_0xe447('0x48')][_0xe447('0x4b')]?_0x2d4397[_0xe447('0x48')]:_0x2e580f['model'];if(!_0xd51aa[_0xe447('0x42')][_0xe447('0xa5')](_0xe447('0xa6'))){_0x2d4397[_0xe447('0x2b')]=qs[_0xe447('0x2b')](_0xd51aa[_0xe447('0x42')][_0xe447('0x2b')]);_0x2d4397[_0xe447('0x29')]=qs[_0xe447('0x29')](_0xd51aa['query'][_0xe447('0x29')]);}_0x2d4397[_0xe447('0xa7')]=qs[_0xe447('0xa8')](_0xd51aa[_0xe447('0x42')][_0xe447('0xa8')]);_0x2d4397['where']=qs[_0xe447('0x47')](_['pick'](_0xd51aa['query'],_0x2e580f[_0xe447('0x47')]));_0x2d4397[_0xe447('0xa9')]['ChatInteractionId']=_0x6561bf['id'];if(_0xd51aa[_0xe447('0x42')][_0xe447('0xac')]){_0x2d4397[_0xe447('0xa9')]=_[_0xe447('0x34')](_0x2d4397[_0xe447('0xa9')],{'$or':_['map'](_0x2d4397['attributes'],function(_0x1b6c8a){var _0x18a04b={};_0x18a04b[_0x1b6c8a]={'$like':'%'+_0xd51aa[_0xe447('0x42')][_0xe447('0xac')]+'%'};return _0x18a04b;})});}_0x2d4397['where'][_0xe447('0x97')]=![];if(_0xd51aa[_0xe447('0x42')]['id']){_0x2d4397[_0xe447('0xa9')]['id']={'$gt':_0xd51aa[_0xe447('0x42')]['id']};}_0x2d4397=_['merge']({},_0x2d4397,_0xd51aa[_0xe447('0x4e')]);return db[_0xe447('0x65')]['count']({'where':_0x2d4397['where']})[_0xe447('0x1a')](function(_0x1e96c7){_0x1c6833[_0xe447('0x2c')]=_0x1e96c7;_0x2d4397[_0xe447('0x4d')]=[];if(_0xd51aa[_0xe447('0x42')][_0xe447('0xb0')]){_0x2d4397['include'][_0xe447('0xb1')]({'model':db[_0xe447('0x85')],'as':'User','attributes':['id','fullname','alias']});}if(_0xd51aa[_0xe447('0x42')]['includeAll']){_0x2d4397[_0xe447('0x4d')]=[{'all':!![]}];}return db[_0xe447('0x65')]['findAll'](_0x2d4397);})['then'](function(_0x5805c4){_0x1c6833[_0xe447('0xaf')]=_0x5805c4;return _0x1c6833;});}})[_0xe447('0x1a')](respondWithFilteredResult(_0x4de4e9,_0x2d4397))[_0xe447('0x24')](handleError(_0x4de4e9,null));};exports[_0xe447('0xb2')]=function(_0x765b62,_0x2834e8){return db[_0xe447('0x3b')][_0xe447('0x4f')]({'where':{'id':_0x765b62[_0xe447('0x44')]['id']}})[_0xe447('0x1a')](handleEntityNotFound(_0x2834e8,null))[_0xe447('0x1a')](function(_0x27d55d){if(_0x27d55d){return _0x27d55d[_0xe447('0xb3')](_0x765b62[_0xe447('0x35')][_0xe447('0xa2')],_[_0xe447('0xa3')](_0x765b62[_0xe447('0x35')],['ids','id'])||{})['spread'](function(){return db[_0xe447('0xb4')][_0xe447('0x40')]({'attributes':['id','name','color'],'where':{'id':_0x765b62['body'][_0xe447('0xa2')]}});})[_0xe447('0x1a')](function(_0x567ed6){socket['emit']('chatInteractionTags:save',{'id':Number(_0x765b62['params']['id']),'tags':_0x567ed6||[]});return{'id':Number(_0x765b62[_0xe447('0x44')]['id']),'tags':_0x567ed6||[]};});}})[_0xe447('0x1a')](respondWithResult(_0x2834e8,null))[_0xe447('0x24')](handleError(_0x2834e8,null));};exports[_0xe447('0xb5')]=function(_0x2ac63b,_0x1fa7ca){return db[_0xe447('0x3b')]['find']({'where':{'id':_0x2ac63b['params']['id']}})['then'](handleEntityNotFound(_0x1fa7ca,null))[_0xe447('0x1a')](function(_0x7eeef2){if(_0x7eeef2){return _0x7eeef2[_0xe447('0xb5')](_0x2ac63b[_0xe447('0x42')][_0xe447('0xa2')]);}})[_0xe447('0x1a')](respondWithStatusCode(_0x1fa7ca,null))[_0xe447('0x24')](handleError(_0x1fa7ca,null));};exports[_0xe447('0x7e')]=function(_0x4b45a6,_0x59b75c){var _0x2dd546=moment()['unix']()[_0xe447('0xb6')]();var _0x18f47b=path[_0xe447('0x7b')](config[_0xe447('0x81')],_0xe447('0xb7'),_0xe447('0xb8'),_0xe447('0xb9'));var _0x1958dd=path[_0xe447('0x7b')](config[_0xe447('0x81')],_0xe447('0xb7'),_0xe447('0xb8'),'attachments');var _0x6b0ff5=path[_0xe447('0x7b')](_0x18f47b,_0x2dd546);var _0x46891c=util[_0xe447('0x89')](_0xe447('0xba'),_0x4b45a6[_0xe447('0x44')]['id'],_0x2dd546);var _0x34eafb=path[_0xe447('0x7b')](_0x18f47b,_0x46891c);var _0x29adb2=[];_0x29adb2['push']({'model':db[_0xe447('0x85')],'as':_0xe447('0x85'),'attributes':['id',_0xe447('0x93')],'raw':!![]});_0x29adb2[_0xe447('0xb1')]({'model':db['CmContact'],'as':_0xe447('0xbb'),'attributes':['id',_0xe447('0xbc'),'lastName'],'raw':!![]});if(_0x4b45a6[_0xe447('0x42')][_0xe447('0xbd')]){_0x29adb2[_0xe447('0xb1')]({'model':db['Attachment'],'as':_0xe447('0x78'),'raw':!![]});}var _0x1ac4ef=[{'model':db[_0xe447('0x65')],'as':_0xe447('0x88'),'attributes':['id',_0xe447('0x35'),_0xe447('0x94'),_0xe447('0x96'),_0xe447('0x97'),_0xe447('0xbe')],'include':_0x29adb2}];_0x1ac4ef[_0xe447('0xb1')]({'model':db['ChatWebsite'],'as':_0xe447('0xbf'),'attributes':['id',_0xe447('0x31')]});_0x1ac4ef[_0xe447('0xb1')]({'model':db[_0xe447('0x85')],'as':_0xe447('0xc0'),'attributes':['id','fullname']});return db[_0xe447('0x3b')]['find']({'where':{'id':_0x4b45a6[_0xe447('0x44')]['id']},'include':_0x1ac4ef})[_0xe447('0x1a')](handleEntityNotFound(_0x59b75c,null))['then'](function(_0x2fa7d9){if(_0x2fa7d9){var _0x3dc96e=_0x2fa7d9['get']({'plain':!![]});fs['mkdirSync'](_0x6b0ff5);var _0x23ce05={'channel':_0xe447('0xc1'),'account':_0x3dc96e[_0xe447('0xbf')][_0xe447('0x31')],'agent':_0x3dc96e['Owner']?_0x3dc96e[_0xe447('0xc0')][_0xe447('0x93')]:_0xe447('0xc2'),'createdAt':moment(_0x3dc96e[_0xe447('0x94')])['format'](_0xe447('0xc3'))[_0xe447('0xb6')](),'closedAt':_0x3dc96e[_0xe447('0x6c')]?moment(_0x3dc96e[_0xe447('0xc4')])[_0xe447('0x89')](_0xe447('0xc3'))[_0xe447('0xb6')]():'','disposition':_0x3dc96e[_0xe447('0x6d')],'chatInfo':{'browser':_0x3dc96e[_0xe447('0xc5')],'os':_0x3dc96e[_0xe447('0xc6')],'referer':_0x3dc96e[_0xe447('0xc7')],'customerIp':_0x3dc96e['customerIp'],'customerPort':_0x3dc96e[_0xe447('0xc8')]?_0x3dc96e[_0xe447('0xc8')]:_0xe447('0xc2')},'messages':_(_0x3dc96e[_0xe447('0x88')])[_0xe447('0xc9')]()[_0xe447('0xac')]({'secret':![]})[_0xe447('0x3a')](function(_0x172036){if(_0x172036['Attachment']){var _0x230e9a=path[_0xe447('0x7b')](_0x1958dd,_0x172036[_0xe447('0x78')][_0xe447('0x71')]);if(fs[_0xe447('0xca')](_0x230e9a)){fs[_0xe447('0xcb')](_0x230e9a)['pipe'](fs[_0xe447('0xcc')](path[_0xe447('0x7b')](_0x6b0ff5,_0x172036[_0xe447('0x78')][_0xe447('0x71')])));}}return{'date':moment(_0x172036[_0xe447('0x94')])[_0xe447('0x89')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe447('0xb6')](),'sender':_0x172036[_0xe447('0x96')]===_0xe447('0x64')?_0x172036[_0xe447('0x85')]?_0x172036[_0xe447('0x85')]['fullname']:_0xe447('0x91'):_0x172036['Contact'][_0xe447('0xbc')]+(_0x172036[_0xe447('0xbb')][_0xe447('0xcd')]?'\x20'+_0x172036['Contact'][_0xe447('0xcd')]:''),'body':_0x172036[_0xe447('0x78')]?_0x172036[_0xe447('0x78')][_0xe447('0x71')]:_0x172036['body'],'direction':_0x172036[_0xe447('0x96')]===_0xe447('0x64')?'A':'C','secret':_0x172036['secret'],'read':_0x172036['read'],'attachment':_0x172036['Attachment']};})['value']()};return ejs[_0xe447('0xce')](path[_0xe447('0x7b')](config[_0xe447('0x81')],'server',_0xe447('0xcf'),_0xe447('0xd0')),{'interaction':_0x23ce05})[_0xe447('0x1a')](function(_0x4f52a6){var _0x9ad498=path['join'](_0x6b0ff5,_0xe447('0xd1')+_0x3dc96e['id']+'-'+_0x2dd546+_0xe447('0xd2'));var _0x90bc5d={'path':_0x9ad498,'channel':'Chat','interactionId':_0x3dc96e['id']};return pdf[_0xe447('0xd3')](_0x4f52a6,_0x90bc5d);})['then'](function(){return new Promise(function(_0xabd564,_0x33a593){zipdir(_0x6b0ff5,{'saveTo':_0x34eafb},function(_0x35201d,_0x2a6a01){if(_0x35201d)return _0x33a593(_0x35201d);return _0xabd564(_0x2a6a01);});})[_0xe447('0x1a')](function(){return new BPromise(function(_0x4ce283,_0x5253b0){rimraf(_0x6b0ff5,function(_0x1f4bd4){if(_0x1f4bd4)_0x5253b0(_0x1f4bd4);return _0x4ce283();});});})[_0xe447('0x1a')](function(){return _0x59b75c[_0xe447('0x7e')](_0x34eafb,_0x46891c,function(_0x305035){if(_0x305035){logger[_0xe447('0x21')](_0xe447('0xd4'),_0x305035);}else{fs[_0xe447('0xd5')](_0x34eafb);}});});});}else{return _0x59b75c[_0xe447('0x25')](0xc8);}})[_0xe447('0x24')](handleError(_0x59b75c,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index f2e66da..4ff0496 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 _0x9eaf=['catch','hasOwnProperty','exports','ChatInteraction','../../mysqldb','ChatMessage','save','remove','getUsers','then','Users','map','setDataValue','unreadMessages','emit'];(function(_0x538dff,_0x4859cf){var _0x16c060=function(_0x2acef9){while(--_0x2acef9){_0x538dff['push'](_0x538dff['shift']());}};_0x16c060(++_0x4859cf);}(_0x9eaf,0x7b));var _0xf9ea=function(_0x12bf8a,_0x3c5eb5){_0x12bf8a=_0x12bf8a-0x0;var _0x152415=_0x9eaf[_0x12bf8a];return _0x152415;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0xf9ea('0x0')];var ChatMessage=require(_0xf9ea('0x1'))['db'][_0xf9ea('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf9ea('0x3'),'afterUpdate':'update','afterDestroy':_0xf9ea('0x4')};function emitEvent(_0x2e9f08){return function(_0x319f1f,_0x138e8b,_0x4b0faf){_0x319f1f[_0xf9ea('0x5')]({'attributes':['id'],'raw':!![]})[_0xf9ea('0x6')](function(_0x2589dc){_0x319f1f['setDataValue'](_0xf9ea('0x7'),_0x2589dc[_0xf9ea('0x8')](function(_0x2ff86f){return{'id':_0x2ff86f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x319f1f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf9ea('0x6')](function(_0x37f668){_0x319f1f[_0xf9ea('0x9')](_0xf9ea('0xa'),_0x37f668['length']);ChatInteractionEvents[_0xf9ea('0xb')](_0x2e9f08+':'+_0x319f1f['id'],_0x319f1f);ChatInteractionEvents[_0xf9ea('0xb')](_0x2e9f08,_0x319f1f);_0x4b0faf(null);})[_0xf9ea('0xc')](_0x4b0faf(null));};}for(var e in events){if(events[_0xf9ea('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xf9ea('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0xa221=['Users','map','findAll','length','emit','catch','hook','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','then','setDataValue'];(function(_0x2c17fc,_0x2f03fe){var _0x4c3e7f=function(_0x20b42a){while(--_0x20b42a){_0x2c17fc['push'](_0x2c17fc['shift']());}};_0x4c3e7f(++_0x2f03fe);}(_0xa221,0xb7));var _0x1a22=function(_0xe86db4,_0x3c20fc){_0xe86db4=_0xe86db4-0x0;var _0x2016a3=_0xa221[_0xe86db4];return _0x2016a3;};'use strict';var EventEmitter=require(_0x1a22('0x0'));var ChatInteraction=require(_0x1a22('0x1'))['db'][_0x1a22('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x1a22('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1a22('0x4'),'afterUpdate':_0x1a22('0x5'),'afterDestroy':_0x1a22('0x6')};function emitEvent(_0x15478c){return function(_0xfcc62e,_0x4deb90,_0xdea749){_0xfcc62e['getUsers']({'attributes':['id'],'raw':!![]})[_0x1a22('0x7')](function(_0x5a1ae6){_0xfcc62e[_0x1a22('0x8')](_0x1a22('0x9'),_0x5a1ae6[_0x1a22('0xa')](function(_0x15b3b7){return{'id':_0x15b3b7['id']};}));return ChatMessage[_0x1a22('0xb')]({'where':{'ChatInteractionId':_0xfcc62e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1a22('0x7')](function(_0x3eadf9){_0xfcc62e['setDataValue']('unreadMessages',_0x3eadf9[_0x1a22('0xc')]);ChatInteractionEvents[_0x1a22('0xd')](_0x15478c+':'+_0xfcc62e['id'],_0xfcc62e);ChatInteractionEvents[_0x1a22('0xd')](_0x15478c,_0xfcc62e);_0xdea749(null);})[_0x1a22('0xe')](_0xdea749(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x1a22('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index a9dd38a..65a1bfa 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 _0x29cb=['path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x522664,_0x571bc2){var _0x4285f5=function(_0xfb923c){while(--_0xfb923c){_0x522664['push'](_0x522664['shift']());}};_0x4285f5(++_0x571bc2);}(_0x29cb,0x186));var _0xb29c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x29cb[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xb29c('0x0'));var util=require(_0xb29c('0x1'));var logger=require('../../config/logger')(_0xb29c('0x2'));var moment=require(_0xb29c('0x3'));var BPromise=require(_0xb29c('0x4'));var rp=require(_0xb29c('0x5'));var fs=require('fs');var path=require(_0xb29c('0x6'));var rimraf=require(_0xb29c('0x7'));var config=require(_0xb29c('0x8'));var attributes=require(_0xb29c('0x9'));module[_0xb29c('0xa')]=function(_0x2ce4b9,_0x54f7a7){return _0x2ce4b9[_0xb29c('0xb')](_0xb29c('0xc'),attributes,{'tableName':_0xb29c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30774d,_0x46017a,_0x27d71c){if(_0x30774d[_0xb29c('0xe')](_0xb29c('0xf'))){_0x30774d[_0xb29c('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x27d71c(null,_0x30774d);}},'charset':'utf8mb4','collate':_0xb29c('0x11')});}; \ No newline at end of file +var _0xa412=['lodash','util','api','moment','rimraf','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4f3e9f,_0xd1b662){var _0x2b0cd2=function(_0x22ec2a){while(--_0x22ec2a){_0x4f3e9f['push'](_0x4f3e9f['shift']());}};_0x2b0cd2(++_0xd1b662);}(_0xa412,0x159));var _0x2a41=function(_0x5168c6,_0x889c5e){_0x5168c6=_0x5168c6-0x0;var _0x594ea3=_0xa412[_0x5168c6];return _0x594ea3;};'use strict';var _=require(_0x2a41('0x0'));var util=require(_0x2a41('0x1'));var logger=require('../../config/logger')(_0x2a41('0x2'));var moment=require(_0x2a41('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2a41('0x4'));var config=require('../../config/environment');var attributes=require(_0x2a41('0x5'));module[_0x2a41('0x6')]=function(_0x488dfc,_0x5383d3){return _0x488dfc['define'](_0x2a41('0x7'),attributes,{'tableName':_0x2a41('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd866ff,_0x429091,_0x518e20){if(_0xd866ff[_0x2a41('0x9')](_0x2a41('0xa'))){_0xd866ff[_0x2a41('0xb')]=moment()[_0x2a41('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x518e20(null,_0xd866ff);}},'charset':_0x2a41('0xd'),'collate':_0x2a41('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index f611dfa..6787217 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 _0xcc0a=['rpc','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','limit','stringify','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x164930,_0x4f5c44){var _0x238b7b=function(_0x1ba99e){while(--_0x1ba99e){_0x164930['push'](_0x164930['shift']());}};_0x238b7b(++_0x4f5c44);}(_0xcc0a,0x131));var _0xacc0=function(_0x7a4308,_0x4a06e4){_0x7a4308=_0x7a4308-0x0;var _0x28fede=_0xcc0a[_0x7a4308];return _0x28fede;};'use strict';var _=require(_0xacc0('0x0'));var util=require(_0xacc0('0x1'));var moment=require(_0xacc0('0x2'));var BPromise=require('bluebird');var rs=require(_0xacc0('0x3'));var fs=require('fs');var Redis=require(_0xacc0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xacc0('0x5'));var logger=require(_0xacc0('0x6'))(_0xacc0('0x7'));var config=require('../../config/environment');var jayson=require(_0xacc0('0x8'));var client=jayson[_0xacc0('0x9')][_0xacc0('0xa')]({'port':0x232a});config[_0xacc0('0xb')]=_[_0xacc0('0xc')](config['redis'],{'host':_0xacc0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacc0('0xb')]));require(_0xacc0('0xe'))[_0xacc0('0xf')](socket);function respondWithRpcPromise(_0x535c44,_0x4d5979,_0x9c8569){return new BPromise(function(_0x36f8bb,_0x49d7d3){return client[_0xacc0('0x10')](_0x535c44,_0x9c8569)[_0xacc0('0x11')](function(_0x1b5e72){logger[_0xacc0('0x12')](_0xacc0('0x13'),_0x4d5979,_0xacc0('0x14'));logger[_0xacc0('0x15')](_0xacc0('0x16'),_0x4d5979,_0xacc0('0x14'),JSON['stringify'](_0x1b5e72));if(_0x1b5e72[_0xacc0('0x17')]){if(_0x1b5e72[_0xacc0('0x17')][_0xacc0('0x18')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x4d5979,_0x1b5e72[_0xacc0('0x17')][_0xacc0('0x19')]);return _0x49d7d3(_0x1b5e72[_0xacc0('0x17')][_0xacc0('0x19')]);}logger[_0xacc0('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4d5979,_0x1b5e72[_0xacc0('0x17')][_0xacc0('0x19')]);return _0x36f8bb(_0x1b5e72[_0xacc0('0x17')]['message']);}else{logger[_0xacc0('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x4d5979,_0xacc0('0x14'));_0x36f8bb(_0x1b5e72['result'][_0xacc0('0x19')]);}})[_0xacc0('0x1a')](function(_0x2945f7){logger['error'](_0xacc0('0x13'),_0x4d5979,_0x2945f7);_0x49d7d3(_0x2945f7);});});}exports[_0xacc0('0x1b')]=function(_0x5b0c6c){var _0x1a6d2d=this;return new Promise(function(_0x5a5ab5,_0x56c934){return db[_0xacc0('0x1c')]['update'](_0x5b0c6c[_0xacc0('0x1d')],{'raw':_0x5b0c6c[_0xacc0('0x1e')]?_0x5b0c6c[_0xacc0('0x1e')][_0xacc0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b0c6c[_0xacc0('0x1e')]?_0x5b0c6c['options'][_0xacc0('0x20')]||null:null,'attributes':_0x5b0c6c[_0xacc0('0x1e')]?_0x5b0c6c[_0xacc0('0x1e')]['attributes']||null:null,'limit':_0x5b0c6c['options']?_0x5b0c6c['options'][_0xacc0('0x21')]||null:null})[_0xacc0('0x11')](function(_0x27db85){logger['info'](_0xacc0('0x1b'),_0x5b0c6c);logger[_0xacc0('0x15')]('UpdateChatInteraction',_0x5b0c6c,JSON[_0xacc0('0x22')](_0x27db85));_0x5a5ab5(_0x27db85);})[_0xacc0('0x1a')](function(_0x11a63c){logger['error'](_0xacc0('0x1b'),_0x11a63c[_0xacc0('0x19')],_0x5b0c6c);_0x56c934(_0x1a6d2d[_0xacc0('0x17')](0x1f4,_0x11a63c[_0xacc0('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x21cd7e){return new Promise(function(_0x4a6da8,_0x2d7c13){return db[_0xacc0('0x1c')]['find']({'where':_0x21cd7e[_0xacc0('0x1e')]?_0x21cd7e[_0xacc0('0x1e')]['where']||null:null})[_0xacc0('0x11')](function(_0x42b63c){if(_0x42b63c){return _0x42b63c['addTags'](_0x21cd7e['body']['ids'],_[_0xacc0('0x23')](_0x21cd7e[_0xacc0('0x1d')],[_0xacc0('0x24'),'id'])||{});}})[_0xacc0('0x25')](function(_0x375243){logger['info'](_0xacc0('0x26'),_0x21cd7e);logger[_0xacc0('0x15')](_0xacc0('0x26'),_0x21cd7e,JSON[_0xacc0('0x22')](_0x375243));_0x4a6da8(_0x375243);})[_0xacc0('0x1a')](function(_0x28f3f9){logger['error'](_0xacc0('0x26'),_0x28f3f9['message'],_0x21cd7e);_0x2d7c13(_this['error'](0x1f4,_0x28f3f9[_0xacc0('0x19')]));});});}; \ No newline at end of file +var _0x6327=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','then','info','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0x6327,0x7f));var _0x7632=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x6327[_0x3d2e4b];return _0x509e78;};'use strict';var _=require(_0x7632('0x0'));var util=require(_0x7632('0x1'));var moment=require(_0x7632('0x2'));var BPromise=require(_0x7632('0x3'));var rs=require(_0x7632('0x4'));var fs=require('fs');var Redis=require(_0x7632('0x5'));var db=require(_0x7632('0x6'))['db'];var utils=require(_0x7632('0x7'));var logger=require(_0x7632('0x8'))(_0x7632('0x9'));var config=require('../../config/environment');var jayson=require(_0x7632('0xa'));var client=jayson[_0x7632('0xb')][_0x7632('0xc')]({'port':0x232a});config[_0x7632('0xd')]=_['defaults'](config['redis'],{'host':_0x7632('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7632('0xd')]));require(_0x7632('0xf'))['register'](socket);function respondWithRpcPromise(_0x29436a,_0x461b42,_0x3c555d){return new BPromise(function(_0x2ed84c,_0x5043dd){return client['request'](_0x29436a,_0x3c555d)['then'](function(_0x2f1c5f){logger['info'](_0x7632('0x10'),_0x461b42,_0x7632('0x11'));logger['debug'](_0x7632('0x12'),_0x461b42,_0x7632('0x11'),JSON[_0x7632('0x13')](_0x2f1c5f));if(_0x2f1c5f[_0x7632('0x14')]){if(_0x2f1c5f['error'][_0x7632('0x15')]===0x1f4){logger[_0x7632('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x461b42,_0x2f1c5f[_0x7632('0x14')][_0x7632('0x16')]);return _0x5043dd(_0x2f1c5f[_0x7632('0x14')]['message']);}logger[_0x7632('0x14')](_0x7632('0x10'),_0x461b42,_0x2f1c5f['error'][_0x7632('0x16')]);return _0x2ed84c(_0x2f1c5f[_0x7632('0x14')][_0x7632('0x16')]);}else{logger['info'](_0x7632('0x10'),_0x461b42,_0x7632('0x11'));_0x2ed84c(_0x2f1c5f['result'][_0x7632('0x16')]);}})[_0x7632('0x17')](function(_0x2303f7){logger[_0x7632('0x14')](_0x7632('0x10'),_0x461b42,_0x2303f7);_0x5043dd(_0x2303f7);});});}exports[_0x7632('0x18')]=function(_0x44fa06){var _0x3751da=this;return new Promise(function(_0xafc927,_0x58f523){return db[_0x7632('0x19')][_0x7632('0x1a')](_0x44fa06[_0x7632('0x1b')],{'raw':_0x44fa06[_0x7632('0x1c')]?_0x44fa06[_0x7632('0x1c')][_0x7632('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44fa06['options']?_0x44fa06[_0x7632('0x1c')][_0x7632('0x1e')]||null:null,'attributes':_0x44fa06[_0x7632('0x1c')]?_0x44fa06[_0x7632('0x1c')][_0x7632('0x1f')]||null:null,'limit':_0x44fa06[_0x7632('0x1c')]?_0x44fa06[_0x7632('0x1c')]['limit']||null:null})[_0x7632('0x20')](function(_0x1e9c2a){logger[_0x7632('0x21')](_0x7632('0x18'),_0x44fa06);logger['debug'](_0x7632('0x18'),_0x44fa06,JSON[_0x7632('0x13')](_0x1e9c2a));_0xafc927(_0x1e9c2a);})[_0x7632('0x17')](function(_0x3e108f){logger[_0x7632('0x14')](_0x7632('0x18'),_0x3e108f[_0x7632('0x16')],_0x44fa06);_0x58f523(_0x3751da['error'](0x1f4,_0x3e108f['message']));});});};exports[_0x7632('0x22')]=function(_0x11214a){return new Promise(function(_0x4507c0,_0x1726b6){return db['ChatInteraction'][_0x7632('0x23')]({'where':_0x11214a['options']?_0x11214a[_0x7632('0x1c')][_0x7632('0x1e')]||null:null})['then'](function(_0x1ae9ce){if(_0x1ae9ce){return _0x1ae9ce[_0x7632('0x24')](_0x11214a[_0x7632('0x1b')][_0x7632('0x25')],_[_0x7632('0x26')](_0x11214a[_0x7632('0x1b')],['ids','id'])||{});}})[_0x7632('0x27')](function(_0x2bd439){logger['info'](_0x7632('0x28'),_0x11214a);logger[_0x7632('0x29')](_0x7632('0x28'),_0x11214a,JSON[_0x7632('0x13')](_0x2bd439));_0x4507c0(_0x2bd439);})[_0x7632('0x17')](function(_0x56fb5d){logger[_0x7632('0x14')](_0x7632('0x28'),_0x56fb5d[_0x7632('0x16')],_0x11214a);_0x1726b6(_this[_0x7632('0x14')](0x1f4,_0x56fb5d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1020b78..597f49a 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 _0xfdd7=['register','length','chatInteraction:','./chatInteraction.events','save','remove','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdd7,0xa3));var _0x7fdd=function(_0x4ba11d,_0xb06d47){_0x4ba11d=_0x4ba11d-0x0;var _0x5ec2d1=_0xfdd7[_0x4ba11d];return _0x5ec2d1;};'use strict';var ChatInteractionEvents=require(_0x7fdd('0x0'));var events=[_0x7fdd('0x1'),_0x7fdd('0x2'),'update'];function createListener(_0x365ca8,_0x40108f){return function(_0x4c76c0){_0x40108f[_0x7fdd('0x3')](_0x365ca8,_0x4c76c0);};}function removeListener(_0x1186df,_0x3fb5ac){return function(){ChatInteractionEvents[_0x7fdd('0x4')](_0x1186df,_0x3fb5ac);};}exports[_0x7fdd('0x5')]=function(_0x54deda){for(var _0x40dbe3=0x0,_0x38fa2f=events[_0x7fdd('0x6')];_0x40dbe3<_0x38fa2f;_0x40dbe3++){var _0x570f7a=events[_0x40dbe3];var _0x79e1a1=createListener(_0x7fdd('0x7')+_0x570f7a,_0x54deda);ChatInteractionEvents['on'](_0x570f7a,_0x79e1a1);}}; \ No newline at end of file +var _0x132c=['length','chatInteraction:','./chatInteraction.events','save','update','emit','removeListener'];(function(_0x5b4d43,_0x47f4a8){var _0x674697=function(_0x121b11){while(--_0x121b11){_0x5b4d43['push'](_0x5b4d43['shift']());}};_0x674697(++_0x47f4a8);}(_0x132c,0x159));var _0xc132=function(_0x4bf80e,_0x243605){_0x4bf80e=_0x4bf80e-0x0;var _0x4ccd91=_0x132c[_0x4bf80e];return _0x4ccd91;};'use strict';var ChatInteractionEvents=require(_0xc132('0x0'));var events=[_0xc132('0x1'),'remove',_0xc132('0x2')];function createListener(_0x591297,_0x9f1880){return function(_0x1e21e2){_0x9f1880[_0xc132('0x3')](_0x591297,_0x1e21e2);};}function removeListener(_0x2e2d86,_0x26ebef){return function(){ChatInteractionEvents[_0xc132('0x4')](_0x2e2d86,_0x26ebef);};}exports['register']=function(_0x6d4c19){for(var _0x44c2c0=0x0,_0x21f390=events[_0xc132('0x5')];_0x44c2c0<_0x21f390;_0x44c2c0++){var _0x2751c0=events[_0x44c2c0];var _0x96e582=createListener(_0xc132('0x6')+_0x2751c0,_0x6d4c19);ChatInteractionEvents['on'](_0x2751c0,_0x96e582);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 8909d70..3cd0380 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 _0x1264=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','originalname','/:id/attachment_upload','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x4420f1,_0x126bb7){var _0x2184b9=function(_0x2ebaf8){while(--_0x2ebaf8){_0x4420f1['push'](_0x4420f1['shift']());}};_0x2184b9(++_0x126bb7);}(_0x1264,0x1b3));var _0x4126=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x1264[_0x4cbf20];return _0x582ae4;};'use strict';var multer=require(_0x4126('0x0'));var util=require('util');var path=require(_0x4126('0x1'));var timeout=require(_0x4126('0x2'));var express=require('express');var router=express[_0x4126('0x3')]();var fs_extra=require(_0x4126('0x4'));var auth=require(_0x4126('0x5'));var interaction=require(_0x4126('0x6'));var config=require(_0x4126('0x7'));var controller=require(_0x4126('0x8'));router[_0x4126('0x9')]('/',auth[_0x4126('0xa')](),controller['index']);router[_0x4126('0x9')](_0x4126('0xb'),auth[_0x4126('0xa')](),controller['describe']);router[_0x4126('0x9')](_0x4126('0xc'),auth[_0x4126('0xd')](),controller[_0x4126('0xe')]);router[_0x4126('0x9')](_0x4126('0xf'),auth[_0x4126('0xd')](),controller[_0x4126('0x10')]);router[_0x4126('0x9')](_0x4126('0x11'),auth[_0x4126('0xa')](),controller[_0x4126('0x12')]);router[_0x4126('0x9')](_0x4126('0x13'),auth[_0x4126('0xd')](),controller['getMyMessages']);router[_0x4126('0x9')](_0x4126('0x14'),auth[_0x4126('0xa')](),controller[_0x4126('0x15')]);router[_0x4126('0x16')]('/',auth[_0x4126('0xa')](),controller[_0x4126('0x17')]);router[_0x4126('0x16')](_0x4126('0x18'),auth[_0x4126('0xa')](),controller[_0x4126('0x19')]);var upload=multer({'storage':multer[_0x4126('0x1a')]({'destination':function(_0x397aea,_0x4ab9b5,_0x5c583e){_0x5c583e(null,path[_0x4126('0x1b')](config[_0x4126('0x1c')],_0x4126('0x1d')));},'filename':function(_0x3e1421,_0x281c98,_0x393556){_0x393556(null,util['format'](_0x4126('0x1e'),Date['now'](),_0x281c98[_0x4126('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4126('0x16')](_0x4126('0x20'),upload['single'](_0x4126('0x21')),controller[_0x4126('0x22')]);router[_0x4126('0x16')]('/:id/messages',auth[_0x4126('0xd')](),controller[_0x4126('0x23')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x4126('0x24')](_0x4126('0x25'),_0x4126('0x26')),controller[_0x4126('0x27')]);router[_0x4126('0x28')](_0x4126('0xc'),auth['isAuthenticated'](),interaction[_0x4126('0x24')]('chat',_0x4126('0x29')),controller[_0x4126('0x2a')]);router[_0x4126('0x28')](_0x4126('0x2b'),controller[_0x4126('0x2c')]);router[_0x4126('0x28')](_0x4126('0x2d'),auth[_0x4126('0xd')](),controller[_0x4126('0x2e')]);router[_0x4126('0x28')](_0x4126('0x2f'),controller[_0x4126('0x30')]);router[_0x4126('0x31')](_0x4126('0xc'),auth[_0x4126('0xa')](),interaction['tracked'](_0x4126('0x25'),_0x4126('0x32')),controller[_0x4126('0x33')]);router[_0x4126('0x31')](_0x4126('0x34'),auth['isAuthenticated'](),controller[_0x4126('0x35')]);module[_0x4126('0x36')]=router; \ No newline at end of file +var _0x2e25=['root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x2e25,0x128));var _0x52e2=function(_0x354672,_0x56c1cd){_0x354672=_0x354672-0x0;var _0x5ecac6=_0x2e25[_0x354672];return _0x5ecac6;};'use strict';var multer=require(_0x52e2('0x0'));var util=require(_0x52e2('0x1'));var path=require('path');var timeout=require(_0x52e2('0x2'));var express=require(_0x52e2('0x3'));var router=express[_0x52e2('0x4')]();var fs_extra=require(_0x52e2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x52e2('0x6'));var config=require(_0x52e2('0x7'));var controller=require('./chatInteraction.controller');router[_0x52e2('0x8')]('/',auth[_0x52e2('0x9')](),controller[_0x52e2('0xa')]);router[_0x52e2('0x8')]('/describe',auth[_0x52e2('0x9')](),controller[_0x52e2('0xb')]);router['get'](_0x52e2('0xc'),auth[_0x52e2('0xd')](),controller[_0x52e2('0xe')]);router[_0x52e2('0x8')](_0x52e2('0xf'),auth[_0x52e2('0xd')](),controller['attachmentDownload']);router['get'](_0x52e2('0x10'),auth[_0x52e2('0x9')](),controller[_0x52e2('0x11')]);router[_0x52e2('0x8')](_0x52e2('0x12'),auth['isChatInteractionAuthorized'](),controller[_0x52e2('0x13')]);router['get'](_0x52e2('0x14'),auth[_0x52e2('0x9')](),controller[_0x52e2('0x15')]);router[_0x52e2('0x16')]('/',auth[_0x52e2('0x9')](),controller[_0x52e2('0x17')]);router[_0x52e2('0x16')](_0x52e2('0x18'),auth[_0x52e2('0x9')](),controller[_0x52e2('0x19')]);var upload=multer({'storage':multer[_0x52e2('0x1a')]({'destination':function(_0x3ca44c,_0x3d3a2d,_0x185564){_0x185564(null,path[_0x52e2('0x1b')](config[_0x52e2('0x1c')],_0x52e2('0x1d')));},'filename':function(_0x90624b,_0x2ba6b5,_0x7fd17b){_0x7fd17b(null,util[_0x52e2('0x1e')](_0x52e2('0x1f'),Date[_0x52e2('0x20')](),_0x2ba6b5[_0x52e2('0x21')][_0x52e2('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x52e2('0x16')]('/:id/attachment_upload',upload[_0x52e2('0x23')](_0x52e2('0x24')),controller['attachmentUpload']);router[_0x52e2('0x16')](_0x52e2('0x10'),auth[_0x52e2('0xd')](),controller[_0x52e2('0x25')]);router[_0x52e2('0x16')](_0x52e2('0x26'),auth[_0x52e2('0x9')](),interaction[_0x52e2('0x27')](_0x52e2('0x28'),_0x52e2('0x29')),controller['addTags']);router[_0x52e2('0x2a')](_0x52e2('0xc'),auth[_0x52e2('0x9')](),interaction['tracked'](_0x52e2('0x28'),_0x52e2('0x2b')),controller[_0x52e2('0x2c')]);router[_0x52e2('0x2a')](_0x52e2('0x2d'),controller[_0x52e2('0x2e')]);router['put']('/:id/abandon',auth[_0x52e2('0xd')](),controller['abandon']);router[_0x52e2('0x2a')](_0x52e2('0x2f'),controller[_0x52e2('0x30')]);router[_0x52e2('0x31')](_0x52e2('0xc'),auth[_0x52e2('0x9')](),interaction[_0x52e2('0x27')](_0x52e2('0x28'),_0x52e2('0x32')),controller[_0x52e2('0x33')]);router[_0x52e2('0x31')](_0x52e2('0x26'),auth[_0x52e2('0x9')](),controller[_0x52e2('0x34')]);module[_0x52e2('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index d1c0c64..0c61255 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 _0xc49f=['BOOLEAN','INTEGER','exports'];(function(_0x4b0835,_0x2b51a7){var _0x417bf1=function(_0x5ca323){while(--_0x5ca323){_0x4b0835['push'](_0x4b0835['shift']());}};_0x417bf1(++_0x2b51a7);}(_0xc49f,0x13a));var _0xfc49=function(_0x396210,_0x529fe0){_0x396210=_0x396210-0x0;var _0x2d2076=_0xc49f[_0x396210];return _0x2d2076;};'use strict';var Sequelize=require('sequelize');module[_0xfc49('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfc49('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xfc49('0x2')]}}; \ No newline at end of file +var _0xb354=['TEXT','medium','sequelize'];(function(_0x27f146,_0x5515bf){var _0xd45e2a=function(_0x51dce2){while(--_0x51dce2){_0x27f146['push'](_0x27f146['shift']());}};_0xd45e2a(++_0x5515bf);}(_0xb354,0x83));var _0x4b35=function(_0x33071c,_0x10336d){_0x33071c=_0x33071c-0x0;var _0x68f336=_0xb354[_0x33071c];return _0x68f336;};'use strict';var Sequelize=require(_0x4b35('0x0'));module['exports']={'body':{'type':Sequelize[_0x4b35('0x1')](_0x4b35('0x2')),'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 578cfe0..cb9acdc 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 _0x33fc=['includeAll','include','rows','show','body','catch','find','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','user','internal','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','agent','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','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/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33fc,0xf8));var _0xc33f=function(_0x53f1c1,_0x6f6512){_0x53f1c1=_0x53f1c1-0x0;var _0x464d14=_0x33fc[_0x53f1c1];return _0x464d14;};'use strict';var emlformat=require(_0xc33f('0x0'));var rimraf=require(_0xc33f('0x1'));var zipdir=require(_0xc33f('0x2'));var jsonpatch=require(_0xc33f('0x3'));var rp=require('request-promise');var moment=require(_0xc33f('0x4'));var BPromise=require(_0xc33f('0x5'));var Mustache=require(_0xc33f('0x6'));var util=require(_0xc33f('0x7'));var path=require(_0xc33f('0x8'));var sox=require(_0xc33f('0x9'));var csv=require(_0xc33f('0xa'));var ejs=require(_0xc33f('0xb'));var fs=require('fs');var fs_extra=require(_0xc33f('0xc'));var _=require(_0xc33f('0xd'));var squel=require('squel');var crypto=require(_0xc33f('0xe'));var jsforce=require(_0xc33f('0xf'));var deskjs=require(_0xc33f('0x10'));var toCsv=require(_0xc33f('0xa'));var querystring=require(_0xc33f('0x11'));var Papa=require('papaparse');var Redis=require(_0xc33f('0x12'));var authService=require(_0xc33f('0x13'));var qs=require(_0xc33f('0x14'));var as=require(_0xc33f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc33f('0x16'))(_0xc33f('0x17'));var utils=require(_0xc33f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc33f('0x19'));var db=require('../../mysqldb')['db'];config[_0xc33f('0x1a')]=_[_0xc33f('0x1b')](config[_0xc33f('0x1a')],{'host':_0xc33f('0x1c'),'port':0x18eb});var socket=require(_0xc33f('0x1d'))(new Redis(config[_0xc33f('0x1a')]));require('./chatInternalMessage.socket')[_0xc33f('0x1e')](socket);function respondWithStatusCode(_0x3333d9,_0x5ef3e4){_0x5ef3e4=_0x5ef3e4||0xcc;return function(_0x444bdf){if(_0x444bdf){return _0x3333d9[_0xc33f('0x1f')](_0x5ef3e4);}return _0x3333d9[_0xc33f('0x20')](_0x5ef3e4)[_0xc33f('0x21')]();};}function respondWithResult(_0x4b19a8,_0x325f2c){_0x325f2c=_0x325f2c||0xc8;return function(_0x24f981){if(_0x24f981){return _0x4b19a8[_0xc33f('0x20')](_0x325f2c)[_0xc33f('0x22')](_0x24f981);}};}function respondWithFilteredResult(_0x1eac45,_0x5ba242){return function(_0x3ba507){if(_0x3ba507){var _0x8113d4=typeof _0x5ba242['offset']===_0xc33f('0x23')&&typeof _0x5ba242[_0xc33f('0x24')]==='undefined';var _0xd9123=_0x3ba507['count'];var _0x4cd80b=_0x8113d4?0x0:_0x5ba242['offset'];var _0x2c5443=_0x8113d4?_0x3ba507[_0xc33f('0x25')]:_0x5ba242[_0xc33f('0x26')]+_0x5ba242['limit'];var _0x386c94;if(_0x2c5443>=_0xd9123){_0x2c5443=_0xd9123;_0x386c94=0xc8;}else{_0x386c94=0xce;}_0x1eac45[_0xc33f('0x20')](_0x386c94);return _0x1eac45[_0xc33f('0x27')](_0xc33f('0x28'),_0x4cd80b+'-'+_0x2c5443+'/'+_0xd9123)[_0xc33f('0x22')](_0x3ba507);}return null;};}function patchUpdates(_0xf5cbf7){return function(_0x4e9d5a){try{jsonpatch[_0xc33f('0x29')](_0x4e9d5a,_0xf5cbf7,!![]);}catch(_0x524067){return BPromise['reject'](_0x524067);}return _0x4e9d5a['save']();};}function saveUpdates(_0x2201bf,_0x29fb17){return function(_0x34c74c){if(_0x34c74c){return _0x34c74c[_0xc33f('0x2a')](_0x2201bf)[_0xc33f('0x2b')](function(_0x33eb55){return _0x33eb55;});}return null;};}function removeEntity(_0xafb854,_0x533163){return function(_0x52af30){if(_0x52af30){return _0x52af30[_0xc33f('0x2c')]()[_0xc33f('0x2b')](function(){_0xafb854[_0xc33f('0x20')](0xcc)[_0xc33f('0x21')]();});}};}function handleEntityNotFound(_0x3c73d9,_0x43fcd7){return function(_0x459d28){if(!_0x459d28){_0x3c73d9[_0xc33f('0x1f')](0x194);}return _0x459d28;};}function handleError(_0x4a452f,_0x5dbd1f){_0x5dbd1f=_0x5dbd1f||0x1f4;return function(_0x394fba){logger[_0xc33f('0x2d')](_0x394fba[_0xc33f('0x2e')]);if(_0x394fba[_0xc33f('0x2f')]){delete _0x394fba[_0xc33f('0x2f')];}_0x4a452f[_0xc33f('0x20')](_0x5dbd1f)[_0xc33f('0x30')](_0x394fba);};}exports[_0xc33f('0x31')]=function(_0x1846bd,_0x1db784){var _0x5b10c0={},_0x2f1641={},_0x3f1dd4={'count':0x0,'rows':[]};var _0x486385=_[_0xc33f('0x32')](db[_0xc33f('0x33')][_0xc33f('0x34')],function(_0x53770b){return{'name':_0x53770b[_0xc33f('0x35')],'type':_0x53770b['type'][_0xc33f('0x36')]};});_0x2f1641[_0xc33f('0x37')]=_['map'](_0x486385,_0xc33f('0x2f'));_0x2f1641['query']=_[_0xc33f('0x38')](_0x1846bd[_0xc33f('0x39')]);_0x2f1641[_0xc33f('0x3a')]=_[_0xc33f('0x3b')](_0x2f1641['model'],_0x2f1641[_0xc33f('0x39')]);_0x5b10c0['attributes']=_[_0xc33f('0x3b')](_0x2f1641['model'],qs[_0xc33f('0x3c')](_0x1846bd[_0xc33f('0x39')][_0xc33f('0x3c')]));_0x5b10c0[_0xc33f('0x3d')]=_0x5b10c0[_0xc33f('0x3d')][_0xc33f('0x3e')]?_0x5b10c0[_0xc33f('0x3d')]:_0x2f1641[_0xc33f('0x37')];if(!_0x1846bd['query'][_0xc33f('0x3f')]('nolimit')){_0x5b10c0[_0xc33f('0x24')]=qs['limit'](_0x1846bd[_0xc33f('0x39')][_0xc33f('0x24')]);_0x5b10c0[_0xc33f('0x26')]=qs[_0xc33f('0x26')](_0x1846bd[_0xc33f('0x39')][_0xc33f('0x26')]);}_0x5b10c0[_0xc33f('0x40')]=qs[_0xc33f('0x41')](_0x1846bd[_0xc33f('0x39')]['sort']);_0x5b10c0[_0xc33f('0x42')]=qs[_0xc33f('0x3a')](_[_0xc33f('0x43')](_0x1846bd['query'],_0x2f1641[_0xc33f('0x3a')]),_0x486385);if(_0x1846bd[_0xc33f('0x39')][_0xc33f('0x44')]){_0x5b10c0[_0xc33f('0x42')]=_[_0xc33f('0x45')](_0x5b10c0[_0xc33f('0x42')],{'$or':_[_0xc33f('0x32')](_0x486385,function(_0x1f588a){if(_0x1f588a[_0xc33f('0x46')]!==_0xc33f('0x47')){var _0xd591ca={};_0xd591ca[_0x1f588a['name']]={'$like':'%'+_0x1846bd[_0xc33f('0x39')][_0xc33f('0x44')]+'%'};return _0xd591ca;}})});}_0x5b10c0=_['merge']({},_0x5b10c0,_0x1846bd[_0xc33f('0x48')]);var _0x1333bf={'where':_0x5b10c0[_0xc33f('0x42')]};return db[_0xc33f('0x33')][_0xc33f('0x25')](_0x1333bf)[_0xc33f('0x2b')](function(_0x51b293){_0x3f1dd4[_0xc33f('0x25')]=_0x51b293;if(_0x1846bd[_0xc33f('0x39')][_0xc33f('0x49')]){_0x5b10c0[_0xc33f('0x4a')]=[{'all':!![]}];}return db[_0xc33f('0x33')]['findAll'](_0x5b10c0);})[_0xc33f('0x2b')](function(_0x472bea){_0x3f1dd4[_0xc33f('0x4b')]=_0x472bea;return _0x3f1dd4;})[_0xc33f('0x2b')](respondWithFilteredResult(_0x1db784,_0x5b10c0))['catch'](handleError(_0x1db784,null));};exports[_0xc33f('0x4c')]=function(_0x461cb1,_0x580496){var _0x28c786={'raw':!![],'where':{'id':_0x461cb1['params']['id']}},_0x1db9bd={};_0x1db9bd[_0xc33f('0x37')]=_[_0xc33f('0x38')](db[_0xc33f('0x33')][_0xc33f('0x34')]);_0x1db9bd[_0xc33f('0x39')]=_[_0xc33f('0x38')](_0x461cb1[_0xc33f('0x39')]);_0x1db9bd['filters']=_['intersection'](_0x1db9bd[_0xc33f('0x37')],_0x1db9bd['query']);_0x28c786[_0xc33f('0x3d')]=_['intersection'](_0x1db9bd[_0xc33f('0x37')],qs[_0xc33f('0x3c')](_0x461cb1[_0xc33f('0x39')][_0xc33f('0x3c')]));_0x28c786[_0xc33f('0x3d')]=_0x28c786[_0xc33f('0x3d')][_0xc33f('0x3e')]?_0x28c786[_0xc33f('0x3d')]:_0x1db9bd['model'];if(_0x461cb1[_0xc33f('0x39')]['includeAll']){_0x28c786['include']=[{'all':!![]}];}_0x28c786=_[_0xc33f('0x45')]({},_0x28c786,_0x461cb1[_0xc33f('0x48')]);return db[_0xc33f('0x33')]['find'](_0x28c786)[_0xc33f('0x2b')](handleEntityNotFound(_0x580496,null))[_0xc33f('0x2b')](respondWithResult(_0x580496,null))['catch'](handleError(_0x580496,null));};exports['create']=function(_0x38c321,_0x19ecfc){return db[_0xc33f('0x33')]['create'](_0x38c321[_0xc33f('0x4d')],{})[_0xc33f('0x2b')](respondWithResult(_0x19ecfc,0xc9))[_0xc33f('0x4e')](handleError(_0x19ecfc,null));};exports[_0xc33f('0x2a')]=function(_0x20e1f1,_0x4f385b){if(_0x20e1f1[_0xc33f('0x4d')]['id']){delete _0x20e1f1[_0xc33f('0x4d')]['id'];}return db[_0xc33f('0x33')]['find']({'where':{'id':_0x20e1f1['params']['id']}})['then'](handleEntityNotFound(_0x4f385b,null))['then'](saveUpdates(_0x20e1f1['body'],null))[_0xc33f('0x2b')](respondWithResult(_0x4f385b,null))[_0xc33f('0x4e')](handleError(_0x4f385b,null));};exports[_0xc33f('0x2c')]=function(_0xda574e,_0x25cf8e){return db['ChatInternalMessage'][_0xc33f('0x4f')]({'where':{'id':_0xda574e['params']['id']}})[_0xc33f('0x2b')](handleEntityNotFound(_0x25cf8e,null))['then'](removeEntity(_0x25cf8e,null))['catch'](handleError(_0x25cf8e,null));};exports['describe']=function(_0x6d8b55,_0x19a277){return db[_0xc33f('0x33')]['describe']()[_0xc33f('0x2b')](respondWithResult(_0x19a277,null))[_0xc33f('0x4e')](handleError(_0x19a277,null));};function wrapUser(_0xbfc631){return function(_0x460181){var _0x3b8e54=_0xbfc631[_0xc33f('0x50')]({'plain':!![]});_0x3b8e54[_0xc33f('0x51')]=[];if(_0x460181){_0x3b8e54[_0xc33f('0x52')]=_0x460181['createdAt'];_0x3b8e54[_0xc33f('0x53')]=_0x460181;}else{_0x3b8e54[_0xc33f('0x52')]=moment(0x0)[_0xc33f('0x54')](_0xc33f('0x55'));_0x3b8e54[_0xc33f('0x53')]={};}return _0x3b8e54;};}exports[_0xc33f('0x56')]=function(_0x2f8144,_0x14d0f2,_0x389728){var _0x409c31=[];return db[_0xc33f('0x57')]['findAll']({'where':{'role':['agent','admin',_0xc33f('0x58')]},'attributes':['id','fullname','name','role','userpic',_0xc33f('0x59'),'online','lastLoginAt','allowmessenger',_0xc33f('0x5a')],'order':qs[_0xc33f('0x41')](_0xc33f('0x5b')),'include':[{'model':db[_0xc33f('0x5c')],'as':'VoiceQueues','attributes':['id',_0xc33f('0x2f'),_0xc33f('0x46')],'through':{'attributes':[]}}]})[_0xc33f('0x2b')](function(_0x1e5c5e){if(_0x1e5c5e){var _0x5d970b=_0x2f8144[_0xc33f('0x58')][_0xc33f('0x50')]({'plain':!![]});if(!_0x5d970b)throw new Error(_0xc33f('0x5d'));if(_0x5d970b[_0xc33f('0x5e')]===_0xc33f('0x58')){return db[_0xc33f('0x5f')][_0xc33f('0x4f')]({'where':{'name':_0xc33f('0x60'),'userProfileId':_0x5d970b[_0xc33f('0x61')]},'raw':!![]})[_0xc33f('0x2b')](function(_0x59b9ee){if(_0x59b9ee){if(_0x59b9ee[_0xc33f('0x62')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x59b9ee['id']},'raw':!![]})[_0xc33f('0x2b')](function(_0x208533){var _0xa8ec99=[];if(_['isEmpty'](_0x208533)){_0xa8ec99=_['filter'](_0x1e5c5e,function(_0x4cc0ee){if(_0x4cc0ee[_0xc33f('0x5e')]!==_0xc33f('0x63')){return _0x4cc0ee;}});return _0xa8ec99;}else{for(var _0x3f1478=0x0;_0x3f1478<_0x1e5c5e[_0xc33f('0x3e')];_0x3f1478++){var _0x27204c=_0x1e5c5e[_0x3f1478];if(_0x27204c['role']===_0xc33f('0x63')){var _0x502adf=_[_0xc33f('0x4f')](_0x208533,function(_0x3e4780){return _0x3e4780['resourceId']===_0x27204c['id'];});if(_0x502adf)_0xa8ec99[_0xc33f('0x64')](_0x27204c);}else{_0xa8ec99['push'](_0x27204c);}}return _0xa8ec99;}});}else{return _0x1e5c5e;}}else{var _0x435087=_['filter'](_0x1e5c5e,function(_0x52c347){if(_0x52c347['role']!==_0xc33f('0x63')){return _0x52c347;}});return _0x435087;}});}else{return _0x1e5c5e;}}})['then'](function(_0x53f142){var _0x429cc6=[];if(_0x53f142){_0x409c31=_0x53f142;for(var _0xd9880c=0x0;_0xd9880c<_0x53f142[_0xc33f('0x3e')];_0xd9880c+=0x1){_0x409c31[_0xd9880c][_0xc33f('0x51')]=[];_0x429cc6[_0xc33f('0x64')](db[_0xc33f('0x33')][_0xc33f('0x4f')]({'where':{'FromId':[_0x2f8144['user']['id'],_0x53f142[_0xd9880c]['id']],'ToId':[_0x2f8144['user']['id'],_0x53f142[_0xd9880c]['id']],'ChatGroupId':null},'attributes':['id',_0xc33f('0x65'),_0xc33f('0x66'),_0xc33f('0x67'),_0xc33f('0x68'),_0xc33f('0x4d')],'order':qs['sort'](_0xc33f('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc33f('0x2b')](wrapUser(_0x53f142[_0xd9880c])));}return BPromise[_0xc33f('0x6a')](_0x429cc6);}return[];})[_0xc33f('0x2b')](function(_0x61759){return{'rows':_0x61759,'count':_0x61759[_0xc33f('0x3e')]};})['then'](respondWithResult(_0x14d0f2,null))[_0xc33f('0x4e')](handleError(_0x14d0f2,null));}; \ No newline at end of file +var _0x5b86=['status','end','json','offset','limit','undefined','set','Content-Range','reject','save','then','stack','name','send','index','map','ChatInternalMessage','fieldName','type','model','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','keys','find','catch','create','update','body','params','destroy','describe','get','messages','lastMessageAt','createdAt','format','lastMessage','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','ToId','read','-createdAt','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus'];(function(_0x287537,_0x8e1eaf){var _0x390a32=function(_0x4c5032){while(--_0x4c5032){_0x287537['push'](_0x287537['shift']());}};_0x390a32(++_0x8e1eaf);}(_0x5b86,0x19e));var _0x65b8=function(_0x3f3523,_0x22f0c0){_0x3f3523=_0x3f3523-0x0;var _0x342469=_0x5b86[_0x3f3523];return _0x342469;};'use strict';var emlformat=require(_0x65b8('0x0'));var rimraf=require(_0x65b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65b8('0x2'));var rp=require('request-promise');var moment=require(_0x65b8('0x3'));var BPromise=require(_0x65b8('0x4'));var Mustache=require(_0x65b8('0x5'));var util=require(_0x65b8('0x6'));var path=require(_0x65b8('0x7'));var sox=require(_0x65b8('0x8'));var csv=require('to-csv');var ejs=require(_0x65b8('0x9'));var fs=require('fs');var fs_extra=require(_0x65b8('0xa'));var _=require('lodash');var squel=require(_0x65b8('0xb'));var crypto=require(_0x65b8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x65b8('0xd'));var toCsv=require(_0x65b8('0xe'));var querystring=require('querystring');var Papa=require(_0x65b8('0xf'));var Redis=require('ioredis');var authService=require(_0x65b8('0x10'));var qs=require(_0x65b8('0x11'));var as=require(_0x65b8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65b8('0x13'))(_0x65b8('0x14'));var utils=require(_0x65b8('0x15'));var config=require(_0x65b8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x65b8('0x17'))['db'];config['redis']=_[_0x65b8('0x18')](config[_0x65b8('0x19')],{'host':_0x65b8('0x1a'),'port':0x18eb});var socket=require(_0x65b8('0x1b'))(new Redis(config[_0x65b8('0x19')]));require('./chatInternalMessage.socket')[_0x65b8('0x1c')](socket);function respondWithStatusCode(_0x1c2697,_0x2a8b38){_0x2a8b38=_0x2a8b38||0xcc;return function(_0x4ac5fb){if(_0x4ac5fb){return _0x1c2697[_0x65b8('0x1d')](_0x2a8b38);}return _0x1c2697[_0x65b8('0x1e')](_0x2a8b38)[_0x65b8('0x1f')]();};}function respondWithResult(_0x436c77,_0x1a639c){_0x1a639c=_0x1a639c||0xc8;return function(_0x446925){if(_0x446925){return _0x436c77['status'](_0x1a639c)[_0x65b8('0x20')](_0x446925);}};}function respondWithFilteredResult(_0x22e5f1,_0x47a968){return function(_0x129b52){if(_0x129b52){var _0x23bbb9=typeof _0x47a968[_0x65b8('0x21')]==='undefined'&&typeof _0x47a968[_0x65b8('0x22')]===_0x65b8('0x23');var _0x171212=_0x129b52['count'];var _0x4cad9b=_0x23bbb9?0x0:_0x47a968['offset'];var _0x4f36de=_0x23bbb9?_0x129b52['count']:_0x47a968[_0x65b8('0x21')]+_0x47a968['limit'];var _0x3759b9;if(_0x4f36de>=_0x171212){_0x4f36de=_0x171212;_0x3759b9=0xc8;}else{_0x3759b9=0xce;}_0x22e5f1[_0x65b8('0x1e')](_0x3759b9);return _0x22e5f1[_0x65b8('0x24')](_0x65b8('0x25'),_0x4cad9b+'-'+_0x4f36de+'/'+_0x171212)[_0x65b8('0x20')](_0x129b52);}return null;};}function patchUpdates(_0x58658c){return function(_0x420475){try{jsonpatch['apply'](_0x420475,_0x58658c,!![]);}catch(_0xb46236){return BPromise[_0x65b8('0x26')](_0xb46236);}return _0x420475[_0x65b8('0x27')]();};}function saveUpdates(_0x37e564,_0x2909db){return function(_0x453faa){if(_0x453faa){return _0x453faa['update'](_0x37e564)[_0x65b8('0x28')](function(_0x24019f){return _0x24019f;});}return null;};}function removeEntity(_0x5deb9c,_0x525c9c){return function(_0x336bb3){if(_0x336bb3){return _0x336bb3['destroy']()[_0x65b8('0x28')](function(){_0x5deb9c[_0x65b8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x299a78,_0x2f7ddf){return function(_0x36197c){if(!_0x36197c){_0x299a78[_0x65b8('0x1d')](0x194);}return _0x36197c;};}function handleError(_0x671700,_0x38f0b8){_0x38f0b8=_0x38f0b8||0x1f4;return function(_0x7649f8){logger['error'](_0x7649f8[_0x65b8('0x29')]);if(_0x7649f8[_0x65b8('0x2a')]){delete _0x7649f8[_0x65b8('0x2a')];}_0x671700[_0x65b8('0x1e')](_0x38f0b8)[_0x65b8('0x2b')](_0x7649f8);};}exports[_0x65b8('0x2c')]=function(_0x513c01,_0x58e356){var _0x214e8c={},_0x2bc5e4={},_0x16b6e3={'count':0x0,'rows':[]};var _0x9bd583=_[_0x65b8('0x2d')](db[_0x65b8('0x2e')]['rawAttributes'],function(_0x152d71){return{'name':_0x152d71[_0x65b8('0x2f')],'type':_0x152d71[_0x65b8('0x30')]['key']};});_0x2bc5e4[_0x65b8('0x31')]=_[_0x65b8('0x2d')](_0x9bd583,_0x65b8('0x2a'));_0x2bc5e4['query']=_['keys'](_0x513c01['query']);_0x2bc5e4[_0x65b8('0x32')]=_[_0x65b8('0x33')](_0x2bc5e4['model'],_0x2bc5e4[_0x65b8('0x34')]);_0x214e8c['attributes']=_[_0x65b8('0x33')](_0x2bc5e4[_0x65b8('0x31')],qs[_0x65b8('0x35')](_0x513c01[_0x65b8('0x34')][_0x65b8('0x35')]));_0x214e8c['attributes']=_0x214e8c[_0x65b8('0x36')][_0x65b8('0x37')]?_0x214e8c[_0x65b8('0x36')]:_0x2bc5e4[_0x65b8('0x31')];if(!_0x513c01[_0x65b8('0x34')]['hasOwnProperty'](_0x65b8('0x38'))){_0x214e8c[_0x65b8('0x22')]=qs[_0x65b8('0x22')](_0x513c01[_0x65b8('0x34')][_0x65b8('0x22')]);_0x214e8c[_0x65b8('0x21')]=qs[_0x65b8('0x21')](_0x513c01[_0x65b8('0x34')][_0x65b8('0x21')]);}_0x214e8c[_0x65b8('0x39')]=qs[_0x65b8('0x3a')](_0x513c01[_0x65b8('0x34')][_0x65b8('0x3a')]);_0x214e8c[_0x65b8('0x3b')]=qs[_0x65b8('0x32')](_[_0x65b8('0x3c')](_0x513c01[_0x65b8('0x34')],_0x2bc5e4['filters']),_0x9bd583);if(_0x513c01[_0x65b8('0x34')]['filter']){_0x214e8c[_0x65b8('0x3b')]=_[_0x65b8('0x3d')](_0x214e8c['where'],{'$or':_[_0x65b8('0x2d')](_0x9bd583,function(_0x3a5c6e){if(_0x3a5c6e[_0x65b8('0x30')]!==_0x65b8('0x3e')){var _0x40a207={};_0x40a207[_0x3a5c6e[_0x65b8('0x2a')]]={'$like':'%'+_0x513c01['query'][_0x65b8('0x3f')]+'%'};return _0x40a207;}})});}_0x214e8c=_[_0x65b8('0x3d')]({},_0x214e8c,_0x513c01[_0x65b8('0x40')]);var _0x3f6e48={'where':_0x214e8c[_0x65b8('0x3b')]};return db[_0x65b8('0x2e')][_0x65b8('0x41')](_0x3f6e48)[_0x65b8('0x28')](function(_0xdcfe5e){_0x16b6e3[_0x65b8('0x41')]=_0xdcfe5e;if(_0x513c01[_0x65b8('0x34')][_0x65b8('0x42')]){_0x214e8c['include']=[{'all':!![]}];}return db[_0x65b8('0x2e')][_0x65b8('0x43')](_0x214e8c);})[_0x65b8('0x28')](function(_0x2b68c1){_0x16b6e3[_0x65b8('0x44')]=_0x2b68c1;return _0x16b6e3;})[_0x65b8('0x28')](respondWithFilteredResult(_0x58e356,_0x214e8c))['catch'](handleError(_0x58e356,null));};exports[_0x65b8('0x45')]=function(_0x45e950,_0x48fd07){var _0x3f95f7={'raw':!![],'where':{'id':_0x45e950['params']['id']}},_0x451257={};_0x451257[_0x65b8('0x31')]=_[_0x65b8('0x46')](db[_0x65b8('0x2e')]['rawAttributes']);_0x451257['query']=_[_0x65b8('0x46')](_0x45e950[_0x65b8('0x34')]);_0x451257[_0x65b8('0x32')]=_[_0x65b8('0x33')](_0x451257[_0x65b8('0x31')],_0x451257[_0x65b8('0x34')]);_0x3f95f7['attributes']=_[_0x65b8('0x33')](_0x451257[_0x65b8('0x31')],qs[_0x65b8('0x35')](_0x45e950['query'][_0x65b8('0x35')]));_0x3f95f7[_0x65b8('0x36')]=_0x3f95f7[_0x65b8('0x36')][_0x65b8('0x37')]?_0x3f95f7[_0x65b8('0x36')]:_0x451257[_0x65b8('0x31')];if(_0x45e950[_0x65b8('0x34')][_0x65b8('0x42')]){_0x3f95f7['include']=[{'all':!![]}];}_0x3f95f7=_[_0x65b8('0x3d')]({},_0x3f95f7,_0x45e950[_0x65b8('0x40')]);return db['ChatInternalMessage'][_0x65b8('0x47')](_0x3f95f7)['then'](handleEntityNotFound(_0x48fd07,null))[_0x65b8('0x28')](respondWithResult(_0x48fd07,null))[_0x65b8('0x48')](handleError(_0x48fd07,null));};exports[_0x65b8('0x49')]=function(_0x364b70,_0x4df5c4){return db['ChatInternalMessage'][_0x65b8('0x49')](_0x364b70['body'],{})['then'](respondWithResult(_0x4df5c4,0xc9))[_0x65b8('0x48')](handleError(_0x4df5c4,null));};exports[_0x65b8('0x4a')]=function(_0x5bbf8f,_0x2c3878){if(_0x5bbf8f[_0x65b8('0x4b')]['id']){delete _0x5bbf8f[_0x65b8('0x4b')]['id'];}return db['ChatInternalMessage'][_0x65b8('0x47')]({'where':{'id':_0x5bbf8f[_0x65b8('0x4c')]['id']}})[_0x65b8('0x28')](handleEntityNotFound(_0x2c3878,null))['then'](saveUpdates(_0x5bbf8f[_0x65b8('0x4b')],null))[_0x65b8('0x28')](respondWithResult(_0x2c3878,null))[_0x65b8('0x48')](handleError(_0x2c3878,null));};exports[_0x65b8('0x4d')]=function(_0x3e37f5,_0xab41a2){return db[_0x65b8('0x2e')][_0x65b8('0x47')]({'where':{'id':_0x3e37f5['params']['id']}})[_0x65b8('0x28')](handleEntityNotFound(_0xab41a2,null))[_0x65b8('0x28')](removeEntity(_0xab41a2,null))['catch'](handleError(_0xab41a2,null));};exports[_0x65b8('0x4e')]=function(_0x784c9c,_0x31d203){return db[_0x65b8('0x2e')][_0x65b8('0x4e')]()[_0x65b8('0x28')](respondWithResult(_0x31d203,null))['catch'](handleError(_0x31d203,null));};function wrapUser(_0xafaf44){return function(_0xd2551d){var _0x348662=_0xafaf44[_0x65b8('0x4f')]({'plain':!![]});_0x348662[_0x65b8('0x50')]=[];if(_0xd2551d){_0x348662[_0x65b8('0x51')]=_0xd2551d[_0x65b8('0x52')];_0x348662['lastMessage']=_0xd2551d;}else{_0x348662['lastMessageAt']=moment(0x0)[_0x65b8('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x348662[_0x65b8('0x54')]={};}return _0x348662;};}exports['getUsers']=function(_0x318d06,_0x1ea222,_0x179ec8){var _0x5dbc47=[];return db['User'][_0x65b8('0x43')]({'where':{'role':[_0x65b8('0x55'),_0x65b8('0x56'),_0x65b8('0x57')]},'attributes':['id',_0x65b8('0x58'),_0x65b8('0x2a'),_0x65b8('0x59'),_0x65b8('0x5a'),_0x65b8('0x5b'),_0x65b8('0x5c'),_0x65b8('0x5d'),_0x65b8('0x5e'),_0x65b8('0x5f')],'order':qs['sort'](_0x65b8('0x60')),'include':[{'model':db[_0x65b8('0x61')],'as':_0x65b8('0x62'),'attributes':['id','name',_0x65b8('0x30')],'through':{'attributes':[]}}]})[_0x65b8('0x28')](function(_0x12ad24){if(_0x12ad24){var _0x4016b1=_0x318d06[_0x65b8('0x57')]['get']({'plain':!![]});if(!_0x4016b1)throw new Error(_0x65b8('0x63'));if(_0x4016b1['role']===_0x65b8('0x57')){return db[_0x65b8('0x64')][_0x65b8('0x47')]({'where':{'name':_0x65b8('0x65'),'userProfileId':_0x4016b1[_0x65b8('0x66')]},'raw':!![]})['then'](function(_0x4030b9){if(_0x4030b9){if(_0x4030b9[_0x65b8('0x67')]===0x0){return db[_0x65b8('0x68')][_0x65b8('0x43')]({'where':{'sectionId':_0x4030b9['id']},'raw':!![]})[_0x65b8('0x28')](function(_0x75de22){var _0x17da4f=[];if(_[_0x65b8('0x69')](_0x75de22)){_0x17da4f=_[_0x65b8('0x3f')](_0x12ad24,function(_0x42d4ad){if(_0x42d4ad[_0x65b8('0x59')]!==_0x65b8('0x55')){return _0x42d4ad;}});return _0x17da4f;}else{for(var _0x1634ef=0x0;_0x1634ef<_0x12ad24[_0x65b8('0x37')];_0x1634ef++){var _0x1a0db3=_0x12ad24[_0x1634ef];if(_0x1a0db3['role']===_0x65b8('0x55')){var _0x5b4af8=_['find'](_0x75de22,function(_0x5abdac){return _0x5abdac['resourceId']===_0x1a0db3['id'];});if(_0x5b4af8)_0x17da4f[_0x65b8('0x6a')](_0x1a0db3);}else{_0x17da4f[_0x65b8('0x6a')](_0x1a0db3);}}return _0x17da4f;}});}else{return _0x12ad24;}}else{var _0x586efc=_[_0x65b8('0x3f')](_0x12ad24,function(_0x30fec3){if(_0x30fec3['role']!==_0x65b8('0x55')){return _0x30fec3;}});return _0x586efc;}});}else{return _0x12ad24;}}})[_0x65b8('0x28')](function(_0x4427c1){var _0x30101f=[];if(_0x4427c1){_0x5dbc47=_0x4427c1;for(var _0x18ad8d=0x0;_0x18ad8d<_0x4427c1[_0x65b8('0x37')];_0x18ad8d+=0x1){_0x5dbc47[_0x18ad8d][_0x65b8('0x50')]=[];_0x30101f[_0x65b8('0x6a')](db[_0x65b8('0x2e')][_0x65b8('0x47')]({'where':{'FromId':[_0x318d06['user']['id'],_0x4427c1[_0x18ad8d]['id']],'ToId':[_0x318d06[_0x65b8('0x57')]['id'],_0x4427c1[_0x18ad8d]['id']],'ChatGroupId':null},'attributes':['id',_0x65b8('0x52'),_0x65b8('0x6b'),_0x65b8('0x6c'),_0x65b8('0x6d'),_0x65b8('0x4b')],'order':qs[_0x65b8('0x3a')](_0x65b8('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x65b8('0x28')](wrapUser(_0x4427c1[_0x18ad8d])));}return BPromise['all'](_0x30101f);}return[];})[_0x65b8('0x28')](function(_0x4f5757){return{'rows':_0x4f5757,'count':_0x4f5757['length']};})[_0x65b8('0x28')](respondWithResult(_0x1ea222,null))['catch'](handleError(_0x1ea222,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index af74687..f76055a 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 _0x756b=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x756b,0xa0));var _0xb756=function(_0x453a07,_0x49e6e6){_0x453a07=_0x453a07-0x0;var _0x1ca5e0=_0x756b[_0x453a07];return _0x1ca5e0;};'use strict';var EventEmitter=require(_0xb756('0x0'));var ChatInternalMessage=require(_0xb756('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb756('0x2'),'afterUpdate':_0xb756('0x3'),'afterDestroy':_0xb756('0x4')};function emitEvent(_0x36cc73){return function(_0x4f4318,_0x39ec7c,_0x5acdce){ChatInternalMessageEvents[_0xb756('0x5')](_0x36cc73+':'+_0x4f4318['id'],_0x4f4318);ChatInternalMessageEvents[_0xb756('0x5')](_0x36cc73,_0x4f4318);_0x5acdce(null);};}for(var e in events){if(events[_0xb756('0x6')](e)){var event=events[e];ChatInternalMessage[_0xb756('0x7')](e,emitEvent(event));}}module[_0xb756('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xea5e=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x4cced0,_0x27dae8){var _0x28e6b6=function(_0x3452b6){while(--_0x3452b6){_0x4cced0['push'](_0x4cced0['shift']());}};_0x28e6b6(++_0x27dae8);}(_0xea5e,0x7f));var _0xeea5=function(_0x286467,_0x59dd6a){_0x286467=_0x286467-0x0;var _0x19a6b1=_0xea5e[_0x286467];return _0x19a6b1;};'use strict';var EventEmitter=require(_0xeea5('0x0'));var ChatInternalMessage=require(_0xeea5('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xeea5('0x2')](0x0);var events={'afterCreate':_0xeea5('0x3'),'afterUpdate':'update','afterDestroy':_0xeea5('0x4')};function emitEvent(_0x556dad){return function(_0x5909e0,_0x4818cc,_0x259980){ChatInternalMessageEvents['emit'](_0x556dad+':'+_0x5909e0['id'],_0x5909e0);ChatInternalMessageEvents[_0xeea5('0x5')](_0x556dad,_0x5909e0);_0x259980(null);};}for(var e in events){if(events[_0xeea5('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 67a1ed6..ada4f1c 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 _0xa507=['bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0xa507,0xa5));var _0x7a50=function(_0x131e60,_0x5352ce){_0x131e60=_0x131e60-0x0;var _0x4bc497=_0xa507[_0x131e60];return _0x4bc497;};'use strict';var _=require(_0x7a50('0x0'));var util=require(_0x7a50('0x1'));var logger=require(_0x7a50('0x2'))(_0x7a50('0x3'));var moment=require('moment');var BPromise=require(_0x7a50('0x4'));var rp=require(_0x7a50('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a50('0x6'));var config=require(_0x7a50('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x7a50('0x8')]=function(_0x3b9b1f,_0x50da83){return _0x3b9b1f[_0x7a50('0x9')](_0x7a50('0xa'),attributes,{'tableName':_0x7a50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7a50('0xc')});}; \ No newline at end of file +var _0x63d2=['bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x484982,_0x4c4564){var _0xb42763=function(_0x3461d4){while(--_0x3461d4){_0x484982['push'](_0x484982['shift']());}};_0xb42763(++_0x4c4564);}(_0x63d2,0x13b));var _0x263d=function(_0x259646,_0x1f0c3d){_0x259646=_0x259646-0x0;var _0x2d2713=_0x63d2[_0x259646];return _0x2d2713;};'use strict';var _=require(_0x263d('0x0'));var util=require(_0x263d('0x1'));var logger=require(_0x263d('0x2'))(_0x263d('0x3'));var moment=require(_0x263d('0x4'));var BPromise=require(_0x263d('0x5'));var rp=require(_0x263d('0x6'));var fs=require('fs');var path=require(_0x263d('0x7'));var rimraf=require(_0x263d('0x8'));var config=require(_0x263d('0x9'));var attributes=require(_0x263d('0xa'));module[_0x263d('0xb')]=function(_0x46ab83,_0x37759d){return _0x46ab83[_0x263d('0xc')]('ChatInternalMessage',attributes,{'tableName':_0x263d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x263d('0xe'),'collate':_0x263d('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 0734e9c..d9a098f 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 _0x56d8=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','ChatInternalMessage,\x20%s,\x20%s','message','result'];(function(_0x2c1aa4,_0x25b489){var _0x4afc0b=function(_0x34a9b5){while(--_0x34a9b5){_0x2c1aa4['push'](_0x2c1aa4['shift']());}};_0x4afc0b(++_0x25b489);}(_0x56d8,0x1a1));var _0x856d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x56d8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x856d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x856d('0x1'));var rs=require(_0x856d('0x2'));var fs=require('fs');var Redis=require(_0x856d('0x3'));var db=require(_0x856d('0x4'))['db'];var utils=require(_0x856d('0x5'));var logger=require(_0x856d('0x6'))(_0x856d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x856d('0x8')][_0x856d('0x9')]({'port':0x232a});config[_0x856d('0xa')]=_[_0x856d('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x856d('0xc'))(new Redis(config['redis']));require(_0x856d('0xd'))[_0x856d('0xe')](socket);function respondWithRpcPromise(_0x176659,_0x3facd4,_0x1f9b9c){return new BPromise(function(_0x333f1d,_0x25a226){return client[_0x856d('0xf')](_0x176659,_0x1f9b9c)[_0x856d('0x10')](function(_0x437ede){logger[_0x856d('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x3facd4,_0x856d('0x12'));logger[_0x856d('0x13')](_0x856d('0x14'),_0x3facd4,_0x856d('0x12'),JSON['stringify'](_0x437ede));if(_0x437ede['error']){if(_0x437ede[_0x856d('0x15')]['code']===0x1f4){logger[_0x856d('0x15')](_0x856d('0x16'),_0x3facd4,_0x437ede[_0x856d('0x15')]['message']);return _0x25a226(_0x437ede[_0x856d('0x15')]['message']);}logger[_0x856d('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x3facd4,_0x437ede[_0x856d('0x15')][_0x856d('0x17')]);return _0x333f1d(_0x437ede[_0x856d('0x15')][_0x856d('0x17')]);}else{logger['info'](_0x856d('0x16'),_0x3facd4,_0x856d('0x12'));_0x333f1d(_0x437ede[_0x856d('0x18')][_0x856d('0x17')]);}})[_0x856d('0x19')](function(_0x33e919){logger[_0x856d('0x15')](_0x856d('0x16'),_0x3facd4,_0x33e919);_0x25a226(_0x33e919);});});} \ No newline at end of file +var _0x62b9=['./chatInternalMessage.socket','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x2a0f3f,_0x4dce14){var _0x43daa7=function(_0x357b96){while(--_0x357b96){_0x2a0f3f['push'](_0x2a0f3f['shift']());}};_0x43daa7(++_0x4dce14);}(_0x62b9,0x130));var _0x962b=function(_0x455ac7,_0x260578){_0x455ac7=_0x455ac7-0x0;var _0x2d28f6=_0x62b9[_0x455ac7];return _0x2d28f6;};'use strict';var _=require(_0x962b('0x0'));var util=require(_0x962b('0x1'));var moment=require(_0x962b('0x2'));var BPromise=require(_0x962b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x962b('0x4'))['db'];var utils=require(_0x962b('0x5'));var logger=require(_0x962b('0x6'))(_0x962b('0x7'));var config=require(_0x962b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x962b('0x9')][_0x962b('0xa')]({'port':0x232a});config[_0x962b('0xb')]=_[_0x962b('0xc')](config[_0x962b('0xb')],{'host':_0x962b('0xd'),'port':0x18eb});var socket=require(_0x962b('0xe'))(new Redis(config[_0x962b('0xb')]));require(_0x962b('0xf'))[_0x962b('0x10')](socket);function respondWithRpcPromise(_0x1c71f2,_0x3bcc5a,_0x564e62){return new BPromise(function(_0x1c056f,_0xc6d013){return client[_0x962b('0x11')](_0x1c71f2,_0x564e62)[_0x962b('0x12')](function(_0x2f0029){logger[_0x962b('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x3bcc5a,'request\x20sent');logger[_0x962b('0x14')](_0x962b('0x15'),_0x3bcc5a,_0x962b('0x16'),JSON[_0x962b('0x17')](_0x2f0029));if(_0x2f0029['error']){if(_0x2f0029['error']['code']===0x1f4){logger[_0x962b('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x3bcc5a,_0x2f0029[_0x962b('0x18')][_0x962b('0x19')]);return _0xc6d013(_0x2f0029['error'][_0x962b('0x19')]);}logger['error'](_0x962b('0x1a'),_0x3bcc5a,_0x2f0029[_0x962b('0x18')][_0x962b('0x19')]);return _0x1c056f(_0x2f0029[_0x962b('0x18')]['message']);}else{logger['info'](_0x962b('0x1a'),_0x3bcc5a,'request\x20sent');_0x1c056f(_0x2f0029[_0x962b('0x1b')]['message']);}})[_0x962b('0x1c')](function(_0x499a4e){logger[_0x962b('0x18')](_0x962b('0x1a'),_0x3bcc5a,_0x499a4e);_0xc6d013(_0x499a4e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7386c93..5087901 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 _0xa9c7=['length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x484a00,_0x2e3622){var _0x180c1b=function(_0x23e82d){while(--_0x23e82d){_0x484a00['push'](_0x484a00['shift']());}};_0x180c1b(++_0x2e3622);}(_0xa9c7,0x158));var _0x7a9c=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0xa9c7[_0x46c1d5];return _0x40fe7b;};'use strict';var ChatInternalMessageEvents=require(_0x7a9c('0x0'));var events=[_0x7a9c('0x1'),_0x7a9c('0x2'),_0x7a9c('0x3')];function createListener(_0x567d45,_0x819db5){return function(_0x3acc26){_0x819db5[_0x7a9c('0x4')](_0x567d45,_0x3acc26);};}function removeListener(_0x12605b,_0x5d54ad){return function(){ChatInternalMessageEvents[_0x7a9c('0x5')](_0x12605b,_0x5d54ad);};}exports[_0x7a9c('0x6')]=function(_0x105347){for(var _0x38c98d=0x0,_0x11fca1=events[_0x7a9c('0x7')];_0x38c98d<_0x11fca1;_0x38c98d++){var _0x3f9bfa=events[_0x38c98d];var _0x34688c=createListener(_0x7a9c('0x8')+_0x3f9bfa,_0x105347);ChatInternalMessageEvents['on'](_0x3f9bfa,_0x34688c);}}; \ No newline at end of file +var _0x7ebc=['update','emit','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x6b35d8,_0xd11b2b){var _0x468f76=function(_0x4b5d88){while(--_0x4b5d88){_0x6b35d8['push'](_0x6b35d8['shift']());}};_0x468f76(++_0xd11b2b);}(_0x7ebc,0x13c));var _0xc7eb=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x7ebc[_0x4c445a];return _0x2f611c;};'use strict';var ChatInternalMessageEvents=require(_0xc7eb('0x0'));var events=[_0xc7eb('0x1'),'remove',_0xc7eb('0x2')];function createListener(_0x2db6fd,_0x1325e8){return function(_0x421888){_0x1325e8[_0xc7eb('0x3')](_0x2db6fd,_0x421888);};}function removeListener(_0xbb4ab9,_0x53ff5a){return function(){ChatInternalMessageEvents['removeListener'](_0xbb4ab9,_0x53ff5a);};}exports['register']=function(_0x4cf826){for(var _0x5ec7e2=0x0,_0x5bed3e=events[_0xc7eb('0x4')];_0x5ec7e2<_0x5bed3e;_0x5ec7e2++){var _0x4cb40e=events[_0x5ec7e2];var _0x55f45c=createListener(_0xc7eb('0x5')+_0x4cb40e,_0x4cf826);ChatInternalMessageEvents['on'](_0x4cb40e,_0x55f45c);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4a9a806..19610b3 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 _0xd03c=['../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated','index','describe','/users','getUsers','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x28b83a,_0x401d6f){var _0x5985d9=function(_0x37d489){while(--_0x37d489){_0x28b83a['push'](_0x28b83a['shift']());}};_0x5985d9(++_0x401d6f);}(_0xd03c,0x1ca));var _0xcd03=function(_0x4d030c,_0x54c36b){_0x4d030c=_0x4d030c-0x0;var _0x216638=_0xd03c[_0x4d030c];return _0x216638;};'use strict';var multer=require(_0xcd03('0x0'));var util=require(_0xcd03('0x1'));var path=require(_0xcd03('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcd03('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcd03('0x4'));var config=require('../../config/environment');var controller=require(_0xcd03('0x5'));router['get']('/',auth[_0xcd03('0x6')](),controller[_0xcd03('0x7')]);router['get']('/describe',auth[_0xcd03('0x6')](),controller[_0xcd03('0x8')]);router['get'](_0xcd03('0x9'),auth['isAuthenticated'](),controller[_0xcd03('0xa')]);router[_0xcd03('0xb')]('/:id',auth[_0xcd03('0x6')](),controller[_0xcd03('0xc')]);router[_0xcd03('0xd')]('/',auth[_0xcd03('0x6')](),controller[_0xcd03('0xe')]);router[_0xcd03('0xf')](_0xcd03('0x10'),controller[_0xcd03('0x11')]);router[_0xcd03('0x12')]('/:id',auth[_0xcd03('0x6')](),controller[_0xcd03('0x13')]);module[_0xcd03('0x14')]=router; \ No newline at end of file +var _0x52cf=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x52cf,0x121));var _0xf52c=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x52cf[_0x2cf2e9];return _0xd3670d;};'use strict';var multer=require(_0xf52c('0x0'));var util=require(_0xf52c('0x1'));var path=require(_0xf52c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf52c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf52c('0x4'));var interaction=require(_0xf52c('0x5'));var config=require(_0xf52c('0x6'));var controller=require('./chatInternalMessage.controller');router[_0xf52c('0x7')]('/',auth['isAuthenticated'](),controller[_0xf52c('0x8')]);router[_0xf52c('0x7')](_0xf52c('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xf52c('0x7')]('/users',auth[_0xf52c('0xa')](),controller[_0xf52c('0xb')]);router[_0xf52c('0x7')](_0xf52c('0xc'),auth[_0xf52c('0xa')](),controller[_0xf52c('0xd')]);router[_0xf52c('0xe')]('/',auth['isAuthenticated'](),controller[_0xf52c('0xf')]);router[_0xf52c('0x10')](_0xf52c('0xc'),controller[_0xf52c('0x11')]);router[_0xf52c('0x12')](_0xf52c('0xc'),auth[_0xf52c('0xa')](),controller[_0xf52c('0x13')]);module[_0xf52c('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index e7e26af..f730667 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 _0x97db=['TEXT','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x2defb1,_0xeecbfd){var _0x353293=function(_0x2aa399){while(--_0x2aa399){_0x2defb1['push'](_0x2defb1['shift']());}};_0x353293(++_0xeecbfd);}(_0x97db,0x1b4));var _0xb97d=function(_0x5f4489,_0x1bdf90){_0x5f4489=_0x5f4489-0x0;var _0x3da858=_0x97db[_0x5f4489];return _0x3da858;};'use strict';var Sequelize=require(_0xb97d('0x0'));module[_0xb97d('0x1')]={'body':{'type':Sequelize[_0xb97d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xb97d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb97d('0x4')]('in',_0xb97d('0x5')),'defaultValue':_0xb97d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb97d('0x2')]}}; \ No newline at end of file +var _0xe5fb=['medium','BOOLEAN','out','DATE','STRING','TEXT','sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe5fb,0xce));var _0xbe5f=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0xe5fb[_0x5f3de3];return _0x287e0d;};'use strict';var Sequelize=require(_0xbe5f('0x0'));module[_0xbe5f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbe5f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbe5f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbe5f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbe5f('0x4')),'defaultValue':_0xbe5f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbe5f('0x5')]},'providerName':{'type':Sequelize[_0xbe5f('0x6')]},'providerResponse':{'type':Sequelize[_0xbe5f('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 86ef5f8..8bca6a4 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 _0x9d4b=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','findAll','show','params','rawAttributes','includeAll','include','find','create','body','describe','accept','acceptMessage','reject','chat','UserId','user','agent','get','ChatInteractionId','interaction','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','email','internal','interface','SIP/%s','channel','event','util','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','chat-interactions','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','update','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','model'];(function(_0x56d229,_0x1783af){var _0x3c2e18=function(_0x41d34a){while(--_0x41d34a){_0x56d229['push'](_0x56d229['shift']());}};_0x3c2e18(++_0x1783af);}(_0x9d4b,0x19d));var _0xb9d4=function(_0x56653c,_0x10c2a5){_0x56653c=_0x56653c-0x0;var _0x17e298=_0x9d4b[_0x56653c];return _0x17e298;};'use strict';var util=require(_0xb9d4('0x0'));var _=require('lodash');var Redis=require(_0xb9d4('0x1'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xb9d4('0x2'))('api');var config=require(_0xb9d4('0x3'));var db=require(_0xb9d4('0x4'))['db'];config[_0xb9d4('0x5')]=_[_0xb9d4('0x6')](config[_0xb9d4('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9d4('0x7'))(new Redis(config[_0xb9d4('0x5')]));require('./chatMessage.socket')[_0xb9d4('0x8')](socket);var jayson=require(_0xb9d4('0x9'));var client=jayson[_0xb9d4('0xa')]['http']({'port':0x232c});var client9002=jayson[_0xb9d4('0xa')][_0xb9d4('0xb')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0xb9d4('0xc'));function respondWithRpcPromise(_0x5d2ab9,_0x150ca6,_0x52f4ff,_0x154be3){return new Promise(function(_0x2dfc00,_0x5ccc2c){var _0x2cb952=_0x154be3||client;return _0x2cb952['request'](_0x5d2ab9,_0x52f4ff)[_0xb9d4('0xd')](function(_0x18caca){logger[_0xb9d4('0xe')](_0xb9d4('0xf'),_0x150ca6,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x150ca6,_0xb9d4('0x10'),JSON[_0xb9d4('0x11')](_0x18caca));if(_0x18caca[_0xb9d4('0x12')]){if(_0x18caca['error'][_0xb9d4('0x13')]===0x1f4){logger[_0xb9d4('0x12')](_0xb9d4('0xf'),_0x150ca6,_0x18caca[_0xb9d4('0x12')]['message']);return _0x5ccc2c(_0x18caca[_0xb9d4('0x12')][_0xb9d4('0x14')]);}logger['error'](_0xb9d4('0xf'),_0x150ca6,_0x18caca[_0xb9d4('0x12')][_0xb9d4('0x14')]);return _0x2dfc00(_0x18caca[_0xb9d4('0x12')]['message']);}else{logger[_0xb9d4('0xe')](_0xb9d4('0xf'),_0x150ca6,'request\x20sent');_0x2dfc00(_0x18caca[_0xb9d4('0x15')]['message']);}})[_0xb9d4('0x16')](function(_0x508da6){logger[_0xb9d4('0x12')](_0xb9d4('0xf'),_0x150ca6,_0x508da6);_0x5ccc2c(_0x508da6);});});}function respondWithResult(_0x3863b6,_0xed8fa){_0xed8fa=_0xed8fa||0xc8;return function(_0x4f8643){if(_0x4f8643){return _0x3863b6[_0xb9d4('0x17')](_0xed8fa)[_0xb9d4('0x18')](_0x4f8643);}};}function respondWithFilteredResult(_0x5e3097,_0x4e5461){return function(_0x3fdbc5){if(_0x3fdbc5){var _0x2c831f=typeof _0x4e5461[_0xb9d4('0x19')]===_0xb9d4('0x1a')&&typeof _0x4e5461[_0xb9d4('0x1b')]===_0xb9d4('0x1a');var _0x27a139=_0x3fdbc5[_0xb9d4('0x1c')];var _0x4a4f21=_0x2c831f?0x0:_0x4e5461[_0xb9d4('0x19')];var _0x2d9b6c=_0x2c831f?_0x3fdbc5[_0xb9d4('0x1c')]:_0x4e5461[_0xb9d4('0x19')]+_0x4e5461[_0xb9d4('0x1b')];var _0x2fd1ac;if(_0x2d9b6c>=_0x27a139){_0x2d9b6c=_0x27a139;_0x2fd1ac=0xc8;}else{_0x2fd1ac=0xce;}_0x5e3097['status'](_0x2fd1ac);return _0x5e3097[_0xb9d4('0x1d')]('Content-Range',_0x4a4f21+'-'+_0x2d9b6c+'/'+_0x27a139)[_0xb9d4('0x18')](_0x3fdbc5);}return null;};}function saveUpdates(_0x44166a){return function(_0x117c85){if(_0x117c85){return _0x117c85[_0xb9d4('0x1e')](_0x44166a)['then'](function(_0x17bbd7){return _0x17bbd7;});}return null;};}function removeEntity(_0x448f78){return function(_0x2bed4c){if(_0x2bed4c){return _0x2bed4c[_0xb9d4('0x1f')]()[_0xb9d4('0xd')](function(){_0x448f78[_0xb9d4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c9d27){return function(_0x49bfb9){if(!_0x49bfb9){_0x3c9d27[_0xb9d4('0x20')](0x194);}return _0x49bfb9;};}function handleError(_0x53a203,_0x58fa11){_0x58fa11=_0x58fa11||0x1f4;return function(_0x56965d){logger[_0xb9d4('0x12')](_0x56965d[_0xb9d4('0x21')]);if(_0x56965d[_0xb9d4('0x22')]){delete _0x56965d[_0xb9d4('0x22')];}_0x53a203[_0xb9d4('0x17')](_0x58fa11)[_0xb9d4('0x23')](_0x56965d);};}exports[_0xb9d4('0x24')]=function(_0x1393d2,_0x51b79b){var _0x2045b={},_0x461e16={},_0x53933d={'count':0x0,'rows':[]};var _0xb6014=_[_0xb9d4('0x25')](db['ChatMessage']['rawAttributes'],function(_0x1658b3){return{'name':_0x1658b3[_0xb9d4('0x26')],'type':_0x1658b3[_0xb9d4('0x27')][_0xb9d4('0x28')]};});_0x461e16[_0xb9d4('0x29')]=_['map'](_0xb6014,_0xb9d4('0x22'));_0x461e16[_0xb9d4('0x2a')]=_[_0xb9d4('0x2b')](_0x1393d2[_0xb9d4('0x2a')]);_0x461e16[_0xb9d4('0x2c')]=_[_0xb9d4('0x2d')](_0x461e16[_0xb9d4('0x29')],_0x461e16['query']);_0x2045b[_0xb9d4('0x2e')]=_[_0xb9d4('0x2d')](_0x461e16['model'],qs['fields'](_0x1393d2['query'][_0xb9d4('0x2f')]));_0x2045b['attributes']=_0x2045b['attributes'][_0xb9d4('0x30')]?_0x2045b[_0xb9d4('0x2e')]:_0x461e16['model'];if(!_0x1393d2[_0xb9d4('0x2a')][_0xb9d4('0x31')](_0xb9d4('0x32'))){_0x2045b[_0xb9d4('0x1b')]=qs[_0xb9d4('0x1b')](_0x1393d2[_0xb9d4('0x2a')][_0xb9d4('0x1b')]);_0x2045b[_0xb9d4('0x19')]=qs[_0xb9d4('0x19')](_0x1393d2['query'][_0xb9d4('0x19')]);}_0x2045b[_0xb9d4('0x33')]=qs['sort'](_0x1393d2[_0xb9d4('0x2a')][_0xb9d4('0x34')]);_0x2045b[_0xb9d4('0x35')]=qs[_0xb9d4('0x2c')](_[_0xb9d4('0x36')](_0x1393d2[_0xb9d4('0x2a')],_0x461e16['filters']),_0xb6014);if(_0x1393d2[_0xb9d4('0x2a')][_0xb9d4('0x37')]){_0x2045b[_0xb9d4('0x35')]=_[_0xb9d4('0x38')](_0x2045b[_0xb9d4('0x35')],{'$or':_[_0xb9d4('0x25')](_0xb6014,function(_0x1960aa){if(_0x1960aa['type']!==_0xb9d4('0x39')){var _0x1b7c5a={};_0x1b7c5a[_0x1960aa['name']]={'$like':'%'+_0x1393d2[_0xb9d4('0x2a')]['filter']+'%'};return _0x1b7c5a;}})});}_0x2045b=_[_0xb9d4('0x38')]({},_0x2045b,_0x1393d2[_0xb9d4('0x3a')]);var _0x4f447b={'where':_0x2045b[_0xb9d4('0x35')]};return db['ChatMessage']['count'](_0x4f447b)[_0xb9d4('0xd')](function(_0x36f49d){_0x53933d[_0xb9d4('0x1c')]=_0x36f49d;if(_0x1393d2[_0xb9d4('0x2a')]['includeAll']){_0x2045b['include']=[{'all':!![]}];}return db[_0xb9d4('0x3b')][_0xb9d4('0x3c')](_0x2045b);})[_0xb9d4('0xd')](function(_0x553705){_0x53933d['rows']=_0x553705;return _0x53933d;})[_0xb9d4('0xd')](respondWithFilteredResult(_0x51b79b,_0x2045b))[_0xb9d4('0x16')](handleError(_0x51b79b,null));};exports[_0xb9d4('0x3d')]=function(_0x33350b,_0x324955){var _0x2f27fb={'raw':!![],'where':{'id':_0x33350b[_0xb9d4('0x3e')]['id']}},_0x3c0d96={};_0x3c0d96['model']=_['keys'](db['ChatMessage'][_0xb9d4('0x3f')]);_0x3c0d96[_0xb9d4('0x2a')]=_[_0xb9d4('0x2b')](_0x33350b['query']);_0x3c0d96[_0xb9d4('0x2c')]=_[_0xb9d4('0x2d')](_0x3c0d96[_0xb9d4('0x29')],_0x3c0d96[_0xb9d4('0x2a')]);_0x2f27fb[_0xb9d4('0x2e')]=_[_0xb9d4('0x2d')](_0x3c0d96[_0xb9d4('0x29')],qs[_0xb9d4('0x2f')](_0x33350b['query'][_0xb9d4('0x2f')]));_0x2f27fb[_0xb9d4('0x2e')]=_0x2f27fb[_0xb9d4('0x2e')][_0xb9d4('0x30')]?_0x2f27fb[_0xb9d4('0x2e')]:_0x3c0d96[_0xb9d4('0x29')];if(_0x33350b[_0xb9d4('0x2a')][_0xb9d4('0x40')]){_0x2f27fb[_0xb9d4('0x41')]=[{'all':!![]}];}_0x2f27fb=_['merge']({},_0x2f27fb,_0x33350b['options']);return db[_0xb9d4('0x3b')][_0xb9d4('0x42')](_0x2f27fb)['then'](handleEntityNotFound(_0x324955,null))[_0xb9d4('0xd')](respondWithResult(_0x324955,null))[_0xb9d4('0x16')](handleError(_0x324955,null));};exports[_0xb9d4('0x43')]=function(_0x937a8b,_0x360296){return db['ChatMessage'][_0xb9d4('0x43')](_0x937a8b[_0xb9d4('0x44')],{})[_0xb9d4('0xd')](respondWithResult(_0x360296,0xc9))['catch'](handleError(_0x360296,null));};exports[_0xb9d4('0x1e')]=function(_0x50b06a,_0x3361e6){if(_0x50b06a[_0xb9d4('0x44')]['id']){delete _0x50b06a['body']['id'];}return db['ChatMessage']['find']({'where':{'id':_0x50b06a[_0xb9d4('0x3e')]['id']}})[_0xb9d4('0xd')](handleEntityNotFound(_0x3361e6,null))[_0xb9d4('0xd')](saveUpdates(_0x50b06a[_0xb9d4('0x44')],null))[_0xb9d4('0xd')](respondWithResult(_0x3361e6,null))[_0xb9d4('0x16')](handleError(_0x3361e6,null));};exports[_0xb9d4('0x1f')]=function(_0x58b605,_0x35c1f4){return db[_0xb9d4('0x3b')][_0xb9d4('0x42')]({'where':{'id':_0x58b605['params']['id']}})['then'](handleEntityNotFound(_0x35c1f4,null))[_0xb9d4('0xd')](removeEntity(_0x35c1f4,null))[_0xb9d4('0x16')](handleError(_0x35c1f4,null));};exports[_0xb9d4('0x45')]=function(_0x43dcb0,_0x2bdc71){return db[_0xb9d4('0x3b')][_0xb9d4('0x45')]()[_0xb9d4('0xd')](respondWithResult(_0x2bdc71,null))[_0xb9d4('0x16')](handleError(_0x2bdc71,null));};exports[_0xb9d4('0x46')]=function(_0x40cb64,_0x366157){var _0x1920de='chat';return interactionService[_0xb9d4('0x47')](_0x40cb64,_0x1920de)['then'](respondWithResult(_0x366157,null))[_0xb9d4('0x16')](handleError(_0x366157,null));};exports[_0xb9d4('0x48')]=function(_0x3386f3,_0x4c1cab){var _0x448218={'agent':{},'channel':_0xb9d4('0x49')};if(_0x3386f3[_0xb9d4('0x44')]['id']){delete _0x3386f3[_0xb9d4('0x44')]['id'];}_0x3386f3[_0xb9d4('0x44')][_0xb9d4('0x4a')]=_0x3386f3[_0xb9d4('0x44')][_0xb9d4('0x4a')]||_0x3386f3[_0xb9d4('0x4b')]['id'];_0x448218[_0xb9d4('0x4c')]['id']=_0x3386f3['body']['UserId'];return db[_0xb9d4('0x3b')][_0xb9d4('0x42')]({'where':{'id':_0x3386f3[_0xb9d4('0x3e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4c1cab,null))['then'](function(_0x7b9916){if(_0x7b9916){_0x448218[_0xb9d4('0x14')]=_0x7b9916[_0xb9d4('0x4d')]({'plain':!![]});return db['ChatInteraction'][_0xb9d4('0x42')]({'where':{'id':_0x7b9916[_0xb9d4('0x4e')]}});}return null;})[_0xb9d4('0xd')](handleEntityNotFound(_0x4c1cab,null))[_0xb9d4('0xd')](function(_0x23dadc){if(_0x23dadc){_0x448218[_0xb9d4('0x4f')]=_0x23dadc[_0xb9d4('0x4d')]({'plain':!![]});interaction_log[_0xb9d4('0xe')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3386f3['user']['id'],_0x3386f3['user'][_0xb9d4('0x22')],_0x3386f3[_0xb9d4('0x4b')][_0xb9d4('0x50')],_0x448218[_0xb9d4('0x4f')]['id'],_0x3386f3[_0xb9d4('0x44')]?JSON[_0xb9d4('0x11')](_0x3386f3[_0xb9d4('0x44')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x448218);}return null;})['then'](function(_0x1031f4){var _0x341e46=_0xb9d4('0x51')+_0x1031f4[_0xb9d4('0x14')]['ContactId'];return db['sequelize']['query'](_0x341e46,{'type':db[_0xb9d4('0x52')][_0xb9d4('0x53')]['SELECT'],'raw':!![]})['then'](function(_0x4ec1f9){return _0x4ec1f9;});})[_0xb9d4('0xd')](function(_0x1cd0d2){if(_0x1cd0d2){_0x448218[_0xb9d4('0x14')][_0xb9d4('0x54')]=_0x1cd0d2[0x0];if(!_0x3386f3[_0xb9d4('0x44')][_0xb9d4('0x4a')])return;return db['User']['find']({'where':{'id':_0x3386f3['body'][_0xb9d4('0x4a')],'role':'agent'},'attributes':['id',_0xb9d4('0x22'),'fullname',_0xb9d4('0x55'),_0xb9d4('0x56')],'raw':!![]});}return null;})['then'](function(_0x199c46){if(!_0x199c46)return null;_0x448218[_0xb9d4('0x14')][_0xb9d4('0x4c')]=_0x199c46;return _0x448218;})[_0xb9d4('0xd')](function(_0x3037ba){if(_0x3037ba){_0x3037ba[_0xb9d4('0x14')][_0xb9d4('0x57')]=util['format'](_0xb9d4('0x58'),_0x3386f3[_0xb9d4('0x4b')][_0xb9d4('0x22')]);_0x3037ba[_0xb9d4('0x14')][_0xb9d4('0x59')]=_0x448218[_0xb9d4('0x59')];_0x3037ba['message']['motionChannel']=_0x448218['channel'];_0x3037ba['message'][_0xb9d4('0x5a')]=_0xb9d4('0x48');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_[_0xb9d4('0x38')](_0x448218[_0xb9d4('0x14')],JSON['parse'](_0x448218[_0xb9d4('0x4f')]['formData']))},client9002);return _0x448218;}return null;})[_0xb9d4('0xd')](respondWithResult(_0x4c1cab,null))[_0xb9d4('0x16')](handleError(_0x4c1cab,null));}; \ No newline at end of file +var _0x960a=['interface','SIP/%s','channel','event','EventManager','parse','formData','util','lodash','ioredis','../../components/interaction/service','../../config/environment','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','../../config/logger','chat-interactions','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','json','undefined','limit','count','offset','status','set','destroy','end','sendStatus','name','send','index','map','ChatMessage','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','find','create','body','update','describe','accept','chat','acceptMessage','reject','UserId','user','agent','ChatInteraction','ChatInteractionId','interaction','get','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email'];(function(_0x5ebec4,_0x474731){var _0x3b9d3b=function(_0x3aa9da){while(--_0x3aa9da){_0x5ebec4['push'](_0x5ebec4['shift']());}};_0x3b9d3b(++_0x474731);}(_0x960a,0x18f));var _0xa960=function(_0x1b2aea,_0x1c51ff){_0x1b2aea=_0x1b2aea-0x0;var _0x2ff88c=_0x960a[_0x1b2aea];return _0x2ff88c;};'use strict';var util=require(_0xa960('0x0'));var _=require(_0xa960('0x1'));var Redis=require(_0xa960('0x2'));var interactionService=require(_0xa960('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xa960('0x4'));var db=require(_0xa960('0x5'))['db'];config[_0xa960('0x6')]=_[_0xa960('0x7')](config[_0xa960('0x6')],{'host':_0xa960('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require(_0xa960('0x9'));var client=jayson[_0xa960('0xa')][_0xa960('0xb')]({'port':0x232c});var client9002=jayson[_0xa960('0xa')][_0xa960('0xb')]({'port':0x232a});var interaction_log=require(_0xa960('0xc'))(_0xa960('0xd'));function respondWithRpcPromise(_0x5de2f6,_0x1b9980,_0x218d30,_0x18cb56){return new Promise(function(_0x3aeeae,_0xa6fc5f){var _0x36a988=_0x18cb56||client;return _0x36a988['request'](_0x5de2f6,_0x218d30)[_0xa960('0xe')](function(_0x4110dc){logger[_0xa960('0xf')](_0xa960('0x10'),_0x1b9980,_0xa960('0x11'));logger['debug'](_0xa960('0x12'),_0x1b9980,_0xa960('0x11'),JSON[_0xa960('0x13')](_0x4110dc));if(_0x4110dc[_0xa960('0x14')]){if(_0x4110dc[_0xa960('0x14')][_0xa960('0x15')]===0x1f4){logger[_0xa960('0x14')](_0xa960('0x10'),_0x1b9980,_0x4110dc[_0xa960('0x14')]['message']);return _0xa6fc5f(_0x4110dc[_0xa960('0x14')][_0xa960('0x16')]);}logger[_0xa960('0x14')]('ChatMessage,\x20%s,\x20%s',_0x1b9980,_0x4110dc['error'][_0xa960('0x16')]);return _0x3aeeae(_0x4110dc[_0xa960('0x14')][_0xa960('0x16')]);}else{logger[_0xa960('0xf')](_0xa960('0x10'),_0x1b9980,_0xa960('0x11'));_0x3aeeae(_0x4110dc['result'][_0xa960('0x16')]);}})[_0xa960('0x17')](function(_0x311c82){logger[_0xa960('0x14')](_0xa960('0x10'),_0x1b9980,_0x311c82);_0xa6fc5f(_0x311c82);});});}function respondWithResult(_0x307cf8,_0x5a408d){_0x5a408d=_0x5a408d||0xc8;return function(_0x1532a0){if(_0x1532a0){return _0x307cf8['status'](_0x5a408d)[_0xa960('0x18')](_0x1532a0);}};}function respondWithFilteredResult(_0x4ea051,_0x76ab41){return function(_0x57dfc4){if(_0x57dfc4){var _0x18d70a=typeof _0x76ab41['offset']===_0xa960('0x19')&&typeof _0x76ab41[_0xa960('0x1a')]===_0xa960('0x19');var _0x4b443a=_0x57dfc4[_0xa960('0x1b')];var _0xcdd616=_0x18d70a?0x0:_0x76ab41[_0xa960('0x1c')];var _0x458b27=_0x18d70a?_0x57dfc4[_0xa960('0x1b')]:_0x76ab41[_0xa960('0x1c')]+_0x76ab41[_0xa960('0x1a')];var _0x52e27d;if(_0x458b27>=_0x4b443a){_0x458b27=_0x4b443a;_0x52e27d=0xc8;}else{_0x52e27d=0xce;}_0x4ea051[_0xa960('0x1d')](_0x52e27d);return _0x4ea051[_0xa960('0x1e')]('Content-Range',_0xcdd616+'-'+_0x458b27+'/'+_0x4b443a)[_0xa960('0x18')](_0x57dfc4);}return null;};}function saveUpdates(_0x40b451){return function(_0x3e0647){if(_0x3e0647){return _0x3e0647['update'](_0x40b451)[_0xa960('0xe')](function(_0x2fb446){return _0x2fb446;});}return null;};}function removeEntity(_0x3ac980){return function(_0x2376d9){if(_0x2376d9){return _0x2376d9[_0xa960('0x1f')]()[_0xa960('0xe')](function(){_0x3ac980[_0xa960('0x1d')](0xcc)[_0xa960('0x20')]();});}};}function handleEntityNotFound(_0x14ce5d){return function(_0x4d6437){if(!_0x4d6437){_0x14ce5d[_0xa960('0x21')](0x194);}return _0x4d6437;};}function handleError(_0xd64cb9,_0x4aa39d){_0x4aa39d=_0x4aa39d||0x1f4;return function(_0x401af3){logger['error'](_0x401af3['stack']);if(_0x401af3[_0xa960('0x22')]){delete _0x401af3[_0xa960('0x22')];}_0xd64cb9['status'](_0x4aa39d)[_0xa960('0x23')](_0x401af3);};}exports[_0xa960('0x24')]=function(_0x36252c,_0x4e928d){var _0x47435f={},_0x5b066a={},_0x1c9e12={'count':0x0,'rows':[]};var _0x37467a=_[_0xa960('0x25')](db[_0xa960('0x26')][_0xa960('0x27')],function(_0x108be3){return{'name':_0x108be3['fieldName'],'type':_0x108be3[_0xa960('0x28')][_0xa960('0x29')]};});_0x5b066a[_0xa960('0x2a')]=_[_0xa960('0x25')](_0x37467a,_0xa960('0x22'));_0x5b066a[_0xa960('0x2b')]=_['keys'](_0x36252c[_0xa960('0x2b')]);_0x5b066a[_0xa960('0x2c')]=_[_0xa960('0x2d')](_0x5b066a['model'],_0x5b066a['query']);_0x47435f['attributes']=_[_0xa960('0x2d')](_0x5b066a[_0xa960('0x2a')],qs[_0xa960('0x2e')](_0x36252c[_0xa960('0x2b')][_0xa960('0x2e')]));_0x47435f[_0xa960('0x2f')]=_0x47435f[_0xa960('0x2f')][_0xa960('0x30')]?_0x47435f[_0xa960('0x2f')]:_0x5b066a[_0xa960('0x2a')];if(!_0x36252c['query'][_0xa960('0x31')](_0xa960('0x32'))){_0x47435f[_0xa960('0x1a')]=qs['limit'](_0x36252c['query']['limit']);_0x47435f[_0xa960('0x1c')]=qs['offset'](_0x36252c[_0xa960('0x2b')][_0xa960('0x1c')]);}_0x47435f[_0xa960('0x33')]=qs[_0xa960('0x34')](_0x36252c[_0xa960('0x2b')][_0xa960('0x34')]);_0x47435f[_0xa960('0x35')]=qs[_0xa960('0x2c')](_[_0xa960('0x36')](_0x36252c[_0xa960('0x2b')],_0x5b066a['filters']),_0x37467a);if(_0x36252c[_0xa960('0x2b')][_0xa960('0x37')]){_0x47435f['where']=_[_0xa960('0x38')](_0x47435f['where'],{'$or':_[_0xa960('0x25')](_0x37467a,function(_0x5b6c3f){if(_0x5b6c3f[_0xa960('0x28')]!==_0xa960('0x39')){var _0x21cddf={};_0x21cddf[_0x5b6c3f[_0xa960('0x22')]]={'$like':'%'+_0x36252c[_0xa960('0x2b')]['filter']+'%'};return _0x21cddf;}})});}_0x47435f=_['merge']({},_0x47435f,_0x36252c['options']);var _0x2473dc={'where':_0x47435f[_0xa960('0x35')]};return db['ChatMessage'][_0xa960('0x1b')](_0x2473dc)[_0xa960('0xe')](function(_0x540a9f){_0x1c9e12[_0xa960('0x1b')]=_0x540a9f;if(_0x36252c[_0xa960('0x2b')][_0xa960('0x3a')]){_0x47435f[_0xa960('0x3b')]=[{'all':!![]}];}return db['ChatMessage'][_0xa960('0x3c')](_0x47435f);})['then'](function(_0x26720e){_0x1c9e12['rows']=_0x26720e;return _0x1c9e12;})['then'](respondWithFilteredResult(_0x4e928d,_0x47435f))[_0xa960('0x17')](handleError(_0x4e928d,null));};exports[_0xa960('0x3d')]=function(_0x110c17,_0x2332fc){var _0x5f0d2d={'raw':!![],'where':{'id':_0x110c17[_0xa960('0x3e')]['id']}},_0x430c0b={};_0x430c0b['model']=_[_0xa960('0x3f')](db[_0xa960('0x26')]['rawAttributes']);_0x430c0b[_0xa960('0x2b')]=_['keys'](_0x110c17['query']);_0x430c0b[_0xa960('0x2c')]=_['intersection'](_0x430c0b[_0xa960('0x2a')],_0x430c0b[_0xa960('0x2b')]);_0x5f0d2d[_0xa960('0x2f')]=_[_0xa960('0x2d')](_0x430c0b[_0xa960('0x2a')],qs[_0xa960('0x2e')](_0x110c17['query'][_0xa960('0x2e')]));_0x5f0d2d[_0xa960('0x2f')]=_0x5f0d2d[_0xa960('0x2f')]['length']?_0x5f0d2d[_0xa960('0x2f')]:_0x430c0b[_0xa960('0x2a')];if(_0x110c17[_0xa960('0x2b')][_0xa960('0x3a')]){_0x5f0d2d[_0xa960('0x3b')]=[{'all':!![]}];}_0x5f0d2d=_[_0xa960('0x38')]({},_0x5f0d2d,_0x110c17['options']);return db[_0xa960('0x26')][_0xa960('0x40')](_0x5f0d2d)[_0xa960('0xe')](handleEntityNotFound(_0x2332fc,null))[_0xa960('0xe')](respondWithResult(_0x2332fc,null))[_0xa960('0x17')](handleError(_0x2332fc,null));};exports[_0xa960('0x41')]=function(_0x1dc2fa,_0x10f1c0){return db[_0xa960('0x26')][_0xa960('0x41')](_0x1dc2fa[_0xa960('0x42')],{})[_0xa960('0xe')](respondWithResult(_0x10f1c0,0xc9))[_0xa960('0x17')](handleError(_0x10f1c0,null));};exports[_0xa960('0x43')]=function(_0x5b6817,_0x280dcf){if(_0x5b6817[_0xa960('0x42')]['id']){delete _0x5b6817[_0xa960('0x42')]['id'];}return db[_0xa960('0x26')][_0xa960('0x40')]({'where':{'id':_0x5b6817[_0xa960('0x3e')]['id']}})[_0xa960('0xe')](handleEntityNotFound(_0x280dcf,null))[_0xa960('0xe')](saveUpdates(_0x5b6817[_0xa960('0x42')],null))['then'](respondWithResult(_0x280dcf,null))[_0xa960('0x17')](handleError(_0x280dcf,null));};exports[_0xa960('0x1f')]=function(_0x4a9d66,_0x12ad6f){return db[_0xa960('0x26')]['find']({'where':{'id':_0x4a9d66[_0xa960('0x3e')]['id']}})[_0xa960('0xe')](handleEntityNotFound(_0x12ad6f,null))[_0xa960('0xe')](removeEntity(_0x12ad6f,null))[_0xa960('0x17')](handleError(_0x12ad6f,null));};exports[_0xa960('0x44')]=function(_0x5f2ad1,_0x14f6e6){return db[_0xa960('0x26')]['describe']()['then'](respondWithResult(_0x14f6e6,null))[_0xa960('0x17')](handleError(_0x14f6e6,null));};exports[_0xa960('0x45')]=function(_0x4c1e6d,_0x30650f){var _0x5d87d8=_0xa960('0x46');return interactionService[_0xa960('0x47')](_0x4c1e6d,_0x5d87d8)[_0xa960('0xe')](respondWithResult(_0x30650f,null))[_0xa960('0x17')](handleError(_0x30650f,null));};exports[_0xa960('0x48')]=function(_0xdc17fa,_0x47f4e7){var _0x3fc48={'agent':{},'channel':_0xa960('0x46')};if(_0xdc17fa['body']['id']){delete _0xdc17fa[_0xa960('0x42')]['id'];}_0xdc17fa['body'][_0xa960('0x49')]=_0xdc17fa[_0xa960('0x42')][_0xa960('0x49')]||_0xdc17fa[_0xa960('0x4a')]['id'];_0x3fc48[_0xa960('0x4b')]['id']=_0xdc17fa[_0xa960('0x42')][_0xa960('0x49')];return db[_0xa960('0x26')][_0xa960('0x40')]({'where':{'id':_0xdc17fa[_0xa960('0x3e')]['id'],'UserId':null}})[_0xa960('0xe')](handleEntityNotFound(_0x47f4e7,null))[_0xa960('0xe')](function(_0x1224b4){if(_0x1224b4){_0x3fc48['message']=_0x1224b4['get']({'plain':!![]});return db[_0xa960('0x4c')][_0xa960('0x40')]({'where':{'id':_0x1224b4[_0xa960('0x4d')]}});}return null;})['then'](handleEntityNotFound(_0x47f4e7,null))[_0xa960('0xe')](function(_0x577b84){if(_0x577b84){_0x3fc48[_0xa960('0x4e')]=_0x577b84[_0xa960('0x4f')]({'plain':!![]});interaction_log[_0xa960('0xf')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xdc17fa['user']['id'],_0xdc17fa['user']['name'],_0xdc17fa[_0xa960('0x4a')][_0xa960('0x50')],_0x3fc48[_0xa960('0x4e')]['id'],_0xdc17fa[_0xa960('0x42')]?JSON[_0xa960('0x13')](_0xdc17fa[_0xa960('0x42')]):'null');return respondWithRpcPromise(_0xa960('0x51'),_0xa960('0x52'),_0x3fc48);}return null;})[_0xa960('0xe')](function(_0x2ac80d){var _0x3705e2=_0xa960('0x53')+_0x2ac80d[_0xa960('0x16')][_0xa960('0x54')];return db[_0xa960('0x55')][_0xa960('0x2b')](_0x3705e2,{'type':db['Sequelize'][_0xa960('0x56')][_0xa960('0x57')],'raw':!![]})[_0xa960('0xe')](function(_0x8ecc5){return _0x8ecc5;});})[_0xa960('0xe')](function(_0x495cb9){if(_0x495cb9){_0x3fc48[_0xa960('0x16')][_0xa960('0x58')]=_0x495cb9[0x0];if(!_0xdc17fa[_0xa960('0x42')][_0xa960('0x49')])return;return db[_0xa960('0x59')]['find']({'where':{'id':_0xdc17fa[_0xa960('0x42')][_0xa960('0x49')],'role':_0xa960('0x4b')},'attributes':['id',_0xa960('0x22'),'fullname',_0xa960('0x5a'),'internal'],'raw':!![]});}return null;})[_0xa960('0xe')](function(_0x9ede29){if(!_0x9ede29)return null;_0x3fc48[_0xa960('0x16')][_0xa960('0x4b')]=_0x9ede29;return _0x3fc48;})[_0xa960('0xe')](function(_0x514e4e){if(_0x514e4e){_0x514e4e['message'][_0xa960('0x5b')]=util['format'](_0xa960('0x5c'),_0xdc17fa[_0xa960('0x4a')][_0xa960('0x22')]);_0x514e4e[_0xa960('0x16')][_0xa960('0x5d')]=_0x3fc48['channel'];_0x514e4e['message']['motionChannel']=_0x3fc48['channel'];_0x514e4e[_0xa960('0x16')][_0xa960('0x5e')]='reject';respondWithRpcPromise(_0xa960('0x5f'),_0xa960('0x5f'),{'event':'rejectmessage','message':_[_0xa960('0x38')](_0x3fc48[_0xa960('0x16')],JSON[_0xa960('0x60')](_0x3fc48[_0xa960('0x4e')][_0xa960('0x61')]))},client9002);return _0x3fc48;}return null;})[_0xa960('0xe')](respondWithResult(_0x47f4e7,null))[_0xa960('0x17')](handleError(_0x47f4e7,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 654ce07..3e28ef4 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 _0x113c=['remove','emit','hasOwnProperty','events','setMaxListeners','update'];(function(_0x271341,_0x1d335f){var _0x423bcc=function(_0x46a47a){while(--_0x46a47a){_0x271341['push'](_0x271341['shift']());}};_0x423bcc(++_0x1d335f);}(_0x113c,0x189));var _0xc113=function(_0x72e0d4,_0x368f98){_0x72e0d4=_0x72e0d4-0x0;var _0x145f0e=_0x113c[_0x72e0d4];return _0x145f0e;};'use strict';var EventEmitter=require(_0xc113('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc113('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc113('0x2'),'afterDestroy':_0xc113('0x3')};function emitEvent(_0x380c4a){return function(_0x1db0b8,_0x263824,_0x739218){ChatMessageEvents['emit'](_0x380c4a+':'+_0x1db0b8['id'],_0x1db0b8);ChatMessageEvents[_0xc113('0x4')](_0x380c4a,_0x1db0b8);_0x739218(null);};}for(var e in events){if(events[_0xc113('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x9094=['save','update','remove','hasOwnProperty','hook','events','ChatMessage'];(function(_0x49abdd,_0x32e671){var _0x433f19=function(_0x5e9045){while(--_0x5e9045){_0x49abdd['push'](_0x49abdd['shift']());}};_0x433f19(++_0x32e671);}(_0x9094,0x1a9));var _0x4909=function(_0x2facfa,_0x1fe707){_0x2facfa=_0x2facfa-0x0;var _0x321f36=_0x9094[_0x2facfa];return _0x321f36;};'use strict';var EventEmitter=require(_0x4909('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x4909('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4909('0x2'),'afterUpdate':_0x4909('0x3'),'afterDestroy':_0x4909('0x4')};function emitEvent(_0xcee881){return function(_0x36c3fe,_0x536578,_0x3dd815){ChatMessageEvents['emit'](_0xcee881+':'+_0x36c3fe['id'],_0x36c3fe);ChatMessageEvents['emit'](_0xcee881,_0x36c3fe);_0x3dd815(null);};}for(var e in events){if(events[_0x4909('0x5')](e)){var event=events[e];ChatMessage[_0x4909('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index ae3c7f0..407cc90 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 _0xa8de=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','chat_messages','fti_chat_messages','FULLTEXT','get','toLowerCase','out','isNil','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util'];(function(_0x55257d,_0x3998ec){var _0x4d296d=function(_0x522f05){while(--_0x522f05){_0x55257d['push'](_0x55257d['shift']());}};_0x4d296d(++_0x3998ec);}(_0xa8de,0x17e));var _0xea8d=function(_0x42a003,_0x3bb958){_0x42a003=_0x42a003-0x0;var _0x2f229c=_0xa8de[_0x42a003];return _0x2f229c;};'use strict';var _=require(_0xea8d('0x0'));var util=require(_0xea8d('0x1'));var logger=require(_0xea8d('0x2'))(_0xea8d('0x3'));var moment=require(_0xea8d('0x4'));var BPromise=require(_0xea8d('0x5'));var rp=require(_0xea8d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea8d('0x7'));var config=require(_0xea8d('0x8'));var attributes=require('./chatMessage.attributes');module[_0xea8d('0x9')]=function(_0x568d27,_0x63d306){return _0x568d27['define']('ChatMessage',attributes,{'tableName':_0xea8d('0xa'),'paranoid':![],'indexes':[{'name':_0xea8d('0xb'),'fields':['body'],'type':_0xea8d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42312b,_0x341de4,_0x3d5900){var _0x392ce2=_0x568d27['models'];var _0x57511f=_0x42312b[_0xea8d('0xd')]({'plain':!![]});if(_0x57511f['direction'][_0xea8d('0xe')]()==='in'||_0x57511f['direction']['toLowerCase']()===_0xea8d('0xf')&&!_0x57511f['secret']&&!_[_0xea8d('0x10')](_0x57511f['UserId'])){_0x392ce2[_0xea8d('0x11')]['findOne']({'where':{'id':_0x57511f[_0xea8d('0x12')]}})[_0xea8d('0x13')](function(_0xaad1cf){if(_0xaad1cf){_0xaad1cf[_0xea8d('0x14')]({'lastMsgAt':_0x57511f[_0xea8d('0x15')],'lastMsgDirection':_0x57511f['direction'][_0xea8d('0xe')]()});}})[_0xea8d('0x16')](function(_0x3d89ba){console['error'](_0x3d89ba);});}_0x3d5900();}},'charset':'utf8mb4','collate':_0xea8d('0x17')});}; \ No newline at end of file +var _0xd745=['ChatInteractionId','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','path','../../config/environment','./chatMessage.attributes','exports','chat_messages','fti_chat_messages','models','get','toLowerCase','out','secret','isNil','UserId','findOne'];(function(_0x42c317,_0x243256){var _0x2624d9=function(_0x5e4a13){while(--_0x5e4a13){_0x42c317['push'](_0x42c317['shift']());}};_0x2624d9(++_0x243256);}(_0xd745,0x9e));var _0x5d74=function(_0x41d65e,_0x479047){_0x41d65e=_0x41d65e-0x0;var _0x16841a=_0xd745[_0x41d65e];return _0x16841a;};'use strict';var _=require('lodash');var util=require(_0x5d74('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5d74('0x1'));var BPromise=require(_0x5d74('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d74('0x3'));var rimraf=require('rimraf');var config=require(_0x5d74('0x4'));var attributes=require(_0x5d74('0x5'));module[_0x5d74('0x6')]=function(_0x32ed6e,_0x343fdb){return _0x32ed6e['define']('ChatMessage',attributes,{'tableName':_0x5d74('0x7'),'paranoid':![],'indexes':[{'name':_0x5d74('0x8'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28e2b7,_0x5421dd,_0x44ea8c){var _0x25b99d=_0x32ed6e[_0x5d74('0x9')];var _0x261316=_0x28e2b7[_0x5d74('0xa')]({'plain':!![]});if(_0x261316['direction'][_0x5d74('0xb')]()==='in'||_0x261316['direction'][_0x5d74('0xb')]()===_0x5d74('0xc')&&!_0x261316[_0x5d74('0xd')]&&!_[_0x5d74('0xe')](_0x261316[_0x5d74('0xf')])){_0x25b99d['ChatInteraction'][_0x5d74('0x10')]({'where':{'id':_0x261316[_0x5d74('0x11')]}})['then'](function(_0x363b3e){if(_0x363b3e){_0x363b3e[_0x5d74('0x12')]({'lastMsgAt':_0x261316[_0x5d74('0x13')],'lastMsgDirection':_0x261316[_0x5d74('0x14')]['toLowerCase']()});}})[_0x5d74('0x15')](function(_0x3c66f6){console[_0x5d74('0x16')](_0x3c66f6);});}_0x44ea8c();}},'charset':_0x5d74('0x17'),'collate':_0x5d74('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 3c5470a..3b448af 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 _0x6790=['localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','CreateChatMessage','ChatMessage','body','options','raw','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3b23db,_0x1afc4d){var _0x4a2153=function(_0xe0aea){while(--_0xe0aea){_0x3b23db['push'](_0x3b23db['shift']());}};_0x4a2153(++_0x1afc4d);}(_0x6790,0xba));var _0x0679=function(_0x3f4c67,_0x1a5f87){_0x3f4c67=_0x3f4c67-0x0;var _0x5c3777=_0x6790[_0x3f4c67];return _0x5c3777;};'use strict';var _=require(_0x0679('0x0'));var util=require(_0x0679('0x1'));var moment=require('moment');var BPromise=require(_0x0679('0x2'));var rs=require(_0x0679('0x3'));var fs=require('fs');var Redis=require(_0x0679('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0679('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0679('0x6'));var jayson=require(_0x0679('0x7'));var client=jayson[_0x0679('0x8')][_0x0679('0x9')]({'port':0x232a});config[_0x0679('0xa')]=_[_0x0679('0xb')](config[_0x0679('0xa')],{'host':_0x0679('0xc'),'port':0x18eb});var socket=require(_0x0679('0xd'))(new Redis(config[_0x0679('0xa')]));require(_0x0679('0xe'))[_0x0679('0xf')](socket);function respondWithRpcPromise(_0x45432b,_0x23a545,_0x27b598){return new BPromise(function(_0x1ff51b,_0x45de0c){return client[_0x0679('0x10')](_0x45432b,_0x27b598)['then'](function(_0x50f6bf){logger[_0x0679('0x11')](_0x0679('0x12'),_0x23a545,_0x0679('0x13'));logger[_0x0679('0x14')](_0x0679('0x15'),_0x23a545,_0x0679('0x13'),JSON['stringify'](_0x50f6bf));if(_0x50f6bf['error']){if(_0x50f6bf['error'][_0x0679('0x16')]===0x1f4){logger[_0x0679('0x17')]('ChatMessage,\x20%s,\x20%s',_0x23a545,_0x50f6bf[_0x0679('0x17')]['message']);return _0x45de0c(_0x50f6bf[_0x0679('0x17')][_0x0679('0x18')]);}logger[_0x0679('0x17')]('ChatMessage,\x20%s,\x20%s',_0x23a545,_0x50f6bf['error'][_0x0679('0x18')]);return _0x1ff51b(_0x50f6bf[_0x0679('0x17')][_0x0679('0x18')]);}else{logger[_0x0679('0x11')]('ChatMessage,\x20%s,\x20%s',_0x23a545,_0x0679('0x13'));_0x1ff51b(_0x50f6bf[_0x0679('0x19')][_0x0679('0x18')]);}})['catch'](function(_0x14ddda){logger[_0x0679('0x17')](_0x0679('0x12'),_0x23a545,_0x14ddda);_0x45de0c(_0x14ddda);});});}exports[_0x0679('0x1a')]=function(_0x503ef2){var _0x5ade41=this;return new Promise(function(_0x28a4a7,_0xb7b9a8){return db[_0x0679('0x1b')]['create'](_0x503ef2[_0x0679('0x1c')],{'raw':_0x503ef2['options']?_0x503ef2[_0x0679('0x1d')][_0x0679('0x1e')]===undefined?!![]:![]:!![]})[_0x0679('0x1f')](function(_0x5a320a){logger[_0x0679('0x11')](_0x0679('0x1a'),_0x503ef2);logger[_0x0679('0x14')](_0x0679('0x1a'),_0x503ef2,JSON[_0x0679('0x20')](_0x5a320a));_0x28a4a7(_0x5a320a);})['catch'](function(_0x795f0f){logger['error'](_0x0679('0x1a'),_0x795f0f[_0x0679('0x18')],_0x503ef2);_0xb7b9a8(_0x5ade41[_0x0679('0x17')](0x1f4,_0x795f0f['message']));});});}; \ No newline at end of file +var _0x0fcc=['../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateChatMessage','ChatMessage','body','raw','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4ee792,_0x16c595){var _0x526542=function(_0x21b049){while(--_0x21b049){_0x4ee792['push'](_0x4ee792['shift']());}};_0x526542(++_0x16c595);}(_0x0fcc,0x8f));var _0xc0fc=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x0fcc[_0x3de8a4];return _0x4635cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc0fc('0x0'));var BPromise=require('bluebird');var rs=require(_0xc0fc('0x1'));var fs=require('fs');var Redis=require(_0xc0fc('0x2'));var db=require(_0xc0fc('0x3'))['db'];var utils=require(_0xc0fc('0x4'));var logger=require(_0xc0fc('0x5'))(_0xc0fc('0x6'));var config=require(_0xc0fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc0fc('0x8')][_0xc0fc('0x9')]({'port':0x232a});config[_0xc0fc('0xa')]=_['defaults'](config['redis'],{'host':_0xc0fc('0xb'),'port':0x18eb});var socket=require(_0xc0fc('0xc'))(new Redis(config[_0xc0fc('0xa')]));require('./chatMessage.socket')[_0xc0fc('0xd')](socket);function respondWithRpcPromise(_0x47a41e,_0x53e74f,_0x415fcb){return new BPromise(function(_0x2b931f,_0x5057d6){return client[_0xc0fc('0xe')](_0x47a41e,_0x415fcb)['then'](function(_0x203b4b){logger[_0xc0fc('0xf')](_0xc0fc('0x10'),_0x53e74f,_0xc0fc('0x11'));logger[_0xc0fc('0x12')](_0xc0fc('0x13'),_0x53e74f,_0xc0fc('0x11'),JSON[_0xc0fc('0x14')](_0x203b4b));if(_0x203b4b['error']){if(_0x203b4b['error'][_0xc0fc('0x15')]===0x1f4){logger[_0xc0fc('0x16')](_0xc0fc('0x10'),_0x53e74f,_0x203b4b['error'][_0xc0fc('0x17')]);return _0x5057d6(_0x203b4b[_0xc0fc('0x16')][_0xc0fc('0x17')]);}logger['error'](_0xc0fc('0x10'),_0x53e74f,_0x203b4b[_0xc0fc('0x16')][_0xc0fc('0x17')]);return _0x2b931f(_0x203b4b[_0xc0fc('0x16')]['message']);}else{logger[_0xc0fc('0xf')](_0xc0fc('0x10'),_0x53e74f,_0xc0fc('0x11'));_0x2b931f(_0x203b4b[_0xc0fc('0x18')][_0xc0fc('0x17')]);}})['catch'](function(_0x5f1c9c){logger['error'](_0xc0fc('0x10'),_0x53e74f,_0x5f1c9c);_0x5057d6(_0x5f1c9c);});});}exports[_0xc0fc('0x19')]=function(_0x387651){var _0x57bf40=this;return new Promise(function(_0x36cac5,_0x57b46f){return db[_0xc0fc('0x1a')]['create'](_0x387651[_0xc0fc('0x1b')],{'raw':_0x387651['options']?_0x387651['options'][_0xc0fc('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x35f1d7){logger['info'](_0xc0fc('0x19'),_0x387651);logger[_0xc0fc('0x12')](_0xc0fc('0x19'),_0x387651,JSON[_0xc0fc('0x14')](_0x35f1d7));_0x36cac5(_0x35f1d7);})[_0xc0fc('0x1d')](function(_0x4b3ce8){logger[_0xc0fc('0x16')](_0xc0fc('0x19'),_0x4b3ce8['message'],_0x387651);_0x57b46f(_0x57bf40[_0xc0fc('0x16')](0x1f4,_0x4b3ce8[_0xc0fc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 668230a..ef0e5db 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 _0x5ad3=['register','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x50aea5,_0x5dd077){_0x50aea5=_0x50aea5-0x0;var _0x4657f1=_0x5ad3[_0x50aea5];return _0x4657f1;};'use strict';var ChatMessageEvents=require(_0x35ad('0x0'));var events=[_0x35ad('0x1'),_0x35ad('0x2'),_0x35ad('0x3')];function createListener(_0x5543d1,_0x468072){return function(_0x373228){_0x468072[_0x35ad('0x4')](_0x5543d1,_0x373228);};}function removeListener(_0x69a0b3,_0x450f55){return function(){ChatMessageEvents[_0x35ad('0x5')](_0x69a0b3,_0x450f55);};}exports[_0x35ad('0x6')]=function(_0x436dcb){for(var _0x36c606=0x0,_0x31cc6a=events['length'];_0x36c606<_0x31cc6a;_0x36c606++){var _0x292521=events[_0x36c606];var _0x3cec3e=createListener(_0x35ad('0x7')+_0x292521,_0x436dcb);ChatMessageEvents['on'](_0x292521,_0x3cec3e);}}; \ No newline at end of file +var _0x9957=['register','length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var ChatMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){ChatMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);ChatMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ed068a0..8e67438 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 _0xa189=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa189,0xea));var _0x9a18=function(_0x35865f,_0x1e6ec1){_0x35865f=_0x35865f-0x0;var _0x13bd8f=_0xa189[_0x35865f];return _0x13bd8f;};'use strict';var multer=require(_0x9a18('0x0'));var util=require(_0x9a18('0x1'));var path=require(_0x9a18('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a18('0x3'));var router=express[_0x9a18('0x4')]();var fs_extra=require(_0x9a18('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9a18('0x6'));var config=require(_0x9a18('0x7'));var controller=require(_0x9a18('0x8'));router[_0x9a18('0x9')]('/',auth[_0x9a18('0xa')](),controller[_0x9a18('0xb')]);router['get'](_0x9a18('0xc'),auth[_0x9a18('0xa')](),controller[_0x9a18('0xd')]);router[_0x9a18('0x9')](_0x9a18('0xe'),auth[_0x9a18('0xa')](),controller[_0x9a18('0xf')]);router[_0x9a18('0x10')]('/',auth[_0x9a18('0xa')](),interaction['tracked'](_0x9a18('0x11'),_0x9a18('0x12')),controller[_0x9a18('0x13')]);router[_0x9a18('0x14')]('/:id',controller[_0x9a18('0x15')]);router[_0x9a18('0x14')](_0x9a18('0x16'),auth[_0x9a18('0xa')](),controller[_0x9a18('0x17')]);router['put'](_0x9a18('0x18'),auth[_0x9a18('0xa')](),controller[_0x9a18('0x19')]);router[_0x9a18('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x9a18('0x1b')]);module[_0x9a18('0x1c')]=router; \ No newline at end of file +var _0x9e73=['accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','/describe','describe','get','/:id','isAuthenticated','show','tracked','chatmessage:create','create','put','update','/:id/accept'];(function(_0x4a6b92,_0x53929c){var _0x303f17=function(_0x30a218){while(--_0x30a218){_0x4a6b92['push'](_0x4a6b92['shift']());}};_0x303f17(++_0x53929c);}(_0x9e73,0xce));var _0x39e7=function(_0x3303ca,_0xfc2b4d){_0x3303ca=_0x3303ca-0x0;var _0x4a3a1b=_0x9e73[_0x3303ca];return _0x4a3a1b;};'use strict';var multer=require(_0x39e7('0x0'));var util=require('util');var path=require(_0x39e7('0x1'));var timeout=require(_0x39e7('0x2'));var express=require(_0x39e7('0x3'));var router=express[_0x39e7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x39e7('0x5'));var config=require(_0x39e7('0x6'));var controller=require('./chatMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x39e7('0x7'),auth['isAuthenticated'](),controller[_0x39e7('0x8')]);router[_0x39e7('0x9')](_0x39e7('0xa'),auth[_0x39e7('0xb')](),controller[_0x39e7('0xc')]);router['post']('/',auth[_0x39e7('0xb')](),interaction[_0x39e7('0xd')]('chat',_0x39e7('0xe')),controller[_0x39e7('0xf')]);router[_0x39e7('0x10')](_0x39e7('0xa'),controller[_0x39e7('0x11')]);router[_0x39e7('0x10')](_0x39e7('0x12'),auth['isAuthenticated'](),controller[_0x39e7('0x13')]);router['put'](_0x39e7('0x14'),auth[_0x39e7('0xb')](),controller[_0x39e7('0x15')]);router[_0x39e7('0x16')](_0x39e7('0xa'),auth['isAuthenticated'](),controller[_0x39e7('0x17')]);module[_0x39e7('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 0f46d26..2fb6260 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x42f4a1,_0x53f9f7){var _0x179727=function(_0x4b183c){while(--_0x4b183c){_0x42f4a1['push'](_0x42f4a1['shift']());}};_0x179727(++_0x53f9f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d2aea,_0x4a8f11){_0x4d2aea=_0x4d2aea-0x0;var _0x1715b8=_0xb10b[_0x4d2aea];return _0x1715b8;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x757a=['exports','TEXT'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x757a,0xde));var _0xa757=function(_0x1fd2ac,_0x47608f){_0x1fd2ac=_0x1fd2ac-0x0;var _0x2aec24=_0x757a[_0x1fd2ac];return _0x2aec24;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 5e1b7d9..c03ccc5 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x7a54,0x106));var _0x47a5=function(_0x5867bc,_0x10363c){_0x5867bc=_0x5867bc-0x0;var _0x358318=_0x7a54[_0x5867bc];return _0x358318;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x7a54,0x106));var _0x47a5=function(_0x5ae965,_0x59769f){_0x5ae965=_0x5ae965-0x0;var _0x453a56=_0x7a54[_0x5ae965];return _0x453a56;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 5e8b135..aececf8 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd73=['events','../../mysqldb','ChatOfflineMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xdd73,0x14a));var _0x3dd7=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xdd73[_0x4fc80b];return _0x119dba;};'use strict';var EventEmitter=require(_0x3dd7('0x0'));var ChatOfflineMessage=require(_0x3dd7('0x1'))['db'][_0x3dd7('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3dd7('0x3'),'afterUpdate':_0x3dd7('0x4'),'afterDestroy':_0x3dd7('0x5')};function emitEvent(_0x31753b){return function(_0x527539,_0x45916f,_0x87da1e){ChatOfflineMessageEvents[_0x3dd7('0x6')](_0x31753b+':'+_0x527539['id'],_0x527539);ChatOfflineMessageEvents[_0x3dd7('0x6')](_0x31753b,_0x527539);_0x87da1e(null);};}for(var e in events){if(events[_0x3dd7('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x3dd7('0x8')](e,emitEvent(event));}}module[_0x3dd7('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xabee=['exports','setMaxListeners','save','update','remove','hook'];(function(_0xcf0c16,_0x5ca230){var _0x199cde=function(_0x4699d5){while(--_0x4699d5){_0xcf0c16['push'](_0xcf0c16['shift']());}};_0x199cde(++_0x5ca230);}(_0xabee,0x11b));var _0xeabe=function(_0xad2182,_0x16d18f){_0xad2182=_0xad2182-0x0;var _0x2275d0=_0xabee[_0xad2182];return _0x2275d0;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xeabe('0x0')](0x0);var events={'afterCreate':_0xeabe('0x1'),'afterUpdate':_0xeabe('0x2'),'afterDestroy':_0xeabe('0x3')};function emitEvent(_0x9e0ebe){return function(_0x44157e,_0x4e9b38,_0x45232c){ChatOfflineMessageEvents['emit'](_0x9e0ebe+':'+_0x44157e['id'],_0x44157e);ChatOfflineMessageEvents['emit'](_0x9e0ebe,_0x44157e);_0x45232c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xeabe('0x4')](e,emitEvent(event));}}module[_0xeabe('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2f550a6..714774d 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 _0xf61a=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','chat_offline_messages'];(function(_0xe0a18a,_0xf55a7f){var _0xf9d256=function(_0x362bc4){while(--_0x362bc4){_0xe0a18a['push'](_0xe0a18a['shift']());}};_0xf9d256(++_0xf55a7f);}(_0xf61a,0x1b5));var _0xaf61=function(_0x541790,_0x45b965){_0x541790=_0x541790-0x0;var _0x7f39ab=_0xf61a[_0x541790];return _0x7f39ab;};'use strict';var attributes=require(_0xaf61('0x0'));module['exports']=function(_0x1f21b0){return _0x1f21b0[_0xaf61('0x1')]('ChatOfflineMessage',attributes,{'tableName':_0xaf61('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaf61('0x3'),'collate':_0xaf61('0x4')});}; \ No newline at end of file +var _0x55cc=['exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x48916b,_0x23ee38){var _0x4d7a48=function(_0x28b741){while(--_0x28b741){_0x48916b['push'](_0x48916b['shift']());}};_0x4d7a48(++_0x23ee38);}(_0x55cc,0x1a9));var _0xc55c=function(_0x3d4790,_0x52b5c2){_0x3d4790=_0x3d4790-0x0;var _0x50c78d=_0x55cc[_0x3d4790];return _0x50c78d;};'use strict';var attributes=require(_0xc55c('0x0'));module[_0xc55c('0x1')]=function(_0x509305){return _0x509305['define'](_0xc55c('0x2'),attributes,{'tableName':_0xc55c('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc55c('0x4'),'collate':_0xc55c('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 09aff71..41e6212 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 _0xa318=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','randomstring'];(function(_0x420599,_0x1ca64e){var _0x217120=function(_0x1388e8){while(--_0x1388e8){_0x420599['push'](_0x420599['shift']());}};_0x217120(++_0x1ca64e);}(_0xa318,0x9c));var _0x8a31=function(_0x21ee7e,_0x54b695){_0x21ee7e=_0x21ee7e-0x0;var _0x2cbebe=_0xa318[_0x21ee7e];return _0x2cbebe;};'use strict';var _=require(_0x8a31('0x0'));var util=require(_0x8a31('0x1'));var moment=require(_0x8a31('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a31('0x3'));var fs=require('fs');var Redis=require(_0x8a31('0x4'));var db=require(_0x8a31('0x5'))['db'];var utils=require(_0x8a31('0x6'));var logger=require('../../config/logger')(_0x8a31('0x7'));var config=require('../../config/environment');var jayson=require(_0x8a31('0x8'));var client=jayson['client'][_0x8a31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e9905,_0x4f6ce8,_0x5b46fb){return new BPromise(function(_0x2cb37c,_0x24b501){return client[_0x8a31('0xa')](_0x2e9905,_0x5b46fb)[_0x8a31('0xb')](function(_0x180ebe){logger[_0x8a31('0xc')](_0x8a31('0xd'),_0x4f6ce8,_0x8a31('0xe'));logger[_0x8a31('0xf')](_0x8a31('0x10'),_0x4f6ce8,'request\x20sent',JSON['stringify'](_0x180ebe));if(_0x180ebe[_0x8a31('0x11')]){if(_0x180ebe[_0x8a31('0x11')][_0x8a31('0x12')]===0x1f4){logger[_0x8a31('0x11')](_0x8a31('0xd'),_0x4f6ce8,_0x180ebe[_0x8a31('0x11')][_0x8a31('0x13')]);return _0x24b501(_0x180ebe[_0x8a31('0x11')][_0x8a31('0x13')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x4f6ce8,_0x180ebe[_0x8a31('0x11')][_0x8a31('0x13')]);return _0x2cb37c(_0x180ebe[_0x8a31('0x11')]['message']);}else{logger['info'](_0x8a31('0xd'),_0x4f6ce8,_0x8a31('0xe'));_0x2cb37c(_0x180ebe['result'][_0x8a31('0x13')]);}})['catch'](function(_0x581745){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x4f6ce8,_0x581745);_0x24b501(_0x581745);});});} \ No newline at end of file +var _0xc55d=['rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x88c06b,_0x4dc671){var _0x1b7bc8=function(_0x10a3dc){while(--_0x10a3dc){_0x88c06b['push'](_0x88c06b['shift']());}};_0x1b7bc8(++_0x4dc671);}(_0xc55d,0x1d9));var _0xdc55=function(_0xf5dc25,_0x76a7c){_0xf5dc25=_0xf5dc25-0x0;var _0x453ea6=_0xc55d[_0xf5dc25];return _0x453ea6;};'use strict';var _=require(_0xdc55('0x0'));var util=require(_0xdc55('0x1'));var moment=require(_0xdc55('0x2'));var BPromise=require(_0xdc55('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc55('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc55('0x5'));var logger=require(_0xdc55('0x6'))(_0xdc55('0x7'));var config=require(_0xdc55('0x8'));var jayson=require(_0xdc55('0x9'));var client=jayson[_0xdc55('0xa')][_0xdc55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x456903,_0x58699e,_0x42c02a){return new BPromise(function(_0x27c1c8,_0x28c5bd){return client[_0xdc55('0xc')](_0x456903,_0x42c02a)[_0xdc55('0xd')](function(_0x3b788d){logger['info'](_0xdc55('0xe'),_0x58699e,_0xdc55('0xf'));logger[_0xdc55('0x10')](_0xdc55('0x11'),_0x58699e,_0xdc55('0xf'),JSON[_0xdc55('0x12')](_0x3b788d));if(_0x3b788d[_0xdc55('0x13')]){if(_0x3b788d[_0xdc55('0x13')][_0xdc55('0x14')]===0x1f4){logger[_0xdc55('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x58699e,_0x3b788d[_0xdc55('0x13')]['message']);return _0x28c5bd(_0x3b788d[_0xdc55('0x13')][_0xdc55('0x15')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x58699e,_0x3b788d[_0xdc55('0x13')]['message']);return _0x27c1c8(_0x3b788d[_0xdc55('0x13')]['message']);}else{logger['info'](_0xdc55('0xe'),_0x58699e,_0xdc55('0xf'));_0x27c1c8(_0x3b788d[_0xdc55('0x16')][_0xdc55('0x15')]);}})[_0xdc55('0x17')](function(_0x2e9dc2){logger['error'](_0xdc55('0xe'),_0x58699e,_0x2e9dc2);_0x28c5bd(_0x2e9dc2);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6d1d173..25ea6a6 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 _0xfaf2=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','util'];(function(_0x446eb9,_0x47a77e){var _0x38e599=function(_0x3d5353){while(--_0x3d5353){_0x446eb9['push'](_0x446eb9['shift']());}};_0x38e599(++_0x47a77e);}(_0xfaf2,0x17b));var _0x2faf=function(_0x99d87d,_0x2e4b20){_0x99d87d=_0x99d87d-0x0;var _0x4e49b6=_0xfaf2[_0x99d87d];return _0x4e49b6;};'use strict';var multer=require('multer');var util=require(_0x2faf('0x0'));var path=require(_0x2faf('0x1'));var timeout=require(_0x2faf('0x2'));var express=require(_0x2faf('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2faf('0x4'));var interaction=require(_0x2faf('0x5'));var config=require('../../config/environment');var controller=require(_0x2faf('0x6'));router[_0x2faf('0x7')]('/',auth[_0x2faf('0x8')](),controller[_0x2faf('0x9')]);router[_0x2faf('0x7')](_0x2faf('0xa'),auth[_0x2faf('0x8')](),controller[_0x2faf('0xb')]);router[_0x2faf('0x7')](_0x2faf('0xc'),auth[_0x2faf('0x8')](),controller[_0x2faf('0xd')]);router[_0x2faf('0xe')]('/',auth[_0x2faf('0x8')](),controller[_0x2faf('0xf')]);router['put'](_0x2faf('0xc'),auth[_0x2faf('0x8')](),controller[_0x2faf('0x10')]);router[_0x2faf('0x11')](_0x2faf('0xc'),auth[_0x2faf('0x8')](),controller[_0x2faf('0x12')]);module[_0x2faf('0x13')]=router; \ No newline at end of file +var _0xf825=['isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./chatOfflineMessage.controller','get'];(function(_0x55f262,_0x128c2a){var _0x87c97=function(_0x291176){while(--_0x291176){_0x55f262['push'](_0x55f262['shift']());}};_0x87c97(++_0x128c2a);}(_0xf825,0x128));var _0x5f82=function(_0x95a30d,_0x4f7559){_0x95a30d=_0x95a30d-0x0;var _0x12f1d3=_0xf825[_0x95a30d];return _0x12f1d3;};'use strict';var multer=require(_0x5f82('0x0'));var util=require('util');var path=require(_0x5f82('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f82('0x2'));var router=express[_0x5f82('0x3')]();var fs_extra=require(_0x5f82('0x4'));var auth=require(_0x5f82('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5f82('0x6'));router[_0x5f82('0x7')]('/',auth[_0x5f82('0x8')](),controller[_0x5f82('0x9')]);router[_0x5f82('0x7')](_0x5f82('0xa'),auth[_0x5f82('0x8')](),controller[_0x5f82('0xb')]);router[_0x5f82('0x7')](_0x5f82('0xc'),auth[_0x5f82('0x8')](),controller[_0x5f82('0xd')]);router['post']('/',auth[_0x5f82('0x8')](),controller[_0x5f82('0xe')]);router[_0x5f82('0xf')](_0x5f82('0xc'),auth[_0x5f82('0x8')](),controller[_0x5f82('0x10')]);router['delete'](_0x5f82('0xc'),auth[_0x5f82('0x8')](),controller[_0x5f82('0x11')]);module[_0x5f82('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 d52ff96..6eba807 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 _0xd57f=['exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd57f,0x120));var _0xfd57=function(_0x564aee,_0x248153){_0x564aee=_0x564aee-0x0;var _0x506fb5=_0xd57f[_0x564aee];return _0x506fb5;};'use strict';var Sequelize=require('sequelize');module[_0xfd57('0x0')]={'name':{'type':Sequelize[_0xfd57('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfd57('0x2')](_0xfd57('0x3'),_0xfd57('0x4')),'defaultValue':_0xfd57('0x3')},'selector':{'type':Sequelize[_0xfd57('0x1')]},'timeout':{'type':Sequelize[_0xfd57('0x5')]}}; \ No newline at end of file +var _0x417b=['timeout','mouseOver','INTEGER','sequelize','exports','ENUM'];(function(_0x181971,_0x29b426){var _0x840c2f=function(_0x824eab){while(--_0x824eab){_0x181971['push'](_0x181971['shift']());}};_0x840c2f(++_0x29b426);}(_0x417b,0x81));var _0xb417=function(_0x19e2ac,_0x3aa1b0){_0x19e2ac=_0x19e2ac-0x0;var _0x262bfc=_0x417b[_0x19e2ac];return _0x262bfc;};'use strict';var Sequelize=require(_0xb417('0x0'));module[_0xb417('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb417('0x2')]('mouseOver',_0xb417('0x3')),'defaultValue':_0xb417('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb417('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 6cb313e..f0fe2b8 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 _0x08d9=['query','intersection','attributes','fields','length','includeAll','options','catch','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes'];(function(_0x137c96,_0x50fe69){var _0x5af958=function(_0x1bb57a){while(--_0x1bb57a){_0x137c96['push'](_0x137c96['shift']());}};_0x5af958(++_0x50fe69);}(_0x08d9,0xc2));var _0x908d=function(_0x5c683b,_0x4a8caf){_0x5c683b=_0x5c683b-0x0;var _0x1b8efd=_0x08d9[_0x5c683b];return _0x1b8efd;};'use strict';var emlformat=require(_0x908d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x908d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x908d('0x2'));var moment=require(_0x908d('0x3'));var BPromise=require(_0x908d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x908d('0x5'));var sox=require(_0x908d('0x6'));var csv=require(_0x908d('0x7'));var ejs=require(_0x908d('0x8'));var fs=require('fs');var fs_extra=require(_0x908d('0x9'));var _=require('lodash');var squel=require(_0x908d('0xa'));var crypto=require(_0x908d('0xb'));var jsforce=require(_0x908d('0xc'));var deskjs=require(_0x908d('0xd'));var toCsv=require(_0x908d('0x7'));var querystring=require(_0x908d('0xe'));var Papa=require(_0x908d('0xf'));var Redis=require(_0x908d('0x10'));var authService=require(_0x908d('0x11'));var qs=require(_0x908d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x908d('0x13'));var logger=require(_0x908d('0x14'))(_0x908d('0x15'));var utils=require(_0x908d('0x16'));var config=require(_0x908d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x588cc3,_0x3213df){_0x3213df=_0x3213df||0xcc;return function(_0x2c92df){if(_0x2c92df){return _0x588cc3[_0x908d('0x18')](_0x3213df);}return _0x588cc3[_0x908d('0x19')](_0x3213df)[_0x908d('0x1a')]();};}function respondWithResult(_0x3c1149,_0x9dbb7f){_0x9dbb7f=_0x9dbb7f||0xc8;return function(_0x4dcd6f){if(_0x4dcd6f){return _0x3c1149['status'](_0x9dbb7f)[_0x908d('0x1b')](_0x4dcd6f);}};}function respondWithFilteredResult(_0x207ac1,_0x178809){return function(_0x3cddfa){if(_0x3cddfa){var _0x5d7f40=typeof _0x178809['offset']===_0x908d('0x1c')&&typeof _0x178809[_0x908d('0x1d')]===_0x908d('0x1c');var _0x3f1c00=_0x3cddfa['count'];var _0x9438c7=_0x5d7f40?0x0:_0x178809[_0x908d('0x1e')];var _0x3dea46=_0x5d7f40?_0x3cddfa[_0x908d('0x1f')]:_0x178809[_0x908d('0x1e')]+_0x178809[_0x908d('0x1d')];var _0x10137f;if(_0x3dea46>=_0x3f1c00){_0x3dea46=_0x3f1c00;_0x10137f=0xc8;}else{_0x10137f=0xce;}_0x207ac1['status'](_0x10137f);return _0x207ac1[_0x908d('0x20')](_0x908d('0x21'),_0x9438c7+'-'+_0x3dea46+'/'+_0x3f1c00)[_0x908d('0x1b')](_0x3cddfa);}return null;};}function patchUpdates(_0x48ef83){return function(_0x37a7b8){try{jsonpatch[_0x908d('0x22')](_0x37a7b8,_0x48ef83,!![]);}catch(_0xdc1474){return BPromise[_0x908d('0x23')](_0xdc1474);}return _0x37a7b8[_0x908d('0x24')]();};}function saveUpdates(_0x53d9bb,_0x3a06c7){return function(_0x4a0875){if(_0x4a0875){return _0x4a0875[_0x908d('0x25')](_0x53d9bb)[_0x908d('0x26')](function(_0x4606a7){return _0x4606a7;});}return null;};}function removeEntity(_0x307b47,_0x43492b){return function(_0x423806){if(_0x423806){return _0x423806[_0x908d('0x27')]()[_0x908d('0x26')](function(){_0x307b47['status'](0xcc)[_0x908d('0x1a')]();});}};}function handleEntityNotFound(_0x1b5514,_0x41aba0){return function(_0x269e36){if(!_0x269e36){_0x1b5514[_0x908d('0x18')](0x194);}return _0x269e36;};}function handleError(_0x56538a,_0x5cd721){_0x5cd721=_0x5cd721||0x1f4;return function(_0x4488e8){logger[_0x908d('0x28')](_0x4488e8[_0x908d('0x29')]);if(_0x4488e8[_0x908d('0x2a')]){delete _0x4488e8[_0x908d('0x2a')];}_0x56538a['status'](_0x5cd721)[_0x908d('0x2b')](_0x4488e8);};}exports[_0x908d('0x2c')]=function(_0x5f529e,_0x163fdd){var _0x40b418={'raw':!![],'where':{'id':_0x5f529e[_0x908d('0x2d')]['id']}},_0x21c6b8={};_0x21c6b8[_0x908d('0x2e')]=_[_0x908d('0x2f')](db[_0x908d('0x30')][_0x908d('0x31')]);_0x21c6b8[_0x908d('0x32')]=_[_0x908d('0x2f')](_0x5f529e[_0x908d('0x32')]);_0x21c6b8['filters']=_[_0x908d('0x33')](_0x21c6b8[_0x908d('0x2e')],_0x21c6b8[_0x908d('0x32')]);_0x40b418[_0x908d('0x34')]=_['intersection'](_0x21c6b8[_0x908d('0x2e')],qs[_0x908d('0x35')](_0x5f529e[_0x908d('0x32')][_0x908d('0x35')]));_0x40b418[_0x908d('0x34')]=_0x40b418[_0x908d('0x34')][_0x908d('0x36')]?_0x40b418[_0x908d('0x34')]:_0x21c6b8[_0x908d('0x2e')];if(_0x5f529e[_0x908d('0x32')][_0x908d('0x37')]){_0x40b418['include']=[{'all':!![]}];}_0x40b418=_['merge']({},_0x40b418,_0x5f529e[_0x908d('0x38')]);return db[_0x908d('0x30')]['find'](_0x40b418)['then'](handleEntityNotFound(_0x163fdd,null))[_0x908d('0x26')](respondWithResult(_0x163fdd,null))[_0x908d('0x39')](handleError(_0x163fdd,null));};exports[_0x908d('0x3a')]=function(_0x451504,_0x1ebb8f){return db['ChatProactiveAction'][_0x908d('0x3a')](_0x451504[_0x908d('0x3b')],{})[_0x908d('0x26')](respondWithResult(_0x1ebb8f,0xc9))[_0x908d('0x39')](handleError(_0x1ebb8f,null));};exports[_0x908d('0x25')]=function(_0x4a6751,_0x5e626e){if(_0x4a6751[_0x908d('0x3b')]['id']){delete _0x4a6751['body']['id'];}return db[_0x908d('0x30')][_0x908d('0x3c')]({'where':{'id':_0x4a6751[_0x908d('0x2d')]['id']}})[_0x908d('0x26')](handleEntityNotFound(_0x5e626e,null))[_0x908d('0x26')](saveUpdates(_0x4a6751[_0x908d('0x3b')],null))[_0x908d('0x26')](respondWithResult(_0x5e626e,null))[_0x908d('0x39')](handleError(_0x5e626e,null));};exports['destroy']=function(_0x4afb7f,_0xe5b38e){return db[_0x908d('0x30')][_0x908d('0x3c')]({'where':{'id':_0x4afb7f['params']['id']}})['then'](handleEntityNotFound(_0xe5b38e,null))['then'](removeEntity(_0xe5b38e,null))[_0x908d('0x39')](handleError(_0xe5b38e,null));}; \ No newline at end of file +var _0x4b84=['name','show','params','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','ChatProactiveAction','find','catch','create','body','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','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x15f685,_0x39436d){var _0x171efd=function(_0x424b88){while(--_0x424b88){_0x15f685['push'](_0x15f685['shift']());}};_0x171efd(++_0x39436d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x4b84[_0x2160a9];return _0xa88cf7;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x25a0c1,_0x47689e){return function(_0x230a3d){if(!_0x230a3d){_0x25a0c1['sendStatus'](0x194);}return _0x230a3d;};}function handleError(_0x474f01,_0x502acf){_0x502acf=_0x502acf||0x1f4;return function(_0x41d673){logger[_0x44b8('0x22')](_0x41d673['stack']);if(_0x41d673[_0x44b8('0x23')]){delete _0x41d673[_0x44b8('0x23')];}_0x474f01[_0x44b8('0x14')](_0x502acf)['send'](_0x41d673);};}exports[_0x44b8('0x24')]=function(_0x242342,_0x53d9c7){var _0x2e0174={'raw':!![],'where':{'id':_0x242342[_0x44b8('0x25')]['id']}},_0x4a182d={};_0x4a182d['model']=_['keys'](db['ChatProactiveAction'][_0x44b8('0x26')]);_0x4a182d[_0x44b8('0x27')]=_[_0x44b8('0x28')](_0x242342[_0x44b8('0x27')]);_0x4a182d[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_0x4a182d[_0x44b8('0x2b')],_0x4a182d[_0x44b8('0x27')]);_0x2e0174[_0x44b8('0x2c')]=_[_0x44b8('0x2a')](_0x4a182d[_0x44b8('0x2b')],qs[_0x44b8('0x2d')](_0x242342[_0x44b8('0x27')]['fields']));_0x2e0174[_0x44b8('0x2c')]=_0x2e0174['attributes'][_0x44b8('0x2e')]?_0x2e0174[_0x44b8('0x2c')]:_0x4a182d[_0x44b8('0x2b')];if(_0x242342[_0x44b8('0x27')][_0x44b8('0x2f')]){_0x2e0174['include']=[{'all':!![]}];}_0x2e0174=_[_0x44b8('0x30')]({},_0x2e0174,_0x242342[_0x44b8('0x31')]);return db[_0x44b8('0x32')][_0x44b8('0x33')](_0x2e0174)[_0x44b8('0x20')](handleEntityNotFound(_0x53d9c7,null))['then'](respondWithResult(_0x53d9c7,null))[_0x44b8('0x34')](handleError(_0x53d9c7,null));};exports[_0x44b8('0x35')]=function(_0x1a30fc,_0x3e93af){return db[_0x44b8('0x32')][_0x44b8('0x35')](_0x1a30fc[_0x44b8('0x36')],{})[_0x44b8('0x20')](respondWithResult(_0x3e93af,0xc9))[_0x44b8('0x34')](handleError(_0x3e93af,null));};exports[_0x44b8('0x1f')]=function(_0x13994c,_0xce304d){if(_0x13994c[_0x44b8('0x36')]['id']){delete _0x13994c[_0x44b8('0x36')]['id'];}return db[_0x44b8('0x32')][_0x44b8('0x33')]({'where':{'id':_0x13994c[_0x44b8('0x25')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0xce304d,null))[_0x44b8('0x20')](saveUpdates(_0x13994c[_0x44b8('0x36')],null))[_0x44b8('0x20')](respondWithResult(_0xce304d,null))[_0x44b8('0x34')](handleError(_0xce304d,null));};exports['destroy']=function(_0x1e2420,_0xd61f14){return db['ChatProactiveAction'][_0x44b8('0x33')]({'where':{'id':_0x1e2420[_0x44b8('0x25')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0xd61f14,null))[_0x44b8('0x20')](removeEntity(_0xd61f14,null))['catch'](handleError(_0xd61f14,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 84e776e..bc19f1d 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 _0x41c1=['ChatProactiveAction','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','define'];(function(_0x44fc42,_0x260da5){var _0x6fdb19=function(_0x4d6d40){while(--_0x4d6d40){_0x44fc42['push'](_0x44fc42['shift']());}};_0x6fdb19(++_0x260da5);}(_0x41c1,0xdd));var _0x141c=function(_0x50499c,_0x188984){_0x50499c=_0x50499c-0x0;var _0xd422b3=_0x41c1[_0x50499c];return _0xd422b3;};'use strict';var _=require(_0x141c('0x0'));var util=require(_0x141c('0x1'));var logger=require(_0x141c('0x2'))(_0x141c('0x3'));var moment=require(_0x141c('0x4'));var BPromise=require('bluebird');var rp=require(_0x141c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x141c('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x141c('0x7')]=function(_0x23929d,_0x4922b7){return _0x23929d[_0x141c('0x8')](_0x141c('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb34f=['define','ChatProactiveAction','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x362046,_0x5cf93f){var _0x419ffe=function(_0x18cb42){while(--_0x18cb42){_0x362046['push'](_0x362046['shift']());}};_0x419ffe(++_0x5cf93f);}(_0xb34f,0x1db));var _0xfb34=function(_0x377909,_0x4f4b84){_0x377909=_0x377909-0x0;var _0x80cfff=_0xb34f[_0x377909];return _0x80cfff;};'use strict';var _=require(_0xfb34('0x0'));var util=require(_0xfb34('0x1'));var logger=require(_0xfb34('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfb34('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb34('0x4'));var rimraf=require(_0xfb34('0x5'));var config=require(_0xfb34('0x6'));var attributes=require(_0xfb34('0x7'));module[_0xfb34('0x8')]=function(_0x3d8ecf,_0x5a4f92){return _0x3d8ecf[_0xfb34('0x9')](_0xfb34('0xa'),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 0ede0fd..62a6815 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 _0x4695=['lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x489880,_0xd46e71){var _0x4465dd=function(_0xbf8380){while(--_0xbf8380){_0x489880['push'](_0x489880['shift']());}};_0x4465dd(++_0xd46e71);}(_0x4695,0x72));var _0x5469=function(_0x156907,_0x398b15){_0x156907=_0x156907-0x0;var _0x31bc30=_0x4695[_0x156907];return _0x31bc30;};'use strict';var _=require(_0x5469('0x0'));var util=require('util');var moment=require(_0x5469('0x1'));var BPromise=require(_0x5469('0x2'));var rs=require(_0x5469('0x3'));var fs=require('fs');var Redis=require(_0x5469('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5469('0x5'))(_0x5469('0x6'));var config=require(_0x5469('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5469('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f00cd,_0xaa3289,_0x228dc4){return new BPromise(function(_0x108b50,_0x528611){return client['request'](_0x2f00cd,_0x228dc4)[_0x5469('0x9')](function(_0x529b36){logger[_0x5469('0xa')](_0x5469('0xb'),_0xaa3289,_0x5469('0xc'));logger['debug'](_0x5469('0xd'),_0xaa3289,_0x5469('0xc'),JSON[_0x5469('0xe')](_0x529b36));if(_0x529b36[_0x5469('0xf')]){if(_0x529b36['error']['code']===0x1f4){logger[_0x5469('0xf')](_0x5469('0xb'),_0xaa3289,_0x529b36[_0x5469('0xf')][_0x5469('0x10')]);return _0x528611(_0x529b36[_0x5469('0xf')][_0x5469('0x10')]);}logger['error'](_0x5469('0xb'),_0xaa3289,_0x529b36[_0x5469('0xf')][_0x5469('0x10')]);return _0x108b50(_0x529b36[_0x5469('0xf')]['message']);}else{logger[_0x5469('0xa')](_0x5469('0xb'),_0xaa3289,_0x5469('0xc'));_0x108b50(_0x529b36[_0x5469('0x11')][_0x5469('0x10')]);}})[_0x5469('0x12')](function(_0x6ffff7){logger[_0x5469('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0xaa3289,_0x6ffff7);_0x528611(_0x6ffff7);});});} \ No newline at end of file +var _0x723f=['code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x58a1a3,_0x5f54a8){var _0x5d5e22=function(_0x445527){while(--_0x445527){_0x58a1a3['push'](_0x58a1a3['shift']());}};_0x5d5e22(++_0x5f54a8);}(_0x723f,0xd6));var _0xf723=function(_0x20c0f5,_0x490a09){_0x20c0f5=_0x20c0f5-0x0;var _0x2a1933=_0x723f[_0x20c0f5];return _0x2a1933;};'use strict';var _=require('lodash');var util=require(_0xf723('0x0'));var moment=require('moment');var BPromise=require(_0xf723('0x1'));var rs=require(_0xf723('0x2'));var fs=require('fs');var Redis=require(_0xf723('0x3'));var db=require(_0xf723('0x4'))['db'];var utils=require(_0xf723('0x5'));var logger=require(_0xf723('0x6'))(_0xf723('0x7'));var config=require(_0xf723('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf723('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25fc17,_0x5edc7e,_0x5acc5e){return new BPromise(function(_0x220d8a,_0x221f8d){return client[_0xf723('0xa')](_0x25fc17,_0x5acc5e)['then'](function(_0x53367e){logger[_0xf723('0xb')](_0xf723('0xc'),_0x5edc7e,'request\x20sent');logger[_0xf723('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5edc7e,_0xf723('0xe'),JSON[_0xf723('0xf')](_0x53367e));if(_0x53367e[_0xf723('0x10')]){if(_0x53367e[_0xf723('0x10')][_0xf723('0x11')]===0x1f4){logger[_0xf723('0x10')](_0xf723('0xc'),_0x5edc7e,_0x53367e[_0xf723('0x10')][_0xf723('0x12')]);return _0x221f8d(_0x53367e[_0xf723('0x10')][_0xf723('0x12')]);}logger[_0xf723('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x5edc7e,_0x53367e['error'][_0xf723('0x12')]);return _0x220d8a(_0x53367e[_0xf723('0x10')][_0xf723('0x12')]);}else{logger[_0xf723('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x5edc7e,'request\x20sent');_0x220d8a(_0x53367e[_0xf723('0x13')][_0xf723('0x12')]);}})[_0xf723('0x14')](function(_0x1fc369){logger[_0xf723('0x10')](_0xf723('0xc'),_0x5edc7e,_0x1fc369);_0x221f8d(_0x1fc369);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ac3b55f..6b0a8d0 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 _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x2f822e,_0xbffb52){var _0x49bb6a=function(_0x5446dd){while(--_0x5446dd){_0x2f822e['push'](_0x2f822e['shift']());}};_0x49bb6a(++_0xbffb52);}(_0xeda8,0x104));var _0x8eda=function(_0x2f7354,_0x2ddc06){_0x2f7354=_0x2f7354-0x0;var _0xea2201=_0xeda8[_0x2f7354];return _0xea2201;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('0x11')]=router; \ No newline at end of file +var _0x5075=['show','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated'];(function(_0x413689,_0x3b9b97){var _0x3d3c57=function(_0x3b4a5e){while(--_0x3b4a5e){_0x413689['push'](_0x413689['shift']());}};_0x3d3c57(++_0x3b9b97);}(_0x5075,0x73));var _0x5507=function(_0x8be9fb,_0x2f90d9){_0x8be9fb=_0x8be9fb-0x0;var _0x3b41ac=_0x5075[_0x8be9fb];return _0x3b41ac;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/:id',auth[_0x5507('0xa')](),controller[_0x5507('0xb')]);router['post']('/',auth[_0x5507('0xa')](),controller[_0x5507('0xc')]);router[_0x5507('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')](_0x5507('0x10'),auth[_0x5507('0xa')](),controller['destroy']);module[_0x5507('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b888ad3..c2e3de6 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 _0x104d=['rrmemory','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x7b7ac,_0x5e0377){var _0x208966=function(_0x4887c2){while(--_0x4887c2){_0x7b7ac['push'](_0x7b7ac['shift']());}};_0x208966(++_0x5e0377);}(_0x104d,0x1d0));var _0xd104=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x104d[_0x83af7f];return _0x32d85c;};'use strict';var Sequelize=require('sequelize');module[_0xd104('0x0')]={'name':{'type':Sequelize[_0xd104('0x1')],'unique':_0xd104('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd104('0x1')]},'timeout':{'type':Sequelize[_0xd104('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd104('0x4')](_0xd104('0x5'),'beepall',_0xd104('0x6'))}}; \ No newline at end of file +var _0xc584=['name','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x55bd12,_0x4dbbb9){var _0x5990f4=function(_0xa59be5){while(--_0xa59be5){_0x55bd12['push'](_0x55bd12['shift']());}};_0x5990f4(++_0x4dbbb9);}(_0xc584,0x136));var _0x4c58=function(_0x5f002d,_0x1b9dc8){_0x5f002d=_0x5f002d-0x0;var _0x544598=_0xc584[_0x5f002d];return _0x544598;};'use strict';var Sequelize=require(_0x4c58('0x0'));module[_0x4c58('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4c58('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4c58('0x3')]},'timeout':{'type':Sequelize[_0x4c58('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4c58('0x5')]('rrmemory',_0x4c58('0x6'),_0x4c58('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e5facc4..52d41a3 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 _0x32ef=['sort','pick','ChatQueueId','findAll','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','Team','filter','nolimit','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','value','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','fieldName','type','key','getOptions','where','query','rows','catch','show','model','keys','filters','attributes','intersection','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','rawAttributes','hasOwnProperty','order'];(function(_0x5a5f9e,_0x4a89c2){var _0x1bec0c=function(_0xcd2793){while(--_0xcd2793){_0x5a5f9e['push'](_0x5a5f9e['shift']());}};_0x1bec0c(++_0x4a89c2);}(_0x32ef,0x1a5));var _0xf32e=function(_0x5c9d0f,_0x2d0b5f){_0x5c9d0f=_0x5c9d0f-0x0;var _0x39f1d8=_0x32ef[_0x5c9d0f];return _0x39f1d8;};'use strict';var BPromise=require('bluebird');var util=require(_0xf32e('0x0'));var _=require(_0xf32e('0x1'));var squel=require(_0xf32e('0x2'));var Redis=require('ioredis');var qs=require(_0xf32e('0x3'));var logger=require(_0xf32e('0x4'))(_0xf32e('0x5'));var config=require(_0xf32e('0x6'));var db=require(_0xf32e('0x7'))['db'];config[_0xf32e('0x8')]=_[_0xf32e('0x9')](config[_0xf32e('0x8')],{'host':_0xf32e('0xa'),'port':0x18eb});var socket=require(_0xf32e('0xb'))(new Redis(config[_0xf32e('0x8')]));require(_0xf32e('0xc'))[_0xf32e('0xd')](socket);function respondWithStatusCode(_0x53cea4,_0x677c33){_0x677c33=_0x677c33||0xcc;return function(_0x1e4e94){if(_0x1e4e94){return _0x53cea4[_0xf32e('0xe')](_0x677c33);}return _0x53cea4[_0xf32e('0xf')](_0x677c33)[_0xf32e('0x10')]();};}function respondWithResult(_0x45ccac,_0x6727fa){_0x6727fa=_0x6727fa||0xc8;return function(_0x499c38){if(_0x499c38){return _0x45ccac[_0xf32e('0xf')](_0x6727fa)['json'](_0x499c38);}};}function respondWithFilteredResult(_0x26131e,_0x4b2109){return function(_0x451098){if(_0x451098){var _0x2b372d=typeof _0x4b2109[_0xf32e('0x11')]===_0xf32e('0x12')&&typeof _0x4b2109[_0xf32e('0x13')]===_0xf32e('0x12');var _0x262b18=_0x451098[_0xf32e('0x14')];var _0x15041e=_0x2b372d?0x0:_0x4b2109[_0xf32e('0x11')];var _0x22cc4c=_0x2b372d?_0x451098[_0xf32e('0x14')]:_0x4b2109['offset']+_0x4b2109[_0xf32e('0x13')];var _0x1884b4;if(_0x22cc4c>=_0x262b18){_0x22cc4c=_0x262b18;_0x1884b4=0xc8;}else{_0x1884b4=0xce;}_0x26131e[_0xf32e('0xf')](_0x1884b4);return _0x26131e['set']('Content-Range',_0x15041e+'-'+_0x22cc4c+'/'+_0x262b18)[_0xf32e('0x15')](_0x451098);}return null;};}function saveUpdates(_0x2241bc){return function(_0xbcc4c1){if(_0xbcc4c1){return _0xbcc4c1[_0xf32e('0x16')](_0x2241bc)[_0xf32e('0x17')](function(_0x1a8eea){return _0x1a8eea;});}return null;};}function removeEntity(_0x36f9b1){return function(_0x43fe5e){if(_0x43fe5e){return _0x43fe5e[_0xf32e('0x18')]()[_0xf32e('0x17')](function(){var _0x2ff9b9=_0x43fe5e[_0xf32e('0x19')]({'plain':!![]});var _0x5df040=_0xf32e('0x1a');return db[_0xf32e('0x1b')][_0xf32e('0x18')]({'where':{'type':_0x5df040,'resourceId':_0x2ff9b9['id']}})[_0xf32e('0x17')](function(){return _0x43fe5e;});})[_0xf32e('0x17')](function(){_0x36f9b1[_0xf32e('0xf')](0xcc)[_0xf32e('0x10')]();});}};}function handleEntityNotFound(_0x149b9a){return function(_0x2c9f2d){if(!_0x2c9f2d){_0x149b9a[_0xf32e('0xe')](0x194);}return _0x2c9f2d;};}function handleError(_0x5d5c34,_0x236eaa){_0x236eaa=_0x236eaa||0x1f4;return function(_0x471e2e){logger[_0xf32e('0x1c')](_0x471e2e[_0xf32e('0x1d')]);if(_0x471e2e[_0xf32e('0x1e')]){delete _0x471e2e[_0xf32e('0x1e')];}_0x5d5c34[_0xf32e('0xf')](_0x236eaa)[_0xf32e('0x1f')](_0x471e2e);};}exports[_0xf32e('0x20')]=function(_0x2078a9,_0x3ebcb6){var _0x2c1c09={};var _0x50b3c4={'count':0x0,'rows':[]};var _0x4a9cc6=_[_0xf32e('0x21')](db[_0xf32e('0x22')]['rawAttributes'],function(_0x4ef589){return{'name':_0x4ef589[_0xf32e('0x23')],'type':_0x4ef589[_0xf32e('0x24')][_0xf32e('0x25')]};});_0x2c1c09=qs[_0xf32e('0x26')](_0x4a9cc6,_0x2078a9);var _0x4c8c1c={'where':_0x2c1c09[_0xf32e('0x27')]};return db['ChatQueue'][_0xf32e('0x14')](_0x4c8c1c)[_0xf32e('0x17')](function(_0x257026){_0x50b3c4[_0xf32e('0x14')]=_0x257026;_0x2c1c09['include']=qs['include'](_0x2078a9[_0xf32e('0x28')]);return db[_0xf32e('0x22')]['findAll'](_0x2c1c09);})['then'](function(_0x26dd52){_0x50b3c4[_0xf32e('0x29')]=_0x26dd52;return _0x50b3c4;})[_0xf32e('0x17')](respondWithFilteredResult(_0x3ebcb6,_0x2c1c09))[_0xf32e('0x2a')](handleError(_0x3ebcb6,null));};exports[_0xf32e('0x2b')]=function(_0x339172,_0xc1b59e){var _0x444ab3={'raw':!![],'where':{'id':_0x339172['params']['id']}},_0xc5f8e4={};_0xc5f8e4[_0xf32e('0x2c')]=_[_0xf32e('0x2d')](db[_0xf32e('0x22')]['rawAttributes']);_0xc5f8e4[_0xf32e('0x28')]=_[_0xf32e('0x2d')](_0x339172[_0xf32e('0x28')]);_0xc5f8e4[_0xf32e('0x2e')]=_['intersection'](_0xc5f8e4['model'],_0xc5f8e4['query']);_0x444ab3[_0xf32e('0x2f')]=_[_0xf32e('0x30')](_0xc5f8e4['model'],qs[_0xf32e('0x31')](_0x339172[_0xf32e('0x28')][_0xf32e('0x31')]));_0x444ab3[_0xf32e('0x2f')]=_0x444ab3[_0xf32e('0x2f')][_0xf32e('0x32')]?_0x444ab3[_0xf32e('0x2f')]:_0xc5f8e4['model'];if(_0x339172[_0xf32e('0x28')]['includeAll']){_0x444ab3['include']=[{'all':!![]}];}_0x444ab3=_[_0xf32e('0x33')]({},_0x444ab3,_0x339172[_0xf32e('0x34')]);return db[_0xf32e('0x22')][_0xf32e('0x35')](_0x444ab3)[_0xf32e('0x17')](handleEntityNotFound(_0xc1b59e,null))['then'](respondWithResult(_0xc1b59e,null))[_0xf32e('0x2a')](handleError(_0xc1b59e,null));};exports[_0xf32e('0x36')]=function(_0x414386,_0x163900){return db[_0xf32e('0x22')]['create'](_0x414386[_0xf32e('0x37')],{})['then'](function(_0x2a2acf){var _0x425552=_0x414386[_0xf32e('0x38')][_0xf32e('0x19')]({'plain':!![]});if(!_0x425552)throw new Error(_0xf32e('0x39'));if(_0x425552[_0xf32e('0x3a')]===_0xf32e('0x38')){var _0x2ce7d1=_0x2a2acf['get']({'plain':!![]});var _0x1ac158=_0xf32e('0x1a');return db[_0xf32e('0x3b')][_0xf32e('0x35')]({'where':{'name':_0x1ac158,'userProfileId':_0x425552[_0xf32e('0x3c')]},'raw':!![]})['then'](function(_0x2514b6){if(_0x2514b6&&_0x2514b6[_0xf32e('0x3d')]===0x0){return db[_0xf32e('0x1b')][_0xf32e('0x36')]({'name':_0x2ce7d1['name'],'resourceId':_0x2ce7d1['id'],'type':_0x2514b6[_0xf32e('0x1e')],'sectionId':_0x2514b6['id']},{})['then'](function(){return _0x2a2acf;});}else{return _0x2a2acf;}})['catch'](function(_0x239ed7){logger[_0xf32e('0x1c')](_0xf32e('0x3e'),_0x239ed7);throw _0x239ed7;});}return _0x2a2acf;})[_0xf32e('0x17')](respondWithResult(_0x163900,0xc9))[_0xf32e('0x2a')](handleError(_0x163900,null));};exports[_0xf32e('0x16')]=function(_0x2ed32f,_0xe0116c){if(_0x2ed32f[_0xf32e('0x37')]['id']){delete _0x2ed32f[_0xf32e('0x37')]['id'];}return db[_0xf32e('0x22')][_0xf32e('0x35')]({'where':{'id':_0x2ed32f[_0xf32e('0x3f')]['id']}})[_0xf32e('0x17')](handleEntityNotFound(_0xe0116c,null))['then'](saveUpdates(_0x2ed32f[_0xf32e('0x37')],null))['then'](respondWithResult(_0xe0116c,null))['catch'](handleError(_0xe0116c,null));};exports[_0xf32e('0x18')]=function(_0x37da5d,_0x32c2e1){return db[_0xf32e('0x22')][_0xf32e('0x35')]({'where':{'id':_0x37da5d['params']['id']}})[_0xf32e('0x17')](handleEntityNotFound(_0x32c2e1,null))[_0xf32e('0x17')](removeEntity(_0x32c2e1,null))['catch'](handleError(_0x32c2e1,null));};exports[_0xf32e('0x40')]=function(_0x4c4fac,_0x4b109b){return db[_0xf32e('0x22')][_0xf32e('0x40')]()[_0xf32e('0x17')](respondWithResult(_0x4b109b,null))[_0xf32e('0x2a')](handleError(_0x4b109b,null));};exports[_0xf32e('0x41')]=function(_0x350742,_0x3be1f8){var _0x54df6f={'raw':!![],'where':{}},_0x35160e={},_0x4b02bd;return db[_0xf32e('0x22')][_0xf32e('0x42')]({'where':{'id':_0x350742[_0xf32e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3be1f8,null))[_0xf32e('0x17')](function(_0x5f214f){if(_0x5f214f){_0x4b02bd=_0x5f214f[_0xf32e('0x19')]({'plain':!![]});_0x35160e[_0xf32e('0x2c')]=_[_0xf32e('0x2d')](db[_0xf32e('0x43')][_0xf32e('0x44')]);_0x35160e['query']=_[_0xf32e('0x2d')](_0x350742[_0xf32e('0x28')]);_0x35160e['filters']=_['intersection'](_0x35160e[_0xf32e('0x2c')],_0x35160e['query']);_0x54df6f[_0xf32e('0x2f')]=_['intersection'](_0x35160e[_0xf32e('0x2c')],qs['fields'](_0x350742['query'][_0xf32e('0x31')]));_0x54df6f[_0xf32e('0x2f')]=_0x54df6f[_0xf32e('0x2f')][_0xf32e('0x32')]?_0x54df6f['attributes']:_0x35160e[_0xf32e('0x2c')];if(!_0x350742['query'][_0xf32e('0x45')]('nolimit')){_0x54df6f[_0xf32e('0x13')]=qs['limit'](_0x350742[_0xf32e('0x28')][_0xf32e('0x13')]);_0x54df6f[_0xf32e('0x11')]=qs['offset'](_0x350742[_0xf32e('0x28')][_0xf32e('0x11')]);}_0x54df6f[_0xf32e('0x46')]=qs[_0xf32e('0x47')](_0x350742[_0xf32e('0x28')][_0xf32e('0x47')]);_0x54df6f['where']=qs[_0xf32e('0x2e')](_[_0xf32e('0x48')](_0x350742[_0xf32e('0x28')],_0x35160e['filters']));_0x54df6f[_0xf32e('0x27')][_0xf32e('0x49')]=_0x5f214f['id'];if(_0x350742[_0xf32e('0x28')]['filter']){_0x54df6f['where']=_[_0xf32e('0x33')](_0x54df6f['where'],{'$or':_[_0xf32e('0x21')](_0x54df6f['attributes'],function(_0x198ede){var _0x4ef35e={};_0x4ef35e[_0x198ede]={'$like':'%'+_0x350742[_0xf32e('0x28')]['filter']+'%'};return _0x4ef35e;})});}_0x54df6f=_['merge']({},_0x54df6f,_0x350742[_0xf32e('0x34')]);return db[_0xf32e('0x43')][_0xf32e('0x4a')](_0x54df6f);}})[_0xf32e('0x17')](function(_0x460bec){if(_0x460bec){return db[_0xf32e('0x4b')][_0xf32e('0x4c')]({'where':{'id':_[_0xf32e('0x21')](_0x460bec,'UserId'),'role':_0xf32e('0x4d')},'attributes':['id',_0xf32e('0x1e'),_0xf32e('0x4e'),_0xf32e('0x4f'),_0xf32e('0x50')]});}})[_0xf32e('0x17')](function(_0x4cf107){if(_0x4cf107){return{'count':_0x4cf107['count'],'rows':_[_0xf32e('0x21')](_0x4cf107['rows'],function(_0x52b815){return{'membername':_0x52b815[_0xf32e('0x1e')],'UserId':_0x52b815['id'],'queue_name':_0x4b02bd[_0xf32e('0x1e')],'ChatQueueId':_0x4b02bd['id'],'interface':util[_0xf32e('0x51')]('%s/%s',_0xf32e('0x52'),_0x52b815[_0xf32e('0x1e')]),'penalty':0x0,'paused':_0x52b815[_0xf32e('0x4e')],'createdAt':_0x52b815[_0xf32e('0x50')],'updatedAt':_0x52b815[_0xf32e('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3be1f8,_0x54df6f))[_0xf32e('0x2a')](handleError(_0x3be1f8,null));};exports[_0xf32e('0x53')]=function(_0x86e16b,_0x4f993c){var _0x4b5233={};var _0x3f6268={};var _0x224daf;var _0x354c9b;return db[_0xf32e('0x22')][_0xf32e('0x42')]({'where':{'id':_0x86e16b[_0xf32e('0x3f')]['id']}})[_0xf32e('0x17')](handleEntityNotFound(_0x4f993c,null))[_0xf32e('0x17')](function(_0x37350b){if(_0x37350b){_0x224daf=_0x37350b;_0x3f6268[_0xf32e('0x2c')]=_['keys'](db[_0xf32e('0x54')][_0xf32e('0x44')]);_0x3f6268['query']=_[_0xf32e('0x2d')](_0x86e16b['query']);_0x3f6268['filters']=_[_0xf32e('0x30')](_0x3f6268[_0xf32e('0x2c')],_0x3f6268[_0xf32e('0x28')]);_0x4b5233['attributes']=_[_0xf32e('0x30')](_0x3f6268[_0xf32e('0x2c')],qs[_0xf32e('0x31')](_0x86e16b[_0xf32e('0x28')][_0xf32e('0x31')]));_0x4b5233['attributes']=_0x4b5233['attributes'][_0xf32e('0x32')]?_0x4b5233[_0xf32e('0x2f')]:_0x3f6268['model'];_0x4b5233[_0xf32e('0x46')]=qs[_0xf32e('0x47')](_0x86e16b['query'][_0xf32e('0x47')]);_0x4b5233[_0xf32e('0x27')]=qs[_0xf32e('0x2e')](_[_0xf32e('0x48')](_0x86e16b[_0xf32e('0x28')],_0x3f6268['filters']));if(_0x86e16b['query'][_0xf32e('0x55')]){_0x4b5233[_0xf32e('0x27')]=_['merge'](_0x4b5233['where'],{'$or':_[_0xf32e('0x21')](_0x4b5233[_0xf32e('0x2f')],function(_0xbef504){var _0x513055={};_0x513055[_0xbef504]={'$like':'%'+_0x86e16b[_0xf32e('0x28')][_0xf32e('0x55')]+'%'};return _0x513055;})});}_0x4b5233=_['merge']({},_0x4b5233,_0x86e16b['options']);return _0x224daf[_0xf32e('0x53')](_0x4b5233);}})[_0xf32e('0x17')](function(_0x17399c){if(_0x17399c){_0x354c9b=_0x17399c[_0xf32e('0x32')];if(!_0x86e16b[_0xf32e('0x28')][_0xf32e('0x45')](_0xf32e('0x56'))){_0x4b5233[_0xf32e('0x13')]=qs[_0xf32e('0x13')](_0x86e16b[_0xf32e('0x28')][_0xf32e('0x13')]);_0x4b5233[_0xf32e('0x11')]=qs[_0xf32e('0x11')](_0x86e16b['query'][_0xf32e('0x11')]);}return _0x224daf[_0xf32e('0x53')](_0x4b5233);}})[_0xf32e('0x17')](function(_0x28bdb7){if(_0x28bdb7){return _0x28bdb7?{'count':_0x354c9b,'rows':_0x28bdb7}:null;}})['then'](respondWithResult(_0x4f993c,null))[_0xf32e('0x2a')](handleError(_0x4f993c,null));};exports[_0xf32e('0x57')]=function(_0x5ef81c,_0x5e5711){var _0x15a4f6=_0x5ef81c[_0xf32e('0x37')][_0xf32e('0x58')];return db[_0xf32e('0x54')][_0xf32e('0x4a')]({'where':{'id':_0x15a4f6},'attributes':['id'],'include':[{'model':db[_0xf32e('0x4b')],'as':'Agents','attributes':['id',_0xf32e('0x1e'),_0xf32e('0x59'),_0xf32e('0x5a'),_0xf32e('0x5b')],'raw':!![]}]})['then'](function(_0x32bbe6){if(_0x32bbe6){var _0x3f4aad=_[_0xf32e('0x5c')](_0x32bbe6,function(_0x286041){var _0x2dc004=_0x286041[_0xf32e('0x19')]({'plain':!![]});return _0x2dc004[_0xf32e('0x5d')];});return db[_0xf32e('0x22')][_0xf32e('0x35')]({'where':{'id':_0x5ef81c['params']['id']}})[_0xf32e('0x17')](function(_0x1e0b47){return db[_0xf32e('0x5e')][_0xf32e('0x5f')](function(_0x2cc611){return _0x1e0b47[_0xf32e('0x57')](_0x15a4f6,{'transaction':_0x2cc611})[_0xf32e('0x17')](function(){return BPromise[_0xf32e('0x60')](_0x3f4aad,function(_0x14bdcf){return db[_0xf32e('0x43')]['findOrCreate']({'where':{'UserId':_0x14bdcf['id'],'ChatQueueId':_0x5ef81c['params']['id']},'transaction':_0x2cc611});});})[_0xf32e('0x17')](function(){_0x3f4aad[_0xf32e('0x61')](function(_0x1ce756){socket[_0xf32e('0x62')](_0xf32e('0x63'),{'UserId':_0x1ce756['id'],'ChatQueueId':_0x1e0b47['id']});});});});});}})['then'](respondWithStatusCode(_0x5e5711,null))[_0xf32e('0x2a')](handleError(_0x5e5711,null));};exports[_0xf32e('0x64')]=function(_0x38c419,_0x5dbbc6){return db[_0xf32e('0x54')][_0xf32e('0x4a')]({'where':{'id':_0x38c419['query'][_0xf32e('0x58')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf32e('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xf32e('0x17')](handleEntityNotFound(_0x5dbbc6,null))[_0xf32e('0x17')](function(_0x33f3bd){var _0x319c5d=_[_0xf32e('0x21')](_0x33f3bd,'id');var _0x3d1df8=[];var _0xfa1f2a=[];var _0x1ac08b=squel['select']();_0x1ac08b[_0xf32e('0x65')](_0xf32e('0x66'))[_0xf32e('0x67')](_0xf32e('0x68'),'tq')[_0xf32e('0x69')](_0xf32e('0x6a'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xf32e('0x6b'),_0x38c419[_0xf32e('0x3f')]['id']);for(var _0x3dccf3=0x0;_0x3dccf3<_0x33f3bd[_0xf32e('0x32')];_0x3dccf3+=0x1){let _0x1591b9=_0x33f3bd[_0x3dccf3];for(var _0x504cca=0x0;_0x504cca<_0x1591b9[_0xf32e('0x5d')][_0xf32e('0x32')];_0x504cca+=0x1){let _0x43b7b0=_0x1591b9[_0xf32e('0x5d')][_0x504cca];var _0x29d647=_0x1ac08b[_0xf32e('0x6c')]();_0x29d647[_0xf32e('0x27')](_0xf32e('0x6d'),_0x43b7b0['id']);_0xfa1f2a[_0xf32e('0x6e')](db['sequelize'][_0xf32e('0x28')](_0x29d647['toString'](),{'type':db[_0xf32e('0x5e')][_0xf32e('0x6f')][_0xf32e('0x70')]})[_0xf32e('0x17')](function(_0x1e726a){if(_0x1e726a['length']===0x1){return _0x43b7b0['id'];}else{var _0x53a3e7=_[_0xf32e('0x71')](_[_0xf32e('0x21')](_0x1e726a,'TeamId'),function(_0x7d16e3){return _[_0xf32e('0x72')](_0x319c5d,_0x7d16e3);});if(_0x53a3e7){return _0x43b7b0['id'];}}}));}}return BPromise[_0xf32e('0x73')](_0xfa1f2a)[_0xf32e('0x17')](function(_0x21ee1a){_0x3d1df8=_(_0x3d1df8)['union'](_0x21ee1a)['compact']()[_0xf32e('0x74')]();return db[_0xf32e('0x22')][_0xf32e('0x35')]({'where':{'id':_0x38c419[_0xf32e('0x3f')]['id']}})[_0xf32e('0x17')](function(_0x1b89aa){return db['sequelize'][_0xf32e('0x5f')](function(_0x456241){return _0x1b89aa[_0xf32e('0x64')](_0x38c419[_0xf32e('0x28')][_0xf32e('0x58')],{'transaction':_0x456241})[_0xf32e('0x17')](function(){if(!_['isEmpty'](_0x3d1df8)){return _0x1b89aa[_0xf32e('0x75')](_0x3d1df8,{'transaction':_0x456241});}})[_0xf32e('0x17')](function(){_0x3d1df8[_0xf32e('0x61')](function(_0x11c295){socket[_0xf32e('0x62')](_0xf32e('0x76'),{'UserId':_0x11c295,'ChatQueueId':_0x1b89aa['id']});});});});});});})['then'](respondWithStatusCode(_0x5dbbc6,null))[_0xf32e('0x2a')](handleError(_0x5dbbc6,null));};exports[_0xf32e('0x77')]=function(_0x468fad,_0x4dd0e5){return db[_0xf32e('0x22')][_0xf32e('0x35')]({'where':{'id':_0x468fad['params']['id']}})['then'](handleEntityNotFound(_0x4dd0e5,null))[_0xf32e('0x17')](function(_0x330358){if(_0x330358){return _0x330358[_0xf32e('0x77')](_0x468fad['body'][_0xf32e('0x58')],_[_0xf32e('0x78')](_0x468fad['body'],[_0xf32e('0x58'),'id'])||{})[_0xf32e('0x79')](function(_0x1e7a12){for(var _0x471102=0x0;_0x471102<_0x468fad[_0xf32e('0x37')]['ids'][_0xf32e('0x32')];_0x471102+=0x1){socket['emit'](_0xf32e('0x63'),{'UserId':Number(_0x468fad[_0xf32e('0x37')][_0xf32e('0x58')][_0x471102]),'ChatQueueId':Number(_0x468fad[_0xf32e('0x3f')]['id'])});}return _0x1e7a12;});}})[_0xf32e('0x17')](respondWithResult(_0x4dd0e5,null))[_0xf32e('0x2a')](handleError(_0x4dd0e5,null));};exports[_0xf32e('0x75')]=function(_0x290242,_0x2634ad){return db['ChatQueue'][_0xf32e('0x35')]({'where':{'id':_0x290242[_0xf32e('0x3f')]['id']}})[_0xf32e('0x17')](handleEntityNotFound(_0x2634ad,null))['then'](function(_0x1acdc9){if(_0x1acdc9){return _0x1acdc9['removeAgents'](_0x290242[_0xf32e('0x28')][_0xf32e('0x58')])[_0xf32e('0x17')](function(){if(_[_0xf32e('0x7a')](_0x290242[_0xf32e('0x28')]['ids'])){for(var _0x56fbe4=0x0;_0x56fbe4<_0x290242[_0xf32e('0x28')][_0xf32e('0x58')]['length'];_0x56fbe4+=0x1){socket['emit'](_0xf32e('0x76'),{'UserId':Number(_0x290242[_0xf32e('0x28')][_0xf32e('0x58')][_0x56fbe4]),'ChatQueueId':Number(_0x290242['params']['id'])});}}else{socket['emit'](_0xf32e('0x76'),{'UserId':Number(_0x290242[_0xf32e('0x28')][_0xf32e('0x58')]),'ChatQueueId':Number(_0x290242['params']['id'])});}});}})[_0xf32e('0x17')](respondWithStatusCode(_0x2634ad,null))[_0xf32e('0x2a')](handleError(_0x2634ad,null));};exports['getAgents']=function(_0x3d0406,_0x4edb51){var _0x316058={};var _0x3952ad={};var _0x2c672b;var _0x25fbaa;return db[_0xf32e('0x22')][_0xf32e('0x42')]({'where':{'id':_0x3d0406[_0xf32e('0x3f')]['id']}})[_0xf32e('0x17')](handleEntityNotFound(_0x4edb51,null))[_0xf32e('0x17')](function(_0x579466){if(_0x579466){_0x2c672b=_0x579466;_0x3952ad[_0xf32e('0x2c')]=_['keys'](db['User']['rawAttributes']);_0x3952ad[_0xf32e('0x28')]=_[_0xf32e('0x2d')](_0x3d0406[_0xf32e('0x28')]);_0x3952ad[_0xf32e('0x2e')]=_[_0xf32e('0x30')](_0x3952ad[_0xf32e('0x2c')],_0x3952ad['query']);_0x316058[_0xf32e('0x2f')]=_[_0xf32e('0x30')](_0x3952ad['model'],qs[_0xf32e('0x31')](_0x3d0406[_0xf32e('0x28')]['fields']));_0x316058[_0xf32e('0x2f')]=_0x316058['attributes'][_0xf32e('0x32')]?_0x316058[_0xf32e('0x2f')]:_0x3952ad[_0xf32e('0x2c')];_0x316058[_0xf32e('0x46')]=qs['sort'](_0x3d0406['query']['sort']);_0x316058[_0xf32e('0x27')]=qs[_0xf32e('0x2e')](_[_0xf32e('0x48')](_0x3d0406[_0xf32e('0x28')],_0x3952ad[_0xf32e('0x2e')]));if(_0x3d0406['query'][_0xf32e('0x55')]){_0x316058[_0xf32e('0x27')]=_[_0xf32e('0x33')](_0x316058['where'],{'$or':_['map'](_0x316058[_0xf32e('0x2f')],function(_0x4eb25c){var _0x2a1c2c={};_0x2a1c2c[_0x4eb25c]={'$like':'%'+_0x3d0406[_0xf32e('0x28')][_0xf32e('0x55')]+'%'};return _0x2a1c2c;})});}_0x316058=_[_0xf32e('0x33')]({},_0x316058,_0x3d0406['options']);return _0x2c672b['getAgents'](_0x316058);}})[_0xf32e('0x17')](function(_0x103130){if(_0x103130){_0x25fbaa=_0x103130['length'];if(!_0x3d0406[_0xf32e('0x28')][_0xf32e('0x45')](_0xf32e('0x56'))){_0x316058['limit']=qs[_0xf32e('0x13')](_0x3d0406[_0xf32e('0x28')][_0xf32e('0x13')]);_0x316058[_0xf32e('0x11')]=qs[_0xf32e('0x11')](_0x3d0406[_0xf32e('0x28')][_0xf32e('0x11')]);}return _0x2c672b['getAgents'](_0x316058);}})[_0xf32e('0x17')](function(_0x2fe848){if(_0x2fe848){return _0x2fe848?{'count':_0x25fbaa,'rows':_0x2fe848}:null;}})['then'](respondWithResult(_0x4edb51,null))[_0xf32e('0x2a')](handleError(_0x4edb51,null));}; \ No newline at end of file +var _0x535c=['find','params','describe','getMembers','findOne','UserChatQueue','keys','hasOwnProperty','order','sort','filters','ChatQueueId','merge','filter','options','findAll','findAndCountAll','map','agent','chatPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','Team','pick','nolimit','ids','User','Agents','online','interface','sequelize','transaction','addTeams','each','removeTeams','select','field','tq.TeamId','from','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','spread','emit','userChatQueue:save','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','then','destroy','get','error','stack','name','send','rawAttributes','fieldName','type','getOptions','where','include','query','ChatQueue','catch','show','model','intersection','fields','attributes','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x4bec00,_0x4d673b){var _0x18a02e=function(_0x290fe6){while(--_0x290fe6){_0x4bec00['push'](_0x4bec00['shift']());}};_0x18a02e(++_0x4d673b);}(_0x535c,0x131));var _0xc535=function(_0x4f6afc,_0x4dfa88){_0x4f6afc=_0x4f6afc-0x0;var _0x256eeb=_0x535c[_0x4f6afc];return _0x256eeb;};'use strict';var BPromise=require(_0xc535('0x0'));var util=require(_0xc535('0x1'));var _=require('lodash');var squel=require(_0xc535('0x2'));var Redis=require(_0xc535('0x3'));var qs=require(_0xc535('0x4'));var logger=require('../../config/logger')('api');var config=require(_0xc535('0x5'));var db=require(_0xc535('0x6'))['db'];config['redis']=_[_0xc535('0x7')](config[_0xc535('0x8')],{'host':_0xc535('0x9'),'port':0x18eb});var socket=require(_0xc535('0xa'))(new Redis(config[_0xc535('0x8')]));require('./chatQueue.socket')[_0xc535('0xb')](socket);function respondWithStatusCode(_0x30d9d8,_0x282bb5){_0x282bb5=_0x282bb5||0xcc;return function(_0x50b5e8){if(_0x50b5e8){return _0x30d9d8[_0xc535('0xc')](_0x282bb5);}return _0x30d9d8[_0xc535('0xd')](_0x282bb5)[_0xc535('0xe')]();};}function respondWithResult(_0x573298,_0x43d777){_0x43d777=_0x43d777||0xc8;return function(_0x627ef6){if(_0x627ef6){return _0x573298[_0xc535('0xd')](_0x43d777)[_0xc535('0xf')](_0x627ef6);}};}function respondWithFilteredResult(_0x91bf46,_0x3f5855){return function(_0x17a2a6){if(_0x17a2a6){var _0x2bd1b4=typeof _0x3f5855[_0xc535('0x10')]==='undefined'&&typeof _0x3f5855[_0xc535('0x11')]===_0xc535('0x12');var _0x35f829=_0x17a2a6[_0xc535('0x13')];var _0x263b6c=_0x2bd1b4?0x0:_0x3f5855[_0xc535('0x10')];var _0x39c28f=_0x2bd1b4?_0x17a2a6[_0xc535('0x13')]:_0x3f5855[_0xc535('0x10')]+_0x3f5855[_0xc535('0x11')];var _0x47c0c2;if(_0x39c28f>=_0x35f829){_0x39c28f=_0x35f829;_0x47c0c2=0xc8;}else{_0x47c0c2=0xce;}_0x91bf46['status'](_0x47c0c2);return _0x91bf46[_0xc535('0x14')]('Content-Range',_0x263b6c+'-'+_0x39c28f+'/'+_0x35f829)[_0xc535('0xf')](_0x17a2a6);}return null;};}function saveUpdates(_0x3a596c){return function(_0x399354){if(_0x399354){return _0x399354['update'](_0x3a596c)[_0xc535('0x15')](function(_0x29114b){return _0x29114b;});}return null;};}function removeEntity(_0x59afef){return function(_0x2e0593){if(_0x2e0593){return _0x2e0593[_0xc535('0x16')]()[_0xc535('0x15')](function(){var _0x426f23=_0x2e0593[_0xc535('0x17')]({'plain':!![]});var _0x321f5b='ChatQueues';return db['UserProfileResource'][_0xc535('0x16')]({'where':{'type':_0x321f5b,'resourceId':_0x426f23['id']}})[_0xc535('0x15')](function(){return _0x2e0593;});})[_0xc535('0x15')](function(){_0x59afef[_0xc535('0xd')](0xcc)[_0xc535('0xe')]();});}};}function handleEntityNotFound(_0x2451b9){return function(_0x254c58){if(!_0x254c58){_0x2451b9[_0xc535('0xc')](0x194);}return _0x254c58;};}function handleError(_0x212e28,_0x57a818){_0x57a818=_0x57a818||0x1f4;return function(_0x2af66f){logger[_0xc535('0x18')](_0x2af66f[_0xc535('0x19')]);if(_0x2af66f[_0xc535('0x1a')]){delete _0x2af66f['name'];}_0x212e28[_0xc535('0xd')](_0x57a818)[_0xc535('0x1b')](_0x2af66f);};}exports['index']=function(_0x10f70f,_0x4b26aa){var _0x471ea7={};var _0x4ef53c={'count':0x0,'rows':[]};var _0x4d6f11=_['map'](db['ChatQueue'][_0xc535('0x1c')],function(_0x8b7202){return{'name':_0x8b7202[_0xc535('0x1d')],'type':_0x8b7202[_0xc535('0x1e')]['key']};});_0x471ea7=qs[_0xc535('0x1f')](_0x4d6f11,_0x10f70f);var _0x52a018={'where':_0x471ea7[_0xc535('0x20')]};return db['ChatQueue'][_0xc535('0x13')](_0x52a018)['then'](function(_0x3f244e){_0x4ef53c[_0xc535('0x13')]=_0x3f244e;_0x471ea7[_0xc535('0x21')]=qs['include'](_0x10f70f[_0xc535('0x22')]);return db[_0xc535('0x23')]['findAll'](_0x471ea7);})['then'](function(_0x476aff){_0x4ef53c['rows']=_0x476aff;return _0x4ef53c;})[_0xc535('0x15')](respondWithFilteredResult(_0x4b26aa,_0x471ea7))[_0xc535('0x24')](handleError(_0x4b26aa,null));};exports[_0xc535('0x25')]=function(_0x351071,_0x1ca736){var _0xcef36f={'raw':!![],'where':{'id':_0x351071['params']['id']}},_0x5ef666={};_0x5ef666[_0xc535('0x26')]=_['keys'](db[_0xc535('0x23')]['rawAttributes']);_0x5ef666[_0xc535('0x22')]=_['keys'](_0x351071['query']);_0x5ef666['filters']=_[_0xc535('0x27')](_0x5ef666[_0xc535('0x26')],_0x5ef666[_0xc535('0x22')]);_0xcef36f['attributes']=_[_0xc535('0x27')](_0x5ef666[_0xc535('0x26')],qs[_0xc535('0x28')](_0x351071[_0xc535('0x22')]['fields']));_0xcef36f[_0xc535('0x29')]=_0xcef36f[_0xc535('0x29')][_0xc535('0x2a')]?_0xcef36f[_0xc535('0x29')]:_0x5ef666[_0xc535('0x26')];if(_0x351071[_0xc535('0x22')][_0xc535('0x2b')]){_0xcef36f[_0xc535('0x21')]=[{'all':!![]}];}_0xcef36f=_['merge']({},_0xcef36f,_0x351071['options']);return db[_0xc535('0x23')]['find'](_0xcef36f)[_0xc535('0x15')](handleEntityNotFound(_0x1ca736,null))[_0xc535('0x15')](respondWithResult(_0x1ca736,null))[_0xc535('0x24')](handleError(_0x1ca736,null));};exports[_0xc535('0x2c')]=function(_0x3b072f,_0x487af9){return db[_0xc535('0x23')][_0xc535('0x2c')](_0x3b072f[_0xc535('0x2d')],{})[_0xc535('0x15')](function(_0x2c5784){var _0x355737=_0x3b072f[_0xc535('0x2e')][_0xc535('0x17')]({'plain':!![]});if(!_0x355737)throw new Error(_0xc535('0x2f'));if(_0x355737[_0xc535('0x30')]===_0xc535('0x2e')){var _0x55bcd6=_0x2c5784['get']({'plain':!![]});var _0x21ed92='ChatQueues';return db[_0xc535('0x31')]['find']({'where':{'name':_0x21ed92,'userProfileId':_0x355737[_0xc535('0x32')]},'raw':!![]})[_0xc535('0x15')](function(_0x58b8f6){if(_0x58b8f6&&_0x58b8f6[_0xc535('0x33')]===0x0){return db[_0xc535('0x34')][_0xc535('0x2c')]({'name':_0x55bcd6['name'],'resourceId':_0x55bcd6['id'],'type':_0x58b8f6['name'],'sectionId':_0x58b8f6['id']},{})[_0xc535('0x15')](function(){return _0x2c5784;});}else{return _0x2c5784;}})[_0xc535('0x24')](function(_0x4edf85){logger['error'](_0xc535('0x35'),_0x4edf85);throw _0x4edf85;});}return _0x2c5784;})[_0xc535('0x15')](respondWithResult(_0x487af9,0xc9))[_0xc535('0x24')](handleError(_0x487af9,null));};exports[_0xc535('0x36')]=function(_0x56ccff,_0x3fd15f){if(_0x56ccff[_0xc535('0x2d')]['id']){delete _0x56ccff['body']['id'];}return db[_0xc535('0x23')][_0xc535('0x37')]({'where':{'id':_0x56ccff[_0xc535('0x38')]['id']}})[_0xc535('0x15')](handleEntityNotFound(_0x3fd15f,null))[_0xc535('0x15')](saveUpdates(_0x56ccff[_0xc535('0x2d')],null))[_0xc535('0x15')](respondWithResult(_0x3fd15f,null))[_0xc535('0x24')](handleError(_0x3fd15f,null));};exports['destroy']=function(_0xf8f694,_0x29f5df){return db[_0xc535('0x23')][_0xc535('0x37')]({'where':{'id':_0xf8f694[_0xc535('0x38')]['id']}})[_0xc535('0x15')](handleEntityNotFound(_0x29f5df,null))[_0xc535('0x15')](removeEntity(_0x29f5df,null))[_0xc535('0x24')](handleError(_0x29f5df,null));};exports['describe']=function(_0x3b58d8,_0x59cdb3){return db['ChatQueue'][_0xc535('0x39')]()[_0xc535('0x15')](respondWithResult(_0x59cdb3,null))[_0xc535('0x24')](handleError(_0x59cdb3,null));};exports[_0xc535('0x3a')]=function(_0xab4bc0,_0x5e38a6){var _0x36bfed={'raw':!![],'where':{}},_0x4e9e15={},_0x4087a9;return db[_0xc535('0x23')][_0xc535('0x3b')]({'where':{'id':_0xab4bc0['params']['id']}})[_0xc535('0x15')](handleEntityNotFound(_0x5e38a6,null))[_0xc535('0x15')](function(_0x528735){if(_0x528735){_0x4087a9=_0x528735[_0xc535('0x17')]({'plain':!![]});_0x4e9e15[_0xc535('0x26')]=_['keys'](db[_0xc535('0x3c')][_0xc535('0x1c')]);_0x4e9e15['query']=_[_0xc535('0x3d')](_0xab4bc0['query']);_0x4e9e15['filters']=_['intersection'](_0x4e9e15[_0xc535('0x26')],_0x4e9e15[_0xc535('0x22')]);_0x36bfed[_0xc535('0x29')]=_[_0xc535('0x27')](_0x4e9e15[_0xc535('0x26')],qs[_0xc535('0x28')](_0xab4bc0[_0xc535('0x22')][_0xc535('0x28')]));_0x36bfed['attributes']=_0x36bfed[_0xc535('0x29')][_0xc535('0x2a')]?_0x36bfed[_0xc535('0x29')]:_0x4e9e15['model'];if(!_0xab4bc0[_0xc535('0x22')][_0xc535('0x3e')]('nolimit')){_0x36bfed[_0xc535('0x11')]=qs[_0xc535('0x11')](_0xab4bc0[_0xc535('0x22')][_0xc535('0x11')]);_0x36bfed['offset']=qs[_0xc535('0x10')](_0xab4bc0[_0xc535('0x22')][_0xc535('0x10')]);}_0x36bfed[_0xc535('0x3f')]=qs['sort'](_0xab4bc0[_0xc535('0x22')][_0xc535('0x40')]);_0x36bfed[_0xc535('0x20')]=qs[_0xc535('0x41')](_['pick'](_0xab4bc0[_0xc535('0x22')],_0x4e9e15[_0xc535('0x41')]));_0x36bfed[_0xc535('0x20')][_0xc535('0x42')]=_0x528735['id'];if(_0xab4bc0[_0xc535('0x22')]['filter']){_0x36bfed['where']=_[_0xc535('0x43')](_0x36bfed['where'],{'$or':_['map'](_0x36bfed[_0xc535('0x29')],function(_0x41312a){var _0x1bdbc3={};_0x1bdbc3[_0x41312a]={'$like':'%'+_0xab4bc0[_0xc535('0x22')][_0xc535('0x44')]+'%'};return _0x1bdbc3;})});}_0x36bfed=_['merge']({},_0x36bfed,_0xab4bc0[_0xc535('0x45')]);return db[_0xc535('0x3c')][_0xc535('0x46')](_0x36bfed);}})['then'](function(_0x1ad22b){if(_0x1ad22b){return db['User'][_0xc535('0x47')]({'where':{'id':_[_0xc535('0x48')](_0x1ad22b,'UserId'),'role':_0xc535('0x49')},'attributes':['id','name',_0xc535('0x4a'),_0xc535('0x4b'),_0xc535('0x4c')]});}})[_0xc535('0x15')](function(_0x14370b){if(_0x14370b){return{'count':_0x14370b['count'],'rows':_['map'](_0x14370b[_0xc535('0x4d')],function(_0x45be82){return{'membername':_0x45be82[_0xc535('0x1a')],'UserId':_0x45be82['id'],'queue_name':_0x4087a9[_0xc535('0x1a')],'ChatQueueId':_0x4087a9['id'],'interface':util['format'](_0xc535('0x4e'),_0xc535('0x4f'),_0x45be82['name']),'penalty':0x0,'paused':_0x45be82['chatPause'],'createdAt':_0x45be82[_0xc535('0x4c')],'updatedAt':_0x45be82[_0xc535('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5e38a6,_0x36bfed))[_0xc535('0x24')](handleError(_0x5e38a6,null));};exports[_0xc535('0x50')]=function(_0x23a2ba,_0x726c62){var _0x3b9126={};var _0x7f14a8={};var _0x2567fd;var _0x10d8f2;return db[_0xc535('0x23')]['findOne']({'where':{'id':_0x23a2ba[_0xc535('0x38')]['id']}})[_0xc535('0x15')](handleEntityNotFound(_0x726c62,null))[_0xc535('0x15')](function(_0x262614){if(_0x262614){_0x2567fd=_0x262614;_0x7f14a8[_0xc535('0x26')]=_[_0xc535('0x3d')](db[_0xc535('0x51')]['rawAttributes']);_0x7f14a8['query']=_[_0xc535('0x3d')](_0x23a2ba['query']);_0x7f14a8['filters']=_[_0xc535('0x27')](_0x7f14a8['model'],_0x7f14a8[_0xc535('0x22')]);_0x3b9126[_0xc535('0x29')]=_[_0xc535('0x27')](_0x7f14a8['model'],qs[_0xc535('0x28')](_0x23a2ba[_0xc535('0x22')][_0xc535('0x28')]));_0x3b9126[_0xc535('0x29')]=_0x3b9126[_0xc535('0x29')]['length']?_0x3b9126['attributes']:_0x7f14a8[_0xc535('0x26')];_0x3b9126[_0xc535('0x3f')]=qs['sort'](_0x23a2ba['query']['sort']);_0x3b9126[_0xc535('0x20')]=qs[_0xc535('0x41')](_[_0xc535('0x52')](_0x23a2ba['query'],_0x7f14a8[_0xc535('0x41')]));if(_0x23a2ba['query'][_0xc535('0x44')]){_0x3b9126[_0xc535('0x20')]=_[_0xc535('0x43')](_0x3b9126['where'],{'$or':_['map'](_0x3b9126['attributes'],function(_0x4ebbd8){var _0xf59aaa={};_0xf59aaa[_0x4ebbd8]={'$like':'%'+_0x23a2ba[_0xc535('0x22')]['filter']+'%'};return _0xf59aaa;})});}_0x3b9126=_[_0xc535('0x43')]({},_0x3b9126,_0x23a2ba[_0xc535('0x45')]);return _0x2567fd[_0xc535('0x50')](_0x3b9126);}})[_0xc535('0x15')](function(_0x8215e6){if(_0x8215e6){_0x10d8f2=_0x8215e6['length'];if(!_0x23a2ba[_0xc535('0x22')]['hasOwnProperty'](_0xc535('0x53'))){_0x3b9126[_0xc535('0x11')]=qs[_0xc535('0x11')](_0x23a2ba[_0xc535('0x22')][_0xc535('0x11')]);_0x3b9126['offset']=qs['offset'](_0x23a2ba[_0xc535('0x22')][_0xc535('0x10')]);}return _0x2567fd[_0xc535('0x50')](_0x3b9126);}})['then'](function(_0x454d28){if(_0x454d28){return _0x454d28?{'count':_0x10d8f2,'rows':_0x454d28}:null;}})['then'](respondWithResult(_0x726c62,null))[_0xc535('0x24')](handleError(_0x726c62,null));};exports['addTeams']=function(_0x562a7b,_0xa67501){var _0x3cd46d=_0x562a7b[_0xc535('0x2d')][_0xc535('0x54')];return db[_0xc535('0x51')]['findAll']({'where':{'id':_0x3cd46d},'attributes':['id'],'include':[{'model':db[_0xc535('0x55')],'as':_0xc535('0x56'),'attributes':['id','name',_0xc535('0x57'),'voicePause',_0xc535('0x58')],'raw':!![]}]})[_0xc535('0x15')](function(_0x537faf){if(_0x537faf){var _0x315e1a=_['flatMap'](_0x537faf,function(_0x3824f6){var _0x28f2ab=_0x3824f6[_0xc535('0x17')]({'plain':!![]});return _0x28f2ab[_0xc535('0x56')];});return db['ChatQueue']['find']({'where':{'id':_0x562a7b[_0xc535('0x38')]['id']}})[_0xc535('0x15')](function(_0x4b0a16){return db[_0xc535('0x59')][_0xc535('0x5a')](function(_0x3046ae){return _0x4b0a16[_0xc535('0x5b')](_0x3cd46d,{'transaction':_0x3046ae})[_0xc535('0x15')](function(){return BPromise[_0xc535('0x5c')](_0x315e1a,function(_0x15e94f){return db[_0xc535('0x3c')]['findOrCreate']({'where':{'UserId':_0x15e94f['id'],'ChatQueueId':_0x562a7b[_0xc535('0x38')]['id']},'transaction':_0x3046ae});});})[_0xc535('0x15')](function(){_0x315e1a['forEach'](function(_0x353833){socket['emit']('userChatQueue:save',{'UserId':_0x353833['id'],'ChatQueueId':_0x4b0a16['id']});});});});});}})[_0xc535('0x15')](respondWithStatusCode(_0xa67501,null))[_0xc535('0x24')](handleError(_0xa67501,null));};exports[_0xc535('0x5d')]=function(_0x9cda5d,_0x6705d4){return db[_0xc535('0x51')][_0xc535('0x46')]({'where':{'id':_0x9cda5d[_0xc535('0x22')][_0xc535('0x54')]},'attributes':['id'],'include':[{'model':db[_0xc535('0x55')],'as':_0xc535('0x56'),'attributes':['id'],'raw':!![]}]})[_0xc535('0x15')](handleEntityNotFound(_0x6705d4,null))[_0xc535('0x15')](function(_0x3316e4){var _0x1d4931=_[_0xc535('0x48')](_0x3316e4,'id');var _0x4bc425=[];var _0x356a3e=[];var _0x218485=squel[_0xc535('0x5e')]();_0x218485[_0xc535('0x5f')](_0xc535('0x60'))[_0xc535('0x61')]('team_has_chat_queues','tq')[_0xc535('0x62')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc535('0x63'),_0x9cda5d[_0xc535('0x38')]['id']);for(var _0x17a82d=0x0;_0x17a82d<_0x3316e4[_0xc535('0x2a')];_0x17a82d+=0x1){let _0x5ba034=_0x3316e4[_0x17a82d];for(var _0x111c27=0x0;_0x111c27<_0x5ba034[_0xc535('0x56')][_0xc535('0x2a')];_0x111c27+=0x1){let _0x46c55b=_0x5ba034[_0xc535('0x56')][_0x111c27];var _0x3b0beb=_0x218485[_0xc535('0x64')]();_0x3b0beb[_0xc535('0x20')](_0xc535('0x65'),_0x46c55b['id']);_0x356a3e[_0xc535('0x66')](db['sequelize']['query'](_0x3b0beb[_0xc535('0x67')](),{'type':db[_0xc535('0x59')]['QueryTypes']['SELECT']})['then'](function(_0x22ad6a){if(_0x22ad6a[_0xc535('0x2a')]===0x1){return _0x46c55b['id'];}else{var _0x28b339=_[_0xc535('0x68')](_[_0xc535('0x48')](_0x22ad6a,_0xc535('0x69')),function(_0x33fada){return _[_0xc535('0x6a')](_0x1d4931,_0x33fada);});if(_0x28b339){return _0x46c55b['id'];}}}));}}return BPromise['all'](_0x356a3e)['then'](function(_0x3a5a9d){_0x4bc425=_(_0x4bc425)[_0xc535('0x6b')](_0x3a5a9d)[_0xc535('0x6c')]()[_0xc535('0x6d')]();return db[_0xc535('0x23')][_0xc535('0x37')]({'where':{'id':_0x9cda5d['params']['id']}})[_0xc535('0x15')](function(_0x3f0b21){return db[_0xc535('0x59')][_0xc535('0x5a')](function(_0x2f4a1d){return _0x3f0b21[_0xc535('0x5d')](_0x9cda5d[_0xc535('0x22')][_0xc535('0x54')],{'transaction':_0x2f4a1d})['then'](function(){if(!_[_0xc535('0x6e')](_0x4bc425)){return _0x3f0b21[_0xc535('0x6f')](_0x4bc425,{'transaction':_0x2f4a1d});}})[_0xc535('0x15')](function(){_0x4bc425[_0xc535('0x70')](function(_0x2e3e6b){socket['emit'](_0xc535('0x71'),{'UserId':_0x2e3e6b,'ChatQueueId':_0x3f0b21['id']});});});});});});})[_0xc535('0x15')](respondWithStatusCode(_0x6705d4,null))[_0xc535('0x24')](handleError(_0x6705d4,null));};exports[_0xc535('0x72')]=function(_0x2725cb,_0x335973){return db[_0xc535('0x23')][_0xc535('0x37')]({'where':{'id':_0x2725cb['params']['id']}})[_0xc535('0x15')](handleEntityNotFound(_0x335973,null))[_0xc535('0x15')](function(_0x6de2ea){if(_0x6de2ea){return _0x6de2ea[_0xc535('0x72')](_0x2725cb[_0xc535('0x2d')][_0xc535('0x54')],_['omit'](_0x2725cb['body'],[_0xc535('0x54'),'id'])||{})[_0xc535('0x73')](function(_0x2f5d3e){for(var _0x4c5f79=0x0;_0x4c5f79<_0x2725cb['body'][_0xc535('0x54')][_0xc535('0x2a')];_0x4c5f79+=0x1){socket[_0xc535('0x74')](_0xc535('0x75'),{'UserId':Number(_0x2725cb[_0xc535('0x2d')]['ids'][_0x4c5f79]),'ChatQueueId':Number(_0x2725cb['params']['id'])});}return _0x2f5d3e;});}})[_0xc535('0x15')](respondWithResult(_0x335973,null))[_0xc535('0x24')](handleError(_0x335973,null));};exports[_0xc535('0x6f')]=function(_0x29a968,_0x34cf17){return db[_0xc535('0x23')][_0xc535('0x37')]({'where':{'id':_0x29a968['params']['id']}})['then'](handleEntityNotFound(_0x34cf17,null))[_0xc535('0x15')](function(_0x16911b){if(_0x16911b){return _0x16911b['removeAgents'](_0x29a968[_0xc535('0x22')][_0xc535('0x54')])[_0xc535('0x15')](function(){if(_[_0xc535('0x76')](_0x29a968[_0xc535('0x22')][_0xc535('0x54')])){for(var _0xd4982e=0x0;_0xd4982e<_0x29a968[_0xc535('0x22')][_0xc535('0x54')][_0xc535('0x2a')];_0xd4982e+=0x1){socket[_0xc535('0x74')](_0xc535('0x71'),{'UserId':Number(_0x29a968[_0xc535('0x22')][_0xc535('0x54')][_0xd4982e]),'ChatQueueId':Number(_0x29a968[_0xc535('0x38')]['id'])});}}else{socket[_0xc535('0x74')](_0xc535('0x71'),{'UserId':Number(_0x29a968['query'][_0xc535('0x54')]),'ChatQueueId':Number(_0x29a968[_0xc535('0x38')]['id'])});}});}})[_0xc535('0x15')](respondWithStatusCode(_0x34cf17,null))[_0xc535('0x24')](handleError(_0x34cf17,null));};exports[_0xc535('0x77')]=function(_0x21737b,_0x4db3ed){var _0x5e1d9d={};var _0x5bd6f5={};var _0x409bd2;var _0x1c7879;return db[_0xc535('0x23')][_0xc535('0x3b')]({'where':{'id':_0x21737b[_0xc535('0x38')]['id']}})[_0xc535('0x15')](handleEntityNotFound(_0x4db3ed,null))[_0xc535('0x15')](function(_0x52a832){if(_0x52a832){_0x409bd2=_0x52a832;_0x5bd6f5[_0xc535('0x26')]=_[_0xc535('0x3d')](db['User'][_0xc535('0x1c')]);_0x5bd6f5['query']=_[_0xc535('0x3d')](_0x21737b[_0xc535('0x22')]);_0x5bd6f5['filters']=_[_0xc535('0x27')](_0x5bd6f5[_0xc535('0x26')],_0x5bd6f5[_0xc535('0x22')]);_0x5e1d9d['attributes']=_[_0xc535('0x27')](_0x5bd6f5[_0xc535('0x26')],qs['fields'](_0x21737b['query']['fields']));_0x5e1d9d['attributes']=_0x5e1d9d[_0xc535('0x29')][_0xc535('0x2a')]?_0x5e1d9d[_0xc535('0x29')]:_0x5bd6f5['model'];_0x5e1d9d[_0xc535('0x3f')]=qs[_0xc535('0x40')](_0x21737b['query'][_0xc535('0x40')]);_0x5e1d9d[_0xc535('0x20')]=qs[_0xc535('0x41')](_['pick'](_0x21737b[_0xc535('0x22')],_0x5bd6f5[_0xc535('0x41')]));if(_0x21737b[_0xc535('0x22')][_0xc535('0x44')]){_0x5e1d9d[_0xc535('0x20')]=_[_0xc535('0x43')](_0x5e1d9d['where'],{'$or':_[_0xc535('0x48')](_0x5e1d9d[_0xc535('0x29')],function(_0x4d8e21){var _0x4657dc={};_0x4657dc[_0x4d8e21]={'$like':'%'+_0x21737b[_0xc535('0x22')]['filter']+'%'};return _0x4657dc;})});}_0x5e1d9d=_[_0xc535('0x43')]({},_0x5e1d9d,_0x21737b[_0xc535('0x45')]);return _0x409bd2[_0xc535('0x77')](_0x5e1d9d);}})[_0xc535('0x15')](function(_0x105d74){if(_0x105d74){_0x1c7879=_0x105d74[_0xc535('0x2a')];if(!_0x21737b[_0xc535('0x22')][_0xc535('0x3e')](_0xc535('0x53'))){_0x5e1d9d['limit']=qs['limit'](_0x21737b[_0xc535('0x22')][_0xc535('0x11')]);_0x5e1d9d['offset']=qs[_0xc535('0x10')](_0x21737b[_0xc535('0x22')]['offset']);}return _0x409bd2[_0xc535('0x77')](_0x5e1d9d);}})[_0xc535('0x15')](function(_0x2790ff){if(_0x2790ff){return _0x2790ff?{'count':_0x1c7879,'rows':_0x2790ff}:null;}})['then'](respondWithResult(_0x4db3ed,null))[_0xc535('0x24')](handleError(_0x4db3ed,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 293ad0a..8ef714a 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 _0xf9b4=['emit','hook','events','setMaxListeners','save','update','remove'];(function(_0x5df061,_0x400a05){var _0x5a4ef6=function(_0x224a94){while(--_0x224a94){_0x5df061['push'](_0x5df061['shift']());}};_0x5a4ef6(++_0x400a05);}(_0xf9b4,0x64));var _0x4f9b=function(_0xf61129,_0x523668){_0xf61129=_0xf61129-0x0;var _0xefa38a=_0xf9b4[_0xf61129];return _0xefa38a;};'use strict';var EventEmitter=require(_0x4f9b('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4f9b('0x1')](0x0);var events={'afterCreate':_0x4f9b('0x2'),'afterUpdate':_0x4f9b('0x3'),'afterDestroy':_0x4f9b('0x4')};function emitEvent(_0x561d1e){return function(_0x3e68ce,_0x1655ba,_0x3f37cb){ChatQueueEvents[_0x4f9b('0x5')](_0x561d1e+':'+_0x3e68ce['id'],_0x3e68ce);ChatQueueEvents[_0x4f9b('0x5')](_0x561d1e,_0x3e68ce);_0x3f37cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x4f9b('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x19d4=['remove','emit','hasOwnProperty','hook','exports','setMaxListeners','save','update'];(function(_0x37d792,_0x4e63d9){var _0x511e7a=function(_0x1238f9){while(--_0x1238f9){_0x37d792['push'](_0x37d792['shift']());}};_0x511e7a(++_0x4e63d9);}(_0x19d4,0x1a5));var _0x419d=function(_0x48be95,_0x59f11e){_0x48be95=_0x48be95-0x0;var _0x32e215=_0x19d4[_0x48be95];return _0x32e215;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x419d('0x0')](0x0);var events={'afterCreate':_0x419d('0x1'),'afterUpdate':_0x419d('0x2'),'afterDestroy':_0x419d('0x3')};function emitEvent(_0xe9f332){return function(_0x556f2b,_0x1738ce,_0x1643de){ChatQueueEvents[_0x419d('0x4')](_0xe9f332+':'+_0x556f2b['id'],_0x556f2b);ChatQueueEvents[_0x419d('0x4')](_0xe9f332,_0x556f2b);_0x1643de(null);};}for(var e in events){if(events[_0x419d('0x5')](e)){var event=events[e];ChatQueue[_0x419d('0x6')](e,emitEvent(event));}}module[_0x419d('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index b13bab3..092be5f 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 _0x6045=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatQueue.attributes','exports','chat_queues'];(function(_0x349577,_0x50be5a){var _0x22b2e7=function(_0x3dec87){while(--_0x3dec87){_0x349577['push'](_0x349577['shift']());}};_0x22b2e7(++_0x50be5a);}(_0x6045,0xb4));var _0x5604=function(_0x3237e8,_0x50d584){_0x3237e8=_0x3237e8-0x0;var _0x1e23c3=_0x6045[_0x3237e8];return _0x1e23c3;};'use strict';var _=require(_0x5604('0x0'));var util=require(_0x5604('0x1'));var logger=require(_0x5604('0x2'))(_0x5604('0x3'));var moment=require(_0x5604('0x4'));var BPromise=require(_0x5604('0x5'));var rp=require(_0x5604('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5604('0x7'));module[_0x5604('0x8')]=function(_0x3b9553,_0xa1a7ef){return _0x3b9553['define']('ChatQueue',attributes,{'tableName':_0x5604('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f66=['define','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x27834e,_0x5dbff2){var _0x39019c=function(_0xc2d4cf){while(--_0xc2d4cf){_0x27834e['push'](_0x27834e['shift']());}};_0x39019c(++_0x5dbff2);}(_0x3f66,0xd4));var _0x63f6=function(_0x480ac1,_0x184674){_0x480ac1=_0x480ac1-0x0;var _0x428632=_0x3f66[_0x480ac1];return _0x428632;};'use strict';var _=require(_0x63f6('0x0'));var util=require(_0x63f6('0x1'));var logger=require(_0x63f6('0x2'))(_0x63f6('0x3'));var moment=require(_0x63f6('0x4'));var BPromise=require(_0x63f6('0x5'));var rp=require(_0x63f6('0x6'));var fs=require('fs');var path=require(_0x63f6('0x7'));var rimraf=require(_0x63f6('0x8'));var config=require(_0x63f6('0x9'));var attributes=require(_0x63f6('0xa'));module[_0x63f6('0xb')]=function(_0x227b28,_0x3cab5f){return _0x227b28[_0x63f6('0xc')]('ChatQueue',attributes,{'tableName':_0x63f6('0xd'),'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 be547a8..419203b 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 _0x6582=['http','redis','defaults','localhost','./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetChatQueue','ChatQueue','options','attributes','limit','include','map','model','then','ShowChatQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x115175,_0x262286){var _0x532de1=function(_0x24f1fe){while(--_0x24f1fe){_0x115175['push'](_0x115175['shift']());}};_0x532de1(++_0x262286);}(_0x6582,0x108));var _0x2658=function(_0x263b1f,_0x3f2376){_0x263b1f=_0x263b1f-0x0;var _0x4aa612=_0x6582[_0x263b1f];return _0x4aa612;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var moment=require(_0x2658('0x2'));var BPromise=require(_0x2658('0x3'));var rs=require(_0x2658('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2658('0x5'))['db'];var utils=require(_0x2658('0x6'));var logger=require(_0x2658('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2658('0x8')][_0x2658('0x9')]({'port':0x232a});config[_0x2658('0xa')]=_[_0x2658('0xb')](config[_0x2658('0xa')],{'host':_0x2658('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2658('0xa')]));require(_0x2658('0xd'))[_0x2658('0xe')](socket);function respondWithRpcPromise(_0x99b9db,_0x455ff9,_0x2b2561){return new BPromise(function(_0x3f22a5,_0x1aaaac){return client[_0x2658('0xf')](_0x99b9db,_0x2b2561)['then'](function(_0x20fe6d){logger['info'](_0x2658('0x10'),_0x455ff9,_0x2658('0x11'));logger[_0x2658('0x12')](_0x2658('0x13'),_0x455ff9,_0x2658('0x11'),JSON[_0x2658('0x14')](_0x20fe6d));if(_0x20fe6d[_0x2658('0x15')]){if(_0x20fe6d['error'][_0x2658('0x16')]===0x1f4){logger[_0x2658('0x15')](_0x2658('0x10'),_0x455ff9,_0x20fe6d[_0x2658('0x15')][_0x2658('0x17')]);return _0x1aaaac(_0x20fe6d['error'][_0x2658('0x17')]);}logger[_0x2658('0x15')](_0x2658('0x10'),_0x455ff9,_0x20fe6d['error'][_0x2658('0x17')]);return _0x3f22a5(_0x20fe6d[_0x2658('0x15')][_0x2658('0x17')]);}else{logger[_0x2658('0x18')]('ChatQueue,\x20%s,\x20%s',_0x455ff9,_0x2658('0x11'));_0x3f22a5(_0x20fe6d['result'][_0x2658('0x17')]);}})[_0x2658('0x19')](function(_0x307220){logger[_0x2658('0x15')]('ChatQueue,\x20%s,\x20%s',_0x455ff9,_0x307220);_0x1aaaac(_0x307220);});});}exports[_0x2658('0x1a')]=function(_0x42c350){var _0x467481=this;return new Promise(function(_0xb0dab8,_0x23cf70){return db[_0x2658('0x1b')]['findAll']({'raw':_0x42c350[_0x2658('0x1c')]?_0x42c350['options']['raw']===undefined?!![]:![]:!![],'where':_0x42c350[_0x2658('0x1c')]?_0x42c350[_0x2658('0x1c')]['where']||null:null,'attributes':_0x42c350[_0x2658('0x1c')]?_0x42c350['options'][_0x2658('0x1d')]||null:null,'limit':_0x42c350[_0x2658('0x1c')]?_0x42c350[_0x2658('0x1c')][_0x2658('0x1e')]||null:null,'include':_0x42c350[_0x2658('0x1c')]?_0x42c350[_0x2658('0x1c')][_0x2658('0x1f')]?_[_0x2658('0x20')](_0x42c350[_0x2658('0x1c')][_0x2658('0x1f')],function(_0x566cec){return{'model':db[_0x566cec[_0x2658('0x21')]],'as':_0x566cec['as'],'attributes':_0x566cec[_0x2658('0x1d')],'include':_0x566cec[_0x2658('0x1f')]?_[_0x2658('0x20')](_0x566cec[_0x2658('0x1f')],function(_0x3a4b45){return{'model':db[_0x3a4b45['model']],'as':_0x3a4b45['as'],'attributes':_0x3a4b45[_0x2658('0x1d')],'include':_0x3a4b45[_0x2658('0x1f')]?_[_0x2658('0x20')](_0x3a4b45[_0x2658('0x1f')],function(_0x27e0f5){return{'model':db[_0x27e0f5[_0x2658('0x21')]],'as':_0x27e0f5['as'],'attributes':_0x27e0f5[_0x2658('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2658('0x22')](function(_0xd891fe){logger[_0x2658('0x18')](_0x2658('0x1a'),_0x42c350);logger[_0x2658('0x12')](_0x2658('0x1a'),_0x42c350,JSON[_0x2658('0x14')](_0xd891fe));_0xb0dab8(_0xd891fe);})[_0x2658('0x19')](function(_0x3db87d){logger[_0x2658('0x15')](_0x2658('0x1a'),_0x3db87d['message'],_0x42c350);_0x23cf70(_0x467481[_0x2658('0x15')](0x1f4,_0x3db87d[_0x2658('0x17')]));});});};exports[_0x2658('0x23')]=function(_0x49bd5e){var _0x3955eb=this;return new Promise(function(_0x44db3c,_0x28cea6){return db['ChatQueue'][_0x2658('0x24')]({'raw':_0x49bd5e[_0x2658('0x1c')]?_0x49bd5e[_0x2658('0x1c')][_0x2658('0x25')]===undefined?!![]:![]:!![],'where':_0x49bd5e[_0x2658('0x1c')]?_0x49bd5e[_0x2658('0x1c')][_0x2658('0x26')]||null:null,'attributes':_0x49bd5e[_0x2658('0x1c')]?_0x49bd5e[_0x2658('0x1c')]['attributes']||null:null,'include':_0x49bd5e[_0x2658('0x1c')]?_0x49bd5e[_0x2658('0x1c')][_0x2658('0x1f')]?_['map'](_0x49bd5e['options']['include'],function(_0x15e7ec){return{'model':db[_0x15e7ec[_0x2658('0x21')]],'as':_0x15e7ec['as'],'attributes':_0x15e7ec[_0x2658('0x1d')],'include':_0x15e7ec[_0x2658('0x1f')]?_[_0x2658('0x20')](_0x15e7ec[_0x2658('0x1f')],function(_0x57f891){return{'model':db[_0x57f891[_0x2658('0x21')]],'as':_0x57f891['as'],'attributes':_0x57f891[_0x2658('0x1d')],'include':_0x57f891[_0x2658('0x1f')]?_['map'](_0x57f891[_0x2658('0x1f')],function(_0x3798ba){return{'model':db[_0x3798ba[_0x2658('0x21')]],'as':_0x3798ba['as'],'attributes':_0x3798ba[_0x2658('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf632b6){logger[_0x2658('0x18')]('ShowChatQueue',_0x49bd5e);logger['debug']('ShowChatQueue',_0x49bd5e,JSON['stringify'](_0xf632b6));_0x44db3c(_0xf632b6);})[_0x2658('0x19')](function(_0x1f6b70){logger[_0x2658('0x15')]('ShowChatQueue',_0x1f6b70[_0x2658('0x17')],_0x49bd5e);_0x28cea6(_0x3955eb['error'](0x1f4,_0x1f6b70['message']));});});}; \ No newline at end of file +var _0x9c9b=['include','map','model','debug','stringify','catch','find','ShowChatQueue','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','error','message','GetChatQueue','ChatQueue','findAll','options','raw','attributes'];(function(_0x1c0b14,_0x4961f1){var _0xb199ac=function(_0x216294){while(--_0x216294){_0x1c0b14['push'](_0x1c0b14['shift']());}};_0xb199ac(++_0x4961f1);}(_0x9c9b,0x194));var _0xb9c9=function(_0x2c58ff,_0x14c04b){_0x2c58ff=_0x2c58ff-0x0;var _0x19789f=_0x9c9b[_0x2c58ff];return _0x19789f;};'use strict';var _=require('lodash');var util=require(_0xb9c9('0x0'));var moment=require(_0xb9c9('0x1'));var BPromise=require(_0xb9c9('0x2'));var rs=require(_0xb9c9('0x3'));var fs=require('fs');var Redis=require(_0xb9c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9c9('0x5'));var logger=require(_0xb9c9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb9c9('0x7')][_0xb9c9('0x8')]({'port':0x232a});config[_0xb9c9('0x9')]=_[_0xb9c9('0xa')](config[_0xb9c9('0x9')],{'host':_0xb9c9('0xb'),'port':0x18eb});var socket=require(_0xb9c9('0xc'))(new Redis(config[_0xb9c9('0x9')]));require(_0xb9c9('0xd'))[_0xb9c9('0xe')](socket);function respondWithRpcPromise(_0x286ad3,_0x2a70ad,_0xfe2780){return new BPromise(function(_0x5a2fb6,_0x490d67){return client[_0xb9c9('0xf')](_0x286ad3,_0xfe2780)[_0xb9c9('0x10')](function(_0x1e06a4){logger[_0xb9c9('0x11')](_0xb9c9('0x12'),_0x2a70ad,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2a70ad,_0xb9c9('0x13'),JSON['stringify'](_0x1e06a4));if(_0x1e06a4[_0xb9c9('0x14')]){if(_0x1e06a4[_0xb9c9('0x14')]['code']===0x1f4){logger['error'](_0xb9c9('0x12'),_0x2a70ad,_0x1e06a4[_0xb9c9('0x14')][_0xb9c9('0x15')]);return _0x490d67(_0x1e06a4['error'][_0xb9c9('0x15')]);}logger[_0xb9c9('0x14')](_0xb9c9('0x12'),_0x2a70ad,_0x1e06a4[_0xb9c9('0x14')][_0xb9c9('0x15')]);return _0x5a2fb6(_0x1e06a4['error'][_0xb9c9('0x15')]);}else{logger[_0xb9c9('0x11')](_0xb9c9('0x12'),_0x2a70ad,'request\x20sent');_0x5a2fb6(_0x1e06a4['result']['message']);}})['catch'](function(_0x9ff31e){logger[_0xb9c9('0x14')](_0xb9c9('0x12'),_0x2a70ad,_0x9ff31e);_0x490d67(_0x9ff31e);});});}exports[_0xb9c9('0x16')]=function(_0x155c29){var _0x2346e3=this;return new Promise(function(_0x1836b6,_0x2faa66){return db[_0xb9c9('0x17')][_0xb9c9('0x18')]({'raw':_0x155c29[_0xb9c9('0x19')]?_0x155c29[_0xb9c9('0x19')][_0xb9c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x155c29['options']?_0x155c29[_0xb9c9('0x19')]['where']||null:null,'attributes':_0x155c29[_0xb9c9('0x19')]?_0x155c29[_0xb9c9('0x19')][_0xb9c9('0x1b')]||null:null,'limit':_0x155c29[_0xb9c9('0x19')]?_0x155c29[_0xb9c9('0x19')]['limit']||null:null,'include':_0x155c29[_0xb9c9('0x19')]?_0x155c29[_0xb9c9('0x19')][_0xb9c9('0x1c')]?_[_0xb9c9('0x1d')](_0x155c29['options'][_0xb9c9('0x1c')],function(_0x55abcf){return{'model':db[_0x55abcf['model']],'as':_0x55abcf['as'],'attributes':_0x55abcf['attributes'],'include':_0x55abcf[_0xb9c9('0x1c')]?_[_0xb9c9('0x1d')](_0x55abcf[_0xb9c9('0x1c')],function(_0x4e8152){return{'model':db[_0x4e8152[_0xb9c9('0x1e')]],'as':_0x4e8152['as'],'attributes':_0x4e8152[_0xb9c9('0x1b')],'include':_0x4e8152[_0xb9c9('0x1c')]?_[_0xb9c9('0x1d')](_0x4e8152[_0xb9c9('0x1c')],function(_0x3bfc70){return{'model':db[_0x3bfc70[_0xb9c9('0x1e')]],'as':_0x3bfc70['as'],'attributes':_0x3bfc70[_0xb9c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb9c9('0x10')](function(_0x482cb1){logger[_0xb9c9('0x11')](_0xb9c9('0x16'),_0x155c29);logger[_0xb9c9('0x1f')]('GetChatQueue',_0x155c29,JSON[_0xb9c9('0x20')](_0x482cb1));_0x1836b6(_0x482cb1);})[_0xb9c9('0x21')](function(_0x46d421){logger[_0xb9c9('0x14')]('GetChatQueue',_0x46d421[_0xb9c9('0x15')],_0x155c29);_0x2faa66(_0x2346e3[_0xb9c9('0x14')](0x1f4,_0x46d421[_0xb9c9('0x15')]));});});};exports['ShowChatQueue']=function(_0x38bacd){var _0x225051=this;return new Promise(function(_0x58a8cc,_0x34ff7c){return db[_0xb9c9('0x17')][_0xb9c9('0x22')]({'raw':_0x38bacd[_0xb9c9('0x19')]?_0x38bacd[_0xb9c9('0x19')][_0xb9c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x38bacd[_0xb9c9('0x19')]?_0x38bacd[_0xb9c9('0x19')]['where']||null:null,'attributes':_0x38bacd[_0xb9c9('0x19')]?_0x38bacd['options'][_0xb9c9('0x1b')]||null:null,'include':_0x38bacd['options']?_0x38bacd[_0xb9c9('0x19')][_0xb9c9('0x1c')]?_[_0xb9c9('0x1d')](_0x38bacd[_0xb9c9('0x19')][_0xb9c9('0x1c')],function(_0x56003f){return{'model':db[_0x56003f[_0xb9c9('0x1e')]],'as':_0x56003f['as'],'attributes':_0x56003f[_0xb9c9('0x1b')],'include':_0x56003f['include']?_[_0xb9c9('0x1d')](_0x56003f[_0xb9c9('0x1c')],function(_0x26d75b){return{'model':db[_0x26d75b[_0xb9c9('0x1e')]],'as':_0x26d75b['as'],'attributes':_0x26d75b[_0xb9c9('0x1b')],'include':_0x26d75b['include']?_[_0xb9c9('0x1d')](_0x26d75b[_0xb9c9('0x1c')],function(_0x304f69){return{'model':db[_0x304f69[_0xb9c9('0x1e')]],'as':_0x304f69['as'],'attributes':_0x304f69[_0xb9c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb9c9('0x10')](function(_0x2b8ba3){logger[_0xb9c9('0x11')](_0xb9c9('0x23'),_0x38bacd);logger['debug'](_0xb9c9('0x23'),_0x38bacd,JSON[_0xb9c9('0x20')](_0x2b8ba3));_0x58a8cc(_0x2b8ba3);})[_0xb9c9('0x21')](function(_0x2774da){logger['error'](_0xb9c9('0x23'),_0x2774da[_0xb9c9('0x15')],_0x38bacd);_0x34ff7c(_0x225051['error'](0x1f4,_0x2774da['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 56bed52..7b386bd 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 _0x00bb=['removeListener','length','chatQueue:','./chatQueue.events','save','remove','emit'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'use strict';var ChatQueueEvents=require(_0xb00b('0x0'));var events=[_0xb00b('0x1'),_0xb00b('0x2'),'update'];function createListener(_0x170f94,_0x47a3bf){return function(_0x278c5e){_0x47a3bf[_0xb00b('0x3')](_0x170f94,_0x278c5e);};}function removeListener(_0x582ef9,_0x14b5d0){return function(){ChatQueueEvents[_0xb00b('0x4')](_0x582ef9,_0x14b5d0);};}exports['register']=function(_0x574cf8){for(var _0x532ffb=0x0,_0x36e363=events[_0xb00b('0x5')];_0x532ffb<_0x36e363;_0x532ffb++){var _0x41dfc9=events[_0x532ffb];var _0x37f07d=createListener(_0xb00b('0x6')+_0x41dfc9,_0x574cf8);ChatQueueEvents['on'](_0x41dfc9,_0x37f07d);}}; \ No newline at end of file +var _0xc874=['emit','removeListener','register','length','./chatQueue.events','remove','update'];(function(_0x231495,_0x2ea4b7){var _0x5d3d2d=function(_0x570abf){while(--_0x570abf){_0x231495['push'](_0x231495['shift']());}};_0x5d3d2d(++_0x2ea4b7);}(_0xc874,0x154));var _0x4c87=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xc874[_0x29b609];return _0x54c952;};'use strict';var ChatQueueEvents=require(_0x4c87('0x0'));var events=['save',_0x4c87('0x1'),_0x4c87('0x2')];function createListener(_0x505440,_0x5e6d61){return function(_0xfc1b9f){_0x5e6d61[_0x4c87('0x3')](_0x505440,_0xfc1b9f);};}function removeListener(_0x1c3dbc,_0x575a7c){return function(){ChatQueueEvents[_0x4c87('0x4')](_0x1c3dbc,_0x575a7c);};}exports[_0x4c87('0x5')]=function(_0x5d63ae){for(var _0x46e0f5=0x0,_0x3dafe0=events[_0x4c87('0x6')];_0x46e0f5<_0x3dafe0;_0x46e0f5++){var _0xdc4a29=events[_0x46e0f5];var _0x116649=createListener('chatQueue:'+_0xdc4a29,_0x5d63ae);ChatQueueEvents['on'](_0xdc4a29,_0x116649);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 52231a0..99d2c81 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x2f5105,_0x55607e){var _0x47c791=function(_0x21cd3e){while(--_0x21cd3e){_0x2f5105['push'](_0x2f5105['shift']());}};_0x47c791(++_0x55607e);}(_0x55ca,0x126));var _0xa55c=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x55ca[_0xe719ec];return _0x4842a1;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x2f7855,_0x4c5f54){var _0x5236d8=function(_0x2ea41c){while(--_0x2ea41c){_0x2f7855['push'](_0x2f7855['shift']());}};_0x5236d8(++_0x4c5f54);}(_0x55ca,0x126));var _0xa55c=function(_0x58c654,_0x56f774){_0x58c654=_0x58c654-0x0;var _0x1b1164=_0x55ca[_0x58c654];return _0x1b1164;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index dde3f35..f173f01 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 _0xa4d3=['STRING','DATE','moment','sequelize','exports'];(function(_0x4ceb5d,_0x10ec2d){var _0x336609=function(_0x15bf21){while(--_0x15bf21){_0x4ceb5d['push'](_0x4ceb5d['shift']());}};_0x336609(++_0x10ec2d);}(_0xa4d3,0x1d3));var _0x3a4d=function(_0xbc54f0,_0x53314d){_0xbc54f0=_0xbc54f0-0x0;var _0x6e22ca=_0xa4d3[_0xbc54f0];return _0x6e22ca;};'use strict';var moment=require(_0x3a4d('0x0'));var Sequelize=require(_0x3a4d('0x1'));module[_0x3a4d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3a4d('0x3')]},'joinAt':{'type':Sequelize[_0x3a4d('0x4')]},'leaveAt':{'type':Sequelize[_0x3a4d('0x4')]},'acceptAt':{'type':Sequelize[_0x3a4d('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3a4d('0x3')]}}; \ No newline at end of file +var _0x91d0=['exports','DATE','STRING','moment','sequelize'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0x91d0,0x1bb));var _0x091d=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0x91d0[_0x27c068];return _0xe5a67f;};'use strict';var moment=require(_0x091d('0x0'));var Sequelize=require(_0x091d('0x1'));module[_0x091d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x091d('0x3')]},'exitAt':{'type':Sequelize[_0x091d('0x3')]},'reason':{'type':Sequelize[_0x091d('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c379a5a..0d6c21e 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 _0xb470=['set','apply','reject','save','update','then','error','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','catch','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x3a468c,_0x56fa70){var _0x2d5acf=function(_0x404a66){while(--_0x404a66){_0x3a468c['push'](_0x3a468c['shift']());}};_0x2d5acf(++_0x56fa70);}(_0xb470,0x75));var _0x0b47=function(_0x349527,_0x24996f){_0x349527=_0x349527-0x0;var _0xe3bb20=_0xb470[_0x349527];return _0xe3bb20;};'use strict';var emlformat=require(_0x0b47('0x0'));var rimraf=require(_0x0b47('0x1'));var zipdir=require(_0x0b47('0x2'));var jsonpatch=require(_0x0b47('0x3'));var rp=require('request-promise');var moment=require(_0x0b47('0x4'));var BPromise=require(_0x0b47('0x5'));var Mustache=require(_0x0b47('0x6'));var util=require('util');var path=require(_0x0b47('0x7'));var sox=require(_0x0b47('0x8'));var csv=require(_0x0b47('0x9'));var ejs=require(_0x0b47('0xa'));var fs=require('fs');var fs_extra=require(_0x0b47('0xb'));var _=require(_0x0b47('0xc'));var squel=require(_0x0b47('0xd'));var crypto=require(_0x0b47('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b47('0xf'));var Redis=require(_0x0b47('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0b47('0x11'));var as=require(_0x0b47('0x12'));var hardwareService=require(_0x0b47('0x13'));var logger=require(_0x0b47('0x14'))(_0x0b47('0x15'));var utils=require(_0x0b47('0x16'));var config=require(_0x0b47('0x17'));var licenseUtil=require(_0x0b47('0x18'));var db=require(_0x0b47('0x19'))['db'];function respondWithStatusCode(_0x3d8949,_0x53ce05){_0x53ce05=_0x53ce05||0xcc;return function(_0x48efdd){if(_0x48efdd){return _0x3d8949[_0x0b47('0x1a')](_0x53ce05);}return _0x3d8949['status'](_0x53ce05)[_0x0b47('0x1b')]();};}function respondWithResult(_0x1e4988,_0x4d427b){_0x4d427b=_0x4d427b||0xc8;return function(_0x36fe0a){if(_0x36fe0a){return _0x1e4988[_0x0b47('0x1c')](_0x4d427b)[_0x0b47('0x1d')](_0x36fe0a);}};}function respondWithFilteredResult(_0x379c9d,_0x387084){return function(_0x1c5e68){if(_0x1c5e68){var _0x1e9588=typeof _0x387084[_0x0b47('0x1e')]===_0x0b47('0x1f')&&typeof _0x387084[_0x0b47('0x20')]==='undefined';var _0x151eb6=_0x1c5e68['count'];var _0x11f305=_0x1e9588?0x0:_0x387084[_0x0b47('0x1e')];var _0x2b1024=_0x1e9588?_0x1c5e68['count']:_0x387084[_0x0b47('0x1e')]+_0x387084['limit'];var _0x4b5bac;if(_0x2b1024>=_0x151eb6){_0x2b1024=_0x151eb6;_0x4b5bac=0xc8;}else{_0x4b5bac=0xce;}_0x379c9d[_0x0b47('0x1c')](_0x4b5bac);return _0x379c9d[_0x0b47('0x21')]('Content-Range',_0x11f305+'-'+_0x2b1024+'/'+_0x151eb6)[_0x0b47('0x1d')](_0x1c5e68);}return null;};}function patchUpdates(_0x501357){return function(_0x450f1a){try{jsonpatch[_0x0b47('0x22')](_0x450f1a,_0x501357,!![]);}catch(_0x34b129){return BPromise[_0x0b47('0x23')](_0x34b129);}return _0x450f1a[_0x0b47('0x24')]();};}function saveUpdates(_0x2c709c,_0x3bd7f1){return function(_0x2dfdb4){if(_0x2dfdb4){return _0x2dfdb4[_0x0b47('0x25')](_0x2c709c)[_0x0b47('0x26')](function(_0x3e37e8){return _0x3e37e8;});}return null;};}function removeEntity(_0x4f79d4,_0xc87cd){return function(_0x11935a){if(_0x11935a){return _0x11935a['destroy']()[_0x0b47('0x26')](function(){_0x4f79d4[_0x0b47('0x1c')](0xcc)[_0x0b47('0x1b')]();});}};}function handleEntityNotFound(_0xd9c35c,_0x59af8e){return function(_0x47d1b2){if(!_0x47d1b2){_0xd9c35c[_0x0b47('0x1a')](0x194);}return _0x47d1b2;};}function handleError(_0x4228e5,_0x5950fa){_0x5950fa=_0x5950fa||0x1f4;return function(_0x138a03){logger[_0x0b47('0x27')](_0x138a03[_0x0b47('0x28')]);if(_0x138a03[_0x0b47('0x29')]){delete _0x138a03[_0x0b47('0x29')];}_0x4228e5[_0x0b47('0x1c')](_0x5950fa)[_0x0b47('0x2a')](_0x138a03);};}exports[_0x0b47('0x2b')]=function(_0x3550cc,_0x15d877){var _0x370022={},_0x5e90f1={},_0x5bea0d={'count':0x0,'rows':[]};var _0x10c966=_['map'](db[_0x0b47('0x2c')][_0x0b47('0x2d')],function(_0x1842ec){return{'name':_0x1842ec[_0x0b47('0x2e')],'type':_0x1842ec[_0x0b47('0x2f')]['key']};});_0x5e90f1[_0x0b47('0x30')]=_[_0x0b47('0x31')](_0x10c966,_0x0b47('0x29'));_0x5e90f1['query']=_[_0x0b47('0x32')](_0x3550cc[_0x0b47('0x33')]);_0x5e90f1[_0x0b47('0x34')]=_[_0x0b47('0x35')](_0x5e90f1[_0x0b47('0x30')],_0x5e90f1[_0x0b47('0x33')]);_0x370022['attributes']=_['intersection'](_0x5e90f1[_0x0b47('0x30')],qs[_0x0b47('0x36')](_0x3550cc[_0x0b47('0x33')][_0x0b47('0x36')]));_0x370022[_0x0b47('0x37')]=_0x370022[_0x0b47('0x37')][_0x0b47('0x38')]?_0x370022[_0x0b47('0x37')]:_0x5e90f1[_0x0b47('0x30')];if(!_0x3550cc[_0x0b47('0x33')][_0x0b47('0x39')]('nolimit')){_0x370022['limit']=qs[_0x0b47('0x20')](_0x3550cc['query'][_0x0b47('0x20')]);_0x370022[_0x0b47('0x1e')]=qs[_0x0b47('0x1e')](_0x3550cc[_0x0b47('0x33')][_0x0b47('0x1e')]);}_0x370022[_0x0b47('0x3a')]=qs['sort'](_0x3550cc['query']['sort']);_0x370022[_0x0b47('0x3b')]=qs[_0x0b47('0x34')](_[_0x0b47('0x3c')](_0x3550cc[_0x0b47('0x33')],_0x5e90f1[_0x0b47('0x34')]),_0x10c966);if(_0x3550cc[_0x0b47('0x33')]['filter']){_0x370022[_0x0b47('0x3b')]=_[_0x0b47('0x3d')](_0x370022[_0x0b47('0x3b')],{'$or':_[_0x0b47('0x31')](_0x10c966,function(_0x56f92b){if(_0x56f92b['type']!==_0x0b47('0x3e')){var _0x46f0cf={};_0x46f0cf[_0x56f92b['name']]={'$like':'%'+_0x3550cc[_0x0b47('0x33')][_0x0b47('0x3f')]+'%'};return _0x46f0cf;}})});}_0x370022=_[_0x0b47('0x3d')]({},_0x370022,_0x3550cc['options']);var _0x4c724e={'where':_0x370022[_0x0b47('0x3b')]};return db[_0x0b47('0x2c')][_0x0b47('0x40')](_0x4c724e)[_0x0b47('0x26')](function(_0x166334){_0x5bea0d[_0x0b47('0x40')]=_0x166334;if(_0x3550cc[_0x0b47('0x33')][_0x0b47('0x41')]){_0x370022[_0x0b47('0x42')]=[{'all':!![]}];}return db[_0x0b47('0x2c')][_0x0b47('0x43')](_0x370022);})[_0x0b47('0x26')](function(_0x2bd25b){_0x5bea0d['rows']=_0x2bd25b;return _0x5bea0d;})['then'](respondWithFilteredResult(_0x15d877,_0x370022))[_0x0b47('0x44')](handleError(_0x15d877,null));};exports['show']=function(_0x1d424f,_0x484efb){var _0x38e02f={'raw':!![],'where':{'id':_0x1d424f[_0x0b47('0x45')]['id']}},_0x274061={};_0x274061[_0x0b47('0x30')]=_['keys'](db[_0x0b47('0x2c')][_0x0b47('0x2d')]);_0x274061['query']=_[_0x0b47('0x32')](_0x1d424f['query']);_0x274061[_0x0b47('0x34')]=_[_0x0b47('0x35')](_0x274061[_0x0b47('0x30')],_0x274061[_0x0b47('0x33')]);_0x38e02f[_0x0b47('0x37')]=_[_0x0b47('0x35')](_0x274061[_0x0b47('0x30')],qs[_0x0b47('0x36')](_0x1d424f[_0x0b47('0x33')][_0x0b47('0x36')]));_0x38e02f['attributes']=_0x38e02f['attributes']['length']?_0x38e02f['attributes']:_0x274061[_0x0b47('0x30')];if(_0x1d424f[_0x0b47('0x33')]['includeAll']){_0x38e02f[_0x0b47('0x42')]=[{'all':!![]}];}_0x38e02f=_['merge']({},_0x38e02f,_0x1d424f[_0x0b47('0x46')]);return db[_0x0b47('0x2c')]['find'](_0x38e02f)[_0x0b47('0x26')](handleEntityNotFound(_0x484efb,null))[_0x0b47('0x26')](respondWithResult(_0x484efb,null))[_0x0b47('0x44')](handleError(_0x484efb,null));};exports[_0x0b47('0x47')]=function(_0x4ef68d,_0x279665){return db[_0x0b47('0x2c')][_0x0b47('0x47')](_0x4ef68d['body'],{})[_0x0b47('0x26')](respondWithResult(_0x279665,0xc9))[_0x0b47('0x44')](handleError(_0x279665,null));};exports['update']=function(_0x1d5789,_0x5c44b9){if(_0x1d5789['body']['id']){delete _0x1d5789[_0x0b47('0x48')]['id'];}return db[_0x0b47('0x2c')]['find']({'where':{'id':_0x1d5789[_0x0b47('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c44b9,null))[_0x0b47('0x26')](saveUpdates(_0x1d5789[_0x0b47('0x48')],null))[_0x0b47('0x26')](respondWithResult(_0x5c44b9,null))['catch'](handleError(_0x5c44b9,null));};exports['destroy']=function(_0x1c222a,_0x19d635){return db[_0x0b47('0x2c')][_0x0b47('0x49')]({'where':{'id':_0x1c222a[_0x0b47('0x45')]['id']}})[_0x0b47('0x26')](handleEntityNotFound(_0x19d635,null))[_0x0b47('0x26')](removeEntity(_0x19d635,null))[_0x0b47('0x44')](handleError(_0x19d635,null));};exports[_0x0b47('0x4a')]=function(_0xcb8582,_0x5e933){return db['ChatQueueReport'][_0x0b47('0x4a')]()[_0x0b47('0x26')](respondWithResult(_0x5e933,null))[_0x0b47('0x44')](handleError(_0x5e933,null));}; \ No newline at end of file +var _0x6f83=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','ChatQueueReport','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error'];(function(_0x56baac,_0x3de33a){var _0x5b1c1f=function(_0x504359){while(--_0x504359){_0x56baac['push'](_0x56baac['shift']());}};_0x5b1c1f(++_0x3de33a);}(_0x6f83,0x72));var _0x36f8=function(_0x289e33,_0x4b74b8){_0x289e33=_0x289e33-0x0;var _0x352078=_0x6f83[_0x289e33];return _0x352078;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36f8('0x0'));var zipdir=require(_0x36f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36f8('0x2'));var moment=require(_0x36f8('0x3'));var BPromise=require(_0x36f8('0x4'));var Mustache=require(_0x36f8('0x5'));var util=require(_0x36f8('0x6'));var path=require(_0x36f8('0x7'));var sox=require(_0x36f8('0x8'));var csv=require(_0x36f8('0x9'));var ejs=require(_0x36f8('0xa'));var fs=require('fs');var fs_extra=require(_0x36f8('0xb'));var _=require(_0x36f8('0xc'));var squel=require(_0x36f8('0xd'));var crypto=require(_0x36f8('0xe'));var jsforce=require(_0x36f8('0xf'));var deskjs=require(_0x36f8('0x10'));var toCsv=require(_0x36f8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36f8('0x11'));var qs=require(_0x36f8('0x12'));var as=require(_0x36f8('0x13'));var hardwareService=require(_0x36f8('0x14'));var logger=require(_0x36f8('0x15'))(_0x36f8('0x16'));var utils=require(_0x36f8('0x17'));var config=require(_0x36f8('0x18'));var licenseUtil=require(_0x36f8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71e1ab,_0x196122){_0x196122=_0x196122||0xcc;return function(_0x166a1c){if(_0x166a1c){return _0x71e1ab[_0x36f8('0x1a')](_0x196122);}return _0x71e1ab['status'](_0x196122)[_0x36f8('0x1b')]();};}function respondWithResult(_0x189e22,_0x40a1c0){_0x40a1c0=_0x40a1c0||0xc8;return function(_0x5a8556){if(_0x5a8556){return _0x189e22[_0x36f8('0x1c')](_0x40a1c0)[_0x36f8('0x1d')](_0x5a8556);}};}function respondWithFilteredResult(_0x1ba051,_0x5048e0){return function(_0x429efc){if(_0x429efc){var _0x3e3281=typeof _0x5048e0[_0x36f8('0x1e')]===_0x36f8('0x1f')&&typeof _0x5048e0['limit']==='undefined';var _0x3f9947=_0x429efc['count'];var _0x517cba=_0x3e3281?0x0:_0x5048e0[_0x36f8('0x1e')];var _0x3d6a3c=_0x3e3281?_0x429efc['count']:_0x5048e0[_0x36f8('0x1e')]+_0x5048e0[_0x36f8('0x20')];var _0x290e63;if(_0x3d6a3c>=_0x3f9947){_0x3d6a3c=_0x3f9947;_0x290e63=0xc8;}else{_0x290e63=0xce;}_0x1ba051[_0x36f8('0x1c')](_0x290e63);return _0x1ba051[_0x36f8('0x21')](_0x36f8('0x22'),_0x517cba+'-'+_0x3d6a3c+'/'+_0x3f9947)[_0x36f8('0x1d')](_0x429efc);}return null;};}function patchUpdates(_0x16b9e8){return function(_0x283fd0){try{jsonpatch[_0x36f8('0x23')](_0x283fd0,_0x16b9e8,!![]);}catch(_0x26fc64){return BPromise[_0x36f8('0x24')](_0x26fc64);}return _0x283fd0['save']();};}function saveUpdates(_0xefe5b2,_0x42d203){return function(_0x41ccc3){if(_0x41ccc3){return _0x41ccc3['update'](_0xefe5b2)[_0x36f8('0x25')](function(_0x52b5ac){return _0x52b5ac;});}return null;};}function removeEntity(_0x362eae,_0x206075){return function(_0x4d2cd9){if(_0x4d2cd9){return _0x4d2cd9[_0x36f8('0x26')]()['then'](function(){_0x362eae[_0x36f8('0x1c')](0xcc)[_0x36f8('0x1b')]();});}};}function handleEntityNotFound(_0xb2acc5,_0x2eeb82){return function(_0x6740e1){if(!_0x6740e1){_0xb2acc5[_0x36f8('0x1a')](0x194);}return _0x6740e1;};}function handleError(_0x59291b,_0x462fd2){_0x462fd2=_0x462fd2||0x1f4;return function(_0xb2bbfd){logger[_0x36f8('0x27')](_0xb2bbfd[_0x36f8('0x28')]);if(_0xb2bbfd[_0x36f8('0x29')]){delete _0xb2bbfd[_0x36f8('0x29')];}_0x59291b[_0x36f8('0x1c')](_0x462fd2)[_0x36f8('0x2a')](_0xb2bbfd);};}exports[_0x36f8('0x2b')]=function(_0x51a2a1,_0x449882){var _0x1f67ea={},_0x3f01a6={},_0x328be8={'count':0x0,'rows':[]};var _0x191cdc=_[_0x36f8('0x2c')](db['ChatQueueReport'][_0x36f8('0x2d')],function(_0x302745){return{'name':_0x302745[_0x36f8('0x2e')],'type':_0x302745[_0x36f8('0x2f')][_0x36f8('0x30')]};});_0x3f01a6[_0x36f8('0x31')]=_[_0x36f8('0x2c')](_0x191cdc,_0x36f8('0x29'));_0x3f01a6[_0x36f8('0x32')]=_[_0x36f8('0x33')](_0x51a2a1[_0x36f8('0x32')]);_0x3f01a6['filters']=_['intersection'](_0x3f01a6['model'],_0x3f01a6[_0x36f8('0x32')]);_0x1f67ea[_0x36f8('0x34')]=_[_0x36f8('0x35')](_0x3f01a6['model'],qs[_0x36f8('0x36')](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x36')]));_0x1f67ea[_0x36f8('0x34')]=_0x1f67ea[_0x36f8('0x34')][_0x36f8('0x37')]?_0x1f67ea[_0x36f8('0x34')]:_0x3f01a6[_0x36f8('0x31')];if(!_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x38')]('nolimit')){_0x1f67ea[_0x36f8('0x20')]=qs[_0x36f8('0x20')](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x20')]);_0x1f67ea[_0x36f8('0x1e')]=qs['offset'](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x1e')]);}_0x1f67ea[_0x36f8('0x39')]=qs['sort'](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x3a')]);_0x1f67ea[_0x36f8('0x3b')]=qs[_0x36f8('0x3c')](_['pick'](_0x51a2a1['query'],_0x3f01a6[_0x36f8('0x3c')]),_0x191cdc);if(_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x3d')]){_0x1f67ea[_0x36f8('0x3b')]=_[_0x36f8('0x3e')](_0x1f67ea[_0x36f8('0x3b')],{'$or':_[_0x36f8('0x2c')](_0x191cdc,function(_0x598db5){if(_0x598db5[_0x36f8('0x2f')]!=='VIRTUAL'){var _0x258c27={};_0x258c27[_0x598db5[_0x36f8('0x29')]]={'$like':'%'+_0x51a2a1[_0x36f8('0x32')]['filter']+'%'};return _0x258c27;}})});}_0x1f67ea=_['merge']({},_0x1f67ea,_0x51a2a1[_0x36f8('0x3f')]);var _0x245a27={'where':_0x1f67ea[_0x36f8('0x3b')]};return db[_0x36f8('0x40')][_0x36f8('0x41')](_0x245a27)[_0x36f8('0x25')](function(_0x437218){_0x328be8[_0x36f8('0x41')]=_0x437218;if(_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x42')]){_0x1f67ea['include']=[{'all':!![]}];}return db[_0x36f8('0x40')][_0x36f8('0x43')](_0x1f67ea);})[_0x36f8('0x25')](function(_0x1e97de){_0x328be8[_0x36f8('0x44')]=_0x1e97de;return _0x328be8;})['then'](respondWithFilteredResult(_0x449882,_0x1f67ea))[_0x36f8('0x45')](handleError(_0x449882,null));};exports[_0x36f8('0x46')]=function(_0x3e1700,_0x53aa30){var _0x10e763={'raw':!![],'where':{'id':_0x3e1700[_0x36f8('0x47')]['id']}},_0x3b9d5e={};_0x3b9d5e[_0x36f8('0x31')]=_[_0x36f8('0x33')](db['ChatQueueReport'][_0x36f8('0x2d')]);_0x3b9d5e[_0x36f8('0x32')]=_[_0x36f8('0x33')](_0x3e1700[_0x36f8('0x32')]);_0x3b9d5e[_0x36f8('0x3c')]=_[_0x36f8('0x35')](_0x3b9d5e[_0x36f8('0x31')],_0x3b9d5e[_0x36f8('0x32')]);_0x10e763['attributes']=_[_0x36f8('0x35')](_0x3b9d5e['model'],qs[_0x36f8('0x36')](_0x3e1700[_0x36f8('0x32')]['fields']));_0x10e763[_0x36f8('0x34')]=_0x10e763[_0x36f8('0x34')]['length']?_0x10e763['attributes']:_0x3b9d5e[_0x36f8('0x31')];if(_0x3e1700[_0x36f8('0x32')][_0x36f8('0x42')]){_0x10e763[_0x36f8('0x48')]=[{'all':!![]}];}_0x10e763=_[_0x36f8('0x3e')]({},_0x10e763,_0x3e1700['options']);return db['ChatQueueReport'][_0x36f8('0x49')](_0x10e763)[_0x36f8('0x25')](handleEntityNotFound(_0x53aa30,null))[_0x36f8('0x25')](respondWithResult(_0x53aa30,null))[_0x36f8('0x45')](handleError(_0x53aa30,null));};exports[_0x36f8('0x4a')]=function(_0x5085ac,_0x4b324d){return db[_0x36f8('0x40')][_0x36f8('0x4a')](_0x5085ac[_0x36f8('0x4b')],{})[_0x36f8('0x25')](respondWithResult(_0x4b324d,0xc9))[_0x36f8('0x45')](handleError(_0x4b324d,null));};exports['update']=function(_0x8e0950,_0x488b41){if(_0x8e0950[_0x36f8('0x4b')]['id']){delete _0x8e0950[_0x36f8('0x4b')]['id'];}return db[_0x36f8('0x40')]['find']({'where':{'id':_0x8e0950[_0x36f8('0x47')]['id']}})[_0x36f8('0x25')](handleEntityNotFound(_0x488b41,null))[_0x36f8('0x25')](saveUpdates(_0x8e0950[_0x36f8('0x4b')],null))[_0x36f8('0x25')](respondWithResult(_0x488b41,null))['catch'](handleError(_0x488b41,null));};exports[_0x36f8('0x26')]=function(_0x4bacdb,_0x5b38da){return db['ChatQueueReport'][_0x36f8('0x49')]({'where':{'id':_0x4bacdb[_0x36f8('0x47')]['id']}})[_0x36f8('0x25')](handleEntityNotFound(_0x5b38da,null))[_0x36f8('0x25')](removeEntity(_0x5b38da,null))[_0x36f8('0x45')](handleError(_0x5b38da,null));};exports['describe']=function(_0x4a2489,_0x1f6bc6){return db[_0x36f8('0x40')][_0x36f8('0x4c')]()[_0x36f8('0x25')](respondWithResult(_0x1f6bc6,null))['catch'](handleError(_0x1f6bc6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 497ef86..b0aa28b 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x3e25bc,_0x1b01f3){var _0x345958=function(_0x289e7e){while(--_0x289e7e){_0x3e25bc['push'](_0x3e25bc['shift']());}};_0x345958(++_0x1b01f3);}(_0xb10b,0x12a));var _0xbb10=function(_0xd1bd2b,_0x43ead3){_0xd1bd2b=_0xd1bd2b-0x0;var _0x466676=_0xb10b[_0xd1bd2b];return _0x466676;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x22ce52,_0x5e720b){var _0x5e10d6=function(_0x3cc49e){while(--_0x3cc49e){_0x22ce52['push'](_0x22ce52['shift']());}};_0x5e10d6(++_0x5e720b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fc208d0..6947ce2 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 _0x6f0f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','info','lodash','util','moment','bluebird'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x6f0f,0x65));var _0xf6f0=function(_0x1cc01a,_0x10e545){_0x1cc01a=_0x1cc01a-0x0;var _0xf401d7=_0x6f0f[_0x1cc01a];return _0xf401d7;};'use strict';var _=require(_0xf6f0('0x0'));var util=require(_0xf6f0('0x1'));var moment=require(_0xf6f0('0x2'));var BPromise=require(_0xf6f0('0x3'));var rs=require(_0xf6f0('0x4'));var fs=require('fs');var Redis=require(_0xf6f0('0x5'));var db=require(_0xf6f0('0x6'))['db'];var utils=require(_0xf6f0('0x7'));var logger=require(_0xf6f0('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf6f0('0x9'));var client=jayson[_0xf6f0('0xa')][_0xf6f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d1188,_0x3dae3d,_0x431f3e){return new BPromise(function(_0x404b0e,_0xc06383){return client['request'](_0x4d1188,_0x431f3e)[_0xf6f0('0xc')](function(_0x3c48d0){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x3dae3d,_0xf6f0('0xd'));logger[_0xf6f0('0xe')](_0xf6f0('0xf'),_0x3dae3d,_0xf6f0('0xd'),JSON[_0xf6f0('0x10')](_0x3c48d0));if(_0x3c48d0['error']){if(_0x3c48d0[_0xf6f0('0x11')][_0xf6f0('0x12')]===0x1f4){logger[_0xf6f0('0x11')](_0xf6f0('0x13'),_0x3dae3d,_0x3c48d0['error'][_0xf6f0('0x14')]);return _0xc06383(_0x3c48d0[_0xf6f0('0x11')][_0xf6f0('0x14')]);}logger['error'](_0xf6f0('0x13'),_0x3dae3d,_0x3c48d0[_0xf6f0('0x11')][_0xf6f0('0x14')]);return _0x404b0e(_0x3c48d0[_0xf6f0('0x11')][_0xf6f0('0x14')]);}else{logger['info'](_0xf6f0('0x13'),_0x3dae3d,_0xf6f0('0xd'));_0x404b0e(_0x3c48d0[_0xf6f0('0x15')][_0xf6f0('0x14')]);}})[_0xf6f0('0x16')](function(_0x4ed647){logger['error'](_0xf6f0('0x13'),_0x3dae3d,_0x4ed647);_0xc06383(_0x4ed647);});});}exports[_0xf6f0('0x17')]=function(_0x33f213){var _0x295197=this;return new Promise(function(_0x1e0a7b,_0x1c6ec8){return db[_0xf6f0('0x18')][_0xf6f0('0x19')](_0x33f213[_0xf6f0('0x1a')],{'raw':_0x33f213[_0xf6f0('0x1b')]?_0x33f213[_0xf6f0('0x1b')][_0xf6f0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3a87d6){logger['info'](_0xf6f0('0x17'),_0x33f213);logger[_0xf6f0('0xe')]('CreateChatQueueReport',_0x33f213,JSON[_0xf6f0('0x10')](_0x3a87d6));_0x1e0a7b(_0x3a87d6);})['catch'](function(_0x393288){logger[_0xf6f0('0x11')](_0xf6f0('0x17'),_0x393288['message'],_0x33f213);_0x1c6ec8(_0x295197[_0xf6f0('0x11')](0x1f4,_0x393288[_0xf6f0('0x14')]));});});};exports[_0xf6f0('0x1d')]=function(_0x161a7f){var _0x56c761=this;return new Promise(function(_0x4ab584,_0x2db931){return db['ChatQueueReport'][_0xf6f0('0x1e')](_0x161a7f['body'],{'raw':_0x161a7f[_0xf6f0('0x1b')]?_0x161a7f[_0xf6f0('0x1b')][_0xf6f0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x161a7f[_0xf6f0('0x1b')]?_0x161a7f['options'][_0xf6f0('0x1f')]||null:null,'attributes':_0x161a7f[_0xf6f0('0x1b')]?_0x161a7f[_0xf6f0('0x1b')][_0xf6f0('0x20')]||null:null,'limit':_0x161a7f[_0xf6f0('0x1b')]?_0x161a7f[_0xf6f0('0x1b')][_0xf6f0('0x21')]||null:null})[_0xf6f0('0xc')](function(_0x579782){logger[_0xf6f0('0x22')](_0xf6f0('0x1d'),_0x161a7f);logger[_0xf6f0('0xe')]('UpdateChatQueueReport',_0x161a7f,JSON[_0xf6f0('0x10')](_0x579782));_0x4ab584(_0x579782);})[_0xf6f0('0x16')](function(_0x122125){logger[_0xf6f0('0x11')](_0xf6f0('0x1d'),_0x122125[_0xf6f0('0x14')],_0x161a7f);_0x2db931(_0x56c761[_0xf6f0('0x11')](0x1f4,_0x122125[_0xf6f0('0x14')]));});});}; \ No newline at end of file +var _0x7732=['debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','stringify','where','attributes','limit','UpdateChatQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0xedbce8,_0x4e291f){var _0x10785d=function(_0x224a5f){while(--_0x224a5f){_0xedbce8['push'](_0xedbce8['shift']());}};_0x10785d(++_0x4e291f);}(_0x7732,0x7d));var _0x2773=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x7732[_0x15b380];return _0x232c5c;};'use strict';var _=require(_0x2773('0x0'));var util=require(_0x2773('0x1'));var moment=require('moment');var BPromise=require(_0x2773('0x2'));var rs=require(_0x2773('0x3'));var fs=require('fs');var Redis=require(_0x2773('0x4'));var db=require(_0x2773('0x5'))['db'];var utils=require(_0x2773('0x6'));var logger=require(_0x2773('0x7'))(_0x2773('0x8'));var config=require(_0x2773('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2773('0xa')][_0x2773('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f098b,_0x3bb2d3,_0x279e1d){return new BPromise(function(_0x3f04dd,_0x4be075){return client[_0x2773('0xc')](_0x5f098b,_0x279e1d)['then'](function(_0x4818ef){logger['info'](_0x2773('0xd'),_0x3bb2d3,_0x2773('0xe'));logger[_0x2773('0xf')](_0x2773('0x10'),_0x3bb2d3,'request\x20sent',JSON['stringify'](_0x4818ef));if(_0x4818ef[_0x2773('0x11')]){if(_0x4818ef[_0x2773('0x11')][_0x2773('0x12')]===0x1f4){logger[_0x2773('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x3bb2d3,_0x4818ef[_0x2773('0x11')]['message']);return _0x4be075(_0x4818ef['error'][_0x2773('0x13')]);}logger[_0x2773('0x11')](_0x2773('0xd'),_0x3bb2d3,_0x4818ef[_0x2773('0x11')][_0x2773('0x13')]);return _0x3f04dd(_0x4818ef[_0x2773('0x11')][_0x2773('0x13')]);}else{logger[_0x2773('0x14')](_0x2773('0xd'),_0x3bb2d3,_0x2773('0xe'));_0x3f04dd(_0x4818ef[_0x2773('0x15')][_0x2773('0x13')]);}})[_0x2773('0x16')](function(_0x50fefe){logger['error'](_0x2773('0xd'),_0x3bb2d3,_0x50fefe);_0x4be075(_0x50fefe);});});}exports[_0x2773('0x17')]=function(_0x541424){var _0x1b450e=this;return new Promise(function(_0x39f152,_0x1faf31){return db[_0x2773('0x18')][_0x2773('0x19')](_0x541424[_0x2773('0x1a')],{'raw':_0x541424[_0x2773('0x1b')]?_0x541424['options'][_0x2773('0x1c')]===undefined?!![]:![]:!![]})[_0x2773('0x1d')](function(_0x3a4130){logger[_0x2773('0x14')](_0x2773('0x17'),_0x541424);logger['debug'](_0x2773('0x17'),_0x541424,JSON[_0x2773('0x1e')](_0x3a4130));_0x39f152(_0x3a4130);})[_0x2773('0x16')](function(_0x4a56ff){logger[_0x2773('0x11')](_0x2773('0x17'),_0x4a56ff[_0x2773('0x13')],_0x541424);_0x1faf31(_0x1b450e['error'](0x1f4,_0x4a56ff[_0x2773('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0xab42c2){var _0xbae5a2=this;return new Promise(function(_0x323c04,_0x49b537){return db[_0x2773('0x18')]['update'](_0xab42c2[_0x2773('0x1a')],{'raw':_0xab42c2[_0x2773('0x1b')]?_0xab42c2[_0x2773('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xab42c2[_0x2773('0x1b')]?_0xab42c2['options'][_0x2773('0x1f')]||null:null,'attributes':_0xab42c2['options']?_0xab42c2[_0x2773('0x1b')][_0x2773('0x20')]||null:null,'limit':_0xab42c2[_0x2773('0x1b')]?_0xab42c2[_0x2773('0x1b')][_0x2773('0x21')]||null:null})[_0x2773('0x1d')](function(_0x596935){logger['info']('UpdateChatQueueReport',_0xab42c2);logger[_0x2773('0xf')](_0x2773('0x22'),_0xab42c2,JSON[_0x2773('0x1e')](_0x596935));_0x323c04(_0x596935);})['catch'](function(_0x428f13){logger[_0x2773('0x11')](_0x2773('0x22'),_0x428f13['message'],_0xab42c2);_0x49b537(_0xbae5a2[_0x2773('0x11')](0x1f4,_0x428f13['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index bf75436..95fb385 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 _0x23c1=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x3e2769,_0x27f55b){var _0x4d558f=function(_0x38ffce){while(--_0x38ffce){_0x3e2769['push'](_0x3e2769['shift']());}};_0x4d558f(++_0x27f55b);}(_0x23c1,0xfa));var _0x123c=function(_0x6ae0df,_0x5d966a){_0x6ae0df=_0x6ae0df-0x0;var _0x89a64c=_0x23c1[_0x6ae0df];return _0x89a64c;};'use strict';var multer=require(_0x123c('0x0'));var util=require(_0x123c('0x1'));var path=require(_0x123c('0x2'));var timeout=require(_0x123c('0x3'));var express=require('express');var router=express[_0x123c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x123c('0x5'));var interaction=require(_0x123c('0x6'));var config=require(_0x123c('0x7'));var controller=require(_0x123c('0x8'));router[_0x123c('0x9')]('/',auth[_0x123c('0xa')](),controller[_0x123c('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x123c('0xc')]);router[_0x123c('0x9')](_0x123c('0xd'),auth[_0x123c('0xa')](),controller[_0x123c('0xe')]);router[_0x123c('0xf')]('/',auth[_0x123c('0xa')](),controller[_0x123c('0x10')]);router[_0x123c('0x11')](_0x123c('0xd'),auth[_0x123c('0xa')](),controller['update']);router[_0x123c('0x12')](_0x123c('0xd'),auth[_0x123c('0xa')](),controller[_0x123c('0x13')]);module[_0x123c('0x14')]=router; \ No newline at end of file +var _0x66db=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports'];(function(_0x1d774d,_0x28a381){var _0x41314f=function(_0x292b24){while(--_0x292b24){_0x1d774d['push'](_0x1d774d['shift']());}};_0x41314f(++_0x28a381);}(_0x66db,0x165));var _0xb66d=function(_0x4ac9b9,_0x650805){_0x4ac9b9=_0x4ac9b9-0x0;var _0x26eb58=_0x66db[_0x4ac9b9];return _0x26eb58;};'use strict';var multer=require(_0xb66d('0x0'));var util=require(_0xb66d('0x1'));var path=require('path');var timeout=require(_0xb66d('0x2'));var express=require(_0xb66d('0x3'));var router=express['Router']();var fs_extra=require(_0xb66d('0x4'));var auth=require(_0xb66d('0x5'));var interaction=require(_0xb66d('0x6'));var config=require(_0xb66d('0x7'));var controller=require(_0xb66d('0x8'));router[_0xb66d('0x9')]('/',auth[_0xb66d('0xa')](),controller[_0xb66d('0xb')]);router['get'](_0xb66d('0xc'),auth[_0xb66d('0xa')](),controller[_0xb66d('0xd')]);router['get'](_0xb66d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xb66d('0xf')]('/',auth[_0xb66d('0xa')](),controller[_0xb66d('0x10')]);router[_0xb66d('0x11')](_0xb66d('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xb66d('0x12')](_0xb66d('0xe'),auth[_0xb66d('0xa')](),controller[_0xb66d('0x13')]);module[_0xb66d('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index acb3b69..fbe133d 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xaab8c0,_0x4dd550){var _0x3bd2d3=function(_0x1f8188){while(--_0x1f8188){_0xaab8c0['push'](_0xaab8c0['shift']());}};_0x3bd2d3(++_0x4dd550);}(_0xf4eb,0xec));var _0xbf4e=function(_0x42e838,_0x1eb543){_0x42e838=_0x42e838-0x0;var _0x38504d=_0xf4eb[_0x42e838];return _0x38504d;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1b9a3f,_0x3e56ab){var _0x56f53f=function(_0x487ba3){while(--_0x487ba3){_0x1b9a3f['push'](_0x1b9a3f['shift']());}};_0x56f53f(++_0x3e56ab);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0xcb91[_0x51639a];return _0x3abae4;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index e7fdc1e..89b71ee 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 _0x14d8=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','rows','show','params','merge','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x48e010,_0x40a23b){var _0x31b860=function(_0x93d102){while(--_0x93d102){_0x48e010['push'](_0x48e010['shift']());}};_0x31b860(++_0x40a23b);}(_0x14d8,0x174));var _0x814d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x14d8[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x814d('0x0'));var rimraf=require(_0x814d('0x1'));var zipdir=require(_0x814d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x814d('0x3'));var moment=require(_0x814d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x814d('0x5'));var util=require(_0x814d('0x6'));var path=require(_0x814d('0x7'));var sox=require(_0x814d('0x8'));var csv=require(_0x814d('0x9'));var ejs=require(_0x814d('0xa'));var fs=require('fs');var fs_extra=require(_0x814d('0xb'));var _=require(_0x814d('0xc'));var squel=require('squel');var crypto=require(_0x814d('0xd'));var jsforce=require(_0x814d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x814d('0x9'));var querystring=require(_0x814d('0xf'));var Papa=require(_0x814d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x814d('0x11'));var as=require(_0x814d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x814d('0x13'))(_0x814d('0x14'));var utils=require(_0x814d('0x15'));var config=require(_0x814d('0x16'));var licenseUtil=require(_0x814d('0x17'));var db=require(_0x814d('0x18'))['db'];function respondWithStatusCode(_0x56cb4d,_0x3d9c15){_0x3d9c15=_0x3d9c15||0xcc;return function(_0x38a714){if(_0x38a714){return _0x56cb4d['sendStatus'](_0x3d9c15);}return _0x56cb4d[_0x814d('0x19')](_0x3d9c15)[_0x814d('0x1a')]();};}function respondWithResult(_0x5c942b,_0x472818){_0x472818=_0x472818||0xc8;return function(_0x53d47f){if(_0x53d47f){return _0x5c942b[_0x814d('0x19')](_0x472818)[_0x814d('0x1b')](_0x53d47f);}};}function respondWithFilteredResult(_0x5c4e94,_0x39b4c1){return function(_0x3c2fa3){if(_0x3c2fa3){var _0x1de8a0=typeof _0x39b4c1[_0x814d('0x1c')]==='undefined'&&typeof _0x39b4c1[_0x814d('0x1d')]===_0x814d('0x1e');var _0x5f3bf1=_0x3c2fa3['count'];var _0x593e8a=_0x1de8a0?0x0:_0x39b4c1[_0x814d('0x1c')];var _0x53bf3e=_0x1de8a0?_0x3c2fa3[_0x814d('0x1f')]:_0x39b4c1[_0x814d('0x1c')]+_0x39b4c1[_0x814d('0x1d')];var _0x571b19;if(_0x53bf3e>=_0x5f3bf1){_0x53bf3e=_0x5f3bf1;_0x571b19=0xc8;}else{_0x571b19=0xce;}_0x5c4e94[_0x814d('0x19')](_0x571b19);return _0x5c4e94[_0x814d('0x20')](_0x814d('0x21'),_0x593e8a+'-'+_0x53bf3e+'/'+_0x5f3bf1)[_0x814d('0x1b')](_0x3c2fa3);}return null;};}function patchUpdates(_0x1996ac){return function(_0x207735){try{jsonpatch[_0x814d('0x22')](_0x207735,_0x1996ac,!![]);}catch(_0x437d56){return BPromise[_0x814d('0x23')](_0x437d56);}return _0x207735[_0x814d('0x24')]();};}function saveUpdates(_0xac33da,_0x468614){return function(_0x179967){if(_0x179967){return _0x179967[_0x814d('0x25')](_0xac33da)[_0x814d('0x26')](function(_0xeeb0ef){return _0xeeb0ef;});}return null;};}function removeEntity(_0x256b4f,_0x1749e7){return function(_0xf0e08){if(_0xf0e08){return _0xf0e08['destroy']()[_0x814d('0x26')](function(){_0x256b4f[_0x814d('0x19')](0xcc)[_0x814d('0x1a')]();});}};}function handleEntityNotFound(_0x30db3b,_0x8d6664){return function(_0x7dd2e2){if(!_0x7dd2e2){_0x30db3b[_0x814d('0x27')](0x194);}return _0x7dd2e2;};}function handleError(_0x4b998e,_0x2ad2f5){_0x2ad2f5=_0x2ad2f5||0x1f4;return function(_0x4fbd2e){logger[_0x814d('0x28')](_0x4fbd2e['stack']);if(_0x4fbd2e[_0x814d('0x29')]){delete _0x4fbd2e[_0x814d('0x29')];}_0x4b998e[_0x814d('0x19')](_0x2ad2f5)[_0x814d('0x2a')](_0x4fbd2e);};}exports[_0x814d('0x2b')]=function(_0x33d8d5,_0x2bc60f){var _0x4f0976={},_0x29dd43={},_0xaad096={'count':0x0,'rows':[]};var _0x4d8362=_[_0x814d('0x2c')](db[_0x814d('0x2d')][_0x814d('0x2e')],function(_0x33a97b){return{'name':_0x33a97b[_0x814d('0x2f')],'type':_0x33a97b[_0x814d('0x30')][_0x814d('0x31')]};});_0x29dd43[_0x814d('0x32')]=_[_0x814d('0x2c')](_0x4d8362,_0x814d('0x29'));_0x29dd43[_0x814d('0x33')]=_[_0x814d('0x34')](_0x33d8d5[_0x814d('0x33')]);_0x29dd43[_0x814d('0x35')]=_[_0x814d('0x36')](_0x29dd43['model'],_0x29dd43[_0x814d('0x33')]);_0x4f0976[_0x814d('0x37')]=_[_0x814d('0x36')](_0x29dd43['model'],qs[_0x814d('0x38')](_0x33d8d5[_0x814d('0x33')][_0x814d('0x38')]));_0x4f0976[_0x814d('0x37')]=_0x4f0976['attributes'][_0x814d('0x39')]?_0x4f0976['attributes']:_0x29dd43['model'];if(!_0x33d8d5[_0x814d('0x33')]['hasOwnProperty'](_0x814d('0x3a'))){_0x4f0976[_0x814d('0x1d')]=qs['limit'](_0x33d8d5['query'][_0x814d('0x1d')]);_0x4f0976[_0x814d('0x1c')]=qs[_0x814d('0x1c')](_0x33d8d5[_0x814d('0x33')][_0x814d('0x1c')]);}_0x4f0976[_0x814d('0x3b')]=qs['sort'](_0x33d8d5[_0x814d('0x33')][_0x814d('0x3c')]);_0x4f0976[_0x814d('0x3d')]=qs[_0x814d('0x35')](_[_0x814d('0x3e')](_0x33d8d5[_0x814d('0x33')],_0x29dd43['filters']),_0x4d8362);if(_0x33d8d5[_0x814d('0x33')]['filter']){_0x4f0976[_0x814d('0x3d')]=_['merge'](_0x4f0976[_0x814d('0x3d')],{'$or':_['map'](_0x4d8362,function(_0x59185f){if(_0x59185f[_0x814d('0x30')]!==_0x814d('0x3f')){var _0x5f25c4={};_0x5f25c4[_0x59185f[_0x814d('0x29')]]={'$like':'%'+_0x33d8d5[_0x814d('0x33')]['filter']+'%'};return _0x5f25c4;}})});}_0x4f0976=_['merge']({},_0x4f0976,_0x33d8d5[_0x814d('0x40')]);var _0x10226b={'where':_0x4f0976['where']};return db[_0x814d('0x2d')]['count'](_0x10226b)[_0x814d('0x26')](function(_0x551229){_0xaad096[_0x814d('0x1f')]=_0x551229;if(_0x33d8d5[_0x814d('0x33')][_0x814d('0x41')]){_0x4f0976['include']=[{'all':!![]}];}return db[_0x814d('0x2d')]['findAll'](_0x4f0976);})[_0x814d('0x26')](function(_0x4299ad){_0xaad096[_0x814d('0x42')]=_0x4299ad;return _0xaad096;})[_0x814d('0x26')](respondWithFilteredResult(_0x2bc60f,_0x4f0976))['catch'](handleError(_0x2bc60f,null));};exports[_0x814d('0x43')]=function(_0xc91361,_0x3d5768){var _0x5a80ec={'raw':!![],'where':{'id':_0xc91361[_0x814d('0x44')]['id']}},_0x558222={};_0x558222[_0x814d('0x32')]=_[_0x814d('0x34')](db[_0x814d('0x2d')]['rawAttributes']);_0x558222['query']=_[_0x814d('0x34')](_0xc91361[_0x814d('0x33')]);_0x558222[_0x814d('0x35')]=_['intersection'](_0x558222[_0x814d('0x32')],_0x558222[_0x814d('0x33')]);_0x5a80ec[_0x814d('0x37')]=_[_0x814d('0x36')](_0x558222[_0x814d('0x32')],qs['fields'](_0xc91361[_0x814d('0x33')][_0x814d('0x38')]));_0x5a80ec['attributes']=_0x5a80ec[_0x814d('0x37')]['length']?_0x5a80ec['attributes']:_0x558222['model'];if(_0xc91361['query']['includeAll']){_0x5a80ec['include']=[{'all':!![]}];}_0x5a80ec=_[_0x814d('0x45')]({},_0x5a80ec,_0xc91361['options']);return db[_0x814d('0x2d')][_0x814d('0x46')](_0x5a80ec)['then'](handleEntityNotFound(_0x3d5768,null))[_0x814d('0x26')](respondWithResult(_0x3d5768,null))['catch'](handleError(_0x3d5768,null));};exports[_0x814d('0x47')]=function(_0x5547d8,_0x59b087){return db[_0x814d('0x2d')][_0x814d('0x47')](_0x5547d8[_0x814d('0x48')],{})[_0x814d('0x26')](respondWithResult(_0x59b087,0xc9))[_0x814d('0x49')](handleError(_0x59b087,null));};exports[_0x814d('0x25')]=function(_0x5be9ae,_0x4670df){if(_0x5be9ae[_0x814d('0x48')]['id']){delete _0x5be9ae[_0x814d('0x48')]['id'];}return db[_0x814d('0x2d')][_0x814d('0x46')]({'where':{'id':_0x5be9ae[_0x814d('0x44')]['id']}})[_0x814d('0x26')](handleEntityNotFound(_0x4670df,null))['then'](saveUpdates(_0x5be9ae[_0x814d('0x48')],null))['then'](respondWithResult(_0x4670df,null))['catch'](handleError(_0x4670df,null));};exports[_0x814d('0x4a')]=function(_0x240c77,_0x43a39e){return db['ChatTransferReport'][_0x814d('0x46')]({'where':{'id':_0x240c77['params']['id']}})[_0x814d('0x26')](handleEntityNotFound(_0x43a39e,null))[_0x814d('0x26')](removeEntity(_0x43a39e,null))[_0x814d('0x49')](handleError(_0x43a39e,null));};exports['describe']=function(_0x23444e,_0x53fb92){return db['ChatTransferReport'][_0x814d('0x4b')]()['then'](respondWithResult(_0x53fb92,null))[_0x814d('0x49')](handleError(_0x53fb92,null));}; \ No newline at end of file +var _0x92e5=['zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','length','include','catch','body','update','find','describe','rimraf'];(function(_0x3789b9,_0x5c2f00){var _0x4d020d=function(_0x170650){while(--_0x170650){_0x3789b9['push'](_0x3789b9['shift']());}};_0x4d020d(++_0x5c2f00);}(_0x92e5,0x11b));var _0x592e=function(_0x4ea34e,_0x9d9b78){_0x4ea34e=_0x4ea34e-0x0;var _0xde9588=_0x92e5[_0x4ea34e];return _0xde9588;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x592e('0x0'));var zipdir=require(_0x592e('0x1'));var jsonpatch=require(_0x592e('0x2'));var rp=require('request-promise');var moment=require(_0x592e('0x3'));var BPromise=require(_0x592e('0x4'));var Mustache=require('mustache');var util=require(_0x592e('0x5'));var path=require('path');var sox=require(_0x592e('0x6'));var csv=require(_0x592e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x592e('0x8'));var squel=require(_0x592e('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x592e('0xa'));var toCsv=require(_0x592e('0x7'));var querystring=require(_0x592e('0xb'));var Papa=require(_0x592e('0xc'));var Redis=require('ioredis');var authService=require(_0x592e('0xd'));var qs=require(_0x592e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x592e('0xf'));var utils=require(_0x592e('0x10'));var config=require(_0x592e('0x11'));var licenseUtil=require(_0x592e('0x12'));var db=require(_0x592e('0x13'))['db'];function respondWithStatusCode(_0x7dd58f,_0x364b34){_0x364b34=_0x364b34||0xcc;return function(_0x4d2164){if(_0x4d2164){return _0x7dd58f[_0x592e('0x14')](_0x364b34);}return _0x7dd58f['status'](_0x364b34)['end']();};}function respondWithResult(_0x392337,_0x37fa95){_0x37fa95=_0x37fa95||0xc8;return function(_0x49e368){if(_0x49e368){return _0x392337[_0x592e('0x15')](_0x37fa95)['json'](_0x49e368);}};}function respondWithFilteredResult(_0x2e2fba,_0x3157b0){return function(_0x551aa2){if(_0x551aa2){var _0xd83a97=typeof _0x3157b0[_0x592e('0x16')]==='undefined'&&typeof _0x3157b0['limit']==='undefined';var _0x4c5eab=_0x551aa2['count'];var _0x4a8096=_0xd83a97?0x0:_0x3157b0[_0x592e('0x16')];var _0x50c261=_0xd83a97?_0x551aa2['count']:_0x3157b0[_0x592e('0x16')]+_0x3157b0[_0x592e('0x17')];var _0x3de83d;if(_0x50c261>=_0x4c5eab){_0x50c261=_0x4c5eab;_0x3de83d=0xc8;}else{_0x3de83d=0xce;}_0x2e2fba['status'](_0x3de83d);return _0x2e2fba[_0x592e('0x18')](_0x592e('0x19'),_0x4a8096+'-'+_0x50c261+'/'+_0x4c5eab)[_0x592e('0x1a')](_0x551aa2);}return null;};}function patchUpdates(_0x3dc2c3){return function(_0x595473){try{jsonpatch[_0x592e('0x1b')](_0x595473,_0x3dc2c3,!![]);}catch(_0x4fd4d4){return BPromise[_0x592e('0x1c')](_0x4fd4d4);}return _0x595473[_0x592e('0x1d')]();};}function saveUpdates(_0x2ef0af,_0x4a6d7a){return function(_0x2f556c){if(_0x2f556c){return _0x2f556c['update'](_0x2ef0af)[_0x592e('0x1e')](function(_0xafae50){return _0xafae50;});}return null;};}function removeEntity(_0x9daaff,_0x40de6c){return function(_0x76d24e){if(_0x76d24e){return _0x76d24e[_0x592e('0x1f')]()[_0x592e('0x1e')](function(){_0x9daaff[_0x592e('0x15')](0xcc)[_0x592e('0x20')]();});}};}function handleEntityNotFound(_0x235f46,_0x30bb72){return function(_0x3ec6c3){if(!_0x3ec6c3){_0x235f46['sendStatus'](0x194);}return _0x3ec6c3;};}function handleError(_0x40a237,_0x2ba1be){_0x2ba1be=_0x2ba1be||0x1f4;return function(_0x2ef2dd){logger[_0x592e('0x21')](_0x2ef2dd[_0x592e('0x22')]);if(_0x2ef2dd[_0x592e('0x23')]){delete _0x2ef2dd[_0x592e('0x23')];}_0x40a237['status'](_0x2ba1be)[_0x592e('0x24')](_0x2ef2dd);};}exports[_0x592e('0x25')]=function(_0x35e4cf,_0x15f237){var _0x56f902={},_0xc361e8={},_0x495e5d={'count':0x0,'rows':[]};var _0x1c9009=_[_0x592e('0x26')](db[_0x592e('0x27')][_0x592e('0x28')],function(_0x2ebbf9){return{'name':_0x2ebbf9[_0x592e('0x29')],'type':_0x2ebbf9[_0x592e('0x2a')]['key']};});_0xc361e8[_0x592e('0x2b')]=_[_0x592e('0x26')](_0x1c9009,_0x592e('0x23'));_0xc361e8['query']=_[_0x592e('0x2c')](_0x35e4cf[_0x592e('0x2d')]);_0xc361e8[_0x592e('0x2e')]=_[_0x592e('0x2f')](_0xc361e8[_0x592e('0x2b')],_0xc361e8[_0x592e('0x2d')]);_0x56f902[_0x592e('0x30')]=_[_0x592e('0x2f')](_0xc361e8[_0x592e('0x2b')],qs[_0x592e('0x31')](_0x35e4cf['query'][_0x592e('0x31')]));_0x56f902[_0x592e('0x30')]=_0x56f902[_0x592e('0x30')]['length']?_0x56f902['attributes']:_0xc361e8[_0x592e('0x2b')];if(!_0x35e4cf['query'][_0x592e('0x32')](_0x592e('0x33'))){_0x56f902[_0x592e('0x17')]=qs[_0x592e('0x17')](_0x35e4cf[_0x592e('0x2d')][_0x592e('0x17')]);_0x56f902['offset']=qs[_0x592e('0x16')](_0x35e4cf[_0x592e('0x2d')]['offset']);}_0x56f902[_0x592e('0x34')]=qs['sort'](_0x35e4cf[_0x592e('0x2d')]['sort']);_0x56f902['where']=qs['filters'](_[_0x592e('0x35')](_0x35e4cf[_0x592e('0x2d')],_0xc361e8[_0x592e('0x2e')]),_0x1c9009);if(_0x35e4cf[_0x592e('0x2d')][_0x592e('0x36')]){_0x56f902[_0x592e('0x37')]=_[_0x592e('0x38')](_0x56f902[_0x592e('0x37')],{'$or':_[_0x592e('0x26')](_0x1c9009,function(_0x24f83c){if(_0x24f83c[_0x592e('0x2a')]!==_0x592e('0x39')){var _0x42f845={};_0x42f845[_0x24f83c[_0x592e('0x23')]]={'$like':'%'+_0x35e4cf[_0x592e('0x2d')]['filter']+'%'};return _0x42f845;}})});}_0x56f902=_[_0x592e('0x38')]({},_0x56f902,_0x35e4cf[_0x592e('0x3a')]);var _0x5ed0cd={'where':_0x56f902[_0x592e('0x37')]};return db[_0x592e('0x27')][_0x592e('0x3b')](_0x5ed0cd)[_0x592e('0x1e')](function(_0x5e0296){_0x495e5d[_0x592e('0x3b')]=_0x5e0296;if(_0x35e4cf[_0x592e('0x2d')][_0x592e('0x3c')]){_0x56f902['include']=[{'all':!![]}];}return db[_0x592e('0x27')][_0x592e('0x3d')](_0x56f902);})[_0x592e('0x1e')](function(_0x497e43){_0x495e5d[_0x592e('0x3e')]=_0x497e43;return _0x495e5d;})['then'](respondWithFilteredResult(_0x15f237,_0x56f902))['catch'](handleError(_0x15f237,null));};exports['show']=function(_0x1b67c9,_0x4a452f){var _0x4c75cd={'raw':!![],'where':{'id':_0x1b67c9[_0x592e('0x3f')]['id']}},_0xe91099={};_0xe91099[_0x592e('0x2b')]=_[_0x592e('0x2c')](db[_0x592e('0x27')][_0x592e('0x28')]);_0xe91099[_0x592e('0x2d')]=_[_0x592e('0x2c')](_0x1b67c9['query']);_0xe91099['filters']=_[_0x592e('0x2f')](_0xe91099['model'],_0xe91099[_0x592e('0x2d')]);_0x4c75cd['attributes']=_[_0x592e('0x2f')](_0xe91099[_0x592e('0x2b')],qs['fields'](_0x1b67c9['query'][_0x592e('0x31')]));_0x4c75cd['attributes']=_0x4c75cd[_0x592e('0x30')][_0x592e('0x40')]?_0x4c75cd['attributes']:_0xe91099[_0x592e('0x2b')];if(_0x1b67c9[_0x592e('0x2d')][_0x592e('0x3c')]){_0x4c75cd[_0x592e('0x41')]=[{'all':!![]}];}_0x4c75cd=_[_0x592e('0x38')]({},_0x4c75cd,_0x1b67c9['options']);return db['ChatTransferReport']['find'](_0x4c75cd)[_0x592e('0x1e')](handleEntityNotFound(_0x4a452f,null))['then'](respondWithResult(_0x4a452f,null))[_0x592e('0x42')](handleError(_0x4a452f,null));};exports['create']=function(_0x5da4b3,_0x3c76fc){return db[_0x592e('0x27')]['create'](_0x5da4b3[_0x592e('0x43')],{})[_0x592e('0x1e')](respondWithResult(_0x3c76fc,0xc9))['catch'](handleError(_0x3c76fc,null));};exports[_0x592e('0x44')]=function(_0x1b25b7,_0x1c1afa){if(_0x1b25b7[_0x592e('0x43')]['id']){delete _0x1b25b7[_0x592e('0x43')]['id'];}return db[_0x592e('0x27')][_0x592e('0x45')]({'where':{'id':_0x1b25b7['params']['id']}})[_0x592e('0x1e')](handleEntityNotFound(_0x1c1afa,null))['then'](saveUpdates(_0x1b25b7[_0x592e('0x43')],null))['then'](respondWithResult(_0x1c1afa,null))[_0x592e('0x42')](handleError(_0x1c1afa,null));};exports[_0x592e('0x1f')]=function(_0x223018,_0x51567b){return db[_0x592e('0x27')][_0x592e('0x45')]({'where':{'id':_0x223018[_0x592e('0x3f')]['id']}})[_0x592e('0x1e')](handleEntityNotFound(_0x51567b,null))[_0x592e('0x1e')](removeEntity(_0x51567b,null))[_0x592e('0x42')](handleError(_0x51567b,null));};exports[_0x592e('0x46')]=function(_0x15b667,_0x1cc0f1){return db[_0x592e('0x27')][_0x592e('0x46')]()[_0x592e('0x1e')](respondWithResult(_0x1cc0f1,null))[_0x592e('0x42')](handleError(_0x1cc0f1,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index fb610e2..e131837 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 _0xd95b=['./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3cb474,_0x413451){var _0x12794e=function(_0x5759dc){while(--_0x5759dc){_0x3cb474['push'](_0x3cb474['shift']());}};_0x12794e(++_0x413451);}(_0xd95b,0x165));var _0xbd95=function(_0x25cd2a,_0x36645d){_0x25cd2a=_0x25cd2a-0x0;var _0x572a39=_0xd95b[_0x25cd2a];return _0x572a39;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbd95('0x0'))(_0xbd95('0x1'));var moment=require(_0xbd95('0x2'));var BPromise=require(_0xbd95('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd95('0x4'));var rimraf=require(_0xbd95('0x5'));var config=require(_0xbd95('0x6'));var attributes=require(_0xbd95('0x7'));module[_0xbd95('0x8')]=function(_0x2e6703,_0x19b695){return _0x2e6703[_0xbd95('0x9')](_0xbd95('0xa'),attributes,{'tableName':_0xbd95('0xb'),'paranoid':![],'indexes':[{'name':_0xbd95('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4a2=['define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','moment','rimraf','../../config/environment','exports'];(function(_0x5b8df9,_0x298d9c){var _0x43b942=function(_0x517bfa){while(--_0x517bfa){_0x5b8df9['push'](_0x5b8df9['shift']());}};_0x43b942(++_0x298d9c);}(_0xe4a2,0xd6));var _0x2e4a=function(_0x2ec7ac,_0x3e44ae){_0x2ec7ac=_0x2ec7ac-0x0;var _0x2f5783=_0xe4a2[_0x2ec7ac];return _0x2f5783;};'use strict';var _=require('lodash');var util=require(_0x2e4a('0x0'));var logger=require(_0x2e4a('0x1'))('api');var moment=require(_0x2e4a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e4a('0x3'));var config=require(_0x2e4a('0x4'));var attributes=require('./chatTransferReport.attributes');module[_0x2e4a('0x5')]=function(_0x3dbf33,_0x2b93ce){return _0x3dbf33[_0x2e4a('0x6')](_0x2e4a('0x7'),attributes,{'tableName':_0x2e4a('0x8'),'paranoid':![],'indexes':[{'name':_0x2e4a('0x9'),'fields':[_0x2e4a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 0293b9e..cc4abd5 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 _0x0845=['stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x58f45e,_0x5ec2f6){var _0x155acd=function(_0x5aa35c){while(--_0x5aa35c){_0x58f45e['push'](_0x58f45e['shift']());}};_0x155acd(++_0x5ec2f6);}(_0x0845,0x1be));var _0x5084=function(_0x3448a4,_0x40ef80){_0x3448a4=_0x3448a4-0x0;var _0x20c1c9=_0x0845[_0x3448a4];return _0x20c1c9;};'use strict';var _=require(_0x5084('0x0'));var util=require(_0x5084('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5084('0x2'));var fs=require('fs');var Redis=require(_0x5084('0x3'));var db=require(_0x5084('0x4'))['db'];var utils=require(_0x5084('0x5'));var logger=require(_0x5084('0x6'))('rpc');var config=require(_0x5084('0x7'));var jayson=require(_0x5084('0x8'));var client=jayson[_0x5084('0x9')][_0x5084('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15dc5c,_0x2b5a6c,_0x52c15f){return new BPromise(function(_0x2bebaa,_0x2d618c){return client[_0x5084('0xb')](_0x15dc5c,_0x52c15f)[_0x5084('0xc')](function(_0x51751d){logger['info'](_0x5084('0xd'),_0x2b5a6c,_0x5084('0xe'));logger[_0x5084('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2b5a6c,_0x5084('0xe'),JSON[_0x5084('0x10')](_0x51751d));if(_0x51751d[_0x5084('0x11')]){if(_0x51751d['error']['code']===0x1f4){logger[_0x5084('0x11')](_0x5084('0xd'),_0x2b5a6c,_0x51751d[_0x5084('0x11')]['message']);return _0x2d618c(_0x51751d[_0x5084('0x11')][_0x5084('0x12')]);}logger[_0x5084('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x2b5a6c,_0x51751d[_0x5084('0x11')][_0x5084('0x12')]);return _0x2bebaa(_0x51751d[_0x5084('0x11')][_0x5084('0x12')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x2b5a6c,'request\x20sent');_0x2bebaa(_0x51751d[_0x5084('0x13')][_0x5084('0x12')]);}})[_0x5084('0x14')](function(_0x41d7e7){logger[_0x5084('0x11')](_0x5084('0xd'),_0x2b5a6c,_0x41d7e7);_0x2d618c(_0x41d7e7);});});} \ No newline at end of file +var _0x8b63=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../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','result'];(function(_0x3b18e6,_0x35e310){var _0xaf05b7=function(_0x5f0cc8){while(--_0x5f0cc8){_0x3b18e6['push'](_0x3b18e6['shift']());}};_0xaf05b7(++_0x35e310);}(_0x8b63,0xfe));var _0x38b6=function(_0x1dc8b8,_0x199da3){_0x1dc8b8=_0x1dc8b8-0x0;var _0x52899a=_0x8b63[_0x1dc8b8];return _0x52899a;};'use strict';var _=require(_0x38b6('0x0'));var util=require(_0x38b6('0x1'));var moment=require(_0x38b6('0x2'));var BPromise=require(_0x38b6('0x3'));var rs=require(_0x38b6('0x4'));var fs=require('fs');var Redis=require(_0x38b6('0x5'));var db=require(_0x38b6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x38b6('0x7'));var jayson=require(_0x38b6('0x8'));var client=jayson[_0x38b6('0x9')][_0x38b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51fddc,_0x5570de,_0x35d937){return new BPromise(function(_0x43898b,_0x4cb2a8){return client[_0x38b6('0xb')](_0x51fddc,_0x35d937)[_0x38b6('0xc')](function(_0x367cc9){logger[_0x38b6('0xd')](_0x38b6('0xe'),_0x5570de,_0x38b6('0xf'));logger[_0x38b6('0x10')](_0x38b6('0x11'),_0x5570de,_0x38b6('0xf'),JSON['stringify'](_0x367cc9));if(_0x367cc9[_0x38b6('0x12')]){if(_0x367cc9[_0x38b6('0x12')][_0x38b6('0x13')]===0x1f4){logger['error'](_0x38b6('0xe'),_0x5570de,_0x367cc9[_0x38b6('0x12')][_0x38b6('0x14')]);return _0x4cb2a8(_0x367cc9[_0x38b6('0x12')][_0x38b6('0x14')]);}logger['error'](_0x38b6('0xe'),_0x5570de,_0x367cc9[_0x38b6('0x12')][_0x38b6('0x14')]);return _0x43898b(_0x367cc9[_0x38b6('0x12')][_0x38b6('0x14')]);}else{logger['info'](_0x38b6('0xe'),_0x5570de,'request\x20sent');_0x43898b(_0x367cc9[_0x38b6('0x15')][_0x38b6('0x14')]);}})[_0x38b6('0x16')](function(_0x3d238d){logger[_0x38b6('0x12')](_0x38b6('0xe'),_0x5570de,_0x3d238d);_0x4cb2a8(_0x3d238d);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index deb763f..7a2e5ea 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 _0x4ff6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ff6,0xee));var _0x64ff=function(_0x1d8c7d,_0x38e94c){_0x1d8c7d=_0x1d8c7d-0x0;var _0x543b07=_0x4ff6[_0x1d8c7d];return _0x543b07;};'use strict';var multer=require(_0x64ff('0x0'));var util=require('util');var path=require(_0x64ff('0x1'));var timeout=require('connect-timeout');var express=require(_0x64ff('0x2'));var router=express['Router']();var fs_extra=require(_0x64ff('0x3'));var auth=require(_0x64ff('0x4'));var interaction=require(_0x64ff('0x5'));var config=require(_0x64ff('0x6'));var controller=require(_0x64ff('0x7'));router[_0x64ff('0x8')]('/',auth[_0x64ff('0x9')](),controller[_0x64ff('0xa')]);router['get'](_0x64ff('0xb'),auth['isAuthenticated'](),controller[_0x64ff('0xc')]);router[_0x64ff('0x8')](_0x64ff('0xd'),auth[_0x64ff('0x9')](),controller[_0x64ff('0xe')]);router[_0x64ff('0xf')]('/',auth[_0x64ff('0x9')](),controller[_0x64ff('0x10')]);router[_0x64ff('0x11')](_0x64ff('0xd'),auth[_0x64ff('0x9')](),controller[_0x64ff('0x12')]);router[_0x64ff('0x13')](_0x64ff('0xd'),auth['isAuthenticated'](),controller[_0x64ff('0x14')]);module[_0x64ff('0x15')]=router; \ No newline at end of file +var _0x1fa9=['Router','fs-extra','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','delete','destroy','util','path','connect-timeout','express'];(function(_0x487663,_0x57146b){var _0xa64395=function(_0x2b4fe1){while(--_0x2b4fe1){_0x487663['push'](_0x487663['shift']());}};_0xa64395(++_0x57146b);}(_0x1fa9,0x7a));var _0x91fa=function(_0x3704f5,_0x166849){_0x3704f5=_0x3704f5-0x0;var _0x47e43d=_0x1fa9[_0x3704f5];return _0x47e43d;};'use strict';var multer=require('multer');var util=require(_0x91fa('0x0'));var path=require(_0x91fa('0x1'));var timeout=require(_0x91fa('0x2'));var express=require(_0x91fa('0x3'));var router=express[_0x91fa('0x4')]();var fs_extra=require(_0x91fa('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x91fa('0x6'));var controller=require(_0x91fa('0x7'));router[_0x91fa('0x8')]('/',auth[_0x91fa('0x9')](),controller[_0x91fa('0xa')]);router[_0x91fa('0x8')](_0x91fa('0xb'),auth[_0x91fa('0x9')](),controller[_0x91fa('0xc')]);router[_0x91fa('0x8')](_0x91fa('0xd'),auth[_0x91fa('0x9')](),controller[_0x91fa('0xe')]);router['post']('/',auth[_0x91fa('0x9')](),controller[_0x91fa('0xf')]);router['put'](_0x91fa('0xd'),auth[_0x91fa('0x9')](),controller['update']);router[_0x91fa('0x10')](_0x91fa('0xd'),auth[_0x91fa('0x9')](),controller[_0x91fa('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index ee54d23..104fcaf 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 _0x066e=['input','name','text','getDataValue','onlineForm','stringify','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','CHAT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','ENUM','thumb','star'];(function(_0x5cfb92,_0x5797e6){var _0x1cd7c2=function(_0x1bb452){while(--_0x1bb452){_0x5cfb92['push'](_0x5cfb92['shift']());}};_0x1cd7c2(++_0x5797e6);}(_0x066e,0xa1));var _0xe066=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x066e[_0x4e1d03];return _0x362d4b;};'use strict';var Sequelize=require(_0xe066('0x0'));var rs=require(_0xe066('0x1'));module[_0xe066('0x2')]={'name':{'type':Sequelize[_0xe066('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xe066('0x3')],'allowNull':![],'unique':_0xe066('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xe066('0x5')},'key':{'type':Sequelize[_0xe066('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xe066('0x6')},'customerAlias':{'type':Sequelize[_0xe066('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe066('0x3')],'allowNull':![],'defaultValue':_0xe066('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xe066('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xe066('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xe066('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xe066('0x3')]},'animation':{'type':Sequelize[_0xe066('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xe066('0xa'),'squared'),'defaultValue':_0xe066('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xe066('0xb')},'start_chat_button':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0xc')},'offline_chat_button':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0xd')},'header_offline':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xe066('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xe066('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe066('0x10')]},'closingQuestion':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe066('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xe066('0x14')},'placeholderMessage':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0x15')},'closingMessage':{'type':Sequelize[_0xe066('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xe066('0xd')},'skipMessageButton':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0x16')},'conditionAgreement':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0x17')},'ratingType':{'type':Sequelize[_0xe066('0x18')]('star',_0xe066('0x19')),'defaultValue':_0xe066('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0xe066('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xe066('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xe066('0x1b'),'variable':null,'config':{'placeholder':_0xe066('0x1c'),'type':_0xe066('0x1d'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xe066('0x1b'),'props':{'title':_0xe066('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xe066('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe066('0x1e')]('onlineForm')?JSON['parse'](this[_0xe066('0x1e')]('onlineForm')):{};},'set':function(_0x1bac9d){return this['setDataValue'](_0xe066('0x1f'),JSON[_0xe066('0x20')](_0x1bac9d));}},'offlineForm':{'type':Sequelize[_0xe066('0x10')],'defaultValue':function(){return JSON[_0xe066('0x20')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xe066('0x5'),'type':_0xe066('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0xe066('0x21')},'props':{'title':_0xe066('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xe066('0x1e')](_0xe066('0x22'))?JSON['parse'](this[_0xe066('0x1e')](_0xe066('0x22'))):{};},'set':function(_0x1d5fe3){return this['setDataValue'](_0xe066('0x22'),JSON[_0xe066('0x20')](_0x1d5fe3));}},'token':{'type':Sequelize[_0xe066('0x3')],'defaultValue':function(){return rs[_0xe066('0x23')]();}},'autoclose':{'type':Sequelize[_0xe066('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xe066('0x3')]},'forwardOffline':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xe066('0x3')]},'waitingTitle':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0x24')},'waitingMessage':{'type':Sequelize[_0xe066('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0x25')},'offlineMessageBody':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xe066('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe066('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xe066('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xe066('0x3')],'defaultValue':_0xe066('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xe066('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe066('0x3')]},'notificationTemplate':{'type':Sequelize[_0xe066('0x10')],'defaultValue':function(){return _0xe066('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xe066('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xe066('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xe066('0x28')},'messagesAlignment':{'type':Sequelize[_0xe066('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xe066('0x3')]},'customerAvatar':{'type':Sequelize[_0xe066('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xe066('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe066('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe066('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xe066('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe066('0x8')],'comment':_0xe066('0x29')},'mandatoryDisposition':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![],'comment':_0xe066('0x2a'),'set':function(_0x1582a5){if(!_0x1582a5)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xe066('0x2b')](_0xe066('0x2c'),_0x1582a5);}},'vidaooEscalation':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xe066('0x3')]},'vidaooTopic':{'type':Sequelize[_0xe066('0x3')],'allowNull':![],'defaultValue':_0xe066('0x2d')},'vidaooNote':{'type':Sequelize[_0xe066('0x3')],'defaultValue':function(){return _0xe066('0x2e');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xe066('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xe066('0x10')]}}; \ No newline at end of file +var _0x67fa=['Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Send','Contact\x20us'];(function(_0x17316d,_0x1bc0d4){var _0x41ecfb=function(_0x1cb8c0){while(--_0x1cb8c0){_0x17316d['push'](_0x17316d['shift']());}};_0x41ecfb(++_0x1bc0d4);}(_0x67fa,0x164));var _0xa67f=function(_0x1b81f6,_0x35d60e){_0x1b81f6=_0x1b81f6-0x0;var _0x1172b4=_0x67fa[_0x1b81f6];return _0x1172b4;};'use strict';var Sequelize=require(_0xa67f('0x0'));var rs=require(_0xa67f('0x1'));module['exports']={'name':{'type':Sequelize[_0xa67f('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xa67f('0x2')],'allowNull':![],'unique':_0xa67f('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0xa67f('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xa67f('0x5')},'customerAlias':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa67f('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa67f('0x2')],'allowNull':![],'defaultValue':_0xa67f('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa67f('0x2')],'allowNull':![],'defaultValue':_0xa67f('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xa67f('0x2')],'allowNull':![],'defaultValue':_0xa67f('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa67f('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xa67f('0xa'),_0xa67f('0xb')),'defaultValue':_0xa67f('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xa67f('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xa67f('0xd')},'header_offline':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0xe')},'download_transcript':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa67f('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xa67f('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xa67f('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa67f('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0x13')},'closingMessageButton':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0xd')},'skipMessageButton':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xa67f('0x15')},'ratingType':{'type':Sequelize[_0xa67f('0x16')](_0xa67f('0x17'),_0xa67f('0x18')),'defaultValue':_0xa67f('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xa67f('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa67f('0x19')],'defaultValue':function(){return JSON[_0xa67f('0x1a')]({'items':[{'type':_0xa67f('0x1b'),'variable':null,'config':{'placeholder':_0xa67f('0x1c'),'type':_0xa67f('0x1d'),'required':!![]},'props':{'title':_0xa67f('0x1c'),'helpText':''}},{'type':_0xa67f('0x1b'),'props':{'title':_0xa67f('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa67f('0x4'),'type':_0xa67f('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa67f('0x1e')](_0xa67f('0x1f'))?JSON[_0xa67f('0x20')](this[_0xa67f('0x1e')](_0xa67f('0x1f'))):{};},'set':function(_0x430462){return this['setDataValue'](_0xa67f('0x1f'),JSON['stringify'](_0x430462));}},'offlineForm':{'type':Sequelize[_0xa67f('0x19')],'defaultValue':function(){return JSON[_0xa67f('0x1a')]({'items':[{'type':_0xa67f('0x1b'),'props':{'title':_0xa67f('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa67f('0x4'),'type':_0xa67f('0x4')},'variable':null},{'type':_0xa67f('0x21'),'config':{'placeholder':_0xa67f('0x22')},'props':{'title':'Comments','helpText':_0xa67f('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xa67f('0x1e')](_0xa67f('0x24'))?JSON[_0xa67f('0x20')](this[_0xa67f('0x1e')](_0xa67f('0x24'))):{};},'set':function(_0x397483){return this['setDataValue'](_0xa67f('0x24'),JSON[_0xa67f('0x1a')](_0x397483));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa67f('0x25')]();}},'autoclose':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa67f('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa67f('0x2')]},'waitingTitle':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa67f('0x27')},'skipUnmanaged':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0x14')},'sendUnmanaged':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa67f('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa67f('0x28');}},'notificationSound':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0x2a')},'messagesAlignment':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0x2b')},'defaultTitle':{'type':Sequelize[_0xa67f('0x2')]},'customerAvatar':{'type':Sequelize[_0xa67f('0x19')]},'showCustomerAvatar':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa67f('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa67f('0x2')],'allowNull':![],'defaultValue':_0xa67f('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa67f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa67f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':_0xa67f('0x2d')},'systemAvatar':{'type':Sequelize[_0xa67f('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa67f('0x8')],'comment':_0xa67f('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![],'comment':_0xa67f('0x2f'),'set':function(_0x596462){if(!_0x596462)this['setDataValue'](_0xa67f('0x30'),null);this[_0xa67f('0x31')](_0xa67f('0x32'),_0x596462);}},'vidaooEscalation':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa67f('0x2')]},'vidaooTopic':{'type':Sequelize[_0xa67f('0x2')],'allowNull':![],'defaultValue':_0xa67f('0x33')},'vidaooNote':{'type':Sequelize[_0xa67f('0x2')],'defaultValue':function(){return _0xa67f('0x34');}},'vidaooMetadata':{'type':Sequelize[_0xa67f('0x19')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xa67f('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xa67f('0x19')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 151e18f..31eb484 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 _0xd67b=['items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','util','ejs','fs-extra','lodash','html-to-text','jayson/promise','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','URL','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','update','destroy','ChatWebsites','UserProfileResource','name','send','user-agent-parser','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','referer','version','format','%s\x20%s','browser','unknown','device','model','vendor','%s\x20%s\x20%s','type','stringify','index','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','mandatoryDispositionPause','options','find','create','address','split','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','user','get','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','params','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','sitepic','file','addAvatar','agentAvatar','customerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','root','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','ifTime','notify','chat','from','mapKey','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','priority','list','Contacts','headers','threadId','ChatInteraction','closed','externalUrl','interaction','contact','firstName','messageId','created','unmanaged','*,*,*,*','ChatMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','queue','Start','startRouting','EventManager','files','Sequelize','no\x20available\x20attributes','difference','ValidationError','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','fromString','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','mapValues','lastName','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','Tag','tag','getProactiveActions','virtual','custom','License','increment','timezone','readFileSync','server/files/chat/iframe.ejs','3.13.0','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','connection','remoteAddress','replace','verticalAlignment','color','labelText','textColor','addApplications','ISOLATION_LEVELS','findAndCountAll','stack','finally','getApplications','addProactiveActions','getFields','online','offlineForm'];(function(_0x2246bc,_0x13c2dc){var _0x526666=function(_0x4cc80){while(--_0x4cc80){_0x2246bc['push'](_0x2246bc['shift']());}};_0x526666(++_0x13c2dc);}(_0xd67b,0x133));var _0xbd67=function(_0x50450d,_0x314c15){_0x50450d=_0x50450d-0x0;var _0x1c391b=_0xd67b[_0x50450d];return _0x1c391b;};'use strict';var Mustache=require('mustache');var util=require(_0xbd67('0x0'));var path=require('path');var ejs=require(_0xbd67('0x1'));var fs=require('fs');var fs_extra=require(_0xbd67('0x2'));var _=require(_0xbd67('0x3'));var querystring=require('querystring');var htmlToText=require(_0xbd67('0x4'));var Redis=require('ioredis');var jayson=require(_0xbd67('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xbd67('0x6'))(_0xbd67('0x7'));var config=require(_0xbd67('0x8'));var APIBadRequestError=require(_0xbd67('0x9'))[_0xbd67('0xa')];var APINotFoundError=require(_0xbd67('0x9'))[_0xbd67('0xb')];var APIOutOfIntervalError=require(_0xbd67('0x9'))[_0xbd67('0xc')];var APIHandleError=require(_0xbd67('0x9'))[_0xbd67('0xd')];var APIConflictError=require(_0xbd67('0x9'))[_0xbd67('0xe')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require('url')[_0xbd67('0xf')];var db=require('../../mysqldb')['db'];config[_0xbd67('0x10')]=_[_0xbd67('0x11')](config[_0xbd67('0x10')],{'host':_0xbd67('0x12'),'port':0x18eb});var socket=require(_0xbd67('0x13'))(new Redis(config[_0xbd67('0x10')]));require(_0xbd67('0x14'))[_0xbd67('0x15')](socket);var client=jayson[_0xbd67('0x16')][_0xbd67('0x17')]({'port':0x232c});var client9002=jayson['client'][_0xbd67('0x17')]({'port':0x232a});var client9003=jayson[_0xbd67('0x16')][_0xbd67('0x17')]({'port':0x232b});var client9001=jayson[_0xbd67('0x16')][_0xbd67('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x23b626,_0x44c025,_0xbdd027,_0xa45c76){return new Promise(function(_0x140df9,_0x591de9){var _0x4ab3a6=_0xa45c76||client;return _0x4ab3a6[_0xbd67('0x18')](_0x23b626,_0xbdd027)[_0xbd67('0x19')](function(_0xff31b){logger['info'](_0xbd67('0x1a'),_0x44c025,_0xbd67('0x1b'));logger[_0xbd67('0x1c')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x44c025,_0xbd67('0x1b'),JSON['stringify'](_0xff31b));if(_0xff31b[_0xbd67('0x1d')]){if(_0xff31b[_0xbd67('0x1d')][_0xbd67('0x1e')]===0x1f4){logger['error'](_0xbd67('0x1a'),_0x44c025,_0xff31b[_0xbd67('0x1d')][_0xbd67('0x1f')]);return _0x591de9(_0xff31b[_0xbd67('0x1d')][_0xbd67('0x1f')]);}logger[_0xbd67('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x44c025,_0xff31b[_0xbd67('0x1d')][_0xbd67('0x1f')]);return _0x140df9(_0xff31b[_0xbd67('0x1d')][_0xbd67('0x1f')]);}else{logger[_0xbd67('0x20')](_0xbd67('0x1a'),_0x44c025,_0xbd67('0x1b'));_0x140df9(_0xff31b[_0xbd67('0x21')][_0xbd67('0x1f')]);}})[_0xbd67('0x22')](function(_0x46b7ff){logger['error'](_0xbd67('0x1a'),_0x44c025,_0x46b7ff);_0x591de9(_0x46b7ff);});});}function respondWithStatusCode(_0x5a5227,_0x25bf7a){_0x25bf7a=_0x25bf7a||0xcc;return function(_0x13b8b8){if(_0x13b8b8){return _0x5a5227[_0xbd67('0x23')](_0x25bf7a);}return _0x5a5227['status'](_0x25bf7a)[_0xbd67('0x24')]();};}function respondWithResult(_0x410baa,_0x4dfa19){_0x4dfa19=_0x4dfa19||0xc8;return function(_0x3a062e){if(_0x3a062e){return _0x410baa[_0xbd67('0x25')](_0x4dfa19)[_0xbd67('0x26')](_0x3a062e);}};}function respondWithFilteredResult(_0x1c66ae,_0x3726ea){return function(_0x55c2d4){if(_0x55c2d4){var _0x5975dc=typeof _0x3726ea[_0xbd67('0x27')]===_0xbd67('0x28')&&typeof _0x3726ea[_0xbd67('0x29')]===_0xbd67('0x28');var _0xc89b90=_0x55c2d4[_0xbd67('0x2a')];var _0x256137=_0x5975dc?0x0:_0x3726ea[_0xbd67('0x27')];var _0x3436bd=_0x5975dc?_0x55c2d4[_0xbd67('0x2a')]:_0x3726ea['offset']+_0x3726ea['limit'];var _0x5fcae8;if(_0x3436bd>=_0xc89b90){_0x3436bd=_0xc89b90;_0x5fcae8=0xc8;}else{_0x5fcae8=0xce;}_0x1c66ae[_0xbd67('0x25')](_0x5fcae8);return _0x1c66ae[_0xbd67('0x2b')]('Content-Range',_0x256137+'-'+_0x3436bd+'/'+_0xc89b90)[_0xbd67('0x26')](_0x55c2d4);}return null;};}function saveUpdates(_0x15da85){return function(_0xb3f593){if(_0xb3f593){return _0xb3f593[_0xbd67('0x2c')](_0x15da85)['then'](function(_0x5186eb){return _0x5186eb;});}return null;};}function removeEntity(_0x4a3627){return function(_0xa8be43){if(_0xa8be43){return _0xa8be43[_0xbd67('0x2d')]()[_0xbd67('0x19')](function(){var _0x562eeb=_0xa8be43['get']({'plain':!![]});var _0x303849=_0xbd67('0x2e');return db[_0xbd67('0x2f')][_0xbd67('0x2d')]({'where':{'type':_0x303849,'resourceId':_0x562eeb['id']}})[_0xbd67('0x19')](function(){return _0xa8be43;});})[_0xbd67('0x19')](function(){_0x4a3627['status'](0xcc)[_0xbd67('0x24')]();});}};}function handleEntityNotFound(_0xba97cf){return function(_0x443d45){if(!_0x443d45){_0xba97cf['sendStatus'](0x194);}return _0x443d45;};}function handleError(_0x43635c,_0x536474){_0x536474=_0x536474||0x1f4;return function(_0x3993e9){logger[_0xbd67('0x1d')](_0x3993e9['stack']);if(_0x3993e9[_0xbd67('0x30')]){delete _0x3993e9[_0xbd67('0x30')];}_0x43635c[_0xbd67('0x25')](_0x536474)[_0xbd67('0x31')](_0x3993e9);};}function createInteractionObject(_0x1b2777,_0x3e6710,_0x5de2b5,_0x383c65){var _0x151848=require(_0xbd67('0x32'));var _0x41149d=new _0x151848();var _0x479211=_0x41149d['setUA'](_0x5de2b5['user-agent'])[_0xbd67('0x33')]();var _0x348024=_0x3e6710[_0xbd67('0x34')];if(_0x5de2b5['cf-connecting-ip']){_0x348024=_0x5de2b5[_0xbd67('0x35')];}else if(_0x5de2b5[_0xbd67('0x36')]){_0x348024=_[_0xbd67('0x37')](_0x5de2b5[_0xbd67('0x36')]['split'](','));}return{'ContactId':_0x383c65['id'],'ChatWebsiteId':_0x1b2777,'from':(_0x383c65['firstName']||'')+'\x20'+(_0x383c65['lastName']||''),'customerIp':_0x348024,'customerPort':_0x5de2b5['x-real-port']?_0x5de2b5['x-real-port']:null,'referer':_0x3e6710[_0xbd67('0x38')],'browserName':_0x479211['browser']['name']&&_0x479211['browser'][_0xbd67('0x39')]?util[_0xbd67('0x3a')](_0xbd67('0x3b'),_0x479211[_0xbd67('0x3c')]['name'],_0x479211[_0xbd67('0x3c')][_0xbd67('0x39')]):_0xbd67('0x3d'),'browserVersion':_0x479211[_0xbd67('0x3c')][_0xbd67('0x39')]||_0xbd67('0x3d'),'osName':util[_0xbd67('0x3a')]('%s\x20%s',_0x479211['os'][_0xbd67('0x30')],_0x479211['os']['version']),'osVersion':_0x479211['os'][_0xbd67('0x39')],'deviceModel':_0x479211[_0xbd67('0x3e')][_0xbd67('0x3f')]&&_0x479211[_0xbd67('0x3e')][_0xbd67('0x40')]?util[_0xbd67('0x3a')](_0xbd67('0x41'),_0x479211[_0xbd67('0x3e')]['model'],_0x479211[_0xbd67('0x3e')][_0xbd67('0x40')],_0x479211['device'][_0xbd67('0x42')]):null,'deviceVendor':_0x479211[_0xbd67('0x3e')][_0xbd67('0x40')],'deviceType':_0x479211['device']['type'],'formData':JSON[_0xbd67('0x43')](_0x3e6710)};}exports[_0xbd67('0x44')]=function(_0x2d53fc,_0x48f4ea){var _0x31fbd5={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x345508={},_0x56ba76={'count':0x0,'rows':[]};var _0x58328f=_[_0xbd67('0x45')](db[_0xbd67('0x46')][_0xbd67('0x47')],function(_0x109a7d){return{'name':_0x109a7d[_0xbd67('0x48')],'type':_0x109a7d['type'][_0xbd67('0x49')]};});_0x345508[_0xbd67('0x3f')]=_['map'](_0x58328f,_0xbd67('0x30'));_0x345508[_0xbd67('0x4a')]=_[_0xbd67('0x4b')](_0x2d53fc[_0xbd67('0x4a')]);_0x345508[_0xbd67('0x4c')]=_['intersection'](_0x345508[_0xbd67('0x3f')],_0x345508['query']);_0x31fbd5[_0xbd67('0x4d')]=_[_0xbd67('0x4e')](_0x345508['model'],qs[_0xbd67('0x4f')](_0x2d53fc[_0xbd67('0x4a')][_0xbd67('0x4f')]));_0x31fbd5['attributes']=_0x31fbd5[_0xbd67('0x4d')][_0xbd67('0x50')]?_0x31fbd5[_0xbd67('0x4d')]:_0x345508[_0xbd67('0x3f')];if(!_0x2d53fc[_0xbd67('0x4a')][_0xbd67('0x51')](_0xbd67('0x52'))){_0x31fbd5['limit']=qs['limit'](_0x2d53fc[_0xbd67('0x4a')][_0xbd67('0x29')]);_0x31fbd5[_0xbd67('0x27')]=qs[_0xbd67('0x27')](_0x2d53fc[_0xbd67('0x4a')]['offset']);}_0x31fbd5['order']=qs[_0xbd67('0x53')](_0x2d53fc[_0xbd67('0x4a')][_0xbd67('0x53')]);_0x31fbd5[_0xbd67('0x54')]=qs[_0xbd67('0x4c')](_[_0xbd67('0x55')](_0x2d53fc[_0xbd67('0x4a')],_0x345508[_0xbd67('0x4c')]),_0x58328f);if(_0x2d53fc[_0xbd67('0x4a')][_0xbd67('0x56')]){_0x31fbd5['where']=_['merge'](_0x31fbd5[_0xbd67('0x54')],{'$or':_['map'](_0x58328f,function(_0x35af4a){if(_0x35af4a[_0xbd67('0x42')]!==_0xbd67('0x57')){var _0x37f588={};_0x37f588[_0x35af4a['name']]={'$like':'%'+_0x2d53fc[_0xbd67('0x4a')][_0xbd67('0x56')]+'%'};return _0x37f588;}})});}_0x31fbd5=_[_0xbd67('0x58')]({},_0x31fbd5,_0x2d53fc['options']);var _0x4529aa={'where':_0x31fbd5['where']};return db[_0xbd67('0x46')][_0xbd67('0x2a')](_0x4529aa)['then'](function(_0x410dc0){_0x56ba76[_0xbd67('0x2a')]=_0x410dc0;if(_0x2d53fc[_0xbd67('0x4a')][_0xbd67('0x59')]){_0x31fbd5[_0xbd67('0x5a')]=[{'all':!![]}];}return db[_0xbd67('0x46')][_0xbd67('0x5b')](_0x31fbd5);})[_0xbd67('0x19')](function(_0xb58edb){_0x56ba76[_0xbd67('0x5c')]=_0xb58edb;return _0x56ba76;})[_0xbd67('0x19')](respondWithFilteredResult(_0x48f4ea,_0x31fbd5))[_0xbd67('0x22')](handleError(_0x48f4ea,null));};exports[_0xbd67('0x5d')]=function(_0x303da4,_0x3a9f86){var _0x27cef0={'raw':![],'where':{'id':_0x303da4['params']['id']},'include':[{'model':db['Pause'],'as':_0xbd67('0x5e')}]},_0x16f722={};_0x16f722[_0xbd67('0x3f')]=_['keys'](db[_0xbd67('0x46')][_0xbd67('0x47')]);_0x16f722[_0xbd67('0x4a')]=_['keys'](_0x303da4[_0xbd67('0x4a')]);_0x16f722[_0xbd67('0x4c')]=_[_0xbd67('0x4e')](_0x16f722[_0xbd67('0x3f')],_0x16f722[_0xbd67('0x4a')]);_0x27cef0[_0xbd67('0x4d')]=_['intersection'](_0x16f722[_0xbd67('0x3f')],qs['fields'](_0x303da4[_0xbd67('0x4a')][_0xbd67('0x4f')]));_0x27cef0['attributes']=_0x27cef0['attributes'][_0xbd67('0x50')]?_0x27cef0[_0xbd67('0x4d')]:_0x16f722[_0xbd67('0x3f')];if(_0x303da4[_0xbd67('0x4a')][_0xbd67('0x59')]){_0x27cef0['include']=[{'all':!![]}];}_0x27cef0=_[_0xbd67('0x58')]({},_0x27cef0,_0x303da4[_0xbd67('0x5f')]);return db[_0xbd67('0x46')][_0xbd67('0x60')](_0x27cef0)[_0xbd67('0x19')](handleEntityNotFound(_0x3a9f86,null))[_0xbd67('0x19')](respondWithResult(_0x3a9f86,null))[_0xbd67('0x22')](handleError(_0x3a9f86,null));};exports[_0xbd67('0x61')]=function(_0x16c8bb,_0x1c2405){var _0x47b41f=null;_0x16c8bb['body'][_0xbd67('0x62')][_0xbd67('0x63')](',')['forEach'](_0x258be7=>{if(_0x258be7[_0xbd67('0x64')]()!==''&&!wildcardUtils[_0xbd67('0x65')](_0x258be7['trim']())){_0x47b41f=new APIBadRequestError('\x22'+_0x258be7['trim']()+_0xbd67('0x66'));}});if(_0x47b41f){return handleError(_0x1c2405,null)(_0x47b41f);}return db['ChatWebsite'][_0xbd67('0x61')](_0x16c8bb[_0xbd67('0x67')],{})['then'](function(_0xb37611){var _0x3d24a0=_0x16c8bb[_0xbd67('0x68')][_0xbd67('0x69')]({'plain':!![]});if(!_0x3d24a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d24a0[_0xbd67('0x6a')]===_0xbd67('0x68')){var _0x55c71f=_0xb37611[_0xbd67('0x69')]({'plain':!![]});var _0xe1a90c=_0xbd67('0x2e');return db['UserProfileSection'][_0xbd67('0x60')]({'where':{'name':_0xe1a90c,'userProfileId':_0x3d24a0[_0xbd67('0x6b')]},'raw':!![]})[_0xbd67('0x19')](function(_0x2e56cc){if(_0x2e56cc&&_0x2e56cc['autoAssociation']===0x0){return db[_0xbd67('0x2f')][_0xbd67('0x61')]({'name':_0x55c71f[_0xbd67('0x30')],'resourceId':_0x55c71f['id'],'type':_0x2e56cc['name'],'sectionId':_0x2e56cc['id']},{})[_0xbd67('0x19')](function(){return _0xb37611;});}else{return _0xb37611;}})['catch'](function(_0x55959e){logger[_0xbd67('0x1d')](_0xbd67('0x6c'),_0x55959e);throw _0x55959e;});}return _0xb37611;})[_0xbd67('0x19')](respondWithResult(_0x1c2405,0xc9))[_0xbd67('0x22')](handleError(_0x1c2405,null));};exports[_0xbd67('0x2c')]=function(_0x43b6ea,_0x429076){var _0x3510a5=null;_0x43b6ea[_0xbd67('0x67')][_0xbd67('0x62')][_0xbd67('0x63')](',')[_0xbd67('0x6d')](_0x188015=>{if(_0x188015[_0xbd67('0x64')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x188015[_0xbd67('0x64')]())){_0x3510a5=new APIBadRequestError('\x22'+_0x188015['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x3510a5){return handleError(_0x429076,null)(_0x3510a5);}if(_0x43b6ea[_0xbd67('0x67')]['id']){delete _0x43b6ea[_0xbd67('0x67')]['id'];}return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0x43b6ea[_0xbd67('0x6e')]['id']},'include':[{'model':db[_0xbd67('0x6f')],'as':'mandatoryDispositionPause'}]})[_0xbd67('0x19')](handleEntityNotFound(_0x429076,null))['then'](saveUpdates(_0x43b6ea['body'],null))['then'](respondWithResult(_0x429076,null))[_0xbd67('0x22')](handleError(_0x429076,null));};exports[_0xbd67('0x2d')]=function(_0x2cc861,_0x41ff24){return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0x2cc861['params']['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x41ff24,null))[_0xbd67('0x19')](removeEntity(_0x41ff24,null))[_0xbd67('0x22')](handleError(_0x41ff24,null));};exports['describe']=function(_0x480eeb,_0x4ef35f){return db[_0xbd67('0x46')][_0xbd67('0x70')]()['then'](respondWithResult(_0x4ef35f,null))[_0xbd67('0x22')](handleError(_0x4ef35f,null));};exports[_0xbd67('0x71')]=function(_0x4a6995,_0x3a571f){if(_0x4a6995[_0xbd67('0x67')]['id']){delete _0x4a6995[_0xbd67('0x67')]['id'];}return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0x4a6995[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x3a571f,null))[_0xbd67('0x19')](function(_0x489598){if(_0x489598){_0x4a6995['body'][_0xbd67('0x72')]=_0x489598['id'];return db[_0xbd67('0x73')][_0xbd67('0x61')](_0x4a6995[_0xbd67('0x67')]);}})['then'](respondWithResult(_0x3a571f,null))[_0xbd67('0x22')](handleError(_0x3a571f,null));};exports[_0xbd67('0x74')]=function(_0x18b8c8,_0x58d339){var _0x5cbb1c={'raw':![],'where':{}};var _0x2bc2b7={};var _0x5159f8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbd67('0x75')]({'where':{'id':_0x18b8c8[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x58d339,null))[_0xbd67('0x19')](function(_0x569582){if(_0x569582){_0x2bc2b7[_0xbd67('0x3f')]=_[_0xbd67('0x4b')](db[_0xbd67('0x73')][_0xbd67('0x47')]);_0x2bc2b7[_0xbd67('0x4a')]=_[_0xbd67('0x4b')](_0x18b8c8[_0xbd67('0x4a')]);_0x2bc2b7[_0xbd67('0x4c')]=_[_0xbd67('0x4e')](_0x2bc2b7[_0xbd67('0x3f')],_0x2bc2b7[_0xbd67('0x4a')]);_0x5cbb1c[_0xbd67('0x4d')]=_[_0xbd67('0x4e')](_0x2bc2b7['model'],qs[_0xbd67('0x4f')](_0x18b8c8['query'][_0xbd67('0x4f')]));_0x5cbb1c[_0xbd67('0x4d')]=_0x5cbb1c[_0xbd67('0x4d')][_0xbd67('0x50')]?_0x5cbb1c[_0xbd67('0x4d')]:_0x2bc2b7[_0xbd67('0x3f')];if(!_0x18b8c8['query']['hasOwnProperty'](_0xbd67('0x52'))){_0x5cbb1c[_0xbd67('0x29')]=qs[_0xbd67('0x29')](_0x18b8c8['query'][_0xbd67('0x29')]);_0x5cbb1c['offset']=qs['offset'](_0x18b8c8['query']['offset']);}_0x5cbb1c[_0xbd67('0x76')]=qs['sort'](_0x18b8c8['query'][_0xbd67('0x53')]);_0x5cbb1c[_0xbd67('0x54')]=qs[_0xbd67('0x4c')](_[_0xbd67('0x55')](_0x18b8c8[_0xbd67('0x4a')],_0x2bc2b7[_0xbd67('0x4c')]));_0x5cbb1c[_0xbd67('0x54')][_0xbd67('0x72')]=_0x569582['id'];if(_0x18b8c8[_0xbd67('0x4a')][_0xbd67('0x56')]){_0x5cbb1c['where']=_['merge'](_0x5cbb1c[_0xbd67('0x54')],{'$or':_[_0xbd67('0x45')](_0x5cbb1c[_0xbd67('0x4d')],function(_0x22c8c8){var _0x555c08={};_0x555c08[_0x22c8c8]={'$like':'%'+_0x18b8c8[_0xbd67('0x4a')][_0xbd67('0x56')]+'%'};return _0x555c08;})});}_0x5cbb1c=_[_0xbd67('0x58')]({},_0x5cbb1c,_0x18b8c8[_0xbd67('0x5f')]);return db['Disposition'][_0xbd67('0x2a')]({'where':_0x5cbb1c[_0xbd67('0x54')]})[_0xbd67('0x19')](function(_0x3a874a){_0x5159f8[_0xbd67('0x2a')]=_0x3a874a;if(_0x18b8c8[_0xbd67('0x4a')][_0xbd67('0x59')]){_0x5cbb1c[_0xbd67('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0xbd67('0x5b')](_0x5cbb1c);})['then'](function(_0x2cc553){_0x5159f8[_0xbd67('0x5c')]=_0x2cc553;return _0x5159f8;});}})[_0xbd67('0x19')](respondWithFilteredResult(_0x58d339,_0x5cbb1c))[_0xbd67('0x22')](handleError(_0x58d339,null));};exports[_0xbd67('0x77')]=function(_0x2653f4,_0x2ff6bf){return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0x2653f4[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x2ff6bf,null))['then'](function(_0x34c994){if(_0x34c994){return _0x34c994[_0xbd67('0x77')](_0x2653f4[_0xbd67('0x4a')]['ids']);}})['then'](respondWithStatusCode(_0x2ff6bf,null))[_0xbd67('0x22')](handleError(_0x2ff6bf,null));};exports[_0xbd67('0x78')]=function(_0x18247a,_0x610692){if(_0x18247a[_0xbd67('0x67')]['id']){delete _0x18247a[_0xbd67('0x67')]['id'];}return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0x18247a[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x610692,null))[_0xbd67('0x19')](function(_0x2e7f26){if(_0x2e7f26){_0x18247a['body']['ChatWebsiteId']=_0x2e7f26['id'];return db[_0xbd67('0x79')][_0xbd67('0x61')](_0x18247a[_0xbd67('0x67')]);}})[_0xbd67('0x19')](respondWithResult(_0x610692,null))[_0xbd67('0x22')](handleError(_0x610692,null));};exports['getAnswers']=function(_0x3e4588,_0x30225e){var _0x35e4b2={'raw':![],'where':{}};var _0x51212b={};var _0x5c605a={'count':0x0,'rows':[]};return db[_0xbd67('0x46')]['findOne']({'where':{'id':_0x3e4588[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x30225e,null))[_0xbd67('0x19')](function(_0x256e2d){if(_0x256e2d){_0x51212b['model']=_['keys'](db[_0xbd67('0x79')][_0xbd67('0x47')]);_0x51212b[_0xbd67('0x4a')]=_[_0xbd67('0x4b')](_0x3e4588[_0xbd67('0x4a')]);_0x51212b[_0xbd67('0x4c')]=_[_0xbd67('0x4e')](_0x51212b[_0xbd67('0x3f')],_0x51212b[_0xbd67('0x4a')]);_0x35e4b2[_0xbd67('0x4d')]=_[_0xbd67('0x4e')](_0x51212b[_0xbd67('0x3f')],qs['fields'](_0x3e4588[_0xbd67('0x4a')]['fields']));_0x35e4b2[_0xbd67('0x4d')]=_0x35e4b2[_0xbd67('0x4d')][_0xbd67('0x50')]?_0x35e4b2[_0xbd67('0x4d')]:_0x51212b[_0xbd67('0x3f')];if(!_0x3e4588['query'][_0xbd67('0x51')]('nolimit')){_0x35e4b2[_0xbd67('0x29')]=qs['limit'](_0x3e4588['query'][_0xbd67('0x29')]);_0x35e4b2[_0xbd67('0x27')]=qs[_0xbd67('0x27')](_0x3e4588[_0xbd67('0x4a')][_0xbd67('0x27')]);}_0x35e4b2[_0xbd67('0x76')]=qs[_0xbd67('0x53')](_0x3e4588[_0xbd67('0x4a')][_0xbd67('0x53')]);_0x35e4b2[_0xbd67('0x54')]=qs[_0xbd67('0x4c')](_[_0xbd67('0x55')](_0x3e4588['query'],_0x51212b[_0xbd67('0x4c')]));_0x35e4b2[_0xbd67('0x54')][_0xbd67('0x72')]=_0x256e2d['id'];if(_0x3e4588[_0xbd67('0x4a')][_0xbd67('0x56')]){_0x35e4b2[_0xbd67('0x54')]=_[_0xbd67('0x58')](_0x35e4b2[_0xbd67('0x54')],{'$or':_[_0xbd67('0x45')](_0x35e4b2[_0xbd67('0x4d')],function(_0x343e26){var _0x40e050={};_0x40e050[_0x343e26]={'$like':'%'+_0x3e4588[_0xbd67('0x4a')]['filter']+'%'};return _0x40e050;})});}_0x35e4b2=_[_0xbd67('0x58')]({},_0x35e4b2,_0x3e4588['options']);return db[_0xbd67('0x79')]['count']({'where':_0x35e4b2[_0xbd67('0x54')]})['then'](function(_0x292203){_0x5c605a[_0xbd67('0x2a')]=_0x292203;if(_0x3e4588[_0xbd67('0x4a')][_0xbd67('0x59')]){_0x35e4b2[_0xbd67('0x5a')]=[{'all':!![]}];}return db[_0xbd67('0x79')][_0xbd67('0x5b')](_0x35e4b2);})[_0xbd67('0x19')](function(_0x1be5e7){_0x5c605a[_0xbd67('0x5c')]=_0x1be5e7;return _0x5c605a;});}})[_0xbd67('0x19')](respondWithFilteredResult(_0x30225e,_0x35e4b2))[_0xbd67('0x22')](handleError(_0x30225e,null));};exports[_0xbd67('0x7a')]=function(_0x14763f,_0x1ccec8){return db['ChatWebsite'][_0xbd67('0x60')]({'where':{'id':_0x14763f['params']['id']}})['then'](handleEntityNotFound(_0x1ccec8,null))[_0xbd67('0x19')](function(_0x30c73a){if(_0x30c73a){return _0x30c73a[_0xbd67('0x7a')](_0x14763f[_0xbd67('0x4a')][_0xbd67('0x7b')]);}})['then'](respondWithStatusCode(_0x1ccec8,null))[_0xbd67('0x22')](handleError(_0x1ccec8,null));};exports['addLogo']=function(_0x2e315e,_0x1df93d){_0x2e315e[_0xbd67('0x67')][_0xbd67('0x7c')]=_0x2e315e[_0xbd67('0x7d')]['filename'];return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0x2e315e[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x1df93d,null))['then'](saveUpdates(_0x2e315e[_0xbd67('0x67')],null))[_0xbd67('0x19')](respondWithResult(_0x1df93d,null))['catch'](handleError(_0x1df93d,null));};exports[_0xbd67('0x7e')]=function(_0x38eae8,_0x68ad28){_0x38eae8[_0xbd67('0x67')][_0xbd67('0x7f')]=_0x38eae8[_0xbd67('0x7d')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x38eae8['params']['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x68ad28,null))[_0xbd67('0x19')](saveUpdates(_0x38eae8[_0xbd67('0x67')],null))[_0xbd67('0x19')](respondWithResult(_0x68ad28,null))['catch'](handleError(_0x68ad28,null));};exports['addCustomerAvatar']=function(_0x37fdab,_0x4411f9){_0x37fdab[_0xbd67('0x67')][_0xbd67('0x80')]=_0x37fdab['file'][_0xbd67('0x81')];return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0x37fdab[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x4411f9,null))[_0xbd67('0x19')](saveUpdates(_0x37fdab['body'],null))[_0xbd67('0x19')](respondWithResult(_0x4411f9,null))[_0xbd67('0x22')](handleError(_0x4411f9,null));};exports[_0xbd67('0x82')]=function(_0xa01d20,_0x397f7a){_0xa01d20[_0xbd67('0x67')][_0xbd67('0x83')]=_0xa01d20['file'][_0xbd67('0x81')];return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0xa01d20[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x397f7a,null))[_0xbd67('0x19')](saveUpdates(_0xa01d20[_0xbd67('0x67')],null))[_0xbd67('0x19')](respondWithResult(_0x397f7a,null))['catch'](handleError(_0x397f7a,null));};exports[_0xbd67('0x84')]=function(_0x44320f,_0x54adcd){var _0x23f56b=path[_0xbd67('0x85')](config['root'],_0xbd67('0x86'));var _0x619e23={'where':{'id':_0x44320f['params']['id']},'attributes':['id',_0xbd67('0x7c')],'raw':!![]};var _0x20f5aa=![];return require(_0xbd67('0x87'))[_0xbd67('0x88')]()[_0xbd67('0x19')](function(_0x42a7ee){if(_0x42a7ee){_0x20f5aa=_0x42a7ee['custom'];}})[_0xbd67('0x19')](function(){return db[_0xbd67('0x46')]['find'](_0x619e23);})[_0xbd67('0x19')](handleEntityNotFound(_0x54adcd,null))[_0xbd67('0x19')](function(_0x47cd23){if(_0x47cd23){if(!_[_0xbd67('0x89')](_0x47cd23[_0xbd67('0x7c')])){if(fs[_0xbd67('0x8a')](path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0x8c'),_0x47cd23[_0xbd67('0x7c')]))&&_0x20f5aa){_0x23f56b=path['join'](config[_0xbd67('0x8b')],'server/files/images/logos/',_0x47cd23[_0xbd67('0x7c')]);}}return _0x54adcd['download'](_0x23f56b);}})[_0xbd67('0x22')](handleError(_0x54adcd,null));};exports[_0xbd67('0x8d')]=function(_0x2a0d40,_0x507069){var _0x1b1487=path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0x8e'));var _0xf217b5={'where':{'id':_0x2a0d40['params']['id']},'attributes':['id',_0xbd67('0x7f')],'raw':!![]};return db[_0xbd67('0x46')][_0xbd67('0x60')](_0xf217b5)[_0xbd67('0x19')](handleEntityNotFound(_0x507069,null))[_0xbd67('0x19')](function(_0x4b920a){if(_0x4b920a){if(!_[_0xbd67('0x89')](_0x4b920a['agentAvatar'])){if(fs['existsSync'](path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0x8f'),_0x4b920a[_0xbd67('0x7f')]))){_0x1b1487=path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0x8f'),_0x4b920a['agentAvatar']);}}return _0x507069[_0xbd67('0x90')](_0x1b1487);}})['catch'](handleError(_0x507069,null));};exports[_0xbd67('0x91')]=function(_0x377294,_0x565d81){var _0xf09269=path[_0xbd67('0x85')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x495715={'where':{'id':_0x377294['params']['id']},'attributes':['id','customerAvatar',_0xbd67('0x92')],'raw':!![]};return db[_0xbd67('0x46')][_0xbd67('0x60')](_0x495715)['then'](handleEntityNotFound(_0x565d81,null))[_0xbd67('0x19')](function(_0x1d3dbb){if(_0x1d3dbb){if(!_[_0xbd67('0x89')](_0x1d3dbb[_0xbd67('0x80')])){if(fs['existsSync'](path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0x8f'),_0x1d3dbb['customerAvatar']))&&_0x1d3dbb[_0xbd67('0x92')]){_0xf09269=path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0x8f'),_0x1d3dbb[_0xbd67('0x80')]);}}return _0x565d81['download'](_0xf09269);}})['catch'](handleError(_0x565d81,null));};exports[_0xbd67('0x93')]=function(_0x59cc74,_0x5602fa){var _0x55cd50=path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0x94'));var _0x122b2b={'where':{'id':_0x59cc74[_0xbd67('0x6e')]['id']},'attributes':['id',_0xbd67('0x83')],'raw':!![]};return db[_0xbd67('0x46')][_0xbd67('0x60')](_0x122b2b)['then'](handleEntityNotFound(_0x5602fa,null))[_0xbd67('0x19')](function(_0x3769a1){if(_0x3769a1){if(!_[_0xbd67('0x89')](_0x3769a1[_0xbd67('0x83')])){if(fs[_0xbd67('0x8a')](path[_0xbd67('0x85')](config[_0xbd67('0x8b')],'server/files/images/avatars/',_0x3769a1[_0xbd67('0x83')]))){_0x55cd50=path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0x8f'),_0x3769a1['systemAvatar']);}}return _0x5602fa['download'](_0x55cd50);}})[_0xbd67('0x22')](handleError(_0x5602fa,null));};function checkWebsiteInterval(_0x1edbb4){var _0x312688=_0x1edbb4[_0xbd67('0x95')];if(!_0x312688){return Promise['resolve'](_0x1edbb4);}var _0xddd75d=_0x1edbb4['timezone']||undefined;return _0x312688[_0xbd67('0x96')](_0xddd75d)['then'](function(_0x39416a){if(!_0x39416a){throw new APIOutOfIntervalError();}return _0x1edbb4;});}exports[_0xbd67('0x97')]=function(_0x467097,_0x16e253){var _0x4f81e3={'body':_0x467097[_0xbd67('0x67')],'channel':_0xbd67('0x98')};var _0x13d94c=[];var _0x3b306a=[];var _0x31d2ca={};var _0x103761=![];if(_0x467097[_0xbd67('0x67')]['id']){delete _0x467097[_0xbd67('0x67')]['id'];}if(_[_0xbd67('0x89')](_0x467097[_0xbd67('0x67')][_0xbd67('0x99')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xbd67('0x89')](_0x467097[_0xbd67('0x67')][_0xbd67('0x9a')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xbd67('0x9b')](_0x467097[_0xbd67('0x67')][_0xbd67('0x67')])){throw new APIBadRequestError(_0xbd67('0x9c'));}var _0x3b6778=_0x467097[_0xbd67('0x67')][_0xbd67('0x34')]&&_0x467097['body'][_0xbd67('0x38')];return db[_0xbd67('0x9d')][_0xbd67('0x70')]()['then'](function(_0x4556ac){if(!_0x4556ac){throw new Error(_0xbd67('0x9e'));}_0x13d94c=Object[_0xbd67('0x4b')](_0x4556ac)[_0xbd67('0x56')](function(_0x253e6b){return!['createdAt',_0xbd67('0x9f')]['includes'](_0x253e6b);});_0x3b306a=Object[_0xbd67('0x4b')](_0x4556ac)[_0xbd67('0x56')](function(_0x3f45de){return![_0xbd67('0xa0'),'updatedAt',_0xbd67('0xa1'),_0xbd67('0xa2')][_0xbd67('0xa3')](_0x3f45de);});if(!_[_0xbd67('0xa3')](_0x3b306a,_0x467097[_0xbd67('0x67')][_0xbd67('0x9a')])){throw new APIBadRequestError(_0xbd67('0xa4')+_0x3b306a[_0xbd67('0x85')](',\x20'));}_0x31d2ca[_0x467097[_0xbd67('0x67')]['mapKey']]=_0x467097[_0xbd67('0x67')][_0xbd67('0x99')];})[_0xbd67('0x19')](function(){return db[_0xbd67('0x46')]['find']({'where':{'id':_0x467097[_0xbd67('0x6e')]['id']},'include':[{'model':db[_0xbd67('0xa5')],'as':_0xbd67('0xa6'),'include':[{'model':db[_0xbd67('0x9d')],'as':'Contacts','where':_0x31d2ca,'limit':0x1,'order':[[_0xbd67('0x9f'),_0xbd67('0xa7')]]}]},{'model':db[_0xbd67('0xa8')],'as':_0xbd67('0xa9')},{'model':db['Interval'],'as':_0xbd67('0x95'),'include':[{'model':db[_0xbd67('0x95')],'as':_0xbd67('0xaa'),'attributes':['id',_0xbd67('0xab')],'raw':!![]}]}]});})[_0xbd67('0x19')](function(_0x2275c3){if(!_0x2275c3){throw new APINotFoundError(util[_0xbd67('0x3a')](_0xbd67('0xac'),_0x467097['params']['id']));}if(_0x3b6778){return checkWebsiteInterval(_0x2275c3);}return _0x2275c3;})[_0xbd67('0x19')](function(_0x183c70){_0x4f81e3[_0xbd67('0xad')]=_0x183c70;_0x4f81e3[_0xbd67('0xae')]=_['orderBy'](_0x183c70[_0xbd67('0xa9')],[_0xbd67('0xaf')],['asc']);if(_0x4f81e3[_0xbd67('0xad')][_0xbd67('0xa9')]){delete _0x4f81e3[_0xbd67('0xad')][_0xbd67('0xa9')];}_0x4f81e3[_0xbd67('0xb0')]=_0x183c70[_0xbd67('0xa6')]||{'id':_0x183c70['ListId']};if(_0x4f81e3[_0xbd67('0xb0')]&&_0x4f81e3[_0xbd67('0xb0')]['Contacts'][_0xbd67('0x50')]){return _0x4f81e3[_0xbd67('0xb0')][_0xbd67('0xb1')][0x0];}var _0x26e164=_['defaults'](_0x467097[_0xbd67('0x67')],{'firstName':_0x467097[_0xbd67('0x67')][_0xbd67('0x99')],'ListId':_0x183c70[_0xbd67('0xa2')]});_0x26e164[_0x467097[_0xbd67('0x67')][_0xbd67('0x9a')]]=_0x467097[_0xbd67('0x67')][_0xbd67('0x99')];return db[_0xbd67('0x9d')][_0xbd67('0x61')](_0x26e164,{'fields':_0x13d94c,'raw':!![]});})['then'](function(_0x11e981){_0x4f81e3['contact']=_0x11e981;var _0x3ef428=createInteractionObject(_0x467097[_0xbd67('0x6e')]['id'],_0x467097[_0xbd67('0x67')],_0x467097[_0xbd67('0xb2')],_0x11e981);var _0x54f1cd={'ChatWebsiteId':_0x467097[_0xbd67('0x6e')]['id']};if(_0x467097[_0xbd67('0x67')][_0xbd67('0xb3')]){_0x54f1cd['threadId']=_0x467097[_0xbd67('0x67')][_0xbd67('0xb3')];_0x54f1cd['closed']=![];return db[_0xbd67('0xb4')]['find']({'where':_0x54f1cd})[_0xbd67('0x19')](function(_0x4c02ee){var _0x5b0386=_0x467097['body'][_0xbd67('0x34')]&&_0x467097[_0xbd67('0x67')]['referer'];if(_0x4c02ee){_0x103761=!![];return _0x4c02ee;}else if(!_0x5b0386&&_0x4c02ee&&_0x4c02ee[_0xbd67('0xb5')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x3ef428['threadId']=_0x467097[_0xbd67('0x67')][_0xbd67('0xb3')];_0x3ef428[_0xbd67('0xb6')]=_0x467097[_0xbd67('0x67')][_0xbd67('0xb6')];return db[_0xbd67('0xb4')][_0xbd67('0x61')](_0x3ef428);});}_0x54f1cd['ContactId']=_0x11e981['id'];if(_0x467097[_0xbd67('0x67')][_0xbd67('0xb7')]&&_0x467097['body']['interaction']['id']){_0x54f1cd['id']=_0x467097[_0xbd67('0x67')][_0xbd67('0xb7')]['id'];return db[_0xbd67('0xb4')][_0xbd67('0x60')]({'where':_0x54f1cd})['then'](function(_0x552ac5){var _0x3630ab=_0x467097['body'][_0xbd67('0x34')]&&_0x467097[_0xbd67('0x67')][_0xbd67('0x38')];if(!_0x3630ab&&_0x552ac5&&_0x552ac5['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x552ac5){_0x103761=!![];return _0x552ac5;}else{return db[_0xbd67('0xb4')][_0xbd67('0x61')](_0x3ef428);}});}return db['ChatInteraction'][_0xbd67('0x61')](_0x3ef428);})[_0xbd67('0x19')](function(_0x540ae3){if(!_0x103761){return _0x540ae3;}var _0x2af116={'from':(_0x4f81e3[_0xbd67('0xb8')][_0xbd67('0xb9')]||'')+'\x20'+(_0x4f81e3[_0xbd67('0xb8')]['lastName']||'')};if(_0x467097[_0xbd67('0x67')]['threadId']&&_0x467097[_0xbd67('0x67')]['messageId']&&_0x467097['body'][_0xbd67('0xb3')]!=_0x467097[_0xbd67('0x67')][_0xbd67('0xba')]){_0x2af116[_0xbd67('0xb3')]=_0x467097['body']['messageId'];}return _0x540ae3['update'](_0x2af116);})[_0xbd67('0x19')](function(_0x2ed8bc){_0x4f81e3[_0xbd67('0xb7')]=_0x2ed8bc[_0xbd67('0x69')]({'plain':!![]});_0x4f81e3[_0xbd67('0xb7')][_0xbd67('0xbb')]=!_0x103761;if(_0x4f81e3[_0xbd67('0xb7')]['created']){if(_0x4f81e3['account']['autoclose']){_0x4f81e3[_0xbd67('0xae')]['push']({'id':0x0,'priority':_0x4f81e3['applications'][_0xbd67('0x50')]+0x1,'app':'close','appdata':_0xbd67('0xbc'),'interval':_0xbd67('0xbd')});}}return db[_0xbd67('0xbe')]['create']({'body':_0x467097[_0xbd67('0x67')][_0xbd67('0x67')],'ChatWebsiteId':_0x467097[_0xbd67('0x6e')]['id'],'ChatInteractionId':_0x2ed8bc['id'],'direction':'in','ContactId':_0x4f81e3[_0xbd67('0xb8')]['id'],'AttachmentId':_0x467097[_0xbd67('0x67')]['AttachmentId']});})[_0xbd67('0x19')](function(_0x2bd260){_0x4f81e3['message']=_0x2bd260;if(!_0x4f81e3[_0xbd67('0xb7')][_0xbd67('0xbf')]){return;}return db[_0xbd67('0xc0')][_0xbd67('0x60')]({'attributes':['id',_0xbd67('0x30')],'where':{'id':_0x4f81e3[_0xbd67('0xb7')][_0xbd67('0xbf')]}});})[_0xbd67('0x19')](function(_0x47f92e){if(_0x47f92e){_0x4f81e3['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xbd67('0xc1'),'appdata':_0x47f92e[_0xbd67('0x30')]+','+(_0x4f81e3[_0xbd67('0xad')][_0xbd67('0xc2')]||0xa),'interval':'*,*,*,*'});_0x4f81e3[_0xbd67('0xc3')]=!![];}if(!_0x4f81e3[_0xbd67('0xb7')][_0xbd67('0xc4')]){return;}return db[_0xbd67('0xc5')][_0xbd67('0x60')]({'attributes':['id','name'],'where':{'id':_0x4f81e3[_0xbd67('0xb7')][_0xbd67('0xc4')]}});})['then'](function(_0x4454c8){if(_0x4454c8){_0x4f81e3['applications'][_0xbd67('0xc6')]({'id':0x0,'priority':0x1,'app':_0xbd67('0xc7'),'appdata':_0x4454c8['name']+','+(_0x4f81e3[_0xbd67('0xad')]['waitForTheAssignedQueue']||0x12c),'interval':_0xbd67('0xbd')});}return respondWithRpcPromise(_0xbd67('0xc8'),_0xbd67('0xc9'),_0x4f81e3);})[_0xbd67('0x19')](function(_0xda3ad6){respondWithRpcPromise(_0xbd67('0xca'),_0xbd67('0xca'),{'event':_0xbd67('0x97'),'message':_0xda3ad6},client9002);return _0xda3ad6;})[_0xbd67('0x19')](respondWithResult(_0x16e253,null))[_0xbd67('0x22')](APIHandleError(_0x16e253));};exports['offline']=function(_0x3974c6,_0x403d92){var _0x5a6e05,_0x547fed,_0x12e26b;var _0x177b81=[];var _0x57dc69={};var _0xd5a7af=_0x3974c6[_0xbd67('0xcb')]||[];var _0x5d3bb9=[];var _0x10f352;return db['CmContact'][_0xbd67('0x70')]()[_0xbd67('0x19')](function(_0x31e47a){if(!_0x31e47a){throw new db[(_0xbd67('0xcc'))]['ValidationError'](_0xbd67('0xcd'));}_0x177b81=_[_0xbd67('0xce')](_[_0xbd67('0x4b')](_0x31e47a),[_0xbd67('0xa0'),_0xbd67('0x9f'),_0xbd67('0xa1'),_0xbd67('0xa2')]);if(_0x3974c6[_0xbd67('0x67')]['id']){delete _0x3974c6['body']['id'];}if(_[_0xbd67('0x89')](_0x3974c6['body'][_0xbd67('0x99')])){throw _0x403d92[_0xbd67('0x25')](0x1f4)[_0xbd67('0x31')](new db[(_0xbd67('0xcc'))][(_0xbd67('0xcf'))](_0xbd67('0xd0')));}if(_[_0xbd67('0x89')](_0x3974c6[_0xbd67('0x67')][_0xbd67('0x67')])||_0x3974c6[_0xbd67('0x67')][_0xbd67('0x67')]===''){throw _0x403d92[_0xbd67('0x25')](0x1f4)[_0xbd67('0x31')](new db[(_0xbd67('0xcc'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x3974c6['body'][_0xbd67('0xd1')])){throw _0x403d92[_0xbd67('0x25')](0x1f4)[_0xbd67('0x31')](new db[(_0xbd67('0xcc'))]['ValidationError'](_0xbd67('0xd2')+_0x177b81));}if(!_[_0xbd67('0xa3')](_0x177b81,_0x3974c6[_0xbd67('0x67')][_0xbd67('0xd1')])){throw _0x403d92['status'](0x1f4)[_0xbd67('0x31')](new db['Sequelize']['ValidationError'](_0xbd67('0xd3')+_0x177b81));}_0x57dc69[_0x3974c6[_0xbd67('0x67')][_0xbd67('0xd1')]]=_0x3974c6[_0xbd67('0x67')]['from'];})[_0xbd67('0x19')](function(){return db['ChatWebsite'][_0xbd67('0x60')]({'where':{'id':_0x3974c6[_0xbd67('0x6e')]['id']},'include':[{'model':db[_0xbd67('0xa5')],'as':_0xbd67('0xa6')},{'model':db[_0xbd67('0xd4')],'as':'MailAccount'}]});})[_0xbd67('0x19')](handleEntityNotFound(_0x403d92,null))[_0xbd67('0x19')](function(_0x5dfa85){if(_0x5dfa85&&_0x5dfa85['List']){_0x547fed=_0x5dfa85;var _0x57d776=_[_0xbd67('0x11')](_0x3974c6[_0xbd67('0x67')],{'firstName':_0x3974c6[_0xbd67('0x67')]['from'],'phone':_0x3974c6[_0xbd67('0x67')]['from'],'ListId':_0x5dfa85[_0xbd67('0xa2')]});_0x57d776[_0x3974c6['body']['mapKeyOffline']]=_0x3974c6[_0xbd67('0x67')]['from'];return db['CmContact']['findOrCreate']({'where':_0x57dc69,'defaults':_0x57d776});}})[_0xbd67('0xd5')](function(_0x31d30b){if(_0x31d30b){_0x12e26b=_0x31d30b;var _0x1f2eff=fs['readFileSync'](path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0xd6')),_0xbd67('0xd7'));var _0x548dc9=ejs[_0xbd67('0xd8')](_0x1f2eff,{'body':_['toPairs'](_0x3974c6[_0xbd67('0x67')][_0xbd67('0x67')]),'bodyTitle':_0x547fed[_0xbd67('0xd9')]});return db['ChatOfflineMessage'][_0xbd67('0x61')]({'body':_0x548dc9,'plainBody':htmlToText[_0xbd67('0xda')](_0x548dc9),'ContactId':_0x31d30b['id'],'ChatWebsiteId':_0x547fed['id']});}})[_0xbd67('0x19')](function(_0x15f829){_0x10f352=_0x15f829;if(_0xd5a7af[_0xbd67('0x50')]){var _0x2d3dd7=_0xd5a7af[_0xbd67('0x45')](function(_0x36a3a3){return{'name':_0x36a3a3['originalname'],'basename':_0x36a3a3['filename'],'type':_0x36a3a3[_0xbd67('0xdb')],'ChatOfflineMessageId':_0x15f829['id']};});_0x5d3bb9=_0x2d3dd7[_0xbd67('0x45')](_0x15d4c9=>{var _0x364ca1={'filename':_0x15d4c9[_0xbd67('0x30')],'path':path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0xdc'),_0xbd67('0xcb'),_0xbd67('0xdd'),'offline-chat',_0x15d4c9[_0xbd67('0xde')])};return _0x364ca1;});if(!_0x547fed[_0xbd67('0xdf')]){return db[_0xbd67('0xe0')][_0xbd67('0xe1')](function(_0x4a5659){return db['Attachment'][_0xbd67('0xe2')](_0x2d3dd7,{'transaction':_0x4a5659});});}}})[_0xbd67('0x19')](function(){if(_0x10f352){_0x5a6e05=_0x10f352;return db[_0xbd67('0xd4')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xbd67('0xe3')],'as':_0xbd67('0xe4'),'raw':!![],'include':[{'model':db[_0xbd67('0xe5')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x2a43a3){if(_0x2a43a3&&_0x2a43a3[_0xbd67('0xe4')]&&_0x547fed[_0xbd67('0xe6')]&&_0x547fed[_0xbd67('0xe7')]){var _0x22de27=_0x2a43a3['getSmtpOptions']();return respondWithRpcPromise(_0xbd67('0xe8'),_0xbd67('0xe9'),{'account':_0x22de27,'message':{'from':util[_0xbd67('0x3a')](_0xbd67('0xea'),_0x2a43a3['name'],_0x2a43a3[_0xbd67('0xeb')]||_0x2a43a3['Smtp'][_0xbd67('0x68')]),'to':_0x547fed[_0xbd67('0xe7')],'subject':_0x547fed[_0xbd67('0xec')],'html':_0x5a6e05[_0xbd67('0x67')],'attachments':_0x5d3bb9}},client9003)['then'](function(){return _0x5a6e05;})[_0xbd67('0x22')](function(_0x4e9460){logger['error'](_0x4e9460);});}})[_0xbd67('0x19')](function(){if(_0x547fed&&_0x547fed[_0xbd67('0xdf')]&&_0x547fed[_0xbd67('0xed')]){var _0xe18d41=[];if(_0xd5a7af[_0xbd67('0x50')]){_0xe18d41=_0xd5a7af['map'](function(_0x5d9e2e){return{'name':_0x5d9e2e[_0xbd67('0xee')],'basename':_0x5d9e2e[_0xbd67('0x81')],'type':_0x5d9e2e[_0xbd67('0xdb')],'ChatOfflineMessageId':_0x10f352['id']};});}var _0x273f05;if(!_[_0xbd67('0x89')](_0x547fed[_0xbd67('0xef')])){var _0x352eb7=_[_0xbd67('0x45')](_0x3974c6[_0xbd67('0x67')],function(_0xdb1667){return _0xdb1667;});var _0x48c319=_['toPairsIn'](_0x352eb7)[0x0];var _0x4fe10d=_[_0xbd67('0xf0')](_0x48c319,function(_0x31b67e){return _0x31b67e;});_0x273f05=_0x4fe10d[0x1][_0x547fed[_0xbd67('0xef')]];}var _0x2fef35={'from':_0x12e26b['email'],'firstName':_0x12e26b[_0xbd67('0xb9')],'lastName':_0x12e26b[_0xbd67('0xf1')],'mapKey':'email','message':{'from':_0x12e26b[_0xbd67('0xeb')],'to':_0x547fed[_0xbd67('0xd4')]['email'],'cc':'','subject':_[_0xbd67('0x89')](_0x273f05)?_0x547fed['offlineMessageSubject']:_0x273f05,'messageId':'','sentAt':new Date(),'attach':_0xe18d41[_0xbd67('0x50')],'attachments':_0xe18d41,'originChannel':_0xbd67('0xf2'),'ChatWebsiteId':_0x547fed['id'],'ChatOfflineMessageId':_0x5a6e05['id'],'originTo':_0x547fed['MailAccount'][_0xbd67('0xeb')]},'body':_0x5a6e05[_0xbd67('0x67')]};var _0x3f9ef6={'account':{'id':_0x547fed[_0xbd67('0xed')]},'body':_0x2fef35,'log':_0xbd67('0xf3')};return respondWithRpcPromise(_0xbd67('0xf3'),'notifyMail',_0x3f9ef6,client9001)[_0xbd67('0x19')](function(){return _0x5a6e05;})['catch'](function(_0x2858c1){logger['error'](_0x2858c1);});}return;})[_0xbd67('0x19')](function(){if(_0x5a6e05){return _0x5a6e05;}})[_0xbd67('0x19')](respondWithResult(_0x403d92,null))[_0xbd67('0x22')](function(){for(var _0x630e1a of _0xd5a7af){var _0x3462ce=path['join'](config[_0xbd67('0x8b')],'server',_0xbd67('0xcb'),_0xbd67('0xdd'),'offline-chat',_0x630e1a[_0xbd67('0x81')]);fs_extra[_0xbd67('0xf4')](_0x3462ce)[_0xbd67('0x22')](function(_0x140a64){logger[_0xbd67('0x1d')](_0xbd67('0xf5'),_0x3462ce,_0x140a64);});}});};exports[_0xbd67('0xf6')]=function(_0xa5351d,_0x216cc2){return db[_0xbd67('0xb4')][_0xbd67('0x60')]({'where':{'id':_0xa5351d[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x216cc2,null))['then'](function(_0x5115f0){if(_0x5115f0){return _0x5115f0[_0xbd67('0xf6')](_0xa5351d[_0xbd67('0x67')][_0xbd67('0x7b')],_[_0xbd67('0xf7')](_0xa5351d['body'],['ids','id'])||{});}})[_0xbd67('0x19')](respondWithResult(_0x216cc2,null))[_0xbd67('0x22')](handleError(_0x216cc2,null));};exports['getInteractions']=function(_0x63f6d7,_0x11d39a){var _0x272a3d={'raw':![],'where':{}};var _0x41f730={};var _0x47d41d={'count':0x0,'rows':[]};return db[_0xbd67('0x46')]['findOne']({'where':{'id':_0x63f6d7['params']['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x11d39a,null))['then'](function(_0x2b466a){if(_0x2b466a){_0x41f730[_0xbd67('0x3f')]=_[_0xbd67('0x4b')](db[_0xbd67('0xb4')][_0xbd67('0x47')]);_0x41f730[_0xbd67('0x4a')]=_[_0xbd67('0x4b')](_0x63f6d7[_0xbd67('0x4a')]);_0x41f730[_0xbd67('0x4c')]=_['intersection'](_0x41f730[_0xbd67('0x3f')],_0x41f730[_0xbd67('0x4a')]);_0x272a3d[_0xbd67('0x4d')]=_['intersection'](_0x41f730[_0xbd67('0x3f')],qs[_0xbd67('0x4f')](_0x63f6d7['query']['fields']));_0x272a3d[_0xbd67('0x4d')]=_0x272a3d[_0xbd67('0x4d')][_0xbd67('0x50')]?_0x272a3d[_0xbd67('0x4d')]:_0x41f730['model'];if(!_0x63f6d7[_0xbd67('0x4a')][_0xbd67('0x51')](_0xbd67('0x52'))){_0x272a3d[_0xbd67('0x29')]=qs[_0xbd67('0x29')](_0x63f6d7[_0xbd67('0x4a')][_0xbd67('0x29')]);_0x272a3d[_0xbd67('0x27')]=qs[_0xbd67('0x27')](_0x63f6d7[_0xbd67('0x4a')][_0xbd67('0x27')]);}_0x272a3d[_0xbd67('0x76')]=qs['sort'](_0x63f6d7[_0xbd67('0x4a')]['sort']);_0x272a3d[_0xbd67('0x54')]=qs[_0xbd67('0x4c')](_['pick'](_0x63f6d7[_0xbd67('0x4a')],_0x41f730[_0xbd67('0x4c')]));_0x272a3d[_0xbd67('0x54')][_0xbd67('0x72')]=_0x2b466a['id'];if(_0x63f6d7['query'][_0xbd67('0x56')]){_0x272a3d['where']=_[_0xbd67('0x58')](_0x272a3d[_0xbd67('0x54')],{'$or':_[_0xbd67('0x45')](_0x272a3d[_0xbd67('0x4d')],function(_0x574603){var _0x4d4364={};_0x4d4364[_0x574603]={'$like':'%'+_0x63f6d7[_0xbd67('0x4a')][_0xbd67('0x56')]+'%'};return _0x4d4364;})});}_0x272a3d=_[_0xbd67('0x58')]({},_0x272a3d,_0x63f6d7[_0xbd67('0x5f')]);return db[_0xbd67('0xb4')]['count']({'where':_0x272a3d[_0xbd67('0x54')]})['then'](function(_0x2108ef){_0x47d41d['count']=_0x2108ef;if(_0x63f6d7['query']['includeAll']){_0x272a3d['include']=[{'model':db[_0xbd67('0x9d')],'as':_0xbd67('0xf8'),'required':![]},{'model':db[_0xbd67('0xc0')],'as':_0xbd67('0xf9'),'attributes':[_0xbd67('0x30'),_0xbd67('0xfa'),'internal'],'required':![]},{'model':db[_0xbd67('0xfb')],'as':'Tags','attributes':['id','name','color'],'where':_0x63f6d7[_0xbd67('0x4a')][_0xbd67('0xfc')]?{'id':_0x63f6d7[_0xbd67('0x4a')][_0xbd67('0xfc')]}:undefined,'required':_0x63f6d7[_0xbd67('0x4a')][_0xbd67('0xfc')]?!![]:![]}];}return db['ChatInteraction'][_0xbd67('0x5b')](_0x272a3d);})[_0xbd67('0x19')](function(_0xca05a7){_0x47d41d['rows']=_0xca05a7;return _0x47d41d;});}})[_0xbd67('0x19')](respondWithFilteredResult(_0x11d39a,_0x272a3d))[_0xbd67('0x22')](handleError(_0x11d39a,null));};exports['getSnippet']=function(_0x29e7b8,_0x52bf34){var _0x4b45a4=0x0;var _0x454f75=0x0;var _0x2da38c=![];var _0x3e2a37;var _0x1409c3;return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0x29e7b8[_0xbd67('0x6e')]['id']},'include':[{'model':db[_0xbd67('0x95')],'as':_0xbd67('0x95'),'include':[{'model':db[_0xbd67('0x95')],'as':_0xbd67('0xaa'),'attributes':['id',_0xbd67('0xab')]}]}]})[_0xbd67('0x19')](handleEntityNotFound(_0x52bf34,null))[_0xbd67('0x19')](function(_0x2840c0){if(_0x2840c0){_0x3e2a37=_0x2840c0;return _0x2840c0[_0xbd67('0xfd')]({'raw':!![]});}})['then'](function(_0x32520f){if(_0x3e2a37){if(_0x32520f){_0x1409c3=_0x32520f;}}return require(_0xbd67('0x87'))[_0xbd67('0x88')]();})[_0xbd67('0x19')](function(_0x24157f){if(_0x24157f){_0x454f75=_0x24157f[_0xbd67('0xfe')];_0x2da38c=_0x24157f[_0xbd67('0xff')];}})['then'](function(){return db[_0xbd67('0xb4')][_0xbd67('0x2a')]({'where':{'closed':![]}});})[_0xbd67('0x19')](function(_0x125cdc){_0x4b45a4=_0x125cdc;if(_0x454f75&&_0x125cdc>_0x454f75){return db[_0xbd67('0x100')][_0xbd67('0x75')]({'where':{'id':0x1}})['then'](function(_0x8be79c){if(_0x8be79c){_0x8be79c[_0xbd67('0x101')]('chatLicenseExceeded');}});}})[_0xbd67('0x19')](function(){var _0x91eb6=_0x3e2a37[_0xbd67('0x95')];var _0x3da179=_0x3e2a37[_0xbd67('0x102')]||undefined;return _0x91eb6?_0x91eb6[_0xbd67('0x96')](_0x3da179):!![];})['then'](function(_0x5d214b){var _0x575cc3=fs[_0xbd67('0x103')](path[_0xbd67('0x85')](config[_0xbd67('0x8b')],_0xbd67('0x104')),_0xbd67('0xd7'));var _0x5cfe0e=_0xbd67('0x105');var _0x2de7ba=![];var _0x26e541,_0xefa144;if(_0x29e7b8[_0xbd67('0xb2')][_0xbd67('0x38')]){_0x26e541=new URL(_0x29e7b8[_0xbd67('0xb2')][_0xbd67('0x38')])[_0xbd67('0x106')];}else if(_0x29e7b8['headers'][_0xbd67('0x106')]){_0x26e541=new URL(_0x29e7b8[_0xbd67('0xb2')]['origin'])[_0xbd67('0x106')];}else{_0x26e541=_0xbd67('0x107');}_0xefa144=typeof _0x3e2a37['address'][_0xbd67('0x63')](',')[_0xbd67('0x60')](function(_0x22abea){return wildcardUtils[_0xbd67('0x108')](_0x22abea,_0x26e541);})!==_0xbd67('0x28');var _0x452d22={'chatVersion':_0x5cfe0e,'chatWebsiteAddressOrigin':_0xefa144?_0x26e541:_0x3e2a37['address'],'remote':_0x3e2a37['remote'],'query':querystring[_0xbd67('0x43')](_['merge'](_0x3e2a37[_0xbd67('0x69')]({'plain':!![]}),{'customerIp':_0x29e7b8[_0xbd67('0xb2')]['x-forwarded-for']||_0x29e7b8['headers'][_0xbd67('0x109')]||_0x29e7b8[_0xbd67('0x10a')][_0xbd67('0x10b')]||_0x29e7b8['ip'],'referer':_0x29e7b8[_0xbd67('0xb2')][_0xbd67('0x38')],'openedInteractions':_0x4b45a4,'maxInteractions':_0x454f75,'virtual':_0x2da38c[_0xbd67('0xfe')],'online':_0x5d214b,'custom':_0x2da38c,'address':_0xefa144?_0x26e541:null}))[_0xbd67('0x10c')](/'/g,'\x5c\x27')};_0x52bf34[_0xbd67('0x31')](ejs[_0xbd67('0xd8')](Mustache[_0xbd67('0xd8')](_0x575cc3,_0x452d22),{'proactiveActions':_0x1409c3,'alignment':_0x3e2a37['alignment'],'verticalAlignment':_0x3e2a37[_0xbd67('0x10d')],'div_color':_0x3e2a37[_0xbd67('0x10e')],'labelText':_0x3e2a37[_0xbd67('0x10f')],'text_color':_0x3e2a37[_0xbd67('0x110')],'text_button_color':_0x3e2a37['textButtonColor'],'button_color':_0x3e2a37['color_button'],'background_color':_0x3e2a37['backgroundColor'],'hideWhenOffline':_0x3e2a37['hideWhenOffline'],'intervalId':_0x3e2a37['IntervalId'],'isDevelopment':_0x2de7ba,'chatVersion':_0x5cfe0e}));})[_0xbd67('0x22')](handleError(_0x52bf34,null));};exports[_0xbd67('0x111')]=function(_0x117f2a,_0x2a89db){var _0x57175c=_0x117f2a[_0xbd67('0x6e')]['id'];var _0x4633d9=_0x117f2a['body'];var _0x5341a9=0xc8;var _0x3e10fc=null;return db[_0xbd67('0xe0')][_0xbd67('0xe1')]({'isolationLevel':db[_0xbd67('0xe0')]['Transaction'][_0xbd67('0x112')]['READ_COMMITTED']},function(_0x4b98ab){return db[_0xbd67('0x46')][_0xbd67('0x75')]({'where':{'id':_0x57175c},'transaction':_0x4b98ab})[_0xbd67('0x19')](function(_0x2b9c38){if(_0x2b9c38){return db[_0xbd67('0xa8')]['destroy']({'where':{'ChatWebsiteId':_0x57175c},'transaction':_0x4b98ab})[_0xbd67('0x19')](function(){var _0x41b150=_[_0xbd67('0x45')](_0x4633d9,function(_0x5c8c94){_0x5c8c94['ChatWebsiteId']=_0x57175c;return _0x5c8c94;});return db['ChatApplication'][_0xbd67('0xe2')](_0x41b150,{'transaction':_0x4b98ab});});}else{_0x5341a9=0x194;_0x3e10fc=[];}});})[_0xbd67('0x19')](function(){if(_0x5341a9!==0x194){return db['ChatApplication'][_0xbd67('0x113')]({'where':{'ChatWebsiteId':_0x57175c},'order':'priority'})[_0xbd67('0x19')](function(_0x468dd6){_0x3e10fc=_0x468dd6;});}})[_0xbd67('0x22')](function(_0x24856e){_0x5341a9=0x1f4;logger['error'](_0x24856e[_0xbd67('0x114')]);if(_0x24856e[_0xbd67('0x30')]){delete _0x24856e['name'];}_0x3e10fc=_0x24856e;})[_0xbd67('0x115')](function(){if(_0x3e10fc===null){_0x2a89db['sendStatus'](_0x5341a9);}else{if(_0x5341a9===0x1f4){_0x2a89db[_0xbd67('0x25')](_0x5341a9)[_0xbd67('0x31')](_0x3e10fc);}else{_0x2a89db[_0xbd67('0x25')](_0x5341a9)[_0xbd67('0x26')](_0x3e10fc);}}});};exports[_0xbd67('0x116')]=function(_0x1bde63,_0x51172e){var _0xd05cfc={};var _0x2b2334={};var _0x56701c;var _0x1dfbda;return db['ChatWebsite'][_0xbd67('0x75')]({'where':{'id':_0x1bde63['params']['id']}})['then'](handleEntityNotFound(_0x51172e,null))[_0xbd67('0x19')](function(_0x26105b){if(_0x26105b){_0x56701c=_0x26105b;_0x2b2334[_0xbd67('0x3f')]=_[_0xbd67('0x4b')](db[_0xbd67('0xa8')][_0xbd67('0x47')]);_0x2b2334['query']=_['keys'](_0x1bde63[_0xbd67('0x4a')]);_0x2b2334[_0xbd67('0x4c')]=_[_0xbd67('0x4e')](_0x2b2334[_0xbd67('0x3f')],_0x2b2334[_0xbd67('0x4a')]);_0xd05cfc[_0xbd67('0x4d')]=_[_0xbd67('0x4e')](_0x2b2334[_0xbd67('0x3f')],qs[_0xbd67('0x4f')](_0x1bde63[_0xbd67('0x4a')][_0xbd67('0x4f')]));_0xd05cfc[_0xbd67('0x4d')]=_0xd05cfc[_0xbd67('0x4d')]['length']?_0xd05cfc[_0xbd67('0x4d')]:_0x2b2334[_0xbd67('0x3f')];_0xd05cfc['order']=qs[_0xbd67('0x53')](_0x1bde63['query'][_0xbd67('0x53')]);_0xd05cfc[_0xbd67('0x54')]=qs[_0xbd67('0x4c')](_['pick'](_0x1bde63[_0xbd67('0x4a')],_0x2b2334['filters']));if(_0x1bde63['query']['filter']){_0xd05cfc[_0xbd67('0x54')]=_[_0xbd67('0x58')](_0xd05cfc[_0xbd67('0x54')],{'$or':_[_0xbd67('0x45')](_0xd05cfc[_0xbd67('0x4d')],function(_0x87138b){var _0x22dfbb={};_0x22dfbb[_0x87138b]={'$like':'%'+_0x1bde63['query'][_0xbd67('0x56')]+'%'};return _0x22dfbb;})});}_0xd05cfc=_[_0xbd67('0x58')]({},_0xd05cfc,_0x1bde63[_0xbd67('0x5f')]);return _0x56701c['getApplications'](_0xd05cfc);}})[_0xbd67('0x19')](function(_0x5b3fbb){if(_0x5b3fbb){_0x1dfbda=_0x5b3fbb[_0xbd67('0x50')];if(!_0x1bde63[_0xbd67('0x4a')][_0xbd67('0x51')](_0xbd67('0x52'))){_0xd05cfc['limit']=qs['limit'](_0x1bde63['query'][_0xbd67('0x29')]);_0xd05cfc['offset']=qs[_0xbd67('0x27')](_0x1bde63[_0xbd67('0x4a')][_0xbd67('0x27')]);}return _0x56701c['getApplications'](_0xd05cfc);}})[_0xbd67('0x19')](function(_0x2c1c71){if(_0x2c1c71){return _0x2c1c71?{'count':_0x1dfbda,'rows':_0x2c1c71}:null;}})[_0xbd67('0x19')](respondWithResult(_0x51172e,null))[_0xbd67('0x22')](handleError(_0x51172e,null));};exports[_0xbd67('0x117')]=function(_0x1197bc,_0x19f2cc){return db['chatProactiveAction']['find']({'where':{'id':_0x1197bc['params']['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x19f2cc,null))['then'](function(_0x387a3e){if(_0x387a3e){return _0x387a3e[_0xbd67('0x117')](_0x1197bc['body'][_0xbd67('0x7b')],_[_0xbd67('0xf7')](_0x1197bc[_0xbd67('0x67')],[_0xbd67('0x7b'),'id'])||{});}})[_0xbd67('0x19')](respondWithResult(_0x19f2cc,null))[_0xbd67('0x22')](handleError(_0x19f2cc,null));};exports[_0xbd67('0xfd')]=function(_0xc8c1c7,_0x1fef67){var _0x1b0d41={};var _0xb67821={};var _0x4b9690;var _0x33e37e;return db[_0xbd67('0x46')]['findOne']({'where':{'id':_0xc8c1c7[_0xbd67('0x6e')]['id']}})['then'](handleEntityNotFound(_0x1fef67,null))['then'](function(_0xd0a260){if(_0xd0a260){_0x4b9690=_0xd0a260;_0xb67821[_0xbd67('0x3f')]=_[_0xbd67('0x4b')](db['ChatProactiveAction'][_0xbd67('0x47')]);_0xb67821[_0xbd67('0x4a')]=_[_0xbd67('0x4b')](_0xc8c1c7[_0xbd67('0x4a')]);_0xb67821['filters']=_[_0xbd67('0x4e')](_0xb67821['model'],_0xb67821[_0xbd67('0x4a')]);_0x1b0d41[_0xbd67('0x4d')]=_['intersection'](_0xb67821['model'],qs[_0xbd67('0x4f')](_0xc8c1c7[_0xbd67('0x4a')][_0xbd67('0x4f')]));_0x1b0d41[_0xbd67('0x4d')]=_0x1b0d41[_0xbd67('0x4d')][_0xbd67('0x50')]?_0x1b0d41[_0xbd67('0x4d')]:_0xb67821[_0xbd67('0x3f')];_0x1b0d41[_0xbd67('0x76')]=qs[_0xbd67('0x53')](_0xc8c1c7['query'][_0xbd67('0x53')]);_0x1b0d41[_0xbd67('0x54')]=qs[_0xbd67('0x4c')](_[_0xbd67('0x55')](_0xc8c1c7[_0xbd67('0x4a')],_0xb67821[_0xbd67('0x4c')]));if(_0xc8c1c7[_0xbd67('0x4a')]['filter']){_0x1b0d41[_0xbd67('0x54')]=_[_0xbd67('0x58')](_0x1b0d41[_0xbd67('0x54')],{'$or':_['map'](_0x1b0d41[_0xbd67('0x4d')],function(_0x2a6f13){var _0x4c4ce4={};_0x4c4ce4[_0x2a6f13]={'$like':'%'+_0xc8c1c7['query'][_0xbd67('0x56')]+'%'};return _0x4c4ce4;})});}_0x1b0d41=_[_0xbd67('0x58')]({},_0x1b0d41,_0xc8c1c7[_0xbd67('0x5f')]);return _0x4b9690['getProactiveActions'](_0x1b0d41);}})['then'](function(_0x316ed3){if(_0x316ed3){_0x33e37e=_0x316ed3[_0xbd67('0x50')];if(!_0xc8c1c7[_0xbd67('0x4a')]['hasOwnProperty'](_0xbd67('0x52'))){_0x1b0d41[_0xbd67('0x29')]=qs[_0xbd67('0x29')](_0xc8c1c7['query']['limit']);_0x1b0d41['offset']=qs[_0xbd67('0x27')](_0xc8c1c7[_0xbd67('0x4a')][_0xbd67('0x27')]);}return _0x4b9690[_0xbd67('0xfd')](_0x1b0d41);}})[_0xbd67('0x19')](function(_0x257da4){if(_0x257da4){return _0x257da4?{'count':_0x33e37e,'rows':_0x257da4}:null;}})[_0xbd67('0x19')](respondWithResult(_0x1fef67,null))[_0xbd67('0x22')](handleError(_0x1fef67,null));};exports[_0xbd67('0x118')]=function(_0x4fbcb9,_0x5818bc){var _0x57f9b4=_0x4fbcb9[_0xbd67('0x4a')][_0xbd67('0x119')]==='false'?_0xbd67('0x11a'):'onlineForm';return db[_0xbd67('0x46')][_0xbd67('0x60')]({'attributes':['id',_0x57f9b4],'where':{'id':_0x4fbcb9[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x5818bc,null))[_0xbd67('0x19')](function(_0x257314){if(_0x257314){var _0x180aa7=_0x257314[_0x57f9b4];var _0x1d6e2f=_0x180aa7&&_0x180aa7['items']?_0x180aa7[_0xbd67('0x11b')]:[];_0x5818bc['send']({'fromKey':_[_0xbd67('0x89')](_0x180aa7[_0xbd67('0x11c')])?undefined:_0x180aa7[_0xbd67('0x11c')],'count':_0x1d6e2f[_0xbd67('0x50')],'rows':_0x1d6e2f});}})['catch'](handleError(_0x5818bc,null));};exports[_0xbd67('0x11d')]=function(_0x407523,_0x5942ac){var _0xe3f1e7={'raw':![],'where':{}};var _0x30a197={};var _0x23e0f5={'count':0x0,'rows':[]};return db[_0xbd67('0x46')][_0xbd67('0x75')]({'where':{'id':_0x407523[_0xbd67('0x6e')]['id']}})['then'](handleEntityNotFound(_0x5942ac,null))[_0xbd67('0x19')](function(_0x7c0f8d){if(_0x7c0f8d){_0x30a197['model']=_[_0xbd67('0x4b')](db[_0xbd67('0x11e')][_0xbd67('0x47')]);_0x30a197['query']=_[_0xbd67('0x4b')](_0x407523[_0xbd67('0x4a')]);_0x30a197[_0xbd67('0x4c')]=_['intersection'](_0x30a197[_0xbd67('0x3f')],_0x30a197[_0xbd67('0x4a')]);_0xe3f1e7[_0xbd67('0x4d')]=_[_0xbd67('0x4e')](_0x30a197[_0xbd67('0x3f')],qs[_0xbd67('0x4f')](_0x407523[_0xbd67('0x4a')][_0xbd67('0x4f')]));_0xe3f1e7[_0xbd67('0x4d')]=_0xe3f1e7[_0xbd67('0x4d')][_0xbd67('0x50')]?_0xe3f1e7[_0xbd67('0x4d')]:_0x30a197['model'];if(!_0x407523[_0xbd67('0x4a')][_0xbd67('0x51')](_0xbd67('0x52'))){_0xe3f1e7[_0xbd67('0x29')]=qs[_0xbd67('0x29')](_0x407523[_0xbd67('0x4a')][_0xbd67('0x29')]);_0xe3f1e7[_0xbd67('0x27')]=qs[_0xbd67('0x27')](_0x407523[_0xbd67('0x4a')]['offset']);}_0xe3f1e7[_0xbd67('0x76')]=qs[_0xbd67('0x53')](_0x407523['query'][_0xbd67('0x53')]);_0xe3f1e7[_0xbd67('0x54')]=qs[_0xbd67('0x4c')](_['pick'](_0x407523[_0xbd67('0x4a')],_0x30a197[_0xbd67('0x4c')]));_0xe3f1e7['where'][_0xbd67('0x72')]=_0x7c0f8d['id'];if(_0x407523[_0xbd67('0x4a')][_0xbd67('0x56')]){_0xe3f1e7['where']=_[_0xbd67('0x58')](_0xe3f1e7['where'],{'$or':_[_0xbd67('0x45')](_0xe3f1e7['attributes'],function(_0x101723){var _0x4fe034={};_0x4fe034[_0x101723]={'$like':'%'+_0x407523[_0xbd67('0x4a')]['filter']+'%'};return _0x4fe034;})});}_0xe3f1e7=_[_0xbd67('0x58')]({},_0xe3f1e7,_0x407523['options']);return db[_0xbd67('0x11e')][_0xbd67('0x2a')]({'where':_0xe3f1e7['where']})[_0xbd67('0x19')](function(_0x5d0e84){_0x23e0f5[_0xbd67('0x2a')]=_0x5d0e84;if(_0x407523[_0xbd67('0x4a')][_0xbd67('0x59')]){_0xe3f1e7[_0xbd67('0x5a')]=[{'all':!![]}];}else{_0xe3f1e7[_0xbd67('0x5a')]=[{'model':db[_0xbd67('0x9d')],'as':_0xbd67('0xf8'),'required':![]},{'model':db[_0xbd67('0x11f')],'as':_0xbd67('0x120'),'required':![]}];}return db[_0xbd67('0x11e')]['findAll'](_0xe3f1e7);})[_0xbd67('0x19')](function(_0x815433){_0x23e0f5['rows']=_0x815433;return _0x23e0f5;});}})[_0xbd67('0x19')](respondWithFilteredResult(_0x5942ac,_0xe3f1e7))[_0xbd67('0x22')](handleError(_0x5942ac,null));};exports[_0xbd67('0x121')]=function(_0x5d859a,_0x151af7){return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0x5d859a[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x151af7,null))[_0xbd67('0x19')](function(_0x5b6014){if(_0x5b6014){return _0x5b6014[_0xbd67('0x121')](_0x5d859a[_0xbd67('0x67')][_0xbd67('0x7b')],_[_0xbd67('0xf7')](_0x5d859a[_0xbd67('0x67')],[_0xbd67('0x7b'),'id'])||{})['spread'](function(_0x22d456){for(var _0xa411c0=0x0;_0xa411c0<_0x5d859a[_0xbd67('0x67')][_0xbd67('0x7b')][_0xbd67('0x50')];_0xa411c0+=0x1){socket[_0xbd67('0x122')](_0xbd67('0x123'),{'UserId':Number(_0x5d859a[_0xbd67('0x67')][_0xbd67('0x7b')][_0xa411c0]),'ChatWebsiteId':Number(_0x5d859a['params']['id'])});}return _0x22d456;});}})['then'](respondWithResult(_0x151af7,null))[_0xbd67('0x22')](handleError(_0x151af7,null));};exports[_0xbd67('0x124')]=function(_0x4b6044,_0x46cc66){return db[_0xbd67('0x46')][_0xbd67('0x60')]({'where':{'id':_0x4b6044[_0xbd67('0x6e')]['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x46cc66,null))[_0xbd67('0x19')](function(_0x52b607){if(_0x52b607){return _0x52b607[_0xbd67('0x124')](_0x4b6044[_0xbd67('0x4a')][_0xbd67('0x7b')])['then'](function(){if(_[_0xbd67('0x125')](_0x4b6044[_0xbd67('0x4a')][_0xbd67('0x7b')])){for(var _0x316dc4=0x0;_0x316dc4<_0x4b6044['query'][_0xbd67('0x7b')][_0xbd67('0x50')];_0x316dc4+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x4b6044['query'][_0xbd67('0x7b')][_0x316dc4]),'ChatWebsiteId':Number(_0x4b6044[_0xbd67('0x6e')]['id'])});}}else{socket[_0xbd67('0x122')](_0xbd67('0x126'),{'UserId':Number(_0x4b6044['query']['ids']),'ChatWebsiteId':Number(_0x4b6044[_0xbd67('0x6e')]['id'])});}});}})[_0xbd67('0x19')](respondWithStatusCode(_0x46cc66,null))[_0xbd67('0x22')](handleError(_0x46cc66,null));};exports['getAgents']=function(_0x274cac,_0x3dd9df){var _0x408df1={};var _0x2d3456={};var _0x456643;var _0x130083;return db[_0xbd67('0x46')][_0xbd67('0x75')]({'where':{'id':_0x274cac['params']['id']}})[_0xbd67('0x19')](handleEntityNotFound(_0x3dd9df,null))['then'](function(_0x1253c3){if(_0x1253c3){_0x456643=_0x1253c3;_0x2d3456['model']=_[_0xbd67('0x4b')](db[_0xbd67('0xc0')][_0xbd67('0x47')]);_0x2d3456[_0xbd67('0x4a')]=_[_0xbd67('0x4b')](_0x274cac[_0xbd67('0x4a')]);_0x2d3456[_0xbd67('0x4c')]=_['intersection'](_0x2d3456[_0xbd67('0x3f')],_0x2d3456[_0xbd67('0x4a')]);_0x408df1[_0xbd67('0x4d')]=_[_0xbd67('0x4e')](_0x2d3456[_0xbd67('0x3f')],qs[_0xbd67('0x4f')](_0x274cac[_0xbd67('0x4a')]['fields']));_0x408df1[_0xbd67('0x4d')]=_0x408df1['attributes']['length']?_0x408df1[_0xbd67('0x4d')]:_0x2d3456[_0xbd67('0x3f')];_0x408df1[_0xbd67('0x76')]=qs['sort'](_0x274cac[_0xbd67('0x4a')]['sort']);_0x408df1[_0xbd67('0x54')]=qs[_0xbd67('0x4c')](_[_0xbd67('0x55')](_0x274cac[_0xbd67('0x4a')],_0x2d3456[_0xbd67('0x4c')]));if(_0x274cac['query'][_0xbd67('0x56')]){_0x408df1[_0xbd67('0x54')]=_[_0xbd67('0x58')](_0x408df1[_0xbd67('0x54')],{'$or':_[_0xbd67('0x45')](_0x408df1[_0xbd67('0x4d')],function(_0x31a18a){var _0x3096f2={};_0x3096f2[_0x31a18a]={'$like':'%'+_0x274cac['query'][_0xbd67('0x56')]+'%'};return _0x3096f2;})});}_0x408df1=_[_0xbd67('0x58')]({},_0x408df1,_0x274cac[_0xbd67('0x5f')]);return _0x456643['getAgents'](_0x408df1);}})[_0xbd67('0x19')](function(_0x34d51d){if(_0x34d51d){_0x130083=_0x34d51d[_0xbd67('0x50')];if(!_0x274cac['query'][_0xbd67('0x51')]('nolimit')){_0x408df1[_0xbd67('0x29')]=qs[_0xbd67('0x29')](_0x274cac['query'][_0xbd67('0x29')]);_0x408df1[_0xbd67('0x27')]=qs[_0xbd67('0x27')](_0x274cac[_0xbd67('0x4a')][_0xbd67('0x27')]);}return _0x456643['getAgents'](_0x408df1);}})[_0xbd67('0x19')](function(_0x4e50dc){if(_0x4e50dc){return _0x4e50dc?{'count':_0x130083,'rows':_0x4e50dc}:null;}})['then'](respondWithResult(_0x3dd9df,null))['catch'](handleError(_0x3dd9df,null));}; \ No newline at end of file +var _0x24ca=['orderBy','priority','account','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','firstName','messageId','created','autoclose','applications','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','offline','files','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','attachments','offline-chat','transaction','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','mimetype','toPairsIn','mapValues','subjectOffline','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','getSnippet','Intervals','getProactiveActions','../../config/license/util','virtual','License','readFileSync','server/files/chat/iframe.ejs','3.13.0','origin','http://localhost:9000','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','color','labelText','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','READ_COMMITTED','ChatApplication','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','http','client','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','limit','undefined','set','then','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','first','lastName','x-real-port','referer','browser','version','unknown','format','%s\x20%s','device','vendor','model','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','options','create','body','address','split','forEach','trim','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','pick','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','resolve','timezone','ifTime','notify','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','Applications','Interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x24ca[_0x2f48cd];return _0x193ae2;};'use strict';var Mustache=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var ejs=require(_0xa24c('0x2'));var fs=require('fs');var fs_extra=require(_0xa24c('0x3'));var _=require('lodash');var querystring=require(_0xa24c('0x4'));var htmlToText=require(_0xa24c('0x5'));var Redis=require(_0xa24c('0x6'));var jayson=require(_0xa24c('0x7'));var qs=require(_0xa24c('0x8'));var logger=require(_0xa24c('0x9'))(_0xa24c('0xa'));var config=require(_0xa24c('0xb'));var APIBadRequestError=require(_0xa24c('0xc'))[_0xa24c('0xd')];var APINotFoundError=require(_0xa24c('0xc'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xa24c('0xc'))[_0xa24c('0xe')];var APIHandleError=require(_0xa24c('0xc'))['handleError'];var APIConflictError=require(_0xa24c('0xc'))[_0xa24c('0xf')];var wildcardUtils=require(_0xa24c('0x10'));var URL=require(_0xa24c('0x11'))[_0xa24c('0x12')];var db=require(_0xa24c('0x13'))['db'];config[_0xa24c('0x14')]=_[_0xa24c('0x15')](config[_0xa24c('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xa24c('0x16'))(new Redis(config[_0xa24c('0x14')]));require(_0xa24c('0x17'))[_0xa24c('0x18')](socket);var client=jayson['client'][_0xa24c('0x19')]({'port':0x232c});var client9002=jayson[_0xa24c('0x1a')][_0xa24c('0x19')]({'port':0x232a});var client9003=jayson[_0xa24c('0x1a')][_0xa24c('0x19')]({'port':0x232b});var client9001=jayson[_0xa24c('0x1a')][_0xa24c('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x5d4727,_0x47a063,_0xb80781,_0x87aa90){return new Promise(function(_0x49ce53,_0x5babb5){var _0x221d21=_0x87aa90||client;return _0x221d21[_0xa24c('0x1b')](_0x5d4727,_0xb80781)['then'](function(_0x2a64ff){logger['info'](_0xa24c('0x1c'),_0x47a063,_0xa24c('0x1d'));logger[_0xa24c('0x1e')](_0xa24c('0x1f'),_0x47a063,'request\x20sent',JSON[_0xa24c('0x20')](_0x2a64ff));if(_0x2a64ff[_0xa24c('0x21')]){if(_0x2a64ff[_0xa24c('0x21')]['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x47a063,_0x2a64ff['error'][_0xa24c('0x22')]);return _0x5babb5(_0x2a64ff[_0xa24c('0x21')][_0xa24c('0x22')]);}logger[_0xa24c('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x47a063,_0x2a64ff[_0xa24c('0x21')]['message']);return _0x49ce53(_0x2a64ff[_0xa24c('0x21')][_0xa24c('0x22')]);}else{logger['info'](_0xa24c('0x1c'),_0x47a063,_0xa24c('0x1d'));_0x49ce53(_0x2a64ff[_0xa24c('0x23')][_0xa24c('0x22')]);}})[_0xa24c('0x24')](function(_0x47e0eb){logger[_0xa24c('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x47a063,_0x47e0eb);_0x5babb5(_0x47e0eb);});});}function respondWithStatusCode(_0x2365f9,_0x3951ae){_0x3951ae=_0x3951ae||0xcc;return function(_0x294685){if(_0x294685){return _0x2365f9['sendStatus'](_0x3951ae);}return _0x2365f9[_0xa24c('0x25')](_0x3951ae)[_0xa24c('0x26')]();};}function respondWithResult(_0x14fd5a,_0x314121){_0x314121=_0x314121||0xc8;return function(_0x11e4e0){if(_0x11e4e0){return _0x14fd5a[_0xa24c('0x25')](_0x314121)[_0xa24c('0x27')](_0x11e4e0);}};}function respondWithFilteredResult(_0x5b23f4,_0xa0c48e){return function(_0x28675f){if(_0x28675f){var _0x152120=typeof _0xa0c48e[_0xa24c('0x28')]==='undefined'&&typeof _0xa0c48e[_0xa24c('0x29')]===_0xa24c('0x2a');var _0x97c08=_0x28675f['count'];var _0x15eaaf=_0x152120?0x0:_0xa0c48e[_0xa24c('0x28')];var _0x253d83=_0x152120?_0x28675f['count']:_0xa0c48e[_0xa24c('0x28')]+_0xa0c48e['limit'];var _0x1102ab;if(_0x253d83>=_0x97c08){_0x253d83=_0x97c08;_0x1102ab=0xc8;}else{_0x1102ab=0xce;}_0x5b23f4[_0xa24c('0x25')](_0x1102ab);return _0x5b23f4[_0xa24c('0x2b')]('Content-Range',_0x15eaaf+'-'+_0x253d83+'/'+_0x97c08)[_0xa24c('0x27')](_0x28675f);}return null;};}function saveUpdates(_0x53f90){return function(_0x1d0379){if(_0x1d0379){return _0x1d0379['update'](_0x53f90)[_0xa24c('0x2c')](function(_0x57c340){return _0x57c340;});}return null;};}function removeEntity(_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x2d')]({'plain':!![]});var _0x182e86=_0xa24c('0x2e');return db[_0xa24c('0x2f')][_0xa24c('0x30')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x2c')](function(){return _0x42ba21;});})['then'](function(){_0xa20091[_0xa24c('0x25')](0xcc)[_0xa24c('0x26')]();});}};}function handleEntityNotFound(_0x12825d){return function(_0xbd24c0){if(!_0xbd24c0){_0x12825d[_0xa24c('0x31')](0x194);}return _0xbd24c0;};}function handleError(_0x31b19d,_0x86902f){_0x86902f=_0x86902f||0x1f4;return function(_0x81d471){logger[_0xa24c('0x21')](_0x81d471[_0xa24c('0x32')]);if(_0x81d471['name']){delete _0x81d471[_0xa24c('0x33')];}_0x31b19d[_0xa24c('0x25')](_0x86902f)[_0xa24c('0x34')](_0x81d471);};}function createInteractionObject(_0x1b0757,_0x578b72,_0x56a485,_0x19a65f){var _0x56ef4d=require(_0xa24c('0x35'));var _0x13f272=new _0x56ef4d();var _0x22a316=_0x13f272[_0xa24c('0x36')](_0x56a485[_0xa24c('0x37')])['getResult']();var _0x532875=_0x578b72[_0xa24c('0x38')];if(_0x56a485[_0xa24c('0x39')]){_0x532875=_0x56a485[_0xa24c('0x39')];}else if(_0x56a485[_0xa24c('0x3a')]){_0x532875=_[_0xa24c('0x3b')](_0x56a485[_0xa24c('0x3a')]['split'](','));}return{'ContactId':_0x19a65f['id'],'ChatWebsiteId':_0x1b0757,'from':(_0x19a65f['firstName']||'')+'\x20'+(_0x19a65f[_0xa24c('0x3c')]||''),'customerIp':_0x532875,'customerPort':_0x56a485[_0xa24c('0x3d')]?_0x56a485[_0xa24c('0x3d')]:null,'referer':_0x578b72[_0xa24c('0x3e')],'browserName':_0x22a316[_0xa24c('0x3f')]['name']&&_0x22a316[_0xa24c('0x3f')][_0xa24c('0x40')]?util['format']('%s\x20%s',_0x22a316[_0xa24c('0x3f')][_0xa24c('0x33')],_0x22a316[_0xa24c('0x3f')]['version']):'unknown','browserVersion':_0x22a316[_0xa24c('0x3f')][_0xa24c('0x40')]||_0xa24c('0x41'),'osName':util[_0xa24c('0x42')](_0xa24c('0x43'),_0x22a316['os'][_0xa24c('0x33')],_0x22a316['os'][_0xa24c('0x40')]),'osVersion':_0x22a316['os'][_0xa24c('0x40')],'deviceModel':_0x22a316['device']['model']&&_0x22a316[_0xa24c('0x44')][_0xa24c('0x45')]?util[_0xa24c('0x42')]('%s\x20%s\x20%s',_0x22a316[_0xa24c('0x44')][_0xa24c('0x46')],_0x22a316[_0xa24c('0x44')][_0xa24c('0x45')],_0x22a316[_0xa24c('0x44')][_0xa24c('0x47')]):null,'deviceVendor':_0x22a316[_0xa24c('0x44')][_0xa24c('0x45')],'deviceType':_0x22a316[_0xa24c('0x44')][_0xa24c('0x47')],'formData':JSON['stringify'](_0x578b72)};}exports[_0xa24c('0x48')]=function(_0x183107,_0x39a6cd){var _0x5aa2b2={'include':[{'model':db[_0xa24c('0x49')],'as':_0xa24c('0x4a')}]},_0x3a85cb={},_0x247d2c={'count':0x0,'rows':[]};var _0x3918a6=_[_0xa24c('0x4b')](db[_0xa24c('0x4c')][_0xa24c('0x4d')],function(_0x2ac54d){return{'name':_0x2ac54d[_0xa24c('0x4e')],'type':_0x2ac54d[_0xa24c('0x47')]['key']};});_0x3a85cb[_0xa24c('0x46')]=_[_0xa24c('0x4b')](_0x3918a6,_0xa24c('0x33'));_0x3a85cb[_0xa24c('0x4f')]=_[_0xa24c('0x50')](_0x183107[_0xa24c('0x4f')]);_0x3a85cb[_0xa24c('0x51')]=_[_0xa24c('0x52')](_0x3a85cb[_0xa24c('0x46')],_0x3a85cb['query']);_0x5aa2b2['attributes']=_[_0xa24c('0x52')](_0x3a85cb['model'],qs[_0xa24c('0x53')](_0x183107[_0xa24c('0x4f')]['fields']));_0x5aa2b2[_0xa24c('0x54')]=_0x5aa2b2[_0xa24c('0x54')][_0xa24c('0x55')]?_0x5aa2b2['attributes']:_0x3a85cb['model'];if(!_0x183107[_0xa24c('0x4f')]['hasOwnProperty'](_0xa24c('0x56'))){_0x5aa2b2[_0xa24c('0x29')]=qs[_0xa24c('0x29')](_0x183107[_0xa24c('0x4f')][_0xa24c('0x29')]);_0x5aa2b2[_0xa24c('0x28')]=qs[_0xa24c('0x28')](_0x183107[_0xa24c('0x4f')][_0xa24c('0x28')]);}_0x5aa2b2[_0xa24c('0x57')]=qs['sort'](_0x183107[_0xa24c('0x4f')][_0xa24c('0x58')]);_0x5aa2b2[_0xa24c('0x59')]=qs['filters'](_['pick'](_0x183107['query'],_0x3a85cb[_0xa24c('0x51')]),_0x3918a6);if(_0x183107['query'][_0xa24c('0x5a')]){_0x5aa2b2[_0xa24c('0x59')]=_['merge'](_0x5aa2b2[_0xa24c('0x59')],{'$or':_[_0xa24c('0x4b')](_0x3918a6,function(_0x131a7a){if(_0x131a7a[_0xa24c('0x47')]!==_0xa24c('0x5b')){var _0x3a72e3={};_0x3a72e3[_0x131a7a[_0xa24c('0x33')]]={'$like':'%'+_0x183107[_0xa24c('0x4f')]['filter']+'%'};return _0x3a72e3;}})});}_0x5aa2b2=_[_0xa24c('0x5c')]({},_0x5aa2b2,_0x183107['options']);var _0x5abd45={'where':_0x5aa2b2['where']};return db['ChatWebsite']['count'](_0x5abd45)[_0xa24c('0x2c')](function(_0x4bb0db){_0x247d2c[_0xa24c('0x5d')]=_0x4bb0db;if(_0x183107[_0xa24c('0x4f')][_0xa24c('0x5e')]){_0x5aa2b2[_0xa24c('0x5f')]=[{'all':!![]}];}return db[_0xa24c('0x4c')][_0xa24c('0x60')](_0x5aa2b2);})[_0xa24c('0x2c')](function(_0x2406d6){_0x247d2c[_0xa24c('0x61')]=_0x2406d6;return _0x247d2c;})[_0xa24c('0x2c')](respondWithFilteredResult(_0x39a6cd,_0x5aa2b2))[_0xa24c('0x24')](handleError(_0x39a6cd,null));};exports[_0xa24c('0x62')]=function(_0x358b48,_0x348086){var _0x136d6b={'raw':![],'where':{'id':_0x358b48[_0xa24c('0x63')]['id']},'include':[{'model':db[_0xa24c('0x49')],'as':'mandatoryDispositionPause'}]},_0x5c3d11={};_0x5c3d11[_0xa24c('0x46')]=_[_0xa24c('0x50')](db[_0xa24c('0x4c')][_0xa24c('0x4d')]);_0x5c3d11['query']=_['keys'](_0x358b48[_0xa24c('0x4f')]);_0x5c3d11['filters']=_['intersection'](_0x5c3d11[_0xa24c('0x46')],_0x5c3d11[_0xa24c('0x4f')]);_0x136d6b[_0xa24c('0x54')]=_[_0xa24c('0x52')](_0x5c3d11['model'],qs['fields'](_0x358b48[_0xa24c('0x4f')]['fields']));_0x136d6b['attributes']=_0x136d6b[_0xa24c('0x54')][_0xa24c('0x55')]?_0x136d6b[_0xa24c('0x54')]:_0x5c3d11['model'];if(_0x358b48[_0xa24c('0x4f')][_0xa24c('0x5e')]){_0x136d6b['include']=[{'all':!![]}];}_0x136d6b=_[_0xa24c('0x5c')]({},_0x136d6b,_0x358b48[_0xa24c('0x64')]);return db[_0xa24c('0x4c')]['find'](_0x136d6b)[_0xa24c('0x2c')](handleEntityNotFound(_0x348086,null))[_0xa24c('0x2c')](respondWithResult(_0x348086,null))[_0xa24c('0x24')](handleError(_0x348086,null));};exports[_0xa24c('0x65')]=function(_0xe56235,_0x4e89e4){var _0x159020=null;_0xe56235[_0xa24c('0x66')][_0xa24c('0x67')][_0xa24c('0x68')](',')[_0xa24c('0x69')](_0x2ca3fa=>{if(_0x2ca3fa[_0xa24c('0x6a')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x2ca3fa[_0xa24c('0x6a')]())){_0x159020=new APIBadRequestError('\x22'+_0x2ca3fa[_0xa24c('0x6a')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x159020){return handleError(_0x4e89e4,null)(_0x159020);}return db[_0xa24c('0x4c')][_0xa24c('0x65')](_0xe56235[_0xa24c('0x66')],{})[_0xa24c('0x2c')](function(_0x256d86){var _0x3a241a=_0xe56235[_0xa24c('0x6b')][_0xa24c('0x2d')]({'plain':!![]});if(!_0x3a241a)throw new Error(_0xa24c('0x6c'));if(_0x3a241a[_0xa24c('0x6d')]==='user'){var _0x2771a1=_0x256d86[_0xa24c('0x2d')]({'plain':!![]});var _0x3b894f='ChatWebsites';return db[_0xa24c('0x6e')][_0xa24c('0x6f')]({'where':{'name':_0x3b894f,'userProfileId':_0x3a241a[_0xa24c('0x70')]},'raw':!![]})['then'](function(_0x3ac3a0){if(_0x3ac3a0&&_0x3ac3a0[_0xa24c('0x71')]===0x0){return db[_0xa24c('0x2f')][_0xa24c('0x65')]({'name':_0x2771a1[_0xa24c('0x33')],'resourceId':_0x2771a1['id'],'type':_0x3ac3a0[_0xa24c('0x33')],'sectionId':_0x3ac3a0['id']},{})['then'](function(){return _0x256d86;});}else{return _0x256d86;}})['catch'](function(_0x361763){logger['error'](_0xa24c('0x72'),_0x361763);throw _0x361763;});}return _0x256d86;})[_0xa24c('0x2c')](respondWithResult(_0x4e89e4,0xc9))[_0xa24c('0x24')](handleError(_0x4e89e4,null));};exports[_0xa24c('0x73')]=function(_0x12d715,_0x58e328){var _0x1f7b20=null;_0x12d715[_0xa24c('0x66')][_0xa24c('0x67')][_0xa24c('0x68')](',')[_0xa24c('0x69')](_0x389c08=>{if(_0x389c08['trim']()!==''&&!wildcardUtils[_0xa24c('0x74')](_0x389c08[_0xa24c('0x6a')]())){_0x1f7b20=new APIBadRequestError('\x22'+_0x389c08[_0xa24c('0x6a')]()+_0xa24c('0x75'));}});if(_0x1f7b20){return handleError(_0x58e328,null)(_0x1f7b20);}if(_0x12d715['body']['id']){delete _0x12d715[_0xa24c('0x66')]['id'];}return db['ChatWebsite'][_0xa24c('0x6f')]({'where':{'id':_0x12d715[_0xa24c('0x63')]['id']},'include':[{'model':db[_0xa24c('0x49')],'as':_0xa24c('0x4a')}]})['then'](handleEntityNotFound(_0x58e328,null))[_0xa24c('0x2c')](saveUpdates(_0x12d715[_0xa24c('0x66')],null))['then'](respondWithResult(_0x58e328,null))[_0xa24c('0x24')](handleError(_0x58e328,null));};exports[_0xa24c('0x30')]=function(_0x135cef,_0x3e0c08){return db[_0xa24c('0x4c')][_0xa24c('0x6f')]({'where':{'id':_0x135cef[_0xa24c('0x63')]['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x3e0c08,null))['then'](removeEntity(_0x3e0c08,null))[_0xa24c('0x24')](handleError(_0x3e0c08,null));};exports[_0xa24c('0x76')]=function(_0x2cae90,_0x28c3ff){return db[_0xa24c('0x4c')][_0xa24c('0x76')]()[_0xa24c('0x2c')](respondWithResult(_0x28c3ff,null))[_0xa24c('0x24')](handleError(_0x28c3ff,null));};exports[_0xa24c('0x77')]=function(_0x286049,_0xc4aa48){if(_0x286049['body']['id']){delete _0x286049[_0xa24c('0x66')]['id'];}return db[_0xa24c('0x4c')]['find']({'where':{'id':_0x286049[_0xa24c('0x63')]['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0xc4aa48,null))[_0xa24c('0x2c')](function(_0x4f0f11){if(_0x4f0f11){_0x286049['body'][_0xa24c('0x78')]=_0x4f0f11['id'];return db[_0xa24c('0x79')]['create'](_0x286049[_0xa24c('0x66')]);}})[_0xa24c('0x2c')](respondWithResult(_0xc4aa48,null))[_0xa24c('0x24')](handleError(_0xc4aa48,null));};exports[_0xa24c('0x7a')]=function(_0x371c80,_0x336898){var _0x5e6e59={'raw':![],'where':{}};var _0x47fc5f={};var _0x4ef0bc={'count':0x0,'rows':[]};return db[_0xa24c('0x4c')]['findOne']({'where':{'id':_0x371c80['params']['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x336898,null))[_0xa24c('0x2c')](function(_0x32d14a){if(_0x32d14a){_0x47fc5f[_0xa24c('0x46')]=_[_0xa24c('0x50')](db[_0xa24c('0x79')][_0xa24c('0x4d')]);_0x47fc5f[_0xa24c('0x4f')]=_[_0xa24c('0x50')](_0x371c80['query']);_0x47fc5f[_0xa24c('0x51')]=_[_0xa24c('0x52')](_0x47fc5f[_0xa24c('0x46')],_0x47fc5f[_0xa24c('0x4f')]);_0x5e6e59[_0xa24c('0x54')]=_[_0xa24c('0x52')](_0x47fc5f[_0xa24c('0x46')],qs[_0xa24c('0x53')](_0x371c80[_0xa24c('0x4f')][_0xa24c('0x53')]));_0x5e6e59[_0xa24c('0x54')]=_0x5e6e59[_0xa24c('0x54')]['length']?_0x5e6e59[_0xa24c('0x54')]:_0x47fc5f[_0xa24c('0x46')];if(!_0x371c80['query'][_0xa24c('0x7b')](_0xa24c('0x56'))){_0x5e6e59[_0xa24c('0x29')]=qs['limit'](_0x371c80[_0xa24c('0x4f')][_0xa24c('0x29')]);_0x5e6e59['offset']=qs[_0xa24c('0x28')](_0x371c80[_0xa24c('0x4f')]['offset']);}_0x5e6e59['order']=qs[_0xa24c('0x58')](_0x371c80[_0xa24c('0x4f')][_0xa24c('0x58')]);_0x5e6e59[_0xa24c('0x59')]=qs['filters'](_[_0xa24c('0x7c')](_0x371c80[_0xa24c('0x4f')],_0x47fc5f[_0xa24c('0x51')]));_0x5e6e59['where']['ChatWebsiteId']=_0x32d14a['id'];if(_0x371c80[_0xa24c('0x4f')][_0xa24c('0x5a')]){_0x5e6e59[_0xa24c('0x59')]=_['merge'](_0x5e6e59['where'],{'$or':_[_0xa24c('0x4b')](_0x5e6e59['attributes'],function(_0x4dce8c){var _0x51ce25={};_0x51ce25[_0x4dce8c]={'$like':'%'+_0x371c80[_0xa24c('0x4f')][_0xa24c('0x5a')]+'%'};return _0x51ce25;})});}_0x5e6e59=_[_0xa24c('0x5c')]({},_0x5e6e59,_0x371c80[_0xa24c('0x64')]);return db[_0xa24c('0x79')][_0xa24c('0x5d')]({'where':_0x5e6e59[_0xa24c('0x59')]})[_0xa24c('0x2c')](function(_0x97cb23){_0x4ef0bc[_0xa24c('0x5d')]=_0x97cb23;if(_0x371c80[_0xa24c('0x4f')][_0xa24c('0x5e')]){_0x5e6e59['include']=[{'all':!![]}];}return db[_0xa24c('0x79')][_0xa24c('0x60')](_0x5e6e59);})['then'](function(_0x2fd4a2){_0x4ef0bc['rows']=_0x2fd4a2;return _0x4ef0bc;});}})['then'](respondWithFilteredResult(_0x336898,_0x5e6e59))['catch'](handleError(_0x336898,null));};exports[_0xa24c('0x7d')]=function(_0x4831d8,_0x5c71bd){return db['ChatWebsite'][_0xa24c('0x6f')]({'where':{'id':_0x4831d8[_0xa24c('0x63')]['id']}})['then'](handleEntityNotFound(_0x5c71bd,null))[_0xa24c('0x2c')](function(_0x512238){if(_0x512238){return _0x512238[_0xa24c('0x7d')](_0x4831d8[_0xa24c('0x4f')][_0xa24c('0x7e')]);}})[_0xa24c('0x2c')](respondWithStatusCode(_0x5c71bd,null))[_0xa24c('0x24')](handleError(_0x5c71bd,null));};exports['addAnswer']=function(_0x2e38e6,_0x5774d2){if(_0x2e38e6[_0xa24c('0x66')]['id']){delete _0x2e38e6[_0xa24c('0x66')]['id'];}return db[_0xa24c('0x4c')][_0xa24c('0x6f')]({'where':{'id':_0x2e38e6['params']['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x5774d2,null))[_0xa24c('0x2c')](function(_0x233681){if(_0x233681){_0x2e38e6[_0xa24c('0x66')]['ChatWebsiteId']=_0x233681['id'];return db[_0xa24c('0x7f')][_0xa24c('0x65')](_0x2e38e6[_0xa24c('0x66')]);}})[_0xa24c('0x2c')](respondWithResult(_0x5774d2,null))[_0xa24c('0x24')](handleError(_0x5774d2,null));};exports[_0xa24c('0x80')]=function(_0xff83d0,_0x4654f0){var _0xd49192={'raw':![],'where':{}};var _0x3a0676={};var _0x627114={'count':0x0,'rows':[]};return db[_0xa24c('0x4c')][_0xa24c('0x81')]({'where':{'id':_0xff83d0['params']['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x4654f0,null))[_0xa24c('0x2c')](function(_0x56465a){if(_0x56465a){_0x3a0676[_0xa24c('0x46')]=_[_0xa24c('0x50')](db[_0xa24c('0x7f')][_0xa24c('0x4d')]);_0x3a0676[_0xa24c('0x4f')]=_['keys'](_0xff83d0[_0xa24c('0x4f')]);_0x3a0676[_0xa24c('0x51')]=_[_0xa24c('0x52')](_0x3a0676[_0xa24c('0x46')],_0x3a0676[_0xa24c('0x4f')]);_0xd49192[_0xa24c('0x54')]=_[_0xa24c('0x52')](_0x3a0676['model'],qs[_0xa24c('0x53')](_0xff83d0[_0xa24c('0x4f')][_0xa24c('0x53')]));_0xd49192[_0xa24c('0x54')]=_0xd49192[_0xa24c('0x54')][_0xa24c('0x55')]?_0xd49192[_0xa24c('0x54')]:_0x3a0676[_0xa24c('0x46')];if(!_0xff83d0[_0xa24c('0x4f')][_0xa24c('0x7b')]('nolimit')){_0xd49192[_0xa24c('0x29')]=qs[_0xa24c('0x29')](_0xff83d0[_0xa24c('0x4f')][_0xa24c('0x29')]);_0xd49192[_0xa24c('0x28')]=qs[_0xa24c('0x28')](_0xff83d0[_0xa24c('0x4f')][_0xa24c('0x28')]);}_0xd49192['order']=qs[_0xa24c('0x58')](_0xff83d0['query']['sort']);_0xd49192['where']=qs['filters'](_[_0xa24c('0x7c')](_0xff83d0[_0xa24c('0x4f')],_0x3a0676[_0xa24c('0x51')]));_0xd49192[_0xa24c('0x59')][_0xa24c('0x78')]=_0x56465a['id'];if(_0xff83d0['query'][_0xa24c('0x5a')]){_0xd49192[_0xa24c('0x59')]=_[_0xa24c('0x5c')](_0xd49192[_0xa24c('0x59')],{'$or':_[_0xa24c('0x4b')](_0xd49192[_0xa24c('0x54')],function(_0x1ab93b){var _0x400773={};_0x400773[_0x1ab93b]={'$like':'%'+_0xff83d0[_0xa24c('0x4f')]['filter']+'%'};return _0x400773;})});}_0xd49192=_[_0xa24c('0x5c')]({},_0xd49192,_0xff83d0[_0xa24c('0x64')]);return db[_0xa24c('0x7f')][_0xa24c('0x5d')]({'where':_0xd49192[_0xa24c('0x59')]})['then'](function(_0x35b314){_0x627114[_0xa24c('0x5d')]=_0x35b314;if(_0xff83d0[_0xa24c('0x4f')]['includeAll']){_0xd49192[_0xa24c('0x5f')]=[{'all':!![]}];}return db[_0xa24c('0x7f')][_0xa24c('0x60')](_0xd49192);})[_0xa24c('0x2c')](function(_0x6e2a32){_0x627114['rows']=_0x6e2a32;return _0x627114;});}})['then'](respondWithFilteredResult(_0x4654f0,_0xd49192))[_0xa24c('0x24')](handleError(_0x4654f0,null));};exports['removeAnswers']=function(_0x1c912c,_0x24e3fb){return db['ChatWebsite'][_0xa24c('0x6f')]({'where':{'id':_0x1c912c[_0xa24c('0x63')]['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x24e3fb,null))[_0xa24c('0x2c')](function(_0x24cfae){if(_0x24cfae){return _0x24cfae[_0xa24c('0x82')](_0x1c912c['query'][_0xa24c('0x7e')]);}})[_0xa24c('0x2c')](respondWithStatusCode(_0x24e3fb,null))[_0xa24c('0x24')](handleError(_0x24e3fb,null));};exports[_0xa24c('0x83')]=function(_0x5583a3,_0x11226e){_0x5583a3[_0xa24c('0x66')][_0xa24c('0x84')]=_0x5583a3[_0xa24c('0x85')][_0xa24c('0x86')];return db[_0xa24c('0x4c')][_0xa24c('0x6f')]({'where':{'id':_0x5583a3['params']['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x11226e,null))[_0xa24c('0x2c')](saveUpdates(_0x5583a3[_0xa24c('0x66')],null))['then'](respondWithResult(_0x11226e,null))['catch'](handleError(_0x11226e,null));};exports[_0xa24c('0x87')]=function(_0x6170f6,_0x464329){_0x6170f6['body'][_0xa24c('0x88')]=_0x6170f6['file']['filename'];return db[_0xa24c('0x4c')][_0xa24c('0x6f')]({'where':{'id':_0x6170f6[_0xa24c('0x63')]['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x464329,null))[_0xa24c('0x2c')](saveUpdates(_0x6170f6[_0xa24c('0x66')],null))[_0xa24c('0x2c')](respondWithResult(_0x464329,null))[_0xa24c('0x24')](handleError(_0x464329,null));};exports[_0xa24c('0x89')]=function(_0x5ae9e5,_0x31ef0d){_0x5ae9e5[_0xa24c('0x66')][_0xa24c('0x8a')]=_0x5ae9e5[_0xa24c('0x85')][_0xa24c('0x86')];return db[_0xa24c('0x4c')]['find']({'where':{'id':_0x5ae9e5['params']['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x31ef0d,null))[_0xa24c('0x2c')](saveUpdates(_0x5ae9e5[_0xa24c('0x66')],null))[_0xa24c('0x2c')](respondWithResult(_0x31ef0d,null))[_0xa24c('0x24')](handleError(_0x31ef0d,null));};exports[_0xa24c('0x8b')]=function(_0x5f1ec2,_0xa1593f){_0x5f1ec2['body'][_0xa24c('0x8c')]=_0x5f1ec2[_0xa24c('0x85')][_0xa24c('0x86')];return db[_0xa24c('0x4c')][_0xa24c('0x6f')]({'where':{'id':_0x5f1ec2['params']['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0xa1593f,null))[_0xa24c('0x2c')](saveUpdates(_0x5f1ec2[_0xa24c('0x66')],null))['then'](respondWithResult(_0xa1593f,null))[_0xa24c('0x24')](handleError(_0xa1593f,null));};exports[_0xa24c('0x8d')]=function(_0x1c7bd3,_0x21596a){var _0x56cd61=path['join'](config[_0xa24c('0x8e')],_0xa24c('0x8f'));var _0x4cb8e2={'where':{'id':_0x1c7bd3[_0xa24c('0x63')]['id']},'attributes':['id',_0xa24c('0x84')],'raw':!![]};var _0x3cb5f0=![];return require('../../config/license/util')[_0xa24c('0x90')]()[_0xa24c('0x2c')](function(_0x59442a){if(_0x59442a){_0x3cb5f0=_0x59442a['custom'];}})['then'](function(){return db[_0xa24c('0x4c')][_0xa24c('0x6f')](_0x4cb8e2);})[_0xa24c('0x2c')](handleEntityNotFound(_0x21596a,null))['then'](function(_0x4c79ae){if(_0x4c79ae){if(!_[_0xa24c('0x91')](_0x4c79ae[_0xa24c('0x84')])){if(fs[_0xa24c('0x92')](path[_0xa24c('0x93')](config[_0xa24c('0x8e')],'server/files/images/logos/',_0x4c79ae['sitepic']))&&_0x3cb5f0){_0x56cd61=path[_0xa24c('0x93')](config[_0xa24c('0x8e')],_0xa24c('0x94'),_0x4c79ae[_0xa24c('0x84')]);}}return _0x21596a[_0xa24c('0x95')](_0x56cd61);}})['catch'](handleError(_0x21596a,null));};exports[_0xa24c('0x96')]=function(_0x1ceed1,_0x314942){var _0x47c049=path[_0xa24c('0x93')](config['root'],_0xa24c('0x97'));var _0x25dfa9={'where':{'id':_0x1ceed1[_0xa24c('0x63')]['id']},'attributes':['id',_0xa24c('0x88')],'raw':!![]};return db[_0xa24c('0x4c')][_0xa24c('0x6f')](_0x25dfa9)[_0xa24c('0x2c')](handleEntityNotFound(_0x314942,null))[_0xa24c('0x2c')](function(_0x3cf181){if(_0x3cf181){if(!_[_0xa24c('0x91')](_0x3cf181[_0xa24c('0x88')])){if(fs[_0xa24c('0x92')](path['join'](config[_0xa24c('0x8e')],_0xa24c('0x98'),_0x3cf181[_0xa24c('0x88')]))){_0x47c049=path[_0xa24c('0x93')](config['root'],_0xa24c('0x98'),_0x3cf181['agentAvatar']);}}return _0x314942[_0xa24c('0x95')](_0x47c049);}})[_0xa24c('0x24')](handleError(_0x314942,null));};exports[_0xa24c('0x99')]=function(_0x37830c,_0x3f7f62){var _0x554072=path[_0xa24c('0x93')](config[_0xa24c('0x8e')],'server/files/images/avatars/customer_avatar.png');var _0x351247={'where':{'id':_0x37830c[_0xa24c('0x63')]['id']},'attributes':['id',_0xa24c('0x8a'),_0xa24c('0x9a')],'raw':!![]};return db[_0xa24c('0x4c')]['find'](_0x351247)[_0xa24c('0x2c')](handleEntityNotFound(_0x3f7f62,null))[_0xa24c('0x2c')](function(_0x2c0f2b){if(_0x2c0f2b){if(!_['isNil'](_0x2c0f2b[_0xa24c('0x8a')])){if(fs[_0xa24c('0x92')](path[_0xa24c('0x93')](config['root'],_0xa24c('0x98'),_0x2c0f2b['customerAvatar']))&&_0x2c0f2b[_0xa24c('0x9a')]){_0x554072=path[_0xa24c('0x93')](config['root'],'server/files/images/avatars/',_0x2c0f2b[_0xa24c('0x8a')]);}}return _0x3f7f62[_0xa24c('0x95')](_0x554072);}})[_0xa24c('0x24')](handleError(_0x3f7f62,null));};exports[_0xa24c('0x9b')]=function(_0x53057b,_0x39c70d){var _0xdcba18=path[_0xa24c('0x93')](config[_0xa24c('0x8e')],_0xa24c('0x9c'));var _0x1449d4={'where':{'id':_0x53057b[_0xa24c('0x63')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xa24c('0x4c')]['find'](_0x1449d4)[_0xa24c('0x2c')](handleEntityNotFound(_0x39c70d,null))[_0xa24c('0x2c')](function(_0xb25a1f){if(_0xb25a1f){if(!_[_0xa24c('0x91')](_0xb25a1f['systemAvatar'])){if(fs[_0xa24c('0x92')](path[_0xa24c('0x93')](config[_0xa24c('0x8e')],_0xa24c('0x98'),_0xb25a1f['systemAvatar']))){_0xdcba18=path['join'](config[_0xa24c('0x8e')],'server/files/images/avatars/',_0xb25a1f[_0xa24c('0x8c')]);}}return _0x39c70d[_0xa24c('0x95')](_0xdcba18);}})['catch'](handleError(_0x39c70d,null));};function checkWebsiteInterval(_0x1a8800){var _0x86fa8c=_0x1a8800['Interval'];if(!_0x86fa8c){return Promise[_0xa24c('0x9d')](_0x1a8800);}var _0x5f2a8f=_0x1a8800[_0xa24c('0x9e')]||undefined;return _0x86fa8c[_0xa24c('0x9f')](_0x5f2a8f)[_0xa24c('0x2c')](function(_0x5d5dbf){if(!_0x5d5dbf){throw new APIOutOfIntervalError();}return _0x1a8800;});}exports[_0xa24c('0xa0')]=function(_0x434b20,_0x4b96bc){var _0x71ffe5={'body':_0x434b20[_0xa24c('0x66')],'channel':'chat'};var _0x14af44=[];var _0xdd221a=[];var _0x2e7e8b={};var _0x1024c3=![];if(_0x434b20[_0xa24c('0x66')]['id']){delete _0x434b20[_0xa24c('0x66')]['id'];}if(_[_0xa24c('0x91')](_0x434b20['body'][_0xa24c('0xa1')])){throw new APIBadRequestError(_0xa24c('0xa2'));}if(_[_0xa24c('0x91')](_0x434b20[_0xa24c('0x66')][_0xa24c('0xa3')])){throw new APIBadRequestError(_0xa24c('0xa4'));}if(_[_0xa24c('0xa5')](_0x434b20[_0xa24c('0x66')][_0xa24c('0x66')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x1fdaa3=_0x434b20['body'][_0xa24c('0x38')]&&_0x434b20['body'][_0xa24c('0x3e')];return db[_0xa24c('0xa6')][_0xa24c('0x76')]()[_0xa24c('0x2c')](function(_0x3b8f40){if(!_0x3b8f40){throw new Error(_0xa24c('0xa7'));}_0x14af44=Object['keys'](_0x3b8f40)['filter'](function(_0x5bbd92){return![_0xa24c('0xa8'),_0xa24c('0xa9')][_0xa24c('0xaa')](_0x5bbd92);});_0xdd221a=Object[_0xa24c('0x50')](_0x3b8f40)[_0xa24c('0x5a')](function(_0x56f1a5){return![_0xa24c('0xa8'),_0xa24c('0xa9'),_0xa24c('0xab'),_0xa24c('0xac')][_0xa24c('0xaa')](_0x56f1a5);});if(!_['includes'](_0xdd221a,_0x434b20[_0xa24c('0x66')][_0xa24c('0xa3')])){throw new APIBadRequestError(_0xa24c('0xad')+_0xdd221a['join'](',\x20'));}_0x2e7e8b[_0x434b20[_0xa24c('0x66')][_0xa24c('0xa3')]]=_0x434b20[_0xa24c('0x66')][_0xa24c('0xa1')];})[_0xa24c('0x2c')](function(){return db['ChatWebsite'][_0xa24c('0x6f')]({'where':{'id':_0x434b20[_0xa24c('0x63')]['id']},'include':[{'model':db[_0xa24c('0xae')],'as':_0xa24c('0xaf'),'include':[{'model':db[_0xa24c('0xa6')],'as':_0xa24c('0xb0'),'where':_0x2e7e8b,'limit':0x1,'order':[[_0xa24c('0xa9'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xa24c('0xb1')},{'model':db['Interval'],'as':_0xa24c('0xb2'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]});})[_0xa24c('0x2c')](function(_0x4946b3){if(!_0x4946b3){throw new APINotFoundError(util[_0xa24c('0x42')](_0xa24c('0xb3'),_0x434b20['params']['id']));}if(_0x1fdaa3){return checkWebsiteInterval(_0x4946b3);}return _0x4946b3;})[_0xa24c('0x2c')](function(_0x129be7){_0x71ffe5['account']=_0x129be7;_0x71ffe5['applications']=_[_0xa24c('0xb4')](_0x129be7[_0xa24c('0xb1')],[_0xa24c('0xb5')],['asc']);if(_0x71ffe5[_0xa24c('0xb6')][_0xa24c('0xb1')]){delete _0x71ffe5[_0xa24c('0xb6')][_0xa24c('0xb1')];}_0x71ffe5[_0xa24c('0xb7')]=_0x129be7[_0xa24c('0xaf')]||{'id':_0x129be7[_0xa24c('0xac')]};if(_0x71ffe5[_0xa24c('0xb7')]&&_0x71ffe5[_0xa24c('0xb7')]['Contacts'][_0xa24c('0x55')]){return _0x71ffe5[_0xa24c('0xb7')][_0xa24c('0xb0')][0x0];}var _0x3624f2=_[_0xa24c('0x15')](_0x434b20[_0xa24c('0x66')],{'firstName':_0x434b20[_0xa24c('0x66')][_0xa24c('0xa1')],'ListId':_0x129be7[_0xa24c('0xac')]});_0x3624f2[_0x434b20['body'][_0xa24c('0xa3')]]=_0x434b20[_0xa24c('0x66')][_0xa24c('0xa1')];return db[_0xa24c('0xa6')][_0xa24c('0x65')](_0x3624f2,{'fields':_0x14af44,'raw':!![]});})['then'](function(_0x352aa6){_0x71ffe5[_0xa24c('0xb8')]=_0x352aa6;var _0x2416d1=createInteractionObject(_0x434b20['params']['id'],_0x434b20['body'],_0x434b20[_0xa24c('0xb9')],_0x352aa6);var _0x4cc133={'ChatWebsiteId':_0x434b20['params']['id']};if(_0x434b20[_0xa24c('0x66')][_0xa24c('0xba')]){_0x4cc133[_0xa24c('0xba')]=_0x434b20[_0xa24c('0x66')][_0xa24c('0xba')];_0x4cc133[_0xa24c('0xbb')]=![];return db[_0xa24c('0xbc')][_0xa24c('0x6f')]({'where':_0x4cc133})[_0xa24c('0x2c')](function(_0x2e5c9f){var _0x14d311=_0x434b20[_0xa24c('0x66')]['customerIp']&&_0x434b20[_0xa24c('0x66')][_0xa24c('0x3e')];if(_0x2e5c9f){_0x1024c3=!![];return _0x2e5c9f;}else if(!_0x14d311&&_0x2e5c9f&&_0x2e5c9f[_0xa24c('0xbb')]){throw new APIConflictError(_0xa24c('0xbd'));}_0x2416d1[_0xa24c('0xba')]=_0x434b20[_0xa24c('0x66')][_0xa24c('0xba')];_0x2416d1[_0xa24c('0xbe')]=_0x434b20[_0xa24c('0x66')][_0xa24c('0xbe')];return db[_0xa24c('0xbc')]['create'](_0x2416d1);});}_0x4cc133[_0xa24c('0xbf')]=_0x352aa6['id'];if(_0x434b20[_0xa24c('0x66')][_0xa24c('0xc0')]&&_0x434b20[_0xa24c('0x66')][_0xa24c('0xc0')]['id']){_0x4cc133['id']=_0x434b20[_0xa24c('0x66')][_0xa24c('0xc0')]['id'];return db[_0xa24c('0xbc')][_0xa24c('0x6f')]({'where':_0x4cc133})['then'](function(_0x188e3b){var _0xb99574=_0x434b20[_0xa24c('0x66')][_0xa24c('0x38')]&&_0x434b20[_0xa24c('0x66')]['referer'];if(!_0xb99574&&_0x188e3b&&_0x188e3b[_0xa24c('0xbb')]){throw new APIConflictError(_0xa24c('0xbd'));}else if(_0x188e3b){_0x1024c3=!![];return _0x188e3b;}else{return db[_0xa24c('0xbc')][_0xa24c('0x65')](_0x2416d1);}});}return db[_0xa24c('0xbc')][_0xa24c('0x65')](_0x2416d1);})[_0xa24c('0x2c')](function(_0x5e7888){if(!_0x1024c3){return _0x5e7888;}var _0x5cdabe={'from':(_0x71ffe5['contact'][_0xa24c('0xc1')]||'')+'\x20'+(_0x71ffe5[_0xa24c('0xb8')]['lastName']||'')};if(_0x434b20[_0xa24c('0x66')][_0xa24c('0xba')]&&_0x434b20[_0xa24c('0x66')][_0xa24c('0xc2')]&&_0x434b20[_0xa24c('0x66')]['threadId']!=_0x434b20[_0xa24c('0x66')][_0xa24c('0xc2')]){_0x5cdabe['threadId']=_0x434b20[_0xa24c('0x66')][_0xa24c('0xc2')];}return _0x5e7888[_0xa24c('0x73')](_0x5cdabe);})[_0xa24c('0x2c')](function(_0xbbe647){_0x71ffe5[_0xa24c('0xc0')]=_0xbbe647[_0xa24c('0x2d')]({'plain':!![]});_0x71ffe5[_0xa24c('0xc0')][_0xa24c('0xc3')]=!_0x1024c3;if(_0x71ffe5[_0xa24c('0xc0')][_0xa24c('0xc3')]){if(_0x71ffe5[_0xa24c('0xb6')][_0xa24c('0xc4')]){_0x71ffe5[_0xa24c('0xc5')]['push']({'id':0x0,'priority':_0x71ffe5['applications'][_0xa24c('0x55')]+0x1,'app':_0xa24c('0xc6'),'appdata':_0xa24c('0xc7'),'interval':_0xa24c('0xc8')});}}return db[_0xa24c('0xc9')][_0xa24c('0x65')]({'body':_0x434b20[_0xa24c('0x66')][_0xa24c('0x66')],'ChatWebsiteId':_0x434b20[_0xa24c('0x63')]['id'],'ChatInteractionId':_0xbbe647['id'],'direction':'in','ContactId':_0x71ffe5['contact']['id'],'AttachmentId':_0x434b20[_0xa24c('0x66')][_0xa24c('0xca')]});})[_0xa24c('0x2c')](function(_0x3a1225){_0x71ffe5[_0xa24c('0x22')]=_0x3a1225;if(!_0x71ffe5['interaction'][_0xa24c('0xcb')]){return;}return db[_0xa24c('0xcc')]['find']({'attributes':['id',_0xa24c('0x33')],'where':{'id':_0x71ffe5[_0xa24c('0xc0')][_0xa24c('0xcb')]}});})['then'](function(_0x3a5489){if(_0x3a5489){_0x71ffe5[_0xa24c('0xc5')][_0xa24c('0xcd')]({'id':0x0,'priority':0x0,'app':_0xa24c('0xce'),'appdata':_0x3a5489[_0xa24c('0x33')]+','+(_0x71ffe5[_0xa24c('0xb6')][_0xa24c('0xcf')]||0xa),'interval':_0xa24c('0xc8')});_0x71ffe5[_0xa24c('0xd0')]=!![];}if(!_0x71ffe5[_0xa24c('0xc0')][_0xa24c('0xd1')]){return;}return db[_0xa24c('0xd2')]['find']({'attributes':['id','name'],'where':{'id':_0x71ffe5[_0xa24c('0xc0')][_0xa24c('0xd1')]}});})[_0xa24c('0x2c')](function(_0x31d81e){if(_0x31d81e){_0x71ffe5[_0xa24c('0xc5')][_0xa24c('0xcd')]({'id':0x0,'priority':0x1,'app':_0xa24c('0xd3'),'appdata':_0x31d81e[_0xa24c('0x33')]+','+(_0x71ffe5[_0xa24c('0xb6')][_0xa24c('0xd4')]||0x12c),'interval':_0xa24c('0xc8')});}return respondWithRpcPromise(_0xa24c('0xd5'),'startRouting',_0x71ffe5);})[_0xa24c('0x2c')](function(_0x859222){respondWithRpcPromise('EventManager',_0xa24c('0xd6'),{'event':_0xa24c('0xa0'),'message':_0x859222},client9002);return _0x859222;})[_0xa24c('0x2c')](respondWithResult(_0x4b96bc,null))['catch'](APIHandleError(_0x4b96bc));};exports[_0xa24c('0xd7')]=function(_0x4f0117,_0x2ac6e1){var _0x377caa,_0x1fb039,_0x86a1ee;var _0x2f26d5=[];var _0x130443={};var _0x16ad64=_0x4f0117[_0xa24c('0xd8')]||[];var _0x484236=[];var _0x5934be;return db[_0xa24c('0xa6')]['describe']()[_0xa24c('0x2c')](function(_0x24a74a){if(!_0x24a74a){throw new db[(_0xa24c('0xd9'))][(_0xa24c('0xda'))]('no\x20available\x20attributes');}_0x2f26d5=_['difference'](_['keys'](_0x24a74a),[_0xa24c('0xa8'),'updatedAt',_0xa24c('0xab'),_0xa24c('0xac')]);if(_0x4f0117[_0xa24c('0x66')]['id']){delete _0x4f0117[_0xa24c('0x66')]['id'];}if(_[_0xa24c('0x91')](_0x4f0117[_0xa24c('0x66')][_0xa24c('0xa1')])){throw _0x2ac6e1[_0xa24c('0x25')](0x1f4)[_0xa24c('0x34')](new db[(_0xa24c('0xd9'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x4f0117[_0xa24c('0x66')]['body'])||_0x4f0117[_0xa24c('0x66')][_0xa24c('0x66')]===''){throw _0x2ac6e1[_0xa24c('0x25')](0x1f4)[_0xa24c('0x34')](new db[(_0xa24c('0xd9'))]['ValidationError'](_0xa24c('0xdb')));}if(_[_0xa24c('0x91')](_0x4f0117[_0xa24c('0x66')][_0xa24c('0xdc')])){throw _0x2ac6e1[_0xa24c('0x25')](0x1f4)['send'](new db[(_0xa24c('0xd9'))][(_0xa24c('0xda'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2f26d5));}if(!_[_0xa24c('0xaa')](_0x2f26d5,_0x4f0117['body'][_0xa24c('0xdc')])){throw _0x2ac6e1[_0xa24c('0x25')](0x1f4)['send'](new db[(_0xa24c('0xd9'))][(_0xa24c('0xda'))](_0xa24c('0xdd')+_0x2f26d5));}_0x130443[_0x4f0117[_0xa24c('0x66')]['mapKeyOffline']]=_0x4f0117['body'][_0xa24c('0xa1')];})[_0xa24c('0x2c')](function(){return db[_0xa24c('0x4c')][_0xa24c('0x6f')]({'where':{'id':_0x4f0117['params']['id']},'include':[{'model':db[_0xa24c('0xae')],'as':_0xa24c('0xaf')},{'model':db['MailAccount'],'as':_0xa24c('0xde')}]});})[_0xa24c('0x2c')](handleEntityNotFound(_0x2ac6e1,null))[_0xa24c('0x2c')](function(_0x2391b8){if(_0x2391b8&&_0x2391b8[_0xa24c('0xaf')]){_0x1fb039=_0x2391b8;var _0x445c4c=_[_0xa24c('0x15')](_0x4f0117[_0xa24c('0x66')],{'firstName':_0x4f0117[_0xa24c('0x66')][_0xa24c('0xa1')],'phone':_0x4f0117['body']['from'],'ListId':_0x2391b8['ListId']});_0x445c4c[_0x4f0117['body'][_0xa24c('0xdc')]]=_0x4f0117[_0xa24c('0x66')][_0xa24c('0xa1')];return db[_0xa24c('0xa6')][_0xa24c('0xdf')]({'where':_0x130443,'defaults':_0x445c4c});}})['spread'](function(_0x45f1a4){if(_0x45f1a4){_0x86a1ee=_0x45f1a4;var _0x55f393=fs['readFileSync'](path['join'](config[_0xa24c('0x8e')],'server/files/templates/chatOfflineMessage.ejs'),_0xa24c('0xe0'));var _0xadb53c=ejs['render'](_0x55f393,{'body':_[_0xa24c('0xe1')](_0x4f0117[_0xa24c('0x66')][_0xa24c('0x66')]),'bodyTitle':_0x1fb039[_0xa24c('0xe2')]});return db[_0xa24c('0xe3')][_0xa24c('0x65')]({'body':_0xadb53c,'plainBody':htmlToText[_0xa24c('0xe4')](_0xadb53c),'ContactId':_0x45f1a4['id'],'ChatWebsiteId':_0x1fb039['id']});}})[_0xa24c('0x2c')](function(_0x1ed27a){_0x5934be=_0x1ed27a;if(_0x16ad64['length']){var _0x36c7f7=_0x16ad64[_0xa24c('0x4b')](function(_0x54d69b){return{'name':_0x54d69b[_0xa24c('0xe5')],'basename':_0x54d69b[_0xa24c('0x86')],'type':_0x54d69b['mimetype'],'ChatOfflineMessageId':_0x1ed27a['id']};});_0x484236=_0x36c7f7[_0xa24c('0x4b')](_0x27ed85=>{var _0x58cacb={'filename':_0x27ed85[_0xa24c('0x33')],'path':path[_0xa24c('0x93')](config['root'],_0xa24c('0xe6'),_0xa24c('0xd8'),_0xa24c('0xe7'),_0xa24c('0xe8'),_0x27ed85['basename'])};return _0x58cacb;});if(!_0x1fb039['openNewInteraction']){return db['sequelize'][_0xa24c('0xe9')](function(_0x3ab9ce){return db['Attachment']['bulkCreate'](_0x36c7f7,{'transaction':_0x3ab9ce});});}}})[_0xa24c('0x2c')](function(){if(_0x5934be){_0x377caa=_0x5934be;return db[_0xa24c('0xde')][_0xa24c('0x81')]({'where':{'service':!![]},'include':[{'model':db[_0xa24c('0xea')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0xa24c('0x2c')](function(_0x3451d2){if(_0x3451d2&&_0x3451d2[_0xa24c('0xeb')]&&_0x1fb039[_0xa24c('0xec')]&&_0x1fb039[_0xa24c('0xed')]){var _0x25ec6d=_0x3451d2[_0xa24c('0xee')]();return respondWithRpcPromise(_0xa24c('0xef'),'sendMail',{'account':_0x25ec6d,'message':{'from':util[_0xa24c('0x42')](_0xa24c('0xf0'),_0x3451d2[_0xa24c('0x33')],_0x3451d2[_0xa24c('0xf1')]||_0x3451d2[_0xa24c('0xeb')][_0xa24c('0x6b')]),'to':_0x1fb039[_0xa24c('0xed')],'subject':_0x1fb039[_0xa24c('0xf2')],'html':_0x377caa[_0xa24c('0x66')],'attachments':_0x484236}},client9003)[_0xa24c('0x2c')](function(){return _0x377caa;})[_0xa24c('0x24')](function(_0x17f7af){logger[_0xa24c('0x21')](_0x17f7af);});}})[_0xa24c('0x2c')](function(){if(_0x1fb039&&_0x1fb039[_0xa24c('0xf3')]&&_0x1fb039[_0xa24c('0xf4')]){var _0x337348=[];if(_0x16ad64[_0xa24c('0x55')]){_0x337348=_0x16ad64[_0xa24c('0x4b')](function(_0x7a7914){return{'name':_0x7a7914[_0xa24c('0xe5')],'basename':_0x7a7914[_0xa24c('0x86')],'type':_0x7a7914[_0xa24c('0xf5')],'ChatOfflineMessageId':_0x5934be['id']};});}var _0x249eea;if(!_[_0xa24c('0x91')](_0x1fb039['subjectOffline'])){var _0x27608e=_['map'](_0x4f0117[_0xa24c('0x66')],function(_0x214a6d){return _0x214a6d;});var _0x3c6338=_[_0xa24c('0xf6')](_0x27608e)[0x0];var _0x3ce6ff=_[_0xa24c('0xf7')](_0x3c6338,function(_0x52f327){return _0x52f327;});_0x249eea=_0x3ce6ff[0x1][_0x1fb039[_0xa24c('0xf8')]];}var _0x50aa8c={'from':_0x86a1ee[_0xa24c('0xf1')],'firstName':_0x86a1ee['firstName'],'lastName':_0x86a1ee[_0xa24c('0x3c')],'mapKey':_0xa24c('0xf1'),'message':{'from':_0x86a1ee[_0xa24c('0xf1')],'to':_0x1fb039[_0xa24c('0xde')][_0xa24c('0xf1')],'cc':'','subject':_[_0xa24c('0x91')](_0x249eea)?_0x1fb039[_0xa24c('0xf2')]:_0x249eea,'messageId':'','sentAt':new Date(),'attach':_0x337348['length'],'attachments':_0x337348,'originChannel':_0xa24c('0xf9'),'ChatWebsiteId':_0x1fb039['id'],'ChatOfflineMessageId':_0x377caa['id'],'originTo':_0x1fb039['MailAccount']['email']},'body':_0x377caa[_0xa24c('0x66')]};var _0x2b9206={'account':{'id':_0x1fb039['MailAccountId']},'body':_0x50aa8c,'log':_0xa24c('0xfa')};return respondWithRpcPromise(_0xa24c('0xfa'),_0xa24c('0xfb'),_0x2b9206,client9001)[_0xa24c('0x2c')](function(){return _0x377caa;})[_0xa24c('0x24')](function(_0x149633){logger[_0xa24c('0x21')](_0x149633);});}return;})[_0xa24c('0x2c')](function(){if(_0x377caa){return _0x377caa;}})[_0xa24c('0x2c')](respondWithResult(_0x2ac6e1,null))[_0xa24c('0x24')](function(){for(var _0x2bfc3c of _0x16ad64){var _0x113183=path[_0xa24c('0x93')](config['root'],_0xa24c('0xe6'),_0xa24c('0xd8'),'attachments',_0xa24c('0xe8'),_0x2bfc3c[_0xa24c('0x86')]);fs_extra[_0xa24c('0xfc')](_0x113183)['catch'](function(_0xefb28){logger[_0xa24c('0x21')](_0xa24c('0xfd'),_0x113183,_0xefb28);});}});};exports[_0xa24c('0xfe')]=function(_0x2c582c,_0x1df626){return db['ChatInteraction'][_0xa24c('0x6f')]({'where':{'id':_0x2c582c[_0xa24c('0x63')]['id']}})['then'](handleEntityNotFound(_0x1df626,null))[_0xa24c('0x2c')](function(_0x200245){if(_0x200245){return _0x200245['addInteraction'](_0x2c582c['body'][_0xa24c('0x7e')],_['omit'](_0x2c582c['body'],['ids','id'])||{});}})[_0xa24c('0x2c')](respondWithResult(_0x1df626,null))[_0xa24c('0x24')](handleError(_0x1df626,null));};exports[_0xa24c('0xff')]=function(_0x13eaa8,_0x343600){var _0x38dfb0={'raw':![],'where':{}};var _0x8120f3={};var _0x198ee1={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x13eaa8[_0xa24c('0x63')]['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x343600,null))['then'](function(_0xecfe9){if(_0xecfe9){_0x8120f3[_0xa24c('0x46')]=_[_0xa24c('0x50')](db[_0xa24c('0xbc')]['rawAttributes']);_0x8120f3[_0xa24c('0x4f')]=_[_0xa24c('0x50')](_0x13eaa8[_0xa24c('0x4f')]);_0x8120f3[_0xa24c('0x51')]=_[_0xa24c('0x52')](_0x8120f3['model'],_0x8120f3[_0xa24c('0x4f')]);_0x38dfb0[_0xa24c('0x54')]=_[_0xa24c('0x52')](_0x8120f3[_0xa24c('0x46')],qs['fields'](_0x13eaa8['query'][_0xa24c('0x53')]));_0x38dfb0[_0xa24c('0x54')]=_0x38dfb0[_0xa24c('0x54')]['length']?_0x38dfb0[_0xa24c('0x54')]:_0x8120f3[_0xa24c('0x46')];if(!_0x13eaa8[_0xa24c('0x4f')][_0xa24c('0x7b')](_0xa24c('0x56'))){_0x38dfb0[_0xa24c('0x29')]=qs['limit'](_0x13eaa8[_0xa24c('0x4f')]['limit']);_0x38dfb0[_0xa24c('0x28')]=qs[_0xa24c('0x28')](_0x13eaa8[_0xa24c('0x4f')][_0xa24c('0x28')]);}_0x38dfb0[_0xa24c('0x57')]=qs[_0xa24c('0x58')](_0x13eaa8[_0xa24c('0x4f')][_0xa24c('0x58')]);_0x38dfb0[_0xa24c('0x59')]=qs[_0xa24c('0x51')](_[_0xa24c('0x7c')](_0x13eaa8['query'],_0x8120f3[_0xa24c('0x51')]));_0x38dfb0[_0xa24c('0x59')][_0xa24c('0x78')]=_0xecfe9['id'];if(_0x13eaa8['query'][_0xa24c('0x5a')]){_0x38dfb0[_0xa24c('0x59')]=_[_0xa24c('0x5c')](_0x38dfb0['where'],{'$or':_[_0xa24c('0x4b')](_0x38dfb0[_0xa24c('0x54')],function(_0x1ecbe0){var _0x393444={};_0x393444[_0x1ecbe0]={'$like':'%'+_0x13eaa8[_0xa24c('0x4f')]['filter']+'%'};return _0x393444;})});}_0x38dfb0=_[_0xa24c('0x5c')]({},_0x38dfb0,_0x13eaa8[_0xa24c('0x64')]);return db[_0xa24c('0xbc')]['count']({'where':_0x38dfb0[_0xa24c('0x59')]})[_0xa24c('0x2c')](function(_0x53cfcb){_0x198ee1[_0xa24c('0x5d')]=_0x53cfcb;if(_0x13eaa8[_0xa24c('0x4f')][_0xa24c('0x5e')]){_0x38dfb0[_0xa24c('0x5f')]=[{'model':db['CmContact'],'as':_0xa24c('0x100'),'required':![]},{'model':db[_0xa24c('0xcc')],'as':_0xa24c('0x101'),'attributes':[_0xa24c('0x33'),_0xa24c('0x102'),'internal'],'required':![]},{'model':db[_0xa24c('0x103')],'as':_0xa24c('0x104'),'attributes':['id',_0xa24c('0x33'),'color'],'where':_0x13eaa8['query'][_0xa24c('0x105')]?{'id':_0x13eaa8[_0xa24c('0x4f')][_0xa24c('0x105')]}:undefined,'required':_0x13eaa8[_0xa24c('0x4f')]['tag']?!![]:![]}];}return db[_0xa24c('0xbc')][_0xa24c('0x60')](_0x38dfb0);})[_0xa24c('0x2c')](function(_0x49b2cc){_0x198ee1['rows']=_0x49b2cc;return _0x198ee1;});}})[_0xa24c('0x2c')](respondWithFilteredResult(_0x343600,_0x38dfb0))[_0xa24c('0x24')](handleError(_0x343600,null));};exports[_0xa24c('0x106')]=function(_0x179399,_0x252022){var _0x1b8906=0x0;var _0x1e07c1=0x0;var _0x2d35a2=![];var _0x3381e3;var _0x28a012;return db[_0xa24c('0x4c')][_0xa24c('0x6f')]({'where':{'id':_0x179399['params']['id']},'include':[{'model':db['Interval'],'as':_0xa24c('0xb2'),'include':[{'model':db[_0xa24c('0xb2')],'as':_0xa24c('0x107'),'attributes':['id','interval']}]}]})['then'](handleEntityNotFound(_0x252022,null))['then'](function(_0x3da2f2){if(_0x3da2f2){_0x3381e3=_0x3da2f2;return _0x3da2f2[_0xa24c('0x108')]({'raw':!![]});}})[_0xa24c('0x2c')](function(_0x1419da){if(_0x3381e3){if(_0x1419da){_0x28a012=_0x1419da;}}return require(_0xa24c('0x109'))[_0xa24c('0x90')]();})['then'](function(_0x41b6b7){if(_0x41b6b7){_0x1e07c1=_0x41b6b7[_0xa24c('0x10a')];_0x2d35a2=_0x41b6b7['custom'];}})['then'](function(){return db['ChatInteraction'][_0xa24c('0x5d')]({'where':{'closed':![]}});})[_0xa24c('0x2c')](function(_0x543ba3){_0x1b8906=_0x543ba3;if(_0x1e07c1&&_0x543ba3>_0x1e07c1){return db[_0xa24c('0x10b')][_0xa24c('0x81')]({'where':{'id':0x1}})[_0xa24c('0x2c')](function(_0x234fec){if(_0x234fec){_0x234fec['increment']('chatLicenseExceeded');}});}})[_0xa24c('0x2c')](function(){var _0x3403d6=_0x3381e3[_0xa24c('0xb2')];var _0x37c6c7=_0x3381e3[_0xa24c('0x9e')]||undefined;return _0x3403d6?_0x3403d6[_0xa24c('0x9f')](_0x37c6c7):!![];})[_0xa24c('0x2c')](function(_0xfb8f2){var _0x353b41=fs[_0xa24c('0x10c')](path[_0xa24c('0x93')](config['root'],_0xa24c('0x10d')),_0xa24c('0xe0'));var _0x37a4b9=_0xa24c('0x10e');var _0x25f814=![];var _0x43d691,_0x28ea92;if(_0x179399[_0xa24c('0xb9')][_0xa24c('0x3e')]){_0x43d691=new URL(_0x179399['headers'][_0xa24c('0x3e')])[_0xa24c('0x10f')];}else if(_0x179399[_0xa24c('0xb9')][_0xa24c('0x10f')]){_0x43d691=new URL(_0x179399['headers'][_0xa24c('0x10f')])[_0xa24c('0x10f')];}else{_0x43d691=_0xa24c('0x110');}_0x28ea92=typeof _0x3381e3[_0xa24c('0x67')][_0xa24c('0x68')](',')[_0xa24c('0x6f')](function(_0x244b0e){return wildcardUtils['testWebsiteWithWildcard'](_0x244b0e,_0x43d691);})!==_0xa24c('0x2a');var _0x150e67={'chatVersion':_0x37a4b9,'chatWebsiteAddressOrigin':_0x28ea92?_0x43d691:_0x3381e3['address'],'remote':_0x3381e3[_0xa24c('0x111')],'query':querystring[_0xa24c('0x20')](_[_0xa24c('0x5c')](_0x3381e3[_0xa24c('0x2d')]({'plain':!![]}),{'customerIp':_0x179399[_0xa24c('0xb9')]['x-forwarded-for']||_0x179399[_0xa24c('0xb9')][_0xa24c('0x112')]||_0x179399[_0xa24c('0x113')][_0xa24c('0x114')]||_0x179399['ip'],'referer':_0x179399['headers'][_0xa24c('0x3e')],'openedInteractions':_0x1b8906,'maxInteractions':_0x1e07c1,'virtual':_0x2d35a2['virtual'],'online':_0xfb8f2,'custom':_0x2d35a2,'address':_0x28ea92?_0x43d691:null}))[_0xa24c('0x115')](/'/g,'\x5c\x27')};_0x252022['send'](ejs['render'](Mustache[_0xa24c('0x116')](_0x353b41,_0x150e67),{'proactiveActions':_0x28a012,'alignment':_0x3381e3[_0xa24c('0x117')],'verticalAlignment':_0x3381e3['verticalAlignment'],'div_color':_0x3381e3[_0xa24c('0x118')],'labelText':_0x3381e3[_0xa24c('0x119')],'text_color':_0x3381e3['textColor'],'text_button_color':_0x3381e3['textButtonColor'],'button_color':_0x3381e3[_0xa24c('0x11a')],'background_color':_0x3381e3[_0xa24c('0x11b')],'hideWhenOffline':_0x3381e3[_0xa24c('0x11c')],'intervalId':_0x3381e3[_0xa24c('0x11d')],'isDevelopment':_0x25f814,'chatVersion':_0x37a4b9}));})[_0xa24c('0x24')](handleError(_0x252022,null));};exports[_0xa24c('0x11e')]=function(_0x38619c,_0x3cf704){var _0xa42a46=_0x38619c[_0xa24c('0x63')]['id'];var _0x546384=_0x38619c[_0xa24c('0x66')];var _0x249b58=0xc8;var _0x265f31=null;return db['sequelize'][_0xa24c('0xe9')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0xa24c('0x11f')]},function(_0x1bf0e4){return db[_0xa24c('0x4c')][_0xa24c('0x81')]({'where':{'id':_0xa42a46},'transaction':_0x1bf0e4})['then'](function(_0x25e73a){if(_0x25e73a){return db[_0xa24c('0x120')]['destroy']({'where':{'ChatWebsiteId':_0xa42a46},'transaction':_0x1bf0e4})[_0xa24c('0x2c')](function(){var _0x541e87=_[_0xa24c('0x4b')](_0x546384,function(_0x40df45){_0x40df45['ChatWebsiteId']=_0xa42a46;return _0x40df45;});return db[_0xa24c('0x120')][_0xa24c('0x121')](_0x541e87,{'transaction':_0x1bf0e4});});}else{_0x249b58=0x194;_0x265f31=[];}});})['then'](function(){if(_0x249b58!==0x194){return db[_0xa24c('0x120')][_0xa24c('0x122')]({'where':{'ChatWebsiteId':_0xa42a46},'order':_0xa24c('0xb5')})[_0xa24c('0x2c')](function(_0x36510c){_0x265f31=_0x36510c;});}})['catch'](function(_0x59ca07){_0x249b58=0x1f4;logger['error'](_0x59ca07[_0xa24c('0x32')]);if(_0x59ca07[_0xa24c('0x33')]){delete _0x59ca07[_0xa24c('0x33')];}_0x265f31=_0x59ca07;})[_0xa24c('0x123')](function(){if(_0x265f31===null){_0x3cf704[_0xa24c('0x31')](_0x249b58);}else{if(_0x249b58===0x1f4){_0x3cf704[_0xa24c('0x25')](_0x249b58)[_0xa24c('0x34')](_0x265f31);}else{_0x3cf704['status'](_0x249b58)[_0xa24c('0x27')](_0x265f31);}}});};exports['getApplications']=function(_0x31f0cd,_0x4ee9bd){var _0x3327c9={};var _0x30cef0={};var _0x2e35a7;var _0x414a04;return db[_0xa24c('0x4c')][_0xa24c('0x81')]({'where':{'id':_0x31f0cd[_0xa24c('0x63')]['id']}})['then'](handleEntityNotFound(_0x4ee9bd,null))[_0xa24c('0x2c')](function(_0x241350){if(_0x241350){_0x2e35a7=_0x241350;_0x30cef0['model']=_[_0xa24c('0x50')](db[_0xa24c('0x120')]['rawAttributes']);_0x30cef0[_0xa24c('0x4f')]=_['keys'](_0x31f0cd[_0xa24c('0x4f')]);_0x30cef0[_0xa24c('0x51')]=_[_0xa24c('0x52')](_0x30cef0[_0xa24c('0x46')],_0x30cef0[_0xa24c('0x4f')]);_0x3327c9[_0xa24c('0x54')]=_[_0xa24c('0x52')](_0x30cef0['model'],qs[_0xa24c('0x53')](_0x31f0cd['query'][_0xa24c('0x53')]));_0x3327c9[_0xa24c('0x54')]=_0x3327c9['attributes'][_0xa24c('0x55')]?_0x3327c9[_0xa24c('0x54')]:_0x30cef0[_0xa24c('0x46')];_0x3327c9[_0xa24c('0x57')]=qs[_0xa24c('0x58')](_0x31f0cd[_0xa24c('0x4f')][_0xa24c('0x58')]);_0x3327c9[_0xa24c('0x59')]=qs['filters'](_[_0xa24c('0x7c')](_0x31f0cd[_0xa24c('0x4f')],_0x30cef0[_0xa24c('0x51')]));if(_0x31f0cd[_0xa24c('0x4f')][_0xa24c('0x5a')]){_0x3327c9[_0xa24c('0x59')]=_['merge'](_0x3327c9[_0xa24c('0x59')],{'$or':_[_0xa24c('0x4b')](_0x3327c9[_0xa24c('0x54')],function(_0x119ec5){var _0x58eecc={};_0x58eecc[_0x119ec5]={'$like':'%'+_0x31f0cd['query'][_0xa24c('0x5a')]+'%'};return _0x58eecc;})});}_0x3327c9=_[_0xa24c('0x5c')]({},_0x3327c9,_0x31f0cd[_0xa24c('0x64')]);return _0x2e35a7['getApplications'](_0x3327c9);}})[_0xa24c('0x2c')](function(_0x281f2b){if(_0x281f2b){_0x414a04=_0x281f2b[_0xa24c('0x55')];if(!_0x31f0cd[_0xa24c('0x4f')][_0xa24c('0x7b')]('nolimit')){_0x3327c9['limit']=qs['limit'](_0x31f0cd[_0xa24c('0x4f')][_0xa24c('0x29')]);_0x3327c9['offset']=qs[_0xa24c('0x28')](_0x31f0cd[_0xa24c('0x4f')][_0xa24c('0x28')]);}return _0x2e35a7[_0xa24c('0x124')](_0x3327c9);}})[_0xa24c('0x2c')](function(_0x37e996){if(_0x37e996){return _0x37e996?{'count':_0x414a04,'rows':_0x37e996}:null;}})[_0xa24c('0x2c')](respondWithResult(_0x4ee9bd,null))[_0xa24c('0x24')](handleError(_0x4ee9bd,null));};exports['addProactiveActions']=function(_0x1e937a,_0x205925){return db['chatProactiveAction'][_0xa24c('0x6f')]({'where':{'id':_0x1e937a[_0xa24c('0x63')]['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x205925,null))[_0xa24c('0x2c')](function(_0x7d22c7){if(_0x7d22c7){return _0x7d22c7[_0xa24c('0x125')](_0x1e937a[_0xa24c('0x66')][_0xa24c('0x7e')],_[_0xa24c('0x126')](_0x1e937a['body'],['ids','id'])||{});}})[_0xa24c('0x2c')](respondWithResult(_0x205925,null))[_0xa24c('0x24')](handleError(_0x205925,null));};exports['getProactiveActions']=function(_0x2955a5,_0x1ead4e){var _0xf49fc={};var _0x41083b={};var _0x100b83;var _0x2ca3d4;return db['ChatWebsite'][_0xa24c('0x81')]({'where':{'id':_0x2955a5['params']['id']}})['then'](handleEntityNotFound(_0x1ead4e,null))['then'](function(_0x51da98){if(_0x51da98){_0x100b83=_0x51da98;_0x41083b[_0xa24c('0x46')]=_[_0xa24c('0x50')](db[_0xa24c('0x127')][_0xa24c('0x4d')]);_0x41083b[_0xa24c('0x4f')]=_[_0xa24c('0x50')](_0x2955a5['query']);_0x41083b['filters']=_[_0xa24c('0x52')](_0x41083b[_0xa24c('0x46')],_0x41083b[_0xa24c('0x4f')]);_0xf49fc[_0xa24c('0x54')]=_[_0xa24c('0x52')](_0x41083b['model'],qs[_0xa24c('0x53')](_0x2955a5[_0xa24c('0x4f')][_0xa24c('0x53')]));_0xf49fc[_0xa24c('0x54')]=_0xf49fc[_0xa24c('0x54')][_0xa24c('0x55')]?_0xf49fc[_0xa24c('0x54')]:_0x41083b['model'];_0xf49fc[_0xa24c('0x57')]=qs[_0xa24c('0x58')](_0x2955a5['query'][_0xa24c('0x58')]);_0xf49fc['where']=qs[_0xa24c('0x51')](_[_0xa24c('0x7c')](_0x2955a5['query'],_0x41083b[_0xa24c('0x51')]));if(_0x2955a5[_0xa24c('0x4f')][_0xa24c('0x5a')]){_0xf49fc[_0xa24c('0x59')]=_['merge'](_0xf49fc[_0xa24c('0x59')],{'$or':_['map'](_0xf49fc[_0xa24c('0x54')],function(_0x297eee){var _0x41a7c6={};_0x41a7c6[_0x297eee]={'$like':'%'+_0x2955a5[_0xa24c('0x4f')][_0xa24c('0x5a')]+'%'};return _0x41a7c6;})});}_0xf49fc=_['merge']({},_0xf49fc,_0x2955a5[_0xa24c('0x64')]);return _0x100b83[_0xa24c('0x108')](_0xf49fc);}})[_0xa24c('0x2c')](function(_0x477625){if(_0x477625){_0x2ca3d4=_0x477625['length'];if(!_0x2955a5[_0xa24c('0x4f')]['hasOwnProperty'](_0xa24c('0x56'))){_0xf49fc[_0xa24c('0x29')]=qs['limit'](_0x2955a5[_0xa24c('0x4f')][_0xa24c('0x29')]);_0xf49fc[_0xa24c('0x28')]=qs['offset'](_0x2955a5[_0xa24c('0x4f')][_0xa24c('0x28')]);}return _0x100b83[_0xa24c('0x108')](_0xf49fc);}})['then'](function(_0x282989){if(_0x282989){return _0x282989?{'count':_0x2ca3d4,'rows':_0x282989}:null;}})[_0xa24c('0x2c')](respondWithResult(_0x1ead4e,null))['catch'](handleError(_0x1ead4e,null));};exports[_0xa24c('0x128')]=function(_0x16a7ea,_0x239973){var _0x3ccbe8=_0x16a7ea['query'][_0xa24c('0x129')]===_0xa24c('0x12a')?_0xa24c('0x12b'):_0xa24c('0x12c');return db[_0xa24c('0x4c')][_0xa24c('0x6f')]({'attributes':['id',_0x3ccbe8],'where':{'id':_0x16a7ea[_0xa24c('0x63')]['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x239973,null))['then'](function(_0x52d989){if(_0x52d989){var _0x56269f=_0x52d989[_0x3ccbe8];var _0x321c06=_0x56269f&&_0x56269f['items']?_0x56269f[_0xa24c('0x12d')]:[];_0x239973[_0xa24c('0x34')]({'fromKey':_[_0xa24c('0x91')](_0x56269f[_0xa24c('0x12e')])?undefined:_0x56269f[_0xa24c('0x12e')],'count':_0x321c06[_0xa24c('0x55')],'rows':_0x321c06});}})[_0xa24c('0x24')](handleError(_0x239973,null));};exports[_0xa24c('0x12f')]=function(_0x43bdd9,_0x51691c){var _0xa194eb={'raw':![],'where':{}};var _0x286dca={};var _0x386e6e={'count':0x0,'rows':[]};return db[_0xa24c('0x4c')][_0xa24c('0x81')]({'where':{'id':_0x43bdd9[_0xa24c('0x63')]['id']}})['then'](handleEntityNotFound(_0x51691c,null))[_0xa24c('0x2c')](function(_0x8e6737){if(_0x8e6737){_0x286dca[_0xa24c('0x46')]=_['keys'](db[_0xa24c('0xe3')]['rawAttributes']);_0x286dca[_0xa24c('0x4f')]=_[_0xa24c('0x50')](_0x43bdd9[_0xa24c('0x4f')]);_0x286dca['filters']=_[_0xa24c('0x52')](_0x286dca[_0xa24c('0x46')],_0x286dca['query']);_0xa194eb[_0xa24c('0x54')]=_[_0xa24c('0x52')](_0x286dca[_0xa24c('0x46')],qs[_0xa24c('0x53')](_0x43bdd9[_0xa24c('0x4f')][_0xa24c('0x53')]));_0xa194eb[_0xa24c('0x54')]=_0xa194eb[_0xa24c('0x54')]['length']?_0xa194eb['attributes']:_0x286dca[_0xa24c('0x46')];if(!_0x43bdd9[_0xa24c('0x4f')]['hasOwnProperty']('nolimit')){_0xa194eb['limit']=qs[_0xa24c('0x29')](_0x43bdd9['query'][_0xa24c('0x29')]);_0xa194eb[_0xa24c('0x28')]=qs['offset'](_0x43bdd9[_0xa24c('0x4f')][_0xa24c('0x28')]);}_0xa194eb['order']=qs[_0xa24c('0x58')](_0x43bdd9[_0xa24c('0x4f')]['sort']);_0xa194eb[_0xa24c('0x59')]=qs[_0xa24c('0x51')](_[_0xa24c('0x7c')](_0x43bdd9['query'],_0x286dca[_0xa24c('0x51')]));_0xa194eb[_0xa24c('0x59')][_0xa24c('0x78')]=_0x8e6737['id'];if(_0x43bdd9[_0xa24c('0x4f')]['filter']){_0xa194eb[_0xa24c('0x59')]=_['merge'](_0xa194eb['where'],{'$or':_[_0xa24c('0x4b')](_0xa194eb['attributes'],function(_0x54061c){var _0x2a2653={};_0x2a2653[_0x54061c]={'$like':'%'+_0x43bdd9[_0xa24c('0x4f')][_0xa24c('0x5a')]+'%'};return _0x2a2653;})});}_0xa194eb=_[_0xa24c('0x5c')]({},_0xa194eb,_0x43bdd9[_0xa24c('0x64')]);return db[_0xa24c('0xe3')][_0xa24c('0x5d')]({'where':_0xa194eb['where']})['then'](function(_0x475b4d){_0x386e6e['count']=_0x475b4d;if(_0x43bdd9[_0xa24c('0x4f')][_0xa24c('0x5e')]){_0xa194eb[_0xa24c('0x5f')]=[{'all':!![]}];}else{_0xa194eb['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xa24c('0x130')],'as':_0xa24c('0x131'),'required':![]}];}return db[_0xa24c('0xe3')][_0xa24c('0x60')](_0xa194eb);})[_0xa24c('0x2c')](function(_0x502912){_0x386e6e[_0xa24c('0x61')]=_0x502912;return _0x386e6e;});}})[_0xa24c('0x2c')](respondWithFilteredResult(_0x51691c,_0xa194eb))[_0xa24c('0x24')](handleError(_0x51691c,null));};exports[_0xa24c('0x132')]=function(_0x233d3b,_0x40dd91){return db[_0xa24c('0x4c')][_0xa24c('0x6f')]({'where':{'id':_0x233d3b[_0xa24c('0x63')]['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x40dd91,null))[_0xa24c('0x2c')](function(_0x3b5c61){if(_0x3b5c61){return _0x3b5c61[_0xa24c('0x132')](_0x233d3b[_0xa24c('0x66')][_0xa24c('0x7e')],_[_0xa24c('0x126')](_0x233d3b[_0xa24c('0x66')],['ids','id'])||{})['spread'](function(_0x38a5dc){for(var _0x10ea95=0x0;_0x10ea95<_0x233d3b['body']['ids'][_0xa24c('0x55')];_0x10ea95+=0x1){socket[_0xa24c('0x133')]('userChatWebsite:save',{'UserId':Number(_0x233d3b[_0xa24c('0x66')][_0xa24c('0x7e')][_0x10ea95]),'ChatWebsiteId':Number(_0x233d3b[_0xa24c('0x63')]['id'])});}return _0x38a5dc;});}})[_0xa24c('0x2c')](respondWithResult(_0x40dd91,null))['catch'](handleError(_0x40dd91,null));};exports['removeAgents']=function(_0x38b73d,_0x502316){return db[_0xa24c('0x4c')][_0xa24c('0x6f')]({'where':{'id':_0x38b73d['params']['id']}})[_0xa24c('0x2c')](handleEntityNotFound(_0x502316,null))[_0xa24c('0x2c')](function(_0x98a454){if(_0x98a454){return _0x98a454[_0xa24c('0x134')](_0x38b73d[_0xa24c('0x4f')][_0xa24c('0x7e')])[_0xa24c('0x2c')](function(){if(_[_0xa24c('0x135')](_0x38b73d['query'][_0xa24c('0x7e')])){for(var _0x1e077f=0x0;_0x1e077f<_0x38b73d[_0xa24c('0x4f')][_0xa24c('0x7e')][_0xa24c('0x55')];_0x1e077f+=0x1){socket[_0xa24c('0x133')](_0xa24c('0x136'),{'UserId':Number(_0x38b73d[_0xa24c('0x4f')][_0xa24c('0x7e')][_0x1e077f]),'ChatWebsiteId':Number(_0x38b73d[_0xa24c('0x63')]['id'])});}}else{socket[_0xa24c('0x133')](_0xa24c('0x136'),{'UserId':Number(_0x38b73d[_0xa24c('0x4f')][_0xa24c('0x7e')]),'ChatWebsiteId':Number(_0x38b73d['params']['id'])});}});}})[_0xa24c('0x2c')](respondWithStatusCode(_0x502316,null))['catch'](handleError(_0x502316,null));};exports['getAgents']=function(_0x313f19,_0x27077c){var _0x2b466b={};var _0x167f45={};var _0x34bbcf;var _0x1571ce;return db[_0xa24c('0x4c')][_0xa24c('0x81')]({'where':{'id':_0x313f19['params']['id']}})['then'](handleEntityNotFound(_0x27077c,null))[_0xa24c('0x2c')](function(_0x5e7ba6){if(_0x5e7ba6){_0x34bbcf=_0x5e7ba6;_0x167f45[_0xa24c('0x46')]=_[_0xa24c('0x50')](db[_0xa24c('0xcc')][_0xa24c('0x4d')]);_0x167f45[_0xa24c('0x4f')]=_[_0xa24c('0x50')](_0x313f19[_0xa24c('0x4f')]);_0x167f45[_0xa24c('0x51')]=_[_0xa24c('0x52')](_0x167f45[_0xa24c('0x46')],_0x167f45[_0xa24c('0x4f')]);_0x2b466b['attributes']=_[_0xa24c('0x52')](_0x167f45[_0xa24c('0x46')],qs[_0xa24c('0x53')](_0x313f19[_0xa24c('0x4f')]['fields']));_0x2b466b[_0xa24c('0x54')]=_0x2b466b[_0xa24c('0x54')]['length']?_0x2b466b['attributes']:_0x167f45[_0xa24c('0x46')];_0x2b466b[_0xa24c('0x57')]=qs[_0xa24c('0x58')](_0x313f19[_0xa24c('0x4f')][_0xa24c('0x58')]);_0x2b466b[_0xa24c('0x59')]=qs[_0xa24c('0x51')](_[_0xa24c('0x7c')](_0x313f19[_0xa24c('0x4f')],_0x167f45[_0xa24c('0x51')]));if(_0x313f19[_0xa24c('0x4f')][_0xa24c('0x5a')]){_0x2b466b[_0xa24c('0x59')]=_['merge'](_0x2b466b['where'],{'$or':_[_0xa24c('0x4b')](_0x2b466b['attributes'],function(_0x3f007a){var _0x4b1256={};_0x4b1256[_0x3f007a]={'$like':'%'+_0x313f19[_0xa24c('0x4f')]['filter']+'%'};return _0x4b1256;})});}_0x2b466b=_['merge']({},_0x2b466b,_0x313f19['options']);return _0x34bbcf[_0xa24c('0x137')](_0x2b466b);}})[_0xa24c('0x2c')](function(_0x17e8db){if(_0x17e8db){_0x1571ce=_0x17e8db[_0xa24c('0x55')];if(!_0x313f19['query'][_0xa24c('0x7b')](_0xa24c('0x56'))){_0x2b466b[_0xa24c('0x29')]=qs['limit'](_0x313f19[_0xa24c('0x4f')]['limit']);_0x2b466b[_0xa24c('0x28')]=qs[_0xa24c('0x28')](_0x313f19[_0xa24c('0x4f')]['offset']);}return _0x34bbcf[_0xa24c('0x137')](_0x2b466b);}})['then'](function(_0x52d95e){if(_0x52d95e){return _0x52d95e?{'count':_0x1571ce,'rows':_0x52d95e}:null;}})['then'](respondWithResult(_0x27077c,null))[_0xa24c('0x24')](handleError(_0x27077c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 3f9e110..85cd785 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 _0x4f99=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x1bad6a,_0x55e7b5){var _0x8e15cf=function(_0x23f80c){while(--_0x23f80c){_0x1bad6a['push'](_0x1bad6a['shift']());}};_0x8e15cf(++_0x55e7b5);}(_0x4f99,0x157));var _0x94f9=function(_0x377899,_0xd248ce){_0x377899=_0x377899-0x0;var _0x3a494b=_0x4f99[_0x377899];return _0x3a494b;};'use strict';var EventEmitter=require(_0x94f9('0x0'));var ChatWebsite=require(_0x94f9('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x94f9('0x2')](0x0);var events={'afterCreate':_0x94f9('0x3'),'afterUpdate':_0x94f9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x15ff7c){return function(_0x879bc2,_0x560634,_0x1b4831){ChatWebsiteEvents[_0x94f9('0x5')](_0x15ff7c+':'+_0x879bc2['id'],_0x879bc2);ChatWebsiteEvents[_0x94f9('0x5')](_0x15ff7c,_0x879bc2);_0x1b4831(null);};}for(var e in events){if(events[_0x94f9('0x6')](e)){var event=events[e];ChatWebsite[_0x94f9('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xd846=['../../mysqldb','ChatWebsite','update','emit','hook','exports','events'];(function(_0x31ae77,_0x1c0eab){var _0x4f5294=function(_0x27295a){while(--_0x27295a){_0x31ae77['push'](_0x31ae77['shift']());}};_0x4f5294(++_0x1c0eab);}(_0xd846,0x195));var _0x6d84=function(_0x325087,_0x464da6){_0x325087=_0x325087-0x0;var _0x11b08e=_0xd846[_0x325087];return _0x11b08e;};'use strict';var EventEmitter=require(_0x6d84('0x0'));var ChatWebsite=require(_0x6d84('0x1'))['db'][_0x6d84('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d84('0x3'),'afterDestroy':'remove'};function emitEvent(_0x47e90f){return function(_0x15fb0c,_0xa19796,_0x5c2176){ChatWebsiteEvents[_0x6d84('0x4')](_0x47e90f+':'+_0x15fb0c['id'],_0x15fb0c);ChatWebsiteEvents['emit'](_0x47e90f,_0x15fb0c);_0x5c2176(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x6d84('0x5')](e,emitEvent(event));}}module[_0x6d84('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ec97ec2..4c9a7be 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 _0x4a85=['exports','ChatWebsite','lodash','util','../../config/logger','moment','request-promise','path','./chatWebsite.attributes'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x4a85,0xfe));var _0x54a8=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x4a85[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x54a8('0x0'));var util=require(_0x54a8('0x1'));var logger=require(_0x54a8('0x2'))('api');var moment=require(_0x54a8('0x3'));var BPromise=require('bluebird');var rp=require(_0x54a8('0x4'));var fs=require('fs');var path=require(_0x54a8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x54a8('0x6'));module[_0x54a8('0x7')]=function(_0x3aaa80,_0x4d52e5){return _0x3aaa80['define'](_0x54a8('0x8'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a62=['bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment'];(function(_0x13a2e5,_0x1a433d){var _0x51a129=function(_0x3675ef){while(--_0x3675ef){_0x13a2e5['push'](_0x13a2e5['shift']());}};_0x51a129(++_0x1a433d);}(_0x9a62,0x127));var _0x29a6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9a62[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x29a6('0x0'));var util=require(_0x29a6('0x1'));var logger=require(_0x29a6('0x2'))(_0x29a6('0x3'));var moment=require(_0x29a6('0x4'));var BPromise=require(_0x29a6('0x5'));var rp=require(_0x29a6('0x6'));var fs=require('fs');var path=require(_0x29a6('0x7'));var rimraf=require(_0x29a6('0x8'));var config=require(_0x29a6('0x9'));var attributes=require(_0x29a6('0xa'));module[_0x29a6('0xb')]=function(_0x426836,_0x59e3d1){return _0x426836[_0x29a6('0xc')](_0x29a6('0xd'),attributes,{'tableName':_0x29a6('0xe'),'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 9f826e4..adf50c3 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 _0xbd35=['then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','register','request'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0xbd35,0x110));var _0x5bd3=function(_0x45084c,_0x5350a8){_0x45084c=_0x45084c-0x0;var _0xcd443=_0xbd35[_0x45084c];return _0xcd443;};'use strict';var _=require(_0x5bd3('0x0'));var util=require(_0x5bd3('0x1'));var moment=require(_0x5bd3('0x2'));var BPromise=require(_0x5bd3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bd3('0x4'))['db'];var utils=require(_0x5bd3('0x5'));var logger=require(_0x5bd3('0x6'))(_0x5bd3('0x7'));var config=require('../../config/environment');var jayson=require(_0x5bd3('0x8'));var client=jayson[_0x5bd3('0x9')]['http']({'port':0x232a});config[_0x5bd3('0xa')]=_[_0x5bd3('0xb')](config[_0x5bd3('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x5bd3('0xc')](socket);function respondWithRpcPromise(_0xdb60e4,_0x52c404,_0x498624){return new BPromise(function(_0x40346c,_0x54141c){return client[_0x5bd3('0xd')](_0xdb60e4,_0x498624)[_0x5bd3('0xe')](function(_0x4d4f96){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x52c404,_0x5bd3('0xf'));logger[_0x5bd3('0x10')](_0x5bd3('0x11'),_0x52c404,_0x5bd3('0xf'),JSON[_0x5bd3('0x12')](_0x4d4f96));if(_0x4d4f96[_0x5bd3('0x13')]){if(_0x4d4f96[_0x5bd3('0x13')][_0x5bd3('0x14')]===0x1f4){logger['error'](_0x5bd3('0x15'),_0x52c404,_0x4d4f96['error'][_0x5bd3('0x16')]);return _0x54141c(_0x4d4f96[_0x5bd3('0x13')][_0x5bd3('0x16')]);}logger[_0x5bd3('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x52c404,_0x4d4f96[_0x5bd3('0x13')][_0x5bd3('0x16')]);return _0x40346c(_0x4d4f96[_0x5bd3('0x13')][_0x5bd3('0x16')]);}else{logger[_0x5bd3('0x17')](_0x5bd3('0x15'),_0x52c404,_0x5bd3('0xf'));_0x40346c(_0x4d4f96[_0x5bd3('0x18')]['message']);}})[_0x5bd3('0x19')](function(_0x310f1a){logger[_0x5bd3('0x13')](_0x5bd3('0x15'),_0x52c404,_0x310f1a);_0x54141c(_0x310f1a);});});} \ No newline at end of file +var _0x86d8=['client','http','defaults','redis','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0x86d8,0x171));var _0x886d=function(_0xee81a7,_0x45d750){_0xee81a7=_0xee81a7-0x0;var _0x4aa7fd=_0x86d8[_0xee81a7];return _0x4aa7fd;};'use strict';var _=require('lodash');var util=require(_0x886d('0x0'));var moment=require(_0x886d('0x1'));var BPromise=require(_0x886d('0x2'));var rs=require(_0x886d('0x3'));var fs=require('fs');var Redis=require(_0x886d('0x4'));var db=require(_0x886d('0x5'))['db'];var utils=require(_0x886d('0x6'));var logger=require(_0x886d('0x7'))('rpc');var config=require(_0x886d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x886d('0x9')][_0x886d('0xa')]({'port':0x232a});config['redis']=_[_0x886d('0xb')](config[_0x886d('0xc')],{'host':_0x886d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x886d('0xc')]));require(_0x886d('0xe'))[_0x886d('0xf')](socket);function respondWithRpcPromise(_0xb2fb8e,_0x3512ff,_0x47f5c0){return new BPromise(function(_0x4bd81f,_0x54a110){return client[_0x886d('0x10')](_0xb2fb8e,_0x47f5c0)[_0x886d('0x11')](function(_0x1ec015){logger[_0x886d('0x12')](_0x886d('0x13'),_0x3512ff,_0x886d('0x14'));logger[_0x886d('0x15')](_0x886d('0x16'),_0x3512ff,_0x886d('0x14'),JSON['stringify'](_0x1ec015));if(_0x1ec015[_0x886d('0x17')]){if(_0x1ec015['error']['code']===0x1f4){logger[_0x886d('0x17')](_0x886d('0x13'),_0x3512ff,_0x1ec015[_0x886d('0x17')]['message']);return _0x54a110(_0x1ec015[_0x886d('0x17')][_0x886d('0x18')]);}logger[_0x886d('0x17')](_0x886d('0x13'),_0x3512ff,_0x1ec015[_0x886d('0x17')][_0x886d('0x18')]);return _0x4bd81f(_0x1ec015['error']['message']);}else{logger['info'](_0x886d('0x13'),_0x3512ff,'request\x20sent');_0x4bd81f(_0x1ec015[_0x886d('0x19')][_0x886d('0x18')]);}})[_0x886d('0x1a')](function(_0x11b689){logger[_0x886d('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x3512ff,_0x11b689);_0x54a110(_0x11b689);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 8cd5284..bd0f6bf 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 _0xd519=['remove','update','emit','register','length','./chatWebsite.events'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0xd519,0xe9));var _0x9d51=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd519[_0x14add3];return _0x4a174f;};'use strict';var ChatWebsiteEvents=require(_0x9d51('0x0'));var events=['save',_0x9d51('0x1'),_0x9d51('0x2')];function createListener(_0x402fb9,_0x28e951){return function(_0x184be1){_0x28e951[_0x9d51('0x3')](_0x402fb9,_0x184be1);};}function removeListener(_0x1d7583,_0x213af8){return function(){ChatWebsiteEvents['removeListener'](_0x1d7583,_0x213af8);};}exports[_0x9d51('0x4')]=function(_0x352aa4){for(var _0x40f024=0x0,_0x89fa60=events[_0x9d51('0x5')];_0x40f024<_0x89fa60;_0x40f024++){var _0x10b078=events[_0x40f024];var _0x4ff763=createListener('chatWebsite:'+_0x10b078,_0x352aa4);ChatWebsiteEvents['on'](_0x10b078,_0x4ff763);}}; \ No newline at end of file +var _0xd76b=['length','chatWebsite:','./chatWebsite.events','remove','update','emit','register'];(function(_0x4e5e39,_0x50e2cb){var _0x4d2c0=function(_0x882f30){while(--_0x882f30){_0x4e5e39['push'](_0x4e5e39['shift']());}};_0x4d2c0(++_0x50e2cb);}(_0xd76b,0x9c));var _0xbd76=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xd76b[_0x342baa];return _0x1208f3;};'use strict';var ChatWebsiteEvents=require(_0xbd76('0x0'));var events=['save',_0xbd76('0x1'),_0xbd76('0x2')];function createListener(_0x5eed28,_0x25b862){return function(_0x6356dd){_0x25b862[_0xbd76('0x3')](_0x5eed28,_0x6356dd);};}function removeListener(_0x40f791,_0x4de0a8){return function(){ChatWebsiteEvents['removeListener'](_0x40f791,_0x4de0a8);};}exports[_0xbd76('0x4')]=function(_0x204c6f){for(var _0x160747=0x0,_0x20a7d2=events[_0xbd76('0x5')];_0x160747<_0x20a7d2;_0x160747++){var _0x1345d4=events[_0x160747];var _0x1886d9=createListener(_0xbd76('0x6')+_0x1345d4,_0x204c6f);ChatWebsiteEvents['on'](_0x1345d4,_0x1886d9);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 97e9b9f..9e7f608 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7d5=['trim','([\x5cw]+)','localhost','exports','../../../utils/misc','escapeRegExp','url','URL','replace'];(function(_0x5e8688,_0x7d1513){var _0x5e2993=function(_0x9d4e88){while(--_0x9d4e88){_0x5e8688['push'](_0x5e8688['shift']());}};_0x5e2993(++_0x7d1513);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x3c2cc2,_0x200840){_0x3c2cc2=_0x3c2cc2-0x0;var _0x31ea11=_0xd7d5[_0x3c2cc2];return _0x31ea11;};var escapeRegExp=require(_0x5d7d('0x0'))[_0x5d7d('0x1')];var URL=require(_0x5d7d('0x2'))[_0x5d7d('0x3')];function testWildcardValidity(_0x312cf8){var _0x37f70e=!![];try{new URL(_0x312cf8[_0x5d7d('0x4')]('*','localhost'));}catch(_0x4631a0){_0x37f70e=![];}return _0x37f70e&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x312cf8);}function testWebsiteWithWildcard(_0x1f3f12,_0x16cdb7){var _0x297be9;var _0x4b30eb=escapeRegExp(_0x1f3f12[_0x5d7d('0x5')]()[_0x5d7d('0x4')](/\/$/,''))[_0x5d7d('0x4')]('\x5c*',_0x5d7d('0x6'));try{new URL(_0x1f3f12[_0x5d7d('0x4')]('\x5c*',_0x5d7d('0x7')));_0x297be9=new RegExp(_0x4b30eb)['test'](_0x16cdb7);}catch(_0x414170){_0x297be9=![];}return _0x297be9;}module[_0x5d7d('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x8212=['escapeRegExp','URL','replace','localhost','test','trim','([\x5cw]+)','exports','../../../utils/misc'];(function(_0x50af79,_0x26774e){var _0xebf22a=function(_0x4493e0){while(--_0x4493e0){_0x50af79['push'](_0x50af79['shift']());}};_0xebf22a(++_0x26774e);}(_0x8212,0xb3));var _0x2821=function(_0x30c91d,_0x1a8c6d){_0x30c91d=_0x30c91d-0x0;var _0x319942=_0x8212[_0x30c91d];return _0x319942;};var escapeRegExp=require(_0x2821('0x0'))[_0x2821('0x1')];var URL=require('url')[_0x2821('0x2')];function testWildcardValidity(_0x41ee88){var _0x2149c3=!![];try{new URL(_0x41ee88[_0x2821('0x3')]('*',_0x2821('0x4')));}catch(_0x1b2d87){_0x2149c3=![];}return _0x2149c3&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x2821('0x5')](_0x41ee88);}function testWebsiteWithWildcard(_0x4151aa,_0x5008da){var _0x2f22bd;var _0x58d600=escapeRegExp(_0x4151aa[_0x2821('0x6')]()[_0x2821('0x3')](/\/$/,''))['replace']('\x5c*',_0x2821('0x7'));try{new URL(_0x4151aa[_0x2821('0x3')]('\x5c*',_0x2821('0x4')));_0x2f22bd=new RegExp(_0x58d600)[_0x2821('0x5')](_0x5008da);}catch(_0x16003f){_0x2f22bd=![];}return _0x2f22bd;}module[_0x2821('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 1b2dbf2..4a3f3ac 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 _0x0d1f=['getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','server/files/images/avatars/','single','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','any','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/avatar'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x0d1f,0x159));var _0xf0d1=function(_0x40a006,_0x29f2b0){_0x40a006=_0x40a006-0x0;var _0x57ce2a=_0x0d1f[_0x40a006];return _0x57ce2a;};'use strict';var multer=require(_0xf0d1('0x0'));var util=require(_0xf0d1('0x1'));var path=require('path');var timeout=require(_0xf0d1('0x2'));var express=require(_0xf0d1('0x3'));var router=express[_0xf0d1('0x4')]();var fs_extra=require(_0xf0d1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf0d1('0x6'));var config=require(_0xf0d1('0x7'));var controller=require(_0xf0d1('0x8'));router['get']('/',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0xa')]);router[_0xf0d1('0xb')](_0xf0d1('0xc'),auth['isAuthenticated'](),controller[_0xf0d1('0xd')]);router['get'](_0xf0d1('0xe'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0xf')]);router['get'](_0xf0d1('0x10'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x11')]);router[_0xf0d1('0xb')](_0xf0d1('0x12'),auth[_0xf0d1('0x9')](),controller['getAnswers']);router['get']('/:id/logo',controller['getLogo']);router[_0xf0d1('0xb')](_0xf0d1('0x13'),controller[_0xf0d1('0x14')]);router['get'](_0xf0d1('0x15'),controller[_0xf0d1('0x16')]);router[_0xf0d1('0xb')](_0xf0d1('0x17'),controller['getSystemAvatar']);router['get'](_0xf0d1('0x18'),auth['isAuthenticated'](),controller[_0xf0d1('0x19')]);router[_0xf0d1('0xb')](_0xf0d1('0x1a'),controller[_0xf0d1('0x1b')]);router['get'](_0xf0d1('0x1c'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x1d')]);router[_0xf0d1('0xb')](_0xf0d1('0x1e'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x1f')]);router['get'](_0xf0d1('0x20'),controller['getFields']);router['get']('/:id/offline_messages',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x21')]);router[_0xf0d1('0xb')](_0xf0d1('0x22'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x23')]);router['post']('/',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x24')]);router[_0xf0d1('0x25')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf0d1('0x26')]);router[_0xf0d1('0x25')]('/:id/canned_answers',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x27')]);var upload=multer({'storage':multer[_0xf0d1('0x28')]({'destination':function(_0x12fd78,_0x3a209a,_0x4a0529){_0x4a0529(null,path[_0xf0d1('0x29')](config[_0xf0d1('0x2a')],_0xf0d1('0x2b')));},'filename':function(_0x28c26e,_0x5a1f45,_0x4a80c3){_0x4a80c3(null,util[_0xf0d1('0x2c')](_0xf0d1('0x2d'),Date[_0xf0d1('0x2e')](),_0x5a1f45[_0xf0d1('0x2f')]));}})});router['post']('/:id/logo',upload['single'](_0xf0d1('0x30')),controller['addLogo']);var upload=multer({'storage':multer[_0xf0d1('0x28')]({'destination':function(_0x271f04,_0x554400,_0x3b2515){_0x3b2515(null,path[_0xf0d1('0x29')](config[_0xf0d1('0x2a')],_0xf0d1('0x31')));},'filename':function(_0x512d51,_0x4465c6,_0x3064c1){_0x3064c1(null,util[_0xf0d1('0x2c')]('%s-%s',Date[_0xf0d1('0x2e')](),_0x4465c6['originalname']));}})});router[_0xf0d1('0x25')](_0xf0d1('0x13'),upload[_0xf0d1('0x32')](_0xf0d1('0x30')),controller[_0xf0d1('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x118236,_0xa7e4ca,_0x2eb861){_0x2eb861(null,path[_0xf0d1('0x29')](config[_0xf0d1('0x2a')],_0xf0d1('0x31')));},'filename':function(_0x41e3ab,_0x5231a4,_0x8f319a){_0x8f319a(null,util['format'](_0xf0d1('0x2d'),Date[_0xf0d1('0x2e')](),_0x5231a4[_0xf0d1('0x2f')]));}})});router['post']('/:id/customer_avatar',upload[_0xf0d1('0x32')]('file'),controller[_0xf0d1('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a75cf,_0x3e3337,_0x3b54e8){_0x3b54e8(null,path[_0xf0d1('0x29')](config[_0xf0d1('0x2a')],_0xf0d1('0x31')));},'filename':function(_0x2c8ce8,_0x49ba07,_0x1d67e1){_0x1d67e1(null,util[_0xf0d1('0x2c')]('%s-%s',Date[_0xf0d1('0x2e')](),_0x49ba07[_0xf0d1('0x2f')]));}})});router['post'](_0xf0d1('0x17'),upload[_0xf0d1('0x32')](_0xf0d1('0x30')),controller[_0xf0d1('0x35')]);router['post'](_0xf0d1('0x36'),controller[_0xf0d1('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0xf0d1('0x28')]({'destination':function(_0xf3979,_0x31bdb0,_0xa91728){const _0x439193=path['join'](config[_0xf0d1('0x2a')],_0xf0d1('0x38'),_0xf0d1('0x39'),_0xf0d1('0x3a'));fs_extra['ensureDir'](_0x439193,function(){_0xa91728(null,_0x439193);});},'filename':function(_0x3a4581,_0x4631ba,_0x770c6c){const _0x34f277=_0x4631ba['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x57943d=path['extname'](_0x34f277);const _0x5b3a5c=Date[_0xf0d1('0x2e')]()+'-'+_0x34f277[_0xf0d1('0x3b')](_0x57943d,'')+_0x57943d;_0x770c6c(null,_0x5b3a5c);}})});router['post']('/:id/offline',offlineUploadMulter[_0xf0d1('0x3c')](),controller['offline']);router['post']('/:id/interactions',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x3d')]);router[_0xf0d1('0x25')](_0xf0d1('0x1c'),auth['isAuthenticated'](),controller[_0xf0d1('0x3e')]);router[_0xf0d1('0x25')](_0xf0d1('0x1e'),auth['isAuthenticated'](),controller[_0xf0d1('0x3f')]);router[_0xf0d1('0x25')](_0xf0d1('0x22'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x40')]);router[_0xf0d1('0x41')]('/:id',auth['isAuthenticated'](),controller[_0xf0d1('0x42')]);router[_0xf0d1('0x43')]('/:id',auth['isAuthenticated'](),controller[_0xf0d1('0x44')]);router[_0xf0d1('0x43')](_0xf0d1('0x10'),auth['isAuthenticated'](),controller[_0xf0d1('0x45')]);router[_0xf0d1('0x43')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf0d1('0x46')]);router['delete']('/:id/users',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x47')]);module[_0xf0d1('0x48')]=router; \ No newline at end of file +var _0x49ed=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','now','file','addLogo','server/files/images/avatars/','originalname','single','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions'];(function(_0x2bad28,_0x578c88){var _0x2774e2=function(_0x32dda0){while(--_0x32dda0){_0x2bad28['push'](_0x2bad28['shift']());}};_0x2774e2(++_0x578c88);}(_0x49ed,0x12a));var _0xd49e=function(_0x4c783a,_0x1015c5){_0x4c783a=_0x4c783a-0x0;var _0x33557e=_0x49ed[_0x4c783a];return _0x33557e;};'use strict';var multer=require(_0xd49e('0x0'));var util=require(_0xd49e('0x1'));var path=require(_0xd49e('0x2'));var timeout=require(_0xd49e('0x3'));var express=require(_0xd49e('0x4'));var router=express[_0xd49e('0x5')]();var fs_extra=require(_0xd49e('0x6'));var auth=require(_0xd49e('0x7'));var interaction=require(_0xd49e('0x8'));var config=require(_0xd49e('0x9'));var controller=require(_0xd49e('0xa'));router[_0xd49e('0xb')]('/',auth[_0xd49e('0xc')](),controller[_0xd49e('0xd')]);router[_0xd49e('0xb')](_0xd49e('0xe'),auth['isAuthenticated'](),controller[_0xd49e('0xf')]);router[_0xd49e('0xb')](_0xd49e('0x10'),auth['isAuthenticated'](),controller['show']);router[_0xd49e('0xb')](_0xd49e('0x11'),auth['isAuthenticated'](),controller[_0xd49e('0x12')]);router[_0xd49e('0xb')](_0xd49e('0x13'),auth[_0xd49e('0xc')](),controller[_0xd49e('0x14')]);router[_0xd49e('0xb')](_0xd49e('0x15'),controller['getLogo']);router[_0xd49e('0xb')](_0xd49e('0x16'),controller['getAvatar']);router['get'](_0xd49e('0x17'),controller['getCustomerAvatar']);router['get'](_0xd49e('0x18'),controller['getSystemAvatar']);router[_0xd49e('0xb')](_0xd49e('0x19'),auth[_0xd49e('0xc')](),controller[_0xd49e('0x1a')]);router[_0xd49e('0xb')]('/:id/snippet',controller[_0xd49e('0x1b')]);router[_0xd49e('0xb')](_0xd49e('0x1c'),auth[_0xd49e('0xc')](),controller[_0xd49e('0x1d')]);router['get'](_0xd49e('0x1e'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xd49e('0xb')]('/:id/fields',controller[_0xd49e('0x1f')]);router['get']('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xd49e('0x20')]);router[_0xd49e('0xb')](_0xd49e('0x21'),auth[_0xd49e('0xc')](),controller[_0xd49e('0x22')]);router[_0xd49e('0x23')]('/',auth[_0xd49e('0xc')](),controller[_0xd49e('0x24')]);router['post'](_0xd49e('0x11'),auth[_0xd49e('0xc')](),controller[_0xd49e('0x25')]);router[_0xd49e('0x23')](_0xd49e('0x13'),auth[_0xd49e('0xc')](),controller[_0xd49e('0x26')]);var upload=multer({'storage':multer[_0xd49e('0x27')]({'destination':function(_0x4546d6,_0x31ebeb,_0x4a29ef){_0x4a29ef(null,path[_0xd49e('0x28')](config[_0xd49e('0x29')],'server/files/images/logos/'));},'filename':function(_0x1233ce,_0xf3c2dc,_0x162598){_0x162598(null,util[_0xd49e('0x2a')](_0xd49e('0x2b'),Date[_0xd49e('0x2c')](),_0xf3c2dc['originalname']));}})});router[_0xd49e('0x23')](_0xd49e('0x15'),upload['single'](_0xd49e('0x2d')),controller[_0xd49e('0x2e')]);var upload=multer({'storage':multer[_0xd49e('0x27')]({'destination':function(_0x18073e,_0x44fcfe,_0x3514d1){_0x3514d1(null,path[_0xd49e('0x28')](config[_0xd49e('0x29')],_0xd49e('0x2f')));},'filename':function(_0x1926c9,_0x2284f7,_0x4c1e13){_0x4c1e13(null,util[_0xd49e('0x2a')](_0xd49e('0x2b'),Date[_0xd49e('0x2c')](),_0x2284f7[_0xd49e('0x30')]));}})});router[_0xd49e('0x23')](_0xd49e('0x16'),upload[_0xd49e('0x31')](_0xd49e('0x2d')),controller[_0xd49e('0x32')]);var upload=multer({'storage':multer[_0xd49e('0x27')]({'destination':function(_0x58fa95,_0x52b775,_0x4fbe0e){_0x4fbe0e(null,path['join'](config['root'],_0xd49e('0x2f')));},'filename':function(_0x55bfe2,_0x38f5e2,_0x3d56fa){_0x3d56fa(null,util['format'](_0xd49e('0x2b'),Date[_0xd49e('0x2c')](),_0x38f5e2['originalname']));}})});router['post'](_0xd49e('0x17'),upload[_0xd49e('0x31')](_0xd49e('0x2d')),controller[_0xd49e('0x33')]);var upload=multer({'storage':multer[_0xd49e('0x27')]({'destination':function(_0x4ebbc7,_0x4eef6d,_0x4a7c41){_0x4a7c41(null,path['join'](config[_0xd49e('0x29')],'server/files/images/avatars/'));},'filename':function(_0x38cea7,_0x2ebdc1,_0x1bfdfe){_0x1bfdfe(null,util[_0xd49e('0x2a')]('%s-%s',Date['now'](),_0x2ebdc1[_0xd49e('0x30')]));}})});router[_0xd49e('0x23')](_0xd49e('0x18'),upload['single'](_0xd49e('0x2d')),controller[_0xd49e('0x34')]);router[_0xd49e('0x23')](_0xd49e('0x35'),controller[_0xd49e('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0xd49e('0x27')]({'destination':function(_0x1ff487,_0x4beb02,_0x241a98){const _0x1c9ec7=path['join'](config['root'],_0xd49e('0x37'),_0xd49e('0x38'),_0xd49e('0x39'));fs_extra[_0xd49e('0x3a')](_0x1c9ec7,function(){_0x241a98(null,_0x1c9ec7);});},'filename':function(_0x1e14ea,_0x239ecb,_0xccf68d){const _0x4b90c6=_0x239ecb['originalname'][_0xd49e('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5caf8d=path[_0xd49e('0x3c')](_0x4b90c6);const _0x2f5b77=Date['now']()+'-'+_0x4b90c6[_0xd49e('0x3b')](_0x5caf8d,'')+_0x5caf8d;_0xccf68d(null,_0x2f5b77);}})});router[_0xd49e('0x23')](_0xd49e('0x3d'),offlineUploadMulter[_0xd49e('0x3e')](),controller[_0xd49e('0x3f')]);router[_0xd49e('0x23')](_0xd49e('0x19'),auth[_0xd49e('0xc')](),controller[_0xd49e('0x40')]);router[_0xd49e('0x23')](_0xd49e('0x1c'),auth[_0xd49e('0xc')](),controller[_0xd49e('0x41')]);router[_0xd49e('0x23')](_0xd49e('0x1e'),auth[_0xd49e('0xc')](),controller[_0xd49e('0x42')]);router[_0xd49e('0x23')](_0xd49e('0x21'),auth['isAuthenticated'](),controller[_0xd49e('0x43')]);router['put'](_0xd49e('0x10'),auth[_0xd49e('0xc')](),controller[_0xd49e('0x44')]);router[_0xd49e('0x45')]('/:id',auth[_0xd49e('0xc')](),controller[_0xd49e('0x46')]);router['delete'](_0xd49e('0x11'),auth['isAuthenticated'](),controller[_0xd49e('0x47')]);router[_0xd49e('0x45')]('/:id/canned_answers',auth[_0xd49e('0xc')](),controller['removeAnswers']);router[_0xd49e('0x45')]('/:id/users',auth[_0xd49e('0xc')](),controller[_0xd49e('0x48')]);module[_0xd49e('0x49')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 7e4953a..5237a70 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb22c=['beaver-logger/server','../config/environment','Router','env','production','app','get','expressEndpoint','isAuthenticated','exports'];(function(_0x48669c,_0x18379b){var _0x16c55c=function(_0x285420){while(--_0x285420){_0x48669c['push'](_0x48669c['shift']());}};_0x16c55c(++_0x18379b);}(_0xb22c,0x1cc));var _0xcb22=function(_0x519fd7,_0x1df175){_0x519fd7=_0x519fd7-0x0;var _0x35399b=_0xb22c[_0x519fd7];return _0x35399b;};var beaverLogger=require(_0xcb22('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0xcb22('0x1'));var router=express[_0xcb22('0x2')]();var isProduction=config[_0xcb22('0x3')]===_0xcb22('0x4')||![];function clientSideLogs(_0x318a41,_0x50a577,_0x20c9c6){var _0x1f677b=_0x318a41[_0xcb22('0x5')][_0xcb22('0x6')]('client-side-logger');if(!_0x1f677b){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xcb22('0x7')]({'uri':'/client-logs','logger':_0x1f677b,'enableCors':!isProduction})(_0x318a41,_0x50a577,_0x20c9c6);}router['use'](auth[_0xcb22('0x8')](),clientSideLogs);module[_0xcb22('0x9')]=router; \ No newline at end of file +var _0x256f=['../components/auth/service','../config/environment','Router','env','production','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','beaver-logger/server','express'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x256f,0x178));var _0xf256=function(_0x5b6a9d,_0x2e6019){_0x5b6a9d=_0x5b6a9d-0x0;var _0x1dc718=_0x256f[_0x5b6a9d];return _0x1dc718;};var beaverLogger=require(_0xf256('0x0'));var express=require(_0xf256('0x1'));var auth=require(_0xf256('0x2'));var config=require(_0xf256('0x3'));var router=express[_0xf256('0x4')]();var isProduction=config[_0xf256('0x5')]===_0xf256('0x6')||![];function clientSideLogs(_0x581596,_0x5160,_0x306cc3){var _0x51a4a7=_0x581596[_0xf256('0x7')][_0xf256('0x8')]('client-side-logger');if(!_0x51a4a7){throw new Error(_0xf256('0x9'));}return beaverLogger[_0xf256('0xa')]({'uri':_0xf256('0xb'),'logger':_0x51a4a7,'enableCors':!isProduction})(_0x581596,_0x5160,_0x306cc3);}router[_0xf256('0xc')](auth[_0xf256('0xd')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e86f78d..4acd42a 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 _0x8976=['MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT'];(function(_0x39c7e4,_0x1f1184){var _0x5447b0=function(_0x3b5fb2){while(--_0x3b5fb2){_0x39c7e4['push'](_0x39c7e4['shift']());}};_0x5447b0(++_0x1f1184);}(_0x8976,0x1de));var _0x6897=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8976[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x6897('0x0'));module[_0x6897('0x1')]={'name':{'type':Sequelize[_0x6897('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6897('0x3')](_0x6897('0x4'),_0x6897('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x6897('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0x6897('0x2')],'comment':_0x6897('0x7')},'data2':{'type':Sequelize[_0x6897('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x6897('0x2')],'comment':_0x6897('0x8')},'data4':{'type':Sequelize[_0x6897('0x2')],'comment':_0x6897('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':_0x6897('0xa')},'data6':{'type':Sequelize[_0x6897('0xb')],'comment':_0x6897('0xc')},'data7':{'type':Sequelize[_0x6897('0xb')],'comment':_0x6897('0xd')}}; \ No newline at end of file +var _0x350a=['MicrosoftAzure\x20=>\x20tenant','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365'];(function(_0x2b09d2,_0x35c881){var _0x1e2652=function(_0x2d74c2){while(--_0x2d74c2){_0x2b09d2['push'](_0x2b09d2['shift']());}};_0x1e2652(++_0x35c881);}(_0x350a,0x6d));var _0xa350=function(_0x401d67,_0xeb1592){_0x401d67=_0x401d67-0x0;var _0x25076b=_0x350a[_0x401d67];return _0x25076b;};'use strict';var Sequelize=require(_0xa350('0x0'));module[_0xa350('0x1')]={'name':{'type':Sequelize[_0xa350('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa350('0x3')]('AmazonAWS',_0xa350('0x4'),_0xa350('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa350('0x3')](_0xa350('0x6'),_0xa350('0x7'))},'data1':{'type':Sequelize[_0xa350('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xa350('0x2')],'comment':_0xa350('0x8')},'data3':{'type':Sequelize[_0xa350('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xa350('0x9')],'comment':_0xa350('0xa')},'data6':{'type':Sequelize['TEXT'],'comment':_0xa350('0xb')},'data7':{'type':Sequelize[_0xa350('0x9')],'comment':_0xa350('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2194dcb..3dbe276 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 _0x5155=['Content-Range','destroy','then','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','service','MicrosoftAzure','decryptString','data3','params','catch','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','from','base64','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','update','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x5155,0xfa));var _0x5515=function(_0x5cbce6,_0x5492b0){_0x5cbce6=_0x5cbce6-0x0;var _0x59732a=_0x5155[_0x5cbce6];return _0x59732a;};'use strict';var _=require('lodash');var Redis=require(_0x5515('0x0'));var qs=require(_0x5515('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x5515('0x2'))('api');var db=require(_0x5515('0x3'))['db'];var oauth=require(_0x5515('0x4'));config[_0x5515('0x5')]=_[_0x5515('0x6')](config[_0x5515('0x5')],{'host':_0x5515('0x7'),'port':0x18eb});var socket=require(_0x5515('0x8'))(new Redis(config[_0x5515('0x5')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x3e41d2,_0x4a327f){_0x4a327f=_0x4a327f||0xcc;return function(_0x3f4eba){if(_0x3f4eba){return _0x3e41d2[_0x5515('0x9')](_0x4a327f);}return _0x3e41d2['status'](_0x4a327f)[_0x5515('0xa')]();};}function respondWithResult(_0x1196c0,_0x34aba9){_0x34aba9=_0x34aba9||0xc8;return function(_0x433842){if(_0x433842){return _0x1196c0[_0x5515('0xb')](_0x34aba9)[_0x5515('0xc')](_0x433842);}};}function respondWithFilteredResult(_0x2a0296,_0x4341bc){return function(_0x5140f7){if(_0x5140f7){var _0x12f2f5=typeof _0x4341bc[_0x5515('0xd')]===_0x5515('0xe')&&typeof _0x4341bc[_0x5515('0xf')]===_0x5515('0xe');var _0x586fae=_0x5140f7[_0x5515('0x10')];var _0x3c9fd1=_0x12f2f5?0x0:_0x4341bc[_0x5515('0xd')];var _0x40d7ca=_0x12f2f5?_0x5140f7['count']:_0x4341bc[_0x5515('0xd')]+_0x4341bc['limit'];var _0x5cb259;if(_0x40d7ca>=_0x586fae){_0x40d7ca=_0x586fae;_0x5cb259=0xc8;}else{_0x5cb259=0xce;}_0x2a0296[_0x5515('0xb')](_0x5cb259);return _0x2a0296['set'](_0x5515('0x11'),_0x3c9fd1+'-'+_0x40d7ca+'/'+_0x586fae)[_0x5515('0xc')](_0x5140f7);}return null;};}function saveUpdates(_0x1b9a8e){return function(_0x99c6ff){if(_0x99c6ff){return _0x99c6ff['update'](_0x1b9a8e)['then'](function(_0x451e09){return _0x451e09;});}return null;};}function removeEntity(_0x30e0a1){return function(_0x18fec0){if(_0x18fec0){return _0x18fec0[_0x5515('0x12')]()[_0x5515('0x13')](function(){_0x30e0a1[_0x5515('0xb')](0xcc)[_0x5515('0xa')]();});}};}function handleEntityNotFound(_0x8b51d6){return function(_0x47d60d){if(!_0x47d60d){_0x8b51d6[_0x5515('0x9')](0x194);}return _0x47d60d;};}function handleError(_0x423026,_0x578c46){_0x578c46=_0x578c46||0x1f4;return function(_0xa4ce4b){logger[_0x5515('0x14')](_0xa4ce4b['stack']);if(_0xa4ce4b[_0x5515('0x15')]){delete _0xa4ce4b[_0x5515('0x15')];}_0x423026['status'](_0x578c46)[_0x5515('0x16')](_0xa4ce4b);};}function maskClientSecret(_0x452ced){return _[_0x5515('0x17')](_0x452ced[_0x5515('0x18')](0x0,0x3),0x14,'*');}exports[_0x5515('0x19')]=function(_0x401003,_0x576521){var _0x579b12={},_0x4fbabb={},_0x536dc4={'count':0x0,'rows':[]};var _0x2e5385=_[_0x5515('0x1a')](db[_0x5515('0x1b')][_0x5515('0x1c')],function(_0x50bfd7){return{'name':_0x50bfd7[_0x5515('0x1d')],'type':_0x50bfd7['type'][_0x5515('0x1e')]};});_0x4fbabb[_0x5515('0x1f')]=_[_0x5515('0x1a')](_0x2e5385,_0x5515('0x15'));_0x4fbabb[_0x5515('0x20')]=_[_0x5515('0x21')](_0x401003[_0x5515('0x20')]);_0x4fbabb[_0x5515('0x22')]=_['intersection'](_0x4fbabb[_0x5515('0x1f')],_0x4fbabb['query']);_0x579b12[_0x5515('0x23')]=_[_0x5515('0x24')](_0x4fbabb[_0x5515('0x1f')],qs['fields'](_0x401003[_0x5515('0x20')][_0x5515('0x25')]));_0x579b12[_0x5515('0x23')]=_0x579b12[_0x5515('0x23')][_0x5515('0x26')]?_0x579b12['attributes']:_0x4fbabb[_0x5515('0x1f')];if(!_0x401003[_0x5515('0x20')][_0x5515('0x27')]('nolimit')){_0x579b12[_0x5515('0xf')]=qs[_0x5515('0xf')](_0x401003[_0x5515('0x20')]['limit']);_0x579b12['offset']=qs[_0x5515('0xd')](_0x401003[_0x5515('0x20')][_0x5515('0xd')]);}_0x579b12[_0x5515('0x28')]=qs[_0x5515('0x29')](_0x401003['query'][_0x5515('0x29')]);_0x579b12[_0x5515('0x2a')]=qs['filters'](_['pick'](_0x401003[_0x5515('0x20')],_0x4fbabb[_0x5515('0x22')]),_0x2e5385);if(_0x401003[_0x5515('0x20')]['filter']){_0x579b12['where']=_[_0x5515('0x2b')](_0x579b12['where'],{'$or':_['map'](_0x2e5385,function(_0xb374b7){if(_0xb374b7[_0x5515('0x2c')]!==_0x5515('0x2d')){var _0x586160={};_0x586160[_0xb374b7[_0x5515('0x15')]]={'$like':'%'+_0x401003[_0x5515('0x20')][_0x5515('0x2e')]+'%'};return _0x586160;}})});}_0x579b12=_['merge']({},_0x579b12,_0x401003[_0x5515('0x2f')]);var _0x40115f={'where':_0x579b12[_0x5515('0x2a')]};return db[_0x5515('0x1b')][_0x5515('0x10')](_0x40115f)[_0x5515('0x13')](function(_0x168fba){_0x536dc4[_0x5515('0x10')]=_0x168fba;if(_0x401003[_0x5515('0x20')][_0x5515('0x30')]){_0x579b12[_0x5515('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0x5515('0x32')](_0x579b12);})['then'](function(_0x471605){_0x536dc4['rows']=_[_0x5515('0x1a')](_0x471605,function(_0x117cb1){if(_0x117cb1[_0x5515('0x33')]===_0x5515('0x34')){var _0xd2cd5a=encryptor[_0x5515('0x35')](_0x117cb1[_0x5515('0x36')]);_0x117cb1['data3']=maskClientSecret(_0xd2cd5a);}return _0x117cb1;});return _0x536dc4;})[_0x5515('0x13')](respondWithFilteredResult(_0x576521,_0x579b12))['catch'](handleError(_0x576521,null));};exports['show']=function(_0x2f20a9,_0x5ebe07){var _0x55977b={'raw':!![],'where':{'id':_0x2f20a9[_0x5515('0x37')]['id']}},_0x11df53={};_0x11df53['model']=_[_0x5515('0x21')](db[_0x5515('0x1b')][_0x5515('0x1c')]);_0x11df53[_0x5515('0x20')]=_[_0x5515('0x21')](_0x2f20a9[_0x5515('0x20')]);_0x11df53[_0x5515('0x22')]=_[_0x5515('0x24')](_0x11df53[_0x5515('0x1f')],_0x11df53[_0x5515('0x20')]);_0x55977b[_0x5515('0x23')]=_['intersection'](_0x11df53['model'],qs['fields'](_0x2f20a9[_0x5515('0x20')][_0x5515('0x25')]));_0x55977b[_0x5515('0x23')]=_0x55977b[_0x5515('0x23')][_0x5515('0x26')]?_0x55977b[_0x5515('0x23')]:_0x11df53[_0x5515('0x1f')];if(_0x2f20a9[_0x5515('0x20')][_0x5515('0x30')]){_0x55977b['include']=[{'all':!![]}];}_0x55977b=_[_0x5515('0x2b')]({},_0x55977b,_0x2f20a9['options']);return db[_0x5515('0x1b')]['find'](_0x55977b)[_0x5515('0x13')](handleEntityNotFound(_0x5ebe07,null))[_0x5515('0x13')](function(_0x4ffb7d){if(_0x4ffb7d[_0x5515('0x33')]===_0x5515('0x34')){var _0xba5ae0=encryptor[_0x5515('0x35')](_0x4ffb7d[_0x5515('0x36')]);_0x4ffb7d[_0x5515('0x36')]=maskClientSecret(_0xba5ae0);}return _0x4ffb7d;})['then'](respondWithResult(_0x5ebe07,null))[_0x5515('0x38')](handleError(_0x5ebe07,null));};exports[_0x5515('0x39')]=function(_0x86308e,_0x32f1cb){if(!_0x86308e['body']['name'])throw new Error(_0x5515('0x3a'));if(!_0x86308e[_0x5515('0x3b')][_0x5515('0x33')])throw new Error(_0x5515('0x3c'));var _0x5953af=db['CloudProvider'][_0x5515('0x1c')][_0x5515('0x33')]['values'];if(!_0x5953af[_0x5515('0x3d')](_0x86308e[_0x5515('0x3b')][_0x5515('0x33')]))throw new Error(_0x5515('0x3e')+_0x5953af['join'](',\x20'));if(_0x86308e[_0x5515('0x3b')][_0x5515('0x33')]==='MicrosoftAzure'&&_0x86308e[_0x5515('0x3b')][_0x5515('0x36')]){_0x86308e[_0x5515('0x3b')][_0x5515('0x36')]=encryptor['encryptString'](_0x86308e[_0x5515('0x3b')][_0x5515('0x36')]);}return db[_0x5515('0x1b')]['create'](_0x86308e['body'],{})['then'](respondWithResult(_0x32f1cb,0xc9))['catch'](handleError(_0x32f1cb,null));};exports['update']=function(_0x2412a4,_0x147afe){if(_0x2412a4[_0x5515('0x3b')]['id']){delete _0x2412a4[_0x5515('0x3b')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x2412a4[_0x5515('0x37')]['id']}})[_0x5515('0x13')](handleEntityNotFound(_0x147afe,null))[_0x5515('0x13')](function(_0x11eb45){if(_0x11eb45[_0x5515('0x33')]===_0x5515('0x34')&&_0x2412a4['body']['data3']){_0x2412a4[_0x5515('0x3b')][_0x5515('0x36')]=encryptor[_0x5515('0x3f')](_0x2412a4['body'][_0x5515('0x36')]);}return _0x11eb45;})[_0x5515('0x13')](saveUpdates(_0x2412a4[_0x5515('0x3b')],null))[_0x5515('0x13')](respondWithResult(_0x147afe,null))[_0x5515('0x38')](handleError(_0x147afe,null));};exports[_0x5515('0x12')]=function(_0x391a4a,_0x494367){return db['CloudProvider'][_0x5515('0x40')]({'where':{'id':_0x391a4a[_0x5515('0x37')]['id']}})['then'](handleEntityNotFound(_0x494367,null))['then'](removeEntity(_0x494367,null))['catch'](handleError(_0x494367,null));};exports[_0x5515('0x41')]=function(_0x49560c,_0x231933){return db[_0x5515('0x1b')][_0x5515('0x42')]({'where':{'id':_0x49560c[_0x5515('0x37')]['id']},'raw':!![]})['then'](function(_0x4646da){if(!_0x4646da)return _0x231933[_0x5515('0x9')](0x194);return{'url':oauth[_0x5515('0x43')](_0x4646da,_0x49560c[_0x5515('0x44')]['id'])};})['then'](respondWithResult(_0x231933,null))['catch'](handleError(_0x231933,null));};exports['oauth2MicrosoftCallback']=function(_0x39462d,_0x136f4a){var _0x15d5a8=_0x39462d[_0x5515('0x3b')];var _0x1ab564;var _0x100adc;if(_0x15d5a8['error'])throw _0x15d5a8;redis[_0x5515('0x45')](_0x15d5a8[_0x5515('0x46')])[_0x5515('0x13')](function(_0x28df6d){if(!_0x28df6d)throw new Error(_0x5515('0x47'));_0x1ab564=JSON['parse'](_0x28df6d);var _0x174007=Buffer[_0x5515('0x48')](_0x15d5a8['state'],_0x5515('0x49'))[_0x5515('0x4a')]('ascii');_0x100adc=JSON['parse'](_0x174007);if(!oauth[_0x5515('0x4b')](_0x15d5a8[_0x5515('0x4c')],_0x1ab564[_0x5515('0x4d')]))throw new Error(_0x5515('0x4e'));redis['del'](_0x15d5a8[_0x5515('0x46')]);return oauth[_0x5515('0x4f')](_0x15d5a8[_0x5515('0x50')],_0x1ab564);})[_0x5515('0x13')](function(_0x1e7662){_0x1ab564[_0x5515('0x51')]=_0x1e7662[_0x5515('0x52')];_0x1ab564[_0x5515('0x53')]=_0x1e7662[_0x5515('0x54')];return db[_0x5515('0x1b')][_0x5515('0x55')]({'data5':_0x1ab564['data5'],'data6':_0x1ab564[_0x5515('0x53')]},{'where':{'id':_0x1ab564['id']}});})[_0x5515('0x13')](function(){oauth['startRefreshInterval'](_0x1ab564);socket[_0x5515('0x56')](_0x5515('0x57'),{'id':_0x100adc['id']});return;})[_0x5515('0x13')](respondWithStatusCode(_0x136f4a,null))[_0x5515('0x38')](function(_0x360922){if(_0x100adc){socket[_0x5515('0x56')]('microsoftAuthorization:error',{'id':_0x100adc['id']});}if(!_0x1ab564){logger[_0x5515('0x14')](_0x5515('0x58'),_0x360922);return _0x136f4a[_0x5515('0xb')](0x1f4)['send'](_0x360922['message']);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1ab564['id'],JSON['stringify'](_0x360922));});}; \ No newline at end of file +var _0xc359=['CloudProvider','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','length','create','Name\x20parameter\x20not\x20specified','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','state','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','destroy','error','stack','name','padEnd','slice','map'];(function(_0x117d44,_0x19f02d){var _0x16dc61=function(_0x31f1f6){while(--_0x31f1f6){_0x117d44['push'](_0x117d44['shift']());}};_0x16dc61(++_0x19f02d);}(_0xc359,0x107));var _0x9c35=function(_0xd46333,_0x1b05c1){_0xd46333=_0xd46333-0x0;var _0x336108=_0xc359[_0xd46333];return _0x336108;};'use strict';var _=require(_0x9c35('0x0'));var Redis=require('ioredis');var qs=require(_0x9c35('0x1'));var encryptor=require(_0x9c35('0x2'));var config=require(_0x9c35('0x3'));var logger=require(_0x9c35('0x4'))(_0x9c35('0x5'));var db=require(_0x9c35('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x9c35('0x7')]=_['defaults'](config[_0x9c35('0x7')],{'host':_0x9c35('0x8'),'port':0x18eb});var socket=require(_0x9c35('0x9'))(new Redis(config[_0x9c35('0x7')]));var redis=new Redis(config[_0x9c35('0x7')]);function respondWithStatusCode(_0x5624ec,_0x3b3d48){_0x3b3d48=_0x3b3d48||0xcc;return function(_0x5f31c1){if(_0x5f31c1){return _0x5624ec[_0x9c35('0xa')](_0x3b3d48);}return _0x5624ec[_0x9c35('0xb')](_0x3b3d48)[_0x9c35('0xc')]();};}function respondWithResult(_0xaaebc0,_0x4d9f1c){_0x4d9f1c=_0x4d9f1c||0xc8;return function(_0x3d5461){if(_0x3d5461){return _0xaaebc0[_0x9c35('0xb')](_0x4d9f1c)[_0x9c35('0xd')](_0x3d5461);}};}function respondWithFilteredResult(_0x34144f,_0x3957de){return function(_0x5da08c){if(_0x5da08c){var _0x30717c=typeof _0x3957de[_0x9c35('0xe')]==='undefined'&&typeof _0x3957de[_0x9c35('0xf')]===_0x9c35('0x10');var _0x324082=_0x5da08c[_0x9c35('0x11')];var _0x5eb89a=_0x30717c?0x0:_0x3957de[_0x9c35('0xe')];var _0x3e8682=_0x30717c?_0x5da08c[_0x9c35('0x11')]:_0x3957de[_0x9c35('0xe')]+_0x3957de[_0x9c35('0xf')];var _0x30a3f5;if(_0x3e8682>=_0x324082){_0x3e8682=_0x324082;_0x30a3f5=0xc8;}else{_0x30a3f5=0xce;}_0x34144f[_0x9c35('0xb')](_0x30a3f5);return _0x34144f[_0x9c35('0x12')](_0x9c35('0x13'),_0x5eb89a+'-'+_0x3e8682+'/'+_0x324082)[_0x9c35('0xd')](_0x5da08c);}return null;};}function saveUpdates(_0x12c582){return function(_0x147206){if(_0x147206){return _0x147206['update'](_0x12c582)[_0x9c35('0x14')](function(_0x13dd51){return _0x13dd51;});}return null;};}function removeEntity(_0xb22118){return function(_0xb720b7){if(_0xb720b7){return _0xb720b7[_0x9c35('0x15')]()[_0x9c35('0x14')](function(){_0xb22118[_0x9c35('0xb')](0xcc)[_0x9c35('0xc')]();});}};}function handleEntityNotFound(_0x1220df){return function(_0x48c236){if(!_0x48c236){_0x1220df[_0x9c35('0xa')](0x194);}return _0x48c236;};}function handleError(_0x2ac3ba,_0x40cf92){_0x40cf92=_0x40cf92||0x1f4;return function(_0x5e4164){logger[_0x9c35('0x16')](_0x5e4164[_0x9c35('0x17')]);if(_0x5e4164[_0x9c35('0x18')]){delete _0x5e4164[_0x9c35('0x18')];}_0x2ac3ba[_0x9c35('0xb')](_0x40cf92)['send'](_0x5e4164);};}function maskClientSecret(_0x1d6984){return _[_0x9c35('0x19')](_0x1d6984[_0x9c35('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x552a40,_0x55184a){var _0x121361={},_0x25c115={},_0x443bfb={'count':0x0,'rows':[]};var _0x3c9718=_[_0x9c35('0x1b')](db[_0x9c35('0x1c')][_0x9c35('0x1d')],function(_0x85b9d3){return{'name':_0x85b9d3[_0x9c35('0x1e')],'type':_0x85b9d3[_0x9c35('0x1f')]['key']};});_0x25c115[_0x9c35('0x20')]=_[_0x9c35('0x1b')](_0x3c9718,_0x9c35('0x18'));_0x25c115[_0x9c35('0x21')]=_['keys'](_0x552a40[_0x9c35('0x21')]);_0x25c115[_0x9c35('0x22')]=_[_0x9c35('0x23')](_0x25c115[_0x9c35('0x20')],_0x25c115['query']);_0x121361[_0x9c35('0x24')]=_['intersection'](_0x25c115[_0x9c35('0x20')],qs['fields'](_0x552a40[_0x9c35('0x21')][_0x9c35('0x25')]));_0x121361[_0x9c35('0x24')]=_0x121361['attributes']['length']?_0x121361[_0x9c35('0x24')]:_0x25c115[_0x9c35('0x20')];if(!_0x552a40[_0x9c35('0x21')]['hasOwnProperty']('nolimit')){_0x121361[_0x9c35('0xf')]=qs[_0x9c35('0xf')](_0x552a40[_0x9c35('0x21')][_0x9c35('0xf')]);_0x121361[_0x9c35('0xe')]=qs['offset'](_0x552a40[_0x9c35('0x21')][_0x9c35('0xe')]);}_0x121361[_0x9c35('0x26')]=qs[_0x9c35('0x27')](_0x552a40['query'][_0x9c35('0x27')]);_0x121361[_0x9c35('0x28')]=qs[_0x9c35('0x22')](_[_0x9c35('0x29')](_0x552a40[_0x9c35('0x21')],_0x25c115['filters']),_0x3c9718);if(_0x552a40[_0x9c35('0x21')][_0x9c35('0x2a')]){_0x121361['where']=_[_0x9c35('0x2b')](_0x121361[_0x9c35('0x28')],{'$or':_['map'](_0x3c9718,function(_0x175307){if(_0x175307[_0x9c35('0x1f')]!=='VIRTUAL'){var _0x535ee5={};_0x535ee5[_0x175307[_0x9c35('0x18')]]={'$like':'%'+_0x552a40['query'][_0x9c35('0x2a')]+'%'};return _0x535ee5;}})});}_0x121361=_[_0x9c35('0x2b')]({},_0x121361,_0x552a40[_0x9c35('0x2c')]);var _0x5dca13={'where':_0x121361[_0x9c35('0x28')]};return db[_0x9c35('0x1c')][_0x9c35('0x11')](_0x5dca13)[_0x9c35('0x14')](function(_0x4585f8){_0x443bfb[_0x9c35('0x11')]=_0x4585f8;if(_0x552a40[_0x9c35('0x21')][_0x9c35('0x2d')]){_0x121361[_0x9c35('0x2e')]=[{'all':!![]}];}return db[_0x9c35('0x1c')]['findAll'](_0x121361);})['then'](function(_0x406cbb){_0x443bfb[_0x9c35('0x2f')]=_[_0x9c35('0x1b')](_0x406cbb,function(_0x515c53){if(_0x515c53[_0x9c35('0x30')]===_0x9c35('0x31')){var _0x294063=encryptor[_0x9c35('0x32')](_0x515c53[_0x9c35('0x33')]);_0x515c53[_0x9c35('0x33')]=maskClientSecret(_0x294063);}return _0x515c53;});return _0x443bfb;})[_0x9c35('0x14')](respondWithFilteredResult(_0x55184a,_0x121361))[_0x9c35('0x34')](handleError(_0x55184a,null));};exports[_0x9c35('0x35')]=function(_0xeca892,_0x46caf8){var _0x24d6ce={'raw':!![],'where':{'id':_0xeca892[_0x9c35('0x36')]['id']}},_0x391b4b={};_0x391b4b[_0x9c35('0x20')]=_['keys'](db['CloudProvider'][_0x9c35('0x1d')]);_0x391b4b[_0x9c35('0x21')]=_[_0x9c35('0x37')](_0xeca892['query']);_0x391b4b[_0x9c35('0x22')]=_[_0x9c35('0x23')](_0x391b4b[_0x9c35('0x20')],_0x391b4b[_0x9c35('0x21')]);_0x24d6ce[_0x9c35('0x24')]=_[_0x9c35('0x23')](_0x391b4b['model'],qs[_0x9c35('0x25')](_0xeca892['query']['fields']));_0x24d6ce[_0x9c35('0x24')]=_0x24d6ce[_0x9c35('0x24')][_0x9c35('0x38')]?_0x24d6ce['attributes']:_0x391b4b[_0x9c35('0x20')];if(_0xeca892[_0x9c35('0x21')][_0x9c35('0x2d')]){_0x24d6ce[_0x9c35('0x2e')]=[{'all':!![]}];}_0x24d6ce=_[_0x9c35('0x2b')]({},_0x24d6ce,_0xeca892[_0x9c35('0x2c')]);return db[_0x9c35('0x1c')]['find'](_0x24d6ce)['then'](handleEntityNotFound(_0x46caf8,null))[_0x9c35('0x14')](function(_0x34e16c){if(_0x34e16c['service']===_0x9c35('0x31')){var _0x102296=encryptor[_0x9c35('0x32')](_0x34e16c[_0x9c35('0x33')]);_0x34e16c[_0x9c35('0x33')]=maskClientSecret(_0x102296);}return _0x34e16c;})[_0x9c35('0x14')](respondWithResult(_0x46caf8,null))[_0x9c35('0x34')](handleError(_0x46caf8,null));};exports[_0x9c35('0x39')]=function(_0x47210d,_0x18d2b3){if(!_0x47210d['body'][_0x9c35('0x18')])throw new Error(_0x9c35('0x3a'));if(!_0x47210d[_0x9c35('0x3b')][_0x9c35('0x30')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x45f0aa=db[_0x9c35('0x1c')][_0x9c35('0x1d')][_0x9c35('0x30')][_0x9c35('0x3c')];if(!_0x45f0aa[_0x9c35('0x3d')](_0x47210d[_0x9c35('0x3b')][_0x9c35('0x30')]))throw new Error(_0x9c35('0x3e')+_0x45f0aa[_0x9c35('0x3f')](',\x20'));if(_0x47210d[_0x9c35('0x3b')][_0x9c35('0x30')]===_0x9c35('0x31')&&_0x47210d['body'][_0x9c35('0x33')]){_0x47210d[_0x9c35('0x3b')]['data3']=encryptor[_0x9c35('0x40')](_0x47210d['body']['data3']);}return db[_0x9c35('0x1c')][_0x9c35('0x39')](_0x47210d[_0x9c35('0x3b')],{})[_0x9c35('0x14')](respondWithResult(_0x18d2b3,0xc9))[_0x9c35('0x34')](handleError(_0x18d2b3,null));};exports[_0x9c35('0x41')]=function(_0x45a472,_0x51297d){if(_0x45a472[_0x9c35('0x3b')]['id']){delete _0x45a472[_0x9c35('0x3b')]['id'];}return db[_0x9c35('0x1c')]['find']({'where':{'id':_0x45a472[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](handleEntityNotFound(_0x51297d,null))['then'](function(_0x4e134e){if(_0x4e134e[_0x9c35('0x30')]===_0x9c35('0x31')&&_0x45a472[_0x9c35('0x3b')][_0x9c35('0x33')]){_0x45a472[_0x9c35('0x3b')][_0x9c35('0x33')]=encryptor[_0x9c35('0x40')](_0x45a472[_0x9c35('0x3b')][_0x9c35('0x33')]);}return _0x4e134e;})[_0x9c35('0x14')](saveUpdates(_0x45a472[_0x9c35('0x3b')],null))[_0x9c35('0x14')](respondWithResult(_0x51297d,null))[_0x9c35('0x34')](handleError(_0x51297d,null));};exports[_0x9c35('0x15')]=function(_0x3d10e5,_0x1c8a26){return db[_0x9c35('0x1c')][_0x9c35('0x42')]({'where':{'id':_0x3d10e5[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](handleEntityNotFound(_0x1c8a26,null))['then'](removeEntity(_0x1c8a26,null))[_0x9c35('0x34')](handleError(_0x1c8a26,null));};exports[_0x9c35('0x43')]=function(_0x4e1c48,_0x2098ee){return db[_0x9c35('0x1c')][_0x9c35('0x44')]({'where':{'id':_0x4e1c48['params']['id']},'raw':!![]})['then'](function(_0x157257){if(!_0x157257)return _0x2098ee[_0x9c35('0xa')](0x194);return{'url':oauth[_0x9c35('0x45')](_0x157257,_0x4e1c48[_0x9c35('0x46')]['id'])};})[_0x9c35('0x14')](respondWithResult(_0x2098ee,null))[_0x9c35('0x34')](handleError(_0x2098ee,null));};exports[_0x9c35('0x47')]=function(_0x321537,_0x49c528){var _0x4b23e4=_0x321537[_0x9c35('0x3b')];var _0x3f7279;var _0x517224;if(_0x4b23e4['error'])throw _0x4b23e4;redis[_0x9c35('0x48')](_0x4b23e4['state'])[_0x9c35('0x14')](function(_0x3661f5){if(!_0x3661f5)throw new Error(_0x9c35('0x49'));_0x3f7279=JSON[_0x9c35('0x4a')](_0x3661f5);var _0x51d878=Buffer[_0x9c35('0x4b')](_0x4b23e4['state'],'base64')[_0x9c35('0x4c')](_0x9c35('0x4d'));_0x517224=JSON[_0x9c35('0x4a')](_0x51d878);if(!oauth[_0x9c35('0x4e')](_0x4b23e4[_0x9c35('0x4f')],_0x3f7279['oauth2Claims']))throw new Error(_0x9c35('0x50'));redis['del'](_0x4b23e4[_0x9c35('0x51')]);return oauth[_0x9c35('0x52')](_0x4b23e4[_0x9c35('0x53')],_0x3f7279);})[_0x9c35('0x14')](function(_0x3f2e06){_0x3f7279[_0x9c35('0x54')]=_0x3f2e06[_0x9c35('0x55')];_0x3f7279['data6']=_0x3f2e06[_0x9c35('0x56')];return db[_0x9c35('0x1c')][_0x9c35('0x41')]({'data5':_0x3f7279[_0x9c35('0x54')],'data6':_0x3f7279[_0x9c35('0x57')]},{'where':{'id':_0x3f7279['id']}});})[_0x9c35('0x14')](function(){oauth[_0x9c35('0x58')](_0x3f7279);socket[_0x9c35('0x59')](_0x9c35('0x5a'),{'id':_0x517224['id']});return;})['then'](respondWithStatusCode(_0x49c528,null))[_0x9c35('0x34')](function(_0x19e200){if(_0x517224){socket['emit'](_0x9c35('0x5b'),{'id':_0x517224['id']});}if(!_0x3f7279){logger['error'](_0x9c35('0x5c'),_0x19e200);return _0x49c528['status'](0x1f4)[_0x9c35('0x5d')](_0x19e200[_0x9c35('0x5e')]);}logger[_0x9c35('0x16')](_0x9c35('0x5f'),_0x3f7279['id'],JSON[_0x9c35('0x60')](_0x19e200));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0439791..613ef44 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 _0x883a=['../../config/environment','./cloudProvider.attributes','exports','cloud_providers','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x1276d5,_0x372d37){var _0x3d62e8=function(_0x23db43){while(--_0x23db43){_0x1276d5['push'](_0x1276d5['shift']());}};_0x3d62e8(++_0x372d37);}(_0x883a,0x158));var _0xa883=function(_0x2ef4d6,_0x4c49c6){_0x2ef4d6=_0x2ef4d6-0x0;var _0x462bba=_0x883a[_0x2ef4d6];return _0x462bba;};'use strict';var _=require(_0xa883('0x0'));var util=require(_0xa883('0x1'));var logger=require(_0xa883('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa883('0x3'));var rp=require(_0xa883('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa883('0x5'));var config=require(_0xa883('0x6'));var attributes=require(_0xa883('0x7'));module[_0xa883('0x8')]=function(_0x42ceb7,_0x508014){return _0x42ceb7['define']('CloudProvider',attributes,{'tableName':_0xa883('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2e6=['bluebird','request-promise','rimraf','./cloudProvider.attributes','define','cloud_providers','lodash','util','../../config/logger','api','moment'];(function(_0x315de3,_0x47fb12){var _0x1d1889=function(_0x54b385){while(--_0x54b385){_0x315de3['push'](_0x315de3['shift']());}};_0x1d1889(++_0x47fb12);}(_0xe2e6,0xab));var _0x6e2e=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0xe2e6[_0x34f545];return _0x1ff6b8;};'use strict';var _=require(_0x6e2e('0x0'));var util=require(_0x6e2e('0x1'));var logger=require(_0x6e2e('0x2'))(_0x6e2e('0x3'));var moment=require(_0x6e2e('0x4'));var BPromise=require(_0x6e2e('0x5'));var rp=require(_0x6e2e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e2e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6e2e('0x8'));module['exports']=function(_0xa6311a,_0x2fd269){return _0xa6311a[_0x6e2e('0x9')]('CloudProvider',attributes,{'tableName':_0x6e2e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index f9045fa..442e503 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x521a=['request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','Outlook365','{TENANT_ID}','data2','id_token','stringify','toString','base64','randomBytes','hex','client_id','data4','response_mode','form_post','scope','nonce','login','value','replace','data1','set','decode','payload','aud','isAfter','exp','resolve','then','CloudProvider','findOne','refresh_token','POST','data5','access_token','data6','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','decryptString','data3','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x521a,0x1c3));var _0xa521=function(_0x221e0d,_0x384d06){_0x221e0d=_0x221e0d-0x0;var _0x41bcb7=_0x521a[_0x221e0d];return _0x41bcb7;};'use strict';var _=require(_0xa521('0x0'));var crypto=require(_0xa521('0x1'));var jwt=require(_0xa521('0x2'));var moment=require(_0xa521('0x3'));var Redis=require(_0xa521('0x4'));var rp=require(_0xa521('0x5'));var util=require(_0xa521('0x6'));var encryptor=require(_0xa521('0x7'));var config=require('../../config/environment');var logger=require(_0xa521('0x8'))(_0xa521('0x9'));var schedule=require(_0xa521('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa521('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xa521('0xc')]);var MICROSOFT_AUTH_URL=_0xa521('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa521('0xe'),_0xa521('0xf'),_0xa521('0x10'),_0xa521('0x11'),_0xa521('0x12'),_0xa521('0x13'),_0xa521('0x14')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xa521('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0xa521('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x378eb4){var _0x413d2d=_[_0xa521('0x17')](AZURE_AUTH_SCOPES[_0x378eb4[_0xa521('0x18')]]);if(_0x378eb4[_0xa521('0x18')]===_0xa521('0x19'))_0x413d2d[_0xa521('0x1a')](_0x378eb4[_0xa521('0x1b')]+_0xa521('0x1c'));return _0x413d2d['join']('\x20');}function getAccessTokenScope(_0x30d932){if(_0x30d932[_0xa521('0x18')]===_0xa521('0x1d'))return _0xa521('0x12');if(_0x30d932[_0xa521('0x18')]==='Dynamics365')return _0x30d932[_0xa521('0x1b')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x549d51,_0x13b5d6){var _0x562ab3=MICROSOFT_AUTH_URL['replace'](_0xa521('0x1e'),_0x549d51[_0xa521('0x1f')]);var _0x17bc41=['code',_0xa521('0x20')];var _0x282185=Buffer['from'](JSON[_0xa521('0x21')]({'id':_0x13b5d6}))[_0xa521('0x22')](_0xa521('0x23'));var _0x587956=crypto[_0xa521('0x24')](0x10)['toString'](_0xa521('0x25'));var _0x5b8c8b=getAuthorizationScopes(_0x549d51);var _0x170bec=[{'key':_0xa521('0x26'),'value':_0x549d51['data1']},{'key':'response_type','value':encodeURIComponent(_0x17bc41['join']('\x20'))},{'key':'redirect_uri','value':_0x549d51[_0xa521('0x27')]},{'key':_0xa521('0x28'),'value':_0xa521('0x29')},{'key':_0xa521('0x2a'),'value':encodeURIComponent(_0x5b8c8b)},{'key':'state','value':_0x282185},{'key':_0xa521('0x2b'),'value':_0x587956},{'key':'prompt','value':_0xa521('0x2c')}];var _0x55dc64=_0x562ab3+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x170bec,function(_0xebd53){return _0xebd53['key']+'='+_0xebd53[_0xa521('0x2d')];})['join']('&');_0x549d51['oauth2Claims']={'issuer':_0x562ab3[_0xa521('0x2e')]('oauth2/',''),'audience':_0x549d51[_0xa521('0x2f')],'state':_0x282185,'nonce':_0x587956};redis[_0xa521('0x30')](_0x282185,JSON['stringify'](_0x549d51));return _0x55dc64;}function isValidIdToken(_0x2a0321,_0x2a0496){try{var _0x3aaa31=jwt[_0xa521('0x31')](_0x2a0321,{'complete':!![]});var _0x10644d=_0x3aaa31[_0xa521('0x32')];if(_0x10644d['iss']!==_0x2a0496['issuer'])return![];if(_0x10644d[_0xa521('0x33')]!==_0x2a0496['audience'])return![];if(_0x10644d[_0xa521('0x2b')]!==_0x2a0496[_0xa521('0x2b')])return![];if(moment()[_0xa521('0x34')](moment['unix'](_0x10644d[_0xa521('0x35')])))return![];return!![];}catch(_0x18853f){throw _0x18853f;}}function refreshOauth2MicrosoftAccessToken(_0x4c42a9){return Promise[_0xa521('0x36')]()[_0xa521('0x37')](function(){if(_0x4c42a9['data3'])return _0x4c42a9;return db[_0xa521('0x38')][_0xa521('0x39')]({'where':{'id':_0x4c42a9['id']},'raw':!![]});})[_0xa521('0x37')](function(_0x1759a0){var _0x361565={'grant_type':_0xa521('0x3a'),'refresh_token':_0x1759a0['data6'],'scope':getAccessTokenScope(_0x1759a0),'redirect_uri':_0x1759a0[_0xa521('0x27')],'client_id':_0x1759a0[_0xa521('0x2f')],'client_secret':encryptor['decryptString'](_0x1759a0['data3'])};var _0x211e65={'method':_0xa521('0x3b'),'uri':MICROSOFT_AUTH_URL[_0xa521('0x2e')](_0xa521('0x1e'),_0x1759a0[_0xa521('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x361565,'json':!![]};return rp(_0x211e65);})[_0xa521('0x37')](function(_0x405a39){_0x4c42a9[_0xa521('0x3c')]=_0x405a39[_0xa521('0x3d')];_0x4c42a9[_0xa521('0x3e')]=_0x405a39[_0xa521('0x3a')];return db[_0xa521('0x38')][_0xa521('0x3f')]({'data5':_0x4c42a9[_0xa521('0x3c')],'data6':_0x4c42a9[_0xa521('0x3e')]},{'where':{'id':_0x4c42a9['id']}});})['then'](function(){return _0x4c42a9;})[_0xa521('0x40')](function(_0x173cb1){logger[_0xa521('0x41')](_0xa521('0x42'),_0x4c42a9['id'],_0x173cb1);});}function getOauth2MicrosoftAccessToken(_0x65f8c6,_0x39b6a4){var _0x35a23c={'grant_type':'authorization_code','code':_0x65f8c6,'scope':getAccessTokenScope(_0x39b6a4),'redirect_uri':_0x39b6a4[_0xa521('0x27')],'client_id':_0x39b6a4[_0xa521('0x2f')],'client_secret':encryptor[_0xa521('0x43')](_0x39b6a4[_0xa521('0x44')])};var _0x4d5f65={'method':_0xa521('0x3b'),'uri':MICROSOFT_AUTH_URL['replace'](_0xa521('0x1e'),_0x39b6a4[_0xa521('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x35a23c,'json':!![]};return rp(_0x4d5f65);}function startRefreshInterval(_0x3deb76){var _0x3eb5a1=schedule[_0xa521('0x45')];if(_0x3eb5a1[_0x3deb76['id']])clearInterval(_0x3eb5a1[_0x3deb76['id']]);_0x3eb5a1[_0x3deb76['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa521('0x46')](this,{'id':_0x3deb76['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa521('0x45')]=_0x3eb5a1;}function startAllRefreshIntervals(){return db[_0xa521('0x38')][_0xa521('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa521('0x37')](function(_0xa79ad9){var _0x8ddf48=_0xa79ad9[_0xa521('0x17')](function(_0x43f8d2){return refreshOauth2MicrosoftAccessToken(_0x43f8d2)['then'](function(_0x26166a){startRefreshInterval(_0x26166a);});});return Promise[_0xa521('0x48')](_0x8ddf48);})[_0xa521('0x40')](function(_0x2082cf){var _0xc0ef93=_0x2082cf?util[_0xa521('0x49')](_0x2082cf,{'showHidden':![],'depth':null}):'';logger['error'](_0xa521('0x4a'),_0xc0ef93);});}module[_0xa521('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xd60a=['then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','catch','error','authorization_code','bind','intervals','findAll','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','openid','map','type','push','data7','/.default','Dynamics365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','randomBytes','toString','client_id','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','audience','isAfter','unix','exp','resolve'];(function(_0x5ba2ac,_0x53b1bc){var _0x1b2443=function(_0x2cfd26){while(--_0x2cfd26){_0x5ba2ac['push'](_0x5ba2ac['shift']());}};_0x1b2443(++_0x53b1bc);}(_0xd60a,0x193));var _0xad60=function(_0x165584,_0xe8e4f){_0x165584=_0x165584-0x0;var _0x46b7fc=_0xd60a[_0x165584];return _0x46b7fc;};'use strict';var _=require(_0xad60('0x0'));var crypto=require(_0xad60('0x1'));var jwt=require(_0xad60('0x2'));var moment=require(_0xad60('0x3'));var Redis=require(_0xad60('0x4'));var rp=require('request-promise');var util=require(_0xad60('0x5'));var encryptor=require(_0xad60('0x6'));var config=require(_0xad60('0x7'));var logger=require(_0xad60('0x8'))(_0xad60('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xad60('0xa'))['db'];config['redis']=_[_0xad60('0xb')](config['redis'],{'host':_0xad60('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xad60('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile','email',_0xad60('0xe'),_0xad60('0xf'),_0xad60('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xad60('0x11'),_0xad60('0xe')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x24ffc5){var _0x43d281=_[_0xad60('0x12')](AZURE_AUTH_SCOPES[_0x24ffc5[_0xad60('0x13')]]);if(_0x24ffc5[_0xad60('0x13')]==='Dynamics365')_0x43d281[_0xad60('0x14')](_0x24ffc5[_0xad60('0x15')]+_0xad60('0x16'));return _0x43d281['join']('\x20');}function getAccessTokenScope(_0xd461a7){if(_0xd461a7[_0xad60('0x13')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0xd461a7[_0xad60('0x13')]===_0xad60('0x17'))return _0xd461a7['data7']+_0xad60('0x16');}function generateMicrosoftAuthorizationUrl(_0x16267d,_0x5ee728){var _0xebe172=MICROSOFT_AUTH_URL[_0xad60('0x18')](_0xad60('0x19'),_0x16267d[_0xad60('0x1a')]);var _0x127ad0=[_0xad60('0x1b'),_0xad60('0x1c')];var _0x11e2b7=Buffer[_0xad60('0x1d')](JSON[_0xad60('0x1e')]({'id':_0x5ee728}))['toString']('base64');var _0x56399c=crypto[_0xad60('0x1f')](0x10)[_0xad60('0x20')]('hex');var _0x583f22=getAuthorizationScopes(_0x16267d);var _0x2402bc=[{'key':_0xad60('0x21'),'value':_0x16267d[_0xad60('0x22')]},{'key':_0xad60('0x23'),'value':encodeURIComponent(_0x127ad0[_0xad60('0x24')]('\x20'))},{'key':_0xad60('0x25'),'value':_0x16267d[_0xad60('0x26')]},{'key':_0xad60('0x27'),'value':_0xad60('0x28')},{'key':_0xad60('0x29'),'value':encodeURIComponent(_0x583f22)},{'key':'state','value':_0x11e2b7},{'key':_0xad60('0x2a'),'value':_0x56399c},{'key':_0xad60('0x2b'),'value':_0xad60('0x2c')}];var _0x316d30=_0xebe172+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x2402bc,function(_0x1a430f){return _0x1a430f[_0xad60('0x2d')]+'='+_0x1a430f[_0xad60('0x2e')];})[_0xad60('0x24')]('&');_0x16267d[_0xad60('0x2f')]={'issuer':_0xebe172[_0xad60('0x18')](_0xad60('0x30'),''),'audience':_0x16267d[_0xad60('0x22')],'state':_0x11e2b7,'nonce':_0x56399c};redis[_0xad60('0x31')](_0x11e2b7,JSON[_0xad60('0x1e')](_0x16267d));return _0x316d30;}function isValidIdToken(_0x24582f,_0x1d53cb){try{var _0x20e32d=jwt[_0xad60('0x32')](_0x24582f,{'complete':!![]});var _0x1e0f85=_0x20e32d[_0xad60('0x33')];if(_0x1e0f85[_0xad60('0x34')]!==_0x1d53cb[_0xad60('0x35')])return![];if(_0x1e0f85['aud']!==_0x1d53cb[_0xad60('0x36')])return![];if(_0x1e0f85[_0xad60('0x2a')]!==_0x1d53cb[_0xad60('0x2a')])return![];if(moment()[_0xad60('0x37')](moment[_0xad60('0x38')](_0x1e0f85[_0xad60('0x39')])))return![];return!![];}catch(_0xfb2e55){throw _0xfb2e55;}}function refreshOauth2MicrosoftAccessToken(_0x25e2b5){return Promise[_0xad60('0x3a')]()[_0xad60('0x3b')](function(){if(_0x25e2b5[_0xad60('0x3c')])return _0x25e2b5;return db[_0xad60('0x3d')][_0xad60('0x3e')]({'where':{'id':_0x25e2b5['id']},'raw':!![]});})[_0xad60('0x3b')](function(_0xcb161a){var _0x205c46={'grant_type':_0xad60('0x3f'),'refresh_token':_0xcb161a[_0xad60('0x40')],'scope':getAccessTokenScope(_0xcb161a),'redirect_uri':_0xcb161a[_0xad60('0x26')],'client_id':_0xcb161a[_0xad60('0x22')],'client_secret':encryptor[_0xad60('0x41')](_0xcb161a[_0xad60('0x3c')])};var _0x55564b={'method':_0xad60('0x42'),'uri':MICROSOFT_AUTH_URL[_0xad60('0x18')]('{TENANT_ID}',_0xcb161a[_0xad60('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x205c46,'json':!![]};return rp(_0x55564b);})[_0xad60('0x3b')](function(_0x3aeaa8){_0x25e2b5[_0xad60('0x43')]=_0x3aeaa8[_0xad60('0x44')];_0x25e2b5[_0xad60('0x40')]=_0x3aeaa8[_0xad60('0x3f')];return db[_0xad60('0x3d')]['update']({'data5':_0x25e2b5[_0xad60('0x43')],'data6':_0x25e2b5[_0xad60('0x40')]},{'where':{'id':_0x25e2b5['id']}});})[_0xad60('0x3b')](function(){return _0x25e2b5;})[_0xad60('0x45')](function(_0x4fe708){logger[_0xad60('0x46')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x25e2b5['id'],_0x4fe708);});}function getOauth2MicrosoftAccessToken(_0x4b60fe,_0x3bfb8e){var _0x30c115={'grant_type':_0xad60('0x47'),'code':_0x4b60fe,'scope':getAccessTokenScope(_0x3bfb8e),'redirect_uri':_0x3bfb8e[_0xad60('0x26')],'client_id':_0x3bfb8e[_0xad60('0x22')],'client_secret':encryptor['decryptString'](_0x3bfb8e['data3'])};var _0x30781f={'method':_0xad60('0x42'),'uri':MICROSOFT_AUTH_URL['replace'](_0xad60('0x19'),_0x3bfb8e['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x30c115,'json':!![]};return rp(_0x30781f);}function startRefreshInterval(_0x1781a3){var _0x49f1dc=schedule['intervals'];if(_0x49f1dc[_0x1781a3['id']])clearInterval(_0x49f1dc[_0x1781a3['id']]);_0x49f1dc[_0x1781a3['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xad60('0x48')](this,{'id':_0x1781a3['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xad60('0x49')]=_0x49f1dc;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xad60('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x12a1a0){var _0x3a37e8=_0x12a1a0[_0xad60('0x12')](function(_0xa823a3){return refreshOauth2MicrosoftAccessToken(_0xa823a3)['then'](function(_0x11202c){startRefreshInterval(_0x11202c);});});return Promise['all'](_0x3a37e8);})[_0xad60('0x45')](function(_0x120a51){var _0x45dcee=_0x120a51?util['inspect'](_0x120a51,{'showHidden':![],'depth':null}):'';logger['error'](_0xad60('0x4b'),_0x45dcee);});}module[_0xad60('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 99c4ee7..64ed44b 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 _0x6931=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x35fa02,_0x20c5b6){var _0x12e4bc=function(_0x4fdaa9){while(--_0x4fdaa9){_0x35fa02['push'](_0x35fa02['shift']());}};_0x12e4bc(++_0x20c5b6);}(_0x6931,0x1a9));var _0x1693=function(_0x4ca961,_0x110d45){_0x4ca961=_0x4ca961-0x0;var _0x26090d=_0x6931[_0x4ca961];return _0x26090d;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var moment=require(_0x1693('0x2'));var BPromise=require(_0x1693('0x3'));var rs=require(_0x1693('0x4'));var fs=require('fs');var Redis=require(_0x1693('0x5'));var db=require(_0x1693('0x6'))['db'];var utils=require(_0x1693('0x7'));var logger=require('../../config/logger')(_0x1693('0x8'));var config=require(_0x1693('0x9'));var jayson=require(_0x1693('0xa'));var client=jayson[_0x1693('0xb')][_0x1693('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5de567,_0x3ab149,_0x2ec499){return new BPromise(function(_0x18e32e,_0x579434){return client[_0x1693('0xd')](_0x5de567,_0x2ec499)[_0x1693('0xe')](function(_0x356ec3){logger[_0x1693('0xf')](_0x1693('0x10'),_0x3ab149,_0x1693('0x11'));logger[_0x1693('0x12')](_0x1693('0x13'),_0x3ab149,_0x1693('0x11'),JSON[_0x1693('0x14')](_0x356ec3));if(_0x356ec3[_0x1693('0x15')]){if(_0x356ec3['error'][_0x1693('0x16')]===0x1f4){logger[_0x1693('0x15')](_0x1693('0x10'),_0x3ab149,_0x356ec3[_0x1693('0x15')][_0x1693('0x17')]);return _0x579434(_0x356ec3[_0x1693('0x15')][_0x1693('0x17')]);}logger['error'](_0x1693('0x10'),_0x3ab149,_0x356ec3['error'][_0x1693('0x17')]);return _0x18e32e(_0x356ec3['error'][_0x1693('0x17')]);}else{logger[_0x1693('0xf')]('CloudProvider,\x20%s,\x20%s',_0x3ab149,'request\x20sent');_0x18e32e(_0x356ec3[_0x1693('0x18')]['message']);}})['catch'](function(_0x54724d){logger[_0x1693('0x15')]('CloudProvider,\x20%s,\x20%s',_0x3ab149,_0x54724d);_0x579434(_0x54724d);});});} \ No newline at end of file +var _0x49f8=['message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x302360,_0x8cb850){var _0x41bf8e=function(_0x44ce0f){while(--_0x44ce0f){_0x302360['push'](_0x302360['shift']());}};_0x41bf8e(++_0x8cb850);}(_0x49f8,0xff));var _0x849f=function(_0x1e20f4,_0x103413){_0x1e20f4=_0x1e20f4-0x0;var _0x7d34cd=_0x49f8[_0x1e20f4];return _0x7d34cd;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('CloudProvider,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6d2d2b8..bf9f406 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x27401f,_0x4f19ef){var _0xf7095c=function(_0x99c7c6){while(--_0x99c7c6){_0x27401f['push'](_0x27401f['shift']());}};_0xf7095c(++_0x4f19ef);}(_0xadb5,0xad));var _0x5adb=function(_0x2be749,_0x325db0){_0x2be749=_0x2be749-0x0;var _0x3ffefe=_0xadb5[_0x2be749];return _0x3ffefe;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x266994,_0x2defa4){var _0x26bca1=function(_0x8c9018){while(--_0x8c9018){_0x266994['push'](_0x266994['shift']());}};_0x26bca1(++_0x2defa4);}(_0x2ef3,0xba));var _0x32ef=function(_0x5199e6,_0x58bf3a){_0x5199e6=_0x5199e6-0x0;var _0xfdf889=_0x2ef3[_0x5199e6];return _0xfdf889;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 19e112e..3fca50f 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 _0x61a2=['sequelize','exports','name','STRING'];(function(_0x228ac9,_0x42f065){var _0x69fe02=function(_0x210551){while(--_0x210551){_0x228ac9['push'](_0x228ac9['shift']());}};_0x69fe02(++_0x42f065);}(_0x61a2,0x184));var _0x261a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x61a2[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x261a('0x0'));module[_0x261a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x261a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x261a('0x3')]},'companyId':{'type':Sequelize[_0x261a('0x3')]},'website':{'type':Sequelize[_0x261a('0x3')]},'phone':{'type':Sequelize[_0x261a('0x3')]},'fax':{'type':Sequelize[_0x261a('0x3')]},'type':{'type':Sequelize[_0x261a('0x3')]},'street':{'type':Sequelize[_0x261a('0x3')]},'postalCode':{'type':Sequelize[_0x261a('0x3')]},'city':{'type':Sequelize[_0x261a('0x3')]},'country':{'type':Sequelize[_0x261a('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x261a('0x3')]},'sStreet':{'type':Sequelize[_0x261a('0x3')]},'sPostalCode':{'type':Sequelize[_0x261a('0x3')]},'sCity':{'type':Sequelize[_0x261a('0x3')]},'sCountry':{'type':Sequelize[_0x261a('0x3')]},'description':{'type':Sequelize[_0x261a('0x3')]}}; \ No newline at end of file +var _0xb624=['exports','name','STRING'];(function(_0x7cbbc7,_0x3bfa52){var _0x33afda=function(_0x3345f1){while(--_0x3345f1){_0x7cbbc7['push'](_0x7cbbc7['shift']());}};_0x33afda(++_0x3bfa52);}(_0xb624,0x9c));var _0x4b62=function(_0x3116d6,_0x2d574f){_0x3116d6=_0x3116d6-0x0;var _0x18729d=_0xb624[_0x3116d6];return _0x18729d;};'use strict';var Sequelize=require('sequelize');module[_0x4b62('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x4b62('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4b62('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x4b62('0x2')]},'phone':{'type':Sequelize[_0x4b62('0x2')]},'fax':{'type':Sequelize[_0x4b62('0x2')]},'type':{'type':Sequelize[_0x4b62('0x2')]},'street':{'type':Sequelize[_0x4b62('0x2')]},'postalCode':{'type':Sequelize[_0x4b62('0x2')]},'city':{'type':Sequelize[_0x4b62('0x2')]},'country':{'type':Sequelize[_0x4b62('0x2')]},'email':{'type':Sequelize[_0x4b62('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4b62('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x4b62('0x2')]},'sCity':{'type':Sequelize[_0x4b62('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 05a2fc0..169eb48 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 _0x772c=['autoAssociation','error','describe','addContacts','ids','getContacts','findOne','CmContact','order','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','name','send','CmCompany','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','map','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','user','Companies','UserProfileSection','userProfileId'];(function(_0xdd52b7,_0x4f630f){var _0x1057c2=function(_0x118859){while(--_0x118859){_0xdd52b7['push'](_0xdd52b7['shift']());}};_0x1057c2(++_0x4f630f);}(_0x772c,0x15a));var _0xc772=function(_0x5d2f46,_0xbca366){_0x5d2f46=_0x5d2f46-0x0;var _0x5b13cb=_0x772c[_0x5d2f46];return _0x5b13cb;};'use strict';var emlformat=require(_0xc772('0x0'));var rimraf=require(_0xc772('0x1'));var zipdir=require(_0xc772('0x2'));var jsonpatch=require(_0xc772('0x3'));var rp=require(_0xc772('0x4'));var moment=require(_0xc772('0x5'));var BPromise=require(_0xc772('0x6'));var Mustache=require('mustache');var util=require(_0xc772('0x7'));var path=require(_0xc772('0x8'));var sox=require(_0xc772('0x9'));var csv=require(_0xc772('0xa'));var ejs=require(_0xc772('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc772('0xc'));var squel=require('squel');var crypto=require(_0xc772('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc772('0xe'));var toCsv=require(_0xc772('0xa'));var querystring=require(_0xc772('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc772('0x10'));var qs=require(_0xc772('0x11'));var as=require(_0xc772('0x12'));var hardwareService=require(_0xc772('0x13'));var logger=require(_0xc772('0x14'))('api');var utils=require(_0xc772('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc772('0x16'))['db'];function respondWithStatusCode(_0x23ec7f,_0x49e17e){_0x49e17e=_0x49e17e||0xcc;return function(_0x74850c){if(_0x74850c){return _0x23ec7f[_0xc772('0x17')](_0x49e17e);}return _0x23ec7f[_0xc772('0x18')](_0x49e17e)[_0xc772('0x19')]();};}function respondWithResult(_0x1ed844,_0x4f3869){_0x4f3869=_0x4f3869||0xc8;return function(_0x151dbf){if(_0x151dbf){return _0x1ed844[_0xc772('0x18')](_0x4f3869)[_0xc772('0x1a')](_0x151dbf);}};}function respondWithFilteredResult(_0x81b5cf,_0x45ed4b){return function(_0x13b452){if(_0x13b452){var _0x49db7d=typeof _0x45ed4b[_0xc772('0x1b')]===_0xc772('0x1c')&&typeof _0x45ed4b['limit']===_0xc772('0x1c');var _0x15c67b=_0x13b452[_0xc772('0x1d')];var _0x5717ab=_0x49db7d?0x0:_0x45ed4b['offset'];var _0x502963=_0x49db7d?_0x13b452[_0xc772('0x1d')]:_0x45ed4b['offset']+_0x45ed4b['limit'];var _0x24bd6e;if(_0x502963>=_0x15c67b){_0x502963=_0x15c67b;_0x24bd6e=0xc8;}else{_0x24bd6e=0xce;}_0x81b5cf[_0xc772('0x18')](_0x24bd6e);return _0x81b5cf[_0xc772('0x1e')](_0xc772('0x1f'),_0x5717ab+'-'+_0x502963+'/'+_0x15c67b)[_0xc772('0x1a')](_0x13b452);}return null;};}function patchUpdates(_0x29cbca){return function(_0x135a54){try{jsonpatch[_0xc772('0x20')](_0x135a54,_0x29cbca,!![]);}catch(_0x3a7a5a){return BPromise[_0xc772('0x21')](_0x3a7a5a);}return _0x135a54[_0xc772('0x22')]();};}function saveUpdates(_0x36d529,_0x3bf333){return function(_0x313143){if(_0x313143){return _0x313143[_0xc772('0x23')](_0x36d529)[_0xc772('0x24')](function(_0x3e80a0){return _0x3e80a0;});}return null;};}function removeEntity(_0x5e3ff5,_0x4ae24b){return function(_0x28b38e){if(_0x28b38e){return _0x28b38e['destroy']()['then'](function(){var _0x5a57cb=_0x28b38e[_0xc772('0x25')]({'plain':!![]});var _0x2a520d='Companies';return db[_0xc772('0x26')][_0xc772('0x27')]({'where':{'type':_0x2a520d,'resourceId':_0x5a57cb['id']}})['then'](function(){return _0x28b38e;});})[_0xc772('0x24')](function(){_0x5e3ff5[_0xc772('0x18')](0xcc)[_0xc772('0x19')]();});}};}function handleEntityNotFound(_0x4c913b,_0x5c1895){return function(_0x26b903){if(!_0x26b903){_0x4c913b[_0xc772('0x17')](0x194);}return _0x26b903;};}function handleError(_0x1bc3f9,_0x5cae24){_0x5cae24=_0x5cae24||0x1f4;return function(_0xa0f077){logger['error'](_0xa0f077['stack']);if(_0xa0f077[_0xc772('0x28')]){delete _0xa0f077[_0xc772('0x28')];}_0x1bc3f9[_0xc772('0x18')](_0x5cae24)[_0xc772('0x29')](_0xa0f077);};}exports['index']=function(_0x544d09,_0x5afcfc){var _0x5d0733={},_0x307992={},_0x3d3241={'count':0x0,'rows':[]};return db[_0xc772('0x2a')]['describe']()[_0xc772('0x24')](function(_0x173538){_0x307992[_0xc772('0x2b')]=_['keys'](_0x173538);_0x307992[_0xc772('0x2c')]=_[_0xc772('0x2d')](_0x544d09[_0xc772('0x2c')]);_0x307992[_0xc772('0x2e')]=_[_0xc772('0x2f')](_0x307992[_0xc772('0x2b')],_0x307992[_0xc772('0x2c')]);_0x5d0733['attributes']=_[_0xc772('0x2f')](_0x307992[_0xc772('0x2b')],qs[_0xc772('0x30')](_0x544d09[_0xc772('0x2c')][_0xc772('0x30')]));_0x5d0733[_0xc772('0x31')]=_0x5d0733[_0xc772('0x31')][_0xc772('0x32')]?_0x5d0733[_0xc772('0x31')]:_0x307992[_0xc772('0x2b')];if(!_0x544d09[_0xc772('0x2c')][_0xc772('0x33')](_0xc772('0x34'))){_0x5d0733[_0xc772('0x35')]=qs[_0xc772('0x35')](_0x544d09['query'][_0xc772('0x35')]);_0x5d0733['offset']=qs[_0xc772('0x1b')](_0x544d09[_0xc772('0x2c')]['offset']);}_0x5d0733['order']=qs[_0xc772('0x36')](_0x544d09[_0xc772('0x2c')]['sort']);_0x5d0733[_0xc772('0x37')]=qs['filters'](_['pick'](_0x544d09[_0xc772('0x2c')],_0x307992[_0xc772('0x2e')]),_0x173538);if(_0x544d09[_0xc772('0x2c')][_0xc772('0x38')]){_0x5d0733[_0xc772('0x37')]=_[_0xc772('0x39')](_0x5d0733['where'],{'$or':_[_0xc772('0x3a')](_0x5d0733[_0xc772('0x31')],function(_0xc01ca4){var _0x37e23a={};_0x37e23a[_0xc01ca4]={'$like':'%'+_0x544d09['query'][_0xc772('0x38')]+'%'};return _0x37e23a;})});}_0x5d0733=_[_0xc772('0x39')]({},_0x5d0733,_0x544d09[_0xc772('0x3b')]);var _0x20a3f5={'where':_0x5d0733['where']};return db[_0xc772('0x2a')][_0xc772('0x1d')](_0x20a3f5)['then'](function(_0x3d780a){_0x3d3241[_0xc772('0x1d')]=_0x3d780a;if(_0x544d09[_0xc772('0x2c')][_0xc772('0x3c')]){_0x5d0733['include']=[{'all':!![]}];}return db['CmCompany'][_0xc772('0x3d')](_0x5d0733);})[_0xc772('0x24')](function(_0x5e077a){_0x3d3241['rows']=_0x5e077a;return _0x3d3241;})[_0xc772('0x24')](respondWithFilteredResult(_0x5afcfc,_0x5d0733))[_0xc772('0x3e')](handleError(_0x5afcfc,null));})[_0xc772('0x3e')](handleError(_0x5afcfc,null));};exports[_0xc772('0x3f')]=function(_0x286718,_0x114a85){var _0x1b0ad1={'raw':![],'where':{'id':_0x286718[_0xc772('0x40')]['id']}},_0x5bbfed={};_0x5bbfed[_0xc772('0x2b')]=_[_0xc772('0x2d')](db[_0xc772('0x2a')][_0xc772('0x41')]);_0x5bbfed[_0xc772('0x2c')]=_[_0xc772('0x2d')](_0x286718[_0xc772('0x2c')]);_0x5bbfed[_0xc772('0x2e')]=_[_0xc772('0x2f')](_0x5bbfed[_0xc772('0x2b')],_0x5bbfed[_0xc772('0x2c')]);_0x1b0ad1[_0xc772('0x31')]=_[_0xc772('0x2f')](_0x5bbfed[_0xc772('0x2b')],qs[_0xc772('0x30')](_0x286718[_0xc772('0x2c')][_0xc772('0x30')]));_0x1b0ad1['attributes']=_0x1b0ad1[_0xc772('0x31')]['length']?_0x1b0ad1[_0xc772('0x31')]:_0x5bbfed['model'];if(_0x286718[_0xc772('0x2c')][_0xc772('0x3c')]){_0x1b0ad1[_0xc772('0x42')]=[{'all':!![]}];}_0x1b0ad1=_[_0xc772('0x39')]({},_0x1b0ad1,_0x286718['options']);return db[_0xc772('0x2a')][_0xc772('0x43')](_0x1b0ad1)['then'](handleEntityNotFound(_0x114a85,null))[_0xc772('0x24')](respondWithResult(_0x114a85,null))[_0xc772('0x3e')](handleError(_0x114a85,null));};exports['create']=function(_0x129134,_0x3c0151){return db[_0xc772('0x2a')][_0xc772('0x44')](_0x129134[_0xc772('0x45')],{})[_0xc772('0x24')](function(_0x387a09){var _0x4496fc=_0x129134[_0xc772('0x46')][_0xc772('0x25')]({'plain':!![]});if(!_0x4496fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4496fc['role']==='user'){var _0x1c93e1=_0x387a09[_0xc772('0x25')]({'plain':!![]});var _0x558d07=_0xc772('0x47');return db[_0xc772('0x48')]['find']({'where':{'name':_0x558d07,'userProfileId':_0x4496fc[_0xc772('0x49')]},'raw':!![]})[_0xc772('0x24')](function(_0x17fdcd){if(_0x17fdcd&&_0x17fdcd[_0xc772('0x4a')]===0x0){return db[_0xc772('0x26')]['create']({'name':_0x1c93e1['name'],'resourceId':_0x1c93e1['id'],'type':_0x17fdcd['name'],'sectionId':_0x17fdcd['id']},{})[_0xc772('0x24')](function(){return _0x387a09;});}else{return _0x387a09;}})[_0xc772('0x3e')](function(_0x597a07){logger[_0xc772('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x597a07);throw _0x597a07;});}return _0x387a09;})[_0xc772('0x24')](respondWithResult(_0x3c0151,0xc9))[_0xc772('0x3e')](handleError(_0x3c0151,null));};exports[_0xc772('0x23')]=function(_0x215298,_0x45dc4c){if(_0x215298[_0xc772('0x45')]['id']){delete _0x215298[_0xc772('0x45')]['id'];}return db[_0xc772('0x2a')][_0xc772('0x43')]({'where':{'id':_0x215298[_0xc772('0x40')]['id']}})[_0xc772('0x24')](handleEntityNotFound(_0x45dc4c,null))['then'](saveUpdates(_0x215298[_0xc772('0x45')],null))['then'](respondWithResult(_0x45dc4c,null))['catch'](handleError(_0x45dc4c,null));};exports['destroy']=function(_0x58b9f1,_0x1b5999){return db[_0xc772('0x2a')][_0xc772('0x43')]({'where':{'id':_0x58b9f1[_0xc772('0x40')]['id']}})[_0xc772('0x24')](handleEntityNotFound(_0x1b5999,null))['then'](removeEntity(_0x1b5999,null))['catch'](handleError(_0x1b5999,null));};exports[_0xc772('0x4c')]=function(_0x4e260f,_0x2798fd){return db[_0xc772('0x2a')][_0xc772('0x4c')]()[_0xc772('0x24')](respondWithResult(_0x2798fd,null))[_0xc772('0x3e')](handleError(_0x2798fd,null));};exports[_0xc772('0x4d')]=function(_0x3b1389,_0x347797,_0xd2909a){return db['CmContact']['find']({'where':{'id':_0x3b1389[_0xc772('0x40')]['id']}})[_0xc772('0x24')](handleEntityNotFound(_0x347797,null))[_0xc772('0x24')](function(_0x35f92e){if(_0x35f92e){return _0x35f92e[_0xc772('0x4d')](_0x3b1389[_0xc772('0x45')][_0xc772('0x4e')],_['omit'](_0x3b1389['body'],[_0xc772('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x347797,null))['catch'](handleError(_0x347797,null));};exports[_0xc772('0x4f')]=function(_0x1f5a49,_0x4a6bd6,_0x1c6eba){var _0x21b0a9={};var _0x4b86c1={};var _0x3ef0de;var _0x58cf48;return db['CmCompany'][_0xc772('0x50')]({'where':{'id':_0x1f5a49[_0xc772('0x40')]['id']}})[_0xc772('0x24')](handleEntityNotFound(_0x4a6bd6,null))[_0xc772('0x24')](function(_0xc3cdab){if(_0xc3cdab){_0x3ef0de=_0xc3cdab;_0x4b86c1['model']=_[_0xc772('0x2d')](db[_0xc772('0x51')][_0xc772('0x41')]);_0x4b86c1['query']=_[_0xc772('0x2d')](_0x1f5a49['query']);_0x4b86c1[_0xc772('0x2e')]=_[_0xc772('0x2f')](_0x4b86c1[_0xc772('0x2b')],_0x4b86c1[_0xc772('0x2c')]);_0x21b0a9[_0xc772('0x31')]=_[_0xc772('0x2f')](_0x4b86c1['model'],qs[_0xc772('0x30')](_0x1f5a49[_0xc772('0x2c')]['fields']));_0x21b0a9[_0xc772('0x31')]=_0x21b0a9[_0xc772('0x31')]['length']?_0x21b0a9[_0xc772('0x31')]:_0x4b86c1[_0xc772('0x2b')];_0x21b0a9[_0xc772('0x52')]=qs[_0xc772('0x36')](_0x1f5a49['query'][_0xc772('0x36')]);_0x21b0a9['where']=qs[_0xc772('0x2e')](_[_0xc772('0x53')](_0x1f5a49[_0xc772('0x2c')],_0x4b86c1[_0xc772('0x2e')]));if(_0x1f5a49['query'][_0xc772('0x38')]){_0x21b0a9['where']=_[_0xc772('0x39')](_0x21b0a9[_0xc772('0x37')],{'$or':_[_0xc772('0x3a')](_0x21b0a9[_0xc772('0x31')],function(_0x4caa09){var _0x529750={};_0x529750[_0x4caa09]={'$like':'%'+_0x1f5a49[_0xc772('0x2c')]['filter']+'%'};return _0x529750;})});}_0x21b0a9=_['merge']({},_0x21b0a9,_0x1f5a49['options']);return _0x3ef0de[_0xc772('0x4f')](_0x21b0a9);}})[_0xc772('0x24')](function(_0x4a058f){if(_0x4a058f){_0x58cf48=_0x4a058f[_0xc772('0x32')];if(!_0x1f5a49[_0xc772('0x2c')][_0xc772('0x33')](_0xc772('0x34'))){_0x21b0a9[_0xc772('0x35')]=qs[_0xc772('0x35')](_0x1f5a49[_0xc772('0x2c')][_0xc772('0x35')]);_0x21b0a9[_0xc772('0x1b')]=qs[_0xc772('0x1b')](_0x1f5a49[_0xc772('0x2c')][_0xc772('0x1b')]);}return _0x3ef0de[_0xc772('0x4f')](_0x21b0a9);}})[_0xc772('0x24')](function(_0x4ed249){if(_0x4ed249){return _0x4ed249?{'count':_0x58cf48,'rows':_0x4ed249}:null;}})[_0xc772('0x24')](respondWithResult(_0x4a6bd6,null))['catch'](handleError(_0x4a6bd6,null));}; \ No newline at end of file +var _0xebae=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','error','stack','name','index','CmCompany','describe','keys','query','intersection','model','fields','attributes','nolimit','sort','filters','pick','where','merge','map','filter','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','params','addContacts','CmContact','omit','ids','findOne','length','order','getContacts','hasOwnProperty','eml-format','rimraf','zip-dir'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xebae,0x15d));var _0xeeba=function(_0x217cfd,_0x1e3094){_0x217cfd=_0x217cfd-0x0;var _0x1e887f=_0xebae[_0x217cfd];return _0x1e887f;};'use strict';var emlformat=require(_0xeeba('0x0'));var rimraf=require(_0xeeba('0x1'));var zipdir=require(_0xeeba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeeba('0x3'));var Mustache=require(_0xeeba('0x4'));var util=require(_0xeeba('0x5'));var path=require('path');var sox=require(_0xeeba('0x6'));var csv=require(_0xeeba('0x7'));var ejs=require(_0xeeba('0x8'));var fs=require('fs');var fs_extra=require(_0xeeba('0x9'));var _=require(_0xeeba('0xa'));var squel=require(_0xeeba('0xb'));var crypto=require(_0xeeba('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeeba('0xd'));var toCsv=require(_0xeeba('0x7'));var querystring=require(_0xeeba('0xe'));var Papa=require('papaparse');var Redis=require(_0xeeba('0xf'));var authService=require(_0xeeba('0x10'));var qs=require(_0xeeba('0x11'));var as=require(_0xeeba('0x12'));var hardwareService=require(_0xeeba('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xeeba('0x14'));var config=require(_0xeeba('0x15'));var licenseUtil=require(_0xeeba('0x16'));var db=require(_0xeeba('0x17'))['db'];function respondWithStatusCode(_0x2899e2,_0x24f22e){_0x24f22e=_0x24f22e||0xcc;return function(_0x4e1ba1){if(_0x4e1ba1){return _0x2899e2[_0xeeba('0x18')](_0x24f22e);}return _0x2899e2['status'](_0x24f22e)['end']();};}function respondWithResult(_0x4f6f7d,_0xa2e1ee){_0xa2e1ee=_0xa2e1ee||0xc8;return function(_0x1755b6){if(_0x1755b6){return _0x4f6f7d[_0xeeba('0x19')](_0xa2e1ee)[_0xeeba('0x1a')](_0x1755b6);}};}function respondWithFilteredResult(_0x17f04d,_0x123385){return function(_0x41499f){if(_0x41499f){var _0x28714c=typeof _0x123385[_0xeeba('0x1b')]==='undefined'&&typeof _0x123385[_0xeeba('0x1c')]===_0xeeba('0x1d');var _0x42c301=_0x41499f['count'];var _0x47527a=_0x28714c?0x0:_0x123385[_0xeeba('0x1b')];var _0x381c36=_0x28714c?_0x41499f[_0xeeba('0x1e')]:_0x123385[_0xeeba('0x1b')]+_0x123385[_0xeeba('0x1c')];var _0x236c44;if(_0x381c36>=_0x42c301){_0x381c36=_0x42c301;_0x236c44=0xc8;}else{_0x236c44=0xce;}_0x17f04d['status'](_0x236c44);return _0x17f04d[_0xeeba('0x1f')]('Content-Range',_0x47527a+'-'+_0x381c36+'/'+_0x42c301)[_0xeeba('0x1a')](_0x41499f);}return null;};}function patchUpdates(_0x303541){return function(_0x5c53ca){try{jsonpatch[_0xeeba('0x20')](_0x5c53ca,_0x303541,!![]);}catch(_0x6a3268){return BPromise[_0xeeba('0x21')](_0x6a3268);}return _0x5c53ca[_0xeeba('0x22')]();};}function saveUpdates(_0x412dbd,_0x5c6787){return function(_0x5ad6c5){if(_0x5ad6c5){return _0x5ad6c5[_0xeeba('0x23')](_0x412dbd)[_0xeeba('0x24')](function(_0x407100){return _0x407100;});}return null;};}function removeEntity(_0x26a2ca,_0x466b3d){return function(_0x292996){if(_0x292996){return _0x292996[_0xeeba('0x25')]()[_0xeeba('0x24')](function(){var _0x38fd18=_0x292996[_0xeeba('0x26')]({'plain':!![]});var _0x2f488f=_0xeeba('0x27');return db[_0xeeba('0x28')][_0xeeba('0x25')]({'where':{'type':_0x2f488f,'resourceId':_0x38fd18['id']}})[_0xeeba('0x24')](function(){return _0x292996;});})['then'](function(){_0x26a2ca['status'](0xcc)[_0xeeba('0x29')]();});}};}function handleEntityNotFound(_0x401641,_0x195045){return function(_0x3f938e){if(!_0x3f938e){_0x401641['sendStatus'](0x194);}return _0x3f938e;};}function handleError(_0x1e108c,_0xbf162d){_0xbf162d=_0xbf162d||0x1f4;return function(_0x5be9d5){logger[_0xeeba('0x2a')](_0x5be9d5[_0xeeba('0x2b')]);if(_0x5be9d5[_0xeeba('0x2c')]){delete _0x5be9d5['name'];}_0x1e108c[_0xeeba('0x19')](_0xbf162d)['send'](_0x5be9d5);};}exports[_0xeeba('0x2d')]=function(_0x240233,_0x28c0fd){var _0x1b0315={},_0x5aca71={},_0x4d1a2b={'count':0x0,'rows':[]};return db[_0xeeba('0x2e')][_0xeeba('0x2f')]()[_0xeeba('0x24')](function(_0xd195d2){_0x5aca71['model']=_[_0xeeba('0x30')](_0xd195d2);_0x5aca71['query']=_[_0xeeba('0x30')](_0x240233[_0xeeba('0x31')]);_0x5aca71['filters']=_[_0xeeba('0x32')](_0x5aca71[_0xeeba('0x33')],_0x5aca71['query']);_0x1b0315['attributes']=_[_0xeeba('0x32')](_0x5aca71[_0xeeba('0x33')],qs[_0xeeba('0x34')](_0x240233[_0xeeba('0x31')][_0xeeba('0x34')]));_0x1b0315[_0xeeba('0x35')]=_0x1b0315[_0xeeba('0x35')]['length']?_0x1b0315[_0xeeba('0x35')]:_0x5aca71[_0xeeba('0x33')];if(!_0x240233[_0xeeba('0x31')]['hasOwnProperty'](_0xeeba('0x36'))){_0x1b0315[_0xeeba('0x1c')]=qs['limit'](_0x240233[_0xeeba('0x31')][_0xeeba('0x1c')]);_0x1b0315[_0xeeba('0x1b')]=qs[_0xeeba('0x1b')](_0x240233[_0xeeba('0x31')]['offset']);}_0x1b0315['order']=qs[_0xeeba('0x37')](_0x240233['query'][_0xeeba('0x37')]);_0x1b0315['where']=qs[_0xeeba('0x38')](_[_0xeeba('0x39')](_0x240233[_0xeeba('0x31')],_0x5aca71['filters']),_0xd195d2);if(_0x240233[_0xeeba('0x31')]['filter']){_0x1b0315[_0xeeba('0x3a')]=_[_0xeeba('0x3b')](_0x1b0315[_0xeeba('0x3a')],{'$or':_[_0xeeba('0x3c')](_0x1b0315[_0xeeba('0x35')],function(_0x1d2796){var _0x2f9fcb={};_0x2f9fcb[_0x1d2796]={'$like':'%'+_0x240233[_0xeeba('0x31')][_0xeeba('0x3d')]+'%'};return _0x2f9fcb;})});}_0x1b0315=_[_0xeeba('0x3b')]({},_0x1b0315,_0x240233[_0xeeba('0x3e')]);var _0x183839={'where':_0x1b0315[_0xeeba('0x3a')]};return db[_0xeeba('0x2e')][_0xeeba('0x1e')](_0x183839)[_0xeeba('0x24')](function(_0x5042bf){_0x4d1a2b['count']=_0x5042bf;if(_0x240233[_0xeeba('0x31')]['includeAll']){_0x1b0315[_0xeeba('0x3f')]=[{'all':!![]}];}return db[_0xeeba('0x2e')][_0xeeba('0x40')](_0x1b0315);})[_0xeeba('0x24')](function(_0x23907e){_0x4d1a2b[_0xeeba('0x41')]=_0x23907e;return _0x4d1a2b;})[_0xeeba('0x24')](respondWithFilteredResult(_0x28c0fd,_0x1b0315))[_0xeeba('0x42')](handleError(_0x28c0fd,null));})[_0xeeba('0x42')](handleError(_0x28c0fd,null));};exports[_0xeeba('0x43')]=function(_0x4de9c0,_0x351597){var _0x4f648b={'raw':![],'where':{'id':_0x4de9c0['params']['id']}},_0x24f364={};_0x24f364[_0xeeba('0x33')]=_[_0xeeba('0x30')](db[_0xeeba('0x2e')][_0xeeba('0x44')]);_0x24f364[_0xeeba('0x31')]=_[_0xeeba('0x30')](_0x4de9c0['query']);_0x24f364[_0xeeba('0x38')]=_['intersection'](_0x24f364[_0xeeba('0x33')],_0x24f364[_0xeeba('0x31')]);_0x4f648b['attributes']=_[_0xeeba('0x32')](_0x24f364[_0xeeba('0x33')],qs[_0xeeba('0x34')](_0x4de9c0[_0xeeba('0x31')][_0xeeba('0x34')]));_0x4f648b[_0xeeba('0x35')]=_0x4f648b[_0xeeba('0x35')]['length']?_0x4f648b[_0xeeba('0x35')]:_0x24f364[_0xeeba('0x33')];if(_0x4de9c0[_0xeeba('0x31')][_0xeeba('0x45')]){_0x4f648b[_0xeeba('0x3f')]=[{'all':!![]}];}_0x4f648b=_[_0xeeba('0x3b')]({},_0x4f648b,_0x4de9c0['options']);return db[_0xeeba('0x2e')][_0xeeba('0x46')](_0x4f648b)[_0xeeba('0x24')](handleEntityNotFound(_0x351597,null))[_0xeeba('0x24')](respondWithResult(_0x351597,null))['catch'](handleError(_0x351597,null));};exports[_0xeeba('0x47')]=function(_0x1f5ab1,_0x45f7f4){return db[_0xeeba('0x2e')][_0xeeba('0x47')](_0x1f5ab1['body'],{})['then'](function(_0x3f6f07){var _0x5a7565=_0x1f5ab1[_0xeeba('0x48')][_0xeeba('0x26')]({'plain':!![]});if(!_0x5a7565)throw new Error(_0xeeba('0x49'));if(_0x5a7565[_0xeeba('0x4a')]===_0xeeba('0x48')){var _0x8d14f5=_0x3f6f07['get']({'plain':!![]});var _0x28e116=_0xeeba('0x27');return db[_0xeeba('0x4b')][_0xeeba('0x46')]({'where':{'name':_0x28e116,'userProfileId':_0x5a7565[_0xeeba('0x4c')]},'raw':!![]})[_0xeeba('0x24')](function(_0x1ad445){if(_0x1ad445&&_0x1ad445['autoAssociation']===0x0){return db[_0xeeba('0x28')][_0xeeba('0x47')]({'name':_0x8d14f5[_0xeeba('0x2c')],'resourceId':_0x8d14f5['id'],'type':_0x1ad445[_0xeeba('0x2c')],'sectionId':_0x1ad445['id']},{})['then'](function(){return _0x3f6f07;});}else{return _0x3f6f07;}})['catch'](function(_0x4be75a){logger[_0xeeba('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4be75a);throw _0x4be75a;});}return _0x3f6f07;})['then'](respondWithResult(_0x45f7f4,0xc9))['catch'](handleError(_0x45f7f4,null));};exports[_0xeeba('0x23')]=function(_0x3d68eb,_0x1f529c){if(_0x3d68eb['body']['id']){delete _0x3d68eb[_0xeeba('0x4d')]['id'];}return db[_0xeeba('0x2e')]['find']({'where':{'id':_0x3d68eb['params']['id']}})[_0xeeba('0x24')](handleEntityNotFound(_0x1f529c,null))['then'](saveUpdates(_0x3d68eb[_0xeeba('0x4d')],null))[_0xeeba('0x24')](respondWithResult(_0x1f529c,null))['catch'](handleError(_0x1f529c,null));};exports['destroy']=function(_0x4981e0,_0x748df3){return db[_0xeeba('0x2e')]['find']({'where':{'id':_0x4981e0[_0xeeba('0x4e')]['id']}})[_0xeeba('0x24')](handleEntityNotFound(_0x748df3,null))['then'](removeEntity(_0x748df3,null))['catch'](handleError(_0x748df3,null));};exports[_0xeeba('0x2f')]=function(_0x570eb2,_0x439eef){return db['CmCompany'][_0xeeba('0x2f')]()['then'](respondWithResult(_0x439eef,null))[_0xeeba('0x42')](handleError(_0x439eef,null));};exports[_0xeeba('0x4f')]=function(_0x1e9e72,_0x590ea3,_0x1d5a99){return db[_0xeeba('0x50')][_0xeeba('0x46')]({'where':{'id':_0x1e9e72[_0xeeba('0x4e')]['id']}})[_0xeeba('0x24')](handleEntityNotFound(_0x590ea3,null))[_0xeeba('0x24')](function(_0x4d77e1){if(_0x4d77e1){return _0x4d77e1[_0xeeba('0x4f')](_0x1e9e72[_0xeeba('0x4d')]['ids'],_[_0xeeba('0x51')](_0x1e9e72[_0xeeba('0x4d')],[_0xeeba('0x52'),'id'])||{});}})[_0xeeba('0x24')](respondWithResult(_0x590ea3,null))[_0xeeba('0x42')](handleError(_0x590ea3,null));};exports['getContacts']=function(_0x18a89e,_0x399048,_0x30bfad){var _0x108bb7={};var _0x18c00f={};var _0x591cfb;var _0x3e23ba;return db['CmCompany'][_0xeeba('0x53')]({'where':{'id':_0x18a89e[_0xeeba('0x4e')]['id']}})[_0xeeba('0x24')](handleEntityNotFound(_0x399048,null))[_0xeeba('0x24')](function(_0x3e83c3){if(_0x3e83c3){_0x591cfb=_0x3e83c3;_0x18c00f[_0xeeba('0x33')]=_[_0xeeba('0x30')](db[_0xeeba('0x50')][_0xeeba('0x44')]);_0x18c00f[_0xeeba('0x31')]=_[_0xeeba('0x30')](_0x18a89e[_0xeeba('0x31')]);_0x18c00f[_0xeeba('0x38')]=_[_0xeeba('0x32')](_0x18c00f[_0xeeba('0x33')],_0x18c00f[_0xeeba('0x31')]);_0x108bb7['attributes']=_[_0xeeba('0x32')](_0x18c00f[_0xeeba('0x33')],qs['fields'](_0x18a89e['query'][_0xeeba('0x34')]));_0x108bb7[_0xeeba('0x35')]=_0x108bb7['attributes'][_0xeeba('0x54')]?_0x108bb7[_0xeeba('0x35')]:_0x18c00f['model'];_0x108bb7[_0xeeba('0x55')]=qs[_0xeeba('0x37')](_0x18a89e[_0xeeba('0x31')][_0xeeba('0x37')]);_0x108bb7['where']=qs[_0xeeba('0x38')](_['pick'](_0x18a89e['query'],_0x18c00f[_0xeeba('0x38')]));if(_0x18a89e[_0xeeba('0x31')]['filter']){_0x108bb7[_0xeeba('0x3a')]=_['merge'](_0x108bb7[_0xeeba('0x3a')],{'$or':_['map'](_0x108bb7[_0xeeba('0x35')],function(_0x1a3f4f){var _0x61f99d={};_0x61f99d[_0x1a3f4f]={'$like':'%'+_0x18a89e[_0xeeba('0x31')]['filter']+'%'};return _0x61f99d;})});}_0x108bb7=_['merge']({},_0x108bb7,_0x18a89e[_0xeeba('0x3e')]);return _0x591cfb[_0xeeba('0x56')](_0x108bb7);}})['then'](function(_0x34cfaf){if(_0x34cfaf){_0x3e23ba=_0x34cfaf['length'];if(!_0x18a89e[_0xeeba('0x31')][_0xeeba('0x57')](_0xeeba('0x36'))){_0x108bb7[_0xeeba('0x1c')]=qs[_0xeeba('0x1c')](_0x18a89e[_0xeeba('0x31')][_0xeeba('0x1c')]);_0x108bb7['offset']=qs['offset'](_0x18a89e[_0xeeba('0x31')][_0xeeba('0x1b')]);}return _0x591cfb[_0xeeba('0x56')](_0x108bb7);}})[_0xeeba('0x24')](function(_0x50f7c5){if(_0x50f7c5){return _0x50f7c5?{'count':_0x3e23ba,'rows':_0x50f7c5}:null;}})['then'](respondWithResult(_0x399048,null))[_0xeeba('0x42')](handleError(_0x399048,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8ed3b53..9d14065 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 _0x8610=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x8610,0x151));var _0x0861=function(_0x1b516b,_0x5acb23){_0x1b516b=_0x1b516b-0x0;var _0x49d33a=_0x8610[_0x1b516b];return _0x49d33a;};'use strict';var _=require(_0x0861('0x0'));var util=require(_0x0861('0x1'));var logger=require(_0x0861('0x2'))(_0x0861('0x3'));var moment=require(_0x0861('0x4'));var BPromise=require(_0x0861('0x5'));var rp=require(_0x0861('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0861('0x7'));var config=require('../../config/environment');var attributes=require(_0x0861('0x8'));module[_0x0861('0x9')]=function(_0x2b9acc,_0x24aced){return _0x2b9acc[_0x0861('0xa')](_0x0861('0xb'),attributes,{'tableName':_0x0861('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd74f=['request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','util','../../config/logger','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd74f,0x189));var _0xfd74=function(_0x1960b6,_0x3f829e){_0x1960b6=_0x1960b6-0x0;var _0x4a78fc=_0xd74f[_0x1960b6];return _0x4a78fc;};'use strict';var _=require('lodash');var util=require(_0xfd74('0x0'));var logger=require(_0xfd74('0x1'))(_0xfd74('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfd74('0x3'));var fs=require('fs');var path=require(_0xfd74('0x4'));var rimraf=require(_0xfd74('0x5'));var config=require(_0xfd74('0x6'));var attributes=require(_0xfd74('0x7'));module['exports']=function(_0x1ea7d2,_0x2cbd14){return _0x1ea7d2[_0xfd74('0x8')](_0xfd74('0x9'),attributes,{'tableName':_0xfd74('0xa'),'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 87f07fd..b70135c 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 _0xd331=['CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x288e73,_0x279189){var _0x2fa4ef=function(_0x365f0f){while(--_0x365f0f){_0x288e73['push'](_0x288e73['shift']());}};_0x2fa4ef(++_0x279189);}(_0xd331,0x113));var _0x1d33=function(_0x1153d7,_0x2495fc){_0x1153d7=_0x1153d7-0x0;var _0x20dd0a=_0xd331[_0x1153d7];return _0x20dd0a;};'use strict';var _=require(_0x1d33('0x0'));var util=require(_0x1d33('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d33('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d33('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d33('0x4'))(_0x1d33('0x5'));var config=require(_0x1d33('0x6'));var jayson=require(_0x1d33('0x7'));var client=jayson[_0x1d33('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ab1af,_0x2e92c8,_0x10fd53){return new BPromise(function(_0x20a4ad,_0x2171a8){return client[_0x1d33('0x9')](_0x2ab1af,_0x10fd53)[_0x1d33('0xa')](function(_0x302f34){logger['info'](_0x1d33('0xb'),_0x2e92c8,_0x1d33('0xc'));logger[_0x1d33('0xd')](_0x1d33('0xe'),_0x2e92c8,_0x1d33('0xc'),JSON[_0x1d33('0xf')](_0x302f34));if(_0x302f34['error']){if(_0x302f34['error'][_0x1d33('0x10')]===0x1f4){logger[_0x1d33('0x11')](_0x1d33('0xb'),_0x2e92c8,_0x302f34[_0x1d33('0x11')][_0x1d33('0x12')]);return _0x2171a8(_0x302f34[_0x1d33('0x11')][_0x1d33('0x12')]);}logger[_0x1d33('0x11')](_0x1d33('0xb'),_0x2e92c8,_0x302f34['error']['message']);return _0x20a4ad(_0x302f34[_0x1d33('0x11')][_0x1d33('0x12')]);}else{logger[_0x1d33('0x13')](_0x1d33('0xb'),_0x2e92c8,_0x1d33('0xc'));_0x20a4ad(_0x302f34[_0x1d33('0x14')][_0x1d33('0x12')]);}})[_0x1d33('0x15')](function(_0x390e34){logger[_0x1d33('0x11')]('CmCompany,\x20%s,\x20%s',_0x2e92c8,_0x390e34);_0x2171a8(_0x390e34);});});} \ No newline at end of file +var _0x3ae4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment'];(function(_0x5d593e,_0x352433){var _0x225697=function(_0x24d981){while(--_0x24d981){_0x5d593e['push'](_0x5d593e['shift']());}};_0x225697(++_0x352433);}(_0x3ae4,0xee));var _0x43ae=function(_0x2cbfee,_0x225004){_0x2cbfee=_0x2cbfee-0x0;var _0x892ecf=_0x3ae4[_0x2cbfee];return _0x892ecf;};'use strict';var _=require(_0x43ae('0x0'));var util=require('util');var moment=require(_0x43ae('0x1'));var BPromise=require(_0x43ae('0x2'));var rs=require(_0x43ae('0x3'));var fs=require('fs');var Redis=require(_0x43ae('0x4'));var db=require(_0x43ae('0x5'))['db'];var utils=require(_0x43ae('0x6'));var logger=require(_0x43ae('0x7'))(_0x43ae('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x43ae('0x9')][_0x43ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe63e36,_0x281b4a,_0xdf5c9d){return new BPromise(function(_0x47252a,_0x403e22){return client['request'](_0xe63e36,_0xdf5c9d)['then'](function(_0x595c53){logger[_0x43ae('0xb')](_0x43ae('0xc'),_0x281b4a,_0x43ae('0xd'));logger[_0x43ae('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x281b4a,'request\x20sent',JSON['stringify'](_0x595c53));if(_0x595c53[_0x43ae('0xf')]){if(_0x595c53[_0x43ae('0xf')][_0x43ae('0x10')]===0x1f4){logger[_0x43ae('0xf')]('CmCompany,\x20%s,\x20%s',_0x281b4a,_0x595c53[_0x43ae('0xf')][_0x43ae('0x11')]);return _0x403e22(_0x595c53[_0x43ae('0xf')][_0x43ae('0x11')]);}logger[_0x43ae('0xf')](_0x43ae('0xc'),_0x281b4a,_0x595c53[_0x43ae('0xf')][_0x43ae('0x11')]);return _0x47252a(_0x595c53['error'][_0x43ae('0x11')]);}else{logger[_0x43ae('0xb')](_0x43ae('0xc'),_0x281b4a,_0x43ae('0xd'));_0x47252a(_0x595c53[_0x43ae('0x12')][_0x43ae('0x11')]);}})[_0x43ae('0x13')](function(_0x17134d){logger[_0x43ae('0xf')](_0x43ae('0xc'),_0x281b4a,_0x17134d);_0x403e22(_0x17134d);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 633606c..15464b6 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 _0xa96b=['/:id/contacts','getContacts','post','create','addContacts','put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x47d076,_0x10139b){var _0x19619e=function(_0x5d99fc){while(--_0x5d99fc){_0x47d076['push'](_0x47d076['shift']());}};_0x19619e(++_0x10139b);}(_0xa96b,0xfb));var _0xba96=function(_0x5e5c7a,_0x29daaa){_0x5e5c7a=_0x5e5c7a-0x0;var _0x9dd079=_0xa96b[_0x5e5c7a];return _0x9dd079;};'use strict';var multer=require(_0xba96('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba96('0x1'));var express=require(_0xba96('0x2'));var router=express['Router']();var fs_extra=require(_0xba96('0x3'));var auth=require(_0xba96('0x4'));var interaction=require(_0xba96('0x5'));var config=require(_0xba96('0x6'));var controller=require(_0xba96('0x7'));router[_0xba96('0x8')]('/',auth['isAuthenticated'](),controller[_0xba96('0x9')]);router[_0xba96('0x8')]('/describe',auth[_0xba96('0xa')](),controller[_0xba96('0xb')]);router[_0xba96('0x8')](_0xba96('0xc'),auth[_0xba96('0xa')](),controller['show']);router[_0xba96('0x8')](_0xba96('0xd'),auth['isAuthenticated'](),controller[_0xba96('0xe')]);router[_0xba96('0xf')]('/',auth['isAuthenticated'](),controller[_0xba96('0x10')]);router[_0xba96('0xf')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xba96('0x11')]);router[_0xba96('0x12')](_0xba96('0xc'),auth['isAuthenticated'](),controller[_0xba96('0x13')]);router[_0xba96('0x14')](_0xba96('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xba96('0x15')]=router; \ No newline at end of file +var _0xc9de=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','/:id/contacts','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xc9de,0x125));var _0xec9d=function(_0xfcb12e,_0x169af2){_0xfcb12e=_0xfcb12e-0x0;var _0x197c1e=_0xc9de[_0xfcb12e];return _0x197c1e;};'use strict';var multer=require(_0xec9d('0x0'));var util=require('util');var path=require(_0xec9d('0x1'));var timeout=require(_0xec9d('0x2'));var express=require(_0xec9d('0x3'));var router=express[_0xec9d('0x4')]();var fs_extra=require(_0xec9d('0x5'));var auth=require(_0xec9d('0x6'));var interaction=require(_0xec9d('0x7'));var config=require(_0xec9d('0x8'));var controller=require(_0xec9d('0x9'));router[_0xec9d('0xa')]('/',auth[_0xec9d('0xb')](),controller[_0xec9d('0xc')]);router[_0xec9d('0xa')](_0xec9d('0xd'),auth['isAuthenticated'](),controller[_0xec9d('0xe')]);router[_0xec9d('0xa')](_0xec9d('0xf'),auth[_0xec9d('0xb')](),controller[_0xec9d('0x10')]);router[_0xec9d('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0xec9d('0x11')]('/',auth[_0xec9d('0xb')](),controller['create']);router[_0xec9d('0x11')](_0xec9d('0x12'),auth[_0xec9d('0xb')](),controller['addContacts']);router[_0xec9d('0x13')]('/:id',auth[_0xec9d('0xb')](),controller[_0xec9d('0x14')]);router[_0xec9d('0x15')](_0xec9d('0xf'),auth['isAuthenticated'](),controller[_0xec9d('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 1073345..8fc7fbb 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 _0x2800=['STRING','TEXT','INTEGER','UNSIGNED','NOW','lodash','exports'];(function(_0x37656f,_0x350ac6){var _0x5cd9d8=function(_0x12e27e){while(--_0x12e27e){_0x37656f['push'](_0x37656f['shift']());}};_0x5cd9d8(++_0x350ac6);}(_0x2800,0x163));var _0x0280=function(_0x41fd4e,_0x3c496c){_0x41fd4e=_0x41fd4e-0x0;var _0x5123b0=_0x2800[_0x41fd4e];return _0x5123b0;};'use strict';var _=require(_0x0280('0x0'));var Sequelize=require('sequelize');module[_0x0280('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x0280('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x0280('0x2')]},'city':{'type':Sequelize[_0x0280('0x2')]},'country':{'type':Sequelize[_0x0280('0x2')]},'dateOfBirth':{'type':Sequelize[_0x0280('0x2')]},'description':{'type':Sequelize[_0x0280('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x0280('0x2')]},'fax':{'type':Sequelize[_0x0280('0x2')]},'email':{'type':Sequelize[_0x0280('0x2')]},'url':{'type':Sequelize[_0x0280('0x2')]},'facebook':{'type':Sequelize[_0x0280('0x2')]},'fb_data':{'type':Sequelize[_0x0280('0x2')]},'twitter':{'type':Sequelize[_0x0280('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x0280('0x2')]},'viber':{'type':Sequelize[_0x0280('0x2')]},'line':{'type':Sequelize[_0x0280('0x2')]},'wechat':{'type':Sequelize[_0x0280('0x2')]},'telegram':{'type':Sequelize[_0x0280('0x2')]},'UserId':{'type':Sequelize[_0x0280('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x0280('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x0280('0x6')]},'dialTimezone':{'type':Sequelize[_0x0280('0x2')]},'utcOffset':{'type':Sequelize[_0x0280('0x4')]}}; \ No newline at end of file +var _0x6e1c=['NOW','lodash','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0x6e1c,0xda));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc6e1('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xc6e1('0x1')]},'street':{'type':Sequelize[_0xc6e1('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc6e1('0x1')]},'country':{'type':Sequelize[_0xc6e1('0x1')]},'dateOfBirth':{'type':Sequelize[_0xc6e1('0x1')]},'description':{'type':Sequelize[_0xc6e1('0x2')]},'phone':{'type':Sequelize[_0xc6e1('0x1')]},'mobile':{'type':Sequelize[_0xc6e1('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc6e1('0x1')]},'url':{'type':Sequelize[_0xc6e1('0x1')]},'facebook':{'type':Sequelize[_0xc6e1('0x1')]},'fb_data':{'type':Sequelize[_0xc6e1('0x1')]},'twitter':{'type':Sequelize[_0xc6e1('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xc6e1('0x1')]},'viber':{'type':Sequelize[_0xc6e1('0x1')]},'line':{'type':Sequelize[_0xc6e1('0x1')]},'wechat':{'type':Sequelize[_0xc6e1('0x1')]},'telegram':{'type':Sequelize[_0xc6e1('0x1')]},'UserId':{'type':Sequelize[_0xc6e1('0x3')]},'AdditionalPhones':{'type':Sequelize[_0xc6e1('0x1')]},'priority':{'type':Sequelize[_0xc6e1('0x3')](0x2)[_0xc6e1('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc6e1('0x5')],'defaultValue':Sequelize[_0xc6e1('0x6')]},'dialTimezone':{'type':Sequelize[_0xc6e1('0x1')]},'utcOffset':{'type':Sequelize[_0xc6e1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index a544fbc..a77382e 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 _0xf131=['fullname','alias','startCase','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','Tags','DESC','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','externalUrl','threadId','findAndCountAll','Owner','flatten','sortBy','reverse','value','slice','moment','bluebird','path','lodash','squel','papaparse','../../components/contacts','../../components/parsers/qs','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','describe','getOptions','findAll','user','catch','CmContact','params','tags','keys','length','startsWith','cf_','columnName','displayName','query','analytics','custom','type','values','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport','create','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','contact','show','find','Tag','color','tag','Phones','sequelize','Phones.OrderBy','map','format','cf_%d','$and','CmCustomField','omit','pickBy','isEmpty','cm_contacts','id\x20=\x20?','text','phone','getTags','model','filters','attributes','intersection','fields','order','sort','pick','filter','nolimit','findOne','setTags','ids','setAdditionalPhones','all','ContactItemType','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','CmHopper','item','OrderBy','literal','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','ItemType','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','getHoppers','rawAttributes','ContactId','options','includeAll','include','rows','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','parse','meta','import','User','agent','No\x20phone\x20column\x20specified','binding','../../components/import/cm/csv2','stringify','message','pid','exit','error\x20child\x20process','importUpdates','child_process','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','mail','chat','openchannel','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId'];(function(_0x47ab99,_0x1b1eb3){var _0x3fa1a5=function(_0x85f150){while(--_0x85f150){_0x47ab99['push'](_0x47ab99['shift']());}};_0x3fa1a5(++_0x1b1eb3);}(_0xf131,0x127));var _0x1f13=function(_0xe19508,_0xafd97e){_0xe19508=_0xe19508-0x0;var _0x6305ff=_0xf131[_0xe19508];return _0x6305ff;};'use strict';var moment=require(_0x1f13('0x0'));var BPromise=require(_0x1f13('0x1'));var util=require('util');var path=require(_0x1f13('0x2'));var fs=require('fs');var _=require(_0x1f13('0x3'));var squel=require(_0x1f13('0x4'));var Papa=require(_0x1f13('0x5'));var Redis=require('ioredis');var contacts=require(_0x1f13('0x6'));var qs=require(_0x1f13('0x7'));var logger=require('../../config/logger')('api');var config=require(_0x1f13('0x8'));var shared=require('../../config/environment/shared');var db=require(_0x1f13('0x9'))['db'];config['redis']=_[_0x1f13('0xa')](config['redis'],{'host':_0x1f13('0xb'),'port':0x18eb});var socket=require(_0x1f13('0xc'))(new Redis(config[_0x1f13('0xd')]));require('./cmContact.socket')[_0x1f13('0xe')](socket);function respondWithResult(_0x38adaa,_0x3d971b){_0x3d971b=_0x3d971b||0xc8;return function(_0xa728ec){if(_0xa728ec){return _0x38adaa[_0x1f13('0xf')](_0x3d971b)[_0x1f13('0x10')](_0xa728ec);}};}function respondWithFilteredResult(_0xd15a7,_0x147633){return function(_0x3b514a){if(_0x3b514a){var _0x19f71a=typeof _0x147633[_0x1f13('0x11')]===_0x1f13('0x12')&&typeof _0x147633['limit']==='undefined';var _0x187fe9=_0x3b514a[_0x1f13('0x13')];var _0x32f7e5=_0x19f71a?0x0:_0x147633[_0x1f13('0x11')];var _0x3e17b0=_0x19f71a?_0x3b514a[_0x1f13('0x13')]:_0x147633[_0x1f13('0x11')]+_0x147633[_0x1f13('0x14')];var _0x2b39ae;if(_0x3e17b0>=_0x187fe9){_0x3e17b0=_0x187fe9;_0x2b39ae=0xc8;}else{_0x2b39ae=0xce;}_0xd15a7['status'](_0x2b39ae);return _0xd15a7[_0x1f13('0x15')](_0x1f13('0x16'),_0x32f7e5+'-'+_0x3e17b0+'/'+_0x187fe9)[_0x1f13('0x10')](_0x3b514a);}return null;};}function saveUpdates(_0x933dba){return function(_0x1cc201){if(_0x1cc201){return _0x1cc201[_0x1f13('0x17')](_0x933dba)[_0x1f13('0x18')](function(_0xf2926){return _0xf2926;});}return null;};}function removeEntity(_0x6ace24){return function(_0x8e35b5){if(_0x8e35b5){return _0x8e35b5[_0x1f13('0x19')]()[_0x1f13('0x18')](function(){_0x6ace24[_0x1f13('0xf')](0xcc)[_0x1f13('0x1a')]();});}};}function handleEntityNotFound(_0x59c7db){return function(_0x5154ba){if(!_0x5154ba){_0x59c7db[_0x1f13('0x1b')](0x194);}return _0x5154ba;};}function handleError(_0x3d427d,_0x413c55){_0x413c55=_0x413c55||0x1f4;return function(_0x45b4be){logger[_0x1f13('0x1c')](_0x45b4be[_0x1f13('0x1d')]);if(_0x45b4be[_0x1f13('0x1e')]){delete _0x45b4be[_0x1f13('0x1e')];}_0x3d427d[_0x1f13('0xf')](_0x413c55)[_0x1f13('0x1f')](_0x45b4be);};}exports[_0x1f13('0x20')]=function(_0x54c98e,_0x2742c3){var _0x286816={};return contacts[_0x1f13('0x21')]()[_0x1f13('0x18')](function(_0x7c2c47){_0x286816=qs[_0x1f13('0x22')](_0x7c2c47,_0x54c98e);return contacts[_0x1f13('0x23')](_0x54c98e['query'],_0x54c98e[_0x1f13('0x24')],_0x286816,_0x7c2c47);})[_0x1f13('0x18')](respondWithFilteredResult(_0x2742c3,_0x286816))[_0x1f13('0x25')](handleError(_0x2742c3,null));};exports[_0x1f13('0x19')]=function(_0x2ec940,_0x56487b){return db[_0x1f13('0x26')]['find']({'where':{'id':_0x2ec940[_0x1f13('0x27')]['id']}})[_0x1f13('0x18')](handleEntityNotFound(_0x56487b,null))[_0x1f13('0x18')](removeEntity(_0x56487b,null))[_0x1f13('0x25')](handleError(_0x56487b,null));};exports[_0x1f13('0x21')]=function(_0x44896d,_0x112497){return db[_0x1f13('0x26')][_0x1f13('0x21')]()[_0x1f13('0x18')](function(_0x5e90b7){delete _0x5e90b7[_0x1f13('0x28')];for(var _0x22808d=0x0;_0x22808d0x0){return new Promise(function(_0x4e1d42){var _0x1f023d=[];for(var _0x56df55=0x0;_0x56df55<_0x16ecc2[_0x1f13('0x2a')];_0x56df55++){_0x1f023d[_0x1f13('0x60')](insertAdditionalPhones(_0x16ecc2[_0x56df55][_0x1f13('0x63')],_0x16ecc2[_0x56df55][_0x1f13('0x5a')]));}Promise['all'](_0x1f023d)[_0x1f13('0x18')](function(){_0x4e1d42(0x1);});})[_0x1f13('0x18')](function(){return{'success':_0x312be7,'failure':_0x2a94b9,'duplicates':_0x118860};});}else{return{'success':_0x312be7,'failure':_0x2a94b9,'duplicates':_0x118860};}}})[_0x1f13('0x18')](respondWithResult(_0x4fd23b,0xc9))[_0x1f13('0x25')](handleError(_0x4fd23b,null));};exports[_0x1f13('0x64')]=function(_0x441620,_0x2b14d1){var _0x3c6c68;return db['CmContact'][_0x1f13('0x21')]()[_0x1f13('0x18')](function(_0x1a2eb6){return db[_0x1f13('0x26')][_0x1f13('0x65')]({'where':{'id':_0x441620[_0x1f13('0x27')]['id']},'include':[{'model':db[_0x1f13('0x66')],'as':'Tags','attributes':['id',_0x1f13('0x1e'),_0x1f13('0x67')],'required':_0x441620[_0x1f13('0x2f')][_0x1f13('0x68')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x1f13('0x69'),'where':{'CmContactId':_0x441620['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':'ItemType'}]}],'order':[db[_0x1f13('0x6a')]['literal'](_0x1f13('0x6b'))],'attributes':_[_0x1f13('0x29')](_0x1a2eb6)});})[_0x1f13('0x18')](function(_0x4efb61){if(!_[_0x1f13('0x56')](_0x4efb61)){_0x3c6c68=_0x4efb61[_0x1f13('0x39')]({'plain':!![]});var _0x4bf89b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4efb61&&_0x4efb61[_0x1f13('0x61')]){if(_0x4efb61[_0x1f13('0x61')]){_0x4bf89b['where']['$and']['push']({'ListId':{'$ne':_0x4efb61[_0x1f13('0x61')]}});}}return db['CmCustomField']['findAll'](_0x4bf89b);}})[_0x1f13('0x18')](function(_0x49203e){if(!_['isNil'](_0x49203e)){return _['omit'](_0x3c6c68,_[_0x1f13('0x6c')](_0x49203e,function(_0x2730b9){return util[_0x1f13('0x6d')](_0x1f13('0x6e'),_0x2730b9['id']);}));}})[_0x1f13('0x18')](handleEntityNotFound(_0x2b14d1,null))[_0x1f13('0x18')](respondWithResult(_0x2b14d1,null))[_0x1f13('0x25')](handleError(_0x2b14d1,null));};exports['update']=function(_0x4b87c0,_0x1e4de1){var _0x113884;if(_0x4b87c0[_0x1f13('0x37')]['id']){delete _0x4b87c0['body']['id'];}if(!_[_0x1f13('0x56')](_0x4b87c0[_0x1f13('0x37')][_0x1f13('0x57')])){var _0x74e5c0=_0x4b87c0['body']['dialTimezone'];if(!_['isNil'](shared[_0x1f13('0x58')][_0x74e5c0]))_0x4b87c0[_0x1f13('0x37')][_0x1f13('0x59')]=shared[_0x1f13('0x58')][_0x74e5c0][_0x1f13('0x59')];}return db[_0x1f13('0x26')]['find']({'where':{'id':_0x4b87c0[_0x1f13('0x27')]['id']}})[_0x1f13('0x18')](handleEntityNotFound(_0x1e4de1,null))['then'](saveUpdates(_0x4b87c0['body'],null))[_0x1f13('0x18')](function(_0x1bc8a7){_0x113884=_0x1bc8a7;var _0x292abe={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1bc8a7&&_0x1bc8a7['ListId']){if(_0x1bc8a7[_0x1f13('0x61')]){_0x292abe[_0x1f13('0x5e')][_0x1f13('0x6f')]['push']({'ListId':{'$ne':_0x1bc8a7[_0x1f13('0x61')]}});}}return db[_0x1f13('0x70')][_0x1f13('0x23')](_0x292abe);})['then'](function(_0x5a74b4){if(_0x5a74b4){return _[_0x1f13('0x71')](_[_0x1f13('0x72')](_0x4b87c0[_0x1f13('0x37')],function(_0x5dbd62,_0x5b898c){return _[_0x1f13('0x2b')](_0x5b898c,_0x1f13('0x2c'));}),_['map'](_0x5a74b4,function(_0x56d940){return util[_0x1f13('0x6d')](_0x1f13('0x6e'),_0x56d940['id']);}));}})[_0x1f13('0x18')](function(_0x2a1c35){if(_0x2a1c35&&!_[_0x1f13('0x73')](_0x2a1c35)){var _0x213139=squel[_0x1f13('0x17')]()['table'](_0x1f13('0x74'))['setFields'](_0x2a1c35)[_0x1f13('0x5e')](_0x1f13('0x75'),_0x4b87c0['params']['id'])['toParam']();return db[_0x1f13('0x6a')][_0x1f13('0x2f')](_0x213139[_0x1f13('0x76')],{'replacements':_0x213139['values']});}})[_0x1f13('0x18')](function(){if(_0x4b87c0[_0x1f13('0x37')][_0x1f13('0x77')]&&_0x113884){return db['CmHopper'][_0x1f13('0x17')]({'phone':_0x4b87c0['body'][_0x1f13('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x113884['id']}});}})[_0x1f13('0x18')](function(){return _0x113884;})[_0x1f13('0x18')](respondWithResult(_0x1e4de1,null))[_0x1f13('0x25')](handleError(_0x1e4de1,null));};exports[_0x1f13('0x78')]=function(_0x4b234c,_0x5f3aa4){var _0x7a9512={};var _0x1056b9={};var _0x5826ea;var _0xbd7e1f;return db[_0x1f13('0x26')]['findOne']({'where':{'id':_0x4b234c[_0x1f13('0x27')]['id']}})[_0x1f13('0x18')](handleEntityNotFound(_0x5f3aa4,null))['then'](function(_0x229cf9){if(_0x229cf9){_0x5826ea=_0x229cf9;_0x1056b9[_0x1f13('0x79')]=_[_0x1f13('0x29')](db['Tag']['rawAttributes']);_0x1056b9[_0x1f13('0x2f')]=_[_0x1f13('0x29')](_0x4b234c[_0x1f13('0x2f')]);_0x1056b9[_0x1f13('0x7a')]=_['intersection'](_0x1056b9[_0x1f13('0x79')],_0x1056b9[_0x1f13('0x2f')]);_0x7a9512[_0x1f13('0x7b')]=_[_0x1f13('0x7c')](_0x1056b9[_0x1f13('0x79')],qs[_0x1f13('0x7d')](_0x4b234c['query'][_0x1f13('0x7d')]));_0x7a9512['attributes']=_0x7a9512[_0x1f13('0x7b')][_0x1f13('0x2a')]?_0x7a9512[_0x1f13('0x7b')]:_0x1056b9['model'];_0x7a9512[_0x1f13('0x7e')]=qs['sort'](_0x4b234c[_0x1f13('0x2f')][_0x1f13('0x7f')]);_0x7a9512[_0x1f13('0x5e')]=qs['filters'](_[_0x1f13('0x80')](_0x4b234c[_0x1f13('0x2f')],_0x1056b9[_0x1f13('0x7a')]));if(_0x4b234c[_0x1f13('0x2f')][_0x1f13('0x81')]){_0x7a9512[_0x1f13('0x5e')]=_['merge'](_0x7a9512['where'],{'$or':_[_0x1f13('0x6c')](_0x7a9512[_0x1f13('0x7b')],function(_0x57f9ca){var _0x39002f={};_0x39002f[_0x57f9ca]={'$like':'%'+_0x4b234c['query'][_0x1f13('0x81')]+'%'};return _0x39002f;})});}_0x7a9512=_[_0x1f13('0x36')]({},_0x7a9512,_0x4b234c['options']);return _0x5826ea[_0x1f13('0x78')](_0x7a9512);}})[_0x1f13('0x18')](function(_0x492038){if(_0x492038){_0xbd7e1f=_0x492038['length'];if(!_0x4b234c[_0x1f13('0x2f')][_0x1f13('0x35')](_0x1f13('0x82'))){_0x7a9512[_0x1f13('0x14')]=qs[_0x1f13('0x14')](_0x4b234c['query']['limit']);_0x7a9512[_0x1f13('0x11')]=qs[_0x1f13('0x11')](_0x4b234c[_0x1f13('0x2f')]['offset']);}return _0x5826ea[_0x1f13('0x78')](_0x7a9512);}})['then'](function(_0x287e1f){if(_0x287e1f){return _0x287e1f?{'count':_0xbd7e1f,'rows':_0x287e1f}:null;}})[_0x1f13('0x18')](respondWithResult(_0x5f3aa4,null))[_0x1f13('0x25')](handleError(_0x5f3aa4,null));};exports['setTags']=function(_0x1c5418,_0x241127){if(_0x1c5418['body']['id']){delete _0x1c5418[_0x1f13('0x37')]['id'];}return db[_0x1f13('0x26')][_0x1f13('0x83')]({'where':{'id':_0x1c5418[_0x1f13('0x27')]['id']}})['then'](handleEntityNotFound(_0x241127,null))['then'](function(_0x33a312){if(_0x33a312){return _0x33a312[_0x1f13('0x84')](_0x1c5418[_0x1f13('0x37')][_0x1f13('0x85')]||[]);}return null;})[_0x1f13('0x18')](respondWithResult(_0x241127,null))[_0x1f13('0x25')](handleError(_0x241127,null));};exports[_0x1f13('0x86')]=function(_0x58ee59,_0x364986){var _0x228f4b=[];_0x228f4b[_0x1f13('0x60')](addAdditionalPhones(_0x58ee59[_0x1f13('0x37')]));Promise['all'](_0x228f4b)[_0x1f13('0x18')](function(){_0x228f4b=[];_0x228f4b[_0x1f13('0x60')](deleteCmHopperPhones(_0x58ee59['body']['id']));_0x228f4b[_0x1f13('0x60')](addCmHopperPhones(_0x58ee59[_0x1f13('0x37')]['id']));Promise[_0x1f13('0x87')](_0x228f4b)[_0x1f13('0x18')](function(){return[0x1];})[_0x1f13('0x18')](respondWithResult(_0x364986,null));});};function addAdditionalPhones(_0x5a0785){var _0x4e6328;return new Promise(function(_0x184dfa){return db[_0x1f13('0x4c')][_0x1f13('0x19')]({'where':{'CmContactId':_0x5a0785['id']}})['then'](function(){db[_0x1f13('0x88')][_0x1f13('0x23')]({'raw':!![],'attributes':['id','OrderBy']})['then'](function(_0x2fd62c){var _0xd0b53e=[];for(var _0x34f4ed=0x0;_0x34f4ed<_0x5a0785[_0x1f13('0x89')][_0x1f13('0x2a')];_0x34f4ed++){var _0x5277c5=_0x5a0785['item_types']?_[_0x1f13('0x56')](_0x5a0785[_0x1f13('0x8a')][_0x34f4ed])?'':_0x5a0785[_0x1f13('0x8a')][_0x34f4ed]:_0x5a0785[_0x1f13('0x89')][_0x34f4ed]['ItemTypeId']?_0x5a0785[_0x1f13('0x89')][_0x34f4ed][_0x1f13('0x8b')]:'';var _0x42b794=_['isNil'](_0x5a0785['items'][_0x34f4ed]['description'])?'':_0x5a0785[_0x1f13('0x89')][_0x34f4ed][_0x1f13('0x8c')];var _0x30ffa4=_0x5277c5+':'+_0x5a0785[_0x1f13('0x89')][_0x34f4ed][_0x1f13('0x77')]+'§'+_0x42b794;if(_[_0x1f13('0x56')](_0x4e6328))_0x4e6328=_0x30ffa4;else _0x4e6328+=';'+_0x30ffa4;var _0xc08cb4=null;var _0x2eb25b=null;if(_0x5a0785[_0x1f13('0x8a')]){if(!_[_0x1f13('0x56')](_0x5a0785[_0x1f13('0x8a')][_0x34f4ed])){_0x2eb25b=_[_0x1f13('0x65')](_0x2fd62c,function(_0xcccf85){return _0xcccf85['id']===_0x5a0785[_0x1f13('0x8a')][_0x34f4ed];});if(!_[_0x1f13('0x56')](_0x2eb25b)){_0xc08cb4=_0x2eb25b['OrderBy'];}}}else{if(!_[_0x1f13('0x56')](_0x5a0785[_0x1f13('0x89')][_0x34f4ed])){_0x2eb25b=_['find'](_0x2fd62c,function(_0x4a4c74){return _0x4a4c74['id']===_0x5a0785[_0x1f13('0x89')][_0x34f4ed][_0x1f13('0x8b')];});if(!_['isNil'](_0x2eb25b)){_0xc08cb4=_0x34f4ed;}}}if(_['isNil'](_0xc08cb4)){_0xc08cb4=0x64;}_0xd0b53e[_0x1f13('0x60')](addAdditionalPhone(_0x5a0785['id'],_0x5a0785[_0x1f13('0x89')][_0x34f4ed][_0x1f13('0x77')],_0x5a0785[_0x1f13('0x8a')]?_['isNil'](_0x5a0785[_0x1f13('0x8a')][_0x34f4ed])?null:_0x5a0785[_0x1f13('0x8a')][_0x34f4ed]:_0x5a0785['items'][_0x34f4ed][_0x1f13('0x8b')]?_0x5a0785['items'][_0x34f4ed][_0x1f13('0x8b')]:null,_0xc08cb4,_0x42b794));}Promise[_0x1f13('0x87')](_0xd0b53e)[_0x1f13('0x18')](function(){db[_0x1f13('0x26')][_0x1f13('0x17')]({'AdditionalPhones':_0x4e6328},{'where':{'id':_0x5a0785['id']}})[_0x1f13('0x18')](function(){_0x184dfa(0x1);});});});});});}function addAdditionalPhone(_0x1e39a5,_0x109078,_0xd05a8f,_0x237f90,_0x20876d){return db[_0x1f13('0x4c')]['find']({'where':{'CmContactId':_0x1e39a5,'item':_0x109078}})['then'](function(_0x1860d1){if(_0x1860d1)logger[_0x1f13('0x3c')](_0x1f13('0x8d'),_0x1860d1);else{db[_0x1f13('0x4c')][_0x1f13('0x54')]({'CmContactId':_0x1e39a5,'item':_0x109078,'ItemTypeId':_0xd05a8f,'OrderBy':_0x237f90,'ItemClass':_0x1f13('0x8e'),'description':_0x20876d});}});}function deleteCmHopperPhones(_0x9fac35){return new Promise(function(_0x4a74aa){return db['CmHopper'][_0x1f13('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x9fac35}})[_0x1f13('0x18')](function(_0x2a718c){db[_0x1f13('0x8f')][_0x1f13('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0x2a718c,'id')}}});})[_0x1f13('0x18')](function(){_0x4a74aa(0x1);});});}function addCmHopperPhones(_0x643795){return new Promise(function(_0x3ac17e){return db[_0x1f13('0x90')][_0x1f13('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x643795}})[_0x1f13('0x18')](function(_0x4c496a){var _0x482d53=[];_[_0x1f13('0x6c')](_0x4c496a,function(_0x55fcff){_0x482d53[_0x1f13('0x60')](createCmHopperPhone(_0x643795,_0x55fcff['id']));});Promise[_0x1f13('0x87')](_0x482d53)[_0x1f13('0x18')](function(){_0x3ac17e(0x1);});});});}function createCmHopperPhone(_0x2a2bdc,_0x558d94){return new Promise(function(_0x59250a){db[_0x1f13('0x4c')][_0x1f13('0x23')]({'raw':!![],'attributes':[_0x1f13('0x91'),'OrderBy'],'where':{'CmContactId':_0x2a2bdc,'ItemClass':_0x1f13('0x8e')},'include':[{'model':db['ContactItemType'],'attributes':[_0x1f13('0x92')],'as':'ItemType'}],'order':[_0x1f13('0x92'),db[_0x1f13('0x6a')][_0x1f13('0x93')](_0x1f13('0x94'))]})[_0x1f13('0x18')](function(_0x5b7cff){var _0x5499b5=0x1;var _0x1f694e=_[_0x1f13('0x6c')](_0x5b7cff,function(_0x23c082){_0x23c082[_0x1f13('0x95')]=_0x558d94;_0x23c082[_0x1f13('0x77')]=_0x23c082[_0x1f13('0x91')];_0x23c082[_0x1f13('0x92')]=_0x5499b5;delete _0x23c082[_0x1f13('0x96')];_0x5499b5=_0x5499b5+0x1;return _0x23c082;});return db[_0x1f13('0x8f')][_0x1f13('0x5b')](_0x1f694e,{});})[_0x1f13('0x18')](function(){_0x59250a(0x1);});});}function insertAdditionalPhones(_0x7e99e2,_0x7d6270){return new Promise(function(_0x58b13c){var _0x147354=[];for(var _0x6469ed=0x0;_0x6469ed<_0x7d6270[_0x1f13('0x2a')];_0x6469ed++){var _0x2a030f=_0x7d6270[_0x6469ed];_0x147354['push'](parseContactItemType(_0x2a030f));}Promise[_0x1f13('0x87')](_0x147354)['then'](function(){var _0x433cd4={'id':_0x7e99e2['id'],'items':_0x7d6270};return addAdditionalPhones(_0x433cd4)[_0x1f13('0x18')](function(){return addCmHopperPhones(_0x7e99e2['id']);});})[_0x1f13('0x18')](function(){_0x58b13c(_0x7e99e2);});});}function parseContactItemType(_0x2f1c21){return new Promise(function(_0x53253a){if(_0x2f1c21[_0x1f13('0x35')]('ItemTypeId')){_0x53253a(_0x2f1c21);}else{return db['ContactItemType'][_0x1f13('0x65')]({'where':{'name':_0x2f1c21[_0x1f13('0x97')]}})[_0x1f13('0x18')](function(_0x6c4f60){if(_[_0x1f13('0x56')](_0x6c4f60))_0x2f1c21['ItemTypeId']=null;else _0x2f1c21[_0x1f13('0x8b')]=_0x6c4f60['id'];_0x53253a(_0x2f1c21);});}});}exports['getAdditionalPhones']=function(_0x38dbe1,_0x51dffd){return db[_0x1f13('0x4c')][_0x1f13('0x23')]({'raw':!![],'where':{'CmContactId':_0x38dbe1[_0x1f13('0x27')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x1f13('0x88')],'as':'ItemType'}],'order':[['OrderBy'],[db[_0x1f13('0x6a')][_0x1f13('0x93')](_0x1f13('0x94'))]]})[_0x1f13('0x18')](function(_0x5e38a6){return _0x5e38a6;})[_0x1f13('0x18')](respondWithResult(_0x51dffd,null))['catch'](handleError(_0x51dffd,null));};exports[_0x1f13('0x98')]=function(_0x56fce5,_0x43427f){return db['CmContactHasItem'][_0x1f13('0x23')]({'raw':!![],'where':{'CmContactId':_0x56fce5[_0x1f13('0x37')][_0x1f13('0x99')]}})[_0x1f13('0x18')](function(_0x57f71a){var _0x518928=_[_0x1f13('0x6c')](_0x57f71a,function(_0x1d57d7){_0x1d57d7['CmContactId']=_0x56fce5['body'][_0x1f13('0x9a')];return _0x1d57d7;});return db['CmContactHasItem'][_0x1f13('0x5b')](_0x518928,{});})[_0x1f13('0x18')](function(){return addCmHopperPhones(_0x56fce5[_0x1f13('0x37')]['toContactId']);})[_0x1f13('0x18')](function(){return['ok'];})[_0x1f13('0x18')](respondWithResult(_0x43427f,null))['catch'](handleError(_0x43427f,null));};exports[_0x1f13('0x9b')]=function(_0x5c62a2,_0x4d1ae0){var _0xb3e1d4=[];_0xb3e1d4[_0x1f13('0x60')](createCmHopperPhone(_0x5c62a2['body']['id'],_0x5c62a2[_0x1f13('0x37')]['hopperId']));Promise[_0x1f13('0x87')](_0xb3e1d4)[_0x1f13('0x18')](function(){return[0x1];})[_0x1f13('0x18')](respondWithResult(_0x4d1ae0,null));};exports[_0x1f13('0x9c')]=function(_0x2a9d84,_0x19cca6){var _0x4a00ad={'raw':![],'where':{}};var _0x338352={};var _0x39cd35={'count':0x0,'rows':[]};return db[_0x1f13('0x26')]['findOne']({'where':{'id':_0x2a9d84[_0x1f13('0x27')]['id']}})['then'](handleEntityNotFound(_0x19cca6,null))[_0x1f13('0x18')](function(_0x2d79c3){if(_0x2d79c3){_0x338352[_0x1f13('0x79')]=_[_0x1f13('0x29')](db['CmHopper'][_0x1f13('0x9d')]);_0x338352[_0x1f13('0x2f')]=_[_0x1f13('0x29')](_0x2a9d84['query']);_0x338352[_0x1f13('0x7a')]=_['intersection'](_0x338352[_0x1f13('0x79')],_0x338352[_0x1f13('0x2f')]);_0x4a00ad[_0x1f13('0x7b')]=_[_0x1f13('0x7c')](_0x338352[_0x1f13('0x79')],qs['fields'](_0x2a9d84[_0x1f13('0x2f')][_0x1f13('0x7d')]));_0x4a00ad[_0x1f13('0x7b')]=_0x4a00ad[_0x1f13('0x7b')][_0x1f13('0x2a')]?_0x4a00ad[_0x1f13('0x7b')]:_0x338352[_0x1f13('0x79')];if(!_0x2a9d84['query'][_0x1f13('0x35')]('nolimit')){_0x4a00ad[_0x1f13('0x14')]=qs['limit'](_0x2a9d84[_0x1f13('0x2f')][_0x1f13('0x14')]);_0x4a00ad[_0x1f13('0x11')]=qs[_0x1f13('0x11')](_0x2a9d84[_0x1f13('0x2f')][_0x1f13('0x11')]);}_0x4a00ad[_0x1f13('0x7e')]=qs[_0x1f13('0x7f')](_0x2a9d84[_0x1f13('0x2f')]['sort']);_0x4a00ad[_0x1f13('0x5e')]=qs[_0x1f13('0x7a')](_[_0x1f13('0x80')](_0x2a9d84['query'],_0x338352['filters']));_0x4a00ad[_0x1f13('0x5e')][_0x1f13('0x9e')]=_0x2d79c3['id'];if(_0x2a9d84[_0x1f13('0x2f')]['filter']){_0x4a00ad['where']=_[_0x1f13('0x36')](_0x4a00ad[_0x1f13('0x5e')],{'$or':_[_0x1f13('0x6c')](_0x4a00ad[_0x1f13('0x7b')],function(_0x129c10){var _0x19d18b={};_0x19d18b[_0x129c10]={'$like':'%'+_0x2a9d84[_0x1f13('0x2f')]['filter']+'%'};return _0x19d18b;})});}_0x4a00ad=_['merge']({},_0x4a00ad,_0x2a9d84[_0x1f13('0x9f')]);return db[_0x1f13('0x90')][_0x1f13('0x13')]({'where':_0x4a00ad[_0x1f13('0x5e')]})[_0x1f13('0x18')](function(_0x20c1ac){_0x39cd35['count']=_0x20c1ac;if(_0x2a9d84[_0x1f13('0x2f')][_0x1f13('0xa0')]){_0x4a00ad[_0x1f13('0xa1')]=[{'all':!![]}];}return db[_0x1f13('0x90')]['findAll'](_0x4a00ad);})[_0x1f13('0x18')](function(_0x46aa33){_0x39cd35[_0x1f13('0xa2')]=_0x46aa33;return _0x39cd35;});}})['then'](respondWithFilteredResult(_0x19cca6,_0x4a00ad))[_0x1f13('0x25')](handleError(_0x19cca6,null));};exports[_0x1f13('0xa3')]=function(_0x252700,_0x2d2eae){var _0x2a4de4={'raw':!![],'where':{}};var _0xe9209f={};var _0x2d8397={'count':0x0,'rows':[]};return db[_0x1f13('0x26')][_0x1f13('0x83')]({'where':{'id':_0x252700['params']['id']}})[_0x1f13('0x18')](handleEntityNotFound(_0x2d2eae,null))['then'](function(_0x2d77a5){if(_0x2d77a5){_0xe9209f[_0x1f13('0x79')]=_[_0x1f13('0x29')](db[_0x1f13('0x4d')]['rawAttributes']);_0xe9209f[_0x1f13('0x2f')]=_['keys'](_0x252700[_0x1f13('0x2f')]);_0xe9209f[_0x1f13('0x7a')]=_['intersection'](_0xe9209f['model'],_0xe9209f[_0x1f13('0x2f')]);_0x2a4de4[_0x1f13('0x7b')]=_[_0x1f13('0x7c')](_0xe9209f[_0x1f13('0x79')],qs[_0x1f13('0x7d')](_0x252700['query'][_0x1f13('0x7d')]));_0x2a4de4[_0x1f13('0x7b')]=_0x2a4de4[_0x1f13('0x7b')][_0x1f13('0x2a')]?_0x2a4de4[_0x1f13('0x7b')]:_0xe9209f['model'];if(!_0x252700['query'][_0x1f13('0x35')]('nolimit')){_0x2a4de4['limit']=qs[_0x1f13('0x14')](_0x252700[_0x1f13('0x2f')]['limit']);_0x2a4de4[_0x1f13('0x11')]=qs[_0x1f13('0x11')](_0x252700['query']['offset']);}_0x2a4de4[_0x1f13('0x7e')]=qs[_0x1f13('0x7f')](_0x252700[_0x1f13('0x2f')][_0x1f13('0x7f')]);_0x2a4de4[_0x1f13('0x5e')]=qs[_0x1f13('0x7a')](_['pick'](_0x252700[_0x1f13('0x2f')],_0xe9209f[_0x1f13('0x7a')]));_0x2a4de4[_0x1f13('0x5e')][_0x1f13('0x9e')]=_0x2d77a5['id'];if(_0x252700[_0x1f13('0x2f')][_0x1f13('0x81')]){_0x2a4de4[_0x1f13('0x5e')]=_['merge'](_0x2a4de4[_0x1f13('0x5e')],{'$or':_[_0x1f13('0x6c')](_0x2a4de4[_0x1f13('0x7b')],function(_0x170e46){var _0x414852={};_0x414852[_0x170e46]={'$like':'%'+_0x252700['query'][_0x1f13('0x81')]+'%'};return _0x414852;})});}_0x2a4de4=_[_0x1f13('0x36')]({},_0x2a4de4,_0x252700[_0x1f13('0x9f')]);return db[_0x1f13('0x4d')]['count']({'where':_0x2a4de4[_0x1f13('0x5e')]})[_0x1f13('0x18')](function(_0x53b825){_0x2d8397['count']=_0x53b825;if(_0x252700['query'][_0x1f13('0xa0')]){_0x2a4de4[_0x1f13('0xa1')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x1f13('0x23')](_0x2a4de4);})[_0x1f13('0x18')](function(_0x256e06){_0x2d8397[_0x1f13('0xa2')]=_0x256e06;return _0x2d8397;});}})['then'](respondWithFilteredResult(_0x2d2eae,_0x2a4de4))['catch'](handleError(_0x2d2eae,null));};exports[_0x1f13('0xa4')]=function(_0x299144,_0x545f5d){var _0x10e942={'raw':!![],'where':{}};var _0x37e15d={};var _0x1b085d={'count':0x0,'rows':[]};return db[_0x1f13('0x26')][_0x1f13('0x83')]({'where':{'id':_0x299144[_0x1f13('0x27')]['id']}})[_0x1f13('0x18')](handleEntityNotFound(_0x545f5d,null))[_0x1f13('0x18')](function(_0x2fd9a2){if(_0x2fd9a2){_0x37e15d['model']=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x37e15d[_0x1f13('0x2f')]=_[_0x1f13('0x29')](_0x299144['query']);_0x37e15d[_0x1f13('0x7a')]=_[_0x1f13('0x7c')](_0x37e15d[_0x1f13('0x79')],_0x37e15d['query']);_0x10e942[_0x1f13('0x7b')]=_[_0x1f13('0x7c')](_0x37e15d[_0x1f13('0x79')],qs[_0x1f13('0x7d')](_0x299144[_0x1f13('0x2f')][_0x1f13('0x7d')]));_0x10e942['attributes']=_0x10e942[_0x1f13('0x7b')][_0x1f13('0x2a')]?_0x10e942['attributes']:_0x37e15d[_0x1f13('0x79')];if(!_0x299144[_0x1f13('0x2f')][_0x1f13('0x35')](_0x1f13('0x82'))){_0x10e942[_0x1f13('0x14')]=qs[_0x1f13('0x14')](_0x299144[_0x1f13('0x2f')][_0x1f13('0x14')]);_0x10e942[_0x1f13('0x11')]=qs[_0x1f13('0x11')](_0x299144[_0x1f13('0x2f')][_0x1f13('0x11')]);}_0x10e942[_0x1f13('0x7e')]=qs[_0x1f13('0x7f')](_0x299144[_0x1f13('0x2f')][_0x1f13('0x7f')]);_0x10e942[_0x1f13('0x5e')]=qs[_0x1f13('0x7a')](_['pick'](_0x299144[_0x1f13('0x2f')],_0x37e15d[_0x1f13('0x7a')]));_0x10e942[_0x1f13('0x5e')][_0x1f13('0x9e')]=_0x2fd9a2['id'];if(_0x299144[_0x1f13('0x2f')][_0x1f13('0x81')]){_0x10e942[_0x1f13('0x5e')]=_[_0x1f13('0x36')](_0x10e942[_0x1f13('0x5e')],{'$or':_['map'](_0x10e942[_0x1f13('0x7b')],function(_0x5a2ca0){var _0xfce451={};_0xfce451[_0x5a2ca0]={'$like':'%'+_0x299144[_0x1f13('0x2f')][_0x1f13('0x81')]+'%'};return _0xfce451;})});}_0x10e942=_[_0x1f13('0x36')]({},_0x10e942,_0x299144[_0x1f13('0x9f')]);return db['CmHopperFinal'][_0x1f13('0x13')]({'where':_0x10e942[_0x1f13('0x5e')]})[_0x1f13('0x18')](function(_0x1b6ee9){_0x1b085d[_0x1f13('0x13')]=_0x1b6ee9;if(_0x299144[_0x1f13('0x2f')][_0x1f13('0xa0')]){_0x10e942['include']=[{'all':!![]}];}return db[_0x1f13('0xa5')]['findAll'](_0x10e942);})[_0x1f13('0x18')](function(_0x3e82f4){_0x1b085d[_0x1f13('0xa2')]=_0x3e82f4;return _0x1b085d;});}})[_0x1f13('0x18')](respondWithFilteredResult(_0x545f5d,_0x10e942))['catch'](handleError(_0x545f5d,null));};exports[_0x1f13('0xa6')]=function(_0x28ea59,_0x323a11){var _0x4e8c00={'raw':!![],'where':{}};var _0x4f0259={};var _0x4d1d65={'count':0x0,'rows':[]};return db['CmContact'][_0x1f13('0x83')]({'where':{'id':_0x28ea59[_0x1f13('0x27')]['id']}})[_0x1f13('0x18')](handleEntityNotFound(_0x323a11,null))[_0x1f13('0x18')](function(_0xe6edf5){if(_0xe6edf5){_0x4f0259[_0x1f13('0x79')]=_[_0x1f13('0x29')](db[_0x1f13('0xa7')]['rawAttributes']);_0x4f0259[_0x1f13('0x2f')]=_[_0x1f13('0x29')](_0x28ea59['query']);_0x4f0259['filters']=_[_0x1f13('0x7c')](_0x4f0259[_0x1f13('0x79')],_0x4f0259[_0x1f13('0x2f')]);_0x4e8c00[_0x1f13('0x7b')]=_[_0x1f13('0x7c')](_0x4f0259[_0x1f13('0x79')],qs[_0x1f13('0x7d')](_0x28ea59[_0x1f13('0x2f')][_0x1f13('0x7d')]));_0x4e8c00[_0x1f13('0x7b')]=_0x4e8c00[_0x1f13('0x7b')][_0x1f13('0x2a')]?_0x4e8c00[_0x1f13('0x7b')]:_0x4f0259[_0x1f13('0x79')];if(!_0x28ea59[_0x1f13('0x2f')]['hasOwnProperty'](_0x1f13('0x82'))){_0x4e8c00[_0x1f13('0x14')]=qs[_0x1f13('0x14')](_0x28ea59[_0x1f13('0x2f')][_0x1f13('0x14')]);_0x4e8c00[_0x1f13('0x11')]=qs[_0x1f13('0x11')](_0x28ea59['query'][_0x1f13('0x11')]);}_0x4e8c00[_0x1f13('0x7e')]=qs[_0x1f13('0x7f')](_0x28ea59[_0x1f13('0x2f')][_0x1f13('0x7f')]);_0x4e8c00['where']=qs['filters'](_[_0x1f13('0x80')](_0x28ea59[_0x1f13('0x2f')],_0x4f0259['filters']));_0x4e8c00['where'][_0x1f13('0x9e')]=_0xe6edf5['id'];if(_0x28ea59[_0x1f13('0x2f')]['filter']){_0x4e8c00[_0x1f13('0x5e')]=_[_0x1f13('0x36')](_0x4e8c00[_0x1f13('0x5e')],{'$or':_[_0x1f13('0x6c')](_0x4e8c00[_0x1f13('0x7b')],function(_0x3e5d12){var _0x3fb56a={};_0x3fb56a[_0x3e5d12]={'$like':'%'+_0x28ea59[_0x1f13('0x2f')]['filter']+'%'};return _0x3fb56a;})});}_0x4e8c00=_['merge']({},_0x4e8c00,_0x28ea59[_0x1f13('0x9f')]);return db[_0x1f13('0xa7')]['count']({'where':_0x4e8c00['where']})[_0x1f13('0x18')](function(_0x46a82a){_0x4d1d65['count']=_0x46a82a;if(_0x28ea59[_0x1f13('0x2f')][_0x1f13('0xa0')]){_0x4e8c00[_0x1f13('0xa1')]=[{'all':!![]}];}return db[_0x1f13('0xa7')]['findAll'](_0x4e8c00);})[_0x1f13('0x18')](function(_0x3986bf){_0x4d1d65[_0x1f13('0xa2')]=_0x3986bf;return _0x4d1d65;});}})['then'](respondWithFilteredResult(_0x323a11,_0x4e8c00))[_0x1f13('0x25')](handleError(_0x323a11,null));};exports[_0x1f13('0xa8')]=function(_0x186e90,_0x1676dd){try{if(!_0x186e90['body'][_0x1f13('0x61')]){throw new Error(_0x1f13('0xa9'));}if(!_0x186e90['body'][_0x1f13('0xaa')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x186e90[_0x1f13('0x37')][_0x1f13('0xab')]){throw new Error(_0x1f13('0xac'));}if(!_0x186e90[_0x1f13('0x37')][_0x1f13('0xad')]){throw new Error(_0x1f13('0xae'));}var _0xc1ee98=_0x186e90[_0x1f13('0x37')]['binding_keys'][_0x1f13('0xaf')](',');var _0x73790d=_0x186e90[_0x1f13('0x37')][_0x1f13('0xab')][_0x1f13('0xaf')](',');if(!_0xc1ee98[_0x1f13('0x2a')]||!_0x73790d[_0x1f13('0x2a')]||_0xc1ee98[_0x1f13('0x2a')]!==_0x73790d[_0x1f13('0x2a')]){throw new Error(_0x1f13('0xb0'));}_0x186e90[_0x1f13('0x37')]['fields']=_[_0x1f13('0xb1')](_0xc1ee98,_0x73790d);if(!_0x186e90[_0x1f13('0x37')][_0x1f13('0x7d')][_0x1f13('0x77')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x186e90['body'][_0x1f13('0x7d')][_0x1f13('0xb2')]){throw new Error(_0x1f13('0xb3'));}var _0x1f04ff=path[_0x1f13('0x55')](config[_0x1f13('0xb4')],_0x1f13('0xb5'),_0x186e90[_0x1f13('0xb6')][_0x1f13('0xb7')]);fs[_0x1f13('0xb8')](_0x1f04ff,parseInt(_0x1f13('0xb9'),0x8));var _0x5f1f87=require('child_process')[_0x1f13('0xba')](path[_0x1f13('0x55')](__dirname,_0x1f13('0xbb')),[_0x1f04ff,_0x186e90[_0x1f13('0x37')]['binding_keys'],_0x186e90[_0x1f13('0x37')]['binding_values'],_0x186e90[_0x1f13('0x37')][_0x1f13('0x61')],_0x186e90[_0x1f13('0x37')][_0x1f13('0xbc')],_0x186e90[_0x1f13('0x37')][_0x1f13('0x5d')],_0x186e90[_0x1f13('0x37')][_0x1f13('0xad')]]);return _0x1676dd[_0x1f13('0xf')](0xc8)[_0x1f13('0x10')]({'message':_0x1f13('0xbd'),'pid':_0x5f1f87['pid']});}catch(_0x453c92){return _0x1676dd[_0x1f13('0xf')](0x1f4)[_0x1f13('0x1f')](_0x453c92);}};exports[_0x1f13('0xbe')]=function(_0xd4e325,_0x11bb18){var _0x2e38ca=fs[_0x1f13('0xbf')](_0xd4e325['file'][_0x1f13('0x2')]);Papa[_0x1f13('0xc0')](_0x2e38ca,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x423ef0){return _0x11bb18[_0x1f13('0xf')](0xc8)['json']({'file':_0xd4e325[_0x1f13('0xb6')],'fields':_0x423ef0[_0x1f13('0xc1')][_0x1f13('0x7d')]});}});};exports[_0x1f13('0xc2')]=function(_0x346251,_0x57789c){return db[_0x1f13('0xc3')][_0x1f13('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1f13('0xc4')}})['then'](function(_0x1fcb00){var _0x421c0c=![];if(!_0x346251['body'][_0x1f13('0x61')]){throw new Error(_0x1f13('0xa9'));}if(!_0x346251[_0x1f13('0x37')]['binding']['phone']){throw new Error(_0x1f13('0xc5'));}if(!_0x346251[_0x1f13('0x37')][_0x1f13('0xc6')][_0x1f13('0xb2')]){throw new Error(_0x1f13('0xb3'));}if(!_0x346251[_0x1f13('0x37')][_0x1f13('0xad')]){throw new Error(_0x1f13('0xae'));}var _0x236f1d=require('child_process')[_0x1f13('0xba')](path[_0x1f13('0x55')](__dirname,_0x1f13('0xc7')),[_0x346251[_0x1f13('0x27')]['id'],JSON[_0x1f13('0xc8')](_0x346251['body']),JSON['stringify'](_0x1fcb00)]);_0x236f1d['on'](_0x1f13('0xc9'),function(){_0x421c0c=!![];return _0x57789c[_0x1f13('0xf')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x236f1d[_0x1f13('0xca')]});});_0x236f1d['on'](_0x1f13('0xcb'),function(_0x4e9622){if(_0x4e9622&&!_0x421c0c){return _0x57789c[_0x1f13('0xf')](0x1f4)[_0x1f13('0x10')]({'message':_0x1f13('0xcc'),'pid':_0x236f1d[_0x1f13('0xca')]});}});})['catch'](handleError(_0x57789c,null));};exports[_0x1f13('0xcd')]=function(_0x21fe84,_0x204020){return db['User'][_0x1f13('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1f13('0xc4')}})[_0x1f13('0x18')](function(_0xfb915){var _0x285596=![];if(!_0x21fe84[_0x1f13('0x37')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x21fe84[_0x1f13('0x37')][_0x1f13('0xc6')][_0x1f13('0x77')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x21fe84['body'][_0x1f13('0xc6')][_0x1f13('0xb2')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x21fe84[_0x1f13('0x37')][_0x1f13('0xad')]){throw new Error(_0x1f13('0xae'));}var _0xcff088=require(_0x1f13('0xce'))[_0x1f13('0xba')](path[_0x1f13('0x55')](__dirname,_0x1f13('0xcf')),[_0x21fe84['params']['id'],JSON['stringify'](_0x21fe84[_0x1f13('0x37')]),JSON[_0x1f13('0xc8')](_0xfb915)]);_0xcff088['on']('message',function(){_0x285596=!![];return _0x204020[_0x1f13('0xf')](0xc8)[_0x1f13('0x10')]({'message':_0x1f13('0xd0'),'pid':_0xcff088[_0x1f13('0xca')]});});_0xcff088['on'](_0x1f13('0xcb'),function(_0x29f895){if(_0x29f895&&!_0x285596){return _0x204020[_0x1f13('0xf')](0x1f4)[_0x1f13('0x10')]({'message':_0x1f13('0xcc'),'pid':_0xcff088[_0x1f13('0xca')]});}});})[_0x1f13('0x25')](handleError(_0x204020,null));};exports['getJourney']=function(_0x4ca182,_0x5f5086){var _0x32ea26=[_0x1f13('0xd1'),_0x1f13('0xd2'),'sms',_0x1f13('0xd3'),'fax',_0x1f13('0xd4'),_0x1f13('0xd5')];var _0xe72235={'offset':0x0,'order':qs[_0x1f13('0x7f')](_0x1f13('0xd6'))},_0x2b0ddc={'count':0x0,'rows':[]};Promise[_0x1f13('0xd7')]()[_0x1f13('0x18')](function(){if(_0x4ca182[_0x1f13('0x2f')][_0x1f13('0xd8')]){if(!_[_0x1f13('0xd9')](_0x32ea26,_0x4ca182[_0x1f13('0x2f')]['channel'][_0x1f13('0xda')]())){throw new Error('Invalid\x20channel');}_0x32ea26=[_0x4ca182[_0x1f13('0x2f')][_0x1f13('0xd8')][_0x1f13('0xda')]()];}if(_0x4ca182['query'][_0x1f13('0xdb')]){try{var _0x10761d=JSON[_0x1f13('0xc0')](_0x4ca182[_0x1f13('0x2f')][_0x1f13('0xdb')]);if(!moment(_0x10761d[_0x1f13('0x38')])['isValid']()){throw new Error(_0x1f13('0xdc'));}if(!moment(_0x10761d['to'])['isValid']()){throw new Error(_0x1f13('0xdd'));}}catch(_0x369f0e){throw new Error(_0x1f13('0xde'));}}if(!_0x4ca182[_0x1f13('0x2f')]['hasOwnProperty'](_0x1f13('0x82'))){_0xe72235[_0x1f13('0x14')]=qs[_0x1f13('0x14')](_0x4ca182[_0x1f13('0x2f')][_0x1f13('0x14')]||0xa);_0xe72235['offset']=qs[_0x1f13('0x11')](_0x4ca182[_0x1f13('0x2f')][_0x1f13('0x11')]);}var _0x1bd663=_0x32ea26[_0x1f13('0x6c')](function(_0x1ae23d){if(_0x1ae23d===_0x1f13('0xd5')){var _0x40fac3={'attributes':['id',_0x1f13('0xdf'),'type','source',_0x1f13('0xe0'),_0x1f13('0xe1'),_0x1f13('0xe2'),_0x1f13('0xe3'),_0x1f13('0xe4'),_0x1f13('0xe5'),_0x1f13('0xe6'),_0x1f13('0xe7'),_0x1f13('0xe8'),_0x1f13('0xe9'),_0x1f13('0xea')],'where':{'ContactId':_0x4ca182['params']['id']},'include':[{'model':db[_0x1f13('0xc3')],'as':'User','attributes':['id','name',_0x1f13('0xeb'),_0x1f13('0xec')]}],'order':[[_0x1f13('0xe6'),'DESC']]};if(_0x4ca182[_0x1f13('0x2f')][_0x1f13('0xdb')]){_0x40fac3['where'][_0x1f13('0xe6')]={'$gte':_0x10761d[_0x1f13('0x38')],'$lte':_0x10761d['to']};}return db[_0x1f13('0x4f')]['findAndCountAll'](_0x40fac3)[_0x1f13('0x18')](function(_0x3dde83){_0x2b0ddc[_0x1f13('0x13')]+=_0x3dde83[_0x1f13('0x13')];return _['map'](_0x3dde83['rows'],function(_0x2857d7){var _0x468cc3=_0x2857d7[_0x1f13('0x39')]({'plain':!![]});_0x468cc3[_0x1f13('0xd8')]=_0x1ae23d;if(_0x468cc3[_0x1f13('0xc3')]){_0x468cc3[_0x1f13('0xc3')]={'id':_0x468cc3[_0x1f13('0xc3')]['id'],'name':_0x468cc3['User'][_0x1f13('0x1e')],'fullname':_0x468cc3[_0x1f13('0xc3')][_0x1f13('0xeb')],'alias':_0x468cc3[_0x1f13('0xc3')][_0x1f13('0xec')]};}return _0x468cc3;});});}else{var _0x172b75=_[_0x1f13('0xed')](_0x1ae23d)+(_0x1ae23d===_0x1f13('0xd2')?'Website':_0x1f13('0xee'));var _0x17fde9={'attributes':['id',_0x1f13('0xef'),_0x1f13('0xf0'),_0x1f13('0xe6'),_0x1f13('0xe5'),_0x1f13('0xf1'),_0x1f13('0xf2'),_0x1f13('0xf3'),_0x1f13('0xea'),_0x172b75+'Id'],'where':{'ContactId':_0x4ca182[_0x1f13('0x27')]['id']},'include':[{'model':db[_0x172b75],'as':_0x1f13('0xee'),'attributes':['id',_0x1f13('0x1e'),'key']},{'model':db[_0x1f13('0xc3')],'as':'Owner','attributes':['id',_0x1f13('0x1e'),'fullname']},{'model':db[_0x1f13('0x66')],'as':_0x1f13('0xf4'),'attributes':['id',_0x1f13('0x1e'),'color'],'through':{'attributes':[]}}],'order':[[_0x1f13('0xe6'),_0x1f13('0xf5')]]};if(_0x4ca182[_0x1f13('0x2f')][_0x1f13('0xdb')]){_0x17fde9[_0x1f13('0x5e')][_0x1f13('0xe6')]={'$gte':_0x10761d[_0x1f13('0x38')],'$lte':_0x10761d['to']};}switch(_0x1ae23d){case'chat':_0x17fde9['attributes'][_0x1f13('0x60')](_0x1f13('0xf6'),_0x1f13('0xf7'),_0x1f13('0xf8'),_0x1f13('0xf9'),_0x1f13('0xfa'),_0x1f13('0xfb'),_0x1f13('0xfc'),_0x1f13('0xfd'),_0x1f13('0xfe'));break;case _0x1f13('0xd1'):_0x17fde9[_0x1f13('0x7b')][_0x1f13('0x60')](_0x1f13('0xff'),'substatus');break;case _0x1f13('0xd3'):_0x17fde9[_0x1f13('0x7b')][_0x1f13('0x60')](_0x1f13('0x100'),_0x1f13('0x101'));break;}return db[_['startCase'](_0x1ae23d)+'Interaction'][_0x1f13('0x102')](_0x17fde9)[_0x1f13('0x18')](function(_0x4cc122){_0x2b0ddc['count']+=_0x4cc122[_0x1f13('0x13')];return _['map'](_0x4cc122['rows'],function(_0x28a7af){var _0x3a00fa=_0x28a7af[_0x1f13('0x39')]({'plain':!![]});_0x3a00fa[_0x1f13('0xd8')]=_0x1ae23d;if(_0x3a00fa[_0x1f13('0x103')]){_0x3a00fa[_0x1f13('0x103')]={'id':_0x3a00fa[_0x1f13('0x103')]['id'],'name':_0x3a00fa[_0x1f13('0x103')][_0x1f13('0x1e')],'fullname':_0x3a00fa[_0x1f13('0x103')][_0x1f13('0xeb')]};}return _0x3a00fa;});});}});return Promise['all'](_0x1bd663);})['then'](function(_0x265d75){return _(_0x265d75)[_0x1f13('0x104')]()[_0x1f13('0x105')]('createdAt')[_0x1f13('0x106')]()[_0x1f13('0x107')]();})[_0x1f13('0x18')](function(_0x43a54c){_0x2b0ddc[_0x1f13('0xa2')]=_0xe72235['limit']?_0x43a54c[_0x1f13('0x108')](_0xe72235['offset'],_0xe72235[_0x1f13('0x11')]+_0xe72235[_0x1f13('0x14')]):_0x43a54c;return _0x2b0ddc;})['then'](respondWithFilteredResult(_0x5f5086,_0xe72235))[_0x1f13('0x25')](handleError(_0x5f5086,null));}; \ No newline at end of file +var _0xd04f=['findOne','rawAttributes','order','ContactId','includeAll','include','rows','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','upload','createReadStream','parse','meta','import','User','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','pid','importUpdates','No\x20phone\x20column\x20specified','mail','chat','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','fullname','DESC','findAndCountAll','startCase','Account','closed','disposition','thirdDisposition','key','Owner','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','subject','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','moment','util','path','lodash','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','json','offset','undefined','count','limit','status','set','update','then','destroy','end','sendStatus','error','stack','name','send','index','describe','getOptions','query','user','CmContact','find','params','length','keys','cf_','columnName','displayName','analytics','CmCustomField','alias','custom','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','catch','body','get','mergeWith','tags','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','spread','contact','show','Tag','Tags','color','tag','ContactItemType','ItemType','Phones.OrderBy','$and','findAll','omit','format','cf_%d','pickBy','startsWith','map','table','cm_contacts','id\x20=\x20?','toParam','sequelize','text','values','phone','getTags','model','filters','intersection','attributes','fields','sort','pick','filter','merge','options','setTags','ids','setAdditionalPhones','all','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers'];(function(_0xf1ed1b,_0x9968bb){var _0x1eed5d=function(_0x2ce5c7){while(--_0x2ce5c7){_0xf1ed1b['push'](_0xf1ed1b['shift']());}};_0x1eed5d(++_0x9968bb);}(_0xd04f,0x66));var _0xfd04=function(_0x29eccf,_0x454476){_0x29eccf=_0x29eccf-0x0;var _0x76b226=_0xd04f[_0x29eccf];return _0x76b226;};'use strict';var moment=require(_0xfd04('0x0'));var BPromise=require('bluebird');var util=require(_0xfd04('0x1'));var path=require(_0xfd04('0x2'));var fs=require('fs');var _=require(_0xfd04('0x3'));var squel=require('squel');var Papa=require(_0xfd04('0x4'));var Redis=require(_0xfd04('0x5'));var contacts=require('../../components/contacts');var qs=require(_0xfd04('0x6'));var logger=require(_0xfd04('0x7'))('api');var config=require(_0xfd04('0x8'));var shared=require(_0xfd04('0x9'));var db=require(_0xfd04('0xa'))['db'];config[_0xfd04('0xb')]=_[_0xfd04('0xc')](config[_0xfd04('0xb')],{'host':_0xfd04('0xd'),'port':0x18eb});var socket=require(_0xfd04('0xe'))(new Redis(config[_0xfd04('0xb')]));require(_0xfd04('0xf'))['register'](socket);function respondWithResult(_0x3fa014,_0x58fd19){_0x58fd19=_0x58fd19||0xc8;return function(_0x39dbb5){if(_0x39dbb5){return _0x3fa014['status'](_0x58fd19)[_0xfd04('0x10')](_0x39dbb5);}};}function respondWithFilteredResult(_0x13acb9,_0x420c39){return function(_0x35836e){if(_0x35836e){var _0x19449a=typeof _0x420c39[_0xfd04('0x11')]===_0xfd04('0x12')&&typeof _0x420c39['limit']==='undefined';var _0x6b87b7=_0x35836e[_0xfd04('0x13')];var _0x3f6541=_0x19449a?0x0:_0x420c39['offset'];var _0x4cdd6d=_0x19449a?_0x35836e[_0xfd04('0x13')]:_0x420c39[_0xfd04('0x11')]+_0x420c39[_0xfd04('0x14')];var _0x1f344b;if(_0x4cdd6d>=_0x6b87b7){_0x4cdd6d=_0x6b87b7;_0x1f344b=0xc8;}else{_0x1f344b=0xce;}_0x13acb9[_0xfd04('0x15')](_0x1f344b);return _0x13acb9[_0xfd04('0x16')]('Content-Range',_0x3f6541+'-'+_0x4cdd6d+'/'+_0x6b87b7)['json'](_0x35836e);}return null;};}function saveUpdates(_0x5e67a1){return function(_0x52ced4){if(_0x52ced4){return _0x52ced4[_0xfd04('0x17')](_0x5e67a1)[_0xfd04('0x18')](function(_0x22704e){return _0x22704e;});}return null;};}function removeEntity(_0x5817df){return function(_0x3e615e){if(_0x3e615e){return _0x3e615e[_0xfd04('0x19')]()[_0xfd04('0x18')](function(){_0x5817df['status'](0xcc)[_0xfd04('0x1a')]();});}};}function handleEntityNotFound(_0x438475){return function(_0x5aeb65){if(!_0x5aeb65){_0x438475[_0xfd04('0x1b')](0x194);}return _0x5aeb65;};}function handleError(_0x3225d2,_0x5b4727){_0x5b4727=_0x5b4727||0x1f4;return function(_0x2ac2b3){logger[_0xfd04('0x1c')](_0x2ac2b3[_0xfd04('0x1d')]);if(_0x2ac2b3[_0xfd04('0x1e')]){delete _0x2ac2b3[_0xfd04('0x1e')];}_0x3225d2[_0xfd04('0x15')](_0x5b4727)[_0xfd04('0x1f')](_0x2ac2b3);};}exports[_0xfd04('0x20')]=function(_0x162c84,_0x317d02){var _0x31f914={};return contacts[_0xfd04('0x21')]()[_0xfd04('0x18')](function(_0x5e9f55){_0x31f914=qs[_0xfd04('0x22')](_0x5e9f55,_0x162c84);return contacts['findAll'](_0x162c84[_0xfd04('0x23')],_0x162c84[_0xfd04('0x24')],_0x31f914,_0x5e9f55);})[_0xfd04('0x18')](respondWithFilteredResult(_0x317d02,_0x31f914))['catch'](handleError(_0x317d02,null));};exports[_0xfd04('0x19')]=function(_0x7e51bd,_0x55c6ca){return db[_0xfd04('0x25')][_0xfd04('0x26')]({'where':{'id':_0x7e51bd[_0xfd04('0x27')]['id']}})['then'](handleEntityNotFound(_0x55c6ca,null))[_0xfd04('0x18')](removeEntity(_0x55c6ca,null))['catch'](handleError(_0x55c6ca,null));};exports[_0xfd04('0x21')]=function(_0x9d40a7,_0x628bb){return db[_0xfd04('0x25')][_0xfd04('0x21')]()['then'](function(_0x323c79){delete _0x323c79['tags'];for(var _0x25da32=0x0;_0x25da320x0){return new Promise(function(_0x563d69){var _0x467d6b=[];for(var _0x54d582=0x0;_0x54d582<_0x72061e[_0xfd04('0x28')];_0x54d582++){_0x467d6b[_0xfd04('0x62')](insertAdditionalPhones(_0x72061e[_0x54d582][_0xfd04('0x65')],_0x72061e[_0x54d582][_0xfd04('0x5c')]));}Promise['all'](_0x467d6b)[_0xfd04('0x18')](function(){_0x563d69(0x1);});})[_0xfd04('0x18')](function(){return{'success':_0x396fc0,'failure':_0x265a27,'duplicates':_0x5477b8};});}else{return{'success':_0x396fc0,'failure':_0x265a27,'duplicates':_0x5477b8};}}})['then'](respondWithResult(_0x1e7bba,0xc9))['catch'](handleError(_0x1e7bba,null));};exports[_0xfd04('0x66')]=function(_0x214488,_0x1c1bb2){var _0x52c6b5;return db[_0xfd04('0x25')][_0xfd04('0x21')]()[_0xfd04('0x18')](function(_0x23a85e){return db['CmContact'][_0xfd04('0x26')]({'where':{'id':_0x214488['params']['id']},'include':[{'model':db[_0xfd04('0x67')],'as':_0xfd04('0x68'),'attributes':['id','name',_0xfd04('0x69')],'required':_0x214488[_0xfd04('0x23')][_0xfd04('0x6a')]?!![]:![]},{'model':db[_0xfd04('0x4b')],'as':'Phones','where':{'CmContactId':_0x214488[_0xfd04('0x27')]['id']},'required':![],'include':[{'model':db[_0xfd04('0x6b')],'as':_0xfd04('0x6c')}]}],'order':[db['sequelize']['literal'](_0xfd04('0x6d'))],'attributes':_['keys'](_0x23a85e)});})[_0xfd04('0x18')](function(_0x3d3ecd){if(!_[_0xfd04('0x58')](_0x3d3ecd)){_0x52c6b5=_0x3d3ecd[_0xfd04('0x37')]({'plain':!![]});var _0xd95f1a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3d3ecd&&_0x3d3ecd[_0xfd04('0x63')]){if(_0x3d3ecd[_0xfd04('0x63')]){_0xd95f1a[_0xfd04('0x60')][_0xfd04('0x6e')][_0xfd04('0x62')]({'ListId':{'$ne':_0x3d3ecd['ListId']}});}}return db['CmCustomField'][_0xfd04('0x6f')](_0xd95f1a);}})['then'](function(_0x528b26){if(!_[_0xfd04('0x58')](_0x528b26)){return _[_0xfd04('0x70')](_0x52c6b5,_['map'](_0x528b26,function(_0x3a1907){return util[_0xfd04('0x71')](_0xfd04('0x72'),_0x3a1907['id']);}));}})[_0xfd04('0x18')](handleEntityNotFound(_0x1c1bb2,null))[_0xfd04('0x18')](respondWithResult(_0x1c1bb2,null))['catch'](handleError(_0x1c1bb2,null));};exports[_0xfd04('0x17')]=function(_0x5d2602,_0x7f12e6){var _0x2b5b9c;if(_0x5d2602[_0xfd04('0x36')]['id']){delete _0x5d2602['body']['id'];}if(!_[_0xfd04('0x58')](_0x5d2602[_0xfd04('0x36')][_0xfd04('0x59')])){var _0x492c88=_0x5d2602[_0xfd04('0x36')][_0xfd04('0x59')];if(!_['isNil'](shared[_0xfd04('0x5a')][_0x492c88]))_0x5d2602[_0xfd04('0x36')][_0xfd04('0x5b')]=shared[_0xfd04('0x5a')][_0x492c88]['utcOffset'];}return db[_0xfd04('0x25')]['find']({'where':{'id':_0x5d2602[_0xfd04('0x27')]['id']}})[_0xfd04('0x18')](handleEntityNotFound(_0x7f12e6,null))[_0xfd04('0x18')](saveUpdates(_0x5d2602[_0xfd04('0x36')],null))[_0xfd04('0x18')](function(_0x5a13c9){_0x2b5b9c=_0x5a13c9;var _0x19a9d0={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5a13c9&&_0x5a13c9['ListId']){if(_0x5a13c9[_0xfd04('0x63')]){_0x19a9d0[_0xfd04('0x60')][_0xfd04('0x6e')][_0xfd04('0x62')]({'ListId':{'$ne':_0x5a13c9[_0xfd04('0x63')]}});}}return db[_0xfd04('0x2e')]['findAll'](_0x19a9d0);})[_0xfd04('0x18')](function(_0x4426ba){if(_0x4426ba){return _[_0xfd04('0x70')](_[_0xfd04('0x73')](_0x5d2602[_0xfd04('0x36')],function(_0x2db0ad,_0x1ba789){return _[_0xfd04('0x74')](_0x1ba789,_0xfd04('0x2a'));}),_[_0xfd04('0x75')](_0x4426ba,function(_0x1a28e4){return util[_0xfd04('0x71')](_0xfd04('0x72'),_0x1a28e4['id']);}));}})['then'](function(_0x3233d8){if(_0x3233d8&&!_['isEmpty'](_0x3233d8)){var _0x26ab70=squel[_0xfd04('0x17')]()[_0xfd04('0x76')](_0xfd04('0x77'))['setFields'](_0x3233d8)[_0xfd04('0x60')](_0xfd04('0x78'),_0x5d2602[_0xfd04('0x27')]['id'])[_0xfd04('0x79')]();return db[_0xfd04('0x7a')][_0xfd04('0x23')](_0x26ab70[_0xfd04('0x7b')],{'replacements':_0x26ab70[_0xfd04('0x7c')]});}})['then'](function(){if(_0x5d2602['body'][_0xfd04('0x7d')]&&_0x2b5b9c){return db[_0xfd04('0x3e')]['update']({'phone':_0x5d2602[_0xfd04('0x36')][_0xfd04('0x7d')],'OrderBy':0x0},{'where':{'ContactId':_0x2b5b9c['id']}});}})[_0xfd04('0x18')](function(){return _0x2b5b9c;})['then'](respondWithResult(_0x7f12e6,null))[_0xfd04('0x35')](handleError(_0x7f12e6,null));};exports[_0xfd04('0x7e')]=function(_0x46327c,_0x27befa){var _0x25d86f={};var _0x4dac2f={};var _0x3eb4b5;var _0x2fdebd;return db[_0xfd04('0x25')]['findOne']({'where':{'id':_0x46327c[_0xfd04('0x27')]['id']}})[_0xfd04('0x18')](handleEntityNotFound(_0x27befa,null))[_0xfd04('0x18')](function(_0x57f92b){if(_0x57f92b){_0x3eb4b5=_0x57f92b;_0x4dac2f[_0xfd04('0x7f')]=_['keys'](db['Tag']['rawAttributes']);_0x4dac2f[_0xfd04('0x23')]=_[_0xfd04('0x29')](_0x46327c[_0xfd04('0x23')]);_0x4dac2f[_0xfd04('0x80')]=_[_0xfd04('0x81')](_0x4dac2f[_0xfd04('0x7f')],_0x4dac2f[_0xfd04('0x23')]);_0x25d86f[_0xfd04('0x82')]=_[_0xfd04('0x81')](_0x4dac2f[_0xfd04('0x7f')],qs[_0xfd04('0x83')](_0x46327c[_0xfd04('0x23')][_0xfd04('0x83')]));_0x25d86f[_0xfd04('0x82')]=_0x25d86f['attributes'][_0xfd04('0x28')]?_0x25d86f[_0xfd04('0x82')]:_0x4dac2f[_0xfd04('0x7f')];_0x25d86f['order']=qs[_0xfd04('0x84')](_0x46327c[_0xfd04('0x23')]['sort']);_0x25d86f['where']=qs[_0xfd04('0x80')](_[_0xfd04('0x85')](_0x46327c[_0xfd04('0x23')],_0x4dac2f[_0xfd04('0x80')]));if(_0x46327c['query'][_0xfd04('0x86')]){_0x25d86f[_0xfd04('0x60')]=_[_0xfd04('0x87')](_0x25d86f[_0xfd04('0x60')],{'$or':_[_0xfd04('0x75')](_0x25d86f[_0xfd04('0x82')],function(_0x2e4867){var _0x3ce440={};_0x3ce440[_0x2e4867]={'$like':'%'+_0x46327c[_0xfd04('0x23')][_0xfd04('0x86')]+'%'};return _0x3ce440;})});}_0x25d86f=_['merge']({},_0x25d86f,_0x46327c[_0xfd04('0x88')]);return _0x3eb4b5[_0xfd04('0x7e')](_0x25d86f);}})[_0xfd04('0x18')](function(_0x554d4f){if(_0x554d4f){_0x2fdebd=_0x554d4f['length'];if(!_0x46327c['query']['hasOwnProperty']('nolimit')){_0x25d86f['limit']=qs['limit'](_0x46327c[_0xfd04('0x23')][_0xfd04('0x14')]);_0x25d86f['offset']=qs[_0xfd04('0x11')](_0x46327c[_0xfd04('0x23')]['offset']);}return _0x3eb4b5[_0xfd04('0x7e')](_0x25d86f);}})[_0xfd04('0x18')](function(_0x2773be){if(_0x2773be){return _0x2773be?{'count':_0x2fdebd,'rows':_0x2773be}:null;}})['then'](respondWithResult(_0x27befa,null))[_0xfd04('0x35')](handleError(_0x27befa,null));};exports[_0xfd04('0x89')]=function(_0x5d851a,_0x9e232a){if(_0x5d851a[_0xfd04('0x36')]['id']){delete _0x5d851a['body']['id'];}return db[_0xfd04('0x25')]['findOne']({'where':{'id':_0x5d851a[_0xfd04('0x27')]['id']}})[_0xfd04('0x18')](handleEntityNotFound(_0x9e232a,null))[_0xfd04('0x18')](function(_0x5869eb){if(_0x5869eb){return _0x5869eb[_0xfd04('0x89')](_0x5d851a[_0xfd04('0x36')][_0xfd04('0x8a')]||[]);}return null;})[_0xfd04('0x18')](respondWithResult(_0x9e232a,null))[_0xfd04('0x35')](handleError(_0x9e232a,null));};exports[_0xfd04('0x8b')]=function(_0x1cd363,_0x510a53){var _0x7b95dd=[];_0x7b95dd[_0xfd04('0x62')](addAdditionalPhones(_0x1cd363['body']));Promise[_0xfd04('0x8c')](_0x7b95dd)[_0xfd04('0x18')](function(){_0x7b95dd=[];_0x7b95dd[_0xfd04('0x62')](deleteCmHopperPhones(_0x1cd363[_0xfd04('0x36')]['id']));_0x7b95dd['push'](addCmHopperPhones(_0x1cd363['body']['id']));Promise['all'](_0x7b95dd)[_0xfd04('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x510a53,null));});};function addAdditionalPhones(_0x48cbc6){var _0x1789f1;return new Promise(function(_0x1883b8){return db[_0xfd04('0x4b')][_0xfd04('0x19')]({'where':{'CmContactId':_0x48cbc6['id']}})[_0xfd04('0x18')](function(){db[_0xfd04('0x6b')][_0xfd04('0x6f')]({'raw':!![],'attributes':['id','OrderBy']})[_0xfd04('0x18')](function(_0x5647b2){var _0x590244=[];for(var _0x65f60a=0x0;_0x65f60a<_0x48cbc6[_0xfd04('0x8d')][_0xfd04('0x28')];_0x65f60a++){var _0x1e400f=_0x48cbc6[_0xfd04('0x8e')]?_[_0xfd04('0x58')](_0x48cbc6[_0xfd04('0x8e')][_0x65f60a])?'':_0x48cbc6[_0xfd04('0x8e')][_0x65f60a]:_0x48cbc6['items'][_0x65f60a][_0xfd04('0x8f')]?_0x48cbc6[_0xfd04('0x8d')][_0x65f60a]['ItemTypeId']:'';var _0x18fadb=_[_0xfd04('0x58')](_0x48cbc6[_0xfd04('0x8d')][_0x65f60a][_0xfd04('0x90')])?'':_0x48cbc6[_0xfd04('0x8d')][_0x65f60a][_0xfd04('0x90')];var _0x18a5e0=_0x1e400f+':'+_0x48cbc6[_0xfd04('0x8d')][_0x65f60a][_0xfd04('0x7d')]+'§'+_0x18fadb;if(_[_0xfd04('0x58')](_0x1789f1))_0x1789f1=_0x18a5e0;else _0x1789f1+=';'+_0x18a5e0;var _0x2cdaf1=null;var _0x10fd55=null;if(_0x48cbc6[_0xfd04('0x8e')]){if(!_[_0xfd04('0x58')](_0x48cbc6[_0xfd04('0x8e')][_0x65f60a])){_0x10fd55=_[_0xfd04('0x26')](_0x5647b2,function(_0x3b3585){return _0x3b3585['id']===_0x48cbc6['item_types'][_0x65f60a];});if(!_[_0xfd04('0x58')](_0x10fd55)){_0x2cdaf1=_0x10fd55[_0xfd04('0x91')];}}}else{if(!_['isNil'](_0x48cbc6[_0xfd04('0x8d')][_0x65f60a])){_0x10fd55=_['find'](_0x5647b2,function(_0x3d276c){return _0x3d276c['id']===_0x48cbc6[_0xfd04('0x8d')][_0x65f60a][_0xfd04('0x8f')];});if(!_[_0xfd04('0x58')](_0x10fd55)){_0x2cdaf1=_0x65f60a;}}}if(_[_0xfd04('0x58')](_0x2cdaf1)){_0x2cdaf1=0x64;}_0x590244['push'](addAdditionalPhone(_0x48cbc6['id'],_0x48cbc6[_0xfd04('0x8d')][_0x65f60a][_0xfd04('0x7d')],_0x48cbc6['item_types']?_[_0xfd04('0x58')](_0x48cbc6['item_types'][_0x65f60a])?null:_0x48cbc6['item_types'][_0x65f60a]:_0x48cbc6[_0xfd04('0x8d')][_0x65f60a][_0xfd04('0x8f')]?_0x48cbc6[_0xfd04('0x8d')][_0x65f60a]['ItemTypeId']:null,_0x2cdaf1,_0x18fadb));}Promise[_0xfd04('0x8c')](_0x590244)[_0xfd04('0x18')](function(){db[_0xfd04('0x25')][_0xfd04('0x17')]({'AdditionalPhones':_0x1789f1},{'where':{'id':_0x48cbc6['id']}})[_0xfd04('0x18')](function(){_0x1883b8(0x1);});});});});});}function addAdditionalPhone(_0x2d9675,_0x471302,_0x5a67c6,_0x3bfff7,_0x244aa4){return db['CmContactHasItem'][_0xfd04('0x26')]({'where':{'CmContactId':_0x2d9675,'item':_0x471302}})['then'](function(_0x288ff7){if(_0x288ff7)logger[_0xfd04('0x31')](_0xfd04('0x92'),_0x288ff7);else{db[_0xfd04('0x4b')]['create']({'CmContactId':_0x2d9675,'item':_0x471302,'ItemTypeId':_0x5a67c6,'OrderBy':_0x3bfff7,'ItemClass':_0xfd04('0x93'),'description':_0x244aa4});}});}function deleteCmHopperPhones(_0x1da79b){return new Promise(function(_0x531bb8){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1da79b}})['then'](function(_0x391a2b){db[_0xfd04('0x94')][_0xfd04('0x19')]({'where':{'CmHopperId':{'$in':_[_0xfd04('0x75')](_0x391a2b,'id')}}});})[_0xfd04('0x18')](function(){_0x531bb8(0x1);});});}function addCmHopperPhones(_0x53174a){return new Promise(function(_0x152982){return db['CmHopper'][_0xfd04('0x6f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x53174a}})[_0xfd04('0x18')](function(_0x5f5d42){var _0x579515=[];_[_0xfd04('0x75')](_0x5f5d42,function(_0x2cbe1a){_0x579515['push'](createCmHopperPhone(_0x53174a,_0x2cbe1a['id']));});Promise[_0xfd04('0x8c')](_0x579515)[_0xfd04('0x18')](function(){_0x152982(0x1);});});});}function createCmHopperPhone(_0x5e6aa4,_0x5cbcbb){return new Promise(function(_0x22efb3){db[_0xfd04('0x4b')][_0xfd04('0x6f')]({'raw':!![],'attributes':[_0xfd04('0x95'),_0xfd04('0x91')],'where':{'CmContactId':_0x5e6aa4,'ItemClass':_0xfd04('0x93')},'include':[{'model':db[_0xfd04('0x6b')],'attributes':['OrderBy'],'as':_0xfd04('0x6c')}],'order':[_0xfd04('0x91'),db[_0xfd04('0x7a')][_0xfd04('0x96')](_0xfd04('0x97'))]})['then'](function(_0x1167d1){var _0x125df5=0x1;var _0x365b6f=_[_0xfd04('0x75')](_0x1167d1,function(_0x443808){_0x443808[_0xfd04('0x98')]=_0x5cbcbb;_0x443808[_0xfd04('0x7d')]=_0x443808[_0xfd04('0x95')];_0x443808['OrderBy']=_0x125df5;delete _0x443808['ItemType.OrderBy'];_0x125df5=_0x125df5+0x1;return _0x443808;});return db[_0xfd04('0x94')][_0xfd04('0x5d')](_0x365b6f,{});})[_0xfd04('0x18')](function(){_0x22efb3(0x1);});});}function insertAdditionalPhones(_0x32eec4,_0x25b8da){return new Promise(function(_0x296b6f){var _0x295021=[];for(var _0x32af56=0x0;_0x32af56<_0x25b8da['length'];_0x32af56++){var _0x4ad786=_0x25b8da[_0x32af56];_0x295021[_0xfd04('0x62')](parseContactItemType(_0x4ad786));}Promise[_0xfd04('0x8c')](_0x295021)['then'](function(){var _0x29e89f={'id':_0x32eec4['id'],'items':_0x25b8da};return addAdditionalPhones(_0x29e89f)[_0xfd04('0x18')](function(){return addCmHopperPhones(_0x32eec4['id']);});})[_0xfd04('0x18')](function(){_0x296b6f(_0x32eec4);});});}function parseContactItemType(_0x5ee00c){return new Promise(function(_0x1bf823){if(_0x5ee00c[_0xfd04('0x34')](_0xfd04('0x8f'))){_0x1bf823(_0x5ee00c);}else{return db[_0xfd04('0x6b')][_0xfd04('0x26')]({'where':{'name':_0x5ee00c[_0xfd04('0x6c')]}})[_0xfd04('0x18')](function(_0x13bfc1){if(_[_0xfd04('0x58')](_0x13bfc1))_0x5ee00c[_0xfd04('0x8f')]=null;else _0x5ee00c['ItemTypeId']=_0x13bfc1['id'];_0x1bf823(_0x5ee00c);});}});}exports[_0xfd04('0x99')]=function(_0x573300,_0x2556fe){return db[_0xfd04('0x4b')]['findAll']({'raw':!![],'where':{'CmContactId':_0x573300['params']['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xfd04('0x6b')],'as':_0xfd04('0x6c')}],'order':[[_0xfd04('0x91')],[db[_0xfd04('0x7a')]['literal'](_0xfd04('0x97'))]]})[_0xfd04('0x18')](function(_0x2e1645){return _0x2e1645;})[_0xfd04('0x18')](respondWithResult(_0x2556fe,null))[_0xfd04('0x35')](handleError(_0x2556fe,null));};exports['duplicateAdditionalPhones']=function(_0x49d06c,_0x57f99c){return db[_0xfd04('0x4b')][_0xfd04('0x6f')]({'raw':!![],'where':{'CmContactId':_0x49d06c[_0xfd04('0x36')][_0xfd04('0x9a')]}})['then'](function(_0x26b525){var _0x23da5e=_[_0xfd04('0x75')](_0x26b525,function(_0x5d0b55){_0x5d0b55[_0xfd04('0x9b')]=_0x49d06c[_0xfd04('0x36')][_0xfd04('0x9c')];return _0x5d0b55;});return db['CmContactHasItem'][_0xfd04('0x5d')](_0x23da5e,{});})[_0xfd04('0x18')](function(){return addCmHopperPhones(_0x49d06c['body'][_0xfd04('0x9c')]);})[_0xfd04('0x18')](function(){return['ok'];})[_0xfd04('0x18')](respondWithResult(_0x57f99c,null))[_0xfd04('0x35')](handleError(_0x57f99c,null));};exports[_0xfd04('0x9d')]=function(_0x5e0443,_0xa40b84){var _0x2c2ab0=[];_0x2c2ab0['push'](createCmHopperPhone(_0x5e0443[_0xfd04('0x36')]['id'],_0x5e0443[_0xfd04('0x36')]['hopperId']));Promise[_0xfd04('0x8c')](_0x2c2ab0)[_0xfd04('0x18')](function(){return[0x1];})[_0xfd04('0x18')](respondWithResult(_0xa40b84,null));};exports[_0xfd04('0x9e')]=function(_0x34e03e,_0x39fa76){var _0x355735={'raw':![],'where':{}};var _0x5cebd1={};var _0x4805e2={'count':0x0,'rows':[]};return db[_0xfd04('0x25')][_0xfd04('0x9f')]({'where':{'id':_0x34e03e['params']['id']}})[_0xfd04('0x18')](handleEntityNotFound(_0x39fa76,null))[_0xfd04('0x18')](function(_0x41bd99){if(_0x41bd99){_0x5cebd1[_0xfd04('0x7f')]=_[_0xfd04('0x29')](db[_0xfd04('0x3e')][_0xfd04('0xa0')]);_0x5cebd1['query']=_['keys'](_0x34e03e[_0xfd04('0x23')]);_0x5cebd1[_0xfd04('0x80')]=_[_0xfd04('0x81')](_0x5cebd1['model'],_0x5cebd1[_0xfd04('0x23')]);_0x355735[_0xfd04('0x82')]=_[_0xfd04('0x81')](_0x5cebd1['model'],qs[_0xfd04('0x83')](_0x34e03e[_0xfd04('0x23')][_0xfd04('0x83')]));_0x355735[_0xfd04('0x82')]=_0x355735[_0xfd04('0x82')][_0xfd04('0x28')]?_0x355735['attributes']:_0x5cebd1['model'];if(!_0x34e03e[_0xfd04('0x23')]['hasOwnProperty']('nolimit')){_0x355735[_0xfd04('0x14')]=qs[_0xfd04('0x14')](_0x34e03e[_0xfd04('0x23')]['limit']);_0x355735[_0xfd04('0x11')]=qs[_0xfd04('0x11')](_0x34e03e[_0xfd04('0x23')][_0xfd04('0x11')]);}_0x355735[_0xfd04('0xa1')]=qs[_0xfd04('0x84')](_0x34e03e['query']['sort']);_0x355735[_0xfd04('0x60')]=qs['filters'](_['pick'](_0x34e03e[_0xfd04('0x23')],_0x5cebd1[_0xfd04('0x80')]));_0x355735[_0xfd04('0x60')][_0xfd04('0xa2')]=_0x41bd99['id'];if(_0x34e03e[_0xfd04('0x23')]['filter']){_0x355735[_0xfd04('0x60')]=_['merge'](_0x355735[_0xfd04('0x60')],{'$or':_[_0xfd04('0x75')](_0x355735[_0xfd04('0x82')],function(_0x234415){var _0x1d010b={};_0x1d010b[_0x234415]={'$like':'%'+_0x34e03e['query']['filter']+'%'};return _0x1d010b;})});}_0x355735=_['merge']({},_0x355735,_0x34e03e[_0xfd04('0x88')]);return db[_0xfd04('0x3e')][_0xfd04('0x13')]({'where':_0x355735[_0xfd04('0x60')]})[_0xfd04('0x18')](function(_0x1f599f){_0x4805e2[_0xfd04('0x13')]=_0x1f599f;if(_0x34e03e['query'][_0xfd04('0xa3')]){_0x355735[_0xfd04('0xa4')]=[{'all':!![]}];}return db[_0xfd04('0x3e')][_0xfd04('0x6f')](_0x355735);})[_0xfd04('0x18')](function(_0x209318){_0x4805e2[_0xfd04('0xa5')]=_0x209318;return _0x4805e2;});}})[_0xfd04('0x18')](respondWithFilteredResult(_0x39fa76,_0x355735))[_0xfd04('0x35')](handleError(_0x39fa76,null));};exports[_0xfd04('0xa6')]=function(_0x82ae2,_0x82075b){var _0xba85b4={'raw':!![],'where':{}};var _0x58e0ca={};var _0x1441bf={'count':0x0,'rows':[]};return db[_0xfd04('0x25')]['findOne']({'where':{'id':_0x82ae2[_0xfd04('0x27')]['id']}})[_0xfd04('0x18')](handleEntityNotFound(_0x82075b,null))[_0xfd04('0x18')](function(_0x2ec601){if(_0x2ec601){_0x58e0ca['model']=_[_0xfd04('0x29')](db[_0xfd04('0xa7')][_0xfd04('0xa0')]);_0x58e0ca['query']=_[_0xfd04('0x29')](_0x82ae2[_0xfd04('0x23')]);_0x58e0ca[_0xfd04('0x80')]=_[_0xfd04('0x81')](_0x58e0ca[_0xfd04('0x7f')],_0x58e0ca[_0xfd04('0x23')]);_0xba85b4[_0xfd04('0x82')]=_[_0xfd04('0x81')](_0x58e0ca[_0xfd04('0x7f')],qs['fields'](_0x82ae2['query'][_0xfd04('0x83')]));_0xba85b4[_0xfd04('0x82')]=_0xba85b4[_0xfd04('0x82')][_0xfd04('0x28')]?_0xba85b4[_0xfd04('0x82')]:_0x58e0ca[_0xfd04('0x7f')];if(!_0x82ae2[_0xfd04('0x23')][_0xfd04('0x34')](_0xfd04('0xa8'))){_0xba85b4[_0xfd04('0x14')]=qs[_0xfd04('0x14')](_0x82ae2[_0xfd04('0x23')][_0xfd04('0x14')]);_0xba85b4['offset']=qs[_0xfd04('0x11')](_0x82ae2[_0xfd04('0x23')][_0xfd04('0x11')]);}_0xba85b4[_0xfd04('0xa1')]=qs[_0xfd04('0x84')](_0x82ae2[_0xfd04('0x23')][_0xfd04('0x84')]);_0xba85b4['where']=qs[_0xfd04('0x80')](_[_0xfd04('0x85')](_0x82ae2[_0xfd04('0x23')],_0x58e0ca[_0xfd04('0x80')]));_0xba85b4['where'][_0xfd04('0xa2')]=_0x2ec601['id'];if(_0x82ae2['query'][_0xfd04('0x86')]){_0xba85b4[_0xfd04('0x60')]=_[_0xfd04('0x87')](_0xba85b4['where'],{'$or':_[_0xfd04('0x75')](_0xba85b4[_0xfd04('0x82')],function(_0x9be28a){var _0x2d3dac={};_0x2d3dac[_0x9be28a]={'$like':'%'+_0x82ae2[_0xfd04('0x23')][_0xfd04('0x86')]+'%'};return _0x2d3dac;})});}_0xba85b4=_[_0xfd04('0x87')]({},_0xba85b4,_0x82ae2[_0xfd04('0x88')]);return db[_0xfd04('0xa7')]['count']({'where':_0xba85b4[_0xfd04('0x60')]})[_0xfd04('0x18')](function(_0x5e44e3){_0x1441bf[_0xfd04('0x13')]=_0x5e44e3;if(_0x82ae2[_0xfd04('0x23')][_0xfd04('0xa3')]){_0xba85b4[_0xfd04('0xa4')]=[{'all':!![]}];}return db[_0xfd04('0xa7')][_0xfd04('0x6f')](_0xba85b4);})[_0xfd04('0x18')](function(_0x22b663){_0x1441bf[_0xfd04('0xa5')]=_0x22b663;return _0x1441bf;});}})[_0xfd04('0x18')](respondWithFilteredResult(_0x82075b,_0xba85b4))[_0xfd04('0x35')](handleError(_0x82075b,null));};exports[_0xfd04('0xa9')]=function(_0x39b49f,_0xf92116){var _0x845526={'raw':!![],'where':{}};var _0x69a3d0={};var _0x2cf716={'count':0x0,'rows':[]};return db[_0xfd04('0x25')][_0xfd04('0x9f')]({'where':{'id':_0x39b49f['params']['id']}})[_0xfd04('0x18')](handleEntityNotFound(_0xf92116,null))['then'](function(_0x41e942){if(_0x41e942){_0x69a3d0[_0xfd04('0x7f')]=_[_0xfd04('0x29')](db['CmHopperFinal']['rawAttributes']);_0x69a3d0[_0xfd04('0x23')]=_[_0xfd04('0x29')](_0x39b49f[_0xfd04('0x23')]);_0x69a3d0[_0xfd04('0x80')]=_[_0xfd04('0x81')](_0x69a3d0[_0xfd04('0x7f')],_0x69a3d0[_0xfd04('0x23')]);_0x845526[_0xfd04('0x82')]=_[_0xfd04('0x81')](_0x69a3d0[_0xfd04('0x7f')],qs[_0xfd04('0x83')](_0x39b49f[_0xfd04('0x23')][_0xfd04('0x83')]));_0x845526[_0xfd04('0x82')]=_0x845526['attributes'][_0xfd04('0x28')]?_0x845526[_0xfd04('0x82')]:_0x69a3d0[_0xfd04('0x7f')];if(!_0x39b49f['query'][_0xfd04('0x34')](_0xfd04('0xa8'))){_0x845526[_0xfd04('0x14')]=qs['limit'](_0x39b49f['query'][_0xfd04('0x14')]);_0x845526[_0xfd04('0x11')]=qs[_0xfd04('0x11')](_0x39b49f['query'][_0xfd04('0x11')]);}_0x845526['order']=qs[_0xfd04('0x84')](_0x39b49f['query'][_0xfd04('0x84')]);_0x845526[_0xfd04('0x60')]=qs[_0xfd04('0x80')](_[_0xfd04('0x85')](_0x39b49f[_0xfd04('0x23')],_0x69a3d0[_0xfd04('0x80')]));_0x845526[_0xfd04('0x60')][_0xfd04('0xa2')]=_0x41e942['id'];if(_0x39b49f[_0xfd04('0x23')][_0xfd04('0x86')]){_0x845526[_0xfd04('0x60')]=_[_0xfd04('0x87')](_0x845526['where'],{'$or':_[_0xfd04('0x75')](_0x845526[_0xfd04('0x82')],function(_0x267ccc){var _0x27d0a5={};_0x27d0a5[_0x267ccc]={'$like':'%'+_0x39b49f['query'][_0xfd04('0x86')]+'%'};return _0x27d0a5;})});}_0x845526=_['merge']({},_0x845526,_0x39b49f[_0xfd04('0x88')]);return db[_0xfd04('0x4c')][_0xfd04('0x13')]({'where':_0x845526[_0xfd04('0x60')]})[_0xfd04('0x18')](function(_0x599875){_0x2cf716[_0xfd04('0x13')]=_0x599875;if(_0x39b49f[_0xfd04('0x23')][_0xfd04('0xa3')]){_0x845526[_0xfd04('0xa4')]=[{'all':!![]}];}return db[_0xfd04('0x4c')]['findAll'](_0x845526);})['then'](function(_0x4077b2){_0x2cf716['rows']=_0x4077b2;return _0x2cf716;});}})['then'](respondWithFilteredResult(_0xf92116,_0x845526))[_0xfd04('0x35')](handleError(_0xf92116,null));};exports[_0xfd04('0xaa')]=function(_0x406aa1,_0x3e1a69){var _0x5e22db={'raw':!![],'where':{}};var _0x17c712={};var _0x459627={'count':0x0,'rows':[]};return db['CmContact'][_0xfd04('0x9f')]({'where':{'id':_0x406aa1[_0xfd04('0x27')]['id']}})[_0xfd04('0x18')](handleEntityNotFound(_0x3e1a69,null))[_0xfd04('0x18')](function(_0xf6633f){if(_0xf6633f){_0x17c712[_0xfd04('0x7f')]=_[_0xfd04('0x29')](db[_0xfd04('0x53')]['rawAttributes']);_0x17c712['query']=_['keys'](_0x406aa1['query']);_0x17c712[_0xfd04('0x80')]=_[_0xfd04('0x81')](_0x17c712['model'],_0x17c712[_0xfd04('0x23')]);_0x5e22db['attributes']=_[_0xfd04('0x81')](_0x17c712[_0xfd04('0x7f')],qs[_0xfd04('0x83')](_0x406aa1[_0xfd04('0x23')][_0xfd04('0x83')]));_0x5e22db['attributes']=_0x5e22db[_0xfd04('0x82')][_0xfd04('0x28')]?_0x5e22db['attributes']:_0x17c712[_0xfd04('0x7f')];if(!_0x406aa1[_0xfd04('0x23')][_0xfd04('0x34')](_0xfd04('0xa8'))){_0x5e22db['limit']=qs[_0xfd04('0x14')](_0x406aa1[_0xfd04('0x23')][_0xfd04('0x14')]);_0x5e22db[_0xfd04('0x11')]=qs[_0xfd04('0x11')](_0x406aa1[_0xfd04('0x23')][_0xfd04('0x11')]);}_0x5e22db['order']=qs[_0xfd04('0x84')](_0x406aa1['query']['sort']);_0x5e22db[_0xfd04('0x60')]=qs['filters'](_[_0xfd04('0x85')](_0x406aa1[_0xfd04('0x23')],_0x17c712[_0xfd04('0x80')]));_0x5e22db[_0xfd04('0x60')][_0xfd04('0xa2')]=_0xf6633f['id'];if(_0x406aa1[_0xfd04('0x23')][_0xfd04('0x86')]){_0x5e22db['where']=_['merge'](_0x5e22db[_0xfd04('0x60')],{'$or':_[_0xfd04('0x75')](_0x5e22db[_0xfd04('0x82')],function(_0x46acaa){var _0x69653={};_0x69653[_0x46acaa]={'$like':'%'+_0x406aa1['query'][_0xfd04('0x86')]+'%'};return _0x69653;})});}_0x5e22db=_[_0xfd04('0x87')]({},_0x5e22db,_0x406aa1['options']);return db[_0xfd04('0x53')][_0xfd04('0x13')]({'where':_0x5e22db[_0xfd04('0x60')]})[_0xfd04('0x18')](function(_0x1a037c){_0x459627[_0xfd04('0x13')]=_0x1a037c;if(_0x406aa1[_0xfd04('0x23')][_0xfd04('0xa3')]){_0x5e22db[_0xfd04('0xa4')]=[{'all':!![]}];}return db[_0xfd04('0x53')][_0xfd04('0x6f')](_0x5e22db);})['then'](function(_0x5d6b5b){_0x459627[_0xfd04('0xa5')]=_0x5d6b5b;return _0x459627;});}})[_0xfd04('0x18')](respondWithFilteredResult(_0x3e1a69,_0x5e22db))[_0xfd04('0x35')](handleError(_0x3e1a69,null));};exports[_0xfd04('0xab')]=function(_0x1f20df,_0x2d5ae4){try{if(!_0x1f20df['body'][_0xfd04('0x63')]){throw new Error(_0xfd04('0xac'));}if(!_0x1f20df[_0xfd04('0x36')][_0xfd04('0xad')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x1f20df[_0xfd04('0x36')][_0xfd04('0xae')]){throw new Error(_0xfd04('0xaf'));}if(!_0x1f20df[_0xfd04('0x36')][_0xfd04('0xb0')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x43e68=_0x1f20df['body'][_0xfd04('0xad')][_0xfd04('0xb1')](',');var _0x1759d5=_0x1f20df[_0xfd04('0x36')][_0xfd04('0xae')][_0xfd04('0xb1')](',');if(!_0x43e68[_0xfd04('0x28')]||!_0x1759d5[_0xfd04('0x28')]||_0x43e68[_0xfd04('0x28')]!==_0x1759d5[_0xfd04('0x28')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x1f20df[_0xfd04('0x36')][_0xfd04('0x83')]=_[_0xfd04('0xb2')](_0x43e68,_0x1759d5);if(!_0x1f20df[_0xfd04('0x36')]['fields'][_0xfd04('0x7d')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1f20df[_0xfd04('0x36')][_0xfd04('0x83')][_0xfd04('0xb3')]){throw new Error(_0xfd04('0xb4'));}var _0x388746=path[_0xfd04('0x3b')](config[_0xfd04('0xb5')],_0xfd04('0xb6'),_0x1f20df[_0xfd04('0xb7')][_0xfd04('0xb8')]);fs[_0xfd04('0xb9')](_0x388746,parseInt('0777',0x8));var _0x404c4a=require(_0xfd04('0xba'))[_0xfd04('0xbb')](path['join'](__dirname,_0xfd04('0xbc')),[_0x388746,_0x1f20df['body'][_0xfd04('0xad')],_0x1f20df['body'][_0xfd04('0xae')],_0x1f20df[_0xfd04('0x36')][_0xfd04('0x63')],_0x1f20df[_0xfd04('0x36')][_0xfd04('0xbd')],_0x1f20df[_0xfd04('0x36')]['duplicates'],_0x1f20df[_0xfd04('0x36')]['socket_timestamp']]);return _0x2d5ae4[_0xfd04('0x15')](0xc8)[_0xfd04('0x10')]({'message':'File\x20uploaded\x20correctly!','pid':_0x404c4a['pid']});}catch(_0x2c5c42){return _0x2d5ae4[_0xfd04('0x15')](0x1f4)[_0xfd04('0x1f')](_0x2c5c42);}};exports[_0xfd04('0xbe')]=function(_0x478ebf,_0x4b42ea){var _0x1c2852=fs[_0xfd04('0xbf')](_0x478ebf[_0xfd04('0xb7')][_0xfd04('0x2')]);Papa[_0xfd04('0xc0')](_0x1c2852,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3597b0){return _0x4b42ea[_0xfd04('0x15')](0xc8)['json']({'file':_0x478ebf[_0xfd04('0xb7')],'fields':_0x3597b0[_0xfd04('0xc1')][_0xfd04('0x83')]});}});};exports[_0xfd04('0xc2')]=function(_0x24ccb0,_0x5dac54){return db[_0xfd04('0xc3')][_0xfd04('0x6f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xfd04('0xc4')}})['then'](function(_0x4faeb9){var _0x4812b2=![];if(!_0x24ccb0[_0xfd04('0x36')][_0xfd04('0x63')]){throw new Error('No\x20ListId\x20specified');}if(!_0x24ccb0['body'][_0xfd04('0xc5')][_0xfd04('0x7d')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x24ccb0[_0xfd04('0x36')][_0xfd04('0xc5')][_0xfd04('0xb3')]){throw new Error(_0xfd04('0xb4'));}if(!_0x24ccb0[_0xfd04('0x36')]['socket_timestamp']){throw new Error(_0xfd04('0xc6'));}var _0x3d9239=require('child_process')[_0xfd04('0xbb')](path[_0xfd04('0x3b')](__dirname,_0xfd04('0xc7')),[_0x24ccb0[_0xfd04('0x27')]['id'],JSON[_0xfd04('0xc8')](_0x24ccb0['body']),JSON[_0xfd04('0xc8')](_0x4faeb9)]);_0x3d9239['on'](_0xfd04('0xc9'),function(){_0x4812b2=!![];return _0x5dac54[_0xfd04('0x15')](0xc8)[_0xfd04('0x10')]({'message':_0xfd04('0xca'),'pid':_0x3d9239['pid']});});_0x3d9239['on'](_0xfd04('0xcb'),function(_0x34b560){if(_0x34b560&&!_0x4812b2){return _0x5dac54[_0xfd04('0x15')](0x1f4)[_0xfd04('0x10')]({'message':_0xfd04('0xcc'),'pid':_0x3d9239[_0xfd04('0xcd')]});}});})['catch'](handleError(_0x5dac54,null));};exports[_0xfd04('0xce')]=function(_0x27cb2f,_0x2099df){return db[_0xfd04('0xc3')][_0xfd04('0x6f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xfd04('0xc4')}})[_0xfd04('0x18')](function(_0xeaf950){var _0x17dec8=![];if(!_0x27cb2f[_0xfd04('0x36')][_0xfd04('0x63')]){throw new Error(_0xfd04('0xac'));}if(!_0x27cb2f[_0xfd04('0x36')][_0xfd04('0xc5')][_0xfd04('0x7d')]){throw new Error(_0xfd04('0xcf'));}if(!_0x27cb2f[_0xfd04('0x36')][_0xfd04('0xc5')][_0xfd04('0xb3')]){throw new Error(_0xfd04('0xb4'));}if(!_0x27cb2f['body'][_0xfd04('0xb0')]){throw new Error(_0xfd04('0xc6'));}var _0x3799e6=require(_0xfd04('0xba'))['fork'](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x27cb2f[_0xfd04('0x27')]['id'],JSON[_0xfd04('0xc8')](_0x27cb2f[_0xfd04('0x36')]),JSON[_0xfd04('0xc8')](_0xeaf950)]);_0x3799e6['on'](_0xfd04('0xc9'),function(){_0x17dec8=!![];return _0x2099df[_0xfd04('0x15')](0xc8)['json']({'message':_0xfd04('0xca'),'pid':_0x3799e6[_0xfd04('0xcd')]});});_0x3799e6['on'](_0xfd04('0xcb'),function(_0x4de225){if(_0x4de225&&!_0x17dec8){return _0x2099df[_0xfd04('0x15')](0x1f4)[_0xfd04('0x10')]({'message':_0xfd04('0xcc'),'pid':_0x3799e6[_0xfd04('0xcd')]});}});})[_0xfd04('0x35')](handleError(_0x2099df,null));};exports['getJourney']=function(_0x1f1071,_0x27889a){var _0x5957d7=[_0xfd04('0xd0'),_0xfd04('0xd1'),'sms',_0xfd04('0xd2'),_0xfd04('0xd3'),_0xfd04('0xd4'),_0xfd04('0xd5')];var _0x4cf89e={'offset':0x0,'order':qs[_0xfd04('0x84')](_0xfd04('0xd6'))},_0x202a52={'count':0x0,'rows':[]};Promise[_0xfd04('0xd7')]()[_0xfd04('0x18')](function(){if(_0x1f1071[_0xfd04('0x23')][_0xfd04('0xd8')]){if(!_[_0xfd04('0xd9')](_0x5957d7,_0x1f1071[_0xfd04('0x23')][_0xfd04('0xd8')][_0xfd04('0xda')]())){throw new Error(_0xfd04('0xdb'));}_0x5957d7=[_0x1f1071[_0xfd04('0x23')][_0xfd04('0xd8')][_0xfd04('0xda')]()];}if(_0x1f1071[_0xfd04('0x23')][_0xfd04('0xdc')]){try{var _0x1d739a=JSON['parse'](_0x1f1071['query'][_0xfd04('0xdc')]);if(!moment(_0x1d739a['from'])[_0xfd04('0xdd')]()){throw new Error(_0xfd04('0xde'));}if(!moment(_0x1d739a['to'])[_0xfd04('0xdd')]()){throw new Error(_0xfd04('0xdf'));}}catch(_0x9a9b7b){throw new Error(_0xfd04('0xe0'));}}if(!_0x1f1071[_0xfd04('0x23')][_0xfd04('0x34')](_0xfd04('0xa8'))){_0x4cf89e[_0xfd04('0x14')]=qs['limit'](_0x1f1071['query']['limit']||0xa);_0x4cf89e[_0xfd04('0x11')]=qs[_0xfd04('0x11')](_0x1f1071[_0xfd04('0x23')]['offset']);}var _0x213c04=_0x5957d7[_0xfd04('0x75')](function(_0x5a1421){if(_0x5a1421===_0xfd04('0xd5')){var _0x485fde={'attributes':['id',_0xfd04('0xe1'),_0xfd04('0xe2'),_0xfd04('0xe3'),_0xfd04('0xe4'),'callerid',_0xfd04('0xe5'),_0xfd04('0xe6'),_0xfd04('0xe7'),_0xfd04('0xe8'),_0xfd04('0xe9'),_0xfd04('0xea'),_0xfd04('0xeb'),'userThirdDisposition',_0xfd04('0xec')],'where':{'ContactId':_0x1f1071[_0xfd04('0x27')]['id']},'include':[{'model':db[_0xfd04('0xc3')],'as':_0xfd04('0xc3'),'attributes':['id',_0xfd04('0x1e'),_0xfd04('0xed'),_0xfd04('0x2f')]}],'order':[[_0xfd04('0xe9'),_0xfd04('0xee')]]};if(_0x1f1071[_0xfd04('0x23')][_0xfd04('0xdc')]){_0x485fde[_0xfd04('0x60')][_0xfd04('0xe9')]={'$gte':_0x1d739a[_0xfd04('0x3d')],'$lte':_0x1d739a['to']};}return db['VoiceCallReport'][_0xfd04('0xef')](_0x485fde)['then'](function(_0x304807){_0x202a52[_0xfd04('0x13')]+=_0x304807[_0xfd04('0x13')];return _[_0xfd04('0x75')](_0x304807['rows'],function(_0x41cb1a){var _0x3ce570=_0x41cb1a['get']({'plain':!![]});_0x3ce570['channel']=_0x5a1421;if(_0x3ce570['User']){_0x3ce570[_0xfd04('0xc3')]={'id':_0x3ce570[_0xfd04('0xc3')]['id'],'name':_0x3ce570[_0xfd04('0xc3')][_0xfd04('0x1e')],'fullname':_0x3ce570[_0xfd04('0xc3')][_0xfd04('0xed')],'alias':_0x3ce570['User'][_0xfd04('0x2f')]};}return _0x3ce570;});});}else{var _0x1730ee=_[_0xfd04('0xf0')](_0x5a1421)+(_0x5a1421===_0xfd04('0xd1')?'Website':_0xfd04('0xf1'));var _0x1d149b={'attributes':['id',_0xfd04('0xf2'),'closedAt','createdAt',_0xfd04('0xe8'),_0xfd04('0xf3'),'secondDisposition',_0xfd04('0xf4'),_0xfd04('0xec'),_0x1730ee+'Id'],'where':{'ContactId':_0x1f1071['params']['id']},'include':[{'model':db[_0x1730ee],'as':_0xfd04('0xf1'),'attributes':['id',_0xfd04('0x1e'),_0xfd04('0xf5')]},{'model':db[_0xfd04('0xc3')],'as':_0xfd04('0xf6'),'attributes':['id',_0xfd04('0x1e'),_0xfd04('0xed')]},{'model':db['Tag'],'as':_0xfd04('0x68'),'attributes':['id',_0xfd04('0x1e'),'color'],'through':{'attributes':[]}}],'order':[[_0xfd04('0xe9'),_0xfd04('0xee')]]};if(_0x1f1071[_0xfd04('0x23')][_0xfd04('0xdc')]){_0x1d149b[_0xfd04('0x60')][_0xfd04('0xe9')]={'$gte':_0x1d739a[_0xfd04('0x3d')],'$lte':_0x1d739a['to']};}switch(_0x5a1421){case _0xfd04('0xd1'):_0x1d149b[_0xfd04('0x82')]['push']('browserName','customerIp',_0xfd04('0xf7'),_0xfd04('0xf8'),_0xfd04('0xf9'),_0xfd04('0xfa'),_0xfd04('0xfb'),_0xfd04('0xfc'),'referer');break;case _0xfd04('0xd0'):_0x1d149b['attributes'][_0xfd04('0x62')](_0xfd04('0xfd'),_0xfd04('0xfe'));break;case _0xfd04('0xd2'):_0x1d149b[_0xfd04('0x82')][_0xfd04('0x62')](_0xfd04('0xff'),_0xfd04('0x100'));break;}return db[_[_0xfd04('0xf0')](_0x5a1421)+_0xfd04('0x101')][_0xfd04('0xef')](_0x1d149b)[_0xfd04('0x18')](function(_0x1e8100){_0x202a52[_0xfd04('0x13')]+=_0x1e8100[_0xfd04('0x13')];return _[_0xfd04('0x75')](_0x1e8100[_0xfd04('0xa5')],function(_0x18678d){var _0x59d6a1=_0x18678d[_0xfd04('0x37')]({'plain':!![]});_0x59d6a1[_0xfd04('0xd8')]=_0x5a1421;if(_0x59d6a1[_0xfd04('0xf6')]){_0x59d6a1['Owner']={'id':_0x59d6a1[_0xfd04('0xf6')]['id'],'name':_0x59d6a1['Owner'][_0xfd04('0x1e')],'fullname':_0x59d6a1[_0xfd04('0xf6')][_0xfd04('0xed')]};}return _0x59d6a1;});});}});return Promise[_0xfd04('0x8c')](_0x213c04);})['then'](function(_0xc8cca1){return _(_0xc8cca1)[_0xfd04('0x102')]()[_0xfd04('0x103')]('createdAt')[_0xfd04('0x104')]()['value']();})[_0xfd04('0x18')](function(_0x32ac5e){_0x202a52['rows']=_0x4cf89e[_0xfd04('0x14')]?_0x32ac5e['slice'](_0x4cf89e[_0xfd04('0x11')],_0x4cf89e[_0xfd04('0x11')]+_0x4cf89e[_0xfd04('0x14')]):_0x32ac5e;return _0x202a52;})[_0xfd04('0x18')](respondWithFilteredResult(_0x27889a,_0x4cf89e))['catch'](handleError(_0x27889a,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index c4db1a4..1285e68 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac49=['hasOwnProperty','exports','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0x1bd2d7,_0x4979aa){var _0x379bbd=function(_0x40701a){while(--_0x40701a){_0x1bd2d7['push'](_0x1bd2d7['shift']());}};_0x379bbd(++_0x4979aa);}(_0xac49,0x10a));var _0x9ac4=function(_0x46e824,_0x260243){_0x46e824=_0x46e824-0x0;var _0x5b6e78=_0xac49[_0x46e824];return _0x5b6e78;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0x9ac4('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9ac4('0x1')](0x0);var events={'afterCreate':_0x9ac4('0x2'),'afterUpdate':_0x9ac4('0x3'),'afterDestroy':_0x9ac4('0x4')};function emitEvent(_0x5e487e){return function(_0x352092,_0x3b8175,_0x602c45){CmContactEvents[_0x9ac4('0x5')](_0x5e487e+':'+_0x352092['id'],_0x352092);CmContactEvents['emit'](_0x5e487e,_0x352092);_0x602c45(null);};}for(var e in events){if(events[_0x9ac4('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x9ac4('0x7')]=CmContactEvents; \ No newline at end of file +var _0x15ff=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x5f34a3,_0x4ba871){var _0xeabd05=function(_0x3ececd){while(--_0x3ececd){_0x5f34a3['push'](_0x5f34a3['shift']());}};_0xeabd05(++_0x4ba871);}(_0x15ff,0x74));var _0xf15f=function(_0x57faf9,_0x108405){_0x57faf9=_0x57faf9-0x0;var _0x49890f=_0x15ff[_0x57faf9];return _0x49890f;};'use strict';var EventEmitter=require(_0xf15f('0x0'));var CmContact=require(_0xf15f('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf15f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf15f('0x3'),'afterDestroy':_0xf15f('0x4')};function emitEvent(_0x43c95a){return function(_0x1aa38c,_0x226046,_0x66b21a){CmContactEvents['emit'](_0x43c95a+':'+_0x1aa38c['id'],_0x1aa38c);CmContactEvents[_0xf15f('0x5')](_0x43c95a,_0x1aa38c);_0x66b21a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xf15f('0x6')](e,emitEvent(event));}}module[_0xf15f('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 6d3c934..fd06066 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc17f=['util','moment','../../config/environment/shared','Campaign','VoiceQueue','scheduledat','format','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','dialCheckDuplicateType','onlyIfOpen','outbound','CmList','map','Lists','all','findAll','CmHopperBlack','BlackLists','exports','cm_contacts','fti_cm_contacts','mobile','fax','utf8mb4','utf8mb4_unicode_ci','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','get','isEmpty','length','destroy','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc17f,0x1d8));var _0xfc17=function(_0x258534,_0x586b54){_0x258534=_0x258534-0x0;var _0x37b893=_0xc17f[_0x258534];return _0x37b893;};'use strict';var _=require('lodash');var util=require(_0xfc17('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xfc17('0x1'));var shared=require(_0xfc17('0x2'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x218bb7,_0x2ca557,_0x31a4dd,_0x1e6ff7){var _0x5c309d=_0x1e6ff7?_0xfc17('0x3'):_0xfc17('0x4');var _0x51b0c1=_0x31a4dd[_0xfc17('0x5')]?_0x31a4dd[_0xfc17('0x5')]:moment()[_0xfc17('0x6')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0xfc17('0x7')](_0x31a4dd[_0xfc17('0x8')])){return Promise[_0xfc17('0x9')](_0x51b0c1);}return _0x218bb7[_0x5c309d][_0xfc17('0xa')]({'where':{'id':_0x2ca557}})[_0xfc17('0xb')](function(_0x190a8c){if(_[_0xfc17('0x7')](_0x190a8c)||_[_0xfc17('0x7')](_0x190a8c[_0xfc17('0x8')])){return Promise[_0xfc17('0x9')](_0x51b0c1);}var _0x430e5a=shared[_0xfc17('0xc')];var _0x541b8a=_0x430e5a[_0x190a8c[_0xfc17('0x8')]];var _0x438b0a=_0x430e5a[_0x31a4dd[_0xfc17('0x8')]];if(_[_0xfc17('0x7')](_0x541b8a)&&_[_0xfc17('0x7')](_0x438b0a)){return Promise['resolve'](_0x51b0c1);}var _0x264d8f=_0x541b8a[_0xfc17('0xd')]-_0x438b0a[_0xfc17('0xd')];var _0x226ac6=_0x31a4dd[_0xfc17('0x5')]?_0x31a4dd[_0xfc17('0x5')]:moment();_0x51b0c1=moment(_0x226ac6)['add'](_0x264d8f,_0xfc17('0xe'))[_0xfc17('0x6')](_0xfc17('0xf'));return Promise[_0xfc17('0x9')](_0x51b0c1);});}function getNewHopperPayload(_0x5d4b5d){return{'phone':_0x5d4b5d[_0xfc17('0x10')],'ContactId':_0x5d4b5d['id'],'ListId':_0x5d4b5d[_0xfc17('0x11')],'scheduledat':_0x5d4b5d[_0xfc17('0x5')]?_0x5d4b5d[_0xfc17('0x5')]:moment()[_0xfc17('0x6')](_0xfc17('0xf')),'priority':_0x5d4b5d[_0xfc17('0x12')]?_0x5d4b5d[_0xfc17('0x12')]:0x2,'callback':_0x5d4b5d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5d4b5d[_0xfc17('0x13')]?_0x5d4b5d[_0xfc17('0x13')]:undefined,'callbackat':_0x5d4b5d['callbackUniqueid']?moment()['format'](_0xfc17('0xf')):undefined};}function handleAlwaysCheckDuplicate(_0x140adc,_0x54253f,_0x2b304,_0x741623){var _0xa43f01={'phone':_0x2b304[_0xfc17('0x10')]};var _0x278d52={'calleridnum':_0x2b304[_0xfc17('0x10')]};if(_0x741623){Object[_0xfc17('0x14')](_0xa43f01,{'CampaignId':_0x54253f['id']});Object[_0xfc17('0x14')](_0x278d52,{'CampaignId':_0x54253f['id']});}else{Object['assign'](_0xa43f01,{'VoiceQueueId':_0x54253f['id']});Object[_0xfc17('0x14')](_0x278d52,{'VoiceQueueId':_0x54253f['id']});}return _0x140adc[_0xfc17('0x15')][_0xfc17('0xa')]({'where':_0xa43f01})[_0xfc17('0xb')](function(_0x340361){if(_0x340361){throw new Error(_0xfc17('0x16')+_0x2b304[_0xfc17('0x10')]+_0xfc17('0x17')+_0x54253f['id']);}return _0x140adc['CmHopperFinal'][_0xfc17('0xa')]({'where':_0x278d52});})[_0xfc17('0xb')](function(_0x658ed2){if(_0x658ed2){throw new Error(_0xfc17('0x18')+_0x2b304[_0xfc17('0x10')]+_0xfc17('0x17')+_0x54253f['id']);}var _0x2568da=getNewHopperPayload(_0x2b304);if(_0x741623){_0x2568da[_0xfc17('0x19')]=_0x54253f['id'];}else{_0x2568da[_0xfc17('0x1a')]=_0x54253f['id'];}return _0x140adc[_0xfc17('0x15')][_0xfc17('0x1b')](_0x2568da);});}function handleOnlyIfOpenCheckDuplicate(_0x33016e,_0x301f00,_0x216a01,_0x311fad){var _0xf87eb5={'phone':_0x216a01[_0xfc17('0x10')]};if(_0x311fad){Object['assign'](_0xf87eb5,{'CampaignId':_0x301f00['id']});}else{Object[_0xfc17('0x14')](_0xf87eb5,{'VoiceQueueId':_0x301f00['id']});}return _0x33016e['CmHopper'][_0xfc17('0xa')]({'where':_0xf87eb5})[_0xfc17('0xb')](function(_0x545ff7){if(_0x545ff7){throw new Error(_0xfc17('0x1c')+_0x216a01[_0xfc17('0x10')]+_0xfc17('0x17')+_0x301f00['id']);}var _0x41b6e7=getNewHopperPayload(_0x216a01);if(_0x311fad){_0x41b6e7[_0xfc17('0x19')]=_0x301f00['id'];}else{_0x41b6e7[_0xfc17('0x1a')]=_0x301f00['id'];}return _0x33016e[_0xfc17('0x15')][_0xfc17('0x1b')](_0x41b6e7);});}function handleNeverCheckDuplicate(_0xdfdce5,_0x4197b7,_0x558358){var _0x443cfb=getNewHopperPayload(_0x558358);_0x443cfb[_0xfc17('0x1a')]=_0x4197b7['id'];return _0xdfdce5[_0xfc17('0x15')][_0xfc17('0x1b')](_0x443cfb);}function handleCheckDuplicate(_0x2effb9,_0x58864e,_0x131def,_0x27ce61){return getTimezoneCallbackAt(_0x2effb9,_0x58864e,_0x131def,_0x27ce61)[_0xfc17('0xb')](function(_0x22c038){_0x131def[_0xfc17('0x5')]=_0x22c038;switch(_0x58864e[_0xfc17('0x1d')]){case'always':return handleAlwaysCheckDuplicate(_0x2effb9,_0x58864e,_0x131def,_0x27ce61);case _0xfc17('0x1e'):return handleOnlyIfOpenCheckDuplicate(_0x2effb9,_0x58864e,_0x131def,_0x27ce61);default:return handleNeverCheckDuplicate(_0x2effb9,_0x58864e,_0x131def);}});}function createHopperForVoiceQueues(_0x363a0b,_0x457d71){return _0x363a0b[_0xfc17('0x4')]['findAll']({'where':{'type':_0xfc17('0x1f')},'attributes':['id',_0xfc17('0x1d'),_0xfc17('0x8')],'include':[{'model':_0x363a0b[_0xfc17('0x20')],'as':'Lists','where':{'id':_0x457d71[_0xfc17('0x11')]}}],'raw':!![]})['then'](function(_0x316ca6){var _0x1af927=_0x316ca6[_0xfc17('0x21')](function(_0x48221e){return handleCheckDuplicate(_0x363a0b,_0x48221e,_0x457d71,![]);});return Promise['all'](_0x1af927);});}function createHopperForCampaigns(_0x22b070,_0x1614fe){return _0x22b070[_0xfc17('0x3')]['findAll']({'attributes':['id',_0xfc17('0x1d'),'dialTimezone'],'include':[{'model':_0x22b070['CmList'],'as':_0xfc17('0x22'),'where':{'id':_0x1614fe['ListId']}}],'raw':!![]})[_0xfc17('0xb')](function(_0x5511d2){var _0x29426e=_0x5511d2['map'](function(_0x2b846d){return handleCheckDuplicate(_0x22b070,_0x2b846d,_0x1614fe,!![]);});return Promise[_0xfc17('0x23')](_0x29426e);});}function createHopperBlackForVoiceQueues(_0x26eb02,_0x35d484){return _0x26eb02[_0xfc17('0x4')][_0xfc17('0x24')]({'where':{'type':_0xfc17('0x1f')},'attributes':['id'],'include':[{'model':_0x26eb02[_0xfc17('0x20')],'as':'BlackLists','where':{'id':_0x35d484[_0xfc17('0x11')]}}],'raw':!![]})['then'](function(_0x2912a9){var _0x125027=_0x2912a9[_0xfc17('0x21')](function(_0xeb5d07){return _0x26eb02[_0xfc17('0x25')][_0xfc17('0x1b')]({'phone':_0x35d484[_0xfc17('0x10')],'ContactId':_0x35d484['id'],'ListId':_0x35d484[_0xfc17('0x11')],'VoiceQueueId':_0xeb5d07['id']});});return Promise[_0xfc17('0x23')](_0x125027);});}function createHopperBlackForCampaigns(_0x2ab9a0,_0x2b9810){return _0x2ab9a0[_0xfc17('0x3')][_0xfc17('0x24')]({'attributes':['id'],'include':[{'model':_0x2ab9a0[_0xfc17('0x20')],'as':_0xfc17('0x26'),'where':{'id':_0x2b9810[_0xfc17('0x11')]}}],'raw':!![]})[_0xfc17('0xb')](function(_0xeeefc9){var _0x4acd39=_0xeeefc9[_0xfc17('0x21')](function(_0x59f3ec){return _0x2ab9a0[_0xfc17('0x25')][_0xfc17('0x1b')]({'phone':_0x2b9810['phone'],'ContactId':_0x2b9810['id'],'ListId':_0x2b9810[_0xfc17('0x11')],'CampaignId':_0x59f3ec['id']});});return Promise['all'](_0x4acd39);});}module[_0xfc17('0x27')]=function(_0x1567cf){return _0x1567cf['define']('CmContact',attributes,{'tableName':_0xfc17('0x28'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xfc17('0x10')]},{'name':_0xfc17('0x29'),'fields':['firstName','lastName',_0xfc17('0x10'),_0xfc17('0x2a'),_0xfc17('0x2b'),'email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xfc17('0x2c'),'collate':_0xfc17('0x2d'),'hooks':{'afterCreate':function(_0x40b8e7,_0x287477,_0xdd4cfe){var _0x1be5ed=_0x1567cf['models'];var _0x55cc0e=_0x40b8e7['get']({'plain':!![]});if(!_0x55cc0e[_0xfc17('0x11')]){logger[_0xfc17('0x2e')](_0xfc17('0x2f')+_0x55cc0e['id']);return _0xdd4cfe();}if(!_0x55cc0e[_0xfc17('0x10')]){return _0xdd4cfe();}return createHopperForVoiceQueues(_0x1be5ed,_0x55cc0e)['then'](function(){return createHopperBlackForVoiceQueues(_0x1be5ed,_0x55cc0e);})[_0xfc17('0xb')](function(){return createHopperForCampaigns(_0x1be5ed,_0x55cc0e);})[_0xfc17('0xb')](function(){return createHopperBlackForCampaigns(_0x1be5ed,_0x55cc0e);})[_0xfc17('0xb')](function(){return _0xdd4cfe();})[_0xfc17('0x30')](function(_0x46e2f5){logger[_0xfc17('0x2e')](_0xfc17('0x31'),_0x46e2f5[_0xfc17('0x32')]);_0xdd4cfe();});},'afterDestroy':function(_0x2aab2c,_0xe8a39e,_0x3f0bea){var _0x494c65=_0x1567cf['models'];var _0x50cff6=_0x2aab2c[_0xfc17('0x33')]({'plain':!![]});return _0x494c65[_0xfc17('0x15')][_0xfc17('0x24')]({'raw':!![],'where':{'ListId':_0x50cff6[_0xfc17('0x11')],'ContactId':_0x50cff6['id']}})[_0xfc17('0xb')](function(_0x2660aa){if(!_[_0xfc17('0x34')](_0x2660aa)){var _0xbeacae=[];for(var _0xe38936=0x0;_0xe38936<_0x2660aa[_0xfc17('0x35')];_0xe38936+=0x1){var _0xf22f06=_0x494c65[_0xfc17('0x15')][_0xfc17('0x36')]({'where':{'ListId':_0x2660aa[_0xe38936]['ListId'],'ContactId':_0x2660aa[_0xe38936]['ContactId'],'VoiceQueueId':_0x2660aa[_0xe38936][_0xfc17('0x1a')],'CampaignId':_0x2660aa[_0xe38936][_0xfc17('0x19')]}});_0xbeacae['push'](_0xf22f06);}return Promise[_0xfc17('0x23')](_0xbeacae);}})[_0xfc17('0xb')](function(_0x3149e2){logger[_0xfc17('0x37')](_0xfc17('0x38'),util[_0xfc17('0x39')](_0x3149e2,{'showHidden':![],'depth':null}));_0x3f0bea();})['catch'](function(_0x27e283){logger[_0xfc17('0x2e')](_0xfc17('0x3a'),util[_0xfc17('0x39')](_0x27e283,{'showHidden':![],'depth':null}));_0x3f0bea(_0x27e283);});}}});}; \ No newline at end of file +var _0x7706=['utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','priority','callbackUniqueid','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','all','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','utf8mb4','utf8mb4_unicode_ci','models','catch','error','[cmContact][afterCreate]','get','isEmpty','length','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','resolve','then','isNil','dialTimezone','timezones'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7706,0xba));var _0x6770=function(_0x404b97,_0x16d72f){_0x404b97=_0x404b97-0x0;var _0x32992c=_0x7706[_0x404b97];return _0x32992c;};'use strict';var _=require(_0x6770('0x0'));var util=require(_0x6770('0x1'));var logger=require(_0x6770('0x2'))(_0x6770('0x3'));var moment=require(_0x6770('0x4'));var shared=require('../../config/environment/shared');var attributes=require(_0x6770('0x5'));function getTimezoneCallbackAt(_0x59656a,_0x1bdf5d,_0x238da6,_0x2aaae1){var _0x177f84=_0x2aaae1?_0x6770('0x6'):_0x6770('0x7');var _0x3a1168=_0x238da6[_0x6770('0x8')]?_0x238da6[_0x6770('0x8')]:moment()[_0x6770('0x9')]('YYYY-MM-DD\x20HH:mm:ss');if(_['isNil'](_0x238da6['dialTimezone'])){return Promise[_0x6770('0xa')](_0x3a1168);}return _0x59656a[_0x177f84]['findOne']({'where':{'id':_0x1bdf5d}})[_0x6770('0xb')](function(_0x1e5e53){if(_[_0x6770('0xc')](_0x1e5e53)||_[_0x6770('0xc')](_0x1e5e53[_0x6770('0xd')])){return Promise['resolve'](_0x3a1168);}var _0x485ecd=shared[_0x6770('0xe')];var _0x4b57e9=_0x485ecd[_0x1e5e53[_0x6770('0xd')]];var _0x2f9a12=_0x485ecd[_0x238da6[_0x6770('0xd')]];if(_[_0x6770('0xc')](_0x4b57e9)&&_[_0x6770('0xc')](_0x2f9a12)){return Promise['resolve'](_0x3a1168);}var _0x47754e=_0x4b57e9[_0x6770('0xf')]-_0x2f9a12['utcOffset'];var _0x583c42=_0x238da6[_0x6770('0x8')]?_0x238da6[_0x6770('0x8')]:moment();_0x3a1168=moment(_0x583c42)[_0x6770('0x10')](_0x47754e,_0x6770('0x11'))[_0x6770('0x9')](_0x6770('0x12'));return Promise[_0x6770('0xa')](_0x3a1168);});}function getNewHopperPayload(_0x4d111e){return{'phone':_0x4d111e[_0x6770('0x13')],'ContactId':_0x4d111e['id'],'ListId':_0x4d111e[_0x6770('0x14')],'scheduledat':_0x4d111e[_0x6770('0x8')]?_0x4d111e['scheduledat']:moment()[_0x6770('0x9')](_0x6770('0x12')),'priority':_0x4d111e[_0x6770('0x15')]?_0x4d111e[_0x6770('0x15')]:0x2,'callback':_0x4d111e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4d111e[_0x6770('0x16')]?_0x4d111e[_0x6770('0x16')]:undefined,'callbackat':_0x4d111e['callbackUniqueid']?moment()[_0x6770('0x9')](_0x6770('0x12')):undefined};}function handleAlwaysCheckDuplicate(_0x34f002,_0x1b5c45,_0x2ac12f,_0x21c188){var _0x4883f9={'phone':_0x2ac12f[_0x6770('0x13')]};var _0x2f9bac={'calleridnum':_0x2ac12f[_0x6770('0x13')]};if(_0x21c188){Object[_0x6770('0x17')](_0x4883f9,{'CampaignId':_0x1b5c45['id']});Object[_0x6770('0x17')](_0x2f9bac,{'CampaignId':_0x1b5c45['id']});}else{Object[_0x6770('0x17')](_0x4883f9,{'VoiceQueueId':_0x1b5c45['id']});Object['assign'](_0x2f9bac,{'VoiceQueueId':_0x1b5c45['id']});}return _0x34f002[_0x6770('0x18')][_0x6770('0x19')]({'where':_0x4883f9})[_0x6770('0xb')](function(_0x2e5a5e){if(_0x2e5a5e){throw new Error(_0x6770('0x1a')+_0x2ac12f[_0x6770('0x13')]+_0x6770('0x1b')+_0x1b5c45['id']);}return _0x34f002[_0x6770('0x1c')][_0x6770('0x19')]({'where':_0x2f9bac});})[_0x6770('0xb')](function(_0x6c5e6e){if(_0x6c5e6e){throw new Error(_0x6770('0x1d')+_0x2ac12f[_0x6770('0x13')]+_0x6770('0x1b')+_0x1b5c45['id']);}var _0x5889dc=getNewHopperPayload(_0x2ac12f);if(_0x21c188){_0x5889dc[_0x6770('0x1e')]=_0x1b5c45['id'];}else{_0x5889dc['VoiceQueueId']=_0x1b5c45['id'];}return _0x34f002['CmHopper'][_0x6770('0x1f')](_0x5889dc);});}function handleOnlyIfOpenCheckDuplicate(_0xbe1cbd,_0x2edb5b,_0xd379f7,_0x468a32){var _0x5c654e={'phone':_0xd379f7[_0x6770('0x13')]};if(_0x468a32){Object[_0x6770('0x17')](_0x5c654e,{'CampaignId':_0x2edb5b['id']});}else{Object[_0x6770('0x17')](_0x5c654e,{'VoiceQueueId':_0x2edb5b['id']});}return _0xbe1cbd[_0x6770('0x18')]['findOne']({'where':_0x5c654e})[_0x6770('0xb')](function(_0xbebeca){if(_0xbebeca){throw new Error(_0x6770('0x20')+_0xd379f7[_0x6770('0x13')]+_0x6770('0x1b')+_0x2edb5b['id']);}var _0x2ce6bd=getNewHopperPayload(_0xd379f7);if(_0x468a32){_0x2ce6bd['CampaignId']=_0x2edb5b['id'];}else{_0x2ce6bd[_0x6770('0x21')]=_0x2edb5b['id'];}return _0xbe1cbd[_0x6770('0x18')][_0x6770('0x1f')](_0x2ce6bd);});}function handleNeverCheckDuplicate(_0x4a4471,_0x2b2e88,_0x4e52ab){var _0xac7598=getNewHopperPayload(_0x4e52ab);_0xac7598[_0x6770('0x21')]=_0x2b2e88['id'];return _0x4a4471['CmHopper'][_0x6770('0x1f')](_0xac7598);}function handleCheckDuplicate(_0x40485c,_0x22195e,_0xa8fd1,_0x35bd26){return getTimezoneCallbackAt(_0x40485c,_0x22195e,_0xa8fd1,_0x35bd26)['then'](function(_0x35a516){_0xa8fd1[_0x6770('0x8')]=_0x35a516;switch(_0x22195e[_0x6770('0x22')]){case _0x6770('0x23'):return handleAlwaysCheckDuplicate(_0x40485c,_0x22195e,_0xa8fd1,_0x35bd26);case _0x6770('0x24'):return handleOnlyIfOpenCheckDuplicate(_0x40485c,_0x22195e,_0xa8fd1,_0x35bd26);default:return handleNeverCheckDuplicate(_0x40485c,_0x22195e,_0xa8fd1);}});}function createHopperForVoiceQueues(_0x3bee98,_0x4afb78){return _0x3bee98[_0x6770('0x7')][_0x6770('0x25')]({'where':{'type':_0x6770('0x26')},'attributes':['id',_0x6770('0x22'),'dialTimezone'],'include':[{'model':_0x3bee98[_0x6770('0x27')],'as':_0x6770('0x28'),'where':{'id':_0x4afb78[_0x6770('0x14')]}}],'raw':!![]})[_0x6770('0xb')](function(_0x52a163){var _0x292e23=_0x52a163[_0x6770('0x29')](function(_0x41823f){return handleCheckDuplicate(_0x3bee98,_0x41823f,_0x4afb78,![]);});return Promise['all'](_0x292e23);});}function createHopperForCampaigns(_0x497645,_0x1f79a0){return _0x497645[_0x6770('0x6')]['findAll']({'attributes':['id',_0x6770('0x22'),_0x6770('0xd')],'include':[{'model':_0x497645[_0x6770('0x27')],'as':_0x6770('0x28'),'where':{'id':_0x1f79a0[_0x6770('0x14')]}}],'raw':!![]})[_0x6770('0xb')](function(_0x575cc2){var _0x1b019e=_0x575cc2[_0x6770('0x29')](function(_0x6f9a8f){return handleCheckDuplicate(_0x497645,_0x6f9a8f,_0x1f79a0,!![]);});return Promise[_0x6770('0x2a')](_0x1b019e);});}function createHopperBlackForVoiceQueues(_0x113f5e,_0x38ee52){return _0x113f5e[_0x6770('0x7')][_0x6770('0x25')]({'where':{'type':_0x6770('0x26')},'attributes':['id'],'include':[{'model':_0x113f5e['CmList'],'as':_0x6770('0x2b'),'where':{'id':_0x38ee52[_0x6770('0x14')]}}],'raw':!![]})[_0x6770('0xb')](function(_0xeea777){var _0x45ec43=_0xeea777['map'](function(_0x2e534b){return _0x113f5e[_0x6770('0x2c')]['create']({'phone':_0x38ee52[_0x6770('0x13')],'ContactId':_0x38ee52['id'],'ListId':_0x38ee52[_0x6770('0x14')],'VoiceQueueId':_0x2e534b['id']});});return Promise[_0x6770('0x2a')](_0x45ec43);});}function createHopperBlackForCampaigns(_0x2e20c9,_0x3c354e){return _0x2e20c9[_0x6770('0x6')][_0x6770('0x25')]({'attributes':['id'],'include':[{'model':_0x2e20c9[_0x6770('0x27')],'as':_0x6770('0x2b'),'where':{'id':_0x3c354e[_0x6770('0x14')]}}],'raw':!![]})['then'](function(_0x34e764){var _0x433f16=_0x34e764['map'](function(_0x1b08c6){return _0x2e20c9[_0x6770('0x2c')][_0x6770('0x1f')]({'phone':_0x3c354e[_0x6770('0x13')],'ContactId':_0x3c354e['id'],'ListId':_0x3c354e[_0x6770('0x14')],'CampaignId':_0x1b08c6['id']});});return Promise[_0x6770('0x2a')](_0x433f16);});}module[_0x6770('0x2d')]=function(_0x5ef308){return _0x5ef308[_0x6770('0x2e')](_0x6770('0x2f'),attributes,{'tableName':_0x6770('0x30'),'paranoid':!![],'indexes':[{'name':_0x6770('0x13'),'fields':[_0x6770('0x13')]},{'name':_0x6770('0x31'),'fields':[_0x6770('0x32'),_0x6770('0x33'),'phone',_0x6770('0x34'),'fax','email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x6770('0x35'),'collate':_0x6770('0x36'),'hooks':{'afterCreate':function(_0x3a2166,_0x12d6bf,_0x43c9bd){var _0x14a349=_0x5ef308[_0x6770('0x37')];var _0x1087e2=_0x3a2166['get']({'plain':!![]});if(!_0x1087e2['ListId']){logger['error']('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x1087e2['id']);return _0x43c9bd();}if(!_0x1087e2['phone']){return _0x43c9bd();}return createHopperForVoiceQueues(_0x14a349,_0x1087e2)[_0x6770('0xb')](function(){return createHopperBlackForVoiceQueues(_0x14a349,_0x1087e2);})[_0x6770('0xb')](function(){return createHopperForCampaigns(_0x14a349,_0x1087e2);})[_0x6770('0xb')](function(){return createHopperBlackForCampaigns(_0x14a349,_0x1087e2);})[_0x6770('0xb')](function(){return _0x43c9bd();})[_0x6770('0x38')](function(_0x5168b2){logger[_0x6770('0x39')](_0x6770('0x3a'),_0x5168b2['message']);_0x43c9bd();});},'afterDestroy':function(_0x38d2d1,_0x19275f,_0x1d6001){var _0x44848e=_0x5ef308['models'];var _0x2d04ea=_0x38d2d1[_0x6770('0x3b')]({'plain':!![]});return _0x44848e[_0x6770('0x18')][_0x6770('0x25')]({'raw':!![],'where':{'ListId':_0x2d04ea[_0x6770('0x14')],'ContactId':_0x2d04ea['id']}})[_0x6770('0xb')](function(_0x3f7279){if(!_[_0x6770('0x3c')](_0x3f7279)){var _0x5a6165=[];for(var _0x50b233=0x0;_0x50b233<_0x3f7279[_0x6770('0x3d')];_0x50b233+=0x1){var _0x524026=_0x44848e['CmHopper']['destroy']({'where':{'ListId':_0x3f7279[_0x50b233][_0x6770('0x14')],'ContactId':_0x3f7279[_0x50b233]['ContactId'],'VoiceQueueId':_0x3f7279[_0x50b233][_0x6770('0x21')],'CampaignId':_0x3f7279[_0x50b233][_0x6770('0x1e')]}});_0x5a6165[_0x6770('0x3e')](_0x524026);}return Promise[_0x6770('0x2a')](_0x5a6165);}})['then'](function(_0x1a796a){logger[_0x6770('0x3f')](_0x6770('0x40'),util[_0x6770('0x41')](_0x1a796a,{'showHidden':![],'depth':null}));_0x1d6001();})['catch'](function(_0x42352d){logger[_0x6770('0x39')](_0x6770('0x42'),util[_0x6770('0x41')](_0x42352d,{'showHidden':![],'depth':null}));_0x1d6001(_0x42352d);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 4a7570e..99ca5e3 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x420e05,_0x2d8ea2){var _0x236195=function(_0x39ae34){while(--_0x39ae34){_0x420e05['push'](_0x420e05['shift']());}};_0x236195(++_0x2d8ea2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index eb579d5..e3f71f4 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0884=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x32292b,_0x4e9525){var _0x1845b4=function(_0x348377){while(--_0x348377){_0x32292b['push'](_0x32292b['shift']());}};_0x1845b4(++_0x4e9525);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4088('0x0'));module[_0x4088('0x1')]={'CmContactId':{'type':Sequelize[_0x4088('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x4088('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4088('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4088('0x3')],'defaultValue':_0x4088('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x4088('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x0f9f=['exports','INTEGER','STRING','PHONE'];(function(_0x1734b2,_0x245b9d){var _0x167af3=function(_0xacf927){while(--_0xacf927){_0x1734b2['push'](_0x1734b2['shift']());}};_0x167af3(++_0x245b9d);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x15278e,_0x1d9952){_0x15278e=_0x15278e-0x0;var _0x6ae1d9=_0x0f9f[_0x15278e];return _0x6ae1d9;};'use strict';var Sequelize=require('sequelize');module[_0xf0f9('0x0')]={'CmContactId':{'type':Sequelize[_0xf0f9('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xf0f9('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xf0f9('0x2')],'defaultValue':_0xf0f9('0x3')},'OrderBy':{'type':Sequelize[_0xf0f9('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xf0f9('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index a6e096f..8ea52c1 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd49b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','sort','where','pick','filter','merge','options','includeAll','rows','params','length','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','error'];(function(_0x41c7e6,_0x3a30c7){var _0x116fa2=function(_0x51c8d7){while(--_0x51c8d7){_0x41c7e6['push'](_0x41c7e6['shift']());}};_0x116fa2(++_0x3a30c7);}(_0xd49b,0x1ef));var _0xbd49=function(_0xa5a920,_0x2d8772){_0xa5a920=_0xa5a920-0x0;var _0x596618=_0xd49b[_0xa5a920];return _0x596618;};'use strict';var emlformat=require(_0xbd49('0x0'));var rimraf=require(_0xbd49('0x1'));var zipdir=require(_0xbd49('0x2'));var jsonpatch=require(_0xbd49('0x3'));var rp=require(_0xbd49('0x4'));var moment=require('moment');var BPromise=require(_0xbd49('0x5'));var Mustache=require(_0xbd49('0x6'));var util=require(_0xbd49('0x7'));var path=require(_0xbd49('0x8'));var sox=require('sox');var csv=require(_0xbd49('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd49('0xa'));var _=require('lodash');var squel=require(_0xbd49('0xb'));var crypto=require(_0xbd49('0xc'));var jsforce=require(_0xbd49('0xd'));var deskjs=require(_0xbd49('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbd49('0xf'));var Papa=require('papaparse');var Redis=require(_0xbd49('0x10'));var authService=require(_0xbd49('0x11'));var qs=require(_0xbd49('0x12'));var as=require(_0xbd49('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd49('0x14'))(_0xbd49('0x15'));var utils=require(_0xbd49('0x16'));var config=require(_0xbd49('0x17'));var licenseUtil=require(_0xbd49('0x18'));var db=require(_0xbd49('0x19'))['db'];function respondWithStatusCode(_0x4c051f,_0x574685){_0x574685=_0x574685||0xcc;return function(_0x3a3862){if(_0x3a3862){return _0x4c051f['sendStatus'](_0x574685);}return _0x4c051f[_0xbd49('0x1a')](_0x574685)[_0xbd49('0x1b')]();};}function respondWithResult(_0x5844aa,_0x56ded1){_0x56ded1=_0x56ded1||0xc8;return function(_0x43ac91){if(_0x43ac91){return _0x5844aa[_0xbd49('0x1a')](_0x56ded1)[_0xbd49('0x1c')](_0x43ac91);}};}function respondWithFilteredResult(_0x5e3af2,_0x1ef45b){return function(_0x381c1d){if(_0x381c1d){var _0x25c3c8=typeof _0x1ef45b[_0xbd49('0x1d')]===_0xbd49('0x1e')&&typeof _0x1ef45b['limit']===_0xbd49('0x1e');var _0xb809cb=_0x381c1d[_0xbd49('0x1f')];var _0x44e29b=_0x25c3c8?0x0:_0x1ef45b[_0xbd49('0x1d')];var _0x2b75ff=_0x25c3c8?_0x381c1d[_0xbd49('0x1f')]:_0x1ef45b['offset']+_0x1ef45b[_0xbd49('0x20')];var _0x4b3705;if(_0x2b75ff>=_0xb809cb){_0x2b75ff=_0xb809cb;_0x4b3705=0xc8;}else{_0x4b3705=0xce;}_0x5e3af2[_0xbd49('0x1a')](_0x4b3705);return _0x5e3af2[_0xbd49('0x21')](_0xbd49('0x22'),_0x44e29b+'-'+_0x2b75ff+'/'+_0xb809cb)[_0xbd49('0x1c')](_0x381c1d);}return null;};}function patchUpdates(_0x37afa6){return function(_0x4551fc){try{jsonpatch[_0xbd49('0x23')](_0x4551fc,_0x37afa6,!![]);}catch(_0x129d35){return BPromise[_0xbd49('0x24')](_0x129d35);}return _0x4551fc[_0xbd49('0x25')]();};}function saveUpdates(_0x12fc93,_0x13c212){return function(_0x59cdf2){if(_0x59cdf2){return _0x59cdf2[_0xbd49('0x26')](_0x12fc93)['then'](function(_0x84bdb6){return _0x84bdb6;});}return null;};}function removeEntity(_0x18c8db,_0x30f3ee){return function(_0x57825d){if(_0x57825d){return _0x57825d[_0xbd49('0x27')]()[_0xbd49('0x28')](function(){var _0x155c39=_0x57825d[_0xbd49('0x29')]({'plain':!![]});var _0x35c3b1='CmContactHasItems';return db[_0xbd49('0x2a')][_0xbd49('0x27')]({'where':{'type':_0x35c3b1,'resourceId':_0x155c39['id']}})['then'](function(){return _0x57825d;});})['then'](function(){_0x18c8db[_0xbd49('0x1a')](0xcc)[_0xbd49('0x1b')]();});}};}function handleEntityNotFound(_0x39174b,_0x49f4b0){return function(_0x1619ec){if(!_0x1619ec){_0x39174b[_0xbd49('0x2b')](0x194);}return _0x1619ec;};}function handleError(_0x11788a,_0x287a09){_0x287a09=_0x287a09||0x1f4;return function(_0x29e45a){logger['error'](_0x29e45a[_0xbd49('0x2c')]);if(_0x29e45a[_0xbd49('0x2d')]){delete _0x29e45a[_0xbd49('0x2d')];}_0x11788a[_0xbd49('0x1a')](_0x287a09)[_0xbd49('0x2e')](_0x29e45a);};}exports['index']=function(_0x45f88b,_0x33375a){var _0x4ee230={},_0x6344e={},_0x1bc983={'count':0x0,'rows':[]};var _0x37ae10=_[_0xbd49('0x2f')](db[_0xbd49('0x30')][_0xbd49('0x31')],function(_0x4d9afb){return{'name':_0x4d9afb[_0xbd49('0x32')],'type':_0x4d9afb[_0xbd49('0x33')][_0xbd49('0x34')]};});_0x6344e[_0xbd49('0x35')]=_[_0xbd49('0x2f')](_0x37ae10,_0xbd49('0x2d'));_0x6344e['query']=_[_0xbd49('0x36')](_0x45f88b[_0xbd49('0x37')]);_0x6344e[_0xbd49('0x38')]=_[_0xbd49('0x39')](_0x6344e[_0xbd49('0x35')],_0x6344e[_0xbd49('0x37')]);_0x4ee230[_0xbd49('0x3a')]=_[_0xbd49('0x39')](_0x6344e[_0xbd49('0x35')],qs[_0xbd49('0x3b')](_0x45f88b[_0xbd49('0x37')][_0xbd49('0x3b')]));_0x4ee230[_0xbd49('0x3a')]=_0x4ee230[_0xbd49('0x3a')]['length']?_0x4ee230['attributes']:_0x6344e[_0xbd49('0x35')];if(!_0x45f88b[_0xbd49('0x37')]['hasOwnProperty']('nolimit')){_0x4ee230['limit']=qs[_0xbd49('0x20')](_0x45f88b['query'][_0xbd49('0x20')]);_0x4ee230[_0xbd49('0x1d')]=qs[_0xbd49('0x1d')](_0x45f88b['query'][_0xbd49('0x1d')]);}_0x4ee230['order']=qs[_0xbd49('0x3c')](_0x45f88b['query']['sort']);_0x4ee230[_0xbd49('0x3d')]=qs['filters'](_[_0xbd49('0x3e')](_0x45f88b[_0xbd49('0x37')],_0x6344e[_0xbd49('0x38')]),_0x37ae10);if(_0x45f88b['query'][_0xbd49('0x3f')]){_0x4ee230['where']=_[_0xbd49('0x40')](_0x4ee230[_0xbd49('0x3d')],{'$or':_[_0xbd49('0x2f')](_0x37ae10,function(_0x48326f){if(_0x48326f[_0xbd49('0x33')]!=='VIRTUAL'){var _0x2402a6={};_0x2402a6[_0x48326f[_0xbd49('0x2d')]]={'$like':'%'+_0x45f88b[_0xbd49('0x37')][_0xbd49('0x3f')]+'%'};return _0x2402a6;}})});}_0x4ee230=_[_0xbd49('0x40')]({},_0x4ee230,_0x45f88b[_0xbd49('0x41')]);var _0x3d0df8={'where':_0x4ee230[_0xbd49('0x3d')]};return db[_0xbd49('0x30')][_0xbd49('0x1f')](_0x3d0df8)[_0xbd49('0x28')](function(_0x5156eb){_0x1bc983['count']=_0x5156eb;if(_0x45f88b[_0xbd49('0x37')][_0xbd49('0x42')]){_0x4ee230['include']=[{'all':!![]}];}return db[_0xbd49('0x30')]['findAll'](_0x4ee230);})[_0xbd49('0x28')](function(_0x3d6a40){_0x1bc983[_0xbd49('0x43')]=_0x3d6a40;return _0x1bc983;})['then'](respondWithFilteredResult(_0x33375a,_0x4ee230))['catch'](handleError(_0x33375a,null));};exports['show']=function(_0x1aef32,_0x4b157c){var _0xef8fa4={'raw':!![],'where':{'id':_0x1aef32[_0xbd49('0x44')]['id']}},_0x428e26={};_0x428e26[_0xbd49('0x35')]=_[_0xbd49('0x36')](db[_0xbd49('0x30')]['rawAttributes']);_0x428e26['query']=_['keys'](_0x1aef32[_0xbd49('0x37')]);_0x428e26[_0xbd49('0x38')]=_[_0xbd49('0x39')](_0x428e26[_0xbd49('0x35')],_0x428e26[_0xbd49('0x37')]);_0xef8fa4[_0xbd49('0x3a')]=_[_0xbd49('0x39')](_0x428e26[_0xbd49('0x35')],qs['fields'](_0x1aef32['query']['fields']));_0xef8fa4[_0xbd49('0x3a')]=_0xef8fa4['attributes'][_0xbd49('0x45')]?_0xef8fa4[_0xbd49('0x3a')]:_0x428e26[_0xbd49('0x35')];if(_0x1aef32[_0xbd49('0x37')][_0xbd49('0x42')]){_0xef8fa4[_0xbd49('0x46')]=[{'all':!![]}];}_0xef8fa4=_['merge']({},_0xef8fa4,_0x1aef32[_0xbd49('0x41')]);return db['CmContactHasItem']['find'](_0xef8fa4)[_0xbd49('0x28')](handleEntityNotFound(_0x4b157c,null))[_0xbd49('0x28')](respondWithResult(_0x4b157c,null))['catch'](handleError(_0x4b157c,null));};exports[_0xbd49('0x47')]=function(_0x5a96a1,_0x15b2ac){return db[_0xbd49('0x30')][_0xbd49('0x47')](_0x5a96a1['body'],{})['then'](function(_0x5b7b92){var _0x3d9631=_0x5a96a1[_0xbd49('0x48')][_0xbd49('0x29')]({'plain':!![]});if(!_0x3d9631)throw new Error(_0xbd49('0x49'));if(_0x3d9631[_0xbd49('0x4a')]===_0xbd49('0x48')){var _0x103502=_0x5b7b92[_0xbd49('0x29')]({'plain':!![]});var _0x4ce983='CmContactHasItems';return db['UserProfileSection']['find']({'where':{'name':_0x4ce983,'userProfileId':_0x3d9631[_0xbd49('0x4b')]},'raw':!![]})[_0xbd49('0x28')](function(_0x4981b7){if(_0x4981b7&&_0x4981b7[_0xbd49('0x4c')]===0x0){return db[_0xbd49('0x2a')]['create']({'name':_0x103502['name'],'resourceId':_0x103502['id'],'type':_0x4981b7[_0xbd49('0x2d')],'sectionId':_0x4981b7['id']},{})[_0xbd49('0x28')](function(){return _0x5b7b92;});}else{return _0x5b7b92;}})[_0xbd49('0x4d')](function(_0xab0cb4){logger[_0xbd49('0x4e')](_0xbd49('0x4f'),_0xab0cb4);throw _0xab0cb4;});}return _0x5b7b92;})[_0xbd49('0x28')](respondWithResult(_0x15b2ac,0xc9))[_0xbd49('0x4d')](handleError(_0x15b2ac,null));};exports[_0xbd49('0x26')]=function(_0xc88cd0,_0x5710fa){if(_0xc88cd0['body']['id']){delete _0xc88cd0[_0xbd49('0x50')]['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0xc88cd0[_0xbd49('0x44')]['id']}})[_0xbd49('0x28')](handleEntityNotFound(_0x5710fa,null))[_0xbd49('0x28')](saveUpdates(_0xc88cd0[_0xbd49('0x50')],null))['then'](respondWithResult(_0x5710fa,null))[_0xbd49('0x4d')](handleError(_0x5710fa,null));};exports[_0xbd49('0x27')]=function(_0x1635b3,_0xe6d7de){return db[_0xbd49('0x30')][_0xbd49('0x51')]({'where':{'id':_0x1635b3['params']['id']}})['then'](handleEntityNotFound(_0xe6d7de,null))[_0xbd49('0x28')](removeEntity(_0xe6d7de,null))[_0xbd49('0x4d')](handleError(_0xe6d7de,null));}; \ No newline at end of file +var _0x644d=['count','offset','Content-Range','apply','reject','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','fieldName','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','CmContactHasItem','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x27290e,_0x408bc0){var _0x144c10=function(_0x511a85){while(--_0x511a85){_0x27290e['push'](_0x27290e['shift']());}};_0x144c10(++_0x408bc0);}(_0x644d,0x1e4));var _0xd644=function(_0x5ec365,_0x49930c){_0x5ec365=_0x5ec365-0x0;var _0xab187d=_0x644d[_0x5ec365];return _0xab187d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd644('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd644('0x1'));var rp=require(_0xd644('0x2'));var moment=require(_0xd644('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd644('0x4'));var util=require(_0xd644('0x5'));var path=require('path');var sox=require(_0xd644('0x6'));var csv=require(_0xd644('0x7'));var ejs=require(_0xd644('0x8'));var fs=require('fs');var fs_extra=require(_0xd644('0x9'));var _=require('lodash');var squel=require(_0xd644('0xa'));var crypto=require(_0xd644('0xb'));var jsforce=require(_0xd644('0xc'));var deskjs=require(_0xd644('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd644('0xe'));var Papa=require(_0xd644('0xf'));var Redis=require(_0xd644('0x10'));var authService=require(_0xd644('0x11'));var qs=require(_0xd644('0x12'));var as=require(_0xd644('0x13'));var hardwareService=require(_0xd644('0x14'));var logger=require(_0xd644('0x15'))(_0xd644('0x16'));var utils=require('../../config/utils');var config=require(_0xd644('0x17'));var licenseUtil=require(_0xd644('0x18'));var db=require(_0xd644('0x19'))['db'];function respondWithStatusCode(_0x331e5a,_0x288c5e){_0x288c5e=_0x288c5e||0xcc;return function(_0x565a8b){if(_0x565a8b){return _0x331e5a[_0xd644('0x1a')](_0x288c5e);}return _0x331e5a[_0xd644('0x1b')](_0x288c5e)[_0xd644('0x1c')]();};}function respondWithResult(_0x13b78c,_0x42f84f){_0x42f84f=_0x42f84f||0xc8;return function(_0x3f5916){if(_0x3f5916){return _0x13b78c['status'](_0x42f84f)[_0xd644('0x1d')](_0x3f5916);}};}function respondWithFilteredResult(_0x3ebb63,_0x2fad47){return function(_0x194dac){if(_0x194dac){var _0x3ba3b1=typeof _0x2fad47['offset']===_0xd644('0x1e')&&typeof _0x2fad47[_0xd644('0x1f')]===_0xd644('0x1e');var _0x3952b2=_0x194dac[_0xd644('0x20')];var _0x5dcab4=_0x3ba3b1?0x0:_0x2fad47['offset'];var _0x389ba9=_0x3ba3b1?_0x194dac['count']:_0x2fad47[_0xd644('0x21')]+_0x2fad47[_0xd644('0x1f')];var _0x474593;if(_0x389ba9>=_0x3952b2){_0x389ba9=_0x3952b2;_0x474593=0xc8;}else{_0x474593=0xce;}_0x3ebb63[_0xd644('0x1b')](_0x474593);return _0x3ebb63['set'](_0xd644('0x22'),_0x5dcab4+'-'+_0x389ba9+'/'+_0x3952b2)[_0xd644('0x1d')](_0x194dac);}return null;};}function patchUpdates(_0x2db6ff){return function(_0x2b91cc){try{jsonpatch[_0xd644('0x23')](_0x2b91cc,_0x2db6ff,!![]);}catch(_0x133add){return BPromise[_0xd644('0x24')](_0x133add);}return _0x2b91cc['save']();};}function saveUpdates(_0x4c1ee0,_0x21430e){return function(_0x527db5){if(_0x527db5){return _0x527db5[_0xd644('0x25')](_0x4c1ee0)[_0xd644('0x26')](function(_0x264b9b){return _0x264b9b;});}return null;};}function removeEntity(_0x1d530f,_0xbc42b9){return function(_0x468241){if(_0x468241){return _0x468241[_0xd644('0x27')]()[_0xd644('0x26')](function(){var _0x2b3a24=_0x468241['get']({'plain':!![]});var _0x407f29=_0xd644('0x28');return db[_0xd644('0x29')][_0xd644('0x27')]({'where':{'type':_0x407f29,'resourceId':_0x2b3a24['id']}})[_0xd644('0x26')](function(){return _0x468241;});})[_0xd644('0x26')](function(){_0x1d530f[_0xd644('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5648b7,_0x23dd98){return function(_0xb3b285){if(!_0xb3b285){_0x5648b7['sendStatus'](0x194);}return _0xb3b285;};}function handleError(_0xd1bc3c,_0x1d5727){_0x1d5727=_0x1d5727||0x1f4;return function(_0x20fa6f){logger[_0xd644('0x2a')](_0x20fa6f[_0xd644('0x2b')]);if(_0x20fa6f['name']){delete _0x20fa6f[_0xd644('0x2c')];}_0xd1bc3c['status'](_0x1d5727)[_0xd644('0x2d')](_0x20fa6f);};}exports['index']=function(_0x478032,_0x521073){var _0x1059ca={},_0x721f95={},_0x1b5088={'count':0x0,'rows':[]};var _0x51bfe7=_['map'](db['CmContactHasItem']['rawAttributes'],function(_0x3ce452){return{'name':_0x3ce452[_0xd644('0x2e')],'type':_0x3ce452['type']['key']};});_0x721f95[_0xd644('0x2f')]=_[_0xd644('0x30')](_0x51bfe7,_0xd644('0x2c'));_0x721f95[_0xd644('0x31')]=_['keys'](_0x478032[_0xd644('0x31')]);_0x721f95['filters']=_[_0xd644('0x32')](_0x721f95[_0xd644('0x2f')],_0x721f95[_0xd644('0x31')]);_0x1059ca[_0xd644('0x33')]=_[_0xd644('0x32')](_0x721f95[_0xd644('0x2f')],qs[_0xd644('0x34')](_0x478032['query'][_0xd644('0x34')]));_0x1059ca[_0xd644('0x33')]=_0x1059ca['attributes'][_0xd644('0x35')]?_0x1059ca[_0xd644('0x33')]:_0x721f95[_0xd644('0x2f')];if(!_0x478032['query'][_0xd644('0x36')](_0xd644('0x37'))){_0x1059ca[_0xd644('0x1f')]=qs[_0xd644('0x1f')](_0x478032[_0xd644('0x31')][_0xd644('0x1f')]);_0x1059ca['offset']=qs[_0xd644('0x21')](_0x478032[_0xd644('0x31')][_0xd644('0x21')]);}_0x1059ca[_0xd644('0x38')]=qs[_0xd644('0x39')](_0x478032[_0xd644('0x31')]['sort']);_0x1059ca['where']=qs[_0xd644('0x3a')](_[_0xd644('0x3b')](_0x478032[_0xd644('0x31')],_0x721f95[_0xd644('0x3a')]),_0x51bfe7);if(_0x478032[_0xd644('0x31')]['filter']){_0x1059ca[_0xd644('0x3c')]=_[_0xd644('0x3d')](_0x1059ca[_0xd644('0x3c')],{'$or':_[_0xd644('0x30')](_0x51bfe7,function(_0x5d458c){if(_0x5d458c[_0xd644('0x3e')]!==_0xd644('0x3f')){var _0x37baee={};_0x37baee[_0x5d458c[_0xd644('0x2c')]]={'$like':'%'+_0x478032[_0xd644('0x31')][_0xd644('0x40')]+'%'};return _0x37baee;}})});}_0x1059ca=_[_0xd644('0x3d')]({},_0x1059ca,_0x478032['options']);var _0x3b2f72={'where':_0x1059ca[_0xd644('0x3c')]};return db[_0xd644('0x41')][_0xd644('0x20')](_0x3b2f72)[_0xd644('0x26')](function(_0x4728b7){_0x1b5088[_0xd644('0x20')]=_0x4728b7;if(_0x478032[_0xd644('0x31')][_0xd644('0x42')]){_0x1059ca[_0xd644('0x43')]=[{'all':!![]}];}return db[_0xd644('0x41')][_0xd644('0x44')](_0x1059ca);})[_0xd644('0x26')](function(_0x4431c3){_0x1b5088[_0xd644('0x45')]=_0x4431c3;return _0x1b5088;})['then'](respondWithFilteredResult(_0x521073,_0x1059ca))[_0xd644('0x46')](handleError(_0x521073,null));};exports[_0xd644('0x47')]=function(_0x20e843,_0x5a4455){var _0x546238={'raw':!![],'where':{'id':_0x20e843[_0xd644('0x48')]['id']}},_0x409809={};_0x409809[_0xd644('0x2f')]=_[_0xd644('0x49')](db[_0xd644('0x41')][_0xd644('0x4a')]);_0x409809[_0xd644('0x31')]=_[_0xd644('0x49')](_0x20e843[_0xd644('0x31')]);_0x409809[_0xd644('0x3a')]=_['intersection'](_0x409809[_0xd644('0x2f')],_0x409809['query']);_0x546238[_0xd644('0x33')]=_[_0xd644('0x32')](_0x409809[_0xd644('0x2f')],qs[_0xd644('0x34')](_0x20e843[_0xd644('0x31')][_0xd644('0x34')]));_0x546238[_0xd644('0x33')]=_0x546238['attributes'][_0xd644('0x35')]?_0x546238[_0xd644('0x33')]:_0x409809['model'];if(_0x20e843[_0xd644('0x31')][_0xd644('0x42')]){_0x546238['include']=[{'all':!![]}];}_0x546238=_[_0xd644('0x3d')]({},_0x546238,_0x20e843[_0xd644('0x4b')]);return db[_0xd644('0x41')][_0xd644('0x4c')](_0x546238)['then'](handleEntityNotFound(_0x5a4455,null))[_0xd644('0x26')](respondWithResult(_0x5a4455,null))[_0xd644('0x46')](handleError(_0x5a4455,null));};exports[_0xd644('0x4d')]=function(_0x344feb,_0x30f324){return db[_0xd644('0x41')]['create'](_0x344feb[_0xd644('0x4e')],{})['then'](function(_0x86caf1){var _0x117156=_0x344feb[_0xd644('0x4f')][_0xd644('0x50')]({'plain':!![]});if(!_0x117156)throw new Error(_0xd644('0x51'));if(_0x117156['role']===_0xd644('0x4f')){var _0x255ea9=_0x86caf1['get']({'plain':!![]});var _0x45cbf8=_0xd644('0x28');return db[_0xd644('0x52')][_0xd644('0x4c')]({'where':{'name':_0x45cbf8,'userProfileId':_0x117156[_0xd644('0x53')]},'raw':!![]})[_0xd644('0x26')](function(_0xbf3095){if(_0xbf3095&&_0xbf3095[_0xd644('0x54')]===0x0){return db[_0xd644('0x29')][_0xd644('0x4d')]({'name':_0x255ea9['name'],'resourceId':_0x255ea9['id'],'type':_0xbf3095[_0xd644('0x2c')],'sectionId':_0xbf3095['id']},{})[_0xd644('0x26')](function(){return _0x86caf1;});}else{return _0x86caf1;}})['catch'](function(_0x52e34a){logger[_0xd644('0x2a')](_0xd644('0x55'),_0x52e34a);throw _0x52e34a;});}return _0x86caf1;})[_0xd644('0x26')](respondWithResult(_0x30f324,0xc9))['catch'](handleError(_0x30f324,null));};exports['update']=function(_0x550955,_0x584bf3){if(_0x550955[_0xd644('0x4e')]['id']){delete _0x550955[_0xd644('0x4e')]['id'];}return db[_0xd644('0x41')][_0xd644('0x4c')]({'where':{'id':_0x550955['params']['id']}})['then'](handleEntityNotFound(_0x584bf3,null))[_0xd644('0x26')](saveUpdates(_0x550955['body'],null))[_0xd644('0x26')](respondWithResult(_0x584bf3,null))['catch'](handleError(_0x584bf3,null));};exports[_0xd644('0x27')]=function(_0x3aab13,_0x236d8b){return db[_0xd644('0x41')]['find']({'where':{'id':_0x3aab13[_0xd644('0x48')]['id']}})['then'](handleEntityNotFound(_0x236d8b,null))[_0xd644('0x26')](removeEntity(_0x236d8b,null))[_0xd644('0x46')](handleError(_0x236d8b,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index af7e8c7..e36c3b5 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a7f=['bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','../../config/logger','api','moment'];(function(_0x3a580b,_0x5cd8b9){var _0xb16db0=function(_0x388613){while(--_0x388613){_0x3a580b['push'](_0x3a580b['shift']());}};_0xb16db0(++_0x5cd8b9);}(_0x5a7f,0x19c));var _0xf5a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5a7('0x0'));var util=require('util');var logger=require(_0xf5a7('0x1'))(_0xf5a7('0x2'));var moment=require(_0xf5a7('0x3'));var BPromise=require(_0xf5a7('0x4'));var rp=require(_0xf5a7('0x5'));var fs=require('fs');var path=require(_0xf5a7('0x6'));var rimraf=require(_0xf5a7('0x7'));var config=require(_0xf5a7('0x8'));var attributes=require(_0xf5a7('0x9'));module[_0xf5a7('0xa')]=function(_0x19420b,_0x5407d9){return _0x19420b[_0xf5a7('0xb')]('CmContactHasItem',attributes,{'tableName':_0xf5a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ed3=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items'];(function(_0x5303b9,_0x5c548){var _0x455125=function(_0x24ad74){while(--_0x24ad74){_0x5303b9['push'](_0x5303b9['shift']());}};_0x455125(++_0x5c548);}(_0x6ed3,0xb4));var _0x36ed=function(_0x727f82,_0x29531d){_0x727f82=_0x727f82-0x0;var _0x324e51=_0x6ed3[_0x727f82];return _0x324e51;};'use strict';var _=require(_0x36ed('0x0'));var util=require(_0x36ed('0x1'));var logger=require(_0x36ed('0x2'))('api');var moment=require(_0x36ed('0x3'));var BPromise=require(_0x36ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36ed('0x5'));var rimraf=require(_0x36ed('0x6'));var config=require(_0x36ed('0x7'));var attributes=require(_0x36ed('0x8'));module[_0x36ed('0x9')]=function(_0x81c5cd,_0xd86b44){return _0x81c5cd['define'](_0x36ed('0xa'),attributes,{'tableName':_0x36ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 3355f62..cb7ff0c 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2a5=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x3bd4c9,_0x20e73e){var _0xabb7c8=function(_0x55e4d0){while(--_0x55e4d0){_0x3bd4c9['push'](_0x3bd4c9['shift']());}};_0xabb7c8(++_0x20e73e);}(_0xb2a5,0x17d));var _0x5b2a=function(_0x277168,_0x4bca19){_0x277168=_0x277168-0x0;var _0x1d2728=_0xb2a5[_0x277168];return _0x1d2728;};'use strict';var _=require(_0x5b2a('0x0'));var util=require(_0x5b2a('0x1'));var moment=require(_0x5b2a('0x2'));var BPromise=require(_0x5b2a('0x3'));var rs=require(_0x5b2a('0x4'));var fs=require('fs');var Redis=require(_0x5b2a('0x5'));var db=require(_0x5b2a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b2a('0x7'))(_0x5b2a('0x8'));var config=require(_0x5b2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5b2a('0xa')][_0x5b2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4177ea,_0x505690,_0x34790f){return new BPromise(function(_0x48f96e,_0xfe9f9e){return client[_0x5b2a('0xc')](_0x4177ea,_0x34790f)[_0x5b2a('0xd')](function(_0xe9ffcf){logger[_0x5b2a('0xe')](_0x5b2a('0xf'),_0x505690,_0x5b2a('0x10'));logger[_0x5b2a('0x11')](_0x5b2a('0x12'),_0x505690,_0x5b2a('0x10'),JSON[_0x5b2a('0x13')](_0xe9ffcf));if(_0xe9ffcf[_0x5b2a('0x14')]){if(_0xe9ffcf[_0x5b2a('0x14')][_0x5b2a('0x15')]===0x1f4){logger[_0x5b2a('0x14')]('CmContactHasItem,\x20%s,\x20%s',_0x505690,_0xe9ffcf[_0x5b2a('0x14')][_0x5b2a('0x16')]);return _0xfe9f9e(_0xe9ffcf['error'][_0x5b2a('0x16')]);}logger[_0x5b2a('0x14')]('CmContactHasItem,\x20%s,\x20%s',_0x505690,_0xe9ffcf[_0x5b2a('0x14')][_0x5b2a('0x16')]);return _0x48f96e(_0xe9ffcf[_0x5b2a('0x14')][_0x5b2a('0x16')]);}else{logger[_0x5b2a('0xe')](_0x5b2a('0xf'),_0x505690,_0x5b2a('0x10'));_0x48f96e(_0xe9ffcf[_0x5b2a('0x17')]['message']);}})[_0x5b2a('0x18')](function(_0x154919){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x505690,_0x154919);_0xfe9f9e(_0x154919);});});} \ No newline at end of file +var _0x7093=['CmContactHasItem,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7093,0x1e7));var _0x3709=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7093[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3709('0x0'));var util=require(_0x3709('0x1'));var moment=require(_0x3709('0x2'));var BPromise=require(_0x3709('0x3'));var rs=require(_0x3709('0x4'));var fs=require('fs');var Redis=require(_0x3709('0x5'));var db=require(_0x3709('0x6'))['db'];var utils=require(_0x3709('0x7'));var logger=require(_0x3709('0x8'))(_0x3709('0x9'));var config=require(_0x3709('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3709('0xb')][_0x3709('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a6433,_0x22dc7b,_0x1376ff){return new BPromise(function(_0x3591ad,_0x31461a){return client['request'](_0x3a6433,_0x1376ff)['then'](function(_0x14226b){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x22dc7b,_0x3709('0xd'));logger['debug'](_0x3709('0xe'),_0x22dc7b,_0x3709('0xd'),JSON[_0x3709('0xf')](_0x14226b));if(_0x14226b[_0x3709('0x10')]){if(_0x14226b[_0x3709('0x10')][_0x3709('0x11')]===0x1f4){logger[_0x3709('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x22dc7b,_0x14226b[_0x3709('0x10')][_0x3709('0x12')]);return _0x31461a(_0x14226b[_0x3709('0x10')][_0x3709('0x12')]);}logger[_0x3709('0x10')](_0x3709('0x13'),_0x22dc7b,_0x14226b[_0x3709('0x10')]['message']);return _0x3591ad(_0x14226b[_0x3709('0x10')][_0x3709('0x12')]);}else{logger[_0x3709('0x14')](_0x3709('0x13'),_0x22dc7b,_0x3709('0xd'));_0x3591ad(_0x14226b[_0x3709('0x15')][_0x3709('0x12')]);}})['catch'](function(_0x3dc83d){logger[_0x3709('0x10')](_0x3709('0x13'),_0x22dc7b,_0x3dc83d);_0x31461a(_0x3dc83d);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 9d32b85..248141c 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10be=['./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0x10be,0x161));var _0xe10b=function(_0x22088d,_0x27deaa){_0x22088d=_0x22088d-0x0;var _0x1dab44=_0x10be[_0x22088d];return _0x1dab44;};'use strict';var multer=require(_0xe10b('0x0'));var util=require('util');var path=require(_0xe10b('0x1'));var timeout=require(_0xe10b('0x2'));var express=require('express');var router=express[_0xe10b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe10b('0x4'));var interaction=require(_0xe10b('0x5'));var config=require(_0xe10b('0x6'));var controller=require(_0xe10b('0x7'));router['get']('/',auth[_0xe10b('0x8')](),controller[_0xe10b('0x9')]);router[_0xe10b('0xa')](_0xe10b('0xb'),auth[_0xe10b('0x8')](),controller[_0xe10b('0xc')]);router[_0xe10b('0xd')]('/',auth[_0xe10b('0x8')](),controller['create']);router[_0xe10b('0xe')](_0xe10b('0xb'),auth[_0xe10b('0x8')](),controller[_0xe10b('0xf')]);router['delete'](_0xe10b('0xb'),auth[_0xe10b('0x8')](),controller[_0xe10b('0x10')]);module[_0xe10b('0x11')]=router; \ No newline at end of file +var _0x3266=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3266,0x6a));var _0x6326=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x3266[_0x1ebe90];return _0x447c82;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/:id',auth[_0x6326('0xa')](),controller['show']);router[_0x6326('0xd')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xf')](_0x6326('0x10'),auth['isAuthenticated'](),controller[_0x6326('0x11')]);router[_0x6326('0x12')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);module[_0x6326('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index adfd7fa..32d9e77 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 _0x8dfa=['ENUM','voice','sequelize','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse','values','isArray','stringify','BOOLEAN'];(function(_0x193ee5,_0x53ac79){var _0x21efd2=function(_0x5e255d){while(--_0x5e255d){_0x193ee5['push'](_0x193ee5['shift']());}};_0x21efd2(++_0x53ac79);}(_0x8dfa,0x178));var _0xa8df=function(_0x3d80ae,_0x115102){_0x3d80ae=_0x3d80ae-0x0;var _0x5be6cc=_0x8dfa[_0x3d80ae];return _0x5be6cc;};'use strict';var Sequelize=require(_0xa8df('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xa8df('0x1')],'get':function(_0xa757d5){return this[_0xa8df('0x2')](_0xa8df('0x3'));}},'alias':{'type':Sequelize[_0xa8df('0x4')],'allowNull':![],'set':function(_0x5e9075){this[_0xa8df('0x5')](_0xa8df('0x3'),_0x5e9075?_0x5e9075:this[_0xa8df('0x2')](_0xa8df('0x6')));}},'type':{'type':Sequelize[_0xa8df('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xa8df('0x7')](_0xa8df('0x8')),'get':function(){if(this[_0xa8df('0x2')]('type')===_0xa8df('0x9')){return JSON[_0xa8df('0xa')](this[_0xa8df('0x2')](_0xa8df('0xb')));}else{return this[_0xa8df('0x2')](_0xa8df('0xb'));}},'set':function(_0x48be9c){if(Array[_0xa8df('0xc')](_0x48be9c)){this[_0xa8df('0x5')](_0xa8df('0xb'),JSON[_0xa8df('0xd')](_0x48be9c));}else{this['setDataValue'](_0xa8df('0xb'),_0x48be9c);}}},'required':{'type':Sequelize[_0xa8df('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa8df('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa8df('0xf')](_0xa8df('0x10'))}}; \ No newline at end of file +var _0x512e=['lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize'];(function(_0x5e0bd4,_0xc02524){var _0xa5d074=function(_0x50b1fb){while(--_0x50b1fb){_0x5e0bd4['push'](_0x5e0bd4['shift']());}};_0xa5d074(++_0xc02524);}(_0x512e,0x117));var _0xe512=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x512e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe512('0x0'));var _=require(_0xe512('0x1'));module[_0xe512('0x2')]={'name':{'type':Sequelize[_0xe512('0x3')],'get':function(_0xce4f64){return this[_0xe512('0x4')](_0xe512('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4e7404){this[_0xe512('0x6')](_0xe512('0x5'),_0x4e7404?_0x4e7404:this[_0xe512('0x4')](_0xe512('0x7')));}},'type':{'type':Sequelize[_0xe512('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0xe512('0x9')](_0xe512('0xa')),'get':function(){if(this['getDataValue'](_0xe512('0xb'))===_0xe512('0xc')){return JSON[_0xe512('0xd')](this[_0xe512('0x4')](_0xe512('0xe')));}else{return this[_0xe512('0x4')](_0xe512('0xe'));}},'set':function(_0x19baca){if(Array[_0xe512('0xf')](_0x19baca)){this[_0xe512('0x6')](_0xe512('0xe'),JSON[_0xe512('0x10')](_0x19baca));}else{this['setDataValue'](_0xe512('0xe'),_0x19baca);}}},'required':{'type':Sequelize[_0xe512('0x11')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe512('0x11')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe512('0x12')](_0xe512('0x13'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 5601cc9..e8962ff 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 _0xec31=['reject','save','update','then','destroy','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','differenceBy','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','sequelize','create','Sequelize','TEXT','type','text','INTEGER','BOOLEAN','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0xec31,0x13a));var _0x1ec3=function(_0x2b2970,_0x2c72c1){_0x2b2970=_0x2b2970-0x0;var _0x981e4f=_0xec31[_0x2b2970];return _0x981e4f;};'use strict';var emlformat=require(_0x1ec3('0x0'));var rimraf=require(_0x1ec3('0x1'));var zipdir=require(_0x1ec3('0x2'));var jsonpatch=require(_0x1ec3('0x3'));var rp=require(_0x1ec3('0x4'));var moment=require('moment');var BPromise=require(_0x1ec3('0x5'));var Mustache=require(_0x1ec3('0x6'));var util=require(_0x1ec3('0x7'));var path=require(_0x1ec3('0x8'));var sox=require(_0x1ec3('0x9'));var csv=require(_0x1ec3('0xa'));var ejs=require(_0x1ec3('0xb'));var fs=require('fs');var fs_extra=require(_0x1ec3('0xc'));var _=require(_0x1ec3('0xd'));var squel=require('squel');var crypto=require(_0x1ec3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1ec3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1ec3('0x10'));var Redis=require('ioredis');var authService=require(_0x1ec3('0x11'));var qs=require(_0x1ec3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ec3('0x13'));var logger=require('../../config/logger')(_0x1ec3('0x14'));var utils=require(_0x1ec3('0x15'));var config=require(_0x1ec3('0x16'));var licenseUtil=require(_0x1ec3('0x17'));var db=require(_0x1ec3('0x18'))['db'];function respondWithStatusCode(_0x5ae83b,_0x4bd969){_0x4bd969=_0x4bd969||0xcc;return function(_0x32688a){if(_0x32688a){return _0x5ae83b[_0x1ec3('0x19')](_0x4bd969);}return _0x5ae83b[_0x1ec3('0x1a')](_0x4bd969)[_0x1ec3('0x1b')]();};}function respondWithResult(_0x4fa5be,_0xb0c5ea){_0xb0c5ea=_0xb0c5ea||0xc8;return function(_0x56d697){if(_0x56d697){return _0x4fa5be[_0x1ec3('0x1a')](_0xb0c5ea)['json'](_0x56d697);}};}function respondWithFilteredResult(_0x162ed1,_0x370afc){return function(_0x30f165){if(_0x30f165){var _0x4c1d9d=typeof _0x370afc[_0x1ec3('0x1c')]===_0x1ec3('0x1d')&&typeof _0x370afc['limit']===_0x1ec3('0x1d');var _0x332093=_0x30f165[_0x1ec3('0x1e')];var _0x1c6ac7=_0x4c1d9d?0x0:_0x370afc[_0x1ec3('0x1c')];var _0x56c6b6=_0x4c1d9d?_0x30f165[_0x1ec3('0x1e')]:_0x370afc[_0x1ec3('0x1c')]+_0x370afc[_0x1ec3('0x1f')];var _0x30b457;if(_0x56c6b6>=_0x332093){_0x56c6b6=_0x332093;_0x30b457=0xc8;}else{_0x30b457=0xce;}_0x162ed1[_0x1ec3('0x1a')](_0x30b457);return _0x162ed1['set'](_0x1ec3('0x20'),_0x1c6ac7+'-'+_0x56c6b6+'/'+_0x332093)['json'](_0x30f165);}return null;};}function patchUpdates(_0x1cfe6f){return function(_0x1b0c62){try{jsonpatch[_0x1ec3('0x21')](_0x1b0c62,_0x1cfe6f,!![]);}catch(_0x52d307){return BPromise[_0x1ec3('0x22')](_0x52d307);}return _0x1b0c62[_0x1ec3('0x23')]();};}function saveUpdates(_0x121727,_0x22ba6f){return function(_0x2b2021){if(_0x2b2021){return _0x2b2021[_0x1ec3('0x24')](_0x121727)[_0x1ec3('0x25')](function(_0x3a9487){return _0x3a9487;});}return null;};}function removeEntity(_0x5bb688,_0x3a2837){return function(_0x3c22ea){if(_0x3c22ea){return _0x3c22ea[_0x1ec3('0x26')]()[_0x1ec3('0x25')](function(){_0x5bb688[_0x1ec3('0x1a')](0xcc)[_0x1ec3('0x1b')]();});}};}function handleEntityNotFound(_0x19d642,_0x24eff6){return function(_0x363a24){if(!_0x363a24){_0x19d642[_0x1ec3('0x19')](0x194);}return _0x363a24;};}function handleError(_0x53b229,_0x232453){_0x232453=_0x232453||0x1f4;return function(_0x3d381d){logger['error'](_0x3d381d[_0x1ec3('0x27')]);if(_0x3d381d[_0x1ec3('0x28')]){delete _0x3d381d[_0x1ec3('0x28')];}_0x53b229[_0x1ec3('0x1a')](_0x232453)[_0x1ec3('0x29')](_0x3d381d);};}exports[_0x1ec3('0x2a')]=function(_0x4dff2a,_0x2a8f0d){var _0x396558={},_0x5e2c27={},_0x433df7={'count':0x0,'rows':[]};var _0x46d086=_[_0x1ec3('0x2b')](db[_0x1ec3('0x2c')][_0x1ec3('0x2d')],function(_0x52ead6){return{'name':_0x52ead6[_0x1ec3('0x2e')],'type':_0x52ead6['type'][_0x1ec3('0x2f')]};});_0x5e2c27['model']=_[_0x1ec3('0x30')](_['map'](_0x46d086,_0x1ec3('0x28')),[_0x1ec3('0x28')]);_0x5e2c27[_0x1ec3('0x31')]=_[_0x1ec3('0x32')](_0x4dff2a['query']);_0x5e2c27[_0x1ec3('0x33')]=_['intersection'](_0x5e2c27[_0x1ec3('0x34')],_0x5e2c27[_0x1ec3('0x31')]);_0x396558[_0x1ec3('0x35')]=_[_0x1ec3('0x36')](_0x5e2c27[_0x1ec3('0x34')],qs[_0x1ec3('0x37')](_0x4dff2a['query'][_0x1ec3('0x37')]));_0x396558[_0x1ec3('0x35')]=_0x396558[_0x1ec3('0x35')][_0x1ec3('0x38')]?_0x396558[_0x1ec3('0x35')]:_0x5e2c27[_0x1ec3('0x34')];if(!_0x4dff2a['query'][_0x1ec3('0x39')](_0x1ec3('0x3a'))){_0x396558[_0x1ec3('0x1f')]=qs['limit'](_0x4dff2a[_0x1ec3('0x31')][_0x1ec3('0x1f')]);_0x396558[_0x1ec3('0x1c')]=qs[_0x1ec3('0x1c')](_0x4dff2a[_0x1ec3('0x31')][_0x1ec3('0x1c')]);}_0x396558[_0x1ec3('0x3b')]=qs[_0x1ec3('0x3c')](_0x4dff2a[_0x1ec3('0x31')][_0x1ec3('0x3c')]);_0x396558[_0x1ec3('0x3d')]=qs['filters'](_[_0x1ec3('0x3e')](_0x4dff2a['query'],_0x5e2c27[_0x1ec3('0x33')]),_0x46d086);if(_0x4dff2a[_0x1ec3('0x31')][_0x1ec3('0x3f')]){_0x396558[_0x1ec3('0x3d')]=_[_0x1ec3('0x40')](_0x396558[_0x1ec3('0x3d')],{'$or':_[_0x1ec3('0x2b')](_0x46d086,function(_0x55459d){if(_0x55459d['type']!==_0x1ec3('0x41')){var _0x10eb8e={};_0x10eb8e[_0x55459d[_0x1ec3('0x28')]]={'$like':'%'+_0x4dff2a[_0x1ec3('0x31')][_0x1ec3('0x3f')]+'%'};return _0x10eb8e;}})});}_0x396558=_[_0x1ec3('0x40')]({},_0x396558,_0x4dff2a[_0x1ec3('0x42')]);var _0x5dd546={'where':_0x396558[_0x1ec3('0x3d')]};return db[_0x1ec3('0x2c')][_0x1ec3('0x1e')](_0x5dd546)[_0x1ec3('0x25')](function(_0x241257){_0x433df7[_0x1ec3('0x1e')]=_0x241257;if(_0x4dff2a[_0x1ec3('0x31')][_0x1ec3('0x43')]){_0x396558[_0x1ec3('0x44')]=[{'all':!![]}];}return db[_0x1ec3('0x2c')][_0x1ec3('0x45')](_0x396558);})[_0x1ec3('0x25')](function(_0x319085){_0x433df7[_0x1ec3('0x46')]=_0x319085;return _0x433df7;})['then'](respondWithFilteredResult(_0x2a8f0d,_0x396558))[_0x1ec3('0x47')](handleError(_0x2a8f0d,null));};exports[_0x1ec3('0x48')]=function(_0x48c580,_0x1c63ee){var _0x4924d3={'raw':!![],'where':{'id':_0x48c580[_0x1ec3('0x49')]['id']}},_0x5629c4={};_0x5629c4[_0x1ec3('0x34')]=_['keys'](db['CmCustomField'][_0x1ec3('0x2d')]);_0x5629c4[_0x1ec3('0x31')]=_[_0x1ec3('0x32')](_0x48c580[_0x1ec3('0x31')]);_0x5629c4[_0x1ec3('0x33')]=_[_0x1ec3('0x36')](_0x5629c4['model'],_0x5629c4[_0x1ec3('0x31')]);_0x4924d3[_0x1ec3('0x35')]=_[_0x1ec3('0x36')](_0x5629c4[_0x1ec3('0x34')],qs[_0x1ec3('0x37')](_0x48c580['query'][_0x1ec3('0x37')]));_0x4924d3['attributes']=_0x4924d3[_0x1ec3('0x35')][_0x1ec3('0x38')]?_0x4924d3[_0x1ec3('0x35')]:_0x5629c4[_0x1ec3('0x34')];if(_0x48c580[_0x1ec3('0x31')]['includeAll']){_0x4924d3[_0x1ec3('0x44')]=[{'all':!![]}];}_0x4924d3=_[_0x1ec3('0x40')]({},_0x4924d3,_0x48c580[_0x1ec3('0x42')]);return db['CmCustomField'][_0x1ec3('0x4a')](_0x4924d3)[_0x1ec3('0x25')](handleEntityNotFound(_0x1c63ee,null))['then'](respondWithResult(_0x1c63ee,null))[_0x1ec3('0x47')](handleError(_0x1c63ee,null));};exports[_0x1ec3('0x24')]=function(_0x5e9d68,_0x1d6552){if(_0x5e9d68[_0x1ec3('0x4b')]['id']){delete _0x5e9d68['body']['id'];}return db[_0x1ec3('0x2c')][_0x1ec3('0x4a')]({'where':{'id':_0x5e9d68[_0x1ec3('0x49')]['id']}})[_0x1ec3('0x25')](handleEntityNotFound(_0x1d6552,null))[_0x1ec3('0x25')](saveUpdates(_0x5e9d68[_0x1ec3('0x4b')],null))[_0x1ec3('0x25')](respondWithResult(_0x1d6552,null))[_0x1ec3('0x47')](handleError(_0x1d6552,null));};exports[_0x1ec3('0x26')]=function(_0x306534,_0x4e02d5){return db[_0x1ec3('0x2c')][_0x1ec3('0x4a')]({'where':{'id':_0x306534['params']['id']}})[_0x1ec3('0x25')](handleEntityNotFound(_0x4e02d5,null))[_0x1ec3('0x25')](removeEntity(_0x4e02d5,null))[_0x1ec3('0x47')](handleError(_0x4e02d5,null));};exports['create']=function(_0x408c41,_0x428583){var _0x38884c;return db[_0x1ec3('0x4c')]['transaction'](function(_0x46feb7){return db[_0x1ec3('0x2c')][_0x1ec3('0x4d')](_0x408c41[_0x1ec3('0x4b')],{'transaction':_0x46feb7})[_0x1ec3('0x25')](function(_0x587618){_0x38884c=_0x587618;var _0x33d9ff={'type':db[_0x1ec3('0x4e')][_0x1ec3('0x4f')],'transaction':_0x46feb7};switch(_0x408c41[_0x1ec3('0x4b')][_0x1ec3('0x50')]){case _0x1ec3('0x51'):_0x33d9ff[_0x1ec3('0x50')]=db[_0x1ec3('0x4e')][_0x1ec3('0x4f')];break;case'number':_0x33d9ff[_0x1ec3('0x50')]=db[_0x1ec3('0x4e')][_0x1ec3('0x52')];break;case'switch':_0x33d9ff['type']=db[_0x1ec3('0x4e')][_0x1ec3('0x53')];_0x33d9ff['defaultValue']=![];break;default:}return db[_0x1ec3('0x4c')]['queryInterface'][_0x1ec3('0x54')](_0x1ec3('0x55'),util['format'](_0x1ec3('0x56'),_0x38884c['id']),_0x33d9ff);})['then'](function(){return _0x38884c;});})[_0x1ec3('0x25')](respondWithResult(_0x428583,0xc9))[_0x1ec3('0x47')](handleError(_0x428583,null));}; \ No newline at end of file +var _0x1d13=['fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','send','index','CmCustomField','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','then','includeAll','include','findAll','rows','catch','rawAttributes','options','find','update','body','params','create','transaction','Sequelize','TEXT','switch','defaultValue','sequelize','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir'];(function(_0x2ab745,_0x291aea){var _0x997b3d=function(_0x14196b){while(--_0x14196b){_0x2ab745['push'](_0x2ab745['shift']());}};_0x997b3d(++_0x291aea);}(_0x1d13,0xa9));var _0x31d1=function(_0x512403,_0xc40e71){_0x512403=_0x512403-0x0;var _0x1b6a12=_0x1d13[_0x512403];return _0x1b6a12;};'use strict';var emlformat=require(_0x31d1('0x0'));var rimraf=require(_0x31d1('0x1'));var zipdir=require(_0x31d1('0x2'));var jsonpatch=require(_0x31d1('0x3'));var rp=require(_0x31d1('0x4'));var moment=require(_0x31d1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31d1('0x6'));var util=require(_0x31d1('0x7'));var path=require(_0x31d1('0x8'));var sox=require(_0x31d1('0x9'));var csv=require('to-csv');var ejs=require(_0x31d1('0xa'));var fs=require('fs');var fs_extra=require(_0x31d1('0xb'));var _=require(_0x31d1('0xc'));var squel=require(_0x31d1('0xd'));var crypto=require('crypto');var jsforce=require(_0x31d1('0xe'));var deskjs=require(_0x31d1('0xf'));var toCsv=require(_0x31d1('0x10'));var querystring=require(_0x31d1('0x11'));var Papa=require(_0x31d1('0x12'));var Redis=require(_0x31d1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x31d1('0x14'));var as=require(_0x31d1('0x15'));var hardwareService=require(_0x31d1('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x31d1('0x17'));var licenseUtil=require(_0x31d1('0x18'));var db=require(_0x31d1('0x19'))['db'];function respondWithStatusCode(_0x32a913,_0x2079cc){_0x2079cc=_0x2079cc||0xcc;return function(_0x46eda3){if(_0x46eda3){return _0x32a913[_0x31d1('0x1a')](_0x2079cc);}return _0x32a913[_0x31d1('0x1b')](_0x2079cc)[_0x31d1('0x1c')]();};}function respondWithResult(_0x6f4ba2,_0xc3a9c3){_0xc3a9c3=_0xc3a9c3||0xc8;return function(_0x2eb0fb){if(_0x2eb0fb){return _0x6f4ba2[_0x31d1('0x1b')](_0xc3a9c3)[_0x31d1('0x1d')](_0x2eb0fb);}};}function respondWithFilteredResult(_0x5eb2f7,_0x510dee){return function(_0x2cecdc){if(_0x2cecdc){var _0x31bad3=typeof _0x510dee[_0x31d1('0x1e')]===_0x31d1('0x1f')&&typeof _0x510dee[_0x31d1('0x20')]===_0x31d1('0x1f');var _0x57d6f4=_0x2cecdc['count'];var _0x4b1c09=_0x31bad3?0x0:_0x510dee['offset'];var _0x524081=_0x31bad3?_0x2cecdc[_0x31d1('0x21')]:_0x510dee[_0x31d1('0x1e')]+_0x510dee[_0x31d1('0x20')];var _0x33683a;if(_0x524081>=_0x57d6f4){_0x524081=_0x57d6f4;_0x33683a=0xc8;}else{_0x33683a=0xce;}_0x5eb2f7['status'](_0x33683a);return _0x5eb2f7[_0x31d1('0x22')](_0x31d1('0x23'),_0x4b1c09+'-'+_0x524081+'/'+_0x57d6f4)[_0x31d1('0x1d')](_0x2cecdc);}return null;};}function patchUpdates(_0x1f6ec9){return function(_0x4581f4){try{jsonpatch['apply'](_0x4581f4,_0x1f6ec9,!![]);}catch(_0xe979ac){return BPromise[_0x31d1('0x24')](_0xe979ac);}return _0x4581f4[_0x31d1('0x25')]();};}function saveUpdates(_0x139215,_0x3a4fb2){return function(_0x280127){if(_0x280127){return _0x280127['update'](_0x139215)['then'](function(_0x17c199){return _0x17c199;});}return null;};}function removeEntity(_0x6d2272,_0x5f21b6){return function(_0x2e3ce5){if(_0x2e3ce5){return _0x2e3ce5[_0x31d1('0x26')]()['then'](function(){_0x6d2272[_0x31d1('0x1b')](0xcc)[_0x31d1('0x1c')]();});}};}function handleEntityNotFound(_0x56913a,_0xf9b90e){return function(_0xa7824c){if(!_0xa7824c){_0x56913a[_0x31d1('0x1a')](0x194);}return _0xa7824c;};}function handleError(_0x1c5df5,_0x3d7f77){_0x3d7f77=_0x3d7f77||0x1f4;return function(_0x13b27f){logger['error'](_0x13b27f[_0x31d1('0x27')]);if(_0x13b27f['name']){delete _0x13b27f[_0x31d1('0x28')];}_0x1c5df5[_0x31d1('0x1b')](_0x3d7f77)[_0x31d1('0x29')](_0x13b27f);};}exports[_0x31d1('0x2a')]=function(_0x4cd809,_0x491056){var _0x371cbb={},_0x17d026={},_0x1dfe7c={'count':0x0,'rows':[]};var _0x38c1da=_['map'](db[_0x31d1('0x2b')]['rawAttributes'],function(_0xbedb7d){return{'name':_0xbedb7d[_0x31d1('0x2c')],'type':_0xbedb7d['type']['key']};});_0x17d026['model']=_['differenceBy'](_[_0x31d1('0x2d')](_0x38c1da,_0x31d1('0x28')),[_0x31d1('0x28')]);_0x17d026[_0x31d1('0x2e')]=_[_0x31d1('0x2f')](_0x4cd809['query']);_0x17d026[_0x31d1('0x30')]=_[_0x31d1('0x31')](_0x17d026[_0x31d1('0x32')],_0x17d026[_0x31d1('0x2e')]);_0x371cbb[_0x31d1('0x33')]=_[_0x31d1('0x31')](_0x17d026[_0x31d1('0x32')],qs[_0x31d1('0x34')](_0x4cd809[_0x31d1('0x2e')][_0x31d1('0x34')]));_0x371cbb[_0x31d1('0x33')]=_0x371cbb[_0x31d1('0x33')][_0x31d1('0x35')]?_0x371cbb[_0x31d1('0x33')]:_0x17d026[_0x31d1('0x32')];if(!_0x4cd809[_0x31d1('0x2e')][_0x31d1('0x36')]('nolimit')){_0x371cbb[_0x31d1('0x20')]=qs[_0x31d1('0x20')](_0x4cd809[_0x31d1('0x2e')][_0x31d1('0x20')]);_0x371cbb[_0x31d1('0x1e')]=qs[_0x31d1('0x1e')](_0x4cd809['query'][_0x31d1('0x1e')]);}_0x371cbb[_0x31d1('0x37')]=qs[_0x31d1('0x38')](_0x4cd809['query'][_0x31d1('0x38')]);_0x371cbb['where']=qs[_0x31d1('0x30')](_[_0x31d1('0x39')](_0x4cd809[_0x31d1('0x2e')],_0x17d026['filters']),_0x38c1da);if(_0x4cd809[_0x31d1('0x2e')][_0x31d1('0x3a')]){_0x371cbb[_0x31d1('0x3b')]=_['merge'](_0x371cbb['where'],{'$or':_['map'](_0x38c1da,function(_0x825f0f){if(_0x825f0f[_0x31d1('0x3c')]!==_0x31d1('0x3d')){var _0x15f5f7={};_0x15f5f7[_0x825f0f[_0x31d1('0x28')]]={'$like':'%'+_0x4cd809[_0x31d1('0x2e')][_0x31d1('0x3a')]+'%'};return _0x15f5f7;}})});}_0x371cbb=_[_0x31d1('0x3e')]({},_0x371cbb,_0x4cd809['options']);var _0x87c62f={'where':_0x371cbb[_0x31d1('0x3b')]};return db[_0x31d1('0x2b')][_0x31d1('0x21')](_0x87c62f)[_0x31d1('0x3f')](function(_0x46c115){_0x1dfe7c[_0x31d1('0x21')]=_0x46c115;if(_0x4cd809['query'][_0x31d1('0x40')]){_0x371cbb[_0x31d1('0x41')]=[{'all':!![]}];}return db['CmCustomField'][_0x31d1('0x42')](_0x371cbb);})[_0x31d1('0x3f')](function(_0x522067){_0x1dfe7c[_0x31d1('0x43')]=_0x522067;return _0x1dfe7c;})[_0x31d1('0x3f')](respondWithFilteredResult(_0x491056,_0x371cbb))[_0x31d1('0x44')](handleError(_0x491056,null));};exports['show']=function(_0xf9ab9,_0xa9d4f4){var _0x2e6485={'raw':!![],'where':{'id':_0xf9ab9['params']['id']}},_0x335a1c={};_0x335a1c[_0x31d1('0x32')]=_[_0x31d1('0x2f')](db[_0x31d1('0x2b')][_0x31d1('0x45')]);_0x335a1c[_0x31d1('0x2e')]=_['keys'](_0xf9ab9['query']);_0x335a1c[_0x31d1('0x30')]=_[_0x31d1('0x31')](_0x335a1c[_0x31d1('0x32')],_0x335a1c[_0x31d1('0x2e')]);_0x2e6485[_0x31d1('0x33')]=_[_0x31d1('0x31')](_0x335a1c[_0x31d1('0x32')],qs[_0x31d1('0x34')](_0xf9ab9[_0x31d1('0x2e')][_0x31d1('0x34')]));_0x2e6485[_0x31d1('0x33')]=_0x2e6485[_0x31d1('0x33')][_0x31d1('0x35')]?_0x2e6485['attributes']:_0x335a1c[_0x31d1('0x32')];if(_0xf9ab9[_0x31d1('0x2e')][_0x31d1('0x40')]){_0x2e6485['include']=[{'all':!![]}];}_0x2e6485=_['merge']({},_0x2e6485,_0xf9ab9[_0x31d1('0x46')]);return db['CmCustomField'][_0x31d1('0x47')](_0x2e6485)[_0x31d1('0x3f')](handleEntityNotFound(_0xa9d4f4,null))['then'](respondWithResult(_0xa9d4f4,null))[_0x31d1('0x44')](handleError(_0xa9d4f4,null));};exports[_0x31d1('0x48')]=function(_0x1d022d,_0x23f13b){if(_0x1d022d[_0x31d1('0x49')]['id']){delete _0x1d022d[_0x31d1('0x49')]['id'];}return db[_0x31d1('0x2b')][_0x31d1('0x47')]({'where':{'id':_0x1d022d[_0x31d1('0x4a')]['id']}})[_0x31d1('0x3f')](handleEntityNotFound(_0x23f13b,null))[_0x31d1('0x3f')](saveUpdates(_0x1d022d[_0x31d1('0x49')],null))['then'](respondWithResult(_0x23f13b,null))[_0x31d1('0x44')](handleError(_0x23f13b,null));};exports[_0x31d1('0x26')]=function(_0x283419,_0x36b39e){return db[_0x31d1('0x2b')][_0x31d1('0x47')]({'where':{'id':_0x283419[_0x31d1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x36b39e,null))[_0x31d1('0x3f')](removeEntity(_0x36b39e,null))[_0x31d1('0x44')](handleError(_0x36b39e,null));};exports[_0x31d1('0x4b')]=function(_0x38cdeb,_0x28cf1a){var _0x11e736;return db['sequelize'][_0x31d1('0x4c')](function(_0x5639d8){return db['CmCustomField']['create'](_0x38cdeb[_0x31d1('0x49')],{'transaction':_0x5639d8})[_0x31d1('0x3f')](function(_0x52c8b7){_0x11e736=_0x52c8b7;var _0x16a169={'type':db[_0x31d1('0x4d')][_0x31d1('0x4e')],'transaction':_0x5639d8};switch(_0x38cdeb['body']['type']){case'text':_0x16a169[_0x31d1('0x3c')]=db['Sequelize'][_0x31d1('0x4e')];break;case'number':_0x16a169[_0x31d1('0x3c')]=db[_0x31d1('0x4d')]['INTEGER'];break;case _0x31d1('0x4f'):_0x16a169[_0x31d1('0x3c')]=db['Sequelize']['BOOLEAN'];_0x16a169[_0x31d1('0x50')]=![];break;default:}return db[_0x31d1('0x51')][_0x31d1('0x52')]['addColumn'](_0x31d1('0x53'),util[_0x31d1('0x54')](_0x31d1('0x55'),_0x11e736['id']),_0x16a169);})[_0x31d1('0x3f')](function(){return _0x11e736;});})[_0x31d1('0x3f')](respondWithResult(_0x28cf1a,0xc9))[_0x31d1('0x44')](handleError(_0x28cf1a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 118301e..1f01c1f 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 _0x2aab=['CmCustomField','cm_custom_fields','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x2aab,0x9b));var _0xb2aa=function(_0x16c718,_0x48f569){_0x16c718=_0x16c718-0x0;var _0x40ac1e=_0x2aab[_0x16c718];return _0x40ac1e;};'use strict';var _=require('lodash');var util=require(_0xb2aa('0x0'));var logger=require(_0xb2aa('0x1'))('api');var moment=require(_0xb2aa('0x2'));var BPromise=require('bluebird');var rp=require(_0xb2aa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2aa('0x4'));var config=require(_0xb2aa('0x5'));var attributes=require('./cmCustomField.attributes');module[_0xb2aa('0x6')]=function(_0x4df788,_0x2aba39){return _0x4df788['define'](_0xb2aa('0x7'),attributes,{'tableName':_0xb2aa('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dd5=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields'];(function(_0x30fd92,_0x189af4){var _0x593db6=function(_0x52f823){while(--_0x52f823){_0x30fd92['push'](_0x30fd92['shift']());}};_0x593db6(++_0x189af4);}(_0x3dd5,0x1d4));var _0x53dd=function(_0x4f98be,_0x10663b){_0x4f98be=_0x4f98be-0x0;var _0x44a29c=_0x3dd5[_0x4f98be];return _0x44a29c;};'use strict';var _=require(_0x53dd('0x0'));var util=require(_0x53dd('0x1'));var logger=require(_0x53dd('0x2'))(_0x53dd('0x3'));var moment=require(_0x53dd('0x4'));var BPromise=require(_0x53dd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x53dd('0x6'));var config=require(_0x53dd('0x7'));var attributes=require(_0x53dd('0x8'));module[_0x53dd('0x9')]=function(_0x1da4c6,_0x4554d2){return _0x1da4c6[_0x53dd('0xa')](_0x53dd('0xb'),attributes,{'tableName':_0x53dd('0xc'),'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 e09f4ca..ecdafe0 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 _0xcebc=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmCustomField,\x20%s,\x20%s'];(function(_0x12a62c,_0xc9c41a){var _0x268a58=function(_0x100ca9){while(--_0x100ca9){_0x12a62c['push'](_0x12a62c['shift']());}};_0x268a58(++_0xc9c41a);}(_0xcebc,0x1d1));var _0xcceb=function(_0x5f2c1b,_0xe31495){_0x5f2c1b=_0x5f2c1b-0x0;var _0x583324=_0xcebc[_0x5f2c1b];return _0x583324;};'use strict';var _=require(_0xcceb('0x0'));var util=require('util');var moment=require(_0xcceb('0x1'));var BPromise=require(_0xcceb('0x2'));var rs=require(_0xcceb('0x3'));var fs=require('fs');var Redis=require(_0xcceb('0x4'));var db=require(_0xcceb('0x5'))['db'];var utils=require(_0xcceb('0x6'));var logger=require(_0xcceb('0x7'))(_0xcceb('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcceb('0x9')][_0xcceb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12537a,_0x294267,_0x4994cb){return new BPromise(function(_0x47403b,_0x22dc31){return client[_0xcceb('0xb')](_0x12537a,_0x4994cb)[_0xcceb('0xc')](function(_0x11ef17){logger[_0xcceb('0xd')](_0xcceb('0xe'),_0x294267,_0xcceb('0xf'));logger[_0xcceb('0x10')](_0xcceb('0x11'),_0x294267,_0xcceb('0xf'),JSON[_0xcceb('0x12')](_0x11ef17));if(_0x11ef17[_0xcceb('0x13')]){if(_0x11ef17[_0xcceb('0x13')][_0xcceb('0x14')]===0x1f4){logger[_0xcceb('0x13')](_0xcceb('0xe'),_0x294267,_0x11ef17[_0xcceb('0x13')][_0xcceb('0x15')]);return _0x22dc31(_0x11ef17[_0xcceb('0x13')][_0xcceb('0x15')]);}logger[_0xcceb('0x13')](_0xcceb('0xe'),_0x294267,_0x11ef17[_0xcceb('0x13')][_0xcceb('0x15')]);return _0x47403b(_0x11ef17['error'][_0xcceb('0x15')]);}else{logger['info'](_0xcceb('0xe'),_0x294267,_0xcceb('0xf'));_0x47403b(_0x11ef17[_0xcceb('0x16')][_0xcceb('0x15')]);}})[_0xcceb('0x17')](function(_0x24bb2b){logger['error']('CmCustomField,\x20%s,\x20%s',_0x294267,_0x24bb2b);_0x22dc31(_0x24bb2b);});});} \ No newline at end of file +var _0x09d1=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','code','CmCustomField,\x20%s,\x20%s','error','message','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug'];(function(_0x19c76f,_0x1272ee){var _0x4e33fb=function(_0x4d0632){while(--_0x4d0632){_0x19c76f['push'](_0x19c76f['shift']());}};_0x4e33fb(++_0x1272ee);}(_0x09d1,0xba));var _0x109d=function(_0x305272,_0x19a527){_0x305272=_0x305272-0x0;var _0x43fdf1=_0x09d1[_0x305272];return _0x43fdf1;};'use strict';var _=require(_0x109d('0x0'));var util=require(_0x109d('0x1'));var moment=require('moment');var BPromise=require(_0x109d('0x2'));var rs=require(_0x109d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x109d('0x4'));var logger=require(_0x109d('0x5'))(_0x109d('0x6'));var config=require(_0x109d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x109d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2eb7f2,_0x2a2a41,_0x1234ae){return new BPromise(function(_0x235202,_0x3b066e){return client[_0x109d('0x9')](_0x2eb7f2,_0x1234ae)[_0x109d('0xa')](function(_0x26e8a2){logger[_0x109d('0xb')]('CmCustomField,\x20%s,\x20%s',_0x2a2a41,_0x109d('0xc'));logger[_0x109d('0xd')](_0x109d('0xe'),_0x2a2a41,_0x109d('0xc'),JSON[_0x109d('0xf')](_0x26e8a2));if(_0x26e8a2['error']){if(_0x26e8a2['error'][_0x109d('0x10')]===0x1f4){logger['error'](_0x109d('0x11'),_0x2a2a41,_0x26e8a2[_0x109d('0x12')][_0x109d('0x13')]);return _0x3b066e(_0x26e8a2[_0x109d('0x12')]['message']);}logger[_0x109d('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2a2a41,_0x26e8a2['error'][_0x109d('0x13')]);return _0x235202(_0x26e8a2[_0x109d('0x12')][_0x109d('0x13')]);}else{logger[_0x109d('0xb')](_0x109d('0x11'),_0x2a2a41,_0x109d('0xc'));_0x235202(_0x26e8a2['result'][_0x109d('0x13')]);}})['catch'](function(_0x1ddda5){logger[_0x109d('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2a2a41,_0x1ddda5);_0x3b066e(_0x1ddda5);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index c56c958..704045c 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 _0x0560=['put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x103486,_0x58a5c7){var _0x53510f=function(_0xdc8141){while(--_0xdc8141){_0x103486['push'](_0x103486['shift']());}};_0x53510f(++_0x58a5c7);}(_0x0560,0x95));var _0x0056=function(_0x45a1db,_0x3e605d){_0x45a1db=_0x45a1db-0x0;var _0x26b684=_0x0560[_0x45a1db];return _0x26b684;};'use strict';var multer=require(_0x0056('0x0'));var util=require('util');var path=require(_0x0056('0x1'));var timeout=require(_0x0056('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0056('0x3'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x0056('0x4')]('/',auth[_0x0056('0x5')](),controller[_0x0056('0x6')]);router['get'](_0x0056('0x7'),auth[_0x0056('0x5')](),controller[_0x0056('0x8')]);router[_0x0056('0x9')]('/',auth['isAuthenticated'](),controller[_0x0056('0xa')]);router[_0x0056('0xb')](_0x0056('0x7'),auth[_0x0056('0x5')](),controller[_0x0056('0xc')]);router[_0x0056('0xd')]('/:id',auth[_0x0056('0x5')](),controller[_0x0056('0xe')]);module[_0x0056('0xf')]=router; \ No newline at end of file +var _0x58dc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','post','create','put','/:id','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x58dc,0x199));var _0xc58d=function(_0x4d8242,_0x39a36b){_0x4d8242=_0x4d8242-0x0;var _0x34e0b8=_0x58dc[_0x4d8242];return _0x34e0b8;};'use strict';var multer=require(_0xc58d('0x0'));var util=require(_0xc58d('0x1'));var path=require('path');var timeout=require(_0xc58d('0x2'));var express=require(_0xc58d('0x3'));var router=express[_0xc58d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc58d('0x5'));var interaction=require(_0xc58d('0x6'));var config=require(_0xc58d('0x7'));var controller=require(_0xc58d('0x8'));router[_0xc58d('0x9')]('/',auth[_0xc58d('0xa')](),controller[_0xc58d('0xb')]);router[_0xc58d('0x9')]('/:id',auth[_0xc58d('0xa')](),controller['show']);router[_0xc58d('0xc')]('/',auth[_0xc58d('0xa')](),controller[_0xc58d('0xd')]);router[_0xc58d('0xe')](_0xc58d('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xc58d('0x10')]('/:id',auth[_0xc58d('0xa')](),controller['destroy']);module[_0xc58d('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 c134556..1caf495 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 _0x3be7=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','contactListQueue','moment','sequelize'];(function(_0x48712d,_0x45b31b){var _0x44c0d6=function(_0x2f7519){while(--_0x2f7519){_0x48712d['push'](_0x48712d['shift']());}};_0x44c0d6(++_0x45b31b);}(_0x3be7,0x148));var _0x73be=function(_0x527df0,_0x559d5b){_0x527df0=_0x527df0-0x0;var _0x46e6ad=_0x3be7[_0x527df0];return _0x46e6ad;};'use strict';var moment=require(_0x73be('0x0'));var Sequelize=require(_0x73be('0x1'));module[_0x73be('0x2')]={'phone':{'type':Sequelize[_0x73be('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x73be('0x4')],'defaultValue':moment()[_0x73be('0x5')](_0x73be('0x6'))},'countbusyretry':{'type':Sequelize[_0x73be('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x73be('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x73be('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x73be('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x73be('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x73be('0x4')]},'priority':{'type':Sequelize[_0x73be('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x73be('0x7')],'unique':_0x73be('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x73be('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x73be('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x73be('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x73be('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x73be('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x73be('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x73be('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x73be('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xfb76=['moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0x1c1c28,_0x57c558){var _0x313a0a=function(_0x44d4f7){while(--_0x44d4f7){_0x1c1c28['push'](_0x1c1c28['shift']());}};_0x313a0a(++_0x57c558);}(_0xfb76,0x168));var _0x6fb7=function(_0x43be49,_0x54ff19){_0x43be49=_0x43be49-0x0;var _0x307e70=_0xfb76[_0x43be49];return _0x307e70;};'use strict';var moment=require(_0x6fb7('0x0'));var Sequelize=require(_0x6fb7('0x1'));module[_0x6fb7('0x2')]={'phone':{'type':Sequelize[_0x6fb7('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x6fb7('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6fb7('0x5')],'defaultValue':moment()['format'](_0x6fb7('0x6'))},'countbusyretry':{'type':Sequelize[_0x6fb7('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6fb7('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6fb7('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6fb7('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6fb7('0x5')]},'priority':{'type':Sequelize[_0x6fb7('0x7')](0x2)[_0x6fb7('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6fb7('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x6fb7('0x7')],'unique':_0x6fb7('0x9')},'UserId':{'type':Sequelize[_0x6fb7('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6fb7('0x9')},'CampaignId':{'type':Sequelize[_0x6fb7('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6fb7('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6fb7('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6fb7('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6fb7('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6fb7('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 5033cc2..145d517 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 _0x6f47=['VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ContactId','isNil','firstName','calleridname','lastName','CmHopperFinal','create','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','body','direction','prev','isEmpty','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','Contact','CmCompany','Company','List','dialActive','getPreviewRecall','CmContact','CmList','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','getTimezone','lodash','../../components/parsers/qs','api','../../mysqldb','status','json','undefined','limit','count','set','Content-Range','update','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','concat','$and','$or','$lt','$ne','$notBetween','$in','$notIn','$like','$notLike','$iLike','$any','attributes','intersection','length','nolimit','offset','order','sort','filter','where','VIRTUAL','merge','options','then','includeAll','include','show','params','fields','find','catch','describe','destroy','VoiceQueueId'];(function(_0x19e1e8,_0x150698){var _0x21fc2c=function(_0x55facc){while(--_0x55facc){_0x19e1e8['push'](_0x19e1e8['shift']());}};_0x21fc2c(++_0x150698);}(_0x6f47,0xc7));var _0x76f4=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x6f47[_0x9fd887];return _0x1a54ab;};'use strict';var moment=require('moment');var _=require(_0x76f4('0x0'));var qs=require(_0x76f4('0x1'));var logger=require('../../config/logger')(_0x76f4('0x2'));var shared=require('../../config/environment');var db=require(_0x76f4('0x3'))['db'];function respondWithResult(_0x47d3e1,_0xe214ad){_0xe214ad=_0xe214ad||0xc8;return function(_0xc5dddc){if(_0xc5dddc){return _0x47d3e1[_0x76f4('0x4')](_0xe214ad)[_0x76f4('0x5')](_0xc5dddc);}};}function respondWithFilteredResult(_0x5754ca,_0x35602f){return function(_0xfc2405){if(_0xfc2405){var _0x2176a7=typeof _0x35602f['offset']===_0x76f4('0x6')&&typeof _0x35602f[_0x76f4('0x7')]===_0x76f4('0x6');var _0xf9b468=_0xfc2405[_0x76f4('0x8')];var _0x4c6b5c=_0x2176a7?0x0:_0x35602f['offset'];var _0x3347ef=_0x2176a7?_0xfc2405[_0x76f4('0x8')]:_0x35602f['offset']+_0x35602f['limit'];var _0x3d8554;if(_0x3347ef>=_0xf9b468){_0x3347ef=_0xf9b468;_0x3d8554=0xc8;}else{_0x3d8554=0xce;}_0x5754ca[_0x76f4('0x4')](_0x3d8554);return _0x5754ca[_0x76f4('0x9')](_0x76f4('0xa'),_0x4c6b5c+'-'+_0x3347ef+'/'+_0xf9b468)[_0x76f4('0x5')](_0xfc2405);}return null;};}function saveUpdates(_0xafd21e,_0xf7e347){return function(_0x3ec740){if(_0x3ec740){return _0x3ec740[_0x76f4('0xb')](_0xafd21e)['then'](function(_0x41ba00){return _0x41ba00;});}return null;};}function handleEntityNotFound(_0x30dabf,_0x5da1ff){return function(_0x4b6021){if(!_0x4b6021){_0x30dabf['sendStatus'](0x194);}return _0x4b6021;};}function handleError(_0x1d7755,_0x3dd240){_0x3dd240=_0x3dd240||0x1f4;return function(_0x979946){logger[_0x76f4('0xc')](_0x979946[_0x76f4('0xd')]);if(_0x979946[_0x76f4('0xe')]){delete _0x979946[_0x76f4('0xe')];}_0x1d7755[_0x76f4('0x4')](_0x3dd240)[_0x76f4('0xf')](_0x979946);};}exports[_0x76f4('0x10')]=function(_0x672960,_0x2d4bd1){var _0x214bef={},_0x38450e={},_0x17625e={'count':0x0,'rows':[]};var _0x397360=_[_0x76f4('0x11')](db[_0x76f4('0x12')][_0x76f4('0x13')],function(_0x35b406){return{'name':_0x35b406[_0x76f4('0x14')],'type':_0x35b406[_0x76f4('0x15')]['key']};});_0x38450e[_0x76f4('0x16')]=_['map'](_0x397360,_0x76f4('0xe'));_0x38450e[_0x76f4('0x17')]=_[_0x76f4('0x18')](_0x672960['query']);_0x38450e['filters']=_['intersection'](_0x38450e[_0x76f4('0x16')],_0x38450e[_0x76f4('0x17')]);_0x38450e[_0x76f4('0x19')]=_[_0x76f4('0x1a')](_0x38450e[_0x76f4('0x19')],[_0x76f4('0x1b'),_0x76f4('0x1c'),'$gt','$gte',_0x76f4('0x1d'),'$lte',_0x76f4('0x1e'),'$eq','$not','$between',_0x76f4('0x1f'),_0x76f4('0x20'),_0x76f4('0x21'),_0x76f4('0x22'),_0x76f4('0x23'),_0x76f4('0x24'),'$notILike',_0x76f4('0x22'),'$overlap','$contains','$contained',_0x76f4('0x25')]);_0x214bef[_0x76f4('0x26')]=_[_0x76f4('0x27')](_0x38450e[_0x76f4('0x16')],qs['fields'](_0x672960[_0x76f4('0x17')]['fields']));_0x214bef[_0x76f4('0x26')]=_0x214bef[_0x76f4('0x26')][_0x76f4('0x28')]?_0x214bef[_0x76f4('0x26')]:_0x38450e[_0x76f4('0x16')];if(!_0x672960['query']['hasOwnProperty'](_0x76f4('0x29'))){_0x214bef[_0x76f4('0x7')]=qs[_0x76f4('0x7')](_0x672960[_0x76f4('0x17')][_0x76f4('0x7')]);_0x214bef[_0x76f4('0x2a')]=qs[_0x76f4('0x2a')](_0x672960[_0x76f4('0x17')][_0x76f4('0x2a')]);}_0x214bef[_0x76f4('0x2b')]=qs[_0x76f4('0x2c')](_0x672960[_0x76f4('0x17')]['sort']);_0x214bef['where']=qs['filters'](_['pick'](_0x672960[_0x76f4('0x17')],_0x38450e[_0x76f4('0x19')]),_0x397360);if(_0x672960[_0x76f4('0x17')][_0x76f4('0x2d')]){_0x214bef[_0x76f4('0x2e')]=_['merge'](_0x214bef[_0x76f4('0x2e')],{'$or':_[_0x76f4('0x11')](_0x397360,function(_0x37a233){if(_0x37a233[_0x76f4('0x15')]!==_0x76f4('0x2f')){var _0x23278f={};_0x23278f[_0x37a233[_0x76f4('0xe')]]={'$like':'%'+_0x672960[_0x76f4('0x17')][_0x76f4('0x2d')]+'%'};return _0x23278f;}})});}_0x214bef=_[_0x76f4('0x30')]({},_0x214bef,_0x672960[_0x76f4('0x31')]);var _0x244607={'where':_0x214bef[_0x76f4('0x2e')]};return db[_0x76f4('0x12')][_0x76f4('0x8')](_0x244607)[_0x76f4('0x32')](function(_0x3308e3){_0x17625e[_0x76f4('0x8')]=_0x3308e3;if(_0x672960['query'][_0x76f4('0x33')]){_0x214bef[_0x76f4('0x34')]=[{'all':!![]}];}return db[_0x76f4('0x12')]['findAll'](_0x214bef);})['then'](function(_0x237fba){_0x17625e['rows']=_0x237fba;return _0x17625e;})[_0x76f4('0x32')](respondWithFilteredResult(_0x2d4bd1,_0x214bef))['catch'](handleError(_0x2d4bd1,null));};exports[_0x76f4('0x35')]=function(_0x16f36d,_0x312243){var _0x378675={'raw':!![],'where':{'id':_0x16f36d[_0x76f4('0x36')]['id']}},_0x2c0b76={};_0x2c0b76[_0x76f4('0x16')]=_[_0x76f4('0x18')](db[_0x76f4('0x12')][_0x76f4('0x13')]);_0x2c0b76['query']=_['keys'](_0x16f36d[_0x76f4('0x17')]);_0x2c0b76[_0x76f4('0x19')]=_[_0x76f4('0x27')](_0x2c0b76[_0x76f4('0x16')],_0x2c0b76[_0x76f4('0x17')]);_0x378675[_0x76f4('0x26')]=_[_0x76f4('0x27')](_0x2c0b76[_0x76f4('0x16')],qs[_0x76f4('0x37')](_0x16f36d['query'][_0x76f4('0x37')]));_0x378675[_0x76f4('0x26')]=_0x378675['attributes']['length']?_0x378675[_0x76f4('0x26')]:_0x2c0b76[_0x76f4('0x16')];if(_0x16f36d[_0x76f4('0x17')][_0x76f4('0x33')]){_0x378675[_0x76f4('0x34')]=[{'all':!![]}];}_0x378675=_['merge']({},_0x378675,_0x16f36d[_0x76f4('0x31')]);return db[_0x76f4('0x12')][_0x76f4('0x38')](_0x378675)[_0x76f4('0x32')](handleEntityNotFound(_0x312243,null))[_0x76f4('0x32')](respondWithResult(_0x312243,null))[_0x76f4('0x39')](handleError(_0x312243,null));};exports['create']=function(_0x317c91,_0x2795db){return db[_0x76f4('0x12')]['create'](_0x317c91['body'],{})[_0x76f4('0x32')](respondWithResult(_0x2795db,0xc9))[_0x76f4('0x39')](handleError(_0x2795db,null));};exports[_0x76f4('0xb')]=function(_0x2bea6d,_0x36fa03){if(_0x2bea6d['body']['id']){delete _0x2bea6d['body']['id'];}return db[_0x76f4('0x12')]['find']({'where':{'id':_0x2bea6d[_0x76f4('0x36')]['id']}})[_0x76f4('0x32')](handleEntityNotFound(_0x36fa03,null))['then'](saveUpdates(_0x2bea6d['body'],null))[_0x76f4('0x32')](respondWithResult(_0x36fa03,null))[_0x76f4('0x39')](handleError(_0x36fa03,null));};exports[_0x76f4('0x3a')]=function(_0x217d3a,_0x55e4cc){return db[_0x76f4('0x12')][_0x76f4('0x3a')]()[_0x76f4('0x32')](respondWithResult(_0x55e4cc,null))['catch'](handleError(_0x55e4cc,null));};exports[_0x76f4('0x3b')]=function(_0x6bbcf2,_0x535eca){var _0x56d905;var _0x4ab620=_0x6bbcf2[_0x76f4('0x36')]['id'];return db[_0x76f4('0x12')][_0x76f4('0x38')]({'where':{'id':_0x6bbcf2[_0x76f4('0x36')]['id']}})['then'](handleEntityNotFound(_0x535eca,null))[_0x76f4('0x32')](function(_0x597de5){if(_0x597de5){return _0x597de5[_0x76f4('0x3b')]()[_0x76f4('0x32')](function(_0x270baf){return _0x270baf;});}})['then'](function(_0x312319){_0x56d905=_0x312319;if(_0x312319){if(_0x312319[_0x76f4('0x3c')]||_0x312319['CampaignId']){return db[_0x312319[_0x76f4('0x3c')]?_0x76f4('0x3d'):_0x76f4('0x3e')][_0x76f4('0x38')]({'where':{'id':_0x312319[_0x76f4('0x3c')]?_0x312319['VoiceQueueId']:_0x312319[_0x76f4('0x3f')]},'attributes':['id','name'],'raw':!![]});}}})[_0x76f4('0x32')](function(_0x38dc69){var _0x154ba={};if(_0x38dc69){_['merge'](_0x154ba,_[_0x76f4('0x40')](_0x56d905[_0x76f4('0x41')],[_0x76f4('0x42'),_0x76f4('0x43'),'id']));_0x154ba['state']=0x15;_0x154ba[_0x76f4('0x44')]=_0x76f4('0x45');_0x154ba[_0x76f4('0x46')]=_0x38dc69[_0x76f4('0xe')];_0x154ba['membername']=_0x6bbcf2[_0x76f4('0x47')]['name'];_0x154ba[_0x76f4('0x48')]=_0x6bbcf2[_0x76f4('0x47')]['id'];_0x154ba['deleted']=!![];_0x154ba['deletedat']=moment()[_0x76f4('0x49')](_0x76f4('0x4a'));_0x154ba[_0x76f4('0x4b')]=_0x56d905['phone'];_0x154ba[_0x76f4('0x4c')]=_0x56d905[_0x76f4('0x3c')]?_0x76f4('0x4d'):'ivr';return db['CmContact'][_0x76f4('0x38')]({'where':{'id':_0x154ba[_0x76f4('0x4e')]},'attributes':['firstName','lastName']})[_0x76f4('0x32')](function(_0x34a5d1){if(!_[_0x76f4('0x4f')](_0x535eca)&&!_[_0x76f4('0x4f')](_0x34a5d1[_0x76f4('0x50')])){_0x154ba[_0x76f4('0x51')]=_0x34a5d1[_0x76f4('0x50')];if(!_[_0x76f4('0x4f')](_0x34a5d1[_0x76f4('0x52')])){_0x154ba['calleridname']+='\x20'+_0x34a5d1['lastName'];}}})['finally'](function(){return db[_0x76f4('0x53')][_0x76f4('0x54')](_0x154ba);});}})[_0x76f4('0x32')](function(_0x3b6c16){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x4ab620}});})[_0x76f4('0x32')](function(){return _0x535eca['status'](0xcc)[_0x76f4('0x55')]();})['catch'](handleError(_0x535eca,null));};exports[_0x76f4('0x56')]=function(_0x25e510,_0x3984d3){var _0x3317a4=[];return db['CmContact'][_0x76f4('0x3a')]()[_0x76f4('0x32')](function(_0x22a0cc){_0x3317a4=_[_0x76f4('0x18')](_0x22a0cc);return _0x25e510[_0x76f4('0x47')][_0x76f4('0x57')]({'where':{'type':_0x76f4('0x58'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x76f4('0x59'),_0x76f4('0x5a')],'raw':!![]});})[_0x76f4('0x32')](function(_0x320a87){if(_0x320a87&&_0x320a87[_0x76f4('0x28')]){return db[_0x76f4('0x5b')][_0x76f4('0x5c')](function(_0x551d38){var _0x5724c3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x76f4('0x4a'))},'VoiceQueueId':{'$in':_[_0x76f4('0x11')](_0x320a87,'id')},'$or':[{'UserId':null},{'UserId':_0x25e510[_0x76f4('0x47')]['id']}]};var _0x5f0dc2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x320a87)[_0x76f4('0x2d')](['dialPreviewAutoRecallMe',0x0])[_0x76f4('0x11')]('id')[_0x76f4('0x5d')]()},'$or':[{'UserId':null},{'UserId':_0x25e510['user']['id']}]};var _0xda0ac2={'$or':[_0x5724c3,_0x5f0dc2]};var _0x37b7f7=[];if(_0x25e510[_0x76f4('0x5e')][_0x76f4('0x5f')]&&_0x25e510[_0x76f4('0x5e')][_0x76f4('0x5f')]===_0x76f4('0x60')){if(!_[_0x76f4('0x61')](_0x25e510[_0x76f4('0x5e')]['hopperIds'])){_0xda0ac2['id']={'$in':_0x25e510[_0x76f4('0x5e')]['hopperIds']};}_0x37b7f7=[[_0x76f4('0x62'),_0x76f4('0x63')],[_0x76f4('0x64'),_0x320a87[0x0][_0x76f4('0x59')]===_0x76f4('0x63')?_0x76f4('0x65'):_0x76f4('0x63')],db[_0x76f4('0x5b')][_0x76f4('0x66')](_0x76f4('0x67')),['id','DESC']];}else{if(!_[_0x76f4('0x61')](_0x25e510[_0x76f4('0x5e')]['hopperIds'])){_0xda0ac2['id']={'$notIn':_0x25e510[_0x76f4('0x5e')][_0x76f4('0x68')]};}_0x37b7f7=[[_0x76f4('0x62'),'DESC'],[_0x76f4('0x64'),_0x320a87[0x0][_0x76f4('0x59')]],db[_0x76f4('0x5b')]['literal'](_0x76f4('0x69')),['id',_0x76f4('0x63')]];}return db[_0x76f4('0x12')][_0x76f4('0x6a')]({'attributes':['id',_0x76f4('0x6b'),_0x76f4('0x6c'),_0x76f4('0x6d')],'where':_0xda0ac2,'order':_0x37b7f7,'transaction':_0x551d38,'lock':_0x551d38[_0x76f4('0x6e')][_0x76f4('0x6f')],'include':[{'model':db['CmContact'],'as':_0x76f4('0x70'),'attributes':_0x3317a4,'include':[{'model':db[_0x76f4('0x71')],'as':_0x76f4('0x72'),'attributes':['id',_0x76f4('0xe')]}]},{'model':db['CmList'],'as':_0x76f4('0x73'),'attributes':['id',_0x76f4('0xe')]},{'model':db[_0x76f4('0x3d')],'as':'Queue','attributes':['id',_0x76f4('0xe'),_0x76f4('0x74')]}]})[_0x76f4('0x32')](function(_0x99fbd6){if(_0x99fbd6){return _0x99fbd6[_0x76f4('0xb')]({'UserId':_0x25e510['user']['id']},{'transaction':_0x551d38});}});});}})[_0x76f4('0x32')](handleEntityNotFound(_0x3984d3,null))['then'](respondWithResult(_0x3984d3,null))[_0x76f4('0x39')](handleError(_0x3984d3,null));};exports[_0x76f4('0x75')]=function(_0x5e6df9,_0x53cb70,_0x58251e){var _0x3aa958=[];var _0x462f3e=_0x5e6df9[_0x76f4('0x36')]['id'];var _0x3e2a07=_0x5e6df9[_0x76f4('0x47')]['id'];return db[_0x76f4('0x76')]['describe']()[_0x76f4('0x32')](function(_0x1bb9b3){_0x3aa958=_[_0x76f4('0x18')](_0x1bb9b3);return db[_0x76f4('0x5b')][_0x76f4('0x5c')](function(_0x1c8973){const _0x307060={'id':_0x462f3e};return db[_0x76f4('0x12')]['findOne']({'attributes':['id',_0x76f4('0x6b'),'recallme'],'where':_0x307060,'transaction':_0x1c8973,'lock':_0x1c8973[_0x76f4('0x6e')][_0x76f4('0x6f')],'include':[{'model':db[_0x76f4('0x76')],'as':_0x76f4('0x70'),'attributes':_0x3aa958,'include':[{'model':db[_0x76f4('0x71')],'as':_0x76f4('0x72'),'attributes':['id',_0x76f4('0xe')]}]},{'model':db[_0x76f4('0x77')],'as':'List','attributes':['id',_0x76f4('0xe')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x76f4('0x74')]}]})[_0x76f4('0x32')](function(_0x279040){if(_0x279040){return _0x279040[_0x76f4('0xb')]({'UserId':_0x3e2a07},{'transaction':_0x1c8973});}});});})['then'](handleEntityNotFound(_0x53cb70,null))[_0x76f4('0x32')](respondWithResult(_0x53cb70,null))[_0x76f4('0x39')](handleError(_0x53cb70,null));};exports[_0x76f4('0x78')]=function(_0x5f5c24,_0x12f16e){return _0x5f5c24[_0x76f4('0x47')][_0x76f4('0x57')]({'where':{'type':_0x76f4('0x58'),'dialActive':!![],'dialMethod':_0x76f4('0x79')},'attributes':['id'],'raw':!![]})[_0x76f4('0x32')](function(_0x3b5e15){if(_0x3b5e15&&_0x3b5e15['length']){return db[_0x76f4('0x12')][_0x76f4('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x76f4('0x4a'))},'VoiceQueueId':{'$in':_[_0x76f4('0x11')](_0x3b5e15,'id')},'$or':[{'UserId':null},{'UserId':_0x5f5c24[_0x76f4('0x47')]['id']}]}});}return 0x0;})[_0x76f4('0x32')](function(_0x36d95c){if(!_[_0x76f4('0x4f')](_0x36d95c)&&_[_0x76f4('0x7a')](_0x36d95c)){return _0x12f16e[_0x76f4('0x4')](0xc8)[_0x76f4('0x5')]({'contacts':_0x36d95c});}else{logger['error'](_0x76f4('0x7b'),_0x76f4('0x78'),0x194,_0x76f4('0x7c'));_0x12f16e[_0x76f4('0x7d')](0x194);}})['catch'](handleError(_0x12f16e,null));};exports[_0x76f4('0x7e')]=function(_0x5df706,_0x420281){var _0x4a7a98=shared[_0x76f4('0x7f')];var _0x7380f=[];_['map'](_0x4a7a98,function(_0x5a3239){_0x7380f[_0x76f4('0x80')]({'id':_0x5a3239[_0x76f4('0xe')],'name':_0x5a3239[_0x76f4('0xe')],'utcOffset':_0x5a3239['utcOffset']});});return _0x420281['status'](0xc8)[_0x76f4('0x5')]({'tz':_0x7380f});};exports[_0x76f4('0x81')]=function(_0x52453,_0x36ab57){var _0x291b87=shared[_0x76f4('0x7f')];var _0x98a269={};if(!_[_0x76f4('0x4f')](_0x291b87[_0x52453['body']['id']]))_0x98a269=_0x291b87[_0x52453['body']['id']];return _0x36ab57[_0x76f4('0x4')](0xc8)[_0x76f4('0x5')](_0x98a269);}; \ No newline at end of file +var _0x202c=['update','then','error','name','send','index','rawAttributes','fieldName','type','key','keys','query','model','filters','concat','$and','$or','$lt','$lte','$ne','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','length','find','create','body','describe','destroy','params','CampaignId','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','UserId','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','map','prev','isEmpty','hopperIds','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','CmCompany','Company','List','Queue','CmContact','VoiceQueue','getOpenContacts','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','moment','../../config/logger','api','../../config/environment','status','undefined','limit','count','offset','Content-Range','json'];(function(_0x1442eb,_0x568fc8){var _0x4186e0=function(_0x3226ef){while(--_0x3226ef){_0x1442eb['push'](_0x1442eb['shift']());}};_0x4186e0(++_0x568fc8);}(_0x202c,0x178));var _0xc202=function(_0x4e35d2,_0x516864){_0x4e35d2=_0x4e35d2-0x0;var _0x384964=_0x202c[_0x4e35d2];return _0x384964;};'use strict';var moment=require(_0xc202('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xc202('0x1'))(_0xc202('0x2'));var shared=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x215161,_0x155c3b){_0x155c3b=_0x155c3b||0xc8;return function(_0x1763f5){if(_0x1763f5){return _0x215161[_0xc202('0x4')](_0x155c3b)['json'](_0x1763f5);}};}function respondWithFilteredResult(_0x28e51c,_0x68d363){return function(_0x59563a){if(_0x59563a){var _0xc2b3eb=typeof _0x68d363['offset']===_0xc202('0x5')&&typeof _0x68d363[_0xc202('0x6')]===_0xc202('0x5');var _0x336fc8=_0x59563a[_0xc202('0x7')];var _0x3ea754=_0xc2b3eb?0x0:_0x68d363[_0xc202('0x8')];var _0xdfe8bf=_0xc2b3eb?_0x59563a[_0xc202('0x7')]:_0x68d363[_0xc202('0x8')]+_0x68d363[_0xc202('0x6')];var _0x870346;if(_0xdfe8bf>=_0x336fc8){_0xdfe8bf=_0x336fc8;_0x870346=0xc8;}else{_0x870346=0xce;}_0x28e51c[_0xc202('0x4')](_0x870346);return _0x28e51c['set'](_0xc202('0x9'),_0x3ea754+'-'+_0xdfe8bf+'/'+_0x336fc8)[_0xc202('0xa')](_0x59563a);}return null;};}function saveUpdates(_0x2805af,_0xbf3618){return function(_0x269dc0){if(_0x269dc0){return _0x269dc0[_0xc202('0xb')](_0x2805af)[_0xc202('0xc')](function(_0x53600c){return _0x53600c;});}return null;};}function handleEntityNotFound(_0xbd4353,_0x32b5d9){return function(_0x591cc0){if(!_0x591cc0){_0xbd4353['sendStatus'](0x194);}return _0x591cc0;};}function handleError(_0x5c10dd,_0x2dafa5){_0x2dafa5=_0x2dafa5||0x1f4;return function(_0x4a333c){logger[_0xc202('0xd')](_0x4a333c['stack']);if(_0x4a333c[_0xc202('0xe')]){delete _0x4a333c[_0xc202('0xe')];}_0x5c10dd[_0xc202('0x4')](_0x2dafa5)[_0xc202('0xf')](_0x4a333c);};}exports[_0xc202('0x10')]=function(_0x2419c5,_0x9620a0){var _0x591ecc={},_0x16ec7c={},_0x2c5557={'count':0x0,'rows':[]};var _0x3f322d=_['map'](db['CmHopper'][_0xc202('0x11')],function(_0x1af67a){return{'name':_0x1af67a[_0xc202('0x12')],'type':_0x1af67a[_0xc202('0x13')][_0xc202('0x14')]};});_0x16ec7c['model']=_['map'](_0x3f322d,_0xc202('0xe'));_0x16ec7c['query']=_[_0xc202('0x15')](_0x2419c5[_0xc202('0x16')]);_0x16ec7c['filters']=_['intersection'](_0x16ec7c[_0xc202('0x17')],_0x16ec7c['query']);_0x16ec7c[_0xc202('0x18')]=_[_0xc202('0x19')](_0x16ec7c[_0xc202('0x18')],[_0xc202('0x1a'),_0xc202('0x1b'),'$gt','$gte',_0xc202('0x1c'),_0xc202('0x1d'),_0xc202('0x1e'),'$eq',_0xc202('0x1f'),_0xc202('0x20'),'$notBetween','$in',_0xc202('0x21'),_0xc202('0x22'),_0xc202('0x23'),_0xc202('0x24'),_0xc202('0x25'),'$like',_0xc202('0x26'),_0xc202('0x27'),'$contained','$any']);_0x591ecc[_0xc202('0x28')]=_[_0xc202('0x29')](_0x16ec7c[_0xc202('0x17')],qs[_0xc202('0x2a')](_0x2419c5['query'][_0xc202('0x2a')]));_0x591ecc[_0xc202('0x28')]=_0x591ecc[_0xc202('0x28')]['length']?_0x591ecc[_0xc202('0x28')]:_0x16ec7c[_0xc202('0x17')];if(!_0x2419c5[_0xc202('0x16')][_0xc202('0x2b')](_0xc202('0x2c'))){_0x591ecc[_0xc202('0x6')]=qs[_0xc202('0x6')](_0x2419c5[_0xc202('0x16')][_0xc202('0x6')]);_0x591ecc[_0xc202('0x8')]=qs[_0xc202('0x8')](_0x2419c5[_0xc202('0x16')]['offset']);}_0x591ecc[_0xc202('0x2d')]=qs[_0xc202('0x2e')](_0x2419c5[_0xc202('0x16')]['sort']);_0x591ecc[_0xc202('0x2f')]=qs['filters'](_[_0xc202('0x30')](_0x2419c5[_0xc202('0x16')],_0x16ec7c[_0xc202('0x18')]),_0x3f322d);if(_0x2419c5[_0xc202('0x16')][_0xc202('0x31')]){_0x591ecc[_0xc202('0x2f')]=_['merge'](_0x591ecc[_0xc202('0x2f')],{'$or':_['map'](_0x3f322d,function(_0x3ac7e8){if(_0x3ac7e8['type']!==_0xc202('0x32')){var _0x147272={};_0x147272[_0x3ac7e8[_0xc202('0xe')]]={'$like':'%'+_0x2419c5['query'][_0xc202('0x31')]+'%'};return _0x147272;}})});}_0x591ecc=_[_0xc202('0x33')]({},_0x591ecc,_0x2419c5[_0xc202('0x34')]);var _0x444a8d={'where':_0x591ecc[_0xc202('0x2f')]};return db[_0xc202('0x35')]['count'](_0x444a8d)[_0xc202('0xc')](function(_0x1e57c3){_0x2c5557[_0xc202('0x7')]=_0x1e57c3;if(_0x2419c5['query'][_0xc202('0x36')]){_0x591ecc[_0xc202('0x37')]=[{'all':!![]}];}return db[_0xc202('0x35')][_0xc202('0x38')](_0x591ecc);})['then'](function(_0x57d5a4){_0x2c5557[_0xc202('0x39')]=_0x57d5a4;return _0x2c5557;})['then'](respondWithFilteredResult(_0x9620a0,_0x591ecc))[_0xc202('0x3a')](handleError(_0x9620a0,null));};exports[_0xc202('0x3b')]=function(_0x25fdd8,_0x200c27){var _0x9dbdb={'raw':!![],'where':{'id':_0x25fdd8['params']['id']}},_0x126c62={};_0x126c62[_0xc202('0x17')]=_[_0xc202('0x15')](db[_0xc202('0x35')][_0xc202('0x11')]);_0x126c62[_0xc202('0x16')]=_['keys'](_0x25fdd8[_0xc202('0x16')]);_0x126c62[_0xc202('0x18')]=_[_0xc202('0x29')](_0x126c62[_0xc202('0x17')],_0x126c62[_0xc202('0x16')]);_0x9dbdb['attributes']=_[_0xc202('0x29')](_0x126c62['model'],qs[_0xc202('0x2a')](_0x25fdd8['query'][_0xc202('0x2a')]));_0x9dbdb[_0xc202('0x28')]=_0x9dbdb[_0xc202('0x28')][_0xc202('0x3c')]?_0x9dbdb['attributes']:_0x126c62[_0xc202('0x17')];if(_0x25fdd8[_0xc202('0x16')][_0xc202('0x36')]){_0x9dbdb[_0xc202('0x37')]=[{'all':!![]}];}_0x9dbdb=_[_0xc202('0x33')]({},_0x9dbdb,_0x25fdd8[_0xc202('0x34')]);return db[_0xc202('0x35')][_0xc202('0x3d')](_0x9dbdb)[_0xc202('0xc')](handleEntityNotFound(_0x200c27,null))[_0xc202('0xc')](respondWithResult(_0x200c27,null))[_0xc202('0x3a')](handleError(_0x200c27,null));};exports[_0xc202('0x3e')]=function(_0x157c2e,_0x39607d){return db[_0xc202('0x35')][_0xc202('0x3e')](_0x157c2e[_0xc202('0x3f')],{})[_0xc202('0xc')](respondWithResult(_0x39607d,0xc9))[_0xc202('0x3a')](handleError(_0x39607d,null));};exports[_0xc202('0xb')]=function(_0x484013,_0x39f2c1){if(_0x484013[_0xc202('0x3f')]['id']){delete _0x484013[_0xc202('0x3f')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x484013['params']['id']}})[_0xc202('0xc')](handleEntityNotFound(_0x39f2c1,null))[_0xc202('0xc')](saveUpdates(_0x484013[_0xc202('0x3f')],null))[_0xc202('0xc')](respondWithResult(_0x39f2c1,null))[_0xc202('0x3a')](handleError(_0x39f2c1,null));};exports[_0xc202('0x40')]=function(_0x157d89,_0x466ba4){return db[_0xc202('0x35')][_0xc202('0x40')]()[_0xc202('0xc')](respondWithResult(_0x466ba4,null))[_0xc202('0x3a')](handleError(_0x466ba4,null));};exports[_0xc202('0x41')]=function(_0x5220a2,_0x33e70c){var _0x163023;var _0x57855e=_0x5220a2[_0xc202('0x42')]['id'];return db[_0xc202('0x35')][_0xc202('0x3d')]({'where':{'id':_0x5220a2[_0xc202('0x42')]['id']}})[_0xc202('0xc')](handleEntityNotFound(_0x33e70c,null))['then'](function(_0x2250a6){if(_0x2250a6){return _0x2250a6['destroy']()[_0xc202('0xc')](function(_0x5f1b99){return _0x5f1b99;});}})[_0xc202('0xc')](function(_0x20ffe5){_0x163023=_0x20ffe5;if(_0x20ffe5){if(_0x20ffe5['VoiceQueueId']||_0x20ffe5[_0xc202('0x43')]){return db[_0x20ffe5[_0xc202('0x44')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x20ffe5[_0xc202('0x44')]?_0x20ffe5['VoiceQueueId']:_0x20ffe5[_0xc202('0x43')]},'attributes':['id',_0xc202('0xe')],'raw':!![]});}}})[_0xc202('0xc')](function(_0x1f6233){var _0x3858b9={};if(_0x1f6233){_[_0xc202('0x33')](_0x3858b9,_[_0xc202('0x45')](_0x163023[_0xc202('0x46')],[_0xc202('0x47'),_0xc202('0x48'),'id']));_0x3858b9[_0xc202('0x49')]=0x15;_0x3858b9[_0xc202('0x4a')]=_0xc202('0x4b');_0x3858b9['campaign']=_0x1f6233[_0xc202('0xe')];_0x3858b9['membername']=_0x5220a2['user'][_0xc202('0xe')];_0x3858b9[_0xc202('0x4c')]=_0x5220a2[_0xc202('0x4d')]['id'];_0x3858b9['deleted']=!![];_0x3858b9[_0xc202('0x4e')]=moment()['format'](_0xc202('0x4f'));_0x3858b9[_0xc202('0x50')]=_0x163023['phone'];_0x3858b9[_0xc202('0x51')]=_0x163023[_0xc202('0x44')]?'queue':_0xc202('0x52');return db['CmContact'][_0xc202('0x3d')]({'where':{'id':_0x3858b9[_0xc202('0x53')]},'attributes':[_0xc202('0x54'),_0xc202('0x55')]})[_0xc202('0xc')](function(_0x2d475a){if(!_[_0xc202('0x56')](_0x33e70c)&&!_['isNil'](_0x2d475a[_0xc202('0x54')])){_0x3858b9[_0xc202('0x57')]=_0x2d475a['firstName'];if(!_[_0xc202('0x56')](_0x2d475a['lastName'])){_0x3858b9[_0xc202('0x57')]+='\x20'+_0x2d475a['lastName'];}}})[_0xc202('0x58')](function(){return db['CmHopperFinal'][_0xc202('0x3e')](_0x3858b9);});}})['then'](function(_0x5f212b){return db[_0xc202('0x59')][_0xc202('0x41')]({'where':{'CmHopperId':_0x57855e}});})[_0xc202('0xc')](function(){return _0x33e70c[_0xc202('0x4')](0xcc)[_0xc202('0x5a')]();})[_0xc202('0x3a')](handleError(_0x33e70c,null));};exports[_0xc202('0x5b')]=function(_0x2b0865,_0x409845){var _0x135797=[];return db['CmContact'][_0xc202('0x40')]()[_0xc202('0xc')](function(_0x58bc02){_0x135797=_[_0xc202('0x15')](_0x58bc02);return _0x2b0865[_0xc202('0x4d')][_0xc202('0x5c')]({'where':{'type':_0xc202('0x5d'),'dialActive':!![],'dialMethod':_0xc202('0x5e')},'attributes':['id',_0xc202('0x5f'),_0xc202('0x60')],'raw':!![]});})[_0xc202('0xc')](function(_0x502caf){if(_0x502caf&&_0x502caf[_0xc202('0x3c')]){return db[_0xc202('0x61')][_0xc202('0x62')](function(_0x3095d2){var _0x233e0a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc202('0x4f'))},'VoiceQueueId':{'$in':_[_0xc202('0x63')](_0x502caf,'id')},'$or':[{'UserId':null},{'UserId':_0x2b0865[_0xc202('0x4d')]['id']}]};var _0x5ae21d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x502caf)[_0xc202('0x31')](['dialPreviewAutoRecallMe',0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x2b0865[_0xc202('0x4d')]['id']}]};var _0xd2d160={'$or':[_0x233e0a,_0x5ae21d]};var _0x189884=[];if(_0x2b0865[_0xc202('0x3f')]['direction']&&_0x2b0865[_0xc202('0x3f')]['direction']===_0xc202('0x64')){if(!_[_0xc202('0x65')](_0x2b0865['body'][_0xc202('0x66')])){_0xd2d160['id']={'$in':_0x2b0865[_0xc202('0x3f')][_0xc202('0x66')]};}_0x189884=[['priority','ASC'],['scheduledAt',_0x502caf[0x0][_0xc202('0x5f')]===_0xc202('0x67')?'DESC':_0xc202('0x67')],db[_0xc202('0x61')]['literal'](_0xc202('0x68')),['id','DESC']];}else{if(!_[_0xc202('0x65')](_0x2b0865[_0xc202('0x3f')][_0xc202('0x66')])){_0xd2d160['id']={'$notIn':_0x2b0865[_0xc202('0x3f')][_0xc202('0x66')]};}_0x189884=[['priority','DESC'],[_0xc202('0x69'),_0x502caf[0x0][_0xc202('0x5f')]],db[_0xc202('0x61')][_0xc202('0x6a')](_0xc202('0x6b')),['id','ASC']];}return db['CmHopper'][_0xc202('0x6c')]({'attributes':['id',_0xc202('0x6d'),_0xc202('0x6e'),_0xc202('0x6f')],'where':_0xd2d160,'order':_0x189884,'transaction':_0x3095d2,'lock':_0x3095d2[_0xc202('0x70')][_0xc202('0x71')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x135797,'include':[{'model':db[_0xc202('0x72')],'as':_0xc202('0x73'),'attributes':['id',_0xc202('0xe')]}]},{'model':db['CmList'],'as':_0xc202('0x74'),'attributes':['id',_0xc202('0xe')]},{'model':db['VoiceQueue'],'as':_0xc202('0x75'),'attributes':['id',_0xc202('0xe'),'dialActive']}]})[_0xc202('0xc')](function(_0x382dea){if(_0x382dea){return _0x382dea[_0xc202('0xb')]({'UserId':_0x2b0865[_0xc202('0x4d')]['id']},{'transaction':_0x3095d2});}});});}})[_0xc202('0xc')](handleEntityNotFound(_0x409845,null))['then'](respondWithResult(_0x409845,null))[_0xc202('0x3a')](handleError(_0x409845,null));};exports['getPreviewRecall']=function(_0x3cfbaa,_0x17ff38,_0x585984){var _0x2d149a=[];var _0x5b8a32=_0x3cfbaa[_0xc202('0x42')]['id'];var _0x411043=_0x3cfbaa[_0xc202('0x4d')]['id'];return db[_0xc202('0x76')]['describe']()[_0xc202('0xc')](function(_0x234770){_0x2d149a=_[_0xc202('0x15')](_0x234770);return db[_0xc202('0x61')][_0xc202('0x62')](function(_0x3ba0c4){const _0x5f2b84={'id':_0x5b8a32};return db[_0xc202('0x35')][_0xc202('0x6c')]({'attributes':['id','scheduledat',_0xc202('0x6f')],'where':_0x5f2b84,'transaction':_0x3ba0c4,'lock':_0x3ba0c4[_0xc202('0x70')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x2d149a,'include':[{'model':db[_0xc202('0x72')],'as':_0xc202('0x73'),'attributes':['id',_0xc202('0xe')]}]},{'model':db['CmList'],'as':_0xc202('0x74'),'attributes':['id',_0xc202('0xe')]},{'model':db[_0xc202('0x77')],'as':_0xc202('0x75'),'attributes':['id',_0xc202('0xe'),'dialActive']}]})[_0xc202('0xc')](function(_0x1bf945){if(_0x1bf945){return _0x1bf945[_0xc202('0xb')]({'UserId':_0x411043},{'transaction':_0x3ba0c4});}});});})[_0xc202('0xc')](handleEntityNotFound(_0x17ff38,null))[_0xc202('0xc')](respondWithResult(_0x17ff38,null))[_0xc202('0x3a')](handleError(_0x17ff38,null));};exports[_0xc202('0x78')]=function(_0x27147e,_0x906dc2){return _0x27147e[_0xc202('0x4d')][_0xc202('0x5c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc202('0x5e')},'attributes':['id'],'raw':!![]})[_0xc202('0xc')](function(_0x48a098){if(_0x48a098&&_0x48a098[_0xc202('0x3c')]){return db[_0xc202('0x35')][_0xc202('0x7')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc202('0x79')](_0xc202('0x4f'))},'VoiceQueueId':{'$in':_['map'](_0x48a098,'id')},'$or':[{'UserId':null},{'UserId':_0x27147e[_0xc202('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x41908c){if(!_[_0xc202('0x56')](_0x41908c)&&_[_0xc202('0x7a')](_0x41908c)){return _0x906dc2[_0xc202('0x4')](0xc8)['json']({'contacts':_0x41908c});}else{logger[_0xc202('0xd')](_0xc202('0x7b'),_0xc202('0x78'),0x194,_0xc202('0x7c'));_0x906dc2[_0xc202('0x7d')](0x194);}})[_0xc202('0x3a')](handleError(_0x906dc2,null));};exports[_0xc202('0x7e')]=function(_0x414557,_0x80109){var _0x1bf8b8=shared[_0xc202('0x7f')];var _0x48521a=[];_['map'](_0x1bf8b8,function(_0x41ef84){_0x48521a[_0xc202('0x80')]({'id':_0x41ef84[_0xc202('0xe')],'name':_0x41ef84[_0xc202('0xe')],'utcOffset':_0x41ef84['utcOffset']});});return _0x80109[_0xc202('0x4')](0xc8)['json']({'tz':_0x48521a});};exports['getTimezone']=function(_0x30f49c,_0x151976){var _0x53e43a=shared['timezones'];var _0x4f6c06={};if(!_[_0xc202('0x56')](_0x53e43a[_0x30f49c[_0xc202('0x3f')]['id']]))_0x4f6c06=_0x53e43a[_0x30f49c['body']['id']];return _0x151976[_0xc202('0x4')](0xc8)[_0xc202('0xa')](_0x4f6c06);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 4dbdf51..c29acff 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 _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x5058d4,_0x5c9315){_0x5058d4=_0x5058d4-0x0;var _0x527bc5=_0x687b[_0x5058d4];return _0x527bc5;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x50954e,_0x5209fc){_0x50954e=_0x50954e-0x0;var _0x3dedce=_0xb4c7[_0x50954e];return _0x3dedce;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('CmHopper',attributes,{'tableName':_0x7b4c('0xb'),'paranoid':![],'indexes':[{'name':_0x7b4c('0xc'),'fields':['scheduledat']},{'name':_0x7b4c('0xd'),'fields':[_0x7b4c('0xd')]},{'name':_0x7b4c('0xe'),'fields':[_0x7b4c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index be1867a..34a40c8 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 _0x4efc=['findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','NOW()','List','lodash','util','moment','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','info','GetCmHopper','debug','stringify','message','error','find','ShowCmHopper','catch','create','body','CreateCmHopper','update','limit','DestroyCmHopper','destroy','transaction','order','LOCK','UPDATE','CmContact','Contact','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','describe','keys'];(function(_0x41dba0,_0x270670){var _0x667e80=function(_0x289510){while(--_0x289510){_0x41dba0['push'](_0x41dba0['shift']());}};_0x667e80(++_0x270670);}(_0x4efc,0x1e1));var _0xc4ef=function(_0x300893,_0x33cb05){_0x300893=_0x300893-0x0;var _0x1ffdd3=_0x4efc[_0x300893];return _0x1ffdd3;};'use strict';var _=require(_0xc4ef('0x0'));var util=require(_0xc4ef('0x1'));var moment=require(_0xc4ef('0x2'));var BPromise=require('bluebird');var db=require(_0xc4ef('0x3'))['db'];var logger=require(_0xc4ef('0x4'))(_0xc4ef('0x5'));exports['GetCmHopper']=function(_0x31ccc6){var _0x2a39b3=this;return new Promise(function(_0x12d4e6,_0x1c288b){return db[_0xc4ef('0x6')][_0xc4ef('0x7')]({'raw':_0x31ccc6[_0xc4ef('0x8')]?_0x31ccc6[_0xc4ef('0x8')][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'where':_0x31ccc6[_0xc4ef('0x8')]?_0x31ccc6[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x31ccc6['options']?_0x31ccc6[_0xc4ef('0x8')][_0xc4ef('0xb')]||null:null,'limit':_0x31ccc6[_0xc4ef('0x8')]?_0x31ccc6[_0xc4ef('0x8')]['limit']||null:null,'include':_0x31ccc6['options']?_0x31ccc6[_0xc4ef('0x8')][_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x31ccc6[_0xc4ef('0x8')][_0xc4ef('0xc')],function(_0x243c2b){return{'model':db[_0x243c2b[_0xc4ef('0xe')]],'as':_0x243c2b['as'],'attributes':_0x243c2b[_0xc4ef('0xb')],'include':_0x243c2b[_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x243c2b[_0xc4ef('0xc')],function(_0x234b85){return{'model':db[_0x234b85[_0xc4ef('0xe')]],'as':_0x234b85['as'],'attributes':_0x234b85[_0xc4ef('0xb')],'include':_0x234b85[_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x234b85[_0xc4ef('0xc')],function(_0x1897b6){return{'model':db[_0x1897b6[_0xc4ef('0xe')]],'as':_0x1897b6['as'],'attributes':_0x1897b6['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4ef('0xf')](function(_0x1513f7){logger[_0xc4ef('0x10')](_0xc4ef('0x11'),_0x31ccc6);logger[_0xc4ef('0x12')](_0xc4ef('0x11'),_0x31ccc6,JSON[_0xc4ef('0x13')](_0x1513f7));_0x12d4e6(_0x1513f7);})['catch'](function(_0x35d65e){logger['error'](_0xc4ef('0x11'),_0x35d65e[_0xc4ef('0x14')],_0x31ccc6);_0x1c288b(_0x2a39b3[_0xc4ef('0x15')](0x1f4,_0x35d65e[_0xc4ef('0x14')]));});});};exports['ShowCmHopper']=function(_0x422753){var _0x266037=this;return new Promise(function(_0x5ec28e,_0xe4880c){return db['CmHopper'][_0xc4ef('0x16')]({'raw':_0x422753[_0xc4ef('0x8')]?_0x422753[_0xc4ef('0x8')][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'where':_0x422753[_0xc4ef('0x8')]?_0x422753[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x422753[_0xc4ef('0x8')]?_0x422753[_0xc4ef('0x8')]['attributes']||null:null,'include':_0x422753[_0xc4ef('0x8')]?_0x422753[_0xc4ef('0x8')][_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x422753[_0xc4ef('0x8')][_0xc4ef('0xc')],function(_0x2d502c){return{'model':db[_0x2d502c[_0xc4ef('0xe')]],'as':_0x2d502c['as'],'attributes':_0x2d502c['attributes'],'include':_0x2d502c[_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x2d502c[_0xc4ef('0xc')],function(_0x1fcd65){return{'model':db[_0x1fcd65[_0xc4ef('0xe')]],'as':_0x1fcd65['as'],'attributes':_0x1fcd65[_0xc4ef('0xb')],'include':_0x1fcd65[_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x1fcd65[_0xc4ef('0xc')],function(_0x2de5d9){return{'model':db[_0x2de5d9[_0xc4ef('0xe')]],'as':_0x2de5d9['as'],'attributes':_0x2de5d9[_0xc4ef('0xb')]};}):[]};}):[]};}):[]:[]})[_0xc4ef('0xf')](function(_0xd103f8){logger[_0xc4ef('0x10')](_0xc4ef('0x17'),_0x422753);logger[_0xc4ef('0x12')]('ShowCmHopper',_0x422753,JSON[_0xc4ef('0x13')](_0xd103f8));_0x5ec28e(_0xd103f8);})[_0xc4ef('0x18')](function(_0x2307b5){logger['error']('ShowCmHopper',_0x2307b5[_0xc4ef('0x14')],_0x422753);_0xe4880c(_0x266037[_0xc4ef('0x15')](0x1f4,_0x2307b5[_0xc4ef('0x14')]));});});};exports['CreateCmHopper']=function(_0x20bf90){var _0x2f3e4c=this;return new Promise(function(_0x5c30da,_0x34747d){return db[_0xc4ef('0x6')][_0xc4ef('0x19')](_0x20bf90[_0xc4ef('0x1a')],{'raw':_0x20bf90['options']?_0x20bf90[_0xc4ef('0x8')][_0xc4ef('0x9')]===undefined?!![]:![]:!![]})[_0xc4ef('0xf')](function(_0x8a22f4){logger[_0xc4ef('0x10')](_0xc4ef('0x1b'),_0x20bf90);logger[_0xc4ef('0x12')](_0xc4ef('0x1b'),_0x20bf90,JSON[_0xc4ef('0x13')](_0x8a22f4));_0x5c30da(_0x8a22f4);})[_0xc4ef('0x18')](function(_0x5504c9){logger[_0xc4ef('0x15')](_0xc4ef('0x1b'),_0x5504c9[_0xc4ef('0x14')],_0x20bf90);_0x34747d(_0x2f3e4c[_0xc4ef('0x15')](0x1f4,_0x5504c9[_0xc4ef('0x14')]));});});};exports['UpdateCmHopper']=function(_0x146337){var _0x1b3fc9=this;return new Promise(function(_0x31a810,_0x3e34e0){return db[_0xc4ef('0x6')][_0xc4ef('0x1c')](_0x146337['body'],{'raw':_0x146337[_0xc4ef('0x8')]?_0x146337['options'][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x146337[_0xc4ef('0x8')]?_0x146337[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x146337[_0xc4ef('0x8')]?_0x146337['options'][_0xc4ef('0xb')]||null:null,'limit':_0x146337[_0xc4ef('0x8')]?_0x146337[_0xc4ef('0x8')][_0xc4ef('0x1d')]||null:null})['then'](function(_0x3f4831){logger[_0xc4ef('0x10')]('UpdateCmHopper',_0x146337);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc4ef('0x13')](_0x146337[_0xc4ef('0x8')][_0xc4ef('0xa')]),_0x146337[_0xc4ef('0x1a')]['active']);logger[_0xc4ef('0x12')]('UpdateCmHopper',_0x146337,JSON[_0xc4ef('0x13')](_0x3f4831));_0x31a810(_0x3f4831);})[_0xc4ef('0x18')](function(_0x4ee530){logger['error']('UpdateCmHopper',_0x4ee530[_0xc4ef('0x14')],_0x146337);_0x3e34e0(_0x1b3fc9[_0xc4ef('0x15')](0x1f4,_0x4ee530[_0xc4ef('0x14')]));});});};exports[_0xc4ef('0x1e')]=function(_0x4dd284){var _0x11aa78=this;return new Promise(function(_0x473cb1,_0x43b0ed){return db[_0xc4ef('0x6')][_0xc4ef('0x1f')]({'where':_0x4dd284[_0xc4ef('0x8')]?_0x4dd284[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null})[_0xc4ef('0xf')](function(_0xa1bd59){logger[_0xc4ef('0x10')](_0xc4ef('0x1e'),_0x4dd284);logger['debug']('DestroyCmHopper',_0x4dd284,JSON['stringify'](_0xa1bd59));_0x473cb1(_0xa1bd59);})['catch'](function(_0x2c8453){logger[_0xc4ef('0x15')](_0xc4ef('0x1e'),_0x2c8453[_0xc4ef('0x14')],_0x4dd284);_0x43b0ed(_0x11aa78[_0xc4ef('0x15')](0x1f4,_0x2c8453[_0xc4ef('0x14')]));});});};exports['GetContactDialer']=function(_0x46334e){var _0x1e8318=this;return new Promise(function(_0x2ac7e9,_0x3a1d23){return db['CmContact']['describe']()[_0xc4ef('0xf')](function(_0x54f28b){return db['sequelize'][_0xc4ef('0x20')](function(_0x4a2543){return db[_0xc4ef('0x6')][_0xc4ef('0x7')]({'where':_0x46334e[_0xc4ef('0x8')]?_0x46334e[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x46334e[_0xc4ef('0x8')]?_0x46334e[_0xc4ef('0x8')][_0xc4ef('0xb')]||null:null,'limit':_0x46334e[_0xc4ef('0x8')]?_0x46334e[_0xc4ef('0x8')][_0xc4ef('0x1d')]||null:null,'order':_0x46334e[_0xc4ef('0x8')]?_0x46334e['options'][_0xc4ef('0x21')]||null:null,'transaction':_0x4a2543,'lock':_0x4a2543[_0xc4ef('0x22')][_0xc4ef('0x23')],'include':[{'model':db[_0xc4ef('0x24')],'as':_0xc4ef('0x25'),'attributes':_['keys'](_0x54f28b)},{'model':db[_0xc4ef('0x26')],'as':_0xc4ef('0x27'),'attributes':['id',_0xc4ef('0x28'),_0xc4ef('0x29')]}]})['then'](function(_0x263d0d){var _0x60e79f=[];var _0x1b8262=[];for(var _0x21e69e=0x0;_0x21e69e<_0x263d0d[_0xc4ef('0x2a')];_0x21e69e+=0x1){var _0x2423fd=_0x263d0d[_0x21e69e][_0xc4ef('0x2b')];if(_0x2423fd===null){_0x60e79f[_0xc4ef('0x2c')](_0x263d0d[_0x21e69e][_0xc4ef('0x1c')](_0x46334e[_0xc4ef('0x1a')],{'transaction':_0x4a2543}));}else if(!_0x1b8262[_0xc4ef('0x2d')](_0x2423fd)){_0x1b8262[_0xc4ef('0x2c')](_0x2423fd);_0x60e79f[_0xc4ef('0x2c')](_0x263d0d[_0x21e69e][_0xc4ef('0x1c')](_0x46334e[_0xc4ef('0x1a')],{'transaction':_0x4a2543}));}}return BPromise[_0xc4ef('0x2e')](_0x60e79f);});})[_0xc4ef('0xf')](function(_0x334ed1){logger['info']('GetContactDialer',_0x46334e);if(_0x334ed1[_0xc4ef('0x2a')]>0x0){logger[_0xc4ef('0x10')](_0xc4ef('0x2f'),_0x334ed1[0x0]['dataValues']['id'],_0x334ed1[0x0][_0xc4ef('0x30')][_0xc4ef('0x31')],_0x334ed1[0x0][_0xc4ef('0x30')][_0xc4ef('0x32')]);}logger[_0xc4ef('0x12')](_0xc4ef('0x33'),_0x46334e,JSON[_0xc4ef('0x13')](_0x334ed1));_0x2ac7e9(_0x334ed1);})[_0xc4ef('0x18')](function(_0x2c4142){logger[_0xc4ef('0x15')]('GetContactDialer',_0x2c4142[_0xc4ef('0x14')],_0x46334e);_0x3a1d23(_0x1e8318['error'](0x1f4,_0x2c4142[_0xc4ef('0x14')]));});});});};exports[_0xc4ef('0x34')]=function(_0x3adc83){var _0x4c6a99=this;return new Promise(function(_0x246d9b,_0x53d935){return db[_0xc4ef('0x35')][_0xc4ef('0x20')](function(_0x57c831){return db[_0xc4ef('0x36')]['create'](_0x3adc83[_0xc4ef('0x1a')],{'raw':_0x3adc83[_0xc4ef('0x8')]?_0x3adc83[_0xc4ef('0x8')][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'transaction':_0x57c831})[_0xc4ef('0xf')](function(){logger[_0xc4ef('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc4ef('0x13')](_0x3adc83['options'][_0xc4ef('0xa')]),_0x3adc83[_0xc4ef('0x8')][_0xc4ef('0xa')][_0xc4ef('0x32')]);return db['CmHopper']['destroy']({'where':_0x3adc83[_0xc4ef('0x8')]?_0x3adc83[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'transaction':_0x57c831});});})[_0xc4ef('0xf')](function(_0xaf9100){logger[_0xc4ef('0x10')](_0xc4ef('0x34'),_0x3adc83);logger[_0xc4ef('0x12')](_0xc4ef('0x34'),_0x3adc83,JSON['stringify'](_0xaf9100));_0x246d9b(_0xaf9100);})[_0xc4ef('0x18')](function(_0xe4a1dd){logger[_0xc4ef('0x15')](_0xc4ef('0x34'),_0xe4a1dd['message'],_0x3adc83);_0x53d935(_0x4c6a99[_0xc4ef('0x15')](0x1f4,_0xe4a1dd[_0xc4ef('0x14')]));});});};exports['CountReScheduled']=function(_0x1711bf){var _0x3b79c8=this;return new Promise(function(_0x5dc283,_0x41db1c){return db[_0xc4ef('0x6')][_0xc4ef('0x7')]({'raw':_0x1711bf[_0xc4ef('0x8')]?_0x1711bf[_0xc4ef('0x8')][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'where':_0x1711bf['options']?_0x1711bf['options']['where']||null:null,'attributes':[[db[_0xc4ef('0x35')]['fn'](_0xc4ef('0x37'),db[_0xc4ef('0x35')]['fn']('IF',db['sequelize'][_0xc4ef('0x38')](_0xc4ef('0x39')+util[_0xc4ef('0x3a')]('\x22%s\x22',moment()[_0xc4ef('0x3a')](_0xc4ef('0x3b')))+_0xc4ef('0x3c')))),'contactsRescheduled']]})[_0xc4ef('0xf')](function(_0x8b57ff){logger[_0xc4ef('0x10')](_0xc4ef('0x3d'),_0x1711bf);logger[_0xc4ef('0x12')](_0xc4ef('0x3d'),_0x1711bf,JSON[_0xc4ef('0x13')](_0x8b57ff));_0x5dc283(_0x8b57ff);})[_0xc4ef('0x18')](function(_0x221af2){logger[_0xc4ef('0x15')](_0xc4ef('0x3d'),_0x221af2['message'],_0x1711bf);_0x41db1c(_0x3b79c8[_0xc4ef('0x15')](0x1f4,_0x221af2[_0xc4ef('0x14')]));});});};exports[_0xc4ef('0x3e')]=function(_0x39911c){var _0x444e22=this;return new Promise(function(_0x21e500,_0x5a1c27){return db['CmContact'][_0xc4ef('0x3f')]()[_0xc4ef('0xf')](function(){return db[_0xc4ef('0x35')][_0xc4ef('0x20')](function(_0x2c088d){return db[_0xc4ef('0x6')][_0xc4ef('0x7')]({'where':_0x39911c[_0xc4ef('0x8')]?_0x39911c[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x39911c['options']?_0x39911c['options']['attributes']||null:null,'limit':0x1,'order':_0x39911c[_0xc4ef('0x8')]?_0x39911c['options']['order']||null:null,'group':db['CmHopper'][_0xc4ef('0x2b')],'transaction':_0x2c088d,'lock':_0x2c088d[_0xc4ef('0x22')][_0xc4ef('0x23')],'include':_0x39911c[_0xc4ef('0x8')]?_0x39911c[_0xc4ef('0x8')][_0xc4ef('0xc')]?_['map'](_0x39911c['options'][_0xc4ef('0xc')],function(_0x228ca3){return{'model':db[_0x228ca3['model']],'as':_0x228ca3['as'],'attributes':_0x228ca3[_0xc4ef('0xb')],'include':_0x228ca3[_0xc4ef('0xc')]?_['map'](_0x228ca3['include'],function(_0x35280c){return{'model':db[_0x35280c[_0xc4ef('0xe')]],'as':_0x35280c['as'],'attributes':_0x35280c['attributes'],'include':_0x35280c[_0xc4ef('0xc')]?_['map'](_0x35280c[_0xc4ef('0xc')],function(_0x19ad66){return{'model':db[_0x19ad66[_0xc4ef('0xe')]],'as':_0x19ad66['as'],'attributes':_0x19ad66[_0xc4ef('0xb')]};}):[]};}):[]};}):[]:[]})[_0xc4ef('0xf')](function(_0x3e102d){var _0x4b0797=[];for(var _0x336e2f=0x0;_0x336e2f<_0x3e102d[_0xc4ef('0x2a')];_0x336e2f+=0x1){_0x4b0797[_0xc4ef('0x2c')](_0x3e102d[_0x336e2f]['update'](_0x39911c[_0xc4ef('0x1a')],{'transaction':_0x2c088d}));}return BPromise[_0xc4ef('0x2e')](_0x4b0797);});})['then'](function(_0x201b72){logger[_0xc4ef('0x10')]('GetContactRecallMe',_0x39911c);logger[_0xc4ef('0x12')]('GetContactRecallMe',_0x39911c,JSON['stringify'](_0x201b72));_0x21e500(_0x201b72);})[_0xc4ef('0x18')](function(_0xb79e9a){logger[_0xc4ef('0x15')](_0xc4ef('0x3e'),_0xb79e9a[_0xc4ef('0x14')],_0x39911c);_0x5a1c27(_0x444e22[_0xc4ef('0x15')](0x1f4,_0xb79e9a[_0xc4ef('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x14ed86){var _0x305ac4=this;return new Promise(function(_0x1575fb,_0x36e519){db[_0xc4ef('0x24')]['describe']()[_0xc4ef('0xf')](function(_0x2ecfd4){return db['CmHopper'][_0xc4ef('0x7')]({'raw':_0x14ed86[_0xc4ef('0x8')]?_0x14ed86['options'][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'where':_0x14ed86[_0xc4ef('0x8')]?_0x14ed86[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x14ed86['options']?_0x14ed86['options'][_0xc4ef('0xb')]||null:null,'limit':_0x14ed86[_0xc4ef('0x8')]?_0x14ed86[_0xc4ef('0x8')][_0xc4ef('0x1d')]||null:null,'include':_0x14ed86['options']?_0x14ed86['options'][_0xc4ef('0xc')]?_['map'](_0x14ed86['options']['include'],function(_0x25a697){return{'model':db[_0x25a697['model']],'as':_0x25a697['as'],'attributes':_0x25a697['as']===_0xc4ef('0x25')?_[_0xc4ef('0x40')](_0x2ecfd4):_0x25a697['attributes'],'include':_0x25a697[_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x25a697[_0xc4ef('0xc')],function(_0x14481c){return{'model':db[_0x14481c[_0xc4ef('0xe')]],'as':_0x14481c['as'],'attributes':_0x14481c[_0xc4ef('0xb')],'include':_0x14481c[_0xc4ef('0xc')]?_['map'](_0x14481c['include'],function(_0xf810c9){return{'model':db[_0xf810c9[_0xc4ef('0xe')]],'as':_0xf810c9['as'],'attributes':_0xf810c9[_0xc4ef('0xb')]};}):[]};}):[]};}):[]:[]})[_0xc4ef('0xf')](function(_0x4ba98c){logger[_0xc4ef('0x10')](_0xc4ef('0x11'),_0x14ed86);logger[_0xc4ef('0x12')](_0xc4ef('0x11'),_0x14ed86,JSON[_0xc4ef('0x13')](_0x4ba98c));_0x1575fb(_0x4ba98c);})[_0xc4ef('0x18')](function(_0xec2ba0){logger[_0xc4ef('0x15')]('GetCmHopper',_0xec2ba0[_0xc4ef('0x14')],_0x14ed86);_0x36e519(_0x305ac4[_0xc4ef('0x15')](0x1f4,_0xec2ba0['message']));});});});};exports['GetContactByPhone']=function(_0x505ba1){var _0x2169c9=this;return new Promise(function(_0x1139b2,_0x2b032e){return db['CmContact'][_0xc4ef('0x41')]({'raw':!![],'where':{'phone':_0x505ba1[_0xc4ef('0x8')][_0xc4ef('0xa')][_0xc4ef('0x42')]},'attributes':['id',_0xc4ef('0x43')],'order':[['id',_0xc4ef('0x44')]]})['then'](function(_0x30a9ad){logger['info'](_0xc4ef('0x45'),_0x505ba1);logger[_0xc4ef('0x12')](_0xc4ef('0x45'),_0x505ba1,JSON[_0xc4ef('0x13')](_0x30a9ad));_0x1139b2(_0x30a9ad);})[_0xc4ef('0x18')](function(_0x658495){logger['error'](_0xc4ef('0x45'),_0x658495[_0xc4ef('0x14')],_0x505ba1);_0x2b032e(_0x2169c9[_0xc4ef('0x15')](0x1f4,_0x658495['message']));});});};exports[_0xc4ef('0x46')]=function(_0x4e4552){var _0x3ffce1=this;return new Promise(function(_0x499849,_0x4b2c24){return db['sequelize'][_0xc4ef('0x20')](function(_0x5d284c){var _0x59d56a=_0x4e4552[_0xc4ef('0x8')]&&_0x4e4552['options'][_0xc4ef('0xa')]?_0x4e4552[_0xc4ef('0x8')]['where']:{};return db[_0xc4ef('0x6')][_0xc4ef('0x1c')](_0x4e4552['body'],{'where':_0x59d56a,'transaction':_0x5d284c})[_0xc4ef('0xf')](function(_0x423f3e){logger['info'](_0xc4ef('0x46'),_0x4e4552);logger[_0xc4ef('0x12')](_0xc4ef('0x46'),_0x4e4552,JSON[_0xc4ef('0x13')](_0x423f3e));_0x499849(_0x423f3e);})[_0xc4ef('0x18')](function(_0x48788d){logger['error'](_0xc4ef('0x46'),_0x48788d['message'],_0x4e4552);_0x4b2c24(_0x3ffce1[_0xc4ef('0x15')](0x1f4,_0x48788d['message']));});});});};exports[_0xc4ef('0x47')]=function(_0x37f459){var _0x4407d9=this;var _0x358f14=_0x37f459['body'][_0xc4ef('0xa')][_0xc4ef('0x48')];var _0x29a38f=_0x37f459[_0xc4ef('0x1a')]['where'][_0xc4ef('0x49')];var _0x3c4fd8=_0x37f459[_0xc4ef('0x1a')]['where'][_0xc4ef('0x4a')];return new Promise(function(_0x459ced,_0x503fab){return db[_0xc4ef('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x358f14},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xc4ef('0x35')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x29a38f+_0xc4ef('0x4b')),'$gt':db[_0xc4ef('0x35')][_0xc4ef('0x38')](_0xc4ef('0x4c'))}},'UserId':{'$in':_0x3c4fd8}},'include':[{'model':db[_0xc4ef('0x24')],'as':_0xc4ef('0x25')},{'model':db[_0xc4ef('0x26')],'as':_0xc4ef('0x27'),'attributes':['id',_0xc4ef('0x28'),'voicePause']},{'model':db['CmList'],'as':_0xc4ef('0x4d')}]})[_0xc4ef('0xf')](function(_0xf113a){if(_0xf113a[_0xc4ef('0x2a')]>0x0){return db[_0xc4ef('0x35')][_0xc4ef('0x20')](function(_0x4d028a){return db[_0xc4ef('0x6')]['update']({'recallmeNotifiedDate':db['sequelize']['literal'](_0xc4ef('0x4c'))},{'where':{'id':{'$in':_['map'](_0xf113a,'id')}},'transaction':_0x4d028a})['then'](function(){_0x459ced(_0xf113a);})[_0xc4ef('0x18')](function(_0x11febc){logger[_0xc4ef('0x15')](_0xc4ef('0x47'),_0x11febc['message'],_0x37f459);_0x503fab(_0x4407d9['error'](0x1f4,_0x11febc['message']));});})[_0xc4ef('0x18')](function(_0x531e27){logger['error'](_0xc4ef('0x47'),_0x531e27['message'],_0x37f459);_0x503fab(_0x4407d9[_0xc4ef('0x15')](0x1f4,_0x531e27[_0xc4ef('0x14')]));});}else{_0x459ced(_0xf113a);}});});}; \ No newline at end of file +var _0x1983=['../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','options','where','limit','include','model','attributes','map','then','debug','stringify','catch','error','message','ShowCmHopper','find','raw','create','body','info','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','User','Agent','name','UserId','push','includes','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','voicePause','CmList','List','NOW()','lodash','moment'];(function(_0x4e83a3,_0x1032ce){var _0x58fba3=function(_0x2f099e){while(--_0x2f099e){_0x4e83a3['push'](_0x4e83a3['shift']());}};_0x58fba3(++_0x1032ce);}(_0x1983,0x1f0));var _0x3198=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x1983[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x3198('0x0'));var util=require('util');var moment=require(_0x3198('0x1'));var BPromise=require('bluebird');var db=require(_0x3198('0x2'))['db'];var logger=require(_0x3198('0x3'))(_0x3198('0x4'));exports[_0x3198('0x5')]=function(_0x473421){var _0x12c483=this;return new Promise(function(_0x500cbe,_0x1829d1){return db[_0x3198('0x6')]['findAll']({'raw':_0x473421[_0x3198('0x7')]?_0x473421[_0x3198('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x473421[_0x3198('0x7')]?_0x473421[_0x3198('0x7')][_0x3198('0x8')]||null:null,'attributes':_0x473421[_0x3198('0x7')]?_0x473421[_0x3198('0x7')]['attributes']||null:null,'limit':_0x473421['options']?_0x473421[_0x3198('0x7')][_0x3198('0x9')]||null:null,'include':_0x473421[_0x3198('0x7')]?_0x473421[_0x3198('0x7')][_0x3198('0xa')]?_['map'](_0x473421['options'][_0x3198('0xa')],function(_0xc44bce){return{'model':db[_0xc44bce[_0x3198('0xb')]],'as':_0xc44bce['as'],'attributes':_0xc44bce[_0x3198('0xc')],'include':_0xc44bce['include']?_[_0x3198('0xd')](_0xc44bce[_0x3198('0xa')],function(_0x5cd23d){return{'model':db[_0x5cd23d[_0x3198('0xb')]],'as':_0x5cd23d['as'],'attributes':_0x5cd23d[_0x3198('0xc')],'include':_0x5cd23d['include']?_[_0x3198('0xd')](_0x5cd23d['include'],function(_0x5e5859){return{'model':db[_0x5e5859[_0x3198('0xb')]],'as':_0x5e5859['as'],'attributes':_0x5e5859[_0x3198('0xc')]};}):[]};}):[]};}):[]:[]})[_0x3198('0xe')](function(_0x319a2b){logger['info'](_0x3198('0x5'),_0x473421);logger[_0x3198('0xf')](_0x3198('0x5'),_0x473421,JSON[_0x3198('0x10')](_0x319a2b));_0x500cbe(_0x319a2b);})[_0x3198('0x11')](function(_0x3f74f7){logger[_0x3198('0x12')](_0x3198('0x5'),_0x3f74f7[_0x3198('0x13')],_0x473421);_0x1829d1(_0x12c483[_0x3198('0x12')](0x1f4,_0x3f74f7['message']));});});};exports[_0x3198('0x14')]=function(_0x38b62a){var _0x741164=this;return new Promise(function(_0x40c714,_0x4b3de6){return db[_0x3198('0x6')][_0x3198('0x15')]({'raw':_0x38b62a['options']?_0x38b62a[_0x3198('0x7')][_0x3198('0x16')]===undefined?!![]:![]:!![],'where':_0x38b62a[_0x3198('0x7')]?_0x38b62a['options']['where']||null:null,'attributes':_0x38b62a[_0x3198('0x7')]?_0x38b62a[_0x3198('0x7')][_0x3198('0xc')]||null:null,'include':_0x38b62a['options']?_0x38b62a[_0x3198('0x7')][_0x3198('0xa')]?_['map'](_0x38b62a[_0x3198('0x7')][_0x3198('0xa')],function(_0x15dd19){return{'model':db[_0x15dd19['model']],'as':_0x15dd19['as'],'attributes':_0x15dd19[_0x3198('0xc')],'include':_0x15dd19[_0x3198('0xa')]?_[_0x3198('0xd')](_0x15dd19[_0x3198('0xa')],function(_0x48e15e){return{'model':db[_0x48e15e[_0x3198('0xb')]],'as':_0x48e15e['as'],'attributes':_0x48e15e['attributes'],'include':_0x48e15e[_0x3198('0xa')]?_[_0x3198('0xd')](_0x48e15e['include'],function(_0x22db54){return{'model':db[_0x22db54[_0x3198('0xb')]],'as':_0x22db54['as'],'attributes':_0x22db54[_0x3198('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3269e2){logger['info'](_0x3198('0x14'),_0x38b62a);logger[_0x3198('0xf')](_0x3198('0x14'),_0x38b62a,JSON[_0x3198('0x10')](_0x3269e2));_0x40c714(_0x3269e2);})[_0x3198('0x11')](function(_0x9ce88c){logger[_0x3198('0x12')](_0x3198('0x14'),_0x9ce88c[_0x3198('0x13')],_0x38b62a);_0x4b3de6(_0x741164[_0x3198('0x12')](0x1f4,_0x9ce88c[_0x3198('0x13')]));});});};exports['CreateCmHopper']=function(_0x3943cf){var _0x249fc9=this;return new Promise(function(_0x25c05a,_0x5ad085){return db[_0x3198('0x6')][_0x3198('0x17')](_0x3943cf[_0x3198('0x18')],{'raw':_0x3943cf[_0x3198('0x7')]?_0x3943cf[_0x3198('0x7')][_0x3198('0x16')]===undefined?!![]:![]:!![]})[_0x3198('0xe')](function(_0xd3f123){logger[_0x3198('0x19')]('CreateCmHopper',_0x3943cf);logger['debug'](_0x3198('0x1a'),_0x3943cf,JSON['stringify'](_0xd3f123));_0x25c05a(_0xd3f123);})[_0x3198('0x11')](function(_0x49cfaf){logger[_0x3198('0x12')](_0x3198('0x1a'),_0x49cfaf[_0x3198('0x13')],_0x3943cf);_0x5ad085(_0x249fc9[_0x3198('0x12')](0x1f4,_0x49cfaf[_0x3198('0x13')]));});});};exports[_0x3198('0x1b')]=function(_0x210bf2){var _0x530e6b=this;return new Promise(function(_0x1e565f,_0x2717b1){return db[_0x3198('0x6')][_0x3198('0x1c')](_0x210bf2[_0x3198('0x18')],{'raw':_0x210bf2['options']?_0x210bf2['options'][_0x3198('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x210bf2['options']?_0x210bf2[_0x3198('0x7')][_0x3198('0x8')]||null:null,'attributes':_0x210bf2[_0x3198('0x7')]?_0x210bf2['options'][_0x3198('0xc')]||null:null,'limit':_0x210bf2['options']?_0x210bf2[_0x3198('0x7')][_0x3198('0x9')]||null:null})[_0x3198('0xe')](function(_0x1a715e){logger[_0x3198('0x19')](_0x3198('0x1b'),_0x210bf2);logger[_0x3198('0x19')](_0x3198('0x1d'),JSON[_0x3198('0x10')](_0x210bf2[_0x3198('0x7')][_0x3198('0x8')]),_0x210bf2[_0x3198('0x18')][_0x3198('0x1e')]);logger['debug'](_0x3198('0x1b'),_0x210bf2,JSON[_0x3198('0x10')](_0x1a715e));_0x1e565f(_0x1a715e);})['catch'](function(_0x3098a2){logger[_0x3198('0x12')](_0x3198('0x1b'),_0x3098a2[_0x3198('0x13')],_0x210bf2);_0x2717b1(_0x530e6b[_0x3198('0x12')](0x1f4,_0x3098a2['message']));});});};exports[_0x3198('0x1f')]=function(_0x52c428){var _0x364d8f=this;return new Promise(function(_0xb17ad2,_0x559d2a){return db[_0x3198('0x6')][_0x3198('0x20')]({'where':_0x52c428['options']?_0x52c428[_0x3198('0x7')][_0x3198('0x8')]||null:null})['then'](function(_0x1fd066){logger[_0x3198('0x19')](_0x3198('0x1f'),_0x52c428);logger[_0x3198('0xf')](_0x3198('0x1f'),_0x52c428,JSON[_0x3198('0x10')](_0x1fd066));_0xb17ad2(_0x1fd066);})[_0x3198('0x11')](function(_0x486f18){logger[_0x3198('0x12')]('DestroyCmHopper',_0x486f18[_0x3198('0x13')],_0x52c428);_0x559d2a(_0x364d8f[_0x3198('0x12')](0x1f4,_0x486f18['message']));});});};exports['GetContactDialer']=function(_0x4f99be){var _0x23bc7c=this;return new Promise(function(_0x3ddb53,_0x70728d){return db[_0x3198('0x21')][_0x3198('0x22')]()['then'](function(_0x2c2770){return db[_0x3198('0x23')][_0x3198('0x24')](function(_0x19a316){return db[_0x3198('0x6')][_0x3198('0x25')]({'where':_0x4f99be[_0x3198('0x7')]?_0x4f99be[_0x3198('0x7')]['where']||null:null,'attributes':_0x4f99be[_0x3198('0x7')]?_0x4f99be[_0x3198('0x7')][_0x3198('0xc')]||null:null,'limit':_0x4f99be[_0x3198('0x7')]?_0x4f99be[_0x3198('0x7')][_0x3198('0x9')]||null:null,'order':_0x4f99be[_0x3198('0x7')]?_0x4f99be[_0x3198('0x7')][_0x3198('0x26')]||null:null,'transaction':_0x19a316,'lock':_0x19a316[_0x3198('0x27')][_0x3198('0x28')],'include':[{'model':db['CmContact'],'as':_0x3198('0x29'),'attributes':_['keys'](_0x2c2770)},{'model':db[_0x3198('0x2a')],'as':_0x3198('0x2b'),'attributes':['id',_0x3198('0x2c'),'voicePause']}]})['then'](function(_0x37a353){var _0xd69b6b=[];var _0x3a03c6=[];for(var _0x130af1=0x0;_0x130af1<_0x37a353['length'];_0x130af1+=0x1){var _0x502166=_0x37a353[_0x130af1][_0x3198('0x2d')];if(_0x502166===null){_0xd69b6b[_0x3198('0x2e')](_0x37a353[_0x130af1][_0x3198('0x1c')](_0x4f99be[_0x3198('0x18')],{'transaction':_0x19a316}));}else if(!_0x3a03c6[_0x3198('0x2f')](_0x502166)){_0x3a03c6['push'](_0x502166);_0xd69b6b['push'](_0x37a353[_0x130af1][_0x3198('0x1c')](_0x4f99be['body'],{'transaction':_0x19a316}));}}return BPromise[_0x3198('0x30')](_0xd69b6b);});})['then'](function(_0x13d87a){logger[_0x3198('0x19')](_0x3198('0x31'),_0x4f99be);if(_0x13d87a[_0x3198('0x32')]>0x0){logger[_0x3198('0x19')](_0x3198('0x33'),_0x13d87a[0x0][_0x3198('0x34')]['id'],_0x13d87a[0x0][_0x3198('0x34')][_0x3198('0x35')],_0x13d87a[0x0][_0x3198('0x34')]['active']);}logger['debug'](_0x3198('0x31'),_0x4f99be,JSON['stringify'](_0x13d87a));_0x3ddb53(_0x13d87a);})[_0x3198('0x11')](function(_0x3a8c96){logger['error'](_0x3198('0x31'),_0x3a8c96[_0x3198('0x13')],_0x4f99be);_0x70728d(_0x23bc7c[_0x3198('0x12')](0x1f4,_0x3a8c96['message']));});});});};exports['MoveContactManagedDialer']=function(_0x6b3f93){var _0x25f6d6=this;return new Promise(function(_0x422934,_0x410b22){return db['sequelize'][_0x3198('0x24')](function(_0x472459){return db['CmHopperFinal'][_0x3198('0x17')](_0x6b3f93[_0x3198('0x18')],{'raw':_0x6b3f93[_0x3198('0x7')]?_0x6b3f93['options'][_0x3198('0x16')]===undefined?!![]:![]:!![],'transaction':_0x472459})['then'](function(){logger['info'](_0x3198('0x36'),JSON[_0x3198('0x10')](_0x6b3f93[_0x3198('0x7')]['where']),_0x6b3f93[_0x3198('0x7')][_0x3198('0x8')][_0x3198('0x1e')]);return db[_0x3198('0x6')]['destroy']({'where':_0x6b3f93[_0x3198('0x7')]?_0x6b3f93[_0x3198('0x7')][_0x3198('0x8')]||null:null,'transaction':_0x472459});});})[_0x3198('0xe')](function(_0x1930a5){logger[_0x3198('0x19')]('MoveContactManagedDialer',_0x6b3f93);logger[_0x3198('0xf')](_0x3198('0x37'),_0x6b3f93,JSON[_0x3198('0x10')](_0x1930a5));_0x422934(_0x1930a5);})[_0x3198('0x11')](function(_0x552838){logger[_0x3198('0x12')](_0x3198('0x37'),_0x552838['message'],_0x6b3f93);_0x410b22(_0x25f6d6[_0x3198('0x12')](0x1f4,_0x552838[_0x3198('0x13')]));});});};exports['CountReScheduled']=function(_0x4d7fba){var _0x5737d1=this;return new Promise(function(_0x2020a5,_0x1de1e6){return db['CmHopper'][_0x3198('0x25')]({'raw':_0x4d7fba['options']?_0x4d7fba[_0x3198('0x7')][_0x3198('0x16')]===undefined?!![]:![]:!![],'where':_0x4d7fba['options']?_0x4d7fba[_0x3198('0x7')][_0x3198('0x8')]||null:null,'attributes':[[db[_0x3198('0x23')]['fn'](_0x3198('0x38'),db[_0x3198('0x23')]['fn']('IF',db[_0x3198('0x23')][_0x3198('0x39')](_0x3198('0x3a')+util[_0x3198('0x3b')](_0x3198('0x3c'),moment()[_0x3198('0x3b')](_0x3198('0x3d')))+_0x3198('0x3e')))),_0x3198('0x3f')]]})[_0x3198('0xe')](function(_0x1cf642){logger[_0x3198('0x19')](_0x3198('0x40'),_0x4d7fba);logger[_0x3198('0xf')]('CountReScheduled',_0x4d7fba,JSON[_0x3198('0x10')](_0x1cf642));_0x2020a5(_0x1cf642);})[_0x3198('0x11')](function(_0x385f3a){logger[_0x3198('0x12')](_0x3198('0x40'),_0x385f3a[_0x3198('0x13')],_0x4d7fba);_0x1de1e6(_0x5737d1[_0x3198('0x12')](0x1f4,_0x385f3a[_0x3198('0x13')]));});});};exports[_0x3198('0x41')]=function(_0x36492f){var _0x5e86b0=this;return new Promise(function(_0x1aa38f,_0x2630c7){return db[_0x3198('0x21')][_0x3198('0x22')]()[_0x3198('0xe')](function(){return db[_0x3198('0x23')][_0x3198('0x24')](function(_0x533d0d){return db['CmHopper'][_0x3198('0x25')]({'where':_0x36492f['options']?_0x36492f[_0x3198('0x7')][_0x3198('0x8')]||null:null,'attributes':_0x36492f['options']?_0x36492f[_0x3198('0x7')][_0x3198('0xc')]||null:null,'limit':0x1,'order':_0x36492f['options']?_0x36492f['options'][_0x3198('0x26')]||null:null,'group':db[_0x3198('0x6')]['UserId'],'transaction':_0x533d0d,'lock':_0x533d0d[_0x3198('0x27')][_0x3198('0x28')],'include':_0x36492f['options']?_0x36492f[_0x3198('0x7')]['include']?_[_0x3198('0xd')](_0x36492f[_0x3198('0x7')][_0x3198('0xa')],function(_0x391eea){return{'model':db[_0x391eea[_0x3198('0xb')]],'as':_0x391eea['as'],'attributes':_0x391eea[_0x3198('0xc')],'include':_0x391eea['include']?_['map'](_0x391eea['include'],function(_0x514f22){return{'model':db[_0x514f22['model']],'as':_0x514f22['as'],'attributes':_0x514f22['attributes'],'include':_0x514f22[_0x3198('0xa')]?_[_0x3198('0xd')](_0x514f22['include'],function(_0x43e52e){return{'model':db[_0x43e52e[_0x3198('0xb')]],'as':_0x43e52e['as'],'attributes':_0x43e52e[_0x3198('0xc')]};}):[]};}):[]};}):[]:[]})[_0x3198('0xe')](function(_0x7196f4){var _0x1c8d9e=[];for(var _0x43faa6=0x0;_0x43faa6<_0x7196f4[_0x3198('0x32')];_0x43faa6+=0x1){_0x1c8d9e[_0x3198('0x2e')](_0x7196f4[_0x43faa6][_0x3198('0x1c')](_0x36492f[_0x3198('0x18')],{'transaction':_0x533d0d}));}return BPromise[_0x3198('0x30')](_0x1c8d9e);});})[_0x3198('0xe')](function(_0xceb8cf){logger['info'](_0x3198('0x41'),_0x36492f);logger[_0x3198('0xf')](_0x3198('0x41'),_0x36492f,JSON[_0x3198('0x10')](_0xceb8cf));_0x1aa38f(_0xceb8cf);})[_0x3198('0x11')](function(_0x3030a6){logger['error']('GetContactRecallMe',_0x3030a6[_0x3198('0x13')],_0x36492f);_0x2630c7(_0x5e86b0[_0x3198('0x12')](0x1f4,_0x3030a6[_0x3198('0x13')]));});});});};exports[_0x3198('0x42')]=function(_0x1f88b1){var _0x33d8eb=this;return new Promise(function(_0x4eb3fe,_0x100645){db[_0x3198('0x21')]['describe']()[_0x3198('0xe')](function(_0x4fa261){return db[_0x3198('0x6')][_0x3198('0x25')]({'raw':_0x1f88b1[_0x3198('0x7')]?_0x1f88b1[_0x3198('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x1f88b1[_0x3198('0x7')]?_0x1f88b1[_0x3198('0x7')][_0x3198('0x8')]||null:null,'attributes':_0x1f88b1[_0x3198('0x7')]?_0x1f88b1[_0x3198('0x7')][_0x3198('0xc')]||null:null,'limit':_0x1f88b1[_0x3198('0x7')]?_0x1f88b1['options']['limit']||null:null,'include':_0x1f88b1['options']?_0x1f88b1[_0x3198('0x7')][_0x3198('0xa')]?_['map'](_0x1f88b1[_0x3198('0x7')][_0x3198('0xa')],function(_0x489f7a){return{'model':db[_0x489f7a[_0x3198('0xb')]],'as':_0x489f7a['as'],'attributes':_0x489f7a['as']===_0x3198('0x29')?_[_0x3198('0x43')](_0x4fa261):_0x489f7a[_0x3198('0xc')],'include':_0x489f7a['include']?_[_0x3198('0xd')](_0x489f7a[_0x3198('0xa')],function(_0x17db53){return{'model':db[_0x17db53[_0x3198('0xb')]],'as':_0x17db53['as'],'attributes':_0x17db53[_0x3198('0xc')],'include':_0x17db53[_0x3198('0xa')]?_[_0x3198('0xd')](_0x17db53[_0x3198('0xa')],function(_0x46a9b7){return{'model':db[_0x46a9b7['model']],'as':_0x46a9b7['as'],'attributes':_0x46a9b7[_0x3198('0xc')]};}):[]};}):[]};}):[]:[]})[_0x3198('0xe')](function(_0x23d331){logger[_0x3198('0x19')](_0x3198('0x5'),_0x1f88b1);logger[_0x3198('0xf')](_0x3198('0x5'),_0x1f88b1,JSON['stringify'](_0x23d331));_0x4eb3fe(_0x23d331);})[_0x3198('0x11')](function(_0x3a18e1){logger[_0x3198('0x12')](_0x3198('0x5'),_0x3a18e1['message'],_0x1f88b1);_0x100645(_0x33d8eb[_0x3198('0x12')](0x1f4,_0x3a18e1['message']));});});});};exports[_0x3198('0x44')]=function(_0x53ab96){var _0x165544=this;return new Promise(function(_0x57223c,_0x359d0d){return db[_0x3198('0x21')][_0x3198('0x45')]({'raw':!![],'where':{'phone':_0x53ab96[_0x3198('0x7')][_0x3198('0x8')][_0x3198('0x46')]},'attributes':['id',_0x3198('0x47')],'order':[['id',_0x3198('0x48')]]})[_0x3198('0xe')](function(_0x3e50de){logger['info'](_0x3198('0x49'),_0x53ab96);logger['debug'](_0x3198('0x49'),_0x53ab96,JSON[_0x3198('0x10')](_0x3e50de));_0x57223c(_0x3e50de);})[_0x3198('0x11')](function(_0x4411e9){logger[_0x3198('0x12')](_0x3198('0x49'),_0x4411e9['message'],_0x53ab96);_0x359d0d(_0x165544[_0x3198('0x12')](0x1f4,_0x4411e9[_0x3198('0x13')]));});});};exports[_0x3198('0x4a')]=function(_0x3c75e3){var _0x5e7db2=this;return new Promise(function(_0x1a6b87,_0xbf7231){return db[_0x3198('0x23')][_0x3198('0x24')](function(_0x72a653){var _0x2a84cf=_0x3c75e3[_0x3198('0x7')]&&_0x3c75e3[_0x3198('0x7')][_0x3198('0x8')]?_0x3c75e3[_0x3198('0x7')]['where']:{};return db['CmHopper'][_0x3198('0x1c')](_0x3c75e3['body'],{'where':_0x2a84cf,'transaction':_0x72a653})[_0x3198('0xe')](function(_0x6af38){logger['info'](_0x3198('0x4a'),_0x3c75e3);logger[_0x3198('0xf')](_0x3198('0x4a'),_0x3c75e3,JSON[_0x3198('0x10')](_0x6af38));_0x1a6b87(_0x6af38);})[_0x3198('0x11')](function(_0x4685ce){logger['error']('ResetActiveCalls',_0x4685ce[_0x3198('0x13')],_0x3c75e3);_0xbf7231(_0x5e7db2[_0x3198('0x12')](0x1f4,_0x4685ce[_0x3198('0x13')]));});});});};exports[_0x3198('0x4b')]=function(_0x31ea06){var _0x394f7b=this;var _0x200675=_0x31ea06[_0x3198('0x18')][_0x3198('0x8')][_0x3198('0x4c')];var _0x59f9c7=_0x31ea06[_0x3198('0x18')][_0x3198('0x8')]['interval'];var _0x48fa6f=_0x31ea06[_0x3198('0x18')][_0x3198('0x8')][_0x3198('0x4d')];return new Promise(function(_0xa37ef,_0x30e3d6){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x200675},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3198('0x23')][_0x3198('0x39')](_0x3198('0x4e')+_0x59f9c7+'\x20MINUTE'),'$gt':db[_0x3198('0x23')]['literal']('NOW()')}},'UserId':{'$in':_0x48fa6f}},'include':[{'model':db[_0x3198('0x21')],'as':_0x3198('0x29')},{'model':db['User'],'as':_0x3198('0x2b'),'attributes':['id',_0x3198('0x2c'),_0x3198('0x4f')]},{'model':db[_0x3198('0x50')],'as':_0x3198('0x51')}]})[_0x3198('0xe')](function(_0x2e9557){if(_0x2e9557[_0x3198('0x32')]>0x0){return db[_0x3198('0x23')][_0x3198('0x24')](function(_0x242629){return db[_0x3198('0x6')][_0x3198('0x1c')]({'recallmeNotifiedDate':db[_0x3198('0x23')][_0x3198('0x39')](_0x3198('0x52'))},{'where':{'id':{'$in':_['map'](_0x2e9557,'id')}},'transaction':_0x242629})[_0x3198('0xe')](function(){_0xa37ef(_0x2e9557);})[_0x3198('0x11')](function(_0x4a48ae){logger[_0x3198('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x4a48ae[_0x3198('0x13')],_0x31ea06);_0x30e3d6(_0x394f7b[_0x3198('0x12')](0x1f4,_0x4a48ae[_0x3198('0x13')]));});})['catch'](function(_0x13d865){logger['error'](_0x3198('0x4b'),_0x13d865[_0x3198('0x13')],_0x31ea06);_0x30e3d6(_0x394f7b['error'](0x1f4,_0x13d865['message']));});}else{_0xa37ef(_0x2e9557);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d9b7d4d..f227666 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 _0x0b89=['isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','getPreview','/timezone','update','destroy','exports','Router','../../components/auth/service','./cmHopper.controller','get'];(function(_0x28f153,_0x4852ed){var _0x56b861=function(_0x3cbf02){while(--_0x3cbf02){_0x28f153['push'](_0x28f153['shift']());}};_0x56b861(++_0x4852ed);}(_0x0b89,0x130));var _0x90b8=function(_0x59c59b,_0x2cbe3e){_0x59c59b=_0x59c59b-0x0;var _0x506c07=_0x0b89[_0x59c59b];return _0x506c07;};'use strict';var express=require('express');var router=express[_0x90b8('0x0')]();var auth=require(_0x90b8('0x1'));var controller=require(_0x90b8('0x2'));router[_0x90b8('0x3')]('/',auth[_0x90b8('0x4')](),controller[_0x90b8('0x5')]);router['get'](_0x90b8('0x6'),auth[_0x90b8('0x4')](),controller[_0x90b8('0x7')]);router['get'](_0x90b8('0x8'),auth[_0x90b8('0x4')](),controller[_0x90b8('0x9')]);router[_0x90b8('0x3')](_0x90b8('0xa'),auth['isAuthenticated'](),controller[_0x90b8('0xb')]);router[_0x90b8('0x3')](_0x90b8('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x90b8('0xd'),auth[_0x90b8('0x4')](),controller[_0x90b8('0xe')]);router[_0x90b8('0xf')]('/',auth[_0x90b8('0x4')](),controller[_0x90b8('0x10')]);router['post']('/preview',auth[_0x90b8('0x4')](),controller[_0x90b8('0x11')]);router['post'](_0x90b8('0x12'),auth[_0x90b8('0x4')](),controller['getTimezone']);router['put'](_0x90b8('0xc'),auth[_0x90b8('0x4')](),controller[_0x90b8('0x13')]);router['delete']('/:id',auth[_0x90b8('0x4')](),controller[_0x90b8('0x14')]);module[_0x90b8('0x15')]=router; \ No newline at end of file +var _0x20db=['Router','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','/timezone','getTimezone','update','delete'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x20db,0x140));var _0xb20d=function(_0x2c1ce8,_0x2ac6a5){_0x2c1ce8=_0x2c1ce8-0x0;var _0xd3d27e=_0x20db[_0x2c1ce8];return _0xd3d27e;};'use strict';var express=require('express');var router=express[_0xb20d('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xb20d('0x1'));router[_0xb20d('0x2')]('/',auth[_0xb20d('0x3')](),controller['index']);router[_0xb20d('0x2')](_0xb20d('0x4'),auth['isAuthenticated'](),controller[_0xb20d('0x5')]);router[_0xb20d('0x2')](_0xb20d('0x6'),auth[_0xb20d('0x3')](),controller[_0xb20d('0x7')]);router['get'](_0xb20d('0x8'),auth[_0xb20d('0x3')](),controller[_0xb20d('0x9')]);router[_0xb20d('0x2')](_0xb20d('0xa'),auth[_0xb20d('0x3')](),controller['show']);router['get'](_0xb20d('0xb'),auth['isAuthenticated'](),controller[_0xb20d('0xc')]);router[_0xb20d('0xd')]('/',auth['isAuthenticated'](),controller[_0xb20d('0xe')]);router[_0xb20d('0xd')](_0xb20d('0xf'),auth[_0xb20d('0x3')](),controller['getPreview']);router[_0xb20d('0xd')](_0xb20d('0x10'),auth[_0xb20d('0x3')](),controller[_0xb20d('0x11')]);router['put']('/:id',auth[_0xb20d('0x3')](),controller[_0xb20d('0x12')]);router[_0xb20d('0x13')](_0xb20d('0xa'),auth[_0xb20d('0x3')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index de5acc5..8a53622 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x810a=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','INTEGER','DATE'];(function(_0xb6516e,_0x2c0401){var _0x575bed=function(_0x2ff90a){while(--_0x2ff90a){_0xb6516e['push'](_0xb6516e['shift']());}};_0x575bed(++_0x2c0401);}(_0x810a,0x1ee));var _0xa810=function(_0x2c6806,_0x274486){_0x2c6806=_0x2c6806-0x0;var _0x17bab0=_0x810a[_0x2c6806];return _0x17bab0;};'use strict';var moment=require('moment');var Sequelize=require(_0xa810('0x0'));module[_0xa810('0x1')]={'CmHopperId':{'type':Sequelize[_0xa810('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa810('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa810('0x3')],'defaultValue':moment()[_0xa810('0x4')](_0xa810('0x5'))},'countbusyretry':{'type':Sequelize[_0xa810('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa810('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa810('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa810('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa810('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x55cb=['sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x333fea,_0xd3e038){var _0x15a706=function(_0x4a3ca3){while(--_0x4a3ca3){_0x333fea['push'](_0x333fea['shift']());}};_0x15a706(++_0xd3e038);}(_0x55cb,0x120));var _0xb55c=function(_0x280820,_0xce9bc7){_0x280820=_0x280820-0x0;var _0x474787=_0x55cb[_0x280820];return _0x474787;};'use strict';var moment=require('moment');var Sequelize=require(_0xb55c('0x0'));module[_0xb55c('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xb55c('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xb55c('0x3')],'defaultValue':moment()['format'](_0xb55c('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb55c('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb55c('0x5')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xb55c('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb55c('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb55c('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index ffb1ab1..347e08e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e88=['lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','index','CmHopperAdditionalPhone','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','CmHopperAdditionalPhones','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra'];(function(_0x17658a,_0x3f894b){var _0x3d12ba=function(_0x57c3f7){while(--_0x57c3f7){_0x17658a['push'](_0x17658a['shift']());}};_0x3d12ba(++_0x3f894b);}(_0x3e88,0x196));var _0x83e8=function(_0x52acff,_0x187abb){_0x52acff=_0x52acff-0x0;var _0x3bc3cc=_0x3e88[_0x52acff];return _0x3bc3cc;};'use strict';var emlformat=require(_0x83e8('0x0'));var rimraf=require(_0x83e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83e8('0x2'));var rp=require('request-promise');var moment=require(_0x83e8('0x3'));var BPromise=require(_0x83e8('0x4'));var Mustache=require(_0x83e8('0x5'));var util=require('util');var path=require(_0x83e8('0x6'));var sox=require(_0x83e8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83e8('0x8'));var _=require(_0x83e8('0x9'));var squel=require(_0x83e8('0xa'));var crypto=require(_0x83e8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x83e8('0xc'));var toCsv=require(_0x83e8('0xd'));var querystring=require('querystring');var Papa=require(_0x83e8('0xe'));var Redis=require(_0x83e8('0xf'));var authService=require(_0x83e8('0x10'));var qs=require(_0x83e8('0x11'));var as=require(_0x83e8('0x12'));var hardwareService=require(_0x83e8('0x13'));var logger=require('../../config/logger')(_0x83e8('0x14'));var utils=require(_0x83e8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x83e8('0x16'));var db=require(_0x83e8('0x17'))['db'];function respondWithStatusCode(_0xdd9328,_0x3f69f6){_0x3f69f6=_0x3f69f6||0xcc;return function(_0xa3819c){if(_0xa3819c){return _0xdd9328[_0x83e8('0x18')](_0x3f69f6);}return _0xdd9328[_0x83e8('0x19')](_0x3f69f6)[_0x83e8('0x1a')]();};}function respondWithResult(_0x529f53,_0x290162){_0x290162=_0x290162||0xc8;return function(_0x581ca3){if(_0x581ca3){return _0x529f53['status'](_0x290162)[_0x83e8('0x1b')](_0x581ca3);}};}function respondWithFilteredResult(_0x6a3c5e,_0x4a2f53){return function(_0x6972b6){if(_0x6972b6){var _0x4cecc6=typeof _0x4a2f53[_0x83e8('0x1c')]===_0x83e8('0x1d')&&typeof _0x4a2f53[_0x83e8('0x1e')]===_0x83e8('0x1d');var _0x19bd08=_0x6972b6[_0x83e8('0x1f')];var _0x462880=_0x4cecc6?0x0:_0x4a2f53['offset'];var _0x3f63f9=_0x4cecc6?_0x6972b6[_0x83e8('0x1f')]:_0x4a2f53[_0x83e8('0x1c')]+_0x4a2f53[_0x83e8('0x1e')];var _0x3ca6f3;if(_0x3f63f9>=_0x19bd08){_0x3f63f9=_0x19bd08;_0x3ca6f3=0xc8;}else{_0x3ca6f3=0xce;}_0x6a3c5e['status'](_0x3ca6f3);return _0x6a3c5e['set'](_0x83e8('0x20'),_0x462880+'-'+_0x3f63f9+'/'+_0x19bd08)['json'](_0x6972b6);}return null;};}function patchUpdates(_0x18a774){return function(_0xcb88a9){try{jsonpatch[_0x83e8('0x21')](_0xcb88a9,_0x18a774,!![]);}catch(_0x4b84c7){return BPromise[_0x83e8('0x22')](_0x4b84c7);}return _0xcb88a9[_0x83e8('0x23')]();};}function saveUpdates(_0x3e1ac3,_0x46462e){return function(_0x390723){if(_0x390723){return _0x390723[_0x83e8('0x24')](_0x3e1ac3)[_0x83e8('0x25')](function(_0x4187a0){return _0x4187a0;});}return null;};}function removeEntity(_0x193a51,_0x28ad90){return function(_0x1f9ff2){if(_0x1f9ff2){return _0x1f9ff2[_0x83e8('0x26')]()[_0x83e8('0x25')](function(){var _0x2ed985=_0x1f9ff2['get']({'plain':!![]});var _0x5091bd='CmHopperAdditionalPhones';return db[_0x83e8('0x27')][_0x83e8('0x26')]({'where':{'type':_0x5091bd,'resourceId':_0x2ed985['id']}})[_0x83e8('0x25')](function(){return _0x1f9ff2;});})[_0x83e8('0x25')](function(){_0x193a51[_0x83e8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x508b2c,_0x3d73b0){return function(_0x2d4abf){if(!_0x2d4abf){_0x508b2c[_0x83e8('0x18')](0x194);}return _0x2d4abf;};}function handleError(_0x1e6413,_0x99b4e4){_0x99b4e4=_0x99b4e4||0x1f4;return function(_0x3eee27){logger['error'](_0x3eee27[_0x83e8('0x28')]);if(_0x3eee27[_0x83e8('0x29')]){delete _0x3eee27[_0x83e8('0x29')];}_0x1e6413[_0x83e8('0x19')](_0x99b4e4)[_0x83e8('0x2a')](_0x3eee27);};}exports[_0x83e8('0x2b')]=function(_0x3cea1b,_0x3c0f28){var _0x17d1bf={},_0x336298={},_0x369709={'count':0x0,'rows':[]};var _0x4eb4ff=_['map'](db[_0x83e8('0x2c')]['rawAttributes'],function(_0x4e4983){return{'name':_0x4e4983[_0x83e8('0x2d')],'type':_0x4e4983[_0x83e8('0x2e')]['key']};});_0x336298[_0x83e8('0x2f')]=_[_0x83e8('0x30')](_0x4eb4ff,'name');_0x336298['query']=_[_0x83e8('0x31')](_0x3cea1b[_0x83e8('0x32')]);_0x336298[_0x83e8('0x33')]=_[_0x83e8('0x34')](_0x336298['model'],_0x336298['query']);_0x17d1bf['attributes']=_[_0x83e8('0x34')](_0x336298['model'],qs['fields'](_0x3cea1b['query'][_0x83e8('0x35')]));_0x17d1bf[_0x83e8('0x36')]=_0x17d1bf[_0x83e8('0x36')][_0x83e8('0x37')]?_0x17d1bf[_0x83e8('0x36')]:_0x336298[_0x83e8('0x2f')];if(!_0x3cea1b[_0x83e8('0x32')][_0x83e8('0x38')](_0x83e8('0x39'))){_0x17d1bf[_0x83e8('0x1e')]=qs[_0x83e8('0x1e')](_0x3cea1b[_0x83e8('0x32')]['limit']);_0x17d1bf[_0x83e8('0x1c')]=qs[_0x83e8('0x1c')](_0x3cea1b[_0x83e8('0x32')][_0x83e8('0x1c')]);}_0x17d1bf['order']=qs[_0x83e8('0x3a')](_0x3cea1b['query'][_0x83e8('0x3a')]);_0x17d1bf['where']=qs[_0x83e8('0x33')](_[_0x83e8('0x3b')](_0x3cea1b[_0x83e8('0x32')],_0x336298[_0x83e8('0x33')]),_0x4eb4ff);if(_0x3cea1b['query'][_0x83e8('0x3c')]){_0x17d1bf[_0x83e8('0x3d')]=_[_0x83e8('0x3e')](_0x17d1bf[_0x83e8('0x3d')],{'$or':_[_0x83e8('0x30')](_0x4eb4ff,function(_0x5713e1){if(_0x5713e1[_0x83e8('0x2e')]!==_0x83e8('0x3f')){var _0x26297e={};_0x26297e[_0x5713e1[_0x83e8('0x29')]]={'$like':'%'+_0x3cea1b[_0x83e8('0x32')][_0x83e8('0x3c')]+'%'};return _0x26297e;}})});}_0x17d1bf=_[_0x83e8('0x3e')]({},_0x17d1bf,_0x3cea1b[_0x83e8('0x40')]);var _0x1c635a={'where':_0x17d1bf[_0x83e8('0x3d')]};return db['CmHopperAdditionalPhone']['count'](_0x1c635a)[_0x83e8('0x25')](function(_0x551829){_0x369709[_0x83e8('0x1f')]=_0x551829;if(_0x3cea1b[_0x83e8('0x32')][_0x83e8('0x41')]){_0x17d1bf[_0x83e8('0x42')]=[{'all':!![]}];}return db[_0x83e8('0x2c')][_0x83e8('0x43')](_0x17d1bf);})[_0x83e8('0x25')](function(_0xe0ea4e){_0x369709[_0x83e8('0x44')]=_0xe0ea4e;return _0x369709;})[_0x83e8('0x25')](respondWithFilteredResult(_0x3c0f28,_0x17d1bf))[_0x83e8('0x45')](handleError(_0x3c0f28,null));};exports['show']=function(_0x530826,_0x501a86){var _0x4a184c={'raw':!![],'where':{'id':_0x530826[_0x83e8('0x46')]['id']}},_0x224320={};_0x224320[_0x83e8('0x2f')]=_[_0x83e8('0x31')](db[_0x83e8('0x2c')][_0x83e8('0x47')]);_0x224320[_0x83e8('0x32')]=_[_0x83e8('0x31')](_0x530826['query']);_0x224320['filters']=_['intersection'](_0x224320[_0x83e8('0x2f')],_0x224320[_0x83e8('0x32')]);_0x4a184c['attributes']=_['intersection'](_0x224320[_0x83e8('0x2f')],qs[_0x83e8('0x35')](_0x530826[_0x83e8('0x32')][_0x83e8('0x35')]));_0x4a184c['attributes']=_0x4a184c[_0x83e8('0x36')][_0x83e8('0x37')]?_0x4a184c[_0x83e8('0x36')]:_0x224320[_0x83e8('0x2f')];if(_0x530826['query'][_0x83e8('0x41')]){_0x4a184c[_0x83e8('0x42')]=[{'all':!![]}];}_0x4a184c=_['merge']({},_0x4a184c,_0x530826[_0x83e8('0x40')]);return db[_0x83e8('0x2c')]['find'](_0x4a184c)[_0x83e8('0x25')](handleEntityNotFound(_0x501a86,null))[_0x83e8('0x25')](respondWithResult(_0x501a86,null))[_0x83e8('0x45')](handleError(_0x501a86,null));};exports[_0x83e8('0x48')]=function(_0xf12d12,_0x2d3168){return db['CmHopperAdditionalPhone'][_0x83e8('0x48')](_0xf12d12[_0x83e8('0x49')],{})[_0x83e8('0x25')](function(_0x30a36d){var _0x37b916=_0xf12d12['user'][_0x83e8('0x4a')]({'plain':!![]});if(!_0x37b916)throw new Error(_0x83e8('0x4b'));if(_0x37b916['role']===_0x83e8('0x4c')){var _0x57255f=_0x30a36d[_0x83e8('0x4a')]({'plain':!![]});var _0x2b0252=_0x83e8('0x4d');return db['UserProfileSection'][_0x83e8('0x4e')]({'where':{'name':_0x2b0252,'userProfileId':_0x37b916[_0x83e8('0x4f')]},'raw':!![]})[_0x83e8('0x25')](function(_0x389685){if(_0x389685&&_0x389685[_0x83e8('0x50')]===0x0){return db[_0x83e8('0x27')][_0x83e8('0x48')]({'name':_0x57255f[_0x83e8('0x29')],'resourceId':_0x57255f['id'],'type':_0x389685['name'],'sectionId':_0x389685['id']},{})['then'](function(){return _0x30a36d;});}else{return _0x30a36d;}})['catch'](function(_0x4065ca){logger[_0x83e8('0x51')](_0x83e8('0x52'),_0x4065ca);throw _0x4065ca;});}return _0x30a36d;})[_0x83e8('0x25')](respondWithResult(_0x2d3168,0xc9))[_0x83e8('0x45')](handleError(_0x2d3168,null));};exports[_0x83e8('0x24')]=function(_0x49d51d,_0x8c7294){if(_0x49d51d[_0x83e8('0x49')]['id']){delete _0x49d51d[_0x83e8('0x49')]['id'];}return db[_0x83e8('0x2c')][_0x83e8('0x4e')]({'where':{'id':_0x49d51d[_0x83e8('0x46')]['id']}})[_0x83e8('0x25')](handleEntityNotFound(_0x8c7294,null))[_0x83e8('0x25')](saveUpdates(_0x49d51d[_0x83e8('0x49')],null))[_0x83e8('0x25')](respondWithResult(_0x8c7294,null))[_0x83e8('0x45')](handleError(_0x8c7294,null));};exports[_0x83e8('0x26')]=function(_0x8f35ad,_0x2486ae){return db[_0x83e8('0x2c')][_0x83e8('0x4e')]({'where':{'id':_0x8f35ad[_0x83e8('0x46')]['id']}})[_0x83e8('0x25')](handleEntityNotFound(_0x2486ae,null))[_0x83e8('0x25')](removeEntity(_0x2486ae,null))['catch'](handleError(_0x2486ae,null));}; \ No newline at end of file +var _0x3d6f=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId'];(function(_0x45e0f4,_0x357d06){var _0x2176d2=function(_0x4be810){while(--_0x4be810){_0x45e0f4['push'](_0x45e0f4['shift']());}};_0x2176d2(++_0x357d06);}(_0x3d6f,0xfb));var _0xf3d6=function(_0x24431a,_0x52459a){_0x24431a=_0x24431a-0x0;var _0x454ec7=_0x3d6f[_0x24431a];return _0x454ec7;};'use strict';var emlformat=require(_0xf3d6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf3d6('0x1'));var jsonpatch=require(_0xf3d6('0x2'));var rp=require('request-promise');var moment=require(_0xf3d6('0x3'));var BPromise=require(_0xf3d6('0x4'));var Mustache=require(_0xf3d6('0x5'));var util=require(_0xf3d6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf3d6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3d6('0x8'));var _=require(_0xf3d6('0x9'));var squel=require(_0xf3d6('0xa'));var crypto=require(_0xf3d6('0xb'));var jsforce=require(_0xf3d6('0xc'));var deskjs=require(_0xf3d6('0xd'));var toCsv=require(_0xf3d6('0x7'));var querystring=require(_0xf3d6('0xe'));var Papa=require('papaparse');var Redis=require(_0xf3d6('0xf'));var authService=require(_0xf3d6('0x10'));var qs=require(_0xf3d6('0x11'));var as=require(_0xf3d6('0x12'));var hardwareService=require(_0xf3d6('0x13'));var logger=require(_0xf3d6('0x14'))('api');var utils=require(_0xf3d6('0x15'));var config=require(_0xf3d6('0x16'));var licenseUtil=require(_0xf3d6('0x17'));var db=require(_0xf3d6('0x18'))['db'];function respondWithStatusCode(_0x24689c,_0x29f7fb){_0x29f7fb=_0x29f7fb||0xcc;return function(_0x3ce2fc){if(_0x3ce2fc){return _0x24689c[_0xf3d6('0x19')](_0x29f7fb);}return _0x24689c['status'](_0x29f7fb)[_0xf3d6('0x1a')]();};}function respondWithResult(_0x282520,_0x5d5d16){_0x5d5d16=_0x5d5d16||0xc8;return function(_0x1a97ee){if(_0x1a97ee){return _0x282520[_0xf3d6('0x1b')](_0x5d5d16)[_0xf3d6('0x1c')](_0x1a97ee);}};}function respondWithFilteredResult(_0x3b248e,_0x221ee5){return function(_0xaa50d7){if(_0xaa50d7){var _0x5484ba=typeof _0x221ee5[_0xf3d6('0x1d')]===_0xf3d6('0x1e')&&typeof _0x221ee5[_0xf3d6('0x1f')]===_0xf3d6('0x1e');var _0x40c16c=_0xaa50d7[_0xf3d6('0x20')];var _0x5c42ca=_0x5484ba?0x0:_0x221ee5['offset'];var _0x9e7810=_0x5484ba?_0xaa50d7[_0xf3d6('0x20')]:_0x221ee5[_0xf3d6('0x1d')]+_0x221ee5['limit'];var _0x2a66a8;if(_0x9e7810>=_0x40c16c){_0x9e7810=_0x40c16c;_0x2a66a8=0xc8;}else{_0x2a66a8=0xce;}_0x3b248e[_0xf3d6('0x1b')](_0x2a66a8);return _0x3b248e[_0xf3d6('0x21')](_0xf3d6('0x22'),_0x5c42ca+'-'+_0x9e7810+'/'+_0x40c16c)[_0xf3d6('0x1c')](_0xaa50d7);}return null;};}function patchUpdates(_0x187b0a){return function(_0x228673){try{jsonpatch[_0xf3d6('0x23')](_0x228673,_0x187b0a,!![]);}catch(_0x51c320){return BPromise[_0xf3d6('0x24')](_0x51c320);}return _0x228673[_0xf3d6('0x25')]();};}function saveUpdates(_0x254dc9,_0x369575){return function(_0x56bcea){if(_0x56bcea){return _0x56bcea[_0xf3d6('0x26')](_0x254dc9)[_0xf3d6('0x27')](function(_0x8a2bca){return _0x8a2bca;});}return null;};}function removeEntity(_0x1d09d4,_0x479167){return function(_0x14cc8b){if(_0x14cc8b){return _0x14cc8b[_0xf3d6('0x28')]()[_0xf3d6('0x27')](function(){var _0x4d93cd=_0x14cc8b[_0xf3d6('0x29')]({'plain':!![]});var _0x577291='CmHopperAdditionalPhones';return db[_0xf3d6('0x2a')]['destroy']({'where':{'type':_0x577291,'resourceId':_0x4d93cd['id']}})['then'](function(){return _0x14cc8b;});})[_0xf3d6('0x27')](function(){_0x1d09d4['status'](0xcc)[_0xf3d6('0x1a')]();});}};}function handleEntityNotFound(_0x3718b8,_0x25a5b2){return function(_0x554671){if(!_0x554671){_0x3718b8[_0xf3d6('0x19')](0x194);}return _0x554671;};}function handleError(_0x39b4ae,_0x10fddf){_0x10fddf=_0x10fddf||0x1f4;return function(_0x3cd555){logger[_0xf3d6('0x2b')](_0x3cd555[_0xf3d6('0x2c')]);if(_0x3cd555['name']){delete _0x3cd555['name'];}_0x39b4ae[_0xf3d6('0x1b')](_0x10fddf)['send'](_0x3cd555);};}exports['index']=function(_0x5e8bc0,_0x15dbd7){var _0x3661cd={},_0x12e8f2={},_0x21fdf5={'count':0x0,'rows':[]};var _0x3410bd=_[_0xf3d6('0x2d')](db[_0xf3d6('0x2e')][_0xf3d6('0x2f')],function(_0x596f11){return{'name':_0x596f11[_0xf3d6('0x30')],'type':_0x596f11[_0xf3d6('0x31')][_0xf3d6('0x32')]};});_0x12e8f2['model']=_[_0xf3d6('0x2d')](_0x3410bd,'name');_0x12e8f2[_0xf3d6('0x33')]=_[_0xf3d6('0x34')](_0x5e8bc0[_0xf3d6('0x33')]);_0x12e8f2[_0xf3d6('0x35')]=_[_0xf3d6('0x36')](_0x12e8f2['model'],_0x12e8f2[_0xf3d6('0x33')]);_0x3661cd[_0xf3d6('0x37')]=_['intersection'](_0x12e8f2[_0xf3d6('0x38')],qs[_0xf3d6('0x39')](_0x5e8bc0[_0xf3d6('0x33')][_0xf3d6('0x39')]));_0x3661cd[_0xf3d6('0x37')]=_0x3661cd[_0xf3d6('0x37')]['length']?_0x3661cd['attributes']:_0x12e8f2[_0xf3d6('0x38')];if(!_0x5e8bc0[_0xf3d6('0x33')]['hasOwnProperty']('nolimit')){_0x3661cd[_0xf3d6('0x1f')]=qs[_0xf3d6('0x1f')](_0x5e8bc0[_0xf3d6('0x33')][_0xf3d6('0x1f')]);_0x3661cd['offset']=qs[_0xf3d6('0x1d')](_0x5e8bc0['query'][_0xf3d6('0x1d')]);}_0x3661cd[_0xf3d6('0x3a')]=qs[_0xf3d6('0x3b')](_0x5e8bc0['query'][_0xf3d6('0x3b')]);_0x3661cd[_0xf3d6('0x3c')]=qs[_0xf3d6('0x35')](_[_0xf3d6('0x3d')](_0x5e8bc0[_0xf3d6('0x33')],_0x12e8f2['filters']),_0x3410bd);if(_0x5e8bc0[_0xf3d6('0x33')][_0xf3d6('0x3e')]){_0x3661cd[_0xf3d6('0x3c')]=_[_0xf3d6('0x3f')](_0x3661cd[_0xf3d6('0x3c')],{'$or':_[_0xf3d6('0x2d')](_0x3410bd,function(_0x598073){if(_0x598073[_0xf3d6('0x31')]!==_0xf3d6('0x40')){var _0x500a7a={};_0x500a7a[_0x598073[_0xf3d6('0x41')]]={'$like':'%'+_0x5e8bc0[_0xf3d6('0x33')]['filter']+'%'};return _0x500a7a;}})});}_0x3661cd=_[_0xf3d6('0x3f')]({},_0x3661cd,_0x5e8bc0[_0xf3d6('0x42')]);var _0x704d4c={'where':_0x3661cd['where']};return db['CmHopperAdditionalPhone']['count'](_0x704d4c)[_0xf3d6('0x27')](function(_0x477fe2){_0x21fdf5[_0xf3d6('0x20')]=_0x477fe2;if(_0x5e8bc0[_0xf3d6('0x33')][_0xf3d6('0x43')]){_0x3661cd[_0xf3d6('0x44')]=[{'all':!![]}];}return db[_0xf3d6('0x2e')][_0xf3d6('0x45')](_0x3661cd);})['then'](function(_0x2c77ff){_0x21fdf5[_0xf3d6('0x46')]=_0x2c77ff;return _0x21fdf5;})['then'](respondWithFilteredResult(_0x15dbd7,_0x3661cd))[_0xf3d6('0x47')](handleError(_0x15dbd7,null));};exports[_0xf3d6('0x48')]=function(_0x372644,_0x288baa){var _0x415cd4={'raw':!![],'where':{'id':_0x372644[_0xf3d6('0x49')]['id']}},_0x453367={};_0x453367[_0xf3d6('0x38')]=_[_0xf3d6('0x34')](db['CmHopperAdditionalPhone'][_0xf3d6('0x2f')]);_0x453367['query']=_['keys'](_0x372644['query']);_0x453367[_0xf3d6('0x35')]=_[_0xf3d6('0x36')](_0x453367['model'],_0x453367['query']);_0x415cd4[_0xf3d6('0x37')]=_[_0xf3d6('0x36')](_0x453367[_0xf3d6('0x38')],qs[_0xf3d6('0x39')](_0x372644[_0xf3d6('0x33')][_0xf3d6('0x39')]));_0x415cd4['attributes']=_0x415cd4[_0xf3d6('0x37')][_0xf3d6('0x4a')]?_0x415cd4['attributes']:_0x453367['model'];if(_0x372644[_0xf3d6('0x33')][_0xf3d6('0x43')]){_0x415cd4[_0xf3d6('0x44')]=[{'all':!![]}];}_0x415cd4=_['merge']({},_0x415cd4,_0x372644['options']);return db[_0xf3d6('0x2e')]['find'](_0x415cd4)[_0xf3d6('0x27')](handleEntityNotFound(_0x288baa,null))[_0xf3d6('0x27')](respondWithResult(_0x288baa,null))['catch'](handleError(_0x288baa,null));};exports[_0xf3d6('0x4b')]=function(_0x4acd55,_0x6d1039){return db[_0xf3d6('0x2e')][_0xf3d6('0x4b')](_0x4acd55[_0xf3d6('0x4c')],{})[_0xf3d6('0x27')](function(_0xef5d6d){var _0x58687b=_0x4acd55['user'][_0xf3d6('0x29')]({'plain':!![]});if(!_0x58687b)throw new Error(_0xf3d6('0x4d'));if(_0x58687b['role']==='user'){var _0x12f513=_0xef5d6d[_0xf3d6('0x29')]({'plain':!![]});var _0x4aee31='CmHopperAdditionalPhones';return db[_0xf3d6('0x4e')][_0xf3d6('0x4f')]({'where':{'name':_0x4aee31,'userProfileId':_0x58687b[_0xf3d6('0x50')]},'raw':!![]})['then'](function(_0x311217){if(_0x311217&&_0x311217[_0xf3d6('0x51')]===0x0){return db[_0xf3d6('0x2a')][_0xf3d6('0x4b')]({'name':_0x12f513[_0xf3d6('0x41')],'resourceId':_0x12f513['id'],'type':_0x311217['name'],'sectionId':_0x311217['id']},{})[_0xf3d6('0x27')](function(){return _0xef5d6d;});}else{return _0xef5d6d;}})['catch'](function(_0x38a0f7){logger[_0xf3d6('0x2b')](_0xf3d6('0x52'),_0x38a0f7);throw _0x38a0f7;});}return _0xef5d6d;})['then'](respondWithResult(_0x6d1039,0xc9))['catch'](handleError(_0x6d1039,null));};exports[_0xf3d6('0x26')]=function(_0x574339,_0x496584){if(_0x574339[_0xf3d6('0x4c')]['id']){delete _0x574339['body']['id'];}return db['CmHopperAdditionalPhone'][_0xf3d6('0x4f')]({'where':{'id':_0x574339[_0xf3d6('0x49')]['id']}})[_0xf3d6('0x27')](handleEntityNotFound(_0x496584,null))[_0xf3d6('0x27')](saveUpdates(_0x574339['body'],null))[_0xf3d6('0x27')](respondWithResult(_0x496584,null))[_0xf3d6('0x47')](handleError(_0x496584,null));};exports[_0xf3d6('0x28')]=function(_0x1d6bc2,_0x2a5989){return db[_0xf3d6('0x2e')][_0xf3d6('0x4f')]({'where':{'id':_0x1d6bc2['params']['id']}})['then'](handleEntityNotFound(_0x2a5989,null))[_0xf3d6('0x27')](removeEntity(_0x2a5989,null))['catch'](handleError(_0x2a5989,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index d336dc2..b535012 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe290=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define'];(function(_0x1ab619,_0x50e866){var _0x299995=function(_0x1a171){while(--_0x1a171){_0x1ab619['push'](_0x1ab619['shift']());}};_0x299995(++_0x50e866);}(_0xe290,0x1d6));var _0x0e29=function(_0x13b593,_0x85a736){_0x13b593=_0x13b593-0x0;var _0x1d2958=_0xe290[_0x13b593];return _0x1d2958;};'use strict';var _=require(_0x0e29('0x0'));var util=require(_0x0e29('0x1'));var logger=require(_0x0e29('0x2'))(_0x0e29('0x3'));var moment=require('moment');var BPromise=require(_0x0e29('0x4'));var rp=require(_0x0e29('0x5'));var fs=require('fs');var path=require(_0x0e29('0x6'));var rimraf=require('rimraf');var config=require(_0x0e29('0x7'));var attributes=require(_0x0e29('0x8'));module[_0x0e29('0x9')]=function(_0x169e72,_0x160649){return _0x169e72[_0x0e29('0xa')](_0x0e29('0xb'),attributes,{'tableName':_0x0e29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3aa=['../../config/logger','api','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x30dd4b,_0x43b8f7){var _0x4b4012=function(_0x1e7237){while(--_0x1e7237){_0x30dd4b['push'](_0x30dd4b['shift']());}};_0x4b4012(++_0x43b8f7);}(_0xe3aa,0x1e3));var _0xae3a=function(_0x50dd2c,_0x286d8a){_0x50dd2c=_0x50dd2c-0x0;var _0x238e58=_0xe3aa[_0x50dd2c];return _0x238e58;};'use strict';var _=require(_0xae3a('0x0'));var util=require('util');var logger=require(_0xae3a('0x1'))(_0xae3a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xae3a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae3a('0x4'));var config=require(_0xae3a('0x5'));var attributes=require(_0xae3a('0x6'));module[_0xae3a('0x7')]=function(_0x4f754b,_0x2505a5){return _0x4f754b[_0xae3a('0x8')](_0xae3a('0x9'),attributes,{'tableName':_0xae3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 94b3704..2118c0b 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02f4=['ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countabandonedretry','SwapAdditionalPhones','CmHopper','duration','waitTime','scheduledat','minutes','isNil','add','updatedAt','phone','createdAt','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0x02f4,0x142));var _0x402f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x02f4[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x402f('0x0'));var util=require(_0x402f('0x1'));var moment=require('moment');var BPromise=require(_0x402f('0x2'));var rs=require(_0x402f('0x3'));var fs=require('fs');var Redis=require(_0x402f('0x4'));var db=require(_0x402f('0x5'))['db'];var utils=require(_0x402f('0x6'));var logger=require(_0x402f('0x7'))(_0x402f('0x8'));var config=require(_0x402f('0x9'));var jayson=require(_0x402f('0xa'));var client=jayson[_0x402f('0xb')][_0x402f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x392904,_0x28ee78,_0x3bc4f1){return new BPromise(function(_0x12bad8,_0x5ca55d){return client['request'](_0x392904,_0x3bc4f1)[_0x402f('0xd')](function(_0x34711d){logger[_0x402f('0xe')](_0x402f('0xf'),_0x28ee78,_0x402f('0x10'));logger['debug'](_0x402f('0x11'),_0x28ee78,_0x402f('0x10'),JSON['stringify'](_0x34711d));if(_0x34711d[_0x402f('0x12')]){if(_0x34711d[_0x402f('0x12')][_0x402f('0x13')]===0x1f4){logger[_0x402f('0x12')](_0x402f('0xf'),_0x28ee78,_0x34711d[_0x402f('0x12')][_0x402f('0x14')]);return _0x5ca55d(_0x34711d[_0x402f('0x12')]['message']);}logger[_0x402f('0x12')](_0x402f('0xf'),_0x28ee78,_0x34711d['error'][_0x402f('0x14')]);return _0x12bad8(_0x34711d[_0x402f('0x12')][_0x402f('0x14')]);}else{logger[_0x402f('0xe')](_0x402f('0xf'),_0x28ee78,_0x402f('0x10'));_0x12bad8(_0x34711d[_0x402f('0x15')][_0x402f('0x14')]);}})[_0x402f('0x16')](function(_0xa71478){logger[_0x402f('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x28ee78,_0xa71478);_0x5ca55d(_0xa71478);});});}exports[_0x402f('0x17')]=function(_0x3a1a29){var _0x2bcd2a=this;return new Promise(function(_0x3066a8,_0x24d650){return db['CmHopper'][_0x402f('0x18')]({'raw':!![],'where':{'ContactId':_0x3a1a29[_0x402f('0x19')][_0x402f('0x1a')],'ListId':_0x3a1a29[_0x402f('0x19')][_0x402f('0x1b')],'VoiceQueueId':_0x3a1a29[_0x402f('0x19')][_0x402f('0x1c')]===undefined?null:_0x3a1a29[_0x402f('0x19')]['VoiceQueueId'],'CampaignId':_0x3a1a29[_0x402f('0x19')][_0x402f('0x1d')]===undefined?null:_0x3a1a29[_0x402f('0x19')][_0x402f('0x1d')]}})['then'](function(_0x4bca0e){if(_0x4bca0e!=null){return db[_0x402f('0x1e')][_0x402f('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4bca0e['id'],'OrderBy':{'$gt':_0x4bca0e[_0x402f('0x1f')]}},'order':[[_0x402f('0x1f'),_0x402f('0x20')]]})[_0x402f('0xd')](function(_0x28a1e4){var _0x48b554=0x0;if(_0x28a1e4){if(_0x28a1e4[_0x402f('0x21')]+_0x28a1e4[_0x402f('0x22')]+_0x28a1e4['countnoanswerretry']+_0x28a1e4[_0x402f('0x23')]+_0x28a1e4[_0x402f('0x24')]+_0x28a1e4['countabandonedretry']+_0x28a1e4[_0x402f('0x25')]+_0x28a1e4[_0x402f('0x26')]<_0x3a1a29[_0x402f('0x27')][_0x402f('0x28')])_0x48b554=0x1;_0x3066a8({'additional':_0x48b554});}else{return db[_0x402f('0x1e')][_0x402f('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4bca0e['id']},'order':[[_0x402f('0x1f'),'ASC']]})[_0x402f('0xd')](function(_0x1d001e){var _0x456564=0x0;if(_0x1d001e){if(_0x1d001e['countbusyretry']+_0x1d001e['countcongestionretry']+_0x1d001e[_0x402f('0x29')]+_0x1d001e['countnosuchnumberretry']+_0x1d001e['countdropretry']+_0x1d001e[_0x402f('0x2a')]+_0x1d001e[_0x402f('0x25')]+_0x1d001e['countagentrejectretry']<_0x3a1a29[_0x402f('0x27')][_0x402f('0x28')])_0x456564=0x1;_0x3066a8({'additional':_0x456564});}else{_0x3066a8({'additional':0x0});}})['catch'](function(_0xaf6cf8){logger[_0x402f('0x12')](_0x402f('0x17'),_0xaf6cf8[_0x402f('0x14')]);_0x24d650(_0x2bcd2a[_0x402f('0x12')](0x1f4,_0xaf6cf8[_0x402f('0x14')]));});}})['catch'](function(_0x205038){logger[_0x402f('0x12')](_0x402f('0x17'),_0x205038['message']);_0x24d650(_0x2bcd2a[_0x402f('0x12')](0x1f4,_0x205038[_0x402f('0x14')]));});}else _0x3066a8({'additional':0x0});});});};exports[_0x402f('0x2b')]=function(_0x4f50f2){var _0x1ca7f3=this;return new Promise(function(_0x3b1398,_0x4c9880){return db[_0x402f('0x2c')][_0x402f('0x18')]({'raw':!![],'where':{'ContactId':_0x4f50f2['body'][_0x402f('0x1a')],'ListId':_0x4f50f2['body'][_0x402f('0x1b')],'VoiceQueueId':_0x4f50f2[_0x402f('0x19')][_0x402f('0x1c')]===undefined?null:_0x4f50f2[_0x402f('0x19')]['VoiceQueueId'],'CampaignId':_0x4f50f2[_0x402f('0x19')][_0x402f('0x1d')]===undefined?null:_0x4f50f2[_0x402f('0x19')]['CampaignId']}})[_0x402f('0xd')](function(_0x587503){if(_0x587503!=null){return db[_0x402f('0x1e')][_0x402f('0x18')]({'raw':!![],'where':{'CmHopperId':_0x587503['id'],'OrderBy':{'$gte':_0x587503[_0x402f('0x1f')]}},'order':[[_0x402f('0x1f'),_0x402f('0x20')]]})[_0x402f('0xd')](function(_0x2589c9){if(_0x2589c9)return activateAdditionalPhone(_0x587503,_0x4f50f2[_0x402f('0x19')],_0x2589c9,_0x4f50f2[_0x402f('0x2d')],_0x4f50f2['waitTime'])[_0x402f('0xd')](function(_0x55ecce){_0x3b1398(_0x55ecce);});else{return db[_0x402f('0x1e')][_0x402f('0x18')]({'raw':!![],'where':{'CmHopperId':_0x587503['id']},'order':[[_0x402f('0x1f'),_0x402f('0x20')]]})[_0x402f('0xd')](function(_0x4a3b8c){if(_0x4a3b8c)return activateAdditionalPhone(_0x587503,_0x4f50f2[_0x402f('0x19')],_0x4a3b8c,_0x4f50f2[_0x402f('0x2d')],_0x4f50f2[_0x402f('0x2e')])[_0x402f('0xd')](function(_0x406041){_0x3b1398(_0x406041);});else{_0x3b1398({'id':_0x587503['id'],'phone':''});}})[_0x402f('0x16')](function(_0x68d0aa){logger[_0x402f('0x12')](_0x402f('0x17'),_0x68d0aa[_0x402f('0x14')]);_0x4c9880(_0x1ca7f3['error'](0x1f4,_0x68d0aa[_0x402f('0x14')]));});}})[_0x402f('0x16')](function(_0x2c7e00){logger[_0x402f('0x12')](_0x402f('0x17'),_0x2c7e00[_0x402f('0x14')]);_0x4c9880(_0x1ca7f3[_0x402f('0x12')](0x1f4,_0x2c7e00[_0x402f('0x14')]));});}else _0x3b1398(0x1);});});};function activateAdditionalPhone(_0x29c591,_0xbc0d4c,_0x204e47,_0x453553,_0x1a330e){return new Promise(function(_0x1d2f0b,_0x542fa0){var _0x4bd246;if(_['isNil'](_0x204e47[_0x402f('0x2f')])){_0x204e47[_0x402f('0x2f')]=moment();}if(moment()>moment(_0x204e47['scheduledat'])){_0x4bd246=moment()['add'](_0x1a330e||0x3,_0x402f('0x30'));}else{if(_0x204e47[_0x402f('0x1f')]==0x0){_0x4bd246=moment(_0x204e47[_0x402f('0x2f')]);}else{_0x4bd246=moment()['add'](_0x1a330e||0x3,_0x402f('0x30'));}}if(_[_0x402f('0x31')](_0x4bd246)){_0x4bd246=moment()[_0x402f('0x32')](_0x1a330e||0x3,_0x402f('0x30'));}var _0x5cfa47={'phone':_0x29c591['phone'],'active':0x0,'OrderBy':_[_0x402f('0x31')](_0x29c591[_0x402f('0x1f')])?0x0:_0x29c591[_0x402f('0x1f')],'scheduledat':moment()[_0x402f('0x32')](_0x453553||0x1,_0x402f('0x30')),'countbusyretry':_0xbc0d4c[_0x402f('0x21')],'countcongestionretry':_0xbc0d4c[_0x402f('0x22')],'countnoanswerretry':_0xbc0d4c['countnoanswerretry'],'countnosuchnumberretry':_0xbc0d4c[_0x402f('0x23')],'countdropretry':_0xbc0d4c['countdropretry'],'countabandonedretry':_0xbc0d4c[_0x402f('0x2a')],'countmachineretry':_0xbc0d4c[_0x402f('0x25')],'countagentrejectretry':_0xbc0d4c[_0x402f('0x26')],'createdAt':_0xbc0d4c['createdAt'],'updatedAt':_0xbc0d4c[_0x402f('0x33')]};var _0x36b963={'CmHopperId':_0x29c591['id'],'phone':_0x204e47[_0x402f('0x34')],'active':0x0,'OrderBy':_[_0x402f('0x31')](_0x204e47[_0x402f('0x1f')])?0x0:_0x204e47[_0x402f('0x1f')],'scheduledat':_0x4bd246,'countbusyretry':_0x204e47[_0x402f('0x21')],'countcongestionretry':_0x204e47[_0x402f('0x22')],'countnoanswerretry':_0x204e47['countnoanswerretry'],'countnosuchnumberretry':_0x204e47[_0x402f('0x23')],'countdropretry':_0x204e47[_0x402f('0x24')],'countabandonedretry':_0x204e47[_0x402f('0x2a')],'countmachineretry':_0x204e47['countmachineretry'],'countagentrejectretry':_0x204e47[_0x402f('0x26')],'createdAt':_0x204e47[_0x402f('0x35')],'updatedAt':_0x204e47[_0x402f('0x33')]};return db[_0x402f('0x36')][_0x402f('0x37')](function(_0xe08d56){return db['CmHopperAdditionalPhone'][_0x402f('0x38')](_0x5cfa47,{'where':{'id':_0x204e47['id']}},{'transaction':_0xe08d56})[_0x402f('0xd')](function(){return db[_0x402f('0x2c')]['update'](_0x36b963,{'where':{'id':_0x29c591['id']}},{'transaction':_0xe08d56});});})['then'](function(_0x5eb9b1){_0x1d2f0b({'id':_0x29c591['id'],'phone':_0x204e47['phone']});})['catch'](function(_0x16b659){logger[_0x402f('0x12')]('activateAdditionalPhone',_0x16b659[_0x402f('0x14')]);_0x542fa0({'error':_0x16b659['message']});});});}exports[_0x402f('0x39')]=function(_0x3e6148){var _0x2f05d0=this;return new Promise(function(_0x3d6d15,_0x471125){return db[_0x402f('0x2c')][_0x402f('0x38')](_0x3e6148[_0x402f('0x19')][_0x402f('0x3a')],{'where':{'id':_0x3e6148[_0x402f('0x19')]['id']}})[_0x402f('0xd')](function(_0x3c5afc){_0x3d6d15(_0x3c5afc);})[_0x402f('0x16')](function(_0x43214d){logger['error'](_0x402f('0x39'),_0x43214d[_0x402f('0x14')]);_0x471125(_0x2f05d0['error'](0x1f4,_0x43214d[_0x402f('0x14')]));});});}; \ No newline at end of file +var _0xe5d6=['add','minutes','isNil','phone','createdAt','updatedAt','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','body','ListId','VoiceQueueId','CampaignId','then','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countcongestionretry','findOne','ContactId','waitTime','duration','scheduledat'];(function(_0x157df5,_0x33f022){var _0x4972ed=function(_0x4d6792){while(--_0x4d6792){_0x157df5['push'](_0x157df5['shift']());}};_0x4972ed(++_0x33f022);}(_0xe5d6,0xba));var _0x6e5d=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xe5d6[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x6e5d('0x0'));var util=require(_0x6e5d('0x1'));var moment=require(_0x6e5d('0x2'));var BPromise=require(_0x6e5d('0x3'));var rs=require(_0x6e5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e5d('0x5'))['db'];var utils=require(_0x6e5d('0x6'));var logger=require(_0x6e5d('0x7'))(_0x6e5d('0x8'));var config=require(_0x6e5d('0x9'));var jayson=require(_0x6e5d('0xa'));var client=jayson[_0x6e5d('0xb')][_0x6e5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18f7b4,_0x25152b,_0x264e29){return new BPromise(function(_0x52387b,_0x5b8f3c){return client[_0x6e5d('0xd')](_0x18f7b4,_0x264e29)['then'](function(_0x28ac0a){logger['info'](_0x6e5d('0xe'),_0x25152b,_0x6e5d('0xf'));logger[_0x6e5d('0x10')](_0x6e5d('0x11'),_0x25152b,_0x6e5d('0xf'),JSON[_0x6e5d('0x12')](_0x28ac0a));if(_0x28ac0a['error']){if(_0x28ac0a[_0x6e5d('0x13')][_0x6e5d('0x14')]===0x1f4){logger[_0x6e5d('0x13')](_0x6e5d('0xe'),_0x25152b,_0x28ac0a[_0x6e5d('0x13')][_0x6e5d('0x15')]);return _0x5b8f3c(_0x28ac0a[_0x6e5d('0x13')]['message']);}logger[_0x6e5d('0x13')](_0x6e5d('0xe'),_0x25152b,_0x28ac0a[_0x6e5d('0x13')]['message']);return _0x52387b(_0x28ac0a[_0x6e5d('0x13')][_0x6e5d('0x15')]);}else{logger[_0x6e5d('0x16')](_0x6e5d('0xe'),_0x25152b,'request\x20sent');_0x52387b(_0x28ac0a[_0x6e5d('0x17')][_0x6e5d('0x15')]);}})[_0x6e5d('0x18')](function(_0x3e4745){logger['error'](_0x6e5d('0xe'),_0x25152b,_0x3e4745);_0x5b8f3c(_0x3e4745);});});}exports[_0x6e5d('0x19')]=function(_0x3b11ad){var _0x1a8b08=this;return new Promise(function(_0x71f6be,_0x4606f3){return db[_0x6e5d('0x1a')]['findOne']({'raw':!![],'where':{'ContactId':_0x3b11ad[_0x6e5d('0x1b')]['ContactId'],'ListId':_0x3b11ad[_0x6e5d('0x1b')][_0x6e5d('0x1c')],'VoiceQueueId':_0x3b11ad['body'][_0x6e5d('0x1d')]===undefined?null:_0x3b11ad[_0x6e5d('0x1b')]['VoiceQueueId'],'CampaignId':_0x3b11ad[_0x6e5d('0x1b')][_0x6e5d('0x1e')]===undefined?null:_0x3b11ad['body'][_0x6e5d('0x1e')]}})[_0x6e5d('0x1f')](function(_0x4a9c5f){if(_0x4a9c5f!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4a9c5f['id'],'OrderBy':{'$gt':_0x4a9c5f[_0x6e5d('0x20')]}},'order':[[_0x6e5d('0x20'),_0x6e5d('0x21')]]})[_0x6e5d('0x1f')](function(_0xc1c432){var _0x323bc4=0x0;if(_0xc1c432){if(_0xc1c432[_0x6e5d('0x22')]+_0xc1c432['countcongestionretry']+_0xc1c432[_0x6e5d('0x23')]+_0xc1c432[_0x6e5d('0x24')]+_0xc1c432[_0x6e5d('0x25')]+_0xc1c432[_0x6e5d('0x26')]+_0xc1c432[_0x6e5d('0x27')]+_0xc1c432[_0x6e5d('0x28')]<_0x3b11ad[_0x6e5d('0x29')][_0x6e5d('0x2a')])_0x323bc4=0x1;_0x71f6be({'additional':_0x323bc4});}else{return db[_0x6e5d('0x2b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4a9c5f['id']},'order':[[_0x6e5d('0x20'),_0x6e5d('0x21')]]})[_0x6e5d('0x1f')](function(_0x5b5225){var _0x3c98ba=0x0;if(_0x5b5225){if(_0x5b5225['countbusyretry']+_0x5b5225[_0x6e5d('0x2c')]+_0x5b5225[_0x6e5d('0x23')]+_0x5b5225['countnosuchnumberretry']+_0x5b5225[_0x6e5d('0x25')]+_0x5b5225[_0x6e5d('0x26')]+_0x5b5225[_0x6e5d('0x27')]+_0x5b5225[_0x6e5d('0x28')]<_0x3b11ad[_0x6e5d('0x29')]['dialGlobalMaxRetry'])_0x3c98ba=0x1;_0x71f6be({'additional':_0x3c98ba});}else{_0x71f6be({'additional':0x0});}})[_0x6e5d('0x18')](function(_0x5cb6db){logger[_0x6e5d('0x13')](_0x6e5d('0x19'),_0x5cb6db[_0x6e5d('0x15')]);_0x4606f3(_0x1a8b08[_0x6e5d('0x13')](0x1f4,_0x5cb6db['message']));});}})['catch'](function(_0x6c3d49){logger[_0x6e5d('0x13')](_0x6e5d('0x19'),_0x6c3d49[_0x6e5d('0x15')]);_0x4606f3(_0x1a8b08[_0x6e5d('0x13')](0x1f4,_0x6c3d49[_0x6e5d('0x15')]));});}else _0x71f6be({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x47df1c){var _0x34ce1e=this;return new Promise(function(_0x54fe34,_0x36e8df){return db[_0x6e5d('0x1a')][_0x6e5d('0x2d')]({'raw':!![],'where':{'ContactId':_0x47df1c[_0x6e5d('0x1b')][_0x6e5d('0x2e')],'ListId':_0x47df1c[_0x6e5d('0x1b')][_0x6e5d('0x1c')],'VoiceQueueId':_0x47df1c[_0x6e5d('0x1b')]['VoiceQueueId']===undefined?null:_0x47df1c[_0x6e5d('0x1b')][_0x6e5d('0x1d')],'CampaignId':_0x47df1c['body'][_0x6e5d('0x1e')]===undefined?null:_0x47df1c['body'][_0x6e5d('0x1e')]}})[_0x6e5d('0x1f')](function(_0x46b431){if(_0x46b431!=null){return db[_0x6e5d('0x2b')][_0x6e5d('0x2d')]({'raw':!![],'where':{'CmHopperId':_0x46b431['id'],'OrderBy':{'$gte':_0x46b431[_0x6e5d('0x20')]}},'order':[[_0x6e5d('0x20'),_0x6e5d('0x21')]]})['then'](function(_0x55a7b6){if(_0x55a7b6)return activateAdditionalPhone(_0x46b431,_0x47df1c['body'],_0x55a7b6,_0x47df1c['duration'],_0x47df1c[_0x6e5d('0x2f')])[_0x6e5d('0x1f')](function(_0xb4be9c){_0x54fe34(_0xb4be9c);});else{return db[_0x6e5d('0x2b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x46b431['id']},'order':[['OrderBy',_0x6e5d('0x21')]]})[_0x6e5d('0x1f')](function(_0x315c0c){if(_0x315c0c)return activateAdditionalPhone(_0x46b431,_0x47df1c[_0x6e5d('0x1b')],_0x315c0c,_0x47df1c[_0x6e5d('0x30')],_0x47df1c[_0x6e5d('0x2f')])[_0x6e5d('0x1f')](function(_0x393fae){_0x54fe34(_0x393fae);});else{_0x54fe34({'id':_0x46b431['id'],'phone':''});}})[_0x6e5d('0x18')](function(_0x20aa81){logger[_0x6e5d('0x13')](_0x6e5d('0x19'),_0x20aa81[_0x6e5d('0x15')]);_0x36e8df(_0x34ce1e[_0x6e5d('0x13')](0x1f4,_0x20aa81[_0x6e5d('0x15')]));});}})['catch'](function(_0x545d75){logger[_0x6e5d('0x13')](_0x6e5d('0x19'),_0x545d75[_0x6e5d('0x15')]);_0x36e8df(_0x34ce1e[_0x6e5d('0x13')](0x1f4,_0x545d75[_0x6e5d('0x15')]));});}else _0x54fe34(0x1);});});};function activateAdditionalPhone(_0x1da82a,_0x65fb1c,_0x412b8f,_0x15ff06,_0x2ed923){return new Promise(function(_0x3c1214,_0x4b844d){var _0x212a96;if(_['isNil'](_0x412b8f['scheduledat'])){_0x412b8f[_0x6e5d('0x31')]=moment();}if(moment()>moment(_0x412b8f[_0x6e5d('0x31')])){_0x212a96=moment()[_0x6e5d('0x32')](_0x2ed923||0x3,_0x6e5d('0x33'));}else{if(_0x412b8f['OrderBy']==0x0){_0x212a96=moment(_0x412b8f['scheduledat']);}else{_0x212a96=moment()['add'](_0x2ed923||0x3,_0x6e5d('0x33'));}}if(_[_0x6e5d('0x34')](_0x212a96)){_0x212a96=moment()[_0x6e5d('0x32')](_0x2ed923||0x3,_0x6e5d('0x33'));}var _0x50e05a={'phone':_0x1da82a[_0x6e5d('0x35')],'active':0x0,'OrderBy':_[_0x6e5d('0x34')](_0x1da82a[_0x6e5d('0x20')])?0x0:_0x1da82a[_0x6e5d('0x20')],'scheduledat':moment()[_0x6e5d('0x32')](_0x15ff06||0x1,'minutes'),'countbusyretry':_0x65fb1c['countbusyretry'],'countcongestionretry':_0x65fb1c['countcongestionretry'],'countnoanswerretry':_0x65fb1c[_0x6e5d('0x23')],'countnosuchnumberretry':_0x65fb1c[_0x6e5d('0x24')],'countdropretry':_0x65fb1c[_0x6e5d('0x25')],'countabandonedretry':_0x65fb1c[_0x6e5d('0x26')],'countmachineretry':_0x65fb1c[_0x6e5d('0x27')],'countagentrejectretry':_0x65fb1c[_0x6e5d('0x28')],'createdAt':_0x65fb1c[_0x6e5d('0x36')],'updatedAt':_0x65fb1c[_0x6e5d('0x37')]};var _0x6acd34={'CmHopperId':_0x1da82a['id'],'phone':_0x412b8f[_0x6e5d('0x35')],'active':0x0,'OrderBy':_[_0x6e5d('0x34')](_0x412b8f['OrderBy'])?0x0:_0x412b8f[_0x6e5d('0x20')],'scheduledat':_0x212a96,'countbusyretry':_0x412b8f[_0x6e5d('0x22')],'countcongestionretry':_0x412b8f[_0x6e5d('0x2c')],'countnoanswerretry':_0x412b8f[_0x6e5d('0x23')],'countnosuchnumberretry':_0x412b8f['countnosuchnumberretry'],'countdropretry':_0x412b8f[_0x6e5d('0x25')],'countabandonedretry':_0x412b8f[_0x6e5d('0x26')],'countmachineretry':_0x412b8f[_0x6e5d('0x27')],'countagentrejectretry':_0x412b8f[_0x6e5d('0x28')],'createdAt':_0x412b8f['createdAt'],'updatedAt':_0x412b8f['updatedAt']};return db['sequelize']['transaction'](function(_0xc66dba){return db[_0x6e5d('0x2b')][_0x6e5d('0x38')](_0x50e05a,{'where':{'id':_0x412b8f['id']}},{'transaction':_0xc66dba})['then'](function(){return db[_0x6e5d('0x1a')][_0x6e5d('0x38')](_0x6acd34,{'where':{'id':_0x1da82a['id']}},{'transaction':_0xc66dba});});})[_0x6e5d('0x1f')](function(_0x4339b2){_0x3c1214({'id':_0x1da82a['id'],'phone':_0x412b8f[_0x6e5d('0x35')]});})['catch'](function(_0x3aa8e3){logger[_0x6e5d('0x13')](_0x6e5d('0x39'),_0x3aa8e3[_0x6e5d('0x15')]);_0x4b844d({'error':_0x3aa8e3[_0x6e5d('0x15')]});});});}exports[_0x6e5d('0x3a')]=function(_0x21f7fd){var _0x6fc33=this;return new Promise(function(_0x26e82e,_0x118d70){return db[_0x6e5d('0x1a')]['update'](_0x21f7fd[_0x6e5d('0x1b')]['field'],{'where':{'id':_0x21f7fd[_0x6e5d('0x1b')]['id']}})[_0x6e5d('0x1f')](function(_0x16cd63){_0x26e82e(_0x16cd63);})['catch'](function(_0x64b79){logger[_0x6e5d('0x13')](_0x6e5d('0x3a'),_0x64b79[_0x6e5d('0x15')]);_0x118d70(_0x6fc33['error'](0x1f4,_0x64b79[_0x6e5d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 635df14..c3600c2 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbab8=['delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0xbab8,0xf2));var _0x8bab=function(_0x158876,_0x8600fe){_0x158876=_0x158876-0x0;var _0x51c285=_0xbab8[_0x158876];return _0x51c285;};'use strict';var multer=require(_0x8bab('0x0'));var util=require(_0x8bab('0x1'));var path=require('path');var timeout=require(_0x8bab('0x2'));var express=require('express');var router=express[_0x8bab('0x3')]();var fs_extra=require(_0x8bab('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8bab('0x5'));var config=require(_0x8bab('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x8bab('0x7')]('/',auth[_0x8bab('0x8')](),controller[_0x8bab('0x9')]);router['get']('/:id',auth[_0x8bab('0x8')](),controller['show']);router[_0x8bab('0xa')]('/',auth[_0x8bab('0x8')](),controller[_0x8bab('0xb')]);router[_0x8bab('0xc')]('/:id',auth[_0x8bab('0x8')](),controller['update']);router[_0x8bab('0xd')](_0x8bab('0xe'),auth[_0x8bab('0x8')](),controller[_0x8bab('0xf')]);module[_0x8bab('0x10')]=router; \ No newline at end of file +var _0x6964=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','/:id','show','post','put'];(function(_0x283cce,_0x27ecaf){var _0x2d0667=function(_0x5511c9){while(--_0x5511c9){_0x283cce['push'](_0x283cce['shift']());}};_0x2d0667(++_0x27ecaf);}(_0x6964,0x114));var _0x4696=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x6964[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0x4696('0x0'));var util=require('util');var path=require(_0x4696('0x1'));var timeout=require(_0x4696('0x2'));var express=require('express');var router=express[_0x4696('0x3')]();var fs_extra=require(_0x4696('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4696('0x5'));var config=require(_0x4696('0x6'));var controller=require(_0x4696('0x7'));router['get']('/',auth[_0x4696('0x8')](),controller['index']);router['get'](_0x4696('0x9'),auth[_0x4696('0x8')](),controller[_0x4696('0xa')]);router[_0x4696('0xb')]('/',auth[_0x4696('0x8')](),controller['create']);router[_0x4696('0xc')](_0x4696('0x9'),auth[_0x4696('0x8')](),controller[_0x4696('0xd')]);router[_0x4696('0xe')](_0x4696('0x9'),auth[_0x4696('0x8')](),controller[_0x4696('0xf')]);module[_0x4696('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c4220a3..98c5bd6 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 _0x7412=['STRING','contactListQueue','moment'];(function(_0x151787,_0x77ec0f){var _0x35f544=function(_0x5c22d4){while(--_0x5c22d4){_0x151787['push'](_0x151787['shift']());}};_0x35f544(++_0x77ec0f);}(_0x7412,0x161));var _0x2741=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x7412[_0x17928f];return _0x500b63;};'use strict';var moment=require(_0x2741('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x2741('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x2741('0x2')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x6e6f=['INTEGER','contactListQueue','sequelize','exports'];(function(_0x46bd05,_0x173661){var _0x2b3e22=function(_0x8cf45){while(--_0x8cf45){_0x46bd05['push'](_0x46bd05['shift']());}};_0x2b3e22(++_0x173661);}(_0x6e6f,0x76));var _0xf6e6=function(_0x3da7a1,_0x151473){_0x3da7a1=_0x3da7a1-0x0;var _0x3b7290=_0x6e6f[_0x3da7a1];return _0x3b7290;};'use strict';var moment=require('moment');var Sequelize=require(_0xf6e6('0x0'));module[_0xf6e6('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf6e6('0x2')],'unique':_0xf6e6('0x3')},'ListId':{'type':Sequelize[_0xf6e6('0x2')],'unique':_0xf6e6('0x3')},'VoiceQueueId':{'type':Sequelize[_0xf6e6('0x2')],'unique':_0xf6e6('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 63cfb16..48df770 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 _0x5a94=['send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopperBlack','includeAll','include','findAll','show','find','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','stack','name'];(function(_0x5e2cb4,_0x592c64){var _0x282902=function(_0x1c1836){while(--_0x1c1836){_0x5e2cb4['push'](_0x5e2cb4['shift']());}};_0x282902(++_0x592c64);}(_0x5a94,0x1e5));var _0x45a9=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x5a94[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require(_0x45a9('0x0'));var rimraf=require(_0x45a9('0x1'));var zipdir=require(_0x45a9('0x2'));var jsonpatch=require(_0x45a9('0x3'));var rp=require(_0x45a9('0x4'));var moment=require(_0x45a9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x45a9('0x6'));var path=require(_0x45a9('0x7'));var sox=require(_0x45a9('0x8'));var csv=require(_0x45a9('0x9'));var ejs=require(_0x45a9('0xa'));var fs=require('fs');var fs_extra=require(_0x45a9('0xb'));var _=require(_0x45a9('0xc'));var squel=require(_0x45a9('0xd'));var crypto=require(_0x45a9('0xe'));var jsforce=require(_0x45a9('0xf'));var deskjs=require(_0x45a9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x45a9('0x11'));var Papa=require(_0x45a9('0x12'));var Redis=require('ioredis');var authService=require(_0x45a9('0x13'));var qs=require(_0x45a9('0x14'));var as=require(_0x45a9('0x15'));var hardwareService=require(_0x45a9('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x45a9('0x17'));var licenseUtil=require(_0x45a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6869c1,_0x3578bf){_0x3578bf=_0x3578bf||0xcc;return function(_0x1baac1){if(_0x1baac1){return _0x6869c1[_0x45a9('0x19')](_0x3578bf);}return _0x6869c1[_0x45a9('0x1a')](_0x3578bf)[_0x45a9('0x1b')]();};}function respondWithResult(_0x262361,_0x4efbda){_0x4efbda=_0x4efbda||0xc8;return function(_0x2d13f9){if(_0x2d13f9){return _0x262361[_0x45a9('0x1a')](_0x4efbda)[_0x45a9('0x1c')](_0x2d13f9);}};}function respondWithFilteredResult(_0x59a7a7,_0x2ef445){return function(_0x34f533){if(_0x34f533){var _0x31070e=typeof _0x2ef445[_0x45a9('0x1d')]===_0x45a9('0x1e')&&typeof _0x2ef445[_0x45a9('0x1f')]===_0x45a9('0x1e');var _0x198ea9=_0x34f533[_0x45a9('0x20')];var _0x2aedee=_0x31070e?0x0:_0x2ef445[_0x45a9('0x1d')];var _0x3b3b2f=_0x31070e?_0x34f533[_0x45a9('0x20')]:_0x2ef445['offset']+_0x2ef445[_0x45a9('0x1f')];var _0x4b1cc9;if(_0x3b3b2f>=_0x198ea9){_0x3b3b2f=_0x198ea9;_0x4b1cc9=0xc8;}else{_0x4b1cc9=0xce;}_0x59a7a7[_0x45a9('0x1a')](_0x4b1cc9);return _0x59a7a7[_0x45a9('0x21')]('Content-Range',_0x2aedee+'-'+_0x3b3b2f+'/'+_0x198ea9)['json'](_0x34f533);}return null;};}function patchUpdates(_0x5859f6){return function(_0x30028a){try{jsonpatch[_0x45a9('0x22')](_0x30028a,_0x5859f6,!![]);}catch(_0x1f2735){return BPromise['reject'](_0x1f2735);}return _0x30028a['save']();};}function saveUpdates(_0x34598f,_0x62cb9f){return function(_0x15baff){if(_0x15baff){return _0x15baff[_0x45a9('0x23')](_0x34598f)[_0x45a9('0x24')](function(_0x5a1952){return _0x5a1952;});}return null;};}function removeEntity(_0x19dfb,_0x5a8216){return function(_0x161fef){if(_0x161fef){return _0x161fef[_0x45a9('0x25')]()['then'](function(){_0x19dfb['status'](0xcc)[_0x45a9('0x1b')]();});}};}function handleEntityNotFound(_0x57f229,_0x23693b){return function(_0x42a0a1){if(!_0x42a0a1){_0x57f229[_0x45a9('0x19')](0x194);}return _0x42a0a1;};}function handleError(_0x132798,_0x46c7ed){_0x46c7ed=_0x46c7ed||0x1f4;return function(_0x1fccf5){logger['error'](_0x1fccf5[_0x45a9('0x26')]);if(_0x1fccf5[_0x45a9('0x27')]){delete _0x1fccf5[_0x45a9('0x27')];}_0x132798[_0x45a9('0x1a')](_0x46c7ed)[_0x45a9('0x28')](_0x1fccf5);};}exports[_0x45a9('0x29')]=function(_0x349d44,_0x18f1ca){var _0x46acfd={},_0x3e4cb1={},_0x13874a={'count':0x0,'rows':[]};var _0x30238e=_['map'](db['CmHopperBlack'][_0x45a9('0x2a')],function(_0x1a083a){return{'name':_0x1a083a[_0x45a9('0x2b')],'type':_0x1a083a[_0x45a9('0x2c')][_0x45a9('0x2d')]};});_0x3e4cb1[_0x45a9('0x2e')]=_[_0x45a9('0x2f')](_0x30238e,_0x45a9('0x27'));_0x3e4cb1[_0x45a9('0x30')]=_[_0x45a9('0x31')](_0x349d44['query']);_0x3e4cb1[_0x45a9('0x32')]=_[_0x45a9('0x33')](_0x3e4cb1[_0x45a9('0x2e')],_0x3e4cb1[_0x45a9('0x30')]);_0x46acfd['attributes']=_['intersection'](_0x3e4cb1[_0x45a9('0x2e')],qs[_0x45a9('0x34')](_0x349d44['query'][_0x45a9('0x34')]));_0x46acfd[_0x45a9('0x35')]=_0x46acfd[_0x45a9('0x35')][_0x45a9('0x36')]?_0x46acfd[_0x45a9('0x35')]:_0x3e4cb1[_0x45a9('0x2e')];if(!_0x349d44[_0x45a9('0x30')][_0x45a9('0x37')](_0x45a9('0x38'))){_0x46acfd['limit']=qs[_0x45a9('0x1f')](_0x349d44['query'][_0x45a9('0x1f')]);_0x46acfd[_0x45a9('0x1d')]=qs['offset'](_0x349d44['query'][_0x45a9('0x1d')]);}_0x46acfd[_0x45a9('0x39')]=qs['sort'](_0x349d44['query'][_0x45a9('0x3a')]);_0x46acfd[_0x45a9('0x3b')]=qs[_0x45a9('0x32')](_[_0x45a9('0x3c')](_0x349d44['query'],_0x3e4cb1[_0x45a9('0x32')]),_0x30238e);if(_0x349d44['query']['filter']){_0x46acfd[_0x45a9('0x3b')]=_[_0x45a9('0x3d')](_0x46acfd[_0x45a9('0x3b')],{'$or':_['map'](_0x30238e,function(_0x15f09b){if(_0x15f09b[_0x45a9('0x2c')]!==_0x45a9('0x3e')){var _0x5a2e43={};_0x5a2e43[_0x15f09b[_0x45a9('0x27')]]={'$like':'%'+_0x349d44[_0x45a9('0x30')][_0x45a9('0x3f')]+'%'};return _0x5a2e43;}})});}_0x46acfd=_[_0x45a9('0x3d')]({},_0x46acfd,_0x349d44[_0x45a9('0x40')]);var _0x12c09a={'where':_0x46acfd['where']};return db[_0x45a9('0x41')][_0x45a9('0x20')](_0x12c09a)[_0x45a9('0x24')](function(_0x8ad476){_0x13874a['count']=_0x8ad476;if(_0x349d44[_0x45a9('0x30')][_0x45a9('0x42')]){_0x46acfd[_0x45a9('0x43')]=[{'all':!![]}];}return db[_0x45a9('0x41')][_0x45a9('0x44')](_0x46acfd);})[_0x45a9('0x24')](function(_0x35ca73){_0x13874a['rows']=_0x35ca73;return _0x13874a;})['then'](respondWithFilteredResult(_0x18f1ca,_0x46acfd))['catch'](handleError(_0x18f1ca,null));};exports[_0x45a9('0x45')]=function(_0x391697,_0x4b7e9a){var _0x1c7d14={'raw':!![],'where':{'id':_0x391697['params']['id']}},_0x184a71={};_0x184a71[_0x45a9('0x2e')]=_[_0x45a9('0x31')](db[_0x45a9('0x41')][_0x45a9('0x2a')]);_0x184a71[_0x45a9('0x30')]=_['keys'](_0x391697[_0x45a9('0x30')]);_0x184a71[_0x45a9('0x32')]=_[_0x45a9('0x33')](_0x184a71[_0x45a9('0x2e')],_0x184a71[_0x45a9('0x30')]);_0x1c7d14[_0x45a9('0x35')]=_['intersection'](_0x184a71[_0x45a9('0x2e')],qs[_0x45a9('0x34')](_0x391697[_0x45a9('0x30')][_0x45a9('0x34')]));_0x1c7d14[_0x45a9('0x35')]=_0x1c7d14[_0x45a9('0x35')]['length']?_0x1c7d14[_0x45a9('0x35')]:_0x184a71['model'];if(_0x391697[_0x45a9('0x30')][_0x45a9('0x42')]){_0x1c7d14[_0x45a9('0x43')]=[{'all':!![]}];}_0x1c7d14=_['merge']({},_0x1c7d14,_0x391697[_0x45a9('0x40')]);return db[_0x45a9('0x41')][_0x45a9('0x46')](_0x1c7d14)['then'](handleEntityNotFound(_0x4b7e9a,null))[_0x45a9('0x24')](respondWithResult(_0x4b7e9a,null))[_0x45a9('0x47')](handleError(_0x4b7e9a,null));};exports['update']=function(_0x430017,_0x52817b){if(_0x430017['body']['id']){delete _0x430017[_0x45a9('0x48')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x430017[_0x45a9('0x49')]['id']}})[_0x45a9('0x24')](handleEntityNotFound(_0x52817b,null))[_0x45a9('0x24')](saveUpdates(_0x430017[_0x45a9('0x48')],null))[_0x45a9('0x24')](respondWithResult(_0x52817b,null))[_0x45a9('0x47')](handleError(_0x52817b,null));};exports[_0x45a9('0x25')]=function(_0x53d6f0,_0x8c82a8){return db[_0x45a9('0x41')]['find']({'where':{'id':_0x53d6f0[_0x45a9('0x49')]['id']}})[_0x45a9('0x24')](handleEntityNotFound(_0x8c82a8,null))['then'](removeEntity(_0x8c82a8,null))['catch'](handleError(_0x8c82a8,null));};exports['describe']=function(_0x303f42,_0x40d1fd){return db[_0x45a9('0x41')][_0x45a9('0x4a')]()[_0x45a9('0x24')](respondWithResult(_0x40d1fd,null))['catch'](handleError(_0x40d1fd,null));}; \ No newline at end of file +var _0x8796=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','params','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined'];(function(_0x50b7f3,_0x228c20){var _0xf69d3d=function(_0x514ae9){while(--_0x514ae9){_0x50b7f3['push'](_0x50b7f3['shift']());}};_0xf69d3d(++_0x228c20);}(_0x8796,0x1a0));var _0x6879=function(_0xc55a7d,_0x2ebbe8){_0xc55a7d=_0xc55a7d-0x0;var _0x58bae7=_0x8796[_0xc55a7d];return _0x58bae7;};'use strict';var emlformat=require(_0x6879('0x0'));var rimraf=require(_0x6879('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6879('0x2'));var rp=require('request-promise');var moment=require(_0x6879('0x3'));var BPromise=require(_0x6879('0x4'));var Mustache=require(_0x6879('0x5'));var util=require(_0x6879('0x6'));var path=require(_0x6879('0x7'));var sox=require(_0x6879('0x8'));var csv=require(_0x6879('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6879('0xa'));var _=require('lodash');var squel=require(_0x6879('0xb'));var crypto=require(_0x6879('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6879('0x9'));var querystring=require('querystring');var Papa=require(_0x6879('0xd'));var Redis=require(_0x6879('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6879('0xf'));var as=require(_0x6879('0x10'));var hardwareService=require(_0x6879('0x11'));var logger=require(_0x6879('0x12'))(_0x6879('0x13'));var utils=require(_0x6879('0x14'));var config=require(_0x6879('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf50fb1,_0x46216f){_0x46216f=_0x46216f||0xcc;return function(_0x4e41aa){if(_0x4e41aa){return _0xf50fb1[_0x6879('0x16')](_0x46216f);}return _0xf50fb1[_0x6879('0x17')](_0x46216f)[_0x6879('0x18')]();};}function respondWithResult(_0x4bbce6,_0x1da8f7){_0x1da8f7=_0x1da8f7||0xc8;return function(_0x169643){if(_0x169643){return _0x4bbce6[_0x6879('0x17')](_0x1da8f7)[_0x6879('0x19')](_0x169643);}};}function respondWithFilteredResult(_0x2e18f2,_0x41c4ed){return function(_0x22b014){if(_0x22b014){var _0x4317f1=typeof _0x41c4ed[_0x6879('0x1a')]===_0x6879('0x1b')&&typeof _0x41c4ed[_0x6879('0x1c')]==='undefined';var _0x1920ad=_0x22b014[_0x6879('0x1d')];var _0x17efde=_0x4317f1?0x0:_0x41c4ed['offset'];var _0x196733=_0x4317f1?_0x22b014[_0x6879('0x1d')]:_0x41c4ed[_0x6879('0x1a')]+_0x41c4ed[_0x6879('0x1c')];var _0x3ba3ca;if(_0x196733>=_0x1920ad){_0x196733=_0x1920ad;_0x3ba3ca=0xc8;}else{_0x3ba3ca=0xce;}_0x2e18f2['status'](_0x3ba3ca);return _0x2e18f2[_0x6879('0x1e')](_0x6879('0x1f'),_0x17efde+'-'+_0x196733+'/'+_0x1920ad)[_0x6879('0x19')](_0x22b014);}return null;};}function patchUpdates(_0x13f3e2){return function(_0x2a2f6b){try{jsonpatch[_0x6879('0x20')](_0x2a2f6b,_0x13f3e2,!![]);}catch(_0x120ce2){return BPromise[_0x6879('0x21')](_0x120ce2);}return _0x2a2f6b[_0x6879('0x22')]();};}function saveUpdates(_0x17bc56,_0x1dd6a3){return function(_0x299dbc){if(_0x299dbc){return _0x299dbc[_0x6879('0x23')](_0x17bc56)[_0x6879('0x24')](function(_0x330be3){return _0x330be3;});}return null;};}function removeEntity(_0xf6bc54,_0x2fd233){return function(_0x56e7c4){if(_0x56e7c4){return _0x56e7c4[_0x6879('0x25')]()[_0x6879('0x24')](function(){_0xf6bc54['status'](0xcc)[_0x6879('0x18')]();});}};}function handleEntityNotFound(_0x62a86f,_0x58992c){return function(_0x2eb2e9){if(!_0x2eb2e9){_0x62a86f[_0x6879('0x16')](0x194);}return _0x2eb2e9;};}function handleError(_0x1166a1,_0x355813){_0x355813=_0x355813||0x1f4;return function(_0x189ef7){logger[_0x6879('0x26')](_0x189ef7[_0x6879('0x27')]);if(_0x189ef7[_0x6879('0x28')]){delete _0x189ef7[_0x6879('0x28')];}_0x1166a1[_0x6879('0x17')](_0x355813)[_0x6879('0x29')](_0x189ef7);};}exports[_0x6879('0x2a')]=function(_0xb706f5,_0x1ca21d){var _0x229d82={},_0x16c32d={},_0x4e2b58={'count':0x0,'rows':[]};var _0xda93f9=_[_0x6879('0x2b')](db[_0x6879('0x2c')][_0x6879('0x2d')],function(_0x1813dc){return{'name':_0x1813dc['fieldName'],'type':_0x1813dc[_0x6879('0x2e')][_0x6879('0x2f')]};});_0x16c32d[_0x6879('0x30')]=_[_0x6879('0x2b')](_0xda93f9,'name');_0x16c32d['query']=_[_0x6879('0x31')](_0xb706f5[_0x6879('0x32')]);_0x16c32d[_0x6879('0x33')]=_[_0x6879('0x34')](_0x16c32d[_0x6879('0x30')],_0x16c32d[_0x6879('0x32')]);_0x229d82[_0x6879('0x35')]=_['intersection'](_0x16c32d['model'],qs['fields'](_0xb706f5[_0x6879('0x32')][_0x6879('0x36')]));_0x229d82['attributes']=_0x229d82[_0x6879('0x35')][_0x6879('0x37')]?_0x229d82[_0x6879('0x35')]:_0x16c32d[_0x6879('0x30')];if(!_0xb706f5['query']['hasOwnProperty'](_0x6879('0x38'))){_0x229d82[_0x6879('0x1c')]=qs['limit'](_0xb706f5[_0x6879('0x32')][_0x6879('0x1c')]);_0x229d82[_0x6879('0x1a')]=qs[_0x6879('0x1a')](_0xb706f5['query'][_0x6879('0x1a')]);}_0x229d82[_0x6879('0x39')]=qs['sort'](_0xb706f5[_0x6879('0x32')][_0x6879('0x3a')]);_0x229d82[_0x6879('0x3b')]=qs['filters'](_[_0x6879('0x3c')](_0xb706f5['query'],_0x16c32d[_0x6879('0x33')]),_0xda93f9);if(_0xb706f5[_0x6879('0x32')][_0x6879('0x3d')]){_0x229d82[_0x6879('0x3b')]=_[_0x6879('0x3e')](_0x229d82[_0x6879('0x3b')],{'$or':_[_0x6879('0x2b')](_0xda93f9,function(_0x46c271){if(_0x46c271[_0x6879('0x2e')]!==_0x6879('0x3f')){var _0x19f3a5={};_0x19f3a5[_0x46c271['name']]={'$like':'%'+_0xb706f5[_0x6879('0x32')][_0x6879('0x3d')]+'%'};return _0x19f3a5;}})});}_0x229d82=_[_0x6879('0x3e')]({},_0x229d82,_0xb706f5[_0x6879('0x40')]);var _0x50e5c9={'where':_0x229d82[_0x6879('0x3b')]};return db['CmHopperBlack']['count'](_0x50e5c9)[_0x6879('0x24')](function(_0x20830e){_0x4e2b58[_0x6879('0x1d')]=_0x20830e;if(_0xb706f5[_0x6879('0x32')][_0x6879('0x41')]){_0x229d82[_0x6879('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x6879('0x43')](_0x229d82);})[_0x6879('0x24')](function(_0x155c29){_0x4e2b58[_0x6879('0x44')]=_0x155c29;return _0x4e2b58;})[_0x6879('0x24')](respondWithFilteredResult(_0x1ca21d,_0x229d82))[_0x6879('0x45')](handleError(_0x1ca21d,null));};exports['show']=function(_0xcc49b,_0x138150){var _0x4fcb65={'raw':!![],'where':{'id':_0xcc49b['params']['id']}},_0x7752d={};_0x7752d[_0x6879('0x30')]=_[_0x6879('0x31')](db[_0x6879('0x2c')][_0x6879('0x2d')]);_0x7752d[_0x6879('0x32')]=_[_0x6879('0x31')](_0xcc49b[_0x6879('0x32')]);_0x7752d[_0x6879('0x33')]=_[_0x6879('0x34')](_0x7752d['model'],_0x7752d[_0x6879('0x32')]);_0x4fcb65[_0x6879('0x35')]=_[_0x6879('0x34')](_0x7752d['model'],qs[_0x6879('0x36')](_0xcc49b['query'][_0x6879('0x36')]));_0x4fcb65[_0x6879('0x35')]=_0x4fcb65[_0x6879('0x35')][_0x6879('0x37')]?_0x4fcb65[_0x6879('0x35')]:_0x7752d[_0x6879('0x30')];if(_0xcc49b[_0x6879('0x32')]['includeAll']){_0x4fcb65[_0x6879('0x42')]=[{'all':!![]}];}_0x4fcb65=_[_0x6879('0x3e')]({},_0x4fcb65,_0xcc49b[_0x6879('0x40')]);return db['CmHopperBlack'][_0x6879('0x46')](_0x4fcb65)['then'](handleEntityNotFound(_0x138150,null))[_0x6879('0x24')](respondWithResult(_0x138150,null))[_0x6879('0x45')](handleError(_0x138150,null));};exports['update']=function(_0x1013e7,_0x28e24e){if(_0x1013e7['body']['id']){delete _0x1013e7['body']['id'];}return db[_0x6879('0x2c')][_0x6879('0x46')]({'where':{'id':_0x1013e7[_0x6879('0x47')]['id']}})[_0x6879('0x24')](handleEntityNotFound(_0x28e24e,null))[_0x6879('0x24')](saveUpdates(_0x1013e7[_0x6879('0x48')],null))[_0x6879('0x24')](respondWithResult(_0x28e24e,null))[_0x6879('0x45')](handleError(_0x28e24e,null));};exports['destroy']=function(_0x4e77d,_0x4a7fa8){return db[_0x6879('0x2c')][_0x6879('0x46')]({'where':{'id':_0x4e77d['params']['id']}})['then'](handleEntityNotFound(_0x4a7fa8,null))['then'](removeEntity(_0x4a7fa8,null))['catch'](handleError(_0x4a7fa8,null));};exports[_0x6879('0x49')]=function(_0x556e07,_0xf64622){return db['CmHopperBlack'][_0x6879('0x49')]()['then'](respondWithResult(_0xf64622,null))[_0x6879('0x45')](handleError(_0xf64622,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index a453c98..e4e7f92 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 _0x1074=['path','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x311e5a,_0x69b78e){var _0x3bdf76=function(_0x5170bc){while(--_0x5170bc){_0x311e5a['push'](_0x311e5a['shift']());}};_0x3bdf76(++_0x69b78e);}(_0x1074,0x1b3));var _0x4107=function(_0x40359a,_0xcb63b){_0x40359a=_0x40359a-0x0;var _0x5efc0c=_0x1074[_0x40359a];return _0x5efc0c;};'use strict';var _=require(_0x4107('0x0'));var util=require(_0x4107('0x1'));var logger=require(_0x4107('0x2'))(_0x4107('0x3'));var moment=require(_0x4107('0x4'));var BPromise=require(_0x4107('0x5'));var rp=require(_0x4107('0x6'));var fs=require('fs');var path=require(_0x4107('0x7'));var rimraf=require('rimraf');var config=require(_0x4107('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x4107('0x9')]=function(_0x40d171,_0x6ac101){return _0x40d171[_0x4107('0xa')](_0x4107('0xb'),attributes,{'tableName':_0x4107('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd1b=['CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x4208c8,_0x316a05){var _0x319311=function(_0x52dc54){while(--_0x52dc54){_0x4208c8['push'](_0x4208c8['shift']());}};_0x319311(++_0x316a05);}(_0xdd1b,0xb2));var _0xbdd1=function(_0x407d50,_0x1c258b){_0x407d50=_0x407d50-0x0;var _0x13e7cb=_0xdd1b[_0x407d50];return _0x13e7cb;};'use strict';var _=require(_0xbdd1('0x0'));var util=require(_0xbdd1('0x1'));var logger=require(_0xbdd1('0x2'))('api');var moment=require(_0xbdd1('0x3'));var BPromise=require(_0xbdd1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbdd1('0x5'));var config=require(_0xbdd1('0x6'));var attributes=require(_0xbdd1('0x7'));module[_0xbdd1('0x8')]=function(_0x42ef23,_0xcd03ec){return _0x42ef23['define'](_0xbdd1('0x9'),attributes,{'tableName':_0xbdd1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index f8a36d8..c659541 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 _0xb4c8=['CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','raw','DestroyCmHopperBlack','destroy','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug'];(function(_0x4897c3,_0x2fdcf2){var _0x2797b0=function(_0x57f2d5){while(--_0x57f2d5){_0x4897c3['push'](_0x4897c3['shift']());}};_0x2797b0(++_0x2fdcf2);}(_0xb4c8,0x83));var _0x8b4c=function(_0x1d9815,_0x4fdf00){_0x1d9815=_0x1d9815-0x0;var _0x3d2966=_0xb4c8[_0x1d9815];return _0x3d2966;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8b4c('0x0'));var BPromise=require(_0x8b4c('0x1'));var rs=require(_0x8b4c('0x2'));var fs=require('fs');var Redis=require(_0x8b4c('0x3'));var db=require(_0x8b4c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b4c('0x5'))(_0x8b4c('0x6'));var config=require(_0x8b4c('0x7'));var jayson=require(_0x8b4c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1915b8,_0x212d5a,_0x232040){return new BPromise(function(_0x3d63bc,_0x3fc088){return client[_0x8b4c('0x9')](_0x1915b8,_0x232040)[_0x8b4c('0xa')](function(_0x1cdbd2){logger[_0x8b4c('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x212d5a,'request\x20sent');logger[_0x8b4c('0xc')](_0x8b4c('0xd'),_0x212d5a,_0x8b4c('0xe'),JSON[_0x8b4c('0xf')](_0x1cdbd2));if(_0x1cdbd2[_0x8b4c('0x10')]){if(_0x1cdbd2[_0x8b4c('0x10')][_0x8b4c('0x11')]===0x1f4){logger['error'](_0x8b4c('0x12'),_0x212d5a,_0x1cdbd2[_0x8b4c('0x10')][_0x8b4c('0x13')]);return _0x3fc088(_0x1cdbd2[_0x8b4c('0x10')][_0x8b4c('0x13')]);}logger['error'](_0x8b4c('0x12'),_0x212d5a,_0x1cdbd2[_0x8b4c('0x10')][_0x8b4c('0x13')]);return _0x3d63bc(_0x1cdbd2[_0x8b4c('0x10')][_0x8b4c('0x13')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x212d5a,'request\x20sent');_0x3d63bc(_0x1cdbd2[_0x8b4c('0x14')]['message']);}})[_0x8b4c('0x15')](function(_0x3d1b4e){logger[_0x8b4c('0x10')](_0x8b4c('0x12'),_0x212d5a,_0x3d1b4e);_0x3fc088(_0x3d1b4e);});});}exports[_0x8b4c('0x16')]=function(_0x1c37ec){var _0x398c94=this;return new Promise(function(_0x3fb5d1,_0x587a52){return db[_0x8b4c('0x17')]['findAll']({'raw':_0x1c37ec['options']?_0x1c37ec[_0x8b4c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1c37ec[_0x8b4c('0x18')]?_0x1c37ec[_0x8b4c('0x18')][_0x8b4c('0x19')]||null:null,'attributes':_0x1c37ec[_0x8b4c('0x18')]?_0x1c37ec[_0x8b4c('0x18')][_0x8b4c('0x1a')]||null:null,'limit':_0x1c37ec['options']?_0x1c37ec[_0x8b4c('0x18')][_0x8b4c('0x1b')]||null:null,'include':_0x1c37ec[_0x8b4c('0x18')]?_0x1c37ec[_0x8b4c('0x18')][_0x8b4c('0x1c')]?_[_0x8b4c('0x1d')](_0x1c37ec['options'][_0x8b4c('0x1c')],function(_0x1e0778){return{'model':db[_0x1e0778[_0x8b4c('0x1e')]],'as':_0x1e0778['as'],'attributes':_0x1e0778['attributes'],'include':_0x1e0778[_0x8b4c('0x1c')]?_[_0x8b4c('0x1d')](_0x1e0778[_0x8b4c('0x1c')],function(_0x1d9013){return{'model':db[_0x1d9013[_0x8b4c('0x1e')]],'as':_0x1d9013['as'],'attributes':_0x1d9013[_0x8b4c('0x1a')],'include':_0x1d9013[_0x8b4c('0x1c')]?_['map'](_0x1d9013[_0x8b4c('0x1c')],function(_0x3d6d1b){return{'model':db[_0x3d6d1b[_0x8b4c('0x1e')]],'as':_0x3d6d1b['as'],'attributes':_0x3d6d1b['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b4c('0xa')](function(_0x25410d){logger[_0x8b4c('0xb')]('GetCmHopperBlack',_0x1c37ec);logger[_0x8b4c('0xc')](_0x8b4c('0x16'),_0x1c37ec,JSON[_0x8b4c('0xf')](_0x25410d));_0x3fb5d1(_0x25410d);})[_0x8b4c('0x15')](function(_0x185631){logger[_0x8b4c('0x10')]('GetCmHopperBlack',_0x185631['message'],_0x1c37ec);_0x587a52(_0x398c94[_0x8b4c('0x10')](0x1f4,_0x185631[_0x8b4c('0x13')]));});});};exports[_0x8b4c('0x1f')]=function(_0x50fa47){var _0xf88c30=this;return new Promise(function(_0x4bf60b,_0x32794e){return db[_0x8b4c('0x17')]['update'](_0x50fa47[_0x8b4c('0x20')],{'raw':_0x50fa47[_0x8b4c('0x18')]?_0x50fa47['options'][_0x8b4c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50fa47[_0x8b4c('0x18')]?_0x50fa47['options']['where']||null:null,'attributes':_0x50fa47['options']?_0x50fa47[_0x8b4c('0x18')]['attributes']||null:null,'limit':_0x50fa47[_0x8b4c('0x18')]?_0x50fa47[_0x8b4c('0x18')]['limit']||null:null})[_0x8b4c('0xa')](function(_0x8cb907){logger['info'](_0x8b4c('0x1f'),_0x50fa47);logger[_0x8b4c('0xc')](_0x8b4c('0x1f'),_0x50fa47,JSON[_0x8b4c('0xf')](_0x8cb907));_0x4bf60b(_0x8cb907);})[_0x8b4c('0x15')](function(_0x44ad15){logger[_0x8b4c('0x10')]('UpdateCmHopperBlack',_0x44ad15['message'],_0x50fa47);_0x32794e(_0xf88c30[_0x8b4c('0x10')](0x1f4,_0x44ad15[_0x8b4c('0x13')]));});});};exports[_0x8b4c('0x22')]=function(_0x3c2442){var _0x4c9dc0=this;return new Promise(function(_0x34f5ed,_0x583174){return db[_0x8b4c('0x17')][_0x8b4c('0x23')]({'where':_0x3c2442['options']?_0x3c2442[_0x8b4c('0x18')][_0x8b4c('0x19')]||null:null})[_0x8b4c('0xa')](function(_0x27916b){logger[_0x8b4c('0xb')](_0x8b4c('0x22'),_0x3c2442);logger[_0x8b4c('0xc')]('DestroyCmHopperBlack',_0x3c2442,JSON[_0x8b4c('0xf')](_0x27916b));_0x34f5ed(_0x27916b);})[_0x8b4c('0x15')](function(_0x1a1f45){logger[_0x8b4c('0x10')](_0x8b4c('0x22'),_0x1a1f45[_0x8b4c('0x13')],_0x3c2442);_0x583174(_0x4c9dc0[_0x8b4c('0x10')](0x1f4,_0x1a1f45[_0x8b4c('0x13')]));});});}; \ No newline at end of file +var _0xb45a=['DestroyCmHopperBlack','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','include','map','model','UpdateCmHopperBlack','body'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0xb45a,0xcd));var _0xab45=function(_0x5eb1a8,_0x30e664){_0x5eb1a8=_0x5eb1a8-0x0;var _0x14c11c=_0xb45a[_0x5eb1a8];return _0x14c11c;};'use strict';var _=require(_0xab45('0x0'));var util=require(_0xab45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xab45('0x2'));var fs=require('fs');var Redis=require(_0xab45('0x3'));var db=require(_0xab45('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xab45('0x5'))('rpc');var config=require(_0xab45('0x6'));var jayson=require(_0xab45('0x7'));var client=jayson[_0xab45('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x587248,_0x469b0e,_0x33f16e){return new BPromise(function(_0x3ae3ff,_0x5a4533){return client[_0xab45('0x9')](_0x587248,_0x33f16e)[_0xab45('0xa')](function(_0xcfe9e9){logger[_0xab45('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x469b0e,'request\x20sent');logger[_0xab45('0xc')](_0xab45('0xd'),_0x469b0e,_0xab45('0xe'),JSON[_0xab45('0xf')](_0xcfe9e9));if(_0xcfe9e9[_0xab45('0x10')]){if(_0xcfe9e9['error'][_0xab45('0x11')]===0x1f4){logger[_0xab45('0x10')](_0xab45('0x12'),_0x469b0e,_0xcfe9e9[_0xab45('0x10')]['message']);return _0x5a4533(_0xcfe9e9[_0xab45('0x10')][_0xab45('0x13')]);}logger[_0xab45('0x10')](_0xab45('0x12'),_0x469b0e,_0xcfe9e9[_0xab45('0x10')][_0xab45('0x13')]);return _0x3ae3ff(_0xcfe9e9[_0xab45('0x10')]['message']);}else{logger[_0xab45('0xb')](_0xab45('0x12'),_0x469b0e,_0xab45('0xe'));_0x3ae3ff(_0xcfe9e9[_0xab45('0x14')][_0xab45('0x13')]);}})[_0xab45('0x15')](function(_0x5e766d){logger['error'](_0xab45('0x12'),_0x469b0e,_0x5e766d);_0x5a4533(_0x5e766d);});});}exports[_0xab45('0x16')]=function(_0x242c1c){var _0x21bdb9=this;return new Promise(function(_0x476dba,_0xcc6a30){return db[_0xab45('0x17')]['findAll']({'raw':_0x242c1c[_0xab45('0x18')]?_0x242c1c['options'][_0xab45('0x19')]===undefined?!![]:![]:!![],'where':_0x242c1c[_0xab45('0x18')]?_0x242c1c[_0xab45('0x18')][_0xab45('0x1a')]||null:null,'attributes':_0x242c1c[_0xab45('0x18')]?_0x242c1c[_0xab45('0x18')][_0xab45('0x1b')]||null:null,'limit':_0x242c1c[_0xab45('0x18')]?_0x242c1c['options']['limit']||null:null,'include':_0x242c1c[_0xab45('0x18')]?_0x242c1c[_0xab45('0x18')][_0xab45('0x1c')]?_[_0xab45('0x1d')](_0x242c1c[_0xab45('0x18')][_0xab45('0x1c')],function(_0x20dbb0){return{'model':db[_0x20dbb0[_0xab45('0x1e')]],'as':_0x20dbb0['as'],'attributes':_0x20dbb0[_0xab45('0x1b')],'include':_0x20dbb0[_0xab45('0x1c')]?_[_0xab45('0x1d')](_0x20dbb0[_0xab45('0x1c')],function(_0x4851f2){return{'model':db[_0x4851f2[_0xab45('0x1e')]],'as':_0x4851f2['as'],'attributes':_0x4851f2[_0xab45('0x1b')],'include':_0x4851f2['include']?_[_0xab45('0x1d')](_0x4851f2[_0xab45('0x1c')],function(_0x2d9936){return{'model':db[_0x2d9936[_0xab45('0x1e')]],'as':_0x2d9936['as'],'attributes':_0x2d9936['attributes']};}):[]};}):[]};}):[]:[]})[_0xab45('0xa')](function(_0x4ed1fc){logger[_0xab45('0xb')](_0xab45('0x16'),_0x242c1c);logger[_0xab45('0xc')](_0xab45('0x16'),_0x242c1c,JSON[_0xab45('0xf')](_0x4ed1fc));_0x476dba(_0x4ed1fc);})['catch'](function(_0x372c5f){logger[_0xab45('0x10')](_0xab45('0x16'),_0x372c5f[_0xab45('0x13')],_0x242c1c);_0xcc6a30(_0x21bdb9[_0xab45('0x10')](0x1f4,_0x372c5f[_0xab45('0x13')]));});});};exports[_0xab45('0x1f')]=function(_0x5e2df0){var _0x30f401=this;return new Promise(function(_0x517dc2,_0x7f8528){return db[_0xab45('0x17')]['update'](_0x5e2df0[_0xab45('0x20')],{'raw':_0x5e2df0['options']?_0x5e2df0[_0xab45('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e2df0[_0xab45('0x18')]?_0x5e2df0[_0xab45('0x18')][_0xab45('0x1a')]||null:null,'attributes':_0x5e2df0[_0xab45('0x18')]?_0x5e2df0[_0xab45('0x18')][_0xab45('0x1b')]||null:null,'limit':_0x5e2df0['options']?_0x5e2df0[_0xab45('0x18')]['limit']||null:null})['then'](function(_0x5f15cc){logger[_0xab45('0xb')]('UpdateCmHopperBlack',_0x5e2df0);logger['debug'](_0xab45('0x1f'),_0x5e2df0,JSON[_0xab45('0xf')](_0x5f15cc));_0x517dc2(_0x5f15cc);})[_0xab45('0x15')](function(_0x1ff1d3){logger[_0xab45('0x10')]('UpdateCmHopperBlack',_0x1ff1d3['message'],_0x5e2df0);_0x7f8528(_0x30f401[_0xab45('0x10')](0x1f4,_0x1ff1d3[_0xab45('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x2f4e91){var _0x6d00d=this;return new Promise(function(_0x370b77,_0x3917d0){return db[_0xab45('0x17')]['destroy']({'where':_0x2f4e91[_0xab45('0x18')]?_0x2f4e91[_0xab45('0x18')][_0xab45('0x1a')]||null:null})[_0xab45('0xa')](function(_0x3d8bf8){logger[_0xab45('0xb')](_0xab45('0x21'),_0x2f4e91);logger['debug'](_0xab45('0x21'),_0x2f4e91,JSON['stringify'](_0x3d8bf8));_0x370b77(_0x3d8bf8);})[_0xab45('0x15')](function(_0x203b2c){logger['error'](_0xab45('0x21'),_0x203b2c[_0xab45('0x13')],_0x2f4e91);_0x3917d0(_0x6d00d[_0xab45('0x10')](0x1f4,_0x203b2c[_0xab45('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index e768faa..364deb5 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 _0x741c=['get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperBlack.controller'];(function(_0x588dc7,_0xb8d65a){var _0x19af0f=function(_0x53e68b){while(--_0x53e68b){_0x588dc7['push'](_0x588dc7['shift']());}};_0x19af0f(++_0xb8d65a);}(_0x741c,0x196));var _0xc741=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x741c[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['describe']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['put']('/:id',auth[_0xc741('0x9')](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xc'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);module[_0xc741('0x11')]=router; \ No newline at end of file +var _0x90b1=['index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x210e70,_0xada8b6){var _0xc94db=function(_0x2723ec){while(--_0x2723ec){_0x210e70['push'](_0x210e70['shift']());}};_0xc94db(++_0xada8b6);}(_0x90b1,0x1bb));var _0x190b=function(_0x4054e2,_0x31572a){_0x4054e2=_0x4054e2-0x0;var _0x54ebdf=_0x90b1[_0x4054e2];return _0x54ebdf;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x10')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller['destroy']);module[_0x190b('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 9d806f8..b2afb0c 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 _0x0f83=['sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN'];(function(_0x3836ae,_0x33dcdb){var _0x4d4a64=function(_0x58810e){while(--_0x58810e){_0x3836ae['push'](_0x3836ae['shift']());}};_0x4d4a64(++_0x33dcdb);}(_0x0f83,0x1c7));var _0x30f8=function(_0x2ce596,_0x10313b){_0x2ce596=_0x2ce596-0x0;var _0x2e65a4=_0x0f83[_0x2ce596];return _0x2e65a4;};'use strict';var Sequelize=require(_0x30f8('0x0'));var moment=require(_0x30f8('0x1'));module[_0x30f8('0x2')]={'state':{'type':Sequelize[_0x30f8('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x30f8('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x30f8('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x30f8('0x4')]},'originatecalleridname':{'type':Sequelize[_0x30f8('0x4')]},'calleridnum':{'type':Sequelize[_0x30f8('0x4')]},'calleridname':{'type':Sequelize[_0x30f8('0x4')]},'starttime':{'type':Sequelize[_0x30f8('0x5')]},'responsetime':{'type':Sequelize[_0x30f8('0x5')]},'answertime':{'type':Sequelize[_0x30f8('0x5')]},'droptime':{'type':Sequelize[_0x30f8('0x5')]},'endtime':{'type':Sequelize[_0x30f8('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x30f8('0x4')]},'campaigntype':{'type':Sequelize[_0x30f8('0x4')]},'membername':{'type':Sequelize[_0x30f8('0x4')]},'reason':{'type':Sequelize[_0x30f8('0x4')]},'disposition':{'type':Sequelize[_0x30f8('0x4')]},'secondDisposition':{'type':Sequelize[_0x30f8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x30f8('0x4')]},'dispositionat':{'type':Sequelize[_0x30f8('0x5')],'set':function(_0x36c17f){var _0x27cc57=this[_0x30f8('0x6')](_0x30f8('0x7'));if(_0x27cc57&&_0x36c17f){this[_0x30f8('0x8')](_0x30f8('0x9'),moment(_0x36c17f)[_0x30f8('0xa')](moment(_0x27cc57),_0x30f8('0xb')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x30f8('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x30f8('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x30f8('0x5')]},'callback':{'type':Sequelize[_0x30f8('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x30f8('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x30f8('0x5')]},'deleted':{'type':Sequelize[_0x30f8('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x30f8('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x30f8('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x30f8('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf8e6=['DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','exports','STRING','INTEGER'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xf8e6,0x6b));var _0x6f8e=function(_0x43bb39,_0x4c5bda){_0x43bb39=_0x43bb39-0x0;var _0x5796cc=_0xf8e6[_0x43bb39];return _0x5796cc;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x6f8e('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6f8e('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f8e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6f8e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6f8e('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x6f8e('0x1')]},'originatecalleridname':{'type':Sequelize[_0x6f8e('0x1')]},'calleridnum':{'type':Sequelize[_0x6f8e('0x1')]},'calleridname':{'type':Sequelize[_0x6f8e('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6f8e('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6f8e('0x3')]},'endtime':{'type':Sequelize[_0x6f8e('0x3')]},'ringtime':{'type':Sequelize[_0x6f8e('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6f8e('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6f8e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6f8e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6f8e('0x1')]},'campaign':{'type':Sequelize[_0x6f8e('0x1')]},'campaigntype':{'type':Sequelize[_0x6f8e('0x1')]},'membername':{'type':Sequelize[_0x6f8e('0x1')]},'reason':{'type':Sequelize[_0x6f8e('0x1')]},'disposition':{'type':Sequelize[_0x6f8e('0x1')]},'secondDisposition':{'type':Sequelize[_0x6f8e('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1c9a7c){var _0x41ced1=this[_0x6f8e('0x4')](_0x6f8e('0x5'));if(_0x41ced1&&_0x1c9a7c){this[_0x6f8e('0x6')]('followuptime',moment(_0x1c9a7c)[_0x6f8e('0x7')](moment(_0x41ced1),_0x6f8e('0x8')));}}},'amd':{'type':Sequelize[_0x6f8e('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6f8e('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6f8e('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x6f8e('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6f8e('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6f8e('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6f8e('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6f8e('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6f8e('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6f8e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6f8e('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 fb84a02..7d7a4a5 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 _0xf61e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','describe','update','body','uniqueid','params','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','fromQuery','ContactId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','checkContactHopper','findOne','eml-format'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xf61e,0x191));var _0xef61=function(_0x10f9f5,_0x20a147){_0x10f9f5=_0x10f9f5-0x0;var _0x46a06e=_0xf61e[_0x10f9f5];return _0x46a06e;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['CmHopperFinal']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':!![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')]()['then'](respondWithResult(_0x47b09d,null))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x13d0f8,_0x2904e0){if(_0x13d0f8[_0xef61('0x4a')][_0xef61('0x4b')]){delete _0x13d0f8[_0xef61('0x4a')]['uniqueid'];}return db[_0xef61('0x30')]['find']({'where':{'uniqueid':_0x13d0f8[_0xef61('0x4c')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x2904e0,null))[_0xef61('0x28')](saveUpdates(_0x13d0f8[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x2904e0,null))[_0xef61('0x45')](handleError(_0x2904e0,null));};exports[_0xef61('0x4d')]=function(_0x1565c7,_0x264877,_0x4af2f3){return db[_0xef61('0x30')][_0xef61('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x1565c7['params']['id']},'attributes':[[db['sequelize']['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db['sequelize'][_0xef61('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0xef61('0x51')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0xef61('0x52')],[db[_0xef61('0x4f')]['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xef61('0x53')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xef61('0x54')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x55')))),_0xef61('0x56')],[db['sequelize']['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x57')))),_0xef61('0x58')],[db['sequelize']['fn'](_0xef61('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0xef61('0x50')](_0xef61('0x59')))),_0xef61('0x5a')],[db['sequelize']['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5b')))),_0xef61('0x5c')]]})[_0xef61('0x28')](handleEntityNotFound(_0x264877,null))[_0xef61('0x28')](respondWithResult(_0x264877,null))[_0xef61('0x45')](handleError(_0x264877,null));};exports[_0xef61('0x5d')]=function(_0x5507ee,_0x15a8c5,_0x4b26e6){return db['CmHopperFinal'][_0xef61('0x44')]({'raw':![],'where':{'CampaignId':_0x5507ee[_0xef61('0x4c')]['id']},'attributes':[[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xef61('0x51')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5e')))),_0xef61('0x52')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db['sequelize'][_0xef61('0x50')](_0xef61('0x5f')))),'busyContacts'],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x60')))),_0xef61('0x54')],[db[_0xef61('0x4f')]['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xef61('0x56')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db['sequelize']['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x57')))),_0xef61('0x58')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x59')))),_0xef61('0x5a')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5b')))),_0xef61('0x5c')]]})['then'](handleEntityNotFound(_0x15a8c5,null))[_0xef61('0x28')](respondWithResult(_0x15a8c5,null))[_0xef61('0x45')](handleError(_0x15a8c5,null));};exports[_0xef61('0x61')]=function(_0x5ab4fe,_0x38117b,_0x346752){return db['VoiceQueue'][_0xef61('0x47')]({'where':{'id':_0x5ab4fe[_0xef61('0x4c')]['id']}})['then'](handleEntityNotFound(_0x38117b,null))[_0xef61('0x28')](function(_0x54777a){var _0xe62ec2;if(_0x54777a){_0xe62ec2=squel[_0xef61('0x62')]()['into'](_0xef61('0x63'))['fromQuery']([_0xef61('0x64'),_0xef61('0x65'),'ContactId','ListId',_0xef61('0x66'),_0xef61('0x67'),_0xef61('0x68')],squel[_0xef61('0x69')]()[_0xef61('0x6a')]('ANY_VALUE(calleridnum)',_0xef61('0x64'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x65'))[_0xef61('0x6a')](_0xef61('0x6c'),'ContactId')[_0xef61('0x6a')]('ANY_VALUE(ListId)',_0xef61('0x6d'))[_0xef61('0x6a')](_0xef61('0x6e'),_0xef61('0x66'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x67'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x68'))[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')]('VoiceQueueId\x20=\x20?',_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x72'),_0x5ab4fe['body'][_0xef61('0x73')]['toString']())['where'](_0xef61('0x74'))['where'](_0xef61('0x75'),squel['select']()['field'](_0xef61('0x64'))[_0xef61('0x6f')]('cm_hopper')[_0xef61('0x3d')]('VoiceQueueId\x20=\x20?',_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]()))[_0xef61('0x3d')](_0xef61('0x75'),squel['select']()[_0xef61('0x6a')]('calleridnum')[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')](_0xef61('0x76'),_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x77')))[_0xef61('0x78')]('ContactId'))[_0xef61('0x71')]();return db['sequelize'][_0xef61('0x34')](_0xe62ec2);}return[];})[_0xef61('0x28')](respondWithResult(_0x38117b,null))['catch'](handleError(_0x38117b,null));};exports[_0xef61('0x79')]=function(_0x5b86e4,_0x52f7c5,_0x465fb5){return db[_0xef61('0x7a')]['find']({'where':{'id':_0x5b86e4[_0xef61('0x4c')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x52f7c5,null))['then'](function(_0x352633){var _0x2cb8a8;if(_0x352633){_0x2cb8a8=squel['insert']()[_0xef61('0x7b')]('cm_hopper')[_0xef61('0x7c')]([_0xef61('0x64'),_0xef61('0x65'),_0xef61('0x7d'),'ListId',_0xef61('0x7e'),_0xef61('0x67'),_0xef61('0x68')],squel['select']()[_0xef61('0x6a')](_0xef61('0x7f'),'phone')['field'](_0xef61('0x6b'),_0xef61('0x65'))[_0xef61('0x6a')](_0xef61('0x6c'),_0xef61('0x7d'))[_0xef61('0x6a')](_0xef61('0x80'),_0xef61('0x6d'))[_0xef61('0x6a')](_0xef61('0x81'),_0xef61('0x7e'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x67'))[_0xef61('0x6a')](_0xef61('0x6b'),'updatedAt')[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')](_0xef61('0x82'),_0x5b86e4[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x72'),_0x5b86e4[_0xef61('0x4a')][_0xef61('0x73')][_0xef61('0x71')]())[_0xef61('0x3d')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xef61('0x3d')](_0xef61('0x75'),squel['select']()[_0xef61('0x6a')](_0xef61('0x64'))[_0xef61('0x6f')](_0xef61('0x63'))[_0xef61('0x3d')]('CampaignId\x20=\x20?',_0x5b86e4[_0xef61('0x4c')]['id']['toString']()))[_0xef61('0x3d')](_0xef61('0x75'),squel[_0xef61('0x69')]()[_0xef61('0x6a')](_0xef61('0x83'))[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')]('CampaignId\x20=\x20?',_0x5b86e4[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x77')))[_0xef61('0x78')](_0xef61('0x7d')))[_0xef61('0x71')]();return db[_0xef61('0x4f')][_0xef61('0x34')](_0x2cb8a8);}return[];})['then'](respondWithResult(_0x52f7c5,null))[_0xef61('0x45')](handleError(_0x52f7c5,null));};exports[_0xef61('0x84')]=function(_0x22006a,_0x317c4a,_0x5d8ee9){return db['CmHopper'][_0xef61('0x85')]({'where':{'VoiceQueueId':_0x22006a[_0xef61('0x4a')][_0xef61('0x66')],'CampaignId':_0x22006a[_0xef61('0x4a')][_0xef61('0x7e')],'ContactId':_0x22006a[_0xef61('0x4a')][_0xef61('0x7d')]}})['then'](handleEntityNotFound(_0x317c4a,null))[_0xef61('0x28')](function(_0x660c71){if(_0x660c71){return _0x660c71;}return null;})[_0xef61('0x28')](respondWithResult(_0x317c4a,null))[_0xef61('0x45')](handleError(_0x317c4a,null));}; \ No newline at end of file +var _0x5d58=['calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','CmHopperFinal','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','describe','catch','body','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)'];(function(_0x4237d8,_0x13cc54){var _0x1e8caf=function(_0x1b18c5){while(--_0x1b18c5){_0x4237d8['push'](_0x4237d8['shift']());}};_0x1e8caf(++_0x13cc54);}(_0x5d58,0x187));var _0x85d5=function(_0x539f2a,_0x534a38){_0x539f2a=_0x539f2a-0x0;var _0x314cd2=_0x5d58[_0x539f2a];return _0x314cd2;};'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('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['CmHopperFinal']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['CmHopperFinal'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')]()['then'](respondWithResult(_0x12a03,null))[_0x85d5('0x40')](handleError(_0x12a03,null));};exports['update']=function(_0x1f2ef9,_0xd8db57){if(_0x1f2ef9[_0x85d5('0x41')]['uniqueid']){delete _0x1f2ef9['body']['uniqueid'];}return db[_0x85d5('0x34')][_0x85d5('0x42')]({'where':{'uniqueid':_0x1f2ef9[_0x85d5('0x39')]['id']}})['then'](handleEntityNotFound(_0xd8db57,null))['then'](saveUpdates(_0x1f2ef9[_0x85d5('0x41')],null))[_0x85d5('0x1c')](respondWithResult(_0xd8db57,null))[_0x85d5('0x40')](handleError(_0xd8db57,null));};exports[_0x85d5('0x43')]=function(_0x4b2dce,_0x3f69ea,_0x29442a){return db[_0x85d5('0x34')][_0x85d5('0x36')]({'raw':![],'where':{'VoiceQueueId':_0x4b2dce[_0x85d5('0x39')]['id']},'attributes':[[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),_0x85d5('0x48')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x85d5('0x4e')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4f')))),_0x85d5('0x50')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x2022,\x201,\x20null'))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x52')))),_0x85d5('0x53')]]})['then'](handleEntityNotFound(_0x3f69ea,null))[_0x85d5('0x1c')](respondWithResult(_0x3f69ea,null))[_0x85d5('0x40')](handleError(_0x3f69ea,null));};exports[_0x85d5('0x54')]=function(_0x561bde,_0x34aa42,_0x1c3e2c){return db['CmHopperFinal'][_0x85d5('0x36')]({'raw':![],'where':{'CampaignId':_0x561bde['params']['id']},'attributes':[[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),'noSuchContacts'],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85d5('0x44')]['literal'](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal'](_0x85d5('0x55')))),'dropContacts'],[db['sequelize']['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x85d5('0x50')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db['sequelize']['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x56')))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x85d5('0x53')]]})[_0x85d5('0x1c')](handleEntityNotFound(_0x34aa42,null))[_0x85d5('0x1c')](respondWithResult(_0x34aa42,null))['catch'](handleError(_0x34aa42,null));};exports[_0x85d5('0x57')]=function(_0x1fdefb,_0x496586,_0x2dbd18){return db[_0x85d5('0x58')][_0x85d5('0x42')]({'where':{'id':_0x1fdefb[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x496586,null))['then'](function(_0x35ba15){var _0x1b96eb;if(_0x35ba15){_0x1b96eb=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')](_0x85d5('0x5b'))['fromQuery']([_0x85d5('0x5c'),_0x85d5('0x5d'),_0x85d5('0x5e'),_0x85d5('0x5f'),_0x85d5('0x60'),_0x85d5('0x61'),_0x85d5('0x62')],squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x65'),'phone')[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x5d'))[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))['field'](_0x85d5('0x68'),'ListId')['field'](_0x85d5('0x69'),_0x85d5('0x60'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x61'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x62'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x1fdefb[_0x85d5('0x41')][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6f'))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('phone')['from'](_0x85d5('0x5b'))['where'](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x71'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb['params']['id'][_0x85d5('0x6c')]())['where'](_0x85d5('0x72')))[_0x85d5('0x73')](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db['sequelize'][_0x85d5('0x27')](_0x1b96eb);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x496586,null))['catch'](handleError(_0x496586,null));};exports[_0x85d5('0x74')]=function(_0x14e4e8,_0x57f26b,_0x45b1e2){return db[_0x85d5('0x75')][_0x85d5('0x42')]({'where':{'id':_0x14e4e8['params']['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x57f26b,null))[_0x85d5('0x1c')](function(_0x2dacf7){var _0x387a3b;if(_0x2dacf7){_0x387a3b=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')]('cm_hopper')[_0x85d5('0x76')]([_0x85d5('0x5c'),'scheduledAt',_0x85d5('0x5e'),'ListId',_0x85d5('0x77'),_0x85d5('0x61'),_0x85d5('0x62')],squel['select']()[_0x85d5('0x64')](_0x85d5('0x65'),_0x85d5('0x5c'))[_0x85d5('0x64')](_0x85d5('0x66'),'scheduledAt')[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))[_0x85d5('0x64')]('ANY_VALUE(ListId)',_0x85d5('0x5f'))[_0x85d5('0x64')](_0x85d5('0x78'),'CampaignId')[_0x85d5('0x64')]('NOW()',_0x85d5('0x61'))[_0x85d5('0x64')]('NOW()','updatedAt')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x14e4e8['body'][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x85d5('0x30')](_0x85d5('0x70'),squel['select']()[_0x85d5('0x64')](_0x85d5('0x5c'))[_0x85d5('0x6a')](_0x85d5('0x5b'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('calleridnum')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']())['where'](_0x85d5('0x72')))['group'](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db[_0x85d5('0x44')][_0x85d5('0x27')](_0x387a3b);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x57f26b,null))[_0x85d5('0x40')](handleError(_0x57f26b,null));};exports[_0x85d5('0x7b')]=function(_0x48553d,_0xedb32d,_0x5366bc){return db[_0x85d5('0x7c')][_0x85d5('0x7d')]({'where':{'VoiceQueueId':_0x48553d[_0x85d5('0x41')]['VoiceQueueId'],'CampaignId':_0x48553d[_0x85d5('0x41')][_0x85d5('0x77')],'ContactId':_0x48553d[_0x85d5('0x41')]['ContactId']}})['then'](handleEntityNotFound(_0xedb32d,null))[_0x85d5('0x1c')](function(_0x428fd4){if(_0x428fd4){return _0x428fd4;}return null;})['then'](respondWithResult(_0xedb32d,null))[_0x85d5('0x40')](handleError(_0xedb32d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d34314f..cad722d 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 _0xb7c4=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x5c680f,_0x242cb1){var _0x137950=function(_0x55ce04){while(--_0x55ce04){_0x5c680f['push'](_0x5c680f['shift']());}};_0x137950(++_0x242cb1);}(_0xb7c4,0xa4));var _0x4b7c=function(_0x1d1074,_0x2ad5f5){_0x1d1074=_0x1d1074-0x0;var _0x72cf8a=_0xb7c4[_0x1d1074];return _0x72cf8a;};'use strict';var _=require(_0x4b7c('0x0'));var util=require(_0x4b7c('0x1'));var logger=require(_0x4b7c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4b7c('0x3'));var rp=require(_0x4b7c('0x4'));var fs=require('fs');var path=require(_0x4b7c('0x5'));var rimraf=require(_0x4b7c('0x6'));var config=require(_0x4b7c('0x7'));var attributes=require(_0x4b7c('0x8'));module['exports']=function(_0x26ff49,_0x32c090){return _0x26ff49[_0x4b7c('0x9')](_0x4b7c('0xa'),attributes,{'tableName':_0x4b7c('0xb'),'paranoid':![],'indexes':[{'name':_0x4b7c('0xc'),'fields':[_0x4b7c('0xc')]},{'name':'uniqueid','fields':[_0x4b7c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf40f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','calleridnum','uniqueid','lodash','util','../../config/logger','api'];(function(_0xa1f5a6,_0x418962){var _0x3b8990=function(_0x2ed3dc){while(--_0x2ed3dc){_0xa1f5a6['push'](_0xa1f5a6['shift']());}};_0x3b8990(++_0x418962);}(_0xf40f,0x1a9));var _0xff40=function(_0x5f1ba8,_0x37222e){_0x5f1ba8=_0x5f1ba8-0x0;var _0x40b16b=_0xf40f[_0x5f1ba8];return _0x40b16b;};'use strict';var _=require(_0xff40('0x0'));var util=require(_0xff40('0x1'));var logger=require(_0xff40('0x2'))(_0xff40('0x3'));var moment=require(_0xff40('0x4'));var BPromise=require(_0xff40('0x5'));var rp=require(_0xff40('0x6'));var fs=require('fs');var path=require(_0xff40('0x7'));var rimraf=require(_0xff40('0x8'));var config=require(_0xff40('0x9'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x732ff0,_0x51f8c0){return _0x732ff0[_0xff40('0xa')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xff40('0xb'),'fields':[_0xff40('0xb')]},{'name':_0xff40('0xc'),'fields':[_0xff40('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 7557819..557397d 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(_0x733f50,_0x2dee34){var _0x3c2b1b=function(_0x44d6aa){while(--_0x44d6aa){_0x733f50['push'](_0x733f50['shift']());}};_0x3c2b1b(++_0x2dee34);}(_0xb10b,0x12a));var _0xbb10=function(_0x163977,_0x4ef72e){_0x163977=_0x163977-0x0;var _0x28bf3a=_0xb10b[_0x163977];return _0x28bf3a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2a5faf,_0x478ce1){var _0x1c964c=function(_0x42aa44){while(--_0x42aa44){_0x2a5faf['push'](_0x2a5faf['shift']());}};_0x1c964c(++_0x478ce1);}(_0x7a54,0x106));var _0x47a5=function(_0x25e43a,_0x50769f){_0x25e43a=_0x25e43a-0x0;var _0xbdbde9=_0x7a54[_0x25e43a];return _0xbdbde9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 9ffec39..a080930 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 _0xcaac=['fs-extra','get','isAuthenticated','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','/:id','update','exports','multer','util','express','Router'];(function(_0x4e415b,_0x4d7380){var _0x5efc4a=function(_0x1f9567){while(--_0x1f9567){_0x4e415b['push'](_0x4e415b['shift']());}};_0x5efc4a(++_0x4d7380);}(_0xcaac,0x13e));var _0xccaa=function(_0x24b373,_0xf62247){_0x24b373=_0x24b373-0x0;var _0x29dfa6=_0xcaac[_0x24b373];return _0x29dfa6;};'use strict';var multer=require(_0xccaa('0x0'));var util=require(_0xccaa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xccaa('0x2'));var router=express[_0xccaa('0x3')]();var fs_extra=require(_0xccaa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xccaa('0x5')]('/',auth[_0xccaa('0x6')](),controller['index']);router[_0xccaa('0x5')](_0xccaa('0x7'),auth['isAuthenticated'](),controller[_0xccaa('0x8')]);router[_0xccaa('0x5')]('/:id',auth[_0xccaa('0x6')](),controller[_0xccaa('0x9')]);router['get'](_0xccaa('0xa'),auth[_0xccaa('0x6')](),controller[_0xccaa('0xb')]);router[_0xccaa('0x5')]('/campaign/countAttributes/:id',auth[_0xccaa('0x6')](),controller[_0xccaa('0xc')]);router[_0xccaa('0xd')](_0xccaa('0xe'),auth['isAuthenticated'](),controller[_0xccaa('0xf')]);router['post'](_0xccaa('0x10'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xccaa('0xd')](_0xccaa('0x11'),auth[_0xccaa('0x6')](),controller[_0xccaa('0x12')]);router[_0xccaa('0x13')](_0xccaa('0x14'),auth[_0xccaa('0x6')](),controller[_0xccaa('0x15')]);module[_0xccaa('0x16')]=router; \ No newline at end of file +var _0xa76e=['/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x387ae9,_0x51e4c5){var _0x355a2d=function(_0x2c685b){while(--_0x2c685b){_0x387ae9['push'](_0x387ae9['shift']());}};_0x355a2d(++_0x51e4c5);}(_0xa76e,0xfe));var _0xea76=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xa76e[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require(_0xea76('0x0'));var path=require(_0xea76('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xea76('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xea76('0x3'));var interaction=require(_0xea76('0x4'));var config=require(_0xea76('0x5'));var controller=require('./cmHopperFinal.controller');router[_0xea76('0x6')]('/',auth['isAuthenticated'](),controller[_0xea76('0x7')]);router['get'](_0xea76('0x8'),auth[_0xea76('0x9')](),controller['describe']);router['get'](_0xea76('0xa'),auth[_0xea76('0x9')](),controller[_0xea76('0xb')]);router[_0xea76('0x6')]('/voice/queue/countAttributes/:id',auth[_0xea76('0x9')](),controller[_0xea76('0xc')]);router[_0xea76('0x6')]('/campaign/countAttributes/:id',auth[_0xea76('0x9')](),controller[_0xea76('0xd')]);router[_0xea76('0xe')](_0xea76('0xf'),auth[_0xea76('0x9')](),controller[_0xea76('0x10')]);router[_0xea76('0xe')](_0xea76('0x11'),auth[_0xea76('0x9')](),controller[_0xea76('0x12')]);router[_0xea76('0xe')](_0xea76('0x13'),auth[_0xea76('0x9')](),controller[_0xea76('0x14')]);router[_0xea76('0x15')]('/:id',auth[_0xea76('0x9')](),controller[_0xea76('0x16')]);module[_0xea76('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 1c99b53..dc2b32f 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 _0xacf4=['STRING','DATE','BOOLEAN','INTEGER'];(function(_0x1450d8,_0x4b8983){var _0x2c267c=function(_0x20deba){while(--_0x20deba){_0x1450d8['push'](_0x1450d8['shift']());}};_0x2c267c(++_0x4b8983);}(_0xacf4,0xe7));var _0x4acf=function(_0x110a90,_0x187d0a){_0x110a90=_0x110a90-0x0;var _0x54f73f=_0xacf4[_0x110a90];return _0x54f73f;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x4acf('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x4acf('0x1')]},'scheduledat':{'type':Sequelize[_0x4acf('0x2')]},'countbusyretry':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x4acf('0x1')]},'originatecalleridname':{'type':Sequelize[_0x4acf('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4acf('0x1')]},'starttime':{'type':Sequelize[_0x4acf('0x2')]},'responsetime':{'type':Sequelize[_0x4acf('0x2')]},'answertime':{'type':Sequelize[_0x4acf('0x2')]},'droptime':{'type':Sequelize[_0x4acf('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4acf('0x1')]},'campaign':{'type':Sequelize[_0x4acf('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4acf('0x1')]},'reason':{'type':Sequelize[_0x4acf('0x1')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x4acf('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x4acf('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4acf('0x2')]},'edited':{'type':Sequelize[_0x4acf('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4acf('0x1')]}}; \ No newline at end of file +var _0x780c=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1f703c,_0x30954a){var _0x333466=function(_0x32aafd){while(--_0x32aafd){_0x1f703c['push'](_0x1f703c['shift']());}};_0x333466(++_0x30954a);}(_0x780c,0x15a));var _0xc780=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x780c[_0x254076];return _0x21a93e;};'use strict';var Sequelize=require(_0xc780('0x0'));module[_0xc780('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xc780('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc780('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc780('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xc780('0x3')]},'originatecalleridname':{'type':Sequelize[_0xc780('0x3')]},'calleridnum':{'type':Sequelize[_0xc780('0x3')]},'calleridname':{'type':Sequelize[_0xc780('0x3')]},'starttime':{'type':Sequelize[_0xc780('0x4')]},'responsetime':{'type':Sequelize[_0xc780('0x4')]},'answertime':{'type':Sequelize[_0xc780('0x4')]},'droptime':{'type':Sequelize[_0xc780('0x4')]},'endtime':{'type':Sequelize[_0xc780('0x4')]},'ringtime':{'type':Sequelize[_0xc780('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc780('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc780('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc780('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc780('0x3')]},'campaign':{'type':Sequelize[_0xc780('0x3')]},'campaigntype':{'type':Sequelize[_0xc780('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xc780('0x3')]},'amd':{'type':Sequelize[_0xc780('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc780('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc780('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc780('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc780('0x4')]},'edited':{'type':Sequelize[_0xc780('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc780('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc780('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9ecb8b4..0c87e4b 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 _0x15cf=['error','name','send','map','CmHopperHistory','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','catch','show','params','include','create','body','describe','uniqueid','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then'];(function(_0x28fca4,_0x11e78b){var _0x42fd01=function(_0x33a97e){while(--_0x33a97e){_0x28fca4['push'](_0x28fca4['shift']());}};_0x42fd01(++_0x11e78b);}(_0x15cf,0x17b));var _0xf15c=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x15cf[_0x4c98b9];return _0x3a257a;};'use strict';var emlformat=require(_0xf15c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf15c('0x1'));var jsonpatch=require(_0xf15c('0x2'));var rp=require('request-promise');var moment=require(_0xf15c('0x3'));var BPromise=require(_0xf15c('0x4'));var Mustache=require(_0xf15c('0x5'));var util=require(_0xf15c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf15c('0x7'));var ejs=require(_0xf15c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf15c('0x9'));var crypto=require('crypto');var jsforce=require(_0xf15c('0xa'));var deskjs=require(_0xf15c('0xb'));var toCsv=require(_0xf15c('0x7'));var querystring=require(_0xf15c('0xc'));var Papa=require(_0xf15c('0xd'));var Redis=require(_0xf15c('0xe'));var authService=require(_0xf15c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15c('0x10'));var logger=require('../../config/logger')(_0xf15c('0x11'));var utils=require(_0xf15c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf15c('0x13'));var db=require(_0xf15c('0x14'))['db'];function respondWithStatusCode(_0x1fcf30,_0x1057fe){_0x1057fe=_0x1057fe||0xcc;return function(_0xc37bf2){if(_0xc37bf2){return _0x1fcf30[_0xf15c('0x15')](_0x1057fe);}return _0x1fcf30[_0xf15c('0x16')](_0x1057fe)[_0xf15c('0x17')]();};}function respondWithResult(_0xfc222,_0x50b2cd){_0x50b2cd=_0x50b2cd||0xc8;return function(_0x2af518){if(_0x2af518){return _0xfc222[_0xf15c('0x16')](_0x50b2cd)['json'](_0x2af518);}};}function respondWithFilteredResult(_0x3d9df8,_0x4eb20f){return function(_0x5dff2e){if(_0x5dff2e){var _0xc7cacd=typeof _0x4eb20f[_0xf15c('0x18')]===_0xf15c('0x19')&&typeof _0x4eb20f[_0xf15c('0x1a')]===_0xf15c('0x19');var _0x2603e1=_0x5dff2e[_0xf15c('0x1b')];var _0x2eec7e=_0xc7cacd?0x0:_0x4eb20f[_0xf15c('0x18')];var _0x5f09f5=_0xc7cacd?_0x5dff2e[_0xf15c('0x1b')]:_0x4eb20f['offset']+_0x4eb20f['limit'];var _0x52aa33;if(_0x5f09f5>=_0x2603e1){_0x5f09f5=_0x2603e1;_0x52aa33=0xc8;}else{_0x52aa33=0xce;}_0x3d9df8[_0xf15c('0x16')](_0x52aa33);return _0x3d9df8[_0xf15c('0x1c')](_0xf15c('0x1d'),_0x2eec7e+'-'+_0x5f09f5+'/'+_0x2603e1)[_0xf15c('0x1e')](_0x5dff2e);}return null;};}function patchUpdates(_0xce497){return function(_0x13a4b9){try{jsonpatch[_0xf15c('0x1f')](_0x13a4b9,_0xce497,!![]);}catch(_0x24e3ed){return BPromise[_0xf15c('0x20')](_0x24e3ed);}return _0x13a4b9['save']();};}function saveUpdates(_0x16f15c,_0x19a48d){return function(_0x1dff67){if(_0x1dff67){return _0x1dff67[_0xf15c('0x21')](_0x16f15c)[_0xf15c('0x22')](function(_0x2f4498){return _0x2f4498;});}return null;};}function removeEntity(_0x56ca75,_0x22b07e){return function(_0x571ad6){if(_0x571ad6){return _0x571ad6['destroy']()[_0xf15c('0x22')](function(){_0x56ca75[_0xf15c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x176a5e,_0x37aa75){return function(_0x1596ae){if(!_0x1596ae){_0x176a5e['sendStatus'](0x194);}return _0x1596ae;};}function handleError(_0x1722bf,_0x4db9eb){_0x4db9eb=_0x4db9eb||0x1f4;return function(_0x356872){logger[_0xf15c('0x23')](_0x356872['stack']);if(_0x356872['name']){delete _0x356872[_0xf15c('0x24')];}_0x1722bf[_0xf15c('0x16')](_0x4db9eb)[_0xf15c('0x25')](_0x356872);};}exports['index']=function(_0x173275,_0x11edbf){var _0x2a753d={},_0x1f5364={},_0xe0c49a={'count':0x0,'rows':[]};var _0x1d3cc8=_[_0xf15c('0x26')](db[_0xf15c('0x27')][_0xf15c('0x28')],function(_0x4e595e){return{'name':_0x4e595e['fieldName'],'type':_0x4e595e[_0xf15c('0x29')][_0xf15c('0x2a')]};});_0x1f5364[_0xf15c('0x2b')]=_[_0xf15c('0x26')](_0x1d3cc8,'name');_0x1f5364[_0xf15c('0x2c')]=_[_0xf15c('0x2d')](_0x173275['query']);_0x1f5364[_0xf15c('0x2e')]=_[_0xf15c('0x2f')](_0x1f5364[_0xf15c('0x2b')],_0x1f5364[_0xf15c('0x2c')]);_0x2a753d[_0xf15c('0x30')]=_['intersection'](_0x1f5364[_0xf15c('0x2b')],qs['fields'](_0x173275[_0xf15c('0x2c')][_0xf15c('0x31')]));_0x2a753d[_0xf15c('0x30')]=_0x2a753d[_0xf15c('0x30')][_0xf15c('0x32')]?_0x2a753d[_0xf15c('0x30')]:_0x1f5364[_0xf15c('0x2b')];if(!_0x173275[_0xf15c('0x2c')][_0xf15c('0x33')](_0xf15c('0x34'))){_0x2a753d[_0xf15c('0x1a')]=qs[_0xf15c('0x1a')](_0x173275[_0xf15c('0x2c')][_0xf15c('0x1a')]);_0x2a753d[_0xf15c('0x18')]=qs[_0xf15c('0x18')](_0x173275[_0xf15c('0x2c')][_0xf15c('0x18')]);}_0x2a753d['order']=qs[_0xf15c('0x35')](_0x173275[_0xf15c('0x2c')][_0xf15c('0x35')]);_0x2a753d[_0xf15c('0x36')]=qs[_0xf15c('0x2e')](_['pick'](_0x173275[_0xf15c('0x2c')],_0x1f5364[_0xf15c('0x2e')]),_0x1d3cc8);if(_0x173275['query']['filter']){_0x2a753d[_0xf15c('0x36')]=_[_0xf15c('0x37')](_0x2a753d[_0xf15c('0x36')],{'$or':_[_0xf15c('0x26')](_0x1d3cc8,function(_0x153042){if(_0x153042[_0xf15c('0x29')]!==_0xf15c('0x38')){var _0x96cfef={};_0x96cfef[_0x153042[_0xf15c('0x24')]]={'$like':'%'+_0x173275[_0xf15c('0x2c')][_0xf15c('0x39')]+'%'};return _0x96cfef;}})});}_0x2a753d=_[_0xf15c('0x37')]({},_0x2a753d,_0x173275[_0xf15c('0x3a')]);var _0xaee811={'where':_0x2a753d[_0xf15c('0x36')]};return db[_0xf15c('0x27')]['count'](_0xaee811)['then'](function(_0x3cf69c){_0xe0c49a[_0xf15c('0x1b')]=_0x3cf69c;if(_0x173275[_0xf15c('0x2c')][_0xf15c('0x3b')]){_0x2a753d['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x2a753d);})[_0xf15c('0x22')](function(_0x10ede0){_0xe0c49a['rows']=_0x10ede0;return _0xe0c49a;})[_0xf15c('0x22')](respondWithFilteredResult(_0x11edbf,_0x2a753d))[_0xf15c('0x3c')](handleError(_0x11edbf,null));};exports[_0xf15c('0x3d')]=function(_0x1e930d,_0x385390){var _0x26f349={'raw':!![],'where':{'id':_0x1e930d[_0xf15c('0x3e')]['id']}},_0x31fe3e={};_0x31fe3e[_0xf15c('0x2b')]=_[_0xf15c('0x2d')](db[_0xf15c('0x27')][_0xf15c('0x28')]);_0x31fe3e['query']=_[_0xf15c('0x2d')](_0x1e930d[_0xf15c('0x2c')]);_0x31fe3e[_0xf15c('0x2e')]=_[_0xf15c('0x2f')](_0x31fe3e['model'],_0x31fe3e[_0xf15c('0x2c')]);_0x26f349[_0xf15c('0x30')]=_[_0xf15c('0x2f')](_0x31fe3e[_0xf15c('0x2b')],qs[_0xf15c('0x31')](_0x1e930d[_0xf15c('0x2c')][_0xf15c('0x31')]));_0x26f349[_0xf15c('0x30')]=_0x26f349[_0xf15c('0x30')][_0xf15c('0x32')]?_0x26f349['attributes']:_0x31fe3e[_0xf15c('0x2b')];if(_0x1e930d['query'][_0xf15c('0x3b')]){_0x26f349[_0xf15c('0x3f')]=[{'all':!![]}];}_0x26f349=_[_0xf15c('0x37')]({},_0x26f349,_0x1e930d[_0xf15c('0x3a')]);return db[_0xf15c('0x27')]['find'](_0x26f349)[_0xf15c('0x22')](handleEntityNotFound(_0x385390,null))[_0xf15c('0x22')](respondWithResult(_0x385390,null))[_0xf15c('0x3c')](handleError(_0x385390,null));};exports[_0xf15c('0x40')]=function(_0x5ad4a7,_0xb9a319){return db[_0xf15c('0x27')]['create'](_0x5ad4a7[_0xf15c('0x41')],{})[_0xf15c('0x22')](respondWithResult(_0xb9a319,0xc9))[_0xf15c('0x3c')](handleError(_0xb9a319,null));};exports[_0xf15c('0x42')]=function(_0x48fa46,_0x3c414f){return db[_0xf15c('0x27')]['describe']()[_0xf15c('0x22')](respondWithResult(_0x3c414f,null))[_0xf15c('0x3c')](handleError(_0x3c414f,null));};exports[_0xf15c('0x21')]=function(_0x246470,_0xc59beb){if(_0x246470['body'][_0xf15c('0x43')]){delete _0x246470[_0xf15c('0x41')][_0xf15c('0x43')];}return db[_0xf15c('0x27')][_0xf15c('0x44')]({'where':{'uniqueid':_0x246470['params']['id']}})[_0xf15c('0x22')](handleEntityNotFound(_0xc59beb,null))[_0xf15c('0x22')](saveUpdates(_0x246470[_0xf15c('0x41')],null))['then'](respondWithResult(_0xc59beb,null))[_0xf15c('0x3c')](handleError(_0xc59beb,null));}; \ No newline at end of file +var _0xb881=['json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','CmHopperHistory','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','keys','rawAttributes','intersection','create','describe','body','find','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x293e1a,_0x25ecfc){var _0x5b6a1e=function(_0x776e9b){while(--_0x776e9b){_0x293e1a['push'](_0x293e1a['shift']());}};_0x5b6a1e(++_0x25ecfc);}(_0xb881,0xc2));var _0x1b88=function(_0xb15db6,_0x388d94){_0xb15db6=_0xb15db6-0x0;var _0x1db34d=_0xb881[_0xb15db6];return _0x1db34d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b88('0x0'));var zipdir=require(_0x1b88('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b88('0x2'));var BPromise=require(_0x1b88('0x3'));var Mustache=require(_0x1b88('0x4'));var util=require(_0x1b88('0x5'));var path=require('path');var sox=require(_0x1b88('0x6'));var csv=require(_0x1b88('0x7'));var ejs=require(_0x1b88('0x8'));var fs=require('fs');var fs_extra=require(_0x1b88('0x9'));var _=require('lodash');var squel=require(_0x1b88('0xa'));var crypto=require(_0x1b88('0xb'));var jsforce=require(_0x1b88('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1b88('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b88('0xd'));var authService=require(_0x1b88('0xe'));var qs=require(_0x1b88('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b88('0x10'));var logger=require(_0x1b88('0x11'))('api');var utils=require(_0x1b88('0x12'));var config=require(_0x1b88('0x13'));var licenseUtil=require(_0x1b88('0x14'));var db=require(_0x1b88('0x15'))['db'];function respondWithStatusCode(_0x5b777f,_0x45df85){_0x45df85=_0x45df85||0xcc;return function(_0x3114ff){if(_0x3114ff){return _0x5b777f[_0x1b88('0x16')](_0x45df85);}return _0x5b777f[_0x1b88('0x17')](_0x45df85)[_0x1b88('0x18')]();};}function respondWithResult(_0x21b58c,_0x3f6586){_0x3f6586=_0x3f6586||0xc8;return function(_0x4033bd){if(_0x4033bd){return _0x21b58c[_0x1b88('0x17')](_0x3f6586)[_0x1b88('0x19')](_0x4033bd);}};}function respondWithFilteredResult(_0x29d130,_0x587803){return function(_0x33fca1){if(_0x33fca1){var _0x2d30a5=typeof _0x587803['offset']==='undefined'&&typeof _0x587803[_0x1b88('0x1a')]===_0x1b88('0x1b');var _0x5508e3=_0x33fca1[_0x1b88('0x1c')];var _0x3ae2ae=_0x2d30a5?0x0:_0x587803[_0x1b88('0x1d')];var _0x40b23d=_0x2d30a5?_0x33fca1[_0x1b88('0x1c')]:_0x587803[_0x1b88('0x1d')]+_0x587803['limit'];var _0x3aa28a;if(_0x40b23d>=_0x5508e3){_0x40b23d=_0x5508e3;_0x3aa28a=0xc8;}else{_0x3aa28a=0xce;}_0x29d130[_0x1b88('0x17')](_0x3aa28a);return _0x29d130[_0x1b88('0x1e')](_0x1b88('0x1f'),_0x3ae2ae+'-'+_0x40b23d+'/'+_0x5508e3)[_0x1b88('0x19')](_0x33fca1);}return null;};}function patchUpdates(_0x13c6c7){return function(_0x406eeb){try{jsonpatch[_0x1b88('0x20')](_0x406eeb,_0x13c6c7,!![]);}catch(_0x3940aa){return BPromise[_0x1b88('0x21')](_0x3940aa);}return _0x406eeb[_0x1b88('0x22')]();};}function saveUpdates(_0x8063c1,_0x426d6c){return function(_0x317484){if(_0x317484){return _0x317484[_0x1b88('0x23')](_0x8063c1)['then'](function(_0x84aa5a){return _0x84aa5a;});}return null;};}function removeEntity(_0x5c4e8c,_0x2b7bf6){return function(_0x3fa429){if(_0x3fa429){return _0x3fa429['destroy']()[_0x1b88('0x24')](function(){_0x5c4e8c['status'](0xcc)[_0x1b88('0x18')]();});}};}function handleEntityNotFound(_0x14c110,_0x3b7e6a){return function(_0x365814){if(!_0x365814){_0x14c110['sendStatus'](0x194);}return _0x365814;};}function handleError(_0x6acb69,_0x1e8b74){_0x1e8b74=_0x1e8b74||0x1f4;return function(_0x1f6360){logger[_0x1b88('0x25')](_0x1f6360[_0x1b88('0x26')]);if(_0x1f6360[_0x1b88('0x27')]){delete _0x1f6360[_0x1b88('0x27')];}_0x6acb69[_0x1b88('0x17')](_0x1e8b74)[_0x1b88('0x28')](_0x1f6360);};}exports[_0x1b88('0x29')]=function(_0x437532,_0x5855fe){var _0x70e3fd={},_0x5e2c90={},_0x50ec32={'count':0x0,'rows':[]};var _0x1af869=_[_0x1b88('0x2a')](db[_0x1b88('0x2b')]['rawAttributes'],function(_0x57d615){return{'name':_0x57d615[_0x1b88('0x2c')],'type':_0x57d615[_0x1b88('0x2d')][_0x1b88('0x2e')]};});_0x5e2c90[_0x1b88('0x2f')]=_[_0x1b88('0x2a')](_0x1af869,_0x1b88('0x27'));_0x5e2c90[_0x1b88('0x30')]=_['keys'](_0x437532[_0x1b88('0x30')]);_0x5e2c90[_0x1b88('0x31')]=_['intersection'](_0x5e2c90['model'],_0x5e2c90[_0x1b88('0x30')]);_0x70e3fd['attributes']=_['intersection'](_0x5e2c90[_0x1b88('0x2f')],qs[_0x1b88('0x32')](_0x437532[_0x1b88('0x30')]['fields']));_0x70e3fd['attributes']=_0x70e3fd[_0x1b88('0x33')][_0x1b88('0x34')]?_0x70e3fd[_0x1b88('0x33')]:_0x5e2c90[_0x1b88('0x2f')];if(!_0x437532['query'][_0x1b88('0x35')]('nolimit')){_0x70e3fd[_0x1b88('0x1a')]=qs[_0x1b88('0x1a')](_0x437532[_0x1b88('0x30')][_0x1b88('0x1a')]);_0x70e3fd[_0x1b88('0x1d')]=qs[_0x1b88('0x1d')](_0x437532['query'][_0x1b88('0x1d')]);}_0x70e3fd[_0x1b88('0x36')]=qs[_0x1b88('0x37')](_0x437532[_0x1b88('0x30')][_0x1b88('0x37')]);_0x70e3fd['where']=qs['filters'](_[_0x1b88('0x38')](_0x437532[_0x1b88('0x30')],_0x5e2c90[_0x1b88('0x31')]),_0x1af869);if(_0x437532[_0x1b88('0x30')][_0x1b88('0x39')]){_0x70e3fd[_0x1b88('0x3a')]=_[_0x1b88('0x3b')](_0x70e3fd['where'],{'$or':_['map'](_0x1af869,function(_0x27b982){if(_0x27b982[_0x1b88('0x2d')]!=='VIRTUAL'){var _0x20e59d={};_0x20e59d[_0x27b982[_0x1b88('0x27')]]={'$like':'%'+_0x437532[_0x1b88('0x30')][_0x1b88('0x39')]+'%'};return _0x20e59d;}})});}_0x70e3fd=_[_0x1b88('0x3b')]({},_0x70e3fd,_0x437532[_0x1b88('0x3c')]);var _0x15cc7d={'where':_0x70e3fd[_0x1b88('0x3a')]};return db[_0x1b88('0x2b')][_0x1b88('0x1c')](_0x15cc7d)[_0x1b88('0x24')](function(_0x119a9c){_0x50ec32[_0x1b88('0x1c')]=_0x119a9c;if(_0x437532[_0x1b88('0x30')]['includeAll']){_0x70e3fd[_0x1b88('0x3d')]=[{'all':!![]}];}return db[_0x1b88('0x2b')][_0x1b88('0x3e')](_0x70e3fd);})[_0x1b88('0x24')](function(_0xbf21ca){_0x50ec32[_0x1b88('0x3f')]=_0xbf21ca;return _0x50ec32;})['then'](respondWithFilteredResult(_0x5855fe,_0x70e3fd))[_0x1b88('0x40')](handleError(_0x5855fe,null));};exports[_0x1b88('0x41')]=function(_0x5333f3,_0x4c240d){var _0x1e87ea={'raw':!![],'where':{'id':_0x5333f3['params']['id']}},_0x28e59a={};_0x28e59a[_0x1b88('0x2f')]=_[_0x1b88('0x42')](db['CmHopperHistory'][_0x1b88('0x43')]);_0x28e59a['query']=_[_0x1b88('0x42')](_0x5333f3['query']);_0x28e59a[_0x1b88('0x31')]=_[_0x1b88('0x44')](_0x28e59a[_0x1b88('0x2f')],_0x28e59a[_0x1b88('0x30')]);_0x1e87ea[_0x1b88('0x33')]=_['intersection'](_0x28e59a[_0x1b88('0x2f')],qs[_0x1b88('0x32')](_0x5333f3[_0x1b88('0x30')][_0x1b88('0x32')]));_0x1e87ea[_0x1b88('0x33')]=_0x1e87ea[_0x1b88('0x33')][_0x1b88('0x34')]?_0x1e87ea[_0x1b88('0x33')]:_0x28e59a['model'];if(_0x5333f3[_0x1b88('0x30')]['includeAll']){_0x1e87ea[_0x1b88('0x3d')]=[{'all':!![]}];}_0x1e87ea=_[_0x1b88('0x3b')]({},_0x1e87ea,_0x5333f3[_0x1b88('0x3c')]);return db[_0x1b88('0x2b')]['find'](_0x1e87ea)[_0x1b88('0x24')](handleEntityNotFound(_0x4c240d,null))[_0x1b88('0x24')](respondWithResult(_0x4c240d,null))[_0x1b88('0x40')](handleError(_0x4c240d,null));};exports[_0x1b88('0x45')]=function(_0xff0905,_0x152a6c){return db[_0x1b88('0x2b')][_0x1b88('0x45')](_0xff0905['body'],{})[_0x1b88('0x24')](respondWithResult(_0x152a6c,0xc9))['catch'](handleError(_0x152a6c,null));};exports[_0x1b88('0x46')]=function(_0x5aa473,_0x55ff83){return db[_0x1b88('0x2b')][_0x1b88('0x46')]()[_0x1b88('0x24')](respondWithResult(_0x55ff83,null))[_0x1b88('0x40')](handleError(_0x55ff83,null));};exports['update']=function(_0x4bd63a,_0x21521a){if(_0x4bd63a[_0x1b88('0x47')]['uniqueid']){delete _0x4bd63a[_0x1b88('0x47')]['uniqueid'];}return db[_0x1b88('0x2b')][_0x1b88('0x48')]({'where':{'uniqueid':_0x4bd63a['params']['id']}})[_0x1b88('0x24')](handleEntityNotFound(_0x21521a,null))[_0x1b88('0x24')](saveUpdates(_0x4bd63a[_0x1b88('0x47')],null))['then'](respondWithResult(_0x21521a,null))[_0x1b88('0x40')](handleError(_0x21521a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 5686299..e56d6b0 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 _0x38b2=['./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x38b2,0xf6));var _0x238b=function(_0x3ae86c,_0x36fe9a){_0x3ae86c=_0x3ae86c-0x0;var _0x3f7ecb=_0x38b2[_0x3ae86c];return _0x3f7ecb;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var logger=require(_0x238b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x238b('0x3'));var rp=require(_0x238b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x238b('0x5'));var config=require('../../config/environment');var attributes=require(_0x238b('0x6'));module[_0x238b('0x7')]=function(_0x2fb980,_0xb6f089){return _0x2fb980['define'](_0x238b('0x8'),attributes,{'tableName':_0x238b('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x238b('0xa')]},{'name':_0x238b('0xb'),'fields':[_0x238b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb8d=['rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','endtime','uniqueid','lodash','../../config/logger','request-promise','path'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xbb8d,0x146));var _0xdbb8=function(_0x3bedf9,_0x3d761c){_0x3bedf9=_0x3bedf9-0x0;var _0x3843dc=_0xbb8d[_0x3bedf9];return _0x3843dc;};'use strict';var _=require(_0xdbb8('0x0'));var util=require('util');var logger=require(_0xdbb8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdbb8('0x2'));var fs=require('fs');var path=require(_0xdbb8('0x3'));var rimraf=require(_0xdbb8('0x4'));var config=require(_0xdbb8('0x5'));var attributes=require(_0xdbb8('0x6'));module['exports']=function(_0x6a6db3,_0x149c99){return _0x6a6db3[_0xdbb8('0x7')](_0xdbb8('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xdbb8('0x9'),'fields':['endtime']},{'name':_0xdbb8('0xa'),'fields':[_0xdbb8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 00865d4..09f2700 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 _0xc1c3=['COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`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','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','body','options','catch','AvgHandleTime','findAll','raw','where','sequelize'];(function(_0x497add,_0x28f093){var _0xd7263d=function(_0x352fe4){while(--_0x352fe4){_0x497add['push'](_0x497add['shift']());}};_0xd7263d(++_0x28f093);}(_0xc1c3,0x1b5));var _0x3c1c=function(_0x1a03e9,_0xdef2a9){_0x1a03e9=_0x1a03e9-0x0;var _0x2829d8=_0xc1c3[_0x1a03e9];return _0x2829d8;};'use strict';var _=require(_0x3c1c('0x0'));var util=require(_0x3c1c('0x1'));var moment=require(_0x3c1c('0x2'));var BPromise=require(_0x3c1c('0x3'));var rs=require(_0x3c1c('0x4'));var fs=require('fs');var Redis=require(_0x3c1c('0x5'));var db=require(_0x3c1c('0x6'))['db'];var utils=require(_0x3c1c('0x7'));var logger=require(_0x3c1c('0x8'))('rpc');var config=require(_0x3c1c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3c1c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55d910,_0x299da6,_0x52f633){return new BPromise(function(_0x27fc76,_0x16c989){return client[_0x3c1c('0xb')](_0x55d910,_0x52f633)[_0x3c1c('0xc')](function(_0x395171){logger[_0x3c1c('0xd')](_0x3c1c('0xe'),_0x299da6,_0x3c1c('0xf'));logger[_0x3c1c('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x299da6,'request\x20sent',JSON[_0x3c1c('0x11')](_0x395171));if(_0x395171[_0x3c1c('0x12')]){if(_0x395171[_0x3c1c('0x12')][_0x3c1c('0x13')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x299da6,_0x395171[_0x3c1c('0x12')]['message']);return _0x16c989(_0x395171[_0x3c1c('0x12')][_0x3c1c('0x14')]);}logger[_0x3c1c('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x299da6,_0x395171['error'][_0x3c1c('0x14')]);return _0x27fc76(_0x395171['error'][_0x3c1c('0x14')]);}else{logger[_0x3c1c('0xd')](_0x3c1c('0xe'),_0x299da6,_0x3c1c('0xf'));_0x27fc76(_0x395171[_0x3c1c('0x15')][_0x3c1c('0x14')]);}})['catch'](function(_0x3293a1){logger[_0x3c1c('0x12')](_0x3c1c('0xe'),_0x299da6,_0x3293a1);_0x16c989(_0x3293a1);});});}exports[_0x3c1c('0x16')]=function(_0x377b8e){var _0x3db631=this;return new Promise(function(_0x17ee10,_0x412756){return db[_0x3c1c('0x17')]['create'](_0x377b8e[_0x3c1c('0x18')],{'raw':_0x377b8e[_0x3c1c('0x19')]?_0x377b8e[_0x3c1c('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x400213){logger[_0x3c1c('0xd')](_0x3c1c('0x16'),_0x377b8e);logger[_0x3c1c('0x10')](_0x3c1c('0x16'),_0x377b8e,JSON[_0x3c1c('0x11')](_0x400213));_0x17ee10(_0x400213);})[_0x3c1c('0x1a')](function(_0x1c6ae1){logger['error'](_0x3c1c('0x16'),_0x1c6ae1[_0x3c1c('0x14')],_0x377b8e);_0x412756(_0x3db631['error'](0x1f4,_0x1c6ae1[_0x3c1c('0x14')]));});});};exports[_0x3c1c('0x1b')]=function(_0x3cf412){var _0xd5938=this;return new Promise(function(_0x218238,_0x5b573c){return db['CmHopperHistory'][_0x3c1c('0x1c')]({'raw':_0x3cf412['options']?_0x3cf412[_0x3c1c('0x19')][_0x3c1c('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cf412[_0x3c1c('0x19')]?_0x3cf412[_0x3c1c('0x19')][_0x3c1c('0x1e')]||null:null,'attributes':[[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x3c1c('0x1f')]['fn']('COUNT',db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')]['literal'](_0x3c1c('0x21')))),_0x3c1c('0x22')],[db[_0x3c1c('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')]['literal'](_0x3c1c('0x23')))),_0x3c1c('0x24')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x26')))),_0x3c1c('0x27')],[db['sequelize']['fn'](_0x3c1c('0x28'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x29')))),'predictiveIntervalAvgHoldtime'],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x28'),db[_0x3c1c('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3c1c('0x2a')]]})['then'](function(_0x2773c0){logger['info'](_0x3c1c('0x1b'),_0x3cf412);logger[_0x3c1c('0x10')](_0x3c1c('0x1b'),_0x3cf412,JSON[_0x3c1c('0x11')](_0x2773c0));_0x218238(_0x2773c0);})[_0x3c1c('0x1a')](function(_0x12d79c){logger[_0x3c1c('0x12')](_0x3c1c('0x1b'),_0x12d79c[_0x3c1c('0x14')],_0x3cf412);_0x5b573c(_0xd5938[_0x3c1c('0x12')](0x1f4,_0x12d79c['message']));});});};exports[_0x3c1c('0x2b')]=function(_0xeed139){var _0x242ab1=this;return new Promise(function(_0x964859,_0x25050c){return db['CmHopperHistory'][_0x3c1c('0x1c')]({'raw':_0xeed139[_0x3c1c('0x19')]?_0xeed139['options'][_0x3c1c('0x1d')]===undefined?!![]:![]:!![],'where':_0xeed139[_0x3c1c('0x19')]?_0xeed139[_0x3c1c('0x19')]['where']||null:null,'attributes':[[_0x3c1c('0x2c'),_0x3c1c('0x2d')],[db[_0x3c1c('0x1f')]['fn']('COUNT',db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x2e')))),_0x3c1c('0x2f')],[db[_0x3c1c('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x30')))),_0x3c1c('0x31')],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x32')))),_0x3c1c('0x33')],[db['sequelize']['fn'](_0x3c1c('0x20'),db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')]('`state`\x20=\x208,\x201,\x20null'))),_0x3c1c('0x34')],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db['sequelize'][_0x3c1c('0x25')](_0x3c1c('0x35')))),'outboundDropCallsDayTimeout'],[db[_0x3c1c('0x1f')]['fn']('COUNT',db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x36')))),_0x3c1c('0x37')],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x38')))),_0x3c1c('0x39')],[db['sequelize']['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')]['literal'](_0x3c1c('0x3a')))),_0x3c1c('0x3b')],[db['sequelize']['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0x3c1c('0x3c')],[db[_0x3c1c('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x3d')))),_0x3c1c('0x3e')],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db['sequelize'][_0x3c1c('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0x3c1c('0x3f')],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db['sequelize'][_0x3c1c('0x25')](_0x3c1c('0x40')))),'outboundRejectCallsDay'],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x3c1c('0x41')]],'group':[_0x3c1c('0x2c')]})[_0x3c1c('0xc')](function(_0xf8c4f5){logger[_0x3c1c('0xd')](_0x3c1c('0x2b'),_0xeed139);logger['debug']('GetVoiceQueueHopperHistory',_0xeed139,JSON[_0x3c1c('0x11')](_0xf8c4f5));_0x964859(_0xf8c4f5);})[_0x3c1c('0x1a')](function(_0xef3726){logger[_0x3c1c('0x12')](_0x3c1c('0x2b'),_0xef3726[_0x3c1c('0x14')],_0xeed139);_0x25050c(_0x242ab1['error'](0x1f4,_0xef3726['message']));});});};exports[_0x3c1c('0x42')]=function(_0x2d59dd){var _0x712c39=this;return new Promise(function(_0x34dd16,_0x356a89){return db['CmHopperHistory'][_0x3c1c('0x1c')]({'raw':_0x2d59dd[_0x3c1c('0x19')]?_0x2d59dd[_0x3c1c('0x19')][_0x3c1c('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d59dd[_0x3c1c('0x19')]?_0x2d59dd['options'][_0x3c1c('0x1e')]||null:null,'attributes':[[_0x3c1c('0x2c'),_0x3c1c('0x2d')],[db[_0x3c1c('0x1f')]['fn']('COUNT',db[_0x3c1c('0x1f')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x3c1c('0x20'),db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x21')))),'ivrAnswerCallsDay']],'group':[_0x3c1c('0x2c')]})[_0x3c1c('0xc')](function(_0x251f95){logger[_0x3c1c('0xd')]('GetCampaignHopperHistory',_0x2d59dd);logger[_0x3c1c('0x10')](_0x3c1c('0x42'),_0x2d59dd,JSON[_0x3c1c('0x11')](_0x251f95));_0x34dd16(_0x251f95);})[_0x3c1c('0x1a')](function(_0x4f8bde){logger[_0x3c1c('0x12')](_0x3c1c('0x42'),_0x4f8bde[_0x3c1c('0x14')],_0x2d59dd);_0x356a89(_0x712c39[_0x3c1c('0x12')](0x1f4,_0x4f8bde[_0x3c1c('0x14')]));});});}; \ No newline at end of file +var _0x2285=['predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`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','ivrTotalCallsDays','GetCampaignHopperHistory','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x2285,0x177));var _0x5228=function(_0x1fcb15,_0x50ac01){_0x1fcb15=_0x1fcb15-0x0;var _0xcbc1c9=_0x2285[_0x1fcb15];return _0xcbc1c9;};'use strict';var _=require('lodash');var util=require(_0x5228('0x0'));var moment=require(_0x5228('0x1'));var BPromise=require(_0x5228('0x2'));var rs=require(_0x5228('0x3'));var fs=require('fs');var Redis=require(_0x5228('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5228('0x5'));var logger=require(_0x5228('0x6'))('rpc');var config=require(_0x5228('0x7'));var jayson=require(_0x5228('0x8'));var client=jayson[_0x5228('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18b2db,_0x156977,_0x192393){return new BPromise(function(_0x322b86,_0x81c9c6){return client[_0x5228('0xa')](_0x18b2db,_0x192393)[_0x5228('0xb')](function(_0xbd1b8d){logger[_0x5228('0xc')](_0x5228('0xd'),_0x156977,'request\x20sent');logger[_0x5228('0xe')](_0x5228('0xf'),_0x156977,_0x5228('0x10'),JSON[_0x5228('0x11')](_0xbd1b8d));if(_0xbd1b8d['error']){if(_0xbd1b8d[_0x5228('0x12')][_0x5228('0x13')]===0x1f4){logger[_0x5228('0x12')](_0x5228('0xd'),_0x156977,_0xbd1b8d['error'][_0x5228('0x14')]);return _0x81c9c6(_0xbd1b8d[_0x5228('0x12')][_0x5228('0x14')]);}logger[_0x5228('0x12')](_0x5228('0xd'),_0x156977,_0xbd1b8d[_0x5228('0x12')]['message']);return _0x322b86(_0xbd1b8d[_0x5228('0x12')][_0x5228('0x14')]);}else{logger['info'](_0x5228('0xd'),_0x156977,_0x5228('0x10'));_0x322b86(_0xbd1b8d['result'][_0x5228('0x14')]);}})[_0x5228('0x15')](function(_0x1c4121){logger[_0x5228('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x156977,_0x1c4121);_0x81c9c6(_0x1c4121);});});}exports[_0x5228('0x16')]=function(_0x23419b){var _0x5c9abd=this;return new Promise(function(_0x41b812,_0x2c7dc4){return db[_0x5228('0x17')]['create'](_0x23419b[_0x5228('0x18')],{'raw':_0x23419b['options']?_0x23419b[_0x5228('0x19')][_0x5228('0x1a')]===undefined?!![]:![]:!![]})[_0x5228('0xb')](function(_0x52d49e){logger[_0x5228('0xc')](_0x5228('0x16'),_0x23419b);logger[_0x5228('0xe')](_0x5228('0x16'),_0x23419b,JSON['stringify'](_0x52d49e));_0x41b812(_0x52d49e);})['catch'](function(_0x28aba5){logger[_0x5228('0x12')]('CreateCmHopperHistory',_0x28aba5[_0x5228('0x14')],_0x23419b);_0x2c7dc4(_0x5c9abd[_0x5228('0x12')](0x1f4,_0x28aba5[_0x5228('0x14')]));});});};exports[_0x5228('0x1b')]=function(_0x63ce01){var _0x77d919=this;return new Promise(function(_0x2661a6,_0x5a3e6d){return db[_0x5228('0x17')]['findAll']({'raw':_0x63ce01[_0x5228('0x19')]?_0x63ce01[_0x5228('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x63ce01['options']?_0x63ce01['options'][_0x5228('0x1c')]||null:null,'attributes':[[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db['sequelize'][_0x5228('0x1f')]('id')),_0x5228('0x20')],[db[_0x5228('0x1d')]['fn']('COUNT',db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')][_0x5228('0x21')](_0x5228('0x22')))),_0x5228('0x23')],[db['sequelize']['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')][_0x5228('0x21')](_0x5228('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x5228('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x5228('0x1d')]['fn'](_0x5228('0x26'),db['sequelize']['fn']('IF',db[_0x5228('0x1d')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x5228('0x27')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x26'),db[_0x5228('0x1d')]['fn']('IF',db['sequelize'][_0x5228('0x21')](_0x5228('0x28')))),_0x5228('0x29')]]})[_0x5228('0xb')](function(_0x2dfe4b){logger[_0x5228('0xc')]('AvgHandleTime',_0x63ce01);logger[_0x5228('0xe')]('AvgHandleTime',_0x63ce01,JSON[_0x5228('0x11')](_0x2dfe4b));_0x2661a6(_0x2dfe4b);})[_0x5228('0x15')](function(_0x488a65){logger['error']('AvgHandleTime',_0x488a65[_0x5228('0x14')],_0x63ce01);_0x5a3e6d(_0x77d919[_0x5228('0x12')](0x1f4,_0x488a65[_0x5228('0x14')]));});});};exports[_0x5228('0x2a')]=function(_0x2ec1f8){var _0x37a15e=this;return new Promise(function(_0x4d5ff2,_0x493a05){return db[_0x5228('0x17')][_0x5228('0x2b')]({'raw':_0x2ec1f8['options']?_0x2ec1f8[_0x5228('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2ec1f8['options']?_0x2ec1f8[_0x5228('0x19')]['where']||null:null,'attributes':[[_0x5228('0x2c'),_0x5228('0x2d')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x5228('0x2e')],[db['sequelize']['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')][_0x5228('0x21')](_0x5228('0x2f')))),'outboundNoAnswerCallsDay'],[db[_0x5228('0x1d')]['fn']('COUNT',db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')][_0x5228('0x21')](_0x5228('0x22')))),_0x5228('0x30')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db['sequelize']['fn']('IF',db[_0x5228('0x1d')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')][_0x5228('0x21')](_0x5228('0x31')))),_0x5228('0x32')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')][_0x5228('0x21')](_0x5228('0x33')))),_0x5228('0x34')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db['sequelize'][_0x5228('0x21')](_0x5228('0x35')))),_0x5228('0x36')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')][_0x5228('0x21')](_0x5228('0x37')))),_0x5228('0x38')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5228('0x1d')]['literal'](_0x5228('0x39')))),_0x5228('0x3a')],[db[_0x5228('0x1d')]['fn']('COUNT',db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')]['literal'](_0x5228('0x3b')))),_0x5228('0x3c')],[db['sequelize']['fn']('COUNT',db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')][_0x5228('0x21')](_0x5228('0x3d')))),_0x5228('0x3e')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db['sequelize'][_0x5228('0x21')](_0x5228('0x3f')))),_0x5228('0x40')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db['sequelize']['fn']('IF',db[_0x5228('0x1d')]['literal'](_0x5228('0x41')))),_0x5228('0x3e')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')][_0x5228('0x21')](_0x5228('0x42')))),'outboundReCallsDay']],'group':[_0x5228('0x2c')]})[_0x5228('0xb')](function(_0x5883b8){logger[_0x5228('0xc')](_0x5228('0x2a'),_0x2ec1f8);logger[_0x5228('0xe')](_0x5228('0x2a'),_0x2ec1f8,JSON[_0x5228('0x11')](_0x5883b8));_0x4d5ff2(_0x5883b8);})[_0x5228('0x15')](function(_0x16ea83){logger['error'](_0x5228('0x2a'),_0x16ea83[_0x5228('0x14')],_0x2ec1f8);_0x493a05(_0x37a15e[_0x5228('0x12')](0x1f4,_0x16ea83[_0x5228('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x587b82){var _0x3bba93=this;return new Promise(function(_0x480062,_0x54713f){return db[_0x5228('0x17')][_0x5228('0x2b')]({'raw':_0x587b82[_0x5228('0x19')]?_0x587b82[_0x5228('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x587b82[_0x5228('0x19')]?_0x587b82[_0x5228('0x19')][_0x5228('0x1c')]||null:null,'attributes':[[_0x5228('0x2c'),_0x5228('0x2d')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')][_0x5228('0x1f')]('id')),_0x5228('0x43')],[db[_0x5228('0x1d')]['fn'](_0x5228('0x1e'),db[_0x5228('0x1d')]['fn']('IF',db[_0x5228('0x1d')][_0x5228('0x21')](_0x5228('0x22')))),'ivrAnswerCallsDay']],'group':[_0x5228('0x2c')]})[_0x5228('0xb')](function(_0x2473e6){logger['info'](_0x5228('0x44'),_0x587b82);logger[_0x5228('0xe')](_0x5228('0x44'),_0x587b82,JSON[_0x5228('0x11')](_0x2473e6));_0x480062(_0x2473e6);})[_0x5228('0x15')](function(_0x344f2c){logger[_0x5228('0x12')](_0x5228('0x44'),_0x344f2c[_0x5228('0x14')],_0x587b82);_0x54713f(_0x3bba93[_0x5228('0x12')](0x1f4,_0x344f2c[_0x5228('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index fc60179..08c6e08 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 _0x09d7=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','describe','/:id','show','isAuthenticated','create','put','exports','multer'];(function(_0x5775a0,_0xb5770b){var _0x11f5fe=function(_0x24c465){while(--_0x24c465){_0x5775a0['push'](_0x5775a0['shift']());}};_0x11f5fe(++_0xb5770b);}(_0x09d7,0x1cb));var _0x709d=function(_0x26e6f0,_0x11911b){_0x26e6f0=_0x26e6f0-0x0;var _0x28b47d=_0x09d7[_0x26e6f0];return _0x28b47d;};'use strict';var multer=require(_0x709d('0x0'));var util=require(_0x709d('0x1'));var path=require(_0x709d('0x2'));var timeout=require(_0x709d('0x3'));var express=require(_0x709d('0x4'));var router=express['Router']();var fs_extra=require(_0x709d('0x5'));var auth=require(_0x709d('0x6'));var interaction=require(_0x709d('0x7'));var config=require(_0x709d('0x8'));var controller=require(_0x709d('0x9'));router[_0x709d('0xa')]('/',auth['isAuthenticated'](),controller[_0x709d('0xb')]);router[_0x709d('0xa')](_0x709d('0xc'),auth['isAuthenticated'](),controller[_0x709d('0xd')]);router[_0x709d('0xa')](_0x709d('0xe'),auth['isAuthenticated'](),controller[_0x709d('0xf')]);router['post']('/',auth[_0x709d('0x10')](),controller[_0x709d('0x11')]);router[_0x709d('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x709d('0x13')]=router; \ No newline at end of file +var _0x27d1=['Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','describe','/:id','show','isAuthenticated','put','update','multer','path','connect-timeout','express'];(function(_0x3675a0,_0x880caf){var _0x499f7a=function(_0x5e3a38){while(--_0x5e3a38){_0x3675a0['push'](_0x3675a0['shift']());}};_0x499f7a(++_0x880caf);}(_0x27d1,0x84));var _0x127d=function(_0x658d9b,_0xf119e7){_0x658d9b=_0x658d9b-0x0;var _0x515368=_0x27d1[_0x658d9b];return _0x515368;};'use strict';var multer=require(_0x127d('0x0'));var util=require('util');var path=require(_0x127d('0x1'));var timeout=require(_0x127d('0x2'));var express=require(_0x127d('0x3'));var router=express[_0x127d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x127d('0x5'));var config=require(_0x127d('0x6'));var controller=require(_0x127d('0x7'));router[_0x127d('0x8')]('/',auth['isAuthenticated'](),controller[_0x127d('0x9')]);router[_0x127d('0x8')](_0x127d('0xa'),auth['isAuthenticated'](),controller[_0x127d('0xb')]);router[_0x127d('0x8')](_0x127d('0xc'),auth['isAuthenticated'](),controller[_0x127d('0xd')]);router['post']('/',auth[_0x127d('0xe')](),controller['create']);router[_0x127d('0xf')](_0x127d('0xc'),auth[_0x127d('0xe')](),controller[_0x127d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index cf78d8f..ef7b55e 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 _0x1159=['sequelize','name','STRING'];(function(_0x383848,_0x355a95){var _0x1fce74=function(_0x21336c){while(--_0x21336c){_0x383848['push'](_0x383848['shift']());}};_0x1fce74(++_0x355a95);}(_0x1159,0xf3));var _0x9115=function(_0x3a32bf,_0xb9a96d){_0x3a32bf=_0x3a32bf-0x0;var _0x18649b=_0x1159[_0x3a32bf];return _0x18649b;};'use strict';var Sequelize=require(_0x9115('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9115('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9115('0x2')]},'dialPrefix':{'type':Sequelize[_0x9115('0x2')]}}; \ No newline at end of file +var _0x39d9=['exports','STRING','name','sequelize'];(function(_0x2042b8,_0x3cc373){var _0x33ff40=function(_0x2516a0){while(--_0x2516a0){_0x2042b8['push'](_0x2042b8['shift']());}};_0x33ff40(++_0x3cc373);}(_0x39d9,0x17f));var _0x939d=function(_0x20cb5f,_0xb04883){_0x20cb5f=_0x20cb5f-0x0;var _0x446a5a=_0x39d9[_0x20cb5f];return _0x446a5a;};'use strict';var Sequelize=require(_0x939d('0x0'));module[_0x939d('0x1')]={'name':{'type':Sequelize[_0x939d('0x2')],'unique':_0x939d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x939d('0x2')]},'dialPrefix':{'type':Sequelize[_0x939d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index d32f9f5..66c9639 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 _0x3ca4=['stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','user','Lists','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addContacts','tags','isArray','join','push','omit','success','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','CmContact','concat','raw','getContacts','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','c.cf_','customField_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','each','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','info','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','save','update','then','get','UserProfileResource','destroy','end','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ca4,0x73));var _0x43ca=function(_0x5eb61e,_0x41b498){_0x5eb61e=_0x5eb61e-0x0;var _0x3e484c=_0x3ca4[_0x5eb61e];return _0x3e484c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43ca('0x0'));var zipdir=require(_0x43ca('0x1'));var jsonpatch=require(_0x43ca('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43ca('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x43ca('0x4'));var csv=require(_0x43ca('0x5'));var ejs=require(_0x43ca('0x6'));var fs=require('fs');var fs_extra=require(_0x43ca('0x7'));var _=require(_0x43ca('0x8'));var squel=require(_0x43ca('0x9'));var crypto=require(_0x43ca('0xa'));var jsforce=require(_0x43ca('0xb'));var deskjs=require(_0x43ca('0xc'));var toCsv=require(_0x43ca('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x43ca('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x43ca('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43ca('0xf'))(_0x43ca('0x10'));var utils=require(_0x43ca('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0x43ca('0x12')](config[_0x43ca('0x13')],{'host':_0x43ca('0x14'),'port':0x18eb});var socket=require(_0x43ca('0x15'))(new Redis(config[_0x43ca('0x13')]));require(_0x43ca('0x16'))[_0x43ca('0x17')](socket);function respondWithStatusCode(_0x5e484d,_0x5c07f2){_0x5c07f2=_0x5c07f2||0xcc;return function(_0x5b7847){if(_0x5b7847){return _0x5e484d[_0x43ca('0x18')](_0x5c07f2);}return _0x5e484d['status'](_0x5c07f2)['end']();};}function respondWithResult(_0x439351,_0x5b9495){_0x5b9495=_0x5b9495||0xc8;return function(_0x379306){if(_0x379306){return _0x439351[_0x43ca('0x19')](_0x5b9495)['json'](_0x379306);}};}function respondWithFilteredResult(_0x171a56,_0x2a7b66){return function(_0x34a32e){if(_0x34a32e){var _0x11c4e9=typeof _0x2a7b66[_0x43ca('0x1a')]===_0x43ca('0x1b')&&typeof _0x2a7b66[_0x43ca('0x1c')]===_0x43ca('0x1b');var _0x10500e=_0x34a32e['count'];var _0x33366c=_0x11c4e9?0x0:_0x2a7b66[_0x43ca('0x1a')];var _0xe30e50=_0x11c4e9?_0x34a32e[_0x43ca('0x1d')]:_0x2a7b66['offset']+_0x2a7b66['limit'];var _0x5afbde;if(_0xe30e50>=_0x10500e){_0xe30e50=_0x10500e;_0x5afbde=0xc8;}else{_0x5afbde=0xce;}_0x171a56['status'](_0x5afbde);return _0x171a56[_0x43ca('0x1e')]('Content-Range',_0x33366c+'-'+_0xe30e50+'/'+_0x10500e)[_0x43ca('0x1f')](_0x34a32e);}return null;};}function patchUpdates(_0x46bca8){return function(_0x305858){try{jsonpatch['apply'](_0x305858,_0x46bca8,!![]);}catch(_0x24ad5e){return BPromise['reject'](_0x24ad5e);}return _0x305858[_0x43ca('0x20')]();};}function saveUpdates(_0x17a870,_0x1491d3){return function(_0x5a6a12){if(_0x5a6a12){return _0x5a6a12[_0x43ca('0x21')](_0x17a870)['then'](function(_0x4d9222){return _0x4d9222;});}return null;};}function removeEntity(_0x46879d,_0x49914b){return function(_0x34ab34){if(_0x34ab34){return _0x34ab34['destroy']()[_0x43ca('0x22')](function(){var _0x542f93=_0x34ab34[_0x43ca('0x23')]({'plain':!![]});var _0x38f91d='Lists';return db[_0x43ca('0x24')][_0x43ca('0x25')]({'where':{'type':_0x38f91d,'resourceId':_0x542f93['id']}})[_0x43ca('0x22')](function(){return _0x34ab34;});})[_0x43ca('0x22')](function(){_0x46879d[_0x43ca('0x19')](0xcc)[_0x43ca('0x26')]();});}};}function handleEntityNotFound(_0x328489,_0x10c9ae){return function(_0xb618d4){if(!_0xb618d4){_0x328489['sendStatus'](0x194);}return _0xb618d4;};}function handleError(_0x5be0fe,_0x2d2576){_0x2d2576=_0x2d2576||0x1f4;return function(_0x591443){logger[_0x43ca('0x27')](_0x591443[_0x43ca('0x28')]);if(_0x591443[_0x43ca('0x29')]){delete _0x591443[_0x43ca('0x29')];}_0x5be0fe[_0x43ca('0x19')](_0x2d2576)[_0x43ca('0x2a')](_0x591443);};}exports[_0x43ca('0x2b')]=function(_0x5f3c9c,_0x4d8647){var _0x23f085={},_0x531c1d={},_0x3e866e={'count':0x0,'rows':[]};var _0x55731b=_[_0x43ca('0x2c')](db[_0x43ca('0x2d')][_0x43ca('0x2e')],function(_0x499582){return{'name':_0x499582[_0x43ca('0x2f')],'type':_0x499582[_0x43ca('0x30')]['key']};});_0x531c1d[_0x43ca('0x31')]=_[_0x43ca('0x2c')](_0x55731b,_0x43ca('0x29'));_0x531c1d[_0x43ca('0x32')]=_['keys'](_0x5f3c9c['query']);_0x531c1d[_0x43ca('0x33')]=_[_0x43ca('0x34')](_0x531c1d[_0x43ca('0x31')],_0x531c1d[_0x43ca('0x32')]);_0x23f085['attributes']=_[_0x43ca('0x34')](_0x531c1d[_0x43ca('0x31')],qs[_0x43ca('0x35')](_0x5f3c9c[_0x43ca('0x32')]['fields']));_0x23f085[_0x43ca('0x36')]=_0x23f085['attributes'][_0x43ca('0x37')]?_0x23f085[_0x43ca('0x36')]:_0x531c1d[_0x43ca('0x31')];if(!_0x5f3c9c[_0x43ca('0x32')][_0x43ca('0x38')](_0x43ca('0x39'))){_0x23f085[_0x43ca('0x1c')]=qs['limit'](_0x5f3c9c[_0x43ca('0x32')][_0x43ca('0x1c')]);_0x23f085['offset']=qs[_0x43ca('0x1a')](_0x5f3c9c[_0x43ca('0x32')][_0x43ca('0x1a')]);}_0x23f085[_0x43ca('0x3a')]=qs[_0x43ca('0x3b')](_0x5f3c9c[_0x43ca('0x32')][_0x43ca('0x3b')]);_0x23f085[_0x43ca('0x3c')]=qs[_0x43ca('0x33')](_['pick'](_0x5f3c9c[_0x43ca('0x32')],_0x531c1d[_0x43ca('0x33')]),_0x55731b);if(_0x5f3c9c[_0x43ca('0x32')][_0x43ca('0x3d')]){_0x23f085['where']=_[_0x43ca('0x3e')](_0x23f085[_0x43ca('0x3c')],{'$or':_[_0x43ca('0x2c')](_0x55731b,function(_0x3a75da){if(_0x3a75da[_0x43ca('0x30')]!==_0x43ca('0x3f')){var _0x36a0ae={};_0x36a0ae[_0x3a75da[_0x43ca('0x29')]]={'$like':'%'+_0x5f3c9c[_0x43ca('0x32')][_0x43ca('0x3d')]+'%'};return _0x36a0ae;}})});}_0x23f085=_[_0x43ca('0x3e')]({},_0x23f085,_0x5f3c9c['options']);var _0x4da442={'where':_0x23f085[_0x43ca('0x3c')]};return db[_0x43ca('0x2d')]['count'](_0x4da442)[_0x43ca('0x22')](function(_0x3f55f6){_0x3e866e[_0x43ca('0x1d')]=_0x3f55f6;if(_0x5f3c9c['query'][_0x43ca('0x40')]){_0x23f085[_0x43ca('0x41')]=[{'all':!![]}];}return db[_0x43ca('0x2d')][_0x43ca('0x42')](_0x23f085);})[_0x43ca('0x22')](function(_0x5340b5){_0x3e866e[_0x43ca('0x43')]=_0x5340b5;return _0x3e866e;})[_0x43ca('0x22')](respondWithFilteredResult(_0x4d8647,_0x23f085))[_0x43ca('0x44')](handleError(_0x4d8647,null));};exports[_0x43ca('0x45')]=function(_0xad5c57,_0x13a01f){var _0x33ceb8={'raw':![],'where':{'id':_0xad5c57[_0x43ca('0x46')]['id']}},_0x393715={};_0x393715[_0x43ca('0x31')]=_[_0x43ca('0x47')](db[_0x43ca('0x2d')]['rawAttributes']);_0x393715['query']=_[_0x43ca('0x47')](_0xad5c57[_0x43ca('0x32')]);_0x393715[_0x43ca('0x33')]=_[_0x43ca('0x34')](_0x393715[_0x43ca('0x31')],_0x393715[_0x43ca('0x32')]);_0x33ceb8[_0x43ca('0x36')]=_[_0x43ca('0x34')](_0x393715['model'],qs['fields'](_0xad5c57[_0x43ca('0x32')][_0x43ca('0x35')]));_0x33ceb8[_0x43ca('0x36')]=_0x33ceb8[_0x43ca('0x36')][_0x43ca('0x37')]?_0x33ceb8[_0x43ca('0x36')]:_0x393715[_0x43ca('0x31')];if(_0xad5c57[_0x43ca('0x32')][_0x43ca('0x40')]){_0x33ceb8[_0x43ca('0x41')]=[{'all':!![]}];}_0x33ceb8=_[_0x43ca('0x3e')]({},_0x33ceb8,_0xad5c57[_0x43ca('0x48')]);return db[_0x43ca('0x2d')]['find'](_0x33ceb8)[_0x43ca('0x22')](handleEntityNotFound(_0x13a01f,null))[_0x43ca('0x22')](respondWithResult(_0x13a01f,null))['catch'](handleError(_0x13a01f,null));};exports[_0x43ca('0x49')]=function(_0x5e0f99,_0x5df36b){return db['CmList'][_0x43ca('0x49')](_0x5e0f99[_0x43ca('0x4a')],{})[_0x43ca('0x22')](function(_0x399fe9){var _0x4d634c=_0x5e0f99['user'][_0x43ca('0x23')]({'plain':!![]});if(!_0x4d634c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d634c['role']===_0x43ca('0x4b')){var _0x547f65=_0x399fe9[_0x43ca('0x23')]({'plain':!![]});var _0x59f2bd=_0x43ca('0x4c');return db[_0x43ca('0x4d')][_0x43ca('0x4e')]({'where':{'name':_0x59f2bd,'userProfileId':_0x4d634c[_0x43ca('0x4f')]},'raw':!![]})[_0x43ca('0x22')](function(_0x5e4bba){if(_0x5e4bba&&_0x5e4bba[_0x43ca('0x50')]===0x0){return db[_0x43ca('0x24')]['create']({'name':_0x547f65[_0x43ca('0x29')],'resourceId':_0x547f65['id'],'type':_0x5e4bba['name'],'sectionId':_0x5e4bba['id']},{})[_0x43ca('0x22')](function(){return _0x399fe9;});}else{return _0x399fe9;}})[_0x43ca('0x44')](function(_0x298062){logger[_0x43ca('0x27')](_0x43ca('0x51'),_0x298062);throw _0x298062;});}return _0x399fe9;})[_0x43ca('0x22')](respondWithResult(_0x5df36b,0xc9))[_0x43ca('0x44')](handleError(_0x5df36b,null));};exports['update']=function(_0x395eb6,_0x15635e){if(_0x395eb6[_0x43ca('0x4a')]['id']){delete _0x395eb6[_0x43ca('0x4a')]['id'];}return db['CmList']['find']({'where':{'id':_0x395eb6[_0x43ca('0x46')]['id']}})['then'](handleEntityNotFound(_0x15635e,null))['then'](saveUpdates(_0x395eb6[_0x43ca('0x4a')],null))[_0x43ca('0x22')](respondWithResult(_0x15635e,null))[_0x43ca('0x44')](handleError(_0x15635e,null));};exports[_0x43ca('0x25')]=function(_0x58eea0,_0x3bcc41){return db[_0x43ca('0x2d')]['find']({'where':{'id':_0x58eea0[_0x43ca('0x46')]['id']}})['then'](handleEntityNotFound(_0x3bcc41,null))[_0x43ca('0x22')](removeEntity(_0x3bcc41,null))[_0x43ca('0x44')](handleError(_0x3bcc41,null));};exports[_0x43ca('0x52')]=function(_0x7c1482,_0x35b084){return db['CmList']['describe']()[_0x43ca('0x22')](respondWithResult(_0x35b084,null))[_0x43ca('0x44')](handleError(_0x35b084,null));};exports['addDisposition']=function(_0x1d9a4e,_0x44dfba,_0x107caf){if(_0x1d9a4e['body']['id']){delete _0x1d9a4e[_0x43ca('0x4a')]['id'];}return db[_0x43ca('0x2d')][_0x43ca('0x4e')]({'where':{'id':_0x1d9a4e['params']['id']}})[_0x43ca('0x22')](handleEntityNotFound(_0x44dfba,null))[_0x43ca('0x22')](function(_0x2efe0a){if(_0x2efe0a){_0x1d9a4e[_0x43ca('0x4a')][_0x43ca('0x53')]=_0x2efe0a['id'];return db[_0x43ca('0x54')][_0x43ca('0x49')](_0x1d9a4e[_0x43ca('0x4a')]);}})[_0x43ca('0x22')](respondWithResult(_0x44dfba,null))['catch'](handleError(_0x44dfba,null));};exports[_0x43ca('0x55')]=function(_0x76feef,_0x22d755,_0x427c84){var _0x19dc7a={'raw':![],'where':{}};var _0x19b815={};var _0x2f3992={'count':0x0,'rows':[]};return db[_0x43ca('0x2d')][_0x43ca('0x56')]({'where':{'id':_0x76feef[_0x43ca('0x46')]['id']}})[_0x43ca('0x22')](handleEntityNotFound(_0x22d755,null))[_0x43ca('0x22')](function(_0x8f1c13){if(_0x8f1c13){_0x19b815[_0x43ca('0x31')]=_[_0x43ca('0x47')](db[_0x43ca('0x54')][_0x43ca('0x2e')]);_0x19b815['query']=_['keys'](_0x76feef[_0x43ca('0x32')]);_0x19b815[_0x43ca('0x33')]=_['intersection'](_0x19b815[_0x43ca('0x31')],_0x19b815['query']);_0x19dc7a[_0x43ca('0x36')]=_['intersection'](_0x19b815[_0x43ca('0x31')],qs[_0x43ca('0x35')](_0x76feef[_0x43ca('0x32')][_0x43ca('0x35')]));_0x19dc7a['attributes']=_0x19dc7a['attributes'][_0x43ca('0x37')]?_0x19dc7a[_0x43ca('0x36')]:_0x19b815[_0x43ca('0x31')];if(!_0x76feef[_0x43ca('0x32')][_0x43ca('0x38')](_0x43ca('0x39'))){_0x19dc7a['limit']=qs[_0x43ca('0x1c')](_0x76feef[_0x43ca('0x32')]['limit']);_0x19dc7a['offset']=qs[_0x43ca('0x1a')](_0x76feef[_0x43ca('0x32')][_0x43ca('0x1a')]);}_0x19dc7a['order']=qs[_0x43ca('0x3b')](_0x76feef[_0x43ca('0x32')][_0x43ca('0x3b')]);_0x19dc7a[_0x43ca('0x3c')]=qs[_0x43ca('0x33')](_[_0x43ca('0x57')](_0x76feef[_0x43ca('0x32')],_0x19b815[_0x43ca('0x33')]));_0x19dc7a['where'][_0x43ca('0x53')]=_0x8f1c13['id'];if(_0x76feef[_0x43ca('0x32')][_0x43ca('0x3d')]){_0x19dc7a[_0x43ca('0x3c')]=_[_0x43ca('0x3e')](_0x19dc7a[_0x43ca('0x3c')],{'$or':_['map'](_0x19dc7a[_0x43ca('0x36')],function(_0xe273f9){var _0xb48de8={};_0xb48de8[_0xe273f9]={'$like':'%'+_0x76feef[_0x43ca('0x32')][_0x43ca('0x3d')]+'%'};return _0xb48de8;})});}_0x19dc7a=_['merge']({},_0x19dc7a,_0x76feef[_0x43ca('0x48')]);return db[_0x43ca('0x54')]['count']({'where':_0x19dc7a[_0x43ca('0x3c')]})[_0x43ca('0x22')](function(_0x56567c){_0x2f3992[_0x43ca('0x1d')]=_0x56567c;if(_0x76feef[_0x43ca('0x32')][_0x43ca('0x40')]){_0x19dc7a['include']=[{'all':!![]}];}return db[_0x43ca('0x54')][_0x43ca('0x42')](_0x19dc7a);})[_0x43ca('0x22')](function(_0x3a5468){_0x2f3992[_0x43ca('0x43')]=_0x3a5468;return _0x2f3992;});}})['then'](respondWithFilteredResult(_0x22d755,_0x19dc7a))['catch'](handleError(_0x22d755,null));};exports[_0x43ca('0x58')]=function(_0x5a127a,_0x18a483,_0x24aecc){return db['CmList'][_0x43ca('0x4e')]({'where':{'id':_0x5a127a['params']['id']}})['then'](handleEntityNotFound(_0x18a483,null))['then'](function(_0x1f21ec){if(_0x1f21ec){return _0x1f21ec['removeDispositions'](_0x5a127a['query'][_0x43ca('0x59')]);}})['then'](respondWithStatusCode(_0x18a483,null))[_0x43ca('0x44')](handleError(_0x18a483,null));};exports[_0x43ca('0x5a')]=function(_0x30f104,_0x42788a,_0x555cd9){return db['CmList']['find']({'where':{'id':_0x30f104[_0x43ca('0x46')]['id']}})[_0x43ca('0x22')](handleEntityNotFound(_0x42788a,null))[_0x43ca('0x22')](function(_0x191312){if(_0x191312){var _0x4882f9=[];var _0x3729b1={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x1b2f96){if(_0x30f104[_0x43ca('0x4a')][_0x43ca('0x5b')]&&_[_0x43ca('0x5c')](_0x30f104[_0x43ca('0x4a')][_0x43ca('0x5b')])){if(_0x30f104[_0x43ca('0x4a')][_0x43ca('0x5b')]['length']){_0x30f104[_0x43ca('0x4a')][_0x43ca('0x5b')]=_0x30f104['body'][_0x43ca('0x5b')][_0x43ca('0x5d')](';')+';';}else{_0x30f104[_0x43ca('0x4a')][_0x43ca('0x5b')]=null;}}else{_0x30f104[_0x43ca('0x4a')][_0x43ca('0x5b')]=null;}if(_0x30f104['body']&&_[_0x43ca('0x5c')](_0x30f104[_0x43ca('0x4a')])){for(var _0x257899=0x0;_0x257899<_0x30f104[_0x43ca('0x4a')][_0x43ca('0x37')];_0x257899+=0x1){_0x30f104[_0x43ca('0x4a')][_0x257899]['ListId']=_0x30f104[_0x43ca('0x46')]['id'];_0x4882f9[_0x43ca('0x5e')](_0x30f104[_0x43ca('0x4a')][_0x257899]);}return BPromise['each'](_0x4882f9,function(_0x1c6e67){return db['CmContact'][_0x43ca('0x49')](_[_0x43ca('0x5f')](_0x1c6e67,[_0x43ca('0x59'),'id'])||{},{'fields':_[_0x43ca('0x47')](_0x1b2f96),'raw':!![]})[_0x43ca('0x22')](function(_0x974c37){_0x3729b1[_0x43ca('0x60')][_0x43ca('0x5e')](_0x974c37['dataValues']);})[_0x43ca('0x44')](function(_0x38acfa){_0x3729b1[_0x43ca('0x61')][_0x43ca('0x5e')]({'data':_0x1c6e67,'error':_0x38acfa['message']});});})[_0x43ca('0x22')](function(_0x635a4d){return _0x3729b1;})[_0x43ca('0x44')](function(_0x3874af){return _0x3874af;});}else{_0x42788a[_0x43ca('0x19')](0x190)['json']({'message':_0x43ca('0x62')});}});}})[_0x43ca('0x22')](respondWithResult(_0x42788a,null))[_0x43ca('0x44')](handleError(_0x42788a,null));};exports['getContacts']=function(_0x58e440,_0x10d4dd,_0x5a2f5b){var _0x3d1a47;return db[_0x43ca('0x2d')][_0x43ca('0x4e')]({'where':{'id':_0x58e440[_0x43ca('0x46')]['id']},'include':[{'model':db[_0x43ca('0x63')],'as':_0x43ca('0x64')}]})[_0x43ca('0x22')](handleEntityNotFound(_0x10d4dd,null))[_0x43ca('0x22')](function(_0x42703f){if(_0x42703f){_0x3d1a47=_0x42703f;return db[_0x43ca('0x65')]['rawAttributes'];}})[_0x43ca('0x22')](function(_0x5ac3a6){if(_0x5ac3a6){var _0xe22983={};var _0x69b66f={};_0x69b66f[_0x43ca('0x31')]=_[_0x43ca('0x66')](_[_0x43ca('0x47')](_0x5ac3a6),_[_0x43ca('0x2c')](_0x3d1a47[_0x43ca('0x64')],function(_0x4ddfa6){return util['format']('cf_%d',_0x4ddfa6['id']);}));_0x69b66f[_0x43ca('0x32')]=_['keys'](_0x58e440[_0x43ca('0x32')]);_0x69b66f['filters']=_[_0x43ca('0x34')](_0x69b66f['model'],_0x69b66f[_0x43ca('0x32')]);_0xe22983[_0x43ca('0x36')]=_[_0x43ca('0x34')](_0x69b66f[_0x43ca('0x31')],qs['fields'](_0x58e440[_0x43ca('0x32')][_0x43ca('0x35')]));_0xe22983[_0x43ca('0x36')]=_0xe22983[_0x43ca('0x36')][_0x43ca('0x37')]?_0xe22983[_0x43ca('0x36')]:_0x69b66f['model'];if(!_0x58e440[_0x43ca('0x32')][_0x43ca('0x38')](_0x43ca('0x39'))){_0xe22983['limit']=qs[_0x43ca('0x1c')](_0x58e440[_0x43ca('0x32')]['limit']);_0xe22983['offset']=qs[_0x43ca('0x1a')](_0x58e440[_0x43ca('0x32')][_0x43ca('0x1a')]);}_0xe22983[_0x43ca('0x3a')]=qs['sort'](_0x58e440[_0x43ca('0x32')]['sort']);_0xe22983[_0x43ca('0x3c')]=qs[_0x43ca('0x33')](_[_0x43ca('0x57')](_0x58e440[_0x43ca('0x32')],_0x69b66f[_0x43ca('0x33')]));_0xe22983[_0x43ca('0x67')]=!![];if(_0x58e440[_0x43ca('0x32')][_0x43ca('0x3d')]){_0xe22983[_0x43ca('0x3c')]=_[_0x43ca('0x3e')](_0xe22983['where'],{'$or':_['map'](_0xe22983['attributes'],function(_0x1a997a){var _0x47d2ab={};_0x47d2ab[_0x1a997a]={'$like':'%'+_0x58e440[_0x43ca('0x32')]['filter']+'%'};return _0x47d2ab;})});}_0xe22983=_[_0x43ca('0x3e')]({},_0xe22983,_0x58e440[_0x43ca('0x48')]);return _0x3d1a47[_0x43ca('0x68')](_0xe22983);}})[_0x43ca('0x22')](respondWithResult(_0x10d4dd,null))[_0x43ca('0x44')](handleError(_0x10d4dd,null));};exports['getContactsCsv']=function(_0x3612e1,_0x48ab5c,_0x2155ab){var _0x1969e7;var _0xb06fdb;var _0x1ed06a;var _0x481d2d=_0x3612e1[_0x43ca('0x46')]['id'];csv_results=[];return db[_0x43ca('0x69')][_0x43ca('0x42')]({'attributes':['id',_0x43ca('0x29')],'raw':!![],'order':[_0x43ca('0x6a')]})[_0x43ca('0x22')](function(_0x44715b){_0x1969e7=_0x44715b;var _0xec6afd=_[_0x43ca('0x47')](db[_0x43ca('0x65')][_0x43ca('0x2e')]);return db[_0x43ca('0x63')][_0x43ca('0x42')]({'raw':!![],'attributes':['id',_0x43ca('0x6b')]})[_0x43ca('0x22')](function(_0x4bf5c2){_0xb06fdb=_0x4bf5c2;var _0x341880=squel[_0x43ca('0x6c')]()[_0x43ca('0x35')](_0xec6afd)[_0x43ca('0x6d')](_0x43ca('0x6e'),'c')[_0x43ca('0x3c')](_0x43ca('0x6f'),_0x481d2d)[_0x43ca('0x3c')]('c.deletedAt\x20is\x20null')[_0x43ca('0x70')]();for(var _0x437494=0x0;_0x437494<_0xb06fdb['length'];_0x437494++){_0x341880['field'](_0x43ca('0x71')+_0xb06fdb[_0x437494]['id'],_0x43ca('0x72')+_0xb06fdb[_0x437494][_0x43ca('0x6b')]);}for(var _0x437494=0x0;_0x437494<_0x1969e7[_0x43ca('0x37')];_0x437494++){_0x341880[_0x43ca('0x73')](squel['select']()[_0x43ca('0x73')](_0x43ca('0x74'))['from'](_0x43ca('0x75'))[_0x43ca('0x3c')](_0x43ca('0x76'),_0x1969e7[_0x437494]['id'])[_0x43ca('0x3c')](_0x43ca('0x77')),_0x43ca('0x78')+_0x1969e7[_0x437494][_0x43ca('0x29')]);_0x341880[_0x43ca('0x73')](squel[_0x43ca('0x6c')]()[_0x43ca('0x73')]('description')[_0x43ca('0x6d')]('cm_contact_has_items')[_0x43ca('0x3c')](_0x43ca('0x76'),_0x1969e7[_0x437494]['id'])[_0x43ca('0x3c')](_0x43ca('0x77')),_0x43ca('0x79')+_0x1969e7[_0x437494]['name']);}var _0x1b6afe=[];_0x1b6afe[_0x43ca('0x5e')](_0x341880[_0x43ca('0x7a')]());BPromise[_0x43ca('0x7b')](_0x1b6afe,handleQuery)['then'](function(_0x1343e0){handleQuery(_0x341880['toString']());var _0x1532b5=csv_results[0x0];if(!_[_0x43ca('0x7c')](_0x1532b5)){var _0x17dea6=toCsv(_0x1532b5);var _0x27a5fe=Date[_0x43ca('0x7d')]();fs[_0x43ca('0x7e')](util[_0x43ca('0x7f')](_0x43ca('0x80'),_0x481d2d,_0x27a5fe),_0x17dea6);_0x48ab5c[_0x43ca('0x81')](_0x43ca('0x82'),'attachment;\x20filename='+util[_0x43ca('0x7f')]('list_%d_%s.csv',_0x481d2d,_0x27a5fe));_0x48ab5c[_0x43ca('0x81')](_0x43ca('0x83'),_0x43ca('0x84'));return _0x48ab5c[_0x43ca('0x85')](util['format']('/tmp/list_%d_%s.csv',_0x481d2d,_0x27a5fe));}else{return _0x48ab5c[_0x43ca('0x18')](0xcc);}});});});};exports[_0x43ca('0x86')]=function(_0x5116ff,_0x24b0a2,_0x207842){var _0x419672;delete _0x5116ff['body']['id'];return db[_0x43ca('0x2d')][_0x43ca('0x56')]({'where':{'id':_0x5116ff[_0x43ca('0x46')]['id']}})['then'](handleEntityNotFound(_0x24b0a2,null))[_0x43ca('0x22')](function(_0x2d07d2){if(_0x2d07d2){return db[_0x43ca('0x87')][_0x43ca('0x88')](function(_0x48062e){return db[_0x43ca('0x63')][_0x43ca('0x49')](_0x5116ff[_0x43ca('0x4a')],{'transaction':_0x48062e})['then'](function(_0x19ea16){_0x419672=_0x19ea16;return _0x2d07d2['addCustomFields'](_0x19ea16,{'transaction':_0x48062e});})[_0x43ca('0x22')](function(){var _0x159928={'type':db[_0x43ca('0x89')][_0x43ca('0x8a')],'transaction':_0x48062e};switch(_0x5116ff[_0x43ca('0x4a')][_0x43ca('0x30')]){case'text':_0x159928[_0x43ca('0x30')]=db['Sequelize'][_0x43ca('0x8a')];break;case _0x43ca('0x8b'):_0x159928[_0x43ca('0x30')]=db[_0x43ca('0x89')][_0x43ca('0x8c')];break;case _0x43ca('0x8d'):_0x159928[_0x43ca('0x30')]=db['Sequelize'][_0x43ca('0x8e')];_0x159928['defaultValue']=![];break;default:}return db['sequelize'][_0x43ca('0x8f')]['addColumn'](_0x43ca('0x6e'),util[_0x43ca('0x7f')](_0x43ca('0x90'),_0x419672['id']),_0x159928);})[_0x43ca('0x22')](function(){return _0x419672;});});}})[_0x43ca('0x22')](respondWithResult(_0x24b0a2,null))[_0x43ca('0x44')](handleError(_0x24b0a2,null));};exports[_0x43ca('0x91')]=function(_0x56d25e,_0x1a0a22,_0x3fe927){var _0x10f54b={};var _0x528fc7={};var _0x4b5eaf;var _0x39cdc4;return db[_0x43ca('0x2d')][_0x43ca('0x56')]({'where':{'id':_0x56d25e[_0x43ca('0x46')]['id']}})[_0x43ca('0x22')](handleEntityNotFound(_0x1a0a22,null))[_0x43ca('0x22')](function(_0xb458f4){if(_0xb458f4){_0x4b5eaf=_0xb458f4;_0x528fc7['model']=_['keys'](db[_0x43ca('0x63')]['rawAttributes']);_0x528fc7[_0x43ca('0x32')]=_[_0x43ca('0x47')](_0x56d25e['query']);_0x528fc7[_0x43ca('0x33')]=_['intersection'](_0x528fc7[_0x43ca('0x31')],_0x528fc7[_0x43ca('0x32')]);_0x10f54b[_0x43ca('0x36')]=_[_0x43ca('0x34')](_0x528fc7[_0x43ca('0x31')],qs['fields'](_0x56d25e[_0x43ca('0x32')][_0x43ca('0x35')]));_0x10f54b[_0x43ca('0x36')]=_0x10f54b['attributes'][_0x43ca('0x37')]?_0x10f54b[_0x43ca('0x36')]:_0x528fc7[_0x43ca('0x31')];_0x10f54b['order']=qs[_0x43ca('0x3b')](_0x56d25e[_0x43ca('0x32')][_0x43ca('0x3b')]);_0x10f54b[_0x43ca('0x3c')]=qs[_0x43ca('0x33')](_[_0x43ca('0x57')](_0x56d25e[_0x43ca('0x32')],_0x528fc7[_0x43ca('0x33')]));_0x10f54b[_0x43ca('0x3c')]=_['merge'](_0x10f54b[_0x43ca('0x3c')],{'$or':[{'ListId':_0xb458f4['id']},{'ListId':null}]});if(_0x56d25e[_0x43ca('0x32')][_0x43ca('0x3d')]){_0x10f54b[_0x43ca('0x3c')]=_['merge'](_0x10f54b[_0x43ca('0x3c')],{'$or':_[_0x43ca('0x2c')](_0x10f54b[_0x43ca('0x36')],function(_0x1ce391){var _0x13c17c={};_0x13c17c[_0x1ce391]={'$like':'%'+_0x56d25e[_0x43ca('0x32')][_0x43ca('0x3d')]+'%'};return _0x13c17c;})});}_0x10f54b=_['merge']({},_0x10f54b,_0x56d25e[_0x43ca('0x48')]);return db[_0x43ca('0x63')][_0x43ca('0x92')](_0x10f54b);}})[_0x43ca('0x22')](respondWithResult(_0x1a0a22,null))[_0x43ca('0x44')](handleError(_0x1a0a22,null));};exports[_0x43ca('0x93')]=function(_0x27f141,_0x49f49e){return db[_0x43ca('0x63')]['findAndCountAll']({'where':{'ListId':null}})[_0x43ca('0x22')](handleEntityNotFound(_0x49f49e,null))[_0x43ca('0x22')](function(_0x4fc182){return _0x4fc182;})[_0x43ca('0x22')](respondWithResult(_0x49f49e,null))['catch'](handleError(_0x49f49e,null));};exports[_0x43ca('0x94')]=function(_0x4c64a2,_0x2a0e75,_0x597bb4){return db[_0x43ca('0x2d')][_0x43ca('0x4e')]({'where':{'id':_0x4c64a2[_0x43ca('0x46')]['id']}})[_0x43ca('0x22')](handleEntityNotFound(_0x2a0e75,null))[_0x43ca('0x22')](function(_0x1b9715){if(_0x1b9715){return _0x1b9715[_0x43ca('0x94')](_0x4c64a2[_0x43ca('0x4a')][_0x43ca('0x59')],_[_0x43ca('0x5f')](_0x4c64a2[_0x43ca('0x4a')],[_0x43ca('0x59'),'id'])||{})[_0x43ca('0x95')](function(_0x524e69){for(var _0x576a88=0x0;_0x576a88<_0x4c64a2['body']['ids'][_0x43ca('0x37')];_0x576a88+=0x1){socket[_0x43ca('0x96')]('userCmList:save',{'UserId':Number(_0x4c64a2[_0x43ca('0x4a')][_0x43ca('0x59')][_0x576a88]),'CmListId':Number(_0x4c64a2[_0x43ca('0x46')]['id'])});}return _0x524e69;});}})[_0x43ca('0x22')](respondWithResult(_0x2a0e75,null))[_0x43ca('0x44')](handleError(_0x2a0e75,null));};exports[_0x43ca('0x97')]=function(_0x402cdb,_0x4820d9,_0x20d72a){return db['CmList'][_0x43ca('0x4e')]({'where':{'id':_0x402cdb[_0x43ca('0x46')]['id']}})[_0x43ca('0x22')](handleEntityNotFound(_0x4820d9,null))[_0x43ca('0x22')](function(_0x5a3353){if(_0x5a3353){return _0x5a3353[_0x43ca('0x97')](_0x402cdb['query'][_0x43ca('0x59')])['then'](function(){if(_[_0x43ca('0x5c')](_0x402cdb[_0x43ca('0x32')][_0x43ca('0x59')])){for(var _0x1609a1=0x0;_0x1609a1<_0x402cdb[_0x43ca('0x32')][_0x43ca('0x59')]['length'];_0x1609a1+=0x1){socket[_0x43ca('0x96')](_0x43ca('0x98'),{'UserId':Number(_0x402cdb['query'][_0x43ca('0x59')][_0x1609a1]),'CmListId':Number(_0x402cdb[_0x43ca('0x46')]['id'])});}}else{socket['emit'](_0x43ca('0x98'),{'UserId':Number(_0x402cdb[_0x43ca('0x32')]['ids']),'CmListId':Number(_0x402cdb['params']['id'])});}});}})[_0x43ca('0x22')](respondWithStatusCode(_0x4820d9,null))[_0x43ca('0x44')](handleError(_0x4820d9,null));};exports[_0x43ca('0x99')]=function(_0x55385c,_0x2d8c70,_0x3351ba){var _0x5afe81={};var _0x408b5e={};var _0x44877b;var _0x14b0be;return db[_0x43ca('0x2d')][_0x43ca('0x56')]({'where':{'id':_0x55385c['params']['id']}})['then'](handleEntityNotFound(_0x2d8c70,null))[_0x43ca('0x22')](function(_0x4e63d8){if(_0x4e63d8){_0x44877b=_0x4e63d8;_0x408b5e[_0x43ca('0x31')]=_['keys'](db['User'][_0x43ca('0x2e')]);_0x408b5e['query']=_['keys'](_0x55385c[_0x43ca('0x32')]);_0x408b5e[_0x43ca('0x33')]=_[_0x43ca('0x34')](_0x408b5e[_0x43ca('0x31')],_0x408b5e[_0x43ca('0x32')]);_0x5afe81[_0x43ca('0x36')]=_[_0x43ca('0x34')](_0x408b5e[_0x43ca('0x31')],qs['fields'](_0x55385c[_0x43ca('0x32')][_0x43ca('0x35')]));_0x5afe81[_0x43ca('0x36')]=_0x5afe81[_0x43ca('0x36')]['length']?_0x5afe81[_0x43ca('0x36')]:_0x408b5e['model'];_0x5afe81[_0x43ca('0x3a')]=qs['sort'](_0x55385c[_0x43ca('0x32')][_0x43ca('0x3b')]);_0x5afe81[_0x43ca('0x3c')]=qs['filters'](_[_0x43ca('0x57')](_0x55385c[_0x43ca('0x32')],_0x408b5e[_0x43ca('0x33')]));if(_0x55385c[_0x43ca('0x32')]['filter']){_0x5afe81['where']=_[_0x43ca('0x3e')](_0x5afe81['where'],{'$or':_[_0x43ca('0x2c')](_0x5afe81[_0x43ca('0x36')],function(_0x145f06){var _0x71b39c={};_0x71b39c[_0x145f06]={'$like':'%'+_0x55385c[_0x43ca('0x32')][_0x43ca('0x3d')]+'%'};return _0x71b39c;})});}_0x5afe81=_[_0x43ca('0x3e')]({},_0x5afe81,_0x55385c[_0x43ca('0x48')]);return _0x44877b[_0x43ca('0x99')](_0x5afe81);}})[_0x43ca('0x22')](function(_0x110d6e){if(_0x110d6e){_0x14b0be=_0x110d6e[_0x43ca('0x37')];if(!_0x55385c[_0x43ca('0x32')][_0x43ca('0x38')]('nolimit')){_0x5afe81[_0x43ca('0x1c')]=qs[_0x43ca('0x1c')](_0x55385c[_0x43ca('0x32')][_0x43ca('0x1c')]);_0x5afe81[_0x43ca('0x1a')]=qs[_0x43ca('0x1a')](_0x55385c[_0x43ca('0x32')]['offset']);}return _0x44877b[_0x43ca('0x99')](_0x5afe81);}})['then'](function(_0x41fd86){if(_0x41fd86){return _0x41fd86?{'count':_0x14b0be,'rows':_0x41fd86}:null;}})[_0x43ca('0x22')](respondWithResult(_0x2d8c70,null))[_0x43ca('0x44')](handleError(_0x2d8c70,null));};function handleQuery(_0x2249eb){logger[_0x43ca('0x9a')](_0x2249eb);return db[_0x43ca('0x87')][_0x43ca('0x32')](_0x2249eb)[_0x43ca('0x95')](function(_0x4e4794){csv_results[_0x43ca('0x5e')](_0x4e4794);})[_0x43ca('0x44')](function(_0x4c250d){logger[_0x43ca('0x27')](_0x4c250d['message']);});} \ No newline at end of file +var _0x5ac1=['options','count','includeAll','include','findAll','catch','show','params','keys','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','length','join','push','each','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','concat','format','cf_%d','getContactsCsv','ContactItemType','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','zip-dir','fast-json-patch','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Lists','error','name','send','index','CmList','rawAttributes','type','key','model','query','filters','attributes','intersection','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x5ac1,0x1a8));var _0x15ac=function(_0x1dce5d,_0x212689){_0x1dce5d=_0x1dce5d-0x0;var _0x1a9ce4=_0x5ac1[_0x1dce5d];return _0x1a9ce4;};'use strict';var emlformat=require(_0x15ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15ac('0x1'));var jsonpatch=require(_0x15ac('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x15ac('0x3'));var path=require(_0x15ac('0x4'));var sox=require(_0x15ac('0x5'));var csv=require(_0x15ac('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15ac('0x7'));var _=require(_0x15ac('0x8'));var squel=require(_0x15ac('0x9'));var crypto=require(_0x15ac('0xa'));var jsforce=require(_0x15ac('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x15ac('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x15ac('0xc'));var qs=require(_0x15ac('0xd'));var as=require(_0x15ac('0xe'));var hardwareService=require(_0x15ac('0xf'));var logger=require(_0x15ac('0x10'))(_0x15ac('0x11'));var utils=require(_0x15ac('0x12'));var config=require(_0x15ac('0x13'));var licenseUtil=require(_0x15ac('0x14'));var db=require(_0x15ac('0x15'))['db'];var csv_results;config[_0x15ac('0x16')]=_[_0x15ac('0x17')](config[_0x15ac('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x15ac('0x18'))(new Redis(config[_0x15ac('0x16')]));require(_0x15ac('0x19'))['register'](socket);function respondWithStatusCode(_0x252e13,_0xb9fcef){_0xb9fcef=_0xb9fcef||0xcc;return function(_0x33c4a3){if(_0x33c4a3){return _0x252e13[_0x15ac('0x1a')](_0xb9fcef);}return _0x252e13[_0x15ac('0x1b')](_0xb9fcef)[_0x15ac('0x1c')]();};}function respondWithResult(_0x14ddc6,_0x1a4e8d){_0x1a4e8d=_0x1a4e8d||0xc8;return function(_0x5279b6){if(_0x5279b6){return _0x14ddc6[_0x15ac('0x1b')](_0x1a4e8d)[_0x15ac('0x1d')](_0x5279b6);}};}function respondWithFilteredResult(_0x13c6ea,_0x1426f2){return function(_0x50c316){if(_0x50c316){var _0x13cc17=typeof _0x1426f2[_0x15ac('0x1e')]===_0x15ac('0x1f')&&typeof _0x1426f2[_0x15ac('0x20')]==='undefined';var _0x223af2=_0x50c316['count'];var _0x4fd153=_0x13cc17?0x0:_0x1426f2[_0x15ac('0x1e')];var _0x576ffa=_0x13cc17?_0x50c316['count']:_0x1426f2[_0x15ac('0x1e')]+_0x1426f2[_0x15ac('0x20')];var _0x30eacf;if(_0x576ffa>=_0x223af2){_0x576ffa=_0x223af2;_0x30eacf=0xc8;}else{_0x30eacf=0xce;}_0x13c6ea[_0x15ac('0x1b')](_0x30eacf);return _0x13c6ea[_0x15ac('0x21')](_0x15ac('0x22'),_0x4fd153+'-'+_0x576ffa+'/'+_0x223af2)['json'](_0x50c316);}return null;};}function patchUpdates(_0x447103){return function(_0x2eb1f6){try{jsonpatch[_0x15ac('0x23')](_0x2eb1f6,_0x447103,!![]);}catch(_0x273cf1){return BPromise[_0x15ac('0x24')](_0x273cf1);}return _0x2eb1f6[_0x15ac('0x25')]();};}function saveUpdates(_0x212b33,_0x5ddd85){return function(_0xf2560e){if(_0xf2560e){return _0xf2560e[_0x15ac('0x26')](_0x212b33)['then'](function(_0x148625){return _0x148625;});}return null;};}function removeEntity(_0x2f0273,_0x47c626){return function(_0x33d00a){if(_0x33d00a){return _0x33d00a[_0x15ac('0x27')]()[_0x15ac('0x28')](function(){var _0x15543a=_0x33d00a[_0x15ac('0x29')]({'plain':!![]});var _0x4a79ac=_0x15ac('0x2a');return db['UserProfileResource'][_0x15ac('0x27')]({'where':{'type':_0x4a79ac,'resourceId':_0x15543a['id']}})[_0x15ac('0x28')](function(){return _0x33d00a;});})[_0x15ac('0x28')](function(){_0x2f0273[_0x15ac('0x1b')](0xcc)[_0x15ac('0x1c')]();});}};}function handleEntityNotFound(_0x72600a,_0x57ba69){return function(_0x3cc847){if(!_0x3cc847){_0x72600a[_0x15ac('0x1a')](0x194);}return _0x3cc847;};}function handleError(_0x4375dc,_0x24d216){_0x24d216=_0x24d216||0x1f4;return function(_0x298c72){logger[_0x15ac('0x2b')](_0x298c72['stack']);if(_0x298c72[_0x15ac('0x2c')]){delete _0x298c72[_0x15ac('0x2c')];}_0x4375dc[_0x15ac('0x1b')](_0x24d216)[_0x15ac('0x2d')](_0x298c72);};}exports[_0x15ac('0x2e')]=function(_0x433072,_0x303dce){var _0x11ac51={},_0x314244={},_0x5a8ad5={'count':0x0,'rows':[]};var _0x3cbe1a=_['map'](db[_0x15ac('0x2f')][_0x15ac('0x30')],function(_0x5b6d2c){return{'name':_0x5b6d2c['fieldName'],'type':_0x5b6d2c[_0x15ac('0x31')][_0x15ac('0x32')]};});_0x314244[_0x15ac('0x33')]=_['map'](_0x3cbe1a,_0x15ac('0x2c'));_0x314244[_0x15ac('0x34')]=_['keys'](_0x433072['query']);_0x314244[_0x15ac('0x35')]=_['intersection'](_0x314244[_0x15ac('0x33')],_0x314244[_0x15ac('0x34')]);_0x11ac51[_0x15ac('0x36')]=_[_0x15ac('0x37')](_0x314244['model'],qs['fields'](_0x433072[_0x15ac('0x34')]['fields']));_0x11ac51['attributes']=_0x11ac51[_0x15ac('0x36')]['length']?_0x11ac51[_0x15ac('0x36')]:_0x314244['model'];if(!_0x433072[_0x15ac('0x34')]['hasOwnProperty'](_0x15ac('0x38'))){_0x11ac51[_0x15ac('0x20')]=qs[_0x15ac('0x20')](_0x433072[_0x15ac('0x34')][_0x15ac('0x20')]);_0x11ac51[_0x15ac('0x1e')]=qs[_0x15ac('0x1e')](_0x433072[_0x15ac('0x34')]['offset']);}_0x11ac51[_0x15ac('0x39')]=qs[_0x15ac('0x3a')](_0x433072[_0x15ac('0x34')][_0x15ac('0x3a')]);_0x11ac51[_0x15ac('0x3b')]=qs[_0x15ac('0x35')](_[_0x15ac('0x3c')](_0x433072[_0x15ac('0x34')],_0x314244['filters']),_0x3cbe1a);if(_0x433072[_0x15ac('0x34')][_0x15ac('0x3d')]){_0x11ac51[_0x15ac('0x3b')]=_[_0x15ac('0x3e')](_0x11ac51['where'],{'$or':_[_0x15ac('0x3f')](_0x3cbe1a,function(_0x35d8e4){if(_0x35d8e4['type']!==_0x15ac('0x40')){var _0x4599db={};_0x4599db[_0x35d8e4[_0x15ac('0x2c')]]={'$like':'%'+_0x433072['query'][_0x15ac('0x3d')]+'%'};return _0x4599db;}})});}_0x11ac51=_[_0x15ac('0x3e')]({},_0x11ac51,_0x433072[_0x15ac('0x41')]);var _0x541135={'where':_0x11ac51[_0x15ac('0x3b')]};return db[_0x15ac('0x2f')][_0x15ac('0x42')](_0x541135)[_0x15ac('0x28')](function(_0x291d8e){_0x5a8ad5[_0x15ac('0x42')]=_0x291d8e;if(_0x433072[_0x15ac('0x34')][_0x15ac('0x43')]){_0x11ac51[_0x15ac('0x44')]=[{'all':!![]}];}return db[_0x15ac('0x2f')][_0x15ac('0x45')](_0x11ac51);})[_0x15ac('0x28')](function(_0x5e927f){_0x5a8ad5['rows']=_0x5e927f;return _0x5a8ad5;})[_0x15ac('0x28')](respondWithFilteredResult(_0x303dce,_0x11ac51))[_0x15ac('0x46')](handleError(_0x303dce,null));};exports[_0x15ac('0x47')]=function(_0xdceeb1,_0x43a20c){var _0x42a1f0={'raw':![],'where':{'id':_0xdceeb1[_0x15ac('0x48')]['id']}},_0x3a81de={};_0x3a81de[_0x15ac('0x33')]=_['keys'](db[_0x15ac('0x2f')][_0x15ac('0x30')]);_0x3a81de[_0x15ac('0x34')]=_[_0x15ac('0x49')](_0xdceeb1[_0x15ac('0x34')]);_0x3a81de['filters']=_[_0x15ac('0x37')](_0x3a81de[_0x15ac('0x33')],_0x3a81de['query']);_0x42a1f0['attributes']=_[_0x15ac('0x37')](_0x3a81de[_0x15ac('0x33')],qs[_0x15ac('0x4a')](_0xdceeb1['query'][_0x15ac('0x4a')]));_0x42a1f0['attributes']=_0x42a1f0[_0x15ac('0x36')]['length']?_0x42a1f0[_0x15ac('0x36')]:_0x3a81de['model'];if(_0xdceeb1[_0x15ac('0x34')][_0x15ac('0x43')]){_0x42a1f0['include']=[{'all':!![]}];}_0x42a1f0=_[_0x15ac('0x3e')]({},_0x42a1f0,_0xdceeb1['options']);return db[_0x15ac('0x2f')][_0x15ac('0x4b')](_0x42a1f0)[_0x15ac('0x28')](handleEntityNotFound(_0x43a20c,null))['then'](respondWithResult(_0x43a20c,null))[_0x15ac('0x46')](handleError(_0x43a20c,null));};exports[_0x15ac('0x4c')]=function(_0x5cc5f6,_0x278656){return db['CmList'][_0x15ac('0x4c')](_0x5cc5f6['body'],{})[_0x15ac('0x28')](function(_0x3c83a5){var _0xcdd875=_0x5cc5f6[_0x15ac('0x4d')][_0x15ac('0x29')]({'plain':!![]});if(!_0xcdd875)throw new Error(_0x15ac('0x4e'));if(_0xcdd875[_0x15ac('0x4f')]===_0x15ac('0x4d')){var _0x25466a=_0x3c83a5[_0x15ac('0x29')]({'plain':!![]});var _0x3cd0a0='Lists';return db[_0x15ac('0x50')][_0x15ac('0x4b')]({'where':{'name':_0x3cd0a0,'userProfileId':_0xcdd875['userProfileId']},'raw':!![]})[_0x15ac('0x28')](function(_0x5d0b17){if(_0x5d0b17&&_0x5d0b17[_0x15ac('0x51')]===0x0){return db[_0x15ac('0x52')][_0x15ac('0x4c')]({'name':_0x25466a[_0x15ac('0x2c')],'resourceId':_0x25466a['id'],'type':_0x5d0b17['name'],'sectionId':_0x5d0b17['id']},{})[_0x15ac('0x28')](function(){return _0x3c83a5;});}else{return _0x3c83a5;}})['catch'](function(_0x9a83cf){logger[_0x15ac('0x2b')](_0x15ac('0x53'),_0x9a83cf);throw _0x9a83cf;});}return _0x3c83a5;})[_0x15ac('0x28')](respondWithResult(_0x278656,0xc9))['catch'](handleError(_0x278656,null));};exports[_0x15ac('0x26')]=function(_0x3b1da7,_0x52ea08){if(_0x3b1da7[_0x15ac('0x54')]['id']){delete _0x3b1da7[_0x15ac('0x54')]['id'];}return db[_0x15ac('0x2f')][_0x15ac('0x4b')]({'where':{'id':_0x3b1da7[_0x15ac('0x48')]['id']}})[_0x15ac('0x28')](handleEntityNotFound(_0x52ea08,null))[_0x15ac('0x28')](saveUpdates(_0x3b1da7[_0x15ac('0x54')],null))[_0x15ac('0x28')](respondWithResult(_0x52ea08,null))[_0x15ac('0x46')](handleError(_0x52ea08,null));};exports[_0x15ac('0x27')]=function(_0x2b1811,_0x3333da){return db['CmList'][_0x15ac('0x4b')]({'where':{'id':_0x2b1811[_0x15ac('0x48')]['id']}})[_0x15ac('0x28')](handleEntityNotFound(_0x3333da,null))[_0x15ac('0x28')](removeEntity(_0x3333da,null))['catch'](handleError(_0x3333da,null));};exports['describe']=function(_0x4cb305,_0x38e162){return db[_0x15ac('0x2f')][_0x15ac('0x55')]()[_0x15ac('0x28')](respondWithResult(_0x38e162,null))[_0x15ac('0x46')](handleError(_0x38e162,null));};exports[_0x15ac('0x56')]=function(_0x3f5ae4,_0x10d896,_0x4e22e7){if(_0x3f5ae4[_0x15ac('0x54')]['id']){delete _0x3f5ae4[_0x15ac('0x54')]['id'];}return db[_0x15ac('0x2f')][_0x15ac('0x4b')]({'where':{'id':_0x3f5ae4[_0x15ac('0x48')]['id']}})['then'](handleEntityNotFound(_0x10d896,null))['then'](function(_0x49a91f){if(_0x49a91f){_0x3f5ae4['body'][_0x15ac('0x57')]=_0x49a91f['id'];return db[_0x15ac('0x58')][_0x15ac('0x4c')](_0x3f5ae4[_0x15ac('0x54')]);}})['then'](respondWithResult(_0x10d896,null))[_0x15ac('0x46')](handleError(_0x10d896,null));};exports[_0x15ac('0x59')]=function(_0x3b5c72,_0x5d580f,_0x3019e2){var _0x2dfdaf={'raw':![],'where':{}};var _0x59d012={};var _0x32736f={'count':0x0,'rows':[]};return db['CmList'][_0x15ac('0x5a')]({'where':{'id':_0x3b5c72[_0x15ac('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d580f,null))[_0x15ac('0x28')](function(_0x1513db){if(_0x1513db){_0x59d012[_0x15ac('0x33')]=_[_0x15ac('0x49')](db[_0x15ac('0x58')][_0x15ac('0x30')]);_0x59d012[_0x15ac('0x34')]=_['keys'](_0x3b5c72[_0x15ac('0x34')]);_0x59d012[_0x15ac('0x35')]=_[_0x15ac('0x37')](_0x59d012[_0x15ac('0x33')],_0x59d012[_0x15ac('0x34')]);_0x2dfdaf[_0x15ac('0x36')]=_[_0x15ac('0x37')](_0x59d012[_0x15ac('0x33')],qs['fields'](_0x3b5c72[_0x15ac('0x34')][_0x15ac('0x4a')]));_0x2dfdaf[_0x15ac('0x36')]=_0x2dfdaf[_0x15ac('0x36')]['length']?_0x2dfdaf[_0x15ac('0x36')]:_0x59d012[_0x15ac('0x33')];if(!_0x3b5c72['query'][_0x15ac('0x5b')](_0x15ac('0x38'))){_0x2dfdaf[_0x15ac('0x20')]=qs[_0x15ac('0x20')](_0x3b5c72[_0x15ac('0x34')][_0x15ac('0x20')]);_0x2dfdaf[_0x15ac('0x1e')]=qs[_0x15ac('0x1e')](_0x3b5c72[_0x15ac('0x34')][_0x15ac('0x1e')]);}_0x2dfdaf[_0x15ac('0x39')]=qs[_0x15ac('0x3a')](_0x3b5c72[_0x15ac('0x34')][_0x15ac('0x3a')]);_0x2dfdaf[_0x15ac('0x3b')]=qs[_0x15ac('0x35')](_['pick'](_0x3b5c72[_0x15ac('0x34')],_0x59d012[_0x15ac('0x35')]));_0x2dfdaf[_0x15ac('0x3b')]['ListId']=_0x1513db['id'];if(_0x3b5c72[_0x15ac('0x34')]['filter']){_0x2dfdaf[_0x15ac('0x3b')]=_[_0x15ac('0x3e')](_0x2dfdaf['where'],{'$or':_['map'](_0x2dfdaf[_0x15ac('0x36')],function(_0xa978d9){var _0x1bed49={};_0x1bed49[_0xa978d9]={'$like':'%'+_0x3b5c72[_0x15ac('0x34')][_0x15ac('0x3d')]+'%'};return _0x1bed49;})});}_0x2dfdaf=_[_0x15ac('0x3e')]({},_0x2dfdaf,_0x3b5c72[_0x15ac('0x41')]);return db[_0x15ac('0x58')]['count']({'where':_0x2dfdaf[_0x15ac('0x3b')]})[_0x15ac('0x28')](function(_0x59f67c){_0x32736f[_0x15ac('0x42')]=_0x59f67c;if(_0x3b5c72[_0x15ac('0x34')][_0x15ac('0x43')]){_0x2dfdaf['include']=[{'all':!![]}];}return db[_0x15ac('0x58')][_0x15ac('0x45')](_0x2dfdaf);})['then'](function(_0x2091b2){_0x32736f[_0x15ac('0x5c')]=_0x2091b2;return _0x32736f;});}})[_0x15ac('0x28')](respondWithFilteredResult(_0x5d580f,_0x2dfdaf))[_0x15ac('0x46')](handleError(_0x5d580f,null));};exports[_0x15ac('0x5d')]=function(_0x50d165,_0x5305e8,_0x5d8e36){return db[_0x15ac('0x2f')][_0x15ac('0x4b')]({'where':{'id':_0x50d165['params']['id']}})['then'](handleEntityNotFound(_0x5305e8,null))[_0x15ac('0x28')](function(_0x102fe9){if(_0x102fe9){return _0x102fe9[_0x15ac('0x5d')](_0x50d165[_0x15ac('0x34')][_0x15ac('0x5e')]);}})[_0x15ac('0x28')](respondWithStatusCode(_0x5305e8,null))[_0x15ac('0x46')](handleError(_0x5305e8,null));};exports[_0x15ac('0x5f')]=function(_0x3ccd94,_0x3eed1a,_0x3e72ca){return db['CmList']['find']({'where':{'id':_0x3ccd94['params']['id']}})[_0x15ac('0x28')](handleEntityNotFound(_0x3eed1a,null))[_0x15ac('0x28')](function(_0xb12541){if(_0xb12541){var _0x28b5ed=[];var _0x3f41a6={'success':[],'errors':[]};return db[_0x15ac('0x60')][_0x15ac('0x55')]()['then'](function(_0x48af4d){if(_0x3ccd94[_0x15ac('0x54')][_0x15ac('0x61')]&&_[_0x15ac('0x62')](_0x3ccd94[_0x15ac('0x54')][_0x15ac('0x61')])){if(_0x3ccd94[_0x15ac('0x54')][_0x15ac('0x61')][_0x15ac('0x63')]){_0x3ccd94[_0x15ac('0x54')][_0x15ac('0x61')]=_0x3ccd94[_0x15ac('0x54')][_0x15ac('0x61')][_0x15ac('0x64')](';')+';';}else{_0x3ccd94[_0x15ac('0x54')][_0x15ac('0x61')]=null;}}else{_0x3ccd94[_0x15ac('0x54')][_0x15ac('0x61')]=null;}if(_0x3ccd94[_0x15ac('0x54')]&&_['isArray'](_0x3ccd94['body'])){for(var _0x46a626=0x0;_0x46a626<_0x3ccd94[_0x15ac('0x54')]['length'];_0x46a626+=0x1){_0x3ccd94['body'][_0x46a626][_0x15ac('0x57')]=_0x3ccd94['params']['id'];_0x28b5ed[_0x15ac('0x65')](_0x3ccd94[_0x15ac('0x54')][_0x46a626]);}return BPromise[_0x15ac('0x66')](_0x28b5ed,function(_0x4daaa9){return db[_0x15ac('0x60')][_0x15ac('0x4c')](_['omit'](_0x4daaa9,[_0x15ac('0x5e'),'id'])||{},{'fields':_[_0x15ac('0x49')](_0x48af4d),'raw':!![]})[_0x15ac('0x28')](function(_0x7b93b6){_0x3f41a6['success']['push'](_0x7b93b6[_0x15ac('0x67')]);})[_0x15ac('0x46')](function(_0x5040ce){_0x3f41a6[_0x15ac('0x68')][_0x15ac('0x65')]({'data':_0x4daaa9,'error':_0x5040ce[_0x15ac('0x69')]});});})[_0x15ac('0x28')](function(_0x49c37f){return _0x3f41a6;})[_0x15ac('0x46')](function(_0x4f4fd8){return _0x4f4fd8;});}else{_0x3eed1a[_0x15ac('0x1b')](0x190)[_0x15ac('0x1d')]({'message':_0x15ac('0x6a')});}});}})['then'](respondWithResult(_0x3eed1a,null))[_0x15ac('0x46')](handleError(_0x3eed1a,null));};exports[_0x15ac('0x6b')]=function(_0x5f8486,_0x150be9,_0x1249e7){var _0x42ef66;return db[_0x15ac('0x2f')][_0x15ac('0x4b')]({'where':{'id':_0x5f8486[_0x15ac('0x48')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x15ac('0x28')](handleEntityNotFound(_0x150be9,null))[_0x15ac('0x28')](function(_0x577b38){if(_0x577b38){_0x42ef66=_0x577b38;return db['CmContact'][_0x15ac('0x30')];}})[_0x15ac('0x28')](function(_0x28cf10){if(_0x28cf10){var _0x281030={};var _0x23ff81={};_0x23ff81[_0x15ac('0x33')]=_[_0x15ac('0x6c')](_['keys'](_0x28cf10),_['map'](_0x42ef66['CustomFields'],function(_0x4e268b){return util[_0x15ac('0x6d')](_0x15ac('0x6e'),_0x4e268b['id']);}));_0x23ff81[_0x15ac('0x34')]=_[_0x15ac('0x49')](_0x5f8486[_0x15ac('0x34')]);_0x23ff81[_0x15ac('0x35')]=_[_0x15ac('0x37')](_0x23ff81[_0x15ac('0x33')],_0x23ff81[_0x15ac('0x34')]);_0x281030[_0x15ac('0x36')]=_[_0x15ac('0x37')](_0x23ff81[_0x15ac('0x33')],qs['fields'](_0x5f8486['query'][_0x15ac('0x4a')]));_0x281030[_0x15ac('0x36')]=_0x281030['attributes'][_0x15ac('0x63')]?_0x281030[_0x15ac('0x36')]:_0x23ff81[_0x15ac('0x33')];if(!_0x5f8486['query'][_0x15ac('0x5b')](_0x15ac('0x38'))){_0x281030[_0x15ac('0x20')]=qs[_0x15ac('0x20')](_0x5f8486[_0x15ac('0x34')][_0x15ac('0x20')]);_0x281030[_0x15ac('0x1e')]=qs[_0x15ac('0x1e')](_0x5f8486[_0x15ac('0x34')][_0x15ac('0x1e')]);}_0x281030[_0x15ac('0x39')]=qs[_0x15ac('0x3a')](_0x5f8486[_0x15ac('0x34')]['sort']);_0x281030[_0x15ac('0x3b')]=qs[_0x15ac('0x35')](_[_0x15ac('0x3c')](_0x5f8486[_0x15ac('0x34')],_0x23ff81['filters']));_0x281030['raw']=!![];if(_0x5f8486[_0x15ac('0x34')][_0x15ac('0x3d')]){_0x281030[_0x15ac('0x3b')]=_['merge'](_0x281030[_0x15ac('0x3b')],{'$or':_['map'](_0x281030['attributes'],function(_0xc8651f){var _0x4f2348={};_0x4f2348[_0xc8651f]={'$like':'%'+_0x5f8486[_0x15ac('0x34')]['filter']+'%'};return _0x4f2348;})});}_0x281030=_[_0x15ac('0x3e')]({},_0x281030,_0x5f8486[_0x15ac('0x41')]);return _0x42ef66[_0x15ac('0x6b')](_0x281030);}})[_0x15ac('0x28')](respondWithResult(_0x150be9,null))[_0x15ac('0x46')](handleError(_0x150be9,null));};exports[_0x15ac('0x6f')]=function(_0xd74f6b,_0x240580,_0xa61745){var _0x557d24;var _0x340dbe;var _0x3b084f;var _0x505e15=_0xd74f6b[_0x15ac('0x48')]['id'];csv_results=[];return db[_0x15ac('0x70')][_0x15ac('0x45')]({'attributes':['id',_0x15ac('0x2c')],'raw':!![],'order':['OrderBy']})[_0x15ac('0x28')](function(_0xa0ec1a){_0x557d24=_0xa0ec1a;var _0x179e7b=_[_0x15ac('0x49')](db[_0x15ac('0x60')][_0x15ac('0x30')]);return db[_0x15ac('0x71')][_0x15ac('0x45')]({'raw':!![],'attributes':['id',_0x15ac('0x72')]})[_0x15ac('0x28')](function(_0x217638){_0x340dbe=_0x217638;var _0x4e6f70=squel[_0x15ac('0x73')]()['fields'](_0x179e7b)[_0x15ac('0x74')](_0x15ac('0x75'),'c')['where'](_0x15ac('0x76'),_0x505e15)['where'](_0x15ac('0x77'))[_0x15ac('0x78')]();for(var _0x2bddbe=0x0;_0x2bddbe<_0x340dbe['length'];_0x2bddbe++){_0x4e6f70[_0x15ac('0x79')](_0x15ac('0x7a')+_0x340dbe[_0x2bddbe]['id'],_0x15ac('0x7b')+_0x340dbe[_0x2bddbe][_0x15ac('0x72')]);}for(var _0x2bddbe=0x0;_0x2bddbe<_0x557d24[_0x15ac('0x63')];_0x2bddbe++){_0x4e6f70[_0x15ac('0x79')](squel[_0x15ac('0x73')]()[_0x15ac('0x79')]('item')[_0x15ac('0x74')](_0x15ac('0x7c'))[_0x15ac('0x3b')](_0x15ac('0x7d'),_0x557d24[_0x2bddbe]['id'])['where'](_0x15ac('0x7e')),_0x15ac('0x7f')+_0x557d24[_0x2bddbe]['name']);_0x4e6f70[_0x15ac('0x79')](squel[_0x15ac('0x73')]()['field'](_0x15ac('0x80'))[_0x15ac('0x74')](_0x15ac('0x7c'))[_0x15ac('0x3b')]('ItemTypeId\x20=\x20?',_0x557d24[_0x2bddbe]['id'])[_0x15ac('0x3b')]('CmContactId\x20=\x20c.id'),_0x15ac('0x81')+_0x557d24[_0x2bddbe]['name']);}var _0x3ecc8b=[];_0x3ecc8b[_0x15ac('0x65')](_0x4e6f70[_0x15ac('0x82')]());BPromise[_0x15ac('0x66')](_0x3ecc8b,handleQuery)[_0x15ac('0x28')](function(_0x3b5021){handleQuery(_0x4e6f70[_0x15ac('0x82')]());var _0x6feb7c=csv_results[0x0];if(!_['isEmpty'](_0x6feb7c)){var _0x1709eb=toCsv(_0x6feb7c);var _0x5853ab=Date[_0x15ac('0x83')]();fs[_0x15ac('0x84')](util[_0x15ac('0x6d')](_0x15ac('0x85'),_0x505e15,_0x5853ab),_0x1709eb);_0x240580[_0x15ac('0x86')](_0x15ac('0x87'),_0x15ac('0x88')+util['format'](_0x15ac('0x89'),_0x505e15,_0x5853ab));_0x240580[_0x15ac('0x86')](_0x15ac('0x8a'),'text/csv');return _0x240580[_0x15ac('0x8b')](util[_0x15ac('0x6d')](_0x15ac('0x85'),_0x505e15,_0x5853ab));}else{return _0x240580['sendStatus'](0xcc);}});});});};exports[_0x15ac('0x8c')]=function(_0x169135,_0x4b66bf,_0x24eccf){var _0x7b6894;delete _0x169135['body']['id'];return db[_0x15ac('0x2f')][_0x15ac('0x5a')]({'where':{'id':_0x169135['params']['id']}})[_0x15ac('0x28')](handleEntityNotFound(_0x4b66bf,null))[_0x15ac('0x28')](function(_0x85d89){if(_0x85d89){return db[_0x15ac('0x8d')][_0x15ac('0x8e')](function(_0x586e36){return db[_0x15ac('0x71')][_0x15ac('0x4c')](_0x169135[_0x15ac('0x54')],{'transaction':_0x586e36})[_0x15ac('0x28')](function(_0x731a0d){_0x7b6894=_0x731a0d;return _0x85d89[_0x15ac('0x8f')](_0x731a0d,{'transaction':_0x586e36});})['then'](function(){var _0x443385={'type':db[_0x15ac('0x90')][_0x15ac('0x91')],'transaction':_0x586e36};switch(_0x169135[_0x15ac('0x54')][_0x15ac('0x31')]){case _0x15ac('0x92'):_0x443385[_0x15ac('0x31')]=db[_0x15ac('0x90')][_0x15ac('0x91')];break;case _0x15ac('0x93'):_0x443385[_0x15ac('0x31')]=db[_0x15ac('0x90')][_0x15ac('0x94')];break;case _0x15ac('0x95'):_0x443385[_0x15ac('0x31')]=db[_0x15ac('0x90')]['BOOLEAN'];_0x443385[_0x15ac('0x96')]=![];break;default:}return db[_0x15ac('0x8d')][_0x15ac('0x97')][_0x15ac('0x98')](_0x15ac('0x75'),util[_0x15ac('0x6d')]('cf_%s',_0x7b6894['id']),_0x443385);})[_0x15ac('0x28')](function(){return _0x7b6894;});});}})['then'](respondWithResult(_0x4b66bf,null))[_0x15ac('0x46')](handleError(_0x4b66bf,null));};exports[_0x15ac('0x99')]=function(_0xf56e6c,_0x40f045,_0x2381e8){var _0x2cb031={};var _0x388b0a={};var _0x5cc284;var _0x5a0310;return db[_0x15ac('0x2f')][_0x15ac('0x5a')]({'where':{'id':_0xf56e6c[_0x15ac('0x48')]['id']}})[_0x15ac('0x28')](handleEntityNotFound(_0x40f045,null))['then'](function(_0x142f33){if(_0x142f33){_0x5cc284=_0x142f33;_0x388b0a['model']=_[_0x15ac('0x49')](db[_0x15ac('0x71')][_0x15ac('0x30')]);_0x388b0a['query']=_[_0x15ac('0x49')](_0xf56e6c[_0x15ac('0x34')]);_0x388b0a[_0x15ac('0x35')]=_['intersection'](_0x388b0a['model'],_0x388b0a[_0x15ac('0x34')]);_0x2cb031[_0x15ac('0x36')]=_[_0x15ac('0x37')](_0x388b0a[_0x15ac('0x33')],qs[_0x15ac('0x4a')](_0xf56e6c['query'][_0x15ac('0x4a')]));_0x2cb031['attributes']=_0x2cb031['attributes']['length']?_0x2cb031['attributes']:_0x388b0a[_0x15ac('0x33')];_0x2cb031[_0x15ac('0x39')]=qs[_0x15ac('0x3a')](_0xf56e6c[_0x15ac('0x34')][_0x15ac('0x3a')]);_0x2cb031['where']=qs[_0x15ac('0x35')](_[_0x15ac('0x3c')](_0xf56e6c[_0x15ac('0x34')],_0x388b0a['filters']));_0x2cb031[_0x15ac('0x3b')]=_[_0x15ac('0x3e')](_0x2cb031[_0x15ac('0x3b')],{'$or':[{'ListId':_0x142f33['id']},{'ListId':null}]});if(_0xf56e6c[_0x15ac('0x34')][_0x15ac('0x3d')]){_0x2cb031[_0x15ac('0x3b')]=_[_0x15ac('0x3e')](_0x2cb031['where'],{'$or':_[_0x15ac('0x3f')](_0x2cb031['attributes'],function(_0x2fde7a){var _0x5a9630={};_0x5a9630[_0x2fde7a]={'$like':'%'+_0xf56e6c[_0x15ac('0x34')]['filter']+'%'};return _0x5a9630;})});}_0x2cb031=_[_0x15ac('0x3e')]({},_0x2cb031,_0xf56e6c[_0x15ac('0x41')]);return db[_0x15ac('0x71')][_0x15ac('0x9a')](_0x2cb031);}})[_0x15ac('0x28')](respondWithResult(_0x40f045,null))[_0x15ac('0x46')](handleError(_0x40f045,null));};exports['getGlobalCustomFields']=function(_0x5acb93,_0x43ed49){return db['CmCustomField'][_0x15ac('0x9a')]({'where':{'ListId':null}})[_0x15ac('0x28')](handleEntityNotFound(_0x43ed49,null))[_0x15ac('0x28')](function(_0x47736d){return _0x47736d;})[_0x15ac('0x28')](respondWithResult(_0x43ed49,null))[_0x15ac('0x46')](handleError(_0x43ed49,null));};exports[_0x15ac('0x9b')]=function(_0x4313a0,_0x31dd30,_0x354242){return db['CmList']['find']({'where':{'id':_0x4313a0[_0x15ac('0x48')]['id']}})[_0x15ac('0x28')](handleEntityNotFound(_0x31dd30,null))['then'](function(_0x53a1f4){if(_0x53a1f4){return _0x53a1f4['addAgents'](_0x4313a0[_0x15ac('0x54')][_0x15ac('0x5e')],_['omit'](_0x4313a0['body'],[_0x15ac('0x5e'),'id'])||{})[_0x15ac('0x9c')](function(_0x3e283c){for(var _0x45a01a=0x0;_0x45a01a<_0x4313a0[_0x15ac('0x54')][_0x15ac('0x5e')][_0x15ac('0x63')];_0x45a01a+=0x1){socket[_0x15ac('0x9d')](_0x15ac('0x9e'),{'UserId':Number(_0x4313a0[_0x15ac('0x54')]['ids'][_0x45a01a]),'CmListId':Number(_0x4313a0[_0x15ac('0x48')]['id'])});}return _0x3e283c;});}})[_0x15ac('0x28')](respondWithResult(_0x31dd30,null))[_0x15ac('0x46')](handleError(_0x31dd30,null));};exports['removeAgents']=function(_0x31f22b,_0x2dca75,_0x3622c8){return db[_0x15ac('0x2f')][_0x15ac('0x4b')]({'where':{'id':_0x31f22b['params']['id']}})[_0x15ac('0x28')](handleEntityNotFound(_0x2dca75,null))['then'](function(_0x257571){if(_0x257571){return _0x257571[_0x15ac('0x9f')](_0x31f22b[_0x15ac('0x34')][_0x15ac('0x5e')])[_0x15ac('0x28')](function(){if(_['isArray'](_0x31f22b[_0x15ac('0x34')]['ids'])){for(var _0x3427df=0x0;_0x3427df<_0x31f22b[_0x15ac('0x34')][_0x15ac('0x5e')][_0x15ac('0x63')];_0x3427df+=0x1){socket[_0x15ac('0x9d')](_0x15ac('0xa0'),{'UserId':Number(_0x31f22b[_0x15ac('0x34')]['ids'][_0x3427df]),'CmListId':Number(_0x31f22b[_0x15ac('0x48')]['id'])});}}else{socket[_0x15ac('0x9d')]('userCmList:remove',{'UserId':Number(_0x31f22b[_0x15ac('0x34')][_0x15ac('0x5e')]),'CmListId':Number(_0x31f22b[_0x15ac('0x48')]['id'])});}});}})[_0x15ac('0x28')](respondWithStatusCode(_0x2dca75,null))[_0x15ac('0x46')](handleError(_0x2dca75,null));};exports['getAgents']=function(_0x4d809d,_0x53d7da,_0xe71ed9){var _0x1a5e9a={};var _0x9267cf={};var _0x5a2996;var _0x1fbb8e;return db[_0x15ac('0x2f')][_0x15ac('0x5a')]({'where':{'id':_0x4d809d[_0x15ac('0x48')]['id']}})['then'](handleEntityNotFound(_0x53d7da,null))[_0x15ac('0x28')](function(_0x2de20f){if(_0x2de20f){_0x5a2996=_0x2de20f;_0x9267cf[_0x15ac('0x33')]=_[_0x15ac('0x49')](db[_0x15ac('0xa1')][_0x15ac('0x30')]);_0x9267cf[_0x15ac('0x34')]=_[_0x15ac('0x49')](_0x4d809d[_0x15ac('0x34')]);_0x9267cf['filters']=_[_0x15ac('0x37')](_0x9267cf[_0x15ac('0x33')],_0x9267cf[_0x15ac('0x34')]);_0x1a5e9a[_0x15ac('0x36')]=_[_0x15ac('0x37')](_0x9267cf['model'],qs[_0x15ac('0x4a')](_0x4d809d[_0x15ac('0x34')][_0x15ac('0x4a')]));_0x1a5e9a['attributes']=_0x1a5e9a['attributes'][_0x15ac('0x63')]?_0x1a5e9a['attributes']:_0x9267cf[_0x15ac('0x33')];_0x1a5e9a[_0x15ac('0x39')]=qs[_0x15ac('0x3a')](_0x4d809d[_0x15ac('0x34')][_0x15ac('0x3a')]);_0x1a5e9a[_0x15ac('0x3b')]=qs['filters'](_[_0x15ac('0x3c')](_0x4d809d['query'],_0x9267cf['filters']));if(_0x4d809d[_0x15ac('0x34')]['filter']){_0x1a5e9a['where']=_[_0x15ac('0x3e')](_0x1a5e9a[_0x15ac('0x3b')],{'$or':_[_0x15ac('0x3f')](_0x1a5e9a[_0x15ac('0x36')],function(_0x45a0cb){var _0x317461={};_0x317461[_0x45a0cb]={'$like':'%'+_0x4d809d[_0x15ac('0x34')][_0x15ac('0x3d')]+'%'};return _0x317461;})});}_0x1a5e9a=_[_0x15ac('0x3e')]({},_0x1a5e9a,_0x4d809d[_0x15ac('0x41')]);return _0x5a2996[_0x15ac('0xa2')](_0x1a5e9a);}})['then'](function(_0x429986){if(_0x429986){_0x1fbb8e=_0x429986[_0x15ac('0x63')];if(!_0x4d809d[_0x15ac('0x34')][_0x15ac('0x5b')](_0x15ac('0x38'))){_0x1a5e9a[_0x15ac('0x20')]=qs[_0x15ac('0x20')](_0x4d809d['query'][_0x15ac('0x20')]);_0x1a5e9a['offset']=qs['offset'](_0x4d809d[_0x15ac('0x34')][_0x15ac('0x1e')]);}return _0x5a2996['getAgents'](_0x1a5e9a);}})[_0x15ac('0x28')](function(_0x46c4b7){if(_0x46c4b7){return _0x46c4b7?{'count':_0x1fbb8e,'rows':_0x46c4b7}:null;}})[_0x15ac('0x28')](respondWithResult(_0x53d7da,null))[_0x15ac('0x46')](handleError(_0x53d7da,null));};function handleQuery(_0x2bee93){logger['info'](_0x2bee93);return db[_0x15ac('0x8d')]['query'](_0x2bee93)[_0x15ac('0x9c')](function(_0x206751){csv_results[_0x15ac('0x65')](_0x206751);})[_0x15ac('0x46')](function(_0x1e5386){logger['error'](_0x1e5386[_0x15ac('0x69')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 933dc20..4af78df 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x1c3112,_0x2325fd){_0x1c3112=_0x1c3112-0x0;var _0x53b062=_0xe14b[_0x1c3112];return _0x53b062;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0x5fc3[_0x35485a];return _0x5148e6;};'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 0ef3e21..e5ee7d6 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 _0xa9e0=['../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x46a52c,_0x1d53eb){var _0x1018ac=function(_0xfa3914){while(--_0xfa3914){_0x46a52c['push'](_0x46a52c['shift']());}};_0x1018ac(++_0x1d53eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c81=['moment','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','api'];(function(_0x5951c7,_0x2f8b6b){var _0x265e08=function(_0x46084f){while(--_0x46084f){_0x5951c7['push'](_0x5951c7['shift']());}};_0x265e08(++_0x2f8b6b);}(_0x3c81,0x102));var _0x13c8=function(_0x5c968f,_0x113e8c){_0x5c968f=_0x5c968f-0x0;var _0xfee6ed=_0x3c81[_0x5c968f];return _0xfee6ed;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x13c8('0x4'));var attributes=require(_0x13c8('0x5'));module[_0x13c8('0x6')]=function(_0x1c16f1,_0x2a4d66){return _0x1c16f1[_0x13c8('0x7')](_0x13c8('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 737270c..aceddcd 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 _0xf87d=['localhost','socket.io-emitter','./cmList.socket','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x1cdf76,_0x52c087){var _0x45c876=function(_0x52c67b){while(--_0x52c67b){_0x1cdf76['push'](_0x1cdf76['shift']());}};_0x45c876(++_0x52c087);}(_0xf87d,0x1b4));var _0xdf87=function(_0x5a3842,_0x5c065e){_0x5a3842=_0x5a3842-0x0;var _0x365c24=_0xf87d[_0x5a3842];return _0x365c24;};'use strict';var _=require(_0xdf87('0x0'));var util=require(_0xdf87('0x1'));var moment=require(_0xdf87('0x2'));var BPromise=require(_0xdf87('0x3'));var rs=require(_0xdf87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdf87('0x5'));var logger=require(_0xdf87('0x6'))('rpc');var config=require(_0xdf87('0x7'));var jayson=require(_0xdf87('0x8'));var client=jayson[_0xdf87('0x9')]['http']({'port':0x232a});config[_0xdf87('0xa')]=_[_0xdf87('0xb')](config[_0xdf87('0xa')],{'host':_0xdf87('0xc'),'port':0x18eb});var socket=require(_0xdf87('0xd'))(new Redis(config[_0xdf87('0xa')]));require(_0xdf87('0xe'))['register'](socket);function respondWithRpcPromise(_0x1f9bf2,_0x26c058,_0x5c40d9){return new BPromise(function(_0xbce9ba,_0x1f4a27){return client[_0xdf87('0xf')](_0x1f9bf2,_0x5c40d9)[_0xdf87('0x10')](function(_0x112925){logger[_0xdf87('0x11')]('CmList,\x20%s,\x20%s',_0x26c058,'request\x20sent');logger[_0xdf87('0x12')](_0xdf87('0x13'),_0x26c058,_0xdf87('0x14'),JSON[_0xdf87('0x15')](_0x112925));if(_0x112925[_0xdf87('0x16')]){if(_0x112925[_0xdf87('0x16')][_0xdf87('0x17')]===0x1f4){logger['error'](_0xdf87('0x18'),_0x26c058,_0x112925['error'][_0xdf87('0x19')]);return _0x1f4a27(_0x112925[_0xdf87('0x16')]['message']);}logger['error'](_0xdf87('0x18'),_0x26c058,_0x112925['error']['message']);return _0xbce9ba(_0x112925['error']['message']);}else{logger['info'](_0xdf87('0x18'),_0x26c058,_0xdf87('0x14'));_0xbce9ba(_0x112925[_0xdf87('0x1a')][_0xdf87('0x19')]);}})[_0xdf87('0x1b')](function(_0xfa8022){logger[_0xdf87('0x16')](_0xdf87('0x18'),_0x26c058,_0xfa8022);_0x1f4a27(_0xfa8022);});});} \ No newline at end of file +var _0x2cca=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x2cca,0x145));var _0xa2cc=function(_0x6ea071,_0x5a8623){_0x6ea071=_0x6ea071-0x0;var _0x5500e5=_0x2cca[_0x6ea071];return _0x5500e5;};'use strict';var _=require(_0xa2cc('0x0'));var util=require(_0xa2cc('0x1'));var moment=require(_0xa2cc('0x2'));var BPromise=require('bluebird');var rs=require(_0xa2cc('0x3'));var fs=require('fs');var Redis=require(_0xa2cc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2cc('0x5'));var logger=require(_0xa2cc('0x6'))(_0xa2cc('0x7'));var config=require(_0xa2cc('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa2cc('0x9')]({'port':0x232a});config[_0xa2cc('0xa')]=_['defaults'](config['redis'],{'host':_0xa2cc('0xb'),'port':0x18eb});var socket=require(_0xa2cc('0xc'))(new Redis(config[_0xa2cc('0xa')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x389b95,_0x3d5845,_0x4b1400){return new BPromise(function(_0x530092,_0x2613cd){return client['request'](_0x389b95,_0x4b1400)[_0xa2cc('0xd')](function(_0x5381ec){logger[_0xa2cc('0xe')](_0xa2cc('0xf'),_0x3d5845,_0xa2cc('0x10'));logger['debug'](_0xa2cc('0x11'),_0x3d5845,_0xa2cc('0x10'),JSON[_0xa2cc('0x12')](_0x5381ec));if(_0x5381ec['error']){if(_0x5381ec[_0xa2cc('0x13')]['code']===0x1f4){logger[_0xa2cc('0x13')](_0xa2cc('0xf'),_0x3d5845,_0x5381ec[_0xa2cc('0x13')][_0xa2cc('0x14')]);return _0x2613cd(_0x5381ec['error'][_0xa2cc('0x14')]);}logger[_0xa2cc('0x13')](_0xa2cc('0xf'),_0x3d5845,_0x5381ec[_0xa2cc('0x13')][_0xa2cc('0x14')]);return _0x530092(_0x5381ec[_0xa2cc('0x13')][_0xa2cc('0x14')]);}else{logger['info'](_0xa2cc('0xf'),_0x3d5845,'request\x20sent');_0x530092(_0x5381ec[_0xa2cc('0x15')][_0xa2cc('0x14')]);}})[_0xa2cc('0x16')](function(_0x4df128){logger[_0xa2cc('0x13')]('CmList,\x20%s,\x20%s',_0x3d5845,_0x4df128);_0x2613cd(_0x4df128);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c101273..72ba635 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 _0x9ac6=['register','length','cmList:','save','remove','emit'];(function(_0x1db78c,_0x37ea25){var _0x1e7df4=function(_0x3d60b7){while(--_0x3d60b7){_0x1db78c['push'](_0x1db78c['shift']());}};_0x1e7df4(++_0x37ea25);}(_0x9ac6,0x1a7));var _0x69ac=function(_0x141598,_0x16c3a6){_0x141598=_0x141598-0x0;var _0x2d3360=_0x9ac6[_0x141598];return _0x2d3360;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x69ac('0x0'),_0x69ac('0x1'),'update'];function createListener(_0x43c4c6,_0x1d7bd9){return function(_0x19936f){_0x1d7bd9[_0x69ac('0x2')](_0x43c4c6,_0x19936f);};}function removeListener(_0x36a4c2,_0x45db83){return function(){CmListEvents['removeListener'](_0x36a4c2,_0x45db83);};}exports[_0x69ac('0x3')]=function(_0x397482){for(var _0x4c7b44=0x0,_0x137a05=events[_0x69ac('0x4')];_0x4c7b44<_0x137a05;_0x4c7b44++){var _0x270d6d=events[_0x4c7b44];var _0x1305f0=createListener(_0x69ac('0x5')+_0x270d6d,_0x397482);CmListEvents['on'](_0x270d6d,_0x1305f0);}}; \ No newline at end of file +var _0x7f5e=['cmList:','emit','removeListener'];(function(_0x2dd849,_0x3bd1bf){var _0x38ba4e=function(_0xd89ddc){while(--_0xd89ddc){_0x2dd849['push'](_0x2dd849['shift']());}};_0x38ba4e(++_0x3bd1bf);}(_0x7f5e,0x18d));var _0xe7f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f5e[_0x20a584];return _0x4b41a8;};'use strict';var CmListEvents=require('./cmList.events');var events=['save','remove','update'];function createListener(_0x3f6ae8,_0x5c5563){return function(_0x484794){_0x5c5563[_0xe7f5('0x0')](_0x3f6ae8,_0x484794);};}function removeListener(_0x591852,_0x994866){return function(){CmListEvents[_0xe7f5('0x1')](_0x591852,_0x994866);};}exports['register']=function(_0xb79e10){for(var _0x29f208=0x0,_0xb2d31d=events['length'];_0x29f208<_0xb2d31d;_0x29f208++){var _0x3869a6=events[_0x29f208];var _0x1f7700=createListener(_0xe7f5('0x2')+_0x3869a6,_0xb79e10);CmListEvents['on'](_0x3869a6,_0x1f7700);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 7831845..8cdf5ee 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 _0xabfb=['describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','getContactsCsv','/:id/fields','/:id/users','post','create','addDisposition','addCustomField','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe'];(function(_0x2cde51,_0x41b85c){var _0x37177e=function(_0x5a68f4){while(--_0x5a68f4){_0x2cde51['push'](_0x2cde51['shift']());}};_0x37177e(++_0x41b85c);}(_0xabfb,0xa2));var _0xbabf=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0xabfb[_0x154cb5];return _0x3f574f;};'use strict';var multer=require(_0xbabf('0x0'));var util=require('util');var path=require(_0xbabf('0x1'));var timeout=require(_0xbabf('0x2'));var express=require(_0xbabf('0x3'));var router=express[_0xbabf('0x4')]();var fs_extra=require(_0xbabf('0x5'));var auth=require(_0xbabf('0x6'));var interaction=require(_0xbabf('0x7'));var config=require(_0xbabf('0x8'));var controller=require(_0xbabf('0x9'));router[_0xbabf('0xa')]('/',auth[_0xbabf('0xb')](),controller['index']);router[_0xbabf('0xa')](_0xbabf('0xc'),auth[_0xbabf('0xb')](),controller[_0xbabf('0xd')]);router['get'](_0xbabf('0xe'),auth[_0xbabf('0xb')](),controller[_0xbabf('0xf')]);router[_0xbabf('0xa')](_0xbabf('0x10'),auth[_0xbabf('0xb')](),controller[_0xbabf('0x11')]);router[_0xbabf('0xa')](_0xbabf('0x12'),auth[_0xbabf('0xb')](),controller[_0xbabf('0x13')]);router[_0xbabf('0xa')]('/:id/contacts',auth[_0xbabf('0xb')](),controller[_0xbabf('0x14')]);router[_0xbabf('0xa')]('/:id/contacts/csv',auth[_0xbabf('0xb')](),controller[_0xbabf('0x15')]);router[_0xbabf('0xa')](_0xbabf('0x16'),auth['isAuthenticated'](),controller['getCustomFields']);router['get'](_0xbabf('0x17'),auth[_0xbabf('0xb')](),controller['getAgents']);router[_0xbabf('0x18')]('/',auth[_0xbabf('0xb')](),controller[_0xbabf('0x19')]);router['post'](_0xbabf('0x12'),auth[_0xbabf('0xb')](),controller[_0xbabf('0x1a')]);router[_0xbabf('0x18')]('/:id/contacts',auth[_0xbabf('0xb')](),controller['addContacts']);router[_0xbabf('0x18')](_0xbabf('0x16'),auth['isAuthenticated'](),controller[_0xbabf('0x1b')]);router[_0xbabf('0x18')](_0xbabf('0x17'),auth[_0xbabf('0xb')](),controller[_0xbabf('0x1c')]);router['put'](_0xbabf('0x10'),auth[_0xbabf('0xb')](),controller[_0xbabf('0x1d')]);router[_0xbabf('0x1e')]('/:id',auth[_0xbabf('0xb')](),controller[_0xbabf('0x1f')]);router['delete'](_0xbabf('0x12'),auth[_0xbabf('0xb')](),controller[_0xbabf('0x20')]);router[_0xbabf('0x1e')](_0xbabf('0x17'),auth[_0xbabf('0xb')](),controller[_0xbabf('0x21')]);module[_0xbabf('0x22')]=router; \ No newline at end of file +var _0xeee3=['/describe','describe','/global_fields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','update','delete','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index'];(function(_0x36b474,_0x57d2e9){var _0x510f44=function(_0x251824){while(--_0x251824){_0x36b474['push'](_0x36b474['shift']());}};_0x510f44(++_0x57d2e9);}(_0xeee3,0xb6));var _0x3eee=function(_0x385785,_0x4f0a37){_0x385785=_0x385785-0x0;var _0x2084ff=_0xeee3[_0x385785];return _0x2084ff;};'use strict';var multer=require('multer');var util=require(_0x3eee('0x0'));var path=require(_0x3eee('0x1'));var timeout=require(_0x3eee('0x2'));var express=require('express');var router=express[_0x3eee('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3eee('0x4'));var config=require(_0x3eee('0x5'));var controller=require(_0x3eee('0x6'));router[_0x3eee('0x7')]('/',auth[_0x3eee('0x8')](),controller[_0x3eee('0x9')]);router[_0x3eee('0x7')](_0x3eee('0xa'),auth[_0x3eee('0x8')](),controller[_0x3eee('0xb')]);router[_0x3eee('0x7')](_0x3eee('0xc'),auth[_0x3eee('0x8')](),controller['getGlobalCustomFields']);router[_0x3eee('0x7')]('/:id',auth[_0x3eee('0x8')](),controller[_0x3eee('0xd')]);router[_0x3eee('0x7')](_0x3eee('0xe'),auth[_0x3eee('0x8')](),controller[_0x3eee('0xf')]);router[_0x3eee('0x7')](_0x3eee('0x10'),auth[_0x3eee('0x8')](),controller[_0x3eee('0x11')]);router[_0x3eee('0x7')](_0x3eee('0x12'),auth[_0x3eee('0x8')](),controller[_0x3eee('0x13')]);router[_0x3eee('0x7')](_0x3eee('0x14'),auth[_0x3eee('0x8')](),controller[_0x3eee('0x15')]);router[_0x3eee('0x7')](_0x3eee('0x16'),auth[_0x3eee('0x8')](),controller[_0x3eee('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3eee('0x18')]);router[_0x3eee('0x19')](_0x3eee('0xe'),auth[_0x3eee('0x8')](),controller[_0x3eee('0x1a')]);router[_0x3eee('0x19')](_0x3eee('0x10'),auth['isAuthenticated'](),controller[_0x3eee('0x1b')]);router[_0x3eee('0x19')](_0x3eee('0x14'),auth[_0x3eee('0x8')](),controller[_0x3eee('0x1c')]);router[_0x3eee('0x19')](_0x3eee('0x16'),auth['isAuthenticated'](),controller[_0x3eee('0x1d')]);router['put']('/:id',auth[_0x3eee('0x8')](),controller[_0x3eee('0x1e')]);router[_0x3eee('0x1f')]('/:id',auth[_0x3eee('0x8')](),controller['destroy']);router[_0x3eee('0x1f')](_0x3eee('0xe'),auth[_0x3eee('0x8')](),controller['removeDispositions']);router[_0x3eee('0x1f')](_0x3eee('0x16'),auth[_0x3eee('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 0270f75..0dbd613 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 _0xa84d=['VIRTUAL','getDataValue','field','STRING'];(function(_0x2f7d3d,_0x5ba77a){var _0x3c8f7a=function(_0x530ab2){while(--_0x530ab2){_0x2f7d3d['push'](_0x2f7d3d['shift']());}};_0x3c8f7a(++_0x5ba77a);}(_0xa84d,0x178));var _0xda84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa84d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xda84('0x0')],'get':function(_0x30fb29){return this[_0xda84('0x1')](_0xda84('0x2'));}},'field':{'type':Sequelize[_0xda84('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xda84('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xda84('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x0e91=['getDataValue','STRING','sequelize','exports','VIRTUAL'];(function(_0x2c7a78,_0x4b6ee1){var _0x3c5926=function(_0x31092e){while(--_0x31092e){_0x2c7a78['push'](_0x2c7a78['shift']());}};_0x3c5926(++_0x4b6ee1);}(_0x0e91,0x18d));var _0x10e9=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x0e91[_0x1e6e4e];return _0x3d746b;};'use strict';var Sequelize=require(_0x10e9('0x0'));module[_0x10e9('0x1')]={'name':{'type':Sequelize[_0x10e9('0x2')],'get':function(_0x5ecd35){return this[_0x10e9('0x3')]('field');}},'field':{'type':Sequelize[_0x10e9('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x10e9('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x10e9('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 530f2a3..8952790 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x2514a4,_0x4bc892){var _0x4a7441=function(_0x49c7d7){while(--_0x49c7d7){_0x2514a4['push'](_0x2514a4['shift']());}};_0x4a7441(++_0x4bc892);}(_0x7a54,0x106));var _0x47a5=function(_0x2faaef,_0xc3760a){_0x2faaef=_0x2faaef-0x0;var _0x1906cd=_0x7a54[_0x2faaef];return _0x1906cd;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4f496b,_0x2d59e4){var _0x2fe12f=function(_0x2249f5){while(--_0x2249f5){_0x4f496b['push'](_0x4f496b['shift']());}};_0x2fe12f(++_0x2d59e4);}(_0x7a54,0x106));var _0x47a5=function(_0x14adb7,_0x208b56){_0x14adb7=_0x14adb7-0x0;var _0x2c515f=_0x7a54[_0x14adb7];return _0x2c515f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 3c32a9b..c394cdb 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 _0x4f79=['rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3df73f,_0x459c3b){var _0x4382c0=function(_0xc28e89){while(--_0xc28e89){_0x3df73f['push'](_0x3df73f['shift']());}};_0x4382c0(++_0x459c3b);}(_0x4f79,0x103));var _0x94f7=function(_0x349e2c,_0x5cb7cc){_0x349e2c=_0x349e2c-0x0;var _0x406caa=_0x4f79[_0x349e2c];return _0x406caa;};'use strict';var _=require(_0x94f7('0x0'));var util=require(_0x94f7('0x1'));var logger=require(_0x94f7('0x2'))(_0x94f7('0x3'));var moment=require(_0x94f7('0x4'));var BPromise=require(_0x94f7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94f7('0x6'));var rimraf=require(_0x94f7('0x7'));var config=require(_0x94f7('0x8'));var attributes=require(_0x94f7('0x9'));module[_0x94f7('0xa')]=function(_0xb42eb0,_0x562983){return _0xb42eb0[_0x94f7('0xb')](_0x94f7('0xc'),attributes,{'tableName':_0x94f7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e2b=['./condition.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x429cdc,_0x53fb92){var _0x458f8a=function(_0x3afbd3){while(--_0x3afbd3){_0x429cdc['push'](_0x429cdc['shift']());}};_0x458f8a(++_0x53fb92);}(_0x2e2b,0x12f));var _0xb2e2=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x2e2b[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xb2e2('0x0'));var util=require(_0xb2e2('0x1'));var logger=require(_0xb2e2('0x2'))(_0xb2e2('0x3'));var moment=require(_0xb2e2('0x4'));var BPromise=require(_0xb2e2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2e2('0x6'));var rimraf=require(_0xb2e2('0x7'));var config=require(_0xb2e2('0x8'));var attributes=require(_0xb2e2('0x9'));module[_0xb2e2('0xa')]=function(_0x17271c,_0xd25623){return _0x17271c[_0xb2e2('0xb')]('Condition',attributes,{'tableName':'tools_conditions','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 d34e287..9f31261 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 _0xd21d=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s'];(function(_0x26899a,_0x26c333){var _0xdc18d9=function(_0x3da640){while(--_0x3da640){_0x26899a['push'](_0x26899a['shift']());}};_0xdc18d9(++_0x26c333);}(_0xd21d,0x173));var _0xdd21=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xd21d[_0xcaf223];return _0x17e00d;};'use strict';var _=require(_0xdd21('0x0'));var util=require(_0xdd21('0x1'));var moment=require(_0xdd21('0x2'));var BPromise=require(_0xdd21('0x3'));var rs=require(_0xdd21('0x4'));var fs=require('fs');var Redis=require(_0xdd21('0x5'));var db=require(_0xdd21('0x6'))['db'];var utils=require(_0xdd21('0x7'));var logger=require(_0xdd21('0x8'))(_0xdd21('0x9'));var config=require('../../config/environment');var jayson=require(_0xdd21('0xa'));var client=jayson[_0xdd21('0xb')][_0xdd21('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfed97d,_0x593843,_0x5ec0ec){return new BPromise(function(_0x9b0b75,_0x3a9b87){return client[_0xdd21('0xd')](_0xfed97d,_0x5ec0ec)[_0xdd21('0xe')](function(_0x161655){logger['info']('Condition,\x20%s,\x20%s',_0x593843,_0xdd21('0xf'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x593843,_0xdd21('0xf'),JSON[_0xdd21('0x10')](_0x161655));if(_0x161655['error']){if(_0x161655[_0xdd21('0x11')][_0xdd21('0x12')]===0x1f4){logger['error'](_0xdd21('0x13'),_0x593843,_0x161655[_0xdd21('0x11')]['message']);return _0x3a9b87(_0x161655[_0xdd21('0x11')][_0xdd21('0x14')]);}logger['error'](_0xdd21('0x13'),_0x593843,_0x161655['error'][_0xdd21('0x14')]);return _0x9b0b75(_0x161655[_0xdd21('0x11')][_0xdd21('0x14')]);}else{logger[_0xdd21('0x15')](_0xdd21('0x13'),_0x593843,_0xdd21('0xf'));_0x9b0b75(_0x161655['result']['message']);}})[_0xdd21('0x16')](function(_0x234dd5){logger['error'](_0xdd21('0x13'),_0x593843,_0x234dd5);_0x3a9b87(_0x234dd5);});});} \ No newline at end of file +var _0x398b=['lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch'];(function(_0x5413f5,_0x3154c7){var _0x639288=function(_0x4b85e9){while(--_0x4b85e9){_0x5413f5['push'](_0x5413f5['shift']());}};_0x639288(++_0x3154c7);}(_0x398b,0xd2));var _0xb398=function(_0x4b43c0,_0x3a8091){_0x4b43c0=_0x4b43c0-0x0;var _0x574c13=_0x398b[_0x4b43c0];return _0x574c13;};'use strict';var _=require(_0xb398('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb398('0x1'));var rs=require(_0xb398('0x2'));var fs=require('fs');var Redis=require(_0xb398('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb398('0x4'));var logger=require(_0xb398('0x5'))(_0xb398('0x6'));var config=require(_0xb398('0x7'));var jayson=require(_0xb398('0x8'));var client=jayson['client'][_0xb398('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42c530,_0x37adb4,_0xbbd96b){return new BPromise(function(_0x2a7641,_0x4b6f92){return client[_0xb398('0xa')](_0x42c530,_0xbbd96b)[_0xb398('0xb')](function(_0x281fa1){logger['info']('Condition,\x20%s,\x20%s',_0x37adb4,_0xb398('0xc'));logger[_0xb398('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x37adb4,_0xb398('0xc'),JSON[_0xb398('0xe')](_0x281fa1));if(_0x281fa1[_0xb398('0xf')]){if(_0x281fa1[_0xb398('0xf')][_0xb398('0x10')]===0x1f4){logger['error'](_0xb398('0x11'),_0x37adb4,_0x281fa1[_0xb398('0xf')][_0xb398('0x12')]);return _0x4b6f92(_0x281fa1[_0xb398('0xf')]['message']);}logger['error'](_0xb398('0x11'),_0x37adb4,_0x281fa1[_0xb398('0xf')][_0xb398('0x12')]);return _0x2a7641(_0x281fa1['error'][_0xb398('0x12')]);}else{logger['info'](_0xb398('0x11'),_0x37adb4,'request\x20sent');_0x2a7641(_0x281fa1[_0xb398('0x13')][_0xb398('0x12')]);}})[_0xb398('0x14')](function(_0x21d929){logger['error'](_0xb398('0x11'),_0x37adb4,_0x21d929);_0x4b6f92(_0x21d929);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index b3ec705..00dedb9 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 _0x9b73=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x2562f3,_0x446102){var _0x396a09=function(_0x2d0061){while(--_0x2d0061){_0x2562f3['push'](_0x2562f3['shift']());}};_0x396a09(++_0x446102);}(_0x9b73,0x17b));var _0x39b7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9b73[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x39b7('0x0'));var util=require(_0x39b7('0x1'));var path=require(_0x39b7('0x2'));var timeout=require(_0x39b7('0x3'));var express=require(_0x39b7('0x4'));var router=express[_0x39b7('0x5')]();var fs_extra=require(_0x39b7('0x6'));var auth=require(_0x39b7('0x7'));var interaction=require(_0x39b7('0x8'));var config=require(_0x39b7('0x9'));var controller=require(_0x39b7('0xa'));router[_0x39b7('0xb')](_0x39b7('0xc'),auth[_0x39b7('0xd')](),controller[_0x39b7('0xe')]);router['delete']('/:id',auth[_0x39b7('0xd')](),controller[_0x39b7('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd5bd=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0xf7a9cf,_0x2cfa33){var _0x7fdc45=function(_0x44b354){while(--_0x44b354){_0xf7a9cf['push'](_0xf7a9cf['shift']());}};_0x7fdc45(++_0x2cfa33);}(_0xd5bd,0xd0));var _0xdd5b=function(_0x41b654,_0x39239c){_0x41b654=_0x41b654-0x0;var _0x55c219=_0xd5bd[_0x41b654];return _0x55c219;};'use strict';var multer=require(_0xdd5b('0x0'));var util=require(_0xdd5b('0x1'));var path=require(_0xdd5b('0x2'));var timeout=require(_0xdd5b('0x3'));var express=require(_0xdd5b('0x4'));var router=express['Router']();var fs_extra=require(_0xdd5b('0x5'));var auth=require(_0xdd5b('0x6'));var interaction=require(_0xdd5b('0x7'));var config=require('../../config/environment');var controller=require(_0xdd5b('0x8'));router[_0xdd5b('0x9')](_0xdd5b('0xa'),auth[_0xdd5b('0xb')](),controller[_0xdd5b('0xc')]);router[_0xdd5b('0xd')](_0xdd5b('0xa'),auth[_0xdd5b('0xb')](),controller[_0xdd5b('0xe')]);module[_0xdd5b('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 66db645..a6544cb 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x534d=['INTEGER','sequelize','exports','STRING','name'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x534d,0x79));var _0xd534=function(_0x2dad68,_0x311f63){_0x2dad68=_0x2dad68-0x0;var _0x17a238=_0x534d[_0x2dad68];return _0x17a238;};'use strict';var Sequelize=require(_0xd534('0x0'));module[_0xd534('0x1')]={'name':{'type':Sequelize[_0xd534('0x2')],'allowNull':![],'unique':_0xd534('0x3')},'OrderBy':{'type':Sequelize[_0xd534('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xd534('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x62ea=['exports','STRING','INTEGER'];(function(_0xb8a2c6,_0x24b92c){var _0x1b779e=function(_0x3cfb6c){while(--_0x3cfb6c){_0xb8a2c6['push'](_0xb8a2c6['shift']());}};_0x1b779e(++_0x24b92c);}(_0x62ea,0xae));var _0xa62e=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0x62ea[_0x1a3e23];return _0x5ee0d8;};'use strict';var Sequelize=require('sequelize');module[_0xa62e('0x0')]={'name':{'type':Sequelize[_0xa62e('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xa62e('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa62e('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 8bb091f..bb4a2f4 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3423=['../../components/auth/service','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','ContactItemTypes','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','role','user','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','CmContactHasItem','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'];(function(_0x4f4c25,_0xd3e44f){var _0x1f2dde=function(_0x545574){while(--_0x545574){_0x4f4c25['push'](_0x4f4c25['shift']());}};_0x1f2dde(++_0xd3e44f);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3342('0x0'));var jsonpatch=require(_0x3342('0x1'));var rp=require(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require(_0x3342('0x8'));var csv=require(_0x3342('0x9'));var ejs=require(_0x3342('0xa'));var fs=require('fs');var fs_extra=require(_0x3342('0xb'));var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0x9'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x716d80,_0x36e1f4){_0x36e1f4=_0x36e1f4||0xcc;return function(_0x592ba8){if(_0x592ba8){return _0x716d80[_0x3342('0x16')](_0x36e1f4);}return _0x716d80[_0x3342('0x17')](_0x36e1f4)[_0x3342('0x18')]();};}function respondWithResult(_0xe4689e,_0x61fcc0){_0x61fcc0=_0x61fcc0||0xc8;return function(_0x104077){if(_0x104077){return _0xe4689e[_0x3342('0x17')](_0x61fcc0)['json'](_0x104077);}};}function respondWithFilteredResult(_0x3e44f3,_0x19bd71){return function(_0x49afe3){if(_0x49afe3){var _0x40d609=typeof _0x19bd71[_0x3342('0x19')]==='undefined'&&typeof _0x19bd71['limit']===_0x3342('0x1a');var _0x143cf1=_0x49afe3[_0x3342('0x1b')];var _0x2075cb=_0x40d609?0x0:_0x19bd71[_0x3342('0x19')];var _0x156c24=_0x40d609?_0x49afe3[_0x3342('0x1b')]:_0x19bd71[_0x3342('0x19')]+_0x19bd71[_0x3342('0x1c')];var _0x4f4c2a;if(_0x156c24>=_0x143cf1){_0x156c24=_0x143cf1;_0x4f4c2a=0xc8;}else{_0x4f4c2a=0xce;}_0x3e44f3[_0x3342('0x17')](_0x4f4c2a);return _0x3e44f3[_0x3342('0x1d')](_0x3342('0x1e'),_0x2075cb+'-'+_0x156c24+'/'+_0x143cf1)['json'](_0x49afe3);}return null;};}function patchUpdates(_0x3cb86f){return function(_0x463324){try{jsonpatch['apply'](_0x463324,_0x3cb86f,!![]);}catch(_0xe774b7){return BPromise[_0x3342('0x1f')](_0xe774b7);}return _0x463324['save']();};}function saveUpdates(_0x4e1b19,_0x5a0658){return function(_0x3f271c){if(_0x3f271c){return _0x3f271c[_0x3342('0x20')](_0x4e1b19)[_0x3342('0x21')](function(_0x2dbad1){return _0x2dbad1;});}return null;};}function removeEntity(_0xd2b87d,_0x2925a2){return function(_0x26eb87){if(_0x26eb87){return _0x26eb87[_0x3342('0x22')]()['then'](function(){var _0x30ffc9=_0x26eb87['get']({'plain':!![]});var _0x51cf45=_0x3342('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x51cf45,'resourceId':_0x30ffc9['id']}})[_0x3342('0x21')](function(){return _0x26eb87;});})['then'](function(){_0xd2b87d[_0x3342('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x524286,_0x55cddd){return function(_0x1497d9){if(!_0x1497d9){_0x524286[_0x3342('0x16')](0x194);}return _0x1497d9;};}function handleError(_0x1dd607,_0x5eef2b){_0x5eef2b=_0x5eef2b||0x1f4;return function(_0xc275a1){logger[_0x3342('0x24')](_0xc275a1[_0x3342('0x25')]);if(_0xc275a1[_0x3342('0x26')]){delete _0xc275a1['name'];}_0x1dd607[_0x3342('0x17')](_0x5eef2b)[_0x3342('0x27')](_0xc275a1);};}exports[_0x3342('0x28')]=function(_0x301114,_0xf82530){var _0x2cc691={},_0x135760={},_0x47b2a0={'count':0x0,'rows':[]};var _0x2e0bde=_['map'](db[_0x3342('0x29')][_0x3342('0x2a')],function(_0x508f87){return{'name':_0x508f87[_0x3342('0x2b')],'type':_0x508f87[_0x3342('0x2c')][_0x3342('0x2d')]};});_0x135760[_0x3342('0x2e')]=_['map'](_0x2e0bde,_0x3342('0x26'));_0x135760[_0x3342('0x2f')]=_[_0x3342('0x30')](_0x301114[_0x3342('0x2f')]);_0x135760[_0x3342('0x31')]=_[_0x3342('0x32')](_0x135760[_0x3342('0x2e')],_0x135760[_0x3342('0x2f')]);_0x2cc691[_0x3342('0x33')]=_[_0x3342('0x32')](_0x135760[_0x3342('0x2e')],qs[_0x3342('0x34')](_0x301114['query']['fields']));_0x2cc691[_0x3342('0x33')]=_0x2cc691['attributes'][_0x3342('0x35')]?_0x2cc691[_0x3342('0x33')]:_0x135760[_0x3342('0x2e')];if(!_0x301114[_0x3342('0x2f')][_0x3342('0x36')](_0x3342('0x37'))){_0x2cc691[_0x3342('0x1c')]=qs['limit'](_0x301114[_0x3342('0x2f')][_0x3342('0x1c')]);_0x2cc691[_0x3342('0x19')]=qs[_0x3342('0x19')](_0x301114[_0x3342('0x2f')]['offset']);}_0x2cc691[_0x3342('0x38')]=qs['sort'](_0x301114[_0x3342('0x2f')][_0x3342('0x39')]);_0x2cc691[_0x3342('0x3a')]=qs[_0x3342('0x31')](_['pick'](_0x301114[_0x3342('0x2f')],_0x135760['filters']),_0x2e0bde);if(_0x301114[_0x3342('0x2f')][_0x3342('0x3b')]){_0x2cc691[_0x3342('0x3a')]=_[_0x3342('0x3c')](_0x2cc691[_0x3342('0x3a')],{'$or':_[_0x3342('0x3d')](_0x2e0bde,function(_0x32ef9a){if(_0x32ef9a['type']!==_0x3342('0x3e')){var _0x355e83={};_0x355e83[_0x32ef9a['name']]={'$like':'%'+_0x301114[_0x3342('0x2f')][_0x3342('0x3b')]+'%'};return _0x355e83;}})});}_0x2cc691=_['merge']({},_0x2cc691,_0x301114[_0x3342('0x3f')]);var _0x29f0a0={'where':_0x2cc691['where']};return db['ContactItemType']['count'](_0x29f0a0)[_0x3342('0x21')](function(_0x41e727){_0x47b2a0['count']=_0x41e727;if(_0x301114[_0x3342('0x2f')][_0x3342('0x40')]){_0x2cc691[_0x3342('0x41')]=[{'all':!![]}];}return db[_0x3342('0x29')][_0x3342('0x42')](_0x2cc691);})[_0x3342('0x21')](function(_0x34de7b){_0x47b2a0[_0x3342('0x43')]=_0x34de7b;return _0x47b2a0;})['then'](respondWithFilteredResult(_0xf82530,_0x2cc691))['catch'](handleError(_0xf82530,null));};exports[_0x3342('0x44')]=function(_0x7341fa,_0x474196){var _0xee717e={'raw':!![],'where':{'id':_0x7341fa[_0x3342('0x45')]['id']}},_0x717946={};_0x717946['model']=_[_0x3342('0x30')](db[_0x3342('0x29')][_0x3342('0x2a')]);_0x717946[_0x3342('0x2f')]=_[_0x3342('0x30')](_0x7341fa[_0x3342('0x2f')]);_0x717946['filters']=_[_0x3342('0x32')](_0x717946['model'],_0x717946[_0x3342('0x2f')]);_0xee717e[_0x3342('0x33')]=_[_0x3342('0x32')](_0x717946[_0x3342('0x2e')],qs['fields'](_0x7341fa[_0x3342('0x2f')][_0x3342('0x34')]));_0xee717e['attributes']=_0xee717e[_0x3342('0x33')][_0x3342('0x35')]?_0xee717e[_0x3342('0x33')]:_0x717946[_0x3342('0x2e')];if(_0x7341fa['query'][_0x3342('0x40')]){_0xee717e[_0x3342('0x41')]=[{'all':!![]}];}_0xee717e=_['merge']({},_0xee717e,_0x7341fa[_0x3342('0x3f')]);return db['ContactItemType']['find'](_0xee717e)[_0x3342('0x21')](handleEntityNotFound(_0x474196,null))[_0x3342('0x21')](respondWithResult(_0x474196,null))[_0x3342('0x46')](handleError(_0x474196,null));};exports[_0x3342('0x47')]=function(_0x23925e,_0x171387){return db[_0x3342('0x29')]['create'](_0x23925e['body'],{})[_0x3342('0x21')](function(_0x5a9e40){var _0x26251c=_0x23925e['user']['get']({'plain':!![]});if(!_0x26251c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26251c[_0x3342('0x48')]===_0x3342('0x49')){var _0x29ccb6=_0x5a9e40[_0x3342('0x4a')]({'plain':!![]});var _0x5176d7=_0x3342('0x23');return db[_0x3342('0x4b')]['find']({'where':{'name':_0x5176d7,'userProfileId':_0x26251c[_0x3342('0x4c')]},'raw':!![]})[_0x3342('0x21')](function(_0x43c27a){if(_0x43c27a&&_0x43c27a['autoAssociation']===0x0){return db[_0x3342('0x4d')][_0x3342('0x47')]({'name':_0x29ccb6[_0x3342('0x26')],'resourceId':_0x29ccb6['id'],'type':_0x43c27a[_0x3342('0x26')],'sectionId':_0x43c27a['id']},{})[_0x3342('0x21')](function(){return _0x5a9e40;});}else{return _0x5a9e40;}})['catch'](function(_0x2699d2){logger[_0x3342('0x24')](_0x3342('0x4e'),_0x2699d2);throw _0x2699d2;});}return _0x5a9e40;})[_0x3342('0x21')](respondWithResult(_0x171387,0xc9))[_0x3342('0x46')](handleError(_0x171387,null));};exports[_0x3342('0x20')]=function(_0x3db07c,_0x47cf76){if(_0x3db07c[_0x3342('0x4f')]['id']){delete _0x3db07c['body']['id'];}return db[_0x3342('0x29')]['find']({'where':{'id':_0x3db07c[_0x3342('0x45')]['id']}})['then'](handleEntityNotFound(_0x47cf76,null))['then'](saveUpdates(_0x3db07c['body'],null))['then'](respondWithResult(_0x47cf76,null))[_0x3342('0x46')](handleError(_0x47cf76,null));};exports[_0x3342('0x22')]=function(_0x3cd098,_0x476973){return db[_0x3342('0x29')][_0x3342('0x50')]({'where':{'id':_0x3cd098[_0x3342('0x45')]['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x476973,null))[_0x3342('0x21')](db[_0x3342('0x51')][_0x3342('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3cd098['params']['id']}}))['then'](removeEntity(_0x476973,null))[_0x3342('0x46')](handleError(_0x476973,null));}; \ No newline at end of file +var _0xbbbc=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','fields','include','options','create','body','user','ContactItemTypes','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x5b536e,_0x197d3e){var _0x303316=function(_0x19771d){while(--_0x19771d){_0x5b536e['push'](_0x5b536e['shift']());}};_0x303316(++_0x197d3e);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x345865,_0x1d878d){_0x345865=_0x345865-0x0;var _0x2e14f4=_0xbbbc[_0x345865];return _0x2e14f4;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){var _0x4c543a=_0x5e3970[_0xcbbb('0x27')]({'plain':!![]});var _0x4ffa80='ContactItemTypes';return db[_0xcbbb('0x28')][_0xcbbb('0x26')]({'where':{'type':_0x4ffa80,'resourceId':_0x4c543a['id']}})['then'](function(){return _0x5e3970;});})['then'](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x55e1d8,_0x4da775){return function(_0x21e3b1){if(!_0x21e3b1){_0x55e1d8[_0xcbbb('0x18')](0x194);}return _0x21e3b1;};}function handleError(_0x38f1c6,_0x13121e){_0x13121e=_0x13121e||0x1f4;return function(_0x372024){logger[_0xcbbb('0x29')](_0x372024[_0xcbbb('0x2a')]);if(_0x372024[_0xcbbb('0x2b')]){delete _0x372024[_0xcbbb('0x2b')];}_0x38f1c6[_0xcbbb('0x19')](_0x13121e)[_0xcbbb('0x2c')](_0x372024);};}exports[_0xcbbb('0x2d')]=function(_0xfa973b,_0x1ce741){var _0x2a9639={},_0xcae72c={},_0x117739={'count':0x0,'rows':[]};var _0x21c560=_['map'](db[_0xcbbb('0x2e')][_0xcbbb('0x2f')],function(_0x5332f9){return{'name':_0x5332f9[_0xcbbb('0x30')],'type':_0x5332f9['type'][_0xcbbb('0x31')]};});_0xcae72c[_0xcbbb('0x32')]=_[_0xcbbb('0x33')](_0x21c560,'name');_0xcae72c[_0xcbbb('0x34')]=_[_0xcbbb('0x35')](_0xfa973b[_0xcbbb('0x34')]);_0xcae72c[_0xcbbb('0x36')]=_[_0xcbbb('0x37')](_0xcae72c[_0xcbbb('0x32')],_0xcae72c[_0xcbbb('0x34')]);_0x2a9639[_0xcbbb('0x38')]=_[_0xcbbb('0x37')](_0xcae72c[_0xcbbb('0x32')],qs['fields'](_0xfa973b['query']['fields']));_0x2a9639['attributes']=_0x2a9639[_0xcbbb('0x38')][_0xcbbb('0x39')]?_0x2a9639[_0xcbbb('0x38')]:_0xcae72c[_0xcbbb('0x32')];if(!_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3a')](_0xcbbb('0x3b'))){_0x2a9639[_0xcbbb('0x1f')]=qs[_0xcbbb('0x1f')](_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x1f')]);_0x2a9639[_0xcbbb('0x1c')]=qs['offset'](_0xfa973b['query'][_0xcbbb('0x1c')]);}_0x2a9639['order']=qs['sort'](_0xfa973b['query'][_0xcbbb('0x3c')]);_0x2a9639[_0xcbbb('0x3d')]=qs[_0xcbbb('0x36')](_[_0xcbbb('0x3e')](_0xfa973b[_0xcbbb('0x34')],_0xcae72c[_0xcbbb('0x36')]),_0x21c560);if(_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3f')]){_0x2a9639[_0xcbbb('0x3d')]=_[_0xcbbb('0x40')](_0x2a9639[_0xcbbb('0x3d')],{'$or':_['map'](_0x21c560,function(_0x21ec4b){if(_0x21ec4b['type']!==_0xcbbb('0x41')){var _0xf5b6f9={};_0xf5b6f9[_0x21ec4b[_0xcbbb('0x2b')]]={'$like':'%'+_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3f')]+'%'};return _0xf5b6f9;}})});}_0x2a9639=_[_0xcbbb('0x40')]({},_0x2a9639,_0xfa973b['options']);var _0x4d31d2={'where':_0x2a9639['where']};return db[_0xcbbb('0x2e')][_0xcbbb('0x1e')](_0x4d31d2)[_0xcbbb('0x25')](function(_0x162979){_0x117739[_0xcbbb('0x1e')]=_0x162979;if(_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x42')]){_0x2a9639['include']=[{'all':!![]}];}return db[_0xcbbb('0x2e')][_0xcbbb('0x43')](_0x2a9639);})['then'](function(_0x15b3bc){_0x117739[_0xcbbb('0x44')]=_0x15b3bc;return _0x117739;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x1ce741,_0x2a9639))[_0xcbbb('0x45')](handleError(_0x1ce741,null));};exports[_0xcbbb('0x46')]=function(_0x50adf5,_0x224682){var _0x58d5cb={'raw':!![],'where':{'id':_0x50adf5[_0xcbbb('0x47')]['id']}},_0x520448={};_0x520448[_0xcbbb('0x32')]=_[_0xcbbb('0x35')](db[_0xcbbb('0x2e')][_0xcbbb('0x2f')]);_0x520448[_0xcbbb('0x34')]=_[_0xcbbb('0x35')](_0x50adf5[_0xcbbb('0x34')]);_0x520448[_0xcbbb('0x36')]=_[_0xcbbb('0x37')](_0x520448[_0xcbbb('0x32')],_0x520448[_0xcbbb('0x34')]);_0x58d5cb[_0xcbbb('0x38')]=_[_0xcbbb('0x37')](_0x520448['model'],qs[_0xcbbb('0x48')](_0x50adf5[_0xcbbb('0x34')][_0xcbbb('0x48')]));_0x58d5cb[_0xcbbb('0x38')]=_0x58d5cb['attributes']['length']?_0x58d5cb['attributes']:_0x520448[_0xcbbb('0x32')];if(_0x50adf5[_0xcbbb('0x34')][_0xcbbb('0x42')]){_0x58d5cb[_0xcbbb('0x49')]=[{'all':!![]}];}_0x58d5cb=_[_0xcbbb('0x40')]({},_0x58d5cb,_0x50adf5[_0xcbbb('0x4a')]);return db[_0xcbbb('0x2e')]['find'](_0x58d5cb)[_0xcbbb('0x25')](handleEntityNotFound(_0x224682,null))[_0xcbbb('0x25')](respondWithResult(_0x224682,null))[_0xcbbb('0x45')](handleError(_0x224682,null));};exports[_0xcbbb('0x4b')]=function(_0x478c22,_0x3378cd){return db[_0xcbbb('0x2e')][_0xcbbb('0x4b')](_0x478c22[_0xcbbb('0x4c')],{})['then'](function(_0x5e0366){var _0x3e1fdc=_0x478c22[_0xcbbb('0x4d')][_0xcbbb('0x27')]({'plain':!![]});if(!_0x3e1fdc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e1fdc['role']==='user'){var _0x189a40=_0x5e0366[_0xcbbb('0x27')]({'plain':!![]});var _0x4b866e=_0xcbbb('0x4e');return db[_0xcbbb('0x4f')][_0xcbbb('0x50')]({'where':{'name':_0x4b866e,'userProfileId':_0x3e1fdc[_0xcbbb('0x51')]},'raw':!![]})['then'](function(_0x33d21c){if(_0x33d21c&&_0x33d21c[_0xcbbb('0x52')]===0x0){return db[_0xcbbb('0x28')][_0xcbbb('0x4b')]({'name':_0x189a40[_0xcbbb('0x2b')],'resourceId':_0x189a40['id'],'type':_0x33d21c[_0xcbbb('0x2b')],'sectionId':_0x33d21c['id']},{})[_0xcbbb('0x25')](function(){return _0x5e0366;});}else{return _0x5e0366;}})[_0xcbbb('0x45')](function(_0x2d3990){logger[_0xcbbb('0x29')](_0xcbbb('0x53'),_0x2d3990);throw _0x2d3990;});}return _0x5e0366;})['then'](respondWithResult(_0x3378cd,0xc9))['catch'](handleError(_0x3378cd,null));};exports[_0xcbbb('0x24')]=function(_0x1eb822,_0x354efc){if(_0x1eb822['body']['id']){delete _0x1eb822[_0xcbbb('0x4c')]['id'];}return db['ContactItemType'][_0xcbbb('0x50')]({'where':{'id':_0x1eb822[_0xcbbb('0x47')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x354efc,null))[_0xcbbb('0x25')](saveUpdates(_0x1eb822[_0xcbbb('0x4c')],null))[_0xcbbb('0x25')](respondWithResult(_0x354efc,null))['catch'](handleError(_0x354efc,null));};exports['destroy']=function(_0x4cc098,_0x370e6d){return db[_0xcbbb('0x2e')][_0xcbbb('0x50')]({'where':{'id':_0x4cc098[_0xcbbb('0x47')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x370e6d,null))[_0xcbbb('0x25')](db[_0xcbbb('0x54')][_0xcbbb('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4cc098[_0xcbbb('0x47')]['id']}}))[_0xcbbb('0x25')](removeEntity(_0x370e6d,null))[_0xcbbb('0x45')](handleError(_0x370e6d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 4a30bf4..637f091 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbef1=['bluebird','request-promise','path','../../config/environment','exports','define','tools_contact_item_types','util','../../config/logger','api','moment'];(function(_0x32d43c,_0x4a5e64){var _0x24eb98=function(_0x51367b){while(--_0x51367b){_0x32d43c['push'](_0x32d43c['shift']());}};_0x24eb98(++_0x4a5e64);}(_0xbef1,0xcd));var _0x1bef=function(_0x2ac8f0,_0x21d3df){_0x2ac8f0=_0x2ac8f0-0x0;var _0x4e9e93=_0xbef1[_0x2ac8f0];return _0x4e9e93;};'use strict';var _=require('lodash');var util=require(_0x1bef('0x0'));var logger=require(_0x1bef('0x1'))(_0x1bef('0x2'));var moment=require(_0x1bef('0x3'));var BPromise=require(_0x1bef('0x4'));var rp=require(_0x1bef('0x5'));var fs=require('fs');var path=require(_0x1bef('0x6'));var rimraf=require('rimraf');var config=require(_0x1bef('0x7'));var attributes=require('./contactItemType.attributes');module[_0x1bef('0x8')]=function(_0x10fc60,_0x3c256f){return _0x10fc60[_0x1bef('0x9')]('ContactItemType',attributes,{'tableName':_0x1bef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf811=['../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x29bb77,_0x481cf9){var _0x510881=function(_0xe97883){while(--_0xe97883){_0x29bb77['push'](_0x29bb77['shift']());}};_0x510881(++_0x481cf9);}(_0xf811,0xf5));var _0x1f81=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xf811[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x1f81('0x0'));var util=require('util');var logger=require(_0x1f81('0x1'))(_0x1f81('0x2'));var moment=require('moment');var BPromise=require(_0x1f81('0x3'));var rp=require(_0x1f81('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1f81('0x5'));var attributes=require(_0x1f81('0x6'));module['exports']=function(_0x4ffa02,_0x446c8e){return _0x4ffa02[_0x1f81('0x7')](_0x1f81('0x8'),attributes,{'tableName':_0x1f81('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index cc3c583..ab80b0b 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15ad=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x32f9be,_0x37b3a1){var _0x2bdebf=function(_0xab2afa){while(--_0xab2afa){_0x32f9be['push'](_0x32f9be['shift']());}};_0x2bdebf(++_0x37b3a1);}(_0x15ad,0x1c7));var _0xd15a=function(_0x594dfa,_0x5c4f3e){_0x594dfa=_0x594dfa-0x0;var _0x370c50=_0x15ad[_0x594dfa];return _0x370c50;};'use strict';var _=require(_0xd15a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd15a('0x1'));var rs=require(_0xd15a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd15a('0x3'))['db'];var utils=require(_0xd15a('0x4'));var logger=require(_0xd15a('0x5'))(_0xd15a('0x6'));var config=require(_0xd15a('0x7'));var jayson=require(_0xd15a('0x8'));var client=jayson['client'][_0xd15a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30dd3f,_0x267ba6,_0x55baf6){return new BPromise(function(_0x17c66e,_0x39a02f){return client[_0xd15a('0xa')](_0x30dd3f,_0x55baf6)['then'](function(_0x5f76ed){logger[_0xd15a('0xb')](_0xd15a('0xc'),_0x267ba6,_0xd15a('0xd'));logger[_0xd15a('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x267ba6,_0xd15a('0xd'),JSON[_0xd15a('0xf')](_0x5f76ed));if(_0x5f76ed[_0xd15a('0x10')]){if(_0x5f76ed['error'][_0xd15a('0x11')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x267ba6,_0x5f76ed['error'][_0xd15a('0x12')]);return _0x39a02f(_0x5f76ed['error'][_0xd15a('0x12')]);}logger[_0xd15a('0x10')](_0xd15a('0xc'),_0x267ba6,_0x5f76ed[_0xd15a('0x10')][_0xd15a('0x12')]);return _0x17c66e(_0x5f76ed['error'][_0xd15a('0x12')]);}else{logger[_0xd15a('0xb')]('ContactItemType,\x20%s,\x20%s',_0x267ba6,'request\x20sent');_0x17c66e(_0x5f76ed[_0xd15a('0x13')][_0xd15a('0x12')]);}})['catch'](function(_0x52b84e){logger['error']('ContactItemType,\x20%s,\x20%s',_0x267ba6,_0x52b84e);_0x39a02f(_0x52b84e);});});} \ No newline at end of file +var _0xd96e=['rpc','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xd96e,0x16e));var _0xed96=function(_0x501548,_0xba6869){_0x501548=_0x501548-0x0;var _0x919a1c=_0xd96e[_0x501548];return _0x919a1c;};'use strict';var _=require(_0xed96('0x0'));var util=require(_0xed96('0x1'));var moment=require(_0xed96('0x2'));var BPromise=require(_0xed96('0x3'));var rs=require(_0xed96('0x4'));var fs=require('fs');var Redis=require(_0xed96('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed96('0x6'));var logger=require(_0xed96('0x7'))(_0xed96('0x8'));var config=require('../../config/environment');var jayson=require(_0xed96('0x9'));var client=jayson[_0xed96('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c1d7d,_0x4f1b05,_0x5c1827){return new BPromise(function(_0x20d2d7,_0x46d6b3){return client[_0xed96('0xb')](_0x3c1d7d,_0x5c1827)[_0xed96('0xc')](function(_0x2b2fef){logger[_0xed96('0xd')](_0xed96('0xe'),_0x4f1b05,'request\x20sent');logger[_0xed96('0xf')](_0xed96('0x10'),_0x4f1b05,_0xed96('0x11'),JSON[_0xed96('0x12')](_0x2b2fef));if(_0x2b2fef[_0xed96('0x13')]){if(_0x2b2fef['error'][_0xed96('0x14')]===0x1f4){logger[_0xed96('0x13')](_0xed96('0xe'),_0x4f1b05,_0x2b2fef[_0xed96('0x13')][_0xed96('0x15')]);return _0x46d6b3(_0x2b2fef[_0xed96('0x13')]['message']);}logger[_0xed96('0x13')](_0xed96('0xe'),_0x4f1b05,_0x2b2fef['error']['message']);return _0x20d2d7(_0x2b2fef[_0xed96('0x13')]['message']);}else{logger['info'](_0xed96('0xe'),_0x4f1b05,_0xed96('0x11'));_0x20d2d7(_0x2b2fef['result']['message']);}})['catch'](function(_0x130223){logger[_0xed96('0x13')](_0xed96('0xe'),_0x4f1b05,_0x130223);_0x46d6b3(_0x130223);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index b88e61c..6275cd1 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x970e=['delete','destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x1ca993,_0x243c1e){var _0x150e5e=function(_0xaf1a3e){while(--_0xaf1a3e){_0x1ca993['push'](_0x1ca993['shift']());}};_0x150e5e(++_0x243c1e);}(_0x970e,0x1ab));var _0xe970=function(_0x2767dd,_0x3eebe8){_0x2767dd=_0x2767dd-0x0;var _0x57b867=_0x970e[_0x2767dd];return _0x57b867;};'use strict';var multer=require(_0xe970('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe970('0x1'));var router=express[_0xe970('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe970('0x3'));var interaction=require(_0xe970('0x4'));var config=require('../../config/environment');var controller=require(_0xe970('0x5'));router[_0xe970('0x6')]('/',auth[_0xe970('0x7')](),controller[_0xe970('0x8')]);router[_0xe970('0x6')]('/:id',auth[_0xe970('0x7')](),controller[_0xe970('0x9')]);router[_0xe970('0xa')]('/',auth['isAuthenticated'](),controller[_0xe970('0xb')]);router[_0xe970('0xc')](_0xe970('0xd'),auth[_0xe970('0x7')](),controller[_0xe970('0xe')]);router[_0xe970('0xf')](_0xe970('0xd'),auth[_0xe970('0x7')](),controller[_0xe970('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2e2e=['../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','post','create','put','delete','destroy','util','path','express','Router'];(function(_0xd8d0fc,_0x4379ea){var _0x47aa29=function(_0x5cf7ef){while(--_0x5cf7ef){_0xd8d0fc['push'](_0xd8d0fc['shift']());}};_0x47aa29(++_0x4379ea);}(_0x2e2e,0xea));var _0xe2e2=function(_0x1ded1b,_0x374841){_0x1ded1b=_0x1ded1b-0x0;var _0x181c9f=_0x2e2e[_0x1ded1b];return _0x181c9f;};'use strict';var multer=require('multer');var util=require(_0xe2e2('0x0'));var path=require(_0xe2e2('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2e2('0x2'));var router=express[_0xe2e2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe2e2('0x4'));var config=require(_0xe2e2('0x5'));var controller=require('./contactItemType.controller');router['get']('/',auth[_0xe2e2('0x6')](),controller[_0xe2e2('0x7')]);router['get'](_0xe2e2('0x8'),auth[_0xe2e2('0x6')](),controller['show']);router[_0xe2e2('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2e2('0xa')]);router[_0xe2e2('0xb')](_0xe2e2('0x8'),auth[_0xe2e2('0x6')](),controller['update']);router[_0xe2e2('0xc')]('/:id',auth[_0xe2e2('0x6')](),controller[_0xe2e2('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5b05577..c41e458 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x3c0d2a,_0xee3689){var _0x10a8fd=function(_0x3f2946){while(--_0x3f2946){_0x3c0d2a['push'](_0x3c0d2a['shift']());}};_0x10a8fd(++_0xee3689);}(_0x2032,0xd9));var _0x2203=function(_0x475566,_0x1d4470){_0x475566=_0x475566-0x0;var _0x3cfb51=_0x2032[_0x475566];return _0x3cfb51;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3366d79..5a74a34 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 _0x044e=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','name','index','Dashboard','rawAttributes','fieldName','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','params','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrVoiceQueues','voice','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','sort','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3f8647,_0x39c233){var _0x39d095=function(_0x367490){while(--_0x367490){_0x3f8647['push'](_0x3f8647['shift']());}};_0x39d095(++_0x39c233);}(_0x044e,0x6d));var _0xe044=function(_0x3f6d56,_0x5ef822){_0x3f6d56=_0x3f6d56-0x0;var _0x219dcd=_0x044e[_0x3f6d56];return _0x219dcd;};'use strict';var emlformat=require(_0xe044('0x0'));var rimraf=require(_0xe044('0x1'));var zipdir=require(_0xe044('0x2'));var jsonpatch=require(_0xe044('0x3'));var rp=require(_0xe044('0x4'));var moment=require(_0xe044('0x5'));var BPromise=require(_0xe044('0x6'));var Mustache=require(_0xe044('0x7'));var util=require('util');var path=require(_0xe044('0x8'));var sox=require(_0xe044('0x9'));var csv=require(_0xe044('0xa'));var ejs=require(_0xe044('0xb'));var fs=require('fs');var fs_extra=require(_0xe044('0xc'));var _=require(_0xe044('0xd'));var squel=require(_0xe044('0xe'));var crypto=require(_0xe044('0xf'));var jsforce=require(_0xe044('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe044('0x11'));var Papa=require(_0xe044('0x12'));var Redis=require(_0xe044('0x13'));var authService=require(_0xe044('0x14'));var qs=require(_0xe044('0x15'));var as=require(_0xe044('0x16'));var hardwareService=require(_0xe044('0x17'));var logger=require(_0xe044('0x18'))(_0xe044('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe044('0x1a'))['db'];config[_0xe044('0x1b')]=_[_0xe044('0x1c')](config[_0xe044('0x1b')],{'host':_0xe044('0x1d'),'port':0x18eb});var socket=require(_0xe044('0x1e'))(new Redis(config['redis']));require(_0xe044('0x1f'))[_0xe044('0x20')](socket);function respondWithStatusCode(_0x434315,_0x4bd690){_0x4bd690=_0x4bd690||0xcc;return function(_0x1d824a){if(_0x1d824a){return _0x434315[_0xe044('0x21')](_0x4bd690);}return _0x434315['status'](_0x4bd690)[_0xe044('0x22')]();};}function respondWithResult(_0x498f5b,_0x52cf8b){_0x52cf8b=_0x52cf8b||0xc8;return function(_0x25cd47){if(_0x25cd47){return _0x498f5b[_0xe044('0x23')](_0x52cf8b)[_0xe044('0x24')](_0x25cd47);}};}function respondWithFilteredResult(_0x928694,_0x547989){return function(_0x4b28ab){if(_0x4b28ab){var _0x4dc7f6=typeof _0x547989[_0xe044('0x25')]==='undefined'&&typeof _0x547989[_0xe044('0x26')]===_0xe044('0x27');var _0x47845d=_0x4b28ab[_0xe044('0x28')];var _0x560cdc=_0x4dc7f6?0x0:_0x547989[_0xe044('0x25')];var _0x259853=_0x4dc7f6?_0x4b28ab[_0xe044('0x28')]:_0x547989[_0xe044('0x25')]+_0x547989[_0xe044('0x26')];var _0x306377;if(_0x259853>=_0x47845d){_0x259853=_0x47845d;_0x306377=0xc8;}else{_0x306377=0xce;}_0x928694[_0xe044('0x23')](_0x306377);return _0x928694[_0xe044('0x29')](_0xe044('0x2a'),_0x560cdc+'-'+_0x259853+'/'+_0x47845d)[_0xe044('0x24')](_0x4b28ab);}return null;};}function patchUpdates(_0xa5210f){return function(_0x5c57f6){try{jsonpatch[_0xe044('0x2b')](_0x5c57f6,_0xa5210f,!![]);}catch(_0x41e08a){return BPromise['reject'](_0x41e08a);}return _0x5c57f6[_0xe044('0x2c')]();};}function saveUpdates(_0xb10450,_0x11bf41){return function(_0x20aaf4){if(_0x20aaf4){return _0x20aaf4[_0xe044('0x2d')](_0xb10450)[_0xe044('0x2e')](function(_0x18e6da){return _0x18e6da;});}return null;};}function removeEntity(_0x315749,_0x1ff097){return function(_0x24758b){if(_0x24758b){return _0x24758b[_0xe044('0x2f')]()['then'](function(){var _0x3e6271=_0x24758b['get']({'plain':!![]});var _0x1afbf6='CustomDashboards';return db[_0xe044('0x30')]['destroy']({'where':{'type':_0x1afbf6,'resourceId':_0x3e6271['id']}})[_0xe044('0x2e')](function(){return _0x24758b;});})['then'](function(){_0x315749[_0xe044('0x23')](0xcc)[_0xe044('0x22')]();});}};}function handleEntityNotFound(_0x469599,_0x250ae6){return function(_0x12d822){if(!_0x12d822){_0x469599[_0xe044('0x21')](0x194);}return _0x12d822;};}function handleError(_0x4e18fb,_0x16c789){_0x16c789=_0x16c789||0x1f4;return function(_0x105665){logger[_0xe044('0x31')](_0x105665['stack']);if(_0x105665['name']){delete _0x105665[_0xe044('0x32')];}_0x4e18fb[_0xe044('0x23')](_0x16c789)['send'](_0x105665);};}exports[_0xe044('0x33')]=function(_0x559752,_0x5eba71){var _0x270a08={},_0x3870da={},_0x21cd4f={'count':0x0,'rows':[]};var _0x5f499f=_['map'](db[_0xe044('0x34')][_0xe044('0x35')],function(_0x4dcfcf){return{'name':_0x4dcfcf[_0xe044('0x36')],'type':_0x4dcfcf[_0xe044('0x37')]['key']};});_0x3870da[_0xe044('0x38')]=_[_0xe044('0x39')](_0x5f499f,_0xe044('0x32'));_0x3870da['query']=_['keys'](_0x559752['query']);_0x3870da[_0xe044('0x3a')]=_[_0xe044('0x3b')](_0x3870da[_0xe044('0x38')],_0x3870da[_0xe044('0x3c')]);_0x270a08[_0xe044('0x3d')]=_[_0xe044('0x3b')](_0x3870da['model'],qs[_0xe044('0x3e')](_0x559752[_0xe044('0x3c')][_0xe044('0x3e')]));_0x270a08['attributes']=_0x270a08[_0xe044('0x3d')]['length']?_0x270a08['attributes']:_0x3870da[_0xe044('0x38')];if(!_0x559752[_0xe044('0x3c')][_0xe044('0x3f')]('nolimit')){_0x270a08[_0xe044('0x26')]=qs[_0xe044('0x26')](_0x559752['query'][_0xe044('0x26')]);_0x270a08[_0xe044('0x25')]=qs[_0xe044('0x25')](_0x559752[_0xe044('0x3c')]['offset']);}_0x270a08[_0xe044('0x40')]=qs['sort'](_0x559752[_0xe044('0x3c')]['sort']);_0x270a08[_0xe044('0x41')]=qs[_0xe044('0x3a')](_[_0xe044('0x42')](_0x559752[_0xe044('0x3c')],_0x3870da[_0xe044('0x3a')]),_0x5f499f);if(_0x559752['query'][_0xe044('0x43')]){_0x270a08[_0xe044('0x41')]=_['merge'](_0x270a08[_0xe044('0x41')],{'$or':_[_0xe044('0x39')](_0x5f499f,function(_0x5f02a5){if(_0x5f02a5['type']!==_0xe044('0x44')){var _0x182656={};_0x182656[_0x5f02a5[_0xe044('0x32')]]={'$like':'%'+_0x559752[_0xe044('0x3c')]['filter']+'%'};return _0x182656;}})});}_0x270a08=_[_0xe044('0x45')]({},_0x270a08,_0x559752['options']);var _0x4c1df1={'where':_0x270a08[_0xe044('0x41')]};return db[_0xe044('0x34')][_0xe044('0x28')](_0x4c1df1)[_0xe044('0x2e')](function(_0x4a0d76){_0x21cd4f[_0xe044('0x28')]=_0x4a0d76;if(_0x559752[_0xe044('0x3c')][_0xe044('0x46')]){_0x270a08[_0xe044('0x47')]=[{'all':!![]}];}return db[_0xe044('0x34')][_0xe044('0x48')](_0x270a08);})[_0xe044('0x2e')](function(_0x470e81){_0x21cd4f[_0xe044('0x49')]=_0x470e81;return _0x21cd4f;})[_0xe044('0x2e')](respondWithFilteredResult(_0x5eba71,_0x270a08))[_0xe044('0x4a')](handleError(_0x5eba71,null));};exports[_0xe044('0x4b')]=function(_0x33d3e7,_0xaa7263){var _0x418de9={'raw':![],'where':{'id':_0x33d3e7['params']['id']}},_0x4d6b20={};_0x4d6b20['model']=_[_0xe044('0x4c')](db['Dashboard'][_0xe044('0x35')]);_0x4d6b20['query']=_[_0xe044('0x4c')](_0x33d3e7[_0xe044('0x3c')]);_0x4d6b20[_0xe044('0x3a')]=_[_0xe044('0x3b')](_0x4d6b20[_0xe044('0x38')],_0x4d6b20[_0xe044('0x3c')]);_0x418de9[_0xe044('0x3d')]=_[_0xe044('0x3b')](_0x4d6b20[_0xe044('0x38')],qs[_0xe044('0x3e')](_0x33d3e7[_0xe044('0x3c')][_0xe044('0x3e')]));_0x418de9[_0xe044('0x3d')]=_0x418de9[_0xe044('0x3d')][_0xe044('0x4d')]?_0x418de9[_0xe044('0x3d')]:_0x4d6b20['model'];if(_0x33d3e7[_0xe044('0x3c')][_0xe044('0x46')]){_0x418de9[_0xe044('0x47')]=[{'all':!![]}];}_0x418de9=_['merge']({},_0x418de9,_0x33d3e7[_0xe044('0x4e')]);return db['Dashboard'][_0xe044('0x4f')](_0x418de9)[_0xe044('0x2e')](handleEntityNotFound(_0xaa7263,null))[_0xe044('0x2e')](respondWithResult(_0xaa7263,null))['catch'](handleError(_0xaa7263,null));};exports[_0xe044('0x50')]=function(_0x2dfad7,_0x2b4d95){return db[_0xe044('0x34')][_0xe044('0x50')](_0x2dfad7[_0xe044('0x51')],{})[_0xe044('0x2e')](function(_0x242f09){var _0x3e9eee=_0x2dfad7[_0xe044('0x52')][_0xe044('0x53')]({'plain':!![]});if(!_0x3e9eee)throw new Error(_0xe044('0x54'));if(_0x3e9eee[_0xe044('0x55')]===_0xe044('0x52')){var _0x5ad228=_0x242f09[_0xe044('0x53')]({'plain':!![]});var _0x5b4eb6=_0xe044('0x56');return db[_0xe044('0x57')][_0xe044('0x4f')]({'where':{'name':_0x5b4eb6,'userProfileId':_0x3e9eee['userProfileId']},'raw':!![]})[_0xe044('0x2e')](function(_0x4f8917){if(_0x4f8917&&_0x4f8917[_0xe044('0x58')]===0x0){return db[_0xe044('0x30')]['create']({'name':_0x5ad228['name'],'resourceId':_0x5ad228['id'],'type':_0x4f8917['name'],'sectionId':_0x4f8917['id']},{})[_0xe044('0x2e')](function(){return _0x242f09;});}else{return _0x242f09;}})['catch'](function(_0x4f1bdc){logger['error'](_0xe044('0x59'),_0x4f1bdc);throw _0x4f1bdc;});}return _0x242f09;})['then'](respondWithResult(_0x2b4d95,0xc9))[_0xe044('0x4a')](handleError(_0x2b4d95,null));};exports[_0xe044('0x5a')]=function(_0x1c8429,_0x6a31f7){var _0x5d1bc6={'where':{'id':_0x1c8429['params']['id']}},_0x2751da={};_0x2751da[_0xe044('0x38')]=_[_0xe044('0x4c')](db[_0xe044('0x34')][_0xe044('0x35')]);_0x5d1bc6[_0xe044('0x3d')]=_[_0xe044('0x3b')](_0x2751da[_0xe044('0x38')],qs[_0xe044('0x3e')](_0x1c8429[_0xe044('0x3c')][_0xe044('0x3e')]));_0x5d1bc6[_0xe044('0x3d')]=_0x5d1bc6[_0xe044('0x3d')][_0xe044('0x4d')]?_0x5d1bc6[_0xe044('0x3d')]:_0x2751da[_0xe044('0x38')];if(_0x1c8429[_0xe044('0x3c')][_0xe044('0x46')]){_0x5d1bc6['include']=[{'all':!![]}];}_0x5d1bc6=_[_0xe044('0x45')]({},_0x5d1bc6,_0x1c8429['options']);return db[_0xe044('0x34')][_0xe044('0x4f')](_0x5d1bc6)[_0xe044('0x2e')](handleEntityNotFound(_0x6a31f7,null))[_0xe044('0x2e')](function(_0x3edb07){if(_0x3edb07){var _0x53d671=_0x3edb07['get']({'plain':!![]});_0x53d671=qs['omit'](_0x53d671,['id',_0xe044('0x5b'),'updatedAt']);_0x1c8429['body']=_['omit'](_0x1c8429[_0xe044('0x51')],['id',_0xe044('0x5b'),_0xe044('0x5c')]);return db['Dashboard'][_0xe044('0x50')](_[_0xe044('0x45')](_0x53d671,_0x1c8429[_0xe044('0x51')]),{'include':_0x1c8429[_0xe044('0x3c')][_0xe044('0x46')]?[{'all':!![]}]:undefined})[_0xe044('0x2e')](function(_0x551f96){var _0x3d8917=_0x1c8429[_0xe044('0x52')][_0xe044('0x53')]({'plain':!![]});if(!_0x3d8917)throw new Error(_0xe044('0x54'));if(_0x3d8917[_0xe044('0x55')]===_0xe044('0x52')){var _0x11b21e=_0x551f96[_0xe044('0x53')]({'plain':!![]});var _0x1521a1=_0xe044('0x56');return db['UserProfileSection'][_0xe044('0x4f')]({'where':{'name':_0x1521a1,'userProfileId':_0x3d8917['userProfileId']},'raw':!![]})[_0xe044('0x2e')](function(_0x354cb4){if(_0x354cb4&&_0x354cb4[_0xe044('0x58')]===0x0){return db['UserProfileResource'][_0xe044('0x50')]({'name':_0x11b21e[_0xe044('0x32')],'resourceId':_0x11b21e['id'],'type':_0x354cb4[_0xe044('0x32')],'sectionId':_0x354cb4['id']},{})['then'](function(){return _0x551f96;});}else{return _0x551f96;}})[_0xe044('0x4a')](function(_0x3fc47c){logger[_0xe044('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fc47c);throw _0x3fc47c;});}return _0x551f96;});}})['then'](respondWithResult(_0x6a31f7,0xc9))[_0xe044('0x4a')](handleError(_0x6a31f7,null));};exports[_0xe044('0x2d')]=function(_0x115efe,_0x47e77e){if(_0x115efe['body']['id']){delete _0x115efe['body']['id'];}return db['Dashboard'][_0xe044('0x4f')]({'where':{'id':_0x115efe[_0xe044('0x5d')]['id']}})[_0xe044('0x2e')](handleEntityNotFound(_0x47e77e,null))[_0xe044('0x2e')](saveUpdates(_0x115efe[_0xe044('0x51')],null))[_0xe044('0x2e')](respondWithResult(_0x47e77e,null))[_0xe044('0x4a')](handleError(_0x47e77e,null));};exports[_0xe044('0x2f')]=function(_0x33e876,_0x204bfa){return db[_0xe044('0x34')][_0xe044('0x4f')]({'where':{'id':_0x33e876['params']['id']}})[_0xe044('0x2e')](handleEntityNotFound(_0x204bfa,null))[_0xe044('0x2e')](removeEntity(_0x204bfa,null))['catch'](handleError(_0x204bfa,null));};function widgetAttributes(_0x92cd17){try{switch(_0x92cd17[_0xe044('0x37')]){case _0xe044('0x5e'):return[{'name':_0xe044('0x5f'),'value':_0x92cd17[_0xe044('0x5f')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17['attrs'][0x0]?_0x92cd17[_0xe044('0x60')][0x0][_0xe044('0x61')]:undefined)||_0xe044('0x62')}];case _0xe044('0x63'):return[{'name':_0xe044('0x64'),'value':_0x92cd17[_0xe044('0x64')]||(_0x92cd17['attrs']&&_0x92cd17['attrs'][0x0]?_0x92cd17[_0xe044('0x60')][0x0][_0xe044('0x61')]:undefined)||''}];case _0xe044('0x65'):return[{'name':_0xe044('0x66'),'value':_0x92cd17[_0xe044('0x66')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x0]?_0x92cd17[_0xe044('0x60')][0x0][_0xe044('0x61')]:undefined)||_0xe044('0x67')},{'name':_0xe044('0x68'),'value':_0x92cd17[_0xe044('0x68')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17['attrs'][0x1]?_0x92cd17['attrs'][0x1][_0xe044('0x61')]:undefined)||_0xe044('0x69')},{'name':_0xe044('0x6a'),'value':_0x92cd17[_0xe044('0x6a')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17['attrs'][0x2]?_0x92cd17[_0xe044('0x60')][0x2][_0xe044('0x61')]:undefined)||0xc}];case'counter':return[{'name':_0xe044('0x6b'),'value':_0x92cd17[_0xe044('0x6b')]||(_0x92cd17['attrs']&&_0x92cd17[_0xe044('0x60')][0x0]?_0x92cd17[_0xe044('0x60')][0x0][_0xe044('0x61')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x92cd17['attrVoiceQueues']||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x1]?_0x92cd17[_0xe044('0x60')][0x1][_0xe044('0x61')]:undefined)||[]},{'name':_0xe044('0x6a'),'value':_0x92cd17[_0xe044('0x6a')]||(_0x92cd17['attrs']&&_0x92cd17['attrs'][0x2]?_0x92cd17[_0xe044('0x60')][0x2][_0xe044('0x61')]:undefined)||0x14},{'name':'attrChannel','value':_0x92cd17[_0xe044('0x6c')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17['attrs'][0x3]?_0x92cd17['attrs'][0x3]['value']:undefined)||'voice'},{'name':_0xe044('0x6d'),'value':_0x92cd17[_0xe044('0x6d')]||(_0x92cd17['attrs']&&_0x92cd17[_0xe044('0x60')][0x4]?_0x92cd17[_0xe044('0x60')][0x4][_0xe044('0x61')]:undefined)||''},{'name':_0xe044('0x6e'),'value':_0x92cd17[_0xe044('0x6e')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x5]?_0x92cd17[_0xe044('0x60')][0x5][_0xe044('0x61')]:undefined)||''},{'name':_0xe044('0x6f'),'value':_0x92cd17[_0xe044('0x6f')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x6]?_0x92cd17[_0xe044('0x60')][0x6][_0xe044('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x92cd17[_0xe044('0x70')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17['attrs'][0x7]?_0x92cd17[_0xe044('0x60')][0x7][_0xe044('0x61')]:undefined)||''},{'name':_0xe044('0x71'),'value':_0x92cd17[_0xe044('0x71')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x8]?_0x92cd17[_0xe044('0x60')][0x8][_0xe044('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x92cd17[_0xe044('0x72')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x9]?_0x92cd17[_0xe044('0x60')][0x9][_0xe044('0x61')]:undefined)||''}];case _0xe044('0x73'):case _0xe044('0x74'):return[{'name':_0xe044('0x75'),'value':_0x92cd17[_0xe044('0x75')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17['attrs'][0x0]?_0x92cd17[_0xe044('0x60')][0x0][_0xe044('0x61')]:undefined)||_0xe044('0x76')},{'name':_0xe044('0x77'),'value':_0x92cd17[_0xe044('0x77')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17['attrs'][0x1]?_0x92cd17[_0xe044('0x60')][0x1][_0xe044('0x61')]:undefined)||null},{'name':_0xe044('0x78'),'value':_0x92cd17[_0xe044('0x78')]||(_0x92cd17['attrs']&&_0x92cd17[_0xe044('0x60')][0x2]?_0x92cd17['attrs'][0x2]['value']:undefined)||null},{'name':_0xe044('0x79'),'value':_0x92cd17[_0xe044('0x79')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x3]?_0x92cd17[_0xe044('0x60')][0x3]['value']:undefined)||[]},{'name':_0xe044('0x6c'),'value':_0x92cd17[_0xe044('0x6c')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x4]?_0x92cd17[_0xe044('0x60')][0x4]['value']:undefined)||_0xe044('0x7a')},{'name':'attrEmailAccounts','value':_0x92cd17[_0xe044('0x6d')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x5]?_0x92cd17[_0xe044('0x60')][0x5][_0xe044('0x61')]:undefined)||''},{'name':_0xe044('0x6e'),'value':_0x92cd17[_0xe044('0x6e')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17['attrs'][0x6]?_0x92cd17[_0xe044('0x60')][0x6]['value']:undefined)||''},{'name':_0xe044('0x6f'),'value':_0x92cd17['attrSmsAccounts']||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x7]?_0x92cd17[_0xe044('0x60')][0x7][_0xe044('0x61')]:undefined)||''},{'name':_0xe044('0x70'),'value':_0x92cd17[_0xe044('0x70')]||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x8]?_0x92cd17[_0xe044('0x60')][0x8][_0xe044('0x61')]:undefined)||''},{'name':_0xe044('0x71'),'value':_0x92cd17['attrWhatsappAccounts']||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x9]?_0x92cd17[_0xe044('0x60')][0x9][_0xe044('0x61')]:undefined)||''},{'name':_0xe044('0x72'),'value':_0x92cd17[_0xe044('0x72')]||(_0x92cd17['attrs']&&_0x92cd17[_0xe044('0x60')][0xa]?_0x92cd17[_0xe044('0x60')][0xa]['value']:undefined)||''}];case _0xe044('0x7b'):return[{'name':_0xe044('0x7c'),'type':_0x92cd17['reportType']||(_0x92cd17[_0xe044('0x60')]&&_0x92cd17[_0xe044('0x60')][0x0]?_0x92cd17[_0xe044('0x60')][0x0]['type']:undefined)||null,'value':_0x92cd17[_0xe044('0x7c')]||(_0x92cd17['attrs']&&_0x92cd17[_0xe044('0x60')][0x0]?_0x92cd17[_0xe044('0x60')][0x0][_0xe044('0x61')]:undefined)||null},{'name':_0xe044('0x7d'),'value':_0x92cd17[_0xe044('0x7d')]||(_0x92cd17['attrs']&&_0x92cd17[_0xe044('0x60')][0x1]?_0x92cd17[_0xe044('0x60')][0x1][_0xe044('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x4df6bb){logger[_0xe044('0x31')](_0xe044('0x7e'),JSON[_0xe044('0x7f')](_0x4df6bb));return[];}}exports[_0xe044('0x80')]=function(_0x24c55d,_0x4a582d,_0x42a44f){if(_0x24c55d[_0xe044('0x51')]['id']){delete _0x24c55d[_0xe044('0x51')]['id'];}return db['Dashboard'][_0xe044('0x4f')]({'where':{'id':_0x24c55d[_0xe044('0x5d')]['id']}})[_0xe044('0x2e')](handleEntityNotFound(_0x4a582d,null))[_0xe044('0x2e')](function(_0x806421){if(_0x806421){_0x24c55d[_0xe044('0x51')][_0xe044('0x81')]=_0x806421['id'];_0x24c55d['body'][_0xe044('0x60')]=widgetAttributes(_0x24c55d[_0xe044('0x51')]);return db[_0xe044('0x82')][_0xe044('0x50')](_0x24c55d[_0xe044('0x51')]);}})['then'](respondWithResult(_0x4a582d,null))[_0xe044('0x4a')](handleError(_0x4a582d,null));};exports[_0xe044('0x83')]=function(_0x59b349,_0x359b26,_0x5f5c8c){var _0x33dc04={};var _0x1e665e={};var _0x1cd0af;var _0xac7e2a;return db[_0xe044('0x34')][_0xe044('0x84')]({'where':{'id':_0x59b349[_0xe044('0x5d')]['id']}})[_0xe044('0x2e')](handleEntityNotFound(_0x359b26,null))[_0xe044('0x2e')](function(_0x3a96f6){if(_0x3a96f6){_0x1cd0af=_0x3a96f6;_0x1e665e[_0xe044('0x38')]=_[_0xe044('0x4c')](db[_0xe044('0x82')]['rawAttributes']);_0x1e665e[_0xe044('0x3c')]=_[_0xe044('0x4c')](_0x59b349[_0xe044('0x3c')]);_0x1e665e[_0xe044('0x3a')]=_['intersection'](_0x1e665e[_0xe044('0x38')],_0x1e665e[_0xe044('0x3c')]);_0x33dc04[_0xe044('0x3d')]=_['intersection'](_0x1e665e['model'],qs['fields'](_0x59b349[_0xe044('0x3c')]['fields']));_0x33dc04[_0xe044('0x3d')]=_0x33dc04[_0xe044('0x3d')][_0xe044('0x4d')]?_0x33dc04[_0xe044('0x3d')]:_0x1e665e[_0xe044('0x38')];_0x33dc04[_0xe044('0x40')]=qs[_0xe044('0x85')](_0x59b349[_0xe044('0x3c')][_0xe044('0x85')]);_0x33dc04[_0xe044('0x41')]=qs[_0xe044('0x3a')](_[_0xe044('0x42')](_0x59b349[_0xe044('0x3c')],_0x1e665e[_0xe044('0x3a')]));if(_0x59b349[_0xe044('0x3c')][_0xe044('0x43')]){_0x33dc04[_0xe044('0x41')]=_[_0xe044('0x45')](_0x33dc04[_0xe044('0x41')],{'$or':_[_0xe044('0x39')](_0x33dc04['attributes'],function(_0x59f7c1){var _0x4665f6={};_0x4665f6[_0x59f7c1]={'$like':'%'+_0x59b349['query'][_0xe044('0x43')]+'%'};return _0x4665f6;})});}_0x33dc04=_[_0xe044('0x45')]({},_0x33dc04,_0x59b349[_0xe044('0x4e')]);return _0x1cd0af['getItems'](_0x33dc04);}})[_0xe044('0x2e')](function(_0x126223){if(_0x126223){_0xac7e2a=_0x126223[_0xe044('0x4d')];if(!_0x59b349['query']['hasOwnProperty'](_0xe044('0x86'))){_0x33dc04['limit']=qs['limit'](_0x59b349[_0xe044('0x3c')]['limit']);_0x33dc04[_0xe044('0x25')]=qs[_0xe044('0x25')](_0x59b349['query']['offset']);}return _0x1cd0af[_0xe044('0x83')](_0x33dc04);}})[_0xe044('0x2e')](function(_0x5c1782){if(_0x5c1782){return _0x5c1782?{'count':_0xac7e2a,'rows':_0x5c1782}:null;}})[_0xe044('0x2e')](respondWithResult(_0x359b26,null))[_0xe044('0x4a')](handleError(_0x359b26,null));}; \ No newline at end of file +var _0xeb20=['attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','update','then','destroy','get','CustomDashboards','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','Dashboard','includeAll','include','rows','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeb20,0x121));var _0x0eb2=function(_0x4ce646,_0x1a0de8){_0x4ce646=_0x4ce646-0x0;var _0x3b60c6=_0xeb20[_0x4ce646];return _0x3b60c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0eb2('0x0'));var zipdir=require(_0x0eb2('0x1'));var jsonpatch=require(_0x0eb2('0x2'));var rp=require(_0x0eb2('0x3'));var moment=require(_0x0eb2('0x4'));var BPromise=require(_0x0eb2('0x5'));var Mustache=require('mustache');var util=require(_0x0eb2('0x6'));var path=require(_0x0eb2('0x7'));var sox=require(_0x0eb2('0x8'));var csv=require(_0x0eb2('0x9'));var ejs=require(_0x0eb2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0eb2('0xb'));var squel=require(_0x0eb2('0xc'));var crypto=require(_0x0eb2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0eb2('0x9'));var querystring=require(_0x0eb2('0xe'));var Papa=require(_0x0eb2('0xf'));var Redis=require(_0x0eb2('0x10'));var authService=require(_0x0eb2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0eb2('0x12'));var hardwareService=require(_0x0eb2('0x13'));var logger=require(_0x0eb2('0x14'))(_0x0eb2('0x15'));var utils=require(_0x0eb2('0x16'));var config=require(_0x0eb2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0eb2('0x18'))['db'];config[_0x0eb2('0x19')]=_[_0x0eb2('0x1a')](config[_0x0eb2('0x19')],{'host':_0x0eb2('0x1b'),'port':0x18eb});var socket=require(_0x0eb2('0x1c'))(new Redis(config[_0x0eb2('0x19')]));require(_0x0eb2('0x1d'))[_0x0eb2('0x1e')](socket);function respondWithStatusCode(_0x142666,_0xd0e73c){_0xd0e73c=_0xd0e73c||0xcc;return function(_0x45b2b1){if(_0x45b2b1){return _0x142666[_0x0eb2('0x1f')](_0xd0e73c);}return _0x142666[_0x0eb2('0x20')](_0xd0e73c)[_0x0eb2('0x21')]();};}function respondWithResult(_0x367f67,_0x18fe7a){_0x18fe7a=_0x18fe7a||0xc8;return function(_0x4030d9){if(_0x4030d9){return _0x367f67[_0x0eb2('0x20')](_0x18fe7a)['json'](_0x4030d9);}};}function respondWithFilteredResult(_0x24f652,_0x40ce0a){return function(_0x272af5){if(_0x272af5){var _0x1520a9=typeof _0x40ce0a[_0x0eb2('0x22')]===_0x0eb2('0x23')&&typeof _0x40ce0a['limit']===_0x0eb2('0x23');var _0x393d07=_0x272af5[_0x0eb2('0x24')];var _0xcfdf7b=_0x1520a9?0x0:_0x40ce0a['offset'];var _0x49ebaa=_0x1520a9?_0x272af5[_0x0eb2('0x24')]:_0x40ce0a['offset']+_0x40ce0a['limit'];var _0x4332bb;if(_0x49ebaa>=_0x393d07){_0x49ebaa=_0x393d07;_0x4332bb=0xc8;}else{_0x4332bb=0xce;}_0x24f652[_0x0eb2('0x20')](_0x4332bb);return _0x24f652['set']('Content-Range',_0xcfdf7b+'-'+_0x49ebaa+'/'+_0x393d07)[_0x0eb2('0x25')](_0x272af5);}return null;};}function patchUpdates(_0x14ee50){return function(_0x4b18c8){try{jsonpatch[_0x0eb2('0x26')](_0x4b18c8,_0x14ee50,!![]);}catch(_0x18efb8){return BPromise[_0x0eb2('0x27')](_0x18efb8);}return _0x4b18c8[_0x0eb2('0x28')]();};}function saveUpdates(_0x3995b7,_0x2a932d){return function(_0x5f1476){if(_0x5f1476){return _0x5f1476[_0x0eb2('0x29')](_0x3995b7)[_0x0eb2('0x2a')](function(_0xcac7fe){return _0xcac7fe;});}return null;};}function removeEntity(_0x4d4419,_0x110086){return function(_0x38334d){if(_0x38334d){return _0x38334d[_0x0eb2('0x2b')]()[_0x0eb2('0x2a')](function(){var _0x14d4e2=_0x38334d[_0x0eb2('0x2c')]({'plain':!![]});var _0x4de217=_0x0eb2('0x2d');return db['UserProfileResource'][_0x0eb2('0x2b')]({'where':{'type':_0x4de217,'resourceId':_0x14d4e2['id']}})[_0x0eb2('0x2a')](function(){return _0x38334d;});})[_0x0eb2('0x2a')](function(){_0x4d4419[_0x0eb2('0x20')](0xcc)[_0x0eb2('0x21')]();});}};}function handleEntityNotFound(_0x3c7424,_0x5e8b5a){return function(_0x5610a7){if(!_0x5610a7){_0x3c7424['sendStatus'](0x194);}return _0x5610a7;};}function handleError(_0xa16663,_0xb5b164){_0xb5b164=_0xb5b164||0x1f4;return function(_0x100598){logger[_0x0eb2('0x2e')](_0x100598[_0x0eb2('0x2f')]);if(_0x100598[_0x0eb2('0x30')]){delete _0x100598[_0x0eb2('0x30')];}_0xa16663[_0x0eb2('0x20')](_0xb5b164)['send'](_0x100598);};}exports[_0x0eb2('0x31')]=function(_0x3c6459,_0x2a6d8e){var _0x52e23c={},_0x269946={},_0x5ad3c7={'count':0x0,'rows':[]};var _0x55096c=_['map'](db['Dashboard'][_0x0eb2('0x32')],function(_0x262e27){return{'name':_0x262e27[_0x0eb2('0x33')],'type':_0x262e27['type'][_0x0eb2('0x34')]};});_0x269946[_0x0eb2('0x35')]=_[_0x0eb2('0x36')](_0x55096c,_0x0eb2('0x30'));_0x269946[_0x0eb2('0x37')]=_[_0x0eb2('0x38')](_0x3c6459[_0x0eb2('0x37')]);_0x269946[_0x0eb2('0x39')]=_[_0x0eb2('0x3a')](_0x269946[_0x0eb2('0x35')],_0x269946['query']);_0x52e23c[_0x0eb2('0x3b')]=_[_0x0eb2('0x3a')](_0x269946['model'],qs[_0x0eb2('0x3c')](_0x3c6459[_0x0eb2('0x37')]['fields']));_0x52e23c[_0x0eb2('0x3b')]=_0x52e23c[_0x0eb2('0x3b')][_0x0eb2('0x3d')]?_0x52e23c[_0x0eb2('0x3b')]:_0x269946[_0x0eb2('0x35')];if(!_0x3c6459[_0x0eb2('0x37')][_0x0eb2('0x3e')]('nolimit')){_0x52e23c[_0x0eb2('0x3f')]=qs[_0x0eb2('0x3f')](_0x3c6459[_0x0eb2('0x37')][_0x0eb2('0x3f')]);_0x52e23c['offset']=qs['offset'](_0x3c6459[_0x0eb2('0x37')][_0x0eb2('0x22')]);}_0x52e23c[_0x0eb2('0x40')]=qs[_0x0eb2('0x41')](_0x3c6459[_0x0eb2('0x37')][_0x0eb2('0x41')]);_0x52e23c[_0x0eb2('0x42')]=qs[_0x0eb2('0x39')](_[_0x0eb2('0x43')](_0x3c6459[_0x0eb2('0x37')],_0x269946[_0x0eb2('0x39')]),_0x55096c);if(_0x3c6459[_0x0eb2('0x37')]['filter']){_0x52e23c[_0x0eb2('0x42')]=_['merge'](_0x52e23c['where'],{'$or':_[_0x0eb2('0x36')](_0x55096c,function(_0x317311){if(_0x317311[_0x0eb2('0x44')]!==_0x0eb2('0x45')){var _0x2cb513={};_0x2cb513[_0x317311[_0x0eb2('0x30')]]={'$like':'%'+_0x3c6459[_0x0eb2('0x37')][_0x0eb2('0x46')]+'%'};return _0x2cb513;}})});}_0x52e23c=_[_0x0eb2('0x47')]({},_0x52e23c,_0x3c6459[_0x0eb2('0x48')]);var _0x55c6cd={'where':_0x52e23c[_0x0eb2('0x42')]};return db[_0x0eb2('0x49')][_0x0eb2('0x24')](_0x55c6cd)[_0x0eb2('0x2a')](function(_0x403cef){_0x5ad3c7[_0x0eb2('0x24')]=_0x403cef;if(_0x3c6459['query'][_0x0eb2('0x4a')]){_0x52e23c[_0x0eb2('0x4b')]=[{'all':!![]}];}return db[_0x0eb2('0x49')]['findAll'](_0x52e23c);})[_0x0eb2('0x2a')](function(_0x5aa823){_0x5ad3c7[_0x0eb2('0x4c')]=_0x5aa823;return _0x5ad3c7;})[_0x0eb2('0x2a')](respondWithFilteredResult(_0x2a6d8e,_0x52e23c))['catch'](handleError(_0x2a6d8e,null));};exports['show']=function(_0x37d8b8,_0xdcf0b5){var _0x38a1b5={'raw':![],'where':{'id':_0x37d8b8['params']['id']}},_0x2037c5={};_0x2037c5[_0x0eb2('0x35')]=_[_0x0eb2('0x38')](db[_0x0eb2('0x49')][_0x0eb2('0x32')]);_0x2037c5[_0x0eb2('0x37')]=_[_0x0eb2('0x38')](_0x37d8b8[_0x0eb2('0x37')]);_0x2037c5['filters']=_['intersection'](_0x2037c5[_0x0eb2('0x35')],_0x2037c5['query']);_0x38a1b5[_0x0eb2('0x3b')]=_[_0x0eb2('0x3a')](_0x2037c5[_0x0eb2('0x35')],qs[_0x0eb2('0x3c')](_0x37d8b8['query']['fields']));_0x38a1b5['attributes']=_0x38a1b5[_0x0eb2('0x3b')][_0x0eb2('0x3d')]?_0x38a1b5[_0x0eb2('0x3b')]:_0x2037c5[_0x0eb2('0x35')];if(_0x37d8b8[_0x0eb2('0x37')][_0x0eb2('0x4a')]){_0x38a1b5['include']=[{'all':!![]}];}_0x38a1b5=_[_0x0eb2('0x47')]({},_0x38a1b5,_0x37d8b8['options']);return db[_0x0eb2('0x49')][_0x0eb2('0x4d')](_0x38a1b5)[_0x0eb2('0x2a')](handleEntityNotFound(_0xdcf0b5,null))['then'](respondWithResult(_0xdcf0b5,null))[_0x0eb2('0x4e')](handleError(_0xdcf0b5,null));};exports[_0x0eb2('0x4f')]=function(_0x4f0dad,_0x4902ab){return db['Dashboard'][_0x0eb2('0x4f')](_0x4f0dad[_0x0eb2('0x50')],{})[_0x0eb2('0x2a')](function(_0x435bab){var _0x38ca35=_0x4f0dad[_0x0eb2('0x51')][_0x0eb2('0x2c')]({'plain':!![]});if(!_0x38ca35)throw new Error(_0x0eb2('0x52'));if(_0x38ca35[_0x0eb2('0x53')]==='user'){var _0x4e1d22=_0x435bab[_0x0eb2('0x2c')]({'plain':!![]});var _0xcdfff7=_0x0eb2('0x2d');return db[_0x0eb2('0x54')][_0x0eb2('0x4d')]({'where':{'name':_0xcdfff7,'userProfileId':_0x38ca35[_0x0eb2('0x55')]},'raw':!![]})[_0x0eb2('0x2a')](function(_0x19aff0){if(_0x19aff0&&_0x19aff0[_0x0eb2('0x56')]===0x0){return db[_0x0eb2('0x57')][_0x0eb2('0x4f')]({'name':_0x4e1d22[_0x0eb2('0x30')],'resourceId':_0x4e1d22['id'],'type':_0x19aff0[_0x0eb2('0x30')],'sectionId':_0x19aff0['id']},{})[_0x0eb2('0x2a')](function(){return _0x435bab;});}else{return _0x435bab;}})['catch'](function(_0x51a308){logger[_0x0eb2('0x2e')](_0x0eb2('0x58'),_0x51a308);throw _0x51a308;});}return _0x435bab;})['then'](respondWithResult(_0x4902ab,0xc9))[_0x0eb2('0x4e')](handleError(_0x4902ab,null));};exports[_0x0eb2('0x59')]=function(_0x5e9e60,_0x5635b2){var _0x581df2={'where':{'id':_0x5e9e60[_0x0eb2('0x5a')]['id']}},_0x1c5847={};_0x1c5847[_0x0eb2('0x35')]=_[_0x0eb2('0x38')](db['Dashboard'][_0x0eb2('0x32')]);_0x581df2['attributes']=_[_0x0eb2('0x3a')](_0x1c5847[_0x0eb2('0x35')],qs[_0x0eb2('0x3c')](_0x5e9e60['query'][_0x0eb2('0x3c')]));_0x581df2[_0x0eb2('0x3b')]=_0x581df2['attributes'][_0x0eb2('0x3d')]?_0x581df2[_0x0eb2('0x3b')]:_0x1c5847[_0x0eb2('0x35')];if(_0x5e9e60[_0x0eb2('0x37')][_0x0eb2('0x4a')]){_0x581df2[_0x0eb2('0x4b')]=[{'all':!![]}];}_0x581df2=_['merge']({},_0x581df2,_0x5e9e60[_0x0eb2('0x48')]);return db[_0x0eb2('0x49')][_0x0eb2('0x4d')](_0x581df2)[_0x0eb2('0x2a')](handleEntityNotFound(_0x5635b2,null))[_0x0eb2('0x2a')](function(_0x1f1459){if(_0x1f1459){var _0x1962e4=_0x1f1459[_0x0eb2('0x2c')]({'plain':!![]});_0x1962e4=qs[_0x0eb2('0x5b')](_0x1962e4,['id','createdAt',_0x0eb2('0x5c')]);_0x5e9e60[_0x0eb2('0x50')]=_[_0x0eb2('0x5b')](_0x5e9e60[_0x0eb2('0x50')],['id',_0x0eb2('0x5d'),_0x0eb2('0x5c')]);return db['Dashboard'][_0x0eb2('0x4f')](_[_0x0eb2('0x47')](_0x1962e4,_0x5e9e60['body']),{'include':_0x5e9e60[_0x0eb2('0x37')][_0x0eb2('0x4a')]?[{'all':!![]}]:undefined})[_0x0eb2('0x2a')](function(_0x5cada1){var _0x547cfb=_0x5e9e60[_0x0eb2('0x51')]['get']({'plain':!![]});if(!_0x547cfb)throw new Error(_0x0eb2('0x52'));if(_0x547cfb[_0x0eb2('0x53')]===_0x0eb2('0x51')){var _0x14d55e=_0x5cada1[_0x0eb2('0x2c')]({'plain':!![]});var _0x5e3534=_0x0eb2('0x2d');return db[_0x0eb2('0x54')][_0x0eb2('0x4d')]({'where':{'name':_0x5e3534,'userProfileId':_0x547cfb['userProfileId']},'raw':!![]})[_0x0eb2('0x2a')](function(_0x59fcd6){if(_0x59fcd6&&_0x59fcd6[_0x0eb2('0x56')]===0x0){return db[_0x0eb2('0x57')][_0x0eb2('0x4f')]({'name':_0x14d55e[_0x0eb2('0x30')],'resourceId':_0x14d55e['id'],'type':_0x59fcd6[_0x0eb2('0x30')],'sectionId':_0x59fcd6['id']},{})['then'](function(){return _0x5cada1;});}else{return _0x5cada1;}})[_0x0eb2('0x4e')](function(_0x365747){logger[_0x0eb2('0x2e')](_0x0eb2('0x58'),_0x365747);throw _0x365747;});}return _0x5cada1;});}})['then'](respondWithResult(_0x5635b2,0xc9))[_0x0eb2('0x4e')](handleError(_0x5635b2,null));};exports[_0x0eb2('0x29')]=function(_0xe2d28e,_0x29bc3b){if(_0xe2d28e[_0x0eb2('0x50')]['id']){delete _0xe2d28e[_0x0eb2('0x50')]['id'];}return db[_0x0eb2('0x49')][_0x0eb2('0x4d')]({'where':{'id':_0xe2d28e[_0x0eb2('0x5a')]['id']}})[_0x0eb2('0x2a')](handleEntityNotFound(_0x29bc3b,null))[_0x0eb2('0x2a')](saveUpdates(_0xe2d28e[_0x0eb2('0x50')],null))['then'](respondWithResult(_0x29bc3b,null))['catch'](handleError(_0x29bc3b,null));};exports[_0x0eb2('0x2b')]=function(_0xe187be,_0x570733){return db[_0x0eb2('0x49')][_0x0eb2('0x4d')]({'where':{'id':_0xe187be[_0x0eb2('0x5a')]['id']}})[_0x0eb2('0x2a')](handleEntityNotFound(_0x570733,null))[_0x0eb2('0x2a')](removeEntity(_0x570733,null))[_0x0eb2('0x4e')](handleError(_0x570733,null));};function widgetAttributes(_0x5935cd){try{switch(_0x5935cd[_0x0eb2('0x44')]){case'iframe':return[{'name':_0x0eb2('0x5e'),'value':_0x5935cd[_0x0eb2('0x5e')]||(_0x5935cd['attrs']&&_0x5935cd[_0x0eb2('0x5f')][0x0]?_0x5935cd[_0x0eb2('0x5f')][0x0][_0x0eb2('0x60')]:undefined)||_0x0eb2('0x61')}];case _0x0eb2('0x62'):return[{'name':_0x0eb2('0x63'),'value':_0x5935cd[_0x0eb2('0x63')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x0]?_0x5935cd[_0x0eb2('0x5f')][0x0][_0x0eb2('0x60')]:undefined)||''}];case _0x0eb2('0x64'):return[{'name':_0x0eb2('0x65'),'value':_0x5935cd[_0x0eb2('0x65')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x0]?_0x5935cd['attrs'][0x0][_0x0eb2('0x60')]:undefined)||_0x0eb2('0x66')},{'name':'attrTimezone','value':_0x5935cd[_0x0eb2('0x67')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x1]?_0x5935cd[_0x0eb2('0x5f')][0x1][_0x0eb2('0x60')]:undefined)||_0x0eb2('0x68')},{'name':'attrFontSize','value':_0x5935cd[_0x0eb2('0x69')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x2]?_0x5935cd[_0x0eb2('0x5f')][0x2]['value']:undefined)||0xc}];case _0x0eb2('0x6a'):return[{'name':_0x0eb2('0x6b'),'value':_0x5935cd['attrMetric']||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd['attrs'][0x0]?_0x5935cd[_0x0eb2('0x5f')][0x0][_0x0eb2('0x60')]:undefined)||'total'},{'name':_0x0eb2('0x6c'),'value':_0x5935cd[_0x0eb2('0x6c')]||(_0x5935cd['attrs']&&_0x5935cd[_0x0eb2('0x5f')][0x1]?_0x5935cd[_0x0eb2('0x5f')][0x1]['value']:undefined)||[]},{'name':_0x0eb2('0x69'),'value':_0x5935cd[_0x0eb2('0x69')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x2]?_0x5935cd[_0x0eb2('0x5f')][0x2][_0x0eb2('0x60')]:undefined)||0x14},{'name':_0x0eb2('0x6d'),'value':_0x5935cd['attrChannel']||(_0x5935cd['attrs']&&_0x5935cd[_0x0eb2('0x5f')][0x3]?_0x5935cd['attrs'][0x3][_0x0eb2('0x60')]:undefined)||'voice'},{'name':_0x0eb2('0x6e'),'value':_0x5935cd['attrEmailAccounts']||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x4]?_0x5935cd['attrs'][0x4]['value']:undefined)||''},{'name':_0x0eb2('0x6f'),'value':_0x5935cd[_0x0eb2('0x6f')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x5]?_0x5935cd[_0x0eb2('0x5f')][0x5][_0x0eb2('0x60')]:undefined)||''},{'name':_0x0eb2('0x70'),'value':_0x5935cd[_0x0eb2('0x70')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x6]?_0x5935cd[_0x0eb2('0x5f')][0x6][_0x0eb2('0x60')]:undefined)||''},{'name':_0x0eb2('0x71'),'value':_0x5935cd['attrOpenchannelAccounts']||(_0x5935cd['attrs']&&_0x5935cd[_0x0eb2('0x5f')][0x7]?_0x5935cd[_0x0eb2('0x5f')][0x7][_0x0eb2('0x60')]:undefined)||''},{'name':_0x0eb2('0x72'),'value':_0x5935cd[_0x0eb2('0x72')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x8]?_0x5935cd[_0x0eb2('0x5f')][0x8][_0x0eb2('0x60')]:undefined)||''},{'name':_0x0eb2('0x73'),'value':_0x5935cd[_0x0eb2('0x73')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x9]?_0x5935cd['attrs'][0x9]['value']:undefined)||''}];case _0x0eb2('0x74'):case _0x0eb2('0x75'):return[{'name':_0x0eb2('0x76'),'value':_0x5935cd['attrSerie1']||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd['attrs'][0x0]?_0x5935cd['attrs'][0x0][_0x0eb2('0x60')]:undefined)||_0x0eb2('0x77')},{'name':_0x0eb2('0x78'),'value':_0x5935cd[_0x0eb2('0x78')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x1]?_0x5935cd['attrs'][0x1][_0x0eb2('0x60')]:undefined)||null},{'name':_0x0eb2('0x79'),'value':_0x5935cd['attrSerie3']||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x2]?_0x5935cd[_0x0eb2('0x5f')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5935cd[_0x0eb2('0x6c')]||(_0x5935cd['attrs']&&_0x5935cd[_0x0eb2('0x5f')][0x3]?_0x5935cd[_0x0eb2('0x5f')][0x3][_0x0eb2('0x60')]:undefined)||[]},{'name':_0x0eb2('0x6d'),'value':_0x5935cd[_0x0eb2('0x6d')]||(_0x5935cd['attrs']&&_0x5935cd['attrs'][0x4]?_0x5935cd[_0x0eb2('0x5f')][0x4][_0x0eb2('0x60')]:undefined)||_0x0eb2('0x7a')},{'name':_0x0eb2('0x6e'),'value':_0x5935cd[_0x0eb2('0x6e')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x5]?_0x5935cd[_0x0eb2('0x5f')][0x5][_0x0eb2('0x60')]:undefined)||''},{'name':_0x0eb2('0x6f'),'value':_0x5935cd[_0x0eb2('0x6f')]||(_0x5935cd['attrs']&&_0x5935cd[_0x0eb2('0x5f')][0x6]?_0x5935cd['attrs'][0x6][_0x0eb2('0x60')]:undefined)||''},{'name':_0x0eb2('0x70'),'value':_0x5935cd['attrSmsAccounts']||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x7]?_0x5935cd[_0x0eb2('0x5f')][0x7][_0x0eb2('0x60')]:undefined)||''},{'name':_0x0eb2('0x71'),'value':_0x5935cd[_0x0eb2('0x71')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x8]?_0x5935cd[_0x0eb2('0x5f')][0x8][_0x0eb2('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5935cd[_0x0eb2('0x72')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x9]?_0x5935cd[_0x0eb2('0x5f')][0x9][_0x0eb2('0x60')]:undefined)||''},{'name':_0x0eb2('0x73'),'value':_0x5935cd[_0x0eb2('0x73')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd['attrs'][0xa]?_0x5935cd[_0x0eb2('0x5f')][0xa][_0x0eb2('0x60')]:undefined)||''}];case _0x0eb2('0x7b'):return[{'name':_0x0eb2('0x7c'),'type':_0x5935cd[_0x0eb2('0x7d')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x0]?_0x5935cd[_0x0eb2('0x5f')][0x0][_0x0eb2('0x44')]:undefined)||null,'value':_0x5935cd['attrReport']||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd['attrs'][0x0]?_0x5935cd['attrs'][0x0]['value']:undefined)||null},{'name':_0x0eb2('0x7e'),'value':_0x5935cd[_0x0eb2('0x7e')]||(_0x5935cd[_0x0eb2('0x5f')]&&_0x5935cd[_0x0eb2('0x5f')][0x1]?_0x5935cd[_0x0eb2('0x5f')][0x1][_0x0eb2('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x2ca999){logger[_0x0eb2('0x2e')](_0x0eb2('0x7f'),JSON[_0x0eb2('0x80')](_0x2ca999));return[];}}exports[_0x0eb2('0x81')]=function(_0x244a9c,_0xf28ad6,_0xf938c4){if(_0x244a9c[_0x0eb2('0x50')]['id']){delete _0x244a9c[_0x0eb2('0x50')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x244a9c[_0x0eb2('0x5a')]['id']}})[_0x0eb2('0x2a')](handleEntityNotFound(_0xf28ad6,null))[_0x0eb2('0x2a')](function(_0x450471){if(_0x450471){_0x244a9c[_0x0eb2('0x50')]['DashboardId']=_0x450471['id'];_0x244a9c[_0x0eb2('0x50')]['attrs']=widgetAttributes(_0x244a9c[_0x0eb2('0x50')]);return db[_0x0eb2('0x82')]['create'](_0x244a9c[_0x0eb2('0x50')]);}})[_0x0eb2('0x2a')](respondWithResult(_0xf28ad6,null))['catch'](handleError(_0xf28ad6,null));};exports[_0x0eb2('0x83')]=function(_0x239490,_0x5bc26f,_0x5005e6){var _0x2e0778={};var _0xd3d1c1={};var _0xf41a4c;var _0x21602e;return db['Dashboard'][_0x0eb2('0x84')]({'where':{'id':_0x239490[_0x0eb2('0x5a')]['id']}})[_0x0eb2('0x2a')](handleEntityNotFound(_0x5bc26f,null))[_0x0eb2('0x2a')](function(_0x33529e){if(_0x33529e){_0xf41a4c=_0x33529e;_0xd3d1c1[_0x0eb2('0x35')]=_[_0x0eb2('0x38')](db[_0x0eb2('0x82')][_0x0eb2('0x32')]);_0xd3d1c1[_0x0eb2('0x37')]=_[_0x0eb2('0x38')](_0x239490[_0x0eb2('0x37')]);_0xd3d1c1['filters']=_['intersection'](_0xd3d1c1[_0x0eb2('0x35')],_0xd3d1c1[_0x0eb2('0x37')]);_0x2e0778[_0x0eb2('0x3b')]=_[_0x0eb2('0x3a')](_0xd3d1c1[_0x0eb2('0x35')],qs[_0x0eb2('0x3c')](_0x239490[_0x0eb2('0x37')][_0x0eb2('0x3c')]));_0x2e0778[_0x0eb2('0x3b')]=_0x2e0778[_0x0eb2('0x3b')]['length']?_0x2e0778[_0x0eb2('0x3b')]:_0xd3d1c1['model'];_0x2e0778['order']=qs[_0x0eb2('0x41')](_0x239490[_0x0eb2('0x37')][_0x0eb2('0x41')]);_0x2e0778[_0x0eb2('0x42')]=qs[_0x0eb2('0x39')](_['pick'](_0x239490[_0x0eb2('0x37')],_0xd3d1c1[_0x0eb2('0x39')]));if(_0x239490[_0x0eb2('0x37')]['filter']){_0x2e0778[_0x0eb2('0x42')]=_[_0x0eb2('0x47')](_0x2e0778['where'],{'$or':_[_0x0eb2('0x36')](_0x2e0778[_0x0eb2('0x3b')],function(_0x143b77){var _0x393b97={};_0x393b97[_0x143b77]={'$like':'%'+_0x239490[_0x0eb2('0x37')][_0x0eb2('0x46')]+'%'};return _0x393b97;})});}_0x2e0778=_[_0x0eb2('0x47')]({},_0x2e0778,_0x239490[_0x0eb2('0x48')]);return _0xf41a4c['getItems'](_0x2e0778);}})[_0x0eb2('0x2a')](function(_0x3d17d1){if(_0x3d17d1){_0x21602e=_0x3d17d1[_0x0eb2('0x3d')];if(!_0x239490[_0x0eb2('0x37')]['hasOwnProperty'](_0x0eb2('0x85'))){_0x2e0778['limit']=qs['limit'](_0x239490[_0x0eb2('0x37')][_0x0eb2('0x3f')]);_0x2e0778['offset']=qs['offset'](_0x239490[_0x0eb2('0x37')][_0x0eb2('0x22')]);}return _0xf41a4c['getItems'](_0x2e0778);}})['then'](function(_0xab738a){if(_0xab738a){return _0xab738a?{'count':_0x21602e,'rows':_0xab738a}:null;}})['then'](respondWithResult(_0x5bc26f,null))[_0x0eb2('0x4e')](handleError(_0x5bc26f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6fbd85d..3856baf 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 _0xba38=['../../mysqldb','Dashboard','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x3dd4cb,_0x6f77ab){var _0x1f7e7e=function(_0x1f4c7a){while(--_0x1f4c7a){_0x3dd4cb['push'](_0x3dd4cb['shift']());}};_0x1f7e7e(++_0x6f77ab);}(_0xba38,0x190));var _0x8ba3=function(_0x317c10,_0x4f8f0){_0x317c10=_0x317c10-0x0;var _0x2808d0=_0xba38[_0x317c10];return _0x2808d0;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x8ba3('0x0'))['db'][_0x8ba3('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8ba3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ba3('0x3'),'afterDestroy':'remove'};function emitEvent(_0x173415){return function(_0x2dce57,_0x124492,_0x105cb3){DashboardEvents[_0x8ba3('0x4')](_0x173415+':'+_0x2dce57['id'],_0x2dce57);DashboardEvents[_0x8ba3('0x4')](_0x173415,_0x2dce57);_0x105cb3(null);};}for(var e in events){if(events[_0x8ba3('0x5')](e)){var event=events[e];Dashboard[_0x8ba3('0x6')](e,emitEvent(event));}}module[_0x8ba3('0x7')]=DashboardEvents; \ No newline at end of file +var _0x8477=['hasOwnProperty','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8477,0xea));var _0x7847=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x8477[_0x32f9ca];return _0x52e083;};'use strict';var EventEmitter=require(_0x7847('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7847('0x1')](0x0);var events={'afterCreate':_0x7847('0x2'),'afterUpdate':_0x7847('0x3'),'afterDestroy':_0x7847('0x4')};function emitEvent(_0x44ac77){return function(_0x10b0f9,_0x5e0973,_0x4499df){DashboardEvents[_0x7847('0x5')](_0x44ac77+':'+_0x10b0f9['id'],_0x10b0f9);DashboardEvents[_0x7847('0x5')](_0x44ac77,_0x10b0f9);_0x4499df(null);};}for(var e in events){if(events[_0x7847('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x7847('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 41b6778..0a6950f 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 _0xd8ea=['./dashboard.attributes','define','Dashboard','dashboards','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x37f533,_0x376167){var _0xe74525=function(_0x4395a3){while(--_0x4395a3){_0x37f533['push'](_0x37f533['shift']());}};_0xe74525(++_0x376167);}(_0xd8ea,0x10c));var _0xad8e=function(_0x84f237,_0x1b7a2c){_0x84f237=_0x84f237-0x0;var _0x4105f5=_0xd8ea[_0x84f237];return _0x4105f5;};'use strict';var _=require(_0xad8e('0x0'));var util=require(_0xad8e('0x1'));var logger=require(_0xad8e('0x2'))(_0xad8e('0x3'));var moment=require('moment');var BPromise=require(_0xad8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad8e('0x5'));var rimraf=require(_0xad8e('0x6'));var config=require('../../config/environment');var attributes=require(_0xad8e('0x7'));module['exports']=function(_0x4307bf,_0x326976){return _0x4307bf[_0xad8e('0x8')](_0xad8e('0x9'),attributes,{'tableName':_0xad8e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd668=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x29dfdb,_0x2a0fc5){var _0x34ec3e=function(_0x43c8f5){while(--_0x43c8f5){_0x29dfdb['push'](_0x29dfdb['shift']());}};_0x34ec3e(++_0x2a0fc5);}(_0xd668,0x108));var _0x8d66=function(_0x139ff1,_0x57ed92){_0x139ff1=_0x139ff1-0x0;var _0xfd468a=_0xd668[_0x139ff1];return _0xfd468a;};'use strict';var _=require(_0x8d66('0x0'));var util=require(_0x8d66('0x1'));var logger=require(_0x8d66('0x2'))(_0x8d66('0x3'));var moment=require(_0x8d66('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d66('0x5'));var rimraf=require(_0x8d66('0x6'));var config=require(_0x8d66('0x7'));var attributes=require(_0x8d66('0x8'));module['exports']=function(_0x5dc979,_0x1432e3){return _0x5dc979[_0x8d66('0x9')](_0x8d66('0xa'),attributes,{'tableName':'dashboards','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 274e202..a1e1b87 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 _0x5dd6=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x44689f,_0x1fb85f){var _0x5379fd=function(_0x1957c5){while(--_0x1957c5){_0x44689f['push'](_0x44689f['shift']());}};_0x5379fd(++_0x1fb85f);}(_0x5dd6,0x1b5));var _0x65dd=function(_0x5dda91,_0x440602){_0x5dda91=_0x5dda91-0x0;var _0xc07d23=_0x5dd6[_0x5dda91];return _0xc07d23;};'use strict';var _=require(_0x65dd('0x0'));var util=require(_0x65dd('0x1'));var moment=require(_0x65dd('0x2'));var BPromise=require(_0x65dd('0x3'));var rs=require(_0x65dd('0x4'));var fs=require('fs');var Redis=require(_0x65dd('0x5'));var db=require(_0x65dd('0x6'))['db'];var utils=require(_0x65dd('0x7'));var logger=require(_0x65dd('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x65dd('0x9'));var client=jayson[_0x65dd('0xa')][_0x65dd('0xb')]({'port':0x232a});config[_0x65dd('0xc')]=_[_0x65dd('0xd')](config[_0x65dd('0xc')],{'host':_0x65dd('0xe'),'port':0x18eb});var socket=require(_0x65dd('0xf'))(new Redis(config[_0x65dd('0xc')]));require(_0x65dd('0x10'))[_0x65dd('0x11')](socket);function respondWithRpcPromise(_0x232890,_0x15778e,_0x2f1857){return new BPromise(function(_0x23433d,_0x102a53){return client[_0x65dd('0x12')](_0x232890,_0x2f1857)[_0x65dd('0x13')](function(_0x1fea24){logger[_0x65dd('0x14')](_0x65dd('0x15'),_0x15778e,'request\x20sent');logger[_0x65dd('0x16')](_0x65dd('0x17'),_0x15778e,_0x65dd('0x18'),JSON['stringify'](_0x1fea24));if(_0x1fea24[_0x65dd('0x19')]){if(_0x1fea24['error'][_0x65dd('0x1a')]===0x1f4){logger[_0x65dd('0x19')]('Dashboard,\x20%s,\x20%s',_0x15778e,_0x1fea24['error'][_0x65dd('0x1b')]);return _0x102a53(_0x1fea24[_0x65dd('0x19')][_0x65dd('0x1b')]);}logger[_0x65dd('0x19')](_0x65dd('0x15'),_0x15778e,_0x1fea24[_0x65dd('0x19')][_0x65dd('0x1b')]);return _0x23433d(_0x1fea24[_0x65dd('0x19')][_0x65dd('0x1b')]);}else{logger[_0x65dd('0x14')]('Dashboard,\x20%s,\x20%s',_0x15778e,_0x65dd('0x18'));_0x23433d(_0x1fea24[_0x65dd('0x1c')]['message']);}})['catch'](function(_0x47a7ce){logger[_0x65dd('0x19')]('Dashboard,\x20%s,\x20%s',_0x15778e,_0x47a7ce);_0x102a53(_0x47a7ce);});});} \ No newline at end of file +var _0x85a9=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x9eab92,_0xe7e818){var _0x20dd9e=function(_0x2e4f03){while(--_0x2e4f03){_0x9eab92['push'](_0x9eab92['shift']());}};_0x20dd9e(++_0xe7e818);}(_0x85a9,0x107));var _0x985a=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0x85a9[_0x4664db];return _0x5615b4;};'use strict';var _=require(_0x985a('0x0'));var util=require('util');var moment=require(_0x985a('0x1'));var BPromise=require(_0x985a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x985a('0x3'));var db=require(_0x985a('0x4'))['db'];var utils=require(_0x985a('0x5'));var logger=require(_0x985a('0x6'))('rpc');var config=require(_0x985a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x985a('0x8')][_0x985a('0x9')]({'port':0x232a});config[_0x985a('0xa')]=_[_0x985a('0xb')](config['redis'],{'host':_0x985a('0xc'),'port':0x18eb});var socket=require(_0x985a('0xd'))(new Redis(config['redis']));require(_0x985a('0xe'))[_0x985a('0xf')](socket);function respondWithRpcPromise(_0x53bfd9,_0xedf266,_0x49d5a1){return new BPromise(function(_0x21247d,_0x499cc9){return client[_0x985a('0x10')](_0x53bfd9,_0x49d5a1)['then'](function(_0x427e60){logger[_0x985a('0x11')](_0x985a('0x12'),_0xedf266,'request\x20sent');logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0xedf266,_0x985a('0x13'),JSON[_0x985a('0x14')](_0x427e60));if(_0x427e60[_0x985a('0x15')]){if(_0x427e60[_0x985a('0x15')][_0x985a('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0xedf266,_0x427e60[_0x985a('0x15')][_0x985a('0x17')]);return _0x499cc9(_0x427e60['error']['message']);}logger['error'](_0x985a('0x12'),_0xedf266,_0x427e60[_0x985a('0x15')][_0x985a('0x17')]);return _0x21247d(_0x427e60[_0x985a('0x15')]['message']);}else{logger[_0x985a('0x11')](_0x985a('0x12'),_0xedf266,_0x985a('0x13'));_0x21247d(_0x427e60[_0x985a('0x18')][_0x985a('0x17')]);}})[_0x985a('0x19')](function(_0x392a01){logger[_0x985a('0x15')](_0x985a('0x12'),_0xedf266,_0x392a01);_0x499cc9(_0x392a01);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index c9efaf0..cda85ed 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 _0x294b=['update','emit','removeListener','length','./dashboard.events','remove'];(function(_0xeae513,_0x511bc4){var _0x8ad8e9=function(_0x11c7c5){while(--_0x11c7c5){_0xeae513['push'](_0xeae513['shift']());}};_0x8ad8e9(++_0x511bc4);}(_0x294b,0x1b4));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0xb294('0x0'));var events=['save',_0xb294('0x1'),_0xb294('0x2')];function createListener(_0x4daa98,_0x5c75be){return function(_0x2f42cc){_0x5c75be[_0xb294('0x3')](_0x4daa98,_0x2f42cc);};}function removeListener(_0x1d8b6d,_0x414bc9){return function(){DashboardEvents[_0xb294('0x4')](_0x1d8b6d,_0x414bc9);};}exports['register']=function(_0x3034f4){for(var _0x3f9042=0x0,_0x1884b4=events[_0xb294('0x5')];_0x3f9042<_0x1884b4;_0x3f9042++){var _0x128656=events[_0x3f9042];var _0x1cc7b8=createListener('dashboard:'+_0x128656,_0x3034f4);DashboardEvents['on'](_0x128656,_0x1cc7b8);}}; \ No newline at end of file +var _0x3ce6=['update','emit','removeListener','register','length','./dashboard.events','save','remove'];(function(_0x22bac6,_0x37c576){var _0x4b2267=function(_0x1dcd6b){while(--_0x1dcd6b){_0x22bac6['push'](_0x22bac6['shift']());}};_0x4b2267(++_0x37c576);}(_0x3ce6,0x95));var _0x63ce=function(_0x30fd41,_0x2c4fd6){_0x30fd41=_0x30fd41-0x0;var _0xda32f5=_0x3ce6[_0x30fd41];return _0xda32f5;};'use strict';var DashboardEvents=require(_0x63ce('0x0'));var events=[_0x63ce('0x1'),_0x63ce('0x2'),_0x63ce('0x3')];function createListener(_0x26cf02,_0x33f5b5){return function(_0xddb348){_0x33f5b5[_0x63ce('0x4')](_0x26cf02,_0xddb348);};}function removeListener(_0x2a72fa,_0x12fa76){return function(){DashboardEvents[_0x63ce('0x5')](_0x2a72fa,_0x12fa76);};}exports[_0x63ce('0x6')]=function(_0x3e01b3){for(var _0x5daa27=0x0,_0x470573=events[_0x63ce('0x7')];_0x5daa27<_0x470573;_0x5daa27++){var _0x12f20d=events[_0x5daa27];var _0xbef07a=createListener('dashboard:'+_0x12f20d,_0x3e01b3);DashboardEvents['on'](_0x12f20d,_0xbef07a);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2d5289d..6a3d88d 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 _0x21b3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','clone','addItem','delete','destroy'];(function(_0x16b242,_0xadbe54){var _0x52da18=function(_0x16cbfd){while(--_0x16cbfd){_0x16b242['push'](_0x16b242['shift']());}};_0x52da18(++_0xadbe54);}(_0x21b3,0x130));var _0x321b=function(_0x1cb484,_0x110b9c){_0x1cb484=_0x1cb484-0x0;var _0x5976b1=_0x21b3[_0x1cb484];return _0x5976b1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x321b('0x0'));var express=require(_0x321b('0x1'));var router=express[_0x321b('0x2')]();var fs_extra=require(_0x321b('0x3'));var auth=require(_0x321b('0x4'));var interaction=require(_0x321b('0x5'));var config=require('../../config/environment');var controller=require(_0x321b('0x6'));router[_0x321b('0x7')]('/',auth[_0x321b('0x8')](),controller[_0x321b('0x9')]);router[_0x321b('0x7')](_0x321b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x321b('0x7')](_0x321b('0xb'),auth[_0x321b('0x8')](),controller[_0x321b('0xc')]);router[_0x321b('0xd')]('/',auth[_0x321b('0x8')](),controller[_0x321b('0xe')]);router[_0x321b('0xd')]('/:id/clone',auth[_0x321b('0x8')](),controller[_0x321b('0xf')]);router[_0x321b('0xd')](_0x321b('0xb'),auth['isAuthenticated'](),controller[_0x321b('0x10')]);router['put'](_0x321b('0xa'),auth[_0x321b('0x8')](),controller['update']);router[_0x321b('0x11')](_0x321b('0xa'),auth[_0x321b('0x8')](),controller[_0x321b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x956b=['/:id','show','/:id/items','getItems','post','create','clone','addItem','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./dashboard.controller','get','isAuthenticated'];(function(_0x56ba00,_0x47b89a){var _0x2c837d=function(_0x3fa4bc){while(--_0x3fa4bc){_0x56ba00['push'](_0x56ba00['shift']());}};_0x2c837d(++_0x47b89a);}(_0x956b,0x174));var _0xb956=function(_0x5e64ee,_0x227a55){_0x5e64ee=_0x5e64ee-0x0;var _0xae8fa2=_0x956b[_0x5e64ee];return _0xae8fa2;};'use strict';var multer=require('multer');var util=require(_0xb956('0x0'));var path=require(_0xb956('0x1'));var timeout=require(_0xb956('0x2'));var express=require('express');var router=express[_0xb956('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb956('0x4'));var config=require('../../config/environment');var controller=require(_0xb956('0x5'));router[_0xb956('0x6')]('/',auth[_0xb956('0x7')](),controller['index']);router['get'](_0xb956('0x8'),auth[_0xb956('0x7')](),controller[_0xb956('0x9')]);router[_0xb956('0x6')](_0xb956('0xa'),auth[_0xb956('0x7')](),controller[_0xb956('0xb')]);router[_0xb956('0xc')]('/',auth[_0xb956('0x7')](),controller[_0xb956('0xd')]);router['post']('/:id/clone',auth[_0xb956('0x7')](),controller[_0xb956('0xe')]);router[_0xb956('0xc')]('/:id/items',auth['isAuthenticated'](),controller[_0xb956('0xf')]);router[_0xb956('0x10')](_0xb956('0x8'),auth[_0xb956('0x7')](),controller['update']);router[_0xb956('0x11')]('/:id',auth[_0xb956('0x7')](),controller[_0xb956('0x12')]);module[_0xb956('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index f5fe57f..401cc97 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 _0xe3da=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize'];(function(_0x458380,_0x2c700d){var _0x13062a=function(_0x4f0d13){while(--_0x4f0d13){_0x458380['push'](_0x458380['shift']());}};_0x13062a(++_0x2c700d);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xae3d('0x0'));var squel=require(_0xae3d('0x1'));var _=require(_0xae3d('0x2'));module[_0xae3d('0x3')]={'title':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xae3d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xae3d('0x5')](_0xae3d('0x6')),'get':function(){try{return JSON[_0xae3d('0x7')](this[_0xae3d('0x8')](_0xae3d('0x9')));}catch(_0x26282d){return[];}},'set':function(_0xa9a1a){try{this[_0xae3d('0xa')](_0xae3d('0x9'),JSON[_0xae3d('0xb')](_0xa9a1a));}catch(_0x583b98){this[_0xae3d('0xa')](_0xae3d('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xae3d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xae3d('0xc')]},'col':{'type':Sequelize[_0xae3d('0xc')]},'background':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':_0xae3d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xae3d('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5d58=['attrs','stringify','INTEGER','#2196f3','STRING','TEXT','parse','getDataValue','setDataValue'];(function(_0x2d42d4,_0x536806){var _0x33c8db=function(_0x1c6a41){while(--_0x1c6a41){_0x2d42d4['push'](_0x2d42d4['shift']());}};_0x33c8db(++_0x536806);}(_0x5d58,0x187));var _0x85d5=function(_0x5db111,_0x183a1a){_0x5db111=_0x5db111-0x0;var _0x4e78ae=_0x5d58[_0x5db111];return _0x4e78ae;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x85d5('0x0')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x85d5('0x1')]('long'),'get':function(){try{return JSON[_0x85d5('0x2')](this[_0x85d5('0x3')]('attrs'));}catch(_0x1eb211){return[];}},'set':function(_0x2d457a){try{this[_0x85d5('0x4')](_0x85d5('0x5'),JSON['stringify'](_0x2d457a));}catch(_0x98c963){this[_0x85d5('0x4')]('attrs',JSON[_0x85d5('0x6')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x85d5('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x85d5('0x7')]},'col':{'type':Sequelize[_0x85d5('0x7')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x85d5('0x8'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x85d5('0x0')]},'titleFontSize':{'type':Sequelize[_0x85d5('0x7')],'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 e7c14d2..0971076 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 _0xf966=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','include','merge','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrRefresh','stringify','create','body','find'];(function(_0x5906cc,_0x266e36){var _0x4861aa=function(_0x44e383){while(--_0x44e383){_0x5906cc['push'](_0x5906cc['shift']());}};_0x4861aa(++_0x266e36);}(_0xf966,0x184));var _0x6f96=function(_0x2bbe98,_0x5e9211){_0x2bbe98=_0x2bbe98-0x0;var _0xd24578=_0xf966[_0x2bbe98];return _0xd24578;};'use strict';var emlformat=require(_0x6f96('0x0'));var rimraf=require(_0x6f96('0x1'));var zipdir=require(_0x6f96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f96('0x3'));var moment=require(_0x6f96('0x4'));var BPromise=require(_0x6f96('0x5'));var Mustache=require('mustache');var util=require(_0x6f96('0x6'));var path=require(_0x6f96('0x7'));var sox=require(_0x6f96('0x8'));var csv=require('to-csv');var ejs=require(_0x6f96('0x9'));var fs=require('fs');var fs_extra=require(_0x6f96('0xa'));var _=require(_0x6f96('0xb'));var squel=require(_0x6f96('0xc'));var crypto=require(_0x6f96('0xd'));var jsforce=require(_0x6f96('0xe'));var deskjs=require(_0x6f96('0xf'));var toCsv=require(_0x6f96('0x10'));var querystring=require(_0x6f96('0x11'));var Papa=require(_0x6f96('0x12'));var Redis=require(_0x6f96('0x13'));var authService=require(_0x6f96('0x14'));var qs=require(_0x6f96('0x15'));var as=require(_0x6f96('0x16'));var hardwareService=require(_0x6f96('0x17'));var logger=require('../../config/logger')(_0x6f96('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f96('0x19'));var db=require(_0x6f96('0x1a'))['db'];config['redis']=_[_0x6f96('0x1b')](config[_0x6f96('0x1c')],{'host':_0x6f96('0x1d'),'port':0x18eb});var socket=require(_0x6f96('0x1e'))(new Redis(config[_0x6f96('0x1c')]));require(_0x6f96('0x1f'))[_0x6f96('0x20')](socket);function respondWithStatusCode(_0x1e2467,_0x5cbacc){_0x5cbacc=_0x5cbacc||0xcc;return function(_0x3f8eb1){if(_0x3f8eb1){return _0x1e2467[_0x6f96('0x21')](_0x5cbacc);}return _0x1e2467['status'](_0x5cbacc)[_0x6f96('0x22')]();};}function respondWithResult(_0x2cd321,_0x55346c){_0x55346c=_0x55346c||0xc8;return function(_0x58c7aa){if(_0x58c7aa){return _0x2cd321[_0x6f96('0x23')](_0x55346c)[_0x6f96('0x24')](_0x58c7aa);}};}function respondWithFilteredResult(_0x130de4,_0x54881a){return function(_0x421e59){if(_0x421e59){var _0x48c4d5=typeof _0x54881a[_0x6f96('0x25')]===_0x6f96('0x26')&&typeof _0x54881a['limit']==='undefined';var _0x75c2db=_0x421e59[_0x6f96('0x27')];var _0x593f91=_0x48c4d5?0x0:_0x54881a[_0x6f96('0x25')];var _0x543b83=_0x48c4d5?_0x421e59[_0x6f96('0x27')]:_0x54881a[_0x6f96('0x25')]+_0x54881a[_0x6f96('0x28')];var _0x2515ca;if(_0x543b83>=_0x75c2db){_0x543b83=_0x75c2db;_0x2515ca=0xc8;}else{_0x2515ca=0xce;}_0x130de4[_0x6f96('0x23')](_0x2515ca);return _0x130de4['set'](_0x6f96('0x29'),_0x593f91+'-'+_0x543b83+'/'+_0x75c2db)['json'](_0x421e59);}return null;};}function patchUpdates(_0x46d79b){return function(_0x2b7508){try{jsonpatch['apply'](_0x2b7508,_0x46d79b,!![]);}catch(_0xa12c3b){return BPromise['reject'](_0xa12c3b);}return _0x2b7508[_0x6f96('0x2a')]();};}function saveUpdates(_0x45c1c2,_0x542388){return function(_0x2607b9){if(_0x2607b9){return _0x2607b9[_0x6f96('0x2b')](_0x45c1c2)[_0x6f96('0x2c')](function(_0x475ee9){return _0x475ee9;});}return null;};}function removeEntity(_0xc91322,_0x3a5f09){return function(_0x4f33e7){if(_0x4f33e7){return _0x4f33e7[_0x6f96('0x2d')]()[_0x6f96('0x2c')](function(){_0xc91322[_0x6f96('0x23')](0xcc)[_0x6f96('0x22')]();});}};}function handleEntityNotFound(_0x1c20aa,_0x10c8f9){return function(_0x490c5b){if(!_0x490c5b){_0x1c20aa['sendStatus'](0x194);}return _0x490c5b;};}function handleError(_0x5dd185,_0xe1c8ed){_0xe1c8ed=_0xe1c8ed||0x1f4;return function(_0x105796){logger[_0x6f96('0x2e')](_0x105796['stack']);if(_0x105796[_0x6f96('0x2f')]){delete _0x105796[_0x6f96('0x2f')];}_0x5dd185[_0x6f96('0x23')](_0xe1c8ed)[_0x6f96('0x30')](_0x105796);};}exports[_0x6f96('0x31')]=function(_0x566cb1,_0x38dbba){var _0xa25290={'raw':![],'where':{'id':_0x566cb1[_0x6f96('0x32')]['id']}},_0x5b9284={};_0x5b9284[_0x6f96('0x33')]=_[_0x6f96('0x34')](db[_0x6f96('0x35')][_0x6f96('0x36')]);_0x5b9284[_0x6f96('0x37')]=_[_0x6f96('0x34')](_0x566cb1[_0x6f96('0x37')]);_0x5b9284['filters']=_[_0x6f96('0x38')](_0x5b9284[_0x6f96('0x33')],_0x5b9284[_0x6f96('0x37')]);_0xa25290[_0x6f96('0x39')]=_[_0x6f96('0x38')](_0x5b9284[_0x6f96('0x33')],qs['fields'](_0x566cb1[_0x6f96('0x37')][_0x6f96('0x3a')]));_0xa25290[_0x6f96('0x39')]=_0xa25290[_0x6f96('0x39')][_0x6f96('0x3b')]?_0xa25290[_0x6f96('0x39')]:_0x5b9284['model'];if(_0x566cb1[_0x6f96('0x37')]['includeAll']){_0xa25290[_0x6f96('0x3c')]=[{'all':!![]}];}_0xa25290=_[_0x6f96('0x3d')]({},_0xa25290,_0x566cb1['options']);return db[_0x6f96('0x35')]['find'](_0xa25290)[_0x6f96('0x2c')](handleEntityNotFound(_0x38dbba,null))[_0x6f96('0x2c')](respondWithResult(_0x38dbba,null))[_0x6f96('0x3e')](handleError(_0x38dbba,null));};exports[_0x6f96('0x2d')]=function(_0x285539,_0x3352e9){return db['DashboardItem']['find']({'where':{'id':_0x285539[_0x6f96('0x32')]['id']}})['then'](handleEntityNotFound(_0x3352e9,null))[_0x6f96('0x2c')](removeEntity(_0x3352e9,null))['catch'](handleError(_0x3352e9,null));};function widgetAttributes(_0x3e0b67){try{switch(_0x3e0b67[_0x6f96('0x3f')]){case _0x6f96('0x40'):return[{'name':_0x6f96('0x41'),'value':_0x3e0b67[_0x6f96('0x41')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67['attrs'][0x0]?_0x3e0b67[_0x6f96('0x42')][0x0][_0x6f96('0x43')]:undefined)||_0x6f96('0x44')}];case _0x6f96('0x45'):return[{'name':'attrPath','value':_0x3e0b67[_0x6f96('0x46')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x0]?_0x3e0b67[_0x6f96('0x42')][0x0][_0x6f96('0x43')]:undefined)||''}];case _0x6f96('0x47'):return[{'name':_0x6f96('0x48'),'value':_0x3e0b67[_0x6f96('0x48')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x0]?_0x3e0b67[_0x6f96('0x42')][0x0][_0x6f96('0x43')]:undefined)||_0x6f96('0x49')},{'name':_0x6f96('0x4a'),'value':_0x3e0b67[_0x6f96('0x4a')]||(_0x3e0b67['attrs']&&_0x3e0b67[_0x6f96('0x42')][0x1]?_0x3e0b67['attrs'][0x1]['value']:undefined)||_0x6f96('0x4b')},{'name':_0x6f96('0x4c'),'value':_0x3e0b67[_0x6f96('0x4c')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x2]?_0x3e0b67['attrs'][0x2][_0x6f96('0x43')]:undefined)||0xc}];case _0x6f96('0x4d'):return[{'name':_0x6f96('0x4e'),'value':_0x3e0b67[_0x6f96('0x4e')]||(_0x3e0b67['attrs']&&_0x3e0b67[_0x6f96('0x42')][0x0]?_0x3e0b67[_0x6f96('0x42')][0x0][_0x6f96('0x43')]:undefined)||_0x6f96('0x4f')},{'name':'attrVoiceQueues','value':_0x3e0b67[_0x6f96('0x50')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x1]?_0x3e0b67[_0x6f96('0x42')][0x1][_0x6f96('0x43')]:undefined)||[]},{'name':_0x6f96('0x4c'),'value':_0x3e0b67[_0x6f96('0x4c')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67['attrs'][0x2]?_0x3e0b67['attrs'][0x2][_0x6f96('0x43')]:undefined)||0x14},{'name':_0x6f96('0x51'),'value':_0x3e0b67[_0x6f96('0x51')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x3]?_0x3e0b67['attrs'][0x3][_0x6f96('0x43')]:undefined)||_0x6f96('0x52')},{'name':_0x6f96('0x53'),'value':_0x3e0b67[_0x6f96('0x53')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x4]?_0x3e0b67[_0x6f96('0x42')][0x4][_0x6f96('0x43')]:undefined)||''},{'name':_0x6f96('0x54'),'value':_0x3e0b67[_0x6f96('0x54')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x5]?_0x3e0b67[_0x6f96('0x42')][0x5][_0x6f96('0x43')]:undefined)||''},{'name':_0x6f96('0x55'),'value':_0x3e0b67[_0x6f96('0x55')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x6]?_0x3e0b67['attrs'][0x6][_0x6f96('0x43')]:undefined)||''},{'name':_0x6f96('0x56'),'value':_0x3e0b67['attrOpenchannelAccounts']||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x7]?_0x3e0b67[_0x6f96('0x42')][0x7]['value']:undefined)||''},{'name':_0x6f96('0x57'),'value':_0x3e0b67[_0x6f96('0x57')]||(_0x3e0b67['attrs']&&_0x3e0b67[_0x6f96('0x42')][0x8]?_0x3e0b67['attrs'][0x8]['value']:undefined)||''},{'name':_0x6f96('0x58'),'value':_0x3e0b67[_0x6f96('0x58')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x9]?_0x3e0b67[_0x6f96('0x42')][0x9][_0x6f96('0x43')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x6f96('0x59'),'value':_0x3e0b67[_0x6f96('0x59')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x0]?_0x3e0b67[_0x6f96('0x42')][0x0][_0x6f96('0x43')]:undefined)||'total'},{'name':_0x6f96('0x5a'),'value':_0x3e0b67['attrSerie2']||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x1]?_0x3e0b67[_0x6f96('0x42')][0x1][_0x6f96('0x43')]:undefined)||null},{'name':_0x6f96('0x5b'),'value':_0x3e0b67[_0x6f96('0x5b')]||(_0x3e0b67['attrs']&&_0x3e0b67[_0x6f96('0x42')][0x2]?_0x3e0b67['attrs'][0x2][_0x6f96('0x43')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3e0b67['attrVoiceQueues']||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x3]?_0x3e0b67[_0x6f96('0x42')][0x3][_0x6f96('0x43')]:undefined)||[]},{'name':'attrChannel','value':_0x3e0b67[_0x6f96('0x51')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x4]?_0x3e0b67['attrs'][0x4][_0x6f96('0x43')]:undefined)||_0x6f96('0x52')},{'name':_0x6f96('0x53'),'value':_0x3e0b67[_0x6f96('0x53')]||(_0x3e0b67['attrs']&&_0x3e0b67['attrs'][0x5]?_0x3e0b67['attrs'][0x5][_0x6f96('0x43')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3e0b67['attrFaxAccounts']||(_0x3e0b67['attrs']&&_0x3e0b67[_0x6f96('0x42')][0x6]?_0x3e0b67['attrs'][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x3e0b67[_0x6f96('0x55')]||(_0x3e0b67['attrs']&&_0x3e0b67[_0x6f96('0x42')][0x7]?_0x3e0b67[_0x6f96('0x42')][0x7][_0x6f96('0x43')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3e0b67['attrOpenchannelAccounts']||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x8]?_0x3e0b67[_0x6f96('0x42')][0x8][_0x6f96('0x43')]:undefined)||''},{'name':_0x6f96('0x57'),'value':_0x3e0b67['attrWhatsappAccounts']||(_0x3e0b67['attrs']&&_0x3e0b67[_0x6f96('0x42')][0x9]?_0x3e0b67[_0x6f96('0x42')][0x9][_0x6f96('0x43')]:undefined)||''},{'name':_0x6f96('0x58'),'value':_0x3e0b67[_0x6f96('0x58')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0xa]?_0x3e0b67['attrs'][0xa][_0x6f96('0x43')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x3e0b67['reportType']||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x0]?_0x3e0b67[_0x6f96('0x42')][0x0][_0x6f96('0x3f')]:undefined)||null,'value':_0x3e0b67['attrReport']||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67['attrs'][0x0]?_0x3e0b67[_0x6f96('0x42')][0x0][_0x6f96('0x43')]:undefined)||null},{'name':'attrRefresh','value':_0x3e0b67[_0x6f96('0x5c')]||(_0x3e0b67[_0x6f96('0x42')]&&_0x3e0b67[_0x6f96('0x42')][0x1]?_0x3e0b67[_0x6f96('0x42')][0x1][_0x6f96('0x43')]:undefined)||0x0}];default:return[];}}catch(_0xd52d2a){logger[_0x6f96('0x2e')]('widgetAttributes:\x20%s',JSON[_0x6f96('0x5d')](_0xd52d2a));return[];}}exports[_0x6f96('0x5e')]=function(_0x404ef9,_0x25917b){if(_0x404ef9[_0x6f96('0x5f')]){_0x404ef9[_0x6f96('0x5f')][_0x6f96('0x42')]=widgetAttributes(_0x404ef9['body']);}return db['DashboardItem'][_0x6f96('0x5e')](_0x404ef9[_0x6f96('0x5f')],{})[_0x6f96('0x2c')](respondWithResult(_0x25917b,0xc9))['catch'](handleError(_0x25917b,null));};exports[_0x6f96('0x2b')]=function(_0x1e9841,_0x347ee6){if(_0x1e9841[_0x6f96('0x5f')]['id']){delete _0x1e9841['body']['id'];}_0x1e9841[_0x6f96('0x5f')][_0x6f96('0x42')]=widgetAttributes(_0x1e9841[_0x6f96('0x5f')]);return db[_0x6f96('0x35')][_0x6f96('0x60')]({'where':{'id':_0x1e9841[_0x6f96('0x32')]['id']}})['then'](handleEntityNotFound(_0x347ee6,null))[_0x6f96('0x2c')](saveUpdates(_0x1e9841['body'],null))[_0x6f96('0x2c')](respondWithResult(_0x347ee6,null))[_0x6f96('0x3e')](handleError(_0x347ee6,null));}; \ No newline at end of file +var _0x304b=['then','error','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','DashboardItem','find','catch','destroy','attrUrl','attrs','value','https://','custom','attrPath','clock','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','apply'];(function(_0x564f9d,_0x119788){var _0x33859a=function(_0x3aeff1){while(--_0x3aeff1){_0x564f9d['push'](_0x564f9d['shift']());}};_0x33859a(++_0x119788);}(_0x304b,0xfb));var _0xb304=function(_0x1cc4c7,_0x21b48b){_0x1cc4c7=_0x1cc4c7-0x0;var _0x46b3c8=_0x304b[_0x1cc4c7];return _0x46b3c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb304('0x0'));var zipdir=require(_0xb304('0x1'));var jsonpatch=require(_0xb304('0x2'));var rp=require(_0xb304('0x3'));var moment=require(_0xb304('0x4'));var BPromise=require(_0xb304('0x5'));var Mustache=require(_0xb304('0x6'));var util=require(_0xb304('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb304('0x8'));var ejs=require(_0xb304('0x9'));var fs=require('fs');var fs_extra=require(_0xb304('0xa'));var _=require(_0xb304('0xb'));var squel=require(_0xb304('0xc'));var crypto=require(_0xb304('0xd'));var jsforce=require(_0xb304('0xe'));var deskjs=require(_0xb304('0xf'));var toCsv=require(_0xb304('0x8'));var querystring=require('querystring');var Papa=require(_0xb304('0x10'));var Redis=require(_0xb304('0x11'));var authService=require(_0xb304('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb304('0x13'));var hardwareService=require(_0xb304('0x14'));var logger=require(_0xb304('0x15'))(_0xb304('0x16'));var utils=require(_0xb304('0x17'));var config=require(_0xb304('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb304('0x19'))['db'];config[_0xb304('0x1a')]=_[_0xb304('0x1b')](config[_0xb304('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb304('0x1c'))(new Redis(config[_0xb304('0x1a')]));require(_0xb304('0x1d'))[_0xb304('0x1e')](socket);function respondWithStatusCode(_0x1ba608,_0x40e646){_0x40e646=_0x40e646||0xcc;return function(_0x116b86){if(_0x116b86){return _0x1ba608[_0xb304('0x1f')](_0x40e646);}return _0x1ba608[_0xb304('0x20')](_0x40e646)[_0xb304('0x21')]();};}function respondWithResult(_0x3d20b5,_0x3be8cb){_0x3be8cb=_0x3be8cb||0xc8;return function(_0x1252cb){if(_0x1252cb){return _0x3d20b5['status'](_0x3be8cb)[_0xb304('0x22')](_0x1252cb);}};}function respondWithFilteredResult(_0x5166c5,_0x522fca){return function(_0x79ca93){if(_0x79ca93){var _0x197bc7=typeof _0x522fca[_0xb304('0x23')]===_0xb304('0x24')&&typeof _0x522fca[_0xb304('0x25')]==='undefined';var _0x272b37=_0x79ca93['count'];var _0x4318b3=_0x197bc7?0x0:_0x522fca[_0xb304('0x23')];var _0x482850=_0x197bc7?_0x79ca93['count']:_0x522fca['offset']+_0x522fca[_0xb304('0x25')];var _0x1dab9e;if(_0x482850>=_0x272b37){_0x482850=_0x272b37;_0x1dab9e=0xc8;}else{_0x1dab9e=0xce;}_0x5166c5[_0xb304('0x20')](_0x1dab9e);return _0x5166c5[_0xb304('0x26')]('Content-Range',_0x4318b3+'-'+_0x482850+'/'+_0x272b37)[_0xb304('0x22')](_0x79ca93);}return null;};}function patchUpdates(_0x3694c4){return function(_0x3f5226){try{jsonpatch[_0xb304('0x27')](_0x3f5226,_0x3694c4,!![]);}catch(_0x4f10ab){return BPromise['reject'](_0x4f10ab);}return _0x3f5226['save']();};}function saveUpdates(_0x2fd41b,_0x4a16eb){return function(_0x40c7d7){if(_0x40c7d7){return _0x40c7d7['update'](_0x2fd41b)[_0xb304('0x28')](function(_0x148f48){return _0x148f48;});}return null;};}function removeEntity(_0x2b5271,_0x4de541){return function(_0x13b9fa){if(_0x13b9fa){return _0x13b9fa['destroy']()[_0xb304('0x28')](function(){_0x2b5271['status'](0xcc)[_0xb304('0x21')]();});}};}function handleEntityNotFound(_0x2e3d0d,_0x58971a){return function(_0x57d706){if(!_0x57d706){_0x2e3d0d[_0xb304('0x1f')](0x194);}return _0x57d706;};}function handleError(_0x25e77b,_0x2af69a){_0x2af69a=_0x2af69a||0x1f4;return function(_0xdfe560){logger[_0xb304('0x29')](_0xdfe560[_0xb304('0x2a')]);if(_0xdfe560[_0xb304('0x2b')]){delete _0xdfe560[_0xb304('0x2b')];}_0x25e77b[_0xb304('0x20')](_0x2af69a)[_0xb304('0x2c')](_0xdfe560);};}exports['show']=function(_0x2d6b13,_0xeba658){var _0x530c78={'raw':![],'where':{'id':_0x2d6b13[_0xb304('0x2d')]['id']}},_0x4d7241={};_0x4d7241[_0xb304('0x2e')]=_[_0xb304('0x2f')](db['DashboardItem'][_0xb304('0x30')]);_0x4d7241[_0xb304('0x31')]=_['keys'](_0x2d6b13[_0xb304('0x31')]);_0x4d7241[_0xb304('0x32')]=_[_0xb304('0x33')](_0x4d7241[_0xb304('0x2e')],_0x4d7241[_0xb304('0x31')]);_0x530c78['attributes']=_[_0xb304('0x33')](_0x4d7241[_0xb304('0x2e')],qs[_0xb304('0x34')](_0x2d6b13[_0xb304('0x31')][_0xb304('0x34')]));_0x530c78[_0xb304('0x35')]=_0x530c78[_0xb304('0x35')][_0xb304('0x36')]?_0x530c78[_0xb304('0x35')]:_0x4d7241[_0xb304('0x2e')];if(_0x2d6b13[_0xb304('0x31')][_0xb304('0x37')]){_0x530c78[_0xb304('0x38')]=[{'all':!![]}];}_0x530c78=_[_0xb304('0x39')]({},_0x530c78,_0x2d6b13[_0xb304('0x3a')]);return db[_0xb304('0x3b')][_0xb304('0x3c')](_0x530c78)[_0xb304('0x28')](handleEntityNotFound(_0xeba658,null))['then'](respondWithResult(_0xeba658,null))[_0xb304('0x3d')](handleError(_0xeba658,null));};exports[_0xb304('0x3e')]=function(_0x48715b,_0x3c81ec){return db['DashboardItem'][_0xb304('0x3c')]({'where':{'id':_0x48715b[_0xb304('0x2d')]['id']}})[_0xb304('0x28')](handleEntityNotFound(_0x3c81ec,null))[_0xb304('0x28')](removeEntity(_0x3c81ec,null))['catch'](handleError(_0x3c81ec,null));};function widgetAttributes(_0x2757a9){try{switch(_0x2757a9['type']){case'iframe':return[{'name':_0xb304('0x3f'),'value':_0x2757a9[_0xb304('0x3f')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9['attrs'][0x0]?_0x2757a9['attrs'][0x0][_0xb304('0x41')]:undefined)||_0xb304('0x42')}];case _0xb304('0x43'):return[{'name':_0xb304('0x44'),'value':_0x2757a9[_0xb304('0x44')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9['attrs'][0x0]?_0x2757a9[_0xb304('0x40')][0x0][_0xb304('0x41')]:undefined)||''}];case _0xb304('0x45'):return[{'name':'attrHourFormat','value':_0x2757a9['attrHourFormat']||(_0x2757a9['attrs']&&_0x2757a9['attrs'][0x0]?_0x2757a9[_0xb304('0x40')][0x0][_0xb304('0x41')]:undefined)||'HH:mm:ss'},{'name':_0xb304('0x46'),'value':_0x2757a9[_0xb304('0x46')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x1]?_0x2757a9[_0xb304('0x40')][0x1][_0xb304('0x41')]:undefined)||_0xb304('0x47')},{'name':_0xb304('0x48'),'value':_0x2757a9[_0xb304('0x48')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x2]?_0x2757a9[_0xb304('0x40')][0x2][_0xb304('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0xb304('0x49'),'value':_0x2757a9[_0xb304('0x49')]||(_0x2757a9['attrs']&&_0x2757a9[_0xb304('0x40')][0x0]?_0x2757a9['attrs'][0x0]['value']:undefined)||_0xb304('0x4a')},{'name':'attrVoiceQueues','value':_0x2757a9[_0xb304('0x4b')]||(_0x2757a9['attrs']&&_0x2757a9[_0xb304('0x40')][0x1]?_0x2757a9[_0xb304('0x40')][0x1][_0xb304('0x41')]:undefined)||[]},{'name':_0xb304('0x48'),'value':_0x2757a9['attrFontSize']||(_0x2757a9['attrs']&&_0x2757a9[_0xb304('0x40')][0x2]?_0x2757a9[_0xb304('0x40')][0x2]['value']:undefined)||0x14},{'name':_0xb304('0x4c'),'value':_0x2757a9['attrChannel']||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x3]?_0x2757a9[_0xb304('0x40')][0x3][_0xb304('0x41')]:undefined)||_0xb304('0x4d')},{'name':_0xb304('0x4e'),'value':_0x2757a9[_0xb304('0x4e')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9['attrs'][0x4]?_0x2757a9[_0xb304('0x40')][0x4][_0xb304('0x41')]:undefined)||''},{'name':_0xb304('0x4f'),'value':_0x2757a9[_0xb304('0x4f')]||(_0x2757a9['attrs']&&_0x2757a9[_0xb304('0x40')][0x5]?_0x2757a9[_0xb304('0x40')][0x5][_0xb304('0x41')]:undefined)||''},{'name':_0xb304('0x50'),'value':_0x2757a9[_0xb304('0x50')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x6]?_0x2757a9[_0xb304('0x40')][0x6][_0xb304('0x41')]:undefined)||''},{'name':_0xb304('0x51'),'value':_0x2757a9[_0xb304('0x51')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x7]?_0x2757a9[_0xb304('0x40')][0x7][_0xb304('0x41')]:undefined)||''},{'name':_0xb304('0x52'),'value':_0x2757a9[_0xb304('0x52')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x8]?_0x2757a9[_0xb304('0x40')][0x8][_0xb304('0x41')]:undefined)||''},{'name':_0xb304('0x53'),'value':_0x2757a9[_0xb304('0x53')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x9]?_0x2757a9['attrs'][0x9][_0xb304('0x41')]:undefined)||''}];case'multibar-chart':case _0xb304('0x54'):return[{'name':_0xb304('0x55'),'value':_0x2757a9['attrSerie1']||(_0x2757a9['attrs']&&_0x2757a9['attrs'][0x0]?_0x2757a9[_0xb304('0x40')][0x0][_0xb304('0x41')]:undefined)||_0xb304('0x4a')},{'name':_0xb304('0x56'),'value':_0x2757a9['attrSerie2']||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x1]?_0x2757a9['attrs'][0x1][_0xb304('0x41')]:undefined)||null},{'name':_0xb304('0x57'),'value':_0x2757a9['attrSerie3']||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x2]?_0x2757a9[_0xb304('0x40')][0x2][_0xb304('0x41')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2757a9[_0xb304('0x4b')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x3]?_0x2757a9[_0xb304('0x40')][0x3][_0xb304('0x41')]:undefined)||[]},{'name':_0xb304('0x4c'),'value':_0x2757a9[_0xb304('0x4c')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x4]?_0x2757a9[_0xb304('0x40')][0x4][_0xb304('0x41')]:undefined)||'voice'},{'name':_0xb304('0x4e'),'value':_0x2757a9[_0xb304('0x4e')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x5]?_0x2757a9[_0xb304('0x40')][0x5]['value']:undefined)||''},{'name':_0xb304('0x4f'),'value':_0x2757a9[_0xb304('0x4f')]||(_0x2757a9['attrs']&&_0x2757a9['attrs'][0x6]?_0x2757a9['attrs'][0x6]['value']:undefined)||''},{'name':_0xb304('0x50'),'value':_0x2757a9['attrSmsAccounts']||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x7]?_0x2757a9['attrs'][0x7][_0xb304('0x41')]:undefined)||''},{'name':_0xb304('0x51'),'value':_0x2757a9[_0xb304('0x51')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x8]?_0x2757a9[_0xb304('0x40')][0x8][_0xb304('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2757a9[_0xb304('0x52')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x9]?_0x2757a9['attrs'][0x9][_0xb304('0x41')]:undefined)||''},{'name':_0xb304('0x53'),'value':_0x2757a9[_0xb304('0x53')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0xa]?_0x2757a9[_0xb304('0x40')][0xa]['value']:undefined)||''}];case _0xb304('0x58'):return[{'name':_0xb304('0x59'),'type':_0x2757a9[_0xb304('0x5a')]||(_0x2757a9['attrs']&&_0x2757a9['attrs'][0x0]?_0x2757a9[_0xb304('0x40')][0x0][_0xb304('0x5b')]:undefined)||null,'value':_0x2757a9[_0xb304('0x59')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9[_0xb304('0x40')][0x0]?_0x2757a9[_0xb304('0x40')][0x0][_0xb304('0x41')]:undefined)||null},{'name':_0xb304('0x5c'),'value':_0x2757a9[_0xb304('0x5c')]||(_0x2757a9[_0xb304('0x40')]&&_0x2757a9['attrs'][0x1]?_0x2757a9[_0xb304('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x11b47b){logger[_0xb304('0x29')](_0xb304('0x5d'),JSON['stringify'](_0x11b47b));return[];}}exports[_0xb304('0x5e')]=function(_0x304408,_0x2afb42){if(_0x304408[_0xb304('0x5f')]){_0x304408[_0xb304('0x5f')][_0xb304('0x40')]=widgetAttributes(_0x304408[_0xb304('0x5f')]);}return db['DashboardItem'][_0xb304('0x5e')](_0x304408[_0xb304('0x5f')],{})[_0xb304('0x28')](respondWithResult(_0x2afb42,0xc9))['catch'](handleError(_0x2afb42,null));};exports[_0xb304('0x60')]=function(_0x4d8091,_0x779162){if(_0x4d8091[_0xb304('0x5f')]['id']){delete _0x4d8091[_0xb304('0x5f')]['id'];}_0x4d8091[_0xb304('0x5f')]['attrs']=widgetAttributes(_0x4d8091['body']);return db[_0xb304('0x3b')]['find']({'where':{'id':_0x4d8091[_0xb304('0x2d')]['id']}})[_0xb304('0x28')](handleEntityNotFound(_0x779162,null))[_0xb304('0x28')](saveUpdates(_0x4d8091[_0xb304('0x5f')],null))[_0xb304('0x28')](respondWithResult(_0x779162,null))[_0xb304('0x3d')](handleError(_0x779162,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0ed05e2..05cfd0d 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 _0xd2d8=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem'];(function(_0x496f90,_0x4704b7){var _0x44409e=function(_0x4b4835){while(--_0x4b4835){_0x496f90['push'](_0x496f90['shift']());}};_0x44409e(++_0x4704b7);}(_0xd2d8,0x1b6));var _0x8d2d=function(_0x3d34f0,_0x4a5dc0){_0x3d34f0=_0x3d34f0-0x0;var _0x135ecd=_0xd2d8[_0x3d34f0];return _0x135ecd;};'use strict';var EventEmitter=require(_0x8d2d('0x0'));var DashboardItem=require(_0x8d2d('0x1'))['db'][_0x8d2d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8d2d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d2d('0x4'),'afterDestroy':_0x8d2d('0x5')};function emitEvent(_0x5c4caa){return function(_0xf74314,_0x5024f2,_0x28074c){DashboardItemEvents[_0x8d2d('0x6')](_0x5c4caa+':'+_0xf74314['id'],_0xf74314);DashboardItemEvents['emit'](_0x5c4caa,_0xf74314);_0x28074c(null);};}for(var e in events){if(events[_0x8d2d('0x7')](e)){var event=events[e];DashboardItem[_0x8d2d('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x37d9=['DashboardItem','setMaxListeners','update','remove','hasOwnProperty','exports','../../mysqldb'];(function(_0x14e691,_0x2f9c39){var _0x3e6b1d=function(_0x5d516d){while(--_0x5d516d){_0x14e691['push'](_0x14e691['shift']());}};_0x3e6b1d(++_0x2f9c39);}(_0x37d9,0xdf));var _0x937d=function(_0x2d1ea4,_0x58a23a){_0x2d1ea4=_0x2d1ea4-0x0;var _0x5aa6a5=_0x37d9[_0x2d1ea4];return _0x5aa6a5;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x937d('0x0'))['db'][_0x937d('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x937d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x937d('0x3'),'afterDestroy':_0x937d('0x4')};function emitEvent(_0x2a3b9){return function(_0x6a5cb3,_0x241a9a,_0x39be89){DashboardItemEvents['emit'](_0x2a3b9+':'+_0x6a5cb3['id'],_0x6a5cb3);DashboardItemEvents['emit'](_0x2a3b9,_0x6a5cb3);_0x39be89(null);};}for(var e in events){if(events[_0x937d('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x937d('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index f7b3437..36f2ed2 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 _0x8cd9=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x8cd9,0x186));var _0x98cd=function(_0x2de68b,_0x3ccf8f){_0x2de68b=_0x2de68b-0x0;var _0x45018d=_0x8cd9[_0x2de68b];return _0x45018d;};'use strict';var _=require(_0x98cd('0x0'));var util=require(_0x98cd('0x1'));var logger=require(_0x98cd('0x2'))(_0x98cd('0x3'));var moment=require(_0x98cd('0x4'));var BPromise=require(_0x98cd('0x5'));var rp=require(_0x98cd('0x6'));var fs=require('fs');var path=require(_0x98cd('0x7'));var rimraf=require(_0x98cd('0x8'));var config=require(_0x98cd('0x9'));var attributes=require(_0x98cd('0xa'));module['exports']=function(_0x1379b8,_0x59e346){return _0x1379b8[_0x98cd('0xb')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0c9=['moment','request-promise','path','../../config/environment','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','api'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xb0c9,0xd8));var _0x9b0c=function(_0xa34cd7,_0x589125){_0xa34cd7=_0xa34cd7-0x0;var _0x45bb92=_0xb0c9[_0xa34cd7];return _0x45bb92;};'use strict';var _=require(_0x9b0c('0x0'));var util=require(_0x9b0c('0x1'));var logger=require(_0x9b0c('0x2'))(_0x9b0c('0x3'));var moment=require(_0x9b0c('0x4'));var BPromise=require('bluebird');var rp=require(_0x9b0c('0x5'));var fs=require('fs');var path=require(_0x9b0c('0x6'));var rimraf=require('rimraf');var config=require(_0x9b0c('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x9b0c('0x8')]=function(_0x51595b,_0x30749c){return _0x51595b['define'](_0x9b0c('0x9'),attributes,{'tableName':_0x9b0c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index e78c092..dd38054 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 _0xe6bd=['register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','redis','socket.io-emitter'];(function(_0x22d244,_0x28cbb){var _0x267c7e=function(_0x5ae131){while(--_0x5ae131){_0x22d244['push'](_0x22d244['shift']());}};_0x267c7e(++_0x28cbb);}(_0xe6bd,0x10b));var _0xde6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6bd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde6b('0x0'));var util=require(_0xde6b('0x1'));var moment=require(_0xde6b('0x2'));var BPromise=require('bluebird');var rs=require(_0xde6b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xde6b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xde6b('0x5'));var jayson=require(_0xde6b('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xde6b('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xde6b('0x8'))(new Redis(config[_0xde6b('0x7')]));require('./dashboardItem.socket')[_0xde6b('0x9')](socket);function respondWithRpcPromise(_0x3e4efa,_0x3d5306,_0x1785e0){return new BPromise(function(_0xda1554,_0x14c257){return client[_0xde6b('0xa')](_0x3e4efa,_0x1785e0)[_0xde6b('0xb')](function(_0x1acfbb){logger[_0xde6b('0xc')](_0xde6b('0xd'),_0x3d5306,'request\x20sent');logger[_0xde6b('0xe')](_0xde6b('0xf'),_0x3d5306,_0xde6b('0x10'),JSON[_0xde6b('0x11')](_0x1acfbb));if(_0x1acfbb[_0xde6b('0x12')]){if(_0x1acfbb[_0xde6b('0x12')][_0xde6b('0x13')]===0x1f4){logger[_0xde6b('0x12')]('DashboardItem,\x20%s,\x20%s',_0x3d5306,_0x1acfbb[_0xde6b('0x12')][_0xde6b('0x14')]);return _0x14c257(_0x1acfbb[_0xde6b('0x12')]['message']);}logger[_0xde6b('0x12')](_0xde6b('0xd'),_0x3d5306,_0x1acfbb[_0xde6b('0x12')][_0xde6b('0x14')]);return _0xda1554(_0x1acfbb[_0xde6b('0x12')][_0xde6b('0x14')]);}else{logger[_0xde6b('0xc')](_0xde6b('0xd'),_0x3d5306,_0xde6b('0x10'));_0xda1554(_0x1acfbb[_0xde6b('0x15')]['message']);}})[_0xde6b('0x16')](function(_0x138f43){logger[_0xde6b('0x12')](_0xde6b('0xd'),_0x3d5306,_0x138f43);_0x14c257(_0x138f43);});});} \ No newline at end of file +var _0xe3cb=['error','message','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c09e7,_0x1522ed){var _0x382ff7=function(_0x2ac5ec){while(--_0x2ac5ec){_0x2c09e7['push'](_0x2c09e7['shift']());}};_0x382ff7(++_0x1522ed);}(_0xe3cb,0x12e));var _0xbe3c=function(_0x3c50b4,_0x395151){_0x3c50b4=_0x3c50b4-0x0;var _0x5e189b=_0xe3cb[_0x3c50b4];return _0x5e189b;};'use strict';var _=require(_0xbe3c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbe3c('0x1'));var rs=require(_0xbe3c('0x2'));var fs=require('fs');var Redis=require(_0xbe3c('0x3'));var db=require(_0xbe3c('0x4'))['db'];var utils=require(_0xbe3c('0x5'));var logger=require(_0xbe3c('0x6'))(_0xbe3c('0x7'));var config=require(_0xbe3c('0x8'));var jayson=require(_0xbe3c('0x9'));var client=jayson[_0xbe3c('0xa')]['http']({'port':0x232a});config[_0xbe3c('0xb')]=_['defaults'](config[_0xbe3c('0xb')],{'host':_0xbe3c('0xc'),'port':0x18eb});var socket=require(_0xbe3c('0xd'))(new Redis(config['redis']));require(_0xbe3c('0xe'))[_0xbe3c('0xf')](socket);function respondWithRpcPromise(_0x4e36ad,_0x136e11,_0x125ff4){return new BPromise(function(_0x5c35a4,_0x2c734f){return client[_0xbe3c('0x10')](_0x4e36ad,_0x125ff4)['then'](function(_0x134eee){logger[_0xbe3c('0x11')](_0xbe3c('0x12'),_0x136e11,'request\x20sent');logger[_0xbe3c('0x13')](_0xbe3c('0x14'),_0x136e11,'request\x20sent',JSON[_0xbe3c('0x15')](_0x134eee));if(_0x134eee[_0xbe3c('0x16')]){if(_0x134eee['error']['code']===0x1f4){logger[_0xbe3c('0x16')](_0xbe3c('0x12'),_0x136e11,_0x134eee[_0xbe3c('0x16')][_0xbe3c('0x17')]);return _0x2c734f(_0x134eee[_0xbe3c('0x16')]['message']);}logger[_0xbe3c('0x16')](_0xbe3c('0x12'),_0x136e11,_0x134eee[_0xbe3c('0x16')][_0xbe3c('0x17')]);return _0x5c35a4(_0x134eee[_0xbe3c('0x16')][_0xbe3c('0x17')]);}else{logger['info'](_0xbe3c('0x12'),_0x136e11,_0xbe3c('0x18'));_0x5c35a4(_0x134eee[_0xbe3c('0x19')][_0xbe3c('0x17')]);}})[_0xbe3c('0x1a')](function(_0x8e3e6d){logger[_0xbe3c('0x16')](_0xbe3c('0x12'),_0x136e11,_0x8e3e6d);_0x2c734f(_0x8e3e6d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a21ff58..240c744 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 _0x67f3=['length','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x37bf40,_0x20c90a){var _0x552c29=function(_0x5c517c){while(--_0x5c517c){_0x37bf40['push'](_0x37bf40['shift']());}};_0x552c29(++_0x20c90a);}(_0x67f3,0x8d));var _0x367f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x67f3[_0x19950b];return _0x3c6b41;};'use strict';var DashboardItemEvents=require(_0x367f('0x0'));var events=[_0x367f('0x1'),_0x367f('0x2'),_0x367f('0x3')];function createListener(_0x18cd2f,_0x293300){return function(_0x44b915){_0x293300[_0x367f('0x4')](_0x18cd2f,_0x44b915);};}function removeListener(_0x1eb954,_0x5e9612){return function(){DashboardItemEvents[_0x367f('0x5')](_0x1eb954,_0x5e9612);};}exports['register']=function(_0x3f45c9){for(var _0x54121d=0x0,_0x2a7db8=events[_0x367f('0x6')];_0x54121d<_0x2a7db8;_0x54121d++){var _0x1e555a=events[_0x54121d];var _0x6bf8c2=createListener('dashboardItem:'+_0x1e555a,_0x3f45c9);DashboardItemEvents['on'](_0x1e555a,_0x6bf8c2);}}; \ No newline at end of file +var _0xdec7=['update','emit','removeListener','length','./dashboardItem.events','save'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xdec7,0x11e));var _0x7dec=function(_0x422107,_0x35fd41){_0x422107=_0x422107-0x0;var _0x3084be=_0xdec7[_0x422107];return _0x3084be;};'use strict';var DashboardItemEvents=require(_0x7dec('0x0'));var events=[_0x7dec('0x1'),'remove',_0x7dec('0x2')];function createListener(_0x5b45ef,_0x5a55f3){return function(_0x319e8b){_0x5a55f3[_0x7dec('0x3')](_0x5b45ef,_0x319e8b);};}function removeListener(_0x4e7cca,_0x1d71c3){return function(){DashboardItemEvents[_0x7dec('0x4')](_0x4e7cca,_0x1d71c3);};}exports['register']=function(_0x33ed7f){for(var _0x14c13b=0x0,_0x16dbe9=events[_0x7dec('0x5')];_0x14c13b<_0x16dbe9;_0x14c13b++){var _0x3a6ac2=events[_0x14c13b];var _0x5bbdab=createListener('dashboardItem:'+_0x3a6ac2,_0x33ed7f);DashboardItemEvents['on'](_0x3a6ac2,_0x5bbdab);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 31321dc..8067477 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 _0xbe2b=['isAuthenticated','post','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get'];(function(_0x2ac471,_0x51b49a){var _0x3e2d25=function(_0x3c4b6c){while(--_0x3c4b6c){_0x2ac471['push'](_0x2ac471['shift']());}};_0x3e2d25(++_0x51b49a);}(_0xbe2b,0x6f));var _0xbbe2=function(_0x2df9fc,_0x28ba17){_0x2df9fc=_0x2df9fc-0x0;var _0x25d4ae=_0xbe2b[_0x2df9fc];return _0x25d4ae;};'use strict';var multer=require(_0xbbe2('0x0'));var util=require(_0xbbe2('0x1'));var path=require(_0xbbe2('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbe2('0x3'));var router=express['Router']();var fs_extra=require(_0xbbe2('0x4'));var auth=require(_0xbbe2('0x5'));var interaction=require(_0xbbe2('0x6'));var config=require('../../config/environment');var controller=require(_0xbbe2('0x7'));router[_0xbbe2('0x8')]('/:id',auth[_0xbbe2('0x9')](),controller['show']);router[_0xbbe2('0xa')]('/',auth[_0xbbe2('0x9')](),controller['create']);router[_0xbbe2('0xb')]('/:id',auth[_0xbbe2('0x9')](),controller[_0xbbe2('0xc')]);router[_0xbbe2('0xd')]('/:id',auth[_0xbbe2('0x9')](),controller[_0xbbe2('0xe')]);module['exports']=router; \ No newline at end of file +var _0x66e0=['exports','path','connect-timeout','fs-extra','../../components/auth/service','./dashboardItem.controller','get','show','post','isAuthenticated','create','put','/:id','update'];(function(_0x10447c,_0x520639){var _0x56da5e=function(_0x1a64c5){while(--_0x1a64c5){_0x10447c['push'](_0x10447c['shift']());}};_0x56da5e(++_0x520639);}(_0x66e0,0x143));var _0x066e=function(_0xd0603b,_0x1b7fff){_0xd0603b=_0xd0603b-0x0;var _0x56af8d=_0x66e0[_0xd0603b];return _0x56af8d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x066e('0x0'));var timeout=require(_0x066e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x066e('0x2'));var auth=require(_0x066e('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x066e('0x4'));router[_0x066e('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x066e('0x6')]);router[_0x066e('0x7')]('/',auth[_0x066e('0x8')](),controller[_0x066e('0x9')]);router[_0x066e('0xa')](_0x066e('0xb'),auth['isAuthenticated'](),controller[_0x066e('0xc')]);router['delete'](_0x066e('0xb'),auth[_0x066e('0x8')](),controller['destroy']);module[_0x066e('0xd')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 3101712..e022ae2 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 _0xa820=['exports','STRING','first','second','sequelize'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0xa820,0x1da));var _0x0a82=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xa820[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x0a82('0x0'));module[_0x0a82('0x1')]={'name':{'type':Sequelize[_0x0a82('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x0a82('0x3'),_0x0a82('0x4'),'third'),'allowNull':![],'defaultValue':_0x0a82('0x3')},'description':{'type':Sequelize[_0x0a82('0x2')]}}; \ No newline at end of file +var _0x6422=['first','second','third','sequelize','exports','STRING','ENUM'];(function(_0x15a942,_0x48b5d6){var _0x49e7a9=function(_0x2cd0c8){while(--_0x2cd0c8){_0x15a942['push'](_0x15a942['shift']());}};_0x49e7a9(++_0x48b5d6);}(_0x6422,0xc7));var _0x2642=function(_0x4540d0,_0x484f3d){_0x4540d0=_0x4540d0-0x0;var _0x51a91a=_0x6422[_0x4540d0];return _0x51a91a;};'use strict';var Sequelize=require(_0x2642('0x0'));module[_0x2642('0x1')]={'name':{'type':Sequelize[_0x2642('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x2642('0x3')](_0x2642('0x4'),_0x2642('0x5'),_0x2642('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x2642('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 50aab29..92d9ce6 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 _0x30e9=['eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Disposition','fieldName','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','find','create','body','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x58a201,_0x4663a3){var _0x46b112=function(_0x569e0d){while(--_0x569e0d){_0x58a201['push'](_0x58a201['shift']());}};_0x46b112(++_0x4663a3);}(_0x30e9,0x158));var _0x930e=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x30e9[_0x2555d0];return _0x3bb486;};'use strict';var emlformat=require(_0x930e('0x0'));var rimraf=require(_0x930e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x930e('0x2'));var moment=require(_0x930e('0x3'));var BPromise=require(_0x930e('0x4'));var Mustache=require(_0x930e('0x5'));var util=require(_0x930e('0x6'));var path=require(_0x930e('0x7'));var sox=require(_0x930e('0x8'));var csv=require(_0x930e('0x9'));var ejs=require(_0x930e('0xa'));var fs=require('fs');var fs_extra=require(_0x930e('0xb'));var _=require(_0x930e('0xc'));var squel=require(_0x930e('0xd'));var crypto=require(_0x930e('0xe'));var jsforce=require(_0x930e('0xf'));var deskjs=require(_0x930e('0x10'));var toCsv=require(_0x930e('0x9'));var querystring=require(_0x930e('0x11'));var Papa=require(_0x930e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x930e('0x13'));var as=require(_0x930e('0x14'));var hardwareService=require(_0x930e('0x15'));var logger=require(_0x930e('0x16'))(_0x930e('0x17'));var utils=require(_0x930e('0x18'));var config=require(_0x930e('0x19'));var licenseUtil=require(_0x930e('0x1a'));var db=require(_0x930e('0x1b'))['db'];function respondWithStatusCode(_0x37292c,_0x20fbb4){_0x20fbb4=_0x20fbb4||0xcc;return function(_0x367fe7){if(_0x367fe7){return _0x37292c['sendStatus'](_0x20fbb4);}return _0x37292c['status'](_0x20fbb4)[_0x930e('0x1c')]();};}function respondWithResult(_0x5d6c84,_0x44cb60){_0x44cb60=_0x44cb60||0xc8;return function(_0x5a5a99){if(_0x5a5a99){return _0x5d6c84[_0x930e('0x1d')](_0x44cb60)[_0x930e('0x1e')](_0x5a5a99);}};}function respondWithFilteredResult(_0x5a894c,_0x48b80d){return function(_0x44ebc0){if(_0x44ebc0){var _0x4afbbd=typeof _0x48b80d[_0x930e('0x1f')]===_0x930e('0x20')&&typeof _0x48b80d[_0x930e('0x21')]==='undefined';var _0x44d972=_0x44ebc0[_0x930e('0x22')];var _0xc1e33b=_0x4afbbd?0x0:_0x48b80d[_0x930e('0x1f')];var _0x3f9291=_0x4afbbd?_0x44ebc0[_0x930e('0x22')]:_0x48b80d[_0x930e('0x1f')]+_0x48b80d[_0x930e('0x21')];var _0x2d5614;if(_0x3f9291>=_0x44d972){_0x3f9291=_0x44d972;_0x2d5614=0xc8;}else{_0x2d5614=0xce;}_0x5a894c['status'](_0x2d5614);return _0x5a894c[_0x930e('0x23')](_0x930e('0x24'),_0xc1e33b+'-'+_0x3f9291+'/'+_0x44d972)[_0x930e('0x1e')](_0x44ebc0);}return null;};}function patchUpdates(_0x363d9a){return function(_0x44a430){try{jsonpatch['apply'](_0x44a430,_0x363d9a,!![]);}catch(_0x384178){return BPromise[_0x930e('0x25')](_0x384178);}return _0x44a430['save']();};}function saveUpdates(_0x4a19f7,_0x385ee8){return function(_0x19302c){if(_0x19302c){return _0x19302c[_0x930e('0x26')](_0x4a19f7)['then'](function(_0x1586f9){return _0x1586f9;});}return null;};}function removeEntity(_0x3c28e2,_0x2d0390){return function(_0x5ca6d2){if(_0x5ca6d2){return _0x5ca6d2[_0x930e('0x27')]()[_0x930e('0x28')](function(){var _0x28d0a6=_0x5ca6d2[_0x930e('0x29')]({'plain':!![]});var _0x2b26df='Dispositions';return db[_0x930e('0x2a')][_0x930e('0x27')]({'where':{'type':_0x2b26df,'resourceId':_0x28d0a6['id']}})[_0x930e('0x28')](function(){return _0x5ca6d2;});})['then'](function(){_0x3c28e2[_0x930e('0x1d')](0xcc)[_0x930e('0x1c')]();});}};}function handleEntityNotFound(_0x3f312d,_0xad78cf){return function(_0x44124e){if(!_0x44124e){_0x3f312d[_0x930e('0x2b')](0x194);}return _0x44124e;};}function handleError(_0x4deec5,_0x57d989){_0x57d989=_0x57d989||0x1f4;return function(_0x3ddea5){logger[_0x930e('0x2c')](_0x3ddea5[_0x930e('0x2d')]);if(_0x3ddea5['name']){delete _0x3ddea5[_0x930e('0x2e')];}_0x4deec5[_0x930e('0x1d')](_0x57d989)[_0x930e('0x2f')](_0x3ddea5);};}exports[_0x930e('0x30')]=function(_0x2f022f,_0x1a864e){var _0x5d0434={},_0x382a52={},_0x595492={'count':0x0,'rows':[]};var _0x1c31ab=_[_0x930e('0x31')](db[_0x930e('0x32')]['rawAttributes'],function(_0x56f02b){return{'name':_0x56f02b[_0x930e('0x33')],'type':_0x56f02b['type']['key']};});_0x382a52[_0x930e('0x34')]=_[_0x930e('0x31')](_0x1c31ab,_0x930e('0x2e'));_0x382a52['query']=_[_0x930e('0x35')](_0x2f022f['query']);_0x382a52[_0x930e('0x36')]=_[_0x930e('0x37')](_0x382a52[_0x930e('0x34')],_0x382a52[_0x930e('0x38')]);_0x5d0434[_0x930e('0x39')]=_[_0x930e('0x37')](_0x382a52[_0x930e('0x34')],qs[_0x930e('0x3a')](_0x2f022f[_0x930e('0x38')][_0x930e('0x3a')]));_0x5d0434[_0x930e('0x39')]=_0x5d0434[_0x930e('0x39')][_0x930e('0x3b')]?_0x5d0434[_0x930e('0x39')]:_0x382a52[_0x930e('0x34')];if(!_0x2f022f[_0x930e('0x38')][_0x930e('0x3c')](_0x930e('0x3d'))){_0x5d0434[_0x930e('0x21')]=qs[_0x930e('0x21')](_0x2f022f[_0x930e('0x38')][_0x930e('0x21')]);_0x5d0434[_0x930e('0x1f')]=qs[_0x930e('0x1f')](_0x2f022f[_0x930e('0x38')][_0x930e('0x1f')]);}_0x5d0434[_0x930e('0x3e')]=qs[_0x930e('0x3f')](_0x2f022f[_0x930e('0x38')][_0x930e('0x3f')]);_0x5d0434[_0x930e('0x40')]=qs[_0x930e('0x36')](_[_0x930e('0x41')](_0x2f022f[_0x930e('0x38')],_0x382a52[_0x930e('0x36')]),_0x1c31ab);if(_0x2f022f['query'][_0x930e('0x42')]){_0x5d0434[_0x930e('0x40')]=_[_0x930e('0x43')](_0x5d0434[_0x930e('0x40')],{'$or':_['map'](_0x1c31ab,function(_0x3bee64){if(_0x3bee64[_0x930e('0x44')]!==_0x930e('0x45')){var _0x2609d3={};_0x2609d3[_0x3bee64['name']]={'$like':'%'+_0x2f022f[_0x930e('0x38')][_0x930e('0x42')]+'%'};return _0x2609d3;}})});}_0x5d0434=_['merge']({},_0x5d0434,_0x2f022f[_0x930e('0x46')]);var _0x5555d7={'where':_0x5d0434['where']};return db[_0x930e('0x32')][_0x930e('0x22')](_0x5555d7)[_0x930e('0x28')](function(_0x44282a){_0x595492[_0x930e('0x22')]=_0x44282a;if(_0x2f022f[_0x930e('0x38')]['includeAll']){_0x5d0434[_0x930e('0x47')]=[{'all':!![]}];}return db['Disposition'][_0x930e('0x48')](_0x5d0434);})['then'](function(_0x3ae6ee){_0x595492[_0x930e('0x49')]=_0x3ae6ee;return _0x595492;})[_0x930e('0x28')](respondWithFilteredResult(_0x1a864e,_0x5d0434))[_0x930e('0x4a')](handleError(_0x1a864e,null));};exports['show']=function(_0x4c771b,_0x7b9365){var _0x3b07e0={'raw':!![],'where':{'id':_0x4c771b[_0x930e('0x4b')]['id']}},_0x5a9763={};_0x5a9763[_0x930e('0x34')]=_[_0x930e('0x35')](db[_0x930e('0x32')][_0x930e('0x4c')]);_0x5a9763[_0x930e('0x38')]=_[_0x930e('0x35')](_0x4c771b[_0x930e('0x38')]);_0x5a9763[_0x930e('0x36')]=_[_0x930e('0x37')](_0x5a9763[_0x930e('0x34')],_0x5a9763[_0x930e('0x38')]);_0x3b07e0[_0x930e('0x39')]=_[_0x930e('0x37')](_0x5a9763['model'],qs['fields'](_0x4c771b[_0x930e('0x38')]['fields']));_0x3b07e0[_0x930e('0x39')]=_0x3b07e0[_0x930e('0x39')][_0x930e('0x3b')]?_0x3b07e0[_0x930e('0x39')]:_0x5a9763[_0x930e('0x34')];if(_0x4c771b[_0x930e('0x38')]['includeAll']){_0x3b07e0[_0x930e('0x47')]=[{'all':!![]}];}_0x3b07e0=_[_0x930e('0x43')]({},_0x3b07e0,_0x4c771b['options']);return db[_0x930e('0x32')][_0x930e('0x4d')](_0x3b07e0)[_0x930e('0x28')](handleEntityNotFound(_0x7b9365,null))[_0x930e('0x28')](respondWithResult(_0x7b9365,null))[_0x930e('0x4a')](handleError(_0x7b9365,null));};exports[_0x930e('0x4e')]=function(_0x5e9adf,_0x33869d){return db[_0x930e('0x32')][_0x930e('0x4e')](_0x5e9adf[_0x930e('0x4f')],{})[_0x930e('0x28')](function(_0x2a6160){var _0x2c77f8=_0x5e9adf['user'][_0x930e('0x29')]({'plain':!![]});if(!_0x2c77f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c77f8[_0x930e('0x50')]==='user'){var _0x5a8031=_0x2a6160[_0x930e('0x29')]({'plain':!![]});var _0x2ae6d2=_0x930e('0x51');return db[_0x930e('0x52')][_0x930e('0x4d')]({'where':{'name':_0x2ae6d2,'userProfileId':_0x2c77f8[_0x930e('0x53')]},'raw':!![]})[_0x930e('0x28')](function(_0xd108a8){if(_0xd108a8&&_0xd108a8[_0x930e('0x54')]===0x0){return db[_0x930e('0x2a')][_0x930e('0x4e')]({'name':_0x5a8031[_0x930e('0x2e')],'resourceId':_0x5a8031['id'],'type':_0xd108a8[_0x930e('0x2e')],'sectionId':_0xd108a8['id']},{})[_0x930e('0x28')](function(){return _0x2a6160;});}else{return _0x2a6160;}})['catch'](function(_0xa2d200){logger[_0x930e('0x2c')](_0x930e('0x55'),_0xa2d200);throw _0xa2d200;});}return _0x2a6160;})[_0x930e('0x28')](respondWithResult(_0x33869d,0xc9))[_0x930e('0x4a')](handleError(_0x33869d,null));};exports[_0x930e('0x26')]=function(_0x4d346a,_0x392a73){if(_0x4d346a[_0x930e('0x4f')]['id']){delete _0x4d346a['body']['id'];}return db['Disposition'][_0x930e('0x4d')]({'where':{'id':_0x4d346a[_0x930e('0x4b')]['id']}})[_0x930e('0x28')](handleEntityNotFound(_0x392a73,null))[_0x930e('0x28')](saveUpdates(_0x4d346a[_0x930e('0x4f')],null))['then'](respondWithResult(_0x392a73,null))[_0x930e('0x4a')](handleError(_0x392a73,null));};exports['destroy']=function(_0x1e2951,_0x479231){return db[_0x930e('0x32')][_0x930e('0x4d')]({'where':{'id':_0x1e2951[_0x930e('0x4b')]['id']}})[_0x930e('0x28')](handleEntityNotFound(_0x479231,null))['then'](removeEntity(_0x479231,null))['catch'](handleError(_0x479231,null));}; \ No newline at end of file +var _0x53f5=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','catch','show','params','fields','length','include','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x386ece,_0x527b4a){var _0x1596a3=function(_0x23f3c2){while(--_0x23f3c2){_0x386ece['push'](_0x386ece['shift']());}};_0x1596a3(++_0x527b4a);}(_0x53f5,0x198));var _0x553f=function(_0x45e9f5,_0x30ad31){_0x45e9f5=_0x45e9f5-0x0;var _0x441b0e=_0x53f5[_0x45e9f5];return _0x441b0e;};'use strict';var emlformat=require(_0x553f('0x0'));var rimraf=require(_0x553f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x553f('0x2'));var rp=require(_0x553f('0x3'));var moment=require('moment');var BPromise=require(_0x553f('0x4'));var Mustache=require(_0x553f('0x5'));var util=require(_0x553f('0x6'));var path=require('path');var sox=require(_0x553f('0x7'));var csv=require(_0x553f('0x8'));var ejs=require(_0x553f('0x9'));var fs=require('fs');var fs_extra=require(_0x553f('0xa'));var _=require(_0x553f('0xb'));var squel=require(_0x553f('0xc'));var crypto=require(_0x553f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x553f('0xe'));var toCsv=require(_0x553f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x553f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x553f('0x10'));var as=require(_0x553f('0x11'));var hardwareService=require(_0x553f('0x12'));var logger=require('../../config/logger')(_0x553f('0x13'));var utils=require(_0x553f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x553f('0x15'))['db'];function respondWithStatusCode(_0x281b28,_0x2bc47a){_0x2bc47a=_0x2bc47a||0xcc;return function(_0x2c00ab){if(_0x2c00ab){return _0x281b28[_0x553f('0x16')](_0x2bc47a);}return _0x281b28[_0x553f('0x17')](_0x2bc47a)[_0x553f('0x18')]();};}function respondWithResult(_0x163617,_0x29378c){_0x29378c=_0x29378c||0xc8;return function(_0x5c891a){if(_0x5c891a){return _0x163617[_0x553f('0x17')](_0x29378c)['json'](_0x5c891a);}};}function respondWithFilteredResult(_0x3b536c,_0x255e67){return function(_0x1ce93a){if(_0x1ce93a){var _0x318f1f=typeof _0x255e67[_0x553f('0x19')]===_0x553f('0x1a')&&typeof _0x255e67[_0x553f('0x1b')]===_0x553f('0x1a');var _0x539b54=_0x1ce93a[_0x553f('0x1c')];var _0x54b94c=_0x318f1f?0x0:_0x255e67[_0x553f('0x19')];var _0x350b9a=_0x318f1f?_0x1ce93a[_0x553f('0x1c')]:_0x255e67['offset']+_0x255e67[_0x553f('0x1b')];var _0x2a0226;if(_0x350b9a>=_0x539b54){_0x350b9a=_0x539b54;_0x2a0226=0xc8;}else{_0x2a0226=0xce;}_0x3b536c['status'](_0x2a0226);return _0x3b536c[_0x553f('0x1d')](_0x553f('0x1e'),_0x54b94c+'-'+_0x350b9a+'/'+_0x539b54)[_0x553f('0x1f')](_0x1ce93a);}return null;};}function patchUpdates(_0xfe53b5){return function(_0x106d66){try{jsonpatch[_0x553f('0x20')](_0x106d66,_0xfe53b5,!![]);}catch(_0xfef34d){return BPromise[_0x553f('0x21')](_0xfef34d);}return _0x106d66[_0x553f('0x22')]();};}function saveUpdates(_0x15ae7e,_0x2029b9){return function(_0x24a6b1){if(_0x24a6b1){return _0x24a6b1[_0x553f('0x23')](_0x15ae7e)['then'](function(_0x1d5d3e){return _0x1d5d3e;});}return null;};}function removeEntity(_0x56598a,_0x36b518){return function(_0x5df1f6){if(_0x5df1f6){return _0x5df1f6['destroy']()[_0x553f('0x24')](function(){var _0x33823f=_0x5df1f6[_0x553f('0x25')]({'plain':!![]});var _0x393086=_0x553f('0x26');return db[_0x553f('0x27')][_0x553f('0x28')]({'where':{'type':_0x393086,'resourceId':_0x33823f['id']}})[_0x553f('0x24')](function(){return _0x5df1f6;});})[_0x553f('0x24')](function(){_0x56598a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d4739,_0x4540fa){return function(_0x54ee47){if(!_0x54ee47){_0x5d4739[_0x553f('0x16')](0x194);}return _0x54ee47;};}function handleError(_0x45a6c1,_0x3a3156){_0x3a3156=_0x3a3156||0x1f4;return function(_0x54cca4){logger[_0x553f('0x29')](_0x54cca4[_0x553f('0x2a')]);if(_0x54cca4[_0x553f('0x2b')]){delete _0x54cca4[_0x553f('0x2b')];}_0x45a6c1[_0x553f('0x17')](_0x3a3156)[_0x553f('0x2c')](_0x54cca4);};}exports[_0x553f('0x2d')]=function(_0x508b94,_0x4f9f14){var _0x3150b3={},_0x386fed={},_0x31f8aa={'count':0x0,'rows':[]};var _0x4c2bce=_[_0x553f('0x2e')](db[_0x553f('0x2f')][_0x553f('0x30')],function(_0xcfc640){return{'name':_0xcfc640[_0x553f('0x31')],'type':_0xcfc640[_0x553f('0x32')][_0x553f('0x33')]};});_0x386fed[_0x553f('0x34')]=_[_0x553f('0x2e')](_0x4c2bce,_0x553f('0x2b'));_0x386fed[_0x553f('0x35')]=_[_0x553f('0x36')](_0x508b94[_0x553f('0x35')]);_0x386fed[_0x553f('0x37')]=_['intersection'](_0x386fed[_0x553f('0x34')],_0x386fed[_0x553f('0x35')]);_0x3150b3[_0x553f('0x38')]=_[_0x553f('0x39')](_0x386fed[_0x553f('0x34')],qs['fields'](_0x508b94[_0x553f('0x35')]['fields']));_0x3150b3[_0x553f('0x38')]=_0x3150b3[_0x553f('0x38')]['length']?_0x3150b3[_0x553f('0x38')]:_0x386fed[_0x553f('0x34')];if(!_0x508b94[_0x553f('0x35')]['hasOwnProperty'](_0x553f('0x3a'))){_0x3150b3['limit']=qs['limit'](_0x508b94[_0x553f('0x35')][_0x553f('0x1b')]);_0x3150b3[_0x553f('0x19')]=qs[_0x553f('0x19')](_0x508b94['query'][_0x553f('0x19')]);}_0x3150b3[_0x553f('0x3b')]=qs[_0x553f('0x3c')](_0x508b94[_0x553f('0x35')]['sort']);_0x3150b3[_0x553f('0x3d')]=qs[_0x553f('0x37')](_['pick'](_0x508b94[_0x553f('0x35')],_0x386fed[_0x553f('0x37')]),_0x4c2bce);if(_0x508b94['query'][_0x553f('0x3e')]){_0x3150b3['where']=_['merge'](_0x3150b3[_0x553f('0x3d')],{'$or':_[_0x553f('0x2e')](_0x4c2bce,function(_0x1af0b3){if(_0x1af0b3[_0x553f('0x32')]!==_0x553f('0x3f')){var _0xd798a={};_0xd798a[_0x1af0b3['name']]={'$like':'%'+_0x508b94[_0x553f('0x35')][_0x553f('0x3e')]+'%'};return _0xd798a;}})});}_0x3150b3=_[_0x553f('0x40')]({},_0x3150b3,_0x508b94['options']);var _0x28b80b={'where':_0x3150b3[_0x553f('0x3d')]};return db[_0x553f('0x2f')][_0x553f('0x1c')](_0x28b80b)[_0x553f('0x24')](function(_0x4145fe){_0x31f8aa[_0x553f('0x1c')]=_0x4145fe;if(_0x508b94['query'][_0x553f('0x41')]){_0x3150b3['include']=[{'all':!![]}];}return db['Disposition'][_0x553f('0x42')](_0x3150b3);})['then'](function(_0x49b13f){_0x31f8aa['rows']=_0x49b13f;return _0x31f8aa;})[_0x553f('0x24')](respondWithFilteredResult(_0x4f9f14,_0x3150b3))[_0x553f('0x43')](handleError(_0x4f9f14,null));};exports[_0x553f('0x44')]=function(_0x24bf19,_0xc12dce){var _0x3a5bc4={'raw':!![],'where':{'id':_0x24bf19[_0x553f('0x45')]['id']}},_0x2b2836={};_0x2b2836[_0x553f('0x34')]=_[_0x553f('0x36')](db['Disposition'][_0x553f('0x30')]);_0x2b2836[_0x553f('0x35')]=_[_0x553f('0x36')](_0x24bf19[_0x553f('0x35')]);_0x2b2836['filters']=_['intersection'](_0x2b2836[_0x553f('0x34')],_0x2b2836[_0x553f('0x35')]);_0x3a5bc4[_0x553f('0x38')]=_['intersection'](_0x2b2836['model'],qs[_0x553f('0x46')](_0x24bf19['query']['fields']));_0x3a5bc4[_0x553f('0x38')]=_0x3a5bc4[_0x553f('0x38')][_0x553f('0x47')]?_0x3a5bc4[_0x553f('0x38')]:_0x2b2836[_0x553f('0x34')];if(_0x24bf19[_0x553f('0x35')]['includeAll']){_0x3a5bc4[_0x553f('0x48')]=[{'all':!![]}];}_0x3a5bc4=_[_0x553f('0x40')]({},_0x3a5bc4,_0x24bf19[_0x553f('0x49')]);return db['Disposition'][_0x553f('0x4a')](_0x3a5bc4)[_0x553f('0x24')](handleEntityNotFound(_0xc12dce,null))['then'](respondWithResult(_0xc12dce,null))['catch'](handleError(_0xc12dce,null));};exports[_0x553f('0x4b')]=function(_0x207932,_0x39f901){return db[_0x553f('0x2f')]['create'](_0x207932[_0x553f('0x4c')],{})[_0x553f('0x24')](function(_0x566624){var _0xc070b9=_0x207932[_0x553f('0x4d')][_0x553f('0x25')]({'plain':!![]});if(!_0xc070b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc070b9[_0x553f('0x4e')]===_0x553f('0x4d')){var _0xc64b06=_0x566624[_0x553f('0x25')]({'plain':!![]});var _0x5eca3c=_0x553f('0x26');return db[_0x553f('0x4f')]['find']({'where':{'name':_0x5eca3c,'userProfileId':_0xc070b9[_0x553f('0x50')]},'raw':!![]})['then'](function(_0xcba512){if(_0xcba512&&_0xcba512[_0x553f('0x51')]===0x0){return db[_0x553f('0x27')][_0x553f('0x4b')]({'name':_0xc64b06[_0x553f('0x2b')],'resourceId':_0xc64b06['id'],'type':_0xcba512[_0x553f('0x2b')],'sectionId':_0xcba512['id']},{})['then'](function(){return _0x566624;});}else{return _0x566624;}})['catch'](function(_0x4b8e3c){logger[_0x553f('0x29')](_0x553f('0x52'),_0x4b8e3c);throw _0x4b8e3c;});}return _0x566624;})[_0x553f('0x24')](respondWithResult(_0x39f901,0xc9))[_0x553f('0x43')](handleError(_0x39f901,null));};exports[_0x553f('0x23')]=function(_0x2e992f,_0x41cd14){if(_0x2e992f[_0x553f('0x4c')]['id']){delete _0x2e992f['body']['id'];}return db[_0x553f('0x2f')][_0x553f('0x4a')]({'where':{'id':_0x2e992f[_0x553f('0x45')]['id']}})[_0x553f('0x24')](handleEntityNotFound(_0x41cd14,null))[_0x553f('0x24')](saveUpdates(_0x2e992f[_0x553f('0x4c')],null))['then'](respondWithResult(_0x41cd14,null))[_0x553f('0x43')](handleError(_0x41cd14,null));};exports[_0x553f('0x28')]=function(_0x1be3f5,_0x421189){return db['Disposition'][_0x553f('0x4a')]({'where':{'id':_0x1be3f5[_0x553f('0x45')]['id']}})[_0x553f('0x24')](handleEntityNotFound(_0x421189,null))[_0x553f('0x24')](removeEntity(_0x421189,null))[_0x553f('0x43')](handleError(_0x421189,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index b99312e..4a79f24 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 _0xc12b=['name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','define','Disposition','name_voice','name'];(function(_0x204d76,_0x5694c0){var _0x387956=function(_0x54fa53){while(--_0x54fa53){_0x204d76['push'](_0x204d76['shift']());}};_0x387956(++_0x5694c0);}(_0xc12b,0x8e));var _0xbc12=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc12b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbc12('0x0'));var util=require(_0xbc12('0x1'));var logger=require('../../config/logger')(_0xbc12('0x2'));var moment=require('moment');var BPromise=require(_0xbc12('0x3'));var rp=require(_0xbc12('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc12('0x5'));var config=require(_0xbc12('0x6'));var attributes=require(_0xbc12('0x7'));module['exports']=function(_0x230bc9,_0x38d756){return _0x230bc9[_0xbc12('0x8')](_0xbc12('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xbc12('0xa'),'fields':[_0xbc12('0xb'),'ListId']},{'unique':!![],'name':_0xbc12('0xc'),'fields':[_0xbc12('0xb'),_0xbc12('0xd')]},{'unique':!![],'name':_0xbc12('0xe'),'fields':[_0xbc12('0xb'),_0xbc12('0xf')]},{'unique':!![],'name':_0xbc12('0x10'),'fields':[_0xbc12('0xb'),_0xbc12('0x11')]},{'unique':!![],'name':'name_fax','fields':[_0xbc12('0xb'),_0xbc12('0x12')]},{'unique':!![],'name':_0xbc12('0x13'),'fields':[_0xbc12('0xb'),_0xbc12('0x14')]},{'unique':!![],'name':_0xbc12('0x15'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x72ad=['define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./disposition.attributes','exports'];(function(_0x12fe86,_0x57ec8d){var _0x3c528b=function(_0x497daf){while(--_0x497daf){_0x12fe86['push'](_0x12fe86['shift']());}};_0x3c528b(++_0x57ec8d);}(_0x72ad,0xff));var _0xd72a=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x72ad[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0xd72a('0x0'));var util=require('util');var logger=require(_0xd72a('0x1'))(_0xd72a('0x2'));var moment=require('moment');var BPromise=require(_0xd72a('0x3'));var rp=require(_0xd72a('0x4'));var fs=require('fs');var path=require(_0xd72a('0x5'));var rimraf=require(_0xd72a('0x6'));var config=require('../../config/environment');var attributes=require(_0xd72a('0x7'));module[_0xd72a('0x8')]=function(_0x22cc12,_0x23720d){return _0x22cc12[_0xd72a('0x9')](_0xd72a('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xd72a('0xb'),'fields':[_0xd72a('0xc'),_0xd72a('0xd')]},{'unique':!![],'name':_0xd72a('0xe'),'fields':[_0xd72a('0xc'),_0xd72a('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0xd72a('0xc'),_0xd72a('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0xd72a('0xc'),_0xd72a('0x11')]},{'unique':!![],'name':_0xd72a('0x12'),'fields':[_0xd72a('0xc'),_0xd72a('0x13')]},{'unique':!![],'name':_0xd72a('0x14'),'fields':[_0xd72a('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':_0xd72a('0x15'),'fields':[_0xd72a('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 817f02f..5f333d6 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(_0x10b598,_0x30975e){var _0x57d41b=function(_0x39c7cf){while(--_0x39c7cf){_0x10b598['push'](_0x10b598['shift']());}};_0x57d41b(++_0x30975e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x344031,_0x48c0ce){var _0x187200=function(_0x55f128){while(--_0x55f128){_0x344031['push'](_0x344031['shift']());}};_0x187200(++_0x48c0ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index eed975f..56e7740 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 _0x1ff1=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','path'];(function(_0x37ac8a,_0x40ad9d){var _0x45bed7=function(_0x28f807){while(--_0x28f807){_0x37ac8a['push'](_0x37ac8a['shift']());}};_0x45bed7(++_0x40ad9d);}(_0x1ff1,0x71));var _0x11ff=function(_0x5838c5,_0x46ab1f){_0x5838c5=_0x5838c5-0x0;var _0x498200=_0x1ff1[_0x5838c5];return _0x498200;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11ff('0x0'));var timeout=require(_0x11ff('0x1'));var express=require('express');var router=express[_0x11ff('0x2')]();var fs_extra=require(_0x11ff('0x3'));var auth=require(_0x11ff('0x4'));var interaction=require(_0x11ff('0x5'));var config=require(_0x11ff('0x6'));var controller=require(_0x11ff('0x7'));router['get']('/',auth[_0x11ff('0x8')](),controller[_0x11ff('0x9')]);router[_0x11ff('0xa')](_0x11ff('0xb'),auth[_0x11ff('0x8')](),controller[_0x11ff('0xc')]);router[_0x11ff('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x11ff('0xe')](_0x11ff('0xb'),auth[_0x11ff('0x8')](),controller[_0x11ff('0xf')]);router[_0x11ff('0x10')](_0x11ff('0xb'),auth['isAuthenticated'](),controller[_0x11ff('0x11')]);module[_0x11ff('0x12')]=router; \ No newline at end of file +var _0x8dae=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8dae,0x10e));var _0xe8da=function(_0x5876a6,_0x410ead){_0x5876a6=_0x5876a6-0x0;var _0x566826=_0x8dae[_0x5876a6];return _0x566826;};'use strict';var multer=require(_0xe8da('0x0'));var util=require(_0xe8da('0x1'));var path=require(_0xe8da('0x2'));var timeout=require(_0xe8da('0x3'));var express=require(_0xe8da('0x4'));var router=express[_0xe8da('0x5')]();var fs_extra=require(_0xe8da('0x6'));var auth=require(_0xe8da('0x7'));var interaction=require(_0xe8da('0x8'));var config=require(_0xe8da('0x9'));var controller=require(_0xe8da('0xa'));router[_0xe8da('0xb')]('/',auth['isAuthenticated'](),controller[_0xe8da('0xc')]);router[_0xe8da('0xb')](_0xe8da('0xd'),auth[_0xe8da('0xe')](),controller[_0xe8da('0xf')]);router[_0xe8da('0x10')]('/',auth['isAuthenticated'](),controller[_0xe8da('0x11')]);router[_0xe8da('0x12')](_0xe8da('0xd'),auth[_0xe8da('0xe')](),controller[_0xe8da('0x13')]);router[_0xe8da('0x14')](_0xe8da('0xd'),auth[_0xe8da('0xe')](),controller[_0xe8da('0x15')]);module[_0xe8da('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 8805b22..502ef1d 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 _0x90ec=['KHOMP','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','sequelize','exports','STRING','ENUM','yes','localstationid','4800','9600','12000','2400','7200','14400','v17,v27,v29','SIP','IAX'];(function(_0x313de4,_0x3f8b9c){var _0x58f8d1=function(_0x51c61a){while(--_0x51c61a){_0x313de4['push'](_0x313de4['shift']());}};_0x58f8d1(++_0x3f8b9c);}(_0x90ec,0x1d4));var _0xc90e=function(_0x207061,_0xe38cda){_0x207061=_0x207061-0x0;var _0x4a2833=_0x90ec[_0x207061];return _0x4a2833;};'use strict';var Sequelize=require(_0xc90e('0x0'));module[_0xc90e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc90e('0x2')]},'ecm':{'type':Sequelize[_0xc90e('0x3')](_0xc90e('0x4'),'no'),'defaultValue':_0xc90e('0x4')},'headerinfo':{'type':Sequelize[_0xc90e('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xc90e('0x2')],'unique':_0xc90e('0x5')},'minrate':{'type':Sequelize[_0xc90e('0x3')]('2400',_0xc90e('0x6'),'7200',_0xc90e('0x7'),_0xc90e('0x8'),'14400'),'defaultValue':_0xc90e('0x6')},'maxrate':{'type':Sequelize[_0xc90e('0x3')](_0xc90e('0x9'),_0xc90e('0x6'),_0xc90e('0xa'),_0xc90e('0x7'),_0xc90e('0x8'),_0xc90e('0xb')),'defaultValue':_0xc90e('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xc90e('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xc90e('0xd'),_0xc90e('0xe'),'DADHI',_0xc90e('0xf')),'defaultValue':_0xc90e('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc90e('0x10')],'defaultValue':function(){return _0xc90e('0x11');}},'notificationSound':{'type':Sequelize[_0xc90e('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc90e('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc90e('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc90e('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc90e('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc90e('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc90e('0x13')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc90e('0x12')],'defaultValue':![],'comment':_0xc90e('0x14'),'set':function(_0x558b22){if(!_0x558b22)this[_0xc90e('0x15')](_0xc90e('0x16'),null);this[_0xc90e('0x15')]('mandatoryDisposition',_0x558b22);}}}; \ No newline at end of file +var _0x90b1=['BOOLEAN','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','4800','7200','9600','12000','14400','ENUM','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3dc68d,_0x1c1951){var _0xdf7f94=function(_0x339428){while(--_0x339428){_0x3dc68d['push'](_0x3dc68d['shift']());}};_0xdf7f94(++_0x1c1951);}(_0x90b1,0x1bb));var _0x190b=function(_0x4b4b1a,_0x276dd5){_0x4b4b1a=_0x4b4b1a-0x0;var _0x5056ec=_0x90b1[_0x4b4b1a];return _0x5056ec;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize[_0x190b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x190b('0x3'),'no'),'defaultValue':_0x190b('0x3')},'headerinfo':{'type':Sequelize[_0x190b('0x2')],'defaultValue':_0x190b('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM']('2400',_0x190b('0x5'),_0x190b('0x6'),_0x190b('0x7'),_0x190b('0x8'),_0x190b('0x9')),'defaultValue':_0x190b('0x5')},'maxrate':{'type':Sequelize[_0x190b('0xa')]('2400',_0x190b('0x5'),_0x190b('0x6'),_0x190b('0x7'),_0x190b('0x8'),_0x190b('0x9')),'defaultValue':_0x190b('0x9')},'modem':{'type':Sequelize[_0x190b('0x2')],'defaultValue':_0x190b('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x190b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x190b('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x190b('0xd'),_0x190b('0xe'),_0x190b('0xf'),_0x190b('0x10')),'defaultValue':_0x190b('0xd')},'key':{'type':Sequelize[_0x190b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x190b('0x11')],'defaultValue':function(){return _0x190b('0x12');}},'notificationSound':{'type':Sequelize[_0x190b('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x190b('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x190b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x190b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x190b('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x190b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x190b('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x190b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x190b('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x190b('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a9323){if(!_0x2a9323)this[_0x190b('0x14')](_0x190b('0x15'),null);this[_0x190b('0x14')]('mandatoryDisposition',_0x2a9323);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 6a6605d..4d7b635 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 _0xf95f=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','count','offset','limit','set','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','includeAll','rows','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','options','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','transaction','sequelize','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','finally','sendStatus','getApplications','context','from-voip-provider','exten','localstationid','system','description','priority','appdata','Answer','push','CDR(type)=inbound-fax','ecm','gateway','headerinfo','maxrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','Messages','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xf95f,0x16f));var _0xff95=function(_0x49536b,_0x2abe5d){_0x49536b=_0x49536b-0x0;var _0x30de59=_0xf95f[_0x49536b];return _0x30de59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff95('0x0'));var zipdir=require(_0xff95('0x1'));var jsonpatch=require(_0xff95('0x2'));var rp=require(_0xff95('0x3'));var moment=require('moment');var BPromise=require(_0xff95('0x4'));var Mustache=require(_0xff95('0x5'));var util=require(_0xff95('0x6'));var path=require(_0xff95('0x7'));var sox=require(_0xff95('0x8'));var csv=require('to-csv');var ejs=require(_0xff95('0x9'));var fs=require('fs');var fs_extra=require(_0xff95('0xa'));var _=require(_0xff95('0xb'));var squel=require('squel');var crypto=require(_0xff95('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xff95('0xd'));var toCsv=require('to-csv');var querystring=require(_0xff95('0xe'));var Papa=require(_0xff95('0xf'));var Redis=require(_0xff95('0x10'));var authService=require(_0xff95('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff95('0x12'));var logger=require(_0xff95('0x13'))(_0xff95('0x14'));var utils=require('../../config/utils');var config=require(_0xff95('0x15'));var licenseUtil=require(_0xff95('0x16'));var db=require(_0xff95('0x17'))['db'];config[_0xff95('0x18')]=_[_0xff95('0x19')](config[_0xff95('0x18')],{'host':_0xff95('0x1a'),'port':0x18eb});var socket=require(_0xff95('0x1b'))(new Redis(config['redis']));require(_0xff95('0x1c'))['register'](socket);var jayson=require(_0xff95('0x1d'));var client=jayson[_0xff95('0x1e')][_0xff95('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xff95('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x172062,_0x24a1c0,_0x15ed0f,_0x2c0dfd){return new BPromise(function(_0x240cae,_0x49d490){var _0x5aeba0=_0x2c0dfd||client;return _0x5aeba0['request'](_0x172062,_0x15ed0f)[_0xff95('0x20')](function(_0x523ab2){logger['info']('FaxAccount,\x20%s,\x20%s',_0x24a1c0,_0xff95('0x21'));logger[_0xff95('0x22')](_0xff95('0x23'),_0x24a1c0,_0xff95('0x21'),JSON[_0xff95('0x24')](_0x523ab2));if(_0x523ab2[_0xff95('0x25')]){if(_0x523ab2[_0xff95('0x25')]['code']===0x1f4){logger['error'](_0xff95('0x26'),_0x24a1c0,_0x523ab2['error'][_0xff95('0x27')]);return _0x49d490(_0x523ab2[_0xff95('0x25')][_0xff95('0x27')]);}logger[_0xff95('0x25')]('FaxAccount,\x20%s,\x20%s',_0x24a1c0,_0x523ab2[_0xff95('0x25')][_0xff95('0x27')]);return _0x240cae(_0x523ab2['error'][_0xff95('0x27')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x24a1c0,_0xff95('0x21'));_0x240cae(_0x523ab2[_0xff95('0x28')]['message']);}})[_0xff95('0x29')](function(_0x24e308){logger['error'](_0xff95('0x26'),_0x24a1c0,_0x24e308);_0x49d490(_0x24e308);});});}function respondWithStatusCode(_0x1d70af,_0x5010c8){_0x5010c8=_0x5010c8||0xcc;return function(_0x2f99fc){if(_0x2f99fc){return _0x1d70af['sendStatus'](_0x5010c8);}return _0x1d70af[_0xff95('0x2a')](_0x5010c8)[_0xff95('0x2b')]();};}function respondWithResult(_0x21749c,_0x2c70c6){_0x2c70c6=_0x2c70c6||0xc8;return function(_0x2ba66a){if(_0x2ba66a){return _0x21749c[_0xff95('0x2a')](_0x2c70c6)[_0xff95('0x2c')](_0x2ba66a);}};}function respondWithFilteredResult(_0x3b4c06,_0x1613d6){return function(_0x28938f){if(_0x28938f){var _0x54e059=typeof _0x1613d6['offset']===_0xff95('0x2d')&&typeof _0x1613d6['limit']===_0xff95('0x2d');var _0x4302ab=_0x28938f[_0xff95('0x2e')];var _0x31aaa6=_0x54e059?0x0:_0x1613d6[_0xff95('0x2f')];var _0x627b6d=_0x54e059?_0x28938f['count']:_0x1613d6['offset']+_0x1613d6[_0xff95('0x30')];var _0x12493f;if(_0x627b6d>=_0x4302ab){_0x627b6d=_0x4302ab;_0x12493f=0xc8;}else{_0x12493f=0xce;}_0x3b4c06[_0xff95('0x2a')](_0x12493f);return _0x3b4c06[_0xff95('0x31')]('Content-Range',_0x31aaa6+'-'+_0x627b6d+'/'+_0x4302ab)[_0xff95('0x2c')](_0x28938f);}return null;};}function patchUpdates(_0x2a7bdd){return function(_0x1b82b4){try{jsonpatch['apply'](_0x1b82b4,_0x2a7bdd,!![]);}catch(_0x575098){return BPromise[_0xff95('0x32')](_0x575098);}return _0x1b82b4[_0xff95('0x33')]();};}function saveUpdates(_0x45527c,_0x58d1d8){return function(_0x1b3a44){if(_0x1b3a44){return _0x1b3a44[_0xff95('0x34')](_0x45527c)[_0xff95('0x20')](function(_0x141895){return _0x141895;});}return null;};}function removeEntity(_0x46a9ed,_0x171f9d){return function(_0xaa7a54){if(_0xaa7a54){return _0xaa7a54[_0xff95('0x35')]()[_0xff95('0x20')](function(){var _0x4ab000=_0xaa7a54[_0xff95('0x36')]({'plain':!![]});var _0x306cd5=_0xff95('0x37');return db[_0xff95('0x38')][_0xff95('0x35')]({'where':{'type':_0x306cd5,'resourceId':_0x4ab000['id']}})[_0xff95('0x20')](function(){return _0xaa7a54;});})[_0xff95('0x20')](function(){_0x46a9ed['status'](0xcc)[_0xff95('0x2b')]();});}};}function handleEntityNotFound(_0x2e0b26,_0x42a82c){return function(_0x4a3a23){if(!_0x4a3a23){_0x2e0b26['sendStatus'](0x194);}return _0x4a3a23;};}function handleError(_0x3c65b8,_0x4dce23){_0x4dce23=_0x4dce23||0x1f4;return function(_0x13ab41){logger[_0xff95('0x25')](_0x13ab41[_0xff95('0x39')]);if(_0x13ab41[_0xff95('0x3a')]){delete _0x13ab41[_0xff95('0x3a')];}_0x3c65b8[_0xff95('0x2a')](_0x4dce23)[_0xff95('0x3b')](_0x13ab41);};}exports[_0xff95('0x3c')]=function(_0x8c75f4,_0x37122c){var _0x56faae={'include':[{'model':db[_0xff95('0x3d')],'as':_0xff95('0x3e')}]},_0x5618a1={},_0x1e5fc4={'count':0x0,'rows':[]};var _0x43f443=_[_0xff95('0x3f')](db[_0xff95('0x40')][_0xff95('0x41')],function(_0x315dde){return{'name':_0x315dde[_0xff95('0x42')],'type':_0x315dde[_0xff95('0x43')][_0xff95('0x44')]};});_0x5618a1[_0xff95('0x45')]=_[_0xff95('0x3f')](_0x43f443,_0xff95('0x3a'));_0x5618a1['query']=_[_0xff95('0x46')](_0x8c75f4[_0xff95('0x47')]);_0x5618a1['filters']=_[_0xff95('0x48')](_0x5618a1[_0xff95('0x45')],_0x5618a1[_0xff95('0x47')]);_0x56faae[_0xff95('0x49')]=_['intersection'](_0x5618a1[_0xff95('0x45')],qs[_0xff95('0x4a')](_0x8c75f4[_0xff95('0x47')][_0xff95('0x4a')]));_0x56faae[_0xff95('0x49')]=_0x56faae['attributes']['length']?_0x56faae[_0xff95('0x49')]:_0x5618a1[_0xff95('0x45')];if(!_0x8c75f4[_0xff95('0x47')][_0xff95('0x4b')](_0xff95('0x4c'))){_0x56faae['limit']=qs[_0xff95('0x30')](_0x8c75f4[_0xff95('0x47')][_0xff95('0x30')]);_0x56faae['offset']=qs[_0xff95('0x2f')](_0x8c75f4[_0xff95('0x47')][_0xff95('0x2f')]);}_0x56faae[_0xff95('0x4d')]=qs[_0xff95('0x4e')](_0x8c75f4[_0xff95('0x47')][_0xff95('0x4e')]);_0x56faae[_0xff95('0x4f')]=qs[_0xff95('0x50')](_[_0xff95('0x51')](_0x8c75f4[_0xff95('0x47')],_0x5618a1[_0xff95('0x50')]),_0x43f443);if(_0x8c75f4[_0xff95('0x47')]['filter']){_0x56faae['where']=_[_0xff95('0x52')](_0x56faae[_0xff95('0x4f')],{'$or':_[_0xff95('0x3f')](_0x43f443,function(_0x45e091){if(_0x45e091['type']!=='VIRTUAL'){var _0x3f0a36={};_0x3f0a36[_0x45e091[_0xff95('0x3a')]]={'$like':'%'+_0x8c75f4[_0xff95('0x47')][_0xff95('0x53')]+'%'};return _0x3f0a36;}})});}_0x56faae=_[_0xff95('0x52')]({},_0x56faae,_0x8c75f4['options']);var _0x2601da={'where':_0x56faae['where']};return db[_0xff95('0x40')][_0xff95('0x2e')](_0x2601da)['then'](function(_0x1d7c87){_0x1e5fc4[_0xff95('0x2e')]=_0x1d7c87;if(_0x8c75f4[_0xff95('0x47')][_0xff95('0x54')]){_0x56faae['include']=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x56faae);})['then'](function(_0x543c18){_0x1e5fc4[_0xff95('0x55')]=_0x543c18;return _0x1e5fc4;})['then'](respondWithFilteredResult(_0x37122c,_0x56faae))['catch'](handleError(_0x37122c,null));};exports[_0xff95('0x56')]=function(_0x5dabd0,_0x34286d){var _0x18c365={'raw':![],'where':{'id':_0x5dabd0[_0xff95('0x57')]['id']},'include':[{'model':db[_0xff95('0x3d')],'as':_0xff95('0x3e')}]},_0xc31cc0={};_0xc31cc0[_0xff95('0x45')]=_['keys'](db[_0xff95('0x40')]['rawAttributes']);_0xc31cc0['query']=_[_0xff95('0x46')](_0x5dabd0[_0xff95('0x47')]);_0xc31cc0[_0xff95('0x50')]=_[_0xff95('0x48')](_0xc31cc0['model'],_0xc31cc0[_0xff95('0x47')]);_0x18c365[_0xff95('0x49')]=_[_0xff95('0x48')](_0xc31cc0[_0xff95('0x45')],qs['fields'](_0x5dabd0['query'][_0xff95('0x4a')]));_0x18c365[_0xff95('0x49')]=_0x18c365['attributes'][_0xff95('0x58')]?_0x18c365[_0xff95('0x49')]:_0xc31cc0['model'];if(_0x5dabd0[_0xff95('0x47')][_0xff95('0x54')]){_0x18c365['include']=[{'all':!![]}];}_0x18c365=_[_0xff95('0x52')]({},_0x18c365,_0x5dabd0['options']);return db[_0xff95('0x40')]['find'](_0x18c365)['then'](handleEntityNotFound(_0x34286d,null))['then'](respondWithResult(_0x34286d,null))['catch'](handleError(_0x34286d,null));};exports[_0xff95('0x59')]=function(_0x1a00e0,_0x123d90){return db[_0xff95('0x40')][_0xff95('0x59')](_0x1a00e0[_0xff95('0x5a')],{})[_0xff95('0x20')](function(_0x1709e8){var _0x250cfa=_0x1a00e0[_0xff95('0x5b')][_0xff95('0x36')]({'plain':!![]});if(!_0x250cfa)throw new Error(_0xff95('0x5c'));if(_0x250cfa['role']===_0xff95('0x5b')){var _0x3f03d7=_0x1709e8[_0xff95('0x36')]({'plain':!![]});var _0xf74dcd='FaxAccounts';return db[_0xff95('0x5d')][_0xff95('0x5e')]({'where':{'name':_0xf74dcd,'userProfileId':_0x250cfa['userProfileId']},'raw':!![]})[_0xff95('0x20')](function(_0x47fa24){if(_0x47fa24&&_0x47fa24[_0xff95('0x5f')]===0x0){return db[_0xff95('0x38')][_0xff95('0x59')]({'name':_0x3f03d7[_0xff95('0x3a')],'resourceId':_0x3f03d7['id'],'type':_0x47fa24['name'],'sectionId':_0x47fa24['id']},{})[_0xff95('0x20')](function(){return _0x1709e8;});}else{return _0x1709e8;}})[_0xff95('0x29')](function(_0x2e29e3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e29e3);throw _0x2e29e3;});}return _0x1709e8;})[_0xff95('0x20')](respondWithResult(_0x123d90,0xc9))['catch'](handleError(_0x123d90,null));};exports[_0xff95('0x34')]=function(_0xd5d027,_0x5e8d74){if(_0xd5d027[_0xff95('0x5a')]['id']){delete _0xd5d027['body']['id'];}return db['FaxAccount'][_0xff95('0x5e')]({'where':{'id':_0xd5d027['params']['id']},'include':[{'model':db[_0xff95('0x3d')],'as':_0xff95('0x3e')}]})[_0xff95('0x20')](handleEntityNotFound(_0x5e8d74,null))[_0xff95('0x20')](saveUpdates(_0xd5d027['body'],null))['then'](respondWithResult(_0x5e8d74,null))[_0xff95('0x29')](handleError(_0x5e8d74,null));};exports[_0xff95('0x35')]=function(_0x1e72f6,_0x504408){return db[_0xff95('0x40')][_0xff95('0x5e')]({'where':{'id':_0x1e72f6[_0xff95('0x57')]['id']}})[_0xff95('0x20')](handleEntityNotFound(_0x504408,null))[_0xff95('0x20')](removeEntity(_0x504408,null))[_0xff95('0x29')](handleError(_0x504408,null));};exports[_0xff95('0x60')]=function(_0x2de52b,_0x40cf5f){return db['FaxAccount'][_0xff95('0x60')]()['then'](respondWithResult(_0x40cf5f,null))[_0xff95('0x29')](handleError(_0x40cf5f,null));};exports[_0xff95('0x61')]=function(_0x3cd996,_0x18131b,_0x1ede1a){if(_0x3cd996[_0xff95('0x5a')]['id']){delete _0x3cd996[_0xff95('0x5a')]['id'];}return db[_0xff95('0x40')][_0xff95('0x5e')]({'where':{'id':_0x3cd996[_0xff95('0x57')]['id']}})[_0xff95('0x20')](handleEntityNotFound(_0x18131b,null))['then'](function(_0x9c419b){if(_0x9c419b){_0x3cd996[_0xff95('0x5a')][_0xff95('0x62')]=_0x9c419b['id'];return db[_0xff95('0x63')][_0xff95('0x59')](_0x3cd996[_0xff95('0x5a')]);}})[_0xff95('0x20')](respondWithResult(_0x18131b,null))[_0xff95('0x29')](handleError(_0x18131b,null));};exports[_0xff95('0x64')]=function(_0x4b7d5f,_0x517334,_0xd068df){var _0x4f4f00={'raw':![],'where':{}};var _0x505f40={};var _0x74fcf6={'count':0x0,'rows':[]};return db[_0xff95('0x40')][_0xff95('0x65')]({'where':{'id':_0x4b7d5f['params']['id']}})[_0xff95('0x20')](handleEntityNotFound(_0x517334,null))[_0xff95('0x20')](function(_0x3e449f){if(_0x3e449f){_0x505f40[_0xff95('0x45')]=_[_0xff95('0x46')](db[_0xff95('0x63')][_0xff95('0x41')]);_0x505f40['query']=_[_0xff95('0x46')](_0x4b7d5f['query']);_0x505f40[_0xff95('0x50')]=_[_0xff95('0x48')](_0x505f40[_0xff95('0x45')],_0x505f40['query']);_0x4f4f00[_0xff95('0x49')]=_['intersection'](_0x505f40[_0xff95('0x45')],qs['fields'](_0x4b7d5f[_0xff95('0x47')][_0xff95('0x4a')]));_0x4f4f00[_0xff95('0x49')]=_0x4f4f00['attributes'][_0xff95('0x58')]?_0x4f4f00[_0xff95('0x49')]:_0x505f40[_0xff95('0x45')];if(!_0x4b7d5f[_0xff95('0x47')]['hasOwnProperty'](_0xff95('0x4c'))){_0x4f4f00[_0xff95('0x30')]=qs[_0xff95('0x30')](_0x4b7d5f[_0xff95('0x47')][_0xff95('0x30')]);_0x4f4f00[_0xff95('0x2f')]=qs[_0xff95('0x2f')](_0x4b7d5f[_0xff95('0x47')][_0xff95('0x2f')]);}_0x4f4f00[_0xff95('0x4d')]=qs['sort'](_0x4b7d5f[_0xff95('0x47')][_0xff95('0x4e')]);_0x4f4f00[_0xff95('0x4f')]=qs[_0xff95('0x50')](_['pick'](_0x4b7d5f[_0xff95('0x47')],_0x505f40[_0xff95('0x50')]));_0x4f4f00[_0xff95('0x4f')][_0xff95('0x62')]=_0x3e449f['id'];if(_0x4b7d5f[_0xff95('0x47')][_0xff95('0x53')]){_0x4f4f00[_0xff95('0x4f')]=_['merge'](_0x4f4f00[_0xff95('0x4f')],{'$or':_['map'](_0x4f4f00[_0xff95('0x49')],function(_0x528ee1){var _0x1d88b7={};_0x1d88b7[_0x528ee1]={'$like':'%'+_0x4b7d5f[_0xff95('0x47')][_0xff95('0x53')]+'%'};return _0x1d88b7;})});}_0x4f4f00=_['merge']({},_0x4f4f00,_0x4b7d5f[_0xff95('0x66')]);return db[_0xff95('0x63')][_0xff95('0x2e')]({'where':_0x4f4f00[_0xff95('0x4f')]})[_0xff95('0x20')](function(_0xc1204d){_0x74fcf6[_0xff95('0x2e')]=_0xc1204d;if(_0x4b7d5f['query'][_0xff95('0x54')]){_0x4f4f00[_0xff95('0x67')]=[{'all':!![]}];}return db['Disposition'][_0xff95('0x68')](_0x4f4f00);})[_0xff95('0x20')](function(_0x4fa67e){_0x74fcf6[_0xff95('0x55')]=_0x4fa67e;return _0x74fcf6;});}})[_0xff95('0x20')](respondWithFilteredResult(_0x517334,_0x4f4f00))['catch'](handleError(_0x517334,null));};exports[_0xff95('0x69')]=function(_0x6815f1,_0x4e6e4b,_0x286acf){return db[_0xff95('0x40')][_0xff95('0x5e')]({'where':{'id':_0x6815f1[_0xff95('0x57')]['id']}})['then'](handleEntityNotFound(_0x4e6e4b,null))[_0xff95('0x20')](function(_0x479d26){if(_0x479d26){return _0x479d26[_0xff95('0x69')](_0x6815f1[_0xff95('0x47')][_0xff95('0x6a')]);}})[_0xff95('0x20')](respondWithStatusCode(_0x4e6e4b,null))[_0xff95('0x29')](handleError(_0x4e6e4b,null));};exports[_0xff95('0x6b')]=function(_0x7b69d7,_0x1d2d78,_0x280508){if(_0x7b69d7[_0xff95('0x5a')]['id']){delete _0x7b69d7[_0xff95('0x5a')]['id'];}return db[_0xff95('0x40')][_0xff95('0x5e')]({'where':{'id':_0x7b69d7[_0xff95('0x57')]['id']}})['then'](handleEntityNotFound(_0x1d2d78,null))[_0xff95('0x20')](function(_0x15cf83){if(_0x15cf83){_0x7b69d7[_0xff95('0x5a')][_0xff95('0x62')]=_0x15cf83['id'];return db[_0xff95('0x6c')][_0xff95('0x59')](_0x7b69d7['body']);}})[_0xff95('0x20')](respondWithResult(_0x1d2d78,null))[_0xff95('0x29')](handleError(_0x1d2d78,null));};exports[_0xff95('0x6d')]=function(_0x3aa31d,_0x4461a2,_0x46946b){var _0x1a2080={'raw':![],'where':{}};var _0x2730e3={};var _0x19e8d2={'count':0x0,'rows':[]};return db[_0xff95('0x40')][_0xff95('0x65')]({'where':{'id':_0x3aa31d[_0xff95('0x57')]['id']}})[_0xff95('0x20')](handleEntityNotFound(_0x4461a2,null))[_0xff95('0x20')](function(_0x16e596){if(_0x16e596){_0x2730e3['model']=_['keys'](db['CannedAnswer'][_0xff95('0x41')]);_0x2730e3['query']=_['keys'](_0x3aa31d[_0xff95('0x47')]);_0x2730e3['filters']=_[_0xff95('0x48')](_0x2730e3[_0xff95('0x45')],_0x2730e3['query']);_0x1a2080[_0xff95('0x49')]=_[_0xff95('0x48')](_0x2730e3[_0xff95('0x45')],qs[_0xff95('0x4a')](_0x3aa31d['query']['fields']));_0x1a2080[_0xff95('0x49')]=_0x1a2080['attributes'][_0xff95('0x58')]?_0x1a2080[_0xff95('0x49')]:_0x2730e3[_0xff95('0x45')];if(!_0x3aa31d[_0xff95('0x47')][_0xff95('0x4b')](_0xff95('0x4c'))){_0x1a2080[_0xff95('0x30')]=qs[_0xff95('0x30')](_0x3aa31d[_0xff95('0x47')][_0xff95('0x30')]);_0x1a2080[_0xff95('0x2f')]=qs[_0xff95('0x2f')](_0x3aa31d[_0xff95('0x47')][_0xff95('0x2f')]);}_0x1a2080[_0xff95('0x4d')]=qs['sort'](_0x3aa31d[_0xff95('0x47')][_0xff95('0x4e')]);_0x1a2080['where']=qs['filters'](_['pick'](_0x3aa31d['query'],_0x2730e3[_0xff95('0x50')]));_0x1a2080[_0xff95('0x4f')][_0xff95('0x62')]=_0x16e596['id'];if(_0x3aa31d[_0xff95('0x47')][_0xff95('0x53')]){_0x1a2080[_0xff95('0x4f')]=_[_0xff95('0x52')](_0x1a2080['where'],{'$or':_[_0xff95('0x3f')](_0x1a2080[_0xff95('0x49')],function(_0x287c31){var _0x3b5d93={};_0x3b5d93[_0x287c31]={'$like':'%'+_0x3aa31d[_0xff95('0x47')][_0xff95('0x53')]+'%'};return _0x3b5d93;})});}_0x1a2080=_[_0xff95('0x52')]({},_0x1a2080,_0x3aa31d[_0xff95('0x66')]);return db[_0xff95('0x6c')]['count']({'where':_0x1a2080[_0xff95('0x4f')]})[_0xff95('0x20')](function(_0x472e5a){_0x19e8d2[_0xff95('0x2e')]=_0x472e5a;if(_0x3aa31d[_0xff95('0x47')][_0xff95('0x54')]){_0x1a2080[_0xff95('0x67')]=[{'all':!![]}];}return db[_0xff95('0x6c')][_0xff95('0x68')](_0x1a2080);})[_0xff95('0x20')](function(_0x2c6804){_0x19e8d2['rows']=_0x2c6804;return _0x19e8d2;});}})[_0xff95('0x20')](respondWithFilteredResult(_0x4461a2,_0x1a2080))[_0xff95('0x29')](handleError(_0x4461a2,null));};exports['removeAnswers']=function(_0x5f012a,_0x1d5de5,_0xbd48dd){return db['FaxAccount']['find']({'where':{'id':_0x5f012a[_0xff95('0x57')]['id']}})['then'](handleEntityNotFound(_0x1d5de5,null))[_0xff95('0x20')](function(_0xd69789){if(_0xd69789){return _0xd69789[_0xff95('0x6e')](_0x5f012a['query'][_0xff95('0x6a')]);}})[_0xff95('0x20')](respondWithStatusCode(_0x1d5de5,null))[_0xff95('0x29')](handleError(_0x1d5de5,null));};exports['addInteraction']=function(_0x11f2b2,_0x554178,_0x1e46e4){return db['FaxInteraction'][_0xff95('0x5e')]({'where':{'id':_0x11f2b2['params']['id']}})[_0xff95('0x20')](handleEntityNotFound(_0x554178,null))[_0xff95('0x20')](function(_0x1cf806){if(_0x1cf806){return _0x1cf806['addInteraction'](_0x11f2b2[_0xff95('0x5a')][_0xff95('0x6a')],_[_0xff95('0x6f')](_0x11f2b2[_0xff95('0x5a')],['ids','id'])||{});}})['then'](respondWithResult(_0x554178,null))[_0xff95('0x29')](handleError(_0x554178,null));};exports[_0xff95('0x70')]=function(_0x16f436,_0x54ada7,_0x2ed68c){var _0x351050={'raw':![],'where':{}};var _0x76b843={};var _0x13f62d={'count':0x0,'rows':[]};return db[_0xff95('0x40')][_0xff95('0x65')]({'where':{'id':_0x16f436[_0xff95('0x57')]['id']}})[_0xff95('0x20')](handleEntityNotFound(_0x54ada7,null))[_0xff95('0x20')](function(_0x215e42){if(_0x215e42){_0x76b843[_0xff95('0x45')]=_[_0xff95('0x46')](db[_0xff95('0x71')][_0xff95('0x41')]);_0x76b843[_0xff95('0x47')]=_[_0xff95('0x46')](_0x16f436['query']);_0x76b843[_0xff95('0x50')]=_[_0xff95('0x48')](_0x76b843[_0xff95('0x45')],_0x76b843[_0xff95('0x47')]);_0x351050[_0xff95('0x49')]=_[_0xff95('0x48')](_0x76b843[_0xff95('0x45')],qs[_0xff95('0x4a')](_0x16f436[_0xff95('0x47')]['fields']));_0x351050['attributes']=_0x351050[_0xff95('0x49')]['length']?_0x351050[_0xff95('0x49')]:_0x76b843[_0xff95('0x45')];if(!_0x16f436[_0xff95('0x47')][_0xff95('0x4b')](_0xff95('0x4c'))){_0x351050['limit']=qs[_0xff95('0x30')](_0x16f436[_0xff95('0x47')][_0xff95('0x30')]);_0x351050['offset']=qs[_0xff95('0x2f')](_0x16f436[_0xff95('0x47')]['offset']);}_0x351050[_0xff95('0x4d')]=qs['sort'](_0x16f436[_0xff95('0x47')]['sort']);_0x351050[_0xff95('0x4f')]=qs[_0xff95('0x50')](_[_0xff95('0x51')](_0x16f436[_0xff95('0x47')],_0x76b843['filters']));_0x351050['where'][_0xff95('0x62')]=_0x215e42['id'];if(_0x16f436['query'][_0xff95('0x53')]){_0x351050['where']=_[_0xff95('0x52')](_0x351050[_0xff95('0x4f')],{'$or':_[_0xff95('0x3f')](_0x351050[_0xff95('0x49')],function(_0x52d0b6){var _0x4053ad={};_0x4053ad[_0x52d0b6]={'$like':'%'+_0x16f436[_0xff95('0x47')][_0xff95('0x53')]+'%'};return _0x4053ad;})});}_0x351050=_['merge']({},_0x351050,_0x16f436[_0xff95('0x66')]);return db['FaxInteraction'][_0xff95('0x2e')]({'where':_0x351050['where']})[_0xff95('0x20')](function(_0x13b768){_0x13f62d[_0xff95('0x2e')]=_0x13b768;if(_0x16f436['query'][_0xff95('0x54')]){_0x351050['include']=[{'model':db[_0xff95('0x72')],'as':_0xff95('0x73'),'required':![]},{'model':db[_0xff95('0x74')],'as':_0xff95('0x75'),'attributes':[_0xff95('0x3a'),_0xff95('0x76'),_0xff95('0x77')],'required':![]},{'model':db['Tag'],'as':_0xff95('0x78'),'attributes':['id',_0xff95('0x3a'),_0xff95('0x79')],'where':_0x16f436['query'][_0xff95('0x7a')]?{'id':_0x16f436['query'][_0xff95('0x7a')]}:undefined,'required':_0x16f436[_0xff95('0x47')][_0xff95('0x7a')]?!![]:![]}];}return db[_0xff95('0x71')]['findAll'](_0x351050);})[_0xff95('0x20')](function(_0x55d285){_0x13f62d[_0xff95('0x55')]=_0x55d285;return _0x13f62d;});}})[_0xff95('0x20')](respondWithFilteredResult(_0x54ada7,_0x351050))[_0xff95('0x29')](handleError(_0x54ada7,null));};exports['addApplications']=function(_0x165376,_0x49048d){var _0x5ebf35=_0x165376[_0xff95('0x57')]['id'];var _0x16c528=_0x165376['body'];var _0x3bb6df=0xc8;var _0x1dd05d=null;return db['sequelize'][_0xff95('0x7b')]({'isolationLevel':db[_0xff95('0x7c')]['Transaction'][_0xff95('0x7d')]['READ_COMMITTED']},function(_0xbc6e68){return db[_0xff95('0x40')][_0xff95('0x65')]({'where':{'id':_0x5ebf35},'transaction':_0xbc6e68})[_0xff95('0x20')](function(_0x1196fb){if(_0x1196fb){return db[_0xff95('0x7e')]['destroy']({'where':{'FaxAccountId':_0x5ebf35},'transaction':_0xbc6e68})[_0xff95('0x20')](function(){var _0x26e142=_[_0xff95('0x3f')](_0x16c528,function(_0x228fed){_0x228fed[_0xff95('0x62')]=_0x5ebf35;return _0x228fed;});return db[_0xff95('0x7e')][_0xff95('0x7f')](_0x26e142,{'transaction':_0xbc6e68});});}else{_0x3bb6df=0x194;_0x1dd05d=[];}});})['then'](function(){if(_0x3bb6df!==0x194){return db['FaxApplication'][_0xff95('0x80')]({'where':{'FaxAccountId':_0x5ebf35},'order':'priority'})['then'](function(_0x3258d2){_0x1dd05d=_0x3258d2;});}})['catch'](function(_0x23ad7f){_0x3bb6df=0x1f4;logger[_0xff95('0x25')](_0x23ad7f[_0xff95('0x39')]);if(_0x23ad7f[_0xff95('0x3a')]){delete _0x23ad7f[_0xff95('0x3a')];}_0x1dd05d=_0x23ad7f;})[_0xff95('0x81')](function(){if(_0x1dd05d===null){_0x49048d[_0xff95('0x82')](_0x3bb6df);}else{if(_0x3bb6df===0x1f4){_0x49048d['status'](_0x3bb6df)['send'](_0x1dd05d);}else{_0x49048d[_0xff95('0x2a')](_0x3bb6df)[_0xff95('0x2c')](_0x1dd05d);}}});};exports[_0xff95('0x83')]=function(_0x5d0805,_0x5958db,_0x1e0c92){var _0x379276={};var _0x5dea3b={};var _0x2a7e78;var _0x91640d;return db[_0xff95('0x40')]['findOne']({'where':{'id':_0x5d0805[_0xff95('0x57')]['id']}})[_0xff95('0x20')](handleEntityNotFound(_0x5958db,null))[_0xff95('0x20')](function(_0x816ccb){if(_0x816ccb){_0x2a7e78=_0x816ccb;_0x5dea3b['model']=_['keys'](db[_0xff95('0x7e')][_0xff95('0x41')]);_0x5dea3b[_0xff95('0x47')]=_['keys'](_0x5d0805[_0xff95('0x47')]);_0x5dea3b[_0xff95('0x50')]=_[_0xff95('0x48')](_0x5dea3b[_0xff95('0x45')],_0x5dea3b['query']);_0x379276['attributes']=_[_0xff95('0x48')](_0x5dea3b[_0xff95('0x45')],qs[_0xff95('0x4a')](_0x5d0805[_0xff95('0x47')]['fields']));_0x379276[_0xff95('0x49')]=_0x379276[_0xff95('0x49')][_0xff95('0x58')]?_0x379276[_0xff95('0x49')]:_0x5dea3b[_0xff95('0x45')];_0x379276[_0xff95('0x4d')]=qs[_0xff95('0x4e')](_0x5d0805[_0xff95('0x47')][_0xff95('0x4e')]);_0x379276[_0xff95('0x4f')]=qs[_0xff95('0x50')](_[_0xff95('0x51')](_0x5d0805[_0xff95('0x47')],_0x5dea3b[_0xff95('0x50')]));if(_0x5d0805[_0xff95('0x47')][_0xff95('0x53')]){_0x379276[_0xff95('0x4f')]=_[_0xff95('0x52')](_0x379276[_0xff95('0x4f')],{'$or':_['map'](_0x379276[_0xff95('0x49')],function(_0x2a4a84){var _0x3b75bf={};_0x3b75bf[_0x2a4a84]={'$like':'%'+_0x5d0805[_0xff95('0x47')][_0xff95('0x53')]+'%'};return _0x3b75bf;})});}_0x379276=_[_0xff95('0x52')]({},_0x379276,_0x5d0805[_0xff95('0x66')]);return _0x2a7e78['getApplications'](_0x379276);}})[_0xff95('0x20')](function(_0x85123a){if(_0x85123a){_0x91640d=_0x85123a[_0xff95('0x58')];if(!_0x5d0805[_0xff95('0x47')][_0xff95('0x4b')](_0xff95('0x4c'))){_0x379276[_0xff95('0x30')]=qs[_0xff95('0x30')](_0x5d0805[_0xff95('0x47')]['limit']);_0x379276[_0xff95('0x2f')]=qs[_0xff95('0x2f')](_0x5d0805[_0xff95('0x47')]['offset']);}return _0x2a7e78['getApplications'](_0x379276);}})[_0xff95('0x20')](function(_0x5db45e){if(_0x5db45e){return _0x5db45e?{'count':_0x91640d,'rows':_0x5db45e}:null;}})[_0xff95('0x20')](respondWithResult(_0x5958db,null))[_0xff95('0x29')](handleError(_0x5958db,null));};function Extension(_0x5ee563,_0x378c02,_0x3e2f5c,_0x3c6d3a){this[_0xff95('0x84')]=_0xff95('0x85');this[_0xff95('0x86')]=_0x5ee563[_0xff95('0x87')];this['app']=_0x3c6d3a;this[_0xff95('0x43')]=_0xff95('0x88');this[_0xff95('0x89')]='Fax\x20Extension';this[_0xff95('0x62')]=_0x5ee563['id'];this[_0xff95('0x8a')]=_0x378c02;this[_0xff95('0x8b')]=_0x3e2f5c;}function createExtensionsReciveFax(_0x5dca3f){var _0x2fcb7a=0x1;var _0x462105=[];_0x462105['push'](new Extension(_0x5dca3f,_0x2fcb7a,'',_0xff95('0x8c')));_0x2fcb7a+=0x1;_0x462105[_0xff95('0x8d')](new Extension(_0x5dca3f,_0x2fcb7a,_0xff95('0x8e'),'Set'));_0x2fcb7a+=0x1;for(var _0x4667b6 in _0x5dca3f){if(_0x5dca3f['hasOwnProperty'](_0x4667b6)&&(_0x4667b6===_0xff95('0x8f')||_0x4667b6===_0xff95('0x87')||_0x4667b6===_0xff95('0x90')||_0x4667b6==='faxdetect'||_0x4667b6===_0xff95('0x91')||_0x4667b6===_0xff95('0x92')||_0x4667b6==='minrate'||_0x4667b6===_0xff95('0x93')||_0x4667b6==='t38timeout')){_0x462105[_0xff95('0x8d')](new Extension(_0x5dca3f,_0x2fcb7a,'FAXOPT('+_0x4667b6+')='+_0x5dca3f[_0x4667b6],'Set'));_0x2fcb7a+=0x1;}}_0x462105[_0xff95('0x8d')](new Extension(_0x5dca3f,_0x2fcb7a,'6',_0xff95('0x94')));_0x2fcb7a+=0x1;_0x462105['push'](new Extension(_0x5dca3f,_0x2fcb7a,_0xff95('0x95'),_0xff95('0x96')));_0x2fcb7a=0x0;return _0x462105;}exports[_0xff95('0x97')]=function(_0x3b25d2,_0x26b1ac,_0x51b413){var _0xab3042;return db[_0xff95('0x7c')][_0xff95('0x7b')](function(_0x1e0e0e){return db[_0xff95('0x40')]['create'](_0x3b25d2[_0xff95('0x5a')],{'transaction':_0x1e0e0e})[_0xff95('0x20')](function(_0x4680b2){_0xab3042=_0x4680b2['get']({'plain':!![]});return db[_0xff95('0x98')][_0xff95('0x7f')](createExtensionsReciveFax(_0xab3042),{'transaction':_0x1e0e0e});});})[_0xff95('0x20')](function(){return _0xab3042;})[_0xff95('0x20')](respondWithResult(_0x26b1ac,null))[_0xff95('0x29')](handleError(_0x26b1ac,null));};exports[_0xff95('0x99')]=function(_0x55e3b0,_0x4c7d7c,_0x2bc368){var _0x2d3c94;return db[_0xff95('0x7c')]['transaction'](function(_0x152539){return db[_0xff95('0x40')]['update'](_0x55e3b0[_0xff95('0x5a')],{'where':{'id':_0x55e3b0[_0xff95('0x5a')]['id']},'transaction':_0x152539})[_0xff95('0x20')](function(_0x278812){return db['VoiceExtension'][_0xff95('0x35')]({'where':{'FaxAccountId':_0x55e3b0[_0xff95('0x5a')]['id']},'transaction':_0x152539})['then'](function(_0x561e24){return db[_0xff95('0x98')][_0xff95('0x7f')](createExtensionsReciveFax(_[_0xff95('0x6f')](_0x55e3b0[_0xff95('0x5a')],['tech',_0xff95('0x44'),'createdAt','updatedAt','TrunkId',_0xff95('0x9a')])),{'transaction':_0x152539});});});})['then'](function(){return db['FaxAccount'][_0xff95('0x9b')](_0x55e3b0[_0xff95('0x5a')]['id']);})[_0xff95('0x20')](respondWithResult(_0x4c7d7c,null))['catch'](handleError(_0x4c7d7c,null));};exports[_0xff95('0x9c')]=function(_0x4f99b1,_0x3aff8e,_0x5b1a9){var _0x437f39={'raw':!![],'where':{}};var _0x182ab6={};var _0x4f1606={'count':0x0,'rows':[]};return db[_0xff95('0x40')][_0xff95('0x65')]({'where':{'id':_0x4f99b1['params']['id']}})[_0xff95('0x20')](handleEntityNotFound(_0x3aff8e,null))[_0xff95('0x20')](function(_0x50e721){if(_0x50e721){_0x182ab6['model']=_['keys'](db[_0xff95('0x9d')]['rawAttributes']);_0x182ab6['query']=_['keys'](_0x4f99b1['query']);_0x182ab6[_0xff95('0x50')]=_[_0xff95('0x48')](_0x182ab6[_0xff95('0x45')],_0x182ab6[_0xff95('0x47')]);_0x437f39[_0xff95('0x49')]=_['intersection'](_0x182ab6[_0xff95('0x45')],qs[_0xff95('0x4a')](_0x4f99b1[_0xff95('0x47')][_0xff95('0x4a')]));_0x437f39['attributes']=_0x437f39[_0xff95('0x49')]['length']?_0x437f39['attributes']:_0x182ab6[_0xff95('0x45')];if(!_0x4f99b1[_0xff95('0x47')]['hasOwnProperty'](_0xff95('0x4c'))){_0x437f39[_0xff95('0x30')]=qs[_0xff95('0x30')](_0x4f99b1[_0xff95('0x47')]['limit']);_0x437f39['offset']=qs['offset'](_0x4f99b1['query']['offset']);}_0x437f39['order']=qs[_0xff95('0x4e')](_0x4f99b1['query'][_0xff95('0x4e')]);_0x437f39[_0xff95('0x4f')]=qs['filters'](_[_0xff95('0x51')](_0x4f99b1[_0xff95('0x47')],_0x182ab6[_0xff95('0x50')]));_0x437f39[_0xff95('0x4f')]['FaxAccountId']=_0x50e721['id'];if(_0x4f99b1[_0xff95('0x47')]['filter']){_0x437f39[_0xff95('0x4f')]=_[_0xff95('0x52')](_0x437f39[_0xff95('0x4f')],{'$or':_[_0xff95('0x3f')](_0x437f39[_0xff95('0x49')],function(_0x3c417d){var _0x3930cf={};_0x3930cf[_0x3c417d]={'$like':'%'+_0x4f99b1[_0xff95('0x47')][_0xff95('0x53')]+'%'};return _0x3930cf;})});}if(_0x4f99b1[_0xff95('0x47')][_0xff95('0x9e')]){var _0x32332a=_0x4f99b1[_0xff95('0x47')][_0xff95('0x9e')][_0xff95('0x9f')](',');var _0x3ee6ed={};_0x3ee6ed[_0x32332a[0x0]]={'$gte':moment(_0x32332a[0x1])[_0xff95('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x437f39[_0xff95('0x4f')]=_[_0xff95('0x52')](_0x437f39[_0xff95('0x4f')],_0x3ee6ed);}_0x437f39=_[_0xff95('0x52')]({},_0x437f39,_0x4f99b1[_0xff95('0x66')]);return db['FaxMessage'][_0xff95('0x2e')]({'where':_0x437f39[_0xff95('0x4f')]})[_0xff95('0x20')](function(_0x1ee34c){_0x4f1606[_0xff95('0x2e')]=_0x1ee34c;if(_0x4f99b1[_0xff95('0x47')][_0xff95('0x54')]){_0x437f39[_0xff95('0x67')]=[{'all':!![]}];}return db[_0xff95('0x9d')]['findAll'](_0x437f39);})[_0xff95('0x20')](function(_0x5f57a7){_0x4f1606[_0xff95('0x55')]=_0x5f57a7;return _0x4f1606;});}})[_0xff95('0x20')](respondWithFilteredResult(_0x3aff8e,_0x437f39))[_0xff95('0x29')](handleError(_0x3aff8e,null));};exports[_0xff95('0x3b')]=function(_0x5b9100,_0x20ef22,_0x381787){var _0x551b38,_0x109c6a={},_0x5b5bd9;if(_0x5b9100[_0xff95('0x5a')]['to']){_0x5b5bd9=_0x5b9100[_0xff95('0x5a')]['to'][0x0];}return db[_0xff95('0x40')][_0xff95('0x5e')]({'where':{'id':_0x5b9100[_0xff95('0x57')]['id']},'include':[{'model':db[_0xff95('0xa1')],'as':'List','include':[{'model':db[_0xff95('0x72')],'as':_0xff95('0xa2'),'where':{'fax':_0x5b5bd9},'limit':0x1,'order':[['updatedAt',_0xff95('0xa3')]]}]}]})[_0xff95('0x20')](handleEntityNotFound(_0x20ef22,null))[_0xff95('0x20')](function(_0x33eca0){_0x551b38=_0x33eca0;if(_0x5b9100[_0xff95('0x5a')][_0xff95('0xa4')]&&_0x5b9100[_0xff95('0x5a')]['attachments'][_0xff95('0x58')]){for(var _0x3fda44=0x0;_0x3fda44<_0x5b9100[_0xff95('0x5a')][_0xff95('0xa4')][_0xff95('0x58')];_0x3fda44+=0x1){_0x5b9100[_0xff95('0x5a')]['attachments'][_0x3fda44]={'filename':_0x5b9100[_0xff95('0x5a')][_0xff95('0xa4')][_0x3fda44][_0xff95('0x3a')],'id':_0x5b9100[_0xff95('0x5a')][_0xff95('0xa4')][_0x3fda44]['id'],'path':path[_0xff95('0xa5')](config['root'],_0xff95('0xa6'),_0x5b9100['body']['attachments'][_0x3fda44][_0xff95('0xa7')])};}}return respondWithRpcPromise('CheckAfterSend',_0xff95('0xa8'),{'FaxAccountId':_[_0xff95('0xa9')](_0x5b9100[_0xff95('0x57')]['id'])?undefined:_0x5b9100[_0xff95('0x57')]['id'],'path':_['isNil'](_0x5b9100[_0xff95('0x5a')]['attachments'][0x0][_0xff95('0x7')])?undefined:_0x5b9100['body'][_0xff95('0xa4')][0x0][_0xff95('0x7')],'fax':_[_0xff95('0xa9')](_0x5b9100[_0xff95('0x5a')]['to'][0x0])?undefined:_0x5b9100[_0xff95('0x5a')]['to'][0x0]},client9002);})[_0xff95('0x20')](function(){if(_0x551b38){if(_[_0xff95('0xa9')](_0x5b9100[_0xff95('0x5a')]['from'])){_0x5b9100[_0xff95('0x5a')][_0xff95('0xaa')]=util[_0xff95('0xa0')](_0xff95('0xab'),_0x551b38[_0xff95('0x3a')],_0x551b38[_0xff95('0xac')]);}if(_0x551b38[_0xff95('0xad')]){if(_0x551b38[_0xff95('0xad')][_0xff95('0xa2')][_0xff95('0x58')]){return _0x551b38[_0xff95('0xad')][_0xff95('0xa2')][0x0];}else{return db[_0xff95('0x72')][_0xff95('0x59')](_['defaults'](_0x5b9100[_0xff95('0x5a')],{'firstName':_0x5b9100['body']['to'][0x0],'phone':_0x5b9100['body']['to'][0x0],'fax':_0x5b9100[_0xff95('0x5a')]['to'][0x0],'ListId':_0x551b38['ListId']}));}}else{throw new Error(_0xff95('0xae'));}}else{throw new Error(_0xff95('0xaf'));}})[_0xff95('0x20')](function(_0x30899e){if(_0x30899e){return db['FaxInteraction'][_0xff95('0x5e')]({'where':{'ContactId':_0x30899e['id'],'closed':![],'FaxAccountId':_0x551b38['id']}})['then'](function(_0x30cb1a){if(_0x30cb1a){return[_0x30cb1a,![]];}return db[_0xff95('0x71')][_0xff95('0x59')]({'UserId':_0x5b9100[_0xff95('0x5b')]['id'],'ContactId':_0x30899e['id'],'FaxAccountId':_0x551b38['id'],'fax':_0x5b9100[_0xff95('0x5a')]['to'][0x0],'firstMsgDirection':_0xff95('0xb0'),'Messages':[_[_0xff95('0x52')](_0x5b9100[_0xff95('0x5a')],{'read':![],'body':_0x5b9100[_0xff95('0x5a')][_0xff95('0xa4')][0x0][_0xff95('0xb1')],'FaxAccountId':_0x551b38['id'],'UserId':_0x5b9100[_0xff95('0x5b')]['id'],'ContactId':_0x30899e['id'],'AttachmentId':_0x5b9100[_0xff95('0x5a')][_0xff95('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0xff95('0x9d')],'as':'Messages'}]})[_0xff95('0x20')](function(_0x2ae9b2){return[_0x2ae9b2,!![]];});});}else{throw new Error(_0xff95('0xb2'));}})[_0xff95('0xb3')](function(_0x47bee9,_0x41f08b){if(_0x41f08b){return _0x47bee9;}return db[_0xff95('0x9d')][_0xff95('0x59')]({'direction':_0xff95('0xb0'),'read':![],'body':_0x5b9100[_0xff95('0x5a')]['attachments'][0x0][_0xff95('0xb1')],'FaxAccountId':_0x551b38['id'],'FaxInteractionId':_0x47bee9['id'],'UserId':_0x5b9100[_0xff95('0x5b')]['id'],'ContactId':_0x47bee9[_0xff95('0xb4')],'AttachmentId':_0x5b9100['body'][_0xff95('0xa4')][0x0]['id']})[_0xff95('0x20')](function(_0x3f19e9){_0x47bee9['dataValues'][_0xff95('0xb5')]=[];_0x47bee9[_0xff95('0xb6')][_0xff95('0xb5')][_0xff95('0x8d')](_0x3f19e9[_0xff95('0xb6')]);return _0x47bee9;});})[_0xff95('0x20')](function(_0x3f9abf){respondWithRpcPromise(_0xff95('0xb7'),_0xff95('0xb7'),{'FaxAccountId':_[_0xff95('0xa9')](_0x5b9100['params']['id'])?undefined:_0x5b9100[_0xff95('0x57')]['id'],'path':_[_0xff95('0xa9')](_0x5b9100[_0xff95('0x5a')]['attachments'][0x0][_0xff95('0x7')])?undefined:_0x5b9100[_0xff95('0x5a')][_0xff95('0xa4')][0x0][_0xff95('0x7')],'fax':_[_0xff95('0xa9')](_0x5b9100[_0xff95('0x5a')]['to'][0x0])?undefined:_0x5b9100[_0xff95('0x5a')]['to'][0x0],'AttachmentId':_0x5b9100[_0xff95('0x5a')]['attachments'][0x0]['id']},client9002)['then'](function(_0x3c528d){logger[_0xff95('0xb8')]('SendFaxRpc,\x20%s',_0x3c528d);})[_0xff95('0x29')](function(_0xa4692b){logger[_0xff95('0xb8')](_0xff95('0xb9'),_0xa4692b);});return _0x3f9abf;})[_0xff95('0x20')](respondWithResult(_0x20ef22,null))[_0xff95('0x29')](handleError(_0x20ef22,null));};exports[_0xff95('0xba')]=function(_0x645f94,_0x1d201f,_0x42e38a){return db[_0xff95('0x40')][_0xff95('0x5e')]({'where':{'id':_0x645f94['params']['id']}})[_0xff95('0x20')](handleEntityNotFound(_0x1d201f,null))[_0xff95('0x20')](function(_0x2ce50b){if(_0x2ce50b){return _0x2ce50b[_0xff95('0xba')](_0x645f94[_0xff95('0x5a')][_0xff95('0x6a')],_[_0xff95('0x6f')](_0x645f94[_0xff95('0x5a')],[_0xff95('0x6a'),'id'])||{})[_0xff95('0xb3')](function(_0x5bcd05){for(var _0x3ba6d1=0x0;_0x3ba6d1<_0x645f94[_0xff95('0x5a')][_0xff95('0x6a')][_0xff95('0x58')];_0x3ba6d1+=0x1){socket[_0xff95('0xbb')](_0xff95('0xbc'),{'UserId':Number(_0x645f94['body'][_0xff95('0x6a')][_0x3ba6d1]),'FaxAccountId':Number(_0x645f94[_0xff95('0x57')]['id'])});}return _0x5bcd05;});}})['then'](respondWithResult(_0x1d201f,null))[_0xff95('0x29')](handleError(_0x1d201f,null));};exports['removeAgents']=function(_0x2c1e18,_0x1e5c97,_0x3e5852){return db[_0xff95('0x40')][_0xff95('0x5e')]({'where':{'id':_0x2c1e18['params']['id']}})[_0xff95('0x20')](handleEntityNotFound(_0x1e5c97,null))['then'](function(_0x441db4){if(_0x441db4){return _0x441db4[_0xff95('0xbd')](_0x2c1e18[_0xff95('0x47')][_0xff95('0x6a')])[_0xff95('0x20')](function(){if(_[_0xff95('0xbe')](_0x2c1e18[_0xff95('0x47')][_0xff95('0x6a')])){for(var _0x3a4923=0x0;_0x3a4923<_0x2c1e18['query'][_0xff95('0x6a')][_0xff95('0x58')];_0x3a4923+=0x1){socket[_0xff95('0xbb')](_0xff95('0xbf'),{'UserId':Number(_0x2c1e18[_0xff95('0x47')][_0xff95('0x6a')][_0x3a4923]),'FaxAccountId':Number(_0x2c1e18[_0xff95('0x57')]['id'])});}}else{socket['emit'](_0xff95('0xbf'),{'UserId':Number(_0x2c1e18[_0xff95('0x47')][_0xff95('0x6a')]),'FaxAccountId':Number(_0x2c1e18['params']['id'])});}});}})[_0xff95('0x20')](respondWithStatusCode(_0x1e5c97,null))[_0xff95('0x29')](handleError(_0x1e5c97,null));};exports[_0xff95('0xc0')]=function(_0x4ea067,_0x3f5621,_0x452b39){var _0x443718={};var _0x211b4e={};var _0x37959a;var _0x1178f1;return db['FaxAccount']['findOne']({'where':{'id':_0x4ea067[_0xff95('0x57')]['id']}})['then'](handleEntityNotFound(_0x3f5621,null))[_0xff95('0x20')](function(_0x27e445){if(_0x27e445){_0x37959a=_0x27e445;_0x211b4e[_0xff95('0x45')]=_['keys'](db[_0xff95('0x74')][_0xff95('0x41')]);_0x211b4e[_0xff95('0x47')]=_[_0xff95('0x46')](_0x4ea067[_0xff95('0x47')]);_0x211b4e[_0xff95('0x50')]=_[_0xff95('0x48')](_0x211b4e[_0xff95('0x45')],_0x211b4e[_0xff95('0x47')]);_0x443718[_0xff95('0x49')]=_['intersection'](_0x211b4e[_0xff95('0x45')],qs['fields'](_0x4ea067[_0xff95('0x47')][_0xff95('0x4a')]));_0x443718[_0xff95('0x49')]=_0x443718[_0xff95('0x49')][_0xff95('0x58')]?_0x443718['attributes']:_0x211b4e[_0xff95('0x45')];_0x443718['order']=qs[_0xff95('0x4e')](_0x4ea067['query'][_0xff95('0x4e')]);_0x443718[_0xff95('0x4f')]=qs[_0xff95('0x50')](_[_0xff95('0x51')](_0x4ea067[_0xff95('0x47')],_0x211b4e['filters']));if(_0x4ea067[_0xff95('0x47')][_0xff95('0x53')]){_0x443718[_0xff95('0x4f')]=_[_0xff95('0x52')](_0x443718[_0xff95('0x4f')],{'$or':_[_0xff95('0x3f')](_0x443718[_0xff95('0x49')],function(_0xf4a34){var _0x4d16e1={};_0x4d16e1[_0xf4a34]={'$like':'%'+_0x4ea067[_0xff95('0x47')][_0xff95('0x53')]+'%'};return _0x4d16e1;})});}_0x443718=_['merge']({},_0x443718,_0x4ea067[_0xff95('0x66')]);return _0x37959a['getAgents'](_0x443718);}})['then'](function(_0x1b7c72){if(_0x1b7c72){_0x1178f1=_0x1b7c72[_0xff95('0x58')];if(!_0x4ea067[_0xff95('0x47')][_0xff95('0x4b')](_0xff95('0x4c'))){_0x443718[_0xff95('0x30')]=qs[_0xff95('0x30')](_0x4ea067['query'][_0xff95('0x30')]);_0x443718[_0xff95('0x2f')]=qs[_0xff95('0x2f')](_0x4ea067[_0xff95('0x47')][_0xff95('0x2f')]);}return _0x37959a['getAgents'](_0x443718);}})[_0xff95('0x20')](function(_0x345d90){if(_0x345d90){return _0x345d90?{'count':_0x1178f1,'rows':_0x345d90}:null;}})[_0xff95('0x20')](respondWithResult(_0x3f5621,null))[_0xff95('0x29')](handleError(_0x3f5621,null));}; \ No newline at end of file +var _0x14c4=['VIRTUAL','FaxAccount','includeAll','include','findAll','catch','show','params','Pause','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','filter','rows','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','priority','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','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','ReceiveFax','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x14c4,0x142));var _0x414c=function(_0xea1570,_0x2f7856){_0xea1570=_0xea1570-0x0;var _0x579e74=_0x14c4[_0xea1570];return _0x579e74;};'use strict';var emlformat=require(_0x414c('0x0'));var rimraf=require(_0x414c('0x1'));var zipdir=require(_0x414c('0x2'));var jsonpatch=require(_0x414c('0x3'));var rp=require(_0x414c('0x4'));var moment=require('moment');var BPromise=require(_0x414c('0x5'));var Mustache=require(_0x414c('0x6'));var util=require(_0x414c('0x7'));var path=require(_0x414c('0x8'));var sox=require(_0x414c('0x9'));var csv=require(_0x414c('0xa'));var ejs=require(_0x414c('0xb'));var fs=require('fs');var fs_extra=require(_0x414c('0xc'));var _=require(_0x414c('0xd'));var squel=require(_0x414c('0xe'));var crypto=require(_0x414c('0xf'));var jsforce=require(_0x414c('0x10'));var deskjs=require(_0x414c('0x11'));var toCsv=require(_0x414c('0xa'));var querystring=require('querystring');var Papa=require(_0x414c('0x12'));var Redis=require('ioredis');var authService=require(_0x414c('0x13'));var qs=require(_0x414c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x414c('0x15'))(_0x414c('0x16'));var utils=require(_0x414c('0x17'));var config=require(_0x414c('0x18'));var licenseUtil=require(_0x414c('0x19'));var db=require(_0x414c('0x1a'))['db'];config[_0x414c('0x1b')]=_[_0x414c('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x414c('0x1b')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x414c('0x1d'));var client=jayson['client'][_0x414c('0x1e')]({'port':0x232c});var client9002=jayson[_0x414c('0x1f')][_0x414c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x43ab29,_0xde3f34,_0x3c4787,_0x4f0bb9){return new BPromise(function(_0x1c1e78,_0x52dffe){var _0x112fff=_0x4f0bb9||client;return _0x112fff[_0x414c('0x20')](_0x43ab29,_0x3c4787)[_0x414c('0x21')](function(_0xda4765){logger[_0x414c('0x22')](_0x414c('0x23'),_0xde3f34,_0x414c('0x24'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0xde3f34,_0x414c('0x24'),JSON[_0x414c('0x25')](_0xda4765));if(_0xda4765[_0x414c('0x26')]){if(_0xda4765[_0x414c('0x26')][_0x414c('0x27')]===0x1f4){logger['error'](_0x414c('0x23'),_0xde3f34,_0xda4765['error'][_0x414c('0x28')]);return _0x52dffe(_0xda4765[_0x414c('0x26')][_0x414c('0x28')]);}logger[_0x414c('0x26')](_0x414c('0x23'),_0xde3f34,_0xda4765[_0x414c('0x26')][_0x414c('0x28')]);return _0x1c1e78(_0xda4765['error'][_0x414c('0x28')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0xde3f34,_0x414c('0x24'));_0x1c1e78(_0xda4765[_0x414c('0x29')][_0x414c('0x28')]);}})['catch'](function(_0x2c3442){logger[_0x414c('0x26')](_0x414c('0x23'),_0xde3f34,_0x2c3442);_0x52dffe(_0x2c3442);});});}function respondWithStatusCode(_0x1c961e,_0x31346d){_0x31346d=_0x31346d||0xcc;return function(_0x4ac95f){if(_0x4ac95f){return _0x1c961e['sendStatus'](_0x31346d);}return _0x1c961e[_0x414c('0x2a')](_0x31346d)[_0x414c('0x2b')]();};}function respondWithResult(_0x510e8d,_0x57fd8c){_0x57fd8c=_0x57fd8c||0xc8;return function(_0x5f2630){if(_0x5f2630){return _0x510e8d[_0x414c('0x2a')](_0x57fd8c)[_0x414c('0x2c')](_0x5f2630);}};}function respondWithFilteredResult(_0x107533,_0x2db081){return function(_0x27d542){if(_0x27d542){var _0x21fb3b=typeof _0x2db081[_0x414c('0x2d')]===_0x414c('0x2e')&&typeof _0x2db081[_0x414c('0x2f')]===_0x414c('0x2e');var _0x33484e=_0x27d542[_0x414c('0x30')];var _0x3f10d3=_0x21fb3b?0x0:_0x2db081[_0x414c('0x2d')];var _0x58daed=_0x21fb3b?_0x27d542['count']:_0x2db081['offset']+_0x2db081['limit'];var _0x1af681;if(_0x58daed>=_0x33484e){_0x58daed=_0x33484e;_0x1af681=0xc8;}else{_0x1af681=0xce;}_0x107533['status'](_0x1af681);return _0x107533[_0x414c('0x31')](_0x414c('0x32'),_0x3f10d3+'-'+_0x58daed+'/'+_0x33484e)['json'](_0x27d542);}return null;};}function patchUpdates(_0x4abbbb){return function(_0x512e20){try{jsonpatch[_0x414c('0x33')](_0x512e20,_0x4abbbb,!![]);}catch(_0x326c97){return BPromise[_0x414c('0x34')](_0x326c97);}return _0x512e20['save']();};}function saveUpdates(_0x4f8ec5,_0x25ecbf){return function(_0x405dc6){if(_0x405dc6){return _0x405dc6[_0x414c('0x35')](_0x4f8ec5)[_0x414c('0x21')](function(_0x3b710b){return _0x3b710b;});}return null;};}function removeEntity(_0x1daaf8,_0x74965c){return function(_0x48f724){if(_0x48f724){return _0x48f724[_0x414c('0x36')]()[_0x414c('0x21')](function(){var _0x18f4ae=_0x48f724[_0x414c('0x37')]({'plain':!![]});var _0x2de84c='FaxAccounts';return db[_0x414c('0x38')][_0x414c('0x36')]({'where':{'type':_0x2de84c,'resourceId':_0x18f4ae['id']}})[_0x414c('0x21')](function(){return _0x48f724;});})[_0x414c('0x21')](function(){_0x1daaf8[_0x414c('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d0c0,_0x531a89){return function(_0x30c2b8){if(!_0x30c2b8){_0x19d0c0[_0x414c('0x39')](0x194);}return _0x30c2b8;};}function handleError(_0x210298,_0x176a04){_0x176a04=_0x176a04||0x1f4;return function(_0x1e884c){logger[_0x414c('0x26')](_0x1e884c[_0x414c('0x3a')]);if(_0x1e884c[_0x414c('0x3b')]){delete _0x1e884c[_0x414c('0x3b')];}_0x210298[_0x414c('0x2a')](_0x176a04)[_0x414c('0x3c')](_0x1e884c);};}exports[_0x414c('0x3d')]=function(_0x4d97a2,_0x4bdb16){var _0x3464cf={'include':[{'model':db['Pause'],'as':_0x414c('0x3e')}]},_0x30d9bb={},_0x5ae4b3={'count':0x0,'rows':[]};var _0x1b13fe=_[_0x414c('0x3f')](db['FaxAccount']['rawAttributes'],function(_0x1fa0b0){return{'name':_0x1fa0b0[_0x414c('0x40')],'type':_0x1fa0b0[_0x414c('0x41')][_0x414c('0x42')]};});_0x30d9bb[_0x414c('0x43')]=_[_0x414c('0x3f')](_0x1b13fe,_0x414c('0x3b'));_0x30d9bb[_0x414c('0x44')]=_[_0x414c('0x45')](_0x4d97a2['query']);_0x30d9bb[_0x414c('0x46')]=_[_0x414c('0x47')](_0x30d9bb[_0x414c('0x43')],_0x30d9bb[_0x414c('0x44')]);_0x3464cf[_0x414c('0x48')]=_['intersection'](_0x30d9bb['model'],qs[_0x414c('0x49')](_0x4d97a2[_0x414c('0x44')]['fields']));_0x3464cf['attributes']=_0x3464cf[_0x414c('0x48')][_0x414c('0x4a')]?_0x3464cf[_0x414c('0x48')]:_0x30d9bb[_0x414c('0x43')];if(!_0x4d97a2[_0x414c('0x44')][_0x414c('0x4b')](_0x414c('0x4c'))){_0x3464cf[_0x414c('0x2f')]=qs[_0x414c('0x2f')](_0x4d97a2[_0x414c('0x44')]['limit']);_0x3464cf[_0x414c('0x2d')]=qs['offset'](_0x4d97a2['query'][_0x414c('0x2d')]);}_0x3464cf[_0x414c('0x4d')]=qs['sort'](_0x4d97a2[_0x414c('0x44')][_0x414c('0x4e')]);_0x3464cf[_0x414c('0x4f')]=qs[_0x414c('0x46')](_[_0x414c('0x50')](_0x4d97a2[_0x414c('0x44')],_0x30d9bb[_0x414c('0x46')]),_0x1b13fe);if(_0x4d97a2[_0x414c('0x44')]['filter']){_0x3464cf[_0x414c('0x4f')]=_[_0x414c('0x51')](_0x3464cf[_0x414c('0x4f')],{'$or':_[_0x414c('0x3f')](_0x1b13fe,function(_0x59b168){if(_0x59b168[_0x414c('0x41')]!==_0x414c('0x52')){var _0x45b8c2={};_0x45b8c2[_0x59b168['name']]={'$like':'%'+_0x4d97a2[_0x414c('0x44')]['filter']+'%'};return _0x45b8c2;}})});}_0x3464cf=_['merge']({},_0x3464cf,_0x4d97a2['options']);var _0x39eea4={'where':_0x3464cf[_0x414c('0x4f')]};return db[_0x414c('0x53')][_0x414c('0x30')](_0x39eea4)[_0x414c('0x21')](function(_0x18211d){_0x5ae4b3[_0x414c('0x30')]=_0x18211d;if(_0x4d97a2[_0x414c('0x44')][_0x414c('0x54')]){_0x3464cf[_0x414c('0x55')]=[{'all':!![]}];}return db[_0x414c('0x53')][_0x414c('0x56')](_0x3464cf);})[_0x414c('0x21')](function(_0x2c0fd4){_0x5ae4b3['rows']=_0x2c0fd4;return _0x5ae4b3;})[_0x414c('0x21')](respondWithFilteredResult(_0x4bdb16,_0x3464cf))[_0x414c('0x57')](handleError(_0x4bdb16,null));};exports[_0x414c('0x58')]=function(_0x2281c3,_0x5c2f1d){var _0x530e81={'raw':![],'where':{'id':_0x2281c3[_0x414c('0x59')]['id']},'include':[{'model':db[_0x414c('0x5a')],'as':_0x414c('0x3e')}]},_0x5100f5={};_0x5100f5[_0x414c('0x43')]=_[_0x414c('0x45')](db[_0x414c('0x53')][_0x414c('0x5b')]);_0x5100f5[_0x414c('0x44')]=_[_0x414c('0x45')](_0x2281c3['query']);_0x5100f5['filters']=_[_0x414c('0x47')](_0x5100f5[_0x414c('0x43')],_0x5100f5['query']);_0x530e81[_0x414c('0x48')]=_[_0x414c('0x47')](_0x5100f5['model'],qs[_0x414c('0x49')](_0x2281c3[_0x414c('0x44')][_0x414c('0x49')]));_0x530e81[_0x414c('0x48')]=_0x530e81[_0x414c('0x48')][_0x414c('0x4a')]?_0x530e81[_0x414c('0x48')]:_0x5100f5[_0x414c('0x43')];if(_0x2281c3['query']['includeAll']){_0x530e81[_0x414c('0x55')]=[{'all':!![]}];}_0x530e81=_['merge']({},_0x530e81,_0x2281c3[_0x414c('0x5c')]);return db[_0x414c('0x53')][_0x414c('0x5d')](_0x530e81)[_0x414c('0x21')](handleEntityNotFound(_0x5c2f1d,null))[_0x414c('0x21')](respondWithResult(_0x5c2f1d,null))[_0x414c('0x57')](handleError(_0x5c2f1d,null));};exports['create']=function(_0x1ac4ab,_0x18ed33){return db[_0x414c('0x53')][_0x414c('0x5e')](_0x1ac4ab[_0x414c('0x5f')],{})['then'](function(_0xf6a48){var _0x4d45c2=_0x1ac4ab[_0x414c('0x60')][_0x414c('0x37')]({'plain':!![]});if(!_0x4d45c2)throw new Error(_0x414c('0x61'));if(_0x4d45c2['role']==='user'){var _0x3d84fe=_0xf6a48[_0x414c('0x37')]({'plain':!![]});var _0x23fe3b=_0x414c('0x62');return db['UserProfileSection'][_0x414c('0x5d')]({'where':{'name':_0x23fe3b,'userProfileId':_0x4d45c2[_0x414c('0x63')]},'raw':!![]})[_0x414c('0x21')](function(_0x1da48b){if(_0x1da48b&&_0x1da48b[_0x414c('0x64')]===0x0){return db[_0x414c('0x38')][_0x414c('0x5e')]({'name':_0x3d84fe[_0x414c('0x3b')],'resourceId':_0x3d84fe['id'],'type':_0x1da48b['name'],'sectionId':_0x1da48b['id']},{})[_0x414c('0x21')](function(){return _0xf6a48;});}else{return _0xf6a48;}})[_0x414c('0x57')](function(_0x51d82b){logger[_0x414c('0x26')](_0x414c('0x65'),_0x51d82b);throw _0x51d82b;});}return _0xf6a48;})[_0x414c('0x21')](respondWithResult(_0x18ed33,0xc9))[_0x414c('0x57')](handleError(_0x18ed33,null));};exports[_0x414c('0x35')]=function(_0x436407,_0xb8f0a8){if(_0x436407[_0x414c('0x5f')]['id']){delete _0x436407['body']['id'];}return db['FaxAccount'][_0x414c('0x5d')]({'where':{'id':_0x436407[_0x414c('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x414c('0x3e')}]})[_0x414c('0x21')](handleEntityNotFound(_0xb8f0a8,null))[_0x414c('0x21')](saveUpdates(_0x436407[_0x414c('0x5f')],null))[_0x414c('0x21')](respondWithResult(_0xb8f0a8,null))[_0x414c('0x57')](handleError(_0xb8f0a8,null));};exports['destroy']=function(_0x3f6fc6,_0x3b7d6f){return db[_0x414c('0x53')][_0x414c('0x5d')]({'where':{'id':_0x3f6fc6[_0x414c('0x59')]['id']}})[_0x414c('0x21')](handleEntityNotFound(_0x3b7d6f,null))[_0x414c('0x21')](removeEntity(_0x3b7d6f,null))[_0x414c('0x57')](handleError(_0x3b7d6f,null));};exports[_0x414c('0x66')]=function(_0x5289d3,_0x3cba57){return db[_0x414c('0x53')]['describe']()['then'](respondWithResult(_0x3cba57,null))['catch'](handleError(_0x3cba57,null));};exports['addDisposition']=function(_0x1e3a65,_0x3dfee7,_0x139306){if(_0x1e3a65['body']['id']){delete _0x1e3a65[_0x414c('0x5f')]['id'];}return db[_0x414c('0x53')]['find']({'where':{'id':_0x1e3a65[_0x414c('0x59')]['id']}})['then'](handleEntityNotFound(_0x3dfee7,null))[_0x414c('0x21')](function(_0x2937ef){if(_0x2937ef){_0x1e3a65[_0x414c('0x5f')][_0x414c('0x67')]=_0x2937ef['id'];return db['Disposition'][_0x414c('0x5e')](_0x1e3a65[_0x414c('0x5f')]);}})['then'](respondWithResult(_0x3dfee7,null))[_0x414c('0x57')](handleError(_0x3dfee7,null));};exports[_0x414c('0x68')]=function(_0x51e4ea,_0x45d1be,_0x4d2773){var _0x5f13dd={'raw':![],'where':{}};var _0x37a839={};var _0x517732={'count':0x0,'rows':[]};return db[_0x414c('0x53')][_0x414c('0x69')]({'where':{'id':_0x51e4ea['params']['id']}})[_0x414c('0x21')](handleEntityNotFound(_0x45d1be,null))[_0x414c('0x21')](function(_0x8795be){if(_0x8795be){_0x37a839[_0x414c('0x43')]=_[_0x414c('0x45')](db[_0x414c('0x6a')]['rawAttributes']);_0x37a839[_0x414c('0x44')]=_[_0x414c('0x45')](_0x51e4ea[_0x414c('0x44')]);_0x37a839['filters']=_[_0x414c('0x47')](_0x37a839[_0x414c('0x43')],_0x37a839[_0x414c('0x44')]);_0x5f13dd[_0x414c('0x48')]=_['intersection'](_0x37a839[_0x414c('0x43')],qs[_0x414c('0x49')](_0x51e4ea[_0x414c('0x44')][_0x414c('0x49')]));_0x5f13dd['attributes']=_0x5f13dd[_0x414c('0x48')][_0x414c('0x4a')]?_0x5f13dd['attributes']:_0x37a839[_0x414c('0x43')];if(!_0x51e4ea['query']['hasOwnProperty'](_0x414c('0x4c'))){_0x5f13dd[_0x414c('0x2f')]=qs[_0x414c('0x2f')](_0x51e4ea[_0x414c('0x44')][_0x414c('0x2f')]);_0x5f13dd[_0x414c('0x2d')]=qs['offset'](_0x51e4ea['query'][_0x414c('0x2d')]);}_0x5f13dd[_0x414c('0x4d')]=qs['sort'](_0x51e4ea['query']['sort']);_0x5f13dd[_0x414c('0x4f')]=qs[_0x414c('0x46')](_[_0x414c('0x50')](_0x51e4ea[_0x414c('0x44')],_0x37a839[_0x414c('0x46')]));_0x5f13dd[_0x414c('0x4f')][_0x414c('0x67')]=_0x8795be['id'];if(_0x51e4ea[_0x414c('0x44')]['filter']){_0x5f13dd[_0x414c('0x4f')]=_[_0x414c('0x51')](_0x5f13dd[_0x414c('0x4f')],{'$or':_[_0x414c('0x3f')](_0x5f13dd[_0x414c('0x48')],function(_0x36d022){var _0x8f2f57={};_0x8f2f57[_0x36d022]={'$like':'%'+_0x51e4ea[_0x414c('0x44')]['filter']+'%'};return _0x8f2f57;})});}_0x5f13dd=_[_0x414c('0x51')]({},_0x5f13dd,_0x51e4ea[_0x414c('0x5c')]);return db[_0x414c('0x6a')][_0x414c('0x30')]({'where':_0x5f13dd[_0x414c('0x4f')]})[_0x414c('0x21')](function(_0x1fbe1c){_0x517732[_0x414c('0x30')]=_0x1fbe1c;if(_0x51e4ea[_0x414c('0x44')][_0x414c('0x54')]){_0x5f13dd[_0x414c('0x55')]=[{'all':!![]}];}return db[_0x414c('0x6a')][_0x414c('0x56')](_0x5f13dd);})[_0x414c('0x21')](function(_0x256e51){_0x517732['rows']=_0x256e51;return _0x517732;});}})[_0x414c('0x21')](respondWithFilteredResult(_0x45d1be,_0x5f13dd))[_0x414c('0x57')](handleError(_0x45d1be,null));};exports[_0x414c('0x6b')]=function(_0x44a13d,_0x114674,_0x2ab12b){return db['FaxAccount'][_0x414c('0x5d')]({'where':{'id':_0x44a13d[_0x414c('0x59')]['id']}})[_0x414c('0x21')](handleEntityNotFound(_0x114674,null))[_0x414c('0x21')](function(_0x5e2842){if(_0x5e2842){return _0x5e2842[_0x414c('0x6b')](_0x44a13d[_0x414c('0x44')][_0x414c('0x6c')]);}})['then'](respondWithStatusCode(_0x114674,null))['catch'](handleError(_0x114674,null));};exports[_0x414c('0x6d')]=function(_0x5cd9e4,_0xa3ac3,_0x34b4cd){if(_0x5cd9e4[_0x414c('0x5f')]['id']){delete _0x5cd9e4[_0x414c('0x5f')]['id'];}return db[_0x414c('0x53')][_0x414c('0x5d')]({'where':{'id':_0x5cd9e4[_0x414c('0x59')]['id']}})[_0x414c('0x21')](handleEntityNotFound(_0xa3ac3,null))[_0x414c('0x21')](function(_0x508b5b){if(_0x508b5b){_0x5cd9e4[_0x414c('0x5f')]['FaxAccountId']=_0x508b5b['id'];return db[_0x414c('0x6e')]['create'](_0x5cd9e4[_0x414c('0x5f')]);}})[_0x414c('0x21')](respondWithResult(_0xa3ac3,null))[_0x414c('0x57')](handleError(_0xa3ac3,null));};exports[_0x414c('0x6f')]=function(_0x56ae31,_0x4862e8,_0x163f4f){var _0x44d960={'raw':![],'where':{}};var _0x29b793={};var _0x9eefea={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x56ae31[_0x414c('0x59')]['id']}})[_0x414c('0x21')](handleEntityNotFound(_0x4862e8,null))['then'](function(_0xaa18f8){if(_0xaa18f8){_0x29b793[_0x414c('0x43')]=_[_0x414c('0x45')](db[_0x414c('0x6e')][_0x414c('0x5b')]);_0x29b793[_0x414c('0x44')]=_[_0x414c('0x45')](_0x56ae31[_0x414c('0x44')]);_0x29b793[_0x414c('0x46')]=_[_0x414c('0x47')](_0x29b793[_0x414c('0x43')],_0x29b793['query']);_0x44d960[_0x414c('0x48')]=_[_0x414c('0x47')](_0x29b793[_0x414c('0x43')],qs['fields'](_0x56ae31[_0x414c('0x44')][_0x414c('0x49')]));_0x44d960[_0x414c('0x48')]=_0x44d960[_0x414c('0x48')][_0x414c('0x4a')]?_0x44d960[_0x414c('0x48')]:_0x29b793['model'];if(!_0x56ae31[_0x414c('0x44')][_0x414c('0x4b')](_0x414c('0x4c'))){_0x44d960['limit']=qs['limit'](_0x56ae31[_0x414c('0x44')][_0x414c('0x2f')]);_0x44d960[_0x414c('0x2d')]=qs['offset'](_0x56ae31[_0x414c('0x44')][_0x414c('0x2d')]);}_0x44d960[_0x414c('0x4d')]=qs['sort'](_0x56ae31[_0x414c('0x44')][_0x414c('0x4e')]);_0x44d960[_0x414c('0x4f')]=qs[_0x414c('0x46')](_[_0x414c('0x50')](_0x56ae31[_0x414c('0x44')],_0x29b793['filters']));_0x44d960[_0x414c('0x4f')][_0x414c('0x67')]=_0xaa18f8['id'];if(_0x56ae31[_0x414c('0x44')][_0x414c('0x70')]){_0x44d960['where']=_[_0x414c('0x51')](_0x44d960[_0x414c('0x4f')],{'$or':_[_0x414c('0x3f')](_0x44d960[_0x414c('0x48')],function(_0x4c6079){var _0xb6a6db={};_0xb6a6db[_0x4c6079]={'$like':'%'+_0x56ae31[_0x414c('0x44')]['filter']+'%'};return _0xb6a6db;})});}_0x44d960=_['merge']({},_0x44d960,_0x56ae31[_0x414c('0x5c')]);return db[_0x414c('0x6e')][_0x414c('0x30')]({'where':_0x44d960['where']})[_0x414c('0x21')](function(_0x43a097){_0x9eefea['count']=_0x43a097;if(_0x56ae31[_0x414c('0x44')][_0x414c('0x54')]){_0x44d960[_0x414c('0x55')]=[{'all':!![]}];}return db[_0x414c('0x6e')]['findAll'](_0x44d960);})['then'](function(_0x2cd861){_0x9eefea[_0x414c('0x71')]=_0x2cd861;return _0x9eefea;});}})[_0x414c('0x21')](respondWithFilteredResult(_0x4862e8,_0x44d960))[_0x414c('0x57')](handleError(_0x4862e8,null));};exports['removeAnswers']=function(_0x260c89,_0x533a65,_0x3de0e2){return db['FaxAccount'][_0x414c('0x5d')]({'where':{'id':_0x260c89['params']['id']}})[_0x414c('0x21')](handleEntityNotFound(_0x533a65,null))[_0x414c('0x21')](function(_0x361576){if(_0x361576){return _0x361576[_0x414c('0x72')](_0x260c89[_0x414c('0x44')][_0x414c('0x6c')]);}})[_0x414c('0x21')](respondWithStatusCode(_0x533a65,null))[_0x414c('0x57')](handleError(_0x533a65,null));};exports[_0x414c('0x73')]=function(_0x3560cc,_0x4e326a,_0x5ee646){return db['FaxInteraction']['find']({'where':{'id':_0x3560cc[_0x414c('0x59')]['id']}})['then'](handleEntityNotFound(_0x4e326a,null))[_0x414c('0x21')](function(_0x56bece){if(_0x56bece){return _0x56bece[_0x414c('0x73')](_0x3560cc[_0x414c('0x5f')][_0x414c('0x6c')],_[_0x414c('0x74')](_0x3560cc[_0x414c('0x5f')],[_0x414c('0x6c'),'id'])||{});}})[_0x414c('0x21')](respondWithResult(_0x4e326a,null))[_0x414c('0x57')](handleError(_0x4e326a,null));};exports[_0x414c('0x75')]=function(_0x725f13,_0x4f7c44,_0x1fd83b){var _0x38c448={'raw':![],'where':{}};var _0x14cddb={};var _0x1fd338={'count':0x0,'rows':[]};return db[_0x414c('0x53')][_0x414c('0x69')]({'where':{'id':_0x725f13[_0x414c('0x59')]['id']}})[_0x414c('0x21')](handleEntityNotFound(_0x4f7c44,null))[_0x414c('0x21')](function(_0x433c3e){if(_0x433c3e){_0x14cddb[_0x414c('0x43')]=_['keys'](db[_0x414c('0x76')][_0x414c('0x5b')]);_0x14cddb[_0x414c('0x44')]=_['keys'](_0x725f13[_0x414c('0x44')]);_0x14cddb[_0x414c('0x46')]=_['intersection'](_0x14cddb[_0x414c('0x43')],_0x14cddb['query']);_0x38c448['attributes']=_[_0x414c('0x47')](_0x14cddb[_0x414c('0x43')],qs[_0x414c('0x49')](_0x725f13[_0x414c('0x44')][_0x414c('0x49')]));_0x38c448['attributes']=_0x38c448[_0x414c('0x48')][_0x414c('0x4a')]?_0x38c448[_0x414c('0x48')]:_0x14cddb[_0x414c('0x43')];if(!_0x725f13['query'][_0x414c('0x4b')](_0x414c('0x4c'))){_0x38c448['limit']=qs['limit'](_0x725f13['query'][_0x414c('0x2f')]);_0x38c448[_0x414c('0x2d')]=qs[_0x414c('0x2d')](_0x725f13[_0x414c('0x44')][_0x414c('0x2d')]);}_0x38c448['order']=qs['sort'](_0x725f13[_0x414c('0x44')][_0x414c('0x4e')]);_0x38c448[_0x414c('0x4f')]=qs[_0x414c('0x46')](_[_0x414c('0x50')](_0x725f13['query'],_0x14cddb[_0x414c('0x46')]));_0x38c448[_0x414c('0x4f')][_0x414c('0x67')]=_0x433c3e['id'];if(_0x725f13[_0x414c('0x44')][_0x414c('0x70')]){_0x38c448[_0x414c('0x4f')]=_[_0x414c('0x51')](_0x38c448[_0x414c('0x4f')],{'$or':_[_0x414c('0x3f')](_0x38c448[_0x414c('0x48')],function(_0x1202f5){var _0x398758={};_0x398758[_0x1202f5]={'$like':'%'+_0x725f13[_0x414c('0x44')]['filter']+'%'};return _0x398758;})});}_0x38c448=_[_0x414c('0x51')]({},_0x38c448,_0x725f13[_0x414c('0x5c')]);return db[_0x414c('0x76')]['count']({'where':_0x38c448[_0x414c('0x4f')]})[_0x414c('0x21')](function(_0x6a79e2){_0x1fd338[_0x414c('0x30')]=_0x6a79e2;if(_0x725f13[_0x414c('0x44')][_0x414c('0x54')]){_0x38c448['include']=[{'model':db[_0x414c('0x77')],'as':_0x414c('0x78'),'required':![]},{'model':db[_0x414c('0x79')],'as':'Owner','attributes':[_0x414c('0x3b'),_0x414c('0x7a'),'internal'],'required':![]},{'model':db[_0x414c('0x7b')],'as':_0x414c('0x7c'),'attributes':['id','name',_0x414c('0x7d')],'where':_0x725f13[_0x414c('0x44')]['tag']?{'id':_0x725f13[_0x414c('0x44')][_0x414c('0x7e')]}:undefined,'required':_0x725f13['query'][_0x414c('0x7e')]?!![]:![]}];}return db[_0x414c('0x76')][_0x414c('0x56')](_0x38c448);})[_0x414c('0x21')](function(_0x148d54){_0x1fd338[_0x414c('0x71')]=_0x148d54;return _0x1fd338;});}})['then'](respondWithFilteredResult(_0x4f7c44,_0x38c448))[_0x414c('0x57')](handleError(_0x4f7c44,null));};exports[_0x414c('0x7f')]=function(_0x3bf440,_0x4c4de8){var _0x1c8dbd=_0x3bf440[_0x414c('0x59')]['id'];var _0xe47ef0=_0x3bf440[_0x414c('0x5f')];var _0x3134ca=0xc8;var _0x9dee6a=null;return db[_0x414c('0x80')][_0x414c('0x81')]({'isolationLevel':db[_0x414c('0x80')][_0x414c('0x82')][_0x414c('0x83')]['READ_COMMITTED']},function(_0x15b819){return db[_0x414c('0x53')][_0x414c('0x69')]({'where':{'id':_0x1c8dbd},'transaction':_0x15b819})[_0x414c('0x21')](function(_0xedf835){if(_0xedf835){return db[_0x414c('0x84')][_0x414c('0x36')]({'where':{'FaxAccountId':_0x1c8dbd},'transaction':_0x15b819})['then'](function(){var _0x171798=_[_0x414c('0x3f')](_0xe47ef0,function(_0x36012c){_0x36012c['FaxAccountId']=_0x1c8dbd;return _0x36012c;});return db[_0x414c('0x84')][_0x414c('0x85')](_0x171798,{'transaction':_0x15b819});});}else{_0x3134ca=0x194;_0x9dee6a=[];}});})[_0x414c('0x21')](function(){if(_0x3134ca!==0x194){return db[_0x414c('0x84')][_0x414c('0x86')]({'where':{'FaxAccountId':_0x1c8dbd},'order':'priority'})[_0x414c('0x21')](function(_0x3bd2d2){_0x9dee6a=_0x3bd2d2;});}})[_0x414c('0x57')](function(_0x139391){_0x3134ca=0x1f4;logger[_0x414c('0x26')](_0x139391['stack']);if(_0x139391[_0x414c('0x3b')]){delete _0x139391[_0x414c('0x3b')];}_0x9dee6a=_0x139391;})['finally'](function(){if(_0x9dee6a===null){_0x4c4de8[_0x414c('0x39')](_0x3134ca);}else{if(_0x3134ca===0x1f4){_0x4c4de8[_0x414c('0x2a')](_0x3134ca)[_0x414c('0x3c')](_0x9dee6a);}else{_0x4c4de8[_0x414c('0x2a')](_0x3134ca)[_0x414c('0x2c')](_0x9dee6a);}}});};exports[_0x414c('0x87')]=function(_0x56b4ea,_0x7f667c,_0x396134){var _0x32d46a={};var _0x149a2c={};var _0x2ab87c;var _0x6ae674;return db[_0x414c('0x53')][_0x414c('0x69')]({'where':{'id':_0x56b4ea[_0x414c('0x59')]['id']}})['then'](handleEntityNotFound(_0x7f667c,null))[_0x414c('0x21')](function(_0x51282d){if(_0x51282d){_0x2ab87c=_0x51282d;_0x149a2c[_0x414c('0x43')]=_[_0x414c('0x45')](db[_0x414c('0x84')][_0x414c('0x5b')]);_0x149a2c[_0x414c('0x44')]=_[_0x414c('0x45')](_0x56b4ea[_0x414c('0x44')]);_0x149a2c[_0x414c('0x46')]=_[_0x414c('0x47')](_0x149a2c[_0x414c('0x43')],_0x149a2c['query']);_0x32d46a[_0x414c('0x48')]=_['intersection'](_0x149a2c[_0x414c('0x43')],qs[_0x414c('0x49')](_0x56b4ea[_0x414c('0x44')][_0x414c('0x49')]));_0x32d46a[_0x414c('0x48')]=_0x32d46a[_0x414c('0x48')][_0x414c('0x4a')]?_0x32d46a['attributes']:_0x149a2c['model'];_0x32d46a[_0x414c('0x4d')]=qs[_0x414c('0x4e')](_0x56b4ea['query'][_0x414c('0x4e')]);_0x32d46a[_0x414c('0x4f')]=qs[_0x414c('0x46')](_['pick'](_0x56b4ea[_0x414c('0x44')],_0x149a2c[_0x414c('0x46')]));if(_0x56b4ea[_0x414c('0x44')][_0x414c('0x70')]){_0x32d46a[_0x414c('0x4f')]=_[_0x414c('0x51')](_0x32d46a['where'],{'$or':_[_0x414c('0x3f')](_0x32d46a[_0x414c('0x48')],function(_0x414df5){var _0x405efc={};_0x405efc[_0x414df5]={'$like':'%'+_0x56b4ea['query'][_0x414c('0x70')]+'%'};return _0x405efc;})});}_0x32d46a=_[_0x414c('0x51')]({},_0x32d46a,_0x56b4ea[_0x414c('0x5c')]);return _0x2ab87c['getApplications'](_0x32d46a);}})[_0x414c('0x21')](function(_0x244d7c){if(_0x244d7c){_0x6ae674=_0x244d7c['length'];if(!_0x56b4ea[_0x414c('0x44')][_0x414c('0x4b')](_0x414c('0x4c'))){_0x32d46a[_0x414c('0x2f')]=qs[_0x414c('0x2f')](_0x56b4ea['query'][_0x414c('0x2f')]);_0x32d46a[_0x414c('0x2d')]=qs['offset'](_0x56b4ea[_0x414c('0x44')]['offset']);}return _0x2ab87c[_0x414c('0x87')](_0x32d46a);}})[_0x414c('0x21')](function(_0x553153){if(_0x553153){return _0x553153?{'count':_0x6ae674,'rows':_0x553153}:null;}})['then'](respondWithResult(_0x7f667c,null))[_0x414c('0x57')](handleError(_0x7f667c,null));};function Extension(_0x5e2b9a,_0x39a69f,_0x59faf2,_0x1681bb){this[_0x414c('0x88')]=_0x414c('0x89');this[_0x414c('0x8a')]=_0x5e2b9a[_0x414c('0x8b')];this['app']=_0x1681bb;this[_0x414c('0x41')]=_0x414c('0x8c');this[_0x414c('0x8d')]=_0x414c('0x8e');this[_0x414c('0x67')]=_0x5e2b9a['id'];this[_0x414c('0x8f')]=_0x39a69f;this['appdata']=_0x59faf2;}function createExtensionsReciveFax(_0x2c1f1a){var _0x16c8b6=0x1;var _0x3096b4=[];_0x3096b4[_0x414c('0x90')](new Extension(_0x2c1f1a,_0x16c8b6,'','Answer'));_0x16c8b6+=0x1;_0x3096b4[_0x414c('0x90')](new Extension(_0x2c1f1a,_0x16c8b6,_0x414c('0x91'),_0x414c('0x92')));_0x16c8b6+=0x1;for(var _0x357229 in _0x2c1f1a){if(_0x2c1f1a[_0x414c('0x4b')](_0x357229)&&(_0x357229===_0x414c('0x93')||_0x357229==='localstationid'||_0x357229===_0x414c('0x94')||_0x357229===_0x414c('0x95')||_0x357229===_0x414c('0x96')||_0x357229===_0x414c('0x97')||_0x357229==='minrate'||_0x357229===_0x414c('0x98')||_0x357229===_0x414c('0x99'))){_0x3096b4[_0x414c('0x90')](new Extension(_0x2c1f1a,_0x16c8b6,_0x414c('0x9a')+_0x357229+')='+_0x2c1f1a[_0x357229],_0x414c('0x92')));_0x16c8b6+=0x1;}}_0x3096b4[_0x414c('0x90')](new Extension(_0x2c1f1a,_0x16c8b6,'6',_0x414c('0x9b')));_0x16c8b6+=0x1;_0x3096b4[_0x414c('0x90')](new Extension(_0x2c1f1a,_0x16c8b6,_0x414c('0x9c'),_0x414c('0x9d')));_0x16c8b6=0x0;return _0x3096b4;}exports['addAccountApplications']=function(_0x6d0980,_0x890b0f,_0x192091){var _0x3a4ca2;return db[_0x414c('0x80')]['transaction'](function(_0x53066c){return db[_0x414c('0x53')]['create'](_0x6d0980[_0x414c('0x5f')],{'transaction':_0x53066c})[_0x414c('0x21')](function(_0x461d36){_0x3a4ca2=_0x461d36[_0x414c('0x37')]({'plain':!![]});return db[_0x414c('0x9e')][_0x414c('0x85')](createExtensionsReciveFax(_0x3a4ca2),{'transaction':_0x53066c});});})[_0x414c('0x21')](function(){return _0x3a4ca2;})[_0x414c('0x21')](respondWithResult(_0x890b0f,null))[_0x414c('0x57')](handleError(_0x890b0f,null));};exports[_0x414c('0x9f')]=function(_0x5713b0,_0x5a0364,_0x26065b){var _0x42dd85;return db['sequelize'][_0x414c('0x81')](function(_0x208026){return db[_0x414c('0x53')]['update'](_0x5713b0[_0x414c('0x5f')],{'where':{'id':_0x5713b0[_0x414c('0x5f')]['id']},'transaction':_0x208026})[_0x414c('0x21')](function(_0x6cf24a){return db[_0x414c('0x9e')][_0x414c('0x36')]({'where':{'FaxAccountId':_0x5713b0[_0x414c('0x5f')]['id']},'transaction':_0x208026})['then'](function(_0x30a712){return db[_0x414c('0x9e')][_0x414c('0x85')](createExtensionsReciveFax(_[_0x414c('0x74')](_0x5713b0[_0x414c('0x5f')],[_0x414c('0xa0'),'key',_0x414c('0xa1'),_0x414c('0xa2'),_0x414c('0xa3'),_0x414c('0xa4')])),{'transaction':_0x208026});});});})['then'](function(){return db['FaxAccount'][_0x414c('0xa5')](_0x5713b0[_0x414c('0x5f')]['id']);})['then'](respondWithResult(_0x5a0364,null))[_0x414c('0x57')](handleError(_0x5a0364,null));};exports[_0x414c('0xa6')]=function(_0x40df90,_0x35f2d0,_0x1d5c92){var _0x4b1aab={'raw':!![],'where':{}};var _0xb61223={};var _0x5b347f={'count':0x0,'rows':[]};return db[_0x414c('0x53')][_0x414c('0x69')]({'where':{'id':_0x40df90['params']['id']}})[_0x414c('0x21')](handleEntityNotFound(_0x35f2d0,null))[_0x414c('0x21')](function(_0x2adcdf){if(_0x2adcdf){_0xb61223['model']=_[_0x414c('0x45')](db['FaxMessage'][_0x414c('0x5b')]);_0xb61223[_0x414c('0x44')]=_[_0x414c('0x45')](_0x40df90[_0x414c('0x44')]);_0xb61223[_0x414c('0x46')]=_[_0x414c('0x47')](_0xb61223['model'],_0xb61223['query']);_0x4b1aab[_0x414c('0x48')]=_['intersection'](_0xb61223[_0x414c('0x43')],qs['fields'](_0x40df90[_0x414c('0x44')]['fields']));_0x4b1aab[_0x414c('0x48')]=_0x4b1aab[_0x414c('0x48')][_0x414c('0x4a')]?_0x4b1aab[_0x414c('0x48')]:_0xb61223[_0x414c('0x43')];if(!_0x40df90[_0x414c('0x44')][_0x414c('0x4b')]('nolimit')){_0x4b1aab[_0x414c('0x2f')]=qs[_0x414c('0x2f')](_0x40df90[_0x414c('0x44')][_0x414c('0x2f')]);_0x4b1aab[_0x414c('0x2d')]=qs[_0x414c('0x2d')](_0x40df90[_0x414c('0x44')][_0x414c('0x2d')]);}_0x4b1aab[_0x414c('0x4d')]=qs['sort'](_0x40df90[_0x414c('0x44')][_0x414c('0x4e')]);_0x4b1aab[_0x414c('0x4f')]=qs[_0x414c('0x46')](_['pick'](_0x40df90[_0x414c('0x44')],_0xb61223[_0x414c('0x46')]));_0x4b1aab['where'][_0x414c('0x67')]=_0x2adcdf['id'];if(_0x40df90[_0x414c('0x44')][_0x414c('0x70')]){_0x4b1aab[_0x414c('0x4f')]=_[_0x414c('0x51')](_0x4b1aab[_0x414c('0x4f')],{'$or':_['map'](_0x4b1aab['attributes'],function(_0x12512d){var _0x2e1c99={};_0x2e1c99[_0x12512d]={'$like':'%'+_0x40df90[_0x414c('0x44')][_0x414c('0x70')]+'%'};return _0x2e1c99;})});}if(_0x40df90['query'][_0x414c('0xa7')]){var _0x4473a0=_0x40df90[_0x414c('0x44')]['$gte'][_0x414c('0xa8')](',');var _0xb1db6d={};_0xb1db6d[_0x4473a0[0x0]]={'$gte':moment(_0x4473a0[0x1])[_0x414c('0xa9')](_0x414c('0xaa'))};_0x4b1aab[_0x414c('0x4f')]=_[_0x414c('0x51')](_0x4b1aab[_0x414c('0x4f')],_0xb1db6d);}_0x4b1aab=_[_0x414c('0x51')]({},_0x4b1aab,_0x40df90[_0x414c('0x5c')]);return db[_0x414c('0xab')][_0x414c('0x30')]({'where':_0x4b1aab[_0x414c('0x4f')]})[_0x414c('0x21')](function(_0x1e620e){_0x5b347f[_0x414c('0x30')]=_0x1e620e;if(_0x40df90[_0x414c('0x44')][_0x414c('0x54')]){_0x4b1aab['include']=[{'all':!![]}];}return db['FaxMessage'][_0x414c('0x56')](_0x4b1aab);})['then'](function(_0x558888){_0x5b347f[_0x414c('0x71')]=_0x558888;return _0x5b347f;});}})[_0x414c('0x21')](respondWithFilteredResult(_0x35f2d0,_0x4b1aab))['catch'](handleError(_0x35f2d0,null));};exports['send']=function(_0x479a9a,_0x26112c,_0x917168){var _0x88ed65,_0x35ace8={},_0x51ce74;if(_0x479a9a[_0x414c('0x5f')]['to']){_0x51ce74=_0x479a9a[_0x414c('0x5f')]['to'][0x0];}return db[_0x414c('0x53')][_0x414c('0x5d')]({'where':{'id':_0x479a9a['params']['id']},'include':[{'model':db[_0x414c('0xac')],'as':_0x414c('0xad'),'include':[{'model':db[_0x414c('0x77')],'as':'Contacts','where':{'fax':_0x51ce74},'limit':0x1,'order':[[_0x414c('0xa2'),_0x414c('0xae')]]}]}]})['then'](handleEntityNotFound(_0x26112c,null))[_0x414c('0x21')](function(_0x16010b){_0x88ed65=_0x16010b;if(_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')]&&_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][_0x414c('0x4a')]){for(var _0x2a1833=0x0;_0x2a1833<_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][_0x414c('0x4a')];_0x2a1833+=0x1){_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][_0x2a1833]={'filename':_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][_0x2a1833]['name'],'id':_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][_0x2a1833]['id'],'path':path[_0x414c('0xb0')](config[_0x414c('0xb1')],_0x414c('0xb2'),_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][_0x2a1833][_0x414c('0xb3')])};}}return respondWithRpcPromise(_0x414c('0xb4'),_0x414c('0xb4'),{'FaxAccountId':_[_0x414c('0xb5')](_0x479a9a[_0x414c('0x59')]['id'])?undefined:_0x479a9a[_0x414c('0x59')]['id'],'path':_['isNil'](_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][0x0][_0x414c('0x8')])?undefined:_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][0x0][_0x414c('0x8')],'fax':_[_0x414c('0xb5')](_0x479a9a['body']['to'][0x0])?undefined:_0x479a9a[_0x414c('0x5f')]['to'][0x0]},client9002);})[_0x414c('0x21')](function(){if(_0x88ed65){if(_[_0x414c('0xb5')](_0x479a9a[_0x414c('0x5f')][_0x414c('0xb6')])){_0x479a9a[_0x414c('0x5f')][_0x414c('0xb6')]=util[_0x414c('0xa9')](_0x414c('0xb7'),_0x88ed65[_0x414c('0x3b')],_0x88ed65[_0x414c('0xb8')]);}if(_0x88ed65[_0x414c('0xad')]){if(_0x88ed65['List']['Contacts']['length']){return _0x88ed65['List'][_0x414c('0xb9')][0x0];}else{return db[_0x414c('0x77')][_0x414c('0x5e')](_['defaults'](_0x479a9a[_0x414c('0x5f')],{'firstName':_0x479a9a[_0x414c('0x5f')]['to'][0x0],'phone':_0x479a9a[_0x414c('0x5f')]['to'][0x0],'fax':_0x479a9a[_0x414c('0x5f')]['to'][0x0],'ListId':_0x88ed65[_0x414c('0xa4')]}));}}else{throw new Error(_0x414c('0xba'));}}else{throw new Error(_0x414c('0xbb'));}})[_0x414c('0x21')](function(_0x4dc44c){if(_0x4dc44c){return db[_0x414c('0x76')][_0x414c('0x5d')]({'where':{'ContactId':_0x4dc44c['id'],'closed':![],'FaxAccountId':_0x88ed65['id']}})['then'](function(_0x32f61f){if(_0x32f61f){return[_0x32f61f,![]];}return db['FaxInteraction'][_0x414c('0x5e')]({'UserId':_0x479a9a['user']['id'],'ContactId':_0x4dc44c['id'],'FaxAccountId':_0x88ed65['id'],'fax':_0x479a9a['body']['to'][0x0],'firstMsgDirection':_0x414c('0xbc'),'Messages':[_[_0x414c('0x51')](_0x479a9a[_0x414c('0x5f')],{'read':![],'body':_0x479a9a[_0x414c('0x5f')]['attachments'][0x0][_0x414c('0xbd')],'FaxAccountId':_0x88ed65['id'],'UserId':_0x479a9a[_0x414c('0x60')]['id'],'ContactId':_0x4dc44c['id'],'AttachmentId':_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0x414c('0xab')],'as':_0x414c('0xbe')}]})[_0x414c('0x21')](function(_0xb4c6ad){return[_0xb4c6ad,!![]];});});}else{throw new Error(_0x414c('0xbf'));}})['spread'](function(_0x39caa1,_0x41e22c){if(_0x41e22c){return _0x39caa1;}return db[_0x414c('0xab')][_0x414c('0x5e')]({'direction':_0x414c('0xbc'),'read':![],'body':_0x479a9a[_0x414c('0x5f')]['attachments'][0x0][_0x414c('0xbd')],'FaxAccountId':_0x88ed65['id'],'FaxInteractionId':_0x39caa1['id'],'UserId':_0x479a9a['user']['id'],'ContactId':_0x39caa1[_0x414c('0xc0')],'AttachmentId':_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][0x0]['id']})[_0x414c('0x21')](function(_0x15c083){_0x39caa1[_0x414c('0xc1')][_0x414c('0xbe')]=[];_0x39caa1[_0x414c('0xc1')][_0x414c('0xbe')]['push'](_0x15c083[_0x414c('0xc1')]);return _0x39caa1;});})['then'](function(_0x2c062d){respondWithRpcPromise('SendFax',_0x414c('0xc2'),{'FaxAccountId':_[_0x414c('0xb5')](_0x479a9a['params']['id'])?undefined:_0x479a9a[_0x414c('0x59')]['id'],'path':_[_0x414c('0xb5')](_0x479a9a[_0x414c('0x5f')]['attachments'][0x0][_0x414c('0x8')])?undefined:_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][0x0][_0x414c('0x8')],'fax':_[_0x414c('0xb5')](_0x479a9a['body']['to'][0x0])?undefined:_0x479a9a['body']['to'][0x0],'AttachmentId':_0x479a9a[_0x414c('0x5f')][_0x414c('0xaf')][0x0]['id']},client9002)[_0x414c('0x21')](function(_0x32cbac){logger[_0x414c('0x22')](_0x414c('0xc3'),_0x32cbac);})[_0x414c('0x57')](function(_0x47824c){logger[_0x414c('0x22')](_0x414c('0xc3'),_0x47824c);});return _0x2c062d;})['then'](respondWithResult(_0x26112c,null))[_0x414c('0x57')](handleError(_0x26112c,null));};exports[_0x414c('0xc4')]=function(_0xd8b2f0,_0x5e8c5e,_0x4f43ae){return db[_0x414c('0x53')]['find']({'where':{'id':_0xd8b2f0['params']['id']}})[_0x414c('0x21')](handleEntityNotFound(_0x5e8c5e,null))['then'](function(_0xd25c2d){if(_0xd25c2d){return _0xd25c2d['addAgents'](_0xd8b2f0[_0x414c('0x5f')][_0x414c('0x6c')],_[_0x414c('0x74')](_0xd8b2f0['body'],[_0x414c('0x6c'),'id'])||{})['spread'](function(_0x4a4d90){for(var _0x76732e=0x0;_0x76732e<_0xd8b2f0['body'][_0x414c('0x6c')][_0x414c('0x4a')];_0x76732e+=0x1){socket[_0x414c('0xc5')]('userFaxAccount:save',{'UserId':Number(_0xd8b2f0['body'][_0x414c('0x6c')][_0x76732e]),'FaxAccountId':Number(_0xd8b2f0[_0x414c('0x59')]['id'])});}return _0x4a4d90;});}})[_0x414c('0x21')](respondWithResult(_0x5e8c5e,null))[_0x414c('0x57')](handleError(_0x5e8c5e,null));};exports[_0x414c('0xc6')]=function(_0xf1083b,_0x38e7b0,_0x3c9e6c){return db[_0x414c('0x53')]['find']({'where':{'id':_0xf1083b[_0x414c('0x59')]['id']}})['then'](handleEntityNotFound(_0x38e7b0,null))['then'](function(_0x3681d0){if(_0x3681d0){return _0x3681d0[_0x414c('0xc6')](_0xf1083b['query'][_0x414c('0x6c')])['then'](function(){if(_[_0x414c('0xc7')](_0xf1083b[_0x414c('0x44')][_0x414c('0x6c')])){for(var _0x416066=0x0;_0x416066<_0xf1083b['query']['ids'][_0x414c('0x4a')];_0x416066+=0x1){socket[_0x414c('0xc5')](_0x414c('0xc8'),{'UserId':Number(_0xf1083b['query'][_0x414c('0x6c')][_0x416066]),'FaxAccountId':Number(_0xf1083b[_0x414c('0x59')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0xf1083b['query'][_0x414c('0x6c')]),'FaxAccountId':Number(_0xf1083b[_0x414c('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x38e7b0,null))['catch'](handleError(_0x38e7b0,null));};exports[_0x414c('0xc9')]=function(_0x1ec18f,_0x3a98bd,_0x2f80a8){var _0x3a252c={};var _0x108dbd={};var _0x2f4298;var _0x7f291e;return db[_0x414c('0x53')][_0x414c('0x69')]({'where':{'id':_0x1ec18f[_0x414c('0x59')]['id']}})[_0x414c('0x21')](handleEntityNotFound(_0x3a98bd,null))[_0x414c('0x21')](function(_0x233791){if(_0x233791){_0x2f4298=_0x233791;_0x108dbd[_0x414c('0x43')]=_['keys'](db['User']['rawAttributes']);_0x108dbd[_0x414c('0x44')]=_[_0x414c('0x45')](_0x1ec18f[_0x414c('0x44')]);_0x108dbd[_0x414c('0x46')]=_['intersection'](_0x108dbd['model'],_0x108dbd[_0x414c('0x44')]);_0x3a252c[_0x414c('0x48')]=_[_0x414c('0x47')](_0x108dbd[_0x414c('0x43')],qs[_0x414c('0x49')](_0x1ec18f[_0x414c('0x44')][_0x414c('0x49')]));_0x3a252c['attributes']=_0x3a252c[_0x414c('0x48')][_0x414c('0x4a')]?_0x3a252c[_0x414c('0x48')]:_0x108dbd['model'];_0x3a252c['order']=qs['sort'](_0x1ec18f[_0x414c('0x44')][_0x414c('0x4e')]);_0x3a252c[_0x414c('0x4f')]=qs[_0x414c('0x46')](_['pick'](_0x1ec18f[_0x414c('0x44')],_0x108dbd['filters']));if(_0x1ec18f[_0x414c('0x44')]['filter']){_0x3a252c['where']=_['merge'](_0x3a252c[_0x414c('0x4f')],{'$or':_['map'](_0x3a252c[_0x414c('0x48')],function(_0xd3e0b9){var _0xac0963={};_0xac0963[_0xd3e0b9]={'$like':'%'+_0x1ec18f[_0x414c('0x44')][_0x414c('0x70')]+'%'};return _0xac0963;})});}_0x3a252c=_[_0x414c('0x51')]({},_0x3a252c,_0x1ec18f['options']);return _0x2f4298[_0x414c('0xc9')](_0x3a252c);}})[_0x414c('0x21')](function(_0xcdbfa0){if(_0xcdbfa0){_0x7f291e=_0xcdbfa0[_0x414c('0x4a')];if(!_0x1ec18f[_0x414c('0x44')]['hasOwnProperty'](_0x414c('0x4c'))){_0x3a252c[_0x414c('0x2f')]=qs[_0x414c('0x2f')](_0x1ec18f[_0x414c('0x44')][_0x414c('0x2f')]);_0x3a252c[_0x414c('0x2d')]=qs[_0x414c('0x2d')](_0x1ec18f[_0x414c('0x44')][_0x414c('0x2d')]);}return _0x2f4298[_0x414c('0xc9')](_0x3a252c);}})[_0x414c('0x21')](function(_0x3acf4){if(_0x3acf4){return _0x3acf4?{'count':_0x7f291e,'rows':_0x3acf4}:null;}})['then'](respondWithResult(_0x3a98bd,null))[_0x414c('0x57')](handleError(_0x3a98bd,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f8e2a99..378c3af 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 _0x311b=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2fb194,_0x12a59a){var _0x1a1f2f=function(_0x41207f){while(--_0x41207f){_0x2fb194['push'](_0x2fb194['shift']());}};_0x1a1f2f(++_0x12a59a);}(_0x311b,0x13b));var _0xb311=function(_0x3f32b2,_0x317ec4){_0x3f32b2=_0x3f32b2-0x0;var _0x20aa6b=_0x311b[_0x3f32b2];return _0x20aa6b;};'use strict';var EventEmitter=require(_0xb311('0x0'));var FaxAccount=require(_0xb311('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb311('0x2')](0x0);var events={'afterCreate':_0xb311('0x3'),'afterUpdate':'update','afterDestroy':_0xb311('0x4')};function emitEvent(_0x142148){return function(_0x233c2b,_0x2d8cdf,_0x1da51d){FaxAccountEvents['emit'](_0x142148+':'+_0x233c2b['id'],_0x233c2b);FaxAccountEvents[_0xb311('0x5')](_0x142148,_0x233c2b);_0x1da51d(null);};}for(var e in events){if(events[_0xb311('0x6')](e)){var event=events[e];FaxAccount[_0xb311('0x7')](e,emitEvent(event));}}module[_0xb311('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x6a4b=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0x6a4b,0x9b));var _0xb6a4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6a4b[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xb6a4('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb6a4('0x1')](0x0);var events={'afterCreate':_0xb6a4('0x2'),'afterUpdate':_0xb6a4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2a0ec5){return function(_0x1f3904,_0x3eab22,_0x5cc92c){FaxAccountEvents[_0xb6a4('0x4')](_0x2a0ec5+':'+_0x1f3904['id'],_0x1f3904);FaxAccountEvents[_0xb6a4('0x4')](_0x2a0ec5,_0x1f3904);_0x5cc92c(null);};}for(var e in events){if(events[_0xb6a4('0x5')](e)){var event=events[e];FaxAccount[_0xb6a4('0x6')](e,emitEvent(event));}}module[_0xb6a4('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index dc2cf5e..b515a21 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 _0x709c=['fax_accounts','lodash','util','api','moment','path','rimraf','define','FaxAccount'];(function(_0x3b5c38,_0x2c7022){var _0x442ebd=function(_0x738ed7){while(--_0x738ed7){_0x3b5c38['push'](_0x3b5c38['shift']());}};_0x442ebd(++_0x2c7022);}(_0x709c,0x1ba));var _0xc709=function(_0x5106b3,_0x4eeecc){_0x5106b3=_0x5106b3-0x0;var _0x30a06e=_0x709c[_0x5106b3];return _0x30a06e;};'use strict';var _=require(_0xc709('0x0'));var util=require(_0xc709('0x1'));var logger=require('../../config/logger')(_0xc709('0x2'));var moment=require(_0xc709('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc709('0x4'));var rimraf=require(_0xc709('0x5'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module['exports']=function(_0x2f77b5,_0x27ebed){return _0x2f77b5[_0xc709('0x6')](_0xc709('0x7'),attributes,{'tableName':_0xc709('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6062=['define','FaxAccount','../../config/logger','api','path','rimraf','./faxAccount.attributes','exports'];(function(_0x348681,_0x486a1d){var _0x30d4b7=function(_0x4b6cb1){while(--_0x4b6cb1){_0x348681['push'](_0x348681['shift']());}};_0x30d4b7(++_0x486a1d);}(_0x6062,0x102));var _0x2606=function(_0x4ca19a,_0x3aa9d7){_0x4ca19a=_0x4ca19a-0x0;var _0x5b6566=_0x6062[_0x4ca19a];return _0x5b6566;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2606('0x0'))(_0x2606('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2606('0x2'));var rimraf=require(_0x2606('0x3'));var config=require('../../config/environment');var attributes=require(_0x2606('0x4'));module[_0x2606('0x5')]=function(_0x1ed7d7,_0x546e92){return _0x1ed7d7[_0x2606('0x6')](_0x2606('0x7'),attributes,{'tableName':'fax_accounts','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 672e978..c0ab052 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 _0xb3f6=['interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','agent','*,*,*,*','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetFaxAccount','catch','NotifyFaxAccount','body','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','find','account','CmList','List','CmContact','Contacts','updatedAt','DESC','FaxApplication','Applications','get','applications','orderBy','length','defaults','create','contact','fax','FaxInteraction','Contact\x20not\x20found','autoclose','push','unmanaged','created'];(function(_0x5ce664,_0x37cb71){var _0x8808c3=function(_0x57ba8c){while(--_0x57ba8c){_0x5ce664['push'](_0x5ce664['shift']());}};_0x8808c3(++_0x37cb71);}(_0xb3f6,0x6c));var _0x6b3f=function(_0x8c7a09,_0x205109){_0x8c7a09=_0x8c7a09-0x0;var _0x448d3c=_0xb3f6[_0x8c7a09];return _0x448d3c;};'use strict';var _=require(_0x6b3f('0x0'));var util=require('util');var moment=require(_0x6b3f('0x1'));var BPromise=require('bluebird');var rs=require(_0x6b3f('0x2'));var fs=require('fs');var Redis=require(_0x6b3f('0x3'));var db=require(_0x6b3f('0x4'))['db'];var utils=require(_0x6b3f('0x5'));var logger=require(_0x6b3f('0x6'))(_0x6b3f('0x7'));var config=require(_0x6b3f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6b3f('0x9')][_0x6b3f('0xa')]({'port':0x232c});config['redis']=_['defaults'](config[_0x6b3f('0xb')],{'host':_0x6b3f('0xc'),'port':0x18eb});var socket=require(_0x6b3f('0xd'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x6b3f('0xe')](socket);function respondWithRpcPromise(_0x348739,_0x59a831,_0x551285){return new BPromise(function(_0x23e2a6,_0x581493){return client[_0x6b3f('0xf')](_0x348739,_0x551285)[_0x6b3f('0x10')](function(_0x1d83c6){logger['info'](_0x6b3f('0x11'),_0x59a831,'request\x20sent');logger['debug'](_0x6b3f('0x12'),_0x59a831,'request\x20sent',JSON[_0x6b3f('0x13')](_0x1d83c6));if(_0x1d83c6[_0x6b3f('0x14')]){if(_0x1d83c6[_0x6b3f('0x14')][_0x6b3f('0x15')]===0x1f4){logger[_0x6b3f('0x14')](_0x6b3f('0x11'),_0x59a831,_0x1d83c6[_0x6b3f('0x14')][_0x6b3f('0x16')]);return _0x581493(_0x1d83c6[_0x6b3f('0x14')]['message']);}logger[_0x6b3f('0x14')]('FaxAccount,\x20%s,\x20%s',_0x59a831,_0x1d83c6[_0x6b3f('0x14')][_0x6b3f('0x16')]);return _0x23e2a6(_0x1d83c6['error']['message']);}else{logger[_0x6b3f('0x17')]('FaxAccount,\x20%s,\x20%s',_0x59a831,_0x6b3f('0x18'));_0x23e2a6(_0x1d83c6[_0x6b3f('0x19')][_0x6b3f('0x16')]);}})['catch'](function(_0x343ac2){logger['error']('FaxAccount,\x20%s,\x20%s',_0x59a831,_0x343ac2);_0x581493(_0x343ac2);});});}exports['GetFaxAccount']=function(_0x499ad9){var _0x2fa35e=this;return new Promise(function(_0x1563e3,_0x3a477f){return db[_0x6b3f('0x1a')][_0x6b3f('0x1b')]({'raw':_0x499ad9['options']?_0x499ad9[_0x6b3f('0x1c')][_0x6b3f('0x1d')]===undefined?!![]:![]:!![],'where':_0x499ad9[_0x6b3f('0x1c')]?_0x499ad9[_0x6b3f('0x1c')][_0x6b3f('0x1e')]||null:null,'attributes':_0x499ad9[_0x6b3f('0x1c')]?_0x499ad9[_0x6b3f('0x1c')][_0x6b3f('0x1f')]||null:null,'limit':_0x499ad9[_0x6b3f('0x1c')]?_0x499ad9[_0x6b3f('0x1c')][_0x6b3f('0x20')]||null:null,'include':_0x499ad9[_0x6b3f('0x1c')]?_0x499ad9[_0x6b3f('0x1c')]['include']?_[_0x6b3f('0x21')](_0x499ad9[_0x6b3f('0x1c')][_0x6b3f('0x22')],function(_0x176067){return{'model':db[_0x176067[_0x6b3f('0x23')]],'as':_0x176067['as'],'attributes':_0x176067[_0x6b3f('0x1f')],'include':_0x176067[_0x6b3f('0x22')]?_['map'](_0x176067[_0x6b3f('0x22')],function(_0x496553){return{'model':db[_0x496553[_0x6b3f('0x23')]],'as':_0x496553['as'],'attributes':_0x496553[_0x6b3f('0x1f')],'include':_0x496553['include']?_[_0x6b3f('0x21')](_0x496553[_0x6b3f('0x22')],function(_0x22285c){return{'model':db[_0x22285c[_0x6b3f('0x23')]],'as':_0x22285c['as'],'attributes':_0x22285c[_0x6b3f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6b3f('0x10')](function(_0x593814){logger[_0x6b3f('0x17')]('GetFaxAccount',_0x499ad9);logger['debug'](_0x6b3f('0x24'),_0x499ad9,JSON[_0x6b3f('0x13')](_0x593814));_0x1563e3(_0x593814);})[_0x6b3f('0x25')](function(_0x1a670d){logger[_0x6b3f('0x14')]('GetFaxAccount',_0x1a670d[_0x6b3f('0x16')],_0x499ad9);_0x3a477f(_0x2fa35e['error'](0x1f4,_0x1a670d[_0x6b3f('0x16')]));});});};exports[_0x6b3f('0x26')]=function(_0xf7feaa,_0x5a6131,_0x1e907c){var _0xe4a135=this;return new Promise(function(_0x2a28bc,_0x467af8){var _0x547b38={'body':_0xf7feaa[_0x6b3f('0x27')],'channel':'fax'};var _0x399f87=[];var _0x1b2aa6=[];var _0x578c7c={};return db['CmContact'][_0x6b3f('0x28')]()['then'](function(_0x724078){if(!_0x724078){throw new db[(_0x6b3f('0x29'))][(_0x6b3f('0x2a'))](_0x6b3f('0x2b'));}_0x399f87=_[_0x6b3f('0x2c')](_['keys'](_0x724078),['createdAt','updatedAt']);_0x1b2aa6=_[_0x6b3f('0x2c')](_[_0x6b3f('0x2d')](_0x724078),[_0x6b3f('0x2e'),'updatedAt','CompanyId',_0x6b3f('0x2f')]);if(_0xf7feaa['body']['id']){delete _0xf7feaa[_0x6b3f('0x27')]['id'];}if(_[_0x6b3f('0x30')](_0xf7feaa[_0x6b3f('0x27')][_0x6b3f('0x31')])){throw new db[(_0x6b3f('0x29'))][(_0x6b3f('0x2a'))](_0x6b3f('0x32'));}if(_['isNil'](_0xf7feaa[_0x6b3f('0x27')][_0x6b3f('0x27')])||_0xf7feaa[_0x6b3f('0x27')][_0x6b3f('0x27')]===''){throw new db[(_0x6b3f('0x29'))][(_0x6b3f('0x2a'))](_0x6b3f('0x33'));}if(_[_0x6b3f('0x30')](_0xf7feaa[_0x6b3f('0x27')]['mapKey'])){throw new db[(_0x6b3f('0x29'))][(_0x6b3f('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b2aa6);}if(!_[_0x6b3f('0x34')](_0x1b2aa6,_0xf7feaa[_0x6b3f('0x27')][_0x6b3f('0x35')])){throw new db[(_0x6b3f('0x29'))][(_0x6b3f('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b2aa6);}_0x578c7c[_0xf7feaa['body'][_0x6b3f('0x35')]]=_0xf7feaa[_0x6b3f('0x27')][_0x6b3f('0x31')];})[_0x6b3f('0x10')](function(){return db[_0x6b3f('0x1a')][_0x6b3f('0x36')]({'where':{'id':_0xf7feaa[_0x6b3f('0x37')]['id']},'include':[{'model':db[_0x6b3f('0x38')],'as':_0x6b3f('0x39'),'include':[{'model':db[_0x6b3f('0x3a')],'as':_0x6b3f('0x3b'),'where':_0x578c7c,'limit':0x1,'order':[[_0x6b3f('0x3c'),_0x6b3f('0x3d')]]}]},{'model':db[_0x6b3f('0x3e')],'as':_0x6b3f('0x3f')}]});})[_0x6b3f('0x10')](function(_0x5db221){if(_0x5db221&&_0x5db221[_0x6b3f('0x39')]){var _0x4a714a=_0x5db221[_0x6b3f('0x40')]({'plain':!![]});_0x547b38['account']=_0x4a714a;_0x547b38[_0x6b3f('0x41')]=_0x4a714a[_0x6b3f('0x3f')];_0x547b38['list']=_0x4a714a[_0x6b3f('0x39')];_0x547b38[_0x6b3f('0x41')]=_[_0x6b3f('0x42')](_0x547b38[_0x6b3f('0x41')],['priority'],['asc']);if(_0x547b38[_0x6b3f('0x37')][_0x6b3f('0x3f')]){delete _0x547b38['account'][_0x6b3f('0x3f')];}if(_0x547b38[_0x6b3f('0x37')][_0x6b3f('0x39')]&&_0x547b38[_0x6b3f('0x37')][_0x6b3f('0x39')][_0x6b3f('0x3b')][_0x6b3f('0x43')]){return _0x547b38[_0x6b3f('0x37')][_0x6b3f('0x39')]['Contacts'][0x0];}var _0x11b911=_[_0x6b3f('0x44')](_0xf7feaa[_0x6b3f('0x27')],{'firstName':_0xf7feaa['body'][_0x6b3f('0x31')],'ListId':_0x4a714a[_0x6b3f('0x2f')]});_0x11b911[_0xf7feaa['body'][_0x6b3f('0x35')]]=_0xf7feaa['body']['from'];return db[_0x6b3f('0x3a')][_0x6b3f('0x45')](_0x11b911,{'fields':_0x399f87,'raw':!![]});}})[_0x6b3f('0x10')](function(_0x4d2cf6){_0x547b38[_0x6b3f('0x46')]=_0x4d2cf6;if(_0x4d2cf6){var _0x4dcc63={'ContactId':_0x4d2cf6['id'],'FaxAccountId':_0xf7feaa[_0x6b3f('0x37')]['id'],'fax':_0x4d2cf6[_0x6b3f('0x47')]};return db[_0x6b3f('0x48')][_0x6b3f('0x36')]({'where':{'ContactId':_0x4d2cf6['id'],'closed':![],'FaxAccountId':_0xf7feaa[_0x6b3f('0x37')]['id']}})[_0x6b3f('0x10')](function(_0x507c54){if(_0x507c54){return[_0x507c54,![]];}return db['FaxInteraction']['create'](_0x4dcc63)[_0x6b3f('0x10')](function(_0x38daed){return[_0x38daed,!![]];});});}else{throw new Error(_0x6b3f('0x49'));}})['spread'](function(_0x358089,_0x5124ee){var _0x3715ec=_0x358089[_0x6b3f('0x40')]({'plain':!![]});if(_0x5124ee){if(_0x547b38[_0x6b3f('0x37')][_0x6b3f('0x4a')]){_0x547b38[_0x6b3f('0x41')][_0x6b3f('0x4b')]({'id':0x0,'priority':_0x547b38[_0x6b3f('0x41')]['length']+0x1,'app':'close','appdata':_0x6b3f('0x4c'),'interval':'*,*,*,*'});}_0x3715ec[_0x6b3f('0x4d')]=!![];}else{_0x3715ec[_0x6b3f('0x4d')]=![];}_0x547b38[_0x6b3f('0x4e')]=_0x3715ec;return db[_0x6b3f('0x4f')]['create']({'body':_0xf7feaa[_0x6b3f('0x27')][_0x6b3f('0x27')],'FaxAccountId':_0xf7feaa[_0x6b3f('0x37')]['id'],'FaxInteractionId':_0x358089['id'],'direction':'in','ContactId':_0x358089[_0x6b3f('0x50')],'AttachmentId':_0xf7feaa[_0x6b3f('0x27')][_0x6b3f('0x51')]});})[_0x6b3f('0x10')](function(_0x34e717){_0x547b38[_0x6b3f('0x16')]=_0x34e717;if(!_0x547b38[_0x6b3f('0x4e')]['UserId'])return;return db[_0x6b3f('0x52')][_0x6b3f('0x36')]({'attributes':['id',_0x6b3f('0x53')],'where':{'id':_0x547b38[_0x6b3f('0x4e')][_0x6b3f('0x54')]}});})[_0x6b3f('0x10')](function(_0x43c70f){if(_0x43c70f){_0x547b38[_0x6b3f('0x41')][_0x6b3f('0x55')]({'id':0x0,'priority':0x0,'app':_0x6b3f('0x56'),'appdata':_0x43c70f[_0x6b3f('0x53')]+','+(_0x547b38[_0x6b3f('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x6b3f('0x57')});}if(!_0x547b38['interaction'][_0x6b3f('0x58')])return;return db['FaxQueue'][_0x6b3f('0x36')]({'attributes':['id',_0x6b3f('0x53')],'where':{'id':_0x547b38['interaction'][_0x6b3f('0x58')]}});})[_0x6b3f('0x10')](function(_0x502184){if(_0x502184){_0x547b38['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x6b3f('0x59'),'appdata':_0x502184[_0x6b3f('0x53')]+','+(_0x547b38['account'][_0x6b3f('0x5a')]||0x12c),'interval':_0x6b3f('0x57')});}return respondWithRpcPromise(_0x6b3f('0x5b'),_0x6b3f('0x5c'),_0x547b38);})['then'](function(_0x5759ad){_0x2a28bc(_0x5759ad);})[_0x6b3f('0x25')](function(_0x304b65){_0x467af8(_0xe4a135['error'](0x1f4,_0x304b65[_0x6b3f('0x16')]));});});}; \ No newline at end of file +var _0xf70d=['message','result','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','debug','catch','body','fax','CmContact','Sequelize','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','priority','asc','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x119953,_0xcd30c8){var _0x22ef82=function(_0x28e497){while(--_0x28e497){_0x119953['push'](_0x119953['shift']());}};_0x22ef82(++_0xcd30c8);}(_0xf70d,0x113));var _0xdf70=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xf70d[_0x166742];return _0xb7814a;};'use strict';var _=require(_0xdf70('0x0'));var util=require(_0xdf70('0x1'));var moment=require(_0xdf70('0x2'));var BPromise=require(_0xdf70('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf70('0x4'));var db=require(_0xdf70('0x5'))['db'];var utils=require(_0xdf70('0x6'));var logger=require(_0xdf70('0x7'))(_0xdf70('0x8'));var config=require(_0xdf70('0x9'));var jayson=require(_0xdf70('0xa'));var client=jayson[_0xdf70('0xb')][_0xdf70('0xc')]({'port':0x232c});config[_0xdf70('0xd')]=_[_0xdf70('0xe')](config[_0xdf70('0xd')],{'host':_0xdf70('0xf'),'port':0x18eb});var socket=require(_0xdf70('0x10'))(new Redis(config['redis']));require(_0xdf70('0x11'))[_0xdf70('0x12')](socket);function respondWithRpcPromise(_0x44d33d,_0x5aa955,_0x52c26a){return new BPromise(function(_0x41cc65,_0x3dd446){return client[_0xdf70('0x13')](_0x44d33d,_0x52c26a)[_0xdf70('0x14')](function(_0x1191be){logger[_0xdf70('0x15')](_0xdf70('0x16'),_0x5aa955,_0xdf70('0x17'));logger['debug'](_0xdf70('0x18'),_0x5aa955,_0xdf70('0x17'),JSON[_0xdf70('0x19')](_0x1191be));if(_0x1191be[_0xdf70('0x1a')]){if(_0x1191be[_0xdf70('0x1a')][_0xdf70('0x1b')]===0x1f4){logger[_0xdf70('0x1a')](_0xdf70('0x16'),_0x5aa955,_0x1191be['error'][_0xdf70('0x1c')]);return _0x3dd446(_0x1191be[_0xdf70('0x1a')]['message']);}logger[_0xdf70('0x1a')]('FaxAccount,\x20%s,\x20%s',_0x5aa955,_0x1191be[_0xdf70('0x1a')]['message']);return _0x41cc65(_0x1191be[_0xdf70('0x1a')][_0xdf70('0x1c')]);}else{logger[_0xdf70('0x15')](_0xdf70('0x16'),_0x5aa955,_0xdf70('0x17'));_0x41cc65(_0x1191be[_0xdf70('0x1d')][_0xdf70('0x1c')]);}})['catch'](function(_0x3adea2){logger[_0xdf70('0x1a')]('FaxAccount,\x20%s,\x20%s',_0x5aa955,_0x3adea2);_0x3dd446(_0x3adea2);});});}exports[_0xdf70('0x1e')]=function(_0x6e6be4){var _0x5c1e84=this;return new Promise(function(_0x16cda4,_0x36078c){return db[_0xdf70('0x1f')][_0xdf70('0x20')]({'raw':_0x6e6be4[_0xdf70('0x21')]?_0x6e6be4['options'][_0xdf70('0x22')]===undefined?!![]:![]:!![],'where':_0x6e6be4[_0xdf70('0x21')]?_0x6e6be4[_0xdf70('0x21')]['where']||null:null,'attributes':_0x6e6be4[_0xdf70('0x21')]?_0x6e6be4['options'][_0xdf70('0x23')]||null:null,'limit':_0x6e6be4['options']?_0x6e6be4[_0xdf70('0x21')][_0xdf70('0x24')]||null:null,'include':_0x6e6be4['options']?_0x6e6be4[_0xdf70('0x21')][_0xdf70('0x25')]?_[_0xdf70('0x26')](_0x6e6be4['options'][_0xdf70('0x25')],function(_0x55b69b){return{'model':db[_0x55b69b[_0xdf70('0x27')]],'as':_0x55b69b['as'],'attributes':_0x55b69b[_0xdf70('0x23')],'include':_0x55b69b[_0xdf70('0x25')]?_[_0xdf70('0x26')](_0x55b69b['include'],function(_0x51711f){return{'model':db[_0x51711f[_0xdf70('0x27')]],'as':_0x51711f['as'],'attributes':_0x51711f[_0xdf70('0x23')],'include':_0x51711f['include']?_['map'](_0x51711f['include'],function(_0x354408){return{'model':db[_0x354408[_0xdf70('0x27')]],'as':_0x354408['as'],'attributes':_0x354408[_0xdf70('0x23')]};}):[]};}):[]};}):[]:[]})[_0xdf70('0x14')](function(_0x1ea7f7){logger[_0xdf70('0x15')](_0xdf70('0x1e'),_0x6e6be4);logger[_0xdf70('0x28')](_0xdf70('0x1e'),_0x6e6be4,JSON[_0xdf70('0x19')](_0x1ea7f7));_0x16cda4(_0x1ea7f7);})[_0xdf70('0x29')](function(_0x205f24){logger['error'](_0xdf70('0x1e'),_0x205f24[_0xdf70('0x1c')],_0x6e6be4);_0x36078c(_0x5c1e84['error'](0x1f4,_0x205f24[_0xdf70('0x1c')]));});});};exports['NotifyFaxAccount']=function(_0x1932a6,_0xf365d6,_0x52abed){var _0x1b6212=this;return new Promise(function(_0x598718,_0x456f8a){var _0x2f2d57={'body':_0x1932a6[_0xdf70('0x2a')],'channel':_0xdf70('0x2b')};var _0x478810=[];var _0x41e906=[];var _0x443176={};return db[_0xdf70('0x2c')]['describe']()[_0xdf70('0x14')](function(_0x458d90){if(!_0x458d90){throw new db[(_0xdf70('0x2d'))]['ValidationError'](_0xdf70('0x2e'));}_0x478810=_[_0xdf70('0x2f')](_[_0xdf70('0x30')](_0x458d90),['createdAt',_0xdf70('0x31')]);_0x41e906=_[_0xdf70('0x2f')](_[_0xdf70('0x30')](_0x458d90),[_0xdf70('0x32'),_0xdf70('0x31'),_0xdf70('0x33'),_0xdf70('0x34')]);if(_0x1932a6[_0xdf70('0x2a')]['id']){delete _0x1932a6['body']['id'];}if(_[_0xdf70('0x35')](_0x1932a6[_0xdf70('0x2a')][_0xdf70('0x36')])){throw new db[(_0xdf70('0x2d'))][(_0xdf70('0x37'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1932a6[_0xdf70('0x2a')][_0xdf70('0x2a')])||_0x1932a6[_0xdf70('0x2a')][_0xdf70('0x2a')]===''){throw new db[(_0xdf70('0x2d'))][(_0xdf70('0x37'))](_0xdf70('0x38'));}if(_[_0xdf70('0x35')](_0x1932a6['body'][_0xdf70('0x39')])){throw new db[(_0xdf70('0x2d'))][(_0xdf70('0x37'))](_0xdf70('0x3a')+_0x41e906);}if(!_[_0xdf70('0x3b')](_0x41e906,_0x1932a6[_0xdf70('0x2a')]['mapKey'])){throw new db[(_0xdf70('0x2d'))][(_0xdf70('0x37'))](_0xdf70('0x3c')+_0x41e906);}_0x443176[_0x1932a6[_0xdf70('0x2a')][_0xdf70('0x39')]]=_0x1932a6[_0xdf70('0x2a')][_0xdf70('0x36')];})[_0xdf70('0x14')](function(){return db[_0xdf70('0x1f')][_0xdf70('0x3d')]({'where':{'id':_0x1932a6[_0xdf70('0x3e')]['id']},'include':[{'model':db[_0xdf70('0x3f')],'as':_0xdf70('0x40'),'include':[{'model':db[_0xdf70('0x2c')],'as':_0xdf70('0x41'),'where':_0x443176,'limit':0x1,'order':[[_0xdf70('0x31'),_0xdf70('0x42')]]}]},{'model':db[_0xdf70('0x43')],'as':_0xdf70('0x44')}]});})[_0xdf70('0x14')](function(_0xacd4e3){if(_0xacd4e3&&_0xacd4e3['List']){var _0x41c2ef=_0xacd4e3[_0xdf70('0x45')]({'plain':!![]});_0x2f2d57[_0xdf70('0x3e')]=_0x41c2ef;_0x2f2d57['applications']=_0x41c2ef[_0xdf70('0x44')];_0x2f2d57[_0xdf70('0x46')]=_0x41c2ef[_0xdf70('0x40')];_0x2f2d57[_0xdf70('0x47')]=_[_0xdf70('0x48')](_0x2f2d57[_0xdf70('0x47')],[_0xdf70('0x49')],[_0xdf70('0x4a')]);if(_0x2f2d57[_0xdf70('0x3e')][_0xdf70('0x44')]){delete _0x2f2d57[_0xdf70('0x3e')][_0xdf70('0x44')];}if(_0x2f2d57[_0xdf70('0x3e')][_0xdf70('0x40')]&&_0x2f2d57[_0xdf70('0x3e')]['List'][_0xdf70('0x41')]['length']){return _0x2f2d57[_0xdf70('0x3e')][_0xdf70('0x40')][_0xdf70('0x41')][0x0];}var _0x310ef8=_[_0xdf70('0xe')](_0x1932a6[_0xdf70('0x2a')],{'firstName':_0x1932a6[_0xdf70('0x2a')][_0xdf70('0x36')],'ListId':_0x41c2ef[_0xdf70('0x34')]});_0x310ef8[_0x1932a6[_0xdf70('0x2a')][_0xdf70('0x39')]]=_0x1932a6['body'][_0xdf70('0x36')];return db[_0xdf70('0x2c')][_0xdf70('0x4b')](_0x310ef8,{'fields':_0x478810,'raw':!![]});}})[_0xdf70('0x14')](function(_0x7333ac){_0x2f2d57[_0xdf70('0x4c')]=_0x7333ac;if(_0x7333ac){var _0x1f0031={'ContactId':_0x7333ac['id'],'FaxAccountId':_0x1932a6[_0xdf70('0x3e')]['id'],'fax':_0x7333ac[_0xdf70('0x2b')]};return db[_0xdf70('0x4d')][_0xdf70('0x3d')]({'where':{'ContactId':_0x7333ac['id'],'closed':![],'FaxAccountId':_0x1932a6[_0xdf70('0x3e')]['id']}})['then'](function(_0x59cefd){if(_0x59cefd){return[_0x59cefd,![]];}return db[_0xdf70('0x4d')][_0xdf70('0x4b')](_0x1f0031)[_0xdf70('0x14')](function(_0x12c78e){return[_0x12c78e,!![]];});});}else{throw new Error(_0xdf70('0x4e'));}})[_0xdf70('0x4f')](function(_0x13a816,_0x5aedfd){var _0xfb6a38=_0x13a816[_0xdf70('0x45')]({'plain':!![]});if(_0x5aedfd){if(_0x2f2d57[_0xdf70('0x3e')][_0xdf70('0x50')]){_0x2f2d57[_0xdf70('0x47')][_0xdf70('0x51')]({'id':0x0,'priority':_0x2f2d57[_0xdf70('0x47')][_0xdf70('0x52')]+0x1,'app':_0xdf70('0x53'),'appdata':_0xdf70('0x54'),'interval':_0xdf70('0x55')});}_0xfb6a38[_0xdf70('0x56')]=!![];}else{_0xfb6a38[_0xdf70('0x56')]=![];}_0x2f2d57[_0xdf70('0x57')]=_0xfb6a38;return db[_0xdf70('0x58')][_0xdf70('0x4b')]({'body':_0x1932a6[_0xdf70('0x2a')][_0xdf70('0x2a')],'FaxAccountId':_0x1932a6[_0xdf70('0x3e')]['id'],'FaxInteractionId':_0x13a816['id'],'direction':'in','ContactId':_0x13a816[_0xdf70('0x59')],'AttachmentId':_0x1932a6[_0xdf70('0x2a')]['AttachmentId']});})['then'](function(_0x35bfa7){_0x2f2d57['message']=_0x35bfa7;if(!_0x2f2d57[_0xdf70('0x57')][_0xdf70('0x5a')])return;return db[_0xdf70('0x5b')][_0xdf70('0x3d')]({'attributes':['id',_0xdf70('0x5c')],'where':{'id':_0x2f2d57[_0xdf70('0x57')][_0xdf70('0x5a')]}});})[_0xdf70('0x14')](function(_0x47e373){if(_0x47e373){_0x2f2d57[_0xdf70('0x47')][_0xdf70('0x5d')]({'id':0x0,'priority':0x0,'app':_0xdf70('0x5e'),'appdata':_0x47e373['name']+','+(_0x2f2d57[_0xdf70('0x3e')][_0xdf70('0x5f')]||0xa),'interval':'*,*,*,*'});}if(!_0x2f2d57[_0xdf70('0x57')][_0xdf70('0x60')])return;return db[_0xdf70('0x61')][_0xdf70('0x3d')]({'attributes':['id',_0xdf70('0x5c')],'where':{'id':_0x2f2d57[_0xdf70('0x57')]['queueId']}});})[_0xdf70('0x14')](function(_0x5453ba){if(_0x5453ba){_0x2f2d57[_0xdf70('0x47')][_0xdf70('0x5d')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5453ba[_0xdf70('0x5c')]+','+(_0x2f2d57[_0xdf70('0x3e')][_0xdf70('0x62')]||0x12c),'interval':_0xdf70('0x55')});}return respondWithRpcPromise(_0xdf70('0x63'),_0xdf70('0x64'),_0x2f2d57);})['then'](function(_0x561c2f){_0x598718(_0x561c2f);})[_0xdf70('0x29')](function(_0x30fadf){_0x456f8a(_0x1b6212[_0xdf70('0x1a')](0x1f4,_0x30fadf[_0xdf70('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 83de4ee..b787670 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 _0x0b99=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x15a06f,_0x19f97b){var _0x44c9bc=function(_0x59069b){while(--_0x59069b){_0x15a06f['push'](_0x15a06f['shift']());}};_0x44c9bc(++_0x19f97b);}(_0x0b99,0x1c1));var _0x90b9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0b99[_0x20a584];return _0x4b41a8;};'use strict';var FaxAccountEvents=require(_0x90b9('0x0'));var events=[_0x90b9('0x1'),_0x90b9('0x2'),_0x90b9('0x3')];function createListener(_0x5c3513,_0x33bc9c){return function(_0xa2185a){_0x33bc9c[_0x90b9('0x4')](_0x5c3513,_0xa2185a);};}function removeListener(_0x9373a8,_0x2e0513){return function(){FaxAccountEvents[_0x90b9('0x5')](_0x9373a8,_0x2e0513);};}exports[_0x90b9('0x6')]=function(_0x334744){for(var _0x4dafeb=0x0,_0x2c0acb=events[_0x90b9('0x7')];_0x4dafeb<_0x2c0acb;_0x4dafeb++){var _0x31f3f0=events[_0x4dafeb];var _0x35b610=createListener(_0x90b9('0x8')+_0x31f3f0,_0x334744);FaxAccountEvents['on'](_0x31f3f0,_0x35b610);}}; \ No newline at end of file +var _0x9ed5=['./faxAccount.events','save','remove','emit','removeListener','register','faxAccount:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ed5,0x19d));var _0x59ed=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x9ed5[_0x2763f2];return _0x3ef471;};'use strict';var FaxAccountEvents=require(_0x59ed('0x0'));var events=[_0x59ed('0x1'),_0x59ed('0x2'),'update'];function createListener(_0x4c7593,_0x30168b){return function(_0x18880c){_0x30168b[_0x59ed('0x3')](_0x4c7593,_0x18880c);};}function removeListener(_0x24f665,_0x361278){return function(){FaxAccountEvents[_0x59ed('0x4')](_0x24f665,_0x361278);};}exports[_0x59ed('0x5')]=function(_0x42c19c){for(var _0x57be8c=0x0,_0x909968=events['length'];_0x57be8c<_0x909968;_0x57be8c++){var _0x29ccec=events[_0x57be8c];var _0x32dfba=createListener(_0x59ed('0x6')+_0x29ccec,_0x42c19c);FaxAccountEvents['on'](_0x29ccec,_0x32dfba);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 1d32fa5..43ee496 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 _0xa437=['put','update','delete','destroy','/:id/dispositions','removeAnswers','removeAgents','exports','multer','path','express','Router','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','index','/:id','show','getDispositions','/:id/canned_answers','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents'];(function(_0x5029a7,_0x26c3c5){var _0xfa3750=function(_0x30ebf1){while(--_0x30ebf1){_0x5029a7['push'](_0x5029a7['shift']());}};_0xfa3750(++_0x26c3c5);}(_0xa437,0x1d0));var _0x7a43=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa437[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x7a43('0x0'));var util=require('util');var path=require(_0x7a43('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a43('0x2'));var router=express[_0x7a43('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7a43('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7a43('0x5'));router[_0x7a43('0x6')]('/',auth[_0x7a43('0x7')](),controller[_0x7a43('0x8')]);router[_0x7a43('0x6')]('/describe',auth[_0x7a43('0x7')](),controller['describe']);router['get'](_0x7a43('0x9'),auth[_0x7a43('0x7')](),controller[_0x7a43('0xa')]);router[_0x7a43('0x6')]('/:id/dispositions',auth[_0x7a43('0x7')](),controller[_0x7a43('0xb')]);router['get'](_0x7a43('0xc'),auth[_0x7a43('0x7')](),controller['getAnswers']);router[_0x7a43('0x6')](_0x7a43('0xd'),auth[_0x7a43('0x7')](),controller['getInteractions']);router[_0x7a43('0x6')](_0x7a43('0xe'),auth[_0x7a43('0x7')](),controller['getApplications']);router[_0x7a43('0x6')](_0x7a43('0xf'),auth['isAuthenticated'](),controller[_0x7a43('0x10')]);router[_0x7a43('0x6')](_0x7a43('0x11'),auth[_0x7a43('0x7')](),controller[_0x7a43('0x12')]);router[_0x7a43('0x13')]('/',auth[_0x7a43('0x7')](),controller[_0x7a43('0x14')]);router[_0x7a43('0x13')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7a43('0x15')]);router[_0x7a43('0x13')](_0x7a43('0xc'),auth[_0x7a43('0x7')](),controller[_0x7a43('0x16')]);router['post'](_0x7a43('0xd'),auth[_0x7a43('0x7')](),controller[_0x7a43('0x17')]);router[_0x7a43('0x13')](_0x7a43('0xe'),auth[_0x7a43('0x7')](),controller[_0x7a43('0x18')]);router['post']('/addaccountapplications',auth[_0x7a43('0x7')](),controller[_0x7a43('0x19')]);router['post']('/updateaccountapplications',auth[_0x7a43('0x7')](),controller[_0x7a43('0x1a')]);router['post'](_0x7a43('0x1b'),auth['isAuthenticated'](),controller[_0x7a43('0x1c')]);router[_0x7a43('0x13')]('/:id/users',auth[_0x7a43('0x7')](),controller[_0x7a43('0x1d')]);router[_0x7a43('0x1e')](_0x7a43('0x9'),auth[_0x7a43('0x7')](),controller[_0x7a43('0x1f')]);router[_0x7a43('0x20')]('/:id',auth[_0x7a43('0x7')](),controller[_0x7a43('0x21')]);router[_0x7a43('0x20')](_0x7a43('0x22'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x7a43('0x20')](_0x7a43('0xc'),auth[_0x7a43('0x7')](),controller[_0x7a43('0x23')]);router[_0x7a43('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0x7a43('0x24')]);module[_0x7a43('0x25')]=router; \ No newline at end of file +var _0x65bb=['create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post'];(function(_0x279ce4,_0x13a3c8){var _0x3e8bcd=function(_0x122463){while(--_0x122463){_0x279ce4['push'](_0x279ce4['shift']());}};_0x3e8bcd(++_0x13a3c8);}(_0x65bb,0x1b7));var _0xb65b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x65bb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb65b('0x0'));var util=require(_0xb65b('0x1'));var path=require(_0xb65b('0x2'));var timeout=require(_0xb65b('0x3'));var express=require(_0xb65b('0x4'));var router=express['Router']();var fs_extra=require(_0xb65b('0x5'));var auth=require(_0xb65b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb65b('0x7'));router[_0xb65b('0x8')]('/',auth[_0xb65b('0x9')](),controller[_0xb65b('0xa')]);router['get'](_0xb65b('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb65b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb65b('0x8')](_0xb65b('0xd'),auth[_0xb65b('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xb65b('0x8')](_0xb65b('0xe'),auth[_0xb65b('0x9')](),controller[_0xb65b('0xf')]);router[_0xb65b('0x8')](_0xb65b('0x10'),auth['isAuthenticated'](),controller[_0xb65b('0x11')]);router[_0xb65b('0x8')](_0xb65b('0x12'),auth[_0xb65b('0x9')](),controller[_0xb65b('0x13')]);router[_0xb65b('0x8')](_0xb65b('0x14'),auth[_0xb65b('0x9')](),controller[_0xb65b('0x15')]);router[_0xb65b('0x16')]('/',auth[_0xb65b('0x9')](),controller[_0xb65b('0x17')]);router[_0xb65b('0x16')](_0xb65b('0xd'),auth['isAuthenticated'](),controller[_0xb65b('0x18')]);router[_0xb65b('0x16')](_0xb65b('0x19'),auth[_0xb65b('0x9')](),controller[_0xb65b('0x1a')]);router[_0xb65b('0x16')](_0xb65b('0xe'),auth[_0xb65b('0x9')](),controller[_0xb65b('0x1b')]);router[_0xb65b('0x16')](_0xb65b('0x10'),auth['isAuthenticated'](),controller[_0xb65b('0x1c')]);router[_0xb65b('0x16')](_0xb65b('0x1d'),auth[_0xb65b('0x9')](),controller[_0xb65b('0x1e')]);router[_0xb65b('0x16')](_0xb65b('0x1f'),auth[_0xb65b('0x9')](),controller[_0xb65b('0x20')]);router[_0xb65b('0x16')](_0xb65b('0x21'),auth['isAuthenticated'](),controller['send']);router[_0xb65b('0x16')](_0xb65b('0x14'),auth[_0xb65b('0x9')](),controller[_0xb65b('0x22')]);router[_0xb65b('0x23')]('/:id',auth[_0xb65b('0x9')](),controller[_0xb65b('0x24')]);router['delete'](_0xb65b('0xc'),auth['isAuthenticated'](),controller[_0xb65b('0x25')]);router[_0xb65b('0x26')]('/:id/dispositions',auth[_0xb65b('0x9')](),controller[_0xb65b('0x27')]);router[_0xb65b('0x26')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb65b('0x28')]);router[_0xb65b('0x26')]('/:id/users',auth[_0xb65b('0x9')](),controller[_0xb65b('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 8080921..1d68763 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 _0x6757=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x1ccc4e,_0x18918f){var _0x1965fe=function(_0x2adf50){while(--_0x2adf50){_0x1ccc4e['push'](_0x1ccc4e['shift']());}};_0x1965fe(++_0x18918f);}(_0x6757,0x8e));var _0x7675=function(_0x3ad809,_0x2ed353){_0x3ad809=_0x3ad809-0x0;var _0xd3244b=_0x6757[_0x3ad809];return _0xd3244b;};'use strict';var Sequelize=require(_0x7675('0x0'));module[_0x7675('0x1')]={'priority':{'type':Sequelize[_0x7675('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7675('0x3')],'allowNull':![],'defaultValue':_0x7675('0x4')},'appdata':{'type':Sequelize[_0x7675('0x5')]()},'description':{'type':Sequelize[_0x7675('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2b41=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x27dfd5,_0x1de10c){var _0x21a9dd=function(_0x588d19){while(--_0x588d19){_0x27dfd5['push'](_0x27dfd5['shift']());}};_0x21a9dd(++_0x1de10c);}(_0x2b41,0x191));var _0x12b4=function(_0x1d4929,_0x6f0475){_0x1d4929=_0x1d4929-0x0;var _0x161ace=_0x2b41[_0x1d4929];return _0x161ace;};'use strict';var Sequelize=require(_0x12b4('0x0'));module[_0x12b4('0x1')]={'priority':{'type':Sequelize[_0x12b4('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x12b4('0x3')},'appdata':{'type':Sequelize[_0x12b4('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x12b4('0x5')],'defaultValue':_0x12b4('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e5ec881..a3f7972 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 _0xc876=['sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','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','../../mysqldb'];(function(_0x3367e3,_0x488a79){var _0x4a8cd2=function(_0xbf6348){while(--_0xbf6348){_0x3367e3['push'](_0x3367e3['shift']());}};_0x4a8cd2(++_0x488a79);}(_0xc876,0x1f4));var _0x6c87=function(_0x7ecce1,_0x5c3fbf){_0x7ecce1=_0x7ecce1-0x0;var _0x2dd976=_0xc876[_0x7ecce1];return _0x2dd976;};'use strict';var emlformat=require(_0x6c87('0x0'));var rimraf=require(_0x6c87('0x1'));var zipdir=require(_0x6c87('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c87('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6c87('0x4'));var path=require(_0x6c87('0x5'));var sox=require(_0x6c87('0x6'));var csv=require(_0x6c87('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c87('0x8'));var _=require(_0x6c87('0x9'));var squel=require(_0x6c87('0xa'));var crypto=require(_0x6c87('0xb'));var jsforce=require(_0x6c87('0xc'));var deskjs=require(_0x6c87('0xd'));var toCsv=require(_0x6c87('0x7'));var querystring=require(_0x6c87('0xe'));var Papa=require(_0x6c87('0xf'));var Redis=require(_0x6c87('0x10'));var authService=require(_0x6c87('0x11'));var qs=require(_0x6c87('0x12'));var as=require(_0x6c87('0x13'));var hardwareService=require(_0x6c87('0x14'));var logger=require(_0x6c87('0x15'))(_0x6c87('0x16'));var utils=require(_0x6c87('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6c87('0x18'))['db'];function respondWithStatusCode(_0x4ab3a3,_0x29f3ce){_0x29f3ce=_0x29f3ce||0xcc;return function(_0x4ead40){if(_0x4ead40){return _0x4ab3a3[_0x6c87('0x19')](_0x29f3ce);}return _0x4ab3a3[_0x6c87('0x1a')](_0x29f3ce)['end']();};}function respondWithResult(_0x440f26,_0x2aafb6){_0x2aafb6=_0x2aafb6||0xc8;return function(_0x26f115){if(_0x26f115){return _0x440f26[_0x6c87('0x1a')](_0x2aafb6)[_0x6c87('0x1b')](_0x26f115);}};}function respondWithFilteredResult(_0x5760d1,_0x406fa8){return function(_0x28c128){if(_0x28c128){var _0xecefe9=typeof _0x406fa8['offset']===_0x6c87('0x1c')&&typeof _0x406fa8[_0x6c87('0x1d')]===_0x6c87('0x1c');var _0x53a265=_0x28c128['count'];var _0xa2d41b=_0xecefe9?0x0:_0x406fa8[_0x6c87('0x1e')];var _0x17ccb7=_0xecefe9?_0x28c128[_0x6c87('0x1f')]:_0x406fa8['offset']+_0x406fa8[_0x6c87('0x1d')];var _0x57fdd0;if(_0x17ccb7>=_0x53a265){_0x17ccb7=_0x53a265;_0x57fdd0=0xc8;}else{_0x57fdd0=0xce;}_0x5760d1[_0x6c87('0x1a')](_0x57fdd0);return _0x5760d1[_0x6c87('0x20')](_0x6c87('0x21'),_0xa2d41b+'-'+_0x17ccb7+'/'+_0x53a265)['json'](_0x28c128);}return null;};}function patchUpdates(_0x10d515){return function(_0x50831e){try{jsonpatch[_0x6c87('0x22')](_0x50831e,_0x10d515,!![]);}catch(_0x55eafb){return BPromise[_0x6c87('0x23')](_0x55eafb);}return _0x50831e[_0x6c87('0x24')]();};}function saveUpdates(_0x7b36b1,_0x25eacb){return function(_0x41695d){if(_0x41695d){return _0x41695d[_0x6c87('0x25')](_0x7b36b1)['then'](function(_0x4e8778){return _0x4e8778;});}return null;};}function removeEntity(_0x300376,_0x128480){return function(_0x580447){if(_0x580447){return _0x580447[_0x6c87('0x26')]()[_0x6c87('0x27')](function(){_0x300376[_0x6c87('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d1204,_0x566485){return function(_0x32c748){if(!_0x32c748){_0x3d1204[_0x6c87('0x19')](0x194);}return _0x32c748;};}function handleError(_0x2c7d89,_0x4f24fe){_0x4f24fe=_0x4f24fe||0x1f4;return function(_0x13db86){logger[_0x6c87('0x28')](_0x13db86[_0x6c87('0x29')]);if(_0x13db86[_0x6c87('0x2a')]){delete _0x13db86[_0x6c87('0x2a')];}_0x2c7d89['status'](_0x4f24fe)[_0x6c87('0x2b')](_0x13db86);};}exports[_0x6c87('0x2c')]=function(_0x10c61d,_0x4a3c2e){var _0x1310fb={},_0x5dad6a={},_0x14c65a={'count':0x0,'rows':[]};var _0x495c23=_[_0x6c87('0x2d')](db[_0x6c87('0x2e')][_0x6c87('0x2f')],function(_0x36318c){return{'name':_0x36318c[_0x6c87('0x30')],'type':_0x36318c[_0x6c87('0x31')]['key']};});_0x5dad6a[_0x6c87('0x32')]=_[_0x6c87('0x2d')](_0x495c23,_0x6c87('0x2a'));_0x5dad6a['query']=_[_0x6c87('0x33')](_0x10c61d['query']);_0x5dad6a[_0x6c87('0x34')]=_[_0x6c87('0x35')](_0x5dad6a[_0x6c87('0x32')],_0x5dad6a[_0x6c87('0x36')]);_0x1310fb[_0x6c87('0x37')]=_[_0x6c87('0x35')](_0x5dad6a[_0x6c87('0x32')],qs[_0x6c87('0x38')](_0x10c61d[_0x6c87('0x36')]['fields']));_0x1310fb['attributes']=_0x1310fb[_0x6c87('0x37')][_0x6c87('0x39')]?_0x1310fb['attributes']:_0x5dad6a[_0x6c87('0x32')];if(!_0x10c61d[_0x6c87('0x36')]['hasOwnProperty'](_0x6c87('0x3a'))){_0x1310fb[_0x6c87('0x1d')]=qs['limit'](_0x10c61d[_0x6c87('0x36')][_0x6c87('0x1d')]);_0x1310fb[_0x6c87('0x1e')]=qs[_0x6c87('0x1e')](_0x10c61d[_0x6c87('0x36')]['offset']);}_0x1310fb[_0x6c87('0x3b')]=qs['sort'](_0x10c61d['query'][_0x6c87('0x3c')]);_0x1310fb[_0x6c87('0x3d')]=qs[_0x6c87('0x34')](_[_0x6c87('0x3e')](_0x10c61d[_0x6c87('0x36')],_0x5dad6a[_0x6c87('0x34')]),_0x495c23);if(_0x10c61d[_0x6c87('0x36')][_0x6c87('0x3f')]){_0x1310fb['where']=_['merge'](_0x1310fb[_0x6c87('0x3d')],{'$or':_[_0x6c87('0x2d')](_0x495c23,function(_0x4f94c2){if(_0x4f94c2['type']!=='VIRTUAL'){var _0x3f514a={};_0x3f514a[_0x4f94c2[_0x6c87('0x2a')]]={'$like':'%'+_0x10c61d[_0x6c87('0x36')][_0x6c87('0x3f')]+'%'};return _0x3f514a;}})});}_0x1310fb=_[_0x6c87('0x40')]({},_0x1310fb,_0x10c61d[_0x6c87('0x41')]);var _0x583570={'where':_0x1310fb[_0x6c87('0x3d')]};return db[_0x6c87('0x2e')][_0x6c87('0x1f')](_0x583570)[_0x6c87('0x27')](function(_0x15dfca){_0x14c65a[_0x6c87('0x1f')]=_0x15dfca;if(_0x10c61d[_0x6c87('0x36')][_0x6c87('0x42')]){_0x1310fb['include']=[{'all':!![]}];}return db[_0x6c87('0x2e')][_0x6c87('0x43')](_0x1310fb);})[_0x6c87('0x27')](function(_0x215f7c){_0x14c65a[_0x6c87('0x44')]=_0x215f7c;return _0x14c65a;})['then'](respondWithFilteredResult(_0x4a3c2e,_0x1310fb))[_0x6c87('0x45')](handleError(_0x4a3c2e,null));};exports[_0x6c87('0x46')]=function(_0x4fc661,_0x159314){var _0x121e73={'raw':!![],'where':{'id':_0x4fc661[_0x6c87('0x47')]['id']}},_0x2f550d={};_0x2f550d[_0x6c87('0x32')]=_[_0x6c87('0x33')](db['FaxApplication'][_0x6c87('0x2f')]);_0x2f550d[_0x6c87('0x36')]=_['keys'](_0x4fc661['query']);_0x2f550d[_0x6c87('0x34')]=_['intersection'](_0x2f550d['model'],_0x2f550d[_0x6c87('0x36')]);_0x121e73[_0x6c87('0x37')]=_[_0x6c87('0x35')](_0x2f550d['model'],qs[_0x6c87('0x38')](_0x4fc661[_0x6c87('0x36')][_0x6c87('0x38')]));_0x121e73[_0x6c87('0x37')]=_0x121e73['attributes']['length']?_0x121e73[_0x6c87('0x37')]:_0x2f550d[_0x6c87('0x32')];if(_0x4fc661[_0x6c87('0x36')][_0x6c87('0x42')]){_0x121e73['include']=[{'all':!![]}];}_0x121e73=_[_0x6c87('0x40')]({},_0x121e73,_0x4fc661[_0x6c87('0x41')]);return db[_0x6c87('0x2e')][_0x6c87('0x48')](_0x121e73)['then'](handleEntityNotFound(_0x159314,null))[_0x6c87('0x27')](respondWithResult(_0x159314,null))[_0x6c87('0x45')](handleError(_0x159314,null));};exports[_0x6c87('0x49')]=function(_0x4b18d3,_0x14bb6e){return db[_0x6c87('0x2e')]['create'](_0x4b18d3[_0x6c87('0x4a')],{})[_0x6c87('0x27')](respondWithResult(_0x14bb6e,0xc9))[_0x6c87('0x45')](handleError(_0x14bb6e,null));};exports[_0x6c87('0x25')]=function(_0x4c64fb,_0x1cf7b5){if(_0x4c64fb['body']['id']){delete _0x4c64fb[_0x6c87('0x4a')]['id'];}return db[_0x6c87('0x2e')][_0x6c87('0x48')]({'where':{'id':_0x4c64fb['params']['id']}})[_0x6c87('0x27')](handleEntityNotFound(_0x1cf7b5,null))[_0x6c87('0x27')](saveUpdates(_0x4c64fb[_0x6c87('0x4a')],null))[_0x6c87('0x27')](respondWithResult(_0x1cf7b5,null))[_0x6c87('0x45')](handleError(_0x1cf7b5,null));};exports['destroy']=function(_0x1c26b7,_0x45af61){return db[_0x6c87('0x2e')][_0x6c87('0x48')]({'where':{'id':_0x1c26b7[_0x6c87('0x47')]['id']}})[_0x6c87('0x27')](handleEntityNotFound(_0x45af61,null))[_0x6c87('0x27')](removeEntity(_0x45af61,null))[_0x6c87('0x45')](handleError(_0x45af61,null));}; \ No newline at end of file +var _0x672c=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','name','index','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','FaxApplication','includeAll','include','findAll','rows','params','keys','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path'];(function(_0x1019e3,_0x50d7b0){var _0x48b834=function(_0x2f9d74){while(--_0x2f9d74){_0x1019e3['push'](_0x1019e3['shift']());}};_0x48b834(++_0x50d7b0);}(_0x672c,0x144));var _0xc672=function(_0x20ba09,_0x52ec07){_0x20ba09=_0x20ba09-0x0;var _0xe02691=_0x672c[_0x20ba09];return _0xe02691;};'use strict';var emlformat=require(_0xc672('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc672('0x1'));var jsonpatch=require(_0xc672('0x2'));var rp=require(_0xc672('0x3'));var moment=require('moment');var BPromise=require(_0xc672('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc672('0x5'));var sox=require(_0xc672('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc672('0x7'));var _=require(_0xc672('0x8'));var squel=require(_0xc672('0x9'));var crypto=require(_0xc672('0xa'));var jsforce=require(_0xc672('0xb'));var deskjs=require(_0xc672('0xc'));var toCsv=require(_0xc672('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc672('0xe'));var qs=require(_0xc672('0xf'));var as=require(_0xc672('0x10'));var hardwareService=require(_0xc672('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xc672('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc672('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x749c80,_0x683d13){_0x683d13=_0x683d13||0xcc;return function(_0x508b7f){if(_0x508b7f){return _0x749c80[_0xc672('0x14')](_0x683d13);}return _0x749c80[_0xc672('0x15')](_0x683d13)[_0xc672('0x16')]();};}function respondWithResult(_0x1f3b73,_0x5ca6c1){_0x5ca6c1=_0x5ca6c1||0xc8;return function(_0x1341af){if(_0x1341af){return _0x1f3b73[_0xc672('0x15')](_0x5ca6c1)[_0xc672('0x17')](_0x1341af);}};}function respondWithFilteredResult(_0x231e30,_0xe7b3c4){return function(_0x16e6ba){if(_0x16e6ba){var _0x36a94e=typeof _0xe7b3c4[_0xc672('0x18')]===_0xc672('0x19')&&typeof _0xe7b3c4[_0xc672('0x1a')]===_0xc672('0x19');var _0x16ad3f=_0x16e6ba[_0xc672('0x1b')];var _0x23ef80=_0x36a94e?0x0:_0xe7b3c4[_0xc672('0x18')];var _0x3adadb=_0x36a94e?_0x16e6ba[_0xc672('0x1b')]:_0xe7b3c4[_0xc672('0x18')]+_0xe7b3c4['limit'];var _0x2f502f;if(_0x3adadb>=_0x16ad3f){_0x3adadb=_0x16ad3f;_0x2f502f=0xc8;}else{_0x2f502f=0xce;}_0x231e30[_0xc672('0x15')](_0x2f502f);return _0x231e30[_0xc672('0x1c')](_0xc672('0x1d'),_0x23ef80+'-'+_0x3adadb+'/'+_0x16ad3f)[_0xc672('0x17')](_0x16e6ba);}return null;};}function patchUpdates(_0x404367){return function(_0x52f183){try{jsonpatch[_0xc672('0x1e')](_0x52f183,_0x404367,!![]);}catch(_0x230a8d){return BPromise['reject'](_0x230a8d);}return _0x52f183[_0xc672('0x1f')]();};}function saveUpdates(_0x292edb,_0x2325b5){return function(_0x5eb19a){if(_0x5eb19a){return _0x5eb19a[_0xc672('0x20')](_0x292edb)[_0xc672('0x21')](function(_0x2b97a1){return _0x2b97a1;});}return null;};}function removeEntity(_0xce600b,_0x2b8303){return function(_0x3273bc){if(_0x3273bc){return _0x3273bc['destroy']()[_0xc672('0x21')](function(){_0xce600b[_0xc672('0x15')](0xcc)[_0xc672('0x16')]();});}};}function handleEntityNotFound(_0x13a17e,_0x2208c1){return function(_0x52b19b){if(!_0x52b19b){_0x13a17e[_0xc672('0x14')](0x194);}return _0x52b19b;};}function handleError(_0x48d14b,_0x33e69d){_0x33e69d=_0x33e69d||0x1f4;return function(_0x1d9b90){logger['error'](_0x1d9b90['stack']);if(_0x1d9b90[_0xc672('0x22')]){delete _0x1d9b90[_0xc672('0x22')];}_0x48d14b[_0xc672('0x15')](_0x33e69d)['send'](_0x1d9b90);};}exports[_0xc672('0x23')]=function(_0x105846,_0x37b9ca){var _0x26af5f={},_0xbe286b={},_0x46f451={'count':0x0,'rows':[]};var _0x1d0fff=_[_0xc672('0x24')](db['FaxApplication'][_0xc672('0x25')],function(_0x152caf){return{'name':_0x152caf['fieldName'],'type':_0x152caf[_0xc672('0x26')]['key']};});_0xbe286b[_0xc672('0x27')]=_[_0xc672('0x24')](_0x1d0fff,'name');_0xbe286b[_0xc672('0x28')]=_['keys'](_0x105846[_0xc672('0x28')]);_0xbe286b[_0xc672('0x29')]=_[_0xc672('0x2a')](_0xbe286b[_0xc672('0x27')],_0xbe286b[_0xc672('0x28')]);_0x26af5f['attributes']=_[_0xc672('0x2a')](_0xbe286b[_0xc672('0x27')],qs[_0xc672('0x2b')](_0x105846[_0xc672('0x28')]['fields']));_0x26af5f[_0xc672('0x2c')]=_0x26af5f[_0xc672('0x2c')][_0xc672('0x2d')]?_0x26af5f[_0xc672('0x2c')]:_0xbe286b[_0xc672('0x27')];if(!_0x105846[_0xc672('0x28')][_0xc672('0x2e')](_0xc672('0x2f'))){_0x26af5f[_0xc672('0x1a')]=qs[_0xc672('0x1a')](_0x105846[_0xc672('0x28')][_0xc672('0x1a')]);_0x26af5f[_0xc672('0x18')]=qs[_0xc672('0x18')](_0x105846[_0xc672('0x28')][_0xc672('0x18')]);}_0x26af5f['order']=qs[_0xc672('0x30')](_0x105846['query'][_0xc672('0x30')]);_0x26af5f[_0xc672('0x31')]=qs[_0xc672('0x29')](_[_0xc672('0x32')](_0x105846[_0xc672('0x28')],_0xbe286b[_0xc672('0x29')]),_0x1d0fff);if(_0x105846[_0xc672('0x28')][_0xc672('0x33')]){_0x26af5f[_0xc672('0x31')]=_[_0xc672('0x34')](_0x26af5f[_0xc672('0x31')],{'$or':_['map'](_0x1d0fff,function(_0x353c73){if(_0x353c73['type']!=='VIRTUAL'){var _0x392a94={};_0x392a94[_0x353c73[_0xc672('0x22')]]={'$like':'%'+_0x105846[_0xc672('0x28')][_0xc672('0x33')]+'%'};return _0x392a94;}})});}_0x26af5f=_[_0xc672('0x34')]({},_0x26af5f,_0x105846[_0xc672('0x35')]);var _0xc47246={'where':_0x26af5f[_0xc672('0x31')]};return db[_0xc672('0x36')][_0xc672('0x1b')](_0xc47246)['then'](function(_0x37edd5){_0x46f451[_0xc672('0x1b')]=_0x37edd5;if(_0x105846['query'][_0xc672('0x37')]){_0x26af5f[_0xc672('0x38')]=[{'all':!![]}];}return db[_0xc672('0x36')][_0xc672('0x39')](_0x26af5f);})['then'](function(_0x686e03){_0x46f451[_0xc672('0x3a')]=_0x686e03;return _0x46f451;})['then'](respondWithFilteredResult(_0x37b9ca,_0x26af5f))['catch'](handleError(_0x37b9ca,null));};exports['show']=function(_0x1185bf,_0x51a2c5){var _0x216116={'raw':!![],'where':{'id':_0x1185bf[_0xc672('0x3b')]['id']}},_0x886769={};_0x886769[_0xc672('0x27')]=_[_0xc672('0x3c')](db[_0xc672('0x36')]['rawAttributes']);_0x886769[_0xc672('0x28')]=_[_0xc672('0x3c')](_0x1185bf[_0xc672('0x28')]);_0x886769[_0xc672('0x29')]=_['intersection'](_0x886769[_0xc672('0x27')],_0x886769[_0xc672('0x28')]);_0x216116[_0xc672('0x2c')]=_[_0xc672('0x2a')](_0x886769[_0xc672('0x27')],qs[_0xc672('0x2b')](_0x1185bf[_0xc672('0x28')][_0xc672('0x2b')]));_0x216116[_0xc672('0x2c')]=_0x216116['attributes']['length']?_0x216116[_0xc672('0x2c')]:_0x886769[_0xc672('0x27')];if(_0x1185bf['query'][_0xc672('0x37')]){_0x216116['include']=[{'all':!![]}];}_0x216116=_[_0xc672('0x34')]({},_0x216116,_0x1185bf['options']);return db['FaxApplication'][_0xc672('0x3d')](_0x216116)[_0xc672('0x21')](handleEntityNotFound(_0x51a2c5,null))[_0xc672('0x21')](respondWithResult(_0x51a2c5,null))[_0xc672('0x3e')](handleError(_0x51a2c5,null));};exports[_0xc672('0x3f')]=function(_0x8124ac,_0x54f2d4){return db['FaxApplication']['create'](_0x8124ac[_0xc672('0x40')],{})[_0xc672('0x21')](respondWithResult(_0x54f2d4,0xc9))[_0xc672('0x3e')](handleError(_0x54f2d4,null));};exports['update']=function(_0x123c23,_0x2b90e8){if(_0x123c23['body']['id']){delete _0x123c23[_0xc672('0x40')]['id'];}return db[_0xc672('0x36')][_0xc672('0x3d')]({'where':{'id':_0x123c23[_0xc672('0x3b')]['id']}})[_0xc672('0x21')](handleEntityNotFound(_0x2b90e8,null))['then'](saveUpdates(_0x123c23[_0xc672('0x40')],null))['then'](respondWithResult(_0x2b90e8,null))[_0xc672('0x3e')](handleError(_0x2b90e8,null));};exports[_0xc672('0x41')]=function(_0x14a401,_0x30e603){return db[_0xc672('0x36')][_0xc672('0x3d')]({'where':{'id':_0x14a401[_0xc672('0x3b')]['id']}})[_0xc672('0x21')](handleEntityNotFound(_0x30e603,null))['then'](removeEntity(_0x30e603,null))['catch'](handleError(_0x30e603,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 479553d..2a43616 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 _0x38f4=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x48e011,_0x380338){var _0x3e2e01=function(_0x2a11c5){while(--_0x2a11c5){_0x48e011['push'](_0x48e011['shift']());}};_0x3e2e01(++_0x380338);}(_0x38f4,0x1df));var _0x438f=function(_0x28b72e,_0x1862be){_0x28b72e=_0x28b72e-0x0;var _0x2bb662=_0x38f4[_0x28b72e];return _0x2bb662;};'use strict';var _=require(_0x438f('0x0'));var util=require('util');var logger=require(_0x438f('0x1'))(_0x438f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x438f('0x3'));var fs=require('fs');var path=require(_0x438f('0x4'));var rimraf=require(_0x438f('0x5'));var config=require(_0x438f('0x6'));var attributes=require('./faxApplication.attributes');module[_0x438f('0x7')]=function(_0x3f75b0,_0x21530c){return _0x3f75b0[_0x438f('0x8')]('FaxApplication',attributes,{'tableName':_0x438f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x438f('0xa'),'collate':_0x438f('0xb')});}; \ No newline at end of file +var _0x33c9=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0xe84ea,_0x56266b){var _0x2e49ba=function(_0x3f2cdf){while(--_0x3f2cdf){_0xe84ea['push'](_0xe84ea['shift']());}};_0x2e49ba(++_0x56266b);}(_0x33c9,0x15d));var _0x933c=function(_0x301004,_0x125315){_0x301004=_0x301004-0x0;var _0x164d2b=_0x33c9[_0x301004];return _0x164d2b;};'use strict';var _=require('lodash');var util=require(_0x933c('0x0'));var logger=require(_0x933c('0x1'))(_0x933c('0x2'));var moment=require(_0x933c('0x3'));var BPromise=require(_0x933c('0x4'));var rp=require(_0x933c('0x5'));var fs=require('fs');var path=require(_0x933c('0x6'));var rimraf=require('rimraf');var config=require(_0x933c('0x7'));var attributes=require('./faxApplication.attributes');module[_0x933c('0x8')]=function(_0x3c852a,_0x54bf41){return _0x3c852a[_0x933c('0x9')](_0x933c('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x933c('0xb'),'collate':_0x933c('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index af01769..658ba91 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 _0xb7cf=['FaxApplication,\x20%s,\x20%s','debug','stringify','error','code','message','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','limit','then','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x5d60ac,_0x55ed24){var _0x37120e=function(_0x436ebb){while(--_0x436ebb){_0x5d60ac['push'](_0x5d60ac['shift']());}};_0x37120e(++_0x55ed24);}(_0xb7cf,0xca));var _0xfb7c=function(_0x5be3cc,_0x3b5c7d){_0x5be3cc=_0x5be3cc-0x0;var _0x1162a2=_0xb7cf[_0x5be3cc];return _0x1162a2;};'use strict';var _=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var moment=require(_0xfb7c('0x2'));var BPromise=require(_0xfb7c('0x3'));var rs=require(_0xfb7c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb7c('0x5'))['db'];var utils=require(_0xfb7c('0x6'));var logger=require(_0xfb7c('0x7'))(_0xfb7c('0x8'));var config=require(_0xfb7c('0x9'));var jayson=require(_0xfb7c('0xa'));var client=jayson[_0xfb7c('0xb')][_0xfb7c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41dcce,_0x2fd757,_0x3c21f3){return new BPromise(function(_0x34b889,_0x289874){return client[_0xfb7c('0xd')](_0x41dcce,_0x3c21f3)['then'](function(_0x13dcc3){logger[_0xfb7c('0xe')](_0xfb7c('0xf'),_0x2fd757,'request\x20sent');logger[_0xfb7c('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2fd757,'request\x20sent',JSON[_0xfb7c('0x11')](_0x13dcc3));if(_0x13dcc3[_0xfb7c('0x12')]){if(_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x13')]===0x1f4){logger[_0xfb7c('0x12')](_0xfb7c('0xf'),_0x2fd757,_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x14')]);return _0x289874(_0x13dcc3['error'][_0xfb7c('0x14')]);}logger[_0xfb7c('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2fd757,_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x14')]);return _0x34b889(_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x14')]);}else{logger[_0xfb7c('0xe')](_0xfb7c('0xf'),_0x2fd757,'request\x20sent');_0x34b889(_0x13dcc3['result'][_0xfb7c('0x14')]);}})['catch'](function(_0xa66d3a){logger[_0xfb7c('0x12')](_0xfb7c('0xf'),_0x2fd757,_0xa66d3a);_0x289874(_0xa66d3a);});});}exports[_0xfb7c('0x15')]=function(_0x493d7b){var _0x20115a=this;return new Promise(function(_0x4f0c3b,_0xa29a57){return db[_0xfb7c('0x16')][_0xfb7c('0x17')](_0x493d7b[_0xfb7c('0x18')],{'raw':_0x493d7b[_0xfb7c('0x19')]?_0x493d7b[_0xfb7c('0x19')][_0xfb7c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493d7b['options']?_0x493d7b[_0xfb7c('0x19')]['where']||null:null,'attributes':_0x493d7b[_0xfb7c('0x19')]?_0x493d7b[_0xfb7c('0x19')][_0xfb7c('0x1b')]||null:null,'limit':_0x493d7b[_0xfb7c('0x19')]?_0x493d7b[_0xfb7c('0x19')][_0xfb7c('0x1c')]||null:null})[_0xfb7c('0x1d')](function(_0x4875b8){logger[_0xfb7c('0xe')]('UpdateFaxApplication',_0x493d7b);logger[_0xfb7c('0x10')]('UpdateFaxApplication',_0x493d7b,JSON['stringify'](_0x4875b8));_0x4f0c3b(_0x4875b8);})[_0xfb7c('0x1e')](function(_0x37ee79){logger['error'](_0xfb7c('0x15'),_0x37ee79['message'],_0x493d7b);_0xa29a57(_0x20115a['error'](0x1f4,_0x37ee79[_0xfb7c('0x14')]));});});}; \ No newline at end of file +var _0x3cde=['body','options','raw','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','update'];(function(_0x13659a,_0x41453c){var _0x4b1c49=function(_0x270c47){while(--_0x270c47){_0x13659a['push'](_0x13659a['shift']());}};_0x4b1c49(++_0x41453c);}(_0x3cde,0x1cf));var _0xe3cd=function(_0x1e0511,_0x57b46f){_0x1e0511=_0x1e0511-0x0;var _0x14f454=_0x3cde[_0x1e0511];return _0x14f454;};'use strict';var _=require(_0xe3cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe3cd('0x1'));var rs=require(_0xe3cd('0x2'));var fs=require('fs');var Redis=require(_0xe3cd('0x3'));var db=require(_0xe3cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe3cd('0x5'));var jayson=require(_0xe3cd('0x6'));var client=jayson[_0xe3cd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x468492,_0x45c2e5,_0x13c386){return new BPromise(function(_0x27ca98,_0x26e16f){return client[_0xe3cd('0x8')](_0x468492,_0x13c386)[_0xe3cd('0x9')](function(_0x1e448a){logger['info'](_0xe3cd('0xa'),_0x45c2e5,_0xe3cd('0xb'));logger[_0xe3cd('0xc')](_0xe3cd('0xd'),_0x45c2e5,_0xe3cd('0xb'),JSON['stringify'](_0x1e448a));if(_0x1e448a['error']){if(_0x1e448a[_0xe3cd('0xe')][_0xe3cd('0xf')]===0x1f4){logger[_0xe3cd('0xe')](_0xe3cd('0xa'),_0x45c2e5,_0x1e448a[_0xe3cd('0xe')]['message']);return _0x26e16f(_0x1e448a[_0xe3cd('0xe')][_0xe3cd('0x10')]);}logger[_0xe3cd('0xe')](_0xe3cd('0xa'),_0x45c2e5,_0x1e448a[_0xe3cd('0xe')][_0xe3cd('0x10')]);return _0x27ca98(_0x1e448a[_0xe3cd('0xe')]['message']);}else{logger[_0xe3cd('0x11')](_0xe3cd('0xa'),_0x45c2e5,_0xe3cd('0xb'));_0x27ca98(_0x1e448a[_0xe3cd('0x12')][_0xe3cd('0x10')]);}})[_0xe3cd('0x13')](function(_0x3641d7){logger['error'](_0xe3cd('0xa'),_0x45c2e5,_0x3641d7);_0x26e16f(_0x3641d7);});});}exports[_0xe3cd('0x14')]=function(_0x21ea21){var _0x498bc4=this;return new Promise(function(_0x414780,_0x4a16ca){return db[_0xe3cd('0x15')][_0xe3cd('0x16')](_0x21ea21[_0xe3cd('0x17')],{'raw':_0x21ea21[_0xe3cd('0x18')]?_0x21ea21[_0xe3cd('0x18')][_0xe3cd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21ea21[_0xe3cd('0x18')]?_0x21ea21['options'][_0xe3cd('0x1a')]||null:null,'attributes':_0x21ea21[_0xe3cd('0x18')]?_0x21ea21['options']['attributes']||null:null,'limit':_0x21ea21[_0xe3cd('0x18')]?_0x21ea21[_0xe3cd('0x18')]['limit']||null:null})[_0xe3cd('0x9')](function(_0x2dc337){logger[_0xe3cd('0x11')](_0xe3cd('0x14'),_0x21ea21);logger[_0xe3cd('0xc')](_0xe3cd('0x14'),_0x21ea21,JSON['stringify'](_0x2dc337));_0x414780(_0x2dc337);})[_0xe3cd('0x13')](function(_0x4c63b3){logger['error']('UpdateFaxApplication',_0x4c63b3[_0xe3cd('0x10')],_0x21ea21);_0x4a16ca(_0x498bc4[_0xe3cd('0xe')](0x1f4,_0x4c63b3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 57db9e2..48f2a56 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 _0xf7b4=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0xf7b4,0x152));var _0x4f7b=function(_0x95eb64,_0x391904){_0x95eb64=_0x95eb64-0x0;var _0x114dd7=_0xf7b4[_0x95eb64];return _0x114dd7;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x8')](),controller['create']);router[_0x4f7b('0xd')](_0x4f7b('0xa'),auth['isAuthenticated'](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5c00=['delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x7d76aa,_0x1bb37c){var _0x2a8bc8=function(_0x4ba873){while(--_0x4ba873){_0x7d76aa['push'](_0x7d76aa['shift']());}};_0x2a8bc8(++_0x1bb37c);}(_0x5c00,0x17e));var _0x05c0=function(_0x2f2c5f,_0x27bd58){_0x2f2c5f=_0x2f2c5f-0x0;var _0x53cec0=_0x5c00[_0x2f2c5f];return _0x53cec0;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./faxApplication.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x05c0('0xd')]);router[_0x05c0('0xe')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x05c0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 7c3bf33..45c8180 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 _0x9582=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x3c8811,_0x561a12){var _0x55396d=function(_0x1bc66c){while(--_0x1bc66c){_0x3c8811['push'](_0x3c8811['shift']());}};_0x55396d(++_0x561a12);}(_0x9582,0x95));var _0x2958=function(_0x1c12ee,_0x6bc643){_0x1c12ee=_0x1c12ee-0x0;var _0x564f73=_0x9582[_0x1c12ee];return _0x564f73;};'use strict';var Sequelize=require(_0x2958('0x0'));module[_0x2958('0x1')]={'closed':{'type':Sequelize[_0x2958('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2958('0x3')]},'disposition':{'type':Sequelize[_0x2958('0x4')]},'secondDisposition':{'type':Sequelize[_0x2958('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2958('0x4')]},'read1stAt':{'type':Sequelize[_0x2958('0x3')]},'fax':{'type':Sequelize[_0x2958('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2958('0x5')]('in',_0x2958('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2958('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2958('0x5')]('in',_0x2958('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2958('0x7')]}}; \ No newline at end of file +var _0x66fa=['exports','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x66fa,0x117));var _0xa66f=function(_0x8328b9,_0x1f9eca){_0x8328b9=_0x8328b9-0x0;var _0x34e08e=_0x66fa[_0x8328b9];return _0x34e08e;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa66f('0x2')]},'disposition':{'type':Sequelize[_0xa66f('0x3')]},'secondDisposition':{'type':Sequelize[_0xa66f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa66f('0x3')]},'note':{'type':Sequelize[_0xa66f('0x3')]},'read1stAt':{'type':Sequelize[_0xa66f('0x2')]},'fax':{'type':Sequelize[_0xa66f('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa66f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa66f('0x4')]('in',_0xa66f('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xa66f('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index ef1cb7e..395e25a 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 _0x1925=['unlinkSync','zip-dir','moment','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','then','destroy','end','name','send','index','FaxInteraction','rawAttributes','type','getOptions','findAll','fax','user','catch','show','keys','query','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','update','params','describe','FaxMessage','addMessage','ids','findOne','filters','hasOwnProperty','sort','where','pick','FaxInteractionId','map','filter','$gte','split','format','options','include','addTags','setTags','omit','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','err'];(function(_0x3ca27f,_0x4552b8){var _0x313cdb=function(_0xcf2b12){while(--_0xcf2b12){_0x3ca27f['push'](_0x3ca27f['shift']());}};_0x313cdb(++_0x4552b8);}(_0x1925,0x12d));var _0x5192=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x1925[_0x387777];return _0x3f84c0;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5192('0x0'));var moment=require(_0x5192('0x1'));var BPromise=require('bluebird');var util=require(_0x5192('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x5192('0x3'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x5192('0x4'));var logger=require(_0x5192('0x5'))(_0x5192('0x6'));var config=require(_0x5192('0x7'));var db=require(_0x5192('0x8'))['db'];config[_0x5192('0x9')]=_[_0x5192('0xa')](config[_0x5192('0x9')],{'host':_0x5192('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5192('0xc'))[_0x5192('0xd')](socket);function respondWithStatusCode(_0x393054,_0x556dc6){_0x556dc6=_0x556dc6||0xcc;return function(_0x184396){if(_0x184396){return _0x393054[_0x5192('0xe')](_0x556dc6);}return _0x393054[_0x5192('0xf')](_0x556dc6)['end']();};}function respondWithResult(_0x30c0a4,_0x27b11e){_0x27b11e=_0x27b11e||0xc8;return function(_0x3377c4){if(_0x3377c4){return _0x30c0a4['status'](_0x27b11e)[_0x5192('0x10')](_0x3377c4);}};}function respondWithFilteredResult(_0x16b966,_0x21618b){return function(_0x37bc8d){if(_0x37bc8d){var _0x462c4b=typeof _0x21618b[_0x5192('0x11')]===_0x5192('0x12')&&typeof _0x21618b['limit']===_0x5192('0x12');var _0x1a1937=_0x37bc8d['count'];var _0xa4394f=_0x462c4b?0x0:_0x21618b['offset'];var _0x24ec41=_0x462c4b?_0x37bc8d[_0x5192('0x13')]:_0x21618b[_0x5192('0x11')]+_0x21618b[_0x5192('0x14')];var _0x125476;if(_0x24ec41>=_0x1a1937){_0x24ec41=_0x1a1937;_0x125476=0xc8;}else{_0x125476=0xce;}_0x16b966[_0x5192('0xf')](_0x125476);return _0x16b966['set']('Content-Range',_0xa4394f+'-'+_0x24ec41+'/'+_0x1a1937)[_0x5192('0x10')](_0x37bc8d);}return null;};}function saveUpdates(_0x30e9a0){return function(_0x115dac){if(_0x115dac){return _0x115dac['update'](_0x30e9a0)[_0x5192('0x15')](function(_0x45ac8b){return _0x45ac8b;});}return null;};}function removeEntity(_0x42a2ff){return function(_0x41046b){if(_0x41046b){return _0x41046b[_0x5192('0x16')]()[_0x5192('0x15')](function(){_0x42a2ff[_0x5192('0xf')](0xcc)[_0x5192('0x17')]();});}};}function handleEntityNotFound(_0x2b8dc4){return function(_0x3288f1){if(!_0x3288f1){_0x2b8dc4['sendStatus'](0x194);}return _0x3288f1;};}function handleError(_0x543c0c,_0x1aa3a9){_0x1aa3a9=_0x1aa3a9||0x1f4;return function(_0x45a7d7){logger['error'](_0x45a7d7['stack']);if(_0x45a7d7['name']){delete _0x45a7d7[_0x5192('0x18')];}_0x543c0c[_0x5192('0xf')](_0x1aa3a9)[_0x5192('0x19')](_0x45a7d7);};}exports[_0x5192('0x1a')]=function(_0x13d641,_0x332e6a){var _0x7e064f={};var _0x13a430=_['map'](db[_0x5192('0x1b')][_0x5192('0x1c')],function(_0x3830a5){return{'name':_0x3830a5['fieldName'],'type':_0x3830a5[_0x5192('0x1d')]['key']};});_0x7e064f=qs[_0x5192('0x1e')](_0x13a430,_0x13d641);return interaction[_0x5192('0x1f')](_0x5192('0x20'),_0x13d641['query'],_0x13d641[_0x5192('0x21')],_0x7e064f,_0x13a430)[_0x5192('0x15')](respondWithFilteredResult(_0x332e6a,_0x7e064f))[_0x5192('0x22')](handleError(_0x332e6a,null));};exports[_0x5192('0x23')]=function(_0x9a690c,_0x270a78){var _0x275549={'raw':![],'where':{'id':_0x9a690c['params']['id']}},_0x10cd81={};_0x10cd81['model']=_[_0x5192('0x24')](db['FaxInteraction'][_0x5192('0x1c')]);_0x10cd81[_0x5192('0x25')]=_[_0x5192('0x24')](_0x9a690c[_0x5192('0x25')]);_0x10cd81['filters']=_[_0x5192('0x26')](_0x10cd81[_0x5192('0x27')],_0x10cd81[_0x5192('0x25')]);_0x275549[_0x5192('0x28')]=_['intersection'](_0x10cd81[_0x5192('0x27')],qs[_0x5192('0x29')](_0x9a690c[_0x5192('0x25')][_0x5192('0x29')]));_0x275549[_0x5192('0x28')]=_0x275549['attributes'][_0x5192('0x2a')]?_0x275549[_0x5192('0x28')]:_0x10cd81[_0x5192('0x27')];if(_0x9a690c['query'][_0x5192('0x2b')]){_0x275549['include']=[{'all':!![]}];}_0x275549=_[_0x5192('0x2c')]({},_0x275549,_0x9a690c['options']);return db[_0x5192('0x1b')][_0x5192('0x2d')](_0x275549)[_0x5192('0x15')](handleEntityNotFound(_0x270a78,null))[_0x5192('0x15')](respondWithResult(_0x270a78,null))['catch'](handleError(_0x270a78,null));};exports[_0x5192('0x2e')]=function(_0x444513,_0x22e506){return db['FaxInteraction'][_0x5192('0x2e')](_0x444513[_0x5192('0x2f')],{})['then'](respondWithResult(_0x22e506,0xc9))['catch'](handleError(_0x22e506,null));};exports[_0x5192('0x30')]=function(_0xf22a0e,_0x4e3f8a){if(_0xf22a0e['body']['id']){delete _0xf22a0e[_0x5192('0x2f')]['id'];}return db[_0x5192('0x1b')][_0x5192('0x2d')]({'where':{'id':_0xf22a0e[_0x5192('0x31')]['id']}})['then'](handleEntityNotFound(_0x4e3f8a,null))[_0x5192('0x15')](saveUpdates(_0xf22a0e[_0x5192('0x2f')],null))[_0x5192('0x15')](respondWithResult(_0x4e3f8a,null))[_0x5192('0x22')](handleError(_0x4e3f8a,null));};exports['destroy']=function(_0x9b6f62,_0x1ec1fb){return db[_0x5192('0x1b')]['find']({'where':{'id':_0x9b6f62[_0x5192('0x31')]['id']}})[_0x5192('0x15')](handleEntityNotFound(_0x1ec1fb,null))[_0x5192('0x15')](removeEntity(_0x1ec1fb,null))[_0x5192('0x22')](handleError(_0x1ec1fb,null));};exports['describe']=function(_0x1aa7d7,_0x5d23bd){return db[_0x5192('0x1b')][_0x5192('0x32')]()[_0x5192('0x15')](respondWithResult(_0x5d23bd,null))[_0x5192('0x22')](handleError(_0x5d23bd,null));};exports['addMessage']=function(_0x247afe,_0x12defd){return db[_0x5192('0x33')][_0x5192('0x2d')]({'where':{'id':_0x247afe[_0x5192('0x31')]['id']}})[_0x5192('0x15')](handleEntityNotFound(_0x12defd,null))[_0x5192('0x15')](function(_0x12c7ea){if(_0x12c7ea){return _0x12c7ea[_0x5192('0x34')](_0x247afe[_0x5192('0x2f')][_0x5192('0x35')],_['omit'](_0x247afe[_0x5192('0x2f')],[_0x5192('0x35'),'id'])||{});}})['then'](respondWithResult(_0x12defd,null))[_0x5192('0x22')](handleError(_0x12defd,null));};exports['getMessages']=function(_0x10733a,_0x53d3d5){var _0x1f42c8={'raw':![],'where':{}};var _0x5f2f26={};var _0x42ac50={'count':0x0,'rows':[]};return db[_0x5192('0x1b')][_0x5192('0x36')]({'where':{'id':_0x10733a[_0x5192('0x31')]['id']}})[_0x5192('0x15')](handleEntityNotFound(_0x53d3d5,null))[_0x5192('0x15')](function(_0x3a09c8){if(_0x3a09c8){_0x5f2f26['model']=_['keys'](db['FaxMessage'][_0x5192('0x1c')]);_0x5f2f26[_0x5192('0x25')]=_[_0x5192('0x24')](_0x10733a[_0x5192('0x25')]);_0x5f2f26[_0x5192('0x37')]=_[_0x5192('0x26')](_0x5f2f26['model'],_0x5f2f26[_0x5192('0x25')]);_0x1f42c8[_0x5192('0x28')]=_[_0x5192('0x26')](_0x5f2f26[_0x5192('0x27')],qs[_0x5192('0x29')](_0x10733a[_0x5192('0x25')][_0x5192('0x29')]));_0x1f42c8[_0x5192('0x28')]=_0x1f42c8[_0x5192('0x28')][_0x5192('0x2a')]?_0x1f42c8[_0x5192('0x28')]:_0x5f2f26['model'];if(!_0x10733a['query'][_0x5192('0x38')]('nolimit')){_0x1f42c8[_0x5192('0x14')]=qs[_0x5192('0x14')](_0x10733a[_0x5192('0x25')]['limit']);_0x1f42c8[_0x5192('0x11')]=qs[_0x5192('0x11')](_0x10733a['query'][_0x5192('0x11')]);}_0x1f42c8['order']=qs[_0x5192('0x39')](_0x10733a[_0x5192('0x25')]['sort']);_0x1f42c8[_0x5192('0x3a')]=qs[_0x5192('0x37')](_[_0x5192('0x3b')](_0x10733a[_0x5192('0x25')],_0x5f2f26[_0x5192('0x37')]));_0x1f42c8['where'][_0x5192('0x3c')]=_0x3a09c8['id'];if(_0x10733a[_0x5192('0x25')]['filter']){_0x1f42c8[_0x5192('0x3a')]=_['merge'](_0x1f42c8[_0x5192('0x3a')],{'$or':_[_0x5192('0x3d')](_0x1f42c8[_0x5192('0x28')],function(_0x273f5c){var _0x4f2ace={};_0x4f2ace[_0x273f5c]={'$like':'%'+_0x10733a[_0x5192('0x25')][_0x5192('0x3e')]+'%'};return _0x4f2ace;})});}if(_0x10733a[_0x5192('0x25')][_0x5192('0x3f')]){var _0x1d4ef0=_0x10733a['query'][_0x5192('0x3f')][_0x5192('0x40')](',');var _0x525a1e={};_0x525a1e[_0x1d4ef0[0x0]]={'$gte':moment(_0x1d4ef0[0x1])[_0x5192('0x41')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1f42c8[_0x5192('0x3a')]=_['merge'](_0x1f42c8['where'],_0x525a1e);}_0x1f42c8=_[_0x5192('0x2c')]({},_0x1f42c8,_0x10733a[_0x5192('0x42')]);return db[_0x5192('0x33')][_0x5192('0x13')]({'where':_0x1f42c8[_0x5192('0x3a')]})[_0x5192('0x15')](function(_0x2fbc7b){_0x42ac50[_0x5192('0x13')]=_0x2fbc7b;if(_0x10733a['query'][_0x5192('0x2b')]){_0x1f42c8[_0x5192('0x43')]=[{'all':!![]}];}return db[_0x5192('0x33')]['findAll'](_0x1f42c8);})[_0x5192('0x15')](function(_0x1abde8){_0x42ac50['rows']=_0x1abde8;return _0x42ac50;});}})[_0x5192('0x15')](respondWithFilteredResult(_0x53d3d5,_0x1f42c8))[_0x5192('0x22')](handleError(_0x53d3d5,null));};exports[_0x5192('0x44')]=function(_0x543a4c,_0x545a25){return db[_0x5192('0x1b')][_0x5192('0x2d')]({'where':{'id':_0x543a4c[_0x5192('0x31')]['id']}})[_0x5192('0x15')](handleEntityNotFound(_0x545a25,null))['then'](function(_0x518ed0){if(_0x518ed0){return _0x518ed0[_0x5192('0x45')](_0x543a4c['body'][_0x5192('0x35')],_[_0x5192('0x46')](_0x543a4c[_0x5192('0x2f')],['ids','id'])||{})[_0x5192('0x47')](function(){return db[_0x5192('0x48')][_0x5192('0x1f')]({'attributes':['id',_0x5192('0x18'),_0x5192('0x49')],'where':{'id':_0x543a4c[_0x5192('0x2f')][_0x5192('0x35')]}});})[_0x5192('0x15')](function(_0x38182b){socket[_0x5192('0x4a')](_0x5192('0x4b'),{'id':Number(_0x543a4c['params']['id']),'tags':_0x38182b||[]});return{'id':Number(_0x543a4c[_0x5192('0x31')]['id']),'tags':_0x38182b||[]};});}})[_0x5192('0x15')](respondWithResult(_0x545a25,null))[_0x5192('0x22')](handleError(_0x545a25,null));};exports[_0x5192('0x4c')]=function(_0x46d08b,_0x4b20e5){return db[_0x5192('0x1b')][_0x5192('0x2d')]({'where':{'id':_0x46d08b['params']['id']}})[_0x5192('0x15')](handleEntityNotFound(_0x4b20e5,null))[_0x5192('0x15')](function(_0x895a37){if(_0x895a37){return _0x895a37[_0x5192('0x4c')](_0x46d08b[_0x5192('0x25')][_0x5192('0x35')]);}})[_0x5192('0x15')](respondWithStatusCode(_0x4b20e5,null))['catch'](handleError(_0x4b20e5,null));};exports[_0x5192('0x4d')]=function(_0x317fe9,_0x9c1a13){var _0x1b9fd6=moment()[_0x5192('0x4e')]()[_0x5192('0x4f')]();var _0x47f7e9=path[_0x5192('0x50')](config[_0x5192('0x51')],_0x5192('0x52'),_0x5192('0x53'),'tmp');var _0x5b2915=path[_0x5192('0x50')](config[_0x5192('0x51')],'server',_0x5192('0x53'),_0x5192('0x54'));var _0x42f24a=path['join'](_0x47f7e9,_0x1b9fd6);var _0x283948=util['format'](_0x5192('0x55'),_0x317fe9[_0x5192('0x31')]['id'],_0x1b9fd6);var _0x2b1dbf=path[_0x5192('0x50')](_0x47f7e9,_0x283948);var _0x200b84=[];_0x200b84[_0x5192('0x56')]({'model':db[_0x5192('0x57')],'as':_0x5192('0x57'),'raw':!![]});var _0x119fe0=[{'model':db[_0x5192('0x33')],'as':_0x5192('0x58'),'attributes':['id','body',_0x5192('0x59')],'include':_0x200b84}];return db[_0x5192('0x1b')][_0x5192('0x2d')]({'where':{'id':_0x317fe9['params']['id']},'include':_0x119fe0})[_0x5192('0x15')](handleEntityNotFound(_0x9c1a13,null))[_0x5192('0x15')](function(_0xd1ba47){if(_0xd1ba47&&_0xd1ba47['Messages']){var _0x2becd7=_0xd1ba47[_0x5192('0x5a')]({'plain':!![]});fs[_0x5192('0x5b')](_0x42f24a);for(var _0x44fee3=0x0;_0x44fee3<_0x2becd7[_0x5192('0x58')][_0x5192('0x2a')];_0x44fee3++){var _0x500b98=_0x2becd7[_0x5192('0x58')][_0x44fee3][_0x5192('0x57')];if(_0x500b98){var _0x1d4e97=path['join'](_0x5b2915,_0x500b98[_0x5192('0x5c')]);if(fs[_0x5192('0x5d')](_0x1d4e97)){fs[_0x5192('0x5e')](_0x1d4e97)[_0x5192('0x5f')](fs[_0x5192('0x60')](path['join'](_0x42f24a,_0x500b98[_0x5192('0x5c')])));}}}return BPromise[_0x5192('0x61')]()[_0x5192('0x15')](function(){return new BPromise(function(_0x4e372b,_0x3d1439){zipdir(_0x42f24a,{'saveTo':_0x2b1dbf},function(_0x2b80af,_0x52bc52){if(_0x2b80af)return _0x3d1439(_0x2b80af);return _0x4e372b(_0x52bc52);});})['then'](function(){return new BPromise(function(_0x1e9e6e,_0x575a77){rimraf(_0x42f24a,function(_0x45095d){if(_0x45095d)_0x575a77(_0x45095d);return _0x1e9e6e();});});})[_0x5192('0x15')](function(){return _0x9c1a13[_0x5192('0x4d')](_0x2b1dbf,_0x283948,function(_0x203256){if(_0x203256){console['log'](_0x5192('0x62'),_0x203256);}else{fs[_0x5192('0x63')](_0x2b1dbf);}});});});}else{return _0x9c1a13[_0x5192('0xe')](0xc8);}})[_0x5192('0x22')](handleError(_0x9c1a13,null));}; \ No newline at end of file +var _0x35a7=['../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','user','catch','show','params','model','query','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','keys','order','sort','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','root','files','attachments','join','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','existsSync','pipe','createWriteStream','basename','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service'];(function(_0x28f37f,_0x227f04){var _0x2b251c=function(_0x44c63d){while(--_0x44c63d){_0x28f37f['push'](_0x28f37f['shift']());}};_0x2b251c(++_0x227f04);}(_0x35a7,0x197));var _0x735a=function(_0x21993f,_0xa34a1b){_0x21993f=_0x21993f-0x0;var _0x3cb4f0=_0x35a7[_0x21993f];return _0x3cb4f0;};'use strict';var rimraf=require(_0x735a('0x0'));var zipdir=require(_0x735a('0x1'));var moment=require(_0x735a('0x2'));var BPromise=require(_0x735a('0x3'));var util=require(_0x735a('0x4'));var path=require(_0x735a('0x5'));var fs=require('fs');var _=require(_0x735a('0x6'));var Redis=require(_0x735a('0x7'));var interaction=require(_0x735a('0x8'));var qs=require(_0x735a('0x9'));var logger=require(_0x735a('0xa'))(_0x735a('0xb'));var config=require(_0x735a('0xc'));var db=require('../../mysqldb')['db'];config[_0x735a('0xd')]=_[_0x735a('0xe')](config['redis'],{'host':_0x735a('0xf'),'port':0x18eb});var socket=require(_0x735a('0x10'))(new Redis(config[_0x735a('0xd')]));require(_0x735a('0x11'))[_0x735a('0x12')](socket);function respondWithStatusCode(_0x4b1c39,_0x4cf928){_0x4cf928=_0x4cf928||0xcc;return function(_0x4bc0ac){if(_0x4bc0ac){return _0x4b1c39[_0x735a('0x13')](_0x4cf928);}return _0x4b1c39['status'](_0x4cf928)['end']();};}function respondWithResult(_0x287dce,_0x345404){_0x345404=_0x345404||0xc8;return function(_0x19e7e3){if(_0x19e7e3){return _0x287dce[_0x735a('0x14')](_0x345404)[_0x735a('0x15')](_0x19e7e3);}};}function respondWithFilteredResult(_0x1bdad6,_0x48c985){return function(_0x36dc75){if(_0x36dc75){var _0x5c40ec=typeof _0x48c985[_0x735a('0x16')]===_0x735a('0x17')&&typeof _0x48c985[_0x735a('0x18')]===_0x735a('0x17');var _0x490440=_0x36dc75[_0x735a('0x19')];var _0x4dd640=_0x5c40ec?0x0:_0x48c985[_0x735a('0x16')];var _0x2e6373=_0x5c40ec?_0x36dc75[_0x735a('0x19')]:_0x48c985[_0x735a('0x16')]+_0x48c985[_0x735a('0x18')];var _0x5d0b49;if(_0x2e6373>=_0x490440){_0x2e6373=_0x490440;_0x5d0b49=0xc8;}else{_0x5d0b49=0xce;}_0x1bdad6[_0x735a('0x14')](_0x5d0b49);return _0x1bdad6[_0x735a('0x1a')](_0x735a('0x1b'),_0x4dd640+'-'+_0x2e6373+'/'+_0x490440)[_0x735a('0x15')](_0x36dc75);}return null;};}function saveUpdates(_0x58a768){return function(_0x146b0e){if(_0x146b0e){return _0x146b0e[_0x735a('0x1c')](_0x58a768)[_0x735a('0x1d')](function(_0x2acbe4){return _0x2acbe4;});}return null;};}function removeEntity(_0x34c894){return function(_0x49f150){if(_0x49f150){return _0x49f150[_0x735a('0x1e')]()[_0x735a('0x1d')](function(){_0x34c894['status'](0xcc)[_0x735a('0x1f')]();});}};}function handleEntityNotFound(_0x3812e2){return function(_0x46c2ed){if(!_0x46c2ed){_0x3812e2['sendStatus'](0x194);}return _0x46c2ed;};}function handleError(_0x1fbe7e,_0x3101b5){_0x3101b5=_0x3101b5||0x1f4;return function(_0x5a535d){logger[_0x735a('0x20')](_0x5a535d[_0x735a('0x21')]);if(_0x5a535d[_0x735a('0x22')]){delete _0x5a535d[_0x735a('0x22')];}_0x1fbe7e[_0x735a('0x14')](_0x3101b5)['send'](_0x5a535d);};}exports['index']=function(_0x809b24,_0x435a65){var _0x391636={};var _0x125b75=_[_0x735a('0x23')](db[_0x735a('0x24')][_0x735a('0x25')],function(_0x3f46ea){return{'name':_0x3f46ea[_0x735a('0x26')],'type':_0x3f46ea['type'][_0x735a('0x27')]};});_0x391636=qs[_0x735a('0x28')](_0x125b75,_0x809b24);return interaction['findAll']('fax',_0x809b24['query'],_0x809b24[_0x735a('0x29')],_0x391636,_0x125b75)['then'](respondWithFilteredResult(_0x435a65,_0x391636))[_0x735a('0x2a')](handleError(_0x435a65,null));};exports[_0x735a('0x2b')]=function(_0xdf1468,_0x3c4cc8){var _0x29007f={'raw':![],'where':{'id':_0xdf1468[_0x735a('0x2c')]['id']}},_0x516974={};_0x516974[_0x735a('0x2d')]=_['keys'](db[_0x735a('0x24')][_0x735a('0x25')]);_0x516974[_0x735a('0x2e')]=_['keys'](_0xdf1468[_0x735a('0x2e')]);_0x516974[_0x735a('0x2f')]=_[_0x735a('0x30')](_0x516974['model'],_0x516974[_0x735a('0x2e')]);_0x29007f[_0x735a('0x31')]=_[_0x735a('0x30')](_0x516974['model'],qs['fields'](_0xdf1468[_0x735a('0x2e')][_0x735a('0x32')]));_0x29007f[_0x735a('0x31')]=_0x29007f[_0x735a('0x31')][_0x735a('0x33')]?_0x29007f[_0x735a('0x31')]:_0x516974[_0x735a('0x2d')];if(_0xdf1468[_0x735a('0x2e')][_0x735a('0x34')]){_0x29007f['include']=[{'all':!![]}];}_0x29007f=_[_0x735a('0x35')]({},_0x29007f,_0xdf1468['options']);return db[_0x735a('0x24')][_0x735a('0x36')](_0x29007f)[_0x735a('0x1d')](handleEntityNotFound(_0x3c4cc8,null))['then'](respondWithResult(_0x3c4cc8,null))['catch'](handleError(_0x3c4cc8,null));};exports[_0x735a('0x37')]=function(_0xfb6e1e,_0x434f06){return db[_0x735a('0x24')][_0x735a('0x37')](_0xfb6e1e[_0x735a('0x38')],{})[_0x735a('0x1d')](respondWithResult(_0x434f06,0xc9))[_0x735a('0x2a')](handleError(_0x434f06,null));};exports['update']=function(_0x3e78f6,_0x1c5204){if(_0x3e78f6['body']['id']){delete _0x3e78f6['body']['id'];}return db[_0x735a('0x24')]['find']({'where':{'id':_0x3e78f6[_0x735a('0x2c')]['id']}})[_0x735a('0x1d')](handleEntityNotFound(_0x1c5204,null))[_0x735a('0x1d')](saveUpdates(_0x3e78f6['body'],null))[_0x735a('0x1d')](respondWithResult(_0x1c5204,null))['catch'](handleError(_0x1c5204,null));};exports[_0x735a('0x1e')]=function(_0x3dfc55,_0x7880cd){return db[_0x735a('0x24')][_0x735a('0x36')]({'where':{'id':_0x3dfc55[_0x735a('0x2c')]['id']}})[_0x735a('0x1d')](handleEntityNotFound(_0x7880cd,null))[_0x735a('0x1d')](removeEntity(_0x7880cd,null))['catch'](handleError(_0x7880cd,null));};exports[_0x735a('0x39')]=function(_0x331cf1,_0x437437){return db[_0x735a('0x24')]['describe']()[_0x735a('0x1d')](respondWithResult(_0x437437,null))[_0x735a('0x2a')](handleError(_0x437437,null));};exports[_0x735a('0x3a')]=function(_0x1fe7b7,_0xcc37c2){return db[_0x735a('0x3b')][_0x735a('0x36')]({'where':{'id':_0x1fe7b7[_0x735a('0x2c')]['id']}})[_0x735a('0x1d')](handleEntityNotFound(_0xcc37c2,null))[_0x735a('0x1d')](function(_0x574a1b){if(_0x574a1b){return _0x574a1b[_0x735a('0x3a')](_0x1fe7b7[_0x735a('0x38')][_0x735a('0x3c')],_[_0x735a('0x3d')](_0x1fe7b7['body'],[_0x735a('0x3c'),'id'])||{});}})[_0x735a('0x1d')](respondWithResult(_0xcc37c2,null))[_0x735a('0x2a')](handleError(_0xcc37c2,null));};exports[_0x735a('0x3e')]=function(_0xda0b47,_0x4e35ef){var _0x175536={'raw':![],'where':{}};var _0x4df54b={};var _0x211833={'count':0x0,'rows':[]};return db[_0x735a('0x24')]['findOne']({'where':{'id':_0xda0b47['params']['id']}})[_0x735a('0x1d')](handleEntityNotFound(_0x4e35ef,null))[_0x735a('0x1d')](function(_0x509b2d){if(_0x509b2d){_0x4df54b['model']=_[_0x735a('0x3f')](db[_0x735a('0x3b')][_0x735a('0x25')]);_0x4df54b[_0x735a('0x2e')]=_[_0x735a('0x3f')](_0xda0b47[_0x735a('0x2e')]);_0x4df54b['filters']=_['intersection'](_0x4df54b[_0x735a('0x2d')],_0x4df54b[_0x735a('0x2e')]);_0x175536[_0x735a('0x31')]=_[_0x735a('0x30')](_0x4df54b[_0x735a('0x2d')],qs[_0x735a('0x32')](_0xda0b47[_0x735a('0x2e')][_0x735a('0x32')]));_0x175536[_0x735a('0x31')]=_0x175536[_0x735a('0x31')][_0x735a('0x33')]?_0x175536[_0x735a('0x31')]:_0x4df54b[_0x735a('0x2d')];if(!_0xda0b47['query']['hasOwnProperty']('nolimit')){_0x175536[_0x735a('0x18')]=qs[_0x735a('0x18')](_0xda0b47[_0x735a('0x2e')][_0x735a('0x18')]);_0x175536[_0x735a('0x16')]=qs[_0x735a('0x16')](_0xda0b47[_0x735a('0x2e')][_0x735a('0x16')]);}_0x175536[_0x735a('0x40')]=qs[_0x735a('0x41')](_0xda0b47[_0x735a('0x2e')]['sort']);_0x175536[_0x735a('0x42')]=qs['filters'](_['pick'](_0xda0b47[_0x735a('0x2e')],_0x4df54b[_0x735a('0x2f')]));_0x175536['where'][_0x735a('0x43')]=_0x509b2d['id'];if(_0xda0b47[_0x735a('0x2e')][_0x735a('0x44')]){_0x175536[_0x735a('0x42')]=_[_0x735a('0x35')](_0x175536[_0x735a('0x42')],{'$or':_[_0x735a('0x23')](_0x175536['attributes'],function(_0x1582cf){var _0x17c166={};_0x17c166[_0x1582cf]={'$like':'%'+_0xda0b47[_0x735a('0x2e')]['filter']+'%'};return _0x17c166;})});}if(_0xda0b47['query'][_0x735a('0x45')]){var _0x3bedf2=_0xda0b47[_0x735a('0x2e')]['$gte'][_0x735a('0x46')](',');var _0x282154={};_0x282154[_0x3bedf2[0x0]]={'$gte':moment(_0x3bedf2[0x1])[_0x735a('0x47')](_0x735a('0x48'))};_0x175536[_0x735a('0x42')]=_[_0x735a('0x35')](_0x175536[_0x735a('0x42')],_0x282154);}_0x175536=_[_0x735a('0x35')]({},_0x175536,_0xda0b47[_0x735a('0x49')]);return db['FaxMessage'][_0x735a('0x19')]({'where':_0x175536['where']})[_0x735a('0x1d')](function(_0x16c1c8){_0x211833[_0x735a('0x19')]=_0x16c1c8;if(_0xda0b47[_0x735a('0x2e')]['includeAll']){_0x175536[_0x735a('0x4a')]=[{'all':!![]}];}return db[_0x735a('0x3b')][_0x735a('0x4b')](_0x175536);})[_0x735a('0x1d')](function(_0x3e4d65){_0x211833[_0x735a('0x4c')]=_0x3e4d65;return _0x211833;});}})[_0x735a('0x1d')](respondWithFilteredResult(_0x4e35ef,_0x175536))[_0x735a('0x2a')](handleError(_0x4e35ef,null));};exports[_0x735a('0x4d')]=function(_0xc6a0b3,_0x2bdc49){return db[_0x735a('0x24')][_0x735a('0x36')]({'where':{'id':_0xc6a0b3[_0x735a('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2bdc49,null))['then'](function(_0x5f301f){if(_0x5f301f){return _0x5f301f[_0x735a('0x4e')](_0xc6a0b3[_0x735a('0x38')][_0x735a('0x3c')],_[_0x735a('0x3d')](_0xc6a0b3[_0x735a('0x38')],[_0x735a('0x3c'),'id'])||{})[_0x735a('0x4f')](function(){return db[_0x735a('0x50')]['findAll']({'attributes':['id','name',_0x735a('0x51')],'where':{'id':_0xc6a0b3[_0x735a('0x38')][_0x735a('0x3c')]}});})['then'](function(_0x2e13ed){socket[_0x735a('0x52')](_0x735a('0x53'),{'id':Number(_0xc6a0b3[_0x735a('0x2c')]['id']),'tags':_0x2e13ed||[]});return{'id':Number(_0xc6a0b3[_0x735a('0x2c')]['id']),'tags':_0x2e13ed||[]};});}})[_0x735a('0x1d')](respondWithResult(_0x2bdc49,null))[_0x735a('0x2a')](handleError(_0x2bdc49,null));};exports[_0x735a('0x54')]=function(_0x49cbb1,_0xb7b9bb){return db[_0x735a('0x24')][_0x735a('0x36')]({'where':{'id':_0x49cbb1[_0x735a('0x2c')]['id']}})[_0x735a('0x1d')](handleEntityNotFound(_0xb7b9bb,null))[_0x735a('0x1d')](function(_0x30042c){if(_0x30042c){return _0x30042c[_0x735a('0x54')](_0x49cbb1['query'][_0x735a('0x3c')]);}})[_0x735a('0x1d')](respondWithStatusCode(_0xb7b9bb,null))[_0x735a('0x2a')](handleError(_0xb7b9bb,null));};exports[_0x735a('0x55')]=function(_0x2e91dc,_0x575ed5){var _0x35d8de=moment()['unix']()['toString']();var _0x4f54ab=path['join'](config[_0x735a('0x56')],'server',_0x735a('0x57'),'tmp');var _0x4624de=path['join'](config[_0x735a('0x56')],'server',_0x735a('0x57'),_0x735a('0x58'));var _0x35724b=path[_0x735a('0x59')](_0x4f54ab,_0x35d8de);var _0x4e0f11=util['format'](_0x735a('0x5a'),_0x2e91dc[_0x735a('0x2c')]['id'],_0x35d8de);var _0x3965c5=path['join'](_0x4f54ab,_0x4e0f11);var _0x58a3e9=[];_0x58a3e9[_0x735a('0x5b')]({'model':db[_0x735a('0x5c')],'as':_0x735a('0x5c'),'raw':!![]});var _0x2eac93=[{'model':db['FaxMessage'],'as':_0x735a('0x5d'),'attributes':['id',_0x735a('0x38'),_0x735a('0x5e')],'include':_0x58a3e9}];return db[_0x735a('0x24')][_0x735a('0x36')]({'where':{'id':_0x2e91dc[_0x735a('0x2c')]['id']},'include':_0x2eac93})[_0x735a('0x1d')](handleEntityNotFound(_0x575ed5,null))[_0x735a('0x1d')](function(_0x4cef25){if(_0x4cef25&&_0x4cef25[_0x735a('0x5d')]){var _0x240ddb=_0x4cef25[_0x735a('0x5f')]({'plain':!![]});fs[_0x735a('0x60')](_0x35724b);for(var _0x5111a4=0x0;_0x5111a4<_0x240ddb[_0x735a('0x5d')]['length'];_0x5111a4++){var _0xf7a900=_0x240ddb[_0x735a('0x5d')][_0x5111a4]['Attachment'];if(_0xf7a900){var _0xae8d42=path[_0x735a('0x59')](_0x4624de,_0xf7a900['basename']);if(fs[_0x735a('0x61')](_0xae8d42)){fs['createReadStream'](_0xae8d42)[_0x735a('0x62')](fs[_0x735a('0x63')](path[_0x735a('0x59')](_0x35724b,_0xf7a900[_0x735a('0x64')])));}}}return BPromise[_0x735a('0x65')]()[_0x735a('0x1d')](function(){return new BPromise(function(_0x132f14,_0x46ac19){zipdir(_0x35724b,{'saveTo':_0x3965c5},function(_0x50b499,_0x400710){if(_0x50b499)return _0x46ac19(_0x50b499);return _0x132f14(_0x400710);});})[_0x735a('0x1d')](function(){return new BPromise(function(_0x131884,_0x5e5bc6){rimraf(_0x35724b,function(_0x44805e){if(_0x44805e)_0x5e5bc6(_0x44805e);return _0x131884();});});})[_0x735a('0x1d')](function(){return _0x575ed5['download'](_0x3965c5,_0x4e0f11,function(_0x4a3519){if(_0x4a3519){console['log'](_0x735a('0x66'),_0x4a3519);}else{fs[_0x735a('0x67')](_0x3965c5);}});});});}else{return _0x575ed5[_0x735a('0x13')](0xc8);}})[_0x735a('0x2a')](handleError(_0x575ed5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 7639734..cc2204f 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 _0xe6cd=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users'];(function(_0x2c88b6,_0x7fa2bb){var _0x1478d1=function(_0x2d9565){while(--_0x2d9565){_0x2c88b6['push'](_0x2c88b6['shift']());}};_0x1478d1(++_0x7fa2bb);}(_0xe6cd,0x1ed));var _0xde6c=function(_0x15ccfe,_0xb6e509){_0x15ccfe=_0x15ccfe-0x0;var _0x538030=_0xe6cd[_0x15ccfe];return _0x538030;};'use strict';var EventEmitter=require(_0xde6c('0x0'));var FaxInteraction=require(_0xde6c('0x1'))['db'][_0xde6c('0x2')];var FaxMessage=require(_0xde6c('0x1'))['db'][_0xde6c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xde6c('0x4')](0x0);var events={'afterCreate':_0xde6c('0x5'),'afterUpdate':'update','afterDestroy':_0xde6c('0x6')};function emitEvent(_0x4c8ab4){return function(_0x5b7ef8,_0xb7f73b,_0x24f99c){_0x5b7ef8[_0xde6c('0x7')]({'attributes':['id'],'raw':!![]})[_0xde6c('0x8')](function(_0x26c2a0){_0x5b7ef8[_0xde6c('0x9')](_0xde6c('0xa'),_0x26c2a0['map'](function(_0x21ae99){return{'id':_0x21ae99['id']};}));return FaxMessage[_0xde6c('0xb')]({'where':{'FaxInteractionId':_0x5b7ef8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xde6c('0x8')](function(_0x18327){_0x5b7ef8[_0xde6c('0x9')](_0xde6c('0xc'),_0x18327[_0xde6c('0xd')]);FaxInteractionEvents[_0xde6c('0xe')](_0x4c8ab4+':'+_0x5b7ef8['id'],_0x5b7ef8);FaxInteractionEvents['emit'](_0x4c8ab4,_0x5b7ef8);_0x24f99c(null);})[_0xde6c('0xf')](_0x24f99c(null));};}for(var e in events){if(events[_0xde6c('0x10')](e)){var event=events[e];FaxInteraction[_0xde6c('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xcff2=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x2514ec,_0x51e1c2){var _0x4a4ec3=function(_0x2915ee){while(--_0x2915ee){_0x2514ec['push'](_0x2514ec['shift']());}};_0x4a4ec3(++_0x51e1c2);}(_0xcff2,0xd5));var _0x2cff=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0xcff2[_0x586fa2];return _0x515be9;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0x2cff('0x0'))['db'][_0x2cff('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2cff('0x2')](0x0);var events={'afterCreate':_0x2cff('0x3'),'afterUpdate':_0x2cff('0x4'),'afterDestroy':'remove'};function emitEvent(_0x492b18){return function(_0x3e99d4,_0x5c5097,_0x1c50a5){_0x3e99d4[_0x2cff('0x5')]({'attributes':['id'],'raw':!![]})[_0x2cff('0x6')](function(_0x146e7b){_0x3e99d4[_0x2cff('0x7')](_0x2cff('0x8'),_0x146e7b[_0x2cff('0x9')](function(_0x14dfa6){return{'id':_0x14dfa6['id']};}));return FaxMessage[_0x2cff('0xa')]({'where':{'FaxInteractionId':_0x3e99d4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2cc717){_0x3e99d4['setDataValue']('unreadMessages',_0x2cc717[_0x2cff('0xb')]);FaxInteractionEvents[_0x2cff('0xc')](_0x492b18+':'+_0x3e99d4['id'],_0x3e99d4);FaxInteractionEvents[_0x2cff('0xc')](_0x492b18,_0x3e99d4);_0x1c50a5(null);})[_0x2cff('0xd')](_0x1c50a5(null));};}for(var e in events){if(events[_0x2cff('0xe')](e)){var event=events[e];FaxInteraction[_0x2cff('0xf')](e,emitEvent(event));}}module[_0x2cff('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 02953eb..5fbccbb 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 _0x1122=['define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2112('0x0'));var util=require('util');var logger=require(_0x2112('0x1'))(_0x2112('0x2'));var moment=require(_0x2112('0x3'));var BPromise=require(_0x2112('0x4'));var rp=require(_0x2112('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2112('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x2112('0x7')]=function(_0x224776,_0x4c7ac4){return _0x224776[_0x2112('0x8')](_0x2112('0x9'),attributes,{'tableName':_0x2112('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x272bdb,_0x4190c7,_0x17d247){if(_0x272bdb[_0x2112('0xb')](_0x2112('0xc'))){_0x272bdb[_0x2112('0xd')]=moment()['format'](_0x2112('0xe'));}_0x17d247(null,_0x272bdb);}}});}; \ No newline at end of file +var _0x4bb2=['path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise'];(function(_0x4df58e,_0xf2d8dd){var _0x16ac17=function(_0x28a08c){while(--_0x28a08c){_0x4df58e['push'](_0x4df58e['shift']());}};_0x16ac17(++_0xf2d8dd);}(_0x4bb2,0x11c));var _0x24bb=function(_0x406561,_0x2036ae){_0x406561=_0x406561-0x0;var _0x942aab=_0x4bb2[_0x406561];return _0x942aab;};'use strict';var _=require(_0x24bb('0x0'));var util=require('util');var logger=require(_0x24bb('0x1'))(_0x24bb('0x2'));var moment=require(_0x24bb('0x3'));var BPromise=require('bluebird');var rp=require(_0x24bb('0x4'));var fs=require('fs');var path=require(_0x24bb('0x5'));var rimraf=require('rimraf');var config=require(_0x24bb('0x6'));var attributes=require(_0x24bb('0x7'));module[_0x24bb('0x8')]=function(_0x12d63c,_0x4c70d){return _0x12d63c[_0x24bb('0x9')](_0x24bb('0xa'),attributes,{'tableName':_0x24bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a9fcc,_0x1973cc,_0x2c2b44){if(_0x1a9fcc[_0x24bb('0xc')](_0x24bb('0xd'))){_0x1a9fcc[_0x24bb('0xe')]=moment()[_0x24bb('0xf')](_0x24bb('0x10'));}_0x2c2b44(null,_0x1a9fcc);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 3d9f520..1994651 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 _0x049d=['body','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','where','limit','then','debug','find','addTags','ids'];(function(_0x257184,_0x5fd62c){var _0x3a2e12=function(_0x151d9b){while(--_0x151d9b){_0x257184['push'](_0x257184['shift']());}};_0x3a2e12(++_0x5fd62c);}(_0x049d,0xc0));var _0xd049=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x049d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd049('0x0'));var util=require(_0xd049('0x1'));var moment=require('moment');var BPromise=require(_0xd049('0x2'));var rs=require(_0xd049('0x3'));var fs=require('fs');var Redis=require(_0xd049('0x4'));var db=require(_0xd049('0x5'))['db'];var utils=require(_0xd049('0x6'));var logger=require(_0xd049('0x7'))(_0xd049('0x8'));var config=require(_0xd049('0x9'));var jayson=require(_0xd049('0xa'));var client=jayson['client'][_0xd049('0xb')]({'port':0x232a});config[_0xd049('0xc')]=_[_0xd049('0xd')](config[_0xd049('0xc')],{'host':_0xd049('0xe'),'port':0x18eb});var socket=require(_0xd049('0xf'))(new Redis(config[_0xd049('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2701b3,_0x23287b,_0x26f44e){return new BPromise(function(_0x19014a,_0x4f376f){return client[_0xd049('0x10')](_0x2701b3,_0x26f44e)['then'](function(_0x240ec2){logger[_0xd049('0x11')](_0xd049('0x12'),_0x23287b,_0xd049('0x13'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x23287b,_0xd049('0x13'),JSON[_0xd049('0x14')](_0x240ec2));if(_0x240ec2[_0xd049('0x15')]){if(_0x240ec2[_0xd049('0x15')][_0xd049('0x16')]===0x1f4){logger['error'](_0xd049('0x12'),_0x23287b,_0x240ec2[_0xd049('0x15')]['message']);return _0x4f376f(_0x240ec2['error'][_0xd049('0x17')]);}logger[_0xd049('0x15')](_0xd049('0x12'),_0x23287b,_0x240ec2[_0xd049('0x15')][_0xd049('0x17')]);return _0x19014a(_0x240ec2[_0xd049('0x15')][_0xd049('0x17')]);}else{logger[_0xd049('0x11')](_0xd049('0x12'),_0x23287b,'request\x20sent');_0x19014a(_0x240ec2['result'][_0xd049('0x17')]);}})[_0xd049('0x18')](function(_0x233031){logger['error'](_0xd049('0x12'),_0x23287b,_0x233031);_0x4f376f(_0x233031);});});}exports[_0xd049('0x19')]=function(_0x46b9ca){var _0x456142=this;return new Promise(function(_0x1054a9,_0x525314){return db[_0xd049('0x1a')][_0xd049('0x1b')](_0x46b9ca['body'],{'raw':_0x46b9ca[_0xd049('0x1c')]?_0x46b9ca[_0xd049('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b9ca[_0xd049('0x1c')]?_0x46b9ca['options'][_0xd049('0x1d')]||null:null,'attributes':_0x46b9ca[_0xd049('0x1c')]?_0x46b9ca[_0xd049('0x1c')]['attributes']||null:null,'limit':_0x46b9ca[_0xd049('0x1c')]?_0x46b9ca[_0xd049('0x1c')][_0xd049('0x1e')]||null:null})[_0xd049('0x1f')](function(_0x477f0c){logger[_0xd049('0x11')](_0xd049('0x19'),_0x46b9ca);logger[_0xd049('0x20')](_0xd049('0x19'),_0x46b9ca,JSON[_0xd049('0x14')](_0x477f0c));_0x1054a9(_0x477f0c);})[_0xd049('0x18')](function(_0x233d8c){logger[_0xd049('0x15')]('UpdateFaxInteraction',_0x233d8c[_0xd049('0x17')],_0x46b9ca);_0x525314(_0x456142[_0xd049('0x15')](0x1f4,_0x233d8c[_0xd049('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x4d6f39){return new Promise(function(_0x3ddca8,_0x2e731b){return db[_0xd049('0x1a')][_0xd049('0x21')]({'where':_0x4d6f39[_0xd049('0x1c')]?_0x4d6f39['options'][_0xd049('0x1d')]||null:null})['then'](function(_0x40fed5){if(_0x40fed5){return _0x40fed5[_0xd049('0x22')](_0x4d6f39['body'][_0xd049('0x23')],_['omit'](_0x4d6f39[_0xd049('0x24')],['ids','id'])||{});}})['spread'](function(_0x3f36c8){logger[_0xd049('0x11')](_0xd049('0x25'),_0x4d6f39);logger[_0xd049('0x20')](_0xd049('0x25'),_0x4d6f39,JSON['stringify'](_0x3f36c8));_0x3ddca8(_0x3f36c8);})[_0xd049('0x18')](function(_0x19f5b2){logger[_0xd049('0x15')](_0xd049('0x25'),_0x19f5b2[_0xd049('0x17')],_0x4d6f39);_0x2e731b(_this['error'](0x1f4,_0x19f5b2[_0xd049('0x17')]));});});}; \ No newline at end of file +var _0xb88c=['AddTagsToFaxInteraction','FaxInteraction','find','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','update','body','raw','options','where','limit','then'];(function(_0x27844a,_0x7bf737){var _0x36eff5=function(_0x1343d6){while(--_0x1343d6){_0x27844a['push'](_0x27844a['shift']());}};_0x36eff5(++_0x7bf737);}(_0xb88c,0xaf));var _0xcb88=function(_0x4ffe6c,_0x1be001){_0x4ffe6c=_0x4ffe6c-0x0;var _0x2bdfc9=_0xb88c[_0x4ffe6c];return _0x2bdfc9;};'use strict';var _=require(_0xcb88('0x0'));var util=require(_0xcb88('0x1'));var moment=require('moment');var BPromise=require(_0xcb88('0x2'));var rs=require(_0xcb88('0x3'));var fs=require('fs');var Redis=require(_0xcb88('0x4'));var db=require(_0xcb88('0x5'))['db'];var utils=require(_0xcb88('0x6'));var logger=require(_0xcb88('0x7'))('rpc');var config=require(_0xcb88('0x8'));var jayson=require(_0xcb88('0x9'));var client=jayson['client'][_0xcb88('0xa')]({'port':0x232a});config['redis']=_[_0xcb88('0xb')](config[_0xcb88('0xc')],{'host':_0xcb88('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0xcb88('0xe')](socket);function respondWithRpcPromise(_0x1b0278,_0x4e2fb4,_0x333523){return new BPromise(function(_0xa483b3,_0x389c83){return client[_0xcb88('0xf')](_0x1b0278,_0x333523)['then'](function(_0x1f0afd){logger['info'](_0xcb88('0x10'),_0x4e2fb4,_0xcb88('0x11'));logger[_0xcb88('0x12')](_0xcb88('0x13'),_0x4e2fb4,_0xcb88('0x11'),JSON[_0xcb88('0x14')](_0x1f0afd));if(_0x1f0afd['error']){if(_0x1f0afd[_0xcb88('0x15')][_0xcb88('0x16')]===0x1f4){logger[_0xcb88('0x15')](_0xcb88('0x10'),_0x4e2fb4,_0x1f0afd[_0xcb88('0x15')]['message']);return _0x389c83(_0x1f0afd[_0xcb88('0x15')][_0xcb88('0x17')]);}logger[_0xcb88('0x15')](_0xcb88('0x10'),_0x4e2fb4,_0x1f0afd[_0xcb88('0x15')][_0xcb88('0x17')]);return _0xa483b3(_0x1f0afd[_0xcb88('0x15')][_0xcb88('0x17')]);}else{logger[_0xcb88('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x4e2fb4,_0xcb88('0x11'));_0xa483b3(_0x1f0afd[_0xcb88('0x19')]['message']);}})[_0xcb88('0x1a')](function(_0x2787c8){logger[_0xcb88('0x15')](_0xcb88('0x10'),_0x4e2fb4,_0x2787c8);_0x389c83(_0x2787c8);});});}exports[_0xcb88('0x1b')]=function(_0x5c3468){var _0x4577d6=this;return new Promise(function(_0x445ec5,_0x40203f){return db['FaxInteraction'][_0xcb88('0x1c')](_0x5c3468[_0xcb88('0x1d')],{'raw':_0x5c3468['options']?_0x5c3468['options'][_0xcb88('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c3468[_0xcb88('0x1f')]?_0x5c3468[_0xcb88('0x1f')][_0xcb88('0x20')]||null:null,'attributes':_0x5c3468[_0xcb88('0x1f')]?_0x5c3468[_0xcb88('0x1f')]['attributes']||null:null,'limit':_0x5c3468[_0xcb88('0x1f')]?_0x5c3468[_0xcb88('0x1f')][_0xcb88('0x21')]||null:null})[_0xcb88('0x22')](function(_0x3daa18){logger[_0xcb88('0x18')]('UpdateFaxInteraction',_0x5c3468);logger[_0xcb88('0x12')](_0xcb88('0x1b'),_0x5c3468,JSON[_0xcb88('0x14')](_0x3daa18));_0x445ec5(_0x3daa18);})['catch'](function(_0x3f3b7f){logger[_0xcb88('0x15')]('UpdateFaxInteraction',_0x3f3b7f[_0xcb88('0x17')],_0x5c3468);_0x40203f(_0x4577d6[_0xcb88('0x15')](0x1f4,_0x3f3b7f['message']));});});};exports[_0xcb88('0x23')]=function(_0xcb99ff){return new Promise(function(_0x398718,_0x2759ff){return db[_0xcb88('0x24')][_0xcb88('0x25')]({'where':_0xcb99ff[_0xcb88('0x1f')]?_0xcb99ff['options'][_0xcb88('0x20')]||null:null})['then'](function(_0x116f20){if(_0x116f20){return _0x116f20['addTags'](_0xcb99ff[_0xcb88('0x1d')][_0xcb88('0x26')],_[_0xcb88('0x27')](_0xcb99ff[_0xcb88('0x1d')],[_0xcb88('0x26'),'id'])||{});}})[_0xcb88('0x28')](function(_0x2c713d){logger[_0xcb88('0x18')](_0xcb88('0x29'),_0xcb99ff);logger[_0xcb88('0x12')]('AddTags',_0xcb99ff,JSON[_0xcb88('0x14')](_0x2c713d));_0x398718(_0x2c713d);})[_0xcb88('0x1a')](function(_0x318ae2){logger[_0xcb88('0x15')]('AddTags',_0x318ae2[_0xcb88('0x17')],_0xcb99ff);_0x2759ff(_this[_0xcb88('0x15')](0x1f4,_0x318ae2['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 39ba6df..2817163 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 _0x7427=['length','./faxInteraction.events','save','remove','emit','removeListener','register'];(function(_0x284729,_0x15f0a9){var _0x409dc2=function(_0x59add4){while(--_0x59add4){_0x284729['push'](_0x284729['shift']());}};_0x409dc2(++_0x15f0a9);}(_0x7427,0x19e));var _0x7742=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0x7427[_0xb83ec2];return _0x4d2fbf;};'use strict';var FaxInteractionEvents=require(_0x7742('0x0'));var events=[_0x7742('0x1'),_0x7742('0x2'),'update'];function createListener(_0x561035,_0x4bd288){return function(_0xed154f){_0x4bd288[_0x7742('0x3')](_0x561035,_0xed154f);};}function removeListener(_0x76c474,_0x3ed61d){return function(){FaxInteractionEvents[_0x7742('0x4')](_0x76c474,_0x3ed61d);};}exports[_0x7742('0x5')]=function(_0x4986ac){for(var _0x5f3ba5=0x0,_0x1c63e7=events[_0x7742('0x6')];_0x5f3ba5<_0x1c63e7;_0x5f3ba5++){var _0x511b9c=events[_0x5f3ba5];var _0x439b0f=createListener('faxInteraction:'+_0x511b9c,_0x4986ac);FaxInteractionEvents['on'](_0x511b9c,_0x439b0f);}}; \ No newline at end of file +var _0x7e02=['save','update','emit','register','faxInteraction:'];(function(_0x2c6fb9,_0xc7d7c0){var _0x49fd5e=function(_0x3dcbaf){while(--_0x3dcbaf){_0x2c6fb9['push'](_0x2c6fb9['shift']());}};_0x49fd5e(++_0xc7d7c0);}(_0x7e02,0xff));var _0x27e0=function(_0x34cc52,_0x461652){_0x34cc52=_0x34cc52-0x0;var _0x2729ec=_0x7e02[_0x34cc52];return _0x2729ec;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x27e0('0x0'),'remove',_0x27e0('0x1')];function createListener(_0x52c6c9,_0x2d8180){return function(_0x4a1580){_0x2d8180[_0x27e0('0x2')](_0x52c6c9,_0x4a1580);};}function removeListener(_0x208fd5,_0x56b824){return function(){FaxInteractionEvents['removeListener'](_0x208fd5,_0x56b824);};}exports[_0x27e0('0x3')]=function(_0x49a930){for(var _0x15630b=0x0,_0x70dbb8=events['length'];_0x15630b<_0x70dbb8;_0x15630b++){var _0x128e5c=events[_0x15630b];var _0x58cab8=createListener(_0x27e0('0x4')+_0x128e5c,_0x49a930);FaxInteractionEvents['on'](_0x128e5c,_0x58cab8);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9c638f1..b0f3f6a 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 _0xaeef=['get','isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','addTags','put','/:id','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0x2f2315,_0x85c29e){var _0x574853=function(_0xd67286){while(--_0xd67286){_0x2f2315['push'](_0x2f2315['shift']());}};_0x574853(++_0x85c29e);}(_0xaeef,0x161));var _0xfaee=function(_0x491025,_0x15ffa8){_0x491025=_0x491025-0x0;var _0x16da67=_0xaeef[_0x491025];return _0x16da67;};'use strict';var multer=require(_0xfaee('0x0'));var util=require(_0xfaee('0x1'));var path=require(_0xfaee('0x2'));var timeout=require(_0xfaee('0x3'));var express=require('express');var router=express[_0xfaee('0x4')]();var fs_extra=require(_0xfaee('0x5'));var auth=require(_0xfaee('0x6'));var interaction=require(_0xfaee('0x7'));var config=require(_0xfaee('0x8'));var controller=require(_0xfaee('0x9'));router[_0xfaee('0xa')]('/',auth[_0xfaee('0xb')](),controller[_0xfaee('0xc')]);router[_0xfaee('0xa')](_0xfaee('0xd'),auth['isAuthenticated'](),controller[_0xfaee('0xe')]);router['get']('/:id',auth[_0xfaee('0xb')](),controller[_0xfaee('0xf')]);router[_0xfaee('0xa')](_0xfaee('0x10'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xfaee('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xfaee('0x12')]('/',auth[_0xfaee('0xb')](),controller[_0xfaee('0x13')]);router[_0xfaee('0x12')](_0xfaee('0x10'),auth[_0xfaee('0xb')](),controller[_0xfaee('0x14')]);router[_0xfaee('0x12')](_0xfaee('0x15'),auth[_0xfaee('0xb')](),interaction[_0xfaee('0x16')](_0xfaee('0x17'),'faxinteraction:addtags'),controller[_0xfaee('0x18')]);router[_0xfaee('0x19')](_0xfaee('0x1a'),auth['isAuthenticated'](),interaction[_0xfaee('0x16')](_0xfaee('0x17'),_0xfaee('0x1b')),controller['update']);router[_0xfaee('0x1c')](_0xfaee('0x1a'),auth[_0xfaee('0xb')](),interaction['tracked'](_0xfaee('0x17'),_0xfaee('0x1d')),controller[_0xfaee('0x1e')]);router[_0xfaee('0x1c')]('/:id/tags',auth[_0xfaee('0xb')](),controller[_0xfaee('0x1f')]);module[_0xfaee('0x20')]=router; \ No newline at end of file +var _0x8ca3=['addTags','put','/:id','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax'];(function(_0x1afdea,_0x4560f6){var _0x3fce2a=function(_0x12574f){while(--_0x12574f){_0x1afdea['push'](_0x1afdea['shift']());}};_0x3fce2a(++_0x4560f6);}(_0x8ca3,0x1d0));var _0x38ca=function(_0x33b986,_0x40da5f){_0x33b986=_0x33b986-0x0;var _0x4ddaca=_0x8ca3[_0x33b986];return _0x4ddaca;};'use strict';var multer=require(_0x38ca('0x0'));var util=require(_0x38ca('0x1'));var path=require(_0x38ca('0x2'));var timeout=require(_0x38ca('0x3'));var express=require(_0x38ca('0x4'));var router=express[_0x38ca('0x5')]();var fs_extra=require(_0x38ca('0x6'));var auth=require(_0x38ca('0x7'));var interaction=require(_0x38ca('0x8'));var config=require('../../config/environment');var controller=require(_0x38ca('0x9'));router[_0x38ca('0xa')]('/',auth['isAuthenticated'](),controller[_0x38ca('0xb')]);router[_0x38ca('0xa')](_0x38ca('0xc'),auth[_0x38ca('0xd')](),controller[_0x38ca('0xe')]);router[_0x38ca('0xa')]('/:id',auth[_0x38ca('0xd')](),controller[_0x38ca('0xf')]);router['get'](_0x38ca('0x10'),auth['isAuthenticated'](),controller[_0x38ca('0x11')]);router['get'](_0x38ca('0x12'),auth[_0x38ca('0xd')](),controller[_0x38ca('0x13')]);router[_0x38ca('0x14')]('/',auth['isAuthenticated'](),controller[_0x38ca('0x15')]);router['post'](_0x38ca('0x10'),auth[_0x38ca('0xd')](),controller[_0x38ca('0x16')]);router['post'](_0x38ca('0x17'),auth[_0x38ca('0xd')](),interaction[_0x38ca('0x18')](_0x38ca('0x19'),'faxinteraction:addtags'),controller[_0x38ca('0x1a')]);router[_0x38ca('0x1b')](_0x38ca('0x1c'),auth['isAuthenticated'](),interaction[_0x38ca('0x18')]('fax',_0x38ca('0x1d')),controller['update']);router[_0x38ca('0x1e')]('/:id',auth[_0x38ca('0xd')](),interaction['tracked'](_0x38ca('0x19'),_0x38ca('0x1f')),controller[_0x38ca('0x20')]);router['delete'](_0x38ca('0x17'),auth['isAuthenticated'](),controller[_0x38ca('0x21')]);module[_0x38ca('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index afc1971..29494c3 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 _0x5ad3=['exports','TEXT','medium','ENUM','out','DATE','sequelize'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0x5ad3[_0x43d701];return _0x2ec4c6;};'use strict';var Sequelize=require(_0x35ad('0x0'));module[_0x35ad('0x1')]={'body':{'type':Sequelize[_0x35ad('0x2')](_0x35ad('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x35ad('0x4')]('in',_0x35ad('0x5')),'defaultValue':_0x35ad('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x35ad('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x35ad('0x6')]}}; \ No newline at end of file +var _0x780f=['BOOLEAN','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x323b01,_0x91ef5e){var _0x22416c=function(_0x36654d){while(--_0x36654d){_0x323b01['push'](_0x323b01['shift']());}};_0x22416c(++_0x91ef5e);}(_0x780f,0x6c));var _0xf780=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x780f[_0x53b8e0];return _0x10630c;};'use strict';var Sequelize=require(_0xf780('0x0'));module[_0xf780('0x1')]={'body':{'type':Sequelize[_0xf780('0x2')](_0xf780('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf780('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xf780('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf780('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf780('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index fa4bb25..ee204ab 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 _0xfa76=['role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','email','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','isNil','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./faxMessage.socket','jayson/promise','client','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','offset','limit','undefined','count','set','json','destroy','end','stack','name','send','index','map','FaxMessage','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','find','update','body','describe','sms','acceptMessage','accept','fax','reject','UserId','agent','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfa76,0x1dc));var _0x6fa7=function(_0x7d2300,_0x4612f6){_0x7d2300=_0x7d2300-0x0;var _0x2f23b0=_0xfa76[_0x7d2300];return _0x2f23b0;};'use strict';var util=require('util');var path=require(_0x6fa7('0x0'));var _=require(_0x6fa7('0x1'));var Redis=require(_0x6fa7('0x2'));var interactionService=require(_0x6fa7('0x3'));var qs=require(_0x6fa7('0x4'));var logger=require('../../config/logger')(_0x6fa7('0x5'));var config=require(_0x6fa7('0x6'));var db=require(_0x6fa7('0x7'))['db'];config[_0x6fa7('0x8')]=_['defaults'](config[_0x6fa7('0x8')],{'host':_0x6fa7('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6fa7('0xa'))['register'](socket);var jayson=require(_0x6fa7('0xb'));var client=jayson[_0x6fa7('0xc')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require('../../config/logger')('fax-interactions');function respondWithRpcPromise(_0x304eab,_0x2d0425,_0x1af04c,_0x5a8380){return new Promise(function(_0x553dcb,_0x4b5199){var _0x51040e=_0x5a8380||client;return _0x51040e['request'](_0x304eab,_0x1af04c)[_0x6fa7('0xd')](function(_0x2792ae){logger[_0x6fa7('0xe')](_0x6fa7('0xf'),_0x2d0425,_0x6fa7('0x10'));logger['debug'](_0x6fa7('0x11'),_0x2d0425,_0x6fa7('0x10'),JSON[_0x6fa7('0x12')](_0x2792ae));if(_0x2792ae[_0x6fa7('0x13')]){if(_0x2792ae[_0x6fa7('0x13')]['code']===0x1f4){logger[_0x6fa7('0x13')](_0x6fa7('0xf'),_0x2d0425,_0x2792ae['error'][_0x6fa7('0x14')]);return _0x4b5199(_0x2792ae['error'][_0x6fa7('0x14')]);}logger[_0x6fa7('0x13')]('FaxMessage,\x20%s,\x20%s',_0x2d0425,_0x2792ae[_0x6fa7('0x13')]['message']);return _0x553dcb(_0x2792ae[_0x6fa7('0x13')]['message']);}else{logger['info'](_0x6fa7('0xf'),_0x2d0425,_0x6fa7('0x10'));_0x553dcb(_0x2792ae[_0x6fa7('0x15')][_0x6fa7('0x14')]);}})[_0x6fa7('0x16')](function(_0x1c6a68){logger[_0x6fa7('0x13')](_0x6fa7('0xf'),_0x2d0425,_0x1c6a68);_0x4b5199(_0x1c6a68);});});}function respondWithResult(_0x22dc46,_0x5dab65){_0x5dab65=_0x5dab65||0xc8;return function(_0x1acdd4){if(_0x1acdd4){return _0x22dc46[_0x6fa7('0x17')](_0x5dab65)['json'](_0x1acdd4);}};}function respondWithFilteredResult(_0x4027f0,_0x3c2b81){return function(_0x4fc9a7){if(_0x4fc9a7){var _0x3a9805=typeof _0x3c2b81[_0x6fa7('0x18')]==='undefined'&&typeof _0x3c2b81[_0x6fa7('0x19')]===_0x6fa7('0x1a');var _0x20924b=_0x4fc9a7[_0x6fa7('0x1b')];var _0x29bfda=_0x3a9805?0x0:_0x3c2b81[_0x6fa7('0x18')];var _0x3afd49=_0x3a9805?_0x4fc9a7[_0x6fa7('0x1b')]:_0x3c2b81[_0x6fa7('0x18')]+_0x3c2b81['limit'];var _0x38e1cd;if(_0x3afd49>=_0x20924b){_0x3afd49=_0x20924b;_0x38e1cd=0xc8;}else{_0x38e1cd=0xce;}_0x4027f0['status'](_0x38e1cd);return _0x4027f0[_0x6fa7('0x1c')]('Content-Range',_0x29bfda+'-'+_0x3afd49+'/'+_0x20924b)[_0x6fa7('0x1d')](_0x4fc9a7);}return null;};}function saveUpdates(_0x2db283){return function(_0x14d607){if(_0x14d607){return _0x14d607['update'](_0x2db283)[_0x6fa7('0xd')](function(_0x2514d5){return _0x2514d5;});}return null;};}function removeEntity(_0x154397){return function(_0x2429a2){if(_0x2429a2){return _0x2429a2[_0x6fa7('0x1e')]()['then'](function(){_0x154397['status'](0xcc)[_0x6fa7('0x1f')]();});}};}function handleEntityNotFound(_0x3e2082){return function(_0x4be0e7){if(!_0x4be0e7){_0x3e2082['sendStatus'](0x194);}return _0x4be0e7;};}function handleError(_0x697d9a,_0x412f7b){_0x412f7b=_0x412f7b||0x1f4;return function(_0x461d06){logger['error'](_0x461d06[_0x6fa7('0x20')]);if(_0x461d06[_0x6fa7('0x21')]){delete _0x461d06[_0x6fa7('0x21')];}_0x697d9a[_0x6fa7('0x17')](_0x412f7b)[_0x6fa7('0x22')](_0x461d06);};}exports[_0x6fa7('0x23')]=function(_0x49638d,_0x1a3781){var _0x1afcbb={},_0x153a33={},_0x115902={'count':0x0,'rows':[]};var _0x385fc8=_[_0x6fa7('0x24')](db[_0x6fa7('0x25')]['rawAttributes'],function(_0x25f659){return{'name':_0x25f659['fieldName'],'type':_0x25f659[_0x6fa7('0x26')][_0x6fa7('0x27')]};});_0x153a33[_0x6fa7('0x28')]=_[_0x6fa7('0x24')](_0x385fc8,_0x6fa7('0x21'));_0x153a33[_0x6fa7('0x29')]=_[_0x6fa7('0x2a')](_0x49638d[_0x6fa7('0x29')]);_0x153a33[_0x6fa7('0x2b')]=_[_0x6fa7('0x2c')](_0x153a33[_0x6fa7('0x28')],_0x153a33[_0x6fa7('0x29')]);_0x1afcbb['attributes']=_['intersection'](_0x153a33[_0x6fa7('0x28')],qs[_0x6fa7('0x2d')](_0x49638d[_0x6fa7('0x29')]['fields']));_0x1afcbb[_0x6fa7('0x2e')]=_0x1afcbb[_0x6fa7('0x2e')][_0x6fa7('0x2f')]?_0x1afcbb[_0x6fa7('0x2e')]:_0x153a33[_0x6fa7('0x28')];if(!_0x49638d[_0x6fa7('0x29')][_0x6fa7('0x30')]('nolimit')){_0x1afcbb[_0x6fa7('0x19')]=qs['limit'](_0x49638d[_0x6fa7('0x29')]['limit']);_0x1afcbb['offset']=qs[_0x6fa7('0x18')](_0x49638d['query'][_0x6fa7('0x18')]);}_0x1afcbb[_0x6fa7('0x31')]=qs[_0x6fa7('0x32')](_0x49638d[_0x6fa7('0x29')][_0x6fa7('0x32')]);_0x1afcbb[_0x6fa7('0x33')]=qs[_0x6fa7('0x2b')](_[_0x6fa7('0x34')](_0x49638d[_0x6fa7('0x29')],_0x153a33[_0x6fa7('0x2b')]),_0x385fc8);if(_0x49638d[_0x6fa7('0x29')][_0x6fa7('0x35')]){_0x1afcbb['where']=_[_0x6fa7('0x36')](_0x1afcbb['where'],{'$or':_[_0x6fa7('0x24')](_0x385fc8,function(_0x40c74b){if(_0x40c74b['type']!==_0x6fa7('0x37')){var _0x224ba4={};_0x224ba4[_0x40c74b[_0x6fa7('0x21')]]={'$like':'%'+_0x49638d[_0x6fa7('0x29')][_0x6fa7('0x35')]+'%'};return _0x224ba4;}})});}_0x1afcbb=_[_0x6fa7('0x36')]({},_0x1afcbb,_0x49638d[_0x6fa7('0x38')]);var _0x75ff2c={'where':_0x1afcbb[_0x6fa7('0x33')]};return db[_0x6fa7('0x25')]['count'](_0x75ff2c)[_0x6fa7('0xd')](function(_0xe05467){_0x115902[_0x6fa7('0x1b')]=_0xe05467;if(_0x49638d[_0x6fa7('0x29')]['includeAll']){_0x1afcbb['include']=[{'all':!![]}];}return db['FaxMessage'][_0x6fa7('0x39')](_0x1afcbb);})[_0x6fa7('0xd')](function(_0x107707){_0x115902[_0x6fa7('0x3a')]=_0x107707;return _0x115902;})[_0x6fa7('0xd')](respondWithFilteredResult(_0x1a3781,_0x1afcbb))['catch'](handleError(_0x1a3781,null));};exports[_0x6fa7('0x3b')]=function(_0x466fdb,_0x43326e){var _0x416b80={'raw':!![],'where':{'id':_0x466fdb[_0x6fa7('0x3c')]['id']}},_0x262c5e={};_0x262c5e[_0x6fa7('0x28')]=_[_0x6fa7('0x2a')](db[_0x6fa7('0x25')][_0x6fa7('0x3d')]);_0x262c5e[_0x6fa7('0x29')]=_[_0x6fa7('0x2a')](_0x466fdb[_0x6fa7('0x29')]);_0x262c5e['filters']=_[_0x6fa7('0x2c')](_0x262c5e[_0x6fa7('0x28')],_0x262c5e['query']);_0x416b80[_0x6fa7('0x2e')]=_[_0x6fa7('0x2c')](_0x262c5e[_0x6fa7('0x28')],qs['fields'](_0x466fdb['query'][_0x6fa7('0x2d')]));_0x416b80[_0x6fa7('0x2e')]=_0x416b80[_0x6fa7('0x2e')][_0x6fa7('0x2f')]?_0x416b80[_0x6fa7('0x2e')]:_0x262c5e[_0x6fa7('0x28')];if(_0x466fdb[_0x6fa7('0x29')]['includeAll']){_0x416b80['include']=[{'all':!![]}];}_0x416b80=_[_0x6fa7('0x36')]({},_0x416b80,_0x466fdb[_0x6fa7('0x38')]);return db[_0x6fa7('0x25')][_0x6fa7('0x3e')](_0x416b80)[_0x6fa7('0xd')](handleEntityNotFound(_0x43326e,null))[_0x6fa7('0xd')](respondWithResult(_0x43326e,null))[_0x6fa7('0x16')](handleError(_0x43326e,null));};exports[_0x6fa7('0x3f')]=function(_0x5f4e82,_0x5b5c17){if(_0x5f4e82[_0x6fa7('0x40')]['id']){delete _0x5f4e82[_0x6fa7('0x40')]['id'];}return db['FaxMessage'][_0x6fa7('0x3e')]({'where':{'id':_0x5f4e82[_0x6fa7('0x3c')]['id']}})[_0x6fa7('0xd')](handleEntityNotFound(_0x5b5c17,null))[_0x6fa7('0xd')](saveUpdates(_0x5f4e82[_0x6fa7('0x40')],null))['then'](respondWithResult(_0x5b5c17,null))[_0x6fa7('0x16')](handleError(_0x5b5c17,null));};exports[_0x6fa7('0x1e')]=function(_0x4bf32e,_0x250cee){return db[_0x6fa7('0x25')][_0x6fa7('0x3e')]({'where':{'id':_0x4bf32e[_0x6fa7('0x3c')]['id']}})['then'](handleEntityNotFound(_0x250cee,null))[_0x6fa7('0xd')](removeEntity(_0x250cee,null))[_0x6fa7('0x16')](handleError(_0x250cee,null));};exports[_0x6fa7('0x41')]=function(_0x41a54c,_0x4a258e){return db['FaxMessage'][_0x6fa7('0x41')]()[_0x6fa7('0xd')](respondWithResult(_0x4a258e,null))['catch'](handleError(_0x4a258e,null));};exports['accept']=function(_0x46b3a3,_0x599ad2){var _0x5bf3ff=_0x6fa7('0x42');return interactionService[_0x6fa7('0x43')](_0x46b3a3,_0x5bf3ff)[_0x6fa7('0xd')](respondWithResult(_0x599ad2,null))[_0x6fa7('0x16')](handleError(_0x599ad2,null));};exports[_0x6fa7('0x44')]=function(_0x1c166e,_0x5e1098){var _0x15e7ea=_0x6fa7('0x45');return interactionService['acceptMessage'](_0x1c166e,_0x15e7ea)[_0x6fa7('0xd')](respondWithResult(_0x5e1098,null))[_0x6fa7('0x16')](handleError(_0x5e1098,null));};exports[_0x6fa7('0x46')]=function(_0x5ceb1e,_0x384195){var _0x44992d={'agent':{},'channel':_0x6fa7('0x45')};if(_0x5ceb1e[_0x6fa7('0x40')]['id']){delete _0x5ceb1e[_0x6fa7('0x40')]['id'];}_0x5ceb1e[_0x6fa7('0x40')][_0x6fa7('0x47')]=_0x5ceb1e[_0x6fa7('0x40')][_0x6fa7('0x47')]||_0x5ceb1e['user']['id'];_0x44992d[_0x6fa7('0x48')]['id']=_0x5ceb1e[_0x6fa7('0x40')][_0x6fa7('0x47')];return db['FaxMessage'][_0x6fa7('0x3e')]({'where':{'id':_0x5ceb1e[_0x6fa7('0x3c')]['id'],'UserId':null}})[_0x6fa7('0xd')](handleEntityNotFound(_0x384195,null))['then'](function(_0x37c8b9){if(_0x37c8b9){_0x44992d[_0x6fa7('0x14')]=_0x37c8b9[_0x6fa7('0x49')]({'plain':!![]});return db[_0x6fa7('0x4a')]['find']({'where':{'id':_0x37c8b9[_0x6fa7('0x4b')]}});}return null;})[_0x6fa7('0xd')](handleEntityNotFound(_0x384195,null))[_0x6fa7('0xd')](function(_0xc89fe7){if(_0xc89fe7){_0x44992d[_0x6fa7('0x4c')]=_0xc89fe7[_0x6fa7('0x49')]({'plain':!![]});interaction_log[_0x6fa7('0xe')](_0x6fa7('0x4d'),_0x5ceb1e[_0x6fa7('0x4e')]['id'],_0x5ceb1e[_0x6fa7('0x4e')][_0x6fa7('0x21')],_0x5ceb1e['user'][_0x6fa7('0x4f')],_0x44992d['interaction']['id'],_0x5ceb1e[_0x6fa7('0x40')]?JSON[_0x6fa7('0x12')](_0x5ceb1e['body']):_0x6fa7('0x50'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x44992d);}return null;})['then'](function(_0x4498a9){var _0x531cfb=_0x6fa7('0x51')+_0x4498a9['message']['ContactId'];return db[_0x6fa7('0x52')]['query'](_0x531cfb,{'type':db['Sequelize'][_0x6fa7('0x53')][_0x6fa7('0x54')],'raw':!![]})['then'](function(_0x68eb77){return _0x68eb77;});})[_0x6fa7('0xd')](function(_0x325a9b){if(_0x325a9b){_0x44992d[_0x6fa7('0x14')]['contact']=_0x325a9b[0x0];if(!_0x5ceb1e[_0x6fa7('0x40')]['UserId'])return;return db[_0x6fa7('0x55')][_0x6fa7('0x3e')]({'where':{'id':_0x5ceb1e['body'][_0x6fa7('0x47')],'role':_0x6fa7('0x48')},'attributes':['id',_0x6fa7('0x21'),_0x6fa7('0x56'),_0x6fa7('0x57'),'internal'],'raw':!![]});}return null;})[_0x6fa7('0xd')](function(_0x363011){if(!_0x363011)return null;_0x44992d[_0x6fa7('0x14')][_0x6fa7('0x48')]=_0x363011;return _0x44992d;})['then'](function(_0x330f66){if(_0x330f66){_0x330f66[_0x6fa7('0x14')][_0x6fa7('0x58')]=util[_0x6fa7('0x59')](_0x6fa7('0x5a'),_0x5ceb1e[_0x6fa7('0x4e')][_0x6fa7('0x21')]);_0x330f66[_0x6fa7('0x14')][_0x6fa7('0x5b')]=_0x44992d[_0x6fa7('0x5b')];_0x330f66[_0x6fa7('0x14')][_0x6fa7('0x5c')]=_0x44992d['channel'];_0x330f66[_0x6fa7('0x14')][_0x6fa7('0x5d')]=_0x6fa7('0x46');respondWithRpcPromise(_0x6fa7('0x5e'),_0x6fa7('0x5e'),{'event':_0x6fa7('0x5f'),'message':_0x330f66[_0x6fa7('0x14')]},client9002);return _0x44992d;}return null;})[_0x6fa7('0xd')](respondWithResult(_0x384195,null))[_0x6fa7('0x16')](handleError(_0x384195,null));};exports[_0x6fa7('0x60')]=function(_0x5234a6,_0x469441){var _0x2021f0;return db['FaxMessage'][_0x6fa7('0x60')](_0x5234a6[_0x6fa7('0x40')],{})[_0x6fa7('0xd')](function(_0xaf422b){_0x2021f0=_0xaf422b;return db[_0x6fa7('0x61')][_0x6fa7('0x62')]({'where':{'id':_0x2021f0[_0x6fa7('0x63')]}});})[_0x6fa7('0xd')](function(_0x1dba55){if(_['isNil'](_0x1dba55)){return;}else{_0x2021f0[_0x6fa7('0x45')]=_0x1dba55['fax'];return db[_0x6fa7('0x64')][_0x6fa7('0x62')]({'where':{'id':_0x2021f0[_0x6fa7('0x65')]}});}})[_0x6fa7('0xd')](function(_0x143380){return respondWithRpcPromise(_0x6fa7('0x66'),_0x6fa7('0x66'),{'FaxAccountId':_['isNil'](_0x5234a6[_0x6fa7('0x40')])?undefined:_0x5234a6[_0x6fa7('0x40')]['FaxAccountId'],'path':_[_0x6fa7('0x67')](_0x143380)?undefined:util[_0x6fa7('0x59')](_0x6fa7('0x68'),_0x143380[_0x6fa7('0x69')]),'fax':_[_0x6fa7('0x67')](_0x2021f0['fax'])?undefined:_0x2021f0['fax'],'AttachmentId':_0x2021f0['AttachmentId']},client9002);})[_0x6fa7('0xd')](respondWithResult(_0x469441,0xc9))['catch'](handleError(_0x469441,null));};exports[_0x6fa7('0x6a')]=function(_0x2ab967,_0x3f5e4b){var _0x419d70=path[_0x6fa7('0x6b')](config['root'],_0x6fa7('0x6c'),_0x6fa7('0x6d'),_0x6fa7('0x6e'));return db[_0x6fa7('0x25')][_0x6fa7('0x3e')]({'where':{'id':_0x2ab967[_0x6fa7('0x3c')]['id']},'include':[{'model':db[_0x6fa7('0x64')],'as':_0x6fa7('0x64')}]})[_0x6fa7('0xd')](handleEntityNotFound(_0x3f5e4b,null))[_0x6fa7('0xd')](function(_0x20d7a2){if(_0x20d7a2){return _0x3f5e4b['download'](path[_0x6fa7('0x6b')](_0x419d70,_0x20d7a2[_0x6fa7('0x64')][_0x6fa7('0x69')]));}})[_0x6fa7('0x16')](handleError(_0x3f5e4b,null));}; \ No newline at end of file +var _0x4825=['offset','limit','undefined','count','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','body','find','describe','accept','acceptMessage','fax','reject','UserId','user','get','FaxInteraction','FaxInteractionId','interaction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','agent','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','rejectmessage','create','findOne','isNil','AttachmentId','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','files','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','http','client','fax-interactions','request','then','info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','json'];(function(_0x542e14,_0x5dfd4b){var _0xe3bbb=function(_0x5c2ac7){while(--_0x5c2ac7){_0x542e14['push'](_0x542e14['shift']());}};_0xe3bbb(++_0x5dfd4b);}(_0x4825,0xc2));var _0x5482=function(_0x4c4a92,_0x2f032e){_0x4c4a92=_0x4c4a92-0x0;var _0xdc8bf0=_0x4825[_0x4c4a92];return _0xdc8bf0;};'use strict';var util=require(_0x5482('0x0'));var path=require('path');var _=require(_0x5482('0x1'));var Redis=require(_0x5482('0x2'));var interactionService=require(_0x5482('0x3'));var qs=require(_0x5482('0x4'));var logger=require(_0x5482('0x5'))('api');var config=require(_0x5482('0x6'));var db=require(_0x5482('0x7'))['db'];config[_0x5482('0x8')]=_[_0x5482('0x9')](config[_0x5482('0x8')],{'host':_0x5482('0xa'),'port':0x18eb});var socket=require(_0x5482('0xb'))(new Redis(config['redis']));require(_0x5482('0xc'))['register'](socket);var jayson=require(_0x5482('0xd'));var client=jayson['client'][_0x5482('0xe')]({'port':0x232c});var client9002=jayson[_0x5482('0xf')][_0x5482('0xe')]({'port':0x232a});var interaction_log=require(_0x5482('0x5'))(_0x5482('0x10'));function respondWithRpcPromise(_0x3728e5,_0x45fc2a,_0x130574,_0x28d268){return new Promise(function(_0x33e9e2,_0x12357e){var _0x2dcc65=_0x28d268||client;return _0x2dcc65[_0x5482('0x11')](_0x3728e5,_0x130574)[_0x5482('0x12')](function(_0x5281f3){logger[_0x5482('0x13')]('FaxMessage,\x20%s,\x20%s',_0x45fc2a,'request\x20sent');logger[_0x5482('0x14')](_0x5482('0x15'),_0x45fc2a,_0x5482('0x16'),JSON[_0x5482('0x17')](_0x5281f3));if(_0x5281f3[_0x5482('0x18')]){if(_0x5281f3['error'][_0x5482('0x19')]===0x1f4){logger[_0x5482('0x18')](_0x5482('0x1a'),_0x45fc2a,_0x5281f3[_0x5482('0x18')][_0x5482('0x1b')]);return _0x12357e(_0x5281f3['error'][_0x5482('0x1b')]);}logger[_0x5482('0x18')](_0x5482('0x1a'),_0x45fc2a,_0x5281f3[_0x5482('0x18')]['message']);return _0x33e9e2(_0x5281f3['error']['message']);}else{logger['info'](_0x5482('0x1a'),_0x45fc2a,_0x5482('0x16'));_0x33e9e2(_0x5281f3[_0x5482('0x1c')][_0x5482('0x1b')]);}})[_0x5482('0x1d')](function(_0x26e048){logger['error'](_0x5482('0x1a'),_0x45fc2a,_0x26e048);_0x12357e(_0x26e048);});});}function respondWithResult(_0x279163,_0x3902b1){_0x3902b1=_0x3902b1||0xc8;return function(_0x44d6a8){if(_0x44d6a8){return _0x279163[_0x5482('0x1e')](_0x3902b1)[_0x5482('0x1f')](_0x44d6a8);}};}function respondWithFilteredResult(_0x2eac49,_0x291300){return function(_0x3aa33c){if(_0x3aa33c){var _0x53a7df=typeof _0x291300[_0x5482('0x20')]==='undefined'&&typeof _0x291300[_0x5482('0x21')]===_0x5482('0x22');var _0x197a7a=_0x3aa33c[_0x5482('0x23')];var _0x52b0da=_0x53a7df?0x0:_0x291300[_0x5482('0x20')];var _0x1c4661=_0x53a7df?_0x3aa33c[_0x5482('0x23')]:_0x291300[_0x5482('0x20')]+_0x291300[_0x5482('0x21')];var _0x1e036c;if(_0x1c4661>=_0x197a7a){_0x1c4661=_0x197a7a;_0x1e036c=0xc8;}else{_0x1e036c=0xce;}_0x2eac49[_0x5482('0x1e')](_0x1e036c);return _0x2eac49[_0x5482('0x24')](_0x5482('0x25'),_0x52b0da+'-'+_0x1c4661+'/'+_0x197a7a)['json'](_0x3aa33c);}return null;};}function saveUpdates(_0x1867da){return function(_0x13484e){if(_0x13484e){return _0x13484e['update'](_0x1867da)['then'](function(_0x4b50a7){return _0x4b50a7;});}return null;};}function removeEntity(_0x269b02){return function(_0x3590a7){if(_0x3590a7){return _0x3590a7[_0x5482('0x26')]()['then'](function(){_0x269b02['status'](0xcc)[_0x5482('0x27')]();});}};}function handleEntityNotFound(_0x323275){return function(_0x275aa6){if(!_0x275aa6){_0x323275[_0x5482('0x28')](0x194);}return _0x275aa6;};}function handleError(_0x339aa3,_0x2377f0){_0x2377f0=_0x2377f0||0x1f4;return function(_0x5c7556){logger['error'](_0x5c7556[_0x5482('0x29')]);if(_0x5c7556[_0x5482('0x2a')]){delete _0x5c7556[_0x5482('0x2a')];}_0x339aa3[_0x5482('0x1e')](_0x2377f0)[_0x5482('0x2b')](_0x5c7556);};}exports[_0x5482('0x2c')]=function(_0x256982,_0x3a1ded){var _0xd51ebc={},_0x2fa3b8={},_0xd16adf={'count':0x0,'rows':[]};var _0x7fa7b1=_['map'](db[_0x5482('0x2d')][_0x5482('0x2e')],function(_0x160b9a){return{'name':_0x160b9a[_0x5482('0x2f')],'type':_0x160b9a[_0x5482('0x30')][_0x5482('0x31')]};});_0x2fa3b8[_0x5482('0x32')]=_[_0x5482('0x33')](_0x7fa7b1,_0x5482('0x2a'));_0x2fa3b8[_0x5482('0x34')]=_[_0x5482('0x35')](_0x256982[_0x5482('0x34')]);_0x2fa3b8[_0x5482('0x36')]=_[_0x5482('0x37')](_0x2fa3b8['model'],_0x2fa3b8[_0x5482('0x34')]);_0xd51ebc['attributes']=_[_0x5482('0x37')](_0x2fa3b8['model'],qs[_0x5482('0x38')](_0x256982[_0x5482('0x34')][_0x5482('0x38')]));_0xd51ebc[_0x5482('0x39')]=_0xd51ebc[_0x5482('0x39')]['length']?_0xd51ebc[_0x5482('0x39')]:_0x2fa3b8[_0x5482('0x32')];if(!_0x256982[_0x5482('0x34')][_0x5482('0x3a')]('nolimit')){_0xd51ebc[_0x5482('0x21')]=qs[_0x5482('0x21')](_0x256982['query'][_0x5482('0x21')]);_0xd51ebc[_0x5482('0x20')]=qs['offset'](_0x256982[_0x5482('0x34')][_0x5482('0x20')]);}_0xd51ebc[_0x5482('0x3b')]=qs['sort'](_0x256982[_0x5482('0x34')][_0x5482('0x3c')]);_0xd51ebc[_0x5482('0x3d')]=qs[_0x5482('0x36')](_[_0x5482('0x3e')](_0x256982[_0x5482('0x34')],_0x2fa3b8[_0x5482('0x36')]),_0x7fa7b1);if(_0x256982[_0x5482('0x34')][_0x5482('0x3f')]){_0xd51ebc['where']=_[_0x5482('0x40')](_0xd51ebc[_0x5482('0x3d')],{'$or':_[_0x5482('0x33')](_0x7fa7b1,function(_0x3fabda){if(_0x3fabda[_0x5482('0x30')]!==_0x5482('0x41')){var _0x2dccc3={};_0x2dccc3[_0x3fabda[_0x5482('0x2a')]]={'$like':'%'+_0x256982[_0x5482('0x34')][_0x5482('0x3f')]+'%'};return _0x2dccc3;}})});}_0xd51ebc=_[_0x5482('0x40')]({},_0xd51ebc,_0x256982['options']);var _0x297b34={'where':_0xd51ebc[_0x5482('0x3d')]};return db[_0x5482('0x2d')]['count'](_0x297b34)['then'](function(_0x24079f){_0xd16adf[_0x5482('0x23')]=_0x24079f;if(_0x256982[_0x5482('0x34')][_0x5482('0x42')]){_0xd51ebc[_0x5482('0x43')]=[{'all':!![]}];}return db[_0x5482('0x2d')][_0x5482('0x44')](_0xd51ebc);})[_0x5482('0x12')](function(_0x2b543f){_0xd16adf['rows']=_0x2b543f;return _0xd16adf;})[_0x5482('0x12')](respondWithFilteredResult(_0x3a1ded,_0xd51ebc))[_0x5482('0x1d')](handleError(_0x3a1ded,null));};exports[_0x5482('0x45')]=function(_0x44cb64,_0x17eb2d){var _0xf677a8={'raw':!![],'where':{'id':_0x44cb64[_0x5482('0x46')]['id']}},_0x9082ce={};_0x9082ce[_0x5482('0x32')]=_['keys'](db[_0x5482('0x2d')][_0x5482('0x2e')]);_0x9082ce[_0x5482('0x34')]=_[_0x5482('0x35')](_0x44cb64[_0x5482('0x34')]);_0x9082ce[_0x5482('0x36')]=_[_0x5482('0x37')](_0x9082ce[_0x5482('0x32')],_0x9082ce[_0x5482('0x34')]);_0xf677a8[_0x5482('0x39')]=_[_0x5482('0x37')](_0x9082ce[_0x5482('0x32')],qs[_0x5482('0x38')](_0x44cb64[_0x5482('0x34')]['fields']));_0xf677a8[_0x5482('0x39')]=_0xf677a8['attributes']['length']?_0xf677a8[_0x5482('0x39')]:_0x9082ce[_0x5482('0x32')];if(_0x44cb64[_0x5482('0x34')]['includeAll']){_0xf677a8['include']=[{'all':!![]}];}_0xf677a8=_[_0x5482('0x40')]({},_0xf677a8,_0x44cb64[_0x5482('0x47')]);return db[_0x5482('0x2d')]['find'](_0xf677a8)[_0x5482('0x12')](handleEntityNotFound(_0x17eb2d,null))[_0x5482('0x12')](respondWithResult(_0x17eb2d,null))[_0x5482('0x1d')](handleError(_0x17eb2d,null));};exports['update']=function(_0x210895,_0x3623c6){if(_0x210895[_0x5482('0x48')]['id']){delete _0x210895[_0x5482('0x48')]['id'];}return db['FaxMessage'][_0x5482('0x49')]({'where':{'id':_0x210895[_0x5482('0x46')]['id']}})[_0x5482('0x12')](handleEntityNotFound(_0x3623c6,null))[_0x5482('0x12')](saveUpdates(_0x210895['body'],null))[_0x5482('0x12')](respondWithResult(_0x3623c6,null))['catch'](handleError(_0x3623c6,null));};exports[_0x5482('0x26')]=function(_0x38ca54,_0x15f65a){return db['FaxMessage']['find']({'where':{'id':_0x38ca54[_0x5482('0x46')]['id']}})[_0x5482('0x12')](handleEntityNotFound(_0x15f65a,null))[_0x5482('0x12')](removeEntity(_0x15f65a,null))[_0x5482('0x1d')](handleError(_0x15f65a,null));};exports[_0x5482('0x4a')]=function(_0x1fea49,_0x3c716a){return db['FaxMessage']['describe']()[_0x5482('0x12')](respondWithResult(_0x3c716a,null))[_0x5482('0x1d')](handleError(_0x3c716a,null));};exports[_0x5482('0x4b')]=function(_0x35fc3a,_0x5d635d){var _0xa2f3f6='sms';return interactionService[_0x5482('0x4c')](_0x35fc3a,_0xa2f3f6)['then'](respondWithResult(_0x5d635d,null))[_0x5482('0x1d')](handleError(_0x5d635d,null));};exports['accept']=function(_0x10bc60,_0xd6b4b1){var _0x45f9dc=_0x5482('0x4d');return interactionService[_0x5482('0x4c')](_0x10bc60,_0x45f9dc)[_0x5482('0x12')](respondWithResult(_0xd6b4b1,null))[_0x5482('0x1d')](handleError(_0xd6b4b1,null));};exports[_0x5482('0x4e')]=function(_0x12f3bb,_0x1fb4ef){var _0x2f2c40={'agent':{},'channel':_0x5482('0x4d')};if(_0x12f3bb[_0x5482('0x48')]['id']){delete _0x12f3bb[_0x5482('0x48')]['id'];}_0x12f3bb[_0x5482('0x48')][_0x5482('0x4f')]=_0x12f3bb[_0x5482('0x48')]['UserId']||_0x12f3bb[_0x5482('0x50')]['id'];_0x2f2c40['agent']['id']=_0x12f3bb['body'][_0x5482('0x4f')];return db[_0x5482('0x2d')]['find']({'where':{'id':_0x12f3bb[_0x5482('0x46')]['id'],'UserId':null}})[_0x5482('0x12')](handleEntityNotFound(_0x1fb4ef,null))[_0x5482('0x12')](function(_0x236684){if(_0x236684){_0x2f2c40[_0x5482('0x1b')]=_0x236684[_0x5482('0x51')]({'plain':!![]});return db[_0x5482('0x52')][_0x5482('0x49')]({'where':{'id':_0x236684[_0x5482('0x53')]}});}return null;})[_0x5482('0x12')](handleEntityNotFound(_0x1fb4ef,null))[_0x5482('0x12')](function(_0x3585fe){if(_0x3585fe){_0x2f2c40[_0x5482('0x54')]=_0x3585fe['get']({'plain':!![]});interaction_log[_0x5482('0x13')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x12f3bb[_0x5482('0x50')]['id'],_0x12f3bb[_0x5482('0x50')][_0x5482('0x2a')],_0x12f3bb['user']['role'],_0x2f2c40[_0x5482('0x54')]['id'],_0x12f3bb[_0x5482('0x48')]?JSON[_0x5482('0x17')](_0x12f3bb['body']):_0x5482('0x55'));return respondWithRpcPromise(_0x5482('0x56'),'rejectMessage',_0x2f2c40);}return null;})[_0x5482('0x12')](function(_0x5086ee){var _0x625a92=_0x5482('0x57')+_0x5086ee[_0x5482('0x1b')]['ContactId'];return db[_0x5482('0x58')][_0x5482('0x34')](_0x625a92,{'type':db[_0x5482('0x59')][_0x5482('0x5a')]['SELECT'],'raw':!![]})[_0x5482('0x12')](function(_0x30bb9c){return _0x30bb9c;});})[_0x5482('0x12')](function(_0x3fef66){if(_0x3fef66){_0x2f2c40['message'][_0x5482('0x5b')]=_0x3fef66[0x0];if(!_0x12f3bb[_0x5482('0x48')][_0x5482('0x4f')])return;return db['User'][_0x5482('0x49')]({'where':{'id':_0x12f3bb['body'][_0x5482('0x4f')],'role':_0x5482('0x5c')},'attributes':['id',_0x5482('0x2a'),_0x5482('0x5d'),_0x5482('0x5e'),_0x5482('0x5f')],'raw':!![]});}return null;})[_0x5482('0x12')](function(_0x358607){if(!_0x358607)return null;_0x2f2c40[_0x5482('0x1b')][_0x5482('0x5c')]=_0x358607;return _0x2f2c40;})[_0x5482('0x12')](function(_0x22b28b){if(_0x22b28b){_0x22b28b[_0x5482('0x1b')][_0x5482('0x60')]=util[_0x5482('0x61')](_0x5482('0x62'),_0x12f3bb['user'][_0x5482('0x2a')]);_0x22b28b[_0x5482('0x1b')][_0x5482('0x63')]=_0x2f2c40[_0x5482('0x63')];_0x22b28b['message'][_0x5482('0x64')]=_0x2f2c40[_0x5482('0x63')];_0x22b28b['message']['event']=_0x5482('0x4e');respondWithRpcPromise('EventManager','EventManager',{'event':_0x5482('0x65'),'message':_0x22b28b[_0x5482('0x1b')]},client9002);return _0x2f2c40;}return null;})[_0x5482('0x12')](respondWithResult(_0x1fb4ef,null))[_0x5482('0x1d')](handleError(_0x1fb4ef,null));};exports['create']=function(_0x1516a2,_0x17a5d7){var _0x276dce;return db[_0x5482('0x2d')][_0x5482('0x66')](_0x1516a2[_0x5482('0x48')],{})[_0x5482('0x12')](function(_0x3d2e08){_0x276dce=_0x3d2e08;return db['CmContact'][_0x5482('0x67')]({'where':{'id':_0x276dce['ContactId']}});})[_0x5482('0x12')](function(_0x377dd7){if(_[_0x5482('0x68')](_0x377dd7)){return;}else{_0x276dce[_0x5482('0x4d')]=_0x377dd7[_0x5482('0x4d')];return db['Attachment'][_0x5482('0x67')]({'where':{'id':_0x276dce[_0x5482('0x69')]}});}})[_0x5482('0x12')](function(_0x48d760){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x5482('0x68')](_0x1516a2['body'])?undefined:_0x1516a2[_0x5482('0x48')][_0x5482('0x6a')],'path':_[_0x5482('0x68')](_0x48d760)?undefined:util['format'](_0x5482('0x6b'),_0x48d760[_0x5482('0x6c')]),'fax':_['isNil'](_0x276dce['fax'])?undefined:_0x276dce['fax'],'AttachmentId':_0x276dce[_0x5482('0x69')]},client9002);})['then'](respondWithResult(_0x17a5d7,0xc9))[_0x5482('0x1d')](handleError(_0x17a5d7,null));};exports[_0x5482('0x6d')]=function(_0x357364,_0x44b8c8){var _0x345e93=path[_0x5482('0x6e')](config[_0x5482('0x6f')],'server',_0x5482('0x70'),'attachments');return db[_0x5482('0x2d')][_0x5482('0x49')]({'where':{'id':_0x357364[_0x5482('0x46')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x44b8c8,null))[_0x5482('0x12')](function(_0x2d90ec){if(_0x2d90ec){return _0x44b8c8[_0x5482('0x6d')](path[_0x5482('0x6e')](_0x345e93,_0x2d90ec['Attachment'][_0x5482('0x6c')]));}})[_0x5482('0x1d')](handleError(_0x44b8c8,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8518369..953bf9e 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 _0x639a=['save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x534051,_0x3f75c3){var _0x257d89=function(_0x344e62){while(--_0x344e62){_0x534051['push'](_0x534051['shift']());}};_0x257d89(++_0x3f75c3);}(_0x639a,0x1e8));var _0xa639=function(_0x163314,_0x42262c){_0x163314=_0x163314-0x0;var _0x54af03=_0x639a[_0x163314];return _0x54af03;};'use strict';var EventEmitter=require(_0xa639('0x0'));var FaxMessage=require(_0xa639('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa639('0x2'),'afterUpdate':_0xa639('0x3'),'afterDestroy':'remove'};function emitEvent(_0x43c5a2){return function(_0x252c3f,_0x255d5a,_0x4070ad){FaxMessageEvents['emit'](_0x43c5a2+':'+_0x252c3f['id'],_0x252c3f);FaxMessageEvents[_0xa639('0x4')](_0x43c5a2,_0x252c3f);_0x4070ad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xa639('0x5')](e,emitEvent(event));}}module[_0xa639('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0xf105=['hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x42aa4b,_0xfc1906){var _0x1ccdb6=function(_0x231e11){while(--_0x231e11){_0x42aa4b['push'](_0x42aa4b['shift']());}};_0x1ccdb6(++_0xfc1906);}(_0xf105,0x1b0));var _0x5f10=function(_0x5ec1b5,_0x27a1b1){_0x5ec1b5=_0x5ec1b5-0x0;var _0x2e44be=_0xf105[_0x5ec1b5];return _0x2e44be;};'use strict';var EventEmitter=require(_0x5f10('0x0'));var FaxMessage=require(_0x5f10('0x1'))['db'][_0x5f10('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5f10('0x3')](0x0);var events={'afterCreate':_0x5f10('0x4'),'afterUpdate':_0x5f10('0x5'),'afterDestroy':'remove'};function emitEvent(_0x395cc9){return function(_0x5a7fe7,_0x2c0393,_0x14dcab){FaxMessageEvents[_0x5f10('0x6')](_0x395cc9+':'+_0x5a7fe7['id'],_0x5a7fe7);FaxMessageEvents[_0x5f10('0x6')](_0x395cc9,_0x5a7fe7);_0x14dcab(null);};}for(var e in events){if(events[_0x5f10('0x7')](e)){var event=events[e];FaxMessage[_0x5f10('0x8')](e,emitEvent(event));}}module[_0x5f10('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 65b9aca..18f288c 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 _0x3460=['body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','FaxInteractionId','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxMessage.attributes','exports','define','FaxMessage','fax_messages'];(function(_0x93dc77,_0x1857e9){var _0xf1250e=function(_0x5da45a){while(--_0x5da45a){_0x93dc77['push'](_0x93dc77['shift']());}};_0xf1250e(++_0x1857e9);}(_0x3460,0x15f));var _0x0346=function(_0x1db23c,_0x52a597){_0x1db23c=_0x1db23c-0x0;var _0x22bab9=_0x3460[_0x1db23c];return _0x22bab9;};'use strict';var _=require(_0x0346('0x0'));var util=require(_0x0346('0x1'));var logger=require(_0x0346('0x2'))(_0x0346('0x3'));var moment=require(_0x0346('0x4'));var BPromise=require(_0x0346('0x5'));var rp=require(_0x0346('0x6'));var fs=require('fs');var path=require(_0x0346('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0346('0x8'));module[_0x0346('0x9')]=function(_0xa1e531,_0x2f843f){return _0xa1e531[_0x0346('0xa')](_0x0346('0xb'),attributes,{'tableName':_0x0346('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x0346('0xd')],'type':_0x0346('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d2f88,_0x104989,_0x4405f7){var _0x531535=_0xa1e531[_0x0346('0xf')];var _0xb5e730=_0x5d2f88[_0x0346('0x10')]({'plain':!![]});if(_0xb5e730[_0x0346('0x11')][_0x0346('0x12')]()==='in'||_0xb5e730[_0x0346('0x11')][_0x0346('0x12')]()==='out'&&!_0xb5e730[_0x0346('0x13')]&&!_['isNil'](_0xb5e730[_0x0346('0x14')])){_0x531535['FaxInteraction']['findOne']({'where':{'id':_0xb5e730[_0x0346('0x15')]}})['then'](function(_0xcfc18f){if(_0xcfc18f){_0xcfc18f['update']({'lastMsgAt':_0xb5e730[_0x0346('0x16')],'lastMsgDirection':_0xb5e730[_0x0346('0x11')][_0x0346('0x12')]()});}})[_0x0346('0x17')](function(_0x101762){console[_0x0346('0x18')](_0x101762);});}_0x4405f7();}},'charset':_0x0346('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x95f0=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','FaxInteraction','then','update','createdAt','catch','error','utf8mb4','lodash','util'];(function(_0x387f80,_0x141029){var _0x3bec51=function(_0x419704){while(--_0x419704){_0x387f80['push'](_0x387f80['shift']());}};_0x3bec51(++_0x141029);}(_0x95f0,0x1eb));var _0x095f=function(_0x461be2,_0x38a677){_0x461be2=_0x461be2-0x0;var _0x5edac8=_0x95f0[_0x461be2];return _0x5edac8;};'use strict';var _=require(_0x095f('0x0'));var util=require(_0x095f('0x1'));var logger=require(_0x095f('0x2'))(_0x095f('0x3'));var moment=require(_0x095f('0x4'));var BPromise=require(_0x095f('0x5'));var rp=require(_0x095f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x095f('0x7'));var attributes=require(_0x095f('0x8'));module[_0x095f('0x9')]=function(_0x5fe6b5,_0x2c3775){return _0x5fe6b5[_0x095f('0xa')](_0x095f('0xb'),attributes,{'tableName':_0x095f('0xc'),'paranoid':![],'indexes':[{'name':_0x095f('0xd'),'fields':[_0x095f('0xe')],'type':_0x095f('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22c8ac,_0x179c11,_0x19fa46){var _0x27b74d=_0x5fe6b5[_0x095f('0x10')];var _0x2565ae=_0x22c8ac[_0x095f('0x11')]({'plain':!![]});if(_0x2565ae[_0x095f('0x12')]['toLowerCase']()==='in'||_0x2565ae[_0x095f('0x12')][_0x095f('0x13')]()===_0x095f('0x14')&&!_0x2565ae['secret']&&!_['isNil'](_0x2565ae[_0x095f('0x15')])){_0x27b74d[_0x095f('0x16')]['findOne']({'where':{'id':_0x2565ae['FaxInteractionId']}})[_0x095f('0x17')](function(_0x1bff39){if(_0x1bff39){_0x1bff39[_0x095f('0x18')]({'lastMsgAt':_0x2565ae[_0x095f('0x19')],'lastMsgDirection':_0x2565ae[_0x095f('0x12')][_0x095f('0x13')]()});}})[_0x095f('0x1a')](function(_0x105d9f){console[_0x095f('0x1b')](_0x105d9f);});}_0x19fa46();}},'charset':_0x095f('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 81ef8ae..cbebf49 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 _0xa41a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','info','debug','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','body','options','raw','then','FaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','bluebird','randomstring'];(function(_0xc4ed0c,_0x2e63f6){var _0x365f54=function(_0x8de275){while(--_0x8de275){_0xc4ed0c['push'](_0xc4ed0c['shift']());}};_0x365f54(++_0x2e63f6);}(_0xa41a,0x6b));var _0xaa41=function(_0x5cdd20,_0x5cb231){_0x5cdd20=_0x5cdd20-0x0;var _0x53246a=_0xa41a[_0x5cdd20];return _0x53246a;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xaa41('0xc')],{'host':_0xaa41('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xc')]));require(_0xaa41('0xe'))[_0xaa41('0xf')](socket);function respondWithRpcPromise(_0x1cc344,_0x4263d6,_0x38d930){return new BPromise(function(_0x806f08,_0x423a19){return client[_0xaa41('0x10')](_0x1cc344,_0x38d930)['then'](function(_0x1d3aac){logger[_0xaa41('0x11')]('FaxMessage,\x20%s,\x20%s',_0x4263d6,'request\x20sent');logger[_0xaa41('0x12')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4263d6,_0xaa41('0x13'),JSON[_0xaa41('0x14')](_0x1d3aac));if(_0x1d3aac[_0xaa41('0x15')]){if(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x16')]===0x1f4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);return _0x423a19(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}logger[_0xaa41('0x15')](_0xaa41('0x17'),_0x4263d6,_0x1d3aac['error'][_0xaa41('0x18')]);return _0x806f08(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}else{logger[_0xaa41('0x11')](_0xaa41('0x17'),_0x4263d6,_0xaa41('0x13'));_0x806f08(_0x1d3aac[_0xaa41('0x19')][_0xaa41('0x18')]);}})[_0xaa41('0x1a')](function(_0x4fe1a4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x4fe1a4);_0x423a19(_0x4fe1a4);});});}exports[_0xaa41('0x1b')]=function(_0x35c753){var _0x54c488=this;return new Promise(function(_0x2bf794,_0x1f692b){return db['FaxMessage']['create'](_0x35c753[_0xaa41('0x1c')],{'raw':_0x35c753['options']?_0x35c753[_0xaa41('0x1d')][_0xaa41('0x1e')]===undefined?!![]:![]:!![]})[_0xaa41('0x1f')](function(_0x1f27f3){logger[_0xaa41('0x11')]('CreateFaxMessage',_0x35c753);logger[_0xaa41('0x12')](_0xaa41('0x1b'),_0x35c753,JSON[_0xaa41('0x14')](_0x1f27f3));_0x2bf794(_0x1f27f3);})[_0xaa41('0x1a')](function(_0x274630){logger[_0xaa41('0x15')]('CreateFaxMessage',_0x274630['message'],_0x35c753);_0x1f692b(_0x54c488[_0xaa41('0x15')](0x1f4,_0x274630['message']));});});};exports['UpdateFaxMessage']=function(_0x12e362){var _0x59707f=this;return new Promise(function(_0x536bed,_0x2d0ac0){return db[_0xaa41('0x20')][_0xaa41('0x21')](_0x12e362[_0xaa41('0x1c')],{'raw':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')][_0xaa41('0x22')]||null:null,'attributes':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')][_0xaa41('0x23')]||null:null,'limit':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')]['limit']||null:null})[_0xaa41('0x1f')](function(_0x48b48b){logger['info'](_0xaa41('0x24'),_0x12e362);logger[_0xaa41('0x12')]('UpdateFaxMessage',_0x12e362,JSON[_0xaa41('0x14')](_0x48b48b));_0x536bed(_0x48b48b);})[_0xaa41('0x1a')](function(_0x4e3b44){logger['error']('UpdateFaxMessage',_0x4e3b44[_0xaa41('0x18')],_0x12e362);_0x2d0ac0(_0x59707f[_0xaa41('0x15')](0x1f4,_0x4e3b44[_0xaa41('0x18')]));});});}; \ No newline at end of file +var _0xb821=['register','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x1f0763,_0x584017){var _0x4673d5=function(_0x50791c){while(--_0x50791c){_0x1f0763['push'](_0x1f0763['shift']());}};_0x4673d5(++_0x584017);}(_0xb821,0xa7));var _0x1b82=function(_0x4d167f,_0x2ffbb7){_0x4d167f=_0x4d167f-0x0;var _0x3748d3=_0xb821[_0x4d167f];return _0x3748d3;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});config[_0x1b82('0x8')]=_[_0x1b82('0x9')](config[_0x1b82('0x8')],{'host':_0x1b82('0xa'),'port':0x18eb});var socket=require(_0x1b82('0xb'))(new Redis(config[_0x1b82('0x8')]));require(_0x1b82('0xc'))[_0x1b82('0xd')](socket);function respondWithRpcPromise(_0x4955b5,_0x4011f2,_0x30c6ee){return new BPromise(function(_0x44dfd4,_0x14c57a){return client[_0x1b82('0xe')](_0x4955b5,_0x30c6ee)[_0x1b82('0xf')](function(_0x739f99){logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1b82('0x11'));logger[_0x1b82('0x12')](_0x1b82('0x13'),_0x4011f2,_0x1b82('0x11'),JSON['stringify'](_0x739f99));if(_0x739f99[_0x1b82('0x14')]){if(_0x739f99['error']['code']===0x1f4){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);return _0x14c57a(_0x739f99['error'][_0x1b82('0x15')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')]['message']);return _0x44dfd4(_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);}else{logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,'request\x20sent');_0x44dfd4(_0x739f99[_0x1b82('0x16')]['message']);}})[_0x1b82('0x17')](function(_0x1002a1){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1002a1);_0x14c57a(_0x1002a1);});});}exports[_0x1b82('0x18')]=function(_0x2b6ee8){var _0x11af50=this;return new Promise(function(_0x46e5e2,_0x10d45c){return db['FaxMessage'][_0x1b82('0x19')](_0x2b6ee8[_0x1b82('0x1a')],{'raw':_0x2b6ee8[_0x1b82('0x1b')]?_0x2b6ee8[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![]})[_0x1b82('0xf')](function(_0x2d07f4){logger['info'](_0x1b82('0x18'),_0x2b6ee8);logger[_0x1b82('0x12')]('CreateFaxMessage',_0x2b6ee8,JSON[_0x1b82('0x1d')](_0x2d07f4));_0x46e5e2(_0x2d07f4);})[_0x1b82('0x17')](function(_0x1ad9d6){logger['error'](_0x1b82('0x18'),_0x1ad9d6['message'],_0x2b6ee8);_0x10d45c(_0x11af50['error'](0x1f4,_0x1ad9d6['message']));});});};exports[_0x1b82('0x1e')]=function(_0x149d0f){var _0xfd00d1=this;return new Promise(function(_0x257b79,_0x548a3b){return db[_0x1b82('0x1f')][_0x1b82('0x20')](_0x149d0f[_0x1b82('0x1a')],{'raw':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x21')]||null:null,'attributes':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x22')]||null:null,'limit':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f['options'][_0x1b82('0x23')]||null:null})[_0x1b82('0xf')](function(_0x155a34){logger[_0x1b82('0x10')](_0x1b82('0x1e'),_0x149d0f);logger[_0x1b82('0x12')](_0x1b82('0x1e'),_0x149d0f,JSON[_0x1b82('0x1d')](_0x155a34));_0x257b79(_0x155a34);})[_0x1b82('0x17')](function(_0x362657){logger['error'](_0x1b82('0x1e'),_0x362657[_0x1b82('0x15')],_0x149d0f);_0x548a3b(_0xfd00d1[_0x1b82('0x14')](0x1f4,_0x362657[_0x1b82('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index feecda6..7eb35c1 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 _0x4b5f=['removeListener','register','length','faxMessage:','./faxMessage.events','save','update'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x4b5f,0xeb));var _0xf4b5=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0x4b5f[_0x29dda1];return _0x21b0ef;};'use strict';var FaxMessageEvents=require(_0xf4b5('0x0'));var events=[_0xf4b5('0x1'),'remove',_0xf4b5('0x2')];function createListener(_0x49bc34,_0x21e4d3){return function(_0x464a8a){_0x21e4d3['emit'](_0x49bc34,_0x464a8a);};}function removeListener(_0x113013,_0x5a5435){return function(){FaxMessageEvents[_0xf4b5('0x3')](_0x113013,_0x5a5435);};}exports[_0xf4b5('0x4')]=function(_0x2293b7){for(var _0x269b42=0x0,_0x4cea13=events[_0xf4b5('0x5')];_0x269b42<_0x4cea13;_0x269b42++){var _0x44bb9d=events[_0x269b42];var _0x48337c=createListener(_0xf4b5('0x6')+_0x44bb9d,_0x2293b7);FaxMessageEvents['on'](_0x44bb9d,_0x48337c);}}; \ No newline at end of file +var _0x1886=['emit','register','faxMessage:','save','remove'];(function(_0x3ed704,_0x563fa0){var _0xe1dd00=function(_0x1ca02d){while(--_0x1ca02d){_0x3ed704['push'](_0x3ed704['shift']());}};_0xe1dd00(++_0x563fa0);}(_0x1886,0xc6));var _0x6188=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1886[_0x2641f9];return _0x585741;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x6188('0x0'),_0x6188('0x1'),'update'];function createListener(_0x2dcdeb,_0x6a2533){return function(_0x5270df){_0x6a2533[_0x6188('0x2')](_0x2dcdeb,_0x5270df);};}function removeListener(_0xd0b514,_0xf99cf4){return function(){FaxMessageEvents['removeListener'](_0xd0b514,_0xf99cf4);};}exports[_0x6188('0x3')]=function(_0x302f0a){for(var _0x3bf7d6=0x0,_0x3e8b8e=events['length'];_0x3bf7d6<_0x3e8b8e;_0x3bf7d6++){var _0x3a59a1=events[_0x3bf7d6];var _0x181dfd=createListener(_0x6188('0x4')+_0x3a59a1,_0x302f0a);FaxMessageEvents['on'](_0x3a59a1,_0x181dfd);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index d31fdd4..77a4f1c 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 _0x593e=['../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','fax','faxmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3d66f0,_0x3f4e63){var _0x4164f3=function(_0x11c22e){while(--_0x11c22e){_0x3d66f0['push'](_0x3d66f0['shift']());}};_0x4164f3(++_0x3f4e63);}(_0x593e,0xcb));var _0xe593=function(_0x535820,_0x360579){_0x535820=_0x535820-0x0;var _0x1ee2b6=_0x593e[_0x535820];return _0x1ee2b6;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),interaction['tracked'](_0xe593('0x12'),_0xe593('0x13')),controller[_0xe593('0x14')]);router[_0xe593('0x15')](_0xe593('0x16'),auth[_0xe593('0xb')](),controller[_0xe593('0x17')]);router[_0xe593('0x15')](_0xe593('0x18'),auth[_0xe593('0xb')](),controller['accept']);router[_0xe593('0x15')](_0xe593('0x19'),auth['isAuthenticated'](),controller[_0xe593('0x1a')]);router[_0xe593('0x1b')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0x1c')]);module[_0xe593('0x1d')]=router; \ No newline at end of file +var _0x41bb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','/:id','show','/:id/download','download','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','multer','util','connect-timeout'];(function(_0x5d8488,_0x46ca8a){var _0x4b758c=function(_0x29b0f8){while(--_0x29b0f8){_0x5d8488['push'](_0x5d8488['shift']());}};_0x4b758c(++_0x46ca8a);}(_0x41bb,0xc5));var _0xb41b=function(_0x1c0b00,_0x473b17){_0x1c0b00=_0x1c0b00-0x0;var _0x30b50f=_0x41bb[_0x1c0b00];return _0x30b50f;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0x8')](_0xb41b('0xd'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router['post']('/',auth[_0xb41b('0x9')](),interaction['tracked'](_0xb41b('0xf'),_0xb41b('0x10')),controller[_0xb41b('0x11')]);router[_0xb41b('0x12')](_0xb41b('0xb'),auth['isAuthenticated'](),controller[_0xb41b('0x13')]);router[_0xb41b('0x12')](_0xb41b('0x14'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xb41b('0x16')]);router[_0xb41b('0x17')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index b12124a..5ad76cd 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 _0x4816=['roundrobin','INTEGER','exports','name','STRING','ENUM'];(function(_0xa12a63,_0x44f899){var _0x17fdc3=function(_0x3d31fe){while(--_0x3d31fe){_0xa12a63['push'](_0xa12a63['shift']());}};_0x17fdc3(++_0x44f899);}(_0x4816,0xfe));var _0x6481=function(_0x45f4e9,_0x5246fd){_0x45f4e9=_0x45f4e9-0x0;var _0x559d8f=_0x4816[_0x45f4e9];return _0x559d8f;};'use strict';var Sequelize=require('sequelize');module[_0x6481('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6481('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6481('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6481('0x3')]('rrmemory','beepall',_0x6481('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6481('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf2a0=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x886dc,_0x3b86c7){var _0x486f85=function(_0x175815){while(--_0x175815){_0x886dc['push'](_0x886dc['shift']());}};_0x486f85(++_0x3b86c7);}(_0xf2a0,0x88));var _0x0f2a=function(_0x401089,_0x469a19){_0x401089=_0x401089-0x0;var _0x128e7c=_0xf2a0[_0x401089];return _0x128e7c;};'use strict';var Sequelize=require('sequelize');module[_0x0f2a('0x0')]={'name':{'type':Sequelize[_0x0f2a('0x1')],'unique':_0x0f2a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0f2a('0x1')]},'timeout':{'type':Sequelize[_0x0f2a('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0f2a('0x4')](_0x0f2a('0x5'),_0x0f2a('0x6'),_0x0f2a('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 53ecfbb..be5afcc 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 _0x57ca=['userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','includes','compact','value','userFaxQueue:remove','addAgents','removeAgents','getAgents','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','get','FaxQueues','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','include','query','rows','catch','params','model','keys','filters','intersection','attributes','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','fields','length','nolimit','sort','pick','where','FaxQueueId','filter','UserFaxQueue','findAll','User','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','order','hasOwnProperty','addTeams','ids','Team','Agents','online','voicePause','transaction','each','findOrCreate','forEach','emit'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0x57ca,0x108));var _0xa57c=function(_0x5ec840,_0x175254){_0x5ec840=_0x5ec840-0x0;var _0x9f6e66=_0x57ca[_0x5ec840];return _0x9f6e66;};'use strict';var BPromise=require('bluebird');var util=require(_0xa57c('0x0'));var _=require(_0xa57c('0x1'));var squel=require('squel');var Redis=require(_0xa57c('0x2'));var qs=require(_0xa57c('0x3'));var logger=require(_0xa57c('0x4'))(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var db=require('../../mysqldb')['db'];config[_0xa57c('0x7')]=_[_0xa57c('0x8')](config[_0xa57c('0x7')],{'host':_0xa57c('0x9'),'port':0x18eb});var socket=require(_0xa57c('0xa'))(new Redis(config[_0xa57c('0x7')]));require(_0xa57c('0xb'))[_0xa57c('0xc')](socket);function respondWithStatusCode(_0x5e3962,_0x13dad8){_0x13dad8=_0x13dad8||0xcc;return function(_0x4b51d8){if(_0x4b51d8){return _0x5e3962[_0xa57c('0xd')](_0x13dad8);}return _0x5e3962[_0xa57c('0xe')](_0x13dad8)['end']();};}function respondWithResult(_0x156bca,_0x51f287){_0x51f287=_0x51f287||0xc8;return function(_0x554101){if(_0x554101){return _0x156bca[_0xa57c('0xe')](_0x51f287)['json'](_0x554101);}};}function respondWithFilteredResult(_0x2ed4c6,_0x5a8952){return function(_0x4200c1){if(_0x4200c1){var _0x4ca5b2=typeof _0x5a8952[_0xa57c('0xf')]===_0xa57c('0x10')&&typeof _0x5a8952[_0xa57c('0x11')]==='undefined';var _0x2644a1=_0x4200c1['count'];var _0x30d23d=_0x4ca5b2?0x0:_0x5a8952[_0xa57c('0xf')];var _0x30940d=_0x4ca5b2?_0x4200c1[_0xa57c('0x12')]:_0x5a8952[_0xa57c('0xf')]+_0x5a8952[_0xa57c('0x11')];var _0x3f900a;if(_0x30940d>=_0x2644a1){_0x30940d=_0x2644a1;_0x3f900a=0xc8;}else{_0x3f900a=0xce;}_0x2ed4c6['status'](_0x3f900a);return _0x2ed4c6[_0xa57c('0x13')](_0xa57c('0x14'),_0x30d23d+'-'+_0x30940d+'/'+_0x2644a1)[_0xa57c('0x15')](_0x4200c1);}return null;};}function saveUpdates(_0x5a6024){return function(_0x2746a0){if(_0x2746a0){return _0x2746a0['update'](_0x5a6024)[_0xa57c('0x16')](function(_0x3d781d){return _0x3d781d;});}return null;};}function removeEntity(_0x93462c){return function(_0xe3d505){if(_0xe3d505){return _0xe3d505[_0xa57c('0x17')]()[_0xa57c('0x16')](function(){var _0x6f3f89=_0xe3d505[_0xa57c('0x18')]({'plain':!![]});var _0x4e4399=_0xa57c('0x19');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e4399,'resourceId':_0x6f3f89['id']}})[_0xa57c('0x16')](function(){return _0xe3d505;});})[_0xa57c('0x16')](function(){_0x93462c[_0xa57c('0xe')](0xcc)[_0xa57c('0x1a')]();});}};}function handleEntityNotFound(_0x49242c){return function(_0x348211){if(!_0x348211){_0x49242c[_0xa57c('0xd')](0x194);}return _0x348211;};}function handleError(_0x34d1bc,_0x2213b2){_0x2213b2=_0x2213b2||0x1f4;return function(_0x3bb969){logger[_0xa57c('0x1b')](_0x3bb969[_0xa57c('0x1c')]);if(_0x3bb969[_0xa57c('0x1d')]){delete _0x3bb969[_0xa57c('0x1d')];}_0x34d1bc[_0xa57c('0xe')](_0x2213b2)[_0xa57c('0x1e')](_0x3bb969);};}exports[_0xa57c('0x1f')]=function(_0x241dcc,_0x10a33d){var _0x431bec={};var _0x511a26={'count':0x0,'rows':[]};var _0x2db443=_[_0xa57c('0x20')](db[_0xa57c('0x21')][_0xa57c('0x22')],function(_0x315ad7){return{'name':_0x315ad7[_0xa57c('0x23')],'type':_0x315ad7[_0xa57c('0x24')][_0xa57c('0x25')]};});_0x431bec=qs[_0xa57c('0x26')](_0x2db443,_0x241dcc);var _0x1d59c2={'where':_0x431bec['where']};return db[_0xa57c('0x21')]['count'](_0x1d59c2)['then'](function(_0x257661){_0x511a26[_0xa57c('0x12')]=_0x257661;_0x431bec['include']=qs[_0xa57c('0x27')](_0x241dcc[_0xa57c('0x28')]);return db[_0xa57c('0x21')]['findAll'](_0x431bec);})[_0xa57c('0x16')](function(_0x58d46f){_0x511a26[_0xa57c('0x29')]=_0x58d46f;return _0x511a26;})['then'](respondWithFilteredResult(_0x10a33d,_0x431bec))[_0xa57c('0x2a')](handleError(_0x10a33d,null));};exports['show']=function(_0xd4c5d4,_0x532164){var _0x9e02bb={'raw':!![],'where':{'id':_0xd4c5d4[_0xa57c('0x2b')]['id']}},_0x1d82d9={};_0x1d82d9[_0xa57c('0x2c')]=_[_0xa57c('0x2d')](db[_0xa57c('0x21')][_0xa57c('0x22')]);_0x1d82d9['query']=_[_0xa57c('0x2d')](_0xd4c5d4['query']);_0x1d82d9[_0xa57c('0x2e')]=_[_0xa57c('0x2f')](_0x1d82d9[_0xa57c('0x2c')],_0x1d82d9['query']);_0x9e02bb[_0xa57c('0x30')]=_['intersection'](_0x1d82d9[_0xa57c('0x2c')],qs['fields'](_0xd4c5d4[_0xa57c('0x28')]['fields']));_0x9e02bb[_0xa57c('0x30')]=_0x9e02bb[_0xa57c('0x30')]['length']?_0x9e02bb[_0xa57c('0x30')]:_0x1d82d9['model'];if(_0xd4c5d4[_0xa57c('0x28')]['includeAll']){_0x9e02bb[_0xa57c('0x27')]=[{'all':!![]}];}_0x9e02bb=_[_0xa57c('0x31')]({},_0x9e02bb,_0xd4c5d4[_0xa57c('0x32')]);return db[_0xa57c('0x21')][_0xa57c('0x33')](_0x9e02bb)[_0xa57c('0x16')](handleEntityNotFound(_0x532164,null))['then'](respondWithResult(_0x532164,null))['catch'](handleError(_0x532164,null));};exports[_0xa57c('0x34')]=function(_0x13e390,_0x2c70d6){return db['FaxQueue'][_0xa57c('0x34')](_0x13e390['body'],{})[_0xa57c('0x16')](function(_0x4184f3){var _0x5c8256=_0x13e390['user']['get']({'plain':!![]});if(!_0x5c8256)throw new Error(_0xa57c('0x35'));if(_0x5c8256[_0xa57c('0x36')]===_0xa57c('0x37')){var _0x21e4df=_0x4184f3[_0xa57c('0x18')]({'plain':!![]});var _0x1b98a0='FaxQueues';return db[_0xa57c('0x38')][_0xa57c('0x33')]({'where':{'name':_0x1b98a0,'userProfileId':_0x5c8256['userProfileId']},'raw':!![]})['then'](function(_0x5e10b){if(_0x5e10b&&_0x5e10b[_0xa57c('0x39')]===0x0){return db['UserProfileResource'][_0xa57c('0x34')]({'name':_0x21e4df[_0xa57c('0x1d')],'resourceId':_0x21e4df['id'],'type':_0x5e10b[_0xa57c('0x1d')],'sectionId':_0x5e10b['id']},{})[_0xa57c('0x16')](function(){return _0x4184f3;});}else{return _0x4184f3;}})[_0xa57c('0x2a')](function(_0x43c1d7){logger['error'](_0xa57c('0x3a'),_0x43c1d7);throw _0x43c1d7;});}return _0x4184f3;})['then'](respondWithResult(_0x2c70d6,0xc9))['catch'](handleError(_0x2c70d6,null));};exports['update']=function(_0x520383,_0x588199){if(_0x520383[_0xa57c('0x3b')]['id']){delete _0x520383[_0xa57c('0x3b')]['id'];}return db[_0xa57c('0x21')]['find']({'where':{'id':_0x520383['params']['id']}})['then'](handleEntityNotFound(_0x588199,null))[_0xa57c('0x16')](saveUpdates(_0x520383[_0xa57c('0x3b')],null))[_0xa57c('0x16')](respondWithResult(_0x588199,null))[_0xa57c('0x2a')](handleError(_0x588199,null));};exports[_0xa57c('0x17')]=function(_0x17c5dd,_0x48d2a7){return db[_0xa57c('0x21')][_0xa57c('0x33')]({'where':{'id':_0x17c5dd[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](handleEntityNotFound(_0x48d2a7,null))[_0xa57c('0x16')](removeEntity(_0x48d2a7,null))[_0xa57c('0x2a')](handleError(_0x48d2a7,null));};exports['describe']=function(_0x246f84,_0xcf1c29){return db[_0xa57c('0x21')][_0xa57c('0x3c')]()[_0xa57c('0x16')](respondWithResult(_0xcf1c29,null))['catch'](handleError(_0xcf1c29,null));};exports[_0xa57c('0x3d')]=function(_0x13ede7,_0xa18f64){var _0x17aae4={'raw':!![],'where':{}},_0x7ba8ab={},_0x11fccc;return db['FaxQueue'][_0xa57c('0x3e')]({'where':{'id':_0x13ede7[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](handleEntityNotFound(_0xa18f64,null))[_0xa57c('0x16')](function(_0x2ea6af){if(_0x2ea6af){_0x11fccc=_0x2ea6af[_0xa57c('0x18')]({'plain':!![]});_0x7ba8ab['model']=_['keys'](db['UserFaxQueue']['rawAttributes']);_0x7ba8ab[_0xa57c('0x28')]=_['keys'](_0x13ede7[_0xa57c('0x28')]);_0x7ba8ab[_0xa57c('0x2e')]=_['intersection'](_0x7ba8ab[_0xa57c('0x2c')],_0x7ba8ab[_0xa57c('0x28')]);_0x17aae4[_0xa57c('0x30')]=_[_0xa57c('0x2f')](_0x7ba8ab[_0xa57c('0x2c')],qs['fields'](_0x13ede7[_0xa57c('0x28')][_0xa57c('0x3f')]));_0x17aae4[_0xa57c('0x30')]=_0x17aae4[_0xa57c('0x30')][_0xa57c('0x40')]?_0x17aae4['attributes']:_0x7ba8ab[_0xa57c('0x2c')];if(!_0x13ede7['query']['hasOwnProperty'](_0xa57c('0x41'))){_0x17aae4[_0xa57c('0x11')]=qs[_0xa57c('0x11')](_0x13ede7['query']['limit']);_0x17aae4[_0xa57c('0xf')]=qs[_0xa57c('0xf')](_0x13ede7[_0xa57c('0x28')][_0xa57c('0xf')]);}_0x17aae4['order']=qs[_0xa57c('0x42')](_0x13ede7[_0xa57c('0x28')][_0xa57c('0x42')]);_0x17aae4['where']=qs['filters'](_[_0xa57c('0x43')](_0x13ede7[_0xa57c('0x28')],_0x7ba8ab['filters']));_0x17aae4[_0xa57c('0x44')][_0xa57c('0x45')]=_0x2ea6af['id'];if(_0x13ede7[_0xa57c('0x28')][_0xa57c('0x46')]){_0x17aae4[_0xa57c('0x44')]=_[_0xa57c('0x31')](_0x17aae4[_0xa57c('0x44')],{'$or':_['map'](_0x17aae4['attributes'],function(_0x2f93fd){var _0x14f3d6={};_0x14f3d6[_0x2f93fd]={'$like':'%'+_0x13ede7[_0xa57c('0x28')][_0xa57c('0x46')]+'%'};return _0x14f3d6;})});}_0x17aae4=_[_0xa57c('0x31')]({},_0x17aae4,_0x13ede7[_0xa57c('0x32')]);return db[_0xa57c('0x47')][_0xa57c('0x48')](_0x17aae4);}})['then'](function(_0x4da028){if(_0x4da028){return db[_0xa57c('0x49')]['findAndCountAll']({'where':{'id':_[_0xa57c('0x20')](_0x4da028,_0xa57c('0x4a')),'role':_0xa57c('0x4b')},'attributes':['id','name',_0xa57c('0x4c'),'updatedAt',_0xa57c('0x4d')]});}})['then'](function(_0x39484d){if(_0x39484d){return{'count':_0x39484d[_0xa57c('0x12')],'rows':_[_0xa57c('0x20')](_0x39484d[_0xa57c('0x29')],function(_0x4c192d){return{'membername':_0x4c192d[_0xa57c('0x1d')],'UserId':_0x4c192d['id'],'queue_name':_0x11fccc[_0xa57c('0x1d')],'FaxQueueId':_0x11fccc['id'],'interface':util[_0xa57c('0x4e')](_0xa57c('0x4f'),_0xa57c('0x50'),_0x4c192d['name']),'penalty':0x0,'paused':_0x4c192d[_0xa57c('0x4c')],'createdAt':_0x4c192d[_0xa57c('0x4d')],'updatedAt':_0x4c192d[_0xa57c('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa57c('0x16')](respondWithFilteredResult(_0xa18f64,_0x17aae4))[_0xa57c('0x2a')](handleError(_0xa18f64,null));};exports[_0xa57c('0x52')]=function(_0x143ec3,_0x419527){var _0x3424a7={};var _0x41041f={};var _0x5a046e;var _0x261c99;return db[_0xa57c('0x21')][_0xa57c('0x3e')]({'where':{'id':_0x143ec3[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](handleEntityNotFound(_0x419527,null))[_0xa57c('0x16')](function(_0x5440c2){if(_0x5440c2){_0x5a046e=_0x5440c2;_0x41041f[_0xa57c('0x2c')]=_[_0xa57c('0x2d')](db['Team'][_0xa57c('0x22')]);_0x41041f[_0xa57c('0x28')]=_[_0xa57c('0x2d')](_0x143ec3[_0xa57c('0x28')]);_0x41041f[_0xa57c('0x2e')]=_[_0xa57c('0x2f')](_0x41041f[_0xa57c('0x2c')],_0x41041f['query']);_0x3424a7[_0xa57c('0x30')]=_['intersection'](_0x41041f[_0xa57c('0x2c')],qs['fields'](_0x143ec3[_0xa57c('0x28')]['fields']));_0x3424a7[_0xa57c('0x30')]=_0x3424a7[_0xa57c('0x30')]['length']?_0x3424a7[_0xa57c('0x30')]:_0x41041f[_0xa57c('0x2c')];_0x3424a7[_0xa57c('0x53')]=qs[_0xa57c('0x42')](_0x143ec3['query'][_0xa57c('0x42')]);_0x3424a7[_0xa57c('0x44')]=qs[_0xa57c('0x2e')](_[_0xa57c('0x43')](_0x143ec3[_0xa57c('0x28')],_0x41041f[_0xa57c('0x2e')]));if(_0x143ec3[_0xa57c('0x28')][_0xa57c('0x46')]){_0x3424a7[_0xa57c('0x44')]=_[_0xa57c('0x31')](_0x3424a7[_0xa57c('0x44')],{'$or':_[_0xa57c('0x20')](_0x3424a7[_0xa57c('0x30')],function(_0x83e9c7){var _0x23552a={};_0x23552a[_0x83e9c7]={'$like':'%'+_0x143ec3[_0xa57c('0x28')]['filter']+'%'};return _0x23552a;})});}_0x3424a7=_[_0xa57c('0x31')]({},_0x3424a7,_0x143ec3['options']);return _0x5a046e[_0xa57c('0x52')](_0x3424a7);}})[_0xa57c('0x16')](function(_0x245238){if(_0x245238){_0x261c99=_0x245238['length'];if(!_0x143ec3[_0xa57c('0x28')][_0xa57c('0x54')](_0xa57c('0x41'))){_0x3424a7['limit']=qs['limit'](_0x143ec3[_0xa57c('0x28')][_0xa57c('0x11')]);_0x3424a7[_0xa57c('0xf')]=qs[_0xa57c('0xf')](_0x143ec3[_0xa57c('0x28')][_0xa57c('0xf')]);}return _0x5a046e[_0xa57c('0x52')](_0x3424a7);}})[_0xa57c('0x16')](function(_0x37cbaf){if(_0x37cbaf){return _0x37cbaf?{'count':_0x261c99,'rows':_0x37cbaf}:null;}})['then'](respondWithResult(_0x419527,null))[_0xa57c('0x2a')](handleError(_0x419527,null));};exports[_0xa57c('0x55')]=function(_0x55f526,_0x2e37d7){var _0x1df5f6=_0x55f526[_0xa57c('0x3b')][_0xa57c('0x56')];return db[_0xa57c('0x57')][_0xa57c('0x48')]({'where':{'id':_0x1df5f6},'attributes':['id'],'include':[{'model':db[_0xa57c('0x49')],'as':_0xa57c('0x58'),'attributes':['id','name',_0xa57c('0x59'),_0xa57c('0x5a'),'interface'],'raw':!![]}]})[_0xa57c('0x16')](function(_0x4a74d7){if(_0x4a74d7){var _0x5454cb=_['flatMap'](_0x4a74d7,function(_0x30dac7){var _0x3a5e2d=_0x30dac7[_0xa57c('0x18')]({'plain':!![]});return _0x3a5e2d[_0xa57c('0x58')];});return db[_0xa57c('0x21')]['find']({'where':{'id':_0x55f526[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](function(_0x2fd797){return db['sequelize'][_0xa57c('0x5b')](function(_0x5a3611){return _0x2fd797[_0xa57c('0x55')](_0x1df5f6,{'transaction':_0x5a3611})[_0xa57c('0x16')](function(){return BPromise[_0xa57c('0x5c')](_0x5454cb,function(_0x2bd081){return db['UserFaxQueue'][_0xa57c('0x5d')]({'where':{'UserId':_0x2bd081['id'],'FaxQueueId':_0x55f526[_0xa57c('0x2b')]['id']},'transaction':_0x5a3611});});})[_0xa57c('0x16')](function(){_0x5454cb[_0xa57c('0x5e')](function(_0x5b0ce6){socket[_0xa57c('0x5f')](_0xa57c('0x60'),{'UserId':_0x5b0ce6['id'],'FaxQueueId':_0x2fd797['id']});});});});});}})[_0xa57c('0x16')](respondWithStatusCode(_0x2e37d7,null))['catch'](handleError(_0x2e37d7,null));};exports[_0xa57c('0x61')]=function(_0x448afd,_0x2ed4f4){return db['Team'][_0xa57c('0x48')]({'where':{'id':_0x448afd[_0xa57c('0x28')][_0xa57c('0x56')]},'attributes':['id'],'include':[{'model':db[_0xa57c('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa57c('0x16')](handleEntityNotFound(_0x2ed4f4,null))[_0xa57c('0x16')](function(_0x5c92ec){var _0x2dac12=_[_0xa57c('0x20')](_0x5c92ec,'id');var _0x59d2a2=[];var _0x29a4e0=[];var _0x4d4524=squel[_0xa57c('0x62')]();_0x4d4524[_0xa57c('0x63')](_0xa57c('0x64'))[_0xa57c('0x65')]('team_has_fax_queues','tq')[_0xa57c('0x66')](_0xa57c('0x67'),'ut',_0xa57c('0x68'))[_0xa57c('0x44')](_0xa57c('0x69'),_0x448afd[_0xa57c('0x2b')]['id']);for(var _0x18b36e=0x0;_0x18b36e<_0x5c92ec[_0xa57c('0x40')];_0x18b36e+=0x1){let _0x1129f=_0x5c92ec[_0x18b36e];for(var _0x2c4e6c=0x0;_0x2c4e6c<_0x1129f[_0xa57c('0x58')]['length'];_0x2c4e6c+=0x1){let _0x488c35=_0x1129f['Agents'][_0x2c4e6c];var _0x29b491=_0x4d4524['clone']();_0x29b491[_0xa57c('0x44')](_0xa57c('0x6a'),_0x488c35['id']);_0x29a4e0[_0xa57c('0x6b')](db['sequelize'][_0xa57c('0x28')](_0x29b491[_0xa57c('0x6c')](),{'type':db[_0xa57c('0x6d')][_0xa57c('0x6e')][_0xa57c('0x6f')]})[_0xa57c('0x16')](function(_0x1cde94){if(_0x1cde94['length']===0x1){return _0x488c35['id'];}else{var _0xcebd5e=_[_0xa57c('0x70')](_['map'](_0x1cde94,'TeamId'),function(_0x1d0d13){return _[_0xa57c('0x71')](_0x2dac12,_0x1d0d13);});if(_0xcebd5e){return _0x488c35['id'];}}}));}}return BPromise['all'](_0x29a4e0)['then'](function(_0xc5f17e){_0x59d2a2=_(_0x59d2a2)['union'](_0xc5f17e)[_0xa57c('0x72')]()[_0xa57c('0x73')]();return db['FaxQueue'][_0xa57c('0x33')]({'where':{'id':_0x448afd[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](function(_0x3df8f5){return db[_0xa57c('0x6d')]['transaction'](function(_0x17fc78){return _0x3df8f5['removeTeams'](_0x448afd[_0xa57c('0x28')][_0xa57c('0x56')],{'transaction':_0x17fc78})['then'](function(){if(!_['isEmpty'](_0x59d2a2)){return _0x3df8f5['removeAgents'](_0x59d2a2,{'transaction':_0x17fc78});}})[_0xa57c('0x16')](function(){_0x59d2a2['forEach'](function(_0x502309){socket[_0xa57c('0x5f')](_0xa57c('0x74'),{'UserId':_0x502309,'FaxQueueId':_0x3df8f5['id']});});});});});});})[_0xa57c('0x16')](respondWithStatusCode(_0x2ed4f4,null))['catch'](handleError(_0x2ed4f4,null));};exports[_0xa57c('0x75')]=function(_0x1f28e9,_0x11e592){return db['FaxQueue']['find']({'where':{'id':_0x1f28e9[_0xa57c('0x2b')]['id']}})['then'](handleEntityNotFound(_0x11e592,null))[_0xa57c('0x16')](function(_0x41d535){if(_0x41d535){return _0x41d535['addAgents'](_0x1f28e9[_0xa57c('0x3b')]['ids'],_['omit'](_0x1f28e9['body'],[_0xa57c('0x56'),'id'])||{})['spread'](function(_0x5143c0){for(var _0x542194=0x0;_0x542194<_0x1f28e9[_0xa57c('0x3b')][_0xa57c('0x56')]['length'];_0x542194+=0x1){socket[_0xa57c('0x5f')](_0xa57c('0x60'),{'UserId':Number(_0x1f28e9[_0xa57c('0x3b')]['ids'][_0x542194]),'FaxQueueId':Number(_0x1f28e9[_0xa57c('0x2b')]['id'])});}return _0x5143c0;});}})[_0xa57c('0x16')](respondWithResult(_0x11e592,null))[_0xa57c('0x2a')](handleError(_0x11e592,null));};exports[_0xa57c('0x76')]=function(_0x54bf3d,_0x5e0db8){return db[_0xa57c('0x21')]['find']({'where':{'id':_0x54bf3d[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](handleEntityNotFound(_0x5e0db8,null))[_0xa57c('0x16')](function(_0x4dc6ac){if(_0x4dc6ac){return _0x4dc6ac[_0xa57c('0x76')](_0x54bf3d['query']['ids'])[_0xa57c('0x16')](function(){if(_['isArray'](_0x54bf3d[_0xa57c('0x28')][_0xa57c('0x56')])){for(var _0x536e87=0x0;_0x536e87<_0x54bf3d['query'][_0xa57c('0x56')][_0xa57c('0x40')];_0x536e87+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x54bf3d[_0xa57c('0x28')][_0xa57c('0x56')][_0x536e87]),'FaxQueueId':Number(_0x54bf3d[_0xa57c('0x2b')]['id'])});}}else{socket['emit'](_0xa57c('0x74'),{'UserId':Number(_0x54bf3d[_0xa57c('0x28')][_0xa57c('0x56')]),'FaxQueueId':Number(_0x54bf3d[_0xa57c('0x2b')]['id'])});}});}})[_0xa57c('0x16')](respondWithStatusCode(_0x5e0db8,null))[_0xa57c('0x2a')](handleError(_0x5e0db8,null));};exports[_0xa57c('0x77')]=function(_0x4133f7,_0x39e5d6){var _0x75888e={};var _0x46b223={};var _0x2fa5fe;var _0x3c82d7;return db['FaxQueue'][_0xa57c('0x3e')]({'where':{'id':_0x4133f7[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](handleEntityNotFound(_0x39e5d6,null))[_0xa57c('0x16')](function(_0x159b00){if(_0x159b00){_0x2fa5fe=_0x159b00;_0x46b223[_0xa57c('0x2c')]=_['keys'](db['User'][_0xa57c('0x22')]);_0x46b223['query']=_['keys'](_0x4133f7[_0xa57c('0x28')]);_0x46b223[_0xa57c('0x2e')]=_[_0xa57c('0x2f')](_0x46b223['model'],_0x46b223[_0xa57c('0x28')]);_0x75888e[_0xa57c('0x30')]=_[_0xa57c('0x2f')](_0x46b223[_0xa57c('0x2c')],qs[_0xa57c('0x3f')](_0x4133f7['query']['fields']));_0x75888e[_0xa57c('0x30')]=_0x75888e[_0xa57c('0x30')][_0xa57c('0x40')]?_0x75888e['attributes']:_0x46b223[_0xa57c('0x2c')];_0x75888e['order']=qs[_0xa57c('0x42')](_0x4133f7[_0xa57c('0x28')][_0xa57c('0x42')]);_0x75888e[_0xa57c('0x44')]=qs[_0xa57c('0x2e')](_[_0xa57c('0x43')](_0x4133f7[_0xa57c('0x28')],_0x46b223['filters']));if(_0x4133f7['query'][_0xa57c('0x46')]){_0x75888e[_0xa57c('0x44')]=_[_0xa57c('0x31')](_0x75888e['where'],{'$or':_['map'](_0x75888e[_0xa57c('0x30')],function(_0xfff76a){var _0x169e6a={};_0x169e6a[_0xfff76a]={'$like':'%'+_0x4133f7[_0xa57c('0x28')][_0xa57c('0x46')]+'%'};return _0x169e6a;})});}_0x75888e=_['merge']({},_0x75888e,_0x4133f7[_0xa57c('0x32')]);return _0x2fa5fe[_0xa57c('0x77')](_0x75888e);}})[_0xa57c('0x16')](function(_0x5dd496){if(_0x5dd496){_0x3c82d7=_0x5dd496[_0xa57c('0x40')];if(!_0x4133f7[_0xa57c('0x28')]['hasOwnProperty'](_0xa57c('0x41'))){_0x75888e[_0xa57c('0x11')]=qs[_0xa57c('0x11')](_0x4133f7[_0xa57c('0x28')][_0xa57c('0x11')]);_0x75888e[_0xa57c('0xf')]=qs[_0xa57c('0xf')](_0x4133f7[_0xa57c('0x28')][_0xa57c('0xf')]);}return _0x2fa5fe['getAgents'](_0x75888e);}})[_0xa57c('0x16')](function(_0x56121){if(_0x56121){return _0x56121?{'count':_0x3c82d7,'rows':_0x56121}:null;}})[_0xa57c('0x16')](respondWithResult(_0x39e5d6,null))[_0xa57c('0x2a')](handleError(_0x39e5d6,null));}; \ No newline at end of file +var _0x398a=['sequelize','transaction','each','UserFaxQueue','findOrCreate','forEach','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','emit','getAgents','options','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','get','name','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','rows','catch','show','params','model','keys','query','filters','attributes','fields','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','pick','FaxQueueId','filter','merge','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','SIP','getTeams','Team','order','sort','addTeams','ids','online','voicePause','flatMap','Agents'];(function(_0x3a1b66,_0x23203c){var _0x217090=function(_0x308d14){while(--_0x308d14){_0x3a1b66['push'](_0x3a1b66['shift']());}};_0x217090(++_0x23203c);}(_0x398a,0x11a));var _0xa398=function(_0x20f096,_0x2e9316){_0x20f096=_0x20f096-0x0;var _0x2e6177=_0x398a[_0x20f096];return _0x2e6177;};'use strict';var BPromise=require(_0xa398('0x0'));var util=require(_0xa398('0x1'));var _=require(_0xa398('0x2'));var squel=require(_0xa398('0x3'));var Redis=require(_0xa398('0x4'));var qs=require(_0xa398('0x5'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xa398('0x6'))['db'];config[_0xa398('0x7')]=_[_0xa398('0x8')](config[_0xa398('0x7')],{'host':_0xa398('0x9'),'port':0x18eb});var socket=require(_0xa398('0xa'))(new Redis(config[_0xa398('0x7')]));require(_0xa398('0xb'))[_0xa398('0xc')](socket);function respondWithStatusCode(_0x2e26f0,_0x57a449){_0x57a449=_0x57a449||0xcc;return function(_0x32a539){if(_0x32a539){return _0x2e26f0[_0xa398('0xd')](_0x57a449);}return _0x2e26f0[_0xa398('0xe')](_0x57a449)[_0xa398('0xf')]();};}function respondWithResult(_0x1025c8,_0xf248f5){_0xf248f5=_0xf248f5||0xc8;return function(_0x3ccd2c){if(_0x3ccd2c){return _0x1025c8['status'](_0xf248f5)[_0xa398('0x10')](_0x3ccd2c);}};}function respondWithFilteredResult(_0x35fc22,_0x22ac95){return function(_0x7cb233){if(_0x7cb233){var _0xfb8694=typeof _0x22ac95[_0xa398('0x11')]===_0xa398('0x12')&&typeof _0x22ac95[_0xa398('0x13')]==='undefined';var _0x19cf87=_0x7cb233[_0xa398('0x14')];var _0x316587=_0xfb8694?0x0:_0x22ac95[_0xa398('0x11')];var _0xb2345f=_0xfb8694?_0x7cb233[_0xa398('0x14')]:_0x22ac95[_0xa398('0x11')]+_0x22ac95[_0xa398('0x13')];var _0x483dbf;if(_0xb2345f>=_0x19cf87){_0xb2345f=_0x19cf87;_0x483dbf=0xc8;}else{_0x483dbf=0xce;}_0x35fc22[_0xa398('0xe')](_0x483dbf);return _0x35fc22[_0xa398('0x15')]('Content-Range',_0x316587+'-'+_0xb2345f+'/'+_0x19cf87)[_0xa398('0x10')](_0x7cb233);}return null;};}function saveUpdates(_0x42a001){return function(_0x36da88){if(_0x36da88){return _0x36da88[_0xa398('0x16')](_0x42a001)[_0xa398('0x17')](function(_0x144c1f){return _0x144c1f;});}return null;};}function removeEntity(_0x2d7a48){return function(_0x10fa7f){if(_0x10fa7f){return _0x10fa7f[_0xa398('0x18')]()[_0xa398('0x17')](function(){var _0x5b280c=_0x10fa7f[_0xa398('0x19')]({'plain':!![]});var _0x47b12f='FaxQueues';return db['UserProfileResource'][_0xa398('0x18')]({'where':{'type':_0x47b12f,'resourceId':_0x5b280c['id']}})['then'](function(){return _0x10fa7f;});})[_0xa398('0x17')](function(){_0x2d7a48[_0xa398('0xe')](0xcc)[_0xa398('0xf')]();});}};}function handleEntityNotFound(_0x13b3f8){return function(_0x37203c){if(!_0x37203c){_0x13b3f8['sendStatus'](0x194);}return _0x37203c;};}function handleError(_0x46ab19,_0x550e75){_0x550e75=_0x550e75||0x1f4;return function(_0x5824f4){logger['error'](_0x5824f4['stack']);if(_0x5824f4[_0xa398('0x1a')]){delete _0x5824f4[_0xa398('0x1a')];}_0x46ab19[_0xa398('0xe')](_0x550e75)['send'](_0x5824f4);};}exports[_0xa398('0x1b')]=function(_0x104bfe,_0x2da10f){var _0x44692d={};var _0x47df2a={'count':0x0,'rows':[]};var _0x311a77=_[_0xa398('0x1c')](db[_0xa398('0x1d')][_0xa398('0x1e')],function(_0x7d1e04){return{'name':_0x7d1e04[_0xa398('0x1f')],'type':_0x7d1e04[_0xa398('0x20')][_0xa398('0x21')]};});_0x44692d=qs[_0xa398('0x22')](_0x311a77,_0x104bfe);var _0x5b719e={'where':_0x44692d[_0xa398('0x23')]};return db[_0xa398('0x1d')][_0xa398('0x14')](_0x5b719e)[_0xa398('0x17')](function(_0x1cbe2f){_0x47df2a[_0xa398('0x14')]=_0x1cbe2f;_0x44692d['include']=qs[_0xa398('0x24')](_0x104bfe['query']);return db[_0xa398('0x1d')]['findAll'](_0x44692d);})[_0xa398('0x17')](function(_0xbb3509){_0x47df2a[_0xa398('0x25')]=_0xbb3509;return _0x47df2a;})[_0xa398('0x17')](respondWithFilteredResult(_0x2da10f,_0x44692d))[_0xa398('0x26')](handleError(_0x2da10f,null));};exports[_0xa398('0x27')]=function(_0x4ead1d,_0x18fea8){var _0x3eca1d={'raw':!![],'where':{'id':_0x4ead1d[_0xa398('0x28')]['id']}},_0x390204={};_0x390204[_0xa398('0x29')]=_[_0xa398('0x2a')](db[_0xa398('0x1d')]['rawAttributes']);_0x390204[_0xa398('0x2b')]=_[_0xa398('0x2a')](_0x4ead1d[_0xa398('0x2b')]);_0x390204[_0xa398('0x2c')]=_['intersection'](_0x390204[_0xa398('0x29')],_0x390204[_0xa398('0x2b')]);_0x3eca1d[_0xa398('0x2d')]=_['intersection'](_0x390204[_0xa398('0x29')],qs[_0xa398('0x2e')](_0x4ead1d[_0xa398('0x2b')][_0xa398('0x2e')]));_0x3eca1d[_0xa398('0x2d')]=_0x3eca1d[_0xa398('0x2d')][_0xa398('0x2f')]?_0x3eca1d['attributes']:_0x390204[_0xa398('0x29')];if(_0x4ead1d['query'][_0xa398('0x30')]){_0x3eca1d['include']=[{'all':!![]}];}_0x3eca1d=_['merge']({},_0x3eca1d,_0x4ead1d['options']);return db['FaxQueue'][_0xa398('0x31')](_0x3eca1d)[_0xa398('0x17')](handleEntityNotFound(_0x18fea8,null))[_0xa398('0x17')](respondWithResult(_0x18fea8,null))[_0xa398('0x26')](handleError(_0x18fea8,null));};exports[_0xa398('0x32')]=function(_0xf860c0,_0xef4e9e){return db[_0xa398('0x1d')]['create'](_0xf860c0[_0xa398('0x33')],{})[_0xa398('0x17')](function(_0x16d3d5){var _0x8859a8=_0xf860c0['user'][_0xa398('0x19')]({'plain':!![]});if(!_0x8859a8)throw new Error(_0xa398('0x34'));if(_0x8859a8['role']===_0xa398('0x35')){var _0x44a51e=_0x16d3d5[_0xa398('0x19')]({'plain':!![]});var _0x92a4dd='FaxQueues';return db[_0xa398('0x36')][_0xa398('0x31')]({'where':{'name':_0x92a4dd,'userProfileId':_0x8859a8[_0xa398('0x37')]},'raw':!![]})['then'](function(_0x2eb748){if(_0x2eb748&&_0x2eb748[_0xa398('0x38')]===0x0){return db['UserProfileResource'][_0xa398('0x32')]({'name':_0x44a51e[_0xa398('0x1a')],'resourceId':_0x44a51e['id'],'type':_0x2eb748['name'],'sectionId':_0x2eb748['id']},{})[_0xa398('0x17')](function(){return _0x16d3d5;});}else{return _0x16d3d5;}})[_0xa398('0x26')](function(_0x31e4bb){logger[_0xa398('0x39')](_0xa398('0x3a'),_0x31e4bb);throw _0x31e4bb;});}return _0x16d3d5;})[_0xa398('0x17')](respondWithResult(_0xef4e9e,0xc9))['catch'](handleError(_0xef4e9e,null));};exports[_0xa398('0x16')]=function(_0x184feb,_0x2eb0c6){if(_0x184feb[_0xa398('0x33')]['id']){delete _0x184feb[_0xa398('0x33')]['id'];}return db[_0xa398('0x1d')][_0xa398('0x31')]({'where':{'id':_0x184feb['params']['id']}})['then'](handleEntityNotFound(_0x2eb0c6,null))[_0xa398('0x17')](saveUpdates(_0x184feb[_0xa398('0x33')],null))[_0xa398('0x17')](respondWithResult(_0x2eb0c6,null))[_0xa398('0x26')](handleError(_0x2eb0c6,null));};exports[_0xa398('0x18')]=function(_0xae8b9a,_0x59847e){return db['FaxQueue'][_0xa398('0x31')]({'where':{'id':_0xae8b9a['params']['id']}})[_0xa398('0x17')](handleEntityNotFound(_0x59847e,null))['then'](removeEntity(_0x59847e,null))[_0xa398('0x26')](handleError(_0x59847e,null));};exports[_0xa398('0x3b')]=function(_0x56c6d5,_0x2a4c9d){return db[_0xa398('0x1d')][_0xa398('0x3b')]()[_0xa398('0x17')](respondWithResult(_0x2a4c9d,null))[_0xa398('0x26')](handleError(_0x2a4c9d,null));};exports[_0xa398('0x3c')]=function(_0x4fcdaf,_0x5c1d35){var _0x5587a2={'raw':!![],'where':{}},_0xc6841d={},_0x256af5;return db['FaxQueue'][_0xa398('0x3d')]({'where':{'id':_0x4fcdaf[_0xa398('0x28')]['id']}})[_0xa398('0x17')](handleEntityNotFound(_0x5c1d35,null))['then'](function(_0x837dc){if(_0x837dc){_0x256af5=_0x837dc[_0xa398('0x19')]({'plain':!![]});_0xc6841d[_0xa398('0x29')]=_['keys'](db['UserFaxQueue']['rawAttributes']);_0xc6841d[_0xa398('0x2b')]=_['keys'](_0x4fcdaf[_0xa398('0x2b')]);_0xc6841d[_0xa398('0x2c')]=_[_0xa398('0x3e')](_0xc6841d[_0xa398('0x29')],_0xc6841d['query']);_0x5587a2[_0xa398('0x2d')]=_[_0xa398('0x3e')](_0xc6841d[_0xa398('0x29')],qs['fields'](_0x4fcdaf['query']['fields']));_0x5587a2[_0xa398('0x2d')]=_0x5587a2[_0xa398('0x2d')]['length']?_0x5587a2[_0xa398('0x2d')]:_0xc6841d['model'];if(!_0x4fcdaf[_0xa398('0x2b')][_0xa398('0x3f')](_0xa398('0x40'))){_0x5587a2['limit']=qs[_0xa398('0x13')](_0x4fcdaf['query'][_0xa398('0x13')]);_0x5587a2[_0xa398('0x11')]=qs[_0xa398('0x11')](_0x4fcdaf[_0xa398('0x2b')]['offset']);}_0x5587a2['order']=qs['sort'](_0x4fcdaf[_0xa398('0x2b')]['sort']);_0x5587a2[_0xa398('0x23')]=qs['filters'](_[_0xa398('0x41')](_0x4fcdaf[_0xa398('0x2b')],_0xc6841d[_0xa398('0x2c')]));_0x5587a2[_0xa398('0x23')][_0xa398('0x42')]=_0x837dc['id'];if(_0x4fcdaf[_0xa398('0x2b')][_0xa398('0x43')]){_0x5587a2['where']=_[_0xa398('0x44')](_0x5587a2['where'],{'$or':_[_0xa398('0x1c')](_0x5587a2[_0xa398('0x2d')],function(_0x14a23e){var _0x582a76={};_0x582a76[_0x14a23e]={'$like':'%'+_0x4fcdaf[_0xa398('0x2b')][_0xa398('0x43')]+'%'};return _0x582a76;})});}_0x5587a2=_[_0xa398('0x44')]({},_0x5587a2,_0x4fcdaf['options']);return db['UserFaxQueue'][_0xa398('0x45')](_0x5587a2);}})[_0xa398('0x17')](function(_0x1a9cf7){if(_0x1a9cf7){return db[_0xa398('0x46')][_0xa398('0x47')]({'where':{'id':_['map'](_0x1a9cf7,_0xa398('0x48')),'role':_0xa398('0x49')},'attributes':['id',_0xa398('0x1a'),_0xa398('0x4a'),_0xa398('0x4b'),'createdAt']});}})[_0xa398('0x17')](function(_0x211b82){if(_0x211b82){return{'count':_0x211b82[_0xa398('0x14')],'rows':_[_0xa398('0x1c')](_0x211b82[_0xa398('0x25')],function(_0x3ff281){return{'membername':_0x3ff281[_0xa398('0x1a')],'UserId':_0x3ff281['id'],'queue_name':_0x256af5[_0xa398('0x1a')],'FaxQueueId':_0x256af5['id'],'interface':util['format']('%s/%s',_0xa398('0x4c'),_0x3ff281[_0xa398('0x1a')]),'penalty':0x0,'paused':_0x3ff281[_0xa398('0x4a')],'createdAt':_0x3ff281['createdAt'],'updatedAt':_0x3ff281[_0xa398('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa398('0x17')](respondWithFilteredResult(_0x5c1d35,_0x5587a2))[_0xa398('0x26')](handleError(_0x5c1d35,null));};exports[_0xa398('0x4d')]=function(_0x2aac08,_0x39f87c){var _0x4f348b={};var _0x151386={};var _0x216309;var _0x5ee10f;return db[_0xa398('0x1d')]['findOne']({'where':{'id':_0x2aac08[_0xa398('0x28')]['id']}})['then'](handleEntityNotFound(_0x39f87c,null))['then'](function(_0x4cb9a9){if(_0x4cb9a9){_0x216309=_0x4cb9a9;_0x151386[_0xa398('0x29')]=_['keys'](db[_0xa398('0x4e')][_0xa398('0x1e')]);_0x151386[_0xa398('0x2b')]=_[_0xa398('0x2a')](_0x2aac08['query']);_0x151386[_0xa398('0x2c')]=_[_0xa398('0x3e')](_0x151386[_0xa398('0x29')],_0x151386[_0xa398('0x2b')]);_0x4f348b[_0xa398('0x2d')]=_[_0xa398('0x3e')](_0x151386[_0xa398('0x29')],qs[_0xa398('0x2e')](_0x2aac08[_0xa398('0x2b')]['fields']));_0x4f348b[_0xa398('0x2d')]=_0x4f348b[_0xa398('0x2d')][_0xa398('0x2f')]?_0x4f348b[_0xa398('0x2d')]:_0x151386[_0xa398('0x29')];_0x4f348b[_0xa398('0x4f')]=qs[_0xa398('0x50')](_0x2aac08[_0xa398('0x2b')]['sort']);_0x4f348b[_0xa398('0x23')]=qs[_0xa398('0x2c')](_['pick'](_0x2aac08[_0xa398('0x2b')],_0x151386[_0xa398('0x2c')]));if(_0x2aac08['query'][_0xa398('0x43')]){_0x4f348b[_0xa398('0x23')]=_[_0xa398('0x44')](_0x4f348b['where'],{'$or':_[_0xa398('0x1c')](_0x4f348b[_0xa398('0x2d')],function(_0x5b2a40){var _0xb3195f={};_0xb3195f[_0x5b2a40]={'$like':'%'+_0x2aac08[_0xa398('0x2b')][_0xa398('0x43')]+'%'};return _0xb3195f;})});}_0x4f348b=_[_0xa398('0x44')]({},_0x4f348b,_0x2aac08['options']);return _0x216309[_0xa398('0x4d')](_0x4f348b);}})[_0xa398('0x17')](function(_0x3baf8a){if(_0x3baf8a){_0x5ee10f=_0x3baf8a['length'];if(!_0x2aac08[_0xa398('0x2b')]['hasOwnProperty'](_0xa398('0x40'))){_0x4f348b['limit']=qs[_0xa398('0x13')](_0x2aac08[_0xa398('0x2b')]['limit']);_0x4f348b[_0xa398('0x11')]=qs['offset'](_0x2aac08[_0xa398('0x2b')][_0xa398('0x11')]);}return _0x216309['getTeams'](_0x4f348b);}})[_0xa398('0x17')](function(_0x101742){if(_0x101742){return _0x101742?{'count':_0x5ee10f,'rows':_0x101742}:null;}})[_0xa398('0x17')](respondWithResult(_0x39f87c,null))[_0xa398('0x26')](handleError(_0x39f87c,null));};exports[_0xa398('0x51')]=function(_0x594858,_0xdded5e){var _0x4446f6=_0x594858[_0xa398('0x33')][_0xa398('0x52')];return db[_0xa398('0x4e')][_0xa398('0x45')]({'where':{'id':_0x4446f6},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa398('0x1a'),_0xa398('0x53'),_0xa398('0x54'),'interface'],'raw':!![]}]})[_0xa398('0x17')](function(_0x11b2a4){if(_0x11b2a4){var _0x108ce7=_[_0xa398('0x55')](_0x11b2a4,function(_0x2f29ac){var _0x211eb6=_0x2f29ac[_0xa398('0x19')]({'plain':!![]});return _0x211eb6[_0xa398('0x56')];});return db['FaxQueue'][_0xa398('0x31')]({'where':{'id':_0x594858[_0xa398('0x28')]['id']}})[_0xa398('0x17')](function(_0x26e8c6){return db[_0xa398('0x57')][_0xa398('0x58')](function(_0x3cb2a8){return _0x26e8c6[_0xa398('0x51')](_0x4446f6,{'transaction':_0x3cb2a8})['then'](function(){return BPromise[_0xa398('0x59')](_0x108ce7,function(_0x43d167){return db[_0xa398('0x5a')][_0xa398('0x5b')]({'where':{'UserId':_0x43d167['id'],'FaxQueueId':_0x594858[_0xa398('0x28')]['id']},'transaction':_0x3cb2a8});});})[_0xa398('0x17')](function(){_0x108ce7[_0xa398('0x5c')](function(_0x8881b7){socket['emit'](_0xa398('0x5d'),{'UserId':_0x8881b7['id'],'FaxQueueId':_0x26e8c6['id']});});});});});}})[_0xa398('0x17')](respondWithStatusCode(_0xdded5e,null))[_0xa398('0x26')](handleError(_0xdded5e,null));};exports[_0xa398('0x5e')]=function(_0x4d41bb,_0xfba3d7){return db[_0xa398('0x4e')][_0xa398('0x45')]({'where':{'id':_0x4d41bb[_0xa398('0x2b')][_0xa398('0x52')]},'attributes':['id'],'include':[{'model':db[_0xa398('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xfba3d7,null))[_0xa398('0x17')](function(_0x9891c){var _0x5d3f7f=_[_0xa398('0x1c')](_0x9891c,'id');var _0x218199=[];var _0x5df338=[];var _0x44b351=squel['select']();_0x44b351[_0xa398('0x5f')](_0xa398('0x60'))[_0xa398('0x61')](_0xa398('0x62'),'tq')[_0xa398('0x63')]('user_has_teams','ut',_0xa398('0x64'))[_0xa398('0x23')](_0xa398('0x65'),_0x4d41bb[_0xa398('0x28')]['id']);for(var _0x15a0f7=0x0;_0x15a0f7<_0x9891c[_0xa398('0x2f')];_0x15a0f7+=0x1){let _0x30f0ab=_0x9891c[_0x15a0f7];for(var _0x3b98e5=0x0;_0x3b98e5<_0x30f0ab['Agents']['length'];_0x3b98e5+=0x1){let _0x305309=_0x30f0ab['Agents'][_0x3b98e5];var _0x2813e1=_0x44b351[_0xa398('0x66')]();_0x2813e1[_0xa398('0x23')](_0xa398('0x67'),_0x305309['id']);_0x5df338[_0xa398('0x68')](db[_0xa398('0x57')]['query'](_0x2813e1[_0xa398('0x69')](),{'type':db[_0xa398('0x57')][_0xa398('0x6a')][_0xa398('0x6b')]})[_0xa398('0x17')](function(_0x2dc7e2){if(_0x2dc7e2[_0xa398('0x2f')]===0x1){return _0x305309['id'];}else{var _0x474856=_[_0xa398('0x6c')](_[_0xa398('0x1c')](_0x2dc7e2,'TeamId'),function(_0x2c5913){return _[_0xa398('0x6d')](_0x5d3f7f,_0x2c5913);});if(_0x474856){return _0x305309['id'];}}}));}}return BPromise[_0xa398('0x6e')](_0x5df338)['then'](function(_0x36b89f){_0x218199=_(_0x218199)[_0xa398('0x6f')](_0x36b89f)[_0xa398('0x70')]()[_0xa398('0x71')]();return db['FaxQueue']['find']({'where':{'id':_0x4d41bb[_0xa398('0x28')]['id']}})['then'](function(_0x36f532){return db[_0xa398('0x57')]['transaction'](function(_0x37f103){return _0x36f532['removeTeams'](_0x4d41bb[_0xa398('0x2b')][_0xa398('0x52')],{'transaction':_0x37f103})[_0xa398('0x17')](function(){if(!_[_0xa398('0x72')](_0x218199)){return _0x36f532[_0xa398('0x73')](_0x218199,{'transaction':_0x37f103});}})[_0xa398('0x17')](function(){_0x218199['forEach'](function(_0x28d2e6){socket['emit'](_0xa398('0x74'),{'UserId':_0x28d2e6,'FaxQueueId':_0x36f532['id']});});});});});});})[_0xa398('0x17')](respondWithStatusCode(_0xfba3d7,null))['catch'](handleError(_0xfba3d7,null));};exports[_0xa398('0x75')]=function(_0x3371cb,_0x1862e1){return db['FaxQueue'][_0xa398('0x31')]({'where':{'id':_0x3371cb[_0xa398('0x28')]['id']}})['then'](handleEntityNotFound(_0x1862e1,null))[_0xa398('0x17')](function(_0x4dd099){if(_0x4dd099){return _0x4dd099[_0xa398('0x75')](_0x3371cb[_0xa398('0x33')][_0xa398('0x52')],_[_0xa398('0x76')](_0x3371cb[_0xa398('0x33')],[_0xa398('0x52'),'id'])||{})[_0xa398('0x77')](function(_0x5e5e8e){for(var _0x3991b7=0x0;_0x3991b7<_0x3371cb[_0xa398('0x33')]['ids'][_0xa398('0x2f')];_0x3991b7+=0x1){socket['emit'](_0xa398('0x5d'),{'UserId':Number(_0x3371cb['body'][_0xa398('0x52')][_0x3991b7]),'FaxQueueId':Number(_0x3371cb[_0xa398('0x28')]['id'])});}return _0x5e5e8e;});}})[_0xa398('0x17')](respondWithResult(_0x1862e1,null))[_0xa398('0x26')](handleError(_0x1862e1,null));};exports[_0xa398('0x73')]=function(_0x55c421,_0x7b4220){return db[_0xa398('0x1d')]['find']({'where':{'id':_0x55c421[_0xa398('0x28')]['id']}})[_0xa398('0x17')](handleEntityNotFound(_0x7b4220,null))[_0xa398('0x17')](function(_0x5ae1ee){if(_0x5ae1ee){return _0x5ae1ee[_0xa398('0x73')](_0x55c421[_0xa398('0x2b')][_0xa398('0x52')])[_0xa398('0x17')](function(){if(_['isArray'](_0x55c421['query']['ids'])){for(var _0x9231bc=0x0;_0x9231bc<_0x55c421[_0xa398('0x2b')][_0xa398('0x52')][_0xa398('0x2f')];_0x9231bc+=0x1){socket[_0xa398('0x78')](_0xa398('0x74'),{'UserId':Number(_0x55c421[_0xa398('0x2b')][_0xa398('0x52')][_0x9231bc]),'FaxQueueId':Number(_0x55c421[_0xa398('0x28')]['id'])});}}else{socket[_0xa398('0x78')](_0xa398('0x74'),{'UserId':Number(_0x55c421['query'][_0xa398('0x52')]),'FaxQueueId':Number(_0x55c421[_0xa398('0x28')]['id'])});}});}})[_0xa398('0x17')](respondWithStatusCode(_0x7b4220,null))[_0xa398('0x26')](handleError(_0x7b4220,null));};exports[_0xa398('0x79')]=function(_0x442184,_0x152047){var _0x4ba85e={};var _0x13025d={};var _0x5a796f;var _0x2030bc;return db[_0xa398('0x1d')]['findOne']({'where':{'id':_0x442184['params']['id']}})[_0xa398('0x17')](handleEntityNotFound(_0x152047,null))['then'](function(_0x5a0a80){if(_0x5a0a80){_0x5a796f=_0x5a0a80;_0x13025d[_0xa398('0x29')]=_[_0xa398('0x2a')](db[_0xa398('0x46')][_0xa398('0x1e')]);_0x13025d[_0xa398('0x2b')]=_['keys'](_0x442184[_0xa398('0x2b')]);_0x13025d[_0xa398('0x2c')]=_['intersection'](_0x13025d[_0xa398('0x29')],_0x13025d['query']);_0x4ba85e[_0xa398('0x2d')]=_[_0xa398('0x3e')](_0x13025d['model'],qs[_0xa398('0x2e')](_0x442184['query'][_0xa398('0x2e')]));_0x4ba85e[_0xa398('0x2d')]=_0x4ba85e[_0xa398('0x2d')][_0xa398('0x2f')]?_0x4ba85e['attributes']:_0x13025d['model'];_0x4ba85e[_0xa398('0x4f')]=qs[_0xa398('0x50')](_0x442184['query'][_0xa398('0x50')]);_0x4ba85e[_0xa398('0x23')]=qs['filters'](_[_0xa398('0x41')](_0x442184[_0xa398('0x2b')],_0x13025d[_0xa398('0x2c')]));if(_0x442184[_0xa398('0x2b')][_0xa398('0x43')]){_0x4ba85e['where']=_[_0xa398('0x44')](_0x4ba85e[_0xa398('0x23')],{'$or':_[_0xa398('0x1c')](_0x4ba85e['attributes'],function(_0x5f0944){var _0x155457={};_0x155457[_0x5f0944]={'$like':'%'+_0x442184[_0xa398('0x2b')]['filter']+'%'};return _0x155457;})});}_0x4ba85e=_['merge']({},_0x4ba85e,_0x442184[_0xa398('0x7a')]);return _0x5a796f['getAgents'](_0x4ba85e);}})[_0xa398('0x17')](function(_0x39b655){if(_0x39b655){_0x2030bc=_0x39b655[_0xa398('0x2f')];if(!_0x442184[_0xa398('0x2b')]['hasOwnProperty'](_0xa398('0x40'))){_0x4ba85e[_0xa398('0x13')]=qs[_0xa398('0x13')](_0x442184[_0xa398('0x2b')][_0xa398('0x13')]);_0x4ba85e[_0xa398('0x11')]=qs[_0xa398('0x11')](_0x442184[_0xa398('0x2b')]['offset']);}return _0x5a796f[_0xa398('0x79')](_0x4ba85e);}})[_0xa398('0x17')](function(_0xf47678){if(_0xf47678){return _0xf47678?{'count':_0x2030bc,'rows':_0xf47678}:null;}})[_0xa398('0x17')](respondWithResult(_0x152047,null))[_0xa398('0x26')](handleError(_0x152047,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 8007b32..f978fe1 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 _0x1128=['exports','../../mysqldb','update','remove','emit'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0x1128,0x141));var _0x8112=function(_0x1f184a,_0x19ff0c){_0x1f184a=_0x1f184a-0x0;var _0x5780b1=_0x1128[_0x1f184a];return _0x5780b1;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x8112('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8112('0x1'),'afterDestroy':_0x8112('0x2')};function emitEvent(_0x2991dc){return function(_0x2347b9,_0x502768,_0x5aec24){FaxQueueEvents[_0x8112('0x3')](_0x2991dc+':'+_0x2347b9['id'],_0x2347b9);FaxQueueEvents['emit'](_0x2991dc,_0x2347b9);_0x5aec24(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x8112('0x4')]=FaxQueueEvents; \ No newline at end of file +var _0x1150=['exports','events','FaxQueue','update','remove','emit','hasOwnProperty'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x1150,0x15f));var _0x0115=function(_0x591080,_0x117e1e){_0x591080=_0x591080-0x0;var _0x666f7e=_0x1150[_0x591080];return _0x666f7e;};'use strict';var EventEmitter=require(_0x0115('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x0115('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0115('0x2'),'afterDestroy':_0x0115('0x3')};function emitEvent(_0x5247fc){return function(_0x4f6051,_0x1d65ae,_0x3cd6aa){FaxQueueEvents[_0x0115('0x4')](_0x5247fc+':'+_0x4f6051['id'],_0x4f6051);FaxQueueEvents[_0x0115('0x4')](_0x5247fc,_0x4f6051);_0x3cd6aa(null);};}for(var e in events){if(events[_0x0115('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x0115('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index d203ac9..9cdeab8 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 _0xb4db=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x2a22ce,_0x367ba8){var _0x30584a=function(_0x7139ee){while(--_0x7139ee){_0x2a22ce['push'](_0x2a22ce['shift']());}};_0x30584a(++_0x367ba8);}(_0xb4db,0x1f1));var _0xbb4d=function(_0x417659,_0x2e3af9){_0x417659=_0x417659-0x0;var _0x3df5b9=_0xb4db[_0x417659];return _0x3df5b9;};'use strict';var _=require(_0xbb4d('0x0'));var util=require(_0xbb4d('0x1'));var logger=require('../../config/logger')(_0xbb4d('0x2'));var moment=require(_0xbb4d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb4d('0x4'));var rimraf=require(_0xbb4d('0x5'));var config=require(_0xbb4d('0x6'));var attributes=require(_0xbb4d('0x7'));module[_0xbb4d('0x8')]=function(_0x223db5,_0x2e206a){return _0x223db5[_0xbb4d('0x9')](_0xbb4d('0xa'),attributes,{'tableName':_0xbb4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6f8=['../../config/environment','./faxQueue.attributes','exports','FaxQueue','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x45161c,_0x5494fc){var _0x186581=function(_0x78fada){while(--_0x78fada){_0x45161c['push'](_0x45161c['shift']());}};_0x186581(++_0x5494fc);}(_0xa6f8,0x1c7));var _0x8a6f=function(_0x591940,_0xa3f3c0){_0x591940=_0x591940-0x0;var _0x3fc57c=_0xa6f8[_0x591940];return _0x3fc57c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8a6f('0x0'))(_0x8a6f('0x1'));var moment=require(_0x8a6f('0x2'));var BPromise=require(_0x8a6f('0x3'));var rp=require(_0x8a6f('0x4'));var fs=require('fs');var path=require(_0x8a6f('0x5'));var rimraf=require(_0x8a6f('0x6'));var config=require(_0x8a6f('0x7'));var attributes=require(_0x8a6f('0x8'));module[_0x8a6f('0x9')]=function(_0x4bedb7,_0xe41d24){return _0x4bedb7['define'](_0x8a6f('0xa'),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 60dc530..e87a5a7 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 _0x34d1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowFaxQueue','then','lodash','util','bluebird','randomstring'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x34d1,0x15b));var _0x134d=function(_0x493589,_0x19f0de){_0x493589=_0x493589-0x0;var _0x1c8f61=_0x34d1[_0x493589];return _0x1c8f61;};'use strict';var _=require(_0x134d('0x0'));var util=require(_0x134d('0x1'));var moment=require('moment');var BPromise=require(_0x134d('0x2'));var rs=require(_0x134d('0x3'));var fs=require('fs');var Redis=require(_0x134d('0x4'));var db=require(_0x134d('0x5'))['db'];var utils=require(_0x134d('0x6'));var logger=require(_0x134d('0x7'))(_0x134d('0x8'));var config=require(_0x134d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x134d('0xa')]['http']({'port':0x232a});config['redis']=_[_0x134d('0xb')](config[_0x134d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x134d('0xd'))(new Redis(config[_0x134d('0xc')]));require(_0x134d('0xe'))[_0x134d('0xf')](socket);function respondWithRpcPromise(_0x1b9d04,_0x152f76,_0x32375e){return new BPromise(function(_0x55c46f,_0x4ac250){return client[_0x134d('0x10')](_0x1b9d04,_0x32375e)['then'](function(_0x20d2c0){logger[_0x134d('0x11')](_0x134d('0x12'),_0x152f76,_0x134d('0x13'));logger['debug'](_0x134d('0x14'),_0x152f76,_0x134d('0x13'),JSON[_0x134d('0x15')](_0x20d2c0));if(_0x20d2c0[_0x134d('0x16')]){if(_0x20d2c0['error']['code']===0x1f4){logger[_0x134d('0x16')](_0x134d('0x12'),_0x152f76,_0x20d2c0[_0x134d('0x16')][_0x134d('0x17')]);return _0x4ac250(_0x20d2c0['error']['message']);}logger[_0x134d('0x16')](_0x134d('0x12'),_0x152f76,_0x20d2c0[_0x134d('0x16')][_0x134d('0x17')]);return _0x55c46f(_0x20d2c0[_0x134d('0x16')]['message']);}else{logger[_0x134d('0x11')]('FaxQueue,\x20%s,\x20%s',_0x152f76,'request\x20sent');_0x55c46f(_0x20d2c0[_0x134d('0x18')][_0x134d('0x17')]);}})['catch'](function(_0x524b35){logger[_0x134d('0x16')](_0x134d('0x12'),_0x152f76,_0x524b35);_0x4ac250(_0x524b35);});});}exports[_0x134d('0x19')]=function(_0x1f846d){var _0x28c130=this;return new Promise(function(_0x1d200a,_0x11d2a6){return db[_0x134d('0x1a')]['findAll']({'raw':_0x1f846d[_0x134d('0x1b')]?_0x1f846d['options'][_0x134d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f846d[_0x134d('0x1b')]?_0x1f846d[_0x134d('0x1b')][_0x134d('0x1d')]||null:null,'attributes':_0x1f846d['options']?_0x1f846d[_0x134d('0x1b')][_0x134d('0x1e')]||null:null,'limit':_0x1f846d['options']?_0x1f846d['options'][_0x134d('0x1f')]||null:null,'include':_0x1f846d[_0x134d('0x1b')]?_0x1f846d['options'][_0x134d('0x20')]?_[_0x134d('0x21')](_0x1f846d[_0x134d('0x1b')][_0x134d('0x20')],function(_0xbd559c){return{'model':db[_0xbd559c[_0x134d('0x22')]],'as':_0xbd559c['as'],'attributes':_0xbd559c['attributes'],'include':_0xbd559c[_0x134d('0x20')]?_[_0x134d('0x21')](_0xbd559c['include'],function(_0x511765){return{'model':db[_0x511765[_0x134d('0x22')]],'as':_0x511765['as'],'attributes':_0x511765[_0x134d('0x1e')],'include':_0x511765[_0x134d('0x20')]?_[_0x134d('0x21')](_0x511765[_0x134d('0x20')],function(_0x3e4d74){return{'model':db[_0x3e4d74[_0x134d('0x22')]],'as':_0x3e4d74['as'],'attributes':_0x3e4d74[_0x134d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3117bd){logger['info'](_0x134d('0x19'),_0x1f846d);logger[_0x134d('0x23')](_0x134d('0x19'),_0x1f846d,JSON[_0x134d('0x15')](_0x3117bd));_0x1d200a(_0x3117bd);})[_0x134d('0x24')](function(_0x468df9){logger[_0x134d('0x16')](_0x134d('0x19'),_0x468df9[_0x134d('0x17')],_0x1f846d);_0x11d2a6(_0x28c130[_0x134d('0x16')](0x1f4,_0x468df9[_0x134d('0x17')]));});});};exports[_0x134d('0x25')]=function(_0x4edc09){var _0x300de8=this;return new Promise(function(_0xbd1cc8,_0x4547c9){return db[_0x134d('0x1a')]['find']({'raw':_0x4edc09[_0x134d('0x1b')]?_0x4edc09[_0x134d('0x1b')][_0x134d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4edc09[_0x134d('0x1b')]?_0x4edc09[_0x134d('0x1b')][_0x134d('0x1d')]||null:null,'attributes':_0x4edc09[_0x134d('0x1b')]?_0x4edc09[_0x134d('0x1b')]['attributes']||null:null,'include':_0x4edc09['options']?_0x4edc09['options'][_0x134d('0x20')]?_['map'](_0x4edc09['options'][_0x134d('0x20')],function(_0x529c91){return{'model':db[_0x529c91['model']],'as':_0x529c91['as'],'attributes':_0x529c91[_0x134d('0x1e')],'include':_0x529c91[_0x134d('0x20')]?_['map'](_0x529c91['include'],function(_0x119e1d){return{'model':db[_0x119e1d[_0x134d('0x22')]],'as':_0x119e1d['as'],'attributes':_0x119e1d['attributes'],'include':_0x119e1d[_0x134d('0x20')]?_['map'](_0x119e1d[_0x134d('0x20')],function(_0x5948f9){return{'model':db[_0x5948f9['model']],'as':_0x5948f9['as'],'attributes':_0x5948f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x134d('0x26')](function(_0x21562f){logger['info']('ShowFaxQueue',_0x4edc09);logger['debug'](_0x134d('0x25'),_0x4edc09,JSON['stringify'](_0x21562f));_0xbd1cc8(_0x21562f);})['catch'](function(_0x579176){logger[_0x134d('0x16')](_0x134d('0x25'),_0x579176[_0x134d('0x17')],_0x4edc09);_0x4547c9(_0x300de8['error'](0x1f4,_0x579176['message']));});});}; \ No newline at end of file +var _0xd5c4=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','catch','options','raw','where','attributes','include','map','model','GetFaxQueue','ShowFaxQueue','FaxQueue','find','lodash','moment','bluebird'];(function(_0xbd8492,_0x186935){var _0x45e751=function(_0xfdd819){while(--_0xfdd819){_0xbd8492['push'](_0xbd8492['shift']());}};_0x45e751(++_0x186935);}(_0xd5c4,0xf2));var _0x4d5c=function(_0x521a28,_0x1b7aa9){_0x521a28=_0x521a28-0x0;var _0x30acd3=_0xd5c4[_0x521a28];return _0x30acd3;};'use strict';var _=require(_0x4d5c('0x0'));var util=require('util');var moment=require(_0x4d5c('0x1'));var BPromise=require(_0x4d5c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d5c('0x4'));var logger=require('../../config/logger')(_0x4d5c('0x5'));var config=require(_0x4d5c('0x6'));var jayson=require(_0x4d5c('0x7'));var client=jayson[_0x4d5c('0x8')]['http']({'port':0x232a});config[_0x4d5c('0x9')]=_[_0x4d5c('0xa')](config[_0x4d5c('0x9')],{'host':_0x4d5c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d5c('0x9')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x34e491,_0x56fe31,_0x2ca46e){return new BPromise(function(_0x3e42df,_0x5b0c6c){return client[_0x4d5c('0xc')](_0x34e491,_0x2ca46e)[_0x4d5c('0xd')](function(_0x533b0a){logger[_0x4d5c('0xe')]('FaxQueue,\x20%s,\x20%s',_0x56fe31,_0x4d5c('0xf'));logger[_0x4d5c('0x10')](_0x4d5c('0x11'),_0x56fe31,'request\x20sent',JSON[_0x4d5c('0x12')](_0x533b0a));if(_0x533b0a['error']){if(_0x533b0a['error']['code']===0x1f4){logger[_0x4d5c('0x13')](_0x4d5c('0x14'),_0x56fe31,_0x533b0a[_0x4d5c('0x13')][_0x4d5c('0x15')]);return _0x5b0c6c(_0x533b0a['error'][_0x4d5c('0x15')]);}logger[_0x4d5c('0x13')](_0x4d5c('0x14'),_0x56fe31,_0x533b0a[_0x4d5c('0x13')][_0x4d5c('0x15')]);return _0x3e42df(_0x533b0a[_0x4d5c('0x13')][_0x4d5c('0x15')]);}else{logger[_0x4d5c('0xe')]('FaxQueue,\x20%s,\x20%s',_0x56fe31,_0x4d5c('0xf'));_0x3e42df(_0x533b0a[_0x4d5c('0x16')][_0x4d5c('0x15')]);}})[_0x4d5c('0x17')](function(_0x2fcbff){logger[_0x4d5c('0x13')]('FaxQueue,\x20%s,\x20%s',_0x56fe31,_0x2fcbff);_0x5b0c6c(_0x2fcbff);});});}exports['GetFaxQueue']=function(_0x42eb3a){var _0x408cea=this;return new Promise(function(_0x3b093e,_0x3498ba){return db['FaxQueue']['findAll']({'raw':_0x42eb3a[_0x4d5c('0x18')]?_0x42eb3a[_0x4d5c('0x18')][_0x4d5c('0x19')]===undefined?!![]:![]:!![],'where':_0x42eb3a[_0x4d5c('0x18')]?_0x42eb3a[_0x4d5c('0x18')][_0x4d5c('0x1a')]||null:null,'attributes':_0x42eb3a[_0x4d5c('0x18')]?_0x42eb3a[_0x4d5c('0x18')][_0x4d5c('0x1b')]||null:null,'limit':_0x42eb3a[_0x4d5c('0x18')]?_0x42eb3a[_0x4d5c('0x18')]['limit']||null:null,'include':_0x42eb3a[_0x4d5c('0x18')]?_0x42eb3a['options'][_0x4d5c('0x1c')]?_[_0x4d5c('0x1d')](_0x42eb3a[_0x4d5c('0x18')][_0x4d5c('0x1c')],function(_0x4e099b){return{'model':db[_0x4e099b[_0x4d5c('0x1e')]],'as':_0x4e099b['as'],'attributes':_0x4e099b['attributes'],'include':_0x4e099b['include']?_[_0x4d5c('0x1d')](_0x4e099b[_0x4d5c('0x1c')],function(_0x19f6ad){return{'model':db[_0x19f6ad['model']],'as':_0x19f6ad['as'],'attributes':_0x19f6ad[_0x4d5c('0x1b')],'include':_0x19f6ad['include']?_[_0x4d5c('0x1d')](_0x19f6ad['include'],function(_0x5a2bb9){return{'model':db[_0x5a2bb9[_0x4d5c('0x1e')]],'as':_0x5a2bb9['as'],'attributes':_0x5a2bb9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6ba016){logger[_0x4d5c('0xe')](_0x4d5c('0x1f'),_0x42eb3a);logger['debug'](_0x4d5c('0x1f'),_0x42eb3a,JSON['stringify'](_0x6ba016));_0x3b093e(_0x6ba016);})[_0x4d5c('0x17')](function(_0x454395){logger[_0x4d5c('0x13')](_0x4d5c('0x1f'),_0x454395[_0x4d5c('0x15')],_0x42eb3a);_0x3498ba(_0x408cea[_0x4d5c('0x13')](0x1f4,_0x454395[_0x4d5c('0x15')]));});});};exports[_0x4d5c('0x20')]=function(_0x28de82){var _0x291bd6=this;return new Promise(function(_0x5f1c25,_0x4d72fb){return db[_0x4d5c('0x21')][_0x4d5c('0x22')]({'raw':_0x28de82[_0x4d5c('0x18')]?_0x28de82[_0x4d5c('0x18')][_0x4d5c('0x19')]===undefined?!![]:![]:!![],'where':_0x28de82[_0x4d5c('0x18')]?_0x28de82[_0x4d5c('0x18')]['where']||null:null,'attributes':_0x28de82['options']?_0x28de82[_0x4d5c('0x18')][_0x4d5c('0x1b')]||null:null,'include':_0x28de82[_0x4d5c('0x18')]?_0x28de82[_0x4d5c('0x18')][_0x4d5c('0x1c')]?_['map'](_0x28de82[_0x4d5c('0x18')][_0x4d5c('0x1c')],function(_0x3dc9d8){return{'model':db[_0x3dc9d8[_0x4d5c('0x1e')]],'as':_0x3dc9d8['as'],'attributes':_0x3dc9d8[_0x4d5c('0x1b')],'include':_0x3dc9d8[_0x4d5c('0x1c')]?_[_0x4d5c('0x1d')](_0x3dc9d8[_0x4d5c('0x1c')],function(_0x57ba8e){return{'model':db[_0x57ba8e['model']],'as':_0x57ba8e['as'],'attributes':_0x57ba8e['attributes'],'include':_0x57ba8e[_0x4d5c('0x1c')]?_[_0x4d5c('0x1d')](_0x57ba8e['include'],function(_0x13cd7a){return{'model':db[_0x13cd7a[_0x4d5c('0x1e')]],'as':_0x13cd7a['as'],'attributes':_0x13cd7a[_0x4d5c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4d5c('0xd')](function(_0x13a22e){logger[_0x4d5c('0xe')](_0x4d5c('0x20'),_0x28de82);logger['debug']('ShowFaxQueue',_0x28de82,JSON[_0x4d5c('0x12')](_0x13a22e));_0x5f1c25(_0x13a22e);})[_0x4d5c('0x17')](function(_0x48ba15){logger[_0x4d5c('0x13')](_0x4d5c('0x20'),_0x48ba15[_0x4d5c('0x15')],_0x28de82);_0x4d72fb(_0x291bd6[_0x4d5c('0x13')](0x1f4,_0x48ba15[_0x4d5c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 40db69e..0232b2c 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 _0x541f=['register','length','faxQueue:','save','update'];(function(_0xbed8a2,_0x578ae3){var _0x11d4f2=function(_0x49e846){while(--_0x49e846){_0xbed8a2['push'](_0xbed8a2['shift']());}};_0x11d4f2(++_0x578ae3);}(_0x541f,0x1f2));var _0xf541=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x541f[_0x2892da];return _0x28cff2;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xf541('0x0'),'remove',_0xf541('0x1')];function createListener(_0x35a162,_0x503fa9){return function(_0x1c9ad7){_0x503fa9['emit'](_0x35a162,_0x1c9ad7);};}function removeListener(_0x13fa1a,_0x27194e){return function(){FaxQueueEvents['removeListener'](_0x13fa1a,_0x27194e);};}exports[_0xf541('0x2')]=function(_0x1e9379){for(var _0x1b75d7=0x0,_0x426257=events[_0xf541('0x3')];_0x1b75d7<_0x426257;_0x1b75d7++){var _0x2a4958=events[_0x1b75d7];var _0x172862=createListener(_0xf541('0x4')+_0x2a4958,_0x1e9379);FaxQueueEvents['on'](_0x2a4958,_0x172862);}}; \ No newline at end of file +var _0xbe3b=['remove','emit','removeListener','register','length','faxQueue:','save'];(function(_0x46064d,_0x2bfc78){var _0x974ada=function(_0x748ec5){while(--_0x748ec5){_0x46064d['push'](_0x46064d['shift']());}};_0x974ada(++_0x2bfc78);}(_0xbe3b,0x19c));var _0xbbe3=function(_0x514c5e,_0x8c0875){_0x514c5e=_0x514c5e-0x0;var _0x34c3e6=_0xbe3b[_0x514c5e];return _0x34c3e6;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xbbe3('0x0'),_0xbbe3('0x1'),'update'];function createListener(_0x364f65,_0x5b26bc){return function(_0x5bfd65){_0x5b26bc[_0xbbe3('0x2')](_0x364f65,_0x5bfd65);};}function removeListener(_0x497180,_0x5d74ec){return function(){FaxQueueEvents[_0xbbe3('0x3')](_0x497180,_0x5d74ec);};}exports[_0xbbe3('0x4')]=function(_0x257eb0){for(var _0x331557=0x0,_0x4c6976=events[_0xbbe3('0x5')];_0x331557<_0x4c6976;_0x331557++){var _0x748756=events[_0x331557];var _0x40199b=createListener(_0xbbe3('0x6')+_0x748756,_0x257eb0);FaxQueueEvents['on'](_0x748756,_0x40199b);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 9eef1d3..043bf4e 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 _0xe2fe=['describe','/:id','/:id/members','getAgents','post','create','/:id/users','addAgents','put','update','destroy','delete','removeTeams','removeAgents','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x15ed21,_0x28b2e6){var _0x31c0c0=function(_0x4f5d86){while(--_0x4f5d86){_0x15ed21['push'](_0x15ed21['shift']());}};_0x31c0c0(++_0x28b2e6);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./faxQueue.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getMembers']);router['get']('/:id/teams',auth[_0xee2f('0x8')](),controller['getTeams']);router['get']('/:id/users',auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);router[_0xee2f('0xe')]('/',auth[_0xee2f('0x8')](),controller[_0xee2f('0xf')]);router[_0xee2f('0xe')]('/:id/teams',auth[_0xee2f('0x8')](),controller['addTeams']);router[_0xee2f('0xe')](_0xee2f('0x10'),auth['isAuthenticated'](),controller[_0xee2f('0x11')]);router[_0xee2f('0x12')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x13')]);router['delete'](_0xee2f('0xb'),auth['isAuthenticated'](),controller[_0xee2f('0x14')]);router[_0xee2f('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0xee2f('0x16')]);router['delete'](_0xee2f('0x10'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x17')]);module['exports']=router; \ No newline at end of file +var _0x38b8=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','get','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x38b8,0x7f));var _0x838b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x38b8[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x838b('0x0'));var util=require('util');var path=require(_0x838b('0x1'));var timeout=require(_0x838b('0x2'));var express=require('express');var router=express[_0x838b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x838b('0x4'));var config=require(_0x838b('0x5'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0x838b('0x6')](),controller[_0x838b('0x7')]);router['get'](_0x838b('0x8'),auth[_0x838b('0x6')](),controller['describe']);router['get'](_0x838b('0x9'),auth[_0x838b('0x6')](),controller[_0x838b('0xa')]);router['get'](_0x838b('0xb'),auth['isAuthenticated'](),controller[_0x838b('0xc')]);router[_0x838b('0xd')](_0x838b('0xe'),auth[_0x838b('0x6')](),controller[_0x838b('0xf')]);router[_0x838b('0xd')]('/:id/users',auth[_0x838b('0x6')](),controller[_0x838b('0x10')]);router[_0x838b('0x11')]('/',auth[_0x838b('0x6')](),controller[_0x838b('0x12')]);router[_0x838b('0x11')](_0x838b('0xe'),auth[_0x838b('0x6')](),controller[_0x838b('0x13')]);router['post'](_0x838b('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x838b('0x9'),auth[_0x838b('0x6')](),controller[_0x838b('0x15')]);router[_0x838b('0x16')](_0x838b('0x9'),auth['isAuthenticated'](),controller[_0x838b('0x17')]);router[_0x838b('0x16')](_0x838b('0xe'),auth[_0x838b('0x6')](),controller['removeTeams']);router[_0x838b('0x16')](_0x838b('0x14'),auth['isAuthenticated'](),controller[_0x838b('0x18')]);module[_0x838b('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 568eb81..a3b3102 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 _0x14c5=['moment','STRING','DATE'];(function(_0x3cb06a,_0xd56a96){var _0x2a92e8=function(_0xd1e12a){while(--_0xd1e12a){_0x3cb06a['push'](_0x3cb06a['shift']());}};_0x2a92e8(++_0xd56a96);}(_0x14c5,0x17a));var _0x514c=function(_0x4c3f9c,_0x2e0e05){_0x4c3f9c=_0x4c3f9c-0x0;var _0x1ae0c4=_0x14c5[_0x4c3f9c];return _0x1ae0c4;};'use strict';var moment=require(_0x514c('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x514c('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x514c('0x1')]},'joinAt':{'type':Sequelize[_0x514c('0x2')]},'leaveAt':{'type':Sequelize[_0x514c('0x2')]},'acceptAt':{'type':Sequelize[_0x514c('0x2')]},'exitAt':{'type':Sequelize[_0x514c('0x2')]},'reason':{'type':Sequelize[_0x514c('0x1')]}}; \ No newline at end of file +var _0xfe78=['sequelize','exports','STRING','DATE'];(function(_0x5268c1,_0x186cd5){var _0x2ad1f8=function(_0x589217){while(--_0x589217){_0x5268c1['push'](_0x5268c1['shift']());}};_0x2ad1f8(++_0x186cd5);}(_0xfe78,0x70));var _0x8fe7=function(_0x3bd2cc,_0x5ab040){_0x3bd2cc=_0x3bd2cc-0x0;var _0x12e415=_0xfe78[_0x3bd2cc];return _0x12e415;};'use strict';var moment=require('moment');var Sequelize=require(_0x8fe7('0x0'));module[_0x8fe7('0x1')]={'uniqueid':{'type':Sequelize[_0x8fe7('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8fe7('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8fe7('0x3')]},'reason':{'type':Sequelize[_0x8fe7('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index c533298..01c993b 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 _0x24a6=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','FaxQueueReport','length','options','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','name','map'];(function(_0x578a41,_0x457926){var _0x246b9b=function(_0x7e749d){while(--_0x7e749d){_0x578a41['push'](_0x578a41['shift']());}};_0x246b9b(++_0x457926);}(_0x24a6,0x14f));var _0x624a=function(_0x97f172,_0x5bd724){_0x97f172=_0x97f172-0x0;var _0xeab429=_0x24a6[_0x97f172];return _0xeab429;};'use strict';var emlformat=require(_0x624a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x624a('0x1'));var jsonpatch=require(_0x624a('0x2'));var rp=require(_0x624a('0x3'));var moment=require(_0x624a('0x4'));var BPromise=require(_0x624a('0x5'));var Mustache=require(_0x624a('0x6'));var util=require(_0x624a('0x7'));var path=require(_0x624a('0x8'));var sox=require(_0x624a('0x9'));var csv=require(_0x624a('0xa'));var ejs=require(_0x624a('0xb'));var fs=require('fs');var fs_extra=require(_0x624a('0xc'));var _=require(_0x624a('0xd'));var squel=require(_0x624a('0xe'));var crypto=require(_0x624a('0xf'));var jsforce=require(_0x624a('0x10'));var deskjs=require(_0x624a('0x11'));var toCsv=require(_0x624a('0xa'));var querystring=require(_0x624a('0x12'));var Papa=require(_0x624a('0x13'));var Redis=require(_0x624a('0x14'));var authService=require(_0x624a('0x15'));var qs=require(_0x624a('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x624a('0x17'))(_0x624a('0x18'));var utils=require(_0x624a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x624a('0x1a'));var db=require(_0x624a('0x1b'))['db'];function respondWithStatusCode(_0x5f0954,_0x50d1aa){_0x50d1aa=_0x50d1aa||0xcc;return function(_0x5406ce){if(_0x5406ce){return _0x5f0954[_0x624a('0x1c')](_0x50d1aa);}return _0x5f0954['status'](_0x50d1aa)[_0x624a('0x1d')]();};}function respondWithResult(_0x89e2fd,_0xe310b4){_0xe310b4=_0xe310b4||0xc8;return function(_0x1e6ffd){if(_0x1e6ffd){return _0x89e2fd['status'](_0xe310b4)[_0x624a('0x1e')](_0x1e6ffd);}};}function respondWithFilteredResult(_0x4935f4,_0x424200){return function(_0x195bfc){if(_0x195bfc){var _0x53005e=typeof _0x424200[_0x624a('0x1f')]===_0x624a('0x20')&&typeof _0x424200[_0x624a('0x21')]===_0x624a('0x20');var _0xce9cd5=_0x195bfc[_0x624a('0x22')];var _0x364867=_0x53005e?0x0:_0x424200[_0x624a('0x1f')];var _0x35342c=_0x53005e?_0x195bfc[_0x624a('0x22')]:_0x424200['offset']+_0x424200[_0x624a('0x21')];var _0x5c6901;if(_0x35342c>=_0xce9cd5){_0x35342c=_0xce9cd5;_0x5c6901=0xc8;}else{_0x5c6901=0xce;}_0x4935f4[_0x624a('0x23')](_0x5c6901);return _0x4935f4['set'](_0x624a('0x24'),_0x364867+'-'+_0x35342c+'/'+_0xce9cd5)[_0x624a('0x1e')](_0x195bfc);}return null;};}function patchUpdates(_0x415af0){return function(_0x200fdc){try{jsonpatch[_0x624a('0x25')](_0x200fdc,_0x415af0,!![]);}catch(_0x54e669){return BPromise[_0x624a('0x26')](_0x54e669);}return _0x200fdc[_0x624a('0x27')]();};}function saveUpdates(_0x156d32,_0x22beca){return function(_0x5dfeec){if(_0x5dfeec){return _0x5dfeec[_0x624a('0x28')](_0x156d32)[_0x624a('0x29')](function(_0x264349){return _0x264349;});}return null;};}function removeEntity(_0x4ba881,_0x4aee03){return function(_0x56834b){if(_0x56834b){return _0x56834b[_0x624a('0x2a')]()[_0x624a('0x29')](function(){_0x4ba881[_0x624a('0x23')](0xcc)[_0x624a('0x1d')]();});}};}function handleEntityNotFound(_0x51a817,_0x5ca99b){return function(_0x2234dc){if(!_0x2234dc){_0x51a817[_0x624a('0x1c')](0x194);}return _0x2234dc;};}function handleError(_0x57eb2e,_0xd0730c){_0xd0730c=_0xd0730c||0x1f4;return function(_0x19b8a6){logger['error'](_0x19b8a6['stack']);if(_0x19b8a6['name']){delete _0x19b8a6[_0x624a('0x2b')];}_0x57eb2e[_0x624a('0x23')](_0xd0730c)['send'](_0x19b8a6);};}exports['index']=function(_0x59917f,_0x422c20){var _0x35c8d0={},_0x4dab19={},_0x55dff7={'count':0x0,'rows':[]};var _0x16178d=_[_0x624a('0x2c')](db['FaxQueueReport'][_0x624a('0x2d')],function(_0x59df8f){return{'name':_0x59df8f[_0x624a('0x2e')],'type':_0x59df8f[_0x624a('0x2f')][_0x624a('0x30')]};});_0x4dab19[_0x624a('0x31')]=_['map'](_0x16178d,_0x624a('0x2b'));_0x4dab19[_0x624a('0x32')]=_['keys'](_0x59917f[_0x624a('0x32')]);_0x4dab19[_0x624a('0x33')]=_[_0x624a('0x34')](_0x4dab19[_0x624a('0x31')],_0x4dab19[_0x624a('0x32')]);_0x35c8d0[_0x624a('0x35')]=_['intersection'](_0x4dab19['model'],qs[_0x624a('0x36')](_0x59917f[_0x624a('0x32')][_0x624a('0x36')]));_0x35c8d0['attributes']=_0x35c8d0[_0x624a('0x35')]['length']?_0x35c8d0['attributes']:_0x4dab19['model'];if(!_0x59917f[_0x624a('0x32')]['hasOwnProperty'](_0x624a('0x37'))){_0x35c8d0['limit']=qs[_0x624a('0x21')](_0x59917f['query']['limit']);_0x35c8d0[_0x624a('0x1f')]=qs[_0x624a('0x1f')](_0x59917f[_0x624a('0x32')][_0x624a('0x1f')]);}_0x35c8d0[_0x624a('0x38')]=qs[_0x624a('0x39')](_0x59917f[_0x624a('0x32')][_0x624a('0x39')]);_0x35c8d0[_0x624a('0x3a')]=qs[_0x624a('0x33')](_['pick'](_0x59917f[_0x624a('0x32')],_0x4dab19[_0x624a('0x33')]),_0x16178d);if(_0x59917f[_0x624a('0x32')][_0x624a('0x3b')]){_0x35c8d0[_0x624a('0x3a')]=_['merge'](_0x35c8d0[_0x624a('0x3a')],{'$or':_[_0x624a('0x2c')](_0x16178d,function(_0x1eb6c5){if(_0x1eb6c5[_0x624a('0x2f')]!==_0x624a('0x3c')){var _0x2f7e73={};_0x2f7e73[_0x1eb6c5['name']]={'$like':'%'+_0x59917f[_0x624a('0x32')][_0x624a('0x3b')]+'%'};return _0x2f7e73;}})});}_0x35c8d0=_[_0x624a('0x3d')]({},_0x35c8d0,_0x59917f['options']);var _0x2794a8={'where':_0x35c8d0['where']};return db['FaxQueueReport'][_0x624a('0x22')](_0x2794a8)[_0x624a('0x29')](function(_0x860d75){_0x55dff7['count']=_0x860d75;if(_0x59917f['query'][_0x624a('0x3e')]){_0x35c8d0[_0x624a('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x624a('0x40')](_0x35c8d0);})[_0x624a('0x29')](function(_0x574651){_0x55dff7[_0x624a('0x41')]=_0x574651;return _0x55dff7;})[_0x624a('0x29')](respondWithFilteredResult(_0x422c20,_0x35c8d0))[_0x624a('0x42')](handleError(_0x422c20,null));};exports[_0x624a('0x43')]=function(_0x5cd777,_0x577ec5){var _0x48e061={'raw':!![],'where':{'id':_0x5cd777[_0x624a('0x44')]['id']}},_0x23168b={};_0x23168b[_0x624a('0x31')]=_[_0x624a('0x45')](db[_0x624a('0x46')][_0x624a('0x2d')]);_0x23168b[_0x624a('0x32')]=_['keys'](_0x5cd777[_0x624a('0x32')]);_0x23168b[_0x624a('0x33')]=_['intersection'](_0x23168b['model'],_0x23168b[_0x624a('0x32')]);_0x48e061['attributes']=_[_0x624a('0x34')](_0x23168b[_0x624a('0x31')],qs[_0x624a('0x36')](_0x5cd777['query'][_0x624a('0x36')]));_0x48e061[_0x624a('0x35')]=_0x48e061[_0x624a('0x35')][_0x624a('0x47')]?_0x48e061[_0x624a('0x35')]:_0x23168b['model'];if(_0x5cd777[_0x624a('0x32')][_0x624a('0x3e')]){_0x48e061[_0x624a('0x3f')]=[{'all':!![]}];}_0x48e061=_['merge']({},_0x48e061,_0x5cd777[_0x624a('0x48')]);return db[_0x624a('0x46')][_0x624a('0x49')](_0x48e061)[_0x624a('0x29')](handleEntityNotFound(_0x577ec5,null))[_0x624a('0x29')](respondWithResult(_0x577ec5,null))[_0x624a('0x42')](handleError(_0x577ec5,null));};exports['create']=function(_0x181433,_0x519bce){return db['FaxQueueReport']['create'](_0x181433[_0x624a('0x4a')],{})[_0x624a('0x29')](respondWithResult(_0x519bce,0xc9))[_0x624a('0x42')](handleError(_0x519bce,null));};exports[_0x624a('0x28')]=function(_0x5312ec,_0x18c318){if(_0x5312ec[_0x624a('0x4a')]['id']){delete _0x5312ec[_0x624a('0x4a')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x5312ec[_0x624a('0x44')]['id']}})[_0x624a('0x29')](handleEntityNotFound(_0x18c318,null))[_0x624a('0x29')](saveUpdates(_0x5312ec[_0x624a('0x4a')],null))[_0x624a('0x29')](respondWithResult(_0x18c318,null))[_0x624a('0x42')](handleError(_0x18c318,null));};exports['destroy']=function(_0x351dc9,_0x47422e){return db['FaxQueueReport'][_0x624a('0x49')]({'where':{'id':_0x351dc9[_0x624a('0x44')]['id']}})[_0x624a('0x29')](handleEntityNotFound(_0x47422e,null))[_0x624a('0x29')](removeEntity(_0x47422e,null))[_0x624a('0x42')](handleError(_0x47422e,null));};exports[_0x624a('0x4b')]=function(_0x5f2151,_0x8cb341){return db[_0x624a('0x46')]['describe']()[_0x624a('0x29')](respondWithResult(_0x8cb341,null))[_0x624a('0x42')](handleError(_0x8cb341,null));}; \ No newline at end of file +var _0x2c6a=['fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','FaxQueueReport','findAll','show','params','include','merge','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','update','destroy','then','error','stack','name','send','index','fieldName','type','key','map','query','keys','filters','intersection','model'];(function(_0xa0be1c,_0x152d5d){var _0x546eec=function(_0x371eae){while(--_0x371eae){_0xa0be1c['push'](_0xa0be1c['shift']());}};_0x546eec(++_0x152d5d);}(_0x2c6a,0xa7));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa2c6('0x0'));var rimraf=require(_0xa2c6('0x1'));var zipdir=require(_0xa2c6('0x2'));var jsonpatch=require(_0xa2c6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa2c6('0x4'));var Mustache=require('mustache');var util=require(_0xa2c6('0x5'));var path=require(_0xa2c6('0x6'));var sox=require(_0xa2c6('0x7'));var csv=require(_0xa2c6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2c6('0x9'));var squel=require(_0xa2c6('0xa'));var crypto=require(_0xa2c6('0xb'));var jsforce=require(_0xa2c6('0xc'));var deskjs=require(_0xa2c6('0xd'));var toCsv=require(_0xa2c6('0x8'));var querystring=require(_0xa2c6('0xe'));var Papa=require('papaparse');var Redis=require(_0xa2c6('0xf'));var authService=require(_0xa2c6('0x10'));var qs=require(_0xa2c6('0x11'));var as=require(_0xa2c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2c6('0x13'))('api');var utils=require(_0xa2c6('0x14'));var config=require(_0xa2c6('0x15'));var licenseUtil=require(_0xa2c6('0x16'));var db=require(_0xa2c6('0x17'))['db'];function respondWithStatusCode(_0x4955be,_0x2897ee){_0x2897ee=_0x2897ee||0xcc;return function(_0x3234b6){if(_0x3234b6){return _0x4955be[_0xa2c6('0x18')](_0x2897ee);}return _0x4955be['status'](_0x2897ee)[_0xa2c6('0x19')]();};}function respondWithResult(_0x1dc749,_0x3ebb15){_0x3ebb15=_0x3ebb15||0xc8;return function(_0x1bc1dc){if(_0x1bc1dc){return _0x1dc749[_0xa2c6('0x1a')](_0x3ebb15)['json'](_0x1bc1dc);}};}function respondWithFilteredResult(_0x412229,_0x374404){return function(_0x43b97b){if(_0x43b97b){var _0x354dff=typeof _0x374404[_0xa2c6('0x1b')]===_0xa2c6('0x1c')&&typeof _0x374404['limit']===_0xa2c6('0x1c');var _0x4d49f8=_0x43b97b[_0xa2c6('0x1d')];var _0x114424=_0x354dff?0x0:_0x374404[_0xa2c6('0x1b')];var _0x2479bd=_0x354dff?_0x43b97b[_0xa2c6('0x1d')]:_0x374404[_0xa2c6('0x1b')]+_0x374404[_0xa2c6('0x1e')];var _0x2b3d6e;if(_0x2479bd>=_0x4d49f8){_0x2479bd=_0x4d49f8;_0x2b3d6e=0xc8;}else{_0x2b3d6e=0xce;}_0x412229['status'](_0x2b3d6e);return _0x412229[_0xa2c6('0x1f')](_0xa2c6('0x20'),_0x114424+'-'+_0x2479bd+'/'+_0x4d49f8)[_0xa2c6('0x21')](_0x43b97b);}return null;};}function patchUpdates(_0x21ec92){return function(_0x2a2fc9){try{jsonpatch['apply'](_0x2a2fc9,_0x21ec92,!![]);}catch(_0x35dd2a){return BPromise[_0xa2c6('0x22')](_0x35dd2a);}return _0x2a2fc9['save']();};}function saveUpdates(_0x20a86e,_0x58530d){return function(_0x8b2eea){if(_0x8b2eea){return _0x8b2eea[_0xa2c6('0x23')](_0x20a86e)['then'](function(_0x291057){return _0x291057;});}return null;};}function removeEntity(_0x5aabe2,_0x19a765){return function(_0x168de7){if(_0x168de7){return _0x168de7[_0xa2c6('0x24')]()[_0xa2c6('0x25')](function(){_0x5aabe2[_0xa2c6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed646,_0x4e9dcc){return function(_0x14c01e){if(!_0x14c01e){_0x2ed646[_0xa2c6('0x18')](0x194);}return _0x14c01e;};}function handleError(_0x5d687a,_0x2cedee){_0x2cedee=_0x2cedee||0x1f4;return function(_0x4485d4){logger[_0xa2c6('0x26')](_0x4485d4[_0xa2c6('0x27')]);if(_0x4485d4[_0xa2c6('0x28')]){delete _0x4485d4[_0xa2c6('0x28')];}_0x5d687a[_0xa2c6('0x1a')](_0x2cedee)[_0xa2c6('0x29')](_0x4485d4);};}exports[_0xa2c6('0x2a')]=function(_0x57d67a,_0x1655f8){var _0x46b082={},_0x233284={},_0x3702ec={'count':0x0,'rows':[]};var _0x598341=_['map'](db['FaxQueueReport']['rawAttributes'],function(_0xa6df69){return{'name':_0xa6df69[_0xa2c6('0x2b')],'type':_0xa6df69[_0xa2c6('0x2c')][_0xa2c6('0x2d')]};});_0x233284['model']=_[_0xa2c6('0x2e')](_0x598341,_0xa2c6('0x28'));_0x233284[_0xa2c6('0x2f')]=_[_0xa2c6('0x30')](_0x57d67a[_0xa2c6('0x2f')]);_0x233284[_0xa2c6('0x31')]=_[_0xa2c6('0x32')](_0x233284[_0xa2c6('0x33')],_0x233284[_0xa2c6('0x2f')]);_0x46b082['attributes']=_[_0xa2c6('0x32')](_0x233284[_0xa2c6('0x33')],qs[_0xa2c6('0x34')](_0x57d67a['query'][_0xa2c6('0x34')]));_0x46b082[_0xa2c6('0x35')]=_0x46b082['attributes']['length']?_0x46b082[_0xa2c6('0x35')]:_0x233284[_0xa2c6('0x33')];if(!_0x57d67a[_0xa2c6('0x2f')][_0xa2c6('0x36')]('nolimit')){_0x46b082[_0xa2c6('0x1e')]=qs[_0xa2c6('0x1e')](_0x57d67a[_0xa2c6('0x2f')][_0xa2c6('0x1e')]);_0x46b082[_0xa2c6('0x1b')]=qs[_0xa2c6('0x1b')](_0x57d67a[_0xa2c6('0x2f')]['offset']);}_0x46b082[_0xa2c6('0x37')]=qs[_0xa2c6('0x38')](_0x57d67a[_0xa2c6('0x2f')][_0xa2c6('0x38')]);_0x46b082[_0xa2c6('0x39')]=qs[_0xa2c6('0x31')](_[_0xa2c6('0x3a')](_0x57d67a['query'],_0x233284[_0xa2c6('0x31')]),_0x598341);if(_0x57d67a[_0xa2c6('0x2f')]['filter']){_0x46b082[_0xa2c6('0x39')]=_['merge'](_0x46b082[_0xa2c6('0x39')],{'$or':_[_0xa2c6('0x2e')](_0x598341,function(_0x5d23d9){if(_0x5d23d9[_0xa2c6('0x2c')]!==_0xa2c6('0x3b')){var _0x5a7db0={};_0x5a7db0[_0x5d23d9[_0xa2c6('0x28')]]={'$like':'%'+_0x57d67a[_0xa2c6('0x2f')][_0xa2c6('0x3c')]+'%'};return _0x5a7db0;}})});}_0x46b082=_['merge']({},_0x46b082,_0x57d67a[_0xa2c6('0x3d')]);var _0x56561a={'where':_0x46b082['where']};return db[_0xa2c6('0x3e')][_0xa2c6('0x1d')](_0x56561a)[_0xa2c6('0x25')](function(_0x27ed9e){_0x3702ec[_0xa2c6('0x1d')]=_0x27ed9e;if(_0x57d67a[_0xa2c6('0x2f')]['includeAll']){_0x46b082['include']=[{'all':!![]}];}return db[_0xa2c6('0x3e')][_0xa2c6('0x3f')](_0x46b082);})['then'](function(_0x2b0267){_0x3702ec['rows']=_0x2b0267;return _0x3702ec;})['then'](respondWithFilteredResult(_0x1655f8,_0x46b082))['catch'](handleError(_0x1655f8,null));};exports[_0xa2c6('0x40')]=function(_0x219942,_0x55b0fb){var _0x2a2895={'raw':!![],'where':{'id':_0x219942[_0xa2c6('0x41')]['id']}},_0x25acce={};_0x25acce[_0xa2c6('0x33')]=_['keys'](db[_0xa2c6('0x3e')]['rawAttributes']);_0x25acce[_0xa2c6('0x2f')]=_[_0xa2c6('0x30')](_0x219942[_0xa2c6('0x2f')]);_0x25acce['filters']=_['intersection'](_0x25acce[_0xa2c6('0x33')],_0x25acce[_0xa2c6('0x2f')]);_0x2a2895[_0xa2c6('0x35')]=_[_0xa2c6('0x32')](_0x25acce[_0xa2c6('0x33')],qs[_0xa2c6('0x34')](_0x219942[_0xa2c6('0x2f')][_0xa2c6('0x34')]));_0x2a2895[_0xa2c6('0x35')]=_0x2a2895['attributes']['length']?_0x2a2895[_0xa2c6('0x35')]:_0x25acce['model'];if(_0x219942[_0xa2c6('0x2f')]['includeAll']){_0x2a2895[_0xa2c6('0x42')]=[{'all':!![]}];}_0x2a2895=_[_0xa2c6('0x43')]({},_0x2a2895,_0x219942[_0xa2c6('0x3d')]);return db[_0xa2c6('0x3e')][_0xa2c6('0x44')](_0x2a2895)[_0xa2c6('0x25')](handleEntityNotFound(_0x55b0fb,null))['then'](respondWithResult(_0x55b0fb,null))[_0xa2c6('0x45')](handleError(_0x55b0fb,null));};exports[_0xa2c6('0x46')]=function(_0x4a66cb,_0x4fcf2e){return db[_0xa2c6('0x3e')]['create'](_0x4a66cb[_0xa2c6('0x47')],{})[_0xa2c6('0x25')](respondWithResult(_0x4fcf2e,0xc9))[_0xa2c6('0x45')](handleError(_0x4fcf2e,null));};exports['update']=function(_0x24e819,_0x2d7341){if(_0x24e819[_0xa2c6('0x47')]['id']){delete _0x24e819[_0xa2c6('0x47')]['id'];}return db[_0xa2c6('0x3e')]['find']({'where':{'id':_0x24e819['params']['id']}})[_0xa2c6('0x25')](handleEntityNotFound(_0x2d7341,null))[_0xa2c6('0x25')](saveUpdates(_0x24e819['body'],null))['then'](respondWithResult(_0x2d7341,null))['catch'](handleError(_0x2d7341,null));};exports[_0xa2c6('0x24')]=function(_0x106c29,_0x56fd27){return db[_0xa2c6('0x3e')]['find']({'where':{'id':_0x106c29[_0xa2c6('0x41')]['id']}})[_0xa2c6('0x25')](handleEntityNotFound(_0x56fd27,null))[_0xa2c6('0x25')](removeEntity(_0x56fd27,null))[_0xa2c6('0x45')](handleError(_0x56fd27,null));};exports[_0xa2c6('0x48')]=function(_0x153f3d,_0x135cde){return db['FaxQueueReport'][_0xa2c6('0x48')]()[_0xa2c6('0x25')](respondWithResult(_0x135cde,null))[_0xa2c6('0x45')](handleError(_0x135cde,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a3ffbd4..89d7e3a 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x4d4546,_0xfc2e0){var _0x3c3d7b=function(_0x3eeb1a){while(--_0x3eeb1a){_0x4d4546['push'](_0x4d4546['shift']());}};_0x3c3d7b(++_0xfc2e0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x5fc3[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x525539,_0x8f2dc5){_0x525539=_0x525539-0x0;var _0x169a0d=_0x1cb9[_0x525539];return _0x169a0d;};'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':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'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 9d022de..73f4a5a 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 _0x8f4b=['UpdateFaxQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch'];(function(_0x23ad78,_0x2279da){var _0x9ae700=function(_0x42524e){while(--_0x42524e){_0x23ad78['push'](_0x23ad78['shift']());}};_0x9ae700(++_0x2279da);}(_0x8f4b,0xca));var _0xb8f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f4b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8f4('0x0'));var util=require(_0xb8f4('0x1'));var moment=require(_0xb8f4('0x2'));var BPromise=require(_0xb8f4('0x3'));var rs=require(_0xb8f4('0x4'));var fs=require('fs');var Redis=require(_0xb8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8f4('0x6'));var logger=require(_0xb8f4('0x7'))(_0xb8f4('0x8'));var config=require(_0xb8f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb8f4('0xa')][_0xb8f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d1166,_0x58408b,_0x4e03c8){return new BPromise(function(_0x5c5b94,_0x3bcff3){return client['request'](_0x4d1166,_0x4e03c8)[_0xb8f4('0xc')](function(_0x138434){logger[_0xb8f4('0xd')](_0xb8f4('0xe'),_0x58408b,_0xb8f4('0xf'));logger[_0xb8f4('0x10')](_0xb8f4('0x11'),_0x58408b,'request\x20sent',JSON[_0xb8f4('0x12')](_0x138434));if(_0x138434[_0xb8f4('0x13')]){if(_0x138434[_0xb8f4('0x13')][_0xb8f4('0x14')]===0x1f4){logger[_0xb8f4('0x13')](_0xb8f4('0xe'),_0x58408b,_0x138434[_0xb8f4('0x13')][_0xb8f4('0x15')]);return _0x3bcff3(_0x138434[_0xb8f4('0x13')]['message']);}logger['error'](_0xb8f4('0xe'),_0x58408b,_0x138434[_0xb8f4('0x13')][_0xb8f4('0x15')]);return _0x5c5b94(_0x138434[_0xb8f4('0x13')][_0xb8f4('0x15')]);}else{logger[_0xb8f4('0xd')](_0xb8f4('0xe'),_0x58408b,_0xb8f4('0xf'));_0x5c5b94(_0x138434['result'][_0xb8f4('0x15')]);}})['catch'](function(_0x619356){logger[_0xb8f4('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x58408b,_0x619356);_0x3bcff3(_0x619356);});});}exports[_0xb8f4('0x16')]=function(_0x44e0c6){var _0xaadb70=this;return new Promise(function(_0x4b2be9,_0x6bb103){return db[_0xb8f4('0x17')][_0xb8f4('0x18')](_0x44e0c6[_0xb8f4('0x19')],{'raw':_0x44e0c6[_0xb8f4('0x1a')]?_0x44e0c6[_0xb8f4('0x1a')][_0xb8f4('0x1b')]===undefined?!![]:![]:!![]})[_0xb8f4('0xc')](function(_0x465b11){logger[_0xb8f4('0xd')](_0xb8f4('0x16'),_0x44e0c6);logger[_0xb8f4('0x10')]('CreateFaxQueueReport',_0x44e0c6,JSON['stringify'](_0x465b11));_0x4b2be9(_0x465b11);})[_0xb8f4('0x1c')](function(_0x8d0761){logger[_0xb8f4('0x13')](_0xb8f4('0x16'),_0x8d0761[_0xb8f4('0x15')],_0x44e0c6);_0x6bb103(_0xaadb70[_0xb8f4('0x13')](0x1f4,_0x8d0761[_0xb8f4('0x15')]));});});};exports[_0xb8f4('0x1d')]=function(_0x133f0b){var _0x4714ef=this;return new Promise(function(_0xcf7dcd,_0x1cdb4a){return db['FaxQueueReport']['update'](_0x133f0b[_0xb8f4('0x19')],{'raw':_0x133f0b[_0xb8f4('0x1a')]?_0x133f0b[_0xb8f4('0x1a')][_0xb8f4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x133f0b[_0xb8f4('0x1a')]?_0x133f0b[_0xb8f4('0x1a')][_0xb8f4('0x1e')]||null:null,'attributes':_0x133f0b[_0xb8f4('0x1a')]?_0x133f0b['options'][_0xb8f4('0x1f')]||null:null,'limit':_0x133f0b['options']?_0x133f0b[_0xb8f4('0x1a')][_0xb8f4('0x20')]||null:null})[_0xb8f4('0xc')](function(_0x2cc4dc){logger[_0xb8f4('0xd')](_0xb8f4('0x1d'),_0x133f0b);logger[_0xb8f4('0x10')](_0xb8f4('0x1d'),_0x133f0b,JSON[_0xb8f4('0x12')](_0x2cc4dc));_0xcf7dcd(_0x2cc4dc);})['catch'](function(_0x34770f){logger[_0xb8f4('0x13')](_0xb8f4('0x1d'),_0x34770f[_0xb8f4('0x15')],_0x133f0b);_0x1cdb4a(_0x4714ef['error'](0x1f4,_0x34770f[_0xb8f4('0x15')]));});});}; \ No newline at end of file +var _0xbe9e=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','debug','UpdateFaxQueueReport','where','attributes','lodash','util','moment','bluebird'];(function(_0x3fb7c9,_0x28b99d){var _0x3dcb37=function(_0x21d30d){while(--_0x21d30d){_0x3fb7c9['push'](_0x3fb7c9['shift']());}};_0x3dcb37(++_0x28b99d);}(_0xbe9e,0x1eb));var _0xebe9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbe9e[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xebe9('0x0'));var util=require(_0xebe9('0x1'));var moment=require(_0xebe9('0x2'));var BPromise=require(_0xebe9('0x3'));var rs=require(_0xebe9('0x4'));var fs=require('fs');var Redis=require(_0xebe9('0x5'));var db=require(_0xebe9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xebe9('0x7'))(_0xebe9('0x8'));var config=require(_0xebe9('0x9'));var jayson=require(_0xebe9('0xa'));var client=jayson[_0xebe9('0xb')][_0xebe9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b624,_0x2dc8c,_0x51d05d){return new BPromise(function(_0xe7684b,_0x234fc2){return client['request'](_0x42b624,_0x51d05d)[_0xebe9('0xd')](function(_0xb83203){logger[_0xebe9('0xe')](_0xebe9('0xf'),_0x2dc8c,'request\x20sent');logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x2dc8c,_0xebe9('0x10'),JSON[_0xebe9('0x11')](_0xb83203));if(_0xb83203[_0xebe9('0x12')]){if(_0xb83203[_0xebe9('0x12')][_0xebe9('0x13')]===0x1f4){logger[_0xebe9('0x12')](_0xebe9('0xf'),_0x2dc8c,_0xb83203['error'][_0xebe9('0x14')]);return _0x234fc2(_0xb83203[_0xebe9('0x12')][_0xebe9('0x14')]);}logger[_0xebe9('0x12')](_0xebe9('0xf'),_0x2dc8c,_0xb83203[_0xebe9('0x12')][_0xebe9('0x14')]);return _0xe7684b(_0xb83203['error'][_0xebe9('0x14')]);}else{logger[_0xebe9('0xe')](_0xebe9('0xf'),_0x2dc8c,_0xebe9('0x10'));_0xe7684b(_0xb83203[_0xebe9('0x15')][_0xebe9('0x14')]);}})[_0xebe9('0x16')](function(_0x10f012){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x2dc8c,_0x10f012);_0x234fc2(_0x10f012);});});}exports['CreateFaxQueueReport']=function(_0x47c188){var _0x13167c=this;return new Promise(function(_0xc58a78,_0xc21fb8){return db[_0xebe9('0x17')][_0xebe9('0x18')](_0x47c188[_0xebe9('0x19')],{'raw':_0x47c188[_0xebe9('0x1a')]?_0x47c188['options'][_0xebe9('0x1b')]===undefined?!![]:![]:!![]})[_0xebe9('0xd')](function(_0x39ca17){logger[_0xebe9('0xe')](_0xebe9('0x1c'),_0x47c188);logger[_0xebe9('0x1d')](_0xebe9('0x1c'),_0x47c188,JSON[_0xebe9('0x11')](_0x39ca17));_0xc58a78(_0x39ca17);})['catch'](function(_0x4bfe78){logger[_0xebe9('0x12')](_0xebe9('0x1c'),_0x4bfe78['message'],_0x47c188);_0xc21fb8(_0x13167c['error'](0x1f4,_0x4bfe78[_0xebe9('0x14')]));});});};exports[_0xebe9('0x1e')]=function(_0xfba560){var _0x5774c9=this;return new Promise(function(_0x7f81e1,_0x171bf3){return db[_0xebe9('0x17')]['update'](_0xfba560[_0xebe9('0x19')],{'raw':_0xfba560[_0xebe9('0x1a')]?_0xfba560[_0xebe9('0x1a')][_0xebe9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfba560[_0xebe9('0x1a')]?_0xfba560[_0xebe9('0x1a')][_0xebe9('0x1f')]||null:null,'attributes':_0xfba560[_0xebe9('0x1a')]?_0xfba560[_0xebe9('0x1a')][_0xebe9('0x20')]||null:null,'limit':_0xfba560[_0xebe9('0x1a')]?_0xfba560[_0xebe9('0x1a')]['limit']||null:null})[_0xebe9('0xd')](function(_0x3c4111){logger[_0xebe9('0xe')]('UpdateFaxQueueReport',_0xfba560);logger[_0xebe9('0x1d')](_0xebe9('0x1e'),_0xfba560,JSON[_0xebe9('0x11')](_0x3c4111));_0x7f81e1(_0x3c4111);})['catch'](function(_0x410cea){logger[_0xebe9('0x12')](_0xebe9('0x1e'),_0x410cea[_0xebe9('0x14')],_0xfba560);_0x171bf3(_0x5774c9[_0xebe9('0x12')](0x1f4,_0x410cea[_0xebe9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 6c6c77b..e0652f1 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 _0xb647=['fs-extra','./faxQueueReport.controller','isAuthenticated','index','get','/:id','post','create','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x4ac228,_0x307a85){var _0x3c55ef=function(_0x15ff5f){while(--_0x15ff5f){_0x4ac228['push'](_0x4ac228['shift']());}};_0x3c55ef(++_0x307a85);}(_0xb647,0xdc));var _0x7b64=function(_0x51d646,_0xba537d){_0x51d646=_0x51d646-0x0;var _0x33c5dd=_0xb647[_0x51d646];return _0x33c5dd;};'use strict';var multer=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7b64('0x2'));var router=express[_0x7b64('0x3')]();var fs_extra=require(_0x7b64('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7b64('0x5'));router['get']('/',auth[_0x7b64('0x6')](),controller[_0x7b64('0x7')]);router[_0x7b64('0x8')]('/describe',auth[_0x7b64('0x6')](),controller['describe']);router[_0x7b64('0x8')](_0x7b64('0x9'),auth[_0x7b64('0x6')](),controller['show']);router[_0x7b64('0xa')]('/',auth['isAuthenticated'](),controller[_0x7b64('0xb')]);router['put'](_0x7b64('0x9'),auth['isAuthenticated'](),controller[_0x7b64('0xc')]);router[_0x7b64('0xd')]('/:id',auth[_0x7b64('0x6')](),controller[_0x7b64('0xe')]);module[_0x7b64('0xf')]=router; \ No newline at end of file +var _0x2af8=['./faxQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy','exports','path','../../components/auth/service','../../config/environment'];(function(_0x4da800,_0x4953df){var _0x545762=function(_0x519c1d){while(--_0x519c1d){_0x4da800['push'](_0x4da800['shift']());}};_0x545762(++_0x4953df);}(_0x2af8,0x84));var _0x82af=function(_0xca877,_0x1ad358){_0xca877=_0xca877-0x0;var _0x3d7691=_0x2af8[_0xca877];return _0x3d7691;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x82af('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x82af('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x82af('0x2'));var controller=require(_0x82af('0x3'));router[_0x82af('0x4')]('/',auth[_0x82af('0x5')](),controller['index']);router['get'](_0x82af('0x6'),auth[_0x82af('0x5')](),controller['describe']);router[_0x82af('0x4')](_0x82af('0x7'),auth[_0x82af('0x5')](),controller[_0x82af('0x8')]);router[_0x82af('0x9')]('/',auth['isAuthenticated'](),controller[_0x82af('0xa')]);router[_0x82af('0xb')](_0x82af('0x7'),auth[_0x82af('0x5')](),controller['update']);router[_0x82af('0xc')](_0x82af('0x7'),auth[_0x82af('0x5')](),controller[_0x82af('0xd')]);module[_0x82af('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e4d5248..d871f77 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x38c471,_0x2ed1f1){var _0x48bea3=function(_0x4ea144){while(--_0x4ea144){_0x38c471['push'](_0x38c471['shift']());}};_0x48bea3(++_0x2ed1f1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4d3b0c,_0x2d0094){_0x4d3b0c=_0x4d3b0c-0x0;var _0x53ad72=_0xf4eb[_0x4d3b0c];return _0x53ad72;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0xb43b,0x1b2));var _0xbb43=function(_0x342f96,_0x341e20){_0x342f96=_0x342f96-0x0;var _0xe25eec=_0xb43b[_0x342f96];return _0xe25eec;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 547eb06..a4c8414 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 _0x087e=['limit','set','Content-Range','apply','update','then','destroy','error','stack','send','map','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FaxTransferReport','count','include','findAll','catch','show','params','rawAttributes','length','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x087e,0xc4));var _0xe087=function(_0x69fee9,_0x9fe92b){_0x69fee9=_0x69fee9-0x0;var _0x4c977e=_0x087e[_0x69fee9];return _0x4c977e;};'use strict';var emlformat=require(_0xe087('0x0'));var rimraf=require(_0xe087('0x1'));var zipdir=require(_0xe087('0x2'));var jsonpatch=require(_0xe087('0x3'));var rp=require(_0xe087('0x4'));var moment=require('moment');var BPromise=require(_0xe087('0x5'));var Mustache=require(_0xe087('0x6'));var util=require(_0xe087('0x7'));var path=require(_0xe087('0x8'));var sox=require(_0xe087('0x9'));var csv=require(_0xe087('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe087('0xb'));var _=require(_0xe087('0xc'));var squel=require(_0xe087('0xd'));var crypto=require(_0xe087('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe087('0xa'));var querystring=require(_0xe087('0xf'));var Papa=require(_0xe087('0x10'));var Redis=require(_0xe087('0x11'));var authService=require(_0xe087('0x12'));var qs=require(_0xe087('0x13'));var as=require(_0xe087('0x14'));var hardwareService=require(_0xe087('0x15'));var logger=require(_0xe087('0x16'))('api');var utils=require(_0xe087('0x17'));var config=require(_0xe087('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe087('0x19'))['db'];function respondWithStatusCode(_0x49355b,_0x1d01b9){_0x1d01b9=_0x1d01b9||0xcc;return function(_0x504e17){if(_0x504e17){return _0x49355b[_0xe087('0x1a')](_0x1d01b9);}return _0x49355b['status'](_0x1d01b9)[_0xe087('0x1b')]();};}function respondWithResult(_0x18a287,_0x3bb9a9){_0x3bb9a9=_0x3bb9a9||0xc8;return function(_0x1bcf10){if(_0x1bcf10){return _0x18a287[_0xe087('0x1c')](_0x3bb9a9)[_0xe087('0x1d')](_0x1bcf10);}};}function respondWithFilteredResult(_0x5fba9,_0x289854){return function(_0x238187){if(_0x238187){var _0x503d21=typeof _0x289854[_0xe087('0x1e')]===_0xe087('0x1f')&&typeof _0x289854['limit']===_0xe087('0x1f');var _0x24f2c0=_0x238187['count'];var _0x3ecb66=_0x503d21?0x0:_0x289854[_0xe087('0x1e')];var _0x32f8a8=_0x503d21?_0x238187['count']:_0x289854[_0xe087('0x1e')]+_0x289854[_0xe087('0x20')];var _0x5c0d60;if(_0x32f8a8>=_0x24f2c0){_0x32f8a8=_0x24f2c0;_0x5c0d60=0xc8;}else{_0x5c0d60=0xce;}_0x5fba9[_0xe087('0x1c')](_0x5c0d60);return _0x5fba9[_0xe087('0x21')](_0xe087('0x22'),_0x3ecb66+'-'+_0x32f8a8+'/'+_0x24f2c0)['json'](_0x238187);}return null;};}function patchUpdates(_0x1010d1){return function(_0x4e76a8){try{jsonpatch[_0xe087('0x23')](_0x4e76a8,_0x1010d1,!![]);}catch(_0xa43e04){return BPromise['reject'](_0xa43e04);}return _0x4e76a8['save']();};}function saveUpdates(_0xa0f285,_0x2e3b24){return function(_0x4b8db9){if(_0x4b8db9){return _0x4b8db9[_0xe087('0x24')](_0xa0f285)[_0xe087('0x25')](function(_0x5cde8c){return _0x5cde8c;});}return null;};}function removeEntity(_0x1da402,_0x423c0b){return function(_0x122825){if(_0x122825){return _0x122825[_0xe087('0x26')]()[_0xe087('0x25')](function(){_0x1da402[_0xe087('0x1c')](0xcc)[_0xe087('0x1b')]();});}};}function handleEntityNotFound(_0x4576b0,_0x4420a7){return function(_0x502483){if(!_0x502483){_0x4576b0[_0xe087('0x1a')](0x194);}return _0x502483;};}function handleError(_0x1078dc,_0x4c7bd5){_0x4c7bd5=_0x4c7bd5||0x1f4;return function(_0x7f9210){logger[_0xe087('0x27')](_0x7f9210[_0xe087('0x28')]);if(_0x7f9210['name']){delete _0x7f9210['name'];}_0x1078dc[_0xe087('0x1c')](_0x4c7bd5)[_0xe087('0x29')](_0x7f9210);};}exports['index']=function(_0x46ab16,_0x2cc82a){var _0x226a3a={},_0x14dc6e={},_0x54deb4={'count':0x0,'rows':[]};var _0x58dd1b=_[_0xe087('0x2a')](db['FaxTransferReport']['rawAttributes'],function(_0x903355){return{'name':_0x903355['fieldName'],'type':_0x903355[_0xe087('0x2b')][_0xe087('0x2c')]};});_0x14dc6e[_0xe087('0x2d')]=_[_0xe087('0x2a')](_0x58dd1b,_0xe087('0x2e'));_0x14dc6e[_0xe087('0x2f')]=_[_0xe087('0x30')](_0x46ab16['query']);_0x14dc6e[_0xe087('0x31')]=_[_0xe087('0x32')](_0x14dc6e[_0xe087('0x2d')],_0x14dc6e[_0xe087('0x2f')]);_0x226a3a[_0xe087('0x33')]=_[_0xe087('0x32')](_0x14dc6e[_0xe087('0x2d')],qs[_0xe087('0x34')](_0x46ab16[_0xe087('0x2f')][_0xe087('0x34')]));_0x226a3a[_0xe087('0x33')]=_0x226a3a[_0xe087('0x33')]['length']?_0x226a3a[_0xe087('0x33')]:_0x14dc6e['model'];if(!_0x46ab16[_0xe087('0x2f')][_0xe087('0x35')](_0xe087('0x36'))){_0x226a3a[_0xe087('0x20')]=qs['limit'](_0x46ab16[_0xe087('0x2f')]['limit']);_0x226a3a[_0xe087('0x1e')]=qs['offset'](_0x46ab16[_0xe087('0x2f')][_0xe087('0x1e')]);}_0x226a3a[_0xe087('0x37')]=qs[_0xe087('0x38')](_0x46ab16[_0xe087('0x2f')]['sort']);_0x226a3a[_0xe087('0x39')]=qs[_0xe087('0x31')](_[_0xe087('0x3a')](_0x46ab16[_0xe087('0x2f')],_0x14dc6e[_0xe087('0x31')]),_0x58dd1b);if(_0x46ab16[_0xe087('0x2f')][_0xe087('0x3b')]){_0x226a3a[_0xe087('0x39')]=_[_0xe087('0x3c')](_0x226a3a[_0xe087('0x39')],{'$or':_[_0xe087('0x2a')](_0x58dd1b,function(_0xfa0313){if(_0xfa0313['type']!==_0xe087('0x3d')){var _0x73d671={};_0x73d671[_0xfa0313[_0xe087('0x2e')]]={'$like':'%'+_0x46ab16[_0xe087('0x2f')][_0xe087('0x3b')]+'%'};return _0x73d671;}})});}_0x226a3a=_[_0xe087('0x3c')]({},_0x226a3a,_0x46ab16['options']);var _0x4c1835={'where':_0x226a3a[_0xe087('0x39')]};return db[_0xe087('0x3e')][_0xe087('0x3f')](_0x4c1835)[_0xe087('0x25')](function(_0x474167){_0x54deb4[_0xe087('0x3f')]=_0x474167;if(_0x46ab16[_0xe087('0x2f')]['includeAll']){_0x226a3a[_0xe087('0x40')]=[{'all':!![]}];}return db[_0xe087('0x3e')][_0xe087('0x41')](_0x226a3a);})[_0xe087('0x25')](function(_0x21e268){_0x54deb4['rows']=_0x21e268;return _0x54deb4;})[_0xe087('0x25')](respondWithFilteredResult(_0x2cc82a,_0x226a3a))[_0xe087('0x42')](handleError(_0x2cc82a,null));};exports[_0xe087('0x43')]=function(_0x485e48,_0x1d7ae2){var _0x2015a2={'raw':!![],'where':{'id':_0x485e48[_0xe087('0x44')]['id']}},_0x2c5c01={};_0x2c5c01[_0xe087('0x2d')]=_[_0xe087('0x30')](db[_0xe087('0x3e')][_0xe087('0x45')]);_0x2c5c01[_0xe087('0x2f')]=_['keys'](_0x485e48['query']);_0x2c5c01['filters']=_[_0xe087('0x32')](_0x2c5c01[_0xe087('0x2d')],_0x2c5c01[_0xe087('0x2f')]);_0x2015a2['attributes']=_[_0xe087('0x32')](_0x2c5c01[_0xe087('0x2d')],qs[_0xe087('0x34')](_0x485e48[_0xe087('0x2f')][_0xe087('0x34')]));_0x2015a2[_0xe087('0x33')]=_0x2015a2['attributes'][_0xe087('0x46')]?_0x2015a2['attributes']:_0x2c5c01[_0xe087('0x2d')];if(_0x485e48['query']['includeAll']){_0x2015a2[_0xe087('0x40')]=[{'all':!![]}];}_0x2015a2=_[_0xe087('0x3c')]({},_0x2015a2,_0x485e48[_0xe087('0x47')]);return db[_0xe087('0x3e')]['find'](_0x2015a2)[_0xe087('0x25')](handleEntityNotFound(_0x1d7ae2,null))[_0xe087('0x25')](respondWithResult(_0x1d7ae2,null))[_0xe087('0x42')](handleError(_0x1d7ae2,null));};exports[_0xe087('0x48')]=function(_0x3060ee,_0x290ff1){return db[_0xe087('0x3e')][_0xe087('0x48')](_0x3060ee['body'],{})[_0xe087('0x25')](respondWithResult(_0x290ff1,0xc9))[_0xe087('0x42')](handleError(_0x290ff1,null));};exports['update']=function(_0x566f65,_0x4c1ef7){if(_0x566f65[_0xe087('0x49')]['id']){delete _0x566f65[_0xe087('0x49')]['id'];}return db[_0xe087('0x3e')][_0xe087('0x4a')]({'where':{'id':_0x566f65[_0xe087('0x44')]['id']}})[_0xe087('0x25')](handleEntityNotFound(_0x4c1ef7,null))['then'](saveUpdates(_0x566f65[_0xe087('0x49')],null))[_0xe087('0x25')](respondWithResult(_0x4c1ef7,null))['catch'](handleError(_0x4c1ef7,null));};exports[_0xe087('0x26')]=function(_0x5a5ea7,_0x471339){return db[_0xe087('0x3e')]['find']({'where':{'id':_0x5a5ea7[_0xe087('0x44')]['id']}})['then'](handleEntityNotFound(_0x471339,null))[_0xe087('0x25')](removeEntity(_0x471339,null))[_0xe087('0x42')](handleError(_0x471339,null));};exports[_0xe087('0x4b')]=function(_0x5ed599,_0x54132e){return db[_0xe087('0x3e')][_0xe087('0x4b')]()['then'](respondWithResult(_0x54132e,null))[_0xe087('0x42')](handleError(_0x54132e,null));}; \ No newline at end of file +var _0xba03=['set','json','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','limit','order','sort','filters','pick','filter','merge','VIRTUAL','where','FaxTransferReport','includeAll','include','findAll','catch','show','length','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count'];(function(_0x2be0eb,_0x1cf0e5){var _0x233b8d=function(_0x292767){while(--_0x292767){_0x2be0eb['push'](_0x2be0eb['shift']());}};_0x233b8d(++_0x1cf0e5);}(_0xba03,0xc3));var _0x3ba0=function(_0xa5f9ce,_0x13d865){_0xa5f9ce=_0xa5f9ce-0x0;var _0x23e116=_0xba03[_0xa5f9ce];return _0x23e116;};'use strict';var emlformat=require(_0x3ba0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ba0('0x1'));var jsonpatch=require(_0x3ba0('0x2'));var rp=require(_0x3ba0('0x3'));var moment=require(_0x3ba0('0x4'));var BPromise=require(_0x3ba0('0x5'));var Mustache=require(_0x3ba0('0x6'));var util=require(_0x3ba0('0x7'));var path=require(_0x3ba0('0x8'));var sox=require('sox');var csv=require(_0x3ba0('0x9'));var ejs=require(_0x3ba0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3ba0('0xb'));var crypto=require('crypto');var jsforce=require(_0x3ba0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3ba0('0x9'));var querystring=require(_0x3ba0('0xd'));var Papa=require(_0x3ba0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3ba0('0xf'));var as=require(_0x3ba0('0x10'));var hardwareService=require(_0x3ba0('0x11'));var logger=require(_0x3ba0('0x12'))(_0x3ba0('0x13'));var utils=require(_0x3ba0('0x14'));var config=require(_0x3ba0('0x15'));var licenseUtil=require(_0x3ba0('0x16'));var db=require(_0x3ba0('0x17'))['db'];function respondWithStatusCode(_0xd5fc37,_0x5d5cef){_0x5d5cef=_0x5d5cef||0xcc;return function(_0x54ba20){if(_0x54ba20){return _0xd5fc37[_0x3ba0('0x18')](_0x5d5cef);}return _0xd5fc37[_0x3ba0('0x19')](_0x5d5cef)[_0x3ba0('0x1a')]();};}function respondWithResult(_0x3f2aa2,_0x425dd4){_0x425dd4=_0x425dd4||0xc8;return function(_0x15b2d7){if(_0x15b2d7){return _0x3f2aa2[_0x3ba0('0x19')](_0x425dd4)['json'](_0x15b2d7);}};}function respondWithFilteredResult(_0x16b910,_0x4e3bc9){return function(_0x4717df){if(_0x4717df){var _0x5e31e5=typeof _0x4e3bc9[_0x3ba0('0x1b')]===_0x3ba0('0x1c')&&typeof _0x4e3bc9['limit']===_0x3ba0('0x1c');var _0x4a5a72=_0x4717df[_0x3ba0('0x1d')];var _0x260f89=_0x5e31e5?0x0:_0x4e3bc9[_0x3ba0('0x1b')];var _0x241568=_0x5e31e5?_0x4717df[_0x3ba0('0x1d')]:_0x4e3bc9[_0x3ba0('0x1b')]+_0x4e3bc9['limit'];var _0x3f79da;if(_0x241568>=_0x4a5a72){_0x241568=_0x4a5a72;_0x3f79da=0xc8;}else{_0x3f79da=0xce;}_0x16b910[_0x3ba0('0x19')](_0x3f79da);return _0x16b910[_0x3ba0('0x1e')]('Content-Range',_0x260f89+'-'+_0x241568+'/'+_0x4a5a72)[_0x3ba0('0x1f')](_0x4717df);}return null;};}function patchUpdates(_0x1d2515){return function(_0x3ce7c7){try{jsonpatch[_0x3ba0('0x20')](_0x3ce7c7,_0x1d2515,!![]);}catch(_0x49efa3){return BPromise[_0x3ba0('0x21')](_0x49efa3);}return _0x3ce7c7[_0x3ba0('0x22')]();};}function saveUpdates(_0xd8f6e4,_0x3819d1){return function(_0x395adc){if(_0x395adc){return _0x395adc['update'](_0xd8f6e4)[_0x3ba0('0x23')](function(_0x277cd6){return _0x277cd6;});}return null;};}function removeEntity(_0x4e7aef,_0x1cf121){return function(_0x3a30e1){if(_0x3a30e1){return _0x3a30e1[_0x3ba0('0x24')]()[_0x3ba0('0x23')](function(){_0x4e7aef[_0x3ba0('0x19')](0xcc)[_0x3ba0('0x1a')]();});}};}function handleEntityNotFound(_0x34f5b2,_0x32d0a7){return function(_0x19aefb){if(!_0x19aefb){_0x34f5b2[_0x3ba0('0x18')](0x194);}return _0x19aefb;};}function handleError(_0x1daf7c,_0x4f3e8b){_0x4f3e8b=_0x4f3e8b||0x1f4;return function(_0x328f19){logger['error'](_0x328f19[_0x3ba0('0x25')]);if(_0x328f19[_0x3ba0('0x26')]){delete _0x328f19[_0x3ba0('0x26')];}_0x1daf7c['status'](_0x4f3e8b)[_0x3ba0('0x27')](_0x328f19);};}exports[_0x3ba0('0x28')]=function(_0x65b0cc,_0x383dee){var _0xc3595e={},_0xe08d16={},_0x38568d={'count':0x0,'rows':[]};var _0x160082=_[_0x3ba0('0x29')](db['FaxTransferReport'][_0x3ba0('0x2a')],function(_0x4d0a80){return{'name':_0x4d0a80[_0x3ba0('0x2b')],'type':_0x4d0a80[_0x3ba0('0x2c')][_0x3ba0('0x2d')]};});_0xe08d16[_0x3ba0('0x2e')]=_[_0x3ba0('0x29')](_0x160082,_0x3ba0('0x26'));_0xe08d16[_0x3ba0('0x2f')]=_[_0x3ba0('0x30')](_0x65b0cc[_0x3ba0('0x2f')]);_0xe08d16['filters']=_['intersection'](_0xe08d16[_0x3ba0('0x2e')],_0xe08d16[_0x3ba0('0x2f')]);_0xc3595e['attributes']=_[_0x3ba0('0x31')](_0xe08d16[_0x3ba0('0x2e')],qs[_0x3ba0('0x32')](_0x65b0cc[_0x3ba0('0x2f')][_0x3ba0('0x32')]));_0xc3595e[_0x3ba0('0x33')]=_0xc3595e[_0x3ba0('0x33')]['length']?_0xc3595e[_0x3ba0('0x33')]:_0xe08d16[_0x3ba0('0x2e')];if(!_0x65b0cc[_0x3ba0('0x2f')]['hasOwnProperty'](_0x3ba0('0x34'))){_0xc3595e['limit']=qs[_0x3ba0('0x35')](_0x65b0cc['query'][_0x3ba0('0x35')]);_0xc3595e[_0x3ba0('0x1b')]=qs[_0x3ba0('0x1b')](_0x65b0cc[_0x3ba0('0x2f')][_0x3ba0('0x1b')]);}_0xc3595e[_0x3ba0('0x36')]=qs[_0x3ba0('0x37')](_0x65b0cc[_0x3ba0('0x2f')]['sort']);_0xc3595e['where']=qs[_0x3ba0('0x38')](_[_0x3ba0('0x39')](_0x65b0cc[_0x3ba0('0x2f')],_0xe08d16[_0x3ba0('0x38')]),_0x160082);if(_0x65b0cc[_0x3ba0('0x2f')][_0x3ba0('0x3a')]){_0xc3595e['where']=_[_0x3ba0('0x3b')](_0xc3595e['where'],{'$or':_[_0x3ba0('0x29')](_0x160082,function(_0x1cb460){if(_0x1cb460['type']!==_0x3ba0('0x3c')){var _0x4104c6={};_0x4104c6[_0x1cb460[_0x3ba0('0x26')]]={'$like':'%'+_0x65b0cc[_0x3ba0('0x2f')][_0x3ba0('0x3a')]+'%'};return _0x4104c6;}})});}_0xc3595e=_[_0x3ba0('0x3b')]({},_0xc3595e,_0x65b0cc['options']);var _0x58c8b8={'where':_0xc3595e[_0x3ba0('0x3d')]};return db[_0x3ba0('0x3e')][_0x3ba0('0x1d')](_0x58c8b8)[_0x3ba0('0x23')](function(_0x49c408){_0x38568d[_0x3ba0('0x1d')]=_0x49c408;if(_0x65b0cc['query'][_0x3ba0('0x3f')]){_0xc3595e[_0x3ba0('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x3ba0('0x41')](_0xc3595e);})['then'](function(_0x44844a){_0x38568d['rows']=_0x44844a;return _0x38568d;})['then'](respondWithFilteredResult(_0x383dee,_0xc3595e))[_0x3ba0('0x42')](handleError(_0x383dee,null));};exports[_0x3ba0('0x43')]=function(_0x3d9477,_0x3e36a3){var _0x2d09d0={'raw':!![],'where':{'id':_0x3d9477['params']['id']}},_0xf299ba={};_0xf299ba[_0x3ba0('0x2e')]=_[_0x3ba0('0x30')](db[_0x3ba0('0x3e')][_0x3ba0('0x2a')]);_0xf299ba[_0x3ba0('0x2f')]=_[_0x3ba0('0x30')](_0x3d9477[_0x3ba0('0x2f')]);_0xf299ba[_0x3ba0('0x38')]=_[_0x3ba0('0x31')](_0xf299ba[_0x3ba0('0x2e')],_0xf299ba[_0x3ba0('0x2f')]);_0x2d09d0[_0x3ba0('0x33')]=_['intersection'](_0xf299ba[_0x3ba0('0x2e')],qs[_0x3ba0('0x32')](_0x3d9477[_0x3ba0('0x2f')]['fields']));_0x2d09d0[_0x3ba0('0x33')]=_0x2d09d0[_0x3ba0('0x33')][_0x3ba0('0x44')]?_0x2d09d0[_0x3ba0('0x33')]:_0xf299ba[_0x3ba0('0x2e')];if(_0x3d9477[_0x3ba0('0x2f')]['includeAll']){_0x2d09d0[_0x3ba0('0x40')]=[{'all':!![]}];}_0x2d09d0=_[_0x3ba0('0x3b')]({},_0x2d09d0,_0x3d9477[_0x3ba0('0x45')]);return db[_0x3ba0('0x3e')][_0x3ba0('0x46')](_0x2d09d0)['then'](handleEntityNotFound(_0x3e36a3,null))['then'](respondWithResult(_0x3e36a3,null))[_0x3ba0('0x42')](handleError(_0x3e36a3,null));};exports[_0x3ba0('0x47')]=function(_0x66fa4,_0x7e63d1){return db['FaxTransferReport'][_0x3ba0('0x47')](_0x66fa4['body'],{})[_0x3ba0('0x23')](respondWithResult(_0x7e63d1,0xc9))['catch'](handleError(_0x7e63d1,null));};exports['update']=function(_0x256c7e,_0x5670f6){if(_0x256c7e[_0x3ba0('0x48')]['id']){delete _0x256c7e['body']['id'];}return db[_0x3ba0('0x3e')][_0x3ba0('0x46')]({'where':{'id':_0x256c7e[_0x3ba0('0x49')]['id']}})[_0x3ba0('0x23')](handleEntityNotFound(_0x5670f6,null))[_0x3ba0('0x23')](saveUpdates(_0x256c7e[_0x3ba0('0x48')],null))[_0x3ba0('0x23')](respondWithResult(_0x5670f6,null))[_0x3ba0('0x42')](handleError(_0x5670f6,null));};exports[_0x3ba0('0x24')]=function(_0x52c165,_0x18b414){return db[_0x3ba0('0x3e')][_0x3ba0('0x46')]({'where':{'id':_0x52c165[_0x3ba0('0x49')]['id']}})[_0x3ba0('0x23')](handleEntityNotFound(_0x18b414,null))[_0x3ba0('0x23')](removeEntity(_0x18b414,null))['catch'](handleError(_0x18b414,null));};exports['describe']=function(_0x512ee7,_0x2aa762){return db['FaxTransferReport'][_0x3ba0('0x4a')]()['then'](respondWithResult(_0x2aa762,null))[_0x3ba0('0x42')](handleError(_0x2aa762,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index fd5c5a5..a3a5cc9 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 _0xb286=['../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','rimraf'];(function(_0x554d25,_0x28bea0){var _0x5f2346=function(_0x50c986){while(--_0x50c986){_0x554d25['push'](_0x554d25['shift']());}};_0x5f2346(++_0x28bea0);}(_0xb286,0x151));var _0x6b28=function(_0x312130,_0x47f809){_0x312130=_0x312130-0x0;var _0x6124df=_0xb286[_0x312130];return _0x6124df;};'use strict';var _=require(_0x6b28('0x0'));var util=require(_0x6b28('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b28('0x2'));var config=require(_0x6b28('0x3'));var attributes=require(_0x6b28('0x4'));module[_0x6b28('0x5')]=function(_0x32bc9d,_0x4e729f){return _0x32bc9d[_0x6b28('0x6')](_0x6b28('0x7'),attributes,{'tableName':_0x6b28('0x8'),'paranoid':![],'indexes':[{'name':_0x6b28('0x9'),'fields':[_0x6b28('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0590=['moment','request-promise','rimraf','../../config/environment','exports','define','report_fax_transfer','uniqueid','../../config/logger','api'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x0590,0x166));var _0x0059=function(_0x1a3672,_0xab77b5){_0x1a3672=_0x1a3672-0x0;var _0x3bba84=_0x0590[_0x1a3672];return _0x3bba84;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0059('0x0'))(_0x0059('0x1'));var moment=require(_0x0059('0x2'));var BPromise=require('bluebird');var rp=require(_0x0059('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0059('0x4'));var config=require(_0x0059('0x5'));var attributes=require('./faxTransferReport.attributes');module[_0x0059('0x6')]=function(_0xb88d6f,_0x489111){return _0xb88d6f[_0x0059('0x7')]('FaxTransferReport',attributes,{'tableName':_0x0059('0x8'),'paranoid':![],'indexes':[{'name':_0x0059('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index ebfa628..1d6202a 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 _0x4c56=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x36df32,_0x734258){var _0x2eeb1c=function(_0x443251){while(--_0x443251){_0x36df32['push'](_0x36df32['shift']());}};_0x2eeb1c(++_0x734258);}(_0x4c56,0x9a));var _0x64c5=function(_0x436356,_0x32d803){_0x436356=_0x436356-0x0;var _0x4b6edf=_0x4c56[_0x436356];return _0x4b6edf;};'use strict';var _=require(_0x64c5('0x0'));var util=require('util');var moment=require(_0x64c5('0x1'));var BPromise=require('bluebird');var rs=require(_0x64c5('0x2'));var fs=require('fs');var Redis=require(_0x64c5('0x3'));var db=require(_0x64c5('0x4'))['db'];var utils=require(_0x64c5('0x5'));var logger=require('../../config/logger')(_0x64c5('0x6'));var config=require(_0x64c5('0x7'));var jayson=require(_0x64c5('0x8'));var client=jayson[_0x64c5('0x9')][_0x64c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ea742,_0x35c27b,_0x45fc62){return new BPromise(function(_0x280bcc,_0x380cb9){return client['request'](_0x5ea742,_0x45fc62)[_0x64c5('0xb')](function(_0x5322d0){logger[_0x64c5('0xc')](_0x64c5('0xd'),_0x35c27b,_0x64c5('0xe'));logger[_0x64c5('0xf')](_0x64c5('0x10'),_0x35c27b,_0x64c5('0xe'),JSON['stringify'](_0x5322d0));if(_0x5322d0[_0x64c5('0x11')]){if(_0x5322d0[_0x64c5('0x11')][_0x64c5('0x12')]===0x1f4){logger[_0x64c5('0x11')](_0x64c5('0xd'),_0x35c27b,_0x5322d0[_0x64c5('0x11')][_0x64c5('0x13')]);return _0x380cb9(_0x5322d0['error'][_0x64c5('0x13')]);}logger[_0x64c5('0x11')](_0x64c5('0xd'),_0x35c27b,_0x5322d0['error'][_0x64c5('0x13')]);return _0x280bcc(_0x5322d0[_0x64c5('0x11')]['message']);}else{logger[_0x64c5('0xc')](_0x64c5('0xd'),_0x35c27b,'request\x20sent');_0x280bcc(_0x5322d0[_0x64c5('0x14')][_0x64c5('0x13')]);}})[_0x64c5('0x15')](function(_0x51e062){logger[_0x64c5('0x11')](_0x64c5('0xd'),_0x35c27b,_0x51e062);_0x380cb9(_0x51e062);});});} \ No newline at end of file +var _0xe29f=['util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','FaxTransferReport,\x20%s,\x20%s','result'];(function(_0x39b035,_0x1d78f6){var _0xd0bf39=function(_0x3de65e){while(--_0x3de65e){_0x39b035['push'](_0x39b035['shift']());}};_0xd0bf39(++_0x1d78f6);}(_0xe29f,0x104));var _0xfe29=function(_0x2a5783,_0x3aa31a){_0x2a5783=_0x2a5783-0x0;var _0x7ad639=_0xe29f[_0x2a5783];return _0x7ad639;};'use strict';var _=require('lodash');var util=require(_0xfe29('0x0'));var moment=require(_0xfe29('0x1'));var BPromise=require(_0xfe29('0x2'));var rs=require(_0xfe29('0x3'));var fs=require('fs');var Redis=require(_0xfe29('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfe29('0x5'));var config=require(_0xfe29('0x6'));var jayson=require(_0xfe29('0x7'));var client=jayson[_0xfe29('0x8')][_0xfe29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c212b,_0x2f8203,_0x2b475f){return new BPromise(function(_0x197abf,_0x1ded82){return client[_0xfe29('0xa')](_0x1c212b,_0x2b475f)[_0xfe29('0xb')](function(_0x464425){logger[_0xfe29('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x2f8203,_0xfe29('0xd'));logger[_0xfe29('0xe')](_0xfe29('0xf'),_0x2f8203,_0xfe29('0xd'),JSON['stringify'](_0x464425));if(_0x464425['error']){if(_0x464425[_0xfe29('0x10')]['code']===0x1f4){logger[_0xfe29('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x2f8203,_0x464425[_0xfe29('0x10')][_0xfe29('0x11')]);return _0x1ded82(_0x464425[_0xfe29('0x10')][_0xfe29('0x11')]);}logger[_0xfe29('0x10')](_0xfe29('0x12'),_0x2f8203,_0x464425[_0xfe29('0x10')][_0xfe29('0x11')]);return _0x197abf(_0x464425[_0xfe29('0x10')][_0xfe29('0x11')]);}else{logger['info'](_0xfe29('0x12'),_0x2f8203,_0xfe29('0xd'));_0x197abf(_0x464425[_0xfe29('0x13')]['message']);}})['catch'](function(_0x51b8d8){logger[_0xfe29('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x2f8203,_0x51b8d8);_0x1ded82(_0x51b8d8);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 6104d4b..23b7710 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 _0x410d=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','/:id','create','put','update','delete','exports'];(function(_0x3deb58,_0x1f3b8c){var _0x1f8f1a=function(_0x4ffae9){while(--_0x4ffae9){_0x3deb58['push'](_0x3deb58['shift']());}};_0x1f8f1a(++_0x1f3b8c);}(_0x410d,0x6c));var _0xd410=function(_0x15797a,_0x16274f){_0x15797a=_0x15797a-0x0;var _0x3e2618=_0x410d[_0x15797a];return _0x3e2618;};'use strict';var multer=require(_0xd410('0x0'));var util=require(_0xd410('0x1'));var path=require(_0xd410('0x2'));var timeout=require(_0xd410('0x3'));var express=require('express');var router=express[_0xd410('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd410('0x5'));var interaction=require(_0xd410('0x6'));var config=require(_0xd410('0x7'));var controller=require(_0xd410('0x8'));router[_0xd410('0x9')]('/',auth[_0xd410('0xa')](),controller['index']);router[_0xd410('0x9')](_0xd410('0xb'),auth[_0xd410('0xa')](),controller['describe']);router[_0xd410('0x9')](_0xd410('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd410('0xa')](),controller[_0xd410('0xd')]);router[_0xd410('0xe')]('/:id',auth[_0xd410('0xa')](),controller[_0xd410('0xf')]);router[_0xd410('0x10')](_0xd410('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd410('0x11')]=router; \ No newline at end of file +var _0x09f7=['../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x154476,_0x3e7d13){var _0x2289a1=function(_0x49b028){while(--_0x49b028){_0x154476['push'](_0x154476['shift']());}};_0x2289a1(++_0x3e7d13);}(_0x09f7,0x183));var _0x709f=function(_0x23196e,_0x55e4dd){_0x23196e=_0x23196e-0x0;var _0xd3b747=_0x09f7[_0x23196e];return _0xd3b747;};'use strict';var multer=require(_0x709f('0x0'));var util=require(_0x709f('0x1'));var path=require(_0x709f('0x2'));var timeout=require(_0x709f('0x3'));var express=require(_0x709f('0x4'));var router=express[_0x709f('0x5')]();var fs_extra=require(_0x709f('0x6'));var auth=require(_0x709f('0x7'));var interaction=require(_0x709f('0x8'));var config=require(_0x709f('0x9'));var controller=require(_0x709f('0xa'));router['get']('/',auth[_0x709f('0xb')](),controller[_0x709f('0xc')]);router['get']('/describe',auth[_0x709f('0xb')](),controller['describe']);router[_0x709f('0xd')](_0x709f('0xe'),auth[_0x709f('0xb')](),controller[_0x709f('0xf')]);router[_0x709f('0x10')]('/',auth[_0x709f('0xb')](),controller[_0x709f('0x11')]);router['put']('/:id',auth[_0x709f('0xb')](),controller[_0x709f('0x12')]);router[_0x709f('0x13')](_0x709f('0xe'),auth[_0x709f('0xb')](),controller[_0x709f('0x14')]);module[_0x709f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 78609f5..04927d9 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 _0xff12=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xff12,0x1de));var _0x2ff1=function(_0x1bdef4,_0x4c8e3a){_0x1bdef4=_0x1bdef4-0x0;var _0x2c475f=_0xff12[_0x1bdef4];return _0x2c475f;};'use strict';var multer=require(_0x2ff1('0x0'));var util=require(_0x2ff1('0x1'));var path=require(_0x2ff1('0x2'));var timeout=require(_0x2ff1('0x3'));var express=require(_0x2ff1('0x4'));var router=express[_0x2ff1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2ff1('0x6'));var config=require(_0x2ff1('0x7'));var controller=require('./intDeskAccount.controller');router[_0x2ff1('0x8')]('/',auth[_0x2ff1('0x9')](),controller['index']);router['get'](_0x2ff1('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x2ff1('0xb'),auth['isAuthenticated'](),controller[_0x2ff1('0xc')]);router[_0x2ff1('0x8')](_0x2ff1('0xd'),auth[_0x2ff1('0x9')](),controller[_0x2ff1('0xe')]);router[_0x2ff1('0xf')]('/',auth[_0x2ff1('0x9')](),controller[_0x2ff1('0x10')]);router['post'](_0x2ff1('0xb'),auth[_0x2ff1('0x9')](),controller[_0x2ff1('0x11')]);router['put'](_0x2ff1('0xa'),auth['isAuthenticated'](),controller[_0x2ff1('0x12')]);router[_0x2ff1('0x13')](_0x2ff1('0xa'),auth[_0x2ff1('0x9')](),controller[_0x2ff1('0x14')]);module[_0x2ff1('0x15')]=router; \ No newline at end of file +var _0xa2f2=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer'];(function(_0x1b55e3,_0x5407d7){var _0x2ed2d7=function(_0x4e503b){while(--_0x4e503b){_0x1b55e3['push'](_0x1b55e3['shift']());}};_0x2ed2d7(++_0x5407d7);}(_0xa2f2,0xae));var _0x2a2f=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xa2f2[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x2a2f('0x0'));var util=require(_0x2a2f('0x1'));var path=require(_0x2a2f('0x2'));var timeout=require(_0x2a2f('0x3'));var express=require(_0x2a2f('0x4'));var router=express[_0x2a2f('0x5')]();var fs_extra=require(_0x2a2f('0x6'));var auth=require(_0x2a2f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2a2f('0x8'));var controller=require(_0x2a2f('0x9'));router[_0x2a2f('0xa')]('/',auth[_0x2a2f('0xb')](),controller[_0x2a2f('0xc')]);router[_0x2a2f('0xa')](_0x2a2f('0xd'),auth[_0x2a2f('0xb')](),controller[_0x2a2f('0xe')]);router[_0x2a2f('0xa')](_0x2a2f('0xf'),auth[_0x2a2f('0xb')](),controller[_0x2a2f('0x10')]);router[_0x2a2f('0xa')](_0x2a2f('0x11'),auth[_0x2a2f('0xb')](),controller['getFields']);router[_0x2a2f('0x12')]('/',auth[_0x2a2f('0xb')](),controller[_0x2a2f('0x13')]);router[_0x2a2f('0x12')](_0x2a2f('0xf'),auth['isAuthenticated'](),controller[_0x2a2f('0x14')]);router[_0x2a2f('0x15')](_0x2a2f('0xd'),auth[_0x2a2f('0xb')](),controller[_0x2a2f('0x16')]);router[_0x2a2f('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2a2f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8bff799..9b985ef 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 _0x376e=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x521df7,_0x277fd6){var _0x4b57b5=function(_0x345f75){while(--_0x345f75){_0x521df7['push'](_0x521df7['shift']());}};_0x4b57b5(++_0x277fd6);}(_0x376e,0x1a0));var _0xe376=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x376e[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0xe376('0x0'));module[_0xe376('0x1')]={'name':{'type':Sequelize[_0xe376('0x2')]},'description':{'type':Sequelize[_0xe376('0x2')]},'username':{'type':Sequelize[_0xe376('0x2')]},'remoteUri':{'type':Sequelize[_0xe376('0x2')]},'authType':{'type':Sequelize[_0xe376('0x3')](_0xe376('0x4')),'defaultValue':_0xe376('0x4')},'password':{'type':Sequelize[_0xe376('0x2')]},'consumerKey':{'type':Sequelize[_0xe376('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe376('0x2')]},'tokenSecret':{'type':Sequelize[_0xe376('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe376('0x3')](_0xe376('0x5'),_0xe376('0x6')),'defaultValue':_0xe376('0x5')}}; \ No newline at end of file +var _0xb27b=['ENUM','basic','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x51b737,_0x5c8d30){var _0x2caf71=function(_0x32d9e0){while(--_0x32d9e0){_0x51b737['push'](_0x51b737['shift']());}};_0x2caf71(++_0x5c8d30);}(_0xb27b,0xc8));var _0xbb27=function(_0xe87972,_0x2ffd33){_0xe87972=_0xe87972-0x0;var _0x294722=_0xb27b[_0xe87972];return _0x294722;};'use strict';var Sequelize=require(_0xbb27('0x0'));module[_0xbb27('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbb27('0x2')]},'username':{'type':Sequelize[_0xbb27('0x2')]},'remoteUri':{'type':Sequelize[_0xbb27('0x2')]},'authType':{'type':Sequelize[_0xbb27('0x3')](_0xbb27('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xbb27('0x2')]},'consumerKey':{'type':Sequelize[_0xbb27('0x2')]},'consumerSecret':{'type':Sequelize[_0xbb27('0x2')]},'token':{'type':Sequelize[_0xbb27('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbb27('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xbb27('0x5')),'defaultValue':_0xbb27('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a2d39a4..a5ecd54 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 _0x3599=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','stack','name','send','index','DeskAccount','rawAttributes','type','key','map','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','merge','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','getConfigurations','findOne','DeskConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','Descriptions','DeskField','priority','authType','username','password','consumerKey','consumerSecret','slice','substring','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x454b4e,_0x37d9ad){var _0x553a78=function(_0x3c400e){while(--_0x3c400e){_0x454b4e['push'](_0x454b4e['shift']());}};_0x553a78(++_0x37d9ad);}(_0x3599,0x1af));var _0x9359=function(_0x400809,_0x26852e){_0x400809=_0x400809-0x0;var _0x2eb0d5=_0x3599[_0x400809];return _0x2eb0d5;};'use strict';var emlformat=require(_0x9359('0x0'));var rimraf=require(_0x9359('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9359('0x2'));var rp=require(_0x9359('0x3'));var moment=require(_0x9359('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9359('0x5'));var util=require(_0x9359('0x6'));var path=require(_0x9359('0x7'));var sox=require(_0x9359('0x8'));var csv=require('to-csv');var ejs=require(_0x9359('0x9'));var fs=require('fs');var fs_extra=require(_0x9359('0xa'));var _=require(_0x9359('0xb'));var squel=require(_0x9359('0xc'));var crypto=require(_0x9359('0xd'));var jsforce=require(_0x9359('0xe'));var deskjs=require(_0x9359('0xf'));var toCsv=require(_0x9359('0x10'));var querystring=require(_0x9359('0x11'));var Papa=require(_0x9359('0x12'));var Redis=require(_0x9359('0x13'));var authService=require(_0x9359('0x14'));var qs=require(_0x9359('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9359('0x16'));var utils=require(_0x9359('0x17'));var config=require(_0x9359('0x18'));var licenseUtil=require(_0x9359('0x19'));var db=require(_0x9359('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4b0f29,_0x33f6b5){_0x33f6b5=_0x33f6b5||0xcc;return function(_0x935431){if(_0x935431){return _0x4b0f29[_0x9359('0x1b')](_0x33f6b5);}return _0x4b0f29[_0x9359('0x1c')](_0x33f6b5)[_0x9359('0x1d')]();};}function respondWithResult(_0x1cb82a,_0x6dfc1e){_0x6dfc1e=_0x6dfc1e||0xc8;return function(_0x2b04e2){if(_0x2b04e2){return _0x1cb82a[_0x9359('0x1c')](_0x6dfc1e)[_0x9359('0x1e')](_0x2b04e2);}};}function respondWithFilteredResult(_0x47b412,_0x1f00fb){return function(_0xbe4424){if(_0xbe4424){var _0x5a7077=typeof _0x1f00fb[_0x9359('0x1f')]===_0x9359('0x20')&&typeof _0x1f00fb[_0x9359('0x21')]===_0x9359('0x20');var _0x215116=_0xbe4424[_0x9359('0x22')];var _0x158014=_0x5a7077?0x0:_0x1f00fb[_0x9359('0x1f')];var _0x12501d=_0x5a7077?_0xbe4424[_0x9359('0x22')]:_0x1f00fb[_0x9359('0x1f')]+_0x1f00fb['limit'];var _0x1c1fec;if(_0x12501d>=_0x215116){_0x12501d=_0x215116;_0x1c1fec=0xc8;}else{_0x1c1fec=0xce;}_0x47b412[_0x9359('0x1c')](_0x1c1fec);return _0x47b412[_0x9359('0x23')](_0x9359('0x24'),_0x158014+'-'+_0x12501d+'/'+_0x215116)[_0x9359('0x1e')](_0xbe4424);}return null;};}function patchUpdates(_0x23e29c){return function(_0x105fb1){try{jsonpatch['apply'](_0x105fb1,_0x23e29c,!![]);}catch(_0x82f859){return BPromise['reject'](_0x82f859);}return _0x105fb1['save']();};}function saveUpdates(_0x2e908c,_0x49791d){return function(_0x558b4b){if(_0x558b4b){return _0x558b4b[_0x9359('0x25')](_0x2e908c)['then'](function(_0x43b93d){return _0x43b93d;});}return null;};}function removeEntity(_0x4ebf15,_0x181a0b){return function(_0x479d8a){if(_0x479d8a){return _0x479d8a[_0x9359('0x26')]()[_0x9359('0x27')](function(){_0x4ebf15[_0x9359('0x1c')](0xcc)[_0x9359('0x1d')]();});}};}function handleEntityNotFound(_0x5d96d4,_0x7edca8){return function(_0x473eeb){if(!_0x473eeb){_0x5d96d4[_0x9359('0x1b')](0x194);}return _0x473eeb;};}function handleError(_0x10893e,_0x374e64){_0x374e64=_0x374e64||0x1f4;return function(_0x5eb990){logger['error'](_0x5eb990[_0x9359('0x28')]);if(_0x5eb990[_0x9359('0x29')]){delete _0x5eb990[_0x9359('0x29')];}_0x10893e[_0x9359('0x1c')](_0x374e64)[_0x9359('0x2a')](_0x5eb990);};}exports[_0x9359('0x2b')]=function(_0x957784,_0x49dfa6){var _0x5688e7={},_0x9d4b74={},_0x2ff807={'count':0x0,'rows':[]};var _0x4a7284=_['map'](db[_0x9359('0x2c')][_0x9359('0x2d')],function(_0x481da1){return{'name':_0x481da1['fieldName'],'type':_0x481da1[_0x9359('0x2e')][_0x9359('0x2f')]};});_0x9d4b74['model']=_[_0x9359('0x30')](_0x4a7284,'name');_0x9d4b74[_0x9359('0x31')]=_[_0x9359('0x32')](_0x957784[_0x9359('0x31')]);_0x9d4b74['filters']=_['intersection'](_0x9d4b74[_0x9359('0x33')],_0x9d4b74[_0x9359('0x31')]);_0x5688e7[_0x9359('0x34')]=_[_0x9359('0x35')](_0x9d4b74['model'],qs['fields'](_0x957784[_0x9359('0x31')][_0x9359('0x36')]));_0x5688e7['attributes']=_0x5688e7[_0x9359('0x34')][_0x9359('0x37')]?_0x5688e7[_0x9359('0x34')]:_0x9d4b74['model'];if(!_0x957784[_0x9359('0x31')]['hasOwnProperty'](_0x9359('0x38'))){_0x5688e7[_0x9359('0x21')]=qs[_0x9359('0x21')](_0x957784[_0x9359('0x31')][_0x9359('0x21')]);_0x5688e7[_0x9359('0x1f')]=qs['offset'](_0x957784[_0x9359('0x31')]['offset']);}_0x5688e7[_0x9359('0x39')]=qs['sort'](_0x957784[_0x9359('0x31')][_0x9359('0x3a')]);_0x5688e7[_0x9359('0x3b')]=qs[_0x9359('0x3c')](_['pick'](_0x957784[_0x9359('0x31')],_0x9d4b74['filters']),_0x4a7284);if(_0x957784[_0x9359('0x31')]['filter']){_0x5688e7[_0x9359('0x3b')]=_[_0x9359('0x3d')](_0x5688e7[_0x9359('0x3b')],{'$or':_[_0x9359('0x30')](_0x4a7284,function(_0x290f63){if(_0x290f63[_0x9359('0x2e')]!=='VIRTUAL'){var _0x4cf871={};_0x4cf871[_0x290f63['name']]={'$like':'%'+_0x957784[_0x9359('0x31')][_0x9359('0x3e')]+'%'};return _0x4cf871;}})});}_0x5688e7=_['merge']({},_0x5688e7,_0x957784['options']);var _0x1d4d04={'where':_0x5688e7[_0x9359('0x3b')]};return db[_0x9359('0x2c')][_0x9359('0x22')](_0x1d4d04)[_0x9359('0x27')](function(_0x16f36d){_0x2ff807[_0x9359('0x22')]=_0x16f36d;if(_0x957784['query'][_0x9359('0x3f')]){_0x5688e7[_0x9359('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0x9359('0x41')](_0x5688e7);})[_0x9359('0x27')](function(_0x3e3565){_0x2ff807[_0x9359('0x42')]=_0x3e3565;return _0x2ff807;})[_0x9359('0x27')](respondWithFilteredResult(_0x49dfa6,_0x5688e7))[_0x9359('0x43')](handleError(_0x49dfa6,null));};exports['show']=function(_0x3c7159,_0x32c2cf){var _0x249953={'raw':![],'where':{'id':_0x3c7159[_0x9359('0x44')]['id']}},_0x449018={};_0x449018[_0x9359('0x33')]=_['keys'](db['DeskAccount'][_0x9359('0x2d')]);_0x449018[_0x9359('0x31')]=_[_0x9359('0x32')](_0x3c7159['query']);_0x449018[_0x9359('0x3c')]=_[_0x9359('0x35')](_0x449018[_0x9359('0x33')],_0x449018[_0x9359('0x31')]);_0x249953[_0x9359('0x34')]=_['intersection'](_0x449018[_0x9359('0x33')],qs[_0x9359('0x36')](_0x3c7159[_0x9359('0x31')][_0x9359('0x36')]));_0x249953[_0x9359('0x34')]=_0x249953['attributes'][_0x9359('0x37')]?_0x249953['attributes']:_0x449018[_0x9359('0x33')];if(_0x3c7159[_0x9359('0x31')][_0x9359('0x3f')]){_0x249953[_0x9359('0x40')]=[{'all':!![]}];}_0x249953=_[_0x9359('0x3d')]({},_0x249953,_0x3c7159[_0x9359('0x45')]);return db['DeskAccount'][_0x9359('0x46')](_0x249953)[_0x9359('0x27')](handleEntityNotFound(_0x32c2cf,null))[_0x9359('0x27')](respondWithResult(_0x32c2cf,null))[_0x9359('0x43')](handleError(_0x32c2cf,null));};exports[_0x9359('0x47')]=function(_0x32da93,_0x378aca){return db['DeskAccount'][_0x9359('0x47')](_0x32da93['body'],{})[_0x9359('0x27')](respondWithResult(_0x378aca,0xc9))[_0x9359('0x43')](handleError(_0x378aca,null));};exports[_0x9359('0x25')]=function(_0x2f5713,_0x3dbdbf){if(_0x2f5713[_0x9359('0x48')]['id']){delete _0x2f5713[_0x9359('0x48')]['id'];}return db[_0x9359('0x2c')][_0x9359('0x46')]({'where':{'id':_0x2f5713[_0x9359('0x44')]['id']}})[_0x9359('0x27')](handleEntityNotFound(_0x3dbdbf,null))['then'](saveUpdates(_0x2f5713[_0x9359('0x48')],null))['then'](respondWithResult(_0x3dbdbf,null))[_0x9359('0x43')](handleError(_0x3dbdbf,null));};exports[_0x9359('0x26')]=function(_0x49971a,_0x6768f7){return db['DeskAccount'][_0x9359('0x46')]({'where':{'id':_0x49971a[_0x9359('0x44')]['id']}})[_0x9359('0x27')](handleEntityNotFound(_0x6768f7,null))[_0x9359('0x27')](removeEntity(_0x6768f7,null))['catch'](handleError(_0x6768f7,null));};exports[_0x9359('0x49')]=function(_0x4edb7b,_0x3af469,_0x4a8260){var _0x3c1713={};var _0x69ce2e={};var _0x5aac92;var _0x39aade;return db['DeskAccount'][_0x9359('0x4a')]({'where':{'id':_0x4edb7b[_0x9359('0x44')]['id']}})['then'](handleEntityNotFound(_0x3af469,null))[_0x9359('0x27')](function(_0x8f17fd){if(_0x8f17fd){_0x5aac92=_0x8f17fd;_0x69ce2e[_0x9359('0x33')]=_[_0x9359('0x32')](db[_0x9359('0x4b')][_0x9359('0x2d')]);_0x69ce2e[_0x9359('0x31')]=_['keys'](_0x4edb7b['query']);_0x69ce2e[_0x9359('0x3c')]=_['intersection'](_0x69ce2e[_0x9359('0x33')],_0x69ce2e[_0x9359('0x31')]);_0x3c1713[_0x9359('0x34')]=_[_0x9359('0x35')](_0x69ce2e[_0x9359('0x33')],qs[_0x9359('0x36')](_0x4edb7b[_0x9359('0x31')][_0x9359('0x36')]));_0x3c1713[_0x9359('0x34')]=_0x3c1713['attributes'][_0x9359('0x37')]?_0x3c1713['attributes']:_0x69ce2e['model'];_0x3c1713[_0x9359('0x39')]=qs['sort'](_0x4edb7b['query'][_0x9359('0x3a')]);_0x3c1713[_0x9359('0x3b')]=qs[_0x9359('0x3c')](_[_0x9359('0x4c')](_0x4edb7b[_0x9359('0x31')],_0x69ce2e[_0x9359('0x3c')]));if(_0x4edb7b[_0x9359('0x31')][_0x9359('0x3e')]){_0x3c1713[_0x9359('0x3b')]=_[_0x9359('0x3d')](_0x3c1713[_0x9359('0x3b')],{'$or':_[_0x9359('0x30')](_0x3c1713[_0x9359('0x34')],function(_0x5037bb){var _0x15a890={};_0x15a890[_0x5037bb]={'$like':'%'+_0x4edb7b[_0x9359('0x31')][_0x9359('0x3e')]+'%'};return _0x15a890;})});}_0x3c1713=_['merge']({},_0x3c1713,_0x4edb7b[_0x9359('0x45')]);return _0x5aac92['getConfigurations'](_0x3c1713);}})[_0x9359('0x27')](function(_0x431198){if(_0x431198){_0x39aade=_0x431198[_0x9359('0x37')];if(!_0x4edb7b[_0x9359('0x31')][_0x9359('0x4d')]('nolimit')){_0x3c1713[_0x9359('0x21')]=qs[_0x9359('0x21')](_0x4edb7b['query'][_0x9359('0x21')]);_0x3c1713['offset']=qs[_0x9359('0x1f')](_0x4edb7b[_0x9359('0x31')]['offset']);}return _0x5aac92['getConfigurations'](_0x3c1713);}})[_0x9359('0x27')](function(_0xb759d6){if(_0xb759d6){return _0xb759d6?{'count':_0x39aade,'rows':_0xb759d6}:null;}})['then'](respondWithResult(_0x3af469,null))['catch'](handleError(_0x3af469,null));};exports[_0x9359('0x4e')]=function(_0x17c412,_0x52025b,_0xe1a3c1){if(_0x17c412[_0x9359('0x48')]['id']){delete _0x17c412[_0x9359('0x48')]['id'];}return db[_0x9359('0x2c')]['findOne']({'where':{'id':_0x17c412[_0x9359('0x44')]['id']}})[_0x9359('0x27')](handleEntityNotFound(_0x52025b,null))[_0x9359('0x27')](function(_0x2ec440){if(_0x2ec440){_0x17c412[_0x9359('0x48')]['AccountId']=_0x2ec440['id'];_0x17c412[_0x9359('0x48')][_0x9359('0x4f')]=integrations[_0x9359('0x50')](_0x17c412['body']['channel'],_0x17c412[_0x9359('0x48')][_0x9359('0x2e')]);_0x17c412[_0x9359('0x48')][_0x9359('0x51')]=integrations['getDescriptions'](_0x17c412[_0x9359('0x48')]['channel'],_0x17c412[_0x9359('0x48')][_0x9359('0x2e')]);return db['DeskConfiguration'][_0x9359('0x47')](_0x17c412[_0x9359('0x48')],{'include':[{'model':db[_0x9359('0x52')],'as':'Subjects'},{'model':db[_0x9359('0x52')],'as':_0x9359('0x51')}]});}return null;})[_0x9359('0x27')](respondWithResult(_0x52025b,null))[_0x9359('0x43')](handleError(_0x52025b,null));};exports['getFields']=function(_0xb9b3f3,_0xb70c6a,_0x8d6fc2){var _0x14dbc6=[{'name':_0x9359('0x53'),'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 _0x5a897e='';return db[_0x9359('0x2c')][_0x9359('0x4a')]({'where':{'id':_0xb9b3f3[_0x9359('0x44')]['id']},'attributes':['id','remoteUri',_0x9359('0x54'),_0x9359('0x55'),_0x9359('0x56'),_0x9359('0x57'),_0x9359('0x58'),'token','tokenSecret']})[_0x9359('0x27')](handleEntityNotFound(_0xb70c6a,null))[_0x9359('0x27')](function(_0x53473c){if(_0x53473c){_0x5a897e=_0x53473c['remoteUri'];var _0xa4f658=_0x5a897e[_0x9359('0x59')](-0x1);if(_0xa4f658==='/'){_0x5a897e=_0x5a897e[_0x9359('0x5a')](0x0,_0x5a897e['lastIndexOf'](_0xa4f658));}var _0x49a0a8={'method':'GET','uri':util[_0x9359('0x5b')](_0x9359('0x5c'),_0x5a897e),'headers':{'Content-Type':_0x9359('0x5d'),'Accept':_0x9359('0x5d')},'json':!![]};if(_0x53473c[_0x9359('0x54')]===_0x9359('0x5e')){_0x49a0a8[_0x9359('0x5f')][_0x9359('0x60')]=util[_0x9359('0x5b')](_0x9359('0x61'),new Buffer(util[_0x9359('0x5b')](_0x9359('0x62'),_0x53473c[_0x9359('0x55')],_0x53473c[_0x9359('0x56')]))['toString'](_0x9359('0x63')));}return rp(_0x49a0a8)[_0x9359('0x27')](function(_0x135fcb){return _0x14dbc6[_0x9359('0x64')](_[_0x9359('0x30')](_0x135fcb[_0x9359('0x65')]['entries'],function(_0x5aea7d){return{'id':_0x5aea7d['name'],'name':_0x5aea7d[_0x9359('0x29')],'type':_0x5aea7d[_0x9359('0x2e')],'active':_0x5aea7d[_0x9359('0x66')],'label':_0x5aea7d[_0x9359('0x67')],'custom':!![]};}));});}})['then'](function(_0xbd983d){return{'count':_0xbd983d['length'],'rows':_0xbd983d};})[_0x9359('0x27')](respondWithResult(_0xb70c6a,null))[_0x9359('0x43')](function(_0x479932){var _0x19ca10=_0xb9b3f3[_0x9359('0x31')][_0x9359('0x68')]?0x1f4:_0x479932[_0x9359('0x69')]||0x1f4;logger['error'](_0x9359('0x6a'),_0x9359('0x6b'),_0x19ca10,JSON[_0x9359('0x6c')](_0x479932));delete _0x479932[_0x9359('0x29')];if(_0x19ca10===0x191){_0x19ca10=0x190;}_0xb70c6a['status'](_0x19ca10)[_0x9359('0x2a')](_0xb9b3f3['query'][_0x9359('0x68')]?{'message':_0x9359('0x6d'),'statusCode':_0x479932[_0x9359('0x69')]}:_0x479932);});}; \ No newline at end of file +var _0xe40d=['Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','DeskAccount','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','length','pick','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskConfiguration','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','headers'];(function(_0x4c0708,_0x58cdbd){var _0x4e2ddd=function(_0x242f47){while(--_0x242f47){_0x4c0708['push'](_0x4c0708['shift']());}};_0x4e2ddd(++_0x58cdbd);}(_0xe40d,0x81));var _0xde40=function(_0x4ef43a,_0x4c6b6a){_0x4ef43a=_0x4ef43a-0x0;var _0x39453b=_0xe40d[_0x4ef43a];return _0x39453b;};'use strict';var emlformat=require(_0xde40('0x0'));var rimraf=require(_0xde40('0x1'));var zipdir=require(_0xde40('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde40('0x3'));var moment=require(_0xde40('0x4'));var BPromise=require(_0xde40('0x5'));var Mustache=require('mustache');var util=require(_0xde40('0x6'));var path=require(_0xde40('0x7'));var sox=require(_0xde40('0x8'));var csv=require('to-csv');var ejs=require(_0xde40('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xde40('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xde40('0xb'));var toCsv=require(_0xde40('0xc'));var querystring=require(_0xde40('0xd'));var Papa=require(_0xde40('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xde40('0xf'));var as=require(_0xde40('0x10'));var hardwareService=require(_0xde40('0x11'));var logger=require(_0xde40('0x12'))('api');var utils=require(_0xde40('0x13'));var config=require(_0xde40('0x14'));var licenseUtil=require(_0xde40('0x15'));var db=require(_0xde40('0x16'))['db'];var integrations=require(_0xde40('0x17'));function respondWithStatusCode(_0x466052,_0x17ab0d){_0x17ab0d=_0x17ab0d||0xcc;return function(_0x4af6cd){if(_0x4af6cd){return _0x466052['sendStatus'](_0x17ab0d);}return _0x466052[_0xde40('0x18')](_0x17ab0d)[_0xde40('0x19')]();};}function respondWithResult(_0x31884d,_0x30f5da){_0x30f5da=_0x30f5da||0xc8;return function(_0x1718fd){if(_0x1718fd){return _0x31884d[_0xde40('0x18')](_0x30f5da)[_0xde40('0x1a')](_0x1718fd);}};}function respondWithFilteredResult(_0x41a440,_0xeced7b){return function(_0x36a03f){if(_0x36a03f){var _0x4d76ad=typeof _0xeced7b[_0xde40('0x1b')]==='undefined'&&typeof _0xeced7b[_0xde40('0x1c')]===_0xde40('0x1d');var _0x390d68=_0x36a03f[_0xde40('0x1e')];var _0x27d693=_0x4d76ad?0x0:_0xeced7b[_0xde40('0x1b')];var _0x2ea4de=_0x4d76ad?_0x36a03f[_0xde40('0x1e')]:_0xeced7b[_0xde40('0x1b')]+_0xeced7b['limit'];var _0x443dea;if(_0x2ea4de>=_0x390d68){_0x2ea4de=_0x390d68;_0x443dea=0xc8;}else{_0x443dea=0xce;}_0x41a440[_0xde40('0x18')](_0x443dea);return _0x41a440[_0xde40('0x1f')]('Content-Range',_0x27d693+'-'+_0x2ea4de+'/'+_0x390d68)[_0xde40('0x1a')](_0x36a03f);}return null;};}function patchUpdates(_0x43ba87){return function(_0x43d2b1){try{jsonpatch[_0xde40('0x20')](_0x43d2b1,_0x43ba87,!![]);}catch(_0x566d22){return BPromise[_0xde40('0x21')](_0x566d22);}return _0x43d2b1[_0xde40('0x22')]();};}function saveUpdates(_0x3e82d4,_0x2569a8){return function(_0xb5ebf6){if(_0xb5ebf6){return _0xb5ebf6[_0xde40('0x23')](_0x3e82d4)[_0xde40('0x24')](function(_0x2447ae){return _0x2447ae;});}return null;};}function removeEntity(_0x195b8a,_0x3d8351){return function(_0x456874){if(_0x456874){return _0x456874[_0xde40('0x25')]()['then'](function(){_0x195b8a[_0xde40('0x18')](0xcc)[_0xde40('0x19')]();});}};}function handleEntityNotFound(_0x12011b,_0x4732f4){return function(_0x7c7f10){if(!_0x7c7f10){_0x12011b[_0xde40('0x26')](0x194);}return _0x7c7f10;};}function handleError(_0x28359e,_0x27c69b){_0x27c69b=_0x27c69b||0x1f4;return function(_0x36975b){logger['error'](_0x36975b[_0xde40('0x27')]);if(_0x36975b['name']){delete _0x36975b[_0xde40('0x28')];}_0x28359e[_0xde40('0x18')](_0x27c69b)[_0xde40('0x29')](_0x36975b);};}exports[_0xde40('0x2a')]=function(_0x39720f,_0x391bb1){var _0x2f062e={},_0x7ce6e={},_0x695731={'count':0x0,'rows':[]};var _0x26ee62=_['map'](db[_0xde40('0x2b')][_0xde40('0x2c')],function(_0x445f8a){return{'name':_0x445f8a['fieldName'],'type':_0x445f8a[_0xde40('0x2d')][_0xde40('0x2e')]};});_0x7ce6e['model']=_[_0xde40('0x2f')](_0x26ee62,_0xde40('0x28'));_0x7ce6e[_0xde40('0x30')]=_[_0xde40('0x31')](_0x39720f[_0xde40('0x30')]);_0x7ce6e[_0xde40('0x32')]=_[_0xde40('0x33')](_0x7ce6e[_0xde40('0x34')],_0x7ce6e[_0xde40('0x30')]);_0x2f062e[_0xde40('0x35')]=_[_0xde40('0x33')](_0x7ce6e['model'],qs[_0xde40('0x36')](_0x39720f[_0xde40('0x30')][_0xde40('0x36')]));_0x2f062e[_0xde40('0x35')]=_0x2f062e[_0xde40('0x35')]['length']?_0x2f062e[_0xde40('0x35')]:_0x7ce6e[_0xde40('0x34')];if(!_0x39720f['query'][_0xde40('0x37')](_0xde40('0x38'))){_0x2f062e[_0xde40('0x1c')]=qs[_0xde40('0x1c')](_0x39720f[_0xde40('0x30')]['limit']);_0x2f062e[_0xde40('0x1b')]=qs[_0xde40('0x1b')](_0x39720f[_0xde40('0x30')]['offset']);}_0x2f062e[_0xde40('0x39')]=qs[_0xde40('0x3a')](_0x39720f[_0xde40('0x30')]['sort']);_0x2f062e[_0xde40('0x3b')]=qs[_0xde40('0x32')](_['pick'](_0x39720f['query'],_0x7ce6e[_0xde40('0x32')]),_0x26ee62);if(_0x39720f[_0xde40('0x30')][_0xde40('0x3c')]){_0x2f062e['where']=_['merge'](_0x2f062e[_0xde40('0x3b')],{'$or':_[_0xde40('0x2f')](_0x26ee62,function(_0x47ce33){if(_0x47ce33[_0xde40('0x2d')]!==_0xde40('0x3d')){var _0x5e6038={};_0x5e6038[_0x47ce33[_0xde40('0x28')]]={'$like':'%'+_0x39720f[_0xde40('0x30')][_0xde40('0x3c')]+'%'};return _0x5e6038;}})});}_0x2f062e=_[_0xde40('0x3e')]({},_0x2f062e,_0x39720f[_0xde40('0x3f')]);var _0x25f391={'where':_0x2f062e[_0xde40('0x3b')]};return db[_0xde40('0x2b')][_0xde40('0x1e')](_0x25f391)[_0xde40('0x24')](function(_0xe7a2fb){_0x695731['count']=_0xe7a2fb;if(_0x39720f['query']['includeAll']){_0x2f062e[_0xde40('0x40')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x2f062e);})['then'](function(_0x39340e){_0x695731[_0xde40('0x41')]=_0x39340e;return _0x695731;})[_0xde40('0x24')](respondWithFilteredResult(_0x391bb1,_0x2f062e))[_0xde40('0x42')](handleError(_0x391bb1,null));};exports[_0xde40('0x43')]=function(_0x9d0568,_0x4f696b){var _0x3f0e38={'raw':![],'where':{'id':_0x9d0568[_0xde40('0x44')]['id']}},_0x1235ff={};_0x1235ff['model']=_[_0xde40('0x31')](db[_0xde40('0x2b')][_0xde40('0x2c')]);_0x1235ff['query']=_['keys'](_0x9d0568[_0xde40('0x30')]);_0x1235ff[_0xde40('0x32')]=_[_0xde40('0x33')](_0x1235ff[_0xde40('0x34')],_0x1235ff[_0xde40('0x30')]);_0x3f0e38[_0xde40('0x35')]=_[_0xde40('0x33')](_0x1235ff[_0xde40('0x34')],qs[_0xde40('0x36')](_0x9d0568[_0xde40('0x30')][_0xde40('0x36')]));_0x3f0e38['attributes']=_0x3f0e38['attributes']['length']?_0x3f0e38[_0xde40('0x35')]:_0x1235ff['model'];if(_0x9d0568['query'][_0xde40('0x45')]){_0x3f0e38[_0xde40('0x40')]=[{'all':!![]}];}_0x3f0e38=_['merge']({},_0x3f0e38,_0x9d0568[_0xde40('0x3f')]);return db[_0xde40('0x2b')][_0xde40('0x46')](_0x3f0e38)['then'](handleEntityNotFound(_0x4f696b,null))[_0xde40('0x24')](respondWithResult(_0x4f696b,null))[_0xde40('0x42')](handleError(_0x4f696b,null));};exports[_0xde40('0x47')]=function(_0x153f98,_0x272172){return db[_0xde40('0x2b')]['create'](_0x153f98['body'],{})[_0xde40('0x24')](respondWithResult(_0x272172,0xc9))['catch'](handleError(_0x272172,null));};exports[_0xde40('0x23')]=function(_0x545e4c,_0x195b50){if(_0x545e4c[_0xde40('0x48')]['id']){delete _0x545e4c[_0xde40('0x48')]['id'];}return db[_0xde40('0x2b')]['find']({'where':{'id':_0x545e4c[_0xde40('0x44')]['id']}})[_0xde40('0x24')](handleEntityNotFound(_0x195b50,null))[_0xde40('0x24')](saveUpdates(_0x545e4c[_0xde40('0x48')],null))['then'](respondWithResult(_0x195b50,null))['catch'](handleError(_0x195b50,null));};exports['destroy']=function(_0x126bb6,_0x1cdf9a){return db[_0xde40('0x2b')][_0xde40('0x46')]({'where':{'id':_0x126bb6[_0xde40('0x44')]['id']}})[_0xde40('0x24')](handleEntityNotFound(_0x1cdf9a,null))[_0xde40('0x24')](removeEntity(_0x1cdf9a,null))[_0xde40('0x42')](handleError(_0x1cdf9a,null));};exports[_0xde40('0x49')]=function(_0x3043e0,_0x53383f,_0x34da4d){var _0x2a073e={};var _0x1b93e2={};var _0x5b7083;var _0x70673;return db[_0xde40('0x2b')][_0xde40('0x4a')]({'where':{'id':_0x3043e0[_0xde40('0x44')]['id']}})['then'](handleEntityNotFound(_0x53383f,null))[_0xde40('0x24')](function(_0x5e8bb6){if(_0x5e8bb6){_0x5b7083=_0x5e8bb6;_0x1b93e2[_0xde40('0x34')]=_[_0xde40('0x31')](db['DeskConfiguration'][_0xde40('0x2c')]);_0x1b93e2[_0xde40('0x30')]=_['keys'](_0x3043e0['query']);_0x1b93e2['filters']=_[_0xde40('0x33')](_0x1b93e2['model'],_0x1b93e2[_0xde40('0x30')]);_0x2a073e[_0xde40('0x35')]=_[_0xde40('0x33')](_0x1b93e2[_0xde40('0x34')],qs['fields'](_0x3043e0[_0xde40('0x30')][_0xde40('0x36')]));_0x2a073e[_0xde40('0x35')]=_0x2a073e[_0xde40('0x35')][_0xde40('0x4b')]?_0x2a073e[_0xde40('0x35')]:_0x1b93e2[_0xde40('0x34')];_0x2a073e[_0xde40('0x39')]=qs['sort'](_0x3043e0[_0xde40('0x30')][_0xde40('0x3a')]);_0x2a073e[_0xde40('0x3b')]=qs[_0xde40('0x32')](_[_0xde40('0x4c')](_0x3043e0[_0xde40('0x30')],_0x1b93e2['filters']));if(_0x3043e0[_0xde40('0x30')][_0xde40('0x3c')]){_0x2a073e[_0xde40('0x3b')]=_['merge'](_0x2a073e['where'],{'$or':_[_0xde40('0x2f')](_0x2a073e[_0xde40('0x35')],function(_0xa09c29){var _0xd6b404={};_0xd6b404[_0xa09c29]={'$like':'%'+_0x3043e0[_0xde40('0x30')][_0xde40('0x3c')]+'%'};return _0xd6b404;})});}_0x2a073e=_[_0xde40('0x3e')]({},_0x2a073e,_0x3043e0[_0xde40('0x3f')]);return _0x5b7083[_0xde40('0x49')](_0x2a073e);}})['then'](function(_0x51c73c){if(_0x51c73c){_0x70673=_0x51c73c['length'];if(!_0x3043e0['query'][_0xde40('0x37')](_0xde40('0x38'))){_0x2a073e[_0xde40('0x1c')]=qs[_0xde40('0x1c')](_0x3043e0[_0xde40('0x30')][_0xde40('0x1c')]);_0x2a073e[_0xde40('0x1b')]=qs[_0xde40('0x1b')](_0x3043e0[_0xde40('0x30')]['offset']);}return _0x5b7083[_0xde40('0x49')](_0x2a073e);}})[_0xde40('0x24')](function(_0x45afdd){if(_0x45afdd){return _0x45afdd?{'count':_0x70673,'rows':_0x45afdd}:null;}})['then'](respondWithResult(_0x53383f,null))[_0xde40('0x42')](handleError(_0x53383f,null));};exports['addConfiguration']=function(_0x400c1d,_0x475c4b,_0xc6fd73){if(_0x400c1d[_0xde40('0x48')]['id']){delete _0x400c1d[_0xde40('0x48')]['id'];}return db['DeskAccount'][_0xde40('0x4a')]({'where':{'id':_0x400c1d[_0xde40('0x44')]['id']}})[_0xde40('0x24')](handleEntityNotFound(_0x475c4b,null))[_0xde40('0x24')](function(_0x3d56c3){if(_0x3d56c3){_0x400c1d['body'][_0xde40('0x4d')]=_0x3d56c3['id'];_0x400c1d['body'][_0xde40('0x4e')]=integrations[_0xde40('0x4f')](_0x400c1d[_0xde40('0x48')][_0xde40('0x50')],_0x400c1d[_0xde40('0x48')][_0xde40('0x2d')]);_0x400c1d[_0xde40('0x48')]['Descriptions']=integrations[_0xde40('0x51')](_0x400c1d[_0xde40('0x48')][_0xde40('0x50')],_0x400c1d['body'][_0xde40('0x2d')]);return db[_0xde40('0x52')]['create'](_0x400c1d['body'],{'include':[{'model':db[_0xde40('0x53')],'as':'Subjects'},{'model':db[_0xde40('0x53')],'as':_0xde40('0x54')}]});}return null;})[_0xde40('0x24')](respondWithResult(_0x475c4b,null))['catch'](handleError(_0x475c4b,null));};exports[_0xde40('0x55')]=function(_0x48bdcb,_0x10e7b0,_0x153b61){var _0x4708a1=[{'name':'priority','label':_0xde40('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xb5a224='';return db[_0xde40('0x2b')][_0xde40('0x4a')]({'where':{'id':_0x48bdcb[_0xde40('0x44')]['id']},'attributes':['id',_0xde40('0x57'),_0xde40('0x58'),_0xde40('0x59'),_0xde40('0x5a'),_0xde40('0x5b'),'consumerSecret',_0xde40('0x5c'),_0xde40('0x5d')]})[_0xde40('0x24')](handleEntityNotFound(_0x10e7b0,null))[_0xde40('0x24')](function(_0x10a90e){if(_0x10a90e){_0xb5a224=_0x10a90e[_0xde40('0x57')];var _0x40be8e=_0xb5a224[_0xde40('0x5e')](-0x1);if(_0x40be8e==='/'){_0xb5a224=_0xb5a224['substring'](0x0,_0xb5a224[_0xde40('0x5f')](_0x40be8e));}var _0x37abe3={'method':_0xde40('0x60'),'uri':util[_0xde40('0x61')](_0xde40('0x62'),_0xb5a224),'headers':{'Content-Type':'application/json','Accept':_0xde40('0x63')},'json':!![]};if(_0x10a90e[_0xde40('0x58')]==='basic'){_0x37abe3[_0xde40('0x64')][_0xde40('0x65')]=util[_0xde40('0x61')](_0xde40('0x66'),new Buffer(util['format'](_0xde40('0x67'),_0x10a90e['username'],_0x10a90e['password']))[_0xde40('0x68')](_0xde40('0x69')));}return rp(_0x37abe3)['then'](function(_0x4f20c3){return _0x4708a1[_0xde40('0x6a')](_[_0xde40('0x2f')](_0x4f20c3[_0xde40('0x6b')][_0xde40('0x6c')],function(_0x11d2a5){return{'id':_0x11d2a5[_0xde40('0x28')],'name':_0x11d2a5[_0xde40('0x28')],'type':_0x11d2a5[_0xde40('0x2d')],'active':_0x11d2a5[_0xde40('0x6d')],'label':_0x11d2a5['label'],'custom':!![]};}));});}})[_0xde40('0x24')](function(_0x37f6e9){return{'count':_0x37f6e9[_0xde40('0x4b')],'rows':_0x37f6e9};})['then'](respondWithResult(_0x10e7b0,null))[_0xde40('0x42')](function(_0x3c200a){var _0x2d61ee=_0x48bdcb['query'][_0xde40('0x6e')]?0x1f4:_0x3c200a[_0xde40('0x6f')]||0x1f4;logger['error'](_0xde40('0x70'),_0xde40('0x55'),_0x2d61ee,JSON[_0xde40('0x71')](_0x3c200a));delete _0x3c200a[_0xde40('0x28')];if(_0x2d61ee===0x191){_0x2d61ee=0x190;}_0x10e7b0['status'](_0x2d61ee)[_0xde40('0x29')](_0x48bdcb[_0xde40('0x30')][_0xde40('0x6e')]?{'message':_0xde40('0x72'),'statusCode':_0x3c200a['statusCode']}:_0x3c200a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 182066c..e90fdc7 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 _0x85aa=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85aa,0x1c7));var _0xa85a=function(_0x1ac361,_0x3d73f6){_0x1ac361=_0x1ac361-0x0;var _0x19c59e=_0x85aa[_0x1ac361];return _0x19c59e;};'use strict';var _=require('lodash');var util=require(_0xa85a('0x0'));var logger=require(_0xa85a('0x1'))(_0xa85a('0x2'));var moment=require(_0xa85a('0x3'));var BPromise=require(_0xa85a('0x4'));var rp=require(_0xa85a('0x5'));var fs=require('fs');var path=require(_0xa85a('0x6'));var rimraf=require(_0xa85a('0x7'));var config=require(_0xa85a('0x8'));var attributes=require(_0xa85a('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1b3326,_0x3498ed){return _0x1b3326[_0xa85a('0xa')](_0xa85a('0xb'),attributes,{'tableName':_0xa85a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0334=['bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','DeskAccount','int_desk_accounts','lodash','util','api','moment'];(function(_0x3665a2,_0x501943){var _0x3fea93=function(_0x2b7e1b){while(--_0x2b7e1b){_0x3665a2['push'](_0x3665a2['shift']());}};_0x3fea93(++_0x501943);}(_0x0334,0x140));var _0x4033=function(_0x2498f5,_0x3fc230){_0x2498f5=_0x2498f5-0x0;var _0x2c9db8=_0x0334[_0x2498f5];return _0x2c9db8;};'use strict';var _=require(_0x4033('0x0'));var util=require(_0x4033('0x1'));var logger=require('../../config/logger')(_0x4033('0x2'));var moment=require(_0x4033('0x3'));var BPromise=require(_0x4033('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4033('0x5'));var rimraf=require(_0x4033('0x6'));var config=require(_0x4033('0x7'));var attributes=require(_0x4033('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x4033('0x9')]=function(_0x3d0bce,_0x16fe55){return _0x3d0bce['define'](_0x4033('0xa'),attributes,{'tableName':_0x4033('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index b41e729..8cbda3a 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 _0xe221=['debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','model','map','ShowDeskAccount','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x30e5ee,_0x1ca4bc){var _0x3720cd=function(_0xd39d2e){while(--_0xd39d2e){_0x30e5ee['push'](_0x30e5ee['shift']());}};_0x3720cd(++_0x1ca4bc);}(_0xe221,0x173));var _0x1e22=function(_0x2ce4ce,_0x450337){_0x2ce4ce=_0x2ce4ce-0x0;var _0x44a4e8=_0xe221[_0x2ce4ce];return _0x44a4e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1e22('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e22('0x1'));var db=require(_0x1e22('0x2'))['db'];var utils=require(_0x1e22('0x3'));var logger=require('../../config/logger')(_0x1e22('0x4'));var config=require('../../config/environment');var jayson=require(_0x1e22('0x5'));var client=jayson[_0x1e22('0x6')][_0x1e22('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ec62e,_0x53c13e,_0x925f25){return new BPromise(function(_0x154c25,_0x4b3190){return client[_0x1e22('0x8')](_0x2ec62e,_0x925f25)[_0x1e22('0x9')](function(_0x1ad1a8){logger[_0x1e22('0xa')](_0x1e22('0xb'),_0x53c13e,_0x1e22('0xc'));logger[_0x1e22('0xd')](_0x1e22('0xe'),_0x53c13e,_0x1e22('0xc'),JSON[_0x1e22('0xf')](_0x1ad1a8));if(_0x1ad1a8[_0x1e22('0x10')]){if(_0x1ad1a8[_0x1e22('0x10')][_0x1e22('0x11')]===0x1f4){logger[_0x1e22('0x10')](_0x1e22('0xb'),_0x53c13e,_0x1ad1a8[_0x1e22('0x10')][_0x1e22('0x12')]);return _0x4b3190(_0x1ad1a8[_0x1e22('0x10')][_0x1e22('0x12')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x53c13e,_0x1ad1a8[_0x1e22('0x10')][_0x1e22('0x12')]);return _0x154c25(_0x1ad1a8[_0x1e22('0x10')][_0x1e22('0x12')]);}else{logger['info'](_0x1e22('0xb'),_0x53c13e,_0x1e22('0xc'));_0x154c25(_0x1ad1a8[_0x1e22('0x13')][_0x1e22('0x12')]);}})[_0x1e22('0x14')](function(_0x22927a){logger[_0x1e22('0x10')]('DeskAccount,\x20%s,\x20%s',_0x53c13e,_0x22927a);_0x4b3190(_0x22927a);});});}exports[_0x1e22('0x15')]=function(_0x3f485a){var _0x42d9c9=this;return new Promise(function(_0x54f909,_0x143e01){return db[_0x1e22('0x16')][_0x1e22('0x17')]({'raw':_0x3f485a[_0x1e22('0x18')]?_0x3f485a[_0x1e22('0x18')][_0x1e22('0x19')]===undefined?!![]:![]:!![],'where':_0x3f485a[_0x1e22('0x18')]?_0x3f485a[_0x1e22('0x18')][_0x1e22('0x1a')]||null:null,'attributes':_0x3f485a[_0x1e22('0x18')]?_0x3f485a['options'][_0x1e22('0x1b')]||null:null,'limit':_0x3f485a[_0x1e22('0x18')]?_0x3f485a[_0x1e22('0x18')]['limit']||null:null,'include':_0x3f485a[_0x1e22('0x18')]?_0x3f485a[_0x1e22('0x18')][_0x1e22('0x1c')]?_['map'](_0x3f485a[_0x1e22('0x18')][_0x1e22('0x1c')],function(_0x253581){return{'model':db[_0x253581[_0x1e22('0x1d')]],'as':_0x253581['as'],'attributes':_0x253581[_0x1e22('0x1b')],'include':_0x253581[_0x1e22('0x1c')]?_[_0x1e22('0x1e')](_0x253581[_0x1e22('0x1c')],function(_0x4699b6){return{'model':db[_0x4699b6['model']],'as':_0x4699b6['as'],'attributes':_0x4699b6['attributes'],'include':_0x4699b6[_0x1e22('0x1c')]?_[_0x1e22('0x1e')](_0x4699b6[_0x1e22('0x1c')],function(_0x5858db){return{'model':db[_0x5858db[_0x1e22('0x1d')]],'as':_0x5858db['as'],'attributes':_0x5858db[_0x1e22('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1e22('0x9')](function(_0x31e1d2){logger[_0x1e22('0xa')](_0x1e22('0x15'),_0x3f485a);logger[_0x1e22('0xd')](_0x1e22('0x15'),_0x3f485a,JSON[_0x1e22('0xf')](_0x31e1d2));_0x54f909(_0x31e1d2);})[_0x1e22('0x14')](function(_0x30de30){logger[_0x1e22('0x10')](_0x1e22('0x15'),_0x30de30[_0x1e22('0x12')],_0x3f485a);_0x143e01(_0x42d9c9[_0x1e22('0x10')](0x1f4,_0x30de30[_0x1e22('0x12')]));});});};exports[_0x1e22('0x1f')]=function(_0x4057bf){var _0x1a3da0=this;return new Promise(function(_0x556742,_0x1f9f28){return db['DeskAccount']['find']({'raw':_0x4057bf['options']?_0x4057bf[_0x1e22('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4057bf[_0x1e22('0x18')]?_0x4057bf[_0x1e22('0x18')][_0x1e22('0x1a')]||null:null,'attributes':_0x4057bf[_0x1e22('0x18')]?_0x4057bf['options'][_0x1e22('0x1b')]||null:null,'include':_0x4057bf[_0x1e22('0x18')]?_0x4057bf['options'][_0x1e22('0x1c')]?_[_0x1e22('0x1e')](_0x4057bf[_0x1e22('0x18')][_0x1e22('0x1c')],function(_0x43af18){return{'model':db[_0x43af18[_0x1e22('0x1d')]],'as':_0x43af18['as'],'attributes':_0x43af18['attributes'],'include':_0x43af18['include']?_[_0x1e22('0x1e')](_0x43af18[_0x1e22('0x1c')],function(_0x31ab43){return{'model':db[_0x31ab43[_0x1e22('0x1d')]],'as':_0x31ab43['as'],'attributes':_0x31ab43[_0x1e22('0x1b')],'include':_0x31ab43[_0x1e22('0x1c')]?_['map'](_0x31ab43[_0x1e22('0x1c')],function(_0x20f6f3){return{'model':db[_0x20f6f3[_0x1e22('0x1d')]],'as':_0x20f6f3['as'],'attributes':_0x20f6f3['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e22('0x9')](function(_0x3f82c8){logger[_0x1e22('0xa')](_0x1e22('0x1f'),_0x4057bf);logger[_0x1e22('0xd')]('ShowDeskAccount',_0x4057bf,JSON[_0x1e22('0xf')](_0x3f82c8));_0x556742(_0x3f82c8);})[_0x1e22('0x14')](function(_0x5d7683){logger[_0x1e22('0x10')](_0x1e22('0x1f'),_0x5d7683[_0x1e22('0x12')],_0x4057bf);_0x1f9f28(_0x1a3da0['error'](0x1f4,_0x5d7683[_0x1e22('0x12')]));});});}; \ No newline at end of file +var _0x0e00=['model','ShowDeskAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x542d6b,_0x1615bd){var _0x22d616=function(_0x1db71f){while(--_0x1db71f){_0x542d6b['push'](_0x542d6b['shift']());}};_0x22d616(++_0x1615bd);}(_0x0e00,0xda));var _0x00e0=function(_0x49f311,_0x1eae4c){_0x49f311=_0x49f311-0x0;var _0x2a638f=_0x0e00[_0x49f311];return _0x2a638f;};'use strict';var _=require(_0x00e0('0x0'));var util=require('util');var moment=require(_0x00e0('0x1'));var BPromise=require(_0x00e0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00e0('0x3'));var db=require(_0x00e0('0x4'))['db'];var utils=require(_0x00e0('0x5'));var logger=require(_0x00e0('0x6'))(_0x00e0('0x7'));var config=require(_0x00e0('0x8'));var jayson=require(_0x00e0('0x9'));var client=jayson[_0x00e0('0xa')][_0x00e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ab04a,_0xa2c648,_0x152ad9){return new BPromise(function(_0xac63ac,_0x3cf3e9){return client[_0x00e0('0xc')](_0x1ab04a,_0x152ad9)[_0x00e0('0xd')](function(_0x3de8ed){logger[_0x00e0('0xe')](_0x00e0('0xf'),_0xa2c648,_0x00e0('0x10'));logger[_0x00e0('0x11')](_0x00e0('0x12'),_0xa2c648,_0x00e0('0x10'),JSON[_0x00e0('0x13')](_0x3de8ed));if(_0x3de8ed[_0x00e0('0x14')]){if(_0x3de8ed[_0x00e0('0x14')]['code']===0x1f4){logger[_0x00e0('0x14')]('DeskAccount,\x20%s,\x20%s',_0xa2c648,_0x3de8ed[_0x00e0('0x14')][_0x00e0('0x15')]);return _0x3cf3e9(_0x3de8ed[_0x00e0('0x14')]['message']);}logger[_0x00e0('0x14')](_0x00e0('0xf'),_0xa2c648,_0x3de8ed['error'][_0x00e0('0x15')]);return _0xac63ac(_0x3de8ed[_0x00e0('0x14')]['message']);}else{logger[_0x00e0('0xe')](_0x00e0('0xf'),_0xa2c648,_0x00e0('0x10'));_0xac63ac(_0x3de8ed[_0x00e0('0x16')][_0x00e0('0x15')]);}})[_0x00e0('0x17')](function(_0xdd9f25){logger[_0x00e0('0x14')](_0x00e0('0xf'),_0xa2c648,_0xdd9f25);_0x3cf3e9(_0xdd9f25);});});}exports[_0x00e0('0x18')]=function(_0x3d7027){var _0xc7fbff=this;return new Promise(function(_0x56189a,_0x4bec17){return db[_0x00e0('0x19')][_0x00e0('0x1a')]({'raw':_0x3d7027[_0x00e0('0x1b')]?_0x3d7027[_0x00e0('0x1b')][_0x00e0('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d7027[_0x00e0('0x1b')]?_0x3d7027[_0x00e0('0x1b')][_0x00e0('0x1d')]||null:null,'attributes':_0x3d7027[_0x00e0('0x1b')]?_0x3d7027[_0x00e0('0x1b')][_0x00e0('0x1e')]||null:null,'limit':_0x3d7027[_0x00e0('0x1b')]?_0x3d7027[_0x00e0('0x1b')][_0x00e0('0x1f')]||null:null,'include':_0x3d7027['options']?_0x3d7027[_0x00e0('0x1b')]['include']?_[_0x00e0('0x20')](_0x3d7027[_0x00e0('0x1b')][_0x00e0('0x21')],function(_0x3e22fb){return{'model':db[_0x3e22fb[_0x00e0('0x22')]],'as':_0x3e22fb['as'],'attributes':_0x3e22fb[_0x00e0('0x1e')],'include':_0x3e22fb[_0x00e0('0x21')]?_['map'](_0x3e22fb[_0x00e0('0x21')],function(_0x195384){return{'model':db[_0x195384[_0x00e0('0x22')]],'as':_0x195384['as'],'attributes':_0x195384[_0x00e0('0x1e')],'include':_0x195384[_0x00e0('0x21')]?_['map'](_0x195384['include'],function(_0x47b95e){return{'model':db[_0x47b95e[_0x00e0('0x22')]],'as':_0x47b95e['as'],'attributes':_0x47b95e[_0x00e0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x00e0('0xd')](function(_0xc1c8e6){logger[_0x00e0('0xe')]('GetDeskAccount',_0x3d7027);logger['debug']('GetDeskAccount',_0x3d7027,JSON[_0x00e0('0x13')](_0xc1c8e6));_0x56189a(_0xc1c8e6);})[_0x00e0('0x17')](function(_0x356b46){logger['error']('GetDeskAccount',_0x356b46[_0x00e0('0x15')],_0x3d7027);_0x4bec17(_0xc7fbff['error'](0x1f4,_0x356b46['message']));});});};exports['ShowDeskAccount']=function(_0x4e78a8){var _0x5af923=this;return new Promise(function(_0x365cc4,_0x3c1125){return db[_0x00e0('0x19')]['find']({'raw':_0x4e78a8['options']?_0x4e78a8['options'][_0x00e0('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e78a8[_0x00e0('0x1b')]?_0x4e78a8[_0x00e0('0x1b')][_0x00e0('0x1d')]||null:null,'attributes':_0x4e78a8[_0x00e0('0x1b')]?_0x4e78a8[_0x00e0('0x1b')][_0x00e0('0x1e')]||null:null,'include':_0x4e78a8[_0x00e0('0x1b')]?_0x4e78a8[_0x00e0('0x1b')][_0x00e0('0x21')]?_[_0x00e0('0x20')](_0x4e78a8[_0x00e0('0x1b')][_0x00e0('0x21')],function(_0x2f1636){return{'model':db[_0x2f1636['model']],'as':_0x2f1636['as'],'attributes':_0x2f1636[_0x00e0('0x1e')],'include':_0x2f1636[_0x00e0('0x21')]?_[_0x00e0('0x20')](_0x2f1636[_0x00e0('0x21')],function(_0x3358a4){return{'model':db[_0x3358a4['model']],'as':_0x3358a4['as'],'attributes':_0x3358a4[_0x00e0('0x1e')],'include':_0x3358a4[_0x00e0('0x21')]?_['map'](_0x3358a4[_0x00e0('0x21')],function(_0x595699){return{'model':db[_0x595699['model']],'as':_0x595699['as'],'attributes':_0x595699[_0x00e0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x00e0('0xd')](function(_0x11e50c){logger['info'](_0x00e0('0x23'),_0x4e78a8);logger[_0x00e0('0x11')](_0x00e0('0x23'),_0x4e78a8,JSON['stringify'](_0x11e50c));_0x365cc4(_0x11e50c);})[_0x00e0('0x17')](function(_0x547094){logger[_0x00e0('0x14')](_0x00e0('0x23'),_0x547094['message'],_0x4e78a8);_0x3c1125(_0x5af923['error'](0x1f4,_0x547094[_0x00e0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index b6a4ef7..a5c0676 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x52f15e,_0x23b9d0){var _0x5caabe=function(_0x341545){while(--_0x341545){_0x52f15e['push'](_0x52f15e['shift']());}};_0x5caabe(++_0x23b9d0);}(_0x3e74,0x175));var _0x43e7=function(_0x2d7b1b,_0x136b13){_0x2d7b1b=_0x2d7b1b-0x0;var _0x3fab04=_0x3e74[_0x2d7b1b];return _0x3fab04;};'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/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0x55ca,0x126));var _0xa55c=function(_0x49748c,_0x3d2005){_0x49748c=_0x49748c-0x0;var _0xedf6b6=_0x55ca[_0x49748c];return _0xedf6b6;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 10b07b1..a00630d 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 _0x258d=['STRING','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x258d,0x1a1));var _0xd258=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x258d[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xd258('0x0'));module['exports']={'name':{'type':Sequelize[_0xd258('0x1')]},'description':{'type':Sequelize[_0xd258('0x1')]}}; \ No newline at end of file +var _0xcd55=['exports','STRING','sequelize'];(function(_0xef7eff,_0x4789a7){var _0x5d502c=function(_0x3a1abe){while(--_0x3a1abe){_0xef7eff['push'](_0xef7eff['shift']());}};_0x5d502c(++_0x4789a7);}(_0xcd55,0x182));var _0x5cd5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcd55[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x5cd5('0x0'));module[_0x5cd5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5cd5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 0b9beba..3b22098 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 _0xc4af=['findOne','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','name','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','include','findAll','catch','show','params','includeAll','create','body','find','getFields','DeskField','order','pick','nolimit','getSubjects','getDescriptions','getTags'];(function(_0x28a869,_0x31dcce){var _0x36ba55=function(_0x14512d){while(--_0x14512d){_0x28a869['push'](_0x28a869['shift']());}};_0x36ba55(++_0x31dcce);}(_0xc4af,0x1a3));var _0xfc4a=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc4af[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require(_0xfc4a('0x0'));var rimraf=require(_0xfc4a('0x1'));var zipdir=require(_0xfc4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc4a('0x3'));var moment=require(_0xfc4a('0x4'));var BPromise=require(_0xfc4a('0x5'));var Mustache=require(_0xfc4a('0x6'));var util=require(_0xfc4a('0x7'));var path=require(_0xfc4a('0x8'));var sox=require(_0xfc4a('0x9'));var csv=require(_0xfc4a('0xa'));var ejs=require(_0xfc4a('0xb'));var fs=require('fs');var fs_extra=require(_0xfc4a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc4a('0xd'));var deskjs=require(_0xfc4a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfc4a('0xf'));var Papa=require('papaparse');var Redis=require(_0xfc4a('0x10'));var authService=require(_0xfc4a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfc4a('0x12'));var hardwareService=require(_0xfc4a('0x13'));var logger=require(_0xfc4a('0x14'))(_0xfc4a('0x15'));var utils=require(_0xfc4a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfc4a('0x17'));var db=require(_0xfc4a('0x18'))['db'];function respondWithStatusCode(_0x27ed5a,_0x56790f){_0x56790f=_0x56790f||0xcc;return function(_0x5cc239){if(_0x5cc239){return _0x27ed5a[_0xfc4a('0x19')](_0x56790f);}return _0x27ed5a['status'](_0x56790f)[_0xfc4a('0x1a')]();};}function respondWithResult(_0x1b5d1d,_0x3b0a59){_0x3b0a59=_0x3b0a59||0xc8;return function(_0x230d27){if(_0x230d27){return _0x1b5d1d[_0xfc4a('0x1b')](_0x3b0a59)[_0xfc4a('0x1c')](_0x230d27);}};}function respondWithFilteredResult(_0x40d59f,_0x40387b){return function(_0x2ca40c){if(_0x2ca40c){var _0x4d68c6=typeof _0x40387b[_0xfc4a('0x1d')]===_0xfc4a('0x1e')&&typeof _0x40387b['limit']===_0xfc4a('0x1e');var _0x5c062e=_0x2ca40c[_0xfc4a('0x1f')];var _0x302535=_0x4d68c6?0x0:_0x40387b[_0xfc4a('0x1d')];var _0x13af6a=_0x4d68c6?_0x2ca40c[_0xfc4a('0x1f')]:_0x40387b[_0xfc4a('0x1d')]+_0x40387b[_0xfc4a('0x20')];var _0xcc3263;if(_0x13af6a>=_0x5c062e){_0x13af6a=_0x5c062e;_0xcc3263=0xc8;}else{_0xcc3263=0xce;}_0x40d59f[_0xfc4a('0x1b')](_0xcc3263);return _0x40d59f['set'](_0xfc4a('0x21'),_0x302535+'-'+_0x13af6a+'/'+_0x5c062e)[_0xfc4a('0x1c')](_0x2ca40c);}return null;};}function patchUpdates(_0x9d0654){return function(_0x1813a7){try{jsonpatch['apply'](_0x1813a7,_0x9d0654,!![]);}catch(_0x3f8518){return BPromise[_0xfc4a('0x22')](_0x3f8518);}return _0x1813a7[_0xfc4a('0x23')]();};}function saveUpdates(_0x611a6e,_0x7463e9){return function(_0x4877f0){if(_0x4877f0){return _0x4877f0[_0xfc4a('0x24')](_0x611a6e)[_0xfc4a('0x25')](function(_0x5e899c){return _0x5e899c;});}return null;};}function removeEntity(_0x388c16,_0x42625c){return function(_0x5a0427){if(_0x5a0427){return _0x5a0427[_0xfc4a('0x26')]()[_0xfc4a('0x25')](function(){_0x388c16[_0xfc4a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x162f9b,_0x199c41){return function(_0x4db779){if(!_0x4db779){_0x162f9b[_0xfc4a('0x19')](0x194);}return _0x4db779;};}function handleError(_0x1f5a32,_0x51ffb4){_0x51ffb4=_0x51ffb4||0x1f4;return function(_0x2527da){logger[_0xfc4a('0x27')](_0x2527da['stack']);if(_0x2527da['name']){delete _0x2527da[_0xfc4a('0x28')];}_0x1f5a32[_0xfc4a('0x1b')](_0x51ffb4)['send'](_0x2527da);};}exports[_0xfc4a('0x29')]=function(_0x349dfa,_0x430613){var _0x189e8b={},_0x1dffa3={},_0x4591a7={'count':0x0,'rows':[]};var _0x747e9=_['map'](db[_0xfc4a('0x2a')][_0xfc4a('0x2b')],function(_0x1b0f37){return{'name':_0x1b0f37[_0xfc4a('0x2c')],'type':_0x1b0f37[_0xfc4a('0x2d')][_0xfc4a('0x2e')]};});_0x1dffa3[_0xfc4a('0x2f')]=_[_0xfc4a('0x30')](_0x747e9,_0xfc4a('0x28'));_0x1dffa3[_0xfc4a('0x31')]=_[_0xfc4a('0x32')](_0x349dfa[_0xfc4a('0x31')]);_0x1dffa3[_0xfc4a('0x33')]=_[_0xfc4a('0x34')](_0x1dffa3[_0xfc4a('0x2f')],_0x1dffa3[_0xfc4a('0x31')]);_0x189e8b[_0xfc4a('0x35')]=_[_0xfc4a('0x34')](_0x1dffa3[_0xfc4a('0x2f')],qs[_0xfc4a('0x36')](_0x349dfa['query'][_0xfc4a('0x36')]));_0x189e8b[_0xfc4a('0x35')]=_0x189e8b[_0xfc4a('0x35')][_0xfc4a('0x37')]?_0x189e8b[_0xfc4a('0x35')]:_0x1dffa3['model'];if(!_0x349dfa[_0xfc4a('0x31')][_0xfc4a('0x38')]('nolimit')){_0x189e8b['limit']=qs['limit'](_0x349dfa[_0xfc4a('0x31')]['limit']);_0x189e8b[_0xfc4a('0x1d')]=qs[_0xfc4a('0x1d')](_0x349dfa[_0xfc4a('0x31')][_0xfc4a('0x1d')]);}_0x189e8b['order']=qs[_0xfc4a('0x39')](_0x349dfa['query'][_0xfc4a('0x39')]);_0x189e8b[_0xfc4a('0x3a')]=qs['filters'](_['pick'](_0x349dfa[_0xfc4a('0x31')],_0x1dffa3['filters']),_0x747e9);if(_0x349dfa[_0xfc4a('0x31')][_0xfc4a('0x3b')]){_0x189e8b[_0xfc4a('0x3a')]=_[_0xfc4a('0x3c')](_0x189e8b[_0xfc4a('0x3a')],{'$or':_[_0xfc4a('0x30')](_0x747e9,function(_0x44c234){if(_0x44c234[_0xfc4a('0x2d')]!=='VIRTUAL'){var _0x29bc69={};_0x29bc69[_0x44c234[_0xfc4a('0x28')]]={'$like':'%'+_0x349dfa['query'][_0xfc4a('0x3b')]+'%'};return _0x29bc69;}})});}_0x189e8b=_[_0xfc4a('0x3c')]({},_0x189e8b,_0x349dfa[_0xfc4a('0x3d')]);var _0x17a137={'where':_0x189e8b[_0xfc4a('0x3a')]};return db[_0xfc4a('0x2a')][_0xfc4a('0x1f')](_0x17a137)[_0xfc4a('0x25')](function(_0x2b3da0){_0x4591a7['count']=_0x2b3da0;if(_0x349dfa[_0xfc4a('0x31')]['includeAll']){_0x189e8b[_0xfc4a('0x3e')]=[{'all':!![]}];}return db[_0xfc4a('0x2a')][_0xfc4a('0x3f')](_0x189e8b);})['then'](function(_0xa60770){_0x4591a7['rows']=_0xa60770;return _0x4591a7;})[_0xfc4a('0x25')](respondWithFilteredResult(_0x430613,_0x189e8b))[_0xfc4a('0x40')](handleError(_0x430613,null));};exports[_0xfc4a('0x41')]=function(_0x25daba,_0xb238a5){var _0x4bb4fb={'raw':![],'where':{'id':_0x25daba[_0xfc4a('0x42')]['id']}},_0xe15467={};_0xe15467[_0xfc4a('0x2f')]=_[_0xfc4a('0x32')](db[_0xfc4a('0x2a')][_0xfc4a('0x2b')]);_0xe15467[_0xfc4a('0x31')]=_[_0xfc4a('0x32')](_0x25daba[_0xfc4a('0x31')]);_0xe15467[_0xfc4a('0x33')]=_['intersection'](_0xe15467[_0xfc4a('0x2f')],_0xe15467['query']);_0x4bb4fb[_0xfc4a('0x35')]=_['intersection'](_0xe15467['model'],qs[_0xfc4a('0x36')](_0x25daba[_0xfc4a('0x31')][_0xfc4a('0x36')]));_0x4bb4fb['attributes']=_0x4bb4fb[_0xfc4a('0x35')][_0xfc4a('0x37')]?_0x4bb4fb['attributes']:_0xe15467[_0xfc4a('0x2f')];if(_0x25daba[_0xfc4a('0x31')][_0xfc4a('0x43')]){_0x4bb4fb[_0xfc4a('0x3e')]=[{'all':!![]}];}_0x4bb4fb=_['merge']({},_0x4bb4fb,_0x25daba[_0xfc4a('0x3d')]);return db['DeskConfiguration']['find'](_0x4bb4fb)[_0xfc4a('0x25')](handleEntityNotFound(_0xb238a5,null))['then'](respondWithResult(_0xb238a5,null))[_0xfc4a('0x40')](handleError(_0xb238a5,null));};exports[_0xfc4a('0x44')]=function(_0x38e72c,_0x7e9e46){return db[_0xfc4a('0x2a')][_0xfc4a('0x44')](_0x38e72c[_0xfc4a('0x45')],{})['then'](respondWithResult(_0x7e9e46,0xc9))[_0xfc4a('0x40')](handleError(_0x7e9e46,null));};exports[_0xfc4a('0x24')]=function(_0x4f9778,_0x5845b0){if(_0x4f9778[_0xfc4a('0x45')]['id']){delete _0x4f9778['body']['id'];}return db[_0xfc4a('0x2a')][_0xfc4a('0x46')]({'where':{'id':_0x4f9778[_0xfc4a('0x42')]['id']}})[_0xfc4a('0x25')](handleEntityNotFound(_0x5845b0,null))[_0xfc4a('0x25')](saveUpdates(_0x4f9778[_0xfc4a('0x45')],null))[_0xfc4a('0x25')](respondWithResult(_0x5845b0,null))[_0xfc4a('0x40')](handleError(_0x5845b0,null));};exports['destroy']=function(_0x3f4af1,_0x5d2aa4){return db[_0xfc4a('0x2a')][_0xfc4a('0x46')]({'where':{'id':_0x3f4af1[_0xfc4a('0x42')]['id']}})[_0xfc4a('0x25')](handleEntityNotFound(_0x5d2aa4,null))[_0xfc4a('0x25')](removeEntity(_0x5d2aa4,null))[_0xfc4a('0x40')](handleError(_0x5d2aa4,null));};exports[_0xfc4a('0x47')]=function(_0x318fbf,_0x35d829,_0x398985){var _0x56acf8={};var _0x5abc86={};var _0x1659d1;var _0x4a1567;return db[_0xfc4a('0x2a')]['findOne']({'where':{'id':_0x318fbf['params']['id']}})['then'](handleEntityNotFound(_0x35d829,null))['then'](function(_0x567ce9){if(_0x567ce9){_0x1659d1=_0x567ce9;_0x5abc86[_0xfc4a('0x2f')]=_[_0xfc4a('0x32')](db[_0xfc4a('0x48')][_0xfc4a('0x2b')]);_0x5abc86[_0xfc4a('0x31')]=_['keys'](_0x318fbf[_0xfc4a('0x31')]);_0x5abc86[_0xfc4a('0x33')]=_['intersection'](_0x5abc86[_0xfc4a('0x2f')],_0x5abc86['query']);_0x56acf8[_0xfc4a('0x35')]=_[_0xfc4a('0x34')](_0x5abc86['model'],qs[_0xfc4a('0x36')](_0x318fbf[_0xfc4a('0x31')][_0xfc4a('0x36')]));_0x56acf8[_0xfc4a('0x35')]=_0x56acf8[_0xfc4a('0x35')][_0xfc4a('0x37')]?_0x56acf8[_0xfc4a('0x35')]:_0x5abc86['model'];_0x56acf8[_0xfc4a('0x49')]=qs[_0xfc4a('0x39')](_0x318fbf[_0xfc4a('0x31')][_0xfc4a('0x39')]);_0x56acf8[_0xfc4a('0x3a')]=qs[_0xfc4a('0x33')](_[_0xfc4a('0x4a')](_0x318fbf[_0xfc4a('0x31')],_0x5abc86[_0xfc4a('0x33')]));if(_0x318fbf[_0xfc4a('0x31')]['filter']){_0x56acf8[_0xfc4a('0x3a')]=_['merge'](_0x56acf8[_0xfc4a('0x3a')],{'$or':_[_0xfc4a('0x30')](_0x56acf8[_0xfc4a('0x35')],function(_0x35d6f5){var _0x578de1={};_0x578de1[_0x35d6f5]={'$like':'%'+_0x318fbf['query']['filter']+'%'};return _0x578de1;})});}_0x56acf8=_['merge']({},_0x56acf8,_0x318fbf[_0xfc4a('0x3d')]);return _0x1659d1['getFields'](_0x56acf8);}})[_0xfc4a('0x25')](function(_0x2127b0){if(_0x2127b0){_0x4a1567=_0x2127b0['length'];if(!_0x318fbf[_0xfc4a('0x31')][_0xfc4a('0x38')](_0xfc4a('0x4b'))){_0x56acf8[_0xfc4a('0x20')]=qs[_0xfc4a('0x20')](_0x318fbf['query'][_0xfc4a('0x20')]);_0x56acf8[_0xfc4a('0x1d')]=qs['offset'](_0x318fbf['query']['offset']);}return _0x1659d1[_0xfc4a('0x47')](_0x56acf8);}})[_0xfc4a('0x25')](function(_0x52fc84){if(_0x52fc84){return _0x52fc84?{'count':_0x4a1567,'rows':_0x52fc84}:null;}})[_0xfc4a('0x25')](respondWithResult(_0x35d829,null))[_0xfc4a('0x40')](handleError(_0x35d829,null));};exports[_0xfc4a('0x4c')]=function(_0x2b0780,_0x5c235e,_0x5a32ad){var _0x14f662={};var _0x55a06b={};var _0x46626a;var _0x7f77e1;return db[_0xfc4a('0x2a')]['findOne']({'where':{'id':_0x2b0780[_0xfc4a('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c235e,null))[_0xfc4a('0x25')](function(_0xc1258b){if(_0xc1258b){_0x46626a=_0xc1258b;_0x55a06b[_0xfc4a('0x2f')]=_[_0xfc4a('0x32')](db[_0xfc4a('0x48')][_0xfc4a('0x2b')]);_0x55a06b['query']=_[_0xfc4a('0x32')](_0x2b0780[_0xfc4a('0x31')]);_0x55a06b['filters']=_[_0xfc4a('0x34')](_0x55a06b[_0xfc4a('0x2f')],_0x55a06b[_0xfc4a('0x31')]);_0x14f662[_0xfc4a('0x35')]=_[_0xfc4a('0x34')](_0x55a06b[_0xfc4a('0x2f')],qs[_0xfc4a('0x36')](_0x2b0780[_0xfc4a('0x31')][_0xfc4a('0x36')]));_0x14f662['attributes']=_0x14f662[_0xfc4a('0x35')][_0xfc4a('0x37')]?_0x14f662['attributes']:_0x55a06b[_0xfc4a('0x2f')];_0x14f662['order']=qs[_0xfc4a('0x39')](_0x2b0780['query'][_0xfc4a('0x39')]);_0x14f662[_0xfc4a('0x3a')]=qs[_0xfc4a('0x33')](_[_0xfc4a('0x4a')](_0x2b0780[_0xfc4a('0x31')],_0x55a06b['filters']));if(_0x2b0780[_0xfc4a('0x31')]['filter']){_0x14f662[_0xfc4a('0x3a')]=_[_0xfc4a('0x3c')](_0x14f662[_0xfc4a('0x3a')],{'$or':_['map'](_0x14f662[_0xfc4a('0x35')],function(_0xb802c5){var _0x533e3b={};_0x533e3b[_0xb802c5]={'$like':'%'+_0x2b0780[_0xfc4a('0x31')][_0xfc4a('0x3b')]+'%'};return _0x533e3b;})});}_0x14f662=_['merge']({},_0x14f662,_0x2b0780['options']);return _0x46626a[_0xfc4a('0x4c')](_0x14f662);}})[_0xfc4a('0x25')](function(_0xe9569e){if(_0xe9569e){_0x7f77e1=_0xe9569e[_0xfc4a('0x37')];if(!_0x2b0780[_0xfc4a('0x31')][_0xfc4a('0x38')](_0xfc4a('0x4b'))){_0x14f662['limit']=qs[_0xfc4a('0x20')](_0x2b0780[_0xfc4a('0x31')][_0xfc4a('0x20')]);_0x14f662[_0xfc4a('0x1d')]=qs['offset'](_0x2b0780[_0xfc4a('0x31')][_0xfc4a('0x1d')]);}return _0x46626a['getSubjects'](_0x14f662);}})['then'](function(_0x16bab7){if(_0x16bab7){return _0x16bab7?{'count':_0x7f77e1,'rows':_0x16bab7}:null;}})[_0xfc4a('0x25')](respondWithResult(_0x5c235e,null))[_0xfc4a('0x40')](handleError(_0x5c235e,null));};exports[_0xfc4a('0x4d')]=function(_0x51941c,_0x4977e1,_0x4a50ab){var _0x52b092={};var _0x401ba5={};var _0x4fa4cc;var _0x416ffa;return db['DeskConfiguration']['findOne']({'where':{'id':_0x51941c[_0xfc4a('0x42')]['id']}})[_0xfc4a('0x25')](handleEntityNotFound(_0x4977e1,null))[_0xfc4a('0x25')](function(_0x56babc){if(_0x56babc){_0x4fa4cc=_0x56babc;_0x401ba5['model']=_[_0xfc4a('0x32')](db[_0xfc4a('0x48')]['rawAttributes']);_0x401ba5['query']=_['keys'](_0x51941c[_0xfc4a('0x31')]);_0x401ba5[_0xfc4a('0x33')]=_[_0xfc4a('0x34')](_0x401ba5[_0xfc4a('0x2f')],_0x401ba5['query']);_0x52b092[_0xfc4a('0x35')]=_[_0xfc4a('0x34')](_0x401ba5[_0xfc4a('0x2f')],qs[_0xfc4a('0x36')](_0x51941c['query'][_0xfc4a('0x36')]));_0x52b092[_0xfc4a('0x35')]=_0x52b092[_0xfc4a('0x35')]['length']?_0x52b092['attributes']:_0x401ba5['model'];_0x52b092['order']=qs[_0xfc4a('0x39')](_0x51941c[_0xfc4a('0x31')][_0xfc4a('0x39')]);_0x52b092[_0xfc4a('0x3a')]=qs[_0xfc4a('0x33')](_[_0xfc4a('0x4a')](_0x51941c[_0xfc4a('0x31')],_0x401ba5[_0xfc4a('0x33')]));if(_0x51941c[_0xfc4a('0x31')][_0xfc4a('0x3b')]){_0x52b092[_0xfc4a('0x3a')]=_[_0xfc4a('0x3c')](_0x52b092[_0xfc4a('0x3a')],{'$or':_[_0xfc4a('0x30')](_0x52b092['attributes'],function(_0x58501c){var _0x479390={};_0x479390[_0x58501c]={'$like':'%'+_0x51941c[_0xfc4a('0x31')][_0xfc4a('0x3b')]+'%'};return _0x479390;})});}_0x52b092=_[_0xfc4a('0x3c')]({},_0x52b092,_0x51941c['options']);return _0x4fa4cc[_0xfc4a('0x4d')](_0x52b092);}})[_0xfc4a('0x25')](function(_0x187dad){if(_0x187dad){_0x416ffa=_0x187dad[_0xfc4a('0x37')];if(!_0x51941c[_0xfc4a('0x31')][_0xfc4a('0x38')](_0xfc4a('0x4b'))){_0x52b092['limit']=qs[_0xfc4a('0x20')](_0x51941c[_0xfc4a('0x31')][_0xfc4a('0x20')]);_0x52b092[_0xfc4a('0x1d')]=qs['offset'](_0x51941c[_0xfc4a('0x31')][_0xfc4a('0x1d')]);}return _0x4fa4cc[_0xfc4a('0x4d')](_0x52b092);}})[_0xfc4a('0x25')](function(_0xf54673){if(_0xf54673){return _0xf54673?{'count':_0x416ffa,'rows':_0xf54673}:null;}})[_0xfc4a('0x25')](respondWithResult(_0x4977e1,null))['catch'](handleError(_0x4977e1,null));};exports[_0xfc4a('0x4e')]=function(_0x17083b,_0x1dcf75,_0x166a3e){var _0x48e4c4={};var _0x471b2a={};var _0x25ed2c;var _0x5765ff;return db[_0xfc4a('0x2a')][_0xfc4a('0x4f')]({'where':{'id':_0x17083b['params']['id']}})[_0xfc4a('0x25')](handleEntityNotFound(_0x1dcf75,null))[_0xfc4a('0x25')](function(_0x53285e){if(_0x53285e){_0x25ed2c=_0x53285e;_0x471b2a[_0xfc4a('0x2f')]=_[_0xfc4a('0x32')](db[_0xfc4a('0x50')][_0xfc4a('0x2b')]);_0x471b2a[_0xfc4a('0x31')]=_[_0xfc4a('0x32')](_0x17083b[_0xfc4a('0x31')]);_0x471b2a[_0xfc4a('0x33')]=_[_0xfc4a('0x34')](_0x471b2a[_0xfc4a('0x2f')],_0x471b2a[_0xfc4a('0x31')]);_0x48e4c4[_0xfc4a('0x35')]=_[_0xfc4a('0x34')](_0x471b2a[_0xfc4a('0x2f')],qs[_0xfc4a('0x36')](_0x17083b['query'][_0xfc4a('0x36')]));_0x48e4c4[_0xfc4a('0x35')]=_0x48e4c4['attributes']['length']?_0x48e4c4[_0xfc4a('0x35')]:_0x471b2a[_0xfc4a('0x2f')];_0x48e4c4[_0xfc4a('0x49')]=qs[_0xfc4a('0x39')](_0x17083b[_0xfc4a('0x31')][_0xfc4a('0x39')]);_0x48e4c4[_0xfc4a('0x3a')]=qs[_0xfc4a('0x33')](_['pick'](_0x17083b[_0xfc4a('0x31')],_0x471b2a[_0xfc4a('0x33')]));if(_0x17083b[_0xfc4a('0x31')][_0xfc4a('0x3b')]){_0x48e4c4[_0xfc4a('0x3a')]=_[_0xfc4a('0x3c')](_0x48e4c4['where'],{'$or':_[_0xfc4a('0x30')](_0x48e4c4[_0xfc4a('0x35')],function(_0x4aa27e){var _0x1cc824={};_0x1cc824[_0x4aa27e]={'$like':'%'+_0x17083b[_0xfc4a('0x31')][_0xfc4a('0x3b')]+'%'};return _0x1cc824;})});}_0x48e4c4=_[_0xfc4a('0x3c')]({},_0x48e4c4,_0x17083b[_0xfc4a('0x3d')]);return _0x25ed2c[_0xfc4a('0x4e')](_0x48e4c4);}})[_0xfc4a('0x25')](function(_0x5165c0){if(_0x5165c0){_0x5765ff=_0x5165c0[_0xfc4a('0x37')];if(!_0x17083b[_0xfc4a('0x31')][_0xfc4a('0x38')](_0xfc4a('0x4b'))){_0x48e4c4[_0xfc4a('0x20')]=qs['limit'](_0x17083b[_0xfc4a('0x31')][_0xfc4a('0x20')]);_0x48e4c4[_0xfc4a('0x1d')]=qs['offset'](_0x17083b['query'][_0xfc4a('0x1d')]);}return _0x25ed2c[_0xfc4a('0x4e')](_0x48e4c4);}})[_0xfc4a('0x25')](function(_0x1d432a){if(_0x1d432a){return _0x1d432a?{'count':_0x5765ff,'rows':_0x1d432a}:null;}})[_0xfc4a('0x25')](respondWithResult(_0x1dcf75,null))['catch'](handleError(_0x1dcf75,null));};exports[_0xfc4a('0x51')]=function(_0xa0aa80,_0x560a76,_0x43e481){if(_0xa0aa80[_0xfc4a('0x45')]['id']){delete _0xa0aa80[_0xfc4a('0x45')]['id'];}return db[_0xfc4a('0x2a')][_0xfc4a('0x4f')]({'where':{'id':_0xa0aa80[_0xfc4a('0x42')]['id']}})[_0xfc4a('0x25')](handleEntityNotFound(_0x560a76,null))[_0xfc4a('0x25')](function(_0x4af417){if(_0x4af417){return _0x4af417[_0xfc4a('0x51')](_0xa0aa80[_0xfc4a('0x45')][_0xfc4a('0x52')]||[]);}return null;})[_0xfc4a('0x25')](respondWithResult(_0x560a76,null))[_0xfc4a('0x40')](handleError(_0x560a76,null));}; \ No newline at end of file +var _0x6e7c=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','options','catch','create','body','find','getFields','length','findOne','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','update','destroy','then','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x15a0c3,_0xa2ae9){var _0x576900=function(_0x5ee47c){while(--_0x5ee47c){_0x15a0c3['push'](_0x15a0c3['shift']());}};_0x576900(++_0xa2ae9);}(_0x6e7c,0xbf));var _0xc6e7=function(_0x47e9dc,_0x347e4e){_0x47e9dc=_0x47e9dc-0x0;var _0x58e385=_0x6e7c[_0x47e9dc];return _0x58e385;};'use strict';var emlformat=require(_0xc6e7('0x0'));var rimraf=require(_0xc6e7('0x1'));var zipdir=require(_0xc6e7('0x2'));var jsonpatch=require(_0xc6e7('0x3'));var rp=require(_0xc6e7('0x4'));var moment=require('moment');var BPromise=require(_0xc6e7('0x5'));var Mustache=require(_0xc6e7('0x6'));var util=require(_0xc6e7('0x7'));var path=require(_0xc6e7('0x8'));var sox=require(_0xc6e7('0x9'));var csv=require(_0xc6e7('0xa'));var ejs=require(_0xc6e7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e7('0xc'));var squel=require(_0xc6e7('0xd'));var crypto=require(_0xc6e7('0xe'));var jsforce=require(_0xc6e7('0xf'));var deskjs=require(_0xc6e7('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc6e7('0x11'));var Papa=require(_0xc6e7('0x12'));var Redis=require(_0xc6e7('0x13'));var authService=require(_0xc6e7('0x14'));var qs=require(_0xc6e7('0x15'));var as=require(_0xc6e7('0x16'));var hardwareService=require(_0xc6e7('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xc6e7('0x18'));var config=require(_0xc6e7('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fc507,_0x308d50){_0x308d50=_0x308d50||0xcc;return function(_0x1d2eff){if(_0x1d2eff){return _0x4fc507[_0xc6e7('0x1a')](_0x308d50);}return _0x4fc507['status'](_0x308d50)[_0xc6e7('0x1b')]();};}function respondWithResult(_0x28327f,_0x350d7c){_0x350d7c=_0x350d7c||0xc8;return function(_0x1629d5){if(_0x1629d5){return _0x28327f['status'](_0x350d7c)[_0xc6e7('0x1c')](_0x1629d5);}};}function respondWithFilteredResult(_0x5fef18,_0x3b1638){return function(_0x59f2e6){if(_0x59f2e6){var _0x47b8f7=typeof _0x3b1638[_0xc6e7('0x1d')]===_0xc6e7('0x1e')&&typeof _0x3b1638[_0xc6e7('0x1f')]==='undefined';var _0x1fed67=_0x59f2e6[_0xc6e7('0x20')];var _0x140ad8=_0x47b8f7?0x0:_0x3b1638[_0xc6e7('0x1d')];var _0x3e2e44=_0x47b8f7?_0x59f2e6[_0xc6e7('0x20')]:_0x3b1638[_0xc6e7('0x1d')]+_0x3b1638[_0xc6e7('0x1f')];var _0x4da367;if(_0x3e2e44>=_0x1fed67){_0x3e2e44=_0x1fed67;_0x4da367=0xc8;}else{_0x4da367=0xce;}_0x5fef18[_0xc6e7('0x21')](_0x4da367);return _0x5fef18['set'](_0xc6e7('0x22'),_0x140ad8+'-'+_0x3e2e44+'/'+_0x1fed67)[_0xc6e7('0x1c')](_0x59f2e6);}return null;};}function patchUpdates(_0x3ac665){return function(_0x4bc68e){try{jsonpatch['apply'](_0x4bc68e,_0x3ac665,!![]);}catch(_0x4d7aa0){return BPromise[_0xc6e7('0x23')](_0x4d7aa0);}return _0x4bc68e['save']();};}function saveUpdates(_0x409c21,_0x5268e5){return function(_0x58ce4c){if(_0x58ce4c){return _0x58ce4c[_0xc6e7('0x24')](_0x409c21)['then'](function(_0x598db0){return _0x598db0;});}return null;};}function removeEntity(_0x37eb05,_0x50e8ff){return function(_0x266d77){if(_0x266d77){return _0x266d77[_0xc6e7('0x25')]()[_0xc6e7('0x26')](function(){_0x37eb05[_0xc6e7('0x21')](0xcc)[_0xc6e7('0x1b')]();});}};}function handleEntityNotFound(_0x5420d0,_0x152082){return function(_0x146504){if(!_0x146504){_0x5420d0[_0xc6e7('0x1a')](0x194);}return _0x146504;};}function handleError(_0x550acd,_0x1c3177){_0x1c3177=_0x1c3177||0x1f4;return function(_0x5d105c){logger['error'](_0x5d105c[_0xc6e7('0x27')]);if(_0x5d105c[_0xc6e7('0x28')]){delete _0x5d105c[_0xc6e7('0x28')];}_0x550acd['status'](_0x1c3177)[_0xc6e7('0x29')](_0x5d105c);};}exports['index']=function(_0x25343d,_0x4dd29b){var _0x7a27a3={},_0x514d21={},_0x5dc786={'count':0x0,'rows':[]};var _0xbdba37=_[_0xc6e7('0x2a')](db[_0xc6e7('0x2b')][_0xc6e7('0x2c')],function(_0x4cc229){return{'name':_0x4cc229[_0xc6e7('0x2d')],'type':_0x4cc229[_0xc6e7('0x2e')][_0xc6e7('0x2f')]};});_0x514d21[_0xc6e7('0x30')]=_[_0xc6e7('0x2a')](_0xbdba37,_0xc6e7('0x28'));_0x514d21[_0xc6e7('0x31')]=_[_0xc6e7('0x32')](_0x25343d['query']);_0x514d21[_0xc6e7('0x33')]=_['intersection'](_0x514d21[_0xc6e7('0x30')],_0x514d21[_0xc6e7('0x31')]);_0x7a27a3[_0xc6e7('0x34')]=_[_0xc6e7('0x35')](_0x514d21['model'],qs[_0xc6e7('0x36')](_0x25343d[_0xc6e7('0x31')][_0xc6e7('0x36')]));_0x7a27a3[_0xc6e7('0x34')]=_0x7a27a3[_0xc6e7('0x34')]['length']?_0x7a27a3['attributes']:_0x514d21[_0xc6e7('0x30')];if(!_0x25343d[_0xc6e7('0x31')][_0xc6e7('0x37')](_0xc6e7('0x38'))){_0x7a27a3[_0xc6e7('0x1f')]=qs[_0xc6e7('0x1f')](_0x25343d[_0xc6e7('0x31')]['limit']);_0x7a27a3[_0xc6e7('0x1d')]=qs[_0xc6e7('0x1d')](_0x25343d[_0xc6e7('0x31')][_0xc6e7('0x1d')]);}_0x7a27a3['order']=qs[_0xc6e7('0x39')](_0x25343d[_0xc6e7('0x31')]['sort']);_0x7a27a3[_0xc6e7('0x3a')]=qs[_0xc6e7('0x33')](_[_0xc6e7('0x3b')](_0x25343d[_0xc6e7('0x31')],_0x514d21[_0xc6e7('0x33')]),_0xbdba37);if(_0x25343d[_0xc6e7('0x31')][_0xc6e7('0x3c')]){_0x7a27a3[_0xc6e7('0x3a')]=_['merge'](_0x7a27a3['where'],{'$or':_[_0xc6e7('0x2a')](_0xbdba37,function(_0x4c155a){if(_0x4c155a[_0xc6e7('0x2e')]!=='VIRTUAL'){var _0x221b2a={};_0x221b2a[_0x4c155a[_0xc6e7('0x28')]]={'$like':'%'+_0x25343d[_0xc6e7('0x31')]['filter']+'%'};return _0x221b2a;}})});}_0x7a27a3=_[_0xc6e7('0x3d')]({},_0x7a27a3,_0x25343d['options']);var _0x30486a={'where':_0x7a27a3['where']};return db['DeskConfiguration'][_0xc6e7('0x20')](_0x30486a)[_0xc6e7('0x26')](function(_0x44e530){_0x5dc786['count']=_0x44e530;if(_0x25343d[_0xc6e7('0x31')][_0xc6e7('0x3e')]){_0x7a27a3[_0xc6e7('0x3f')]=[{'all':!![]}];}return db[_0xc6e7('0x2b')][_0xc6e7('0x40')](_0x7a27a3);})[_0xc6e7('0x26')](function(_0x48a925){_0x5dc786[_0xc6e7('0x41')]=_0x48a925;return _0x5dc786;})['then'](respondWithFilteredResult(_0x4dd29b,_0x7a27a3))['catch'](handleError(_0x4dd29b,null));};exports['show']=function(_0x5bce7c,_0x42185c){var _0x2e61cb={'raw':![],'where':{'id':_0x5bce7c[_0xc6e7('0x42')]['id']}},_0x1ae42a={};_0x1ae42a[_0xc6e7('0x30')]=_[_0xc6e7('0x32')](db[_0xc6e7('0x2b')]['rawAttributes']);_0x1ae42a[_0xc6e7('0x31')]=_[_0xc6e7('0x32')](_0x5bce7c[_0xc6e7('0x31')]);_0x1ae42a[_0xc6e7('0x33')]=_[_0xc6e7('0x35')](_0x1ae42a['model'],_0x1ae42a['query']);_0x2e61cb[_0xc6e7('0x34')]=_[_0xc6e7('0x35')](_0x1ae42a['model'],qs[_0xc6e7('0x36')](_0x5bce7c[_0xc6e7('0x31')][_0xc6e7('0x36')]));_0x2e61cb['attributes']=_0x2e61cb['attributes']['length']?_0x2e61cb[_0xc6e7('0x34')]:_0x1ae42a['model'];if(_0x5bce7c[_0xc6e7('0x31')][_0xc6e7('0x3e')]){_0x2e61cb[_0xc6e7('0x3f')]=[{'all':!![]}];}_0x2e61cb=_[_0xc6e7('0x3d')]({},_0x2e61cb,_0x5bce7c[_0xc6e7('0x43')]);return db[_0xc6e7('0x2b')]['find'](_0x2e61cb)['then'](handleEntityNotFound(_0x42185c,null))[_0xc6e7('0x26')](respondWithResult(_0x42185c,null))[_0xc6e7('0x44')](handleError(_0x42185c,null));};exports[_0xc6e7('0x45')]=function(_0x1c57e2,_0x531a90){return db['DeskConfiguration']['create'](_0x1c57e2[_0xc6e7('0x46')],{})['then'](respondWithResult(_0x531a90,0xc9))[_0xc6e7('0x44')](handleError(_0x531a90,null));};exports['update']=function(_0x291b90,_0xd21b58){if(_0x291b90[_0xc6e7('0x46')]['id']){delete _0x291b90[_0xc6e7('0x46')]['id'];}return db[_0xc6e7('0x2b')][_0xc6e7('0x47')]({'where':{'id':_0x291b90[_0xc6e7('0x42')]['id']}})[_0xc6e7('0x26')](handleEntityNotFound(_0xd21b58,null))['then'](saveUpdates(_0x291b90[_0xc6e7('0x46')],null))[_0xc6e7('0x26')](respondWithResult(_0xd21b58,null))['catch'](handleError(_0xd21b58,null));};exports[_0xc6e7('0x25')]=function(_0x492b65,_0xfd4a85){return db[_0xc6e7('0x2b')][_0xc6e7('0x47')]({'where':{'id':_0x492b65[_0xc6e7('0x42')]['id']}})['then'](handleEntityNotFound(_0xfd4a85,null))['then'](removeEntity(_0xfd4a85,null))[_0xc6e7('0x44')](handleError(_0xfd4a85,null));};exports['getFields']=function(_0x54bfb9,_0x317786,_0x1ddfb9){var _0x2bee45={};var _0x293145={};var _0xe6ed1b;var _0x39b941;return db['DeskConfiguration']['findOne']({'where':{'id':_0x54bfb9[_0xc6e7('0x42')]['id']}})['then'](handleEntityNotFound(_0x317786,null))['then'](function(_0x73e347){if(_0x73e347){_0xe6ed1b=_0x73e347;_0x293145[_0xc6e7('0x30')]=_[_0xc6e7('0x32')](db['DeskField'][_0xc6e7('0x2c')]);_0x293145['query']=_[_0xc6e7('0x32')](_0x54bfb9[_0xc6e7('0x31')]);_0x293145[_0xc6e7('0x33')]=_[_0xc6e7('0x35')](_0x293145[_0xc6e7('0x30')],_0x293145[_0xc6e7('0x31')]);_0x2bee45[_0xc6e7('0x34')]=_[_0xc6e7('0x35')](_0x293145['model'],qs['fields'](_0x54bfb9['query'][_0xc6e7('0x36')]));_0x2bee45[_0xc6e7('0x34')]=_0x2bee45['attributes']['length']?_0x2bee45[_0xc6e7('0x34')]:_0x293145['model'];_0x2bee45['order']=qs['sort'](_0x54bfb9[_0xc6e7('0x31')][_0xc6e7('0x39')]);_0x2bee45[_0xc6e7('0x3a')]=qs[_0xc6e7('0x33')](_[_0xc6e7('0x3b')](_0x54bfb9[_0xc6e7('0x31')],_0x293145[_0xc6e7('0x33')]));if(_0x54bfb9['query'][_0xc6e7('0x3c')]){_0x2bee45[_0xc6e7('0x3a')]=_['merge'](_0x2bee45[_0xc6e7('0x3a')],{'$or':_[_0xc6e7('0x2a')](_0x2bee45[_0xc6e7('0x34')],function(_0x52492e){var _0x515faf={};_0x515faf[_0x52492e]={'$like':'%'+_0x54bfb9['query'][_0xc6e7('0x3c')]+'%'};return _0x515faf;})});}_0x2bee45=_[_0xc6e7('0x3d')]({},_0x2bee45,_0x54bfb9[_0xc6e7('0x43')]);return _0xe6ed1b[_0xc6e7('0x48')](_0x2bee45);}})[_0xc6e7('0x26')](function(_0x53c306){if(_0x53c306){_0x39b941=_0x53c306[_0xc6e7('0x49')];if(!_0x54bfb9[_0xc6e7('0x31')][_0xc6e7('0x37')](_0xc6e7('0x38'))){_0x2bee45[_0xc6e7('0x1f')]=qs[_0xc6e7('0x1f')](_0x54bfb9[_0xc6e7('0x31')][_0xc6e7('0x1f')]);_0x2bee45['offset']=qs[_0xc6e7('0x1d')](_0x54bfb9['query']['offset']);}return _0xe6ed1b['getFields'](_0x2bee45);}})[_0xc6e7('0x26')](function(_0x1701cf){if(_0x1701cf){return _0x1701cf?{'count':_0x39b941,'rows':_0x1701cf}:null;}})['then'](respondWithResult(_0x317786,null))[_0xc6e7('0x44')](handleError(_0x317786,null));};exports['getSubjects']=function(_0x91b6e4,_0x5382eb,_0x5f0ce0){var _0x461e4d={};var _0x1b3b93={};var _0x78b156;var _0x20e848;return db[_0xc6e7('0x2b')][_0xc6e7('0x4a')]({'where':{'id':_0x91b6e4[_0xc6e7('0x42')]['id']}})[_0xc6e7('0x26')](handleEntityNotFound(_0x5382eb,null))['then'](function(_0x525da9){if(_0x525da9){_0x78b156=_0x525da9;_0x1b3b93['model']=_[_0xc6e7('0x32')](db['DeskField'][_0xc6e7('0x2c')]);_0x1b3b93['query']=_['keys'](_0x91b6e4['query']);_0x1b3b93['filters']=_['intersection'](_0x1b3b93[_0xc6e7('0x30')],_0x1b3b93['query']);_0x461e4d[_0xc6e7('0x34')]=_[_0xc6e7('0x35')](_0x1b3b93[_0xc6e7('0x30')],qs[_0xc6e7('0x36')](_0x91b6e4[_0xc6e7('0x31')][_0xc6e7('0x36')]));_0x461e4d[_0xc6e7('0x34')]=_0x461e4d[_0xc6e7('0x34')][_0xc6e7('0x49')]?_0x461e4d['attributes']:_0x1b3b93[_0xc6e7('0x30')];_0x461e4d[_0xc6e7('0x4b')]=qs['sort'](_0x91b6e4['query']['sort']);_0x461e4d[_0xc6e7('0x3a')]=qs[_0xc6e7('0x33')](_[_0xc6e7('0x3b')](_0x91b6e4[_0xc6e7('0x31')],_0x1b3b93[_0xc6e7('0x33')]));if(_0x91b6e4[_0xc6e7('0x31')][_0xc6e7('0x3c')]){_0x461e4d[_0xc6e7('0x3a')]=_['merge'](_0x461e4d[_0xc6e7('0x3a')],{'$or':_[_0xc6e7('0x2a')](_0x461e4d['attributes'],function(_0xf03a56){var _0x5ed8ca={};_0x5ed8ca[_0xf03a56]={'$like':'%'+_0x91b6e4[_0xc6e7('0x31')][_0xc6e7('0x3c')]+'%'};return _0x5ed8ca;})});}_0x461e4d=_[_0xc6e7('0x3d')]({},_0x461e4d,_0x91b6e4['options']);return _0x78b156[_0xc6e7('0x4c')](_0x461e4d);}})[_0xc6e7('0x26')](function(_0x4d5025){if(_0x4d5025){_0x20e848=_0x4d5025['length'];if(!_0x91b6e4[_0xc6e7('0x31')][_0xc6e7('0x37')](_0xc6e7('0x38'))){_0x461e4d[_0xc6e7('0x1f')]=qs['limit'](_0x91b6e4[_0xc6e7('0x31')][_0xc6e7('0x1f')]);_0x461e4d[_0xc6e7('0x1d')]=qs['offset'](_0x91b6e4[_0xc6e7('0x31')][_0xc6e7('0x1d')]);}return _0x78b156[_0xc6e7('0x4c')](_0x461e4d);}})['then'](function(_0x5c3046){if(_0x5c3046){return _0x5c3046?{'count':_0x20e848,'rows':_0x5c3046}:null;}})[_0xc6e7('0x26')](respondWithResult(_0x5382eb,null))[_0xc6e7('0x44')](handleError(_0x5382eb,null));};exports[_0xc6e7('0x4d')]=function(_0x526d0e,_0x495b74,_0x2f11bd){var _0x3376c4={};var _0x3838b0={};var _0x2cd1e0;var _0x445321;return db[_0xc6e7('0x2b')][_0xc6e7('0x4a')]({'where':{'id':_0x526d0e['params']['id']}})[_0xc6e7('0x26')](handleEntityNotFound(_0x495b74,null))[_0xc6e7('0x26')](function(_0x8be94a){if(_0x8be94a){_0x2cd1e0=_0x8be94a;_0x3838b0['model']=_[_0xc6e7('0x32')](db['DeskField']['rawAttributes']);_0x3838b0[_0xc6e7('0x31')]=_[_0xc6e7('0x32')](_0x526d0e[_0xc6e7('0x31')]);_0x3838b0[_0xc6e7('0x33')]=_[_0xc6e7('0x35')](_0x3838b0[_0xc6e7('0x30')],_0x3838b0['query']);_0x3376c4[_0xc6e7('0x34')]=_[_0xc6e7('0x35')](_0x3838b0[_0xc6e7('0x30')],qs[_0xc6e7('0x36')](_0x526d0e['query'][_0xc6e7('0x36')]));_0x3376c4[_0xc6e7('0x34')]=_0x3376c4[_0xc6e7('0x34')][_0xc6e7('0x49')]?_0x3376c4[_0xc6e7('0x34')]:_0x3838b0['model'];_0x3376c4[_0xc6e7('0x4b')]=qs[_0xc6e7('0x39')](_0x526d0e[_0xc6e7('0x31')][_0xc6e7('0x39')]);_0x3376c4[_0xc6e7('0x3a')]=qs[_0xc6e7('0x33')](_[_0xc6e7('0x3b')](_0x526d0e['query'],_0x3838b0[_0xc6e7('0x33')]));if(_0x526d0e[_0xc6e7('0x31')][_0xc6e7('0x3c')]){_0x3376c4['where']=_[_0xc6e7('0x3d')](_0x3376c4[_0xc6e7('0x3a')],{'$or':_[_0xc6e7('0x2a')](_0x3376c4['attributes'],function(_0x48f3e3){var _0x208332={};_0x208332[_0x48f3e3]={'$like':'%'+_0x526d0e['query'][_0xc6e7('0x3c')]+'%'};return _0x208332;})});}_0x3376c4=_[_0xc6e7('0x3d')]({},_0x3376c4,_0x526d0e['options']);return _0x2cd1e0[_0xc6e7('0x4d')](_0x3376c4);}})[_0xc6e7('0x26')](function(_0xd097da){if(_0xd097da){_0x445321=_0xd097da[_0xc6e7('0x49')];if(!_0x526d0e['query']['hasOwnProperty'](_0xc6e7('0x38'))){_0x3376c4[_0xc6e7('0x1f')]=qs['limit'](_0x526d0e[_0xc6e7('0x31')]['limit']);_0x3376c4['offset']=qs['offset'](_0x526d0e[_0xc6e7('0x31')][_0xc6e7('0x1d')]);}return _0x2cd1e0[_0xc6e7('0x4d')](_0x3376c4);}})['then'](function(_0x68ce8b){if(_0x68ce8b){return _0x68ce8b?{'count':_0x445321,'rows':_0x68ce8b}:null;}})['then'](respondWithResult(_0x495b74,null))[_0xc6e7('0x44')](handleError(_0x495b74,null));};exports[_0xc6e7('0x4e')]=function(_0x1f77f1,_0x25fa68,_0x4f21bf){var _0x3bf036={};var _0x1e5c6e={};var _0xc672c7;var _0xd483fe;return db[_0xc6e7('0x2b')][_0xc6e7('0x4a')]({'where':{'id':_0x1f77f1['params']['id']}})['then'](handleEntityNotFound(_0x25fa68,null))['then'](function(_0x3a632f){if(_0x3a632f){_0xc672c7=_0x3a632f;_0x1e5c6e[_0xc6e7('0x30')]=_[_0xc6e7('0x32')](db[_0xc6e7('0x4f')][_0xc6e7('0x2c')]);_0x1e5c6e[_0xc6e7('0x31')]=_[_0xc6e7('0x32')](_0x1f77f1['query']);_0x1e5c6e['filters']=_['intersection'](_0x1e5c6e['model'],_0x1e5c6e[_0xc6e7('0x31')]);_0x3bf036[_0xc6e7('0x34')]=_['intersection'](_0x1e5c6e[_0xc6e7('0x30')],qs[_0xc6e7('0x36')](_0x1f77f1[_0xc6e7('0x31')][_0xc6e7('0x36')]));_0x3bf036[_0xc6e7('0x34')]=_0x3bf036[_0xc6e7('0x34')]['length']?_0x3bf036[_0xc6e7('0x34')]:_0x1e5c6e[_0xc6e7('0x30')];_0x3bf036[_0xc6e7('0x4b')]=qs[_0xc6e7('0x39')](_0x1f77f1[_0xc6e7('0x31')][_0xc6e7('0x39')]);_0x3bf036[_0xc6e7('0x3a')]=qs[_0xc6e7('0x33')](_['pick'](_0x1f77f1[_0xc6e7('0x31')],_0x1e5c6e[_0xc6e7('0x33')]));if(_0x1f77f1['query']['filter']){_0x3bf036[_0xc6e7('0x3a')]=_['merge'](_0x3bf036[_0xc6e7('0x3a')],{'$or':_[_0xc6e7('0x2a')](_0x3bf036['attributes'],function(_0x5bc47c){var _0xc06d9={};_0xc06d9[_0x5bc47c]={'$like':'%'+_0x1f77f1[_0xc6e7('0x31')][_0xc6e7('0x3c')]+'%'};return _0xc06d9;})});}_0x3bf036=_[_0xc6e7('0x3d')]({},_0x3bf036,_0x1f77f1[_0xc6e7('0x43')]);return _0xc672c7['getTags'](_0x3bf036);}})[_0xc6e7('0x26')](function(_0x5c4f7a){if(_0x5c4f7a){_0xd483fe=_0x5c4f7a[_0xc6e7('0x49')];if(!_0x1f77f1[_0xc6e7('0x31')]['hasOwnProperty']('nolimit')){_0x3bf036[_0xc6e7('0x1f')]=qs[_0xc6e7('0x1f')](_0x1f77f1[_0xc6e7('0x31')]['limit']);_0x3bf036[_0xc6e7('0x1d')]=qs['offset'](_0x1f77f1[_0xc6e7('0x31')][_0xc6e7('0x1d')]);}return _0xc672c7[_0xc6e7('0x4e')](_0x3bf036);}})[_0xc6e7('0x26')](function(_0x59079c){if(_0x59079c){return _0x59079c?{'count':_0xd483fe,'rows':_0x59079c}:null;}})['then'](respondWithResult(_0x25fa68,null))[_0xc6e7('0x44')](handleError(_0x25fa68,null));};exports[_0xc6e7('0x50')]=function(_0x2523f2,_0x59af8f,_0x1c4369){if(_0x2523f2[_0xc6e7('0x46')]['id']){delete _0x2523f2['body']['id'];}return db[_0xc6e7('0x2b')][_0xc6e7('0x4a')]({'where':{'id':_0x2523f2['params']['id']}})[_0xc6e7('0x26')](handleEntityNotFound(_0x59af8f,null))[_0xc6e7('0x26')](function(_0x7b4083){if(_0x7b4083){return _0x7b4083[_0xc6e7('0x50')](_0x2523f2[_0xc6e7('0x46')][_0xc6e7('0x51')]||[]);}return null;})[_0xc6e7('0x26')](respondWithResult(_0x59af8f,null))[_0xc6e7('0x44')](handleError(_0x59af8f,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8dd4405..5a66f4c 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 _0x59e0=['rimraf','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x1e7b02,_0x229281){var _0x130830=function(_0x508597){while(--_0x508597){_0x1e7b02['push'](_0x1e7b02['shift']());}};_0x130830(++_0x229281);}(_0x59e0,0x102));var _0x059e=function(_0x475c13,_0x14a866){_0x475c13=_0x475c13-0x0;var _0x117cfc=_0x59e0[_0x475c13];return _0x117cfc;};'use strict';var _=require(_0x059e('0x0'));var util=require('util');var logger=require(_0x059e('0x1'))(_0x059e('0x2'));var moment=require(_0x059e('0x3'));var BPromise=require('bluebird');var rp=require(_0x059e('0x4'));var fs=require('fs');var path=require(_0x059e('0x5'));var rimraf=require(_0x059e('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x059e('0x7')]=function(_0x46dec3,_0x56ba69){return _0x46dec3[_0x059e('0x8')](_0x059e('0x9'),attributes,{'tableName':_0x059e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec15=['../../config/logger','api','bluebird','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x417fbb,_0x300917){var _0x18ab13=function(_0xf005a7){while(--_0xf005a7){_0x417fbb['push'](_0x417fbb['shift']());}};_0x18ab13(++_0x300917);}(_0xec15,0x167));var _0x5ec1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec15[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5ec1('0x0'));var util=require('util');var logger=require(_0x5ec1('0x1'))(_0x5ec1('0x2'));var moment=require('moment');var BPromise=require(_0x5ec1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ec1('0x4'));module['exports']=function(_0x5ef2c5,_0x32df48){return _0x5ef2c5[_0x5ec1('0x5')](_0x5ec1('0x6'),attributes,{'tableName':_0x5ec1('0x7'),'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 17fc238..2da8475 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 _0xce08=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x6f3151,_0x406745){var _0x305fb8=function(_0x24e5a8){while(--_0x24e5a8){_0x6f3151['push'](_0x6f3151['shift']());}};_0x305fb8(++_0x406745);}(_0xce08,0xb4));var _0x8ce0=function(_0x1a10c0,_0xc8b33e){_0x1a10c0=_0x1a10c0-0x0;var _0x35af71=_0xce08[_0x1a10c0];return _0x35af71;};'use strict';var _=require(_0x8ce0('0x0'));var util=require(_0x8ce0('0x1'));var moment=require(_0x8ce0('0x2'));var BPromise=require(_0x8ce0('0x3'));var rs=require(_0x8ce0('0x4'));var fs=require('fs');var Redis=require(_0x8ce0('0x5'));var db=require(_0x8ce0('0x6'))['db'];var utils=require(_0x8ce0('0x7'));var logger=require('../../config/logger')(_0x8ce0('0x8'));var config=require('../../config/environment');var jayson=require(_0x8ce0('0x9'));var client=jayson[_0x8ce0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b2cf2,_0x1bbc5b,_0x66dc09){return new BPromise(function(_0x19c898,_0x1aa771){return client[_0x8ce0('0xb')](_0x5b2cf2,_0x66dc09)[_0x8ce0('0xc')](function(_0x2b5fa9){logger[_0x8ce0('0xd')](_0x8ce0('0xe'),_0x1bbc5b,_0x8ce0('0xf'));logger['debug'](_0x8ce0('0x10'),_0x1bbc5b,_0x8ce0('0xf'),JSON[_0x8ce0('0x11')](_0x2b5fa9));if(_0x2b5fa9[_0x8ce0('0x12')]){if(_0x2b5fa9[_0x8ce0('0x12')][_0x8ce0('0x13')]===0x1f4){logger['error'](_0x8ce0('0xe'),_0x1bbc5b,_0x2b5fa9[_0x8ce0('0x12')][_0x8ce0('0x14')]);return _0x1aa771(_0x2b5fa9['error'][_0x8ce0('0x14')]);}logger['error'](_0x8ce0('0xe'),_0x1bbc5b,_0x2b5fa9[_0x8ce0('0x12')]['message']);return _0x19c898(_0x2b5fa9[_0x8ce0('0x12')][_0x8ce0('0x14')]);}else{logger[_0x8ce0('0xd')](_0x8ce0('0xe'),_0x1bbc5b,_0x8ce0('0xf'));_0x19c898(_0x2b5fa9[_0x8ce0('0x15')]['message']);}})[_0x8ce0('0x16')](function(_0x125a4d){logger[_0x8ce0('0x12')](_0x8ce0('0xe'),_0x1bbc5b,_0x125a4d);_0x1aa771(_0x125a4d);});});} \ No newline at end of file +var _0xdd6a=['../../config/environment','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xdd6a,0x15d));var _0xadd6=function(_0x483f52,_0x8466d7){_0x483f52=_0x483f52-0x0;var _0x1b9605=_0xdd6a[_0x483f52];return _0x1b9605;};'use strict';var _=require(_0xadd6('0x0'));var util=require(_0xadd6('0x1'));var moment=require('moment');var BPromise=require(_0xadd6('0x2'));var rs=require(_0xadd6('0x3'));var fs=require('fs');var Redis=require(_0xadd6('0x4'));var db=require(_0xadd6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xadd6('0x6'))(_0xadd6('0x7'));var config=require(_0xadd6('0x8'));var jayson=require(_0xadd6('0x9'));var client=jayson[_0xadd6('0xa')][_0xadd6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c2cc1,_0x4368d0,_0x51cbe6){return new BPromise(function(_0x27be41,_0x119801){return client[_0xadd6('0xc')](_0x5c2cc1,_0x51cbe6)['then'](function(_0x100341){logger['info'](_0xadd6('0xd'),_0x4368d0,_0xadd6('0xe'));logger[_0xadd6('0xf')](_0xadd6('0x10'),_0x4368d0,_0xadd6('0xe'),JSON[_0xadd6('0x11')](_0x100341));if(_0x100341['error']){if(_0x100341[_0xadd6('0x12')][_0xadd6('0x13')]===0x1f4){logger[_0xadd6('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x4368d0,_0x100341['error']['message']);return _0x119801(_0x100341['error']['message']);}logger[_0xadd6('0x12')](_0xadd6('0xd'),_0x4368d0,_0x100341[_0xadd6('0x12')][_0xadd6('0x14')]);return _0x27be41(_0x100341['error'][_0xadd6('0x14')]);}else{logger['info'](_0xadd6('0xd'),_0x4368d0,_0xadd6('0xe'));_0x27be41(_0x100341['result'][_0xadd6('0x14')]);}})['catch'](function(_0xd17027){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4368d0,_0xd17027);_0x119801(_0xd17027);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index bcc360b..e14ba00 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 _0xe3bb=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3df871,_0xda2e11){var _0x570f7b=function(_0xfaac78){while(--_0xfaac78){_0x3df871['push'](_0x3df871['shift']());}};_0x570f7b(++_0xda2e11);}(_0xe3bb,0x1c8));var _0xbe3b=function(_0x448e8d,_0x43a056){_0x448e8d=_0x448e8d-0x0;var _0x46e774=_0xe3bb[_0x448e8d];return _0x46e774;};'use strict';var multer=require(_0xbe3b('0x0'));var util=require(_0xbe3b('0x1'));var path=require(_0xbe3b('0x2'));var timeout=require(_0xbe3b('0x3'));var express=require(_0xbe3b('0x4'));var router=express['Router']();var fs_extra=require(_0xbe3b('0x5'));var auth=require(_0xbe3b('0x6'));var interaction=require(_0xbe3b('0x7'));var config=require(_0xbe3b('0x8'));var controller=require(_0xbe3b('0x9'));router[_0xbe3b('0xa')]('/',auth['isAuthenticated'](),controller[_0xbe3b('0xb')]);router[_0xbe3b('0xa')]('/:id',auth[_0xbe3b('0xc')](),controller[_0xbe3b('0xd')]);router[_0xbe3b('0xe')]('/',auth[_0xbe3b('0xc')](),controller[_0xbe3b('0xf')]);router['put'](_0xbe3b('0x10'),auth[_0xbe3b('0xc')](),controller[_0xbe3b('0x11')]);router[_0xbe3b('0x12')](_0xbe3b('0x10'),auth[_0xbe3b('0xc')](),controller[_0xbe3b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4295=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0x4295,0x147));var _0x5429=function(_0x32e264,_0x41cee8){_0x32e264=_0x32e264-0x0;var _0x1d7175=_0x4295[_0x32e264];return _0x1d7175;};'use strict';var multer=require('multer');var util=require(_0x5429('0x0'));var path=require(_0x5429('0x1'));var timeout=require('connect-timeout');var express=require(_0x5429('0x2'));var router=express[_0x5429('0x3')]();var fs_extra=require(_0x5429('0x4'));var auth=require(_0x5429('0x5'));var interaction=require(_0x5429('0x6'));var config=require('../../config/environment');var controller=require(_0x5429('0x7'));router[_0x5429('0x8')]('/',auth[_0x5429('0x9')](),controller[_0x5429('0xa')]);router[_0x5429('0x8')](_0x5429('0xb'),auth[_0x5429('0x9')](),controller[_0x5429('0xc')]);router[_0x5429('0xd')]('/',auth[_0x5429('0x9')](),controller['create']);router[_0x5429('0xe')](_0x5429('0xb'),auth[_0x5429('0x9')](),controller[_0x5429('0xf')]);router[_0x5429('0x10')](_0x5429('0xb'),auth['isAuthenticated'](),controller[_0x5429('0x11')]);module[_0x5429('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 907d508..9dcd582 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 _0xfff8=['sequelize','variable','customVariable','picklist','string','STRING','BOOLEAN'];(function(_0x562e89,_0x236fcf){var _0xdb7b85=function(_0x24246e){while(--_0x24246e){_0x562e89['push'](_0x562e89['shift']());}};_0xdb7b85(++_0x236fcf);}(_0xfff8,0x188));var _0x8fff=function(_0x18cb73,_0x1a9f76){_0x18cb73=_0x18cb73-0x0;var _0x35e43e=_0xfff8[_0x18cb73];return _0x35e43e;};'use strict';var Sequelize=require(_0x8fff('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x8fff('0x1'),_0x8fff('0x2'),'keyValue',_0x8fff('0x3')),'defaultValue':_0x8fff('0x4')},'content':{'type':Sequelize[_0x8fff('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8fff('0x4'),_0x8fff('0x1'),_0x8fff('0x2'))},'keyContent':{'type':Sequelize[_0x8fff('0x5')]},'idField':{'type':Sequelize[_0x8fff('0x5')]},'nameField':{'type':Sequelize[_0x8fff('0x5')]},'customField':{'type':Sequelize[_0x8fff('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8fff('0x5')]}}; \ No newline at end of file +var _0x2432=['BOOLEAN','sequelize','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0xa4426b,_0x1ac322){var _0x2c026c=function(_0x16671e){while(--_0x16671e){_0xa4426b['push'](_0xa4426b['shift']());}};_0x2c026c(++_0x1ac322);}(_0x2432,0x1b1));var _0x2243=function(_0x1b75f6,_0x187790){_0x1b75f6=_0x1b75f6-0x0;var _0x4be7d5=_0x2432[_0x1b75f6];return _0x4be7d5;};'use strict';var Sequelize=require(_0x2243('0x0'));module['exports']={'type':{'type':Sequelize[_0x2243('0x1')](_0x2243('0x2'),'variable',_0x2243('0x3'),_0x2243('0x4'),_0x2243('0x5')),'defaultValue':_0x2243('0x2')},'content':{'type':Sequelize[_0x2243('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2243('0x1')](_0x2243('0x2'),'variable',_0x2243('0x3'))},'keyContent':{'type':Sequelize[_0x2243('0x6')]},'idField':{'type':Sequelize[_0x2243('0x6')]},'nameField':{'type':Sequelize[_0x2243('0x6')]},'customField':{'type':Sequelize[_0x2243('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index cbde4b6..eca8ced 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 _0x8c97=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','DeskField','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x10dea3,_0x3aeeb0){var _0x1aeef=function(_0x281afa){while(--_0x281afa){_0x10dea3['push'](_0x10dea3['shift']());}};_0x1aeef(++_0x3aeeb0);}(_0x8c97,0x194));var _0x78c9=function(_0x3f5844,_0x3b679b){_0x3f5844=_0x3f5844-0x0;var _0x1956b4=_0x8c97[_0x3f5844];return _0x1956b4;};'use strict';var emlformat=require(_0x78c9('0x0'));var rimraf=require(_0x78c9('0x1'));var zipdir=require(_0x78c9('0x2'));var jsonpatch=require(_0x78c9('0x3'));var rp=require('request-promise');var moment=require(_0x78c9('0x4'));var BPromise=require(_0x78c9('0x5'));var Mustache=require('mustache');var util=require(_0x78c9('0x6'));var path=require(_0x78c9('0x7'));var sox=require(_0x78c9('0x8'));var csv=require(_0x78c9('0x9'));var ejs=require(_0x78c9('0xa'));var fs=require('fs');var fs_extra=require(_0x78c9('0xb'));var _=require(_0x78c9('0xc'));var squel=require(_0x78c9('0xd'));var crypto=require(_0x78c9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x78c9('0xf'));var toCsv=require(_0x78c9('0x9'));var querystring=require(_0x78c9('0x10'));var Papa=require('papaparse');var Redis=require(_0x78c9('0x11'));var authService=require(_0x78c9('0x12'));var qs=require(_0x78c9('0x13'));var as=require(_0x78c9('0x14'));var hardwareService=require(_0x78c9('0x15'));var logger=require(_0x78c9('0x16'))(_0x78c9('0x17'));var utils=require('../../config/utils');var config=require(_0x78c9('0x18'));var licenseUtil=require(_0x78c9('0x19'));var db=require(_0x78c9('0x1a'))['db'];function respondWithStatusCode(_0x5e515e,_0x3f21a6){_0x3f21a6=_0x3f21a6||0xcc;return function(_0x5e450d){if(_0x5e450d){return _0x5e515e['sendStatus'](_0x3f21a6);}return _0x5e515e[_0x78c9('0x1b')](_0x3f21a6)[_0x78c9('0x1c')]();};}function respondWithResult(_0x4e051a,_0x58be8c){_0x58be8c=_0x58be8c||0xc8;return function(_0x3010d3){if(_0x3010d3){return _0x4e051a[_0x78c9('0x1b')](_0x58be8c)[_0x78c9('0x1d')](_0x3010d3);}};}function respondWithFilteredResult(_0x3ad95d,_0x34a7b2){return function(_0x2d440d){if(_0x2d440d){var _0x5b6476=typeof _0x34a7b2[_0x78c9('0x1e')]===_0x78c9('0x1f')&&typeof _0x34a7b2[_0x78c9('0x20')]===_0x78c9('0x1f');var _0x41ad55=_0x2d440d[_0x78c9('0x21')];var _0x11ae39=_0x5b6476?0x0:_0x34a7b2['offset'];var _0x5b8633=_0x5b6476?_0x2d440d[_0x78c9('0x21')]:_0x34a7b2[_0x78c9('0x1e')]+_0x34a7b2[_0x78c9('0x20')];var _0x33d630;if(_0x5b8633>=_0x41ad55){_0x5b8633=_0x41ad55;_0x33d630=0xc8;}else{_0x33d630=0xce;}_0x3ad95d[_0x78c9('0x1b')](_0x33d630);return _0x3ad95d['set']('Content-Range',_0x11ae39+'-'+_0x5b8633+'/'+_0x41ad55)[_0x78c9('0x1d')](_0x2d440d);}return null;};}function patchUpdates(_0x3c4143){return function(_0x39f180){try{jsonpatch['apply'](_0x39f180,_0x3c4143,!![]);}catch(_0x3ab4e9){return BPromise[_0x78c9('0x22')](_0x3ab4e9);}return _0x39f180[_0x78c9('0x23')]();};}function saveUpdates(_0x23d34c,_0x4d4563){return function(_0x2a0892){if(_0x2a0892){return _0x2a0892[_0x78c9('0x24')](_0x23d34c)[_0x78c9('0x25')](function(_0x4e41d3){return _0x4e41d3;});}return null;};}function removeEntity(_0x3c8adb,_0x45069d){return function(_0xcfa065){if(_0xcfa065){return _0xcfa065['destroy']()[_0x78c9('0x25')](function(){_0x3c8adb['status'](0xcc)[_0x78c9('0x1c')]();});}};}function handleEntityNotFound(_0x4ffae8,_0x426088){return function(_0x32684b){if(!_0x32684b){_0x4ffae8['sendStatus'](0x194);}return _0x32684b;};}function handleError(_0x58036f,_0x31b38b){_0x31b38b=_0x31b38b||0x1f4;return function(_0x3e313a){logger[_0x78c9('0x26')](_0x3e313a[_0x78c9('0x27')]);if(_0x3e313a[_0x78c9('0x28')]){delete _0x3e313a[_0x78c9('0x28')];}_0x58036f['status'](_0x31b38b)[_0x78c9('0x29')](_0x3e313a);};}exports[_0x78c9('0x2a')]=function(_0x949c5d,_0x125a3b){var _0x1298db={},_0x500b0c={},_0x12cbc0={'count':0x0,'rows':[]};var _0x3617b6=_['map'](db['DeskField'][_0x78c9('0x2b')],function(_0x5e02f9){return{'name':_0x5e02f9[_0x78c9('0x2c')],'type':_0x5e02f9[_0x78c9('0x2d')][_0x78c9('0x2e')]};});_0x500b0c[_0x78c9('0x2f')]=_[_0x78c9('0x30')](_0x3617b6,_0x78c9('0x28'));_0x500b0c[_0x78c9('0x31')]=_[_0x78c9('0x32')](_0x949c5d[_0x78c9('0x31')]);_0x500b0c['filters']=_['intersection'](_0x500b0c['model'],_0x500b0c[_0x78c9('0x31')]);_0x1298db['attributes']=_[_0x78c9('0x33')](_0x500b0c['model'],qs[_0x78c9('0x34')](_0x949c5d[_0x78c9('0x31')][_0x78c9('0x34')]));_0x1298db['attributes']=_0x1298db[_0x78c9('0x35')][_0x78c9('0x36')]?_0x1298db['attributes']:_0x500b0c[_0x78c9('0x2f')];if(!_0x949c5d[_0x78c9('0x31')][_0x78c9('0x37')](_0x78c9('0x38'))){_0x1298db[_0x78c9('0x20')]=qs[_0x78c9('0x20')](_0x949c5d['query']['limit']);_0x1298db['offset']=qs['offset'](_0x949c5d[_0x78c9('0x31')]['offset']);}_0x1298db[_0x78c9('0x39')]=qs[_0x78c9('0x3a')](_0x949c5d[_0x78c9('0x31')][_0x78c9('0x3a')]);_0x1298db[_0x78c9('0x3b')]=qs['filters'](_[_0x78c9('0x3c')](_0x949c5d[_0x78c9('0x31')],_0x500b0c[_0x78c9('0x3d')]),_0x3617b6);if(_0x949c5d[_0x78c9('0x31')][_0x78c9('0x3e')]){_0x1298db[_0x78c9('0x3b')]=_['merge'](_0x1298db[_0x78c9('0x3b')],{'$or':_[_0x78c9('0x30')](_0x3617b6,function(_0x20e36b){if(_0x20e36b[_0x78c9('0x2d')]!=='VIRTUAL'){var _0x2f1e33={};_0x2f1e33[_0x20e36b['name']]={'$like':'%'+_0x949c5d[_0x78c9('0x31')][_0x78c9('0x3e')]+'%'};return _0x2f1e33;}})});}_0x1298db=_[_0x78c9('0x3f')]({},_0x1298db,_0x949c5d['options']);var _0xd6deaa={'where':_0x1298db['where']};return db[_0x78c9('0x40')][_0x78c9('0x21')](_0xd6deaa)['then'](function(_0x225bcf){_0x12cbc0[_0x78c9('0x21')]=_0x225bcf;if(_0x949c5d[_0x78c9('0x31')][_0x78c9('0x41')]){_0x1298db[_0x78c9('0x42')]=[{'all':!![]}];}return db[_0x78c9('0x40')][_0x78c9('0x43')](_0x1298db);})[_0x78c9('0x25')](function(_0xf528b1){_0x12cbc0['rows']=_0xf528b1;return _0x12cbc0;})[_0x78c9('0x25')](respondWithFilteredResult(_0x125a3b,_0x1298db))[_0x78c9('0x44')](handleError(_0x125a3b,null));};exports[_0x78c9('0x45')]=function(_0x2a4f2b,_0x41bbd0){var _0x2b1132={'raw':!![],'where':{'id':_0x2a4f2b[_0x78c9('0x46')]['id']}},_0x4541b2={};_0x4541b2[_0x78c9('0x2f')]=_['keys'](db[_0x78c9('0x40')][_0x78c9('0x2b')]);_0x4541b2['query']=_[_0x78c9('0x32')](_0x2a4f2b[_0x78c9('0x31')]);_0x4541b2[_0x78c9('0x3d')]=_['intersection'](_0x4541b2['model'],_0x4541b2[_0x78c9('0x31')]);_0x2b1132[_0x78c9('0x35')]=_['intersection'](_0x4541b2[_0x78c9('0x2f')],qs[_0x78c9('0x34')](_0x2a4f2b[_0x78c9('0x31')][_0x78c9('0x34')]));_0x2b1132['attributes']=_0x2b1132[_0x78c9('0x35')][_0x78c9('0x36')]?_0x2b1132[_0x78c9('0x35')]:_0x4541b2[_0x78c9('0x2f')];if(_0x2a4f2b[_0x78c9('0x31')]['includeAll']){_0x2b1132[_0x78c9('0x42')]=[{'all':!![]}];}_0x2b1132=_['merge']({},_0x2b1132,_0x2a4f2b[_0x78c9('0x47')]);return db['DeskField']['find'](_0x2b1132)[_0x78c9('0x25')](handleEntityNotFound(_0x41bbd0,null))[_0x78c9('0x25')](respondWithResult(_0x41bbd0,null))[_0x78c9('0x44')](handleError(_0x41bbd0,null));};exports[_0x78c9('0x48')]=function(_0x32fe08,_0x50481a){return db['DeskField'][_0x78c9('0x48')](_0x32fe08['body'],{})[_0x78c9('0x25')](respondWithResult(_0x50481a,0xc9))[_0x78c9('0x44')](handleError(_0x50481a,null));};exports[_0x78c9('0x24')]=function(_0x307405,_0x2ae60b){if(_0x307405['body']['id']){delete _0x307405[_0x78c9('0x49')]['id'];}return db[_0x78c9('0x40')][_0x78c9('0x4a')]({'where':{'id':_0x307405[_0x78c9('0x46')]['id']}})[_0x78c9('0x25')](handleEntityNotFound(_0x2ae60b,null))[_0x78c9('0x25')](saveUpdates(_0x307405[_0x78c9('0x49')],null))[_0x78c9('0x25')](respondWithResult(_0x2ae60b,null))[_0x78c9('0x44')](handleError(_0x2ae60b,null));};exports[_0x78c9('0x4b')]=function(_0x2a46ff,_0x57305d){return db[_0x78c9('0x40')][_0x78c9('0x4a')]({'where':{'id':_0x2a46ff[_0x78c9('0x46')]['id']}})['then'](handleEntityNotFound(_0x57305d,null))[_0x78c9('0x25')](removeEntity(_0x57305d,null))[_0x78c9('0x44')](handleError(_0x57305d,null));}; \ No newline at end of file +var _0x5075=['json','apply','save','update','then','destroy','end','error','name','index','map','DeskField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','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'];(function(_0x3f5e07,_0x111260){var _0x1c4a55=function(_0x59a78d){while(--_0x59a78d){_0x3f5e07['push'](_0x3f5e07['shift']());}};_0x1c4a55(++_0x111260);}(_0x5075,0x73));var _0x5507=function(_0x1eac9b,_0x24bf2f){_0x1eac9b=_0x1eac9b-0x0;var _0x33dfd6=_0x5075[_0x1eac9b];return _0x33dfd6;};'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('0x29')](_0x55e889,_0x5507('0x27'));_0x1e5ce6[_0x5507('0x2e')]=_['keys'](_0x24574b[_0x5507('0x2e')]);_0x1e5ce6[_0x5507('0x2f')]=_[_0x5507('0x30')](_0x1e5ce6[_0x5507('0x2d')],_0x1e5ce6[_0x5507('0x2e')]);_0x38f4d9[_0x5507('0x31')]=_[_0x5507('0x30')](_0x1e5ce6[_0x5507('0x2d')],qs['fields'](_0x24574b[_0x5507('0x2e')][_0x5507('0x32')]));_0x38f4d9[_0x5507('0x31')]=_0x38f4d9['attributes']['length']?_0x38f4d9[_0x5507('0x31')]:_0x1e5ce6[_0x5507('0x2d')];if(!_0x24574b[_0x5507('0x2e')][_0x5507('0x33')](_0x5507('0x34'))){_0x38f4d9['limit']=qs['limit'](_0x24574b[_0x5507('0x2e')][_0x5507('0x1c')]);_0x38f4d9[_0x5507('0x1a')]=qs[_0x5507('0x1a')](_0x24574b['query']['offset']);}_0x38f4d9[_0x5507('0x35')]=qs['sort'](_0x24574b[_0x5507('0x2e')][_0x5507('0x36')]);_0x38f4d9[_0x5507('0x37')]=qs[_0x5507('0x2f')](_[_0x5507('0x38')](_0x24574b[_0x5507('0x2e')],_0x1e5ce6[_0x5507('0x2f')]),_0x55e889);if(_0x24574b[_0x5507('0x2e')][_0x5507('0x39')]){_0x38f4d9[_0x5507('0x37')]=_['merge'](_0x38f4d9['where'],{'$or':_['map'](_0x55e889,function(_0x570eee){if(_0x570eee[_0x5507('0x3a')]!==_0x5507('0x3b')){var _0x2c2bad={};_0x2c2bad[_0x570eee[_0x5507('0x27')]]={'$like':'%'+_0x24574b[_0x5507('0x2e')][_0x5507('0x39')]+'%'};return _0x2c2bad;}})});}_0x38f4d9=_[_0x5507('0x3c')]({},_0x38f4d9,_0x24574b[_0x5507('0x3d')]);var _0xbc9f93={'where':_0x38f4d9[_0x5507('0x37')]};return db[_0x5507('0x2a')][_0x5507('0x1d')](_0xbc9f93)[_0x5507('0x23')](function(_0x4418de){_0x14fdea['count']=_0x4418de;if(_0x24574b['query']['includeAll']){_0x38f4d9[_0x5507('0x3e')]=[{'all':!![]}];}return db[_0x5507('0x2a')][_0x5507('0x3f')](_0x38f4d9);})[_0x5507('0x23')](function(_0xcd4df5){_0x14fdea[_0x5507('0x40')]=_0xcd4df5;return _0x14fdea;})[_0x5507('0x23')](respondWithFilteredResult(_0x85d383,_0x38f4d9))[_0x5507('0x41')](handleError(_0x85d383,null));};exports[_0x5507('0x42')]=function(_0x436c44,_0x1a2df8){var _0x192a00={'raw':!![],'where':{'id':_0x436c44[_0x5507('0x43')]['id']}},_0x24d7b5={};_0x24d7b5[_0x5507('0x2d')]=_[_0x5507('0x44')](db[_0x5507('0x2a')][_0x5507('0x2b')]);_0x24d7b5[_0x5507('0x2e')]=_['keys'](_0x436c44[_0x5507('0x2e')]);_0x24d7b5[_0x5507('0x2f')]=_['intersection'](_0x24d7b5['model'],_0x24d7b5[_0x5507('0x2e')]);_0x192a00[_0x5507('0x31')]=_[_0x5507('0x30')](_0x24d7b5[_0x5507('0x2d')],qs[_0x5507('0x32')](_0x436c44['query'][_0x5507('0x32')]));_0x192a00[_0x5507('0x31')]=_0x192a00[_0x5507('0x31')]['length']?_0x192a00[_0x5507('0x31')]:_0x24d7b5[_0x5507('0x2d')];if(_0x436c44[_0x5507('0x2e')][_0x5507('0x45')]){_0x192a00[_0x5507('0x3e')]=[{'all':!![]}];}_0x192a00=_['merge']({},_0x192a00,_0x436c44[_0x5507('0x3d')]);return db['DeskField'][_0x5507('0x46')](_0x192a00)[_0x5507('0x23')](handleEntityNotFound(_0x1a2df8,null))[_0x5507('0x23')](respondWithResult(_0x1a2df8,null))[_0x5507('0x41')](handleError(_0x1a2df8,null));};exports[_0x5507('0x47')]=function(_0xe2e58c,_0x418c2e){return db[_0x5507('0x2a')]['create'](_0xe2e58c[_0x5507('0x48')],{})[_0x5507('0x23')](respondWithResult(_0x418c2e,0xc9))['catch'](handleError(_0x418c2e,null));};exports['update']=function(_0x4e5825,_0x39b20f){if(_0x4e5825['body']['id']){delete _0x4e5825[_0x5507('0x48')]['id'];}return db['DeskField'][_0x5507('0x46')]({'where':{'id':_0x4e5825['params']['id']}})['then'](handleEntityNotFound(_0x39b20f,null))[_0x5507('0x23')](saveUpdates(_0x4e5825[_0x5507('0x48')],null))[_0x5507('0x23')](respondWithResult(_0x39b20f,null))[_0x5507('0x41')](handleError(_0x39b20f,null));};exports[_0x5507('0x24')]=function(_0x38dabd,_0x57819a){return db[_0x5507('0x2a')][_0x5507('0x46')]({'where':{'id':_0x38dabd[_0x5507('0x43')]['id']}})['then'](handleEntityNotFound(_0x57819a,null))[_0x5507('0x23')](removeEntity(_0x57819a,null))[_0x5507('0x41')](handleError(_0x57819a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e41c251..414810c 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 _0xb131=['desk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','define','DeskField'];(function(_0x4a8018,_0x5c2a36){var _0x4ef640=function(_0x47fc25){while(--_0x47fc25){_0x4a8018['push'](_0x4a8018['shift']());}};_0x4ef640(++_0x5c2a36);}(_0xb131,0xf1));var _0x1b13=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0xb131[_0x289a67];return _0x572b49;};'use strict';var _=require(_0x1b13('0x0'));var util=require(_0x1b13('0x1'));var logger=require('../../config/logger')(_0x1b13('0x2'));var moment=require(_0x1b13('0x3'));var BPromise=require(_0x1b13('0x4'));var rp=require(_0x1b13('0x5'));var fs=require('fs');var path=require(_0x1b13('0x6'));var rimraf=require('rimraf');var config=require(_0x1b13('0x7'));var attributes=require(_0x1b13('0x8'));module['exports']=function(_0x138ed0,_0x44404a){return _0x138ed0[_0x1b13('0x9')](_0x1b13('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x1b13('0xb'),'fields':[_0x1b13('0xc'),_0x1b13('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bc5=['api','moment','path','rimraf','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x577e13,_0xc2c054){var _0x13a973=function(_0x517cc9){while(--_0x517cc9){_0x577e13['push'](_0x577e13['shift']());}};_0x13a973(++_0xc2c054);}(_0x1bc5,0x1a1));var _0x51bc=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x1bc5[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x51bc('0x0'));var util=require(_0x51bc('0x1'));var logger=require(_0x51bc('0x2'))(_0x51bc('0x3'));var moment=require(_0x51bc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51bc('0x5'));var rimraf=require(_0x51bc('0x6'));var config=require('../../config/environment');var attributes=require(_0x51bc('0x7'));module[_0x51bc('0x8')]=function(_0x5f03ad,_0x5da2d0){return _0x5f03ad['define'](_0x51bc('0x9'),attributes,{'tableName':_0x51bc('0xa'),'paranoid':![],'indexes':[{'name':_0x51bc('0xb'),'fields':[_0x51bc('0xc'),_0x51bc('0xd')],'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 1c23504..53a7d9a 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 _0x45d0=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x1ee056,_0x35733f){var _0x2a26f8=function(_0x4a13b3){while(--_0x4a13b3){_0x1ee056['push'](_0x1ee056['shift']());}};_0x2a26f8(++_0x35733f);}(_0x45d0,0x1d3));var _0x045d=function(_0x3256b4,_0x59695a){_0x3256b4=_0x3256b4-0x0;var _0x57d4d3=_0x45d0[_0x3256b4];return _0x57d4d3;};'use strict';var _=require(_0x045d('0x0'));var util=require(_0x045d('0x1'));var moment=require(_0x045d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x045d('0x3'))['db'];var utils=require(_0x045d('0x4'));var logger=require(_0x045d('0x5'))(_0x045d('0x6'));var config=require(_0x045d('0x7'));var jayson=require(_0x045d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37b584,_0x75837d,_0x23d832){return new BPromise(function(_0x26bac5,_0x4f3b9a){return client['request'](_0x37b584,_0x23d832)[_0x045d('0x9')](function(_0x157b26){logger[_0x045d('0xa')](_0x045d('0xb'),_0x75837d,_0x045d('0xc'));logger[_0x045d('0xd')](_0x045d('0xe'),_0x75837d,'request\x20sent',JSON[_0x045d('0xf')](_0x157b26));if(_0x157b26[_0x045d('0x10')]){if(_0x157b26[_0x045d('0x10')][_0x045d('0x11')]===0x1f4){logger[_0x045d('0x10')](_0x045d('0xb'),_0x75837d,_0x157b26[_0x045d('0x10')][_0x045d('0x12')]);return _0x4f3b9a(_0x157b26[_0x045d('0x10')][_0x045d('0x12')]);}logger[_0x045d('0x10')](_0x045d('0xb'),_0x75837d,_0x157b26[_0x045d('0x10')]['message']);return _0x26bac5(_0x157b26[_0x045d('0x10')][_0x045d('0x12')]);}else{logger['info'](_0x045d('0xb'),_0x75837d,_0x045d('0xc'));_0x26bac5(_0x157b26['result'][_0x045d('0x12')]);}})[_0x045d('0x13')](function(_0x24dbe2){logger[_0x045d('0x10')](_0x045d('0xb'),_0x75837d,_0x24dbe2);_0x4f3b9a(_0x24dbe2);});});} \ No newline at end of file +var _0x5ae1=['bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment'];(function(_0x13138c,_0x3197c5){var _0x105f93=function(_0x1c3c76){while(--_0x1c3c76){_0x13138c['push'](_0x13138c['shift']());}};_0x105f93(++_0x3197c5);}(_0x5ae1,0x179));var _0x15ae=function(_0x7e77b2,_0x16ec94){_0x7e77b2=_0x7e77b2-0x0;var _0x4b5a00=_0x5ae1[_0x7e77b2];return _0x4b5a00;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x15ae('0x0'));var BPromise=require(_0x15ae('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15ae('0x2'));var db=require(_0x15ae('0x3'))['db'];var utils=require(_0x15ae('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x15ae('0x5'));var client=jayson[_0x15ae('0x6')][_0x15ae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x12f7e5,_0x265dee,_0x56182e){return new BPromise(function(_0x4b1865,_0x5aedf2){return client[_0x15ae('0x8')](_0x12f7e5,_0x56182e)[_0x15ae('0x9')](function(_0x4c5a1d){logger[_0x15ae('0xa')](_0x15ae('0xb'),_0x265dee,_0x15ae('0xc'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x265dee,'request\x20sent',JSON[_0x15ae('0xd')](_0x4c5a1d));if(_0x4c5a1d[_0x15ae('0xe')]){if(_0x4c5a1d[_0x15ae('0xe')]['code']===0x1f4){logger[_0x15ae('0xe')](_0x15ae('0xb'),_0x265dee,_0x4c5a1d[_0x15ae('0xe')][_0x15ae('0xf')]);return _0x5aedf2(_0x4c5a1d[_0x15ae('0xe')][_0x15ae('0xf')]);}logger[_0x15ae('0xe')](_0x15ae('0xb'),_0x265dee,_0x4c5a1d['error']['message']);return _0x4b1865(_0x4c5a1d[_0x15ae('0xe')][_0x15ae('0xf')]);}else{logger[_0x15ae('0xa')]('DeskField,\x20%s,\x20%s',_0x265dee,'request\x20sent');_0x4b1865(_0x4c5a1d[_0x15ae('0x10')][_0x15ae('0xf')]);}})[_0x15ae('0x11')](function(_0x416bc4){logger[_0x15ae('0xe')](_0x15ae('0xb'),_0x265dee,_0x416bc4);_0x5aedf2(_0x416bc4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 666878d..b72d232 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 _0x651c=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration','update','destroy','exports','multer'];(function(_0x24c411,_0x573797){var _0x4ff58a=function(_0x2a5f32){while(--_0x2a5f32){_0x24c411['push'](_0x24c411['shift']());}};_0x4ff58a(++_0x573797);}(_0x651c,0xdb));var _0xc651=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0x651c[_0x49beea];return _0x27693a;};'use strict';var multer=require(_0xc651('0x0'));var util=require(_0xc651('0x1'));var path=require('path');var timeout=require(_0xc651('0x2'));var express=require(_0xc651('0x3'));var router=express[_0xc651('0x4')]();var fs_extra=require(_0xc651('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc651('0x6'));var config=require(_0xc651('0x7'));var controller=require('./intDynamics365Account.controller');router[_0xc651('0x8')]('/',auth[_0xc651('0x9')](),controller['index']);router[_0xc651('0x8')](_0xc651('0xa'),auth['isAuthenticated'](),controller[_0xc651('0xb')]);router[_0xc651('0x8')](_0xc651('0xc'),auth[_0xc651('0x9')](),controller[_0xc651('0xd')]);router[_0xc651('0x8')]('/:id/fields',auth[_0xc651('0x9')](),controller['getFields']);router[_0xc651('0xe')]('/',auth['isAuthenticated'](),controller[_0xc651('0xf')]);router[_0xc651('0xe')](_0xc651('0xc'),auth['isAuthenticated'](),controller[_0xc651('0x10')]);router['put'](_0xc651('0xa'),auth['isAuthenticated'](),controller[_0xc651('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc651('0x12')]);module[_0xc651('0x13')]=router; \ No newline at end of file +var _0x4832=['delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x40268e,_0x1233bc){var _0x270f28=function(_0x141612){while(--_0x141612){_0x40268e['push'](_0x40268e['shift']());}};_0x270f28(++_0x1233bc);}(_0x4832,0xd1));var _0x2483=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x4832[_0x20cb20];return _0x2fcf4b;};'use strict';var multer=require(_0x2483('0x0'));var util=require('util');var path=require(_0x2483('0x1'));var timeout=require(_0x2483('0x2'));var express=require(_0x2483('0x3'));var router=express['Router']();var fs_extra=require(_0x2483('0x4'));var auth=require(_0x2483('0x5'));var interaction=require(_0x2483('0x6'));var config=require(_0x2483('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x2483('0x8')]('/',auth[_0x2483('0x9')](),controller[_0x2483('0xa')]);router[_0x2483('0x8')]('/:id',auth[_0x2483('0x9')](),controller[_0x2483('0xb')]);router[_0x2483('0x8')](_0x2483('0xc'),auth[_0x2483('0x9')](),controller['getConfigurations']);router[_0x2483('0x8')](_0x2483('0xd'),auth[_0x2483('0x9')](),controller[_0x2483('0xe')]);router[_0x2483('0xf')]('/',auth[_0x2483('0x9')](),controller[_0x2483('0x10')]);router[_0x2483('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x2483('0x11')]);router[_0x2483('0x12')](_0x2483('0x13'),auth['isAuthenticated'](),controller[_0x2483('0x14')]);router[_0x2483('0x15')]('/:id',auth[_0x2483('0x9')](),controller['destroy']);module[_0x2483('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 7ec58b6..28ddef8 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 _0x0e17=['STRING','BOOLEAN','sequelize','exports'];(function(_0x550aed,_0x1ba6cb){var _0x1c43a5=function(_0x39e5f7){while(--_0x39e5f7){_0x550aed['push'](_0x550aed['shift']());}};_0x1c43a5(++_0x1ba6cb);}(_0x0e17,0xd6));var _0x70e1=function(_0x638db4,_0xf3a442){_0x638db4=_0x638db4-0x0;var _0xe36e13=_0x0e17[_0x638db4];return _0xe36e13;};'use strict';var Sequelize=require(_0x70e1('0x0'));module[_0x70e1('0x1')]={'name':{'type':Sequelize[_0x70e1('0x2')]},'username':{'type':Sequelize[_0x70e1('0x2')]},'password':{'type':Sequelize[_0x70e1('0x2')]},'remoteUri':{'type':Sequelize[_0x70e1('0x2')]},'tenantId':{'type':Sequelize[_0x70e1('0x2')]},'clientId':{'type':Sequelize[_0x70e1('0x2')]},'clientSecret':{'type':Sequelize[_0x70e1('0x2')]},'serverUrl':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x70e1('0x2')]},'modernAuthentication':{'type':Sequelize[_0x70e1('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0fcd=['exports','STRING','BOOLEAN'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0fcd,0x129));var _0xd0fc=function(_0x5435a8,_0x141715){_0x5435a8=_0x5435a8-0x0;var _0x24eb61=_0x0fcd[_0x5435a8];return _0x24eb61;};'use strict';var Sequelize=require('sequelize');module[_0xd0fc('0x0')]={'name':{'type':Sequelize[_0xd0fc('0x1')]},'username':{'type':Sequelize[_0xd0fc('0x1')]},'password':{'type':Sequelize[_0xd0fc('0x1')]},'remoteUri':{'type':Sequelize[_0xd0fc('0x1')]},'tenantId':{'type':Sequelize[_0xd0fc('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xd0fc('0x1')]},'serverUrl':{'type':Sequelize[_0xd0fc('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd0fc('0x1')]},'modernAuthentication':{'type':Sequelize[_0xd0fc('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 611a5e0..49a9f45 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 _0xa02f=['test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','status','json','offset','limit','undefined','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','merge','filter','count','includeAll','include','findAll','rows','show','params','options','find','create','catch','body','getConfigurations','findOne','Dynamics365Configuration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','GET','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata'];(function(_0x124e94,_0x571a91){var _0x59d2fb=function(_0x12b3b2){while(--_0x12b3b2){_0x124e94['push'](_0x124e94['shift']());}};_0x59d2fb(++_0x571a91);}(_0xa02f,0xce));var _0xfa02=function(_0x5cd171,_0x21473c){_0x5cd171=_0x5cd171-0x0;var _0x127b63=_0xa02f[_0x5cd171];return _0x127b63;};'use strict';var rp=require('request-promise');var util=require(_0xfa02('0x0'));var _=require(_0xfa02('0x1'));var qs=require(_0xfa02('0x2'));var logger=require(_0xfa02('0x3'))('api');var db=require(_0xfa02('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x42cd8a,_0x2b84fc){_0x2b84fc=_0x2b84fc||0xc8;return function(_0x3878aa){if(_0x3878aa){return _0x42cd8a[_0xfa02('0x5')](_0x2b84fc)[_0xfa02('0x6')](_0x3878aa);}};}function respondWithFilteredResult(_0x4db7f4,_0x31d4ca){return function(_0x2a234b){if(_0x2a234b){var _0x442a34=typeof _0x31d4ca[_0xfa02('0x7')]==='undefined'&&typeof _0x31d4ca[_0xfa02('0x8')]===_0xfa02('0x9');var _0x16150a=_0x2a234b['count'];var _0xabb434=_0x442a34?0x0:_0x31d4ca[_0xfa02('0x7')];var _0x3b7972=_0x442a34?_0x2a234b['count']:_0x31d4ca[_0xfa02('0x7')]+_0x31d4ca[_0xfa02('0x8')];var _0x9117f3;if(_0x3b7972>=_0x16150a){_0x3b7972=_0x16150a;_0x9117f3=0xc8;}else{_0x9117f3=0xce;}_0x4db7f4[_0xfa02('0x5')](_0x9117f3);return _0x4db7f4[_0xfa02('0xa')](_0xfa02('0xb'),_0xabb434+'-'+_0x3b7972+'/'+_0x16150a)[_0xfa02('0x6')](_0x2a234b);}return null;};}function saveUpdates(_0x15da3c){return function(_0x42b076){if(_0x42b076){return _0x42b076[_0xfa02('0xc')](_0x15da3c)[_0xfa02('0xd')](function(_0x1e6c42){return _0x1e6c42;});}return null;};}function removeEntity(_0x214001){return function(_0x3679e5){if(_0x3679e5){return _0x3679e5[_0xfa02('0xe')]()[_0xfa02('0xd')](function(){_0x214001[_0xfa02('0x5')](0xcc)[_0xfa02('0xf')]();});}};}function handleEntityNotFound(_0x2c2735){return function(_0x65d77f){if(!_0x65d77f){_0x2c2735[_0xfa02('0x10')](0x194);}return _0x65d77f;};}function handleError(_0x40b96c,_0x367e58){_0x367e58=_0x367e58||0x1f4;return function(_0x269322){logger[_0xfa02('0x11')](_0x269322[_0xfa02('0x12')]);if(_0x269322['name']){delete _0x269322[_0xfa02('0x13')];}_0x40b96c['status'](_0x367e58)[_0xfa02('0x14')](_0x269322);};}exports[_0xfa02('0x15')]=function(_0x4a616e,_0x637753){var _0x26aab7={},_0x3e02d2={},_0x72ab07={'count':0x0,'rows':[]};var _0x6e620f=_[_0xfa02('0x16')](db[_0xfa02('0x17')][_0xfa02('0x18')],function(_0x18ab8c){return{'name':_0x18ab8c['fieldName'],'type':_0x18ab8c[_0xfa02('0x19')]['key']};});_0x3e02d2['model']=_[_0xfa02('0x16')](_0x6e620f,_0xfa02('0x13'));_0x3e02d2[_0xfa02('0x1a')]=_[_0xfa02('0x1b')](_0x4a616e[_0xfa02('0x1a')]);_0x3e02d2[_0xfa02('0x1c')]=_[_0xfa02('0x1d')](_0x3e02d2['model'],_0x3e02d2[_0xfa02('0x1a')]);_0x26aab7[_0xfa02('0x1e')]=_[_0xfa02('0x1d')](_0x3e02d2[_0xfa02('0x1f')],qs[_0xfa02('0x20')](_0x4a616e[_0xfa02('0x1a')][_0xfa02('0x20')]));_0x26aab7[_0xfa02('0x1e')]=_0x26aab7[_0xfa02('0x1e')][_0xfa02('0x21')]?_0x26aab7['attributes']:_0x3e02d2['model'];if(!_0x4a616e[_0xfa02('0x1a')][_0xfa02('0x22')]('nolimit')){_0x26aab7[_0xfa02('0x8')]=qs[_0xfa02('0x8')](_0x4a616e[_0xfa02('0x1a')][_0xfa02('0x8')]);_0x26aab7[_0xfa02('0x7')]=qs[_0xfa02('0x7')](_0x4a616e[_0xfa02('0x1a')][_0xfa02('0x7')]);}_0x26aab7[_0xfa02('0x23')]=qs[_0xfa02('0x24')](_0x4a616e[_0xfa02('0x1a')][_0xfa02('0x24')]);_0x26aab7[_0xfa02('0x25')]=qs[_0xfa02('0x1c')](_['pick'](_0x4a616e[_0xfa02('0x1a')],_0x3e02d2[_0xfa02('0x1c')]),_0x6e620f);if(_0x4a616e[_0xfa02('0x1a')]['filter']){_0x26aab7[_0xfa02('0x25')]=_[_0xfa02('0x26')](_0x26aab7[_0xfa02('0x25')],{'$or':_['map'](_0x6e620f,function(_0x335eb6){if(_0x335eb6[_0xfa02('0x19')]!=='VIRTUAL'){var _0x4e367f={};_0x4e367f[_0x335eb6[_0xfa02('0x13')]]={'$like':'%'+_0x4a616e['query'][_0xfa02('0x27')]+'%'};return _0x4e367f;}})});}_0x26aab7=_[_0xfa02('0x26')]({},_0x26aab7,_0x4a616e['options']);var _0x3b5c68={'where':_0x26aab7[_0xfa02('0x25')]};return db['Dynamics365Account'][_0xfa02('0x28')](_0x3b5c68)[_0xfa02('0xd')](function(_0x2b10c6){_0x72ab07[_0xfa02('0x28')]=_0x2b10c6;if(_0x4a616e[_0xfa02('0x1a')][_0xfa02('0x29')]){_0x26aab7[_0xfa02('0x2a')]=[{'all':!![]}];}return db[_0xfa02('0x17')][_0xfa02('0x2b')](_0x26aab7);})['then'](function(_0x2c3248){_0x72ab07[_0xfa02('0x2c')]=_0x2c3248;return _0x72ab07;})[_0xfa02('0xd')](respondWithFilteredResult(_0x637753,_0x26aab7))['catch'](handleError(_0x637753,null));};exports[_0xfa02('0x2d')]=function(_0x1eb273,_0x33589c){var _0x944cad={'raw':![],'where':{'id':_0x1eb273[_0xfa02('0x2e')]['id']}},_0x1ab97d={};_0x1ab97d['model']=_[_0xfa02('0x1b')](db[_0xfa02('0x17')][_0xfa02('0x18')]);_0x1ab97d[_0xfa02('0x1a')]=_[_0xfa02('0x1b')](_0x1eb273[_0xfa02('0x1a')]);_0x1ab97d[_0xfa02('0x1c')]=_[_0xfa02('0x1d')](_0x1ab97d[_0xfa02('0x1f')],_0x1ab97d['query']);_0x944cad[_0xfa02('0x1e')]=_[_0xfa02('0x1d')](_0x1ab97d[_0xfa02('0x1f')],qs['fields'](_0x1eb273[_0xfa02('0x1a')][_0xfa02('0x20')]));_0x944cad[_0xfa02('0x1e')]=_0x944cad[_0xfa02('0x1e')]['length']?_0x944cad[_0xfa02('0x1e')]:_0x1ab97d[_0xfa02('0x1f')];if(_0x1eb273[_0xfa02('0x1a')][_0xfa02('0x29')]){_0x944cad['include']=[{'all':!![]}];}_0x944cad=_[_0xfa02('0x26')]({},_0x944cad,_0x1eb273[_0xfa02('0x2f')]);return db[_0xfa02('0x17')][_0xfa02('0x30')](_0x944cad)[_0xfa02('0xd')](handleEntityNotFound(_0x33589c,null))[_0xfa02('0xd')](respondWithResult(_0x33589c,null))['catch'](handleError(_0x33589c,null));};exports[_0xfa02('0x31')]=function(_0x47dc71,_0x3e1eff){return db[_0xfa02('0x17')]['create'](_0x47dc71['body'],{})[_0xfa02('0xd')](respondWithResult(_0x3e1eff,0xc9))[_0xfa02('0x32')](handleError(_0x3e1eff,null));};exports[_0xfa02('0xc')]=function(_0x5ffab0,_0x44c45a){if(_0x5ffab0[_0xfa02('0x33')]['id']){delete _0x5ffab0['body']['id'];}return db[_0xfa02('0x17')][_0xfa02('0x30')]({'where':{'id':_0x5ffab0[_0xfa02('0x2e')]['id']}})[_0xfa02('0xd')](handleEntityNotFound(_0x44c45a,null))[_0xfa02('0xd')](saveUpdates(_0x5ffab0['body'],null))[_0xfa02('0xd')](respondWithResult(_0x44c45a,null))[_0xfa02('0x32')](handleError(_0x44c45a,null));};exports[_0xfa02('0xe')]=function(_0x56fe20,_0x19bc70){return db[_0xfa02('0x17')]['find']({'where':{'id':_0x56fe20[_0xfa02('0x2e')]['id']}})[_0xfa02('0xd')](handleEntityNotFound(_0x19bc70,null))['then'](removeEntity(_0x19bc70,null))['catch'](handleError(_0x19bc70,null));};exports[_0xfa02('0x34')]=function(_0x98dbd2,_0x530ad9){var _0x873ae1={};var _0x56c8d7={};var _0xbd4b4e;var _0x48ea33;return db[_0xfa02('0x17')][_0xfa02('0x35')]({'where':{'id':_0x98dbd2[_0xfa02('0x2e')]['id']}})['then'](handleEntityNotFound(_0x530ad9,null))['then'](function(_0x1a06c3){if(_0x1a06c3){_0xbd4b4e=_0x1a06c3;_0x56c8d7[_0xfa02('0x1f')]=_[_0xfa02('0x1b')](db[_0xfa02('0x36')][_0xfa02('0x18')]);_0x56c8d7[_0xfa02('0x1a')]=_['keys'](_0x98dbd2['query']);_0x56c8d7[_0xfa02('0x1c')]=_[_0xfa02('0x1d')](_0x56c8d7[_0xfa02('0x1f')],_0x56c8d7[_0xfa02('0x1a')]);_0x873ae1[_0xfa02('0x1e')]=_[_0xfa02('0x1d')](_0x56c8d7[_0xfa02('0x1f')],qs['fields'](_0x98dbd2[_0xfa02('0x1a')][_0xfa02('0x20')]));_0x873ae1['attributes']=_0x873ae1[_0xfa02('0x1e')][_0xfa02('0x21')]?_0x873ae1['attributes']:_0x56c8d7[_0xfa02('0x1f')];_0x873ae1[_0xfa02('0x23')]=qs[_0xfa02('0x24')](_0x98dbd2[_0xfa02('0x1a')]['sort']);_0x873ae1[_0xfa02('0x25')]=qs[_0xfa02('0x1c')](_[_0xfa02('0x37')](_0x98dbd2[_0xfa02('0x1a')],_0x56c8d7[_0xfa02('0x1c')]));if(_0x98dbd2['query'][_0xfa02('0x27')]){_0x873ae1[_0xfa02('0x25')]=_[_0xfa02('0x26')](_0x873ae1['where'],{'$or':_[_0xfa02('0x16')](_0x873ae1[_0xfa02('0x1e')],function(_0x177db9){var _0x1e0fc4={};_0x1e0fc4[_0x177db9]={'$like':'%'+_0x98dbd2[_0xfa02('0x1a')][_0xfa02('0x27')]+'%'};return _0x1e0fc4;})});}_0x873ae1=_['merge']({},_0x873ae1,_0x98dbd2[_0xfa02('0x2f')]);return _0xbd4b4e[_0xfa02('0x34')](_0x873ae1);}})[_0xfa02('0xd')](function(_0x3a581d){if(_0x3a581d){_0x48ea33=_0x3a581d[_0xfa02('0x21')];if(!_0x98dbd2[_0xfa02('0x1a')][_0xfa02('0x22')](_0xfa02('0x38'))){_0x873ae1[_0xfa02('0x8')]=qs[_0xfa02('0x8')](_0x98dbd2['query'][_0xfa02('0x8')]);_0x873ae1[_0xfa02('0x7')]=qs['offset'](_0x98dbd2[_0xfa02('0x1a')][_0xfa02('0x7')]);}return _0xbd4b4e[_0xfa02('0x34')](_0x873ae1);}})[_0xfa02('0xd')](function(_0x1532cb){if(_0x1532cb){return _0x1532cb?{'count':_0x48ea33,'rows':_0x1532cb}:null;}})['then'](respondWithResult(_0x530ad9,null))['catch'](handleError(_0x530ad9,null));};exports[_0xfa02('0x39')]=function(_0x295bea,_0x4b0917){if(_0x295bea[_0xfa02('0x33')]['id']){delete _0x295bea[_0xfa02('0x33')]['id'];}return db[_0xfa02('0x17')][_0xfa02('0x35')]({'where':{'id':_0x295bea[_0xfa02('0x2e')]['id']}})[_0xfa02('0xd')](handleEntityNotFound(_0x4b0917,null))[_0xfa02('0xd')](function(_0x34dacf){if(_0x34dacf){_0x295bea[_0xfa02('0x33')][_0xfa02('0x3a')]=_0x34dacf['id'];_0x295bea['body'][_0xfa02('0x3b')]=integrations[_0xfa02('0x3c')](_0x295bea['body'][_0xfa02('0x3d')],_0x295bea['body'][_0xfa02('0x19')]);_0x295bea[_0xfa02('0x33')][_0xfa02('0x3e')]=integrations[_0xfa02('0x3f')](_0x295bea[_0xfa02('0x33')][_0xfa02('0x3d')],_0x295bea[_0xfa02('0x33')][_0xfa02('0x19')]);return db[_0xfa02('0x36')]['create'](_0x295bea[_0xfa02('0x33')],{'include':[{'model':db[_0xfa02('0x40')],'as':_0xfa02('0x3b')},{'model':db[_0xfa02('0x40')],'as':_0xfa02('0x3e')}]});}return null;})[_0xfa02('0xd')](respondWithResult(_0x4b0917,null))['catch'](handleError(_0x4b0917,null));};function sanitizeRemoteUri(_0x170d53){var _0x382e7a=_0x170d53[_0xfa02('0x41')](-0x1);if(_0x382e7a==='/')return _0x170d53['substring'](0x0,_0x170d53[_0xfa02('0x42')](_0x382e7a));return _0x170d53;}function getWebApiUrl(_0xc48d82){return util[_0xfa02('0x43')](_0xfa02('0x44'),_0xc48d82);}exports[_0xfa02('0x45')]=function(_0x2e9352,_0x55cfb9){var _0x3778c6=_0x2e9352[_0xfa02('0x1a')][_0xfa02('0x46')];var _0x4a2a50=_0x3778c6===_0xfa02('0x47')?_0xfa02('0x48'):_0xfa02('0x49');var _0x19b05b='';var _0x58cde7='';var _0x35cf48='';var _0x513e36='';var _0x1828dc='';var _0x4eee22='';var _0x6e14e8='';var _0x4b96fa='';var _0x167d04=[_0xfa02('0x4a'),_0xfa02('0x4b'),'customerid',_0xfa02('0x4c'),_0xfa02('0x4d'),_0xfa02('0x4e'),_0xfa02('0x4f'),'regardingobjectid',_0xfa02('0x50'),_0xfa02('0x51')];var _0x4f4ba7=[_0xfa02('0x52'),_0xfa02('0x53'),'actualserviceunits',_0xfa02('0x54'),_0xfa02('0x55'),'contactidyominame','contractdetailidname',_0xfa02('0x56'),'createdbyexternalpartyname',_0xfa02('0x57'),_0xfa02('0x58'),_0xfa02('0x59'),_0xfa02('0x5a'),_0xfa02('0x5b'),'createdonbehalfbyyominame',_0xfa02('0x5c'),_0xfa02('0x5d'),'customeridyominame',_0xfa02('0x5e'),_0xfa02('0x5f'),_0xfa02('0x60'),_0xfa02('0x61'),_0xfa02('0x62'),'exchangerate','firstresponsebykpiidname','followupby',_0xfa02('0x63'),_0xfa02('0x64'),_0xfa02('0x65'),_0xfa02('0x66'),'masteridname',_0xfa02('0x67'),_0xfa02('0x68'),'modifiedbyname','modifiedbyyominame',_0xfa02('0x69'),_0xfa02('0x6a'),_0xfa02('0x6b'),_0xfa02('0x6c'),_0xfa02('0x6d'),_0xfa02('0x6e'),'onholdtime',_0xfa02('0x6f'),_0xfa02('0x70'),_0xfa02('0x71'),_0xfa02('0x72'),_0xfa02('0x73'),_0xfa02('0x74'),'primarycontactidyominame',_0xfa02('0x75'),_0xfa02('0x76'),'productserialnumber','resolveby',_0xfa02('0x77'),_0xfa02('0x78'),_0xfa02('0x79'),_0xfa02('0x7a'),'sentimentvalue',_0xfa02('0x7b'),'slaname',_0xfa02('0x7c'),'statecode',_0xfa02('0x7d'),_0xfa02('0x7e'),_0xfa02('0x7f'),_0xfa02('0x80'),'transactioncurrencyidname','traversedpath',_0xfa02('0x81'),_0xfa02('0x82')];var _0x588ed6=_0x167d04[_0xfa02('0x83')](_0x4f4ba7);return db[_0xfa02('0x17')][_0xfa02('0x35')]({'where':{'id':_0x2e9352['params']['id']},'attributes':['id',_0xfa02('0x84'),_0xfa02('0x85'),_0xfa02('0x86'),_0xfa02('0x87'),_0xfa02('0x88'),_0xfa02('0x89'),_0xfa02('0x8a')],'include':[{'model':db[_0xfa02('0x8b')],'as':'CloudProvider','attributes':['id',_0xfa02('0x8c'),_0xfa02('0x8d')]}]})['then'](handleEntityNotFound(_0x55cfb9,null))[_0xfa02('0xd')](function(_0x5c3205){if(_0x5c3205){if(_0x5c3205[_0xfa02('0x8a')]){_0x5c3205[_0xfa02('0x8e')]=_0x5c3205[_0xfa02('0x8b')]['data5'];_0x4b96fa=sanitizeRemoteUri(_0x5c3205[_0xfa02('0x8b')][_0xfa02('0x8d')]);_0x6e14e8=getWebApiUrl(_0x4b96fa);return _0x5c3205;}_0x4b96fa=sanitizeRemoteUri(_0x5c3205['remoteUri']);_0x6e14e8=getWebApiUrl(_0x4b96fa);var _0x7d1c80={'method':_0xfa02('0x8f'),'uri':_0xfa02('0x90')+_0x5c3205[_0xfa02('0x87')]+_0xfa02('0x91'),'form':{'client_id':_0x5c3205[_0xfa02('0x88')],'resource':_0x4b96fa,'username':_0x5c3205[_0xfa02('0x84')],'password':_0x5c3205[_0xfa02('0x85')],'grant_type':_0xfa02('0x85'),'client_secret':_0x5c3205[_0xfa02('0x89')]},'json':!![]};return rp(_0x7d1c80);}})[_0xfa02('0xd')](function(_0x5a00f8){_0x4eee22=_0x5a00f8[_0xfa02('0x8e')];var _0x42e2cf={'method':_0xfa02('0x92'),'uri':encodeURI(_0x6e14e8+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4a2a50+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4eee22,'If-None-Match':null,'OData-Version':_0xfa02('0x93')},'json':!![]};return rp(_0x42e2cf);})[_0xfa02('0xd')](function(_0x491525){var _0x5d3d3f=_0x491525[_0xfa02('0x94')][0x0];var _0x7fb02f=_0x5d3d3f[_0xfa02('0x95')];var _0x2d6600={'method':_0xfa02('0x92'),'uri':_0x6e14e8+_0xfa02('0x96')+_0x7fb02f+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xfa02('0x97')+_0x4eee22,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2d6600);})[_0xfa02('0xd')](function(_0x4f6587){_0x19b05b=_0x4f6587;_0x58cde7=_0x19b05b[_0xfa02('0x98')];_0x58cde7=_[_0xfa02('0x99')](_0x58cde7,function(_0x32032a){return!_0x588ed6[_0xfa02('0x9a')](_0x32032a[_0xfa02('0x9b')]);});var _0x54ce32=[];var _0x63c786=[];_0x58cde7[_0xfa02('0x9c')](function(_0x18eb85){if(_0x18eb85['@odata.type']){var _0x27c46b=_0x18eb85[_0xfa02('0x9d')][_0xfa02('0x9e')](_0x18eb85[_0xfa02('0x9d')][_0xfa02('0x42')]('.')+0x1);if(_0x27c46b===_0xfa02('0x9f')){_0x54ce32[_0xfa02('0xa0')](getSelectList(_0x6e14e8,_0x3778c6,_0x63c786,_0x19b05b[_0xfa02('0x95')],_0x18eb85[_0xfa02('0x95')],_0x4eee22));}}});return Promise[_0xfa02('0xa1')](_0x54ce32);})[_0xfa02('0xd')](function(_0x2bdab5){_0x35cf48=_0x2bdab5[0x0];var _0x829013=[];var _0x524503=[];_0x58cde7[_0xfa02('0x9c')](function(_0x376ad1){if(!_[_0xfa02('0xa2')](_0x376ad1[_0xfa02('0x9d')])){var _0x1df6da=_0x376ad1[_0xfa02('0x9d')][_0xfa02('0x9e')](_0x376ad1[_0xfa02('0x9d')]['lastIndexOf']('.')+0x1);if(_0x1df6da===_0xfa02('0xa3')){_0x829013['push'](getBooleanList(_0x6e14e8,_0x3778c6,_0x524503,_0x19b05b[_0xfa02('0x95')],_0x376ad1['MetadataId'],_0x4eee22));}}});return Promise['all'](_0x829013);})[_0xfa02('0xd')](function(_0x2dd4fc){_0x513e36=_0x2dd4fc[0x0];var _0x1b717a=[];var _0x52769c=[];_0x58cde7[_0xfa02('0x9c')](function(_0x413448){if(_0x413448['@odata.type']){var _0x19d3a4=_0x413448[_0xfa02('0x9d')][_0xfa02('0x9e')](_0x413448[_0xfa02('0x9d')][_0xfa02('0x42')]('.')+0x1);if(_0x19d3a4===_0xfa02('0xa4')||_0x19d3a4==='DoubleAttributeMetadata'||_0x19d3a4===_0xfa02('0xa5')||_0x19d3a4===_0xfa02('0xa6')||_0x19d3a4==='MemoAttributeMetadata'||_0x19d3a4===_0xfa02('0xa7')||_0x19d3a4===_0xfa02('0xa8')||_0x19d3a4===_0xfa02('0xa9')||_0x19d3a4===_0xfa02('0xaa')||_0x19d3a4===_0xfa02('0xab')){_0x1b717a['push'](getInputList(_0x6e14e8,_0x3778c6,_0x19d3a4,_0x52769c,_0x19b05b[_0xfa02('0x95')],_0x413448['MetadataId'],_0x4eee22));}}});return Promise[_0xfa02('0xa1')](_0x1b717a);})[_0xfa02('0xd')](function(_0x5c82a0){_0x1828dc=_0x5c82a0[0x0];var _0x2744c8=_0x35cf48[_0xfa02('0x83')](_0x513e36)[_0xfa02('0x83')](_0x1828dc);var _0x3b5c7b={'count':_0x2744c8[_0xfa02('0x21')],'rows':_0x2744c8};return _0x3b5c7b;})[_0xfa02('0xd')](respondWithResult(_0x55cfb9,null))[_0xfa02('0x32')](function(_0x3dd41c){var _0x55516e=_0x2e9352[_0xfa02('0x1a')][_0xfa02('0xac')]?0x1f4:_0x3dd41c['statusCode']||0x1f4;logger[_0xfa02('0x11')](_0x3dd41c[_0xfa02('0x12')]);delete _0x3dd41c[_0xfa02('0x13')];if(_0x55516e===0x191){_0x55516e=0x190;}_0x55cfb9['status'](_0x55516e)[_0xfa02('0x14')](_0x2e9352['query']['test']?{'message':_0xfa02('0xad'),'statusCode':_0x3dd41c['statusCode']}:_0x3dd41c);});};function getSelectList(_0x4a38d5,_0x3ac379,_0x264242,_0x318854,_0x36a49f,_0x2dd371){var _0x34e798={'method':_0xfa02('0x92'),'uri':_0x4a38d5+_0xfa02('0x96')+_0x318854+_0xfa02('0xae')+_0x36a49f+_0xfa02('0xaf')+_0xfa02('0xb0'),'headers':{'Authorization':_0xfa02('0x97')+_0x2dd371,'If-None-Match':null,'OData-Version':_0xfa02('0x93')},'json':!![]};return rp(_0x34e798)[_0xfa02('0xd')](function(_0x58b980){var _0x54683f=[];var _0x19c3d7=_0x58b980['OptionSet']['Options'];_0x19c3d7[_0xfa02('0x9c')](function(_0x4479d4){_0x54683f[_0xfa02('0xa0')]({'name':_0x4479d4[_0xfa02('0xb1')][_0xfa02('0xb2')][_0xfa02('0xb1')],'value':String(_0x4479d4[_0xfa02('0xb3')])});});var _0x1c27f5={'id':_0x3ac379+'_'+_0x58b980['LogicalName'],'name':_0x58b980[_0xfa02('0xb4')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x54683f};_0x264242['push'](_0x1c27f5);return _0x264242;});}function getBooleanList(_0x56e543,_0x54956b,_0x44bcf2,_0x5b2d11,_0x419d55,_0x340d45){var _0x598bc7={'method':_0xfa02('0x92'),'uri':_0x56e543+_0xfa02('0x96')+_0x5b2d11+_0xfa02('0xae')+_0x419d55+_0xfa02('0xb5'),'headers':{'Authorization':_0xfa02('0x97')+_0x340d45,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x598bc7)[_0xfa02('0xd')](function(_0x36e707){var _0x5311e9=[];_0x5311e9['push']({'name':_0x36e707[_0xfa02('0xb6')][_0xfa02('0xb7')][_0xfa02('0xb1')][_0xfa02('0xb2')]['Label'],'value':_0xfa02('0xb8')},{'name':_0x36e707[_0xfa02('0xb6')][_0xfa02('0xb9')][_0xfa02('0xb1')][_0xfa02('0xb2')][_0xfa02('0xb1')],'value':_0xfa02('0xba')});var _0x1caf82={'id':_0x54956b+'_'+_0x36e707['LogicalName'],'name':_0x36e707['DisplayName']['UserLocalizedLabel'][_0xfa02('0xb1')],'custom':![],'options':_0x5311e9};_0x44bcf2[_0xfa02('0xa0')](_0x1caf82);return _0x44bcf2;});}function getInputList(_0x195260,_0x1d317d,_0xb1b50e,_0x5b4b39,_0x445716,_0x27c079,_0x3b27f3){var _0x590ed7={'method':_0xfa02('0x92'),'uri':_0x195260+_0xfa02('0x96')+_0x445716+_0xfa02('0xae')+_0x27c079+_0xfa02('0xbb')+_0xb1b50e+_0xfa02('0xbc'),'headers':{'Authorization':_0xfa02('0x97')+_0x3b27f3,'If-None-Match':null,'OData-Version':_0xfa02('0x93')},'json':!![]};return rp(_0x590ed7)[_0xfa02('0xd')](function(_0x3be401){var _0x235f1b={'id':_0x1d317d+'_'+_0x3be401[_0xfa02('0x9b')],'name':_0x3be401[_0xfa02('0xb4')][_0xfa02('0xb2')]?_0x3be401['DisplayName'][_0xfa02('0xb2')][_0xfa02('0xb1')]:_0x3be401[_0xfa02('0x9b')],'custom':![],'options':[]};_0x5b4b39[_0xfa02('0xa0')](_0x235f1b);return _0x5b4b39;});} \ No newline at end of file +var _0x390a=['Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Dynamics365Account','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','length','include','create','catch','body','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','Subjects','channel','Descriptions','getDescriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','customerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','password','clientSecret','modernAuthentication','CloudProvider','data5','access_token','remoteUri','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel'];(function(_0x595d28,_0x1b719c){var _0x225ac0=function(_0x2916e4){while(--_0x2916e4){_0x595d28['push'](_0x595d28['shift']());}};_0x225ac0(++_0x1b719c);}(_0x390a,0xbe));var _0xa390=function(_0x411004,_0x3d60ea){_0x411004=_0x411004-0x0;var _0x3429d3=_0x390a[_0x411004];return _0x3429d3;};'use strict';var rp=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var _=require(_0xa390('0x2'));var qs=require(_0xa390('0x3'));var logger=require(_0xa390('0x4'))(_0xa390('0x5'));var db=require(_0xa390('0x6'))['db'];var integrations=require(_0xa390('0x7'));function respondWithResult(_0x1a1a62,_0x2d2584){_0x2d2584=_0x2d2584||0xc8;return function(_0x476c34){if(_0x476c34){return _0x1a1a62[_0xa390('0x8')](_0x2d2584)[_0xa390('0x9')](_0x476c34);}};}function respondWithFilteredResult(_0x50f4f3,_0x212916){return function(_0x940df7){if(_0x940df7){var _0x55a074=typeof _0x212916[_0xa390('0xa')]==='undefined'&&typeof _0x212916['limit']===_0xa390('0xb');var _0x21e05b=_0x940df7[_0xa390('0xc')];var _0x8a741a=_0x55a074?0x0:_0x212916[_0xa390('0xa')];var _0x4e94e6=_0x55a074?_0x940df7[_0xa390('0xc')]:_0x212916[_0xa390('0xa')]+_0x212916['limit'];var _0x3a9a18;if(_0x4e94e6>=_0x21e05b){_0x4e94e6=_0x21e05b;_0x3a9a18=0xc8;}else{_0x3a9a18=0xce;}_0x50f4f3[_0xa390('0x8')](_0x3a9a18);return _0x50f4f3[_0xa390('0xd')](_0xa390('0xe'),_0x8a741a+'-'+_0x4e94e6+'/'+_0x21e05b)[_0xa390('0x9')](_0x940df7);}return null;};}function saveUpdates(_0x1ad190){return function(_0x59ac6d){if(_0x59ac6d){return _0x59ac6d[_0xa390('0xf')](_0x1ad190)[_0xa390('0x10')](function(_0x16aaaf){return _0x16aaaf;});}return null;};}function removeEntity(_0x564acb){return function(_0x531c82){if(_0x531c82){return _0x531c82[_0xa390('0x11')]()['then'](function(){_0x564acb[_0xa390('0x8')](0xcc)[_0xa390('0x12')]();});}};}function handleEntityNotFound(_0x1c4cd3){return function(_0x36b367){if(!_0x36b367){_0x1c4cd3[_0xa390('0x13')](0x194);}return _0x36b367;};}function handleError(_0x58b01d,_0x5a7526){_0x5a7526=_0x5a7526||0x1f4;return function(_0x5b1998){logger[_0xa390('0x14')](_0x5b1998[_0xa390('0x15')]);if(_0x5b1998['name']){delete _0x5b1998[_0xa390('0x16')];}_0x58b01d[_0xa390('0x8')](_0x5a7526)[_0xa390('0x17')](_0x5b1998);};}exports['index']=function(_0x192f3d,_0x2617ac){var _0xa5bc23={},_0x41f696={},_0x22298c={'count':0x0,'rows':[]};var _0x112e46=_['map'](db[_0xa390('0x18')]['rawAttributes'],function(_0x28c032){return{'name':_0x28c032[_0xa390('0x19')],'type':_0x28c032['type'][_0xa390('0x1a')]};});_0x41f696[_0xa390('0x1b')]=_['map'](_0x112e46,_0xa390('0x16'));_0x41f696[_0xa390('0x1c')]=_[_0xa390('0x1d')](_0x192f3d['query']);_0x41f696[_0xa390('0x1e')]=_[_0xa390('0x1f')](_0x41f696[_0xa390('0x1b')],_0x41f696[_0xa390('0x1c')]);_0xa5bc23[_0xa390('0x20')]=_[_0xa390('0x1f')](_0x41f696[_0xa390('0x1b')],qs[_0xa390('0x21')](_0x192f3d['query']['fields']));_0xa5bc23[_0xa390('0x20')]=_0xa5bc23['attributes']['length']?_0xa5bc23[_0xa390('0x20')]:_0x41f696[_0xa390('0x1b')];if(!_0x192f3d[_0xa390('0x1c')][_0xa390('0x22')](_0xa390('0x23'))){_0xa5bc23[_0xa390('0x24')]=qs['limit'](_0x192f3d[_0xa390('0x1c')][_0xa390('0x24')]);_0xa5bc23[_0xa390('0xa')]=qs[_0xa390('0xa')](_0x192f3d[_0xa390('0x1c')][_0xa390('0xa')]);}_0xa5bc23[_0xa390('0x25')]=qs['sort'](_0x192f3d[_0xa390('0x1c')][_0xa390('0x26')]);_0xa5bc23[_0xa390('0x27')]=qs['filters'](_[_0xa390('0x28')](_0x192f3d[_0xa390('0x1c')],_0x41f696['filters']),_0x112e46);if(_0x192f3d[_0xa390('0x1c')][_0xa390('0x29')]){_0xa5bc23[_0xa390('0x27')]=_[_0xa390('0x2a')](_0xa5bc23[_0xa390('0x27')],{'$or':_[_0xa390('0x2b')](_0x112e46,function(_0x39b7b6){if(_0x39b7b6[_0xa390('0x2c')]!==_0xa390('0x2d')){var _0x52f9d6={};_0x52f9d6[_0x39b7b6[_0xa390('0x16')]]={'$like':'%'+_0x192f3d[_0xa390('0x1c')][_0xa390('0x29')]+'%'};return _0x52f9d6;}})});}_0xa5bc23=_[_0xa390('0x2a')]({},_0xa5bc23,_0x192f3d[_0xa390('0x2e')]);var _0x4ba880={'where':_0xa5bc23[_0xa390('0x27')]};return db[_0xa390('0x18')][_0xa390('0xc')](_0x4ba880)[_0xa390('0x10')](function(_0x512f84){_0x22298c[_0xa390('0xc')]=_0x512f84;if(_0x192f3d[_0xa390('0x1c')][_0xa390('0x2f')]){_0xa5bc23['include']=[{'all':!![]}];}return db[_0xa390('0x18')]['findAll'](_0xa5bc23);})[_0xa390('0x10')](function(_0x2e4590){_0x22298c[_0xa390('0x30')]=_0x2e4590;return _0x22298c;})[_0xa390('0x10')](respondWithFilteredResult(_0x2617ac,_0xa5bc23))['catch'](handleError(_0x2617ac,null));};exports[_0xa390('0x31')]=function(_0x1f70c4,_0x32a423){var _0x4236ef={'raw':![],'where':{'id':_0x1f70c4[_0xa390('0x32')]['id']}},_0x133da2={};_0x133da2['model']=_[_0xa390('0x1d')](db[_0xa390('0x18')][_0xa390('0x33')]);_0x133da2['query']=_[_0xa390('0x1d')](_0x1f70c4[_0xa390('0x1c')]);_0x133da2[_0xa390('0x1e')]=_[_0xa390('0x1f')](_0x133da2['model'],_0x133da2[_0xa390('0x1c')]);_0x4236ef[_0xa390('0x20')]=_[_0xa390('0x1f')](_0x133da2[_0xa390('0x1b')],qs['fields'](_0x1f70c4['query']['fields']));_0x4236ef['attributes']=_0x4236ef[_0xa390('0x20')][_0xa390('0x34')]?_0x4236ef[_0xa390('0x20')]:_0x133da2['model'];if(_0x1f70c4['query'][_0xa390('0x2f')]){_0x4236ef[_0xa390('0x35')]=[{'all':!![]}];}_0x4236ef=_[_0xa390('0x2a')]({},_0x4236ef,_0x1f70c4[_0xa390('0x2e')]);return db[_0xa390('0x18')]['find'](_0x4236ef)[_0xa390('0x10')](handleEntityNotFound(_0x32a423,null))[_0xa390('0x10')](respondWithResult(_0x32a423,null))['catch'](handleError(_0x32a423,null));};exports[_0xa390('0x36')]=function(_0x53dd12,_0x5a2da2){return db[_0xa390('0x18')]['create'](_0x53dd12['body'],{})[_0xa390('0x10')](respondWithResult(_0x5a2da2,0xc9))[_0xa390('0x37')](handleError(_0x5a2da2,null));};exports['update']=function(_0x29157e,_0x4533a8){if(_0x29157e['body']['id']){delete _0x29157e[_0xa390('0x38')]['id'];}return db[_0xa390('0x18')][_0xa390('0x39')]({'where':{'id':_0x29157e[_0xa390('0x32')]['id']}})[_0xa390('0x10')](handleEntityNotFound(_0x4533a8,null))[_0xa390('0x10')](saveUpdates(_0x29157e[_0xa390('0x38')],null))[_0xa390('0x10')](respondWithResult(_0x4533a8,null))[_0xa390('0x37')](handleError(_0x4533a8,null));};exports[_0xa390('0x11')]=function(_0x5532b9,_0x549bdc){return db[_0xa390('0x18')][_0xa390('0x39')]({'where':{'id':_0x5532b9[_0xa390('0x32')]['id']}})['then'](handleEntityNotFound(_0x549bdc,null))['then'](removeEntity(_0x549bdc,null))[_0xa390('0x37')](handleError(_0x549bdc,null));};exports[_0xa390('0x3a')]=function(_0x391066,_0x38b647){var _0x2fe224={};var _0x22cc5b={};var _0x38561e;var _0x8158f1;return db['Dynamics365Account'][_0xa390('0x3b')]({'where':{'id':_0x391066[_0xa390('0x32')]['id']}})[_0xa390('0x10')](handleEntityNotFound(_0x38b647,null))['then'](function(_0x539d1e){if(_0x539d1e){_0x38561e=_0x539d1e;_0x22cc5b['model']=_[_0xa390('0x1d')](db[_0xa390('0x3c')]['rawAttributes']);_0x22cc5b[_0xa390('0x1c')]=_[_0xa390('0x1d')](_0x391066['query']);_0x22cc5b[_0xa390('0x1e')]=_[_0xa390('0x1f')](_0x22cc5b['model'],_0x22cc5b['query']);_0x2fe224[_0xa390('0x20')]=_[_0xa390('0x1f')](_0x22cc5b[_0xa390('0x1b')],qs['fields'](_0x391066['query'][_0xa390('0x21')]));_0x2fe224[_0xa390('0x20')]=_0x2fe224['attributes']['length']?_0x2fe224[_0xa390('0x20')]:_0x22cc5b[_0xa390('0x1b')];_0x2fe224[_0xa390('0x25')]=qs['sort'](_0x391066[_0xa390('0x1c')][_0xa390('0x26')]);_0x2fe224['where']=qs[_0xa390('0x1e')](_[_0xa390('0x28')](_0x391066['query'],_0x22cc5b[_0xa390('0x1e')]));if(_0x391066[_0xa390('0x1c')][_0xa390('0x29')]){_0x2fe224[_0xa390('0x27')]=_['merge'](_0x2fe224[_0xa390('0x27')],{'$or':_[_0xa390('0x2b')](_0x2fe224[_0xa390('0x20')],function(_0x4f22c4){var _0x23149e={};_0x23149e[_0x4f22c4]={'$like':'%'+_0x391066[_0xa390('0x1c')][_0xa390('0x29')]+'%'};return _0x23149e;})});}_0x2fe224=_[_0xa390('0x2a')]({},_0x2fe224,_0x391066[_0xa390('0x2e')]);return _0x38561e[_0xa390('0x3a')](_0x2fe224);}})['then'](function(_0x15212c){if(_0x15212c){_0x8158f1=_0x15212c[_0xa390('0x34')];if(!_0x391066['query'][_0xa390('0x22')](_0xa390('0x23'))){_0x2fe224['limit']=qs[_0xa390('0x24')](_0x391066['query'][_0xa390('0x24')]);_0x2fe224[_0xa390('0xa')]=qs['offset'](_0x391066[_0xa390('0x1c')][_0xa390('0xa')]);}return _0x38561e[_0xa390('0x3a')](_0x2fe224);}})[_0xa390('0x10')](function(_0x9c39f1){if(_0x9c39f1){return _0x9c39f1?{'count':_0x8158f1,'rows':_0x9c39f1}:null;}})[_0xa390('0x10')](respondWithResult(_0x38b647,null))['catch'](handleError(_0x38b647,null));};exports[_0xa390('0x3d')]=function(_0x2cbd8d,_0x324651){if(_0x2cbd8d[_0xa390('0x38')]['id']){delete _0x2cbd8d[_0xa390('0x38')]['id'];}return db['Dynamics365Account'][_0xa390('0x3b')]({'where':{'id':_0x2cbd8d['params']['id']}})[_0xa390('0x10')](handleEntityNotFound(_0x324651,null))['then'](function(_0x2ced27){if(_0x2ced27){_0x2cbd8d['body']['AccountId']=_0x2ced27['id'];_0x2cbd8d['body'][_0xa390('0x3e')]=integrations['getSubjects'](_0x2cbd8d[_0xa390('0x38')][_0xa390('0x3f')],_0x2cbd8d[_0xa390('0x38')][_0xa390('0x2c')]);_0x2cbd8d[_0xa390('0x38')][_0xa390('0x40')]=integrations[_0xa390('0x41')](_0x2cbd8d['body'][_0xa390('0x3f')],_0x2cbd8d[_0xa390('0x38')][_0xa390('0x2c')]);return db[_0xa390('0x3c')][_0xa390('0x36')](_0x2cbd8d['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xa390('0x3e')},{'model':db['Dynamics365Field'],'as':_0xa390('0x40')}]});}return null;})['then'](respondWithResult(_0x324651,null))[_0xa390('0x37')](handleError(_0x324651,null));};function sanitizeRemoteUri(_0x3c0ad0){var _0x38051a=_0x3c0ad0[_0xa390('0x42')](-0x1);if(_0x38051a==='/')return _0x3c0ad0[_0xa390('0x43')](0x0,_0x3c0ad0[_0xa390('0x44')](_0x38051a));return _0x3c0ad0;}function getWebApiUrl(_0x5270f3){return util[_0xa390('0x45')](_0xa390('0x46'),_0x5270f3);}exports[_0xa390('0x47')]=function(_0x1cbaf5,_0x360934){var _0x351033=_0x1cbaf5['query']['ticketType'];var _0x16c862=_0x351033===_0xa390('0x48')?_0xa390('0x49'):'PhoneCall';var _0x5bb007='';var _0x40374a='';var _0x5cbe8c='';var _0x4de6d8='';var _0x561230='';var _0x267de6='';var _0x169b78='';var _0x3c52b8='';var _0xe14d6c=['title','description',_0xa390('0x4a'),'ownerid',_0xa390('0x4b'),_0xa390('0x4c'),'phonenumber','regardingobjectid',_0xa390('0x4d'),_0xa390('0x4e')];var _0x5b1752=[_0xa390('0x4f'),'accountidyominame','actualserviceunits',_0xa390('0x50'),_0xa390('0x51'),_0xa390('0x52'),'contractdetailidname',_0xa390('0x53'),'createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname',_0xa390('0x54'),'createdon',_0xa390('0x55'),_0xa390('0x56'),_0xa390('0x57'),_0xa390('0x58'),_0xa390('0x59'),'emailaddress',_0xa390('0x5a'),_0xa390('0x5b'),_0xa390('0x5c'),_0xa390('0x5d'),_0xa390('0x5e'),_0xa390('0x5f'),'followupby','importsequencenumber',_0xa390('0x60'),'kbarticleidname',_0xa390('0x61'),_0xa390('0x62'),_0xa390('0x63'),_0xa390('0x64'),_0xa390('0x65'),_0xa390('0x66'),_0xa390('0x67'),_0xa390('0x68'),_0xa390('0x69'),_0xa390('0x6a'),_0xa390('0x6b'),_0xa390('0x6c'),_0xa390('0x6d'),_0xa390('0x6e'),_0xa390('0x6f'),'owneridtype','owneridyominame','parentcaseidname','primarycontactidname',_0xa390('0x70'),_0xa390('0x71'),_0xa390('0x72'),_0xa390('0x73'),_0xa390('0x74'),_0xa390('0x75'),_0xa390('0x76'),_0xa390('0x77'),_0xa390('0x78'),_0xa390('0x79'),_0xa390('0x7a'),_0xa390('0x7b'),_0xa390('0x7c'),_0xa390('0x7d'),_0xa390('0x7e'),_0xa390('0x7f'),'ticketnumber',_0xa390('0x80'),_0xa390('0x81'),_0xa390('0x82'),'utcconversiontimezonecode',_0xa390('0x83')];var _0x2f7099=_0xe14d6c[_0xa390('0x84')](_0x5b1752);return db[_0xa390('0x18')][_0xa390('0x3b')]({'where':{'id':_0x1cbaf5[_0xa390('0x32')]['id']},'attributes':['id','username',_0xa390('0x85'),'remoteUri','tenantId','clientId',_0xa390('0x86'),_0xa390('0x87')],'include':[{'model':db['CloudProvider'],'as':_0xa390('0x88'),'attributes':['id',_0xa390('0x89'),'data7']}]})['then'](handleEntityNotFound(_0x360934,null))[_0xa390('0x10')](function(_0x5994c3){if(_0x5994c3){if(_0x5994c3[_0xa390('0x87')]){_0x5994c3[_0xa390('0x8a')]=_0x5994c3['CloudProvider']['data5'];_0x3c52b8=sanitizeRemoteUri(_0x5994c3[_0xa390('0x88')]['data7']);_0x169b78=getWebApiUrl(_0x3c52b8);return _0x5994c3;}_0x3c52b8=sanitizeRemoteUri(_0x5994c3[_0xa390('0x8b')]);_0x169b78=getWebApiUrl(_0x3c52b8);var _0x4dcd7a={'method':_0xa390('0x8c'),'uri':_0xa390('0x8d')+_0x5994c3[_0xa390('0x8e')]+_0xa390('0x8f'),'form':{'client_id':_0x5994c3['clientId'],'resource':_0x3c52b8,'username':_0x5994c3[_0xa390('0x90')],'password':_0x5994c3[_0xa390('0x85')],'grant_type':_0xa390('0x85'),'client_secret':_0x5994c3[_0xa390('0x86')]},'json':!![]};return rp(_0x4dcd7a);}})[_0xa390('0x10')](function(_0x8be515){_0x267de6=_0x8be515[_0xa390('0x8a')];var _0x43ca9f={'method':_0xa390('0x91'),'uri':encodeURI(_0x169b78+_0xa390('0x92')+_0x16c862+'\x27'),'headers':{'Authorization':_0xa390('0x93')+_0x267de6,'If-None-Match':null,'OData-Version':_0xa390('0x94')},'json':!![]};return rp(_0x43ca9f);})['then'](function(_0x146d2c){var _0x248a3f=_0x146d2c[_0xa390('0x95')][0x0];var _0x6b0ebc=_0x248a3f[_0xa390('0x96')];var _0x1d789e={'method':_0xa390('0x91'),'uri':_0x169b78+_0xa390('0x97')+_0x6b0ebc+_0xa390('0x98'),'headers':{'Authorization':_0xa390('0x93')+_0x267de6,'If-None-Match':null,'OData-Version':_0xa390('0x94')},'json':!![]};return rp(_0x1d789e);})[_0xa390('0x10')](function(_0x13dd47){_0x5bb007=_0x13dd47;_0x40374a=_0x5bb007[_0xa390('0x99')];_0x40374a=_['remove'](_0x40374a,function(_0x4f9f03){return!_0x2f7099['includes'](_0x4f9f03[_0xa390('0x9a')]);});var _0x5da3ac=[];var _0x2babec=[];_0x40374a[_0xa390('0x9b')](function(_0x4823bb){if(_0x4823bb[_0xa390('0x9c')]){var _0x2f4ab5=_0x4823bb['@odata.type'][_0xa390('0x43')](_0x4823bb[_0xa390('0x9c')][_0xa390('0x44')]('.')+0x1);if(_0x2f4ab5===_0xa390('0x9d')){_0x5da3ac['push'](getSelectList(_0x169b78,_0x351033,_0x2babec,_0x5bb007[_0xa390('0x96')],_0x4823bb[_0xa390('0x96')],_0x267de6));}}});return Promise[_0xa390('0x9e')](_0x5da3ac);})[_0xa390('0x10')](function(_0x3fcfbc){_0x5cbe8c=_0x3fcfbc[0x0];var _0x54f78c=[];var _0x1bc6d5=[];_0x40374a['forEach'](function(_0x11b6c7){if(!_[_0xa390('0x9f')](_0x11b6c7[_0xa390('0x9c')])){var _0x7d64b3=_0x11b6c7[_0xa390('0x9c')][_0xa390('0x43')](_0x11b6c7[_0xa390('0x9c')]['lastIndexOf']('.')+0x1);if(_0x7d64b3===_0xa390('0xa0')){_0x54f78c[_0xa390('0xa1')](getBooleanList(_0x169b78,_0x351033,_0x1bc6d5,_0x5bb007[_0xa390('0x96')],_0x11b6c7[_0xa390('0x96')],_0x267de6));}}});return Promise[_0xa390('0x9e')](_0x54f78c);})[_0xa390('0x10')](function(_0x11c728){_0x4de6d8=_0x11c728[0x0];var _0x59dca8=[];var _0x1a3c31=[];_0x40374a['forEach'](function(_0x4d9c04){if(_0x4d9c04[_0xa390('0x9c')]){var _0x2e4ab9=_0x4d9c04['@odata.type'][_0xa390('0x43')](_0x4d9c04[_0xa390('0x9c')]['lastIndexOf']('.')+0x1);if(_0x2e4ab9===_0xa390('0xa2')||_0x2e4ab9===_0xa390('0xa3')||_0x2e4ab9===_0xa390('0xa4')||_0x2e4ab9==='IntegerAttributeMetadata'||_0x2e4ab9===_0xa390('0xa5')||_0x2e4ab9===_0xa390('0xa6')||_0x2e4ab9===_0xa390('0xa7')||_0x2e4ab9===_0xa390('0xa8')||_0x2e4ab9==='StateAttributeMetadata'||_0x2e4ab9===_0xa390('0xa9')){_0x59dca8[_0xa390('0xa1')](getInputList(_0x169b78,_0x351033,_0x2e4ab9,_0x1a3c31,_0x5bb007['MetadataId'],_0x4d9c04['MetadataId'],_0x267de6));}}});return Promise[_0xa390('0x9e')](_0x59dca8);})[_0xa390('0x10')](function(_0x20c712){_0x561230=_0x20c712[0x0];var _0x54aab8=_0x5cbe8c[_0xa390('0x84')](_0x4de6d8)[_0xa390('0x84')](_0x561230);var _0x2c5882={'count':_0x54aab8[_0xa390('0x34')],'rows':_0x54aab8};return _0x2c5882;})[_0xa390('0x10')](respondWithResult(_0x360934,null))[_0xa390('0x37')](function(_0x31d579){var _0x91d03=_0x1cbaf5[_0xa390('0x1c')]['test']?0x1f4:_0x31d579['statusCode']||0x1f4;logger[_0xa390('0x14')](_0x31d579['stack']);delete _0x31d579[_0xa390('0x16')];if(_0x91d03===0x191){_0x91d03=0x190;}_0x360934[_0xa390('0x8')](_0x91d03)['send'](_0x1cbaf5[_0xa390('0x1c')][_0xa390('0xaa')]?{'message':_0xa390('0xab'),'statusCode':_0x31d579['statusCode']}:_0x31d579);});};function getSelectList(_0x59d16b,_0x161636,_0x3a7992,_0x39f4c6,_0x30731e,_0x49d5fe){var _0x3bbce3={'method':_0xa390('0x91'),'uri':_0x59d16b+_0xa390('0x97')+_0x39f4c6+_0xa390('0xac')+_0x30731e+_0xa390('0xad')+_0xa390('0xae'),'headers':{'Authorization':_0xa390('0x93')+_0x49d5fe,'If-None-Match':null,'OData-Version':_0xa390('0x94')},'json':!![]};return rp(_0x3bbce3)['then'](function(_0x26dbb2){var _0x55dcdc=[];var _0x28e347=_0x26dbb2[_0xa390('0xaf')]['Options'];_0x28e347['forEach'](function(_0x4747af){_0x55dcdc[_0xa390('0xa1')]({'name':_0x4747af[_0xa390('0xb0')][_0xa390('0xb1')]['Label'],'value':String(_0x4747af[_0xa390('0xb2')])});});var _0x5b59c5={'id':_0x161636+'_'+_0x26dbb2[_0xa390('0x9a')],'name':_0x26dbb2[_0xa390('0xb3')][_0xa390('0xb1')][_0xa390('0xb0')],'custom':![],'options':_0x55dcdc};_0x3a7992[_0xa390('0xa1')](_0x5b59c5);return _0x3a7992;});}function getBooleanList(_0x1e5c5d,_0x2a1da1,_0x4630fd,_0x11b5d5,_0x1fbc3b,_0x20ec46){var _0x45919e={'method':_0xa390('0x91'),'uri':_0x1e5c5d+_0xa390('0x97')+_0x11b5d5+_0xa390('0xac')+_0x1fbc3b+_0xa390('0xb4'),'headers':{'Authorization':_0xa390('0x93')+_0x20ec46,'If-None-Match':null,'OData-Version':_0xa390('0x94')},'json':!![]};return rp(_0x45919e)['then'](function(_0x3c4d72){var _0x40598e=[];_0x40598e[_0xa390('0xa1')]({'name':_0x3c4d72[_0xa390('0xaf')][_0xa390('0xb5')][_0xa390('0xb0')]['UserLocalizedLabel']['Label'],'value':'true'},{'name':_0x3c4d72[_0xa390('0xaf')][_0xa390('0xb6')]['Label'][_0xa390('0xb1')][_0xa390('0xb0')],'value':_0xa390('0xb7')});var _0x4f40d9={'id':_0x2a1da1+'_'+_0x3c4d72['LogicalName'],'name':_0x3c4d72[_0xa390('0xb3')][_0xa390('0xb1')]['Label'],'custom':![],'options':_0x40598e};_0x4630fd['push'](_0x4f40d9);return _0x4630fd;});}function getInputList(_0x9aea2e,_0x349869,_0x5ba545,_0x33d6cf,_0x3faf20,_0xe1fb33,_0x2748ae){var _0x3dcfa6={'method':_0xa390('0x91'),'uri':_0x9aea2e+_0xa390('0x97')+_0x3faf20+')/Attributes('+_0xe1fb33+')/Microsoft.Dynamics.CRM.'+_0x5ba545+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xa390('0x93')+_0x2748ae,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3dcfa6)[_0xa390('0x10')](function(_0x32f388){var _0x3724fe={'id':_0x349869+'_'+_0x32f388[_0xa390('0x9a')],'name':_0x32f388[_0xa390('0xb3')][_0xa390('0xb1')]?_0x32f388['DisplayName']['UserLocalizedLabel'][_0xa390('0xb0')]:_0x32f388[_0xa390('0x9a')],'custom':![],'options':[]};_0x33d6cf[_0xa390('0xa1')](_0x3724fe);return _0x33d6cf;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index bf8eb07..ced2619 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x5c8524,_0x2c67c4){var _0x400827=function(_0x4060a3){while(--_0x4060a3){_0x5c8524['push'](_0x5c8524['shift']());}};_0x400827(++_0x2c67c4);}(_0x757a,0xde));var _0xa757=function(_0x507185,_0xefd6d5){_0x507185=_0x507185-0x0;var _0xd34531=_0x757a[_0x507185];return _0xd34531;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x3a8a59,_0x33ed5e){var _0x2cf291=function(_0x18b3fe){while(--_0x18b3fe){_0x3a8a59['push'](_0x3a8a59['shift']());}};_0x2cf291(++_0x33ed5e);}(_0x757a,0xde));var _0xa757=function(_0x583eee,_0x2ec40d){_0x583eee=_0x583eee-0x0;var _0x3dd9c0=_0x757a[_0x583eee];return _0x3dd9c0;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'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 e3aab26..8078da5 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 _0x3f2e=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','include','map','model','debug','ShowDynamics365Account','lodash','moment','randomstring'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x3f2e,0x114));var _0xe3f2=function(_0x4ca922,_0x11f8d6){_0x4ca922=_0x4ca922-0x0;var _0x3feb75=_0x3f2e[_0x4ca922];return _0x3feb75;};'use strict';var _=require(_0xe3f2('0x0'));var util=require('util');var moment=require(_0xe3f2('0x1'));var BPromise=require('bluebird');var rs=require(_0xe3f2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3f2('0x3'))['db'];var utils=require(_0xe3f2('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe3f2('0x5'));var jayson=require(_0xe3f2('0x6'));var client=jayson[_0xe3f2('0x7')][_0xe3f2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d0690,_0x30440a,_0x4501df){return new BPromise(function(_0x3aa76b,_0x4403c6){return client[_0xe3f2('0x9')](_0x5d0690,_0x4501df)[_0xe3f2('0xa')](function(_0x55248d){logger[_0xe3f2('0xb')](_0xe3f2('0xc'),_0x30440a,_0xe3f2('0xd'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x30440a,_0xe3f2('0xd'),JSON[_0xe3f2('0xe')](_0x55248d));if(_0x55248d[_0xe3f2('0xf')]){if(_0x55248d['error'][_0xe3f2('0x10')]===0x1f4){logger[_0xe3f2('0xf')](_0xe3f2('0xc'),_0x30440a,_0x55248d[_0xe3f2('0xf')][_0xe3f2('0x11')]);return _0x4403c6(_0x55248d['error']['message']);}logger[_0xe3f2('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x30440a,_0x55248d[_0xe3f2('0xf')][_0xe3f2('0x11')]);return _0x3aa76b(_0x55248d['error'][_0xe3f2('0x11')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x30440a,_0xe3f2('0xd'));_0x3aa76b(_0x55248d[_0xe3f2('0x12')][_0xe3f2('0x11')]);}})[_0xe3f2('0x13')](function(_0x14e683){logger['error'](_0xe3f2('0xc'),_0x30440a,_0x14e683);_0x4403c6(_0x14e683);});});}exports[_0xe3f2('0x14')]=function(_0x477181){var _0x52e84f=this;return new Promise(function(_0x65e8f6,_0x424c67){return db[_0xe3f2('0x15')]['findAll']({'raw':_0x477181[_0xe3f2('0x16')]?_0x477181[_0xe3f2('0x16')][_0xe3f2('0x17')]===undefined?!![]:![]:!![],'where':_0x477181[_0xe3f2('0x16')]?_0x477181[_0xe3f2('0x16')][_0xe3f2('0x18')]||null:null,'attributes':_0x477181[_0xe3f2('0x16')]?_0x477181[_0xe3f2('0x16')][_0xe3f2('0x19')]||null:null,'limit':_0x477181[_0xe3f2('0x16')]?_0x477181[_0xe3f2('0x16')]['limit']||null:null,'include':_0x477181[_0xe3f2('0x16')]?_0x477181[_0xe3f2('0x16')][_0xe3f2('0x1a')]?_[_0xe3f2('0x1b')](_0x477181[_0xe3f2('0x16')][_0xe3f2('0x1a')],function(_0x3f4f3a){return{'model':db[_0x3f4f3a[_0xe3f2('0x1c')]],'as':_0x3f4f3a['as'],'attributes':_0x3f4f3a[_0xe3f2('0x19')],'include':_0x3f4f3a[_0xe3f2('0x1a')]?_['map'](_0x3f4f3a[_0xe3f2('0x1a')],function(_0x477036){return{'model':db[_0x477036[_0xe3f2('0x1c')]],'as':_0x477036['as'],'attributes':_0x477036[_0xe3f2('0x19')],'include':_0x477036[_0xe3f2('0x1a')]?_['map'](_0x477036['include'],function(_0x2a6bbc){return{'model':db[_0x2a6bbc[_0xe3f2('0x1c')]],'as':_0x2a6bbc['as'],'attributes':_0x2a6bbc[_0xe3f2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe3f2('0xa')](function(_0x2e01ce){logger[_0xe3f2('0xb')]('GetDynamics365Account',_0x477181);logger[_0xe3f2('0x1d')](_0xe3f2('0x14'),_0x477181,JSON[_0xe3f2('0xe')](_0x2e01ce));_0x65e8f6(_0x2e01ce);})[_0xe3f2('0x13')](function(_0xc5b230){logger[_0xe3f2('0xf')](_0xe3f2('0x14'),_0xc5b230[_0xe3f2('0x11')],_0x477181);_0x424c67(_0x52e84f[_0xe3f2('0xf')](0x1f4,_0xc5b230[_0xe3f2('0x11')]));});});};exports[_0xe3f2('0x1e')]=function(_0x47b344){var _0x37efc9=this;return new Promise(function(_0x5bcba9,_0x5d67e3){return db['Dynamics365Account']['find']({'raw':_0x47b344[_0xe3f2('0x16')]?_0x47b344[_0xe3f2('0x16')][_0xe3f2('0x17')]===undefined?!![]:![]:!![],'where':_0x47b344[_0xe3f2('0x16')]?_0x47b344['options']['where']||null:null,'attributes':_0x47b344[_0xe3f2('0x16')]?_0x47b344[_0xe3f2('0x16')][_0xe3f2('0x19')]||null:null,'include':_0x47b344[_0xe3f2('0x16')]?_0x47b344[_0xe3f2('0x16')][_0xe3f2('0x1a')]?_['map'](_0x47b344['options'][_0xe3f2('0x1a')],function(_0x54f48a){return{'model':db[_0x54f48a['model']],'as':_0x54f48a['as'],'attributes':_0x54f48a['attributes'],'include':_0x54f48a[_0xe3f2('0x1a')]?_[_0xe3f2('0x1b')](_0x54f48a[_0xe3f2('0x1a')],function(_0x19992f){return{'model':db[_0x19992f[_0xe3f2('0x1c')]],'as':_0x19992f['as'],'attributes':_0x19992f[_0xe3f2('0x19')],'include':_0x19992f[_0xe3f2('0x1a')]?_['map'](_0x19992f['include'],function(_0x3919da){return{'model':db[_0x3919da[_0xe3f2('0x1c')]],'as':_0x3919da['as'],'attributes':_0x3919da[_0xe3f2('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x516b6f){logger[_0xe3f2('0xb')](_0xe3f2('0x1e'),_0x47b344);logger[_0xe3f2('0x1d')](_0xe3f2('0x1e'),_0x47b344,JSON[_0xe3f2('0xe')](_0x516b6f));_0x5bcba9(_0x516b6f);})[_0xe3f2('0x13')](function(_0x5f497d){logger[_0xe3f2('0xf')]('ShowDynamics365Account',_0x5f497d[_0xe3f2('0x11')],_0x47b344);_0x5d67e3(_0x37efc9['error'](0x1f4,_0x5f497d['message']));});});}; \ No newline at end of file +var _0xc7ca=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','attributes','map','model','then','ShowDynamics365Account','catch','util','moment'];(function(_0x56a369,_0x447525){var _0x568420=function(_0x5ac520){while(--_0x5ac520){_0x56a369['push'](_0x56a369['shift']());}};_0x568420(++_0x447525);}(_0xc7ca,0x8e));var _0xac7c=function(_0x27dbbf,_0x24255a){_0x27dbbf=_0x27dbbf-0x0;var _0x19e1c0=_0xc7ca[_0x27dbbf];return _0x19e1c0;};'use strict';var _=require('lodash');var util=require(_0xac7c('0x0'));var moment=require(_0xac7c('0x1'));var BPromise=require(_0xac7c('0x2'));var rs=require(_0xac7c('0x3'));var fs=require('fs');var Redis=require(_0xac7c('0x4'));var db=require(_0xac7c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7c('0x6'))(_0xac7c('0x7'));var config=require(_0xac7c('0x8'));var jayson=require(_0xac7c('0x9'));var client=jayson[_0xac7c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4270ea,_0x4d5455,_0x59238e){return new BPromise(function(_0xad238c,_0xab481b){return client[_0xac7c('0xb')](_0x4270ea,_0x59238e)['then'](function(_0x47ae52){logger[_0xac7c('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x4d5455,_0xac7c('0xd'));logger[_0xac7c('0xe')](_0xac7c('0xf'),_0x4d5455,_0xac7c('0xd'),JSON[_0xac7c('0x10')](_0x47ae52));if(_0x47ae52['error']){if(_0x47ae52[_0xac7c('0x11')][_0xac7c('0x12')]===0x1f4){logger[_0xac7c('0x11')](_0xac7c('0x13'),_0x4d5455,_0x47ae52[_0xac7c('0x11')][_0xac7c('0x14')]);return _0xab481b(_0x47ae52[_0xac7c('0x11')]['message']);}logger[_0xac7c('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x4d5455,_0x47ae52[_0xac7c('0x11')][_0xac7c('0x14')]);return _0xad238c(_0x47ae52[_0xac7c('0x11')][_0xac7c('0x14')]);}else{logger[_0xac7c('0xc')](_0xac7c('0x13'),_0x4d5455,_0xac7c('0xd'));_0xad238c(_0x47ae52[_0xac7c('0x15')][_0xac7c('0x14')]);}})['catch'](function(_0x568f37){logger[_0xac7c('0x11')](_0xac7c('0x13'),_0x4d5455,_0x568f37);_0xab481b(_0x568f37);});});}exports[_0xac7c('0x16')]=function(_0x393305){var _0x34620d=this;return new Promise(function(_0x4435e3,_0x42df37){return db[_0xac7c('0x17')][_0xac7c('0x18')]({'raw':_0x393305[_0xac7c('0x19')]?_0x393305['options'][_0xac7c('0x1a')]===undefined?!![]:![]:!![],'where':_0x393305[_0xac7c('0x19')]?_0x393305[_0xac7c('0x19')][_0xac7c('0x1b')]||null:null,'attributes':_0x393305['options']?_0x393305[_0xac7c('0x19')]['attributes']||null:null,'limit':_0x393305[_0xac7c('0x19')]?_0x393305['options'][_0xac7c('0x1c')]||null:null,'include':_0x393305[_0xac7c('0x19')]?_0x393305[_0xac7c('0x19')][_0xac7c('0x1d')]?_['map'](_0x393305['options'][_0xac7c('0x1d')],function(_0x500db1){return{'model':db[_0x500db1['model']],'as':_0x500db1['as'],'attributes':_0x500db1[_0xac7c('0x1e')],'include':_0x500db1[_0xac7c('0x1d')]?_[_0xac7c('0x1f')](_0x500db1[_0xac7c('0x1d')],function(_0xb8a082){return{'model':db[_0xb8a082[_0xac7c('0x20')]],'as':_0xb8a082['as'],'attributes':_0xb8a082['attributes'],'include':_0xb8a082['include']?_[_0xac7c('0x1f')](_0xb8a082[_0xac7c('0x1d')],function(_0xc4a83a){return{'model':db[_0xc4a83a[_0xac7c('0x20')]],'as':_0xc4a83a['as'],'attributes':_0xc4a83a[_0xac7c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xac7c('0x21')](function(_0x1e614b){logger[_0xac7c('0xc')](_0xac7c('0x16'),_0x393305);logger[_0xac7c('0xe')](_0xac7c('0x16'),_0x393305,JSON[_0xac7c('0x10')](_0x1e614b));_0x4435e3(_0x1e614b);})['catch'](function(_0x4460f2){logger[_0xac7c('0x11')](_0xac7c('0x16'),_0x4460f2[_0xac7c('0x14')],_0x393305);_0x42df37(_0x34620d[_0xac7c('0x11')](0x1f4,_0x4460f2[_0xac7c('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x3759e2){var _0x230a7d=this;return new Promise(function(_0x5699b5,_0x410ad4){return db['Dynamics365Account']['find']({'raw':_0x3759e2[_0xac7c('0x19')]?_0x3759e2['options']['raw']===undefined?!![]:![]:!![],'where':_0x3759e2[_0xac7c('0x19')]?_0x3759e2['options'][_0xac7c('0x1b')]||null:null,'attributes':_0x3759e2['options']?_0x3759e2[_0xac7c('0x19')][_0xac7c('0x1e')]||null:null,'include':_0x3759e2[_0xac7c('0x19')]?_0x3759e2[_0xac7c('0x19')]['include']?_[_0xac7c('0x1f')](_0x3759e2[_0xac7c('0x19')][_0xac7c('0x1d')],function(_0x234bcb){return{'model':db[_0x234bcb[_0xac7c('0x20')]],'as':_0x234bcb['as'],'attributes':_0x234bcb[_0xac7c('0x1e')],'include':_0x234bcb[_0xac7c('0x1d')]?_[_0xac7c('0x1f')](_0x234bcb[_0xac7c('0x1d')],function(_0x34c924){return{'model':db[_0x34c924['model']],'as':_0x34c924['as'],'attributes':_0x34c924[_0xac7c('0x1e')],'include':_0x34c924['include']?_[_0xac7c('0x1f')](_0x34c924[_0xac7c('0x1d')],function(_0x3fb389){return{'model':db[_0x3fb389[_0xac7c('0x20')]],'as':_0x3fb389['as'],'attributes':_0x3fb389['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58b764){logger[_0xac7c('0xc')](_0xac7c('0x22'),_0x3759e2);logger['debug'](_0xac7c('0x22'),_0x3759e2,JSON[_0xac7c('0x10')](_0x58b764));_0x5699b5(_0x58b764);})[_0xac7c('0x23')](function(_0x4ef04d){logger[_0xac7c('0x11')](_0xac7c('0x22'),_0x4ef04d['message'],_0x3759e2);_0x410ad4(_0x230a7d[_0xac7c('0x11')](0x1f4,_0x4ef04d[_0xac7c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 54a02b2..c613368 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x280a40,_0x605567){var _0x593d43=function(_0x12a365){while(--_0x12a365){_0x280a40['push'](_0x280a40['shift']());}};_0x593d43(++_0x605567);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'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('./intDynamics365Configuration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x8c6c=['getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','/:id','show','get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3edc22,_0x243990){var _0x1ddf50=function(_0x6e175f){while(--_0x6e175f){_0x3edc22['push'](_0x3edc22['shift']());}};_0x1ddf50(++_0x243990);}(_0x8c6c,0x133));var _0xc8c6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8c6c[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xc8c6('0x0'));var util=require(_0xc8c6('0x1'));var path=require('path');var timeout=require(_0xc8c6('0x2'));var express=require('express');var router=express[_0xc8c6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc8c6('0x4'));var config=require(_0xc8c6('0x5'));var controller=require(_0xc8c6('0x6'));router['get']('/',auth[_0xc8c6('0x7')](),controller['index']);router['get'](_0xc8c6('0x8'),auth['isAuthenticated'](),controller[_0xc8c6('0x9')]);router[_0xc8c6('0xa')](_0xc8c6('0xb'),auth[_0xc8c6('0x7')](),controller['getFields']);router[_0xc8c6('0xa')](_0xc8c6('0xc'),auth[_0xc8c6('0x7')](),controller[_0xc8c6('0xd')]);router['get'](_0xc8c6('0xe'),auth[_0xc8c6('0x7')](),controller[_0xc8c6('0xf')]);router[_0xc8c6('0x10')]('/',auth['isAuthenticated'](),controller[_0xc8c6('0x11')]);router[_0xc8c6('0x12')]('/:id',auth[_0xc8c6('0x7')](),controller[_0xc8c6('0x13')]);router[_0xc8c6('0x14')](_0xc8c6('0x8'),auth[_0xc8c6('0x7')](),controller[_0xc8c6('0x15')]);module[_0xc8c6('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c8d4da9..3fe736a 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 _0x7185=['STRING','ENUM','incident','contact','nothing','exports'];(function(_0x51648b,_0x5d9f64){var _0x22d841=function(_0x25bbf2){while(--_0x25bbf2){_0x51648b['push'](_0x51648b['shift']());}};_0x22d841(++_0x5d9f64);}(_0x7185,0x16d));var _0x5718=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7185[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0x5718('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5718('0x1')]},'ticketType':{'type':Sequelize[_0x5718('0x2')](_0x5718('0x3'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x5718('0x4'),_0x5718('0x5')),'defaultValue':_0x5718('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5718('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x6c50=['BOOLEAN','sequelize','exports','STRING','ENUM','incident','phonecall','contact','nothing'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x6c50,0x10f));var _0x06c5=function(_0x34f8a0,_0x4f3c54){_0x34f8a0=_0x34f8a0-0x0;var _0xc06c83=_0x6c50[_0x34f8a0];return _0xc06c83;};'use strict';var Sequelize=require(_0x06c5('0x0'));module[_0x06c5('0x1')]={'name':{'type':Sequelize[_0x06c5('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x06c5('0x3')](_0x06c5('0x4'),_0x06c5('0x5')),'defaultValue':_0x06c5('0x4')},'moduleCreate':{'type':Sequelize[_0x06c5('0x3')](_0x06c5('0x6'),_0x06c5('0x7')),'defaultValue':_0x06c5('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x06c5('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index b00584b..10e18ed 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 _0xc908=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','Dynamics365Configuration','fieldName','key'];(function(_0x3afe00,_0x19d479){var _0x9aa407=function(_0x25d425){while(--_0x25d425){_0x3afe00['push'](_0x3afe00['shift']());}};_0x9aa407(++_0x19d479);}(_0xc908,0x165));var _0x8c90=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xc908[_0x25701b];return _0x3a8a2c;};'use strict';var emlformat=require(_0x8c90('0x0'));var rimraf=require(_0x8c90('0x1'));var zipdir=require(_0x8c90('0x2'));var jsonpatch=require(_0x8c90('0x3'));var rp=require(_0x8c90('0x4'));var moment=require(_0x8c90('0x5'));var BPromise=require(_0x8c90('0x6'));var Mustache=require(_0x8c90('0x7'));var util=require(_0x8c90('0x8'));var path=require(_0x8c90('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8c90('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8c90('0xb'));var jsforce=require(_0x8c90('0xc'));var deskjs=require(_0x8c90('0xd'));var toCsv=require(_0x8c90('0xe'));var querystring=require(_0x8c90('0xf'));var Papa=require(_0x8c90('0x10'));var Redis=require(_0x8c90('0x11'));var authService=require(_0x8c90('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8c90('0x13'));var hardwareService=require(_0x8c90('0x14'));var logger=require('../../config/logger')(_0x8c90('0x15'));var utils=require('../../config/utils');var config=require(_0x8c90('0x16'));var licenseUtil=require(_0x8c90('0x17'));var db=require(_0x8c90('0x18'))['db'];function respondWithStatusCode(_0xfd39fe,_0x5e5f63){_0x5e5f63=_0x5e5f63||0xcc;return function(_0x3ce04b){if(_0x3ce04b){return _0xfd39fe[_0x8c90('0x19')](_0x5e5f63);}return _0xfd39fe['status'](_0x5e5f63)[_0x8c90('0x1a')]();};}function respondWithResult(_0x4ce50f,_0x21a3b3){_0x21a3b3=_0x21a3b3||0xc8;return function(_0x1365fe){if(_0x1365fe){return _0x4ce50f[_0x8c90('0x1b')](_0x21a3b3)['json'](_0x1365fe);}};}function respondWithFilteredResult(_0x293f23,_0x43476c){return function(_0x255c92){if(_0x255c92){var _0x4380eb=typeof _0x43476c['offset']===_0x8c90('0x1c')&&typeof _0x43476c[_0x8c90('0x1d')]===_0x8c90('0x1c');var _0x33b020=_0x255c92[_0x8c90('0x1e')];var _0xa35ab8=_0x4380eb?0x0:_0x43476c['offset'];var _0x5bec49=_0x4380eb?_0x255c92[_0x8c90('0x1e')]:_0x43476c[_0x8c90('0x1f')]+_0x43476c['limit'];var _0x3dbf3d;if(_0x5bec49>=_0x33b020){_0x5bec49=_0x33b020;_0x3dbf3d=0xc8;}else{_0x3dbf3d=0xce;}_0x293f23['status'](_0x3dbf3d);return _0x293f23[_0x8c90('0x20')](_0x8c90('0x21'),_0xa35ab8+'-'+_0x5bec49+'/'+_0x33b020)[_0x8c90('0x22')](_0x255c92);}return null;};}function patchUpdates(_0x529376){return function(_0x55018f){try{jsonpatch[_0x8c90('0x23')](_0x55018f,_0x529376,!![]);}catch(_0x5195c5){return BPromise[_0x8c90('0x24')](_0x5195c5);}return _0x55018f[_0x8c90('0x25')]();};}function saveUpdates(_0x166a31,_0x53ed36){return function(_0x578e8d){if(_0x578e8d){return _0x578e8d[_0x8c90('0x26')](_0x166a31)[_0x8c90('0x27')](function(_0x252cd1){return _0x252cd1;});}return null;};}function removeEntity(_0x41b895,_0x4faedf){return function(_0x22e89b){if(_0x22e89b){return _0x22e89b[_0x8c90('0x28')]()[_0x8c90('0x27')](function(){_0x41b895[_0x8c90('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6e39e9,_0x473bb0){return function(_0x56af21){if(!_0x56af21){_0x6e39e9[_0x8c90('0x19')](0x194);}return _0x56af21;};}function handleError(_0x1b1894,_0x21dbed){_0x21dbed=_0x21dbed||0x1f4;return function(_0xd5a000){logger['error'](_0xd5a000['stack']);if(_0xd5a000['name']){delete _0xd5a000[_0x8c90('0x29')];}_0x1b1894['status'](_0x21dbed)[_0x8c90('0x2a')](_0xd5a000);};}exports[_0x8c90('0x2b')]=function(_0x9475ce,_0x1df903){var _0x27b874={},_0x2eab05={},_0x7b3e63={'count':0x0,'rows':[]};var _0x3203a=_[_0x8c90('0x2c')](db[_0x8c90('0x2d')]['rawAttributes'],function(_0xeac18d){return{'name':_0xeac18d[_0x8c90('0x2e')],'type':_0xeac18d['type'][_0x8c90('0x2f')]};});_0x2eab05[_0x8c90('0x30')]=_['map'](_0x3203a,'name');_0x2eab05[_0x8c90('0x31')]=_[_0x8c90('0x32')](_0x9475ce[_0x8c90('0x31')]);_0x2eab05['filters']=_[_0x8c90('0x33')](_0x2eab05['model'],_0x2eab05[_0x8c90('0x31')]);_0x27b874[_0x8c90('0x34')]=_[_0x8c90('0x33')](_0x2eab05[_0x8c90('0x30')],qs[_0x8c90('0x35')](_0x9475ce[_0x8c90('0x31')][_0x8c90('0x35')]));_0x27b874['attributes']=_0x27b874[_0x8c90('0x34')][_0x8c90('0x36')]?_0x27b874[_0x8c90('0x34')]:_0x2eab05['model'];if(!_0x9475ce[_0x8c90('0x31')][_0x8c90('0x37')]('nolimit')){_0x27b874[_0x8c90('0x1d')]=qs[_0x8c90('0x1d')](_0x9475ce[_0x8c90('0x31')][_0x8c90('0x1d')]);_0x27b874[_0x8c90('0x1f')]=qs[_0x8c90('0x1f')](_0x9475ce['query'][_0x8c90('0x1f')]);}_0x27b874[_0x8c90('0x38')]=qs[_0x8c90('0x39')](_0x9475ce[_0x8c90('0x31')][_0x8c90('0x39')]);_0x27b874[_0x8c90('0x3a')]=qs[_0x8c90('0x3b')](_[_0x8c90('0x3c')](_0x9475ce[_0x8c90('0x31')],_0x2eab05['filters']),_0x3203a);if(_0x9475ce[_0x8c90('0x31')][_0x8c90('0x3d')]){_0x27b874[_0x8c90('0x3a')]=_['merge'](_0x27b874[_0x8c90('0x3a')],{'$or':_[_0x8c90('0x2c')](_0x3203a,function(_0x41e927){if(_0x41e927['type']!==_0x8c90('0x3e')){var _0x56416f={};_0x56416f[_0x41e927[_0x8c90('0x29')]]={'$like':'%'+_0x9475ce[_0x8c90('0x31')]['filter']+'%'};return _0x56416f;}})});}_0x27b874=_[_0x8c90('0x3f')]({},_0x27b874,_0x9475ce[_0x8c90('0x40')]);var _0x277ba0={'where':_0x27b874[_0x8c90('0x3a')]};return db[_0x8c90('0x2d')]['count'](_0x277ba0)[_0x8c90('0x27')](function(_0x11c586){_0x7b3e63[_0x8c90('0x1e')]=_0x11c586;if(_0x9475ce[_0x8c90('0x31')]['includeAll']){_0x27b874['include']=[{'all':!![]}];}return db[_0x8c90('0x2d')][_0x8c90('0x41')](_0x27b874);})[_0x8c90('0x27')](function(_0x2cf14b){_0x7b3e63['rows']=_0x2cf14b;return _0x7b3e63;})[_0x8c90('0x27')](respondWithFilteredResult(_0x1df903,_0x27b874))[_0x8c90('0x42')](handleError(_0x1df903,null));};exports[_0x8c90('0x43')]=function(_0x1cacd7,_0x2b93d9){var _0x155c44={'raw':![],'where':{'id':_0x1cacd7[_0x8c90('0x44')]['id']}},_0x4709ab={};_0x4709ab[_0x8c90('0x30')]=_['keys'](db[_0x8c90('0x2d')][_0x8c90('0x45')]);_0x4709ab[_0x8c90('0x31')]=_['keys'](_0x1cacd7['query']);_0x4709ab['filters']=_[_0x8c90('0x33')](_0x4709ab[_0x8c90('0x30')],_0x4709ab[_0x8c90('0x31')]);_0x155c44[_0x8c90('0x34')]=_[_0x8c90('0x33')](_0x4709ab[_0x8c90('0x30')],qs[_0x8c90('0x35')](_0x1cacd7[_0x8c90('0x31')][_0x8c90('0x35')]));_0x155c44[_0x8c90('0x34')]=_0x155c44['attributes'][_0x8c90('0x36')]?_0x155c44['attributes']:_0x4709ab[_0x8c90('0x30')];if(_0x1cacd7['query'][_0x8c90('0x46')]){_0x155c44[_0x8c90('0x47')]=[{'all':!![]}];}_0x155c44=_[_0x8c90('0x3f')]({},_0x155c44,_0x1cacd7[_0x8c90('0x40')]);return db[_0x8c90('0x2d')][_0x8c90('0x48')](_0x155c44)[_0x8c90('0x27')](handleEntityNotFound(_0x2b93d9,null))['then'](respondWithResult(_0x2b93d9,null))[_0x8c90('0x42')](handleError(_0x2b93d9,null));};exports[_0x8c90('0x49')]=function(_0x5a4bae,_0x148182){return db[_0x8c90('0x2d')]['create'](_0x5a4bae[_0x8c90('0x4a')],{})[_0x8c90('0x27')](respondWithResult(_0x148182,0xc9))['catch'](handleError(_0x148182,null));};exports[_0x8c90('0x26')]=function(_0x4771c6,_0x1ff3a3){if(_0x4771c6[_0x8c90('0x4a')]['id']){delete _0x4771c6[_0x8c90('0x4a')]['id'];}return db[_0x8c90('0x2d')][_0x8c90('0x48')]({'where':{'id':_0x4771c6[_0x8c90('0x44')]['id']}})[_0x8c90('0x27')](handleEntityNotFound(_0x1ff3a3,null))[_0x8c90('0x27')](saveUpdates(_0x4771c6['body'],null))[_0x8c90('0x27')](respondWithResult(_0x1ff3a3,null))[_0x8c90('0x42')](handleError(_0x1ff3a3,null));};exports[_0x8c90('0x28')]=function(_0x114338,_0x34053d){return db[_0x8c90('0x2d')][_0x8c90('0x48')]({'where':{'id':_0x114338[_0x8c90('0x44')]['id']}})[_0x8c90('0x27')](handleEntityNotFound(_0x34053d,null))['then'](removeEntity(_0x34053d,null))[_0x8c90('0x42')](handleError(_0x34053d,null));};exports[_0x8c90('0x4b')]=function(_0x134108,_0x628832,_0x2a376d){var _0x41bfd4={};var _0x5522da={};var _0x5d89a8;var _0x403a02;return db['Dynamics365Configuration'][_0x8c90('0x4c')]({'where':{'id':_0x134108['params']['id']}})[_0x8c90('0x27')](handleEntityNotFound(_0x628832,null))['then'](function(_0x3ad710){if(_0x3ad710){_0x5d89a8=_0x3ad710;_0x5522da[_0x8c90('0x30')]=_[_0x8c90('0x32')](db[_0x8c90('0x4d')]['rawAttributes']);_0x5522da[_0x8c90('0x31')]=_['keys'](_0x134108[_0x8c90('0x31')]);_0x5522da['filters']=_[_0x8c90('0x33')](_0x5522da[_0x8c90('0x30')],_0x5522da[_0x8c90('0x31')]);_0x41bfd4[_0x8c90('0x34')]=_['intersection'](_0x5522da['model'],qs[_0x8c90('0x35')](_0x134108[_0x8c90('0x31')][_0x8c90('0x35')]));_0x41bfd4[_0x8c90('0x34')]=_0x41bfd4[_0x8c90('0x34')][_0x8c90('0x36')]?_0x41bfd4['attributes']:_0x5522da['model'];_0x41bfd4['order']=qs[_0x8c90('0x39')](_0x134108[_0x8c90('0x31')][_0x8c90('0x39')]);_0x41bfd4[_0x8c90('0x3a')]=qs[_0x8c90('0x3b')](_[_0x8c90('0x3c')](_0x134108[_0x8c90('0x31')],_0x5522da[_0x8c90('0x3b')]));if(_0x134108[_0x8c90('0x31')][_0x8c90('0x3d')]){_0x41bfd4[_0x8c90('0x3a')]=_[_0x8c90('0x3f')](_0x41bfd4[_0x8c90('0x3a')],{'$or':_[_0x8c90('0x2c')](_0x41bfd4[_0x8c90('0x34')],function(_0x242b63){var _0x2087db={};_0x2087db[_0x242b63]={'$like':'%'+_0x134108[_0x8c90('0x31')][_0x8c90('0x3d')]+'%'};return _0x2087db;})});}_0x41bfd4=_[_0x8c90('0x3f')]({},_0x41bfd4,_0x134108[_0x8c90('0x40')]);return _0x5d89a8['getFields'](_0x41bfd4);}})['then'](function(_0x2183b6){if(_0x2183b6){_0x403a02=_0x2183b6[_0x8c90('0x36')];if(!_0x134108[_0x8c90('0x31')]['hasOwnProperty']('nolimit')){_0x41bfd4[_0x8c90('0x1d')]=qs['limit'](_0x134108[_0x8c90('0x31')][_0x8c90('0x1d')]);_0x41bfd4[_0x8c90('0x1f')]=qs[_0x8c90('0x1f')](_0x134108[_0x8c90('0x31')][_0x8c90('0x1f')]);}return _0x5d89a8[_0x8c90('0x4b')](_0x41bfd4);}})[_0x8c90('0x27')](function(_0x535677){if(_0x535677){return _0x535677?{'count':_0x403a02,'rows':_0x535677}:null;}})['then'](respondWithResult(_0x628832,null))[_0x8c90('0x42')](handleError(_0x628832,null));};exports[_0x8c90('0x4e')]=function(_0x1d243a,_0xf57805,_0x57250f){var _0x29b03c={};var _0x4bf813={};var _0x588489;var _0x540c0d;return db[_0x8c90('0x2d')][_0x8c90('0x4c')]({'where':{'id':_0x1d243a[_0x8c90('0x44')]['id']}})[_0x8c90('0x27')](handleEntityNotFound(_0xf57805,null))[_0x8c90('0x27')](function(_0xafc429){if(_0xafc429){_0x588489=_0xafc429;_0x4bf813[_0x8c90('0x30')]=_[_0x8c90('0x32')](db[_0x8c90('0x4d')]['rawAttributes']);_0x4bf813['query']=_[_0x8c90('0x32')](_0x1d243a['query']);_0x4bf813[_0x8c90('0x3b')]=_[_0x8c90('0x33')](_0x4bf813[_0x8c90('0x30')],_0x4bf813[_0x8c90('0x31')]);_0x29b03c[_0x8c90('0x34')]=_[_0x8c90('0x33')](_0x4bf813[_0x8c90('0x30')],qs[_0x8c90('0x35')](_0x1d243a[_0x8c90('0x31')][_0x8c90('0x35')]));_0x29b03c['attributes']=_0x29b03c[_0x8c90('0x34')][_0x8c90('0x36')]?_0x29b03c[_0x8c90('0x34')]:_0x4bf813['model'];_0x29b03c[_0x8c90('0x38')]=qs[_0x8c90('0x39')](_0x1d243a['query']['sort']);_0x29b03c['where']=qs[_0x8c90('0x3b')](_[_0x8c90('0x3c')](_0x1d243a[_0x8c90('0x31')],_0x4bf813[_0x8c90('0x3b')]));if(_0x1d243a['query'][_0x8c90('0x3d')]){_0x29b03c[_0x8c90('0x3a')]=_[_0x8c90('0x3f')](_0x29b03c[_0x8c90('0x3a')],{'$or':_['map'](_0x29b03c[_0x8c90('0x34')],function(_0x1f6536){var _0x41c8cb={};_0x41c8cb[_0x1f6536]={'$like':'%'+_0x1d243a[_0x8c90('0x31')][_0x8c90('0x3d')]+'%'};return _0x41c8cb;})});}_0x29b03c=_['merge']({},_0x29b03c,_0x1d243a[_0x8c90('0x40')]);return _0x588489['getSubjects'](_0x29b03c);}})[_0x8c90('0x27')](function(_0x38c3e9){if(_0x38c3e9){_0x540c0d=_0x38c3e9[_0x8c90('0x36')];if(!_0x1d243a[_0x8c90('0x31')][_0x8c90('0x37')](_0x8c90('0x4f'))){_0x29b03c[_0x8c90('0x1d')]=qs[_0x8c90('0x1d')](_0x1d243a[_0x8c90('0x31')][_0x8c90('0x1d')]);_0x29b03c[_0x8c90('0x1f')]=qs[_0x8c90('0x1f')](_0x1d243a['query']['offset']);}return _0x588489[_0x8c90('0x4e')](_0x29b03c);}})[_0x8c90('0x27')](function(_0x1e886b){if(_0x1e886b){return _0x1e886b?{'count':_0x540c0d,'rows':_0x1e886b}:null;}})[_0x8c90('0x27')](respondWithResult(_0xf57805,null))[_0x8c90('0x42')](handleError(_0xf57805,null));};exports['getDescriptions']=function(_0x5242cc,_0x5a2dc6,_0xa8d459){var _0x5e6981={};var _0x1242a9={};var _0x1a3aca;var _0x2dca72;return db[_0x8c90('0x2d')][_0x8c90('0x4c')]({'where':{'id':_0x5242cc['params']['id']}})[_0x8c90('0x27')](handleEntityNotFound(_0x5a2dc6,null))[_0x8c90('0x27')](function(_0x41219a){if(_0x41219a){_0x1a3aca=_0x41219a;_0x1242a9['model']=_[_0x8c90('0x32')](db['Dynamics365Field'][_0x8c90('0x45')]);_0x1242a9[_0x8c90('0x31')]=_['keys'](_0x5242cc[_0x8c90('0x31')]);_0x1242a9['filters']=_['intersection'](_0x1242a9[_0x8c90('0x30')],_0x1242a9[_0x8c90('0x31')]);_0x5e6981[_0x8c90('0x34')]=_[_0x8c90('0x33')](_0x1242a9[_0x8c90('0x30')],qs['fields'](_0x5242cc[_0x8c90('0x31')][_0x8c90('0x35')]));_0x5e6981[_0x8c90('0x34')]=_0x5e6981[_0x8c90('0x34')][_0x8c90('0x36')]?_0x5e6981[_0x8c90('0x34')]:_0x1242a9[_0x8c90('0x30')];_0x5e6981[_0x8c90('0x38')]=qs[_0x8c90('0x39')](_0x5242cc[_0x8c90('0x31')][_0x8c90('0x39')]);_0x5e6981[_0x8c90('0x3a')]=qs[_0x8c90('0x3b')](_[_0x8c90('0x3c')](_0x5242cc['query'],_0x1242a9['filters']));if(_0x5242cc[_0x8c90('0x31')][_0x8c90('0x3d')]){_0x5e6981[_0x8c90('0x3a')]=_['merge'](_0x5e6981['where'],{'$or':_[_0x8c90('0x2c')](_0x5e6981[_0x8c90('0x34')],function(_0x1fad3b){var _0x9bff50={};_0x9bff50[_0x1fad3b]={'$like':'%'+_0x5242cc[_0x8c90('0x31')][_0x8c90('0x3d')]+'%'};return _0x9bff50;})});}_0x5e6981=_[_0x8c90('0x3f')]({},_0x5e6981,_0x5242cc[_0x8c90('0x40')]);return _0x1a3aca[_0x8c90('0x50')](_0x5e6981);}})[_0x8c90('0x27')](function(_0x268b81){if(_0x268b81){_0x2dca72=_0x268b81[_0x8c90('0x36')];if(!_0x5242cc[_0x8c90('0x31')][_0x8c90('0x37')](_0x8c90('0x4f'))){_0x5e6981[_0x8c90('0x1d')]=qs[_0x8c90('0x1d')](_0x5242cc[_0x8c90('0x31')][_0x8c90('0x1d')]);_0x5e6981[_0x8c90('0x1f')]=qs[_0x8c90('0x1f')](_0x5242cc[_0x8c90('0x31')]['offset']);}return _0x1a3aca[_0x8c90('0x50')](_0x5e6981);}})[_0x8c90('0x27')](function(_0x13f022){if(_0x13f022){return _0x13f022?{'count':_0x2dca72,'rows':_0x13f022}:null;}})[_0x8c90('0x27')](respondWithResult(_0x5a2dc6,null))[_0x8c90('0x42')](handleError(_0x5a2dc6,null));}; \ No newline at end of file +var _0x6c77=['type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','Dynamics365Configuration','rawAttributes','fieldName'];(function(_0x482649,_0x1bc190){var _0x443ae9=function(_0x510e70){while(--_0x510e70){_0x482649['push'](_0x482649['shift']());}};_0x443ae9(++_0x1bc190);}(_0x6c77,0x1e9));var _0x76c7=function(_0x42546d,_0x4b060a){_0x42546d=_0x42546d-0x0;var _0x5cac5b=_0x6c77[_0x42546d];return _0x5cac5b;};'use strict';var emlformat=require(_0x76c7('0x0'));var rimraf=require(_0x76c7('0x1'));var zipdir=require(_0x76c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x76c7('0x3'));var util=require(_0x76c7('0x4'));var path=require(_0x76c7('0x5'));var sox=require(_0x76c7('0x6'));var csv=require(_0x76c7('0x7'));var ejs=require(_0x76c7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76c7('0x9'));var squel=require(_0x76c7('0xa'));var crypto=require('crypto');var jsforce=require(_0x76c7('0xb'));var deskjs=require(_0x76c7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x76c7('0xd'));var Papa=require(_0x76c7('0xe'));var Redis=require(_0x76c7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x76c7('0x10'));var as=require(_0x76c7('0x11'));var hardwareService=require(_0x76c7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x76c7('0x13'));var config=require(_0x76c7('0x14'));var licenseUtil=require(_0x76c7('0x15'));var db=require(_0x76c7('0x16'))['db'];function respondWithStatusCode(_0xadfc12,_0x43774f){_0x43774f=_0x43774f||0xcc;return function(_0x28c1b7){if(_0x28c1b7){return _0xadfc12[_0x76c7('0x17')](_0x43774f);}return _0xadfc12[_0x76c7('0x18')](_0x43774f)[_0x76c7('0x19')]();};}function respondWithResult(_0x4044b2,_0x76e987){_0x76e987=_0x76e987||0xc8;return function(_0x2d2095){if(_0x2d2095){return _0x4044b2[_0x76c7('0x18')](_0x76e987)[_0x76c7('0x1a')](_0x2d2095);}};}function respondWithFilteredResult(_0x24bc14,_0x547bc4){return function(_0x4d1411){if(_0x4d1411){var _0x1f48e7=typeof _0x547bc4[_0x76c7('0x1b')]===_0x76c7('0x1c')&&typeof _0x547bc4[_0x76c7('0x1d')]===_0x76c7('0x1c');var _0x2b9912=_0x4d1411[_0x76c7('0x1e')];var _0x35004a=_0x1f48e7?0x0:_0x547bc4['offset'];var _0x16fc41=_0x1f48e7?_0x4d1411[_0x76c7('0x1e')]:_0x547bc4[_0x76c7('0x1b')]+_0x547bc4[_0x76c7('0x1d')];var _0x2065ae;if(_0x16fc41>=_0x2b9912){_0x16fc41=_0x2b9912;_0x2065ae=0xc8;}else{_0x2065ae=0xce;}_0x24bc14[_0x76c7('0x18')](_0x2065ae);return _0x24bc14['set'](_0x76c7('0x1f'),_0x35004a+'-'+_0x16fc41+'/'+_0x2b9912)['json'](_0x4d1411);}return null;};}function patchUpdates(_0x1d7643){return function(_0xe6e954){try{jsonpatch[_0x76c7('0x20')](_0xe6e954,_0x1d7643,!![]);}catch(_0x114eed){return BPromise['reject'](_0x114eed);}return _0xe6e954['save']();};}function saveUpdates(_0x38391a,_0x34c517){return function(_0x32aa65){if(_0x32aa65){return _0x32aa65[_0x76c7('0x21')](_0x38391a)[_0x76c7('0x22')](function(_0x537b5e){return _0x537b5e;});}return null;};}function removeEntity(_0x2fc292,_0x366496){return function(_0x43dd06){if(_0x43dd06){return _0x43dd06[_0x76c7('0x23')]()[_0x76c7('0x22')](function(){_0x2fc292[_0x76c7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdbb9a2,_0x2e524d){return function(_0x4c2a64){if(!_0x4c2a64){_0xdbb9a2[_0x76c7('0x17')](0x194);}return _0x4c2a64;};}function handleError(_0x40c9c1,_0x2aa51f){_0x2aa51f=_0x2aa51f||0x1f4;return function(_0x50799f){logger[_0x76c7('0x24')](_0x50799f[_0x76c7('0x25')]);if(_0x50799f[_0x76c7('0x26')]){delete _0x50799f['name'];}_0x40c9c1[_0x76c7('0x18')](_0x2aa51f)[_0x76c7('0x27')](_0x50799f);};}exports['index']=function(_0x94571e,_0x5d2f39){var _0x5df15b={},_0x39c5dd={},_0x205ad0={'count':0x0,'rows':[]};var _0x54a616=_['map'](db[_0x76c7('0x28')][_0x76c7('0x29')],function(_0x3d83e5){return{'name':_0x3d83e5[_0x76c7('0x2a')],'type':_0x3d83e5[_0x76c7('0x2b')]['key']};});_0x39c5dd[_0x76c7('0x2c')]=_[_0x76c7('0x2d')](_0x54a616,_0x76c7('0x26'));_0x39c5dd['query']=_[_0x76c7('0x2e')](_0x94571e[_0x76c7('0x2f')]);_0x39c5dd[_0x76c7('0x30')]=_[_0x76c7('0x31')](_0x39c5dd[_0x76c7('0x2c')],_0x39c5dd[_0x76c7('0x2f')]);_0x5df15b['attributes']=_[_0x76c7('0x31')](_0x39c5dd[_0x76c7('0x2c')],qs[_0x76c7('0x32')](_0x94571e[_0x76c7('0x2f')][_0x76c7('0x32')]));_0x5df15b['attributes']=_0x5df15b[_0x76c7('0x33')][_0x76c7('0x34')]?_0x5df15b[_0x76c7('0x33')]:_0x39c5dd[_0x76c7('0x2c')];if(!_0x94571e['query'][_0x76c7('0x35')](_0x76c7('0x36'))){_0x5df15b['limit']=qs[_0x76c7('0x1d')](_0x94571e[_0x76c7('0x2f')]['limit']);_0x5df15b['offset']=qs['offset'](_0x94571e[_0x76c7('0x2f')][_0x76c7('0x1b')]);}_0x5df15b[_0x76c7('0x37')]=qs[_0x76c7('0x38')](_0x94571e[_0x76c7('0x2f')][_0x76c7('0x38')]);_0x5df15b['where']=qs[_0x76c7('0x30')](_[_0x76c7('0x39')](_0x94571e[_0x76c7('0x2f')],_0x39c5dd['filters']),_0x54a616);if(_0x94571e[_0x76c7('0x2f')][_0x76c7('0x3a')]){_0x5df15b['where']=_[_0x76c7('0x3b')](_0x5df15b['where'],{'$or':_['map'](_0x54a616,function(_0x2c9118){if(_0x2c9118[_0x76c7('0x2b')]!==_0x76c7('0x3c')){var _0x48cf78={};_0x48cf78[_0x2c9118[_0x76c7('0x26')]]={'$like':'%'+_0x94571e[_0x76c7('0x2f')][_0x76c7('0x3a')]+'%'};return _0x48cf78;}})});}_0x5df15b=_['merge']({},_0x5df15b,_0x94571e[_0x76c7('0x3d')]);var _0x3268e9={'where':_0x5df15b[_0x76c7('0x3e')]};return db[_0x76c7('0x28')][_0x76c7('0x1e')](_0x3268e9)[_0x76c7('0x22')](function(_0x2fa6fb){_0x205ad0[_0x76c7('0x1e')]=_0x2fa6fb;if(_0x94571e[_0x76c7('0x2f')]['includeAll']){_0x5df15b[_0x76c7('0x3f')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x76c7('0x40')](_0x5df15b);})['then'](function(_0x2f55d3){_0x205ad0['rows']=_0x2f55d3;return _0x205ad0;})['then'](respondWithFilteredResult(_0x5d2f39,_0x5df15b))[_0x76c7('0x41')](handleError(_0x5d2f39,null));};exports[_0x76c7('0x42')]=function(_0x3e0e1f,_0x554585){var _0x4f03c6={'raw':![],'where':{'id':_0x3e0e1f[_0x76c7('0x43')]['id']}},_0x45b200={};_0x45b200[_0x76c7('0x2c')]=_['keys'](db[_0x76c7('0x28')][_0x76c7('0x29')]);_0x45b200['query']=_[_0x76c7('0x2e')](_0x3e0e1f[_0x76c7('0x2f')]);_0x45b200[_0x76c7('0x30')]=_['intersection'](_0x45b200[_0x76c7('0x2c')],_0x45b200[_0x76c7('0x2f')]);_0x4f03c6['attributes']=_[_0x76c7('0x31')](_0x45b200[_0x76c7('0x2c')],qs[_0x76c7('0x32')](_0x3e0e1f['query'][_0x76c7('0x32')]));_0x4f03c6[_0x76c7('0x33')]=_0x4f03c6[_0x76c7('0x33')][_0x76c7('0x34')]?_0x4f03c6[_0x76c7('0x33')]:_0x45b200[_0x76c7('0x2c')];if(_0x3e0e1f['query']['includeAll']){_0x4f03c6[_0x76c7('0x3f')]=[{'all':!![]}];}_0x4f03c6=_[_0x76c7('0x3b')]({},_0x4f03c6,_0x3e0e1f[_0x76c7('0x3d')]);return db[_0x76c7('0x28')][_0x76c7('0x44')](_0x4f03c6)[_0x76c7('0x22')](handleEntityNotFound(_0x554585,null))['then'](respondWithResult(_0x554585,null))['catch'](handleError(_0x554585,null));};exports[_0x76c7('0x45')]=function(_0x344b13,_0x3b4cd7){return db[_0x76c7('0x28')][_0x76c7('0x45')](_0x344b13[_0x76c7('0x46')],{})[_0x76c7('0x22')](respondWithResult(_0x3b4cd7,0xc9))[_0x76c7('0x41')](handleError(_0x3b4cd7,null));};exports[_0x76c7('0x21')]=function(_0x43d7ea,_0x5f5130){if(_0x43d7ea[_0x76c7('0x46')]['id']){delete _0x43d7ea[_0x76c7('0x46')]['id'];}return db[_0x76c7('0x28')][_0x76c7('0x44')]({'where':{'id':_0x43d7ea[_0x76c7('0x43')]['id']}})['then'](handleEntityNotFound(_0x5f5130,null))[_0x76c7('0x22')](saveUpdates(_0x43d7ea[_0x76c7('0x46')],null))['then'](respondWithResult(_0x5f5130,null))[_0x76c7('0x41')](handleError(_0x5f5130,null));};exports['destroy']=function(_0x4b6e96,_0x14bf3b){return db[_0x76c7('0x28')]['find']({'where':{'id':_0x4b6e96[_0x76c7('0x43')]['id']}})[_0x76c7('0x22')](handleEntityNotFound(_0x14bf3b,null))[_0x76c7('0x22')](removeEntity(_0x14bf3b,null))[_0x76c7('0x41')](handleError(_0x14bf3b,null));};exports[_0x76c7('0x47')]=function(_0x3ad881,_0x52042c,_0x5ed980){var _0x3b53b5={};var _0x1a287a={};var _0x2985dc;var _0x5b71bb;return db[_0x76c7('0x28')][_0x76c7('0x48')]({'where':{'id':_0x3ad881['params']['id']}})[_0x76c7('0x22')](handleEntityNotFound(_0x52042c,null))[_0x76c7('0x22')](function(_0x2e10d7){if(_0x2e10d7){_0x2985dc=_0x2e10d7;_0x1a287a[_0x76c7('0x2c')]=_[_0x76c7('0x2e')](db[_0x76c7('0x49')][_0x76c7('0x29')]);_0x1a287a[_0x76c7('0x2f')]=_['keys'](_0x3ad881[_0x76c7('0x2f')]);_0x1a287a[_0x76c7('0x30')]=_[_0x76c7('0x31')](_0x1a287a['model'],_0x1a287a[_0x76c7('0x2f')]);_0x3b53b5[_0x76c7('0x33')]=_[_0x76c7('0x31')](_0x1a287a[_0x76c7('0x2c')],qs['fields'](_0x3ad881[_0x76c7('0x2f')][_0x76c7('0x32')]));_0x3b53b5[_0x76c7('0x33')]=_0x3b53b5['attributes']['length']?_0x3b53b5[_0x76c7('0x33')]:_0x1a287a[_0x76c7('0x2c')];_0x3b53b5[_0x76c7('0x37')]=qs[_0x76c7('0x38')](_0x3ad881[_0x76c7('0x2f')][_0x76c7('0x38')]);_0x3b53b5[_0x76c7('0x3e')]=qs[_0x76c7('0x30')](_[_0x76c7('0x39')](_0x3ad881[_0x76c7('0x2f')],_0x1a287a['filters']));if(_0x3ad881[_0x76c7('0x2f')]['filter']){_0x3b53b5[_0x76c7('0x3e')]=_[_0x76c7('0x3b')](_0x3b53b5[_0x76c7('0x3e')],{'$or':_[_0x76c7('0x2d')](_0x3b53b5[_0x76c7('0x33')],function(_0x36826e){var _0xf9d35={};_0xf9d35[_0x36826e]={'$like':'%'+_0x3ad881[_0x76c7('0x2f')][_0x76c7('0x3a')]+'%'};return _0xf9d35;})});}_0x3b53b5=_['merge']({},_0x3b53b5,_0x3ad881[_0x76c7('0x3d')]);return _0x2985dc[_0x76c7('0x47')](_0x3b53b5);}})[_0x76c7('0x22')](function(_0x3330b6){if(_0x3330b6){_0x5b71bb=_0x3330b6['length'];if(!_0x3ad881[_0x76c7('0x2f')][_0x76c7('0x35')]('nolimit')){_0x3b53b5[_0x76c7('0x1d')]=qs[_0x76c7('0x1d')](_0x3ad881[_0x76c7('0x2f')][_0x76c7('0x1d')]);_0x3b53b5[_0x76c7('0x1b')]=qs[_0x76c7('0x1b')](_0x3ad881['query'][_0x76c7('0x1b')]);}return _0x2985dc['getFields'](_0x3b53b5);}})['then'](function(_0xfdaf0b){if(_0xfdaf0b){return _0xfdaf0b?{'count':_0x5b71bb,'rows':_0xfdaf0b}:null;}})[_0x76c7('0x22')](respondWithResult(_0x52042c,null))[_0x76c7('0x41')](handleError(_0x52042c,null));};exports[_0x76c7('0x4a')]=function(_0x3a3db6,_0x5eb6ad,_0x2741bd){var _0x3895ce={};var _0x21c772={};var _0x24db5c;var _0x3a1f4f;return db['Dynamics365Configuration'][_0x76c7('0x48')]({'where':{'id':_0x3a3db6[_0x76c7('0x43')]['id']}})['then'](handleEntityNotFound(_0x5eb6ad,null))[_0x76c7('0x22')](function(_0x393856){if(_0x393856){_0x24db5c=_0x393856;_0x21c772[_0x76c7('0x2c')]=_[_0x76c7('0x2e')](db[_0x76c7('0x49')][_0x76c7('0x29')]);_0x21c772[_0x76c7('0x2f')]=_[_0x76c7('0x2e')](_0x3a3db6['query']);_0x21c772['filters']=_['intersection'](_0x21c772['model'],_0x21c772[_0x76c7('0x2f')]);_0x3895ce[_0x76c7('0x33')]=_[_0x76c7('0x31')](_0x21c772['model'],qs[_0x76c7('0x32')](_0x3a3db6[_0x76c7('0x2f')]['fields']));_0x3895ce[_0x76c7('0x33')]=_0x3895ce[_0x76c7('0x33')]['length']?_0x3895ce[_0x76c7('0x33')]:_0x21c772['model'];_0x3895ce['order']=qs[_0x76c7('0x38')](_0x3a3db6['query'][_0x76c7('0x38')]);_0x3895ce[_0x76c7('0x3e')]=qs[_0x76c7('0x30')](_[_0x76c7('0x39')](_0x3a3db6[_0x76c7('0x2f')],_0x21c772[_0x76c7('0x30')]));if(_0x3a3db6[_0x76c7('0x2f')]['filter']){_0x3895ce[_0x76c7('0x3e')]=_[_0x76c7('0x3b')](_0x3895ce['where'],{'$or':_[_0x76c7('0x2d')](_0x3895ce['attributes'],function(_0x5d6ddc){var _0x32c2d3={};_0x32c2d3[_0x5d6ddc]={'$like':'%'+_0x3a3db6[_0x76c7('0x2f')][_0x76c7('0x3a')]+'%'};return _0x32c2d3;})});}_0x3895ce=_[_0x76c7('0x3b')]({},_0x3895ce,_0x3a3db6['options']);return _0x24db5c['getSubjects'](_0x3895ce);}})['then'](function(_0x40d676){if(_0x40d676){_0x3a1f4f=_0x40d676[_0x76c7('0x34')];if(!_0x3a3db6[_0x76c7('0x2f')][_0x76c7('0x35')](_0x76c7('0x36'))){_0x3895ce['limit']=qs['limit'](_0x3a3db6[_0x76c7('0x2f')][_0x76c7('0x1d')]);_0x3895ce[_0x76c7('0x1b')]=qs[_0x76c7('0x1b')](_0x3a3db6[_0x76c7('0x2f')][_0x76c7('0x1b')]);}return _0x24db5c[_0x76c7('0x4a')](_0x3895ce);}})[_0x76c7('0x22')](function(_0x2e0225){if(_0x2e0225){return _0x2e0225?{'count':_0x3a1f4f,'rows':_0x2e0225}:null;}})[_0x76c7('0x22')](respondWithResult(_0x5eb6ad,null))['catch'](handleError(_0x5eb6ad,null));};exports[_0x76c7('0x4b')]=function(_0x588c17,_0x2253c2,_0x268037){var _0x17ba39={};var _0x205f66={};var _0xf8516;var _0xb10c3f;return db['Dynamics365Configuration'][_0x76c7('0x48')]({'where':{'id':_0x588c17[_0x76c7('0x43')]['id']}})['then'](handleEntityNotFound(_0x2253c2,null))[_0x76c7('0x22')](function(_0x2c8014){if(_0x2c8014){_0xf8516=_0x2c8014;_0x205f66[_0x76c7('0x2c')]=_[_0x76c7('0x2e')](db['Dynamics365Field']['rawAttributes']);_0x205f66[_0x76c7('0x2f')]=_['keys'](_0x588c17[_0x76c7('0x2f')]);_0x205f66['filters']=_[_0x76c7('0x31')](_0x205f66[_0x76c7('0x2c')],_0x205f66[_0x76c7('0x2f')]);_0x17ba39[_0x76c7('0x33')]=_[_0x76c7('0x31')](_0x205f66[_0x76c7('0x2c')],qs[_0x76c7('0x32')](_0x588c17[_0x76c7('0x2f')][_0x76c7('0x32')]));_0x17ba39[_0x76c7('0x33')]=_0x17ba39[_0x76c7('0x33')][_0x76c7('0x34')]?_0x17ba39[_0x76c7('0x33')]:_0x205f66[_0x76c7('0x2c')];_0x17ba39[_0x76c7('0x37')]=qs[_0x76c7('0x38')](_0x588c17[_0x76c7('0x2f')][_0x76c7('0x38')]);_0x17ba39['where']=qs[_0x76c7('0x30')](_[_0x76c7('0x39')](_0x588c17[_0x76c7('0x2f')],_0x205f66[_0x76c7('0x30')]));if(_0x588c17[_0x76c7('0x2f')][_0x76c7('0x3a')]){_0x17ba39['where']=_[_0x76c7('0x3b')](_0x17ba39['where'],{'$or':_[_0x76c7('0x2d')](_0x17ba39[_0x76c7('0x33')],function(_0x247f9b){var _0x15ea39={};_0x15ea39[_0x247f9b]={'$like':'%'+_0x588c17[_0x76c7('0x2f')][_0x76c7('0x3a')]+'%'};return _0x15ea39;})});}_0x17ba39=_['merge']({},_0x17ba39,_0x588c17[_0x76c7('0x3d')]);return _0xf8516[_0x76c7('0x4b')](_0x17ba39);}})[_0x76c7('0x22')](function(_0x2212d2){if(_0x2212d2){_0xb10c3f=_0x2212d2[_0x76c7('0x34')];if(!_0x588c17['query'][_0x76c7('0x35')](_0x76c7('0x36'))){_0x17ba39[_0x76c7('0x1d')]=qs[_0x76c7('0x1d')](_0x588c17['query'][_0x76c7('0x1d')]);_0x17ba39['offset']=qs[_0x76c7('0x1b')](_0x588c17[_0x76c7('0x2f')][_0x76c7('0x1b')]);}return _0xf8516[_0x76c7('0x4b')](_0x17ba39);}})['then'](function(_0x49e6fd){if(_0x49e6fd){return _0x49e6fd?{'count':_0xb10c3f,'rows':_0x49e6fd}:null;}})['then'](respondWithResult(_0x2253c2,null))[_0x76c7('0x41')](handleError(_0x2253c2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 6ecaed3..1864df2 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 _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x5ebee0,_0x115f58){var _0x1ef6b4=function(_0x40819b){while(--_0x40819b){_0x5ebee0['push'](_0x5ebee0['shift']());}};_0x1ef6b4(++_0x115f58);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2b0327,_0x843047){_0x2b0327=_0x2b0327-0x0;var _0x45bf49=_0xb43b[_0x2b0327];return _0x45bf49;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x59e236,_0x126b46){var _0x326120=function(_0x5add5a){while(--_0x5add5a){_0x59e236['push'](_0x59e236['shift']());}};_0x326120(++_0x126b46);}(_0x54ef,0x112));var _0xf54e=function(_0x38b2c2,_0x5209f7){_0x38b2c2=_0x38b2c2-0x0;var _0x5e8e26=_0x54ef[_0x38b2c2];return _0x5e8e26;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index f9cb90b..3954695 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 _0xce29=['result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xce29,0x1a3));var _0x9ce2=function(_0x422e66,_0x21c4b1){_0x422e66=_0x422e66-0x0;var _0x3c7fcc=_0xce29[_0x422e66];return _0x3c7fcc;};'use strict';var _=require(_0x9ce2('0x0'));var util=require(_0x9ce2('0x1'));var moment=require(_0x9ce2('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ce2('0x3'));var fs=require('fs');var Redis=require(_0x9ce2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ce2('0x5'));var logger=require(_0x9ce2('0x6'))(_0x9ce2('0x7'));var config=require(_0x9ce2('0x8'));var jayson=require(_0x9ce2('0x9'));var client=jayson[_0x9ce2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2399f3,_0x4a0eaa,_0x57219e){return new BPromise(function(_0x32deba,_0x515354){return client[_0x9ce2('0xb')](_0x2399f3,_0x57219e)[_0x9ce2('0xc')](function(_0x38465e){logger[_0x9ce2('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4a0eaa,_0x9ce2('0xe'));logger[_0x9ce2('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4a0eaa,_0x9ce2('0xe'),JSON[_0x9ce2('0x10')](_0x38465e));if(_0x38465e['error']){if(_0x38465e[_0x9ce2('0x11')][_0x9ce2('0x12')]===0x1f4){logger[_0x9ce2('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4a0eaa,_0x38465e['error'][_0x9ce2('0x13')]);return _0x515354(_0x38465e['error'][_0x9ce2('0x13')]);}logger[_0x9ce2('0x11')](_0x9ce2('0x14'),_0x4a0eaa,_0x38465e[_0x9ce2('0x11')][_0x9ce2('0x13')]);return _0x32deba(_0x38465e[_0x9ce2('0x11')][_0x9ce2('0x13')]);}else{logger[_0x9ce2('0xd')](_0x9ce2('0x14'),_0x4a0eaa,_0x9ce2('0xe'));_0x32deba(_0x38465e[_0x9ce2('0x15')][_0x9ce2('0x13')]);}})['catch'](function(_0x52c423){logger[_0x9ce2('0x11')](_0x9ce2('0x14'),_0x4a0eaa,_0x52c423);_0x515354(_0x52c423);});});} \ No newline at end of file +var _0xe32e=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x42e06a,_0x2f5fd1){var _0x3d3c90=function(_0xbd9403){while(--_0xbd9403){_0x42e06a['push'](_0x42e06a['shift']());}};_0x3d3c90(++_0x2f5fd1);}(_0xe32e,0x157));var _0xee32=function(_0x140350,_0xe286a3){_0x140350=_0x140350-0x0;var _0x202da7=_0xe32e[_0x140350];return _0x202da7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee32('0x0'));var BPromise=require(_0xee32('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee32('0x2'));var db=require(_0xee32('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xee32('0x4'))('rpc');var config=require(_0xee32('0x5'));var jayson=require(_0xee32('0x6'));var client=jayson[_0xee32('0x7')][_0xee32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f9b14,_0x3ba307,_0x13b93c){return new BPromise(function(_0x1bf828,_0x4c4c6d){return client[_0xee32('0x9')](_0x3f9b14,_0x13b93c)[_0xee32('0xa')](function(_0x4cdebf){logger[_0xee32('0xb')](_0xee32('0xc'),_0x3ba307,_0xee32('0xd'));logger[_0xee32('0xe')](_0xee32('0xf'),_0x3ba307,_0xee32('0xd'),JSON['stringify'](_0x4cdebf));if(_0x4cdebf['error']){if(_0x4cdebf['error'][_0xee32('0x10')]===0x1f4){logger[_0xee32('0x11')](_0xee32('0xc'),_0x3ba307,_0x4cdebf[_0xee32('0x11')][_0xee32('0x12')]);return _0x4c4c6d(_0x4cdebf['error']['message']);}logger[_0xee32('0x11')](_0xee32('0xc'),_0x3ba307,_0x4cdebf[_0xee32('0x11')][_0xee32('0x12')]);return _0x1bf828(_0x4cdebf[_0xee32('0x11')][_0xee32('0x12')]);}else{logger[_0xee32('0xb')](_0xee32('0xc'),_0x3ba307,_0xee32('0xd'));_0x1bf828(_0x4cdebf[_0xee32('0x13')][_0xee32('0x12')]);}})[_0xee32('0x14')](function(_0xc21faa){logger['error'](_0xee32('0xc'),_0x3ba307,_0xc21faa);_0x4c4c6d(_0xc21faa);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 4356412..2b1213a 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 _0x0d0d=['./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x0d0d,0xbe));var _0xd0d0=function(_0x2e1e5e,_0x579929){_0x2e1e5e=_0x2e1e5e-0x0;var _0x14b6a9=_0x0d0d[_0x2e1e5e];return _0x14b6a9;};'use strict';var multer=require(_0xd0d0('0x0'));var util=require(_0xd0d0('0x1'));var path=require(_0xd0d0('0x2'));var timeout=require(_0xd0d0('0x3'));var express=require(_0xd0d0('0x4'));var router=express[_0xd0d0('0x5')]();var fs_extra=require(_0xd0d0('0x6'));var auth=require(_0xd0d0('0x7'));var interaction=require(_0xd0d0('0x8'));var config=require(_0xd0d0('0x9'));var controller=require(_0xd0d0('0xa'));router[_0xd0d0('0xb')]('/',auth['isAuthenticated'](),controller[_0xd0d0('0xc')]);router[_0xd0d0('0xb')](_0xd0d0('0xd'),auth[_0xd0d0('0xe')](),controller[_0xd0d0('0xf')]);router['post']('/',auth[_0xd0d0('0xe')](),controller[_0xd0d0('0x10')]);router['put']('/:id',auth[_0xd0d0('0xe')](),controller['update']);router[_0xd0d0('0x11')](_0xd0d0('0xd'),auth[_0xd0d0('0xe')](),controller[_0xd0d0('0x12')]);module[_0xd0d0('0x13')]=router; \ No newline at end of file +var _0x1cc4=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x45b175,_0x1ae74e){var _0x42748=function(_0x3cc1d4){while(--_0x3cc1d4){_0x45b175['push'](_0x45b175['shift']());}};_0x42748(++_0x1ae74e);}(_0x1cc4,0x99));var _0x41cc=function(_0x46d8b2,_0x3829c4){_0x46d8b2=_0x46d8b2-0x0;var _0x1a351f=_0x1cc4[_0x46d8b2];return _0x1a351f;};'use strict';var multer=require(_0x41cc('0x0'));var util=require(_0x41cc('0x1'));var path=require(_0x41cc('0x2'));var timeout=require(_0x41cc('0x3'));var express=require(_0x41cc('0x4'));var router=express[_0x41cc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x41cc('0x6'));var interaction=require(_0x41cc('0x7'));var config=require(_0x41cc('0x8'));var controller=require(_0x41cc('0x9'));router[_0x41cc('0xa')]('/',auth['isAuthenticated'](),controller[_0x41cc('0xb')]);router[_0x41cc('0xa')](_0x41cc('0xc'),auth[_0x41cc('0xd')](),controller[_0x41cc('0xe')]);router[_0x41cc('0xf')]('/',auth[_0x41cc('0xd')](),controller[_0x41cc('0x10')]);router[_0x41cc('0x11')](_0x41cc('0xc'),auth[_0x41cc('0xd')](),controller[_0x41cc('0x12')]);router[_0x41cc('0x13')]('/:id',auth[_0x41cc('0xd')](),controller[_0x41cc('0x14')]);module[_0x41cc('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 8748ff2..01d45ce 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 _0xf260=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xf260,0xfb));var _0x0f26=function(_0x229fa7,_0xcf12a5){_0x229fa7=_0x229fa7-0x0;var _0x26ee05=_0xf260[_0x229fa7];return _0x26ee05;};'use strict';var Sequelize=require(_0x0f26('0x0'));module[_0x0f26('0x1')]={'type':{'type':Sequelize[_0x0f26('0x2')](_0x0f26('0x3'),_0x0f26('0x4'),_0x0f26('0x5'),_0x0f26('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0f26('0x2')]('string',_0x0f26('0x4'),_0x0f26('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0f26('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0f26('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0f26('0x7')]}}; \ No newline at end of file +var _0x0f73=['picklist','STRING','ENUM','variable','customVariable','exports','string'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0f73,0x6e));var _0x30f7=function(_0x28a09b,_0xa06f7c){_0x28a09b=_0x28a09b-0x0;var _0x3a3b8a=_0x0f73[_0x28a09b];return _0x3a3b8a;};'use strict';var Sequelize=require('sequelize');module[_0x30f7('0x0')]={'type':{'type':Sequelize['ENUM'](_0x30f7('0x1'),'variable','customVariable','keyValue',_0x30f7('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x30f7('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x30f7('0x4')](_0x30f7('0x1'),_0x30f7('0x5'),_0x30f7('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x30f7('0x3')]},'nameField':{'type':Sequelize[_0x30f7('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x30f7('0x3')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 93c7470..cc2d303 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 _0x990e=['offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','status','end','json'];(function(_0x54ccd7,_0x3bc3ce){var _0x4e667b=function(_0xab8fea){while(--_0xab8fea){_0x54ccd7['push'](_0x54ccd7['shift']());}};_0x4e667b(++_0x3bc3ce);}(_0x990e,0x193));var _0xe990=function(_0xbaa2eb,_0x5b51cd){_0xbaa2eb=_0xbaa2eb-0x0;var _0x328ca0=_0x990e[_0xbaa2eb];return _0x328ca0;};'use strict';var emlformat=require(_0xe990('0x0'));var rimraf=require(_0xe990('0x1'));var zipdir=require(_0xe990('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe990('0x3'));var moment=require(_0xe990('0x4'));var BPromise=require(_0xe990('0x5'));var Mustache=require('mustache');var util=require(_0xe990('0x6'));var path=require(_0xe990('0x7'));var sox=require(_0xe990('0x8'));var csv=require(_0xe990('0x9'));var ejs=require(_0xe990('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe990('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe990('0xc'));var deskjs=require(_0xe990('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe990('0xe'));var Papa=require('papaparse');var Redis=require(_0xe990('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe990('0x10'));var as=require(_0xe990('0x11'));var hardwareService=require(_0xe990('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe990('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1558c0,_0x57afe1){_0x57afe1=_0x57afe1||0xcc;return function(_0x1101ec){if(_0x1101ec){return _0x1558c0['sendStatus'](_0x57afe1);}return _0x1558c0[_0xe990('0x14')](_0x57afe1)[_0xe990('0x15')]();};}function respondWithResult(_0x15b87d,_0x375c78){_0x375c78=_0x375c78||0xc8;return function(_0xfd3df5){if(_0xfd3df5){return _0x15b87d[_0xe990('0x14')](_0x375c78)[_0xe990('0x16')](_0xfd3df5);}};}function respondWithFilteredResult(_0x4388af,_0x5f7a72){return function(_0x336534){if(_0x336534){var _0x196353=typeof _0x5f7a72[_0xe990('0x17')]===_0xe990('0x18')&&typeof _0x5f7a72[_0xe990('0x19')]===_0xe990('0x18');var _0x3b5226=_0x336534['count'];var _0xd5093f=_0x196353?0x0:_0x5f7a72[_0xe990('0x17')];var _0xe9c4e8=_0x196353?_0x336534[_0xe990('0x1a')]:_0x5f7a72[_0xe990('0x17')]+_0x5f7a72['limit'];var _0x433384;if(_0xe9c4e8>=_0x3b5226){_0xe9c4e8=_0x3b5226;_0x433384=0xc8;}else{_0x433384=0xce;}_0x4388af[_0xe990('0x14')](_0x433384);return _0x4388af[_0xe990('0x1b')]('Content-Range',_0xd5093f+'-'+_0xe9c4e8+'/'+_0x3b5226)[_0xe990('0x16')](_0x336534);}return null;};}function patchUpdates(_0x55faad){return function(_0x5ac4d6){try{jsonpatch[_0xe990('0x1c')](_0x5ac4d6,_0x55faad,!![]);}catch(_0x5320db){return BPromise[_0xe990('0x1d')](_0x5320db);}return _0x5ac4d6[_0xe990('0x1e')]();};}function saveUpdates(_0xfa5e6b,_0x129231){return function(_0x350cf1){if(_0x350cf1){return _0x350cf1[_0xe990('0x1f')](_0xfa5e6b)[_0xe990('0x20')](function(_0x2e755e){return _0x2e755e;});}return null;};}function removeEntity(_0x488d26,_0x337ae8){return function(_0x2d3f22){if(_0x2d3f22){return _0x2d3f22['destroy']()[_0xe990('0x20')](function(){_0x488d26['status'](0xcc)[_0xe990('0x15')]();});}};}function handleEntityNotFound(_0x91521e,_0xd99802){return function(_0x4d2442){if(!_0x4d2442){_0x91521e[_0xe990('0x21')](0x194);}return _0x4d2442;};}function handleError(_0x290770,_0x1840be){_0x1840be=_0x1840be||0x1f4;return function(_0x134a1b){logger['error'](_0x134a1b[_0xe990('0x22')]);if(_0x134a1b[_0xe990('0x23')]){delete _0x134a1b[_0xe990('0x23')];}_0x290770[_0xe990('0x14')](_0x1840be)[_0xe990('0x24')](_0x134a1b);};}exports[_0xe990('0x25')]=function(_0x191fe0,_0x1901fe){var _0x31cc35={},_0x38b1be={},_0x2e58bb={'count':0x0,'rows':[]};var _0x457b44=_[_0xe990('0x26')](db[_0xe990('0x27')][_0xe990('0x28')],function(_0x419386){return{'name':_0x419386[_0xe990('0x29')],'type':_0x419386[_0xe990('0x2a')][_0xe990('0x2b')]};});_0x38b1be[_0xe990('0x2c')]=_[_0xe990('0x26')](_0x457b44,'name');_0x38b1be[_0xe990('0x2d')]=_['keys'](_0x191fe0[_0xe990('0x2d')]);_0x38b1be[_0xe990('0x2e')]=_[_0xe990('0x2f')](_0x38b1be[_0xe990('0x2c')],_0x38b1be[_0xe990('0x2d')]);_0x31cc35[_0xe990('0x30')]=_[_0xe990('0x2f')](_0x38b1be[_0xe990('0x2c')],qs['fields'](_0x191fe0[_0xe990('0x2d')][_0xe990('0x31')]));_0x31cc35[_0xe990('0x30')]=_0x31cc35['attributes']['length']?_0x31cc35[_0xe990('0x30')]:_0x38b1be[_0xe990('0x2c')];if(!_0x191fe0[_0xe990('0x2d')][_0xe990('0x32')]('nolimit')){_0x31cc35['limit']=qs['limit'](_0x191fe0['query'][_0xe990('0x19')]);_0x31cc35[_0xe990('0x17')]=qs['offset'](_0x191fe0[_0xe990('0x2d')][_0xe990('0x17')]);}_0x31cc35[_0xe990('0x33')]=qs[_0xe990('0x34')](_0x191fe0[_0xe990('0x2d')]['sort']);_0x31cc35[_0xe990('0x35')]=qs[_0xe990('0x2e')](_['pick'](_0x191fe0['query'],_0x38b1be[_0xe990('0x2e')]),_0x457b44);if(_0x191fe0['query']['filter']){_0x31cc35['where']=_[_0xe990('0x36')](_0x31cc35['where'],{'$or':_['map'](_0x457b44,function(_0x41bc89){if(_0x41bc89[_0xe990('0x2a')]!==_0xe990('0x37')){var _0x3196bc={};_0x3196bc[_0x41bc89['name']]={'$like':'%'+_0x191fe0[_0xe990('0x2d')][_0xe990('0x38')]+'%'};return _0x3196bc;}})});}_0x31cc35=_[_0xe990('0x36')]({},_0x31cc35,_0x191fe0[_0xe990('0x39')]);var _0x2379bd={'where':_0x31cc35['where']};return db[_0xe990('0x27')][_0xe990('0x1a')](_0x2379bd)[_0xe990('0x20')](function(_0x3ecfa5){_0x2e58bb[_0xe990('0x1a')]=_0x3ecfa5;if(_0x191fe0[_0xe990('0x2d')][_0xe990('0x3a')]){_0x31cc35[_0xe990('0x3b')]=[{'all':!![]}];}return db[_0xe990('0x27')][_0xe990('0x3c')](_0x31cc35);})[_0xe990('0x20')](function(_0x41ed27){_0x2e58bb[_0xe990('0x3d')]=_0x41ed27;return _0x2e58bb;})[_0xe990('0x20')](respondWithFilteredResult(_0x1901fe,_0x31cc35))[_0xe990('0x3e')](handleError(_0x1901fe,null));};exports[_0xe990('0x3f')]=function(_0xb4dfd6,_0x589d46){var _0x290df5={'raw':!![],'where':{'id':_0xb4dfd6[_0xe990('0x40')]['id']}},_0x496eb2={};_0x496eb2['model']=_[_0xe990('0x41')](db['Dynamics365Field'][_0xe990('0x28')]);_0x496eb2[_0xe990('0x2d')]=_['keys'](_0xb4dfd6[_0xe990('0x2d')]);_0x496eb2[_0xe990('0x2e')]=_[_0xe990('0x2f')](_0x496eb2['model'],_0x496eb2['query']);_0x290df5[_0xe990('0x30')]=_['intersection'](_0x496eb2[_0xe990('0x2c')],qs['fields'](_0xb4dfd6['query']['fields']));_0x290df5['attributes']=_0x290df5['attributes'][_0xe990('0x42')]?_0x290df5[_0xe990('0x30')]:_0x496eb2[_0xe990('0x2c')];if(_0xb4dfd6[_0xe990('0x2d')][_0xe990('0x3a')]){_0x290df5[_0xe990('0x3b')]=[{'all':!![]}];}_0x290df5=_[_0xe990('0x36')]({},_0x290df5,_0xb4dfd6[_0xe990('0x39')]);return db[_0xe990('0x27')][_0xe990('0x43')](_0x290df5)['then'](handleEntityNotFound(_0x589d46,null))[_0xe990('0x20')](respondWithResult(_0x589d46,null))[_0xe990('0x3e')](handleError(_0x589d46,null));};exports[_0xe990('0x44')]=function(_0x5283de,_0x28d8e7){return db[_0xe990('0x27')][_0xe990('0x44')](_0x5283de['body'],{})[_0xe990('0x20')](respondWithResult(_0x28d8e7,0xc9))[_0xe990('0x3e')](handleError(_0x28d8e7,null));};exports[_0xe990('0x1f')]=function(_0x2bf062,_0xc7dd4b){if(_0x2bf062['body']['id']){delete _0x2bf062['body']['id'];}return db[_0xe990('0x27')][_0xe990('0x43')]({'where':{'id':_0x2bf062[_0xe990('0x40')]['id']}})[_0xe990('0x20')](handleEntityNotFound(_0xc7dd4b,null))[_0xe990('0x20')](saveUpdates(_0x2bf062[_0xe990('0x45')],null))['then'](respondWithResult(_0xc7dd4b,null))[_0xe990('0x3e')](handleError(_0xc7dd4b,null));};exports[_0xe990('0x46')]=function(_0x354c0f,_0x39ca31){return db[_0xe990('0x27')][_0xe990('0x43')]({'where':{'id':_0x354c0f[_0xe990('0x40')]['id']}})['then'](handleEntityNotFound(_0x39ca31,null))[_0xe990('0x20')](removeEntity(_0x39ca31,null))[_0xe990('0x3e')](handleError(_0x39ca31,null));}; \ No newline at end of file +var _0x15b7=['offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','Dynamics365Field','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','body','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x215ca2,_0x496fd2){var _0x1683c4=function(_0x476bfb){while(--_0x476bfb){_0x215ca2['push'](_0x215ca2['shift']());}};_0x1683c4(++_0x496fd2);}(_0x15b7,0x19b));var _0x715b=function(_0x30ecc4,_0x20ce11){_0x30ecc4=_0x30ecc4-0x0;var _0xe7e5ad=_0x15b7[_0x30ecc4];return _0xe7e5ad;};'use strict';var emlformat=require(_0x715b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x715b('0x1'));var moment=require(_0x715b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x715b('0x3'));var util=require(_0x715b('0x4'));var path=require(_0x715b('0x5'));var sox=require(_0x715b('0x6'));var csv=require(_0x715b('0x7'));var ejs=require(_0x715b('0x8'));var fs=require('fs');var fs_extra=require(_0x715b('0x9'));var _=require(_0x715b('0xa'));var squel=require(_0x715b('0xb'));var crypto=require(_0x715b('0xc'));var jsforce=require(_0x715b('0xd'));var deskjs=require(_0x715b('0xe'));var toCsv=require(_0x715b('0x7'));var querystring=require('querystring');var Papa=require(_0x715b('0xf'));var Redis=require(_0x715b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x715b('0x11'));var as=require(_0x715b('0x12'));var hardwareService=require(_0x715b('0x13'));var logger=require(_0x715b('0x14'))(_0x715b('0x15'));var utils=require(_0x715b('0x16'));var config=require(_0x715b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x715b('0x18'))['db'];function respondWithStatusCode(_0x7c6ee7,_0x5d5fc3){_0x5d5fc3=_0x5d5fc3||0xcc;return function(_0x5e3bc7){if(_0x5e3bc7){return _0x7c6ee7[_0x715b('0x19')](_0x5d5fc3);}return _0x7c6ee7[_0x715b('0x1a')](_0x5d5fc3)['end']();};}function respondWithResult(_0xddf7e1,_0x44fa7d){_0x44fa7d=_0x44fa7d||0xc8;return function(_0x2cb908){if(_0x2cb908){return _0xddf7e1[_0x715b('0x1a')](_0x44fa7d)['json'](_0x2cb908);}};}function respondWithFilteredResult(_0x13f516,_0x443cda){return function(_0x24bc11){if(_0x24bc11){var _0x3f8dae=typeof _0x443cda[_0x715b('0x1b')]==='undefined'&&typeof _0x443cda[_0x715b('0x1c')]===_0x715b('0x1d');var _0x5aaa9c=_0x24bc11['count'];var _0xfb497f=_0x3f8dae?0x0:_0x443cda[_0x715b('0x1b')];var _0x584156=_0x3f8dae?_0x24bc11[_0x715b('0x1e')]:_0x443cda['offset']+_0x443cda['limit'];var _0x26a1de;if(_0x584156>=_0x5aaa9c){_0x584156=_0x5aaa9c;_0x26a1de=0xc8;}else{_0x26a1de=0xce;}_0x13f516[_0x715b('0x1a')](_0x26a1de);return _0x13f516[_0x715b('0x1f')](_0x715b('0x20'),_0xfb497f+'-'+_0x584156+'/'+_0x5aaa9c)[_0x715b('0x21')](_0x24bc11);}return null;};}function patchUpdates(_0x339ba8){return function(_0x2f243f){try{jsonpatch['apply'](_0x2f243f,_0x339ba8,!![]);}catch(_0x17607c){return BPromise[_0x715b('0x22')](_0x17607c);}return _0x2f243f[_0x715b('0x23')]();};}function saveUpdates(_0x3bd32c,_0x20e0d5){return function(_0xb89876){if(_0xb89876){return _0xb89876[_0x715b('0x24')](_0x3bd32c)[_0x715b('0x25')](function(_0x12c0e5){return _0x12c0e5;});}return null;};}function removeEntity(_0x318978,_0x29ba55){return function(_0x521998){if(_0x521998){return _0x521998[_0x715b('0x26')]()[_0x715b('0x25')](function(){_0x318978[_0x715b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b0840,_0x38cc6c){return function(_0x3b44a5){if(!_0x3b44a5){_0x4b0840[_0x715b('0x19')](0x194);}return _0x3b44a5;};}function handleError(_0x4a5e98,_0x3d8d17){_0x3d8d17=_0x3d8d17||0x1f4;return function(_0x424c7e){logger['error'](_0x424c7e[_0x715b('0x27')]);if(_0x424c7e[_0x715b('0x28')]){delete _0x424c7e[_0x715b('0x28')];}_0x4a5e98[_0x715b('0x1a')](_0x3d8d17)[_0x715b('0x29')](_0x424c7e);};}exports['index']=function(_0x53e477,_0x15b5e0){var _0x35c101={},_0x21091c={},_0x2c96c1={'count':0x0,'rows':[]};var _0x4b16b6=_['map'](db[_0x715b('0x2a')][_0x715b('0x2b')],function(_0x806845){return{'name':_0x806845[_0x715b('0x2c')],'type':_0x806845[_0x715b('0x2d')]['key']};});_0x21091c[_0x715b('0x2e')]=_[_0x715b('0x2f')](_0x4b16b6,'name');_0x21091c['query']=_[_0x715b('0x30')](_0x53e477['query']);_0x21091c[_0x715b('0x31')]=_[_0x715b('0x32')](_0x21091c['model'],_0x21091c[_0x715b('0x33')]);_0x35c101[_0x715b('0x34')]=_[_0x715b('0x32')](_0x21091c[_0x715b('0x2e')],qs[_0x715b('0x35')](_0x53e477['query']['fields']));_0x35c101[_0x715b('0x34')]=_0x35c101[_0x715b('0x34')][_0x715b('0x36')]?_0x35c101['attributes']:_0x21091c['model'];if(!_0x53e477[_0x715b('0x33')][_0x715b('0x37')](_0x715b('0x38'))){_0x35c101['limit']=qs['limit'](_0x53e477[_0x715b('0x33')][_0x715b('0x1c')]);_0x35c101[_0x715b('0x1b')]=qs[_0x715b('0x1b')](_0x53e477[_0x715b('0x33')][_0x715b('0x1b')]);}_0x35c101[_0x715b('0x39')]=qs['sort'](_0x53e477[_0x715b('0x33')][_0x715b('0x3a')]);_0x35c101[_0x715b('0x3b')]=qs[_0x715b('0x31')](_[_0x715b('0x3c')](_0x53e477[_0x715b('0x33')],_0x21091c[_0x715b('0x31')]),_0x4b16b6);if(_0x53e477[_0x715b('0x33')][_0x715b('0x3d')]){_0x35c101['where']=_[_0x715b('0x3e')](_0x35c101[_0x715b('0x3b')],{'$or':_[_0x715b('0x2f')](_0x4b16b6,function(_0x134812){if(_0x134812[_0x715b('0x2d')]!==_0x715b('0x3f')){var _0xd2853={};_0xd2853[_0x134812[_0x715b('0x28')]]={'$like':'%'+_0x53e477[_0x715b('0x33')][_0x715b('0x3d')]+'%'};return _0xd2853;}})});}_0x35c101=_['merge']({},_0x35c101,_0x53e477[_0x715b('0x40')]);var _0x45c79d={'where':_0x35c101[_0x715b('0x3b')]};return db[_0x715b('0x2a')]['count'](_0x45c79d)[_0x715b('0x25')](function(_0x3cd9d5){_0x2c96c1[_0x715b('0x1e')]=_0x3cd9d5;if(_0x53e477[_0x715b('0x33')][_0x715b('0x41')]){_0x35c101['include']=[{'all':!![]}];}return db[_0x715b('0x2a')]['findAll'](_0x35c101);})[_0x715b('0x25')](function(_0x1e9049){_0x2c96c1[_0x715b('0x42')]=_0x1e9049;return _0x2c96c1;})[_0x715b('0x25')](respondWithFilteredResult(_0x15b5e0,_0x35c101))[_0x715b('0x43')](handleError(_0x15b5e0,null));};exports[_0x715b('0x44')]=function(_0x4ef40d,_0x4305c5){var _0x5d274f={'raw':!![],'where':{'id':_0x4ef40d[_0x715b('0x45')]['id']}},_0x4e9f95={};_0x4e9f95['model']=_['keys'](db['Dynamics365Field'][_0x715b('0x2b')]);_0x4e9f95['query']=_[_0x715b('0x30')](_0x4ef40d[_0x715b('0x33')]);_0x4e9f95[_0x715b('0x31')]=_[_0x715b('0x32')](_0x4e9f95['model'],_0x4e9f95[_0x715b('0x33')]);_0x5d274f['attributes']=_[_0x715b('0x32')](_0x4e9f95['model'],qs[_0x715b('0x35')](_0x4ef40d[_0x715b('0x33')][_0x715b('0x35')]));_0x5d274f[_0x715b('0x34')]=_0x5d274f['attributes'][_0x715b('0x36')]?_0x5d274f[_0x715b('0x34')]:_0x4e9f95[_0x715b('0x2e')];if(_0x4ef40d[_0x715b('0x33')][_0x715b('0x41')]){_0x5d274f[_0x715b('0x46')]=[{'all':!![]}];}_0x5d274f=_[_0x715b('0x3e')]({},_0x5d274f,_0x4ef40d[_0x715b('0x40')]);return db[_0x715b('0x2a')][_0x715b('0x47')](_0x5d274f)['then'](handleEntityNotFound(_0x4305c5,null))[_0x715b('0x25')](respondWithResult(_0x4305c5,null))[_0x715b('0x43')](handleError(_0x4305c5,null));};exports['create']=function(_0xb78c9d,_0x4cca7d){return db[_0x715b('0x2a')]['create'](_0xb78c9d[_0x715b('0x48')],{})['then'](respondWithResult(_0x4cca7d,0xc9))[_0x715b('0x43')](handleError(_0x4cca7d,null));};exports['update']=function(_0x255a0b,_0x2c45d9){if(_0x255a0b[_0x715b('0x48')]['id']){delete _0x255a0b[_0x715b('0x48')]['id'];}return db[_0x715b('0x2a')][_0x715b('0x47')]({'where':{'id':_0x255a0b[_0x715b('0x45')]['id']}})[_0x715b('0x25')](handleEntityNotFound(_0x2c45d9,null))[_0x715b('0x25')](saveUpdates(_0x255a0b[_0x715b('0x48')],null))[_0x715b('0x25')](respondWithResult(_0x2c45d9,null))[_0x715b('0x43')](handleError(_0x2c45d9,null));};exports[_0x715b('0x26')]=function(_0x384fbf,_0x2bbef7){return db[_0x715b('0x2a')][_0x715b('0x47')]({'where':{'id':_0x384fbf['params']['id']}})[_0x715b('0x25')](handleEntityNotFound(_0x2bbef7,null))['then'](removeEntity(_0x2bbef7,null))[_0x715b('0x43')](handleError(_0x2bbef7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d6841cd..ad3d227 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 _0x5762=['lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0x5762,0x8c));var _0x2576=function(_0x1f2941,_0x3544ce){_0x1f2941=_0x1f2941-0x0;var _0x31e313=_0x5762[_0x1f2941];return _0x31e313;};'use strict';var _=require(_0x2576('0x0'));var util=require(_0x2576('0x1'));var logger=require('../../config/logger')(_0x2576('0x2'));var moment=require('moment');var BPromise=require(_0x2576('0x3'));var rp=require(_0x2576('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2576('0x5'));var config=require(_0x2576('0x6'));var attributes=require(_0x2576('0x7'));module[_0x2576('0x8')]=function(_0x468c93,_0x482ed9){return _0x468c93[_0x2576('0x9')](_0x2576('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x2576('0xb'),'fields':[_0x2576('0xc'),_0x2576('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x135a=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','api','request-promise','rimraf','./intDynamics365Field.attributes','exports'];(function(_0x27b089,_0x4b9a50){var _0x16f0f4=function(_0x730ed7){while(--_0x730ed7){_0x27b089['push'](_0x27b089['shift']());}};_0x16f0f4(++_0x4b9a50);}(_0x135a,0x7b));var _0xa135=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x135a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xa135('0x0'));var util=require(_0xa135('0x1'));var logger=require('../../config/logger')(_0xa135('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa135('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa135('0x4'));var config=require('../../config/environment');var attributes=require(_0xa135('0x5'));module[_0xa135('0x6')]=function(_0x37c48e,_0x1c89fd){return _0x37c48e[_0xa135('0x7')](_0xa135('0x8'),attributes,{'tableName':_0xa135('0x9'),'paranoid':![],'indexes':[{'name':_0xa135('0xa'),'fields':[_0xa135('0xb'),_0xa135('0xc')],'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 c53e5da..e30da31 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 _0x581d=['then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Field,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3654ac,_0x5145c4){var _0x58eb14=function(_0x398b1b){while(--_0x398b1b){_0x3654ac['push'](_0x3654ac['shift']());}};_0x58eb14(++_0x5145c4);}(_0x581d,0x15a));var _0xd581=function(_0x46fbea,_0x10028a){_0x46fbea=_0x46fbea-0x0;var _0x517110=_0x581d[_0x46fbea];return _0x517110;};'use strict';var _=require(_0xd581('0x0'));var util=require(_0xd581('0x1'));var moment=require(_0xd581('0x2'));var BPromise=require('bluebird');var rs=require(_0xd581('0x3'));var fs=require('fs');var Redis=require(_0xd581('0x4'));var db=require(_0xd581('0x5'))['db'];var utils=require(_0xd581('0x6'));var logger=require(_0xd581('0x7'))(_0xd581('0x8'));var config=require(_0xd581('0x9'));var jayson=require(_0xd581('0xa'));var client=jayson[_0xd581('0xb')][_0xd581('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49905d,_0x1cf5c8,_0xb53dee){return new BPromise(function(_0x40b735,_0x16f37c){return client[_0xd581('0xd')](_0x49905d,_0xb53dee)[_0xd581('0xe')](function(_0x316f6b){logger[_0xd581('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x1cf5c8,_0xd581('0x10'));logger['debug'](_0xd581('0x11'),_0x1cf5c8,_0xd581('0x10'),JSON[_0xd581('0x12')](_0x316f6b));if(_0x316f6b[_0xd581('0x13')]){if(_0x316f6b['error'][_0xd581('0x14')]===0x1f4){logger[_0xd581('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x1cf5c8,_0x316f6b[_0xd581('0x13')]['message']);return _0x16f37c(_0x316f6b['error'][_0xd581('0x15')]);}logger[_0xd581('0x13')](_0xd581('0x16'),_0x1cf5c8,_0x316f6b[_0xd581('0x13')][_0xd581('0x15')]);return _0x40b735(_0x316f6b[_0xd581('0x13')]['message']);}else{logger[_0xd581('0xf')](_0xd581('0x16'),_0x1cf5c8,'request\x20sent');_0x40b735(_0x316f6b['result']['message']);}})[_0xd581('0x17')](function(_0x143ae4){logger[_0xd581('0x13')](_0xd581('0x16'),_0x1cf5c8,_0x143ae4);_0x16f37c(_0x143ae4);});});} \ No newline at end of file +var _0xafc1=['jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xafc1,0x9e));var _0x1afc=function(_0x1dfd01,_0x4c3e0b){_0x1dfd01=_0x1dfd01-0x0;var _0x25e63c=_0xafc1[_0x1dfd01];return _0x25e63c;};'use strict';var _=require(_0x1afc('0x0'));var util=require(_0x1afc('0x1'));var moment=require(_0x1afc('0x2'));var BPromise=require(_0x1afc('0x3'));var rs=require(_0x1afc('0x4'));var fs=require('fs');var Redis=require(_0x1afc('0x5'));var db=require(_0x1afc('0x6'))['db'];var utils=require(_0x1afc('0x7'));var logger=require('../../config/logger')(_0x1afc('0x8'));var config=require(_0x1afc('0x9'));var jayson=require(_0x1afc('0xa'));var client=jayson[_0x1afc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bcf3d,_0x8dac69,_0x5567e9){return new BPromise(function(_0x354148,_0x4b4c8f){return client[_0x1afc('0xc')](_0x2bcf3d,_0x5567e9)[_0x1afc('0xd')](function(_0x12c8b4){logger[_0x1afc('0xe')](_0x1afc('0xf'),_0x8dac69,'request\x20sent');logger[_0x1afc('0x10')](_0x1afc('0x11'),_0x8dac69,_0x1afc('0x12'),JSON[_0x1afc('0x13')](_0x12c8b4));if(_0x12c8b4[_0x1afc('0x14')]){if(_0x12c8b4[_0x1afc('0x14')]['code']===0x1f4){logger[_0x1afc('0x14')](_0x1afc('0xf'),_0x8dac69,_0x12c8b4[_0x1afc('0x14')]['message']);return _0x4b4c8f(_0x12c8b4[_0x1afc('0x14')]['message']);}logger[_0x1afc('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x8dac69,_0x12c8b4[_0x1afc('0x14')][_0x1afc('0x15')]);return _0x354148(_0x12c8b4[_0x1afc('0x14')][_0x1afc('0x15')]);}else{logger['info'](_0x1afc('0xf'),_0x8dac69,_0x1afc('0x12'));_0x354148(_0x12c8b4[_0x1afc('0x16')]['message']);}})[_0x1afc('0x17')](function(_0xef1b96){logger[_0x1afc('0x14')](_0x1afc('0xf'),_0x8dac69,_0xef1b96);_0x4b4c8f(_0xef1b96);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 66bd10d..f31224d 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 _0xd448=['/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get'];(function(_0x443736,_0xf53446){var _0x13a564=function(_0x24b342){while(--_0x24b342){_0x443736['push'](_0x443736['shift']());}};_0x13a564(++_0xf53446);}(_0xd448,0x1c6));var _0x8d44=function(_0x30553f,_0x4b2836){_0x30553f=_0x30553f-0x0;var _0x214c32=_0xd448[_0x30553f];return _0x214c32;};'use strict';var multer=require(_0x8d44('0x0'));var util=require(_0x8d44('0x1'));var path=require(_0x8d44('0x2'));var timeout=require(_0x8d44('0x3'));var express=require(_0x8d44('0x4'));var router=express[_0x8d44('0x5')]();var fs_extra=require(_0x8d44('0x6'));var auth=require(_0x8d44('0x7'));var interaction=require(_0x8d44('0x8'));var config=require(_0x8d44('0x9'));var controller=require(_0x8d44('0xa'));router['get']('/',auth[_0x8d44('0xb')](),controller[_0x8d44('0xc')]);router[_0x8d44('0xd')](_0x8d44('0xe'),auth[_0x8d44('0xb')](),controller[_0x8d44('0xf')]);router[_0x8d44('0xd')](_0x8d44('0x10'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x8d44('0xd')](_0x8d44('0x11'),auth[_0x8d44('0xb')](),controller[_0x8d44('0x12')]);router[_0x8d44('0x13')]('/',auth[_0x8d44('0xb')](),controller[_0x8d44('0x14')]);router[_0x8d44('0x13')](_0x8d44('0x10'),auth[_0x8d44('0xb')](),controller[_0x8d44('0x15')]);router[_0x8d44('0x16')](_0x8d44('0xe'),auth[_0x8d44('0xb')](),controller[_0x8d44('0x17')]);router[_0x8d44('0x18')](_0x8d44('0xe'),auth[_0x8d44('0xb')](),controller[_0x8d44('0x19')]);module['exports']=router; \ No newline at end of file +var _0x40bd=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x40bd,0x11f));var _0xd40b=function(_0x17da88,_0x4f8dc3){_0x17da88=_0x17da88-0x0;var _0x3d79da=_0x40bd[_0x17da88];return _0x3d79da;};'use strict';var multer=require(_0xd40b('0x0'));var util=require(_0xd40b('0x1'));var path=require(_0xd40b('0x2'));var timeout=require('connect-timeout');var express=require(_0xd40b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd40b('0x4'));var interaction=require(_0xd40b('0x5'));var config=require(_0xd40b('0x6'));var controller=require(_0xd40b('0x7'));router[_0xd40b('0x8')]('/',auth[_0xd40b('0x9')](),controller[_0xd40b('0xa')]);router[_0xd40b('0x8')](_0xd40b('0xb'),auth[_0xd40b('0x9')](),controller['show']);router[_0xd40b('0x8')](_0xd40b('0xc'),auth['isAuthenticated'](),controller[_0xd40b('0xd')]);router[_0xd40b('0x8')](_0xd40b('0xe'),auth[_0xd40b('0x9')](),controller[_0xd40b('0xf')]);router[_0xd40b('0x10')]('/',auth[_0xd40b('0x9')](),controller[_0xd40b('0x11')]);router[_0xd40b('0x10')]('/:id/configurations',auth[_0xd40b('0x9')](),controller[_0xd40b('0x12')]);router[_0xd40b('0x13')](_0xd40b('0xb'),auth[_0xd40b('0x9')](),controller[_0xd40b('0x14')]);router[_0xd40b('0x15')]('/:id',auth[_0xd40b('0x9')](),controller[_0xd40b('0x16')]);module[_0xd40b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 800f6c1..b810cb3 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 _0x7708=['sequelize','exports','STRING','remoteUri'];(function(_0x8d5399,_0x96775a){var _0x2d0ddb=function(_0x384dd3){while(--_0x384dd3){_0x8d5399['push'](_0x8d5399['shift']());}};_0x2d0ddb(++_0x96775a);}(_0x7708,0x188));var _0x8770=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x7708[_0x120bc2];return _0x454a41;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8770('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8770('0x3')},'serverUrl':{'type':Sequelize[_0x8770('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x02ce=['sequelize','exports','STRING','remoteUri'];(function(_0x3b56c5,_0x6baa9c){var _0x56f312=function(_0x24412d){while(--_0x24412d){_0x3b56c5['push'](_0x3b56c5['shift']());}};_0x56f312(++_0x6baa9c);}(_0x02ce,0x1ac));var _0xe02c=function(_0x35d4e8,_0x1bedde){_0x35d4e8=_0x35d4e8-0x0;var _0x472d58=_0x02ce[_0x35d4e8];return _0x472d58;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'serverUrl':{'type':Sequelize[_0xe02c('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 a40277e..cd29f0e 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 _0xbc8b=['base64','requester','subject','agent','group','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','rows','catch','params','include','create','body','find','FreshdeskConfiguration','pick','getConfigurations','findOne','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString'];(function(_0x391d9e,_0x1650f9){var _0x2f1c0c=function(_0xb4f387){while(--_0xb4f387){_0x391d9e['push'](_0x391d9e['shift']());}};_0x2f1c0c(++_0x1650f9);}(_0xbc8b,0x16b));var _0xbbc8=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xbc8b[_0xbb091];return _0x467a04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbc8('0x1'));var rp=require(_0xbbc8('0x2'));var moment=require(_0xbbc8('0x3'));var BPromise=require(_0xbbc8('0x4'));var Mustache=require(_0xbbc8('0x5'));var util=require(_0xbbc8('0x6'));var path=require('path');var sox=require(_0xbbc8('0x7'));var csv=require(_0xbbc8('0x8'));var ejs=require(_0xbbc8('0x9'));var fs=require('fs');var fs_extra=require(_0xbbc8('0xa'));var _=require(_0xbbc8('0xb'));var squel=require('squel');var crypto=require(_0xbbc8('0xc'));var jsforce=require(_0xbbc8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbbc8('0x8'));var querystring=require(_0xbbc8('0xe'));var Papa=require(_0xbbc8('0xf'));var Redis=require(_0xbbc8('0x10'));var authService=require(_0xbbc8('0x11'));var qs=require(_0xbbc8('0x12'));var as=require(_0xbbc8('0x13'));var hardwareService=require(_0xbbc8('0x14'));var logger=require(_0xbbc8('0x15'))(_0xbbc8('0x16'));var utils=require(_0xbbc8('0x17'));var config=require(_0xbbc8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbc8('0x19'))['db'];var integrations=require(_0xbbc8('0x1a'));function respondWithStatusCode(_0x1c4b00,_0x55b386){_0x55b386=_0x55b386||0xcc;return function(_0x5b4b1b){if(_0x5b4b1b){return _0x1c4b00[_0xbbc8('0x1b')](_0x55b386);}return _0x1c4b00['status'](_0x55b386)[_0xbbc8('0x1c')]();};}function respondWithResult(_0x2add43,_0x1c76df){_0x1c76df=_0x1c76df||0xc8;return function(_0x1126c7){if(_0x1126c7){return _0x2add43[_0xbbc8('0x1d')](_0x1c76df)[_0xbbc8('0x1e')](_0x1126c7);}};}function respondWithFilteredResult(_0x292cc2,_0x1cd58e){return function(_0x38bf2f){if(_0x38bf2f){var _0x20e656=typeof _0x1cd58e[_0xbbc8('0x1f')]===_0xbbc8('0x20')&&typeof _0x1cd58e[_0xbbc8('0x21')]===_0xbbc8('0x20');var _0x5b070e=_0x38bf2f[_0xbbc8('0x22')];var _0x218cae=_0x20e656?0x0:_0x1cd58e[_0xbbc8('0x1f')];var _0x291abf=_0x20e656?_0x38bf2f['count']:_0x1cd58e[_0xbbc8('0x1f')]+_0x1cd58e['limit'];var _0xc5ea1e;if(_0x291abf>=_0x5b070e){_0x291abf=_0x5b070e;_0xc5ea1e=0xc8;}else{_0xc5ea1e=0xce;}_0x292cc2[_0xbbc8('0x1d')](_0xc5ea1e);return _0x292cc2['set'](_0xbbc8('0x23'),_0x218cae+'-'+_0x291abf+'/'+_0x5b070e)[_0xbbc8('0x1e')](_0x38bf2f);}return null;};}function patchUpdates(_0x14b069){return function(_0x283526){try{jsonpatch[_0xbbc8('0x24')](_0x283526,_0x14b069,!![]);}catch(_0x35391d){return BPromise[_0xbbc8('0x25')](_0x35391d);}return _0x283526['save']();};}function saveUpdates(_0x14af5b,_0x5a1e00){return function(_0x80fb90){if(_0x80fb90){return _0x80fb90[_0xbbc8('0x26')](_0x14af5b)[_0xbbc8('0x27')](function(_0x37acb1){return _0x37acb1;});}return null;};}function removeEntity(_0x354312,_0x521c11){return function(_0xd3200c){if(_0xd3200c){return _0xd3200c[_0xbbc8('0x28')]()['then'](function(){_0x354312['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ee2dd,_0x31fc9b){return function(_0xe6be9d){if(!_0xe6be9d){_0x2ee2dd[_0xbbc8('0x1b')](0x194);}return _0xe6be9d;};}function handleError(_0x1a0129,_0x15fd05){_0x15fd05=_0x15fd05||0x1f4;return function(_0x407acd){logger[_0xbbc8('0x29')](_0x407acd['stack']);if(_0x407acd[_0xbbc8('0x2a')]){delete _0x407acd[_0xbbc8('0x2a')];}_0x1a0129[_0xbbc8('0x1d')](_0x15fd05)['send'](_0x407acd);};}exports[_0xbbc8('0x2b')]=function(_0x239e64,_0x4b0e0c){var _0x130758={},_0x56ce6b={},_0x57cc7e={'count':0x0,'rows':[]};var _0x2939f8=_[_0xbbc8('0x2c')](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')],function(_0x24ec93){return{'name':_0x24ec93[_0xbbc8('0x2f')],'type':_0x24ec93['type']['key']};});_0x56ce6b[_0xbbc8('0x30')]=_[_0xbbc8('0x2c')](_0x2939f8,_0xbbc8('0x2a'));_0x56ce6b['query']=_[_0xbbc8('0x31')](_0x239e64[_0xbbc8('0x32')]);_0x56ce6b[_0xbbc8('0x33')]=_[_0xbbc8('0x34')](_0x56ce6b[_0xbbc8('0x30')],_0x56ce6b[_0xbbc8('0x32')]);_0x130758[_0xbbc8('0x35')]=_[_0xbbc8('0x34')](_0x56ce6b[_0xbbc8('0x30')],qs[_0xbbc8('0x36')](_0x239e64[_0xbbc8('0x32')]['fields']));_0x130758[_0xbbc8('0x35')]=_0x130758[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x130758[_0xbbc8('0x35')]:_0x56ce6b[_0xbbc8('0x30')];if(!_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x38')](_0xbbc8('0x39'))){_0x130758[_0xbbc8('0x21')]=qs[_0xbbc8('0x21')](_0x239e64['query'][_0xbbc8('0x21')]);_0x130758[_0xbbc8('0x1f')]=qs[_0xbbc8('0x1f')](_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x1f')]);}_0x130758[_0xbbc8('0x3a')]=qs['sort'](_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x3b')]);_0x130758[_0xbbc8('0x3c')]=qs[_0xbbc8('0x33')](_['pick'](_0x239e64[_0xbbc8('0x32')],_0x56ce6b[_0xbbc8('0x33')]),_0x2939f8);if(_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x3d')]){_0x130758[_0xbbc8('0x3c')]=_['merge'](_0x130758[_0xbbc8('0x3c')],{'$or':_[_0xbbc8('0x2c')](_0x2939f8,function(_0x2a2d68){if(_0x2a2d68[_0xbbc8('0x3e')]!=='VIRTUAL'){var _0x545bc3={};_0x545bc3[_0x2a2d68[_0xbbc8('0x2a')]]={'$like':'%'+_0x239e64['query'][_0xbbc8('0x3d')]+'%'};return _0x545bc3;}})});}_0x130758=_[_0xbbc8('0x3f')]({},_0x130758,_0x239e64[_0xbbc8('0x40')]);var _0x5ed5d2={'where':_0x130758[_0xbbc8('0x3c')]};return db['FreshdeskAccount']['count'](_0x5ed5d2)[_0xbbc8('0x27')](function(_0x37e803){_0x57cc7e['count']=_0x37e803;if(_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x41')]){_0x130758['include']=[{'all':!![]}];}return db[_0xbbc8('0x2d')][_0xbbc8('0x42')](_0x130758);})[_0xbbc8('0x27')](function(_0x52c836){_0x57cc7e[_0xbbc8('0x43')]=_0x52c836;return _0x57cc7e;})[_0xbbc8('0x27')](respondWithFilteredResult(_0x4b0e0c,_0x130758))[_0xbbc8('0x44')](handleError(_0x4b0e0c,null));};exports['show']=function(_0x3e7e54,_0x1dfbce){var _0x3dd5f6={'raw':![],'where':{'id':_0x3e7e54[_0xbbc8('0x45')]['id']}},_0x3d6405={};_0x3d6405[_0xbbc8('0x30')]=_['keys'](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')]);_0x3d6405['query']=_[_0xbbc8('0x31')](_0x3e7e54[_0xbbc8('0x32')]);_0x3d6405[_0xbbc8('0x33')]=_['intersection'](_0x3d6405[_0xbbc8('0x30')],_0x3d6405[_0xbbc8('0x32')]);_0x3dd5f6[_0xbbc8('0x35')]=_['intersection'](_0x3d6405[_0xbbc8('0x30')],qs['fields'](_0x3e7e54[_0xbbc8('0x32')][_0xbbc8('0x36')]));_0x3dd5f6[_0xbbc8('0x35')]=_0x3dd5f6['attributes'][_0xbbc8('0x37')]?_0x3dd5f6[_0xbbc8('0x35')]:_0x3d6405[_0xbbc8('0x30')];if(_0x3e7e54['query'][_0xbbc8('0x41')]){_0x3dd5f6[_0xbbc8('0x46')]=[{'all':!![]}];}_0x3dd5f6=_[_0xbbc8('0x3f')]({},_0x3dd5f6,_0x3e7e54[_0xbbc8('0x40')]);return db[_0xbbc8('0x2d')]['find'](_0x3dd5f6)[_0xbbc8('0x27')](handleEntityNotFound(_0x1dfbce,null))['then'](respondWithResult(_0x1dfbce,null))[_0xbbc8('0x44')](handleError(_0x1dfbce,null));};exports[_0xbbc8('0x47')]=function(_0x528b53,_0x4f3133){return db[_0xbbc8('0x2d')]['create'](_0x528b53[_0xbbc8('0x48')],{})[_0xbbc8('0x27')](respondWithResult(_0x4f3133,0xc9))[_0xbbc8('0x44')](handleError(_0x4f3133,null));};exports[_0xbbc8('0x26')]=function(_0x387dbf,_0x3d3a3a){if(_0x387dbf[_0xbbc8('0x48')]['id']){delete _0x387dbf['body']['id'];}return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0x387dbf['params']['id']}})['then'](handleEntityNotFound(_0x3d3a3a,null))[_0xbbc8('0x27')](saveUpdates(_0x387dbf['body'],null))[_0xbbc8('0x27')](respondWithResult(_0x3d3a3a,null))[_0xbbc8('0x44')](handleError(_0x3d3a3a,null));};exports[_0xbbc8('0x28')]=function(_0x45262e,_0x228502){return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0x45262e[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0x228502,null))[_0xbbc8('0x27')](removeEntity(_0x228502,null))[_0xbbc8('0x44')](handleError(_0x228502,null));};exports['getConfigurations']=function(_0x44510b,_0x46fa8d,_0x241b89){var _0x11414f={};var _0x40ac43={};var _0x219e4d;var _0x8fa10a;return db[_0xbbc8('0x2d')]['findOne']({'where':{'id':_0x44510b[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0x46fa8d,null))[_0xbbc8('0x27')](function(_0x2ebdf9){if(_0x2ebdf9){_0x219e4d=_0x2ebdf9;_0x40ac43[_0xbbc8('0x30')]=_['keys'](db[_0xbbc8('0x4a')]['rawAttributes']);_0x40ac43[_0xbbc8('0x32')]=_[_0xbbc8('0x31')](_0x44510b[_0xbbc8('0x32')]);_0x40ac43['filters']=_[_0xbbc8('0x34')](_0x40ac43['model'],_0x40ac43[_0xbbc8('0x32')]);_0x11414f['attributes']=_[_0xbbc8('0x34')](_0x40ac43[_0xbbc8('0x30')],qs[_0xbbc8('0x36')](_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x36')]));_0x11414f[_0xbbc8('0x35')]=_0x11414f[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x11414f[_0xbbc8('0x35')]:_0x40ac43[_0xbbc8('0x30')];_0x11414f['order']=qs[_0xbbc8('0x3b')](_0x44510b['query']['sort']);_0x11414f[_0xbbc8('0x3c')]=qs[_0xbbc8('0x33')](_[_0xbbc8('0x4b')](_0x44510b[_0xbbc8('0x32')],_0x40ac43[_0xbbc8('0x33')]));if(_0x44510b[_0xbbc8('0x32')]['filter']){_0x11414f[_0xbbc8('0x3c')]=_[_0xbbc8('0x3f')](_0x11414f['where'],{'$or':_[_0xbbc8('0x2c')](_0x11414f['attributes'],function(_0x45066b){var _0x20485c={};_0x20485c[_0x45066b]={'$like':'%'+_0x44510b[_0xbbc8('0x32')]['filter']+'%'};return _0x20485c;})});}_0x11414f=_['merge']({},_0x11414f,_0x44510b[_0xbbc8('0x40')]);return _0x219e4d[_0xbbc8('0x4c')](_0x11414f);}})[_0xbbc8('0x27')](function(_0x1419ba){if(_0x1419ba){_0x8fa10a=_0x1419ba[_0xbbc8('0x37')];if(!_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x38')]('nolimit')){_0x11414f[_0xbbc8('0x21')]=qs[_0xbbc8('0x21')](_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x21')]);_0x11414f['offset']=qs[_0xbbc8('0x1f')](_0x44510b['query']['offset']);}return _0x219e4d[_0xbbc8('0x4c')](_0x11414f);}})[_0xbbc8('0x27')](function(_0x107727){if(_0x107727){return _0x107727?{'count':_0x8fa10a,'rows':_0x107727}:null;}})[_0xbbc8('0x27')](respondWithResult(_0x46fa8d,null))[_0xbbc8('0x44')](handleError(_0x46fa8d,null));};exports['addConfiguration']=function(_0x113a4a,_0xd1b4af,_0x392184){if(_0x113a4a[_0xbbc8('0x48')]['id']){delete _0x113a4a['body']['id'];}return db[_0xbbc8('0x2d')][_0xbbc8('0x4d')]({'where':{'id':_0x113a4a[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0xd1b4af,null))[_0xbbc8('0x27')](function(_0xabda07){if(_0xabda07){_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x4e')]=_0xabda07['id'];_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x4f')]=integrations[_0xbbc8('0x50')](_0x113a4a[_0xbbc8('0x48')]['channel'],_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x3e')]);_0x113a4a['body']['Descriptions']=integrations[_0xbbc8('0x51')](_0x113a4a[_0xbbc8('0x48')]['channel'],_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x3e')]);return db[_0xbbc8('0x4a')][_0xbbc8('0x47')](_0x113a4a[_0xbbc8('0x48')],{'include':[{'model':db[_0xbbc8('0x52')],'as':_0xbbc8('0x4f')},{'model':db[_0xbbc8('0x52')],'as':_0xbbc8('0x53')}]});}return null;})[_0xbbc8('0x27')](respondWithResult(_0xd1b4af,null))['catch'](handleError(_0xd1b4af,null));};exports[_0xbbc8('0x54')]=function(_0x2a7747,_0x295393,_0x393039){var _0x3a2c0e='';return db[_0xbbc8('0x2d')][_0xbbc8('0x4d')]({'where':{'id':_0x2a7747['params']['id']},'attributes':['id',_0xbbc8('0x55'),_0xbbc8('0x56')]})['then'](handleEntityNotFound(_0x295393,null))[_0xbbc8('0x27')](function(_0x350007){if(_0x350007){_0x3a2c0e=_0x350007[_0xbbc8('0x55')];var _0x4184a0=_0x3a2c0e[_0xbbc8('0x57')](-0x1);if(_0x4184a0==='/'){_0x3a2c0e=_0x3a2c0e[_0xbbc8('0x58')](0x0,_0x3a2c0e[_0xbbc8('0x59')](_0x4184a0));}return rp({'method':_0xbbc8('0x5a'),'uri':util[_0xbbc8('0x5b')](_0xbbc8('0x5c'),_0x3a2c0e,_0xbbc8('0x5d')),'headers':{'Authorization':util[_0xbbc8('0x5b')](_0xbbc8('0x5e'),new Buffer(util[_0xbbc8('0x5b')](_0xbbc8('0x5f'),_0x350007['apiKey']))[_0xbbc8('0x60')](_0xbbc8('0x61')))},'json':!![]});}})[_0xbbc8('0x27')](function(_0x7e96db){if(_0x7e96db){var _0x42b954=[_0xbbc8('0x62'),_0xbbc8('0x63'),_0xbbc8('0x64'),'description',_0xbbc8('0x1d'),'priority','group','source','ticket_type',_0xbbc8('0x65'),'company'];_[_0xbbc8('0x66')](_0x7e96db,function(_0x35d6a6){return _0x42b954[_0xbbc8('0x67')](_0x35d6a6[_0xbbc8('0x2a')])||!_0x35d6a6['default']&&_0x35d6a6['type']!==_0xbbc8('0x68')&&_0x35d6a6[_0xbbc8('0x3e')]!==_0xbbc8('0x69');});return{'count':_0x7e96db[_0xbbc8('0x37')],'rows':_['map'](_0x7e96db,function(_0x596c70){return{'id':_0x596c70[_0xbbc8('0x2a')],'name':_0x596c70['label'],'custom':!_0x596c70[_0xbbc8('0x6a')],'options':_0x596c70[_0xbbc8('0x6b')]?_['map'](_0x596c70['choices'],function(_0x33ad43){return{'name':_[_0xbbc8('0x6c')](_0x33ad43),'value':_0x33ad43};}):[]};})};}})[_0xbbc8('0x27')](respondWithResult(_0x295393,null))[_0xbbc8('0x44')](function(_0x284d81){var _0x1014cc=_0x2a7747['query']['test']?0x1f4:_0x284d81[_0xbbc8('0x6d')]||0x1f4;logger[_0xbbc8('0x29')](_0xbbc8('0x6e'),'getFields',_0x1014cc,JSON[_0xbbc8('0x6f')](_0x284d81));delete _0x284d81[_0xbbc8('0x2a')];if(_0x1014cc===0x191){_0x1014cc=0x190;}_0x295393['status'](_0x1014cc)[_0xbbc8('0x70')](_0x2a7747[_0xbbc8('0x32')][_0xbbc8('0x71')]?{'message':_0xbbc8('0x72'),'statusCode':_0x284d81['statusCode']}:_0x284d81);});}; \ No newline at end of file +var _0xc820=['then','destroy','sendStatus','stack','name','send','index','FreshdeskAccount','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','rawAttributes','length','create','body','find','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','remoteUri','slice','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','priority','source','ticket_type','group','company','remove','includes','default','custom_text','label','choices','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update'];(function(_0x1b4180,_0x4f1d53){var _0x21e6b0=function(_0x5577b1){while(--_0x5577b1){_0x1b4180['push'](_0x1b4180['shift']());}};_0x21e6b0(++_0x4f1d53);}(_0xc820,0x13f));var _0x0c82=function(_0x458882,_0x4cea4e){_0x458882=_0x458882-0x0;var _0x4a7970=_0xc820[_0x458882];return _0x4a7970;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c82('0x0'));var zipdir=require(_0x0c82('0x1'));var jsonpatch=require(_0x0c82('0x2'));var rp=require(_0x0c82('0x3'));var moment=require(_0x0c82('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0c82('0x5'));var util=require('util');var path=require(_0x0c82('0x6'));var sox=require(_0x0c82('0x7'));var csv=require(_0x0c82('0x8'));var ejs=require(_0x0c82('0x9'));var fs=require('fs');var fs_extra=require(_0x0c82('0xa'));var _=require(_0x0c82('0xb'));var squel=require(_0x0c82('0xc'));var crypto=require(_0x0c82('0xd'));var jsforce=require(_0x0c82('0xe'));var deskjs=require(_0x0c82('0xf'));var toCsv=require(_0x0c82('0x8'));var querystring=require(_0x0c82('0x10'));var Papa=require(_0x0c82('0x11'));var Redis=require(_0x0c82('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0c82('0x13'));var as=require(_0x0c82('0x14'));var hardwareService=require(_0x0c82('0x15'));var logger=require(_0x0c82('0x16'))(_0x0c82('0x17'));var utils=require(_0x0c82('0x18'));var config=require(_0x0c82('0x19'));var licenseUtil=require(_0x0c82('0x1a'));var db=require(_0x0c82('0x1b'))['db'];var integrations=require(_0x0c82('0x1c'));function respondWithStatusCode(_0x505706,_0xc9a01b){_0xc9a01b=_0xc9a01b||0xcc;return function(_0x54b6da){if(_0x54b6da){return _0x505706['sendStatus'](_0xc9a01b);}return _0x505706[_0x0c82('0x1d')](_0xc9a01b)[_0x0c82('0x1e')]();};}function respondWithResult(_0x3e1ff8,_0x1bf511){_0x1bf511=_0x1bf511||0xc8;return function(_0x20439a){if(_0x20439a){return _0x3e1ff8['status'](_0x1bf511)[_0x0c82('0x1f')](_0x20439a);}};}function respondWithFilteredResult(_0x17376c,_0x693427){return function(_0x54caf2){if(_0x54caf2){var _0x44033d=typeof _0x693427['offset']===_0x0c82('0x20')&&typeof _0x693427[_0x0c82('0x21')]===_0x0c82('0x20');var _0x5c5b3a=_0x54caf2['count'];var _0x3e2478=_0x44033d?0x0:_0x693427[_0x0c82('0x22')];var _0x49231a=_0x44033d?_0x54caf2[_0x0c82('0x23')]:_0x693427['offset']+_0x693427[_0x0c82('0x21')];var _0x3aa4c3;if(_0x49231a>=_0x5c5b3a){_0x49231a=_0x5c5b3a;_0x3aa4c3=0xc8;}else{_0x3aa4c3=0xce;}_0x17376c['status'](_0x3aa4c3);return _0x17376c[_0x0c82('0x24')]('Content-Range',_0x3e2478+'-'+_0x49231a+'/'+_0x5c5b3a)[_0x0c82('0x1f')](_0x54caf2);}return null;};}function patchUpdates(_0x55e106){return function(_0xf2ff44){try{jsonpatch[_0x0c82('0x25')](_0xf2ff44,_0x55e106,!![]);}catch(_0x599ca8){return BPromise[_0x0c82('0x26')](_0x599ca8);}return _0xf2ff44[_0x0c82('0x27')]();};}function saveUpdates(_0x8a6e02,_0x4a4a04){return function(_0x2a576a){if(_0x2a576a){return _0x2a576a[_0x0c82('0x28')](_0x8a6e02)[_0x0c82('0x29')](function(_0x1d2691){return _0x1d2691;});}return null;};}function removeEntity(_0x514993,_0x2bcc7f){return function(_0x242f79){if(_0x242f79){return _0x242f79[_0x0c82('0x2a')]()[_0x0c82('0x29')](function(){_0x514993[_0x0c82('0x1d')](0xcc)[_0x0c82('0x1e')]();});}};}function handleEntityNotFound(_0x807d12,_0x590553){return function(_0xf08c1){if(!_0xf08c1){_0x807d12[_0x0c82('0x2b')](0x194);}return _0xf08c1;};}function handleError(_0x4e7f33,_0x17031f){_0x17031f=_0x17031f||0x1f4;return function(_0x4aa36f){logger['error'](_0x4aa36f[_0x0c82('0x2c')]);if(_0x4aa36f[_0x0c82('0x2d')]){delete _0x4aa36f[_0x0c82('0x2d')];}_0x4e7f33[_0x0c82('0x1d')](_0x17031f)[_0x0c82('0x2e')](_0x4aa36f);};}exports[_0x0c82('0x2f')]=function(_0x4c58e1,_0x206283){var _0x5ab0c7={},_0x548e98={},_0x17b569={'count':0x0,'rows':[]};var _0x596232=_['map'](db[_0x0c82('0x30')]['rawAttributes'],function(_0x57442c){return{'name':_0x57442c[_0x0c82('0x31')],'type':_0x57442c[_0x0c82('0x32')][_0x0c82('0x33')]};});_0x548e98[_0x0c82('0x34')]=_[_0x0c82('0x35')](_0x596232,_0x0c82('0x2d'));_0x548e98[_0x0c82('0x36')]=_[_0x0c82('0x37')](_0x4c58e1[_0x0c82('0x36')]);_0x548e98[_0x0c82('0x38')]=_[_0x0c82('0x39')](_0x548e98[_0x0c82('0x34')],_0x548e98['query']);_0x5ab0c7['attributes']=_[_0x0c82('0x39')](_0x548e98[_0x0c82('0x34')],qs[_0x0c82('0x3a')](_0x4c58e1[_0x0c82('0x36')][_0x0c82('0x3a')]));_0x5ab0c7[_0x0c82('0x3b')]=_0x5ab0c7[_0x0c82('0x3b')]['length']?_0x5ab0c7[_0x0c82('0x3b')]:_0x548e98[_0x0c82('0x34')];if(!_0x4c58e1['query'][_0x0c82('0x3c')]('nolimit')){_0x5ab0c7['limit']=qs[_0x0c82('0x21')](_0x4c58e1['query']['limit']);_0x5ab0c7[_0x0c82('0x22')]=qs[_0x0c82('0x22')](_0x4c58e1[_0x0c82('0x36')][_0x0c82('0x22')]);}_0x5ab0c7[_0x0c82('0x3d')]=qs[_0x0c82('0x3e')](_0x4c58e1['query']['sort']);_0x5ab0c7[_0x0c82('0x3f')]=qs[_0x0c82('0x38')](_[_0x0c82('0x40')](_0x4c58e1['query'],_0x548e98[_0x0c82('0x38')]),_0x596232);if(_0x4c58e1[_0x0c82('0x36')]['filter']){_0x5ab0c7[_0x0c82('0x3f')]=_[_0x0c82('0x41')](_0x5ab0c7['where'],{'$or':_[_0x0c82('0x35')](_0x596232,function(_0x2da3dc){if(_0x2da3dc[_0x0c82('0x32')]!==_0x0c82('0x42')){var _0x5dcb49={};_0x5dcb49[_0x2da3dc[_0x0c82('0x2d')]]={'$like':'%'+_0x4c58e1[_0x0c82('0x36')][_0x0c82('0x43')]+'%'};return _0x5dcb49;}})});}_0x5ab0c7=_[_0x0c82('0x41')]({},_0x5ab0c7,_0x4c58e1[_0x0c82('0x44')]);var _0x2fa180={'where':_0x5ab0c7[_0x0c82('0x3f')]};return db['FreshdeskAccount'][_0x0c82('0x23')](_0x2fa180)[_0x0c82('0x29')](function(_0x534ec5){_0x17b569[_0x0c82('0x23')]=_0x534ec5;if(_0x4c58e1[_0x0c82('0x36')][_0x0c82('0x45')]){_0x5ab0c7[_0x0c82('0x46')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x5ab0c7);})[_0x0c82('0x29')](function(_0x557b29){_0x17b569[_0x0c82('0x47')]=_0x557b29;return _0x17b569;})[_0x0c82('0x29')](respondWithFilteredResult(_0x206283,_0x5ab0c7))[_0x0c82('0x48')](handleError(_0x206283,null));};exports['show']=function(_0x4b3257,_0x3b09f6){var _0x161077={'raw':![],'where':{'id':_0x4b3257[_0x0c82('0x49')]['id']}},_0x3a7ba2={};_0x3a7ba2[_0x0c82('0x34')]=_['keys'](db['FreshdeskAccount'][_0x0c82('0x4a')]);_0x3a7ba2['query']=_['keys'](_0x4b3257['query']);_0x3a7ba2[_0x0c82('0x38')]=_[_0x0c82('0x39')](_0x3a7ba2['model'],_0x3a7ba2[_0x0c82('0x36')]);_0x161077[_0x0c82('0x3b')]=_[_0x0c82('0x39')](_0x3a7ba2['model'],qs['fields'](_0x4b3257[_0x0c82('0x36')]['fields']));_0x161077[_0x0c82('0x3b')]=_0x161077[_0x0c82('0x3b')][_0x0c82('0x4b')]?_0x161077[_0x0c82('0x3b')]:_0x3a7ba2[_0x0c82('0x34')];if(_0x4b3257[_0x0c82('0x36')][_0x0c82('0x45')]){_0x161077[_0x0c82('0x46')]=[{'all':!![]}];}_0x161077=_[_0x0c82('0x41')]({},_0x161077,_0x4b3257[_0x0c82('0x44')]);return db[_0x0c82('0x30')]['find'](_0x161077)['then'](handleEntityNotFound(_0x3b09f6,null))[_0x0c82('0x29')](respondWithResult(_0x3b09f6,null))[_0x0c82('0x48')](handleError(_0x3b09f6,null));};exports[_0x0c82('0x4c')]=function(_0x4b0660,_0x4383cf){return db[_0x0c82('0x30')][_0x0c82('0x4c')](_0x4b0660['body'],{})['then'](respondWithResult(_0x4383cf,0xc9))[_0x0c82('0x48')](handleError(_0x4383cf,null));};exports[_0x0c82('0x28')]=function(_0x4e789d,_0x221efc){if(_0x4e789d['body']['id']){delete _0x4e789d[_0x0c82('0x4d')]['id'];}return db[_0x0c82('0x30')]['find']({'where':{'id':_0x4e789d[_0x0c82('0x49')]['id']}})[_0x0c82('0x29')](handleEntityNotFound(_0x221efc,null))[_0x0c82('0x29')](saveUpdates(_0x4e789d[_0x0c82('0x4d')],null))[_0x0c82('0x29')](respondWithResult(_0x221efc,null))[_0x0c82('0x48')](handleError(_0x221efc,null));};exports['destroy']=function(_0x5cf09e,_0x7d9138){return db[_0x0c82('0x30')][_0x0c82('0x4e')]({'where':{'id':_0x5cf09e[_0x0c82('0x49')]['id']}})[_0x0c82('0x29')](handleEntityNotFound(_0x7d9138,null))[_0x0c82('0x29')](removeEntity(_0x7d9138,null))[_0x0c82('0x48')](handleError(_0x7d9138,null));};exports['getConfigurations']=function(_0x584e0d,_0xec04c9,_0x5dfb0b){var _0x195ed3={};var _0x432791={};var _0x5e3328;var _0x367726;return db[_0x0c82('0x30')][_0x0c82('0x4f')]({'where':{'id':_0x584e0d[_0x0c82('0x49')]['id']}})['then'](handleEntityNotFound(_0xec04c9,null))[_0x0c82('0x29')](function(_0x2e7fe5){if(_0x2e7fe5){_0x5e3328=_0x2e7fe5;_0x432791[_0x0c82('0x34')]=_[_0x0c82('0x37')](db[_0x0c82('0x50')]['rawAttributes']);_0x432791[_0x0c82('0x36')]=_[_0x0c82('0x37')](_0x584e0d[_0x0c82('0x36')]);_0x432791[_0x0c82('0x38')]=_[_0x0c82('0x39')](_0x432791[_0x0c82('0x34')],_0x432791[_0x0c82('0x36')]);_0x195ed3[_0x0c82('0x3b')]=_['intersection'](_0x432791[_0x0c82('0x34')],qs[_0x0c82('0x3a')](_0x584e0d[_0x0c82('0x36')][_0x0c82('0x3a')]));_0x195ed3[_0x0c82('0x3b')]=_0x195ed3[_0x0c82('0x3b')][_0x0c82('0x4b')]?_0x195ed3[_0x0c82('0x3b')]:_0x432791[_0x0c82('0x34')];_0x195ed3[_0x0c82('0x3d')]=qs[_0x0c82('0x3e')](_0x584e0d[_0x0c82('0x36')][_0x0c82('0x3e')]);_0x195ed3['where']=qs[_0x0c82('0x38')](_[_0x0c82('0x40')](_0x584e0d['query'],_0x432791[_0x0c82('0x38')]));if(_0x584e0d['query']['filter']){_0x195ed3['where']=_[_0x0c82('0x41')](_0x195ed3[_0x0c82('0x3f')],{'$or':_[_0x0c82('0x35')](_0x195ed3[_0x0c82('0x3b')],function(_0x2383e7){var _0x372a8e={};_0x372a8e[_0x2383e7]={'$like':'%'+_0x584e0d[_0x0c82('0x36')][_0x0c82('0x43')]+'%'};return _0x372a8e;})});}_0x195ed3=_[_0x0c82('0x41')]({},_0x195ed3,_0x584e0d['options']);return _0x5e3328[_0x0c82('0x51')](_0x195ed3);}})['then'](function(_0x51d773){if(_0x51d773){_0x367726=_0x51d773['length'];if(!_0x584e0d['query']['hasOwnProperty']('nolimit')){_0x195ed3[_0x0c82('0x21')]=qs[_0x0c82('0x21')](_0x584e0d[_0x0c82('0x36')][_0x0c82('0x21')]);_0x195ed3[_0x0c82('0x22')]=qs['offset'](_0x584e0d['query']['offset']);}return _0x5e3328[_0x0c82('0x51')](_0x195ed3);}})['then'](function(_0x38dfce){if(_0x38dfce){return _0x38dfce?{'count':_0x367726,'rows':_0x38dfce}:null;}})['then'](respondWithResult(_0xec04c9,null))['catch'](handleError(_0xec04c9,null));};exports[_0x0c82('0x52')]=function(_0x1ad770,_0xd72773,_0x3e2afc){if(_0x1ad770['body']['id']){delete _0x1ad770[_0x0c82('0x4d')]['id'];}return db[_0x0c82('0x30')][_0x0c82('0x4f')]({'where':{'id':_0x1ad770['params']['id']}})[_0x0c82('0x29')](handleEntityNotFound(_0xd72773,null))['then'](function(_0x5d6b84){if(_0x5d6b84){_0x1ad770[_0x0c82('0x4d')][_0x0c82('0x53')]=_0x5d6b84['id'];_0x1ad770['body'][_0x0c82('0x54')]=integrations[_0x0c82('0x55')](_0x1ad770[_0x0c82('0x4d')][_0x0c82('0x56')],_0x1ad770[_0x0c82('0x4d')][_0x0c82('0x32')]);_0x1ad770[_0x0c82('0x4d')][_0x0c82('0x57')]=integrations[_0x0c82('0x58')](_0x1ad770[_0x0c82('0x4d')][_0x0c82('0x56')],_0x1ad770[_0x0c82('0x4d')][_0x0c82('0x32')]);return db['FreshdeskConfiguration'][_0x0c82('0x4c')](_0x1ad770['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x0c82('0x54')},{'model':db[_0x0c82('0x59')],'as':_0x0c82('0x57')}]});}return null;})[_0x0c82('0x29')](respondWithResult(_0xd72773,null))['catch'](handleError(_0xd72773,null));};exports[_0x0c82('0x5a')]=function(_0x105130,_0x43c5a6,_0x548731){var _0xe1bfd0='';return db[_0x0c82('0x30')][_0x0c82('0x4f')]({'where':{'id':_0x105130['params']['id']},'attributes':['id','remoteUri',_0x0c82('0x5b')]})[_0x0c82('0x29')](handleEntityNotFound(_0x43c5a6,null))[_0x0c82('0x29')](function(_0x1825d4){if(_0x1825d4){_0xe1bfd0=_0x1825d4[_0x0c82('0x5c')];var _0x2d66a6=_0xe1bfd0[_0x0c82('0x5d')](-0x1);if(_0x2d66a6==='/'){_0xe1bfd0=_0xe1bfd0['substring'](0x0,_0xe1bfd0['lastIndexOf'](_0x2d66a6));}return rp({'method':_0x0c82('0x5e'),'uri':util[_0x0c82('0x5f')](_0x0c82('0x60'),_0xe1bfd0,_0x0c82('0x61')),'headers':{'Authorization':util[_0x0c82('0x5f')](_0x0c82('0x62'),new Buffer(util[_0x0c82('0x5f')](_0x0c82('0x63'),_0x1825d4['apiKey']))['toString'](_0x0c82('0x64')))},'json':!![]});}})[_0x0c82('0x29')](function(_0x2bd532){if(_0x2bd532){var _0x38c0bf=[_0x0c82('0x65'),_0x0c82('0x66'),_0x0c82('0x67'),'description','status',_0x0c82('0x68'),'group',_0x0c82('0x69'),_0x0c82('0x6a'),_0x0c82('0x6b'),_0x0c82('0x6c')];_[_0x0c82('0x6d')](_0x2bd532,function(_0x4e1e60){return _0x38c0bf[_0x0c82('0x6e')](_0x4e1e60[_0x0c82('0x2d')])||!_0x4e1e60[_0x0c82('0x6f')]&&_0x4e1e60[_0x0c82('0x32')]!==_0x0c82('0x70')&&_0x4e1e60[_0x0c82('0x32')]!=='custom_dropdown';});return{'count':_0x2bd532[_0x0c82('0x4b')],'rows':_[_0x0c82('0x35')](_0x2bd532,function(_0x9f625){return{'id':_0x9f625[_0x0c82('0x2d')],'name':_0x9f625[_0x0c82('0x71')],'custom':!_0x9f625[_0x0c82('0x6f')],'options':_0x9f625[_0x0c82('0x72')]?_[_0x0c82('0x35')](_0x9f625['choices'],function(_0x10f5ab){return{'name':_['capitalize'](_0x10f5ab),'value':_0x10f5ab};}):[]};})};}})[_0x0c82('0x29')](respondWithResult(_0x43c5a6,null))[_0x0c82('0x48')](function(_0x4b19ea){var _0x238388=_0x105130[_0x0c82('0x36')][_0x0c82('0x73')]?0x1f4:_0x4b19ea['statusCode']||0x1f4;logger[_0x0c82('0x74')](_0x0c82('0x75'),'getFields',_0x238388,JSON[_0x0c82('0x76')](_0x4b19ea));delete _0x4b19ea[_0x0c82('0x2d')];if(_0x238388===0x191){_0x238388=0x190;}_0x43c5a6[_0x0c82('0x1d')](_0x238388)[_0x0c82('0x2e')](_0x105130[_0x0c82('0x36')][_0x0c82('0x73')]?{'message':_0x0c82('0x77'),'statusCode':_0x4b19ea['statusCode']}:_0x4b19ea);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ee2a113..7fc0611 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 _0x0a50=['define','lodash','util','moment','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x10302e,_0x158f12){var _0x526ee6=function(_0x2a89db){while(--_0x2a89db){_0x10302e['push'](_0x10302e['shift']());}};_0x526ee6(++_0x158f12);}(_0x0a50,0x1c9));var _0x00a5=function(_0x35e97,_0x20fac6){_0x35e97=_0x35e97-0x0;var _0xc0a3d4=_0x0a50[_0x35e97];return _0xc0a3d4;};'use strict';var _=require(_0x00a5('0x0'));var util=require(_0x00a5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x00a5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x00a5('0x3'));var rimraf=require(_0x00a5('0x4'));var config=require(_0x00a5('0x5'));var attributes=require(_0x00a5('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x47868a,_0x5c7be5){return _0x47868a[_0x00a5('0x7')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ba0=['lodash','util','api','moment','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts'];(function(_0x3c065a,_0x90a342){var _0x30e680=function(_0x188477){while(--_0x188477){_0x3c065a['push'](_0x3c065a['shift']());}};_0x30e680(++_0x90a342);}(_0x3ba0,0x90));var _0x03ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3ba0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x03ba('0x0'));var util=require(_0x03ba('0x1'));var logger=require('../../config/logger')(_0x03ba('0x2'));var moment=require(_0x03ba('0x3'));var BPromise=require('bluebird');var rp=require(_0x03ba('0x4'));var fs=require('fs');var path=require(_0x03ba('0x5'));var rimraf=require(_0x03ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x03ba('0x7'));var integrations=require(_0x03ba('0x8'));module[_0x03ba('0x9')]=function(_0x2acfb6,_0x88840e){return _0x2acfb6[_0x03ba('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x03ba('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 6d157e4..64b37c7 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 _0x4126=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','include','map','model','attributes','ShowFreshdeskAccount'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x4126,0x1a4));var _0x6412=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x4126[_0x4aba15];return _0x1c8122;};'use strict';var _=require(_0x6412('0x0'));var util=require(_0x6412('0x1'));var moment=require(_0x6412('0x2'));var BPromise=require(_0x6412('0x3'));var rs=require(_0x6412('0x4'));var fs=require('fs');var Redis=require(_0x6412('0x5'));var db=require(_0x6412('0x6'))['db'];var utils=require(_0x6412('0x7'));var logger=require(_0x6412('0x8'))('rpc');var config=require(_0x6412('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6412('0xa')][_0x6412('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5443ab,_0x507838,_0x1bf19e){return new BPromise(function(_0x4733cf,_0x2052ef){return client[_0x6412('0xc')](_0x5443ab,_0x1bf19e)[_0x6412('0xd')](function(_0x2d3414){logger[_0x6412('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x507838,_0x6412('0xf'));logger[_0x6412('0x10')](_0x6412('0x11'),_0x507838,_0x6412('0xf'),JSON[_0x6412('0x12')](_0x2d3414));if(_0x2d3414['error']){if(_0x2d3414['error'][_0x6412('0x13')]===0x1f4){logger[_0x6412('0x14')](_0x6412('0x15'),_0x507838,_0x2d3414[_0x6412('0x14')][_0x6412('0x16')]);return _0x2052ef(_0x2d3414[_0x6412('0x14')][_0x6412('0x16')]);}logger[_0x6412('0x14')](_0x6412('0x15'),_0x507838,_0x2d3414['error'][_0x6412('0x16')]);return _0x4733cf(_0x2d3414[_0x6412('0x14')][_0x6412('0x16')]);}else{logger[_0x6412('0xe')](_0x6412('0x15'),_0x507838,_0x6412('0xf'));_0x4733cf(_0x2d3414['result'][_0x6412('0x16')]);}})[_0x6412('0x17')](function(_0x5c2059){logger[_0x6412('0x14')](_0x6412('0x15'),_0x507838,_0x5c2059);_0x2052ef(_0x5c2059);});});}exports[_0x6412('0x18')]=function(_0x312a44){var _0x3de8fd=this;return new Promise(function(_0x13ba37,_0x301afd){return db[_0x6412('0x19')][_0x6412('0x1a')]({'raw':_0x312a44[_0x6412('0x1b')]?_0x312a44[_0x6412('0x1b')][_0x6412('0x1c')]===undefined?!![]:![]:!![],'where':_0x312a44['options']?_0x312a44[_0x6412('0x1b')][_0x6412('0x1d')]||null:null,'attributes':_0x312a44['options']?_0x312a44[_0x6412('0x1b')]['attributes']||null:null,'limit':_0x312a44[_0x6412('0x1b')]?_0x312a44['options']['limit']||null:null,'include':_0x312a44[_0x6412('0x1b')]?_0x312a44[_0x6412('0x1b')][_0x6412('0x1e')]?_[_0x6412('0x1f')](_0x312a44[_0x6412('0x1b')][_0x6412('0x1e')],function(_0x475a81){return{'model':db[_0x475a81[_0x6412('0x20')]],'as':_0x475a81['as'],'attributes':_0x475a81[_0x6412('0x21')],'include':_0x475a81['include']?_[_0x6412('0x1f')](_0x475a81[_0x6412('0x1e')],function(_0x4d5c8a){return{'model':db[_0x4d5c8a['model']],'as':_0x4d5c8a['as'],'attributes':_0x4d5c8a['attributes'],'include':_0x4d5c8a['include']?_[_0x6412('0x1f')](_0x4d5c8a[_0x6412('0x1e')],function(_0x5419c5){return{'model':db[_0x5419c5['model']],'as':_0x5419c5['as'],'attributes':_0x5419c5['attributes']};}):[]};}):[]};}):[]:[]})[_0x6412('0xd')](function(_0x47491b){logger['info'](_0x6412('0x18'),_0x312a44);logger[_0x6412('0x10')]('GetFreshdeskAccount',_0x312a44,JSON[_0x6412('0x12')](_0x47491b));_0x13ba37(_0x47491b);})['catch'](function(_0x3ebb4b){logger[_0x6412('0x14')](_0x6412('0x18'),_0x3ebb4b[_0x6412('0x16')],_0x312a44);_0x301afd(_0x3de8fd['error'](0x1f4,_0x3ebb4b['message']));});});};exports[_0x6412('0x22')]=function(_0xad19f5){var _0x69e46a=this;return new Promise(function(_0x10b39a,_0x49e6ee){return db['FreshdeskAccount']['find']({'raw':_0xad19f5[_0x6412('0x1b')]?_0xad19f5[_0x6412('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xad19f5[_0x6412('0x1b')]?_0xad19f5[_0x6412('0x1b')][_0x6412('0x1d')]||null:null,'attributes':_0xad19f5['options']?_0xad19f5[_0x6412('0x1b')]['attributes']||null:null,'include':_0xad19f5['options']?_0xad19f5[_0x6412('0x1b')][_0x6412('0x1e')]?_['map'](_0xad19f5[_0x6412('0x1b')][_0x6412('0x1e')],function(_0x32eeeb){return{'model':db[_0x32eeeb[_0x6412('0x20')]],'as':_0x32eeeb['as'],'attributes':_0x32eeeb[_0x6412('0x21')],'include':_0x32eeeb['include']?_[_0x6412('0x1f')](_0x32eeeb[_0x6412('0x1e')],function(_0x442ba0){return{'model':db[_0x442ba0['model']],'as':_0x442ba0['as'],'attributes':_0x442ba0[_0x6412('0x21')],'include':_0x442ba0['include']?_[_0x6412('0x1f')](_0x442ba0[_0x6412('0x1e')],function(_0x28f77c){return{'model':db[_0x28f77c[_0x6412('0x20')]],'as':_0x28f77c['as'],'attributes':_0x28f77c[_0x6412('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6412('0xd')](function(_0x4654ee){logger[_0x6412('0xe')](_0x6412('0x22'),_0xad19f5);logger[_0x6412('0x10')](_0x6412('0x22'),_0xad19f5,JSON[_0x6412('0x12')](_0x4654ee));_0x10b39a(_0x4654ee);})[_0x6412('0x17')](function(_0x221137){logger[_0x6412('0x14')](_0x6412('0x22'),_0x221137[_0x6412('0x16')],_0xad19f5);_0x49e6ee(_0x69e46a['error'](0x1f4,_0x221137[_0x6412('0x16')]));});});}; \ No newline at end of file +var _0x3aca=['attributes','ShowFreshdeskAccount','raw','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','limit','map','include','model'];(function(_0x142412,_0x189a3b){var _0x3274b3=function(_0xd6e26f){while(--_0xd6e26f){_0x142412['push'](_0x142412['shift']());}};_0x3274b3(++_0x189a3b);}(_0x3aca,0x83));var _0xa3ac=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x3aca[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0xa3ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa3ac('0x1'));var rs=require(_0xa3ac('0x2'));var fs=require('fs');var Redis=require(_0xa3ac('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3ac('0x4'));var logger=require(_0xa3ac('0x5'))(_0xa3ac('0x6'));var config=require(_0xa3ac('0x7'));var jayson=require(_0xa3ac('0x8'));var client=jayson['client'][_0xa3ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d9b73,_0x4fd108,_0x389abc){return new BPromise(function(_0x4da43d,_0x423126){return client[_0xa3ac('0xa')](_0x5d9b73,_0x389abc)[_0xa3ac('0xb')](function(_0xd5985e){logger[_0xa3ac('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x4fd108,_0xa3ac('0xd'));logger[_0xa3ac('0xe')](_0xa3ac('0xf'),_0x4fd108,'request\x20sent',JSON[_0xa3ac('0x10')](_0xd5985e));if(_0xd5985e[_0xa3ac('0x11')]){if(_0xd5985e[_0xa3ac('0x11')]['code']===0x1f4){logger[_0xa3ac('0x11')](_0xa3ac('0x12'),_0x4fd108,_0xd5985e[_0xa3ac('0x11')][_0xa3ac('0x13')]);return _0x423126(_0xd5985e[_0xa3ac('0x11')][_0xa3ac('0x13')]);}logger[_0xa3ac('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x4fd108,_0xd5985e[_0xa3ac('0x11')]['message']);return _0x4da43d(_0xd5985e['error']['message']);}else{logger[_0xa3ac('0xc')](_0xa3ac('0x12'),_0x4fd108,_0xa3ac('0xd'));_0x4da43d(_0xd5985e['result'][_0xa3ac('0x13')]);}})[_0xa3ac('0x14')](function(_0x4ee54e){logger[_0xa3ac('0x11')](_0xa3ac('0x12'),_0x4fd108,_0x4ee54e);_0x423126(_0x4ee54e);});});}exports[_0xa3ac('0x15')]=function(_0x40d38a){var _0xf7521d=this;return new Promise(function(_0x5d1ab4,_0x48c8c7){return db[_0xa3ac('0x16')]['findAll']({'raw':_0x40d38a['options']?_0x40d38a[_0xa3ac('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x40d38a['options']?_0x40d38a['options'][_0xa3ac('0x18')]||null:null,'attributes':_0x40d38a[_0xa3ac('0x17')]?_0x40d38a[_0xa3ac('0x17')]['attributes']||null:null,'limit':_0x40d38a[_0xa3ac('0x17')]?_0x40d38a[_0xa3ac('0x17')][_0xa3ac('0x19')]||null:null,'include':_0x40d38a[_0xa3ac('0x17')]?_0x40d38a['options']['include']?_[_0xa3ac('0x1a')](_0x40d38a[_0xa3ac('0x17')][_0xa3ac('0x1b')],function(_0x331aba){return{'model':db[_0x331aba[_0xa3ac('0x1c')]],'as':_0x331aba['as'],'attributes':_0x331aba[_0xa3ac('0x1d')],'include':_0x331aba[_0xa3ac('0x1b')]?_[_0xa3ac('0x1a')](_0x331aba[_0xa3ac('0x1b')],function(_0x23b644){return{'model':db[_0x23b644['model']],'as':_0x23b644['as'],'attributes':_0x23b644['attributes'],'include':_0x23b644[_0xa3ac('0x1b')]?_[_0xa3ac('0x1a')](_0x23b644[_0xa3ac('0x1b')],function(_0x2a8dec){return{'model':db[_0x2a8dec[_0xa3ac('0x1c')]],'as':_0x2a8dec['as'],'attributes':_0x2a8dec[_0xa3ac('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa3ac('0xb')](function(_0x189801){logger['info'](_0xa3ac('0x15'),_0x40d38a);logger[_0xa3ac('0xe')](_0xa3ac('0x15'),_0x40d38a,JSON[_0xa3ac('0x10')](_0x189801));_0x5d1ab4(_0x189801);})[_0xa3ac('0x14')](function(_0x4c1a2f){logger[_0xa3ac('0x11')]('GetFreshdeskAccount',_0x4c1a2f[_0xa3ac('0x13')],_0x40d38a);_0x48c8c7(_0xf7521d[_0xa3ac('0x11')](0x1f4,_0x4c1a2f[_0xa3ac('0x13')]));});});};exports[_0xa3ac('0x1e')]=function(_0x47f852){var _0x195845=this;return new Promise(function(_0x5a5847,_0x5e7d9b){return db[_0xa3ac('0x16')]['find']({'raw':_0x47f852[_0xa3ac('0x17')]?_0x47f852[_0xa3ac('0x17')][_0xa3ac('0x1f')]===undefined?!![]:![]:!![],'where':_0x47f852['options']?_0x47f852['options']['where']||null:null,'attributes':_0x47f852[_0xa3ac('0x17')]?_0x47f852[_0xa3ac('0x17')]['attributes']||null:null,'include':_0x47f852[_0xa3ac('0x17')]?_0x47f852[_0xa3ac('0x17')]['include']?_[_0xa3ac('0x1a')](_0x47f852[_0xa3ac('0x17')]['include'],function(_0x9ca2ca){return{'model':db[_0x9ca2ca[_0xa3ac('0x1c')]],'as':_0x9ca2ca['as'],'attributes':_0x9ca2ca['attributes'],'include':_0x9ca2ca['include']?_[_0xa3ac('0x1a')](_0x9ca2ca[_0xa3ac('0x1b')],function(_0x5bef2b){return{'model':db[_0x5bef2b[_0xa3ac('0x1c')]],'as':_0x5bef2b['as'],'attributes':_0x5bef2b[_0xa3ac('0x1d')],'include':_0x5bef2b['include']?_['map'](_0x5bef2b[_0xa3ac('0x1b')],function(_0x4ac44e){return{'model':db[_0x4ac44e[_0xa3ac('0x1c')]],'as':_0x4ac44e['as'],'attributes':_0x4ac44e[_0xa3ac('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa3ac('0xb')](function(_0x2dd735){logger[_0xa3ac('0xc')]('ShowFreshdeskAccount',_0x47f852);logger[_0xa3ac('0xe')](_0xa3ac('0x1e'),_0x47f852,JSON[_0xa3ac('0x10')](_0x2dd735));_0x5a5847(_0x2dd735);})[_0xa3ac('0x14')](function(_0x4f66c6){logger[_0xa3ac('0x11')]('ShowFreshdeskAccount',_0x4f66c6[_0xa3ac('0x13')],_0x47f852);_0x5e7d9b(_0x195845[_0xa3ac('0x11')](0x1f4,_0x4f66c6['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 9a89b11..c42e2b6 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 _0x6247=['show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x41dc9e,_0x7446){var _0x2f90d7=function(_0x2b88d8){while(--_0x2b88d8){_0x41dc9e['push'](_0x41dc9e['shift']());}};_0x2f90d7(++_0x7446);}(_0x6247,0xf5));var _0x7624=function(_0x35db7d,_0x123643){_0x35db7d=_0x35db7d-0x0;var _0x1da269=_0x6247[_0x35db7d];return _0x1da269;};'use strict';var multer=require(_0x7624('0x0'));var util=require(_0x7624('0x1'));var path=require(_0x7624('0x2'));var timeout=require(_0x7624('0x3'));var express=require(_0x7624('0x4'));var router=express[_0x7624('0x5')]();var fs_extra=require(_0x7624('0x6'));var auth=require(_0x7624('0x7'));var interaction=require(_0x7624('0x8'));var config=require(_0x7624('0x9'));var controller=require(_0x7624('0xa'));router['get']('/',auth[_0x7624('0xb')](),controller[_0x7624('0xc')]);router[_0x7624('0xd')](_0x7624('0xe'),auth[_0x7624('0xb')](),controller[_0x7624('0xf')]);router['get'](_0x7624('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x7624('0xd')]('/:id/subjects',auth[_0x7624('0xb')](),controller[_0x7624('0x11')]);router['get'](_0x7624('0x12'),auth[_0x7624('0xb')](),controller[_0x7624('0x13')]);router[_0x7624('0xd')](_0x7624('0x14'),auth['isAuthenticated'](),controller[_0x7624('0x15')]);router[_0x7624('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7624('0x16')](_0x7624('0x14'),auth[_0x7624('0xb')](),controller['setTags']);router[_0x7624('0x17')]('/:id',auth[_0x7624('0xb')](),controller['update']);router['delete'](_0x7624('0xe'),auth[_0x7624('0xb')](),controller[_0x7624('0x18')]);module[_0x7624('0x19')]=router; \ No newline at end of file +var _0x0d0f=['Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x46cd24,_0xb4813b){var _0x293def=function(_0x4ecfb4){while(--_0x4ecfb4){_0x46cd24['push'](_0x46cd24['shift']());}};_0x293def(++_0xb4813b);}(_0x0d0f,0xcc));var _0xf0d0=function(_0x47853b,_0x21856b){_0x47853b=_0x47853b-0x0;var _0x4deb01=_0x0d0f[_0x47853b];return _0x4deb01;};'use strict';var multer=require(_0xf0d0('0x0'));var util=require(_0xf0d0('0x1'));var path=require(_0xf0d0('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0d0('0x3'));var router=express[_0xf0d0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf0d0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf0d0('0x6'));var controller=require(_0xf0d0('0x7'));router['get']('/',auth[_0xf0d0('0x8')](),controller[_0xf0d0('0x9')]);router[_0xf0d0('0xa')](_0xf0d0('0xb'),auth[_0xf0d0('0x8')](),controller[_0xf0d0('0xc')]);router['get'](_0xf0d0('0xd'),auth[_0xf0d0('0x8')](),controller[_0xf0d0('0xe')]);router[_0xf0d0('0xa')]('/:id/subjects',auth[_0xf0d0('0x8')](),controller[_0xf0d0('0xf')]);router[_0xf0d0('0xa')]('/:id/descriptions',auth[_0xf0d0('0x8')](),controller[_0xf0d0('0x10')]);router[_0xf0d0('0xa')](_0xf0d0('0x11'),auth[_0xf0d0('0x8')](),controller[_0xf0d0('0x12')]);router[_0xf0d0('0x13')]('/',auth[_0xf0d0('0x8')](),controller[_0xf0d0('0x14')]);router['post'](_0xf0d0('0x11'),auth[_0xf0d0('0x8')](),controller['setTags']);router[_0xf0d0('0x15')](_0xf0d0('0xb'),auth[_0xf0d0('0x8')](),controller[_0xf0d0('0x16')]);router[_0xf0d0('0x17')](_0xf0d0('0xb'),auth[_0xf0d0('0x8')](),controller[_0xf0d0('0x18')]);module[_0xf0d0('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index de3ed43..2214eab 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 _0x06be=['STRING','exports'];(function(_0x2e2769,_0x3b79c0){var _0x472c7d=function(_0x5cba0b){while(--_0x5cba0b){_0x2e2769['push'](_0x2e2769['shift']());}};_0x472c7d(++_0x3b79c0);}(_0x06be,0x151));var _0xe06b=function(_0x42a7e3,_0x497a41){_0x42a7e3=_0x42a7e3-0x0;var _0x45f424=_0x06be[_0x42a7e3];return _0x45f424;};'use strict';var Sequelize=require('sequelize');module[_0xe06b('0x0')]={'name':{'type':Sequelize[_0xe06b('0x1')]},'description':{'type':Sequelize[_0xe06b('0x1')]}}; \ No newline at end of file +var _0x9171=['exports','STRING','sequelize'];(function(_0x5b2f49,_0x31dbae){var _0x20b032=function(_0x559e99){while(--_0x559e99){_0x5b2f49['push'](_0x5b2f49['shift']());}};_0x20b032(++_0x31dbae);}(_0x9171,0x13d));var _0x1917=function(_0x22381e,_0x49ae72){_0x22381e=_0x22381e-0x0;var _0x55d54c=_0x9171[_0x22381e];return _0x55d54c;};'use strict';var Sequelize=require(_0x1917('0x0'));module[_0x1917('0x1')]={'name':{'type':Sequelize[_0x1917('0x2')]},'description':{'type':Sequelize[_0x1917('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 99eceb8..c39dc93 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 _0x5a64=['Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','getFields','findOne','FreshdeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','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','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','set'];(function(_0xdd79be,_0x3bd452){var _0x24a6a5=function(_0x423f5c){while(--_0x423f5c){_0xdd79be['push'](_0xdd79be['shift']());}};_0x24a6a5(++_0x3bd452);}(_0x5a64,0x8a));var _0x45a6=function(_0x575410,_0x316dc8){_0x575410=_0x575410-0x0;var _0x1aa3ae=_0x5a64[_0x575410];return _0x1aa3ae;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x45a6('0x0'));var jsonpatch=require(_0x45a6('0x1'));var rp=require(_0x45a6('0x2'));var moment=require('moment');var BPromise=require(_0x45a6('0x3'));var Mustache=require(_0x45a6('0x4'));var util=require(_0x45a6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x45a6('0x6'));var ejs=require(_0x45a6('0x7'));var fs=require('fs');var fs_extra=require(_0x45a6('0x8'));var _=require(_0x45a6('0x9'));var squel=require(_0x45a6('0xa'));var crypto=require('crypto');var jsforce=require(_0x45a6('0xb'));var deskjs=require(_0x45a6('0xc'));var toCsv=require(_0x45a6('0x6'));var querystring=require(_0x45a6('0xd'));var Papa=require(_0x45a6('0xe'));var Redis=require(_0x45a6('0xf'));var authService=require(_0x45a6('0x10'));var qs=require(_0x45a6('0x11'));var as=require(_0x45a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45a6('0x13'))(_0x45a6('0x14'));var utils=require(_0x45a6('0x15'));var config=require(_0x45a6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2173d3,_0xbf5a36){_0xbf5a36=_0xbf5a36||0xcc;return function(_0x1ea2b3){if(_0x1ea2b3){return _0x2173d3[_0x45a6('0x17')](_0xbf5a36);}return _0x2173d3[_0x45a6('0x18')](_0xbf5a36)[_0x45a6('0x19')]();};}function respondWithResult(_0xd9700e,_0x283ef2){_0x283ef2=_0x283ef2||0xc8;return function(_0x40149f){if(_0x40149f){return _0xd9700e[_0x45a6('0x18')](_0x283ef2)[_0x45a6('0x1a')](_0x40149f);}};}function respondWithFilteredResult(_0x19c992,_0x53821b){return function(_0x3e70c4){if(_0x3e70c4){var _0x458eb1=typeof _0x53821b['offset']===_0x45a6('0x1b')&&typeof _0x53821b[_0x45a6('0x1c')]===_0x45a6('0x1b');var _0x51a04c=_0x3e70c4['count'];var _0x4b6eab=_0x458eb1?0x0:_0x53821b[_0x45a6('0x1d')];var _0x15c69d=_0x458eb1?_0x3e70c4[_0x45a6('0x1e')]:_0x53821b[_0x45a6('0x1d')]+_0x53821b[_0x45a6('0x1c')];var _0x321f94;if(_0x15c69d>=_0x51a04c){_0x15c69d=_0x51a04c;_0x321f94=0xc8;}else{_0x321f94=0xce;}_0x19c992['status'](_0x321f94);return _0x19c992[_0x45a6('0x1f')](_0x45a6('0x20'),_0x4b6eab+'-'+_0x15c69d+'/'+_0x51a04c)[_0x45a6('0x1a')](_0x3e70c4);}return null;};}function patchUpdates(_0x2888dd){return function(_0x137cf4){try{jsonpatch[_0x45a6('0x21')](_0x137cf4,_0x2888dd,!![]);}catch(_0x36a5c4){return BPromise['reject'](_0x36a5c4);}return _0x137cf4[_0x45a6('0x22')]();};}function saveUpdates(_0xe9ffc3,_0x171c3a){return function(_0xe05b13){if(_0xe05b13){return _0xe05b13[_0x45a6('0x23')](_0xe9ffc3)['then'](function(_0x4bf4b1){return _0x4bf4b1;});}return null;};}function removeEntity(_0x8f5ac4,_0x27a360){return function(_0x7283b0){if(_0x7283b0){return _0x7283b0[_0x45a6('0x24')]()[_0x45a6('0x25')](function(){_0x8f5ac4[_0x45a6('0x18')](0xcc)[_0x45a6('0x19')]();});}};}function handleEntityNotFound(_0x44ead2,_0x5d1107){return function(_0x4c33ca){if(!_0x4c33ca){_0x44ead2[_0x45a6('0x17')](0x194);}return _0x4c33ca;};}function handleError(_0x22b15f,_0x3430b4){_0x3430b4=_0x3430b4||0x1f4;return function(_0x260a03){logger[_0x45a6('0x26')](_0x260a03[_0x45a6('0x27')]);if(_0x260a03[_0x45a6('0x28')]){delete _0x260a03[_0x45a6('0x28')];}_0x22b15f[_0x45a6('0x18')](_0x3430b4)[_0x45a6('0x29')](_0x260a03);};}exports[_0x45a6('0x2a')]=function(_0x5c3f6e,_0xcd6524){var _0xe66b5e={},_0xd88283={},_0x12cd4e={'count':0x0,'rows':[]};var _0x38730e=_[_0x45a6('0x2b')](db[_0x45a6('0x2c')][_0x45a6('0x2d')],function(_0x166e4a){return{'name':_0x166e4a[_0x45a6('0x2e')],'type':_0x166e4a[_0x45a6('0x2f')][_0x45a6('0x30')]};});_0xd88283[_0x45a6('0x31')]=_[_0x45a6('0x2b')](_0x38730e,_0x45a6('0x28'));_0xd88283[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x5c3f6e[_0x45a6('0x32')]);_0xd88283['filters']=_['intersection'](_0xd88283['model'],_0xd88283[_0x45a6('0x32')]);_0xe66b5e[_0x45a6('0x34')]=_[_0x45a6('0x35')](_0xd88283[_0x45a6('0x31')],qs[_0x45a6('0x36')](_0x5c3f6e[_0x45a6('0x32')][_0x45a6('0x36')]));_0xe66b5e['attributes']=_0xe66b5e[_0x45a6('0x34')]['length']?_0xe66b5e[_0x45a6('0x34')]:_0xd88283['model'];if(!_0x5c3f6e['query']['hasOwnProperty'](_0x45a6('0x37'))){_0xe66b5e[_0x45a6('0x1c')]=qs[_0x45a6('0x1c')](_0x5c3f6e[_0x45a6('0x32')][_0x45a6('0x1c')]);_0xe66b5e[_0x45a6('0x1d')]=qs['offset'](_0x5c3f6e['query'][_0x45a6('0x1d')]);}_0xe66b5e[_0x45a6('0x38')]=qs['sort'](_0x5c3f6e['query'][_0x45a6('0x39')]);_0xe66b5e['where']=qs[_0x45a6('0x3a')](_[_0x45a6('0x3b')](_0x5c3f6e[_0x45a6('0x32')],_0xd88283['filters']),_0x38730e);if(_0x5c3f6e[_0x45a6('0x32')][_0x45a6('0x3c')]){_0xe66b5e[_0x45a6('0x3d')]=_['merge'](_0xe66b5e['where'],{'$or':_[_0x45a6('0x2b')](_0x38730e,function(_0xb4dcf0){if(_0xb4dcf0[_0x45a6('0x2f')]!==_0x45a6('0x3e')){var _0x3f2a85={};_0x3f2a85[_0xb4dcf0[_0x45a6('0x28')]]={'$like':'%'+_0x5c3f6e['query'][_0x45a6('0x3c')]+'%'};return _0x3f2a85;}})});}_0xe66b5e=_[_0x45a6('0x3f')]({},_0xe66b5e,_0x5c3f6e[_0x45a6('0x40')]);var _0x57a29f={'where':_0xe66b5e['where']};return db[_0x45a6('0x2c')][_0x45a6('0x1e')](_0x57a29f)[_0x45a6('0x25')](function(_0x1798e1){_0x12cd4e[_0x45a6('0x1e')]=_0x1798e1;if(_0x5c3f6e[_0x45a6('0x32')][_0x45a6('0x41')]){_0xe66b5e[_0x45a6('0x42')]=[{'all':!![]}];}return db[_0x45a6('0x2c')][_0x45a6('0x43')](_0xe66b5e);})[_0x45a6('0x25')](function(_0x111de5){_0x12cd4e[_0x45a6('0x44')]=_0x111de5;return _0x12cd4e;})[_0x45a6('0x25')](respondWithFilteredResult(_0xcd6524,_0xe66b5e))['catch'](handleError(_0xcd6524,null));};exports[_0x45a6('0x45')]=function(_0x5794e3,_0x3612a3){var _0x45f7f1={'raw':![],'where':{'id':_0x5794e3[_0x45a6('0x46')]['id']}},_0x442615={};_0x442615[_0x45a6('0x31')]=_[_0x45a6('0x33')](db[_0x45a6('0x2c')][_0x45a6('0x2d')]);_0x442615['query']=_[_0x45a6('0x33')](_0x5794e3['query']);_0x442615[_0x45a6('0x3a')]=_[_0x45a6('0x35')](_0x442615[_0x45a6('0x31')],_0x442615[_0x45a6('0x32')]);_0x45f7f1[_0x45a6('0x34')]=_[_0x45a6('0x35')](_0x442615[_0x45a6('0x31')],qs['fields'](_0x5794e3['query'][_0x45a6('0x36')]));_0x45f7f1[_0x45a6('0x34')]=_0x45f7f1[_0x45a6('0x34')][_0x45a6('0x47')]?_0x45f7f1['attributes']:_0x442615['model'];if(_0x5794e3[_0x45a6('0x32')][_0x45a6('0x41')]){_0x45f7f1['include']=[{'all':!![]}];}_0x45f7f1=_[_0x45a6('0x3f')]({},_0x45f7f1,_0x5794e3['options']);return db[_0x45a6('0x2c')][_0x45a6('0x48')](_0x45f7f1)[_0x45a6('0x25')](handleEntityNotFound(_0x3612a3,null))[_0x45a6('0x25')](respondWithResult(_0x3612a3,null))[_0x45a6('0x49')](handleError(_0x3612a3,null));};exports[_0x45a6('0x4a')]=function(_0x4760b6,_0x1b3de0){return db[_0x45a6('0x2c')][_0x45a6('0x4a')](_0x4760b6[_0x45a6('0x4b')],{})['then'](respondWithResult(_0x1b3de0,0xc9))[_0x45a6('0x49')](handleError(_0x1b3de0,null));};exports[_0x45a6('0x23')]=function(_0x4fac9c,_0xf54ddd){if(_0x4fac9c[_0x45a6('0x4b')]['id']){delete _0x4fac9c[_0x45a6('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0x45a6('0x48')]({'where':{'id':_0x4fac9c[_0x45a6('0x46')]['id']}})['then'](handleEntityNotFound(_0xf54ddd,null))['then'](saveUpdates(_0x4fac9c[_0x45a6('0x4b')],null))[_0x45a6('0x25')](respondWithResult(_0xf54ddd,null))[_0x45a6('0x49')](handleError(_0xf54ddd,null));};exports['destroy']=function(_0x568ca6,_0x328e42){return db['FreshdeskConfiguration'][_0x45a6('0x48')]({'where':{'id':_0x568ca6[_0x45a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x328e42,null))['then'](removeEntity(_0x328e42,null))[_0x45a6('0x49')](handleError(_0x328e42,null));};exports[_0x45a6('0x4c')]=function(_0x119241,_0x52488b,_0x2b08a6){var _0x43c02a={};var _0x47c0f4={};var _0x47408a;var _0x5b5528;return db[_0x45a6('0x2c')][_0x45a6('0x4d')]({'where':{'id':_0x119241[_0x45a6('0x46')]['id']}})[_0x45a6('0x25')](handleEntityNotFound(_0x52488b,null))[_0x45a6('0x25')](function(_0x268345){if(_0x268345){_0x47408a=_0x268345;_0x47c0f4['model']=_[_0x45a6('0x33')](db[_0x45a6('0x4e')][_0x45a6('0x2d')]);_0x47c0f4[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x119241[_0x45a6('0x32')]);_0x47c0f4['filters']=_['intersection'](_0x47c0f4[_0x45a6('0x31')],_0x47c0f4[_0x45a6('0x32')]);_0x43c02a[_0x45a6('0x34')]=_[_0x45a6('0x35')](_0x47c0f4['model'],qs[_0x45a6('0x36')](_0x119241[_0x45a6('0x32')][_0x45a6('0x36')]));_0x43c02a[_0x45a6('0x34')]=_0x43c02a[_0x45a6('0x34')][_0x45a6('0x47')]?_0x43c02a[_0x45a6('0x34')]:_0x47c0f4[_0x45a6('0x31')];_0x43c02a[_0x45a6('0x38')]=qs[_0x45a6('0x39')](_0x119241[_0x45a6('0x32')][_0x45a6('0x39')]);_0x43c02a['where']=qs['filters'](_[_0x45a6('0x3b')](_0x119241[_0x45a6('0x32')],_0x47c0f4[_0x45a6('0x3a')]));if(_0x119241[_0x45a6('0x32')][_0x45a6('0x3c')]){_0x43c02a[_0x45a6('0x3d')]=_[_0x45a6('0x3f')](_0x43c02a[_0x45a6('0x3d')],{'$or':_[_0x45a6('0x2b')](_0x43c02a[_0x45a6('0x34')],function(_0x218465){var _0x35cb91={};_0x35cb91[_0x218465]={'$like':'%'+_0x119241[_0x45a6('0x32')][_0x45a6('0x3c')]+'%'};return _0x35cb91;})});}_0x43c02a=_['merge']({},_0x43c02a,_0x119241[_0x45a6('0x40')]);return _0x47408a[_0x45a6('0x4c')](_0x43c02a);}})[_0x45a6('0x25')](function(_0x5ddb58){if(_0x5ddb58){_0x5b5528=_0x5ddb58[_0x45a6('0x47')];if(!_0x119241[_0x45a6('0x32')]['hasOwnProperty'](_0x45a6('0x37'))){_0x43c02a['limit']=qs[_0x45a6('0x1c')](_0x119241[_0x45a6('0x32')][_0x45a6('0x1c')]);_0x43c02a[_0x45a6('0x1d')]=qs[_0x45a6('0x1d')](_0x119241[_0x45a6('0x32')][_0x45a6('0x1d')]);}return _0x47408a[_0x45a6('0x4c')](_0x43c02a);}})[_0x45a6('0x25')](function(_0x4707d2){if(_0x4707d2){return _0x4707d2?{'count':_0x5b5528,'rows':_0x4707d2}:null;}})[_0x45a6('0x25')](respondWithResult(_0x52488b,null))[_0x45a6('0x49')](handleError(_0x52488b,null));};exports[_0x45a6('0x4f')]=function(_0x316abe,_0x41f93d,_0x950c35){var _0x58ee73={};var _0x28543b={};var _0x463e36;var _0x3ba1db;return db['FreshdeskConfiguration'][_0x45a6('0x4d')]({'where':{'id':_0x316abe['params']['id']}})[_0x45a6('0x25')](handleEntityNotFound(_0x41f93d,null))[_0x45a6('0x25')](function(_0x851e7a){if(_0x851e7a){_0x463e36=_0x851e7a;_0x28543b[_0x45a6('0x31')]=_[_0x45a6('0x33')](db[_0x45a6('0x4e')][_0x45a6('0x2d')]);_0x28543b['query']=_['keys'](_0x316abe[_0x45a6('0x32')]);_0x28543b['filters']=_[_0x45a6('0x35')](_0x28543b[_0x45a6('0x31')],_0x28543b[_0x45a6('0x32')]);_0x58ee73[_0x45a6('0x34')]=_['intersection'](_0x28543b[_0x45a6('0x31')],qs[_0x45a6('0x36')](_0x316abe[_0x45a6('0x32')][_0x45a6('0x36')]));_0x58ee73['attributes']=_0x58ee73[_0x45a6('0x34')][_0x45a6('0x47')]?_0x58ee73[_0x45a6('0x34')]:_0x28543b[_0x45a6('0x31')];_0x58ee73[_0x45a6('0x38')]=qs[_0x45a6('0x39')](_0x316abe[_0x45a6('0x32')][_0x45a6('0x39')]);_0x58ee73[_0x45a6('0x3d')]=qs[_0x45a6('0x3a')](_[_0x45a6('0x3b')](_0x316abe['query'],_0x28543b[_0x45a6('0x3a')]));if(_0x316abe[_0x45a6('0x32')][_0x45a6('0x3c')]){_0x58ee73[_0x45a6('0x3d')]=_['merge'](_0x58ee73['where'],{'$or':_[_0x45a6('0x2b')](_0x58ee73[_0x45a6('0x34')],function(_0x496645){var _0x331ef8={};_0x331ef8[_0x496645]={'$like':'%'+_0x316abe['query'][_0x45a6('0x3c')]+'%'};return _0x331ef8;})});}_0x58ee73=_['merge']({},_0x58ee73,_0x316abe[_0x45a6('0x40')]);return _0x463e36['getSubjects'](_0x58ee73);}})[_0x45a6('0x25')](function(_0x1da1ed){if(_0x1da1ed){_0x3ba1db=_0x1da1ed[_0x45a6('0x47')];if(!_0x316abe['query'][_0x45a6('0x50')](_0x45a6('0x37'))){_0x58ee73[_0x45a6('0x1c')]=qs['limit'](_0x316abe[_0x45a6('0x32')][_0x45a6('0x1c')]);_0x58ee73[_0x45a6('0x1d')]=qs[_0x45a6('0x1d')](_0x316abe[_0x45a6('0x32')][_0x45a6('0x1d')]);}return _0x463e36[_0x45a6('0x4f')](_0x58ee73);}})[_0x45a6('0x25')](function(_0x3850ea){if(_0x3850ea){return _0x3850ea?{'count':_0x3ba1db,'rows':_0x3850ea}:null;}})[_0x45a6('0x25')](respondWithResult(_0x41f93d,null))[_0x45a6('0x49')](handleError(_0x41f93d,null));};exports[_0x45a6('0x51')]=function(_0x46e20c,_0x27a334,_0x43b4fa){var _0x19854a={};var _0x4f925d={};var _0x1ca689;var _0x54b736;return db[_0x45a6('0x2c')][_0x45a6('0x4d')]({'where':{'id':_0x46e20c[_0x45a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x27a334,null))[_0x45a6('0x25')](function(_0x149b71){if(_0x149b71){_0x1ca689=_0x149b71;_0x4f925d[_0x45a6('0x31')]=_[_0x45a6('0x33')](db[_0x45a6('0x4e')][_0x45a6('0x2d')]);_0x4f925d[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x46e20c['query']);_0x4f925d['filters']=_['intersection'](_0x4f925d[_0x45a6('0x31')],_0x4f925d[_0x45a6('0x32')]);_0x19854a[_0x45a6('0x34')]=_[_0x45a6('0x35')](_0x4f925d[_0x45a6('0x31')],qs[_0x45a6('0x36')](_0x46e20c['query']['fields']));_0x19854a[_0x45a6('0x34')]=_0x19854a[_0x45a6('0x34')][_0x45a6('0x47')]?_0x19854a['attributes']:_0x4f925d[_0x45a6('0x31')];_0x19854a[_0x45a6('0x38')]=qs['sort'](_0x46e20c['query'][_0x45a6('0x39')]);_0x19854a['where']=qs[_0x45a6('0x3a')](_[_0x45a6('0x3b')](_0x46e20c[_0x45a6('0x32')],_0x4f925d['filters']));if(_0x46e20c[_0x45a6('0x32')][_0x45a6('0x3c')]){_0x19854a[_0x45a6('0x3d')]=_[_0x45a6('0x3f')](_0x19854a[_0x45a6('0x3d')],{'$or':_['map'](_0x19854a['attributes'],function(_0x88eebc){var _0xc45062={};_0xc45062[_0x88eebc]={'$like':'%'+_0x46e20c[_0x45a6('0x32')][_0x45a6('0x3c')]+'%'};return _0xc45062;})});}_0x19854a=_[_0x45a6('0x3f')]({},_0x19854a,_0x46e20c[_0x45a6('0x40')]);return _0x1ca689[_0x45a6('0x51')](_0x19854a);}})[_0x45a6('0x25')](function(_0x4c3c3e){if(_0x4c3c3e){_0x54b736=_0x4c3c3e[_0x45a6('0x47')];if(!_0x46e20c[_0x45a6('0x32')]['hasOwnProperty'](_0x45a6('0x37'))){_0x19854a[_0x45a6('0x1c')]=qs[_0x45a6('0x1c')](_0x46e20c[_0x45a6('0x32')]['limit']);_0x19854a[_0x45a6('0x1d')]=qs['offset'](_0x46e20c[_0x45a6('0x32')][_0x45a6('0x1d')]);}return _0x1ca689[_0x45a6('0x51')](_0x19854a);}})[_0x45a6('0x25')](function(_0x4efe86){if(_0x4efe86){return _0x4efe86?{'count':_0x54b736,'rows':_0x4efe86}:null;}})['then'](respondWithResult(_0x27a334,null))[_0x45a6('0x49')](handleError(_0x27a334,null));};exports[_0x45a6('0x52')]=function(_0x44a3e8,_0x249d4c,_0x2f9245){var _0x4eaa92={};var _0x5da9a0={};var _0xdbbd3f;var _0x1f13b8;return db[_0x45a6('0x2c')][_0x45a6('0x4d')]({'where':{'id':_0x44a3e8[_0x45a6('0x46')]['id']}})[_0x45a6('0x25')](handleEntityNotFound(_0x249d4c,null))['then'](function(_0x123c63){if(_0x123c63){_0xdbbd3f=_0x123c63;_0x5da9a0[_0x45a6('0x31')]=_[_0x45a6('0x33')](db[_0x45a6('0x53')][_0x45a6('0x2d')]);_0x5da9a0[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x44a3e8[_0x45a6('0x32')]);_0x5da9a0[_0x45a6('0x3a')]=_[_0x45a6('0x35')](_0x5da9a0[_0x45a6('0x31')],_0x5da9a0[_0x45a6('0x32')]);_0x4eaa92[_0x45a6('0x34')]=_['intersection'](_0x5da9a0[_0x45a6('0x31')],qs['fields'](_0x44a3e8[_0x45a6('0x32')][_0x45a6('0x36')]));_0x4eaa92[_0x45a6('0x34')]=_0x4eaa92['attributes'][_0x45a6('0x47')]?_0x4eaa92[_0x45a6('0x34')]:_0x5da9a0[_0x45a6('0x31')];_0x4eaa92[_0x45a6('0x38')]=qs[_0x45a6('0x39')](_0x44a3e8[_0x45a6('0x32')][_0x45a6('0x39')]);_0x4eaa92[_0x45a6('0x3d')]=qs[_0x45a6('0x3a')](_['pick'](_0x44a3e8[_0x45a6('0x32')],_0x5da9a0['filters']));if(_0x44a3e8[_0x45a6('0x32')][_0x45a6('0x3c')]){_0x4eaa92[_0x45a6('0x3d')]=_[_0x45a6('0x3f')](_0x4eaa92[_0x45a6('0x3d')],{'$or':_[_0x45a6('0x2b')](_0x4eaa92['attributes'],function(_0x690813){var _0x243548={};_0x243548[_0x690813]={'$like':'%'+_0x44a3e8['query'][_0x45a6('0x3c')]+'%'};return _0x243548;})});}_0x4eaa92=_[_0x45a6('0x3f')]({},_0x4eaa92,_0x44a3e8['options']);return _0xdbbd3f[_0x45a6('0x52')](_0x4eaa92);}})[_0x45a6('0x25')](function(_0x1c66f2){if(_0x1c66f2){_0x1f13b8=_0x1c66f2[_0x45a6('0x47')];if(!_0x44a3e8[_0x45a6('0x32')]['hasOwnProperty']('nolimit')){_0x4eaa92[_0x45a6('0x1c')]=qs[_0x45a6('0x1c')](_0x44a3e8['query']['limit']);_0x4eaa92[_0x45a6('0x1d')]=qs[_0x45a6('0x1d')](_0x44a3e8['query'][_0x45a6('0x1d')]);}return _0xdbbd3f['getTags'](_0x4eaa92);}})[_0x45a6('0x25')](function(_0x26642b){if(_0x26642b){return _0x26642b?{'count':_0x1f13b8,'rows':_0x26642b}:null;}})[_0x45a6('0x25')](respondWithResult(_0x249d4c,null))[_0x45a6('0x49')](handleError(_0x249d4c,null));};exports[_0x45a6('0x54')]=function(_0x1e4028,_0x22a1dc,_0x37649e){if(_0x1e4028[_0x45a6('0x4b')]['id']){delete _0x1e4028[_0x45a6('0x4b')]['id'];}return db[_0x45a6('0x2c')][_0x45a6('0x4d')]({'where':{'id':_0x1e4028[_0x45a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x22a1dc,null))[_0x45a6('0x25')](function(_0x1f70ca){if(_0x1f70ca){return _0x1f70ca[_0x45a6('0x54')](_0x1e4028['body']['ids']||[]);}return null;})[_0x45a6('0x25')](respondWithResult(_0x22a1dc,null))[_0x45a6('0x49')](handleError(_0x22a1dc,null));}; \ No newline at end of file +var _0x42d0=['params','rawAttributes','options','catch','create','body','find','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','nolimit','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','stack','name','send','index','FreshdeskConfiguration','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','show'];(function(_0x1e659c,_0x111494){var _0x2f6631=function(_0x543d20){while(--_0x543d20){_0x1e659c['push'](_0x1e659c['shift']());}};_0x2f6631(++_0x111494);}(_0x42d0,0x151));var _0x042d=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x42d0[_0x12a2a6];return _0x1754ae;};'use strict';var emlformat=require(_0x042d('0x0'));var rimraf=require(_0x042d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x042d('0x2'));var rp=require('request-promise');var moment=require(_0x042d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x042d('0x4'));var util=require(_0x042d('0x5'));var path=require(_0x042d('0x6'));var sox=require(_0x042d('0x7'));var csv=require(_0x042d('0x8'));var ejs=require(_0x042d('0x9'));var fs=require('fs');var fs_extra=require(_0x042d('0xa'));var _=require(_0x042d('0xb'));var squel=require(_0x042d('0xc'));var crypto=require('crypto');var jsforce=require(_0x042d('0xd'));var deskjs=require(_0x042d('0xe'));var toCsv=require(_0x042d('0x8'));var querystring=require(_0x042d('0xf'));var Papa=require('papaparse');var Redis=require(_0x042d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x042d('0x11'));var as=require(_0x042d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x042d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x042d('0x14'));var db=require(_0x042d('0x15'))['db'];function respondWithStatusCode(_0x2b0fad,_0x701a7){_0x701a7=_0x701a7||0xcc;return function(_0x52a622){if(_0x52a622){return _0x2b0fad['sendStatus'](_0x701a7);}return _0x2b0fad[_0x042d('0x16')](_0x701a7)[_0x042d('0x17')]();};}function respondWithResult(_0x39d10d,_0x31466b){_0x31466b=_0x31466b||0xc8;return function(_0x5037a7){if(_0x5037a7){return _0x39d10d[_0x042d('0x16')](_0x31466b)[_0x042d('0x18')](_0x5037a7);}};}function respondWithFilteredResult(_0x3c2b5c,_0xdd64c6){return function(_0x2e5615){if(_0x2e5615){var _0x3a37c1=typeof _0xdd64c6[_0x042d('0x19')]==='undefined'&&typeof _0xdd64c6['limit']===_0x042d('0x1a');var _0x2f9690=_0x2e5615[_0x042d('0x1b')];var _0x22e650=_0x3a37c1?0x0:_0xdd64c6['offset'];var _0x5c3ba9=_0x3a37c1?_0x2e5615[_0x042d('0x1b')]:_0xdd64c6[_0x042d('0x19')]+_0xdd64c6['limit'];var _0x361024;if(_0x5c3ba9>=_0x2f9690){_0x5c3ba9=_0x2f9690;_0x361024=0xc8;}else{_0x361024=0xce;}_0x3c2b5c['status'](_0x361024);return _0x3c2b5c[_0x042d('0x1c')]('Content-Range',_0x22e650+'-'+_0x5c3ba9+'/'+_0x2f9690)['json'](_0x2e5615);}return null;};}function patchUpdates(_0x196a88){return function(_0x36cdf9){try{jsonpatch[_0x042d('0x1d')](_0x36cdf9,_0x196a88,!![]);}catch(_0x5c9f83){return BPromise[_0x042d('0x1e')](_0x5c9f83);}return _0x36cdf9[_0x042d('0x1f')]();};}function saveUpdates(_0x1891b4,_0x10c63e){return function(_0x1d4772){if(_0x1d4772){return _0x1d4772['update'](_0x1891b4)[_0x042d('0x20')](function(_0x3a512f){return _0x3a512f;});}return null;};}function removeEntity(_0x3af2f8,_0x28b2fa){return function(_0x51953d){if(_0x51953d){return _0x51953d[_0x042d('0x21')]()[_0x042d('0x20')](function(){_0x3af2f8[_0x042d('0x16')](0xcc)[_0x042d('0x17')]();});}};}function handleEntityNotFound(_0x230117,_0x37dcfd){return function(_0xe21e2){if(!_0xe21e2){_0x230117['sendStatus'](0x194);}return _0xe21e2;};}function handleError(_0x2eeb66,_0x590458){_0x590458=_0x590458||0x1f4;return function(_0x49edab){logger['error'](_0x49edab[_0x042d('0x22')]);if(_0x49edab[_0x042d('0x23')]){delete _0x49edab[_0x042d('0x23')];}_0x2eeb66['status'](_0x590458)[_0x042d('0x24')](_0x49edab);};}exports[_0x042d('0x25')]=function(_0x4ec26f,_0x42f52a){var _0xeb21cf={},_0xca435c={},_0x3967f7={'count':0x0,'rows':[]};var _0x1fbe44=_['map'](db[_0x042d('0x26')]['rawAttributes'],function(_0x66a534){return{'name':_0x66a534[_0x042d('0x27')],'type':_0x66a534[_0x042d('0x28')]['key']};});_0xca435c[_0x042d('0x29')]=_[_0x042d('0x2a')](_0x1fbe44,_0x042d('0x23'));_0xca435c[_0x042d('0x2b')]=_[_0x042d('0x2c')](_0x4ec26f['query']);_0xca435c[_0x042d('0x2d')]=_[_0x042d('0x2e')](_0xca435c[_0x042d('0x29')],_0xca435c[_0x042d('0x2b')]);_0xeb21cf[_0x042d('0x2f')]=_[_0x042d('0x2e')](_0xca435c['model'],qs[_0x042d('0x30')](_0x4ec26f[_0x042d('0x2b')][_0x042d('0x30')]));_0xeb21cf['attributes']=_0xeb21cf[_0x042d('0x2f')][_0x042d('0x31')]?_0xeb21cf['attributes']:_0xca435c['model'];if(!_0x4ec26f[_0x042d('0x2b')][_0x042d('0x32')]('nolimit')){_0xeb21cf[_0x042d('0x33')]=qs[_0x042d('0x33')](_0x4ec26f[_0x042d('0x2b')][_0x042d('0x33')]);_0xeb21cf[_0x042d('0x19')]=qs[_0x042d('0x19')](_0x4ec26f[_0x042d('0x2b')]['offset']);}_0xeb21cf[_0x042d('0x34')]=qs['sort'](_0x4ec26f['query'][_0x042d('0x35')]);_0xeb21cf['where']=qs[_0x042d('0x2d')](_[_0x042d('0x36')](_0x4ec26f['query'],_0xca435c[_0x042d('0x2d')]),_0x1fbe44);if(_0x4ec26f[_0x042d('0x2b')]['filter']){_0xeb21cf[_0x042d('0x37')]=_[_0x042d('0x38')](_0xeb21cf[_0x042d('0x37')],{'$or':_['map'](_0x1fbe44,function(_0x4b925e){if(_0x4b925e[_0x042d('0x28')]!==_0x042d('0x39')){var _0x462f9b={};_0x462f9b[_0x4b925e[_0x042d('0x23')]]={'$like':'%'+_0x4ec26f[_0x042d('0x2b')][_0x042d('0x3a')]+'%'};return _0x462f9b;}})});}_0xeb21cf=_[_0x042d('0x38')]({},_0xeb21cf,_0x4ec26f['options']);var _0x5dbb38={'where':_0xeb21cf['where']};return db[_0x042d('0x26')][_0x042d('0x1b')](_0x5dbb38)[_0x042d('0x20')](function(_0x32f1b3){_0x3967f7[_0x042d('0x1b')]=_0x32f1b3;if(_0x4ec26f[_0x042d('0x2b')][_0x042d('0x3b')]){_0xeb21cf[_0x042d('0x3c')]=[{'all':!![]}];}return db[_0x042d('0x26')][_0x042d('0x3d')](_0xeb21cf);})[_0x042d('0x20')](function(_0x4afd54){_0x3967f7['rows']=_0x4afd54;return _0x3967f7;})[_0x042d('0x20')](respondWithFilteredResult(_0x42f52a,_0xeb21cf))['catch'](handleError(_0x42f52a,null));};exports[_0x042d('0x3e')]=function(_0x22bbe2,_0x393c5a){var _0x2cf555={'raw':![],'where':{'id':_0x22bbe2[_0x042d('0x3f')]['id']}},_0x55f5ec={};_0x55f5ec[_0x042d('0x29')]=_[_0x042d('0x2c')](db[_0x042d('0x26')][_0x042d('0x40')]);_0x55f5ec['query']=_[_0x042d('0x2c')](_0x22bbe2[_0x042d('0x2b')]);_0x55f5ec[_0x042d('0x2d')]=_[_0x042d('0x2e')](_0x55f5ec[_0x042d('0x29')],_0x55f5ec[_0x042d('0x2b')]);_0x2cf555[_0x042d('0x2f')]=_[_0x042d('0x2e')](_0x55f5ec[_0x042d('0x29')],qs[_0x042d('0x30')](_0x22bbe2[_0x042d('0x2b')][_0x042d('0x30')]));_0x2cf555['attributes']=_0x2cf555[_0x042d('0x2f')][_0x042d('0x31')]?_0x2cf555[_0x042d('0x2f')]:_0x55f5ec[_0x042d('0x29')];if(_0x22bbe2[_0x042d('0x2b')][_0x042d('0x3b')]){_0x2cf555[_0x042d('0x3c')]=[{'all':!![]}];}_0x2cf555=_['merge']({},_0x2cf555,_0x22bbe2[_0x042d('0x41')]);return db[_0x042d('0x26')]['find'](_0x2cf555)[_0x042d('0x20')](handleEntityNotFound(_0x393c5a,null))[_0x042d('0x20')](respondWithResult(_0x393c5a,null))[_0x042d('0x42')](handleError(_0x393c5a,null));};exports[_0x042d('0x43')]=function(_0x4e7a3f,_0x1049ea){return db[_0x042d('0x26')][_0x042d('0x43')](_0x4e7a3f[_0x042d('0x44')],{})[_0x042d('0x20')](respondWithResult(_0x1049ea,0xc9))['catch'](handleError(_0x1049ea,null));};exports['update']=function(_0x160626,_0x1318c1){if(_0x160626[_0x042d('0x44')]['id']){delete _0x160626[_0x042d('0x44')]['id'];}return db['FreshdeskConfiguration'][_0x042d('0x45')]({'where':{'id':_0x160626[_0x042d('0x3f')]['id']}})[_0x042d('0x20')](handleEntityNotFound(_0x1318c1,null))['then'](saveUpdates(_0x160626[_0x042d('0x44')],null))[_0x042d('0x20')](respondWithResult(_0x1318c1,null))[_0x042d('0x42')](handleError(_0x1318c1,null));};exports['destroy']=function(_0x79e06a,_0xe22a9a){return db['FreshdeskConfiguration'][_0x042d('0x45')]({'where':{'id':_0x79e06a[_0x042d('0x3f')]['id']}})[_0x042d('0x20')](handleEntityNotFound(_0xe22a9a,null))['then'](removeEntity(_0xe22a9a,null))[_0x042d('0x42')](handleError(_0xe22a9a,null));};exports[_0x042d('0x46')]=function(_0x5381fd,_0x1979b3,_0x3e986a){var _0x4c127c={};var _0x4b8d31={};var _0x4f88f4;var _0x541a91;return db[_0x042d('0x26')][_0x042d('0x47')]({'where':{'id':_0x5381fd[_0x042d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1979b3,null))['then'](function(_0x5ee5ac){if(_0x5ee5ac){_0x4f88f4=_0x5ee5ac;_0x4b8d31[_0x042d('0x29')]=_[_0x042d('0x2c')](db[_0x042d('0x48')]['rawAttributes']);_0x4b8d31[_0x042d('0x2b')]=_[_0x042d('0x2c')](_0x5381fd[_0x042d('0x2b')]);_0x4b8d31[_0x042d('0x2d')]=_[_0x042d('0x2e')](_0x4b8d31[_0x042d('0x29')],_0x4b8d31[_0x042d('0x2b')]);_0x4c127c['attributes']=_[_0x042d('0x2e')](_0x4b8d31[_0x042d('0x29')],qs[_0x042d('0x30')](_0x5381fd[_0x042d('0x2b')][_0x042d('0x30')]));_0x4c127c[_0x042d('0x2f')]=_0x4c127c[_0x042d('0x2f')][_0x042d('0x31')]?_0x4c127c[_0x042d('0x2f')]:_0x4b8d31['model'];_0x4c127c[_0x042d('0x34')]=qs['sort'](_0x5381fd[_0x042d('0x2b')][_0x042d('0x35')]);_0x4c127c[_0x042d('0x37')]=qs[_0x042d('0x2d')](_[_0x042d('0x36')](_0x5381fd['query'],_0x4b8d31[_0x042d('0x2d')]));if(_0x5381fd[_0x042d('0x2b')][_0x042d('0x3a')]){_0x4c127c[_0x042d('0x37')]=_['merge'](_0x4c127c[_0x042d('0x37')],{'$or':_[_0x042d('0x2a')](_0x4c127c[_0x042d('0x2f')],function(_0x30d0bb){var _0x2e1d8e={};_0x2e1d8e[_0x30d0bb]={'$like':'%'+_0x5381fd[_0x042d('0x2b')][_0x042d('0x3a')]+'%'};return _0x2e1d8e;})});}_0x4c127c=_['merge']({},_0x4c127c,_0x5381fd['options']);return _0x4f88f4[_0x042d('0x46')](_0x4c127c);}})[_0x042d('0x20')](function(_0x3c63b5){if(_0x3c63b5){_0x541a91=_0x3c63b5[_0x042d('0x31')];if(!_0x5381fd[_0x042d('0x2b')][_0x042d('0x32')]('nolimit')){_0x4c127c[_0x042d('0x33')]=qs[_0x042d('0x33')](_0x5381fd[_0x042d('0x2b')][_0x042d('0x33')]);_0x4c127c[_0x042d('0x19')]=qs[_0x042d('0x19')](_0x5381fd[_0x042d('0x2b')][_0x042d('0x19')]);}return _0x4f88f4[_0x042d('0x46')](_0x4c127c);}})['then'](function(_0x53f4a1){if(_0x53f4a1){return _0x53f4a1?{'count':_0x541a91,'rows':_0x53f4a1}:null;}})['then'](respondWithResult(_0x1979b3,null))['catch'](handleError(_0x1979b3,null));};exports[_0x042d('0x49')]=function(_0x26610a,_0x43bd2a,_0x26993e){var _0x50fcbe={};var _0x1e5b5b={};var _0xd92375;var _0x2e03d4;return db[_0x042d('0x26')][_0x042d('0x47')]({'where':{'id':_0x26610a[_0x042d('0x3f')]['id']}})[_0x042d('0x20')](handleEntityNotFound(_0x43bd2a,null))[_0x042d('0x20')](function(_0x41658c){if(_0x41658c){_0xd92375=_0x41658c;_0x1e5b5b[_0x042d('0x29')]=_[_0x042d('0x2c')](db[_0x042d('0x48')][_0x042d('0x40')]);_0x1e5b5b[_0x042d('0x2b')]=_[_0x042d('0x2c')](_0x26610a[_0x042d('0x2b')]);_0x1e5b5b[_0x042d('0x2d')]=_['intersection'](_0x1e5b5b[_0x042d('0x29')],_0x1e5b5b['query']);_0x50fcbe[_0x042d('0x2f')]=_[_0x042d('0x2e')](_0x1e5b5b[_0x042d('0x29')],qs[_0x042d('0x30')](_0x26610a[_0x042d('0x2b')][_0x042d('0x30')]));_0x50fcbe['attributes']=_0x50fcbe[_0x042d('0x2f')][_0x042d('0x31')]?_0x50fcbe[_0x042d('0x2f')]:_0x1e5b5b[_0x042d('0x29')];_0x50fcbe[_0x042d('0x34')]=qs[_0x042d('0x35')](_0x26610a[_0x042d('0x2b')][_0x042d('0x35')]);_0x50fcbe['where']=qs[_0x042d('0x2d')](_['pick'](_0x26610a[_0x042d('0x2b')],_0x1e5b5b[_0x042d('0x2d')]));if(_0x26610a['query']['filter']){_0x50fcbe['where']=_['merge'](_0x50fcbe[_0x042d('0x37')],{'$or':_['map'](_0x50fcbe[_0x042d('0x2f')],function(_0x4e7452){var _0x150360={};_0x150360[_0x4e7452]={'$like':'%'+_0x26610a['query'][_0x042d('0x3a')]+'%'};return _0x150360;})});}_0x50fcbe=_['merge']({},_0x50fcbe,_0x26610a['options']);return _0xd92375['getSubjects'](_0x50fcbe);}})['then'](function(_0xb16da4){if(_0xb16da4){_0x2e03d4=_0xb16da4[_0x042d('0x31')];if(!_0x26610a[_0x042d('0x2b')][_0x042d('0x32')]('nolimit')){_0x50fcbe[_0x042d('0x33')]=qs[_0x042d('0x33')](_0x26610a['query']['limit']);_0x50fcbe[_0x042d('0x19')]=qs[_0x042d('0x19')](_0x26610a['query'][_0x042d('0x19')]);}return _0xd92375['getSubjects'](_0x50fcbe);}})[_0x042d('0x20')](function(_0x3bbd65){if(_0x3bbd65){return _0x3bbd65?{'count':_0x2e03d4,'rows':_0x3bbd65}:null;}})[_0x042d('0x20')](respondWithResult(_0x43bd2a,null))['catch'](handleError(_0x43bd2a,null));};exports[_0x042d('0x4a')]=function(_0x37999a,_0x5b7526,_0x5975a4){var _0x3bd04e={};var _0x3392a4={};var _0x4f948f;var _0x57a6a1;return db[_0x042d('0x26')][_0x042d('0x47')]({'where':{'id':_0x37999a[_0x042d('0x3f')]['id']}})[_0x042d('0x20')](handleEntityNotFound(_0x5b7526,null))['then'](function(_0x4a5fac){if(_0x4a5fac){_0x4f948f=_0x4a5fac;_0x3392a4[_0x042d('0x29')]=_[_0x042d('0x2c')](db[_0x042d('0x48')][_0x042d('0x40')]);_0x3392a4['query']=_[_0x042d('0x2c')](_0x37999a[_0x042d('0x2b')]);_0x3392a4['filters']=_[_0x042d('0x2e')](_0x3392a4[_0x042d('0x29')],_0x3392a4[_0x042d('0x2b')]);_0x3bd04e[_0x042d('0x2f')]=_[_0x042d('0x2e')](_0x3392a4[_0x042d('0x29')],qs[_0x042d('0x30')](_0x37999a['query']['fields']));_0x3bd04e[_0x042d('0x2f')]=_0x3bd04e[_0x042d('0x2f')][_0x042d('0x31')]?_0x3bd04e[_0x042d('0x2f')]:_0x3392a4['model'];_0x3bd04e[_0x042d('0x34')]=qs[_0x042d('0x35')](_0x37999a['query'][_0x042d('0x35')]);_0x3bd04e[_0x042d('0x37')]=qs['filters'](_['pick'](_0x37999a[_0x042d('0x2b')],_0x3392a4['filters']));if(_0x37999a[_0x042d('0x2b')][_0x042d('0x3a')]){_0x3bd04e[_0x042d('0x37')]=_['merge'](_0x3bd04e[_0x042d('0x37')],{'$or':_[_0x042d('0x2a')](_0x3bd04e[_0x042d('0x2f')],function(_0x2c8511){var _0x22aaf9={};_0x22aaf9[_0x2c8511]={'$like':'%'+_0x37999a['query']['filter']+'%'};return _0x22aaf9;})});}_0x3bd04e=_[_0x042d('0x38')]({},_0x3bd04e,_0x37999a[_0x042d('0x41')]);return _0x4f948f[_0x042d('0x4a')](_0x3bd04e);}})['then'](function(_0x80cc78){if(_0x80cc78){_0x57a6a1=_0x80cc78[_0x042d('0x31')];if(!_0x37999a[_0x042d('0x2b')][_0x042d('0x32')](_0x042d('0x4b'))){_0x3bd04e[_0x042d('0x33')]=qs[_0x042d('0x33')](_0x37999a[_0x042d('0x2b')][_0x042d('0x33')]);_0x3bd04e[_0x042d('0x19')]=qs['offset'](_0x37999a[_0x042d('0x2b')][_0x042d('0x19')]);}return _0x4f948f['getDescriptions'](_0x3bd04e);}})['then'](function(_0x2f0fc0){if(_0x2f0fc0){return _0x2f0fc0?{'count':_0x57a6a1,'rows':_0x2f0fc0}:null;}})[_0x042d('0x20')](respondWithResult(_0x5b7526,null))[_0x042d('0x42')](handleError(_0x5b7526,null));};exports[_0x042d('0x4c')]=function(_0x125550,_0x2d1920,_0x430d1){var _0x3e0ad3={};var _0x5478da={};var _0x280ad6;var _0x1e298f;return db[_0x042d('0x26')][_0x042d('0x47')]({'where':{'id':_0x125550['params']['id']}})[_0x042d('0x20')](handleEntityNotFound(_0x2d1920,null))[_0x042d('0x20')](function(_0x35835b){if(_0x35835b){_0x280ad6=_0x35835b;_0x5478da['model']=_[_0x042d('0x2c')](db[_0x042d('0x4d')][_0x042d('0x40')]);_0x5478da[_0x042d('0x2b')]=_['keys'](_0x125550[_0x042d('0x2b')]);_0x5478da[_0x042d('0x2d')]=_[_0x042d('0x2e')](_0x5478da['model'],_0x5478da[_0x042d('0x2b')]);_0x3e0ad3['attributes']=_[_0x042d('0x2e')](_0x5478da['model'],qs[_0x042d('0x30')](_0x125550[_0x042d('0x2b')][_0x042d('0x30')]));_0x3e0ad3[_0x042d('0x2f')]=_0x3e0ad3[_0x042d('0x2f')]['length']?_0x3e0ad3[_0x042d('0x2f')]:_0x5478da[_0x042d('0x29')];_0x3e0ad3[_0x042d('0x34')]=qs[_0x042d('0x35')](_0x125550[_0x042d('0x2b')][_0x042d('0x35')]);_0x3e0ad3[_0x042d('0x37')]=qs[_0x042d('0x2d')](_[_0x042d('0x36')](_0x125550[_0x042d('0x2b')],_0x5478da[_0x042d('0x2d')]));if(_0x125550[_0x042d('0x2b')][_0x042d('0x3a')]){_0x3e0ad3[_0x042d('0x37')]=_['merge'](_0x3e0ad3['where'],{'$or':_['map'](_0x3e0ad3[_0x042d('0x2f')],function(_0x3e3930){var _0x11c49b={};_0x11c49b[_0x3e3930]={'$like':'%'+_0x125550[_0x042d('0x2b')][_0x042d('0x3a')]+'%'};return _0x11c49b;})});}_0x3e0ad3=_[_0x042d('0x38')]({},_0x3e0ad3,_0x125550[_0x042d('0x41')]);return _0x280ad6['getTags'](_0x3e0ad3);}})[_0x042d('0x20')](function(_0x4f1641){if(_0x4f1641){_0x1e298f=_0x4f1641['length'];if(!_0x125550[_0x042d('0x2b')]['hasOwnProperty'](_0x042d('0x4b'))){_0x3e0ad3['limit']=qs['limit'](_0x125550['query'][_0x042d('0x33')]);_0x3e0ad3[_0x042d('0x19')]=qs[_0x042d('0x19')](_0x125550[_0x042d('0x2b')][_0x042d('0x19')]);}return _0x280ad6[_0x042d('0x4c')](_0x3e0ad3);}})['then'](function(_0x3f7b88){if(_0x3f7b88){return _0x3f7b88?{'count':_0x1e298f,'rows':_0x3f7b88}:null;}})[_0x042d('0x20')](respondWithResult(_0x2d1920,null))[_0x042d('0x42')](handleError(_0x2d1920,null));};exports[_0x042d('0x4e')]=function(_0x150a53,_0x40822a,_0x33863c){if(_0x150a53[_0x042d('0x44')]['id']){delete _0x150a53[_0x042d('0x44')]['id'];}return db[_0x042d('0x26')][_0x042d('0x47')]({'where':{'id':_0x150a53[_0x042d('0x3f')]['id']}})[_0x042d('0x20')](handleEntityNotFound(_0x40822a,null))['then'](function(_0x257a70){if(_0x257a70){return _0x257a70[_0x042d('0x4e')](_0x150a53[_0x042d('0x44')][_0x042d('0x4f')]||[]);}return null;})[_0x042d('0x20')](respondWithResult(_0x40822a,null))['catch'](handleError(_0x40822a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f5f89b4..e459f7b 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 _0x693b=['request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x37bab4,_0x4fa85e){var _0x336d20=function(_0xdd4ab8){while(--_0xdd4ab8){_0x37bab4['push'](_0x37bab4['shift']());}};_0x336d20(++_0x4fa85e);}(_0x693b,0x14d));var _0xb693=function(_0x393b85,_0x548368){_0x393b85=_0x393b85-0x0;var _0x10925f=_0x693b[_0x393b85];return _0x10925f;};'use strict';var _=require(_0xb693('0x0'));var util=require(_0xb693('0x1'));var logger=require(_0xb693('0x2'))(_0xb693('0x3'));var moment=require('moment');var BPromise=require(_0xb693('0x4'));var rp=require(_0xb693('0x5'));var fs=require('fs');var path=require(_0xb693('0x6'));var rimraf=require(_0xb693('0x7'));var config=require(_0xb693('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xb693('0x9')]=function(_0x35d2f7,_0x1aee4e){return _0x35d2f7[_0xb693('0xa')](_0xb693('0xb'),attributes,{'tableName':_0xb693('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf02=['./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x59832e,_0x320934){var _0x3fdb17=function(_0x176e6c){while(--_0x176e6c){_0x59832e['push'](_0x59832e['shift']());}};_0x3fdb17(++_0x320934);}(_0xbf02,0x115));var _0x2bf0=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xbf02[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x2bf0('0x0'));var util=require(_0x2bf0('0x1'));var logger=require(_0x2bf0('0x2'))(_0x2bf0('0x3'));var moment=require('moment');var BPromise=require(_0x2bf0('0x4'));var rp=require(_0x2bf0('0x5'));var fs=require('fs');var path=require(_0x2bf0('0x6'));var rimraf=require(_0x2bf0('0x7'));var config=require(_0x2bf0('0x8'));var attributes=require(_0x2bf0('0x9'));module[_0x2bf0('0xa')]=function(_0x55845d,_0x524b2e){return _0x55845d[_0x2bf0('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0x2bf0('0xc'),'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 75a5e8c..f235494 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 _0x5ea3=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x283a48,_0x1cdd21){var _0x24b344=function(_0x487635){while(--_0x487635){_0x283a48['push'](_0x283a48['shift']());}};_0x24b344(++_0x1cdd21);}(_0x5ea3,0x11c));var _0x35ea=function(_0x2c6d84,_0x193cb7){_0x2c6d84=_0x2c6d84-0x0;var _0x7d67f6=_0x5ea3[_0x2c6d84];return _0x7d67f6;};'use strict';var _=require(_0x35ea('0x0'));var util=require('util');var moment=require(_0x35ea('0x1'));var BPromise=require('bluebird');var rs=require(_0x35ea('0x2'));var fs=require('fs');var Redis=require(_0x35ea('0x3'));var db=require(_0x35ea('0x4'))['db'];var utils=require(_0x35ea('0x5'));var logger=require(_0x35ea('0x6'))(_0x35ea('0x7'));var config=require(_0x35ea('0x8'));var jayson=require(_0x35ea('0x9'));var client=jayson[_0x35ea('0xa')][_0x35ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44a282,_0x4a7b85,_0x1d1b65){return new BPromise(function(_0x4c8658,_0x34b5b2){return client['request'](_0x44a282,_0x1d1b65)[_0x35ea('0xc')](function(_0x34afa1){logger[_0x35ea('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4a7b85,_0x35ea('0xe'));logger[_0x35ea('0xf')](_0x35ea('0x10'),_0x4a7b85,_0x35ea('0xe'),JSON[_0x35ea('0x11')](_0x34afa1));if(_0x34afa1[_0x35ea('0x12')]){if(_0x34afa1['error']['code']===0x1f4){logger['error'](_0x35ea('0x13'),_0x4a7b85,_0x34afa1[_0x35ea('0x12')]['message']);return _0x34b5b2(_0x34afa1['error'][_0x35ea('0x14')]);}logger[_0x35ea('0x12')](_0x35ea('0x13'),_0x4a7b85,_0x34afa1[_0x35ea('0x12')][_0x35ea('0x14')]);return _0x4c8658(_0x34afa1[_0x35ea('0x12')][_0x35ea('0x14')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4a7b85,'request\x20sent');_0x4c8658(_0x34afa1[_0x35ea('0x15')][_0x35ea('0x14')]);}})[_0x35ea('0x16')](function(_0x4d2353){logger['error'](_0x35ea('0x13'),_0x4a7b85,_0x4d2353);_0x34b5b2(_0x4d2353);});});} \ No newline at end of file +var _0x825f=['stringify','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x825f,0x180));var _0xf825=function(_0x276bde,_0x5d22df){_0x276bde=_0x276bde-0x0;var _0x3aa2b1=_0x825f[_0x276bde];return _0x3aa2b1;};'use strict';var _=require(_0xf825('0x0'));var util=require(_0xf825('0x1'));var moment=require('moment');var BPromise=require(_0xf825('0x2'));var rs=require(_0xf825('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf825('0x4'))['db'];var utils=require(_0xf825('0x5'));var logger=require(_0xf825('0x6'))('rpc');var config=require(_0xf825('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf825('0x8')][_0xf825('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43e063,_0x2a45f8,_0x5b62ec){return new BPromise(function(_0x4a4be5,_0x380cc1){return client[_0xf825('0xa')](_0x43e063,_0x5b62ec)[_0xf825('0xb')](function(_0x21755f){logger['info'](_0xf825('0xc'),_0x2a45f8,_0xf825('0xd'));logger[_0xf825('0xe')](_0xf825('0xf'),_0x2a45f8,_0xf825('0xd'),JSON[_0xf825('0x10')](_0x21755f));if(_0x21755f[_0xf825('0x11')]){if(_0x21755f[_0xf825('0x11')]['code']===0x1f4){logger[_0xf825('0x11')](_0xf825('0xc'),_0x2a45f8,_0x21755f['error']['message']);return _0x380cc1(_0x21755f['error'][_0xf825('0x12')]);}logger['error'](_0xf825('0xc'),_0x2a45f8,_0x21755f['error'][_0xf825('0x12')]);return _0x4a4be5(_0x21755f[_0xf825('0x11')]['message']);}else{logger['info'](_0xf825('0xc'),_0x2a45f8,_0xf825('0xd'));_0x4a4be5(_0x21755f['result'][_0xf825('0x12')]);}})[_0xf825('0x13')](function(_0x465619){logger['error'](_0xf825('0xc'),_0x2a45f8,_0x465619);_0x380cc1(_0x465619);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index af843db..ac009ae 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 _0xe0f3=['index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x593675,_0x50bbaf){var _0x3a9a23=function(_0x3876d5){while(--_0x3876d5){_0x593675['push'](_0x593675['shift']());}};_0x3a9a23(++_0x50bbaf);}(_0xe0f3,0xa3));var _0x3e0f=function(_0x4a9c2c,_0x15b798){_0x4a9c2c=_0x4a9c2c-0x0;var _0x27ff1d=_0xe0f3[_0x4a9c2c];return _0x27ff1d;};'use strict';var multer=require(_0x3e0f('0x0'));var util=require(_0x3e0f('0x1'));var path=require(_0x3e0f('0x2'));var timeout=require(_0x3e0f('0x3'));var express=require(_0x3e0f('0x4'));var router=express[_0x3e0f('0x5')]();var fs_extra=require(_0x3e0f('0x6'));var auth=require(_0x3e0f('0x7'));var interaction=require(_0x3e0f('0x8'));var config=require(_0x3e0f('0x9'));var controller=require(_0x3e0f('0xa'));router[_0x3e0f('0xb')]('/',auth[_0x3e0f('0xc')](),controller[_0x3e0f('0xd')]);router['get'](_0x3e0f('0xe'),auth['isAuthenticated'](),controller[_0x3e0f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3e0f('0x10')]);router[_0x3e0f('0x11')]('/:id',auth[_0x3e0f('0xc')](),controller[_0x3e0f('0x12')]);router[_0x3e0f('0x13')](_0x3e0f('0xe'),auth[_0x3e0f('0xc')](),controller[_0x3e0f('0x14')]);module[_0x3e0f('0x15')]=router; \ No newline at end of file +var _0x7969=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','/:id','isAuthenticated','show','create','put','update','destroy','multer','util','express','Router'];(function(_0x563498,_0x415c8d){var _0x271b65=function(_0x594ba4){while(--_0x594ba4){_0x563498['push'](_0x563498['shift']());}};_0x271b65(++_0x415c8d);}(_0x7969,0x146));var _0x9796=function(_0x533256,_0x44df61){_0x533256=_0x533256-0x0;var _0x5a77ae=_0x7969[_0x533256];return _0x5a77ae;};'use strict';var multer=require(_0x9796('0x0'));var util=require(_0x9796('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9796('0x2'));var router=express[_0x9796('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9796('0x4'));var config=require(_0x9796('0x5'));var controller=require(_0x9796('0x6'));router[_0x9796('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9796('0x8'),auth[_0x9796('0x9')](),controller[_0x9796('0xa')]);router['post']('/',auth[_0x9796('0x9')](),controller[_0x9796('0xb')]);router[_0x9796('0xc')]('/:id',auth[_0x9796('0x9')](),controller[_0x9796('0xd')]);router['delete'](_0x9796('0x8'),auth['isAuthenticated'](),controller[_0x9796('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index fe3e4f9..190b997 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 _0x04e0=['exports','ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0x04e0,0x128));var _0x004e=function(_0x599fec,_0x36e8bd){_0x599fec=_0x599fec-0x0;var _0x13c142=_0x04e0[_0x599fec];return _0x13c142;};'use strict';var Sequelize=require('sequelize');module[_0x004e('0x0')]={'type':{'type':Sequelize[_0x004e('0x1')](_0x004e('0x2'),'variable',_0x004e('0x3'),'keyValue',_0x004e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x004e('0x5')]},'keyType':{'type':Sequelize[_0x004e('0x1')](_0x004e('0x2'),_0x004e('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x004e('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x004e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x369b=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x4c8395,_0x23550e){var _0x231c2b=function(_0x37e776){while(--_0x37e776){_0x4c8395['push'](_0x4c8395['shift']());}};_0x231c2b(++_0x23550e);}(_0x369b,0xd9));var _0xb369=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x369b[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0xb369('0x0'));module[_0xb369('0x1')]={'type':{'type':Sequelize[_0xb369('0x2')](_0xb369('0x3'),_0xb369('0x4'),_0xb369('0x5'),_0xb369('0x6'),'picklist'),'defaultValue':_0xb369('0x3')},'content':{'type':Sequelize[_0xb369('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb369('0x2')](_0xb369('0x3'),_0xb369('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb369('0x7')]},'idField':{'type':Sequelize[_0xb369('0x7')]},'nameField':{'type':Sequelize[_0xb369('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 1a72473..1ca928f 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 _0x70e0=['nolimit','order','sort','where','filters','filter','merge','options','include','rows','catch','show','rawAttributes','length','find','create','body','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','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','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty'];(function(_0x3c6743,_0x544a90){var _0x1e2b85=function(_0x7a5553){while(--_0x7a5553){_0x3c6743['push'](_0x3c6743['shift']());}};_0x1e2b85(++_0x544a90);}(_0x70e0,0x17b));var _0x070e=function(_0x5c600e,_0x3c2fbc){_0x5c600e=_0x5c600e-0x0;var _0x12821d=_0x70e0[_0x5c600e];return _0x12821d;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={},_0x26373b={},_0x5e8326={'count':0x0,'rows':[]};var _0x282344=_[_0x070e('0x29')](db[_0x070e('0x2a')]['rawAttributes'],function(_0x5c5f0d){return{'name':_0x5c5f0d[_0x070e('0x2b')],'type':_0x5c5f0d[_0x070e('0x2c')][_0x070e('0x2d')]};});_0x26373b['model']=_[_0x070e('0x29')](_0x282344,_0x070e('0x26'));_0x26373b[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x43dd96['query']);_0x26373b['filters']=_['intersection'](_0x26373b['model'],_0x26373b[_0x070e('0x2e')]);_0x1a1892['attributes']=_[_0x070e('0x30')](_0x26373b[_0x070e('0x31')],qs['fields'](_0x43dd96['query'][_0x070e('0x32')]));_0x1a1892[_0x070e('0x33')]=_0x1a1892['attributes']['length']?_0x1a1892[_0x070e('0x33')]:_0x26373b[_0x070e('0x31')];if(!_0x43dd96[_0x070e('0x2e')][_0x070e('0x34')](_0x070e('0x35'))){_0x1a1892['limit']=qs['limit'](_0x43dd96[_0x070e('0x2e')][_0x070e('0x1e')]);_0x1a1892[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x43dd96[_0x070e('0x2e')]['offset']);}_0x1a1892[_0x070e('0x36')]=qs[_0x070e('0x37')](_0x43dd96['query'][_0x070e('0x37')]);_0x1a1892[_0x070e('0x38')]=qs['filters'](_['pick'](_0x43dd96['query'],_0x26373b[_0x070e('0x39')]),_0x282344);if(_0x43dd96[_0x070e('0x2e')][_0x070e('0x3a')]){_0x1a1892[_0x070e('0x38')]=_[_0x070e('0x3b')](_0x1a1892['where'],{'$or':_[_0x070e('0x29')](_0x282344,function(_0xa1bb20){if(_0xa1bb20[_0x070e('0x2c')]!=='VIRTUAL'){var _0x268c5d={};_0x268c5d[_0xa1bb20[_0x070e('0x26')]]={'$like':'%'+_0x43dd96[_0x070e('0x2e')]['filter']+'%'};return _0x268c5d;}})});}_0x1a1892=_[_0x070e('0x3b')]({},_0x1a1892,_0x43dd96[_0x070e('0x3c')]);var _0x4800a9={'where':_0x1a1892[_0x070e('0x38')]};return db['FreshdeskField'][_0x070e('0x1d')](_0x4800a9)[_0x070e('0x23')](function(_0x3462d3){_0x5e8326[_0x070e('0x1d')]=_0x3462d3;if(_0x43dd96[_0x070e('0x2e')]['includeAll']){_0x1a1892[_0x070e('0x3d')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x1a1892);})[_0x070e('0x23')](function(_0x42c448){_0x5e8326[_0x070e('0x3e')]=_0x42c448;return _0x5e8326;})['then'](respondWithFilteredResult(_0x28d7f2,_0x1a1892))[_0x070e('0x3f')](handleError(_0x28d7f2,null));};exports[_0x070e('0x40')]=function(_0x556bf3,_0x7dc240){var _0x4a4ee3={'raw':!![],'where':{'id':_0x556bf3['params']['id']}},_0x13e4e0={};_0x13e4e0['model']=_['keys'](db[_0x070e('0x2a')][_0x070e('0x41')]);_0x13e4e0[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x556bf3[_0x070e('0x2e')]);_0x13e4e0['filters']=_[_0x070e('0x30')](_0x13e4e0['model'],_0x13e4e0[_0x070e('0x2e')]);_0x4a4ee3[_0x070e('0x33')]=_[_0x070e('0x30')](_0x13e4e0['model'],qs['fields'](_0x556bf3[_0x070e('0x2e')]['fields']));_0x4a4ee3[_0x070e('0x33')]=_0x4a4ee3[_0x070e('0x33')][_0x070e('0x42')]?_0x4a4ee3['attributes']:_0x13e4e0[_0x070e('0x31')];if(_0x556bf3[_0x070e('0x2e')]['includeAll']){_0x4a4ee3['include']=[{'all':!![]}];}_0x4a4ee3=_[_0x070e('0x3b')]({},_0x4a4ee3,_0x556bf3[_0x070e('0x3c')]);return db[_0x070e('0x2a')][_0x070e('0x43')](_0x4a4ee3)[_0x070e('0x23')](handleEntityNotFound(_0x7dc240,null))['then'](respondWithResult(_0x7dc240,null))[_0x070e('0x3f')](handleError(_0x7dc240,null));};exports[_0x070e('0x44')]=function(_0x427fa7,_0x391dee){return db[_0x070e('0x2a')][_0x070e('0x44')](_0x427fa7[_0x070e('0x45')],{})[_0x070e('0x23')](respondWithResult(_0x391dee,0xc9))[_0x070e('0x3f')](handleError(_0x391dee,null));};exports[_0x070e('0x22')]=function(_0x210c4d,_0x3be553){if(_0x210c4d[_0x070e('0x45')]['id']){delete _0x210c4d[_0x070e('0x45')]['id'];}return db[_0x070e('0x2a')]['find']({'where':{'id':_0x210c4d[_0x070e('0x46')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x3be553,null))[_0x070e('0x23')](saveUpdates(_0x210c4d[_0x070e('0x45')],null))[_0x070e('0x23')](respondWithResult(_0x3be553,null))[_0x070e('0x3f')](handleError(_0x3be553,null));};exports[_0x070e('0x47')]=function(_0x35dbaf,_0x1c64d2){return db['FreshdeskField'][_0x070e('0x43')]({'where':{'id':_0x35dbaf['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x1c64d2,null))[_0x070e('0x23')](removeEntity(_0x1c64d2,null))['catch'](handleError(_0x1c64d2,null));}; \ No newline at end of file +var _0xe5b5=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x423550,_0x4f4084){var _0x290904=function(_0x2dd6a5){while(--_0x2dd6a5){_0x423550['push'](_0x423550['shift']());}};_0x290904(++_0x4f4084);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0xe5b5[_0x5c4f6b];return _0x104c4e;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310f71,_0x18434e){_0x18434e=_0x18434e||0xcc;return function(_0x4559a0){if(_0x4559a0){return _0x310f71[_0x5e5b('0x1b')](_0x18434e);}return _0x310f71[_0x5e5b('0x1c')](_0x18434e)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x2e331d,_0x49edd0){_0x49edd0=_0x49edd0||0xc8;return function(_0x2b37fa){if(_0x2b37fa){return _0x2e331d[_0x5e5b('0x1c')](_0x49edd0)['json'](_0x2b37fa);}};}function respondWithFilteredResult(_0x227417,_0x578c14){return function(_0x4e9509){if(_0x4e9509){var _0x13a1cb=typeof _0x578c14[_0x5e5b('0x1e')]===_0x5e5b('0x1f')&&typeof _0x578c14['limit']===_0x5e5b('0x1f');var _0x4d490c=_0x4e9509[_0x5e5b('0x20')];var _0x45a091=_0x13a1cb?0x0:_0x578c14['offset'];var _0xe5aa6b=_0x13a1cb?_0x4e9509[_0x5e5b('0x20')]:_0x578c14[_0x5e5b('0x1e')]+_0x578c14['limit'];var _0x2bf0b7;if(_0xe5aa6b>=_0x4d490c){_0xe5aa6b=_0x4d490c;_0x2bf0b7=0xc8;}else{_0x2bf0b7=0xce;}_0x227417[_0x5e5b('0x1c')](_0x2bf0b7);return _0x227417['set'](_0x5e5b('0x21'),_0x45a091+'-'+_0xe5aa6b+'/'+_0x4d490c)[_0x5e5b('0x22')](_0x4e9509);}return null;};}function patchUpdates(_0x3c488e){return function(_0x2d8252){try{jsonpatch[_0x5e5b('0x23')](_0x2d8252,_0x3c488e,!![]);}catch(_0x33d61b){return BPromise[_0x5e5b('0x24')](_0x33d61b);}return _0x2d8252[_0x5e5b('0x25')]();};}function saveUpdates(_0x4a78e3,_0x512e46){return function(_0x256a00){if(_0x256a00){return _0x256a00[_0x5e5b('0x26')](_0x4a78e3)[_0x5e5b('0x27')](function(_0xe1c268){return _0xe1c268;});}return null;};}function removeEntity(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(_0x135c6c){return _0x135c6c[_0x5e5b('0x28')]()[_0x5e5b('0x27')](function(){_0x2e38ed[_0x5e5b('0x1c')](0xcc)[_0x5e5b('0x1d')]();});}};}function handleEntityNotFound(_0x4da321,_0x1ebb11){return function(_0x75800d){if(!_0x75800d){_0x4da321[_0x5e5b('0x1b')](0x194);}return _0x75800d;};}function handleError(_0x5a2ba8,_0x988e5d){_0x988e5d=_0x988e5d||0x1f4;return function(_0xdb2863){logger['error'](_0xdb2863[_0x5e5b('0x29')]);if(_0xdb2863[_0x5e5b('0x2a')]){delete _0xdb2863[_0x5e5b('0x2a')];}_0x5a2ba8[_0x5e5b('0x1c')](_0x988e5d)[_0x5e5b('0x2b')](_0xdb2863);};}exports[_0x5e5b('0x2c')]=function(_0x2cb695,_0x2b4351){var _0x3f6b25={},_0x42da3b={},_0xcb272c={'count':0x0,'rows':[]};var _0x28157a=_['map'](db['FreshdeskField'][_0x5e5b('0x2d')],function(_0x289f54){return{'name':_0x289f54[_0x5e5b('0x2e')],'type':_0x289f54[_0x5e5b('0x2f')][_0x5e5b('0x30')]};});_0x42da3b['model']=_[_0x5e5b('0x31')](_0x28157a,'name');_0x42da3b[_0x5e5b('0x32')]=_[_0x5e5b('0x33')](_0x2cb695[_0x5e5b('0x32')]);_0x42da3b[_0x5e5b('0x34')]=_['intersection'](_0x42da3b[_0x5e5b('0x35')],_0x42da3b[_0x5e5b('0x32')]);_0x3f6b25['attributes']=_[_0x5e5b('0x36')](_0x42da3b[_0x5e5b('0x35')],qs[_0x5e5b('0x37')](_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x37')]));_0x3f6b25[_0x5e5b('0x38')]=_0x3f6b25[_0x5e5b('0x38')][_0x5e5b('0x39')]?_0x3f6b25['attributes']:_0x42da3b[_0x5e5b('0x35')];if(!_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x3a')](_0x5e5b('0x3b'))){_0x3f6b25[_0x5e5b('0x3c')]=qs[_0x5e5b('0x3c')](_0x2cb695['query']['limit']);_0x3f6b25[_0x5e5b('0x1e')]=qs[_0x5e5b('0x1e')](_0x2cb695[_0x5e5b('0x32')]['offset']);}_0x3f6b25[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x3e')]);_0x3f6b25['where']=qs[_0x5e5b('0x34')](_[_0x5e5b('0x3f')](_0x2cb695['query'],_0x42da3b['filters']),_0x28157a);if(_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x40')]){_0x3f6b25[_0x5e5b('0x41')]=_['merge'](_0x3f6b25[_0x5e5b('0x41')],{'$or':_['map'](_0x28157a,function(_0x5cb741){if(_0x5cb741[_0x5e5b('0x2f')]!==_0x5e5b('0x42')){var _0xef0295={};_0xef0295[_0x5cb741[_0x5e5b('0x2a')]]={'$like':'%'+_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x40')]+'%'};return _0xef0295;}})});}_0x3f6b25=_[_0x5e5b('0x43')]({},_0x3f6b25,_0x2cb695[_0x5e5b('0x44')]);var _0x1034fa={'where':_0x3f6b25['where']};return db[_0x5e5b('0x45')][_0x5e5b('0x20')](_0x1034fa)['then'](function(_0x204487){_0xcb272c['count']=_0x204487;if(_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x46')]){_0x3f6b25[_0x5e5b('0x47')]=[{'all':!![]}];}return db[_0x5e5b('0x45')][_0x5e5b('0x48')](_0x3f6b25);})[_0x5e5b('0x27')](function(_0x371550){_0xcb272c[_0x5e5b('0x49')]=_0x371550;return _0xcb272c;})[_0x5e5b('0x27')](respondWithFilteredResult(_0x2b4351,_0x3f6b25))[_0x5e5b('0x4a')](handleError(_0x2b4351,null));};exports[_0x5e5b('0x4b')]=function(_0x4e6fe2,_0x2b81dd){var _0x40e8ce={'raw':!![],'where':{'id':_0x4e6fe2['params']['id']}},_0x46fec9={};_0x46fec9[_0x5e5b('0x35')]=_[_0x5e5b('0x33')](db['FreshdeskField'][_0x5e5b('0x2d')]);_0x46fec9[_0x5e5b('0x32')]=_['keys'](_0x4e6fe2[_0x5e5b('0x32')]);_0x46fec9['filters']=_['intersection'](_0x46fec9['model'],_0x46fec9[_0x5e5b('0x32')]);_0x40e8ce['attributes']=_[_0x5e5b('0x36')](_0x46fec9['model'],qs[_0x5e5b('0x37')](_0x4e6fe2[_0x5e5b('0x32')][_0x5e5b('0x37')]));_0x40e8ce[_0x5e5b('0x38')]=_0x40e8ce[_0x5e5b('0x38')][_0x5e5b('0x39')]?_0x40e8ce[_0x5e5b('0x38')]:_0x46fec9['model'];if(_0x4e6fe2['query'][_0x5e5b('0x46')]){_0x40e8ce['include']=[{'all':!![]}];}_0x40e8ce=_['merge']({},_0x40e8ce,_0x4e6fe2['options']);return db[_0x5e5b('0x45')]['find'](_0x40e8ce)[_0x5e5b('0x27')](handleEntityNotFound(_0x2b81dd,null))[_0x5e5b('0x27')](respondWithResult(_0x2b81dd,null))[_0x5e5b('0x4a')](handleError(_0x2b81dd,null));};exports[_0x5e5b('0x4c')]=function(_0x2982e7,_0x192445){return db['FreshdeskField'][_0x5e5b('0x4c')](_0x2982e7[_0x5e5b('0x4d')],{})['then'](respondWithResult(_0x192445,0xc9))[_0x5e5b('0x4a')](handleError(_0x192445,null));};exports['update']=function(_0x41e4b3,_0x36d8fa){if(_0x41e4b3[_0x5e5b('0x4d')]['id']){delete _0x41e4b3[_0x5e5b('0x4d')]['id'];}return db['FreshdeskField'][_0x5e5b('0x4e')]({'where':{'id':_0x41e4b3[_0x5e5b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36d8fa,null))[_0x5e5b('0x27')](saveUpdates(_0x41e4b3[_0x5e5b('0x4d')],null))[_0x5e5b('0x27')](respondWithResult(_0x36d8fa,null))[_0x5e5b('0x4a')](handleError(_0x36d8fa,null));};exports[_0x5e5b('0x28')]=function(_0x5ae8d0,_0x50fc9c){return db[_0x5e5b('0x45')][_0x5e5b('0x4e')]({'where':{'id':_0x5ae8d0['params']['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x50fc9c,null))[_0x5e5b('0x27')](removeEntity(_0x50fc9c,null))[_0x5e5b('0x4a')](handleError(_0x50fc9c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 7763445..7814683 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 _0xeeb9=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x40aebf,_0x31078c){var _0x826b7d=function(_0x121934){while(--_0x121934){_0x40aebf['push'](_0x40aebf['shift']());}};_0x826b7d(++_0x31078c);}(_0xeeb9,0x150));var _0x9eeb=function(_0x564883,_0x1f674d){_0x564883=_0x564883-0x0;var _0x131a99=_0xeeb9[_0x564883];return _0x131a99;};'use strict';var _=require('lodash');var util=require(_0x9eeb('0x0'));var logger=require(_0x9eeb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9eeb('0x2'));var rp=require(_0x9eeb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eeb('0x4'));var config=require(_0x9eeb('0x5'));var attributes=require('./intFreshdeskField.attributes');module[_0x9eeb('0x6')]=function(_0x4c5a2e,_0x5b88c3){return _0x4c5a2e['define'](_0x9eeb('0x7'),attributes,{'tableName':_0x9eeb('0x8'),'paranoid':![],'indexes':[{'name':_0x9eeb('0x9'),'fields':[_0x9eeb('0xa'),_0x9eeb('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x430c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','idField','util','api'];(function(_0x311e43,_0x4cccc6){var _0x4b72a5=function(_0xcf6a19){while(--_0xcf6a19){_0x311e43['push'](_0x311e43['shift']());}};_0x4b72a5(++_0x4cccc6);}(_0x430c,0x177));var _0xc430=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x430c[_0x176329];return _0x31997c;};'use strict';var _=require('lodash');var util=require(_0xc430('0x0'));var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require(_0xc430('0x4'));var fs=require('fs');var path=require(_0xc430('0x5'));var rimraf=require(_0xc430('0x6'));var config=require(_0xc430('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0xc430('0x8')]=function(_0x4e56cb,_0x3f4f89){return _0x4e56cb[_0xc430('0x9')](_0xc430('0xa'),attributes,{'tableName':_0xc430('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xc430('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index df740bb..27a0da9 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 _0xbedd=['then','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshdeskField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4c5255,_0x371165){var _0x2ba8f0=function(_0x194777){while(--_0x194777){_0x4c5255['push'](_0x4c5255['shift']());}};_0x2ba8f0(++_0x371165);}(_0xbedd,0x83));var _0xdbed=function(_0x1eabe2,_0x24666c){_0x1eabe2=_0x1eabe2-0x0;var _0x39adc0=_0xbedd[_0x1eabe2];return _0x39adc0;};'use strict';var _=require('lodash');var util=require(_0xdbed('0x0'));var moment=require(_0xdbed('0x1'));var BPromise=require(_0xdbed('0x2'));var rs=require(_0xdbed('0x3'));var fs=require('fs');var Redis=require(_0xdbed('0x4'));var db=require(_0xdbed('0x5'))['db'];var utils=require(_0xdbed('0x6'));var logger=require(_0xdbed('0x7'))(_0xdbed('0x8'));var config=require(_0xdbed('0x9'));var jayson=require(_0xdbed('0xa'));var client=jayson['client'][_0xdbed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d4c11,_0x3ed9bf,_0x38faff){return new BPromise(function(_0xa24c77,_0x502f89){return client[_0xdbed('0xc')](_0x4d4c11,_0x38faff)[_0xdbed('0xd')](function(_0x4edf55){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x3ed9bf,'request\x20sent');logger[_0xdbed('0xe')](_0xdbed('0xf'),_0x3ed9bf,_0xdbed('0x10'),JSON['stringify'](_0x4edf55));if(_0x4edf55['error']){if(_0x4edf55[_0xdbed('0x11')][_0xdbed('0x12')]===0x1f4){logger[_0xdbed('0x11')](_0xdbed('0x13'),_0x3ed9bf,_0x4edf55['error'][_0xdbed('0x14')]);return _0x502f89(_0x4edf55['error'][_0xdbed('0x14')]);}logger[_0xdbed('0x11')](_0xdbed('0x13'),_0x3ed9bf,_0x4edf55['error'][_0xdbed('0x14')]);return _0xa24c77(_0x4edf55[_0xdbed('0x11')][_0xdbed('0x14')]);}else{logger[_0xdbed('0x15')](_0xdbed('0x13'),_0x3ed9bf,_0xdbed('0x10'));_0xa24c77(_0x4edf55[_0xdbed('0x16')]['message']);}})[_0xdbed('0x17')](function(_0x3563cb){logger[_0xdbed('0x11')](_0xdbed('0x13'),_0x3ed9bf,_0x3563cb);_0x502f89(_0x3563cb);});});} \ No newline at end of file +var _0x817f=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x49d9c2,_0x40163c){var _0x504586=function(_0x2aad37){while(--_0x2aad37){_0x49d9c2['push'](_0x49d9c2['shift']());}};_0x504586(++_0x40163c);}(_0x817f,0x147));var _0xf817=function(_0xdb5808,_0x58c067){_0xdb5808=_0xdb5808-0x0;var _0x111072=_0x817f[_0xdb5808];return _0x111072;};'use strict';var _=require(_0xf817('0x0'));var util=require(_0xf817('0x1'));var moment=require(_0xf817('0x2'));var BPromise=require(_0xf817('0x3'));var rs=require(_0xf817('0x4'));var fs=require('fs');var Redis=require(_0xf817('0x5'));var db=require(_0xf817('0x6'))['db'];var utils=require(_0xf817('0x7'));var logger=require(_0xf817('0x8'))(_0xf817('0x9'));var config=require(_0xf817('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf817('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59d289,_0x51e971,_0x40b245){return new BPromise(function(_0x573266,_0x52e269){return client[_0xf817('0xc')](_0x59d289,_0x40b245)[_0xf817('0xd')](function(_0xe314ff){logger[_0xf817('0xe')](_0xf817('0xf'),_0x51e971,_0xf817('0x10'));logger[_0xf817('0x11')](_0xf817('0x12'),_0x51e971,_0xf817('0x10'),JSON[_0xf817('0x13')](_0xe314ff));if(_0xe314ff[_0xf817('0x14')]){if(_0xe314ff[_0xf817('0x14')][_0xf817('0x15')]===0x1f4){logger[_0xf817('0x14')](_0xf817('0xf'),_0x51e971,_0xe314ff[_0xf817('0x14')][_0xf817('0x16')]);return _0x52e269(_0xe314ff[_0xf817('0x14')][_0xf817('0x16')]);}logger[_0xf817('0x14')](_0xf817('0xf'),_0x51e971,_0xe314ff[_0xf817('0x14')][_0xf817('0x16')]);return _0x573266(_0xe314ff[_0xf817('0x14')][_0xf817('0x16')]);}else{logger[_0xf817('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x51e971,_0xf817('0x10'));_0x573266(_0xe314ff[_0xf817('0x17')]['message']);}})[_0xf817('0x18')](function(_0x401e69){logger[_0xf817('0x14')](_0xf817('0xf'),_0x51e971,_0x401e69);_0x52e269(_0x401e69);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a9475ec..d1361dc 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 _0xf45e=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','destroy'];(function(_0xf6e5ea,_0x1d7ab1){var _0x22e827=function(_0x3f348b){while(--_0x3f348b){_0xf6e5ea['push'](_0xf6e5ea['shift']());}};_0x22e827(++_0x1d7ab1);}(_0xf45e,0x115));var _0xef45=function(_0x4f34d8,_0x40f022){_0x4f34d8=_0x4f34d8-0x0;var _0xc97536=_0xf45e[_0x4f34d8];return _0xc97536;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var fs_extra=require(_0xef45('0x4'));var auth=require(_0xef45('0x5'));var interaction=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var controller=require(_0xef45('0x8'));router[_0xef45('0x9')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0x9')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0x9')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);router[_0xef45('0x9')]('/:id/fields',auth[_0xef45('0xa')](),controller[_0xef45('0x10')]);router[_0xef45('0x11')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0x12')]);router[_0xef45('0x11')]('/:id/configurations',auth[_0xef45('0xa')](),controller[_0xef45('0x13')]);router[_0xef45('0x14')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller['update']);router['delete'](_0xef45('0xc'),auth['isAuthenticated'](),controller[_0xef45('0x15')]);module[_0xef45('0x16')]=router; \ No newline at end of file +var _0x2547=['addConfiguration','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create'];(function(_0x573b68,_0x5a1ed5){var _0x1275ac=function(_0x33b19f){while(--_0x33b19f){_0x573b68['push'](_0x573b68['shift']());}};_0x1275ac(++_0x5a1ed5);}(_0x2547,0x1cd));var _0x7254=function(_0x1a7fe6,_0x93b0bf){_0x1a7fe6=_0x1a7fe6-0x0;var _0x17e5ee=_0x2547[_0x1a7fe6];return _0x17e5ee;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x11')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0x12')]);router['post'](_0x7254('0xe'),auth['isAuthenticated'](),controller[_0x7254('0x13')]);router['put'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0x14')]);router[_0x7254('0x15')](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0x16')]);module[_0x7254('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 2c63bc7..8082ff5 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 _0x6a95=['exports','STRING','username','sequelize'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0x6a95,0x1db));var _0x56a9=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x6a95[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa30a=['sequelize','exports','STRING','username','remoteUri'];(function(_0x12cb5b,_0x2c7116){var _0x4160b4=function(_0x67374f){while(--_0x67374f){_0x12cb5b['push'](_0x12cb5b['shift']());}};_0x4160b4(++_0x2c7116);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x3')},'apiKey':{'type':Sequelize[_0xaa30('0x2')]},'remoteUri':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x4')},'serverUrl':{'type':Sequelize[_0xaa30('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 6b241c5..294baa0 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 _0xb71c=['Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','error','stack','name','send','index','FreshsalesAccount','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','type','VIRTUAL','filter','includeAll','include','findAll','then','catch','show','params','options','create','body','update','find','getConfigurations','findOne','FreshsalesConfiguration','AccountId'];(function(_0x4c3c88,_0x42f102){var _0x1587d4=function(_0x521d65){while(--_0x521d65){_0x4c3c88['push'](_0x4c3c88['shift']());}};_0x1587d4(++_0x42f102);}(_0xb71c,0x151));var _0xcb71=function(_0x672fb,_0x65b172){_0x672fb=_0x672fb-0x0;var _0x43185f=_0xb71c[_0x672fb];return _0x43185f;};'use strict';var emlformat=require(_0xcb71('0x0'));var rimraf=require(_0xcb71('0x1'));var zipdir=require(_0xcb71('0x2'));var jsonpatch=require(_0xcb71('0x3'));var rp=require(_0xcb71('0x4'));var moment=require(_0xcb71('0x5'));var BPromise=require(_0xcb71('0x6'));var Mustache=require(_0xcb71('0x7'));var util=require(_0xcb71('0x8'));var path=require(_0xcb71('0x9'));var sox=require('sox');var csv=require(_0xcb71('0xa'));var ejs=require(_0xcb71('0xb'));var fs=require('fs');var fs_extra=require(_0xcb71('0xc'));var _=require(_0xcb71('0xd'));var squel=require(_0xcb71('0xe'));var crypto=require(_0xcb71('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xcb71('0x10'));var toCsv=require(_0xcb71('0xa'));var querystring=require(_0xcb71('0x11'));var Papa=require(_0xcb71('0x12'));var Redis=require(_0xcb71('0x13'));var authService=require(_0xcb71('0x14'));var qs=require(_0xcb71('0x15'));var as=require(_0xcb71('0x16'));var hardwareService=require(_0xcb71('0x17'));var logger=require(_0xcb71('0x18'))(_0xcb71('0x19'));var utils=require(_0xcb71('0x1a'));var config=require(_0xcb71('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb71('0x1c'))['db'];var integrations=require(_0xcb71('0x1d'));function respondWithStatusCode(_0x546b2d,_0x5f157b){_0x5f157b=_0x5f157b||0xcc;return function(_0x13419d){if(_0x13419d){return _0x546b2d[_0xcb71('0x1e')](_0x5f157b);}return _0x546b2d['status'](_0x5f157b)[_0xcb71('0x1f')]();};}function respondWithResult(_0x2b1033,_0x3c79f5){_0x3c79f5=_0x3c79f5||0xc8;return function(_0x41d1ee){if(_0x41d1ee){return _0x2b1033[_0xcb71('0x20')](_0x3c79f5)[_0xcb71('0x21')](_0x41d1ee);}};}function respondWithFilteredResult(_0x33708c,_0x5385ca){return function(_0x5f14cc){if(_0x5f14cc){var _0x3bee6b=typeof _0x5385ca[_0xcb71('0x22')]==='undefined'&&typeof _0x5385ca[_0xcb71('0x23')]===_0xcb71('0x24');var _0x216b82=_0x5f14cc[_0xcb71('0x25')];var _0x284a83=_0x3bee6b?0x0:_0x5385ca[_0xcb71('0x22')];var _0x587dfc=_0x3bee6b?_0x5f14cc[_0xcb71('0x25')]:_0x5385ca[_0xcb71('0x22')]+_0x5385ca['limit'];var _0x566b7a;if(_0x587dfc>=_0x216b82){_0x587dfc=_0x216b82;_0x566b7a=0xc8;}else{_0x566b7a=0xce;}_0x33708c[_0xcb71('0x20')](_0x566b7a);return _0x33708c[_0xcb71('0x26')](_0xcb71('0x27'),_0x284a83+'-'+_0x587dfc+'/'+_0x216b82)[_0xcb71('0x21')](_0x5f14cc);}return null;};}function patchUpdates(_0x287b7d){return function(_0x28f5b2){try{jsonpatch[_0xcb71('0x28')](_0x28f5b2,_0x287b7d,!![]);}catch(_0x24b55f){return BPromise['reject'](_0x24b55f);}return _0x28f5b2['save']();};}function saveUpdates(_0x2e0456,_0x55f640){return function(_0xba7d3c){if(_0xba7d3c){return _0xba7d3c['update'](_0x2e0456)['then'](function(_0xb67b56){return _0xb67b56;});}return null;};}function removeEntity(_0x4401e5,_0x25ee33){return function(_0x96411){if(_0x96411){return _0x96411['destroy']()['then'](function(){_0x4401e5[_0xcb71('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a3a7d,_0x57fa1a){return function(_0xe0ce13){if(!_0xe0ce13){_0x4a3a7d[_0xcb71('0x1e')](0x194);}return _0xe0ce13;};}function handleError(_0x58c492,_0x80eb67){_0x80eb67=_0x80eb67||0x1f4;return function(_0x20ca97){logger[_0xcb71('0x29')](_0x20ca97[_0xcb71('0x2a')]);if(_0x20ca97[_0xcb71('0x2b')]){delete _0x20ca97[_0xcb71('0x2b')];}_0x58c492[_0xcb71('0x20')](_0x80eb67)[_0xcb71('0x2c')](_0x20ca97);};}exports[_0xcb71('0x2d')]=function(_0x475861,_0x21ef09){var _0x553e7b={},_0x2550ae={},_0xe9157f={'count':0x0,'rows':[]};var _0x563f99=_['map'](db[_0xcb71('0x2e')][_0xcb71('0x2f')],function(_0x4efbcb){return{'name':_0x4efbcb['fieldName'],'type':_0x4efbcb['type']['key']};});_0x2550ae[_0xcb71('0x30')]=_[_0xcb71('0x31')](_0x563f99,'name');_0x2550ae[_0xcb71('0x32')]=_[_0xcb71('0x33')](_0x475861[_0xcb71('0x32')]);_0x2550ae[_0xcb71('0x34')]=_[_0xcb71('0x35')](_0x2550ae[_0xcb71('0x30')],_0x2550ae[_0xcb71('0x32')]);_0x553e7b[_0xcb71('0x36')]=_['intersection'](_0x2550ae[_0xcb71('0x30')],qs['fields'](_0x475861[_0xcb71('0x32')][_0xcb71('0x37')]));_0x553e7b[_0xcb71('0x36')]=_0x553e7b[_0xcb71('0x36')][_0xcb71('0x38')]?_0x553e7b[_0xcb71('0x36')]:_0x2550ae[_0xcb71('0x30')];if(!_0x475861[_0xcb71('0x32')][_0xcb71('0x39')](_0xcb71('0x3a'))){_0x553e7b[_0xcb71('0x23')]=qs[_0xcb71('0x23')](_0x475861['query'][_0xcb71('0x23')]);_0x553e7b[_0xcb71('0x22')]=qs['offset'](_0x475861['query'][_0xcb71('0x22')]);}_0x553e7b[_0xcb71('0x3b')]=qs[_0xcb71('0x3c')](_0x475861[_0xcb71('0x32')][_0xcb71('0x3c')]);_0x553e7b['where']=qs[_0xcb71('0x34')](_[_0xcb71('0x3d')](_0x475861[_0xcb71('0x32')],_0x2550ae['filters']),_0x563f99);if(_0x475861[_0xcb71('0x32')]['filter']){_0x553e7b['where']=_[_0xcb71('0x3e')](_0x553e7b[_0xcb71('0x3f')],{'$or':_[_0xcb71('0x31')](_0x563f99,function(_0x50db7d){if(_0x50db7d[_0xcb71('0x40')]!==_0xcb71('0x41')){var _0x4ff16e={};_0x4ff16e[_0x50db7d[_0xcb71('0x2b')]]={'$like':'%'+_0x475861['query'][_0xcb71('0x42')]+'%'};return _0x4ff16e;}})});}_0x553e7b=_[_0xcb71('0x3e')]({},_0x553e7b,_0x475861['options']);var _0x1c3e24={'where':_0x553e7b[_0xcb71('0x3f')]};return db[_0xcb71('0x2e')]['count'](_0x1c3e24)['then'](function(_0xa760eb){_0xe9157f[_0xcb71('0x25')]=_0xa760eb;if(_0x475861['query'][_0xcb71('0x43')]){_0x553e7b[_0xcb71('0x44')]=[{'all':!![]}];}return db[_0xcb71('0x2e')][_0xcb71('0x45')](_0x553e7b);})[_0xcb71('0x46')](function(_0x358639){_0xe9157f['rows']=_0x358639;return _0xe9157f;})[_0xcb71('0x46')](respondWithFilteredResult(_0x21ef09,_0x553e7b))[_0xcb71('0x47')](handleError(_0x21ef09,null));};exports[_0xcb71('0x48')]=function(_0x55f29a,_0x2b217f){var _0x12e5ad={'raw':![],'where':{'id':_0x55f29a[_0xcb71('0x49')]['id']}},_0x5c0b5f={};_0x5c0b5f[_0xcb71('0x30')]=_['keys'](db[_0xcb71('0x2e')][_0xcb71('0x2f')]);_0x5c0b5f[_0xcb71('0x32')]=_[_0xcb71('0x33')](_0x55f29a['query']);_0x5c0b5f[_0xcb71('0x34')]=_['intersection'](_0x5c0b5f[_0xcb71('0x30')],_0x5c0b5f[_0xcb71('0x32')]);_0x12e5ad[_0xcb71('0x36')]=_[_0xcb71('0x35')](_0x5c0b5f[_0xcb71('0x30')],qs[_0xcb71('0x37')](_0x55f29a[_0xcb71('0x32')]['fields']));_0x12e5ad[_0xcb71('0x36')]=_0x12e5ad['attributes']['length']?_0x12e5ad[_0xcb71('0x36')]:_0x5c0b5f[_0xcb71('0x30')];if(_0x55f29a[_0xcb71('0x32')][_0xcb71('0x43')]){_0x12e5ad['include']=[{'all':!![]}];}_0x12e5ad=_[_0xcb71('0x3e')]({},_0x12e5ad,_0x55f29a[_0xcb71('0x4a')]);return db[_0xcb71('0x2e')]['find'](_0x12e5ad)[_0xcb71('0x46')](handleEntityNotFound(_0x2b217f,null))[_0xcb71('0x46')](respondWithResult(_0x2b217f,null))[_0xcb71('0x47')](handleError(_0x2b217f,null));};exports[_0xcb71('0x4b')]=function(_0x3aaffd,_0x2d070c){return db[_0xcb71('0x2e')]['create'](_0x3aaffd[_0xcb71('0x4c')],{})[_0xcb71('0x46')](respondWithResult(_0x2d070c,0xc9))[_0xcb71('0x47')](handleError(_0x2d070c,null));};exports[_0xcb71('0x4d')]=function(_0x13ce8e,_0x3892e6){if(_0x13ce8e['body']['id']){delete _0x13ce8e['body']['id'];}return db[_0xcb71('0x2e')][_0xcb71('0x4e')]({'where':{'id':_0x13ce8e[_0xcb71('0x49')]['id']}})[_0xcb71('0x46')](handleEntityNotFound(_0x3892e6,null))[_0xcb71('0x46')](saveUpdates(_0x13ce8e[_0xcb71('0x4c')],null))[_0xcb71('0x46')](respondWithResult(_0x3892e6,null))[_0xcb71('0x47')](handleError(_0x3892e6,null));};exports['destroy']=function(_0x1a52ca,_0x3826fe){return db[_0xcb71('0x2e')][_0xcb71('0x4e')]({'where':{'id':_0x1a52ca[_0xcb71('0x49')]['id']}})[_0xcb71('0x46')](handleEntityNotFound(_0x3826fe,null))[_0xcb71('0x46')](removeEntity(_0x3826fe,null))[_0xcb71('0x47')](handleError(_0x3826fe,null));};exports[_0xcb71('0x4f')]=function(_0x1937bb,_0x326136,_0x62c106){var _0x4593e9={};var _0x3152f0={};var _0x5200ed;var _0x4ab509;return db[_0xcb71('0x2e')][_0xcb71('0x50')]({'where':{'id':_0x1937bb[_0xcb71('0x49')]['id']}})[_0xcb71('0x46')](handleEntityNotFound(_0x326136,null))[_0xcb71('0x46')](function(_0x25eeaf){if(_0x25eeaf){_0x5200ed=_0x25eeaf;_0x3152f0[_0xcb71('0x30')]=_[_0xcb71('0x33')](db[_0xcb71('0x51')][_0xcb71('0x2f')]);_0x3152f0[_0xcb71('0x32')]=_[_0xcb71('0x33')](_0x1937bb[_0xcb71('0x32')]);_0x3152f0[_0xcb71('0x34')]=_[_0xcb71('0x35')](_0x3152f0[_0xcb71('0x30')],_0x3152f0[_0xcb71('0x32')]);_0x4593e9[_0xcb71('0x36')]=_['intersection'](_0x3152f0['model'],qs[_0xcb71('0x37')](_0x1937bb['query'][_0xcb71('0x37')]));_0x4593e9[_0xcb71('0x36')]=_0x4593e9[_0xcb71('0x36')][_0xcb71('0x38')]?_0x4593e9[_0xcb71('0x36')]:_0x3152f0[_0xcb71('0x30')];_0x4593e9['order']=qs[_0xcb71('0x3c')](_0x1937bb[_0xcb71('0x32')][_0xcb71('0x3c')]);_0x4593e9[_0xcb71('0x3f')]=qs[_0xcb71('0x34')](_['pick'](_0x1937bb[_0xcb71('0x32')],_0x3152f0[_0xcb71('0x34')]));if(_0x1937bb[_0xcb71('0x32')][_0xcb71('0x42')]){_0x4593e9['where']=_['merge'](_0x4593e9['where'],{'$or':_['map'](_0x4593e9[_0xcb71('0x36')],function(_0xfddc12){var _0x5caf2e={};_0x5caf2e[_0xfddc12]={'$like':'%'+_0x1937bb[_0xcb71('0x32')][_0xcb71('0x42')]+'%'};return _0x5caf2e;})});}_0x4593e9=_[_0xcb71('0x3e')]({},_0x4593e9,_0x1937bb[_0xcb71('0x4a')]);return _0x5200ed[_0xcb71('0x4f')](_0x4593e9);}})[_0xcb71('0x46')](function(_0x2fc75b){if(_0x2fc75b){_0x4ab509=_0x2fc75b[_0xcb71('0x38')];if(!_0x1937bb['query'][_0xcb71('0x39')](_0xcb71('0x3a'))){_0x4593e9[_0xcb71('0x23')]=qs[_0xcb71('0x23')](_0x1937bb[_0xcb71('0x32')]['limit']);_0x4593e9[_0xcb71('0x22')]=qs[_0xcb71('0x22')](_0x1937bb[_0xcb71('0x32')][_0xcb71('0x22')]);}return _0x5200ed[_0xcb71('0x4f')](_0x4593e9);}})['then'](function(_0x15c3fb){if(_0x15c3fb){return _0x15c3fb?{'count':_0x4ab509,'rows':_0x15c3fb}:null;}})[_0xcb71('0x46')](respondWithResult(_0x326136,null))[_0xcb71('0x47')](handleError(_0x326136,null));};exports['addConfiguration']=function(_0x400ffb,_0x1b7ab6,_0xf43a4b){if(_0x400ffb[_0xcb71('0x4c')]['id']){delete _0x400ffb['body']['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x400ffb['params']['id']}})[_0xcb71('0x46')](handleEntityNotFound(_0x1b7ab6,null))[_0xcb71('0x46')](function(_0x5dce97){if(_0x5dce97){_0x400ffb[_0xcb71('0x4c')][_0xcb71('0x52')]=_0x5dce97['id'];_0x400ffb[_0xcb71('0x4c')][_0xcb71('0x53')]=integrations[_0xcb71('0x54')](_0x400ffb[_0xcb71('0x4c')][_0xcb71('0x55')],_0x400ffb['body'][_0xcb71('0x40')]);_0x400ffb[_0xcb71('0x4c')]['Descriptions']=integrations[_0xcb71('0x56')](_0x400ffb[_0xcb71('0x4c')]['channel'],_0x400ffb[_0xcb71('0x4c')]['type']);return db[_0xcb71('0x51')][_0xcb71('0x4b')](_0x400ffb[_0xcb71('0x4c')],{'include':[{'model':db['FreshsalesField'],'as':_0xcb71('0x53')},{'model':db['FreshsalesField'],'as':_0xcb71('0x57')}]});}return null;})[_0xcb71('0x46')](respondWithResult(_0x1b7ab6,null))['catch'](handleError(_0x1b7ab6,null));};exports[_0xcb71('0x58')]=function(_0x4fad35,_0x3127f0,_0x2e9d63){var _0x47c306='';var _0x25796e='';return db[_0xcb71('0x2e')][_0xcb71('0x50')]({'where':{'id':_0x4fad35['params']['id']},'attributes':['id','username',_0xcb71('0x59'),'apiKey']})[_0xcb71('0x46')](handleEntityNotFound(_0x3127f0,null))[_0xcb71('0x46')](function(_0x502c22){if(_0x502c22){_0x25796e=_0x502c22['username'];_0x47c306=_0x502c22[_0xcb71('0x59')];var _0x614479=_0x502c22[_0xcb71('0x59')]['slice'](-0x1);if(_0x614479==='/'){_0x47c306=_0x47c306[_0xcb71('0x5a')](0x0,_0x47c306[_0xcb71('0x5b')](_0x614479));}return rp({'method':_0xcb71('0x5c'),'uri':util[_0xcb71('0x5d')](_0xcb71('0x5e'),_0x47c306,_0xcb71('0x5f')),'headers':{'Authorization':_0xcb71('0x60')+_0x502c22[_0xcb71('0x61')]},'json':!![]});}})[_0xcb71('0x46')](function(_0x394dfb){if(_0x394dfb){var _0x5780c6=_0x394dfb[_0xcb71('0x62')];var _0x276fe3=![];var _0x40f890=null;for(_0x40f890=0x0;_0x40f890<_0x5780c6[_0xcb71('0x38')];_0x40f890++){if(_0x5780c6[_0x40f890][_0xcb71('0x63')]===_0x25796e){_0x276fe3=!![];}}if(_0x276fe3){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x3127f0,null))[_0xcb71('0x47')](function(_0xcac07c){var _0x22b575=_0x4fad35[_0xcb71('0x32')][_0xcb71('0x64')]?0x1f4:_0xcac07c[_0xcb71('0x65')]||0x1f4;logger['error'](_0xcb71('0x66'),_0xcb71('0x58'),_0x22b575,JSON[_0xcb71('0x67')](_0xcac07c));delete _0xcac07c['name'];if(_0x22b575===0x191){_0x22b575=0x190;}_0x3127f0[_0xcb71('0x20')](_0x22b575)['send'](_0x4fad35[_0xcb71('0x32')]['test']?{'message':_0xcb71('0x68'),'statusCode':_0xcac07c[_0xcb71('0x65')]}:_0xcac07c);});}; \ No newline at end of file +var _0x8980=['hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshsalesField','Subjects','Descriptions','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','/api/selector/owners','users','Requested\x20Resource\x20not\x20Found','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','json','undefined','count','offset','limit','set','reject','save','update','then','destroy','end','sendStatus','name','send','index','FreshsalesAccount','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','order','getConfigurations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8980,0x82));var _0x0898=function(_0x1d4aa8,_0x177c03){_0x1d4aa8=_0x1d4aa8-0x0;var _0x1d9b0f=_0x8980[_0x1d4aa8];return _0x1d9b0f;};'use strict';var emlformat=require(_0x0898('0x0'));var rimraf=require(_0x0898('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0898('0x2'));var rp=require(_0x0898('0x3'));var moment=require(_0x0898('0x4'));var BPromise=require(_0x0898('0x5'));var Mustache=require(_0x0898('0x6'));var util=require(_0x0898('0x7'));var path=require(_0x0898('0x8'));var sox=require(_0x0898('0x9'));var csv=require(_0x0898('0xa'));var ejs=require(_0x0898('0xb'));var fs=require('fs');var fs_extra=require(_0x0898('0xc'));var _=require(_0x0898('0xd'));var squel=require(_0x0898('0xe'));var crypto=require(_0x0898('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0898('0x10'));var toCsv=require(_0x0898('0xa'));var querystring=require(_0x0898('0x11'));var Papa=require(_0x0898('0x12'));var Redis=require(_0x0898('0x13'));var authService=require(_0x0898('0x14'));var qs=require(_0x0898('0x15'));var as=require(_0x0898('0x16'));var hardwareService=require(_0x0898('0x17'));var logger=require(_0x0898('0x18'))(_0x0898('0x19'));var utils=require(_0x0898('0x1a'));var config=require(_0x0898('0x1b'));var licenseUtil=require(_0x0898('0x1c'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0898('0x1d'));function respondWithStatusCode(_0x2b5047,_0x55681f){_0x55681f=_0x55681f||0xcc;return function(_0x159d76){if(_0x159d76){return _0x2b5047['sendStatus'](_0x55681f);}return _0x2b5047[_0x0898('0x1e')](_0x55681f)['end']();};}function respondWithResult(_0x2e95fd,_0x200800){_0x200800=_0x200800||0xc8;return function(_0x4c4294){if(_0x4c4294){return _0x2e95fd[_0x0898('0x1e')](_0x200800)[_0x0898('0x1f')](_0x4c4294);}};}function respondWithFilteredResult(_0x2e9c68,_0x3d9b81){return function(_0x30be4e){if(_0x30be4e){var _0x5195fa=typeof _0x3d9b81['offset']==='undefined'&&typeof _0x3d9b81['limit']===_0x0898('0x20');var _0x36a195=_0x30be4e[_0x0898('0x21')];var _0x1686f3=_0x5195fa?0x0:_0x3d9b81[_0x0898('0x22')];var _0x41c42d=_0x5195fa?_0x30be4e[_0x0898('0x21')]:_0x3d9b81['offset']+_0x3d9b81[_0x0898('0x23')];var _0x468c53;if(_0x41c42d>=_0x36a195){_0x41c42d=_0x36a195;_0x468c53=0xc8;}else{_0x468c53=0xce;}_0x2e9c68[_0x0898('0x1e')](_0x468c53);return _0x2e9c68[_0x0898('0x24')]('Content-Range',_0x1686f3+'-'+_0x41c42d+'/'+_0x36a195)[_0x0898('0x1f')](_0x30be4e);}return null;};}function patchUpdates(_0x4471eb){return function(_0x5034c1){try{jsonpatch['apply'](_0x5034c1,_0x4471eb,!![]);}catch(_0x51a04e){return BPromise[_0x0898('0x25')](_0x51a04e);}return _0x5034c1[_0x0898('0x26')]();};}function saveUpdates(_0x5b36d9,_0x14bfc4){return function(_0x56fcae){if(_0x56fcae){return _0x56fcae[_0x0898('0x27')](_0x5b36d9)[_0x0898('0x28')](function(_0xffcb33){return _0xffcb33;});}return null;};}function removeEntity(_0x550d08,_0x5d6e6f){return function(_0x4f8c4d){if(_0x4f8c4d){return _0x4f8c4d[_0x0898('0x29')]()[_0x0898('0x28')](function(){_0x550d08[_0x0898('0x1e')](0xcc)[_0x0898('0x2a')]();});}};}function handleEntityNotFound(_0x3f49e9,_0x5e7bdb){return function(_0x45999b){if(!_0x45999b){_0x3f49e9[_0x0898('0x2b')](0x194);}return _0x45999b;};}function handleError(_0x1f967d,_0x358c34){_0x358c34=_0x358c34||0x1f4;return function(_0x5973b1){logger['error'](_0x5973b1['stack']);if(_0x5973b1[_0x0898('0x2c')]){delete _0x5973b1[_0x0898('0x2c')];}_0x1f967d[_0x0898('0x1e')](_0x358c34)[_0x0898('0x2d')](_0x5973b1);};}exports[_0x0898('0x2e')]=function(_0x2ddbdb,_0x5e57d8){var _0x1a611c={},_0x5f01cf={},_0x38be48={'count':0x0,'rows':[]};var _0x3aedb1=_['map'](db[_0x0898('0x2f')][_0x0898('0x30')],function(_0x2fa9cb){return{'name':_0x2fa9cb['fieldName'],'type':_0x2fa9cb[_0x0898('0x31')]['key']};});_0x5f01cf[_0x0898('0x32')]=_[_0x0898('0x33')](_0x3aedb1,'name');_0x5f01cf[_0x0898('0x34')]=_[_0x0898('0x35')](_0x2ddbdb[_0x0898('0x34')]);_0x5f01cf[_0x0898('0x36')]=_[_0x0898('0x37')](_0x5f01cf[_0x0898('0x32')],_0x5f01cf['query']);_0x1a611c[_0x0898('0x38')]=_[_0x0898('0x37')](_0x5f01cf['model'],qs['fields'](_0x2ddbdb[_0x0898('0x34')][_0x0898('0x39')]));_0x1a611c['attributes']=_0x1a611c['attributes'][_0x0898('0x3a')]?_0x1a611c[_0x0898('0x38')]:_0x5f01cf['model'];if(!_0x2ddbdb[_0x0898('0x34')]['hasOwnProperty'](_0x0898('0x3b'))){_0x1a611c[_0x0898('0x23')]=qs['limit'](_0x2ddbdb[_0x0898('0x34')]['limit']);_0x1a611c['offset']=qs[_0x0898('0x22')](_0x2ddbdb['query'][_0x0898('0x22')]);}_0x1a611c['order']=qs[_0x0898('0x3c')](_0x2ddbdb['query'][_0x0898('0x3c')]);_0x1a611c[_0x0898('0x3d')]=qs['filters'](_[_0x0898('0x3e')](_0x2ddbdb['query'],_0x5f01cf[_0x0898('0x36')]),_0x3aedb1);if(_0x2ddbdb[_0x0898('0x34')][_0x0898('0x3f')]){_0x1a611c[_0x0898('0x3d')]=_[_0x0898('0x40')](_0x1a611c[_0x0898('0x3d')],{'$or':_[_0x0898('0x33')](_0x3aedb1,function(_0x604a75){if(_0x604a75['type']!==_0x0898('0x41')){var _0x1b0d4c={};_0x1b0d4c[_0x604a75['name']]={'$like':'%'+_0x2ddbdb[_0x0898('0x34')][_0x0898('0x3f')]+'%'};return _0x1b0d4c;}})});}_0x1a611c=_[_0x0898('0x40')]({},_0x1a611c,_0x2ddbdb[_0x0898('0x42')]);var _0x42f0b6={'where':_0x1a611c['where']};return db[_0x0898('0x2f')][_0x0898('0x21')](_0x42f0b6)[_0x0898('0x28')](function(_0x4c089a){_0x38be48[_0x0898('0x21')]=_0x4c089a;if(_0x2ddbdb[_0x0898('0x34')]['includeAll']){_0x1a611c[_0x0898('0x43')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x0898('0x44')](_0x1a611c);})[_0x0898('0x28')](function(_0x8c1f07){_0x38be48[_0x0898('0x45')]=_0x8c1f07;return _0x38be48;})['then'](respondWithFilteredResult(_0x5e57d8,_0x1a611c))[_0x0898('0x46')](handleError(_0x5e57d8,null));};exports[_0x0898('0x47')]=function(_0x1b035c,_0x4c44d3){var _0x29e311={'raw':![],'where':{'id':_0x1b035c[_0x0898('0x48')]['id']}},_0xc2d88={};_0xc2d88[_0x0898('0x32')]=_[_0x0898('0x35')](db['FreshsalesAccount']['rawAttributes']);_0xc2d88[_0x0898('0x34')]=_['keys'](_0x1b035c[_0x0898('0x34')]);_0xc2d88[_0x0898('0x36')]=_[_0x0898('0x37')](_0xc2d88[_0x0898('0x32')],_0xc2d88[_0x0898('0x34')]);_0x29e311[_0x0898('0x38')]=_['intersection'](_0xc2d88[_0x0898('0x32')],qs['fields'](_0x1b035c[_0x0898('0x34')][_0x0898('0x39')]));_0x29e311[_0x0898('0x38')]=_0x29e311[_0x0898('0x38')][_0x0898('0x3a')]?_0x29e311['attributes']:_0xc2d88['model'];if(_0x1b035c[_0x0898('0x34')][_0x0898('0x49')]){_0x29e311['include']=[{'all':!![]}];}_0x29e311=_[_0x0898('0x40')]({},_0x29e311,_0x1b035c[_0x0898('0x42')]);return db['FreshsalesAccount'][_0x0898('0x4a')](_0x29e311)['then'](handleEntityNotFound(_0x4c44d3,null))['then'](respondWithResult(_0x4c44d3,null))[_0x0898('0x46')](handleError(_0x4c44d3,null));};exports['create']=function(_0x50d610,_0x492013){return db[_0x0898('0x2f')][_0x0898('0x4b')](_0x50d610[_0x0898('0x4c')],{})['then'](respondWithResult(_0x492013,0xc9))[_0x0898('0x46')](handleError(_0x492013,null));};exports[_0x0898('0x27')]=function(_0x272d1a,_0x271ad6){if(_0x272d1a[_0x0898('0x4c')]['id']){delete _0x272d1a[_0x0898('0x4c')]['id'];}return db[_0x0898('0x2f')][_0x0898('0x4a')]({'where':{'id':_0x272d1a[_0x0898('0x48')]['id']}})[_0x0898('0x28')](handleEntityNotFound(_0x271ad6,null))[_0x0898('0x28')](saveUpdates(_0x272d1a[_0x0898('0x4c')],null))[_0x0898('0x28')](respondWithResult(_0x271ad6,null))[_0x0898('0x46')](handleError(_0x271ad6,null));};exports['destroy']=function(_0x1a190a,_0x157219){return db[_0x0898('0x2f')][_0x0898('0x4a')]({'where':{'id':_0x1a190a[_0x0898('0x48')]['id']}})[_0x0898('0x28')](handleEntityNotFound(_0x157219,null))[_0x0898('0x28')](removeEntity(_0x157219,null))[_0x0898('0x46')](handleError(_0x157219,null));};exports['getConfigurations']=function(_0x4bfd98,_0xe17121,_0x5e1fdf){var _0xd819ba={};var _0x4f2af4={};var _0x2670c;var _0x4d94ec;return db['FreshsalesAccount'][_0x0898('0x4d')]({'where':{'id':_0x4bfd98[_0x0898('0x48')]['id']}})['then'](handleEntityNotFound(_0xe17121,null))[_0x0898('0x28')](function(_0x5532ec){if(_0x5532ec){_0x2670c=_0x5532ec;_0x4f2af4['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x4f2af4[_0x0898('0x34')]=_['keys'](_0x4bfd98[_0x0898('0x34')]);_0x4f2af4[_0x0898('0x36')]=_[_0x0898('0x37')](_0x4f2af4[_0x0898('0x32')],_0x4f2af4[_0x0898('0x34')]);_0xd819ba['attributes']=_[_0x0898('0x37')](_0x4f2af4[_0x0898('0x32')],qs[_0x0898('0x39')](_0x4bfd98['query']['fields']));_0xd819ba[_0x0898('0x38')]=_0xd819ba[_0x0898('0x38')][_0x0898('0x3a')]?_0xd819ba['attributes']:_0x4f2af4['model'];_0xd819ba[_0x0898('0x4e')]=qs[_0x0898('0x3c')](_0x4bfd98[_0x0898('0x34')][_0x0898('0x3c')]);_0xd819ba['where']=qs[_0x0898('0x36')](_[_0x0898('0x3e')](_0x4bfd98[_0x0898('0x34')],_0x4f2af4[_0x0898('0x36')]));if(_0x4bfd98[_0x0898('0x34')][_0x0898('0x3f')]){_0xd819ba[_0x0898('0x3d')]=_['merge'](_0xd819ba[_0x0898('0x3d')],{'$or':_[_0x0898('0x33')](_0xd819ba[_0x0898('0x38')],function(_0xa19c44){var _0x23bd39={};_0x23bd39[_0xa19c44]={'$like':'%'+_0x4bfd98['query'][_0x0898('0x3f')]+'%'};return _0x23bd39;})});}_0xd819ba=_[_0x0898('0x40')]({},_0xd819ba,_0x4bfd98[_0x0898('0x42')]);return _0x2670c[_0x0898('0x4f')](_0xd819ba);}})[_0x0898('0x28')](function(_0x4667d8){if(_0x4667d8){_0x4d94ec=_0x4667d8[_0x0898('0x3a')];if(!_0x4bfd98[_0x0898('0x34')][_0x0898('0x50')]('nolimit')){_0xd819ba[_0x0898('0x23')]=qs[_0x0898('0x23')](_0x4bfd98[_0x0898('0x34')][_0x0898('0x23')]);_0xd819ba[_0x0898('0x22')]=qs[_0x0898('0x22')](_0x4bfd98[_0x0898('0x34')]['offset']);}return _0x2670c[_0x0898('0x4f')](_0xd819ba);}})[_0x0898('0x28')](function(_0x14c82b){if(_0x14c82b){return _0x14c82b?{'count':_0x4d94ec,'rows':_0x14c82b}:null;}})[_0x0898('0x28')](respondWithResult(_0xe17121,null))[_0x0898('0x46')](handleError(_0xe17121,null));};exports[_0x0898('0x51')]=function(_0x303fdd,_0x5dadde,_0x5caeae){if(_0x303fdd['body']['id']){delete _0x303fdd['body']['id'];}return db[_0x0898('0x2f')]['findOne']({'where':{'id':_0x303fdd[_0x0898('0x48')]['id']}})[_0x0898('0x28')](handleEntityNotFound(_0x5dadde,null))[_0x0898('0x28')](function(_0x44ebcf){if(_0x44ebcf){_0x303fdd['body'][_0x0898('0x52')]=_0x44ebcf['id'];_0x303fdd[_0x0898('0x4c')]['Subjects']=integrations[_0x0898('0x53')](_0x303fdd[_0x0898('0x4c')][_0x0898('0x54')],_0x303fdd[_0x0898('0x4c')][_0x0898('0x31')]);_0x303fdd[_0x0898('0x4c')]['Descriptions']=integrations[_0x0898('0x55')](_0x303fdd[_0x0898('0x4c')][_0x0898('0x54')],_0x303fdd[_0x0898('0x4c')]['type']);return db['FreshsalesConfiguration'][_0x0898('0x4b')](_0x303fdd['body'],{'include':[{'model':db[_0x0898('0x56')],'as':_0x0898('0x57')},{'model':db['FreshsalesField'],'as':_0x0898('0x58')}]});}return null;})[_0x0898('0x28')](respondWithResult(_0x5dadde,null))['catch'](handleError(_0x5dadde,null));};exports[_0x0898('0x59')]=function(_0x1eeba6,_0x4eb902,_0x287368){var _0x130b04='';var _0x32dfa1='';return db[_0x0898('0x2f')][_0x0898('0x4d')]({'where':{'id':_0x1eeba6['params']['id']},'attributes':['id',_0x0898('0x5a'),_0x0898('0x5b'),_0x0898('0x5c')]})[_0x0898('0x28')](handleEntityNotFound(_0x4eb902,null))[_0x0898('0x28')](function(_0x18f6a7){if(_0x18f6a7){_0x32dfa1=_0x18f6a7['username'];_0x130b04=_0x18f6a7[_0x0898('0x5b')];var _0x7ff982=_0x18f6a7[_0x0898('0x5b')][_0x0898('0x5d')](-0x1);if(_0x7ff982==='/'){_0x130b04=_0x130b04['substring'](0x0,_0x130b04[_0x0898('0x5e')](_0x7ff982));}return rp({'method':'GET','uri':util[_0x0898('0x5f')]('%s%s',_0x130b04,_0x0898('0x60')),'headers':{'Authorization':'Token\x20token='+_0x18f6a7['apiKey']},'json':!![]});}})[_0x0898('0x28')](function(_0x1bc4b4){if(_0x1bc4b4){var _0x318424=_0x1bc4b4[_0x0898('0x61')];var _0x21cbf9=![];var _0x52ed10=null;for(_0x52ed10=0x0;_0x52ed10<_0x318424[_0x0898('0x3a')];_0x52ed10++){if(_0x318424[_0x52ed10]['email']===_0x32dfa1){_0x21cbf9=!![];}}if(_0x21cbf9){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0898('0x62')});}}})[_0x0898('0x28')](respondWithResult(_0x4eb902,null))['catch'](function(_0x56df69){var _0x225a3a=_0x1eeba6[_0x0898('0x34')]['test']?0x1f4:_0x56df69[_0x0898('0x63')]||0x1f4;logger[_0x0898('0x64')](_0x0898('0x65'),_0x0898('0x59'),_0x225a3a,JSON[_0x0898('0x66')](_0x56df69));delete _0x56df69[_0x0898('0x2c')];if(_0x225a3a===0x191){_0x225a3a=0x190;}_0x4eb902[_0x0898('0x1e')](_0x225a3a)['send'](_0x1eeba6[_0x0898('0x34')][_0x0898('0x67')]?{'message':_0x0898('0x68'),'statusCode':_0x56df69[_0x0898('0x63')]}:_0x56df69);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index af3b62e..983b2a2 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 _0x2da6=['int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount'];(function(_0x1a08e2,_0x3f1a81){var _0x3e83b0=function(_0x29e48a){while(--_0x29e48a){_0x1a08e2['push'](_0x1a08e2['shift']());}};_0x3e83b0(++_0x3f1a81);}(_0x2da6,0x1dd));var _0x62da=function(_0x41a73f,_0x19fcb6){_0x41a73f=_0x41a73f-0x0;var _0x24594f=_0x2da6[_0x41a73f];return _0x24594f;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var logger=require(_0x62da('0x2'))(_0x62da('0x3'));var moment=require(_0x62da('0x4'));var BPromise=require(_0x62da('0x5'));var rp=require(_0x62da('0x6'));var fs=require('fs');var path=require(_0x62da('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62da('0x8'));var integrations=require(_0x62da('0x9'));module[_0x62da('0xa')]=function(_0x30437f,_0x100e73){return _0x30437f[_0x62da('0xb')](_0x62da('0xc'),attributes,{'tableName':_0x62da('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a6d=['api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x3a6d,0x143));var _0xd3a6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x3a6d[_0x8c43de];return _0xa6591b;};'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'));var integrations=require(_0xd3a6('0x9'));module[_0xd3a6('0xa')]=function(_0x25b042,_0x282cb1){return _0x25b042['define'](_0xd3a6('0xb'),attributes,{'tableName':_0xd3a6('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 0dadf39..99dd6c3 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 _0x2da6=['info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshsalesAccount','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x594e9d,_0x883433){var _0x2f4839=function(_0x28e1d4){while(--_0x28e1d4){_0x594e9d['push'](_0x594e9d['shift']());}};_0x2f4839(++_0x883433);}(_0x2da6,0x1dd));var _0x62da=function(_0x509973,_0x1eb959){_0x509973=_0x509973-0x0;var _0x2a3a52=_0x2da6[_0x509973];return _0x2a3a52;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});}exports['GetFreshsalesAccount']=function(_0xa7050b){var _0x4ae4fb=this;return new Promise(function(_0x4d6482,_0x264366){return db[_0x62da('0x18')]['findAll']({'raw':_0xa7050b[_0x62da('0x19')]?_0xa7050b['options'][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1b')]||null:null,'attributes':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1c')]||null:null,'limit':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')]['limit']||null:null,'include':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')]?_[_0x62da('0x1e')](_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')],function(_0x24298a){return{'model':db[_0x24298a['model']],'as':_0x24298a['as'],'attributes':_0x24298a['attributes'],'include':_0x24298a['include']?_[_0x62da('0x1e')](_0x24298a[_0x62da('0x1d')],function(_0x14897c){return{'model':db[_0x14897c[_0x62da('0x1f')]],'as':_0x14897c['as'],'attributes':_0x14897c['attributes'],'include':_0x14897c[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x14897c['include'],function(_0x3ccf96){return{'model':db[_0x3ccf96[_0x62da('0x1f')]],'as':_0x3ccf96['as'],'attributes':_0x3ccf96[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41de3a){logger[_0x62da('0xd')](_0x62da('0x20'),_0xa7050b);logger['debug']('GetFreshsalesAccount',_0xa7050b,JSON[_0x62da('0x12')](_0x41de3a));_0x4d6482(_0x41de3a);})[_0x62da('0x17')](function(_0x220ffc){logger['error'](_0x62da('0x20'),_0x220ffc[_0x62da('0x15')],_0xa7050b);_0x264366(_0x4ae4fb[_0x62da('0x13')](0x1f4,_0x220ffc[_0x62da('0x15')]));});});};exports[_0x62da('0x21')]=function(_0x1cf765){var _0x592c6c=this;return new Promise(function(_0xbe398f,_0x4f71bc){return db[_0x62da('0x18')][_0x62da('0x22')]({'raw':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cf765[_0x62da('0x19')]?_0x1cf765['options'][_0x62da('0x1b')]||null:null,'attributes':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')]['attributes']||null:null,'include':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')]?_['map'](_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')],function(_0x55eda7){return{'model':db[_0x55eda7[_0x62da('0x1f')]],'as':_0x55eda7['as'],'attributes':_0x55eda7[_0x62da('0x1c')],'include':_0x55eda7['include']?_[_0x62da('0x1e')](_0x55eda7[_0x62da('0x1d')],function(_0x11bf73){return{'model':db[_0x11bf73[_0x62da('0x1f')]],'as':_0x11bf73['as'],'attributes':_0x11bf73[_0x62da('0x1c')],'include':_0x11bf73[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x11bf73[_0x62da('0x1d')],function(_0x2f1115){return{'model':db[_0x2f1115[_0x62da('0x1f')]],'as':_0x2f1115['as'],'attributes':_0x2f1115[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x62da('0xc')](function(_0x3057f6){logger[_0x62da('0xd')](_0x62da('0x21'),_0x1cf765);logger[_0x62da('0xf')](_0x62da('0x21'),_0x1cf765,JSON['stringify'](_0x3057f6));_0xbe398f(_0x3057f6);})[_0x62da('0x17')](function(_0x5e9295){logger[_0x62da('0x13')](_0x62da('0x21'),_0x5e9295[_0x62da('0x15')],_0x1cf765);_0x4f71bc(_0x592c6c['error'](0x1f4,_0x5e9295[_0x62da('0x15')]));});});}; \ No newline at end of file +var _0x0120=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','catch','FreshsalesAccount','find','ShowFreshsalesAccount','lodash','util','moment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0120,0x6f));var _0x0012=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x0120[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});}exports[_0x0012('0x16')]=function(_0x1d0423){var _0x22ded1=this;return new Promise(function(_0x1e78ee,_0x2eb3fa){return db['FreshsalesAccount'][_0x0012('0x17')]({'raw':_0x1d0423[_0x0012('0x18')]?_0x1d0423['options'][_0x0012('0x19')]===undefined?!![]:![]:!![],'where':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1a')]||null:null,'attributes':_0x1d0423['options']?_0x1d0423['options'][_0x0012('0x1b')]||null:null,'limit':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1c')]||null:null,'include':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x1d0423['options'][_0x0012('0x1d')],function(_0x24a280){return{'model':db[_0x24a280['model']],'as':_0x24a280['as'],'attributes':_0x24a280[_0x0012('0x1b')],'include':_0x24a280[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x24a280[_0x0012('0x1d')],function(_0x42bcd7){return{'model':db[_0x42bcd7['model']],'as':_0x42bcd7['as'],'attributes':_0x42bcd7[_0x0012('0x1b')],'include':_0x42bcd7[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x42bcd7[_0x0012('0x1d')],function(_0x173cb3){return{'model':db[_0x173cb3[_0x0012('0x1f')]],'as':_0x173cb3['as'],'attributes':_0x173cb3[_0x0012('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0012('0x20')](function(_0x300e13){logger[_0x0012('0xd')](_0x0012('0x16'),_0x1d0423);logger[_0x0012('0x21')](_0x0012('0x16'),_0x1d0423,JSON[_0x0012('0x11')](_0x300e13));_0x1e78ee(_0x300e13);})[_0x0012('0x22')](function(_0x276389){logger[_0x0012('0x12')](_0x0012('0x16'),_0x276389[_0x0012('0x14')],_0x1d0423);_0x2eb3fa(_0x22ded1[_0x0012('0x12')](0x1f4,_0x276389[_0x0012('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x283134){var _0x1bb49b=this;return new Promise(function(_0x4c2601,_0x2fa6a2){return db[_0x0012('0x23')][_0x0012('0x24')]({'raw':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')][_0x0012('0x1a')]||null:null,'attributes':_0x283134['options']?_0x283134[_0x0012('0x18')][_0x0012('0x1b')]||null:null,'include':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')][_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x283134['options'][_0x0012('0x1d')],function(_0x30dfd8){return{'model':db[_0x30dfd8[_0x0012('0x1f')]],'as':_0x30dfd8['as'],'attributes':_0x30dfd8[_0x0012('0x1b')],'include':_0x30dfd8['include']?_['map'](_0x30dfd8[_0x0012('0x1d')],function(_0x30f8a2){return{'model':db[_0x30f8a2[_0x0012('0x1f')]],'as':_0x30f8a2['as'],'attributes':_0x30f8a2[_0x0012('0x1b')],'include':_0x30f8a2[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x30f8a2[_0x0012('0x1d')],function(_0x4f13b9){return{'model':db[_0x4f13b9[_0x0012('0x1f')]],'as':_0x4f13b9['as'],'attributes':_0x4f13b9[_0x0012('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x196222){logger[_0x0012('0xd')](_0x0012('0x25'),_0x283134);logger[_0x0012('0x21')](_0x0012('0x25'),_0x283134,JSON[_0x0012('0x11')](_0x196222));_0x4c2601(_0x196222);})[_0x0012('0x22')](function(_0x4a4af8){logger[_0x0012('0x12')]('ShowFreshsalesAccount',_0x4a4af8[_0x0012('0x14')],_0x283134);_0x2fa6a2(_0x1bb49b['error'](0x1f4,_0x4a4af8['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 287f8c9..fe1346d 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 _0x92de=['Router','fs-extra','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x52493c,_0x2d03a0){var _0x1b4213=function(_0xf679b8){while(--_0xf679b8){_0x52493c['push'](_0x52493c['shift']());}};_0x1b4213(++_0x2d03a0);}(_0x92de,0x10f));var _0xe92d=function(_0xae6db5,_0x5b81e9){_0xae6db5=_0xae6db5-0x0;var _0x526e3c=_0x92de[_0xae6db5];return _0x526e3c;};'use strict';var multer=require(_0xe92d('0x0'));var util=require(_0xe92d('0x1'));var path=require(_0xe92d('0x2'));var timeout=require(_0xe92d('0x3'));var express=require(_0xe92d('0x4'));var router=express[_0xe92d('0x5')]();var fs_extra=require(_0xe92d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe92d('0x7'));var config=require('../../config/environment');var controller=require(_0xe92d('0x8'));router[_0xe92d('0x9')]('/',auth[_0xe92d('0xa')](),controller[_0xe92d('0xb')]);router[_0xe92d('0x9')]('/:id',auth[_0xe92d('0xa')](),controller[_0xe92d('0xc')]);router['get']('/:id/subjects',auth[_0xe92d('0xa')](),controller[_0xe92d('0xd')]);router['get'](_0xe92d('0xe'),auth[_0xe92d('0xa')](),controller['getDescriptions']);router[_0xe92d('0x9')](_0xe92d('0xf'),auth[_0xe92d('0xa')](),controller[_0xe92d('0x10')]);router[_0xe92d('0x11')]('/',auth[_0xe92d('0xa')](),controller[_0xe92d('0x12')]);router['put'](_0xe92d('0x13'),auth[_0xe92d('0xa')](),controller[_0xe92d('0x14')]);router['delete'](_0xe92d('0x13'),auth[_0xe92d('0xa')](),controller[_0xe92d('0x15')]);module[_0xe92d('0x16')]=router; \ No newline at end of file +var _0xefb7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x4e881c,_0x4c512e){var _0x372256=function(_0x382fbb){while(--_0x382fbb){_0x4e881c['push'](_0x4e881c['shift']());}};_0x372256(++_0x4c512e);}(_0xefb7,0xa3));var _0x7efb=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0xefb7[_0x10d34b];return _0x92b0bf;};'use strict';var multer=require(_0x7efb('0x0'));var util=require(_0x7efb('0x1'));var path=require(_0x7efb('0x2'));var timeout=require(_0x7efb('0x3'));var express=require(_0x7efb('0x4'));var router=express[_0x7efb('0x5')]();var fs_extra=require(_0x7efb('0x6'));var auth=require(_0x7efb('0x7'));var interaction=require(_0x7efb('0x8'));var config=require(_0x7efb('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x7efb('0xa')](),controller['index']);router['get'](_0x7efb('0xb'),auth['isAuthenticated'](),controller[_0x7efb('0xc')]);router[_0x7efb('0xd')](_0x7efb('0xe'),auth[_0x7efb('0xa')](),controller[_0x7efb('0xf')]);router['get'](_0x7efb('0x10'),auth[_0x7efb('0xa')](),controller[_0x7efb('0x11')]);router[_0x7efb('0xd')](_0x7efb('0x12'),auth[_0x7efb('0xa')](),controller['getFields']);router[_0x7efb('0x13')]('/',auth[_0x7efb('0xa')](),controller[_0x7efb('0x14')]);router[_0x7efb('0x15')](_0x7efb('0xb'),auth[_0x7efb('0xa')](),controller['update']);router[_0x7efb('0x16')]('/:id',auth[_0x7efb('0xa')](),controller['destroy']);module[_0x7efb('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1a003bb..8c99538 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 _0x0bf1=['exports','STRING','sequelize'];(function(_0x28b7ab,_0x16a764){var _0x56791b=function(_0x25d20d){while(--_0x25d20d){_0x28b7ab['push'](_0x28b7ab['shift']());}};_0x56791b(++_0x16a764);}(_0x0bf1,0xaa));var _0x10bf=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0bf1[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x10bf('0x0'));module[_0x10bf('0x1')]={'name':{'type':Sequelize[_0x10bf('0x2')]},'description':{'type':Sequelize[_0x10bf('0x2')]}}; \ No newline at end of file +var _0xdc74=['exports','sequelize'];(function(_0x5f100a,_0x14d1a3){var _0x3917bc=function(_0xec886f){while(--_0xec886f){_0x5f100a['push'](_0x5f100a['shift']());}};_0x3917bc(++_0x14d1a3);}(_0xdc74,0x1e1));var _0x4dc7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdc74[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x4dc7('0x0'));module[_0x4dc7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 6ee4d41..d5853d5 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 _0x79fb=['options','includeAll','findAll','rows','catch','show','params','rawAttributes','filters','length','include','find','create','body','destroy','getSubjects','findOne','pick','getDescriptions','FreshsalesField','hasOwnProperty','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','index','map','FreshsalesConfiguration','fieldName','key','model','keys','intersection','query','fields','attributes','nolimit','order','sort','where','merge','VIRTUAL','filter'];(function(_0x17114a,_0x60171){var _0x3571ca=function(_0x59b48f){while(--_0x59b48f){_0x17114a['push'](_0x17114a['shift']());}};_0x3571ca(++_0x60171);}(_0x79fb,0xb2));var _0xb79f=function(_0x587595,_0x4b5ced){_0x587595=_0x587595-0x0;var _0x5e1ab4=_0x79fb[_0x587595];return _0x5e1ab4;};'use strict';var emlformat=require(_0xb79f('0x0'));var rimraf=require(_0xb79f('0x1'));var zipdir=require(_0xb79f('0x2'));var jsonpatch=require(_0xb79f('0x3'));var rp=require(_0xb79f('0x4'));var moment=require(_0xb79f('0x5'));var BPromise=require(_0xb79f('0x6'));var Mustache=require(_0xb79f('0x7'));var util=require(_0xb79f('0x8'));var path=require('path');var sox=require(_0xb79f('0x9'));var csv=require('to-csv');var ejs=require(_0xb79f('0xa'));var fs=require('fs');var fs_extra=require(_0xb79f('0xb'));var _=require(_0xb79f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb79f('0xd'));var deskjs=require(_0xb79f('0xe'));var toCsv=require(_0xb79f('0xf'));var querystring=require('querystring');var Papa=require(_0xb79f('0x10'));var Redis=require(_0xb79f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb79f('0x12'));var hardwareService=require(_0xb79f('0x13'));var logger=require('../../config/logger')(_0xb79f('0x14'));var utils=require(_0xb79f('0x15'));var config=require(_0xb79f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd05b79,_0x1fbd1c){_0x1fbd1c=_0x1fbd1c||0xcc;return function(_0x20128f){if(_0x20128f){return _0xd05b79['sendStatus'](_0x1fbd1c);}return _0xd05b79[_0xb79f('0x17')](_0x1fbd1c)['end']();};}function respondWithResult(_0x32b096,_0x3fcf95){_0x3fcf95=_0x3fcf95||0xc8;return function(_0x4d2e1d){if(_0x4d2e1d){return _0x32b096[_0xb79f('0x17')](_0x3fcf95)['json'](_0x4d2e1d);}};}function respondWithFilteredResult(_0x184d20,_0x2d368e){return function(_0x7c9d1c){if(_0x7c9d1c){var _0x9073bc=typeof _0x2d368e[_0xb79f('0x18')]===_0xb79f('0x19')&&typeof _0x2d368e[_0xb79f('0x1a')]===_0xb79f('0x19');var _0x3cc2a4=_0x7c9d1c[_0xb79f('0x1b')];var _0x22c7f8=_0x9073bc?0x0:_0x2d368e[_0xb79f('0x18')];var _0x471c05=_0x9073bc?_0x7c9d1c[_0xb79f('0x1b')]:_0x2d368e[_0xb79f('0x18')]+_0x2d368e[_0xb79f('0x1a')];var _0x4343a8;if(_0x471c05>=_0x3cc2a4){_0x471c05=_0x3cc2a4;_0x4343a8=0xc8;}else{_0x4343a8=0xce;}_0x184d20[_0xb79f('0x17')](_0x4343a8);return _0x184d20[_0xb79f('0x1c')](_0xb79f('0x1d'),_0x22c7f8+'-'+_0x471c05+'/'+_0x3cc2a4)[_0xb79f('0x1e')](_0x7c9d1c);}return null;};}function patchUpdates(_0x19b5c9){return function(_0xef03fe){try{jsonpatch[_0xb79f('0x1f')](_0xef03fe,_0x19b5c9,!![]);}catch(_0x54109a){return BPromise['reject'](_0x54109a);}return _0xef03fe[_0xb79f('0x20')]();};}function saveUpdates(_0x4e6abe,_0x1b8f06){return function(_0x4b927a){if(_0x4b927a){return _0x4b927a[_0xb79f('0x21')](_0x4e6abe)[_0xb79f('0x22')](function(_0x3e3809){return _0x3e3809;});}return null;};}function removeEntity(_0x7ba723,_0x332175){return function(_0x28299b){if(_0x28299b){return _0x28299b['destroy']()[_0xb79f('0x22')](function(){_0x7ba723['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa52fbc,_0x427fd5){return function(_0x5bbde2){if(!_0x5bbde2){_0xa52fbc['sendStatus'](0x194);}return _0x5bbde2;};}function handleError(_0x1bb6a7,_0x11e990){_0x11e990=_0x11e990||0x1f4;return function(_0x53765b){logger[_0xb79f('0x23')](_0x53765b[_0xb79f('0x24')]);if(_0x53765b[_0xb79f('0x25')]){delete _0x53765b['name'];}_0x1bb6a7[_0xb79f('0x17')](_0x11e990)['send'](_0x53765b);};}exports[_0xb79f('0x26')]=function(_0x181bf0,_0x541978){var _0x16cc59={},_0x293482={},_0x520da4={'count':0x0,'rows':[]};var _0x6ab071=_[_0xb79f('0x27')](db[_0xb79f('0x28')]['rawAttributes'],function(_0x3b543a){return{'name':_0x3b543a[_0xb79f('0x29')],'type':_0x3b543a['type'][_0xb79f('0x2a')]};});_0x293482[_0xb79f('0x2b')]=_[_0xb79f('0x27')](_0x6ab071,'name');_0x293482['query']=_[_0xb79f('0x2c')](_0x181bf0['query']);_0x293482['filters']=_[_0xb79f('0x2d')](_0x293482[_0xb79f('0x2b')],_0x293482[_0xb79f('0x2e')]);_0x16cc59['attributes']=_['intersection'](_0x293482[_0xb79f('0x2b')],qs[_0xb79f('0x2f')](_0x181bf0['query']['fields']));_0x16cc59[_0xb79f('0x30')]=_0x16cc59[_0xb79f('0x30')]['length']?_0x16cc59['attributes']:_0x293482[_0xb79f('0x2b')];if(!_0x181bf0[_0xb79f('0x2e')]['hasOwnProperty'](_0xb79f('0x31'))){_0x16cc59[_0xb79f('0x1a')]=qs['limit'](_0x181bf0['query'][_0xb79f('0x1a')]);_0x16cc59['offset']=qs[_0xb79f('0x18')](_0x181bf0[_0xb79f('0x2e')][_0xb79f('0x18')]);}_0x16cc59[_0xb79f('0x32')]=qs[_0xb79f('0x33')](_0x181bf0['query'][_0xb79f('0x33')]);_0x16cc59[_0xb79f('0x34')]=qs['filters'](_['pick'](_0x181bf0[_0xb79f('0x2e')],_0x293482['filters']),_0x6ab071);if(_0x181bf0[_0xb79f('0x2e')]['filter']){_0x16cc59[_0xb79f('0x34')]=_[_0xb79f('0x35')](_0x16cc59[_0xb79f('0x34')],{'$or':_[_0xb79f('0x27')](_0x6ab071,function(_0x4c8837){if(_0x4c8837['type']!==_0xb79f('0x36')){var _0x533e5d={};_0x533e5d[_0x4c8837['name']]={'$like':'%'+_0x181bf0[_0xb79f('0x2e')][_0xb79f('0x37')]+'%'};return _0x533e5d;}})});}_0x16cc59=_['merge']({},_0x16cc59,_0x181bf0[_0xb79f('0x38')]);var _0x4e9b44={'where':_0x16cc59[_0xb79f('0x34')]};return db[_0xb79f('0x28')][_0xb79f('0x1b')](_0x4e9b44)['then'](function(_0x56dfa0){_0x520da4['count']=_0x56dfa0;if(_0x181bf0[_0xb79f('0x2e')][_0xb79f('0x39')]){_0x16cc59['include']=[{'all':!![]}];}return db[_0xb79f('0x28')][_0xb79f('0x3a')](_0x16cc59);})['then'](function(_0x3bdf99){_0x520da4[_0xb79f('0x3b')]=_0x3bdf99;return _0x520da4;})[_0xb79f('0x22')](respondWithFilteredResult(_0x541978,_0x16cc59))[_0xb79f('0x3c')](handleError(_0x541978,null));};exports[_0xb79f('0x3d')]=function(_0x13310f,_0x4d2b07){var _0xa15228={'raw':![],'where':{'id':_0x13310f[_0xb79f('0x3e')]['id']}},_0x1a3aa0={};_0x1a3aa0[_0xb79f('0x2b')]=_[_0xb79f('0x2c')](db[_0xb79f('0x28')][_0xb79f('0x3f')]);_0x1a3aa0[_0xb79f('0x2e')]=_[_0xb79f('0x2c')](_0x13310f[_0xb79f('0x2e')]);_0x1a3aa0[_0xb79f('0x40')]=_['intersection'](_0x1a3aa0[_0xb79f('0x2b')],_0x1a3aa0[_0xb79f('0x2e')]);_0xa15228['attributes']=_[_0xb79f('0x2d')](_0x1a3aa0[_0xb79f('0x2b')],qs[_0xb79f('0x2f')](_0x13310f[_0xb79f('0x2e')]['fields']));_0xa15228['attributes']=_0xa15228[_0xb79f('0x30')][_0xb79f('0x41')]?_0xa15228['attributes']:_0x1a3aa0['model'];if(_0x13310f[_0xb79f('0x2e')][_0xb79f('0x39')]){_0xa15228[_0xb79f('0x42')]=[{'all':!![]}];}_0xa15228=_['merge']({},_0xa15228,_0x13310f[_0xb79f('0x38')]);return db[_0xb79f('0x28')][_0xb79f('0x43')](_0xa15228)[_0xb79f('0x22')](handleEntityNotFound(_0x4d2b07,null))[_0xb79f('0x22')](respondWithResult(_0x4d2b07,null))['catch'](handleError(_0x4d2b07,null));};exports[_0xb79f('0x44')]=function(_0x384388,_0x2b1ab4){return db[_0xb79f('0x28')]['create'](_0x384388[_0xb79f('0x45')],{})[_0xb79f('0x22')](respondWithResult(_0x2b1ab4,0xc9))['catch'](handleError(_0x2b1ab4,null));};exports['update']=function(_0x3146ed,_0x261883){if(_0x3146ed['body']['id']){delete _0x3146ed[_0xb79f('0x45')]['id'];}return db['FreshsalesConfiguration'][_0xb79f('0x43')]({'where':{'id':_0x3146ed[_0xb79f('0x3e')]['id']}})[_0xb79f('0x22')](handleEntityNotFound(_0x261883,null))[_0xb79f('0x22')](saveUpdates(_0x3146ed[_0xb79f('0x45')],null))['then'](respondWithResult(_0x261883,null))['catch'](handleError(_0x261883,null));};exports[_0xb79f('0x46')]=function(_0x2b3a66,_0x421940){return db[_0xb79f('0x28')][_0xb79f('0x43')]({'where':{'id':_0x2b3a66[_0xb79f('0x3e')]['id']}})[_0xb79f('0x22')](handleEntityNotFound(_0x421940,null))[_0xb79f('0x22')](removeEntity(_0x421940,null))[_0xb79f('0x3c')](handleError(_0x421940,null));};exports[_0xb79f('0x47')]=function(_0x181de7,_0x5e2e95,_0x3e13ee){var _0x5c5dcf={};var _0x17a894={};var _0x154bd5;var _0x5e1382;return db[_0xb79f('0x28')][_0xb79f('0x48')]({'where':{'id':_0x181de7['params']['id']}})[_0xb79f('0x22')](handleEntityNotFound(_0x5e2e95,null))[_0xb79f('0x22')](function(_0x27d6d7){if(_0x27d6d7){_0x154bd5=_0x27d6d7;_0x17a894[_0xb79f('0x2b')]=_['keys'](db['FreshsalesField'][_0xb79f('0x3f')]);_0x17a894['query']=_[_0xb79f('0x2c')](_0x181de7[_0xb79f('0x2e')]);_0x17a894[_0xb79f('0x40')]=_[_0xb79f('0x2d')](_0x17a894[_0xb79f('0x2b')],_0x17a894[_0xb79f('0x2e')]);_0x5c5dcf[_0xb79f('0x30')]=_[_0xb79f('0x2d')](_0x17a894[_0xb79f('0x2b')],qs['fields'](_0x181de7[_0xb79f('0x2e')]['fields']));_0x5c5dcf['attributes']=_0x5c5dcf['attributes'][_0xb79f('0x41')]?_0x5c5dcf[_0xb79f('0x30')]:_0x17a894[_0xb79f('0x2b')];_0x5c5dcf[_0xb79f('0x32')]=qs[_0xb79f('0x33')](_0x181de7[_0xb79f('0x2e')][_0xb79f('0x33')]);_0x5c5dcf[_0xb79f('0x34')]=qs[_0xb79f('0x40')](_[_0xb79f('0x49')](_0x181de7[_0xb79f('0x2e')],_0x17a894[_0xb79f('0x40')]));if(_0x181de7['query'][_0xb79f('0x37')]){_0x5c5dcf[_0xb79f('0x34')]=_['merge'](_0x5c5dcf[_0xb79f('0x34')],{'$or':_[_0xb79f('0x27')](_0x5c5dcf[_0xb79f('0x30')],function(_0x3dd7f0){var _0x299fdb={};_0x299fdb[_0x3dd7f0]={'$like':'%'+_0x181de7['query']['filter']+'%'};return _0x299fdb;})});}_0x5c5dcf=_['merge']({},_0x5c5dcf,_0x181de7[_0xb79f('0x38')]);return _0x154bd5['getSubjects'](_0x5c5dcf);}})[_0xb79f('0x22')](function(_0x331595){if(_0x331595){_0x5e1382=_0x331595['length'];if(!_0x181de7['query']['hasOwnProperty']('nolimit')){_0x5c5dcf[_0xb79f('0x1a')]=qs[_0xb79f('0x1a')](_0x181de7['query'][_0xb79f('0x1a')]);_0x5c5dcf[_0xb79f('0x18')]=qs[_0xb79f('0x18')](_0x181de7[_0xb79f('0x2e')][_0xb79f('0x18')]);}return _0x154bd5[_0xb79f('0x47')](_0x5c5dcf);}})['then'](function(_0x5a8fd7){if(_0x5a8fd7){return _0x5a8fd7?{'count':_0x5e1382,'rows':_0x5a8fd7}:null;}})['then'](respondWithResult(_0x5e2e95,null))[_0xb79f('0x3c')](handleError(_0x5e2e95,null));};exports[_0xb79f('0x4a')]=function(_0xc8cf6e,_0x1a59b8,_0x3c2ab3){var _0x41b1d3={};var _0x388203={};var _0x41ce89;var _0x45d0e5;return db[_0xb79f('0x28')][_0xb79f('0x48')]({'where':{'id':_0xc8cf6e[_0xb79f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1a59b8,null))[_0xb79f('0x22')](function(_0x2c3b01){if(_0x2c3b01){_0x41ce89=_0x2c3b01;_0x388203[_0xb79f('0x2b')]=_[_0xb79f('0x2c')](db[_0xb79f('0x4b')][_0xb79f('0x3f')]);_0x388203[_0xb79f('0x2e')]=_[_0xb79f('0x2c')](_0xc8cf6e[_0xb79f('0x2e')]);_0x388203[_0xb79f('0x40')]=_['intersection'](_0x388203['model'],_0x388203[_0xb79f('0x2e')]);_0x41b1d3[_0xb79f('0x30')]=_['intersection'](_0x388203[_0xb79f('0x2b')],qs[_0xb79f('0x2f')](_0xc8cf6e[_0xb79f('0x2e')][_0xb79f('0x2f')]));_0x41b1d3['attributes']=_0x41b1d3['attributes'][_0xb79f('0x41')]?_0x41b1d3[_0xb79f('0x30')]:_0x388203[_0xb79f('0x2b')];_0x41b1d3[_0xb79f('0x32')]=qs[_0xb79f('0x33')](_0xc8cf6e[_0xb79f('0x2e')]['sort']);_0x41b1d3[_0xb79f('0x34')]=qs[_0xb79f('0x40')](_[_0xb79f('0x49')](_0xc8cf6e['query'],_0x388203[_0xb79f('0x40')]));if(_0xc8cf6e[_0xb79f('0x2e')][_0xb79f('0x37')]){_0x41b1d3['where']=_[_0xb79f('0x35')](_0x41b1d3['where'],{'$or':_[_0xb79f('0x27')](_0x41b1d3[_0xb79f('0x30')],function(_0x51d4cb){var _0x191793={};_0x191793[_0x51d4cb]={'$like':'%'+_0xc8cf6e[_0xb79f('0x2e')][_0xb79f('0x37')]+'%'};return _0x191793;})});}_0x41b1d3=_[_0xb79f('0x35')]({},_0x41b1d3,_0xc8cf6e[_0xb79f('0x38')]);return _0x41ce89[_0xb79f('0x4a')](_0x41b1d3);}})[_0xb79f('0x22')](function(_0x8a9671){if(_0x8a9671){_0x45d0e5=_0x8a9671[_0xb79f('0x41')];if(!_0xc8cf6e['query'][_0xb79f('0x4c')](_0xb79f('0x31'))){_0x41b1d3[_0xb79f('0x1a')]=qs[_0xb79f('0x1a')](_0xc8cf6e[_0xb79f('0x2e')]['limit']);_0x41b1d3[_0xb79f('0x18')]=qs[_0xb79f('0x18')](_0xc8cf6e[_0xb79f('0x2e')][_0xb79f('0x18')]);}return _0x41ce89['getDescriptions'](_0x41b1d3);}})[_0xb79f('0x22')](function(_0xfde8ed){if(_0xfde8ed){return _0xfde8ed?{'count':_0x45d0e5,'rows':_0xfde8ed}:null;}})['then'](respondWithResult(_0x1a59b8,null))[_0xb79f('0x3c')](handleError(_0x1a59b8,null));};exports[_0xb79f('0x4d')]=function(_0x8a9ece,_0x44d137,_0x17ecfc){var _0xc4d1af={};var _0x413a24={};var _0x1f4873;var _0x579f91;return db[_0xb79f('0x28')][_0xb79f('0x48')]({'where':{'id':_0x8a9ece[_0xb79f('0x3e')]['id']}})[_0xb79f('0x22')](handleEntityNotFound(_0x44d137,null))[_0xb79f('0x22')](function(_0x7b34df){if(_0x7b34df){_0x1f4873=_0x7b34df;_0x413a24[_0xb79f('0x2b')]=_['keys'](db['FreshsalesField'][_0xb79f('0x3f')]);_0x413a24['query']=_['keys'](_0x8a9ece['query']);_0x413a24[_0xb79f('0x40')]=_['intersection'](_0x413a24[_0xb79f('0x2b')],_0x413a24[_0xb79f('0x2e')]);_0xc4d1af['attributes']=_[_0xb79f('0x2d')](_0x413a24[_0xb79f('0x2b')],qs[_0xb79f('0x2f')](_0x8a9ece['query'][_0xb79f('0x2f')]));_0xc4d1af[_0xb79f('0x30')]=_0xc4d1af[_0xb79f('0x30')]['length']?_0xc4d1af[_0xb79f('0x30')]:_0x413a24['model'];_0xc4d1af[_0xb79f('0x32')]=qs[_0xb79f('0x33')](_0x8a9ece[_0xb79f('0x2e')][_0xb79f('0x33')]);_0xc4d1af[_0xb79f('0x34')]=qs[_0xb79f('0x40')](_['pick'](_0x8a9ece[_0xb79f('0x2e')],_0x413a24['filters']));if(_0x8a9ece['query'][_0xb79f('0x37')]){_0xc4d1af['where']=_[_0xb79f('0x35')](_0xc4d1af[_0xb79f('0x34')],{'$or':_[_0xb79f('0x27')](_0xc4d1af[_0xb79f('0x30')],function(_0x275e14){var _0x2f83f6={};_0x2f83f6[_0x275e14]={'$like':'%'+_0x8a9ece[_0xb79f('0x2e')][_0xb79f('0x37')]+'%'};return _0x2f83f6;})});}_0xc4d1af=_[_0xb79f('0x35')]({},_0xc4d1af,_0x8a9ece[_0xb79f('0x38')]);return _0x1f4873[_0xb79f('0x4d')](_0xc4d1af);}})['then'](function(_0x5c97d8){if(_0x5c97d8){_0x579f91=_0x5c97d8['length'];if(!_0x8a9ece[_0xb79f('0x2e')]['hasOwnProperty'](_0xb79f('0x31'))){_0xc4d1af[_0xb79f('0x1a')]=qs[_0xb79f('0x1a')](_0x8a9ece['query'][_0xb79f('0x1a')]);_0xc4d1af[_0xb79f('0x18')]=qs['offset'](_0x8a9ece[_0xb79f('0x2e')][_0xb79f('0x18')]);}return _0x1f4873[_0xb79f('0x4d')](_0xc4d1af);}})['then'](function(_0x4e140e){if(_0x4e140e){return _0x4e140e?{'count':_0x579f91,'rows':_0x4e140e}:null;}})['then'](respondWithResult(_0x44d137,null))[_0xb79f('0x3c')](handleError(_0x44d137,null));}; \ No newline at end of file +var _0xc8b2=['ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','index','FreshsalesConfiguration','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','intersection','length','find','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','moment','util','path','sox'];(function(_0x145c10,_0x56acfb){var _0x316e17=function(_0x203a48){while(--_0x203a48){_0x145c10['push'](_0x145c10['shift']());}};_0x316e17(++_0x56acfb);}(_0xc8b2,0x13d));var _0x2c8b=function(_0x3f3462,_0x2f7c01){_0x3f3462=_0x3f3462-0x0;var _0x50d730=_0xc8b2[_0x3f3462];return _0x50d730;};'use strict';var emlformat=require(_0x2c8b('0x0'));var rimraf=require(_0x2c8b('0x1'));var zipdir=require(_0x2c8b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2c8b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c8b('0x4'));var path=require(_0x2c8b('0x5'));var sox=require(_0x2c8b('0x6'));var csv=require('to-csv');var ejs=require(_0x2c8b('0x7'));var fs=require('fs');var fs_extra=require(_0x2c8b('0x8'));var _=require(_0x2c8b('0x9'));var squel=require(_0x2c8b('0xa'));var crypto=require('crypto');var jsforce=require(_0x2c8b('0xb'));var deskjs=require(_0x2c8b('0xc'));var toCsv=require(_0x2c8b('0xd'));var querystring=require(_0x2c8b('0xe'));var Papa=require(_0x2c8b('0xf'));var Redis=require(_0x2c8b('0x10'));var authService=require(_0x2c8b('0x11'));var qs=require(_0x2c8b('0x12'));var as=require(_0x2c8b('0x13'));var hardwareService=require(_0x2c8b('0x14'));var logger=require(_0x2c8b('0x15'))(_0x2c8b('0x16'));var utils=require(_0x2c8b('0x17'));var config=require(_0x2c8b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb0d31d,_0x3d36c5){_0x3d36c5=_0x3d36c5||0xcc;return function(_0x4fef82){if(_0x4fef82){return _0xb0d31d[_0x2c8b('0x19')](_0x3d36c5);}return _0xb0d31d[_0x2c8b('0x1a')](_0x3d36c5)['end']();};}function respondWithResult(_0x54aaee,_0x2a514b){_0x2a514b=_0x2a514b||0xc8;return function(_0x3a3b1f){if(_0x3a3b1f){return _0x54aaee[_0x2c8b('0x1a')](_0x2a514b)['json'](_0x3a3b1f);}};}function respondWithFilteredResult(_0x7d0a6,_0x41c505){return function(_0x52b49a){if(_0x52b49a){var _0x7dc9e7=typeof _0x41c505[_0x2c8b('0x1b')]===_0x2c8b('0x1c')&&typeof _0x41c505['limit']===_0x2c8b('0x1c');var _0x1f4774=_0x52b49a['count'];var _0x12fd16=_0x7dc9e7?0x0:_0x41c505[_0x2c8b('0x1b')];var _0xcca354=_0x7dc9e7?_0x52b49a[_0x2c8b('0x1d')]:_0x41c505['offset']+_0x41c505[_0x2c8b('0x1e')];var _0x5e0cdf;if(_0xcca354>=_0x1f4774){_0xcca354=_0x1f4774;_0x5e0cdf=0xc8;}else{_0x5e0cdf=0xce;}_0x7d0a6[_0x2c8b('0x1a')](_0x5e0cdf);return _0x7d0a6[_0x2c8b('0x1f')](_0x2c8b('0x20'),_0x12fd16+'-'+_0xcca354+'/'+_0x1f4774)[_0x2c8b('0x21')](_0x52b49a);}return null;};}function patchUpdates(_0x555187){return function(_0x45ede1){try{jsonpatch['apply'](_0x45ede1,_0x555187,!![]);}catch(_0x1600ec){return BPromise[_0x2c8b('0x22')](_0x1600ec);}return _0x45ede1[_0x2c8b('0x23')]();};}function saveUpdates(_0x4b691d,_0x3f94a9){return function(_0x43baf2){if(_0x43baf2){return _0x43baf2[_0x2c8b('0x24')](_0x4b691d)['then'](function(_0x523e01){return _0x523e01;});}return null;};}function removeEntity(_0x2a8119,_0x1e7f41){return function(_0x2b3bd4){if(_0x2b3bd4){return _0x2b3bd4[_0x2c8b('0x25')]()[_0x2c8b('0x26')](function(){_0x2a8119[_0x2c8b('0x1a')](0xcc)[_0x2c8b('0x27')]();});}};}function handleEntityNotFound(_0x1e31b6,_0x24a5e9){return function(_0x29b45b){if(!_0x29b45b){_0x1e31b6[_0x2c8b('0x19')](0x194);}return _0x29b45b;};}function handleError(_0x4666a9,_0xf6f0da){_0xf6f0da=_0xf6f0da||0x1f4;return function(_0x170d3f){logger[_0x2c8b('0x28')](_0x170d3f[_0x2c8b('0x29')]);if(_0x170d3f['name']){delete _0x170d3f[_0x2c8b('0x2a')];}_0x4666a9['status'](_0xf6f0da)['send'](_0x170d3f);};}exports[_0x2c8b('0x2b')]=function(_0x5a2210,_0x515df1){var _0xc413b1={},_0x2f0e25={},_0x1e4e0c={'count':0x0,'rows':[]};var _0x51e5af=_['map'](db[_0x2c8b('0x2c')][_0x2c8b('0x2d')],function(_0x4e3c5f){return{'name':_0x4e3c5f['fieldName'],'type':_0x4e3c5f[_0x2c8b('0x2e')][_0x2c8b('0x2f')]};});_0x2f0e25[_0x2c8b('0x30')]=_[_0x2c8b('0x31')](_0x51e5af,_0x2c8b('0x2a'));_0x2f0e25[_0x2c8b('0x32')]=_[_0x2c8b('0x33')](_0x5a2210['query']);_0x2f0e25[_0x2c8b('0x34')]=_['intersection'](_0x2f0e25[_0x2c8b('0x30')],_0x2f0e25[_0x2c8b('0x32')]);_0xc413b1[_0x2c8b('0x35')]=_['intersection'](_0x2f0e25['model'],qs[_0x2c8b('0x36')](_0x5a2210['query'][_0x2c8b('0x36')]));_0xc413b1[_0x2c8b('0x35')]=_0xc413b1[_0x2c8b('0x35')]['length']?_0xc413b1[_0x2c8b('0x35')]:_0x2f0e25[_0x2c8b('0x30')];if(!_0x5a2210[_0x2c8b('0x32')][_0x2c8b('0x37')](_0x2c8b('0x38'))){_0xc413b1['limit']=qs[_0x2c8b('0x1e')](_0x5a2210[_0x2c8b('0x32')][_0x2c8b('0x1e')]);_0xc413b1[_0x2c8b('0x1b')]=qs[_0x2c8b('0x1b')](_0x5a2210[_0x2c8b('0x32')][_0x2c8b('0x1b')]);}_0xc413b1[_0x2c8b('0x39')]=qs[_0x2c8b('0x3a')](_0x5a2210[_0x2c8b('0x32')]['sort']);_0xc413b1['where']=qs[_0x2c8b('0x34')](_[_0x2c8b('0x3b')](_0x5a2210[_0x2c8b('0x32')],_0x2f0e25[_0x2c8b('0x34')]),_0x51e5af);if(_0x5a2210['query'][_0x2c8b('0x3c')]){_0xc413b1['where']=_['merge'](_0xc413b1[_0x2c8b('0x3d')],{'$or':_[_0x2c8b('0x31')](_0x51e5af,function(_0x5b9e61){if(_0x5b9e61[_0x2c8b('0x2e')]!==_0x2c8b('0x3e')){var _0x5bcbf9={};_0x5bcbf9[_0x5b9e61[_0x2c8b('0x2a')]]={'$like':'%'+_0x5a2210[_0x2c8b('0x32')][_0x2c8b('0x3c')]+'%'};return _0x5bcbf9;}})});}_0xc413b1=_[_0x2c8b('0x3f')]({},_0xc413b1,_0x5a2210[_0x2c8b('0x40')]);var _0x1056c7={'where':_0xc413b1['where']};return db[_0x2c8b('0x2c')][_0x2c8b('0x1d')](_0x1056c7)['then'](function(_0x5dff4e){_0x1e4e0c[_0x2c8b('0x1d')]=_0x5dff4e;if(_0x5a2210[_0x2c8b('0x32')][_0x2c8b('0x41')]){_0xc413b1[_0x2c8b('0x42')]=[{'all':!![]}];}return db[_0x2c8b('0x2c')][_0x2c8b('0x43')](_0xc413b1);})[_0x2c8b('0x26')](function(_0x3e73fc){_0x1e4e0c[_0x2c8b('0x44')]=_0x3e73fc;return _0x1e4e0c;})[_0x2c8b('0x26')](respondWithFilteredResult(_0x515df1,_0xc413b1))[_0x2c8b('0x45')](handleError(_0x515df1,null));};exports['show']=function(_0x2a5cb6,_0x13be3a){var _0x230b7d={'raw':![],'where':{'id':_0x2a5cb6[_0x2c8b('0x46')]['id']}},_0x1ed05f={};_0x1ed05f[_0x2c8b('0x30')]=_[_0x2c8b('0x33')](db[_0x2c8b('0x2c')][_0x2c8b('0x2d')]);_0x1ed05f[_0x2c8b('0x32')]=_[_0x2c8b('0x33')](_0x2a5cb6[_0x2c8b('0x32')]);_0x1ed05f[_0x2c8b('0x34')]=_[_0x2c8b('0x47')](_0x1ed05f[_0x2c8b('0x30')],_0x1ed05f[_0x2c8b('0x32')]);_0x230b7d[_0x2c8b('0x35')]=_[_0x2c8b('0x47')](_0x1ed05f[_0x2c8b('0x30')],qs[_0x2c8b('0x36')](_0x2a5cb6[_0x2c8b('0x32')][_0x2c8b('0x36')]));_0x230b7d['attributes']=_0x230b7d['attributes'][_0x2c8b('0x48')]?_0x230b7d[_0x2c8b('0x35')]:_0x1ed05f['model'];if(_0x2a5cb6[_0x2c8b('0x32')]['includeAll']){_0x230b7d[_0x2c8b('0x42')]=[{'all':!![]}];}_0x230b7d=_['merge']({},_0x230b7d,_0x2a5cb6[_0x2c8b('0x40')]);return db[_0x2c8b('0x2c')][_0x2c8b('0x49')](_0x230b7d)['then'](handleEntityNotFound(_0x13be3a,null))[_0x2c8b('0x26')](respondWithResult(_0x13be3a,null))[_0x2c8b('0x45')](handleError(_0x13be3a,null));};exports[_0x2c8b('0x4a')]=function(_0x37f245,_0x276ed4){return db[_0x2c8b('0x2c')]['create'](_0x37f245[_0x2c8b('0x4b')],{})['then'](respondWithResult(_0x276ed4,0xc9))[_0x2c8b('0x45')](handleError(_0x276ed4,null));};exports[_0x2c8b('0x24')]=function(_0x791d30,_0x4de24c){if(_0x791d30[_0x2c8b('0x4b')]['id']){delete _0x791d30['body']['id'];}return db[_0x2c8b('0x2c')][_0x2c8b('0x49')]({'where':{'id':_0x791d30['params']['id']}})[_0x2c8b('0x26')](handleEntityNotFound(_0x4de24c,null))[_0x2c8b('0x26')](saveUpdates(_0x791d30[_0x2c8b('0x4b')],null))[_0x2c8b('0x26')](respondWithResult(_0x4de24c,null))[_0x2c8b('0x45')](handleError(_0x4de24c,null));};exports[_0x2c8b('0x25')]=function(_0x1e3c7e,_0x2fb137){return db[_0x2c8b('0x2c')][_0x2c8b('0x49')]({'where':{'id':_0x1e3c7e[_0x2c8b('0x46')]['id']}})[_0x2c8b('0x26')](handleEntityNotFound(_0x2fb137,null))[_0x2c8b('0x26')](removeEntity(_0x2fb137,null))[_0x2c8b('0x45')](handleError(_0x2fb137,null));};exports[_0x2c8b('0x4c')]=function(_0x16cf4a,_0x2e0ff9,_0x497bea){var _0x3e310c={};var _0x14ce3d={};var _0x3c03ee;var _0x49b0f2;return db[_0x2c8b('0x2c')][_0x2c8b('0x4d')]({'where':{'id':_0x16cf4a[_0x2c8b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e0ff9,null))[_0x2c8b('0x26')](function(_0x31605e){if(_0x31605e){_0x3c03ee=_0x31605e;_0x14ce3d[_0x2c8b('0x30')]=_[_0x2c8b('0x33')](db[_0x2c8b('0x4e')][_0x2c8b('0x2d')]);_0x14ce3d[_0x2c8b('0x32')]=_[_0x2c8b('0x33')](_0x16cf4a[_0x2c8b('0x32')]);_0x14ce3d[_0x2c8b('0x34')]=_[_0x2c8b('0x47')](_0x14ce3d[_0x2c8b('0x30')],_0x14ce3d[_0x2c8b('0x32')]);_0x3e310c[_0x2c8b('0x35')]=_['intersection'](_0x14ce3d['model'],qs[_0x2c8b('0x36')](_0x16cf4a[_0x2c8b('0x32')][_0x2c8b('0x36')]));_0x3e310c[_0x2c8b('0x35')]=_0x3e310c[_0x2c8b('0x35')][_0x2c8b('0x48')]?_0x3e310c[_0x2c8b('0x35')]:_0x14ce3d[_0x2c8b('0x30')];_0x3e310c['order']=qs[_0x2c8b('0x3a')](_0x16cf4a[_0x2c8b('0x32')][_0x2c8b('0x3a')]);_0x3e310c[_0x2c8b('0x3d')]=qs[_0x2c8b('0x34')](_[_0x2c8b('0x3b')](_0x16cf4a[_0x2c8b('0x32')],_0x14ce3d[_0x2c8b('0x34')]));if(_0x16cf4a[_0x2c8b('0x32')][_0x2c8b('0x3c')]){_0x3e310c[_0x2c8b('0x3d')]=_['merge'](_0x3e310c[_0x2c8b('0x3d')],{'$or':_[_0x2c8b('0x31')](_0x3e310c[_0x2c8b('0x35')],function(_0x4e77be){var _0x1d5b32={};_0x1d5b32[_0x4e77be]={'$like':'%'+_0x16cf4a[_0x2c8b('0x32')][_0x2c8b('0x3c')]+'%'};return _0x1d5b32;})});}_0x3e310c=_[_0x2c8b('0x3f')]({},_0x3e310c,_0x16cf4a['options']);return _0x3c03ee['getSubjects'](_0x3e310c);}})[_0x2c8b('0x26')](function(_0x245341){if(_0x245341){_0x49b0f2=_0x245341[_0x2c8b('0x48')];if(!_0x16cf4a[_0x2c8b('0x32')][_0x2c8b('0x37')](_0x2c8b('0x38'))){_0x3e310c['limit']=qs[_0x2c8b('0x1e')](_0x16cf4a[_0x2c8b('0x32')][_0x2c8b('0x1e')]);_0x3e310c['offset']=qs[_0x2c8b('0x1b')](_0x16cf4a[_0x2c8b('0x32')][_0x2c8b('0x1b')]);}return _0x3c03ee[_0x2c8b('0x4c')](_0x3e310c);}})[_0x2c8b('0x26')](function(_0x2d3733){if(_0x2d3733){return _0x2d3733?{'count':_0x49b0f2,'rows':_0x2d3733}:null;}})[_0x2c8b('0x26')](respondWithResult(_0x2e0ff9,null))[_0x2c8b('0x45')](handleError(_0x2e0ff9,null));};exports[_0x2c8b('0x4f')]=function(_0x1ba84a,_0x60862e,_0x3d8f54){var _0x7bed40={};var _0x1a430c={};var _0x147491;var _0x1805c1;return db[_0x2c8b('0x2c')][_0x2c8b('0x4d')]({'where':{'id':_0x1ba84a[_0x2c8b('0x46')]['id']}})[_0x2c8b('0x26')](handleEntityNotFound(_0x60862e,null))['then'](function(_0xd74d2b){if(_0xd74d2b){_0x147491=_0xd74d2b;_0x1a430c[_0x2c8b('0x30')]=_[_0x2c8b('0x33')](db[_0x2c8b('0x4e')][_0x2c8b('0x2d')]);_0x1a430c[_0x2c8b('0x32')]=_['keys'](_0x1ba84a[_0x2c8b('0x32')]);_0x1a430c[_0x2c8b('0x34')]=_[_0x2c8b('0x47')](_0x1a430c['model'],_0x1a430c[_0x2c8b('0x32')]);_0x7bed40['attributes']=_[_0x2c8b('0x47')](_0x1a430c[_0x2c8b('0x30')],qs[_0x2c8b('0x36')](_0x1ba84a[_0x2c8b('0x32')][_0x2c8b('0x36')]));_0x7bed40['attributes']=_0x7bed40[_0x2c8b('0x35')]['length']?_0x7bed40[_0x2c8b('0x35')]:_0x1a430c['model'];_0x7bed40[_0x2c8b('0x39')]=qs['sort'](_0x1ba84a[_0x2c8b('0x32')]['sort']);_0x7bed40[_0x2c8b('0x3d')]=qs[_0x2c8b('0x34')](_[_0x2c8b('0x3b')](_0x1ba84a['query'],_0x1a430c['filters']));if(_0x1ba84a[_0x2c8b('0x32')][_0x2c8b('0x3c')]){_0x7bed40[_0x2c8b('0x3d')]=_[_0x2c8b('0x3f')](_0x7bed40['where'],{'$or':_['map'](_0x7bed40[_0x2c8b('0x35')],function(_0x355720){var _0x4b44b2={};_0x4b44b2[_0x355720]={'$like':'%'+_0x1ba84a['query'][_0x2c8b('0x3c')]+'%'};return _0x4b44b2;})});}_0x7bed40=_['merge']({},_0x7bed40,_0x1ba84a['options']);return _0x147491['getDescriptions'](_0x7bed40);}})[_0x2c8b('0x26')](function(_0x84f2ec){if(_0x84f2ec){_0x1805c1=_0x84f2ec[_0x2c8b('0x48')];if(!_0x1ba84a[_0x2c8b('0x32')][_0x2c8b('0x37')](_0x2c8b('0x38'))){_0x7bed40['limit']=qs[_0x2c8b('0x1e')](_0x1ba84a[_0x2c8b('0x32')][_0x2c8b('0x1e')]);_0x7bed40[_0x2c8b('0x1b')]=qs[_0x2c8b('0x1b')](_0x1ba84a[_0x2c8b('0x32')][_0x2c8b('0x1b')]);}return _0x147491[_0x2c8b('0x4f')](_0x7bed40);}})['then'](function(_0x4ff023){if(_0x4ff023){return _0x4ff023?{'count':_0x1805c1,'rows':_0x4ff023}:null;}})[_0x2c8b('0x26')](respondWithResult(_0x60862e,null))[_0x2c8b('0x45')](handleError(_0x60862e,null));};exports[_0x2c8b('0x50')]=function(_0x599e76,_0x5d783c,_0x45afe5){var _0x1d509f={};var _0x3a5e32={};var _0x2e1a0d;var _0x15fb9b;return db[_0x2c8b('0x2c')][_0x2c8b('0x4d')]({'where':{'id':_0x599e76['params']['id']}})[_0x2c8b('0x26')](handleEntityNotFound(_0x5d783c,null))['then'](function(_0x3900cd){if(_0x3900cd){_0x2e1a0d=_0x3900cd;_0x3a5e32[_0x2c8b('0x30')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x3a5e32[_0x2c8b('0x32')]=_[_0x2c8b('0x33')](_0x599e76[_0x2c8b('0x32')]);_0x3a5e32[_0x2c8b('0x34')]=_[_0x2c8b('0x47')](_0x3a5e32[_0x2c8b('0x30')],_0x3a5e32[_0x2c8b('0x32')]);_0x1d509f[_0x2c8b('0x35')]=_[_0x2c8b('0x47')](_0x3a5e32[_0x2c8b('0x30')],qs[_0x2c8b('0x36')](_0x599e76['query'][_0x2c8b('0x36')]));_0x1d509f[_0x2c8b('0x35')]=_0x1d509f[_0x2c8b('0x35')][_0x2c8b('0x48')]?_0x1d509f[_0x2c8b('0x35')]:_0x3a5e32[_0x2c8b('0x30')];_0x1d509f[_0x2c8b('0x39')]=qs[_0x2c8b('0x3a')](_0x599e76['query'][_0x2c8b('0x3a')]);_0x1d509f['where']=qs[_0x2c8b('0x34')](_[_0x2c8b('0x3b')](_0x599e76[_0x2c8b('0x32')],_0x3a5e32[_0x2c8b('0x34')]));if(_0x599e76[_0x2c8b('0x32')][_0x2c8b('0x3c')]){_0x1d509f[_0x2c8b('0x3d')]=_[_0x2c8b('0x3f')](_0x1d509f[_0x2c8b('0x3d')],{'$or':_['map'](_0x1d509f[_0x2c8b('0x35')],function(_0x13cd21){var _0x1dfa92={};_0x1dfa92[_0x13cd21]={'$like':'%'+_0x599e76[_0x2c8b('0x32')][_0x2c8b('0x3c')]+'%'};return _0x1dfa92;})});}_0x1d509f=_[_0x2c8b('0x3f')]({},_0x1d509f,_0x599e76['options']);return _0x2e1a0d['getFields'](_0x1d509f);}})[_0x2c8b('0x26')](function(_0x486b4f){if(_0x486b4f){_0x15fb9b=_0x486b4f[_0x2c8b('0x48')];if(!_0x599e76['query'][_0x2c8b('0x37')](_0x2c8b('0x38'))){_0x1d509f['limit']=qs[_0x2c8b('0x1e')](_0x599e76[_0x2c8b('0x32')]['limit']);_0x1d509f['offset']=qs['offset'](_0x599e76[_0x2c8b('0x32')][_0x2c8b('0x1b')]);}return _0x2e1a0d['getFields'](_0x1d509f);}})[_0x2c8b('0x26')](function(_0x4d581d){if(_0x4d581d){return _0x4d581d?{'count':_0x15fb9b,'rows':_0x4d581d}:null;}})[_0x2c8b('0x26')](respondWithResult(_0x5d783c,null))[_0x2c8b('0x45')](handleError(_0x5d783c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index e98b1e5..ec59fc3 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 _0x7b30=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7b30,0x1d4));var _0x07b3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7b30[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x07b3('0x0'));var util=require(_0x07b3('0x1'));var logger=require(_0x07b3('0x2'))(_0x07b3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x07b3('0x4'));var fs=require('fs');var path=require(_0x07b3('0x5'));var rimraf=require('rimraf');var config=require(_0x07b3('0x6'));var attributes=require(_0x07b3('0x7'));module[_0x07b3('0x8')]=function(_0x28d6f8,_0x3b15fb){return _0x28d6f8[_0x07b3('0x9')](_0x07b3('0xa'),attributes,{'tableName':_0x07b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffd6=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','moment'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xffd6,0x134));var _0x6ffd=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xffd6[_0x3ea913];return _0x2b4f28;};'use strict';var _=require('lodash');var util=require(_0x6ffd('0x0'));var logger=require(_0x6ffd('0x1'))(_0x6ffd('0x2'));var moment=require(_0x6ffd('0x3'));var BPromise=require(_0x6ffd('0x4'));var rp=require(_0x6ffd('0x5'));var fs=require('fs');var path=require(_0x6ffd('0x6'));var rimraf=require(_0x6ffd('0x7'));var config=require(_0x6ffd('0x8'));var attributes=require(_0x6ffd('0x9'));module[_0x6ffd('0xa')]=function(_0x920f8,_0x118982){return _0x920f8['define'](_0x6ffd('0xb'),attributes,{'tableName':_0x6ffd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 18a69d5..90a6eac 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 _0x8a7c=['error','code','message','result','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0x8a7c,0xd4));var _0xc8a7=function(_0x3be72e,_0x3a85ee){_0x3be72e=_0x3be72e-0x0;var _0x1fd7f8=_0x8a7c[_0x3be72e];return _0x1fd7f8;};'use strict';var _=require(_0xc8a7('0x0'));var util=require(_0xc8a7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc8a7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc8a7('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xc8a7('0x4'));var jayson=require(_0xc8a7('0x5'));var client=jayson['client'][_0xc8a7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x228ece,_0xacfa96,_0x5c631d){return new BPromise(function(_0x46c303,_0x1739ac){return client[_0xc8a7('0x7')](_0x228ece,_0x5c631d)['then'](function(_0xe9fc82){logger['info'](_0xc8a7('0x8'),_0xacfa96,_0xc8a7('0x9'));logger['debug'](_0xc8a7('0xa'),_0xacfa96,_0xc8a7('0x9'),JSON[_0xc8a7('0xb')](_0xe9fc82));if(_0xe9fc82[_0xc8a7('0xc')]){if(_0xe9fc82[_0xc8a7('0xc')][_0xc8a7('0xd')]===0x1f4){logger['error'](_0xc8a7('0x8'),_0xacfa96,_0xe9fc82[_0xc8a7('0xc')][_0xc8a7('0xe')]);return _0x1739ac(_0xe9fc82[_0xc8a7('0xc')][_0xc8a7('0xe')]);}logger[_0xc8a7('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xacfa96,_0xe9fc82[_0xc8a7('0xc')][_0xc8a7('0xe')]);return _0x46c303(_0xe9fc82[_0xc8a7('0xc')][_0xc8a7('0xe')]);}else{logger['info'](_0xc8a7('0x8'),_0xacfa96,_0xc8a7('0x9'));_0x46c303(_0xe9fc82[_0xc8a7('0xf')]['message']);}})['catch'](function(_0x468d78){logger[_0xc8a7('0xc')](_0xc8a7('0x8'),_0xacfa96,_0x468d78);_0x1739ac(_0x468d78);});});} \ No newline at end of file +var _0xf889=['jayson/promise','client','request','info','request\x20sent','debug','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/environment'];(function(_0x3da749,_0x4834f5){var _0x173cab=function(_0x507afa){while(--_0x507afa){_0x3da749['push'](_0x3da749['shift']());}};_0x173cab(++_0x4834f5);}(_0xf889,0x92));var _0x9f88=function(_0x385e9e,_0x1b16bb){_0x385e9e=_0x385e9e-0x0;var _0xf77d49=_0xf889[_0x385e9e];return _0xf77d49;};'use strict';var _=require(_0x9f88('0x0'));var util=require(_0x9f88('0x1'));var moment=require(_0x9f88('0x2'));var BPromise=require(_0x9f88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f88('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9f88('0x5'));var jayson=require(_0x9f88('0x6'));var client=jayson[_0x9f88('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25b1c0,_0x7c64d4,_0x1448f0){return new BPromise(function(_0x3290d4,_0x5a26f6){return client[_0x9f88('0x8')](_0x25b1c0,_0x1448f0)['then'](function(_0x4404ef){logger[_0x9f88('0x9')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7c64d4,_0x9f88('0xa'));logger[_0x9f88('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x7c64d4,_0x9f88('0xa'),JSON[_0x9f88('0xc')](_0x4404ef));if(_0x4404ef[_0x9f88('0xd')]){if(_0x4404ef[_0x9f88('0xd')][_0x9f88('0xe')]===0x1f4){logger['error'](_0x9f88('0xf'),_0x7c64d4,_0x4404ef[_0x9f88('0xd')][_0x9f88('0x10')]);return _0x5a26f6(_0x4404ef['error']['message']);}logger[_0x9f88('0xd')](_0x9f88('0xf'),_0x7c64d4,_0x4404ef[_0x9f88('0xd')][_0x9f88('0x10')]);return _0x3290d4(_0x4404ef[_0x9f88('0xd')][_0x9f88('0x10')]);}else{logger[_0x9f88('0x9')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7c64d4,_0x9f88('0xa'));_0x3290d4(_0x4404ef[_0x9f88('0x11')]['message']);}})[_0x9f88('0x12')](function(_0x5f39da){logger[_0x9f88('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7c64d4,_0x5f39da);_0x5a26f6(_0x5f39da);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 78b02d2..0fcb168 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 _0xbf83=['connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x2e2465,_0x132d5e){var _0x4a8cd8=function(_0x39f0ad){while(--_0x39f0ad){_0x2e2465['push'](_0x2e2465['shift']());}};_0x4a8cd8(++_0x132d5e);}(_0xbf83,0x11e));var _0x3bf8=function(_0x4080b6,_0x276b59){_0x4080b6=_0x4080b6-0x0;var _0x38fb33=_0xbf83[_0x4080b6];return _0x38fb33;};'use strict';var multer=require(_0x3bf8('0x0'));var util=require('util');var path=require(_0x3bf8('0x1'));var timeout=require(_0x3bf8('0x2'));var express=require(_0x3bf8('0x3'));var router=express[_0x3bf8('0x4')]();var fs_extra=require(_0x3bf8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3bf8('0x6'));var controller=require(_0x3bf8('0x7'));router[_0x3bf8('0x8')]('/',auth[_0x3bf8('0x9')](),controller['index']);router['get'](_0x3bf8('0xa'),auth[_0x3bf8('0x9')](),controller['show']);router[_0x3bf8('0xb')]('/',auth['isAuthenticated'](),controller[_0x3bf8('0xc')]);router[_0x3bf8('0xd')](_0x3bf8('0xa'),auth[_0x3bf8('0x9')](),controller[_0x3bf8('0xe')]);router[_0x3bf8('0xf')](_0x3bf8('0xa'),auth['isAuthenticated'](),controller[_0x3bf8('0x10')]);module[_0x3bf8('0x11')]=router; \ No newline at end of file +var _0x1d5b=['../../config/environment','isAuthenticated','index','get','/:id','show','post','put','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4d3030,_0x5ceda6){var _0x20b492=function(_0x5baa07){while(--_0x5baa07){_0x4d3030['push'](_0x4d3030['shift']());}};_0x20b492(++_0x5ceda6);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x1657be,_0x526481){_0x1657be=_0x1657be-0x0;var _0x455108=_0x1d5b[_0x1657be];return _0x455108;};'use strict';var multer=require(_0xb1d5('0x0'));var util=require(_0xb1d5('0x1'));var path=require(_0xb1d5('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1d5('0x3'));var router=express['Router']();var fs_extra=require(_0xb1d5('0x4'));var auth=require(_0xb1d5('0x5'));var interaction=require(_0xb1d5('0x6'));var config=require(_0xb1d5('0x7'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xb1d5('0x8')](),controller[_0xb1d5('0x9')]);router[_0xb1d5('0xa')](_0xb1d5('0xb'),auth[_0xb1d5('0x8')](),controller[_0xb1d5('0xc')]);router[_0xb1d5('0xd')]('/',auth[_0xb1d5('0x8')](),controller['create']);router[_0xb1d5('0xe')](_0xb1d5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xb1d5('0xf')](_0xb1d5('0xb'),auth[_0xb1d5('0x8')](),controller['destroy']);module[_0xb1d5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2d7ef3a..a3cfb00 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 _0xfb7e=['STRING','ENUM','BOOLEAN','exports','string','variable','customVariable','picklist'];(function(_0x48200b,_0x3bc629){var _0xd0219a=function(_0x4ee966){while(--_0x4ee966){_0x48200b['push'](_0x48200b['shift']());}};_0xd0219a(++_0x3bc629);}(_0xfb7e,0x1f3));var _0xefb7=function(_0x35dd41,_0x5842e9){_0x35dd41=_0x35dd41-0x0;var _0x55894d=_0xfb7e[_0x35dd41];return _0x55894d;};'use strict';var Sequelize=require('sequelize');module[_0xefb7('0x0')]={'type':{'type':Sequelize['ENUM'](_0xefb7('0x1'),_0xefb7('0x2'),_0xefb7('0x3'),'keyValue',_0xefb7('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xefb7('0x5')]},'keyType':{'type':Sequelize[_0xefb7('0x6')](_0xefb7('0x1'),_0xefb7('0x2'),_0xefb7('0x3'))},'keyContent':{'type':Sequelize[_0xefb7('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xefb7('0x5')]},'customField':{'type':Sequelize[_0xefb7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xefb7('0x5')]}}; \ No newline at end of file +var _0xd1eb=['ENUM','string','customVariable','picklist','variable','STRING','sequelize'];(function(_0xc35e79,_0x37df8f){var _0x2f2750=function(_0x33ab91){while(--_0x33ab91){_0xc35e79['push'](_0xc35e79['shift']());}};_0x2f2750(++_0x37df8f);}(_0xd1eb,0x16b));var _0xbd1e=function(_0x3d4581,_0x3b804f){_0x3d4581=_0x3d4581-0x0;var _0x40a818=_0xd1eb[_0x3d4581];return _0x40a818;};'use strict';var Sequelize=require(_0xbd1e('0x0'));module['exports']={'type':{'type':Sequelize[_0xbd1e('0x1')](_0xbd1e('0x2'),'variable',_0xbd1e('0x3'),'keyValue',_0xbd1e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xbd1e('0x2'),_0xbd1e('0x5'),_0xbd1e('0x3'))},'keyContent':{'type':Sequelize[_0xbd1e('0x6')]},'idField':{'type':Sequelize[_0xbd1e('0x6')]},'nameField':{'type':Sequelize[_0xbd1e('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd1e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 2eaddb5..76349f2 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 _0x512a=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','sort','where','filter','VIRTUAL','merge','includeAll','include','FreshsalesField','catch','length','options','create','body','find','params','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x35c2c8,_0x58aeb8){var _0x25f8cf=function(_0x1d5646){while(--_0x1d5646){_0x35c2c8['push'](_0x35c2c8['shift']());}};_0x25f8cf(++_0x58aeb8);}(_0x512a,0x199));var _0xa512=function(_0x35550f,_0x1d709a){_0x35550f=_0x35550f-0x0;var _0x1e7240=_0x512a[_0x35550f];return _0x1e7240;};'use strict';var emlformat=require(_0xa512('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa512('0x1'));var rp=require(_0xa512('0x2'));var moment=require('moment');var BPromise=require(_0xa512('0x3'));var Mustache=require(_0xa512('0x4'));var util=require(_0xa512('0x5'));var path=require(_0xa512('0x6'));var sox=require(_0xa512('0x7'));var csv=require(_0xa512('0x8'));var ejs=require(_0xa512('0x9'));var fs=require('fs');var fs_extra=require(_0xa512('0xa'));var _=require(_0xa512('0xb'));var squel=require(_0xa512('0xc'));var crypto=require(_0xa512('0xd'));var jsforce=require(_0xa512('0xe'));var deskjs=require(_0xa512('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa512('0x10'));var Papa=require(_0xa512('0x11'));var Redis=require(_0xa512('0x12'));var authService=require(_0xa512('0x13'));var qs=require(_0xa512('0x14'));var as=require(_0xa512('0x15'));var hardwareService=require(_0xa512('0x16'));var logger=require(_0xa512('0x17'))(_0xa512('0x18'));var utils=require(_0xa512('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa512('0x1a'));var db=require(_0xa512('0x1b'))['db'];function respondWithStatusCode(_0x583de8,_0x2d322c){_0x2d322c=_0x2d322c||0xcc;return function(_0x41aa17){if(_0x41aa17){return _0x583de8[_0xa512('0x1c')](_0x2d322c);}return _0x583de8[_0xa512('0x1d')](_0x2d322c)['end']();};}function respondWithResult(_0x336776,_0xa9c9af){_0xa9c9af=_0xa9c9af||0xc8;return function(_0x4ea684){if(_0x4ea684){return _0x336776['status'](_0xa9c9af)['json'](_0x4ea684);}};}function respondWithFilteredResult(_0x128f9a,_0x57f16b){return function(_0x2f6482){if(_0x2f6482){var _0x160e45=typeof _0x57f16b[_0xa512('0x1e')]===_0xa512('0x1f')&&typeof _0x57f16b['limit']===_0xa512('0x1f');var _0x4e2b87=_0x2f6482[_0xa512('0x20')];var _0x3741af=_0x160e45?0x0:_0x57f16b['offset'];var _0x178dea=_0x160e45?_0x2f6482['count']:_0x57f16b['offset']+_0x57f16b[_0xa512('0x21')];var _0x96f708;if(_0x178dea>=_0x4e2b87){_0x178dea=_0x4e2b87;_0x96f708=0xc8;}else{_0x96f708=0xce;}_0x128f9a[_0xa512('0x1d')](_0x96f708);return _0x128f9a[_0xa512('0x22')](_0xa512('0x23'),_0x3741af+'-'+_0x178dea+'/'+_0x4e2b87)[_0xa512('0x24')](_0x2f6482);}return null;};}function patchUpdates(_0x4c3f49){return function(_0x5f4be1){try{jsonpatch[_0xa512('0x25')](_0x5f4be1,_0x4c3f49,!![]);}catch(_0x1ef8a4){return BPromise[_0xa512('0x26')](_0x1ef8a4);}return _0x5f4be1['save']();};}function saveUpdates(_0x4fbae8,_0x5d8346){return function(_0x53ba5b){if(_0x53ba5b){return _0x53ba5b[_0xa512('0x27')](_0x4fbae8)[_0xa512('0x28')](function(_0x3de2e3){return _0x3de2e3;});}return null;};}function removeEntity(_0x5611b,_0x50b2e2){return function(_0x5568e7){if(_0x5568e7){return _0x5568e7[_0xa512('0x29')]()[_0xa512('0x28')](function(){_0x5611b[_0xa512('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e1957,_0x9d74ae){return function(_0x16b897){if(!_0x16b897){_0x1e1957[_0xa512('0x1c')](0x194);}return _0x16b897;};}function handleError(_0x1ca7db,_0x174e43){_0x174e43=_0x174e43||0x1f4;return function(_0x3975e5){logger[_0xa512('0x2a')](_0x3975e5['stack']);if(_0x3975e5['name']){delete _0x3975e5[_0xa512('0x2b')];}_0x1ca7db[_0xa512('0x1d')](_0x174e43)[_0xa512('0x2c')](_0x3975e5);};}exports[_0xa512('0x2d')]=function(_0x27d3fd,_0x43e41b){var _0x41169a={},_0x2b6ed2={},_0x5cbb2a={'count':0x0,'rows':[]};var _0x2e7622=_[_0xa512('0x2e')](db['FreshsalesField'][_0xa512('0x2f')],function(_0x20c129){return{'name':_0x20c129[_0xa512('0x30')],'type':_0x20c129[_0xa512('0x31')]['key']};});_0x2b6ed2[_0xa512('0x32')]=_[_0xa512('0x2e')](_0x2e7622,_0xa512('0x2b'));_0x2b6ed2[_0xa512('0x33')]=_[_0xa512('0x34')](_0x27d3fd[_0xa512('0x33')]);_0x2b6ed2[_0xa512('0x35')]=_[_0xa512('0x36')](_0x2b6ed2[_0xa512('0x32')],_0x2b6ed2['query']);_0x41169a[_0xa512('0x37')]=_[_0xa512('0x36')](_0x2b6ed2[_0xa512('0x32')],qs[_0xa512('0x38')](_0x27d3fd[_0xa512('0x33')][_0xa512('0x38')]));_0x41169a[_0xa512('0x37')]=_0x41169a[_0xa512('0x37')]['length']?_0x41169a[_0xa512('0x37')]:_0x2b6ed2['model'];if(!_0x27d3fd['query']['hasOwnProperty']('nolimit')){_0x41169a[_0xa512('0x21')]=qs[_0xa512('0x21')](_0x27d3fd[_0xa512('0x33')][_0xa512('0x21')]);_0x41169a['offset']=qs[_0xa512('0x1e')](_0x27d3fd[_0xa512('0x33')][_0xa512('0x1e')]);}_0x41169a['order']=qs['sort'](_0x27d3fd['query'][_0xa512('0x39')]);_0x41169a[_0xa512('0x3a')]=qs['filters'](_['pick'](_0x27d3fd[_0xa512('0x33')],_0x2b6ed2['filters']),_0x2e7622);if(_0x27d3fd[_0xa512('0x33')][_0xa512('0x3b')]){_0x41169a[_0xa512('0x3a')]=_['merge'](_0x41169a['where'],{'$or':_[_0xa512('0x2e')](_0x2e7622,function(_0x381ca3){if(_0x381ca3['type']!==_0xa512('0x3c')){var _0x4808be={};_0x4808be[_0x381ca3[_0xa512('0x2b')]]={'$like':'%'+_0x27d3fd[_0xa512('0x33')]['filter']+'%'};return _0x4808be;}})});}_0x41169a=_[_0xa512('0x3d')]({},_0x41169a,_0x27d3fd['options']);var _0x38c5a5={'where':_0x41169a[_0xa512('0x3a')]};return db['FreshsalesField'][_0xa512('0x20')](_0x38c5a5)['then'](function(_0x5ddbfc){_0x5cbb2a[_0xa512('0x20')]=_0x5ddbfc;if(_0x27d3fd[_0xa512('0x33')][_0xa512('0x3e')]){_0x41169a[_0xa512('0x3f')]=[{'all':!![]}];}return db[_0xa512('0x40')]['findAll'](_0x41169a);})[_0xa512('0x28')](function(_0x52a444){_0x5cbb2a['rows']=_0x52a444;return _0x5cbb2a;})[_0xa512('0x28')](respondWithFilteredResult(_0x43e41b,_0x41169a))[_0xa512('0x41')](handleError(_0x43e41b,null));};exports['show']=function(_0x3333cc,_0x327433){var _0x5174bd={'raw':!![],'where':{'id':_0x3333cc['params']['id']}},_0x52910a={};_0x52910a[_0xa512('0x32')]=_[_0xa512('0x34')](db[_0xa512('0x40')][_0xa512('0x2f')]);_0x52910a[_0xa512('0x33')]=_[_0xa512('0x34')](_0x3333cc[_0xa512('0x33')]);_0x52910a[_0xa512('0x35')]=_[_0xa512('0x36')](_0x52910a['model'],_0x52910a['query']);_0x5174bd[_0xa512('0x37')]=_['intersection'](_0x52910a[_0xa512('0x32')],qs['fields'](_0x3333cc[_0xa512('0x33')][_0xa512('0x38')]));_0x5174bd[_0xa512('0x37')]=_0x5174bd[_0xa512('0x37')][_0xa512('0x42')]?_0x5174bd['attributes']:_0x52910a[_0xa512('0x32')];if(_0x3333cc['query'][_0xa512('0x3e')]){_0x5174bd[_0xa512('0x3f')]=[{'all':!![]}];}_0x5174bd=_['merge']({},_0x5174bd,_0x3333cc[_0xa512('0x43')]);return db[_0xa512('0x40')]['find'](_0x5174bd)['then'](handleEntityNotFound(_0x327433,null))['then'](respondWithResult(_0x327433,null))[_0xa512('0x41')](handleError(_0x327433,null));};exports[_0xa512('0x44')]=function(_0x4dcb35,_0xddb6ef){return db['FreshsalesField']['create'](_0x4dcb35['body'],{})[_0xa512('0x28')](respondWithResult(_0xddb6ef,0xc9))['catch'](handleError(_0xddb6ef,null));};exports['update']=function(_0x262190,_0x59d2eb){if(_0x262190[_0xa512('0x45')]['id']){delete _0x262190['body']['id'];}return db['FreshsalesField'][_0xa512('0x46')]({'where':{'id':_0x262190[_0xa512('0x47')]['id']}})[_0xa512('0x28')](handleEntityNotFound(_0x59d2eb,null))[_0xa512('0x28')](saveUpdates(_0x262190[_0xa512('0x45')],null))[_0xa512('0x28')](respondWithResult(_0x59d2eb,null))[_0xa512('0x41')](handleError(_0x59d2eb,null));};exports['destroy']=function(_0x29449c,_0x1f1171){return db[_0xa512('0x40')][_0xa512('0x46')]({'where':{'id':_0x29449c[_0xa512('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f1171,null))['then'](removeEntity(_0x1f1171,null))[_0xa512('0x41')](handleError(_0x1f1171,null));}; \ No newline at end of file +var _0xf631=['stack','name','send','map','FreshsalesField','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','type','VIRTUAL','includeAll','rows','catch','show','params','keys','rawAttributes','include','merge','create','body','find','eml-format','rimraf','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','undefined','count','Content-Range','apply','reject','then','destroy','error'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0xf631,0xaa));var _0x1f63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf631[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1f63('0x0'));var rimraf=require(_0x1f63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1f63('0x2'));var moment=require('moment');var BPromise=require(_0x1f63('0x3'));var Mustache=require(_0x1f63('0x4'));var util=require(_0x1f63('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1f63('0x6'));var ejs=require(_0x1f63('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f63('0x8'));var squel=require(_0x1f63('0x9'));var crypto=require('crypto');var jsforce=require(_0x1f63('0xa'));var deskjs=require(_0x1f63('0xb'));var toCsv=require(_0x1f63('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f63('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x1f63('0xd'));var hardwareService=require(_0x1f63('0xe'));var logger=require(_0x1f63('0xf'))(_0x1f63('0x10'));var utils=require(_0x1f63('0x11'));var config=require(_0x1f63('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x263014,_0x6a520d){_0x6a520d=_0x6a520d||0xcc;return function(_0x4ee397){if(_0x4ee397){return _0x263014[_0x1f63('0x13')](_0x6a520d);}return _0x263014['status'](_0x6a520d)[_0x1f63('0x14')]();};}function respondWithResult(_0x48d81d,_0x2eca7a){_0x2eca7a=_0x2eca7a||0xc8;return function(_0x72470){if(_0x72470){return _0x48d81d[_0x1f63('0x15')](_0x2eca7a)[_0x1f63('0x16')](_0x72470);}};}function respondWithFilteredResult(_0x599302,_0x510fdf){return function(_0x4f97ae){if(_0x4f97ae){var _0x336a6b=typeof _0x510fdf['offset']===_0x1f63('0x17')&&typeof _0x510fdf['limit']===_0x1f63('0x17');var _0x2bb874=_0x4f97ae[_0x1f63('0x18')];var _0x5ca636=_0x336a6b?0x0:_0x510fdf['offset'];var _0x128a29=_0x336a6b?_0x4f97ae[_0x1f63('0x18')]:_0x510fdf['offset']+_0x510fdf['limit'];var _0x62d115;if(_0x128a29>=_0x2bb874){_0x128a29=_0x2bb874;_0x62d115=0xc8;}else{_0x62d115=0xce;}_0x599302['status'](_0x62d115);return _0x599302['set'](_0x1f63('0x19'),_0x5ca636+'-'+_0x128a29+'/'+_0x2bb874)[_0x1f63('0x16')](_0x4f97ae);}return null;};}function patchUpdates(_0x89177a){return function(_0x41dd85){try{jsonpatch[_0x1f63('0x1a')](_0x41dd85,_0x89177a,!![]);}catch(_0x1acdbe){return BPromise[_0x1f63('0x1b')](_0x1acdbe);}return _0x41dd85['save']();};}function saveUpdates(_0x33cdba,_0x2aef7a){return function(_0x314b59){if(_0x314b59){return _0x314b59['update'](_0x33cdba)[_0x1f63('0x1c')](function(_0x3a12f5){return _0x3a12f5;});}return null;};}function removeEntity(_0x5639a4,_0x4eb692){return function(_0xb28f6f){if(_0xb28f6f){return _0xb28f6f[_0x1f63('0x1d')]()[_0x1f63('0x1c')](function(){_0x5639a4[_0x1f63('0x15')](0xcc)[_0x1f63('0x14')]();});}};}function handleEntityNotFound(_0x5bca0e,_0x2a02d0){return function(_0x202fdd){if(!_0x202fdd){_0x5bca0e['sendStatus'](0x194);}return _0x202fdd;};}function handleError(_0xb6abfc,_0xe305ef){_0xe305ef=_0xe305ef||0x1f4;return function(_0x1d8d22){logger[_0x1f63('0x1e')](_0x1d8d22[_0x1f63('0x1f')]);if(_0x1d8d22[_0x1f63('0x20')]){delete _0x1d8d22[_0x1f63('0x20')];}_0xb6abfc[_0x1f63('0x15')](_0xe305ef)[_0x1f63('0x21')](_0x1d8d22);};}exports['index']=function(_0x186b4b,_0x20f800){var _0x56eada={},_0xc594b7={},_0x1df173={'count':0x0,'rows':[]};var _0x3ffc4b=_[_0x1f63('0x22')](db[_0x1f63('0x23')]['rawAttributes'],function(_0x5f1528){return{'name':_0x5f1528['fieldName'],'type':_0x5f1528['type'][_0x1f63('0x24')]};});_0xc594b7[_0x1f63('0x25')]=_[_0x1f63('0x22')](_0x3ffc4b,_0x1f63('0x20'));_0xc594b7[_0x1f63('0x26')]=_['keys'](_0x186b4b['query']);_0xc594b7[_0x1f63('0x27')]=_['intersection'](_0xc594b7[_0x1f63('0x25')],_0xc594b7[_0x1f63('0x26')]);_0x56eada['attributes']=_[_0x1f63('0x28')](_0xc594b7[_0x1f63('0x25')],qs[_0x1f63('0x29')](_0x186b4b[_0x1f63('0x26')][_0x1f63('0x29')]));_0x56eada[_0x1f63('0x2a')]=_0x56eada[_0x1f63('0x2a')][_0x1f63('0x2b')]?_0x56eada[_0x1f63('0x2a')]:_0xc594b7[_0x1f63('0x25')];if(!_0x186b4b[_0x1f63('0x26')][_0x1f63('0x2c')](_0x1f63('0x2d'))){_0x56eada[_0x1f63('0x2e')]=qs['limit'](_0x186b4b[_0x1f63('0x26')]['limit']);_0x56eada[_0x1f63('0x2f')]=qs[_0x1f63('0x2f')](_0x186b4b[_0x1f63('0x26')]['offset']);}_0x56eada[_0x1f63('0x30')]=qs[_0x1f63('0x31')](_0x186b4b[_0x1f63('0x26')][_0x1f63('0x31')]);_0x56eada[_0x1f63('0x32')]=qs[_0x1f63('0x27')](_[_0x1f63('0x33')](_0x186b4b[_0x1f63('0x26')],_0xc594b7[_0x1f63('0x27')]),_0x3ffc4b);if(_0x186b4b[_0x1f63('0x26')][_0x1f63('0x34')]){_0x56eada[_0x1f63('0x32')]=_['merge'](_0x56eada[_0x1f63('0x32')],{'$or':_[_0x1f63('0x22')](_0x3ffc4b,function(_0x1ea8be){if(_0x1ea8be[_0x1f63('0x35')]!==_0x1f63('0x36')){var _0x7b89a5={};_0x7b89a5[_0x1ea8be[_0x1f63('0x20')]]={'$like':'%'+_0x186b4b[_0x1f63('0x26')][_0x1f63('0x34')]+'%'};return _0x7b89a5;}})});}_0x56eada=_['merge']({},_0x56eada,_0x186b4b['options']);var _0x128368={'where':_0x56eada[_0x1f63('0x32')]};return db[_0x1f63('0x23')][_0x1f63('0x18')](_0x128368)[_0x1f63('0x1c')](function(_0x205511){_0x1df173[_0x1f63('0x18')]=_0x205511;if(_0x186b4b[_0x1f63('0x26')][_0x1f63('0x37')]){_0x56eada['include']=[{'all':!![]}];}return db[_0x1f63('0x23')]['findAll'](_0x56eada);})[_0x1f63('0x1c')](function(_0x4e7314){_0x1df173[_0x1f63('0x38')]=_0x4e7314;return _0x1df173;})['then'](respondWithFilteredResult(_0x20f800,_0x56eada))[_0x1f63('0x39')](handleError(_0x20f800,null));};exports[_0x1f63('0x3a')]=function(_0x98df3a,_0x3d926e){var _0x3f24d6={'raw':!![],'where':{'id':_0x98df3a[_0x1f63('0x3b')]['id']}},_0x5eeae8={};_0x5eeae8[_0x1f63('0x25')]=_[_0x1f63('0x3c')](db[_0x1f63('0x23')][_0x1f63('0x3d')]);_0x5eeae8[_0x1f63('0x26')]=_['keys'](_0x98df3a[_0x1f63('0x26')]);_0x5eeae8[_0x1f63('0x27')]=_[_0x1f63('0x28')](_0x5eeae8['model'],_0x5eeae8[_0x1f63('0x26')]);_0x3f24d6[_0x1f63('0x2a')]=_[_0x1f63('0x28')](_0x5eeae8[_0x1f63('0x25')],qs[_0x1f63('0x29')](_0x98df3a['query'][_0x1f63('0x29')]));_0x3f24d6['attributes']=_0x3f24d6[_0x1f63('0x2a')][_0x1f63('0x2b')]?_0x3f24d6[_0x1f63('0x2a')]:_0x5eeae8[_0x1f63('0x25')];if(_0x98df3a[_0x1f63('0x26')]['includeAll']){_0x3f24d6[_0x1f63('0x3e')]=[{'all':!![]}];}_0x3f24d6=_[_0x1f63('0x3f')]({},_0x3f24d6,_0x98df3a['options']);return db['FreshsalesField']['find'](_0x3f24d6)[_0x1f63('0x1c')](handleEntityNotFound(_0x3d926e,null))[_0x1f63('0x1c')](respondWithResult(_0x3d926e,null))[_0x1f63('0x39')](handleError(_0x3d926e,null));};exports[_0x1f63('0x40')]=function(_0x22f0bc,_0xa15679){return db[_0x1f63('0x23')][_0x1f63('0x40')](_0x22f0bc['body'],{})[_0x1f63('0x1c')](respondWithResult(_0xa15679,0xc9))['catch'](handleError(_0xa15679,null));};exports['update']=function(_0x4e3d4d,_0x14fdf0){if(_0x4e3d4d['body']['id']){delete _0x4e3d4d[_0x1f63('0x41')]['id'];}return db['FreshsalesField'][_0x1f63('0x42')]({'where':{'id':_0x4e3d4d[_0x1f63('0x3b')]['id']}})[_0x1f63('0x1c')](handleEntityNotFound(_0x14fdf0,null))[_0x1f63('0x1c')](saveUpdates(_0x4e3d4d[_0x1f63('0x41')],null))[_0x1f63('0x1c')](respondWithResult(_0x14fdf0,null))[_0x1f63('0x39')](handleError(_0x14fdf0,null));};exports[_0x1f63('0x1d')]=function(_0x41e4bd,_0x3dd843){return db['FreshsalesField'][_0x1f63('0x42')]({'where':{'id':_0x41e4bd[_0x1f63('0x3b')]['id']}})[_0x1f63('0x1c')](handleEntityNotFound(_0x3dd843,null))[_0x1f63('0x1c')](removeEntity(_0x3dd843,null))[_0x1f63('0x39')](handleError(_0x3dd843,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index ca03966..48971d0 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 _0xd070=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x579b02,_0x48cb72){var _0x9fd391=function(_0xb1e847){while(--_0xb1e847){_0x579b02['push'](_0x579b02['shift']());}};_0x9fd391(++_0x48cb72);}(_0xd070,0x8e));var _0x0d07=function(_0x37b142,_0x448678){_0x37b142=_0x37b142-0x0;var _0x33767f=_0xd070[_0x37b142];return _0x33767f;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var logger=require(_0x0d07('0x1'))(_0x0d07('0x2'));var moment=require(_0x0d07('0x3'));var BPromise=require(_0x0d07('0x4'));var rp=require(_0x0d07('0x5'));var fs=require('fs');var path=require(_0x0d07('0x6'));var rimraf=require(_0x0d07('0x7'));var config=require(_0x0d07('0x8'));var attributes=require(_0x0d07('0x9'));module[_0x0d07('0xa')]=function(_0x18943f,_0x495815){return _0x18943f[_0x0d07('0xb')]('FreshsalesField',attributes,{'tableName':_0x0d07('0xc'),'paranoid':![],'indexes':[{'name':_0x0d07('0xd'),'fields':[_0x0d07('0xe'),_0x0d07('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbee0=['idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','FreshsalesField','freshsales_unique_index'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbee0,0x147));var _0x0bee=function(_0x344038,_0x438831){_0x344038=_0x344038-0x0;var _0x199979=_0xbee0[_0x344038];return _0x199979;};'use strict';var _=require('lodash');var util=require(_0x0bee('0x0'));var logger=require(_0x0bee('0x1'))(_0x0bee('0x2'));var moment=require(_0x0bee('0x3'));var BPromise=require(_0x0bee('0x4'));var rp=require(_0x0bee('0x5'));var fs=require('fs');var path=require(_0x0bee('0x6'));var rimraf=require(_0x0bee('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0xd0c8f,_0xa3a091){return _0xd0c8f[_0x0bee('0x8')](_0x0bee('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x0bee('0xa'),'fields':[_0x0bee('0xb'),_0x0bee('0xc')],'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 07f650d..11f467c 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 _0x0295=['client','http','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2eacfc,_0x4a0867){var _0xc26f56=function(_0x5b04eb){while(--_0x5b04eb){_0x2eacfc['push'](_0x2eacfc['shift']());}};_0xc26f56(++_0x4a0867);}(_0x0295,0x1f0));var _0x5029=function(_0x366647,_0xd7065c){_0x366647=_0x366647-0x0;var _0x54aed1=_0x0295[_0x366647];return _0x54aed1;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x6d38=['request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3bdd0b,_0x5d711d){var _0x35f170=function(_0x1bdb90){while(--_0x1bdb90){_0x3bdd0b['push'](_0x3bdd0b['shift']());}};_0x35f170(++_0x5d711d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 91f37a6..b1d8033 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4c2600,_0x47edb3){var _0x6d5bb2=function(_0x639134){while(--_0x639134){_0x4c2600['push'](_0x4c2600['shift']());}};_0x6d5bb2(++_0x47edb3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4de521,_0x2bf102){var _0xbb55f6=function(_0x413d15){while(--_0x413d15){_0x4de521['push'](_0x4de521['shift']());}};_0xbb55f6(++_0x2bf102);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 1836a50..9f7e63c 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 _0x0257=['newTab','exports','STRING','username','ENUM','integrationTab'];(function(_0x1bd319,_0x2e8e72){var _0x20bf32=function(_0x28b7ae){while(--_0x28b7ae){_0x1bd319['push'](_0x1bd319['shift']());}};_0x20bf32(++_0x2e8e72);}(_0x0257,0x1db));var _0x7025=function(_0x22b70f,_0x4c853f){_0x22b70f=_0x22b70f-0x0;var _0x100985=_0x0257[_0x22b70f];return _0x100985;};'use strict';var Sequelize=require('sequelize');module[_0x7025('0x0')]={'name':{'type':Sequelize[_0x7025('0x1')]},'description':{'type':Sequelize[_0x7025('0x1')]},'username':{'type':Sequelize[_0x7025('0x1')],'unique':_0x7025('0x2')},'remoteUri':{'type':Sequelize[_0x7025('0x1')]},'password':{'type':Sequelize[_0x7025('0x1')]},'clientId':{'type':Sequelize[_0x7025('0x1')]},'clientSecret':{'type':Sequelize[_0x7025('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7025('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7025('0x3')](_0x7025('0x4'),_0x7025('0x5')),'defaultValue':_0x7025('0x4')}}; \ No newline at end of file +var _0xa908=['newTab','sequelize','STRING','username','integrationTab'];(function(_0x1b244b,_0x1347f5){var _0x1d3aea=function(_0x2ce3fc){while(--_0x2ce3fc){_0x1b244b['push'](_0x1b244b['shift']());}};_0x1d3aea(++_0x1347f5);}(_0xa908,0x1c3));var _0x8a90=function(_0xee209,_0x4858f4){_0xee209=_0xee209-0x0;var _0x48cd8c=_0xa908[_0xee209];return _0x48cd8c;};'use strict';var Sequelize=require(_0x8a90('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a90('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8a90('0x1')],'unique':_0x8a90('0x2')},'remoteUri':{'type':Sequelize[_0x8a90('0x1')]},'password':{'type':Sequelize[_0x8a90('0x1')]},'clientId':{'type':Sequelize[_0x8a90('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x8a90('0x1')]},'serverUrl':{'type':Sequelize[_0x8a90('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8a90('0x3'),_0x8a90('0x4')),'defaultValue':_0x8a90('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b9ba841..ac4d282 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 _0x439f=['undefined','limit','count','json','apply','save','update','then','end','sendStatus','error','send','index','map','SalesforceAccount','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','rows','show','params','keys','includeAll','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','remoteUri','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','email','phone','remove','includes','label','custom','picklistValues','boolean','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset'];(function(_0x5f037a,_0x174055){var _0x68027b=function(_0x3d5edd){while(--_0x3d5edd){_0x5f037a['push'](_0x5f037a['shift']());}};_0x68027b(++_0x174055);}(_0x439f,0x1de));var _0xf439=function(_0x17371c,_0x1a1e9c){_0x17371c=_0x17371c-0x0;var _0x422265=_0x439f[_0x17371c];return _0x422265;};'use strict';var emlformat=require(_0xf439('0x0'));var rimraf=require(_0xf439('0x1'));var zipdir=require(_0xf439('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf439('0x3'));var moment=require(_0xf439('0x4'));var BPromise=require(_0xf439('0x5'));var Mustache=require(_0xf439('0x6'));var util=require('util');var path=require(_0xf439('0x7'));var sox=require(_0xf439('0x8'));var csv=require(_0xf439('0x9'));var ejs=require(_0xf439('0xa'));var fs=require('fs');var fs_extra=require(_0xf439('0xb'));var _=require(_0xf439('0xc'));var squel=require(_0xf439('0xd'));var crypto=require(_0xf439('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf439('0xf'));var toCsv=require(_0xf439('0x9'));var querystring=require(_0xf439('0x10'));var Papa=require('papaparse');var Redis=require(_0xf439('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf439('0x12'));var as=require(_0xf439('0x13'));var hardwareService=require(_0xf439('0x14'));var logger=require(_0xf439('0x15'))(_0xf439('0x16'));var utils=require(_0xf439('0x17'));var config=require(_0xf439('0x18'));var licenseUtil=require(_0xf439('0x19'));var db=require(_0xf439('0x1a'))['db'];var integrations=require(_0xf439('0x1b'));function respondWithStatusCode(_0x16c954,_0x3288a2){_0x3288a2=_0x3288a2||0xcc;return function(_0x3197da){if(_0x3197da){return _0x16c954['sendStatus'](_0x3288a2);}return _0x16c954[_0xf439('0x1c')](_0x3288a2)['end']();};}function respondWithResult(_0x4f3054,_0x1f5c8d){_0x1f5c8d=_0x1f5c8d||0xc8;return function(_0x310dcc){if(_0x310dcc){return _0x4f3054[_0xf439('0x1c')](_0x1f5c8d)['json'](_0x310dcc);}};}function respondWithFilteredResult(_0x4aa2a9,_0x55a16b){return function(_0x5501ba){if(_0x5501ba){var _0x1cd501=typeof _0x55a16b[_0xf439('0x1d')]===_0xf439('0x1e')&&typeof _0x55a16b[_0xf439('0x1f')]===_0xf439('0x1e');var _0x3c959c=_0x5501ba[_0xf439('0x20')];var _0x1d4964=_0x1cd501?0x0:_0x55a16b[_0xf439('0x1d')];var _0x143a26=_0x1cd501?_0x5501ba[_0xf439('0x20')]:_0x55a16b['offset']+_0x55a16b[_0xf439('0x1f')];var _0x136e79;if(_0x143a26>=_0x3c959c){_0x143a26=_0x3c959c;_0x136e79=0xc8;}else{_0x136e79=0xce;}_0x4aa2a9[_0xf439('0x1c')](_0x136e79);return _0x4aa2a9['set']('Content-Range',_0x1d4964+'-'+_0x143a26+'/'+_0x3c959c)[_0xf439('0x21')](_0x5501ba);}return null;};}function patchUpdates(_0x3178ef){return function(_0x15789d){try{jsonpatch[_0xf439('0x22')](_0x15789d,_0x3178ef,!![]);}catch(_0x3cd567){return BPromise['reject'](_0x3cd567);}return _0x15789d[_0xf439('0x23')]();};}function saveUpdates(_0x46a348,_0x37ecd7){return function(_0x51d2f2){if(_0x51d2f2){return _0x51d2f2[_0xf439('0x24')](_0x46a348)['then'](function(_0x5cbe8b){return _0x5cbe8b;});}return null;};}function removeEntity(_0xa28ba0,_0x266bf9){return function(_0x700b5f){if(_0x700b5f){return _0x700b5f['destroy']()[_0xf439('0x25')](function(){_0xa28ba0[_0xf439('0x1c')](0xcc)[_0xf439('0x26')]();});}};}function handleEntityNotFound(_0x25bd92,_0xd3ee92){return function(_0x1687bc){if(!_0x1687bc){_0x25bd92[_0xf439('0x27')](0x194);}return _0x1687bc;};}function handleError(_0x400996,_0x1bbc67){_0x1bbc67=_0x1bbc67||0x1f4;return function(_0x18c808){logger[_0xf439('0x28')](_0x18c808['stack']);if(_0x18c808['name']){delete _0x18c808['name'];}_0x400996[_0xf439('0x1c')](_0x1bbc67)[_0xf439('0x29')](_0x18c808);};}exports[_0xf439('0x2a')]=function(_0x42f688,_0x291229){var _0x37878e={},_0x1918fe={},_0x25cf9b={'count':0x0,'rows':[]};var _0x1c0764=_[_0xf439('0x2b')](db[_0xf439('0x2c')][_0xf439('0x2d')],function(_0x2759e1){return{'name':_0x2759e1['fieldName'],'type':_0x2759e1[_0xf439('0x2e')][_0xf439('0x2f')]};});_0x1918fe[_0xf439('0x30')]=_[_0xf439('0x2b')](_0x1c0764,_0xf439('0x31'));_0x1918fe['query']=_['keys'](_0x42f688[_0xf439('0x32')]);_0x1918fe[_0xf439('0x33')]=_[_0xf439('0x34')](_0x1918fe[_0xf439('0x30')],_0x1918fe[_0xf439('0x32')]);_0x37878e[_0xf439('0x35')]=_[_0xf439('0x34')](_0x1918fe[_0xf439('0x30')],qs[_0xf439('0x36')](_0x42f688[_0xf439('0x32')][_0xf439('0x36')]));_0x37878e[_0xf439('0x35')]=_0x37878e[_0xf439('0x35')][_0xf439('0x37')]?_0x37878e[_0xf439('0x35')]:_0x1918fe[_0xf439('0x30')];if(!_0x42f688[_0xf439('0x32')][_0xf439('0x38')]('nolimit')){_0x37878e[_0xf439('0x1f')]=qs[_0xf439('0x1f')](_0x42f688[_0xf439('0x32')][_0xf439('0x1f')]);_0x37878e[_0xf439('0x1d')]=qs['offset'](_0x42f688['query']['offset']);}_0x37878e[_0xf439('0x39')]=qs[_0xf439('0x3a')](_0x42f688['query'][_0xf439('0x3a')]);_0x37878e[_0xf439('0x3b')]=qs['filters'](_['pick'](_0x42f688[_0xf439('0x32')],_0x1918fe['filters']),_0x1c0764);if(_0x42f688['query'][_0xf439('0x3c')]){_0x37878e[_0xf439('0x3b')]=_[_0xf439('0x3d')](_0x37878e[_0xf439('0x3b')],{'$or':_[_0xf439('0x2b')](_0x1c0764,function(_0x36bd4f){if(_0x36bd4f[_0xf439('0x2e')]!==_0xf439('0x3e')){var _0x4bee19={};_0x4bee19[_0x36bd4f[_0xf439('0x31')]]={'$like':'%'+_0x42f688[_0xf439('0x32')]['filter']+'%'};return _0x4bee19;}})});}_0x37878e=_[_0xf439('0x3d')]({},_0x37878e,_0x42f688[_0xf439('0x3f')]);var _0x2755b7={'where':_0x37878e[_0xf439('0x3b')]};return db['SalesforceAccount']['count'](_0x2755b7)[_0xf439('0x25')](function(_0x309622){_0x25cf9b[_0xf439('0x20')]=_0x309622;if(_0x42f688[_0xf439('0x32')]['includeAll']){_0x37878e[_0xf439('0x40')]=[{'all':!![]}];}return db[_0xf439('0x2c')]['findAll'](_0x37878e);})['then'](function(_0x1f8667){_0x25cf9b[_0xf439('0x41')]=_0x1f8667;return _0x25cf9b;})[_0xf439('0x25')](respondWithFilteredResult(_0x291229,_0x37878e))['catch'](handleError(_0x291229,null));};exports[_0xf439('0x42')]=function(_0x42eadc,_0x5b3773){var _0x1f2f40={'raw':![],'where':{'id':_0x42eadc[_0xf439('0x43')]['id']}},_0x1f4d04={};_0x1f4d04['model']=_[_0xf439('0x44')](db[_0xf439('0x2c')][_0xf439('0x2d')]);_0x1f4d04[_0xf439('0x32')]=_['keys'](_0x42eadc[_0xf439('0x32')]);_0x1f4d04[_0xf439('0x33')]=_[_0xf439('0x34')](_0x1f4d04[_0xf439('0x30')],_0x1f4d04[_0xf439('0x32')]);_0x1f2f40[_0xf439('0x35')]=_[_0xf439('0x34')](_0x1f4d04[_0xf439('0x30')],qs['fields'](_0x42eadc[_0xf439('0x32')][_0xf439('0x36')]));_0x1f2f40[_0xf439('0x35')]=_0x1f2f40['attributes'][_0xf439('0x37')]?_0x1f2f40[_0xf439('0x35')]:_0x1f4d04[_0xf439('0x30')];if(_0x42eadc[_0xf439('0x32')][_0xf439('0x45')]){_0x1f2f40[_0xf439('0x40')]=[{'all':!![]}];}_0x1f2f40=_[_0xf439('0x3d')]({},_0x1f2f40,_0x42eadc[_0xf439('0x3f')]);return db[_0xf439('0x2c')][_0xf439('0x46')](_0x1f2f40)['then'](handleEntityNotFound(_0x5b3773,null))[_0xf439('0x25')](respondWithResult(_0x5b3773,null))[_0xf439('0x47')](handleError(_0x5b3773,null));};exports[_0xf439('0x48')]=function(_0x3f55ab,_0x5cb2af){return db[_0xf439('0x2c')]['create'](_0x3f55ab['body'],{})['then'](respondWithResult(_0x5cb2af,0xc9))[_0xf439('0x47')](handleError(_0x5cb2af,null));};exports['update']=function(_0x174e52,_0x1cf20d){if(_0x174e52[_0xf439('0x49')]['id']){delete _0x174e52[_0xf439('0x49')]['id'];}return db[_0xf439('0x2c')][_0xf439('0x46')]({'where':{'id':_0x174e52[_0xf439('0x43')]['id']}})[_0xf439('0x25')](handleEntityNotFound(_0x1cf20d,null))[_0xf439('0x25')](saveUpdates(_0x174e52[_0xf439('0x49')],null))[_0xf439('0x25')](respondWithResult(_0x1cf20d,null))[_0xf439('0x47')](handleError(_0x1cf20d,null));};exports['destroy']=function(_0x24db11,_0x2f4b3a){return db[_0xf439('0x2c')]['find']({'where':{'id':_0x24db11[_0xf439('0x43')]['id']}})[_0xf439('0x25')](handleEntityNotFound(_0x2f4b3a,null))[_0xf439('0x25')](removeEntity(_0x2f4b3a,null))['catch'](handleError(_0x2f4b3a,null));};exports[_0xf439('0x4a')]=function(_0x551bac,_0x338bf0,_0x31f400){var _0x43492e={};var _0x59c5eb={};var _0x59017a;var _0x59d85f;return db[_0xf439('0x2c')][_0xf439('0x4b')]({'where':{'id':_0x551bac[_0xf439('0x43')]['id']}})[_0xf439('0x25')](handleEntityNotFound(_0x338bf0,null))[_0xf439('0x25')](function(_0x37b71d){if(_0x37b71d){_0x59017a=_0x37b71d;_0x59c5eb[_0xf439('0x30')]=_[_0xf439('0x44')](db[_0xf439('0x4c')][_0xf439('0x2d')]);_0x59c5eb[_0xf439('0x32')]=_[_0xf439('0x44')](_0x551bac[_0xf439('0x32')]);_0x59c5eb[_0xf439('0x33')]=_[_0xf439('0x34')](_0x59c5eb[_0xf439('0x30')],_0x59c5eb[_0xf439('0x32')]);_0x43492e['attributes']=_[_0xf439('0x34')](_0x59c5eb['model'],qs['fields'](_0x551bac[_0xf439('0x32')][_0xf439('0x36')]));_0x43492e[_0xf439('0x35')]=_0x43492e['attributes']['length']?_0x43492e[_0xf439('0x35')]:_0x59c5eb['model'];_0x43492e['order']=qs[_0xf439('0x3a')](_0x551bac[_0xf439('0x32')][_0xf439('0x3a')]);_0x43492e[_0xf439('0x3b')]=qs['filters'](_[_0xf439('0x4d')](_0x551bac[_0xf439('0x32')],_0x59c5eb['filters']));if(_0x551bac[_0xf439('0x32')][_0xf439('0x3c')]){_0x43492e[_0xf439('0x3b')]=_['merge'](_0x43492e[_0xf439('0x3b')],{'$or':_[_0xf439('0x2b')](_0x43492e['attributes'],function(_0x4b7931){var _0x52c7d0={};_0x52c7d0[_0x4b7931]={'$like':'%'+_0x551bac[_0xf439('0x32')][_0xf439('0x3c')]+'%'};return _0x52c7d0;})});}_0x43492e=_[_0xf439('0x3d')]({},_0x43492e,_0x551bac[_0xf439('0x3f')]);return _0x59017a[_0xf439('0x4a')](_0x43492e);}})[_0xf439('0x25')](function(_0x29bc19){if(_0x29bc19){_0x59d85f=_0x29bc19[_0xf439('0x37')];if(!_0x551bac[_0xf439('0x32')][_0xf439('0x38')](_0xf439('0x4e'))){_0x43492e['limit']=qs[_0xf439('0x1f')](_0x551bac[_0xf439('0x32')]['limit']);_0x43492e['offset']=qs['offset'](_0x551bac[_0xf439('0x32')][_0xf439('0x1d')]);}return _0x59017a['getConfigurations'](_0x43492e);}})[_0xf439('0x25')](function(_0x43e7f3){if(_0x43e7f3){return _0x43e7f3?{'count':_0x59d85f,'rows':_0x43e7f3}:null;}})[_0xf439('0x25')](respondWithResult(_0x338bf0,null))[_0xf439('0x47')](handleError(_0x338bf0,null));};exports[_0xf439('0x4f')]=function(_0x598a34,_0x45667e,_0x1bdbd5){if(_0x598a34['body']['id']){delete _0x598a34[_0xf439('0x49')]['id'];}return db[_0xf439('0x2c')]['findOne']({'where':{'id':_0x598a34[_0xf439('0x43')]['id']}})[_0xf439('0x25')](handleEntityNotFound(_0x45667e,null))[_0xf439('0x25')](function(_0x113003){if(_0x113003){_0x598a34['body'][_0xf439('0x50')]=_0x113003['id'];_0x598a34[_0xf439('0x49')][_0xf439('0x51')]=integrations['getSubjects'](_0x598a34[_0xf439('0x49')][_0xf439('0x52')],_0x598a34[_0xf439('0x49')][_0xf439('0x2e')]);_0x598a34[_0xf439('0x49')][_0xf439('0x53')]=integrations[_0xf439('0x54')](_0x598a34[_0xf439('0x49')]['channel'],_0x598a34['body'][_0xf439('0x2e')]);return db[_0xf439('0x4c')][_0xf439('0x48')](_0x598a34[_0xf439('0x49')],{'include':[{'model':db[_0xf439('0x55')],'as':_0xf439('0x51')},{'model':db[_0xf439('0x55')],'as':_0xf439('0x53')}]});}return null;})[_0xf439('0x25')](respondWithResult(_0x45667e,null))['catch'](handleError(_0x45667e,null));};exports['getFields']=function(_0x509650,_0x2da685,_0xc192d9){var _0x35feb3;var _0x470a2a='';var _0x47d457='Task';return db[_0xf439('0x2c')][_0xf439('0x4b')]({'where':{'id':_0x509650[_0xf439('0x43')]['id']},'attributes':['id',_0xf439('0x56'),'clientId',_0xf439('0x57'),_0xf439('0x58'),'password',_0xf439('0x59')]})[_0xf439('0x25')](handleEntityNotFound(_0x2da685,null))[_0xf439('0x25')](function(_0x44bce2){if(_0x44bce2){_0x470a2a=_0x44bce2['remoteUri'];var _0x2ca146=_0x470a2a[_0xf439('0x5a')](-0x1);if(_0x2ca146==='/'){_0x470a2a=_0x470a2a[_0xf439('0x5b')](0x0,_0x470a2a[_0xf439('0x5c')](_0x2ca146));}_0x35feb3=new jsforce[(_0xf439('0x5d'))]({'oauth2':{'loginUrl':_0x470a2a,'clientId':_0x44bce2[_0xf439('0x5e')],'clientSecret':_0x44bce2[_0xf439('0x57')]}});return _0x35feb3[_0xf439('0x5f')](_0x44bce2[_0xf439('0x58')],_0x44bce2[_0xf439('0x60')][_0xf439('0x61')](_0x44bce2[_0xf439('0x59')]));}})[_0xf439('0x25')](function(_0x580c65){if(_0x580c65){if(!_[_0xf439('0x62')](_0x509650[_0xf439('0x32')][_0xf439('0x63')])){_0x47d457=_0x509650[_0xf439('0x32')][_0xf439('0x63')];}return _0x35feb3[_0xf439('0x64')](_0x47d457)[_0xf439('0x65')]();}})[_0xf439('0x25')](function(_0x2b695e){var _0x455baf=[_0xf439('0x66'),_0xf439('0x67'),_0xf439('0x68'),_0xf439('0x69'),_0xf439('0x6a'),'Description'];var _0x52711a=[_0xf439('0x6b'),_0xf439('0x6c'),_0xf439('0x6d'),'boolean',_0xf439('0x6e'),'textarea',_0xf439('0x6f')];if(_0x2b695e){_[_0xf439('0x70')](_0x2b695e['fields'],function(_0xe7d2ad){return _0x455baf[_0xf439('0x71')](_0xe7d2ad['name'])||!_0x52711a[_0xf439('0x71')](_0xe7d2ad['type']);});return{'count':_0x2b695e[_0xf439('0x36')][_0xf439('0x37')],'rows':_['map'](_0x2b695e[_0xf439('0x36')],function(_0x51986a){return{'id':_0x51986a[_0xf439('0x31')],'name':_0x51986a[_0xf439('0x72')],'custom':_0x51986a[_0xf439('0x73')],'options':_0x51986a[_0xf439('0x74')]['length']>0x0?_[_0xf439('0x2b')](_0x51986a[_0xf439('0x74')],function(_0x2694a1){return{'name':_0x2694a1[_0xf439('0x72')],'value':_0x2694a1['value']};}):_0x51986a[_0xf439('0x2e')]==_0xf439('0x75')?[{'name':_0xf439('0x76'),'value':'true'},{'name':_0xf439('0x77'),'value':_0xf439('0x78')}]:[]};})};}})[_0xf439('0x25')](respondWithResult(_0x2da685,null))[_0xf439('0x47')](function(_0x435074){var _0x2c4c86=_0x509650['query'][_0xf439('0x79')]?0x1f4:_0x435074[_0xf439('0x7a')]||0x1f4;logger[_0xf439('0x28')](_0xf439('0x7b'),_0xf439('0x7c'),_0x2c4c86,JSON[_0xf439('0x7d')](_0x435074));delete _0x435074[_0xf439('0x31')];if(_0x2c4c86===0x191){_0x2c4c86=0x190;}_0x2da685['status'](_0x2c4c86)[_0xf439('0x29')](_0x509650['query'][_0xf439('0x79')]?{'message':_0xf439('0x7e'),'statusCode':_0x435074[_0xf439('0x7a')]}:_0x435074);});}; \ No newline at end of file +var _0xe7cd=['find','create','body','destroy','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','concat','ticketType','describe','OwnerId','ActivityDate','IsRecurrence','Subject','string','picklist','boolean','textarea','remove','includes','custom','picklistValues','label','value','True','true','false','test','statusCode','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','sendStatus','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','then','catch','show','params','keys'];(function(_0x2fa64e,_0x40d833){var _0x16367f=function(_0x10da0e){while(--_0x10da0e){_0x2fa64e['push'](_0x2fa64e['shift']());}};_0x16367f(++_0x40d833);}(_0xe7cd,0xaa));var _0xde7c=function(_0x2e2ff9,_0x178c81){_0x2e2ff9=_0x2e2ff9-0x0;var _0x588fe1=_0xe7cd[_0x2e2ff9];return _0x588fe1;};'use strict';var emlformat=require(_0xde7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde7c('0x1'));var jsonpatch=require(_0xde7c('0x2'));var rp=require(_0xde7c('0x3'));var moment=require(_0xde7c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xde7c('0x5'));var util=require('util');var path=require(_0xde7c('0x6'));var sox=require(_0xde7c('0x7'));var csv=require('to-csv');var ejs=require(_0xde7c('0x8'));var fs=require('fs');var fs_extra=require(_0xde7c('0x9'));var _=require('lodash');var squel=require(_0xde7c('0xa'));var crypto=require(_0xde7c('0xb'));var jsforce=require(_0xde7c('0xc'));var deskjs=require(_0xde7c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xde7c('0xe'));var Papa=require(_0xde7c('0xf'));var Redis=require(_0xde7c('0x10'));var authService=require(_0xde7c('0x11'));var qs=require(_0xde7c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde7c('0x13'));var logger=require('../../config/logger')(_0xde7c('0x14'));var utils=require(_0xde7c('0x15'));var config=require(_0xde7c('0x16'));var licenseUtil=require(_0xde7c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xde7c('0x18'));function respondWithStatusCode(_0x133d81,_0x1e2f1e){_0x1e2f1e=_0x1e2f1e||0xcc;return function(_0x48ec21){if(_0x48ec21){return _0x133d81['sendStatus'](_0x1e2f1e);}return _0x133d81[_0xde7c('0x19')](_0x1e2f1e)[_0xde7c('0x1a')]();};}function respondWithResult(_0x182b51,_0x4612c2){_0x4612c2=_0x4612c2||0xc8;return function(_0x2c6864){if(_0x2c6864){return _0x182b51[_0xde7c('0x19')](_0x4612c2)['json'](_0x2c6864);}};}function respondWithFilteredResult(_0x313dab,_0x1adf0e){return function(_0x4b05f5){if(_0x4b05f5){var _0x4d9214=typeof _0x1adf0e[_0xde7c('0x1b')]===_0xde7c('0x1c')&&typeof _0x1adf0e[_0xde7c('0x1d')]===_0xde7c('0x1c');var _0x42480a=_0x4b05f5[_0xde7c('0x1e')];var _0x495b55=_0x4d9214?0x0:_0x1adf0e[_0xde7c('0x1b')];var _0x413732=_0x4d9214?_0x4b05f5[_0xde7c('0x1e')]:_0x1adf0e[_0xde7c('0x1b')]+_0x1adf0e[_0xde7c('0x1d')];var _0x25d915;if(_0x413732>=_0x42480a){_0x413732=_0x42480a;_0x25d915=0xc8;}else{_0x25d915=0xce;}_0x313dab[_0xde7c('0x19')](_0x25d915);return _0x313dab[_0xde7c('0x1f')](_0xde7c('0x20'),_0x495b55+'-'+_0x413732+'/'+_0x42480a)[_0xde7c('0x21')](_0x4b05f5);}return null;};}function patchUpdates(_0xadaa4f){return function(_0x395339){try{jsonpatch[_0xde7c('0x22')](_0x395339,_0xadaa4f,!![]);}catch(_0x3c9bdc){return BPromise[_0xde7c('0x23')](_0x3c9bdc);}return _0x395339[_0xde7c('0x24')]();};}function saveUpdates(_0x555781,_0x468bd5){return function(_0x58bc16){if(_0x58bc16){return _0x58bc16['update'](_0x555781)['then'](function(_0x4c52b2){return _0x4c52b2;});}return null;};}function removeEntity(_0x5aa662,_0x135869){return function(_0x15bf7b){if(_0x15bf7b){return _0x15bf7b['destroy']()['then'](function(){_0x5aa662[_0xde7c('0x19')](0xcc)[_0xde7c('0x1a')]();});}};}function handleEntityNotFound(_0x26f9a2,_0x47164d){return function(_0x59cd72){if(!_0x59cd72){_0x26f9a2[_0xde7c('0x25')](0x194);}return _0x59cd72;};}function handleError(_0x96a23d,_0x5390f3){_0x5390f3=_0x5390f3||0x1f4;return function(_0xd8cb79){logger[_0xde7c('0x26')](_0xd8cb79[_0xde7c('0x27')]);if(_0xd8cb79[_0xde7c('0x28')]){delete _0xd8cb79[_0xde7c('0x28')];}_0x96a23d[_0xde7c('0x19')](_0x5390f3)[_0xde7c('0x29')](_0xd8cb79);};}exports[_0xde7c('0x2a')]=function(_0x127d1e,_0x3b1402){var _0x268fce={},_0x3ff7ac={},_0x1bbade={'count':0x0,'rows':[]};var _0x44696f=_[_0xde7c('0x2b')](db[_0xde7c('0x2c')][_0xde7c('0x2d')],function(_0x2fc1e9){return{'name':_0x2fc1e9[_0xde7c('0x2e')],'type':_0x2fc1e9['type'][_0xde7c('0x2f')]};});_0x3ff7ac['model']=_[_0xde7c('0x2b')](_0x44696f,_0xde7c('0x28'));_0x3ff7ac[_0xde7c('0x30')]=_['keys'](_0x127d1e[_0xde7c('0x30')]);_0x3ff7ac[_0xde7c('0x31')]=_['intersection'](_0x3ff7ac[_0xde7c('0x32')],_0x3ff7ac['query']);_0x268fce[_0xde7c('0x33')]=_[_0xde7c('0x34')](_0x3ff7ac[_0xde7c('0x32')],qs['fields'](_0x127d1e[_0xde7c('0x30')][_0xde7c('0x35')]));_0x268fce[_0xde7c('0x33')]=_0x268fce[_0xde7c('0x33')][_0xde7c('0x36')]?_0x268fce[_0xde7c('0x33')]:_0x3ff7ac[_0xde7c('0x32')];if(!_0x127d1e[_0xde7c('0x30')][_0xde7c('0x37')](_0xde7c('0x38'))){_0x268fce[_0xde7c('0x1d')]=qs[_0xde7c('0x1d')](_0x127d1e[_0xde7c('0x30')]['limit']);_0x268fce['offset']=qs[_0xde7c('0x1b')](_0x127d1e['query'][_0xde7c('0x1b')]);}_0x268fce[_0xde7c('0x39')]=qs[_0xde7c('0x3a')](_0x127d1e[_0xde7c('0x30')][_0xde7c('0x3a')]);_0x268fce['where']=qs[_0xde7c('0x31')](_[_0xde7c('0x3b')](_0x127d1e[_0xde7c('0x30')],_0x3ff7ac[_0xde7c('0x31')]),_0x44696f);if(_0x127d1e[_0xde7c('0x30')][_0xde7c('0x3c')]){_0x268fce[_0xde7c('0x3d')]=_[_0xde7c('0x3e')](_0x268fce[_0xde7c('0x3d')],{'$or':_[_0xde7c('0x2b')](_0x44696f,function(_0x3c7387){if(_0x3c7387[_0xde7c('0x3f')]!==_0xde7c('0x40')){var _0x195660={};_0x195660[_0x3c7387[_0xde7c('0x28')]]={'$like':'%'+_0x127d1e[_0xde7c('0x30')][_0xde7c('0x3c')]+'%'};return _0x195660;}})});}_0x268fce=_[_0xde7c('0x3e')]({},_0x268fce,_0x127d1e[_0xde7c('0x41')]);var _0x8fa1b9={'where':_0x268fce[_0xde7c('0x3d')]};return db['SalesforceAccount'][_0xde7c('0x1e')](_0x8fa1b9)['then'](function(_0x329b0d){_0x1bbade['count']=_0x329b0d;if(_0x127d1e[_0xde7c('0x30')][_0xde7c('0x42')]){_0x268fce['include']=[{'all':!![]}];}return db[_0xde7c('0x2c')][_0xde7c('0x43')](_0x268fce);})['then'](function(_0xef06aa){_0x1bbade[_0xde7c('0x44')]=_0xef06aa;return _0x1bbade;})[_0xde7c('0x45')](respondWithFilteredResult(_0x3b1402,_0x268fce))[_0xde7c('0x46')](handleError(_0x3b1402,null));};exports[_0xde7c('0x47')]=function(_0x17ecf0,_0x2ae391){var _0x35dc04={'raw':![],'where':{'id':_0x17ecf0[_0xde7c('0x48')]['id']}},_0x121969={};_0x121969['model']=_[_0xde7c('0x49')](db['SalesforceAccount'][_0xde7c('0x2d')]);_0x121969[_0xde7c('0x30')]=_[_0xde7c('0x49')](_0x17ecf0[_0xde7c('0x30')]);_0x121969[_0xde7c('0x31')]=_['intersection'](_0x121969[_0xde7c('0x32')],_0x121969[_0xde7c('0x30')]);_0x35dc04['attributes']=_[_0xde7c('0x34')](_0x121969['model'],qs[_0xde7c('0x35')](_0x17ecf0['query'][_0xde7c('0x35')]));_0x35dc04['attributes']=_0x35dc04[_0xde7c('0x33')][_0xde7c('0x36')]?_0x35dc04['attributes']:_0x121969[_0xde7c('0x32')];if(_0x17ecf0[_0xde7c('0x30')]['includeAll']){_0x35dc04['include']=[{'all':!![]}];}_0x35dc04=_[_0xde7c('0x3e')]({},_0x35dc04,_0x17ecf0[_0xde7c('0x41')]);return db['SalesforceAccount'][_0xde7c('0x4a')](_0x35dc04)[_0xde7c('0x45')](handleEntityNotFound(_0x2ae391,null))[_0xde7c('0x45')](respondWithResult(_0x2ae391,null))['catch'](handleError(_0x2ae391,null));};exports[_0xde7c('0x4b')]=function(_0x467a4f,_0x28b10d){return db[_0xde7c('0x2c')]['create'](_0x467a4f[_0xde7c('0x4c')],{})[_0xde7c('0x45')](respondWithResult(_0x28b10d,0xc9))['catch'](handleError(_0x28b10d,null));};exports['update']=function(_0x35e42d,_0x3f4a13){if(_0x35e42d[_0xde7c('0x4c')]['id']){delete _0x35e42d['body']['id'];}return db['SalesforceAccount'][_0xde7c('0x4a')]({'where':{'id':_0x35e42d[_0xde7c('0x48')]['id']}})[_0xde7c('0x45')](handleEntityNotFound(_0x3f4a13,null))[_0xde7c('0x45')](saveUpdates(_0x35e42d['body'],null))[_0xde7c('0x45')](respondWithResult(_0x3f4a13,null))['catch'](handleError(_0x3f4a13,null));};exports[_0xde7c('0x4d')]=function(_0x2a3f92,_0x2791f4){return db[_0xde7c('0x2c')][_0xde7c('0x4a')]({'where':{'id':_0x2a3f92[_0xde7c('0x48')]['id']}})[_0xde7c('0x45')](handleEntityNotFound(_0x2791f4,null))[_0xde7c('0x45')](removeEntity(_0x2791f4,null))[_0xde7c('0x46')](handleError(_0x2791f4,null));};exports[_0xde7c('0x4e')]=function(_0x47102a,_0x436cbe,_0x49ab3f){var _0x26f94e={};var _0x42ac6f={};var _0x20daca;var _0x2fd8a4;return db['SalesforceAccount'][_0xde7c('0x4f')]({'where':{'id':_0x47102a[_0xde7c('0x48')]['id']}})[_0xde7c('0x45')](handleEntityNotFound(_0x436cbe,null))[_0xde7c('0x45')](function(_0x18cd07){if(_0x18cd07){_0x20daca=_0x18cd07;_0x42ac6f[_0xde7c('0x32')]=_['keys'](db['SalesforceConfiguration'][_0xde7c('0x2d')]);_0x42ac6f[_0xde7c('0x30')]=_[_0xde7c('0x49')](_0x47102a['query']);_0x42ac6f['filters']=_[_0xde7c('0x34')](_0x42ac6f[_0xde7c('0x32')],_0x42ac6f['query']);_0x26f94e['attributes']=_[_0xde7c('0x34')](_0x42ac6f[_0xde7c('0x32')],qs[_0xde7c('0x35')](_0x47102a[_0xde7c('0x30')]['fields']));_0x26f94e['attributes']=_0x26f94e[_0xde7c('0x33')][_0xde7c('0x36')]?_0x26f94e[_0xde7c('0x33')]:_0x42ac6f[_0xde7c('0x32')];_0x26f94e[_0xde7c('0x39')]=qs[_0xde7c('0x3a')](_0x47102a[_0xde7c('0x30')]['sort']);_0x26f94e[_0xde7c('0x3d')]=qs[_0xde7c('0x31')](_[_0xde7c('0x3b')](_0x47102a[_0xde7c('0x30')],_0x42ac6f[_0xde7c('0x31')]));if(_0x47102a[_0xde7c('0x30')][_0xde7c('0x3c')]){_0x26f94e[_0xde7c('0x3d')]=_[_0xde7c('0x3e')](_0x26f94e[_0xde7c('0x3d')],{'$or':_[_0xde7c('0x2b')](_0x26f94e[_0xde7c('0x33')],function(_0x4cbfd1){var _0x26c5a1={};_0x26c5a1[_0x4cbfd1]={'$like':'%'+_0x47102a[_0xde7c('0x30')][_0xde7c('0x3c')]+'%'};return _0x26c5a1;})});}_0x26f94e=_['merge']({},_0x26f94e,_0x47102a['options']);return _0x20daca['getConfigurations'](_0x26f94e);}})[_0xde7c('0x45')](function(_0x3ec1d4){if(_0x3ec1d4){_0x2fd8a4=_0x3ec1d4[_0xde7c('0x36')];if(!_0x47102a[_0xde7c('0x30')][_0xde7c('0x37')]('nolimit')){_0x26f94e[_0xde7c('0x1d')]=qs['limit'](_0x47102a[_0xde7c('0x30')]['limit']);_0x26f94e['offset']=qs[_0xde7c('0x1b')](_0x47102a[_0xde7c('0x30')]['offset']);}return _0x20daca[_0xde7c('0x4e')](_0x26f94e);}})['then'](function(_0x3aa35a){if(_0x3aa35a){return _0x3aa35a?{'count':_0x2fd8a4,'rows':_0x3aa35a}:null;}})[_0xde7c('0x45')](respondWithResult(_0x436cbe,null))[_0xde7c('0x46')](handleError(_0x436cbe,null));};exports[_0xde7c('0x50')]=function(_0x31b8f1,_0x288255,_0x4b0f62){if(_0x31b8f1['body']['id']){delete _0x31b8f1[_0xde7c('0x4c')]['id'];}return db[_0xde7c('0x2c')][_0xde7c('0x4f')]({'where':{'id':_0x31b8f1[_0xde7c('0x48')]['id']}})[_0xde7c('0x45')](handleEntityNotFound(_0x288255,null))[_0xde7c('0x45')](function(_0xeabdea){if(_0xeabdea){_0x31b8f1[_0xde7c('0x4c')]['AccountId']=_0xeabdea['id'];_0x31b8f1[_0xde7c('0x4c')][_0xde7c('0x51')]=integrations[_0xde7c('0x52')](_0x31b8f1[_0xde7c('0x4c')][_0xde7c('0x53')],_0x31b8f1[_0xde7c('0x4c')][_0xde7c('0x3f')]);_0x31b8f1['body']['Descriptions']=integrations[_0xde7c('0x54')](_0x31b8f1[_0xde7c('0x4c')]['channel'],_0x31b8f1[_0xde7c('0x4c')][_0xde7c('0x3f')]);return db[_0xde7c('0x55')][_0xde7c('0x4b')](_0x31b8f1[_0xde7c('0x4c')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xde7c('0x56')],'as':'Descriptions'}]});}return null;})[_0xde7c('0x45')](respondWithResult(_0x288255,null))[_0xde7c('0x46')](handleError(_0x288255,null));};exports[_0xde7c('0x57')]=function(_0x126874,_0x58e03d,_0x1bed3a){var _0x23b446;var _0x4157fc='';var _0x277c43=_0xde7c('0x58');return db[_0xde7c('0x2c')][_0xde7c('0x4f')]({'where':{'id':_0x126874[_0xde7c('0x48')]['id']},'attributes':['id',_0xde7c('0x59'),_0xde7c('0x5a'),_0xde7c('0x5b'),_0xde7c('0x5c'),_0xde7c('0x5d'),_0xde7c('0x5e')]})[_0xde7c('0x45')](handleEntityNotFound(_0x58e03d,null))[_0xde7c('0x45')](function(_0x1af004){if(_0x1af004){_0x4157fc=_0x1af004[_0xde7c('0x59')];var _0x284d96=_0x4157fc[_0xde7c('0x5f')](-0x1);if(_0x284d96==='/'){_0x4157fc=_0x4157fc[_0xde7c('0x60')](0x0,_0x4157fc[_0xde7c('0x61')](_0x284d96));}_0x23b446=new jsforce[(_0xde7c('0x62'))]({'oauth2':{'loginUrl':_0x4157fc,'clientId':_0x1af004[_0xde7c('0x5a')],'clientSecret':_0x1af004[_0xde7c('0x5b')]}});return _0x23b446['login'](_0x1af004[_0xde7c('0x5c')],_0x1af004[_0xde7c('0x5d')][_0xde7c('0x63')](_0x1af004[_0xde7c('0x5e')]));}})['then'](function(_0x56500c){if(_0x56500c){if(!_['isNil'](_0x126874[_0xde7c('0x30')][_0xde7c('0x64')])){_0x277c43=_0x126874['query'][_0xde7c('0x64')];}return _0x23b446['sobject'](_0x277c43)[_0xde7c('0x65')]();}})[_0xde7c('0x45')](function(_0x150a1d){var _0x12336d=[_0xde7c('0x66'),_0xde7c('0x67'),'IsReminderSet',_0xde7c('0x68'),_0xde7c('0x69'),'Description'];var _0x437a1c=[_0xde7c('0x6a'),'int',_0xde7c('0x6b'),_0xde7c('0x6c'),'email',_0xde7c('0x6d'),'phone'];if(_0x150a1d){_[_0xde7c('0x6e')](_0x150a1d[_0xde7c('0x35')],function(_0x24359f){return _0x12336d[_0xde7c('0x6f')](_0x24359f['name'])||!_0x437a1c[_0xde7c('0x6f')](_0x24359f['type']);});return{'count':_0x150a1d['fields'][_0xde7c('0x36')],'rows':_[_0xde7c('0x2b')](_0x150a1d[_0xde7c('0x35')],function(_0x99b415){return{'id':_0x99b415[_0xde7c('0x28')],'name':_0x99b415['label'],'custom':_0x99b415[_0xde7c('0x70')],'options':_0x99b415[_0xde7c('0x71')]['length']>0x0?_[_0xde7c('0x2b')](_0x99b415[_0xde7c('0x71')],function(_0x5ab758){return{'name':_0x5ab758[_0xde7c('0x72')],'value':_0x5ab758[_0xde7c('0x73')]};}):_0x99b415[_0xde7c('0x3f')]=='boolean'?[{'name':_0xde7c('0x74'),'value':_0xde7c('0x75')},{'name':'False','value':_0xde7c('0x76')}]:[]};})};}})[_0xde7c('0x45')](respondWithResult(_0x58e03d,null))[_0xde7c('0x46')](function(_0x4c9537){var _0x59c7ac=_0x126874[_0xde7c('0x30')][_0xde7c('0x77')]?0x1f4:_0x4c9537[_0xde7c('0x78')]||0x1f4;logger[_0xde7c('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x59c7ac,JSON[_0xde7c('0x79')](_0x4c9537));delete _0x4c9537['name'];if(_0x59c7ac===0x191){_0x59c7ac=0x190;}_0x58e03d[_0xde7c('0x19')](_0x59c7ac)[_0xde7c('0x29')](_0x126874[_0xde7c('0x30')][_0xde7c('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x4c9537[_0xde7c('0x78')]}:_0x4c9537);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4c11b9b..bf0ca94 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 _0xd0e9=['exports','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x5b9be4,_0x1d724c){var _0x5f29b7=function(_0x5097d5){while(--_0x5097d5){_0x5b9be4['push'](_0x5b9be4['shift']());}};_0x5f29b7(++_0x1d724c);}(_0xd0e9,0x1d6));var _0x9d0e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd0e9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9d0e('0x0'));var util=require(_0x9d0e('0x1'));var logger=require(_0x9d0e('0x2'))(_0x9d0e('0x3'));var moment=require('moment');var BPromise=require(_0x9d0e('0x4'));var rp=require(_0x9d0e('0x5'));var fs=require('fs');var path=require(_0x9d0e('0x6'));var rimraf=require(_0x9d0e('0x7'));var config=require('../../config/environment');var attributes=require(_0x9d0e('0x8'));var integrations=require(_0x9d0e('0x9'));module[_0x9d0e('0xa')]=function(_0x637ddc,_0x491405){return _0x637ddc['define']('SalesforceAccount',attributes,{'tableName':_0x9d0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6c7=['exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','bluebird','request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x1830c2,_0x4f8216){var _0x1a995e=function(_0x3c8476){while(--_0x3c8476){_0x1830c2['push'](_0x1830c2['shift']());}};_0x1a995e(++_0x4f8216);}(_0xf6c7,0x143));var _0x7f6c=function(_0x4f3fb2,_0x344590){_0x4f3fb2=_0x4f3fb2-0x0;var _0x105d62=_0xf6c7[_0x4f3fb2];return _0x105d62;};'use strict';var _=require(_0x7f6c('0x0'));var util=require('util');var logger=require(_0x7f6c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7f6c('0x2'));var rp=require(_0x7f6c('0x3'));var fs=require('fs');var path=require(_0x7f6c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7f6c('0x5'));var integrations=require(_0x7f6c('0x6'));module[_0x7f6c('0x7')]=function(_0x2885bf,_0x24c163){return _0x2885bf[_0x7f6c('0x8')](_0x7f6c('0x9'),attributes,{'tableName':_0x7f6c('0xa'),'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 9ff6b06..3eb0c2c 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 _0x2555=['find','where','ShowSalesforceAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model'];(function(_0x221b8c,_0x2c7afc){var _0x3fab9f=function(_0x28bab0){while(--_0x28bab0){_0x221b8c['push'](_0x221b8c['shift']());}};_0x3fab9f(++_0x2c7afc);}(_0x2555,0x11b));var _0x5255=function(_0x132e70,_0x99809f){_0x132e70=_0x132e70-0x0;var _0x3a4dad=_0x2555[_0x132e70];return _0x3a4dad;};'use strict';var _=require(_0x5255('0x0'));var util=require(_0x5255('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5255('0x2'));var fs=require('fs');var Redis=require(_0x5255('0x3'));var db=require(_0x5255('0x4'))['db'];var utils=require(_0x5255('0x5'));var logger=require(_0x5255('0x6'))(_0x5255('0x7'));var config=require(_0x5255('0x8'));var jayson=require(_0x5255('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32bc44,_0x37d12b,_0x2e857f){return new BPromise(function(_0x6fabc8,_0x418df4){return client[_0x5255('0xa')](_0x32bc44,_0x2e857f)[_0x5255('0xb')](function(_0x447dbc){logger[_0x5255('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x37d12b,_0x5255('0xd'));logger[_0x5255('0xe')](_0x5255('0xf'),_0x37d12b,_0x5255('0xd'),JSON[_0x5255('0x10')](_0x447dbc));if(_0x447dbc['error']){if(_0x447dbc[_0x5255('0x11')][_0x5255('0x12')]===0x1f4){logger[_0x5255('0x11')](_0x5255('0x13'),_0x37d12b,_0x447dbc['error']['message']);return _0x418df4(_0x447dbc[_0x5255('0x11')]['message']);}logger[_0x5255('0x11')](_0x5255('0x13'),_0x37d12b,_0x447dbc[_0x5255('0x11')][_0x5255('0x14')]);return _0x6fabc8(_0x447dbc[_0x5255('0x11')][_0x5255('0x14')]);}else{logger[_0x5255('0xc')](_0x5255('0x13'),_0x37d12b,_0x5255('0xd'));_0x6fabc8(_0x447dbc[_0x5255('0x15')][_0x5255('0x14')]);}})[_0x5255('0x16')](function(_0x36a5e2){logger['error'](_0x5255('0x13'),_0x37d12b,_0x36a5e2);_0x418df4(_0x36a5e2);});});}exports[_0x5255('0x17')]=function(_0x45caad){var _0x2892a4=this;return new Promise(function(_0x1984e9,_0x5d6ce6){return db[_0x5255('0x18')]['findAll']({'raw':_0x45caad[_0x5255('0x19')]?_0x45caad[_0x5255('0x19')][_0x5255('0x1a')]===undefined?!![]:![]:!![],'where':_0x45caad['options']?_0x45caad[_0x5255('0x19')]['where']||null:null,'attributes':_0x45caad[_0x5255('0x19')]?_0x45caad['options'][_0x5255('0x1b')]||null:null,'limit':_0x45caad[_0x5255('0x19')]?_0x45caad[_0x5255('0x19')][_0x5255('0x1c')]||null:null,'include':_0x45caad[_0x5255('0x19')]?_0x45caad['options'][_0x5255('0x1d')]?_[_0x5255('0x1e')](_0x45caad[_0x5255('0x19')][_0x5255('0x1d')],function(_0x5e65ff){return{'model':db[_0x5e65ff[_0x5255('0x1f')]],'as':_0x5e65ff['as'],'attributes':_0x5e65ff[_0x5255('0x1b')],'include':_0x5e65ff[_0x5255('0x1d')]?_[_0x5255('0x1e')](_0x5e65ff[_0x5255('0x1d')],function(_0x38dd02){return{'model':db[_0x38dd02[_0x5255('0x1f')]],'as':_0x38dd02['as'],'attributes':_0x38dd02[_0x5255('0x1b')],'include':_0x38dd02[_0x5255('0x1d')]?_[_0x5255('0x1e')](_0x38dd02[_0x5255('0x1d')],function(_0x6446c7){return{'model':db[_0x6446c7['model']],'as':_0x6446c7['as'],'attributes':_0x6446c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x5255('0xb')](function(_0x567533){logger[_0x5255('0xc')](_0x5255('0x17'),_0x45caad);logger[_0x5255('0xe')](_0x5255('0x17'),_0x45caad,JSON['stringify'](_0x567533));_0x1984e9(_0x567533);})['catch'](function(_0x240f10){logger[_0x5255('0x11')](_0x5255('0x17'),_0x240f10[_0x5255('0x14')],_0x45caad);_0x5d6ce6(_0x2892a4[_0x5255('0x11')](0x1f4,_0x240f10[_0x5255('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x104733){var _0x5e19aa=this;return new Promise(function(_0x226514,_0x476056){return db['SalesforceAccount'][_0x5255('0x20')]({'raw':_0x104733[_0x5255('0x19')]?_0x104733['options'][_0x5255('0x1a')]===undefined?!![]:![]:!![],'where':_0x104733['options']?_0x104733['options'][_0x5255('0x21')]||null:null,'attributes':_0x104733[_0x5255('0x19')]?_0x104733[_0x5255('0x19')][_0x5255('0x1b')]||null:null,'include':_0x104733[_0x5255('0x19')]?_0x104733[_0x5255('0x19')][_0x5255('0x1d')]?_[_0x5255('0x1e')](_0x104733[_0x5255('0x19')]['include'],function(_0x525a1d){return{'model':db[_0x525a1d[_0x5255('0x1f')]],'as':_0x525a1d['as'],'attributes':_0x525a1d[_0x5255('0x1b')],'include':_0x525a1d[_0x5255('0x1d')]?_[_0x5255('0x1e')](_0x525a1d[_0x5255('0x1d')],function(_0x541631){return{'model':db[_0x541631[_0x5255('0x1f')]],'as':_0x541631['as'],'attributes':_0x541631[_0x5255('0x1b')],'include':_0x541631[_0x5255('0x1d')]?_['map'](_0x541631[_0x5255('0x1d')],function(_0xa8bc57){return{'model':db[_0xa8bc57[_0x5255('0x1f')]],'as':_0xa8bc57['as'],'attributes':_0xa8bc57[_0x5255('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5255('0xb')](function(_0x3c378c){logger[_0x5255('0xc')](_0x5255('0x22'),_0x104733);logger[_0x5255('0xe')]('ShowSalesforceAccount',_0x104733,JSON[_0x5255('0x10')](_0x3c378c));_0x226514(_0x3c378c);})['catch'](function(_0x501faf){logger['error'](_0x5255('0x22'),_0x501faf[_0x5255('0x14')],_0x104733);_0x476056(_0x5e19aa['error'](0x1f4,_0x501faf['message']));});});}; \ No newline at end of file +var _0x5cc6=['randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','raw','options','where','attributes','limit','include','map','model','ShowSalesforceAccount','lodash','util','moment'];(function(_0x3401ce,_0x5d1579){var _0x1bb79d=function(_0x46985e){while(--_0x46985e){_0x3401ce['push'](_0x3401ce['shift']());}};_0x1bb79d(++_0x5d1579);}(_0x5cc6,0x13d));var _0x65cc=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0x5cc6[_0x199bc4];return _0x136ffb;};'use strict';var _=require(_0x65cc('0x0'));var util=require(_0x65cc('0x1'));var moment=require(_0x65cc('0x2'));var BPromise=require('bluebird');var rs=require(_0x65cc('0x3'));var fs=require('fs');var Redis=require(_0x65cc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x65cc('0x5'));var config=require(_0x65cc('0x6'));var jayson=require(_0x65cc('0x7'));var client=jayson['client'][_0x65cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x503655,_0x31aaed,_0x3601b0){return new BPromise(function(_0x397737,_0x1d494c){return client[_0x65cc('0x9')](_0x503655,_0x3601b0)[_0x65cc('0xa')](function(_0x31b3c4){logger[_0x65cc('0xb')](_0x65cc('0xc'),_0x31aaed,'request\x20sent');logger[_0x65cc('0xd')](_0x65cc('0xe'),_0x31aaed,_0x65cc('0xf'),JSON[_0x65cc('0x10')](_0x31b3c4));if(_0x31b3c4['error']){if(_0x31b3c4['error']['code']===0x1f4){logger['error'](_0x65cc('0xc'),_0x31aaed,_0x31b3c4[_0x65cc('0x11')][_0x65cc('0x12')]);return _0x1d494c(_0x31b3c4[_0x65cc('0x11')][_0x65cc('0x12')]);}logger['error'](_0x65cc('0xc'),_0x31aaed,_0x31b3c4['error'][_0x65cc('0x12')]);return _0x397737(_0x31b3c4[_0x65cc('0x11')][_0x65cc('0x12')]);}else{logger[_0x65cc('0xb')](_0x65cc('0xc'),_0x31aaed,'request\x20sent');_0x397737(_0x31b3c4['result']['message']);}})[_0x65cc('0x13')](function(_0x5a9c29){logger[_0x65cc('0x11')](_0x65cc('0xc'),_0x31aaed,_0x5a9c29);_0x1d494c(_0x5a9c29);});});}exports[_0x65cc('0x14')]=function(_0x5bfc0e){var _0x114560=this;return new Promise(function(_0x7d5685,_0x13e52e){return db[_0x65cc('0x15')][_0x65cc('0x16')]({'raw':_0x5bfc0e['options']?_0x5bfc0e['options'][_0x65cc('0x17')]===undefined?!![]:![]:!![],'where':_0x5bfc0e[_0x65cc('0x18')]?_0x5bfc0e[_0x65cc('0x18')][_0x65cc('0x19')]||null:null,'attributes':_0x5bfc0e['options']?_0x5bfc0e[_0x65cc('0x18')][_0x65cc('0x1a')]||null:null,'limit':_0x5bfc0e[_0x65cc('0x18')]?_0x5bfc0e[_0x65cc('0x18')][_0x65cc('0x1b')]||null:null,'include':_0x5bfc0e[_0x65cc('0x18')]?_0x5bfc0e[_0x65cc('0x18')][_0x65cc('0x1c')]?_[_0x65cc('0x1d')](_0x5bfc0e['options'][_0x65cc('0x1c')],function(_0xc2fcd8){return{'model':db[_0xc2fcd8[_0x65cc('0x1e')]],'as':_0xc2fcd8['as'],'attributes':_0xc2fcd8[_0x65cc('0x1a')],'include':_0xc2fcd8['include']?_[_0x65cc('0x1d')](_0xc2fcd8[_0x65cc('0x1c')],function(_0x1a014b){return{'model':db[_0x1a014b[_0x65cc('0x1e')]],'as':_0x1a014b['as'],'attributes':_0x1a014b[_0x65cc('0x1a')],'include':_0x1a014b['include']?_[_0x65cc('0x1d')](_0x1a014b['include'],function(_0x403a0f){return{'model':db[_0x403a0f[_0x65cc('0x1e')]],'as':_0x403a0f['as'],'attributes':_0x403a0f[_0x65cc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65cc('0xa')](function(_0x442a41){logger['info'](_0x65cc('0x14'),_0x5bfc0e);logger[_0x65cc('0xd')](_0x65cc('0x14'),_0x5bfc0e,JSON[_0x65cc('0x10')](_0x442a41));_0x7d5685(_0x442a41);})[_0x65cc('0x13')](function(_0x20c07f){logger[_0x65cc('0x11')](_0x65cc('0x14'),_0x20c07f[_0x65cc('0x12')],_0x5bfc0e);_0x13e52e(_0x114560[_0x65cc('0x11')](0x1f4,_0x20c07f[_0x65cc('0x12')]));});});};exports[_0x65cc('0x1f')]=function(_0x23ee54){var _0x23cfb5=this;return new Promise(function(_0x208c5a,_0x49bbd8){return db[_0x65cc('0x15')]['find']({'raw':_0x23ee54[_0x65cc('0x18')]?_0x23ee54[_0x65cc('0x18')][_0x65cc('0x17')]===undefined?!![]:![]:!![],'where':_0x23ee54[_0x65cc('0x18')]?_0x23ee54[_0x65cc('0x18')][_0x65cc('0x19')]||null:null,'attributes':_0x23ee54['options']?_0x23ee54[_0x65cc('0x18')]['attributes']||null:null,'include':_0x23ee54['options']?_0x23ee54[_0x65cc('0x18')][_0x65cc('0x1c')]?_[_0x65cc('0x1d')](_0x23ee54['options']['include'],function(_0x49ee9d){return{'model':db[_0x49ee9d[_0x65cc('0x1e')]],'as':_0x49ee9d['as'],'attributes':_0x49ee9d[_0x65cc('0x1a')],'include':_0x49ee9d[_0x65cc('0x1c')]?_[_0x65cc('0x1d')](_0x49ee9d[_0x65cc('0x1c')],function(_0x14755f){return{'model':db[_0x14755f[_0x65cc('0x1e')]],'as':_0x14755f['as'],'attributes':_0x14755f[_0x65cc('0x1a')],'include':_0x14755f[_0x65cc('0x1c')]?_[_0x65cc('0x1d')](_0x14755f[_0x65cc('0x1c')],function(_0x5ef8fd){return{'model':db[_0x5ef8fd[_0x65cc('0x1e')]],'as':_0x5ef8fd['as'],'attributes':_0x5ef8fd[_0x65cc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b3559){logger['info'](_0x65cc('0x1f'),_0x23ee54);logger[_0x65cc('0xd')](_0x65cc('0x1f'),_0x23ee54,JSON[_0x65cc('0x10')](_0x5b3559));_0x208c5a(_0x5b3559);})[_0x65cc('0x13')](function(_0x552144){logger['error'](_0x65cc('0x1f'),_0x552144[_0x65cc('0x12')],_0x23ee54);_0x49bbd8(_0x23cfb5[_0x65cc('0x11')](0x1f4,_0x552144[_0x65cc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b83d482..9e10736 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xdb28,0x106));var _0x8db2=function(_0x231430,_0x4e4337){_0x231430=_0x231430-0x0;var _0x4e9cf0=_0xdb28[_0x231430];return _0x4e9cf0;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1af944,_0x5f4274){var _0xc5d2b6=function(_0x6c41e){while(--_0x6c41e){_0x1af944['push'](_0x1af944['shift']());}};_0xc5d2b6(++_0x5f4274);}(_0x5f2f,0x73));var _0xf5f2=function(_0x52b0ef,_0x5f4989){_0x52b0ef=_0x52b0ef-0x0;var _0x321bbf=_0x5f2f[_0x52b0ef];return _0x321bbf;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f8fbb56..e311201 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 _0xbaaf=['account_contact_lead','account','nothing','contact','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','lead'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbaaf,0x1a8));var _0xfbaa=function(_0x2e8bea,_0x2ce264){_0x2e8bea=_0x2e8bea-0x0;var _0x157f22=_0xbaaf[_0x2e8bea];return _0x157f22;};'use strict';var Sequelize=require(_0xfbaa('0x0'));module[_0xfbaa('0x1')]={'name':{'type':Sequelize[_0xfbaa('0x2')]},'description':{'type':Sequelize[_0xfbaa('0x2')]},'ticketType':{'type':Sequelize[_0xfbaa('0x3')](_0xfbaa('0x4'),_0xfbaa('0x5')),'defaultValue':_0xfbaa('0x4')},'moduleSearch':{'type':Sequelize[_0xfbaa('0x3')](_0xfbaa('0x6'),'contact',_0xfbaa('0x7'),_0xfbaa('0x8'),_0xfbaa('0x9')),'defaultValue':_0xfbaa('0x6')},'moduleCreate':{'type':Sequelize[_0xfbaa('0x3')](_0xfbaa('0xa'),_0xfbaa('0xb'),_0xfbaa('0x7'),'account'),'defaultValue':_0xfbaa('0x7')},'leadId':{'type':Sequelize[_0xfbaa('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xfbaa('0x2')]}}; \ No newline at end of file +var _0x0c73=['account','nothing','sequelize','STRING','Task','ENUM','contact_lead','contact','lead','account_contact_lead'];(function(_0x2bf2a9,_0x5c8556){var _0x19f039=function(_0x129421){while(--_0x129421){_0x2bf2a9['push'](_0x2bf2a9['shift']());}};_0x19f039(++_0x5c8556);}(_0x0c73,0x17e));var _0x30c7=function(_0xea63d4,_0x23150a){_0xea63d4=_0xea63d4-0x0;var _0x1fcd67=_0x0c73[_0xea63d4];return _0x1fcd67;};'use strict';var Sequelize=require(_0x30c7('0x0'));module['exports']={'name':{'type':Sequelize[_0x30c7('0x1')]},'description':{'type':Sequelize[_0x30c7('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x30c7('0x2'),'Case'),'defaultValue':_0x30c7('0x2')},'moduleSearch':{'type':Sequelize[_0x30c7('0x3')](_0x30c7('0x4'),_0x30c7('0x5'),_0x30c7('0x6'),_0x30c7('0x7'),_0x30c7('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x30c7('0x3')](_0x30c7('0x9'),'contact',_0x30c7('0x6'),_0x30c7('0x8')),'defaultValue':_0x30c7('0x6')},'leadId':{'type':Sequelize[_0x30c7('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x30c7('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x30c7('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x30c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 62562e0..c7509e6 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 _0xa234=['limit','offset','set','Content-Range','json','apply','update','then','stack','name','index','map','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','SalesforceConfiguration','count','includeAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','getFields','keys','SalesforceField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined'];(function(_0x260dd0,_0x4ff3be){var _0x2b463e=function(_0x270ea9){while(--_0x270ea9){_0x260dd0['push'](_0x260dd0['shift']());}};_0x2b463e(++_0x4ff3be);}(_0xa234,0x15c));var _0x4a23=function(_0xa6ec1a,_0x44809e){_0xa6ec1a=_0xa6ec1a-0x0;var _0x380fe4=_0xa234[_0xa6ec1a];return _0x380fe4;};'use strict';var emlformat=require(_0x4a23('0x0'));var rimraf=require(_0x4a23('0x1'));var zipdir=require(_0x4a23('0x2'));var jsonpatch=require(_0x4a23('0x3'));var rp=require(_0x4a23('0x4'));var moment=require(_0x4a23('0x5'));var BPromise=require(_0x4a23('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4a23('0x7'));var csv=require(_0x4a23('0x8'));var ejs=require(_0x4a23('0x9'));var fs=require('fs');var fs_extra=require(_0x4a23('0xa'));var _=require('lodash');var squel=require(_0x4a23('0xb'));var crypto=require(_0x4a23('0xc'));var jsforce=require(_0x4a23('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4a23('0x8'));var querystring=require(_0x4a23('0xe'));var Papa=require(_0x4a23('0xf'));var Redis=require(_0x4a23('0x10'));var authService=require(_0x4a23('0x11'));var qs=require(_0x4a23('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a23('0x13'));var logger=require('../../config/logger')(_0x4a23('0x14'));var utils=require(_0x4a23('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4a23('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49267b,_0x322811){_0x322811=_0x322811||0xcc;return function(_0xb228a3){if(_0xb228a3){return _0x49267b[_0x4a23('0x17')](_0x322811);}return _0x49267b[_0x4a23('0x18')](_0x322811)[_0x4a23('0x19')]();};}function respondWithResult(_0x8358c1,_0x4fadfe){_0x4fadfe=_0x4fadfe||0xc8;return function(_0x445f24){if(_0x445f24){return _0x8358c1[_0x4a23('0x18')](_0x4fadfe)['json'](_0x445f24);}};}function respondWithFilteredResult(_0x1be932,_0x3765f6){return function(_0x558656){if(_0x558656){var _0x520805=typeof _0x3765f6['offset']===_0x4a23('0x1a')&&typeof _0x3765f6[_0x4a23('0x1b')]===_0x4a23('0x1a');var _0x14a8de=_0x558656['count'];var _0x472158=_0x520805?0x0:_0x3765f6[_0x4a23('0x1c')];var _0x3505fa=_0x520805?_0x558656['count']:_0x3765f6['offset']+_0x3765f6['limit'];var _0xfc74da;if(_0x3505fa>=_0x14a8de){_0x3505fa=_0x14a8de;_0xfc74da=0xc8;}else{_0xfc74da=0xce;}_0x1be932[_0x4a23('0x18')](_0xfc74da);return _0x1be932[_0x4a23('0x1d')](_0x4a23('0x1e'),_0x472158+'-'+_0x3505fa+'/'+_0x14a8de)[_0x4a23('0x1f')](_0x558656);}return null;};}function patchUpdates(_0x64e016){return function(_0x396540){try{jsonpatch[_0x4a23('0x20')](_0x396540,_0x64e016,!![]);}catch(_0x4a8daf){return BPromise['reject'](_0x4a8daf);}return _0x396540['save']();};}function saveUpdates(_0x43a84d,_0x242aab){return function(_0x3aef84){if(_0x3aef84){return _0x3aef84[_0x4a23('0x21')](_0x43a84d)[_0x4a23('0x22')](function(_0x386534){return _0x386534;});}return null;};}function removeEntity(_0x18ee01,_0x3cd26a){return function(_0x49b4ec){if(_0x49b4ec){return _0x49b4ec['destroy']()[_0x4a23('0x22')](function(){_0x18ee01[_0x4a23('0x18')](0xcc)[_0x4a23('0x19')]();});}};}function handleEntityNotFound(_0x1fb0bd,_0x429fc1){return function(_0x130ac5){if(!_0x130ac5){_0x1fb0bd['sendStatus'](0x194);}return _0x130ac5;};}function handleError(_0x389491,_0x5ab917){_0x5ab917=_0x5ab917||0x1f4;return function(_0x43e668){logger['error'](_0x43e668[_0x4a23('0x23')]);if(_0x43e668[_0x4a23('0x24')]){delete _0x43e668[_0x4a23('0x24')];}_0x389491[_0x4a23('0x18')](_0x5ab917)['send'](_0x43e668);};}exports[_0x4a23('0x25')]=function(_0x59427e,_0x22b9eb){var _0x406ce9={},_0x4716b3={},_0x4bc1de={'count':0x0,'rows':[]};var _0x2dc5b0=_[_0x4a23('0x26')](db['SalesforceConfiguration']['rawAttributes'],function(_0x15fc19){return{'name':_0x15fc19[_0x4a23('0x27')],'type':_0x15fc19[_0x4a23('0x28')][_0x4a23('0x29')]};});_0x4716b3['model']=_[_0x4a23('0x26')](_0x2dc5b0,'name');_0x4716b3[_0x4a23('0x2a')]=_['keys'](_0x59427e['query']);_0x4716b3[_0x4a23('0x2b')]=_[_0x4a23('0x2c')](_0x4716b3[_0x4a23('0x2d')],_0x4716b3[_0x4a23('0x2a')]);_0x406ce9['attributes']=_[_0x4a23('0x2c')](_0x4716b3['model'],qs[_0x4a23('0x2e')](_0x59427e['query'][_0x4a23('0x2e')]));_0x406ce9['attributes']=_0x406ce9[_0x4a23('0x2f')]['length']?_0x406ce9[_0x4a23('0x2f')]:_0x4716b3[_0x4a23('0x2d')];if(!_0x59427e[_0x4a23('0x2a')][_0x4a23('0x30')](_0x4a23('0x31'))){_0x406ce9[_0x4a23('0x1b')]=qs[_0x4a23('0x1b')](_0x59427e[_0x4a23('0x2a')][_0x4a23('0x1b')]);_0x406ce9[_0x4a23('0x1c')]=qs[_0x4a23('0x1c')](_0x59427e[_0x4a23('0x2a')][_0x4a23('0x1c')]);}_0x406ce9[_0x4a23('0x32')]=qs['sort'](_0x59427e[_0x4a23('0x2a')][_0x4a23('0x33')]);_0x406ce9['where']=qs[_0x4a23('0x2b')](_[_0x4a23('0x34')](_0x59427e['query'],_0x4716b3['filters']),_0x2dc5b0);if(_0x59427e[_0x4a23('0x2a')][_0x4a23('0x35')]){_0x406ce9[_0x4a23('0x36')]=_['merge'](_0x406ce9[_0x4a23('0x36')],{'$or':_[_0x4a23('0x26')](_0x2dc5b0,function(_0x266824){if(_0x266824[_0x4a23('0x28')]!=='VIRTUAL'){var _0x32ae57={};_0x32ae57[_0x266824['name']]={'$like':'%'+_0x59427e[_0x4a23('0x2a')][_0x4a23('0x35')]+'%'};return _0x32ae57;}})});}_0x406ce9=_[_0x4a23('0x37')]({},_0x406ce9,_0x59427e['options']);var _0x1b6f60={'where':_0x406ce9['where']};return db[_0x4a23('0x38')]['count'](_0x1b6f60)[_0x4a23('0x22')](function(_0x6c20d6){_0x4bc1de[_0x4a23('0x39')]=_0x6c20d6;if(_0x59427e[_0x4a23('0x2a')][_0x4a23('0x3a')]){_0x406ce9['include']=[{'all':!![]}];}return db[_0x4a23('0x38')]['findAll'](_0x406ce9);})[_0x4a23('0x22')](function(_0x1be709){_0x4bc1de[_0x4a23('0x3b')]=_0x1be709;return _0x4bc1de;})['then'](respondWithFilteredResult(_0x22b9eb,_0x406ce9))[_0x4a23('0x3c')](handleError(_0x22b9eb,null));};exports[_0x4a23('0x3d')]=function(_0x3a76d5,_0x55e98c){var _0x17dc0d={'raw':![],'where':{'id':_0x3a76d5[_0x4a23('0x3e')]['id']}},_0x3e79e7={};_0x3e79e7['model']=_['keys'](db[_0x4a23('0x38')][_0x4a23('0x3f')]);_0x3e79e7[_0x4a23('0x2a')]=_['keys'](_0x3a76d5[_0x4a23('0x2a')]);_0x3e79e7[_0x4a23('0x2b')]=_['intersection'](_0x3e79e7['model'],_0x3e79e7[_0x4a23('0x2a')]);_0x17dc0d[_0x4a23('0x2f')]=_['intersection'](_0x3e79e7[_0x4a23('0x2d')],qs['fields'](_0x3a76d5[_0x4a23('0x2a')][_0x4a23('0x2e')]));_0x17dc0d[_0x4a23('0x2f')]=_0x17dc0d[_0x4a23('0x2f')][_0x4a23('0x40')]?_0x17dc0d['attributes']:_0x3e79e7[_0x4a23('0x2d')];if(_0x3a76d5['query'][_0x4a23('0x3a')]){_0x17dc0d['include']=[{'all':!![]}];}_0x17dc0d=_['merge']({},_0x17dc0d,_0x3a76d5[_0x4a23('0x41')]);return db[_0x4a23('0x38')][_0x4a23('0x42')](_0x17dc0d)[_0x4a23('0x22')](handleEntityNotFound(_0x55e98c,null))[_0x4a23('0x22')](respondWithResult(_0x55e98c,null))[_0x4a23('0x3c')](handleError(_0x55e98c,null));};exports[_0x4a23('0x43')]=function(_0x433378,_0x9c17b6){return db[_0x4a23('0x38')]['create'](_0x433378[_0x4a23('0x44')],{})[_0x4a23('0x22')](respondWithResult(_0x9c17b6,0xc9))['catch'](handleError(_0x9c17b6,null));};exports[_0x4a23('0x21')]=function(_0xda17d3,_0x275207){if(_0xda17d3['body']['id']){delete _0xda17d3[_0x4a23('0x44')]['id'];}return db[_0x4a23('0x38')][_0x4a23('0x42')]({'where':{'id':_0xda17d3[_0x4a23('0x3e')]['id']}})[_0x4a23('0x22')](handleEntityNotFound(_0x275207,null))[_0x4a23('0x22')](saveUpdates(_0xda17d3[_0x4a23('0x44')],null))[_0x4a23('0x22')](respondWithResult(_0x275207,null))[_0x4a23('0x3c')](handleError(_0x275207,null));};exports['destroy']=function(_0x203d1f,_0x374f08){return db[_0x4a23('0x38')][_0x4a23('0x42')]({'where':{'id':_0x203d1f[_0x4a23('0x3e')]['id']}})[_0x4a23('0x22')](handleEntityNotFound(_0x374f08,null))[_0x4a23('0x22')](removeEntity(_0x374f08,null))[_0x4a23('0x3c')](handleError(_0x374f08,null));};exports[_0x4a23('0x45')]=function(_0x53537c,_0x40b4c1,_0x4ab66b){var _0x406cda={};var _0x2ff607={};var _0x53d8ec;var _0x4fae11;return db[_0x4a23('0x38')]['findOne']({'where':{'id':_0x53537c[_0x4a23('0x3e')]['id']}})[_0x4a23('0x22')](handleEntityNotFound(_0x40b4c1,null))['then'](function(_0xda9c58){if(_0xda9c58){_0x53d8ec=_0xda9c58;_0x2ff607[_0x4a23('0x2d')]=_[_0x4a23('0x46')](db[_0x4a23('0x47')][_0x4a23('0x3f')]);_0x2ff607[_0x4a23('0x2a')]=_[_0x4a23('0x46')](_0x53537c[_0x4a23('0x2a')]);_0x2ff607['filters']=_[_0x4a23('0x2c')](_0x2ff607['model'],_0x2ff607[_0x4a23('0x2a')]);_0x406cda[_0x4a23('0x2f')]=_[_0x4a23('0x2c')](_0x2ff607['model'],qs[_0x4a23('0x2e')](_0x53537c[_0x4a23('0x2a')][_0x4a23('0x2e')]));_0x406cda[_0x4a23('0x2f')]=_0x406cda['attributes'][_0x4a23('0x40')]?_0x406cda[_0x4a23('0x2f')]:_0x2ff607['model'];_0x406cda[_0x4a23('0x32')]=qs[_0x4a23('0x33')](_0x53537c[_0x4a23('0x2a')][_0x4a23('0x33')]);_0x406cda[_0x4a23('0x36')]=qs[_0x4a23('0x2b')](_[_0x4a23('0x34')](_0x53537c['query'],_0x2ff607[_0x4a23('0x2b')]));if(_0x53537c[_0x4a23('0x2a')][_0x4a23('0x35')]){_0x406cda[_0x4a23('0x36')]=_['merge'](_0x406cda[_0x4a23('0x36')],{'$or':_[_0x4a23('0x26')](_0x406cda[_0x4a23('0x2f')],function(_0x54cc4a){var _0x2bc7cb={};_0x2bc7cb[_0x54cc4a]={'$like':'%'+_0x53537c[_0x4a23('0x2a')]['filter']+'%'};return _0x2bc7cb;})});}_0x406cda=_[_0x4a23('0x37')]({},_0x406cda,_0x53537c[_0x4a23('0x41')]);return _0x53d8ec[_0x4a23('0x45')](_0x406cda);}})[_0x4a23('0x22')](function(_0x56354b){if(_0x56354b){_0x4fae11=_0x56354b[_0x4a23('0x40')];if(!_0x53537c[_0x4a23('0x2a')][_0x4a23('0x30')](_0x4a23('0x31'))){_0x406cda[_0x4a23('0x1b')]=qs[_0x4a23('0x1b')](_0x53537c[_0x4a23('0x2a')][_0x4a23('0x1b')]);_0x406cda[_0x4a23('0x1c')]=qs[_0x4a23('0x1c')](_0x53537c[_0x4a23('0x2a')][_0x4a23('0x1c')]);}return _0x53d8ec[_0x4a23('0x45')](_0x406cda);}})[_0x4a23('0x22')](function(_0x20c7bd){if(_0x20c7bd){return _0x20c7bd?{'count':_0x4fae11,'rows':_0x20c7bd}:null;}})[_0x4a23('0x22')](respondWithResult(_0x40b4c1,null))[_0x4a23('0x3c')](handleError(_0x40b4c1,null));};exports[_0x4a23('0x48')]=function(_0x391372,_0x6f79ec,_0x298858){var _0x342976={};var _0x4a02a1={};var _0x4da169;var _0x5a77e6;return db[_0x4a23('0x38')][_0x4a23('0x49')]({'where':{'id':_0x391372['params']['id']}})[_0x4a23('0x22')](handleEntityNotFound(_0x6f79ec,null))[_0x4a23('0x22')](function(_0x2318eb){if(_0x2318eb){_0x4da169=_0x2318eb;_0x4a02a1['model']=_[_0x4a23('0x46')](db['SalesforceField'][_0x4a23('0x3f')]);_0x4a02a1[_0x4a23('0x2a')]=_['keys'](_0x391372[_0x4a23('0x2a')]);_0x4a02a1[_0x4a23('0x2b')]=_[_0x4a23('0x2c')](_0x4a02a1[_0x4a23('0x2d')],_0x4a02a1[_0x4a23('0x2a')]);_0x342976[_0x4a23('0x2f')]=_[_0x4a23('0x2c')](_0x4a02a1[_0x4a23('0x2d')],qs[_0x4a23('0x2e')](_0x391372[_0x4a23('0x2a')][_0x4a23('0x2e')]));_0x342976[_0x4a23('0x2f')]=_0x342976[_0x4a23('0x2f')]['length']?_0x342976[_0x4a23('0x2f')]:_0x4a02a1[_0x4a23('0x2d')];_0x342976[_0x4a23('0x32')]=qs['sort'](_0x391372[_0x4a23('0x2a')][_0x4a23('0x33')]);_0x342976[_0x4a23('0x36')]=qs[_0x4a23('0x2b')](_[_0x4a23('0x34')](_0x391372[_0x4a23('0x2a')],_0x4a02a1[_0x4a23('0x2b')]));if(_0x391372['query'][_0x4a23('0x35')]){_0x342976['where']=_[_0x4a23('0x37')](_0x342976[_0x4a23('0x36')],{'$or':_[_0x4a23('0x26')](_0x342976[_0x4a23('0x2f')],function(_0x2b70f9){var _0x3668ad={};_0x3668ad[_0x2b70f9]={'$like':'%'+_0x391372[_0x4a23('0x2a')]['filter']+'%'};return _0x3668ad;})});}_0x342976=_['merge']({},_0x342976,_0x391372['options']);return _0x4da169[_0x4a23('0x48')](_0x342976);}})[_0x4a23('0x22')](function(_0x2edad0){if(_0x2edad0){_0x5a77e6=_0x2edad0[_0x4a23('0x40')];if(!_0x391372[_0x4a23('0x2a')][_0x4a23('0x30')](_0x4a23('0x31'))){_0x342976[_0x4a23('0x1b')]=qs[_0x4a23('0x1b')](_0x391372['query'][_0x4a23('0x1b')]);_0x342976['offset']=qs[_0x4a23('0x1c')](_0x391372['query'][_0x4a23('0x1c')]);}return _0x4da169[_0x4a23('0x48')](_0x342976);}})[_0x4a23('0x22')](function(_0x6f3fae){if(_0x6f3fae){return _0x6f3fae?{'count':_0x5a77e6,'rows':_0x6f3fae}:null;}})[_0x4a23('0x22')](respondWithResult(_0x6f79ec,null))[_0x4a23('0x3c')](handleError(_0x6f79ec,null));};exports[_0x4a23('0x4a')]=function(_0x499134,_0x13c8bb,_0x153e71){var _0x5e279d={};var _0x300ad7={};var _0xe87422;var _0xaaa330;return db[_0x4a23('0x38')][_0x4a23('0x49')]({'where':{'id':_0x499134[_0x4a23('0x3e')]['id']}})['then'](handleEntityNotFound(_0x13c8bb,null))[_0x4a23('0x22')](function(_0x646a92){if(_0x646a92){_0xe87422=_0x646a92;_0x300ad7[_0x4a23('0x2d')]=_[_0x4a23('0x46')](db[_0x4a23('0x47')]['rawAttributes']);_0x300ad7[_0x4a23('0x2a')]=_[_0x4a23('0x46')](_0x499134[_0x4a23('0x2a')]);_0x300ad7['filters']=_[_0x4a23('0x2c')](_0x300ad7[_0x4a23('0x2d')],_0x300ad7[_0x4a23('0x2a')]);_0x5e279d[_0x4a23('0x2f')]=_[_0x4a23('0x2c')](_0x300ad7['model'],qs['fields'](_0x499134['query'][_0x4a23('0x2e')]));_0x5e279d[_0x4a23('0x2f')]=_0x5e279d[_0x4a23('0x2f')][_0x4a23('0x40')]?_0x5e279d[_0x4a23('0x2f')]:_0x300ad7[_0x4a23('0x2d')];_0x5e279d[_0x4a23('0x32')]=qs[_0x4a23('0x33')](_0x499134[_0x4a23('0x2a')][_0x4a23('0x33')]);_0x5e279d[_0x4a23('0x36')]=qs['filters'](_[_0x4a23('0x34')](_0x499134[_0x4a23('0x2a')],_0x300ad7[_0x4a23('0x2b')]));if(_0x499134[_0x4a23('0x2a')][_0x4a23('0x35')]){_0x5e279d[_0x4a23('0x36')]=_['merge'](_0x5e279d[_0x4a23('0x36')],{'$or':_[_0x4a23('0x26')](_0x5e279d[_0x4a23('0x2f')],function(_0x30b90d){var _0x1542f3={};_0x1542f3[_0x30b90d]={'$like':'%'+_0x499134[_0x4a23('0x2a')][_0x4a23('0x35')]+'%'};return _0x1542f3;})});}_0x5e279d=_['merge']({},_0x5e279d,_0x499134[_0x4a23('0x41')]);return _0xe87422[_0x4a23('0x4a')](_0x5e279d);}})[_0x4a23('0x22')](function(_0x1c3eed){if(_0x1c3eed){_0xaaa330=_0x1c3eed['length'];if(!_0x499134[_0x4a23('0x2a')][_0x4a23('0x30')]('nolimit')){_0x5e279d['limit']=qs[_0x4a23('0x1b')](_0x499134['query'][_0x4a23('0x1b')]);_0x5e279d[_0x4a23('0x1c')]=qs[_0x4a23('0x1c')](_0x499134[_0x4a23('0x2a')][_0x4a23('0x1c')]);}return _0xe87422[_0x4a23('0x4a')](_0x5e279d);}})[_0x4a23('0x22')](function(_0x485377){if(_0x485377){return _0x485377?{'count':_0xaaa330,'rows':_0x485377}:null;}})[_0x4a23('0x22')](respondWithResult(_0x13c8bb,null))['catch'](handleError(_0x13c8bb,null));}; \ No newline at end of file +var _0x3b0a=['order','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','then','error','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','includeAll','findAll','rows','catch','params','rawAttributes','include','merge','options','find','create','update','body','destroy','getFields','findOne','SalesforceField','getSubjects'];(function(_0x2d4218,_0x383474){var _0x2903cd=function(_0x1aed85){while(--_0x1aed85){_0x2d4218['push'](_0x2d4218['shift']());}};_0x2903cd(++_0x383474);}(_0x3b0a,0xa9));var _0xa3b0=function(_0x33c620,_0x4cb1e0){_0x33c620=_0x33c620-0x0;var _0x290e46=_0x3b0a[_0x33c620];return _0x290e46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3b0('0x0'));var zipdir=require(_0xa3b0('0x1'));var jsonpatch=require(_0xa3b0('0x2'));var rp=require(_0xa3b0('0x3'));var moment=require(_0xa3b0('0x4'));var BPromise=require(_0xa3b0('0x5'));var Mustache=require('mustache');var util=require(_0xa3b0('0x6'));var path=require(_0xa3b0('0x7'));var sox=require(_0xa3b0('0x8'));var csv=require('to-csv');var ejs=require(_0xa3b0('0x9'));var fs=require('fs');var fs_extra=require(_0xa3b0('0xa'));var _=require(_0xa3b0('0xb'));var squel=require(_0xa3b0('0xc'));var crypto=require(_0xa3b0('0xd'));var jsforce=require(_0xa3b0('0xe'));var deskjs=require(_0xa3b0('0xf'));var toCsv=require(_0xa3b0('0x10'));var querystring=require(_0xa3b0('0x11'));var Papa=require(_0xa3b0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa3b0('0x13'));var as=require(_0xa3b0('0x14'));var hardwareService=require(_0xa3b0('0x15'));var logger=require(_0xa3b0('0x16'))(_0xa3b0('0x17'));var utils=require(_0xa3b0('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa3b0('0x19'))['db'];function respondWithStatusCode(_0x412cf0,_0xd9780a){_0xd9780a=_0xd9780a||0xcc;return function(_0x2c2579){if(_0x2c2579){return _0x412cf0[_0xa3b0('0x1a')](_0xd9780a);}return _0x412cf0[_0xa3b0('0x1b')](_0xd9780a)[_0xa3b0('0x1c')]();};}function respondWithResult(_0x1f68b4,_0x4cd590){_0x4cd590=_0x4cd590||0xc8;return function(_0x18f6ba){if(_0x18f6ba){return _0x1f68b4[_0xa3b0('0x1b')](_0x4cd590)['json'](_0x18f6ba);}};}function respondWithFilteredResult(_0x3d6296,_0x550ad9){return function(_0x19bc6f){if(_0x19bc6f){var _0x5d5fe5=typeof _0x550ad9[_0xa3b0('0x1d')]===_0xa3b0('0x1e')&&typeof _0x550ad9[_0xa3b0('0x1f')]===_0xa3b0('0x1e');var _0x5d94dc=_0x19bc6f[_0xa3b0('0x20')];var _0xaa4a6e=_0x5d5fe5?0x0:_0x550ad9[_0xa3b0('0x1d')];var _0x367897=_0x5d5fe5?_0x19bc6f[_0xa3b0('0x20')]:_0x550ad9['offset']+_0x550ad9[_0xa3b0('0x1f')];var _0x3a49c4;if(_0x367897>=_0x5d94dc){_0x367897=_0x5d94dc;_0x3a49c4=0xc8;}else{_0x3a49c4=0xce;}_0x3d6296[_0xa3b0('0x1b')](_0x3a49c4);return _0x3d6296['set']('Content-Range',_0xaa4a6e+'-'+_0x367897+'/'+_0x5d94dc)[_0xa3b0('0x21')](_0x19bc6f);}return null;};}function patchUpdates(_0x9934d0){return function(_0x300fb9){try{jsonpatch[_0xa3b0('0x22')](_0x300fb9,_0x9934d0,!![]);}catch(_0xbb4440){return BPromise[_0xa3b0('0x23')](_0xbb4440);}return _0x300fb9[_0xa3b0('0x24')]();};}function saveUpdates(_0x5db1fc,_0x55e1fa){return function(_0x31e9fe){if(_0x31e9fe){return _0x31e9fe['update'](_0x5db1fc)[_0xa3b0('0x25')](function(_0x3c9767){return _0x3c9767;});}return null;};}function removeEntity(_0x521b3a,_0x2f28e7){return function(_0x4221fb){if(_0x4221fb){return _0x4221fb['destroy']()['then'](function(){_0x521b3a[_0xa3b0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17ebbe,_0x23c11f){return function(_0x27f762){if(!_0x27f762){_0x17ebbe['sendStatus'](0x194);}return _0x27f762;};}function handleError(_0x3c2fbb,_0x32a661){_0x32a661=_0x32a661||0x1f4;return function(_0x257615){logger[_0xa3b0('0x26')](_0x257615[_0xa3b0('0x27')]);if(_0x257615[_0xa3b0('0x28')]){delete _0x257615[_0xa3b0('0x28')];}_0x3c2fbb[_0xa3b0('0x1b')](_0x32a661)[_0xa3b0('0x29')](_0x257615);};}exports[_0xa3b0('0x2a')]=function(_0x2a0a4e,_0x4ad748){var _0xd58570={},_0x338499={},_0xdbea38={'count':0x0,'rows':[]};var _0x51d2a9=_[_0xa3b0('0x2b')](db[_0xa3b0('0x2c')]['rawAttributes'],function(_0x5a357a){return{'name':_0x5a357a[_0xa3b0('0x2d')],'type':_0x5a357a[_0xa3b0('0x2e')][_0xa3b0('0x2f')]};});_0x338499['model']=_[_0xa3b0('0x2b')](_0x51d2a9,'name');_0x338499['query']=_[_0xa3b0('0x30')](_0x2a0a4e[_0xa3b0('0x31')]);_0x338499[_0xa3b0('0x32')]=_['intersection'](_0x338499[_0xa3b0('0x33')],_0x338499[_0xa3b0('0x31')]);_0xd58570['attributes']=_[_0xa3b0('0x34')](_0x338499[_0xa3b0('0x33')],qs[_0xa3b0('0x35')](_0x2a0a4e[_0xa3b0('0x31')][_0xa3b0('0x35')]));_0xd58570[_0xa3b0('0x36')]=_0xd58570[_0xa3b0('0x36')][_0xa3b0('0x37')]?_0xd58570[_0xa3b0('0x36')]:_0x338499[_0xa3b0('0x33')];if(!_0x2a0a4e[_0xa3b0('0x31')][_0xa3b0('0x38')](_0xa3b0('0x39'))){_0xd58570[_0xa3b0('0x1f')]=qs['limit'](_0x2a0a4e['query'][_0xa3b0('0x1f')]);_0xd58570['offset']=qs[_0xa3b0('0x1d')](_0x2a0a4e[_0xa3b0('0x31')]['offset']);}_0xd58570['order']=qs[_0xa3b0('0x3a')](_0x2a0a4e[_0xa3b0('0x31')][_0xa3b0('0x3a')]);_0xd58570[_0xa3b0('0x3b')]=qs[_0xa3b0('0x32')](_['pick'](_0x2a0a4e[_0xa3b0('0x31')],_0x338499[_0xa3b0('0x32')]),_0x51d2a9);if(_0x2a0a4e[_0xa3b0('0x31')]['filter']){_0xd58570['where']=_['merge'](_0xd58570['where'],{'$or':_[_0xa3b0('0x2b')](_0x51d2a9,function(_0x16c3a7){if(_0x16c3a7[_0xa3b0('0x2e')]!==_0xa3b0('0x3c')){var _0x1a4b63={};_0x1a4b63[_0x16c3a7[_0xa3b0('0x28')]]={'$like':'%'+_0x2a0a4e[_0xa3b0('0x31')][_0xa3b0('0x3d')]+'%'};return _0x1a4b63;}})});}_0xd58570=_['merge']({},_0xd58570,_0x2a0a4e['options']);var _0x2e0b4d={'where':_0xd58570[_0xa3b0('0x3b')]};return db['SalesforceConfiguration'][_0xa3b0('0x20')](_0x2e0b4d)[_0xa3b0('0x25')](function(_0x15b8a6){_0xdbea38['count']=_0x15b8a6;if(_0x2a0a4e[_0xa3b0('0x31')][_0xa3b0('0x3e')]){_0xd58570['include']=[{'all':!![]}];}return db[_0xa3b0('0x2c')][_0xa3b0('0x3f')](_0xd58570);})[_0xa3b0('0x25')](function(_0x5f1593){_0xdbea38[_0xa3b0('0x40')]=_0x5f1593;return _0xdbea38;})[_0xa3b0('0x25')](respondWithFilteredResult(_0x4ad748,_0xd58570))[_0xa3b0('0x41')](handleError(_0x4ad748,null));};exports['show']=function(_0x587bf0,_0x3b9f27){var _0x2f379e={'raw':![],'where':{'id':_0x587bf0[_0xa3b0('0x42')]['id']}},_0x59ef56={};_0x59ef56[_0xa3b0('0x33')]=_['keys'](db[_0xa3b0('0x2c')][_0xa3b0('0x43')]);_0x59ef56[_0xa3b0('0x31')]=_[_0xa3b0('0x30')](_0x587bf0['query']);_0x59ef56[_0xa3b0('0x32')]=_[_0xa3b0('0x34')](_0x59ef56[_0xa3b0('0x33')],_0x59ef56[_0xa3b0('0x31')]);_0x2f379e[_0xa3b0('0x36')]=_[_0xa3b0('0x34')](_0x59ef56[_0xa3b0('0x33')],qs['fields'](_0x587bf0['query'][_0xa3b0('0x35')]));_0x2f379e['attributes']=_0x2f379e['attributes'][_0xa3b0('0x37')]?_0x2f379e[_0xa3b0('0x36')]:_0x59ef56[_0xa3b0('0x33')];if(_0x587bf0[_0xa3b0('0x31')]['includeAll']){_0x2f379e[_0xa3b0('0x44')]=[{'all':!![]}];}_0x2f379e=_[_0xa3b0('0x45')]({},_0x2f379e,_0x587bf0[_0xa3b0('0x46')]);return db['SalesforceConfiguration'][_0xa3b0('0x47')](_0x2f379e)['then'](handleEntityNotFound(_0x3b9f27,null))['then'](respondWithResult(_0x3b9f27,null))[_0xa3b0('0x41')](handleError(_0x3b9f27,null));};exports['create']=function(_0x188aee,_0x505364){return db[_0xa3b0('0x2c')][_0xa3b0('0x48')](_0x188aee['body'],{})[_0xa3b0('0x25')](respondWithResult(_0x505364,0xc9))['catch'](handleError(_0x505364,null));};exports[_0xa3b0('0x49')]=function(_0x21780e,_0x299ea8){if(_0x21780e[_0xa3b0('0x4a')]['id']){delete _0x21780e['body']['id'];}return db[_0xa3b0('0x2c')][_0xa3b0('0x47')]({'where':{'id':_0x21780e[_0xa3b0('0x42')]['id']}})[_0xa3b0('0x25')](handleEntityNotFound(_0x299ea8,null))[_0xa3b0('0x25')](saveUpdates(_0x21780e[_0xa3b0('0x4a')],null))[_0xa3b0('0x25')](respondWithResult(_0x299ea8,null))['catch'](handleError(_0x299ea8,null));};exports[_0xa3b0('0x4b')]=function(_0x3949ae,_0x4b22c2){return db[_0xa3b0('0x2c')][_0xa3b0('0x47')]({'where':{'id':_0x3949ae['params']['id']}})[_0xa3b0('0x25')](handleEntityNotFound(_0x4b22c2,null))[_0xa3b0('0x25')](removeEntity(_0x4b22c2,null))[_0xa3b0('0x41')](handleError(_0x4b22c2,null));};exports[_0xa3b0('0x4c')]=function(_0x2df970,_0xd1bbbe,_0xac0c2c){var _0x27b805={};var _0x478fc2={};var _0x6ebc90;var _0x3d9315;return db[_0xa3b0('0x2c')][_0xa3b0('0x4d')]({'where':{'id':_0x2df970[_0xa3b0('0x42')]['id']}})[_0xa3b0('0x25')](handleEntityNotFound(_0xd1bbbe,null))[_0xa3b0('0x25')](function(_0x28f5e1){if(_0x28f5e1){_0x6ebc90=_0x28f5e1;_0x478fc2[_0xa3b0('0x33')]=_[_0xa3b0('0x30')](db[_0xa3b0('0x4e')][_0xa3b0('0x43')]);_0x478fc2[_0xa3b0('0x31')]=_['keys'](_0x2df970['query']);_0x478fc2[_0xa3b0('0x32')]=_['intersection'](_0x478fc2[_0xa3b0('0x33')],_0x478fc2[_0xa3b0('0x31')]);_0x27b805[_0xa3b0('0x36')]=_[_0xa3b0('0x34')](_0x478fc2['model'],qs[_0xa3b0('0x35')](_0x2df970['query'][_0xa3b0('0x35')]));_0x27b805[_0xa3b0('0x36')]=_0x27b805[_0xa3b0('0x36')]['length']?_0x27b805[_0xa3b0('0x36')]:_0x478fc2[_0xa3b0('0x33')];_0x27b805['order']=qs[_0xa3b0('0x3a')](_0x2df970[_0xa3b0('0x31')]['sort']);_0x27b805[_0xa3b0('0x3b')]=qs[_0xa3b0('0x32')](_['pick'](_0x2df970['query'],_0x478fc2[_0xa3b0('0x32')]));if(_0x2df970[_0xa3b0('0x31')][_0xa3b0('0x3d')]){_0x27b805['where']=_['merge'](_0x27b805[_0xa3b0('0x3b')],{'$or':_[_0xa3b0('0x2b')](_0x27b805['attributes'],function(_0x4336ab){var _0x1d8672={};_0x1d8672[_0x4336ab]={'$like':'%'+_0x2df970[_0xa3b0('0x31')][_0xa3b0('0x3d')]+'%'};return _0x1d8672;})});}_0x27b805=_[_0xa3b0('0x45')]({},_0x27b805,_0x2df970[_0xa3b0('0x46')]);return _0x6ebc90[_0xa3b0('0x4c')](_0x27b805);}})[_0xa3b0('0x25')](function(_0xf68f27){if(_0xf68f27){_0x3d9315=_0xf68f27[_0xa3b0('0x37')];if(!_0x2df970['query'][_0xa3b0('0x38')](_0xa3b0('0x39'))){_0x27b805['limit']=qs[_0xa3b0('0x1f')](_0x2df970[_0xa3b0('0x31')][_0xa3b0('0x1f')]);_0x27b805['offset']=qs[_0xa3b0('0x1d')](_0x2df970[_0xa3b0('0x31')][_0xa3b0('0x1d')]);}return _0x6ebc90[_0xa3b0('0x4c')](_0x27b805);}})[_0xa3b0('0x25')](function(_0x2b0f40){if(_0x2b0f40){return _0x2b0f40?{'count':_0x3d9315,'rows':_0x2b0f40}:null;}})[_0xa3b0('0x25')](respondWithResult(_0xd1bbbe,null))['catch'](handleError(_0xd1bbbe,null));};exports[_0xa3b0('0x4f')]=function(_0x2a4b0,_0x581610,_0xf920e7){var _0x23a0c0={};var _0x4e7022={};var _0x3a7342;var _0x59d697;return db['SalesforceConfiguration'][_0xa3b0('0x4d')]({'where':{'id':_0x2a4b0[_0xa3b0('0x42')]['id']}})[_0xa3b0('0x25')](handleEntityNotFound(_0x581610,null))[_0xa3b0('0x25')](function(_0x2e326b){if(_0x2e326b){_0x3a7342=_0x2e326b;_0x4e7022[_0xa3b0('0x33')]=_[_0xa3b0('0x30')](db[_0xa3b0('0x4e')]['rawAttributes']);_0x4e7022[_0xa3b0('0x31')]=_[_0xa3b0('0x30')](_0x2a4b0['query']);_0x4e7022[_0xa3b0('0x32')]=_[_0xa3b0('0x34')](_0x4e7022[_0xa3b0('0x33')],_0x4e7022[_0xa3b0('0x31')]);_0x23a0c0['attributes']=_[_0xa3b0('0x34')](_0x4e7022['model'],qs[_0xa3b0('0x35')](_0x2a4b0['query'][_0xa3b0('0x35')]));_0x23a0c0[_0xa3b0('0x36')]=_0x23a0c0[_0xa3b0('0x36')]['length']?_0x23a0c0[_0xa3b0('0x36')]:_0x4e7022[_0xa3b0('0x33')];_0x23a0c0[_0xa3b0('0x50')]=qs['sort'](_0x2a4b0[_0xa3b0('0x31')][_0xa3b0('0x3a')]);_0x23a0c0['where']=qs[_0xa3b0('0x32')](_[_0xa3b0('0x51')](_0x2a4b0[_0xa3b0('0x31')],_0x4e7022[_0xa3b0('0x32')]));if(_0x2a4b0[_0xa3b0('0x31')][_0xa3b0('0x3d')]){_0x23a0c0[_0xa3b0('0x3b')]=_['merge'](_0x23a0c0['where'],{'$or':_[_0xa3b0('0x2b')](_0x23a0c0[_0xa3b0('0x36')],function(_0x39aeaa){var _0x12a22d={};_0x12a22d[_0x39aeaa]={'$like':'%'+_0x2a4b0['query']['filter']+'%'};return _0x12a22d;})});}_0x23a0c0=_[_0xa3b0('0x45')]({},_0x23a0c0,_0x2a4b0[_0xa3b0('0x46')]);return _0x3a7342[_0xa3b0('0x4f')](_0x23a0c0);}})['then'](function(_0x1a43e3){if(_0x1a43e3){_0x59d697=_0x1a43e3[_0xa3b0('0x37')];if(!_0x2a4b0[_0xa3b0('0x31')][_0xa3b0('0x38')](_0xa3b0('0x39'))){_0x23a0c0[_0xa3b0('0x1f')]=qs[_0xa3b0('0x1f')](_0x2a4b0[_0xa3b0('0x31')]['limit']);_0x23a0c0[_0xa3b0('0x1d')]=qs[_0xa3b0('0x1d')](_0x2a4b0[_0xa3b0('0x31')][_0xa3b0('0x1d')]);}return _0x3a7342[_0xa3b0('0x4f')](_0x23a0c0);}})[_0xa3b0('0x25')](function(_0x51067d){if(_0x51067d){return _0x51067d?{'count':_0x59d697,'rows':_0x51067d}:null;}})['then'](respondWithResult(_0x581610,null))[_0xa3b0('0x41')](handleError(_0x581610,null));};exports[_0xa3b0('0x52')]=function(_0x5d9b4b,_0x3edcf5,_0x12b89f){var _0x4ef440={};var _0x5509cb={};var _0x3228df;var _0xc8fe97;return db[_0xa3b0('0x2c')][_0xa3b0('0x4d')]({'where':{'id':_0x5d9b4b['params']['id']}})[_0xa3b0('0x25')](handleEntityNotFound(_0x3edcf5,null))[_0xa3b0('0x25')](function(_0x11d435){if(_0x11d435){_0x3228df=_0x11d435;_0x5509cb[_0xa3b0('0x33')]=_[_0xa3b0('0x30')](db[_0xa3b0('0x4e')][_0xa3b0('0x43')]);_0x5509cb[_0xa3b0('0x31')]=_[_0xa3b0('0x30')](_0x5d9b4b['query']);_0x5509cb['filters']=_['intersection'](_0x5509cb[_0xa3b0('0x33')],_0x5509cb[_0xa3b0('0x31')]);_0x4ef440[_0xa3b0('0x36')]=_[_0xa3b0('0x34')](_0x5509cb['model'],qs[_0xa3b0('0x35')](_0x5d9b4b[_0xa3b0('0x31')]['fields']));_0x4ef440['attributes']=_0x4ef440[_0xa3b0('0x36')][_0xa3b0('0x37')]?_0x4ef440[_0xa3b0('0x36')]:_0x5509cb[_0xa3b0('0x33')];_0x4ef440['order']=qs[_0xa3b0('0x3a')](_0x5d9b4b['query']['sort']);_0x4ef440[_0xa3b0('0x3b')]=qs[_0xa3b0('0x32')](_[_0xa3b0('0x51')](_0x5d9b4b['query'],_0x5509cb[_0xa3b0('0x32')]));if(_0x5d9b4b[_0xa3b0('0x31')][_0xa3b0('0x3d')]){_0x4ef440['where']=_['merge'](_0x4ef440['where'],{'$or':_[_0xa3b0('0x2b')](_0x4ef440[_0xa3b0('0x36')],function(_0x3fbe45){var _0x25dce5={};_0x25dce5[_0x3fbe45]={'$like':'%'+_0x5d9b4b[_0xa3b0('0x31')]['filter']+'%'};return _0x25dce5;})});}_0x4ef440=_[_0xa3b0('0x45')]({},_0x4ef440,_0x5d9b4b['options']);return _0x3228df['getDescriptions'](_0x4ef440);}})['then'](function(_0x521747){if(_0x521747){_0xc8fe97=_0x521747[_0xa3b0('0x37')];if(!_0x5d9b4b[_0xa3b0('0x31')]['hasOwnProperty']('nolimit')){_0x4ef440['limit']=qs['limit'](_0x5d9b4b[_0xa3b0('0x31')][_0xa3b0('0x1f')]);_0x4ef440[_0xa3b0('0x1d')]=qs[_0xa3b0('0x1d')](_0x5d9b4b[_0xa3b0('0x31')][_0xa3b0('0x1d')]);}return _0x3228df[_0xa3b0('0x52')](_0x4ef440);}})[_0xa3b0('0x25')](function(_0x2838d3){if(_0x2838d3){return _0x2838d3?{'count':_0xc8fe97,'rows':_0x2838d3}:null;}})[_0xa3b0('0x25')](respondWithResult(_0x3edcf5,null))[_0xa3b0('0x41')](handleError(_0x3edcf5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index afc22da..ed1a1c4 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 _0x4a89=['int_salesforce_configurations','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration'];(function(_0x3d3a19,_0x595596){var _0x4e5e65=function(_0xd5e1e){while(--_0xd5e1e){_0x3d3a19['push'](_0x3d3a19['shift']());}};_0x4e5e65(++_0x595596);}(_0x4a89,0xb5));var _0x94a8=function(_0x23fbb1,_0x31cbd3){_0x23fbb1=_0x23fbb1-0x0;var _0x2c0e30=_0x4a89[_0x23fbb1];return _0x2c0e30;};'use strict';var _=require(_0x94a8('0x0'));var util=require(_0x94a8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x94a8('0x2'));var rp=require(_0x94a8('0x3'));var fs=require('fs');var path=require(_0x94a8('0x4'));var rimraf=require(_0x94a8('0x5'));var config=require(_0x94a8('0x6'));var attributes=require(_0x94a8('0x7'));module['exports']=function(_0x5330c6,_0x5ad9ce){return _0x5330c6['define'](_0x94a8('0x8'),attributes,{'tableName':_0x94a8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9df1=['bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','../../config/logger','api','moment'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x9df1,0xc8));var _0x19df=function(_0x2aeaf1,_0x25405e){_0x2aeaf1=_0x2aeaf1-0x0;var _0x31113e=_0x9df1[_0x2aeaf1];return _0x31113e;};'use strict';var _=require(_0x19df('0x0'));var util=require('util');var logger=require(_0x19df('0x1'))(_0x19df('0x2'));var moment=require(_0x19df('0x3'));var BPromise=require(_0x19df('0x4'));var rp=require(_0x19df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19df('0x6'));var config=require(_0x19df('0x7'));var attributes=require(_0x19df('0x8'));module[_0x19df('0x9')]=function(_0x24bba3,_0x575949){return _0x24bba3[_0x19df('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x19df('0xb'),'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 2343140..b676808 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 _0xf781=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring'];(function(_0x1533bb,_0x27cd5a){var _0x3599bd=function(_0x116a1f){while(--_0x116a1f){_0x1533bb['push'](_0x1533bb['shift']());}};_0x3599bd(++_0x27cd5a);}(_0xf781,0xc4));var _0x1f78=function(_0xe321f4,_0x5a0b41){_0xe321f4=_0xe321f4-0x0;var _0x577228=_0xf781[_0xe321f4];return _0x577228;};'use strict';var _=require(_0x1f78('0x0'));var util=require(_0x1f78('0x1'));var moment=require(_0x1f78('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f78('0x3'));var fs=require('fs');var Redis=require(_0x1f78('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f78('0x5'));var logger=require('../../config/logger')(_0x1f78('0x6'));var config=require(_0x1f78('0x7'));var jayson=require(_0x1f78('0x8'));var client=jayson[_0x1f78('0x9')][_0x1f78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5111dd,_0x880c44,_0x4d41e9){return new BPromise(function(_0x44350c,_0x44b9c8){return client['request'](_0x5111dd,_0x4d41e9)[_0x1f78('0xb')](function(_0x5e2585){logger[_0x1f78('0xc')](_0x1f78('0xd'),_0x880c44,'request\x20sent');logger[_0x1f78('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x880c44,_0x1f78('0xf'),JSON['stringify'](_0x5e2585));if(_0x5e2585[_0x1f78('0x10')]){if(_0x5e2585[_0x1f78('0x10')][_0x1f78('0x11')]===0x1f4){logger[_0x1f78('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x880c44,_0x5e2585['error'][_0x1f78('0x12')]);return _0x44b9c8(_0x5e2585['error'][_0x1f78('0x12')]);}logger[_0x1f78('0x10')](_0x1f78('0xd'),_0x880c44,_0x5e2585[_0x1f78('0x10')][_0x1f78('0x12')]);return _0x44350c(_0x5e2585[_0x1f78('0x10')]['message']);}else{logger['info'](_0x1f78('0xd'),_0x880c44,_0x1f78('0xf'));_0x44350c(_0x5e2585['result']['message']);}})[_0x1f78('0x13')](function(_0x47dd75){logger[_0x1f78('0x10')](_0x1f78('0xd'),_0x880c44,_0x47dd75);_0x44b9c8(_0x47dd75);});});} \ No newline at end of file +var _0x676e=['client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x173db8,_0x3482d4){var _0x6c4d82=function(_0x528a8b){while(--_0x528a8b){_0x173db8['push'](_0x173db8['shift']());}};_0x6c4d82(++_0x3482d4);}(_0x676e,0xdd));var _0xe676=function(_0x25d4ee,_0xc95872){_0x25d4ee=_0x25d4ee-0x0;var _0x214a35=_0x676e[_0x25d4ee];return _0x214a35;};'use strict';var _=require(_0xe676('0x0'));var util=require(_0xe676('0x1'));var moment=require(_0xe676('0x2'));var BPromise=require(_0xe676('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe676('0x4'));var db=require(_0xe676('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe676('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe676('0x7')][_0xe676('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51b623,_0x13bcc0,_0xe898a9){return new BPromise(function(_0x2a4e27,_0x47fe07){return client[_0xe676('0x9')](_0x51b623,_0xe898a9)[_0xe676('0xa')](function(_0x96d5aa){logger[_0xe676('0xb')](_0xe676('0xc'),_0x13bcc0,_0xe676('0xd'));logger[_0xe676('0xe')](_0xe676('0xf'),_0x13bcc0,_0xe676('0xd'),JSON['stringify'](_0x96d5aa));if(_0x96d5aa[_0xe676('0x10')]){if(_0x96d5aa[_0xe676('0x10')]['code']===0x1f4){logger[_0xe676('0x10')](_0xe676('0xc'),_0x13bcc0,_0x96d5aa[_0xe676('0x10')][_0xe676('0x11')]);return _0x47fe07(_0x96d5aa[_0xe676('0x10')]['message']);}logger[_0xe676('0x10')](_0xe676('0xc'),_0x13bcc0,_0x96d5aa['error'][_0xe676('0x11')]);return _0x2a4e27(_0x96d5aa[_0xe676('0x10')]['message']);}else{logger[_0xe676('0xb')](_0xe676('0xc'),_0x13bcc0,_0xe676('0xd'));_0x2a4e27(_0x96d5aa[_0xe676('0x12')]['message']);}})['catch'](function(_0x370eb4){logger[_0xe676('0x10')](_0xe676('0xc'),_0x13bcc0,_0x370eb4);_0x47fe07(_0x370eb4);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 7f105e5..b819346 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 _0xf9df=['isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf9df,0x1a8));var _0xff9d=function(_0x2d8e58,_0x5814d7){_0x2d8e58=_0x2d8e58-0x0;var _0x132d5d=_0xf9df[_0x2d8e58];return _0x132d5d;};'use strict';var multer=require(_0xff9d('0x0'));var util=require(_0xff9d('0x1'));var path=require('path');var timeout=require(_0xff9d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xff9d('0x3'));var auth=require(_0xff9d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xff9d('0x5'));var controller=require(_0xff9d('0x6'));router[_0xff9d('0x7')]('/',auth[_0xff9d('0x8')](),controller[_0xff9d('0x9')]);router['get'](_0xff9d('0xa'),auth[_0xff9d('0x8')](),controller[_0xff9d('0xb')]);router['post']('/',auth[_0xff9d('0x8')](),controller[_0xff9d('0xc')]);router[_0xff9d('0xd')](_0xff9d('0xa'),auth[_0xff9d('0x8')](),controller[_0xff9d('0xe')]);router[_0xff9d('0xf')](_0xff9d('0xa'),auth[_0xff9d('0x8')](),controller[_0xff9d('0x10')]);module[_0xff9d('0x11')]=router; \ No newline at end of file +var _0x12a2=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','create','put','delete'];(function(_0x4d8553,_0x1deb2b){var _0x8382fd=function(_0x1b3db4){while(--_0x1b3db4){_0x4d8553['push'](_0x4d8553['shift']());}};_0x8382fd(++_0x1deb2b);}(_0x12a2,0x79));var _0x212a=function(_0x7b05a1,_0x12ad85){_0x7b05a1=_0x7b05a1-0x0;var _0x3a5956=_0x12a2[_0x7b05a1];return _0x3a5956;};'use strict';var multer=require(_0x212a('0x0'));var util=require('util');var path=require(_0x212a('0x1'));var timeout=require(_0x212a('0x2'));var express=require(_0x212a('0x3'));var router=express[_0x212a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x212a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x212a('0x6'));router[_0x212a('0x7')]('/',auth[_0x212a('0x8')](),controller[_0x212a('0x9')]);router[_0x212a('0x7')](_0x212a('0xa'),auth[_0x212a('0x8')](),controller['show']);router[_0x212a('0xb')]('/',auth['isAuthenticated'](),controller[_0x212a('0xc')]);router[_0x212a('0xd')](_0x212a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x212a('0xe')](_0x212a('0xa'),auth[_0x212a('0x8')](),controller[_0x212a('0xf')]);module[_0x212a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index d9bf379..53d5118 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 _0x2bb2=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x2bb2,0x82));var _0x22bb=function(_0x4bd5f9,_0xfbd152){_0x4bd5f9=_0x4bd5f9-0x0;var _0x58b951=_0x2bb2[_0x4bd5f9];return _0x58b951;};'use strict';var Sequelize=require(_0x22bb('0x0'));module[_0x22bb('0x1')]={'type':{'type':Sequelize[_0x22bb('0x2')](_0x22bb('0x3'),_0x22bb('0x4'),_0x22bb('0x5'),_0x22bb('0x6'),_0x22bb('0x7')),'defaultValue':_0x22bb('0x3')},'content':{'type':Sequelize[_0x22bb('0x8')]},'key':{'type':Sequelize[_0x22bb('0x8')]},'keyType':{'type':Sequelize[_0x22bb('0x2')]('string',_0x22bb('0x4'),_0x22bb('0x5'))},'keyContent':{'type':Sequelize[_0x22bb('0x8')]},'idField':{'type':Sequelize[_0x22bb('0x8')]},'variableName':{'type':Sequelize[_0x22bb('0x8')]}}; \ No newline at end of file +var _0xfe55=['string','variable','customVariable','keyValue','picklist','STRING','exports','ENUM'];(function(_0x3ec501,_0x1d035a){var _0x5a3037=function(_0x383d66){while(--_0x383d66){_0x3ec501['push'](_0x3ec501['shift']());}};_0x5a3037(++_0x1d035a);}(_0xfe55,0x13e));var _0x5fe5=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0xfe55[_0x2a5099];return _0x2802f1;};'use strict';var Sequelize=require('sequelize');module[_0x5fe5('0x0')]={'type':{'type':Sequelize[_0x5fe5('0x1')](_0x5fe5('0x2'),_0x5fe5('0x3'),_0x5fe5('0x4'),_0x5fe5('0x5'),_0x5fe5('0x6')),'defaultValue':_0x5fe5('0x2')},'content':{'type':Sequelize[_0x5fe5('0x7')]},'key':{'type':Sequelize[_0x5fe5('0x7')]},'keyType':{'type':Sequelize[_0x5fe5('0x1')](_0x5fe5('0x2'),_0x5fe5('0x3'),_0x5fe5('0x4'))},'keyContent':{'type':Sequelize[_0x5fe5('0x7')]},'idField':{'type':Sequelize[_0x5fe5('0x7')]},'variableName':{'type':Sequelize[_0x5fe5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 27d9e94..272324f 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 _0xe541=['../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x30a528,_0x1d04f2){var _0x3e029c=function(_0x4e4b97){while(--_0x4e4b97){_0x30a528['push'](_0x30a528['shift']());}};_0x3e029c(++_0x1d04f2);}(_0xe541,0x15a));var _0x1e54=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0xe541[_0x421eeb];return _0x2c7371;};'use strict';var emlformat=require(_0x1e54('0x0'));var rimraf=require(_0x1e54('0x1'));var zipdir=require(_0x1e54('0x2'));var jsonpatch=require(_0x1e54('0x3'));var rp=require(_0x1e54('0x4'));var moment=require(_0x1e54('0x5'));var BPromise=require(_0x1e54('0x6'));var Mustache=require(_0x1e54('0x7'));var util=require(_0x1e54('0x8'));var path=require(_0x1e54('0x9'));var sox=require('sox');var csv=require(_0x1e54('0xa'));var ejs=require(_0x1e54('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e54('0xc'));var squel=require(_0x1e54('0xd'));var crypto=require('crypto');var jsforce=require(_0x1e54('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1e54('0xf'));var Papa=require(_0x1e54('0x10'));var Redis=require(_0x1e54('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1e54('0x12'));var as=require(_0x1e54('0x13'));var hardwareService=require(_0x1e54('0x14'));var logger=require(_0x1e54('0x15'))('api');var utils=require(_0x1e54('0x16'));var config=require(_0x1e54('0x17'));var licenseUtil=require(_0x1e54('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18fc32,_0xd9fbd0){_0xd9fbd0=_0xd9fbd0||0xcc;return function(_0x3f3c14){if(_0x3f3c14){return _0x18fc32[_0x1e54('0x19')](_0xd9fbd0);}return _0x18fc32[_0x1e54('0x1a')](_0xd9fbd0)['end']();};}function respondWithResult(_0x38399a,_0x50efa2){_0x50efa2=_0x50efa2||0xc8;return function(_0x2383e5){if(_0x2383e5){return _0x38399a[_0x1e54('0x1a')](_0x50efa2)[_0x1e54('0x1b')](_0x2383e5);}};}function respondWithFilteredResult(_0x2c6045,_0x638a91){return function(_0x4cf43a){if(_0x4cf43a){var _0x3b5561=typeof _0x638a91['offset']===_0x1e54('0x1c')&&typeof _0x638a91['limit']===_0x1e54('0x1c');var _0x3d1d43=_0x4cf43a[_0x1e54('0x1d')];var _0xadd6eb=_0x3b5561?0x0:_0x638a91[_0x1e54('0x1e')];var _0x539dcd=_0x3b5561?_0x4cf43a[_0x1e54('0x1d')]:_0x638a91[_0x1e54('0x1e')]+_0x638a91[_0x1e54('0x1f')];var _0x412298;if(_0x539dcd>=_0x3d1d43){_0x539dcd=_0x3d1d43;_0x412298=0xc8;}else{_0x412298=0xce;}_0x2c6045[_0x1e54('0x1a')](_0x412298);return _0x2c6045[_0x1e54('0x20')]('Content-Range',_0xadd6eb+'-'+_0x539dcd+'/'+_0x3d1d43)['json'](_0x4cf43a);}return null;};}function patchUpdates(_0x4b0c66){return function(_0x12f122){try{jsonpatch[_0x1e54('0x21')](_0x12f122,_0x4b0c66,!![]);}catch(_0x1ca702){return BPromise[_0x1e54('0x22')](_0x1ca702);}return _0x12f122['save']();};}function saveUpdates(_0x2eee96,_0x23aa60){return function(_0x32090d){if(_0x32090d){return _0x32090d[_0x1e54('0x23')](_0x2eee96)[_0x1e54('0x24')](function(_0x3e15e2){return _0x3e15e2;});}return null;};}function removeEntity(_0x5ae673,_0x1852d4){return function(_0x2d067a){if(_0x2d067a){return _0x2d067a[_0x1e54('0x25')]()[_0x1e54('0x24')](function(){_0x5ae673[_0x1e54('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8ea2,_0x515671){return function(_0x17bc07){if(!_0x17bc07){_0x1d8ea2[_0x1e54('0x19')](0x194);}return _0x17bc07;};}function handleError(_0x59f7a9,_0x10bc08){_0x10bc08=_0x10bc08||0x1f4;return function(_0x4562fa){logger[_0x1e54('0x26')](_0x4562fa[_0x1e54('0x27')]);if(_0x4562fa['name']){delete _0x4562fa[_0x1e54('0x28')];}_0x59f7a9[_0x1e54('0x1a')](_0x10bc08)[_0x1e54('0x29')](_0x4562fa);};}exports[_0x1e54('0x2a')]=function(_0x282b39,_0x800abd){var _0x39973e={},_0x1d34aa={},_0xab9003={'count':0x0,'rows':[]};var _0x14a9dd=_[_0x1e54('0x2b')](db[_0x1e54('0x2c')][_0x1e54('0x2d')],function(_0x598242){return{'name':_0x598242[_0x1e54('0x2e')],'type':_0x598242[_0x1e54('0x2f')][_0x1e54('0x30')]};});_0x1d34aa[_0x1e54('0x31')]=_[_0x1e54('0x2b')](_0x14a9dd,_0x1e54('0x28'));_0x1d34aa[_0x1e54('0x32')]=_[_0x1e54('0x33')](_0x282b39[_0x1e54('0x32')]);_0x1d34aa[_0x1e54('0x34')]=_[_0x1e54('0x35')](_0x1d34aa['model'],_0x1d34aa[_0x1e54('0x32')]);_0x39973e[_0x1e54('0x36')]=_[_0x1e54('0x35')](_0x1d34aa['model'],qs[_0x1e54('0x37')](_0x282b39['query'][_0x1e54('0x37')]));_0x39973e[_0x1e54('0x36')]=_0x39973e[_0x1e54('0x36')][_0x1e54('0x38')]?_0x39973e[_0x1e54('0x36')]:_0x1d34aa['model'];if(!_0x282b39[_0x1e54('0x32')][_0x1e54('0x39')](_0x1e54('0x3a'))){_0x39973e[_0x1e54('0x1f')]=qs['limit'](_0x282b39[_0x1e54('0x32')]['limit']);_0x39973e[_0x1e54('0x1e')]=qs[_0x1e54('0x1e')](_0x282b39[_0x1e54('0x32')][_0x1e54('0x1e')]);}_0x39973e['order']=qs[_0x1e54('0x3b')](_0x282b39[_0x1e54('0x32')][_0x1e54('0x3b')]);_0x39973e[_0x1e54('0x3c')]=qs[_0x1e54('0x34')](_[_0x1e54('0x3d')](_0x282b39['query'],_0x1d34aa['filters']),_0x14a9dd);if(_0x282b39[_0x1e54('0x32')][_0x1e54('0x3e')]){_0x39973e[_0x1e54('0x3c')]=_[_0x1e54('0x3f')](_0x39973e[_0x1e54('0x3c')],{'$or':_[_0x1e54('0x2b')](_0x14a9dd,function(_0x190971){if(_0x190971[_0x1e54('0x2f')]!==_0x1e54('0x40')){var _0x4b7712={};_0x4b7712[_0x190971[_0x1e54('0x28')]]={'$like':'%'+_0x282b39[_0x1e54('0x32')][_0x1e54('0x3e')]+'%'};return _0x4b7712;}})});}_0x39973e=_[_0x1e54('0x3f')]({},_0x39973e,_0x282b39[_0x1e54('0x41')]);var _0x18f193={'where':_0x39973e['where']};return db['SalesforceField'][_0x1e54('0x1d')](_0x18f193)['then'](function(_0x1cd88c){_0xab9003[_0x1e54('0x1d')]=_0x1cd88c;if(_0x282b39[_0x1e54('0x32')][_0x1e54('0x42')]){_0x39973e[_0x1e54('0x43')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x39973e);})[_0x1e54('0x24')](function(_0x4671fc){_0xab9003[_0x1e54('0x44')]=_0x4671fc;return _0xab9003;})[_0x1e54('0x24')](respondWithFilteredResult(_0x800abd,_0x39973e))[_0x1e54('0x45')](handleError(_0x800abd,null));};exports['show']=function(_0x459160,_0x1a6eee){var _0x112e4c={'raw':!![],'where':{'id':_0x459160[_0x1e54('0x46')]['id']}},_0x255f6a={};_0x255f6a[_0x1e54('0x31')]=_[_0x1e54('0x33')](db[_0x1e54('0x2c')][_0x1e54('0x2d')]);_0x255f6a['query']=_['keys'](_0x459160[_0x1e54('0x32')]);_0x255f6a[_0x1e54('0x34')]=_['intersection'](_0x255f6a['model'],_0x255f6a[_0x1e54('0x32')]);_0x112e4c['attributes']=_[_0x1e54('0x35')](_0x255f6a[_0x1e54('0x31')],qs[_0x1e54('0x37')](_0x459160['query'][_0x1e54('0x37')]));_0x112e4c['attributes']=_0x112e4c[_0x1e54('0x36')][_0x1e54('0x38')]?_0x112e4c[_0x1e54('0x36')]:_0x255f6a['model'];if(_0x459160[_0x1e54('0x32')]['includeAll']){_0x112e4c[_0x1e54('0x43')]=[{'all':!![]}];}_0x112e4c=_[_0x1e54('0x3f')]({},_0x112e4c,_0x459160['options']);return db['SalesforceField'][_0x1e54('0x47')](_0x112e4c)[_0x1e54('0x24')](handleEntityNotFound(_0x1a6eee,null))[_0x1e54('0x24')](respondWithResult(_0x1a6eee,null))[_0x1e54('0x45')](handleError(_0x1a6eee,null));};exports[_0x1e54('0x48')]=function(_0x5ece6a,_0x165f98){return db[_0x1e54('0x2c')][_0x1e54('0x48')](_0x5ece6a[_0x1e54('0x49')],{})[_0x1e54('0x24')](respondWithResult(_0x165f98,0xc9))['catch'](handleError(_0x165f98,null));};exports[_0x1e54('0x23')]=function(_0x4e9748,_0x33700d){if(_0x4e9748[_0x1e54('0x49')]['id']){delete _0x4e9748['body']['id'];}return db[_0x1e54('0x2c')][_0x1e54('0x47')]({'where':{'id':_0x4e9748[_0x1e54('0x46')]['id']}})['then'](handleEntityNotFound(_0x33700d,null))['then'](saveUpdates(_0x4e9748[_0x1e54('0x49')],null))[_0x1e54('0x24')](respondWithResult(_0x33700d,null))['catch'](handleError(_0x33700d,null));};exports[_0x1e54('0x25')]=function(_0xde3f3c,_0x1298f3){return db[_0x1e54('0x2c')][_0x1e54('0x47')]({'where':{'id':_0xde3f3c[_0x1e54('0x46')]['id']}})['then'](handleEntityNotFound(_0x1298f3,null))['then'](removeEntity(_0x1298f3,null))[_0x1e54('0x45')](handleError(_0x1298f3,null));}; \ No newline at end of file +var _0x8788=['keys','filters','intersection','query','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','SalesforceField','fieldName','type','model','map'];(function(_0x182e09,_0x5cb1f1){var _0x5bb657=function(_0x2e987b){while(--_0x2e987b){_0x182e09['push'](_0x182e09['shift']());}};_0x5bb657(++_0x5cb1f1);}(_0x8788,0xaa));var _0x8878=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0x8788[_0xea343d];return _0x2c6e9c;};'use strict';var emlformat=require(_0x8878('0x0'));var rimraf=require(_0x8878('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8878('0x2'));var rp=require(_0x8878('0x3'));var moment=require(_0x8878('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8878('0x5'));var path=require('path');var sox=require(_0x8878('0x6'));var csv=require(_0x8878('0x7'));var ejs=require(_0x8878('0x8'));var fs=require('fs');var fs_extra=require(_0x8878('0x9'));var _=require(_0x8878('0xa'));var squel=require(_0x8878('0xb'));var crypto=require(_0x8878('0xc'));var jsforce=require(_0x8878('0xd'));var deskjs=require(_0x8878('0xe'));var toCsv=require(_0x8878('0x7'));var querystring=require(_0x8878('0xf'));var Papa=require(_0x8878('0x10'));var Redis=require(_0x8878('0x11'));var authService=require(_0x8878('0x12'));var qs=require(_0x8878('0x13'));var as=require(_0x8878('0x14'));var hardwareService=require(_0x8878('0x15'));var logger=require(_0x8878('0x16'))(_0x8878('0x17'));var utils=require(_0x8878('0x18'));var config=require(_0x8878('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8878('0x1a'))['db'];function respondWithStatusCode(_0x2837cb,_0x29290c){_0x29290c=_0x29290c||0xcc;return function(_0x16bff5){if(_0x16bff5){return _0x2837cb[_0x8878('0x1b')](_0x29290c);}return _0x2837cb[_0x8878('0x1c')](_0x29290c)[_0x8878('0x1d')]();};}function respondWithResult(_0x47b45e,_0x276f01){_0x276f01=_0x276f01||0xc8;return function(_0x38e3da){if(_0x38e3da){return _0x47b45e[_0x8878('0x1c')](_0x276f01)['json'](_0x38e3da);}};}function respondWithFilteredResult(_0x2efb95,_0x102733){return function(_0x2e2ca2){if(_0x2e2ca2){var _0x41b561=typeof _0x102733[_0x8878('0x1e')]===_0x8878('0x1f')&&typeof _0x102733['limit']==='undefined';var _0x13c2b4=_0x2e2ca2['count'];var _0x2442e0=_0x41b561?0x0:_0x102733[_0x8878('0x1e')];var _0x334695=_0x41b561?_0x2e2ca2[_0x8878('0x20')]:_0x102733[_0x8878('0x1e')]+_0x102733[_0x8878('0x21')];var _0x4b80d2;if(_0x334695>=_0x13c2b4){_0x334695=_0x13c2b4;_0x4b80d2=0xc8;}else{_0x4b80d2=0xce;}_0x2efb95['status'](_0x4b80d2);return _0x2efb95['set'](_0x8878('0x22'),_0x2442e0+'-'+_0x334695+'/'+_0x13c2b4)[_0x8878('0x23')](_0x2e2ca2);}return null;};}function patchUpdates(_0xe266f){return function(_0x37c1c3){try{jsonpatch[_0x8878('0x24')](_0x37c1c3,_0xe266f,!![]);}catch(_0x5415f1){return BPromise[_0x8878('0x25')](_0x5415f1);}return _0x37c1c3[_0x8878('0x26')]();};}function saveUpdates(_0x5efb8f,_0x53ff20){return function(_0x23cbc9){if(_0x23cbc9){return _0x23cbc9[_0x8878('0x27')](_0x5efb8f)[_0x8878('0x28')](function(_0x2e8ac8){return _0x2e8ac8;});}return null;};}function removeEntity(_0x153512,_0xe362b4){return function(_0x186ca4){if(_0x186ca4){return _0x186ca4['destroy']()[_0x8878('0x28')](function(){_0x153512['status'](0xcc)[_0x8878('0x1d')]();});}};}function handleEntityNotFound(_0x23cb0a,_0x2fcb63){return function(_0x5e095f){if(!_0x5e095f){_0x23cb0a[_0x8878('0x1b')](0x194);}return _0x5e095f;};}function handleError(_0x410974,_0x56d730){_0x56d730=_0x56d730||0x1f4;return function(_0x57fd96){logger[_0x8878('0x29')](_0x57fd96[_0x8878('0x2a')]);if(_0x57fd96['name']){delete _0x57fd96[_0x8878('0x2b')];}_0x410974[_0x8878('0x1c')](_0x56d730)['send'](_0x57fd96);};}exports['index']=function(_0x4301ca,_0x43333c){var _0x56257a={},_0x231b4a={},_0x3d3307={'count':0x0,'rows':[]};var _0x4c8ca8=_['map'](db[_0x8878('0x2c')]['rawAttributes'],function(_0x5c7244){return{'name':_0x5c7244[_0x8878('0x2d')],'type':_0x5c7244[_0x8878('0x2e')]['key']};});_0x231b4a[_0x8878('0x2f')]=_[_0x8878('0x30')](_0x4c8ca8,_0x8878('0x2b'));_0x231b4a['query']=_[_0x8878('0x31')](_0x4301ca['query']);_0x231b4a[_0x8878('0x32')]=_[_0x8878('0x33')](_0x231b4a[_0x8878('0x2f')],_0x231b4a[_0x8878('0x34')]);_0x56257a['attributes']=_[_0x8878('0x33')](_0x231b4a[_0x8878('0x2f')],qs[_0x8878('0x35')](_0x4301ca[_0x8878('0x34')][_0x8878('0x35')]));_0x56257a[_0x8878('0x36')]=_0x56257a['attributes'][_0x8878('0x37')]?_0x56257a['attributes']:_0x231b4a[_0x8878('0x2f')];if(!_0x4301ca['query']['hasOwnProperty'](_0x8878('0x38'))){_0x56257a[_0x8878('0x21')]=qs[_0x8878('0x21')](_0x4301ca[_0x8878('0x34')][_0x8878('0x21')]);_0x56257a['offset']=qs[_0x8878('0x1e')](_0x4301ca['query'][_0x8878('0x1e')]);}_0x56257a['order']=qs[_0x8878('0x39')](_0x4301ca[_0x8878('0x34')][_0x8878('0x39')]);_0x56257a[_0x8878('0x3a')]=qs[_0x8878('0x32')](_['pick'](_0x4301ca[_0x8878('0x34')],_0x231b4a['filters']),_0x4c8ca8);if(_0x4301ca['query'][_0x8878('0x3b')]){_0x56257a[_0x8878('0x3a')]=_[_0x8878('0x3c')](_0x56257a[_0x8878('0x3a')],{'$or':_[_0x8878('0x30')](_0x4c8ca8,function(_0x16f44f){if(_0x16f44f['type']!==_0x8878('0x3d')){var _0x3e263b={};_0x3e263b[_0x16f44f[_0x8878('0x2b')]]={'$like':'%'+_0x4301ca[_0x8878('0x34')][_0x8878('0x3b')]+'%'};return _0x3e263b;}})});}_0x56257a=_[_0x8878('0x3c')]({},_0x56257a,_0x4301ca[_0x8878('0x3e')]);var _0xde6a11={'where':_0x56257a[_0x8878('0x3a')]};return db['SalesforceField']['count'](_0xde6a11)[_0x8878('0x28')](function(_0x29dd5e){_0x3d3307[_0x8878('0x20')]=_0x29dd5e;if(_0x4301ca['query'][_0x8878('0x3f')]){_0x56257a[_0x8878('0x40')]=[{'all':!![]}];}return db[_0x8878('0x2c')][_0x8878('0x41')](_0x56257a);})[_0x8878('0x28')](function(_0x1faca3){_0x3d3307['rows']=_0x1faca3;return _0x3d3307;})[_0x8878('0x28')](respondWithFilteredResult(_0x43333c,_0x56257a))[_0x8878('0x42')](handleError(_0x43333c,null));};exports[_0x8878('0x43')]=function(_0x11b89e,_0x237abe){var _0x9a1932={'raw':!![],'where':{'id':_0x11b89e[_0x8878('0x44')]['id']}},_0x47ab41={};_0x47ab41[_0x8878('0x2f')]=_[_0x8878('0x31')](db[_0x8878('0x2c')]['rawAttributes']);_0x47ab41[_0x8878('0x34')]=_[_0x8878('0x31')](_0x11b89e[_0x8878('0x34')]);_0x47ab41[_0x8878('0x32')]=_[_0x8878('0x33')](_0x47ab41['model'],_0x47ab41[_0x8878('0x34')]);_0x9a1932[_0x8878('0x36')]=_[_0x8878('0x33')](_0x47ab41['model'],qs[_0x8878('0x35')](_0x11b89e[_0x8878('0x34')][_0x8878('0x35')]));_0x9a1932[_0x8878('0x36')]=_0x9a1932['attributes'][_0x8878('0x37')]?_0x9a1932[_0x8878('0x36')]:_0x47ab41[_0x8878('0x2f')];if(_0x11b89e['query'][_0x8878('0x3f')]){_0x9a1932[_0x8878('0x40')]=[{'all':!![]}];}_0x9a1932=_[_0x8878('0x3c')]({},_0x9a1932,_0x11b89e[_0x8878('0x3e')]);return db['SalesforceField']['find'](_0x9a1932)[_0x8878('0x28')](handleEntityNotFound(_0x237abe,null))['then'](respondWithResult(_0x237abe,null))['catch'](handleError(_0x237abe,null));};exports[_0x8878('0x45')]=function(_0x427cc6,_0x5a7048){return db['SalesforceField'][_0x8878('0x45')](_0x427cc6[_0x8878('0x46')],{})[_0x8878('0x28')](respondWithResult(_0x5a7048,0xc9))[_0x8878('0x42')](handleError(_0x5a7048,null));};exports[_0x8878('0x27')]=function(_0x3040c5,_0x174737){if(_0x3040c5[_0x8878('0x46')]['id']){delete _0x3040c5[_0x8878('0x46')]['id'];}return db[_0x8878('0x2c')][_0x8878('0x47')]({'where':{'id':_0x3040c5[_0x8878('0x44')]['id']}})[_0x8878('0x28')](handleEntityNotFound(_0x174737,null))['then'](saveUpdates(_0x3040c5[_0x8878('0x46')],null))[_0x8878('0x28')](respondWithResult(_0x174737,null))[_0x8878('0x42')](handleError(_0x174737,null));};exports[_0x8878('0x48')]=function(_0x52c2fc,_0x5b9a07){return db[_0x8878('0x2c')][_0x8878('0x47')]({'where':{'id':_0x52c2fc[_0x8878('0x44')]['id']}})[_0x8878('0x28')](handleEntityNotFound(_0x5b9a07,null))[_0x8878('0x28')](removeEntity(_0x5b9a07,null))['catch'](handleError(_0x5b9a07,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 309a23c..ec53ce1 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 _0x08b5=['exports','define','SalesforceField','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x573c19,_0x5525bd){var _0x26df1d=function(_0x1ce098){while(--_0x1ce098){_0x573c19['push'](_0x573c19['shift']());}};_0x26df1d(++_0x5525bd);}(_0x08b5,0x131));var _0x508b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x08b5[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x508b('0x0'));var util=require(_0x508b('0x1'));var logger=require(_0x508b('0x2'))(_0x508b('0x3'));var moment=require(_0x508b('0x4'));var BPromise=require(_0x508b('0x5'));var rp=require(_0x508b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x508b('0x7'));var config=require(_0x508b('0x8'));var attributes=require(_0x508b('0x9'));module[_0x508b('0xa')]=function(_0x9f5cb1,_0x1b865f){return _0x9f5cb1[_0x508b('0xb')](_0x508b('0xc'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x508b('0xd'),_0x508b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcabb=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0xe886fa,_0x5a2f45){var _0xf40f=function(_0x29ab47){while(--_0x29ab47){_0xe886fa['push'](_0xe886fa['shift']());}};_0xf40f(++_0x5a2f45);}(_0xcabb,0x17d));var _0xbcab=function(_0x501ff9,_0x3c0677){_0x501ff9=_0x501ff9-0x0;var _0x129fa7=_0xcabb[_0x501ff9];return _0x129fa7;};'use strict';var _=require('lodash');var util=require(_0xbcab('0x0'));var logger=require(_0xbcab('0x1'))('api');var moment=require(_0xbcab('0x2'));var BPromise=require(_0xbcab('0x3'));var rp=require(_0xbcab('0x4'));var fs=require('fs');var path=require(_0xbcab('0x5'));var rimraf=require('rimraf');var config=require(_0xbcab('0x6'));var attributes=require(_0xbcab('0x7'));module[_0xbcab('0x8')]=function(_0x4e81d3,_0xd120b3){return _0x4e81d3[_0xbcab('0x9')](_0xbcab('0xa'),attributes,{'tableName':_0xbcab('0xb'),'paranoid':![],'indexes':[{'name':_0xbcab('0xc'),'fields':[_0xbcab('0xd'),_0xbcab('0xe')],'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 68e0d95..daca9dd 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 _0xf43d=['code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xff2e73,_0x25a284){var _0x3729b6=function(_0x5e3c70){while(--_0x5e3c70){_0xff2e73['push'](_0xff2e73['shift']());}};_0x3729b6(++_0x25a284);}(_0xf43d,0x1be));var _0xdf43=function(_0x47f580,_0x4bb039){_0x47f580=_0x47f580-0x0;var _0x100a5b=_0xf43d[_0x47f580];return _0x100a5b;};'use strict';var _=require(_0xdf43('0x0'));var util=require(_0xdf43('0x1'));var moment=require(_0xdf43('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf43('0x3'))['db'];var utils=require(_0xdf43('0x4'));var logger=require(_0xdf43('0x5'))('rpc');var config=require(_0xdf43('0x6'));var jayson=require(_0xdf43('0x7'));var client=jayson[_0xdf43('0x8')][_0xdf43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7c7b95,_0x4c2ef7,_0x2bae56){return new BPromise(function(_0xeee4c9,_0x153581){return client['request'](_0x7c7b95,_0x2bae56)['then'](function(_0x430721){logger[_0xdf43('0xa')]('SalesforceField,\x20%s,\x20%s',_0x4c2ef7,_0xdf43('0xb'));logger[_0xdf43('0xc')](_0xdf43('0xd'),_0x4c2ef7,_0xdf43('0xb'),JSON[_0xdf43('0xe')](_0x430721));if(_0x430721[_0xdf43('0xf')]){if(_0x430721['error'][_0xdf43('0x10')]===0x1f4){logger['error'](_0xdf43('0x11'),_0x4c2ef7,_0x430721[_0xdf43('0xf')][_0xdf43('0x12')]);return _0x153581(_0x430721['error'][_0xdf43('0x12')]);}logger[_0xdf43('0xf')]('SalesforceField,\x20%s,\x20%s',_0x4c2ef7,_0x430721['error'][_0xdf43('0x12')]);return _0xeee4c9(_0x430721[_0xdf43('0xf')]['message']);}else{logger[_0xdf43('0xa')](_0xdf43('0x11'),_0x4c2ef7,_0xdf43('0xb'));_0xeee4c9(_0x430721[_0xdf43('0x13')][_0xdf43('0x12')]);}})[_0xdf43('0x14')](function(_0x7ed38a){logger[_0xdf43('0xf')](_0xdf43('0x11'),_0x4c2ef7,_0x7ed38a);_0x153581(_0x7ed38a);});});} \ No newline at end of file +var _0x5e9a=['catch','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1d3864,_0x11fd66){var _0x2a2f1b=function(_0x3d66fa){while(--_0x3d66fa){_0x1d3864['push'](_0x1d3864['shift']());}};_0x2a2f1b(++_0x11fd66);}(_0x5e9a,0x155));var _0xa5e9=function(_0x4517f3,_0x3af8ef){_0x4517f3=_0x4517f3-0x0;var _0x1d63d3=_0x5e9a[_0x4517f3];return _0x1d63d3;};'use strict';var _=require('lodash');var util=require(_0xa5e9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa5e9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5e9('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5e9('0x3'))(_0xa5e9('0x4'));var config=require(_0xa5e9('0x5'));var jayson=require(_0xa5e9('0x6'));var client=jayson[_0xa5e9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2cf4,_0x5e2dc9,_0x3e117a){return new BPromise(function(_0x277e39,_0x507aca){return client[_0xa5e9('0x8')](_0x1f2cf4,_0x3e117a)['then'](function(_0x11010c){logger[_0xa5e9('0x9')](_0xa5e9('0xa'),_0x5e2dc9,_0xa5e9('0xb'));logger[_0xa5e9('0xc')](_0xa5e9('0xd'),_0x5e2dc9,_0xa5e9('0xb'),JSON[_0xa5e9('0xe')](_0x11010c));if(_0x11010c[_0xa5e9('0xf')]){if(_0x11010c[_0xa5e9('0xf')][_0xa5e9('0x10')]===0x1f4){logger[_0xa5e9('0xf')](_0xa5e9('0xa'),_0x5e2dc9,_0x11010c['error'][_0xa5e9('0x11')]);return _0x507aca(_0x11010c[_0xa5e9('0xf')][_0xa5e9('0x11')]);}logger['error'](_0xa5e9('0xa'),_0x5e2dc9,_0x11010c[_0xa5e9('0xf')]['message']);return _0x277e39(_0x11010c['error'][_0xa5e9('0x11')]);}else{logger[_0xa5e9('0x9')]('SalesforceField,\x20%s,\x20%s',_0x5e2dc9,_0xa5e9('0xb'));_0x277e39(_0x11010c[_0xa5e9('0x12')][_0xa5e9('0x11')]);}})[_0xa5e9('0x13')](function(_0x49baed){logger[_0xa5e9('0xf')]('SalesforceField,\x20%s,\x20%s',_0x5e2dc9,_0x49baed);_0x507aca(_0x49baed);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 010f7dd..47ff369 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 _0xacb8=['../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x3a5a0d,_0x328d15){var _0x4a005f=function(_0x50ed3a){while(--_0x50ed3a){_0x3a5a0d['push'](_0x3a5a0d['shift']());}};_0x4a005f(++_0x328d15);}(_0xacb8,0x119));var _0x8acb=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xacb8[_0x1b4b23];return _0x2a325b;};'use strict';var multer=require(_0x8acb('0x0'));var util=require('util');var path=require(_0x8acb('0x1'));var timeout=require(_0x8acb('0x2'));var express=require(_0x8acb('0x3'));var router=express['Router']();var fs_extra=require(_0x8acb('0x4'));var auth=require(_0x8acb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8acb('0x6'));var controller=require(_0x8acb('0x7'));router[_0x8acb('0x8')]('/',auth[_0x8acb('0x9')](),controller[_0x8acb('0xa')]);router[_0x8acb('0x8')]('/:id',auth[_0x8acb('0x9')](),controller[_0x8acb('0xb')]);router[_0x8acb('0x8')](_0x8acb('0xc'),auth[_0x8acb('0x9')](),controller[_0x8acb('0xd')]);router['get']('/:id/fields',auth[_0x8acb('0x9')](),controller[_0x8acb('0xe')]);router[_0x8acb('0xf')]('/',auth[_0x8acb('0x9')](),controller['create']);router[_0x8acb('0xf')](_0x8acb('0xc'),auth['isAuthenticated'](),controller[_0x8acb('0x10')]);router[_0x8acb('0x11')](_0x8acb('0x12'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x13')]);router['delete'](_0x8acb('0x12'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x14')]);module[_0x8acb('0x15')]=router; \ No newline at end of file +var _0x6263=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x5b09b5,_0xea4cdf){var _0x929bf=function(_0xb7cd46){while(--_0xb7cd46){_0x5b09b5['push'](_0x5b09b5['shift']());}};_0x929bf(++_0xea4cdf);}(_0x6263,0x19d));var _0x3626=function(_0x523414,_0x58a86a){_0x523414=_0x523414-0x0;var _0x354b87=_0x6263[_0x523414];return _0x354b87;};'use strict';var multer=require(_0x3626('0x0'));var util=require(_0x3626('0x1'));var path=require(_0x3626('0x2'));var timeout=require(_0x3626('0x3'));var express=require(_0x3626('0x4'));var router=express['Router']();var fs_extra=require(_0x3626('0x5'));var auth=require(_0x3626('0x6'));var interaction=require(_0x3626('0x7'));var config=require(_0x3626('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x3626('0x9')]('/',auth['isAuthenticated'](),controller[_0x3626('0xa')]);router[_0x3626('0x9')]('/:id',auth[_0x3626('0xb')](),controller[_0x3626('0xc')]);router['get'](_0x3626('0xd'),auth[_0x3626('0xb')](),controller['getConfigurations']);router['get'](_0x3626('0xe'),auth[_0x3626('0xb')](),controller['getFields']);router[_0x3626('0xf')]('/',auth[_0x3626('0xb')](),controller[_0x3626('0x10')]);router[_0x3626('0xf')](_0x3626('0xd'),auth['isAuthenticated'](),controller[_0x3626('0x11')]);router[_0x3626('0x12')]('/:id',auth[_0x3626('0xb')](),controller[_0x3626('0x13')]);router[_0x3626('0x14')](_0x3626('0x15'),auth[_0x3626('0xb')](),controller[_0x3626('0x16')]);module[_0x3626('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 3264373..a4fb005 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 _0x1b30=['exports','STRING','username','remoteUri'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x1b30,0x120));var _0x01b3=function(_0x13d2c6,_0x36ebb1){_0x13d2c6=_0x13d2c6-0x0;var _0x40c250=_0x1b30[_0x13d2c6];return _0x40c250;};'use strict';var Sequelize=require('sequelize');module[_0x01b3('0x0')]={'name':{'type':Sequelize[_0x01b3('0x1')]},'description':{'type':Sequelize[_0x01b3('0x1')]},'username':{'type':Sequelize[_0x01b3('0x1')],'unique':_0x01b3('0x2')},'password':{'type':Sequelize[_0x01b3('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x01b3('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0478=['STRING','remoteUri'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x0478,0x186));var _0x8047=function(_0x3fecfb,_0x333b0c){_0x3fecfb=_0x3fecfb-0x0;var _0x49a988=_0x0478[_0x3fecfb];return _0x49a988;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8047('0x0')]},'description':{'type':Sequelize[_0x8047('0x0')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8047('0x0')]},'remoteUri':{'type':Sequelize[_0x8047('0x0')],'unique':_0x8047('0x1')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 702e0a0..98caaf1 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 _0x832d=['made_sla','hold_reason','subcategory','close_code','notify','incident_state','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','approval_set','short_description','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','urgency','company','reassignment_count','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','password','email','remoteUri','serverUrl','substring','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','end','error','name','send','index','map','ServicenowAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','getConfigurations','findOne','ServicenowConfiguration','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields'];(function(_0x40c32b,_0x106317){var _0x1eda88=function(_0x385a84){while(--_0x385a84){_0x40c32b['push'](_0x40c32b['shift']());}};_0x1eda88(++_0x106317);}(_0x832d,0x122));var _0xd832=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x832d[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xd832('0x0'));var rimraf=require(_0xd832('0x1'));var zipdir=require(_0xd832('0x2'));var jsonpatch=require(_0xd832('0x3'));var rp=require(_0xd832('0x4'));var moment=require(_0xd832('0x5'));var BPromise=require(_0xd832('0x6'));var Mustache=require(_0xd832('0x7'));var util=require(_0xd832('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd832('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd832('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd832('0xb'));var toCsv=require(_0xd832('0xc'));var querystring=require(_0xd832('0xd'));var Papa=require('papaparse');var Redis=require(_0xd832('0xe'));var authService=require(_0xd832('0xf'));var qs=require(_0xd832('0x10'));var as=require(_0xd832('0x11'));var hardwareService=require(_0xd832('0x12'));var logger=require(_0xd832('0x13'))(_0xd832('0x14'));var utils=require('../../config/utils');var config=require(_0xd832('0x15'));var licenseUtil=require(_0xd832('0x16'));var db=require(_0xd832('0x17'))['db'];var integrations=require(_0xd832('0x18'));function respondWithStatusCode(_0x39bd64,_0x84c7b4){_0x84c7b4=_0x84c7b4||0xcc;return function(_0x24b787){if(_0x24b787){return _0x39bd64[_0xd832('0x19')](_0x84c7b4);}return _0x39bd64[_0xd832('0x1a')](_0x84c7b4)['end']();};}function respondWithResult(_0x3932ef,_0x1972ac){_0x1972ac=_0x1972ac||0xc8;return function(_0x3922c1){if(_0x3922c1){return _0x3932ef[_0xd832('0x1a')](_0x1972ac)['json'](_0x3922c1);}};}function respondWithFilteredResult(_0x54f183,_0x178fad){return function(_0x713f57){if(_0x713f57){var _0xa9d698=typeof _0x178fad[_0xd832('0x1b')]===_0xd832('0x1c')&&typeof _0x178fad[_0xd832('0x1d')]===_0xd832('0x1c');var _0x5c1fb6=_0x713f57[_0xd832('0x1e')];var _0x1fbbdf=_0xa9d698?0x0:_0x178fad[_0xd832('0x1b')];var _0x436611=_0xa9d698?_0x713f57[_0xd832('0x1e')]:_0x178fad[_0xd832('0x1b')]+_0x178fad[_0xd832('0x1d')];var _0x35354b;if(_0x436611>=_0x5c1fb6){_0x436611=_0x5c1fb6;_0x35354b=0xc8;}else{_0x35354b=0xce;}_0x54f183[_0xd832('0x1a')](_0x35354b);return _0x54f183['set'](_0xd832('0x1f'),_0x1fbbdf+'-'+_0x436611+'/'+_0x5c1fb6)[_0xd832('0x20')](_0x713f57);}return null;};}function patchUpdates(_0xe7e12b){return function(_0x44f1ac){try{jsonpatch[_0xd832('0x21')](_0x44f1ac,_0xe7e12b,!![]);}catch(_0x58aed4){return BPromise[_0xd832('0x22')](_0x58aed4);}return _0x44f1ac['save']();};}function saveUpdates(_0x152ea9,_0x2f29fa){return function(_0x1f5903){if(_0x1f5903){return _0x1f5903['update'](_0x152ea9)[_0xd832('0x23')](function(_0x26fdce){return _0x26fdce;});}return null;};}function removeEntity(_0x4ca3cf,_0x475362){return function(_0x22717a){if(_0x22717a){return _0x22717a[_0xd832('0x24')]()[_0xd832('0x23')](function(){_0x4ca3cf[_0xd832('0x1a')](0xcc)[_0xd832('0x25')]();});}};}function handleEntityNotFound(_0x3840f,_0xf029cf){return function(_0x37fa1f){if(!_0x37fa1f){_0x3840f[_0xd832('0x19')](0x194);}return _0x37fa1f;};}function handleError(_0x582d37,_0x3e942e){_0x3e942e=_0x3e942e||0x1f4;return function(_0x66d585){logger[_0xd832('0x26')](_0x66d585['stack']);if(_0x66d585[_0xd832('0x27')]){delete _0x66d585[_0xd832('0x27')];}_0x582d37['status'](_0x3e942e)[_0xd832('0x28')](_0x66d585);};}exports[_0xd832('0x29')]=function(_0x2fb32,_0x7c433c){var _0x15d705={},_0x26bc3e={},_0x47238e={'count':0x0,'rows':[]};var _0x5d6a33=_[_0xd832('0x2a')](db[_0xd832('0x2b')][_0xd832('0x2c')],function(_0xeb7c15){return{'name':_0xeb7c15['fieldName'],'type':_0xeb7c15[_0xd832('0x2d')][_0xd832('0x2e')]};});_0x26bc3e[_0xd832('0x2f')]=_['map'](_0x5d6a33,_0xd832('0x27'));_0x26bc3e[_0xd832('0x30')]=_[_0xd832('0x31')](_0x2fb32[_0xd832('0x30')]);_0x26bc3e[_0xd832('0x32')]=_[_0xd832('0x33')](_0x26bc3e['model'],_0x26bc3e[_0xd832('0x30')]);_0x15d705['attributes']=_[_0xd832('0x33')](_0x26bc3e[_0xd832('0x2f')],qs[_0xd832('0x34')](_0x2fb32['query']['fields']));_0x15d705[_0xd832('0x35')]=_0x15d705[_0xd832('0x35')]['length']?_0x15d705[_0xd832('0x35')]:_0x26bc3e['model'];if(!_0x2fb32[_0xd832('0x30')][_0xd832('0x36')]('nolimit')){_0x15d705[_0xd832('0x1d')]=qs['limit'](_0x2fb32[_0xd832('0x30')]['limit']);_0x15d705[_0xd832('0x1b')]=qs[_0xd832('0x1b')](_0x2fb32[_0xd832('0x30')][_0xd832('0x1b')]);}_0x15d705[_0xd832('0x37')]=qs[_0xd832('0x38')](_0x2fb32['query']['sort']);_0x15d705[_0xd832('0x39')]=qs[_0xd832('0x32')](_[_0xd832('0x3a')](_0x2fb32[_0xd832('0x30')],_0x26bc3e[_0xd832('0x32')]),_0x5d6a33);if(_0x2fb32[_0xd832('0x30')][_0xd832('0x3b')]){_0x15d705['where']=_[_0xd832('0x3c')](_0x15d705['where'],{'$or':_[_0xd832('0x2a')](_0x5d6a33,function(_0x57a40c){if(_0x57a40c[_0xd832('0x2d')]!==_0xd832('0x3d')){var _0x314986={};_0x314986[_0x57a40c[_0xd832('0x27')]]={'$like':'%'+_0x2fb32['query']['filter']+'%'};return _0x314986;}})});}_0x15d705=_[_0xd832('0x3c')]({},_0x15d705,_0x2fb32[_0xd832('0x3e')]);var _0x4b139b={'where':_0x15d705[_0xd832('0x39')]};return db[_0xd832('0x2b')][_0xd832('0x1e')](_0x4b139b)['then'](function(_0x35f2dd){_0x47238e[_0xd832('0x1e')]=_0x35f2dd;if(_0x2fb32['query'][_0xd832('0x3f')]){_0x15d705[_0xd832('0x40')]=[{'all':!![]}];}return db[_0xd832('0x2b')][_0xd832('0x41')](_0x15d705);})[_0xd832('0x23')](function(_0xa4b87b){_0x47238e[_0xd832('0x42')]=_0xa4b87b;return _0x47238e;})[_0xd832('0x23')](respondWithFilteredResult(_0x7c433c,_0x15d705))[_0xd832('0x43')](handleError(_0x7c433c,null));};exports[_0xd832('0x44')]=function(_0x897371,_0x37385e){var _0xd0a718={'raw':![],'where':{'id':_0x897371['params']['id']}},_0x204828={};_0x204828[_0xd832('0x2f')]=_['keys'](db['ServicenowAccount'][_0xd832('0x2c')]);_0x204828['query']=_[_0xd832('0x31')](_0x897371[_0xd832('0x30')]);_0x204828['filters']=_[_0xd832('0x33')](_0x204828[_0xd832('0x2f')],_0x204828[_0xd832('0x30')]);_0xd0a718[_0xd832('0x35')]=_[_0xd832('0x33')](_0x204828[_0xd832('0x2f')],qs[_0xd832('0x34')](_0x897371['query'][_0xd832('0x34')]));_0xd0a718[_0xd832('0x35')]=_0xd0a718[_0xd832('0x35')][_0xd832('0x45')]?_0xd0a718['attributes']:_0x204828[_0xd832('0x2f')];if(_0x897371[_0xd832('0x30')][_0xd832('0x3f')]){_0xd0a718[_0xd832('0x40')]=[{'all':!![]}];}_0xd0a718=_[_0xd832('0x3c')]({},_0xd0a718,_0x897371[_0xd832('0x3e')]);return db[_0xd832('0x2b')][_0xd832('0x46')](_0xd0a718)[_0xd832('0x23')](handleEntityNotFound(_0x37385e,null))['then'](respondWithResult(_0x37385e,null))['catch'](handleError(_0x37385e,null));};exports[_0xd832('0x47')]=function(_0x35865e,_0x14e1ec){return db[_0xd832('0x2b')][_0xd832('0x47')](_0x35865e[_0xd832('0x48')],{})[_0xd832('0x23')](respondWithResult(_0x14e1ec,0xc9))[_0xd832('0x43')](handleError(_0x14e1ec,null));};exports[_0xd832('0x49')]=function(_0x52c510,_0x360566){if(_0x52c510[_0xd832('0x48')]['id']){delete _0x52c510[_0xd832('0x48')]['id'];}return db[_0xd832('0x2b')][_0xd832('0x46')]({'where':{'id':_0x52c510[_0xd832('0x4a')]['id']}})[_0xd832('0x23')](handleEntityNotFound(_0x360566,null))[_0xd832('0x23')](saveUpdates(_0x52c510[_0xd832('0x48')],null))[_0xd832('0x23')](respondWithResult(_0x360566,null))['catch'](handleError(_0x360566,null));};exports['destroy']=function(_0x48d7ae,_0x540955){return db[_0xd832('0x2b')]['find']({'where':{'id':_0x48d7ae[_0xd832('0x4a')]['id']}})[_0xd832('0x23')](handleEntityNotFound(_0x540955,null))[_0xd832('0x23')](removeEntity(_0x540955,null))[_0xd832('0x43')](handleError(_0x540955,null));};exports[_0xd832('0x4b')]=function(_0x3eea6a,_0x2cf5d5,_0x1e3f46){var _0x9c75e9={};var _0x3c62e0={};var _0x110020;var _0x471a1d;return db[_0xd832('0x2b')][_0xd832('0x4c')]({'where':{'id':_0x3eea6a['params']['id']}})['then'](handleEntityNotFound(_0x2cf5d5,null))[_0xd832('0x23')](function(_0x3dd84a){if(_0x3dd84a){_0x110020=_0x3dd84a;_0x3c62e0['model']=_[_0xd832('0x31')](db[_0xd832('0x4d')][_0xd832('0x2c')]);_0x3c62e0['query']=_[_0xd832('0x31')](_0x3eea6a[_0xd832('0x30')]);_0x3c62e0[_0xd832('0x32')]=_[_0xd832('0x33')](_0x3c62e0[_0xd832('0x2f')],_0x3c62e0[_0xd832('0x30')]);_0x9c75e9[_0xd832('0x35')]=_['intersection'](_0x3c62e0[_0xd832('0x2f')],qs[_0xd832('0x34')](_0x3eea6a[_0xd832('0x30')]['fields']));_0x9c75e9[_0xd832('0x35')]=_0x9c75e9['attributes'][_0xd832('0x45')]?_0x9c75e9[_0xd832('0x35')]:_0x3c62e0[_0xd832('0x2f')];_0x9c75e9[_0xd832('0x37')]=qs[_0xd832('0x38')](_0x3eea6a[_0xd832('0x30')]['sort']);_0x9c75e9[_0xd832('0x39')]=qs['filters'](_[_0xd832('0x3a')](_0x3eea6a['query'],_0x3c62e0[_0xd832('0x32')]));if(_0x3eea6a[_0xd832('0x30')][_0xd832('0x3b')]){_0x9c75e9[_0xd832('0x39')]=_['merge'](_0x9c75e9[_0xd832('0x39')],{'$or':_[_0xd832('0x2a')](_0x9c75e9[_0xd832('0x35')],function(_0x3db16a){var _0x3a9eb2={};_0x3a9eb2[_0x3db16a]={'$like':'%'+_0x3eea6a[_0xd832('0x30')]['filter']+'%'};return _0x3a9eb2;})});}_0x9c75e9=_['merge']({},_0x9c75e9,_0x3eea6a[_0xd832('0x3e')]);return _0x110020[_0xd832('0x4b')](_0x9c75e9);}})[_0xd832('0x23')](function(_0x39aa6a){if(_0x39aa6a){_0x471a1d=_0x39aa6a['length'];if(!_0x3eea6a[_0xd832('0x30')][_0xd832('0x36')](_0xd832('0x4e'))){_0x9c75e9[_0xd832('0x1d')]=qs[_0xd832('0x1d')](_0x3eea6a[_0xd832('0x30')][_0xd832('0x1d')]);_0x9c75e9[_0xd832('0x1b')]=qs[_0xd832('0x1b')](_0x3eea6a[_0xd832('0x30')][_0xd832('0x1b')]);}return _0x110020['getConfigurations'](_0x9c75e9);}})[_0xd832('0x23')](function(_0x245d4f){if(_0x245d4f){return _0x245d4f?{'count':_0x471a1d,'rows':_0x245d4f}:null;}})[_0xd832('0x23')](respondWithResult(_0x2cf5d5,null))[_0xd832('0x43')](handleError(_0x2cf5d5,null));};exports[_0xd832('0x4f')]=function(_0x28ba7c,_0x27793b,_0x3617e7){if(_0x28ba7c[_0xd832('0x48')]['id']){delete _0x28ba7c[_0xd832('0x48')]['id'];}return db[_0xd832('0x2b')][_0xd832('0x4c')]({'where':{'id':_0x28ba7c[_0xd832('0x4a')]['id']}})[_0xd832('0x23')](handleEntityNotFound(_0x27793b,null))[_0xd832('0x23')](function(_0x16b364){if(_0x16b364){_0x28ba7c[_0xd832('0x48')]['AccountId']=_0x16b364['id'];_0x28ba7c['body'][_0xd832('0x50')]=integrations['getSubjects'](_0x28ba7c[_0xd832('0x48')][_0xd832('0x51')],_0x28ba7c['body']['type']);_0x28ba7c['body'][_0xd832('0x52')]=integrations[_0xd832('0x53')](_0x28ba7c[_0xd832('0x48')][_0xd832('0x51')],_0x28ba7c[_0xd832('0x48')][_0xd832('0x2d')]);return db[_0xd832('0x4d')][_0xd832('0x47')](_0x28ba7c[_0xd832('0x48')],{'include':[{'model':db['ServicenowField'],'as':_0xd832('0x50')},{'model':db[_0xd832('0x54')],'as':_0xd832('0x52')}]});}return null;})[_0xd832('0x23')](respondWithResult(_0x27793b,null))[_0xd832('0x43')](handleError(_0x27793b,null));};exports[_0xd832('0x55')]=function(_0x52b241,_0x103f5c,_0x8bc6bd){var _0x9838c9=[_0xd832('0x56'),_0xd832('0x57'),'knowledge',_0xd832('0x58'),_0xd832('0x59'),_0xd832('0x5a'),_0xd832('0x5b'),'severity','category'];var _0xd0f4e9=[_0xd832('0x5c'),_0xd832('0x56'),_0xd832('0x5d'),_0xd832('0x5e'),_0xd832('0x5f'),_0xd832('0x60'),_0xd832('0x61'),'hold_reason','approval_history',_0xd832('0x62'),_0xd832('0x63'),_0xd832('0x64'),_0xd832('0x65'),_0xd832('0x66'),_0xd832('0x67'),_0xd832('0x68'),_0xd832('0x69'),_0xd832('0x6a'),_0xd832('0x6b'),_0xd832('0x37'),_0xd832('0x6c'),'closed_at',_0xd832('0x6d'),_0xd832('0x6e'),_0xd832('0x6f'),'active',_0xd832('0x70'),_0xd832('0x71'),_0xd832('0x72'),_0xd832('0x73'),'rfc',_0xd832('0x74'),_0xd832('0x75'),_0xd832('0x76'),_0xd832('0x77'),_0xd832('0x78'),'work_end',_0xd832('0x79'),'resolved_at','caller_id',_0xd832('0x7a'),_0xd832('0x58'),'work_notes',_0xd832('0x7b'),_0xd832('0x59'),'correlation_display','delivery_task','work_start',_0xd832('0x7c'),'business_stc',_0xd832('0x7d'),_0xd832('0x7e'),_0xd832('0x7f'),'notify',_0xd832('0x80'),_0xd832('0x81'),_0xd832('0x82'),_0xd832('0x83'),_0xd832('0x84'),_0xd832('0x85'),'contact_type','reopened_by','incident_state',_0xd832('0x86'),'problem_id',_0xd832('0x87'),_0xd832('0x88'),'activity_due',_0xd832('0x89'),_0xd832('0x8a'),_0xd832('0x8b'),_0xd832('0x8c'),_0xd832('0x8d'),_0xd832('0x8e'),_0xd832('0x8f'),_0xd832('0x90'),_0xd832('0x91'),_0xd832('0x92'),_0xd832('0x93'),_0xd832('0x94'),_0xd832('0x95'),_0xd832('0x96'),_0xd832('0x97')];var _0xecb833='';var _0x159cac='';var _0x434de2=[];var _0x1204ec='';var _0xd31d70='';var _0x1c3f4e=[];var _0x59d8ba='';var _0x58acfb='';var _0x236cd3={};var _0x25bbc6='';return db[_0xd832('0x2b')]['findOne']({'where':{'id':_0x52b241[_0xd832('0x4a')]['id']},'attributes':['id','username',_0xd832('0x98'),_0xd832('0x99'),_0xd832('0x9a'),_0xd832('0x9b')]})[_0xd832('0x23')](handleEntityNotFound(_0x103f5c,null))[_0xd832('0x23')](function(_0x4efb6d){if(_0x4efb6d){_0x25bbc6=_0x4efb6d[_0xd832('0x9a')];var _0x158fd5=_0x25bbc6['slice'](-0x1);if(_0x158fd5==='/'){_0x25bbc6=_0x25bbc6[_0xd832('0x9c')](0x0,_0x25bbc6['lastIndexOf'](_0x158fd5));}_0x58acfb=util[_0xd832('0x9d')]('%s/api/now/doc/table/schema/',_0x25bbc6);_0x59d8ba=util[_0xd832('0x9d')](_0xd832('0x9e'),_0x25bbc6);_0x236cd3={'user':_0x4efb6d[_0xd832('0x9f')],'pass':_0x4efb6d[_0xd832('0x98')]};var _0x22613a={'method':_0xd832('0xa0'),'uri':_0x58acfb+_0xd832('0xa1'),'auth':_0x236cd3,'json':!![]};return rp(_0x22613a);}})[_0xd832('0x23')](function(_0x4968c5){if(_0x4968c5['result'][_0xd832('0x45')]>0x0){_0xecb833=_0x4968c5[_0xd832('0xa2')];}console[_0xd832('0xa3')](_0xd832('0xa4'),_0xecb833);_0x1c3f4e=[];_0x159cac=Object[_0xd832('0xa5')]([],_0xecb833);_[_0xd832('0xa6')](_0x159cac,function(_0x2b818c){return!_0x9838c9[_0xd832('0xa7')](_0x2b818c['name']);});_0x159cac[_0xd832('0xa8')](function(_0x59dd9e){var _0x472ee4=createFieldObject(_0x59d8ba,_0x236cd3,_0x59dd9e[_0xd832('0xa9')],_0x59dd9e[_0xd832('0x27')],_0x59dd9e['label'],![]);_0x1c3f4e[_0xd832('0xaa')](_0x472ee4);});return Promise[_0xd832('0xab')](_0x1c3f4e);})[_0xd832('0x23')](function(_0x45d964){_0x434de2=_0x45d964;_0x1204ec=Object[_0xd832('0xa5')]([],_0xecb833);console[_0xd832('0xa3')](_0xd832('0xac'),_0xecb833);_['remove'](_0x1204ec,function(_0x9904ba){return _0xd0f4e9[_0xd832('0xa7')](_0x9904ba['name']);});console['log'](_0xd832('0xad'),_0x1204ec);_0x1c3f4e=[];_0x1204ec[_0xd832('0xa8')](function(_0x5b7786){var _0xee4e9b=createFieldObject(_0x59d8ba,_0x236cd3,_0x5b7786['internalType'],_0x5b7786[_0xd832('0x27')],_0x5b7786[_0xd832('0xae')],!![]);_0x1c3f4e[_0xd832('0xaa')](_0xee4e9b);});return Promise[_0xd832('0xab')](_0x1c3f4e);})[_0xd832('0x23')](function(_0x1622bf){_0xd31d70=_0x1622bf;var _0x4474aa=_0x434de2['concat'](_0xd31d70);return{'count':_0x4474aa[_0xd832('0x45')],'rows':_0x4474aa};})[_0xd832('0x23')](respondWithResult(_0x103f5c,null))[_0xd832('0x43')](function(_0x465b1a){console[_0xd832('0xa3')](_0xd832('0xaf')+_0x465b1a);var _0x30ee2b=_0x52b241[_0xd832('0x30')][_0xd832('0xb0')]?0x1f4:_0x465b1a[_0xd832('0xb1')]||0x1f4;logger[_0xd832('0x26')](_0x465b1a[_0xd832('0xb2')]);delete _0x465b1a[_0xd832('0x27')];if(_0x30ee2b===0x191){_0x30ee2b=0x190;}_0x103f5c['status'](_0x30ee2b)[_0xd832('0x28')](_0x52b241[_0xd832('0x30')]['test']?{'message':_0xd832('0xb3'),'statusCode':_0x465b1a['statusCode']}:_0x465b1a);});};function createFieldObject(_0x5559aa,_0x5e139d,_0x2ee789,_0x495e92,_0x1910ea,_0x377ece){return new Promise(function(_0x1a6240,_0x5b7eb8){var _0x2be504={'id':_0x495e92,'name':_0x1910ea,'custom':_0x377ece};if(_0x2ee789===_0xd832('0xb4')){_0x2be504['options']=[{'name':_0xd832('0xb5'),'value':_0xd832('0xb6')},{'name':_0xd832('0xb7'),'value':_0xd832('0xb8')}];_0x1a6240(_0x2be504);}else{var _0x2e3eef={'method':_0xd832('0xa0'),'uri':_0x5559aa+_0xd832('0xb9')+_0x495e92,'auth':_0x5e139d,'json':!![]};return rp(_0x2e3eef)[_0xd832('0x23')](function(_0x1a08a5){var _0x252042=[];if(_0x1a08a5[_0xd832('0xa2')][_0xd832('0x45')]>0x0){_0x1a08a5[_0xd832('0xa2')]['forEach'](function(_0x2f3b7f){if(_0x2f3b7f[_0xd832('0xba')]===_0xd832('0xb8')){var _0x42114b={'name':_0x2f3b7f['label'],'value':_0x2f3b7f[_0xd832('0xbb')]};_0x252042[_0xd832('0xaa')](_0x42114b);}});}_0x2be504[_0xd832('0x3e')]=_0x252042;if(_0x2be504[_0xd832('0x3e')]['length']>0x0){_0x1a6240(_0x2be504);}else{if(_0x377ece==![]){_0x1a6240();}else{_0x1a6240(_0x2be504);}}});}});} \ No newline at end of file +var _0x2f64=['format','%s/api/now/doc/table/schema/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','TCL:\x20_object','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','send','index','map','ServicenowAccount','rawAttributes','fieldName','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getDescriptions','channel','ServicenowConfiguration','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','watch_list','upon_reject','child_incidents','number','resolved_by','sys_updated_by','opened_by','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','rfc','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','closed_by','follow_up','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','correlation_id','location','username','email','remoteUri','serverUrl','slice','lastIndexOf'];(function(_0xfd7a4f,_0x5f528e){var _0x817904=function(_0x5b51f3){while(--_0x5b51f3){_0xfd7a4f['push'](_0xfd7a4f['shift']());}};_0x817904(++_0x5f528e);}(_0x2f64,0x185));var _0x42f6=function(_0x4b793b,_0x1ee112){_0x4b793b=_0x4b793b-0x0;var _0xcfbd6a=_0x2f64[_0x4b793b];return _0xcfbd6a;};'use strict';var emlformat=require(_0x42f6('0x0'));var rimraf=require(_0x42f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42f6('0x2'));var rp=require(_0x42f6('0x3'));var moment=require('moment');var BPromise=require(_0x42f6('0x4'));var Mustache=require(_0x42f6('0x5'));var util=require(_0x42f6('0x6'));var path=require(_0x42f6('0x7'));var sox=require(_0x42f6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42f6('0x9'));var _=require(_0x42f6('0xa'));var squel=require(_0x42f6('0xb'));var crypto=require(_0x42f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x42f6('0xd'));var toCsv=require(_0x42f6('0xe'));var querystring=require('querystring');var Papa=require(_0x42f6('0xf'));var Redis=require(_0x42f6('0x10'));var authService=require(_0x42f6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42f6('0x12'));var logger=require(_0x42f6('0x13'))(_0x42f6('0x14'));var utils=require(_0x42f6('0x15'));var config=require(_0x42f6('0x16'));var licenseUtil=require(_0x42f6('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x42f6('0x18'));function respondWithStatusCode(_0x541854,_0x54112e){_0x54112e=_0x54112e||0xcc;return function(_0x524ddb){if(_0x524ddb){return _0x541854[_0x42f6('0x19')](_0x54112e);}return _0x541854[_0x42f6('0x1a')](_0x54112e)[_0x42f6('0x1b')]();};}function respondWithResult(_0x51d94c,_0x52406f){_0x52406f=_0x52406f||0xc8;return function(_0xf00b4){if(_0xf00b4){return _0x51d94c['status'](_0x52406f)['json'](_0xf00b4);}};}function respondWithFilteredResult(_0x25260f,_0x107422){return function(_0x1c446c){if(_0x1c446c){var _0x4a6966=typeof _0x107422[_0x42f6('0x1c')]===_0x42f6('0x1d')&&typeof _0x107422[_0x42f6('0x1e')]===_0x42f6('0x1d');var _0x50bfbd=_0x1c446c[_0x42f6('0x1f')];var _0x3e323a=_0x4a6966?0x0:_0x107422['offset'];var _0x4d7fa6=_0x4a6966?_0x1c446c[_0x42f6('0x1f')]:_0x107422[_0x42f6('0x1c')]+_0x107422['limit'];var _0x375c56;if(_0x4d7fa6>=_0x50bfbd){_0x4d7fa6=_0x50bfbd;_0x375c56=0xc8;}else{_0x375c56=0xce;}_0x25260f[_0x42f6('0x1a')](_0x375c56);return _0x25260f[_0x42f6('0x20')](_0x42f6('0x21'),_0x3e323a+'-'+_0x4d7fa6+'/'+_0x50bfbd)[_0x42f6('0x22')](_0x1c446c);}return null;};}function patchUpdates(_0x59735f){return function(_0x5141e3){try{jsonpatch['apply'](_0x5141e3,_0x59735f,!![]);}catch(_0x271bc3){return BPromise[_0x42f6('0x23')](_0x271bc3);}return _0x5141e3[_0x42f6('0x24')]();};}function saveUpdates(_0x3d3fe1,_0x3dcbd5){return function(_0xf06621){if(_0xf06621){return _0xf06621[_0x42f6('0x25')](_0x3d3fe1)[_0x42f6('0x26')](function(_0x3e2be7){return _0x3e2be7;});}return null;};}function removeEntity(_0x594c92,_0x5131bb){return function(_0x21e734){if(_0x21e734){return _0x21e734['destroy']()[_0x42f6('0x26')](function(){_0x594c92[_0x42f6('0x1a')](0xcc)[_0x42f6('0x1b')]();});}};}function handleEntityNotFound(_0x12b2b0,_0xa6de34){return function(_0x295d8e){if(!_0x295d8e){_0x12b2b0['sendStatus'](0x194);}return _0x295d8e;};}function handleError(_0x1ecd41,_0x31d317){_0x31d317=_0x31d317||0x1f4;return function(_0x535b69){logger[_0x42f6('0x27')](_0x535b69[_0x42f6('0x28')]);if(_0x535b69['name']){delete _0x535b69['name'];}_0x1ecd41[_0x42f6('0x1a')](_0x31d317)[_0x42f6('0x29')](_0x535b69);};}exports[_0x42f6('0x2a')]=function(_0x3e5adc,_0x218974){var _0x137442={},_0xc7b24a={},_0xed7145={'count':0x0,'rows':[]};var _0x4d026d=_[_0x42f6('0x2b')](db[_0x42f6('0x2c')][_0x42f6('0x2d')],function(_0x3a4351){return{'name':_0x3a4351[_0x42f6('0x2e')],'type':_0x3a4351['type']['key']};});_0xc7b24a['model']=_[_0x42f6('0x2b')](_0x4d026d,_0x42f6('0x2f'));_0xc7b24a[_0x42f6('0x30')]=_[_0x42f6('0x31')](_0x3e5adc['query']);_0xc7b24a[_0x42f6('0x32')]=_['intersection'](_0xc7b24a['model'],_0xc7b24a[_0x42f6('0x30')]);_0x137442['attributes']=_[_0x42f6('0x33')](_0xc7b24a[_0x42f6('0x34')],qs[_0x42f6('0x35')](_0x3e5adc['query'][_0x42f6('0x35')]));_0x137442[_0x42f6('0x36')]=_0x137442[_0x42f6('0x36')][_0x42f6('0x37')]?_0x137442[_0x42f6('0x36')]:_0xc7b24a['model'];if(!_0x3e5adc['query']['hasOwnProperty'](_0x42f6('0x38'))){_0x137442[_0x42f6('0x1e')]=qs[_0x42f6('0x1e')](_0x3e5adc['query'][_0x42f6('0x1e')]);_0x137442[_0x42f6('0x1c')]=qs[_0x42f6('0x1c')](_0x3e5adc['query'][_0x42f6('0x1c')]);}_0x137442[_0x42f6('0x39')]=qs['sort'](_0x3e5adc[_0x42f6('0x30')][_0x42f6('0x3a')]);_0x137442['where']=qs[_0x42f6('0x32')](_[_0x42f6('0x3b')](_0x3e5adc[_0x42f6('0x30')],_0xc7b24a[_0x42f6('0x32')]),_0x4d026d);if(_0x3e5adc[_0x42f6('0x30')]['filter']){_0x137442['where']=_['merge'](_0x137442[_0x42f6('0x3c')],{'$or':_[_0x42f6('0x2b')](_0x4d026d,function(_0x4ea381){if(_0x4ea381[_0x42f6('0x3d')]!==_0x42f6('0x3e')){var _0x14a583={};_0x14a583[_0x4ea381[_0x42f6('0x2f')]]={'$like':'%'+_0x3e5adc[_0x42f6('0x30')][_0x42f6('0x3f')]+'%'};return _0x14a583;}})});}_0x137442=_[_0x42f6('0x40')]({},_0x137442,_0x3e5adc[_0x42f6('0x41')]);var _0x39c170={'where':_0x137442[_0x42f6('0x3c')]};return db['ServicenowAccount'][_0x42f6('0x1f')](_0x39c170)[_0x42f6('0x26')](function(_0x406e91){_0xed7145[_0x42f6('0x1f')]=_0x406e91;if(_0x3e5adc['query'][_0x42f6('0x42')]){_0x137442['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0x42f6('0x43')](_0x137442);})[_0x42f6('0x26')](function(_0x1192a4){_0xed7145[_0x42f6('0x44')]=_0x1192a4;return _0xed7145;})[_0x42f6('0x26')](respondWithFilteredResult(_0x218974,_0x137442))[_0x42f6('0x45')](handleError(_0x218974,null));};exports[_0x42f6('0x46')]=function(_0x5bb6dd,_0x7fa1c4){var _0x4eaecb={'raw':![],'where':{'id':_0x5bb6dd[_0x42f6('0x47')]['id']}},_0x861647={};_0x861647[_0x42f6('0x34')]=_[_0x42f6('0x31')](db[_0x42f6('0x2c')][_0x42f6('0x2d')]);_0x861647[_0x42f6('0x30')]=_[_0x42f6('0x31')](_0x5bb6dd[_0x42f6('0x30')]);_0x861647[_0x42f6('0x32')]=_[_0x42f6('0x33')](_0x861647[_0x42f6('0x34')],_0x861647[_0x42f6('0x30')]);_0x4eaecb[_0x42f6('0x36')]=_['intersection'](_0x861647[_0x42f6('0x34')],qs[_0x42f6('0x35')](_0x5bb6dd[_0x42f6('0x30')]['fields']));_0x4eaecb[_0x42f6('0x36')]=_0x4eaecb['attributes'][_0x42f6('0x37')]?_0x4eaecb[_0x42f6('0x36')]:_0x861647['model'];if(_0x5bb6dd[_0x42f6('0x30')][_0x42f6('0x42')]){_0x4eaecb['include']=[{'all':!![]}];}_0x4eaecb=_['merge']({},_0x4eaecb,_0x5bb6dd[_0x42f6('0x41')]);return db[_0x42f6('0x2c')][_0x42f6('0x48')](_0x4eaecb)[_0x42f6('0x26')](handleEntityNotFound(_0x7fa1c4,null))[_0x42f6('0x26')](respondWithResult(_0x7fa1c4,null))[_0x42f6('0x45')](handleError(_0x7fa1c4,null));};exports[_0x42f6('0x49')]=function(_0x2fcd3a,_0x51663a){return db[_0x42f6('0x2c')][_0x42f6('0x49')](_0x2fcd3a[_0x42f6('0x4a')],{})[_0x42f6('0x26')](respondWithResult(_0x51663a,0xc9))[_0x42f6('0x45')](handleError(_0x51663a,null));};exports[_0x42f6('0x25')]=function(_0x18409c,_0x1463cf){if(_0x18409c[_0x42f6('0x4a')]['id']){delete _0x18409c[_0x42f6('0x4a')]['id'];}return db[_0x42f6('0x2c')][_0x42f6('0x48')]({'where':{'id':_0x18409c[_0x42f6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1463cf,null))['then'](saveUpdates(_0x18409c[_0x42f6('0x4a')],null))[_0x42f6('0x26')](respondWithResult(_0x1463cf,null))['catch'](handleError(_0x1463cf,null));};exports[_0x42f6('0x4b')]=function(_0x35abd7,_0x26807e){return db[_0x42f6('0x2c')][_0x42f6('0x48')]({'where':{'id':_0x35abd7[_0x42f6('0x47')]['id']}})[_0x42f6('0x26')](handleEntityNotFound(_0x26807e,null))[_0x42f6('0x26')](removeEntity(_0x26807e,null))['catch'](handleError(_0x26807e,null));};exports[_0x42f6('0x4c')]=function(_0x35bb32,_0x4dcd6c,_0x207f6f){var _0x83dbfc={};var _0x34828e={};var _0x4034d8;var _0xb95d46;return db['ServicenowAccount'][_0x42f6('0x4d')]({'where':{'id':_0x35bb32[_0x42f6('0x47')]['id']}})[_0x42f6('0x26')](handleEntityNotFound(_0x4dcd6c,null))[_0x42f6('0x26')](function(_0x120258){if(_0x120258){_0x4034d8=_0x120258;_0x34828e[_0x42f6('0x34')]=_[_0x42f6('0x31')](db['ServicenowConfiguration'][_0x42f6('0x2d')]);_0x34828e[_0x42f6('0x30')]=_['keys'](_0x35bb32[_0x42f6('0x30')]);_0x34828e[_0x42f6('0x32')]=_[_0x42f6('0x33')](_0x34828e[_0x42f6('0x34')],_0x34828e['query']);_0x83dbfc['attributes']=_[_0x42f6('0x33')](_0x34828e[_0x42f6('0x34')],qs[_0x42f6('0x35')](_0x35bb32[_0x42f6('0x30')][_0x42f6('0x35')]));_0x83dbfc['attributes']=_0x83dbfc[_0x42f6('0x36')][_0x42f6('0x37')]?_0x83dbfc[_0x42f6('0x36')]:_0x34828e[_0x42f6('0x34')];_0x83dbfc[_0x42f6('0x39')]=qs[_0x42f6('0x3a')](_0x35bb32[_0x42f6('0x30')]['sort']);_0x83dbfc[_0x42f6('0x3c')]=qs['filters'](_[_0x42f6('0x3b')](_0x35bb32[_0x42f6('0x30')],_0x34828e[_0x42f6('0x32')]));if(_0x35bb32['query'][_0x42f6('0x3f')]){_0x83dbfc[_0x42f6('0x3c')]=_['merge'](_0x83dbfc[_0x42f6('0x3c')],{'$or':_[_0x42f6('0x2b')](_0x83dbfc[_0x42f6('0x36')],function(_0x4948f6){var _0x2308aa={};_0x2308aa[_0x4948f6]={'$like':'%'+_0x35bb32[_0x42f6('0x30')][_0x42f6('0x3f')]+'%'};return _0x2308aa;})});}_0x83dbfc=_[_0x42f6('0x40')]({},_0x83dbfc,_0x35bb32['options']);return _0x4034d8[_0x42f6('0x4c')](_0x83dbfc);}})[_0x42f6('0x26')](function(_0x13da26){if(_0x13da26){_0xb95d46=_0x13da26[_0x42f6('0x37')];if(!_0x35bb32[_0x42f6('0x30')]['hasOwnProperty']('nolimit')){_0x83dbfc[_0x42f6('0x1e')]=qs[_0x42f6('0x1e')](_0x35bb32[_0x42f6('0x30')][_0x42f6('0x1e')]);_0x83dbfc[_0x42f6('0x1c')]=qs[_0x42f6('0x1c')](_0x35bb32[_0x42f6('0x30')]['offset']);}return _0x4034d8[_0x42f6('0x4c')](_0x83dbfc);}})[_0x42f6('0x26')](function(_0x451319){if(_0x451319){return _0x451319?{'count':_0xb95d46,'rows':_0x451319}:null;}})[_0x42f6('0x26')](respondWithResult(_0x4dcd6c,null))[_0x42f6('0x45')](handleError(_0x4dcd6c,null));};exports[_0x42f6('0x4e')]=function(_0x36c7a0,_0x336225,_0x22602e){if(_0x36c7a0[_0x42f6('0x4a')]['id']){delete _0x36c7a0[_0x42f6('0x4a')]['id'];}return db[_0x42f6('0x2c')][_0x42f6('0x4d')]({'where':{'id':_0x36c7a0[_0x42f6('0x47')]['id']}})[_0x42f6('0x26')](handleEntityNotFound(_0x336225,null))[_0x42f6('0x26')](function(_0x114f35){if(_0x114f35){_0x36c7a0[_0x42f6('0x4a')][_0x42f6('0x4f')]=_0x114f35['id'];_0x36c7a0['body'][_0x42f6('0x50')]=integrations['getSubjects'](_0x36c7a0[_0x42f6('0x4a')]['channel'],_0x36c7a0[_0x42f6('0x4a')][_0x42f6('0x3d')]);_0x36c7a0['body']['Descriptions']=integrations[_0x42f6('0x51')](_0x36c7a0[_0x42f6('0x4a')][_0x42f6('0x52')],_0x36c7a0[_0x42f6('0x4a')][_0x42f6('0x3d')]);return db[_0x42f6('0x53')]['create'](_0x36c7a0[_0x42f6('0x4a')],{'include':[{'model':db[_0x42f6('0x54')],'as':_0x42f6('0x50')},{'model':db['ServicenowField'],'as':_0x42f6('0x55')}]});}return null;})[_0x42f6('0x26')](respondWithResult(_0x336225,null))[_0x42f6('0x45')](handleError(_0x336225,null));};exports[_0x42f6('0x56')]=function(_0x5a4674,_0x1d759d,_0x3ab620){var _0x19fb75=[_0x42f6('0x57'),_0x42f6('0x58'),_0x42f6('0x59'),_0x42f6('0x5a'),_0x42f6('0x5b'),_0x42f6('0x5c'),_0x42f6('0x5d'),_0x42f6('0x5e'),_0x42f6('0x5f')];var _0x40cfad=[_0x42f6('0x60'),'made_sla','caused_by',_0x42f6('0x61'),_0x42f6('0x62'),'sys_updated_on',_0x42f6('0x63'),'hold_reason','approval_history',_0x42f6('0x64'),_0x42f6('0x65'),_0x42f6('0x66'),_0x42f6('0x67'),'user_input','sys_created_on',_0x42f6('0x68'),_0x42f6('0x69'),_0x42f6('0x6a'),_0x42f6('0x59'),_0x42f6('0x39'),_0x42f6('0x6b'),_0x42f6('0x6c'),_0x42f6('0x6d'),_0x42f6('0x6e'),_0x42f6('0x6f'),_0x42f6('0x70'),_0x42f6('0x71'),_0x42f6('0x72'),'priority','sys_domain_path',_0x42f6('0x73'),'time_worked',_0x42f6('0x74'),_0x42f6('0x75'),_0x42f6('0x76'),_0x42f6('0x77'),_0x42f6('0x78'),_0x42f6('0x79'),_0x42f6('0x7a'),_0x42f6('0x7b'),_0x42f6('0x7c'),'subcategory',_0x42f6('0x7d'),'short_description',_0x42f6('0x5b'),_0x42f6('0x7e'),_0x42f6('0x7f'),_0x42f6('0x80'),'assignment_group',_0x42f6('0x81'),_0x42f6('0x82'),_0x42f6('0x83'),_0x42f6('0x84'),'notify','sys_class_name','close_notes',_0x42f6('0x85'),_0x42f6('0x86'),'parent_incident','sys_id',_0x42f6('0x87'),_0x42f6('0x88'),_0x42f6('0x5d'),_0x42f6('0x89'),'problem_id',_0x42f6('0x8a'),_0x42f6('0x8b'),_0x42f6('0x8c'),_0x42f6('0x8d'),_0x42f6('0x5e'),_0x42f6('0x8e'),'sla_due','approval',_0x42f6('0x8f'),_0x42f6('0x90'),_0x42f6('0x91'),'reopen_count','sys_tags','escalation','upon_approval',_0x42f6('0x92'),_0x42f6('0x93'),_0x42f6('0x5f')];var _0x2511cd='';var _0x169bc3='';var _0xdc992a=[];var _0x282d59='';var _0x578424='';var _0x9b5e66=[];var _0x38c33c='';var _0x5467ea='';var _0x5b9017={};var _0x1efef0='';return db[_0x42f6('0x2c')]['findOne']({'where':{'id':_0x5a4674[_0x42f6('0x47')]['id']},'attributes':['id',_0x42f6('0x94'),'password',_0x42f6('0x95'),_0x42f6('0x96'),_0x42f6('0x97')]})[_0x42f6('0x26')](handleEntityNotFound(_0x1d759d,null))[_0x42f6('0x26')](function(_0x1aa3fb){if(_0x1aa3fb){_0x1efef0=_0x1aa3fb[_0x42f6('0x96')];var _0x48d2cf=_0x1efef0[_0x42f6('0x98')](-0x1);if(_0x48d2cf==='/'){_0x1efef0=_0x1efef0['substring'](0x0,_0x1efef0[_0x42f6('0x99')](_0x48d2cf));}_0x5467ea=util[_0x42f6('0x9a')](_0x42f6('0x9b'),_0x1efef0);_0x38c33c=util[_0x42f6('0x9a')]('%s/api/now/table/',_0x1efef0);_0x5b9017={'user':_0x1aa3fb['username'],'pass':_0x1aa3fb[_0x42f6('0x9c')]};var _0x45e02b={'method':_0x42f6('0x9d'),'uri':_0x5467ea+_0x42f6('0x9e'),'auth':_0x5b9017,'json':!![]};return rp(_0x45e02b);}})['then'](function(_0x118619){if(_0x118619[_0x42f6('0x9f')]['length']>0x0){_0x2511cd=_0x118619[_0x42f6('0x9f')];}console[_0x42f6('0xa0')](_0x42f6('0xa1'),_0x2511cd);_0x9b5e66=[];_0x169bc3=Object[_0x42f6('0xa2')]([],_0x2511cd);_[_0x42f6('0xa3')](_0x169bc3,function(_0x40fd99){return!_0x19fb75[_0x42f6('0xa4')](_0x40fd99[_0x42f6('0x2f')]);});_0x169bc3[_0x42f6('0xa5')](function(_0x2fa049){var _0x344f13=createFieldObject(_0x38c33c,_0x5b9017,_0x2fa049['internalType'],_0x2fa049[_0x42f6('0x2f')],_0x2fa049[_0x42f6('0xa6')],![]);_0x9b5e66[_0x42f6('0xa7')](_0x344f13);});return Promise[_0x42f6('0xa8')](_0x9b5e66);})[_0x42f6('0x26')](function(_0xff32){_0xdc992a=_0xff32;_0x282d59=Object[_0x42f6('0xa2')]([],_0x2511cd);console['log'](_0x42f6('0xa9'),_0x2511cd);_[_0x42f6('0xa3')](_0x282d59,function(_0x118def){return _0x40cfad['includes'](_0x118def[_0x42f6('0x2f')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x282d59);_0x9b5e66=[];_0x282d59[_0x42f6('0xa5')](function(_0x53ed6e){var _0x528849=createFieldObject(_0x38c33c,_0x5b9017,_0x53ed6e['internalType'],_0x53ed6e[_0x42f6('0x2f')],_0x53ed6e[_0x42f6('0xa6')],!![]);_0x9b5e66['push'](_0x528849);});return Promise[_0x42f6('0xa8')](_0x9b5e66);})[_0x42f6('0x26')](function(_0x1c656d){_0x578424=_0x1c656d;var _0xbfd455=_0xdc992a['concat'](_0x578424);return{'count':_0xbfd455[_0x42f6('0x37')],'rows':_0xbfd455};})[_0x42f6('0x26')](respondWithResult(_0x1d759d,null))['catch'](function(_0x560c9c){console[_0x42f6('0xa0')](_0x42f6('0xaa')+_0x560c9c);var _0x4eeadb=_0x5a4674[_0x42f6('0x30')][_0x42f6('0xab')]?0x1f4:_0x560c9c[_0x42f6('0xac')]||0x1f4;logger[_0x42f6('0x27')](_0x560c9c[_0x42f6('0x28')]);delete _0x560c9c[_0x42f6('0x2f')];if(_0x4eeadb===0x191){_0x4eeadb=0x190;}_0x1d759d[_0x42f6('0x1a')](_0x4eeadb)['send'](_0x5a4674[_0x42f6('0x30')][_0x42f6('0xab')]?{'message':_0x42f6('0xad'),'statusCode':_0x560c9c[_0x42f6('0xac')]}:_0x560c9c);});};function createFieldObject(_0x148a0e,_0x5ddf0f,_0x2cff08,_0xef1890,_0x49c5e3,_0x2fe2f0){return new Promise(function(_0x23f84a,_0x157972){var _0x295798={'id':_0xef1890,'name':_0x49c5e3,'custom':_0x2fe2f0};if(_0x2cff08===_0x42f6('0xae')){_0x295798[_0x42f6('0x41')]=[{'name':_0x42f6('0xaf'),'value':_0x42f6('0xb0')},{'name':_0x42f6('0xb1'),'value':_0x42f6('0xb2')}];_0x23f84a(_0x295798);}else{var _0x3762f0={'method':_0x42f6('0x9d'),'uri':_0x148a0e+_0x42f6('0xb3')+_0xef1890,'auth':_0x5ddf0f,'json':!![]};return rp(_0x3762f0)[_0x42f6('0x26')](function(_0x328ddb){var _0x56375c=[];if(_0x328ddb[_0x42f6('0x9f')][_0x42f6('0x37')]>0x0){_0x328ddb[_0x42f6('0x9f')][_0x42f6('0xa5')](function(_0x4512f6){if(_0x4512f6[_0x42f6('0xb4')]==='false'){var _0x456a06={'name':_0x4512f6[_0x42f6('0xa6')],'value':_0x4512f6['value']};_0x56375c[_0x42f6('0xa7')](_0x456a06);}});}_0x295798[_0x42f6('0x41')]=_0x56375c;if(_0x295798[_0x42f6('0x41')]['length']>0x0){_0x23f84a(_0x295798);}else{if(_0x2fe2f0==![]){_0x23f84a();}else{_0x23f84a(_0x295798);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index b7b9219..df86907 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 _0x187d=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes'];(function(_0x57d4c4,_0x1eb1c7){var _0x551561=function(_0x5aa58d){while(--_0x5aa58d){_0x57d4c4['push'](_0x57d4c4['shift']());}};_0x551561(++_0x1eb1c7);}(_0x187d,0x93));var _0xd187=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x187d[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return _0x58ee7[_0xd187('0xa')](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x5e99f8,_0x3da771){var _0x56f637=function(_0x3be8b9){while(--_0x3be8b9){_0x5e99f8['push'](_0x5e99f8['shift']());}};_0x56f637(++_0x3da771);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x42bc0a,_0x2d8a63){_0x42bc0a=_0x42bc0a-0x0;var _0x2e3144=_0x9c5a[_0x42bc0a];return _0x2e3144;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xa9c5('0x8'));module['exports']=function(_0x394d84,_0x3df556){return _0x394d84['define']('ServicenowAccount',attributes,{'tableName':_0xa9c5('0x9'),'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 9d7038e..471a527 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 _0xcc82=['options','raw','where','limit','include','map','attributes','model','then','find','ShowServicenowAccount','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetServicenowAccount','ServicenowAccount','findAll'];(function(_0x5a0950,_0x38e796){var _0x52b631=function(_0x1cfcab){while(--_0x1cfcab){_0x5a0950['push'](_0x5a0950['shift']());}};_0x52b631(++_0x38e796);}(_0xcc82,0x79));var _0x2cc8=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xcc82[_0x1f71d8];return _0x10b045;};'use strict';var _=require(_0x2cc8('0x0'));var util=require(_0x2cc8('0x1'));var moment=require(_0x2cc8('0x2'));var BPromise=require(_0x2cc8('0x3'));var rs=require(_0x2cc8('0x4'));var fs=require('fs');var Redis=require(_0x2cc8('0x5'));var db=require(_0x2cc8('0x6'))['db'];var utils=require(_0x2cc8('0x7'));var logger=require(_0x2cc8('0x8'))('rpc');var config=require(_0x2cc8('0x9'));var jayson=require(_0x2cc8('0xa'));var client=jayson[_0x2cc8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb4bbc4,_0x1a4b1f,_0x56a58e){return new BPromise(function(_0x1fbe81,_0x3d61a0){return client['request'](_0xb4bbc4,_0x56a58e)['then'](function(_0x1dd841){logger[_0x2cc8('0xc')](_0x2cc8('0xd'),_0x1a4b1f,'request\x20sent');logger[_0x2cc8('0xe')](_0x2cc8('0xf'),_0x1a4b1f,_0x2cc8('0x10'),JSON['stringify'](_0x1dd841));if(_0x1dd841[_0x2cc8('0x11')]){if(_0x1dd841['error'][_0x2cc8('0x12')]===0x1f4){logger[_0x2cc8('0x11')](_0x2cc8('0xd'),_0x1a4b1f,_0x1dd841['error']['message']);return _0x3d61a0(_0x1dd841['error'][_0x2cc8('0x13')]);}logger[_0x2cc8('0x11')](_0x2cc8('0xd'),_0x1a4b1f,_0x1dd841[_0x2cc8('0x11')][_0x2cc8('0x13')]);return _0x1fbe81(_0x1dd841[_0x2cc8('0x11')][_0x2cc8('0x13')]);}else{logger[_0x2cc8('0xc')](_0x2cc8('0xd'),_0x1a4b1f,_0x2cc8('0x10'));_0x1fbe81(_0x1dd841['result'][_0x2cc8('0x13')]);}})['catch'](function(_0x30deec){logger[_0x2cc8('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1a4b1f,_0x30deec);_0x3d61a0(_0x30deec);});});}exports[_0x2cc8('0x14')]=function(_0x1637bf){var _0x14004a=this;return new Promise(function(_0x51090c,_0x44320b){return db[_0x2cc8('0x15')][_0x2cc8('0x16')]({'raw':_0x1637bf[_0x2cc8('0x17')]?_0x1637bf[_0x2cc8('0x17')][_0x2cc8('0x18')]===undefined?!![]:![]:!![],'where':_0x1637bf['options']?_0x1637bf[_0x2cc8('0x17')][_0x2cc8('0x19')]||null:null,'attributes':_0x1637bf[_0x2cc8('0x17')]?_0x1637bf[_0x2cc8('0x17')]['attributes']||null:null,'limit':_0x1637bf['options']?_0x1637bf[_0x2cc8('0x17')][_0x2cc8('0x1a')]||null:null,'include':_0x1637bf[_0x2cc8('0x17')]?_0x1637bf[_0x2cc8('0x17')][_0x2cc8('0x1b')]?_[_0x2cc8('0x1c')](_0x1637bf['options'][_0x2cc8('0x1b')],function(_0x2b7b18){return{'model':db[_0x2b7b18['model']],'as':_0x2b7b18['as'],'attributes':_0x2b7b18[_0x2cc8('0x1d')],'include':_0x2b7b18[_0x2cc8('0x1b')]?_[_0x2cc8('0x1c')](_0x2b7b18[_0x2cc8('0x1b')],function(_0x2f0d92){return{'model':db[_0x2f0d92[_0x2cc8('0x1e')]],'as':_0x2f0d92['as'],'attributes':_0x2f0d92[_0x2cc8('0x1d')],'include':_0x2f0d92['include']?_['map'](_0x2f0d92[_0x2cc8('0x1b')],function(_0x6474b9){return{'model':db[_0x6474b9[_0x2cc8('0x1e')]],'as':_0x6474b9['as'],'attributes':_0x6474b9[_0x2cc8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2cc8('0x1f')](function(_0x46b323){logger[_0x2cc8('0xc')](_0x2cc8('0x14'),_0x1637bf);logger[_0x2cc8('0xe')](_0x2cc8('0x14'),_0x1637bf,JSON['stringify'](_0x46b323));_0x51090c(_0x46b323);})['catch'](function(_0x32c170){logger[_0x2cc8('0x11')](_0x2cc8('0x14'),_0x32c170[_0x2cc8('0x13')],_0x1637bf);_0x44320b(_0x14004a[_0x2cc8('0x11')](0x1f4,_0x32c170[_0x2cc8('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x210b3e){var _0x44e6e6=this;return new Promise(function(_0x4b4b10,_0x53ef59){return db[_0x2cc8('0x15')][_0x2cc8('0x20')]({'raw':_0x210b3e[_0x2cc8('0x17')]?_0x210b3e[_0x2cc8('0x17')][_0x2cc8('0x18')]===undefined?!![]:![]:!![],'where':_0x210b3e[_0x2cc8('0x17')]?_0x210b3e[_0x2cc8('0x17')][_0x2cc8('0x19')]||null:null,'attributes':_0x210b3e['options']?_0x210b3e[_0x2cc8('0x17')][_0x2cc8('0x1d')]||null:null,'include':_0x210b3e['options']?_0x210b3e['options']['include']?_['map'](_0x210b3e['options'][_0x2cc8('0x1b')],function(_0x3dcd39){return{'model':db[_0x3dcd39[_0x2cc8('0x1e')]],'as':_0x3dcd39['as'],'attributes':_0x3dcd39[_0x2cc8('0x1d')],'include':_0x3dcd39[_0x2cc8('0x1b')]?_[_0x2cc8('0x1c')](_0x3dcd39[_0x2cc8('0x1b')],function(_0x5d1a54){return{'model':db[_0x5d1a54[_0x2cc8('0x1e')]],'as':_0x5d1a54['as'],'attributes':_0x5d1a54[_0x2cc8('0x1d')],'include':_0x5d1a54[_0x2cc8('0x1b')]?_[_0x2cc8('0x1c')](_0x5d1a54['include'],function(_0x58ba4e){return{'model':db[_0x58ba4e[_0x2cc8('0x1e')]],'as':_0x58ba4e['as'],'attributes':_0x58ba4e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3333df){logger[_0x2cc8('0xc')](_0x2cc8('0x21'),_0x210b3e);logger[_0x2cc8('0xe')]('ShowServicenowAccount',_0x210b3e,JSON[_0x2cc8('0x22')](_0x3333df));_0x4b4b10(_0x3333df);})[_0x2cc8('0x23')](function(_0x521a63){logger[_0x2cc8('0x11')](_0x2cc8('0x21'),_0x521a63['message'],_0x210b3e);_0x53ef59(_0x44e6e6['error'](0x1f4,_0x521a63[_0x2cc8('0x13')]));});});}; \ No newline at end of file +var _0x71d4=['ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','raw','options','where','attributes','limit','map','model','include','stringify','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','then','ServicenowAccount,\x20%s,\x20%s','debug'];(function(_0xddc336,_0x216777){var _0x25e722=function(_0x3f7991){while(--_0x3f7991){_0xddc336['push'](_0xddc336['shift']());}};_0x25e722(++_0x216777);}(_0x71d4,0x1e3));var _0x471d=function(_0x25516d,_0x9fcf7f){_0x25516d=_0x25516d-0x0;var _0x59441a=_0x71d4[_0x25516d];return _0x59441a;};'use strict';var _=require(_0x471d('0x0'));var util=require(_0x471d('0x1'));var moment=require(_0x471d('0x2'));var BPromise=require(_0x471d('0x3'));var rs=require(_0x471d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x471d('0x5'));var logger=require('../../config/logger')(_0x471d('0x6'));var config=require('../../config/environment');var jayson=require(_0x471d('0x7'));var client=jayson['client'][_0x471d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e7095,_0x455a35,_0x537a26){return new BPromise(function(_0xf33963,_0xa15500){return client['request'](_0x5e7095,_0x537a26)[_0x471d('0x9')](function(_0x6779e8){logger['info'](_0x471d('0xa'),_0x455a35,'request\x20sent');logger[_0x471d('0xb')](_0x471d('0xc'),_0x455a35,_0x471d('0xd'),JSON['stringify'](_0x6779e8));if(_0x6779e8['error']){if(_0x6779e8['error'][_0x471d('0xe')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x455a35,_0x6779e8['error']['message']);return _0xa15500(_0x6779e8['error']['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x455a35,_0x6779e8[_0x471d('0xf')][_0x471d('0x10')]);return _0xf33963(_0x6779e8['error'][_0x471d('0x10')]);}else{logger[_0x471d('0x11')](_0x471d('0xa'),_0x455a35,_0x471d('0xd'));_0xf33963(_0x6779e8[_0x471d('0x12')][_0x471d('0x10')]);}})[_0x471d('0x13')](function(_0x3f6757){logger[_0x471d('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x455a35,_0x3f6757);_0xa15500(_0x3f6757);});});}exports[_0x471d('0x14')]=function(_0xfcc9b5){var _0x176a9a=this;return new Promise(function(_0x456247,_0x27c834){return db[_0x471d('0x15')][_0x471d('0x16')]({'raw':_0xfcc9b5['options']?_0xfcc9b5['options'][_0x471d('0x17')]===undefined?!![]:![]:!![],'where':_0xfcc9b5[_0x471d('0x18')]?_0xfcc9b5[_0x471d('0x18')][_0x471d('0x19')]||null:null,'attributes':_0xfcc9b5[_0x471d('0x18')]?_0xfcc9b5['options'][_0x471d('0x1a')]||null:null,'limit':_0xfcc9b5[_0x471d('0x18')]?_0xfcc9b5['options'][_0x471d('0x1b')]||null:null,'include':_0xfcc9b5[_0x471d('0x18')]?_0xfcc9b5['options']['include']?_[_0x471d('0x1c')](_0xfcc9b5[_0x471d('0x18')]['include'],function(_0x3dc814){return{'model':db[_0x3dc814['model']],'as':_0x3dc814['as'],'attributes':_0x3dc814[_0x471d('0x1a')],'include':_0x3dc814['include']?_[_0x471d('0x1c')](_0x3dc814['include'],function(_0x4d4d2d){return{'model':db[_0x4d4d2d[_0x471d('0x1d')]],'as':_0x4d4d2d['as'],'attributes':_0x4d4d2d[_0x471d('0x1a')],'include':_0x4d4d2d[_0x471d('0x1e')]?_[_0x471d('0x1c')](_0x4d4d2d[_0x471d('0x1e')],function(_0x4713e7){return{'model':db[_0x4713e7[_0x471d('0x1d')]],'as':_0x4713e7['as'],'attributes':_0x4713e7[_0x471d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x471d('0x9')](function(_0x18ede1){logger[_0x471d('0x11')](_0x471d('0x14'),_0xfcc9b5);logger['debug']('GetServicenowAccount',_0xfcc9b5,JSON[_0x471d('0x1f')](_0x18ede1));_0x456247(_0x18ede1);})[_0x471d('0x13')](function(_0x231c1a){logger[_0x471d('0xf')]('GetServicenowAccount',_0x231c1a['message'],_0xfcc9b5);_0x27c834(_0x176a9a[_0x471d('0xf')](0x1f4,_0x231c1a[_0x471d('0x10')]));});});};exports[_0x471d('0x20')]=function(_0x1639bb){var _0x233dfc=this;return new Promise(function(_0x33ca0e,_0x41e633){return db[_0x471d('0x15')]['find']({'raw':_0x1639bb[_0x471d('0x18')]?_0x1639bb['options']['raw']===undefined?!![]:![]:!![],'where':_0x1639bb[_0x471d('0x18')]?_0x1639bb[_0x471d('0x18')]['where']||null:null,'attributes':_0x1639bb[_0x471d('0x18')]?_0x1639bb[_0x471d('0x18')][_0x471d('0x1a')]||null:null,'include':_0x1639bb[_0x471d('0x18')]?_0x1639bb[_0x471d('0x18')][_0x471d('0x1e')]?_[_0x471d('0x1c')](_0x1639bb['options']['include'],function(_0xa9447){return{'model':db[_0xa9447[_0x471d('0x1d')]],'as':_0xa9447['as'],'attributes':_0xa9447[_0x471d('0x1a')],'include':_0xa9447['include']?_[_0x471d('0x1c')](_0xa9447['include'],function(_0x11776a){return{'model':db[_0x11776a[_0x471d('0x1d')]],'as':_0x11776a['as'],'attributes':_0x11776a['attributes'],'include':_0x11776a[_0x471d('0x1e')]?_[_0x471d('0x1c')](_0x11776a[_0x471d('0x1e')],function(_0x97f224){return{'model':db[_0x97f224[_0x471d('0x1d')]],'as':_0x97f224['as'],'attributes':_0x97f224[_0x471d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x471d('0x9')](function(_0x39af1a){logger[_0x471d('0x11')](_0x471d('0x20'),_0x1639bb);logger[_0x471d('0xb')](_0x471d('0x20'),_0x1639bb,JSON[_0x471d('0x1f')](_0x39af1a));_0x33ca0e(_0x39af1a);})['catch'](function(_0x596324){logger[_0x471d('0xf')](_0x471d('0x20'),_0x596324[_0x471d('0x10')],_0x1639bb);_0x41e633(_0x233dfc[_0x471d('0xf')](0x1f4,_0x596324[_0x471d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ead6697..835eaea 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 _0x262f=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports'];(function(_0x500a49,_0x5b319a){var _0x559da4=function(_0x53106b){while(--_0x53106b){_0x500a49['push'](_0x500a49['shift']());}};_0x559da4(++_0x5b319a);}(_0x262f,0x145));var _0xf262=function(_0x333767,_0x220733){_0x333767=_0x333767-0x0;var _0x42a755=_0x262f[_0x333767];return _0x42a755;};'use strict';var multer=require('multer');var util=require(_0xf262('0x0'));var path=require(_0xf262('0x1'));var timeout=require(_0xf262('0x2'));var express=require(_0xf262('0x3'));var router=express[_0xf262('0x4')]();var fs_extra=require(_0xf262('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf262('0x6'));var config=require(_0xf262('0x7'));var controller=require(_0xf262('0x8'));router[_0xf262('0x9')]('/',auth['isAuthenticated'](),controller[_0xf262('0xa')]);router['get'](_0xf262('0xb'),auth[_0xf262('0xc')](),controller['show']);router[_0xf262('0x9')](_0xf262('0xd'),auth[_0xf262('0xc')](),controller[_0xf262('0xe')]);router[_0xf262('0x9')](_0xf262('0xf'),auth[_0xf262('0xc')](),controller['getSubjects']);router['get'](_0xf262('0x10'),auth['isAuthenticated'](),controller[_0xf262('0x11')]);router[_0xf262('0x12')]('/',auth['isAuthenticated'](),controller[_0xf262('0x13')]);router[_0xf262('0x14')](_0xf262('0xb'),auth[_0xf262('0xc')](),controller[_0xf262('0x15')]);router[_0xf262('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf262('0x17')]);module[_0xf262('0x18')]=router; \ No newline at end of file +var _0x59c3=['show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4f7927,_0x35f6fa){var _0x56b150=function(_0x2768ea){while(--_0x2768ea){_0x4f7927['push'](_0x4f7927['shift']());}};_0x56b150(++_0x35f6fa);}(_0x59c3,0xfd));var _0x359c=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x59c3[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x359c('0x0'));var util=require(_0x359c('0x1'));var path=require(_0x359c('0x2'));var timeout=require(_0x359c('0x3'));var express=require(_0x359c('0x4'));var router=express[_0x359c('0x5')]();var fs_extra=require(_0x359c('0x6'));var auth=require(_0x359c('0x7'));var interaction=require(_0x359c('0x8'));var config=require(_0x359c('0x9'));var controller=require('./intServicenowConfiguration.controller');router[_0x359c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x359c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x359c('0xb')]);router[_0x359c('0xa')](_0x359c('0xc'),auth[_0x359c('0xd')](),controller[_0x359c('0xe')]);router['get'](_0x359c('0xf'),auth[_0x359c('0xd')](),controller[_0x359c('0x10')]);router['get'](_0x359c('0x11'),auth[_0x359c('0xd')](),controller['getDescriptions']);router[_0x359c('0x12')]('/',auth['isAuthenticated'](),controller[_0x359c('0x13')]);router[_0x359c('0x14')](_0x359c('0x15'),auth['isAuthenticated'](),controller[_0x359c('0x16')]);router['delete'](_0x359c('0x15'),auth[_0x359c('0xd')](),controller['destroy']);module[_0x359c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index be5d816..113b06f 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 _0x79a0=['STRING','sequelize'];(function(_0x56c860,_0x2964ce){var _0x442c52=function(_0x18847c){while(--_0x18847c){_0x56c860['push'](_0x56c860['shift']());}};_0x442c52(++_0x2964ce);}(_0x79a0,0xdf));var _0x079a=function(_0x23a410,_0x4c32a7){_0x23a410=_0x23a410-0x0;var _0x113e46=_0x79a0[_0x23a410];return _0x113e46;};'use strict';var Sequelize=require(_0x079a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x079a('0x1')]}}; \ No newline at end of file +var _0x0c42=['sequelize','exports'];(function(_0x5e0102,_0x37f37c){var _0x5a6468=function(_0x269fd3){while(--_0x269fd3){_0x5e0102['push'](_0x5e0102['shift']());}};_0x5a6468(++_0x37f37c);}(_0x0c42,0x8e));var _0x20c4=function(_0x49bc96,_0x5f2d3c){_0x49bc96=_0x49bc96-0x0;var _0x5b1427=_0x0c42[_0x49bc96];return _0x5b1427;};'use strict';var Sequelize=require(_0x20c4('0x0'));module[_0x20c4('0x1')]={'name':{'type':Sequelize['STRING']},'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 54fd489..efc72f7 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 _0x1ec6=['rows','catch','show','params','keys','length','options','find','create','body','update','getFields','findOne','ServicenowField','pick','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','end','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x5295f4,_0xf2024d){var _0x236fc1=function(_0x4ed2a0){while(--_0x4ed2a0){_0x5295f4['push'](_0x5295f4['shift']());}};_0x236fc1(++_0xf2024d);}(_0x1ec6,0x64));var _0x61ec=function(_0x2b6ec7,_0x514fd5){_0x2b6ec7=_0x2b6ec7-0x0;var _0x41063d=_0x1ec6[_0x2b6ec7];return _0x41063d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x61ec('0x0'));var zipdir=require(_0x61ec('0x1'));var jsonpatch=require(_0x61ec('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x61ec('0x3'));var Mustache=require(_0x61ec('0x4'));var util=require(_0x61ec('0x5'));var path=require(_0x61ec('0x6'));var sox=require(_0x61ec('0x7'));var csv=require(_0x61ec('0x8'));var ejs=require(_0x61ec('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x61ec('0xa'));var squel=require(_0x61ec('0xb'));var crypto=require(_0x61ec('0xc'));var jsforce=require(_0x61ec('0xd'));var deskjs=require(_0x61ec('0xe'));var toCsv=require(_0x61ec('0x8'));var querystring=require(_0x61ec('0xf'));var Papa=require(_0x61ec('0x10'));var Redis=require(_0x61ec('0x11'));var authService=require(_0x61ec('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x61ec('0x13'));var hardwareService=require(_0x61ec('0x14'));var logger=require(_0x61ec('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x61ec('0x16'));var licenseUtil=require(_0x61ec('0x17'));var db=require(_0x61ec('0x18'))['db'];function respondWithStatusCode(_0xf21ed3,_0xdbad9d){_0xdbad9d=_0xdbad9d||0xcc;return function(_0xcb31d1){if(_0xcb31d1){return _0xf21ed3[_0x61ec('0x19')](_0xdbad9d);}return _0xf21ed3['status'](_0xdbad9d)['end']();};}function respondWithResult(_0xb8208c,_0x1a3363){_0x1a3363=_0x1a3363||0xc8;return function(_0x396675){if(_0x396675){return _0xb8208c[_0x61ec('0x1a')](_0x1a3363)['json'](_0x396675);}};}function respondWithFilteredResult(_0x511da7,_0x3a0c09){return function(_0x31cd3a){if(_0x31cd3a){var _0x536ca9=typeof _0x3a0c09[_0x61ec('0x1b')]===_0x61ec('0x1c')&&typeof _0x3a0c09[_0x61ec('0x1d')]===_0x61ec('0x1c');var _0x55411b=_0x31cd3a['count'];var _0x19a120=_0x536ca9?0x0:_0x3a0c09['offset'];var _0x372f2d=_0x536ca9?_0x31cd3a[_0x61ec('0x1e')]:_0x3a0c09[_0x61ec('0x1b')]+_0x3a0c09[_0x61ec('0x1d')];var _0x3b4bf4;if(_0x372f2d>=_0x55411b){_0x372f2d=_0x55411b;_0x3b4bf4=0xc8;}else{_0x3b4bf4=0xce;}_0x511da7['status'](_0x3b4bf4);return _0x511da7[_0x61ec('0x1f')](_0x61ec('0x20'),_0x19a120+'-'+_0x372f2d+'/'+_0x55411b)[_0x61ec('0x21')](_0x31cd3a);}return null;};}function patchUpdates(_0x30bac2){return function(_0x4c3881){try{jsonpatch['apply'](_0x4c3881,_0x30bac2,!![]);}catch(_0x563d94){return BPromise[_0x61ec('0x22')](_0x563d94);}return _0x4c3881[_0x61ec('0x23')]();};}function saveUpdates(_0x3dfd51,_0x2f2c1c){return function(_0x40b566){if(_0x40b566){return _0x40b566['update'](_0x3dfd51)['then'](function(_0x5df828){return _0x5df828;});}return null;};}function removeEntity(_0x67da7a,_0x4b1836){return function(_0x58914a){if(_0x58914a){return _0x58914a[_0x61ec('0x24')]()[_0x61ec('0x25')](function(){_0x67da7a[_0x61ec('0x1a')](0xcc)[_0x61ec('0x26')]();});}};}function handleEntityNotFound(_0x26a488,_0x53b1d3){return function(_0x945845){if(!_0x945845){_0x26a488['sendStatus'](0x194);}return _0x945845;};}function handleError(_0x58b12d,_0x5511a2){_0x5511a2=_0x5511a2||0x1f4;return function(_0x1e8e47){logger[_0x61ec('0x27')](_0x1e8e47[_0x61ec('0x28')]);if(_0x1e8e47['name']){delete _0x1e8e47[_0x61ec('0x29')];}_0x58b12d[_0x61ec('0x1a')](_0x5511a2)[_0x61ec('0x2a')](_0x1e8e47);};}exports[_0x61ec('0x2b')]=function(_0x4bed98,_0x434e20){var _0x5b8403={},_0x155cf6={},_0x5d2992={'count':0x0,'rows':[]};var _0x12440a=_['map'](db[_0x61ec('0x2c')][_0x61ec('0x2d')],function(_0x328e43){return{'name':_0x328e43[_0x61ec('0x2e')],'type':_0x328e43[_0x61ec('0x2f')]['key']};});_0x155cf6[_0x61ec('0x30')]=_[_0x61ec('0x31')](_0x12440a,_0x61ec('0x29'));_0x155cf6[_0x61ec('0x32')]=_['keys'](_0x4bed98[_0x61ec('0x32')]);_0x155cf6[_0x61ec('0x33')]=_[_0x61ec('0x34')](_0x155cf6[_0x61ec('0x30')],_0x155cf6['query']);_0x5b8403['attributes']=_[_0x61ec('0x34')](_0x155cf6[_0x61ec('0x30')],qs[_0x61ec('0x35')](_0x4bed98[_0x61ec('0x32')][_0x61ec('0x35')]));_0x5b8403[_0x61ec('0x36')]=_0x5b8403[_0x61ec('0x36')]['length']?_0x5b8403[_0x61ec('0x36')]:_0x155cf6[_0x61ec('0x30')];if(!_0x4bed98[_0x61ec('0x32')][_0x61ec('0x37')](_0x61ec('0x38'))){_0x5b8403[_0x61ec('0x1d')]=qs['limit'](_0x4bed98[_0x61ec('0x32')][_0x61ec('0x1d')]);_0x5b8403[_0x61ec('0x1b')]=qs['offset'](_0x4bed98[_0x61ec('0x32')][_0x61ec('0x1b')]);}_0x5b8403[_0x61ec('0x39')]=qs[_0x61ec('0x3a')](_0x4bed98['query'][_0x61ec('0x3a')]);_0x5b8403[_0x61ec('0x3b')]=qs[_0x61ec('0x33')](_['pick'](_0x4bed98[_0x61ec('0x32')],_0x155cf6[_0x61ec('0x33')]),_0x12440a);if(_0x4bed98[_0x61ec('0x32')][_0x61ec('0x3c')]){_0x5b8403[_0x61ec('0x3b')]=_[_0x61ec('0x3d')](_0x5b8403['where'],{'$or':_[_0x61ec('0x31')](_0x12440a,function(_0x3580ac){if(_0x3580ac['type']!==_0x61ec('0x3e')){var _0x2b6a2e={};_0x2b6a2e[_0x3580ac[_0x61ec('0x29')]]={'$like':'%'+_0x4bed98[_0x61ec('0x32')]['filter']+'%'};return _0x2b6a2e;}})});}_0x5b8403=_[_0x61ec('0x3d')]({},_0x5b8403,_0x4bed98['options']);var _0x1db028={'where':_0x5b8403[_0x61ec('0x3b')]};return db['ServicenowConfiguration'][_0x61ec('0x1e')](_0x1db028)[_0x61ec('0x25')](function(_0x28c1ba){_0x5d2992['count']=_0x28c1ba;if(_0x4bed98['query'][_0x61ec('0x3f')]){_0x5b8403[_0x61ec('0x40')]=[{'all':!![]}];}return db[_0x61ec('0x2c')][_0x61ec('0x41')](_0x5b8403);})[_0x61ec('0x25')](function(_0x1f4773){_0x5d2992[_0x61ec('0x42')]=_0x1f4773;return _0x5d2992;})[_0x61ec('0x25')](respondWithFilteredResult(_0x434e20,_0x5b8403))[_0x61ec('0x43')](handleError(_0x434e20,null));};exports[_0x61ec('0x44')]=function(_0x3de0b3,_0xb901b4){var _0x2c0738={'raw':![],'where':{'id':_0x3de0b3[_0x61ec('0x45')]['id']}},_0x1dc52c={};_0x1dc52c[_0x61ec('0x30')]=_['keys'](db[_0x61ec('0x2c')][_0x61ec('0x2d')]);_0x1dc52c[_0x61ec('0x32')]=_[_0x61ec('0x46')](_0x3de0b3[_0x61ec('0x32')]);_0x1dc52c[_0x61ec('0x33')]=_[_0x61ec('0x34')](_0x1dc52c[_0x61ec('0x30')],_0x1dc52c['query']);_0x2c0738[_0x61ec('0x36')]=_[_0x61ec('0x34')](_0x1dc52c[_0x61ec('0x30')],qs[_0x61ec('0x35')](_0x3de0b3[_0x61ec('0x32')][_0x61ec('0x35')]));_0x2c0738[_0x61ec('0x36')]=_0x2c0738[_0x61ec('0x36')][_0x61ec('0x47')]?_0x2c0738[_0x61ec('0x36')]:_0x1dc52c[_0x61ec('0x30')];if(_0x3de0b3[_0x61ec('0x32')][_0x61ec('0x3f')]){_0x2c0738['include']=[{'all':!![]}];}_0x2c0738=_[_0x61ec('0x3d')]({},_0x2c0738,_0x3de0b3[_0x61ec('0x48')]);return db['ServicenowConfiguration'][_0x61ec('0x49')](_0x2c0738)[_0x61ec('0x25')](handleEntityNotFound(_0xb901b4,null))[_0x61ec('0x25')](respondWithResult(_0xb901b4,null))[_0x61ec('0x43')](handleError(_0xb901b4,null));};exports[_0x61ec('0x4a')]=function(_0x5a82f7,_0x37e4d3){return db[_0x61ec('0x2c')][_0x61ec('0x4a')](_0x5a82f7[_0x61ec('0x4b')],{})[_0x61ec('0x25')](respondWithResult(_0x37e4d3,0xc9))['catch'](handleError(_0x37e4d3,null));};exports[_0x61ec('0x4c')]=function(_0x48dc4b,_0x4a7bd9){if(_0x48dc4b[_0x61ec('0x4b')]['id']){delete _0x48dc4b[_0x61ec('0x4b')]['id'];}return db[_0x61ec('0x2c')][_0x61ec('0x49')]({'where':{'id':_0x48dc4b[_0x61ec('0x45')]['id']}})[_0x61ec('0x25')](handleEntityNotFound(_0x4a7bd9,null))[_0x61ec('0x25')](saveUpdates(_0x48dc4b[_0x61ec('0x4b')],null))['then'](respondWithResult(_0x4a7bd9,null))[_0x61ec('0x43')](handleError(_0x4a7bd9,null));};exports[_0x61ec('0x24')]=function(_0x1b5a87,_0x561785){return db[_0x61ec('0x2c')][_0x61ec('0x49')]({'where':{'id':_0x1b5a87['params']['id']}})[_0x61ec('0x25')](handleEntityNotFound(_0x561785,null))[_0x61ec('0x25')](removeEntity(_0x561785,null))['catch'](handleError(_0x561785,null));};exports[_0x61ec('0x4d')]=function(_0x5cd9aa,_0x4e95cd,_0x46e9e9){var _0x28d372={};var _0x63187={};var _0x350c78;var _0x4c7fda;return db['ServicenowConfiguration'][_0x61ec('0x4e')]({'where':{'id':_0x5cd9aa[_0x61ec('0x45')]['id']}})[_0x61ec('0x25')](handleEntityNotFound(_0x4e95cd,null))['then'](function(_0x2f0495){if(_0x2f0495){_0x350c78=_0x2f0495;_0x63187[_0x61ec('0x30')]=_['keys'](db[_0x61ec('0x4f')]['rawAttributes']);_0x63187[_0x61ec('0x32')]=_['keys'](_0x5cd9aa[_0x61ec('0x32')]);_0x63187[_0x61ec('0x33')]=_[_0x61ec('0x34')](_0x63187['model'],_0x63187[_0x61ec('0x32')]);_0x28d372['attributes']=_[_0x61ec('0x34')](_0x63187[_0x61ec('0x30')],qs['fields'](_0x5cd9aa['query'][_0x61ec('0x35')]));_0x28d372['attributes']=_0x28d372[_0x61ec('0x36')][_0x61ec('0x47')]?_0x28d372[_0x61ec('0x36')]:_0x63187[_0x61ec('0x30')];_0x28d372[_0x61ec('0x39')]=qs[_0x61ec('0x3a')](_0x5cd9aa[_0x61ec('0x32')][_0x61ec('0x3a')]);_0x28d372['where']=qs['filters'](_[_0x61ec('0x50')](_0x5cd9aa['query'],_0x63187['filters']));if(_0x5cd9aa[_0x61ec('0x32')]['filter']){_0x28d372[_0x61ec('0x3b')]=_[_0x61ec('0x3d')](_0x28d372[_0x61ec('0x3b')],{'$or':_['map'](_0x28d372[_0x61ec('0x36')],function(_0x49abb5){var _0x25f58a={};_0x25f58a[_0x49abb5]={'$like':'%'+_0x5cd9aa[_0x61ec('0x32')][_0x61ec('0x3c')]+'%'};return _0x25f58a;})});}_0x28d372=_[_0x61ec('0x3d')]({},_0x28d372,_0x5cd9aa[_0x61ec('0x48')]);return _0x350c78['getFields'](_0x28d372);}})[_0x61ec('0x25')](function(_0x15b016){if(_0x15b016){_0x4c7fda=_0x15b016[_0x61ec('0x47')];if(!_0x5cd9aa[_0x61ec('0x32')]['hasOwnProperty'](_0x61ec('0x38'))){_0x28d372[_0x61ec('0x1d')]=qs[_0x61ec('0x1d')](_0x5cd9aa[_0x61ec('0x32')][_0x61ec('0x1d')]);_0x28d372[_0x61ec('0x1b')]=qs['offset'](_0x5cd9aa[_0x61ec('0x32')][_0x61ec('0x1b')]);}return _0x350c78[_0x61ec('0x4d')](_0x28d372);}})['then'](function(_0x3849b){if(_0x3849b){return _0x3849b?{'count':_0x4c7fda,'rows':_0x3849b}:null;}})['then'](respondWithResult(_0x4e95cd,null))['catch'](handleError(_0x4e95cd,null));};exports['getSubjects']=function(_0x1769a9,_0x23379d,_0x5c074d){var _0x38df04={};var _0x7b04ab={};var _0x397940;var _0x2179b6;return db['ServicenowConfiguration'][_0x61ec('0x4e')]({'where':{'id':_0x1769a9[_0x61ec('0x45')]['id']}})[_0x61ec('0x25')](handleEntityNotFound(_0x23379d,null))[_0x61ec('0x25')](function(_0x507d25){if(_0x507d25){_0x397940=_0x507d25;_0x7b04ab[_0x61ec('0x30')]=_[_0x61ec('0x46')](db[_0x61ec('0x4f')][_0x61ec('0x2d')]);_0x7b04ab[_0x61ec('0x32')]=_[_0x61ec('0x46')](_0x1769a9[_0x61ec('0x32')]);_0x7b04ab['filters']=_['intersection'](_0x7b04ab['model'],_0x7b04ab[_0x61ec('0x32')]);_0x38df04[_0x61ec('0x36')]=_[_0x61ec('0x34')](_0x7b04ab['model'],qs[_0x61ec('0x35')](_0x1769a9[_0x61ec('0x32')][_0x61ec('0x35')]));_0x38df04[_0x61ec('0x36')]=_0x38df04[_0x61ec('0x36')][_0x61ec('0x47')]?_0x38df04[_0x61ec('0x36')]:_0x7b04ab[_0x61ec('0x30')];_0x38df04[_0x61ec('0x39')]=qs[_0x61ec('0x3a')](_0x1769a9[_0x61ec('0x32')]['sort']);_0x38df04[_0x61ec('0x3b')]=qs[_0x61ec('0x33')](_[_0x61ec('0x50')](_0x1769a9[_0x61ec('0x32')],_0x7b04ab[_0x61ec('0x33')]));if(_0x1769a9[_0x61ec('0x32')]['filter']){_0x38df04[_0x61ec('0x3b')]=_['merge'](_0x38df04['where'],{'$or':_[_0x61ec('0x31')](_0x38df04['attributes'],function(_0x2d425c){var _0x478d32={};_0x478d32[_0x2d425c]={'$like':'%'+_0x1769a9[_0x61ec('0x32')][_0x61ec('0x3c')]+'%'};return _0x478d32;})});}_0x38df04=_[_0x61ec('0x3d')]({},_0x38df04,_0x1769a9['options']);return _0x397940[_0x61ec('0x51')](_0x38df04);}})[_0x61ec('0x25')](function(_0x389fce){if(_0x389fce){_0x2179b6=_0x389fce[_0x61ec('0x47')];if(!_0x1769a9['query'][_0x61ec('0x37')](_0x61ec('0x38'))){_0x38df04[_0x61ec('0x1d')]=qs[_0x61ec('0x1d')](_0x1769a9['query'][_0x61ec('0x1d')]);_0x38df04[_0x61ec('0x1b')]=qs[_0x61ec('0x1b')](_0x1769a9[_0x61ec('0x32')]['offset']);}return _0x397940['getSubjects'](_0x38df04);}})[_0x61ec('0x25')](function(_0x22d51b){if(_0x22d51b){return _0x22d51b?{'count':_0x2179b6,'rows':_0x22d51b}:null;}})['then'](respondWithResult(_0x23379d,null))[_0x61ec('0x43')](handleError(_0x23379d,null));};exports['getDescriptions']=function(_0x37cf98,_0x5c83cb,_0x567478){var _0x15bb61={};var _0x554695={};var _0x5ada2e;var _0x544784;return db[_0x61ec('0x2c')][_0x61ec('0x4e')]({'where':{'id':_0x37cf98[_0x61ec('0x45')]['id']}})[_0x61ec('0x25')](handleEntityNotFound(_0x5c83cb,null))[_0x61ec('0x25')](function(_0x492a64){if(_0x492a64){_0x5ada2e=_0x492a64;_0x554695[_0x61ec('0x30')]=_['keys'](db[_0x61ec('0x4f')]['rawAttributes']);_0x554695[_0x61ec('0x32')]=_[_0x61ec('0x46')](_0x37cf98[_0x61ec('0x32')]);_0x554695[_0x61ec('0x33')]=_[_0x61ec('0x34')](_0x554695[_0x61ec('0x30')],_0x554695['query']);_0x15bb61['attributes']=_[_0x61ec('0x34')](_0x554695[_0x61ec('0x30')],qs[_0x61ec('0x35')](_0x37cf98[_0x61ec('0x32')][_0x61ec('0x35')]));_0x15bb61[_0x61ec('0x36')]=_0x15bb61[_0x61ec('0x36')][_0x61ec('0x47')]?_0x15bb61['attributes']:_0x554695['model'];_0x15bb61[_0x61ec('0x39')]=qs[_0x61ec('0x3a')](_0x37cf98[_0x61ec('0x32')]['sort']);_0x15bb61[_0x61ec('0x3b')]=qs[_0x61ec('0x33')](_[_0x61ec('0x50')](_0x37cf98['query'],_0x554695[_0x61ec('0x33')]));if(_0x37cf98[_0x61ec('0x32')][_0x61ec('0x3c')]){_0x15bb61[_0x61ec('0x3b')]=_[_0x61ec('0x3d')](_0x15bb61[_0x61ec('0x3b')],{'$or':_[_0x61ec('0x31')](_0x15bb61[_0x61ec('0x36')],function(_0x40c207){var _0x5b274f={};_0x5b274f[_0x40c207]={'$like':'%'+_0x37cf98[_0x61ec('0x32')][_0x61ec('0x3c')]+'%'};return _0x5b274f;})});}_0x15bb61=_[_0x61ec('0x3d')]({},_0x15bb61,_0x37cf98[_0x61ec('0x48')]);return _0x5ada2e[_0x61ec('0x52')](_0x15bb61);}})[_0x61ec('0x25')](function(_0x5488d5){if(_0x5488d5){_0x544784=_0x5488d5[_0x61ec('0x47')];if(!_0x37cf98[_0x61ec('0x32')][_0x61ec('0x37')](_0x61ec('0x38'))){_0x15bb61[_0x61ec('0x1d')]=qs['limit'](_0x37cf98['query'][_0x61ec('0x1d')]);_0x15bb61[_0x61ec('0x1b')]=qs['offset'](_0x37cf98[_0x61ec('0x32')][_0x61ec('0x1b')]);}return _0x5ada2e[_0x61ec('0x52')](_0x15bb61);}})['then'](function(_0x4c4406){if(_0x4c4406){return _0x4c4406?{'count':_0x544784,'rows':_0x4c4406}:null;}})[_0x61ec('0x25')](respondWithResult(_0x5c83cb,null))['catch'](handleError(_0x5c83cb,null));}; \ No newline at end of file +var _0x89e9=['sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','fields','length','include','find','create','update','body','getFields','findOne','order','filter','getSubjects','getDescriptions','ServicenowField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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/utils','../../config/environment','../../mysqldb'];(function(_0xc0c817,_0x3174a0){var _0x41947d=function(_0x4e50a2){while(--_0x4e50a2){_0xc0c817['push'](_0xc0c817['shift']());}};_0x41947d(++_0x3174a0);}(_0x89e9,0x8f));var _0x989e=function(_0x497b6b,_0x19f2fd){_0x497b6b=_0x497b6b-0x0;var _0x2f34f3=_0x89e9[_0x497b6b];return _0x2f34f3;};'use strict';var emlformat=require(_0x989e('0x0'));var rimraf=require(_0x989e('0x1'));var zipdir=require(_0x989e('0x2'));var jsonpatch=require(_0x989e('0x3'));var rp=require(_0x989e('0x4'));var moment=require(_0x989e('0x5'));var BPromise=require(_0x989e('0x6'));var Mustache=require('mustache');var util=require(_0x989e('0x7'));var path=require(_0x989e('0x8'));var sox=require(_0x989e('0x9'));var csv=require(_0x989e('0xa'));var ejs=require(_0x989e('0xb'));var fs=require('fs');var fs_extra=require(_0x989e('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x989e('0xd'));var jsforce=require(_0x989e('0xe'));var deskjs=require(_0x989e('0xf'));var toCsv=require(_0x989e('0xa'));var querystring=require(_0x989e('0x10'));var Papa=require(_0x989e('0x11'));var Redis=require(_0x989e('0x12'));var authService=require(_0x989e('0x13'));var qs=require(_0x989e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x989e('0x15'));var logger=require(_0x989e('0x16'))(_0x989e('0x17'));var utils=require(_0x989e('0x18'));var config=require(_0x989e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x989e('0x1a'))['db'];function respondWithStatusCode(_0x1938f2,_0x249192){_0x249192=_0x249192||0xcc;return function(_0x4deb01){if(_0x4deb01){return _0x1938f2[_0x989e('0x1b')](_0x249192);}return _0x1938f2[_0x989e('0x1c')](_0x249192)[_0x989e('0x1d')]();};}function respondWithResult(_0x1d333b,_0x3ecd36){_0x3ecd36=_0x3ecd36||0xc8;return function(_0x3ec4cd){if(_0x3ec4cd){return _0x1d333b[_0x989e('0x1c')](_0x3ecd36)[_0x989e('0x1e')](_0x3ec4cd);}};}function respondWithFilteredResult(_0x3079af,_0x1892bf){return function(_0x5c2ca3){if(_0x5c2ca3){var _0x4ba013=typeof _0x1892bf['offset']===_0x989e('0x1f')&&typeof _0x1892bf['limit']==='undefined';var _0x4b3fe2=_0x5c2ca3[_0x989e('0x20')];var _0x37cc72=_0x4ba013?0x0:_0x1892bf[_0x989e('0x21')];var _0x5bb6a0=_0x4ba013?_0x5c2ca3[_0x989e('0x20')]:_0x1892bf[_0x989e('0x21')]+_0x1892bf['limit'];var _0x4e7404;if(_0x5bb6a0>=_0x4b3fe2){_0x5bb6a0=_0x4b3fe2;_0x4e7404=0xc8;}else{_0x4e7404=0xce;}_0x3079af[_0x989e('0x1c')](_0x4e7404);return _0x3079af[_0x989e('0x22')](_0x989e('0x23'),_0x37cc72+'-'+_0x5bb6a0+'/'+_0x4b3fe2)['json'](_0x5c2ca3);}return null;};}function patchUpdates(_0x19e1fd){return function(_0x234dd9){try{jsonpatch[_0x989e('0x24')](_0x234dd9,_0x19e1fd,!![]);}catch(_0xa7529a){return BPromise[_0x989e('0x25')](_0xa7529a);}return _0x234dd9[_0x989e('0x26')]();};}function saveUpdates(_0x17a0b9,_0x497b94){return function(_0x4d12c4){if(_0x4d12c4){return _0x4d12c4['update'](_0x17a0b9)['then'](function(_0x1be269){return _0x1be269;});}return null;};}function removeEntity(_0x33646a,_0x32b00b){return function(_0x4a0a3f){if(_0x4a0a3f){return _0x4a0a3f[_0x989e('0x27')]()[_0x989e('0x28')](function(){_0x33646a[_0x989e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x413b54,_0x840537){return function(_0x4c3ff3){if(!_0x4c3ff3){_0x413b54[_0x989e('0x1b')](0x194);}return _0x4c3ff3;};}function handleError(_0x196d58,_0x5a3603){_0x5a3603=_0x5a3603||0x1f4;return function(_0x33b951){logger[_0x989e('0x29')](_0x33b951[_0x989e('0x2a')]);if(_0x33b951[_0x989e('0x2b')]){delete _0x33b951[_0x989e('0x2b')];}_0x196d58[_0x989e('0x1c')](_0x5a3603)['send'](_0x33b951);};}exports[_0x989e('0x2c')]=function(_0x2ae284,_0x56cf9b){var _0x204778={},_0x14b6b4={},_0x300161={'count':0x0,'rows':[]};var _0x5d663b=_[_0x989e('0x2d')](db[_0x989e('0x2e')][_0x989e('0x2f')],function(_0x253094){return{'name':_0x253094[_0x989e('0x30')],'type':_0x253094['type'][_0x989e('0x31')]};});_0x14b6b4[_0x989e('0x32')]=_[_0x989e('0x2d')](_0x5d663b,'name');_0x14b6b4[_0x989e('0x33')]=_[_0x989e('0x34')](_0x2ae284[_0x989e('0x33')]);_0x14b6b4[_0x989e('0x35')]=_[_0x989e('0x36')](_0x14b6b4[_0x989e('0x32')],_0x14b6b4[_0x989e('0x33')]);_0x204778[_0x989e('0x37')]=_[_0x989e('0x36')](_0x14b6b4[_0x989e('0x32')],qs['fields'](_0x2ae284[_0x989e('0x33')]['fields']));_0x204778[_0x989e('0x37')]=_0x204778[_0x989e('0x37')]['length']?_0x204778[_0x989e('0x37')]:_0x14b6b4[_0x989e('0x32')];if(!_0x2ae284[_0x989e('0x33')][_0x989e('0x38')](_0x989e('0x39'))){_0x204778[_0x989e('0x3a')]=qs['limit'](_0x2ae284[_0x989e('0x33')][_0x989e('0x3a')]);_0x204778['offset']=qs[_0x989e('0x21')](_0x2ae284[_0x989e('0x33')][_0x989e('0x21')]);}_0x204778['order']=qs['sort'](_0x2ae284[_0x989e('0x33')][_0x989e('0x3b')]);_0x204778[_0x989e('0x3c')]=qs[_0x989e('0x35')](_[_0x989e('0x3d')](_0x2ae284['query'],_0x14b6b4[_0x989e('0x35')]),_0x5d663b);if(_0x2ae284[_0x989e('0x33')]['filter']){_0x204778['where']=_[_0x989e('0x3e')](_0x204778[_0x989e('0x3c')],{'$or':_[_0x989e('0x2d')](_0x5d663b,function(_0x58339f){if(_0x58339f[_0x989e('0x3f')]!==_0x989e('0x40')){var _0x3228ad={};_0x3228ad[_0x58339f[_0x989e('0x2b')]]={'$like':'%'+_0x2ae284[_0x989e('0x33')]['filter']+'%'};return _0x3228ad;}})});}_0x204778=_[_0x989e('0x3e')]({},_0x204778,_0x2ae284[_0x989e('0x41')]);var _0x2f31e0={'where':_0x204778[_0x989e('0x3c')]};return db[_0x989e('0x2e')][_0x989e('0x20')](_0x2f31e0)[_0x989e('0x28')](function(_0x280e37){_0x300161['count']=_0x280e37;if(_0x2ae284[_0x989e('0x33')][_0x989e('0x42')]){_0x204778['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x989e('0x43')](_0x204778);})['then'](function(_0x54f9c7){_0x300161[_0x989e('0x44')]=_0x54f9c7;return _0x300161;})['then'](respondWithFilteredResult(_0x56cf9b,_0x204778))[_0x989e('0x45')](handleError(_0x56cf9b,null));};exports['show']=function(_0x1deb40,_0xb0335e){var _0x4755e0={'raw':![],'where':{'id':_0x1deb40[_0x989e('0x46')]['id']}},_0x47afee={};_0x47afee[_0x989e('0x32')]=_[_0x989e('0x34')](db[_0x989e('0x2e')][_0x989e('0x2f')]);_0x47afee['query']=_[_0x989e('0x34')](_0x1deb40[_0x989e('0x33')]);_0x47afee['filters']=_['intersection'](_0x47afee['model'],_0x47afee['query']);_0x4755e0[_0x989e('0x37')]=_[_0x989e('0x36')](_0x47afee[_0x989e('0x32')],qs[_0x989e('0x47')](_0x1deb40[_0x989e('0x33')]['fields']));_0x4755e0['attributes']=_0x4755e0[_0x989e('0x37')][_0x989e('0x48')]?_0x4755e0['attributes']:_0x47afee[_0x989e('0x32')];if(_0x1deb40[_0x989e('0x33')]['includeAll']){_0x4755e0[_0x989e('0x49')]=[{'all':!![]}];}_0x4755e0=_[_0x989e('0x3e')]({},_0x4755e0,_0x1deb40[_0x989e('0x41')]);return db[_0x989e('0x2e')][_0x989e('0x4a')](_0x4755e0)[_0x989e('0x28')](handleEntityNotFound(_0xb0335e,null))[_0x989e('0x28')](respondWithResult(_0xb0335e,null))[_0x989e('0x45')](handleError(_0xb0335e,null));};exports[_0x989e('0x4b')]=function(_0x116db7,_0x44d664){return db['ServicenowConfiguration'][_0x989e('0x4b')](_0x116db7['body'],{})[_0x989e('0x28')](respondWithResult(_0x44d664,0xc9))[_0x989e('0x45')](handleError(_0x44d664,null));};exports[_0x989e('0x4c')]=function(_0x5d8776,_0x49d3ca){if(_0x5d8776[_0x989e('0x4d')]['id']){delete _0x5d8776[_0x989e('0x4d')]['id'];}return db[_0x989e('0x2e')][_0x989e('0x4a')]({'where':{'id':_0x5d8776[_0x989e('0x46')]['id']}})['then'](handleEntityNotFound(_0x49d3ca,null))[_0x989e('0x28')](saveUpdates(_0x5d8776['body'],null))['then'](respondWithResult(_0x49d3ca,null))[_0x989e('0x45')](handleError(_0x49d3ca,null));};exports['destroy']=function(_0x46b0e8,_0x4befab){return db[_0x989e('0x2e')][_0x989e('0x4a')]({'where':{'id':_0x46b0e8[_0x989e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4befab,null))['then'](removeEntity(_0x4befab,null))[_0x989e('0x45')](handleError(_0x4befab,null));};exports[_0x989e('0x4e')]=function(_0x259baa,_0x4e69bc,_0x552267){var _0x25674d={};var _0x69f92c={};var _0xa7a76c;var _0x3afbb8;return db[_0x989e('0x2e')][_0x989e('0x4f')]({'where':{'id':_0x259baa[_0x989e('0x46')]['id']}})[_0x989e('0x28')](handleEntityNotFound(_0x4e69bc,null))['then'](function(_0x58f0d6){if(_0x58f0d6){_0xa7a76c=_0x58f0d6;_0x69f92c['model']=_[_0x989e('0x34')](db['ServicenowField'][_0x989e('0x2f')]);_0x69f92c['query']=_[_0x989e('0x34')](_0x259baa[_0x989e('0x33')]);_0x69f92c[_0x989e('0x35')]=_[_0x989e('0x36')](_0x69f92c[_0x989e('0x32')],_0x69f92c[_0x989e('0x33')]);_0x25674d['attributes']=_[_0x989e('0x36')](_0x69f92c[_0x989e('0x32')],qs['fields'](_0x259baa[_0x989e('0x33')]['fields']));_0x25674d[_0x989e('0x37')]=_0x25674d[_0x989e('0x37')][_0x989e('0x48')]?_0x25674d[_0x989e('0x37')]:_0x69f92c[_0x989e('0x32')];_0x25674d[_0x989e('0x50')]=qs[_0x989e('0x3b')](_0x259baa[_0x989e('0x33')][_0x989e('0x3b')]);_0x25674d['where']=qs[_0x989e('0x35')](_[_0x989e('0x3d')](_0x259baa[_0x989e('0x33')],_0x69f92c[_0x989e('0x35')]));if(_0x259baa['query']['filter']){_0x25674d[_0x989e('0x3c')]=_[_0x989e('0x3e')](_0x25674d[_0x989e('0x3c')],{'$or':_['map'](_0x25674d[_0x989e('0x37')],function(_0xc36102){var _0x4adfcd={};_0x4adfcd[_0xc36102]={'$like':'%'+_0x259baa[_0x989e('0x33')][_0x989e('0x51')]+'%'};return _0x4adfcd;})});}_0x25674d=_[_0x989e('0x3e')]({},_0x25674d,_0x259baa['options']);return _0xa7a76c[_0x989e('0x4e')](_0x25674d);}})[_0x989e('0x28')](function(_0x5911d1){if(_0x5911d1){_0x3afbb8=_0x5911d1['length'];if(!_0x259baa[_0x989e('0x33')][_0x989e('0x38')](_0x989e('0x39'))){_0x25674d[_0x989e('0x3a')]=qs[_0x989e('0x3a')](_0x259baa['query'][_0x989e('0x3a')]);_0x25674d[_0x989e('0x21')]=qs[_0x989e('0x21')](_0x259baa[_0x989e('0x33')][_0x989e('0x21')]);}return _0xa7a76c['getFields'](_0x25674d);}})[_0x989e('0x28')](function(_0x20cecb){if(_0x20cecb){return _0x20cecb?{'count':_0x3afbb8,'rows':_0x20cecb}:null;}})[_0x989e('0x28')](respondWithResult(_0x4e69bc,null))['catch'](handleError(_0x4e69bc,null));};exports[_0x989e('0x52')]=function(_0x1ac005,_0x5f1675,_0x149bae){var _0x347fe5={};var _0x1d4303={};var _0x5e7227;var _0x3a26f1;return db['ServicenowConfiguration'][_0x989e('0x4f')]({'where':{'id':_0x1ac005[_0x989e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5f1675,null))['then'](function(_0xa4c676){if(_0xa4c676){_0x5e7227=_0xa4c676;_0x1d4303['model']=_[_0x989e('0x34')](db['ServicenowField']['rawAttributes']);_0x1d4303[_0x989e('0x33')]=_['keys'](_0x1ac005['query']);_0x1d4303[_0x989e('0x35')]=_[_0x989e('0x36')](_0x1d4303[_0x989e('0x32')],_0x1d4303[_0x989e('0x33')]);_0x347fe5['attributes']=_[_0x989e('0x36')](_0x1d4303['model'],qs['fields'](_0x1ac005[_0x989e('0x33')][_0x989e('0x47')]));_0x347fe5['attributes']=_0x347fe5[_0x989e('0x37')]['length']?_0x347fe5['attributes']:_0x1d4303['model'];_0x347fe5[_0x989e('0x50')]=qs[_0x989e('0x3b')](_0x1ac005[_0x989e('0x33')][_0x989e('0x3b')]);_0x347fe5[_0x989e('0x3c')]=qs[_0x989e('0x35')](_[_0x989e('0x3d')](_0x1ac005[_0x989e('0x33')],_0x1d4303[_0x989e('0x35')]));if(_0x1ac005['query'][_0x989e('0x51')]){_0x347fe5[_0x989e('0x3c')]=_[_0x989e('0x3e')](_0x347fe5[_0x989e('0x3c')],{'$or':_[_0x989e('0x2d')](_0x347fe5[_0x989e('0x37')],function(_0x90689a){var _0x5a641b={};_0x5a641b[_0x90689a]={'$like':'%'+_0x1ac005[_0x989e('0x33')][_0x989e('0x51')]+'%'};return _0x5a641b;})});}_0x347fe5=_[_0x989e('0x3e')]({},_0x347fe5,_0x1ac005[_0x989e('0x41')]);return _0x5e7227['getSubjects'](_0x347fe5);}})[_0x989e('0x28')](function(_0x539287){if(_0x539287){_0x3a26f1=_0x539287[_0x989e('0x48')];if(!_0x1ac005[_0x989e('0x33')]['hasOwnProperty']('nolimit')){_0x347fe5[_0x989e('0x3a')]=qs[_0x989e('0x3a')](_0x1ac005['query']['limit']);_0x347fe5[_0x989e('0x21')]=qs[_0x989e('0x21')](_0x1ac005[_0x989e('0x33')]['offset']);}return _0x5e7227[_0x989e('0x52')](_0x347fe5);}})[_0x989e('0x28')](function(_0xc2b03f){if(_0xc2b03f){return _0xc2b03f?{'count':_0x3a26f1,'rows':_0xc2b03f}:null;}})[_0x989e('0x28')](respondWithResult(_0x5f1675,null))[_0x989e('0x45')](handleError(_0x5f1675,null));};exports[_0x989e('0x53')]=function(_0x578888,_0x20226d,_0x439161){var _0x4de407={};var _0x116751={};var _0x5e1fbc;var _0x40f17e;return db['ServicenowConfiguration'][_0x989e('0x4f')]({'where':{'id':_0x578888[_0x989e('0x46')]['id']}})[_0x989e('0x28')](handleEntityNotFound(_0x20226d,null))[_0x989e('0x28')](function(_0x1243ad){if(_0x1243ad){_0x5e1fbc=_0x1243ad;_0x116751['model']=_[_0x989e('0x34')](db[_0x989e('0x54')]['rawAttributes']);_0x116751[_0x989e('0x33')]=_[_0x989e('0x34')](_0x578888[_0x989e('0x33')]);_0x116751[_0x989e('0x35')]=_['intersection'](_0x116751[_0x989e('0x32')],_0x116751[_0x989e('0x33')]);_0x4de407[_0x989e('0x37')]=_[_0x989e('0x36')](_0x116751[_0x989e('0x32')],qs[_0x989e('0x47')](_0x578888[_0x989e('0x33')][_0x989e('0x47')]));_0x4de407[_0x989e('0x37')]=_0x4de407['attributes'][_0x989e('0x48')]?_0x4de407['attributes']:_0x116751[_0x989e('0x32')];_0x4de407[_0x989e('0x50')]=qs[_0x989e('0x3b')](_0x578888[_0x989e('0x33')][_0x989e('0x3b')]);_0x4de407[_0x989e('0x3c')]=qs[_0x989e('0x35')](_[_0x989e('0x3d')](_0x578888[_0x989e('0x33')],_0x116751[_0x989e('0x35')]));if(_0x578888[_0x989e('0x33')][_0x989e('0x51')]){_0x4de407['where']=_[_0x989e('0x3e')](_0x4de407['where'],{'$or':_[_0x989e('0x2d')](_0x4de407[_0x989e('0x37')],function(_0x3d4f86){var _0xe811ba={};_0xe811ba[_0x3d4f86]={'$like':'%'+_0x578888[_0x989e('0x33')][_0x989e('0x51')]+'%'};return _0xe811ba;})});}_0x4de407=_[_0x989e('0x3e')]({},_0x4de407,_0x578888[_0x989e('0x41')]);return _0x5e1fbc[_0x989e('0x53')](_0x4de407);}})[_0x989e('0x28')](function(_0x2ceb3c){if(_0x2ceb3c){_0x40f17e=_0x2ceb3c[_0x989e('0x48')];if(!_0x578888[_0x989e('0x33')]['hasOwnProperty'](_0x989e('0x39'))){_0x4de407[_0x989e('0x3a')]=qs[_0x989e('0x3a')](_0x578888[_0x989e('0x33')][_0x989e('0x3a')]);_0x4de407[_0x989e('0x21')]=qs['offset'](_0x578888[_0x989e('0x33')][_0x989e('0x21')]);}return _0x5e1fbc['getDescriptions'](_0x4de407);}})[_0x989e('0x28')](function(_0x24ea31){if(_0x24ea31){return _0x24ea31?{'count':_0x40f17e,'rows':_0x24ea31}:null;}})['then'](respondWithResult(_0x20226d,null))[_0x989e('0x45')](handleError(_0x20226d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 75c8483..b59180b 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 _0xcaa3=['bluebird','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4e3d3d,_0x4340f4){var _0x39ed43=function(_0x556c10){while(--_0x556c10){_0x4e3d3d['push'](_0x4e3d3d['shift']());}};_0x39ed43(++_0x4340f4);}(_0xcaa3,0xcb));var _0x3caa=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xcaa3[_0x166d93];return _0xba708;};'use strict';var _=require(_0x3caa('0x0'));var util=require(_0x3caa('0x1'));var logger=require(_0x3caa('0x2'))(_0x3caa('0x3'));var moment=require(_0x3caa('0x4'));var BPromise=require(_0x3caa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3caa('0x6'));var config=require(_0x3caa('0x7'));var attributes=require(_0x3caa('0x8'));module[_0x3caa('0x9')]=function(_0x171c56,_0x54ba79){return _0x171c56[_0x3caa('0xa')](_0x3caa('0xb'),attributes,{'tableName':_0x3caa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63ad=['rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','util','../../config/logger','path'];(function(_0x4ab7e0,_0x3230d5){var _0x5e7bc9=function(_0x50f3b7){while(--_0x50f3b7){_0x4ab7e0['push'](_0x4ab7e0['shift']());}};_0x5e7bc9(++_0x3230d5);}(_0x63ad,0x7d));var _0xd63a=function(_0x19561b,_0x213b5b){_0x19561b=_0x19561b-0x0;var _0x45f6ec=_0x63ad[_0x19561b];return _0x45f6ec;};'use strict';var _=require('lodash');var util=require(_0xd63a('0x0'));var logger=require(_0xd63a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd63a('0x2'));var rimraf=require(_0xd63a('0x3'));var config=require('../../config/environment');var attributes=require(_0xd63a('0x4'));module[_0xd63a('0x5')]=function(_0x32e509,_0xcfe533){return _0x32e509[_0xd63a('0x6')](_0xd63a('0x7'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index da43394..ca4b9ec 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 _0xfaf3=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xfaf3,0x118));var _0x3faf=function(_0x2894d9,_0x5dcc92){_0x2894d9=_0x2894d9-0x0;var _0x58953c=_0xfaf3[_0x2894d9];return _0x58953c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3faf('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3faf('0x1'));var db=require(_0x3faf('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3faf('0x3'))(_0x3faf('0x4'));var config=require(_0x3faf('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3faf('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x41eb8e,_0x12cc3a,_0x1120d6){return new BPromise(function(_0xe406f3,_0x545776){return client['request'](_0x41eb8e,_0x1120d6)[_0x3faf('0x7')](function(_0xb01373){logger[_0x3faf('0x8')](_0x3faf('0x9'),_0x12cc3a,_0x3faf('0xa'));logger[_0x3faf('0xb')](_0x3faf('0xc'),_0x12cc3a,_0x3faf('0xa'),JSON[_0x3faf('0xd')](_0xb01373));if(_0xb01373['error']){if(_0xb01373[_0x3faf('0xe')]['code']===0x1f4){logger[_0x3faf('0xe')](_0x3faf('0x9'),_0x12cc3a,_0xb01373['error'][_0x3faf('0xf')]);return _0x545776(_0xb01373[_0x3faf('0xe')][_0x3faf('0xf')]);}logger[_0x3faf('0xe')](_0x3faf('0x9'),_0x12cc3a,_0xb01373['error'][_0x3faf('0xf')]);return _0xe406f3(_0xb01373[_0x3faf('0xe')][_0x3faf('0xf')]);}else{logger[_0x3faf('0x8')](_0x3faf('0x9'),_0x12cc3a,_0x3faf('0xa'));_0xe406f3(_0xb01373['result'][_0x3faf('0xf')]);}})[_0x3faf('0x10')](function(_0x5631b7){logger['error'](_0x3faf('0x9'),_0x12cc3a,_0x5631b7);_0x545776(_0x5631b7);});});} \ No newline at end of file +var _0x71ca=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71ca,0x176));var _0xa71c=function(_0x5a4365,_0x409a56){_0x5a4365=_0x5a4365-0x0;var _0x259d7c=_0x71ca[_0x5a4365];return _0x259d7c;};'use strict';var _=require('lodash');var util=require(_0xa71c('0x0'));var moment=require(_0xa71c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa71c('0x2'));var fs=require('fs');var Redis=require(_0xa71c('0x3'));var db=require(_0xa71c('0x4'))['db'];var utils=require(_0xa71c('0x5'));var logger=require(_0xa71c('0x6'))(_0xa71c('0x7'));var config=require(_0xa71c('0x8'));var jayson=require(_0xa71c('0x9'));var client=jayson[_0xa71c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f9450,_0x38a6b2,_0x118a18){return new BPromise(function(_0x1edd6f,_0x43010c){return client['request'](_0x3f9450,_0x118a18)['then'](function(_0x3145de){logger[_0xa71c('0xb')](_0xa71c('0xc'),_0x38a6b2,_0xa71c('0xd'));logger['debug'](_0xa71c('0xe'),_0x38a6b2,_0xa71c('0xd'),JSON['stringify'](_0x3145de));if(_0x3145de[_0xa71c('0xf')]){if(_0x3145de[_0xa71c('0xf')]['code']===0x1f4){logger[_0xa71c('0xf')](_0xa71c('0xc'),_0x38a6b2,_0x3145de[_0xa71c('0xf')][_0xa71c('0x10')]);return _0x43010c(_0x3145de['error']['message']);}logger[_0xa71c('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x38a6b2,_0x3145de[_0xa71c('0xf')][_0xa71c('0x10')]);return _0x1edd6f(_0x3145de[_0xa71c('0xf')][_0xa71c('0x10')]);}else{logger[_0xa71c('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x38a6b2,_0xa71c('0xd'));_0x1edd6f(_0x3145de['result'][_0xa71c('0x10')]);}})[_0xa71c('0x11')](function(_0x436c88){logger['error'](_0xa71c('0xc'),_0x38a6b2,_0x436c88);_0x43010c(_0x436c88);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 492a5c3..1f9046d 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 _0x0dd5=['multer','util','path','express','Router','fs-extra','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0dd5,0x187));var _0x50dd=function(_0x2f017b,_0x3ed6c0){_0x2f017b=_0x2f017b-0x0;var _0x31f0db=_0x0dd5[_0x2f017b];return _0x31f0db;};'use strict';var multer=require(_0x50dd('0x0'));var util=require(_0x50dd('0x1'));var path=require(_0x50dd('0x2'));var timeout=require('connect-timeout');var express=require(_0x50dd('0x3'));var router=express[_0x50dd('0x4')]();var fs_extra=require(_0x50dd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x50dd('0x6'));var controller=require(_0x50dd('0x7'));router[_0x50dd('0x8')]('/',auth[_0x50dd('0x9')](),controller[_0x50dd('0xa')]);router[_0x50dd('0x8')](_0x50dd('0xb'),auth[_0x50dd('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x50dd('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x50dd('0xd')]);router[_0x50dd('0xe')](_0x50dd('0xb'),auth[_0x50dd('0x9')](),controller[_0x50dd('0xf')]);module[_0x50dd('0x10')]=router; \ No newline at end of file +var _0x886e=['put','isAuthenticated','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','post'];(function(_0x356d1b,_0x2a9fb7){var _0x4c2ca4=function(_0x4bf366){while(--_0x4bf366){_0x356d1b['push'](_0x356d1b['shift']());}};_0x4c2ca4(++_0x2a9fb7);}(_0x886e,0x149));var _0xe886=function(_0x5148b7,_0x57f80e){_0x5148b7=_0x5148b7-0x0;var _0x3295f8=_0x886e[_0x5148b7];return _0x3295f8;};'use strict';var multer=require(_0xe886('0x0'));var util=require(_0xe886('0x1'));var path=require('path');var timeout=require(_0xe886('0x2'));var express=require(_0xe886('0x3'));var router=express[_0xe886('0x4')]();var fs_extra=require(_0xe886('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe886('0x6'));var config=require(_0xe886('0x7'));var controller=require(_0xe886('0x8'));router[_0xe886('0x9')]('/',auth['isAuthenticated'](),controller[_0xe886('0xa')]);router['get'](_0xe886('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe886('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe886('0xd')](_0xe886('0xb'),auth[_0xe886('0xe')](),controller['update']);router[_0xe886('0xf')](_0xe886('0xb'),auth[_0xe886('0xe')](),controller[_0xe886('0x10')]);module[_0xe886('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index f10da1a..d405561 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 _0xe79d=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x5c77d9,_0x310fac){var _0x114cdd=function(_0xd60a02){while(--_0xd60a02){_0x5c77d9['push'](_0x5c77d9['shift']());}};_0x114cdd(++_0x310fac);}(_0xe79d,0xdb));var _0xde79=function(_0x339647,_0x42e930){_0x339647=_0x339647-0x0;var _0x5203b5=_0xe79d[_0x339647];return _0x5203b5;};'use strict';var Sequelize=require(_0xde79('0x0'));module[_0xde79('0x1')]={'type':{'type':Sequelize[_0xde79('0x2')](_0xde79('0x3'),_0xde79('0x4'),_0xde79('0x5'),_0xde79('0x6'),_0xde79('0x7')),'defaultValue':_0xde79('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xde79('0x2')]('string',_0xde79('0x4'),_0xde79('0x5'))},'keyContent':{'type':Sequelize[_0xde79('0x8')]},'idField':{'type':Sequelize[_0xde79('0x8')]},'nameField':{'type':Sequelize[_0xde79('0x8')]},'customField':{'type':Sequelize[_0xde79('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde79('0x8')]}}; \ No newline at end of file +var _0xd90e=['keyValue','picklist','STRING','variable','exports','string','customVariable'];(function(_0xbc8873,_0x160489){var _0x5289fd=function(_0x35583f){while(--_0x35583f){_0xbc8873['push'](_0xbc8873['shift']());}};_0x5289fd(++_0x160489);}(_0xd90e,0x90));var _0xed90=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd90e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xed90('0x0')]={'type':{'type':Sequelize['ENUM'](_0xed90('0x1'),'variable',_0xed90('0x2'),_0xed90('0x3'),_0xed90('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xed90('0x5')]},'key':{'type':Sequelize[_0xed90('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xed90('0x1'),_0xed90('0x6'),_0xed90('0x2'))},'keyContent':{'type':Sequelize[_0xed90('0x5')]},'idField':{'type':Sequelize[_0xed90('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xed90('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 1aa877f..6182cb5 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 _0x513c=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowField','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x513c,0x1ac));var _0xc513=function(_0x338b26,_0x45d064){_0x338b26=_0x338b26-0x0;var _0x21d9da=_0x513c[_0x338b26];return _0x21d9da;};'use strict';var emlformat=require(_0xc513('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc513('0x1'));var jsonpatch=require(_0xc513('0x2'));var rp=require('request-promise');var moment=require(_0xc513('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc513('0x4'));var util=require(_0xc513('0x5'));var path=require(_0xc513('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc513('0x7'));var fs=require('fs');var fs_extra=require(_0xc513('0x8'));var _=require(_0xc513('0x9'));var squel=require(_0xc513('0xa'));var crypto=require(_0xc513('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc513('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc513('0xd'));var Papa=require(_0xc513('0xe'));var Redis=require('ioredis');var authService=require(_0xc513('0xf'));var qs=require(_0xc513('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc513('0x11'))(_0xc513('0x12'));var utils=require(_0xc513('0x13'));var config=require(_0xc513('0x14'));var licenseUtil=require(_0xc513('0x15'));var db=require(_0xc513('0x16'))['db'];function respondWithStatusCode(_0x5f555f,_0x2f78d1){_0x2f78d1=_0x2f78d1||0xcc;return function(_0x2c15d4){if(_0x2c15d4){return _0x5f555f[_0xc513('0x17')](_0x2f78d1);}return _0x5f555f[_0xc513('0x18')](_0x2f78d1)[_0xc513('0x19')]();};}function respondWithResult(_0x207151,_0x450b7e){_0x450b7e=_0x450b7e||0xc8;return function(_0x4908c6){if(_0x4908c6){return _0x207151['status'](_0x450b7e)[_0xc513('0x1a')](_0x4908c6);}};}function respondWithFilteredResult(_0x2f2f37,_0x23e2db){return function(_0x55bf92){if(_0x55bf92){var _0x5a9717=typeof _0x23e2db['offset']===_0xc513('0x1b')&&typeof _0x23e2db[_0xc513('0x1c')]===_0xc513('0x1b');var _0x4357c3=_0x55bf92[_0xc513('0x1d')];var _0xf10ff1=_0x5a9717?0x0:_0x23e2db[_0xc513('0x1e')];var _0x18d4a9=_0x5a9717?_0x55bf92['count']:_0x23e2db[_0xc513('0x1e')]+_0x23e2db[_0xc513('0x1c')];var _0x58589f;if(_0x18d4a9>=_0x4357c3){_0x18d4a9=_0x4357c3;_0x58589f=0xc8;}else{_0x58589f=0xce;}_0x2f2f37['status'](_0x58589f);return _0x2f2f37[_0xc513('0x1f')](_0xc513('0x20'),_0xf10ff1+'-'+_0x18d4a9+'/'+_0x4357c3)[_0xc513('0x1a')](_0x55bf92);}return null;};}function patchUpdates(_0x4a388f){return function(_0x7d0cbb){try{jsonpatch[_0xc513('0x21')](_0x7d0cbb,_0x4a388f,!![]);}catch(_0x293400){return BPromise[_0xc513('0x22')](_0x293400);}return _0x7d0cbb[_0xc513('0x23')]();};}function saveUpdates(_0x3c8120,_0x28d28c){return function(_0xb6de65){if(_0xb6de65){return _0xb6de65['update'](_0x3c8120)['then'](function(_0x19d13c){return _0x19d13c;});}return null;};}function removeEntity(_0x4946bd,_0x57e330){return function(_0x280db1){if(_0x280db1){return _0x280db1[_0xc513('0x24')]()[_0xc513('0x25')](function(){_0x4946bd[_0xc513('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x535970,_0x9b7bc5){return function(_0x191bae){if(!_0x191bae){_0x535970['sendStatus'](0x194);}return _0x191bae;};}function handleError(_0x4fcca3,_0xb0b2b8){_0xb0b2b8=_0xb0b2b8||0x1f4;return function(_0x16a624){logger[_0xc513('0x26')](_0x16a624[_0xc513('0x27')]);if(_0x16a624[_0xc513('0x28')]){delete _0x16a624[_0xc513('0x28')];}_0x4fcca3[_0xc513('0x18')](_0xb0b2b8)[_0xc513('0x29')](_0x16a624);};}exports[_0xc513('0x2a')]=function(_0x2bd3f1,_0x22cabf){var _0x37d20a={},_0x11c205={},_0x512ee6={'count':0x0,'rows':[]};var _0x4ce5fc=_[_0xc513('0x2b')](db['ServicenowField'][_0xc513('0x2c')],function(_0x2a7be8){return{'name':_0x2a7be8['fieldName'],'type':_0x2a7be8[_0xc513('0x2d')][_0xc513('0x2e')]};});_0x11c205['model']=_[_0xc513('0x2b')](_0x4ce5fc,_0xc513('0x28'));_0x11c205[_0xc513('0x2f')]=_[_0xc513('0x30')](_0x2bd3f1[_0xc513('0x2f')]);_0x11c205[_0xc513('0x31')]=_[_0xc513('0x32')](_0x11c205[_0xc513('0x33')],_0x11c205[_0xc513('0x2f')]);_0x37d20a[_0xc513('0x34')]=_['intersection'](_0x11c205[_0xc513('0x33')],qs[_0xc513('0x35')](_0x2bd3f1['query'][_0xc513('0x35')]));_0x37d20a['attributes']=_0x37d20a[_0xc513('0x34')][_0xc513('0x36')]?_0x37d20a[_0xc513('0x34')]:_0x11c205[_0xc513('0x33')];if(!_0x2bd3f1['query'][_0xc513('0x37')]('nolimit')){_0x37d20a[_0xc513('0x1c')]=qs[_0xc513('0x1c')](_0x2bd3f1['query'][_0xc513('0x1c')]);_0x37d20a[_0xc513('0x1e')]=qs[_0xc513('0x1e')](_0x2bd3f1[_0xc513('0x2f')][_0xc513('0x1e')]);}_0x37d20a['order']=qs[_0xc513('0x38')](_0x2bd3f1['query'][_0xc513('0x38')]);_0x37d20a[_0xc513('0x39')]=qs[_0xc513('0x31')](_[_0xc513('0x3a')](_0x2bd3f1[_0xc513('0x2f')],_0x11c205[_0xc513('0x31')]),_0x4ce5fc);if(_0x2bd3f1['query'][_0xc513('0x3b')]){_0x37d20a[_0xc513('0x39')]=_[_0xc513('0x3c')](_0x37d20a['where'],{'$or':_[_0xc513('0x2b')](_0x4ce5fc,function(_0x3b213e){if(_0x3b213e[_0xc513('0x2d')]!==_0xc513('0x3d')){var _0x5cf077={};_0x5cf077[_0x3b213e[_0xc513('0x28')]]={'$like':'%'+_0x2bd3f1[_0xc513('0x2f')]['filter']+'%'};return _0x5cf077;}})});}_0x37d20a=_[_0xc513('0x3c')]({},_0x37d20a,_0x2bd3f1[_0xc513('0x3e')]);var _0x5513f6={'where':_0x37d20a['where']};return db[_0xc513('0x3f')][_0xc513('0x1d')](_0x5513f6)[_0xc513('0x25')](function(_0x17afde){_0x512ee6[_0xc513('0x1d')]=_0x17afde;if(_0x2bd3f1['query']['includeAll']){_0x37d20a[_0xc513('0x40')]=[{'all':!![]}];}return db[_0xc513('0x3f')][_0xc513('0x41')](_0x37d20a);})[_0xc513('0x25')](function(_0x191d8d){_0x512ee6[_0xc513('0x42')]=_0x191d8d;return _0x512ee6;})['then'](respondWithFilteredResult(_0x22cabf,_0x37d20a))[_0xc513('0x43')](handleError(_0x22cabf,null));};exports[_0xc513('0x44')]=function(_0x48ab22,_0x254abf){var _0x218097={'raw':!![],'where':{'id':_0x48ab22['params']['id']}},_0x542975={};_0x542975[_0xc513('0x33')]=_[_0xc513('0x30')](db['ServicenowField'][_0xc513('0x2c')]);_0x542975[_0xc513('0x2f')]=_[_0xc513('0x30')](_0x48ab22[_0xc513('0x2f')]);_0x542975[_0xc513('0x31')]=_[_0xc513('0x32')](_0x542975[_0xc513('0x33')],_0x542975[_0xc513('0x2f')]);_0x218097['attributes']=_[_0xc513('0x32')](_0x542975[_0xc513('0x33')],qs[_0xc513('0x35')](_0x48ab22[_0xc513('0x2f')][_0xc513('0x35')]));_0x218097[_0xc513('0x34')]=_0x218097[_0xc513('0x34')][_0xc513('0x36')]?_0x218097[_0xc513('0x34')]:_0x542975[_0xc513('0x33')];if(_0x48ab22[_0xc513('0x2f')][_0xc513('0x45')]){_0x218097[_0xc513('0x40')]=[{'all':!![]}];}_0x218097=_[_0xc513('0x3c')]({},_0x218097,_0x48ab22['options']);return db[_0xc513('0x3f')][_0xc513('0x46')](_0x218097)['then'](handleEntityNotFound(_0x254abf,null))[_0xc513('0x25')](respondWithResult(_0x254abf,null))[_0xc513('0x43')](handleError(_0x254abf,null));};exports[_0xc513('0x47')]=function(_0x1b0443,_0x134626){return db[_0xc513('0x3f')][_0xc513('0x47')](_0x1b0443[_0xc513('0x48')],{})[_0xc513('0x25')](respondWithResult(_0x134626,0xc9))['catch'](handleError(_0x134626,null));};exports[_0xc513('0x49')]=function(_0x326b69,_0x410ee5){if(_0x326b69['body']['id']){delete _0x326b69[_0xc513('0x48')]['id'];}return db[_0xc513('0x3f')][_0xc513('0x46')]({'where':{'id':_0x326b69[_0xc513('0x4a')]['id']}})[_0xc513('0x25')](handleEntityNotFound(_0x410ee5,null))[_0xc513('0x25')](saveUpdates(_0x326b69[_0xc513('0x48')],null))[_0xc513('0x25')](respondWithResult(_0x410ee5,null))[_0xc513('0x43')](handleError(_0x410ee5,null));};exports[_0xc513('0x24')]=function(_0x499e4,_0x390733){return db[_0xc513('0x3f')][_0xc513('0x46')]({'where':{'id':_0x499e4[_0xc513('0x4a')]['id']}})[_0xc513('0x25')](handleEntityNotFound(_0x390733,null))[_0xc513('0x25')](removeEntity(_0x390733,null))[_0xc513('0x43')](handleError(_0x390733,null));}; \ No newline at end of file +var _0x9061=['VIRTUAL','includeAll','rows','catch','params','options','find','create','body','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x3c4777,_0x24a938){var _0x573008=function(_0x43d3e4){while(--_0x43d3e4){_0x3c4777['push'](_0x3c4777['shift']());}};_0x573008(++_0x24a938);}(_0x9061,0x13d));var _0x1906=function(_0x506ff8,_0x34c4da){_0x506ff8=_0x506ff8-0x0;var _0x312f4e=_0x9061[_0x506ff8];return _0x312f4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1906('0x0'));var zipdir=require(_0x1906('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1906('0x2'));var moment=require('moment');var BPromise=require(_0x1906('0x3'));var Mustache=require('mustache');var util=require(_0x1906('0x4'));var path=require(_0x1906('0x5'));var sox=require(_0x1906('0x6'));var csv=require('to-csv');var ejs=require(_0x1906('0x7'));var fs=require('fs');var fs_extra=require(_0x1906('0x8'));var _=require(_0x1906('0x9'));var squel=require(_0x1906('0xa'));var crypto=require(_0x1906('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1906('0xc'));var toCsv=require(_0x1906('0xd'));var querystring=require(_0x1906('0xe'));var Papa=require(_0x1906('0xf'));var Redis=require(_0x1906('0x10'));var authService=require(_0x1906('0x11'));var qs=require(_0x1906('0x12'));var as=require(_0x1906('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1906('0x14'))(_0x1906('0x15'));var utils=require(_0x1906('0x16'));var config=require(_0x1906('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1906('0x18'))['db'];function respondWithStatusCode(_0x303f25,_0x158a09){_0x158a09=_0x158a09||0xcc;return function(_0x4793bd){if(_0x4793bd){return _0x303f25[_0x1906('0x19')](_0x158a09);}return _0x303f25[_0x1906('0x1a')](_0x158a09)['end']();};}function respondWithResult(_0x4ae989,_0x57aa8f){_0x57aa8f=_0x57aa8f||0xc8;return function(_0x5817e1){if(_0x5817e1){return _0x4ae989[_0x1906('0x1a')](_0x57aa8f)[_0x1906('0x1b')](_0x5817e1);}};}function respondWithFilteredResult(_0x4b56e4,_0xf82b44){return function(_0x53d041){if(_0x53d041){var _0x435b5e=typeof _0xf82b44[_0x1906('0x1c')]===_0x1906('0x1d')&&typeof _0xf82b44[_0x1906('0x1e')]===_0x1906('0x1d');var _0x5771f4=_0x53d041[_0x1906('0x1f')];var _0x520743=_0x435b5e?0x0:_0xf82b44[_0x1906('0x1c')];var _0x59395c=_0x435b5e?_0x53d041[_0x1906('0x1f')]:_0xf82b44[_0x1906('0x1c')]+_0xf82b44[_0x1906('0x1e')];var _0x3f4e07;if(_0x59395c>=_0x5771f4){_0x59395c=_0x5771f4;_0x3f4e07=0xc8;}else{_0x3f4e07=0xce;}_0x4b56e4[_0x1906('0x1a')](_0x3f4e07);return _0x4b56e4[_0x1906('0x20')](_0x1906('0x21'),_0x520743+'-'+_0x59395c+'/'+_0x5771f4)[_0x1906('0x1b')](_0x53d041);}return null;};}function patchUpdates(_0x33a411){return function(_0x140d1d){try{jsonpatch[_0x1906('0x22')](_0x140d1d,_0x33a411,!![]);}catch(_0xd94811){return BPromise[_0x1906('0x23')](_0xd94811);}return _0x140d1d[_0x1906('0x24')]();};}function saveUpdates(_0x3b7bea,_0x540c20){return function(_0x5a7556){if(_0x5a7556){return _0x5a7556[_0x1906('0x25')](_0x3b7bea)[_0x1906('0x26')](function(_0x50f4bd){return _0x50f4bd;});}return null;};}function removeEntity(_0x13bd35,_0x20fe94){return function(_0x221a48){if(_0x221a48){return _0x221a48[_0x1906('0x27')]()[_0x1906('0x26')](function(){_0x13bd35[_0x1906('0x1a')](0xcc)[_0x1906('0x28')]();});}};}function handleEntityNotFound(_0x203d4a,_0x790efb){return function(_0x6f3fe){if(!_0x6f3fe){_0x203d4a[_0x1906('0x19')](0x194);}return _0x6f3fe;};}function handleError(_0x20afc6,_0x4f61e7){_0x4f61e7=_0x4f61e7||0x1f4;return function(_0x448041){logger[_0x1906('0x29')](_0x448041[_0x1906('0x2a')]);if(_0x448041[_0x1906('0x2b')]){delete _0x448041[_0x1906('0x2b')];}_0x20afc6['status'](_0x4f61e7)[_0x1906('0x2c')](_0x448041);};}exports[_0x1906('0x2d')]=function(_0x611d59,_0x3d1c95){var _0x412ac0={},_0x9df4f7={},_0x5291b8={'count':0x0,'rows':[]};var _0x33578f=_[_0x1906('0x2e')](db[_0x1906('0x2f')][_0x1906('0x30')],function(_0x57d871){return{'name':_0x57d871[_0x1906('0x31')],'type':_0x57d871[_0x1906('0x32')][_0x1906('0x33')]};});_0x9df4f7[_0x1906('0x34')]=_[_0x1906('0x2e')](_0x33578f,_0x1906('0x2b'));_0x9df4f7[_0x1906('0x35')]=_[_0x1906('0x36')](_0x611d59[_0x1906('0x35')]);_0x9df4f7[_0x1906('0x37')]=_[_0x1906('0x38')](_0x9df4f7[_0x1906('0x34')],_0x9df4f7[_0x1906('0x35')]);_0x412ac0[_0x1906('0x39')]=_['intersection'](_0x9df4f7[_0x1906('0x34')],qs[_0x1906('0x3a')](_0x611d59['query']['fields']));_0x412ac0[_0x1906('0x39')]=_0x412ac0[_0x1906('0x39')][_0x1906('0x3b')]?_0x412ac0['attributes']:_0x9df4f7[_0x1906('0x34')];if(!_0x611d59[_0x1906('0x35')][_0x1906('0x3c')](_0x1906('0x3d'))){_0x412ac0['limit']=qs[_0x1906('0x1e')](_0x611d59[_0x1906('0x35')][_0x1906('0x1e')]);_0x412ac0[_0x1906('0x1c')]=qs[_0x1906('0x1c')](_0x611d59[_0x1906('0x35')][_0x1906('0x1c')]);}_0x412ac0[_0x1906('0x3e')]=qs[_0x1906('0x3f')](_0x611d59[_0x1906('0x35')][_0x1906('0x3f')]);_0x412ac0[_0x1906('0x40')]=qs[_0x1906('0x37')](_[_0x1906('0x41')](_0x611d59[_0x1906('0x35')],_0x9df4f7[_0x1906('0x37')]),_0x33578f);if(_0x611d59[_0x1906('0x35')][_0x1906('0x42')]){_0x412ac0['where']=_[_0x1906('0x43')](_0x412ac0[_0x1906('0x40')],{'$or':_[_0x1906('0x2e')](_0x33578f,function(_0x35385e){if(_0x35385e[_0x1906('0x32')]!==_0x1906('0x44')){var _0x14d8f7={};_0x14d8f7[_0x35385e['name']]={'$like':'%'+_0x611d59['query'][_0x1906('0x42')]+'%'};return _0x14d8f7;}})});}_0x412ac0=_[_0x1906('0x43')]({},_0x412ac0,_0x611d59['options']);var _0x4add2d={'where':_0x412ac0[_0x1906('0x40')]};return db[_0x1906('0x2f')][_0x1906('0x1f')](_0x4add2d)[_0x1906('0x26')](function(_0x6f69a3){_0x5291b8[_0x1906('0x1f')]=_0x6f69a3;if(_0x611d59['query'][_0x1906('0x45')]){_0x412ac0['include']=[{'all':!![]}];}return db[_0x1906('0x2f')]['findAll'](_0x412ac0);})[_0x1906('0x26')](function(_0x5893ff){_0x5291b8[_0x1906('0x46')]=_0x5893ff;return _0x5291b8;})['then'](respondWithFilteredResult(_0x3d1c95,_0x412ac0))[_0x1906('0x47')](handleError(_0x3d1c95,null));};exports['show']=function(_0x5a5449,_0x215a83){var _0x66b9a3={'raw':!![],'where':{'id':_0x5a5449[_0x1906('0x48')]['id']}},_0x569ec7={};_0x569ec7[_0x1906('0x34')]=_[_0x1906('0x36')](db[_0x1906('0x2f')][_0x1906('0x30')]);_0x569ec7[_0x1906('0x35')]=_[_0x1906('0x36')](_0x5a5449['query']);_0x569ec7[_0x1906('0x37')]=_['intersection'](_0x569ec7[_0x1906('0x34')],_0x569ec7[_0x1906('0x35')]);_0x66b9a3[_0x1906('0x39')]=_['intersection'](_0x569ec7[_0x1906('0x34')],qs['fields'](_0x5a5449[_0x1906('0x35')][_0x1906('0x3a')]));_0x66b9a3[_0x1906('0x39')]=_0x66b9a3[_0x1906('0x39')]['length']?_0x66b9a3[_0x1906('0x39')]:_0x569ec7[_0x1906('0x34')];if(_0x5a5449['query']['includeAll']){_0x66b9a3['include']=[{'all':!![]}];}_0x66b9a3=_[_0x1906('0x43')]({},_0x66b9a3,_0x5a5449[_0x1906('0x49')]);return db['ServicenowField'][_0x1906('0x4a')](_0x66b9a3)['then'](handleEntityNotFound(_0x215a83,null))[_0x1906('0x26')](respondWithResult(_0x215a83,null))[_0x1906('0x47')](handleError(_0x215a83,null));};exports['create']=function(_0x20bd04,_0x318c9b){return db[_0x1906('0x2f')][_0x1906('0x4b')](_0x20bd04[_0x1906('0x4c')],{})[_0x1906('0x26')](respondWithResult(_0x318c9b,0xc9))[_0x1906('0x47')](handleError(_0x318c9b,null));};exports['update']=function(_0x3d3b43,_0xc45897){if(_0x3d3b43[_0x1906('0x4c')]['id']){delete _0x3d3b43[_0x1906('0x4c')]['id'];}return db['ServicenowField'][_0x1906('0x4a')]({'where':{'id':_0x3d3b43[_0x1906('0x48')]['id']}})[_0x1906('0x26')](handleEntityNotFound(_0xc45897,null))['then'](saveUpdates(_0x3d3b43[_0x1906('0x4c')],null))[_0x1906('0x26')](respondWithResult(_0xc45897,null))['catch'](handleError(_0xc45897,null));};exports[_0x1906('0x27')]=function(_0x1f60b2,_0x577640){return db[_0x1906('0x2f')]['find']({'where':{'id':_0x1f60b2[_0x1906('0x48')]['id']}})[_0x1906('0x26')](handleEntityNotFound(_0x577640,null))[_0x1906('0x26')](removeEntity(_0x577640,null))[_0x1906('0x47')](handleError(_0x577640,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4c043ce..02a6999 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 _0xfe4a=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash'];(function(_0x5219fb,_0x5a69ee){var _0x30717b=function(_0x2861be){while(--_0x2861be){_0x5219fb['push'](_0x5219fb['shift']());}};_0x30717b(++_0x5a69ee);}(_0xfe4a,0x15e));var _0xafe4=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xfe4a[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0xafe4('0x0'));var util=require(_0xafe4('0x1'));var logger=require(_0xafe4('0x2'))('api');var moment=require(_0xafe4('0x3'));var BPromise=require(_0xafe4('0x4'));var rp=require(_0xafe4('0x5'));var fs=require('fs');var path=require(_0xafe4('0x6'));var rimraf=require(_0xafe4('0x7'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0xafe4('0x8')]=function(_0x5eb465,_0x4c3437){return _0x5eb465['define']('ServicenowField',attributes,{'tableName':_0xafe4('0x9'),'paranoid':![],'indexes':[{'name':_0xafe4('0xa'),'fields':[_0xafe4('0xb'),_0xafe4('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19f5=['util','moment','bluebird','request-promise','path','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash'];(function(_0xd6dd72,_0x495753){var _0xa712a2=function(_0x43f66f){while(--_0x43f66f){_0xd6dd72['push'](_0xd6dd72['shift']());}};_0xa712a2(++_0x495753);}(_0x19f5,0x103));var _0x519f=function(_0x5be692,_0x1aff5c){_0x5be692=_0x5be692-0x0;var _0x4e5793=_0x19f5[_0x5be692];return _0x4e5793;};'use strict';var _=require(_0x519f('0x0'));var util=require(_0x519f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x519f('0x2'));var BPromise=require(_0x519f('0x3'));var rp=require(_0x519f('0x4'));var fs=require('fs');var path=require(_0x519f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x519f('0x6'));module[_0x519f('0x7')]=function(_0xf80131,_0x39cad3){return _0xf80131[_0x519f('0x8')](_0x519f('0x9'),attributes,{'tableName':_0x519f('0xa'),'paranoid':![],'indexes':[{'name':_0x519f('0xb'),'fields':['idField',_0x519f('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 1ffa31d..f817df3 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x581e01,_0x241cbd){var _0x558b54=function(_0x22a370){while(--_0x22a370){_0x581e01['push'](_0x581e01['shift']());}};_0x558b54(++_0x241cbd);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5a4b94,_0x317630){_0x5a4b94=_0x5a4b94-0x0;var _0x270b41=_0xf4eb[_0x5a4b94];return _0x270b41;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0xda3f,0xec));var _0xfda3=function(_0x5189c2,_0x21acda){_0x5189c2=_0x5189c2-0x0;var _0x1d409e=_0xda3f[_0x5189c2];return _0x1d409e;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 55fed9d..7c1b4b1 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(_0x35fd48,_0x2ea2db){var _0x56027d=function(_0x5057e2){while(--_0x5057e2){_0x35fd48['push'](_0x35fd48['shift']());}};_0x56027d(++_0x2ea2db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x5b6525,_0xa7d197){var _0x1017c9=function(_0x1b6530){while(--_0x1b6530){_0x5b6525['push'](_0x5b6525['shift']());}};_0x1017c9(++_0xa7d197);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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 e08d983..eb5825e 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(_0x438416,_0x5d4ffb){var _0x305703=function(_0x526ac5){while(--_0x526ac5){_0x438416['push'](_0x438416['shift']());}};_0x305703(++_0x5d4ffb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x3f1ac5,_0x39e193){var _0x5856ca=function(_0xe1cc63){while(--_0xe1cc63){_0x3f1ac5['push'](_0x3f1ac5['shift']());}};_0x5856ca(++_0x39e193);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 67f9cdf..793e5b1 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 _0xd7c0=['SugarcrmConfiguration','sort','AccountId','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','remove','includes','endsWith','values','value','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filters','VIRTUAL','filter','merge','options','findAll','rows','catch','show','params','length','includeAll','create','body','find','getConfigurations','findOne'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0xd7c0,0x19a));var _0x0d7c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd7c0[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x0d7c('0x0'));var rimraf=require(_0x0d7c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d7c('0x2'));var rp=require(_0x0d7c('0x3'));var moment=require(_0x0d7c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d7c('0x5'));var path=require(_0x0d7c('0x6'));var sox=require(_0x0d7c('0x7'));var csv=require(_0x0d7c('0x8'));var ejs=require(_0x0d7c('0x9'));var fs=require('fs');var fs_extra=require(_0x0d7c('0xa'));var _=require(_0x0d7c('0xb'));var squel=require(_0x0d7c('0xc'));var crypto=require(_0x0d7c('0xd'));var jsforce=require(_0x0d7c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0d7c('0x8'));var querystring=require(_0x0d7c('0xf'));var Papa=require(_0x0d7c('0x10'));var Redis=require('ioredis');var authService=require(_0x0d7c('0x11'));var qs=require(_0x0d7c('0x12'));var as=require(_0x0d7c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d7c('0x14'))(_0x0d7c('0x15'));var utils=require(_0x0d7c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0d7c('0x17'));var db=require(_0x0d7c('0x18'))['db'];var integrations=require(_0x0d7c('0x19'));function respondWithStatusCode(_0x293c06,_0x38d2b7){_0x38d2b7=_0x38d2b7||0xcc;return function(_0x48ddec){if(_0x48ddec){return _0x293c06[_0x0d7c('0x1a')](_0x38d2b7);}return _0x293c06[_0x0d7c('0x1b')](_0x38d2b7)['end']();};}function respondWithResult(_0x405839,_0x8d0026){_0x8d0026=_0x8d0026||0xc8;return function(_0x19a19a){if(_0x19a19a){return _0x405839[_0x0d7c('0x1b')](_0x8d0026)[_0x0d7c('0x1c')](_0x19a19a);}};}function respondWithFilteredResult(_0x84afbf,_0x58e518){return function(_0x2c3fb6){if(_0x2c3fb6){var _0x3fb52e=typeof _0x58e518['offset']===_0x0d7c('0x1d')&&typeof _0x58e518[_0x0d7c('0x1e')]===_0x0d7c('0x1d');var _0x7566e5=_0x2c3fb6[_0x0d7c('0x1f')];var _0xaf0499=_0x3fb52e?0x0:_0x58e518[_0x0d7c('0x20')];var _0x2bdf6e=_0x3fb52e?_0x2c3fb6[_0x0d7c('0x1f')]:_0x58e518[_0x0d7c('0x20')]+_0x58e518['limit'];var _0x2a1fb6;if(_0x2bdf6e>=_0x7566e5){_0x2bdf6e=_0x7566e5;_0x2a1fb6=0xc8;}else{_0x2a1fb6=0xce;}_0x84afbf[_0x0d7c('0x1b')](_0x2a1fb6);return _0x84afbf[_0x0d7c('0x21')](_0x0d7c('0x22'),_0xaf0499+'-'+_0x2bdf6e+'/'+_0x7566e5)['json'](_0x2c3fb6);}return null;};}function patchUpdates(_0x31dcef){return function(_0x1a2d78){try{jsonpatch[_0x0d7c('0x23')](_0x1a2d78,_0x31dcef,!![]);}catch(_0x2e8709){return BPromise[_0x0d7c('0x24')](_0x2e8709);}return _0x1a2d78[_0x0d7c('0x25')]();};}function saveUpdates(_0x11367b,_0x4aa9b4){return function(_0x1fe218){if(_0x1fe218){return _0x1fe218[_0x0d7c('0x26')](_0x11367b)[_0x0d7c('0x27')](function(_0x32b376){return _0x32b376;});}return null;};}function removeEntity(_0x45af84,_0xc132f9){return function(_0x2f8947){if(_0x2f8947){return _0x2f8947[_0x0d7c('0x28')]()[_0x0d7c('0x27')](function(){_0x45af84[_0x0d7c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a454e,_0x4e35aa){return function(_0x134382){if(!_0x134382){_0x3a454e[_0x0d7c('0x1a')](0x194);}return _0x134382;};}function handleError(_0x44eb3d,_0x536eb1){_0x536eb1=_0x536eb1||0x1f4;return function(_0x5421e5){logger[_0x0d7c('0x29')](_0x5421e5[_0x0d7c('0x2a')]);if(_0x5421e5[_0x0d7c('0x2b')]){delete _0x5421e5[_0x0d7c('0x2b')];}_0x44eb3d[_0x0d7c('0x1b')](_0x536eb1)[_0x0d7c('0x2c')](_0x5421e5);};}exports['index']=function(_0x2d67f5,_0x36a1a4){var _0x635b0f={},_0x2f47cd={},_0x453303={'count':0x0,'rows':[]};var _0x3284aa=_[_0x0d7c('0x2d')](db[_0x0d7c('0x2e')][_0x0d7c('0x2f')],function(_0x5b1e58){return{'name':_0x5b1e58[_0x0d7c('0x30')],'type':_0x5b1e58[_0x0d7c('0x31')]['key']};});_0x2f47cd[_0x0d7c('0x32')]=_['map'](_0x3284aa,'name');_0x2f47cd['query']=_[_0x0d7c('0x33')](_0x2d67f5[_0x0d7c('0x34')]);_0x2f47cd['filters']=_[_0x0d7c('0x35')](_0x2f47cd[_0x0d7c('0x32')],_0x2f47cd['query']);_0x635b0f[_0x0d7c('0x36')]=_[_0x0d7c('0x35')](_0x2f47cd[_0x0d7c('0x32')],qs['fields'](_0x2d67f5[_0x0d7c('0x34')][_0x0d7c('0x37')]));_0x635b0f[_0x0d7c('0x36')]=_0x635b0f[_0x0d7c('0x36')]['length']?_0x635b0f[_0x0d7c('0x36')]:_0x2f47cd[_0x0d7c('0x32')];if(!_0x2d67f5[_0x0d7c('0x34')][_0x0d7c('0x38')](_0x0d7c('0x39'))){_0x635b0f[_0x0d7c('0x1e')]=qs[_0x0d7c('0x1e')](_0x2d67f5[_0x0d7c('0x34')]['limit']);_0x635b0f['offset']=qs[_0x0d7c('0x20')](_0x2d67f5[_0x0d7c('0x34')]['offset']);}_0x635b0f[_0x0d7c('0x3a')]=qs['sort'](_0x2d67f5[_0x0d7c('0x34')]['sort']);_0x635b0f[_0x0d7c('0x3b')]=qs['filters'](_[_0x0d7c('0x3c')](_0x2d67f5[_0x0d7c('0x34')],_0x2f47cd[_0x0d7c('0x3d')]),_0x3284aa);if(_0x2d67f5[_0x0d7c('0x34')]['filter']){_0x635b0f[_0x0d7c('0x3b')]=_['merge'](_0x635b0f['where'],{'$or':_[_0x0d7c('0x2d')](_0x3284aa,function(_0x48c7c7){if(_0x48c7c7[_0x0d7c('0x31')]!==_0x0d7c('0x3e')){var _0x57acaf={};_0x57acaf[_0x48c7c7[_0x0d7c('0x2b')]]={'$like':'%'+_0x2d67f5[_0x0d7c('0x34')][_0x0d7c('0x3f')]+'%'};return _0x57acaf;}})});}_0x635b0f=_[_0x0d7c('0x40')]({},_0x635b0f,_0x2d67f5[_0x0d7c('0x41')]);var _0x3b037b={'where':_0x635b0f[_0x0d7c('0x3b')]};return db[_0x0d7c('0x2e')][_0x0d7c('0x1f')](_0x3b037b)['then'](function(_0x3dff42){_0x453303[_0x0d7c('0x1f')]=_0x3dff42;if(_0x2d67f5[_0x0d7c('0x34')]['includeAll']){_0x635b0f['include']=[{'all':!![]}];}return db[_0x0d7c('0x2e')][_0x0d7c('0x42')](_0x635b0f);})[_0x0d7c('0x27')](function(_0x2b23f1){_0x453303[_0x0d7c('0x43')]=_0x2b23f1;return _0x453303;})['then'](respondWithFilteredResult(_0x36a1a4,_0x635b0f))[_0x0d7c('0x44')](handleError(_0x36a1a4,null));};exports[_0x0d7c('0x45')]=function(_0x2be574,_0x2ec3c9){var _0x1f97f5={'raw':![],'where':{'id':_0x2be574[_0x0d7c('0x46')]['id']}},_0xbdbaac={};_0xbdbaac[_0x0d7c('0x32')]=_[_0x0d7c('0x33')](db[_0x0d7c('0x2e')][_0x0d7c('0x2f')]);_0xbdbaac[_0x0d7c('0x34')]=_['keys'](_0x2be574['query']);_0xbdbaac[_0x0d7c('0x3d')]=_['intersection'](_0xbdbaac[_0x0d7c('0x32')],_0xbdbaac[_0x0d7c('0x34')]);_0x1f97f5['attributes']=_[_0x0d7c('0x35')](_0xbdbaac['model'],qs['fields'](_0x2be574['query'][_0x0d7c('0x37')]));_0x1f97f5[_0x0d7c('0x36')]=_0x1f97f5[_0x0d7c('0x36')][_0x0d7c('0x47')]?_0x1f97f5[_0x0d7c('0x36')]:_0xbdbaac[_0x0d7c('0x32')];if(_0x2be574['query'][_0x0d7c('0x48')]){_0x1f97f5['include']=[{'all':!![]}];}_0x1f97f5=_['merge']({},_0x1f97f5,_0x2be574['options']);return db['SugarcrmAccount']['find'](_0x1f97f5)[_0x0d7c('0x27')](handleEntityNotFound(_0x2ec3c9,null))[_0x0d7c('0x27')](respondWithResult(_0x2ec3c9,null))[_0x0d7c('0x44')](handleError(_0x2ec3c9,null));};exports['create']=function(_0xe3487b,_0x5cc92e){return db[_0x0d7c('0x2e')][_0x0d7c('0x49')](_0xe3487b[_0x0d7c('0x4a')],{})[_0x0d7c('0x27')](respondWithResult(_0x5cc92e,0xc9))[_0x0d7c('0x44')](handleError(_0x5cc92e,null));};exports[_0x0d7c('0x26')]=function(_0x48c70e,_0x32a126){if(_0x48c70e[_0x0d7c('0x4a')]['id']){delete _0x48c70e[_0x0d7c('0x4a')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x48c70e[_0x0d7c('0x46')]['id']}})[_0x0d7c('0x27')](handleEntityNotFound(_0x32a126,null))['then'](saveUpdates(_0x48c70e[_0x0d7c('0x4a')],null))[_0x0d7c('0x27')](respondWithResult(_0x32a126,null))[_0x0d7c('0x44')](handleError(_0x32a126,null));};exports[_0x0d7c('0x28')]=function(_0x27b105,_0x656815){return db[_0x0d7c('0x2e')][_0x0d7c('0x4b')]({'where':{'id':_0x27b105[_0x0d7c('0x46')]['id']}})[_0x0d7c('0x27')](handleEntityNotFound(_0x656815,null))['then'](removeEntity(_0x656815,null))[_0x0d7c('0x44')](handleError(_0x656815,null));};exports[_0x0d7c('0x4c')]=function(_0x583c2d,_0x3cca6f,_0x1a66e4){var _0x4e4dd1={};var _0x218535={};var _0x1f4ef0;var _0xc0b75e;return db['SugarcrmAccount'][_0x0d7c('0x4d')]({'where':{'id':_0x583c2d[_0x0d7c('0x46')]['id']}})[_0x0d7c('0x27')](handleEntityNotFound(_0x3cca6f,null))['then'](function(_0x360f86){if(_0x360f86){_0x1f4ef0=_0x360f86;_0x218535[_0x0d7c('0x32')]=_['keys'](db[_0x0d7c('0x4e')]['rawAttributes']);_0x218535[_0x0d7c('0x34')]=_['keys'](_0x583c2d[_0x0d7c('0x34')]);_0x218535[_0x0d7c('0x3d')]=_[_0x0d7c('0x35')](_0x218535[_0x0d7c('0x32')],_0x218535[_0x0d7c('0x34')]);_0x4e4dd1[_0x0d7c('0x36')]=_[_0x0d7c('0x35')](_0x218535[_0x0d7c('0x32')],qs[_0x0d7c('0x37')](_0x583c2d[_0x0d7c('0x34')][_0x0d7c('0x37')]));_0x4e4dd1[_0x0d7c('0x36')]=_0x4e4dd1[_0x0d7c('0x36')][_0x0d7c('0x47')]?_0x4e4dd1[_0x0d7c('0x36')]:_0x218535[_0x0d7c('0x32')];_0x4e4dd1[_0x0d7c('0x3a')]=qs[_0x0d7c('0x4f')](_0x583c2d['query'][_0x0d7c('0x4f')]);_0x4e4dd1[_0x0d7c('0x3b')]=qs[_0x0d7c('0x3d')](_[_0x0d7c('0x3c')](_0x583c2d['query'],_0x218535[_0x0d7c('0x3d')]));if(_0x583c2d[_0x0d7c('0x34')][_0x0d7c('0x3f')]){_0x4e4dd1[_0x0d7c('0x3b')]=_[_0x0d7c('0x40')](_0x4e4dd1[_0x0d7c('0x3b')],{'$or':_[_0x0d7c('0x2d')](_0x4e4dd1[_0x0d7c('0x36')],function(_0x31e883){var _0x1502b3={};_0x1502b3[_0x31e883]={'$like':'%'+_0x583c2d['query']['filter']+'%'};return _0x1502b3;})});}_0x4e4dd1=_[_0x0d7c('0x40')]({},_0x4e4dd1,_0x583c2d[_0x0d7c('0x41')]);return _0x1f4ef0['getConfigurations'](_0x4e4dd1);}})[_0x0d7c('0x27')](function(_0x15a7d7){if(_0x15a7d7){_0xc0b75e=_0x15a7d7[_0x0d7c('0x47')];if(!_0x583c2d[_0x0d7c('0x34')][_0x0d7c('0x38')](_0x0d7c('0x39'))){_0x4e4dd1[_0x0d7c('0x1e')]=qs[_0x0d7c('0x1e')](_0x583c2d[_0x0d7c('0x34')][_0x0d7c('0x1e')]);_0x4e4dd1[_0x0d7c('0x20')]=qs['offset'](_0x583c2d[_0x0d7c('0x34')]['offset']);}return _0x1f4ef0[_0x0d7c('0x4c')](_0x4e4dd1);}})['then'](function(_0x258b82){if(_0x258b82){return _0x258b82?{'count':_0xc0b75e,'rows':_0x258b82}:null;}})['then'](respondWithResult(_0x3cca6f,null))[_0x0d7c('0x44')](handleError(_0x3cca6f,null));};exports['addConfiguration']=function(_0x348fa4,_0x596338,_0x19a021){if(_0x348fa4['body']['id']){delete _0x348fa4[_0x0d7c('0x4a')]['id'];}return db[_0x0d7c('0x2e')]['findOne']({'where':{'id':_0x348fa4[_0x0d7c('0x46')]['id']}})[_0x0d7c('0x27')](handleEntityNotFound(_0x596338,null))[_0x0d7c('0x27')](function(_0x24cf1d){if(_0x24cf1d){_0x348fa4[_0x0d7c('0x4a')][_0x0d7c('0x50')]=_0x24cf1d['id'];_0x348fa4['body'][_0x0d7c('0x51')]=integrations['getSubjects'](_0x348fa4['body'][_0x0d7c('0x52')],_0x348fa4[_0x0d7c('0x4a')][_0x0d7c('0x31')]);_0x348fa4['body']['Descriptions']=integrations[_0x0d7c('0x53')](_0x348fa4[_0x0d7c('0x4a')][_0x0d7c('0x52')],_0x348fa4['body'][_0x0d7c('0x31')]);return db[_0x0d7c('0x4e')][_0x0d7c('0x49')](_0x348fa4[_0x0d7c('0x4a')],{'include':[{'model':db['SugarcrmField'],'as':_0x0d7c('0x51')},{'model':db[_0x0d7c('0x54')],'as':_0x0d7c('0x55')}]});}return null;})[_0x0d7c('0x27')](respondWithResult(_0x596338,null))[_0x0d7c('0x44')](handleError(_0x596338,null));};exports[_0x0d7c('0x56')]=function(_0x4a8dfd,_0x416476,_0x5f2ee5){var _0x39c756='';var _0x5d6f0d=['id',_0x0d7c('0x2b'),_0x0d7c('0x57'),_0x0d7c('0x58'),'description',_0x0d7c('0x59'),_0x0d7c('0x5a'),_0x0d7c('0x5b'),_0x0d7c('0x5c'),_0x0d7c('0x5d'),_0x0d7c('0x5e'),_0x0d7c('0x5f')];return db[_0x0d7c('0x2e')][_0x0d7c('0x4d')]({'where':{'id':_0x4a8dfd[_0x0d7c('0x46')]['id']},'attributes':['id','username',_0x0d7c('0x60'),_0x0d7c('0x61')]})[_0x0d7c('0x27')](handleEntityNotFound(_0x416476,null))[_0x0d7c('0x27')](function(_0x514428){if(_0x514428){_0x39c756=_0x514428['remoteUri'];var _0x27936e=_0x39c756[_0x0d7c('0x62')](-0x1);if(_0x27936e==='/'){_0x39c756=_0x39c756[_0x0d7c('0x63')](0x0,_0x39c756[_0x0d7c('0x64')](_0x27936e));}return rp({'method':'POST','uri':util[_0x0d7c('0x65')](_0x0d7c('0x66'),_0x39c756,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0d7c('0x67'),'input_type':_0x0d7c('0x68'),'response_type':'JSON','rest_data':JSON[_0x0d7c('0x69')]({'user_auth':{'user_name':_0x514428['username'],'password':_0x514428[_0x0d7c('0x60')],'encryption':_0x0d7c('0x6a')},'application':_0x0d7c('0x6b')})}});}})[_0x0d7c('0x27')](function(_0x3df5b7){if(_0x3df5b7&&_0x3df5b7[_0x0d7c('0x2b')]!==_0x0d7c('0x6c')&&_0x3df5b7[_0x0d7c('0x2b')]!==_0x0d7c('0x6d')){return rp({'method':_0x0d7c('0x6e'),'uri':util[_0x0d7c('0x65')]('%s%s',_0x39c756,_0x0d7c('0x6f')),'json':!![],'form':{'method':_0x0d7c('0x70'),'input_type':_0x0d7c('0x68'),'response_type':'JSON','rest_data':JSON[_0x0d7c('0x69')]({'session':_0x3df5b7['id'],'module_name':_0x0d7c('0x71')})}})[_0x0d7c('0x27')](function(_0x4e591){if(_0x4e591){var _0x4580e2=_['values'](_0x4e591[_0x0d7c('0x72')]);_[_0x0d7c('0x73')](_0x4580e2,function(_0x3fd56c){return _0x5d6f0d[_0x0d7c('0x74')](_0x3fd56c[_0x0d7c('0x2b')]);});return{'count':_0x4580e2[_0x0d7c('0x47')],'rows':_['map'](_0x4580e2,function(_0x43d879){return{'id':_0x43d879[_0x0d7c('0x2b')],'name':_0x43d879['label'],'custom':_[_0x0d7c('0x75')](_0x43d879[_0x0d7c('0x2b')],'_c')?!![]:![],'options':_0x43d879[_0x0d7c('0x41')]?_['map'](_[_0x0d7c('0x76')](_0x43d879['options']),function(_0xfbd3be){return{'name':_0xfbd3be[_0x0d7c('0x77')],'value':_0xfbd3be['name']};}):[]};})};}})[_0x0d7c('0x27')](respondWithResult(_0x416476,null))[_0x0d7c('0x44')](function(_0xf0be7d){var _0x35acd5=_0x4a8dfd['query']['test']?0x1f4:_0xf0be7d[_0x0d7c('0x78')]||0x1f4;logger[_0x0d7c('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x0d7c('0x56'),_0x35acd5,JSON[_0x0d7c('0x69')](_0xf0be7d));delete _0xf0be7d[_0x0d7c('0x2b')];if(_0x35acd5===0x191){_0x35acd5=0x190;}_0x416476[_0x0d7c('0x1b')](_0x35acd5)[_0x0d7c('0x2c')](_0x4a8dfd[_0x0d7c('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xf0be7d[_0x0d7c('0x78')]}:_0xf0be7d);});}else{var _0x5452be=0x1f4;_0x416476[_0x0d7c('0x1b')](_0x5452be)[_0x0d7c('0x2c')]({'message':_0x0d7c('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x21fc=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','update','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','SugarcrmField','getFields','assigned_user_id','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Calls','values','remove','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x25b26d,_0x2a6610){var _0xda3c58=function(_0x552d0e){while(--_0x552d0e){_0x25b26d['push'](_0x25b26d['shift']());}};_0xda3c58(++_0x2a6610);}(_0x21fc,0x130));var _0xc21f=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x21fc[_0x4c184d];return _0x23d997;};'use strict';var emlformat=require(_0xc21f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc21f('0x1'));var jsonpatch=require(_0xc21f('0x2'));var rp=require(_0xc21f('0x3'));var moment=require(_0xc21f('0x4'));var BPromise=require(_0xc21f('0x5'));var Mustache=require(_0xc21f('0x6'));var util=require(_0xc21f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc21f('0x8'));var ejs=require(_0xc21f('0x9'));var fs=require('fs');var fs_extra=require(_0xc21f('0xa'));var _=require('lodash');var squel=require(_0xc21f('0xb'));var crypto=require(_0xc21f('0xc'));var jsforce=require(_0xc21f('0xd'));var deskjs=require(_0xc21f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc21f('0xf'));var Papa=require('papaparse');var Redis=require(_0xc21f('0x10'));var authService=require(_0xc21f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc21f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc21f('0x13'))('api');var utils=require(_0xc21f('0x14'));var config=require(_0xc21f('0x15'));var licenseUtil=require(_0xc21f('0x16'));var db=require(_0xc21f('0x17'))['db'];var integrations=require(_0xc21f('0x18'));function respondWithStatusCode(_0x35a13c,_0x162bcf){_0x162bcf=_0x162bcf||0xcc;return function(_0x3cc5e8){if(_0x3cc5e8){return _0x35a13c[_0xc21f('0x19')](_0x162bcf);}return _0x35a13c[_0xc21f('0x1a')](_0x162bcf)[_0xc21f('0x1b')]();};}function respondWithResult(_0x3551b1,_0x51cc21){_0x51cc21=_0x51cc21||0xc8;return function(_0x1b83b9){if(_0x1b83b9){return _0x3551b1[_0xc21f('0x1a')](_0x51cc21)[_0xc21f('0x1c')](_0x1b83b9);}};}function respondWithFilteredResult(_0x2dac4a,_0x39517e){return function(_0xf38d31){if(_0xf38d31){var _0xfcb025=typeof _0x39517e[_0xc21f('0x1d')]===_0xc21f('0x1e')&&typeof _0x39517e[_0xc21f('0x1f')]==='undefined';var _0x3713ab=_0xf38d31[_0xc21f('0x20')];var _0x2bf0c7=_0xfcb025?0x0:_0x39517e[_0xc21f('0x1d')];var _0x417a35=_0xfcb025?_0xf38d31['count']:_0x39517e['offset']+_0x39517e['limit'];var _0xa0cff;if(_0x417a35>=_0x3713ab){_0x417a35=_0x3713ab;_0xa0cff=0xc8;}else{_0xa0cff=0xce;}_0x2dac4a[_0xc21f('0x1a')](_0xa0cff);return _0x2dac4a[_0xc21f('0x21')](_0xc21f('0x22'),_0x2bf0c7+'-'+_0x417a35+'/'+_0x3713ab)[_0xc21f('0x1c')](_0xf38d31);}return null;};}function patchUpdates(_0x408fa7){return function(_0x98f61d){try{jsonpatch[_0xc21f('0x23')](_0x98f61d,_0x408fa7,!![]);}catch(_0x17567f){return BPromise[_0xc21f('0x24')](_0x17567f);}return _0x98f61d[_0xc21f('0x25')]();};}function saveUpdates(_0x2f0628,_0x2a5d46){return function(_0x5b91ba){if(_0x5b91ba){return _0x5b91ba['update'](_0x2f0628)[_0xc21f('0x26')](function(_0x5d91f5){return _0x5d91f5;});}return null;};}function removeEntity(_0x22f31e,_0x5099d7){return function(_0x147b84){if(_0x147b84){return _0x147b84['destroy']()[_0xc21f('0x26')](function(){_0x22f31e['status'](0xcc)[_0xc21f('0x1b')]();});}};}function handleEntityNotFound(_0x5e46a0,_0x127072){return function(_0x3b996e){if(!_0x3b996e){_0x5e46a0['sendStatus'](0x194);}return _0x3b996e;};}function handleError(_0x73229,_0x2647ee){_0x2647ee=_0x2647ee||0x1f4;return function(_0x4d897b){logger[_0xc21f('0x27')](_0x4d897b[_0xc21f('0x28')]);if(_0x4d897b[_0xc21f('0x29')]){delete _0x4d897b['name'];}_0x73229[_0xc21f('0x1a')](_0x2647ee)[_0xc21f('0x2a')](_0x4d897b);};}exports[_0xc21f('0x2b')]=function(_0x3f59b4,_0x33e40a){var _0x3c2ac1={},_0x23d8d0={},_0x3c2783={'count':0x0,'rows':[]};var _0x18748d=_[_0xc21f('0x2c')](db[_0xc21f('0x2d')][_0xc21f('0x2e')],function(_0x4c14cf){return{'name':_0x4c14cf[_0xc21f('0x2f')],'type':_0x4c14cf[_0xc21f('0x30')][_0xc21f('0x31')]};});_0x23d8d0[_0xc21f('0x32')]=_['map'](_0x18748d,'name');_0x23d8d0[_0xc21f('0x33')]=_[_0xc21f('0x34')](_0x3f59b4[_0xc21f('0x33')]);_0x23d8d0[_0xc21f('0x35')]=_[_0xc21f('0x36')](_0x23d8d0[_0xc21f('0x32')],_0x23d8d0[_0xc21f('0x33')]);_0x3c2ac1['attributes']=_[_0xc21f('0x36')](_0x23d8d0[_0xc21f('0x32')],qs[_0xc21f('0x37')](_0x3f59b4[_0xc21f('0x33')][_0xc21f('0x37')]));_0x3c2ac1[_0xc21f('0x38')]=_0x3c2ac1[_0xc21f('0x38')][_0xc21f('0x39')]?_0x3c2ac1[_0xc21f('0x38')]:_0x23d8d0[_0xc21f('0x32')];if(!_0x3f59b4[_0xc21f('0x33')][_0xc21f('0x3a')](_0xc21f('0x3b'))){_0x3c2ac1['limit']=qs[_0xc21f('0x1f')](_0x3f59b4[_0xc21f('0x33')][_0xc21f('0x1f')]);_0x3c2ac1['offset']=qs['offset'](_0x3f59b4[_0xc21f('0x33')][_0xc21f('0x1d')]);}_0x3c2ac1['order']=qs['sort'](_0x3f59b4[_0xc21f('0x33')][_0xc21f('0x3c')]);_0x3c2ac1[_0xc21f('0x3d')]=qs[_0xc21f('0x35')](_['pick'](_0x3f59b4['query'],_0x23d8d0['filters']),_0x18748d);if(_0x3f59b4[_0xc21f('0x33')][_0xc21f('0x3e')]){_0x3c2ac1['where']=_[_0xc21f('0x3f')](_0x3c2ac1['where'],{'$or':_[_0xc21f('0x2c')](_0x18748d,function(_0x1924df){if(_0x1924df[_0xc21f('0x30')]!==_0xc21f('0x40')){var _0x2cf1df={};_0x2cf1df[_0x1924df[_0xc21f('0x29')]]={'$like':'%'+_0x3f59b4[_0xc21f('0x33')][_0xc21f('0x3e')]+'%'};return _0x2cf1df;}})});}_0x3c2ac1=_[_0xc21f('0x3f')]({},_0x3c2ac1,_0x3f59b4[_0xc21f('0x41')]);var _0x2fad9a={'where':_0x3c2ac1[_0xc21f('0x3d')]};return db[_0xc21f('0x2d')][_0xc21f('0x20')](_0x2fad9a)[_0xc21f('0x26')](function(_0x121e4a){_0x3c2783[_0xc21f('0x20')]=_0x121e4a;if(_0x3f59b4[_0xc21f('0x33')][_0xc21f('0x42')]){_0x3c2ac1[_0xc21f('0x43')]=[{'all':!![]}];}return db[_0xc21f('0x2d')]['findAll'](_0x3c2ac1);})[_0xc21f('0x26')](function(_0x1551c6){_0x3c2783[_0xc21f('0x44')]=_0x1551c6;return _0x3c2783;})[_0xc21f('0x26')](respondWithFilteredResult(_0x33e40a,_0x3c2ac1))[_0xc21f('0x45')](handleError(_0x33e40a,null));};exports[_0xc21f('0x46')]=function(_0x3dfd93,_0x5d8f3a){var _0xaa5fb8={'raw':![],'where':{'id':_0x3dfd93[_0xc21f('0x47')]['id']}},_0xb45baf={};_0xb45baf[_0xc21f('0x32')]=_[_0xc21f('0x34')](db['SugarcrmAccount']['rawAttributes']);_0xb45baf[_0xc21f('0x33')]=_[_0xc21f('0x34')](_0x3dfd93['query']);_0xb45baf['filters']=_[_0xc21f('0x36')](_0xb45baf[_0xc21f('0x32')],_0xb45baf[_0xc21f('0x33')]);_0xaa5fb8[_0xc21f('0x38')]=_['intersection'](_0xb45baf[_0xc21f('0x32')],qs[_0xc21f('0x37')](_0x3dfd93[_0xc21f('0x33')][_0xc21f('0x37')]));_0xaa5fb8[_0xc21f('0x38')]=_0xaa5fb8[_0xc21f('0x38')]['length']?_0xaa5fb8[_0xc21f('0x38')]:_0xb45baf[_0xc21f('0x32')];if(_0x3dfd93[_0xc21f('0x33')][_0xc21f('0x42')]){_0xaa5fb8[_0xc21f('0x43')]=[{'all':!![]}];}_0xaa5fb8=_[_0xc21f('0x3f')]({},_0xaa5fb8,_0x3dfd93[_0xc21f('0x41')]);return db[_0xc21f('0x2d')][_0xc21f('0x48')](_0xaa5fb8)['then'](handleEntityNotFound(_0x5d8f3a,null))[_0xc21f('0x26')](respondWithResult(_0x5d8f3a,null))[_0xc21f('0x45')](handleError(_0x5d8f3a,null));};exports[_0xc21f('0x49')]=function(_0x495bd7,_0x271bcb){return db[_0xc21f('0x2d')][_0xc21f('0x49')](_0x495bd7['body'],{})['then'](respondWithResult(_0x271bcb,0xc9))[_0xc21f('0x45')](handleError(_0x271bcb,null));};exports[_0xc21f('0x4a')]=function(_0x5d4409,_0x3ff49a){if(_0x5d4409[_0xc21f('0x4b')]['id']){delete _0x5d4409[_0xc21f('0x4b')]['id'];}return db['SugarcrmAccount'][_0xc21f('0x48')]({'where':{'id':_0x5d4409[_0xc21f('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ff49a,null))[_0xc21f('0x26')](saveUpdates(_0x5d4409[_0xc21f('0x4b')],null))[_0xc21f('0x26')](respondWithResult(_0x3ff49a,null))[_0xc21f('0x45')](handleError(_0x3ff49a,null));};exports[_0xc21f('0x4c')]=function(_0x17318e,_0x41e67e){return db[_0xc21f('0x2d')][_0xc21f('0x48')]({'where':{'id':_0x17318e['params']['id']}})['then'](handleEntityNotFound(_0x41e67e,null))[_0xc21f('0x26')](removeEntity(_0x41e67e,null))[_0xc21f('0x45')](handleError(_0x41e67e,null));};exports[_0xc21f('0x4d')]=function(_0xbee424,_0x57e344,_0x13c497){var _0x45f75d={};var _0x2ec05d={};var _0x990f57;var _0x57f3f3;return db[_0xc21f('0x2d')][_0xc21f('0x4e')]({'where':{'id':_0xbee424['params']['id']}})['then'](handleEntityNotFound(_0x57e344,null))['then'](function(_0x1fa42a){if(_0x1fa42a){_0x990f57=_0x1fa42a;_0x2ec05d[_0xc21f('0x32')]=_[_0xc21f('0x34')](db[_0xc21f('0x4f')][_0xc21f('0x2e')]);_0x2ec05d[_0xc21f('0x33')]=_[_0xc21f('0x34')](_0xbee424[_0xc21f('0x33')]);_0x2ec05d[_0xc21f('0x35')]=_[_0xc21f('0x36')](_0x2ec05d['model'],_0x2ec05d[_0xc21f('0x33')]);_0x45f75d[_0xc21f('0x38')]=_['intersection'](_0x2ec05d['model'],qs[_0xc21f('0x37')](_0xbee424['query'][_0xc21f('0x37')]));_0x45f75d[_0xc21f('0x38')]=_0x45f75d['attributes'][_0xc21f('0x39')]?_0x45f75d[_0xc21f('0x38')]:_0x2ec05d[_0xc21f('0x32')];_0x45f75d[_0xc21f('0x50')]=qs['sort'](_0xbee424[_0xc21f('0x33')][_0xc21f('0x3c')]);_0x45f75d[_0xc21f('0x3d')]=qs[_0xc21f('0x35')](_[_0xc21f('0x51')](_0xbee424[_0xc21f('0x33')],_0x2ec05d[_0xc21f('0x35')]));if(_0xbee424[_0xc21f('0x33')][_0xc21f('0x3e')]){_0x45f75d[_0xc21f('0x3d')]=_[_0xc21f('0x3f')](_0x45f75d[_0xc21f('0x3d')],{'$or':_[_0xc21f('0x2c')](_0x45f75d[_0xc21f('0x38')],function(_0x2361f0){var _0x4767e8={};_0x4767e8[_0x2361f0]={'$like':'%'+_0xbee424[_0xc21f('0x33')]['filter']+'%'};return _0x4767e8;})});}_0x45f75d=_[_0xc21f('0x3f')]({},_0x45f75d,_0xbee424['options']);return _0x990f57[_0xc21f('0x4d')](_0x45f75d);}})['then'](function(_0x2647e6){if(_0x2647e6){_0x57f3f3=_0x2647e6[_0xc21f('0x39')];if(!_0xbee424[_0xc21f('0x33')]['hasOwnProperty'](_0xc21f('0x3b'))){_0x45f75d[_0xc21f('0x1f')]=qs[_0xc21f('0x1f')](_0xbee424['query'][_0xc21f('0x1f')]);_0x45f75d[_0xc21f('0x1d')]=qs['offset'](_0xbee424['query']['offset']);}return _0x990f57[_0xc21f('0x4d')](_0x45f75d);}})[_0xc21f('0x26')](function(_0x4ce195){if(_0x4ce195){return _0x4ce195?{'count':_0x57f3f3,'rows':_0x4ce195}:null;}})[_0xc21f('0x26')](respondWithResult(_0x57e344,null))[_0xc21f('0x45')](handleError(_0x57e344,null));};exports[_0xc21f('0x52')]=function(_0x2496d6,_0x529369,_0x6789e){if(_0x2496d6['body']['id']){delete _0x2496d6['body']['id'];}return db[_0xc21f('0x2d')]['findOne']({'where':{'id':_0x2496d6[_0xc21f('0x47')]['id']}})[_0xc21f('0x26')](handleEntityNotFound(_0x529369,null))['then'](function(_0x436eba){if(_0x436eba){_0x2496d6[_0xc21f('0x4b')][_0xc21f('0x53')]=_0x436eba['id'];_0x2496d6[_0xc21f('0x4b')][_0xc21f('0x54')]=integrations[_0xc21f('0x55')](_0x2496d6[_0xc21f('0x4b')][_0xc21f('0x56')],_0x2496d6[_0xc21f('0x4b')][_0xc21f('0x30')]);_0x2496d6['body']['Descriptions']=integrations['getDescriptions'](_0x2496d6['body'][_0xc21f('0x56')],_0x2496d6[_0xc21f('0x4b')][_0xc21f('0x30')]);return db[_0xc21f('0x4f')][_0xc21f('0x49')](_0x2496d6['body'],{'include':[{'model':db[_0xc21f('0x57')],'as':_0xc21f('0x54')},{'model':db[_0xc21f('0x57')],'as':'Descriptions'}]});}return null;})[_0xc21f('0x26')](respondWithResult(_0x529369,null))[_0xc21f('0x45')](handleError(_0x529369,null));};exports[_0xc21f('0x58')]=function(_0xa9e7c5,_0x112f5d,_0x1f0eb5){var _0x132393='';var _0x25675a=['id',_0xc21f('0x29'),_0xc21f('0x59'),'created_by','description','date_start','duration_hours',_0xc21f('0x5a'),_0xc21f('0x5b'),_0xc21f('0x5c'),_0xc21f('0x5d'),_0xc21f('0x5e')];return db['SugarcrmAccount'][_0xc21f('0x4e')]({'where':{'id':_0xa9e7c5['params']['id']},'attributes':['id',_0xc21f('0x5f'),_0xc21f('0x60'),_0xc21f('0x61')]})[_0xc21f('0x26')](handleEntityNotFound(_0x112f5d,null))[_0xc21f('0x26')](function(_0x324a23){if(_0x324a23){_0x132393=_0x324a23[_0xc21f('0x61')];var _0x2c6e03=_0x132393[_0xc21f('0x62')](-0x1);if(_0x2c6e03==='/'){_0x132393=_0x132393['substring'](0x0,_0x132393[_0xc21f('0x63')](_0x2c6e03));}return rp({'method':_0xc21f('0x64'),'uri':util[_0xc21f('0x65')](_0xc21f('0x66'),_0x132393,_0xc21f('0x67')),'json':!![],'form':{'method':_0xc21f('0x68'),'input_type':_0xc21f('0x69'),'response_type':_0xc21f('0x69'),'rest_data':JSON[_0xc21f('0x6a')]({'user_auth':{'user_name':_0x324a23[_0xc21f('0x5f')],'password':_0x324a23['password'],'encryption':_0xc21f('0x6b')},'application':_0xc21f('0x6c')})}});}})[_0xc21f('0x26')](function(_0x18c0a5){if(_0x18c0a5&&_0x18c0a5[_0xc21f('0x29')]!=='Invalid\x20Login'&&_0x18c0a5['name']!=='Password\x20Expired'){return rp({'method':_0xc21f('0x64'),'uri':util[_0xc21f('0x65')](_0xc21f('0x66'),_0x132393,_0xc21f('0x67')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xc21f('0x69'),'response_type':_0xc21f('0x69'),'rest_data':JSON[_0xc21f('0x6a')]({'session':_0x18c0a5['id'],'module_name':_0xc21f('0x6d')})}})[_0xc21f('0x26')](function(_0x49d99a){if(_0x49d99a){var _0xe09fb5=_[_0xc21f('0x6e')](_0x49d99a['module_fields']);_[_0xc21f('0x6f')](_0xe09fb5,function(_0x3ea078){return _0x25675a[_0xc21f('0x70')](_0x3ea078['name']);});return{'count':_0xe09fb5['length'],'rows':_[_0xc21f('0x2c')](_0xe09fb5,function(_0x8d97cd){return{'id':_0x8d97cd[_0xc21f('0x29')],'name':_0x8d97cd[_0xc21f('0x71')],'custom':_[_0xc21f('0x72')](_0x8d97cd[_0xc21f('0x29')],'_c')?!![]:![],'options':_0x8d97cd[_0xc21f('0x41')]?_[_0xc21f('0x2c')](_[_0xc21f('0x6e')](_0x8d97cd['options']),function(_0x4bb17b){return{'name':_0x4bb17b['value'],'value':_0x4bb17b[_0xc21f('0x29')]};}):[]};})};}})[_0xc21f('0x26')](respondWithResult(_0x112f5d,null))['catch'](function(_0x94a6c2){var _0x23e0ef=_0xa9e7c5[_0xc21f('0x33')][_0xc21f('0x73')]?0x1f4:_0x94a6c2[_0xc21f('0x74')]||0x1f4;logger[_0xc21f('0x27')](_0xc21f('0x75'),_0xc21f('0x58'),_0x23e0ef,JSON[_0xc21f('0x6a')](_0x94a6c2));delete _0x94a6c2[_0xc21f('0x29')];if(_0x23e0ef===0x191){_0x23e0ef=0x190;}_0x112f5d[_0xc21f('0x1a')](_0x23e0ef)[_0xc21f('0x2a')](_0xa9e7c5[_0xc21f('0x33')][_0xc21f('0x73')]?{'message':_0xc21f('0x76'),'statusCode':_0x94a6c2[_0xc21f('0x74')]}:_0x94a6c2);});}else{var _0x4b849e=0x1f4;_0x112f5d[_0xc21f('0x1a')](_0x4b849e)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index a5525c6..170e108 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 _0xb486=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xb486,0x138));var _0x6b48=function(_0x4003c4,_0x572145){_0x4003c4=_0x4003c4-0x0;var _0x1cca64=_0xb486[_0x4003c4];return _0x1cca64;};'use strict';var _=require(_0x6b48('0x0'));var util=require(_0x6b48('0x1'));var logger=require('../../config/logger')(_0x6b48('0x2'));var moment=require(_0x6b48('0x3'));var BPromise=require(_0x6b48('0x4'));var rp=require(_0x6b48('0x5'));var fs=require('fs');var path=require(_0x6b48('0x6'));var rimraf=require(_0x6b48('0x7'));var config=require(_0x6b48('0x8'));var attributes=require(_0x6b48('0x9'));var integrations=require(_0x6b48('0xa'));module[_0x6b48('0xb')]=function(_0x40ae92,_0x366a50){return _0x40ae92[_0x6b48('0xc')](_0x6b48('0xd'),attributes,{'tableName':_0x6b48('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65fe=['int_sugarcrm_accounts','util','api','moment','bluebird','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount'];(function(_0x3b6bf0,_0x54d5c6){var _0x4f1884=function(_0xbcd2e5){while(--_0xbcd2e5){_0x3b6bf0['push'](_0x3b6bf0['shift']());}};_0x4f1884(++_0x54d5c6);}(_0x65fe,0x16c));var _0xe65f=function(_0x482180,_0x29f608){_0x482180=_0x482180-0x0;var _0x1a11a6=_0x65fe[_0x482180];return _0x1a11a6;};'use strict';var _=require('lodash');var util=require(_0xe65f('0x0'));var logger=require('../../config/logger')(_0xe65f('0x1'));var moment=require(_0xe65f('0x2'));var BPromise=require(_0xe65f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe65f('0x4'));var rimraf=require('rimraf');var config=require(_0xe65f('0x5'));var attributes=require(_0xe65f('0x6'));var integrations=require(_0xe65f('0x7'));module['exports']=function(_0x1d378a,_0x486cf3){return _0x1d378a[_0xe65f('0x8')](_0xe65f('0x9'),attributes,{'tableName':_0xe65f('0xa'),'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 6dcee80..672d164 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 _0x1f10=['debug','ShowSugarcrmAccount','find','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','model','include','then'];(function(_0x46c2ae,_0x44a5de){var _0x5c01fa=function(_0x5c412f){while(--_0x5c412f){_0x46c2ae['push'](_0x46c2ae['shift']());}};_0x5c01fa(++_0x44a5de);}(_0x1f10,0x1a8));var _0x01f1=function(_0x1835a5,_0x3a44cb){_0x1835a5=_0x1835a5-0x0;var _0x1e7275=_0x1f10[_0x1835a5];return _0x1e7275;};'use strict';var _=require(_0x01f1('0x0'));var util=require('util');var moment=require(_0x01f1('0x1'));var BPromise=require(_0x01f1('0x2'));var rs=require(_0x01f1('0x3'));var fs=require('fs');var Redis=require(_0x01f1('0x4'));var db=require(_0x01f1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x01f1('0x6'));var jayson=require(_0x01f1('0x7'));var client=jayson[_0x01f1('0x8')][_0x01f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e9206,_0x37ef1a,_0x33ba62){return new BPromise(function(_0x1395e8,_0x48637f){return client['request'](_0x3e9206,_0x33ba62)['then'](function(_0xd7796d){logger[_0x01f1('0xa')](_0x01f1('0xb'),_0x37ef1a,_0x01f1('0xc'));logger['debug'](_0x01f1('0xd'),_0x37ef1a,_0x01f1('0xc'),JSON[_0x01f1('0xe')](_0xd7796d));if(_0xd7796d['error']){if(_0xd7796d[_0x01f1('0xf')][_0x01f1('0x10')]===0x1f4){logger[_0x01f1('0xf')](_0x01f1('0xb'),_0x37ef1a,_0xd7796d[_0x01f1('0xf')][_0x01f1('0x11')]);return _0x48637f(_0xd7796d['error'][_0x01f1('0x11')]);}logger[_0x01f1('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x37ef1a,_0xd7796d['error']['message']);return _0x1395e8(_0xd7796d['error'][_0x01f1('0x11')]);}else{logger[_0x01f1('0xa')](_0x01f1('0xb'),_0x37ef1a,_0x01f1('0xc'));_0x1395e8(_0xd7796d[_0x01f1('0x12')][_0x01f1('0x11')]);}})[_0x01f1('0x13')](function(_0x4036f4){logger[_0x01f1('0xf')](_0x01f1('0xb'),_0x37ef1a,_0x4036f4);_0x48637f(_0x4036f4);});});}exports[_0x01f1('0x14')]=function(_0x1acfd7){var _0x594a2c=this;return new Promise(function(_0x47bf63,_0x49a815){return db[_0x01f1('0x15')][_0x01f1('0x16')]({'raw':_0x1acfd7[_0x01f1('0x17')]?_0x1acfd7[_0x01f1('0x17')][_0x01f1('0x18')]===undefined?!![]:![]:!![],'where':_0x1acfd7[_0x01f1('0x17')]?_0x1acfd7['options'][_0x01f1('0x19')]||null:null,'attributes':_0x1acfd7[_0x01f1('0x17')]?_0x1acfd7[_0x01f1('0x17')][_0x01f1('0x1a')]||null:null,'limit':_0x1acfd7[_0x01f1('0x17')]?_0x1acfd7[_0x01f1('0x17')][_0x01f1('0x1b')]||null:null,'include':_0x1acfd7['options']?_0x1acfd7[_0x01f1('0x17')]['include']?_['map'](_0x1acfd7[_0x01f1('0x17')]['include'],function(_0x3ab4b6){return{'model':db[_0x3ab4b6[_0x01f1('0x1c')]],'as':_0x3ab4b6['as'],'attributes':_0x3ab4b6[_0x01f1('0x1a')],'include':_0x3ab4b6[_0x01f1('0x1d')]?_['map'](_0x3ab4b6[_0x01f1('0x1d')],function(_0x2b0b60){return{'model':db[_0x2b0b60[_0x01f1('0x1c')]],'as':_0x2b0b60['as'],'attributes':_0x2b0b60[_0x01f1('0x1a')],'include':_0x2b0b60['include']?_['map'](_0x2b0b60[_0x01f1('0x1d')],function(_0x590c97){return{'model':db[_0x590c97[_0x01f1('0x1c')]],'as':_0x590c97['as'],'attributes':_0x590c97[_0x01f1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x01f1('0x1e')](function(_0x563544){logger[_0x01f1('0xa')]('GetSugarcrmAccount',_0x1acfd7);logger[_0x01f1('0x1f')](_0x01f1('0x14'),_0x1acfd7,JSON[_0x01f1('0xe')](_0x563544));_0x47bf63(_0x563544);})[_0x01f1('0x13')](function(_0x3bdc0){logger[_0x01f1('0xf')](_0x01f1('0x14'),_0x3bdc0[_0x01f1('0x11')],_0x1acfd7);_0x49a815(_0x594a2c[_0x01f1('0xf')](0x1f4,_0x3bdc0['message']));});});};exports[_0x01f1('0x20')]=function(_0x55e846){var _0x213dd0=this;return new Promise(function(_0xf69f4,_0x2bf731){return db[_0x01f1('0x15')][_0x01f1('0x21')]({'raw':_0x55e846[_0x01f1('0x17')]?_0x55e846[_0x01f1('0x17')][_0x01f1('0x18')]===undefined?!![]:![]:!![],'where':_0x55e846[_0x01f1('0x17')]?_0x55e846[_0x01f1('0x17')][_0x01f1('0x19')]||null:null,'attributes':_0x55e846[_0x01f1('0x17')]?_0x55e846[_0x01f1('0x17')][_0x01f1('0x1a')]||null:null,'include':_0x55e846['options']?_0x55e846[_0x01f1('0x17')][_0x01f1('0x1d')]?_[_0x01f1('0x22')](_0x55e846['options'][_0x01f1('0x1d')],function(_0x13c380){return{'model':db[_0x13c380[_0x01f1('0x1c')]],'as':_0x13c380['as'],'attributes':_0x13c380[_0x01f1('0x1a')],'include':_0x13c380['include']?_[_0x01f1('0x22')](_0x13c380[_0x01f1('0x1d')],function(_0x5e8e30){return{'model':db[_0x5e8e30['model']],'as':_0x5e8e30['as'],'attributes':_0x5e8e30[_0x01f1('0x1a')],'include':_0x5e8e30[_0x01f1('0x1d')]?_[_0x01f1('0x22')](_0x5e8e30[_0x01f1('0x1d')],function(_0x325d03){return{'model':db[_0x325d03[_0x01f1('0x1c')]],'as':_0x325d03['as'],'attributes':_0x325d03[_0x01f1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x01f1('0x1e')](function(_0xc43dfc){logger[_0x01f1('0xa')]('ShowSugarcrmAccount',_0x55e846);logger[_0x01f1('0x1f')](_0x01f1('0x20'),_0x55e846,JSON[_0x01f1('0xe')](_0xc43dfc));_0xf69f4(_0xc43dfc);})['catch'](function(_0x1cec96){logger[_0x01f1('0xf')]('ShowSugarcrmAccount',_0x1cec96['message'],_0x55e846);_0x2bf731(_0x213dd0[_0x01f1('0xf')](0x1f4,_0x1cec96[_0x01f1('0x11')]));});});}; \ No newline at end of file +var _0x7d39=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','ShowSugarcrmAccount','find','debug','lodash','moment','bluebird'];(function(_0x2aee46,_0x183d19){var _0x11117f=function(_0x506f25){while(--_0x506f25){_0x2aee46['push'](_0x2aee46['shift']());}};_0x11117f(++_0x183d19);}(_0x7d39,0x89));var _0x97d3=function(_0x5b3e47,_0x31ee5f){_0x5b3e47=_0x5b3e47-0x0;var _0x31c9a1=_0x7d39[_0x5b3e47];return _0x31c9a1;};'use strict';var _=require(_0x97d3('0x0'));var util=require('util');var moment=require(_0x97d3('0x1'));var BPromise=require(_0x97d3('0x2'));var rs=require(_0x97d3('0x3'));var fs=require('fs');var Redis=require(_0x97d3('0x4'));var db=require(_0x97d3('0x5'))['db'];var utils=require(_0x97d3('0x6'));var logger=require('../../config/logger')(_0x97d3('0x7'));var config=require(_0x97d3('0x8'));var jayson=require(_0x97d3('0x9'));var client=jayson['client'][_0x97d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e805,_0x245528,_0x370101){return new BPromise(function(_0x36f70a,_0x585c3f){return client[_0x97d3('0xb')](_0x52e805,_0x370101)[_0x97d3('0xc')](function(_0x305d4e){logger[_0x97d3('0xd')](_0x97d3('0xe'),_0x245528,'request\x20sent');logger['debug'](_0x97d3('0xf'),_0x245528,_0x97d3('0x10'),JSON[_0x97d3('0x11')](_0x305d4e));if(_0x305d4e['error']){if(_0x305d4e[_0x97d3('0x12')]['code']===0x1f4){logger[_0x97d3('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x245528,_0x305d4e[_0x97d3('0x12')][_0x97d3('0x13')]);return _0x585c3f(_0x305d4e['error'][_0x97d3('0x13')]);}logger[_0x97d3('0x12')](_0x97d3('0xe'),_0x245528,_0x305d4e[_0x97d3('0x12')][_0x97d3('0x13')]);return _0x36f70a(_0x305d4e[_0x97d3('0x12')][_0x97d3('0x13')]);}else{logger[_0x97d3('0xd')](_0x97d3('0xe'),_0x245528,'request\x20sent');_0x36f70a(_0x305d4e[_0x97d3('0x14')][_0x97d3('0x13')]);}})[_0x97d3('0x15')](function(_0x31f35c){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x245528,_0x31f35c);_0x585c3f(_0x31f35c);});});}exports[_0x97d3('0x16')]=function(_0x2e4098){var _0xe813d7=this;return new Promise(function(_0x5bc30d,_0x253b2d){return db[_0x97d3('0x17')][_0x97d3('0x18')]({'raw':_0x2e4098[_0x97d3('0x19')]?_0x2e4098[_0x97d3('0x19')][_0x97d3('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e4098[_0x97d3('0x19')]?_0x2e4098[_0x97d3('0x19')][_0x97d3('0x1b')]||null:null,'attributes':_0x2e4098['options']?_0x2e4098['options'][_0x97d3('0x1c')]||null:null,'limit':_0x2e4098[_0x97d3('0x19')]?_0x2e4098[_0x97d3('0x19')]['limit']||null:null,'include':_0x2e4098[_0x97d3('0x19')]?_0x2e4098['options'][_0x97d3('0x1d')]?_[_0x97d3('0x1e')](_0x2e4098[_0x97d3('0x19')]['include'],function(_0x2e7852){return{'model':db[_0x2e7852[_0x97d3('0x1f')]],'as':_0x2e7852['as'],'attributes':_0x2e7852[_0x97d3('0x1c')],'include':_0x2e7852[_0x97d3('0x1d')]?_[_0x97d3('0x1e')](_0x2e7852[_0x97d3('0x1d')],function(_0x213830){return{'model':db[_0x213830[_0x97d3('0x1f')]],'as':_0x213830['as'],'attributes':_0x213830[_0x97d3('0x1c')],'include':_0x213830['include']?_['map'](_0x213830[_0x97d3('0x1d')],function(_0x684678){return{'model':db[_0x684678[_0x97d3('0x1f')]],'as':_0x684678['as'],'attributes':_0x684678[_0x97d3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x97d3('0xc')](function(_0x13d891){logger[_0x97d3('0xd')](_0x97d3('0x16'),_0x2e4098);logger['debug'](_0x97d3('0x16'),_0x2e4098,JSON[_0x97d3('0x11')](_0x13d891));_0x5bc30d(_0x13d891);})[_0x97d3('0x15')](function(_0x15d1ea){logger[_0x97d3('0x12')](_0x97d3('0x16'),_0x15d1ea[_0x97d3('0x13')],_0x2e4098);_0x253b2d(_0xe813d7[_0x97d3('0x12')](0x1f4,_0x15d1ea[_0x97d3('0x13')]));});});};exports[_0x97d3('0x20')]=function(_0x4c3e28){var _0x24e6eb=this;return new Promise(function(_0x1c845f,_0x42753f){return db['SugarcrmAccount'][_0x97d3('0x21')]({'raw':_0x4c3e28[_0x97d3('0x19')]?_0x4c3e28[_0x97d3('0x19')][_0x97d3('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c3e28[_0x97d3('0x19')]?_0x4c3e28[_0x97d3('0x19')][_0x97d3('0x1b')]||null:null,'attributes':_0x4c3e28[_0x97d3('0x19')]?_0x4c3e28['options'][_0x97d3('0x1c')]||null:null,'include':_0x4c3e28['options']?_0x4c3e28[_0x97d3('0x19')][_0x97d3('0x1d')]?_[_0x97d3('0x1e')](_0x4c3e28[_0x97d3('0x19')][_0x97d3('0x1d')],function(_0x231def){return{'model':db[_0x231def[_0x97d3('0x1f')]],'as':_0x231def['as'],'attributes':_0x231def[_0x97d3('0x1c')],'include':_0x231def[_0x97d3('0x1d')]?_[_0x97d3('0x1e')](_0x231def[_0x97d3('0x1d')],function(_0x51b9a8){return{'model':db[_0x51b9a8[_0x97d3('0x1f')]],'as':_0x51b9a8['as'],'attributes':_0x51b9a8[_0x97d3('0x1c')],'include':_0x51b9a8[_0x97d3('0x1d')]?_[_0x97d3('0x1e')](_0x51b9a8[_0x97d3('0x1d')],function(_0x3f159b){return{'model':db[_0x3f159b[_0x97d3('0x1f')]],'as':_0x3f159b['as'],'attributes':_0x3f159b[_0x97d3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x97d3('0xc')](function(_0x9e8ecd){logger[_0x97d3('0xd')](_0x97d3('0x20'),_0x4c3e28);logger[_0x97d3('0x22')](_0x97d3('0x20'),_0x4c3e28,JSON['stringify'](_0x9e8ecd));_0x1c845f(_0x9e8ecd);})[_0x97d3('0x15')](function(_0x49b801){logger[_0x97d3('0x12')](_0x97d3('0x20'),_0x49b801['message'],_0x4c3e28);_0x42753f(_0x24e6eb[_0x97d3('0x12')](0x1f4,_0x49b801['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 2967b99..9b24b44 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 _0xe131=['../../config/environment','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','update','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe131,0x118));var _0x1e13=function(_0x3f2e09,_0x231aee){_0x3f2e09=_0x3f2e09-0x0;var _0x2268e5=_0xe131[_0x3f2e09];return _0x2268e5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e13('0x0'));var router=express[_0x1e13('0x1')]();var fs_extra=require(_0x1e13('0x2'));var auth=require(_0x1e13('0x3'));var interaction=require(_0x1e13('0x4'));var config=require(_0x1e13('0x5'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x1e13('0x6')]('/',auth[_0x1e13('0x7')](),controller['index']);router[_0x1e13('0x6')](_0x1e13('0x8'),auth[_0x1e13('0x7')](),controller['show']);router[_0x1e13('0x6')](_0x1e13('0x9'),auth['isAuthenticated'](),controller[_0x1e13('0xa')]);router[_0x1e13('0x6')](_0x1e13('0xb'),auth[_0x1e13('0x7')](),controller['getSubjects']);router[_0x1e13('0x6')]('/:id/descriptions',auth[_0x1e13('0x7')](),controller[_0x1e13('0xc')]);router[_0x1e13('0xd')]('/',auth[_0x1e13('0x7')](),controller[_0x1e13('0xe')]);router['put']('/:id',auth[_0x1e13('0x7')](),controller[_0x1e13('0xf')]);router[_0x1e13('0x10')]('/:id',auth[_0x1e13('0x7')](),controller[_0x1e13('0x11')]);module[_0x1e13('0x12')]=router; \ No newline at end of file +var _0xc879=['../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x174a4d,_0x203ae3){var _0x240fa1=function(_0x7139f){while(--_0x7139f){_0x174a4d['push'](_0x174a4d['shift']());}};_0x240fa1(++_0x203ae3);}(_0xc879,0x101));var _0x9c87=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xc879[_0x500419];return _0x241c1a;};'use strict';var multer=require('multer');var util=require(_0x9c87('0x0'));var path=require(_0x9c87('0x1'));var timeout=require(_0x9c87('0x2'));var express=require(_0x9c87('0x3'));var router=express[_0x9c87('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c87('0x5'));var interaction=require(_0x9c87('0x6'));var config=require(_0x9c87('0x7'));var controller=require(_0x9c87('0x8'));router['get']('/',auth[_0x9c87('0x9')](),controller['index']);router[_0x9c87('0xa')](_0x9c87('0xb'),auth['isAuthenticated'](),controller[_0x9c87('0xc')]);router[_0x9c87('0xa')](_0x9c87('0xd'),auth[_0x9c87('0x9')](),controller[_0x9c87('0xe')]);router[_0x9c87('0xa')](_0x9c87('0xf'),auth[_0x9c87('0x9')](),controller[_0x9c87('0x10')]);router['get'](_0x9c87('0x11'),auth[_0x9c87('0x9')](),controller[_0x9c87('0x12')]);router['post']('/',auth[_0x9c87('0x9')](),controller['create']);router[_0x9c87('0x13')](_0x9c87('0xb'),auth[_0x9c87('0x9')](),controller[_0x9c87('0x14')]);router[_0x9c87('0x15')]('/:id',auth[_0x9c87('0x9')](),controller[_0x9c87('0x16')]);module[_0x9c87('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 7570f9e..8eff94c 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 _0x2d06=['exports','STRING','sequelize'];(function(_0x3cffa1,_0x3ce717){var _0x27bb50=function(_0x4c7a2f){while(--_0x4c7a2f){_0x3cffa1['push'](_0x3cffa1['shift']());}};_0x27bb50(++_0x3ce717);}(_0x2d06,0xaa));var _0x62d0=function(_0x2c65f7,_0x1f2c3a){_0x2c65f7=_0x2c65f7-0x0;var _0x415fc1=_0x2d06[_0x2c65f7];return _0x415fc1;};'use strict';var Sequelize=require(_0x62d0('0x0'));module[_0x62d0('0x1')]={'name':{'type':Sequelize[_0x62d0('0x2')]},'description':{'type':Sequelize[_0x62d0('0x2')]}}; \ No newline at end of file +var _0x5aec=['STRING','sequelize'];(function(_0x372927,_0x148100){var _0x33b854=function(_0x108af1){while(--_0x108af1){_0x372927['push'](_0x372927['shift']());}};_0x33b854(++_0x148100);}(_0x5aec,0x119));var _0xc5ae=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x5aec[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0xc5ae('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc5ae('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 1fb267c..326bcd3 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 _0x04c6=['save','update','then','destroy','sendStatus','stack','name','SugarcrmConfiguration','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','catch','show','params','filters','length','includeAll','create','body','find','getFields','findOne','getSubjects','getDescriptions','SugarcrmField','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x1626ac,_0x517818){var _0x3753ef=function(_0x4a9113){while(--_0x4a9113){_0x1626ac['push'](_0x1626ac['shift']());}};_0x3753ef(++_0x517818);}(_0x04c6,0x14f));var _0x604c=function(_0x4ec0c5,_0xbbb1d0){_0x4ec0c5=_0x4ec0c5-0x0;var _0x58a74e=_0x04c6[_0x4ec0c5];return _0x58a74e;};'use strict';var emlformat=require(_0x604c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x604c('0x1'));var jsonpatch=require(_0x604c('0x2'));var rp=require(_0x604c('0x3'));var moment=require(_0x604c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x604c('0x5'));var util=require(_0x604c('0x6'));var path=require(_0x604c('0x7'));var sox=require('sox');var csv=require(_0x604c('0x8'));var ejs=require(_0x604c('0x9'));var fs=require('fs');var fs_extra=require(_0x604c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x604c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x604c('0x8'));var querystring=require(_0x604c('0xc'));var Papa=require(_0x604c('0xd'));var Redis=require(_0x604c('0xe'));var authService=require(_0x604c('0xf'));var qs=require(_0x604c('0x10'));var as=require(_0x604c('0x11'));var hardwareService=require(_0x604c('0x12'));var logger=require('../../config/logger')(_0x604c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x604c('0x14'));var db=require(_0x604c('0x15'))['db'];function respondWithStatusCode(_0x526337,_0x5b2c7a){_0x5b2c7a=_0x5b2c7a||0xcc;return function(_0xc9fa56){if(_0xc9fa56){return _0x526337['sendStatus'](_0x5b2c7a);}return _0x526337[_0x604c('0x16')](_0x5b2c7a)[_0x604c('0x17')]();};}function respondWithResult(_0x41cd76,_0x45e596){_0x45e596=_0x45e596||0xc8;return function(_0x4e0533){if(_0x4e0533){return _0x41cd76[_0x604c('0x16')](_0x45e596)[_0x604c('0x18')](_0x4e0533);}};}function respondWithFilteredResult(_0xc55e97,_0x5d3ce0){return function(_0x5f5279){if(_0x5f5279){var _0x4ebb56=typeof _0x5d3ce0[_0x604c('0x19')]===_0x604c('0x1a')&&typeof _0x5d3ce0[_0x604c('0x1b')]===_0x604c('0x1a');var _0x15db3c=_0x5f5279['count'];var _0x52ef0c=_0x4ebb56?0x0:_0x5d3ce0[_0x604c('0x19')];var _0x5c1f67=_0x4ebb56?_0x5f5279[_0x604c('0x1c')]:_0x5d3ce0[_0x604c('0x19')]+_0x5d3ce0[_0x604c('0x1b')];var _0x5d1864;if(_0x5c1f67>=_0x15db3c){_0x5c1f67=_0x15db3c;_0x5d1864=0xc8;}else{_0x5d1864=0xce;}_0xc55e97[_0x604c('0x16')](_0x5d1864);return _0xc55e97[_0x604c('0x1d')]('Content-Range',_0x52ef0c+'-'+_0x5c1f67+'/'+_0x15db3c)[_0x604c('0x18')](_0x5f5279);}return null;};}function patchUpdates(_0xb4e7ab){return function(_0x1ea5c4){try{jsonpatch['apply'](_0x1ea5c4,_0xb4e7ab,!![]);}catch(_0x184381){return BPromise['reject'](_0x184381);}return _0x1ea5c4[_0x604c('0x1e')]();};}function saveUpdates(_0x197029,_0x1fdde8){return function(_0x4fab8e){if(_0x4fab8e){return _0x4fab8e[_0x604c('0x1f')](_0x197029)[_0x604c('0x20')](function(_0x9fed63){return _0x9fed63;});}return null;};}function removeEntity(_0x172d9b,_0x295ed9){return function(_0x232edd){if(_0x232edd){return _0x232edd[_0x604c('0x21')]()[_0x604c('0x20')](function(){_0x172d9b[_0x604c('0x16')](0xcc)[_0x604c('0x17')]();});}};}function handleEntityNotFound(_0x3e9ab7,_0x5ab8ba){return function(_0x45bdd7){if(!_0x45bdd7){_0x3e9ab7[_0x604c('0x22')](0x194);}return _0x45bdd7;};}function handleError(_0x314024,_0x4ade75){_0x4ade75=_0x4ade75||0x1f4;return function(_0x38a070){logger['error'](_0x38a070[_0x604c('0x23')]);if(_0x38a070[_0x604c('0x24')]){delete _0x38a070['name'];}_0x314024['status'](_0x4ade75)['send'](_0x38a070);};}exports['index']=function(_0x25e1dc,_0x3b1386){var _0x2904dc={},_0x4838ff={},_0x1d3d50={'count':0x0,'rows':[]};var _0x117424=_['map'](db[_0x604c('0x25')][_0x604c('0x26')],function(_0x496aac){return{'name':_0x496aac[_0x604c('0x27')],'type':_0x496aac[_0x604c('0x28')]['key']};});_0x4838ff[_0x604c('0x29')]=_[_0x604c('0x2a')](_0x117424,_0x604c('0x24'));_0x4838ff[_0x604c('0x2b')]=_[_0x604c('0x2c')](_0x25e1dc[_0x604c('0x2b')]);_0x4838ff['filters']=_[_0x604c('0x2d')](_0x4838ff[_0x604c('0x29')],_0x4838ff['query']);_0x2904dc['attributes']=_[_0x604c('0x2d')](_0x4838ff['model'],qs[_0x604c('0x2e')](_0x25e1dc[_0x604c('0x2b')][_0x604c('0x2e')]));_0x2904dc[_0x604c('0x2f')]=_0x2904dc[_0x604c('0x2f')]['length']?_0x2904dc[_0x604c('0x2f')]:_0x4838ff[_0x604c('0x29')];if(!_0x25e1dc[_0x604c('0x2b')][_0x604c('0x30')](_0x604c('0x31'))){_0x2904dc[_0x604c('0x1b')]=qs[_0x604c('0x1b')](_0x25e1dc[_0x604c('0x2b')]['limit']);_0x2904dc[_0x604c('0x19')]=qs['offset'](_0x25e1dc['query']['offset']);}_0x2904dc[_0x604c('0x32')]=qs[_0x604c('0x33')](_0x25e1dc['query'][_0x604c('0x33')]);_0x2904dc[_0x604c('0x34')]=qs['filters'](_[_0x604c('0x35')](_0x25e1dc[_0x604c('0x2b')],_0x4838ff['filters']),_0x117424);if(_0x25e1dc[_0x604c('0x2b')]['filter']){_0x2904dc['where']=_[_0x604c('0x36')](_0x2904dc[_0x604c('0x34')],{'$or':_['map'](_0x117424,function(_0xa4effc){if(_0xa4effc[_0x604c('0x28')]!==_0x604c('0x37')){var _0xce6686={};_0xce6686[_0xa4effc[_0x604c('0x24')]]={'$like':'%'+_0x25e1dc['query'][_0x604c('0x38')]+'%'};return _0xce6686;}})});}_0x2904dc=_['merge']({},_0x2904dc,_0x25e1dc[_0x604c('0x39')]);var _0x39e119={'where':_0x2904dc[_0x604c('0x34')]};return db[_0x604c('0x25')][_0x604c('0x1c')](_0x39e119)[_0x604c('0x20')](function(_0x4ccf82){_0x1d3d50[_0x604c('0x1c')]=_0x4ccf82;if(_0x25e1dc[_0x604c('0x2b')]['includeAll']){_0x2904dc['include']=[{'all':!![]}];}return db[_0x604c('0x25')][_0x604c('0x3a')](_0x2904dc);})[_0x604c('0x20')](function(_0xbe9904){_0x1d3d50['rows']=_0xbe9904;return _0x1d3d50;})[_0x604c('0x20')](respondWithFilteredResult(_0x3b1386,_0x2904dc))[_0x604c('0x3b')](handleError(_0x3b1386,null));};exports[_0x604c('0x3c')]=function(_0x2a9e68,_0x2b08c5){var _0x15f98b={'raw':![],'where':{'id':_0x2a9e68[_0x604c('0x3d')]['id']}},_0x5ad1ec={};_0x5ad1ec[_0x604c('0x29')]=_[_0x604c('0x2c')](db[_0x604c('0x25')][_0x604c('0x26')]);_0x5ad1ec[_0x604c('0x2b')]=_[_0x604c('0x2c')](_0x2a9e68[_0x604c('0x2b')]);_0x5ad1ec[_0x604c('0x3e')]=_[_0x604c('0x2d')](_0x5ad1ec[_0x604c('0x29')],_0x5ad1ec['query']);_0x15f98b[_0x604c('0x2f')]=_[_0x604c('0x2d')](_0x5ad1ec['model'],qs[_0x604c('0x2e')](_0x2a9e68['query'][_0x604c('0x2e')]));_0x15f98b[_0x604c('0x2f')]=_0x15f98b['attributes'][_0x604c('0x3f')]?_0x15f98b[_0x604c('0x2f')]:_0x5ad1ec[_0x604c('0x29')];if(_0x2a9e68[_0x604c('0x2b')][_0x604c('0x40')]){_0x15f98b['include']=[{'all':!![]}];}_0x15f98b=_['merge']({},_0x15f98b,_0x2a9e68['options']);return db[_0x604c('0x25')]['find'](_0x15f98b)['then'](handleEntityNotFound(_0x2b08c5,null))[_0x604c('0x20')](respondWithResult(_0x2b08c5,null))[_0x604c('0x3b')](handleError(_0x2b08c5,null));};exports['create']=function(_0x30f211,_0x532f84){return db['SugarcrmConfiguration'][_0x604c('0x41')](_0x30f211[_0x604c('0x42')],{})['then'](respondWithResult(_0x532f84,0xc9))[_0x604c('0x3b')](handleError(_0x532f84,null));};exports[_0x604c('0x1f')]=function(_0x32eb98,_0x50ee57){if(_0x32eb98[_0x604c('0x42')]['id']){delete _0x32eb98[_0x604c('0x42')]['id'];}return db[_0x604c('0x25')][_0x604c('0x43')]({'where':{'id':_0x32eb98['params']['id']}})[_0x604c('0x20')](handleEntityNotFound(_0x50ee57,null))[_0x604c('0x20')](saveUpdates(_0x32eb98[_0x604c('0x42')],null))[_0x604c('0x20')](respondWithResult(_0x50ee57,null))['catch'](handleError(_0x50ee57,null));};exports[_0x604c('0x21')]=function(_0x393c31,_0x14bb01){return db[_0x604c('0x25')][_0x604c('0x43')]({'where':{'id':_0x393c31[_0x604c('0x3d')]['id']}})[_0x604c('0x20')](handleEntityNotFound(_0x14bb01,null))['then'](removeEntity(_0x14bb01,null))[_0x604c('0x3b')](handleError(_0x14bb01,null));};exports[_0x604c('0x44')]=function(_0x3957ef,_0x3d0796,_0x4031c6){var _0x2b2ec7={};var _0x428f2c={};var _0x3cbc33;var _0x22fc79;return db[_0x604c('0x25')][_0x604c('0x45')]({'where':{'id':_0x3957ef['params']['id']}})['then'](handleEntityNotFound(_0x3d0796,null))[_0x604c('0x20')](function(_0x131123){if(_0x131123){_0x3cbc33=_0x131123;_0x428f2c[_0x604c('0x29')]=_['keys'](db['SugarcrmField'][_0x604c('0x26')]);_0x428f2c[_0x604c('0x2b')]=_[_0x604c('0x2c')](_0x3957ef[_0x604c('0x2b')]);_0x428f2c[_0x604c('0x3e')]=_[_0x604c('0x2d')](_0x428f2c[_0x604c('0x29')],_0x428f2c[_0x604c('0x2b')]);_0x2b2ec7['attributes']=_['intersection'](_0x428f2c[_0x604c('0x29')],qs[_0x604c('0x2e')](_0x3957ef[_0x604c('0x2b')][_0x604c('0x2e')]));_0x2b2ec7[_0x604c('0x2f')]=_0x2b2ec7[_0x604c('0x2f')][_0x604c('0x3f')]?_0x2b2ec7[_0x604c('0x2f')]:_0x428f2c[_0x604c('0x29')];_0x2b2ec7['order']=qs[_0x604c('0x33')](_0x3957ef['query'][_0x604c('0x33')]);_0x2b2ec7[_0x604c('0x34')]=qs[_0x604c('0x3e')](_[_0x604c('0x35')](_0x3957ef['query'],_0x428f2c[_0x604c('0x3e')]));if(_0x3957ef[_0x604c('0x2b')][_0x604c('0x38')]){_0x2b2ec7[_0x604c('0x34')]=_['merge'](_0x2b2ec7[_0x604c('0x34')],{'$or':_[_0x604c('0x2a')](_0x2b2ec7[_0x604c('0x2f')],function(_0x169a0f){var _0x4ab589={};_0x4ab589[_0x169a0f]={'$like':'%'+_0x3957ef[_0x604c('0x2b')][_0x604c('0x38')]+'%'};return _0x4ab589;})});}_0x2b2ec7=_[_0x604c('0x36')]({},_0x2b2ec7,_0x3957ef[_0x604c('0x39')]);return _0x3cbc33[_0x604c('0x44')](_0x2b2ec7);}})[_0x604c('0x20')](function(_0x4ffffb){if(_0x4ffffb){_0x22fc79=_0x4ffffb[_0x604c('0x3f')];if(!_0x3957ef[_0x604c('0x2b')]['hasOwnProperty'](_0x604c('0x31'))){_0x2b2ec7['limit']=qs['limit'](_0x3957ef[_0x604c('0x2b')][_0x604c('0x1b')]);_0x2b2ec7[_0x604c('0x19')]=qs[_0x604c('0x19')](_0x3957ef['query'][_0x604c('0x19')]);}return _0x3cbc33[_0x604c('0x44')](_0x2b2ec7);}})['then'](function(_0x724cec){if(_0x724cec){return _0x724cec?{'count':_0x22fc79,'rows':_0x724cec}:null;}})[_0x604c('0x20')](respondWithResult(_0x3d0796,null))[_0x604c('0x3b')](handleError(_0x3d0796,null));};exports['getSubjects']=function(_0x350e02,_0x166116,_0x3778b4){var _0x4f62d5={};var _0x2409d6={};var _0x2fc818;var _0x1ef281;return db[_0x604c('0x25')][_0x604c('0x45')]({'where':{'id':_0x350e02[_0x604c('0x3d')]['id']}})[_0x604c('0x20')](handleEntityNotFound(_0x166116,null))[_0x604c('0x20')](function(_0xb515ab){if(_0xb515ab){_0x2fc818=_0xb515ab;_0x2409d6[_0x604c('0x29')]=_[_0x604c('0x2c')](db['SugarcrmField'][_0x604c('0x26')]);_0x2409d6['query']=_[_0x604c('0x2c')](_0x350e02[_0x604c('0x2b')]);_0x2409d6['filters']=_[_0x604c('0x2d')](_0x2409d6[_0x604c('0x29')],_0x2409d6[_0x604c('0x2b')]);_0x4f62d5[_0x604c('0x2f')]=_[_0x604c('0x2d')](_0x2409d6[_0x604c('0x29')],qs[_0x604c('0x2e')](_0x350e02[_0x604c('0x2b')][_0x604c('0x2e')]));_0x4f62d5[_0x604c('0x2f')]=_0x4f62d5['attributes'][_0x604c('0x3f')]?_0x4f62d5[_0x604c('0x2f')]:_0x2409d6[_0x604c('0x29')];_0x4f62d5[_0x604c('0x32')]=qs['sort'](_0x350e02['query'][_0x604c('0x33')]);_0x4f62d5[_0x604c('0x34')]=qs[_0x604c('0x3e')](_[_0x604c('0x35')](_0x350e02[_0x604c('0x2b')],_0x2409d6[_0x604c('0x3e')]));if(_0x350e02[_0x604c('0x2b')]['filter']){_0x4f62d5[_0x604c('0x34')]=_['merge'](_0x4f62d5[_0x604c('0x34')],{'$or':_[_0x604c('0x2a')](_0x4f62d5['attributes'],function(_0x86f646){var _0x3120d4={};_0x3120d4[_0x86f646]={'$like':'%'+_0x350e02[_0x604c('0x2b')][_0x604c('0x38')]+'%'};return _0x3120d4;})});}_0x4f62d5=_['merge']({},_0x4f62d5,_0x350e02['options']);return _0x2fc818['getSubjects'](_0x4f62d5);}})['then'](function(_0x3eb5a8){if(_0x3eb5a8){_0x1ef281=_0x3eb5a8[_0x604c('0x3f')];if(!_0x350e02[_0x604c('0x2b')]['hasOwnProperty'](_0x604c('0x31'))){_0x4f62d5[_0x604c('0x1b')]=qs[_0x604c('0x1b')](_0x350e02[_0x604c('0x2b')][_0x604c('0x1b')]);_0x4f62d5[_0x604c('0x19')]=qs[_0x604c('0x19')](_0x350e02[_0x604c('0x2b')][_0x604c('0x19')]);}return _0x2fc818[_0x604c('0x46')](_0x4f62d5);}})[_0x604c('0x20')](function(_0x402a45){if(_0x402a45){return _0x402a45?{'count':_0x1ef281,'rows':_0x402a45}:null;}})['then'](respondWithResult(_0x166116,null))[_0x604c('0x3b')](handleError(_0x166116,null));};exports[_0x604c('0x47')]=function(_0xcc1d8e,_0x12bdc1,_0x4c12ee){var _0x4b438b={};var _0x3f283b={};var _0x13d68d;var _0x5007ed;return db[_0x604c('0x25')][_0x604c('0x45')]({'where':{'id':_0xcc1d8e[_0x604c('0x3d')]['id']}})[_0x604c('0x20')](handleEntityNotFound(_0x12bdc1,null))[_0x604c('0x20')](function(_0x570f6c){if(_0x570f6c){_0x13d68d=_0x570f6c;_0x3f283b[_0x604c('0x29')]=_['keys'](db[_0x604c('0x48')][_0x604c('0x26')]);_0x3f283b[_0x604c('0x2b')]=_['keys'](_0xcc1d8e[_0x604c('0x2b')]);_0x3f283b[_0x604c('0x3e')]=_['intersection'](_0x3f283b[_0x604c('0x29')],_0x3f283b['query']);_0x4b438b[_0x604c('0x2f')]=_[_0x604c('0x2d')](_0x3f283b[_0x604c('0x29')],qs[_0x604c('0x2e')](_0xcc1d8e[_0x604c('0x2b')][_0x604c('0x2e')]));_0x4b438b['attributes']=_0x4b438b[_0x604c('0x2f')][_0x604c('0x3f')]?_0x4b438b[_0x604c('0x2f')]:_0x3f283b[_0x604c('0x29')];_0x4b438b[_0x604c('0x32')]=qs['sort'](_0xcc1d8e[_0x604c('0x2b')][_0x604c('0x33')]);_0x4b438b['where']=qs[_0x604c('0x3e')](_[_0x604c('0x35')](_0xcc1d8e['query'],_0x3f283b[_0x604c('0x3e')]));if(_0xcc1d8e['query'][_0x604c('0x38')]){_0x4b438b[_0x604c('0x34')]=_['merge'](_0x4b438b[_0x604c('0x34')],{'$or':_[_0x604c('0x2a')](_0x4b438b['attributes'],function(_0x37152d){var _0x5c57f8={};_0x5c57f8[_0x37152d]={'$like':'%'+_0xcc1d8e[_0x604c('0x2b')][_0x604c('0x38')]+'%'};return _0x5c57f8;})});}_0x4b438b=_[_0x604c('0x36')]({},_0x4b438b,_0xcc1d8e[_0x604c('0x39')]);return _0x13d68d[_0x604c('0x47')](_0x4b438b);}})[_0x604c('0x20')](function(_0x222ab7){if(_0x222ab7){_0x5007ed=_0x222ab7[_0x604c('0x3f')];if(!_0xcc1d8e[_0x604c('0x2b')]['hasOwnProperty']('nolimit')){_0x4b438b[_0x604c('0x1b')]=qs[_0x604c('0x1b')](_0xcc1d8e[_0x604c('0x2b')]['limit']);_0x4b438b['offset']=qs[_0x604c('0x19')](_0xcc1d8e[_0x604c('0x2b')][_0x604c('0x19')]);}return _0x13d68d[_0x604c('0x47')](_0x4b438b);}})['then'](function(_0x15de75){if(_0x15de75){return _0x15de75?{'count':_0x5007ed,'rows':_0x15de75}:null;}})[_0x604c('0x20')](respondWithResult(_0x12bdc1,null))['catch'](handleError(_0x12bdc1,null));}; \ No newline at end of file +var _0x6bb1=['getDescriptions','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','offset','count','limit','status','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','getFields','findOne','SugarcrmField','pick','nolimit','getSubjects'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x6bb1,0x1cf));var _0x16bb=function(_0x3bf80d,_0x2650df){_0x3bf80d=_0x3bf80d-0x0;var _0x505f21=_0x6bb1[_0x3bf80d];return _0x505f21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16bb('0x0'));var zipdir=require(_0x16bb('0x1'));var jsonpatch=require(_0x16bb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x16bb('0x3'));var util=require('util');var path=require('path');var sox=require(_0x16bb('0x4'));var csv=require(_0x16bb('0x5'));var ejs=require(_0x16bb('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x16bb('0x7'));var jsforce=require(_0x16bb('0x8'));var deskjs=require(_0x16bb('0x9'));var toCsv=require(_0x16bb('0x5'));var querystring=require(_0x16bb('0xa'));var Papa=require(_0x16bb('0xb'));var Redis=require('ioredis');var authService=require(_0x16bb('0xc'));var qs=require(_0x16bb('0xd'));var as=require(_0x16bb('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16bb('0xf'))('api');var utils=require(_0x16bb('0x10'));var config=require(_0x16bb('0x11'));var licenseUtil=require(_0x16bb('0x12'));var db=require(_0x16bb('0x13'))['db'];function respondWithStatusCode(_0x461c2e,_0x5c5763){_0x5c5763=_0x5c5763||0xcc;return function(_0x20fef8){if(_0x20fef8){return _0x461c2e[_0x16bb('0x14')](_0x5c5763);}return _0x461c2e['status'](_0x5c5763)[_0x16bb('0x15')]();};}function respondWithResult(_0x34d0a5,_0x1c3e6b){_0x1c3e6b=_0x1c3e6b||0xc8;return function(_0x231d61){if(_0x231d61){return _0x34d0a5['status'](_0x1c3e6b)[_0x16bb('0x16')](_0x231d61);}};}function respondWithFilteredResult(_0x2c2f45,_0x3160d2){return function(_0x16d8d8){if(_0x16d8d8){var _0xeba497=typeof _0x3160d2['offset']===_0x16bb('0x17')&&typeof _0x3160d2['limit']===_0x16bb('0x17');var _0x14bba5=_0x16d8d8['count'];var _0x34d25b=_0xeba497?0x0:_0x3160d2[_0x16bb('0x18')];var _0x4385c2=_0xeba497?_0x16d8d8[_0x16bb('0x19')]:_0x3160d2['offset']+_0x3160d2[_0x16bb('0x1a')];var _0x53bd98;if(_0x4385c2>=_0x14bba5){_0x4385c2=_0x14bba5;_0x53bd98=0xc8;}else{_0x53bd98=0xce;}_0x2c2f45[_0x16bb('0x1b')](_0x53bd98);return _0x2c2f45[_0x16bb('0x1c')](_0x16bb('0x1d'),_0x34d25b+'-'+_0x4385c2+'/'+_0x14bba5)[_0x16bb('0x16')](_0x16d8d8);}return null;};}function patchUpdates(_0x505ab2){return function(_0x3c4a07){try{jsonpatch[_0x16bb('0x1e')](_0x3c4a07,_0x505ab2,!![]);}catch(_0x3affe0){return BPromise['reject'](_0x3affe0);}return _0x3c4a07[_0x16bb('0x1f')]();};}function saveUpdates(_0x1c80a2,_0x39a881){return function(_0x4145a2){if(_0x4145a2){return _0x4145a2['update'](_0x1c80a2)[_0x16bb('0x20')](function(_0x2fb83c){return _0x2fb83c;});}return null;};}function removeEntity(_0x2c5ad6,_0x3717cc){return function(_0x46d7c8){if(_0x46d7c8){return _0x46d7c8[_0x16bb('0x21')]()[_0x16bb('0x20')](function(){_0x2c5ad6[_0x16bb('0x1b')](0xcc)[_0x16bb('0x15')]();});}};}function handleEntityNotFound(_0x14d6cb,_0x517a28){return function(_0x5b2b08){if(!_0x5b2b08){_0x14d6cb[_0x16bb('0x14')](0x194);}return _0x5b2b08;};}function handleError(_0x12f436,_0x534ac7){_0x534ac7=_0x534ac7||0x1f4;return function(_0x15dfc5){logger[_0x16bb('0x22')](_0x15dfc5[_0x16bb('0x23')]);if(_0x15dfc5[_0x16bb('0x24')]){delete _0x15dfc5[_0x16bb('0x24')];}_0x12f436[_0x16bb('0x1b')](_0x534ac7)[_0x16bb('0x25')](_0x15dfc5);};}exports[_0x16bb('0x26')]=function(_0x56a155,_0x21307b){var _0x10d324={},_0x25ca6f={},_0x554f7c={'count':0x0,'rows':[]};var _0x25a731=_[_0x16bb('0x27')](db[_0x16bb('0x28')][_0x16bb('0x29')],function(_0x1fe89f){return{'name':_0x1fe89f[_0x16bb('0x2a')],'type':_0x1fe89f[_0x16bb('0x2b')]['key']};});_0x25ca6f[_0x16bb('0x2c')]=_[_0x16bb('0x27')](_0x25a731,_0x16bb('0x24'));_0x25ca6f['query']=_[_0x16bb('0x2d')](_0x56a155['query']);_0x25ca6f[_0x16bb('0x2e')]=_[_0x16bb('0x2f')](_0x25ca6f[_0x16bb('0x2c')],_0x25ca6f[_0x16bb('0x30')]);_0x10d324[_0x16bb('0x31')]=_['intersection'](_0x25ca6f[_0x16bb('0x2c')],qs['fields'](_0x56a155['query']['fields']));_0x10d324[_0x16bb('0x31')]=_0x10d324[_0x16bb('0x31')][_0x16bb('0x32')]?_0x10d324[_0x16bb('0x31')]:_0x25ca6f[_0x16bb('0x2c')];if(!_0x56a155[_0x16bb('0x30')][_0x16bb('0x33')]('nolimit')){_0x10d324[_0x16bb('0x1a')]=qs[_0x16bb('0x1a')](_0x56a155[_0x16bb('0x30')][_0x16bb('0x1a')]);_0x10d324['offset']=qs[_0x16bb('0x18')](_0x56a155['query'][_0x16bb('0x18')]);}_0x10d324[_0x16bb('0x34')]=qs[_0x16bb('0x35')](_0x56a155[_0x16bb('0x30')][_0x16bb('0x35')]);_0x10d324[_0x16bb('0x36')]=qs[_0x16bb('0x2e')](_['pick'](_0x56a155[_0x16bb('0x30')],_0x25ca6f[_0x16bb('0x2e')]),_0x25a731);if(_0x56a155[_0x16bb('0x30')][_0x16bb('0x37')]){_0x10d324[_0x16bb('0x36')]=_['merge'](_0x10d324['where'],{'$or':_[_0x16bb('0x27')](_0x25a731,function(_0x4c5ccb){if(_0x4c5ccb[_0x16bb('0x2b')]!==_0x16bb('0x38')){var _0x2c5d1a={};_0x2c5d1a[_0x4c5ccb[_0x16bb('0x24')]]={'$like':'%'+_0x56a155[_0x16bb('0x30')]['filter']+'%'};return _0x2c5d1a;}})});}_0x10d324=_[_0x16bb('0x39')]({},_0x10d324,_0x56a155[_0x16bb('0x3a')]);var _0x5a164c={'where':_0x10d324['where']};return db[_0x16bb('0x28')]['count'](_0x5a164c)[_0x16bb('0x20')](function(_0x62e3f0){_0x554f7c[_0x16bb('0x19')]=_0x62e3f0;if(_0x56a155['query'][_0x16bb('0x3b')]){_0x10d324[_0x16bb('0x3c')]=[{'all':!![]}];}return db[_0x16bb('0x28')][_0x16bb('0x3d')](_0x10d324);})[_0x16bb('0x20')](function(_0x28ef2f){_0x554f7c[_0x16bb('0x3e')]=_0x28ef2f;return _0x554f7c;})[_0x16bb('0x20')](respondWithFilteredResult(_0x21307b,_0x10d324))[_0x16bb('0x3f')](handleError(_0x21307b,null));};exports[_0x16bb('0x40')]=function(_0x4cd7d6,_0x30332c){var _0x517bed={'raw':![],'where':{'id':_0x4cd7d6['params']['id']}},_0x387a79={};_0x387a79[_0x16bb('0x2c')]=_[_0x16bb('0x2d')](db[_0x16bb('0x28')]['rawAttributes']);_0x387a79[_0x16bb('0x30')]=_[_0x16bb('0x2d')](_0x4cd7d6[_0x16bb('0x30')]);_0x387a79[_0x16bb('0x2e')]=_[_0x16bb('0x2f')](_0x387a79[_0x16bb('0x2c')],_0x387a79[_0x16bb('0x30')]);_0x517bed[_0x16bb('0x31')]=_['intersection'](_0x387a79[_0x16bb('0x2c')],qs[_0x16bb('0x41')](_0x4cd7d6[_0x16bb('0x30')][_0x16bb('0x41')]));_0x517bed[_0x16bb('0x31')]=_0x517bed[_0x16bb('0x31')][_0x16bb('0x32')]?_0x517bed['attributes']:_0x387a79[_0x16bb('0x2c')];if(_0x4cd7d6[_0x16bb('0x30')][_0x16bb('0x3b')]){_0x517bed[_0x16bb('0x3c')]=[{'all':!![]}];}_0x517bed=_[_0x16bb('0x39')]({},_0x517bed,_0x4cd7d6[_0x16bb('0x3a')]);return db['SugarcrmConfiguration'][_0x16bb('0x42')](_0x517bed)['then'](handleEntityNotFound(_0x30332c,null))[_0x16bb('0x20')](respondWithResult(_0x30332c,null))[_0x16bb('0x3f')](handleError(_0x30332c,null));};exports['create']=function(_0x10e66e,_0x7eb48e){return db[_0x16bb('0x28')][_0x16bb('0x43')](_0x10e66e[_0x16bb('0x44')],{})[_0x16bb('0x20')](respondWithResult(_0x7eb48e,0xc9))[_0x16bb('0x3f')](handleError(_0x7eb48e,null));};exports['update']=function(_0xd4985,_0x400933){if(_0xd4985[_0x16bb('0x44')]['id']){delete _0xd4985['body']['id'];}return db[_0x16bb('0x28')][_0x16bb('0x42')]({'where':{'id':_0xd4985[_0x16bb('0x45')]['id']}})[_0x16bb('0x20')](handleEntityNotFound(_0x400933,null))['then'](saveUpdates(_0xd4985[_0x16bb('0x44')],null))[_0x16bb('0x20')](respondWithResult(_0x400933,null))[_0x16bb('0x3f')](handleError(_0x400933,null));};exports[_0x16bb('0x21')]=function(_0x4eb48f,_0x136de1){return db[_0x16bb('0x28')][_0x16bb('0x42')]({'where':{'id':_0x4eb48f['params']['id']}})[_0x16bb('0x20')](handleEntityNotFound(_0x136de1,null))[_0x16bb('0x20')](removeEntity(_0x136de1,null))[_0x16bb('0x3f')](handleError(_0x136de1,null));};exports[_0x16bb('0x46')]=function(_0x269ae3,_0x38b131,_0x37ead1){var _0x17ed8a={};var _0x224ef5={};var _0x4eede6;var _0x5abef4;return db[_0x16bb('0x28')][_0x16bb('0x47')]({'where':{'id':_0x269ae3['params']['id']}})['then'](handleEntityNotFound(_0x38b131,null))['then'](function(_0x1ea100){if(_0x1ea100){_0x4eede6=_0x1ea100;_0x224ef5[_0x16bb('0x2c')]=_[_0x16bb('0x2d')](db[_0x16bb('0x48')][_0x16bb('0x29')]);_0x224ef5[_0x16bb('0x30')]=_[_0x16bb('0x2d')](_0x269ae3[_0x16bb('0x30')]);_0x224ef5[_0x16bb('0x2e')]=_[_0x16bb('0x2f')](_0x224ef5[_0x16bb('0x2c')],_0x224ef5[_0x16bb('0x30')]);_0x17ed8a['attributes']=_[_0x16bb('0x2f')](_0x224ef5[_0x16bb('0x2c')],qs[_0x16bb('0x41')](_0x269ae3[_0x16bb('0x30')][_0x16bb('0x41')]));_0x17ed8a[_0x16bb('0x31')]=_0x17ed8a['attributes'][_0x16bb('0x32')]?_0x17ed8a[_0x16bb('0x31')]:_0x224ef5[_0x16bb('0x2c')];_0x17ed8a[_0x16bb('0x34')]=qs['sort'](_0x269ae3['query'][_0x16bb('0x35')]);_0x17ed8a[_0x16bb('0x36')]=qs[_0x16bb('0x2e')](_[_0x16bb('0x49')](_0x269ae3[_0x16bb('0x30')],_0x224ef5[_0x16bb('0x2e')]));if(_0x269ae3[_0x16bb('0x30')][_0x16bb('0x37')]){_0x17ed8a[_0x16bb('0x36')]=_[_0x16bb('0x39')](_0x17ed8a[_0x16bb('0x36')],{'$or':_['map'](_0x17ed8a[_0x16bb('0x31')],function(_0x428868){var _0x591663={};_0x591663[_0x428868]={'$like':'%'+_0x269ae3[_0x16bb('0x30')]['filter']+'%'};return _0x591663;})});}_0x17ed8a=_[_0x16bb('0x39')]({},_0x17ed8a,_0x269ae3[_0x16bb('0x3a')]);return _0x4eede6['getFields'](_0x17ed8a);}})[_0x16bb('0x20')](function(_0x720210){if(_0x720210){_0x5abef4=_0x720210['length'];if(!_0x269ae3[_0x16bb('0x30')]['hasOwnProperty'](_0x16bb('0x4a'))){_0x17ed8a[_0x16bb('0x1a')]=qs[_0x16bb('0x1a')](_0x269ae3[_0x16bb('0x30')][_0x16bb('0x1a')]);_0x17ed8a[_0x16bb('0x18')]=qs[_0x16bb('0x18')](_0x269ae3[_0x16bb('0x30')][_0x16bb('0x18')]);}return _0x4eede6[_0x16bb('0x46')](_0x17ed8a);}})[_0x16bb('0x20')](function(_0x1e1fb1){if(_0x1e1fb1){return _0x1e1fb1?{'count':_0x5abef4,'rows':_0x1e1fb1}:null;}})['then'](respondWithResult(_0x38b131,null))[_0x16bb('0x3f')](handleError(_0x38b131,null));};exports['getSubjects']=function(_0xcd21dc,_0x2b4062,_0x47387a){var _0x5a5fdd={};var _0x43cec={};var _0x27a378;var _0x466d37;return db[_0x16bb('0x28')][_0x16bb('0x47')]({'where':{'id':_0xcd21dc[_0x16bb('0x45')]['id']}})[_0x16bb('0x20')](handleEntityNotFound(_0x2b4062,null))[_0x16bb('0x20')](function(_0x573bf){if(_0x573bf){_0x27a378=_0x573bf;_0x43cec[_0x16bb('0x2c')]=_['keys'](db[_0x16bb('0x48')]['rawAttributes']);_0x43cec['query']=_['keys'](_0xcd21dc[_0x16bb('0x30')]);_0x43cec[_0x16bb('0x2e')]=_[_0x16bb('0x2f')](_0x43cec['model'],_0x43cec[_0x16bb('0x30')]);_0x5a5fdd[_0x16bb('0x31')]=_[_0x16bb('0x2f')](_0x43cec[_0x16bb('0x2c')],qs[_0x16bb('0x41')](_0xcd21dc['query'][_0x16bb('0x41')]));_0x5a5fdd[_0x16bb('0x31')]=_0x5a5fdd[_0x16bb('0x31')][_0x16bb('0x32')]?_0x5a5fdd[_0x16bb('0x31')]:_0x43cec[_0x16bb('0x2c')];_0x5a5fdd[_0x16bb('0x34')]=qs['sort'](_0xcd21dc['query'][_0x16bb('0x35')]);_0x5a5fdd['where']=qs[_0x16bb('0x2e')](_['pick'](_0xcd21dc['query'],_0x43cec['filters']));if(_0xcd21dc[_0x16bb('0x30')]['filter']){_0x5a5fdd[_0x16bb('0x36')]=_[_0x16bb('0x39')](_0x5a5fdd[_0x16bb('0x36')],{'$or':_[_0x16bb('0x27')](_0x5a5fdd[_0x16bb('0x31')],function(_0x5d626){var _0x24e521={};_0x24e521[_0x5d626]={'$like':'%'+_0xcd21dc[_0x16bb('0x30')]['filter']+'%'};return _0x24e521;})});}_0x5a5fdd=_[_0x16bb('0x39')]({},_0x5a5fdd,_0xcd21dc['options']);return _0x27a378['getSubjects'](_0x5a5fdd);}})[_0x16bb('0x20')](function(_0x499a43){if(_0x499a43){_0x466d37=_0x499a43[_0x16bb('0x32')];if(!_0xcd21dc[_0x16bb('0x30')][_0x16bb('0x33')](_0x16bb('0x4a'))){_0x5a5fdd[_0x16bb('0x1a')]=qs[_0x16bb('0x1a')](_0xcd21dc['query']['limit']);_0x5a5fdd['offset']=qs['offset'](_0xcd21dc['query'][_0x16bb('0x18')]);}return _0x27a378[_0x16bb('0x4b')](_0x5a5fdd);}})['then'](function(_0x3702d7){if(_0x3702d7){return _0x3702d7?{'count':_0x466d37,'rows':_0x3702d7}:null;}})[_0x16bb('0x20')](respondWithResult(_0x2b4062,null))[_0x16bb('0x3f')](handleError(_0x2b4062,null));};exports[_0x16bb('0x4c')]=function(_0x3ee984,_0x1a7013,_0x5c401e){var _0xf80464={};var _0x1d6d06={};var _0xd77c89;var _0x3d38b9;return db[_0x16bb('0x28')][_0x16bb('0x47')]({'where':{'id':_0x3ee984[_0x16bb('0x45')]['id']}})[_0x16bb('0x20')](handleEntityNotFound(_0x1a7013,null))[_0x16bb('0x20')](function(_0xa8e26b){if(_0xa8e26b){_0xd77c89=_0xa8e26b;_0x1d6d06[_0x16bb('0x2c')]=_['keys'](db[_0x16bb('0x48')][_0x16bb('0x29')]);_0x1d6d06[_0x16bb('0x30')]=_['keys'](_0x3ee984[_0x16bb('0x30')]);_0x1d6d06[_0x16bb('0x2e')]=_['intersection'](_0x1d6d06['model'],_0x1d6d06[_0x16bb('0x30')]);_0xf80464[_0x16bb('0x31')]=_[_0x16bb('0x2f')](_0x1d6d06['model'],qs[_0x16bb('0x41')](_0x3ee984[_0x16bb('0x30')][_0x16bb('0x41')]));_0xf80464[_0x16bb('0x31')]=_0xf80464[_0x16bb('0x31')][_0x16bb('0x32')]?_0xf80464[_0x16bb('0x31')]:_0x1d6d06[_0x16bb('0x2c')];_0xf80464['order']=qs[_0x16bb('0x35')](_0x3ee984[_0x16bb('0x30')]['sort']);_0xf80464[_0x16bb('0x36')]=qs['filters'](_[_0x16bb('0x49')](_0x3ee984['query'],_0x1d6d06['filters']));if(_0x3ee984['query'][_0x16bb('0x37')]){_0xf80464[_0x16bb('0x36')]=_[_0x16bb('0x39')](_0xf80464[_0x16bb('0x36')],{'$or':_[_0x16bb('0x27')](_0xf80464[_0x16bb('0x31')],function(_0x4ad651){var _0x527392={};_0x527392[_0x4ad651]={'$like':'%'+_0x3ee984[_0x16bb('0x30')][_0x16bb('0x37')]+'%'};return _0x527392;})});}_0xf80464=_[_0x16bb('0x39')]({},_0xf80464,_0x3ee984['options']);return _0xd77c89[_0x16bb('0x4c')](_0xf80464);}})['then'](function(_0x4a8674){if(_0x4a8674){_0x3d38b9=_0x4a8674[_0x16bb('0x32')];if(!_0x3ee984[_0x16bb('0x30')][_0x16bb('0x33')](_0x16bb('0x4a'))){_0xf80464[_0x16bb('0x1a')]=qs[_0x16bb('0x1a')](_0x3ee984[_0x16bb('0x30')][_0x16bb('0x1a')]);_0xf80464[_0x16bb('0x18')]=qs[_0x16bb('0x18')](_0x3ee984[_0x16bb('0x30')]['offset']);}return _0xd77c89[_0x16bb('0x4c')](_0xf80464);}})[_0x16bb('0x20')](function(_0x1b7cdf){if(_0x1b7cdf){return _0x1b7cdf?{'count':_0x3d38b9,'rows':_0x1b7cdf}:null;}})['then'](respondWithResult(_0x1a7013,null))[_0x16bb('0x3f')](handleError(_0x1a7013,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c0423ee..edaf71e 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 _0xc049=['api','moment','bluebird','path','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xc049,0x14c));var _0x9c04=function(_0xd286c8,_0x20c090){_0xd286c8=_0xd286c8-0x0;var _0x489168=_0xc049[_0xd286c8];return _0x489168;};'use strict';var _=require(_0x9c04('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9c04('0x1'));var moment=require(_0x9c04('0x2'));var BPromise=require(_0x9c04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c04('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9c04('0x5'));module[_0x9c04('0x6')]=function(_0x36b760,_0x54b8af){return _0x36b760[_0x9c04('0x7')](_0x9c04('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e7b=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x4c62a8,_0x3b08e2){var _0x2d4902=function(_0x18175c){while(--_0x18175c){_0x4c62a8['push'](_0x4c62a8['shift']());}};_0x2d4902(++_0x3b08e2);}(_0x8e7b,0x1df));var _0xb8e7=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x8e7b[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xb8e7('0x0'));var util=require(_0xb8e7('0x1'));var logger=require('../../config/logger')(_0xb8e7('0x2'));var moment=require('moment');var BPromise=require(_0xb8e7('0x3'));var rp=require(_0xb8e7('0x4'));var fs=require('fs');var path=require(_0xb8e7('0x5'));var rimraf=require(_0xb8e7('0x6'));var config=require(_0xb8e7('0x7'));var attributes=require(_0xb8e7('0x8'));module[_0xb8e7('0x9')]=function(_0x3448aa,_0x32cbe4){return _0x3448aa[_0xb8e7('0xa')](_0xb8e7('0xb'),attributes,{'tableName':_0xb8e7('0xc'),'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 82b936a..7ca07b0 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 _0x2645=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x1f9bcc,_0x400cb8){var _0x12831a=function(_0x53faae){while(--_0x53faae){_0x1f9bcc['push'](_0x1f9bcc['shift']());}};_0x12831a(++_0x400cb8);}(_0x2645,0x165));var _0x5264=function(_0x12d53f,_0x48a55b){_0x12d53f=_0x12d53f-0x0;var _0x50cbee=_0x2645[_0x12d53f];return _0x50cbee;};'use strict';var _=require(_0x5264('0x0'));var util=require(_0x5264('0x1'));var moment=require(_0x5264('0x2'));var BPromise=require(_0x5264('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5264('0x4'));var db=require(_0x5264('0x5'))['db'];var utils=require(_0x5264('0x6'));var logger=require('../../config/logger')(_0x5264('0x7'));var config=require('../../config/environment');var jayson=require(_0x5264('0x8'));var client=jayson[_0x5264('0x9')][_0x5264('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47a011,_0x1996dd,_0x574858){return new BPromise(function(_0xdaeb1b,_0x44690e){return client['request'](_0x47a011,_0x574858)[_0x5264('0xb')](function(_0x109ee6){logger['info'](_0x5264('0xc'),_0x1996dd,'request\x20sent');logger[_0x5264('0xd')](_0x5264('0xe'),_0x1996dd,_0x5264('0xf'),JSON[_0x5264('0x10')](_0x109ee6));if(_0x109ee6['error']){if(_0x109ee6[_0x5264('0x11')][_0x5264('0x12')]===0x1f4){logger[_0x5264('0x11')](_0x5264('0xc'),_0x1996dd,_0x109ee6[_0x5264('0x11')][_0x5264('0x13')]);return _0x44690e(_0x109ee6[_0x5264('0x11')]['message']);}logger[_0x5264('0x11')](_0x5264('0xc'),_0x1996dd,_0x109ee6[_0x5264('0x11')][_0x5264('0x13')]);return _0xdaeb1b(_0x109ee6[_0x5264('0x11')][_0x5264('0x13')]);}else{logger[_0x5264('0x14')](_0x5264('0xc'),_0x1996dd,_0x5264('0xf'));_0xdaeb1b(_0x109ee6['result'][_0x5264('0x13')]);}})['catch'](function(_0x2edf23){logger[_0x5264('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1996dd,_0x2edf23);_0x44690e(_0x2edf23);});});} \ No newline at end of file +var _0x064e=['SugarcrmConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x3999ac,_0x56f9d4){var _0x4a73e7=function(_0x3a081c){while(--_0x3a081c){_0x3999ac['push'](_0x3999ac['shift']());}};_0x4a73e7(++_0x56f9d4);}(_0x064e,0x12f));var _0xe064=function(_0x225f2f,_0x243686){_0x225f2f=_0x225f2f-0x0;var _0x27b19a=_0x064e[_0x225f2f];return _0x27b19a;};'use strict';var _=require('lodash');var util=require(_0xe064('0x0'));var moment=require(_0xe064('0x1'));var BPromise=require(_0xe064('0x2'));var rs=require(_0xe064('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe064('0x4'));var logger=require(_0xe064('0x5'))(_0xe064('0x6'));var config=require('../../config/environment');var jayson=require(_0xe064('0x7'));var client=jayson[_0xe064('0x8')][_0xe064('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5611b1,_0x1492dd,_0x1ffed3){return new BPromise(function(_0x2edb22,_0x36208a){return client[_0xe064('0xa')](_0x5611b1,_0x1ffed3)[_0xe064('0xb')](function(_0x143202){logger[_0xe064('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1492dd,_0xe064('0xd'));logger[_0xe064('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x1492dd,'request\x20sent',JSON[_0xe064('0xf')](_0x143202));if(_0x143202['error']){if(_0x143202[_0xe064('0x10')]['code']===0x1f4){logger[_0xe064('0x10')](_0xe064('0x11'),_0x1492dd,_0x143202[_0xe064('0x10')]['message']);return _0x36208a(_0x143202[_0xe064('0x10')][_0xe064('0x12')]);}logger[_0xe064('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1492dd,_0x143202[_0xe064('0x10')][_0xe064('0x12')]);return _0x2edb22(_0x143202[_0xe064('0x10')][_0xe064('0x12')]);}else{logger[_0xe064('0xc')](_0xe064('0x11'),_0x1492dd,'request\x20sent');_0x2edb22(_0x143202['result']['message']);}})[_0xe064('0x13')](function(_0x4c28ab){logger[_0xe064('0x10')](_0xe064('0x11'),_0x1492dd,_0x4c28ab);_0x36208a(_0x4c28ab);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 7246b09..56d22a0 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 _0x16b1=['../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0x16b1,0x7d));var _0x116b=function(_0x47f6bb,_0x2bad5b){_0x47f6bb=_0x47f6bb-0x0;var _0xd73348=_0x16b1[_0x47f6bb];return _0xd73348;};'use strict';var multer=require(_0x116b('0x0'));var util=require(_0x116b('0x1'));var path=require(_0x116b('0x2'));var timeout=require('connect-timeout');var express=require(_0x116b('0x3'));var router=express[_0x116b('0x4')]();var fs_extra=require(_0x116b('0x5'));var auth=require(_0x116b('0x6'));var interaction=require(_0x116b('0x7'));var config=require(_0x116b('0x8'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x116b('0x9')]('/:id',auth[_0x116b('0xa')](),controller[_0x116b('0xb')]);router[_0x116b('0xc')]('/',auth[_0x116b('0xa')](),controller[_0x116b('0xd')]);router[_0x116b('0xe')](_0x116b('0xf'),auth['isAuthenticated'](),controller[_0x116b('0x10')]);router['delete'](_0x116b('0xf'),auth[_0x116b('0xa')](),controller[_0x116b('0x11')]);module[_0x116b('0x12')]=router; \ No newline at end of file +var _0x2b94=['isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x1337c6,_0x3e8010){var _0x28bcf4=function(_0x3f0a5a){while(--_0x3f0a5a){_0x1337c6['push'](_0x1337c6['shift']());}};_0x28bcf4(++_0x3e8010);}(_0x2b94,0x121));var _0x42b9=function(_0x1c45e5,_0x58014b){_0x1c45e5=_0x1c45e5-0x0;var _0x1bc672=_0x2b94[_0x1c45e5];return _0x1bc672;};'use strict';var multer=require(_0x42b9('0x0'));var util=require('util');var path=require(_0x42b9('0x1'));var timeout=require(_0x42b9('0x2'));var express=require(_0x42b9('0x3'));var router=express[_0x42b9('0x4')]();var fs_extra=require(_0x42b9('0x5'));var auth=require(_0x42b9('0x6'));var interaction=require(_0x42b9('0x7'));var config=require(_0x42b9('0x8'));var controller=require(_0x42b9('0x9'));router[_0x42b9('0xa')]('/',auth[_0x42b9('0xb')](),controller['index']);router[_0x42b9('0xa')](_0x42b9('0xc'),auth['isAuthenticated'](),controller[_0x42b9('0xd')]);router[_0x42b9('0xe')]('/',auth[_0x42b9('0xb')](),controller[_0x42b9('0xf')]);router[_0x42b9('0x10')](_0x42b9('0xc'),auth[_0x42b9('0xb')](),controller['update']);router[_0x42b9('0x11')]('/:id',auth[_0x42b9('0xb')](),controller[_0x42b9('0x12')]);module[_0x42b9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 955f29f..5cbf47c 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 _0x9cd4=['ENUM','BOOLEAN','exports','variable','customVariable','keyValue','string','STRING'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x9cd4,0xfa));var _0x49cd=function(_0x4b095c,_0x266c55){_0x4b095c=_0x4b095c-0x0;var _0x4495e2=_0x9cd4[_0x4b095c];return _0x4495e2;};'use strict';var Sequelize=require('sequelize');module[_0x49cd('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x49cd('0x1'),_0x49cd('0x2'),_0x49cd('0x3'),'picklist'),'defaultValue':_0x49cd('0x4')},'content':{'type':Sequelize[_0x49cd('0x5')]},'key':{'type':Sequelize[_0x49cd('0x5')]},'keyType':{'type':Sequelize[_0x49cd('0x6')](_0x49cd('0x4'),_0x49cd('0x1'),_0x49cd('0x2'))},'keyContent':{'type':Sequelize[_0x49cd('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x49cd('0x5')]},'customField':{'type':Sequelize[_0x49cd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x49cd('0x5')]}}; \ No newline at end of file +var _0xaa75=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','sequelize'];(function(_0x518021,_0x3501a4){var _0x1c4617=function(_0x5c0848){while(--_0x5c0848){_0x518021['push'](_0x518021['shift']());}};_0x1c4617(++_0x3501a4);}(_0xaa75,0x11f));var _0x5aa7=function(_0x5b2e6b,_0x2b848c){_0x5b2e6b=_0x5b2e6b-0x0;var _0x2d1dff=_0xaa75[_0x5b2e6b];return _0x2d1dff;};'use strict';var Sequelize=require(_0x5aa7('0x0'));module[_0x5aa7('0x1')]={'type':{'type':Sequelize[_0x5aa7('0x2')](_0x5aa7('0x3'),'variable',_0x5aa7('0x4'),_0x5aa7('0x5'),_0x5aa7('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5aa7('0x7')]},'key':{'type':Sequelize[_0x5aa7('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x5aa7('0x3'),_0x5aa7('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5aa7('0x7')]},'nameField':{'type':Sequelize[_0x5aa7('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 1f2cf61..78698a8 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 _0xd8c2=['../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','catch','create','body','zip-dir','moment','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x2fc6cf,_0x2bb133){var _0xf2ade3=function(_0x522b04){while(--_0x522b04){_0x2fc6cf['push'](_0x2fc6cf['shift']());}};_0xf2ade3(++_0x2bb133);}(_0xd8c2,0x182));var _0x2d8c=function(_0x4966ad,_0x398da6){_0x4966ad=_0x4966ad-0x0;var _0x27efb8=_0xd8c2[_0x4966ad];return _0x27efb8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d8c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d8c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x2d8c('0x2'));var util=require(_0x2d8c('0x3'));var path=require('path');var sox=require(_0x2d8c('0x4'));var csv=require(_0x2d8c('0x5'));var ejs=require(_0x2d8c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2d8c('0x7'));var crypto=require(_0x2d8c('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2d8c('0x5'));var querystring=require(_0x2d8c('0x9'));var Papa=require(_0x2d8c('0xa'));var Redis=require(_0x2d8c('0xb'));var authService=require(_0x2d8c('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d8c('0xd'));var logger=require(_0x2d8c('0xe'))(_0x2d8c('0xf'));var utils=require(_0x2d8c('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x2d8c('0x11'));var db=require(_0x2d8c('0x12'))['db'];function respondWithStatusCode(_0x2838c7,_0x2d562d){_0x2d562d=_0x2d562d||0xcc;return function(_0x3850da){if(_0x3850da){return _0x2838c7['sendStatus'](_0x2d562d);}return _0x2838c7['status'](_0x2d562d)[_0x2d8c('0x13')]();};}function respondWithResult(_0x5ea38a,_0x120d37){_0x120d37=_0x120d37||0xc8;return function(_0x3ed465){if(_0x3ed465){return _0x5ea38a[_0x2d8c('0x14')](_0x120d37)[_0x2d8c('0x15')](_0x3ed465);}};}function respondWithFilteredResult(_0x853ee2,_0x52e513){return function(_0x4e6255){if(_0x4e6255){var _0x491666=typeof _0x52e513[_0x2d8c('0x16')]==='undefined'&&typeof _0x52e513[_0x2d8c('0x17')]===_0x2d8c('0x18');var _0x263301=_0x4e6255[_0x2d8c('0x19')];var _0x389401=_0x491666?0x0:_0x52e513['offset'];var _0x2bdb95=_0x491666?_0x4e6255[_0x2d8c('0x19')]:_0x52e513[_0x2d8c('0x16')]+_0x52e513[_0x2d8c('0x17')];var _0xe3a42;if(_0x2bdb95>=_0x263301){_0x2bdb95=_0x263301;_0xe3a42=0xc8;}else{_0xe3a42=0xce;}_0x853ee2[_0x2d8c('0x14')](_0xe3a42);return _0x853ee2['set']('Content-Range',_0x389401+'-'+_0x2bdb95+'/'+_0x263301)[_0x2d8c('0x15')](_0x4e6255);}return null;};}function patchUpdates(_0x1f6a87){return function(_0x4767a8){try{jsonpatch[_0x2d8c('0x1a')](_0x4767a8,_0x1f6a87,!![]);}catch(_0x4eb7cc){return BPromise['reject'](_0x4eb7cc);}return _0x4767a8[_0x2d8c('0x1b')]();};}function saveUpdates(_0x352f31,_0x5431ea){return function(_0x493769){if(_0x493769){return _0x493769[_0x2d8c('0x1c')](_0x352f31)[_0x2d8c('0x1d')](function(_0x127453){return _0x127453;});}return null;};}function removeEntity(_0x573d84,_0x324256){return function(_0x20a081){if(_0x20a081){return _0x20a081[_0x2d8c('0x1e')]()['then'](function(){_0x573d84[_0x2d8c('0x14')](0xcc)[_0x2d8c('0x13')]();});}};}function handleEntityNotFound(_0x1fabe9,_0x4a0e46){return function(_0x161931){if(!_0x161931){_0x1fabe9[_0x2d8c('0x1f')](0x194);}return _0x161931;};}function handleError(_0x574ee6,_0x5eab9c){_0x5eab9c=_0x5eab9c||0x1f4;return function(_0x21ab1d){logger[_0x2d8c('0x20')](_0x21ab1d[_0x2d8c('0x21')]);if(_0x21ab1d['name']){delete _0x21ab1d[_0x2d8c('0x22')];}_0x574ee6['status'](_0x5eab9c)['send'](_0x21ab1d);};}exports[_0x2d8c('0x23')]=function(_0x312a1f,_0x1288b9){var _0x5ef434={},_0x536847={},_0x3443e5={'count':0x0,'rows':[]};var _0x1d8ea8=_[_0x2d8c('0x24')](db[_0x2d8c('0x25')][_0x2d8c('0x26')],function(_0x316040){return{'name':_0x316040[_0x2d8c('0x27')],'type':_0x316040['type'][_0x2d8c('0x28')]};});_0x536847[_0x2d8c('0x29')]=_[_0x2d8c('0x24')](_0x1d8ea8,'name');_0x536847[_0x2d8c('0x2a')]=_[_0x2d8c('0x2b')](_0x312a1f[_0x2d8c('0x2a')]);_0x536847[_0x2d8c('0x2c')]=_['intersection'](_0x536847[_0x2d8c('0x29')],_0x536847[_0x2d8c('0x2a')]);_0x5ef434[_0x2d8c('0x2d')]=_[_0x2d8c('0x2e')](_0x536847['model'],qs[_0x2d8c('0x2f')](_0x312a1f[_0x2d8c('0x2a')][_0x2d8c('0x2f')]));_0x5ef434['attributes']=_0x5ef434[_0x2d8c('0x2d')]['length']?_0x5ef434[_0x2d8c('0x2d')]:_0x536847['model'];if(!_0x312a1f[_0x2d8c('0x2a')]['hasOwnProperty'](_0x2d8c('0x30'))){_0x5ef434['limit']=qs[_0x2d8c('0x17')](_0x312a1f[_0x2d8c('0x2a')][_0x2d8c('0x17')]);_0x5ef434[_0x2d8c('0x16')]=qs[_0x2d8c('0x16')](_0x312a1f[_0x2d8c('0x2a')][_0x2d8c('0x16')]);}_0x5ef434[_0x2d8c('0x31')]=qs[_0x2d8c('0x32')](_0x312a1f[_0x2d8c('0x2a')][_0x2d8c('0x32')]);_0x5ef434[_0x2d8c('0x33')]=qs[_0x2d8c('0x2c')](_[_0x2d8c('0x34')](_0x312a1f[_0x2d8c('0x2a')],_0x536847['filters']),_0x1d8ea8);if(_0x312a1f[_0x2d8c('0x2a')][_0x2d8c('0x35')]){_0x5ef434['where']=_['merge'](_0x5ef434[_0x2d8c('0x33')],{'$or':_['map'](_0x1d8ea8,function(_0x40d0f9){if(_0x40d0f9[_0x2d8c('0x36')]!==_0x2d8c('0x37')){var _0x188643={};_0x188643[_0x40d0f9['name']]={'$like':'%'+_0x312a1f[_0x2d8c('0x2a')][_0x2d8c('0x35')]+'%'};return _0x188643;}})});}_0x5ef434=_[_0x2d8c('0x38')]({},_0x5ef434,_0x312a1f[_0x2d8c('0x39')]);var _0x2644c9={'where':_0x5ef434['where']};return db[_0x2d8c('0x25')][_0x2d8c('0x19')](_0x2644c9)['then'](function(_0x1a7eb1){_0x3443e5[_0x2d8c('0x19')]=_0x1a7eb1;if(_0x312a1f[_0x2d8c('0x2a')][_0x2d8c('0x3a')]){_0x5ef434[_0x2d8c('0x3b')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x5ef434);})[_0x2d8c('0x1d')](function(_0x13f173){_0x3443e5[_0x2d8c('0x3c')]=_0x13f173;return _0x3443e5;})[_0x2d8c('0x1d')](respondWithFilteredResult(_0x1288b9,_0x5ef434))['catch'](handleError(_0x1288b9,null));};exports[_0x2d8c('0x3d')]=function(_0x3aa4ee,_0x2902cb){var _0x1096eb={'raw':!![],'where':{'id':_0x3aa4ee[_0x2d8c('0x3e')]['id']}},_0x1a534e={};_0x1a534e[_0x2d8c('0x29')]=_['keys'](db[_0x2d8c('0x25')][_0x2d8c('0x26')]);_0x1a534e['query']=_['keys'](_0x3aa4ee[_0x2d8c('0x2a')]);_0x1a534e[_0x2d8c('0x2c')]=_[_0x2d8c('0x2e')](_0x1a534e[_0x2d8c('0x29')],_0x1a534e['query']);_0x1096eb[_0x2d8c('0x2d')]=_['intersection'](_0x1a534e[_0x2d8c('0x29')],qs[_0x2d8c('0x2f')](_0x3aa4ee[_0x2d8c('0x2a')][_0x2d8c('0x2f')]));_0x1096eb['attributes']=_0x1096eb['attributes']['length']?_0x1096eb[_0x2d8c('0x2d')]:_0x1a534e[_0x2d8c('0x29')];if(_0x3aa4ee[_0x2d8c('0x2a')][_0x2d8c('0x3a')]){_0x1096eb[_0x2d8c('0x3b')]=[{'all':!![]}];}_0x1096eb=_[_0x2d8c('0x38')]({},_0x1096eb,_0x3aa4ee['options']);return db[_0x2d8c('0x25')][_0x2d8c('0x3f')](_0x1096eb)[_0x2d8c('0x1d')](handleEntityNotFound(_0x2902cb,null))[_0x2d8c('0x1d')](respondWithResult(_0x2902cb,null))[_0x2d8c('0x40')](handleError(_0x2902cb,null));};exports[_0x2d8c('0x41')]=function(_0x2fc610,_0x2e1680){return db[_0x2d8c('0x25')][_0x2d8c('0x41')](_0x2fc610['body'],{})[_0x2d8c('0x1d')](respondWithResult(_0x2e1680,0xc9))[_0x2d8c('0x40')](handleError(_0x2e1680,null));};exports[_0x2d8c('0x1c')]=function(_0x7604f5,_0x4a0109){if(_0x7604f5[_0x2d8c('0x42')]['id']){delete _0x7604f5['body']['id'];}return db[_0x2d8c('0x25')][_0x2d8c('0x3f')]({'where':{'id':_0x7604f5['params']['id']}})['then'](handleEntityNotFound(_0x4a0109,null))[_0x2d8c('0x1d')](saveUpdates(_0x7604f5[_0x2d8c('0x42')],null))[_0x2d8c('0x1d')](respondWithResult(_0x4a0109,null))[_0x2d8c('0x40')](handleError(_0x4a0109,null));};exports[_0x2d8c('0x1e')]=function(_0x108c30,_0x3410ed){return db['SugarcrmField'][_0x2d8c('0x3f')]({'where':{'id':_0x108c30[_0x2d8c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3410ed,null))[_0x2d8c('0x1d')](removeEntity(_0x3410ed,null))[_0x2d8c('0x40')](handleError(_0x3410ed,null));}; \ No newline at end of file +var _0x97b5=['includeAll','include','findAll','rows','show','params','rawAttributes','length','create','catch','body','destroy','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','index','map','SugarcrmField','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options'];(function(_0x3daf57,_0x38912a){var _0x5889eb=function(_0x25346b){while(--_0x25346b){_0x3daf57['push'](_0x3daf57['shift']());}};_0x5889eb(++_0x38912a);}(_0x97b5,0xe7));var _0x597b=function(_0x44d6b8,_0xe7e065){_0x44d6b8=_0x44d6b8-0x0;var _0x18cbfa=_0x97b5[_0x44d6b8];return _0x18cbfa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x597b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x597b('0x1'));var BPromise=require(_0x597b('0x2'));var Mustache=require(_0x597b('0x3'));var util=require(_0x597b('0x4'));var path=require(_0x597b('0x5'));var sox=require(_0x597b('0x6'));var csv=require(_0x597b('0x7'));var ejs=require(_0x597b('0x8'));var fs=require('fs');var fs_extra=require(_0x597b('0x9'));var _=require(_0x597b('0xa'));var squel=require('squel');var crypto=require(_0x597b('0xb'));var jsforce=require(_0x597b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x597b('0x7'));var querystring=require(_0x597b('0xd'));var Papa=require(_0x597b('0xe'));var Redis=require('ioredis');var authService=require(_0x597b('0xf'));var qs=require(_0x597b('0x10'));var as=require(_0x597b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x597b('0x12'))(_0x597b('0x13'));var utils=require('../../config/utils');var config=require(_0x597b('0x14'));var licenseUtil=require(_0x597b('0x15'));var db=require(_0x597b('0x16'))['db'];function respondWithStatusCode(_0x8331b5,_0x1cca25){_0x1cca25=_0x1cca25||0xcc;return function(_0x174724){if(_0x174724){return _0x8331b5[_0x597b('0x17')](_0x1cca25);}return _0x8331b5[_0x597b('0x18')](_0x1cca25)[_0x597b('0x19')]();};}function respondWithResult(_0x2fbc7b,_0x170573){_0x170573=_0x170573||0xc8;return function(_0x2480a5){if(_0x2480a5){return _0x2fbc7b[_0x597b('0x18')](_0x170573)[_0x597b('0x1a')](_0x2480a5);}};}function respondWithFilteredResult(_0x319149,_0x211f1a){return function(_0x40d28d){if(_0x40d28d){var _0x1b62d0=typeof _0x211f1a['offset']===_0x597b('0x1b')&&typeof _0x211f1a[_0x597b('0x1c')]===_0x597b('0x1b');var _0x2b4d39=_0x40d28d[_0x597b('0x1d')];var _0xd60b8b=_0x1b62d0?0x0:_0x211f1a[_0x597b('0x1e')];var _0x5062c7=_0x1b62d0?_0x40d28d[_0x597b('0x1d')]:_0x211f1a['offset']+_0x211f1a[_0x597b('0x1c')];var _0x4c5b1f;if(_0x5062c7>=_0x2b4d39){_0x5062c7=_0x2b4d39;_0x4c5b1f=0xc8;}else{_0x4c5b1f=0xce;}_0x319149[_0x597b('0x18')](_0x4c5b1f);return _0x319149[_0x597b('0x1f')](_0x597b('0x20'),_0xd60b8b+'-'+_0x5062c7+'/'+_0x2b4d39)[_0x597b('0x1a')](_0x40d28d);}return null;};}function patchUpdates(_0x276eb5){return function(_0x155daa){try{jsonpatch['apply'](_0x155daa,_0x276eb5,!![]);}catch(_0x3b5439){return BPromise[_0x597b('0x21')](_0x3b5439);}return _0x155daa[_0x597b('0x22')]();};}function saveUpdates(_0x3e985e,_0x534d9a){return function(_0x115854){if(_0x115854){return _0x115854[_0x597b('0x23')](_0x3e985e)[_0x597b('0x24')](function(_0x546280){return _0x546280;});}return null;};}function removeEntity(_0x5a1455,_0x1bc46c){return function(_0x49e866){if(_0x49e866){return _0x49e866['destroy']()['then'](function(){_0x5a1455[_0x597b('0x18')](0xcc)[_0x597b('0x19')]();});}};}function handleEntityNotFound(_0x3bc571,_0x102667){return function(_0x570ebd){if(!_0x570ebd){_0x3bc571[_0x597b('0x17')](0x194);}return _0x570ebd;};}function handleError(_0x411d24,_0x449133){_0x449133=_0x449133||0x1f4;return function(_0x27e319){logger[_0x597b('0x25')](_0x27e319[_0x597b('0x26')]);if(_0x27e319[_0x597b('0x27')]){delete _0x27e319[_0x597b('0x27')];}_0x411d24[_0x597b('0x18')](_0x449133)['send'](_0x27e319);};}exports[_0x597b('0x28')]=function(_0x43ce65,_0x33b47a){var _0x1d3552={},_0x4a73c5={},_0x5cd0bc={'count':0x0,'rows':[]};var _0x24a8c0=_[_0x597b('0x29')](db[_0x597b('0x2a')]['rawAttributes'],function(_0x431c79){return{'name':_0x431c79[_0x597b('0x2b')],'type':_0x431c79[_0x597b('0x2c')][_0x597b('0x2d')]};});_0x4a73c5['model']=_['map'](_0x24a8c0,'name');_0x4a73c5[_0x597b('0x2e')]=_[_0x597b('0x2f')](_0x43ce65[_0x597b('0x2e')]);_0x4a73c5[_0x597b('0x30')]=_[_0x597b('0x31')](_0x4a73c5['model'],_0x4a73c5[_0x597b('0x2e')]);_0x1d3552['attributes']=_['intersection'](_0x4a73c5[_0x597b('0x32')],qs['fields'](_0x43ce65[_0x597b('0x2e')][_0x597b('0x33')]));_0x1d3552[_0x597b('0x34')]=_0x1d3552['attributes']['length']?_0x1d3552[_0x597b('0x34')]:_0x4a73c5[_0x597b('0x32')];if(!_0x43ce65[_0x597b('0x2e')][_0x597b('0x35')](_0x597b('0x36'))){_0x1d3552['limit']=qs[_0x597b('0x1c')](_0x43ce65[_0x597b('0x2e')][_0x597b('0x1c')]);_0x1d3552[_0x597b('0x1e')]=qs[_0x597b('0x1e')](_0x43ce65['query'][_0x597b('0x1e')]);}_0x1d3552['order']=qs['sort'](_0x43ce65[_0x597b('0x2e')][_0x597b('0x37')]);_0x1d3552[_0x597b('0x38')]=qs[_0x597b('0x30')](_['pick'](_0x43ce65[_0x597b('0x2e')],_0x4a73c5['filters']),_0x24a8c0);if(_0x43ce65['query']['filter']){_0x1d3552['where']=_[_0x597b('0x39')](_0x1d3552[_0x597b('0x38')],{'$or':_[_0x597b('0x29')](_0x24a8c0,function(_0xd88f35){if(_0xd88f35[_0x597b('0x2c')]!==_0x597b('0x3a')){var _0x388bc3={};_0x388bc3[_0xd88f35['name']]={'$like':'%'+_0x43ce65[_0x597b('0x2e')][_0x597b('0x3b')]+'%'};return _0x388bc3;}})});}_0x1d3552=_['merge']({},_0x1d3552,_0x43ce65[_0x597b('0x3c')]);var _0x308113={'where':_0x1d3552[_0x597b('0x38')]};return db[_0x597b('0x2a')][_0x597b('0x1d')](_0x308113)[_0x597b('0x24')](function(_0x2e3168){_0x5cd0bc['count']=_0x2e3168;if(_0x43ce65[_0x597b('0x2e')][_0x597b('0x3d')]){_0x1d3552[_0x597b('0x3e')]=[{'all':!![]}];}return db[_0x597b('0x2a')][_0x597b('0x3f')](_0x1d3552);})['then'](function(_0x472dbe){_0x5cd0bc[_0x597b('0x40')]=_0x472dbe;return _0x5cd0bc;})['then'](respondWithFilteredResult(_0x33b47a,_0x1d3552))['catch'](handleError(_0x33b47a,null));};exports[_0x597b('0x41')]=function(_0x2b4da0,_0x138f67){var _0x436ae7={'raw':!![],'where':{'id':_0x2b4da0[_0x597b('0x42')]['id']}},_0x44873c={};_0x44873c['model']=_[_0x597b('0x2f')](db[_0x597b('0x2a')][_0x597b('0x43')]);_0x44873c[_0x597b('0x2e')]=_[_0x597b('0x2f')](_0x2b4da0['query']);_0x44873c['filters']=_[_0x597b('0x31')](_0x44873c['model'],_0x44873c[_0x597b('0x2e')]);_0x436ae7['attributes']=_[_0x597b('0x31')](_0x44873c['model'],qs['fields'](_0x2b4da0[_0x597b('0x2e')][_0x597b('0x33')]));_0x436ae7[_0x597b('0x34')]=_0x436ae7[_0x597b('0x34')][_0x597b('0x44')]?_0x436ae7['attributes']:_0x44873c['model'];if(_0x2b4da0[_0x597b('0x2e')][_0x597b('0x3d')]){_0x436ae7[_0x597b('0x3e')]=[{'all':!![]}];}_0x436ae7=_[_0x597b('0x39')]({},_0x436ae7,_0x2b4da0[_0x597b('0x3c')]);return db[_0x597b('0x2a')]['find'](_0x436ae7)[_0x597b('0x24')](handleEntityNotFound(_0x138f67,null))[_0x597b('0x24')](respondWithResult(_0x138f67,null))['catch'](handleError(_0x138f67,null));};exports[_0x597b('0x45')]=function(_0x5349a0,_0x407cc7){return db[_0x597b('0x2a')][_0x597b('0x45')](_0x5349a0['body'],{})[_0x597b('0x24')](respondWithResult(_0x407cc7,0xc9))[_0x597b('0x46')](handleError(_0x407cc7,null));};exports[_0x597b('0x23')]=function(_0x199183,_0x5423d2){if(_0x199183['body']['id']){delete _0x199183['body']['id'];}return db[_0x597b('0x2a')]['find']({'where':{'id':_0x199183[_0x597b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5423d2,null))[_0x597b('0x24')](saveUpdates(_0x199183[_0x597b('0x47')],null))[_0x597b('0x24')](respondWithResult(_0x5423d2,null))[_0x597b('0x46')](handleError(_0x5423d2,null));};exports[_0x597b('0x48')]=function(_0x58a176,_0x3b1283){return db[_0x597b('0x2a')]['find']({'where':{'id':_0x58a176[_0x597b('0x42')]['id']}})[_0x597b('0x24')](handleEntityNotFound(_0x3b1283,null))[_0x597b('0x24')](removeEntity(_0x3b1283,null))['catch'](handleError(_0x3b1283,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 71fe85b..4e15c99 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 _0x3376=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId'];(function(_0x4753df,_0x494932){var _0x292daa=function(_0xce44a8){while(--_0xce44a8){_0x4753df['push'](_0x4753df['shift']());}};_0x292daa(++_0x494932);}(_0x3376,0x1a4));var _0x6337=function(_0x25a5ee,_0x54d5de){_0x25a5ee=_0x25a5ee-0x0;var _0x18593f=_0x3376[_0x25a5ee];return _0x18593f;};'use strict';var _=require(_0x6337('0x0'));var util=require('util');var logger=require(_0x6337('0x1'))(_0x6337('0x2'));var moment=require(_0x6337('0x3'));var BPromise=require('bluebird');var rp=require(_0x6337('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6337('0x5'));var config=require(_0x6337('0x6'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x152b26,_0x392a88){return _0x152b26[_0x6337('0x7')](_0x6337('0x8'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x6337('0x9'),'fields':[_0x6337('0xa'),_0x6337('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4265=['path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x7c0646,_0x45d16b){var _0x32416d=function(_0x22abdd){while(--_0x22abdd){_0x7c0646['push'](_0x7c0646['shift']());}};_0x32416d(++_0x45d16b);}(_0x4265,0x1c9));var _0x5426=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4265[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5426('0x0'));var util=require(_0x5426('0x1'));var logger=require(_0x5426('0x2'))('api');var moment=require(_0x5426('0x3'));var BPromise=require(_0x5426('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5426('0x5'));var rimraf=require(_0x5426('0x6'));var config=require('../../config/environment');var attributes=require(_0x5426('0x7'));module[_0x5426('0x8')]=function(_0x1b73ec,_0x44bd94){return _0x1b73ec[_0x5426('0x9')](_0x5426('0xa'),attributes,{'tableName':_0x5426('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x5426('0xc'),_0x5426('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index cb0a9a1..29bc400 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 _0xa7f1=['jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x4bbcc1,_0x594e19){var _0x34435b=function(_0x124582){while(--_0x124582){_0x4bbcc1['push'](_0x4bbcc1['shift']());}};_0x34435b(++_0x594e19);}(_0xa7f1,0x92));var _0x1a7f=function(_0x2929ba,_0x506aa6){_0x2929ba=_0x2929ba-0x0;var _0x365e6e=_0xa7f1[_0x2929ba];return _0x365e6e;};'use strict';var _=require(_0x1a7f('0x0'));var util=require(_0x1a7f('0x1'));var moment=require(_0x1a7f('0x2'));var BPromise=require(_0x1a7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a7f('0x4'));var db=require(_0x1a7f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a7f('0x6'));var config=require(_0x1a7f('0x7'));var jayson=require(_0x1a7f('0x8'));var client=jayson[_0x1a7f('0x9')][_0x1a7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50c1b6,_0x4f9064,_0x5cc8c5){return new BPromise(function(_0x137342,_0x46cc9a){return client[_0x1a7f('0xb')](_0x50c1b6,_0x5cc8c5)['then'](function(_0x128db6){logger[_0x1a7f('0xc')](_0x1a7f('0xd'),_0x4f9064,_0x1a7f('0xe'));logger[_0x1a7f('0xf')](_0x1a7f('0x10'),_0x4f9064,_0x1a7f('0xe'),JSON[_0x1a7f('0x11')](_0x128db6));if(_0x128db6[_0x1a7f('0x12')]){if(_0x128db6[_0x1a7f('0x12')]['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4f9064,_0x128db6[_0x1a7f('0x12')][_0x1a7f('0x13')]);return _0x46cc9a(_0x128db6[_0x1a7f('0x12')]['message']);}logger[_0x1a7f('0x12')](_0x1a7f('0xd'),_0x4f9064,_0x128db6[_0x1a7f('0x12')][_0x1a7f('0x13')]);return _0x137342(_0x128db6[_0x1a7f('0x12')]['message']);}else{logger[_0x1a7f('0xc')](_0x1a7f('0xd'),_0x4f9064,_0x1a7f('0xe'));_0x137342(_0x128db6[_0x1a7f('0x14')][_0x1a7f('0x13')]);}})[_0x1a7f('0x15')](function(_0x35261b){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4f9064,_0x35261b);_0x46cc9a(_0x35261b);});});} \ No newline at end of file +var _0x357b=['jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2ff38c,_0x57bd89){var _0x3cf2e1=function(_0x4e840f){while(--_0x4e840f){_0x2ff38c['push'](_0x2ff38c['shift']());}};_0x3cf2e1(++_0x57bd89);}(_0x357b,0x6c));var _0xb357=function(_0x53509d,_0x66d0f2){_0x53509d=_0x53509d-0x0;var _0x10f555=_0x357b[_0x53509d];return _0x10f555;};'use strict';var _=require(_0xb357('0x0'));var util=require('util');var moment=require(_0xb357('0x1'));var BPromise=require(_0xb357('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb357('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb357('0x4'));var logger=require(_0xb357('0x5'))(_0xb357('0x6'));var config=require('../../config/environment');var jayson=require(_0xb357('0x7'));var client=jayson[_0xb357('0x8')][_0xb357('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16e6db,_0x1b1bf7,_0x2213b2){return new BPromise(function(_0x1bfe97,_0x51b90d){return client[_0xb357('0xa')](_0x16e6db,_0x2213b2)[_0xb357('0xb')](function(_0x35e0e2){logger[_0xb357('0xc')](_0xb357('0xd'),_0x1b1bf7,_0xb357('0xe'));logger[_0xb357('0xf')](_0xb357('0x10'),_0x1b1bf7,_0xb357('0xe'),JSON[_0xb357('0x11')](_0x35e0e2));if(_0x35e0e2[_0xb357('0x12')]){if(_0x35e0e2[_0xb357('0x12')][_0xb357('0x13')]===0x1f4){logger[_0xb357('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x1b1bf7,_0x35e0e2[_0xb357('0x12')][_0xb357('0x14')]);return _0x51b90d(_0x35e0e2[_0xb357('0x12')][_0xb357('0x14')]);}logger['error'](_0xb357('0xd'),_0x1b1bf7,_0x35e0e2[_0xb357('0x12')][_0xb357('0x14')]);return _0x1bfe97(_0x35e0e2['error'][_0xb357('0x14')]);}else{logger[_0xb357('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x1b1bf7,_0xb357('0xe'));_0x1bfe97(_0x35e0e2[_0xb357('0x15')][_0xb357('0x14')]);}})[_0xb357('0x16')](function(_0x1f015b){logger['error'](_0xb357('0xd'),_0x1b1bf7,_0x1f015b);_0x51b90d(_0x1f015b);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 9c98356..aea16e7 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 _0xaba6=['fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','/:id','destroy','multer','util'];(function(_0x8b5e41,_0x5d6d50){var _0x12cbed=function(_0x5d66dc){while(--_0x5d66dc){_0x8b5e41['push'](_0x8b5e41['shift']());}};_0x12cbed(++_0x5d6d50);}(_0xaba6,0xe2));var _0x6aba=function(_0x44f9c0,_0x391085){_0x44f9c0=_0x44f9c0-0x0;var _0x241aa7=_0xaba6[_0x44f9c0];return _0x241aa7;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/:id',auth[_0x6aba('0x7')](),controller[_0x6aba('0x8')]);router['get'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller['getConfigurations']);router[_0x6aba('0x6')](_0x6aba('0xa'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xb')]);router[_0x6aba('0xc')]('/',auth[_0x6aba('0x7')](),controller[_0x6aba('0xd')]);router['post'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xe')]);router[_0x6aba('0xf')]('/:id',auth[_0x6aba('0x7')](),controller[_0x6aba('0x10')]);router['delete'](_0x6aba('0x11'),auth[_0x6aba('0x7')](),controller[_0x6aba('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa79e=['post','create','/:id/configurations','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields'];(function(_0x30d723,_0x5bcfb9){var _0x4a074b=function(_0x1f2a54){while(--_0x1f2a54){_0x30d723['push'](_0x30d723['shift']());}};_0x4a074b(++_0x5bcfb9);}(_0xa79e,0xf7));var _0xea79=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0xa79e[_0x8afdd0];return _0x3de7ac;};'use strict';var multer=require(_0xea79('0x0'));var util=require('util');var path=require(_0xea79('0x1'));var timeout=require(_0xea79('0x2'));var express=require(_0xea79('0x3'));var router=express[_0xea79('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xea79('0x5'));var config=require(_0xea79('0x6'));var controller=require('./intVtigerAccount.controller');router[_0xea79('0x7')]('/',auth[_0xea79('0x8')](),controller['index']);router[_0xea79('0x7')](_0xea79('0x9'),auth[_0xea79('0x8')](),controller['show']);router['get']('/:id/configurations',auth[_0xea79('0x8')](),controller[_0xea79('0xa')]);router['get'](_0xea79('0xb'),auth[_0xea79('0x8')](),controller[_0xea79('0xc')]);router[_0xea79('0xd')]('/',auth['isAuthenticated'](),controller[_0xea79('0xe')]);router[_0xea79('0xd')](_0xea79('0xf'),auth[_0xea79('0x8')](),controller['addConfiguration']);router[_0xea79('0x10')]('/:id',auth[_0xea79('0x8')](),controller[_0xea79('0x11')]);router[_0xea79('0x12')]('/:id',auth[_0xea79('0x8')](),controller[_0xea79('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 514dc19..9a198aa 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 _0x14c1=['sequelize','exports','STRING','HelpDesk'];(function(_0x53def7,_0x5eff70){var _0x425ee7=function(_0x2466bf){while(--_0x2466bf){_0x53def7['push'](_0x53def7['shift']());}};_0x425ee7(++_0x5eff70);}(_0x14c1,0x68));var _0x114c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x14c1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x114c('0x0'));module[_0x114c('0x1')]={'name':{'type':Sequelize[_0x114c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x114c('0x2')]},'username':{'type':Sequelize[_0x114c('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x114c('0x3')},'remoteUri':{'type':Sequelize[_0x114c('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x114c('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x114c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0ee2=['STRING','HelpDesk','sequelize','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x0ee2,0x15e));var _0x20ee=function(_0x4145c2,_0x3bc556){_0x4145c2=_0x4145c2-0x0;var _0x5b0dce=_0x0ee2[_0x4145c2];return _0x5b0dce;};'use strict';var Sequelize=require(_0x20ee('0x0'));module[_0x20ee('0x1')]={'name':{'type':Sequelize[_0x20ee('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x20ee('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x20ee('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x20ee('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x20ee('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 ca1ae13..8426aeb 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 _0x80c8=['md5','getFields','username','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','getchallenge','success','login','result','token','GET','describe','sessionName','autogenerated','reference','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','vTiger\x20error:\x20','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','getConfigurations','VtigerConfiguration','order','merge','nolimit','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','VtigerField','Descriptions'];(function(_0x428eb2,_0x20f989){var _0x20fc49=function(_0x6b45ea){while(--_0x6b45ea){_0x428eb2['push'](_0x428eb2['shift']());}};_0x20fc49(++_0x20f989);}(_0x80c8,0x9a));var _0x880c=function(_0x3dfb99,_0x2c5bc8){_0x3dfb99=_0x3dfb99-0x0;var _0xadeebe=_0x80c8[_0x3dfb99];return _0xadeebe;};'use strict';var emlformat=require(_0x880c('0x0'));var rimraf=require(_0x880c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x880c('0x2'));var rp=require(_0x880c('0x3'));var moment=require(_0x880c('0x4'));var BPromise=require(_0x880c('0x5'));var Mustache=require(_0x880c('0x6'));var util=require(_0x880c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x880c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x880c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x880c('0xa'));var jsforce=require(_0x880c('0xb'));var deskjs=require(_0x880c('0xc'));var toCsv=require(_0x880c('0x8'));var querystring=require(_0x880c('0xd'));var Papa=require('papaparse');var Redis=require(_0x880c('0xe'));var authService=require(_0x880c('0xf'));var qs=require(_0x880c('0x10'));var as=require(_0x880c('0x11'));var hardwareService=require(_0x880c('0x12'));var logger=require(_0x880c('0x13'))(_0x880c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x880c('0x15'))['db'];var integrations=require(_0x880c('0x16'));function respondWithStatusCode(_0x14a5a1,_0x4398d2){_0x4398d2=_0x4398d2||0xcc;return function(_0x17d79c){if(_0x17d79c){return _0x14a5a1[_0x880c('0x17')](_0x4398d2);}return _0x14a5a1[_0x880c('0x18')](_0x4398d2)['end']();};}function respondWithResult(_0x1341bc,_0x27be74){_0x27be74=_0x27be74||0xc8;return function(_0x2bc330){if(_0x2bc330){return _0x1341bc['status'](_0x27be74)[_0x880c('0x19')](_0x2bc330);}};}function respondWithFilteredResult(_0x1f87f9,_0x34bb04){return function(_0x405cb8){if(_0x405cb8){var _0x3be1eb=typeof _0x34bb04[_0x880c('0x1a')]===_0x880c('0x1b')&&typeof _0x34bb04[_0x880c('0x1c')]==='undefined';var _0x31a9b3=_0x405cb8['count'];var _0x2c297e=_0x3be1eb?0x0:_0x34bb04[_0x880c('0x1a')];var _0x49ce1d=_0x3be1eb?_0x405cb8[_0x880c('0x1d')]:_0x34bb04[_0x880c('0x1a')]+_0x34bb04[_0x880c('0x1c')];var _0xe85759;if(_0x49ce1d>=_0x31a9b3){_0x49ce1d=_0x31a9b3;_0xe85759=0xc8;}else{_0xe85759=0xce;}_0x1f87f9[_0x880c('0x18')](_0xe85759);return _0x1f87f9[_0x880c('0x1e')](_0x880c('0x1f'),_0x2c297e+'-'+_0x49ce1d+'/'+_0x31a9b3)[_0x880c('0x19')](_0x405cb8);}return null;};}function patchUpdates(_0x3af146){return function(_0x28ce0f){try{jsonpatch[_0x880c('0x20')](_0x28ce0f,_0x3af146,!![]);}catch(_0x79beab){return BPromise[_0x880c('0x21')](_0x79beab);}return _0x28ce0f[_0x880c('0x22')]();};}function saveUpdates(_0x3fa0f8,_0x236f08){return function(_0x11d1ef){if(_0x11d1ef){return _0x11d1ef[_0x880c('0x23')](_0x3fa0f8)[_0x880c('0x24')](function(_0x1ff5a5){return _0x1ff5a5;});}return null;};}function removeEntity(_0x2c616d,_0x5381cf){return function(_0x2ecea1){if(_0x2ecea1){return _0x2ecea1[_0x880c('0x25')]()[_0x880c('0x24')](function(){_0x2c616d[_0x880c('0x18')](0xcc)[_0x880c('0x26')]();});}};}function handleEntityNotFound(_0xc67a66,_0x437539){return function(_0x235c89){if(!_0x235c89){_0xc67a66[_0x880c('0x17')](0x194);}return _0x235c89;};}function handleError(_0x5ca8c6,_0x493cc5){_0x493cc5=_0x493cc5||0x1f4;return function(_0x73a466){logger[_0x880c('0x27')](_0x73a466['stack']);if(_0x73a466['name']){delete _0x73a466[_0x880c('0x28')];}_0x5ca8c6[_0x880c('0x18')](_0x493cc5)[_0x880c('0x29')](_0x73a466);};}exports[_0x880c('0x2a')]=function(_0x3bb050,_0x54d3a0){var _0x5717b9={},_0x51b279={},_0x1d8893={'count':0x0,'rows':[]};var _0x47f1b0=_[_0x880c('0x2b')](db[_0x880c('0x2c')][_0x880c('0x2d')],function(_0x49783d){return{'name':_0x49783d[_0x880c('0x2e')],'type':_0x49783d[_0x880c('0x2f')][_0x880c('0x30')]};});_0x51b279['model']=_[_0x880c('0x2b')](_0x47f1b0,'name');_0x51b279[_0x880c('0x31')]=_['keys'](_0x3bb050[_0x880c('0x31')]);_0x51b279[_0x880c('0x32')]=_[_0x880c('0x33')](_0x51b279[_0x880c('0x34')],_0x51b279[_0x880c('0x31')]);_0x5717b9[_0x880c('0x35')]=_[_0x880c('0x33')](_0x51b279[_0x880c('0x34')],qs[_0x880c('0x36')](_0x3bb050[_0x880c('0x31')]['fields']));_0x5717b9[_0x880c('0x35')]=_0x5717b9[_0x880c('0x35')][_0x880c('0x37')]?_0x5717b9[_0x880c('0x35')]:_0x51b279[_0x880c('0x34')];if(!_0x3bb050[_0x880c('0x31')][_0x880c('0x38')]('nolimit')){_0x5717b9[_0x880c('0x1c')]=qs[_0x880c('0x1c')](_0x3bb050[_0x880c('0x31')][_0x880c('0x1c')]);_0x5717b9[_0x880c('0x1a')]=qs['offset'](_0x3bb050[_0x880c('0x31')][_0x880c('0x1a')]);}_0x5717b9['order']=qs[_0x880c('0x39')](_0x3bb050['query'][_0x880c('0x39')]);_0x5717b9[_0x880c('0x3a')]=qs[_0x880c('0x32')](_[_0x880c('0x3b')](_0x3bb050[_0x880c('0x31')],_0x51b279['filters']),_0x47f1b0);if(_0x3bb050['query'][_0x880c('0x3c')]){_0x5717b9[_0x880c('0x3a')]=_['merge'](_0x5717b9[_0x880c('0x3a')],{'$or':_['map'](_0x47f1b0,function(_0x52b405){if(_0x52b405[_0x880c('0x2f')]!==_0x880c('0x3d')){var _0x49340e={};_0x49340e[_0x52b405[_0x880c('0x28')]]={'$like':'%'+_0x3bb050[_0x880c('0x31')][_0x880c('0x3c')]+'%'};return _0x49340e;}})});}_0x5717b9=_['merge']({},_0x5717b9,_0x3bb050[_0x880c('0x3e')]);var _0x422bce={'where':_0x5717b9[_0x880c('0x3a')]};return db[_0x880c('0x2c')]['count'](_0x422bce)[_0x880c('0x24')](function(_0x362352){_0x1d8893[_0x880c('0x1d')]=_0x362352;if(_0x3bb050[_0x880c('0x31')]['includeAll']){_0x5717b9[_0x880c('0x3f')]=[{'all':!![]}];}return db[_0x880c('0x2c')][_0x880c('0x40')](_0x5717b9);})[_0x880c('0x24')](function(_0x3a8460){_0x1d8893['rows']=_0x3a8460;return _0x1d8893;})[_0x880c('0x24')](respondWithFilteredResult(_0x54d3a0,_0x5717b9))[_0x880c('0x41')](handleError(_0x54d3a0,null));};exports[_0x880c('0x42')]=function(_0x4dba8b,_0x183b38){var _0x3df7fd={'raw':![],'where':{'id':_0x4dba8b[_0x880c('0x43')]['id']}},_0x2b4283={};_0x2b4283['model']=_[_0x880c('0x44')](db['VtigerAccount']['rawAttributes']);_0x2b4283[_0x880c('0x31')]=_[_0x880c('0x44')](_0x4dba8b[_0x880c('0x31')]);_0x2b4283['filters']=_['intersection'](_0x2b4283['model'],_0x2b4283[_0x880c('0x31')]);_0x3df7fd[_0x880c('0x35')]=_[_0x880c('0x33')](_0x2b4283[_0x880c('0x34')],qs[_0x880c('0x36')](_0x4dba8b[_0x880c('0x31')][_0x880c('0x36')]));_0x3df7fd[_0x880c('0x35')]=_0x3df7fd[_0x880c('0x35')][_0x880c('0x37')]?_0x3df7fd[_0x880c('0x35')]:_0x2b4283[_0x880c('0x34')];if(_0x4dba8b['query'][_0x880c('0x45')]){_0x3df7fd[_0x880c('0x3f')]=[{'all':!![]}];}_0x3df7fd=_['merge']({},_0x3df7fd,_0x4dba8b['options']);return db[_0x880c('0x2c')][_0x880c('0x46')](_0x3df7fd)['then'](handleEntityNotFound(_0x183b38,null))[_0x880c('0x24')](respondWithResult(_0x183b38,null))[_0x880c('0x41')](handleError(_0x183b38,null));};exports[_0x880c('0x47')]=function(_0x25024d,_0x1d0647){return db[_0x880c('0x2c')][_0x880c('0x47')](_0x25024d[_0x880c('0x48')],{})[_0x880c('0x24')](respondWithResult(_0x1d0647,0xc9))[_0x880c('0x41')](handleError(_0x1d0647,null));};exports[_0x880c('0x23')]=function(_0x5916c7,_0x33c92b){if(_0x5916c7['body']['id']){delete _0x5916c7[_0x880c('0x48')]['id'];}return db[_0x880c('0x2c')]['find']({'where':{'id':_0x5916c7['params']['id']}})['then'](handleEntityNotFound(_0x33c92b,null))[_0x880c('0x24')](saveUpdates(_0x5916c7[_0x880c('0x48')],null))[_0x880c('0x24')](respondWithResult(_0x33c92b,null))[_0x880c('0x41')](handleError(_0x33c92b,null));};exports[_0x880c('0x25')]=function(_0xabc6e2,_0x4cb7a8){return db[_0x880c('0x2c')][_0x880c('0x46')]({'where':{'id':_0xabc6e2[_0x880c('0x43')]['id']}})[_0x880c('0x24')](handleEntityNotFound(_0x4cb7a8,null))[_0x880c('0x24')](removeEntity(_0x4cb7a8,null))['catch'](handleError(_0x4cb7a8,null));};exports[_0x880c('0x49')]=function(_0x1ebd6d,_0x6640e,_0xd4bdb8){var _0x3d1a1c={};var _0x47a865={};var _0x2a2b98;var _0x1e4ea0;return db[_0x880c('0x2c')]['findOne']({'where':{'id':_0x1ebd6d[_0x880c('0x43')]['id']}})[_0x880c('0x24')](handleEntityNotFound(_0x6640e,null))[_0x880c('0x24')](function(_0x3c2453){if(_0x3c2453){_0x2a2b98=_0x3c2453;_0x47a865[_0x880c('0x34')]=_[_0x880c('0x44')](db[_0x880c('0x4a')][_0x880c('0x2d')]);_0x47a865[_0x880c('0x31')]=_[_0x880c('0x44')](_0x1ebd6d[_0x880c('0x31')]);_0x47a865[_0x880c('0x32')]=_[_0x880c('0x33')](_0x47a865[_0x880c('0x34')],_0x47a865[_0x880c('0x31')]);_0x3d1a1c['attributes']=_[_0x880c('0x33')](_0x47a865[_0x880c('0x34')],qs[_0x880c('0x36')](_0x1ebd6d[_0x880c('0x31')][_0x880c('0x36')]));_0x3d1a1c['attributes']=_0x3d1a1c[_0x880c('0x35')][_0x880c('0x37')]?_0x3d1a1c[_0x880c('0x35')]:_0x47a865[_0x880c('0x34')];_0x3d1a1c[_0x880c('0x4b')]=qs['sort'](_0x1ebd6d[_0x880c('0x31')][_0x880c('0x39')]);_0x3d1a1c[_0x880c('0x3a')]=qs[_0x880c('0x32')](_[_0x880c('0x3b')](_0x1ebd6d[_0x880c('0x31')],_0x47a865[_0x880c('0x32')]));if(_0x1ebd6d[_0x880c('0x31')][_0x880c('0x3c')]){_0x3d1a1c['where']=_[_0x880c('0x4c')](_0x3d1a1c[_0x880c('0x3a')],{'$or':_[_0x880c('0x2b')](_0x3d1a1c['attributes'],function(_0x431250){var _0x245e81={};_0x245e81[_0x431250]={'$like':'%'+_0x1ebd6d[_0x880c('0x31')][_0x880c('0x3c')]+'%'};return _0x245e81;})});}_0x3d1a1c=_[_0x880c('0x4c')]({},_0x3d1a1c,_0x1ebd6d[_0x880c('0x3e')]);return _0x2a2b98['getConfigurations'](_0x3d1a1c);}})['then'](function(_0x50f642){if(_0x50f642){_0x1e4ea0=_0x50f642[_0x880c('0x37')];if(!_0x1ebd6d[_0x880c('0x31')][_0x880c('0x38')](_0x880c('0x4d'))){_0x3d1a1c[_0x880c('0x1c')]=qs[_0x880c('0x1c')](_0x1ebd6d[_0x880c('0x31')][_0x880c('0x1c')]);_0x3d1a1c[_0x880c('0x1a')]=qs[_0x880c('0x1a')](_0x1ebd6d[_0x880c('0x31')][_0x880c('0x1a')]);}return _0x2a2b98['getConfigurations'](_0x3d1a1c);}})['then'](function(_0x1b9349){if(_0x1b9349){return _0x1b9349?{'count':_0x1e4ea0,'rows':_0x1b9349}:null;}})[_0x880c('0x24')](respondWithResult(_0x6640e,null))[_0x880c('0x41')](handleError(_0x6640e,null));};exports[_0x880c('0x4e')]=function(_0x1405d1,_0x4dae23,_0x2b4ce0){if(_0x1405d1[_0x880c('0x48')]['id']){delete _0x1405d1[_0x880c('0x48')]['id'];}return db[_0x880c('0x2c')]['findOne']({'where':{'id':_0x1405d1[_0x880c('0x43')]['id']}})[_0x880c('0x24')](handleEntityNotFound(_0x4dae23,null))[_0x880c('0x24')](function(_0x224a3f){if(_0x224a3f){_0x1405d1[_0x880c('0x48')][_0x880c('0x4f')]=_0x224a3f['id'];_0x1405d1[_0x880c('0x48')][_0x880c('0x50')]=integrations[_0x880c('0x51')](_0x1405d1[_0x880c('0x48')]['channel'],_0x1405d1[_0x880c('0x48')]['type']);_0x1405d1['body']['Descriptions']=integrations[_0x880c('0x52')](_0x1405d1[_0x880c('0x48')][_0x880c('0x53')],_0x1405d1['body'][_0x880c('0x2f')]);return db[_0x880c('0x4a')][_0x880c('0x47')](_0x1405d1[_0x880c('0x48')],{'include':[{'model':db[_0x880c('0x54')],'as':_0x880c('0x50')},{'model':db[_0x880c('0x54')],'as':_0x880c('0x55')}]});}return null;})[_0x880c('0x24')](respondWithResult(_0x4dae23,null))['catch'](handleError(_0x4dae23,null));};var md5=require(_0x880c('0x56'));exports[_0x880c('0x57')]=function(_0x5ebeaa,_0x220442,_0xbe71e){var _0x1b7ab4=null;var _0x2318a1=null;var _0x22da2e=null;var _0x17efd1=null;var _0x16172d='';return db[_0x880c('0x2c')]['findOne']({'where':{'id':_0x5ebeaa[_0x880c('0x43')]['id']},'attributes':['id',_0x880c('0x28'),_0x880c('0x58'),'description','moduleName',_0x880c('0x59'),_0x880c('0x5a'),_0x880c('0x5b')]})['then'](handleEntityNotFound(_0x220442,null))[_0x880c('0x24')](function(_0x312e9f){if(_0x312e9f){_0x1b7ab4=_0x312e9f[_0x880c('0x58')];_0x2318a1=_0x312e9f['accessKey'];_0x22da2e=_0x312e9f[_0x880c('0x5c')];_0x16172d=_0x312e9f[_0x880c('0x59')];var _0x452fb2=_0x16172d[_0x880c('0x5d')](-0x1);if(_0x452fb2==='/'){_0x16172d=_0x16172d['substring'](0x0,_0x16172d[_0x880c('0x5e')](_0x452fb2));}_0x17efd1=util[_0x880c('0x5f')](_0x880c('0x60'),_0x16172d);var _0x124f3f={'method':'GET','uri':_0x17efd1,'qs':{'operation':_0x880c('0x61'),'username':_0x312e9f[_0x880c('0x58')]},'json':!![]};return rp(_0x124f3f);}})[_0x880c('0x24')](function(_0x324548){if(_0x324548[_0x880c('0x62')]){var _0x2fe4c5={'method':'POST','uri':_0x17efd1,'form':{'operation':_0x880c('0x63'),'username':_0x1b7ab4,'accessKey':md5(_0x324548[_0x880c('0x64')][_0x880c('0x65')]+_0x2318a1)},'json':!![]};return rp(_0x2fe4c5);}})[_0x880c('0x24')](function(_0x364152){if(_0x364152[_0x880c('0x62')]){var _0x41a7c3={'method':_0x880c('0x66'),'uri':_0x17efd1,'qs':{'operation':_0x880c('0x67'),'username':_0x1b7ab4,'sessionName':_0x364152[_0x880c('0x64')][_0x880c('0x68')],'elementType':_0x22da2e},'json':!![]};return rp(_0x41a7c3);}})[_0x880c('0x24')](function(_0x50254f){if(_0x50254f['success']){var _0xaa07ed=[_0x880c('0x69'),_0x880c('0x6a'),'owner'];_[_0x880c('0x6b')](_0x50254f[_0x880c('0x64')][_0x880c('0x36')],function(_0x1a7c5a){return _0xaa07ed[_0x880c('0x6c')](_0x1a7c5a[_0x880c('0x2f')][_0x880c('0x28')]);});_[_0x880c('0x6b')](_0x50254f['result']['fields'],function(_0x31be5e){return _0x31be5e[_0x880c('0x6d')]==='false';});return{'count':_0x50254f[_0x880c('0x64')]['fields'][_0x880c('0x37')],'rows':_[_0x880c('0x2b')](_0x50254f[_0x880c('0x64')][_0x880c('0x36')],function(_0x590c2e){return{'id':_0x590c2e[_0x880c('0x28')],'name':_0x590c2e[_0x880c('0x6e')],'custom':_[_0x880c('0x6f')](_0x590c2e['name'],_0x880c('0x70'))?!![]:![],'options':_0x590c2e['type'][_0x880c('0x28')]===_0x880c('0x71')&&_0x590c2e[_0x880c('0x2f')][_0x880c('0x72')]['length']>0x0?_['map'](_0x590c2e[_0x880c('0x2f')][_0x880c('0x72')],function(_0x136883){return{'name':_0x136883[_0x880c('0x6e')],'value':_0x136883['value']};}):[]};})};}})[_0x880c('0x24')](respondWithResult(_0x220442,null))[_0x880c('0x41')](function(_0x38053b){console['log'](_0x880c('0x73')+_0x38053b);var _0x37b52c=_0x5ebeaa['query'][_0x880c('0x74')]?0x1f4:_0x38053b['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x880c('0x57'),_0x37b52c,JSON[_0x880c('0x75')](_0x38053b));delete _0x38053b[_0x880c('0x28')];if(_0x37b52c===0x191){_0x37b52c=0x190;}_0x220442[_0x880c('0x18')](_0x37b52c)['send'](_0x5ebeaa['query'][_0x880c('0x74')]?{'message':_0x880c('0x76'),'statusCode':_0x38053b[_0x880c('0x77')]}:_0x38053b);});}; \ No newline at end of file +var _0x435d=['includes','false','label','startsWith','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','zip-dir','fast-json-patch','mustache','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','undefined','limit','count','offset','json','reject','save','update','destroy','sendStatus','error','stack','name','send','index','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','VtigerAccount','then','includeAll','include','findAll','rows','show','params','rawAttributes','filters','length','find','catch','create','body','getConfigurations','VtigerConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','VtigerField','Descriptions','description','serverUrl','username','accessKey','moduleName','substring','format','%s/webservice.php','GET','success','POST','login','result','token','describe','autogenerated','owner','remove'];(function(_0x331fc6,_0x1b00b3){var _0xae3fe2=function(_0x36d11b){while(--_0x36d11b){_0x331fc6['push'](_0x331fc6['shift']());}};_0xae3fe2(++_0x1b00b3);}(_0x435d,0x15d));var _0xd435=function(_0x350ef9,_0x1971dd){_0x350ef9=_0x350ef9-0x0;var _0x1547e9=_0x435d[_0x350ef9];return _0x1547e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd435('0x0'));var jsonpatch=require(_0xd435('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd435('0x2'));var util=require('util');var path=require(_0xd435('0x3'));var sox=require(_0xd435('0x4'));var csv=require(_0xd435('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd435('0x6'));var crypto=require(_0xd435('0x7'));var jsforce=require(_0xd435('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xd435('0x5'));var querystring=require(_0xd435('0x9'));var Papa=require(_0xd435('0xa'));var Redis=require(_0xd435('0xb'));var authService=require(_0xd435('0xc'));var qs=require(_0xd435('0xd'));var as=require(_0xd435('0xe'));var hardwareService=require(_0xd435('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd435('0x10'));var licenseUtil=require(_0xd435('0x11'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd435('0x12'));function respondWithStatusCode(_0x31a7a5,_0x576cdd){_0x576cdd=_0x576cdd||0xcc;return function(_0x4f3fe2){if(_0x4f3fe2){return _0x31a7a5['sendStatus'](_0x576cdd);}return _0x31a7a5[_0xd435('0x13')](_0x576cdd)[_0xd435('0x14')]();};}function respondWithResult(_0x105303,_0x403021){_0x403021=_0x403021||0xc8;return function(_0x13b34f){if(_0x13b34f){return _0x105303[_0xd435('0x13')](_0x403021)['json'](_0x13b34f);}};}function respondWithFilteredResult(_0x792e6e,_0x223a6d){return function(_0x12ed2d){if(_0x12ed2d){var _0xe3921d=typeof _0x223a6d['offset']===_0xd435('0x15')&&typeof _0x223a6d[_0xd435('0x16')]==='undefined';var _0x4caec6=_0x12ed2d[_0xd435('0x17')];var _0x1596ac=_0xe3921d?0x0:_0x223a6d[_0xd435('0x18')];var _0x4dff83=_0xe3921d?_0x12ed2d[_0xd435('0x17')]:_0x223a6d[_0xd435('0x18')]+_0x223a6d[_0xd435('0x16')];var _0x2aa37d;if(_0x4dff83>=_0x4caec6){_0x4dff83=_0x4caec6;_0x2aa37d=0xc8;}else{_0x2aa37d=0xce;}_0x792e6e[_0xd435('0x13')](_0x2aa37d);return _0x792e6e['set']('Content-Range',_0x1596ac+'-'+_0x4dff83+'/'+_0x4caec6)[_0xd435('0x19')](_0x12ed2d);}return null;};}function patchUpdates(_0x5e913f){return function(_0x1de4c1){try{jsonpatch['apply'](_0x1de4c1,_0x5e913f,!![]);}catch(_0x52de76){return BPromise[_0xd435('0x1a')](_0x52de76);}return _0x1de4c1[_0xd435('0x1b')]();};}function saveUpdates(_0x4a87e1,_0x2638e2){return function(_0x152001){if(_0x152001){return _0x152001[_0xd435('0x1c')](_0x4a87e1)['then'](function(_0x303589){return _0x303589;});}return null;};}function removeEntity(_0x1295d0,_0x41819c){return function(_0x2c7201){if(_0x2c7201){return _0x2c7201[_0xd435('0x1d')]()['then'](function(){_0x1295d0[_0xd435('0x13')](0xcc)[_0xd435('0x14')]();});}};}function handleEntityNotFound(_0x292f55,_0x46e63f){return function(_0x3aa6fa){if(!_0x3aa6fa){_0x292f55[_0xd435('0x1e')](0x194);}return _0x3aa6fa;};}function handleError(_0x312293,_0x4c1feb){_0x4c1feb=_0x4c1feb||0x1f4;return function(_0x15fcd9){logger[_0xd435('0x1f')](_0x15fcd9[_0xd435('0x20')]);if(_0x15fcd9[_0xd435('0x21')]){delete _0x15fcd9[_0xd435('0x21')];}_0x312293[_0xd435('0x13')](_0x4c1feb)[_0xd435('0x22')](_0x15fcd9);};}exports[_0xd435('0x23')]=function(_0x28f2ab,_0x9e62ee){var _0x2db14b={},_0x1bf923={},_0x581a14={'count':0x0,'rows':[]};var _0x3eda6c=_['map'](db['VtigerAccount']['rawAttributes'],function(_0x302330){return{'name':_0x302330[_0xd435('0x24')],'type':_0x302330[_0xd435('0x25')]['key']};});_0x1bf923[_0xd435('0x26')]=_[_0xd435('0x27')](_0x3eda6c,_0xd435('0x21'));_0x1bf923[_0xd435('0x28')]=_[_0xd435('0x29')](_0x28f2ab['query']);_0x1bf923['filters']=_[_0xd435('0x2a')](_0x1bf923['model'],_0x1bf923[_0xd435('0x28')]);_0x2db14b[_0xd435('0x2b')]=_[_0xd435('0x2a')](_0x1bf923[_0xd435('0x26')],qs[_0xd435('0x2c')](_0x28f2ab[_0xd435('0x28')][_0xd435('0x2c')]));_0x2db14b[_0xd435('0x2b')]=_0x2db14b[_0xd435('0x2b')]['length']?_0x2db14b[_0xd435('0x2b')]:_0x1bf923[_0xd435('0x26')];if(!_0x28f2ab[_0xd435('0x28')][_0xd435('0x2d')]('nolimit')){_0x2db14b[_0xd435('0x16')]=qs['limit'](_0x28f2ab[_0xd435('0x28')][_0xd435('0x16')]);_0x2db14b[_0xd435('0x18')]=qs['offset'](_0x28f2ab[_0xd435('0x28')][_0xd435('0x18')]);}_0x2db14b[_0xd435('0x2e')]=qs[_0xd435('0x2f')](_0x28f2ab[_0xd435('0x28')]['sort']);_0x2db14b[_0xd435('0x30')]=qs['filters'](_[_0xd435('0x31')](_0x28f2ab['query'],_0x1bf923['filters']),_0x3eda6c);if(_0x28f2ab[_0xd435('0x28')]['filter']){_0x2db14b[_0xd435('0x30')]=_[_0xd435('0x32')](_0x2db14b[_0xd435('0x30')],{'$or':_['map'](_0x3eda6c,function(_0x260289){if(_0x260289['type']!==_0xd435('0x33')){var _0x3ef780={};_0x3ef780[_0x260289[_0xd435('0x21')]]={'$like':'%'+_0x28f2ab['query'][_0xd435('0x34')]+'%'};return _0x3ef780;}})});}_0x2db14b=_[_0xd435('0x32')]({},_0x2db14b,_0x28f2ab[_0xd435('0x35')]);var _0x14cccb={'where':_0x2db14b['where']};return db[_0xd435('0x36')][_0xd435('0x17')](_0x14cccb)[_0xd435('0x37')](function(_0x21a447){_0x581a14['count']=_0x21a447;if(_0x28f2ab['query'][_0xd435('0x38')]){_0x2db14b[_0xd435('0x39')]=[{'all':!![]}];}return db[_0xd435('0x36')][_0xd435('0x3a')](_0x2db14b);})['then'](function(_0x41358a){_0x581a14[_0xd435('0x3b')]=_0x41358a;return _0x581a14;})[_0xd435('0x37')](respondWithFilteredResult(_0x9e62ee,_0x2db14b))['catch'](handleError(_0x9e62ee,null));};exports[_0xd435('0x3c')]=function(_0x50b59e,_0x425f8d){var _0x528ba6={'raw':![],'where':{'id':_0x50b59e[_0xd435('0x3d')]['id']}},_0x1a285c={};_0x1a285c[_0xd435('0x26')]=_[_0xd435('0x29')](db[_0xd435('0x36')][_0xd435('0x3e')]);_0x1a285c['query']=_['keys'](_0x50b59e[_0xd435('0x28')]);_0x1a285c[_0xd435('0x3f')]=_[_0xd435('0x2a')](_0x1a285c[_0xd435('0x26')],_0x1a285c['query']);_0x528ba6[_0xd435('0x2b')]=_[_0xd435('0x2a')](_0x1a285c[_0xd435('0x26')],qs[_0xd435('0x2c')](_0x50b59e['query'][_0xd435('0x2c')]));_0x528ba6[_0xd435('0x2b')]=_0x528ba6[_0xd435('0x2b')][_0xd435('0x40')]?_0x528ba6[_0xd435('0x2b')]:_0x1a285c['model'];if(_0x50b59e[_0xd435('0x28')]['includeAll']){_0x528ba6[_0xd435('0x39')]=[{'all':!![]}];}_0x528ba6=_[_0xd435('0x32')]({},_0x528ba6,_0x50b59e[_0xd435('0x35')]);return db[_0xd435('0x36')][_0xd435('0x41')](_0x528ba6)[_0xd435('0x37')](handleEntityNotFound(_0x425f8d,null))[_0xd435('0x37')](respondWithResult(_0x425f8d,null))[_0xd435('0x42')](handleError(_0x425f8d,null));};exports[_0xd435('0x43')]=function(_0x5394a8,_0x2dd4fe){return db[_0xd435('0x36')][_0xd435('0x43')](_0x5394a8[_0xd435('0x44')],{})['then'](respondWithResult(_0x2dd4fe,0xc9))[_0xd435('0x42')](handleError(_0x2dd4fe,null));};exports['update']=function(_0x28b033,_0x7c233a){if(_0x28b033[_0xd435('0x44')]['id']){delete _0x28b033[_0xd435('0x44')]['id'];}return db[_0xd435('0x36')]['find']({'where':{'id':_0x28b033[_0xd435('0x3d')]['id']}})[_0xd435('0x37')](handleEntityNotFound(_0x7c233a,null))[_0xd435('0x37')](saveUpdates(_0x28b033[_0xd435('0x44')],null))['then'](respondWithResult(_0x7c233a,null))[_0xd435('0x42')](handleError(_0x7c233a,null));};exports['destroy']=function(_0x45189c,_0x5855ad){return db['VtigerAccount']['find']({'where':{'id':_0x45189c[_0xd435('0x3d')]['id']}})[_0xd435('0x37')](handleEntityNotFound(_0x5855ad,null))['then'](removeEntity(_0x5855ad,null))[_0xd435('0x42')](handleError(_0x5855ad,null));};exports[_0xd435('0x45')]=function(_0xdda2a1,_0x449ca4,_0x5b8bff){var _0x5bea64={};var _0x1257fb={};var _0x5b1b20;var _0x1d8135;return db[_0xd435('0x36')]['findOne']({'where':{'id':_0xdda2a1[_0xd435('0x3d')]['id']}})[_0xd435('0x37')](handleEntityNotFound(_0x449ca4,null))['then'](function(_0x18c742){if(_0x18c742){_0x5b1b20=_0x18c742;_0x1257fb['model']=_[_0xd435('0x29')](db[_0xd435('0x46')][_0xd435('0x3e')]);_0x1257fb[_0xd435('0x28')]=_[_0xd435('0x29')](_0xdda2a1[_0xd435('0x28')]);_0x1257fb[_0xd435('0x3f')]=_[_0xd435('0x2a')](_0x1257fb['model'],_0x1257fb['query']);_0x5bea64['attributes']=_['intersection'](_0x1257fb['model'],qs[_0xd435('0x2c')](_0xdda2a1[_0xd435('0x28')][_0xd435('0x2c')]));_0x5bea64[_0xd435('0x2b')]=_0x5bea64[_0xd435('0x2b')][_0xd435('0x40')]?_0x5bea64[_0xd435('0x2b')]:_0x1257fb['model'];_0x5bea64[_0xd435('0x2e')]=qs[_0xd435('0x2f')](_0xdda2a1[_0xd435('0x28')]['sort']);_0x5bea64['where']=qs['filters'](_[_0xd435('0x31')](_0xdda2a1['query'],_0x1257fb[_0xd435('0x3f')]));if(_0xdda2a1[_0xd435('0x28')][_0xd435('0x34')]){_0x5bea64[_0xd435('0x30')]=_['merge'](_0x5bea64[_0xd435('0x30')],{'$or':_[_0xd435('0x27')](_0x5bea64[_0xd435('0x2b')],function(_0x7c3bfa){var _0x2ecb6b={};_0x2ecb6b[_0x7c3bfa]={'$like':'%'+_0xdda2a1[_0xd435('0x28')][_0xd435('0x34')]+'%'};return _0x2ecb6b;})});}_0x5bea64=_[_0xd435('0x32')]({},_0x5bea64,_0xdda2a1['options']);return _0x5b1b20['getConfigurations'](_0x5bea64);}})[_0xd435('0x37')](function(_0x1f038b){if(_0x1f038b){_0x1d8135=_0x1f038b['length'];if(!_0xdda2a1[_0xd435('0x28')]['hasOwnProperty'](_0xd435('0x47'))){_0x5bea64[_0xd435('0x16')]=qs[_0xd435('0x16')](_0xdda2a1[_0xd435('0x28')][_0xd435('0x16')]);_0x5bea64[_0xd435('0x18')]=qs['offset'](_0xdda2a1[_0xd435('0x28')]['offset']);}return _0x5b1b20[_0xd435('0x45')](_0x5bea64);}})[_0xd435('0x37')](function(_0x30977b){if(_0x30977b){return _0x30977b?{'count':_0x1d8135,'rows':_0x30977b}:null;}})[_0xd435('0x37')](respondWithResult(_0x449ca4,null))[_0xd435('0x42')](handleError(_0x449ca4,null));};exports[_0xd435('0x48')]=function(_0x545906,_0x26ed18,_0x245157){if(_0x545906[_0xd435('0x44')]['id']){delete _0x545906[_0xd435('0x44')]['id'];}return db[_0xd435('0x36')][_0xd435('0x49')]({'where':{'id':_0x545906[_0xd435('0x3d')]['id']}})[_0xd435('0x37')](handleEntityNotFound(_0x26ed18,null))[_0xd435('0x37')](function(_0x34cf70){if(_0x34cf70){_0x545906[_0xd435('0x44')][_0xd435('0x4a')]=_0x34cf70['id'];_0x545906[_0xd435('0x44')][_0xd435('0x4b')]=integrations[_0xd435('0x4c')](_0x545906[_0xd435('0x44')]['channel'],_0x545906[_0xd435('0x44')][_0xd435('0x25')]);_0x545906['body']['Descriptions']=integrations[_0xd435('0x4d')](_0x545906['body'][_0xd435('0x4e')],_0x545906[_0xd435('0x44')][_0xd435('0x25')]);return db['VtigerConfiguration']['create'](_0x545906[_0xd435('0x44')],{'include':[{'model':db[_0xd435('0x4f')],'as':'Subjects'},{'model':db[_0xd435('0x4f')],'as':_0xd435('0x50')}]});}return null;})[_0xd435('0x37')](respondWithResult(_0x26ed18,null))[_0xd435('0x42')](handleError(_0x26ed18,null));};var md5=require('md5');exports['getFields']=function(_0x367995,_0xedeb40,_0x2219d2){var _0x5c1408=null;var _0x85978e=null;var _0x3bd96c=null;var _0x43db55=null;var _0x14a2e7='';return db['VtigerAccount'][_0xd435('0x49')]({'where':{'id':_0x367995[_0xd435('0x3d')]['id']},'attributes':['id',_0xd435('0x21'),'username',_0xd435('0x51'),'moduleName','remoteUri',_0xd435('0x52'),'accessKey']})[_0xd435('0x37')](handleEntityNotFound(_0xedeb40,null))['then'](function(_0x558d64){if(_0x558d64){_0x5c1408=_0x558d64[_0xd435('0x53')];_0x85978e=_0x558d64[_0xd435('0x54')];_0x3bd96c=_0x558d64[_0xd435('0x55')];_0x14a2e7=_0x558d64['remoteUri'];var _0x1bb531=_0x14a2e7['slice'](-0x1);if(_0x1bb531==='/'){_0x14a2e7=_0x14a2e7[_0xd435('0x56')](0x0,_0x14a2e7['lastIndexOf'](_0x1bb531));}_0x43db55=util[_0xd435('0x57')](_0xd435('0x58'),_0x14a2e7);var _0x44d2eb={'method':_0xd435('0x59'),'uri':_0x43db55,'qs':{'operation':'getchallenge','username':_0x558d64[_0xd435('0x53')]},'json':!![]};return rp(_0x44d2eb);}})['then'](function(_0x47d5af){if(_0x47d5af[_0xd435('0x5a')]){var _0x5ca0ba={'method':_0xd435('0x5b'),'uri':_0x43db55,'form':{'operation':_0xd435('0x5c'),'username':_0x5c1408,'accessKey':md5(_0x47d5af[_0xd435('0x5d')][_0xd435('0x5e')]+_0x85978e)},'json':!![]};return rp(_0x5ca0ba);}})[_0xd435('0x37')](function(_0x3b34e3){if(_0x3b34e3[_0xd435('0x5a')]){var _0x5ce1f0={'method':_0xd435('0x59'),'uri':_0x43db55,'qs':{'operation':_0xd435('0x5f'),'username':_0x5c1408,'sessionName':_0x3b34e3['result']['sessionName'],'elementType':_0x3bd96c},'json':!![]};return rp(_0x5ce1f0);}})[_0xd435('0x37')](function(_0x5204b7){if(_0x5204b7[_0xd435('0x5a')]){var _0x471053=[_0xd435('0x60'),'reference',_0xd435('0x61')];_[_0xd435('0x62')](_0x5204b7[_0xd435('0x5d')][_0xd435('0x2c')],function(_0x21017c){return _0x471053[_0xd435('0x63')](_0x21017c[_0xd435('0x25')][_0xd435('0x21')]);});_[_0xd435('0x62')](_0x5204b7[_0xd435('0x5d')][_0xd435('0x2c')],function(_0x84b23b){return _0x84b23b['editable']===_0xd435('0x64');});return{'count':_0x5204b7[_0xd435('0x5d')]['fields'][_0xd435('0x40')],'rows':_[_0xd435('0x27')](_0x5204b7[_0xd435('0x5d')]['fields'],function(_0x3f1e92){return{'id':_0x3f1e92[_0xd435('0x21')],'name':_0x3f1e92[_0xd435('0x65')],'custom':_[_0xd435('0x66')](_0x3f1e92['name'],'cf_')?!![]:![],'options':_0x3f1e92[_0xd435('0x25')][_0xd435('0x21')]===_0xd435('0x67')&&_0x3f1e92[_0xd435('0x25')][_0xd435('0x68')][_0xd435('0x40')]>0x0?_[_0xd435('0x27')](_0x3f1e92[_0xd435('0x25')][_0xd435('0x68')],function(_0x5ac9d8){return{'name':_0x5ac9d8['label'],'value':_0x5ac9d8[_0xd435('0x69')]};}):[]};})};}})[_0xd435('0x37')](respondWithResult(_0xedeb40,null))[_0xd435('0x42')](function(_0x1e2bf6){console[_0xd435('0x6a')]('vTiger\x20error:\x20'+_0x1e2bf6);var _0x18e82d=_0x367995[_0xd435('0x28')][_0xd435('0x6b')]?0x1f4:_0x1e2bf6[_0xd435('0x6c')]||0x1f4;logger[_0xd435('0x1f')](_0xd435('0x6d'),_0xd435('0x6e'),_0x18e82d,JSON['stringify'](_0x1e2bf6));delete _0x1e2bf6[_0xd435('0x21')];if(_0x18e82d===0x191){_0x18e82d=0x190;}_0xedeb40[_0xd435('0x13')](_0x18e82d)[_0xd435('0x22')](_0x367995[_0xd435('0x28')][_0xd435('0x6b')]?{'message':_0xd435('0x6f'),'statusCode':_0x1e2bf6[_0xd435('0x6c')]}:_0x1e2bf6);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 7b26e7f..023bfa9 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 _0x2904=['util','../../config/logger','bluebird','request-promise','rimraf','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x25e526,_0xb04139){var _0x40715b=function(_0x36d35d){while(--_0x36d35d){_0x25e526['push'](_0x25e526['shift']());}};_0x40715b(++_0xb04139);}(_0x2904,0x9f));var _0x4290=function(_0x4edc71,_0x3e3e27){_0x4edc71=_0x4edc71-0x0;var _0x4186da=_0x2904[_0x4edc71];return _0x4186da;};'use strict';var _=require(_0x4290('0x0'));var util=require(_0x4290('0x1'));var logger=require(_0x4290('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4290('0x3'));var rp=require(_0x4290('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4290('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x4290('0x6'));module['exports']=function(_0x3d1833,_0x2a963a){return _0x3d1833[_0x4290('0x7')](_0x4290('0x8'),attributes,{'tableName':_0x4290('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc041=['define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc041,0xab));var _0x1c04=function(_0x23402b,_0x421ac9){_0x23402b=_0x23402b-0x0;var _0x3a21c7=_0xc041[_0x23402b];return _0x3a21c7;};'use strict';var _=require(_0x1c04('0x0'));var util=require('util');var logger=require(_0x1c04('0x1'))(_0x1c04('0x2'));var moment=require(_0x1c04('0x3'));var BPromise=require(_0x1c04('0x4'));var rp=require(_0x1c04('0x5'));var fs=require('fs');var path=require(_0x1c04('0x6'));var rimraf=require(_0x1c04('0x7'));var config=require(_0x1c04('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2e748d,_0x4faebd){return _0x2e748d[_0x1c04('0x9')](_0x1c04('0xa'),attributes,{'tableName':_0x1c04('0xb'),'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 71af7e9..8707a47 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 _0x3f8c=['jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','debug','catch','find','raw','ShowVtigerAccount','moment','bluebird','randomstring','ioredis'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1fdfda,_0xf55159){_0x1fdfda=_0x1fdfda-0x0;var _0x43f505=_0x3f8c[_0x1fdfda];return _0x43f505;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')]({'raw':_0x2e7c0f['options']?_0x2e7c0f[_0xc3f8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x16')]||null:null,'attributes':_0x2e7c0f['options']?_0x2e7c0f['options'][_0xc3f8('0x17')]||null:null,'limit':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x18')]||null:null,'include':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2e7c0f['options']['include'],function(_0x4b83f0){return{'model':db[_0x4b83f0[_0xc3f8('0x1b')]],'as':_0x4b83f0['as'],'attributes':_0x4b83f0['attributes'],'include':_0x4b83f0[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4b83f0['include'],function(_0x4569c2){return{'model':db[_0x4569c2[_0xc3f8('0x1b')]],'as':_0x4569c2['as'],'attributes':_0x4569c2[_0xc3f8('0x17')],'include':_0x4569c2[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4569c2[_0xc3f8('0x19')],function(_0xf1d460){return{'model':db[_0xf1d460[_0xc3f8('0x1b')]],'as':_0xf1d460['as'],'attributes':_0xf1d460[_0xc3f8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x22c8e6){logger[_0xc3f8('0x9')](_0xc3f8('0x12'),_0x2e7c0f);logger[_0xc3f8('0x1c')]('GetVtigerAccount',_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x22c8e6));_0xb4ab67(_0x22c8e6);})[_0xc3f8('0x1d')](function(_0x218029){logger['error'](_0xc3f8('0x12'),_0x218029['message'],_0x2e7c0f);_0x47a185(_0x35500f[_0xc3f8('0xe')](0x1f4,_0x218029[_0xc3f8('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x48b32e){var _0x21a225=this;return new Promise(function(_0x25df65,_0xd32b09){return db[_0xc3f8('0x13')][_0xc3f8('0x1e')]({'raw':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x1f')]===undefined?!![]:![]:!![],'where':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['where']||null:null,'attributes':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x17')]||null:null,'include':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['include']?_['map'](_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x19')],function(_0x76ef00){return{'model':db[_0x76ef00[_0xc3f8('0x1b')]],'as':_0x76ef00['as'],'attributes':_0x76ef00[_0xc3f8('0x17')],'include':_0x76ef00['include']?_[_0xc3f8('0x1a')](_0x76ef00[_0xc3f8('0x19')],function(_0x2ba6aa){return{'model':db[_0x2ba6aa['model']],'as':_0x2ba6aa['as'],'attributes':_0x2ba6aa[_0xc3f8('0x17')],'include':_0x2ba6aa[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2ba6aa['include'],function(_0x21a725){return{'model':db[_0x21a725[_0xc3f8('0x1b')]],'as':_0x21a725['as'],'attributes':_0x21a725['attributes']};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x84d5d2){logger[_0xc3f8('0x9')](_0xc3f8('0x20'),_0x48b32e);logger[_0xc3f8('0x1c')](_0xc3f8('0x20'),_0x48b32e,JSON['stringify'](_0x84d5d2));_0x25df65(_0x84d5d2);})[_0xc3f8('0x1d')](function(_0x2e4880){logger[_0xc3f8('0xe')](_0xc3f8('0x20'),_0x2e4880[_0xc3f8('0x10')],_0x48b32e);_0xd32b09(_0x21a225['error'](0x1f4,_0x2e4880[_0xc3f8('0x10')]));});});}; \ No newline at end of file +var _0x2e54=['error','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','map','include','model','ShowVtigerAccount','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x45943c,_0x292e90){var _0xe1cf98=function(_0x4ba1ae){while(--_0x4ba1ae){_0x45943c['push'](_0x45943c['shift']());}};_0xe1cf98(++_0x292e90);}(_0x2e54,0x1dd));var _0x42e5=function(_0x4b46ec,_0x1b57bb){_0x4b46ec=_0x4b46ec-0x0;var _0x33cd23=_0x2e54[_0x4b46ec];return _0x33cd23;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});}exports[_0x42e5('0x16')]=function(_0x38282d){var _0x11550e=this;return new Promise(function(_0x23fe09,_0x54fcfc){return db[_0x42e5('0x17')]['findAll']({'raw':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1a')]||null:null,'attributes':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1b')]||null:null,'limit':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')]['limit']||null:null,'include':_0x38282d['options']?_0x38282d[_0x42e5('0x18')]['include']?_[_0x42e5('0x1c')](_0x38282d[_0x42e5('0x18')][_0x42e5('0x1d')],function(_0x49490f){return{'model':db[_0x49490f[_0x42e5('0x1e')]],'as':_0x49490f['as'],'attributes':_0x49490f['attributes'],'include':_0x49490f[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x49490f[_0x42e5('0x1d')],function(_0x275c80){return{'model':db[_0x275c80[_0x42e5('0x1e')]],'as':_0x275c80['as'],'attributes':_0x275c80['attributes'],'include':_0x275c80['include']?_[_0x42e5('0x1c')](_0x275c80['include'],function(_0x56f812){return{'model':db[_0x56f812[_0x42e5('0x1e')]],'as':_0x56f812['as'],'attributes':_0x56f812['attributes']};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x2d9e65){logger[_0x42e5('0xd')](_0x42e5('0x16'),_0x38282d);logger[_0x42e5('0x10')](_0x42e5('0x16'),_0x38282d,JSON['stringify'](_0x2d9e65));_0x23fe09(_0x2d9e65);})[_0x42e5('0x15')](function(_0x201d9e){logger[_0x42e5('0x12')](_0x42e5('0x16'),_0x201d9e[_0x42e5('0x13')],_0x38282d);_0x54fcfc(_0x11550e[_0x42e5('0x12')](0x1f4,_0x201d9e[_0x42e5('0x13')]));});});};exports[_0x42e5('0x1f')]=function(_0x5a4930){var _0x2ba9ef=this;return new Promise(function(_0x2c7542,_0x3d9e8b){return db[_0x42e5('0x17')]['find']({'raw':_0x5a4930[_0x42e5('0x18')]?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options']['where']||null:null,'attributes':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options'][_0x42e5('0x1b')]||null:null,'include':_0x5a4930['options']?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x5a4930['options'][_0x42e5('0x1d')],function(_0x3a8d1c){return{'model':db[_0x3a8d1c['model']],'as':_0x3a8d1c['as'],'attributes':_0x3a8d1c[_0x42e5('0x1b')],'include':_0x3a8d1c['include']?_[_0x42e5('0x1c')](_0x3a8d1c[_0x42e5('0x1d')],function(_0x25a040){return{'model':db[_0x25a040[_0x42e5('0x1e')]],'as':_0x25a040['as'],'attributes':_0x25a040[_0x42e5('0x1b')],'include':_0x25a040[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x25a040['include'],function(_0x5a18cc){return{'model':db[_0x5a18cc[_0x42e5('0x1e')]],'as':_0x5a18cc['as'],'attributes':_0x5a18cc[_0x42e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x4a1a8a){logger['info']('ShowVtigerAccount',_0x5a4930);logger['debug'](_0x42e5('0x1f'),_0x5a4930,JSON[_0x42e5('0x20')](_0x4a1a8a));_0x2c7542(_0x4a1a8a);})[_0x42e5('0x15')](function(_0xedb7bc){logger[_0x42e5('0x12')](_0x42e5('0x1f'),_0xedb7bc[_0x42e5('0x13')],_0x5a4930);_0x3d9e8b(_0x2ba9ef[_0x42e5('0x12')](0x1f4,_0xedb7bc['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index b223665..083901f 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 _0xe0d3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0xbab0b8,_0x292a2e){var _0x171ea9=function(_0x1ecbeb){while(--_0x1ecbeb){_0xbab0b8['push'](_0xbab0b8['shift']());}};_0x171ea9(++_0x292a2e);}(_0xe0d3,0x14b));var _0x3e0d=function(_0xf3dc36,_0x23c49e){_0xf3dc36=_0xf3dc36-0x0;var _0x4c573b=_0xe0d3[_0xf3dc36];return _0x4c573b;};'use strict';var multer=require(_0x3e0d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e0d('0x1'));var express=require(_0x3e0d('0x2'));var router=express[_0x3e0d('0x3')]();var fs_extra=require(_0x3e0d('0x4'));var auth=require(_0x3e0d('0x5'));var interaction=require(_0x3e0d('0x6'));var config=require(_0x3e0d('0x7'));var controller=require(_0x3e0d('0x8'));router[_0x3e0d('0x9')]('/',auth[_0x3e0d('0xa')](),controller[_0x3e0d('0xb')]);router[_0x3e0d('0x9')](_0x3e0d('0xc'),auth[_0x3e0d('0xa')](),controller[_0x3e0d('0xd')]);router[_0x3e0d('0x9')](_0x3e0d('0xe'),auth[_0x3e0d('0xa')](),controller[_0x3e0d('0xf')]);router['get']('/:id/subjects',auth[_0x3e0d('0xa')](),controller[_0x3e0d('0x10')]);router[_0x3e0d('0x9')](_0x3e0d('0x11'),auth[_0x3e0d('0xa')](),controller[_0x3e0d('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3e0d('0x13')]);router['put'](_0x3e0d('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3e0d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x3e0d('0x14')]=router; \ No newline at end of file +var _0xe223=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','util','path','connect-timeout','Router'];(function(_0x29efdb,_0x4bec6f){var _0x567565=function(_0x2ee3f7){while(--_0x2ee3f7){_0x29efdb['push'](_0x29efdb['shift']());}};_0x567565(++_0x4bec6f);}(_0xe223,0x9d));var _0x3e22=function(_0x2d8ca8,_0x22bcb6){_0x2d8ca8=_0x2d8ca8-0x0;var _0x268164=_0xe223[_0x2d8ca8];return _0x268164;};'use strict';var multer=require('multer');var util=require(_0x3e22('0x0'));var path=require(_0x3e22('0x1'));var timeout=require(_0x3e22('0x2'));var express=require('express');var router=express[_0x3e22('0x3')]();var fs_extra=require(_0x3e22('0x4'));var auth=require(_0x3e22('0x5'));var interaction=require(_0x3e22('0x6'));var config=require(_0x3e22('0x7'));var controller=require(_0x3e22('0x8'));router[_0x3e22('0x9')]('/',auth[_0x3e22('0xa')](),controller[_0x3e22('0xb')]);router[_0x3e22('0x9')](_0x3e22('0xc'),auth[_0x3e22('0xa')](),controller[_0x3e22('0xd')]);router[_0x3e22('0x9')](_0x3e22('0xe'),auth[_0x3e22('0xa')](),controller['getFields']);router[_0x3e22('0x9')](_0x3e22('0xf'),auth[_0x3e22('0xa')](),controller[_0x3e22('0x10')]);router[_0x3e22('0x9')](_0x3e22('0x11'),auth[_0x3e22('0xa')](),controller[_0x3e22('0x12')]);router[_0x3e22('0x13')]('/',auth['isAuthenticated'](),controller[_0x3e22('0x14')]);router[_0x3e22('0x15')](_0x3e22('0xc'),auth['isAuthenticated'](),controller[_0x3e22('0x16')]);router['delete'](_0x3e22('0xc'),auth[_0x3e22('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 9114264..4977dcf 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 _0x01a6=['sequelize','exports','STRING'];(function(_0x5f6160,_0x599b41){var _0x3eadc1=function(_0x4b686b){while(--_0x4b686b){_0x5f6160['push'](_0x5f6160['shift']());}};_0x3eadc1(++_0x599b41);}(_0x01a6,0x14a));var _0x601a=function(_0x5eb0e6,_0x475a28){_0x5eb0e6=_0x5eb0e6-0x0;var _0x3dfb29=_0x01a6[_0x5eb0e6];return _0x3dfb29;};'use strict';var Sequelize=require(_0x601a('0x0'));module[_0x601a('0x1')]={'name':{'type':Sequelize[_0x601a('0x2')]},'description':{'type':Sequelize[_0x601a('0x2')]}}; \ No newline at end of file +var _0x097b=['sequelize','STRING'];(function(_0x284728,_0xe03f84){var _0x3d0bbe=function(_0x1c174d){while(--_0x1c174d){_0x284728['push'](_0x284728['shift']());}};_0x3d0bbe(++_0xe03f84);}(_0x097b,0xf6));var _0xb097=function(_0x270ed0,_0x4e26f6){_0x270ed0=_0x270ed0-0x0;var _0x14de27=_0x097b[_0x270ed0];return _0x14de27;};'use strict';var Sequelize=require(_0xb097('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb097('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7e7340f..8f4f9cb 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 _0x702d=['bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','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','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','create','body','update','find','findOne','VtigerField','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2ba05e,_0x40009a){var _0xd4dd07=function(_0x20e0eb){while(--_0x20e0eb){_0x2ba05e['push'](_0x2ba05e['shift']());}};_0xd4dd07(++_0x40009a);}(_0x702d,0x147));var _0xd702=function(_0x519bac,_0x5e4af1){_0x519bac=_0x519bac-0x0;var _0x571631=_0x702d[_0x519bac];return _0x571631;};'use strict';var emlformat=require(_0xd702('0x0'));var rimraf=require(_0xd702('0x1'));var zipdir=require(_0xd702('0x2'));var jsonpatch=require(_0xd702('0x3'));var rp=require(_0xd702('0x4'));var moment=require('moment');var BPromise=require(_0xd702('0x5'));var Mustache=require(_0xd702('0x6'));var util=require(_0xd702('0x7'));var path=require(_0xd702('0x8'));var sox=require('sox');var csv=require(_0xd702('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd702('0xa'));var _=require(_0xd702('0xb'));var squel=require(_0xd702('0xc'));var crypto=require('crypto');var jsforce=require(_0xd702('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd702('0x9'));var querystring=require(_0xd702('0xe'));var Papa=require(_0xd702('0xf'));var Redis=require(_0xd702('0x10'));var authService=require(_0xd702('0x11'));var qs=require(_0xd702('0x12'));var as=require(_0xd702('0x13'));var hardwareService=require(_0xd702('0x14'));var logger=require(_0xd702('0x15'))(_0xd702('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd702('0x17'));var db=require(_0xd702('0x18'))['db'];function respondWithStatusCode(_0x273577,_0x5c0dad){_0x5c0dad=_0x5c0dad||0xcc;return function(_0x13ee5a){if(_0x13ee5a){return _0x273577[_0xd702('0x19')](_0x5c0dad);}return _0x273577[_0xd702('0x1a')](_0x5c0dad)[_0xd702('0x1b')]();};}function respondWithResult(_0x3948f8,_0x181ff2){_0x181ff2=_0x181ff2||0xc8;return function(_0x59dd33){if(_0x59dd33){return _0x3948f8[_0xd702('0x1a')](_0x181ff2)[_0xd702('0x1c')](_0x59dd33);}};}function respondWithFilteredResult(_0x5d7978,_0x707b9){return function(_0x4922f8){if(_0x4922f8){var _0x268c66=typeof _0x707b9[_0xd702('0x1d')]==='undefined'&&typeof _0x707b9[_0xd702('0x1e')]===_0xd702('0x1f');var _0x2a87f2=_0x4922f8['count'];var _0x5b3b1d=_0x268c66?0x0:_0x707b9[_0xd702('0x1d')];var _0x5a296e=_0x268c66?_0x4922f8[_0xd702('0x20')]:_0x707b9[_0xd702('0x1d')]+_0x707b9[_0xd702('0x1e')];var _0x265b1b;if(_0x5a296e>=_0x2a87f2){_0x5a296e=_0x2a87f2;_0x265b1b=0xc8;}else{_0x265b1b=0xce;}_0x5d7978[_0xd702('0x1a')](_0x265b1b);return _0x5d7978[_0xd702('0x21')](_0xd702('0x22'),_0x5b3b1d+'-'+_0x5a296e+'/'+_0x2a87f2)['json'](_0x4922f8);}return null;};}function patchUpdates(_0x4be140){return function(_0x536ca8){try{jsonpatch[_0xd702('0x23')](_0x536ca8,_0x4be140,!![]);}catch(_0x109284){return BPromise['reject'](_0x109284);}return _0x536ca8[_0xd702('0x24')]();};}function saveUpdates(_0x5d91fd,_0xc4c246){return function(_0x5824ec){if(_0x5824ec){return _0x5824ec['update'](_0x5d91fd)['then'](function(_0x21c00e){return _0x21c00e;});}return null;};}function removeEntity(_0xeec2e4,_0x459184){return function(_0x49761c){if(_0x49761c){return _0x49761c[_0xd702('0x25')]()[_0xd702('0x26')](function(){_0xeec2e4[_0xd702('0x1a')](0xcc)[_0xd702('0x1b')]();});}};}function handleEntityNotFound(_0x1200ed,_0x146f35){return function(_0x94c58d){if(!_0x94c58d){_0x1200ed[_0xd702('0x19')](0x194);}return _0x94c58d;};}function handleError(_0x22328a,_0x50d7ad){_0x50d7ad=_0x50d7ad||0x1f4;return function(_0x116b2f){logger[_0xd702('0x27')](_0x116b2f[_0xd702('0x28')]);if(_0x116b2f[_0xd702('0x29')]){delete _0x116b2f[_0xd702('0x29')];}_0x22328a[_0xd702('0x1a')](_0x50d7ad)[_0xd702('0x2a')](_0x116b2f);};}exports[_0xd702('0x2b')]=function(_0x5f1084,_0x47c9a2){var _0x1870b7={},_0x43cd38={},_0x56bc8d={'count':0x0,'rows':[]};var _0x45cd22=_[_0xd702('0x2c')](db[_0xd702('0x2d')][_0xd702('0x2e')],function(_0x56e9cd){return{'name':_0x56e9cd[_0xd702('0x2f')],'type':_0x56e9cd[_0xd702('0x30')][_0xd702('0x31')]};});_0x43cd38[_0xd702('0x32')]=_[_0xd702('0x2c')](_0x45cd22,'name');_0x43cd38[_0xd702('0x33')]=_[_0xd702('0x34')](_0x5f1084[_0xd702('0x33')]);_0x43cd38['filters']=_[_0xd702('0x35')](_0x43cd38['model'],_0x43cd38['query']);_0x1870b7[_0xd702('0x36')]=_[_0xd702('0x35')](_0x43cd38[_0xd702('0x32')],qs['fields'](_0x5f1084[_0xd702('0x33')][_0xd702('0x37')]));_0x1870b7['attributes']=_0x1870b7[_0xd702('0x36')][_0xd702('0x38')]?_0x1870b7[_0xd702('0x36')]:_0x43cd38[_0xd702('0x32')];if(!_0x5f1084[_0xd702('0x33')][_0xd702('0x39')](_0xd702('0x3a'))){_0x1870b7[_0xd702('0x1e')]=qs[_0xd702('0x1e')](_0x5f1084[_0xd702('0x33')][_0xd702('0x1e')]);_0x1870b7[_0xd702('0x1d')]=qs[_0xd702('0x1d')](_0x5f1084['query'][_0xd702('0x1d')]);}_0x1870b7[_0xd702('0x3b')]=qs[_0xd702('0x3c')](_0x5f1084[_0xd702('0x33')][_0xd702('0x3c')]);_0x1870b7[_0xd702('0x3d')]=qs[_0xd702('0x3e')](_['pick'](_0x5f1084['query'],_0x43cd38[_0xd702('0x3e')]),_0x45cd22);if(_0x5f1084[_0xd702('0x33')]['filter']){_0x1870b7['where']=_[_0xd702('0x3f')](_0x1870b7[_0xd702('0x3d')],{'$or':_['map'](_0x45cd22,function(_0x3a7aee){if(_0x3a7aee[_0xd702('0x30')]!==_0xd702('0x40')){var _0x4822d9={};_0x4822d9[_0x3a7aee[_0xd702('0x29')]]={'$like':'%'+_0x5f1084[_0xd702('0x33')][_0xd702('0x41')]+'%'};return _0x4822d9;}})});}_0x1870b7=_['merge']({},_0x1870b7,_0x5f1084[_0xd702('0x42')]);var _0x512854={'where':_0x1870b7[_0xd702('0x3d')]};return db[_0xd702('0x2d')][_0xd702('0x20')](_0x512854)[_0xd702('0x26')](function(_0x6af8d6){_0x56bc8d[_0xd702('0x20')]=_0x6af8d6;if(_0x5f1084[_0xd702('0x33')][_0xd702('0x43')]){_0x1870b7['include']=[{'all':!![]}];}return db[_0xd702('0x2d')][_0xd702('0x44')](_0x1870b7);})[_0xd702('0x26')](function(_0x3d703e){_0x56bc8d[_0xd702('0x45')]=_0x3d703e;return _0x56bc8d;})['then'](respondWithFilteredResult(_0x47c9a2,_0x1870b7))[_0xd702('0x46')](handleError(_0x47c9a2,null));};exports[_0xd702('0x47')]=function(_0x3424a3,_0x4c56ae){var _0xd48ad0={'raw':![],'where':{'id':_0x3424a3[_0xd702('0x48')]['id']}},_0x3a1ed5={};_0x3a1ed5[_0xd702('0x32')]=_['keys'](db[_0xd702('0x2d')][_0xd702('0x2e')]);_0x3a1ed5[_0xd702('0x33')]=_[_0xd702('0x34')](_0x3424a3[_0xd702('0x33')]);_0x3a1ed5['filters']=_[_0xd702('0x35')](_0x3a1ed5[_0xd702('0x32')],_0x3a1ed5['query']);_0xd48ad0['attributes']=_[_0xd702('0x35')](_0x3a1ed5[_0xd702('0x32')],qs[_0xd702('0x37')](_0x3424a3[_0xd702('0x33')][_0xd702('0x37')]));_0xd48ad0[_0xd702('0x36')]=_0xd48ad0[_0xd702('0x36')][_0xd702('0x38')]?_0xd48ad0[_0xd702('0x36')]:_0x3a1ed5['model'];if(_0x3424a3['query'][_0xd702('0x43')]){_0xd48ad0['include']=[{'all':!![]}];}_0xd48ad0=_[_0xd702('0x3f')]({},_0xd48ad0,_0x3424a3['options']);return db[_0xd702('0x2d')]['find'](_0xd48ad0)[_0xd702('0x26')](handleEntityNotFound(_0x4c56ae,null))['then'](respondWithResult(_0x4c56ae,null))[_0xd702('0x46')](handleError(_0x4c56ae,null));};exports[_0xd702('0x49')]=function(_0x543b8f,_0x160f5e){return db[_0xd702('0x2d')][_0xd702('0x49')](_0x543b8f[_0xd702('0x4a')],{})[_0xd702('0x26')](respondWithResult(_0x160f5e,0xc9))['catch'](handleError(_0x160f5e,null));};exports[_0xd702('0x4b')]=function(_0x14c1db,_0x2d09be){if(_0x14c1db['body']['id']){delete _0x14c1db[_0xd702('0x4a')]['id'];}return db['VtigerConfiguration'][_0xd702('0x4c')]({'where':{'id':_0x14c1db[_0xd702('0x48')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x2d09be,null))['then'](saveUpdates(_0x14c1db['body'],null))[_0xd702('0x26')](respondWithResult(_0x2d09be,null))[_0xd702('0x46')](handleError(_0x2d09be,null));};exports[_0xd702('0x25')]=function(_0x397e91,_0x16e59b){return db[_0xd702('0x2d')][_0xd702('0x4c')]({'where':{'id':_0x397e91[_0xd702('0x48')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x16e59b,null))[_0xd702('0x26')](removeEntity(_0x16e59b,null))['catch'](handleError(_0x16e59b,null));};exports['getFields']=function(_0x2980d5,_0x11260a,_0x229d47){var _0x5180c4={};var _0x52efb4={};var _0x831383;var _0x54c7e2;return db[_0xd702('0x2d')][_0xd702('0x4d')]({'where':{'id':_0x2980d5[_0xd702('0x48')]['id']}})[_0xd702('0x26')](handleEntityNotFound(_0x11260a,null))[_0xd702('0x26')](function(_0x3cd4c1){if(_0x3cd4c1){_0x831383=_0x3cd4c1;_0x52efb4[_0xd702('0x32')]=_[_0xd702('0x34')](db[_0xd702('0x4e')]['rawAttributes']);_0x52efb4[_0xd702('0x33')]=_[_0xd702('0x34')](_0x2980d5[_0xd702('0x33')]);_0x52efb4[_0xd702('0x3e')]=_['intersection'](_0x52efb4[_0xd702('0x32')],_0x52efb4['query']);_0x5180c4[_0xd702('0x36')]=_['intersection'](_0x52efb4['model'],qs[_0xd702('0x37')](_0x2980d5[_0xd702('0x33')][_0xd702('0x37')]));_0x5180c4[_0xd702('0x36')]=_0x5180c4[_0xd702('0x36')][_0xd702('0x38')]?_0x5180c4['attributes']:_0x52efb4[_0xd702('0x32')];_0x5180c4[_0xd702('0x3b')]=qs['sort'](_0x2980d5[_0xd702('0x33')][_0xd702('0x3c')]);_0x5180c4[_0xd702('0x3d')]=qs[_0xd702('0x3e')](_[_0xd702('0x4f')](_0x2980d5[_0xd702('0x33')],_0x52efb4['filters']));if(_0x2980d5[_0xd702('0x33')][_0xd702('0x41')]){_0x5180c4[_0xd702('0x3d')]=_[_0xd702('0x3f')](_0x5180c4[_0xd702('0x3d')],{'$or':_['map'](_0x5180c4['attributes'],function(_0xe2796d){var _0x5d09df={};_0x5d09df[_0xe2796d]={'$like':'%'+_0x2980d5['query'][_0xd702('0x41')]+'%'};return _0x5d09df;})});}_0x5180c4=_['merge']({},_0x5180c4,_0x2980d5[_0xd702('0x42')]);return _0x831383[_0xd702('0x50')](_0x5180c4);}})[_0xd702('0x26')](function(_0x1ea97e){if(_0x1ea97e){_0x54c7e2=_0x1ea97e['length'];if(!_0x2980d5[_0xd702('0x33')]['hasOwnProperty'](_0xd702('0x3a'))){_0x5180c4['limit']=qs[_0xd702('0x1e')](_0x2980d5[_0xd702('0x33')][_0xd702('0x1e')]);_0x5180c4[_0xd702('0x1d')]=qs[_0xd702('0x1d')](_0x2980d5[_0xd702('0x33')][_0xd702('0x1d')]);}return _0x831383['getFields'](_0x5180c4);}})['then'](function(_0x3ab474){if(_0x3ab474){return _0x3ab474?{'count':_0x54c7e2,'rows':_0x3ab474}:null;}})['then'](respondWithResult(_0x11260a,null))[_0xd702('0x46')](handleError(_0x11260a,null));};exports[_0xd702('0x51')]=function(_0x4d5772,_0x22f0db,_0x229666){var _0x4c6b33={};var _0x1dbf12={};var _0x5e88cb;var _0x20f7ac;return db[_0xd702('0x2d')][_0xd702('0x4d')]({'where':{'id':_0x4d5772[_0xd702('0x48')]['id']}})['then'](handleEntityNotFound(_0x22f0db,null))[_0xd702('0x26')](function(_0x3777ae){if(_0x3777ae){_0x5e88cb=_0x3777ae;_0x1dbf12[_0xd702('0x32')]=_[_0xd702('0x34')](db[_0xd702('0x4e')]['rawAttributes']);_0x1dbf12[_0xd702('0x33')]=_[_0xd702('0x34')](_0x4d5772[_0xd702('0x33')]);_0x1dbf12[_0xd702('0x3e')]=_[_0xd702('0x35')](_0x1dbf12[_0xd702('0x32')],_0x1dbf12['query']);_0x4c6b33[_0xd702('0x36')]=_['intersection'](_0x1dbf12[_0xd702('0x32')],qs[_0xd702('0x37')](_0x4d5772[_0xd702('0x33')][_0xd702('0x37')]));_0x4c6b33['attributes']=_0x4c6b33[_0xd702('0x36')][_0xd702('0x38')]?_0x4c6b33[_0xd702('0x36')]:_0x1dbf12[_0xd702('0x32')];_0x4c6b33[_0xd702('0x3b')]=qs['sort'](_0x4d5772['query'][_0xd702('0x3c')]);_0x4c6b33[_0xd702('0x3d')]=qs[_0xd702('0x3e')](_[_0xd702('0x4f')](_0x4d5772[_0xd702('0x33')],_0x1dbf12[_0xd702('0x3e')]));if(_0x4d5772[_0xd702('0x33')][_0xd702('0x41')]){_0x4c6b33[_0xd702('0x3d')]=_[_0xd702('0x3f')](_0x4c6b33[_0xd702('0x3d')],{'$or':_[_0xd702('0x2c')](_0x4c6b33[_0xd702('0x36')],function(_0x75b86f){var _0x8b3e15={};_0x8b3e15[_0x75b86f]={'$like':'%'+_0x4d5772[_0xd702('0x33')]['filter']+'%'};return _0x8b3e15;})});}_0x4c6b33=_[_0xd702('0x3f')]({},_0x4c6b33,_0x4d5772['options']);return _0x5e88cb['getSubjects'](_0x4c6b33);}})[_0xd702('0x26')](function(_0x5cea9f){if(_0x5cea9f){_0x20f7ac=_0x5cea9f[_0xd702('0x38')];if(!_0x4d5772[_0xd702('0x33')][_0xd702('0x39')](_0xd702('0x3a'))){_0x4c6b33[_0xd702('0x1e')]=qs[_0xd702('0x1e')](_0x4d5772[_0xd702('0x33')][_0xd702('0x1e')]);_0x4c6b33[_0xd702('0x1d')]=qs[_0xd702('0x1d')](_0x4d5772[_0xd702('0x33')][_0xd702('0x1d')]);}return _0x5e88cb[_0xd702('0x51')](_0x4c6b33);}})[_0xd702('0x26')](function(_0x5e0470){if(_0x5e0470){return _0x5e0470?{'count':_0x20f7ac,'rows':_0x5e0470}:null;}})[_0xd702('0x26')](respondWithResult(_0x22f0db,null))[_0xd702('0x46')](handleError(_0x22f0db,null));};exports[_0xd702('0x52')]=function(_0x3be3c6,_0x5834e8,_0x15cecd){var _0x32c984={};var _0x454209={};var _0x2d8a0b;var _0x3253a8;return db['VtigerConfiguration'][_0xd702('0x4d')]({'where':{'id':_0x3be3c6[_0xd702('0x48')]['id']}})['then'](handleEntityNotFound(_0x5834e8,null))[_0xd702('0x26')](function(_0x12420){if(_0x12420){_0x2d8a0b=_0x12420;_0x454209[_0xd702('0x32')]=_['keys'](db[_0xd702('0x4e')][_0xd702('0x2e')]);_0x454209['query']=_[_0xd702('0x34')](_0x3be3c6[_0xd702('0x33')]);_0x454209[_0xd702('0x3e')]=_[_0xd702('0x35')](_0x454209[_0xd702('0x32')],_0x454209[_0xd702('0x33')]);_0x32c984[_0xd702('0x36')]=_[_0xd702('0x35')](_0x454209[_0xd702('0x32')],qs[_0xd702('0x37')](_0x3be3c6[_0xd702('0x33')]['fields']));_0x32c984[_0xd702('0x36')]=_0x32c984[_0xd702('0x36')]['length']?_0x32c984[_0xd702('0x36')]:_0x454209[_0xd702('0x32')];_0x32c984[_0xd702('0x3b')]=qs[_0xd702('0x3c')](_0x3be3c6[_0xd702('0x33')]['sort']);_0x32c984['where']=qs[_0xd702('0x3e')](_['pick'](_0x3be3c6[_0xd702('0x33')],_0x454209[_0xd702('0x3e')]));if(_0x3be3c6[_0xd702('0x33')][_0xd702('0x41')]){_0x32c984[_0xd702('0x3d')]=_['merge'](_0x32c984[_0xd702('0x3d')],{'$or':_['map'](_0x32c984[_0xd702('0x36')],function(_0x45ba8b){var _0x42c4c0={};_0x42c4c0[_0x45ba8b]={'$like':'%'+_0x3be3c6[_0xd702('0x33')][_0xd702('0x41')]+'%'};return _0x42c4c0;})});}_0x32c984=_[_0xd702('0x3f')]({},_0x32c984,_0x3be3c6['options']);return _0x2d8a0b['getDescriptions'](_0x32c984);}})[_0xd702('0x26')](function(_0x2eab19){if(_0x2eab19){_0x3253a8=_0x2eab19['length'];if(!_0x3be3c6[_0xd702('0x33')][_0xd702('0x39')]('nolimit')){_0x32c984['limit']=qs[_0xd702('0x1e')](_0x3be3c6[_0xd702('0x33')][_0xd702('0x1e')]);_0x32c984['offset']=qs[_0xd702('0x1d')](_0x3be3c6[_0xd702('0x33')][_0xd702('0x1d')]);}return _0x2d8a0b[_0xd702('0x52')](_0x32c984);}})[_0xd702('0x26')](function(_0x5c661c){if(_0x5c661c){return _0x5c661c?{'count':_0x3253a8,'rows':_0x5c661c}:null;}})[_0xd702('0x26')](respondWithResult(_0x5834e8,null))[_0xd702('0x46')](handleError(_0x5834e8,null));}; \ No newline at end of file +var _0xa2ab=['getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','getFields','getSubjects','VtigerField'];(function(_0xba0ecf,_0x595808){var _0x3a66a7=function(_0x1d2687){while(--_0x1d2687){_0xba0ecf['push'](_0xba0ecf['shift']());}};_0x3a66a7(++_0x595808);}(_0xa2ab,0xa7));var _0xba2a=function(_0x5480e5,_0x52e354){_0x5480e5=_0x5480e5-0x0;var _0x20b7cc=_0xa2ab[_0x5480e5];return _0x20b7cc;};'use strict';var emlformat=require(_0xba2a('0x0'));var rimraf=require(_0xba2a('0x1'));var zipdir=require(_0xba2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba2a('0x3'));var moment=require(_0xba2a('0x4'));var BPromise=require(_0xba2a('0x5'));var Mustache=require(_0xba2a('0x6'));var util=require(_0xba2a('0x7'));var path=require(_0xba2a('0x8'));var sox=require(_0xba2a('0x9'));var csv=require('to-csv');var ejs=require(_0xba2a('0xa'));var fs=require('fs');var fs_extra=require(_0xba2a('0xb'));var _=require(_0xba2a('0xc'));var squel=require('squel');var crypto=require(_0xba2a('0xd'));var jsforce=require(_0xba2a('0xe'));var deskjs=require(_0xba2a('0xf'));var toCsv=require(_0xba2a('0x10'));var querystring=require('querystring');var Papa=require(_0xba2a('0x11'));var Redis=require(_0xba2a('0x12'));var authService=require(_0xba2a('0x13'));var qs=require(_0xba2a('0x14'));var as=require(_0xba2a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba2a('0x16'))(_0xba2a('0x17'));var utils=require(_0xba2a('0x18'));var config=require(_0xba2a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xba2a('0x1a'))['db'];function respondWithStatusCode(_0x10bf76,_0x94b897){_0x94b897=_0x94b897||0xcc;return function(_0x2c850e){if(_0x2c850e){return _0x10bf76[_0xba2a('0x1b')](_0x94b897);}return _0x10bf76['status'](_0x94b897)[_0xba2a('0x1c')]();};}function respondWithResult(_0x44759c,_0xe2bbdb){_0xe2bbdb=_0xe2bbdb||0xc8;return function(_0x127c42){if(_0x127c42){return _0x44759c['status'](_0xe2bbdb)[_0xba2a('0x1d')](_0x127c42);}};}function respondWithFilteredResult(_0x1b3272,_0x261f90){return function(_0x4147a6){if(_0x4147a6){var _0x4b9f63=typeof _0x261f90[_0xba2a('0x1e')]===_0xba2a('0x1f')&&typeof _0x261f90['limit']===_0xba2a('0x1f');var _0x49c57e=_0x4147a6['count'];var _0x559c6e=_0x4b9f63?0x0:_0x261f90[_0xba2a('0x1e')];var _0xa56be8=_0x4b9f63?_0x4147a6[_0xba2a('0x20')]:_0x261f90[_0xba2a('0x1e')]+_0x261f90['limit'];var _0x437e4c;if(_0xa56be8>=_0x49c57e){_0xa56be8=_0x49c57e;_0x437e4c=0xc8;}else{_0x437e4c=0xce;}_0x1b3272[_0xba2a('0x21')](_0x437e4c);return _0x1b3272['set'](_0xba2a('0x22'),_0x559c6e+'-'+_0xa56be8+'/'+_0x49c57e)['json'](_0x4147a6);}return null;};}function patchUpdates(_0x3b3924){return function(_0x2ad68){try{jsonpatch[_0xba2a('0x23')](_0x2ad68,_0x3b3924,!![]);}catch(_0x1d4ba9){return BPromise[_0xba2a('0x24')](_0x1d4ba9);}return _0x2ad68[_0xba2a('0x25')]();};}function saveUpdates(_0x55565d,_0x2e0712){return function(_0x2cc3db){if(_0x2cc3db){return _0x2cc3db[_0xba2a('0x26')](_0x55565d)[_0xba2a('0x27')](function(_0x3bc8e1){return _0x3bc8e1;});}return null;};}function removeEntity(_0x56fa5e,_0xdfbf5c){return function(_0x4458cb){if(_0x4458cb){return _0x4458cb[_0xba2a('0x28')]()[_0xba2a('0x27')](function(){_0x56fa5e[_0xba2a('0x21')](0xcc)[_0xba2a('0x1c')]();});}};}function handleEntityNotFound(_0x24ee7d,_0x415dd7){return function(_0x4bba7a){if(!_0x4bba7a){_0x24ee7d[_0xba2a('0x1b')](0x194);}return _0x4bba7a;};}function handleError(_0x3d1a75,_0x1a0f21){_0x1a0f21=_0x1a0f21||0x1f4;return function(_0x2a001c){logger['error'](_0x2a001c[_0xba2a('0x29')]);if(_0x2a001c[_0xba2a('0x2a')]){delete _0x2a001c[_0xba2a('0x2a')];}_0x3d1a75['status'](_0x1a0f21)['send'](_0x2a001c);};}exports[_0xba2a('0x2b')]=function(_0x2f292b,_0x19c776){var _0x3bb5c3={},_0x3aa95a={},_0x403372={'count':0x0,'rows':[]};var _0x85d5a4=_[_0xba2a('0x2c')](db[_0xba2a('0x2d')][_0xba2a('0x2e')],function(_0x53f32d){return{'name':_0x53f32d[_0xba2a('0x2f')],'type':_0x53f32d[_0xba2a('0x30')][_0xba2a('0x31')]};});_0x3aa95a[_0xba2a('0x32')]=_['map'](_0x85d5a4,_0xba2a('0x2a'));_0x3aa95a[_0xba2a('0x33')]=_[_0xba2a('0x34')](_0x2f292b['query']);_0x3aa95a[_0xba2a('0x35')]=_[_0xba2a('0x36')](_0x3aa95a[_0xba2a('0x32')],_0x3aa95a[_0xba2a('0x33')]);_0x3bb5c3[_0xba2a('0x37')]=_[_0xba2a('0x36')](_0x3aa95a[_0xba2a('0x32')],qs[_0xba2a('0x38')](_0x2f292b['query'][_0xba2a('0x38')]));_0x3bb5c3[_0xba2a('0x37')]=_0x3bb5c3[_0xba2a('0x37')][_0xba2a('0x39')]?_0x3bb5c3[_0xba2a('0x37')]:_0x3aa95a['model'];if(!_0x2f292b[_0xba2a('0x33')][_0xba2a('0x3a')](_0xba2a('0x3b'))){_0x3bb5c3[_0xba2a('0x3c')]=qs['limit'](_0x2f292b[_0xba2a('0x33')][_0xba2a('0x3c')]);_0x3bb5c3[_0xba2a('0x1e')]=qs['offset'](_0x2f292b[_0xba2a('0x33')][_0xba2a('0x1e')]);}_0x3bb5c3[_0xba2a('0x3d')]=qs['sort'](_0x2f292b[_0xba2a('0x33')][_0xba2a('0x3e')]);_0x3bb5c3[_0xba2a('0x3f')]=qs[_0xba2a('0x35')](_[_0xba2a('0x40')](_0x2f292b[_0xba2a('0x33')],_0x3aa95a[_0xba2a('0x35')]),_0x85d5a4);if(_0x2f292b['query'][_0xba2a('0x41')]){_0x3bb5c3['where']=_[_0xba2a('0x42')](_0x3bb5c3[_0xba2a('0x3f')],{'$or':_['map'](_0x85d5a4,function(_0x5e4aa6){if(_0x5e4aa6['type']!=='VIRTUAL'){var _0x2402ff={};_0x2402ff[_0x5e4aa6['name']]={'$like':'%'+_0x2f292b[_0xba2a('0x33')][_0xba2a('0x41')]+'%'};return _0x2402ff;}})});}_0x3bb5c3=_['merge']({},_0x3bb5c3,_0x2f292b[_0xba2a('0x43')]);var _0x35a9c1={'where':_0x3bb5c3[_0xba2a('0x3f')]};return db['VtigerConfiguration'][_0xba2a('0x20')](_0x35a9c1)['then'](function(_0x34fbfb){_0x403372[_0xba2a('0x20')]=_0x34fbfb;if(_0x2f292b[_0xba2a('0x33')]['includeAll']){_0x3bb5c3[_0xba2a('0x44')]=[{'all':!![]}];}return db[_0xba2a('0x2d')][_0xba2a('0x45')](_0x3bb5c3);})['then'](function(_0xc184a6){_0x403372[_0xba2a('0x46')]=_0xc184a6;return _0x403372;})['then'](respondWithFilteredResult(_0x19c776,_0x3bb5c3))[_0xba2a('0x47')](handleError(_0x19c776,null));};exports[_0xba2a('0x48')]=function(_0x22a674,_0xc180a6){var _0x38d98c={'raw':![],'where':{'id':_0x22a674[_0xba2a('0x49')]['id']}},_0x3905d7={};_0x3905d7[_0xba2a('0x32')]=_[_0xba2a('0x34')](db['VtigerConfiguration'][_0xba2a('0x2e')]);_0x3905d7[_0xba2a('0x33')]=_['keys'](_0x22a674[_0xba2a('0x33')]);_0x3905d7[_0xba2a('0x35')]=_[_0xba2a('0x36')](_0x3905d7[_0xba2a('0x32')],_0x3905d7['query']);_0x38d98c['attributes']=_['intersection'](_0x3905d7['model'],qs[_0xba2a('0x38')](_0x22a674[_0xba2a('0x33')]['fields']));_0x38d98c['attributes']=_0x38d98c['attributes'][_0xba2a('0x39')]?_0x38d98c[_0xba2a('0x37')]:_0x3905d7['model'];if(_0x22a674['query'][_0xba2a('0x4a')]){_0x38d98c[_0xba2a('0x44')]=[{'all':!![]}];}_0x38d98c=_['merge']({},_0x38d98c,_0x22a674[_0xba2a('0x43')]);return db[_0xba2a('0x2d')][_0xba2a('0x4b')](_0x38d98c)['then'](handleEntityNotFound(_0xc180a6,null))[_0xba2a('0x27')](respondWithResult(_0xc180a6,null))['catch'](handleError(_0xc180a6,null));};exports[_0xba2a('0x4c')]=function(_0x574075,_0x317bd8){return db[_0xba2a('0x2d')][_0xba2a('0x4c')](_0x574075[_0xba2a('0x4d')],{})[_0xba2a('0x27')](respondWithResult(_0x317bd8,0xc9))[_0xba2a('0x47')](handleError(_0x317bd8,null));};exports['update']=function(_0x46d4f8,_0x5e7dbc){if(_0x46d4f8[_0xba2a('0x4d')]['id']){delete _0x46d4f8['body']['id'];}return db[_0xba2a('0x2d')][_0xba2a('0x4b')]({'where':{'id':_0x46d4f8[_0xba2a('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e7dbc,null))[_0xba2a('0x27')](saveUpdates(_0x46d4f8['body'],null))['then'](respondWithResult(_0x5e7dbc,null))[_0xba2a('0x47')](handleError(_0x5e7dbc,null));};exports['destroy']=function(_0x4f16c2,_0x236a31){return db[_0xba2a('0x2d')]['find']({'where':{'id':_0x4f16c2[_0xba2a('0x49')]['id']}})[_0xba2a('0x27')](handleEntityNotFound(_0x236a31,null))[_0xba2a('0x27')](removeEntity(_0x236a31,null))['catch'](handleError(_0x236a31,null));};exports['getFields']=function(_0x243469,_0x3c1926,_0x9e7df5){var _0x2e38a3={};var _0x395d86={};var _0x2c51d1;var _0x88c057;return db[_0xba2a('0x2d')][_0xba2a('0x4e')]({'where':{'id':_0x243469[_0xba2a('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c1926,null))[_0xba2a('0x27')](function(_0x4bec55){if(_0x4bec55){_0x2c51d1=_0x4bec55;_0x395d86[_0xba2a('0x32')]=_[_0xba2a('0x34')](db['VtigerField'][_0xba2a('0x2e')]);_0x395d86[_0xba2a('0x33')]=_[_0xba2a('0x34')](_0x243469[_0xba2a('0x33')]);_0x395d86[_0xba2a('0x35')]=_[_0xba2a('0x36')](_0x395d86['model'],_0x395d86[_0xba2a('0x33')]);_0x2e38a3['attributes']=_[_0xba2a('0x36')](_0x395d86[_0xba2a('0x32')],qs[_0xba2a('0x38')](_0x243469['query'][_0xba2a('0x38')]));_0x2e38a3[_0xba2a('0x37')]=_0x2e38a3[_0xba2a('0x37')]['length']?_0x2e38a3['attributes']:_0x395d86[_0xba2a('0x32')];_0x2e38a3[_0xba2a('0x3d')]=qs[_0xba2a('0x3e')](_0x243469[_0xba2a('0x33')][_0xba2a('0x3e')]);_0x2e38a3['where']=qs[_0xba2a('0x35')](_[_0xba2a('0x40')](_0x243469[_0xba2a('0x33')],_0x395d86[_0xba2a('0x35')]));if(_0x243469['query'][_0xba2a('0x41')]){_0x2e38a3[_0xba2a('0x3f')]=_[_0xba2a('0x42')](_0x2e38a3[_0xba2a('0x3f')],{'$or':_['map'](_0x2e38a3[_0xba2a('0x37')],function(_0x121e17){var _0x44ef91={};_0x44ef91[_0x121e17]={'$like':'%'+_0x243469['query'][_0xba2a('0x41')]+'%'};return _0x44ef91;})});}_0x2e38a3=_[_0xba2a('0x42')]({},_0x2e38a3,_0x243469[_0xba2a('0x43')]);return _0x2c51d1['getFields'](_0x2e38a3);}})['then'](function(_0x284399){if(_0x284399){_0x88c057=_0x284399[_0xba2a('0x39')];if(!_0x243469['query']['hasOwnProperty'](_0xba2a('0x3b'))){_0x2e38a3[_0xba2a('0x3c')]=qs[_0xba2a('0x3c')](_0x243469['query'][_0xba2a('0x3c')]);_0x2e38a3[_0xba2a('0x1e')]=qs['offset'](_0x243469[_0xba2a('0x33')]['offset']);}return _0x2c51d1[_0xba2a('0x4f')](_0x2e38a3);}})[_0xba2a('0x27')](function(_0x4f2ae7){if(_0x4f2ae7){return _0x4f2ae7?{'count':_0x88c057,'rows':_0x4f2ae7}:null;}})[_0xba2a('0x27')](respondWithResult(_0x3c1926,null))[_0xba2a('0x47')](handleError(_0x3c1926,null));};exports[_0xba2a('0x50')]=function(_0x3858a2,_0x6ed444,_0x7a7b8e){var _0x5cc5f9={};var _0x2f87e5={};var _0x330749;var _0x2266e2;return db[_0xba2a('0x2d')][_0xba2a('0x4e')]({'where':{'id':_0x3858a2[_0xba2a('0x49')]['id']}})['then'](handleEntityNotFound(_0x6ed444,null))[_0xba2a('0x27')](function(_0x20f33f){if(_0x20f33f){_0x330749=_0x20f33f;_0x2f87e5[_0xba2a('0x32')]=_['keys'](db['VtigerField'][_0xba2a('0x2e')]);_0x2f87e5[_0xba2a('0x33')]=_['keys'](_0x3858a2[_0xba2a('0x33')]);_0x2f87e5[_0xba2a('0x35')]=_['intersection'](_0x2f87e5[_0xba2a('0x32')],_0x2f87e5['query']);_0x5cc5f9['attributes']=_[_0xba2a('0x36')](_0x2f87e5[_0xba2a('0x32')],qs[_0xba2a('0x38')](_0x3858a2[_0xba2a('0x33')][_0xba2a('0x38')]));_0x5cc5f9[_0xba2a('0x37')]=_0x5cc5f9[_0xba2a('0x37')]['length']?_0x5cc5f9['attributes']:_0x2f87e5[_0xba2a('0x32')];_0x5cc5f9[_0xba2a('0x3d')]=qs['sort'](_0x3858a2['query']['sort']);_0x5cc5f9[_0xba2a('0x3f')]=qs['filters'](_[_0xba2a('0x40')](_0x3858a2[_0xba2a('0x33')],_0x2f87e5[_0xba2a('0x35')]));if(_0x3858a2[_0xba2a('0x33')][_0xba2a('0x41')]){_0x5cc5f9[_0xba2a('0x3f')]=_[_0xba2a('0x42')](_0x5cc5f9['where'],{'$or':_['map'](_0x5cc5f9[_0xba2a('0x37')],function(_0x3f1962){var _0x5efcbd={};_0x5efcbd[_0x3f1962]={'$like':'%'+_0x3858a2['query'][_0xba2a('0x41')]+'%'};return _0x5efcbd;})});}_0x5cc5f9=_[_0xba2a('0x42')]({},_0x5cc5f9,_0x3858a2[_0xba2a('0x43')]);return _0x330749[_0xba2a('0x50')](_0x5cc5f9);}})['then'](function(_0x4634cc){if(_0x4634cc){_0x2266e2=_0x4634cc[_0xba2a('0x39')];if(!_0x3858a2[_0xba2a('0x33')][_0xba2a('0x3a')]('nolimit')){_0x5cc5f9['limit']=qs[_0xba2a('0x3c')](_0x3858a2[_0xba2a('0x33')][_0xba2a('0x3c')]);_0x5cc5f9[_0xba2a('0x1e')]=qs[_0xba2a('0x1e')](_0x3858a2[_0xba2a('0x33')]['offset']);}return _0x330749[_0xba2a('0x50')](_0x5cc5f9);}})[_0xba2a('0x27')](function(_0x51b7e3){if(_0x51b7e3){return _0x51b7e3?{'count':_0x2266e2,'rows':_0x51b7e3}:null;}})[_0xba2a('0x27')](respondWithResult(_0x6ed444,null))[_0xba2a('0x47')](handleError(_0x6ed444,null));};exports['getDescriptions']=function(_0x2d6446,_0x4ec9ea,_0x6dcd7d){var _0x339bfb={};var _0x9b427b={};var _0x4df545;var _0x63dd2f;return db[_0xba2a('0x2d')]['findOne']({'where':{'id':_0x2d6446[_0xba2a('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ec9ea,null))[_0xba2a('0x27')](function(_0x499f65){if(_0x499f65){_0x4df545=_0x499f65;_0x9b427b[_0xba2a('0x32')]=_[_0xba2a('0x34')](db[_0xba2a('0x51')][_0xba2a('0x2e')]);_0x9b427b[_0xba2a('0x33')]=_[_0xba2a('0x34')](_0x2d6446[_0xba2a('0x33')]);_0x9b427b[_0xba2a('0x35')]=_[_0xba2a('0x36')](_0x9b427b[_0xba2a('0x32')],_0x9b427b[_0xba2a('0x33')]);_0x339bfb[_0xba2a('0x37')]=_[_0xba2a('0x36')](_0x9b427b[_0xba2a('0x32')],qs['fields'](_0x2d6446[_0xba2a('0x33')][_0xba2a('0x38')]));_0x339bfb[_0xba2a('0x37')]=_0x339bfb['attributes'][_0xba2a('0x39')]?_0x339bfb[_0xba2a('0x37')]:_0x9b427b['model'];_0x339bfb['order']=qs['sort'](_0x2d6446[_0xba2a('0x33')][_0xba2a('0x3e')]);_0x339bfb[_0xba2a('0x3f')]=qs[_0xba2a('0x35')](_[_0xba2a('0x40')](_0x2d6446['query'],_0x9b427b[_0xba2a('0x35')]));if(_0x2d6446[_0xba2a('0x33')][_0xba2a('0x41')]){_0x339bfb[_0xba2a('0x3f')]=_[_0xba2a('0x42')](_0x339bfb['where'],{'$or':_[_0xba2a('0x2c')](_0x339bfb[_0xba2a('0x37')],function(_0x3624dc){var _0x1fbcef={};_0x1fbcef[_0x3624dc]={'$like':'%'+_0x2d6446['query']['filter']+'%'};return _0x1fbcef;})});}_0x339bfb=_[_0xba2a('0x42')]({},_0x339bfb,_0x2d6446[_0xba2a('0x43')]);return _0x4df545[_0xba2a('0x52')](_0x339bfb);}})['then'](function(_0x172c1e){if(_0x172c1e){_0x63dd2f=_0x172c1e[_0xba2a('0x39')];if(!_0x2d6446[_0xba2a('0x33')][_0xba2a('0x3a')](_0xba2a('0x3b'))){_0x339bfb['limit']=qs[_0xba2a('0x3c')](_0x2d6446[_0xba2a('0x33')][_0xba2a('0x3c')]);_0x339bfb['offset']=qs[_0xba2a('0x1e')](_0x2d6446['query']['offset']);}return _0x4df545[_0xba2a('0x52')](_0x339bfb);}})['then'](function(_0x836cc2){if(_0x836cc2){return _0x836cc2?{'count':_0x63dd2f,'rows':_0x836cc2}:null;}})[_0xba2a('0x27')](respondWithResult(_0x4ec9ea,null))[_0xba2a('0x47')](handleError(_0x4ec9ea,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e5fa059..6b681e5 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 _0x6b86=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6b86,0x1b1));var _0x66b8=function(_0x47d6a9,_0x32de4b){_0x47d6a9=_0x47d6a9-0x0;var _0x11c430=_0x6b86[_0x47d6a9];return _0x11c430;};'use strict';var _=require(_0x66b8('0x0'));var util=require(_0x66b8('0x1'));var logger=require(_0x66b8('0x2'))(_0x66b8('0x3'));var moment=require(_0x66b8('0x4'));var BPromise=require(_0x66b8('0x5'));var rp=require(_0x66b8('0x6'));var fs=require('fs');var path=require(_0x66b8('0x7'));var rimraf=require('rimraf');var config=require(_0x66b8('0x8'));var attributes=require(_0x66b8('0x9'));module[_0x66b8('0xa')]=function(_0x424318,_0x48cf29){return _0x424318[_0x66b8('0xb')](_0x66b8('0xc'),attributes,{'tableName':_0x66b8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe954=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x58c0bc,_0x2de51f){var _0x5d681f=function(_0x11d843){while(--_0x11d843){_0x58c0bc['push'](_0x58c0bc['shift']());}};_0x5d681f(++_0x2de51f);}(_0xe954,0xa3));var _0x4e95=function(_0x2c9f0e,_0x474047){_0x2c9f0e=_0x2c9f0e-0x0;var _0x473710=_0xe954[_0x2c9f0e];return _0x473710;};'use strict';var _=require(_0x4e95('0x0'));var util=require(_0x4e95('0x1'));var logger=require(_0x4e95('0x2'))(_0x4e95('0x3'));var moment=require(_0x4e95('0x4'));var BPromise=require(_0x4e95('0x5'));var rp=require(_0x4e95('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e95('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x4e95('0x8')]=function(_0x260059,_0x361ef2){return _0x260059['define'](_0x4e95('0x9'),attributes,{'tableName':_0x4e95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 78d9937..5b9f40a 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 _0x189b=['rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xb5ef3b,_0x3d119e){var _0x170026=function(_0x14db28){while(--_0x14db28){_0xb5ef3b['push'](_0xb5ef3b['shift']());}};_0x170026(++_0x3d119e);}(_0x189b,0xd5));var _0xb189=function(_0x32569d,_0x58f9de){_0x32569d=_0x32569d-0x0;var _0x52dabf=_0x189b[_0x32569d];return _0x52dabf;};'use strict';var _=require(_0xb189('0x0'));var util=require(_0xb189('0x1'));var moment=require('moment');var BPromise=require(_0xb189('0x2'));var rs=require(_0xb189('0x3'));var fs=require('fs');var Redis=require(_0xb189('0x4'));var db=require(_0xb189('0x5'))['db'];var utils=require(_0xb189('0x6'));var logger=require('../../config/logger')(_0xb189('0x7'));var config=require(_0xb189('0x8'));var jayson=require(_0xb189('0x9'));var client=jayson[_0xb189('0xa')][_0xb189('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48b5f4,_0x4959e0,_0x76702a){return new BPromise(function(_0x5bb259,_0x28dcc7){return client['request'](_0x48b5f4,_0x76702a)[_0xb189('0xc')](function(_0x47eae2){logger[_0xb189('0xd')](_0xb189('0xe'),_0x4959e0,_0xb189('0xf'));logger['debug'](_0xb189('0x10'),_0x4959e0,_0xb189('0xf'),JSON['stringify'](_0x47eae2));if(_0x47eae2['error']){if(_0x47eae2['error'][_0xb189('0x11')]===0x1f4){logger[_0xb189('0x12')](_0xb189('0xe'),_0x4959e0,_0x47eae2[_0xb189('0x12')][_0xb189('0x13')]);return _0x28dcc7(_0x47eae2[_0xb189('0x12')]['message']);}logger[_0xb189('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x4959e0,_0x47eae2[_0xb189('0x12')]['message']);return _0x5bb259(_0x47eae2['error'][_0xb189('0x13')]);}else{logger['info'](_0xb189('0xe'),_0x4959e0,_0xb189('0xf'));_0x5bb259(_0x47eae2[_0xb189('0x14')][_0xb189('0x13')]);}})[_0xb189('0x15')](function(_0xe08a3f){logger['error'](_0xb189('0xe'),_0x4959e0,_0xe08a3f);_0x28dcc7(_0xe08a3f);});});} \ No newline at end of file +var _0x322f=['message','request\x20sent','result','catch','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x322f,0x9c));var _0xf322=function(_0x4bc2dc,_0x5aa865){_0x4bc2dc=_0x4bc2dc-0x0;var _0x3dbee9=_0x322f[_0x4bc2dc];return _0x3dbee9;};'use strict';var _=require('lodash');var util=require(_0xf322('0x0'));var moment=require(_0xf322('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf322('0x2'))['db'];var utils=require(_0xf322('0x3'));var logger=require('../../config/logger')(_0xf322('0x4'));var config=require(_0xf322('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf322('0x6')][_0xf322('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x59e78d,_0x550a24,_0x55ed98){return new BPromise(function(_0x17187f,_0xb9a7b){return client['request'](_0x59e78d,_0x55ed98)['then'](function(_0xb109dc){logger[_0xf322('0x8')](_0xf322('0x9'),_0x550a24,'request\x20sent');logger[_0xf322('0xa')](_0xf322('0xb'),_0x550a24,'request\x20sent',JSON[_0xf322('0xc')](_0xb109dc));if(_0xb109dc['error']){if(_0xb109dc[_0xf322('0xd')][_0xf322('0xe')]===0x1f4){logger[_0xf322('0xd')](_0xf322('0x9'),_0x550a24,_0xb109dc[_0xf322('0xd')][_0xf322('0xf')]);return _0xb9a7b(_0xb109dc[_0xf322('0xd')][_0xf322('0xf')]);}logger[_0xf322('0xd')](_0xf322('0x9'),_0x550a24,_0xb109dc['error']['message']);return _0x17187f(_0xb109dc[_0xf322('0xd')][_0xf322('0xf')]);}else{logger[_0xf322('0x8')](_0xf322('0x9'),_0x550a24,_0xf322('0x10'));_0x17187f(_0xb109dc[_0xf322('0x11')][_0xf322('0xf')]);}})[_0xf322('0x12')](function(_0x2daade){logger[_0xf322('0xd')](_0xf322('0x9'),_0x550a24,_0x2daade);_0xb9a7b(_0x2daade);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index e609f66..af791f8 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 _0x6eaa=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports'];(function(_0xb36843,_0x57c1f4){var _0x227b83=function(_0x3bce6f){while(--_0x3bce6f){_0xb36843['push'](_0xb36843['shift']());}};_0x227b83(++_0x57c1f4);}(_0x6eaa,0xd1));var _0xa6ea=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x6eaa[_0x5c72ee];return _0x231876;};'use strict';var multer=require(_0xa6ea('0x0'));var util=require(_0xa6ea('0x1'));var path=require(_0xa6ea('0x2'));var timeout=require(_0xa6ea('0x3'));var express=require(_0xa6ea('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa6ea('0x5'));var interaction=require(_0xa6ea('0x6'));var config=require(_0xa6ea('0x7'));var controller=require(_0xa6ea('0x8'));router[_0xa6ea('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa6ea('0x9')](_0xa6ea('0xa'),auth[_0xa6ea('0xb')](),controller[_0xa6ea('0xc')]);router['post']('/',auth[_0xa6ea('0xb')](),controller[_0xa6ea('0xd')]);router[_0xa6ea('0xe')]('/:id',auth[_0xa6ea('0xb')](),controller[_0xa6ea('0xf')]);router[_0xa6ea('0x10')]('/:id',auth[_0xa6ea('0xb')](),controller[_0xa6ea('0x11')]);module[_0xa6ea('0x12')]=router; \ No newline at end of file +var _0xae94=['./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x16f9bf,_0x50b53d){var _0x2e54f5=function(_0xca76b1){while(--_0xca76b1){_0x16f9bf['push'](_0x16f9bf['shift']());}};_0x2e54f5(++_0x50b53d);}(_0xae94,0xdb));var _0x4ae9=function(_0xe2b770,_0x96d8c3){_0xe2b770=_0xe2b770-0x0;var _0x4f2a9a=_0xae94[_0xe2b770];return _0x4f2a9a;};'use strict';var multer=require(_0x4ae9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4ae9('0x1'));var express=require(_0x4ae9('0x2'));var router=express[_0x4ae9('0x3')]();var fs_extra=require(_0x4ae9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ae9('0x5'));var controller=require(_0x4ae9('0x6'));router[_0x4ae9('0x7')]('/',auth[_0x4ae9('0x8')](),controller[_0x4ae9('0x9')]);router['get'](_0x4ae9('0xa'),auth[_0x4ae9('0x8')](),controller[_0x4ae9('0xb')]);router['post']('/',auth[_0x4ae9('0x8')](),controller[_0x4ae9('0xc')]);router['put'](_0x4ae9('0xa'),auth[_0x4ae9('0x8')](),controller['update']);router[_0x4ae9('0xd')]('/:id',auth[_0x4ae9('0x8')](),controller['destroy']);module[_0x4ae9('0xe')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a3d1531..c2699a8 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 _0xbcaf=['exports','ENUM','string','variable','customVariable','STRING','sequelize'];(function(_0xa81dce,_0x1586c6){var _0x3d06b9=function(_0x15babd){while(--_0x15babd){_0xa81dce['push'](_0xa81dce['shift']());}};_0x3d06b9(++_0x1586c6);}(_0xbcaf,0x1e9));var _0xfbca=function(_0x316a28,_0x4e4ad8){_0x316a28=_0x316a28-0x0;var _0x55347a=_0xbcaf[_0x316a28];return _0x55347a;};'use strict';var Sequelize=require(_0xfbca('0x0'));module[_0xfbca('0x1')]={'type':{'type':Sequelize[_0xfbca('0x2')](_0xfbca('0x3'),_0xfbca('0x4'),_0xfbca('0x5'),'keyValue','picklist'),'defaultValue':_0xfbca('0x3')},'content':{'type':Sequelize[_0xfbca('0x6')]},'key':{'type':Sequelize[_0xfbca('0x6')]},'keyType':{'type':Sequelize[_0xfbca('0x2')]('string','variable',_0xfbca('0x5'))},'keyContent':{'type':Sequelize[_0xfbca('0x6')]},'idField':{'type':Sequelize[_0xfbca('0x6')]},'nameField':{'type':Sequelize[_0xfbca('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x13fa=['ENUM','customVariable','sequelize','exports','variable','string','STRING'];(function(_0xd06da0,_0x56102d){var _0x2b9c41=function(_0x16c2c4){while(--_0x16c2c4){_0xd06da0['push'](_0xd06da0['shift']());}};_0x2b9c41(++_0x56102d);}(_0x13fa,0xcd));var _0xa13f=function(_0x30b145,_0x5b1406){_0x30b145=_0x30b145-0x0;var _0x5acce4=_0x13fa[_0x30b145];return _0x5acce4;};'use strict';var Sequelize=require(_0xa13f('0x0'));module[_0xa13f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xa13f('0x2'),'customVariable','keyValue','picklist'),'defaultValue':_0xa13f('0x3')},'content':{'type':Sequelize[_0xa13f('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa13f('0x5')](_0xa13f('0x3'),'variable',_0xa13f('0x6'))},'keyContent':{'type':Sequelize[_0xa13f('0x4')]},'idField':{'type':Sequelize[_0xa13f('0x4')]},'nameField':{'type':Sequelize[_0xa13f('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5ad0df9..cb6bcd6 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 _0x2b9f=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VtigerField','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','name','index','map','fieldName','type','key'];(function(_0x26688d,_0x3cef0f){var _0x1d5cb5=function(_0x1beaa3){while(--_0x1beaa3){_0x26688d['push'](_0x26688d['shift']());}};_0x1d5cb5(++_0x3cef0f);}(_0x2b9f,0x68));var _0xf2b9=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x2b9f[_0x45f951];return _0x24756c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2b9('0x0'));var zipdir=require(_0xf2b9('0x1'));var jsonpatch=require(_0xf2b9('0x2'));var rp=require(_0xf2b9('0x3'));var moment=require(_0xf2b9('0x4'));var BPromise=require(_0xf2b9('0x5'));var Mustache=require(_0xf2b9('0x6'));var util=require(_0xf2b9('0x7'));var path=require('path');var sox=require(_0xf2b9('0x8'));var csv=require('to-csv');var ejs=require(_0xf2b9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2b9('0xa'));var squel=require('squel');var crypto=require(_0xf2b9('0xb'));var jsforce=require(_0xf2b9('0xc'));var deskjs=require(_0xf2b9('0xd'));var toCsv=require(_0xf2b9('0xe'));var querystring=require(_0xf2b9('0xf'));var Papa=require(_0xf2b9('0x10'));var Redis=require(_0xf2b9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf2b9('0x12'));var as=require(_0xf2b9('0x13'));var hardwareService=require(_0xf2b9('0x14'));var logger=require(_0xf2b9('0x15'))(_0xf2b9('0x16'));var utils=require(_0xf2b9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf2b9('0x18'));var db=require(_0xf2b9('0x19'))['db'];function respondWithStatusCode(_0x4432a1,_0x3b415b){_0x3b415b=_0x3b415b||0xcc;return function(_0x555f1c){if(_0x555f1c){return _0x4432a1[_0xf2b9('0x1a')](_0x3b415b);}return _0x4432a1[_0xf2b9('0x1b')](_0x3b415b)[_0xf2b9('0x1c')]();};}function respondWithResult(_0x1ac2f0,_0x158b53){_0x158b53=_0x158b53||0xc8;return function(_0x12fb8c){if(_0x12fb8c){return _0x1ac2f0['status'](_0x158b53)[_0xf2b9('0x1d')](_0x12fb8c);}};}function respondWithFilteredResult(_0x400565,_0x589dd5){return function(_0x495758){if(_0x495758){var _0x1694f0=typeof _0x589dd5[_0xf2b9('0x1e')]===_0xf2b9('0x1f')&&typeof _0x589dd5[_0xf2b9('0x20')]===_0xf2b9('0x1f');var _0x36c171=_0x495758[_0xf2b9('0x21')];var _0x16c2ee=_0x1694f0?0x0:_0x589dd5[_0xf2b9('0x1e')];var _0x2ea231=_0x1694f0?_0x495758[_0xf2b9('0x21')]:_0x589dd5[_0xf2b9('0x1e')]+_0x589dd5[_0xf2b9('0x20')];var _0xe4d13c;if(_0x2ea231>=_0x36c171){_0x2ea231=_0x36c171;_0xe4d13c=0xc8;}else{_0xe4d13c=0xce;}_0x400565[_0xf2b9('0x1b')](_0xe4d13c);return _0x400565[_0xf2b9('0x22')](_0xf2b9('0x23'),_0x16c2ee+'-'+_0x2ea231+'/'+_0x36c171)[_0xf2b9('0x1d')](_0x495758);}return null;};}function patchUpdates(_0x2310b7){return function(_0x3a47a2){try{jsonpatch['apply'](_0x3a47a2,_0x2310b7,!![]);}catch(_0x44e73f){return BPromise[_0xf2b9('0x24')](_0x44e73f);}return _0x3a47a2['save']();};}function saveUpdates(_0x1d29cc,_0x54cbc7){return function(_0x1a61f2){if(_0x1a61f2){return _0x1a61f2[_0xf2b9('0x25')](_0x1d29cc)[_0xf2b9('0x26')](function(_0x154db3){return _0x154db3;});}return null;};}function removeEntity(_0x40b81b,_0x5bab6f){return function(_0x5457de){if(_0x5457de){return _0x5457de[_0xf2b9('0x27')]()[_0xf2b9('0x26')](function(){_0x40b81b[_0xf2b9('0x1b')](0xcc)[_0xf2b9('0x1c')]();});}};}function handleEntityNotFound(_0x534722,_0x1e1322){return function(_0x1ec79f){if(!_0x1ec79f){_0x534722[_0xf2b9('0x1a')](0x194);}return _0x1ec79f;};}function handleError(_0xf3f46e,_0x2d3f74){_0x2d3f74=_0x2d3f74||0x1f4;return function(_0x11fc0a){logger['error'](_0x11fc0a['stack']);if(_0x11fc0a[_0xf2b9('0x28')]){delete _0x11fc0a[_0xf2b9('0x28')];}_0xf3f46e[_0xf2b9('0x1b')](_0x2d3f74)['send'](_0x11fc0a);};}exports[_0xf2b9('0x29')]=function(_0x37ff55,_0x4ebb27){var _0x5c093f={},_0x4823d1={},_0x405252={'count':0x0,'rows':[]};var _0x50e901=_[_0xf2b9('0x2a')](db['VtigerField']['rawAttributes'],function(_0x41efa8){return{'name':_0x41efa8[_0xf2b9('0x2b')],'type':_0x41efa8[_0xf2b9('0x2c')][_0xf2b9('0x2d')]};});_0x4823d1[_0xf2b9('0x2e')]=_[_0xf2b9('0x2a')](_0x50e901,'name');_0x4823d1[_0xf2b9('0x2f')]=_[_0xf2b9('0x30')](_0x37ff55[_0xf2b9('0x2f')]);_0x4823d1[_0xf2b9('0x31')]=_[_0xf2b9('0x32')](_0x4823d1[_0xf2b9('0x2e')],_0x4823d1[_0xf2b9('0x2f')]);_0x5c093f[_0xf2b9('0x33')]=_[_0xf2b9('0x32')](_0x4823d1[_0xf2b9('0x2e')],qs[_0xf2b9('0x34')](_0x37ff55[_0xf2b9('0x2f')][_0xf2b9('0x34')]));_0x5c093f[_0xf2b9('0x33')]=_0x5c093f[_0xf2b9('0x33')][_0xf2b9('0x35')]?_0x5c093f['attributes']:_0x4823d1[_0xf2b9('0x2e')];if(!_0x37ff55[_0xf2b9('0x2f')][_0xf2b9('0x36')](_0xf2b9('0x37'))){_0x5c093f[_0xf2b9('0x20')]=qs[_0xf2b9('0x20')](_0x37ff55[_0xf2b9('0x2f')][_0xf2b9('0x20')]);_0x5c093f[_0xf2b9('0x1e')]=qs['offset'](_0x37ff55[_0xf2b9('0x2f')]['offset']);}_0x5c093f[_0xf2b9('0x38')]=qs[_0xf2b9('0x39')](_0x37ff55[_0xf2b9('0x2f')][_0xf2b9('0x39')]);_0x5c093f[_0xf2b9('0x3a')]=qs['filters'](_['pick'](_0x37ff55[_0xf2b9('0x2f')],_0x4823d1[_0xf2b9('0x31')]),_0x50e901);if(_0x37ff55[_0xf2b9('0x2f')][_0xf2b9('0x3b')]){_0x5c093f['where']=_[_0xf2b9('0x3c')](_0x5c093f['where'],{'$or':_['map'](_0x50e901,function(_0x54c377){if(_0x54c377[_0xf2b9('0x2c')]!==_0xf2b9('0x3d')){var _0x378221={};_0x378221[_0x54c377['name']]={'$like':'%'+_0x37ff55[_0xf2b9('0x2f')]['filter']+'%'};return _0x378221;}})});}_0x5c093f=_[_0xf2b9('0x3c')]({},_0x5c093f,_0x37ff55[_0xf2b9('0x3e')]);var _0x5bb1b7={'where':_0x5c093f[_0xf2b9('0x3a')]};return db[_0xf2b9('0x3f')][_0xf2b9('0x21')](_0x5bb1b7)[_0xf2b9('0x26')](function(_0x1e9efa){_0x405252[_0xf2b9('0x21')]=_0x1e9efa;if(_0x37ff55[_0xf2b9('0x2f')]['includeAll']){_0x5c093f[_0xf2b9('0x40')]=[{'all':!![]}];}return db[_0xf2b9('0x3f')][_0xf2b9('0x41')](_0x5c093f);})[_0xf2b9('0x26')](function(_0x427db1){_0x405252[_0xf2b9('0x42')]=_0x427db1;return _0x405252;})[_0xf2b9('0x26')](respondWithFilteredResult(_0x4ebb27,_0x5c093f))[_0xf2b9('0x43')](handleError(_0x4ebb27,null));};exports[_0xf2b9('0x44')]=function(_0x1af7da,_0x439518){var _0x35e12b={'raw':!![],'where':{'id':_0x1af7da[_0xf2b9('0x45')]['id']}},_0x4710c3={};_0x4710c3[_0xf2b9('0x2e')]=_[_0xf2b9('0x30')](db[_0xf2b9('0x3f')][_0xf2b9('0x46')]);_0x4710c3[_0xf2b9('0x2f')]=_[_0xf2b9('0x30')](_0x1af7da[_0xf2b9('0x2f')]);_0x4710c3[_0xf2b9('0x31')]=_[_0xf2b9('0x32')](_0x4710c3[_0xf2b9('0x2e')],_0x4710c3[_0xf2b9('0x2f')]);_0x35e12b[_0xf2b9('0x33')]=_[_0xf2b9('0x32')](_0x4710c3[_0xf2b9('0x2e')],qs[_0xf2b9('0x34')](_0x1af7da[_0xf2b9('0x2f')]['fields']));_0x35e12b[_0xf2b9('0x33')]=_0x35e12b[_0xf2b9('0x33')]['length']?_0x35e12b[_0xf2b9('0x33')]:_0x4710c3[_0xf2b9('0x2e')];if(_0x1af7da[_0xf2b9('0x2f')][_0xf2b9('0x47')]){_0x35e12b[_0xf2b9('0x40')]=[{'all':!![]}];}_0x35e12b=_[_0xf2b9('0x3c')]({},_0x35e12b,_0x1af7da['options']);return db['VtigerField'][_0xf2b9('0x48')](_0x35e12b)[_0xf2b9('0x26')](handleEntityNotFound(_0x439518,null))['then'](respondWithResult(_0x439518,null))[_0xf2b9('0x43')](handleError(_0x439518,null));};exports[_0xf2b9('0x49')]=function(_0x48de4c,_0x18c4a3){return db[_0xf2b9('0x3f')]['create'](_0x48de4c[_0xf2b9('0x4a')],{})[_0xf2b9('0x26')](respondWithResult(_0x18c4a3,0xc9))[_0xf2b9('0x43')](handleError(_0x18c4a3,null));};exports[_0xf2b9('0x25')]=function(_0x16a63c,_0x5d9f67){if(_0x16a63c[_0xf2b9('0x4a')]['id']){delete _0x16a63c['body']['id'];}return db['VtigerField'][_0xf2b9('0x48')]({'where':{'id':_0x16a63c[_0xf2b9('0x45')]['id']}})[_0xf2b9('0x26')](handleEntityNotFound(_0x5d9f67,null))['then'](saveUpdates(_0x16a63c['body'],null))['then'](respondWithResult(_0x5d9f67,null))['catch'](handleError(_0x5d9f67,null));};exports[_0xf2b9('0x27')]=function(_0x3ef05f,_0x397c80){return db[_0xf2b9('0x3f')]['find']({'where':{'id':_0x3ef05f[_0xf2b9('0x45')]['id']}})[_0xf2b9('0x26')](handleEntityNotFound(_0x397c80,null))[_0xf2b9('0x26')](removeEntity(_0x397c80,null))['catch'](handleError(_0x397c80,null));}; \ No newline at end of file +var _0x5d82=['create','destroy','rimraf','fast-json-patch','moment','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','name','send','VtigerField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find'];(function(_0xb4e2df,_0x1cbb7c){var _0x5e95ba=function(_0x79d317){while(--_0x79d317){_0xb4e2df['push'](_0xb4e2df['shift']());}};_0x5e95ba(++_0x1cbb7c);}(_0x5d82,0xd4));var _0x25d8=function(_0x1f0498,_0x4eb36a){_0x1f0498=_0x1f0498-0x0;var _0x36221a=_0x5d82[_0x1f0498];return _0x36221a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25d8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25d8('0x1'));var rp=require('request-promise');var moment=require(_0x25d8('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x25d8('0x3'));var path=require(_0x25d8('0x4'));var sox=require(_0x25d8('0x5'));var csv=require('to-csv');var ejs=require(_0x25d8('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25d8('0x7'));var crypto=require(_0x25d8('0x8'));var jsforce=require(_0x25d8('0x9'));var deskjs=require(_0x25d8('0xa'));var toCsv=require(_0x25d8('0xb'));var querystring=require('querystring');var Papa=require(_0x25d8('0xc'));var Redis=require(_0x25d8('0xd'));var authService=require(_0x25d8('0xe'));var qs=require(_0x25d8('0xf'));var as=require(_0x25d8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25d8('0x11'))(_0x25d8('0x12'));var utils=require(_0x25d8('0x13'));var config=require(_0x25d8('0x14'));var licenseUtil=require(_0x25d8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3af3d3,_0x1b1abe){_0x1b1abe=_0x1b1abe||0xcc;return function(_0x544961){if(_0x544961){return _0x3af3d3[_0x25d8('0x16')](_0x1b1abe);}return _0x3af3d3[_0x25d8('0x17')](_0x1b1abe)[_0x25d8('0x18')]();};}function respondWithResult(_0x5f3098,_0x17b9ba){_0x17b9ba=_0x17b9ba||0xc8;return function(_0x623915){if(_0x623915){return _0x5f3098[_0x25d8('0x17')](_0x17b9ba)['json'](_0x623915);}};}function respondWithFilteredResult(_0x60b04a,_0x35e08b){return function(_0x94c33a){if(_0x94c33a){var _0x5e6a83=typeof _0x35e08b[_0x25d8('0x19')]===_0x25d8('0x1a')&&typeof _0x35e08b[_0x25d8('0x1b')]===_0x25d8('0x1a');var _0x336ca1=_0x94c33a[_0x25d8('0x1c')];var _0x54f626=_0x5e6a83?0x0:_0x35e08b[_0x25d8('0x19')];var _0x1ba261=_0x5e6a83?_0x94c33a['count']:_0x35e08b[_0x25d8('0x19')]+_0x35e08b['limit'];var _0x21cda0;if(_0x1ba261>=_0x336ca1){_0x1ba261=_0x336ca1;_0x21cda0=0xc8;}else{_0x21cda0=0xce;}_0x60b04a[_0x25d8('0x17')](_0x21cda0);return _0x60b04a[_0x25d8('0x1d')](_0x25d8('0x1e'),_0x54f626+'-'+_0x1ba261+'/'+_0x336ca1)[_0x25d8('0x1f')](_0x94c33a);}return null;};}function patchUpdates(_0x12629c){return function(_0x3a0215){try{jsonpatch[_0x25d8('0x20')](_0x3a0215,_0x12629c,!![]);}catch(_0x9781cc){return BPromise['reject'](_0x9781cc);}return _0x3a0215[_0x25d8('0x21')]();};}function saveUpdates(_0x583d8d,_0x49857e){return function(_0x25ad47){if(_0x25ad47){return _0x25ad47[_0x25d8('0x22')](_0x583d8d)[_0x25d8('0x23')](function(_0xa1eb15){return _0xa1eb15;});}return null;};}function removeEntity(_0x2ed6ae,_0x3c7973){return function(_0x30aa8b){if(_0x30aa8b){return _0x30aa8b['destroy']()[_0x25d8('0x23')](function(){_0x2ed6ae['status'](0xcc)[_0x25d8('0x18')]();});}};}function handleEntityNotFound(_0x32cea7,_0x2fc0db){return function(_0x320dd8){if(!_0x320dd8){_0x32cea7[_0x25d8('0x16')](0x194);}return _0x320dd8;};}function handleError(_0x37dd02,_0x311da3){_0x311da3=_0x311da3||0x1f4;return function(_0x2f295d){logger[_0x25d8('0x24')](_0x2f295d['stack']);if(_0x2f295d[_0x25d8('0x25')]){delete _0x2f295d[_0x25d8('0x25')];}_0x37dd02[_0x25d8('0x17')](_0x311da3)[_0x25d8('0x26')](_0x2f295d);};}exports['index']=function(_0x5af26c,_0x4e87d3){var _0x57c331={},_0x221f37={},_0x305c11={'count':0x0,'rows':[]};var _0x4b3c2f=_['map'](db[_0x25d8('0x27')][_0x25d8('0x28')],function(_0x5112a8){return{'name':_0x5112a8[_0x25d8('0x29')],'type':_0x5112a8[_0x25d8('0x2a')]['key']};});_0x221f37[_0x25d8('0x2b')]=_['map'](_0x4b3c2f,'name');_0x221f37[_0x25d8('0x2c')]=_[_0x25d8('0x2d')](_0x5af26c[_0x25d8('0x2c')]);_0x221f37[_0x25d8('0x2e')]=_[_0x25d8('0x2f')](_0x221f37[_0x25d8('0x2b')],_0x221f37[_0x25d8('0x2c')]);_0x57c331['attributes']=_[_0x25d8('0x2f')](_0x221f37['model'],qs[_0x25d8('0x30')](_0x5af26c[_0x25d8('0x2c')][_0x25d8('0x30')]));_0x57c331[_0x25d8('0x31')]=_0x57c331[_0x25d8('0x31')][_0x25d8('0x32')]?_0x57c331[_0x25d8('0x31')]:_0x221f37[_0x25d8('0x2b')];if(!_0x5af26c['query'][_0x25d8('0x33')](_0x25d8('0x34'))){_0x57c331[_0x25d8('0x1b')]=qs[_0x25d8('0x1b')](_0x5af26c[_0x25d8('0x2c')]['limit']);_0x57c331[_0x25d8('0x19')]=qs[_0x25d8('0x19')](_0x5af26c['query']['offset']);}_0x57c331[_0x25d8('0x35')]=qs[_0x25d8('0x36')](_0x5af26c[_0x25d8('0x2c')]['sort']);_0x57c331[_0x25d8('0x37')]=qs[_0x25d8('0x2e')](_['pick'](_0x5af26c['query'],_0x221f37[_0x25d8('0x2e')]),_0x4b3c2f);if(_0x5af26c['query'][_0x25d8('0x38')]){_0x57c331[_0x25d8('0x37')]=_[_0x25d8('0x39')](_0x57c331[_0x25d8('0x37')],{'$or':_[_0x25d8('0x3a')](_0x4b3c2f,function(_0x4eb4d6){if(_0x4eb4d6['type']!==_0x25d8('0x3b')){var _0x3b00c8={};_0x3b00c8[_0x4eb4d6[_0x25d8('0x25')]]={'$like':'%'+_0x5af26c[_0x25d8('0x2c')][_0x25d8('0x38')]+'%'};return _0x3b00c8;}})});}_0x57c331=_[_0x25d8('0x39')]({},_0x57c331,_0x5af26c[_0x25d8('0x3c')]);var _0x3c7287={'where':_0x57c331[_0x25d8('0x37')]};return db[_0x25d8('0x27')]['count'](_0x3c7287)[_0x25d8('0x23')](function(_0x5b3df2){_0x305c11[_0x25d8('0x1c')]=_0x5b3df2;if(_0x5af26c[_0x25d8('0x2c')][_0x25d8('0x3d')]){_0x57c331[_0x25d8('0x3e')]=[{'all':!![]}];}return db[_0x25d8('0x27')][_0x25d8('0x3f')](_0x57c331);})[_0x25d8('0x23')](function(_0x36cb13){_0x305c11['rows']=_0x36cb13;return _0x305c11;})[_0x25d8('0x23')](respondWithFilteredResult(_0x4e87d3,_0x57c331))[_0x25d8('0x40')](handleError(_0x4e87d3,null));};exports[_0x25d8('0x41')]=function(_0x3e9f82,_0x30a3f0){var _0x2b0903={'raw':!![],'where':{'id':_0x3e9f82[_0x25d8('0x42')]['id']}},_0x3fab03={};_0x3fab03['model']=_[_0x25d8('0x2d')](db[_0x25d8('0x27')][_0x25d8('0x28')]);_0x3fab03[_0x25d8('0x2c')]=_['keys'](_0x3e9f82[_0x25d8('0x2c')]);_0x3fab03[_0x25d8('0x2e')]=_[_0x25d8('0x2f')](_0x3fab03['model'],_0x3fab03['query']);_0x2b0903[_0x25d8('0x31')]=_[_0x25d8('0x2f')](_0x3fab03['model'],qs['fields'](_0x3e9f82['query'][_0x25d8('0x30')]));_0x2b0903[_0x25d8('0x31')]=_0x2b0903[_0x25d8('0x31')][_0x25d8('0x32')]?_0x2b0903[_0x25d8('0x31')]:_0x3fab03['model'];if(_0x3e9f82[_0x25d8('0x2c')][_0x25d8('0x3d')]){_0x2b0903['include']=[{'all':!![]}];}_0x2b0903=_[_0x25d8('0x39')]({},_0x2b0903,_0x3e9f82[_0x25d8('0x3c')]);return db[_0x25d8('0x27')][_0x25d8('0x43')](_0x2b0903)[_0x25d8('0x23')](handleEntityNotFound(_0x30a3f0,null))[_0x25d8('0x23')](respondWithResult(_0x30a3f0,null))[_0x25d8('0x40')](handleError(_0x30a3f0,null));};exports[_0x25d8('0x44')]=function(_0x480085,_0x37664d){return db[_0x25d8('0x27')]['create'](_0x480085['body'],{})[_0x25d8('0x23')](respondWithResult(_0x37664d,0xc9))['catch'](handleError(_0x37664d,null));};exports['update']=function(_0x326f12,_0x368e4f){if(_0x326f12['body']['id']){delete _0x326f12['body']['id'];}return db[_0x25d8('0x27')][_0x25d8('0x43')]({'where':{'id':_0x326f12[_0x25d8('0x42')]['id']}})[_0x25d8('0x23')](handleEntityNotFound(_0x368e4f,null))[_0x25d8('0x23')](saveUpdates(_0x326f12['body'],null))[_0x25d8('0x23')](respondWithResult(_0x368e4f,null))[_0x25d8('0x40')](handleError(_0x368e4f,null));};exports[_0x25d8('0x45')]=function(_0x33ea21,_0x32ad25){return db['VtigerField'][_0x25d8('0x43')]({'where':{'id':_0x33ea21[_0x25d8('0x42')]['id']}})['then'](handleEntityNotFound(_0x32ad25,null))[_0x25d8('0x23')](removeEntity(_0x32ad25,null))[_0x25d8('0x40')](handleError(_0x32ad25,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 5f04d66..8b1a143 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 _0xe3a4=['bluebird','request-promise','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','moment'];(function(_0x565f83,_0xe65b97){var _0x368f77=function(_0x10609a){while(--_0x10609a){_0x565f83['push'](_0x565f83['shift']());}};_0x368f77(++_0xe65b97);}(_0xe3a4,0x18f));var _0x4e3a=function(_0x21a13a,_0x1aad6b){_0x21a13a=_0x21a13a-0x0;var _0x8c7c7c=_0xe3a4[_0x21a13a];return _0x8c7c7c;};'use strict';var _=require(_0x4e3a('0x0'));var util=require(_0x4e3a('0x1'));var logger=require(_0x4e3a('0x2'))('api');var moment=require(_0x4e3a('0x3'));var BPromise=require(_0x4e3a('0x4'));var rp=require(_0x4e3a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e3a('0x6'));module[_0x4e3a('0x7')]=function(_0x365f71,_0x2281a7){return _0x365f71[_0x4e3a('0x8')](_0x4e3a('0x9'),attributes,{'tableName':_0x4e3a('0xa'),'paranoid':![],'indexes':[{'name':_0x4e3a('0xb'),'fields':['idField',_0x4e3a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb77d=['path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise'];(function(_0xb0f68a,_0x4b4011){var _0x370f1d=function(_0x5e846a){while(--_0x5e846a){_0xb0f68a['push'](_0xb0f68a['shift']());}};_0x370f1d(++_0x4b4011);}(_0xb77d,0x1e5));var _0xdb77=function(_0x36da2a,_0x139b77){_0x36da2a=_0x36da2a-0x0;var _0x457b21=_0xb77d[_0x36da2a];return _0x457b21;};'use strict';var _=require('lodash');var util=require(_0xdb77('0x0'));var logger=require(_0xdb77('0x1'))(_0xdb77('0x2'));var moment=require('moment');var BPromise=require(_0xdb77('0x3'));var rp=require(_0xdb77('0x4'));var fs=require('fs');var path=require(_0xdb77('0x5'));var rimraf=require(_0xdb77('0x6'));var config=require(_0xdb77('0x7'));var attributes=require(_0xdb77('0x8'));module[_0xdb77('0x9')]=function(_0x2644da,_0x58e2ff){return _0x2644da[_0xdb77('0xa')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xdb77('0xb'),'fields':[_0xdb77('0xc'),_0xdb77('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 2042c8b..79212c8 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 _0xc40c=['error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b8b95,_0x3ea343){var _0x3657ae=function(_0x3703e1){while(--_0x3703e1){_0x1b8b95['push'](_0x1b8b95['shift']());}};_0x3657ae(++_0x3ea343);}(_0xc40c,0x169));var _0xcc40=function(_0x3d563f,_0x277022){_0x3d563f=_0x3d563f-0x0;var _0x4272b0=_0xc40c[_0x3d563f];return _0x4272b0;};'use strict';var _=require('lodash');var util=require(_0xcc40('0x0'));var moment=require(_0xcc40('0x1'));var BPromise=require(_0xcc40('0x2'));var rs=require(_0xcc40('0x3'));var fs=require('fs');var Redis=require(_0xcc40('0x4'));var db=require(_0xcc40('0x5'))['db'];var utils=require(_0xcc40('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcc40('0x7'));var client=jayson[_0xcc40('0x8')][_0xcc40('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1074da,_0x4d5e2e,_0x2cd80f){return new BPromise(function(_0x34a618,_0x167f0c){return client[_0xcc40('0xa')](_0x1074da,_0x2cd80f)['then'](function(_0x2dae05){logger[_0xcc40('0xb')](_0xcc40('0xc'),_0x4d5e2e,_0xcc40('0xd'));logger[_0xcc40('0xe')](_0xcc40('0xf'),_0x4d5e2e,'request\x20sent',JSON[_0xcc40('0x10')](_0x2dae05));if(_0x2dae05['error']){if(_0x2dae05[_0xcc40('0x11')]['code']===0x1f4){logger[_0xcc40('0x11')](_0xcc40('0xc'),_0x4d5e2e,_0x2dae05['error']['message']);return _0x167f0c(_0x2dae05['error'][_0xcc40('0x12')]);}logger[_0xcc40('0x11')](_0xcc40('0xc'),_0x4d5e2e,_0x2dae05[_0xcc40('0x11')][_0xcc40('0x12')]);return _0x34a618(_0x2dae05[_0xcc40('0x11')]['message']);}else{logger[_0xcc40('0xb')](_0xcc40('0xc'),_0x4d5e2e,_0xcc40('0xd'));_0x34a618(_0x2dae05[_0xcc40('0x13')]['message']);}})[_0xcc40('0x14')](function(_0x3df6d0){logger['error']('VtigerField,\x20%s,\x20%s',_0x4d5e2e,_0x3df6d0);_0x167f0c(_0x3df6d0);});});} \ No newline at end of file +var _0x24f5=['stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3d46d2,_0x26464e){var _0x499bb6=function(_0x13a9ca){while(--_0x13a9ca){_0x3d46d2['push'](_0x3d46d2['shift']());}};_0x499bb6(++_0x26464e);}(_0x24f5,0x104));var _0x524f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x24f5[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x524f('0x0'));var util=require(_0x524f('0x1'));var moment=require(_0x524f('0x2'));var BPromise=require(_0x524f('0x3'));var rs=require(_0x524f('0x4'));var fs=require('fs');var Redis=require(_0x524f('0x5'));var db=require(_0x524f('0x6'))['db'];var utils=require(_0x524f('0x7'));var logger=require(_0x524f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x524f('0x9'));var client=jayson[_0x524f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x347d83,_0x28a907,_0x27f987){return new BPromise(function(_0x13ae3e,_0x379fa4){return client[_0x524f('0xb')](_0x347d83,_0x27f987)['then'](function(_0x3f969a){logger[_0x524f('0xc')]('VtigerField,\x20%s,\x20%s',_0x28a907,'request\x20sent');logger[_0x524f('0xd')](_0x524f('0xe'),_0x28a907,_0x524f('0xf'),JSON[_0x524f('0x10')](_0x3f969a));if(_0x3f969a[_0x524f('0x11')]){if(_0x3f969a[_0x524f('0x11')][_0x524f('0x12')]===0x1f4){logger[_0x524f('0x11')](_0x524f('0x13'),_0x28a907,_0x3f969a[_0x524f('0x11')][_0x524f('0x14')]);return _0x379fa4(_0x3f969a[_0x524f('0x11')][_0x524f('0x14')]);}logger[_0x524f('0x11')](_0x524f('0x13'),_0x28a907,_0x3f969a[_0x524f('0x11')][_0x524f('0x14')]);return _0x13ae3e(_0x3f969a[_0x524f('0x11')][_0x524f('0x14')]);}else{logger[_0x524f('0xc')](_0x524f('0x13'),_0x28a907,_0x524f('0xf'));_0x13ae3e(_0x3f969a[_0x524f('0x15')]['message']);}})[_0x524f('0x16')](function(_0x35d622){logger[_0x524f('0x11')]('VtigerField,\x20%s,\x20%s',_0x28a907,_0x35d622);_0x379fa4(_0x35d622);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index c992136..901de07 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 _0x3c72=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x666504,_0x3cc475){var _0x1d13ce=function(_0x4edad3){while(--_0x4edad3){_0x666504['push'](_0x666504['shift']());}};_0x1d13ce(++_0x3cc475);}(_0x3c72,0x1ee));var _0x23c7=function(_0x49d006,_0x1e332d){_0x49d006=_0x49d006-0x0;var _0x1b6909=_0x3c72[_0x49d006];return _0x1b6909;};'use strict';var multer=require(_0x23c7('0x0'));var util=require(_0x23c7('0x1'));var path=require(_0x23c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x23c7('0x3'));var router=express[_0x23c7('0x4')]();var fs_extra=require(_0x23c7('0x5'));var auth=require(_0x23c7('0x6'));var interaction=require(_0x23c7('0x7'));var config=require(_0x23c7('0x8'));var controller=require(_0x23c7('0x9'));router[_0x23c7('0xa')]('/',auth[_0x23c7('0xb')](),controller[_0x23c7('0xc')]);router[_0x23c7('0xa')](_0x23c7('0xd'),auth[_0x23c7('0xb')](),controller[_0x23c7('0xe')]);router['get'](_0x23c7('0xf'),auth[_0x23c7('0xb')](),controller[_0x23c7('0x10')]);router[_0x23c7('0xa')](_0x23c7('0x11'),auth[_0x23c7('0xb')](),controller[_0x23c7('0x12')]);router[_0x23c7('0x13')]('/',auth['isAuthenticated'](),controller[_0x23c7('0x14')]);router[_0x23c7('0x13')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x23c7('0xd'),auth[_0x23c7('0xb')](),controller[_0x23c7('0x15')]);router[_0x23c7('0x16')](_0x23c7('0xd'),auth['isAuthenticated'](),controller[_0x23c7('0x17')]);module[_0x23c7('0x18')]=router; \ No newline at end of file +var _0x5638=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id'];(function(_0x1c7f70,_0x16b1ca){var _0x5b4596=function(_0x52131c){while(--_0x52131c){_0x1c7f70['push'](_0x1c7f70['shift']());}};_0x5b4596(++_0x16b1ca);}(_0x5638,0xb3));var _0x8563=function(_0x142163,_0x148232){_0x142163=_0x142163-0x0;var _0x21abb2=_0x5638[_0x142163];return _0x21abb2;};'use strict';var multer=require(_0x8563('0x0'));var util=require(_0x8563('0x1'));var path=require(_0x8563('0x2'));var timeout=require('connect-timeout');var express=require(_0x8563('0x3'));var router=express[_0x8563('0x4')]();var fs_extra=require(_0x8563('0x5'));var auth=require(_0x8563('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8563('0x7'));var controller=require(_0x8563('0x8'));router['get']('/',auth[_0x8563('0x9')](),controller[_0x8563('0xa')]);router[_0x8563('0xb')](_0x8563('0xc'),auth[_0x8563('0x9')](),controller[_0x8563('0xd')]);router[_0x8563('0xb')](_0x8563('0xe'),auth[_0x8563('0x9')](),controller[_0x8563('0xf')]);router[_0x8563('0xb')](_0x8563('0x10'),auth['isAuthenticated'](),controller[_0x8563('0x11')]);router[_0x8563('0x12')]('/',auth[_0x8563('0x9')](),controller['create']);router['post'](_0x8563('0xe'),auth['isAuthenticated'](),controller[_0x8563('0x13')]);router['put'](_0x8563('0xc'),auth[_0x8563('0x9')](),controller[_0x8563('0x14')]);router[_0x8563('0x15')]('/:id',auth[_0x8563('0x9')](),controller[_0x8563('0x16')]);module[_0x8563('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1a4ccfe..117ea87 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 _0x002d=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token'];(function(_0x457610,_0x3f2dd0){var _0x2d2b67=function(_0x3ea299){while(--_0x3ea299){_0x457610['push'](_0x457610['shift']());}};_0x2d2b67(++_0x3f2dd0);}(_0x002d,0xca));var _0xd002=function(_0x219ddb,_0x73e299){_0x219ddb=_0x219ddb-0x0;var _0x3b8ee1=_0x002d[_0x219ddb];return _0x3b8ee1;};'use strict';var Sequelize=require(_0xd002('0x0'));module[_0xd002('0x1')]={'name':{'type':Sequelize[_0xd002('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xd002('0x3')},'password':{'type':Sequelize[_0xd002('0x2')]},'token':{'type':Sequelize[_0xd002('0x2')]},'remoteUri':{'type':Sequelize[_0xd002('0x2')],'unique':_0xd002('0x4')},'authType':{'type':Sequelize[_0xd002('0x5')](_0xd002('0x6'),_0xd002('0x7')),'defaultValue':_0xd002('0x6')},'serverUrl':{'type':Sequelize[_0xd002('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd002('0x5')](_0xd002('0x8'),_0xd002('0x9')),'defaultValue':_0xd002('0x8')}}; \ No newline at end of file +var _0x4317=['ENUM','password','integrationTab','newTab','exports','STRING','username','remoteUri'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4317,0x7c));var _0x7431=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x4317[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0x7431('0x0')]={'name':{'type':Sequelize[_0x7431('0x1')]},'description':{'type':Sequelize[_0x7431('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x7431('0x2')},'password':{'type':Sequelize[_0x7431('0x1')]},'token':{'type':Sequelize[_0x7431('0x1')]},'remoteUri':{'type':Sequelize[_0x7431('0x1')],'unique':_0x7431('0x3')},'authType':{'type':Sequelize[_0x7431('0x4')]('password','token'),'defaultValue':_0x7431('0x5')},'serverUrl':{'type':Sequelize[_0x7431('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7431('0x4')](_0x7431('0x6'),_0x7431('0x7')),'defaultValue':_0x7431('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 8dd45a0..4707451 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 _0x1c7c=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','name','send','index','map','ZendeskAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers','Unknown\x20authentication\x20type','subject','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x13b4d4,_0x4478c0){var _0x111749=function(_0xb0b090){while(--_0xb0b090){_0x13b4d4['push'](_0x13b4d4['shift']());}};_0x111749(++_0x4478c0);}(_0x1c7c,0x164));var _0xc1c7=function(_0x137a3e,_0x307f03){_0x137a3e=_0x137a3e-0x0;var _0x1d6072=_0x1c7c[_0x137a3e];return _0x1d6072;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];var integrations=require(_0xc1c7('0x1b'));function respondWithStatusCode(_0x376cab,_0x35feaa){_0x35feaa=_0x35feaa||0xcc;return function(_0x2dad6e){if(_0x2dad6e){return _0x376cab[_0xc1c7('0x1c')](_0x35feaa);}return _0x376cab[_0xc1c7('0x1d')](_0x35feaa)[_0xc1c7('0x1e')]();};}function respondWithResult(_0xdfc7d9,_0x1b6905){_0x1b6905=_0x1b6905||0xc8;return function(_0x99b874){if(_0x99b874){return _0xdfc7d9[_0xc1c7('0x1d')](_0x1b6905)['json'](_0x99b874);}};}function respondWithFilteredResult(_0x3e1f0e,_0x335600){return function(_0x21911c){if(_0x21911c){var _0x555b59=typeof _0x335600[_0xc1c7('0x1f')]===_0xc1c7('0x20')&&typeof _0x335600[_0xc1c7('0x21')]===_0xc1c7('0x20');var _0x20439e=_0x21911c[_0xc1c7('0x22')];var _0x21758a=_0x555b59?0x0:_0x335600[_0xc1c7('0x1f')];var _0x5d44e9=_0x555b59?_0x21911c[_0xc1c7('0x22')]:_0x335600[_0xc1c7('0x1f')]+_0x335600[_0xc1c7('0x21')];var _0x1bc9d;if(_0x5d44e9>=_0x20439e){_0x5d44e9=_0x20439e;_0x1bc9d=0xc8;}else{_0x1bc9d=0xce;}_0x3e1f0e['status'](_0x1bc9d);return _0x3e1f0e[_0xc1c7('0x23')]('Content-Range',_0x21758a+'-'+_0x5d44e9+'/'+_0x20439e)[_0xc1c7('0x24')](_0x21911c);}return null;};}function patchUpdates(_0x195c5f){return function(_0x567cd4){try{jsonpatch['apply'](_0x567cd4,_0x195c5f,!![]);}catch(_0x2d006f){return BPromise[_0xc1c7('0x25')](_0x2d006f);}return _0x567cd4[_0xc1c7('0x26')]();};}function saveUpdates(_0x4c6b34,_0x813853){return function(_0x341b41){if(_0x341b41){return _0x341b41[_0xc1c7('0x27')](_0x4c6b34)[_0xc1c7('0x28')](function(_0x2e64c4){return _0x2e64c4;});}return null;};}function removeEntity(_0x3a2483,_0x3180fd){return function(_0x120168){if(_0x120168){return _0x120168[_0xc1c7('0x29')]()[_0xc1c7('0x28')](function(){_0x3a2483[_0xc1c7('0x1d')](0xcc)[_0xc1c7('0x1e')]();});}};}function handleEntityNotFound(_0x33aac7,_0x260a3f){return function(_0xf1c405){if(!_0xf1c405){_0x33aac7[_0xc1c7('0x1c')](0x194);}return _0xf1c405;};}function handleError(_0x5edb34,_0xf0ab9c){_0xf0ab9c=_0xf0ab9c||0x1f4;return function(_0x13a1f9){logger['error'](_0x13a1f9['stack']);if(_0x13a1f9[_0xc1c7('0x2a')]){delete _0x13a1f9['name'];}_0x5edb34['status'](_0xf0ab9c)[_0xc1c7('0x2b')](_0x13a1f9);};}exports[_0xc1c7('0x2c')]=function(_0x46d045,_0x243450){var _0x461360={},_0x4adb81={},_0x574e1c={'count':0x0,'rows':[]};var _0x1b6f97=_[_0xc1c7('0x2d')](db[_0xc1c7('0x2e')][_0xc1c7('0x2f')],function(_0x2e35f1){return{'name':_0x2e35f1['fieldName'],'type':_0x2e35f1['type'][_0xc1c7('0x30')]};});_0x4adb81[_0xc1c7('0x31')]=_['map'](_0x1b6f97,_0xc1c7('0x2a'));_0x4adb81[_0xc1c7('0x32')]=_[_0xc1c7('0x33')](_0x46d045[_0xc1c7('0x32')]);_0x4adb81[_0xc1c7('0x34')]=_[_0xc1c7('0x35')](_0x4adb81[_0xc1c7('0x31')],_0x4adb81['query']);_0x461360[_0xc1c7('0x36')]=_[_0xc1c7('0x35')](_0x4adb81[_0xc1c7('0x31')],qs[_0xc1c7('0x37')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x37')]));_0x461360[_0xc1c7('0x36')]=_0x461360[_0xc1c7('0x36')][_0xc1c7('0x38')]?_0x461360['attributes']:_0x4adb81['model'];if(!_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x39')](_0xc1c7('0x3a'))){_0x461360[_0xc1c7('0x21')]=qs[_0xc1c7('0x21')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x21')]);_0x461360[_0xc1c7('0x1f')]=qs[_0xc1c7('0x1f')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x1f')]);}_0x461360[_0xc1c7('0x3b')]=qs[_0xc1c7('0x3c')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x3c')]);_0x461360[_0xc1c7('0x3d')]=qs[_0xc1c7('0x34')](_[_0xc1c7('0x3e')](_0x46d045[_0xc1c7('0x32')],_0x4adb81[_0xc1c7('0x34')]),_0x1b6f97);if(_0x46d045[_0xc1c7('0x32')]['filter']){_0x461360['where']=_['merge'](_0x461360[_0xc1c7('0x3d')],{'$or':_['map'](_0x1b6f97,function(_0x53bf70){if(_0x53bf70[_0xc1c7('0x3f')]!==_0xc1c7('0x40')){var _0x2cd728={};_0x2cd728[_0x53bf70[_0xc1c7('0x2a')]]={'$like':'%'+_0x46d045['query'][_0xc1c7('0x41')]+'%'};return _0x2cd728;}})});}_0x461360=_[_0xc1c7('0x42')]({},_0x461360,_0x46d045[_0xc1c7('0x43')]);var _0x3e5a61={'where':_0x461360[_0xc1c7('0x3d')]};return db[_0xc1c7('0x2e')][_0xc1c7('0x22')](_0x3e5a61)[_0xc1c7('0x28')](function(_0x1d4621){_0x574e1c[_0xc1c7('0x22')]=_0x1d4621;if(_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x44')]){_0x461360[_0xc1c7('0x45')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xc1c7('0x46')](_0x461360);})[_0xc1c7('0x28')](function(_0x508b32){_0x574e1c[_0xc1c7('0x47')]=_0x508b32;return _0x574e1c;})[_0xc1c7('0x28')](respondWithFilteredResult(_0x243450,_0x461360))[_0xc1c7('0x48')](handleError(_0x243450,null));};exports[_0xc1c7('0x49')]=function(_0x46a1b5,_0x2c09de){var _0xd5e06a={'raw':![],'where':{'id':_0x46a1b5[_0xc1c7('0x4a')]['id']}},_0x1e0248={};_0x1e0248[_0xc1c7('0x31')]=_['keys'](db[_0xc1c7('0x2e')][_0xc1c7('0x2f')]);_0x1e0248['query']=_['keys'](_0x46a1b5[_0xc1c7('0x32')]);_0x1e0248[_0xc1c7('0x34')]=_[_0xc1c7('0x35')](_0x1e0248[_0xc1c7('0x31')],_0x1e0248[_0xc1c7('0x32')]);_0xd5e06a['attributes']=_[_0xc1c7('0x35')](_0x1e0248[_0xc1c7('0x31')],qs['fields'](_0x46a1b5['query']['fields']));_0xd5e06a[_0xc1c7('0x36')]=_0xd5e06a[_0xc1c7('0x36')][_0xc1c7('0x38')]?_0xd5e06a['attributes']:_0x1e0248[_0xc1c7('0x31')];if(_0x46a1b5[_0xc1c7('0x32')]['includeAll']){_0xd5e06a[_0xc1c7('0x45')]=[{'all':!![]}];}_0xd5e06a=_[_0xc1c7('0x42')]({},_0xd5e06a,_0x46a1b5[_0xc1c7('0x43')]);return db[_0xc1c7('0x2e')][_0xc1c7('0x4b')](_0xd5e06a)[_0xc1c7('0x28')](handleEntityNotFound(_0x2c09de,null))[_0xc1c7('0x28')](respondWithResult(_0x2c09de,null))[_0xc1c7('0x48')](handleError(_0x2c09de,null));};exports[_0xc1c7('0x4c')]=function(_0x3ec5de,_0xa49f73){return db[_0xc1c7('0x2e')][_0xc1c7('0x4c')](_0x3ec5de[_0xc1c7('0x4d')],{})[_0xc1c7('0x28')](respondWithResult(_0xa49f73,0xc9))[_0xc1c7('0x48')](handleError(_0xa49f73,null));};exports[_0xc1c7('0x27')]=function(_0x1addc8,_0x5da115){if(_0x1addc8[_0xc1c7('0x4d')]['id']){delete _0x1addc8['body']['id'];}return db[_0xc1c7('0x2e')][_0xc1c7('0x4b')]({'where':{'id':_0x1addc8[_0xc1c7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5da115,null))[_0xc1c7('0x28')](saveUpdates(_0x1addc8[_0xc1c7('0x4d')],null))['then'](respondWithResult(_0x5da115,null))['catch'](handleError(_0x5da115,null));};exports['destroy']=function(_0x302185,_0x415416){return db['ZendeskAccount'][_0xc1c7('0x4b')]({'where':{'id':_0x302185[_0xc1c7('0x4a')]['id']}})[_0xc1c7('0x28')](handleEntityNotFound(_0x415416,null))[_0xc1c7('0x28')](removeEntity(_0x415416,null))[_0xc1c7('0x48')](handleError(_0x415416,null));};exports[_0xc1c7('0x4e')]=function(_0x4cad6a,_0x259e55,_0x568377){var _0x307b5e={};var _0x456ac1={};var _0x37dca9;var _0x557cb6;return db[_0xc1c7('0x2e')][_0xc1c7('0x4f')]({'where':{'id':_0x4cad6a[_0xc1c7('0x4a')]['id']}})[_0xc1c7('0x28')](handleEntityNotFound(_0x259e55,null))[_0xc1c7('0x28')](function(_0x45dfa2){if(_0x45dfa2){_0x37dca9=_0x45dfa2;_0x456ac1[_0xc1c7('0x31')]=_[_0xc1c7('0x33')](db['ZendeskConfiguration'][_0xc1c7('0x2f')]);_0x456ac1[_0xc1c7('0x32')]=_[_0xc1c7('0x33')](_0x4cad6a['query']);_0x456ac1['filters']=_[_0xc1c7('0x35')](_0x456ac1[_0xc1c7('0x31')],_0x456ac1[_0xc1c7('0x32')]);_0x307b5e['attributes']=_[_0xc1c7('0x35')](_0x456ac1['model'],qs[_0xc1c7('0x37')](_0x4cad6a[_0xc1c7('0x32')][_0xc1c7('0x37')]));_0x307b5e[_0xc1c7('0x36')]=_0x307b5e[_0xc1c7('0x36')][_0xc1c7('0x38')]?_0x307b5e[_0xc1c7('0x36')]:_0x456ac1['model'];_0x307b5e[_0xc1c7('0x3b')]=qs[_0xc1c7('0x3c')](_0x4cad6a[_0xc1c7('0x32')]['sort']);_0x307b5e[_0xc1c7('0x3d')]=qs['filters'](_[_0xc1c7('0x3e')](_0x4cad6a['query'],_0x456ac1[_0xc1c7('0x34')]));if(_0x4cad6a[_0xc1c7('0x32')][_0xc1c7('0x41')]){_0x307b5e[_0xc1c7('0x3d')]=_[_0xc1c7('0x42')](_0x307b5e['where'],{'$or':_['map'](_0x307b5e['attributes'],function(_0xbce766){var _0x28231b={};_0x28231b[_0xbce766]={'$like':'%'+_0x4cad6a[_0xc1c7('0x32')][_0xc1c7('0x41')]+'%'};return _0x28231b;})});}_0x307b5e=_[_0xc1c7('0x42')]({},_0x307b5e,_0x4cad6a[_0xc1c7('0x43')]);return _0x37dca9['getConfigurations'](_0x307b5e);}})[_0xc1c7('0x28')](function(_0xe5882){if(_0xe5882){_0x557cb6=_0xe5882[_0xc1c7('0x38')];if(!_0x4cad6a[_0xc1c7('0x32')]['hasOwnProperty'](_0xc1c7('0x3a'))){_0x307b5e[_0xc1c7('0x21')]=qs[_0xc1c7('0x21')](_0x4cad6a['query'][_0xc1c7('0x21')]);_0x307b5e[_0xc1c7('0x1f')]=qs[_0xc1c7('0x1f')](_0x4cad6a[_0xc1c7('0x32')]['offset']);}return _0x37dca9['getConfigurations'](_0x307b5e);}})[_0xc1c7('0x28')](function(_0x203790){if(_0x203790){return _0x203790?{'count':_0x557cb6,'rows':_0x203790}:null;}})['then'](respondWithResult(_0x259e55,null))[_0xc1c7('0x48')](handleError(_0x259e55,null));};exports[_0xc1c7('0x50')]=function(_0x4b27f5,_0x12aaac,_0x6eec68){if(_0x4b27f5['body']['id']){delete _0x4b27f5[_0xc1c7('0x4d')]['id'];}return db[_0xc1c7('0x2e')][_0xc1c7('0x4f')]({'where':{'id':_0x4b27f5[_0xc1c7('0x4a')]['id']}})[_0xc1c7('0x28')](handleEntityNotFound(_0x12aaac,null))[_0xc1c7('0x28')](function(_0x1ed9fc){if(_0x1ed9fc){_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x51')]=_0x1ed9fc['id'];_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x52')]=integrations[_0xc1c7('0x53')](_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x54')],_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x3f')]);_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x55')]=integrations[_0xc1c7('0x56')](_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x54')],_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x3f')]);return db[_0xc1c7('0x57')][_0xc1c7('0x4c')](_0x4b27f5[_0xc1c7('0x4d')],{'include':[{'model':db[_0xc1c7('0x58')],'as':_0xc1c7('0x52')},{'model':db['ZendeskField'],'as':_0xc1c7('0x55')}]});}return null;})[_0xc1c7('0x28')](respondWithResult(_0x12aaac,null))[_0xc1c7('0x48')](handleError(_0x12aaac,null));};exports[_0xc1c7('0x59')]=function(_0x268de7,_0x1cd622,_0x1ccd7d){var _0x29181f='';return db['ZendeskAccount'][_0xc1c7('0x4f')]({'where':{'id':_0x268de7[_0xc1c7('0x4a')]['id']},'attributes':['id',_0xc1c7('0x5a'),_0xc1c7('0x5b'),_0xc1c7('0x5c'),_0xc1c7('0x5d'),_0xc1c7('0x5e')]})[_0xc1c7('0x28')](handleEntityNotFound(_0x1cd622,null))['then'](function(_0x378f7f){if(_0x378f7f){_0x29181f=_0x378f7f[_0xc1c7('0x5e')];var _0x32ed03=_0x29181f[_0xc1c7('0x5f')](-0x1);if(_0x32ed03==='/'){_0x29181f=_0x29181f[_0xc1c7('0x60')](0x0,_0x29181f[_0xc1c7('0x61')](_0x32ed03));}var _0x426698={'method':_0xc1c7('0x62'),'uri':util[_0xc1c7('0x63')](_0xc1c7('0x64'),_0x29181f,_0xc1c7('0x65')),'json':!![]};switch(_0x378f7f[_0xc1c7('0x5d')]){case'password':_0x426698['headers']={'Authorization':util[_0xc1c7('0x63')](_0xc1c7('0x66'),new Buffer(util[_0xc1c7('0x63')](_0xc1c7('0x67'),_0x378f7f[_0xc1c7('0x5a')],_0x378f7f[_0xc1c7('0x5b')]))[_0xc1c7('0x68')](_0xc1c7('0x69')))};break;case _0xc1c7('0x5c'):_0x426698[_0xc1c7('0x6a')]={'Authorization':util[_0xc1c7('0x63')](_0xc1c7('0x66'),new Buffer(util[_0xc1c7('0x63')]('%s/token:%s',_0x378f7f[_0xc1c7('0x5a')],_0x378f7f[_0xc1c7('0x5c')]))[_0xc1c7('0x68')]('base64'))};break;default:throw new db['Sequelize']['ValidationError'](_0xc1c7('0x6b'));}return rp(_0x426698);}})[_0xc1c7('0x28')](function(_0x51dfb2){if(_0x51dfb2){var _0x1f2940=[_0xc1c7('0x6c'),'description','group','assignee'];_[_0xc1c7('0x6d')](_0x51dfb2['ticket_fields'],function(_0x219d44){return _0x1f2940[_0xc1c7('0x6e')](_0x219d44[_0xc1c7('0x3f')]);});return{'count':_0x51dfb2['ticket_fields'][_0xc1c7('0x38')],'rows':_['map'](_0x51dfb2[_0xc1c7('0x65')],function(_0x16832c){return{'id':_0x16832c['id'],'name':_0x16832c['position']>0x7?_0x16832c[_0xc1c7('0x6f')]:_0x16832c[_0xc1c7('0x3f')],'custom':_0x16832c[_0xc1c7('0x70')]>0x7?!![]:![],'options':_0x16832c[_0xc1c7('0x71')]?_0x16832c[_0xc1c7('0x71')]:_0x16832c[_0xc1c7('0x72')]?_0x16832c[_0xc1c7('0x72')]:[]};})};}})[_0xc1c7('0x28')](respondWithResult(_0x1cd622,null))[_0xc1c7('0x48')](function(_0x3eba33){var _0x4bb9bc=_0x268de7[_0xc1c7('0x32')][_0xc1c7('0x73')]?0x1f4:_0x3eba33[_0xc1c7('0x74')]||0x1f4;logger[_0xc1c7('0x75')]('getFields,\x20%s,\x20%s,\x20%s',_0xc1c7('0x59'),_0x4bb9bc,JSON[_0xc1c7('0x76')](_0x3eba33));delete _0x3eba33['name'];if(_0x4bb9bc===0x191){_0x4bb9bc=0x190;}_0x1cd622['status'](_0x4bb9bc)[_0xc1c7('0x2b')](_0x268de7[_0xc1c7('0x32')][_0xc1c7('0x73')]?{'message':_0xc1c7('0x77'),'statusCode':_0x3eba33[_0xc1c7('0x74')]}:_0x3eba33);});}; \ No newline at end of file +var _0xb62e=['custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','include','rows','catch','keys','rawAttributes','length','find','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','position','system_field_options'];(function(_0x45ac9f,_0x2d3db2){var _0x3c0d14=function(_0x1e1caa){while(--_0x1e1caa){_0x45ac9f['push'](_0x45ac9f['shift']());}};_0x3c0d14(++_0x2d3db2);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb62('0x1b'));function respondWithStatusCode(_0xcc11c4,_0x27671e){_0x27671e=_0x27671e||0xcc;return function(_0x6822bc){if(_0x6822bc){return _0xcc11c4['sendStatus'](_0x27671e);}return _0xcc11c4[_0xeb62('0x1c')](_0x27671e)[_0xeb62('0x1d')]();};}function respondWithResult(_0x23fb15,_0x4da178){_0x4da178=_0x4da178||0xc8;return function(_0x26c3fd){if(_0x26c3fd){return _0x23fb15[_0xeb62('0x1c')](_0x4da178)[_0xeb62('0x1e')](_0x26c3fd);}};}function respondWithFilteredResult(_0x4ce9fa,_0x1f6a1f){return function(_0x15b3e8){if(_0x15b3e8){var _0x184106=typeof _0x1f6a1f[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x1f6a1f[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1324d7=_0x15b3e8[_0xeb62('0x22')];var _0x27fd84=_0x184106?0x0:_0x1f6a1f[_0xeb62('0x1f')];var _0x11d516=_0x184106?_0x15b3e8[_0xeb62('0x22')]:_0x1f6a1f['offset']+_0x1f6a1f[_0xeb62('0x21')];var _0x130e2f;if(_0x11d516>=_0x1324d7){_0x11d516=_0x1324d7;_0x130e2f=0xc8;}else{_0x130e2f=0xce;}_0x4ce9fa[_0xeb62('0x1c')](_0x130e2f);return _0x4ce9fa[_0xeb62('0x23')](_0xeb62('0x24'),_0x27fd84+'-'+_0x11d516+'/'+_0x1324d7)[_0xeb62('0x1e')](_0x15b3e8);}return null;};}function patchUpdates(_0x2ed96d){return function(_0x589bf2){try{jsonpatch['apply'](_0x589bf2,_0x2ed96d,!![]);}catch(_0x1fbfaa){return BPromise[_0xeb62('0x25')](_0x1fbfaa);}return _0x589bf2[_0xeb62('0x26')]();};}function saveUpdates(_0x13243f,_0x122b15){return function(_0x4cafcf){if(_0x4cafcf){return _0x4cafcf['update'](_0x13243f)[_0xeb62('0x27')](function(_0x132861){return _0x132861;});}return null;};}function removeEntity(_0x182781,_0x395b70){return function(_0x55a169){if(_0x55a169){return _0x55a169['destroy']()[_0xeb62('0x27')](function(){_0x182781['status'](0xcc)[_0xeb62('0x1d')]();});}};}function handleEntityNotFound(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(!_0x516a72){_0x4b0f46[_0xeb62('0x28')](0x194);}return _0x516a72;};}function handleError(_0x6bfbbc,_0x46d1bb){_0x46d1bb=_0x46d1bb||0x1f4;return function(_0x4e4268){logger[_0xeb62('0x29')](_0x4e4268[_0xeb62('0x2a')]);if(_0x4e4268[_0xeb62('0x2b')]){delete _0x4e4268[_0xeb62('0x2b')];}_0x6bfbbc[_0xeb62('0x1c')](_0x46d1bb)[_0xeb62('0x2c')](_0x4e4268);};}exports['index']=function(_0x192517,_0x1616ee){var _0x57169a={},_0x157474={},_0x2b51b2={'count':0x0,'rows':[]};var _0x2c967c=_[_0xeb62('0x2d')](db[_0xeb62('0x2e')]['rawAttributes'],function(_0x4b58af){return{'name':_0x4b58af[_0xeb62('0x2f')],'type':_0x4b58af[_0xeb62('0x30')][_0xeb62('0x31')]};});_0x157474[_0xeb62('0x32')]=_[_0xeb62('0x2d')](_0x2c967c,_0xeb62('0x2b'));_0x157474[_0xeb62('0x33')]=_['keys'](_0x192517[_0xeb62('0x33')]);_0x157474['filters']=_['intersection'](_0x157474[_0xeb62('0x32')],_0x157474[_0xeb62('0x33')]);_0x57169a['attributes']=_[_0xeb62('0x34')](_0x157474['model'],qs[_0xeb62('0x35')](_0x192517[_0xeb62('0x33')]['fields']));_0x57169a[_0xeb62('0x36')]=_0x57169a[_0xeb62('0x36')]['length']?_0x57169a[_0xeb62('0x36')]:_0x157474[_0xeb62('0x32')];if(!_0x192517[_0xeb62('0x33')][_0xeb62('0x37')]('nolimit')){_0x57169a[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x192517['query']['limit']);_0x57169a[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x192517['query'][_0xeb62('0x1f')]);}_0x57169a[_0xeb62('0x38')]=qs[_0xeb62('0x39')](_0x192517[_0xeb62('0x33')][_0xeb62('0x39')]);_0x57169a[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_['pick'](_0x192517['query'],_0x157474[_0xeb62('0x3b')]),_0x2c967c);if(_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x57169a[_0xeb62('0x3a')]=_['merge'](_0x57169a[_0xeb62('0x3a')],{'$or':_['map'](_0x2c967c,function(_0x20fd7a){if(_0x20fd7a[_0xeb62('0x30')]!==_0xeb62('0x3d')){var _0x136c5a={};_0x136c5a[_0x20fd7a[_0xeb62('0x2b')]]={'$like':'%'+_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x136c5a;}})});}_0x57169a=_[_0xeb62('0x3e')]({},_0x57169a,_0x192517['options']);var _0x38f91b={'where':_0x57169a[_0xeb62('0x3a')]};return db[_0xeb62('0x2e')][_0xeb62('0x22')](_0x38f91b)['then'](function(_0x4eda8b){_0x2b51b2[_0xeb62('0x22')]=_0x4eda8b;if(_0x192517[_0xeb62('0x33')]['includeAll']){_0x57169a[_0xeb62('0x3f')]=[{'all':!![]}];}return db[_0xeb62('0x2e')]['findAll'](_0x57169a);})[_0xeb62('0x27')](function(_0x478a54){_0x2b51b2[_0xeb62('0x40')]=_0x478a54;return _0x2b51b2;})['then'](respondWithFilteredResult(_0x1616ee,_0x57169a))[_0xeb62('0x41')](handleError(_0x1616ee,null));};exports['show']=function(_0x2bf77f,_0x609b2d){var _0x317f50={'raw':![],'where':{'id':_0x2bf77f['params']['id']}},_0x594274={};_0x594274[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x2e')][_0xeb62('0x43')]);_0x594274[_0xeb62('0x33')]=_['keys'](_0x2bf77f[_0xeb62('0x33')]);_0x594274['filters']=_[_0xeb62('0x34')](_0x594274['model'],_0x594274[_0xeb62('0x33')]);_0x317f50['attributes']=_[_0xeb62('0x34')](_0x594274['model'],qs[_0xeb62('0x35')](_0x2bf77f[_0xeb62('0x33')][_0xeb62('0x35')]));_0x317f50[_0xeb62('0x36')]=_0x317f50[_0xeb62('0x36')][_0xeb62('0x44')]?_0x317f50['attributes']:_0x594274[_0xeb62('0x32')];if(_0x2bf77f[_0xeb62('0x33')]['includeAll']){_0x317f50['include']=[{'all':!![]}];}_0x317f50=_['merge']({},_0x317f50,_0x2bf77f['options']);return db[_0xeb62('0x2e')][_0xeb62('0x45')](_0x317f50)['then'](handleEntityNotFound(_0x609b2d,null))[_0xeb62('0x27')](respondWithResult(_0x609b2d,null))[_0xeb62('0x41')](handleError(_0x609b2d,null));};exports[_0xeb62('0x46')]=function(_0x16e262,_0x39595c){return db['ZendeskAccount'][_0xeb62('0x46')](_0x16e262['body'],{})[_0xeb62('0x27')](respondWithResult(_0x39595c,0xc9))[_0xeb62('0x41')](handleError(_0x39595c,null));};exports[_0xeb62('0x47')]=function(_0x18c40d,_0x1f2d87){if(_0x18c40d[_0xeb62('0x48')]['id']){delete _0x18c40d[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x45')]({'where':{'id':_0x18c40d[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x1f2d87,null))[_0xeb62('0x27')](saveUpdates(_0x18c40d['body'],null))[_0xeb62('0x27')](respondWithResult(_0x1f2d87,null))['catch'](handleError(_0x1f2d87,null));};exports['destroy']=function(_0x2dcb2d,_0x31fd4a){return db['ZendeskAccount'][_0xeb62('0x45')]({'where':{'id':_0x2dcb2d[_0xeb62('0x49')]['id']}})['then'](handleEntityNotFound(_0x31fd4a,null))[_0xeb62('0x27')](removeEntity(_0x31fd4a,null))[_0xeb62('0x41')](handleError(_0x31fd4a,null));};exports[_0xeb62('0x4a')]=function(_0x60617,_0xe71e83,_0x1e6238){var _0x351027={};var _0x190e65={};var _0x497714;var _0x3e2be9;return db['ZendeskAccount'][_0xeb62('0x4b')]({'where':{'id':_0x60617[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0xe71e83,null))[_0xeb62('0x27')](function(_0x35d92d){if(_0x35d92d){_0x497714=_0x35d92d;_0x190e65[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x4c')]['rawAttributes']);_0x190e65['query']=_['keys'](_0x60617['query']);_0x190e65[_0xeb62('0x3b')]=_['intersection'](_0x190e65[_0xeb62('0x32')],_0x190e65['query']);_0x351027[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x190e65[_0xeb62('0x32')],qs['fields'](_0x60617[_0xeb62('0x33')][_0xeb62('0x35')]));_0x351027['attributes']=_0x351027[_0xeb62('0x36')][_0xeb62('0x44')]?_0x351027[_0xeb62('0x36')]:_0x190e65[_0xeb62('0x32')];_0x351027['order']=qs[_0xeb62('0x39')](_0x60617[_0xeb62('0x33')]['sort']);_0x351027[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_[_0xeb62('0x4d')](_0x60617[_0xeb62('0x33')],_0x190e65[_0xeb62('0x3b')]));if(_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x351027[_0xeb62('0x3a')]=_[_0xeb62('0x3e')](_0x351027[_0xeb62('0x3a')],{'$or':_[_0xeb62('0x2d')](_0x351027[_0xeb62('0x36')],function(_0x200b43){var _0x3ae984={};_0x3ae984[_0x200b43]={'$like':'%'+_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x3ae984;})});}_0x351027=_['merge']({},_0x351027,_0x60617['options']);return _0x497714['getConfigurations'](_0x351027);}})['then'](function(_0x279b83){if(_0x279b83){_0x3e2be9=_0x279b83['length'];if(!_0x60617[_0xeb62('0x33')][_0xeb62('0x37')](_0xeb62('0x4e'))){_0x351027[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x60617[_0xeb62('0x33')][_0xeb62('0x21')]);_0x351027[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x60617[_0xeb62('0x33')]['offset']);}return _0x497714[_0xeb62('0x4a')](_0x351027);}})[_0xeb62('0x27')](function(_0x42e992){if(_0x42e992){return _0x42e992?{'count':_0x3e2be9,'rows':_0x42e992}:null;}})[_0xeb62('0x27')](respondWithResult(_0xe71e83,null))['catch'](handleError(_0xe71e83,null));};exports[_0xeb62('0x4f')]=function(_0x2e5456,_0x3ff00a,_0x2abd21){if(_0x2e5456[_0xeb62('0x48')]['id']){delete _0x2e5456[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x2e5456[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x3ff00a,null))[_0xeb62('0x27')](function(_0x510275){if(_0x510275){_0x2e5456[_0xeb62('0x48')][_0xeb62('0x50')]=_0x510275['id'];_0x2e5456[_0xeb62('0x48')][_0xeb62('0x51')]=integrations[_0xeb62('0x52')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')][_0xeb62('0x30')]);_0x2e5456[_0xeb62('0x48')]['Descriptions']=integrations[_0xeb62('0x54')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')]['type']);return db[_0xeb62('0x4c')][_0xeb62('0x46')](_0x2e5456[_0xeb62('0x48')],{'include':[{'model':db[_0xeb62('0x55')],'as':_0xeb62('0x51')},{'model':db[_0xeb62('0x55')],'as':'Descriptions'}]});}return null;})[_0xeb62('0x27')](respondWithResult(_0x3ff00a,null))[_0xeb62('0x41')](handleError(_0x3ff00a,null));};exports[_0xeb62('0x56')]=function(_0x173c07,_0x351acf,_0x28d0ff){var _0x2e4502='';return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x173c07[_0xeb62('0x49')]['id']},'attributes':['id',_0xeb62('0x57'),_0xeb62('0x58'),_0xeb62('0x59'),_0xeb62('0x5a'),_0xeb62('0x5b')]})[_0xeb62('0x27')](handleEntityNotFound(_0x351acf,null))['then'](function(_0x3b3eb1){if(_0x3b3eb1){_0x2e4502=_0x3b3eb1['remoteUri'];var _0x6ea297=_0x2e4502[_0xeb62('0x5c')](-0x1);if(_0x6ea297==='/'){_0x2e4502=_0x2e4502['substring'](0x0,_0x2e4502[_0xeb62('0x5d')](_0x6ea297));}var _0x10986a={'method':_0xeb62('0x5e'),'uri':util[_0xeb62('0x5f')](_0xeb62('0x60'),_0x2e4502,_0xeb62('0x61')),'json':!![]};switch(_0x3b3eb1[_0xeb62('0x5a')]){case _0xeb62('0x58'):_0x10986a[_0xeb62('0x62')]={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x64'),_0x3b3eb1['username'],_0x3b3eb1[_0xeb62('0x58')]))[_0xeb62('0x65')]('base64'))};break;case _0xeb62('0x59'):_0x10986a['headers']={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x66'),_0x3b3eb1[_0xeb62('0x57')],_0x3b3eb1[_0xeb62('0x59')]))['toString'](_0xeb62('0x67')))};break;default:throw new db['Sequelize'][(_0xeb62('0x68'))](_0xeb62('0x69'));}return rp(_0x10986a);}})[_0xeb62('0x27')](function(_0x489410){if(_0x489410){var _0x1dcd96=['subject',_0xeb62('0x6a'),_0xeb62('0x6b'),_0xeb62('0x6c')];_['remove'](_0x489410[_0xeb62('0x61')],function(_0x3ad496){return _0x1dcd96[_0xeb62('0x6d')](_0x3ad496[_0xeb62('0x30')]);});return{'count':_0x489410[_0xeb62('0x61')][_0xeb62('0x44')],'rows':_['map'](_0x489410['ticket_fields'],function(_0x4c7a56){return{'id':_0x4c7a56['id'],'name':_0x4c7a56['position']>0x7?_0x4c7a56['title']:_0x4c7a56[_0xeb62('0x30')],'custom':_0x4c7a56[_0xeb62('0x6e')]>0x7?!![]:![],'options':_0x4c7a56[_0xeb62('0x6f')]?_0x4c7a56[_0xeb62('0x6f')]:_0x4c7a56[_0xeb62('0x70')]?_0x4c7a56[_0xeb62('0x70')]:[]};})};}})[_0xeb62('0x27')](respondWithResult(_0x351acf,null))[_0xeb62('0x41')](function(_0xb28adb){var _0x2c6bb3=_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?0x1f4:_0xb28adb['statusCode']||0x1f4;logger[_0xeb62('0x29')](_0xeb62('0x72'),_0xeb62('0x56'),_0x2c6bb3,JSON[_0xeb62('0x73')](_0xb28adb));delete _0xb28adb[_0xeb62('0x2b')];if(_0x2c6bb3===0x191){_0x2c6bb3=0x190;}_0x351acf[_0xeb62('0x1c')](_0x2c6bb3)[_0xeb62('0x2c')](_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?{'message':_0xeb62('0x74'),'statusCode':_0xb28adb[_0xeb62('0x75')]}:_0xb28adb);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 2d1b34e..0d84485 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 _0xf03b=['request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x52ac27,_0x8776c8){var _0x40732e=function(_0x32b6c9){while(--_0x32b6c9){_0x52ac27['push'](_0x52ac27['shift']());}};_0x40732e(++_0x8776c8);}(_0xf03b,0x19f));var _0xbf03=function(_0x548696,_0x41c876){_0x548696=_0x548696-0x0;var _0x23114d=_0xf03b[_0x548696];return _0x23114d;};'use strict';var _=require(_0xbf03('0x0'));var util=require(_0xbf03('0x1'));var logger=require(_0xbf03('0x2'))(_0xbf03('0x3'));var moment=require('moment');var BPromise=require(_0xbf03('0x4'));var rp=require(_0xbf03('0x5'));var fs=require('fs');var path=require(_0xbf03('0x6'));var rimraf=require(_0xbf03('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf03('0x8'));var integrations=require(_0xbf03('0x9'));module[_0xbf03('0xa')]=function(_0xcf8b9,_0x10272e){return _0xcf8b9[_0xbf03('0xb')](_0xbf03('0xc'),attributes,{'tableName':_0xbf03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11f5=['path','../../components/integrations/configuration','define','ZendeskAccount','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2f6651,_0x1c19e8){var _0x4cf9ee=function(_0x1b1b7a){while(--_0x1b1b7a){_0x2f6651['push'](_0x2f6651['shift']());}};_0x4cf9ee(++_0x1c19e8);}(_0x11f5,0x1ee));var _0x511f=function(_0x32a3cc,_0x27e38a){_0x32a3cc=_0x32a3cc-0x0;var _0xc38659=_0x11f5[_0x32a3cc];return _0xc38659;};'use strict';var _=require(_0x511f('0x0'));var util=require('util');var logger=require(_0x511f('0x1'))(_0x511f('0x2'));var moment=require(_0x511f('0x3'));var BPromise=require(_0x511f('0x4'));var rp=require(_0x511f('0x5'));var fs=require('fs');var path=require(_0x511f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x511f('0x7'));module['exports']=function(_0x24a5f0,_0x253216){return _0x24a5f0[_0x511f('0x8')](_0x511f('0x9'),attributes,{'tableName':'int_zendesk_accounts','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 87f7005..468b316 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 _0xdedd=['findAll','options','raw','where','attributes','limit','include','model','map','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xdedd,0x197));var _0xdded=function(_0xa87159,_0x984d70){_0xa87159=_0xa87159-0x0;var _0x3aa3f9=_0xdedd[_0xa87159];return _0x3aa3f9;};'use strict';var _=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var moment=require(_0xdded('0x2'));var BPromise=require(_0xdded('0x3'));var rs=require(_0xdded('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdded('0x5'))['db'];var utils=require(_0xdded('0x6'));var logger=require(_0xdded('0x7'))(_0xdded('0x8'));var config=require(_0xdded('0x9'));var jayson=require(_0xdded('0xa'));var client=jayson[_0xdded('0xb')][_0xdded('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59aa13,_0x5a43e7,_0x558cff){return new BPromise(function(_0x224a4d,_0x4a2516){return client['request'](_0x59aa13,_0x558cff)[_0xdded('0xd')](function(_0x1a183f){logger[_0xdded('0xe')](_0xdded('0xf'),_0x5a43e7,'request\x20sent');logger[_0xdded('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x5a43e7,_0xdded('0x11'),JSON[_0xdded('0x12')](_0x1a183f));if(_0x1a183f[_0xdded('0x13')]){if(_0x1a183f[_0xdded('0x13')][_0xdded('0x14')]===0x1f4){logger[_0xdded('0x13')](_0xdded('0xf'),_0x5a43e7,_0x1a183f[_0xdded('0x13')][_0xdded('0x15')]);return _0x4a2516(_0x1a183f['error'][_0xdded('0x15')]);}logger[_0xdded('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x5a43e7,_0x1a183f[_0xdded('0x13')]['message']);return _0x224a4d(_0x1a183f[_0xdded('0x13')]['message']);}else{logger[_0xdded('0xe')](_0xdded('0xf'),_0x5a43e7,_0xdded('0x11'));_0x224a4d(_0x1a183f['result'][_0xdded('0x15')]);}})[_0xdded('0x16')](function(_0x2ef523){logger[_0xdded('0x13')](_0xdded('0xf'),_0x5a43e7,_0x2ef523);_0x4a2516(_0x2ef523);});});}exports[_0xdded('0x17')]=function(_0x323c30){var _0x436ee9=this;return new Promise(function(_0x4f249e,_0x3380b7){return db[_0xdded('0x18')][_0xdded('0x19')]({'raw':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1b')]===undefined?!![]:![]:!![],'where':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1c')]||null:null,'attributes':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1d')]||null:null,'limit':_0x323c30[_0xdded('0x1a')]?_0x323c30['options'][_0xdded('0x1e')]||null:null,'include':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1f')]?_['map'](_0x323c30[_0xdded('0x1a')]['include'],function(_0x223048){return{'model':db[_0x223048[_0xdded('0x20')]],'as':_0x223048['as'],'attributes':_0x223048[_0xdded('0x1d')],'include':_0x223048[_0xdded('0x1f')]?_[_0xdded('0x21')](_0x223048['include'],function(_0x1c5025){return{'model':db[_0x1c5025[_0xdded('0x20')]],'as':_0x1c5025['as'],'attributes':_0x1c5025[_0xdded('0x1d')],'include':_0x1c5025[_0xdded('0x1f')]?_[_0xdded('0x21')](_0x1c5025['include'],function(_0x5e2dfb){return{'model':db[_0x5e2dfb[_0xdded('0x20')]],'as':_0x5e2dfb['as'],'attributes':_0x5e2dfb[_0xdded('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdded('0xd')](function(_0x4358f6){logger[_0xdded('0xe')]('GetZendeskAccount',_0x323c30);logger[_0xdded('0x10')](_0xdded('0x17'),_0x323c30,JSON[_0xdded('0x12')](_0x4358f6));_0x4f249e(_0x4358f6);})[_0xdded('0x16')](function(_0x560dca){logger[_0xdded('0x13')]('GetZendeskAccount',_0x560dca[_0xdded('0x15')],_0x323c30);_0x3380b7(_0x436ee9[_0xdded('0x13')](0x1f4,_0x560dca[_0xdded('0x15')]));});});};exports[_0xdded('0x22')]=function(_0xf193a8){var _0x3459c7=this;return new Promise(function(_0xdf0051,_0x49d098){return db[_0xdded('0x18')][_0xdded('0x23')]({'raw':_0xf193a8['options']?_0xf193a8[_0xdded('0x1a')][_0xdded('0x1b')]===undefined?!![]:![]:!![],'where':_0xf193a8['options']?_0xf193a8['options']['where']||null:null,'attributes':_0xf193a8['options']?_0xf193a8[_0xdded('0x1a')][_0xdded('0x1d')]||null:null,'include':_0xf193a8[_0xdded('0x1a')]?_0xf193a8[_0xdded('0x1a')][_0xdded('0x1f')]?_[_0xdded('0x21')](_0xf193a8[_0xdded('0x1a')]['include'],function(_0x39c0e5){return{'model':db[_0x39c0e5[_0xdded('0x20')]],'as':_0x39c0e5['as'],'attributes':_0x39c0e5[_0xdded('0x1d')],'include':_0x39c0e5[_0xdded('0x1f')]?_[_0xdded('0x21')](_0x39c0e5[_0xdded('0x1f')],function(_0x560d51){return{'model':db[_0x560d51[_0xdded('0x20')]],'as':_0x560d51['as'],'attributes':_0x560d51[_0xdded('0x1d')],'include':_0x560d51[_0xdded('0x1f')]?_['map'](_0x560d51[_0xdded('0x1f')],function(_0x31f602){return{'model':db[_0x31f602['model']],'as':_0x31f602['as'],'attributes':_0x31f602[_0xdded('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdded('0xd')](function(_0x382a48){logger[_0xdded('0xe')](_0xdded('0x22'),_0xf193a8);logger[_0xdded('0x10')](_0xdded('0x22'),_0xf193a8,JSON[_0xdded('0x12')](_0x382a48));_0xdf0051(_0x382a48);})[_0xdded('0x16')](function(_0x4242b5){logger[_0xdded('0x13')](_0xdded('0x22'),_0x4242b5['message'],_0xf193a8);_0x49d098(_0x3459c7['error'](0x1f4,_0x4242b5[_0xdded('0x15')]));});});}; \ No newline at end of file +var _0x4b2e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowZendeskAccount','lodash','util'];(function(_0x2cd27b,_0x49c7ec){var _0x2fee4d=function(_0x202526){while(--_0x202526){_0x2cd27b['push'](_0x2cd27b['shift']());}};_0x2fee4d(++_0x49c7ec);}(_0x4b2e,0x1ec));var _0xe4b2=function(_0x4de56d,_0x4fcb24){_0x4de56d=_0x4de56d-0x0;var _0x29c984=_0x4b2e[_0x4de56d];return _0x29c984;};'use strict';var _=require(_0xe4b2('0x0'));var util=require(_0xe4b2('0x1'));var moment=require(_0xe4b2('0x2'));var BPromise=require(_0xe4b2('0x3'));var rs=require(_0xe4b2('0x4'));var fs=require('fs');var Redis=require(_0xe4b2('0x5'));var db=require(_0xe4b2('0x6'))['db'];var utils=require(_0xe4b2('0x7'));var logger=require(_0xe4b2('0x8'))(_0xe4b2('0x9'));var config=require(_0xe4b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe4b2('0xb')][_0xe4b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x566045,_0xeb41bc,_0xa7d655){return new BPromise(function(_0x4109ae,_0xe355b6){return client[_0xe4b2('0xd')](_0x566045,_0xa7d655)[_0xe4b2('0xe')](function(_0x486fd5){logger[_0xe4b2('0xf')](_0xe4b2('0x10'),_0xeb41bc,_0xe4b2('0x11'));logger[_0xe4b2('0x12')](_0xe4b2('0x13'),_0xeb41bc,_0xe4b2('0x11'),JSON[_0xe4b2('0x14')](_0x486fd5));if(_0x486fd5[_0xe4b2('0x15')]){if(_0x486fd5[_0xe4b2('0x15')][_0xe4b2('0x16')]===0x1f4){logger[_0xe4b2('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0xeb41bc,_0x486fd5[_0xe4b2('0x15')][_0xe4b2('0x17')]);return _0xe355b6(_0x486fd5[_0xe4b2('0x15')][_0xe4b2('0x17')]);}logger['error'](_0xe4b2('0x10'),_0xeb41bc,_0x486fd5[_0xe4b2('0x15')]['message']);return _0x4109ae(_0x486fd5[_0xe4b2('0x15')]['message']);}else{logger[_0xe4b2('0xf')](_0xe4b2('0x10'),_0xeb41bc,'request\x20sent');_0x4109ae(_0x486fd5[_0xe4b2('0x18')][_0xe4b2('0x17')]);}})['catch'](function(_0x15ed3d){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0xeb41bc,_0x15ed3d);_0xe355b6(_0x15ed3d);});});}exports[_0xe4b2('0x19')]=function(_0x5f585e){var _0x2f271e=this;return new Promise(function(_0x2d5d06,_0x2ac137){return db[_0xe4b2('0x1a')][_0xe4b2('0x1b')]({'raw':_0x5f585e['options']?_0x5f585e['options'][_0xe4b2('0x1c')]===undefined?!![]:![]:!![],'where':_0x5f585e['options']?_0x5f585e[_0xe4b2('0x1d')][_0xe4b2('0x1e')]||null:null,'attributes':_0x5f585e[_0xe4b2('0x1d')]?_0x5f585e['options'][_0xe4b2('0x1f')]||null:null,'limit':_0x5f585e[_0xe4b2('0x1d')]?_0x5f585e[_0xe4b2('0x1d')][_0xe4b2('0x20')]||null:null,'include':_0x5f585e[_0xe4b2('0x1d')]?_0x5f585e[_0xe4b2('0x1d')][_0xe4b2('0x21')]?_[_0xe4b2('0x22')](_0x5f585e['options'][_0xe4b2('0x21')],function(_0x84511f){return{'model':db[_0x84511f[_0xe4b2('0x23')]],'as':_0x84511f['as'],'attributes':_0x84511f[_0xe4b2('0x1f')],'include':_0x84511f['include']?_['map'](_0x84511f[_0xe4b2('0x21')],function(_0xfb51c8){return{'model':db[_0xfb51c8[_0xe4b2('0x23')]],'as':_0xfb51c8['as'],'attributes':_0xfb51c8[_0xe4b2('0x1f')],'include':_0xfb51c8[_0xe4b2('0x21')]?_['map'](_0xfb51c8[_0xe4b2('0x21')],function(_0x1a995b){return{'model':db[_0x1a995b[_0xe4b2('0x23')]],'as':_0x1a995b['as'],'attributes':_0x1a995b[_0xe4b2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe4b2('0xe')](function(_0x4f9019){logger[_0xe4b2('0xf')](_0xe4b2('0x19'),_0x5f585e);logger['debug'](_0xe4b2('0x19'),_0x5f585e,JSON['stringify'](_0x4f9019));_0x2d5d06(_0x4f9019);})[_0xe4b2('0x24')](function(_0x18f564){logger[_0xe4b2('0x15')]('GetZendeskAccount',_0x18f564[_0xe4b2('0x17')],_0x5f585e);_0x2ac137(_0x2f271e['error'](0x1f4,_0x18f564[_0xe4b2('0x17')]));});});};exports['ShowZendeskAccount']=function(_0x3f8d41){var _0x1f3af0=this;return new Promise(function(_0x4de692,_0x467e58){return db[_0xe4b2('0x1a')]['find']({'raw':_0x3f8d41[_0xe4b2('0x1d')]?_0x3f8d41[_0xe4b2('0x1d')][_0xe4b2('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f8d41[_0xe4b2('0x1d')]?_0x3f8d41[_0xe4b2('0x1d')]['where']||null:null,'attributes':_0x3f8d41[_0xe4b2('0x1d')]?_0x3f8d41[_0xe4b2('0x1d')][_0xe4b2('0x1f')]||null:null,'include':_0x3f8d41[_0xe4b2('0x1d')]?_0x3f8d41[_0xe4b2('0x1d')][_0xe4b2('0x21')]?_[_0xe4b2('0x22')](_0x3f8d41[_0xe4b2('0x1d')][_0xe4b2('0x21')],function(_0x3f343e){return{'model':db[_0x3f343e[_0xe4b2('0x23')]],'as':_0x3f343e['as'],'attributes':_0x3f343e[_0xe4b2('0x1f')],'include':_0x3f343e['include']?_[_0xe4b2('0x22')](_0x3f343e[_0xe4b2('0x21')],function(_0x9a8a78){return{'model':db[_0x9a8a78[_0xe4b2('0x23')]],'as':_0x9a8a78['as'],'attributes':_0x9a8a78['attributes'],'include':_0x9a8a78[_0xe4b2('0x21')]?_[_0xe4b2('0x22')](_0x9a8a78[_0xe4b2('0x21')],function(_0x33a7fd){return{'model':db[_0x33a7fd[_0xe4b2('0x23')]],'as':_0x33a7fd['as'],'attributes':_0x33a7fd[_0xe4b2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe4b2('0xe')](function(_0x5dafa6){logger[_0xe4b2('0xf')](_0xe4b2('0x25'),_0x3f8d41);logger[_0xe4b2('0x12')](_0xe4b2('0x25'),_0x3f8d41,JSON['stringify'](_0x5dafa6));_0x4de692(_0x5dafa6);})[_0xe4b2('0x24')](function(_0x2547c1){logger[_0xe4b2('0x15')](_0xe4b2('0x25'),_0x2547c1['message'],_0x3f8d41);_0x467e58(_0x1f3af0[_0xe4b2('0x15')](0x1f4,_0x2547c1[_0xe4b2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 891eaa8..cb91cfb 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x16e86c,_0x3be3e2){var _0x57d7db=function(_0x404a8e){while(--_0x404a8e){_0x16e86c['push'](_0x16e86c['shift']());}};_0x57d7db(++_0x3be3e2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x3f5b57,_0x1d8338){var _0x5d48af=function(_0x4434bc){while(--_0x4434bc){_0x3f5b57['push'](_0x3f5b57['shift']());}};_0x5d48af(++_0x1d8338);}(_0xe706,0xa3));var _0x6e70=function(_0x55cf9d,_0x2795b3){_0x55cf9d=_0x55cf9d-0x0;var _0x2fd425=_0xe706[_0x55cf9d];return _0x2fd425;};'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('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 126ad29..bb17955 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 _0x7ca3=['STRING','exports'];(function(_0x44a0e9,_0x959f63){var _0x3b8e8c=function(_0x11b3e1){while(--_0x11b3e1){_0x44a0e9['push'](_0x44a0e9['shift']());}};_0x3b8e8c(++_0x959f63);}(_0x7ca3,0x1c9));var _0x37ca=function(_0x1bf8cc,_0x118778){_0x1bf8cc=_0x1bf8cc-0x0;var _0x322d20=_0x7ca3[_0x1bf8cc];return _0x322d20;};'use strict';var Sequelize=require('sequelize');module[_0x37ca('0x0')]={'name':{'type':Sequelize[_0x37ca('0x1')]},'description':{'type':Sequelize[_0x37ca('0x1')]}}; \ No newline at end of file +var _0xee9f=['sequelize','STRING'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xee9f,0x12a));var _0xfee9=function(_0x5ea284,_0xe36959){_0x5ea284=_0x5ea284-0x0;var _0x25392e=_0xee9f[_0x5ea284];return _0x25392e;};'use strict';var Sequelize=require(_0xfee9('0x0'));module['exports']={'name':{'type':Sequelize[_0xfee9('0x1')]},'description':{'type':Sequelize[_0xfee9('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 33662d1..0e3b8ab 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 _0xc11a=['VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','findOne','ZendeskField','rawAttributes','getFields','hasOwnProperty','getSubjects','nolimit','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','name','send','map','ZendeskConfiguration','fieldName','key','model','keys','filters','intersection','fields','attributes','length','query','order','sort','where','pick','filter','merge','type'];(function(_0x4609be,_0x35833b){var _0x550998=function(_0x4b66ee){while(--_0x4b66ee){_0x4609be['push'](_0x4609be['shift']());}};_0x550998(++_0x35833b);}(_0xc11a,0x69));var _0xac11=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xc11a[_0x5311e8];return _0x582ad8;};'use strict';var emlformat=require(_0xac11('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac11('0x1'));var jsonpatch=require(_0xac11('0x2'));var rp=require(_0xac11('0x3'));var moment=require('moment');var BPromise=require(_0xac11('0x4'));var Mustache=require('mustache');var util=require(_0xac11('0x5'));var path=require(_0xac11('0x6'));var sox=require(_0xac11('0x7'));var csv=require(_0xac11('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac11('0x9'));var _=require(_0xac11('0xa'));var squel=require(_0xac11('0xb'));var crypto=require(_0xac11('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xac11('0xd'));var toCsv=require(_0xac11('0x8'));var querystring=require(_0xac11('0xe'));var Papa=require(_0xac11('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xac11('0x10'));var as=require(_0xac11('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac11('0x12'))(_0xac11('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xac11('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6e5214,_0x3c6785){_0x3c6785=_0x3c6785||0xcc;return function(_0x174fac){if(_0x174fac){return _0x6e5214[_0xac11('0x15')](_0x3c6785);}return _0x6e5214[_0xac11('0x16')](_0x3c6785)['end']();};}function respondWithResult(_0x119b74,_0x3721b7){_0x3721b7=_0x3721b7||0xc8;return function(_0x530a42){if(_0x530a42){return _0x119b74['status'](_0x3721b7)[_0xac11('0x17')](_0x530a42);}};}function respondWithFilteredResult(_0x26cd1f,_0x29df3d){return function(_0x44c7ab){if(_0x44c7ab){var _0x29aecf=typeof _0x29df3d[_0xac11('0x18')]===_0xac11('0x19')&&typeof _0x29df3d[_0xac11('0x1a')]===_0xac11('0x19');var _0x16b21e=_0x44c7ab[_0xac11('0x1b')];var _0x5bc0c8=_0x29aecf?0x0:_0x29df3d['offset'];var _0x471705=_0x29aecf?_0x44c7ab[_0xac11('0x1b')]:_0x29df3d[_0xac11('0x18')]+_0x29df3d[_0xac11('0x1a')];var _0x5e7d67;if(_0x471705>=_0x16b21e){_0x471705=_0x16b21e;_0x5e7d67=0xc8;}else{_0x5e7d67=0xce;}_0x26cd1f[_0xac11('0x16')](_0x5e7d67);return _0x26cd1f[_0xac11('0x1c')](_0xac11('0x1d'),_0x5bc0c8+'-'+_0x471705+'/'+_0x16b21e)['json'](_0x44c7ab);}return null;};}function patchUpdates(_0xadcfaa){return function(_0x5aa7b2){try{jsonpatch[_0xac11('0x1e')](_0x5aa7b2,_0xadcfaa,!![]);}catch(_0x1482f2){return BPromise['reject'](_0x1482f2);}return _0x5aa7b2[_0xac11('0x1f')]();};}function saveUpdates(_0x4ac484,_0x4cb273){return function(_0x3e8b73){if(_0x3e8b73){return _0x3e8b73[_0xac11('0x20')](_0x4ac484)[_0xac11('0x21')](function(_0x447ac7){return _0x447ac7;});}return null;};}function removeEntity(_0x15a1e6,_0xe087ae){return function(_0x45ca93){if(_0x45ca93){return _0x45ca93['destroy']()[_0xac11('0x21')](function(){_0x15a1e6[_0xac11('0x16')](0xcc)[_0xac11('0x22')]();});}};}function handleEntityNotFound(_0x5020dc,_0x16f654){return function(_0x5683c1){if(!_0x5683c1){_0x5020dc['sendStatus'](0x194);}return _0x5683c1;};}function handleError(_0x5ccc09,_0x1f0dc5){_0x1f0dc5=_0x1f0dc5||0x1f4;return function(_0x20c64a){logger[_0xac11('0x23')](_0x20c64a['stack']);if(_0x20c64a[_0xac11('0x24')]){delete _0x20c64a[_0xac11('0x24')];}_0x5ccc09['status'](_0x1f0dc5)[_0xac11('0x25')](_0x20c64a);};}exports['index']=function(_0x3043a5,_0x7b67fb){var _0xaea16b={},_0x1b2484={},_0x54edb1={'count':0x0,'rows':[]};var _0x5573bb=_[_0xac11('0x26')](db[_0xac11('0x27')]['rawAttributes'],function(_0xec1a8f){return{'name':_0xec1a8f[_0xac11('0x28')],'type':_0xec1a8f['type'][_0xac11('0x29')]};});_0x1b2484[_0xac11('0x2a')]=_[_0xac11('0x26')](_0x5573bb,_0xac11('0x24'));_0x1b2484['query']=_[_0xac11('0x2b')](_0x3043a5['query']);_0x1b2484[_0xac11('0x2c')]=_[_0xac11('0x2d')](_0x1b2484[_0xac11('0x2a')],_0x1b2484['query']);_0xaea16b['attributes']=_[_0xac11('0x2d')](_0x1b2484['model'],qs[_0xac11('0x2e')](_0x3043a5['query']['fields']));_0xaea16b[_0xac11('0x2f')]=_0xaea16b['attributes'][_0xac11('0x30')]?_0xaea16b[_0xac11('0x2f')]:_0x1b2484[_0xac11('0x2a')];if(!_0x3043a5[_0xac11('0x31')]['hasOwnProperty']('nolimit')){_0xaea16b['limit']=qs[_0xac11('0x1a')](_0x3043a5[_0xac11('0x31')][_0xac11('0x1a')]);_0xaea16b[_0xac11('0x18')]=qs[_0xac11('0x18')](_0x3043a5[_0xac11('0x31')][_0xac11('0x18')]);}_0xaea16b[_0xac11('0x32')]=qs['sort'](_0x3043a5[_0xac11('0x31')][_0xac11('0x33')]);_0xaea16b[_0xac11('0x34')]=qs[_0xac11('0x2c')](_[_0xac11('0x35')](_0x3043a5[_0xac11('0x31')],_0x1b2484[_0xac11('0x2c')]),_0x5573bb);if(_0x3043a5[_0xac11('0x31')][_0xac11('0x36')]){_0xaea16b[_0xac11('0x34')]=_[_0xac11('0x37')](_0xaea16b['where'],{'$or':_[_0xac11('0x26')](_0x5573bb,function(_0x14b09c){if(_0x14b09c[_0xac11('0x38')]!==_0xac11('0x39')){var _0x2ca177={};_0x2ca177[_0x14b09c[_0xac11('0x24')]]={'$like':'%'+_0x3043a5[_0xac11('0x31')][_0xac11('0x36')]+'%'};return _0x2ca177;}})});}_0xaea16b=_[_0xac11('0x37')]({},_0xaea16b,_0x3043a5[_0xac11('0x3a')]);var _0x417dd4={'where':_0xaea16b[_0xac11('0x34')]};return db[_0xac11('0x27')]['count'](_0x417dd4)[_0xac11('0x21')](function(_0x606c5f){_0x54edb1[_0xac11('0x1b')]=_0x606c5f;if(_0x3043a5['query']['includeAll']){_0xaea16b[_0xac11('0x3b')]=[{'all':!![]}];}return db[_0xac11('0x27')][_0xac11('0x3c')](_0xaea16b);})[_0xac11('0x21')](function(_0x3536dd){_0x54edb1[_0xac11('0x3d')]=_0x3536dd;return _0x54edb1;})[_0xac11('0x21')](respondWithFilteredResult(_0x7b67fb,_0xaea16b))[_0xac11('0x3e')](handleError(_0x7b67fb,null));};exports[_0xac11('0x3f')]=function(_0x39a744,_0x2e7aea){var _0x3055ad={'raw':![],'where':{'id':_0x39a744[_0xac11('0x40')]['id']}},_0x47f100={};_0x47f100[_0xac11('0x2a')]=_[_0xac11('0x2b')](db[_0xac11('0x27')]['rawAttributes']);_0x47f100[_0xac11('0x31')]=_['keys'](_0x39a744[_0xac11('0x31')]);_0x47f100['filters']=_[_0xac11('0x2d')](_0x47f100['model'],_0x47f100[_0xac11('0x31')]);_0x3055ad[_0xac11('0x2f')]=_[_0xac11('0x2d')](_0x47f100[_0xac11('0x2a')],qs[_0xac11('0x2e')](_0x39a744[_0xac11('0x31')][_0xac11('0x2e')]));_0x3055ad['attributes']=_0x3055ad['attributes'][_0xac11('0x30')]?_0x3055ad[_0xac11('0x2f')]:_0x47f100[_0xac11('0x2a')];if(_0x39a744[_0xac11('0x31')][_0xac11('0x41')]){_0x3055ad['include']=[{'all':!![]}];}_0x3055ad=_[_0xac11('0x37')]({},_0x3055ad,_0x39a744[_0xac11('0x3a')]);return db[_0xac11('0x27')][_0xac11('0x42')](_0x3055ad)[_0xac11('0x21')](handleEntityNotFound(_0x2e7aea,null))[_0xac11('0x21')](respondWithResult(_0x2e7aea,null))[_0xac11('0x3e')](handleError(_0x2e7aea,null));};exports[_0xac11('0x43')]=function(_0x2c5e4f,_0x4b7c32){return db['ZendeskConfiguration'][_0xac11('0x43')](_0x2c5e4f[_0xac11('0x44')],{})[_0xac11('0x21')](respondWithResult(_0x4b7c32,0xc9))[_0xac11('0x3e')](handleError(_0x4b7c32,null));};exports[_0xac11('0x20')]=function(_0x3a183a,_0x560f54){if(_0x3a183a['body']['id']){delete _0x3a183a['body']['id'];}return db[_0xac11('0x27')]['find']({'where':{'id':_0x3a183a[_0xac11('0x40')]['id']}})[_0xac11('0x21')](handleEntityNotFound(_0x560f54,null))[_0xac11('0x21')](saveUpdates(_0x3a183a[_0xac11('0x44')],null))[_0xac11('0x21')](respondWithResult(_0x560f54,null))[_0xac11('0x3e')](handleError(_0x560f54,null));};exports[_0xac11('0x45')]=function(_0x4f3820,_0x53d648){return db[_0xac11('0x27')][_0xac11('0x42')]({'where':{'id':_0x4f3820[_0xac11('0x40')]['id']}})[_0xac11('0x21')](handleEntityNotFound(_0x53d648,null))[_0xac11('0x21')](removeEntity(_0x53d648,null))[_0xac11('0x3e')](handleError(_0x53d648,null));};exports['getFields']=function(_0x4f9072,_0x1b3a81,_0x39cc92){var _0x32966e={};var _0x4b9671={};var _0x20c553;var _0x961e02;return db[_0xac11('0x27')][_0xac11('0x46')]({'where':{'id':_0x4f9072[_0xac11('0x40')]['id']}})[_0xac11('0x21')](handleEntityNotFound(_0x1b3a81,null))['then'](function(_0x3cc6e9){if(_0x3cc6e9){_0x20c553=_0x3cc6e9;_0x4b9671[_0xac11('0x2a')]=_[_0xac11('0x2b')](db[_0xac11('0x47')][_0xac11('0x48')]);_0x4b9671['query']=_['keys'](_0x4f9072['query']);_0x4b9671[_0xac11('0x2c')]=_[_0xac11('0x2d')](_0x4b9671[_0xac11('0x2a')],_0x4b9671[_0xac11('0x31')]);_0x32966e['attributes']=_[_0xac11('0x2d')](_0x4b9671[_0xac11('0x2a')],qs['fields'](_0x4f9072[_0xac11('0x31')][_0xac11('0x2e')]));_0x32966e[_0xac11('0x2f')]=_0x32966e[_0xac11('0x2f')][_0xac11('0x30')]?_0x32966e['attributes']:_0x4b9671['model'];_0x32966e[_0xac11('0x32')]=qs[_0xac11('0x33')](_0x4f9072['query'][_0xac11('0x33')]);_0x32966e[_0xac11('0x34')]=qs[_0xac11('0x2c')](_[_0xac11('0x35')](_0x4f9072[_0xac11('0x31')],_0x4b9671['filters']));if(_0x4f9072[_0xac11('0x31')][_0xac11('0x36')]){_0x32966e['where']=_[_0xac11('0x37')](_0x32966e[_0xac11('0x34')],{'$or':_['map'](_0x32966e[_0xac11('0x2f')],function(_0xa218d6){var _0x3a4a15={};_0x3a4a15[_0xa218d6]={'$like':'%'+_0x4f9072[_0xac11('0x31')][_0xac11('0x36')]+'%'};return _0x3a4a15;})});}_0x32966e=_['merge']({},_0x32966e,_0x4f9072[_0xac11('0x3a')]);return _0x20c553[_0xac11('0x49')](_0x32966e);}})['then'](function(_0x4f64ce){if(_0x4f64ce){_0x961e02=_0x4f64ce['length'];if(!_0x4f9072['query'][_0xac11('0x4a')]('nolimit')){_0x32966e[_0xac11('0x1a')]=qs[_0xac11('0x1a')](_0x4f9072[_0xac11('0x31')][_0xac11('0x1a')]);_0x32966e[_0xac11('0x18')]=qs[_0xac11('0x18')](_0x4f9072[_0xac11('0x31')]['offset']);}return _0x20c553[_0xac11('0x49')](_0x32966e);}})[_0xac11('0x21')](function(_0x56a506){if(_0x56a506){return _0x56a506?{'count':_0x961e02,'rows':_0x56a506}:null;}})[_0xac11('0x21')](respondWithResult(_0x1b3a81,null))[_0xac11('0x3e')](handleError(_0x1b3a81,null));};exports[_0xac11('0x4b')]=function(_0x5ddb93,_0x3d6c1c,_0xec0903){var _0x373b85={};var _0x1e646d={};var _0x36b56e;var _0x33eee3;return db[_0xac11('0x27')][_0xac11('0x46')]({'where':{'id':_0x5ddb93['params']['id']}})[_0xac11('0x21')](handleEntityNotFound(_0x3d6c1c,null))[_0xac11('0x21')](function(_0x4f2529){if(_0x4f2529){_0x36b56e=_0x4f2529;_0x1e646d[_0xac11('0x2a')]=_[_0xac11('0x2b')](db['ZendeskField'][_0xac11('0x48')]);_0x1e646d[_0xac11('0x31')]=_[_0xac11('0x2b')](_0x5ddb93['query']);_0x1e646d['filters']=_[_0xac11('0x2d')](_0x1e646d[_0xac11('0x2a')],_0x1e646d[_0xac11('0x31')]);_0x373b85[_0xac11('0x2f')]=_[_0xac11('0x2d')](_0x1e646d[_0xac11('0x2a')],qs[_0xac11('0x2e')](_0x5ddb93['query'][_0xac11('0x2e')]));_0x373b85[_0xac11('0x2f')]=_0x373b85[_0xac11('0x2f')][_0xac11('0x30')]?_0x373b85['attributes']:_0x1e646d['model'];_0x373b85[_0xac11('0x32')]=qs[_0xac11('0x33')](_0x5ddb93[_0xac11('0x31')][_0xac11('0x33')]);_0x373b85[_0xac11('0x34')]=qs[_0xac11('0x2c')](_[_0xac11('0x35')](_0x5ddb93[_0xac11('0x31')],_0x1e646d[_0xac11('0x2c')]));if(_0x5ddb93[_0xac11('0x31')][_0xac11('0x36')]){_0x373b85['where']=_[_0xac11('0x37')](_0x373b85[_0xac11('0x34')],{'$or':_[_0xac11('0x26')](_0x373b85['attributes'],function(_0xe541a5){var _0x12f627={};_0x12f627[_0xe541a5]={'$like':'%'+_0x5ddb93['query'][_0xac11('0x36')]+'%'};return _0x12f627;})});}_0x373b85=_[_0xac11('0x37')]({},_0x373b85,_0x5ddb93['options']);return _0x36b56e[_0xac11('0x4b')](_0x373b85);}})[_0xac11('0x21')](function(_0x1dba7e){if(_0x1dba7e){_0x33eee3=_0x1dba7e[_0xac11('0x30')];if(!_0x5ddb93[_0xac11('0x31')][_0xac11('0x4a')](_0xac11('0x4c'))){_0x373b85[_0xac11('0x1a')]=qs[_0xac11('0x1a')](_0x5ddb93[_0xac11('0x31')]['limit']);_0x373b85['offset']=qs[_0xac11('0x18')](_0x5ddb93[_0xac11('0x31')][_0xac11('0x18')]);}return _0x36b56e[_0xac11('0x4b')](_0x373b85);}})[_0xac11('0x21')](function(_0x1c3072){if(_0x1c3072){return _0x1c3072?{'count':_0x33eee3,'rows':_0x1c3072}:null;}})[_0xac11('0x21')](respondWithResult(_0x3d6c1c,null))['catch'](handleError(_0x3d6c1c,null));};exports['getDescriptions']=function(_0x4a921b,_0x254584,_0x19e7f0){var _0x4550a9={};var _0x20e0b5={};var _0x1e2ed6;var _0x349751;return db[_0xac11('0x27')]['findOne']({'where':{'id':_0x4a921b[_0xac11('0x40')]['id']}})[_0xac11('0x21')](handleEntityNotFound(_0x254584,null))['then'](function(_0x508dc8){if(_0x508dc8){_0x1e2ed6=_0x508dc8;_0x20e0b5[_0xac11('0x2a')]=_[_0xac11('0x2b')](db[_0xac11('0x47')]['rawAttributes']);_0x20e0b5[_0xac11('0x31')]=_[_0xac11('0x2b')](_0x4a921b[_0xac11('0x31')]);_0x20e0b5[_0xac11('0x2c')]=_['intersection'](_0x20e0b5['model'],_0x20e0b5[_0xac11('0x31')]);_0x4550a9['attributes']=_['intersection'](_0x20e0b5[_0xac11('0x2a')],qs[_0xac11('0x2e')](_0x4a921b[_0xac11('0x31')][_0xac11('0x2e')]));_0x4550a9[_0xac11('0x2f')]=_0x4550a9['attributes']['length']?_0x4550a9[_0xac11('0x2f')]:_0x20e0b5['model'];_0x4550a9['order']=qs['sort'](_0x4a921b[_0xac11('0x31')][_0xac11('0x33')]);_0x4550a9[_0xac11('0x34')]=qs[_0xac11('0x2c')](_[_0xac11('0x35')](_0x4a921b[_0xac11('0x31')],_0x20e0b5[_0xac11('0x2c')]));if(_0x4a921b[_0xac11('0x31')][_0xac11('0x36')]){_0x4550a9['where']=_['merge'](_0x4550a9[_0xac11('0x34')],{'$or':_[_0xac11('0x26')](_0x4550a9['attributes'],function(_0x68d650){var _0x22a4b1={};_0x22a4b1[_0x68d650]={'$like':'%'+_0x4a921b[_0xac11('0x31')][_0xac11('0x36')]+'%'};return _0x22a4b1;})});}_0x4550a9=_[_0xac11('0x37')]({},_0x4550a9,_0x4a921b[_0xac11('0x3a')]);return _0x1e2ed6[_0xac11('0x4d')](_0x4550a9);}})[_0xac11('0x21')](function(_0x5bbfbf){if(_0x5bbfbf){_0x349751=_0x5bbfbf[_0xac11('0x30')];if(!_0x4a921b[_0xac11('0x31')][_0xac11('0x4a')](_0xac11('0x4c'))){_0x4550a9['limit']=qs[_0xac11('0x1a')](_0x4a921b[_0xac11('0x31')]['limit']);_0x4550a9[_0xac11('0x18')]=qs[_0xac11('0x18')](_0x4a921b[_0xac11('0x31')][_0xac11('0x18')]);}return _0x1e2ed6['getDescriptions'](_0x4550a9);}})['then'](function(_0x1a7a5b){if(_0x1a7a5b){return _0x1a7a5b?{'count':_0x349751,'rows':_0x1a7a5b}:null;}})[_0xac11('0x21')](respondWithResult(_0x254584,null))[_0xac11('0x3e')](handleError(_0x254584,null));};exports[_0xac11('0x4e')]=function(_0x2213ed,_0x42cc77,_0x4258de){var _0x158622={};var _0x42029e={};var _0x508f7b;var _0x4c06f5;return db[_0xac11('0x27')][_0xac11('0x46')]({'where':{'id':_0x2213ed[_0xac11('0x40')]['id']}})[_0xac11('0x21')](handleEntityNotFound(_0x42cc77,null))[_0xac11('0x21')](function(_0x12d22){if(_0x12d22){_0x508f7b=_0x12d22;_0x42029e[_0xac11('0x2a')]=_['keys'](db['Tag'][_0xac11('0x48')]);_0x42029e[_0xac11('0x31')]=_['keys'](_0x2213ed[_0xac11('0x31')]);_0x42029e[_0xac11('0x2c')]=_[_0xac11('0x2d')](_0x42029e[_0xac11('0x2a')],_0x42029e[_0xac11('0x31')]);_0x158622[_0xac11('0x2f')]=_['intersection'](_0x42029e[_0xac11('0x2a')],qs['fields'](_0x2213ed[_0xac11('0x31')][_0xac11('0x2e')]));_0x158622[_0xac11('0x2f')]=_0x158622['attributes']['length']?_0x158622['attributes']:_0x42029e[_0xac11('0x2a')];_0x158622[_0xac11('0x32')]=qs[_0xac11('0x33')](_0x2213ed[_0xac11('0x31')][_0xac11('0x33')]);_0x158622[_0xac11('0x34')]=qs['filters'](_[_0xac11('0x35')](_0x2213ed[_0xac11('0x31')],_0x42029e[_0xac11('0x2c')]));if(_0x2213ed[_0xac11('0x31')][_0xac11('0x36')]){_0x158622[_0xac11('0x34')]=_['merge'](_0x158622[_0xac11('0x34')],{'$or':_[_0xac11('0x26')](_0x158622['attributes'],function(_0x38ed05){var _0x5aaf08={};_0x5aaf08[_0x38ed05]={'$like':'%'+_0x2213ed[_0xac11('0x31')]['filter']+'%'};return _0x5aaf08;})});}_0x158622=_['merge']({},_0x158622,_0x2213ed[_0xac11('0x3a')]);return _0x508f7b[_0xac11('0x4e')](_0x158622);}})[_0xac11('0x21')](function(_0x207e0b){if(_0x207e0b){_0x4c06f5=_0x207e0b[_0xac11('0x30')];if(!_0x2213ed['query'][_0xac11('0x4a')]('nolimit')){_0x158622['limit']=qs['limit'](_0x2213ed['query'][_0xac11('0x1a')]);_0x158622[_0xac11('0x18')]=qs[_0xac11('0x18')](_0x2213ed[_0xac11('0x31')][_0xac11('0x18')]);}return _0x508f7b[_0xac11('0x4e')](_0x158622);}})['then'](function(_0x5ee451){if(_0x5ee451){return _0x5ee451?{'count':_0x4c06f5,'rows':_0x5ee451}:null;}})[_0xac11('0x21')](respondWithResult(_0x42cc77,null))[_0xac11('0x3e')](handleError(_0x42cc77,null));};exports[_0xac11('0x4f')]=function(_0x19cf98,_0x116cf8,_0x14a52e){if(_0x19cf98['body']['id']){delete _0x19cf98['body']['id'];}return db[_0xac11('0x27')]['findOne']({'where':{'id':_0x19cf98['params']['id']}})[_0xac11('0x21')](handleEntityNotFound(_0x116cf8,null))['then'](function(_0x53a0e0){if(_0x53a0e0){return _0x53a0e0[_0xac11('0x4f')](_0x19cf98['body'][_0xac11('0x50')]||[]);}return null;})[_0xac11('0x21')](respondWithResult(_0x116cf8,null))[_0xac11('0x3e')](handleError(_0x116cf8,null));}; \ No newline at end of file +var _0x504d=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','ZendeskConfiguration','includeAll','include','findAll','catch','find','create','body','params','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x5e343c,_0x5d5c6a){var _0x497243=function(_0x49bcda){while(--_0x49bcda){_0x5e343c['push'](_0x5e343c['shift']());}};_0x497243(++_0x5d5c6a);}(_0x504d,0x12f));var _0xd504=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x504d[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd504('0x0'));var zipdir=require(_0xd504('0x1'));var jsonpatch=require(_0xd504('0x2'));var rp=require(_0xd504('0x3'));var moment=require(_0xd504('0x4'));var BPromise=require(_0xd504('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd504('0x6'));var sox=require(_0xd504('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd504('0x8'));var _=require(_0xd504('0x9'));var squel=require(_0xd504('0xa'));var crypto=require(_0xd504('0xb'));var jsforce=require(_0xd504('0xc'));var deskjs=require(_0xd504('0xd'));var toCsv=require(_0xd504('0xe'));var querystring=require(_0xd504('0xf'));var Papa=require(_0xd504('0x10'));var Redis=require(_0xd504('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd504('0x12'));var as=require(_0xd504('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd504('0x14'))(_0xd504('0x15'));var utils=require(_0xd504('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4285d0,_0x4d010b){_0x4d010b=_0x4d010b||0xcc;return function(_0x543b16){if(_0x543b16){return _0x4285d0['sendStatus'](_0x4d010b);}return _0x4285d0[_0xd504('0x17')](_0x4d010b)['end']();};}function respondWithResult(_0x255078,_0x13dacd){_0x13dacd=_0x13dacd||0xc8;return function(_0x229ad9){if(_0x229ad9){return _0x255078[_0xd504('0x17')](_0x13dacd)[_0xd504('0x18')](_0x229ad9);}};}function respondWithFilteredResult(_0x1039b7,_0x208e8f){return function(_0x5a42e4){if(_0x5a42e4){var _0xb4863d=typeof _0x208e8f[_0xd504('0x19')]===_0xd504('0x1a')&&typeof _0x208e8f[_0xd504('0x1b')]===_0xd504('0x1a');var _0x395df0=_0x5a42e4['count'];var _0x29e127=_0xb4863d?0x0:_0x208e8f[_0xd504('0x19')];var _0x2933c7=_0xb4863d?_0x5a42e4[_0xd504('0x1c')]:_0x208e8f['offset']+_0x208e8f['limit'];var _0x4f73c6;if(_0x2933c7>=_0x395df0){_0x2933c7=_0x395df0;_0x4f73c6=0xc8;}else{_0x4f73c6=0xce;}_0x1039b7[_0xd504('0x17')](_0x4f73c6);return _0x1039b7[_0xd504('0x1d')](_0xd504('0x1e'),_0x29e127+'-'+_0x2933c7+'/'+_0x395df0)['json'](_0x5a42e4);}return null;};}function patchUpdates(_0x1ca9a9){return function(_0xc2e3f1){try{jsonpatch[_0xd504('0x1f')](_0xc2e3f1,_0x1ca9a9,!![]);}catch(_0x12b35){return BPromise['reject'](_0x12b35);}return _0xc2e3f1[_0xd504('0x20')]();};}function saveUpdates(_0x5cc735,_0x4d90d6){return function(_0x7ff503){if(_0x7ff503){return _0x7ff503[_0xd504('0x21')](_0x5cc735)['then'](function(_0x28729c){return _0x28729c;});}return null;};}function removeEntity(_0x5e5c95,_0x5a03fb){return function(_0x3d1886){if(_0x3d1886){return _0x3d1886[_0xd504('0x22')]()[_0xd504('0x23')](function(){_0x5e5c95[_0xd504('0x17')](0xcc)[_0xd504('0x24')]();});}};}function handleEntityNotFound(_0x1550cd,_0x41960f){return function(_0x36f97f){if(!_0x36f97f){_0x1550cd[_0xd504('0x25')](0x194);}return _0x36f97f;};}function handleError(_0x4a756d,_0x10b5f1){_0x10b5f1=_0x10b5f1||0x1f4;return function(_0x5d8518){logger['error'](_0x5d8518[_0xd504('0x26')]);if(_0x5d8518[_0xd504('0x27')]){delete _0x5d8518[_0xd504('0x27')];}_0x4a756d[_0xd504('0x17')](_0x10b5f1)[_0xd504('0x28')](_0x5d8518);};}exports[_0xd504('0x29')]=function(_0x5a0fca,_0x515730){var _0x3edb22={},_0x4604d0={},_0xc4a95={'count':0x0,'rows':[]};var _0x335773=_[_0xd504('0x2a')](db['ZendeskConfiguration'][_0xd504('0x2b')],function(_0x3e7245){return{'name':_0x3e7245[_0xd504('0x2c')],'type':_0x3e7245['type'][_0xd504('0x2d')]};});_0x4604d0[_0xd504('0x2e')]=_['map'](_0x335773,_0xd504('0x27'));_0x4604d0[_0xd504('0x2f')]=_[_0xd504('0x30')](_0x5a0fca[_0xd504('0x2f')]);_0x4604d0[_0xd504('0x31')]=_[_0xd504('0x32')](_0x4604d0['model'],_0x4604d0[_0xd504('0x2f')]);_0x3edb22[_0xd504('0x33')]=_[_0xd504('0x32')](_0x4604d0[_0xd504('0x2e')],qs[_0xd504('0x34')](_0x5a0fca['query'][_0xd504('0x34')]));_0x3edb22[_0xd504('0x33')]=_0x3edb22[_0xd504('0x33')][_0xd504('0x35')]?_0x3edb22[_0xd504('0x33')]:_0x4604d0[_0xd504('0x2e')];if(!_0x5a0fca[_0xd504('0x2f')][_0xd504('0x36')](_0xd504('0x37'))){_0x3edb22['limit']=qs['limit'](_0x5a0fca[_0xd504('0x2f')][_0xd504('0x1b')]);_0x3edb22[_0xd504('0x19')]=qs[_0xd504('0x19')](_0x5a0fca[_0xd504('0x2f')][_0xd504('0x19')]);}_0x3edb22[_0xd504('0x38')]=qs['sort'](_0x5a0fca[_0xd504('0x2f')][_0xd504('0x39')]);_0x3edb22['where']=qs['filters'](_[_0xd504('0x3a')](_0x5a0fca['query'],_0x4604d0[_0xd504('0x31')]),_0x335773);if(_0x5a0fca[_0xd504('0x2f')][_0xd504('0x3b')]){_0x3edb22[_0xd504('0x3c')]=_[_0xd504('0x3d')](_0x3edb22[_0xd504('0x3c')],{'$or':_[_0xd504('0x2a')](_0x335773,function(_0x577993){if(_0x577993[_0xd504('0x3e')]!=='VIRTUAL'){var _0xf7441d={};_0xf7441d[_0x577993[_0xd504('0x27')]]={'$like':'%'+_0x5a0fca[_0xd504('0x2f')][_0xd504('0x3b')]+'%'};return _0xf7441d;}})});}_0x3edb22=_[_0xd504('0x3d')]({},_0x3edb22,_0x5a0fca[_0xd504('0x3f')]);var _0x1239ae={'where':_0x3edb22[_0xd504('0x3c')]};return db[_0xd504('0x40')][_0xd504('0x1c')](_0x1239ae)['then'](function(_0xaa727b){_0xc4a95[_0xd504('0x1c')]=_0xaa727b;if(_0x5a0fca[_0xd504('0x2f')][_0xd504('0x41')]){_0x3edb22[_0xd504('0x42')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xd504('0x43')](_0x3edb22);})[_0xd504('0x23')](function(_0x44e959){_0xc4a95['rows']=_0x44e959;return _0xc4a95;})['then'](respondWithFilteredResult(_0x515730,_0x3edb22))[_0xd504('0x44')](handleError(_0x515730,null));};exports['show']=function(_0xefb351,_0x46aa38){var _0x452ff9={'raw':![],'where':{'id':_0xefb351['params']['id']}},_0x333dc5={};_0x333dc5[_0xd504('0x2e')]=_[_0xd504('0x30')](db[_0xd504('0x40')][_0xd504('0x2b')]);_0x333dc5[_0xd504('0x2f')]=_['keys'](_0xefb351[_0xd504('0x2f')]);_0x333dc5[_0xd504('0x31')]=_[_0xd504('0x32')](_0x333dc5[_0xd504('0x2e')],_0x333dc5[_0xd504('0x2f')]);_0x452ff9[_0xd504('0x33')]=_['intersection'](_0x333dc5[_0xd504('0x2e')],qs[_0xd504('0x34')](_0xefb351['query']['fields']));_0x452ff9['attributes']=_0x452ff9[_0xd504('0x33')][_0xd504('0x35')]?_0x452ff9[_0xd504('0x33')]:_0x333dc5[_0xd504('0x2e')];if(_0xefb351[_0xd504('0x2f')]['includeAll']){_0x452ff9['include']=[{'all':!![]}];}_0x452ff9=_[_0xd504('0x3d')]({},_0x452ff9,_0xefb351[_0xd504('0x3f')]);return db[_0xd504('0x40')][_0xd504('0x45')](_0x452ff9)[_0xd504('0x23')](handleEntityNotFound(_0x46aa38,null))[_0xd504('0x23')](respondWithResult(_0x46aa38,null))[_0xd504('0x44')](handleError(_0x46aa38,null));};exports[_0xd504('0x46')]=function(_0x1b82f4,_0x645f96){return db['ZendeskConfiguration'][_0xd504('0x46')](_0x1b82f4[_0xd504('0x47')],{})[_0xd504('0x23')](respondWithResult(_0x645f96,0xc9))[_0xd504('0x44')](handleError(_0x645f96,null));};exports[_0xd504('0x21')]=function(_0x2f015b,_0x418c0d){if(_0x2f015b['body']['id']){delete _0x2f015b[_0xd504('0x47')]['id'];}return db['ZendeskConfiguration'][_0xd504('0x45')]({'where':{'id':_0x2f015b[_0xd504('0x48')]['id']}})['then'](handleEntityNotFound(_0x418c0d,null))[_0xd504('0x23')](saveUpdates(_0x2f015b[_0xd504('0x47')],null))[_0xd504('0x23')](respondWithResult(_0x418c0d,null))[_0xd504('0x44')](handleError(_0x418c0d,null));};exports[_0xd504('0x22')]=function(_0x2b07d1,_0x24fac8){return db['ZendeskConfiguration'][_0xd504('0x45')]({'where':{'id':_0x2b07d1[_0xd504('0x48')]['id']}})[_0xd504('0x23')](handleEntityNotFound(_0x24fac8,null))[_0xd504('0x23')](removeEntity(_0x24fac8,null))[_0xd504('0x44')](handleError(_0x24fac8,null));};exports[_0xd504('0x49')]=function(_0x3b7b2a,_0x57dd12,_0x32e33c){var _0x3b3b1d={};var _0x3b94ba={};var _0x5a9472;var _0xb8c466;return db[_0xd504('0x40')][_0xd504('0x4a')]({'where':{'id':_0x3b7b2a[_0xd504('0x48')]['id']}})['then'](handleEntityNotFound(_0x57dd12,null))[_0xd504('0x23')](function(_0x1cf38b){if(_0x1cf38b){_0x5a9472=_0x1cf38b;_0x3b94ba[_0xd504('0x2e')]=_[_0xd504('0x30')](db[_0xd504('0x4b')][_0xd504('0x2b')]);_0x3b94ba[_0xd504('0x2f')]=_[_0xd504('0x30')](_0x3b7b2a['query']);_0x3b94ba[_0xd504('0x31')]=_['intersection'](_0x3b94ba['model'],_0x3b94ba[_0xd504('0x2f')]);_0x3b3b1d[_0xd504('0x33')]=_[_0xd504('0x32')](_0x3b94ba[_0xd504('0x2e')],qs[_0xd504('0x34')](_0x3b7b2a[_0xd504('0x2f')][_0xd504('0x34')]));_0x3b3b1d['attributes']=_0x3b3b1d[_0xd504('0x33')][_0xd504('0x35')]?_0x3b3b1d[_0xd504('0x33')]:_0x3b94ba[_0xd504('0x2e')];_0x3b3b1d[_0xd504('0x38')]=qs[_0xd504('0x39')](_0x3b7b2a[_0xd504('0x2f')][_0xd504('0x39')]);_0x3b3b1d[_0xd504('0x3c')]=qs[_0xd504('0x31')](_['pick'](_0x3b7b2a[_0xd504('0x2f')],_0x3b94ba[_0xd504('0x31')]));if(_0x3b7b2a['query'][_0xd504('0x3b')]){_0x3b3b1d['where']=_[_0xd504('0x3d')](_0x3b3b1d[_0xd504('0x3c')],{'$or':_[_0xd504('0x2a')](_0x3b3b1d[_0xd504('0x33')],function(_0x2313e6){var _0x91ff27={};_0x91ff27[_0x2313e6]={'$like':'%'+_0x3b7b2a[_0xd504('0x2f')][_0xd504('0x3b')]+'%'};return _0x91ff27;})});}_0x3b3b1d=_['merge']({},_0x3b3b1d,_0x3b7b2a[_0xd504('0x3f')]);return _0x5a9472[_0xd504('0x49')](_0x3b3b1d);}})[_0xd504('0x23')](function(_0x95b9a6){if(_0x95b9a6){_0xb8c466=_0x95b9a6[_0xd504('0x35')];if(!_0x3b7b2a['query'][_0xd504('0x36')](_0xd504('0x37'))){_0x3b3b1d['limit']=qs[_0xd504('0x1b')](_0x3b7b2a[_0xd504('0x2f')][_0xd504('0x1b')]);_0x3b3b1d[_0xd504('0x19')]=qs[_0xd504('0x19')](_0x3b7b2a['query'][_0xd504('0x19')]);}return _0x5a9472[_0xd504('0x49')](_0x3b3b1d);}})[_0xd504('0x23')](function(_0x1d974a){if(_0x1d974a){return _0x1d974a?{'count':_0xb8c466,'rows':_0x1d974a}:null;}})[_0xd504('0x23')](respondWithResult(_0x57dd12,null))[_0xd504('0x44')](handleError(_0x57dd12,null));};exports[_0xd504('0x4c')]=function(_0x45ce84,_0x2fe669,_0x317a9a){var _0x4dc40b={};var _0x41e57d={};var _0x36d467;var _0x193e3d;return db[_0xd504('0x40')][_0xd504('0x4a')]({'where':{'id':_0x45ce84[_0xd504('0x48')]['id']}})['then'](handleEntityNotFound(_0x2fe669,null))[_0xd504('0x23')](function(_0xaee81f){if(_0xaee81f){_0x36d467=_0xaee81f;_0x41e57d['model']=_['keys'](db['ZendeskField'][_0xd504('0x2b')]);_0x41e57d[_0xd504('0x2f')]=_[_0xd504('0x30')](_0x45ce84[_0xd504('0x2f')]);_0x41e57d[_0xd504('0x31')]=_[_0xd504('0x32')](_0x41e57d[_0xd504('0x2e')],_0x41e57d['query']);_0x4dc40b[_0xd504('0x33')]=_[_0xd504('0x32')](_0x41e57d['model'],qs[_0xd504('0x34')](_0x45ce84[_0xd504('0x2f')][_0xd504('0x34')]));_0x4dc40b[_0xd504('0x33')]=_0x4dc40b['attributes'][_0xd504('0x35')]?_0x4dc40b['attributes']:_0x41e57d[_0xd504('0x2e')];_0x4dc40b[_0xd504('0x38')]=qs[_0xd504('0x39')](_0x45ce84['query'][_0xd504('0x39')]);_0x4dc40b[_0xd504('0x3c')]=qs[_0xd504('0x31')](_[_0xd504('0x3a')](_0x45ce84[_0xd504('0x2f')],_0x41e57d['filters']));if(_0x45ce84[_0xd504('0x2f')]['filter']){_0x4dc40b[_0xd504('0x3c')]=_[_0xd504('0x3d')](_0x4dc40b[_0xd504('0x3c')],{'$or':_[_0xd504('0x2a')](_0x4dc40b[_0xd504('0x33')],function(_0x9c24e8){var _0x3d1c42={};_0x3d1c42[_0x9c24e8]={'$like':'%'+_0x45ce84[_0xd504('0x2f')][_0xd504('0x3b')]+'%'};return _0x3d1c42;})});}_0x4dc40b=_[_0xd504('0x3d')]({},_0x4dc40b,_0x45ce84[_0xd504('0x3f')]);return _0x36d467['getSubjects'](_0x4dc40b);}})['then'](function(_0x227f86){if(_0x227f86){_0x193e3d=_0x227f86[_0xd504('0x35')];if(!_0x45ce84['query']['hasOwnProperty'](_0xd504('0x37'))){_0x4dc40b[_0xd504('0x1b')]=qs['limit'](_0x45ce84[_0xd504('0x2f')][_0xd504('0x1b')]);_0x4dc40b[_0xd504('0x19')]=qs[_0xd504('0x19')](_0x45ce84[_0xd504('0x2f')]['offset']);}return _0x36d467[_0xd504('0x4c')](_0x4dc40b);}})[_0xd504('0x23')](function(_0x317a48){if(_0x317a48){return _0x317a48?{'count':_0x193e3d,'rows':_0x317a48}:null;}})[_0xd504('0x23')](respondWithResult(_0x2fe669,null))[_0xd504('0x44')](handleError(_0x2fe669,null));};exports[_0xd504('0x4d')]=function(_0x46b0d9,_0x4a5713,_0x4837da){var _0x5b2987={};var _0x5a60fe={};var _0x418954;var _0x5af022;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x46b0d9[_0xd504('0x48')]['id']}})[_0xd504('0x23')](handleEntityNotFound(_0x4a5713,null))[_0xd504('0x23')](function(_0x4fabbf){if(_0x4fabbf){_0x418954=_0x4fabbf;_0x5a60fe[_0xd504('0x2e')]=_[_0xd504('0x30')](db[_0xd504('0x4b')]['rawAttributes']);_0x5a60fe['query']=_['keys'](_0x46b0d9[_0xd504('0x2f')]);_0x5a60fe[_0xd504('0x31')]=_[_0xd504('0x32')](_0x5a60fe[_0xd504('0x2e')],_0x5a60fe[_0xd504('0x2f')]);_0x5b2987[_0xd504('0x33')]=_['intersection'](_0x5a60fe['model'],qs[_0xd504('0x34')](_0x46b0d9[_0xd504('0x2f')][_0xd504('0x34')]));_0x5b2987['attributes']=_0x5b2987[_0xd504('0x33')][_0xd504('0x35')]?_0x5b2987[_0xd504('0x33')]:_0x5a60fe['model'];_0x5b2987[_0xd504('0x38')]=qs[_0xd504('0x39')](_0x46b0d9[_0xd504('0x2f')][_0xd504('0x39')]);_0x5b2987[_0xd504('0x3c')]=qs[_0xd504('0x31')](_[_0xd504('0x3a')](_0x46b0d9['query'],_0x5a60fe[_0xd504('0x31')]));if(_0x46b0d9[_0xd504('0x2f')][_0xd504('0x3b')]){_0x5b2987[_0xd504('0x3c')]=_['merge'](_0x5b2987[_0xd504('0x3c')],{'$or':_[_0xd504('0x2a')](_0x5b2987[_0xd504('0x33')],function(_0x4fa596){var _0x369c3e={};_0x369c3e[_0x4fa596]={'$like':'%'+_0x46b0d9['query']['filter']+'%'};return _0x369c3e;})});}_0x5b2987=_[_0xd504('0x3d')]({},_0x5b2987,_0x46b0d9[_0xd504('0x3f')]);return _0x418954['getDescriptions'](_0x5b2987);}})[_0xd504('0x23')](function(_0x1586a4){if(_0x1586a4){_0x5af022=_0x1586a4['length'];if(!_0x46b0d9[_0xd504('0x2f')][_0xd504('0x36')](_0xd504('0x37'))){_0x5b2987[_0xd504('0x1b')]=qs[_0xd504('0x1b')](_0x46b0d9['query'][_0xd504('0x1b')]);_0x5b2987[_0xd504('0x19')]=qs[_0xd504('0x19')](_0x46b0d9['query'][_0xd504('0x19')]);}return _0x418954[_0xd504('0x4d')](_0x5b2987);}})[_0xd504('0x23')](function(_0x2ad784){if(_0x2ad784){return _0x2ad784?{'count':_0x5af022,'rows':_0x2ad784}:null;}})[_0xd504('0x23')](respondWithResult(_0x4a5713,null))['catch'](handleError(_0x4a5713,null));};exports[_0xd504('0x4e')]=function(_0x5d4b79,_0x308716,_0x3170db){var _0x3fd80a={};var _0x5a0063={};var _0xac085d;var _0x3d1914;return db[_0xd504('0x40')][_0xd504('0x4a')]({'where':{'id':_0x5d4b79[_0xd504('0x48')]['id']}})['then'](handleEntityNotFound(_0x308716,null))[_0xd504('0x23')](function(_0x164cb5){if(_0x164cb5){_0xac085d=_0x164cb5;_0x5a0063[_0xd504('0x2e')]=_[_0xd504('0x30')](db['Tag']['rawAttributes']);_0x5a0063[_0xd504('0x2f')]=_[_0xd504('0x30')](_0x5d4b79[_0xd504('0x2f')]);_0x5a0063[_0xd504('0x31')]=_[_0xd504('0x32')](_0x5a0063[_0xd504('0x2e')],_0x5a0063[_0xd504('0x2f')]);_0x3fd80a[_0xd504('0x33')]=_[_0xd504('0x32')](_0x5a0063['model'],qs['fields'](_0x5d4b79['query'][_0xd504('0x34')]));_0x3fd80a[_0xd504('0x33')]=_0x3fd80a['attributes'][_0xd504('0x35')]?_0x3fd80a['attributes']:_0x5a0063[_0xd504('0x2e')];_0x3fd80a['order']=qs[_0xd504('0x39')](_0x5d4b79[_0xd504('0x2f')][_0xd504('0x39')]);_0x3fd80a['where']=qs['filters'](_[_0xd504('0x3a')](_0x5d4b79[_0xd504('0x2f')],_0x5a0063['filters']));if(_0x5d4b79[_0xd504('0x2f')][_0xd504('0x3b')]){_0x3fd80a[_0xd504('0x3c')]=_[_0xd504('0x3d')](_0x3fd80a['where'],{'$or':_[_0xd504('0x2a')](_0x3fd80a['attributes'],function(_0x42bbca){var _0xe3f5a5={};_0xe3f5a5[_0x42bbca]={'$like':'%'+_0x5d4b79[_0xd504('0x2f')]['filter']+'%'};return _0xe3f5a5;})});}_0x3fd80a=_['merge']({},_0x3fd80a,_0x5d4b79[_0xd504('0x3f')]);return _0xac085d[_0xd504('0x4e')](_0x3fd80a);}})[_0xd504('0x23')](function(_0x728697){if(_0x728697){_0x3d1914=_0x728697[_0xd504('0x35')];if(!_0x5d4b79[_0xd504('0x2f')][_0xd504('0x36')]('nolimit')){_0x3fd80a[_0xd504('0x1b')]=qs[_0xd504('0x1b')](_0x5d4b79[_0xd504('0x2f')]['limit']);_0x3fd80a[_0xd504('0x19')]=qs[_0xd504('0x19')](_0x5d4b79[_0xd504('0x2f')][_0xd504('0x19')]);}return _0xac085d[_0xd504('0x4e')](_0x3fd80a);}})[_0xd504('0x23')](function(_0x5cf6cd){if(_0x5cf6cd){return _0x5cf6cd?{'count':_0x3d1914,'rows':_0x5cf6cd}:null;}})['then'](respondWithResult(_0x308716,null))[_0xd504('0x44')](handleError(_0x308716,null));};exports['setTags']=function(_0x2da3e8,_0x4ab546,_0x4bc7ae){if(_0x2da3e8['body']['id']){delete _0x2da3e8[_0xd504('0x47')]['id'];}return db[_0xd504('0x40')][_0xd504('0x4a')]({'where':{'id':_0x2da3e8[_0xd504('0x48')]['id']}})[_0xd504('0x23')](handleEntityNotFound(_0x4ab546,null))[_0xd504('0x23')](function(_0x25a86d){if(_0x25a86d){return _0x25a86d['setTags'](_0x2da3e8[_0xd504('0x47')][_0xd504('0x4f')]||[]);}return null;})[_0xd504('0x23')](respondWithResult(_0x4ab546,null))[_0xd504('0x44')](handleError(_0x4ab546,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 85ee33b..470e2f1 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 _0xa5fa=['exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x2e0bc0,_0xaad046){var _0x1ef34e=function(_0x36a59f){while(--_0x36a59f){_0x2e0bc0['push'](_0x2e0bc0['shift']());}};_0x1ef34e(++_0xaad046);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xa5fa[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var logger=require(_0xaa5f('0x1'))(_0xaa5f('0x2'));var moment=require(_0xaa5f('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa5f('0x4'));var fs=require('fs');var path=require(_0xaa5f('0x5'));var rimraf=require('rimraf');var config=require(_0xaa5f('0x6'));var attributes=require(_0xaa5f('0x7'));module[_0xaa5f('0x8')]=function(_0x20744d,_0x3d1489){return _0x20744d[_0xaa5f('0x9')](_0xaa5f('0xa'),attributes,{'tableName':_0xaa5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9354=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0x9354,0x96));var _0x4935=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x9354[_0xe719ec];return _0x4842a1;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('api');var moment=require(_0x4935('0x2'));var BPromise=require(_0x4935('0x3'));var rp=require(_0x4935('0x4'));var fs=require('fs');var path=require(_0x4935('0x5'));var rimraf=require('rimraf');var config=require(_0x4935('0x6'));var attributes=require(_0x4935('0x7'));module[_0x4935('0x8')]=function(_0x2d518a,_0x263864){return _0x2d518a[_0x4935('0x9')](_0x4935('0xa'),attributes,{'tableName':_0x4935('0xb'),'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 6adb75b..c76f475 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 _0xc703=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc703,0x8b));var _0x3c70=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0xc703[_0x35387d];return _0x3aba56;};'use strict';var _=require(_0x3c70('0x0'));var util=require('util');var moment=require(_0x3c70('0x1'));var BPromise=require(_0x3c70('0x2'));var rs=require(_0x3c70('0x3'));var fs=require('fs');var Redis=require(_0x3c70('0x4'));var db=require(_0x3c70('0x5'))['db'];var utils=require(_0x3c70('0x6'));var logger=require(_0x3c70('0x7'))(_0x3c70('0x8'));var config=require(_0x3c70('0x9'));var jayson=require(_0x3c70('0xa'));var client=jayson['client'][_0x3c70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3be6a2,_0xb4c57,_0x21d012){return new BPromise(function(_0x5bcfc5,_0xf0ff2f){return client[_0x3c70('0xc')](_0x3be6a2,_0x21d012)[_0x3c70('0xd')](function(_0x417e3c){logger[_0x3c70('0xe')](_0x3c70('0xf'),_0xb4c57,_0x3c70('0x10'));logger[_0x3c70('0x11')](_0x3c70('0x12'),_0xb4c57,'request\x20sent',JSON['stringify'](_0x417e3c));if(_0x417e3c[_0x3c70('0x13')]){if(_0x417e3c[_0x3c70('0x13')][_0x3c70('0x14')]===0x1f4){logger[_0x3c70('0x13')](_0x3c70('0xf'),_0xb4c57,_0x417e3c['error']['message']);return _0xf0ff2f(_0x417e3c['error'][_0x3c70('0x15')]);}logger[_0x3c70('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0xb4c57,_0x417e3c[_0x3c70('0x13')][_0x3c70('0x15')]);return _0x5bcfc5(_0x417e3c[_0x3c70('0x13')][_0x3c70('0x15')]);}else{logger['info'](_0x3c70('0xf'),_0xb4c57,_0x3c70('0x10'));_0x5bcfc5(_0x417e3c[_0x3c70('0x16')][_0x3c70('0x15')]);}})[_0x3c70('0x17')](function(_0x55bf71){logger[_0x3c70('0x13')](_0x3c70('0xf'),_0xb4c57,_0x55bf71);_0xf0ff2f(_0x55bf71);});});} \ No newline at end of file +var _0x44a1=['../../config/logger','../../config/environment','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0x44a1,0x1af));var _0x144a=function(_0x5c5a89,_0xa9db9b){_0x5c5a89=_0x5c5a89-0x0;var _0x415bb0=_0x44a1[_0x5c5a89];return _0x415bb0;};'use strict';var _=require(_0x144a('0x0'));var util=require(_0x144a('0x1'));var moment=require('moment');var BPromise=require(_0x144a('0x2'));var rs=require(_0x144a('0x3'));var fs=require('fs');var Redis=require(_0x144a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x144a('0x5'));var logger=require(_0x144a('0x6'))('rpc');var config=require(_0x144a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x144a('0x8')][_0x144a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48e6ff,_0x4a36fa,_0x54dff7){return new BPromise(function(_0x39fa39,_0xe6f3fe){return client[_0x144a('0xa')](_0x48e6ff,_0x54dff7)['then'](function(_0x5a683d){logger['info'](_0x144a('0xb'),_0x4a36fa,_0x144a('0xc'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4a36fa,_0x144a('0xc'),JSON[_0x144a('0xd')](_0x5a683d));if(_0x5a683d[_0x144a('0xe')]){if(_0x5a683d[_0x144a('0xe')][_0x144a('0xf')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x4a36fa,_0x5a683d[_0x144a('0xe')][_0x144a('0x10')]);return _0xe6f3fe(_0x5a683d[_0x144a('0xe')]['message']);}logger[_0x144a('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4a36fa,_0x5a683d['error']['message']);return _0x39fa39(_0x5a683d[_0x144a('0xe')][_0x144a('0x10')]);}else{logger[_0x144a('0x11')](_0x144a('0xb'),_0x4a36fa,_0x144a('0xc'));_0x39fa39(_0x5a683d['result']['message']);}})[_0x144a('0x12')](function(_0x3acb7f){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x4a36fa,_0x3acb7f);_0xe6f3fe(_0x3acb7f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index eb509e4..c672ed0 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 _0xcda0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','show','post','put','/:id','isAuthenticated','delete','destroy','exports','multer','path','express'];(function(_0x5d64ac,_0x46e6fa){var _0x2f5c48=function(_0x5b3a85){while(--_0x5b3a85){_0x5d64ac['push'](_0x5d64ac['shift']());}};_0x2f5c48(++_0x46e6fa);}(_0xcda0,0x10b));var _0x0cda=function(_0x2b6410,_0x4facf6){_0x2b6410=_0x2b6410-0x0;var _0x3ac69e=_0xcda0[_0x2b6410];return _0x3ac69e;};'use strict';var multer=require(_0x0cda('0x0'));var util=require('util');var path=require(_0x0cda('0x1'));var timeout=require('connect-timeout');var express=require(_0x0cda('0x2'));var router=express[_0x0cda('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0cda('0x4'));var interaction=require(_0x0cda('0x5'));var config=require(_0x0cda('0x6'));var controller=require(_0x0cda('0x7'));router[_0x0cda('0x8')]('/',auth['isAuthenticated'](),controller[_0x0cda('0x9')]);router[_0x0cda('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0cda('0xa')]);router[_0x0cda('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0cda('0xc')](_0x0cda('0xd'),auth[_0x0cda('0xe')](),controller['update']);router[_0x0cda('0xf')]('/:id',auth[_0x0cda('0xe')](),controller[_0x0cda('0x10')]);module[_0x0cda('0x11')]=router; \ No newline at end of file +var _0xa058=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x19c3e9,_0x54f261){var _0x55f997=function(_0x20da58){while(--_0x20da58){_0x19c3e9['push'](_0x19c3e9['shift']());}};_0x55f997(++_0x54f261);}(_0xa058,0x179));var _0x8a05=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xa058[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0x8a05('0x0'));var util=require(_0x8a05('0x1'));var path=require(_0x8a05('0x2'));var timeout=require('connect-timeout');var express=require(_0x8a05('0x3'));var router=express[_0x8a05('0x4')]();var fs_extra=require(_0x8a05('0x5'));var auth=require(_0x8a05('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8a05('0x7'));var controller=require(_0x8a05('0x8'));router[_0x8a05('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a05('0xa')]);router[_0x8a05('0x9')](_0x8a05('0xb'),auth[_0x8a05('0xc')](),controller[_0x8a05('0xd')]);router[_0x8a05('0xe')]('/',auth[_0x8a05('0xc')](),controller[_0x8a05('0xf')]);router[_0x8a05('0x10')](_0x8a05('0xb'),auth[_0x8a05('0xc')](),controller[_0x8a05('0x11')]);router['delete'](_0x8a05('0xb'),auth[_0x8a05('0xc')](),controller[_0x8a05('0x12')]);module[_0x8a05('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 b8b9026..0a16dbf 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 _0xe68c=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM'];(function(_0x43eb7d,_0x1aca18){var _0x1154ef=function(_0x1383fa){while(--_0x1383fa){_0x43eb7d['push'](_0x43eb7d['shift']());}};_0x1154ef(++_0x1aca18);}(_0xe68c,0x15f));var _0xce68=function(_0x1e67d0,_0x13b2c1){_0x1e67d0=_0x1e67d0-0x0;var _0x54f7de=_0xe68c[_0x1e67d0];return _0x54f7de;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xce68('0x0')](_0xce68('0x1'),_0xce68('0x2'),_0xce68('0x3'),_0xce68('0x4'),_0xce68('0x5')),'defaultValue':_0xce68('0x1')},'content':{'type':Sequelize[_0xce68('0x6')]},'key':{'type':Sequelize[_0xce68('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xce68('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xce68('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xce68('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce68('0x6')]}}; \ No newline at end of file +var _0x4f79=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x4f79,0x127));var _0x94f7=function(_0x35bc20,_0x10dcc3){_0x35bc20=_0x35bc20-0x0;var _0x2ada1b=_0x4f79[_0x35bc20];return _0x2ada1b;};'use strict';var Sequelize=require(_0x94f7('0x0'));module[_0x94f7('0x1')]={'type':{'type':Sequelize[_0x94f7('0x2')](_0x94f7('0x3'),_0x94f7('0x4'),_0x94f7('0x5'),_0x94f7('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x94f7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x94f7('0x4'),_0x94f7('0x5'))},'keyContent':{'type':Sequelize[_0x94f7('0x7')]},'idField':{'type':Sequelize[_0x94f7('0x7')]},'nameField':{'type':Sequelize[_0x94f7('0x7')]},'customField':{'type':Sequelize[_0x94f7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x94f7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1856506..1a9d028 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 _0xa122=['../../config/utils','../../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','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','catch','params','ZendeskField','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xa122,0x17b));var _0x2a12=function(_0x5c477c,_0x33ecc2){_0x5c477c=_0x5c477c-0x0;var _0x155770=_0xa122[_0x5c477c];return _0x155770;};'use strict';var emlformat=require(_0x2a12('0x0'));var rimraf=require(_0x2a12('0x1'));var zipdir=require(_0x2a12('0x2'));var jsonpatch=require(_0x2a12('0x3'));var rp=require(_0x2a12('0x4'));var moment=require(_0x2a12('0x5'));var BPromise=require(_0x2a12('0x6'));var Mustache=require(_0x2a12('0x7'));var util=require(_0x2a12('0x8'));var path=require(_0x2a12('0x9'));var sox=require(_0x2a12('0xa'));var csv=require(_0x2a12('0xb'));var ejs=require(_0x2a12('0xc'));var fs=require('fs');var fs_extra=require(_0x2a12('0xd'));var _=require(_0x2a12('0xe'));var squel=require(_0x2a12('0xf'));var crypto=require(_0x2a12('0x10'));var jsforce=require(_0x2a12('0x11'));var deskjs=require(_0x2a12('0x12'));var toCsv=require(_0x2a12('0xb'));var querystring=require(_0x2a12('0x13'));var Papa=require(_0x2a12('0x14'));var Redis=require('ioredis');var authService=require(_0x2a12('0x15'));var qs=require(_0x2a12('0x16'));var as=require(_0x2a12('0x17'));var hardwareService=require(_0x2a12('0x18'));var logger=require(_0x2a12('0x19'))('api');var utils=require(_0x2a12('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x2a12('0x1b'));var db=require(_0x2a12('0x1c'))['db'];function respondWithStatusCode(_0x565207,_0xdd4610){_0xdd4610=_0xdd4610||0xcc;return function(_0xc35fc8){if(_0xc35fc8){return _0x565207[_0x2a12('0x1d')](_0xdd4610);}return _0x565207['status'](_0xdd4610)[_0x2a12('0x1e')]();};}function respondWithResult(_0x4ce92e,_0x1e1744){_0x1e1744=_0x1e1744||0xc8;return function(_0xe3b615){if(_0xe3b615){return _0x4ce92e['status'](_0x1e1744)[_0x2a12('0x1f')](_0xe3b615);}};}function respondWithFilteredResult(_0x248cd2,_0x48c5ad){return function(_0x17a030){if(_0x17a030){var _0x321b8=typeof _0x48c5ad[_0x2a12('0x20')]==='undefined'&&typeof _0x48c5ad[_0x2a12('0x21')]==='undefined';var _0x42a4f1=_0x17a030[_0x2a12('0x22')];var _0x2cd758=_0x321b8?0x0:_0x48c5ad[_0x2a12('0x20')];var _0xc96506=_0x321b8?_0x17a030['count']:_0x48c5ad[_0x2a12('0x20')]+_0x48c5ad[_0x2a12('0x21')];var _0x4d120c;if(_0xc96506>=_0x42a4f1){_0xc96506=_0x42a4f1;_0x4d120c=0xc8;}else{_0x4d120c=0xce;}_0x248cd2[_0x2a12('0x23')](_0x4d120c);return _0x248cd2[_0x2a12('0x24')](_0x2a12('0x25'),_0x2cd758+'-'+_0xc96506+'/'+_0x42a4f1)[_0x2a12('0x1f')](_0x17a030);}return null;};}function patchUpdates(_0x56a45b){return function(_0x1f2b33){try{jsonpatch[_0x2a12('0x26')](_0x1f2b33,_0x56a45b,!![]);}catch(_0x150f42){return BPromise[_0x2a12('0x27')](_0x150f42);}return _0x1f2b33[_0x2a12('0x28')]();};}function saveUpdates(_0x1d7987,_0x5c0287){return function(_0x8b94d4){if(_0x8b94d4){return _0x8b94d4[_0x2a12('0x29')](_0x1d7987)[_0x2a12('0x2a')](function(_0x5bd1dc){return _0x5bd1dc;});}return null;};}function removeEntity(_0x1df4bc,_0x9ed63){return function(_0x6cd9de){if(_0x6cd9de){return _0x6cd9de[_0x2a12('0x2b')]()[_0x2a12('0x2a')](function(){_0x1df4bc[_0x2a12('0x23')](0xcc)[_0x2a12('0x1e')]();});}};}function handleEntityNotFound(_0x1dc836,_0x518033){return function(_0x978901){if(!_0x978901){_0x1dc836[_0x2a12('0x1d')](0x194);}return _0x978901;};}function handleError(_0x25bb19,_0x133469){_0x133469=_0x133469||0x1f4;return function(_0x3c8b00){logger[_0x2a12('0x2c')](_0x3c8b00[_0x2a12('0x2d')]);if(_0x3c8b00[_0x2a12('0x2e')]){delete _0x3c8b00[_0x2a12('0x2e')];}_0x25bb19['status'](_0x133469)[_0x2a12('0x2f')](_0x3c8b00);};}exports[_0x2a12('0x30')]=function(_0x430fde,_0x33ddb5){var _0x4d81ec={},_0x4514f9={},_0x17fc5f={'count':0x0,'rows':[]};var _0x40da86=_['map'](db['ZendeskField'][_0x2a12('0x31')],function(_0x3676cf){return{'name':_0x3676cf[_0x2a12('0x32')],'type':_0x3676cf[_0x2a12('0x33')][_0x2a12('0x34')]};});_0x4514f9[_0x2a12('0x35')]=_[_0x2a12('0x36')](_0x40da86,_0x2a12('0x2e'));_0x4514f9[_0x2a12('0x37')]=_[_0x2a12('0x38')](_0x430fde[_0x2a12('0x37')]);_0x4514f9['filters']=_[_0x2a12('0x39')](_0x4514f9[_0x2a12('0x35')],_0x4514f9[_0x2a12('0x37')]);_0x4d81ec[_0x2a12('0x3a')]=_[_0x2a12('0x39')](_0x4514f9[_0x2a12('0x35')],qs[_0x2a12('0x3b')](_0x430fde[_0x2a12('0x37')][_0x2a12('0x3b')]));_0x4d81ec['attributes']=_0x4d81ec[_0x2a12('0x3a')][_0x2a12('0x3c')]?_0x4d81ec[_0x2a12('0x3a')]:_0x4514f9[_0x2a12('0x35')];if(!_0x430fde[_0x2a12('0x37')][_0x2a12('0x3d')](_0x2a12('0x3e'))){_0x4d81ec['limit']=qs[_0x2a12('0x21')](_0x430fde[_0x2a12('0x37')]['limit']);_0x4d81ec[_0x2a12('0x20')]=qs[_0x2a12('0x20')](_0x430fde[_0x2a12('0x37')]['offset']);}_0x4d81ec[_0x2a12('0x3f')]=qs[_0x2a12('0x40')](_0x430fde[_0x2a12('0x37')][_0x2a12('0x40')]);_0x4d81ec[_0x2a12('0x41')]=qs['filters'](_[_0x2a12('0x42')](_0x430fde[_0x2a12('0x37')],_0x4514f9[_0x2a12('0x43')]),_0x40da86);if(_0x430fde[_0x2a12('0x37')][_0x2a12('0x44')]){_0x4d81ec[_0x2a12('0x41')]=_[_0x2a12('0x45')](_0x4d81ec[_0x2a12('0x41')],{'$or':_[_0x2a12('0x36')](_0x40da86,function(_0x3ba98c){if(_0x3ba98c[_0x2a12('0x33')]!==_0x2a12('0x46')){var _0x4187f2={};_0x4187f2[_0x3ba98c['name']]={'$like':'%'+_0x430fde[_0x2a12('0x37')][_0x2a12('0x44')]+'%'};return _0x4187f2;}})});}_0x4d81ec=_['merge']({},_0x4d81ec,_0x430fde[_0x2a12('0x47')]);var _0x43a05c={'where':_0x4d81ec[_0x2a12('0x41')]};return db['ZendeskField']['count'](_0x43a05c)[_0x2a12('0x2a')](function(_0x590b52){_0x17fc5f[_0x2a12('0x22')]=_0x590b52;if(_0x430fde[_0x2a12('0x37')]['includeAll']){_0x4d81ec[_0x2a12('0x48')]=[{'all':!![]}];}return db['ZendeskField'][_0x2a12('0x49')](_0x4d81ec);})[_0x2a12('0x2a')](function(_0x27d91a){_0x17fc5f['rows']=_0x27d91a;return _0x17fc5f;})[_0x2a12('0x2a')](respondWithFilteredResult(_0x33ddb5,_0x4d81ec))[_0x2a12('0x4a')](handleError(_0x33ddb5,null));};exports['show']=function(_0x59144e,_0x4b161d){var _0x3f9d8b={'raw':!![],'where':{'id':_0x59144e[_0x2a12('0x4b')]['id']}},_0x2e83e4={};_0x2e83e4[_0x2a12('0x35')]=_[_0x2a12('0x38')](db[_0x2a12('0x4c')]['rawAttributes']);_0x2e83e4[_0x2a12('0x37')]=_['keys'](_0x59144e['query']);_0x2e83e4['filters']=_[_0x2a12('0x39')](_0x2e83e4['model'],_0x2e83e4[_0x2a12('0x37')]);_0x3f9d8b[_0x2a12('0x3a')]=_['intersection'](_0x2e83e4[_0x2a12('0x35')],qs[_0x2a12('0x3b')](_0x59144e[_0x2a12('0x37')][_0x2a12('0x3b')]));_0x3f9d8b['attributes']=_0x3f9d8b[_0x2a12('0x3a')]['length']?_0x3f9d8b[_0x2a12('0x3a')]:_0x2e83e4[_0x2a12('0x35')];if(_0x59144e[_0x2a12('0x37')][_0x2a12('0x4d')]){_0x3f9d8b[_0x2a12('0x48')]=[{'all':!![]}];}_0x3f9d8b=_[_0x2a12('0x45')]({},_0x3f9d8b,_0x59144e[_0x2a12('0x47')]);return db[_0x2a12('0x4c')][_0x2a12('0x4e')](_0x3f9d8b)['then'](handleEntityNotFound(_0x4b161d,null))[_0x2a12('0x2a')](respondWithResult(_0x4b161d,null))[_0x2a12('0x4a')](handleError(_0x4b161d,null));};exports[_0x2a12('0x4f')]=function(_0x4824c5,_0x4209fa){return db[_0x2a12('0x4c')][_0x2a12('0x4f')](_0x4824c5[_0x2a12('0x50')],{})[_0x2a12('0x2a')](respondWithResult(_0x4209fa,0xc9))[_0x2a12('0x4a')](handleError(_0x4209fa,null));};exports[_0x2a12('0x29')]=function(_0x2ab91f,_0x450682){if(_0x2ab91f[_0x2a12('0x50')]['id']){delete _0x2ab91f[_0x2a12('0x50')]['id'];}return db['ZendeskField'][_0x2a12('0x4e')]({'where':{'id':_0x2ab91f[_0x2a12('0x4b')]['id']}})[_0x2a12('0x2a')](handleEntityNotFound(_0x450682,null))[_0x2a12('0x2a')](saveUpdates(_0x2ab91f[_0x2a12('0x50')],null))[_0x2a12('0x2a')](respondWithResult(_0x450682,null))['catch'](handleError(_0x450682,null));};exports[_0x2a12('0x2b')]=function(_0x4dc6d6,_0x4d43d4){return db[_0x2a12('0x4c')][_0x2a12('0x4e')]({'where':{'id':_0x4dc6d6[_0x2a12('0x4b')]['id']}})[_0x2a12('0x2a')](handleEntityNotFound(_0x4d43d4,null))[_0x2a12('0x2a')](removeEntity(_0x4d43d4,null))['catch'](handleError(_0x4d43d4,null));}; \ No newline at end of file +var _0x38f5=['crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','ZendeskField','rawAttributes','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3f7dfe,_0x218f69){var _0x3e10b0=function(_0x32bde5){while(--_0x32bde5){_0x3f7dfe['push'](_0x3f7dfe['shift']());}};_0x3e10b0(++_0x218f69);}(_0x38f5,0x89));var _0x538f=function(_0x72738c,_0x4a2111){_0x72738c=_0x72738c-0x0;var _0x312f95=_0x38f5[_0x72738c];return _0x312f95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x538f('0x0'));var zipdir=require(_0x538f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x538f('0x2'));var moment=require(_0x538f('0x3'));var BPromise=require(_0x538f('0x4'));var Mustache=require(_0x538f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x538f('0x6'));var csv=require(_0x538f('0x7'));var ejs=require(_0x538f('0x8'));var fs=require('fs');var fs_extra=require(_0x538f('0x9'));var _=require(_0x538f('0xa'));var squel=require('squel');var crypto=require(_0x538f('0xb'));var jsforce=require(_0x538f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x538f('0xd'));var Papa=require(_0x538f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x538f('0xf'));var as=require(_0x538f('0x10'));var hardwareService=require(_0x538f('0x11'));var logger=require(_0x538f('0x12'))('api');var utils=require(_0x538f('0x13'));var config=require(_0x538f('0x14'));var licenseUtil=require(_0x538f('0x15'));var db=require(_0x538f('0x16'))['db'];function respondWithStatusCode(_0x58ec83,_0x1572c8){_0x1572c8=_0x1572c8||0xcc;return function(_0x233360){if(_0x233360){return _0x58ec83[_0x538f('0x17')](_0x1572c8);}return _0x58ec83[_0x538f('0x18')](_0x1572c8)['end']();};}function respondWithResult(_0x547580,_0x1e7822){_0x1e7822=_0x1e7822||0xc8;return function(_0x522034){if(_0x522034){return _0x547580[_0x538f('0x18')](_0x1e7822)[_0x538f('0x19')](_0x522034);}};}function respondWithFilteredResult(_0x55fb7b,_0x22d8fe){return function(_0x9213b2){if(_0x9213b2){var _0x29b444=typeof _0x22d8fe['offset']===_0x538f('0x1a')&&typeof _0x22d8fe[_0x538f('0x1b')]===_0x538f('0x1a');var _0x3ce1a6=_0x9213b2['count'];var _0x4dd5b3=_0x29b444?0x0:_0x22d8fe[_0x538f('0x1c')];var _0x58e0f2=_0x29b444?_0x9213b2['count']:_0x22d8fe[_0x538f('0x1c')]+_0x22d8fe[_0x538f('0x1b')];var _0x266929;if(_0x58e0f2>=_0x3ce1a6){_0x58e0f2=_0x3ce1a6;_0x266929=0xc8;}else{_0x266929=0xce;}_0x55fb7b[_0x538f('0x18')](_0x266929);return _0x55fb7b[_0x538f('0x1d')](_0x538f('0x1e'),_0x4dd5b3+'-'+_0x58e0f2+'/'+_0x3ce1a6)['json'](_0x9213b2);}return null;};}function patchUpdates(_0x50cdc0){return function(_0x34e374){try{jsonpatch[_0x538f('0x1f')](_0x34e374,_0x50cdc0,!![]);}catch(_0x512837){return BPromise[_0x538f('0x20')](_0x512837);}return _0x34e374[_0x538f('0x21')]();};}function saveUpdates(_0x1ea973,_0x31c266){return function(_0x2355d7){if(_0x2355d7){return _0x2355d7[_0x538f('0x22')](_0x1ea973)[_0x538f('0x23')](function(_0x1c9110){return _0x1c9110;});}return null;};}function removeEntity(_0x58d4cf,_0x1a351f){return function(_0x482a20){if(_0x482a20){return _0x482a20['destroy']()[_0x538f('0x23')](function(){_0x58d4cf['status'](0xcc)[_0x538f('0x24')]();});}};}function handleEntityNotFound(_0xe28e8e,_0x2b22bc){return function(_0x58a060){if(!_0x58a060){_0xe28e8e[_0x538f('0x17')](0x194);}return _0x58a060;};}function handleError(_0x4a8852,_0x5ce971){_0x5ce971=_0x5ce971||0x1f4;return function(_0x290738){logger[_0x538f('0x25')](_0x290738[_0x538f('0x26')]);if(_0x290738[_0x538f('0x27')]){delete _0x290738['name'];}_0x4a8852[_0x538f('0x18')](_0x5ce971)['send'](_0x290738);};}exports[_0x538f('0x28')]=function(_0x2ba538,_0x547ed9){var _0x1ddd2f={},_0x35d912={},_0x5b3478={'count':0x0,'rows':[]};var _0x3d8ef4=_[_0x538f('0x29')](db[_0x538f('0x2a')][_0x538f('0x2b')],function(_0xb2afe9){return{'name':_0xb2afe9['fieldName'],'type':_0xb2afe9[_0x538f('0x2c')][_0x538f('0x2d')]};});_0x35d912['model']=_[_0x538f('0x29')](_0x3d8ef4,'name');_0x35d912[_0x538f('0x2e')]=_['keys'](_0x2ba538[_0x538f('0x2e')]);_0x35d912['filters']=_[_0x538f('0x2f')](_0x35d912['model'],_0x35d912[_0x538f('0x2e')]);_0x1ddd2f[_0x538f('0x30')]=_[_0x538f('0x2f')](_0x35d912[_0x538f('0x31')],qs[_0x538f('0x32')](_0x2ba538[_0x538f('0x2e')][_0x538f('0x32')]));_0x1ddd2f[_0x538f('0x30')]=_0x1ddd2f['attributes'][_0x538f('0x33')]?_0x1ddd2f[_0x538f('0x30')]:_0x35d912['model'];if(!_0x2ba538[_0x538f('0x2e')][_0x538f('0x34')](_0x538f('0x35'))){_0x1ddd2f[_0x538f('0x1b')]=qs[_0x538f('0x1b')](_0x2ba538[_0x538f('0x2e')]['limit']);_0x1ddd2f['offset']=qs['offset'](_0x2ba538[_0x538f('0x2e')][_0x538f('0x1c')]);}_0x1ddd2f[_0x538f('0x36')]=qs['sort'](_0x2ba538['query']['sort']);_0x1ddd2f[_0x538f('0x37')]=qs[_0x538f('0x38')](_[_0x538f('0x39')](_0x2ba538[_0x538f('0x2e')],_0x35d912[_0x538f('0x38')]),_0x3d8ef4);if(_0x2ba538[_0x538f('0x2e')][_0x538f('0x3a')]){_0x1ddd2f[_0x538f('0x37')]=_[_0x538f('0x3b')](_0x1ddd2f['where'],{'$or':_[_0x538f('0x29')](_0x3d8ef4,function(_0x1ff265){if(_0x1ff265[_0x538f('0x2c')]!=='VIRTUAL'){var _0x348e9a={};_0x348e9a[_0x1ff265['name']]={'$like':'%'+_0x2ba538[_0x538f('0x2e')]['filter']+'%'};return _0x348e9a;}})});}_0x1ddd2f=_[_0x538f('0x3b')]({},_0x1ddd2f,_0x2ba538[_0x538f('0x3c')]);var _0x17fd6c={'where':_0x1ddd2f[_0x538f('0x37')]};return db[_0x538f('0x2a')][_0x538f('0x3d')](_0x17fd6c)[_0x538f('0x23')](function(_0x45c775){_0x5b3478[_0x538f('0x3d')]=_0x45c775;if(_0x2ba538[_0x538f('0x2e')][_0x538f('0x3e')]){_0x1ddd2f[_0x538f('0x3f')]=[{'all':!![]}];}return db[_0x538f('0x2a')][_0x538f('0x40')](_0x1ddd2f);})[_0x538f('0x23')](function(_0x48670a){_0x5b3478[_0x538f('0x41')]=_0x48670a;return _0x5b3478;})[_0x538f('0x23')](respondWithFilteredResult(_0x547ed9,_0x1ddd2f))['catch'](handleError(_0x547ed9,null));};exports[_0x538f('0x42')]=function(_0x397e49,_0x4e4d0f){var _0x4e7ff7={'raw':!![],'where':{'id':_0x397e49[_0x538f('0x43')]['id']}},_0x28ed31={};_0x28ed31['model']=_['keys'](db[_0x538f('0x2a')]['rawAttributes']);_0x28ed31[_0x538f('0x2e')]=_[_0x538f('0x44')](_0x397e49[_0x538f('0x2e')]);_0x28ed31['filters']=_['intersection'](_0x28ed31[_0x538f('0x31')],_0x28ed31[_0x538f('0x2e')]);_0x4e7ff7['attributes']=_[_0x538f('0x2f')](_0x28ed31[_0x538f('0x31')],qs[_0x538f('0x32')](_0x397e49[_0x538f('0x2e')]['fields']));_0x4e7ff7[_0x538f('0x30')]=_0x4e7ff7['attributes']['length']?_0x4e7ff7[_0x538f('0x30')]:_0x28ed31[_0x538f('0x31')];if(_0x397e49['query'][_0x538f('0x3e')]){_0x4e7ff7[_0x538f('0x3f')]=[{'all':!![]}];}_0x4e7ff7=_[_0x538f('0x3b')]({},_0x4e7ff7,_0x397e49[_0x538f('0x3c')]);return db[_0x538f('0x2a')][_0x538f('0x45')](_0x4e7ff7)[_0x538f('0x23')](handleEntityNotFound(_0x4e4d0f,null))['then'](respondWithResult(_0x4e4d0f,null))['catch'](handleError(_0x4e4d0f,null));};exports[_0x538f('0x46')]=function(_0x2fb350,_0x4f326b){return db[_0x538f('0x2a')][_0x538f('0x46')](_0x2fb350[_0x538f('0x47')],{})[_0x538f('0x23')](respondWithResult(_0x4f326b,0xc9))[_0x538f('0x48')](handleError(_0x4f326b,null));};exports['update']=function(_0x20dbe2,_0x132ad4){if(_0x20dbe2[_0x538f('0x47')]['id']){delete _0x20dbe2['body']['id'];}return db[_0x538f('0x2a')][_0x538f('0x45')]({'where':{'id':_0x20dbe2[_0x538f('0x43')]['id']}})[_0x538f('0x23')](handleEntityNotFound(_0x132ad4,null))[_0x538f('0x23')](saveUpdates(_0x20dbe2[_0x538f('0x47')],null))[_0x538f('0x23')](respondWithResult(_0x132ad4,null))['catch'](handleError(_0x132ad4,null));};exports[_0x538f('0x49')]=function(_0x186a71,_0x246b55){return db[_0x538f('0x2a')][_0x538f('0x45')]({'where':{'id':_0x186a71[_0x538f('0x43')]['id']}})[_0x538f('0x23')](handleEntityNotFound(_0x246b55,null))[_0x538f('0x23')](removeEntity(_0x246b55,null))[_0x538f('0x48')](handleError(_0x246b55,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 62beda9..1194a95 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 _0x0776=['int_zendesk_fields','zendesk_unique_index','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','exports','define','ZendeskField'];(function(_0x493c7a,_0x30ea93){var _0x1ad499=function(_0x5c8318){while(--_0x5c8318){_0x493c7a['push'](_0x493c7a['shift']());}};_0x1ad499(++_0x30ea93);}(_0x0776,0x12b));var _0x6077=function(_0x2aed51,_0xff737){_0x2aed51=_0x2aed51-0x0;var _0x292cfb=_0x0776[_0x2aed51];return _0x292cfb;};'use strict';var _=require(_0x6077('0x0'));var util=require('util');var logger=require(_0x6077('0x1'))('api');var moment=require(_0x6077('0x2'));var BPromise=require(_0x6077('0x3'));var rp=require(_0x6077('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6077('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x6077('0x6')]=function(_0x18f055,_0x24e44d){return _0x18f055[_0x6077('0x7')](_0x6077('0x8'),attributes,{'tableName':_0x6077('0x9'),'paranoid':![],'indexes':[{'name':_0x6077('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe453=['int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','ZendeskField'];(function(_0x48c021,_0x454d7a){var _0x1ccc17=function(_0x49f087){while(--_0x49f087){_0x48c021['push'](_0x48c021['shift']());}};_0x1ccc17(++_0x454d7a);}(_0xe453,0xfa));var _0x3e45=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe453[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x3e45('0x0'));var util=require(_0x3e45('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3e45('0x2'));var BPromise=require(_0x3e45('0x3'));var rp=require(_0x3e45('0x4'));var fs=require('fs');var path=require(_0x3e45('0x5'));var rimraf=require('rimraf');var config=require(_0x3e45('0x6'));var attributes=require(_0x3e45('0x7'));module[_0x3e45('0x8')]=function(_0x33215a,_0x19ca00){return _0x33215a['define'](_0x3e45('0x9'),attributes,{'tableName':_0x3e45('0xa'),'paranoid':![],'indexes':[{'name':_0x3e45('0xb'),'fields':['idField',_0x3e45('0xc')],'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 7aebdd1..da5ef5e 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 _0xa8ba=['http','request','then','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x225a8a,_0x458626){var _0x57a4cd=function(_0x54bbb8){while(--_0x54bbb8){_0x225a8a['push'](_0x225a8a['shift']());}};_0x57a4cd(++_0x458626);}(_0xa8ba,0x17d));var _0xaa8b=function(_0x4720da,_0x1504f6){_0x4720da=_0x4720da-0x0;var _0x51bc78=_0xa8ba[_0x4720da];return _0x51bc78;};'use strict';var _=require('lodash');var util=require(_0xaa8b('0x0'));var moment=require(_0xaa8b('0x1'));var BPromise=require(_0xaa8b('0x2'));var rs=require(_0xaa8b('0x3'));var fs=require('fs');var Redis=require(_0xaa8b('0x4'));var db=require(_0xaa8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa8b('0x6'))('rpc');var config=require(_0xaa8b('0x7'));var jayson=require(_0xaa8b('0x8'));var client=jayson[_0xaa8b('0x9')][_0xaa8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d7857,_0x2e40ae,_0x2a83e9){return new BPromise(function(_0x5ac31f,_0x4f90e6){return client[_0xaa8b('0xb')](_0x5d7857,_0x2a83e9)[_0xaa8b('0xc')](function(_0x3706a6){logger['info'](_0xaa8b('0xd'),_0x2e40ae,'request\x20sent');logger['debug'](_0xaa8b('0xe'),_0x2e40ae,'request\x20sent',JSON[_0xaa8b('0xf')](_0x3706a6));if(_0x3706a6[_0xaa8b('0x10')]){if(_0x3706a6[_0xaa8b('0x10')][_0xaa8b('0x11')]===0x1f4){logger['error'](_0xaa8b('0xd'),_0x2e40ae,_0x3706a6[_0xaa8b('0x10')][_0xaa8b('0x12')]);return _0x4f90e6(_0x3706a6[_0xaa8b('0x10')][_0xaa8b('0x12')]);}logger[_0xaa8b('0x10')](_0xaa8b('0xd'),_0x2e40ae,_0x3706a6[_0xaa8b('0x10')]['message']);return _0x5ac31f(_0x3706a6[_0xaa8b('0x10')]['message']);}else{logger[_0xaa8b('0x13')]('ZendeskField,\x20%s,\x20%s',_0x2e40ae,_0xaa8b('0x14'));_0x5ac31f(_0x3706a6[_0xaa8b('0x15')]['message']);}})[_0xaa8b('0x16')](function(_0x268b29){logger[_0xaa8b('0x10')]('ZendeskField,\x20%s,\x20%s',_0x2e40ae,_0x268b29);_0x4f90e6(_0x268b29);});});} \ No newline at end of file +var _0x6882=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x6882,0x6e));var _0x2688=function(_0x791fb,_0x4f41ae){_0x791fb=_0x791fb-0x0;var _0x34e310=_0x6882[_0x791fb];return _0x34e310;};'use strict';var _=require('lodash');var util=require(_0x2688('0x0'));var moment=require(_0x2688('0x1'));var BPromise=require(_0x2688('0x2'));var rs=require(_0x2688('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2688('0x4'))['db'];var utils=require(_0x2688('0x5'));var logger=require(_0x2688('0x6'))('rpc');var config=require(_0x2688('0x7'));var jayson=require(_0x2688('0x8'));var client=jayson[_0x2688('0x9')][_0x2688('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f29e3,_0x5aa281,_0x1d4cf8){return new BPromise(function(_0x3b4c77,_0x2963b6){return client[_0x2688('0xb')](_0x1f29e3,_0x1d4cf8)[_0x2688('0xc')](function(_0x1aa440){logger['info'](_0x2688('0xd'),_0x5aa281,'request\x20sent');logger[_0x2688('0xe')](_0x2688('0xf'),_0x5aa281,_0x2688('0x10'),JSON[_0x2688('0x11')](_0x1aa440));if(_0x1aa440[_0x2688('0x12')]){if(_0x1aa440[_0x2688('0x12')][_0x2688('0x13')]===0x1f4){logger[_0x2688('0x12')]('ZendeskField,\x20%s,\x20%s',_0x5aa281,_0x1aa440[_0x2688('0x12')][_0x2688('0x14')]);return _0x2963b6(_0x1aa440['error']['message']);}logger[_0x2688('0x12')](_0x2688('0xd'),_0x5aa281,_0x1aa440[_0x2688('0x12')]['message']);return _0x3b4c77(_0x1aa440['error']['message']);}else{logger[_0x2688('0x15')](_0x2688('0xd'),_0x5aa281,'request\x20sent');_0x3b4c77(_0x1aa440['result'][_0x2688('0x14')]);}})['catch'](function(_0x166e11){logger[_0x2688('0x12')](_0x2688('0xd'),_0x5aa281,_0x166e11);_0x2963b6(_0x166e11);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9509c9c..5244fea 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 _0x483b=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e1e70,_0x298066){var _0x135bad=function(_0x575a52){while(--_0x575a52){_0x4e1e70['push'](_0x4e1e70['shift']());}};_0x135bad(++_0x298066);}(_0x483b,0x1f1));var _0xb483=function(_0x5c0baf,_0xf0e17){_0x5c0baf=_0x5c0baf-0x0;var _0x492f8d=_0x483b[_0x5c0baf];return _0x492f8d;};'use strict';var multer=require(_0xb483('0x0'));var util=require(_0xb483('0x1'));var path=require(_0xb483('0x2'));var timeout=require(_0xb483('0x3'));var express=require('express');var router=express[_0xb483('0x4')]();var fs_extra=require(_0xb483('0x5'));var auth=require(_0xb483('0x6'));var interaction=require(_0xb483('0x7'));var config=require(_0xb483('0x8'));var controller=require('./intZohoAccount.controller');router[_0xb483('0x9')]('/',auth[_0xb483('0xa')](),controller[_0xb483('0xb')]);router['get'](_0xb483('0xc'),auth[_0xb483('0xa')](),controller[_0xb483('0xd')]);router['get'](_0xb483('0xe'),auth[_0xb483('0xa')](),controller[_0xb483('0xf')]);router[_0xb483('0x9')](_0xb483('0x10'),auth[_0xb483('0xa')](),controller['getFields']);router[_0xb483('0x11')]('/',auth['isAuthenticated'](),controller[_0xb483('0x12')]);router[_0xb483('0x11')]('/:id/configurations',auth[_0xb483('0xa')](),controller['addConfiguration']);router[_0xb483('0x13')](_0xb483('0xc'),auth[_0xb483('0xa')](),controller[_0xb483('0x14')]);router['delete'](_0xb483('0xc'),auth[_0xb483('0xa')](),controller[_0xb483('0x15')]);module[_0xb483('0x16')]=router; \ No newline at end of file +var _0xe51a=['fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0xa55ff,_0x4fbcbe){var _0x5b18ef=function(_0x5707b1){while(--_0x5707b1){_0xa55ff['push'](_0xa55ff['shift']());}};_0x5b18ef(++_0x4fbcbe);}(_0xe51a,0x133));var _0xae51=function(_0x158910,_0x56b910){_0x158910=_0x158910-0x0;var _0x1726b4=_0xe51a[_0x158910];return _0x1726b4;};'use strict';var multer=require('multer');var util=require(_0xae51('0x0'));var path=require(_0xae51('0x1'));var timeout=require(_0xae51('0x2'));var express=require(_0xae51('0x3'));var router=express[_0xae51('0x4')]();var fs_extra=require(_0xae51('0x5'));var auth=require(_0xae51('0x6'));var interaction=require(_0xae51('0x7'));var config=require('../../config/environment');var controller=require(_0xae51('0x8'));router[_0xae51('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xae51('0x9')](_0xae51('0xa'),auth[_0xae51('0xb')](),controller[_0xae51('0xc')]);router[_0xae51('0x9')](_0xae51('0xd'),auth[_0xae51('0xb')](),controller[_0xae51('0xe')]);router[_0xae51('0x9')](_0xae51('0xf'),auth[_0xae51('0xb')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xae51('0x10')]);router[_0xae51('0x11')](_0xae51('0xd'),auth['isAuthenticated'](),controller[_0xae51('0x12')]);router[_0xae51('0x13')](_0xae51('0xa'),auth[_0xae51('0xb')](),controller[_0xae51('0x14')]);router[_0xae51('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xae51('0x16')]);module[_0xae51('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 518aa86..b07169b 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 _0x22fb=['STRING'];(function(_0x15f6e2,_0x25c342){var _0x39688f=function(_0x382563){while(--_0x382563){_0x15f6e2['push'](_0x15f6e2['shift']());}};_0x39688f(++_0x25c342);}(_0x22fb,0x192));var _0xb22f=function(_0x11f90a,_0x33204e){_0x11f90a=_0x11f90a-0x0;var _0x21c310=_0x22fb[_0x11f90a];return _0x21c310;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb22f('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb22f('0x0')]},'zone':{'type':Sequelize[_0xb22f('0x0')]},'clientId':{'type':Sequelize[_0xb22f('0x0')]},'clientSecret':{'type':Sequelize[_0xb22f('0x0')]},'serverUrl':{'type':Sequelize[_0xb22f('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb22f('0x0')]}}; \ No newline at end of file +var _0x6f0d=['exports','STRING'];(function(_0x42c5f4,_0x470d0d){var _0x30b4ca=function(_0x3cc2f1){while(--_0x3cc2f1){_0x42c5f4['push'](_0x42c5f4['shift']());}};_0x30b4ca(++_0x470d0d);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x34c54d,_0x357ece){_0x34c54d=_0x34c54d-0x0;var _0x557f9a=_0x6f0d[_0x34c54d];return _0x557f9a;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'name':{'type':Sequelize[_0xd6f0('0x1')]},'description':{'type':Sequelize[_0xd6f0('0x1')]},'host':{'type':Sequelize[_0xd6f0('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd6f0('0x1')]},'clientSecret':{'type':Sequelize[_0xd6f0('0x1')]},'serverUrl':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xd6f0('0x1')]},'refreshToken':{'type':Sequelize[_0xd6f0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5b5f77b..6a0c132 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 _0x94d7=['../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','include','findAll','rows','catch','params','includeAll','find','create','body','findOne','ZohoConfiguration','merge','hasOwnProperty','getConfigurations','addConfiguration','AccountId','channel','ZohoField','Subjects','Descriptions','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','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','slice','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x94d7,0x15b));var _0x794d=function(_0x5891e1,_0x3f485d){_0x5891e1=_0x5891e1-0x0;var _0x50f846=_0x94d7[_0x5891e1];return _0x50f846;};'use strict';var emlformat=require(_0x794d('0x0'));var rimraf=require(_0x794d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x794d('0x2'));var rp=require(_0x794d('0x3'));var moment=require(_0x794d('0x4'));var BPromise=require(_0x794d('0x5'));var Mustache=require('mustache');var util=require(_0x794d('0x6'));var path=require(_0x794d('0x7'));var sox=require(_0x794d('0x8'));var csv=require('to-csv');var ejs=require(_0x794d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x794d('0xa'));var squel=require('squel');var crypto=require(_0x794d('0xb'));var jsforce=require(_0x794d('0xc'));var deskjs=require(_0x794d('0xd'));var toCsv=require(_0x794d('0xe'));var querystring=require(_0x794d('0xf'));var Papa=require(_0x794d('0x10'));var Redis=require('ioredis');var authService=require(_0x794d('0x11'));var qs=require(_0x794d('0x12'));var as=require(_0x794d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x794d('0x14'))(_0x794d('0x15'));var utils=require(_0x794d('0x16'));var config=require(_0x794d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x794d('0x18'))['db'];var integrations=require(_0x794d('0x19'));function respondWithStatusCode(_0x2d5c11,_0x32ca0e){_0x32ca0e=_0x32ca0e||0xcc;return function(_0x46ec53){if(_0x46ec53){return _0x2d5c11[_0x794d('0x1a')](_0x32ca0e);}return _0x2d5c11[_0x794d('0x1b')](_0x32ca0e)[_0x794d('0x1c')]();};}function respondWithResult(_0x30ca44,_0x1b7bb8){_0x1b7bb8=_0x1b7bb8||0xc8;return function(_0x252a81){if(_0x252a81){return _0x30ca44[_0x794d('0x1b')](_0x1b7bb8)[_0x794d('0x1d')](_0x252a81);}};}function respondWithFilteredResult(_0x112344,_0x303e18){return function(_0x596fbe){if(_0x596fbe){var _0x43dbe5=typeof _0x303e18['offset']===_0x794d('0x1e')&&typeof _0x303e18['limit']===_0x794d('0x1e');var _0xd91098=_0x596fbe[_0x794d('0x1f')];var _0x3bb322=_0x43dbe5?0x0:_0x303e18[_0x794d('0x20')];var _0x5ce567=_0x43dbe5?_0x596fbe['count']:_0x303e18[_0x794d('0x20')]+_0x303e18[_0x794d('0x21')];var _0x213795;if(_0x5ce567>=_0xd91098){_0x5ce567=_0xd91098;_0x213795=0xc8;}else{_0x213795=0xce;}_0x112344['status'](_0x213795);return _0x112344['set'](_0x794d('0x22'),_0x3bb322+'-'+_0x5ce567+'/'+_0xd91098)[_0x794d('0x1d')](_0x596fbe);}return null;};}function patchUpdates(_0x17186c){return function(_0x1aebaa){try{jsonpatch['apply'](_0x1aebaa,_0x17186c,!![]);}catch(_0x4b5857){return BPromise[_0x794d('0x23')](_0x4b5857);}return _0x1aebaa[_0x794d('0x24')]();};}function saveUpdates(_0x86b1e6,_0x4022a3){return function(_0x56ef8d){if(_0x56ef8d){return _0x56ef8d[_0x794d('0x25')](_0x86b1e6)[_0x794d('0x26')](function(_0x19655b){return _0x19655b;});}return null;};}function removeEntity(_0x2b58ef,_0x49073e){return function(_0x559fe2){if(_0x559fe2){return _0x559fe2[_0x794d('0x27')]()[_0x794d('0x26')](function(){_0x2b58ef[_0x794d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe9e0e2,_0xcd0d50){return function(_0x5f4bb4){if(!_0x5f4bb4){_0xe9e0e2[_0x794d('0x1a')](0x194);}return _0x5f4bb4;};}function handleError(_0xed92e7,_0x140bca){_0x140bca=_0x140bca||0x1f4;return function(_0x3ef8b1){logger[_0x794d('0x28')](_0x3ef8b1[_0x794d('0x29')]);if(_0x3ef8b1['name']){delete _0x3ef8b1[_0x794d('0x2a')];}_0xed92e7[_0x794d('0x1b')](_0x140bca)[_0x794d('0x2b')](_0x3ef8b1);};}exports['index']=function(_0x1e7772,_0x23bc23){var _0x250a7e={},_0x51632e={},_0x5bc943={'count':0x0,'rows':[]};var _0x3e64d3=_[_0x794d('0x2c')](db[_0x794d('0x2d')][_0x794d('0x2e')],function(_0x53236e){return{'name':_0x53236e[_0x794d('0x2f')],'type':_0x53236e[_0x794d('0x30')][_0x794d('0x31')]};});_0x51632e[_0x794d('0x32')]=_['map'](_0x3e64d3,_0x794d('0x2a'));_0x51632e['query']=_[_0x794d('0x33')](_0x1e7772[_0x794d('0x34')]);_0x51632e[_0x794d('0x35')]=_['intersection'](_0x51632e[_0x794d('0x32')],_0x51632e[_0x794d('0x34')]);_0x250a7e[_0x794d('0x36')]=_[_0x794d('0x37')](_0x51632e[_0x794d('0x32')],qs[_0x794d('0x38')](_0x1e7772[_0x794d('0x34')]['fields']));_0x250a7e[_0x794d('0x36')]=_0x250a7e['attributes'][_0x794d('0x39')]?_0x250a7e['attributes']:_0x51632e[_0x794d('0x32')];if(!_0x1e7772['query']['hasOwnProperty'](_0x794d('0x3a'))){_0x250a7e[_0x794d('0x21')]=qs['limit'](_0x1e7772[_0x794d('0x34')][_0x794d('0x21')]);_0x250a7e['offset']=qs['offset'](_0x1e7772[_0x794d('0x34')][_0x794d('0x20')]);}_0x250a7e[_0x794d('0x3b')]=qs[_0x794d('0x3c')](_0x1e7772[_0x794d('0x34')][_0x794d('0x3c')]);_0x250a7e[_0x794d('0x3d')]=qs['filters'](_[_0x794d('0x3e')](_0x1e7772['query'],_0x51632e[_0x794d('0x35')]),_0x3e64d3);if(_0x1e7772[_0x794d('0x34')]['filter']){_0x250a7e[_0x794d('0x3d')]=_['merge'](_0x250a7e[_0x794d('0x3d')],{'$or':_[_0x794d('0x2c')](_0x3e64d3,function(_0x50ea55){if(_0x50ea55['type']!==_0x794d('0x3f')){var _0x452f93={};_0x452f93[_0x50ea55['name']]={'$like':'%'+_0x1e7772[_0x794d('0x34')][_0x794d('0x40')]+'%'};return _0x452f93;}})});}_0x250a7e=_['merge']({},_0x250a7e,_0x1e7772['options']);var _0x5deff7={'where':_0x250a7e[_0x794d('0x3d')]};return db[_0x794d('0x2d')][_0x794d('0x1f')](_0x5deff7)[_0x794d('0x26')](function(_0x23ace5){_0x5bc943[_0x794d('0x1f')]=_0x23ace5;if(_0x1e7772[_0x794d('0x34')]['includeAll']){_0x250a7e[_0x794d('0x41')]=[{'all':!![]}];}return db['ZohoAccount'][_0x794d('0x42')](_0x250a7e);})[_0x794d('0x26')](function(_0x42042a){_0x5bc943[_0x794d('0x43')]=_0x42042a;return _0x5bc943;})[_0x794d('0x26')](respondWithFilteredResult(_0x23bc23,_0x250a7e))[_0x794d('0x44')](handleError(_0x23bc23,null));};exports['show']=function(_0x9a8a68,_0x36538f){var _0x320e0a={'raw':![],'where':{'id':_0x9a8a68[_0x794d('0x45')]['id']}},_0x559e87={};_0x559e87[_0x794d('0x32')]=_[_0x794d('0x33')](db[_0x794d('0x2d')]['rawAttributes']);_0x559e87[_0x794d('0x34')]=_[_0x794d('0x33')](_0x9a8a68[_0x794d('0x34')]);_0x559e87['filters']=_[_0x794d('0x37')](_0x559e87['model'],_0x559e87[_0x794d('0x34')]);_0x320e0a[_0x794d('0x36')]=_['intersection'](_0x559e87['model'],qs['fields'](_0x9a8a68['query'][_0x794d('0x38')]));_0x320e0a['attributes']=_0x320e0a[_0x794d('0x36')][_0x794d('0x39')]?_0x320e0a['attributes']:_0x559e87[_0x794d('0x32')];if(_0x9a8a68[_0x794d('0x34')][_0x794d('0x46')]){_0x320e0a[_0x794d('0x41')]=[{'all':!![]}];}_0x320e0a=_['merge']({},_0x320e0a,_0x9a8a68['options']);return db[_0x794d('0x2d')][_0x794d('0x47')](_0x320e0a)[_0x794d('0x26')](handleEntityNotFound(_0x36538f,null))[_0x794d('0x26')](respondWithResult(_0x36538f,null))[_0x794d('0x44')](handleError(_0x36538f,null));};exports[_0x794d('0x48')]=function(_0x3a8eef,_0x485ab){return db['ZohoAccount'][_0x794d('0x48')](_0x3a8eef[_0x794d('0x49')],{})[_0x794d('0x26')](respondWithResult(_0x485ab,0xc9))['catch'](handleError(_0x485ab,null));};exports[_0x794d('0x25')]=function(_0x5c2769,_0x818c1f){if(_0x5c2769[_0x794d('0x49')]['id']){delete _0x5c2769['body']['id'];}return db[_0x794d('0x2d')][_0x794d('0x47')]({'where':{'id':_0x5c2769[_0x794d('0x45')]['id']}})[_0x794d('0x26')](handleEntityNotFound(_0x818c1f,null))[_0x794d('0x26')](saveUpdates(_0x5c2769[_0x794d('0x49')],null))[_0x794d('0x26')](respondWithResult(_0x818c1f,null))['catch'](handleError(_0x818c1f,null));};exports[_0x794d('0x27')]=function(_0x15a390,_0x53ce39){return db[_0x794d('0x2d')][_0x794d('0x47')]({'where':{'id':_0x15a390[_0x794d('0x45')]['id']}})['then'](handleEntityNotFound(_0x53ce39,null))[_0x794d('0x26')](removeEntity(_0x53ce39,null))[_0x794d('0x44')](handleError(_0x53ce39,null));};exports['getConfigurations']=function(_0x5b24bd,_0x2728bc,_0x3d02b9){var _0x80c9e3={};var _0xcbbf6={};var _0x22da09;var _0xbac0db;return db['ZohoAccount'][_0x794d('0x4a')]({'where':{'id':_0x5b24bd[_0x794d('0x45')]['id']}})[_0x794d('0x26')](handleEntityNotFound(_0x2728bc,null))[_0x794d('0x26')](function(_0x49d49a){if(_0x49d49a){_0x22da09=_0x49d49a;_0xcbbf6[_0x794d('0x32')]=_[_0x794d('0x33')](db[_0x794d('0x4b')][_0x794d('0x2e')]);_0xcbbf6['query']=_['keys'](_0x5b24bd[_0x794d('0x34')]);_0xcbbf6[_0x794d('0x35')]=_[_0x794d('0x37')](_0xcbbf6[_0x794d('0x32')],_0xcbbf6['query']);_0x80c9e3[_0x794d('0x36')]=_[_0x794d('0x37')](_0xcbbf6['model'],qs[_0x794d('0x38')](_0x5b24bd[_0x794d('0x34')][_0x794d('0x38')]));_0x80c9e3['attributes']=_0x80c9e3[_0x794d('0x36')][_0x794d('0x39')]?_0x80c9e3[_0x794d('0x36')]:_0xcbbf6['model'];_0x80c9e3[_0x794d('0x3b')]=qs['sort'](_0x5b24bd[_0x794d('0x34')][_0x794d('0x3c')]);_0x80c9e3['where']=qs[_0x794d('0x35')](_['pick'](_0x5b24bd['query'],_0xcbbf6[_0x794d('0x35')]));if(_0x5b24bd[_0x794d('0x34')]['filter']){_0x80c9e3[_0x794d('0x3d')]=_[_0x794d('0x4c')](_0x80c9e3['where'],{'$or':_[_0x794d('0x2c')](_0x80c9e3[_0x794d('0x36')],function(_0x3cfebd){var _0x253ab3={};_0x253ab3[_0x3cfebd]={'$like':'%'+_0x5b24bd[_0x794d('0x34')][_0x794d('0x40')]+'%'};return _0x253ab3;})});}_0x80c9e3=_['merge']({},_0x80c9e3,_0x5b24bd['options']);return _0x22da09['getConfigurations'](_0x80c9e3);}})['then'](function(_0x6f48da){if(_0x6f48da){_0xbac0db=_0x6f48da[_0x794d('0x39')];if(!_0x5b24bd[_0x794d('0x34')][_0x794d('0x4d')](_0x794d('0x3a'))){_0x80c9e3['limit']=qs[_0x794d('0x21')](_0x5b24bd[_0x794d('0x34')][_0x794d('0x21')]);_0x80c9e3['offset']=qs['offset'](_0x5b24bd[_0x794d('0x34')][_0x794d('0x20')]);}return _0x22da09[_0x794d('0x4e')](_0x80c9e3);}})[_0x794d('0x26')](function(_0x3642ec){if(_0x3642ec){return _0x3642ec?{'count':_0xbac0db,'rows':_0x3642ec}:null;}})[_0x794d('0x26')](respondWithResult(_0x2728bc,null))[_0x794d('0x44')](handleError(_0x2728bc,null));};exports[_0x794d('0x4f')]=function(_0xbdca12,_0x3fd039,_0x2aec36){if(_0xbdca12['body']['id']){delete _0xbdca12[_0x794d('0x49')]['id'];}return db['ZohoAccount'][_0x794d('0x4a')]({'where':{'id':_0xbdca12[_0x794d('0x45')]['id']}})[_0x794d('0x26')](handleEntityNotFound(_0x3fd039,null))[_0x794d('0x26')](function(_0x341d66){if(_0x341d66){_0xbdca12[_0x794d('0x49')][_0x794d('0x50')]=_0x341d66['id'];_0xbdca12[_0x794d('0x49')]['Subjects']=integrations['getSubjects'](_0xbdca12[_0x794d('0x49')]['channel'],_0xbdca12[_0x794d('0x49')][_0x794d('0x30')]);_0xbdca12[_0x794d('0x49')]['Descriptions']=integrations['getDescriptions'](_0xbdca12[_0x794d('0x49')][_0x794d('0x51')],_0xbdca12[_0x794d('0x49')]['type']);return db['ZohoConfiguration'][_0x794d('0x48')](_0xbdca12[_0x794d('0x49')],{'include':[{'model':db[_0x794d('0x52')],'as':_0x794d('0x53')},{'model':db['ZohoField'],'as':_0x794d('0x54')}]});}return null;})['then'](respondWithResult(_0x3fd039,null))[_0x794d('0x44')](handleError(_0x3fd039,null));};function getAccessToken(_0x58b522){return new Promise(function(_0x278087,_0x26d7a7){var _0x34bfe1;switch(_0x58b522['zone']){case'US':_0x34bfe1=_0x794d('0x55');break;case'AU':_0x34bfe1=_0x794d('0x56');break;case'EU':_0x34bfe1='https://accounts.zoho.eu';break;case'IN':_0x34bfe1=_0x794d('0x57');break;case'CN':_0x34bfe1=_0x794d('0x58');break;default:_0x34bfe1=_0x794d('0x59');break;}var _0xd95146={'method':_0x794d('0x5a'),'uri':_0x34bfe1+_0x794d('0x5b'),'qs':{'refresh_token':_0x58b522[_0x794d('0x5c')],'client_id':_0x58b522[_0x794d('0x5d')],'client_secret':_0x58b522[_0x794d('0x5e')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xd95146)[_0x794d('0x26')](function(_0x3af49b){if(_0x3af49b[_0x794d('0x5f')]){_0x278087(_0x3af49b[_0x794d('0x5f')]);}else{_0x26d7a7(_0x794d('0x60'));}})['catch'](function(_0x330ea6){_0x26d7a7(_0x330ea6);});});}exports['getFields']=function(_0xfd4cc6,_0x513fc5,_0x208949){var _0x3dc073,_0x5dd840,_0xf38b70,_0xf8fc41,_0x5d6f79;return db['ZohoAccount'][_0x794d('0x4a')]({'where':{'id':_0xfd4cc6[_0x794d('0x45')]['id']},'attributes':['id',_0x794d('0x61'),'zone',_0x794d('0x5d'),_0x794d('0x5e'),_0x794d('0x62'),_0x794d('0x63'),_0x794d('0x5c')]})['then'](handleEntityNotFound(_0x513fc5,null))['then'](function(_0x4ca1a1){_0x5d6f79=_0x4ca1a1;_0x3dc073=_0x5d6f79[_0x794d('0x61')];_0x5dd840=_0x3dc073===_0x794d('0x64')?'eu':'com';_0xf38b70=_0x5d6f79['serverUrl'];var _0x500473=_0xf38b70[_0x794d('0x65')](-0x1);if(_0x500473==='/'||_0x500473==='\x5c'||_0x500473===':'){_0xf38b70=_0xf38b70['substring'](0x0,_0xf38b70[_0x794d('0x66')](_0x500473));}if(!_0x5d6f79[_0x794d('0x5c')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5d6f79);})['then'](function(_0x892752){if(_0x892752){return rp({'method':_0x794d('0x67'),'uri':util[_0x794d('0x68')](_0x794d('0x69'),_0x5dd840),'qs':{'module':_0x794d('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x892752},'json':!![]});}})[_0x794d('0x26')](function(_0x42b9cc){if(_0x42b9cc){if(_0x42b9cc[_0x794d('0x6b')]&&_0x42b9cc[_0x794d('0x6b')][_0x794d('0x28')]){throw new Error(_0x42b9cc[_0x794d('0x6b')][_0x794d('0x28')][_0x794d('0x6c')]);}var _0x3a04a2=[];var _0x12358b=[];var _0x20e5c3=['Owner','Subject','Description','WhoId','Call_Duration',_0x794d('0x6d'),_0x794d('0x6e'),_0x794d('0x6f')];_0x12358b=_['remove'](_0x42b9cc['fields'],function(_0x232443){return _0x20e5c3[_0x794d('0x70')](_0x232443['api_name']);});for(var _0x39c392=0x0;_0x39c392<_0x12358b[_0x794d('0x39')];_0x39c392++){if(_0x12358b[_0x39c392][_0x794d('0x71')]===![]){_0x3a04a2[_0x794d('0x72')]({'id':_0x12358b[_0x39c392]['id'],'name':_0x12358b[_0x39c392][_0x794d('0x73')],'custom':_0x12358b[_0x39c392][_0x794d('0x74')],'options':_0x12358b[_0x39c392][_0x794d('0x75')]==='picklist'&&_0x12358b[_0x39c392][_0x794d('0x76')][_0x794d('0x39')]>-0x1?_[_0x794d('0x2c')](_0x12358b[_0x39c392][_0x794d('0x76')],function(_0x4bce1a){return{'name':_0x4bce1a,'value':_0x4bce1a};}):[]});}}return{'count':_0x3a04a2[_0x794d('0x39')],'rows':_0x3a04a2};}else{return{'count':0x0,'rows':[]};}})[_0x794d('0x26')](respondWithResult(_0x513fc5,null))['catch'](function(_0x311234){var _0x2d4745=_0xfd4cc6['query']['test']?0x1f4:_0x311234[_0x794d('0x77')]||0x1f4;logger[_0x794d('0x28')](_0x794d('0x78'),_0x794d('0x79'),_0x2d4745,JSON['stringify'](_0x311234));delete _0x311234[_0x794d('0x2a')];if(_0x2d4745===0x191){_0x2d4745=0x190;}_0x513fc5[_0x794d('0x1b')](_0x2d4745)[_0x794d('0x2b')](_0xfd4cc6['query'][_0x794d('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x311234[_0x794d('0x77')]}:_0x311234);});}; \ No newline at end of file +var _0x8c48=['key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','create','body','find','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','clientSecret','code','com','serverUrl','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','custom_field','data_type','picklist','test','statusCode','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type'];(function(_0x2b0a1c,_0x4537ea){var _0x1fde49=function(_0xdb8377){while(--_0xdb8377){_0x2b0a1c['push'](_0x2b0a1c['shift']());}};_0x1fde49(++_0x4537ea);}(_0x8c48,0xd4));var _0x88c4=function(_0x34089b,_0x32bac4){_0x34089b=_0x34089b-0x0;var _0xd31e99=_0x8c48[_0x34089b];return _0xd31e99;};'use strict';var emlformat=require(_0x88c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x88c4('0x1'));var jsonpatch=require(_0x88c4('0x2'));var rp=require(_0x88c4('0x3'));var moment=require(_0x88c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x88c4('0x5'));var util=require(_0x88c4('0x6'));var path=require('path');var sox=require(_0x88c4('0x7'));var csv=require(_0x88c4('0x8'));var ejs=require(_0x88c4('0x9'));var fs=require('fs');var fs_extra=require(_0x88c4('0xa'));var _=require(_0x88c4('0xb'));var squel=require(_0x88c4('0xc'));var crypto=require('crypto');var jsforce=require(_0x88c4('0xd'));var deskjs=require(_0x88c4('0xe'));var toCsv=require(_0x88c4('0x8'));var querystring=require(_0x88c4('0xf'));var Papa=require('papaparse');var Redis=require(_0x88c4('0x10'));var authService=require(_0x88c4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x88c4('0x12'));var hardwareService=require(_0x88c4('0x13'));var logger=require(_0x88c4('0x14'))(_0x88c4('0x15'));var utils=require(_0x88c4('0x16'));var config=require(_0x88c4('0x17'));var licenseUtil=require(_0x88c4('0x18'));var db=require(_0x88c4('0x19'))['db'];var integrations=require(_0x88c4('0x1a'));function respondWithStatusCode(_0x23d134,_0x207e3e){_0x207e3e=_0x207e3e||0xcc;return function(_0x27498f){if(_0x27498f){return _0x23d134[_0x88c4('0x1b')](_0x207e3e);}return _0x23d134[_0x88c4('0x1c')](_0x207e3e)[_0x88c4('0x1d')]();};}function respondWithResult(_0x3f0b09,_0x901e04){_0x901e04=_0x901e04||0xc8;return function(_0x1db8ac){if(_0x1db8ac){return _0x3f0b09[_0x88c4('0x1c')](_0x901e04)[_0x88c4('0x1e')](_0x1db8ac);}};}function respondWithFilteredResult(_0x25073c,_0x34ed4b){return function(_0x80d68){if(_0x80d68){var _0x578ba0=typeof _0x34ed4b[_0x88c4('0x1f')]==='undefined'&&typeof _0x34ed4b[_0x88c4('0x20')]===_0x88c4('0x21');var _0x3ccbc7=_0x80d68['count'];var _0x25f424=_0x578ba0?0x0:_0x34ed4b[_0x88c4('0x1f')];var _0xd1d345=_0x578ba0?_0x80d68[_0x88c4('0x22')]:_0x34ed4b[_0x88c4('0x1f')]+_0x34ed4b['limit'];var _0x80eea8;if(_0xd1d345>=_0x3ccbc7){_0xd1d345=_0x3ccbc7;_0x80eea8=0xc8;}else{_0x80eea8=0xce;}_0x25073c[_0x88c4('0x1c')](_0x80eea8);return _0x25073c['set'](_0x88c4('0x23'),_0x25f424+'-'+_0xd1d345+'/'+_0x3ccbc7)[_0x88c4('0x1e')](_0x80d68);}return null;};}function patchUpdates(_0x3ec00f){return function(_0xa13d99){try{jsonpatch['apply'](_0xa13d99,_0x3ec00f,!![]);}catch(_0x5275ff){return BPromise[_0x88c4('0x24')](_0x5275ff);}return _0xa13d99[_0x88c4('0x25')]();};}function saveUpdates(_0x5c3092,_0x1cc6aa){return function(_0x333be1){if(_0x333be1){return _0x333be1[_0x88c4('0x26')](_0x5c3092)['then'](function(_0x1dc738){return _0x1dc738;});}return null;};}function removeEntity(_0x5d5e9f,_0x14d6ff){return function(_0x2a71fd){if(_0x2a71fd){return _0x2a71fd[_0x88c4('0x27')]()[_0x88c4('0x28')](function(){_0x5d5e9f[_0x88c4('0x1c')](0xcc)[_0x88c4('0x1d')]();});}};}function handleEntityNotFound(_0x407db7,_0x2d6ebe){return function(_0x2e5ed4){if(!_0x2e5ed4){_0x407db7[_0x88c4('0x1b')](0x194);}return _0x2e5ed4;};}function handleError(_0x359801,_0x2c7720){_0x2c7720=_0x2c7720||0x1f4;return function(_0x2c70f4){logger[_0x88c4('0x29')](_0x2c70f4[_0x88c4('0x2a')]);if(_0x2c70f4[_0x88c4('0x2b')]){delete _0x2c70f4[_0x88c4('0x2b')];}_0x359801[_0x88c4('0x1c')](_0x2c7720)['send'](_0x2c70f4);};}exports[_0x88c4('0x2c')]=function(_0x7fc1f1,_0x3a0aaa){var _0x45b17f={},_0x12c994={},_0x123123={'count':0x0,'rows':[]};var _0x10e677=_[_0x88c4('0x2d')](db[_0x88c4('0x2e')][_0x88c4('0x2f')],function(_0x24ed43){return{'name':_0x24ed43[_0x88c4('0x30')],'type':_0x24ed43[_0x88c4('0x31')][_0x88c4('0x32')]};});_0x12c994[_0x88c4('0x33')]=_[_0x88c4('0x2d')](_0x10e677,'name');_0x12c994['query']=_['keys'](_0x7fc1f1[_0x88c4('0x34')]);_0x12c994[_0x88c4('0x35')]=_[_0x88c4('0x36')](_0x12c994['model'],_0x12c994[_0x88c4('0x34')]);_0x45b17f['attributes']=_[_0x88c4('0x36')](_0x12c994[_0x88c4('0x33')],qs[_0x88c4('0x37')](_0x7fc1f1[_0x88c4('0x34')][_0x88c4('0x37')]));_0x45b17f[_0x88c4('0x38')]=_0x45b17f[_0x88c4('0x38')]['length']?_0x45b17f['attributes']:_0x12c994[_0x88c4('0x33')];if(!_0x7fc1f1[_0x88c4('0x34')][_0x88c4('0x39')](_0x88c4('0x3a'))){_0x45b17f[_0x88c4('0x20')]=qs[_0x88c4('0x20')](_0x7fc1f1[_0x88c4('0x34')][_0x88c4('0x20')]);_0x45b17f[_0x88c4('0x1f')]=qs['offset'](_0x7fc1f1[_0x88c4('0x34')][_0x88c4('0x1f')]);}_0x45b17f[_0x88c4('0x3b')]=qs[_0x88c4('0x3c')](_0x7fc1f1[_0x88c4('0x34')][_0x88c4('0x3c')]);_0x45b17f[_0x88c4('0x3d')]=qs[_0x88c4('0x35')](_[_0x88c4('0x3e')](_0x7fc1f1['query'],_0x12c994['filters']),_0x10e677);if(_0x7fc1f1[_0x88c4('0x34')][_0x88c4('0x3f')]){_0x45b17f[_0x88c4('0x3d')]=_[_0x88c4('0x40')](_0x45b17f[_0x88c4('0x3d')],{'$or':_[_0x88c4('0x2d')](_0x10e677,function(_0x3f095f){if(_0x3f095f[_0x88c4('0x31')]!==_0x88c4('0x41')){var _0x2a2e9f={};_0x2a2e9f[_0x3f095f[_0x88c4('0x2b')]]={'$like':'%'+_0x7fc1f1[_0x88c4('0x34')][_0x88c4('0x3f')]+'%'};return _0x2a2e9f;}})});}_0x45b17f=_[_0x88c4('0x40')]({},_0x45b17f,_0x7fc1f1[_0x88c4('0x42')]);var _0x2fa69a={'where':_0x45b17f[_0x88c4('0x3d')]};return db['ZohoAccount'][_0x88c4('0x22')](_0x2fa69a)[_0x88c4('0x28')](function(_0x5f24dd){_0x123123[_0x88c4('0x22')]=_0x5f24dd;if(_0x7fc1f1['query'][_0x88c4('0x43')]){_0x45b17f['include']=[{'all':!![]}];}return db[_0x88c4('0x2e')][_0x88c4('0x44')](_0x45b17f);})[_0x88c4('0x28')](function(_0x5f5ca9){_0x123123[_0x88c4('0x45')]=_0x5f5ca9;return _0x123123;})['then'](respondWithFilteredResult(_0x3a0aaa,_0x45b17f))[_0x88c4('0x46')](handleError(_0x3a0aaa,null));};exports[_0x88c4('0x47')]=function(_0x130f6e,_0x2edb76){var _0x314512={'raw':![],'where':{'id':_0x130f6e[_0x88c4('0x48')]['id']}},_0x1208b7={};_0x1208b7['model']=_[_0x88c4('0x49')](db[_0x88c4('0x2e')][_0x88c4('0x2f')]);_0x1208b7['query']=_[_0x88c4('0x49')](_0x130f6e[_0x88c4('0x34')]);_0x1208b7[_0x88c4('0x35')]=_[_0x88c4('0x36')](_0x1208b7[_0x88c4('0x33')],_0x1208b7[_0x88c4('0x34')]);_0x314512[_0x88c4('0x38')]=_[_0x88c4('0x36')](_0x1208b7[_0x88c4('0x33')],qs[_0x88c4('0x37')](_0x130f6e[_0x88c4('0x34')][_0x88c4('0x37')]));_0x314512[_0x88c4('0x38')]=_0x314512[_0x88c4('0x38')][_0x88c4('0x4a')]?_0x314512[_0x88c4('0x38')]:_0x1208b7[_0x88c4('0x33')];if(_0x130f6e[_0x88c4('0x34')][_0x88c4('0x43')]){_0x314512[_0x88c4('0x4b')]=[{'all':!![]}];}_0x314512=_[_0x88c4('0x40')]({},_0x314512,_0x130f6e[_0x88c4('0x42')]);return db[_0x88c4('0x2e')]['find'](_0x314512)[_0x88c4('0x28')](handleEntityNotFound(_0x2edb76,null))[_0x88c4('0x28')](respondWithResult(_0x2edb76,null))[_0x88c4('0x46')](handleError(_0x2edb76,null));};exports[_0x88c4('0x4c')]=function(_0x3bbac2,_0x277d05){return db[_0x88c4('0x2e')][_0x88c4('0x4c')](_0x3bbac2[_0x88c4('0x4d')],{})['then'](respondWithResult(_0x277d05,0xc9))['catch'](handleError(_0x277d05,null));};exports[_0x88c4('0x26')]=function(_0x3bda41,_0x8b5a62){if(_0x3bda41['body']['id']){delete _0x3bda41[_0x88c4('0x4d')]['id'];}return db['ZohoAccount'][_0x88c4('0x4e')]({'where':{'id':_0x3bda41['params']['id']}})[_0x88c4('0x28')](handleEntityNotFound(_0x8b5a62,null))[_0x88c4('0x28')](saveUpdates(_0x3bda41['body'],null))[_0x88c4('0x28')](respondWithResult(_0x8b5a62,null))[_0x88c4('0x46')](handleError(_0x8b5a62,null));};exports['destroy']=function(_0x2064f3,_0x1a7271){return db[_0x88c4('0x2e')][_0x88c4('0x4e')]({'where':{'id':_0x2064f3[_0x88c4('0x48')]['id']}})[_0x88c4('0x28')](handleEntityNotFound(_0x1a7271,null))[_0x88c4('0x28')](removeEntity(_0x1a7271,null))[_0x88c4('0x46')](handleError(_0x1a7271,null));};exports[_0x88c4('0x4f')]=function(_0x377593,_0x24a81c,_0x2f41e5){var _0xfe546a={};var _0x44b3ec={};var _0x5d3658;var _0x206d00;return db[_0x88c4('0x2e')][_0x88c4('0x50')]({'where':{'id':_0x377593[_0x88c4('0x48')]['id']}})[_0x88c4('0x28')](handleEntityNotFound(_0x24a81c,null))[_0x88c4('0x28')](function(_0x10a2ac){if(_0x10a2ac){_0x5d3658=_0x10a2ac;_0x44b3ec[_0x88c4('0x33')]=_[_0x88c4('0x49')](db[_0x88c4('0x51')][_0x88c4('0x2f')]);_0x44b3ec[_0x88c4('0x34')]=_[_0x88c4('0x49')](_0x377593['query']);_0x44b3ec['filters']=_[_0x88c4('0x36')](_0x44b3ec[_0x88c4('0x33')],_0x44b3ec[_0x88c4('0x34')]);_0xfe546a[_0x88c4('0x38')]=_[_0x88c4('0x36')](_0x44b3ec['model'],qs['fields'](_0x377593['query'][_0x88c4('0x37')]));_0xfe546a['attributes']=_0xfe546a['attributes'][_0x88c4('0x4a')]?_0xfe546a[_0x88c4('0x38')]:_0x44b3ec[_0x88c4('0x33')];_0xfe546a[_0x88c4('0x3b')]=qs[_0x88c4('0x3c')](_0x377593[_0x88c4('0x34')][_0x88c4('0x3c')]);_0xfe546a[_0x88c4('0x3d')]=qs[_0x88c4('0x35')](_[_0x88c4('0x3e')](_0x377593[_0x88c4('0x34')],_0x44b3ec[_0x88c4('0x35')]));if(_0x377593[_0x88c4('0x34')][_0x88c4('0x3f')]){_0xfe546a[_0x88c4('0x3d')]=_[_0x88c4('0x40')](_0xfe546a['where'],{'$or':_[_0x88c4('0x2d')](_0xfe546a['attributes'],function(_0x5ea3c9){var _0x179850={};_0x179850[_0x5ea3c9]={'$like':'%'+_0x377593[_0x88c4('0x34')][_0x88c4('0x3f')]+'%'};return _0x179850;})});}_0xfe546a=_[_0x88c4('0x40')]({},_0xfe546a,_0x377593[_0x88c4('0x42')]);return _0x5d3658[_0x88c4('0x4f')](_0xfe546a);}})['then'](function(_0x23b83a){if(_0x23b83a){_0x206d00=_0x23b83a[_0x88c4('0x4a')];if(!_0x377593[_0x88c4('0x34')][_0x88c4('0x39')]('nolimit')){_0xfe546a[_0x88c4('0x20')]=qs[_0x88c4('0x20')](_0x377593[_0x88c4('0x34')]['limit']);_0xfe546a[_0x88c4('0x1f')]=qs[_0x88c4('0x1f')](_0x377593[_0x88c4('0x34')][_0x88c4('0x1f')]);}return _0x5d3658[_0x88c4('0x4f')](_0xfe546a);}})[_0x88c4('0x28')](function(_0x19c4c8){if(_0x19c4c8){return _0x19c4c8?{'count':_0x206d00,'rows':_0x19c4c8}:null;}})[_0x88c4('0x28')](respondWithResult(_0x24a81c,null))[_0x88c4('0x46')](handleError(_0x24a81c,null));};exports[_0x88c4('0x52')]=function(_0x1028f6,_0x452eed,_0x4b4214){if(_0x1028f6['body']['id']){delete _0x1028f6[_0x88c4('0x4d')]['id'];}return db[_0x88c4('0x2e')][_0x88c4('0x50')]({'where':{'id':_0x1028f6[_0x88c4('0x48')]['id']}})['then'](handleEntityNotFound(_0x452eed,null))[_0x88c4('0x28')](function(_0x21955e){if(_0x21955e){_0x1028f6[_0x88c4('0x4d')][_0x88c4('0x53')]=_0x21955e['id'];_0x1028f6[_0x88c4('0x4d')]['Subjects']=integrations[_0x88c4('0x54')](_0x1028f6[_0x88c4('0x4d')][_0x88c4('0x55')],_0x1028f6[_0x88c4('0x4d')][_0x88c4('0x31')]);_0x1028f6[_0x88c4('0x4d')][_0x88c4('0x56')]=integrations[_0x88c4('0x57')](_0x1028f6[_0x88c4('0x4d')][_0x88c4('0x55')],_0x1028f6['body'][_0x88c4('0x31')]);return db[_0x88c4('0x51')][_0x88c4('0x4c')](_0x1028f6[_0x88c4('0x4d')],{'include':[{'model':db['ZohoField'],'as':_0x88c4('0x58')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x88c4('0x28')](respondWithResult(_0x452eed,null))[_0x88c4('0x46')](handleError(_0x452eed,null));};function getAccessToken(_0x1d3067){return new Promise(function(_0x273346,_0x69fe09){var _0xe8923;switch(_0x1d3067[_0x88c4('0x59')]){case'US':_0xe8923=_0x88c4('0x5a');break;case'AU':_0xe8923=_0x88c4('0x5b');break;case'EU':_0xe8923=_0x88c4('0x5c');break;case'IN':_0xe8923='https://accounts.zoho.in';break;case'CN':_0xe8923=_0x88c4('0x5d');break;default:_0xe8923=_0x88c4('0x5c');break;}var _0x2f6e3b={'method':'POST','uri':_0xe8923+_0x88c4('0x5e'),'qs':{'refresh_token':_0x1d3067[_0x88c4('0x5f')],'client_id':_0x1d3067['clientId'],'client_secret':_0x1d3067['clientSecret'],'grant_type':_0x88c4('0x60')},'json':!![]};return rp(_0x2f6e3b)[_0x88c4('0x28')](function(_0x553d99){if(_0x553d99[_0x88c4('0x61')]){_0x273346(_0x553d99['access_token']);}else{_0x69fe09(_0x88c4('0x62'));}})[_0x88c4('0x46')](function(_0xbb50aa){_0x69fe09(_0xbb50aa);});});}exports[_0x88c4('0x63')]=function(_0x59a359,_0x33fabc,_0x181fe3){var _0x41ccff,_0x482268,_0x456d8d,_0x3b37c3,_0x14f626;return db[_0x88c4('0x2e')][_0x88c4('0x50')]({'where':{'id':_0x59a359[_0x88c4('0x48')]['id']},'attributes':['id',_0x88c4('0x64'),_0x88c4('0x59'),_0x88c4('0x65'),_0x88c4('0x66'),'serverUrl',_0x88c4('0x67'),_0x88c4('0x5f')]})[_0x88c4('0x28')](handleEntityNotFound(_0x33fabc,null))['then'](function(_0x1a04bf){_0x14f626=_0x1a04bf;_0x41ccff=_0x14f626[_0x88c4('0x64')];_0x482268=_0x41ccff==='zoho.eu'?'eu':_0x88c4('0x68');_0x456d8d=_0x14f626[_0x88c4('0x69')];var _0x5afd73=_0x456d8d['slice'](-0x1);if(_0x5afd73==='/'||_0x5afd73==='\x5c'||_0x5afd73===':'){_0x456d8d=_0x456d8d[_0x88c4('0x6a')](0x0,_0x456d8d[_0x88c4('0x6b')](_0x5afd73));}if(!_0x14f626['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x14f626);})[_0x88c4('0x28')](function(_0x1d0843){if(_0x1d0843){return rp({'method':_0x88c4('0x6c'),'uri':util[_0x88c4('0x6d')](_0x88c4('0x6e'),_0x482268),'qs':{'module':_0x88c4('0x6f')},'headers':{'Authorization':_0x88c4('0x70')+_0x1d0843},'json':!![]});}})['then'](function(_0xaeb306){if(_0xaeb306){if(_0xaeb306[_0x88c4('0x71')]&&_0xaeb306[_0x88c4('0x71')][_0x88c4('0x29')]){throw new Error(_0xaeb306[_0x88c4('0x71')][_0x88c4('0x29')][_0x88c4('0x72')]);}var _0x499385=[];var _0x354312=[];var _0x6d1c8e=[_0x88c4('0x73'),_0x88c4('0x74'),_0x88c4('0x75'),_0x88c4('0x76'),_0x88c4('0x77'),'Call_Result',_0x88c4('0x78'),_0x88c4('0x79')];_0x354312=_[_0x88c4('0x7a')](_0xaeb306['fields'],function(_0x3ee1a9){return _0x6d1c8e[_0x88c4('0x7b')](_0x3ee1a9[_0x88c4('0x7c')]);});for(var _0x1ca43f=0x0;_0x1ca43f<_0x354312[_0x88c4('0x4a')];_0x1ca43f++){if(_0x354312[_0x1ca43f]['system_mandatory']===![]){_0x499385['push']({'id':_0x354312[_0x1ca43f]['id'],'name':_0x354312[_0x1ca43f]['display_label'],'custom':_0x354312[_0x1ca43f][_0x88c4('0x7d')],'options':_0x354312[_0x1ca43f][_0x88c4('0x7e')]===_0x88c4('0x7f')&&_0x354312[_0x1ca43f]['pick_list_values']['length']>-0x1?_[_0x88c4('0x2d')](_0x354312[_0x1ca43f]['pick_list_values'],function(_0x2be2fc){return{'name':_0x2be2fc,'value':_0x2be2fc};}):[]});}}return{'count':_0x499385[_0x88c4('0x4a')],'rows':_0x499385};}else{return{'count':0x0,'rows':[]};}})[_0x88c4('0x28')](respondWithResult(_0x33fabc,null))['catch'](function(_0x4e3d1e){var _0x3d4531=_0x59a359[_0x88c4('0x34')][_0x88c4('0x80')]?0x1f4:_0x4e3d1e[_0x88c4('0x81')]||0x1f4;logger[_0x88c4('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x88c4('0x63'),_0x3d4531,JSON[_0x88c4('0x82')](_0x4e3d1e));delete _0x4e3d1e['name'];if(_0x3d4531===0x191){_0x3d4531=0x190;}_0x33fabc[_0x88c4('0x1c')](_0x3d4531)['send'](_0x59a359['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x4e3d1e[_0x88c4('0x81')]}:_0x4e3d1e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4f662e4..49ed373 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 _0x0aa5=['define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','clientSecret','code','application/x-www-form-urlencoded','parse','refresh_token','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','inspect','catch','https://accounts.zoho.com','authorization_code','refreshToken','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2ff233,_0x4281a6){var _0x4945dd=function(_0x904df7){while(--_0x904df7){_0x2ff233['push'](_0x2ff233['shift']());}};_0x4945dd(++_0x4281a6);}(_0x0aa5,0xed));var _0x50aa=function(_0x3f1a92,_0x15ebfa){_0x3f1a92=_0x3f1a92-0x0;var _0x13ebfb=_0x0aa5[_0x3f1a92];return _0x13ebfb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x50aa('0x0'))(_0x50aa('0x1'));var moment=require(_0x50aa('0x2'));var BPromise=require(_0x50aa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50aa('0x4'));var rimraf=require('rimraf');var config=require(_0x50aa('0x5'));var attributes=require(_0x50aa('0x6'));var integrations=require(_0x50aa('0x7'));module[_0x50aa('0x8')]=function(_0x48fd01,_0x417d4f){return _0x48fd01[_0x50aa('0x9')](_0x50aa('0xa'),attributes,{'tableName':_0x50aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4e56d3,_0x544651,_0x25752a){if(_0x4e56d3[_0x50aa('0xc')](_0x50aa('0xd'))||_0x4e56d3[_0x50aa('0xc')]('serverUrl')||_0x4e56d3[_0x50aa('0xc')](_0x50aa('0xe'))||_0x4e56d3[_0x50aa('0xc')]('clientSecret')||_0x4e56d3[_0x50aa('0xc')]('code')||_0x4e56d3['changed'](_0x50aa('0xf'))){var _0x2cf335,_0x124378;_0x2cf335=_0x4e56d3[_0x50aa('0x10')];var _0x273652=_0x2cf335[_0x50aa('0x11')](-0x1);if(_0x273652==='/'||_0x273652==='\x5c'||_0x273652===':'){_0x2cf335=_0x2cf335[_0x50aa('0x12')](0x0,_0x2cf335[_0x50aa('0x13')](_0x273652));}switch(_0x4e56d3[_0x50aa('0xd')]){case'US':_0x124378='https://accounts.zoho.com';break;case'AU':_0x124378=_0x50aa('0x14');break;case'IN':_0x124378=_0x50aa('0x15');break;case'CN':_0x124378='https://accounts.zoho.com.cn';break;default:_0x124378=_0x50aa('0x16');break;}var _0x4fd3d2={'method':_0x50aa('0x17'),'uri':_0x124378+_0x50aa('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x4e56d3[_0x50aa('0xe')],'client_secret':_0x4e56d3[_0x50aa('0x19')],'redirect_uri':_0x4e56d3[_0x50aa('0x10')],'code':_0x4e56d3[_0x50aa('0x1a')]},'headers':{'Content-Type':_0x50aa('0x1b')}};return rp(_0x4fd3d2)['then'](function(_0x329922){var _0x3f4727=JSON[_0x50aa('0x1c')](_0x329922);if(_0x3f4727[_0x50aa('0x1d')]){_0x4e56d3['refreshToken']=_0x3f4727['refresh_token'];logger[_0x50aa('0x1e')](util[_0x50aa('0x1f')](_0x50aa('0x20'),_0x4e56d3[_0x50aa('0x21')],_0x4e56d3['id']));}else{logger[_0x50aa('0x22')](util[_0x50aa('0x1f')](_0x50aa('0x23'),_0x4e56d3['name'],_0x4e56d3['id']),util[_0x50aa('0x24')](_0x3f4727,{'showHidden':![],'depth':null}));}return _0x25752a(null,_0x544651);})[_0x50aa('0x25')](function(_0x4c2b58){logger[_0x50aa('0x22')](util['format'](_0x50aa('0x23'),_0x4e56d3['name'],_0x4e56d3['id']),util[_0x50aa('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x25752a(_0x4c2b58);});}else{return _0x25752a(null,_0x544651);}},'beforeUpdate':function(_0x259778,_0x24a8a8,_0x201826){if(_0x259778[_0x50aa('0xc')]('zone')||_0x259778['changed'](_0x50aa('0x10'))||_0x259778[_0x50aa('0xc')](_0x50aa('0xe'))||_0x259778[_0x50aa('0xc')]('clientSecret')||_0x259778[_0x50aa('0xc')](_0x50aa('0x1a'))||_0x259778[_0x50aa('0xc')](_0x50aa('0xf'))){var _0x443f08,_0x3174a0;_0x443f08=_0x259778['serverUrl'];var _0x31435f=_0x443f08[_0x50aa('0x11')](-0x1);if(_0x31435f==='/'||_0x31435f==='\x5c'||_0x31435f===':'){_0x443f08=_0x443f08[_0x50aa('0x12')](0x0,_0x443f08[_0x50aa('0x13')](_0x31435f));}switch(_0x259778[_0x50aa('0xd')]){case'US':_0x3174a0=_0x50aa('0x26');break;case'AU':_0x3174a0=_0x50aa('0x14');break;case'IN':_0x3174a0=_0x50aa('0x15');break;case'CN':_0x3174a0='https://accounts.zoho.com.cn';break;default:_0x3174a0=_0x50aa('0x16');break;}var _0x204b49={'method':_0x50aa('0x17'),'uri':_0x3174a0+_0x50aa('0x18'),'form':{'grant_type':_0x50aa('0x27'),'client_id':_0x259778[_0x50aa('0xe')],'client_secret':_0x259778['clientSecret'],'redirect_uri':_0x259778[_0x50aa('0x10')],'code':_0x259778[_0x50aa('0x1a')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x204b49)['then'](function(_0x2e2356){var _0x57742d=JSON[_0x50aa('0x1c')](_0x2e2356);if(_0x57742d[_0x50aa('0x1d')]){_0x259778[_0x50aa('0x28')]=_0x57742d[_0x50aa('0x1d')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x259778[_0x50aa('0x21')],_0x259778['id']));}else{logger['error'](util[_0x50aa('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x259778[_0x50aa('0x21')],_0x259778['id']),util[_0x50aa('0x24')](_0x57742d,{'showHidden':![],'depth':null}));}return _0x201826(null,_0x24a8a8);})[_0x50aa('0x25')](function(_0x14b874){logger[_0x50aa('0x22')](util[_0x50aa('0x1f')](_0x50aa('0x23'),_0x259778[_0x50aa('0x21')],_0x259778['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x201826(_0x14b874);});}else{return _0x201826(null,_0x24a8a8);}}}});}; \ No newline at end of file +var _0xd43b=['../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientSecret','code','host','serverUrl','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','parse','refreshToken','refresh_token','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','lastIndexOf','https://accounts.zoho.com','application/x-www-form-urlencoded','then','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x442905,_0x5b3ef5){var _0x5dbff3=function(_0x5516e9){while(--_0x5516e9){_0x442905['push'](_0x442905['shift']());}};_0x5dbff3(++_0x5b3ef5);}(_0xd43b,0x1c7));var _0xbd43=function(_0x24d41e,_0x4af282){_0x24d41e=_0x24d41e-0x0;var _0x1c3483=_0xd43b[_0x24d41e];return _0x1c3483;};'use strict';var _=require(_0xbd43('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbd43('0x1'));var moment=require('moment');var BPromise=require(_0xbd43('0x2'));var rp=require(_0xbd43('0x3'));var fs=require('fs');var path=require(_0xbd43('0x4'));var rimraf=require(_0xbd43('0x5'));var config=require(_0xbd43('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xbd43('0x7'));module[_0xbd43('0x8')]=function(_0x140130,_0x5ef5b3){return _0x140130[_0xbd43('0x9')](_0xbd43('0xa'),attributes,{'tableName':_0xbd43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a62f1,_0x5edd7d,_0x1cc501){if(_0x4a62f1[_0xbd43('0xc')](_0xbd43('0xd'))||_0x4a62f1[_0xbd43('0xc')]('serverUrl')||_0x4a62f1[_0xbd43('0xc')]('clientId')||_0x4a62f1[_0xbd43('0xc')](_0xbd43('0xe'))||_0x4a62f1[_0xbd43('0xc')](_0xbd43('0xf'))||_0x4a62f1['changed'](_0xbd43('0x10'))){var _0x4a987a,_0x251d23;_0x4a987a=_0x4a62f1[_0xbd43('0x11')];var _0x3fef0e=_0x4a987a['slice'](-0x1);if(_0x3fef0e==='/'||_0x3fef0e==='\x5c'||_0x3fef0e===':'){_0x4a987a=_0x4a987a[_0xbd43('0x12')](0x0,_0x4a987a['lastIndexOf'](_0x3fef0e));}switch(_0x4a62f1['zone']){case'US':_0x251d23='https://accounts.zoho.com';break;case'AU':_0x251d23=_0xbd43('0x13');break;case'IN':_0x251d23=_0xbd43('0x14');break;case'CN':_0x251d23=_0xbd43('0x15');break;default:_0x251d23=_0xbd43('0x16');break;}var _0x3cf409={'method':_0xbd43('0x17'),'uri':_0x251d23+_0xbd43('0x18'),'form':{'grant_type':_0xbd43('0x19'),'client_id':_0x4a62f1[_0xbd43('0x1a')],'client_secret':_0x4a62f1[_0xbd43('0xe')],'redirect_uri':_0x4a62f1[_0xbd43('0x11')],'code':_0x4a62f1[_0xbd43('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3cf409)['then'](function(_0xe92355){var _0x54a72e=JSON[_0xbd43('0x1b')](_0xe92355);if(_0x54a72e['refresh_token']){_0x4a62f1[_0xbd43('0x1c')]=_0x54a72e[_0xbd43('0x1d')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a62f1[_0xbd43('0x1e')],_0x4a62f1['id']));}else{logger[_0xbd43('0x1f')](util[_0xbd43('0x20')](_0xbd43('0x21'),_0x4a62f1[_0xbd43('0x1e')],_0x4a62f1['id']),util['inspect'](_0x54a72e,{'showHidden':![],'depth':null}));}return _0x1cc501(null,_0x5edd7d);})[_0xbd43('0x22')](function(_0x328cd){logger[_0xbd43('0x1f')](util[_0xbd43('0x20')](_0xbd43('0x21'),_0x4a62f1['name'],_0x4a62f1['id']),util[_0xbd43('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x1cc501(_0x328cd);});}else{return _0x1cc501(null,_0x5edd7d);}},'beforeUpdate':function(_0x331ad5,_0x434017,_0x38666e){if(_0x331ad5[_0xbd43('0xc')](_0xbd43('0xd'))||_0x331ad5[_0xbd43('0xc')](_0xbd43('0x11'))||_0x331ad5['changed'](_0xbd43('0x1a'))||_0x331ad5[_0xbd43('0xc')](_0xbd43('0xe'))||_0x331ad5[_0xbd43('0xc')](_0xbd43('0xf'))||_0x331ad5[_0xbd43('0xc')](_0xbd43('0x10'))){var _0x519921,_0x25d832;_0x519921=_0x331ad5[_0xbd43('0x11')];var _0x2c816a=_0x519921['slice'](-0x1);if(_0x2c816a==='/'||_0x2c816a==='\x5c'||_0x2c816a===':'){_0x519921=_0x519921[_0xbd43('0x12')](0x0,_0x519921[_0xbd43('0x24')](_0x2c816a));}switch(_0x331ad5[_0xbd43('0xd')]){case'US':_0x25d832=_0xbd43('0x25');break;case'AU':_0x25d832='https://accounts.zoho.com.au';break;case'IN':_0x25d832=_0xbd43('0x14');break;case'CN':_0x25d832=_0xbd43('0x15');break;default:_0x25d832=_0xbd43('0x16');break;}var _0x5d13fa={'method':_0xbd43('0x17'),'uri':_0x25d832+_0xbd43('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x331ad5[_0xbd43('0x1a')],'client_secret':_0x331ad5[_0xbd43('0xe')],'redirect_uri':_0x331ad5['serverUrl'],'code':_0x331ad5[_0xbd43('0xf')]},'headers':{'Content-Type':_0xbd43('0x26')}};return rp(_0x5d13fa)[_0xbd43('0x27')](function(_0x362074){var _0x2b12a1=JSON[_0xbd43('0x1b')](_0x362074);if(_0x2b12a1['refresh_token']){_0x331ad5[_0xbd43('0x1c')]=_0x2b12a1[_0xbd43('0x1d')];logger[_0xbd43('0x28')](util['format'](_0xbd43('0x29'),_0x331ad5[_0xbd43('0x1e')],_0x331ad5['id']));}else{logger['error'](util['format'](_0xbd43('0x21'),_0x331ad5[_0xbd43('0x1e')],_0x331ad5['id']),util['inspect'](_0x2b12a1,{'showHidden':![],'depth':null}));}return _0x38666e(null,_0x434017);})['catch'](function(_0x381577){logger[_0xbd43('0x1f')](util[_0xbd43('0x20')](_0xbd43('0x21'),_0x331ad5['name'],_0x331ad5['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x38666e(_0x381577);});}else{return _0x38666e(null,_0x434017);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 147093d..f8e4ae1 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 _0xa30a=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','GetZohoAccount','findAll','options','where','attributes','limit','include','model','map','debug','catch','ShowZohoAccount','ZohoAccount','find','raw','lodash'];(function(_0x2f9b50,_0x1bf527){var _0x43bb2f=function(_0x5d6a2a){while(--_0x5d6a2a){_0x2f9b50['push'](_0x2f9b50['shift']());}};_0x43bb2f(++_0x1bf527);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});}exports[_0xaa30('0x15')]=function(_0x540e36){var _0x54fa49=this;return new Promise(function(_0x53f9fd,_0x23ad3b){return db['ZohoAccount'][_0xaa30('0x16')]({'raw':_0x540e36[_0xaa30('0x17')]?_0x540e36['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e36['options']?_0x540e36[_0xaa30('0x17')][_0xaa30('0x18')]||null:null,'attributes':_0x540e36[_0xaa30('0x17')]?_0x540e36[_0xaa30('0x17')][_0xaa30('0x19')]||null:null,'limit':_0x540e36['options']?_0x540e36[_0xaa30('0x17')][_0xaa30('0x1a')]||null:null,'include':_0x540e36[_0xaa30('0x17')]?_0x540e36[_0xaa30('0x17')][_0xaa30('0x1b')]?_['map'](_0x540e36[_0xaa30('0x17')][_0xaa30('0x1b')],function(_0x2fecdd){return{'model':db[_0x2fecdd[_0xaa30('0x1c')]],'as':_0x2fecdd['as'],'attributes':_0x2fecdd['attributes'],'include':_0x2fecdd[_0xaa30('0x1b')]?_[_0xaa30('0x1d')](_0x2fecdd[_0xaa30('0x1b')],function(_0x12da2f){return{'model':db[_0x12da2f[_0xaa30('0x1c')]],'as':_0x12da2f['as'],'attributes':_0x12da2f[_0xaa30('0x19')],'include':_0x12da2f['include']?_[_0xaa30('0x1d')](_0x12da2f[_0xaa30('0x1b')],function(_0x5d4da8){return{'model':db[_0x5d4da8[_0xaa30('0x1c')]],'as':_0x5d4da8['as'],'attributes':_0x5d4da8['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa30('0xc')](function(_0x33a0c9){logger[_0xaa30('0xd')](_0xaa30('0x15'),_0x540e36);logger[_0xaa30('0x1e')](_0xaa30('0x15'),_0x540e36,JSON[_0xaa30('0x10')](_0x33a0c9));_0x53f9fd(_0x33a0c9);})[_0xaa30('0x1f')](function(_0x1f288c){logger[_0xaa30('0x11')](_0xaa30('0x15'),_0x1f288c[_0xaa30('0x13')],_0x540e36);_0x23ad3b(_0x54fa49[_0xaa30('0x11')](0x1f4,_0x1f288c[_0xaa30('0x13')]));});});};exports[_0xaa30('0x20')]=function(_0x1a3f64){var _0x230d56=this;return new Promise(function(_0x1fa8d4,_0x484ffb){return db[_0xaa30('0x21')][_0xaa30('0x22')]({'raw':_0x1a3f64[_0xaa30('0x17')]?_0x1a3f64[_0xaa30('0x17')][_0xaa30('0x23')]===undefined?!![]:![]:!![],'where':_0x1a3f64[_0xaa30('0x17')]?_0x1a3f64['options']['where']||null:null,'attributes':_0x1a3f64['options']?_0x1a3f64[_0xaa30('0x17')][_0xaa30('0x19')]||null:null,'include':_0x1a3f64[_0xaa30('0x17')]?_0x1a3f64[_0xaa30('0x17')][_0xaa30('0x1b')]?_['map'](_0x1a3f64['options'][_0xaa30('0x1b')],function(_0x2d26fb){return{'model':db[_0x2d26fb['model']],'as':_0x2d26fb['as'],'attributes':_0x2d26fb[_0xaa30('0x19')],'include':_0x2d26fb['include']?_[_0xaa30('0x1d')](_0x2d26fb['include'],function(_0x2ae4ed){return{'model':db[_0x2ae4ed[_0xaa30('0x1c')]],'as':_0x2ae4ed['as'],'attributes':_0x2ae4ed['attributes'],'include':_0x2ae4ed[_0xaa30('0x1b')]?_[_0xaa30('0x1d')](_0x2ae4ed[_0xaa30('0x1b')],function(_0x2cca77){return{'model':db[_0x2cca77[_0xaa30('0x1c')]],'as':_0x2cca77['as'],'attributes':_0x2cca77[_0xaa30('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30712f){logger[_0xaa30('0xd')]('ShowZohoAccount',_0x1a3f64);logger[_0xaa30('0x1e')](_0xaa30('0x20'),_0x1a3f64,JSON[_0xaa30('0x10')](_0x30712f));_0x1fa8d4(_0x30712f);})['catch'](function(_0x4add3e){logger[_0xaa30('0x11')](_0xaa30('0x20'),_0x4add3e[_0xaa30('0x13')],_0x1a3f64);_0x484ffb(_0x230d56[_0xaa30('0x11')](0x1f4,_0x4add3e[_0xaa30('0x13')]));});});}; \ No newline at end of file +var _0xa5c1=['util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ZohoAccount','options','raw','attributes','include','map','model','GetZohoAccount','ShowZohoAccount','find','where','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x270b83,_0x481742){_0x270b83=_0x270b83-0x0;var _0x51da81=_0xa5c1[_0x270b83];return _0x51da81;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var moment=require(_0x1a5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a5c('0x4'));var logger=require(_0x1a5c('0x5'))(_0x1a5c('0x6'));var config=require(_0x1a5c('0x7'));var jayson=require(_0x1a5c('0x8'));var client=jayson[_0x1a5c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9853,_0x580a2e,_0x438f8f){return new BPromise(function(_0x43a2ed,_0x1702ce){return client['request'](_0x9853,_0x438f8f)[_0x1a5c('0xa')](function(_0x4c0bd2){logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');logger[_0x1a5c('0xd')](_0x1a5c('0xe'),_0x580a2e,'request\x20sent',JSON[_0x1a5c('0xf')](_0x4c0bd2));if(_0x4c0bd2[_0x1a5c('0x10')]){if(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x11')]===0x1f4){logger[_0x1a5c('0x10')](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x1702ce(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}logger['error'](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x43a2ed(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}else{logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');_0x43a2ed(_0x4c0bd2[_0x1a5c('0x13')]['message']);}})[_0x1a5c('0x14')](function(_0x44648a){logger[_0x1a5c('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x580a2e,_0x44648a);_0x1702ce(_0x44648a);});});}exports['GetZohoAccount']=function(_0x32e177){var _0x2e6a6f=this;return new Promise(function(_0x18551c,_0xe376f4){return db[_0x1a5c('0x15')]['findAll']({'raw':_0x32e177[_0x1a5c('0x16')]?_0x32e177['options'][_0x1a5c('0x17')]===undefined?!![]:![]:!![],'where':_0x32e177[_0x1a5c('0x16')]?_0x32e177[_0x1a5c('0x16')]['where']||null:null,'attributes':_0x32e177[_0x1a5c('0x16')]?_0x32e177[_0x1a5c('0x16')][_0x1a5c('0x18')]||null:null,'limit':_0x32e177[_0x1a5c('0x16')]?_0x32e177[_0x1a5c('0x16')]['limit']||null:null,'include':_0x32e177[_0x1a5c('0x16')]?_0x32e177[_0x1a5c('0x16')][_0x1a5c('0x19')]?_[_0x1a5c('0x1a')](_0x32e177[_0x1a5c('0x16')][_0x1a5c('0x19')],function(_0x1991f6){return{'model':db[_0x1991f6[_0x1a5c('0x1b')]],'as':_0x1991f6['as'],'attributes':_0x1991f6[_0x1a5c('0x18')],'include':_0x1991f6[_0x1a5c('0x19')]?_[_0x1a5c('0x1a')](_0x1991f6[_0x1a5c('0x19')],function(_0x4c6520){return{'model':db[_0x4c6520[_0x1a5c('0x1b')]],'as':_0x4c6520['as'],'attributes':_0x4c6520['attributes'],'include':_0x4c6520[_0x1a5c('0x19')]?_['map'](_0x4c6520[_0x1a5c('0x19')],function(_0x4323f8){return{'model':db[_0x4323f8[_0x1a5c('0x1b')]],'as':_0x4323f8['as'],'attributes':_0x4323f8[_0x1a5c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1a5c('0xa')](function(_0x1e5e87){logger[_0x1a5c('0xb')](_0x1a5c('0x1c'),_0x32e177);logger[_0x1a5c('0xd')](_0x1a5c('0x1c'),_0x32e177,JSON[_0x1a5c('0xf')](_0x1e5e87));_0x18551c(_0x1e5e87);})['catch'](function(_0x25950b){logger[_0x1a5c('0x10')](_0x1a5c('0x1c'),_0x25950b[_0x1a5c('0x12')],_0x32e177);_0xe376f4(_0x2e6a6f[_0x1a5c('0x10')](0x1f4,_0x25950b[_0x1a5c('0x12')]));});});};exports[_0x1a5c('0x1d')]=function(_0x1a2bec){var _0xb97acb=this;return new Promise(function(_0x523dfb,_0x243c0c){return db[_0x1a5c('0x15')][_0x1a5c('0x1e')]({'raw':_0x1a2bec[_0x1a5c('0x16')]?_0x1a2bec['options'][_0x1a5c('0x17')]===undefined?!![]:![]:!![],'where':_0x1a2bec[_0x1a5c('0x16')]?_0x1a2bec[_0x1a5c('0x16')][_0x1a5c('0x1f')]||null:null,'attributes':_0x1a2bec[_0x1a5c('0x16')]?_0x1a2bec[_0x1a5c('0x16')][_0x1a5c('0x18')]||null:null,'include':_0x1a2bec['options']?_0x1a2bec[_0x1a5c('0x16')][_0x1a5c('0x19')]?_['map'](_0x1a2bec[_0x1a5c('0x16')][_0x1a5c('0x19')],function(_0xdd89f2){return{'model':db[_0xdd89f2[_0x1a5c('0x1b')]],'as':_0xdd89f2['as'],'attributes':_0xdd89f2['attributes'],'include':_0xdd89f2[_0x1a5c('0x19')]?_[_0x1a5c('0x1a')](_0xdd89f2['include'],function(_0x1f957a){return{'model':db[_0x1f957a[_0x1a5c('0x1b')]],'as':_0x1f957a['as'],'attributes':_0x1f957a[_0x1a5c('0x18')],'include':_0x1f957a[_0x1a5c('0x19')]?_[_0x1a5c('0x1a')](_0x1f957a[_0x1a5c('0x19')],function(_0x38e8cb){return{'model':db[_0x38e8cb[_0x1a5c('0x1b')]],'as':_0x38e8cb['as'],'attributes':_0x38e8cb[_0x1a5c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1a5c('0xa')](function(_0x515780){logger[_0x1a5c('0xb')](_0x1a5c('0x1d'),_0x1a2bec);logger['debug'](_0x1a5c('0x1d'),_0x1a2bec,JSON[_0x1a5c('0xf')](_0x515780));_0x523dfb(_0x515780);})['catch'](function(_0x4abca8){logger[_0x1a5c('0x10')](_0x1a5c('0x1d'),_0x4abca8[_0x1a5c('0x12')],_0x1a2bec);_0x243c0c(_0xb97acb[_0x1a5c('0x10')](0x1f4,_0x4abca8['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 730f386..c869e28 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 _0xfd68=['express','../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','util','path','connect-timeout'];(function(_0x5d7a55,_0x1b8d3f){var _0x2f3c27=function(_0x4f9c8a){while(--_0x4f9c8a){_0x5d7a55['push'](_0x5d7a55['shift']());}};_0x2f3c27(++_0x1b8d3f);}(_0xfd68,0xd9));var _0x8fd6=function(_0xee06c6,_0x544866){_0xee06c6=_0xee06c6-0x0;var _0x2dbf78=_0xfd68[_0xee06c6];return _0x2dbf78;};'use strict';var multer=require('multer');var util=require(_0x8fd6('0x0'));var path=require(_0x8fd6('0x1'));var timeout=require(_0x8fd6('0x2'));var express=require(_0x8fd6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8fd6('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8fd6('0x5'));router[_0x8fd6('0x6')]('/',auth[_0x8fd6('0x7')](),controller[_0x8fd6('0x8')]);router[_0x8fd6('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x8fd6('0x9')]);router[_0x8fd6('0x6')](_0x8fd6('0xa'),auth[_0x8fd6('0x7')](),controller[_0x8fd6('0xb')]);router['get'](_0x8fd6('0xc'),auth['isAuthenticated'](),controller[_0x8fd6('0xd')]);router[_0x8fd6('0x6')](_0x8fd6('0xe'),auth[_0x8fd6('0x7')](),controller[_0x8fd6('0xf')]);router[_0x8fd6('0x10')]('/',auth[_0x8fd6('0x7')](),controller[_0x8fd6('0x11')]);router[_0x8fd6('0x12')](_0x8fd6('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x8fd6('0x14')](_0x8fd6('0x13'),auth[_0x8fd6('0x7')](),controller[_0x8fd6('0x15')]);module['exports']=router; \ No newline at end of file +var _0xaadd=['../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xde0c72,_0xebb46a){var _0x3a32d8=function(_0x1eac86){while(--_0x1eac86){_0xde0c72['push'](_0xde0c72['shift']());}};_0x3a32d8(++_0xebb46a);}(_0xaadd,0x1f4));var _0xdaad=function(_0x58bf5f,_0x477093){_0x58bf5f=_0x58bf5f-0x0;var _0x2e5e88=_0xaadd[_0x58bf5f];return _0x2e5e88;};'use strict';var multer=require(_0xdaad('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdaad('0x1'));var express=require(_0xdaad('0x2'));var router=express[_0xdaad('0x3')]();var fs_extra=require(_0xdaad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdaad('0x5'));var config=require(_0xdaad('0x6'));var controller=require(_0xdaad('0x7'));router[_0xdaad('0x8')]('/',auth[_0xdaad('0x9')](),controller[_0xdaad('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xdaad('0xb'),auth[_0xdaad('0x9')](),controller[_0xdaad('0xc')]);router[_0xdaad('0x8')](_0xdaad('0xd'),auth[_0xdaad('0x9')](),controller['getSubjects']);router[_0xdaad('0x8')](_0xdaad('0xe'),auth['isAuthenticated'](),controller[_0xdaad('0xf')]);router[_0xdaad('0x10')]('/',auth[_0xdaad('0x9')](),controller[_0xdaad('0x11')]);router[_0xdaad('0x12')](_0xdaad('0x13'),auth[_0xdaad('0x9')](),controller[_0xdaad('0x14')]);router[_0xdaad('0x15')](_0xdaad('0x13'),auth[_0xdaad('0x9')](),controller['destroy']);module[_0xdaad('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2992e3f..18f0b05 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 _0x044e=['ENUM','nothing','lead','contact_lead','contact','STRING','sequelize','exports'];(function(_0x133550,_0x19b4a9){var _0x106ad3=function(_0x1d86aa){while(--_0x1d86aa){_0x133550['push'](_0x133550['shift']());}};_0x106ad3(++_0x19b4a9);}(_0x044e,0x96));var _0xe044=function(_0x110fdc,_0x5b4202){_0x110fdc=_0x110fdc-0x0;var _0x567049=_0x044e[_0x110fdc];return _0x567049;};'use strict';var Sequelize=require(_0xe044('0x0'));module[_0xe044('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xe044('0x2')]('lead','contact',_0xe044('0x3')),'defaultValue':_0xe044('0x4')},'moduleSearch':{'type':Sequelize[_0xe044('0x2')](_0xe044('0x5'),_0xe044('0x6'),_0xe044('0x4')),'defaultValue':_0xe044('0x5')},'description':{'type':Sequelize[_0xe044('0x7')]}}; \ No newline at end of file +var _0x02ee=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x37f364,_0x56f6ae){var _0x1a97dd=function(_0x4f4161){while(--_0x4f4161){_0x37f364['push'](_0x37f364['shift']());}};_0x1a97dd(++_0x56f6ae);}(_0x02ee,0x72));var _0xe02e=function(_0x4eef96,_0x434661){_0x4eef96=_0x4eef96-0x0;var _0x3dc01f=_0x02ee[_0x4eef96];return _0x3dc01f;};'use strict';var Sequelize=require(_0xe02e('0x0'));module[_0xe02e('0x1')]={'name':{'type':Sequelize[_0xe02e('0x2')]},'moduleCreate':{'type':Sequelize[_0xe02e('0x3')](_0xe02e('0x4'),_0xe02e('0x5'),_0xe02e('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe02e('0x3')](_0xe02e('0x7'),_0xe02e('0x5'),'lead'),'defaultValue':_0xe02e('0x7')},'description':{'type':Sequelize[_0xe02e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 80c8977..09488cd 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 _0x68a0=['VIRTUAL','options','ZohoConfiguration','include','rows','show','params','includeAll','find','catch','create','body','getFields','findOne','order','getSubjects','getDescriptions','ZohoField','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x390ab4,_0x553e28){var _0xb4378a=function(_0x19dce6){while(--_0x19dce6){_0x390ab4['push'](_0x390ab4['shift']());}};_0xb4378a(++_0x553e28);}(_0x68a0,0x64));var _0x068a=function(_0x593cbd,_0x141c5b){_0x593cbd=_0x593cbd-0x0;var _0x1ea4aa=_0x68a0[_0x593cbd];return _0x1ea4aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x068a('0x0'));var zipdir=require(_0x068a('0x1'));var jsonpatch=require(_0x068a('0x2'));var rp=require(_0x068a('0x3'));var moment=require(_0x068a('0x4'));var BPromise=require(_0x068a('0x5'));var Mustache=require(_0x068a('0x6'));var util=require(_0x068a('0x7'));var path=require('path');var sox=require(_0x068a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x068a('0x9'));var _=require(_0x068a('0xa'));var squel=require('squel');var crypto=require(_0x068a('0xb'));var jsforce=require(_0x068a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x068a('0xd'));var querystring=require(_0x068a('0xe'));var Papa=require(_0x068a('0xf'));var Redis=require(_0x068a('0x10'));var authService=require(_0x068a('0x11'));var qs=require(_0x068a('0x12'));var as=require(_0x068a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x068a('0x14'))(_0x068a('0x15'));var utils=require('../../config/utils');var config=require(_0x068a('0x16'));var licenseUtil=require(_0x068a('0x17'));var db=require(_0x068a('0x18'))['db'];function respondWithStatusCode(_0x221d67,_0x4a7cfd){_0x4a7cfd=_0x4a7cfd||0xcc;return function(_0x11224b){if(_0x11224b){return _0x221d67[_0x068a('0x19')](_0x4a7cfd);}return _0x221d67[_0x068a('0x1a')](_0x4a7cfd)['end']();};}function respondWithResult(_0x3ab4b8,_0x33d1e9){_0x33d1e9=_0x33d1e9||0xc8;return function(_0x1626c2){if(_0x1626c2){return _0x3ab4b8[_0x068a('0x1a')](_0x33d1e9)['json'](_0x1626c2);}};}function respondWithFilteredResult(_0x12b5d2,_0x4a3f60){return function(_0x4041d2){if(_0x4041d2){var _0x604fb3=typeof _0x4a3f60[_0x068a('0x1b')]==='undefined'&&typeof _0x4a3f60[_0x068a('0x1c')]===_0x068a('0x1d');var _0x3a9bb4=_0x4041d2[_0x068a('0x1e')];var _0x364517=_0x604fb3?0x0:_0x4a3f60[_0x068a('0x1b')];var _0x48a75e=_0x604fb3?_0x4041d2[_0x068a('0x1e')]:_0x4a3f60[_0x068a('0x1b')]+_0x4a3f60[_0x068a('0x1c')];var _0x29b306;if(_0x48a75e>=_0x3a9bb4){_0x48a75e=_0x3a9bb4;_0x29b306=0xc8;}else{_0x29b306=0xce;}_0x12b5d2['status'](_0x29b306);return _0x12b5d2[_0x068a('0x1f')](_0x068a('0x20'),_0x364517+'-'+_0x48a75e+'/'+_0x3a9bb4)[_0x068a('0x21')](_0x4041d2);}return null;};}function patchUpdates(_0x330bfc){return function(_0x5c6829){try{jsonpatch[_0x068a('0x22')](_0x5c6829,_0x330bfc,!![]);}catch(_0x513094){return BPromise['reject'](_0x513094);}return _0x5c6829[_0x068a('0x23')]();};}function saveUpdates(_0x5dd5f7,_0x28ac50){return function(_0x5eed22){if(_0x5eed22){return _0x5eed22[_0x068a('0x24')](_0x5dd5f7)[_0x068a('0x25')](function(_0x22bf7b){return _0x22bf7b;});}return null;};}function removeEntity(_0x67b425,_0x3d79ed){return function(_0x432ee0){if(_0x432ee0){return _0x432ee0['destroy']()[_0x068a('0x25')](function(){_0x67b425[_0x068a('0x1a')](0xcc)[_0x068a('0x26')]();});}};}function handleEntityNotFound(_0x454612,_0x3f55ca){return function(_0x187b82){if(!_0x187b82){_0x454612[_0x068a('0x19')](0x194);}return _0x187b82;};}function handleError(_0x543760,_0x1fb5ba){_0x1fb5ba=_0x1fb5ba||0x1f4;return function(_0x15f6ec){logger[_0x068a('0x27')](_0x15f6ec[_0x068a('0x28')]);if(_0x15f6ec['name']){delete _0x15f6ec[_0x068a('0x29')];}_0x543760[_0x068a('0x1a')](_0x1fb5ba)[_0x068a('0x2a')](_0x15f6ec);};}exports[_0x068a('0x2b')]=function(_0x14d1fe,_0x22aab9){var _0x41f84f={},_0x31a9cc={},_0x33b628={'count':0x0,'rows':[]};var _0x4e3a12=_[_0x068a('0x2c')](db['ZohoConfiguration'][_0x068a('0x2d')],function(_0x28c705){return{'name':_0x28c705[_0x068a('0x2e')],'type':_0x28c705[_0x068a('0x2f')][_0x068a('0x30')]};});_0x31a9cc[_0x068a('0x31')]=_[_0x068a('0x2c')](_0x4e3a12,_0x068a('0x29'));_0x31a9cc[_0x068a('0x32')]=_[_0x068a('0x33')](_0x14d1fe[_0x068a('0x32')]);_0x31a9cc[_0x068a('0x34')]=_[_0x068a('0x35')](_0x31a9cc[_0x068a('0x31')],_0x31a9cc[_0x068a('0x32')]);_0x41f84f['attributes']=_['intersection'](_0x31a9cc[_0x068a('0x31')],qs[_0x068a('0x36')](_0x14d1fe[_0x068a('0x32')]['fields']));_0x41f84f[_0x068a('0x37')]=_0x41f84f[_0x068a('0x37')][_0x068a('0x38')]?_0x41f84f['attributes']:_0x31a9cc[_0x068a('0x31')];if(!_0x14d1fe[_0x068a('0x32')][_0x068a('0x39')](_0x068a('0x3a'))){_0x41f84f['limit']=qs[_0x068a('0x1c')](_0x14d1fe[_0x068a('0x32')][_0x068a('0x1c')]);_0x41f84f[_0x068a('0x1b')]=qs['offset'](_0x14d1fe[_0x068a('0x32')][_0x068a('0x1b')]);}_0x41f84f['order']=qs[_0x068a('0x3b')](_0x14d1fe[_0x068a('0x32')]['sort']);_0x41f84f[_0x068a('0x3c')]=qs['filters'](_[_0x068a('0x3d')](_0x14d1fe[_0x068a('0x32')],_0x31a9cc[_0x068a('0x34')]),_0x4e3a12);if(_0x14d1fe[_0x068a('0x32')][_0x068a('0x3e')]){_0x41f84f['where']=_[_0x068a('0x3f')](_0x41f84f[_0x068a('0x3c')],{'$or':_[_0x068a('0x2c')](_0x4e3a12,function(_0xf8380c){if(_0xf8380c[_0x068a('0x2f')]!==_0x068a('0x40')){var _0xff2bcd={};_0xff2bcd[_0xf8380c[_0x068a('0x29')]]={'$like':'%'+_0x14d1fe[_0x068a('0x32')][_0x068a('0x3e')]+'%'};return _0xff2bcd;}})});}_0x41f84f=_[_0x068a('0x3f')]({},_0x41f84f,_0x14d1fe[_0x068a('0x41')]);var _0x5c521c={'where':_0x41f84f[_0x068a('0x3c')]};return db[_0x068a('0x42')][_0x068a('0x1e')](_0x5c521c)[_0x068a('0x25')](function(_0x1418e5){_0x33b628[_0x068a('0x1e')]=_0x1418e5;if(_0x14d1fe[_0x068a('0x32')]['includeAll']){_0x41f84f[_0x068a('0x43')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x41f84f);})['then'](function(_0x20564d){_0x33b628[_0x068a('0x44')]=_0x20564d;return _0x33b628;})[_0x068a('0x25')](respondWithFilteredResult(_0x22aab9,_0x41f84f))['catch'](handleError(_0x22aab9,null));};exports[_0x068a('0x45')]=function(_0x1aa517,_0x13c1e2){var _0x4a2cef={'raw':![],'where':{'id':_0x1aa517[_0x068a('0x46')]['id']}},_0xa452a0={};_0xa452a0[_0x068a('0x31')]=_['keys'](db[_0x068a('0x42')][_0x068a('0x2d')]);_0xa452a0['query']=_[_0x068a('0x33')](_0x1aa517['query']);_0xa452a0['filters']=_['intersection'](_0xa452a0[_0x068a('0x31')],_0xa452a0[_0x068a('0x32')]);_0x4a2cef[_0x068a('0x37')]=_[_0x068a('0x35')](_0xa452a0['model'],qs[_0x068a('0x36')](_0x1aa517['query']['fields']));_0x4a2cef[_0x068a('0x37')]=_0x4a2cef[_0x068a('0x37')][_0x068a('0x38')]?_0x4a2cef['attributes']:_0xa452a0['model'];if(_0x1aa517['query'][_0x068a('0x47')]){_0x4a2cef[_0x068a('0x43')]=[{'all':!![]}];}_0x4a2cef=_['merge']({},_0x4a2cef,_0x1aa517[_0x068a('0x41')]);return db[_0x068a('0x42')][_0x068a('0x48')](_0x4a2cef)[_0x068a('0x25')](handleEntityNotFound(_0x13c1e2,null))[_0x068a('0x25')](respondWithResult(_0x13c1e2,null))[_0x068a('0x49')](handleError(_0x13c1e2,null));};exports['create']=function(_0x371482,_0x546da1){return db[_0x068a('0x42')][_0x068a('0x4a')](_0x371482[_0x068a('0x4b')],{})['then'](respondWithResult(_0x546da1,0xc9))['catch'](handleError(_0x546da1,null));};exports[_0x068a('0x24')]=function(_0x4ccb78,_0x40b1d3){if(_0x4ccb78[_0x068a('0x4b')]['id']){delete _0x4ccb78['body']['id'];}return db[_0x068a('0x42')][_0x068a('0x48')]({'where':{'id':_0x4ccb78['params']['id']}})[_0x068a('0x25')](handleEntityNotFound(_0x40b1d3,null))['then'](saveUpdates(_0x4ccb78[_0x068a('0x4b')],null))['then'](respondWithResult(_0x40b1d3,null))[_0x068a('0x49')](handleError(_0x40b1d3,null));};exports['destroy']=function(_0x14be11,_0x3f95de){return db['ZohoConfiguration'][_0x068a('0x48')]({'where':{'id':_0x14be11[_0x068a('0x46')]['id']}})[_0x068a('0x25')](handleEntityNotFound(_0x3f95de,null))[_0x068a('0x25')](removeEntity(_0x3f95de,null))[_0x068a('0x49')](handleError(_0x3f95de,null));};exports[_0x068a('0x4c')]=function(_0x58a4db,_0x6c5076,_0x41407f){var _0x233dbd={};var _0x15205b={};var _0x42ac52;var _0x4b5ad6;return db['ZohoConfiguration'][_0x068a('0x4d')]({'where':{'id':_0x58a4db['params']['id']}})['then'](handleEntityNotFound(_0x6c5076,null))[_0x068a('0x25')](function(_0x142316){if(_0x142316){_0x42ac52=_0x142316;_0x15205b[_0x068a('0x31')]=_[_0x068a('0x33')](db['ZohoField']['rawAttributes']);_0x15205b[_0x068a('0x32')]=_[_0x068a('0x33')](_0x58a4db[_0x068a('0x32')]);_0x15205b['filters']=_[_0x068a('0x35')](_0x15205b[_0x068a('0x31')],_0x15205b[_0x068a('0x32')]);_0x233dbd[_0x068a('0x37')]=_['intersection'](_0x15205b['model'],qs[_0x068a('0x36')](_0x58a4db[_0x068a('0x32')][_0x068a('0x36')]));_0x233dbd[_0x068a('0x37')]=_0x233dbd['attributes'][_0x068a('0x38')]?_0x233dbd[_0x068a('0x37')]:_0x15205b['model'];_0x233dbd[_0x068a('0x4e')]=qs[_0x068a('0x3b')](_0x58a4db[_0x068a('0x32')][_0x068a('0x3b')]);_0x233dbd[_0x068a('0x3c')]=qs[_0x068a('0x34')](_[_0x068a('0x3d')](_0x58a4db[_0x068a('0x32')],_0x15205b[_0x068a('0x34')]));if(_0x58a4db[_0x068a('0x32')]['filter']){_0x233dbd[_0x068a('0x3c')]=_[_0x068a('0x3f')](_0x233dbd[_0x068a('0x3c')],{'$or':_['map'](_0x233dbd[_0x068a('0x37')],function(_0x530054){var _0x4f706c={};_0x4f706c[_0x530054]={'$like':'%'+_0x58a4db['query'][_0x068a('0x3e')]+'%'};return _0x4f706c;})});}_0x233dbd=_[_0x068a('0x3f')]({},_0x233dbd,_0x58a4db[_0x068a('0x41')]);return _0x42ac52[_0x068a('0x4c')](_0x233dbd);}})[_0x068a('0x25')](function(_0x3b0a0d){if(_0x3b0a0d){_0x4b5ad6=_0x3b0a0d[_0x068a('0x38')];if(!_0x58a4db[_0x068a('0x32')][_0x068a('0x39')](_0x068a('0x3a'))){_0x233dbd[_0x068a('0x1c')]=qs[_0x068a('0x1c')](_0x58a4db[_0x068a('0x32')][_0x068a('0x1c')]);_0x233dbd[_0x068a('0x1b')]=qs[_0x068a('0x1b')](_0x58a4db[_0x068a('0x32')][_0x068a('0x1b')]);}return _0x42ac52[_0x068a('0x4c')](_0x233dbd);}})['then'](function(_0xf90372){if(_0xf90372){return _0xf90372?{'count':_0x4b5ad6,'rows':_0xf90372}:null;}})[_0x068a('0x25')](respondWithResult(_0x6c5076,null))[_0x068a('0x49')](handleError(_0x6c5076,null));};exports[_0x068a('0x4f')]=function(_0x4b67a9,_0x38f9a2,_0x1e65b9){var _0x988e98={};var _0x1c8122={};var _0x36b12f;var _0x44967d;return db['ZohoConfiguration'][_0x068a('0x4d')]({'where':{'id':_0x4b67a9[_0x068a('0x46')]['id']}})[_0x068a('0x25')](handleEntityNotFound(_0x38f9a2,null))[_0x068a('0x25')](function(_0x1f986b){if(_0x1f986b){_0x36b12f=_0x1f986b;_0x1c8122[_0x068a('0x31')]=_[_0x068a('0x33')](db['ZohoField']['rawAttributes']);_0x1c8122[_0x068a('0x32')]=_['keys'](_0x4b67a9[_0x068a('0x32')]);_0x1c8122[_0x068a('0x34')]=_[_0x068a('0x35')](_0x1c8122[_0x068a('0x31')],_0x1c8122[_0x068a('0x32')]);_0x988e98[_0x068a('0x37')]=_[_0x068a('0x35')](_0x1c8122[_0x068a('0x31')],qs[_0x068a('0x36')](_0x4b67a9[_0x068a('0x32')]['fields']));_0x988e98[_0x068a('0x37')]=_0x988e98[_0x068a('0x37')]['length']?_0x988e98[_0x068a('0x37')]:_0x1c8122[_0x068a('0x31')];_0x988e98[_0x068a('0x4e')]=qs['sort'](_0x4b67a9[_0x068a('0x32')][_0x068a('0x3b')]);_0x988e98[_0x068a('0x3c')]=qs['filters'](_['pick'](_0x4b67a9['query'],_0x1c8122[_0x068a('0x34')]));if(_0x4b67a9['query'][_0x068a('0x3e')]){_0x988e98[_0x068a('0x3c')]=_['merge'](_0x988e98[_0x068a('0x3c')],{'$or':_[_0x068a('0x2c')](_0x988e98[_0x068a('0x37')],function(_0x19eaeb){var _0x1223d9={};_0x1223d9[_0x19eaeb]={'$like':'%'+_0x4b67a9[_0x068a('0x32')][_0x068a('0x3e')]+'%'};return _0x1223d9;})});}_0x988e98=_[_0x068a('0x3f')]({},_0x988e98,_0x4b67a9['options']);return _0x36b12f[_0x068a('0x4f')](_0x988e98);}})[_0x068a('0x25')](function(_0x5de040){if(_0x5de040){_0x44967d=_0x5de040[_0x068a('0x38')];if(!_0x4b67a9[_0x068a('0x32')][_0x068a('0x39')](_0x068a('0x3a'))){_0x988e98['limit']=qs[_0x068a('0x1c')](_0x4b67a9['query'][_0x068a('0x1c')]);_0x988e98['offset']=qs['offset'](_0x4b67a9[_0x068a('0x32')][_0x068a('0x1b')]);}return _0x36b12f[_0x068a('0x4f')](_0x988e98);}})['then'](function(_0x17a7dc){if(_0x17a7dc){return _0x17a7dc?{'count':_0x44967d,'rows':_0x17a7dc}:null;}})[_0x068a('0x25')](respondWithResult(_0x38f9a2,null))[_0x068a('0x49')](handleError(_0x38f9a2,null));};exports[_0x068a('0x50')]=function(_0x14584c,_0x5d2aac,_0x775bb0){var _0xa879f1={};var _0x5bc0eb={};var _0x2b3d91;var _0x232536;return db['ZohoConfiguration'][_0x068a('0x4d')]({'where':{'id':_0x14584c[_0x068a('0x46')]['id']}})[_0x068a('0x25')](handleEntityNotFound(_0x5d2aac,null))[_0x068a('0x25')](function(_0x8fb79a){if(_0x8fb79a){_0x2b3d91=_0x8fb79a;_0x5bc0eb['model']=_[_0x068a('0x33')](db[_0x068a('0x51')][_0x068a('0x2d')]);_0x5bc0eb['query']=_[_0x068a('0x33')](_0x14584c[_0x068a('0x32')]);_0x5bc0eb['filters']=_['intersection'](_0x5bc0eb[_0x068a('0x31')],_0x5bc0eb[_0x068a('0x32')]);_0xa879f1[_0x068a('0x37')]=_[_0x068a('0x35')](_0x5bc0eb[_0x068a('0x31')],qs[_0x068a('0x36')](_0x14584c[_0x068a('0x32')]['fields']));_0xa879f1[_0x068a('0x37')]=_0xa879f1[_0x068a('0x37')][_0x068a('0x38')]?_0xa879f1[_0x068a('0x37')]:_0x5bc0eb[_0x068a('0x31')];_0xa879f1[_0x068a('0x4e')]=qs['sort'](_0x14584c[_0x068a('0x32')][_0x068a('0x3b')]);_0xa879f1['where']=qs[_0x068a('0x34')](_[_0x068a('0x3d')](_0x14584c[_0x068a('0x32')],_0x5bc0eb[_0x068a('0x34')]));if(_0x14584c['query'][_0x068a('0x3e')]){_0xa879f1[_0x068a('0x3c')]=_[_0x068a('0x3f')](_0xa879f1[_0x068a('0x3c')],{'$or':_['map'](_0xa879f1[_0x068a('0x37')],function(_0x1def1a){var _0x2c7fb6={};_0x2c7fb6[_0x1def1a]={'$like':'%'+_0x14584c[_0x068a('0x32')][_0x068a('0x3e')]+'%'};return _0x2c7fb6;})});}_0xa879f1=_[_0x068a('0x3f')]({},_0xa879f1,_0x14584c[_0x068a('0x41')]);return _0x2b3d91['getDescriptions'](_0xa879f1);}})[_0x068a('0x25')](function(_0x586c91){if(_0x586c91){_0x232536=_0x586c91[_0x068a('0x38')];if(!_0x14584c[_0x068a('0x32')][_0x068a('0x39')]('nolimit')){_0xa879f1[_0x068a('0x1c')]=qs['limit'](_0x14584c['query'][_0x068a('0x1c')]);_0xa879f1[_0x068a('0x1b')]=qs[_0x068a('0x1b')](_0x14584c[_0x068a('0x32')][_0x068a('0x1b')]);}return _0x2b3d91[_0x068a('0x50')](_0xa879f1);}})[_0x068a('0x25')](function(_0x3c6af8){if(_0x3c6af8){return _0x3c6af8?{'count':_0x232536,'rows':_0x3c6af8}:null;}})['then'](respondWithResult(_0x5d2aac,null))['catch'](handleError(_0x5d2aac,null));}; \ No newline at end of file +var _0xd36b=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','find','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','nolimit','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x4c05da,_0x358ef2){var _0x17cae9=function(_0xe25a02){while(--_0xe25a02){_0x4c05da['push'](_0x4c05da['shift']());}};_0x17cae9(++_0x358ef2);}(_0xd36b,0x1a3));var _0xbd36=function(_0x27c11a,_0x223b7c){_0x27c11a=_0x27c11a-0x0;var _0x5cc708=_0xd36b[_0x27c11a];return _0x5cc708;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbd36('0x0'));var jsonpatch=require(_0xbd36('0x1'));var rp=require('request-promise');var moment=require(_0xbd36('0x2'));var BPromise=require(_0xbd36('0x3'));var Mustache=require('mustache');var util=require(_0xbd36('0x4'));var path=require('path');var sox=require(_0xbd36('0x5'));var csv=require(_0xbd36('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd36('0x7'));var _=require(_0xbd36('0x8'));var squel=require(_0xbd36('0x9'));var crypto=require(_0xbd36('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbd36('0x6'));var querystring=require(_0xbd36('0xb'));var Papa=require(_0xbd36('0xc'));var Redis=require('ioredis');var authService=require(_0xbd36('0xd'));var qs=require(_0xbd36('0xe'));var as=require(_0xbd36('0xf'));var hardwareService=require(_0xbd36('0x10'));var logger=require(_0xbd36('0x11'))(_0xbd36('0x12'));var utils=require(_0xbd36('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbd36('0x14'));var db=require(_0xbd36('0x15'))['db'];function respondWithStatusCode(_0x2aca2e,_0x5682b6){_0x5682b6=_0x5682b6||0xcc;return function(_0x48f4b2){if(_0x48f4b2){return _0x2aca2e[_0xbd36('0x16')](_0x5682b6);}return _0x2aca2e[_0xbd36('0x17')](_0x5682b6)['end']();};}function respondWithResult(_0x3fe5d1,_0x3dfee8){_0x3dfee8=_0x3dfee8||0xc8;return function(_0x36356c){if(_0x36356c){return _0x3fe5d1[_0xbd36('0x17')](_0x3dfee8)[_0xbd36('0x18')](_0x36356c);}};}function respondWithFilteredResult(_0xba0202,_0x1d9264){return function(_0x1ddc33){if(_0x1ddc33){var _0x224f3d=typeof _0x1d9264['offset']===_0xbd36('0x19')&&typeof _0x1d9264[_0xbd36('0x1a')]===_0xbd36('0x19');var _0x423579=_0x1ddc33['count'];var _0x598a24=_0x224f3d?0x0:_0x1d9264['offset'];var _0x38d2ea=_0x224f3d?_0x1ddc33[_0xbd36('0x1b')]:_0x1d9264[_0xbd36('0x1c')]+_0x1d9264[_0xbd36('0x1a')];var _0x454817;if(_0x38d2ea>=_0x423579){_0x38d2ea=_0x423579;_0x454817=0xc8;}else{_0x454817=0xce;}_0xba0202[_0xbd36('0x17')](_0x454817);return _0xba0202[_0xbd36('0x1d')](_0xbd36('0x1e'),_0x598a24+'-'+_0x38d2ea+'/'+_0x423579)[_0xbd36('0x18')](_0x1ddc33);}return null;};}function patchUpdates(_0x5f2224){return function(_0x3fe020){try{jsonpatch[_0xbd36('0x1f')](_0x3fe020,_0x5f2224,!![]);}catch(_0x45c738){return BPromise[_0xbd36('0x20')](_0x45c738);}return _0x3fe020['save']();};}function saveUpdates(_0x5366e9,_0x2ee7bf){return function(_0x4624c5){if(_0x4624c5){return _0x4624c5[_0xbd36('0x21')](_0x5366e9)[_0xbd36('0x22')](function(_0x23a970){return _0x23a970;});}return null;};}function removeEntity(_0x28333d,_0x19cba7){return function(_0x3d0587){if(_0x3d0587){return _0x3d0587[_0xbd36('0x23')]()['then'](function(){_0x28333d[_0xbd36('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8747,_0x3eabc4){return function(_0x582d52){if(!_0x582d52){_0x1f8747[_0xbd36('0x16')](0x194);}return _0x582d52;};}function handleError(_0x25057b,_0x39404f){_0x39404f=_0x39404f||0x1f4;return function(_0x51ade4){logger['error'](_0x51ade4[_0xbd36('0x24')]);if(_0x51ade4[_0xbd36('0x25')]){delete _0x51ade4['name'];}_0x25057b[_0xbd36('0x17')](_0x39404f)[_0xbd36('0x26')](_0x51ade4);};}exports[_0xbd36('0x27')]=function(_0x27c4cd,_0x1f8cd3){var _0x53ce29={},_0x1a22ce={},_0x5a6844={'count':0x0,'rows':[]};var _0x4bc3af=_[_0xbd36('0x28')](db[_0xbd36('0x29')][_0xbd36('0x2a')],function(_0x3ec57c){return{'name':_0x3ec57c[_0xbd36('0x2b')],'type':_0x3ec57c[_0xbd36('0x2c')][_0xbd36('0x2d')]};});_0x1a22ce[_0xbd36('0x2e')]=_[_0xbd36('0x28')](_0x4bc3af,_0xbd36('0x25'));_0x1a22ce['query']=_[_0xbd36('0x2f')](_0x27c4cd[_0xbd36('0x30')]);_0x1a22ce[_0xbd36('0x31')]=_[_0xbd36('0x32')](_0x1a22ce[_0xbd36('0x2e')],_0x1a22ce['query']);_0x53ce29[_0xbd36('0x33')]=_['intersection'](_0x1a22ce[_0xbd36('0x2e')],qs[_0xbd36('0x34')](_0x27c4cd[_0xbd36('0x30')][_0xbd36('0x34')]));_0x53ce29[_0xbd36('0x33')]=_0x53ce29['attributes'][_0xbd36('0x35')]?_0x53ce29['attributes']:_0x1a22ce[_0xbd36('0x2e')];if(!_0x27c4cd[_0xbd36('0x30')][_0xbd36('0x36')]('nolimit')){_0x53ce29[_0xbd36('0x1a')]=qs[_0xbd36('0x1a')](_0x27c4cd['query'][_0xbd36('0x1a')]);_0x53ce29['offset']=qs[_0xbd36('0x1c')](_0x27c4cd[_0xbd36('0x30')][_0xbd36('0x1c')]);}_0x53ce29[_0xbd36('0x37')]=qs[_0xbd36('0x38')](_0x27c4cd[_0xbd36('0x30')][_0xbd36('0x38')]);_0x53ce29[_0xbd36('0x39')]=qs[_0xbd36('0x31')](_[_0xbd36('0x3a')](_0x27c4cd[_0xbd36('0x30')],_0x1a22ce[_0xbd36('0x31')]),_0x4bc3af);if(_0x27c4cd[_0xbd36('0x30')][_0xbd36('0x3b')]){_0x53ce29['where']=_[_0xbd36('0x3c')](_0x53ce29['where'],{'$or':_['map'](_0x4bc3af,function(_0x28c06b){if(_0x28c06b[_0xbd36('0x2c')]!==_0xbd36('0x3d')){var _0x121f9a={};_0x121f9a[_0x28c06b[_0xbd36('0x25')]]={'$like':'%'+_0x27c4cd[_0xbd36('0x30')][_0xbd36('0x3b')]+'%'};return _0x121f9a;}})});}_0x53ce29=_[_0xbd36('0x3c')]({},_0x53ce29,_0x27c4cd[_0xbd36('0x3e')]);var _0x260a32={'where':_0x53ce29[_0xbd36('0x39')]};return db['ZohoConfiguration'][_0xbd36('0x1b')](_0x260a32)[_0xbd36('0x22')](function(_0x1a2c92){_0x5a6844[_0xbd36('0x1b')]=_0x1a2c92;if(_0x27c4cd['query'][_0xbd36('0x3f')]){_0x53ce29[_0xbd36('0x40')]=[{'all':!![]}];}return db[_0xbd36('0x29')][_0xbd36('0x41')](_0x53ce29);})[_0xbd36('0x22')](function(_0x5d451a){_0x5a6844[_0xbd36('0x42')]=_0x5d451a;return _0x5a6844;})[_0xbd36('0x22')](respondWithFilteredResult(_0x1f8cd3,_0x53ce29))['catch'](handleError(_0x1f8cd3,null));};exports['show']=function(_0x5aec7b,_0x16f512){var _0x1365bf={'raw':![],'where':{'id':_0x5aec7b[_0xbd36('0x43')]['id']}},_0x211db4={};_0x211db4[_0xbd36('0x2e')]=_[_0xbd36('0x2f')](db[_0xbd36('0x29')][_0xbd36('0x2a')]);_0x211db4[_0xbd36('0x30')]=_[_0xbd36('0x2f')](_0x5aec7b[_0xbd36('0x30')]);_0x211db4[_0xbd36('0x31')]=_[_0xbd36('0x32')](_0x211db4[_0xbd36('0x2e')],_0x211db4[_0xbd36('0x30')]);_0x1365bf[_0xbd36('0x33')]=_[_0xbd36('0x32')](_0x211db4[_0xbd36('0x2e')],qs[_0xbd36('0x34')](_0x5aec7b['query'][_0xbd36('0x34')]));_0x1365bf[_0xbd36('0x33')]=_0x1365bf[_0xbd36('0x33')][_0xbd36('0x35')]?_0x1365bf[_0xbd36('0x33')]:_0x211db4[_0xbd36('0x2e')];if(_0x5aec7b[_0xbd36('0x30')][_0xbd36('0x3f')]){_0x1365bf[_0xbd36('0x40')]=[{'all':!![]}];}_0x1365bf=_[_0xbd36('0x3c')]({},_0x1365bf,_0x5aec7b[_0xbd36('0x3e')]);return db['ZohoConfiguration']['find'](_0x1365bf)['then'](handleEntityNotFound(_0x16f512,null))[_0xbd36('0x22')](respondWithResult(_0x16f512,null))[_0xbd36('0x44')](handleError(_0x16f512,null));};exports['create']=function(_0x32f647,_0x19e732){return db[_0xbd36('0x29')][_0xbd36('0x45')](_0x32f647['body'],{})[_0xbd36('0x22')](respondWithResult(_0x19e732,0xc9))['catch'](handleError(_0x19e732,null));};exports[_0xbd36('0x21')]=function(_0x150116,_0x2aaca7){if(_0x150116['body']['id']){delete _0x150116['body']['id'];}return db[_0xbd36('0x29')][_0xbd36('0x46')]({'where':{'id':_0x150116[_0xbd36('0x43')]['id']}})[_0xbd36('0x22')](handleEntityNotFound(_0x2aaca7,null))['then'](saveUpdates(_0x150116[_0xbd36('0x47')],null))[_0xbd36('0x22')](respondWithResult(_0x2aaca7,null))[_0xbd36('0x44')](handleError(_0x2aaca7,null));};exports[_0xbd36('0x23')]=function(_0x1421c5,_0x338103){return db['ZohoConfiguration'][_0xbd36('0x46')]({'where':{'id':_0x1421c5[_0xbd36('0x43')]['id']}})[_0xbd36('0x22')](handleEntityNotFound(_0x338103,null))[_0xbd36('0x22')](removeEntity(_0x338103,null))['catch'](handleError(_0x338103,null));};exports[_0xbd36('0x48')]=function(_0x5dfc96,_0x552b58,_0x1378f0){var _0x1295fa={};var _0x1acf39={};var _0x61ab53;var _0x3cc05c;return db[_0xbd36('0x29')][_0xbd36('0x49')]({'where':{'id':_0x5dfc96[_0xbd36('0x43')]['id']}})[_0xbd36('0x22')](handleEntityNotFound(_0x552b58,null))['then'](function(_0x10d2c9){if(_0x10d2c9){_0x61ab53=_0x10d2c9;_0x1acf39[_0xbd36('0x2e')]=_[_0xbd36('0x2f')](db[_0xbd36('0x4a')][_0xbd36('0x2a')]);_0x1acf39[_0xbd36('0x30')]=_[_0xbd36('0x2f')](_0x5dfc96[_0xbd36('0x30')]);_0x1acf39[_0xbd36('0x31')]=_[_0xbd36('0x32')](_0x1acf39['model'],_0x1acf39[_0xbd36('0x30')]);_0x1295fa[_0xbd36('0x33')]=_[_0xbd36('0x32')](_0x1acf39[_0xbd36('0x2e')],qs[_0xbd36('0x34')](_0x5dfc96[_0xbd36('0x30')][_0xbd36('0x34')]));_0x1295fa[_0xbd36('0x33')]=_0x1295fa['attributes']['length']?_0x1295fa[_0xbd36('0x33')]:_0x1acf39['model'];_0x1295fa['order']=qs['sort'](_0x5dfc96[_0xbd36('0x30')][_0xbd36('0x38')]);_0x1295fa[_0xbd36('0x39')]=qs[_0xbd36('0x31')](_['pick'](_0x5dfc96[_0xbd36('0x30')],_0x1acf39[_0xbd36('0x31')]));if(_0x5dfc96['query'][_0xbd36('0x3b')]){_0x1295fa[_0xbd36('0x39')]=_[_0xbd36('0x3c')](_0x1295fa['where'],{'$or':_[_0xbd36('0x28')](_0x1295fa[_0xbd36('0x33')],function(_0xc67b48){var _0x142138={};_0x142138[_0xc67b48]={'$like':'%'+_0x5dfc96[_0xbd36('0x30')]['filter']+'%'};return _0x142138;})});}_0x1295fa=_['merge']({},_0x1295fa,_0x5dfc96[_0xbd36('0x3e')]);return _0x61ab53['getFields'](_0x1295fa);}})[_0xbd36('0x22')](function(_0x2c1ad4){if(_0x2c1ad4){_0x3cc05c=_0x2c1ad4[_0xbd36('0x35')];if(!_0x5dfc96[_0xbd36('0x30')]['hasOwnProperty']('nolimit')){_0x1295fa[_0xbd36('0x1a')]=qs[_0xbd36('0x1a')](_0x5dfc96['query'][_0xbd36('0x1a')]);_0x1295fa[_0xbd36('0x1c')]=qs['offset'](_0x5dfc96[_0xbd36('0x30')]['offset']);}return _0x61ab53[_0xbd36('0x48')](_0x1295fa);}})[_0xbd36('0x22')](function(_0x2427e0){if(_0x2427e0){return _0x2427e0?{'count':_0x3cc05c,'rows':_0x2427e0}:null;}})[_0xbd36('0x22')](respondWithResult(_0x552b58,null))['catch'](handleError(_0x552b58,null));};exports[_0xbd36('0x4b')]=function(_0x34075b,_0x1e5c76,_0x143b35){var _0x1ecdfc={};var _0x597911={};var _0xcd62ac;var _0x4ce9cd;return db[_0xbd36('0x29')][_0xbd36('0x49')]({'where':{'id':_0x34075b[_0xbd36('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e5c76,null))[_0xbd36('0x22')](function(_0x158090){if(_0x158090){_0xcd62ac=_0x158090;_0x597911['model']=_[_0xbd36('0x2f')](db[_0xbd36('0x4a')][_0xbd36('0x2a')]);_0x597911[_0xbd36('0x30')]=_[_0xbd36('0x2f')](_0x34075b[_0xbd36('0x30')]);_0x597911[_0xbd36('0x31')]=_[_0xbd36('0x32')](_0x597911[_0xbd36('0x2e')],_0x597911[_0xbd36('0x30')]);_0x1ecdfc['attributes']=_['intersection'](_0x597911['model'],qs[_0xbd36('0x34')](_0x34075b[_0xbd36('0x30')][_0xbd36('0x34')]));_0x1ecdfc['attributes']=_0x1ecdfc[_0xbd36('0x33')]['length']?_0x1ecdfc['attributes']:_0x597911['model'];_0x1ecdfc[_0xbd36('0x37')]=qs[_0xbd36('0x38')](_0x34075b[_0xbd36('0x30')]['sort']);_0x1ecdfc[_0xbd36('0x39')]=qs[_0xbd36('0x31')](_[_0xbd36('0x3a')](_0x34075b[_0xbd36('0x30')],_0x597911[_0xbd36('0x31')]));if(_0x34075b[_0xbd36('0x30')][_0xbd36('0x3b')]){_0x1ecdfc[_0xbd36('0x39')]=_[_0xbd36('0x3c')](_0x1ecdfc['where'],{'$or':_[_0xbd36('0x28')](_0x1ecdfc[_0xbd36('0x33')],function(_0xa329cc){var _0x33773e={};_0x33773e[_0xa329cc]={'$like':'%'+_0x34075b[_0xbd36('0x30')][_0xbd36('0x3b')]+'%'};return _0x33773e;})});}_0x1ecdfc=_['merge']({},_0x1ecdfc,_0x34075b[_0xbd36('0x3e')]);return _0xcd62ac['getSubjects'](_0x1ecdfc);}})[_0xbd36('0x22')](function(_0x5d37f2){if(_0x5d37f2){_0x4ce9cd=_0x5d37f2['length'];if(!_0x34075b[_0xbd36('0x30')][_0xbd36('0x36')]('nolimit')){_0x1ecdfc[_0xbd36('0x1a')]=qs[_0xbd36('0x1a')](_0x34075b[_0xbd36('0x30')]['limit']);_0x1ecdfc['offset']=qs[_0xbd36('0x1c')](_0x34075b['query'][_0xbd36('0x1c')]);}return _0xcd62ac['getSubjects'](_0x1ecdfc);}})[_0xbd36('0x22')](function(_0x3ffc80){if(_0x3ffc80){return _0x3ffc80?{'count':_0x4ce9cd,'rows':_0x3ffc80}:null;}})['then'](respondWithResult(_0x1e5c76,null))[_0xbd36('0x44')](handleError(_0x1e5c76,null));};exports[_0xbd36('0x4c')]=function(_0x5e6944,_0x46a871,_0x2a447c){var _0x6c85b8={};var _0x30080f={};var _0xe4f9f;var _0x41d16d;return db[_0xbd36('0x29')][_0xbd36('0x49')]({'where':{'id':_0x5e6944[_0xbd36('0x43')]['id']}})[_0xbd36('0x22')](handleEntityNotFound(_0x46a871,null))['then'](function(_0x1a02cc){if(_0x1a02cc){_0xe4f9f=_0x1a02cc;_0x30080f['model']=_['keys'](db[_0xbd36('0x4a')][_0xbd36('0x2a')]);_0x30080f[_0xbd36('0x30')]=_[_0xbd36('0x2f')](_0x5e6944[_0xbd36('0x30')]);_0x30080f[_0xbd36('0x31')]=_[_0xbd36('0x32')](_0x30080f['model'],_0x30080f[_0xbd36('0x30')]);_0x6c85b8[_0xbd36('0x33')]=_['intersection'](_0x30080f[_0xbd36('0x2e')],qs['fields'](_0x5e6944['query'][_0xbd36('0x34')]));_0x6c85b8[_0xbd36('0x33')]=_0x6c85b8[_0xbd36('0x33')]['length']?_0x6c85b8[_0xbd36('0x33')]:_0x30080f[_0xbd36('0x2e')];_0x6c85b8[_0xbd36('0x37')]=qs[_0xbd36('0x38')](_0x5e6944[_0xbd36('0x30')][_0xbd36('0x38')]);_0x6c85b8[_0xbd36('0x39')]=qs[_0xbd36('0x31')](_[_0xbd36('0x3a')](_0x5e6944[_0xbd36('0x30')],_0x30080f['filters']));if(_0x5e6944[_0xbd36('0x30')][_0xbd36('0x3b')]){_0x6c85b8[_0xbd36('0x39')]=_['merge'](_0x6c85b8[_0xbd36('0x39')],{'$or':_[_0xbd36('0x28')](_0x6c85b8['attributes'],function(_0x2fe9a2){var _0x270f9f={};_0x270f9f[_0x2fe9a2]={'$like':'%'+_0x5e6944['query']['filter']+'%'};return _0x270f9f;})});}_0x6c85b8=_[_0xbd36('0x3c')]({},_0x6c85b8,_0x5e6944[_0xbd36('0x3e')]);return _0xe4f9f['getDescriptions'](_0x6c85b8);}})[_0xbd36('0x22')](function(_0x409abf){if(_0x409abf){_0x41d16d=_0x409abf[_0xbd36('0x35')];if(!_0x5e6944[_0xbd36('0x30')]['hasOwnProperty'](_0xbd36('0x4d'))){_0x6c85b8[_0xbd36('0x1a')]=qs[_0xbd36('0x1a')](_0x5e6944['query']['limit']);_0x6c85b8['offset']=qs['offset'](_0x5e6944[_0xbd36('0x30')][_0xbd36('0x1c')]);}return _0xe4f9f[_0xbd36('0x4c')](_0x6c85b8);}})[_0xbd36('0x22')](function(_0x1da247){if(_0x1da247){return _0x1da247?{'count':_0x41d16d,'rows':_0x1da247}:null;}})[_0xbd36('0x22')](respondWithResult(_0x46a871,null))[_0xbd36('0x44')](handleError(_0x46a871,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 49e6e23..782efc2 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 _0x1179=['../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x30bac8,_0x318577){var _0xc63696=function(_0xc64db6){while(--_0xc64db6){_0x30bac8['push'](_0x30bac8['shift']());}};_0xc63696(++_0x318577);}(_0x1179,0x171));var _0x9117=function(_0x580c76,_0x532c5c){_0x580c76=_0x580c76-0x0;var _0x39127c=_0x1179[_0x580c76];return _0x39127c;};'use strict';var _=require(_0x9117('0x0'));var util=require(_0x9117('0x1'));var logger=require(_0x9117('0x2'))(_0x9117('0x3'));var moment=require(_0x9117('0x4'));var BPromise=require(_0x9117('0x5'));var rp=require(_0x9117('0x6'));var fs=require('fs');var path=require(_0x9117('0x7'));var rimraf=require(_0x9117('0x8'));var config=require(_0x9117('0x9'));var attributes=require(_0x9117('0xa'));module[_0x9117('0xb')]=function(_0x25524e,_0x4c837d){return _0x25524e[_0x9117('0xc')](_0x9117('0xd'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8221=['rimraf','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4f66ab,_0x283eff){var _0x109adc=function(_0x5bb320){while(--_0x5bb320){_0x4f66ab['push'](_0x4f66ab['shift']());}};_0x109adc(++_0x283eff);}(_0x8221,0x88));var _0x1822=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x8221[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x1822('0x0'));var util=require('util');var logger=require(_0x1822('0x1'))(_0x1822('0x2'));var moment=require(_0x1822('0x3'));var BPromise=require(_0x1822('0x4'));var rp=require(_0x1822('0x5'));var fs=require('fs');var path=require(_0x1822('0x6'));var rimraf=require(_0x1822('0x7'));var config=require(_0x1822('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x1822('0x9')]=function(_0xf153a5,_0xd7b190){return _0xf153a5[_0x1822('0xa')](_0x1822('0xb'),attributes,{'tableName':_0x1822('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 f3976ff..9bf718f 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 _0x5209=['../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x535596,_0x15c174){var _0x5751dd=function(_0x2b3a50){while(--_0x2b3a50){_0x535596['push'](_0x535596['shift']());}};_0x5751dd(++_0x15c174);}(_0x5209,0xbf));var _0x9520=function(_0x231b2c,_0x556d64){_0x231b2c=_0x231b2c-0x0;var _0x1c1e20=_0x5209[_0x231b2c];return _0x1c1e20;};'use strict';var _=require(_0x9520('0x0'));var util=require(_0x9520('0x1'));var moment=require(_0x9520('0x2'));var BPromise=require(_0x9520('0x3'));var rs=require(_0x9520('0x4'));var fs=require('fs');var Redis=require(_0x9520('0x5'));var db=require(_0x9520('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9520('0x7'));var jayson=require(_0x9520('0x8'));var client=jayson[_0x9520('0x9')][_0x9520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x509717,_0x3a2ee0,_0x5bf670){return new BPromise(function(_0x5b52af,_0x10d501){return client[_0x9520('0xb')](_0x509717,_0x5bf670)[_0x9520('0xc')](function(_0x1f9531){logger[_0x9520('0xd')](_0x9520('0xe'),_0x3a2ee0,_0x9520('0xf'));logger[_0x9520('0x10')](_0x9520('0x11'),_0x3a2ee0,_0x9520('0xf'),JSON[_0x9520('0x12')](_0x1f9531));if(_0x1f9531[_0x9520('0x13')]){if(_0x1f9531[_0x9520('0x13')]['code']===0x1f4){logger[_0x9520('0x13')](_0x9520('0xe'),_0x3a2ee0,_0x1f9531[_0x9520('0x13')][_0x9520('0x14')]);return _0x10d501(_0x1f9531[_0x9520('0x13')][_0x9520('0x14')]);}logger['error'](_0x9520('0xe'),_0x3a2ee0,_0x1f9531['error'][_0x9520('0x14')]);return _0x5b52af(_0x1f9531[_0x9520('0x13')][_0x9520('0x14')]);}else{logger[_0x9520('0xd')](_0x9520('0xe'),_0x3a2ee0,_0x9520('0xf'));_0x5b52af(_0x1f9531[_0x9520('0x15')][_0x9520('0x14')]);}})['catch'](function(_0x3393ac){logger[_0x9520('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x3a2ee0,_0x3393ac);_0x10d501(_0x3393ac);});});} \ No newline at end of file +var _0x18ac=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2a5526,_0x60e410){var _0x5df58b=function(_0x1150ee){while(--_0x1150ee){_0x2a5526['push'](_0x2a5526['shift']());}};_0x5df58b(++_0x60e410);}(_0x18ac,0xe6));var _0xc18a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x18ac[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xc18a('0x0'));var util=require(_0xc18a('0x1'));var moment=require(_0xc18a('0x2'));var BPromise=require(_0xc18a('0x3'));var rs=require(_0xc18a('0x4'));var fs=require('fs');var Redis=require(_0xc18a('0x5'));var db=require(_0xc18a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc18a('0x7'))(_0xc18a('0x8'));var config=require(_0xc18a('0x9'));var jayson=require(_0xc18a('0xa'));var client=jayson[_0xc18a('0xb')][_0xc18a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36aac6,_0x5a020c,_0x42c129){return new BPromise(function(_0x2a6430,_0x5d1ed1){return client[_0xc18a('0xd')](_0x36aac6,_0x42c129)[_0xc18a('0xe')](function(_0x437d62){logger[_0xc18a('0xf')](_0xc18a('0x10'),_0x5a020c,'request\x20sent');logger[_0xc18a('0x11')](_0xc18a('0x12'),_0x5a020c,_0xc18a('0x13'),JSON['stringify'](_0x437d62));if(_0x437d62[_0xc18a('0x14')]){if(_0x437d62[_0xc18a('0x14')][_0xc18a('0x15')]===0x1f4){logger[_0xc18a('0x14')](_0xc18a('0x10'),_0x5a020c,_0x437d62[_0xc18a('0x14')][_0xc18a('0x16')]);return _0x5d1ed1(_0x437d62[_0xc18a('0x14')][_0xc18a('0x16')]);}logger[_0xc18a('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x5a020c,_0x437d62[_0xc18a('0x14')][_0xc18a('0x16')]);return _0x2a6430(_0x437d62[_0xc18a('0x14')][_0xc18a('0x16')]);}else{logger[_0xc18a('0xf')](_0xc18a('0x10'),_0x5a020c,_0xc18a('0x13'));_0x2a6430(_0x437d62['result']['message']);}})['catch'](function(_0x4897a4){logger[_0xc18a('0x14')](_0xc18a('0x10'),_0x5a020c,_0x4897a4);_0x5d1ed1(_0x4897a4);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 16ed4d9..1288237 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 _0xdf65=['Router','fs-extra','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2300c7,_0x255f74){var _0x23f720=function(_0x3fea57){while(--_0x3fea57){_0x2300c7['push'](_0x2300c7['shift']());}};_0x23f720(++_0x255f74);}(_0xdf65,0x9b));var _0x5df6=function(_0x35979f,_0x527e17){_0x35979f=_0x35979f-0x0;var _0x3a13b5=_0xdf65[_0x35979f];return _0x3a13b5;};'use strict';var multer=require(_0x5df6('0x0'));var util=require(_0x5df6('0x1'));var path=require(_0x5df6('0x2'));var timeout=require(_0x5df6('0x3'));var express=require(_0x5df6('0x4'));var router=express[_0x5df6('0x5')]();var fs_extra=require(_0x5df6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5df6('0x7'));var config=require('../../config/environment');var controller=require(_0x5df6('0x8'));router[_0x5df6('0x9')]('/',auth[_0x5df6('0xa')](),controller[_0x5df6('0xb')]);router[_0x5df6('0x9')](_0x5df6('0xc'),auth['isAuthenticated'](),controller[_0x5df6('0xd')]);router[_0x5df6('0xe')]('/',auth[_0x5df6('0xa')](),controller[_0x5df6('0xf')]);router['put']('/:id',auth[_0x5df6('0xa')](),controller[_0x5df6('0x10')]);router[_0x5df6('0x11')](_0x5df6('0xc'),auth['isAuthenticated'](),controller[_0x5df6('0x12')]);module[_0x5df6('0x13')]=router; \ No newline at end of file +var _0x6625=['get','isAuthenticated','index','/:id','show','post','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x1834e1,_0x52fb40){var _0x12bbca=function(_0x1673e9){while(--_0x1673e9){_0x1834e1['push'](_0x1834e1['shift']());}};_0x12bbca(++_0x52fb40);}(_0x6625,0x117));var _0x5662=function(_0x45173e,_0x17ec62){_0x45173e=_0x45173e-0x0;var _0x304954=_0x6625[_0x45173e];return _0x304954;};'use strict';var multer=require(_0x5662('0x0'));var util=require('util');var path=require(_0x5662('0x1'));var timeout=require(_0x5662('0x2'));var express=require(_0x5662('0x3'));var router=express['Router']();var fs_extra=require(_0x5662('0x4'));var auth=require(_0x5662('0x5'));var interaction=require(_0x5662('0x6'));var config=require(_0x5662('0x7'));var controller=require(_0x5662('0x8'));router[_0x5662('0x9')]('/',auth[_0x5662('0xa')](),controller[_0x5662('0xb')]);router[_0x5662('0x9')](_0x5662('0xc'),auth[_0x5662('0xa')](),controller[_0x5662('0xd')]);router[_0x5662('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5662('0xc'),auth[_0x5662('0xa')](),controller[_0x5662('0xf')]);router[_0x5662('0x10')](_0x5662('0xc'),auth[_0x5662('0xa')](),controller[_0x5662('0x11')]);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 b53d035..588929f 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 _0x1d95=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x1ae467,_0x14fe63){var _0x251cc9=function(_0x29b655){while(--_0x29b655){_0x1ae467['push'](_0x1ae467['shift']());}};_0x251cc9(++_0x14fe63);}(_0x1d95,0x117));var _0x51d9=function(_0x1f725c,_0x6e4868){_0x1f725c=_0x1f725c-0x0;var _0x39023f=_0x1d95[_0x1f725c];return _0x39023f;};'use strict';var Sequelize=require(_0x51d9('0x0'));module[_0x51d9('0x1')]={'type':{'type':Sequelize[_0x51d9('0x2')](_0x51d9('0x3'),_0x51d9('0x4'),_0x51d9('0x5'),_0x51d9('0x6'),_0x51d9('0x7')),'defaultValue':_0x51d9('0x3')},'content':{'type':Sequelize[_0x51d9('0x8')]},'key':{'type':Sequelize[_0x51d9('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x51d9('0x3'),_0x51d9('0x4'),_0x51d9('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x51d9('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x51d9('0x8')]}}; \ No newline at end of file +var _0x6c0a=['sequelize','exports','string','variable','keyValue','STRING','customVariable','BOOLEAN'];(function(_0x33a098,_0x4b7277){var _0x375125=function(_0x2b3305){while(--_0x2b3305){_0x33a098['push'](_0x33a098['shift']());}};_0x375125(++_0x4b7277);}(_0x6c0a,0xf8));var _0xa6c0=function(_0x176be6,_0x52b808){_0x176be6=_0x176be6-0x0;var _0x252021=_0x6c0a[_0x176be6];return _0x252021;};'use strict';var Sequelize=require(_0xa6c0('0x0'));module[_0xa6c0('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa6c0('0x2'),_0xa6c0('0x3'),'customVariable',_0xa6c0('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa6c0('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa6c0('0x2'),_0xa6c0('0x3'),_0xa6c0('0x6'))},'keyContent':{'type':Sequelize[_0xa6c0('0x5')]},'idField':{'type':Sequelize[_0xa6c0('0x5')]},'nameField':{'type':Sequelize[_0xa6c0('0x5')]},'customField':{'type':Sequelize[_0xa6c0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 93647c1..9f22e4a 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 _0x845f=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','ZohoField','length','catch','create','body','find','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x424a5e,_0x3cbb66){var _0x38672b=function(_0x3bc55c){while(--_0x3bc55c){_0x424a5e['push'](_0x424a5e['shift']());}};_0x38672b(++_0x3cbb66);}(_0x845f,0x1b8));var _0xf845=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x845f[_0x32b542];return _0x554d54;};'use strict';var emlformat=require(_0xf845('0x0'));var rimraf=require(_0xf845('0x1'));var zipdir=require(_0xf845('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf845('0x3'));var moment=require(_0xf845('0x4'));var BPromise=require(_0xf845('0x5'));var Mustache=require(_0xf845('0x6'));var util=require(_0xf845('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf845('0x8'));var ejs=require(_0xf845('0x9'));var fs=require('fs');var fs_extra=require(_0xf845('0xa'));var _=require(_0xf845('0xb'));var squel=require('squel');var crypto=require(_0xf845('0xc'));var jsforce=require(_0xf845('0xd'));var deskjs=require(_0xf845('0xe'));var toCsv=require(_0xf845('0x8'));var querystring=require(_0xf845('0xf'));var Papa=require(_0xf845('0x10'));var Redis=require(_0xf845('0x11'));var authService=require(_0xf845('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf845('0x13'));var hardwareService=require(_0xf845('0x14'));var logger=require(_0xf845('0x15'))(_0xf845('0x16'));var utils=require(_0xf845('0x17'));var config=require(_0xf845('0x18'));var licenseUtil=require(_0xf845('0x19'));var db=require(_0xf845('0x1a'))['db'];function respondWithStatusCode(_0xd6e757,_0xa3d43a){_0xa3d43a=_0xa3d43a||0xcc;return function(_0x23ac7a){if(_0x23ac7a){return _0xd6e757[_0xf845('0x1b')](_0xa3d43a);}return _0xd6e757[_0xf845('0x1c')](_0xa3d43a)[_0xf845('0x1d')]();};}function respondWithResult(_0x5a6115,_0x808834){_0x808834=_0x808834||0xc8;return function(_0x538d93){if(_0x538d93){return _0x5a6115[_0xf845('0x1c')](_0x808834)[_0xf845('0x1e')](_0x538d93);}};}function respondWithFilteredResult(_0x443447,_0x19cead){return function(_0x56e16f){if(_0x56e16f){var _0x2ae924=typeof _0x19cead[_0xf845('0x1f')]===_0xf845('0x20')&&typeof _0x19cead['limit']===_0xf845('0x20');var _0x230503=_0x56e16f[_0xf845('0x21')];var _0x21e1dc=_0x2ae924?0x0:_0x19cead[_0xf845('0x1f')];var _0x4cca89=_0x2ae924?_0x56e16f[_0xf845('0x21')]:_0x19cead[_0xf845('0x1f')]+_0x19cead[_0xf845('0x22')];var _0x3fa637;if(_0x4cca89>=_0x230503){_0x4cca89=_0x230503;_0x3fa637=0xc8;}else{_0x3fa637=0xce;}_0x443447[_0xf845('0x1c')](_0x3fa637);return _0x443447[_0xf845('0x23')](_0xf845('0x24'),_0x21e1dc+'-'+_0x4cca89+'/'+_0x230503)['json'](_0x56e16f);}return null;};}function patchUpdates(_0x1cd597){return function(_0x44d755){try{jsonpatch[_0xf845('0x25')](_0x44d755,_0x1cd597,!![]);}catch(_0x3cd4d3){return BPromise[_0xf845('0x26')](_0x3cd4d3);}return _0x44d755[_0xf845('0x27')]();};}function saveUpdates(_0x162534,_0x5b8ecd){return function(_0x28c8e2){if(_0x28c8e2){return _0x28c8e2[_0xf845('0x28')](_0x162534)[_0xf845('0x29')](function(_0x470aea){return _0x470aea;});}return null;};}function removeEntity(_0x4b59ff,_0x12707a){return function(_0x391204){if(_0x391204){return _0x391204[_0xf845('0x2a')]()[_0xf845('0x29')](function(){_0x4b59ff['status'](0xcc)[_0xf845('0x1d')]();});}};}function handleEntityNotFound(_0x29d57c,_0x4dd424){return function(_0x388d7d){if(!_0x388d7d){_0x29d57c[_0xf845('0x1b')](0x194);}return _0x388d7d;};}function handleError(_0x1c1a02,_0x554575){_0x554575=_0x554575||0x1f4;return function(_0x4234bd){logger[_0xf845('0x2b')](_0x4234bd['stack']);if(_0x4234bd[_0xf845('0x2c')]){delete _0x4234bd[_0xf845('0x2c')];}_0x1c1a02['status'](_0x554575)['send'](_0x4234bd);};}exports[_0xf845('0x2d')]=function(_0x5aaeac,_0x1a6715){var _0x2bbac5={},_0x48958a={},_0x1f9acd={'count':0x0,'rows':[]};var _0x22fd5a=_['map'](db['ZohoField'][_0xf845('0x2e')],function(_0x4cecbe){return{'name':_0x4cecbe['fieldName'],'type':_0x4cecbe[_0xf845('0x2f')][_0xf845('0x30')]};});_0x48958a[_0xf845('0x31')]=_[_0xf845('0x32')](_0x22fd5a,_0xf845('0x2c'));_0x48958a[_0xf845('0x33')]=_[_0xf845('0x34')](_0x5aaeac[_0xf845('0x33')]);_0x48958a['filters']=_[_0xf845('0x35')](_0x48958a[_0xf845('0x31')],_0x48958a[_0xf845('0x33')]);_0x2bbac5[_0xf845('0x36')]=_[_0xf845('0x35')](_0x48958a[_0xf845('0x31')],qs['fields'](_0x5aaeac[_0xf845('0x33')][_0xf845('0x37')]));_0x2bbac5[_0xf845('0x36')]=_0x2bbac5[_0xf845('0x36')]['length']?_0x2bbac5['attributes']:_0x48958a[_0xf845('0x31')];if(!_0x5aaeac[_0xf845('0x33')][_0xf845('0x38')]('nolimit')){_0x2bbac5['limit']=qs['limit'](_0x5aaeac[_0xf845('0x33')][_0xf845('0x22')]);_0x2bbac5[_0xf845('0x1f')]=qs['offset'](_0x5aaeac['query'][_0xf845('0x1f')]);}_0x2bbac5[_0xf845('0x39')]=qs[_0xf845('0x3a')](_0x5aaeac[_0xf845('0x33')][_0xf845('0x3a')]);_0x2bbac5[_0xf845('0x3b')]=qs[_0xf845('0x3c')](_[_0xf845('0x3d')](_0x5aaeac[_0xf845('0x33')],_0x48958a['filters']),_0x22fd5a);if(_0x5aaeac[_0xf845('0x33')][_0xf845('0x3e')]){_0x2bbac5[_0xf845('0x3b')]=_[_0xf845('0x3f')](_0x2bbac5[_0xf845('0x3b')],{'$or':_[_0xf845('0x32')](_0x22fd5a,function(_0x36edc5){if(_0x36edc5[_0xf845('0x2f')]!=='VIRTUAL'){var _0x11d376={};_0x11d376[_0x36edc5['name']]={'$like':'%'+_0x5aaeac[_0xf845('0x33')]['filter']+'%'};return _0x11d376;}})});}_0x2bbac5=_['merge']({},_0x2bbac5,_0x5aaeac[_0xf845('0x40')]);var _0x198015={'where':_0x2bbac5[_0xf845('0x3b')]};return db['ZohoField'][_0xf845('0x21')](_0x198015)[_0xf845('0x29')](function(_0x101fe8){_0x1f9acd[_0xf845('0x21')]=_0x101fe8;if(_0x5aaeac[_0xf845('0x33')][_0xf845('0x41')]){_0x2bbac5[_0xf845('0x42')]=[{'all':!![]}];}return db['ZohoField'][_0xf845('0x43')](_0x2bbac5);})[_0xf845('0x29')](function(_0x327c02){_0x1f9acd['rows']=_0x327c02;return _0x1f9acd;})['then'](respondWithFilteredResult(_0x1a6715,_0x2bbac5))['catch'](handleError(_0x1a6715,null));};exports[_0xf845('0x44')]=function(_0x152158,_0x3b8f36){var _0x28af5c={'raw':!![],'where':{'id':_0x152158['params']['id']}},_0x1afefa={};_0x1afefa[_0xf845('0x31')]=_[_0xf845('0x34')](db[_0xf845('0x45')][_0xf845('0x2e')]);_0x1afefa[_0xf845('0x33')]=_[_0xf845('0x34')](_0x152158[_0xf845('0x33')]);_0x1afefa[_0xf845('0x3c')]=_[_0xf845('0x35')](_0x1afefa[_0xf845('0x31')],_0x1afefa['query']);_0x28af5c[_0xf845('0x36')]=_[_0xf845('0x35')](_0x1afefa[_0xf845('0x31')],qs[_0xf845('0x37')](_0x152158['query']['fields']));_0x28af5c[_0xf845('0x36')]=_0x28af5c[_0xf845('0x36')][_0xf845('0x46')]?_0x28af5c[_0xf845('0x36')]:_0x1afefa[_0xf845('0x31')];if(_0x152158[_0xf845('0x33')]['includeAll']){_0x28af5c[_0xf845('0x42')]=[{'all':!![]}];}_0x28af5c=_[_0xf845('0x3f')]({},_0x28af5c,_0x152158[_0xf845('0x40')]);return db[_0xf845('0x45')]['find'](_0x28af5c)[_0xf845('0x29')](handleEntityNotFound(_0x3b8f36,null))[_0xf845('0x29')](respondWithResult(_0x3b8f36,null))[_0xf845('0x47')](handleError(_0x3b8f36,null));};exports[_0xf845('0x48')]=function(_0x20e7e8,_0x3eca07){return db[_0xf845('0x45')][_0xf845('0x48')](_0x20e7e8['body'],{})[_0xf845('0x29')](respondWithResult(_0x3eca07,0xc9))[_0xf845('0x47')](handleError(_0x3eca07,null));};exports['update']=function(_0x4d95c1,_0x236d31){if(_0x4d95c1[_0xf845('0x49')]['id']){delete _0x4d95c1['body']['id'];}return db[_0xf845('0x45')][_0xf845('0x4a')]({'where':{'id':_0x4d95c1[_0xf845('0x4b')]['id']}})[_0xf845('0x29')](handleEntityNotFound(_0x236d31,null))[_0xf845('0x29')](saveUpdates(_0x4d95c1[_0xf845('0x49')],null))[_0xf845('0x29')](respondWithResult(_0x236d31,null))[_0xf845('0x47')](handleError(_0x236d31,null));};exports['destroy']=function(_0x288c87,_0x4d1223){return db[_0xf845('0x45')]['find']({'where':{'id':_0x288c87['params']['id']}})['then'](handleEntityNotFound(_0x4d1223,null))[_0xf845('0x29')](removeEntity(_0x4d1223,null))[_0xf845('0x47')](handleError(_0x4d1223,null));}; \ No newline at end of file +var _0x4885=['show','includeAll','find','create','body','params','eml-format','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','then','include','catch'];(function(_0x5a1a26,_0x2060ca){var _0x13ec41=function(_0x33b1e4){while(--_0x33b1e4){_0x5a1a26['push'](_0x5a1a26['shift']());}};_0x13ec41(++_0x2060ca);}(_0x4885,0x12e));var _0x5488=function(_0xecfc69,_0x17151a){_0xecfc69=_0xecfc69-0x0;var _0x401a80=_0x4885[_0xecfc69];return _0x401a80;};'use strict';var emlformat=require(_0x5488('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5488('0x1'));var BPromise=require(_0x5488('0x2'));var Mustache=require(_0x5488('0x3'));var util=require(_0x5488('0x4'));var path=require(_0x5488('0x5'));var sox=require('sox');var csv=require(_0x5488('0x6'));var ejs=require(_0x5488('0x7'));var fs=require('fs');var fs_extra=require(_0x5488('0x8'));var _=require('lodash');var squel=require(_0x5488('0x9'));var crypto=require(_0x5488('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5488('0xb'));var toCsv=require(_0x5488('0x6'));var querystring=require('querystring');var Papa=require(_0x5488('0xc'));var Redis=require(_0x5488('0xd'));var authService=require(_0x5488('0xe'));var qs=require(_0x5488('0xf'));var as=require(_0x5488('0x10'));var hardwareService=require(_0x5488('0x11'));var logger=require(_0x5488('0x12'))(_0x5488('0x13'));var utils=require(_0x5488('0x14'));var config=require(_0x5488('0x15'));var licenseUtil=require(_0x5488('0x16'));var db=require(_0x5488('0x17'))['db'];function respondWithStatusCode(_0x4bf8c7,_0x1b9a7f){_0x1b9a7f=_0x1b9a7f||0xcc;return function(_0x2dcc76){if(_0x2dcc76){return _0x4bf8c7[_0x5488('0x18')](_0x1b9a7f);}return _0x4bf8c7[_0x5488('0x19')](_0x1b9a7f)[_0x5488('0x1a')]();};}function respondWithResult(_0x2f8793,_0x552830){_0x552830=_0x552830||0xc8;return function(_0x55e04e){if(_0x55e04e){return _0x2f8793[_0x5488('0x19')](_0x552830)[_0x5488('0x1b')](_0x55e04e);}};}function respondWithFilteredResult(_0x5ab0e4,_0x3fdaf7){return function(_0x4970fb){if(_0x4970fb){var _0x5d9d3a=typeof _0x3fdaf7[_0x5488('0x1c')]===_0x5488('0x1d')&&typeof _0x3fdaf7[_0x5488('0x1e')]===_0x5488('0x1d');var _0x1084bf=_0x4970fb[_0x5488('0x1f')];var _0x275efa=_0x5d9d3a?0x0:_0x3fdaf7[_0x5488('0x1c')];var _0x13b056=_0x5d9d3a?_0x4970fb['count']:_0x3fdaf7[_0x5488('0x1c')]+_0x3fdaf7['limit'];var _0x3a8ef8;if(_0x13b056>=_0x1084bf){_0x13b056=_0x1084bf;_0x3a8ef8=0xc8;}else{_0x3a8ef8=0xce;}_0x5ab0e4[_0x5488('0x19')](_0x3a8ef8);return _0x5ab0e4[_0x5488('0x20')](_0x5488('0x21'),_0x275efa+'-'+_0x13b056+'/'+_0x1084bf)[_0x5488('0x1b')](_0x4970fb);}return null;};}function patchUpdates(_0x42efe2){return function(_0x193769){try{jsonpatch[_0x5488('0x22')](_0x193769,_0x42efe2,!![]);}catch(_0x5b2142){return BPromise[_0x5488('0x23')](_0x5b2142);}return _0x193769['save']();};}function saveUpdates(_0x401bd5,_0x3f9e60){return function(_0x407812){if(_0x407812){return _0x407812[_0x5488('0x24')](_0x401bd5)['then'](function(_0x30c516){return _0x30c516;});}return null;};}function removeEntity(_0x4b3464,_0x54d931){return function(_0x5a2271){if(_0x5a2271){return _0x5a2271[_0x5488('0x25')]()['then'](function(){_0x4b3464[_0x5488('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f516,_0x25b74c){return function(_0x21554e){if(!_0x21554e){_0x13f516[_0x5488('0x18')](0x194);}return _0x21554e;};}function handleError(_0x28f180,_0x181d48){_0x181d48=_0x181d48||0x1f4;return function(_0x1e1a54){logger[_0x5488('0x26')](_0x1e1a54[_0x5488('0x27')]);if(_0x1e1a54[_0x5488('0x28')]){delete _0x1e1a54[_0x5488('0x28')];}_0x28f180[_0x5488('0x19')](_0x181d48)[_0x5488('0x29')](_0x1e1a54);};}exports[_0x5488('0x2a')]=function(_0x2eb65d,_0x5add23){var _0x50e7b6={},_0x377533={},_0x3594ff={'count':0x0,'rows':[]};var _0x168865=_[_0x5488('0x2b')](db[_0x5488('0x2c')][_0x5488('0x2d')],function(_0x4d112f){return{'name':_0x4d112f['fieldName'],'type':_0x4d112f['type'][_0x5488('0x2e')]};});_0x377533[_0x5488('0x2f')]=_['map'](_0x168865,_0x5488('0x28'));_0x377533['query']=_[_0x5488('0x30')](_0x2eb65d[_0x5488('0x31')]);_0x377533['filters']=_[_0x5488('0x32')](_0x377533[_0x5488('0x2f')],_0x377533[_0x5488('0x31')]);_0x50e7b6[_0x5488('0x33')]=_[_0x5488('0x32')](_0x377533['model'],qs['fields'](_0x2eb65d[_0x5488('0x31')][_0x5488('0x34')]));_0x50e7b6[_0x5488('0x33')]=_0x50e7b6[_0x5488('0x33')][_0x5488('0x35')]?_0x50e7b6[_0x5488('0x33')]:_0x377533[_0x5488('0x2f')];if(!_0x2eb65d[_0x5488('0x31')]['hasOwnProperty'](_0x5488('0x36'))){_0x50e7b6[_0x5488('0x1e')]=qs['limit'](_0x2eb65d['query']['limit']);_0x50e7b6[_0x5488('0x1c')]=qs[_0x5488('0x1c')](_0x2eb65d[_0x5488('0x31')][_0x5488('0x1c')]);}_0x50e7b6[_0x5488('0x37')]=qs['sort'](_0x2eb65d[_0x5488('0x31')][_0x5488('0x38')]);_0x50e7b6[_0x5488('0x39')]=qs[_0x5488('0x3a')](_[_0x5488('0x3b')](_0x2eb65d[_0x5488('0x31')],_0x377533['filters']),_0x168865);if(_0x2eb65d[_0x5488('0x31')][_0x5488('0x3c')]){_0x50e7b6[_0x5488('0x39')]=_['merge'](_0x50e7b6[_0x5488('0x39')],{'$or':_[_0x5488('0x2b')](_0x168865,function(_0x3a6b59){if(_0x3a6b59[_0x5488('0x3d')]!==_0x5488('0x3e')){var _0x4f8e8f={};_0x4f8e8f[_0x3a6b59['name']]={'$like':'%'+_0x2eb65d[_0x5488('0x31')]['filter']+'%'};return _0x4f8e8f;}})});}_0x50e7b6=_[_0x5488('0x3f')]({},_0x50e7b6,_0x2eb65d[_0x5488('0x40')]);var _0x1a943a={'where':_0x50e7b6[_0x5488('0x39')]};return db[_0x5488('0x2c')][_0x5488('0x1f')](_0x1a943a)[_0x5488('0x41')](function(_0x437a3c){_0x3594ff['count']=_0x437a3c;if(_0x2eb65d[_0x5488('0x31')]['includeAll']){_0x50e7b6[_0x5488('0x42')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x50e7b6);})[_0x5488('0x41')](function(_0x4f1f15){_0x3594ff['rows']=_0x4f1f15;return _0x3594ff;})['then'](respondWithFilteredResult(_0x5add23,_0x50e7b6))[_0x5488('0x43')](handleError(_0x5add23,null));};exports[_0x5488('0x44')]=function(_0x51b275,_0xb8ce8e){var _0x4d397d={'raw':!![],'where':{'id':_0x51b275['params']['id']}},_0x267299={};_0x267299[_0x5488('0x2f')]=_[_0x5488('0x30')](db['ZohoField'][_0x5488('0x2d')]);_0x267299['query']=_['keys'](_0x51b275[_0x5488('0x31')]);_0x267299[_0x5488('0x3a')]=_['intersection'](_0x267299[_0x5488('0x2f')],_0x267299[_0x5488('0x31')]);_0x4d397d[_0x5488('0x33')]=_[_0x5488('0x32')](_0x267299['model'],qs['fields'](_0x51b275['query']['fields']));_0x4d397d[_0x5488('0x33')]=_0x4d397d['attributes'][_0x5488('0x35')]?_0x4d397d[_0x5488('0x33')]:_0x267299[_0x5488('0x2f')];if(_0x51b275[_0x5488('0x31')][_0x5488('0x45')]){_0x4d397d[_0x5488('0x42')]=[{'all':!![]}];}_0x4d397d=_[_0x5488('0x3f')]({},_0x4d397d,_0x51b275[_0x5488('0x40')]);return db[_0x5488('0x2c')][_0x5488('0x46')](_0x4d397d)[_0x5488('0x41')](handleEntityNotFound(_0xb8ce8e,null))[_0x5488('0x41')](respondWithResult(_0xb8ce8e,null))['catch'](handleError(_0xb8ce8e,null));};exports[_0x5488('0x47')]=function(_0x51a94c,_0x3a910a){return db['ZohoField'][_0x5488('0x47')](_0x51a94c[_0x5488('0x48')],{})[_0x5488('0x41')](respondWithResult(_0x3a910a,0xc9))[_0x5488('0x43')](handleError(_0x3a910a,null));};exports[_0x5488('0x24')]=function(_0x4d2635,_0x45b20e){if(_0x4d2635['body']['id']){delete _0x4d2635['body']['id'];}return db[_0x5488('0x2c')][_0x5488('0x46')]({'where':{'id':_0x4d2635['params']['id']}})[_0x5488('0x41')](handleEntityNotFound(_0x45b20e,null))[_0x5488('0x41')](saveUpdates(_0x4d2635[_0x5488('0x48')],null))['then'](respondWithResult(_0x45b20e,null))['catch'](handleError(_0x45b20e,null));};exports[_0x5488('0x25')]=function(_0x4f153a,_0x30ecbb){return db[_0x5488('0x2c')][_0x5488('0x46')]({'where':{'id':_0x4f153a[_0x5488('0x49')]['id']}})[_0x5488('0x41')](handleEntityNotFound(_0x30ecbb,null))[_0x5488('0x41')](removeEntity(_0x30ecbb,null))[_0x5488('0x43')](handleError(_0x30ecbb,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1477d91..0b23130 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 _0x71ab=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','api','bluebird','request-promise','path'];(function(_0x1ff77b,_0x2cd2f8){var _0x86467d=function(_0x5b67ee){while(--_0x5b67ee){_0x1ff77b['push'](_0x1ff77b['shift']());}};_0x86467d(++_0x2cd2f8);}(_0x71ab,0x64));var _0xb71a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71ab[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[{'name':_0xb71a('0xc'),'fields':[_0xb71a('0xd'),_0xb71a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0424=['define','ZohoField','int_zoho_fields','FieldId','../../config/logger','api','moment','bluebird','path','./intZohoField.attributes','exports'];(function(_0x371ddf,_0x2370f8){var _0x5c4804=function(_0x3babd7){while(--_0x3babd7){_0x371ddf['push'](_0x371ddf['shift']());}};_0x5c4804(++_0x2370f8);}(_0x0424,0x159));var _0x4042=function(_0x993f24,_0x227b78){_0x993f24=_0x993f24-0x0;var _0x3064db=_0x0424[_0x993f24];return _0x3064db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x4042('0xa')],'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 aa3011e..7bdf4b8 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 _0x9907=['randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird'];(function(_0x4b9cb4,_0x1f18a8){var _0x335d39=function(_0x5d6de6){while(--_0x5d6de6){_0x4b9cb4['push'](_0x4b9cb4['shift']());}};_0x335d39(++_0x1f18a8);}(_0x9907,0x1dd));var _0x7990=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0x9907[_0x21d0c3];return _0x4df18e;};'use strict';var _=require('lodash');var util=require(_0x7990('0x0'));var moment=require(_0x7990('0x1'));var BPromise=require(_0x7990('0x2'));var rs=require(_0x7990('0x3'));var fs=require('fs');var Redis=require(_0x7990('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7990('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7990('0x6'));var client=jayson[_0x7990('0x7')][_0x7990('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x178ed3,_0x20764c,_0x541380){return new BPromise(function(_0x17ddee,_0x2fbddb){return client[_0x7990('0x9')](_0x178ed3,_0x541380)['then'](function(_0x4ea3c9){logger[_0x7990('0xa')](_0x7990('0xb'),_0x20764c,_0x7990('0xc'));logger[_0x7990('0xd')](_0x7990('0xe'),_0x20764c,_0x7990('0xc'),JSON[_0x7990('0xf')](_0x4ea3c9));if(_0x4ea3c9[_0x7990('0x10')]){if(_0x4ea3c9[_0x7990('0x10')]['code']===0x1f4){logger[_0x7990('0x10')](_0x7990('0xb'),_0x20764c,_0x4ea3c9[_0x7990('0x10')]['message']);return _0x2fbddb(_0x4ea3c9[_0x7990('0x10')][_0x7990('0x11')]);}logger[_0x7990('0x10')](_0x7990('0xb'),_0x20764c,_0x4ea3c9[_0x7990('0x10')][_0x7990('0x11')]);return _0x17ddee(_0x4ea3c9[_0x7990('0x10')]['message']);}else{logger[_0x7990('0xa')]('ZohoField,\x20%s,\x20%s',_0x20764c,_0x7990('0xc'));_0x17ddee(_0x4ea3c9[_0x7990('0x12')][_0x7990('0x11')]);}})[_0x7990('0x13')](function(_0x45e7aa){logger[_0x7990('0x10')](_0x7990('0xb'),_0x20764c,_0x45e7aa);_0x2fbddb(_0x45e7aa);});});} \ No newline at end of file +var _0x8955=['error','code','ZohoField,\x20%s,\x20%s','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0xa1181c,_0x1724a4){var _0x1ef296=function(_0x1233e0){while(--_0x1233e0){_0xa1181c['push'](_0xa1181c['shift']());}};_0x1ef296(++_0x1724a4);}(_0x8955,0x99));var _0x5895=function(_0x24b628,_0x3b1ecb){_0x24b628=_0x24b628-0x0;var _0x184416=_0x8955[_0x24b628];return _0x184416;};'use strict';var _=require(_0x5895('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5895('0x1'));var rs=require(_0x5895('0x2'));var fs=require('fs');var Redis=require(_0x5895('0x3'));var db=require(_0x5895('0x4'))['db'];var utils=require(_0x5895('0x5'));var logger=require(_0x5895('0x6'))(_0x5895('0x7'));var config=require(_0x5895('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5895('0x9')][_0x5895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x460e28,_0x89bccb,_0x7c40e3){return new BPromise(function(_0x2f1dc6,_0x124065){return client[_0x5895('0xb')](_0x460e28,_0x7c40e3)[_0x5895('0xc')](function(_0x527017){logger['info']('ZohoField,\x20%s,\x20%s',_0x89bccb,_0x5895('0xd'));logger['debug'](_0x5895('0xe'),_0x89bccb,_0x5895('0xd'),JSON['stringify'](_0x527017));if(_0x527017[_0x5895('0xf')]){if(_0x527017[_0x5895('0xf')][_0x5895('0x10')]===0x1f4){logger[_0x5895('0xf')](_0x5895('0x11'),_0x89bccb,_0x527017[_0x5895('0xf')][_0x5895('0x12')]);return _0x124065(_0x527017['error'][_0x5895('0x12')]);}logger[_0x5895('0xf')](_0x5895('0x11'),_0x89bccb,_0x527017['error'][_0x5895('0x12')]);return _0x2f1dc6(_0x527017[_0x5895('0xf')][_0x5895('0x12')]);}else{logger[_0x5895('0x13')](_0x5895('0x11'),_0x89bccb,_0x5895('0xd'));_0x2f1dc6(_0x527017['result'][_0x5895('0x12')]);}})[_0x5895('0x14')](function(_0x51ba50){logger[_0x5895('0xf')](_0x5895('0x11'),_0x89bccb,_0x51ba50);_0x124065(_0x51ba50);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index bb8021a..69b4be4 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2ee91a,_0x20b608){var _0x1bbcf3=function(_0x2d1a0e){while(--_0x2d1a0e){_0x2ee91a['push'](_0x2ee91a['shift']());}};_0x1bbcf3(++_0x20b608);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x560fc6,_0x59bd68){var _0x14d08a=function(_0x10bcfb){while(--_0x10bcfb){_0x560fc6['push'](_0x560fc6['shift']());}};_0x14d08a(++_0x59bd68);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 1a32362..bc7af7c 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 _0x45d2=['state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x4f9931,_0x45c009){var _0x3a68b3=function(_0x1fcebf){while(--_0x1fcebf){_0x4f9931['push'](_0x4f9931['shift']());}};_0x3a68b3(++_0x45c009);}(_0x45d2,0xec));var _0x245d=function(_0x31438d,_0x31c750){_0x31438d=_0x31438d-0x0;var _0xe845ac=_0x45d2[_0x31438d];return _0xe845ac;};'use strict';var Sequelize=require(_0x245d('0x0'));module[_0x245d('0x1')]={'name':{'type':Sequelize[_0x245d('0x2')],'allowNull':![],'unique':_0x245d('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x245d('0x3')},'main':{'type':Sequelize[_0x245d('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x245d('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x245d('0x2')]},'logo':{'type':Sequelize[_0x245d('0x2')]},'state':{'type':Sequelize[_0x245d('0x2')],'unique':_0x245d('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x245d('0x2')]},'remoteUri':{'type':Sequelize[_0x245d('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xd5c4=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','state'];(function(_0x300d70,_0x513347){var _0x41a183=function(_0x5d5832){while(--_0x5d5832){_0x300d70['push'](_0x300d70['shift']());}};_0x41a183(++_0x513347);}(_0xd5c4,0x12d));var _0x4d5c=function(_0x5d50e1,_0x15016d){_0x5d50e1=_0x5d50e1-0x0;var _0x4e95bb=_0xd5c4[_0x5d50e1];return _0x4e95bb;};'use strict';var Sequelize=require(_0x4d5c('0x0'));module[_0x4d5c('0x1')]={'name':{'type':Sequelize[_0x4d5c('0x2')],'allowNull':![],'unique':_0x4d5c('0x3')},'version':{'type':Sequelize[_0x4d5c('0x2')],'allowNull':![],'unique':_0x4d5c('0x3')},'main':{'type':Sequelize[_0x4d5c('0x2')],'defaultValue':_0x4d5c('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x4d5c('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x4d5c('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x4d5c('0x2')]},'logo':{'type':Sequelize[_0x4d5c('0x2')]},'state':{'type':Sequelize[_0x4d5c('0x2')],'unique':_0x4d5c('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x4d5c('0x2')]},'remoteUri':{'type':Sequelize[_0x4d5c('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 504390d..a49ec1b 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 _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5f2f,0x73));var _0xf5f2=function(_0x277b82,_0x5aa3b4){_0x277b82=_0x277b82-0x0;var _0xc7ab69=_0x5f2f[_0x277b82];return _0xc7ab69;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file +var _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x5496,0x175));var _0x6549=function(_0x20c90a,_0x220ae3){_0x20c90a=_0x20c90a-0x0;var _0x1bb66a=_0x5496[_0x20c90a];return _0x1bb66a;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index a302052..bbd8bc8 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 _0x6d56=['path','rimraf','./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger','api','request-promise'];(function(_0x392857,_0x4d1087){var _0x50e53b=function(_0x1da270){while(--_0x1da270){_0x392857['push'](_0x392857['shift']());}};_0x50e53b(++_0x4d1087);}(_0x6d56,0x145));var _0x66d5=function(_0x1dd8d9,_0x127984){_0x1dd8d9=_0x1dd8d9-0x0;var _0x1deb45=_0x6d56[_0x1dd8d9];return _0x1deb45;};'use strict';var _=require(_0x66d5('0x0'));var util=require(_0x66d5('0x1'));var logger=require(_0x66d5('0x2'))(_0x66d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x66d5('0x4'));var fs=require('fs');var path=require(_0x66d5('0x5'));var rimraf=require(_0x66d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x66d5('0x7'));module['exports']=function(_0x5b6cfa,_0x18f568){return _0x5b6cfa[_0x66d5('0x8')](_0x66d5('0x9'),attributes,{'tableName':_0x66d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2e6=['path','rimraf','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3b5bd4,_0x2d60de){var _0xec75c4=function(_0x52f7d7){while(--_0x52f7d7){_0x3b5bd4['push'](_0x3b5bd4['shift']());}};_0xec75c4(++_0x2d60de);}(_0xa2e6,0x1e8));var _0x6a2e=function(_0x1156ae,_0x26f344){_0x1156ae=_0x1156ae-0x0;var _0x3fb7bc=_0xa2e6[_0x1156ae];return _0x3fb7bc;};'use strict';var _=require(_0x6a2e('0x0'));var util=require(_0x6a2e('0x1'));var logger=require(_0x6a2e('0x2'))(_0x6a2e('0x3'));var moment=require('moment');var BPromise=require(_0x6a2e('0x4'));var rp=require(_0x6a2e('0x5'));var fs=require('fs');var path=require(_0x6a2e('0x6'));var rimraf=require(_0x6a2e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6a2e('0x8'));module[_0x6a2e('0x9')]=function(_0x1710bc,_0x3a023e){return _0x1710bc[_0x6a2e('0xa')](_0x6a2e('0xb'),attributes,{'tableName':_0x6a2e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 39b0ae7..606a667 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 _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(_0x11765b,_0x59fab7){var _0x5e651e=function(_0x48f17d){while(--_0x48f17d){_0x11765b['push'](_0x11765b['shift']());}};_0x5e651e(++_0x59fab7);}(_0x14a0,0x8e));var _0x014a=function(_0x181f8e,_0x1606a8){_0x181f8e=_0x181f8e-0x0;var _0x4c4e3f=_0x14a0[_0x181f8e];return _0x4c4e3f;};'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 +var _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x213e16,_0x5f5165){var _0x334ab4=function(_0x23a6e2){while(--_0x23a6e2){_0x213e16['push'](_0x213e16['shift']());}};_0x334ab4(++_0x5f5165);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2d7c29,_0x48be56){_0x2d7c29=_0x2d7c29-0x0;var _0x891916=_0x9f0e[_0x2d7c29];return _0x891916;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6b8dc0f..064ec89 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 _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x3bb96e,_0xdc7992){var _0x1a6739=function(_0x42e380){while(--_0x42e380){_0x3bb96e['push'](_0x3bb96e['shift']());}};_0x1a6739(++_0xdc7992);}(_0xba34,0x119));var _0x4ba3=function(_0x10b639,_0x4f15f8){_0x10b639=_0x10b639-0x0;var _0x33bd1b=_0xba34[_0x10b639];return _0x33bd1b;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file +var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x22e571,_0x443a32){var _0x5b3f1c=function(_0x52a0ce){while(--_0x52a0ce){_0x22e571['push'](_0x22e571['shift']());}};_0x5b3f1c(++_0x443a32);}(_0x9f0e,0x116));var _0xe9f0=function(_0x212375,_0x110b9a){_0x212375=_0x212375-0x0;var _0x10d0e6=_0x9f0e[_0x212375];return _0x10d0e6;};'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['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f0fd3b6..71e6dee 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 _0xfedf=['RECEIVED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0xd8897b,_0x1d7f1e){var _0x16aef7=function(_0x3f3f1a){while(--_0x3f3f1a){_0xd8897b['push'](_0xd8897b['shift']());}};_0x16aef7(++_0x1d7f1e);}(_0xfedf,0x15f));var _0xffed=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0xfedf[_0x119280];return _0x481797;};'use strict';var Sequelize=require('sequelize');module[_0xffed('0x0')]={'integration':{'type':Sequelize[_0xffed('0x1')]},'eventChannel':{'type':Sequelize[_0xffed('0x1')]},'exitStatus':{'type':Sequelize[_0xffed('0x1')]},'ticketId':{'type':Sequelize[_0xffed('0x1')]},'integrationId':{'type':Sequelize[_0xffed('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xffed('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xffed('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xffed('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xffed('0x3')]},'holdtime':{'type':Sequelize[_0xffed('0x2')]},'agentcomplete':{'type':Sequelize[_0xffed('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xffed('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xffed('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xffed('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xffed('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xffed('0x3')]},'agentdump':{'type':Sequelize[_0xffed('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xffed('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xffed('0x1')]},'connectedlinenum':{'type':Sequelize[_0xffed('0x1')]},'connectedlinename':{'type':Sequelize[_0xffed('0x1')]},'language':{'type':Sequelize[_0xffed('0x1')]},'accountcode':{'type':Sequelize[_0xffed('0x1')]},'context':{'type':Sequelize[_0xffed('0x1')]},'exten':{'type':Sequelize[_0xffed('0x1')]},'priority':{'type':Sequelize[_0xffed('0x1')]},'destchannel':{'type':Sequelize[_0xffed('0x1')]},'destchannelstate':{'type':Sequelize[_0xffed('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xffed('0x1')]},'destcalleridnum':{'type':Sequelize[_0xffed('0x1')]},'destcalleridname':{'type':Sequelize[_0xffed('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xffed('0x1')]},'destlanguage':{'type':Sequelize[_0xffed('0x1')]},'destaccountcode':{'type':Sequelize[_0xffed('0x1')]},'destcontext':{'type':Sequelize[_0xffed('0x1')]},'destexten':{'type':Sequelize[_0xffed('0x1')]},'destpriority':{'type':Sequelize[_0xffed('0x1')]},'destuniqueid':{'type':Sequelize[_0xffed('0x1')]},'messageId':{'type':Sequelize[_0xffed('0x1')]},'inReplyTo':{'type':Sequelize[_0xffed('0x1')]},'subject':{'type':Sequelize[_0xffed('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xffed('0x1')]},'attachment':{'type':Sequelize[_0xffed('0x5')]},'html':{'type':Sequelize[_0xffed('0x5')]},'text':{'type':Sequelize[_0xffed('0x5')]},'status':{'type':Sequelize[_0xffed('0x6')](_0xffed('0x7'),_0xffed('0x8'),_0xffed('0x9'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xffed('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xffed('0x2')]}}; \ No newline at end of file +var _0x9c08=['INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x22d6a9,_0x1b2913){var _0x238c38=function(_0x1fcaef){while(--_0x1fcaef){_0x22d6a9['push'](_0x22d6a9['shift']());}};_0x238c38(++_0x1b2913);}(_0x9c08,0x147));var _0x89c0=function(_0x5f0253,_0x3e5c74){_0x5f0253=_0x5f0253-0x0;var _0x9d2931=_0x9c08[_0x5f0253];return _0x9d2931;};'use strict';var Sequelize=require(_0x89c0('0x0'));module[_0x89c0('0x1')]={'integration':{'type':Sequelize[_0x89c0('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x89c0('0x2')]},'integrationId':{'type':Sequelize[_0x89c0('0x3')]},'contacts':{'type':Sequelize[_0x89c0('0x2')]},'uniqueid':{'type':Sequelize[_0x89c0('0x2')]},'calleridnum':{'type':Sequelize[_0x89c0('0x2')]},'calleridname':{'type':Sequelize[_0x89c0('0x2')]},'queue':{'type':Sequelize[_0x89c0('0x2')]},'interface':{'type':Sequelize[_0x89c0('0x2')]},'membername':{'type':Sequelize[_0x89c0('0x2')]},'agentcalledAt':{'type':Sequelize[_0x89c0('0x4')]},'agentconnectAt':{'type':Sequelize[_0x89c0('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x89c0('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x89c0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x89c0('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x89c0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x89c0('0x4')]},'agentdump':{'type':Sequelize[_0x89c0('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x89c0('0x4')]},'lastevent':{'type':Sequelize[_0x89c0('0x2')]},'channel':{'type':Sequelize[_0x89c0('0x2')]},'channelstate':{'type':Sequelize[_0x89c0('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x89c0('0x2')]},'connectedlinename':{'type':Sequelize[_0x89c0('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x89c0('0x2')]},'context':{'type':Sequelize[_0x89c0('0x2')]},'exten':{'type':Sequelize[_0x89c0('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x89c0('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x89c0('0x2')]},'destcalleridnum':{'type':Sequelize[_0x89c0('0x2')]},'destcalleridname':{'type':Sequelize[_0x89c0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x89c0('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x89c0('0x2')]},'destaccountcode':{'type':Sequelize[_0x89c0('0x2')]},'destcontext':{'type':Sequelize[_0x89c0('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x89c0('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x89c0('0x2')]},'subject':{'type':Sequelize[_0x89c0('0x2')]},'from':{'type':Sequelize[_0x89c0('0x2')]},'to':{'type':Sequelize[_0x89c0('0x2')]},'cc':{'type':Sequelize[_0x89c0('0x2')]},'attachment':{'type':Sequelize[_0x89c0('0x6')]},'html':{'type':Sequelize[_0x89c0('0x6')]},'text':{'type':Sequelize[_0x89c0('0x6')]},'status':{'type':Sequelize['ENUM'](_0x89c0('0x7'),_0x89c0('0x8'),_0x89c0('0x9'),_0x89c0('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x89c0('0x2')]},'appdata':{'type':Sequelize[_0x89c0('0x2')]},'projectId':{'type':Sequelize[_0x89c0('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index ba33956..1675603 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 _0x4f84=['offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x93bf7b,_0x1b2a09){var _0x41b8de=function(_0x579d6b){while(--_0x579d6b){_0x93bf7b['push'](_0x93bf7b['shift']());}};_0x41b8de(++_0x1b2a09);}(_0x4f84,0x1a7));var _0x44f8=function(_0x12d034,_0x430f51){_0x12d034=_0x12d034-0x0;var _0x39d6e5=_0x4f84[_0x12d034];return _0x39d6e5;};'use strict';var emlformat=require(_0x44f8('0x0'));var rimraf=require(_0x44f8('0x1'));var zipdir=require(_0x44f8('0x2'));var jsonpatch=require(_0x44f8('0x3'));var rp=require(_0x44f8('0x4'));var moment=require(_0x44f8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x44f8('0x6'));var util=require(_0x44f8('0x7'));var path=require(_0x44f8('0x8'));var sox=require(_0x44f8('0x9'));var csv=require(_0x44f8('0xa'));var ejs=require(_0x44f8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x44f8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x44f8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x44f8('0xe'));var Papa=require(_0x44f8('0xf'));var Redis=require(_0x44f8('0x10'));var authService=require(_0x44f8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x44f8('0x12'));var hardwareService=require(_0x44f8('0x13'));var logger=require(_0x44f8('0x14'))(_0x44f8('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x44f8('0x16'));var db=require(_0x44f8('0x17'))['db'];function respondWithStatusCode(_0x4cb0fe,_0x3136fa){_0x3136fa=_0x3136fa||0xcc;return function(_0x34c639){if(_0x34c639){return _0x4cb0fe[_0x44f8('0x18')](_0x3136fa);}return _0x4cb0fe[_0x44f8('0x19')](_0x3136fa)['end']();};}function respondWithResult(_0x4df9f4,_0x3f96da){_0x3f96da=_0x3f96da||0xc8;return function(_0x4ae6f9){if(_0x4ae6f9){return _0x4df9f4[_0x44f8('0x19')](_0x3f96da)[_0x44f8('0x1a')](_0x4ae6f9);}};}function respondWithFilteredResult(_0x4c5a6b,_0x5c0e8a){return function(_0xa046d2){if(_0xa046d2){var _0x41cf47=typeof _0x5c0e8a[_0x44f8('0x1b')]===_0x44f8('0x1c')&&typeof _0x5c0e8a['limit']==='undefined';var _0x4f1578=_0xa046d2[_0x44f8('0x1d')];var _0x23f5bf=_0x41cf47?0x0:_0x5c0e8a['offset'];var _0x418ee1=_0x41cf47?_0xa046d2[_0x44f8('0x1d')]:_0x5c0e8a[_0x44f8('0x1b')]+_0x5c0e8a[_0x44f8('0x1e')];var _0x32c157;if(_0x418ee1>=_0x4f1578){_0x418ee1=_0x4f1578;_0x32c157=0xc8;}else{_0x32c157=0xce;}_0x4c5a6b[_0x44f8('0x19')](_0x32c157);return _0x4c5a6b['set'](_0x44f8('0x1f'),_0x23f5bf+'-'+_0x418ee1+'/'+_0x4f1578)['json'](_0xa046d2);}return null;};}function patchUpdates(_0x18fd5d){return function(_0x48f7d3){try{jsonpatch[_0x44f8('0x20')](_0x48f7d3,_0x18fd5d,!![]);}catch(_0x2c2d2b){return BPromise[_0x44f8('0x21')](_0x2c2d2b);}return _0x48f7d3[_0x44f8('0x22')]();};}function saveUpdates(_0x291346,_0x165317){return function(_0x3a84e7){if(_0x3a84e7){return _0x3a84e7[_0x44f8('0x23')](_0x291346)[_0x44f8('0x24')](function(_0x575571){return _0x575571;});}return null;};}function removeEntity(_0x391139,_0x5159c3){return function(_0x5b8720){if(_0x5b8720){return _0x5b8720[_0x44f8('0x25')]()[_0x44f8('0x24')](function(){_0x391139[_0x44f8('0x19')](0xcc)[_0x44f8('0x26')]();});}};}function handleEntityNotFound(_0x357471,_0x33148d){return function(_0x3ff18b){if(!_0x3ff18b){_0x357471[_0x44f8('0x18')](0x194);}return _0x3ff18b;};}function handleError(_0x2b729c,_0x6e674c){_0x6e674c=_0x6e674c||0x1f4;return function(_0x5a305d){logger[_0x44f8('0x27')](_0x5a305d['stack']);if(_0x5a305d['name']){delete _0x5a305d[_0x44f8('0x28')];}_0x2b729c[_0x44f8('0x19')](_0x6e674c)[_0x44f8('0x29')](_0x5a305d);};}exports['index']=function(_0x3c50eb,_0x4ee6f6){var _0x322037={},_0x46f5d9={},_0x1836c1={'count':0x0,'rows':[]};var _0x365510=_[_0x44f8('0x2a')](db[_0x44f8('0x2b')][_0x44f8('0x2c')],function(_0x447f0e){return{'name':_0x447f0e[_0x44f8('0x2d')],'type':_0x447f0e[_0x44f8('0x2e')]['key']};});_0x46f5d9[_0x44f8('0x2f')]=_[_0x44f8('0x2a')](_0x365510,_0x44f8('0x28'));_0x46f5d9[_0x44f8('0x30')]=_[_0x44f8('0x31')](_0x3c50eb[_0x44f8('0x30')]);_0x46f5d9[_0x44f8('0x32')]=_['intersection'](_0x46f5d9[_0x44f8('0x2f')],_0x46f5d9[_0x44f8('0x30')]);_0x322037[_0x44f8('0x33')]=_['intersection'](_0x46f5d9[_0x44f8('0x2f')],qs[_0x44f8('0x34')](_0x3c50eb['query'][_0x44f8('0x34')]));_0x322037['attributes']=_0x322037[_0x44f8('0x33')][_0x44f8('0x35')]?_0x322037[_0x44f8('0x33')]:_0x46f5d9['model'];if(!_0x3c50eb[_0x44f8('0x30')][_0x44f8('0x36')](_0x44f8('0x37'))){_0x322037['limit']=qs['limit'](_0x3c50eb[_0x44f8('0x30')][_0x44f8('0x1e')]);_0x322037[_0x44f8('0x1b')]=qs['offset'](_0x3c50eb['query'][_0x44f8('0x1b')]);}_0x322037['order']=qs[_0x44f8('0x38')](_0x3c50eb[_0x44f8('0x30')]['sort']);_0x322037[_0x44f8('0x39')]=qs[_0x44f8('0x32')](_[_0x44f8('0x3a')](_0x3c50eb[_0x44f8('0x30')],_0x46f5d9['filters']),_0x365510);if(_0x3c50eb[_0x44f8('0x30')][_0x44f8('0x3b')]){_0x322037[_0x44f8('0x39')]=_[_0x44f8('0x3c')](_0x322037[_0x44f8('0x39')],{'$or':_[_0x44f8('0x2a')](_0x365510,function(_0x35be08){if(_0x35be08[_0x44f8('0x2e')]!==_0x44f8('0x3d')){var _0x18ec3d={};_0x18ec3d[_0x35be08[_0x44f8('0x28')]]={'$like':'%'+_0x3c50eb[_0x44f8('0x30')][_0x44f8('0x3b')]+'%'};return _0x18ec3d;}})});}_0x322037=_[_0x44f8('0x3c')]({},_0x322037,_0x3c50eb[_0x44f8('0x3e')]);var _0x5743a4={'where':_0x322037[_0x44f8('0x39')]};return db['IntegrationReport'][_0x44f8('0x1d')](_0x5743a4)[_0x44f8('0x24')](function(_0x181bba){_0x1836c1[_0x44f8('0x1d')]=_0x181bba;if(_0x3c50eb['query'][_0x44f8('0x3f')]){_0x322037[_0x44f8('0x40')]=[{'all':!![]}];}return db['IntegrationReport'][_0x44f8('0x41')](_0x322037);})[_0x44f8('0x24')](function(_0x4abe05){_0x1836c1[_0x44f8('0x42')]=_0x4abe05;return _0x1836c1;})[_0x44f8('0x24')](respondWithFilteredResult(_0x4ee6f6,_0x322037))['catch'](handleError(_0x4ee6f6,null));};exports[_0x44f8('0x43')]=function(_0x1768d1,_0x2b6483){var _0x31ce90={'raw':![],'where':{'id':_0x1768d1['params']['id']}},_0x217e68={};_0x217e68[_0x44f8('0x2f')]=_[_0x44f8('0x31')](db['IntegrationReport'][_0x44f8('0x2c')]);_0x217e68[_0x44f8('0x30')]=_[_0x44f8('0x31')](_0x1768d1['query']);_0x217e68['filters']=_[_0x44f8('0x44')](_0x217e68['model'],_0x217e68[_0x44f8('0x30')]);_0x31ce90['attributes']=_[_0x44f8('0x44')](_0x217e68['model'],qs[_0x44f8('0x34')](_0x1768d1['query'][_0x44f8('0x34')]));_0x31ce90['attributes']=_0x31ce90[_0x44f8('0x33')][_0x44f8('0x35')]?_0x31ce90[_0x44f8('0x33')]:_0x217e68[_0x44f8('0x2f')];if(_0x1768d1[_0x44f8('0x30')][_0x44f8('0x3f')]){_0x31ce90['include']=[{'all':!![]}];}_0x31ce90=_[_0x44f8('0x3c')]({},_0x31ce90,_0x1768d1[_0x44f8('0x3e')]);return db[_0x44f8('0x2b')]['find'](_0x31ce90)[_0x44f8('0x24')](handleEntityNotFound(_0x2b6483,null))[_0x44f8('0x24')](respondWithResult(_0x2b6483,null))[_0x44f8('0x45')](handleError(_0x2b6483,null));};exports[_0x44f8('0x46')]=function(_0x2343ca,_0x408a29){return db[_0x44f8('0x2b')][_0x44f8('0x46')](_0x2343ca[_0x44f8('0x47')],{})[_0x44f8('0x24')](respondWithResult(_0x408a29,0xc9))[_0x44f8('0x45')](handleError(_0x408a29,null));};exports[_0x44f8('0x23')]=function(_0x119cdd,_0x3836fb){if(_0x119cdd[_0x44f8('0x47')]['id']){delete _0x119cdd['body']['id'];}return db[_0x44f8('0x2b')][_0x44f8('0x48')]({'where':{'id':_0x119cdd[_0x44f8('0x49')]['id']}})['then'](handleEntityNotFound(_0x3836fb,null))[_0x44f8('0x24')](saveUpdates(_0x119cdd['body'],null))[_0x44f8('0x24')](respondWithResult(_0x3836fb,null))[_0x44f8('0x45')](handleError(_0x3836fb,null));};exports['destroy']=function(_0x1f04ea,_0x13db0b){return db[_0x44f8('0x2b')][_0x44f8('0x48')]({'where':{'id':_0x1f04ea[_0x44f8('0x49')]['id']}})[_0x44f8('0x24')](handleEntityNotFound(_0x13db0b,null))[_0x44f8('0x24')](removeEntity(_0x13db0b,null))[_0x44f8('0x45')](handleError(_0x13db0b,null));};exports[_0x44f8('0x4a')]=function(_0x5e0012,_0x2e380d){return db[_0x44f8('0x2b')][_0x44f8('0x4a')]()['then'](respondWithResult(_0x2e380d,null))[_0x44f8('0x45')](handleError(_0x2e380d,null));}; \ No newline at end of file +var _0xf5ac=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5e79ec,_0x8bdee){var _0x3455da=function(_0x2cb94f){while(--_0x2cb94f){_0x5e79ec['push'](_0x5e79ec['shift']());}};_0x3455da(++_0x8bdee);}(_0xf5ac,0x118));var _0xcf5a=function(_0x28871a,_0x51f5aa){_0x28871a=_0x28871a-0x0;var _0x3f4566=_0xf5ac[_0x28871a];return _0x3f4566;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf5a('0x0'));var zipdir=require(_0xcf5a('0x1'));var jsonpatch=require(_0xcf5a('0x2'));var rp=require(_0xcf5a('0x3'));var moment=require('moment');var BPromise=require(_0xcf5a('0x4'));var Mustache=require('mustache');var util=require(_0xcf5a('0x5'));var path=require(_0xcf5a('0x6'));var sox=require(_0xcf5a('0x7'));var csv=require(_0xcf5a('0x8'));var ejs=require(_0xcf5a('0x9'));var fs=require('fs');var fs_extra=require(_0xcf5a('0xa'));var _=require(_0xcf5a('0xb'));var squel=require('squel');var crypto=require(_0xcf5a('0xc'));var jsforce=require(_0xcf5a('0xd'));var deskjs=require(_0xcf5a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcf5a('0xf'));var Papa=require(_0xcf5a('0x10'));var Redis=require(_0xcf5a('0x11'));var authService=require(_0xcf5a('0x12'));var qs=require(_0xcf5a('0x13'));var as=require(_0xcf5a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf5a('0x15'))(_0xcf5a('0x16'));var utils=require(_0xcf5a('0x17'));var config=require(_0xcf5a('0x18'));var licenseUtil=require(_0xcf5a('0x19'));var db=require(_0xcf5a('0x1a'))['db'];function respondWithStatusCode(_0x31a9f3,_0x4fd383){_0x4fd383=_0x4fd383||0xcc;return function(_0xb06840){if(_0xb06840){return _0x31a9f3['sendStatus'](_0x4fd383);}return _0x31a9f3[_0xcf5a('0x1b')](_0x4fd383)[_0xcf5a('0x1c')]();};}function respondWithResult(_0x28189b,_0x3e6af0){_0x3e6af0=_0x3e6af0||0xc8;return function(_0x45b0bc){if(_0x45b0bc){return _0x28189b['status'](_0x3e6af0)[_0xcf5a('0x1d')](_0x45b0bc);}};}function respondWithFilteredResult(_0x28fd0f,_0x1252c9){return function(_0x152bdf){if(_0x152bdf){var _0x5ae2e9=typeof _0x1252c9[_0xcf5a('0x1e')]==='undefined'&&typeof _0x1252c9[_0xcf5a('0x1f')]===_0xcf5a('0x20');var _0x197e15=_0x152bdf[_0xcf5a('0x21')];var _0x31e4c2=_0x5ae2e9?0x0:_0x1252c9[_0xcf5a('0x1e')];var _0x95a318=_0x5ae2e9?_0x152bdf[_0xcf5a('0x21')]:_0x1252c9[_0xcf5a('0x1e')]+_0x1252c9[_0xcf5a('0x1f')];var _0x29184c;if(_0x95a318>=_0x197e15){_0x95a318=_0x197e15;_0x29184c=0xc8;}else{_0x29184c=0xce;}_0x28fd0f[_0xcf5a('0x1b')](_0x29184c);return _0x28fd0f[_0xcf5a('0x22')](_0xcf5a('0x23'),_0x31e4c2+'-'+_0x95a318+'/'+_0x197e15)[_0xcf5a('0x1d')](_0x152bdf);}return null;};}function patchUpdates(_0x437664){return function(_0x1b9d5d){try{jsonpatch[_0xcf5a('0x24')](_0x1b9d5d,_0x437664,!![]);}catch(_0x1c2995){return BPromise['reject'](_0x1c2995);}return _0x1b9d5d[_0xcf5a('0x25')]();};}function saveUpdates(_0x181c3c,_0x2e0a42){return function(_0x4f2d28){if(_0x4f2d28){return _0x4f2d28[_0xcf5a('0x26')](_0x181c3c)[_0xcf5a('0x27')](function(_0x4d4675){return _0x4d4675;});}return null;};}function removeEntity(_0x535db5,_0x5e8c7b){return function(_0x32c8fe){if(_0x32c8fe){return _0x32c8fe[_0xcf5a('0x28')]()[_0xcf5a('0x27')](function(){_0x535db5[_0xcf5a('0x1b')](0xcc)[_0xcf5a('0x1c')]();});}};}function handleEntityNotFound(_0x377481,_0x16c8b4){return function(_0x11e088){if(!_0x11e088){_0x377481['sendStatus'](0x194);}return _0x11e088;};}function handleError(_0x3ce9aa,_0x45587a){_0x45587a=_0x45587a||0x1f4;return function(_0xdffbf7){logger[_0xcf5a('0x29')](_0xdffbf7[_0xcf5a('0x2a')]);if(_0xdffbf7[_0xcf5a('0x2b')]){delete _0xdffbf7[_0xcf5a('0x2b')];}_0x3ce9aa[_0xcf5a('0x1b')](_0x45587a)[_0xcf5a('0x2c')](_0xdffbf7);};}exports[_0xcf5a('0x2d')]=function(_0x5ba166,_0x298aa6){var _0x14dd1c={},_0x38e451={},_0x4f8e70={'count':0x0,'rows':[]};var _0x9feb43=_[_0xcf5a('0x2e')](db[_0xcf5a('0x2f')][_0xcf5a('0x30')],function(_0x515a6f){return{'name':_0x515a6f[_0xcf5a('0x31')],'type':_0x515a6f[_0xcf5a('0x32')]['key']};});_0x38e451[_0xcf5a('0x33')]=_[_0xcf5a('0x2e')](_0x9feb43,_0xcf5a('0x2b'));_0x38e451[_0xcf5a('0x34')]=_['keys'](_0x5ba166[_0xcf5a('0x34')]);_0x38e451[_0xcf5a('0x35')]=_[_0xcf5a('0x36')](_0x38e451[_0xcf5a('0x33')],_0x38e451[_0xcf5a('0x34')]);_0x14dd1c[_0xcf5a('0x37')]=_[_0xcf5a('0x36')](_0x38e451['model'],qs[_0xcf5a('0x38')](_0x5ba166['query'][_0xcf5a('0x38')]));_0x14dd1c[_0xcf5a('0x37')]=_0x14dd1c['attributes']['length']?_0x14dd1c[_0xcf5a('0x37')]:_0x38e451[_0xcf5a('0x33')];if(!_0x5ba166[_0xcf5a('0x34')]['hasOwnProperty']('nolimit')){_0x14dd1c[_0xcf5a('0x1f')]=qs[_0xcf5a('0x1f')](_0x5ba166['query'][_0xcf5a('0x1f')]);_0x14dd1c['offset']=qs[_0xcf5a('0x1e')](_0x5ba166[_0xcf5a('0x34')][_0xcf5a('0x1e')]);}_0x14dd1c['order']=qs['sort'](_0x5ba166[_0xcf5a('0x34')][_0xcf5a('0x39')]);_0x14dd1c[_0xcf5a('0x3a')]=qs[_0xcf5a('0x35')](_[_0xcf5a('0x3b')](_0x5ba166[_0xcf5a('0x34')],_0x38e451['filters']),_0x9feb43);if(_0x5ba166[_0xcf5a('0x34')][_0xcf5a('0x3c')]){_0x14dd1c[_0xcf5a('0x3a')]=_[_0xcf5a('0x3d')](_0x14dd1c[_0xcf5a('0x3a')],{'$or':_[_0xcf5a('0x2e')](_0x9feb43,function(_0x25bc41){if(_0x25bc41[_0xcf5a('0x32')]!=='VIRTUAL'){var _0x19310e={};_0x19310e[_0x25bc41[_0xcf5a('0x2b')]]={'$like':'%'+_0x5ba166['query'][_0xcf5a('0x3c')]+'%'};return _0x19310e;}})});}_0x14dd1c=_['merge']({},_0x14dd1c,_0x5ba166['options']);var _0x2ef006={'where':_0x14dd1c[_0xcf5a('0x3a')]};return db[_0xcf5a('0x2f')][_0xcf5a('0x21')](_0x2ef006)['then'](function(_0x2c9d5a){_0x4f8e70['count']=_0x2c9d5a;if(_0x5ba166[_0xcf5a('0x34')][_0xcf5a('0x3e')]){_0x14dd1c[_0xcf5a('0x3f')]=[{'all':!![]}];}return db[_0xcf5a('0x2f')][_0xcf5a('0x40')](_0x14dd1c);})[_0xcf5a('0x27')](function(_0x45d865){_0x4f8e70[_0xcf5a('0x41')]=_0x45d865;return _0x4f8e70;})['then'](respondWithFilteredResult(_0x298aa6,_0x14dd1c))['catch'](handleError(_0x298aa6,null));};exports[_0xcf5a('0x42')]=function(_0x22114c,_0x2462e4){var _0x20e6ed={'raw':![],'where':{'id':_0x22114c[_0xcf5a('0x43')]['id']}},_0xe2b48a={};_0xe2b48a[_0xcf5a('0x33')]=_['keys'](db[_0xcf5a('0x2f')][_0xcf5a('0x30')]);_0xe2b48a['query']=_['keys'](_0x22114c[_0xcf5a('0x34')]);_0xe2b48a[_0xcf5a('0x35')]=_['intersection'](_0xe2b48a['model'],_0xe2b48a[_0xcf5a('0x34')]);_0x20e6ed[_0xcf5a('0x37')]=_[_0xcf5a('0x36')](_0xe2b48a[_0xcf5a('0x33')],qs[_0xcf5a('0x38')](_0x22114c['query'][_0xcf5a('0x38')]));_0x20e6ed[_0xcf5a('0x37')]=_0x20e6ed[_0xcf5a('0x37')]['length']?_0x20e6ed[_0xcf5a('0x37')]:_0xe2b48a[_0xcf5a('0x33')];if(_0x22114c[_0xcf5a('0x34')][_0xcf5a('0x3e')]){_0x20e6ed[_0xcf5a('0x3f')]=[{'all':!![]}];}_0x20e6ed=_[_0xcf5a('0x3d')]({},_0x20e6ed,_0x22114c['options']);return db[_0xcf5a('0x2f')][_0xcf5a('0x44')](_0x20e6ed)[_0xcf5a('0x27')](handleEntityNotFound(_0x2462e4,null))[_0xcf5a('0x27')](respondWithResult(_0x2462e4,null))[_0xcf5a('0x45')](handleError(_0x2462e4,null));};exports['create']=function(_0x1b7e88,_0x58c7dc){return db[_0xcf5a('0x2f')][_0xcf5a('0x46')](_0x1b7e88[_0xcf5a('0x47')],{})[_0xcf5a('0x27')](respondWithResult(_0x58c7dc,0xc9))[_0xcf5a('0x45')](handleError(_0x58c7dc,null));};exports[_0xcf5a('0x26')]=function(_0x384142,_0x30eede){if(_0x384142['body']['id']){delete _0x384142[_0xcf5a('0x47')]['id'];}return db[_0xcf5a('0x2f')][_0xcf5a('0x44')]({'where':{'id':_0x384142[_0xcf5a('0x43')]['id']}})[_0xcf5a('0x27')](handleEntityNotFound(_0x30eede,null))[_0xcf5a('0x27')](saveUpdates(_0x384142['body'],null))[_0xcf5a('0x27')](respondWithResult(_0x30eede,null))[_0xcf5a('0x45')](handleError(_0x30eede,null));};exports['destroy']=function(_0x5d0426,_0x45493b){return db[_0xcf5a('0x2f')][_0xcf5a('0x44')]({'where':{'id':_0x5d0426['params']['id']}})['then'](handleEntityNotFound(_0x45493b,null))['then'](removeEntity(_0x45493b,null))[_0xcf5a('0x45')](handleError(_0x45493b,null));};exports[_0xcf5a('0x48')]=function(_0x19ea5e,_0xb89a5c){return db[_0xcf5a('0x2f')][_0xcf5a('0x48')]()['then'](respondWithResult(_0xb89a5c,null))['catch'](handleError(_0xb89a5c,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3b7e9c2..e8fb970 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 _0x9bd3=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash'];(function(_0x16e67e,_0x2defe0){var _0x23a0d9=function(_0x436ecf){while(--_0x436ecf){_0x16e67e['push'](_0x16e67e['shift']());}};_0x23a0d9(++_0x2defe0);}(_0x9bd3,0x1c6));var _0x39bd=function(_0x2013f7,_0x4d869f){_0x2013f7=_0x2013f7-0x0;var _0x4f4cb3=_0x9bd3[_0x2013f7];return _0x4f4cb3;};'use strict';var _=require(_0x39bd('0x0'));var util=require(_0x39bd('0x1'));var logger=require(_0x39bd('0x2'))(_0x39bd('0x3'));var moment=require(_0x39bd('0x4'));var BPromise=require('bluebird');var rp=require(_0x39bd('0x5'));var fs=require('fs');var path=require(_0x39bd('0x6'));var rimraf=require(_0x39bd('0x7'));var config=require(_0x39bd('0x8'));var attributes=require(_0x39bd('0x9'));module[_0x39bd('0xa')]=function(_0x1ab03f,_0x406492){return _0x1ab03f[_0x39bd('0xb')](_0x39bd('0xc'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ce=['request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','IntegrationReport','report_integration','lodash','../../config/logger','api','moment'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0xa7ce,0x172));var _0xea7c=function(_0x3ceb4d,_0x5a2f62){_0x3ceb4d=_0x3ceb4d-0x0;var _0x4346ac=_0xa7ce[_0x3ceb4d];return _0x4346ac;};'use strict';var _=require(_0xea7c('0x0'));var util=require('util');var logger=require(_0xea7c('0x1'))(_0xea7c('0x2'));var moment=require(_0xea7c('0x3'));var BPromise=require('bluebird');var rp=require(_0xea7c('0x4'));var fs=require('fs');var path=require(_0xea7c('0x5'));var rimraf=require(_0xea7c('0x6'));var config=require(_0xea7c('0x7'));var attributes=require(_0xea7c('0x8'));module['exports']=function(_0x5aad9a,_0x31bf7e){return _0x5aad9a['define'](_0xea7c('0x9'),attributes,{'tableName':_0xea7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 32da765..a49321f 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 _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x300e47,_0x405962){var _0x44e81e=function(_0x454b96){while(--_0x454b96){_0x300e47['push'](_0x300e47['shift']());}};_0x44e81e(++_0x405962);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x52e823,_0x28039d){var _0x5698e5=function(_0x43aab1){while(--_0x43aab1){_0x52e823['push'](_0x52e823['shift']());}};_0x5698e5(++_0x28039d);}(_0xba34,0x119));var _0x4ba3=function(_0x1d3270,_0x60423a){_0x1d3270=_0x1d3270-0x0;var _0x5e8912=_0xba34[_0x1d3270];return _0x5e8912;};'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/interval/index.js b/server/api/interval/index.js index 6acf7e8..ff55fdc 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 _0xd325=['../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd325,0x1f3));var _0x5d32=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0xd325[_0x55c1f0];return _0x1530fa;};'use strict';var multer=require(_0x5d32('0x0'));var util=require(_0x5d32('0x1'));var path=require('path');var timeout=require(_0x5d32('0x2'));var express=require(_0x5d32('0x3'));var router=express[_0x5d32('0x4')]();var fs_extra=require(_0x5d32('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5d32('0x6'));var config=require(_0x5d32('0x7'));var controller=require('./interval.controller');router['get']('/',auth[_0x5d32('0x8')](),controller[_0x5d32('0x9')]);router[_0x5d32('0xa')](_0x5d32('0xb'),auth[_0x5d32('0x8')](),controller[_0x5d32('0xc')]);router['get'](_0x5d32('0xd'),auth[_0x5d32('0x8')](),controller[_0x5d32('0xe')]);router[_0x5d32('0xf')]('/',auth[_0x5d32('0x8')](),controller['create']);router['post']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x5d32('0x10')]);router['post'](_0x5d32('0x11'),auth[_0x5d32('0x8')](),controller['addIntervals']);router[_0x5d32('0x12')](_0x5d32('0xb'),auth[_0x5d32('0x8')](),controller[_0x5d32('0x13')]);router[_0x5d32('0x14')](_0x5d32('0xb'),auth['isAuthenticated'](),controller[_0x5d32('0x15')]);module[_0x5d32('0x16')]=router; \ No newline at end of file +var _0x9485=['index','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated'];(function(_0x1ced24,_0x1447a8){var _0x41f3b4=function(_0x5ce8eb){while(--_0x5ce8eb){_0x1ced24['push'](_0x1ced24['shift']());}};_0x41f3b4(++_0x1447a8);}(_0x9485,0x8b));var _0x5948=function(_0x35a3c6,_0x551d51){_0x35a3c6=_0x35a3c6-0x0;var _0x2874d3=_0x9485[_0x35a3c6];return _0x2874d3;};'use strict';var multer=require(_0x5948('0x0'));var util=require(_0x5948('0x1'));var path=require(_0x5948('0x2'));var timeout=require(_0x5948('0x3'));var express=require('express');var router=express[_0x5948('0x4')]();var fs_extra=require(_0x5948('0x5'));var auth=require(_0x5948('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5948('0x7'));var controller=require(_0x5948('0x8'));router[_0x5948('0x9')]('/',auth[_0x5948('0xa')](),controller[_0x5948('0xb')]);router[_0x5948('0x9')]('/:id',auth[_0x5948('0xa')](),controller['show']);router[_0x5948('0x9')](_0x5948('0xc'),auth['isAuthenticated'](),controller[_0x5948('0xd')]);router[_0x5948('0xe')]('/',auth['isAuthenticated'](),controller[_0x5948('0xf')]);router[_0x5948('0xe')](_0x5948('0xc'),auth[_0x5948('0xa')](),controller[_0x5948('0x10')]);router[_0x5948('0xe')](_0x5948('0x11'),auth[_0x5948('0xa')](),controller[_0x5948('0x12')]);router[_0x5948('0x13')](_0x5948('0x14'),auth['isAuthenticated'](),controller[_0x5948('0x15')]);router[_0x5948('0x16')](_0x5948('0x14'),auth[_0x5948('0xa')](),controller[_0x5948('0x17')]);module[_0x5948('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index db5b052..543fd0f 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 _0x0141=['exports','STRING','sequelize'];(function(_0x4528cf,_0x3b1892){var _0x4bca53=function(_0x47d77b){while(--_0x47d77b){_0x4528cf['push'](_0x4528cf['shift']());}};_0x4bca53(++_0x3b1892);}(_0x0141,0x8f));var _0x1014=function(_0x17641b,_0x4f7b71){_0x17641b=_0x17641b-0x0;var _0x541396=_0x0141[_0x17641b];return _0x541396;};'use strict';var Sequelize=require(_0x1014('0x0'));module[_0x1014('0x1')]={'name':{'type':Sequelize[_0x1014('0x2')]},'description':{'type':Sequelize[_0x1014('0x2')]},'interval':{'type':Sequelize[_0x1014('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9e38=['sequelize','STRING'];(function(_0x4277b0,_0x2b2cf6){var _0x57c93f=function(_0xadf08b){while(--_0xadf08b){_0x4277b0['push'](_0x4277b0['shift']());}};_0x57c93f(++_0x2b2cf6);}(_0x9e38,0xfe));var _0x89e3=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0x9e38[_0x4e8286];return _0x44a440;};'use strict';var Sequelize=require(_0x89e3('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x89e3('0x1')]},'interval':{'type':Sequelize[_0x89e3('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f70c372..29b4eed 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 _0xa099=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','findAll','rows','fields','include','options','create','body','user','role','UserProfileSection','find','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','findOne','addIntervals','sequelize','destroy','bulkCreate','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','Intervals','UserProfileResource','stack','name','index','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x527827,_0x29b389){var _0x2360b8=function(_0x24fe5b){while(--_0x24fe5b){_0x527827['push'](_0x527827['shift']());}};_0x2360b8(++_0x29b389);}(_0xa099,0x76));var _0x9a09=function(_0x5c8112,_0x2b2b40){_0x5c8112=_0x5c8112-0x0;var _0x4042c6=_0xa099[_0x5c8112];return _0x4042c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a09('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a09('0x1'));var moment=require(_0x9a09('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9a09('0x3'));var path=require(_0x9a09('0x4'));var sox=require(_0x9a09('0x5'));var csv=require(_0x9a09('0x6'));var ejs=require(_0x9a09('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a09('0x8'));var squel=require(_0x9a09('0x9'));var crypto=require(_0x9a09('0xa'));var jsforce=require(_0x9a09('0xb'));var deskjs=require(_0x9a09('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9a09('0xd'));var Papa=require('papaparse');var Redis=require(_0x9a09('0xe'));var authService=require(_0x9a09('0xf'));var qs=require(_0x9a09('0x10'));var as=require(_0x9a09('0x11'));var hardwareService=require(_0x9a09('0x12'));var logger=require(_0x9a09('0x13'))('api');var utils=require(_0x9a09('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9a09('0x15'));var db=require(_0x9a09('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x1e5ee6,_0x2170c1){_0x2170c1=_0x2170c1||0xcc;return function(_0x36b548){if(_0x36b548){return _0x1e5ee6[_0x9a09('0x17')](_0x2170c1);}return _0x1e5ee6[_0x9a09('0x18')](_0x2170c1)[_0x9a09('0x19')]();};}function respondWithResult(_0x5a1772,_0x3365b3){_0x3365b3=_0x3365b3||0xc8;return function(_0x3dc395){if(_0x3dc395){return _0x5a1772[_0x9a09('0x18')](_0x3365b3)[_0x9a09('0x1a')](_0x3dc395);}};}function respondWithFilteredResult(_0x2fe91a,_0x56d1a6){return function(_0x3c3c98){if(_0x3c3c98){var _0x1c068f=typeof _0x56d1a6[_0x9a09('0x1b')]==='undefined'&&typeof _0x56d1a6[_0x9a09('0x1c')]===_0x9a09('0x1d');var _0x4f1666=_0x3c3c98[_0x9a09('0x1e')];var _0x16b267=_0x1c068f?0x0:_0x56d1a6[_0x9a09('0x1b')];var _0x5e1d9c=_0x1c068f?_0x3c3c98[_0x9a09('0x1e')]:_0x56d1a6['offset']+_0x56d1a6['limit'];var _0x14803c;if(_0x5e1d9c>=_0x4f1666){_0x5e1d9c=_0x4f1666;_0x14803c=0xc8;}else{_0x14803c=0xce;}_0x2fe91a[_0x9a09('0x18')](_0x14803c);return _0x2fe91a[_0x9a09('0x1f')](_0x9a09('0x20'),_0x16b267+'-'+_0x5e1d9c+'/'+_0x4f1666)['json'](_0x3c3c98);}return null;};}function patchUpdates(_0x1a0763){return function(_0x257740){try{jsonpatch['apply'](_0x257740,_0x1a0763,!![]);}catch(_0x27a8ec){return BPromise[_0x9a09('0x21')](_0x27a8ec);}return _0x257740[_0x9a09('0x22')]();};}function saveUpdates(_0x571c98,_0xdfb57c){return function(_0x1c51d3){if(_0x1c51d3){return _0x1c51d3[_0x9a09('0x23')](_0x571c98)[_0x9a09('0x24')](function(_0x2f7780){return _0x2f7780;});}return null;};}function removeEntity(_0x4b2b11,_0x3162eb){return function(_0x530c9b){if(_0x530c9b){return _0x530c9b['destroy']()[_0x9a09('0x24')](function(){var _0xc84f68=_0x530c9b[_0x9a09('0x25')]({'plain':!![]});var _0x207ebd=_0x9a09('0x26');return db[_0x9a09('0x27')]['destroy']({'where':{'type':_0x207ebd,'resourceId':_0xc84f68['id']}})[_0x9a09('0x24')](function(){return _0x530c9b;});})[_0x9a09('0x24')](function(){_0x4b2b11[_0x9a09('0x18')](0xcc)[_0x9a09('0x19')]();});}};}function handleEntityNotFound(_0x444d6c,_0x337c9a){return function(_0x53ace7){if(!_0x53ace7){_0x444d6c[_0x9a09('0x17')](0x194);}return _0x53ace7;};}function handleError(_0x51b851,_0x55a0af){_0x55a0af=_0x55a0af||0x1f4;return function(_0x564631){logger['error'](_0x564631[_0x9a09('0x28')]);if(_0x564631[_0x9a09('0x29')]){delete _0x564631['name'];}_0x51b851[_0x9a09('0x18')](_0x55a0af)['send'](_0x564631);};}exports[_0x9a09('0x2a')]=function(_0x2f80a7,_0x210b15){var _0x2f851f={},_0x4b107f={},_0x4eb106={'count':0x0,'rows':[]};var _0x30d6c8=_[_0x9a09('0x2b')](db[_0x9a09('0x2c')]['rawAttributes'],function(_0x2e23c9){return{'name':_0x2e23c9[_0x9a09('0x2d')],'type':_0x2e23c9[_0x9a09('0x2e')][_0x9a09('0x2f')]};});_0x4b107f[_0x9a09('0x30')]=_[_0x9a09('0x2b')](_0x30d6c8,'name');_0x4b107f[_0x9a09('0x31')]=_[_0x9a09('0x32')](_0x2f80a7[_0x9a09('0x31')]);_0x4b107f[_0x9a09('0x33')]=_[_0x9a09('0x34')](_0x4b107f[_0x9a09('0x30')],_0x4b107f[_0x9a09('0x31')]);_0x2f851f[_0x9a09('0x35')]=_['intersection'](_0x4b107f[_0x9a09('0x30')],qs['fields'](_0x2f80a7[_0x9a09('0x31')]['fields']));_0x2f851f[_0x9a09('0x35')]=_0x2f851f['attributes'][_0x9a09('0x36')]?_0x2f851f['attributes']:_0x4b107f['model'];if(!_0x2f80a7['query'][_0x9a09('0x37')](_0x9a09('0x38'))){_0x2f851f[_0x9a09('0x1c')]=qs[_0x9a09('0x1c')](_0x2f80a7['query'][_0x9a09('0x1c')]);_0x2f851f[_0x9a09('0x1b')]=qs[_0x9a09('0x1b')](_0x2f80a7[_0x9a09('0x31')][_0x9a09('0x1b')]);}_0x2f851f[_0x9a09('0x39')]=qs[_0x9a09('0x3a')](_0x2f80a7['query']['sort']);_0x2f851f[_0x9a09('0x3b')]=qs[_0x9a09('0x33')](_[_0x9a09('0x3c')](_0x2f80a7[_0x9a09('0x31')],_0x4b107f['filters']),_0x30d6c8);if(_0x2f80a7[_0x9a09('0x31')][_0x9a09('0x3d')]){_0x2f851f[_0x9a09('0x3b')]=_['merge'](_0x2f851f[_0x9a09('0x3b')],{'$or':_[_0x9a09('0x2b')](_0x30d6c8,function(_0x356be0){if(_0x356be0['type']!=='VIRTUAL'){var _0x238ac7={};_0x238ac7[_0x356be0['name']]={'$like':'%'+_0x2f80a7[_0x9a09('0x31')][_0x9a09('0x3d')]+'%'};return _0x238ac7;}})});}_0x2f851f=_[_0x9a09('0x3e')]({},_0x2f851f,_0x2f80a7['options']);var _0xbeb170={'where':_0x2f851f['where']};return db[_0x9a09('0x2c')][_0x9a09('0x1e')](_0xbeb170)[_0x9a09('0x24')](function(_0x170cdb){_0x4eb106[_0x9a09('0x1e')]=_0x170cdb;if(_0x2f80a7[_0x9a09('0x31')]['includeAll']){_0x2f851f['include']=[{'all':!![]}];}return db[_0x9a09('0x2c')][_0x9a09('0x3f')](_0x2f851f);})[_0x9a09('0x24')](function(_0x31c308){_0x4eb106[_0x9a09('0x40')]=_0x31c308;return _0x4eb106;})[_0x9a09('0x24')](respondWithFilteredResult(_0x210b15,_0x2f851f))['catch'](handleError(_0x210b15,null));};exports['show']=function(_0x12dc61,_0x56cdc2){var _0xb0a02d={'raw':!![],'where':{'id':_0x12dc61['params']['id']}},_0x5527d3={};_0x5527d3[_0x9a09('0x30')]=_[_0x9a09('0x32')](db['Interval']['rawAttributes']);_0x5527d3[_0x9a09('0x31')]=_[_0x9a09('0x32')](_0x12dc61[_0x9a09('0x31')]);_0x5527d3['filters']=_[_0x9a09('0x34')](_0x5527d3[_0x9a09('0x30')],_0x5527d3[_0x9a09('0x31')]);_0xb0a02d[_0x9a09('0x35')]=_[_0x9a09('0x34')](_0x5527d3['model'],qs['fields'](_0x12dc61[_0x9a09('0x31')][_0x9a09('0x41')]));_0xb0a02d[_0x9a09('0x35')]=_0xb0a02d[_0x9a09('0x35')]['length']?_0xb0a02d[_0x9a09('0x35')]:_0x5527d3[_0x9a09('0x30')];if(_0x12dc61['query']['includeAll']){_0xb0a02d[_0x9a09('0x42')]=[{'all':!![]}];}_0xb0a02d=_[_0x9a09('0x3e')]({},_0xb0a02d,_0x12dc61[_0x9a09('0x43')]);return db[_0x9a09('0x2c')]['find'](_0xb0a02d)['then'](handleEntityNotFound(_0x56cdc2,null))[_0x9a09('0x24')](respondWithResult(_0x56cdc2,null))['catch'](handleError(_0x56cdc2,null));};exports[_0x9a09('0x44')]=function(_0x3198d6,_0x1547c7){return db[_0x9a09('0x2c')][_0x9a09('0x44')](_0x3198d6[_0x9a09('0x45')],{})[_0x9a09('0x24')](function(_0x36346e){var _0x5158fc=_0x3198d6[_0x9a09('0x46')][_0x9a09('0x25')]({'plain':!![]});if(!_0x5158fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5158fc[_0x9a09('0x47')]==='user'){var _0x39f1de=_0x36346e[_0x9a09('0x25')]({'plain':!![]});var _0x13bafe=_0x9a09('0x26');return db[_0x9a09('0x48')][_0x9a09('0x49')]({'where':{'name':_0x13bafe,'userProfileId':_0x5158fc['userProfileId']},'raw':!![]})[_0x9a09('0x24')](function(_0x449dca){if(_0x449dca&&_0x449dca[_0x9a09('0x4a')]===0x0){return db['UserProfileResource'][_0x9a09('0x44')]({'name':_0x39f1de[_0x9a09('0x29')],'resourceId':_0x39f1de['id'],'type':_0x449dca[_0x9a09('0x29')],'sectionId':_0x449dca['id']},{})[_0x9a09('0x24')](function(){return _0x36346e;});}else{return _0x36346e;}})[_0x9a09('0x4b')](function(_0x5c141a){logger[_0x9a09('0x4c')](_0x9a09('0x4d'),_0x5c141a);throw _0x5c141a;});}return _0x36346e;})[_0x9a09('0x24')](respondWithResult(_0x1547c7,0xc9))[_0x9a09('0x4b')](handleError(_0x1547c7,null));};exports[_0x9a09('0x23')]=function(_0x4a80e2,_0x1c60d4){if(_0x4a80e2[_0x9a09('0x45')]['id']){delete _0x4a80e2[_0x9a09('0x45')]['id'];}return db['Interval'][_0x9a09('0x49')]({'where':{'id':_0x4a80e2[_0x9a09('0x4e')]['id']}})[_0x9a09('0x24')](handleEntityNotFound(_0x1c60d4,null))['then'](saveUpdates(_0x4a80e2[_0x9a09('0x45')],null))[_0x9a09('0x24')](respondWithResult(_0x1c60d4,null))[_0x9a09('0x4b')](handleError(_0x1c60d4,null));};exports['destroy']=function(_0x499cd8,_0x46763c){return db['Interval'][_0x9a09('0x49')]({'where':{'id':_0x499cd8[_0x9a09('0x4e')]['id']}})[_0x9a09('0x24')](handleEntityNotFound(_0x46763c,null))[_0x9a09('0x24')](removeEntity(_0x46763c,null))[_0x9a09('0x4b')](handleError(_0x46763c,null));};exports[_0x9a09('0x4f')]=function(_0x46edb2,_0xdb18e7,_0x76f8f5){if(_0x46edb2[_0x9a09('0x45')]['id']){delete _0x46edb2['body']['id'];}return db[_0x9a09('0x2c')]['find']({'where':{'id':_0x46edb2[_0x9a09('0x4e')]['id']}})[_0x9a09('0x24')](handleEntityNotFound(_0xdb18e7,null))[_0x9a09('0x24')](function(_0x4552d4){if(_0x4552d4){_0x46edb2[_0x9a09('0x45')]['IntervalId']=_0x4552d4['id'];return db[_0x9a09('0x2c')][_0x9a09('0x44')](_0x46edb2['body']);}})['then'](respondWithResult(_0xdb18e7,null))[_0x9a09('0x4b')](handleError(_0xdb18e7,null));};exports[_0x9a09('0x50')]=function(_0xfc3ffa,_0x21216a,_0x1c9c42){var _0x13cdab={};var _0x4a42a6={};var _0x5371ac;var _0x2d1d37;return db[_0x9a09('0x2c')][_0x9a09('0x51')]({'where':{'id':_0xfc3ffa['params']['id']}})[_0x9a09('0x24')](handleEntityNotFound(_0x21216a,null))[_0x9a09('0x24')](function(_0x2ddd6f){if(_0x2ddd6f){_0x5371ac=_0x2ddd6f;_0x4a42a6['model']=_['keys'](db[_0x9a09('0x2c')]['rawAttributes']);_0x4a42a6[_0x9a09('0x31')]=_['keys'](_0xfc3ffa['query']);_0x4a42a6[_0x9a09('0x33')]=_[_0x9a09('0x34')](_0x4a42a6[_0x9a09('0x30')],_0x4a42a6[_0x9a09('0x31')]);_0x13cdab[_0x9a09('0x35')]=_[_0x9a09('0x34')](_0x4a42a6['model'],qs['fields'](_0xfc3ffa[_0x9a09('0x31')][_0x9a09('0x41')]));_0x13cdab[_0x9a09('0x35')]=_0x13cdab['attributes']['length']?_0x13cdab[_0x9a09('0x35')]:_0x4a42a6[_0x9a09('0x30')];_0x13cdab[_0x9a09('0x39')]=qs['sort'](_0xfc3ffa[_0x9a09('0x31')]['sort']);_0x13cdab[_0x9a09('0x3b')]=qs[_0x9a09('0x33')](_[_0x9a09('0x3c')](_0xfc3ffa[_0x9a09('0x31')],_0x4a42a6[_0x9a09('0x33')]));if(_0xfc3ffa[_0x9a09('0x31')][_0x9a09('0x3d')]){_0x13cdab['where']=_[_0x9a09('0x3e')](_0x13cdab[_0x9a09('0x3b')],{'$or':_[_0x9a09('0x2b')](_0x13cdab[_0x9a09('0x35')],function(_0x424c71){var _0x4dcdb8={};_0x4dcdb8[_0x424c71]={'$like':'%'+_0xfc3ffa[_0x9a09('0x31')]['filter']+'%'};return _0x4dcdb8;})});}_0x13cdab=_[_0x9a09('0x3e')]({},_0x13cdab,_0xfc3ffa[_0x9a09('0x43')]);return _0x5371ac['getIntervals'](_0x13cdab);}})[_0x9a09('0x24')](function(_0x3f9b85){if(_0x3f9b85){_0x2d1d37=_0x3f9b85[_0x9a09('0x36')];if(!_0xfc3ffa[_0x9a09('0x31')][_0x9a09('0x37')](_0x9a09('0x38'))){_0x13cdab['limit']=qs[_0x9a09('0x1c')](_0xfc3ffa[_0x9a09('0x31')][_0x9a09('0x1c')]);_0x13cdab['offset']=qs[_0x9a09('0x1b')](_0xfc3ffa[_0x9a09('0x31')][_0x9a09('0x1b')]);}return _0x5371ac[_0x9a09('0x50')](_0x13cdab);}})['then'](function(_0x317d6c){if(_0x317d6c){return _0x317d6c?{'count':_0x2d1d37,'rows':_0x317d6c}:null;}})[_0x9a09('0x24')](respondWithResult(_0x21216a,null))[_0x9a09('0x4b')](handleError(_0x21216a,null));};exports[_0x9a09('0x52')]=function(_0x156cc2,_0x8af524,_0x21fd94){return db[_0x9a09('0x2c')]['findOne']({'where':{'id':_0x156cc2[_0x9a09('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8af524,null))[_0x9a09('0x24')](function(_0x4ec85b){if(_0x4ec85b){return db[_0x9a09('0x53')]['transaction'](function(_0x10aeae){return db[_0x9a09('0x2c')][_0x9a09('0x54')]({'where':{'IntervalId':_0x156cc2['params']['id']},'transaction':_0x10aeae})[_0x9a09('0x24')](function(_0xb5b0fe){var _0x261027=_['map'](_0x156cc2['body'],function(_0x441b37){delete _0x441b37['id'];_0x441b37['IntervalId']=_0x156cc2[_0x9a09('0x4e')]['id'];return _0x441b37;});return db['Interval'][_0x9a09('0x55')](_0x261027,{'transaction':_0x10aeae});});})[_0x9a09('0x24')](function(){return db['Interval'][_0x9a09('0x3f')]({'where':{'IntervalId':_0x156cc2[_0x9a09('0x4e')]['id']}});});}})[_0x9a09('0x24')](respondWithResult(_0x8af524,null))['catch'](handleError(_0x8af524,null));}; \ No newline at end of file +var _0xbe18=['includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','send','index','Interval','rawAttributes','type','key','model','map','name','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x2bfc70,_0x47f4c5){var _0x5a9a23=function(_0x1b209d){while(--_0x1b209d){_0x2bfc70['push'](_0x2bfc70['shift']());}};_0x5a9a23(++_0x47f4c5);}(_0xbe18,0x186));var _0x8be1=function(_0x3c40cc,_0x391640){_0x3c40cc=_0x3c40cc-0x0;var _0x4fb3f9=_0xbe18[_0x3c40cc];return _0x4fb3f9;};'use strict';var emlformat=require(_0x8be1('0x0'));var rimraf=require(_0x8be1('0x1'));var zipdir=require(_0x8be1('0x2'));var jsonpatch=require(_0x8be1('0x3'));var rp=require(_0x8be1('0x4'));var moment=require(_0x8be1('0x5'));var BPromise=require(_0x8be1('0x6'));var Mustache=require('mustache');var util=require(_0x8be1('0x7'));var path=require(_0x8be1('0x8'));var sox=require(_0x8be1('0x9'));var csv=require('to-csv');var ejs=require(_0x8be1('0xa'));var fs=require('fs');var fs_extra=require(_0x8be1('0xb'));var _=require(_0x8be1('0xc'));var squel=require(_0x8be1('0xd'));var crypto=require(_0x8be1('0xe'));var jsforce=require(_0x8be1('0xf'));var deskjs=require(_0x8be1('0x10'));var toCsv=require(_0x8be1('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8be1('0x12'));var qs=require(_0x8be1('0x13'));var as=require(_0x8be1('0x14'));var hardwareService=require(_0x8be1('0x15'));var logger=require(_0x8be1('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8be1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8be1('0x18'))['db'];var extensions=require(_0x8be1('0x19'));function respondWithStatusCode(_0x4f4ef9,_0x1fff92){_0x1fff92=_0x1fff92||0xcc;return function(_0x46eaef){if(_0x46eaef){return _0x4f4ef9[_0x8be1('0x1a')](_0x1fff92);}return _0x4f4ef9[_0x8be1('0x1b')](_0x1fff92)['end']();};}function respondWithResult(_0xc7c20,_0x264bb1){_0x264bb1=_0x264bb1||0xc8;return function(_0xc1902b){if(_0xc1902b){return _0xc7c20['status'](_0x264bb1)[_0x8be1('0x1c')](_0xc1902b);}};}function respondWithFilteredResult(_0x15f535,_0x208cd3){return function(_0x26c818){if(_0x26c818){var _0x46b65f=typeof _0x208cd3[_0x8be1('0x1d')]===_0x8be1('0x1e')&&typeof _0x208cd3[_0x8be1('0x1f')]===_0x8be1('0x1e');var _0x422c33=_0x26c818[_0x8be1('0x20')];var _0x40d40f=_0x46b65f?0x0:_0x208cd3[_0x8be1('0x1d')];var _0x387433=_0x46b65f?_0x26c818['count']:_0x208cd3[_0x8be1('0x1d')]+_0x208cd3[_0x8be1('0x1f')];var _0x2bc485;if(_0x387433>=_0x422c33){_0x387433=_0x422c33;_0x2bc485=0xc8;}else{_0x2bc485=0xce;}_0x15f535['status'](_0x2bc485);return _0x15f535[_0x8be1('0x21')](_0x8be1('0x22'),_0x40d40f+'-'+_0x387433+'/'+_0x422c33)['json'](_0x26c818);}return null;};}function patchUpdates(_0x40bfcc){return function(_0x1055c5){try{jsonpatch[_0x8be1('0x23')](_0x1055c5,_0x40bfcc,!![]);}catch(_0x310431){return BPromise[_0x8be1('0x24')](_0x310431);}return _0x1055c5['save']();};}function saveUpdates(_0x25a828,_0x232f84){return function(_0x4d886b){if(_0x4d886b){return _0x4d886b[_0x8be1('0x25')](_0x25a828)[_0x8be1('0x26')](function(_0x3fd462){return _0x3fd462;});}return null;};}function removeEntity(_0x4d660e,_0xbb8af0){return function(_0x49af83){if(_0x49af83){return _0x49af83[_0x8be1('0x27')]()['then'](function(){var _0x3b4ac6=_0x49af83[_0x8be1('0x28')]({'plain':!![]});var _0x1db8ea='Intervals';return db[_0x8be1('0x29')][_0x8be1('0x27')]({'where':{'type':_0x1db8ea,'resourceId':_0x3b4ac6['id']}})[_0x8be1('0x26')](function(){return _0x49af83;});})[_0x8be1('0x26')](function(){_0x4d660e['status'](0xcc)[_0x8be1('0x2a')]();});}};}function handleEntityNotFound(_0x2c37aa,_0x394636){return function(_0xea53fb){if(!_0xea53fb){_0x2c37aa['sendStatus'](0x194);}return _0xea53fb;};}function handleError(_0x448e5d,_0x5d0c37){_0x5d0c37=_0x5d0c37||0x1f4;return function(_0x42d5dc){logger[_0x8be1('0x2b')](_0x42d5dc[_0x8be1('0x2c')]);if(_0x42d5dc['name']){delete _0x42d5dc['name'];}_0x448e5d[_0x8be1('0x1b')](_0x5d0c37)[_0x8be1('0x2d')](_0x42d5dc);};}exports[_0x8be1('0x2e')]=function(_0x356108,_0x3807b2){var _0x202f8e={},_0x37d136={},_0xba8058={'count':0x0,'rows':[]};var _0x461e12=_['map'](db[_0x8be1('0x2f')][_0x8be1('0x30')],function(_0x2e338b){return{'name':_0x2e338b['fieldName'],'type':_0x2e338b[_0x8be1('0x31')][_0x8be1('0x32')]};});_0x37d136[_0x8be1('0x33')]=_[_0x8be1('0x34')](_0x461e12,_0x8be1('0x35'));_0x37d136[_0x8be1('0x36')]=_[_0x8be1('0x37')](_0x356108[_0x8be1('0x36')]);_0x37d136['filters']=_['intersection'](_0x37d136['model'],_0x37d136[_0x8be1('0x36')]);_0x202f8e['attributes']=_['intersection'](_0x37d136['model'],qs[_0x8be1('0x38')](_0x356108[_0x8be1('0x36')][_0x8be1('0x38')]));_0x202f8e[_0x8be1('0x39')]=_0x202f8e[_0x8be1('0x39')][_0x8be1('0x3a')]?_0x202f8e['attributes']:_0x37d136[_0x8be1('0x33')];if(!_0x356108[_0x8be1('0x36')][_0x8be1('0x3b')](_0x8be1('0x3c'))){_0x202f8e[_0x8be1('0x1f')]=qs['limit'](_0x356108[_0x8be1('0x36')][_0x8be1('0x1f')]);_0x202f8e[_0x8be1('0x1d')]=qs[_0x8be1('0x1d')](_0x356108['query'][_0x8be1('0x1d')]);}_0x202f8e[_0x8be1('0x3d')]=qs[_0x8be1('0x3e')](_0x356108['query'][_0x8be1('0x3e')]);_0x202f8e[_0x8be1('0x3f')]=qs[_0x8be1('0x40')](_[_0x8be1('0x41')](_0x356108[_0x8be1('0x36')],_0x37d136[_0x8be1('0x40')]),_0x461e12);if(_0x356108[_0x8be1('0x36')][_0x8be1('0x42')]){_0x202f8e[_0x8be1('0x3f')]=_[_0x8be1('0x43')](_0x202f8e['where'],{'$or':_['map'](_0x461e12,function(_0x244035){if(_0x244035[_0x8be1('0x31')]!==_0x8be1('0x44')){var _0x42faaa={};_0x42faaa[_0x244035[_0x8be1('0x35')]]={'$like':'%'+_0x356108['query'][_0x8be1('0x42')]+'%'};return _0x42faaa;}})});}_0x202f8e=_[_0x8be1('0x43')]({},_0x202f8e,_0x356108[_0x8be1('0x45')]);var _0x202618={'where':_0x202f8e['where']};return db[_0x8be1('0x2f')][_0x8be1('0x20')](_0x202618)[_0x8be1('0x26')](function(_0x4d9da5){_0xba8058[_0x8be1('0x20')]=_0x4d9da5;if(_0x356108[_0x8be1('0x36')][_0x8be1('0x46')]){_0x202f8e[_0x8be1('0x47')]=[{'all':!![]}];}return db[_0x8be1('0x2f')][_0x8be1('0x48')](_0x202f8e);})[_0x8be1('0x26')](function(_0x319755){_0xba8058[_0x8be1('0x49')]=_0x319755;return _0xba8058;})[_0x8be1('0x26')](respondWithFilteredResult(_0x3807b2,_0x202f8e))[_0x8be1('0x4a')](handleError(_0x3807b2,null));};exports[_0x8be1('0x4b')]=function(_0x883b30,_0x5f2418){var _0x284296={'raw':!![],'where':{'id':_0x883b30[_0x8be1('0x4c')]['id']}},_0x15f5e3={};_0x15f5e3[_0x8be1('0x33')]=_[_0x8be1('0x37')](db[_0x8be1('0x2f')][_0x8be1('0x30')]);_0x15f5e3[_0x8be1('0x36')]=_['keys'](_0x883b30[_0x8be1('0x36')]);_0x15f5e3[_0x8be1('0x40')]=_[_0x8be1('0x4d')](_0x15f5e3[_0x8be1('0x33')],_0x15f5e3[_0x8be1('0x36')]);_0x284296[_0x8be1('0x39')]=_['intersection'](_0x15f5e3[_0x8be1('0x33')],qs[_0x8be1('0x38')](_0x883b30[_0x8be1('0x36')][_0x8be1('0x38')]));_0x284296[_0x8be1('0x39')]=_0x284296[_0x8be1('0x39')][_0x8be1('0x3a')]?_0x284296[_0x8be1('0x39')]:_0x15f5e3[_0x8be1('0x33')];if(_0x883b30[_0x8be1('0x36')][_0x8be1('0x46')]){_0x284296['include']=[{'all':!![]}];}_0x284296=_[_0x8be1('0x43')]({},_0x284296,_0x883b30[_0x8be1('0x45')]);return db['Interval'][_0x8be1('0x4e')](_0x284296)[_0x8be1('0x26')](handleEntityNotFound(_0x5f2418,null))[_0x8be1('0x26')](respondWithResult(_0x5f2418,null))[_0x8be1('0x4a')](handleError(_0x5f2418,null));};exports[_0x8be1('0x4f')]=function(_0x28268c,_0x52b8db){return db['Interval'][_0x8be1('0x4f')](_0x28268c[_0x8be1('0x50')],{})[_0x8be1('0x26')](function(_0x31e0b9){var _0x19e815=_0x28268c[_0x8be1('0x51')][_0x8be1('0x28')]({'plain':!![]});if(!_0x19e815)throw new Error(_0x8be1('0x52'));if(_0x19e815['role']===_0x8be1('0x51')){var _0x2ba0c1=_0x31e0b9[_0x8be1('0x28')]({'plain':!![]});var _0x79babc='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x79babc,'userProfileId':_0x19e815[_0x8be1('0x53')]},'raw':!![]})['then'](function(_0x38fc98){if(_0x38fc98&&_0x38fc98[_0x8be1('0x54')]===0x0){return db[_0x8be1('0x29')]['create']({'name':_0x2ba0c1[_0x8be1('0x35')],'resourceId':_0x2ba0c1['id'],'type':_0x38fc98[_0x8be1('0x35')],'sectionId':_0x38fc98['id']},{})[_0x8be1('0x26')](function(){return _0x31e0b9;});}else{return _0x31e0b9;}})[_0x8be1('0x4a')](function(_0xc01be0){logger['error'](_0x8be1('0x55'),_0xc01be0);throw _0xc01be0;});}return _0x31e0b9;})[_0x8be1('0x26')](respondWithResult(_0x52b8db,0xc9))['catch'](handleError(_0x52b8db,null));};exports[_0x8be1('0x25')]=function(_0x568978,_0xf0d535){if(_0x568978[_0x8be1('0x50')]['id']){delete _0x568978[_0x8be1('0x50')]['id'];}return db[_0x8be1('0x2f')][_0x8be1('0x4e')]({'where':{'id':_0x568978[_0x8be1('0x4c')]['id']}})[_0x8be1('0x26')](handleEntityNotFound(_0xf0d535,null))[_0x8be1('0x26')](saveUpdates(_0x568978[_0x8be1('0x50')],null))[_0x8be1('0x26')](respondWithResult(_0xf0d535,null))[_0x8be1('0x4a')](handleError(_0xf0d535,null));};exports[_0x8be1('0x27')]=function(_0x3a0f87,_0x4d08c4){return db[_0x8be1('0x2f')][_0x8be1('0x4e')]({'where':{'id':_0x3a0f87[_0x8be1('0x4c')]['id']}})[_0x8be1('0x26')](handleEntityNotFound(_0x4d08c4,null))[_0x8be1('0x26')](removeEntity(_0x4d08c4,null))[_0x8be1('0x4a')](handleError(_0x4d08c4,null));};exports['addInterval']=function(_0x27486c,_0x4b0d6c,_0x22d908){if(_0x27486c[_0x8be1('0x50')]['id']){delete _0x27486c[_0x8be1('0x50')]['id'];}return db['Interval'][_0x8be1('0x4e')]({'where':{'id':_0x27486c[_0x8be1('0x4c')]['id']}})[_0x8be1('0x26')](handleEntityNotFound(_0x4b0d6c,null))[_0x8be1('0x26')](function(_0x24eb4e){if(_0x24eb4e){_0x27486c[_0x8be1('0x50')]['IntervalId']=_0x24eb4e['id'];return db[_0x8be1('0x2f')][_0x8be1('0x4f')](_0x27486c[_0x8be1('0x50')]);}})[_0x8be1('0x26')](respondWithResult(_0x4b0d6c,null))[_0x8be1('0x4a')](handleError(_0x4b0d6c,null));};exports[_0x8be1('0x56')]=function(_0x3c64dc,_0xbfc66b,_0x17ca14){var _0x204bc8={};var _0x2c5bc7={};var _0x2aee67;var _0x43d1cd;return db[_0x8be1('0x2f')][_0x8be1('0x57')]({'where':{'id':_0x3c64dc[_0x8be1('0x4c')]['id']}})[_0x8be1('0x26')](handleEntityNotFound(_0xbfc66b,null))[_0x8be1('0x26')](function(_0x188b3c){if(_0x188b3c){_0x2aee67=_0x188b3c;_0x2c5bc7[_0x8be1('0x33')]=_[_0x8be1('0x37')](db[_0x8be1('0x2f')][_0x8be1('0x30')]);_0x2c5bc7['query']=_['keys'](_0x3c64dc[_0x8be1('0x36')]);_0x2c5bc7[_0x8be1('0x40')]=_[_0x8be1('0x4d')](_0x2c5bc7['model'],_0x2c5bc7['query']);_0x204bc8[_0x8be1('0x39')]=_[_0x8be1('0x4d')](_0x2c5bc7[_0x8be1('0x33')],qs[_0x8be1('0x38')](_0x3c64dc[_0x8be1('0x36')][_0x8be1('0x38')]));_0x204bc8['attributes']=_0x204bc8[_0x8be1('0x39')][_0x8be1('0x3a')]?_0x204bc8['attributes']:_0x2c5bc7['model'];_0x204bc8[_0x8be1('0x3d')]=qs['sort'](_0x3c64dc[_0x8be1('0x36')][_0x8be1('0x3e')]);_0x204bc8[_0x8be1('0x3f')]=qs[_0x8be1('0x40')](_[_0x8be1('0x41')](_0x3c64dc[_0x8be1('0x36')],_0x2c5bc7[_0x8be1('0x40')]));if(_0x3c64dc[_0x8be1('0x36')][_0x8be1('0x42')]){_0x204bc8['where']=_[_0x8be1('0x43')](_0x204bc8[_0x8be1('0x3f')],{'$or':_[_0x8be1('0x34')](_0x204bc8[_0x8be1('0x39')],function(_0x48c313){var _0x90bc3={};_0x90bc3[_0x48c313]={'$like':'%'+_0x3c64dc[_0x8be1('0x36')][_0x8be1('0x42')]+'%'};return _0x90bc3;})});}_0x204bc8=_[_0x8be1('0x43')]({},_0x204bc8,_0x3c64dc['options']);return _0x2aee67[_0x8be1('0x56')](_0x204bc8);}})[_0x8be1('0x26')](function(_0x535bf6){if(_0x535bf6){_0x43d1cd=_0x535bf6[_0x8be1('0x3a')];if(!_0x3c64dc['query'][_0x8be1('0x3b')]('nolimit')){_0x204bc8[_0x8be1('0x1f')]=qs[_0x8be1('0x1f')](_0x3c64dc['query'][_0x8be1('0x1f')]);_0x204bc8[_0x8be1('0x1d')]=qs[_0x8be1('0x1d')](_0x3c64dc[_0x8be1('0x36')][_0x8be1('0x1d')]);}return _0x2aee67[_0x8be1('0x56')](_0x204bc8);}})[_0x8be1('0x26')](function(_0x1294de){if(_0x1294de){return _0x1294de?{'count':_0x43d1cd,'rows':_0x1294de}:null;}})[_0x8be1('0x26')](respondWithResult(_0xbfc66b,null))['catch'](handleError(_0xbfc66b,null));};exports[_0x8be1('0x58')]=function(_0x173d96,_0x2090d7,_0x1c2951){return db[_0x8be1('0x2f')][_0x8be1('0x57')]({'where':{'id':_0x173d96['params']['id']}})[_0x8be1('0x26')](handleEntityNotFound(_0x2090d7,null))[_0x8be1('0x26')](function(_0x441a0c){if(_0x441a0c){return db[_0x8be1('0x59')][_0x8be1('0x5a')](function(_0x278660){return db[_0x8be1('0x2f')][_0x8be1('0x27')]({'where':{'IntervalId':_0x173d96[_0x8be1('0x4c')]['id']},'transaction':_0x278660})[_0x8be1('0x26')](function(_0x1b9a06){var _0x1fba3b=_[_0x8be1('0x34')](_0x173d96[_0x8be1('0x50')],function(_0x5558b2){delete _0x5558b2['id'];_0x5558b2[_0x8be1('0x5b')]=_0x173d96[_0x8be1('0x4c')]['id'];return _0x5558b2;});return db[_0x8be1('0x2f')]['bulkCreate'](_0x1fba3b,{'transaction':_0x278660});});})[_0x8be1('0x26')](function(){return db[_0x8be1('0x2f')][_0x8be1('0x48')]({'where':{'IntervalId':_0x173d96['params']['id']}});});}})[_0x8be1('0x26')](respondWithResult(_0x2090d7,null))[_0x8be1('0x4a')](handleError(_0x2090d7,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 030dab6..e845945 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 _0xc588=['interval','getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xc588,0x19a));var _0x8c58=function(_0x4d189e,_0x2c0a04){_0x4d189e=_0x4d189e-0x0;var _0x1b36df=_0xc588[_0x4d189e];return _0x1b36df;};'use strict';var attributes=require(_0x8c58('0x0'));var extensions=require(_0x8c58('0x1'));var iftime=require('../../utils/iftime')['iftime'];module[_0x8c58('0x2')]=function(_0x79b1bc){return _0x79b1bc[_0x8c58('0x3')]('Interval',attributes,{'tableName':_0x8c58('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1685ff){extensions[_0x8c58('0x5')](_0x79b1bc,_0x1685ff);},'afterBulkCreate':function(_0x42fe2d,_0x5d1e87,_0x509749){_0x509749();extensions[_0x8c58('0x5')](_0x79b1bc,_0x42fe2d[0x0]);},'afterUpdate':function(_0x32a51e){extensions['rewrite'](_0x79b1bc,_0x32a51e);},'afterDestroy':function(_0xa1eb3){extensions[_0x8c58('0x5')](_0x79b1bc,_0xa1eb3);}},'instanceMethods':{'ifTime':function(_0x5a58bf=undefined,_0x9288cd=new Date()){if(typeof this[_0x8c58('0x6')]==='string'){return iftime(this[_0x8c58('0x6')],_0x5a58bf,_0x9288cd);}else{return this[_0x8c58('0x7')]()[_0x8c58('0x8')](function(_0x3d0f26){return Promise[_0x8c58('0x9')](_0x3d0f26[_0x8c58('0xa')](function(_0x151ba9){return _0x151ba9[_0x8c58('0xb')](_0x5a58bf,_0x9288cd);}));})[_0x8c58('0x8')](function(_0x5d6e38){return _0x5d6e38[_0x8c58('0xc')](function(_0x24d030,_0x286d38){return _0x24d030||_0x286d38;},![]);});}}}});}; \ No newline at end of file +var _0xc358=['getIntervals','then','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','Interval','tools_intervals','rewrite','interval','string'];(function(_0x366255,_0x3edffb){var _0x2604b2=function(_0x512223){while(--_0x512223){_0x366255['push'](_0x366255['shift']());}};_0x2604b2(++_0x3edffb);}(_0xc358,0x131));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x8c35('0x0'));var iftime=require(_0x8c35('0x1'))['iftime'];module['exports']=function(_0x51fa9a){return _0x51fa9a['define'](_0x8c35('0x2'),attributes,{'tableName':_0x8c35('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c3221){extensions[_0x8c35('0x4')](_0x51fa9a,_0x2c3221);},'afterBulkCreate':function(_0x448685,_0x14bbaf,_0x3b2641){_0x3b2641();extensions[_0x8c35('0x4')](_0x51fa9a,_0x448685[0x0]);},'afterUpdate':function(_0x292b3b){extensions[_0x8c35('0x4')](_0x51fa9a,_0x292b3b);},'afterDestroy':function(_0x268c6f){extensions[_0x8c35('0x4')](_0x51fa9a,_0x268c6f);}},'instanceMethods':{'ifTime':function(_0x42dc32=undefined,_0x92bf04=new Date()){if(typeof this[_0x8c35('0x5')]===_0x8c35('0x6')){return iftime(this[_0x8c35('0x5')],_0x42dc32,_0x92bf04);}else{return this[_0x8c35('0x7')]()[_0x8c35('0x8')](function(_0x402cd3){return Promise['all'](_0x402cd3[_0x8c35('0x9')](function(_0x2f284a){return _0x2f284a[_0x8c35('0xa')](_0x42dc32,_0x92bf04);}));})[_0x8c35('0x8')](function(_0x269c5f){return _0x269c5f[_0x8c35('0xb')](function(_0x1a899e,_0x126394){return _0x1a899e||_0x126394;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 65d7be6..d8e5d0f 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 _0x8945=['intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','where','include','model','attributes','map','then','info','stringify','error','message','find','ShowInterval','catch','all','ifTime','format','name','join','findById','IntervalIftime','intervalIds','isArray'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8945,0x18d));var _0x5894=function(_0x5c7753,_0x25dbc9){_0x5c7753=_0x5c7753-0x0;var _0x4d7dbf=_0x8945[_0x5c7753];return _0x4d7dbf;};'use strict';var _=require(_0x5894('0x0'));var util=require('util');var db=require(_0x5894('0x1'))['db'];var iftime=require(_0x5894('0x2'))[_0x5894('0x3')];var logger=require(_0x5894('0x4'))(_0x5894('0x5'));exports[_0x5894('0x6')]=function(_0x340d5d){var _0x5eee15=this;return new Promise(function(_0x5cca8a,_0x714ed1){return db[_0x5894('0x7')][_0x5894('0x8')]({'raw':_0x340d5d[_0x5894('0x9')]?_0x340d5d[_0x5894('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x340d5d[_0x5894('0x9')]?_0x340d5d[_0x5894('0x9')][_0x5894('0xa')]||null:null,'attributes':_0x340d5d[_0x5894('0x9')]?_0x340d5d[_0x5894('0x9')]['attributes']||null:null,'limit':_0x340d5d[_0x5894('0x9')]?_0x340d5d[_0x5894('0x9')]['limit']||null:null,'include':_0x340d5d[_0x5894('0x9')]?_0x340d5d[_0x5894('0x9')]['include']?_['map'](_0x340d5d['options'][_0x5894('0xb')],function(_0x8d2aab){return{'model':db[_0x8d2aab[_0x5894('0xc')]],'as':_0x8d2aab['as'],'attributes':_0x8d2aab[_0x5894('0xd')],'include':_0x8d2aab[_0x5894('0xb')]?_[_0x5894('0xe')](_0x8d2aab[_0x5894('0xb')],function(_0xaad43e){return{'model':db[_0xaad43e[_0x5894('0xc')]],'as':_0xaad43e['as'],'attributes':_0xaad43e['attributes'],'include':_0xaad43e[_0x5894('0xb')]?_['map'](_0xaad43e[_0x5894('0xb')],function(_0x1a484e){return{'model':db[_0x1a484e[_0x5894('0xc')]],'as':_0x1a484e['as'],'attributes':_0x1a484e[_0x5894('0xd')]};}):[]};}):[]};}):[]:[]})[_0x5894('0xf')](function(_0x12c6a2){logger[_0x5894('0x10')](_0x5894('0x6'),_0x340d5d);logger['debug'](_0x5894('0x6'),_0x340d5d,JSON[_0x5894('0x11')](_0x12c6a2));_0x5cca8a(_0x12c6a2);})['catch'](function(_0x4182c2){logger[_0x5894('0x12')]('GetInterval',_0x4182c2[_0x5894('0x13')],_0x340d5d);_0x714ed1(_0x5eee15[_0x5894('0x12')](0x1f4,_0x4182c2[_0x5894('0x13')]));});});};exports['ShowInterval']=function(_0x50f33b){var _0x44ded4=this;return new Promise(function(_0x3b9e45,_0xc5d981){return db[_0x5894('0x7')][_0x5894('0x14')]({'raw':_0x50f33b[_0x5894('0x9')]?_0x50f33b[_0x5894('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x50f33b['options']?_0x50f33b[_0x5894('0x9')][_0x5894('0xa')]||null:null,'attributes':_0x50f33b[_0x5894('0x9')]?_0x50f33b[_0x5894('0x9')][_0x5894('0xd')]||null:null,'include':_0x50f33b[_0x5894('0x9')]?_0x50f33b[_0x5894('0x9')][_0x5894('0xb')]?_[_0x5894('0xe')](_0x50f33b[_0x5894('0x9')]['include'],function(_0x3beab1){return{'model':db[_0x3beab1[_0x5894('0xc')]],'as':_0x3beab1['as'],'attributes':_0x3beab1[_0x5894('0xd')],'include':_0x3beab1[_0x5894('0xb')]?_[_0x5894('0xe')](_0x3beab1[_0x5894('0xb')],function(_0x5e8c0b){return{'model':db[_0x5e8c0b[_0x5894('0xc')]],'as':_0x5e8c0b['as'],'attributes':_0x5e8c0b[_0x5894('0xd')],'include':_0x5e8c0b[_0x5894('0xb')]?_[_0x5894('0xe')](_0x5e8c0b[_0x5894('0xb')],function(_0xefd41a){return{'model':db[_0xefd41a[_0x5894('0xc')]],'as':_0xefd41a['as'],'attributes':_0xefd41a[_0x5894('0xd')]};}):[]};}):[]};}):[]:[]})[_0x5894('0xf')](function(_0x3d654f){logger['info'](_0x5894('0x15'),_0x50f33b);logger['debug']('ShowInterval',_0x50f33b,JSON['stringify'](_0x3d654f));_0x3b9e45(_0x3d654f);})[_0x5894('0x16')](function(_0x721228){logger['error'](_0x5894('0x15'),_0x721228[_0x5894('0x13')],_0x50f33b);_0xc5d981(_0x44ded4[_0x5894('0x12')](0x1f4,_0x721228[_0x5894('0x13')]));});});};function checkArrayOfIntervals(_0x17bd13,_0x19b60e){var _0x254baf=[];return db['Interval'][_0x5894('0x8')]({'where':{'id':_0x17bd13}})[_0x5894('0xf')](function(_0x1e3f29){_0x254baf=_0x1e3f29;return Promise[_0x5894('0x17')](_0x254baf[_0x5894('0xe')](function(_0x5cd692){return _0x5cd692[_0x5894('0x18')](_0x19b60e);}));})['then'](function(_0x8ae036){var _0x324dad=_0x8ae036['reduce'](function(_0x52563c,_0x4c07a0){return _0x52563c||_0x4c07a0;},![]);logger[_0x5894('0x10')](util[_0x5894('0x19')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x254baf[_0x5894('0xe')](function(_0x5f1499){return _0x5f1499[_0x5894('0x1a')];})[_0x5894('0x1b')](',\x20'),_0x254baf['map'](function(_0x4898ad){return _0x4898ad['id'];})['join'](',\x20')));return _0x324dad;});}function checkSingleInterval(_0xf065f7,_0x1898ea){return db['Interval'][_0x5894('0x1c')](_0xf065f7)['then'](function(_0x280682){if(_0x280682){logger['info'](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x280682[_0x5894('0x1a')],_0x280682['id']));return _0x280682[_0x5894('0x18')](_0x1898ea);}});}exports[_0x5894('0x1d')]=function(_0x25d39a){var _0x466738=_0x25d39a[_0x5894('0x1e')];var _0x5afd7a=Array[_0x5894('0x1f')](_0x25d39a['intervals'])?_0x25d39a[_0x5894('0x20')]:typeof _0x25d39a['intervals']===_0x5894('0x21')?[_0x25d39a[_0x5894('0x20')]]:[];var _0x2cd476=_0x25d39a[_0x5894('0x22')]||undefined;var _0x353b73=![];if(_0x5afd7a['length']){logger[_0x5894('0x10')](util[_0x5894('0x19')](_0x5894('0x23'),_0x5afd7a[_0x5894('0x1b')](';\x20')));}if(_0x2cd476){logger[_0x5894('0x10')](util[_0x5894('0x19')](_0x5894('0x24'),_0x2cd476));}logger['debug'](_0x5894('0x25'),_0x353b73);logger['silly']('IntervalIftime',_0x25d39a);return Promise[_0x5894('0x26')]()[_0x5894('0xf')](function(){if(Array[_0x5894('0x1f')](_0x466738)){return checkArrayOfIntervals(_0x466738,_0x2cd476);}else if(_0x466738){return checkSingleInterval(_0x466738,_0x2cd476);}})[_0x5894('0xf')](function(_0x3d0321){var _0x24d436=_0x5afd7a['reduce'](function(_0x31e136,_0x3d929b){return _0x31e136||iftime(_0x3d929b,_0x2cd476);},![]);_0x353b73=_0x3d0321||_0x24d436;return _0x353b73;})[_0x5894('0x16')](function(_0xccf5ed){logger[_0x5894('0x12')](_0x5894('0x1d'),_0x25d39a,_0xccf5ed);throw this['error'](0x1f4,_0xccf5ed[_0x5894('0x13')]);});}; \ No newline at end of file +var _0xd40e=['reduce','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','options','where','attributes','limit','include','map','model','info','debug','stringify','catch','message','error','ShowInterval','find','raw','then','all','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve'];(function(_0x207061,_0xe38cda){var _0x4a2833=function(_0x16906e){while(--_0x16906e){_0x207061['push'](_0x207061['shift']());}};_0x4a2833(++_0xe38cda);}(_0xd40e,0x10f));var _0xed40=function(_0x506f64,_0x395f5a){_0x506f64=_0x506f64-0x0;var _0x389fdb=_0xd40e[_0x506f64];return _0x389fdb;};'use strict';var _=require(_0xed40('0x0'));var util=require(_0xed40('0x1'));var db=require(_0xed40('0x2'))['db'];var iftime=require(_0xed40('0x3'))[_0xed40('0x4')];var logger=require('../../config/logger')(_0xed40('0x5'));exports[_0xed40('0x6')]=function(_0x4d4599){var _0x193ce7=this;return new Promise(function(_0x44a053,_0x3a7167){return db[_0xed40('0x7')][_0xed40('0x8')]({'raw':_0x4d4599['options']?_0x4d4599['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d4599['options']?_0x4d4599[_0xed40('0x9')][_0xed40('0xa')]||null:null,'attributes':_0x4d4599[_0xed40('0x9')]?_0x4d4599[_0xed40('0x9')][_0xed40('0xb')]||null:null,'limit':_0x4d4599[_0xed40('0x9')]?_0x4d4599[_0xed40('0x9')][_0xed40('0xc')]||null:null,'include':_0x4d4599['options']?_0x4d4599[_0xed40('0x9')][_0xed40('0xd')]?_[_0xed40('0xe')](_0x4d4599[_0xed40('0x9')][_0xed40('0xd')],function(_0x64e3e4){return{'model':db[_0x64e3e4['model']],'as':_0x64e3e4['as'],'attributes':_0x64e3e4['attributes'],'include':_0x64e3e4[_0xed40('0xd')]?_[_0xed40('0xe')](_0x64e3e4['include'],function(_0x5c061a){return{'model':db[_0x5c061a['model']],'as':_0x5c061a['as'],'attributes':_0x5c061a['attributes'],'include':_0x5c061a[_0xed40('0xd')]?_[_0xed40('0xe')](_0x5c061a[_0xed40('0xd')],function(_0x5520a9){return{'model':db[_0x5520a9[_0xed40('0xf')]],'as':_0x5520a9['as'],'attributes':_0x5520a9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4db714){logger[_0xed40('0x10')](_0xed40('0x6'),_0x4d4599);logger[_0xed40('0x11')]('GetInterval',_0x4d4599,JSON[_0xed40('0x12')](_0x4db714));_0x44a053(_0x4db714);})[_0xed40('0x13')](function(_0x34e37a){logger['error'](_0xed40('0x6'),_0x34e37a[_0xed40('0x14')],_0x4d4599);_0x3a7167(_0x193ce7[_0xed40('0x15')](0x1f4,_0x34e37a['message']));});});};exports[_0xed40('0x16')]=function(_0xcc1dbb){var _0xbf4c0e=this;return new Promise(function(_0x44485e,_0x5d0a07){return db['Interval'][_0xed40('0x17')]({'raw':_0xcc1dbb[_0xed40('0x9')]?_0xcc1dbb[_0xed40('0x9')][_0xed40('0x18')]===undefined?!![]:![]:!![],'where':_0xcc1dbb[_0xed40('0x9')]?_0xcc1dbb[_0xed40('0x9')][_0xed40('0xa')]||null:null,'attributes':_0xcc1dbb[_0xed40('0x9')]?_0xcc1dbb['options']['attributes']||null:null,'include':_0xcc1dbb['options']?_0xcc1dbb[_0xed40('0x9')][_0xed40('0xd')]?_[_0xed40('0xe')](_0xcc1dbb['options']['include'],function(_0x40cdca){return{'model':db[_0x40cdca['model']],'as':_0x40cdca['as'],'attributes':_0x40cdca[_0xed40('0xb')],'include':_0x40cdca[_0xed40('0xd')]?_['map'](_0x40cdca[_0xed40('0xd')],function(_0x2ee7a8){return{'model':db[_0x2ee7a8[_0xed40('0xf')]],'as':_0x2ee7a8['as'],'attributes':_0x2ee7a8[_0xed40('0xb')],'include':_0x2ee7a8[_0xed40('0xd')]?_[_0xed40('0xe')](_0x2ee7a8[_0xed40('0xd')],function(_0x4a7a35){return{'model':db[_0x4a7a35[_0xed40('0xf')]],'as':_0x4a7a35['as'],'attributes':_0x4a7a35[_0xed40('0xb')]};}):[]};}):[]};}):[]:[]})[_0xed40('0x19')](function(_0x2edf08){logger[_0xed40('0x10')](_0xed40('0x16'),_0xcc1dbb);logger[_0xed40('0x11')](_0xed40('0x16'),_0xcc1dbb,JSON[_0xed40('0x12')](_0x2edf08));_0x44485e(_0x2edf08);})[_0xed40('0x13')](function(_0x2df297){logger['error'](_0xed40('0x16'),_0x2df297['message'],_0xcc1dbb);_0x5d0a07(_0xbf4c0e[_0xed40('0x15')](0x1f4,_0x2df297[_0xed40('0x14')]));});});};function checkArrayOfIntervals(_0x5313e6,_0x5727c5){var _0x282a38=[];return db[_0xed40('0x7')][_0xed40('0x8')]({'where':{'id':_0x5313e6}})[_0xed40('0x19')](function(_0x41598e){_0x282a38=_0x41598e;return Promise[_0xed40('0x1a')](_0x282a38[_0xed40('0xe')](function(_0x58d9a1){return _0x58d9a1['ifTime'](_0x5727c5);}));})[_0xed40('0x19')](function(_0x554bd8){var _0x27046f=_0x554bd8['reduce'](function(_0x2c1817,_0x4f0786){return _0x2c1817||_0x4f0786;},![]);logger[_0xed40('0x10')](util[_0xed40('0x1b')](_0xed40('0x1c'),_0x282a38['map'](function(_0x495014){return _0x495014['name'];})[_0xed40('0x1d')](',\x20'),_0x282a38['map'](function(_0x3eeedc){return _0x3eeedc['id'];})[_0xed40('0x1d')](',\x20')));return _0x27046f;});}function checkSingleInterval(_0x3d31dd,_0x3f49c0){return db[_0xed40('0x7')][_0xed40('0x1e')](_0x3d31dd)[_0xed40('0x19')](function(_0x3903a3){if(_0x3903a3){logger[_0xed40('0x10')](util[_0xed40('0x1b')](_0xed40('0x1f'),_0x3903a3['name'],_0x3903a3['id']));return _0x3903a3[_0xed40('0x20')](_0x3f49c0);}});}exports[_0xed40('0x21')]=function(_0xea1a6e){var _0x54ee88=_0xea1a6e[_0xed40('0x22')];var _0x319b67=Array[_0xed40('0x23')](_0xea1a6e[_0xed40('0x24')])?_0xea1a6e[_0xed40('0x24')]:typeof _0xea1a6e['intervals']===_0xed40('0x25')?[_0xea1a6e[_0xed40('0x24')]]:[];var _0xca03c1=_0xea1a6e[_0xed40('0x26')]||undefined;var _0x1ffeda=![];if(_0x319b67['length']){logger['info'](util[_0xed40('0x1b')](_0xed40('0x27'),_0x319b67[_0xed40('0x1d')](';\x20')));}if(_0xca03c1){logger[_0xed40('0x10')](util['format'](_0xed40('0x28'),_0xca03c1));}logger['debug'](_0xed40('0x29'),_0x1ffeda);logger[_0xed40('0x2a')]('IntervalIftime',_0xea1a6e);return Promise[_0xed40('0x2b')]()[_0xed40('0x19')](function(){if(Array[_0xed40('0x23')](_0x54ee88)){return checkArrayOfIntervals(_0x54ee88,_0xca03c1);}else if(_0x54ee88){return checkSingleInterval(_0x54ee88,_0xca03c1);}})[_0xed40('0x19')](function(_0x4a1aa8){var _0x550156=_0x319b67[_0xed40('0x2c')](function(_0x5ef480,_0x394112){return _0x5ef480||iftime(_0x394112,_0xca03c1);},![]);_0x1ffeda=_0x4a1aa8||_0x550156;return _0x1ffeda;})[_0xed40('0x13')](function(_0x3c6172){logger[_0xed40('0x15')](_0xed40('0x21'),_0xea1a6e,_0x3c6172);throw this[_0xed40('0x15')](0x1f4,_0x3c6172[_0xed40('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index b7d1edc..3495036 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0xca4094,_0x11ca4c){var _0x5bc223=function(_0x4131da){while(--_0x4131da){_0xca4094['push'](_0xca4094['shift']());}};_0x5bc223(++_0x11ca4c);}(_0xadb5,0xad));var _0x5adb=function(_0x17a1e4,_0x59cbe4){_0x17a1e4=_0x17a1e4-0x0;var _0x2f26f6=_0xadb5[_0x17a1e4];return _0x2f26f6;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xb10b,0x12a));var _0xbb10=function(_0x56b083,_0x29476f){_0x56b083=_0x56b083-0x0;var _0x1b01e6=_0xb10b[_0x56b083];return _0x1b01e6;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index d6c6b70..01c635e 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 _0xd12d=['socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','customfield_11503','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','body','headers','x-forwarded-for','connection','remoteAddress'];(function(_0xbfb71b,_0x121bc2){var _0x12d390=function(_0x104c81){while(--_0x104c81){_0xbfb71b['push'](_0xbfb71b['shift']());}};_0x12d390(++_0x121bc2);}(_0xd12d,0x88));var _0xdd12=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd12d[_0x465a0c];return _0x1e202e;};'use strict';var BPromise=require(_0xdd12('0x0'));var https=require(_0xdd12('0x1'));var logger=require(_0xdd12('0x2'))(_0xdd12('0x3'));var USERNAME=_0xdd12('0x4');var PASSWORD=_0xdd12('0x5');function openIssue(_0x3f6e7f,_0x4a0042){var _0x545f7d={'fields':{'project':{'key':_0x3f6e7f['key']||_0xdd12('0x6')},'summary':(_0x3f6e7f[_0xdd12('0x7')]||_0xdd12('0x8'))+'\x20from\x20'+_0x3f6e7f['ip'],'description':_0x3f6e7f[_0xdd12('0x9')]||JSON[_0xdd12('0xa')](_0x3f6e7f),'issuetype':{'name':_0x3f6e7f[_0xdd12('0xb')]||_0xdd12('0xc')}}};_0x545f7d[_0xdd12('0xd')][_0xdd12('0xe')]=_0x3f6e7f[_0xdd12('0xf')];_0x545f7d[_0xdd12('0xd')]['customfield_11501']=_0x3f6e7f[_0xdd12('0x10')];_0x545f7d[_0xdd12('0xd')][_0xdd12('0x11')]=_0x3f6e7f['newToken'];_0x545f7d['fields'][_0xdd12('0x12')]=_0x3f6e7f['name'];_0x545f7d['fields'][_0xdd12('0x13')]=_0x3f6e7f[_0xdd12('0x14')];_0x545f7d[_0xdd12('0xd')]['customfield_10102']=_0x3f6e7f['ip'];var _0x343c12={'host':_0xdd12('0x15'),'port':0x1bb,'path':_0xdd12('0x16'),'method':_0xdd12('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xdd12('0x18'),'Authorization':_0xdd12('0x19')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xdd12('0x1a'))}};var _0x4e2b9b=JSON[_0xdd12('0xa')](_0x545f7d);var _0x284a8f=https[_0xdd12('0x1b')](_0x343c12,function(_0x297fe8){_0x297fe8[_0xdd12('0x1c')]('utf8');var _0x12d53e='';_0x297fe8['on'](_0xdd12('0x1d'),function(_0x1a5108){_0x12d53e+=_0x1a5108;});_0x297fe8['on'](_0xdd12('0x1e'),function(){if(_0x4a0042){return _0x4a0042[_0xdd12('0x1f')](_0x297fe8[_0xdd12('0x20')])['json'](JSON[_0xdd12('0x21')](_0x12d53e));}});});_0x284a8f['on'](_0xdd12('0x22'),function(_0x349d21){if(_0x4a0042){return _0x4a0042[_0xdd12('0x1f')](0x1f4)[_0xdd12('0x23')]({'errors':[{'message':_0xdd12('0x24'),'type':_0xdd12('0x25')}]});}});_0x284a8f[_0xdd12('0x26')](_0x4e2b9b);_0x284a8f[_0xdd12('0x1e')]();}exports['openIssue']=openIssue;exports['send']=function(_0x4ebc95,_0x1ef36e){_0x4ebc95[_0xdd12('0x27')]['ip']=_0x4ebc95[_0xdd12('0x28')][_0xdd12('0x29')]||_0x4ebc95[_0xdd12('0x2a')][_0xdd12('0x2b')]||_0x4ebc95['socket'][_0xdd12('0x2b')]||_0x4ebc95[_0xdd12('0x2a')][_0xdd12('0x2c')]['remoteAddress'];return openIssue(_0x4ebc95['body'],_0x1ef36e);}; \ No newline at end of file +var _0x174b=['stringify','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','toString','base64','setEncoding','data','status','json','error','api.jira','write','end','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description'];(function(_0x22d37d,_0x21ea9b){var _0x565483=function(_0x5af52f){while(--_0x5af52f){_0x22d37d['push'](_0x22d37d['shift']());}};_0x565483(++_0x21ea9b);}(_0x174b,0x129));var _0xb174=function(_0x30383d,_0x471372){_0x30383d=_0x30383d-0x0;var _0x2b2a94=_0x174b[_0x30383d];return _0x2b2a94;};'use strict';var BPromise=require(_0xb174('0x0'));var https=require(_0xb174('0x1'));var logger=require(_0xb174('0x2'))('api');var USERNAME=_0xb174('0x3');var PASSWORD=_0xb174('0x4');function openIssue(_0x4f4bbe,_0x1d22db){var _0x2a7258={'fields':{'project':{'key':_0x4f4bbe[_0xb174('0x5')]||_0xb174('0x6')},'summary':(_0x4f4bbe[_0xb174('0x7')]||_0xb174('0x8'))+_0xb174('0x9')+_0x4f4bbe['ip'],'description':_0x4f4bbe[_0xb174('0xa')]||JSON[_0xb174('0xb')](_0x4f4bbe),'issuetype':{'name':_0x4f4bbe[_0xb174('0xc')]||_0xb174('0xd')}}};_0x2a7258[_0xb174('0xe')][_0xb174('0xf')]=_0x4f4bbe[_0xb174('0x10')];_0x2a7258[_0xb174('0xe')]['customfield_11501']=_0x4f4bbe[_0xb174('0x11')];_0x2a7258['fields'][_0xb174('0x12')]=_0x4f4bbe[_0xb174('0x13')];_0x2a7258[_0xb174('0xe')][_0xb174('0x14')]=_0x4f4bbe[_0xb174('0x15')];_0x2a7258[_0xb174('0xe')][_0xb174('0x16')]=_0x4f4bbe[_0xb174('0x17')];_0x2a7258[_0xb174('0xe')][_0xb174('0x18')]=_0x4f4bbe['ip'];var _0x10412c={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xb174('0x19'),'method':_0xb174('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':_0xb174('0x1b'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xb174('0x1c')](_0xb174('0x1d'))}};var _0x865290=JSON[_0xb174('0xb')](_0x2a7258);var _0x45ee8a=https['request'](_0x10412c,function(_0x2b3aa3){_0x2b3aa3[_0xb174('0x1e')]('utf8');var _0x5c573e='';_0x2b3aa3['on'](_0xb174('0x1f'),function(_0x394a53){_0x5c573e+=_0x394a53;});_0x2b3aa3['on']('end',function(){if(_0x1d22db){return _0x1d22db[_0xb174('0x20')](_0x2b3aa3['statusCode'])[_0xb174('0x21')](JSON['parse'](_0x5c573e));}});});_0x45ee8a['on'](_0xb174('0x22'),function(_0x47f03d){if(_0x1d22db){return _0x1d22db[_0xb174('0x20')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xb174('0x23')}]});}});_0x45ee8a[_0xb174('0x24')](_0x865290);_0x45ee8a[_0xb174('0x25')]();}exports['openIssue']=openIssue;exports['send']=function(_0x3bda6b,_0x4386e6){_0x3bda6b[_0xb174('0x26')]['ip']=_0x3bda6b[_0xb174('0x27')][_0xb174('0x28')]||_0x3bda6b[_0xb174('0x29')]['remoteAddress']||_0x3bda6b[_0xb174('0x2a')][_0xb174('0x2b')]||_0x3bda6b[_0xb174('0x29')]['socket'][_0xb174('0x2b')];return openIssue(_0x3bda6b['body'],_0x4386e6);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index f9e3436..42926f2 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','show'];(function(_0x2e2b3b,_0x2f426a){var _0x97cf13=function(_0x236038){while(--_0x236038){_0x2e2b3b['push'](_0x2e2b3b['shift']());}};_0x97cf13(++_0x2f426a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xf9b3ad,_0x2a4436){_0xf9b3ad=_0xf9b3ad-0x0;var _0x3b2b0e=_0x6f0d[_0xf9b3ad];return _0x3b2b0e;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')]('/',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);router['put'](_0xd6f0('0x10'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x11')]);router[_0xd6f0('0x12')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x13')]);module[_0xd6f0('0x14')]=router; \ No newline at end of file +var _0x55e0=['./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4d9e96,_0x2957d5){var _0x5385a8=function(_0x265b8e){while(--_0x265b8e){_0x4d9e96['push'](_0x4d9e96['shift']());}};_0x5385a8(++_0x2957d5);}(_0x55e0,0xdc));var _0x055e=function(_0x1b9d5d,_0x2cc276){_0x1b9d5d=_0x1b9d5d-0x0;var _0x43caa9=_0x55e0[_0x1b9d5d];return _0x43caa9;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/describe',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['show']);router[_0x055e('0xd')]('/',auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xf')](_0x055e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x055e('0x10')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0x11')]);module[_0x055e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 8f5c2cb..f621587 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x561286,_0x28cc33){_0x561286=_0x561286-0x0;var _0x12c31d=_0x7a54[_0x561286];return _0x12c31d;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x4af5bd,_0x65944){_0x4af5bd=_0x4af5bd-0x0;var _0x1dae5d=_0x7a54[_0x4af5bd];return _0x1dae5d;};'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 15a6ff0..edad770 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7278=['stack','name','send','JscriptyAnswerReport','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','length','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x7278,0x161));var _0x8727=function(_0x43e347,_0x442b0f){_0x43e347=_0x43e347-0x0;var _0x92c64a=_0x7278[_0x43e347];return _0x92c64a;};'use strict';var emlformat=require(_0x8727('0x0'));var rimraf=require(_0x8727('0x1'));var zipdir=require(_0x8727('0x2'));var jsonpatch=require(_0x8727('0x3'));var rp=require(_0x8727('0x4'));var moment=require('moment');var BPromise=require(_0x8727('0x5'));var Mustache=require(_0x8727('0x6'));var util=require(_0x8727('0x7'));var path=require(_0x8727('0x8'));var sox=require(_0x8727('0x9'));var csv=require(_0x8727('0xa'));var ejs=require(_0x8727('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8727('0xc'));var squel=require(_0x8727('0xd'));var crypto=require(_0x8727('0xe'));var jsforce=require(_0x8727('0xf'));var deskjs=require(_0x8727('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8727('0x11'));var authService=require(_0x8727('0x12'));var qs=require(_0x8727('0x13'));var as=require(_0x8727('0x14'));var hardwareService=require(_0x8727('0x15'));var logger=require(_0x8727('0x16'))(_0x8727('0x17'));var utils=require(_0x8727('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8727('0x19'));var db=require(_0x8727('0x1a'))['db'];function respondWithStatusCode(_0x176389,_0x518e56){_0x518e56=_0x518e56||0xcc;return function(_0x22d03d){if(_0x22d03d){return _0x176389[_0x8727('0x1b')](_0x518e56);}return _0x176389['status'](_0x518e56)[_0x8727('0x1c')]();};}function respondWithResult(_0x3aa1b,_0x47c29d){_0x47c29d=_0x47c29d||0xc8;return function(_0x2185e5){if(_0x2185e5){return _0x3aa1b[_0x8727('0x1d')](_0x47c29d)[_0x8727('0x1e')](_0x2185e5);}};}function respondWithFilteredResult(_0x3865e9,_0x1916f7){return function(_0x11c828){if(_0x11c828){var _0x88857c=typeof _0x1916f7['offset']===_0x8727('0x1f')&&typeof _0x1916f7[_0x8727('0x20')]===_0x8727('0x1f');var _0x2f6e1d=_0x11c828[_0x8727('0x21')];var _0xba0af5=_0x88857c?0x0:_0x1916f7['offset'];var _0x575d29=_0x88857c?_0x11c828[_0x8727('0x21')]:_0x1916f7['offset']+_0x1916f7[_0x8727('0x20')];var _0xfd266f;if(_0x575d29>=_0x2f6e1d){_0x575d29=_0x2f6e1d;_0xfd266f=0xc8;}else{_0xfd266f=0xce;}_0x3865e9[_0x8727('0x1d')](_0xfd266f);return _0x3865e9[_0x8727('0x22')](_0x8727('0x23'),_0xba0af5+'-'+_0x575d29+'/'+_0x2f6e1d)['json'](_0x11c828);}return null;};}function patchUpdates(_0x6e552f){return function(_0x286856){try{jsonpatch[_0x8727('0x24')](_0x286856,_0x6e552f,!![]);}catch(_0x1d78df){return BPromise[_0x8727('0x25')](_0x1d78df);}return _0x286856[_0x8727('0x26')]();};}function saveUpdates(_0x46d43e,_0x441cc0){return function(_0x117f58){if(_0x117f58){return _0x117f58[_0x8727('0x27')](_0x46d43e)[_0x8727('0x28')](function(_0x1a69d5){return _0x1a69d5;});}return null;};}function removeEntity(_0x4c699b,_0x464a32){return function(_0x3d3592){if(_0x3d3592){return _0x3d3592['destroy']()['then'](function(){_0x4c699b[_0x8727('0x1d')](0xcc)[_0x8727('0x1c')]();});}};}function handleEntityNotFound(_0x15e8bf,_0x5de6fa){return function(_0x98261b){if(!_0x98261b){_0x15e8bf[_0x8727('0x1b')](0x194);}return _0x98261b;};}function handleError(_0x267008,_0x440ff5){_0x440ff5=_0x440ff5||0x1f4;return function(_0x2c8cd5){logger[_0x8727('0x29')](_0x2c8cd5[_0x8727('0x2a')]);if(_0x2c8cd5[_0x8727('0x2b')]){delete _0x2c8cd5['name'];}_0x267008[_0x8727('0x1d')](_0x440ff5)[_0x8727('0x2c')](_0x2c8cd5);};}exports['index']=function(_0x23325f,_0x163989){var _0x3ecd6a={},_0x228ca9={},_0x416da8={'count':0x0,'rows':[]};var _0x1e21b9=_['map'](db[_0x8727('0x2d')]['rawAttributes'],function(_0x34c58e){return{'name':_0x34c58e['fieldName'],'type':_0x34c58e[_0x8727('0x2e')][_0x8727('0x2f')]};});_0x228ca9[_0x8727('0x30')]=_[_0x8727('0x31')](_0x1e21b9,_0x8727('0x2b'));_0x228ca9[_0x8727('0x32')]=_[_0x8727('0x33')](_0x23325f['query']);_0x228ca9[_0x8727('0x34')]=_[_0x8727('0x35')](_0x228ca9[_0x8727('0x30')],_0x228ca9[_0x8727('0x32')]);_0x3ecd6a[_0x8727('0x36')]=_[_0x8727('0x35')](_0x228ca9[_0x8727('0x30')],qs[_0x8727('0x37')](_0x23325f[_0x8727('0x32')][_0x8727('0x37')]));_0x3ecd6a[_0x8727('0x36')]=_0x3ecd6a[_0x8727('0x36')]['length']?_0x3ecd6a['attributes']:_0x228ca9[_0x8727('0x30')];if(!_0x23325f[_0x8727('0x32')][_0x8727('0x38')](_0x8727('0x39'))){_0x3ecd6a['limit']=qs[_0x8727('0x20')](_0x23325f[_0x8727('0x32')][_0x8727('0x20')]);_0x3ecd6a[_0x8727('0x3a')]=qs[_0x8727('0x3a')](_0x23325f['query'][_0x8727('0x3a')]);}_0x3ecd6a[_0x8727('0x3b')]=qs[_0x8727('0x3c')](_0x23325f[_0x8727('0x32')][_0x8727('0x3c')]);_0x3ecd6a[_0x8727('0x3d')]=qs[_0x8727('0x34')](_[_0x8727('0x3e')](_0x23325f[_0x8727('0x32')],_0x228ca9[_0x8727('0x34')]),_0x1e21b9);if(_0x23325f[_0x8727('0x32')][_0x8727('0x3f')]){_0x3ecd6a['where']=_[_0x8727('0x40')](_0x3ecd6a[_0x8727('0x3d')],{'$or':_[_0x8727('0x31')](_0x1e21b9,function(_0x403d90){if(_0x403d90[_0x8727('0x2e')]!==_0x8727('0x41')){var _0x308035={};_0x308035[_0x403d90[_0x8727('0x2b')]]={'$like':'%'+_0x23325f[_0x8727('0x32')][_0x8727('0x3f')]+'%'};return _0x308035;}})});}_0x3ecd6a=_[_0x8727('0x40')]({},_0x3ecd6a,_0x23325f[_0x8727('0x42')]);var _0x2a1063={'where':_0x3ecd6a[_0x8727('0x3d')]};return db['JscriptyAnswerReport'][_0x8727('0x21')](_0x2a1063)[_0x8727('0x28')](function(_0x19d08a){_0x416da8['count']=_0x19d08a;if(_0x23325f[_0x8727('0x32')][_0x8727('0x43')]){_0x3ecd6a[_0x8727('0x44')]=[{'all':!![]}];}return db[_0x8727('0x2d')]['findAll'](_0x3ecd6a);})[_0x8727('0x28')](function(_0x37e87c){_0x416da8[_0x8727('0x45')]=_0x37e87c;return _0x416da8;})[_0x8727('0x28')](respondWithFilteredResult(_0x163989,_0x3ecd6a))[_0x8727('0x46')](handleError(_0x163989,null));};exports[_0x8727('0x47')]=function(_0x2fe40d,_0x15b764){var _0x3aac97={'raw':!![],'where':{'id':_0x2fe40d['params']['id']}},_0x2b5ba7={};_0x2b5ba7[_0x8727('0x30')]=_[_0x8727('0x33')](db[_0x8727('0x2d')][_0x8727('0x48')]);_0x2b5ba7[_0x8727('0x32')]=_['keys'](_0x2fe40d[_0x8727('0x32')]);_0x2b5ba7[_0x8727('0x34')]=_[_0x8727('0x35')](_0x2b5ba7['model'],_0x2b5ba7[_0x8727('0x32')]);_0x3aac97[_0x8727('0x36')]=_[_0x8727('0x35')](_0x2b5ba7[_0x8727('0x30')],qs[_0x8727('0x37')](_0x2fe40d[_0x8727('0x32')]['fields']));_0x3aac97[_0x8727('0x36')]=_0x3aac97[_0x8727('0x36')][_0x8727('0x49')]?_0x3aac97['attributes']:_0x2b5ba7[_0x8727('0x30')];if(_0x2fe40d[_0x8727('0x32')][_0x8727('0x43')]){_0x3aac97[_0x8727('0x44')]=[{'all':!![]}];}_0x3aac97=_[_0x8727('0x40')]({},_0x3aac97,_0x2fe40d[_0x8727('0x42')]);return db[_0x8727('0x2d')]['find'](_0x3aac97)[_0x8727('0x28')](handleEntityNotFound(_0x15b764,null))[_0x8727('0x28')](respondWithResult(_0x15b764,null))[_0x8727('0x46')](handleError(_0x15b764,null));};exports[_0x8727('0x4a')]=function(_0x152de6,_0x426727){return db[_0x8727('0x2d')]['create'](_0x152de6[_0x8727('0x4b')],{})[_0x8727('0x28')](respondWithResult(_0x426727,0xc9))[_0x8727('0x46')](handleError(_0x426727,null));};exports['update']=function(_0x30e656,_0x22cd31){if(_0x30e656[_0x8727('0x4b')]['id']){delete _0x30e656[_0x8727('0x4b')]['id'];}return db[_0x8727('0x2d')][_0x8727('0x4c')]({'where':{'id':_0x30e656[_0x8727('0x4d')]['id']}})['then'](handleEntityNotFound(_0x22cd31,null))[_0x8727('0x28')](saveUpdates(_0x30e656['body'],null))[_0x8727('0x28')](respondWithResult(_0x22cd31,null))[_0x8727('0x46')](handleError(_0x22cd31,null));};exports['destroy']=function(_0x133973,_0x3bb732){return db[_0x8727('0x2d')]['find']({'where':{'id':_0x133973['params']['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x3bb732,null))[_0x8727('0x28')](removeEntity(_0x3bb732,null))[_0x8727('0x46')](handleError(_0x3bb732,null));};exports['describe']=function(_0x102daf,_0x3945c4){return db[_0x8727('0x2d')][_0x8727('0x4e')]()[_0x8727('0x28')](respondWithResult(_0x3945c4,null))[_0x8727('0x46')](handleError(_0x3945c4,null));}; \ No newline at end of file +var _0x7e02=['destroy','end','error','stack','name','map','JscriptyAnswerReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','apply','then'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x7e02,0x71));var _0x27e0=function(_0x4a015f,_0x2820e3){_0x4a015f=_0x4a015f-0x0;var _0x40ce6c=_0x7e02[_0x4a015f];return _0x40ce6c;};'use strict';var emlformat=require(_0x27e0('0x0'));var rimraf=require(_0x27e0('0x1'));var zipdir=require(_0x27e0('0x2'));var jsonpatch=require(_0x27e0('0x3'));var rp=require(_0x27e0('0x4'));var moment=require(_0x27e0('0x5'));var BPromise=require(_0x27e0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x27e0('0x7'));var sox=require('sox');var csv=require(_0x27e0('0x8'));var ejs=require(_0x27e0('0x9'));var fs=require('fs');var fs_extra=require(_0x27e0('0xa'));var _=require(_0x27e0('0xb'));var squel=require(_0x27e0('0xc'));var crypto=require(_0x27e0('0xd'));var jsforce=require(_0x27e0('0xe'));var deskjs=require(_0x27e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27e0('0x10'));var Papa=require('papaparse');var Redis=require(_0x27e0('0x11'));var authService=require(_0x27e0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x27e0('0x13'));var hardwareService=require(_0x27e0('0x14'));var logger=require(_0x27e0('0x15'))(_0x27e0('0x16'));var utils=require(_0x27e0('0x17'));var config=require(_0x27e0('0x18'));var licenseUtil=require(_0x27e0('0x19'));var db=require(_0x27e0('0x1a'))['db'];function respondWithStatusCode(_0x31ef33,_0x492c65){_0x492c65=_0x492c65||0xcc;return function(_0x156bea){if(_0x156bea){return _0x31ef33[_0x27e0('0x1b')](_0x492c65);}return _0x31ef33[_0x27e0('0x1c')](_0x492c65)['end']();};}function respondWithResult(_0x39fb61,_0x3a67ab){_0x3a67ab=_0x3a67ab||0xc8;return function(_0x473128){if(_0x473128){return _0x39fb61['status'](_0x3a67ab)[_0x27e0('0x1d')](_0x473128);}};}function respondWithFilteredResult(_0x220128,_0x1f7532){return function(_0xf326e2){if(_0xf326e2){var _0x5b1b6e=typeof _0x1f7532['offset']===_0x27e0('0x1e')&&typeof _0x1f7532[_0x27e0('0x1f')]===_0x27e0('0x1e');var _0x2111e=_0xf326e2['count'];var _0x32597b=_0x5b1b6e?0x0:_0x1f7532[_0x27e0('0x20')];var _0x12a91f=_0x5b1b6e?_0xf326e2[_0x27e0('0x21')]:_0x1f7532[_0x27e0('0x20')]+_0x1f7532[_0x27e0('0x1f')];var _0x4d9edc;if(_0x12a91f>=_0x2111e){_0x12a91f=_0x2111e;_0x4d9edc=0xc8;}else{_0x4d9edc=0xce;}_0x220128[_0x27e0('0x1c')](_0x4d9edc);return _0x220128[_0x27e0('0x22')]('Content-Range',_0x32597b+'-'+_0x12a91f+'/'+_0x2111e)[_0x27e0('0x1d')](_0xf326e2);}return null;};}function patchUpdates(_0x23df66){return function(_0x32c2ff){try{jsonpatch[_0x27e0('0x23')](_0x32c2ff,_0x23df66,!![]);}catch(_0x408d95){return BPromise['reject'](_0x408d95);}return _0x32c2ff['save']();};}function saveUpdates(_0x57897e,_0x1ef3aa){return function(_0x11f4ca){if(_0x11f4ca){return _0x11f4ca['update'](_0x57897e)[_0x27e0('0x24')](function(_0xee6318){return _0xee6318;});}return null;};}function removeEntity(_0x32503e,_0x6f83ee){return function(_0xd857c2){if(_0xd857c2){return _0xd857c2[_0x27e0('0x25')]()[_0x27e0('0x24')](function(){_0x32503e[_0x27e0('0x1c')](0xcc)[_0x27e0('0x26')]();});}};}function handleEntityNotFound(_0x3068c4,_0x1e5060){return function(_0x27dc43){if(!_0x27dc43){_0x3068c4[_0x27e0('0x1b')](0x194);}return _0x27dc43;};}function handleError(_0x3d4691,_0xab503d){_0xab503d=_0xab503d||0x1f4;return function(_0x581ec9){logger[_0x27e0('0x27')](_0x581ec9[_0x27e0('0x28')]);if(_0x581ec9[_0x27e0('0x29')]){delete _0x581ec9[_0x27e0('0x29')];}_0x3d4691[_0x27e0('0x1c')](_0xab503d)['send'](_0x581ec9);};}exports['index']=function(_0x29114d,_0x3e2c4b){var _0x141c40={},_0x304fe6={},_0x57bcc1={'count':0x0,'rows':[]};var _0x4f5ea2=_[_0x27e0('0x2a')](db[_0x27e0('0x2b')]['rawAttributes'],function(_0x55d752){return{'name':_0x55d752['fieldName'],'type':_0x55d752[_0x27e0('0x2c')][_0x27e0('0x2d')]};});_0x304fe6[_0x27e0('0x2e')]=_[_0x27e0('0x2a')](_0x4f5ea2,'name');_0x304fe6[_0x27e0('0x2f')]=_[_0x27e0('0x30')](_0x29114d[_0x27e0('0x2f')]);_0x304fe6[_0x27e0('0x31')]=_[_0x27e0('0x32')](_0x304fe6[_0x27e0('0x2e')],_0x304fe6[_0x27e0('0x2f')]);_0x141c40[_0x27e0('0x33')]=_[_0x27e0('0x32')](_0x304fe6[_0x27e0('0x2e')],qs['fields'](_0x29114d[_0x27e0('0x2f')][_0x27e0('0x34')]));_0x141c40['attributes']=_0x141c40['attributes'][_0x27e0('0x35')]?_0x141c40[_0x27e0('0x33')]:_0x304fe6[_0x27e0('0x2e')];if(!_0x29114d['query'][_0x27e0('0x36')](_0x27e0('0x37'))){_0x141c40['limit']=qs[_0x27e0('0x1f')](_0x29114d[_0x27e0('0x2f')]['limit']);_0x141c40[_0x27e0('0x20')]=qs[_0x27e0('0x20')](_0x29114d['query'][_0x27e0('0x20')]);}_0x141c40[_0x27e0('0x38')]=qs['sort'](_0x29114d['query'][_0x27e0('0x39')]);_0x141c40[_0x27e0('0x3a')]=qs[_0x27e0('0x31')](_[_0x27e0('0x3b')](_0x29114d['query'],_0x304fe6[_0x27e0('0x31')]),_0x4f5ea2);if(_0x29114d['query'][_0x27e0('0x3c')]){_0x141c40[_0x27e0('0x3a')]=_[_0x27e0('0x3d')](_0x141c40['where'],{'$or':_[_0x27e0('0x2a')](_0x4f5ea2,function(_0x213540){if(_0x213540['type']!=='VIRTUAL'){var _0x2763ec={};_0x2763ec[_0x213540[_0x27e0('0x29')]]={'$like':'%'+_0x29114d[_0x27e0('0x2f')][_0x27e0('0x3c')]+'%'};return _0x2763ec;}})});}_0x141c40=_['merge']({},_0x141c40,_0x29114d['options']);var _0x5f5b65={'where':_0x141c40[_0x27e0('0x3a')]};return db[_0x27e0('0x2b')]['count'](_0x5f5b65)['then'](function(_0x4a6856){_0x57bcc1[_0x27e0('0x21')]=_0x4a6856;if(_0x29114d[_0x27e0('0x2f')][_0x27e0('0x3e')]){_0x141c40[_0x27e0('0x3f')]=[{'all':!![]}];}return db[_0x27e0('0x2b')][_0x27e0('0x40')](_0x141c40);})[_0x27e0('0x24')](function(_0x3f81ba){_0x57bcc1[_0x27e0('0x41')]=_0x3f81ba;return _0x57bcc1;})[_0x27e0('0x24')](respondWithFilteredResult(_0x3e2c4b,_0x141c40))[_0x27e0('0x42')](handleError(_0x3e2c4b,null));};exports[_0x27e0('0x43')]=function(_0x4227c0,_0x6c37db){var _0x2f6005={'raw':!![],'where':{'id':_0x4227c0['params']['id']}},_0x535260={};_0x535260[_0x27e0('0x2e')]=_[_0x27e0('0x30')](db['JscriptyAnswerReport']['rawAttributes']);_0x535260['query']=_[_0x27e0('0x30')](_0x4227c0[_0x27e0('0x2f')]);_0x535260['filters']=_['intersection'](_0x535260[_0x27e0('0x2e')],_0x535260[_0x27e0('0x2f')]);_0x2f6005[_0x27e0('0x33')]=_[_0x27e0('0x32')](_0x535260[_0x27e0('0x2e')],qs[_0x27e0('0x34')](_0x4227c0[_0x27e0('0x2f')][_0x27e0('0x34')]));_0x2f6005[_0x27e0('0x33')]=_0x2f6005[_0x27e0('0x33')][_0x27e0('0x35')]?_0x2f6005[_0x27e0('0x33')]:_0x535260[_0x27e0('0x2e')];if(_0x4227c0[_0x27e0('0x2f')][_0x27e0('0x3e')]){_0x2f6005[_0x27e0('0x3f')]=[{'all':!![]}];}_0x2f6005=_[_0x27e0('0x3d')]({},_0x2f6005,_0x4227c0[_0x27e0('0x44')]);return db[_0x27e0('0x2b')][_0x27e0('0x45')](_0x2f6005)[_0x27e0('0x24')](handleEntityNotFound(_0x6c37db,null))[_0x27e0('0x24')](respondWithResult(_0x6c37db,null))[_0x27e0('0x42')](handleError(_0x6c37db,null));};exports[_0x27e0('0x46')]=function(_0x24058f,_0x22cd05){return db[_0x27e0('0x2b')][_0x27e0('0x46')](_0x24058f['body'],{})['then'](respondWithResult(_0x22cd05,0xc9))[_0x27e0('0x42')](handleError(_0x22cd05,null));};exports[_0x27e0('0x47')]=function(_0x5322c9,_0x58aef9){if(_0x5322c9[_0x27e0('0x48')]['id']){delete _0x5322c9[_0x27e0('0x48')]['id'];}return db[_0x27e0('0x2b')][_0x27e0('0x45')]({'where':{'id':_0x5322c9[_0x27e0('0x49')]['id']}})[_0x27e0('0x24')](handleEntityNotFound(_0x58aef9,null))[_0x27e0('0x24')](saveUpdates(_0x5322c9['body'],null))['then'](respondWithResult(_0x58aef9,null))[_0x27e0('0x42')](handleError(_0x58aef9,null));};exports[_0x27e0('0x25')]=function(_0xca08c,_0x29241d){return db[_0x27e0('0x2b')][_0x27e0('0x45')]({'where':{'id':_0xca08c['params']['id']}})['then'](handleEntityNotFound(_0x29241d,null))[_0x27e0('0x24')](removeEntity(_0x29241d,null))[_0x27e0('0x42')](handleError(_0x29241d,null));};exports[_0x27e0('0x4a')]=function(_0x315f2f,_0x4d7f5a){return db['JscriptyAnswerReport'][_0x27e0('0x4a')]()[_0x27e0('0x24')](respondWithResult(_0x4d7f5a,null))['catch'](handleError(_0x4d7f5a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index cbcaa36..9673c0b 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 _0xd918=['./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x11288b,_0x4d1c91){var _0x3c4136=function(_0x3b8a04){while(--_0x3b8a04){_0x11288b['push'](_0x11288b['shift']());}};_0x3c4136(++_0x4d1c91);}(_0xd918,0x137));var _0x8d91=function(_0x534e9a,_0x5bd217){_0x534e9a=_0x534e9a-0x0;var _0x4628fc=_0xd918[_0x534e9a];return _0x4628fc;};'use strict';var _=require(_0x8d91('0x0'));var util=require(_0x8d91('0x1'));var logger=require(_0x8d91('0x2'))('api');var moment=require(_0x8d91('0x3'));var BPromise=require('bluebird');var rp=require(_0x8d91('0x4'));var fs=require('fs');var path=require(_0x8d91('0x5'));var rimraf=require(_0x8d91('0x6'));var config=require(_0x8d91('0x7'));var attributes=require(_0x8d91('0x8'));module[_0x8d91('0x9')]=function(_0x4c1c0e,_0x139cd1){return _0x4c1c0e['define']('JscriptyAnswerReport',attributes,{'tableName':_0x8d91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1381=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0xd413a4,_0x3120fe){var _0x9170f4=function(_0x5aa567){while(--_0x5aa567){_0xd413a4['push'](_0xd413a4['shift']());}};_0x9170f4(++_0x3120fe);}(_0x1381,0xfb));var _0x1138=function(_0x316597,_0x2be478){_0x316597=_0x316597-0x0;var _0x538219=_0x1381[_0x316597];return _0x538219;};'use strict';var _=require(_0x1138('0x0'));var util=require('util');var logger=require(_0x1138('0x1'))('api');var moment=require(_0x1138('0x2'));var BPromise=require(_0x1138('0x3'));var rp=require(_0x1138('0x4'));var fs=require('fs');var path=require(_0x1138('0x5'));var rimraf=require(_0x1138('0x6'));var config=require('../../config/environment');var attributes=require(_0x1138('0x7'));module[_0x1138('0x8')]=function(_0x4b1c11,_0x3cd1e0){return _0x4b1c11[_0x1138('0x9')](_0x1138('0xa'),attributes,{'tableName':_0x1138('0xb'),'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 66be3a2..a2bee01 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 _0x8eb3=['debug','stringify','error','message','request\x20sent','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8eb3,0x8b));var _0x38eb=function(_0x5e5754,_0x270c8b){_0x5e5754=_0x5e5754-0x0;var _0x3779f1=_0x8eb3[_0x5e5754];return _0x3779f1;};'use strict';var _=require(_0x38eb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x38eb('0x1'));var fs=require('fs');var Redis=require(_0x38eb('0x2'));var db=require(_0x38eb('0x3'))['db'];var utils=require(_0x38eb('0x4'));var logger=require('../../config/logger')(_0x38eb('0x5'));var config=require(_0x38eb('0x6'));var jayson=require(_0x38eb('0x7'));var client=jayson[_0x38eb('0x8')][_0x38eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x496ec6,_0x195fdf,_0x360c94){return new BPromise(function(_0x19f16f,_0x355fa7){return client[_0x38eb('0xa')](_0x496ec6,_0x360c94)['then'](function(_0x5cc0df){logger[_0x38eb('0xb')](_0x38eb('0xc'),_0x195fdf,'request\x20sent');logger[_0x38eb('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x195fdf,'request\x20sent',JSON[_0x38eb('0xe')](_0x5cc0df));if(_0x5cc0df[_0x38eb('0xf')]){if(_0x5cc0df[_0x38eb('0xf')]['code']===0x1f4){logger['error'](_0x38eb('0xc'),_0x195fdf,_0x5cc0df[_0x38eb('0xf')][_0x38eb('0x10')]);return _0x355fa7(_0x5cc0df['error'][_0x38eb('0x10')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x195fdf,_0x5cc0df[_0x38eb('0xf')][_0x38eb('0x10')]);return _0x19f16f(_0x5cc0df[_0x38eb('0xf')]['message']);}else{logger['info'](_0x38eb('0xc'),_0x195fdf,_0x38eb('0x11'));_0x19f16f(_0x5cc0df[_0x38eb('0x12')]['message']);}})['catch'](function(_0x3ecb8e){logger['error'](_0x38eb('0xc'),_0x195fdf,_0x3ecb8e);_0x355fa7(_0x3ecb8e);});});} \ No newline at end of file +var _0x45fa=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x45fa,0x1d5));var _0xa45f=function(_0x53e243,_0x3da7b2){_0x53e243=_0x53e243-0x0;var _0x1eecf6=_0x45fa[_0x53e243];return _0x1eecf6;};'use strict';var _=require(_0xa45f('0x0'));var util=require(_0xa45f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa45f('0x2'));var fs=require('fs');var Redis=require(_0xa45f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa45f('0x4'));var logger=require(_0xa45f('0x5'))(_0xa45f('0x6'));var config=require('../../config/environment');var jayson=require(_0xa45f('0x7'));var client=jayson[_0xa45f('0x8')][_0xa45f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x238fdd,_0x3fd897,_0xd8b676){return new BPromise(function(_0x22fe42,_0x52b8c6){return client[_0xa45f('0xa')](_0x238fdd,_0xd8b676)[_0xa45f('0xb')](function(_0x48fc56){logger[_0xa45f('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3fd897,_0xa45f('0xd'));logger['debug'](_0xa45f('0xe'),_0x3fd897,'request\x20sent',JSON[_0xa45f('0xf')](_0x48fc56));if(_0x48fc56[_0xa45f('0x10')]){if(_0x48fc56[_0xa45f('0x10')]['code']===0x1f4){logger[_0xa45f('0x10')](_0xa45f('0x11'),_0x3fd897,_0x48fc56[_0xa45f('0x10')][_0xa45f('0x12')]);return _0x52b8c6(_0x48fc56[_0xa45f('0x10')][_0xa45f('0x12')]);}logger['error'](_0xa45f('0x11'),_0x3fd897,_0x48fc56['error'][_0xa45f('0x12')]);return _0x22fe42(_0x48fc56['error'][_0xa45f('0x12')]);}else{logger[_0xa45f('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3fd897,_0xa45f('0xd'));_0x22fe42(_0x48fc56[_0xa45f('0x13')]['message']);}})[_0xa45f('0x14')](function(_0x37c4d9){logger['error'](_0xa45f('0x11'),_0x3fd897,_0x37c4d9);_0x52b8c6(_0x37c4d9);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1a78ba1..95b7919 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 _0xc8dd=['path','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getSummary','post','create','/:id/clone','put','update','delete','destroy','multer','util'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xc8dd,0x8e));var _0xdc8d=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0xc8dd[_0x4382bc];return _0x13c82a;};'use strict';var multer=require(_0xdc8d('0x0'));var util=require(_0xdc8d('0x1'));var path=require(_0xdc8d('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc8d('0x3'));var router=express[_0xdc8d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdc8d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc8d('0x6'));var controller=require(_0xdc8d('0x7'));router[_0xdc8d('0x8')]('/',auth[_0xdc8d('0x9')](),controller[_0xdc8d('0xa')]);router['get'](_0xdc8d('0xb'),auth[_0xdc8d('0x9')](),controller[_0xdc8d('0xc')]);router[_0xdc8d('0x8')](_0xdc8d('0xd'),auth[_0xdc8d('0x9')](),controller[_0xdc8d('0xe')]);router[_0xdc8d('0x8')](_0xdc8d('0xf'),auth[_0xdc8d('0x9')](),controller['getAnswers']);router[_0xdc8d('0x8')]('/:id/summary',auth[_0xdc8d('0x9')](),timeout('30s'),controller[_0xdc8d('0x10')]);router[_0xdc8d('0x11')]('/',auth['isAuthenticated'](),controller[_0xdc8d('0x12')]);router['post'](_0xdc8d('0x13'),auth[_0xdc8d('0x9')](),controller['clone']);router[_0xdc8d('0x14')]('/:id',auth[_0xdc8d('0x9')](),controller[_0xdc8d('0x15')]);router[_0xdc8d('0x16')](_0xdc8d('0xb'),auth['isAuthenticated'](),controller[_0xdc8d('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc89a=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSessions','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x44d144,_0x2e6dbf){var _0x258c86=function(_0x1064b7){while(--_0x1064b7){_0x44d144['push'](_0x44d144['shift']());}};_0x258c86(++_0x2e6dbf);}(_0xc89a,0x88));var _0xac89=function(_0x54a155,_0x29fe9b){_0x54a155=_0x54a155-0x0;var _0x45ae64=_0xc89a[_0x54a155];return _0x45ae64;};'use strict';var multer=require(_0xac89('0x0'));var util=require(_0xac89('0x1'));var path=require(_0xac89('0x2'));var timeout=require(_0xac89('0x3'));var express=require(_0xac89('0x4'));var router=express['Router']();var fs_extra=require(_0xac89('0x5'));var auth=require(_0xac89('0x6'));var interaction=require(_0xac89('0x7'));var config=require(_0xac89('0x8'));var controller=require('./jscriptyProject.controller');router[_0xac89('0x9')]('/',auth[_0xac89('0xa')](),controller[_0xac89('0xb')]);router[_0xac89('0x9')](_0xac89('0xc'),auth[_0xac89('0xa')](),controller[_0xac89('0xd')]);router['get']('/:id/sessions',auth[_0xac89('0xa')](),controller[_0xac89('0xe')]);router[_0xac89('0x9')]('/:id/answers',auth[_0xac89('0xa')](),controller[_0xac89('0xf')]);router[_0xac89('0x9')](_0xac89('0x10'),auth[_0xac89('0xa')](),timeout(_0xac89('0x11')),controller[_0xac89('0x12')]);router[_0xac89('0x13')]('/',auth[_0xac89('0xa')](),controller[_0xac89('0x14')]);router[_0xac89('0x13')](_0xac89('0x15'),auth[_0xac89('0xa')](),controller[_0xac89('0x16')]);router[_0xac89('0x17')](_0xac89('0xc'),auth[_0xac89('0xa')](),controller[_0xac89('0x18')]);router[_0xac89('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xac89('0x1a')]);module[_0xac89('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index f1d85d9..daff670 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 _0xfac1=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue'];(function(_0x2f463f,_0x4d9f56){var _0x3673a3=function(_0x48200f){while(--_0x48200f){_0x2f463f['push'](_0x2f463f['shift']());}};_0x3673a3(++_0x4d9f56);}(_0xfac1,0x71));var _0x1fac=function(_0x74d12d,_0x1970a1){_0x74d12d=_0x74d12d-0x0;var _0x325250=_0xfac1[_0x74d12d];return _0x325250;};'use strict';var Sequelize=require(_0x1fac('0x0'));var _=require(_0x1fac('0x1'));var util=require(_0x1fac('0x2'));module[_0x1fac('0x3')]={'name':{'type':Sequelize[_0x1fac('0x4')],'unique':_0x1fac('0x5')},'description':{'type':Sequelize[_0x1fac('0x4')]},'formData':{'type':Sequelize[_0x1fac('0x6')](_0x1fac('0x7')),'set':function(_0x4e31cd){if(_[_0x1fac('0x8')](_0x4e31cd)){this['setDataValue'](_0x1fac('0x9'),JSON[_0x1fac('0xa')](_0x4e31cd));}else if(_[_0x1fac('0xb')](_0x4e31cd)){this[_0x1fac('0xc')](_0x1fac('0x9'),_0x4e31cd);}else{this[_0x1fac('0xc')]('formData',util[_0x1fac('0xd')](_0x1fac('0xe'),this[_0x1fac('0xf')](_0x1fac('0x5'))||'',this[_0x1fac('0xf')](_0x1fac('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1fac('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1fac('0x11')],'defaultValue':![]}}; \ No newline at end of file +var _0xf031=['isObjectLike','stringify','isString','setDataValue','formData','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','TEXT','long'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf031,0xcc));var _0x1f03=function(_0x3f3729,_0x5586ea){_0x3f3729=_0x3f3729-0x0;var _0x589448=_0xf031[_0x3f3729];return _0x589448;};'use strict';var Sequelize=require(_0x1f03('0x0'));var _=require(_0x1f03('0x1'));var util=require(_0x1f03('0x2'));module['exports']={'name':{'type':Sequelize[_0x1f03('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x1f03('0x3')]},'formData':{'type':Sequelize[_0x1f03('0x4')](_0x1f03('0x5')),'set':function(_0x292e79){if(_[_0x1f03('0x6')](_0x292e79)){this['setDataValue']('formData',JSON[_0x1f03('0x7')](_0x292e79));}else if(_[_0x1f03('0x8')](_0x292e79)){this[_0x1f03('0x9')](_0x1f03('0xa'),_0x292e79);}else{this[_0x1f03('0x9')]('formData',util[_0x1f03('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue']('name')||'',this[_0x1f03('0xc')](_0x1f03('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1f03('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1f03('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 7e99b5c..d4ec5cc 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 _0x3a5d=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','clone','params','omit','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getSessions','findOne','JscriptySessionReport','findAll','rows','JscriptyAnswerReport','ProjectId','number','fromCharCode','apply','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','status','set','reject','save','update','then','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','JscriptyProject','catch','length','find','create','body'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3a5d,0x193));var _0xd3a5=function(_0x16f07d,_0x278463){_0x16f07d=_0x16f07d-0x0;var _0x1b38d5=_0x3a5d[_0x16f07d];return _0x1b38d5;};'use strict';var emlformat=require(_0xd3a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3a5('0x1'));var jsonpatch=require(_0xd3a5('0x2'));var rp=require(_0xd3a5('0x3'));var moment=require(_0xd3a5('0x4'));var BPromise=require(_0xd3a5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd3a5('0x6'));var sox=require(_0xd3a5('0x7'));var csv=require(_0xd3a5('0x8'));var ejs=require(_0xd3a5('0x9'));var fs=require('fs');var fs_extra=require(_0xd3a5('0xa'));var _=require(_0xd3a5('0xb'));var squel=require(_0xd3a5('0xc'));var crypto=require(_0xd3a5('0xd'));var jsforce=require(_0xd3a5('0xe'));var deskjs=require(_0xd3a5('0xf'));var toCsv=require(_0xd3a5('0x8'));var querystring=require(_0xd3a5('0x10'));var Papa=require(_0xd3a5('0x11'));var Redis=require(_0xd3a5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd3a5('0x13'));var as=require(_0xd3a5('0x14'));var hardwareService=require(_0xd3a5('0x15'));var logger=require('../../config/logger')(_0xd3a5('0x16'));var utils=require(_0xd3a5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd3a5('0x18'));var db=require(_0xd3a5('0x19'))['db'];function respondWithStatusCode(_0x26068b,_0x4f8acb){_0x4f8acb=_0x4f8acb||0xcc;return function(_0x7c91ef){if(_0x7c91ef){return _0x26068b['sendStatus'](_0x4f8acb);}return _0x26068b['status'](_0x4f8acb)[_0xd3a5('0x1a')]();};}function respondWithResult(_0x411cc2,_0x25096c){_0x25096c=_0x25096c||0xc8;return function(_0x5e5dc0){if(_0x5e5dc0){return _0x411cc2['status'](_0x25096c)[_0xd3a5('0x1b')](_0x5e5dc0);}};}function respondWithFilteredResult(_0x2d0016,_0x50e40e){return function(_0x20d72a){if(_0x20d72a){var _0x54e6af=typeof _0x50e40e[_0xd3a5('0x1c')]==='undefined'&&typeof _0x50e40e[_0xd3a5('0x1d')]===_0xd3a5('0x1e');var _0x5a6a11=_0x20d72a[_0xd3a5('0x1f')];var _0x13694f=_0x54e6af?0x0:_0x50e40e[_0xd3a5('0x1c')];var _0x824d1=_0x54e6af?_0x20d72a[_0xd3a5('0x1f')]:_0x50e40e[_0xd3a5('0x1c')]+_0x50e40e[_0xd3a5('0x1d')];var _0x29866f;if(_0x824d1>=_0x5a6a11){_0x824d1=_0x5a6a11;_0x29866f=0xc8;}else{_0x29866f=0xce;}_0x2d0016[_0xd3a5('0x20')](_0x29866f);return _0x2d0016[_0xd3a5('0x21')]('Content-Range',_0x13694f+'-'+_0x824d1+'/'+_0x5a6a11)[_0xd3a5('0x1b')](_0x20d72a);}return null;};}function patchUpdates(_0x264b23){return function(_0x5adb83){try{jsonpatch['apply'](_0x5adb83,_0x264b23,!![]);}catch(_0x1d43a5){return BPromise[_0xd3a5('0x22')](_0x1d43a5);}return _0x5adb83[_0xd3a5('0x23')]();};}function saveUpdates(_0x11d728,_0x2d3c34){return function(_0x21577a){if(_0x21577a){return _0x21577a[_0xd3a5('0x24')](_0x11d728)[_0xd3a5('0x25')](function(_0x5b6d54){return _0x5b6d54;});}return null;};}function removeEntity(_0x367100,_0x26a6e1){return function(_0x1fa136){if(_0x1fa136){return _0x1fa136['destroy']()[_0xd3a5('0x25')](function(){var _0x221909=_0x1fa136[_0xd3a5('0x26')]({'plain':!![]});var _0x3c4697=_0xd3a5('0x27');return db[_0xd3a5('0x28')]['destroy']({'where':{'type':_0x3c4697,'resourceId':_0x221909['id']}})[_0xd3a5('0x25')](function(){return _0x1fa136;});})['then'](function(){_0x367100[_0xd3a5('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d6a0e,_0x245f1){return function(_0x1e9a0c){if(!_0x1e9a0c){_0x5d6a0e[_0xd3a5('0x29')](0x194);}return _0x1e9a0c;};}function handleError(_0x5be48d,_0x5a0567){_0x5a0567=_0x5a0567||0x1f4;return function(_0x2626f6){logger[_0xd3a5('0x2a')](_0x2626f6[_0xd3a5('0x2b')]);if(_0x2626f6[_0xd3a5('0x2c')]){delete _0x2626f6[_0xd3a5('0x2c')];}_0x5be48d[_0xd3a5('0x20')](_0x5a0567)[_0xd3a5('0x2d')](_0x2626f6);};}exports['index']=function(_0xab1349,_0xb7ebcc){var _0xda41ef={},_0x15e3e0={},_0x28ffc2={'count':0x0,'rows':[]};var _0xee1f51=_[_0xd3a5('0x2e')](db['JscriptyProject'][_0xd3a5('0x2f')],function(_0x7a7122){return{'name':_0x7a7122['fieldName'],'type':_0x7a7122[_0xd3a5('0x30')]['key']};});_0x15e3e0[_0xd3a5('0x31')]=_[_0xd3a5('0x2e')](_0xee1f51,'name');_0x15e3e0[_0xd3a5('0x32')]=_[_0xd3a5('0x33')](_0xab1349[_0xd3a5('0x32')]);_0x15e3e0[_0xd3a5('0x34')]=_[_0xd3a5('0x35')](_0x15e3e0['model'],_0x15e3e0[_0xd3a5('0x32')]);_0xda41ef[_0xd3a5('0x36')]=_[_0xd3a5('0x35')](_0x15e3e0[_0xd3a5('0x31')],qs[_0xd3a5('0x37')](_0xab1349[_0xd3a5('0x32')][_0xd3a5('0x37')]));_0xda41ef[_0xd3a5('0x36')]=_0xda41ef[_0xd3a5('0x36')]['length']?_0xda41ef[_0xd3a5('0x36')]:_0x15e3e0[_0xd3a5('0x31')];if(!_0xab1349[_0xd3a5('0x32')][_0xd3a5('0x38')](_0xd3a5('0x39'))){_0xda41ef['limit']=qs[_0xd3a5('0x1d')](_0xab1349['query'][_0xd3a5('0x1d')]);_0xda41ef[_0xd3a5('0x1c')]=qs['offset'](_0xab1349['query'][_0xd3a5('0x1c')]);}_0xda41ef[_0xd3a5('0x3a')]=qs['sort'](_0xab1349[_0xd3a5('0x32')][_0xd3a5('0x3b')]);_0xda41ef[_0xd3a5('0x3c')]=qs[_0xd3a5('0x34')](_[_0xd3a5('0x3d')](_0xab1349['query'],_0x15e3e0[_0xd3a5('0x34')]),_0xee1f51);if(_0xab1349['query']['filter']){_0xda41ef[_0xd3a5('0x3c')]=_[_0xd3a5('0x3e')](_0xda41ef[_0xd3a5('0x3c')],{'$or':_[_0xd3a5('0x2e')](_0xee1f51,function(_0x4c9998){if(_0x4c9998[_0xd3a5('0x30')]!=='VIRTUAL'){var _0x52d13e={};_0x52d13e[_0x4c9998['name']]={'$like':'%'+_0xab1349['query'][_0xd3a5('0x3f')]+'%'};return _0x52d13e;}})});}_0xda41ef=_['merge']({},_0xda41ef,_0xab1349[_0xd3a5('0x40')]);var _0x3d317a={'where':_0xda41ef[_0xd3a5('0x3c')]};return db['JscriptyProject']['count'](_0x3d317a)['then'](function(_0x5010e5){_0x28ffc2[_0xd3a5('0x1f')]=_0x5010e5;if(_0xab1349[_0xd3a5('0x32')][_0xd3a5('0x41')]){_0xda41ef[_0xd3a5('0x42')]=[{'all':!![]}];}return db[_0xd3a5('0x43')]['findAll'](_0xda41ef);})[_0xd3a5('0x25')](function(_0x3dcf8d){_0x28ffc2['rows']=_0x3dcf8d;return _0x28ffc2;})[_0xd3a5('0x25')](respondWithFilteredResult(_0xb7ebcc,_0xda41ef))[_0xd3a5('0x44')](handleError(_0xb7ebcc,null));};exports['show']=function(_0x55d0b2,_0x5a7057){var _0x27f31b={'raw':![],'where':{'id':_0x55d0b2['params']['id']}},_0x4bc6fd={};_0x4bc6fd[_0xd3a5('0x31')]=_[_0xd3a5('0x33')](db['JscriptyProject'][_0xd3a5('0x2f')]);_0x4bc6fd[_0xd3a5('0x32')]=_[_0xd3a5('0x33')](_0x55d0b2['query']);_0x4bc6fd[_0xd3a5('0x34')]=_[_0xd3a5('0x35')](_0x4bc6fd['model'],_0x4bc6fd[_0xd3a5('0x32')]);_0x27f31b['attributes']=_[_0xd3a5('0x35')](_0x4bc6fd['model'],qs[_0xd3a5('0x37')](_0x55d0b2[_0xd3a5('0x32')]['fields']));_0x27f31b[_0xd3a5('0x36')]=_0x27f31b[_0xd3a5('0x36')][_0xd3a5('0x45')]?_0x27f31b[_0xd3a5('0x36')]:_0x4bc6fd['model'];if(_0x55d0b2[_0xd3a5('0x32')][_0xd3a5('0x41')]){_0x27f31b[_0xd3a5('0x42')]=[{'all':!![]}];}_0x27f31b=_['merge']({},_0x27f31b,_0x55d0b2[_0xd3a5('0x40')]);return db[_0xd3a5('0x43')][_0xd3a5('0x46')](_0x27f31b)[_0xd3a5('0x25')](handleEntityNotFound(_0x5a7057,null))['then'](respondWithResult(_0x5a7057,null))[_0xd3a5('0x44')](handleError(_0x5a7057,null));};exports['create']=function(_0x250a85,_0x4a627d){return db[_0xd3a5('0x43')][_0xd3a5('0x47')](_0x250a85[_0xd3a5('0x48')],{})['then'](function(_0x373c59){var _0x59b563=_0x250a85['user'][_0xd3a5('0x26')]({'plain':!![]});if(!_0x59b563)throw new Error(_0xd3a5('0x49'));if(_0x59b563[_0xd3a5('0x4a')]===_0xd3a5('0x4b')){var _0x963629=_0x373c59['get']({'plain':!![]});var _0x2e8110=_0xd3a5('0x27');return db[_0xd3a5('0x4c')]['find']({'where':{'name':_0x2e8110,'userProfileId':_0x59b563[_0xd3a5('0x4d')]},'raw':!![]})[_0xd3a5('0x25')](function(_0x38219b){if(_0x38219b&&_0x38219b['autoAssociation']===0x0){return db[_0xd3a5('0x28')]['create']({'name':_0x963629[_0xd3a5('0x2c')],'resourceId':_0x963629['id'],'type':_0x38219b['name'],'sectionId':_0x38219b['id']},{})[_0xd3a5('0x25')](function(){return _0x373c59;});}else{return _0x373c59;}})[_0xd3a5('0x44')](function(_0x5c00d8){logger[_0xd3a5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c00d8);throw _0x5c00d8;});}return _0x373c59;})[_0xd3a5('0x25')](respondWithResult(_0x4a627d,0xc9))['catch'](handleError(_0x4a627d,null));};exports[_0xd3a5('0x4e')]=function(_0x46fec7,_0x2fc458){var _0x4429c4={'where':{'id':_0x46fec7[_0xd3a5('0x4f')]['id']}},_0x97c8b0={};_0x97c8b0[_0xd3a5('0x31')]=_[_0xd3a5('0x33')](db['JscriptyProject'][_0xd3a5('0x2f')]);_0x4429c4[_0xd3a5('0x36')]=_[_0xd3a5('0x35')](_0x97c8b0[_0xd3a5('0x31')],qs[_0xd3a5('0x37')](_0x46fec7[_0xd3a5('0x32')]['fields']));_0x4429c4['attributes']=_0x4429c4[_0xd3a5('0x36')][_0xd3a5('0x45')]?_0x4429c4['attributes']:_0x97c8b0[_0xd3a5('0x31')];if(_0x46fec7[_0xd3a5('0x32')][_0xd3a5('0x41')]){_0x4429c4['include']=[{'all':!![]}];}_0x4429c4=_[_0xd3a5('0x3e')]({},_0x4429c4,_0x46fec7[_0xd3a5('0x40')]);return db[_0xd3a5('0x43')][_0xd3a5('0x46')](_0x4429c4)[_0xd3a5('0x25')](handleEntityNotFound(_0x2fc458,null))[_0xd3a5('0x25')](function(_0x343ffc){if(_0x343ffc){var _0x105a7c=_0x343ffc[_0xd3a5('0x26')]({'plain':!![]});_0x105a7c=qs[_0xd3a5('0x50')](_0x105a7c,['id',_0xd3a5('0x51'),'updatedAt']);_0x46fec7['body']=_[_0xd3a5('0x50')](_0x46fec7[_0xd3a5('0x48')],['id','createdAt','updatedAt']);return db[_0xd3a5('0x43')][_0xd3a5('0x47')](_[_0xd3a5('0x3e')](_0x105a7c,_0x46fec7[_0xd3a5('0x48')]),{'include':_0x46fec7[_0xd3a5('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xd3a5('0x25')](function(_0x31324e){var _0x1dd451=_0x46fec7['user'][_0xd3a5('0x26')]({'plain':!![]});if(!_0x1dd451)throw new Error(_0xd3a5('0x49'));if(_0x1dd451[_0xd3a5('0x4a')]===_0xd3a5('0x4b')){var _0x11925e=_0x31324e[_0xd3a5('0x26')]({'plain':!![]});var _0x3edbc6='Projects';return db[_0xd3a5('0x4c')][_0xd3a5('0x46')]({'where':{'name':_0x3edbc6,'userProfileId':_0x1dd451[_0xd3a5('0x4d')]},'raw':!![]})[_0xd3a5('0x25')](function(_0x4b565c){if(_0x4b565c&&_0x4b565c['autoAssociation']===0x0){return db[_0xd3a5('0x28')][_0xd3a5('0x47')]({'name':_0x11925e[_0xd3a5('0x2c')],'resourceId':_0x11925e['id'],'type':_0x4b565c['name'],'sectionId':_0x4b565c['id']},{})[_0xd3a5('0x25')](function(){return _0x31324e;});}else{return _0x31324e;}})[_0xd3a5('0x44')](function(_0x2f96ce){logger[_0xd3a5('0x2a')](_0xd3a5('0x52'),_0x2f96ce);throw _0x2f96ce;});}return _0x31324e;});}})[_0xd3a5('0x25')](respondWithResult(_0x2fc458,0xc9))[_0xd3a5('0x44')](handleError(_0x2fc458,null));};exports['update']=function(_0x42cf7a,_0x2697ff){if(_0x42cf7a[_0xd3a5('0x48')]['id']){delete _0x42cf7a[_0xd3a5('0x48')]['id'];}return db[_0xd3a5('0x43')][_0xd3a5('0x46')]({'where':{'id':_0x42cf7a[_0xd3a5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2697ff,null))[_0xd3a5('0x25')](saveUpdates(_0x42cf7a[_0xd3a5('0x48')],null))[_0xd3a5('0x25')](respondWithResult(_0x2697ff,null))[_0xd3a5('0x44')](handleError(_0x2697ff,null));};exports[_0xd3a5('0x53')]=function(_0x1b757b,_0x1e7a7c){return db[_0xd3a5('0x43')][_0xd3a5('0x46')]({'where':{'id':_0x1b757b[_0xd3a5('0x4f')]['id']}})[_0xd3a5('0x25')](handleEntityNotFound(_0x1e7a7c,null))[_0xd3a5('0x25')](removeEntity(_0x1e7a7c,null))['catch'](handleError(_0x1e7a7c,null));};exports[_0xd3a5('0x54')]=function(_0x4a9b03,_0x36cef6,_0x13b0be){var _0x3785e2={'raw':!![],'where':{}};var _0x308335={};var _0x16302e={'count':0x0,'rows':[]};return db[_0xd3a5('0x43')][_0xd3a5('0x55')]({'where':{'id':_0x4a9b03['params']['id']}})[_0xd3a5('0x25')](handleEntityNotFound(_0x36cef6,null))['then'](function(_0x39f1c0){if(_0x39f1c0){_0x308335[_0xd3a5('0x31')]=_['keys'](db[_0xd3a5('0x56')][_0xd3a5('0x2f')]);_0x308335['query']=_['keys'](_0x4a9b03[_0xd3a5('0x32')]);_0x308335[_0xd3a5('0x34')]=_[_0xd3a5('0x35')](_0x308335[_0xd3a5('0x31')],_0x308335[_0xd3a5('0x32')]);_0x3785e2[_0xd3a5('0x36')]=_[_0xd3a5('0x35')](_0x308335[_0xd3a5('0x31')],qs['fields'](_0x4a9b03['query'][_0xd3a5('0x37')]));_0x3785e2[_0xd3a5('0x36')]=_0x3785e2[_0xd3a5('0x36')][_0xd3a5('0x45')]?_0x3785e2[_0xd3a5('0x36')]:_0x308335[_0xd3a5('0x31')];if(!_0x4a9b03[_0xd3a5('0x32')][_0xd3a5('0x38')](_0xd3a5('0x39'))){_0x3785e2[_0xd3a5('0x1d')]=qs['limit'](_0x4a9b03[_0xd3a5('0x32')][_0xd3a5('0x1d')]);_0x3785e2[_0xd3a5('0x1c')]=qs[_0xd3a5('0x1c')](_0x4a9b03[_0xd3a5('0x32')][_0xd3a5('0x1c')]);}_0x3785e2[_0xd3a5('0x3a')]=qs[_0xd3a5('0x3b')](_0x4a9b03[_0xd3a5('0x32')][_0xd3a5('0x3b')]);_0x3785e2[_0xd3a5('0x3c')]=qs[_0xd3a5('0x34')](_['pick'](_0x4a9b03[_0xd3a5('0x32')],_0x308335[_0xd3a5('0x34')]));_0x3785e2[_0xd3a5('0x3c')]['ProjectId']=_0x39f1c0['id'];if(_0x4a9b03[_0xd3a5('0x32')][_0xd3a5('0x3f')]){_0x3785e2[_0xd3a5('0x3c')]=_[_0xd3a5('0x3e')](_0x3785e2[_0xd3a5('0x3c')],{'$or':_[_0xd3a5('0x2e')](_0x3785e2[_0xd3a5('0x36')],function(_0x1f2692){var _0x4dbf2d={};_0x4dbf2d[_0x1f2692]={'$like':'%'+_0x4a9b03['query'][_0xd3a5('0x3f')]+'%'};return _0x4dbf2d;})});}_0x3785e2=_[_0xd3a5('0x3e')]({},_0x3785e2,_0x4a9b03[_0xd3a5('0x40')]);return db[_0xd3a5('0x56')]['count']({'where':_0x3785e2['where']})[_0xd3a5('0x25')](function(_0x31df67){_0x16302e[_0xd3a5('0x1f')]=_0x31df67;if(_0x4a9b03[_0xd3a5('0x32')][_0xd3a5('0x41')]){_0x3785e2['include']=[{'all':!![]}];}return db[_0xd3a5('0x56')][_0xd3a5('0x57')](_0x3785e2);})[_0xd3a5('0x25')](function(_0x11beca){_0x16302e[_0xd3a5('0x58')]=_0x11beca;return _0x16302e;});}})[_0xd3a5('0x25')](respondWithFilteredResult(_0x36cef6,_0x3785e2))[_0xd3a5('0x44')](handleError(_0x36cef6,null));};exports['getAnswers']=function(_0x1e5366,_0x2a15af,_0x2393e2){var _0x3bc434={'raw':!![],'where':{}};var _0x3c6c0b={};var _0x271dec={'count':0x0,'rows':[]};return db[_0xd3a5('0x43')]['findOne']({'where':{'id':_0x1e5366[_0xd3a5('0x4f')]['id']}})[_0xd3a5('0x25')](handleEntityNotFound(_0x2a15af,null))[_0xd3a5('0x25')](function(_0x9dbf67){if(_0x9dbf67){_0x3c6c0b[_0xd3a5('0x31')]=_['keys'](db[_0xd3a5('0x59')][_0xd3a5('0x2f')]);_0x3c6c0b['query']=_['keys'](_0x1e5366[_0xd3a5('0x32')]);_0x3c6c0b[_0xd3a5('0x34')]=_[_0xd3a5('0x35')](_0x3c6c0b[_0xd3a5('0x31')],_0x3c6c0b['query']);_0x3bc434[_0xd3a5('0x36')]=_[_0xd3a5('0x35')](_0x3c6c0b['model'],qs[_0xd3a5('0x37')](_0x1e5366[_0xd3a5('0x32')][_0xd3a5('0x37')]));_0x3bc434[_0xd3a5('0x36')]=_0x3bc434[_0xd3a5('0x36')][_0xd3a5('0x45')]?_0x3bc434[_0xd3a5('0x36')]:_0x3c6c0b[_0xd3a5('0x31')];if(!_0x1e5366[_0xd3a5('0x32')][_0xd3a5('0x38')](_0xd3a5('0x39'))){_0x3bc434['limit']=qs[_0xd3a5('0x1d')](_0x1e5366[_0xd3a5('0x32')]['limit']);_0x3bc434[_0xd3a5('0x1c')]=qs['offset'](_0x1e5366[_0xd3a5('0x32')]['offset']);}_0x3bc434[_0xd3a5('0x3a')]=qs[_0xd3a5('0x3b')](_0x1e5366[_0xd3a5('0x32')][_0xd3a5('0x3b')]);_0x3bc434[_0xd3a5('0x3c')]=qs[_0xd3a5('0x34')](_[_0xd3a5('0x3d')](_0x1e5366[_0xd3a5('0x32')],_0x3c6c0b['filters']));_0x3bc434[_0xd3a5('0x3c')][_0xd3a5('0x5a')]=_0x9dbf67['id'];if(_0x1e5366[_0xd3a5('0x32')][_0xd3a5('0x3f')]){_0x3bc434['where']=_[_0xd3a5('0x3e')](_0x3bc434[_0xd3a5('0x3c')],{'$or':_[_0xd3a5('0x2e')](_0x3bc434[_0xd3a5('0x36')],function(_0x2799e1){var _0xa59021={};_0xa59021[_0x2799e1]={'$like':'%'+_0x1e5366[_0xd3a5('0x32')][_0xd3a5('0x3f')]+'%'};return _0xa59021;})});}_0x3bc434=_['merge']({},_0x3bc434,_0x1e5366[_0xd3a5('0x40')]);return db['JscriptyAnswerReport'][_0xd3a5('0x1f')]({'where':_0x3bc434[_0xd3a5('0x3c')]})[_0xd3a5('0x25')](function(_0x69c960){_0x271dec[_0xd3a5('0x1f')]=_0x69c960;if(_0x1e5366['query'][_0xd3a5('0x41')]){_0x3bc434['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd3a5('0x57')](_0x3bc434);})[_0xd3a5('0x25')](function(_0x17e187){_0x271dec[_0xd3a5('0x58')]=_0x17e187;return _0x271dec;});}})[_0xd3a5('0x25')](respondWithFilteredResult(_0x2a15af,_0x3bc434))['catch'](handleError(_0x2a15af,null));};function char(_0x369443){return _0xd3a5('0x5b')===typeof _0x369443?String[_0xd3a5('0x5c')][_0xd3a5('0x5d')](null,arguments):_0x369443;}function needsEncapsulation(_0x588c98){return!!_0x588c98&&(_0x588c98[_0xd3a5('0x5e')]()[_0xd3a5('0x5f')](char(0xd))>=0x0||_0x588c98[_0xd3a5('0x5e')]()[_0xd3a5('0x5f')](char(0xa))>=0x0||_0x588c98[_0xd3a5('0x5e')]()['indexOf'](char(0x2c))>=0x0||_0x588c98[_0xd3a5('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x53cbd2){var _0x37957f=char(0x22),_0x322cfd='\x5c'+char(0x22),_0x3475e5=_0x53cbd2[_0xd3a5('0x5e')]()['replace'](new RegExp(_0x37957f,'g'),_0x322cfd);return _0x37957f+_0x3475e5+_0x37957f;}exports[_0xd3a5('0x60')]=function(_0x14b382,_0x117a66,_0x33cdb6){var _0x169643,_0x32f792;var _0x5e6ceb={'where':{'ProjectId':_0x14b382[_0xd3a5('0x4f')]['id']}};if(_0x14b382['query'][_0xd3a5('0x61')]){_0x5e6ceb[_0xd3a5('0x3c')][_0xd3a5('0x62')]=JSON[_0xd3a5('0x63')](_0x14b382['query'][_0xd3a5('0x61')]);}return db['JscriptySessionReport'][_0xd3a5('0x57')](_0x5e6ceb)[_0xd3a5('0x25')](handleEntityNotFound(_0x117a66,null))['then'](function(_0x327b32){if(_0x327b32){_0x169643=_0x327b32;return db[_0xd3a5('0x64')][_0xd3a5('0x57')]({'where':{'SessionId':{'$in':_[_0xd3a5('0x2e')](_0x169643,'id')},'ProjectId':_0x14b382[_0xd3a5('0x4f')]['id']},'order':_0xd3a5('0x65')});}})['then'](handleEntityNotFound(_0x117a66,null))[_0xd3a5('0x25')](function(_0x2f8842){if(_0x2f8842){_0x32f792=_0x2f8842;var _0x2991ee={};for(var _0x1618aa=0x0,_0x2e01b1=_0x32f792['length'];_0x1618aa<_0x2e01b1;_0x1618aa++){if(!_0x2991ee[_0xd3a5('0x38')](_0x32f792[_0x1618aa][_0xd3a5('0x66')])){_0x2991ee[_0x32f792[_0x1618aa]['questionId']]=needsEncapsulation(_0x32f792[_0x1618aa][_0xd3a5('0x67')])?encapsulate(_0x32f792[_0x1618aa][_0xd3a5('0x67')]):_0x32f792[_0x1618aa][_0xd3a5('0x67')];}}var _0x199585=[],_0x5ad14a={};for(var _0x47ae17=0x0,_0x100dab=_0x169643[_0xd3a5('0x45')];_0x47ae17<_0x100dab;_0x47ae17++){_0x5ad14a={'ProjectId':_0x14b382[_0xd3a5('0x4f')]['id'],'SessionId':_0x169643[_0x47ae17]['id'],'StartTime':moment(_0x169643[_0x47ae17][_0xd3a5('0x62')])[_0xd3a5('0x68')](_0xd3a5('0x69'))};for(var _0x42ebf7=0x0,_0x10584c=_0x32f792[_0xd3a5('0x45')];_0x42ebf7<_0x10584c;_0x42ebf7++){if(_0x32f792[_0x42ebf7][_0xd3a5('0x6a')]==_0x169643[_0x47ae17]['id']&&_0x2991ee['hasOwnProperty'](_0x32f792[_0x42ebf7][_0xd3a5('0x66')])){_0x5ad14a[_0x2991ee[_0x32f792[_0x42ebf7]['questionId']]]=_0x32f792[_0x42ebf7][_0xd3a5('0x6b')];}}for(var _0x5dae50 in _0x2991ee){if(!_0x5ad14a['hasOwnProperty'](_0x2991ee[_0x5dae50])){_0x5ad14a[_0x2991ee[_0x5dae50]]=null;}}_0x199585[_0xd3a5('0x6c')](_0x5ad14a);}return _0x199585;}})[_0xd3a5('0x25')](function(_0x3595df){if(!_[_0xd3a5('0x6d')](_0x3595df)){var _0x10250d=toCsv(_0x3595df);var _0x2bc2d4=Date[_0xd3a5('0x6e')]();fs[_0xd3a5('0x6f')](util['format'](_0xd3a5('0x70'),_0x14b382['params']['id'],_0x2bc2d4),_0x10250d);_0x117a66[_0xd3a5('0x71')](_0xd3a5('0x72'),_0xd3a5('0x73')+util['format'](_0xd3a5('0x74'),_0x14b382[_0xd3a5('0x4f')]['id'],_0x2bc2d4));_0x117a66[_0xd3a5('0x71')](_0xd3a5('0x75'),_0xd3a5('0x76'));return _0x117a66['download'](util['format'](_0xd3a5('0x70'),_0x14b382[_0xd3a5('0x4f')]['id'],_0x2bc2d4));}else{return _0x117a66[_0xd3a5('0x29')](0xcc);}})[_0xd3a5('0x44')](handleError(_0x117a66,null));}; \ No newline at end of file +var _0xc664=['toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','sendStatus','error','stack','name','index','map','JscriptyProject','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','options','include','findAll','params','keys','rawAttributes','includeAll','merge','find','catch','create','user','Projects','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','length','omit','createdAt','updatedAt','body','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','order','ProjectId','JscriptySessionReport','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply'];(function(_0x4b8252,_0x4eefa5){var _0x734396=function(_0x4e6727){while(--_0x4e6727){_0x4b8252['push'](_0x4b8252['shift']());}};_0x734396(++_0x4eefa5);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4c66('0x0'));var rimraf=require(_0x4c66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c66('0x2'));var rp=require(_0x4c66('0x3'));var moment=require(_0x4c66('0x4'));var BPromise=require(_0x4c66('0x5'));var Mustache=require(_0x4c66('0x6'));var util=require('util');var path=require(_0x4c66('0x7'));var sox=require(_0x4c66('0x8'));var csv=require(_0x4c66('0x9'));var ejs=require(_0x4c66('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c66('0xb'));var squel=require(_0x4c66('0xc'));var crypto=require(_0x4c66('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c66('0x9'));var querystring=require(_0x4c66('0xe'));var Papa=require(_0x4c66('0xf'));var Redis=require(_0x4c66('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4c66('0x11'));var as=require(_0x4c66('0x12'));var hardwareService=require(_0x4c66('0x13'));var logger=require(_0x4c66('0x14'))(_0x4c66('0x15'));var utils=require(_0x4c66('0x16'));var config=require(_0x4c66('0x17'));var licenseUtil=require(_0x4c66('0x18'));var db=require(_0x4c66('0x19'))['db'];function respondWithStatusCode(_0x497cdf,_0x49d412){_0x49d412=_0x49d412||0xcc;return function(_0x51b6f9){if(_0x51b6f9){return _0x497cdf['sendStatus'](_0x49d412);}return _0x497cdf[_0x4c66('0x1a')](_0x49d412)[_0x4c66('0x1b')]();};}function respondWithResult(_0x1b3135,_0x5833b7){_0x5833b7=_0x5833b7||0xc8;return function(_0x1d37a5){if(_0x1d37a5){return _0x1b3135[_0x4c66('0x1a')](_0x5833b7)[_0x4c66('0x1c')](_0x1d37a5);}};}function respondWithFilteredResult(_0x16b20d,_0x46280e){return function(_0x23d1b6){if(_0x23d1b6){var _0x108f8c=typeof _0x46280e[_0x4c66('0x1d')]===_0x4c66('0x1e')&&typeof _0x46280e[_0x4c66('0x1f')]===_0x4c66('0x1e');var _0x541c11=_0x23d1b6[_0x4c66('0x20')];var _0x1a85cc=_0x108f8c?0x0:_0x46280e[_0x4c66('0x1d')];var _0x4d1a49=_0x108f8c?_0x23d1b6['count']:_0x46280e['offset']+_0x46280e['limit'];var _0x1cfd00;if(_0x4d1a49>=_0x541c11){_0x4d1a49=_0x541c11;_0x1cfd00=0xc8;}else{_0x1cfd00=0xce;}_0x16b20d[_0x4c66('0x1a')](_0x1cfd00);return _0x16b20d['set'](_0x4c66('0x21'),_0x1a85cc+'-'+_0x4d1a49+'/'+_0x541c11)['json'](_0x23d1b6);}return null;};}function patchUpdates(_0x160601){return function(_0x53af34){try{jsonpatch['apply'](_0x53af34,_0x160601,!![]);}catch(_0x53c879){return BPromise[_0x4c66('0x22')](_0x53c879);}return _0x53af34[_0x4c66('0x23')]();};}function saveUpdates(_0x19c37d,_0x862fa4){return function(_0x20bc50){if(_0x20bc50){return _0x20bc50[_0x4c66('0x24')](_0x19c37d)[_0x4c66('0x25')](function(_0x963188){return _0x963188;});}return null;};}function removeEntity(_0x2e6126,_0x362e69){return function(_0x35084b){if(_0x35084b){return _0x35084b[_0x4c66('0x26')]()['then'](function(){var _0x195f6e=_0x35084b[_0x4c66('0x27')]({'plain':!![]});var _0x2881e4='Projects';return db['UserProfileResource']['destroy']({'where':{'type':_0x2881e4,'resourceId':_0x195f6e['id']}})[_0x4c66('0x25')](function(){return _0x35084b;});})[_0x4c66('0x25')](function(){_0x2e6126[_0x4c66('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cfc9f,_0xb9d88a){return function(_0x5921a7){if(!_0x5921a7){_0x2cfc9f[_0x4c66('0x28')](0x194);}return _0x5921a7;};}function handleError(_0x176e95,_0x14c1d3){_0x14c1d3=_0x14c1d3||0x1f4;return function(_0x2f9d56){logger[_0x4c66('0x29')](_0x2f9d56[_0x4c66('0x2a')]);if(_0x2f9d56[_0x4c66('0x2b')]){delete _0x2f9d56[_0x4c66('0x2b')];}_0x176e95[_0x4c66('0x1a')](_0x14c1d3)['send'](_0x2f9d56);};}exports[_0x4c66('0x2c')]=function(_0x75656c,_0x404c10){var _0x597872={},_0x17db64={},_0x454755={'count':0x0,'rows':[]};var _0x32c5dc=_[_0x4c66('0x2d')](db[_0x4c66('0x2e')]['rawAttributes'],function(_0x5eaab4){return{'name':_0x5eaab4[_0x4c66('0x2f')],'type':_0x5eaab4[_0x4c66('0x30')][_0x4c66('0x31')]};});_0x17db64['model']=_[_0x4c66('0x2d')](_0x32c5dc,'name');_0x17db64[_0x4c66('0x32')]=_['keys'](_0x75656c[_0x4c66('0x32')]);_0x17db64[_0x4c66('0x33')]=_[_0x4c66('0x34')](_0x17db64[_0x4c66('0x35')],_0x17db64[_0x4c66('0x32')]);_0x597872[_0x4c66('0x36')]=_[_0x4c66('0x34')](_0x17db64[_0x4c66('0x35')],qs[_0x4c66('0x37')](_0x75656c[_0x4c66('0x32')][_0x4c66('0x37')]));_0x597872[_0x4c66('0x36')]=_0x597872['attributes']['length']?_0x597872[_0x4c66('0x36')]:_0x17db64['model'];if(!_0x75656c[_0x4c66('0x32')][_0x4c66('0x38')](_0x4c66('0x39'))){_0x597872[_0x4c66('0x1f')]=qs['limit'](_0x75656c[_0x4c66('0x32')][_0x4c66('0x1f')]);_0x597872[_0x4c66('0x1d')]=qs[_0x4c66('0x1d')](_0x75656c[_0x4c66('0x32')][_0x4c66('0x1d')]);}_0x597872['order']=qs['sort'](_0x75656c['query'][_0x4c66('0x3a')]);_0x597872['where']=qs[_0x4c66('0x33')](_['pick'](_0x75656c[_0x4c66('0x32')],_0x17db64['filters']),_0x32c5dc);if(_0x75656c[_0x4c66('0x32')][_0x4c66('0x3b')]){_0x597872[_0x4c66('0x3c')]=_['merge'](_0x597872[_0x4c66('0x3c')],{'$or':_[_0x4c66('0x2d')](_0x32c5dc,function(_0x4842ef){if(_0x4842ef[_0x4c66('0x30')]!==_0x4c66('0x3d')){var _0x3b0b36={};_0x3b0b36[_0x4842ef['name']]={'$like':'%'+_0x75656c[_0x4c66('0x32')][_0x4c66('0x3b')]+'%'};return _0x3b0b36;}})});}_0x597872=_['merge']({},_0x597872,_0x75656c[_0x4c66('0x3e')]);var _0x478ce4={'where':_0x597872[_0x4c66('0x3c')]};return db[_0x4c66('0x2e')][_0x4c66('0x20')](_0x478ce4)['then'](function(_0xc7a687){_0x454755[_0x4c66('0x20')]=_0xc7a687;if(_0x75656c['query']['includeAll']){_0x597872[_0x4c66('0x3f')]=[{'all':!![]}];}return db[_0x4c66('0x2e')][_0x4c66('0x40')](_0x597872);})[_0x4c66('0x25')](function(_0x5eb957){_0x454755['rows']=_0x5eb957;return _0x454755;})[_0x4c66('0x25')](respondWithFilteredResult(_0x404c10,_0x597872))['catch'](handleError(_0x404c10,null));};exports['show']=function(_0x4b8fe5,_0x27e8fe){var _0x3c5d75={'raw':![],'where':{'id':_0x4b8fe5[_0x4c66('0x41')]['id']}},_0x414603={};_0x414603[_0x4c66('0x35')]=_[_0x4c66('0x42')](db[_0x4c66('0x2e')][_0x4c66('0x43')]);_0x414603[_0x4c66('0x32')]=_[_0x4c66('0x42')](_0x4b8fe5[_0x4c66('0x32')]);_0x414603['filters']=_[_0x4c66('0x34')](_0x414603[_0x4c66('0x35')],_0x414603[_0x4c66('0x32')]);_0x3c5d75['attributes']=_['intersection'](_0x414603[_0x4c66('0x35')],qs[_0x4c66('0x37')](_0x4b8fe5['query'][_0x4c66('0x37')]));_0x3c5d75[_0x4c66('0x36')]=_0x3c5d75[_0x4c66('0x36')]['length']?_0x3c5d75[_0x4c66('0x36')]:_0x414603['model'];if(_0x4b8fe5[_0x4c66('0x32')][_0x4c66('0x44')]){_0x3c5d75[_0x4c66('0x3f')]=[{'all':!![]}];}_0x3c5d75=_[_0x4c66('0x45')]({},_0x3c5d75,_0x4b8fe5[_0x4c66('0x3e')]);return db[_0x4c66('0x2e')][_0x4c66('0x46')](_0x3c5d75)[_0x4c66('0x25')](handleEntityNotFound(_0x27e8fe,null))[_0x4c66('0x25')](respondWithResult(_0x27e8fe,null))[_0x4c66('0x47')](handleError(_0x27e8fe,null));};exports[_0x4c66('0x48')]=function(_0x388499,_0x23d036){return db['JscriptyProject'][_0x4c66('0x48')](_0x388499['body'],{})[_0x4c66('0x25')](function(_0x4330bd){var _0x2444f=_0x388499[_0x4c66('0x49')][_0x4c66('0x27')]({'plain':!![]});if(!_0x2444f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2444f['role']===_0x4c66('0x49')){var _0x46dd9b=_0x4330bd[_0x4c66('0x27')]({'plain':!![]});var _0x1c45e3=_0x4c66('0x4a');return db[_0x4c66('0x4b')]['find']({'where':{'name':_0x1c45e3,'userProfileId':_0x2444f[_0x4c66('0x4c')]},'raw':!![]})[_0x4c66('0x25')](function(_0x4e4dbf){if(_0x4e4dbf&&_0x4e4dbf[_0x4c66('0x4d')]===0x0){return db[_0x4c66('0x4e')][_0x4c66('0x48')]({'name':_0x46dd9b[_0x4c66('0x2b')],'resourceId':_0x46dd9b['id'],'type':_0x4e4dbf['name'],'sectionId':_0x4e4dbf['id']},{})[_0x4c66('0x25')](function(){return _0x4330bd;});}else{return _0x4330bd;}})[_0x4c66('0x47')](function(_0x1efdc7){logger[_0x4c66('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1efdc7);throw _0x1efdc7;});}return _0x4330bd;})[_0x4c66('0x25')](respondWithResult(_0x23d036,0xc9))[_0x4c66('0x47')](handleError(_0x23d036,null));};exports[_0x4c66('0x4f')]=function(_0x296d23,_0x28634b){var _0x56dfb3={'where':{'id':_0x296d23['params']['id']}},_0x5c73ad={};_0x5c73ad[_0x4c66('0x35')]=_[_0x4c66('0x42')](db[_0x4c66('0x2e')][_0x4c66('0x43')]);_0x56dfb3[_0x4c66('0x36')]=_[_0x4c66('0x34')](_0x5c73ad[_0x4c66('0x35')],qs['fields'](_0x296d23['query']['fields']));_0x56dfb3[_0x4c66('0x36')]=_0x56dfb3[_0x4c66('0x36')][_0x4c66('0x50')]?_0x56dfb3[_0x4c66('0x36')]:_0x5c73ad['model'];if(_0x296d23[_0x4c66('0x32')][_0x4c66('0x44')]){_0x56dfb3['include']=[{'all':!![]}];}_0x56dfb3=_[_0x4c66('0x45')]({},_0x56dfb3,_0x296d23[_0x4c66('0x3e')]);return db[_0x4c66('0x2e')]['find'](_0x56dfb3)['then'](handleEntityNotFound(_0x28634b,null))[_0x4c66('0x25')](function(_0x331f82){if(_0x331f82){var _0x141266=_0x331f82[_0x4c66('0x27')]({'plain':!![]});_0x141266=qs[_0x4c66('0x51')](_0x141266,['id',_0x4c66('0x52'),_0x4c66('0x53')]);_0x296d23[_0x4c66('0x54')]=_['omit'](_0x296d23[_0x4c66('0x54')],['id','createdAt',_0x4c66('0x53')]);return db['JscriptyProject'][_0x4c66('0x48')](_[_0x4c66('0x45')](_0x141266,_0x296d23[_0x4c66('0x54')]),{'include':_0x296d23[_0x4c66('0x32')][_0x4c66('0x44')]?[{'all':!![]}]:undefined})[_0x4c66('0x25')](function(_0x1d1dbf){var _0x2c318e=_0x296d23[_0x4c66('0x49')]['get']({'plain':!![]});if(!_0x2c318e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c318e[_0x4c66('0x55')]===_0x4c66('0x49')){var _0x222e1f=_0x1d1dbf[_0x4c66('0x27')]({'plain':!![]});var _0xb7e4be=_0x4c66('0x4a');return db['UserProfileSection'][_0x4c66('0x46')]({'where':{'name':_0xb7e4be,'userProfileId':_0x2c318e[_0x4c66('0x4c')]},'raw':!![]})[_0x4c66('0x25')](function(_0x36efed){if(_0x36efed&&_0x36efed[_0x4c66('0x4d')]===0x0){return db[_0x4c66('0x4e')][_0x4c66('0x48')]({'name':_0x222e1f[_0x4c66('0x2b')],'resourceId':_0x222e1f['id'],'type':_0x36efed[_0x4c66('0x2b')],'sectionId':_0x36efed['id']},{})[_0x4c66('0x25')](function(){return _0x1d1dbf;});}else{return _0x1d1dbf;}})[_0x4c66('0x47')](function(_0x44182c){logger[_0x4c66('0x29')](_0x4c66('0x56'),_0x44182c);throw _0x44182c;});}return _0x1d1dbf;});}})[_0x4c66('0x25')](respondWithResult(_0x28634b,0xc9))[_0x4c66('0x47')](handleError(_0x28634b,null));};exports[_0x4c66('0x24')]=function(_0x25580d,_0x379fdf){if(_0x25580d[_0x4c66('0x54')]['id']){delete _0x25580d[_0x4c66('0x54')]['id'];}return db[_0x4c66('0x2e')][_0x4c66('0x46')]({'where':{'id':_0x25580d[_0x4c66('0x41')]['id']}})['then'](handleEntityNotFound(_0x379fdf,null))[_0x4c66('0x25')](saveUpdates(_0x25580d[_0x4c66('0x54')],null))[_0x4c66('0x25')](respondWithResult(_0x379fdf,null))[_0x4c66('0x47')](handleError(_0x379fdf,null));};exports[_0x4c66('0x26')]=function(_0x40a87d,_0x448039){return db[_0x4c66('0x2e')][_0x4c66('0x46')]({'where':{'id':_0x40a87d[_0x4c66('0x41')]['id']}})['then'](handleEntityNotFound(_0x448039,null))[_0x4c66('0x25')](removeEntity(_0x448039,null))['catch'](handleError(_0x448039,null));};exports[_0x4c66('0x57')]=function(_0x73b27b,_0x4b4473,_0x3e7d83){var _0x58d4c5={'raw':!![],'where':{}};var _0x26086c={};var _0x507bab={'count':0x0,'rows':[]};return db[_0x4c66('0x2e')][_0x4c66('0x58')]({'where':{'id':_0x73b27b[_0x4c66('0x41')]['id']}})[_0x4c66('0x25')](handleEntityNotFound(_0x4b4473,null))[_0x4c66('0x25')](function(_0x39db47){if(_0x39db47){_0x26086c[_0x4c66('0x35')]=_[_0x4c66('0x42')](db['JscriptySessionReport'][_0x4c66('0x43')]);_0x26086c[_0x4c66('0x32')]=_[_0x4c66('0x42')](_0x73b27b[_0x4c66('0x32')]);_0x26086c[_0x4c66('0x33')]=_['intersection'](_0x26086c[_0x4c66('0x35')],_0x26086c[_0x4c66('0x32')]);_0x58d4c5['attributes']=_[_0x4c66('0x34')](_0x26086c[_0x4c66('0x35')],qs['fields'](_0x73b27b[_0x4c66('0x32')][_0x4c66('0x37')]));_0x58d4c5['attributes']=_0x58d4c5['attributes'][_0x4c66('0x50')]?_0x58d4c5[_0x4c66('0x36')]:_0x26086c[_0x4c66('0x35')];if(!_0x73b27b[_0x4c66('0x32')][_0x4c66('0x38')](_0x4c66('0x39'))){_0x58d4c5[_0x4c66('0x1f')]=qs[_0x4c66('0x1f')](_0x73b27b[_0x4c66('0x32')][_0x4c66('0x1f')]);_0x58d4c5[_0x4c66('0x1d')]=qs['offset'](_0x73b27b['query']['offset']);}_0x58d4c5[_0x4c66('0x59')]=qs[_0x4c66('0x3a')](_0x73b27b[_0x4c66('0x32')][_0x4c66('0x3a')]);_0x58d4c5[_0x4c66('0x3c')]=qs[_0x4c66('0x33')](_['pick'](_0x73b27b['query'],_0x26086c[_0x4c66('0x33')]));_0x58d4c5['where'][_0x4c66('0x5a')]=_0x39db47['id'];if(_0x73b27b[_0x4c66('0x32')][_0x4c66('0x3b')]){_0x58d4c5[_0x4c66('0x3c')]=_[_0x4c66('0x45')](_0x58d4c5[_0x4c66('0x3c')],{'$or':_[_0x4c66('0x2d')](_0x58d4c5[_0x4c66('0x36')],function(_0x36dfdb){var _0x26071b={};_0x26071b[_0x36dfdb]={'$like':'%'+_0x73b27b[_0x4c66('0x32')][_0x4c66('0x3b')]+'%'};return _0x26071b;})});}_0x58d4c5=_[_0x4c66('0x45')]({},_0x58d4c5,_0x73b27b[_0x4c66('0x3e')]);return db['JscriptySessionReport'][_0x4c66('0x20')]({'where':_0x58d4c5[_0x4c66('0x3c')]})[_0x4c66('0x25')](function(_0xf70cbb){_0x507bab[_0x4c66('0x20')]=_0xf70cbb;if(_0x73b27b[_0x4c66('0x32')][_0x4c66('0x44')]){_0x58d4c5['include']=[{'all':!![]}];}return db[_0x4c66('0x5b')][_0x4c66('0x40')](_0x58d4c5);})[_0x4c66('0x25')](function(_0x10815f){_0x507bab[_0x4c66('0x5c')]=_0x10815f;return _0x507bab;});}})[_0x4c66('0x25')](respondWithFilteredResult(_0x4b4473,_0x58d4c5))[_0x4c66('0x47')](handleError(_0x4b4473,null));};exports[_0x4c66('0x5d')]=function(_0x18da89,_0x2b51fa,_0x4b177a){var _0x366dd0={'raw':!![],'where':{}};var _0x1f1219={};var _0x45245e={'count':0x0,'rows':[]};return db[_0x4c66('0x2e')][_0x4c66('0x58')]({'where':{'id':_0x18da89[_0x4c66('0x41')]['id']}})[_0x4c66('0x25')](handleEntityNotFound(_0x2b51fa,null))[_0x4c66('0x25')](function(_0x1e9482){if(_0x1e9482){_0x1f1219[_0x4c66('0x35')]=_[_0x4c66('0x42')](db[_0x4c66('0x5e')][_0x4c66('0x43')]);_0x1f1219[_0x4c66('0x32')]=_[_0x4c66('0x42')](_0x18da89[_0x4c66('0x32')]);_0x1f1219[_0x4c66('0x33')]=_[_0x4c66('0x34')](_0x1f1219[_0x4c66('0x35')],_0x1f1219[_0x4c66('0x32')]);_0x366dd0[_0x4c66('0x36')]=_['intersection'](_0x1f1219[_0x4c66('0x35')],qs['fields'](_0x18da89[_0x4c66('0x32')][_0x4c66('0x37')]));_0x366dd0[_0x4c66('0x36')]=_0x366dd0[_0x4c66('0x36')]['length']?_0x366dd0[_0x4c66('0x36')]:_0x1f1219[_0x4c66('0x35')];if(!_0x18da89[_0x4c66('0x32')][_0x4c66('0x38')](_0x4c66('0x39'))){_0x366dd0['limit']=qs[_0x4c66('0x1f')](_0x18da89['query']['limit']);_0x366dd0[_0x4c66('0x1d')]=qs[_0x4c66('0x1d')](_0x18da89['query'][_0x4c66('0x1d')]);}_0x366dd0[_0x4c66('0x59')]=qs[_0x4c66('0x3a')](_0x18da89[_0x4c66('0x32')]['sort']);_0x366dd0[_0x4c66('0x3c')]=qs[_0x4c66('0x33')](_['pick'](_0x18da89[_0x4c66('0x32')],_0x1f1219[_0x4c66('0x33')]));_0x366dd0[_0x4c66('0x3c')][_0x4c66('0x5a')]=_0x1e9482['id'];if(_0x18da89['query'][_0x4c66('0x3b')]){_0x366dd0['where']=_[_0x4c66('0x45')](_0x366dd0['where'],{'$or':_[_0x4c66('0x2d')](_0x366dd0[_0x4c66('0x36')],function(_0x4a6262){var _0x4b8117={};_0x4b8117[_0x4a6262]={'$like':'%'+_0x18da89[_0x4c66('0x32')][_0x4c66('0x3b')]+'%'};return _0x4b8117;})});}_0x366dd0=_[_0x4c66('0x45')]({},_0x366dd0,_0x18da89[_0x4c66('0x3e')]);return db[_0x4c66('0x5e')][_0x4c66('0x20')]({'where':_0x366dd0[_0x4c66('0x3c')]})[_0x4c66('0x25')](function(_0x2f0321){_0x45245e[_0x4c66('0x20')]=_0x2f0321;if(_0x18da89[_0x4c66('0x32')][_0x4c66('0x44')]){_0x366dd0[_0x4c66('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4c66('0x40')](_0x366dd0);})['then'](function(_0x2e9b69){_0x45245e[_0x4c66('0x5c')]=_0x2e9b69;return _0x45245e;});}})['then'](respondWithFilteredResult(_0x2b51fa,_0x366dd0))[_0x4c66('0x47')](handleError(_0x2b51fa,null));};function char(_0x1e2852){return _0x4c66('0x5f')===typeof _0x1e2852?String[_0x4c66('0x60')][_0x4c66('0x61')](null,arguments):_0x1e2852;}function needsEncapsulation(_0x1470da){return!!_0x1470da&&(_0x1470da[_0x4c66('0x62')]()[_0x4c66('0x63')](char(0xd))>=0x0||_0x1470da['toString']()['indexOf'](char(0xa))>=0x0||_0x1470da['toString']()[_0x4c66('0x63')](char(0x2c))>=0x0||_0x1470da[_0x4c66('0x62')]()[_0x4c66('0x63')](char(0x22))>=0x0);}function encapsulate(_0x431b33){var _0x56b7e2=char(0x22),_0x486f83='\x5c'+char(0x22),_0x4b99f2=_0x431b33[_0x4c66('0x62')]()[_0x4c66('0x64')](new RegExp(_0x56b7e2,'g'),_0x486f83);return _0x56b7e2+_0x4b99f2+_0x56b7e2;}exports['getSummary']=function(_0x97fb68,_0x1ed305,_0x3d5a18){var _0x2fdb45,_0x572527;var _0x24ea2f={'where':{'ProjectId':_0x97fb68['params']['id']}};if(_0x97fb68[_0x4c66('0x32')][_0x4c66('0x65')]){_0x24ea2f['where'][_0x4c66('0x66')]=JSON[_0x4c66('0x67')](_0x97fb68[_0x4c66('0x32')][_0x4c66('0x65')]);}return db[_0x4c66('0x5b')][_0x4c66('0x40')](_0x24ea2f)[_0x4c66('0x25')](handleEntityNotFound(_0x1ed305,null))[_0x4c66('0x25')](function(_0x4ab667){if(_0x4ab667){_0x2fdb45=_0x4ab667;return db[_0x4c66('0x68')]['findAll']({'where':{'SessionId':{'$in':_[_0x4c66('0x2d')](_0x2fdb45,'id')},'ProjectId':_0x97fb68[_0x4c66('0x41')]['id']},'order':_0x4c66('0x69')});}})[_0x4c66('0x25')](handleEntityNotFound(_0x1ed305,null))[_0x4c66('0x25')](function(_0x14e653){if(_0x14e653){_0x572527=_0x14e653;var _0x21df57={};for(var _0x3f5016=0x0,_0x3ccd6d=_0x572527[_0x4c66('0x50')];_0x3f5016<_0x3ccd6d;_0x3f5016++){if(!_0x21df57['hasOwnProperty'](_0x572527[_0x3f5016][_0x4c66('0x6a')])){_0x21df57[_0x572527[_0x3f5016][_0x4c66('0x6a')]]=needsEncapsulation(_0x572527[_0x3f5016]['question'])?encapsulate(_0x572527[_0x3f5016]['question']):_0x572527[_0x3f5016]['question'];}}var _0x1f90c9=[],_0x329576={};for(var _0x587baa=0x0,_0x2aed3a=_0x2fdb45['length'];_0x587baa<_0x2aed3a;_0x587baa++){_0x329576={'ProjectId':_0x97fb68['params']['id'],'SessionId':_0x2fdb45[_0x587baa]['id'],'StartTime':moment(_0x2fdb45[_0x587baa][_0x4c66('0x66')])[_0x4c66('0x6b')](_0x4c66('0x6c'))};for(var _0x167014=0x0,_0x4e5a2a=_0x572527[_0x4c66('0x50')];_0x167014<_0x4e5a2a;_0x167014++){if(_0x572527[_0x167014]['SessionId']==_0x2fdb45[_0x587baa]['id']&&_0x21df57[_0x4c66('0x38')](_0x572527[_0x167014]['questionId'])){_0x329576[_0x21df57[_0x572527[_0x167014]['questionId']]]=_0x572527[_0x167014][_0x4c66('0x6d')];}}for(var _0x24a969 in _0x21df57){if(!_0x329576['hasOwnProperty'](_0x21df57[_0x24a969])){_0x329576[_0x21df57[_0x24a969]]=null;}}_0x1f90c9[_0x4c66('0x6e')](_0x329576);}return _0x1f90c9;}})[_0x4c66('0x25')](function(_0x800c77){if(!_[_0x4c66('0x6f')](_0x800c77)){var _0x4ab469=toCsv(_0x800c77);var _0x4513df=Date[_0x4c66('0x70')]();fs[_0x4c66('0x71')](util[_0x4c66('0x6b')](_0x4c66('0x72'),_0x97fb68[_0x4c66('0x41')]['id'],_0x4513df),_0x4ab469);_0x1ed305[_0x4c66('0x73')](_0x4c66('0x74'),_0x4c66('0x75')+util[_0x4c66('0x6b')](_0x4c66('0x76'),_0x97fb68[_0x4c66('0x41')]['id'],_0x4513df));_0x1ed305[_0x4c66('0x73')](_0x4c66('0x77'),_0x4c66('0x78'));return _0x1ed305['download'](util[_0x4c66('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x97fb68[_0x4c66('0x41')]['id'],_0x4513df));}else{return _0x1ed305[_0x4c66('0x28')](0xcc);}})[_0x4c66('0x47')](handleError(_0x1ed305,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 291bf9a..6771f1a 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 _0x0686=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x3de924,_0x15bec3){var _0x2e9159=function(_0x165a5c){while(--_0x165a5c){_0x3de924['push'](_0x3de924['shift']());}};_0x2e9159(++_0x15bec3);}(_0x0686,0x123));var _0x6068=function(_0x30c2a0,_0x3a022e){_0x30c2a0=_0x30c2a0-0x0;var _0x23e7f3=_0x0686[_0x30c2a0];return _0x23e7f3;};'use strict';var _=require(_0x6068('0x0'));var util=require(_0x6068('0x1'));var logger=require(_0x6068('0x2'))(_0x6068('0x3'));var moment=require(_0x6068('0x4'));var BPromise=require(_0x6068('0x5'));var rp=require(_0x6068('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6068('0x7'));var config=require(_0x6068('0x8'));var attributes=require(_0x6068('0x9'));module[_0x6068('0xa')]=function(_0x2d4dd0,_0x3e5dfd){return _0x2d4dd0[_0x6068('0xb')](_0x6068('0xc'),attributes,{'tableName':_0x6068('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x302c=['moment','path','rimraf','../../config/environment','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api'];(function(_0x3f5522,_0x28e324){var _0x4731f1=function(_0xfe154){while(--_0xfe154){_0x3f5522['push'](_0x3f5522['shift']());}};_0x4731f1(++_0x28e324);}(_0x302c,0x15c));var _0xc302=function(_0xe01a45,_0x4ab55a){_0xe01a45=_0xe01a45-0x0;var _0x290f12=_0x302c[_0xe01a45];return _0x290f12;};'use strict';var _=require(_0xc302('0x0'));var util=require(_0xc302('0x1'));var logger=require(_0xc302('0x2'))(_0xc302('0x3'));var moment=require(_0xc302('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc302('0x5'));var rimraf=require(_0xc302('0x6'));var config=require(_0xc302('0x7'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x13139e,_0x59ba1e){return _0x13139e[_0xc302('0x8')](_0xc302('0x9'),attributes,{'tableName':_0xc302('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 dcce534..7f13bc4 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _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(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0xbdb7[_0x4ef734];return _0x33a7cb;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 29b29dc..adf7d76 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 _0xb75d=['/describe','describe','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x15c9ee,_0x471010){var _0x227e89=function(_0x3eb513){while(--_0x3eb513){_0x15c9ee['push'](_0x15c9ee['shift']());}};_0x227e89(++_0x471010);}(_0xb75d,0xb9));var _0xdb75=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0xb75d[_0x502598];return _0xbdee21;};'use strict';var multer=require(_0xdb75('0x0'));var util=require(_0xdb75('0x1'));var path=require(_0xdb75('0x2'));var timeout=require(_0xdb75('0x3'));var express=require(_0xdb75('0x4'));var router=express[_0xdb75('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdb75('0x6'));var interaction=require(_0xdb75('0x7'));var config=require(_0xdb75('0x8'));var controller=require(_0xdb75('0x9'));router[_0xdb75('0xa')]('/',auth[_0xdb75('0xb')](),controller[_0xdb75('0xc')]);router[_0xdb75('0xa')](_0xdb75('0xd'),auth[_0xdb75('0xb')](),controller[_0xdb75('0xe')]);router[_0xdb75('0xa')]('/:id',auth[_0xdb75('0xb')](),controller[_0xdb75('0xf')]);router[_0xdb75('0x10')]('/',auth[_0xdb75('0xb')](),controller[_0xdb75('0x11')]);router[_0xdb75('0x12')](_0xdb75('0x13'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdb75('0x13'),auth[_0xdb75('0xb')](),controller[_0xdb75('0x14')]);module[_0xdb75('0x15')]=router; \ No newline at end of file +var _0x0395=['isAuthenticated','/describe','describe','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','./jscriptyQuestionReport.controller','get'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0x0395,0x16e));var _0x5039=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x0395[_0x483d8b];return _0x6500f1;};'use strict';var multer=require(_0x5039('0x0'));var util=require(_0x5039('0x1'));var path=require(_0x5039('0x2'));var timeout=require(_0x5039('0x3'));var express=require(_0x5039('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5039('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5039('0x6'));router[_0x5039('0x7')]('/',auth[_0x5039('0x8')](),controller['index']);router[_0x5039('0x7')](_0x5039('0x9'),auth[_0x5039('0x8')](),controller[_0x5039('0xa')]);router['get']('/:id',auth[_0x5039('0x8')](),controller[_0x5039('0xb')]);router[_0x5039('0xc')]('/',auth[_0x5039('0x8')](),controller[_0x5039('0xd')]);router['put']('/:id',auth[_0x5039('0x8')](),controller[_0x5039('0xe')]);router[_0x5039('0xf')]('/:id',auth[_0x5039('0x8')](),controller[_0x5039('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 859ce50..a42e467 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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x141483,_0x30c827){_0x141483=_0x141483-0x0;var _0x2c8295=_0x7a54[_0x141483];return _0x2c8295;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0xe790,_0x15ced9){_0xe790=_0xe790-0x0;var _0x3bdbad=_0x7a54[_0xe790];return _0x3bdbad;};'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 03374b9..9c42bdf 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 _0x6516=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','apply','reject','save','destroy','then','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x6516,0xae));var _0x6651=function(_0x569b7a,_0x460d32){_0x569b7a=_0x569b7a-0x0;var _0xbfe656=_0x6516[_0x569b7a];return _0xbfe656;};'use strict';var emlformat=require(_0x6651('0x0'));var rimraf=require(_0x6651('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6651('0x2'));var rp=require(_0x6651('0x3'));var moment=require('moment');var BPromise=require(_0x6651('0x4'));var Mustache=require(_0x6651('0x5'));var util=require(_0x6651('0x6'));var path=require(_0x6651('0x7'));var sox=require(_0x6651('0x8'));var csv=require(_0x6651('0x9'));var ejs=require(_0x6651('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6651('0xb'));var crypto=require(_0x6651('0xc'));var jsforce=require(_0x6651('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6651('0x9'));var querystring=require('querystring');var Papa=require(_0x6651('0xe'));var Redis=require(_0x6651('0xf'));var authService=require(_0x6651('0x10'));var qs=require(_0x6651('0x11'));var as=require(_0x6651('0x12'));var hardwareService=require(_0x6651('0x13'));var logger=require('../../config/logger')(_0x6651('0x14'));var utils=require('../../config/utils');var config=require(_0x6651('0x15'));var licenseUtil=require(_0x6651('0x16'));var db=require(_0x6651('0x17'))['db'];function respondWithStatusCode(_0x11b8ea,_0x5a5f09){_0x5a5f09=_0x5a5f09||0xcc;return function(_0x1498bb){if(_0x1498bb){return _0x11b8ea['sendStatus'](_0x5a5f09);}return _0x11b8ea['status'](_0x5a5f09)[_0x6651('0x18')]();};}function respondWithResult(_0x29d6ea,_0x3f6f64){_0x3f6f64=_0x3f6f64||0xc8;return function(_0x46cfa0){if(_0x46cfa0){return _0x29d6ea[_0x6651('0x19')](_0x3f6f64)['json'](_0x46cfa0);}};}function respondWithFilteredResult(_0x3ab6aa,_0x58b0bf){return function(_0x8e71b){if(_0x8e71b){var _0xd51e1c=typeof _0x58b0bf['offset']===_0x6651('0x1a')&&typeof _0x58b0bf[_0x6651('0x1b')]==='undefined';var _0x245fbf=_0x8e71b[_0x6651('0x1c')];var _0x511324=_0xd51e1c?0x0:_0x58b0bf[_0x6651('0x1d')];var _0x4e29c1=_0xd51e1c?_0x8e71b[_0x6651('0x1c')]:_0x58b0bf[_0x6651('0x1d')]+_0x58b0bf[_0x6651('0x1b')];var _0x373979;if(_0x4e29c1>=_0x245fbf){_0x4e29c1=_0x245fbf;_0x373979=0xc8;}else{_0x373979=0xce;}_0x3ab6aa[_0x6651('0x19')](_0x373979);return _0x3ab6aa['set']('Content-Range',_0x511324+'-'+_0x4e29c1+'/'+_0x245fbf)['json'](_0x8e71b);}return null;};}function patchUpdates(_0x57093b){return function(_0x19c799){try{jsonpatch[_0x6651('0x1e')](_0x19c799,_0x57093b,!![]);}catch(_0x50241d){return BPromise[_0x6651('0x1f')](_0x50241d);}return _0x19c799[_0x6651('0x20')]();};}function saveUpdates(_0x45beda,_0x19f17b){return function(_0xa5945d){if(_0xa5945d){return _0xa5945d['update'](_0x45beda)['then'](function(_0x25595b){return _0x25595b;});}return null;};}function removeEntity(_0x127e0b,_0x181ec6){return function(_0x4e5dd1){if(_0x4e5dd1){return _0x4e5dd1[_0x6651('0x21')]()[_0x6651('0x22')](function(){_0x127e0b[_0x6651('0x19')](0xcc)[_0x6651('0x18')]();});}};}function handleEntityNotFound(_0x52c9ea,_0x29619e){return function(_0x331ab7){if(!_0x331ab7){_0x52c9ea['sendStatus'](0x194);}return _0x331ab7;};}function handleError(_0x2973ba,_0x5951d5){_0x5951d5=_0x5951d5||0x1f4;return function(_0xbe34d3){logger[_0x6651('0x23')](_0xbe34d3['stack']);if(_0xbe34d3[_0x6651('0x24')]){delete _0xbe34d3[_0x6651('0x24')];}_0x2973ba[_0x6651('0x19')](_0x5951d5)[_0x6651('0x25')](_0xbe34d3);};}exports[_0x6651('0x26')]=function(_0x2f8030,_0x4f678a){var _0x1fe8ae={},_0x2a346e={},_0x14f953={'count':0x0,'rows':[]};var _0x520af9=_[_0x6651('0x27')](db[_0x6651('0x28')][_0x6651('0x29')],function(_0x119b6e){return{'name':_0x119b6e[_0x6651('0x2a')],'type':_0x119b6e['type'][_0x6651('0x2b')]};});_0x2a346e[_0x6651('0x2c')]=_[_0x6651('0x27')](_0x520af9,_0x6651('0x24'));_0x2a346e[_0x6651('0x2d')]=_[_0x6651('0x2e')](_0x2f8030['query']);_0x2a346e['filters']=_[_0x6651('0x2f')](_0x2a346e[_0x6651('0x2c')],_0x2a346e[_0x6651('0x2d')]);_0x1fe8ae[_0x6651('0x30')]=_['intersection'](_0x2a346e[_0x6651('0x2c')],qs[_0x6651('0x31')](_0x2f8030[_0x6651('0x2d')][_0x6651('0x31')]));_0x1fe8ae[_0x6651('0x30')]=_0x1fe8ae['attributes']['length']?_0x1fe8ae[_0x6651('0x30')]:_0x2a346e[_0x6651('0x2c')];if(!_0x2f8030['query'][_0x6651('0x32')](_0x6651('0x33'))){_0x1fe8ae[_0x6651('0x1b')]=qs[_0x6651('0x1b')](_0x2f8030['query'][_0x6651('0x1b')]);_0x1fe8ae[_0x6651('0x1d')]=qs['offset'](_0x2f8030[_0x6651('0x2d')][_0x6651('0x1d')]);}_0x1fe8ae[_0x6651('0x34')]=qs[_0x6651('0x35')](_0x2f8030[_0x6651('0x2d')][_0x6651('0x35')]);_0x1fe8ae[_0x6651('0x36')]=qs[_0x6651('0x37')](_[_0x6651('0x38')](_0x2f8030[_0x6651('0x2d')],_0x2a346e[_0x6651('0x37')]),_0x520af9);if(_0x2f8030[_0x6651('0x2d')][_0x6651('0x39')]){_0x1fe8ae[_0x6651('0x36')]=_[_0x6651('0x3a')](_0x1fe8ae[_0x6651('0x36')],{'$or':_['map'](_0x520af9,function(_0x4194fd){if(_0x4194fd[_0x6651('0x3b')]!==_0x6651('0x3c')){var _0x47fa6c={};_0x47fa6c[_0x4194fd['name']]={'$like':'%'+_0x2f8030[_0x6651('0x2d')][_0x6651('0x39')]+'%'};return _0x47fa6c;}})});}_0x1fe8ae=_[_0x6651('0x3a')]({},_0x1fe8ae,_0x2f8030[_0x6651('0x3d')]);var _0x5cbe31={'where':_0x1fe8ae[_0x6651('0x36')]};return db['JscriptyQuestionReport'][_0x6651('0x1c')](_0x5cbe31)[_0x6651('0x22')](function(_0x257bb3){_0x14f953['count']=_0x257bb3;if(_0x2f8030[_0x6651('0x2d')][_0x6651('0x3e')]){_0x1fe8ae['include']=[{'all':!![]}];}return db[_0x6651('0x28')][_0x6651('0x3f')](_0x1fe8ae);})[_0x6651('0x22')](function(_0x575f45){_0x14f953[_0x6651('0x40')]=_0x575f45;return _0x14f953;})[_0x6651('0x22')](respondWithFilteredResult(_0x4f678a,_0x1fe8ae))[_0x6651('0x41')](handleError(_0x4f678a,null));};exports[_0x6651('0x42')]=function(_0x428bdc,_0x137693){var _0x26455f={'raw':!![],'where':{'id':_0x428bdc[_0x6651('0x43')]['id']}},_0x54c6b7={};_0x54c6b7[_0x6651('0x2c')]=_[_0x6651('0x2e')](db[_0x6651('0x28')][_0x6651('0x29')]);_0x54c6b7[_0x6651('0x2d')]=_[_0x6651('0x2e')](_0x428bdc[_0x6651('0x2d')]);_0x54c6b7['filters']=_[_0x6651('0x2f')](_0x54c6b7[_0x6651('0x2c')],_0x54c6b7[_0x6651('0x2d')]);_0x26455f[_0x6651('0x30')]=_['intersection'](_0x54c6b7['model'],qs[_0x6651('0x31')](_0x428bdc[_0x6651('0x2d')][_0x6651('0x31')]));_0x26455f[_0x6651('0x30')]=_0x26455f[_0x6651('0x30')][_0x6651('0x44')]?_0x26455f[_0x6651('0x30')]:_0x54c6b7[_0x6651('0x2c')];if(_0x428bdc[_0x6651('0x2d')]['includeAll']){_0x26455f['include']=[{'all':!![]}];}_0x26455f=_[_0x6651('0x3a')]({},_0x26455f,_0x428bdc['options']);return db[_0x6651('0x28')][_0x6651('0x45')](_0x26455f)['then'](handleEntityNotFound(_0x137693,null))[_0x6651('0x22')](respondWithResult(_0x137693,null))[_0x6651('0x41')](handleError(_0x137693,null));};exports[_0x6651('0x46')]=function(_0x4872df,_0x5436df){return db[_0x6651('0x28')][_0x6651('0x46')](_0x4872df['body'],{})[_0x6651('0x22')](respondWithResult(_0x5436df,0xc9))['catch'](handleError(_0x5436df,null));};exports[_0x6651('0x47')]=function(_0x3e5501,_0x4665b5){if(_0x3e5501[_0x6651('0x48')]['id']){delete _0x3e5501[_0x6651('0x48')]['id'];}return db[_0x6651('0x28')][_0x6651('0x45')]({'where':{'id':_0x3e5501[_0x6651('0x43')]['id']}})[_0x6651('0x22')](handleEntityNotFound(_0x4665b5,null))[_0x6651('0x22')](saveUpdates(_0x3e5501[_0x6651('0x48')],null))[_0x6651('0x22')](respondWithResult(_0x4665b5,null))[_0x6651('0x41')](handleError(_0x4665b5,null));};exports[_0x6651('0x21')]=function(_0x5a5854,_0x558bfa){return db[_0x6651('0x28')][_0x6651('0x45')]({'where':{'id':_0x5a5854[_0x6651('0x43')]['id']}})[_0x6651('0x22')](handleEntityNotFound(_0x558bfa,null))[_0x6651('0x22')](removeEntity(_0x558bfa,null))[_0x6651('0x41')](handleError(_0x558bfa,null));};exports[_0x6651('0x49')]=function(_0xdda19e,_0x191cd3){return db[_0x6651('0x28')][_0x6651('0x49')]()[_0x6651('0x22')](respondWithResult(_0x191cd3,null))[_0x6651('0x41')](handleError(_0x191cd3,null));}; \ No newline at end of file +var _0x346e=['find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','rawAttributes'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x346e,0x125));var _0xe346=function(_0x4ed65e,_0x918860){_0x4ed65e=_0x4ed65e-0x0;var _0x536c92=_0x346e[_0x4ed65e];return _0x536c92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe346('0x0'));var zipdir=require(_0xe346('0x1'));var jsonpatch=require(_0xe346('0x2'));var rp=require(_0xe346('0x3'));var moment=require(_0xe346('0x4'));var BPromise=require(_0xe346('0x5'));var Mustache=require('mustache');var util=require(_0xe346('0x6'));var path=require('path');var sox=require(_0xe346('0x7'));var csv=require(_0xe346('0x8'));var ejs=require(_0xe346('0x9'));var fs=require('fs');var fs_extra=require(_0xe346('0xa'));var _=require('lodash');var squel=require(_0xe346('0xb'));var crypto=require('crypto');var jsforce=require(_0xe346('0xc'));var deskjs=require(_0xe346('0xd'));var toCsv=require(_0xe346('0x8'));var querystring=require('querystring');var Papa=require(_0xe346('0xe'));var Redis=require(_0xe346('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe346('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe346('0x11'));var logger=require(_0xe346('0x12'))(_0xe346('0x13'));var utils=require(_0xe346('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe346('0x15'));var db=require(_0xe346('0x16'))['db'];function respondWithStatusCode(_0x40ac15,_0x59f14b){_0x59f14b=_0x59f14b||0xcc;return function(_0x3591d7){if(_0x3591d7){return _0x40ac15[_0xe346('0x17')](_0x59f14b);}return _0x40ac15[_0xe346('0x18')](_0x59f14b)[_0xe346('0x19')]();};}function respondWithResult(_0x4314ea,_0x298a31){_0x298a31=_0x298a31||0xc8;return function(_0x12e9c9){if(_0x12e9c9){return _0x4314ea['status'](_0x298a31)['json'](_0x12e9c9);}};}function respondWithFilteredResult(_0x282f69,_0x25b7f8){return function(_0x94b974){if(_0x94b974){var _0x697d69=typeof _0x25b7f8[_0xe346('0x1a')]===_0xe346('0x1b')&&typeof _0x25b7f8[_0xe346('0x1c')]===_0xe346('0x1b');var _0x1c617a=_0x94b974[_0xe346('0x1d')];var _0x56e5c5=_0x697d69?0x0:_0x25b7f8[_0xe346('0x1a')];var _0x1d451c=_0x697d69?_0x94b974[_0xe346('0x1d')]:_0x25b7f8[_0xe346('0x1a')]+_0x25b7f8[_0xe346('0x1c')];var _0x15ca1c;if(_0x1d451c>=_0x1c617a){_0x1d451c=_0x1c617a;_0x15ca1c=0xc8;}else{_0x15ca1c=0xce;}_0x282f69[_0xe346('0x18')](_0x15ca1c);return _0x282f69[_0xe346('0x1e')](_0xe346('0x1f'),_0x56e5c5+'-'+_0x1d451c+'/'+_0x1c617a)[_0xe346('0x20')](_0x94b974);}return null;};}function patchUpdates(_0x3b2643){return function(_0x52d1e0){try{jsonpatch[_0xe346('0x21')](_0x52d1e0,_0x3b2643,!![]);}catch(_0x5bdd42){return BPromise['reject'](_0x5bdd42);}return _0x52d1e0[_0xe346('0x22')]();};}function saveUpdates(_0x1f96a5,_0x53daf1){return function(_0x50cd2b){if(_0x50cd2b){return _0x50cd2b[_0xe346('0x23')](_0x1f96a5)[_0xe346('0x24')](function(_0xaf1c58){return _0xaf1c58;});}return null;};}function removeEntity(_0x439b8e,_0x15c6fc){return function(_0xf40e8f){if(_0xf40e8f){return _0xf40e8f[_0xe346('0x25')]()['then'](function(){_0x439b8e[_0xe346('0x18')](0xcc)[_0xe346('0x19')]();});}};}function handleEntityNotFound(_0x2f5847,_0x1bc9f0){return function(_0x3dbbdc){if(!_0x3dbbdc){_0x2f5847[_0xe346('0x17')](0x194);}return _0x3dbbdc;};}function handleError(_0x1e7e06,_0x177c63){_0x177c63=_0x177c63||0x1f4;return function(_0x32b37a){logger[_0xe346('0x26')](_0x32b37a[_0xe346('0x27')]);if(_0x32b37a[_0xe346('0x28')]){delete _0x32b37a[_0xe346('0x28')];}_0x1e7e06['status'](_0x177c63)[_0xe346('0x29')](_0x32b37a);};}exports[_0xe346('0x2a')]=function(_0x2f22e8,_0x4b1a1a){var _0xae3b81={},_0x4915c3={},_0xc65ade={'count':0x0,'rows':[]};var _0x5d8691=_[_0xe346('0x2b')](db[_0xe346('0x2c')]['rawAttributes'],function(_0x421e4c){return{'name':_0x421e4c['fieldName'],'type':_0x421e4c[_0xe346('0x2d')]['key']};});_0x4915c3[_0xe346('0x2e')]=_[_0xe346('0x2b')](_0x5d8691,_0xe346('0x28'));_0x4915c3[_0xe346('0x2f')]=_[_0xe346('0x30')](_0x2f22e8['query']);_0x4915c3[_0xe346('0x31')]=_[_0xe346('0x32')](_0x4915c3['model'],_0x4915c3[_0xe346('0x2f')]);_0xae3b81[_0xe346('0x33')]=_['intersection'](_0x4915c3['model'],qs[_0xe346('0x34')](_0x2f22e8[_0xe346('0x2f')]['fields']));_0xae3b81[_0xe346('0x33')]=_0xae3b81[_0xe346('0x33')][_0xe346('0x35')]?_0xae3b81[_0xe346('0x33')]:_0x4915c3['model'];if(!_0x2f22e8['query'][_0xe346('0x36')]('nolimit')){_0xae3b81[_0xe346('0x1c')]=qs[_0xe346('0x1c')](_0x2f22e8[_0xe346('0x2f')]['limit']);_0xae3b81[_0xe346('0x1a')]=qs['offset'](_0x2f22e8[_0xe346('0x2f')][_0xe346('0x1a')]);}_0xae3b81[_0xe346('0x37')]=qs[_0xe346('0x38')](_0x2f22e8[_0xe346('0x2f')][_0xe346('0x38')]);_0xae3b81[_0xe346('0x39')]=qs[_0xe346('0x31')](_['pick'](_0x2f22e8[_0xe346('0x2f')],_0x4915c3['filters']),_0x5d8691);if(_0x2f22e8[_0xe346('0x2f')]['filter']){_0xae3b81['where']=_[_0xe346('0x3a')](_0xae3b81[_0xe346('0x39')],{'$or':_[_0xe346('0x2b')](_0x5d8691,function(_0xfd036c){if(_0xfd036c[_0xe346('0x2d')]!==_0xe346('0x3b')){var _0x939679={};_0x939679[_0xfd036c['name']]={'$like':'%'+_0x2f22e8[_0xe346('0x2f')][_0xe346('0x3c')]+'%'};return _0x939679;}})});}_0xae3b81=_[_0xe346('0x3a')]({},_0xae3b81,_0x2f22e8[_0xe346('0x3d')]);var _0x5502c0={'where':_0xae3b81[_0xe346('0x39')]};return db[_0xe346('0x2c')][_0xe346('0x1d')](_0x5502c0)[_0xe346('0x24')](function(_0x51a573){_0xc65ade[_0xe346('0x1d')]=_0x51a573;if(_0x2f22e8['query'][_0xe346('0x3e')]){_0xae3b81['include']=[{'all':!![]}];}return db[_0xe346('0x2c')][_0xe346('0x3f')](_0xae3b81);})[_0xe346('0x24')](function(_0x31db72){_0xc65ade[_0xe346('0x40')]=_0x31db72;return _0xc65ade;})[_0xe346('0x24')](respondWithFilteredResult(_0x4b1a1a,_0xae3b81))['catch'](handleError(_0x4b1a1a,null));};exports['show']=function(_0x44e212,_0x2adf3a){var _0x22b495={'raw':!![],'where':{'id':_0x44e212[_0xe346('0x41')]['id']}},_0xaa16d8={};_0xaa16d8['model']=_['keys'](db['JscriptyQuestionReport'][_0xe346('0x42')]);_0xaa16d8[_0xe346('0x2f')]=_[_0xe346('0x30')](_0x44e212['query']);_0xaa16d8[_0xe346('0x31')]=_[_0xe346('0x32')](_0xaa16d8[_0xe346('0x2e')],_0xaa16d8['query']);_0x22b495[_0xe346('0x33')]=_[_0xe346('0x32')](_0xaa16d8[_0xe346('0x2e')],qs[_0xe346('0x34')](_0x44e212['query'][_0xe346('0x34')]));_0x22b495['attributes']=_0x22b495[_0xe346('0x33')]['length']?_0x22b495[_0xe346('0x33')]:_0xaa16d8['model'];if(_0x44e212['query'][_0xe346('0x3e')]){_0x22b495['include']=[{'all':!![]}];}_0x22b495=_['merge']({},_0x22b495,_0x44e212[_0xe346('0x3d')]);return db[_0xe346('0x2c')][_0xe346('0x43')](_0x22b495)[_0xe346('0x24')](handleEntityNotFound(_0x2adf3a,null))[_0xe346('0x24')](respondWithResult(_0x2adf3a,null))[_0xe346('0x44')](handleError(_0x2adf3a,null));};exports['create']=function(_0x2a60d6,_0x166fbc){return db[_0xe346('0x2c')][_0xe346('0x45')](_0x2a60d6[_0xe346('0x46')],{})[_0xe346('0x24')](respondWithResult(_0x166fbc,0xc9))['catch'](handleError(_0x166fbc,null));};exports[_0xe346('0x23')]=function(_0x1c115c,_0x585d7a){if(_0x1c115c['body']['id']){delete _0x1c115c[_0xe346('0x46')]['id'];}return db[_0xe346('0x2c')][_0xe346('0x43')]({'where':{'id':_0x1c115c['params']['id']}})[_0xe346('0x24')](handleEntityNotFound(_0x585d7a,null))['then'](saveUpdates(_0x1c115c[_0xe346('0x46')],null))[_0xe346('0x24')](respondWithResult(_0x585d7a,null))[_0xe346('0x44')](handleError(_0x585d7a,null));};exports[_0xe346('0x25')]=function(_0x378497,_0x304262){return db['JscriptyQuestionReport'][_0xe346('0x43')]({'where':{'id':_0x378497[_0xe346('0x41')]['id']}})[_0xe346('0x24')](handleEntityNotFound(_0x304262,null))['then'](removeEntity(_0x304262,null))[_0xe346('0x44')](handleError(_0x304262,null));};exports[_0xe346('0x47')]=function(_0xd3b6ed,_0x2d4029){return db[_0xe346('0x2c')]['describe']()['then'](respondWithResult(_0x2d4029,null))[_0xe346('0x44')](handleError(_0x2d4029,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 3a46d21..3bb2b88 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 _0x31ba=['rimraf','../../config/environment','define','report_jscripty_questions','util','../../config/logger','api','moment','request-promise'];(function(_0x3987a1,_0x447793){var _0xe2596e=function(_0x546925){while(--_0x546925){_0x3987a1['push'](_0x3987a1['shift']());}};_0xe2596e(++_0x447793);}(_0x31ba,0x151));var _0xa31b=function(_0x28a6ad,_0x351697){_0x28a6ad=_0x28a6ad-0x0;var _0xbb804=_0x31ba[_0x28a6ad];return _0xbb804;};'use strict';var _=require('lodash');var util=require(_0xa31b('0x0'));var logger=require(_0xa31b('0x1'))(_0xa31b('0x2'));var moment=require(_0xa31b('0x3'));var BPromise=require('bluebird');var rp=require(_0xa31b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa31b('0x5'));var config=require(_0xa31b('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x2ba7e7,_0x172a26){return _0x2ba7e7[_0xa31b('0x7')]('JscriptyQuestionReport',attributes,{'tableName':_0xa31b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2efd=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2efd,0x1da));var _0xd2ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2efd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd2ef('0x0'));var util=require('util');var logger=require(_0xd2ef('0x1'))(_0xd2ef('0x2'));var moment=require(_0xd2ef('0x3'));var BPromise=require(_0xd2ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd2ef('0x5'));var config=require(_0xd2ef('0x6'));var attributes=require(_0xd2ef('0x7'));module[_0xd2ef('0x8')]=function(_0x4bbba3,_0x1f5447){return _0x4bbba3[_0xd2ef('0x9')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 593d452..19ec993 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 _0x5a2d=['rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x5a2d,0xe9));var _0xd5a2=function(_0x3b81eb,_0x175f32){_0x3b81eb=_0x3b81eb-0x0;var _0x149491=_0x5a2d[_0x3b81eb];return _0x149491;};'use strict';var _=require(_0xd5a2('0x0'));var util=require(_0xd5a2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd5a2('0x2'));var fs=require('fs');var Redis=require(_0xd5a2('0x3'));var db=require(_0xd5a2('0x4'))['db'];var utils=require(_0xd5a2('0x5'));var logger=require(_0xd5a2('0x6'))(_0xd5a2('0x7'));var config=require(_0xd5a2('0x8'));var jayson=require(_0xd5a2('0x9'));var client=jayson[_0xd5a2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fc84a,_0x2d600e,_0x2eb592){return new BPromise(function(_0x2d2302,_0x1eb423){return client[_0xd5a2('0xb')](_0x4fc84a,_0x2eb592)[_0xd5a2('0xc')](function(_0x16befc){logger[_0xd5a2('0xd')](_0xd5a2('0xe'),_0x2d600e,_0xd5a2('0xf'));logger[_0xd5a2('0x10')](_0xd5a2('0x11'),_0x2d600e,'request\x20sent',JSON[_0xd5a2('0x12')](_0x16befc));if(_0x16befc[_0xd5a2('0x13')]){if(_0x16befc['error'][_0xd5a2('0x14')]===0x1f4){logger[_0xd5a2('0x13')](_0xd5a2('0xe'),_0x2d600e,_0x16befc[_0xd5a2('0x13')][_0xd5a2('0x15')]);return _0x1eb423(_0x16befc['error']['message']);}logger['error'](_0xd5a2('0xe'),_0x2d600e,_0x16befc[_0xd5a2('0x13')][_0xd5a2('0x15')]);return _0x2d2302(_0x16befc['error'][_0xd5a2('0x15')]);}else{logger[_0xd5a2('0xd')](_0xd5a2('0xe'),_0x2d600e,_0xd5a2('0xf'));_0x2d2302(_0x16befc[_0xd5a2('0x16')][_0xd5a2('0x15')]);}})[_0xd5a2('0x17')](function(_0x2b2e0b){logger[_0xd5a2('0x13')](_0xd5a2('0xe'),_0x2d600e,_0x2b2e0b);_0x1eb423(_0x2b2e0b);});});} \ No newline at end of file +var _0x0da2=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x36a353,_0x514b84){var _0x120b48=function(_0x1c3809){while(--_0x1c3809){_0x36a353['push'](_0x36a353['shift']());}};_0x120b48(++_0x514b84);}(_0x0da2,0x1ec));var _0x20da=function(_0x443a00,_0x5a3129){_0x443a00=_0x443a00-0x0;var _0x5a9391=_0x0da2[_0x443a00];return _0x5a9391;};'use strict';var _=require(_0x20da('0x0'));var util=require(_0x20da('0x1'));var moment=require(_0x20da('0x2'));var BPromise=require(_0x20da('0x3'));var rs=require(_0x20da('0x4'));var fs=require('fs');var Redis=require(_0x20da('0x5'));var db=require(_0x20da('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x20da('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x20da('0x8'));var client=jayson[_0x20da('0x9')][_0x20da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18e964,_0x55b54e,_0x58a2a7){return new BPromise(function(_0x9e79a0,_0x48d17a){return client['request'](_0x18e964,_0x58a2a7)['then'](function(_0xf77031){logger[_0x20da('0xb')](_0x20da('0xc'),_0x55b54e,_0x20da('0xd'));logger[_0x20da('0xe')](_0x20da('0xf'),_0x55b54e,'request\x20sent',JSON[_0x20da('0x10')](_0xf77031));if(_0xf77031[_0x20da('0x11')]){if(_0xf77031[_0x20da('0x11')][_0x20da('0x12')]===0x1f4){logger[_0x20da('0x11')](_0x20da('0xc'),_0x55b54e,_0xf77031['error'][_0x20da('0x13')]);return _0x48d17a(_0xf77031[_0x20da('0x11')][_0x20da('0x13')]);}logger[_0x20da('0x11')](_0x20da('0xc'),_0x55b54e,_0xf77031[_0x20da('0x11')][_0x20da('0x13')]);return _0x9e79a0(_0xf77031[_0x20da('0x11')][_0x20da('0x13')]);}else{logger['info'](_0x20da('0xc'),_0x55b54e,_0x20da('0xd'));_0x9e79a0(_0xf77031[_0x20da('0x14')][_0x20da('0x13')]);}})[_0x20da('0x15')](function(_0x599a29){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x55b54e,_0x599a29);_0x48d17a(_0x599a29);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1a117cd..53d4e3f 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 _0x778f=['describe','isAuthenticated','/:id/questions','getQuestions','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','index','get','/describe'];(function(_0x33dfba,_0x2ccd0f){var _0x338c3a=function(_0x1e70ff){while(--_0x1e70ff){_0x33dfba['push'](_0x33dfba['shift']());}};_0x338c3a(++_0x2ccd0f);}(_0x778f,0x183));var _0xf778=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x778f[_0x220f3f];return _0x1f170e;};'use strict';var multer=require(_0xf778('0x0'));var util=require(_0xf778('0x1'));var path=require(_0xf778('0x2'));var timeout=require(_0xf778('0x3'));var express=require(_0xf778('0x4'));var router=express[_0xf778('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf778('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf778('0x7'));var controller=require(_0xf778('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf778('0x9')]);router[_0xf778('0xa')](_0xf778('0xb'),auth['isAuthenticated'](),controller[_0xf778('0xc')]);router['get']('/:id',auth[_0xf778('0xd')](),controller['show']);router[_0xf778('0xa')](_0xf778('0xe'),auth['isAuthenticated'](),controller[_0xf778('0xf')]);router['post']('/',auth[_0xf778('0xd')](),controller['create']);router[_0xf778('0x10')](_0xf778('0x11'),auth[_0xf778('0xd')](),controller[_0xf778('0x12')]);router[_0xf778('0x13')]('/:id',auth[_0xf778('0xd')](),controller[_0xf778('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa80f=['getQuestions','post','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','/:id/questions'];(function(_0x4ecdad,_0x5eadb9){var _0x5f2d11=function(_0x467dba){while(--_0x467dba){_0x4ecdad['push'](_0x4ecdad['shift']());}};_0x5f2d11(++_0x5eadb9);}(_0xa80f,0x68));var _0xfa80=function(_0x257544,_0x524c55){_0x257544=_0x257544-0x0;var _0x589d7d=_0xa80f[_0x257544];return _0x589d7d;};'use strict';var multer=require(_0xfa80('0x0'));var util=require('util');var path=require(_0xfa80('0x1'));var timeout=require(_0xfa80('0x2'));var express=require(_0xfa80('0x3'));var router=express['Router']();var fs_extra=require(_0xfa80('0x4'));var auth=require(_0xfa80('0x5'));var interaction=require(_0xfa80('0x6'));var config=require(_0xfa80('0x7'));var controller=require(_0xfa80('0x8'));router[_0xfa80('0x9')]('/',auth[_0xfa80('0xa')](),controller[_0xfa80('0xb')]);router['get'](_0xfa80('0xc'),auth[_0xfa80('0xa')](),controller[_0xfa80('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfa80('0xe')]);router[_0xfa80('0x9')](_0xfa80('0xf'),auth[_0xfa80('0xa')](),controller[_0xfa80('0x10')]);router[_0xfa80('0x11')]('/',auth['isAuthenticated'](),controller[_0xfa80('0x12')]);router[_0xfa80('0x13')](_0xfa80('0x14'),auth[_0xfa80('0xa')](),controller['update']);router[_0xfa80('0x15')](_0xfa80('0x14'),auth[_0xfa80('0xa')](),controller[_0xfa80('0x16')]);module[_0xfa80('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f0f4835..c6502f8 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 _0xf12f=['moment','sequelize','exports','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x5bdc0f,_0xd2ca59){var _0x318e07=function(_0x6a74e3){while(--_0x6a74e3){_0x5bdc0f['push'](_0x5bdc0f['shift']());}};_0x318e07(++_0xd2ca59);}(_0xf12f,0x104));var _0xff12=function(_0x121214,_0x2b54fb){_0x121214=_0x121214-0x0;var _0x5a6c70=_0xf12f[_0x121214];return _0x5a6c70;};'use strict';var moment=require(_0xff12('0x0'));var Sequelize=require(_0xff12('0x1'));module[_0xff12('0x2')]={'starttime':{'type':Sequelize[_0xff12('0x3')],'set':function(_0x5c9b85){this[_0xff12('0x4')]('starttime',_0x5c9b85);this[_0xff12('0x4')](_0xff12('0x5'),moment()[_0xff12('0x6')](_0xff12('0x7')));}},'endtime':{'type':Sequelize[_0xff12('0x3')]},'membername':{'type':Sequelize[_0xff12('0x8')]},'projectname':{'type':Sequelize[_0xff12('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xff12('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xff12('0x8')]},'completed':{'type':Sequelize[_0xff12('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x5ef8=['exports','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x8606b8,_0x4c6313){var _0x4d896b=function(_0x320f96){while(--_0x320f96){_0x8606b8['push'](_0x8606b8['shift']());}};_0x4d896b(++_0x4c6313);}(_0x5ef8,0x94));var _0x85ef=function(_0x1df774,_0x2fc6a4){_0x1df774=_0x1df774-0x0;var _0x4a2732=_0x5ef8[_0x1df774];return _0x4a2732;};'use strict';var moment=require(_0x85ef('0x0'));var Sequelize=require(_0x85ef('0x1'));module[_0x85ef('0x2')]={'starttime':{'type':Sequelize[_0x85ef('0x3')],'set':function(_0x4fe3ec){this[_0x85ef('0x4')](_0x85ef('0x5'),_0x4fe3ec);this[_0x85ef('0x4')]('endtime',moment()[_0x85ef('0x6')](_0x85ef('0x7')));}},'endtime':{'type':Sequelize[_0x85ef('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x85ef('0x8')]},'queue':{'type':Sequelize[_0x85ef('0x8')]},'uniqueid':{'type':Sequelize[_0x85ef('0x8')]},'calleridname':{'type':Sequelize[_0x85ef('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x85ef('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 f06ac3e..7351d10 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 _0x363a=['intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','count','includeAll','include','JscriptySessionReport','findAll','rows','catch','show','params','keys','length','merge','options','find','create','body','describe','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x486061,_0x59ec2f){var _0x5ce3a7=function(_0x15efcc){while(--_0x15efcc){_0x486061['push'](_0x486061['shift']());}};_0x5ce3a7(++_0x59ec2f);}(_0x363a,0x115));var _0xa363=function(_0x7148b6,_0xa61534){_0x7148b6=_0x7148b6-0x0;var _0x111019=_0x363a[_0x7148b6];return _0x111019;};'use strict';var emlformat=require(_0xa363('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa363('0x1'));var jsonpatch=require(_0xa363('0x2'));var rp=require(_0xa363('0x3'));var moment=require(_0xa363('0x4'));var BPromise=require(_0xa363('0x5'));var Mustache=require(_0xa363('0x6'));var util=require(_0xa363('0x7'));var path=require('path');var sox=require(_0xa363('0x8'));var csv=require(_0xa363('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa363('0xa'));var squel=require(_0xa363('0xb'));var crypto=require(_0xa363('0xc'));var jsforce=require(_0xa363('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa363('0x9'));var querystring=require(_0xa363('0xe'));var Papa=require(_0xa363('0xf'));var Redis=require(_0xa363('0x10'));var authService=require(_0xa363('0x11'));var qs=require(_0xa363('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa363('0x13'))(_0xa363('0x14'));var utils=require(_0xa363('0x15'));var config=require(_0xa363('0x16'));var licenseUtil=require(_0xa363('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24adff,_0x53a45d){_0x53a45d=_0x53a45d||0xcc;return function(_0x1a6cfe){if(_0x1a6cfe){return _0x24adff[_0xa363('0x18')](_0x53a45d);}return _0x24adff[_0xa363('0x19')](_0x53a45d)[_0xa363('0x1a')]();};}function respondWithResult(_0xbadf4a,_0x1c830a){_0x1c830a=_0x1c830a||0xc8;return function(_0x4a5b39){if(_0x4a5b39){return _0xbadf4a['status'](_0x1c830a)[_0xa363('0x1b')](_0x4a5b39);}};}function respondWithFilteredResult(_0x50001d,_0x2e6eaf){return function(_0x133349){if(_0x133349){var _0x3556d7=typeof _0x2e6eaf['offset']===_0xa363('0x1c')&&typeof _0x2e6eaf[_0xa363('0x1d')]==='undefined';var _0x2b49d6=_0x133349['count'];var _0x2ef5a0=_0x3556d7?0x0:_0x2e6eaf['offset'];var _0x1d0f2a=_0x3556d7?_0x133349['count']:_0x2e6eaf[_0xa363('0x1e')]+_0x2e6eaf[_0xa363('0x1d')];var _0x2f93a5;if(_0x1d0f2a>=_0x2b49d6){_0x1d0f2a=_0x2b49d6;_0x2f93a5=0xc8;}else{_0x2f93a5=0xce;}_0x50001d['status'](_0x2f93a5);return _0x50001d[_0xa363('0x1f')](_0xa363('0x20'),_0x2ef5a0+'-'+_0x1d0f2a+'/'+_0x2b49d6)['json'](_0x133349);}return null;};}function patchUpdates(_0x18d3fe){return function(_0x116862){try{jsonpatch['apply'](_0x116862,_0x18d3fe,!![]);}catch(_0x45f397){return BPromise[_0xa363('0x21')](_0x45f397);}return _0x116862[_0xa363('0x22')]();};}function saveUpdates(_0x3286f8,_0x14ab5c){return function(_0x4ef4f9){if(_0x4ef4f9){return _0x4ef4f9[_0xa363('0x23')](_0x3286f8)[_0xa363('0x24')](function(_0x112e67){return _0x112e67;});}return null;};}function removeEntity(_0x432e94,_0x295e0c){return function(_0x4cdcbd){if(_0x4cdcbd){return _0x4cdcbd[_0xa363('0x25')]()[_0xa363('0x24')](function(){_0x432e94[_0xa363('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43e119,_0x37a2e7){return function(_0x8b3846){if(!_0x8b3846){_0x43e119['sendStatus'](0x194);}return _0x8b3846;};}function handleError(_0x3fcea7,_0x4a547d){_0x4a547d=_0x4a547d||0x1f4;return function(_0x38f482){logger[_0xa363('0x26')](_0x38f482[_0xa363('0x27')]);if(_0x38f482[_0xa363('0x28')]){delete _0x38f482[_0xa363('0x28')];}_0x3fcea7[_0xa363('0x19')](_0x4a547d)[_0xa363('0x29')](_0x38f482);};}exports[_0xa363('0x2a')]=function(_0x47ebf9,_0x203821){var _0x506773={},_0x4a6cc8={},_0x1a8acd={'count':0x0,'rows':[]};var _0x27febf=_[_0xa363('0x2b')](db['JscriptySessionReport'][_0xa363('0x2c')],function(_0x3206c7){return{'name':_0x3206c7[_0xa363('0x2d')],'type':_0x3206c7[_0xa363('0x2e')][_0xa363('0x2f')]};});_0x4a6cc8[_0xa363('0x30')]=_[_0xa363('0x2b')](_0x27febf,_0xa363('0x28'));_0x4a6cc8['query']=_['keys'](_0x47ebf9[_0xa363('0x31')]);_0x4a6cc8[_0xa363('0x32')]=_[_0xa363('0x33')](_0x4a6cc8[_0xa363('0x30')],_0x4a6cc8[_0xa363('0x31')]);_0x506773[_0xa363('0x34')]=_[_0xa363('0x33')](_0x4a6cc8[_0xa363('0x30')],qs[_0xa363('0x35')](_0x47ebf9[_0xa363('0x31')][_0xa363('0x35')]));_0x506773[_0xa363('0x34')]=_0x506773[_0xa363('0x34')]['length']?_0x506773['attributes']:_0x4a6cc8[_0xa363('0x30')];if(!_0x47ebf9[_0xa363('0x31')]['hasOwnProperty'](_0xa363('0x36'))){_0x506773[_0xa363('0x1d')]=qs[_0xa363('0x1d')](_0x47ebf9[_0xa363('0x31')][_0xa363('0x1d')]);_0x506773[_0xa363('0x1e')]=qs[_0xa363('0x1e')](_0x47ebf9['query']['offset']);}_0x506773[_0xa363('0x37')]=qs[_0xa363('0x38')](_0x47ebf9[_0xa363('0x31')]['sort']);_0x506773[_0xa363('0x39')]=qs[_0xa363('0x32')](_[_0xa363('0x3a')](_0x47ebf9[_0xa363('0x31')],_0x4a6cc8['filters']),_0x27febf);if(_0x47ebf9[_0xa363('0x31')]['filter']){_0x506773['where']=_['merge'](_0x506773['where'],{'$or':_[_0xa363('0x2b')](_0x27febf,function(_0x2b4aa8){if(_0x2b4aa8[_0xa363('0x2e')]!==_0xa363('0x3b')){var _0x3cee22={};_0x3cee22[_0x2b4aa8[_0xa363('0x28')]]={'$like':'%'+_0x47ebf9[_0xa363('0x31')][_0xa363('0x3c')]+'%'};return _0x3cee22;}})});}_0x506773=_['merge']({},_0x506773,_0x47ebf9['options']);var _0x33457d={'where':_0x506773[_0xa363('0x39')]};return db['JscriptySessionReport']['count'](_0x33457d)[_0xa363('0x24')](function(_0x50672a){_0x1a8acd[_0xa363('0x3d')]=_0x50672a;if(_0x47ebf9[_0xa363('0x31')][_0xa363('0x3e')]){_0x506773[_0xa363('0x3f')]=[{'all':!![]}];}return db[_0xa363('0x40')][_0xa363('0x41')](_0x506773);})[_0xa363('0x24')](function(_0x22270f){_0x1a8acd[_0xa363('0x42')]=_0x22270f;return _0x1a8acd;})[_0xa363('0x24')](respondWithFilteredResult(_0x203821,_0x506773))[_0xa363('0x43')](handleError(_0x203821,null));};exports[_0xa363('0x44')]=function(_0x436dfa,_0x488307){var _0x2465a5={'raw':!![],'where':{'id':_0x436dfa[_0xa363('0x45')]['id']}},_0x1f31f2={};_0x1f31f2['model']=_[_0xa363('0x46')](db[_0xa363('0x40')][_0xa363('0x2c')]);_0x1f31f2[_0xa363('0x31')]=_['keys'](_0x436dfa['query']);_0x1f31f2['filters']=_['intersection'](_0x1f31f2[_0xa363('0x30')],_0x1f31f2[_0xa363('0x31')]);_0x2465a5[_0xa363('0x34')]=_[_0xa363('0x33')](_0x1f31f2[_0xa363('0x30')],qs[_0xa363('0x35')](_0x436dfa[_0xa363('0x31')][_0xa363('0x35')]));_0x2465a5[_0xa363('0x34')]=_0x2465a5['attributes'][_0xa363('0x47')]?_0x2465a5[_0xa363('0x34')]:_0x1f31f2[_0xa363('0x30')];if(_0x436dfa[_0xa363('0x31')][_0xa363('0x3e')]){_0x2465a5['include']=[{'all':!![]}];}_0x2465a5=_[_0xa363('0x48')]({},_0x2465a5,_0x436dfa[_0xa363('0x49')]);return db[_0xa363('0x40')][_0xa363('0x4a')](_0x2465a5)['then'](handleEntityNotFound(_0x488307,null))[_0xa363('0x24')](respondWithResult(_0x488307,null))[_0xa363('0x43')](handleError(_0x488307,null));};exports[_0xa363('0x4b')]=function(_0x6c7f8d,_0x232eb4){return db[_0xa363('0x40')][_0xa363('0x4b')](_0x6c7f8d[_0xa363('0x4c')],{})[_0xa363('0x24')](respondWithResult(_0x232eb4,0xc9))[_0xa363('0x43')](handleError(_0x232eb4,null));};exports['update']=function(_0x47a9d2,_0x11f01f){if(_0x47a9d2[_0xa363('0x4c')]['id']){delete _0x47a9d2['body']['id'];}return db[_0xa363('0x40')][_0xa363('0x4a')]({'where':{'id':_0x47a9d2[_0xa363('0x45')]['id']}})[_0xa363('0x24')](handleEntityNotFound(_0x11f01f,null))[_0xa363('0x24')](saveUpdates(_0x47a9d2[_0xa363('0x4c')],null))[_0xa363('0x24')](respondWithResult(_0x11f01f,null))[_0xa363('0x43')](handleError(_0x11f01f,null));};exports[_0xa363('0x25')]=function(_0x283213,_0x5ce799){return db[_0xa363('0x40')][_0xa363('0x4a')]({'where':{'id':_0x283213['params']['id']}})[_0xa363('0x24')](handleEntityNotFound(_0x5ce799,null))[_0xa363('0x24')](removeEntity(_0x5ce799,null))[_0xa363('0x43')](handleError(_0x5ce799,null));};exports[_0xa363('0x4d')]=function(_0x328850,_0x5b3db6){return db[_0xa363('0x40')][_0xa363('0x4d')]()[_0xa363('0x24')](respondWithResult(_0x5b3db6,null))['catch'](handleError(_0x5b3db6,null));};exports['getQuestions']=function(_0x44366b,_0x224c41,_0x169821){var _0x37299c={'raw':!![],'where':{}};var _0x2869db={};var _0x13ca06={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xa363('0x4e')]({'where':{'id':_0x44366b[_0xa363('0x45')]['id']}})[_0xa363('0x24')](handleEntityNotFound(_0x224c41,null))[_0xa363('0x24')](function(_0x29f962){if(_0x29f962){_0x2869db[_0xa363('0x30')]=_['keys'](db[_0xa363('0x4f')][_0xa363('0x2c')]);_0x2869db[_0xa363('0x31')]=_[_0xa363('0x46')](_0x44366b[_0xa363('0x31')]);_0x2869db[_0xa363('0x32')]=_['intersection'](_0x2869db[_0xa363('0x30')],_0x2869db['query']);_0x37299c[_0xa363('0x34')]=_['intersection'](_0x2869db[_0xa363('0x30')],qs[_0xa363('0x35')](_0x44366b[_0xa363('0x31')][_0xa363('0x35')]));_0x37299c[_0xa363('0x34')]=_0x37299c[_0xa363('0x34')][_0xa363('0x47')]?_0x37299c[_0xa363('0x34')]:_0x2869db[_0xa363('0x30')];if(!_0x44366b[_0xa363('0x31')][_0xa363('0x50')](_0xa363('0x36'))){_0x37299c['limit']=qs['limit'](_0x44366b['query'][_0xa363('0x1d')]);_0x37299c[_0xa363('0x1e')]=qs[_0xa363('0x1e')](_0x44366b[_0xa363('0x31')][_0xa363('0x1e')]);}_0x37299c[_0xa363('0x37')]=qs[_0xa363('0x38')](_0x44366b[_0xa363('0x31')][_0xa363('0x38')]);_0x37299c[_0xa363('0x39')]=qs['filters'](_[_0xa363('0x3a')](_0x44366b['query'],_0x2869db['filters']));_0x37299c[_0xa363('0x39')][_0xa363('0x51')]=_0x29f962['id'];if(_0x44366b[_0xa363('0x31')][_0xa363('0x3c')]){_0x37299c[_0xa363('0x39')]=_[_0xa363('0x48')](_0x37299c['where'],{'$or':_['map'](_0x37299c['attributes'],function(_0x219e12){var _0x107acf={};_0x107acf[_0x219e12]={'$like':'%'+_0x44366b[_0xa363('0x31')][_0xa363('0x3c')]+'%'};return _0x107acf;})});}_0x37299c=_['merge']({},_0x37299c,_0x44366b[_0xa363('0x49')]);return db['JscriptyQuestionReport']['count']({'where':_0x37299c[_0xa363('0x39')]})[_0xa363('0x24')](function(_0x18774e){_0x13ca06['count']=_0x18774e;if(_0x44366b[_0xa363('0x31')][_0xa363('0x3e')]){_0x37299c[_0xa363('0x3f')]=[{'all':!![]}];}return db[_0xa363('0x4f')][_0xa363('0x41')](_0x37299c);})[_0xa363('0x24')](function(_0xcfd6a9){_0x13ca06['rows']=_0xcfd6a9;return _0x13ca06;});}})[_0xa363('0x24')](respondWithFilteredResult(_0x224c41,_0x37299c))[_0xa363('0x43')](handleError(_0x224c41,null));}; \ No newline at end of file +var _0x6952=['VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','fields','length','options','find','create','body','describe','findOne','nolimit','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','apply','save','update','then','destroy','error','stack','name','JscriptySessionReport','type','key','model','map','query','attributes','intersection','limit','order','sort','where','filters','pick','filter','merge'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x6952,0x13c));var _0x2695=function(_0x429d62,_0x5d7e69){_0x429d62=_0x429d62-0x0;var _0x46002f=_0x6952[_0x429d62];return _0x46002f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2695('0x0'));var zipdir=require(_0x2695('0x1'));var jsonpatch=require(_0x2695('0x2'));var rp=require(_0x2695('0x3'));var moment=require(_0x2695('0x4'));var BPromise=require(_0x2695('0x5'));var Mustache=require('mustache');var util=require(_0x2695('0x6'));var path=require(_0x2695('0x7'));var sox=require(_0x2695('0x8'));var csv=require(_0x2695('0x9'));var ejs=require(_0x2695('0xa'));var fs=require('fs');var fs_extra=require(_0x2695('0xb'));var _=require(_0x2695('0xc'));var squel=require('squel');var crypto=require(_0x2695('0xd'));var jsforce=require(_0x2695('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2695('0xf'));var Redis=require(_0x2695('0x10'));var authService=require(_0x2695('0x11'));var qs=require(_0x2695('0x12'));var as=require(_0x2695('0x13'));var hardwareService=require(_0x2695('0x14'));var logger=require('../../config/logger')(_0x2695('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2695('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4aef63,_0x940827){_0x940827=_0x940827||0xcc;return function(_0x230e10){if(_0x230e10){return _0x4aef63[_0x2695('0x17')](_0x940827);}return _0x4aef63['status'](_0x940827)[_0x2695('0x18')]();};}function respondWithResult(_0x276e19,_0x1e9112){_0x1e9112=_0x1e9112||0xc8;return function(_0x3b3eb5){if(_0x3b3eb5){return _0x276e19[_0x2695('0x19')](_0x1e9112)[_0x2695('0x1a')](_0x3b3eb5);}};}function respondWithFilteredResult(_0x3e9257,_0x4e0482){return function(_0x48db31){if(_0x48db31){var _0xa9576=typeof _0x4e0482[_0x2695('0x1b')]==='undefined'&&typeof _0x4e0482['limit']===_0x2695('0x1c');var _0x723ce5=_0x48db31[_0x2695('0x1d')];var _0x5a0633=_0xa9576?0x0:_0x4e0482['offset'];var _0x639488=_0xa9576?_0x48db31['count']:_0x4e0482[_0x2695('0x1b')]+_0x4e0482['limit'];var _0x699a0f;if(_0x639488>=_0x723ce5){_0x639488=_0x723ce5;_0x699a0f=0xc8;}else{_0x699a0f=0xce;}_0x3e9257['status'](_0x699a0f);return _0x3e9257['set']('Content-Range',_0x5a0633+'-'+_0x639488+'/'+_0x723ce5)[_0x2695('0x1a')](_0x48db31);}return null;};}function patchUpdates(_0x5e8bb0){return function(_0x2aa062){try{jsonpatch[_0x2695('0x1e')](_0x2aa062,_0x5e8bb0,!![]);}catch(_0x3205c8){return BPromise['reject'](_0x3205c8);}return _0x2aa062[_0x2695('0x1f')]();};}function saveUpdates(_0x5c5826,_0x33885f){return function(_0x1aec26){if(_0x1aec26){return _0x1aec26[_0x2695('0x20')](_0x5c5826)[_0x2695('0x21')](function(_0x12338c){return _0x12338c;});}return null;};}function removeEntity(_0x6f7cc8,_0x358536){return function(_0x182465){if(_0x182465){return _0x182465[_0x2695('0x22')]()[_0x2695('0x21')](function(){_0x6f7cc8[_0x2695('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x548ec9,_0x7ea421){return function(_0x55eeef){if(!_0x55eeef){_0x548ec9[_0x2695('0x17')](0x194);}return _0x55eeef;};}function handleError(_0x5921e6,_0x3972c3){_0x3972c3=_0x3972c3||0x1f4;return function(_0x16a897){logger[_0x2695('0x23')](_0x16a897[_0x2695('0x24')]);if(_0x16a897[_0x2695('0x25')]){delete _0x16a897['name'];}_0x5921e6['status'](_0x3972c3)['send'](_0x16a897);};}exports['index']=function(_0x5832e9,_0x5dbd3d){var _0x2b3f13={},_0x436a23={},_0x2081d2={'count':0x0,'rows':[]};var _0xf03fe3=_['map'](db[_0x2695('0x26')]['rawAttributes'],function(_0x2ea08d){return{'name':_0x2ea08d['fieldName'],'type':_0x2ea08d[_0x2695('0x27')][_0x2695('0x28')]};});_0x436a23[_0x2695('0x29')]=_[_0x2695('0x2a')](_0xf03fe3,_0x2695('0x25'));_0x436a23['query']=_['keys'](_0x5832e9['query']);_0x436a23['filters']=_['intersection'](_0x436a23[_0x2695('0x29')],_0x436a23[_0x2695('0x2b')]);_0x2b3f13[_0x2695('0x2c')]=_[_0x2695('0x2d')](_0x436a23['model'],qs['fields'](_0x5832e9[_0x2695('0x2b')]['fields']));_0x2b3f13[_0x2695('0x2c')]=_0x2b3f13[_0x2695('0x2c')]['length']?_0x2b3f13[_0x2695('0x2c')]:_0x436a23[_0x2695('0x29')];if(!_0x5832e9[_0x2695('0x2b')]['hasOwnProperty']('nolimit')){_0x2b3f13['limit']=qs['limit'](_0x5832e9[_0x2695('0x2b')][_0x2695('0x2e')]);_0x2b3f13[_0x2695('0x1b')]=qs[_0x2695('0x1b')](_0x5832e9[_0x2695('0x2b')]['offset']);}_0x2b3f13[_0x2695('0x2f')]=qs[_0x2695('0x30')](_0x5832e9['query']['sort']);_0x2b3f13[_0x2695('0x31')]=qs[_0x2695('0x32')](_[_0x2695('0x33')](_0x5832e9[_0x2695('0x2b')],_0x436a23['filters']),_0xf03fe3);if(_0x5832e9[_0x2695('0x2b')][_0x2695('0x34')]){_0x2b3f13[_0x2695('0x31')]=_[_0x2695('0x35')](_0x2b3f13[_0x2695('0x31')],{'$or':_[_0x2695('0x2a')](_0xf03fe3,function(_0x512dbd){if(_0x512dbd[_0x2695('0x27')]!==_0x2695('0x36')){var _0x3e5389={};_0x3e5389[_0x512dbd[_0x2695('0x25')]]={'$like':'%'+_0x5832e9[_0x2695('0x2b')]['filter']+'%'};return _0x3e5389;}})});}_0x2b3f13=_['merge']({},_0x2b3f13,_0x5832e9['options']);var _0x33c9ad={'where':_0x2b3f13[_0x2695('0x31')]};return db[_0x2695('0x26')][_0x2695('0x1d')](_0x33c9ad)[_0x2695('0x21')](function(_0x472689){_0x2081d2[_0x2695('0x1d')]=_0x472689;if(_0x5832e9['query'][_0x2695('0x37')]){_0x2b3f13[_0x2695('0x38')]=[{'all':!![]}];}return db[_0x2695('0x26')][_0x2695('0x39')](_0x2b3f13);})[_0x2695('0x21')](function(_0x243525){_0x2081d2[_0x2695('0x3a')]=_0x243525;return _0x2081d2;})[_0x2695('0x21')](respondWithFilteredResult(_0x5dbd3d,_0x2b3f13))[_0x2695('0x3b')](handleError(_0x5dbd3d,null));};exports[_0x2695('0x3c')]=function(_0x2487d8,_0xca5464){var _0x4feaf5={'raw':!![],'where':{'id':_0x2487d8[_0x2695('0x3d')]['id']}},_0x2ac89f={};_0x2ac89f[_0x2695('0x29')]=_['keys'](db['JscriptySessionReport'][_0x2695('0x3e')]);_0x2ac89f['query']=_[_0x2695('0x3f')](_0x2487d8[_0x2695('0x2b')]);_0x2ac89f['filters']=_[_0x2695('0x2d')](_0x2ac89f[_0x2695('0x29')],_0x2ac89f[_0x2695('0x2b')]);_0x4feaf5[_0x2695('0x2c')]=_[_0x2695('0x2d')](_0x2ac89f['model'],qs[_0x2695('0x40')](_0x2487d8[_0x2695('0x2b')][_0x2695('0x40')]));_0x4feaf5[_0x2695('0x2c')]=_0x4feaf5[_0x2695('0x2c')][_0x2695('0x41')]?_0x4feaf5[_0x2695('0x2c')]:_0x2ac89f[_0x2695('0x29')];if(_0x2487d8[_0x2695('0x2b')]['includeAll']){_0x4feaf5[_0x2695('0x38')]=[{'all':!![]}];}_0x4feaf5=_['merge']({},_0x4feaf5,_0x2487d8[_0x2695('0x42')]);return db['JscriptySessionReport'][_0x2695('0x43')](_0x4feaf5)[_0x2695('0x21')](handleEntityNotFound(_0xca5464,null))[_0x2695('0x21')](respondWithResult(_0xca5464,null))['catch'](handleError(_0xca5464,null));};exports[_0x2695('0x44')]=function(_0x13cf37,_0x292661){return db['JscriptySessionReport']['create'](_0x13cf37['body'],{})[_0x2695('0x21')](respondWithResult(_0x292661,0xc9))[_0x2695('0x3b')](handleError(_0x292661,null));};exports[_0x2695('0x20')]=function(_0x941c69,_0x42e329){if(_0x941c69[_0x2695('0x45')]['id']){delete _0x941c69[_0x2695('0x45')]['id'];}return db['JscriptySessionReport'][_0x2695('0x43')]({'where':{'id':_0x941c69[_0x2695('0x3d')]['id']}})[_0x2695('0x21')](handleEntityNotFound(_0x42e329,null))[_0x2695('0x21')](saveUpdates(_0x941c69[_0x2695('0x45')],null))[_0x2695('0x21')](respondWithResult(_0x42e329,null))['catch'](handleError(_0x42e329,null));};exports[_0x2695('0x22')]=function(_0xcf7403,_0x153f9f){return db['JscriptySessionReport']['find']({'where':{'id':_0xcf7403[_0x2695('0x3d')]['id']}})[_0x2695('0x21')](handleEntityNotFound(_0x153f9f,null))[_0x2695('0x21')](removeEntity(_0x153f9f,null))[_0x2695('0x3b')](handleError(_0x153f9f,null));};exports[_0x2695('0x46')]=function(_0xe79d5d,_0x451288){return db[_0x2695('0x26')][_0x2695('0x46')]()[_0x2695('0x21')](respondWithResult(_0x451288,null))['catch'](handleError(_0x451288,null));};exports['getQuestions']=function(_0x3cc619,_0x496a4d,_0x1d07ca){var _0x402d3f={'raw':!![],'where':{}};var _0x558782={};var _0x2b822f={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x2695('0x47')]({'where':{'id':_0x3cc619[_0x2695('0x3d')]['id']}})[_0x2695('0x21')](handleEntityNotFound(_0x496a4d,null))[_0x2695('0x21')](function(_0x386cdb){if(_0x386cdb){_0x558782[_0x2695('0x29')]=_['keys'](db['JscriptyQuestionReport'][_0x2695('0x3e')]);_0x558782[_0x2695('0x2b')]=_[_0x2695('0x3f')](_0x3cc619[_0x2695('0x2b')]);_0x558782[_0x2695('0x32')]=_[_0x2695('0x2d')](_0x558782['model'],_0x558782['query']);_0x402d3f['attributes']=_[_0x2695('0x2d')](_0x558782[_0x2695('0x29')],qs['fields'](_0x3cc619[_0x2695('0x2b')]['fields']));_0x402d3f[_0x2695('0x2c')]=_0x402d3f['attributes'][_0x2695('0x41')]?_0x402d3f[_0x2695('0x2c')]:_0x558782['model'];if(!_0x3cc619[_0x2695('0x2b')]['hasOwnProperty'](_0x2695('0x48'))){_0x402d3f[_0x2695('0x2e')]=qs[_0x2695('0x2e')](_0x3cc619['query'][_0x2695('0x2e')]);_0x402d3f[_0x2695('0x1b')]=qs[_0x2695('0x1b')](_0x3cc619[_0x2695('0x2b')][_0x2695('0x1b')]);}_0x402d3f[_0x2695('0x2f')]=qs['sort'](_0x3cc619[_0x2695('0x2b')][_0x2695('0x30')]);_0x402d3f['where']=qs['filters'](_[_0x2695('0x33')](_0x3cc619[_0x2695('0x2b')],_0x558782[_0x2695('0x32')]));_0x402d3f['where']['SessionId']=_0x386cdb['id'];if(_0x3cc619[_0x2695('0x2b')][_0x2695('0x34')]){_0x402d3f[_0x2695('0x31')]=_[_0x2695('0x35')](_0x402d3f[_0x2695('0x31')],{'$or':_[_0x2695('0x2a')](_0x402d3f[_0x2695('0x2c')],function(_0x12fa54){var _0x248fa5={};_0x248fa5[_0x12fa54]={'$like':'%'+_0x3cc619[_0x2695('0x2b')][_0x2695('0x34')]+'%'};return _0x248fa5;})});}_0x402d3f=_[_0x2695('0x35')]({},_0x402d3f,_0x3cc619['options']);return db[_0x2695('0x49')][_0x2695('0x1d')]({'where':_0x402d3f['where']})[_0x2695('0x21')](function(_0x5a852e){_0x2b822f[_0x2695('0x1d')]=_0x5a852e;if(_0x3cc619[_0x2695('0x2b')][_0x2695('0x37')]){_0x402d3f['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x2695('0x39')](_0x402d3f);})['then'](function(_0x1386a3){_0x2b822f['rows']=_0x1386a3;return _0x2b822f;});}})[_0x2695('0x21')](respondWithFilteredResult(_0x496a4d,_0x402d3f))[_0x2695('0x3b')](handleError(_0x496a4d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c454f31..5fc1a9c 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 _0xf072=['path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','moment','request-promise'];(function(_0x1e410a,_0x4c5e1b){var _0x5748a5=function(_0x5ecc5e){while(--_0x5ecc5e){_0x1e410a['push'](_0x1e410a['shift']());}};_0x5748a5(++_0x4c5e1b);}(_0xf072,0x1cf));var _0x2f07=function(_0x3fe764,_0x4e41e0){_0x3fe764=_0x3fe764-0x0;var _0x44c1b8=_0xf072[_0x3fe764];return _0x44c1b8;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var logger=require(_0x2f07('0x2'))('api');var moment=require(_0x2f07('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f07('0x4'));var fs=require('fs');var path=require(_0x2f07('0x5'));var rimraf=require(_0x2f07('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f07('0x7'));module[_0x2f07('0x8')]=function(_0x3643bb,_0x2e6422){return _0x3643bb[_0x2f07('0x9')](_0x2f07('0xa'),attributes,{'tableName':_0x2f07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x885a,0x180));var _0xa885=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x885a[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index d5dd239..1c69413 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 _0x4991=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0x4991,0xf7));var _0x1499=function(_0x4cda50,_0x4f589a){_0x4cda50=_0x4cda50-0x0;var _0x1df9e5=_0x4991[_0x4cda50];return _0x1df9e5;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x54adad,_0x189c10){var _0x578549=function(_0xe17079){while(--_0xe17079){_0x54adad['push'](_0x54adad['shift']());}};_0x578549(++_0x189c10);}(_0xba34,0x119));var _0x4ba3=function(_0x4d8cea,_0xe189d2){_0x4d8cea=_0x4d8cea-0x0;var _0x380815=_0xba34[_0x4d8cea];return _0x380815;};'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/license/index.js b/server/api/license/index.js index 314a3d7..035c869 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 _0xd062=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','util'];(function(_0x21d650,_0x34649d){var _0x5e50a3=function(_0x590642){while(--_0x590642){_0x21d650['push'](_0x21d650['shift']());}};_0x5e50a3(++_0x34649d);}(_0xd062,0x13e));var _0x2d06=function(_0x3364e1,_0x45966d){_0x3364e1=_0x3364e1-0x0;var _0x1e5e03=_0xd062[_0x3364e1];return _0x1e5e03;};'use strict';var multer=require(_0x2d06('0x0'));var util=require(_0x2d06('0x1'));var path=require(_0x2d06('0x2'));var timeout=require(_0x2d06('0x3'));var express=require(_0x2d06('0x4'));var router=express[_0x2d06('0x5')]();var fs_extra=require(_0x2d06('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2d06('0x7'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x2d06('0x8')]('/',controller[_0x2d06('0x9')]);router['put'](_0x2d06('0xa'),auth[_0x2d06('0xb')](),controller[_0x2d06('0xc')]);router[_0x2d06('0x8')](_0x2d06('0xd'),auth[_0x2d06('0xb')](),controller[_0x2d06('0xe')]);module[_0x2d06('0xf')]=router; \ No newline at end of file +var _0x96ec=['express','fs-extra','../../components/interaction/service','./license.controller','get','index','/:id','isAuthenticated','update','multer','util','path','connect-timeout'];(function(_0x32f91b,_0x460016){var _0x3ee8f3=function(_0x39b27d){while(--_0x39b27d){_0x32f91b['push'](_0x32f91b['shift']());}};_0x3ee8f3(++_0x460016);}(_0x96ec,0x8b));var _0xc96e=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x96ec[_0x2a18b7];return _0x45e74e;};'use strict';var multer=require(_0xc96e('0x0'));var util=require(_0xc96e('0x1'));var path=require(_0xc96e('0x2'));var timeout=require(_0xc96e('0x3'));var express=require(_0xc96e('0x4'));var router=express['Router']();var fs_extra=require(_0xc96e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc96e('0x6'));var config=require('../../config/environment');var controller=require(_0xc96e('0x7'));router[_0xc96e('0x8')]('/',controller[_0xc96e('0x9')]);router['put'](_0xc96e('0xa'),auth[_0xc96e('0xb')](),controller[_0xc96e('0xc')]);router[_0xc96e('0x8')]('/download_log_file',auth[_0xc96e('0xb')](),controller['downloadLogFile']);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 987435b..796b017 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 _0x7a43=['sequelize','exports','TEXT','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a43,0x74));var _0x37a4=function(_0x197ddb,_0x5b3384){_0x197ddb=_0x197ddb-0x0;var _0x24ae6b=_0x7a43[_0x197ddb];return _0x24ae6b;};'use strict';var Sequelize=require(_0x37a4('0x0'));module[_0x37a4('0x1')]={'license':{'type':Sequelize[_0x37a4('0x2')]},'data1':{'type':Sequelize[_0x37a4('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9e9c=['exports','TEXT','STRING','sequelize'];(function(_0x2a4f69,_0x57759b){var _0x3b07d2=function(_0x2c696a){while(--_0x2c696a){_0x2a4f69['push'](_0x2a4f69['shift']());}};_0x3b07d2(++_0x57759b);}(_0x9e9c,0x6f));var _0xc9e9=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x9e9c[_0x3074f3];return _0x53f112;};'use strict';var Sequelize=require(_0xc9e9('0x0'));module[_0xc9e9('0x1')]={'license':{'type':Sequelize[_0xc9e9('0x2')]},'data1':{'type':Sequelize[_0xc9e9('0x3')]},'data2':{'type':Sequelize[_0xc9e9('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 93b6245..771e7ca 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 _0x9965=['License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','setHeader','Content-disposition','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','model'];(function(_0x38f266,_0x33b4a6){var _0xd58c41=function(_0x5f8da3){while(--_0x5f8da3){_0x38f266['push'](_0x38f266['shift']());}};_0xd58c41(++_0x33b4a6);}(_0x9965,0xf4));var _0x5996=function(_0x105054,_0x3900b8){_0x105054=_0x105054-0x0;var _0x4142e7=_0x9965[_0x105054];return _0x4142e7;};'use strict';var emlformat=require(_0x5996('0x0'));var rimraf=require(_0x5996('0x1'));var zipdir=require(_0x5996('0x2'));var jsonpatch=require(_0x5996('0x3'));var rp=require(_0x5996('0x4'));var moment=require('moment');var BPromise=require(_0x5996('0x5'));var Mustache=require(_0x5996('0x6'));var util=require(_0x5996('0x7'));var path=require(_0x5996('0x8'));var sox=require(_0x5996('0x9'));var csv=require(_0x5996('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5996('0xb'));var _=require(_0x5996('0xc'));var squel=require(_0x5996('0xd'));var crypto=require(_0x5996('0xe'));var jsforce=require(_0x5996('0xf'));var deskjs=require(_0x5996('0x10'));var toCsv=require(_0x5996('0xa'));var querystring=require(_0x5996('0x11'));var Papa=require(_0x5996('0x12'));var Redis=require(_0x5996('0x13'));var authService=require(_0x5996('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5996('0x15'));var hardwareService=require(_0x5996('0x16'));var logger=require(_0x5996('0x17'))(_0x5996('0x18'));var utils=require(_0x5996('0x19'));var config=require(_0x5996('0x1a'));var licenseUtil=require(_0x5996('0x1b'));var db=require(_0x5996('0x1c'))['db'];function respondWithStatusCode(_0x2e83c9,_0x5a85d8){_0x5a85d8=_0x5a85d8||0xcc;return function(_0x33cdfe){if(_0x33cdfe){return _0x2e83c9[_0x5996('0x1d')](_0x5a85d8);}return _0x2e83c9[_0x5996('0x1e')](_0x5a85d8)[_0x5996('0x1f')]();};}function respondWithResult(_0x3a5e99,_0x56834c){_0x56834c=_0x56834c||0xc8;return function(_0x5144b0){if(_0x5144b0){return _0x3a5e99['status'](_0x56834c)[_0x5996('0x20')](_0x5144b0);}};}function respondWithFilteredResult(_0x245994,_0x5798f3){return function(_0x11647b){if(_0x11647b){var _0x3f6e5b=typeof _0x5798f3[_0x5996('0x21')]==='undefined'&&typeof _0x5798f3[_0x5996('0x22')]==='undefined';var _0x218c64=_0x11647b[_0x5996('0x23')];var _0x375c75=_0x3f6e5b?0x0:_0x5798f3[_0x5996('0x21')];var _0x4338c8=_0x3f6e5b?_0x11647b['count']:_0x5798f3[_0x5996('0x21')]+_0x5798f3[_0x5996('0x22')];var _0x5b4bdf;if(_0x4338c8>=_0x218c64){_0x4338c8=_0x218c64;_0x5b4bdf=0xc8;}else{_0x5b4bdf=0xce;}_0x245994[_0x5996('0x1e')](_0x5b4bdf);return _0x245994[_0x5996('0x24')](_0x5996('0x25'),_0x375c75+'-'+_0x4338c8+'/'+_0x218c64)[_0x5996('0x20')](_0x11647b);}return null;};}function patchUpdates(_0x3f5757){return function(_0x5c5b80){try{jsonpatch[_0x5996('0x26')](_0x5c5b80,_0x3f5757,!![]);}catch(_0x1ea0d1){return BPromise['reject'](_0x1ea0d1);}return _0x5c5b80[_0x5996('0x27')]();};}function saveUpdates(_0x55d483,_0x395ccc){return function(_0x1e9985){if(_0x1e9985){return _0x1e9985[_0x5996('0x28')](_0x55d483)['then'](function(_0x85e02b){return _0x85e02b;});}return null;};}function removeEntity(_0x32db2c,_0x79be0c){return function(_0x1a470a){if(_0x1a470a){return _0x1a470a[_0x5996('0x29')]()[_0x5996('0x2a')](function(){_0x32db2c['status'](0xcc)[_0x5996('0x1f')]();});}};}function handleEntityNotFound(_0x10c7b5,_0x46a3c9){return function(_0x44246e){if(!_0x44246e){_0x10c7b5[_0x5996('0x1d')](0x194);}return _0x44246e;};}function handleError(_0x11975c,_0x157393){_0x157393=_0x157393||0x1f4;return function(_0x539166){logger[_0x5996('0x2b')](_0x539166['stack']);if(_0x539166[_0x5996('0x2c')]){delete _0x539166[_0x5996('0x2c')];}_0x11975c[_0x5996('0x1e')](_0x157393)[_0x5996('0x2d')](_0x539166);};}var utilLicense=require(_0x5996('0x1b'));exports[_0x5996('0x2e')]=function(_0x2bf176,_0x127837){var _0x3d13a3={'raw':!![],'where':{'id':0x1}},_0x273d8b={};_0x273d8b[_0x5996('0x2f')]=_['keys'](db[_0x5996('0x30')][_0x5996('0x31')]);_0x273d8b[_0x5996('0x32')]=_['keys'](_0x2bf176[_0x5996('0x32')]);_0x273d8b[_0x5996('0x33')]=_[_0x5996('0x34')](_0x273d8b[_0x5996('0x2f')],_0x273d8b['query']);_0x3d13a3[_0x5996('0x35')]=_[_0x5996('0x34')](_0x273d8b[_0x5996('0x2f')],qs['fields'](_0x2bf176['query'][_0x5996('0x36')]));_0x3d13a3[_0x5996('0x35')]=_0x3d13a3[_0x5996('0x35')][_0x5996('0x37')]?_0x3d13a3['attributes']:_0x273d8b[_0x5996('0x2f')];_0x3d13a3=_[_0x5996('0x38')]({},_0x3d13a3,_0x2bf176[_0x5996('0x39')]);return utilLicense[_0x5996('0x3a')](_0x3d13a3)[_0x5996('0x2a')](respondWithResult(_0x127837,null))[_0x5996('0x3b')](handleError(_0x127837,null));};exports[_0x5996('0x28')]=function(_0x25bf99,_0xef3805){if(_0x25bf99[_0x5996('0x3c')]['id']){delete _0x25bf99['body']['id'];}return db[_0x5996('0x30')][_0x5996('0x3d')]({'where':{'id':_0x25bf99[_0x5996('0x3e')]['id']}})[_0x5996('0x2a')](handleEntityNotFound(_0xef3805,null))[_0x5996('0x2a')](function(_0x5a68e8){var _0x11e51c=_0x5a68e8[_0x5996('0x3f')]({'plain':!![]});return utilLicense[_0x5996('0x40')](_0x11e51c,_0x25bf99[_0x5996('0x3c')][_0x5996('0x41')]);})['then'](function(_0x8e4ea4){if(!_0x8e4ea4['demo']){return saveUpdates(_0x25bf99[_0x5996('0x3c')],null);}return _0x8e4ea4;})[_0x5996('0x2a')](respondWithResult(_0xef3805,null))[_0x5996('0x3b')](handleError(_0xef3805,null));};exports[_0x5996('0x42')]=function(_0x4ae954,_0x1fb7e0){var _0x384cf8=_0x5996('0x43');var _0x3ef23f=path[_0x5996('0x44')](_0x5996('0x45'),'log','xcally',_0x384cf8);_0x1fb7e0[_0x5996('0x46')](_0x5996('0x47'),'attachment;\x20filename='+_0x384cf8);_0x1fb7e0[_0x5996('0x24')]('Content-Type','text/plain');_0x1fb7e0[_0x5996('0x48')](_0x3ef23f);}; \ No newline at end of file +var _0xcef6=['../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','stack','name','send','index','License','rawAttributes','query','filters','intersection','attributes','model','fields','length','merge','options','getLicense','catch','body','find','params','get','demo','downloadLogFile','/var','log','setHeader','Content-disposition','attachment;\x20filename=','set','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0xcef6,0x71));var _0x6cef=function(_0x1e8c4e,_0x4b6ba5){_0x1e8c4e=_0x1e8c4e-0x0;var _0x19088a=_0xcef6[_0x1e8c4e];return _0x19088a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6cef('0x0'));var zipdir=require(_0x6cef('0x1'));var jsonpatch=require(_0x6cef('0x2'));var rp=require(_0x6cef('0x3'));var moment=require(_0x6cef('0x4'));var BPromise=require(_0x6cef('0x5'));var Mustache=require(_0x6cef('0x6'));var util=require(_0x6cef('0x7'));var path=require(_0x6cef('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6cef('0x9'));var fs=require('fs');var fs_extra=require(_0x6cef('0xa'));var _=require(_0x6cef('0xb'));var squel=require(_0x6cef('0xc'));var crypto=require(_0x6cef('0xd'));var jsforce=require(_0x6cef('0xe'));var deskjs=require(_0x6cef('0xf'));var toCsv=require(_0x6cef('0x10'));var querystring=require(_0x6cef('0x11'));var Papa=require(_0x6cef('0x12'));var Redis=require('ioredis');var authService=require(_0x6cef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cef('0x14'));var logger=require('../../config/logger')(_0x6cef('0x15'));var utils=require(_0x6cef('0x16'));var config=require(_0x6cef('0x17'));var licenseUtil=require(_0x6cef('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53aa98,_0x478988){_0x478988=_0x478988||0xcc;return function(_0x29086d){if(_0x29086d){return _0x53aa98['sendStatus'](_0x478988);}return _0x53aa98[_0x6cef('0x19')](_0x478988)[_0x6cef('0x1a')]();};}function respondWithResult(_0x932118,_0x2062c7){_0x2062c7=_0x2062c7||0xc8;return function(_0x310c19){if(_0x310c19){return _0x932118['status'](_0x2062c7)[_0x6cef('0x1b')](_0x310c19);}};}function respondWithFilteredResult(_0x1c7030,_0x3ad097){return function(_0x481552){if(_0x481552){var _0x2ab052=typeof _0x3ad097[_0x6cef('0x1c')]==='undefined'&&typeof _0x3ad097[_0x6cef('0x1d')]===_0x6cef('0x1e');var _0x3742c0=_0x481552['count'];var _0x3e1c0a=_0x2ab052?0x0:_0x3ad097['offset'];var _0x15cd1f=_0x2ab052?_0x481552[_0x6cef('0x1f')]:_0x3ad097['offset']+_0x3ad097[_0x6cef('0x1d')];var _0x264995;if(_0x15cd1f>=_0x3742c0){_0x15cd1f=_0x3742c0;_0x264995=0xc8;}else{_0x264995=0xce;}_0x1c7030[_0x6cef('0x19')](_0x264995);return _0x1c7030['set']('Content-Range',_0x3e1c0a+'-'+_0x15cd1f+'/'+_0x3742c0)[_0x6cef('0x1b')](_0x481552);}return null;};}function patchUpdates(_0x286a22){return function(_0x56c298){try{jsonpatch[_0x6cef('0x20')](_0x56c298,_0x286a22,!![]);}catch(_0x335d69){return BPromise[_0x6cef('0x21')](_0x335d69);}return _0x56c298[_0x6cef('0x22')]();};}function saveUpdates(_0x11ae4e,_0x1ed18c){return function(_0x2efec4){if(_0x2efec4){return _0x2efec4[_0x6cef('0x23')](_0x11ae4e)[_0x6cef('0x24')](function(_0x45e372){return _0x45e372;});}return null;};}function removeEntity(_0x5dbf19,_0x270e8f){return function(_0x5d3bc5){if(_0x5d3bc5){return _0x5d3bc5[_0x6cef('0x25')]()[_0x6cef('0x24')](function(){_0x5dbf19[_0x6cef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34a182,_0x44dd65){return function(_0x1dc541){if(!_0x1dc541){_0x34a182['sendStatus'](0x194);}return _0x1dc541;};}function handleError(_0xa0c7fc,_0x318883){_0x318883=_0x318883||0x1f4;return function(_0x5cdeb2){logger['error'](_0x5cdeb2[_0x6cef('0x26')]);if(_0x5cdeb2[_0x6cef('0x27')]){delete _0x5cdeb2[_0x6cef('0x27')];}_0xa0c7fc[_0x6cef('0x19')](_0x318883)[_0x6cef('0x28')](_0x5cdeb2);};}var utilLicense=require(_0x6cef('0x18'));exports[_0x6cef('0x29')]=function(_0x891159,_0x227e3d){var _0x282c0f={'raw':!![],'where':{'id':0x1}},_0x3005f3={};_0x3005f3['model']=_['keys'](db[_0x6cef('0x2a')][_0x6cef('0x2b')]);_0x3005f3[_0x6cef('0x2c')]=_['keys'](_0x891159[_0x6cef('0x2c')]);_0x3005f3[_0x6cef('0x2d')]=_[_0x6cef('0x2e')](_0x3005f3['model'],_0x3005f3['query']);_0x282c0f[_0x6cef('0x2f')]=_[_0x6cef('0x2e')](_0x3005f3[_0x6cef('0x30')],qs[_0x6cef('0x31')](_0x891159['query'][_0x6cef('0x31')]));_0x282c0f[_0x6cef('0x2f')]=_0x282c0f[_0x6cef('0x2f')][_0x6cef('0x32')]?_0x282c0f['attributes']:_0x3005f3['model'];_0x282c0f=_[_0x6cef('0x33')]({},_0x282c0f,_0x891159[_0x6cef('0x34')]);return utilLicense[_0x6cef('0x35')](_0x282c0f)[_0x6cef('0x24')](respondWithResult(_0x227e3d,null))[_0x6cef('0x36')](handleError(_0x227e3d,null));};exports[_0x6cef('0x23')]=function(_0x1c0dd1,_0x243a92){if(_0x1c0dd1[_0x6cef('0x37')]['id']){delete _0x1c0dd1[_0x6cef('0x37')]['id'];}return db[_0x6cef('0x2a')][_0x6cef('0x38')]({'where':{'id':_0x1c0dd1[_0x6cef('0x39')]['id']}})[_0x6cef('0x24')](handleEntityNotFound(_0x243a92,null))['then'](function(_0x28c926){var _0x22f82a=_0x28c926[_0x6cef('0x3a')]({'plain':!![]});return utilLicense['checkLicense'](_0x22f82a,_0x1c0dd1[_0x6cef('0x37')]['key']);})['then'](function(_0x2660aa){if(!_0x2660aa[_0x6cef('0x3b')]){return saveUpdates(_0x1c0dd1[_0x6cef('0x37')],null);}return _0x2660aa;})[_0x6cef('0x24')](respondWithResult(_0x243a92,null))[_0x6cef('0x36')](handleError(_0x243a92,null));};exports[_0x6cef('0x3c')]=function(_0x36a3e8,_0x2a5076){var _0x1c9ff5='license-info.log';var _0x1893f8=path['join'](_0x6cef('0x3d'),_0x6cef('0x3e'),'xcally',_0x1c9ff5);_0x2a5076[_0x6cef('0x3f')](_0x6cef('0x40'),_0x6cef('0x41')+_0x1c9ff5);_0x2a5076[_0x6cef('0x42')]('Content-Type','text/plain');_0x2a5076[_0x6cef('0x43')](_0x1893f8);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 34149f1..c837ad2 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 _0xe9e9=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','license','util','../../config/logger'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xe9e9,0x1de));var _0x9e9e=function(_0x4bfbc9,_0x4de284){_0x4bfbc9=_0x4bfbc9-0x0;var _0xfea3a1=_0xe9e9[_0x4bfbc9];return _0xfea3a1;};'use strict';var _=require('lodash');var util=require(_0x9e9e('0x0'));var logger=require(_0x9e9e('0x1'))(_0x9e9e('0x2'));var moment=require(_0x9e9e('0x3'));var BPromise=require('bluebird');var rp=require(_0x9e9e('0x4'));var fs=require('fs');var path=require(_0x9e9e('0x5'));var rimraf=require(_0x9e9e('0x6'));var config=require(_0x9e9e('0x7'));var attributes=require(_0x9e9e('0x8'));module['exports']=function(_0x33332e,_0x16ac57){return _0x33332e[_0x9e9e('0x9')](_0x9e9e('0xa'),attributes,{'tableName':_0x9e9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7016=['bluebird','path','rimraf','../../config/environment','./license.attributes','License','license','util','../../config/logger','api','moment'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x7016,0x151));var _0x6701=function(_0x4c1963,_0x19dee9){_0x4c1963=_0x4c1963-0x0;var _0x5ae217=_0x7016[_0x4c1963];return _0x5ae217;};'use strict';var _=require('lodash');var util=require(_0x6701('0x0'));var logger=require(_0x6701('0x1'))(_0x6701('0x2'));var moment=require(_0x6701('0x3'));var BPromise=require(_0x6701('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6701('0x5'));var rimraf=require(_0x6701('0x6'));var config=require(_0x6701('0x7'));var attributes=require(_0x6701('0x8'));module['exports']=function(_0x1f1894,_0x4018de){return _0x1f1894['define'](_0x6701('0x9'),attributes,{'tableName':_0x6701('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 7632ea1..0f77368 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 _0x743d=['stringify','error','message','info','util','bluebird','../../mysqldb','rpc','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x3f10f8,_0x3ab30a){var _0x569320=function(_0x54107f){while(--_0x54107f){_0x3f10f8['push'](_0x3f10f8['shift']());}};_0x569320(++_0x3ab30a);}(_0x743d,0x6a));var _0xd743=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x743d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xd743('0x0'));var moment=require('moment');var BPromise=require(_0xd743('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd743('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd743('0x3'));var config=require('../../config/environment');var jayson=require(_0xd743('0x4'));var client=jayson[_0xd743('0x5')][_0xd743('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x24ecec,_0x1d34a1,_0x59d941){return new BPromise(function(_0x248a3d,_0xde675b){return client[_0xd743('0x7')](_0x24ecec,_0x59d941)[_0xd743('0x8')](function(_0x3dba3d){logger['info'](_0xd743('0x9'),_0x1d34a1,_0xd743('0xa'));logger[_0xd743('0xb')](_0xd743('0xc'),_0x1d34a1,'request\x20sent',JSON[_0xd743('0xd')](_0x3dba3d));if(_0x3dba3d[_0xd743('0xe')]){if(_0x3dba3d['error']['code']===0x1f4){logger[_0xd743('0xe')](_0xd743('0x9'),_0x1d34a1,_0x3dba3d[_0xd743('0xe')][_0xd743('0xf')]);return _0xde675b(_0x3dba3d[_0xd743('0xe')]['message']);}logger['error'](_0xd743('0x9'),_0x1d34a1,_0x3dba3d['error'][_0xd743('0xf')]);return _0x248a3d(_0x3dba3d[_0xd743('0xe')][_0xd743('0xf')]);}else{logger[_0xd743('0x10')](_0xd743('0x9'),_0x1d34a1,_0xd743('0xa'));_0x248a3d(_0x3dba3d['result'][_0xd743('0xf')]);}})['catch'](function(_0x4221a1){logger[_0xd743('0xe')]('License,\x20%s,\x20%s',_0x1d34a1,_0x4221a1);_0xde675b(_0x4221a1);});});} \ No newline at end of file +var _0x5f05=['bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x5f05,0x1e1));var _0x55f0=function(_0x1e9b1a,_0x51ee65){_0x1e9b1a=_0x1e9b1a-0x0;var _0x47681d=_0x5f05[_0x1e9b1a];return _0x47681d;};'use strict';var _=require(_0x55f0('0x0'));var util=require('util');var moment=require(_0x55f0('0x1'));var BPromise=require(_0x55f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55f0('0x3'))['db'];var utils=require(_0x55f0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x55f0('0x5'));var jayson=require(_0x55f0('0x6'));var client=jayson[_0x55f0('0x7')][_0x55f0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ac2d2,_0x48ee8a,_0x1c51e4){return new BPromise(function(_0x56947b,_0x372b6f){return client[_0x55f0('0x9')](_0x3ac2d2,_0x1c51e4)[_0x55f0('0xa')](function(_0x558d46){logger['info'](_0x55f0('0xb'),_0x48ee8a,_0x55f0('0xc'));logger[_0x55f0('0xd')](_0x55f0('0xe'),_0x48ee8a,'request\x20sent',JSON[_0x55f0('0xf')](_0x558d46));if(_0x558d46['error']){if(_0x558d46[_0x55f0('0x10')][_0x55f0('0x11')]===0x1f4){logger[_0x55f0('0x10')](_0x55f0('0xb'),_0x48ee8a,_0x558d46[_0x55f0('0x10')][_0x55f0('0x12')]);return _0x372b6f(_0x558d46[_0x55f0('0x10')][_0x55f0('0x12')]);}logger[_0x55f0('0x10')](_0x55f0('0xb'),_0x48ee8a,_0x558d46[_0x55f0('0x10')]['message']);return _0x56947b(_0x558d46[_0x55f0('0x10')][_0x55f0('0x12')]);}else{logger[_0x55f0('0x13')](_0x55f0('0xb'),_0x48ee8a,_0x55f0('0xc'));_0x56947b(_0x558d46['result']['message']);}})[_0x55f0('0x14')](function(_0x4f5b0f){logger['error'](_0x55f0('0xb'),_0x48ee8a,_0x4f5b0f);_0x372b6f(_0x4f5b0f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 5aada6a..9863967 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 _0xe5e9=['show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','addDisposition','post','/:id/canned_answers','addImap','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','put','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x822a3f,_0x32fd83){var _0x1053e7=function(_0xf41a09){while(--_0xf41a09){_0x822a3f['push'](_0x822a3f['shift']());}};_0x1053e7(++_0x32fd83);}(_0xe5e9,0x81));var _0x9e5e=function(_0x5cc450,_0xbc6fa8){_0x5cc450=_0x5cc450-0x0;var _0x781ec6=_0xe5e9[_0x5cc450];return _0x781ec6;};'use strict';var multer=require(_0x9e5e('0x0'));var util=require(_0x9e5e('0x1'));var path=require(_0x9e5e('0x2'));var timeout=require(_0x9e5e('0x3'));var express=require(_0x9e5e('0x4'));var router=express['Router']();var fs_extra=require(_0x9e5e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9e5e('0x6'));var config=require(_0x9e5e('0x7'));var controller=require(_0x9e5e('0x8'));router[_0x9e5e('0x9')]('/',auth[_0x9e5e('0xa')](),controller[_0x9e5e('0xb')]);router[_0x9e5e('0x9')](_0x9e5e('0xc'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0xd')]);router[_0x9e5e('0x9')](_0x9e5e('0xe'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0xf')]);router[_0x9e5e('0x9')](_0x9e5e('0x10'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x11')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9e5e('0x12')]);router['get'](_0x9e5e('0x13'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x14')]);router[_0x9e5e('0x9')](_0x9e5e('0x15'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x16')]);router[_0x9e5e('0x9')](_0x9e5e('0x17'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x18')]);router[_0x9e5e('0x9')](_0x9e5e('0x19'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x1a')]);router['get'](_0x9e5e('0x1b'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x1c')]);router[_0x9e5e('0x9')]('/:id/verify',auth[_0x9e5e('0xa')](),controller['verifySmtp']);router['get']('/:id/users',auth[_0x9e5e('0xa')](),controller['getAgents']);router['post'](_0x9e5e('0x10'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x1d')]);router[_0x9e5e('0x1e')](_0x9e5e('0x1f'),auth[_0x9e5e('0xa')](),controller['addAnswer']);router[_0x9e5e('0x1e')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9e5e('0x1e')](_0x9e5e('0x13'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x20')]);router[_0x9e5e('0x1e')](_0x9e5e('0x15'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x21')]);router[_0x9e5e('0x1e')](_0x9e5e('0x17'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x22')]);router[_0x9e5e('0x1e')]('/:id/applications',auth['isAuthenticated'](),controller[_0x9e5e('0x23')]);router[_0x9e5e('0x1e')]('/:id/send',auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x24')]);router['post'](_0x9e5e('0x25'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x26')]);router[_0x9e5e('0x27')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id/dispositions',auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x28')]);router[_0x9e5e('0x29')](_0x9e5e('0x1f'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x2a')]);router['delete'](_0x9e5e('0x13'),auth['isAuthenticated'](),controller[_0x9e5e('0x2b')]);router[_0x9e5e('0x29')](_0x9e5e('0x15'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x2c')]);router['delete'](_0x9e5e('0xe'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x2d')]);router[_0x9e5e('0x29')](_0x9e5e('0x25'),auth[_0x9e5e('0xa')](),controller[_0x9e5e('0x2e')]);module[_0x9e5e('0x2f')]=router; \ No newline at end of file +var _0x5f41=['destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','addDisposition','addAnswer','create','post','addImap','addSmtp','addInteraction','addApplications','send','addAgents','update','removeDispositions','delete','removeImap','removeSmtp'];(function(_0x382737,_0x4ca74f){var _0x52adc0=function(_0x867c6b){while(--_0x867c6b){_0x382737['push'](_0x382737['shift']());}};_0x52adc0(++_0x4ca74f);}(_0x5f41,0x1cf));var _0x15f4=function(_0x5c8da0,_0x5d2fd9){_0x5c8da0=_0x5c8da0-0x0;var _0xd2567f=_0x5f41[_0x5c8da0];return _0xd2567f;};'use strict';var multer=require(_0x15f4('0x0'));var util=require(_0x15f4('0x1'));var path=require(_0x15f4('0x2'));var timeout=require(_0x15f4('0x3'));var express=require(_0x15f4('0x4'));var router=express[_0x15f4('0x5')]();var fs_extra=require(_0x15f4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x15f4('0x7'));var config=require(_0x15f4('0x8'));var controller=require('./mailAccount.controller');router[_0x15f4('0x9')]('/',auth[_0x15f4('0xa')](),controller[_0x15f4('0xb')]);router[_0x15f4('0x9')]('/describe',auth[_0x15f4('0xa')](),controller[_0x15f4('0xc')]);router[_0x15f4('0x9')](_0x15f4('0xd'),auth['isAuthenticated'](),controller[_0x15f4('0xe')]);router[_0x15f4('0x9')](_0x15f4('0xf'),auth[_0x15f4('0xa')](),controller[_0x15f4('0x10')]);router['get'](_0x15f4('0x11'),auth[_0x15f4('0xa')](),controller[_0x15f4('0x12')]);router['get'](_0x15f4('0x13'),auth[_0x15f4('0xa')](),controller[_0x15f4('0x14')]);router[_0x15f4('0x9')](_0x15f4('0x15'),auth[_0x15f4('0xa')](),controller[_0x15f4('0x16')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x15f4('0x9')](_0x15f4('0x17'),auth[_0x15f4('0xa')](),controller[_0x15f4('0x18')]);router[_0x15f4('0x9')](_0x15f4('0x19'),auth[_0x15f4('0xa')](),controller[_0x15f4('0x1a')]);router[_0x15f4('0x9')]('/:id/verify',auth[_0x15f4('0xa')](),controller['verifySmtp']);router[_0x15f4('0x9')](_0x15f4('0x1b'),auth[_0x15f4('0xa')](),controller['getAgents']);router['post'](_0x15f4('0xf'),auth['isAuthenticated'](),controller[_0x15f4('0x1c')]);router['post']('/:id/canned_answers',auth[_0x15f4('0xa')](),controller[_0x15f4('0x1d')]);router['post']('/',auth[_0x15f4('0xa')](),controller[_0x15f4('0x1e')]);router[_0x15f4('0x1f')]('/:id/in_servers',auth[_0x15f4('0xa')](),controller[_0x15f4('0x20')]);router[_0x15f4('0x1f')]('/:id/out_servers',auth[_0x15f4('0xa')](),controller[_0x15f4('0x21')]);router['post']('/:id/interactions',auth[_0x15f4('0xa')](),controller[_0x15f4('0x22')]);router[_0x15f4('0x1f')](_0x15f4('0x17'),auth['isAuthenticated'](),controller[_0x15f4('0x23')]);router[_0x15f4('0x1f')]('/:id/send',auth['isAuthenticated'](),controller[_0x15f4('0x24')]);router[_0x15f4('0x1f')]('/:id/users',auth[_0x15f4('0xa')](),controller[_0x15f4('0x25')]);router['put'](_0x15f4('0xd'),auth['isAuthenticated'](),controller[_0x15f4('0x26')]);router['delete'](_0x15f4('0xf'),auth[_0x15f4('0xa')](),controller[_0x15f4('0x27')]);router[_0x15f4('0x28')](_0x15f4('0x11'),auth[_0x15f4('0xa')](),controller['removeAnswers']);router['delete'](_0x15f4('0x13'),auth['isAuthenticated'](),controller[_0x15f4('0x29')]);router[_0x15f4('0x28')](_0x15f4('0x15'),auth[_0x15f4('0xa')](),controller[_0x15f4('0x2a')]);router[_0x15f4('0x28')]('/:id',auth[_0x15f4('0xa')](),controller[_0x15f4('0x2b')]);router[_0x15f4('0x28')]('/:id/users',auth[_0x15f4('0xa')](),controller[_0x15f4('0x2c')]);module[_0x15f4('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 00b2539..68ea2b7 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 _0x77ba=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize'];(function(_0x5ccc0b,_0x16e537){var _0x5f457f=function(_0x192df7){while(--_0x192df7){_0x5ccc0b['push'](_0x5ccc0b['shift']());}};_0x5f457f(++_0x16e537);}(_0x77ba,0x98));var _0xa77b=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x77ba[_0x29a29f];return _0x443ea3;};'use strict';var Sequelize=require(_0xa77b('0x0'));module['exports']={'description':{'type':Sequelize[_0xa77b('0x1')]},'name':{'type':Sequelize[_0xa77b('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xa77b('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa77b('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa77b('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa77b('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xa77b('0x3')]},'markAsUnread':{'type':Sequelize[_0xa77b('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa77b('0x1')],'allowNull':![],'defaultValue':_0xa77b('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xa77b('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa77b('0x3')],'defaultValue':function(){return _0xa77b('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa77b('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa77b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa77b('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa77b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa77b('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa77b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa77b('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xa77b('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xa77b('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5c057c){if(!_0x5c057c)this[_0xa77b('0x9')]('mandatoryDispositionPauseId',null);this[_0xa77b('0x9')]('mandatoryDisposition',_0x5c057c);}},'provider':{'type':Sequelize[_0xa77b('0xa')](_0xa77b('0xb'),_0xa77b('0xc'),_0xa77b('0xd'),'outlook365'),'defaultValue':null,'get':function(){var _0x2aa36e=this[_0xa77b('0xe')](_0xa77b('0xf'));return _0x2aa36e||'custom';},'set':function(_0x4bea9e){if(_0x4bea9e===_0xa77b('0x10')){_0x4bea9e=null;}return this['setDataValue']('provider',_0x4bea9e);}}}; \ No newline at end of file +var _0xd00c=['yahoo','outlook365','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0x2554d6,_0x21ce38){var _0x534441=function(_0x25419e){while(--_0x25419e){_0x2554d6['push'](_0x2554d6['shift']());}};_0x534441(++_0x21ce38);}(_0xd00c,0x8a));var _0xcd00=function(_0x4e9485,_0x5b1c25){_0x4e9485=_0x4e9485-0x0;var _0x2295cf=_0xd00c[_0x4e9485];return _0x2295cf;};'use strict';var Sequelize=require(_0xcd00('0x0'));module[_0xcd00('0x1')]={'description':{'type':Sequelize[_0xcd00('0x2')]},'name':{'type':Sequelize[_0xcd00('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xcd00('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xcd00('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xcd00('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xcd00('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xcd00('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xcd00('0x2')],'allowNull':![],'defaultValue':_0xcd00('0x5')},'fontSize':{'type':Sequelize[_0xcd00('0x6')](0x2)[_0xcd00('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xcd00('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xcd00('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcd00('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcd00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcd00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcd00('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcd00('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcd00('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xcd00('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xcd00('0x3')],'defaultValue':![],'comment':_0xcd00('0x9'),'set':function(_0x24ea73){if(!_0x24ea73)this[_0xcd00('0xa')](_0xcd00('0xb'),null);this[_0xcd00('0xa')](_0xcd00('0xc'),_0x24ea73);}},'provider':{'type':Sequelize[_0xcd00('0xd')]('gmail','hotmail',_0xcd00('0xe'),_0xcd00('0xf')),'defaultValue':null,'get':function(){var _0x318d70=this[_0xcd00('0x10')]('provider');return _0x318d70||_0xcd00('0x11');},'set':function(_0x2c8791){if(_0x2c8791===_0xcd00('0x11')){_0x2c8791=null;}return this[_0xcd00('0xa')](_0xcd00('0x12'),_0x2c8791);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 1f3c13f..b93eedd 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 _0x2d6d=['CmContact','User','Owner','fullname','internal','Tag','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','destroy','findAndCountAll','priority','send','getApplications','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','getSmtpOptions','List\x20not\x20found','defaults','messageId','subject','out','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','userMailAccount:remove','getAgents','moment','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','json','offset','undefined','count','limit','update','then','get','MailAccounts','UserProfileResource','stack','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','MailAccount','findAll','show','params','Pause','keys','rawAttributes','fields','find','body','provider','custom','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','isNil','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit'];(function(_0x43bb57,_0x1bd572){var _0x260a1e=function(_0x41f80b){while(--_0x41f80b){_0x43bb57['push'](_0x43bb57['shift']());}};_0x260a1e(++_0x1bd572);}(_0x2d6d,0xec));var _0xd2d6=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0x2d6d[_0x13b7fd];return _0x32a74a;};'use strict';var moment=require(_0xd2d6('0x0'));var BPromise=require(_0xd2d6('0x1'));var util=require('util');var path=require('path');var _=require(_0xd2d6('0x2'));var juice=require('juice');var Redis=require(_0xd2d6('0x3'));var qs=require(_0xd2d6('0x4'));var logger=require(_0xd2d6('0x5'))('api');var config=require(_0xd2d6('0x6'));var db=require(_0xd2d6('0x7'))['db'];config[_0xd2d6('0x8')]=_['defaults'](config[_0xd2d6('0x8')],{'host':_0xd2d6('0x9'),'port':0x18eb});var socket=require(_0xd2d6('0xa'))(new Redis(config['redis']));require(_0xd2d6('0xb'))[_0xd2d6('0xc')](socket);var jayson=require(_0xd2d6('0xd'));var client=jayson[_0xd2d6('0xe')][_0xd2d6('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x26db10,_0x19eb2c,_0x41b41e,_0x5cf8b6){return new BPromise(function(_0xe3e2b9,_0x3914b4){var _0x51d1a7=_0x5cf8b6||client;return _0x51d1a7['request'](_0x26db10,_0x41b41e)['then'](function(_0x18e746){logger['info'](_0xd2d6('0x10'),_0x19eb2c,_0xd2d6('0x11'));logger[_0xd2d6('0x12')](_0xd2d6('0x13'),_0x19eb2c,_0xd2d6('0x11'),JSON[_0xd2d6('0x14')](_0x18e746));if(_0x18e746['error']){if(_0x18e746[_0xd2d6('0x15')][_0xd2d6('0x16')]===0x1f4){logger['error'](_0xd2d6('0x10'),_0x19eb2c,_0x18e746[_0xd2d6('0x15')][_0xd2d6('0x17')]);return _0x3914b4(_0x18e746[_0xd2d6('0x15')][_0xd2d6('0x17')]);}logger[_0xd2d6('0x15')]('MailAccount,\x20%s,\x20%s',_0x19eb2c,_0x18e746[_0xd2d6('0x15')][_0xd2d6('0x17')]);return _0xe3e2b9(_0x18e746[_0xd2d6('0x15')]['message']);}else{logger[_0xd2d6('0x18')](_0xd2d6('0x10'),_0x19eb2c,_0xd2d6('0x11'));_0xe3e2b9(_0x18e746['result']['message']);}})[_0xd2d6('0x19')](function(_0x55c328){logger[_0xd2d6('0x15')](_0xd2d6('0x10'),_0x19eb2c,_0x55c328);_0x3914b4(_0x55c328);});});}function respondWithStatusCode(_0x18f0e8,_0x5df1ab){_0x5df1ab=_0x5df1ab||0xcc;return function(_0x1a9e17){if(_0x1a9e17){return _0x18f0e8[_0xd2d6('0x1a')](_0x5df1ab);}return _0x18f0e8['status'](_0x5df1ab)[_0xd2d6('0x1b')]();};}function respondWithResult(_0x95ca,_0x652790){_0x652790=_0x652790||0xc8;return function(_0x56821f){if(_0x56821f){return _0x95ca[_0xd2d6('0x1c')](_0x652790)[_0xd2d6('0x1d')](_0x56821f);}};}function respondWithFilteredResult(_0x545445,_0x3f56af){return function(_0x5ffcd5){if(_0x5ffcd5){var _0x2f0a67=typeof _0x3f56af[_0xd2d6('0x1e')]===_0xd2d6('0x1f')&&typeof _0x3f56af['limit']==='undefined';var _0x21ba09=_0x5ffcd5[_0xd2d6('0x20')];var _0x4d1cee=_0x2f0a67?0x0:_0x3f56af['offset'];var _0x185531=_0x2f0a67?_0x5ffcd5[_0xd2d6('0x20')]:_0x3f56af[_0xd2d6('0x1e')]+_0x3f56af[_0xd2d6('0x21')];var _0x2ff225;if(_0x185531>=_0x21ba09){_0x185531=_0x21ba09;_0x2ff225=0xc8;}else{_0x2ff225=0xce;}_0x545445[_0xd2d6('0x1c')](_0x2ff225);return _0x545445['set']('Content-Range',_0x4d1cee+'-'+_0x185531+'/'+_0x21ba09)['json'](_0x5ffcd5);}return null;};}function saveUpdates(_0x3531ec){return function(_0x1b21a0){if(_0x1b21a0){return _0x1b21a0[_0xd2d6('0x22')](_0x3531ec)[_0xd2d6('0x23')](function(_0x22d85a){return _0x22d85a;});}return null;};}function removeEntity(_0x3f5cd2){return function(_0x3174d3){if(_0x3174d3){return _0x3174d3['destroy']()[_0xd2d6('0x23')](function(){var _0x5c98da=_0x3174d3[_0xd2d6('0x24')]({'plain':!![]});var _0x1cba5d=_0xd2d6('0x25');return db[_0xd2d6('0x26')]['destroy']({'where':{'type':_0x1cba5d,'resourceId':_0x5c98da['id']}})[_0xd2d6('0x23')](function(){return _0x3174d3;});})[_0xd2d6('0x23')](function(){_0x3f5cd2[_0xd2d6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xef95c0){return function(_0x1e3eb5){if(!_0x1e3eb5){_0xef95c0[_0xd2d6('0x1a')](0x194);}return _0x1e3eb5;};}function handleError(_0xbed937,_0x2bade1){_0x2bade1=_0x2bade1||0x1f4;return function(_0x4bde24){logger[_0xd2d6('0x15')](_0x4bde24[_0xd2d6('0x27')]);if(_0x4bde24['name']){delete _0x4bde24['name'];}_0xbed937[_0xd2d6('0x1c')](_0x2bade1)['send'](_0x4bde24);};}function getImapHost(_0xaec960){switch(_0xaec960){case'gmail':return _0xd2d6('0x28');case _0xd2d6('0x29'):return'imap.mail.yahoo.com';case _0xd2d6('0x2a'):return _0xd2d6('0x2b');case _0xd2d6('0x2c'):return _0xd2d6('0x2d');}throw new Error(_0xd2d6('0x2e'),_0xaec960);}function getSmtpHost(_0x22a9a2){switch(_0x22a9a2){case _0xd2d6('0x2f'):return _0xd2d6('0x30');case _0xd2d6('0x29'):return _0xd2d6('0x31');case'hotmail':return _0xd2d6('0x32');case'outlook365':return _0xd2d6('0x33');}throw new Error(_0xd2d6('0x2e'),_0x22a9a2);}function getAuthenticationOptions(_0xc4ce7e,_0x1ea9e7){var _0x2eb7f6={};var _0x32033d={};if(_0xc4ce7e){_0x2eb7f6[_0xd2d6('0x34')]=_0x32033d[_0xd2d6('0x34')]=_0x1ea9e7[_0xd2d6('0x35')];_0x2eb7f6[_0xd2d6('0x36')]=_0x32033d[_0xd2d6('0x37')]=_0x1ea9e7[_0xd2d6('0x36')];if(_0x1ea9e7['modernAuthentication']){_0x2eb7f6[_0xd2d6('0x38')]=_0x32033d[_0xd2d6('0x38')]=!![];_0x2eb7f6[_0xd2d6('0x39')]=_0x32033d[_0xd2d6('0x39')]=_0x1ea9e7['CloudProviderId'];_0x2eb7f6[_0xd2d6('0x36')]=_0x32033d[_0xd2d6('0x37')]=null;}else{_0x2eb7f6[_0xd2d6('0x39')]=_0x32033d[_0xd2d6('0x39')]=null;}_0x2eb7f6[_0xd2d6('0x3a')]=getImapHost(_0xc4ce7e);_0x2eb7f6['port']=0x3e1;_0x32033d[_0xd2d6('0x3a')]=getSmtpHost(_0xc4ce7e);_0x32033d[_0xd2d6('0x3b')]=0x24b;_0x32033d[_0xd2d6('0x3c')]=![];_0x2eb7f6[_0xd2d6('0x3d')]=_0x32033d[_0xd2d6('0x3d')]=null;}else{if(_0x1ea9e7[_0xd2d6('0x3e')]){_0x2eb7f6[_0xd2d6('0x34')]=_0x32033d['user']=_0x1ea9e7[_0xd2d6('0x35')];_0x2eb7f6['password']=_0x32033d[_0xd2d6('0x37')]=_0x1ea9e7[_0xd2d6('0x36')];}else{_0x2eb7f6[_0xd2d6('0x3e')]=_0x32033d[_0xd2d6('0x3e')]=![];_0x2eb7f6[_0xd2d6('0x34')]=_0x32033d['user']=null;_0x2eb7f6['password']=_0x32033d['pass']=null;}_0x2eb7f6[_0xd2d6('0x3a')]=_0x1ea9e7[_0xd2d6('0x3f')][_0xd2d6('0x3a')];_0x2eb7f6[_0xd2d6('0x3b')]=_0x1ea9e7['Imap']['port'];_0x32033d[_0xd2d6('0x3a')]=_0x1ea9e7[_0xd2d6('0x40')]['host'];_0x32033d['port']=_0x1ea9e7['Smtp']['port'];}return{'Imap':_0x2eb7f6,'Smtp':_0x32033d};}exports[_0xd2d6('0x41')]=function(_0x4fea03,_0x1c1ecc){var _0x3138f3={'include':[{'model':db[_0xd2d6('0x42')],'as':_0xd2d6('0x3f')},{'model':db[_0xd2d6('0x43')],'as':_0xd2d6('0x40')},{'model':db['Pause'],'as':_0xd2d6('0x44')}]},_0x16d58e={},_0x98e7e5={'count':0x0,'rows':[]};var _0x49e65e=_[_0xd2d6('0x45')](db['MailAccount']['rawAttributes'],function(_0x40e1f9){return{'name':_0x40e1f9[_0xd2d6('0x46')],'type':_0x40e1f9['type'][_0xd2d6('0x47')]};});_0x16d58e[_0xd2d6('0x48')]=_[_0xd2d6('0x45')](_0x49e65e,'name');_0x16d58e[_0xd2d6('0x49')]=_['keys'](_0x4fea03[_0xd2d6('0x49')]);_0x16d58e[_0xd2d6('0x4a')]=_[_0xd2d6('0x4b')](_0x16d58e[_0xd2d6('0x48')],_0x16d58e[_0xd2d6('0x49')]);_0x3138f3['attributes']=_['intersection'](_0x16d58e[_0xd2d6('0x48')],qs['fields'](_0x4fea03[_0xd2d6('0x49')]['fields']));_0x3138f3[_0xd2d6('0x4c')]=_0x3138f3['attributes'][_0xd2d6('0x4d')]?_0x3138f3[_0xd2d6('0x4c')]:_0x16d58e['model'];if(!_0x4fea03[_0xd2d6('0x49')]['hasOwnProperty'](_0xd2d6('0x4e'))){_0x3138f3[_0xd2d6('0x21')]=qs['limit'](_0x4fea03['query'][_0xd2d6('0x21')]);_0x3138f3['offset']=qs[_0xd2d6('0x1e')](_0x4fea03['query']['offset']);}_0x3138f3[_0xd2d6('0x4f')]=qs[_0xd2d6('0x50')](_0x4fea03[_0xd2d6('0x49')][_0xd2d6('0x50')]);_0x3138f3[_0xd2d6('0x51')]=qs['filters'](_[_0xd2d6('0x52')](_0x4fea03[_0xd2d6('0x49')],_0x16d58e[_0xd2d6('0x4a')]),_0x49e65e);if(_0x4fea03[_0xd2d6('0x49')][_0xd2d6('0x53')]){_0x3138f3[_0xd2d6('0x51')]=_[_0xd2d6('0x54')](_0x3138f3[_0xd2d6('0x51')],{'$or':_[_0xd2d6('0x45')](_0x49e65e,function(_0x334230){if(_0x334230['type']!==_0xd2d6('0x55')){var _0x598675={};_0x598675[_0x334230[_0xd2d6('0x56')]]={'$like':'%'+_0x4fea03[_0xd2d6('0x49')]['filter']+'%'};return _0x598675;}})});}_0x3138f3=_['merge']({},_0x3138f3,_0x4fea03[_0xd2d6('0x57')]);var _0x2cba4e={'where':_0x3138f3[_0xd2d6('0x51')]};return db['MailAccount'][_0xd2d6('0x20')](_0x2cba4e)[_0xd2d6('0x23')](function(_0x507608){_0x98e7e5['count']=_0x507608;if(_0x4fea03[_0xd2d6('0x49')][_0xd2d6('0x58')]){_0x3138f3[_0xd2d6('0x59')]=[{'all':!![]}];}return db[_0xd2d6('0x5a')][_0xd2d6('0x5b')](_0x3138f3);})[_0xd2d6('0x23')](function(_0x1790c0){_0x98e7e5['rows']=_0x1790c0;return _0x98e7e5;})['then'](respondWithFilteredResult(_0x1c1ecc,_0x3138f3))[_0xd2d6('0x19')](handleError(_0x1c1ecc,null));};exports[_0xd2d6('0x5c')]=function(_0x8a4fc8,_0x1de4e7){var _0x12b75e={'raw':![],'where':{'id':_0x8a4fc8[_0xd2d6('0x5d')]['id']},'include':[{'model':db[_0xd2d6('0x42')],'as':_0xd2d6('0x3f')},{'model':db['MailServerOut'],'as':_0xd2d6('0x40')},{'model':db[_0xd2d6('0x5e')],'as':_0xd2d6('0x44')}]},_0x231b7b={};_0x231b7b[_0xd2d6('0x48')]=_[_0xd2d6('0x5f')](db[_0xd2d6('0x5a')][_0xd2d6('0x60')]);_0x231b7b[_0xd2d6('0x49')]=_['keys'](_0x8a4fc8['query']);_0x231b7b['filters']=_[_0xd2d6('0x4b')](_0x231b7b['model'],_0x231b7b[_0xd2d6('0x49')]);_0x12b75e[_0xd2d6('0x4c')]=_[_0xd2d6('0x4b')](_0x231b7b['model'],qs['fields'](_0x8a4fc8[_0xd2d6('0x49')][_0xd2d6('0x61')]));_0x12b75e[_0xd2d6('0x4c')]=_0x12b75e['attributes'][_0xd2d6('0x4d')]?_0x12b75e[_0xd2d6('0x4c')]:_0x231b7b[_0xd2d6('0x48')];if(_0x8a4fc8[_0xd2d6('0x49')][_0xd2d6('0x58')]){_0x12b75e['include']=[{'all':!![]}];}_0x12b75e=_[_0xd2d6('0x54')]({},_0x12b75e,_0x8a4fc8[_0xd2d6('0x57')]);return db[_0xd2d6('0x5a')][_0xd2d6('0x62')](_0x12b75e)['then'](handleEntityNotFound(_0x1de4e7,null))[_0xd2d6('0x23')](respondWithResult(_0x1de4e7,null))['catch'](handleError(_0x1de4e7,null));};exports[_0xd2d6('0x22')]=function(_0x38929b,_0x2ebf90){if(_0x38929b[_0xd2d6('0x63')]['id']){delete _0x38929b[_0xd2d6('0x63')]['id'];}var _0xd23946=_0x38929b[_0xd2d6('0x63')][_0xd2d6('0x64')]===_0xd2d6('0x65')?null:_0x38929b[_0xd2d6('0x63')]['provider'];var _0x31c149=_0x38929b[_0xd2d6('0x63')][_0xd2d6('0x3f')]||{};var _0x10bdcc=_0x38929b[_0xd2d6('0x63')]['Smtp']||{};if(_0xd23946){_0x31c149['host']=getImapHost(_0xd23946);_0x31c149[_0xd2d6('0x3b')]=0x3e1;_0x10bdcc[_0xd2d6('0x3a')]=getSmtpHost(_0xd23946);_0x10bdcc['port']=0x24b;_0x10bdcc[_0xd2d6('0x3c')]=![];}if(_0x10bdcc[_0xd2d6('0x38')]){_0x10bdcc['secure']=![];}else{_0x10bdcc[_0xd2d6('0x39')]=null;}if(!_0x31c149['modernAuthentication'])_0x31c149[_0xd2d6('0x39')]=null;_0x38929b[_0xd2d6('0x63')][_0xd2d6('0x3f')]=_0x31c149;_0x38929b['body'][_0xd2d6('0x40')]=_0x10bdcc;return db[_0xd2d6('0x5a')][_0xd2d6('0x62')]({'where':{'id':_0x38929b[_0xd2d6('0x5d')]['id']},'include':[{'model':db[_0xd2d6('0x42')],'as':_0xd2d6('0x3f')},{'model':db[_0xd2d6('0x43')],'as':'Smtp'},{'model':db[_0xd2d6('0x5e')],'as':_0xd2d6('0x44')}]})['then'](handleEntityNotFound(_0x2ebf90,null))['then'](function(_0x449918){if(!_0x449918)throw new Error('Mail\x20Account\x20not\x20found');if(_0x449918[_0xd2d6('0x3d')])delete _0x38929b[_0xd2d6('0x63')]['Imap'];return _0x449918;})[_0xd2d6('0x23')](saveUpdates(_0x38929b['body'],null))[_0xd2d6('0x23')](function(_0x1fb96f){if(!_0x38929b[_0xd2d6('0x63')][_0xd2d6('0x3f')])return _0x1fb96f;return db[_0xd2d6('0x42')][_0xd2d6('0x22')](_0x38929b[_0xd2d6('0x63')][_0xd2d6('0x3f')],{'where':{'MailAccountId':_0x1fb96f['id']}})[_0xd2d6('0x23')](function(){return _0x1fb96f;});})[_0xd2d6('0x23')](function(_0x61299d){if(!_0x38929b[_0xd2d6('0x63')][_0xd2d6('0x40')])return _0x61299d;return db[_0xd2d6('0x43')][_0xd2d6('0x22')](_0x38929b['body'][_0xd2d6('0x40')],{'where':{'MailAccountId':_0x61299d['id']}})[_0xd2d6('0x23')](function(){return _0x61299d;});})[_0xd2d6('0x23')](respondWithResult(_0x2ebf90,null))[_0xd2d6('0x19')](handleError(_0x2ebf90,null));};exports[_0xd2d6('0x66')]=function(_0x286c46,_0x2739eb){return db['MailAccount'][_0xd2d6('0x66')]()[_0xd2d6('0x23')](respondWithResult(_0x2739eb,null))[_0xd2d6('0x19')](handleError(_0x2739eb,null));};exports[_0xd2d6('0x67')]=function(_0x2ed5e4,_0xfbd19e){if(_0x2ed5e4[_0xd2d6('0x63')]['id']){delete _0x2ed5e4['body']['id'];}return db[_0xd2d6('0x5a')][_0xd2d6('0x62')]({'where':{'id':_0x2ed5e4[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0xfbd19e,null))[_0xd2d6('0x23')](function(_0x240465){if(_0x240465){_0x2ed5e4[_0xd2d6('0x63')][_0xd2d6('0x68')]=_0x240465['id'];return db[_0xd2d6('0x69')][_0xd2d6('0x6a')](_0x2ed5e4[_0xd2d6('0x63')]);}})[_0xd2d6('0x23')](respondWithResult(_0xfbd19e,null))[_0xd2d6('0x19')](handleError(_0xfbd19e,null));};exports[_0xd2d6('0x6b')]=function(_0x1daf99,_0x588a2a){var _0x319b9d={'raw':![],'where':{}};var _0x110cb9={};var _0x49f9be={'count':0x0,'rows':[]};return db[_0xd2d6('0x5a')][_0xd2d6('0x6c')]({'where':{'id':_0x1daf99[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x588a2a,null))[_0xd2d6('0x23')](function(_0x35c800){if(_0x35c800){_0x110cb9[_0xd2d6('0x48')]=_[_0xd2d6('0x5f')](db[_0xd2d6('0x69')][_0xd2d6('0x60')]);_0x110cb9[_0xd2d6('0x49')]=_[_0xd2d6('0x5f')](_0x1daf99[_0xd2d6('0x49')]);_0x110cb9[_0xd2d6('0x4a')]=_[_0xd2d6('0x4b')](_0x110cb9[_0xd2d6('0x48')],_0x110cb9[_0xd2d6('0x49')]);_0x319b9d[_0xd2d6('0x4c')]=_[_0xd2d6('0x4b')](_0x110cb9[_0xd2d6('0x48')],qs[_0xd2d6('0x61')](_0x1daf99[_0xd2d6('0x49')][_0xd2d6('0x61')]));_0x319b9d[_0xd2d6('0x4c')]=_0x319b9d[_0xd2d6('0x4c')][_0xd2d6('0x4d')]?_0x319b9d[_0xd2d6('0x4c')]:_0x110cb9[_0xd2d6('0x48')];if(!_0x1daf99[_0xd2d6('0x49')][_0xd2d6('0x6d')]('nolimit')){_0x319b9d[_0xd2d6('0x21')]=qs[_0xd2d6('0x21')](_0x1daf99[_0xd2d6('0x49')]['limit']);_0x319b9d[_0xd2d6('0x1e')]=qs[_0xd2d6('0x1e')](_0x1daf99[_0xd2d6('0x49')][_0xd2d6('0x1e')]);}_0x319b9d[_0xd2d6('0x4f')]=qs['sort'](_0x1daf99[_0xd2d6('0x49')][_0xd2d6('0x50')]);_0x319b9d[_0xd2d6('0x51')]=qs[_0xd2d6('0x4a')](_['pick'](_0x1daf99[_0xd2d6('0x49')],_0x110cb9[_0xd2d6('0x4a')]));_0x319b9d[_0xd2d6('0x51')][_0xd2d6('0x68')]=_0x35c800['id'];if(_0x1daf99['query']['filter']){_0x319b9d[_0xd2d6('0x51')]=_[_0xd2d6('0x54')](_0x319b9d[_0xd2d6('0x51')],{'$or':_[_0xd2d6('0x45')](_0x319b9d['attributes'],function(_0x560fc8){var _0x2ceeee={};_0x2ceeee[_0x560fc8]={'$like':'%'+_0x1daf99[_0xd2d6('0x49')][_0xd2d6('0x53')]+'%'};return _0x2ceeee;})});}_0x319b9d=_['merge']({},_0x319b9d,_0x1daf99[_0xd2d6('0x57')]);return db[_0xd2d6('0x69')][_0xd2d6('0x20')]({'where':_0x319b9d['where']})[_0xd2d6('0x23')](function(_0x2eccb5){_0x49f9be['count']=_0x2eccb5;if(_0x1daf99[_0xd2d6('0x49')][_0xd2d6('0x58')]){_0x319b9d[_0xd2d6('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xd2d6('0x5b')](_0x319b9d);})[_0xd2d6('0x23')](function(_0x2efc0d){_0x49f9be[_0xd2d6('0x6e')]=_0x2efc0d;return _0x49f9be;});}})[_0xd2d6('0x23')](respondWithFilteredResult(_0x588a2a,_0x319b9d))[_0xd2d6('0x19')](handleError(_0x588a2a,null));};exports[_0xd2d6('0x6f')]=function(_0x497e27,_0x54bbac){return db[_0xd2d6('0x5a')][_0xd2d6('0x62')]({'where':{'id':_0x497e27[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x54bbac,null))[_0xd2d6('0x23')](function(_0x3f47e8){if(_0x3f47e8){return _0x3f47e8[_0xd2d6('0x6f')](_0x497e27[_0xd2d6('0x49')][_0xd2d6('0x70')]);}})[_0xd2d6('0x23')](respondWithStatusCode(_0x54bbac,null))['catch'](handleError(_0x54bbac,null));};exports[_0xd2d6('0x71')]=function(_0x3cfe22,_0x3de25d){if(_0x3cfe22['body']['id']){delete _0x3cfe22['body']['id'];}return db[_0xd2d6('0x5a')]['find']({'where':{'id':_0x3cfe22[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x3de25d,null))[_0xd2d6('0x23')](function(_0x3ad821){if(_0x3ad821){_0x3cfe22[_0xd2d6('0x63')][_0xd2d6('0x68')]=_0x3ad821['id'];return db['CannedAnswer'][_0xd2d6('0x6a')](_0x3cfe22['body']);}})[_0xd2d6('0x23')](respondWithResult(_0x3de25d,null))[_0xd2d6('0x19')](handleError(_0x3de25d,null));};exports['getAnswers']=function(_0x211c8f,_0x348bde){var _0x5a2795={'raw':![],'where':{}};var _0x81f538={};var _0x2802bb={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x211c8f[_0xd2d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x348bde,null))['then'](function(_0x3cfd2d){if(_0x3cfd2d){_0x81f538['model']=_[_0xd2d6('0x5f')](db['CannedAnswer'][_0xd2d6('0x60')]);_0x81f538[_0xd2d6('0x49')]=_[_0xd2d6('0x5f')](_0x211c8f[_0xd2d6('0x49')]);_0x81f538[_0xd2d6('0x4a')]=_['intersection'](_0x81f538[_0xd2d6('0x48')],_0x81f538[_0xd2d6('0x49')]);_0x5a2795[_0xd2d6('0x4c')]=_[_0xd2d6('0x4b')](_0x81f538['model'],qs['fields'](_0x211c8f[_0xd2d6('0x49')]['fields']));_0x5a2795[_0xd2d6('0x4c')]=_0x5a2795['attributes'][_0xd2d6('0x4d')]?_0x5a2795[_0xd2d6('0x4c')]:_0x81f538[_0xd2d6('0x48')];if(!_0x211c8f[_0xd2d6('0x49')]['hasOwnProperty'](_0xd2d6('0x4e'))){_0x5a2795[_0xd2d6('0x21')]=qs[_0xd2d6('0x21')](_0x211c8f[_0xd2d6('0x49')][_0xd2d6('0x21')]);_0x5a2795[_0xd2d6('0x1e')]=qs[_0xd2d6('0x1e')](_0x211c8f[_0xd2d6('0x49')][_0xd2d6('0x1e')]);}_0x5a2795[_0xd2d6('0x4f')]=qs[_0xd2d6('0x50')](_0x211c8f[_0xd2d6('0x49')][_0xd2d6('0x50')]);_0x5a2795['where']=qs['filters'](_[_0xd2d6('0x52')](_0x211c8f[_0xd2d6('0x49')],_0x81f538[_0xd2d6('0x4a')]));_0x5a2795[_0xd2d6('0x51')]['MailAccountId']=_0x3cfd2d['id'];if(_0x211c8f[_0xd2d6('0x49')][_0xd2d6('0x53')]){_0x5a2795[_0xd2d6('0x51')]=_[_0xd2d6('0x54')](_0x5a2795[_0xd2d6('0x51')],{'$or':_[_0xd2d6('0x45')](_0x5a2795[_0xd2d6('0x4c')],function(_0x5f0e1e){var _0x561ae0={};_0x561ae0[_0x5f0e1e]={'$like':'%'+_0x211c8f[_0xd2d6('0x49')][_0xd2d6('0x53')]+'%'};return _0x561ae0;})});}_0x5a2795=_['merge']({},_0x5a2795,_0x211c8f[_0xd2d6('0x57')]);return db['CannedAnswer'][_0xd2d6('0x20')]({'where':_0x5a2795[_0xd2d6('0x51')]})[_0xd2d6('0x23')](function(_0x520233){_0x2802bb[_0xd2d6('0x20')]=_0x520233;if(_0x211c8f[_0xd2d6('0x49')]['includeAll']){_0x5a2795[_0xd2d6('0x59')]=[{'all':!![]}];}return db[_0xd2d6('0x72')]['findAll'](_0x5a2795);})['then'](function(_0x25c059){_0x2802bb[_0xd2d6('0x6e')]=_0x25c059;return _0x2802bb;});}})[_0xd2d6('0x23')](respondWithFilteredResult(_0x348bde,_0x5a2795))[_0xd2d6('0x19')](handleError(_0x348bde,null));};exports[_0xd2d6('0x73')]=function(_0x17d605,_0xcbfb7d){return db['MailAccount'][_0xd2d6('0x62')]({'where':{'id':_0x17d605[_0xd2d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0xcbfb7d,null))['then'](function(_0x179f50){if(_0x179f50){return _0x179f50[_0xd2d6('0x73')](_0x17d605[_0xd2d6('0x49')][_0xd2d6('0x70')]);}})[_0xd2d6('0x23')](respondWithStatusCode(_0xcbfb7d,null))[_0xd2d6('0x19')](handleError(_0xcbfb7d,null));};exports[_0xd2d6('0x6a')]=function(_0x4c1a36,_0x32d98b){var _0x45a460={'name':_0x4c1a36['body']['name'],'key':_0x4c1a36['body'][_0xd2d6('0x47')],'provider':_0x4c1a36[_0xd2d6('0x63')]['provider']===_0xd2d6('0x65')?null:_0x4c1a36[_0xd2d6('0x63')][_0xd2d6('0x64')],'email':_0x4c1a36[_0xd2d6('0x63')]['email'],'ListId':_0x4c1a36[_0xd2d6('0x63')]['ListId'],'active':!_[_0xd2d6('0x74')](_0x4c1a36[_0xd2d6('0x63')]['active'])?_0x4c1a36[_0xd2d6('0x63')]['active']:!![],'description':_0x4c1a36['body']['description']||null};var _0x258942=getAuthenticationOptions(_0x45a460['provider'],_0x4c1a36[_0xd2d6('0x63')]);_0x45a460[_0xd2d6('0x3f')]=_0x258942[_0xd2d6('0x3f')];_0x45a460['Smtp']=_0x258942[_0xd2d6('0x40')];return db[_0xd2d6('0x5a')][_0xd2d6('0x6a')](_0x45a460,{'include':[{'model':db[_0xd2d6('0x43')],'as':_0xd2d6('0x40')},{'model':db[_0xd2d6('0x42')],'as':_0xd2d6('0x3f')}]})[_0xd2d6('0x23')](function(_0x8b0119){var _0x51fdfb=_0x4c1a36['user'][_0xd2d6('0x24')]({'plain':!![]});if(!_0x51fdfb)throw new Error(_0xd2d6('0x75'));if(_0x51fdfb['role']===_0xd2d6('0x34')){var _0x58c178=_0x8b0119[_0xd2d6('0x24')]({'plain':!![]});return db[_0xd2d6('0x76')][_0xd2d6('0x62')]({'where':{'name':_0xd2d6('0x25'),'userProfileId':_0x51fdfb[_0xd2d6('0x77')]},'raw':!![]})[_0xd2d6('0x23')](function(_0x293693){if(_0x293693&&_0x293693[_0xd2d6('0x78')]===0x0){return db['UserProfileResource'][_0xd2d6('0x6a')]({'name':_0x58c178[_0xd2d6('0x56')],'resourceId':_0x58c178['id'],'type':_0x293693[_0xd2d6('0x56')],'sectionId':_0x293693['id']},{})[_0xd2d6('0x23')](function(){return _0x8b0119;});}else{return _0x8b0119;}})[_0xd2d6('0x19')](function(_0x3bd403){logger[_0xd2d6('0x15')](_0xd2d6('0x79'),_0x3bd403);throw _0x3bd403;});}return _0x8b0119;})[_0xd2d6('0x23')](respondWithResult(_0x32d98b,0xc9))[_0xd2d6('0x19')](handleError(_0x32d98b,null));};exports[_0xd2d6('0x7a')]=function(_0x43dd36,_0x2551c1){return db['MailAccount']['findOne']({'where':{'id':_0x43dd36[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x2551c1,null))['then'](function(_0x2b322d){if(_0x2b322d){return _0x2b322d[_0xd2d6('0x7a')]();}return null;})[_0xd2d6('0x23')](respondWithResult(_0x2551c1,null))[_0xd2d6('0x19')](handleError(_0x2551c1,null));};exports[_0xd2d6('0x7b')]=function(_0x382a65,_0x47cdfa){if(_0x382a65[_0xd2d6('0x63')]['id']){delete _0x382a65[_0xd2d6('0x63')]['id'];}return db[_0xd2d6('0x5a')][_0xd2d6('0x62')]({'where':{'id':_0x382a65[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x47cdfa,null))[_0xd2d6('0x23')](function(_0x1f2910){if(_0x1f2910){_0x382a65[_0xd2d6('0x63')][_0xd2d6('0x68')]=_0x1f2910['id'];return db[_0xd2d6('0x42')][_0xd2d6('0x6a')](_0x382a65[_0xd2d6('0x63')]);}})['then'](respondWithResult(_0x47cdfa,null))[_0xd2d6('0x19')](handleError(_0x47cdfa,null));};exports['removeImap']=function(_0x53cffb,_0x31e013){return db['MailAccount'][_0xd2d6('0x6c')]({'where':{'id':_0x53cffb[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x31e013,null))[_0xd2d6('0x23')](function(_0xe99a88){if(_0xe99a88){return _0xe99a88[_0xd2d6('0x7c')](null);}return null;})[_0xd2d6('0x23')](respondWithStatusCode(_0x31e013,null))[_0xd2d6('0x19')](handleError(_0x31e013,null));};exports[_0xd2d6('0x7d')]=function(_0x39c835,_0x49a3d7){return db[_0xd2d6('0x5a')]['findOne']({'where':{'id':_0x39c835['params']['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x49a3d7,null))[_0xd2d6('0x23')](function(_0x21a06f){if(_0x21a06f){return _0x21a06f[_0xd2d6('0x7d')]();}return null;})[_0xd2d6('0x23')](respondWithResult(_0x49a3d7,null))[_0xd2d6('0x19')](handleError(_0x49a3d7,null));};exports[_0xd2d6('0x7e')]=function(_0x1a0ca3,_0x57ff1d){if(_0x1a0ca3[_0xd2d6('0x63')]['id']){delete _0x1a0ca3[_0xd2d6('0x63')]['id'];}return db[_0xd2d6('0x5a')][_0xd2d6('0x62')]({'where':{'id':_0x1a0ca3[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x57ff1d,null))[_0xd2d6('0x23')](function(_0x464312){if(_0x464312){_0x1a0ca3[_0xd2d6('0x63')]['MailAccountId']=_0x464312['id'];return db['MailServerOut']['create'](_0x1a0ca3[_0xd2d6('0x63')]);}})[_0xd2d6('0x23')](respondWithResult(_0x57ff1d,null))[_0xd2d6('0x19')](handleError(_0x57ff1d,null));};exports[_0xd2d6('0x7f')]=function(_0x28fd99,_0x3caf87){return db[_0xd2d6('0x5a')][_0xd2d6('0x6c')]({'where':{'id':_0x28fd99[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x3caf87,null))[_0xd2d6('0x23')](function(_0x1ccf32){if(_0x1ccf32){return _0x1ccf32[_0xd2d6('0x80')](null);}return null;})[_0xd2d6('0x23')](respondWithStatusCode(_0x3caf87,null))[_0xd2d6('0x19')](handleError(_0x3caf87,null));};exports[_0xd2d6('0x81')]=function(_0x33d67a,_0x3dd25e){return db[_0xd2d6('0x82')]['find']({'where':{'id':_0x33d67a[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x3dd25e,null))['then'](function(_0x51ba60){if(_0x51ba60){return _0x51ba60[_0xd2d6('0x81')](_0x33d67a[_0xd2d6('0x63')]['ids'],_[_0xd2d6('0x83')](_0x33d67a[_0xd2d6('0x63')],['ids','id'])||{});}})[_0xd2d6('0x23')](respondWithResult(_0x3dd25e,null))[_0xd2d6('0x19')](handleError(_0x3dd25e,null));};exports['getInteractions']=function(_0x92d387,_0x5f1ce3){var _0x25d191={'raw':![],'where':{}};var _0x56e966={};var _0x35521a={'count':0x0,'rows':[]};return db['MailAccount'][_0xd2d6('0x6c')]({'where':{'id':_0x92d387[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x5f1ce3,null))['then'](function(_0x354940){if(_0x354940){_0x56e966[_0xd2d6('0x48')]=_[_0xd2d6('0x5f')](db['MailInteraction'][_0xd2d6('0x60')]);_0x56e966['query']=_['keys'](_0x92d387[_0xd2d6('0x49')]);_0x56e966[_0xd2d6('0x4a')]=_[_0xd2d6('0x4b')](_0x56e966[_0xd2d6('0x48')],_0x56e966[_0xd2d6('0x49')]);_0x25d191[_0xd2d6('0x4c')]=_[_0xd2d6('0x4b')](_0x56e966[_0xd2d6('0x48')],qs['fields'](_0x92d387['query'][_0xd2d6('0x61')]));_0x25d191[_0xd2d6('0x4c')]=_0x25d191[_0xd2d6('0x4c')][_0xd2d6('0x4d')]?_0x25d191[_0xd2d6('0x4c')]:_0x56e966['model'];if(!_0x92d387['query'][_0xd2d6('0x6d')]('nolimit')){_0x25d191['limit']=qs[_0xd2d6('0x21')](_0x92d387[_0xd2d6('0x49')]['limit']);_0x25d191[_0xd2d6('0x1e')]=qs[_0xd2d6('0x1e')](_0x92d387['query'][_0xd2d6('0x1e')]);}_0x25d191[_0xd2d6('0x4f')]=qs[_0xd2d6('0x50')](_0x92d387[_0xd2d6('0x49')][_0xd2d6('0x50')]);_0x25d191[_0xd2d6('0x51')]=qs[_0xd2d6('0x4a')](_[_0xd2d6('0x52')](_0x92d387[_0xd2d6('0x49')],_0x56e966['filters']));_0x25d191[_0xd2d6('0x51')][_0xd2d6('0x68')]=_0x354940['id'];if(_0x92d387[_0xd2d6('0x49')]['filter']){_0x25d191['where']=_[_0xd2d6('0x54')](_0x25d191[_0xd2d6('0x51')],{'$or':_[_0xd2d6('0x45')](_0x25d191[_0xd2d6('0x4c')],function(_0x5eb27f){var _0x5d2ad8={};_0x5d2ad8[_0x5eb27f]={'$like':'%'+_0x92d387[_0xd2d6('0x49')][_0xd2d6('0x53')]+'%'};return _0x5d2ad8;})});}_0x25d191=_[_0xd2d6('0x54')]({},_0x25d191,_0x92d387[_0xd2d6('0x57')]);return db[_0xd2d6('0x82')]['count']({'where':_0x25d191[_0xd2d6('0x51')]})[_0xd2d6('0x23')](function(_0x17a5fa){_0x35521a[_0xd2d6('0x20')]=_0x17a5fa;if(_0x92d387[_0xd2d6('0x49')]['includeAll']){_0x25d191['include']=[{'model':db[_0xd2d6('0x84')],'as':'Contact','required':![]},{'model':db[_0xd2d6('0x85')],'as':_0xd2d6('0x86'),'attributes':[_0xd2d6('0x56'),_0xd2d6('0x87'),_0xd2d6('0x88')],'required':![]},{'model':db[_0xd2d6('0x89')],'as':'Tags','attributes':['id',_0xd2d6('0x56'),'color'],'where':_0x92d387[_0xd2d6('0x49')][_0xd2d6('0x8a')]?{'id':_0x92d387[_0xd2d6('0x49')][_0xd2d6('0x8a')]}:undefined,'required':_0x92d387[_0xd2d6('0x49')]['tag']?!![]:![]}];}return db[_0xd2d6('0x82')][_0xd2d6('0x5b')](_0x25d191);})[_0xd2d6('0x23')](function(_0x11339b){_0x35521a[_0xd2d6('0x6e')]=_0x11339b;return _0x35521a;});}})[_0xd2d6('0x23')](respondWithFilteredResult(_0x5f1ce3,_0x25d191))[_0xd2d6('0x19')](handleError(_0x5f1ce3,null));};exports['addApplications']=function addApplications(_0x17e9fd,_0x38d42e){var _0x2d4d22=_0x17e9fd[_0xd2d6('0x5d')]['id'];var _0x2078f5=_0x17e9fd[_0xd2d6('0x63')];var _0x3027cb=0xc8;var _0x114981=null;return db['sequelize'][_0xd2d6('0x8b')]({'isolationLevel':db[_0xd2d6('0x8c')][_0xd2d6('0x8d')][_0xd2d6('0x8e')]['READ_COMMITTED']},function(_0x32a2da){return db[_0xd2d6('0x5a')][_0xd2d6('0x6c')]({'where':{'id':_0x2d4d22},'transaction':_0x32a2da})[_0xd2d6('0x23')](function(_0x43db57){if(_0x43db57){return db[_0xd2d6('0x8f')][_0xd2d6('0x90')]({'where':{'MailAccountId':_0x2d4d22},'transaction':_0x32a2da})['then'](function(){var _0x2e1159=_[_0xd2d6('0x45')](_0x2078f5,function(_0x325803){_0x325803[_0xd2d6('0x68')]=_0x2d4d22;return _0x325803;});return db[_0xd2d6('0x8f')]['bulkCreate'](_0x2e1159,{'transaction':_0x32a2da});});}else{_0x3027cb=0x194;_0x114981=[];}});})[_0xd2d6('0x23')](function(){if(_0x3027cb!==0x194){return db[_0xd2d6('0x8f')][_0xd2d6('0x91')]({'where':{'MailAccountId':_0x2d4d22},'order':_0xd2d6('0x92')})[_0xd2d6('0x23')](function(_0x2ac13f){_0x114981=_0x2ac13f;});}})['catch'](function(_0x557fbb){_0x3027cb=0x1f4;logger['error'](_0x557fbb[_0xd2d6('0x27')]);if(_0x557fbb['name']){delete _0x557fbb[_0xd2d6('0x56')];}_0x114981=_0x557fbb;})['finally'](function(){if(_0x114981===null){_0x38d42e['sendStatus'](_0x3027cb);}else{if(_0x3027cb===0x1f4){_0x38d42e['status'](_0x3027cb)[_0xd2d6('0x93')](_0x114981);}else{_0x38d42e['status'](_0x3027cb)[_0xd2d6('0x1d')](_0x114981);}}});};exports[_0xd2d6('0x94')]=function(_0x17b865,_0x36c14c){var _0x342297={};var _0x4c237e={};var _0x413035;var _0x4aecdd;return db[_0xd2d6('0x5a')][_0xd2d6('0x6c')]({'where':{'id':_0x17b865[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x36c14c,null))[_0xd2d6('0x23')](function(_0x12f416){if(_0x12f416){_0x413035=_0x12f416;_0x4c237e[_0xd2d6('0x48')]=_[_0xd2d6('0x5f')](db[_0xd2d6('0x8f')][_0xd2d6('0x60')]);_0x4c237e['query']=_[_0xd2d6('0x5f')](_0x17b865[_0xd2d6('0x49')]);_0x4c237e[_0xd2d6('0x4a')]=_[_0xd2d6('0x4b')](_0x4c237e['model'],_0x4c237e[_0xd2d6('0x49')]);_0x342297['attributes']=_[_0xd2d6('0x4b')](_0x4c237e[_0xd2d6('0x48')],qs[_0xd2d6('0x61')](_0x17b865['query'][_0xd2d6('0x61')]));_0x342297[_0xd2d6('0x4c')]=_0x342297[_0xd2d6('0x4c')][_0xd2d6('0x4d')]?_0x342297['attributes']:_0x4c237e[_0xd2d6('0x48')];_0x342297[_0xd2d6('0x4f')]=qs['sort'](_0x17b865[_0xd2d6('0x49')][_0xd2d6('0x50')]);_0x342297['where']=qs[_0xd2d6('0x4a')](_[_0xd2d6('0x52')](_0x17b865[_0xd2d6('0x49')],_0x4c237e[_0xd2d6('0x4a')]));if(_0x17b865['query']['filter']){_0x342297['where']=_[_0xd2d6('0x54')](_0x342297[_0xd2d6('0x51')],{'$or':_['map'](_0x342297['attributes'],function(_0x4c6d13){var _0x24a8ac={};_0x24a8ac[_0x4c6d13]={'$like':'%'+_0x17b865[_0xd2d6('0x49')][_0xd2d6('0x53')]+'%'};return _0x24a8ac;})});}_0x342297=_[_0xd2d6('0x54')]({},_0x342297,_0x17b865[_0xd2d6('0x57')]);return _0x413035[_0xd2d6('0x94')](_0x342297);}})[_0xd2d6('0x23')](function(_0x208041){if(_0x208041){_0x4aecdd=_0x208041[_0xd2d6('0x4d')];if(!_0x17b865['query'][_0xd2d6('0x6d')]('nolimit')){_0x342297[_0xd2d6('0x21')]=qs[_0xd2d6('0x21')](_0x17b865[_0xd2d6('0x49')][_0xd2d6('0x21')]);_0x342297[_0xd2d6('0x1e')]=qs[_0xd2d6('0x1e')](_0x17b865[_0xd2d6('0x49')][_0xd2d6('0x1e')]);}return _0x413035['getApplications'](_0x342297);}})[_0xd2d6('0x23')](function(_0x2f7a2f){if(_0x2f7a2f){return _0x2f7a2f?{'count':_0x4aecdd,'rows':_0x2f7a2f}:null;}})[_0xd2d6('0x23')](respondWithResult(_0x36c14c,null))[_0xd2d6('0x19')](handleError(_0x36c14c,null));};exports['getMessages']=function(_0x373612,_0x3bf729){var _0x3b8693={'raw':!![],'where':{}};var _0x2f0481={};var _0x2bef9f={'count':0x0,'rows':[]};return db[_0xd2d6('0x5a')][_0xd2d6('0x6c')]({'where':{'id':_0x373612[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x3bf729,null))['then'](function(_0x558967){if(_0x558967){_0x2f0481[_0xd2d6('0x48')]=_[_0xd2d6('0x5f')](db[_0xd2d6('0x95')]['rawAttributes']);_0x2f0481['query']=_['keys'](_0x373612[_0xd2d6('0x49')]);_0x2f0481[_0xd2d6('0x4a')]=_['intersection'](_0x2f0481[_0xd2d6('0x48')],_0x2f0481[_0xd2d6('0x49')]);_0x3b8693['attributes']=_['intersection'](_0x2f0481[_0xd2d6('0x48')],qs[_0xd2d6('0x61')](_0x373612[_0xd2d6('0x49')][_0xd2d6('0x61')]));_0x3b8693[_0xd2d6('0x4c')]=_0x3b8693[_0xd2d6('0x4c')][_0xd2d6('0x4d')]?_0x3b8693[_0xd2d6('0x4c')]:_0x2f0481['model'];if(!_0x373612[_0xd2d6('0x49')][_0xd2d6('0x6d')](_0xd2d6('0x4e'))){_0x3b8693['limit']=qs[_0xd2d6('0x21')](_0x373612['query']['limit']);_0x3b8693['offset']=qs[_0xd2d6('0x1e')](_0x373612[_0xd2d6('0x49')][_0xd2d6('0x1e')]);}_0x3b8693[_0xd2d6('0x4f')]=qs['sort'](_0x373612[_0xd2d6('0x49')][_0xd2d6('0x50')]);_0x3b8693[_0xd2d6('0x51')]=qs[_0xd2d6('0x4a')](_['pick'](_0x373612[_0xd2d6('0x49')],_0x2f0481['filters']));_0x3b8693[_0xd2d6('0x51')][_0xd2d6('0x68')]=_0x558967['id'];if(_0x373612[_0xd2d6('0x49')][_0xd2d6('0x53')]){_0x3b8693[_0xd2d6('0x51')]=_[_0xd2d6('0x54')](_0x3b8693[_0xd2d6('0x51')],{'$or':_['map'](_0x3b8693[_0xd2d6('0x4c')],function(_0x355b12){var _0x24508d={};_0x24508d[_0x355b12]={'$like':'%'+_0x373612[_0xd2d6('0x49')]['filter']+'%'};return _0x24508d;})});}if(_0x373612[_0xd2d6('0x49')][_0xd2d6('0x96')]){var _0x2f8add=_0x373612['query']['$gte']['split'](',');var _0xf3a7de={};_0xf3a7de[_0x2f8add[0x0]]={'$gte':moment(_0x2f8add[0x1])[_0xd2d6('0x97')](_0xd2d6('0x98'))};_0x3b8693[_0xd2d6('0x51')]=_[_0xd2d6('0x54')](_0x3b8693[_0xd2d6('0x51')],_0xf3a7de);}_0x3b8693=_[_0xd2d6('0x54')]({},_0x3b8693,_0x373612[_0xd2d6('0x57')]);return db[_0xd2d6('0x95')][_0xd2d6('0x20')]({'where':_0x3b8693[_0xd2d6('0x51')]})[_0xd2d6('0x23')](function(_0x204a28){_0x2bef9f[_0xd2d6('0x20')]=_0x204a28;if(_0x373612['query'][_0xd2d6('0x58')]){_0x3b8693[_0xd2d6('0x59')]=[{'all':!![]}];}return db[_0xd2d6('0x95')][_0xd2d6('0x5b')](_0x3b8693);})[_0xd2d6('0x23')](function(_0x20677a){if(_0x373612[_0xd2d6('0x49')][_0xd2d6('0x99')]===_0xd2d6('0x9a')){for(var _0x29d46b=0x0;_0x29d46b<_0x20677a[_0xd2d6('0x4d')];_0x29d46b++){_0x20677a[_0x29d46b][_0xd2d6('0x63')]=juice(_0x20677a[_0x29d46b][_0xd2d6('0x63')]);}}_0x2bef9f[_0xd2d6('0x6e')]=_0x20677a;return _0x2bef9f;});}})['then'](respondWithFilteredResult(_0x3bf729,_0x3b8693))[_0xd2d6('0x19')](handleError(_0x3bf729,null));};exports[_0xd2d6('0x93')]=function(_0x2e925b,_0x3b3443){var _0x5a4cdd,_0x1d74a0={},_0x116a0d;if(_0x2e925b['body']['to']){_0x116a0d=_0x2e925b[_0xd2d6('0x63')]['to'][_0xd2d6('0x9b')](',')[0x0];}return db['MailAccount'][_0xd2d6('0x62')]({'where':{'id':_0x2e925b[_0xd2d6('0x5d')]['id']},'include':[{'model':db[_0xd2d6('0x9c')],'as':_0xd2d6('0x9d'),'include':[{'model':db[_0xd2d6('0x84')],'as':_0xd2d6('0x9e'),'where':{'email':_0x116a0d},'limit':0x1,'order':[[_0xd2d6('0x9f'),_0xd2d6('0xa0')]]}]},{'model':db[_0xd2d6('0x43')],'as':_0xd2d6('0x40'),'raw':!![],'include':[{'model':db[_0xd2d6('0xa1')],'as':'CloudProvider','raw':!![]}]}]})[_0xd2d6('0x23')](handleEntityNotFound(_0x3b3443,null))['then'](function(_0x15f1a7){if(!_0x15f1a7)return;_0x5a4cdd=_0x15f1a7;if(!_0x15f1a7[_0xd2d6('0x40')])throw new Error(_0xd2d6('0xa2'));if(_[_0xd2d6('0x74')](_0x2e925b[_0xd2d6('0x63')][_0xd2d6('0xa3')])){_0x2e925b[_0xd2d6('0x63')][_0xd2d6('0xa3')]=util[_0xd2d6('0x97')](_0xd2d6('0xa4'),_0x15f1a7[_0xd2d6('0x56')],_0x15f1a7['email']||_0x15f1a7[_0xd2d6('0x40')][_0xd2d6('0x34')]);}if(_0x2e925b['body'][_0xd2d6('0xa5')]&&_0x2e925b[_0xd2d6('0x63')][_0xd2d6('0xa5')]['length']){for(var _0x46dd44=0x0;_0x46dd44<_0x2e925b['body']['attachments']['length'];_0x46dd44+=0x1){_0x2e925b[_0xd2d6('0x63')][_0xd2d6('0xa5')][_0x46dd44]={'filename':_0x2e925b[_0xd2d6('0x63')]['attachments'][_0x46dd44][_0xd2d6('0x56')],'path':path[_0xd2d6('0xa6')](config['root'],'server/files/attachments',_0x2e925b['body'][_0xd2d6('0xa5')][_0x46dd44]['basename'])};}}var _0x33b7bb=_0x15f1a7[_0xd2d6('0xa7')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x33b7bb,'message':_0x2e925b['body']});})[_0xd2d6('0x23')](function(_0xe5730a){if(!_0xe5730a)return;_0x1d74a0=_0xe5730a;if(!_0x5a4cdd[_0xd2d6('0x9d')])throw new Error(_0xd2d6('0xa8'));if(_0x5a4cdd[_0xd2d6('0x9d')][_0xd2d6('0x9e')][_0xd2d6('0x4d')])return _0x5a4cdd[_0xd2d6('0x9d')][_0xd2d6('0x9e')][0x0];return db[_0xd2d6('0x84')][_0xd2d6('0x6a')](_[_0xd2d6('0xa9')](_0x2e925b[_0xd2d6('0x63')],{'firstName':_0x2e925b[_0xd2d6('0x63')]['to'],'email':_0x2e925b[_0xd2d6('0x63')]['to'],'phone':_0x2e925b[_0xd2d6('0x63')]['to'],'ListId':_0x5a4cdd['ListId']}));})['then'](function(_0x70e6b2){if(!_0x70e6b2)return;var _0x39bbc4={'UserId':_0x2e925b[_0xd2d6('0x34')]['id'],'ContactId':_0x70e6b2['id'],'MailAccountId':_0x5a4cdd['id'],'inReplyTo':_0x1d74a0[_0xd2d6('0xaa')],'to':_0x2e925b[_0xd2d6('0x63')]['from'],'cc':_0x2e925b['body']['cc'],'subject':_0x2e925b[_0xd2d6('0x63')][_0xd2d6('0xab')],'attach':_0x2e925b['body']['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0xd2d6('0x97')](_0xd2d6('0x98')),'lastMsgDirection':_0xd2d6('0xac'),'Messages':[_[_0xd2d6('0x54')](_0x2e925b[_0xd2d6('0x63')],{'messageId':_0x1d74a0[_0xd2d6('0xaa')],'sentAt':moment()['format'](_0xd2d6('0x98')),'read':!![],'MailAccountId':_0x5a4cdd['id'],'UserId':_0x2e925b[_0xd2d6('0x34')]['id'],'ContactId':_0x70e6b2['id']})]};if(_0x2e925b[_0xd2d6('0x63')]['Interaction']){_0x39bbc4=_[_0xd2d6('0x54')](_0x39bbc4,_0x2e925b[_0xd2d6('0x63')]['Interaction']);}return db['MailInteraction']['create'](_0x39bbc4,{'include':[{'model':db[_0xd2d6('0x95')],'as':_0xd2d6('0xad')}]});})[_0xd2d6('0x23')](respondWithResult(_0x3b3443,null))[_0xd2d6('0x19')](handleError(_0x3b3443,null));};exports[_0xd2d6('0xae')]=function(_0xeed1bc,_0x1362ca){return db[_0xd2d6('0x5a')][_0xd2d6('0x62')]({'where':{'id':_0xeed1bc[_0xd2d6('0x5d')]['id']},'include':[{'model':db[_0xd2d6('0x43')],'as':_0xd2d6('0x40'),'raw':!![],'include':[{'model':db[_0xd2d6('0xa1')],'as':_0xd2d6('0xa1'),'raw':!![]}]}]})[_0xd2d6('0x23')](handleEntityNotFound(_0x1362ca,null))[_0xd2d6('0x23')](function(_0x5a82b8){if(!_0x5a82b8[_0xd2d6('0x40')])return;var _0x5e0dc7=_0x5a82b8[_0xd2d6('0xa7')]();return respondWithRpcPromise(_0xd2d6('0xaf'),'verifySmtp',{'account':_0x5e0dc7});})['then'](respondWithResult(_0x1362ca,null))[_0xd2d6('0x19')](handleError(_0x1362ca,null));};exports['destroy']=function(_0x56e1b0,_0x5e9da0){return db[_0xd2d6('0x5a')]['find']({'where':{'id':_0x56e1b0['params']['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x5e9da0,null))[_0xd2d6('0x23')](function(_0xa39333){if(_0xa39333&&_0xa39333[_0xd2d6('0x3d')]){throw new db[(_0xd2d6('0xb0'))]['ValidationError'](_0xd2d6('0xb1'));}return _0xa39333;})['then'](removeEntity(_0x5e9da0,null))[_0xd2d6('0x19')](handleError(_0x5e9da0,null));};exports[_0xd2d6('0xb2')]=function(_0x1feb06,_0x27c982){return db[_0xd2d6('0x5a')][_0xd2d6('0x62')]({'where':{'id':_0x1feb06['params']['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x27c982,null))['then'](function(_0x5e56c6){if(_0x5e56c6){return _0x5e56c6[_0xd2d6('0xb2')](_0x1feb06[_0xd2d6('0x63')][_0xd2d6('0x70')],_[_0xd2d6('0x83')](_0x1feb06[_0xd2d6('0x63')],['ids','id'])||{})[_0xd2d6('0xb3')](function(_0x23ed72){for(var _0x165ca2=0x0;_0x165ca2<_0x1feb06['body'][_0xd2d6('0x70')][_0xd2d6('0x4d')];_0x165ca2+=0x1){socket[_0xd2d6('0xb4')](_0xd2d6('0xb5'),{'UserId':Number(_0x1feb06['body'][_0xd2d6('0x70')][_0x165ca2]),'MailAccountId':Number(_0x1feb06[_0xd2d6('0x5d')]['id'])});}return _0x23ed72;});}})[_0xd2d6('0x23')](respondWithResult(_0x27c982,null))[_0xd2d6('0x19')](handleError(_0x27c982,null));};exports['removeAgents']=function(_0x561dcb,_0x40c436){return db[_0xd2d6('0x5a')][_0xd2d6('0x62')]({'where':{'id':_0x561dcb[_0xd2d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x40c436,null))[_0xd2d6('0x23')](function(_0x2d79c4){if(_0x2d79c4){return _0x2d79c4['removeAgents'](_0x561dcb[_0xd2d6('0x49')][_0xd2d6('0x70')])['then'](function(){if(_['isArray'](_0x561dcb['query']['ids'])){for(var _0x1dd7e6=0x0;_0x1dd7e6<_0x561dcb[_0xd2d6('0x49')][_0xd2d6('0x70')]['length'];_0x1dd7e6+=0x1){socket[_0xd2d6('0xb4')]('userMailAccount:remove',{'UserId':Number(_0x561dcb['query'][_0xd2d6('0x70')][_0x1dd7e6]),'MailAccountId':Number(_0x561dcb[_0xd2d6('0x5d')]['id'])});}}else{socket['emit'](_0xd2d6('0xb6'),{'UserId':Number(_0x561dcb[_0xd2d6('0x49')][_0xd2d6('0x70')]),'MailAccountId':Number(_0x561dcb[_0xd2d6('0x5d')]['id'])});}});}})[_0xd2d6('0x23')](respondWithStatusCode(_0x40c436,null))[_0xd2d6('0x19')](handleError(_0x40c436,null));};exports[_0xd2d6('0xb7')]=function(_0x11a389,_0x1a1b32){var _0x52babe={};var _0x47b6d1={};var _0x3a32a4;var _0x240dd0;return db['MailAccount'][_0xd2d6('0x6c')]({'where':{'id':_0x11a389[_0xd2d6('0x5d')]['id']}})[_0xd2d6('0x23')](handleEntityNotFound(_0x1a1b32,null))[_0xd2d6('0x23')](function(_0x2863c9){if(_0x2863c9){_0x3a32a4=_0x2863c9;_0x47b6d1[_0xd2d6('0x48')]=_[_0xd2d6('0x5f')](db[_0xd2d6('0x85')][_0xd2d6('0x60')]);_0x47b6d1[_0xd2d6('0x49')]=_[_0xd2d6('0x5f')](_0x11a389['query']);_0x47b6d1['filters']=_[_0xd2d6('0x4b')](_0x47b6d1[_0xd2d6('0x48')],_0x47b6d1[_0xd2d6('0x49')]);_0x52babe[_0xd2d6('0x4c')]=_[_0xd2d6('0x4b')](_0x47b6d1[_0xd2d6('0x48')],qs[_0xd2d6('0x61')](_0x11a389['query'][_0xd2d6('0x61')]));_0x52babe[_0xd2d6('0x4c')]=_0x52babe[_0xd2d6('0x4c')][_0xd2d6('0x4d')]?_0x52babe[_0xd2d6('0x4c')]:_0x47b6d1[_0xd2d6('0x48')];_0x52babe['order']=qs[_0xd2d6('0x50')](_0x11a389[_0xd2d6('0x49')]['sort']);_0x52babe[_0xd2d6('0x51')]=qs[_0xd2d6('0x4a')](_[_0xd2d6('0x52')](_0x11a389[_0xd2d6('0x49')],_0x47b6d1[_0xd2d6('0x4a')]));if(_0x11a389[_0xd2d6('0x49')][_0xd2d6('0x53')]){_0x52babe[_0xd2d6('0x51')]=_[_0xd2d6('0x54')](_0x52babe['where'],{'$or':_[_0xd2d6('0x45')](_0x52babe[_0xd2d6('0x4c')],function(_0x2b0d08){var _0x224e7a={};_0x224e7a[_0x2b0d08]={'$like':'%'+_0x11a389[_0xd2d6('0x49')][_0xd2d6('0x53')]+'%'};return _0x224e7a;})});}_0x52babe=_[_0xd2d6('0x54')]({},_0x52babe,_0x11a389['options']);return _0x3a32a4[_0xd2d6('0xb7')](_0x52babe);}})[_0xd2d6('0x23')](function(_0x5546d7){if(_0x5546d7){_0x240dd0=_0x5546d7[_0xd2d6('0x4d')];if(!_0x11a389[_0xd2d6('0x49')][_0xd2d6('0x6d')](_0xd2d6('0x4e'))){_0x52babe[_0xd2d6('0x21')]=qs['limit'](_0x11a389[_0xd2d6('0x49')][_0xd2d6('0x21')]);_0x52babe['offset']=qs[_0xd2d6('0x1e')](_0x11a389[_0xd2d6('0x49')][_0xd2d6('0x1e')]);}return _0x3a32a4['getAgents'](_0x52babe);}})[_0xd2d6('0x23')](function(_0x4f486f){if(_0x4f486f){return _0x4f486f?{'count':_0x240dd0,'rows':_0x4f486f}:null;}})[_0xd2d6('0x23')](respondWithResult(_0x1a1b32,null))[_0xd2d6('0x19')](handleError(_0x1a1b32,null));}; \ No newline at end of file +var _0xa5a5=['ids','CannedAnswer','pick','removeAnswers','ListId','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','User','Owner','fullname','internal','Tag','Tags','tag','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','priority','getApplications','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','CmContact','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','join','root','server/files/attachments','basename','sendMail','List\x20not\x20found','subject','attach','out','messageId','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','UserProfileResource','stack','name','send','gmail','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','hotmail','smtp-mail.outlook.com','user','username','password','pass','CloudProviderId','host','port','service','authentication','Imap','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','Smtp','length','options','body','provider','secure','modernAuthentication','find','params','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create','getDispositions','findOne','filter','removeDispositions'];(function(_0x445699,_0x19168b){var _0x431ac0=function(_0x328e14){while(--_0x328e14){_0x445699['push'](_0x445699['shift']());}};_0x431ac0(++_0x19168b);}(_0xa5a5,0x105));var _0x5a5a=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xa5a5[_0xc0a3d3];return _0x3386e8;};'use strict';var moment=require(_0x5a5a('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var _=require(_0x5a5a('0x1'));var juice=require(_0x5a5a('0x2'));var Redis=require(_0x5a5a('0x3'));var qs=require(_0x5a5a('0x4'));var logger=require('../../config/logger')(_0x5a5a('0x5'));var config=require(_0x5a5a('0x6'));var db=require('../../mysqldb')['db'];config[_0x5a5a('0x7')]=_[_0x5a5a('0x8')](config[_0x5a5a('0x7')],{'host':_0x5a5a('0x9'),'port':0x18eb});var socket=require(_0x5a5a('0xa'))(new Redis(config[_0x5a5a('0x7')]));require('./mailAccount.socket')[_0x5a5a('0xb')](socket);var jayson=require(_0x5a5a('0xc'));var client=jayson['client'][_0x5a5a('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x326946,_0x2b58b7,_0x190fbc,_0x5aeb75){return new BPromise(function(_0x3cada5,_0x3e8fa2){var _0x5d212a=_0x5aeb75||client;return _0x5d212a['request'](_0x326946,_0x190fbc)[_0x5a5a('0xe')](function(_0xd6a2e8){logger[_0x5a5a('0xf')](_0x5a5a('0x10'),_0x2b58b7,_0x5a5a('0x11'));logger[_0x5a5a('0x12')](_0x5a5a('0x13'),_0x2b58b7,_0x5a5a('0x11'),JSON['stringify'](_0xd6a2e8));if(_0xd6a2e8[_0x5a5a('0x14')]){if(_0xd6a2e8[_0x5a5a('0x14')][_0x5a5a('0x15')]===0x1f4){logger[_0x5a5a('0x14')]('MailAccount,\x20%s,\x20%s',_0x2b58b7,_0xd6a2e8[_0x5a5a('0x14')]['message']);return _0x3e8fa2(_0xd6a2e8[_0x5a5a('0x14')]['message']);}logger[_0x5a5a('0x14')](_0x5a5a('0x10'),_0x2b58b7,_0xd6a2e8[_0x5a5a('0x14')][_0x5a5a('0x16')]);return _0x3cada5(_0xd6a2e8[_0x5a5a('0x14')][_0x5a5a('0x16')]);}else{logger['info'](_0x5a5a('0x10'),_0x2b58b7,_0x5a5a('0x11'));_0x3cada5(_0xd6a2e8['result'][_0x5a5a('0x16')]);}})[_0x5a5a('0x17')](function(_0x1c2497){logger[_0x5a5a('0x14')](_0x5a5a('0x10'),_0x2b58b7,_0x1c2497);_0x3e8fa2(_0x1c2497);});});}function respondWithStatusCode(_0x1f5acb,_0x30f1b4){_0x30f1b4=_0x30f1b4||0xcc;return function(_0x5b2ea9){if(_0x5b2ea9){return _0x1f5acb[_0x5a5a('0x18')](_0x30f1b4);}return _0x1f5acb[_0x5a5a('0x19')](_0x30f1b4)[_0x5a5a('0x1a')]();};}function respondWithResult(_0xe02f6f,_0x3f3761){_0x3f3761=_0x3f3761||0xc8;return function(_0x15f7e7){if(_0x15f7e7){return _0xe02f6f[_0x5a5a('0x19')](_0x3f3761)[_0x5a5a('0x1b')](_0x15f7e7);}};}function respondWithFilteredResult(_0x3cefb4,_0x40058d){return function(_0x3cbc35){if(_0x3cbc35){var _0x3f76ad=typeof _0x40058d[_0x5a5a('0x1c')]===_0x5a5a('0x1d')&&typeof _0x40058d[_0x5a5a('0x1e')]===_0x5a5a('0x1d');var _0x1f0a41=_0x3cbc35[_0x5a5a('0x1f')];var _0x1b789b=_0x3f76ad?0x0:_0x40058d[_0x5a5a('0x1c')];var _0x400ee7=_0x3f76ad?_0x3cbc35[_0x5a5a('0x1f')]:_0x40058d[_0x5a5a('0x1c')]+_0x40058d[_0x5a5a('0x1e')];var _0x30b63a;if(_0x400ee7>=_0x1f0a41){_0x400ee7=_0x1f0a41;_0x30b63a=0xc8;}else{_0x30b63a=0xce;}_0x3cefb4['status'](_0x30b63a);return _0x3cefb4[_0x5a5a('0x20')](_0x5a5a('0x21'),_0x1b789b+'-'+_0x400ee7+'/'+_0x1f0a41)['json'](_0x3cbc35);}return null;};}function saveUpdates(_0x2f908d){return function(_0x3a7ea5){if(_0x3a7ea5){return _0x3a7ea5[_0x5a5a('0x22')](_0x2f908d)[_0x5a5a('0xe')](function(_0x31d9e4){return _0x31d9e4;});}return null;};}function removeEntity(_0x397b12){return function(_0x5affc0){if(_0x5affc0){return _0x5affc0[_0x5a5a('0x23')]()[_0x5a5a('0xe')](function(){var _0x57a971=_0x5affc0['get']({'plain':!![]});var _0x1dd4af='MailAccounts';return db[_0x5a5a('0x24')][_0x5a5a('0x23')]({'where':{'type':_0x1dd4af,'resourceId':_0x57a971['id']}})[_0x5a5a('0xe')](function(){return _0x5affc0;});})[_0x5a5a('0xe')](function(){_0x397b12['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d079c){return function(_0x118a07){if(!_0x118a07){_0x3d079c[_0x5a5a('0x18')](0x194);}return _0x118a07;};}function handleError(_0x4e65b4,_0x3e070c){_0x3e070c=_0x3e070c||0x1f4;return function(_0x2786ce){logger[_0x5a5a('0x14')](_0x2786ce[_0x5a5a('0x25')]);if(_0x2786ce[_0x5a5a('0x26')]){delete _0x2786ce[_0x5a5a('0x26')];}_0x4e65b4[_0x5a5a('0x19')](_0x3e070c)[_0x5a5a('0x27')](_0x2786ce);};}function getImapHost(_0x183caa){switch(_0x183caa){case _0x5a5a('0x28'):return'imap.gmail.com';case _0x5a5a('0x29'):return'imap.mail.yahoo.com';case'hotmail':return _0x5a5a('0x2a');case _0x5a5a('0x2b'):return _0x5a5a('0x2c');}throw new Error(_0x5a5a('0x2d'),_0x183caa);}function getSmtpHost(_0x5e74d7){switch(_0x5e74d7){case _0x5a5a('0x28'):return _0x5a5a('0x2e');case _0x5a5a('0x29'):return'smtp.mail.yahoo.com';case _0x5a5a('0x2f'):return _0x5a5a('0x30');case _0x5a5a('0x2b'):return'smtp.office365.com';}throw new Error(_0x5a5a('0x2d'),_0x5e74d7);}function getAuthenticationOptions(_0x1ae9b3,_0x676aa2){var _0x272c59={};var _0x451f40={};if(_0x1ae9b3){_0x272c59[_0x5a5a('0x31')]=_0x451f40[_0x5a5a('0x31')]=_0x676aa2[_0x5a5a('0x32')];_0x272c59[_0x5a5a('0x33')]=_0x451f40[_0x5a5a('0x34')]=_0x676aa2['password'];if(_0x676aa2['modernAuthentication']){_0x272c59['modernAuthentication']=_0x451f40['modernAuthentication']=!![];_0x272c59[_0x5a5a('0x35')]=_0x451f40[_0x5a5a('0x35')]=_0x676aa2[_0x5a5a('0x35')];_0x272c59[_0x5a5a('0x33')]=_0x451f40[_0x5a5a('0x34')]=null;}else{_0x272c59[_0x5a5a('0x35')]=_0x451f40[_0x5a5a('0x35')]=null;}_0x272c59[_0x5a5a('0x36')]=getImapHost(_0x1ae9b3);_0x272c59[_0x5a5a('0x37')]=0x3e1;_0x451f40[_0x5a5a('0x36')]=getSmtpHost(_0x1ae9b3);_0x451f40['port']=0x24b;_0x451f40['secure']=![];_0x272c59[_0x5a5a('0x38')]=_0x451f40[_0x5a5a('0x38')]=null;}else{if(_0x676aa2[_0x5a5a('0x39')]){_0x272c59['user']=_0x451f40['user']=_0x676aa2[_0x5a5a('0x32')];_0x272c59[_0x5a5a('0x33')]=_0x451f40[_0x5a5a('0x34')]=_0x676aa2[_0x5a5a('0x33')];}else{_0x272c59[_0x5a5a('0x39')]=_0x451f40['authentication']=![];_0x272c59[_0x5a5a('0x31')]=_0x451f40[_0x5a5a('0x31')]=null;_0x272c59['password']=_0x451f40[_0x5a5a('0x34')]=null;}_0x272c59[_0x5a5a('0x36')]=_0x676aa2['Imap']['host'];_0x272c59[_0x5a5a('0x37')]=_0x676aa2[_0x5a5a('0x3a')][_0x5a5a('0x37')];_0x451f40[_0x5a5a('0x36')]=_0x676aa2['Smtp']['host'];_0x451f40['port']=_0x676aa2['Smtp'][_0x5a5a('0x37')];}return{'Imap':_0x272c59,'Smtp':_0x451f40};}exports['index']=function(_0x4c20f2,_0x16b7cd){var _0xfa7006={'include':[{'model':db[_0x5a5a('0x3b')],'as':_0x5a5a('0x3a')},{'model':db[_0x5a5a('0x3c')],'as':'Smtp'},{'model':db[_0x5a5a('0x3d')],'as':_0x5a5a('0x3e')}]},_0x462f21={},_0x5d325e={'count':0x0,'rows':[]};var _0x2e5891=_[_0x5a5a('0x3f')](db[_0x5a5a('0x40')][_0x5a5a('0x41')],function(_0x2b6f9f){return{'name':_0x2b6f9f[_0x5a5a('0x42')],'type':_0x2b6f9f[_0x5a5a('0x43')][_0x5a5a('0x44')]};});_0x462f21['model']=_[_0x5a5a('0x3f')](_0x2e5891,'name');_0x462f21[_0x5a5a('0x45')]=_[_0x5a5a('0x46')](_0x4c20f2[_0x5a5a('0x45')]);_0x462f21[_0x5a5a('0x47')]=_[_0x5a5a('0x48')](_0x462f21[_0x5a5a('0x49')],_0x462f21[_0x5a5a('0x45')]);_0xfa7006[_0x5a5a('0x4a')]=_[_0x5a5a('0x48')](_0x462f21['model'],qs[_0x5a5a('0x4b')](_0x4c20f2[_0x5a5a('0x45')][_0x5a5a('0x4b')]));_0xfa7006[_0x5a5a('0x4a')]=_0xfa7006[_0x5a5a('0x4a')]['length']?_0xfa7006[_0x5a5a('0x4a')]:_0x462f21[_0x5a5a('0x49')];if(!_0x4c20f2[_0x5a5a('0x45')][_0x5a5a('0x4c')](_0x5a5a('0x4d'))){_0xfa7006[_0x5a5a('0x1e')]=qs['limit'](_0x4c20f2[_0x5a5a('0x45')][_0x5a5a('0x1e')]);_0xfa7006[_0x5a5a('0x1c')]=qs[_0x5a5a('0x1c')](_0x4c20f2['query']['offset']);}_0xfa7006[_0x5a5a('0x4e')]=qs['sort'](_0x4c20f2[_0x5a5a('0x45')][_0x5a5a('0x4f')]);_0xfa7006[_0x5a5a('0x50')]=qs[_0x5a5a('0x47')](_['pick'](_0x4c20f2[_0x5a5a('0x45')],_0x462f21['filters']),_0x2e5891);if(_0x4c20f2[_0x5a5a('0x45')]['filter']){_0xfa7006['where']=_[_0x5a5a('0x51')](_0xfa7006[_0x5a5a('0x50')],{'$or':_[_0x5a5a('0x3f')](_0x2e5891,function(_0x5a04f1){if(_0x5a04f1[_0x5a5a('0x43')]!==_0x5a5a('0x52')){var _0x5a3baa={};_0x5a3baa[_0x5a04f1[_0x5a5a('0x26')]]={'$like':'%'+_0x4c20f2[_0x5a5a('0x45')]['filter']+'%'};return _0x5a3baa;}})});}_0xfa7006=_[_0x5a5a('0x51')]({},_0xfa7006,_0x4c20f2['options']);var _0xf4d22b={'where':_0xfa7006['where']};return db[_0x5a5a('0x40')][_0x5a5a('0x1f')](_0xf4d22b)[_0x5a5a('0xe')](function(_0x5b40b8){_0x5d325e[_0x5a5a('0x1f')]=_0x5b40b8;if(_0x4c20f2[_0x5a5a('0x45')][_0x5a5a('0x53')]){_0xfa7006[_0x5a5a('0x54')]=[{'all':!![]}];}return db['MailAccount'][_0x5a5a('0x55')](_0xfa7006);})[_0x5a5a('0xe')](function(_0x22362c){_0x5d325e[_0x5a5a('0x56')]=_0x22362c;return _0x5d325e;})[_0x5a5a('0xe')](respondWithFilteredResult(_0x16b7cd,_0xfa7006))[_0x5a5a('0x17')](handleError(_0x16b7cd,null));};exports['show']=function(_0x378e53,_0x5472d1){var _0x5e288c={'raw':![],'where':{'id':_0x378e53['params']['id']},'include':[{'model':db[_0x5a5a('0x3b')],'as':_0x5a5a('0x3a')},{'model':db['MailServerOut'],'as':_0x5a5a('0x57')},{'model':db[_0x5a5a('0x3d')],'as':_0x5a5a('0x3e')}]},_0x4e224a={};_0x4e224a['model']=_[_0x5a5a('0x46')](db[_0x5a5a('0x40')][_0x5a5a('0x41')]);_0x4e224a['query']=_[_0x5a5a('0x46')](_0x378e53[_0x5a5a('0x45')]);_0x4e224a['filters']=_['intersection'](_0x4e224a[_0x5a5a('0x49')],_0x4e224a[_0x5a5a('0x45')]);_0x5e288c[_0x5a5a('0x4a')]=_['intersection'](_0x4e224a[_0x5a5a('0x49')],qs[_0x5a5a('0x4b')](_0x378e53[_0x5a5a('0x45')][_0x5a5a('0x4b')]));_0x5e288c['attributes']=_0x5e288c[_0x5a5a('0x4a')][_0x5a5a('0x58')]?_0x5e288c[_0x5a5a('0x4a')]:_0x4e224a[_0x5a5a('0x49')];if(_0x378e53[_0x5a5a('0x45')][_0x5a5a('0x53')]){_0x5e288c[_0x5a5a('0x54')]=[{'all':!![]}];}_0x5e288c=_[_0x5a5a('0x51')]({},_0x5e288c,_0x378e53[_0x5a5a('0x59')]);return db['MailAccount']['find'](_0x5e288c)['then'](handleEntityNotFound(_0x5472d1,null))[_0x5a5a('0xe')](respondWithResult(_0x5472d1,null))[_0x5a5a('0x17')](handleError(_0x5472d1,null));};exports[_0x5a5a('0x22')]=function(_0x39f401,_0x94c383){if(_0x39f401['body']['id']){delete _0x39f401[_0x5a5a('0x5a')]['id'];}var _0x595c9a=_0x39f401[_0x5a5a('0x5a')][_0x5a5a('0x5b')]==='custom'?null:_0x39f401[_0x5a5a('0x5a')][_0x5a5a('0x5b')];var _0x1c0888=_0x39f401['body']['Imap']||{};var _0x41cfb6=_0x39f401[_0x5a5a('0x5a')]['Smtp']||{};if(_0x595c9a){_0x1c0888[_0x5a5a('0x36')]=getImapHost(_0x595c9a);_0x1c0888[_0x5a5a('0x37')]=0x3e1;_0x41cfb6['host']=getSmtpHost(_0x595c9a);_0x41cfb6['port']=0x24b;_0x41cfb6[_0x5a5a('0x5c')]=![];}if(_0x41cfb6[_0x5a5a('0x5d')]){_0x41cfb6[_0x5a5a('0x5c')]=![];}else{_0x41cfb6[_0x5a5a('0x35')]=null;}if(!_0x1c0888[_0x5a5a('0x5d')])_0x1c0888[_0x5a5a('0x35')]=null;_0x39f401[_0x5a5a('0x5a')][_0x5a5a('0x3a')]=_0x1c0888;_0x39f401[_0x5a5a('0x5a')][_0x5a5a('0x57')]=_0x41cfb6;return db[_0x5a5a('0x40')][_0x5a5a('0x5e')]({'where':{'id':_0x39f401[_0x5a5a('0x5f')]['id']},'include':[{'model':db[_0x5a5a('0x3b')],'as':_0x5a5a('0x3a')},{'model':db[_0x5a5a('0x3c')],'as':'Smtp'},{'model':db['Pause'],'as':_0x5a5a('0x3e')}]})[_0x5a5a('0xe')](handleEntityNotFound(_0x94c383,null))[_0x5a5a('0xe')](function(_0x30234e){if(!_0x30234e)throw new Error(_0x5a5a('0x60'));if(_0x30234e[_0x5a5a('0x38')])delete _0x39f401['body']['Imap'];return _0x30234e;})[_0x5a5a('0xe')](saveUpdates(_0x39f401['body'],null))[_0x5a5a('0xe')](function(_0x5031bd){if(!_0x39f401[_0x5a5a('0x5a')][_0x5a5a('0x3a')])return _0x5031bd;return db[_0x5a5a('0x3b')]['update'](_0x39f401['body']['Imap'],{'where':{'MailAccountId':_0x5031bd['id']}})['then'](function(){return _0x5031bd;});})[_0x5a5a('0xe')](function(_0x46b914){if(!_0x39f401[_0x5a5a('0x5a')]['Smtp'])return _0x46b914;return db['MailServerOut'][_0x5a5a('0x22')](_0x39f401[_0x5a5a('0x5a')]['Smtp'],{'where':{'MailAccountId':_0x46b914['id']}})[_0x5a5a('0xe')](function(){return _0x46b914;});})[_0x5a5a('0xe')](respondWithResult(_0x94c383,null))[_0x5a5a('0x17')](handleError(_0x94c383,null));};exports[_0x5a5a('0x61')]=function(_0x248715,_0xc71ca){return db[_0x5a5a('0x40')][_0x5a5a('0x61')]()[_0x5a5a('0xe')](respondWithResult(_0xc71ca,null))[_0x5a5a('0x17')](handleError(_0xc71ca,null));};exports['addDisposition']=function(_0x715b16,_0x55190f){if(_0x715b16[_0x5a5a('0x5a')]['id']){delete _0x715b16[_0x5a5a('0x5a')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x715b16[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x55190f,null))['then'](function(_0x4bb286){if(_0x4bb286){_0x715b16['body'][_0x5a5a('0x62')]=_0x4bb286['id'];return db[_0x5a5a('0x63')][_0x5a5a('0x64')](_0x715b16['body']);}})[_0x5a5a('0xe')](respondWithResult(_0x55190f,null))[_0x5a5a('0x17')](handleError(_0x55190f,null));};exports[_0x5a5a('0x65')]=function(_0x2fb5dc,_0x4596c8){var _0x42d8ad={'raw':![],'where':{}};var _0xe20993={};var _0x2e11d8={'count':0x0,'rows':[]};return db[_0x5a5a('0x40')][_0x5a5a('0x66')]({'where':{'id':_0x2fb5dc[_0x5a5a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4596c8,null))[_0x5a5a('0xe')](function(_0x26e665){if(_0x26e665){_0xe20993[_0x5a5a('0x49')]=_[_0x5a5a('0x46')](db['Disposition'][_0x5a5a('0x41')]);_0xe20993['query']=_[_0x5a5a('0x46')](_0x2fb5dc[_0x5a5a('0x45')]);_0xe20993['filters']=_[_0x5a5a('0x48')](_0xe20993[_0x5a5a('0x49')],_0xe20993['query']);_0x42d8ad[_0x5a5a('0x4a')]=_['intersection'](_0xe20993['model'],qs[_0x5a5a('0x4b')](_0x2fb5dc[_0x5a5a('0x45')][_0x5a5a('0x4b')]));_0x42d8ad[_0x5a5a('0x4a')]=_0x42d8ad['attributes'][_0x5a5a('0x58')]?_0x42d8ad[_0x5a5a('0x4a')]:_0xe20993[_0x5a5a('0x49')];if(!_0x2fb5dc['query']['hasOwnProperty'](_0x5a5a('0x4d'))){_0x42d8ad[_0x5a5a('0x1e')]=qs['limit'](_0x2fb5dc[_0x5a5a('0x45')]['limit']);_0x42d8ad[_0x5a5a('0x1c')]=qs[_0x5a5a('0x1c')](_0x2fb5dc[_0x5a5a('0x45')][_0x5a5a('0x1c')]);}_0x42d8ad[_0x5a5a('0x4e')]=qs['sort'](_0x2fb5dc['query'][_0x5a5a('0x4f')]);_0x42d8ad['where']=qs['filters'](_['pick'](_0x2fb5dc[_0x5a5a('0x45')],_0xe20993[_0x5a5a('0x47')]));_0x42d8ad[_0x5a5a('0x50')][_0x5a5a('0x62')]=_0x26e665['id'];if(_0x2fb5dc[_0x5a5a('0x45')][_0x5a5a('0x67')]){_0x42d8ad[_0x5a5a('0x50')]=_[_0x5a5a('0x51')](_0x42d8ad[_0x5a5a('0x50')],{'$or':_[_0x5a5a('0x3f')](_0x42d8ad['attributes'],function(_0x4af8c5){var _0x5e468d={};_0x5e468d[_0x4af8c5]={'$like':'%'+_0x2fb5dc[_0x5a5a('0x45')][_0x5a5a('0x67')]+'%'};return _0x5e468d;})});}_0x42d8ad=_[_0x5a5a('0x51')]({},_0x42d8ad,_0x2fb5dc[_0x5a5a('0x59')]);return db[_0x5a5a('0x63')]['count']({'where':_0x42d8ad[_0x5a5a('0x50')]})[_0x5a5a('0xe')](function(_0x4b5fe2){_0x2e11d8[_0x5a5a('0x1f')]=_0x4b5fe2;if(_0x2fb5dc[_0x5a5a('0x45')]['includeAll']){_0x42d8ad[_0x5a5a('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x5a5a('0x55')](_0x42d8ad);})['then'](function(_0x44e07d){_0x2e11d8[_0x5a5a('0x56')]=_0x44e07d;return _0x2e11d8;});}})[_0x5a5a('0xe')](respondWithFilteredResult(_0x4596c8,_0x42d8ad))['catch'](handleError(_0x4596c8,null));};exports[_0x5a5a('0x68')]=function(_0x558e83,_0xaf353e){return db['MailAccount'][_0x5a5a('0x5e')]({'where':{'id':_0x558e83[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0xaf353e,null))['then'](function(_0x47ad81){if(_0x47ad81){return _0x47ad81['removeDispositions'](_0x558e83[_0x5a5a('0x45')][_0x5a5a('0x69')]);}})[_0x5a5a('0xe')](respondWithStatusCode(_0xaf353e,null))[_0x5a5a('0x17')](handleError(_0xaf353e,null));};exports['addAnswer']=function(_0x49ec90,_0x1f3c96){if(_0x49ec90[_0x5a5a('0x5a')]['id']){delete _0x49ec90[_0x5a5a('0x5a')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x49ec90['params']['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x1f3c96,null))['then'](function(_0x4928ac){if(_0x4928ac){_0x49ec90[_0x5a5a('0x5a')][_0x5a5a('0x62')]=_0x4928ac['id'];return db[_0x5a5a('0x6a')][_0x5a5a('0x64')](_0x49ec90[_0x5a5a('0x5a')]);}})[_0x5a5a('0xe')](respondWithResult(_0x1f3c96,null))[_0x5a5a('0x17')](handleError(_0x1f3c96,null));};exports['getAnswers']=function(_0xe7289,_0x27d84f){var _0x2accc8={'raw':![],'where':{}};var _0x2cb044={};var _0x3bb735={'count':0x0,'rows':[]};return db[_0x5a5a('0x40')][_0x5a5a('0x66')]({'where':{'id':_0xe7289['params']['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x27d84f,null))[_0x5a5a('0xe')](function(_0x594232){if(_0x594232){_0x2cb044[_0x5a5a('0x49')]=_[_0x5a5a('0x46')](db[_0x5a5a('0x6a')][_0x5a5a('0x41')]);_0x2cb044['query']=_[_0x5a5a('0x46')](_0xe7289[_0x5a5a('0x45')]);_0x2cb044['filters']=_[_0x5a5a('0x48')](_0x2cb044[_0x5a5a('0x49')],_0x2cb044['query']);_0x2accc8['attributes']=_[_0x5a5a('0x48')](_0x2cb044[_0x5a5a('0x49')],qs[_0x5a5a('0x4b')](_0xe7289[_0x5a5a('0x45')][_0x5a5a('0x4b')]));_0x2accc8['attributes']=_0x2accc8['attributes'][_0x5a5a('0x58')]?_0x2accc8[_0x5a5a('0x4a')]:_0x2cb044['model'];if(!_0xe7289['query'][_0x5a5a('0x4c')]('nolimit')){_0x2accc8[_0x5a5a('0x1e')]=qs[_0x5a5a('0x1e')](_0xe7289['query'][_0x5a5a('0x1e')]);_0x2accc8[_0x5a5a('0x1c')]=qs[_0x5a5a('0x1c')](_0xe7289[_0x5a5a('0x45')][_0x5a5a('0x1c')]);}_0x2accc8[_0x5a5a('0x4e')]=qs[_0x5a5a('0x4f')](_0xe7289[_0x5a5a('0x45')][_0x5a5a('0x4f')]);_0x2accc8[_0x5a5a('0x50')]=qs['filters'](_[_0x5a5a('0x6b')](_0xe7289[_0x5a5a('0x45')],_0x2cb044['filters']));_0x2accc8[_0x5a5a('0x50')]['MailAccountId']=_0x594232['id'];if(_0xe7289[_0x5a5a('0x45')][_0x5a5a('0x67')]){_0x2accc8['where']=_['merge'](_0x2accc8['where'],{'$or':_[_0x5a5a('0x3f')](_0x2accc8[_0x5a5a('0x4a')],function(_0x443264){var _0x1a3508={};_0x1a3508[_0x443264]={'$like':'%'+_0xe7289['query']['filter']+'%'};return _0x1a3508;})});}_0x2accc8=_[_0x5a5a('0x51')]({},_0x2accc8,_0xe7289[_0x5a5a('0x59')]);return db[_0x5a5a('0x6a')]['count']({'where':_0x2accc8[_0x5a5a('0x50')]})[_0x5a5a('0xe')](function(_0x26ddba){_0x3bb735['count']=_0x26ddba;if(_0xe7289['query'][_0x5a5a('0x53')]){_0x2accc8[_0x5a5a('0x54')]=[{'all':!![]}];}return db[_0x5a5a('0x6a')][_0x5a5a('0x55')](_0x2accc8);})[_0x5a5a('0xe')](function(_0x5afd0e){_0x3bb735['rows']=_0x5afd0e;return _0x3bb735;});}})[_0x5a5a('0xe')](respondWithFilteredResult(_0x27d84f,_0x2accc8))['catch'](handleError(_0x27d84f,null));};exports[_0x5a5a('0x6c')]=function(_0x57f693,_0x451f3e){return db['MailAccount'][_0x5a5a('0x5e')]({'where':{'id':_0x57f693[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x451f3e,null))[_0x5a5a('0xe')](function(_0x31afd0){if(_0x31afd0){return _0x31afd0[_0x5a5a('0x6c')](_0x57f693['query'][_0x5a5a('0x69')]);}})[_0x5a5a('0xe')](respondWithStatusCode(_0x451f3e,null))[_0x5a5a('0x17')](handleError(_0x451f3e,null));};exports['create']=function(_0x3615a3,_0x3d1078){var _0x2aa314={'name':_0x3615a3[_0x5a5a('0x5a')][_0x5a5a('0x26')],'key':_0x3615a3['body'][_0x5a5a('0x44')],'provider':_0x3615a3[_0x5a5a('0x5a')][_0x5a5a('0x5b')]==='custom'?null:_0x3615a3['body'][_0x5a5a('0x5b')],'email':_0x3615a3['body']['email'],'ListId':_0x3615a3[_0x5a5a('0x5a')][_0x5a5a('0x6d')],'active':!_['isNil'](_0x3615a3['body'][_0x5a5a('0x6e')])?_0x3615a3['body'][_0x5a5a('0x6e')]:!![],'description':_0x3615a3['body'][_0x5a5a('0x6f')]||null};var _0x138bfc=getAuthenticationOptions(_0x2aa314[_0x5a5a('0x5b')],_0x3615a3[_0x5a5a('0x5a')]);_0x2aa314[_0x5a5a('0x3a')]=_0x138bfc[_0x5a5a('0x3a')];_0x2aa314[_0x5a5a('0x57')]=_0x138bfc[_0x5a5a('0x57')];return db[_0x5a5a('0x40')][_0x5a5a('0x64')](_0x2aa314,{'include':[{'model':db['MailServerOut'],'as':_0x5a5a('0x57')},{'model':db[_0x5a5a('0x3b')],'as':_0x5a5a('0x3a')}]})[_0x5a5a('0xe')](function(_0x2522ed){var _0x25d49f=_0x3615a3[_0x5a5a('0x31')][_0x5a5a('0x70')]({'plain':!![]});if(!_0x25d49f)throw new Error(_0x5a5a('0x71'));if(_0x25d49f[_0x5a5a('0x72')]===_0x5a5a('0x31')){var _0x3ce999=_0x2522ed['get']({'plain':!![]});return db[_0x5a5a('0x73')][_0x5a5a('0x5e')]({'where':{'name':_0x5a5a('0x74'),'userProfileId':_0x25d49f['userProfileId']},'raw':!![]})[_0x5a5a('0xe')](function(_0x2b61fc){if(_0x2b61fc&&_0x2b61fc[_0x5a5a('0x75')]===0x0){return db[_0x5a5a('0x24')][_0x5a5a('0x64')]({'name':_0x3ce999['name'],'resourceId':_0x3ce999['id'],'type':_0x2b61fc['name'],'sectionId':_0x2b61fc['id']},{})['then'](function(){return _0x2522ed;});}else{return _0x2522ed;}})['catch'](function(_0x4d985c){logger['error'](_0x5a5a('0x76'),_0x4d985c);throw _0x4d985c;});}return _0x2522ed;})[_0x5a5a('0xe')](respondWithResult(_0x3d1078,0xc9))['catch'](handleError(_0x3d1078,null));};exports[_0x5a5a('0x77')]=function(_0x195c95,_0x31558f){return db[_0x5a5a('0x40')][_0x5a5a('0x66')]({'where':{'id':_0x195c95[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x31558f,null))[_0x5a5a('0xe')](function(_0x3baff1){if(_0x3baff1){return _0x3baff1['getImap']();}return null;})[_0x5a5a('0xe')](respondWithResult(_0x31558f,null))[_0x5a5a('0x17')](handleError(_0x31558f,null));};exports['addImap']=function(_0x200ea3,_0x5c99bd){if(_0x200ea3['body']['id']){delete _0x200ea3[_0x5a5a('0x5a')]['id'];}return db[_0x5a5a('0x40')]['find']({'where':{'id':_0x200ea3['params']['id']}})['then'](handleEntityNotFound(_0x5c99bd,null))[_0x5a5a('0xe')](function(_0x4a6282){if(_0x4a6282){_0x200ea3[_0x5a5a('0x5a')][_0x5a5a('0x62')]=_0x4a6282['id'];return db[_0x5a5a('0x3b')][_0x5a5a('0x64')](_0x200ea3[_0x5a5a('0x5a')]);}})[_0x5a5a('0xe')](respondWithResult(_0x5c99bd,null))[_0x5a5a('0x17')](handleError(_0x5c99bd,null));};exports[_0x5a5a('0x78')]=function(_0x1a4ce2,_0x4ca6eb){return db['MailAccount']['findOne']({'where':{'id':_0x1a4ce2[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x4ca6eb,null))[_0x5a5a('0xe')](function(_0x5e5a97){if(_0x5e5a97){return _0x5e5a97[_0x5a5a('0x79')](null);}return null;})['then'](respondWithStatusCode(_0x4ca6eb,null))[_0x5a5a('0x17')](handleError(_0x4ca6eb,null));};exports[_0x5a5a('0x7a')]=function(_0xf9b836,_0x557158){return db[_0x5a5a('0x40')][_0x5a5a('0x66')]({'where':{'id':_0xf9b836[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x557158,null))['then'](function(_0x3cd4b8){if(_0x3cd4b8){return _0x3cd4b8['getSmtp']();}return null;})[_0x5a5a('0xe')](respondWithResult(_0x557158,null))[_0x5a5a('0x17')](handleError(_0x557158,null));};exports['addSmtp']=function(_0x2cc05c,_0x57ccf9){if(_0x2cc05c[_0x5a5a('0x5a')]['id']){delete _0x2cc05c['body']['id'];}return db['MailAccount'][_0x5a5a('0x5e')]({'where':{'id':_0x2cc05c['params']['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x57ccf9,null))[_0x5a5a('0xe')](function(_0x2776fa){if(_0x2776fa){_0x2cc05c[_0x5a5a('0x5a')]['MailAccountId']=_0x2776fa['id'];return db[_0x5a5a('0x3c')]['create'](_0x2cc05c['body']);}})[_0x5a5a('0xe')](respondWithResult(_0x57ccf9,null))[_0x5a5a('0x17')](handleError(_0x57ccf9,null));};exports[_0x5a5a('0x7b')]=function(_0x3dc83c,_0x239dbb){return db['MailAccount'][_0x5a5a('0x66')]({'where':{'id':_0x3dc83c[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x239dbb,null))[_0x5a5a('0xe')](function(_0x4e09b9){if(_0x4e09b9){return _0x4e09b9[_0x5a5a('0x7c')](null);}return null;})['then'](respondWithStatusCode(_0x239dbb,null))[_0x5a5a('0x17')](handleError(_0x239dbb,null));};exports[_0x5a5a('0x7d')]=function(_0x586045,_0x42222c){return db[_0x5a5a('0x7e')][_0x5a5a('0x5e')]({'where':{'id':_0x586045['params']['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x42222c,null))['then'](function(_0x79c746){if(_0x79c746){return _0x79c746[_0x5a5a('0x7d')](_0x586045[_0x5a5a('0x5a')][_0x5a5a('0x69')],_['omit'](_0x586045[_0x5a5a('0x5a')],[_0x5a5a('0x69'),'id'])||{});}})['then'](respondWithResult(_0x42222c,null))[_0x5a5a('0x17')](handleError(_0x42222c,null));};exports[_0x5a5a('0x7f')]=function(_0x4b4a8c,_0x4142b9){var _0x448b8e={'raw':![],'where':{}};var _0x2c8ca9={};var _0x4438e3={'count':0x0,'rows':[]};return db[_0x5a5a('0x40')][_0x5a5a('0x66')]({'where':{'id':_0x4b4a8c[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x4142b9,null))[_0x5a5a('0xe')](function(_0x2f06d8){if(_0x2f06d8){_0x2c8ca9[_0x5a5a('0x49')]=_[_0x5a5a('0x46')](db[_0x5a5a('0x7e')][_0x5a5a('0x41')]);_0x2c8ca9[_0x5a5a('0x45')]=_[_0x5a5a('0x46')](_0x4b4a8c['query']);_0x2c8ca9[_0x5a5a('0x47')]=_[_0x5a5a('0x48')](_0x2c8ca9[_0x5a5a('0x49')],_0x2c8ca9[_0x5a5a('0x45')]);_0x448b8e[_0x5a5a('0x4a')]=_[_0x5a5a('0x48')](_0x2c8ca9[_0x5a5a('0x49')],qs[_0x5a5a('0x4b')](_0x4b4a8c['query'][_0x5a5a('0x4b')]));_0x448b8e[_0x5a5a('0x4a')]=_0x448b8e[_0x5a5a('0x4a')][_0x5a5a('0x58')]?_0x448b8e[_0x5a5a('0x4a')]:_0x2c8ca9['model'];if(!_0x4b4a8c[_0x5a5a('0x45')][_0x5a5a('0x4c')](_0x5a5a('0x4d'))){_0x448b8e['limit']=qs[_0x5a5a('0x1e')](_0x4b4a8c[_0x5a5a('0x45')][_0x5a5a('0x1e')]);_0x448b8e[_0x5a5a('0x1c')]=qs[_0x5a5a('0x1c')](_0x4b4a8c['query']['offset']);}_0x448b8e[_0x5a5a('0x4e')]=qs['sort'](_0x4b4a8c[_0x5a5a('0x45')][_0x5a5a('0x4f')]);_0x448b8e[_0x5a5a('0x50')]=qs[_0x5a5a('0x47')](_[_0x5a5a('0x6b')](_0x4b4a8c['query'],_0x2c8ca9[_0x5a5a('0x47')]));_0x448b8e[_0x5a5a('0x50')]['MailAccountId']=_0x2f06d8['id'];if(_0x4b4a8c[_0x5a5a('0x45')][_0x5a5a('0x67')]){_0x448b8e[_0x5a5a('0x50')]=_[_0x5a5a('0x51')](_0x448b8e[_0x5a5a('0x50')],{'$or':_[_0x5a5a('0x3f')](_0x448b8e['attributes'],function(_0x18fc5){var _0x331fc8={};_0x331fc8[_0x18fc5]={'$like':'%'+_0x4b4a8c[_0x5a5a('0x45')][_0x5a5a('0x67')]+'%'};return _0x331fc8;})});}_0x448b8e=_[_0x5a5a('0x51')]({},_0x448b8e,_0x4b4a8c['options']);return db[_0x5a5a('0x7e')][_0x5a5a('0x1f')]({'where':_0x448b8e[_0x5a5a('0x50')]})[_0x5a5a('0xe')](function(_0x3c4e63){_0x4438e3[_0x5a5a('0x1f')]=_0x3c4e63;if(_0x4b4a8c[_0x5a5a('0x45')][_0x5a5a('0x53')]){_0x448b8e[_0x5a5a('0x54')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x5a5a('0x80')],'as':_0x5a5a('0x81'),'attributes':['name',_0x5a5a('0x82'),_0x5a5a('0x83')],'required':![]},{'model':db[_0x5a5a('0x84')],'as':_0x5a5a('0x85'),'attributes':['id','name','color'],'where':_0x4b4a8c[_0x5a5a('0x45')][_0x5a5a('0x86')]?{'id':_0x4b4a8c[_0x5a5a('0x45')]['tag']}:undefined,'required':_0x4b4a8c['query']['tag']?!![]:![]}];}return db['MailInteraction']['findAll'](_0x448b8e);})[_0x5a5a('0xe')](function(_0x22416c){_0x4438e3['rows']=_0x22416c;return _0x4438e3;});}})[_0x5a5a('0xe')](respondWithFilteredResult(_0x4142b9,_0x448b8e))[_0x5a5a('0x17')](handleError(_0x4142b9,null));};exports['addApplications']=function addApplications(_0x37e986,_0x2ada74){var _0x55bcb1=_0x37e986['params']['id'];var _0x201126=_0x37e986[_0x5a5a('0x5a')];var _0x2c45cb=0xc8;var _0x95ea2b=null;return db['sequelize'][_0x5a5a('0x87')]({'isolationLevel':db['sequelize'][_0x5a5a('0x88')][_0x5a5a('0x89')][_0x5a5a('0x8a')]},function(_0x48cccf){return db[_0x5a5a('0x40')]['findOne']({'where':{'id':_0x55bcb1},'transaction':_0x48cccf})[_0x5a5a('0xe')](function(_0x3c5686){if(_0x3c5686){return db[_0x5a5a('0x8b')][_0x5a5a('0x23')]({'where':{'MailAccountId':_0x55bcb1},'transaction':_0x48cccf})[_0x5a5a('0xe')](function(){var _0x2484a1=_[_0x5a5a('0x3f')](_0x201126,function(_0x411a2d){_0x411a2d[_0x5a5a('0x62')]=_0x55bcb1;return _0x411a2d;});return db[_0x5a5a('0x8b')]['bulkCreate'](_0x2484a1,{'transaction':_0x48cccf});});}else{_0x2c45cb=0x194;_0x95ea2b=[];}});})[_0x5a5a('0xe')](function(){if(_0x2c45cb!==0x194){return db[_0x5a5a('0x8b')]['findAndCountAll']({'where':{'MailAccountId':_0x55bcb1},'order':_0x5a5a('0x8c')})['then'](function(_0x190765){_0x95ea2b=_0x190765;});}})[_0x5a5a('0x17')](function(_0x4b82b0){_0x2c45cb=0x1f4;logger['error'](_0x4b82b0[_0x5a5a('0x25')]);if(_0x4b82b0[_0x5a5a('0x26')]){delete _0x4b82b0[_0x5a5a('0x26')];}_0x95ea2b=_0x4b82b0;})['finally'](function(){if(_0x95ea2b===null){_0x2ada74[_0x5a5a('0x18')](_0x2c45cb);}else{if(_0x2c45cb===0x1f4){_0x2ada74[_0x5a5a('0x19')](_0x2c45cb)[_0x5a5a('0x27')](_0x95ea2b);}else{_0x2ada74['status'](_0x2c45cb)[_0x5a5a('0x1b')](_0x95ea2b);}}});};exports[_0x5a5a('0x8d')]=function(_0x2e9b85,_0x3c08ed){var _0x54e152={};var _0x16c28b={};var _0xb51ebb;var _0x1cc506;return db[_0x5a5a('0x40')][_0x5a5a('0x66')]({'where':{'id':_0x2e9b85[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x3c08ed,null))['then'](function(_0x322c21){if(_0x322c21){_0xb51ebb=_0x322c21;_0x16c28b['model']=_['keys'](db[_0x5a5a('0x8b')][_0x5a5a('0x41')]);_0x16c28b[_0x5a5a('0x45')]=_[_0x5a5a('0x46')](_0x2e9b85[_0x5a5a('0x45')]);_0x16c28b[_0x5a5a('0x47')]=_[_0x5a5a('0x48')](_0x16c28b[_0x5a5a('0x49')],_0x16c28b['query']);_0x54e152[_0x5a5a('0x4a')]=_[_0x5a5a('0x48')](_0x16c28b[_0x5a5a('0x49')],qs[_0x5a5a('0x4b')](_0x2e9b85['query'][_0x5a5a('0x4b')]));_0x54e152[_0x5a5a('0x4a')]=_0x54e152[_0x5a5a('0x4a')][_0x5a5a('0x58')]?_0x54e152[_0x5a5a('0x4a')]:_0x16c28b['model'];_0x54e152[_0x5a5a('0x4e')]=qs[_0x5a5a('0x4f')](_0x2e9b85[_0x5a5a('0x45')][_0x5a5a('0x4f')]);_0x54e152['where']=qs['filters'](_[_0x5a5a('0x6b')](_0x2e9b85[_0x5a5a('0x45')],_0x16c28b['filters']));if(_0x2e9b85[_0x5a5a('0x45')][_0x5a5a('0x67')]){_0x54e152[_0x5a5a('0x50')]=_[_0x5a5a('0x51')](_0x54e152['where'],{'$or':_[_0x5a5a('0x3f')](_0x54e152[_0x5a5a('0x4a')],function(_0x2b5236){var _0x660a84={};_0x660a84[_0x2b5236]={'$like':'%'+_0x2e9b85[_0x5a5a('0x45')][_0x5a5a('0x67')]+'%'};return _0x660a84;})});}_0x54e152=_[_0x5a5a('0x51')]({},_0x54e152,_0x2e9b85['options']);return _0xb51ebb[_0x5a5a('0x8d')](_0x54e152);}})['then'](function(_0x3e277a){if(_0x3e277a){_0x1cc506=_0x3e277a[_0x5a5a('0x58')];if(!_0x2e9b85[_0x5a5a('0x45')][_0x5a5a('0x4c')](_0x5a5a('0x4d'))){_0x54e152[_0x5a5a('0x1e')]=qs[_0x5a5a('0x1e')](_0x2e9b85[_0x5a5a('0x45')][_0x5a5a('0x1e')]);_0x54e152[_0x5a5a('0x1c')]=qs[_0x5a5a('0x1c')](_0x2e9b85[_0x5a5a('0x45')][_0x5a5a('0x1c')]);}return _0xb51ebb['getApplications'](_0x54e152);}})[_0x5a5a('0xe')](function(_0x320f83){if(_0x320f83){return _0x320f83?{'count':_0x1cc506,'rows':_0x320f83}:null;}})[_0x5a5a('0xe')](respondWithResult(_0x3c08ed,null))['catch'](handleError(_0x3c08ed,null));};exports['getMessages']=function(_0x168a21,_0x5b1800){var _0x32b3ab={'raw':!![],'where':{}};var _0x506694={};var _0x5cc766={'count':0x0,'rows':[]};return db[_0x5a5a('0x40')][_0x5a5a('0x66')]({'where':{'id':_0x168a21[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x5b1800,null))[_0x5a5a('0xe')](function(_0x63056f){if(_0x63056f){_0x506694[_0x5a5a('0x49')]=_[_0x5a5a('0x46')](db[_0x5a5a('0x8e')][_0x5a5a('0x41')]);_0x506694[_0x5a5a('0x45')]=_['keys'](_0x168a21[_0x5a5a('0x45')]);_0x506694[_0x5a5a('0x47')]=_['intersection'](_0x506694[_0x5a5a('0x49')],_0x506694[_0x5a5a('0x45')]);_0x32b3ab[_0x5a5a('0x4a')]=_[_0x5a5a('0x48')](_0x506694[_0x5a5a('0x49')],qs[_0x5a5a('0x4b')](_0x168a21[_0x5a5a('0x45')][_0x5a5a('0x4b')]));_0x32b3ab['attributes']=_0x32b3ab[_0x5a5a('0x4a')][_0x5a5a('0x58')]?_0x32b3ab['attributes']:_0x506694[_0x5a5a('0x49')];if(!_0x168a21[_0x5a5a('0x45')][_0x5a5a('0x4c')](_0x5a5a('0x4d'))){_0x32b3ab[_0x5a5a('0x1e')]=qs['limit'](_0x168a21[_0x5a5a('0x45')]['limit']);_0x32b3ab['offset']=qs[_0x5a5a('0x1c')](_0x168a21[_0x5a5a('0x45')]['offset']);}_0x32b3ab[_0x5a5a('0x4e')]=qs[_0x5a5a('0x4f')](_0x168a21[_0x5a5a('0x45')][_0x5a5a('0x4f')]);_0x32b3ab['where']=qs[_0x5a5a('0x47')](_['pick'](_0x168a21[_0x5a5a('0x45')],_0x506694[_0x5a5a('0x47')]));_0x32b3ab[_0x5a5a('0x50')][_0x5a5a('0x62')]=_0x63056f['id'];if(_0x168a21[_0x5a5a('0x45')][_0x5a5a('0x67')]){_0x32b3ab['where']=_['merge'](_0x32b3ab[_0x5a5a('0x50')],{'$or':_[_0x5a5a('0x3f')](_0x32b3ab['attributes'],function(_0x49ec89){var _0xe2e86b={};_0xe2e86b[_0x49ec89]={'$like':'%'+_0x168a21[_0x5a5a('0x45')][_0x5a5a('0x67')]+'%'};return _0xe2e86b;})});}if(_0x168a21[_0x5a5a('0x45')][_0x5a5a('0x8f')]){var _0x5d6350=_0x168a21[_0x5a5a('0x45')][_0x5a5a('0x8f')]['split'](',');var _0x3a2000={};_0x3a2000[_0x5d6350[0x0]]={'$gte':moment(_0x5d6350[0x1])[_0x5a5a('0x90')](_0x5a5a('0x91'))};_0x32b3ab['where']=_[_0x5a5a('0x51')](_0x32b3ab[_0x5a5a('0x50')],_0x3a2000);}_0x32b3ab=_['merge']({},_0x32b3ab,_0x168a21[_0x5a5a('0x59')]);return db['MailMessage'][_0x5a5a('0x1f')]({'where':_0x32b3ab[_0x5a5a('0x50')]})['then'](function(_0x1a39c7){_0x5cc766[_0x5a5a('0x1f')]=_0x1a39c7;if(_0x168a21['query'][_0x5a5a('0x53')]){_0x32b3ab[_0x5a5a('0x54')]=[{'all':!![]}];}return db[_0x5a5a('0x8e')][_0x5a5a('0x55')](_0x32b3ab);})[_0x5a5a('0xe')](function(_0x2434f1){if(_0x168a21[_0x5a5a('0x45')][_0x5a5a('0x92')]===_0x5a5a('0x93')){for(var _0x52107d=0x0;_0x52107d<_0x2434f1[_0x5a5a('0x58')];_0x52107d++){_0x2434f1[_0x52107d][_0x5a5a('0x5a')]=juice(_0x2434f1[_0x52107d][_0x5a5a('0x5a')]);}}_0x5cc766['rows']=_0x2434f1;return _0x5cc766;});}})[_0x5a5a('0xe')](respondWithFilteredResult(_0x5b1800,_0x32b3ab))[_0x5a5a('0x17')](handleError(_0x5b1800,null));};exports[_0x5a5a('0x27')]=function(_0x109616,_0x3a4162){var _0xdb1436,_0x2fd1f4={},_0x175d1c;if(_0x109616['body']['to']){_0x175d1c=_0x109616[_0x5a5a('0x5a')]['to']['split'](',')[0x0];}return db[_0x5a5a('0x40')][_0x5a5a('0x5e')]({'where':{'id':_0x109616[_0x5a5a('0x5f')]['id']},'include':[{'model':db[_0x5a5a('0x94')],'as':_0x5a5a('0x95'),'include':[{'model':db[_0x5a5a('0x96')],'as':_0x5a5a('0x97'),'where':{'email':_0x175d1c},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x5a5a('0x3c')],'as':_0x5a5a('0x57'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x5a5a('0x98'),'raw':!![]}]}]})[_0x5a5a('0xe')](handleEntityNotFound(_0x3a4162,null))[_0x5a5a('0xe')](function(_0x22800f){if(!_0x22800f)return;_0xdb1436=_0x22800f;if(!_0x22800f['Smtp'])throw new Error(_0x5a5a('0x99'));if(_[_0x5a5a('0x9a')](_0x109616[_0x5a5a('0x5a')][_0x5a5a('0x9b')])){_0x109616[_0x5a5a('0x5a')]['from']=util[_0x5a5a('0x90')](_0x5a5a('0x9c'),_0x22800f['name'],_0x22800f['email']||_0x22800f[_0x5a5a('0x57')][_0x5a5a('0x31')]);}if(_0x109616['body']['attachments']&&_0x109616[_0x5a5a('0x5a')]['attachments'][_0x5a5a('0x58')]){for(var _0x547734=0x0;_0x547734<_0x109616[_0x5a5a('0x5a')]['attachments'][_0x5a5a('0x58')];_0x547734+=0x1){_0x109616[_0x5a5a('0x5a')]['attachments'][_0x547734]={'filename':_0x109616['body']['attachments'][_0x547734][_0x5a5a('0x26')],'path':path[_0x5a5a('0x9d')](config[_0x5a5a('0x9e')],_0x5a5a('0x9f'),_0x109616[_0x5a5a('0x5a')]['attachments'][_0x547734][_0x5a5a('0xa0')])};}}var _0x3a0ce5=_0x22800f['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x5a5a('0xa1'),{'account':_0x3a0ce5,'message':_0x109616[_0x5a5a('0x5a')]});})[_0x5a5a('0xe')](function(_0x495451){if(!_0x495451)return;_0x2fd1f4=_0x495451;if(!_0xdb1436[_0x5a5a('0x95')])throw new Error(_0x5a5a('0xa2'));if(_0xdb1436['List'][_0x5a5a('0x97')][_0x5a5a('0x58')])return _0xdb1436[_0x5a5a('0x95')]['Contacts'][0x0];return db[_0x5a5a('0x96')]['create'](_[_0x5a5a('0x8')](_0x109616[_0x5a5a('0x5a')],{'firstName':_0x109616[_0x5a5a('0x5a')]['to'],'email':_0x109616[_0x5a5a('0x5a')]['to'],'phone':_0x109616[_0x5a5a('0x5a')]['to'],'ListId':_0xdb1436[_0x5a5a('0x6d')]}));})['then'](function(_0x59254b){if(!_0x59254b)return;var _0x4daaa2={'UserId':_0x109616[_0x5a5a('0x31')]['id'],'ContactId':_0x59254b['id'],'MailAccountId':_0xdb1436['id'],'inReplyTo':_0x2fd1f4['messageId'],'to':_0x109616['body'][_0x5a5a('0x9b')],'cc':_0x109616[_0x5a5a('0x5a')]['cc'],'subject':_0x109616[_0x5a5a('0x5a')][_0x5a5a('0xa3')],'attach':_0x109616[_0x5a5a('0x5a')][_0x5a5a('0xa4')],'firstMsgDirection':_0x5a5a('0xa5'),'lastMsgAt':moment()[_0x5a5a('0x90')](_0x5a5a('0x91')),'lastMsgDirection':_0x5a5a('0xa5'),'Messages':[_[_0x5a5a('0x51')](_0x109616[_0x5a5a('0x5a')],{'messageId':_0x2fd1f4[_0x5a5a('0xa6')],'sentAt':moment()[_0x5a5a('0x90')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0xdb1436['id'],'UserId':_0x109616[_0x5a5a('0x31')]['id'],'ContactId':_0x59254b['id']})]};if(_0x109616[_0x5a5a('0x5a')][_0x5a5a('0xa7')]){_0x4daaa2=_[_0x5a5a('0x51')](_0x4daaa2,_0x109616['body'][_0x5a5a('0xa7')]);}return db['MailInteraction']['create'](_0x4daaa2,{'include':[{'model':db[_0x5a5a('0x8e')],'as':_0x5a5a('0xa8')}]});})[_0x5a5a('0xe')](respondWithResult(_0x3a4162,null))['catch'](handleError(_0x3a4162,null));};exports[_0x5a5a('0xa9')]=function(_0x25d9ec,_0x3caa5a){return db[_0x5a5a('0x40')]['find']({'where':{'id':_0x25d9ec[_0x5a5a('0x5f')]['id']},'include':[{'model':db[_0x5a5a('0x3c')],'as':_0x5a5a('0x57'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x5a5a('0x98'),'raw':!![]}]}]})[_0x5a5a('0xe')](handleEntityNotFound(_0x3caa5a,null))['then'](function(_0x5c1d37){if(!_0x5c1d37['Smtp'])return;var _0x25ccf9=_0x5c1d37[_0x5a5a('0xaa')]();return respondWithRpcPromise(_0x5a5a('0xab'),_0x5a5a('0xa9'),{'account':_0x25ccf9});})['then'](respondWithResult(_0x3caa5a,null))[_0x5a5a('0x17')](handleError(_0x3caa5a,null));};exports[_0x5a5a('0x23')]=function(_0x34ed73,_0x379333){return db[_0x5a5a('0x40')]['find']({'where':{'id':_0x34ed73['params']['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x379333,null))[_0x5a5a('0xe')](function(_0x4e4681){if(_0x4e4681&&_0x4e4681['service']){throw new db[(_0x5a5a('0xac'))][(_0x5a5a('0xad'))](_0x5a5a('0xae'));}return _0x4e4681;})['then'](removeEntity(_0x379333,null))[_0x5a5a('0x17')](handleError(_0x379333,null));};exports[_0x5a5a('0xaf')]=function(_0x2289b5,_0x2a24a8){return db[_0x5a5a('0x40')][_0x5a5a('0x5e')]({'where':{'id':_0x2289b5[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x2a24a8,null))[_0x5a5a('0xe')](function(_0x216f68){if(_0x216f68){return _0x216f68['addAgents'](_0x2289b5['body'][_0x5a5a('0x69')],_[_0x5a5a('0xb0')](_0x2289b5[_0x5a5a('0x5a')],[_0x5a5a('0x69'),'id'])||{})[_0x5a5a('0xb1')](function(_0x419f0e){for(var _0x405cab=0x0;_0x405cab<_0x2289b5['body']['ids'][_0x5a5a('0x58')];_0x405cab+=0x1){socket[_0x5a5a('0xb2')](_0x5a5a('0xb3'),{'UserId':Number(_0x2289b5[_0x5a5a('0x5a')]['ids'][_0x405cab]),'MailAccountId':Number(_0x2289b5[_0x5a5a('0x5f')]['id'])});}return _0x419f0e;});}})['then'](respondWithResult(_0x2a24a8,null))[_0x5a5a('0x17')](handleError(_0x2a24a8,null));};exports[_0x5a5a('0xb4')]=function(_0x45e2ed,_0x1030da){return db[_0x5a5a('0x40')][_0x5a5a('0x5e')]({'where':{'id':_0x45e2ed[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x1030da,null))['then'](function(_0x2191ce){if(_0x2191ce){return _0x2191ce[_0x5a5a('0xb4')](_0x45e2ed[_0x5a5a('0x45')][_0x5a5a('0x69')])[_0x5a5a('0xe')](function(){if(_['isArray'](_0x45e2ed[_0x5a5a('0x45')][_0x5a5a('0x69')])){for(var _0x1c78f9=0x0;_0x1c78f9<_0x45e2ed[_0x5a5a('0x45')][_0x5a5a('0x69')][_0x5a5a('0x58')];_0x1c78f9+=0x1){socket[_0x5a5a('0xb2')](_0x5a5a('0xb5'),{'UserId':Number(_0x45e2ed[_0x5a5a('0x45')][_0x5a5a('0x69')][_0x1c78f9]),'MailAccountId':Number(_0x45e2ed[_0x5a5a('0x5f')]['id'])});}}else{socket[_0x5a5a('0xb2')]('userMailAccount:remove',{'UserId':Number(_0x45e2ed[_0x5a5a('0x45')][_0x5a5a('0x69')]),'MailAccountId':Number(_0x45e2ed[_0x5a5a('0x5f')]['id'])});}});}})[_0x5a5a('0xe')](respondWithStatusCode(_0x1030da,null))[_0x5a5a('0x17')](handleError(_0x1030da,null));};exports['getAgents']=function(_0x198daa,_0x2a5cb6){var _0x4b5738={};var _0x250d92={};var _0x337744;var _0x38fc18;return db[_0x5a5a('0x40')]['findOne']({'where':{'id':_0x198daa[_0x5a5a('0x5f')]['id']}})[_0x5a5a('0xe')](handleEntityNotFound(_0x2a5cb6,null))['then'](function(_0x5c2a9f){if(_0x5c2a9f){_0x337744=_0x5c2a9f;_0x250d92['model']=_[_0x5a5a('0x46')](db[_0x5a5a('0x80')]['rawAttributes']);_0x250d92['query']=_[_0x5a5a('0x46')](_0x198daa['query']);_0x250d92[_0x5a5a('0x47')]=_[_0x5a5a('0x48')](_0x250d92['model'],_0x250d92[_0x5a5a('0x45')]);_0x4b5738['attributes']=_[_0x5a5a('0x48')](_0x250d92[_0x5a5a('0x49')],qs['fields'](_0x198daa['query'][_0x5a5a('0x4b')]));_0x4b5738['attributes']=_0x4b5738[_0x5a5a('0x4a')][_0x5a5a('0x58')]?_0x4b5738[_0x5a5a('0x4a')]:_0x250d92[_0x5a5a('0x49')];_0x4b5738[_0x5a5a('0x4e')]=qs[_0x5a5a('0x4f')](_0x198daa[_0x5a5a('0x45')][_0x5a5a('0x4f')]);_0x4b5738[_0x5a5a('0x50')]=qs[_0x5a5a('0x47')](_['pick'](_0x198daa[_0x5a5a('0x45')],_0x250d92[_0x5a5a('0x47')]));if(_0x198daa[_0x5a5a('0x45')]['filter']){_0x4b5738['where']=_[_0x5a5a('0x51')](_0x4b5738[_0x5a5a('0x50')],{'$or':_[_0x5a5a('0x3f')](_0x4b5738[_0x5a5a('0x4a')],function(_0x2e691c){var _0x1db47f={};_0x1db47f[_0x2e691c]={'$like':'%'+_0x198daa[_0x5a5a('0x45')][_0x5a5a('0x67')]+'%'};return _0x1db47f;})});}_0x4b5738=_['merge']({},_0x4b5738,_0x198daa['options']);return _0x337744[_0x5a5a('0xb6')](_0x4b5738);}})['then'](function(_0x5ce319){if(_0x5ce319){_0x38fc18=_0x5ce319['length'];if(!_0x198daa[_0x5a5a('0x45')]['hasOwnProperty'](_0x5a5a('0x4d'))){_0x4b5738['limit']=qs[_0x5a5a('0x1e')](_0x198daa['query'][_0x5a5a('0x1e')]);_0x4b5738[_0x5a5a('0x1c')]=qs[_0x5a5a('0x1c')](_0x198daa[_0x5a5a('0x45')][_0x5a5a('0x1c')]);}return _0x337744['getAgents'](_0x4b5738);}})['then'](function(_0x152dbf){if(_0x152dbf){return _0x152dbf?{'count':_0x38fc18,'rows':_0x152dbf}:null;}})[_0x5a5a('0xe')](respondWithResult(_0x2a5cb6,null))[_0x5a5a('0x17')](handleError(_0x2a5cb6,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index a392b3c..86ece0e 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 _0x8b52=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','save','update'];(function(_0x277131,_0x50e225){var _0x4d3dd1=function(_0x5dcd63){while(--_0x5dcd63){_0x277131['push'](_0x277131['shift']());}};_0x4d3dd1(++_0x50e225);}(_0x8b52,0x151));var _0x28b5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8b52[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0x28b5('0x0'));var MailAccount=require(_0x28b5('0x1'))['db'][_0x28b5('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x28b5('0x3'),'afterUpdate':_0x28b5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4110e8){return function(_0x3d0e93,_0x3a762e,_0x226981){MailAccountEvents[_0x28b5('0x5')](_0x4110e8+':'+_0x3d0e93['id'],_0x3d0e93);MailAccountEvents[_0x28b5('0x5')](_0x4110e8,_0x3d0e93);_0x226981(null);};}for(var e in events){if(events[_0x28b5('0x6')](e)){var event=events[e];MailAccount[_0x28b5('0x7')](e,emitEvent(event));}}module[_0x28b5('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x80eb=['events','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x80eb,0x118));var _0xb80e=function(_0x23aa69,_0x166be3){_0x23aa69=_0x23aa69-0x0;var _0x5d24ea=_0x80eb[_0x23aa69];return _0x5d24ea;};'use strict';var EventEmitter=require(_0xb80e('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xb80e('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb80e('0x2')](0x0);var events={'afterCreate':_0xb80e('0x3'),'afterUpdate':_0xb80e('0x4'),'afterDestroy':'remove'};function emitEvent(_0xcc43b0){return function(_0xa7aaa0,_0x1e2a30,_0xc0af77){MailAccountEvents[_0xb80e('0x5')](_0xcc43b0+':'+_0xa7aaa0['id'],_0xa7aaa0);MailAccountEvents[_0xb80e('0x5')](_0xcc43b0,_0xa7aaa0);_0xc0af77(null);};}for(var e in events){if(events[_0xb80e('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xb80e('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 694edd5..bc8ba67 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 _0xa979=['service','provider','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','auth','user','data5','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','custom'];(function(_0x118858,_0x22d304){var _0x611d35=function(_0x127b09){while(--_0x127b09){_0x118858['push'](_0x118858['shift']());}};_0x611d35(++_0x22d304);}(_0xa979,0x1cf));var _0x9a97=function(_0x1aa617,_0x23271a){_0x1aa617=_0x1aa617-0x0;var _0x38653c=_0xa979[_0x1aa617];return _0x38653c;};'use strict';var attributes=require(_0x9a97('0x0'));module[_0x9a97('0x1')]=function(_0x51742d){return _0x51742d['define'](_0x9a97('0x2'),attributes,{'tableName':_0x9a97('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x193bb1=this;var _0x274b91={'id':_0x193bb1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x193bb1['provider']!==_0x9a97('0x4')){_0x274b91[_0x9a97('0x5')]=_0x193bb1[_0x9a97('0x6')];}else{_0x274b91['host']=_0x193bb1[_0x9a97('0x7')][_0x9a97('0x8')];_0x274b91[_0x9a97('0x9')]=_0x193bb1[_0x9a97('0x7')]['port'];_0x274b91[_0x9a97('0xa')]=_0x193bb1[_0x9a97('0x7')][_0x9a97('0xa')];}if(_0x193bb1[_0x9a97('0x7')][_0x9a97('0xb')]){if(_0x193bb1[_0x9a97('0x7')][_0x9a97('0xc')]){if(!_0x193bb1[_0x9a97('0x7')][_0x9a97('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x274b91[_0x9a97('0xe')]={'type':'OAuth2','user':_0x193bb1[_0x9a97('0x7')][_0x9a97('0xf')],'accessToken':_0x193bb1[_0x9a97('0x7')][_0x9a97('0xd')][_0x9a97('0x10')]};}else{_0x274b91[_0x9a97('0xe')]={'user':_0x193bb1[_0x9a97('0x7')][_0x9a97('0xf')],'pass':_0x193bb1['Smtp'][_0x9a97('0x11')]};}}return _0x274b91;}}});}; \ No newline at end of file +var _0xd805=['CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','mail_accounts','provider','custom','service','Smtp','host','port','secure','authentication','modernAuthentication'];(function(_0x244214,_0x3358aa){var _0x3377e5=function(_0x781c2b){while(--_0x781c2b){_0x244214['push'](_0x244214['shift']());}};_0x3377e5(++_0x3358aa);}(_0xd805,0x1e1));var _0x5d80=function(_0x44650b,_0x5af069){_0x44650b=_0x44650b-0x0;var _0x13b205=_0xd805[_0x44650b];return _0x13b205;};'use strict';var attributes=require(_0x5d80('0x0'));module[_0x5d80('0x1')]=function(_0x19b839){return _0x19b839[_0x5d80('0x2')]('MailAccount',attributes,{'tableName':_0x5d80('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x34163d=this;var _0x1b704e={'id':_0x34163d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x34163d[_0x5d80('0x4')]!==_0x5d80('0x5')){_0x1b704e[_0x5d80('0x6')]=_0x34163d['provider'];}else{_0x1b704e['host']=_0x34163d[_0x5d80('0x7')][_0x5d80('0x8')];_0x1b704e[_0x5d80('0x9')]=_0x34163d['Smtp'][_0x5d80('0x9')];_0x1b704e[_0x5d80('0xa')]=_0x34163d[_0x5d80('0x7')][_0x5d80('0xa')];}if(_0x34163d['Smtp'][_0x5d80('0xb')]){if(_0x34163d['Smtp'][_0x5d80('0xc')]){if(!_0x34163d[_0x5d80('0x7')][_0x5d80('0xd')])throw new Error(_0x5d80('0xe'));_0x1b704e['auth']={'type':_0x5d80('0xf'),'user':_0x34163d['Smtp'][_0x5d80('0x10')],'accessToken':_0x34163d[_0x5d80('0x7')][_0x5d80('0xd')][_0x5d80('0x11')]};}else{_0x1b704e['auth']={'user':_0x34163d[_0x5d80('0x7')][_0x5d80('0x10')],'pass':_0x34163d[_0x5d80('0x7')][_0x5d80('0x12')]};}}return _0x1b704e;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index aa517d1..7a999b8 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 _0xb138=['messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','created','create','subject','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','name','unshift','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetMailAccount','findAll','options','where','attributes','limit','include','model','map','ShowMailAccount','find','raw','setDataValue','getSmtpOptions','body','mail','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','List','Contacts','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','smtpOptions','applications','Applications','list','orderBy','priority','asc','autoclose','push','close','length','List\x20not\x20found'];(function(_0x528375,_0x49a89e){var _0x363892=function(_0x504565){while(--_0x504565){_0x528375['push'](_0x528375['shift']());}};_0x363892(++_0x49a89e);}(_0xb138,0x1dd));var _0x8b13=function(_0x5323a0,_0x481644){_0x5323a0=_0x5323a0-0x0;var _0x1dc6bc=_0xb138[_0x5323a0];return _0x1dc6bc;};'use strict';var _=require(_0x8b13('0x0'));var moment=require(_0x8b13('0x1'));var BPromise=require(_0x8b13('0x2'));var rs=require(_0x8b13('0x3'));var Redis=require(_0x8b13('0x4'));var db=require(_0x8b13('0x5'))['db'];var logger=require(_0x8b13('0x6'))('rpc');var config=require(_0x8b13('0x7'));var jayson=require(_0x8b13('0x8'));var client=jayson[_0x8b13('0x9')]['http']({'port':0x232c});config[_0x8b13('0xa')]=_[_0x8b13('0xb')](config['redis'],{'host':_0x8b13('0xc'),'port':0x18eb});var socket=require(_0x8b13('0xd'))(new Redis(config[_0x8b13('0xa')]));require('./mailAccount.socket')[_0x8b13('0xe')](socket);function respondWithRpcPromise(_0x1aed6f,_0x58683a,_0x53ae50){return new BPromise(function(_0x1f2528,_0x21fcd9){return client[_0x8b13('0xf')](_0x1aed6f,_0x53ae50)[_0x8b13('0x10')](function(_0x3e8eca){logger['info'](_0x8b13('0x11'),_0x58683a,_0x8b13('0x12'));logger[_0x8b13('0x13')](_0x8b13('0x14'),_0x58683a,_0x8b13('0x12'),JSON[_0x8b13('0x15')](_0x3e8eca));if(_0x3e8eca['error']){if(_0x3e8eca['error'][_0x8b13('0x16')]===0x1f4){logger[_0x8b13('0x17')]('MailAccount,\x20%s,\x20%s',_0x58683a,_0x3e8eca['error']['message']);return _0x21fcd9(_0x3e8eca[_0x8b13('0x17')][_0x8b13('0x18')]);}logger[_0x8b13('0x17')](_0x8b13('0x11'),_0x58683a,_0x3e8eca[_0x8b13('0x17')]['message']);return _0x1f2528(_0x3e8eca[_0x8b13('0x17')][_0x8b13('0x18')]);}else{logger[_0x8b13('0x19')](_0x8b13('0x11'),_0x58683a,_0x8b13('0x12'));_0x1f2528(_0x3e8eca[_0x8b13('0x1a')][_0x8b13('0x18')]);}})[_0x8b13('0x1b')](function(_0x4989d3){logger['error'](_0x8b13('0x11'),_0x58683a,_0x4989d3);_0x21fcd9(_0x4989d3);});});}exports[_0x8b13('0x1c')]=function(_0x14a8ac){var _0x9c03b4=this;return new Promise(function(_0x1e0fe3,_0x3cc9a0){return db['MailAccount'][_0x8b13('0x1d')]({'raw':_0x14a8ac[_0x8b13('0x1e')]?_0x14a8ac[_0x8b13('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x14a8ac['options']?_0x14a8ac[_0x8b13('0x1e')][_0x8b13('0x1f')]||null:null,'attributes':_0x14a8ac['options']?_0x14a8ac[_0x8b13('0x1e')][_0x8b13('0x20')]||null:null,'limit':_0x14a8ac[_0x8b13('0x1e')]?_0x14a8ac[_0x8b13('0x1e')][_0x8b13('0x21')]||null:null,'include':_0x14a8ac['options']?_0x14a8ac[_0x8b13('0x1e')][_0x8b13('0x22')]?_['map'](_0x14a8ac[_0x8b13('0x1e')]['include'],function(_0x420772){return{'model':db[_0x420772[_0x8b13('0x23')]],'as':_0x420772['as'],'attributes':_0x420772['attributes'],'include':_0x420772[_0x8b13('0x22')]?_[_0x8b13('0x24')](_0x420772['include'],function(_0x134c5e){return{'model':db[_0x134c5e[_0x8b13('0x23')]],'as':_0x134c5e['as'],'attributes':_0x134c5e[_0x8b13('0x20')],'include':_0x134c5e[_0x8b13('0x22')]?_[_0x8b13('0x24')](_0x134c5e['include'],function(_0x6023f5){return{'model':db[_0x6023f5[_0x8b13('0x23')]],'as':_0x6023f5['as'],'attributes':_0x6023f5[_0x8b13('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8b13('0x10')](function(_0x114b01){logger[_0x8b13('0x19')]('GetMailAccount',_0x14a8ac);logger[_0x8b13('0x13')](_0x8b13('0x1c'),_0x14a8ac,JSON[_0x8b13('0x15')](_0x114b01));_0x1e0fe3(_0x114b01);})[_0x8b13('0x1b')](function(_0x23fde7){logger[_0x8b13('0x17')](_0x8b13('0x1c'),_0x23fde7[_0x8b13('0x18')],_0x14a8ac);_0x3cc9a0(_0x9c03b4[_0x8b13('0x17')](0x1f4,_0x23fde7['message']));});});};exports[_0x8b13('0x25')]=function(_0x193965){var _0x288ff7=this;return new Promise(function(_0x2878a6,_0x51a334){return db['MailAccount'][_0x8b13('0x26')]({'raw':_0x193965['options']?_0x193965['options'][_0x8b13('0x27')]===undefined?!![]:![]:!![],'where':_0x193965['options']?_0x193965[_0x8b13('0x1e')][_0x8b13('0x1f')]||null:null,'attributes':_0x193965[_0x8b13('0x1e')]?_0x193965[_0x8b13('0x1e')][_0x8b13('0x20')]||null:null,'include':_0x193965[_0x8b13('0x1e')]?_0x193965[_0x8b13('0x1e')][_0x8b13('0x22')]?_[_0x8b13('0x24')](_0x193965[_0x8b13('0x1e')]['include'],function(_0xa07850){return{'model':db[_0xa07850[_0x8b13('0x23')]],'as':_0xa07850['as'],'attributes':_0xa07850[_0x8b13('0x20')],'include':_0xa07850[_0x8b13('0x22')]?_[_0x8b13('0x24')](_0xa07850[_0x8b13('0x22')],function(_0x6b4645){return{'model':db[_0x6b4645[_0x8b13('0x23')]],'as':_0x6b4645['as'],'attributes':_0x6b4645['attributes'],'include':_0x6b4645[_0x8b13('0x22')]?_['map'](_0x6b4645[_0x8b13('0x22')],function(_0x37732c){return{'model':db[_0x37732c[_0x8b13('0x23')]],'as':_0x37732c['as'],'attributes':_0x37732c[_0x8b13('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8b13('0x10')](function(_0x327eb1){if(_0x193965['options']['smtp']===!![])_0x327eb1[_0x8b13('0x28')]('smtpOptions',_0x327eb1[_0x8b13('0x29')]());logger['info'](_0x8b13('0x25'),_0x193965);logger[_0x8b13('0x13')](_0x8b13('0x25'),_0x193965,JSON[_0x8b13('0x15')](_0x327eb1));_0x2878a6(_0x327eb1);})[_0x8b13('0x1b')](function(_0x4e16e7){logger['error'](_0x8b13('0x25'),_0x4e16e7['message'],_0x193965);_0x51a334(_0x288ff7[_0x8b13('0x17')](0x1f4,_0x4e16e7[_0x8b13('0x18')]));});});};exports['NotifyMailAccount']=function(_0x1012eb){var _0x41d710=this;return new Promise(function(_0x35c1d6,_0x81b931){var _0x2f4e7f={'body':_0x1012eb[_0x8b13('0x2a')],'channel':_0x8b13('0x2b')};var _0x516c70=_['difference'](_['keys'](db[_0x8b13('0x2c')][_0x8b13('0x2d')]),[_0x8b13('0x2e'),_0x8b13('0x2f'),_0x8b13('0x30'),_0x8b13('0x31')]);var _0x492f7d=![];if(_0x1012eb[_0x8b13('0x2a')]['id']){delete _0x1012eb['body']['id'];}if(_[_0x8b13('0x32')](_0x1012eb['body'][_0x8b13('0x33')])){return _0x81b931(_0x41d710[_0x8b13('0x17')](0x1f4,_0x8b13('0x34')));}if(_[_0x8b13('0x32')](_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x2a')])||_0x1012eb[_0x8b13('0x2a')]['body']===''){return _0x81b931(_0x41d710['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8b13('0x32')](_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x35')])){return _0x81b931(_0x41d710[_0x8b13('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x516c70));}if(!_['includes'](_0x516c70,_0x1012eb[_0x8b13('0x2a')]['mapKey'])){return _0x81b931(_0x41d710[_0x8b13('0x17')](0x1f4,_0x8b13('0x36')+_0x516c70));}var _0x20c363={};_0x20c363[_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x35')]]=_0x1012eb['body'][_0x8b13('0x33')];return db[_0x8b13('0x37')][_0x8b13('0x26')]({'where':{'id':_0x1012eb[_0x8b13('0x38')]['id']},'include':[{'model':db[_0x8b13('0x39')],'as':_0x8b13('0x3a'),'include':[{'model':db[_0x8b13('0x2c')],'as':_0x8b13('0x3b'),'where':_0x20c363,'limit':0x1,'order':[[_0x8b13('0x2f'),'DESC']]}]},{'model':db[_0x8b13('0x3c')],'as':'Applications'},{'model':db[_0x8b13('0x3d')],'as':_0x8b13('0x3e'),'include':[{'model':db[_0x8b13('0x3f')],'as':'CloudProvider'}]}]})[_0x8b13('0x10')](function(_0x35f612){if(_0x35f612&&_0x35f612[_0x8b13('0x3a')]){var _0x4129c0=_0x35f612[_0x8b13('0x40')]({'plain':!![]});_0x2f4e7f[_0x8b13('0x38')]=_[_0x8b13('0x41')](_0x4129c0,['Applications',_0x8b13('0x3a')]);_0x2f4e7f['account'][_0x8b13('0x42')]=_0x35f612[_0x8b13('0x29')]();_0x2f4e7f[_0x8b13('0x43')]=_0x4129c0[_0x8b13('0x44')];_0x2f4e7f[_0x8b13('0x45')]=_0x4129c0[_0x8b13('0x3a')];_0x2f4e7f[_0x8b13('0x43')]=_[_0x8b13('0x46')](_0x2f4e7f[_0x8b13('0x43')],[_0x8b13('0x47')],[_0x8b13('0x48')]);if(_0x2f4e7f[_0x8b13('0x38')]&&_0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x49')]){_0x2f4e7f[_0x8b13('0x43')][_0x8b13('0x4a')]({'id':0x0,'priority':_0x2f4e7f[_0x8b13('0x43')]['length']+0x1,'app':_0x8b13('0x4b'),'appdata':_0x8b13('0x49'),'interval':'*,*,*,*'});}if(_0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x44')]){delete _0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x44')];}if(_0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x3a')]){delete _0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x3a')];}if(_0x4129c0[_0x8b13('0x3a')][_0x8b13('0x3b')][_0x8b13('0x4c')]){return _0x4129c0[_0x8b13('0x3a')][_0x8b13('0x3b')][0x0];}var _0x25ab1f=_[_0x8b13('0xb')](_0x1012eb['body'],{'firstName':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x33')],'ListId':_0x4129c0['ListId']});_0x25ab1f[_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x35')]]=_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x33')];return db[_0x8b13('0x2c')]['create'](_0x25ab1f);}else{throw new Error(_0x8b13('0x4d'));}})[_0x8b13('0x10')](function(_0x46850a){_0x2f4e7f['contact']=_0x46850a;if(_0x46850a){if(!_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['messageId']){_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x4e')]=rs[_0x8b13('0x4f')]()+'\x20'+_0x1012eb['body'][_0x8b13('0x18')][_0x8b13('0x33')];}var _0x52e705={'ContactId':_0x46850a['id'],'MailAccountId':_0x1012eb[_0x8b13('0x38')]['id'],'inReplyTo':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x4e')],'to':_0x1012eb['body'][_0x8b13('0x18')][_0x8b13('0x33')],'cc':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['cc'],'subject':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['subject'],'attach':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x50')],'lastMsgAt':moment()['format'](_0x8b13('0x51')),'lastMsgDirection':'in'};return db[_0x8b13('0x52')][_0x8b13('0x26')]({'where':{'closed':![],'MailAccountId':_0x1012eb[_0x8b13('0x38')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x1012eb['body']['message'][_0x8b13('0x53')]}}]})[_0x8b13('0x10')](function(_0x574f98){if(_0x574f98){return[_0x574f98,![]];}return db[_0x8b13('0x52')]['create'](_0x52e705)[_0x8b13('0x10')](function(_0x2d2fa3){return[_0x2d2fa3,!![]];});});}else{throw new Error(_0x8b13('0x54'));}})[_0x8b13('0x55')](function(_0x43f12a,_0x2ff9c3){if(_0x43f12a){_0x492f7d=_0x2ff9c3;if(!_0x2ff9c3){return _0x43f12a[_0x8b13('0x56')]({'inReplyTo':_0x1012eb['body'][_0x8b13('0x18')]['messageId'],'to':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x33')],'cc':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['cc'],'subject':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['subject'],'attach':_0x43f12a[_0x8b13('0x50')]?_0x43f12a['attach']:_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x50')],'substatus':null,'substatusAt':moment()[_0x8b13('0x57')](_0x8b13('0x51')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x43f12a;}}})[_0x8b13('0x10')](function(_0x37a243){_0x2f4e7f['interaction']=_0x37a243[_0x8b13('0x40')]({'plain':!![]});_0x2f4e7f[_0x8b13('0x58')][_0x8b13('0x59')]=_0x492f7d;return db['MailMessage'][_0x8b13('0x5a')]({'body':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x2a')],'MailAccountId':_0x1012eb[_0x8b13('0x38')]['id'],'MailInteractionId':_0x37a243['id'],'direction':'in','ContactId':_0x2f4e7f['contact']['id'],'messageId':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['messageId'],'from':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x33')],'to':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['to'],'cc':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['cc'],'subject':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x5b')],'attach':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x50')],'Attachments':_0x1012eb[_0x8b13('0x2a')]['message'][_0x8b13('0x5c')],'originTo':_0x1012eb['body'][_0x8b13('0x18')][_0x8b13('0x5d')],'originCc':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')]['originCc'],'bcc':_0x1012eb['body'][_0x8b13('0x18')][_0x8b13('0x5e')],'ChatWebsiteId':_0x1012eb['body'][_0x8b13('0x18')][_0x8b13('0x5f')]||null,'originChannel':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x60')]||_0x8b13('0x61'),'ChatOfflineMessageId':_0x1012eb[_0x8b13('0x2a')][_0x8b13('0x18')][_0x8b13('0x62')]||null},{'include':[{'model':db[_0x8b13('0x63')],'as':'Attachments'}]});})[_0x8b13('0x10')](function(_0x2e7477){_0x2f4e7f['message']=_0x2e7477;if(!_0x2f4e7f[_0x8b13('0x58')][_0x8b13('0x64')]){return;}return db['User'][_0x8b13('0x26')]({'attributes':['id',_0x8b13('0x65')],'where':{'id':_0x2f4e7f[_0x8b13('0x58')][_0x8b13('0x64')]}});})[_0x8b13('0x10')](function(_0xe81c2e){if(_0xe81c2e){_0x2f4e7f[_0x8b13('0x43')][_0x8b13('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe81c2e[_0x8b13('0x65')]+','+(_0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x67')]||0xa),'interval':'*,*,*,*'});}if(!_0x2f4e7f[_0x8b13('0x58')]['queueId']){return;}return db[_0x8b13('0x68')][_0x8b13('0x26')]({'attributes':['id',_0x8b13('0x65')],'where':{'id':_0x2f4e7f[_0x8b13('0x58')][_0x8b13('0x69')]}});})[_0x8b13('0x10')](function(_0x41cefe){if(_0x41cefe){_0x2f4e7f[_0x8b13('0x43')][_0x8b13('0x66')]({'id':0x0,'priority':0x1,'app':_0x8b13('0x6a'),'appdata':_0x41cefe['name']+','+(_0x2f4e7f[_0x8b13('0x38')][_0x8b13('0x6b')]||0x12c),'interval':_0x8b13('0x6c')});}return respondWithRpcPromise(_0x8b13('0x6d'),_0x8b13('0x6e'),_0x2f4e7f);})[_0x8b13('0x10')](function(_0x2c69f5){_0x35c1d6(_0x2c69f5);})[_0x8b13('0x1b')](function(_0x5cb836){_0x81b931(_0x41d710[_0x8b13('0x17')](0x1f4,_0x5cb836[_0x8b13('0x18')]));});});}; \ No newline at end of file +var _0xafc4=['lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetMailAccount','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Smtp','CloudProvider','get','account','omit','Applications','list','applications','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','spread','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachments','UserId','User','name','interaction','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','waitForTheAssignedQueue','startRouting'];(function(_0x3de7e0,_0x28cbff){var _0x11d0b3=function(_0xd95412){while(--_0xd95412){_0x3de7e0['push'](_0x3de7e0['shift']());}};_0x11d0b3(++_0x28cbff);}(_0xafc4,0x69));var _0x4afc=function(_0xdd156e,_0xb43250){_0xdd156e=_0xdd156e-0x0;var _0x3426b6=_0xafc4[_0xdd156e];return _0x3426b6;};'use strict';var _=require(_0x4afc('0x0'));var moment=require('moment');var BPromise=require(_0x4afc('0x1'));var rs=require('randomstring');var Redis=require(_0x4afc('0x2'));var db=require(_0x4afc('0x3'))['db'];var logger=require(_0x4afc('0x4'))(_0x4afc('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4afc('0x6')]({'port':0x232c});config[_0x4afc('0x7')]=_[_0x4afc('0x8')](config[_0x4afc('0x7')],{'host':_0x4afc('0x9'),'port':0x18eb});var socket=require(_0x4afc('0xa'))(new Redis(config['redis']));require(_0x4afc('0xb'))[_0x4afc('0xc')](socket);function respondWithRpcPromise(_0x134aad,_0x1e6bf5,_0x1b8981){return new BPromise(function(_0x458fde,_0x5542ec){return client['request'](_0x134aad,_0x1b8981)[_0x4afc('0xd')](function(_0x49222e){logger[_0x4afc('0xe')](_0x4afc('0xf'),_0x1e6bf5,'request\x20sent');logger[_0x4afc('0x10')](_0x4afc('0x11'),_0x1e6bf5,_0x4afc('0x12'),JSON[_0x4afc('0x13')](_0x49222e));if(_0x49222e[_0x4afc('0x14')]){if(_0x49222e[_0x4afc('0x14')][_0x4afc('0x15')]===0x1f4){logger[_0x4afc('0x14')]('MailAccount,\x20%s,\x20%s',_0x1e6bf5,_0x49222e[_0x4afc('0x14')][_0x4afc('0x16')]);return _0x5542ec(_0x49222e[_0x4afc('0x14')][_0x4afc('0x16')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x1e6bf5,_0x49222e[_0x4afc('0x14')]['message']);return _0x458fde(_0x49222e[_0x4afc('0x14')][_0x4afc('0x16')]);}else{logger[_0x4afc('0xe')](_0x4afc('0xf'),_0x1e6bf5,_0x4afc('0x12'));_0x458fde(_0x49222e[_0x4afc('0x17')][_0x4afc('0x16')]);}})[_0x4afc('0x18')](function(_0x16365f){logger[_0x4afc('0x14')](_0x4afc('0xf'),_0x1e6bf5,_0x16365f);_0x5542ec(_0x16365f);});});}exports['GetMailAccount']=function(_0x1a8f49){var _0x25603b=this;return new Promise(function(_0x32865e,_0x14558a){return db['MailAccount'][_0x4afc('0x19')]({'raw':_0x1a8f49[_0x4afc('0x1a')]?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a8f49[_0x4afc('0x1a')]?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1c')]||null:null,'attributes':_0x1a8f49['options']?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1d')]||null:null,'limit':_0x1a8f49['options']?_0x1a8f49[_0x4afc('0x1a')]['limit']||null:null,'include':_0x1a8f49[_0x4afc('0x1a')]?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1e')]?_[_0x4afc('0x1f')](_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1e')],function(_0x40a0db){return{'model':db[_0x40a0db[_0x4afc('0x20')]],'as':_0x40a0db['as'],'attributes':_0x40a0db[_0x4afc('0x1d')],'include':_0x40a0db[_0x4afc('0x1e')]?_[_0x4afc('0x1f')](_0x40a0db[_0x4afc('0x1e')],function(_0x35f5b3){return{'model':db[_0x35f5b3['model']],'as':_0x35f5b3['as'],'attributes':_0x35f5b3[_0x4afc('0x1d')],'include':_0x35f5b3[_0x4afc('0x1e')]?_[_0x4afc('0x1f')](_0x35f5b3['include'],function(_0x52212d){return{'model':db[_0x52212d['model']],'as':_0x52212d['as'],'attributes':_0x52212d[_0x4afc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4afc('0xd')](function(_0x5e4747){logger[_0x4afc('0xe')](_0x4afc('0x21'),_0x1a8f49);logger['debug']('GetMailAccount',_0x1a8f49,JSON['stringify'](_0x5e4747));_0x32865e(_0x5e4747);})[_0x4afc('0x18')](function(_0x34434a){logger[_0x4afc('0x14')](_0x4afc('0x21'),_0x34434a[_0x4afc('0x16')],_0x1a8f49);_0x14558a(_0x25603b[_0x4afc('0x14')](0x1f4,_0x34434a['message']));});});};exports[_0x4afc('0x22')]=function(_0x3d1693){var _0x1ba6b5=this;return new Promise(function(_0x2f178c,_0x2b115d){return db[_0x4afc('0x23')][_0x4afc('0x24')]({'raw':_0x3d1693[_0x4afc('0x1a')]?_0x3d1693['options'][_0x4afc('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d1693['options']?_0x3d1693['options'][_0x4afc('0x1c')]||null:null,'attributes':_0x3d1693[_0x4afc('0x1a')]?_0x3d1693[_0x4afc('0x1a')][_0x4afc('0x1d')]||null:null,'include':_0x3d1693[_0x4afc('0x1a')]?_0x3d1693[_0x4afc('0x1a')]['include']?_[_0x4afc('0x1f')](_0x3d1693[_0x4afc('0x1a')][_0x4afc('0x1e')],function(_0x127ac8){return{'model':db[_0x127ac8[_0x4afc('0x20')]],'as':_0x127ac8['as'],'attributes':_0x127ac8[_0x4afc('0x1d')],'include':_0x127ac8['include']?_[_0x4afc('0x1f')](_0x127ac8[_0x4afc('0x1e')],function(_0x91565d){return{'model':db[_0x91565d[_0x4afc('0x20')]],'as':_0x91565d['as'],'attributes':_0x91565d['attributes'],'include':_0x91565d['include']?_[_0x4afc('0x1f')](_0x91565d[_0x4afc('0x1e')],function(_0x17ea03){return{'model':db[_0x17ea03['model']],'as':_0x17ea03['as'],'attributes':_0x17ea03['attributes']};}):[]};}):[]};}):[]:[]})[_0x4afc('0xd')](function(_0x4a06cf){if(_0x3d1693['options'][_0x4afc('0x25')]===!![])_0x4a06cf[_0x4afc('0x26')](_0x4afc('0x27'),_0x4a06cf[_0x4afc('0x28')]());logger[_0x4afc('0xe')](_0x4afc('0x22'),_0x3d1693);logger[_0x4afc('0x10')](_0x4afc('0x22'),_0x3d1693,JSON[_0x4afc('0x13')](_0x4a06cf));_0x2f178c(_0x4a06cf);})[_0x4afc('0x18')](function(_0x26e59f){logger[_0x4afc('0x14')](_0x4afc('0x22'),_0x26e59f[_0x4afc('0x16')],_0x3d1693);_0x2b115d(_0x1ba6b5[_0x4afc('0x14')](0x1f4,_0x26e59f['message']));});});};exports[_0x4afc('0x29')]=function(_0x6a8345){var _0x4357a6=this;return new Promise(function(_0xe6db12,_0x12db1d){var _0x260b06={'body':_0x6a8345[_0x4afc('0x2a')],'channel':'mail'};var _0x5e97f4=_['difference'](_[_0x4afc('0x2b')](db[_0x4afc('0x2c')]['rawAttributes']),[_0x4afc('0x2d'),_0x4afc('0x2e'),_0x4afc('0x2f'),_0x4afc('0x30')]);var _0x545109=![];if(_0x6a8345[_0x4afc('0x2a')]['id']){delete _0x6a8345[_0x4afc('0x2a')]['id'];}if(_[_0x4afc('0x31')](_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x32')])){return _0x12db1d(_0x4357a6[_0x4afc('0x14')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4afc('0x31')](_0x6a8345['body'][_0x4afc('0x2a')])||_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x2a')]===''){return _0x12db1d(_0x4357a6['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x4afc('0x31')](_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x33')])){return _0x12db1d(_0x4357a6[_0x4afc('0x14')](0x1f4,_0x4afc('0x34')+_0x5e97f4));}if(!_[_0x4afc('0x35')](_0x5e97f4,_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x33')])){return _0x12db1d(_0x4357a6['error'](0x1f4,_0x4afc('0x36')+_0x5e97f4));}var _0xb1e91e={};_0xb1e91e[_0x6a8345['body'][_0x4afc('0x33')]]=_0x6a8345['body'][_0x4afc('0x32')];return db[_0x4afc('0x23')][_0x4afc('0x24')]({'where':{'id':_0x6a8345['account']['id']},'include':[{'model':db[_0x4afc('0x37')],'as':_0x4afc('0x38'),'include':[{'model':db[_0x4afc('0x2c')],'as':_0x4afc('0x39'),'where':_0xb1e91e,'limit':0x1,'order':[[_0x4afc('0x2e'),_0x4afc('0x3a')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x4afc('0x3b'),'include':[{'model':db[_0x4afc('0x3c')],'as':_0x4afc('0x3c')}]}]})[_0x4afc('0xd')](function(_0xb5cca9){if(_0xb5cca9&&_0xb5cca9[_0x4afc('0x38')]){var _0x22e8b0=_0xb5cca9[_0x4afc('0x3d')]({'plain':!![]});_0x260b06[_0x4afc('0x3e')]=_[_0x4afc('0x3f')](_0x22e8b0,['Applications',_0x4afc('0x38')]);_0x260b06['account']['smtpOptions']=_0xb5cca9[_0x4afc('0x28')]();_0x260b06['applications']=_0x22e8b0[_0x4afc('0x40')];_0x260b06[_0x4afc('0x41')]=_0x22e8b0[_0x4afc('0x38')];_0x260b06[_0x4afc('0x42')]=_['orderBy'](_0x260b06[_0x4afc('0x42')],['priority'],[_0x4afc('0x43')]);if(_0x260b06[_0x4afc('0x3e')]&&_0x260b06[_0x4afc('0x3e')][_0x4afc('0x44')]){_0x260b06[_0x4afc('0x42')][_0x4afc('0x45')]({'id':0x0,'priority':_0x260b06[_0x4afc('0x42')][_0x4afc('0x46')]+0x1,'app':_0x4afc('0x47'),'appdata':_0x4afc('0x44'),'interval':_0x4afc('0x48')});}if(_0x260b06[_0x4afc('0x3e')]['Applications']){delete _0x260b06[_0x4afc('0x3e')][_0x4afc('0x40')];}if(_0x260b06[_0x4afc('0x3e')][_0x4afc('0x38')]){delete _0x260b06[_0x4afc('0x3e')][_0x4afc('0x38')];}if(_0x22e8b0[_0x4afc('0x38')][_0x4afc('0x39')][_0x4afc('0x46')]){return _0x22e8b0[_0x4afc('0x38')][_0x4afc('0x39')][0x0];}var _0x2aa927=_[_0x4afc('0x8')](_0x6a8345['body'],{'firstName':_0x6a8345[_0x4afc('0x2a')]['from'],'ListId':_0x22e8b0[_0x4afc('0x30')]});_0x2aa927[_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x33')]]=_0x6a8345[_0x4afc('0x2a')]['from'];return db['CmContact'][_0x4afc('0x49')](_0x2aa927);}else{throw new Error(_0x4afc('0x4a'));}})['then'](function(_0x40021e){_0x260b06[_0x4afc('0x4b')]=_0x40021e;if(_0x40021e){if(!_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4c')]){_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4c')]=rs[_0x4afc('0x4d')]()+'\x20'+_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')];}var _0x22f586={'ContactId':_0x40021e['id'],'MailAccountId':_0x6a8345[_0x4afc('0x3e')]['id'],'inReplyTo':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x4c')],'to':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')],'cc':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['cc'],'subject':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x4e')],'attach':_0x6a8345['body']['message'][_0x4afc('0x4f')],'lastMsgAt':moment()[_0x4afc('0x50')](_0x4afc('0x51')),'lastMsgDirection':'in'};return db[_0x4afc('0x52')][_0x4afc('0x24')]({'where':{'closed':![],'MailAccountId':_0x6a8345[_0x4afc('0x3e')]['id']},'include':[{'model':db[_0x4afc('0x53')],'as':_0x4afc('0x54'),'attributes':[_0x4afc('0x4c')],'where':{'messageId':_0x6a8345[_0x4afc('0x2a')]['message']['inReplyTo']}}]})[_0x4afc('0xd')](function(_0x139786){if(_0x139786){return[_0x139786,![]];}return db['MailInteraction'][_0x4afc('0x49')](_0x22f586)[_0x4afc('0xd')](function(_0x5be1a7){return[_0x5be1a7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4afc('0x55')](function(_0x26f4ee,_0x576ea0){if(_0x26f4ee){_0x545109=_0x576ea0;if(!_0x576ea0){return _0x26f4ee['update']({'inReplyTo':_0x6a8345[_0x4afc('0x2a')]['message']['messageId'],'to':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')],'cc':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['cc'],'subject':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4e')],'attach':_0x26f4ee[_0x4afc('0x4f')]?_0x26f4ee['attach']:_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4f')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x4afc('0x51')),'lastMsgDirection':'in'});}else{return _0x26f4ee;}}})[_0x4afc('0xd')](function(_0x195378){_0x260b06['interaction']=_0x195378[_0x4afc('0x3d')]({'plain':!![]});_0x260b06['interaction']['created']=_0x545109;return db['MailMessage'][_0x4afc('0x49')]({'body':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x2a')],'MailAccountId':_0x6a8345['account']['id'],'MailInteractionId':_0x195378['id'],'direction':'in','ContactId':_0x260b06[_0x4afc('0x4b')]['id'],'messageId':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['messageId'],'from':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')],'to':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['to'],'cc':_0x6a8345['body']['message']['cc'],'subject':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4e')],'attach':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x4f')],'Attachments':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x56')],'originTo':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x57')],'originCc':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x58')],'bcc':_0x6a8345[_0x4afc('0x2a')]['message'][_0x4afc('0x59')],'ChatWebsiteId':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x5a')]||null,'originChannel':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x5b')]||_0x4afc('0x5c'),'ChatOfflineMessageId':_0x6a8345['body'][_0x4afc('0x16')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0x4afc('0x5d')}]});})[_0x4afc('0xd')](function(_0x1354f1){_0x260b06['message']=_0x1354f1;if(!_0x260b06['interaction'][_0x4afc('0x5e')]){return;}return db[_0x4afc('0x5f')][_0x4afc('0x24')]({'attributes':['id',_0x4afc('0x60')],'where':{'id':_0x260b06[_0x4afc('0x61')][_0x4afc('0x5e')]}});})[_0x4afc('0xd')](function(_0x198ec9){if(_0x198ec9){_0x260b06[_0x4afc('0x42')][_0x4afc('0x62')]({'id':0x0,'priority':0x0,'app':_0x4afc('0x63'),'appdata':_0x198ec9[_0x4afc('0x60')]+','+(_0x260b06[_0x4afc('0x3e')][_0x4afc('0x64')]||0xa),'interval':_0x4afc('0x48')});}if(!_0x260b06[_0x4afc('0x61')]['queueId']){return;}return db[_0x4afc('0x65')][_0x4afc('0x24')]({'attributes':['id',_0x4afc('0x60')],'where':{'id':_0x260b06[_0x4afc('0x61')][_0x4afc('0x66')]}});})[_0x4afc('0xd')](function(_0x3fddd1){if(_0x3fddd1){_0x260b06[_0x4afc('0x42')][_0x4afc('0x62')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3fddd1[_0x4afc('0x60')]+','+(_0x260b06[_0x4afc('0x3e')][_0x4afc('0x67')]||0x12c),'interval':_0x4afc('0x48')});}return respondWithRpcPromise('Start',_0x4afc('0x68'),_0x260b06);})[_0x4afc('0xd')](function(_0x4ce81a){_0xe6db12(_0x4ce81a);})[_0x4afc('0x18')](function(_0x46fe52){_0x12db1d(_0x4357a6[_0x4afc('0x14')](0x1f4,_0x46fe52[_0x4afc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b529b3c..6e830a2 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 _0x4e63=['emit','removeListener','register','mailAccount:','save'];(function(_0x193567,_0xef773f){var _0x395f0f=function(_0x840a19){while(--_0x840a19){_0x193567['push'](_0x193567['shift']());}};_0x395f0f(++_0xef773f);}(_0x4e63,0x1ad));var _0x34e6=function(_0x49af6c,_0x5b83db){_0x49af6c=_0x49af6c-0x0;var _0x29d28c=_0x4e63[_0x49af6c];return _0x29d28c;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x34e6('0x0'),'remove','update'];function createListener(_0x27f06d,_0x5c2e4d){return function(_0x5abb4c){_0x5c2e4d[_0x34e6('0x1')](_0x27f06d,_0x5abb4c);};}function removeListener(_0x227fa0,_0x4c3fc0){return function(){MailAccountEvents[_0x34e6('0x2')](_0x227fa0,_0x4c3fc0);};}exports[_0x34e6('0x3')]=function(_0x119f25){for(var _0x13077f=0x0,_0x13b449=events['length'];_0x13077f<_0x13b449;_0x13077f++){var _0x25dce7=events[_0x13077f];var _0x1a04f8=createListener(_0x34e6('0x4')+_0x25dce7,_0x119f25);MailAccountEvents['on'](_0x25dce7,_0x1a04f8);}}; \ No newline at end of file +var _0x6026=['save','remove','update','emit','removeListener','length','mailAccount:','./mailAccount.events'];(function(_0x50c1dd,_0x42cf3d){var _0x49f65e=function(_0x289fca){while(--_0x289fca){_0x50c1dd['push'](_0x50c1dd['shift']());}};_0x49f65e(++_0x42cf3d);}(_0x6026,0x1bf));var _0x6602=function(_0x3a5712,_0x34bdd1){_0x3a5712=_0x3a5712-0x0;var _0x797efd=_0x6026[_0x3a5712];return _0x797efd;};'use strict';var MailAccountEvents=require(_0x6602('0x0'));var events=[_0x6602('0x1'),_0x6602('0x2'),_0x6602('0x3')];function createListener(_0x3de24c,_0x2fad57){return function(_0x20e2cb){_0x2fad57[_0x6602('0x4')](_0x3de24c,_0x20e2cb);};}function removeListener(_0x2886df,_0x2ce70f){return function(){MailAccountEvents[_0x6602('0x5')](_0x2886df,_0x2ce70f);};}exports['register']=function(_0x167fa2){for(var _0x265736=0x0,_0x180338=events[_0x6602('0x6')];_0x265736<_0x180338;_0x265736++){var _0x4ecbb2=events[_0x265736];var _0xbe2a27=createListener(_0x6602('0x7')+_0x4ecbb2,_0x167fa2);MailAccountEvents['on'](_0x4ecbb2,_0xbe2a27);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 07e6951..061fe3a 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 _0xec50=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xec50,0x1ae));var _0x0ec5=function(_0x23f201,_0x58e734){_0x23f201=_0x23f201-0x0;var _0x25794f=_0xec50[_0x23f201];return _0x25794f;};'use strict';var multer=require(_0x0ec5('0x0'));var util=require(_0x0ec5('0x1'));var path=require(_0x0ec5('0x2'));var timeout=require(_0x0ec5('0x3'));var express=require('express');var router=express[_0x0ec5('0x4')]();var fs_extra=require(_0x0ec5('0x5'));var auth=require(_0x0ec5('0x6'));var interaction=require(_0x0ec5('0x7'));var config=require(_0x0ec5('0x8'));var controller=require(_0x0ec5('0x9'));router[_0x0ec5('0xa')](_0x0ec5('0xb'),auth[_0x0ec5('0xc')](),controller[_0x0ec5('0xd')]);router['put'](_0x0ec5('0xb'),auth['isAuthenticated'](),controller[_0x0ec5('0xe')]);router[_0x0ec5('0xf')]('/:id',auth[_0x0ec5('0xc')](),controller[_0x0ec5('0x10')]);module[_0x0ec5('0x11')]=router; \ No newline at end of file +var _0xc1cd=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy'];(function(_0x1f4835,_0x3bf4fe){var _0x59d8a7=function(_0x11e2ac){while(--_0x11e2ac){_0x1f4835['push'](_0x1f4835['shift']());}};_0x59d8a7(++_0x3bf4fe);}(_0xc1cd,0x81));var _0xdc1c=function(_0x2e8106,_0x18864a){_0x2e8106=_0x2e8106-0x0;var _0x373832=_0xc1cd[_0x2e8106];return _0x373832;};'use strict';var multer=require(_0xdc1c('0x0'));var util=require(_0xdc1c('0x1'));var path=require(_0xdc1c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdc1c('0x3')]();var fs_extra=require(_0xdc1c('0x4'));var auth=require(_0xdc1c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc1c('0x6'));var controller=require('./mailApplication.controller');router[_0xdc1c('0x7')](_0xdc1c('0x8'),auth[_0xdc1c('0x9')](),controller[_0xdc1c('0xa')]);router[_0xdc1c('0xb')](_0xdc1c('0x8'),auth[_0xdc1c('0x9')](),controller[_0xdc1c('0xc')]);router[_0xdc1c('0xd')]('/:id',auth[_0xdc1c('0x9')](),controller[_0xdc1c('0xe')]);module[_0xdc1c('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 072deb0..e908dc9 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 _0x629d=['STRING','*,*,*,*','noop'];(function(_0x5d5629,_0x42e6ce){var _0x28aef0=function(_0x32e781){while(--_0x32e781){_0x5d5629['push'](_0x5d5629['shift']());}};_0x28aef0(++_0x42e6ce);}(_0x629d,0x13d));var _0xd629=function(_0x15bf58,_0x170ea4){_0x15bf58=_0x15bf58-0x0;var _0x5d6c96=_0x629d[_0x15bf58];return _0x5d6c96;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd629('0x0')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd629('0x1')]},'interval':{'type':Sequelize[_0xd629('0x1')],'defaultValue':_0xd629('0x2')}}; \ No newline at end of file +var _0x387c=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x464c79,_0x50579d){var _0x28a9ce=function(_0x372b24){while(--_0x372b24){_0x464c79['push'](_0x464c79['shift']());}};_0x28a9ce(++_0x50579d);}(_0x387c,0xf5));var _0xc387=function(_0x2f32c4,_0x2597ba){_0x2f32c4=_0x2f32c4-0x0;var _0x95b5dc=_0x387c[_0x2f32c4];return _0x95b5dc;};'use strict';var Sequelize=require(_0xc387('0x0'));module[_0xc387('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc387('0x2')],'allowNull':![],'defaultValue':_0xc387('0x3')},'appdata':{'type':Sequelize[_0xc387('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc387('0x2')],'defaultValue':_0xc387('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7193df5..65e67a8 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 _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(_0x5dd68d,_0x3faf5d){var _0x22c7fd=function(_0x19deb8){while(--_0x19deb8){_0x5dd68d['push'](_0x5dd68d['shift']());}};_0x22c7fd(++_0x3faf5d);}(_0xb43b,0x1b2));var _0xbb43=function(_0xc2f30d,_0x6a7aa9){_0xc2f30d=_0xc2f30d-0x0;var _0x3810e4=_0xb43b[_0xc2f30d];return _0x3810e4;};'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 +var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x34bde0,_0x210df3){var _0x2fc245=function(_0x209412){while(--_0x209412){_0x34bde0['push'](_0x34bde0['shift']());}};_0x2fc245(++_0x210df3);}(_0xac4a,0x13f));var _0xaac4=function(_0x181f6d,_0x4f81c0){_0x181f6d=_0x181f6d-0x0;var _0x7deaf7=_0xac4a[_0x181f6d];return _0x7deaf7;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c71d5c5..e03a2d8 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 _0x5d5f=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','MailApplication','mail_applications'];(function(_0x297fb4,_0x4bb346){var _0x109e65=function(_0x255f18){while(--_0x255f18){_0x297fb4['push'](_0x297fb4['shift']());}};_0x109e65(++_0x4bb346);}(_0x5d5f,0x12e));var _0xf5d5=function(_0x4af179,_0x58e608){_0x4af179=_0x4af179-0x0;var _0x3faa5e=_0x5d5f[_0x4af179];return _0x3faa5e;};'use strict';var _=require(_0xf5d5('0x0'));var util=require('util');var logger=require(_0xf5d5('0x1'))('api');var moment=require(_0xf5d5('0x2'));var BPromise=require(_0xf5d5('0x3'));var rp=require(_0xf5d5('0x4'));var fs=require('fs');var path=require(_0xf5d5('0x5'));var rimraf=require(_0xf5d5('0x6'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x2ff93a,_0x1ea9ee){return _0x2ff93a[_0xf5d5('0x7')](_0xf5d5('0x8'),attributes,{'tableName':_0xf5d5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf5d5('0xa'),'collate':_0xf5d5('0xb')});}; \ No newline at end of file +var _0x7f33=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','rimraf','./mailApplication.attributes','exports','MailApplication'];(function(_0x4ce60a,_0x5bd1ec){var _0x3f2c0a=function(_0x3af240){while(--_0x3af240){_0x4ce60a['push'](_0x4ce60a['shift']());}};_0x3f2c0a(++_0x5bd1ec);}(_0x7f33,0x1a4));var _0x37f3=function(_0x33cd84,_0x423b80){_0x33cd84=_0x33cd84-0x0;var _0xa6f41b=_0x7f33[_0x33cd84];return _0xa6f41b;};'use strict';var _=require('lodash');var util=require(_0x37f3('0x0'));var logger=require(_0x37f3('0x1'))(_0x37f3('0x2'));var moment=require('moment');var BPromise=require(_0x37f3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37f3('0x4'));var rimraf=require(_0x37f3('0x5'));var config=require('../../config/environment');var attributes=require(_0x37f3('0x6'));module[_0x37f3('0x7')]=function(_0x39ceb8,_0x1a1890){return _0x39ceb8['define'](_0x37f3('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x37f3('0x9'),'collate':_0x37f3('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9ea75fa..6a2e99c 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 _0x66bf=['result','UpdateMailApplication','MailApplication','update','body','options','raw','where','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x4258d7,_0x2252ac){var _0x1470ac=function(_0x5d3609){while(--_0x5d3609){_0x4258d7['push'](_0x4258d7['shift']());}};_0x1470ac(++_0x2252ac);}(_0x66bf,0x1c9));var _0xf66b=function(_0x74b1f4,_0x3054a8){_0x74b1f4=_0x74b1f4-0x0;var _0x2b0b85=_0x66bf[_0x74b1f4];return _0x2b0b85;};'use strict';var _=require(_0xf66b('0x0'));var util=require(_0xf66b('0x1'));var moment=require(_0xf66b('0x2'));var BPromise=require(_0xf66b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf66b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf66b('0x5'))(_0xf66b('0x6'));var config=require(_0xf66b('0x7'));var jayson=require(_0xf66b('0x8'));var client=jayson['client'][_0xf66b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21407a,_0x2d86bc,_0xa6edc5){return new BPromise(function(_0x17a66f,_0x561c87){return client[_0xf66b('0xa')](_0x21407a,_0xa6edc5)[_0xf66b('0xb')](function(_0xfde58a){logger['info'](_0xf66b('0xc'),_0x2d86bc,_0xf66b('0xd'));logger['debug'](_0xf66b('0xe'),_0x2d86bc,_0xf66b('0xd'),JSON[_0xf66b('0xf')](_0xfde58a));if(_0xfde58a[_0xf66b('0x10')]){if(_0xfde58a[_0xf66b('0x10')]['code']===0x1f4){logger[_0xf66b('0x10')]('MailApplication,\x20%s,\x20%s',_0x2d86bc,_0xfde58a[_0xf66b('0x10')][_0xf66b('0x11')]);return _0x561c87(_0xfde58a[_0xf66b('0x10')][_0xf66b('0x11')]);}logger[_0xf66b('0x10')](_0xf66b('0xc'),_0x2d86bc,_0xfde58a[_0xf66b('0x10')][_0xf66b('0x11')]);return _0x17a66f(_0xfde58a[_0xf66b('0x10')][_0xf66b('0x11')]);}else{logger[_0xf66b('0x12')](_0xf66b('0xc'),_0x2d86bc,_0xf66b('0xd'));_0x17a66f(_0xfde58a[_0xf66b('0x13')]['message']);}})['catch'](function(_0x34afb6){logger['error'](_0xf66b('0xc'),_0x2d86bc,_0x34afb6);_0x561c87(_0x34afb6);});});}exports[_0xf66b('0x14')]=function(_0x48fb98){var _0x545330=this;return new Promise(function(_0x342a6f,_0x4a5530){return db[_0xf66b('0x15')][_0xf66b('0x16')](_0x48fb98[_0xf66b('0x17')],{'raw':_0x48fb98[_0xf66b('0x18')]?_0x48fb98[_0xf66b('0x18')][_0xf66b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48fb98['options']?_0x48fb98[_0xf66b('0x18')][_0xf66b('0x1a')]||null:null,'attributes':_0x48fb98['options']?_0x48fb98['options']['attributes']||null:null,'limit':_0x48fb98[_0xf66b('0x18')]?_0x48fb98[_0xf66b('0x18')]['limit']||null:null})[_0xf66b('0xb')](function(_0x473d01){logger[_0xf66b('0x12')](_0xf66b('0x14'),_0x48fb98);logger['debug'](_0xf66b('0x14'),_0x48fb98,JSON[_0xf66b('0xf')](_0x473d01));_0x342a6f(_0x473d01);})[_0xf66b('0x1b')](function(_0x493163){logger[_0xf66b('0x10')](_0xf66b('0x14'),_0x493163[_0xf66b('0x11')],_0x48fb98);_0x4a5530(_0x545330[_0xf66b('0x10')](0x1f4,_0x493163[_0xf66b('0x11')]));});});}; \ No newline at end of file +var _0x3f82=['limit','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x3f82,0x1c3));var _0x23f8=function(_0x30b015,_0xe071e3){_0x30b015=_0x30b015-0x0;var _0x34920a=_0x3f82[_0x30b015];return _0x34920a;};'use strict';var _=require(_0x23f8('0x0'));var util=require(_0x23f8('0x1'));var moment=require(_0x23f8('0x2'));var BPromise=require(_0x23f8('0x3'));var rs=require(_0x23f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x23f8('0x5'));var logger=require('../../config/logger')(_0x23f8('0x6'));var config=require(_0x23f8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x23f8('0x8')][_0x23f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x168190,_0x3a0bfb,_0x1c2538){return new BPromise(function(_0x19754a,_0x4ae35c){return client[_0x23f8('0xa')](_0x168190,_0x1c2538)[_0x23f8('0xb')](function(_0x1a7308){logger['info'](_0x23f8('0xc'),_0x3a0bfb,_0x23f8('0xd'));logger[_0x23f8('0xe')](_0x23f8('0xf'),_0x3a0bfb,_0x23f8('0xd'),JSON[_0x23f8('0x10')](_0x1a7308));if(_0x1a7308[_0x23f8('0x11')]){if(_0x1a7308[_0x23f8('0x11')][_0x23f8('0x12')]===0x1f4){logger[_0x23f8('0x11')](_0x23f8('0xc'),_0x3a0bfb,_0x1a7308['error'][_0x23f8('0x13')]);return _0x4ae35c(_0x1a7308[_0x23f8('0x11')][_0x23f8('0x13')]);}logger['error'](_0x23f8('0xc'),_0x3a0bfb,_0x1a7308['error'][_0x23f8('0x13')]);return _0x19754a(_0x1a7308['error'][_0x23f8('0x13')]);}else{logger[_0x23f8('0x14')](_0x23f8('0xc'),_0x3a0bfb,_0x23f8('0xd'));_0x19754a(_0x1a7308[_0x23f8('0x15')][_0x23f8('0x13')]);}})[_0x23f8('0x16')](function(_0x58d216){logger[_0x23f8('0x11')]('MailApplication,\x20%s,\x20%s',_0x3a0bfb,_0x58d216);_0x4ae35c(_0x58d216);});});}exports[_0x23f8('0x17')]=function(_0x1dbcc2){var _0x5a9edf=this;return new Promise(function(_0x52b76f,_0x4713ae){return db[_0x23f8('0x18')][_0x23f8('0x19')](_0x1dbcc2[_0x23f8('0x1a')],{'raw':_0x1dbcc2[_0x23f8('0x1b')]?_0x1dbcc2[_0x23f8('0x1b')][_0x23f8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dbcc2[_0x23f8('0x1b')]?_0x1dbcc2['options']['where']||null:null,'attributes':_0x1dbcc2[_0x23f8('0x1b')]?_0x1dbcc2[_0x23f8('0x1b')]['attributes']||null:null,'limit':_0x1dbcc2[_0x23f8('0x1b')]?_0x1dbcc2[_0x23f8('0x1b')][_0x23f8('0x1d')]||null:null})['then'](function(_0x199689){logger['info'](_0x23f8('0x17'),_0x1dbcc2);logger[_0x23f8('0xe')](_0x23f8('0x17'),_0x1dbcc2,JSON[_0x23f8('0x10')](_0x199689));_0x52b76f(_0x199689);})[_0x23f8('0x16')](function(_0x234d5c){logger['error'](_0x23f8('0x17'),_0x234d5c['message'],_0x1dbcc2);_0x4713ae(_0x5a9edf[_0x23f8('0x11')](0x1f4,_0x234d5c[_0x23f8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 6290ad0..323f322 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 _0x80db=['update','mailinteraction:destroy','destroy','delete','exports','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','put','/:id','mail'];(function(_0x13cd99,_0x3650a2){var _0x11391f=function(_0x2dab78){while(--_0x2dab78){_0x13cd99['push'](_0x13cd99['shift']());}};_0x11391f(++_0x3650a2);}(_0x80db,0xc5));var _0xb80d=function(_0x37f594,_0x40aa2c){_0x37f594=_0x37f594-0x0;var _0x1782c5=_0x80db[_0x37f594];return _0x1782c5;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xb80d('0x0'));var interaction=require(_0xb80d('0x1'));var controller=require(_0xb80d('0x2'));router[_0xb80d('0x3')]('/',auth[_0xb80d('0x4')](),controller['index']);router[_0xb80d('0x3')](_0xb80d('0x5'),auth[_0xb80d('0x4')](),controller[_0xb80d('0x6')]);router['get']('/:id',auth[_0xb80d('0x4')](),controller[_0xb80d('0x7')]);router[_0xb80d('0x3')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xb80d('0x3')](_0xb80d('0x8'),auth[_0xb80d('0x4')](),controller[_0xb80d('0x9')]);router[_0xb80d('0xa')]('/',auth[_0xb80d('0x4')](),controller[_0xb80d('0xb')]);router[_0xb80d('0xa')]('/:id/messages',auth[_0xb80d('0x4')](),controller[_0xb80d('0xc')]);router['post'](_0xb80d('0xd'),auth[_0xb80d('0x4')](),interaction[_0xb80d('0xe')]('mail',_0xb80d('0xf')),controller['addTags']);router[_0xb80d('0x10')](_0xb80d('0x11'),auth[_0xb80d('0x4')](),interaction[_0xb80d('0xe')](_0xb80d('0x12'),'mailinteraction:update'),controller[_0xb80d('0x13')]);router['delete'](_0xb80d('0x11'),auth[_0xb80d('0x4')](),interaction[_0xb80d('0xe')](_0xb80d('0x12'),_0xb80d('0x14')),controller[_0xb80d('0x15')]);router[_0xb80d('0x16')](_0xb80d('0xd'),auth['isAuthenticated'](),controller['removeTags']);module[_0xb80d('0x17')]=router; \ No newline at end of file +var _0xd4a8=['/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','../../components/auth/service','./mailInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getMessages','/:id/download','create','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4a8,0xf7));var _0x8d4a=function(_0x4c9fa9,_0x478b86){_0x4c9fa9=_0x4c9fa9-0x0;var _0x3ca7e0=_0xd4a8[_0x4c9fa9];return _0x3ca7e0;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x8d4a('0x0'));var interaction=require('../../components/interaction/service');var controller=require(_0x8d4a('0x1'));router[_0x8d4a('0x2')]('/',auth['isAuthenticated'](),controller[_0x8d4a('0x3')]);router['get'](_0x8d4a('0x4'),auth['isAuthenticated'](),controller[_0x8d4a('0x5')]);router[_0x8d4a('0x2')](_0x8d4a('0x6'),auth[_0x8d4a('0x7')](),controller[_0x8d4a('0x8')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x8d4a('0x9')]);router[_0x8d4a('0x2')](_0x8d4a('0xa'),auth[_0x8d4a('0x7')](),controller['download']);router['post']('/',auth[_0x8d4a('0x7')](),controller[_0x8d4a('0xb')]);router[_0x8d4a('0xc')](_0x8d4a('0xd'),auth['isAuthenticated'](),controller[_0x8d4a('0xe')]);router[_0x8d4a('0xc')](_0x8d4a('0xf'),auth['isAuthenticated'](),interaction[_0x8d4a('0x10')](_0x8d4a('0x11'),_0x8d4a('0x12')),controller['addTags']);router['put'](_0x8d4a('0x6'),auth[_0x8d4a('0x7')](),interaction['tracked'](_0x8d4a('0x11'),_0x8d4a('0x13')),controller[_0x8d4a('0x14')]);router[_0x8d4a('0x15')](_0x8d4a('0x6'),auth[_0x8d4a('0x7')](),interaction[_0x8d4a('0x10')](_0x8d4a('0x11'),_0x8d4a('0x16')),controller[_0x8d4a('0x17')]);router['delete'](_0x8d4a('0xf'),auth[_0x8d4a('0x7')](),controller[_0x8d4a('0x18')]);module[_0x8d4a('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index a1a36ff..6731a29 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 _0x77ac=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x3ca05d,_0x33f42d){var _0x3ea007=function(_0x8b8068){while(--_0x8b8068){_0x3ca05d['push'](_0x3ca05d['shift']());}};_0x3ea007(++_0x33f42d);}(_0x77ac,0x98));var _0xc77a=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x77ac[_0x2eb5bc];return _0x51c7b1;};'use strict';var Sequelize=require(_0xc77a('0x0'));var iconv=require('iconv');module[_0xc77a('0x1')]={'closed':{'type':Sequelize[_0xc77a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc77a('0x3')]},'disposition':{'type':Sequelize[_0xc77a('0x4')]},'secondDisposition':{'type':Sequelize[_0xc77a('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc77a('0x4')]},'inReplyTo':{'type':Sequelize[_0xc77a('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc77a('0x4')]},'cc':{'type':Sequelize[_0xc77a('0x5')](_0xc77a('0x6'))},'subject':{'type':Sequelize[_0xc77a('0x5')]()},'attach':{'type':Sequelize[_0xc77a('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xc77a('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xc77a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc77a('0x7')]('in',_0xc77a('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc77a('0x7')]('in',_0xc77a('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc77a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc77a('0x9')]}}; \ No newline at end of file +var _0x5593=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','STRING','TEXT','DATE'];(function(_0x2e3174,_0x55ea82){var _0x174039=function(_0x279fef){while(--_0x279fef){_0x2e3174['push'](_0x2e3174['shift']());}};_0x174039(++_0x55ea82);}(_0x5593,0x1d7));var _0x3559=function(_0x30aadd,_0x20a265){_0x30aadd=_0x30aadd-0x0;var _0x428865=_0x5593[_0x30aadd];return _0x428865;};'use strict';var Sequelize=require(_0x3559('0x0'));var iconv=require('iconv');module[_0x3559('0x1')]={'closed':{'type':Sequelize[_0x3559('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3559('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3559('0x3')]},'note':{'type':Sequelize[_0x3559('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x3559('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x3559('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3559('0x5')]},'substatus':{'type':Sequelize[_0x3559('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x3559('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x3559('0x6')]('in',_0x3559('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3559('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x3559('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3559('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3559('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 479ea3d..d048cae 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 _0x2229=['find','create','body','update','describe','addMessage','MailMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','pick','where','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','rows','addTags','setTags','spread','color','emit','removeTags','download','unix','toString','root','server','files','tmp','attachments','join','format','push','Attachment','Attachments','from','bcc','subject','createdAt','Messages','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','juice','ioredis','../../config/logger','api','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','mail','query','user','catch','params','model','keys','MailInteraction','filters','intersection','attributes','fields','includeAll','include','merge','options'];(function(_0x2cfd73,_0x50ea71){var _0x5e1a1d=function(_0x4326f9){while(--_0x4326f9){_0x2cfd73['push'](_0x2cfd73['shift']());}};_0x5e1a1d(++_0x50ea71);}(_0x2229,0x196));var _0x9222=function(_0x412572,_0x37e9e2){_0x412572=_0x412572-0x0;var _0x20881f=_0x2229[_0x412572];return _0x20881f;};'use strict';var emlformat=require(_0x9222('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x9222('0x1'));var BPromise=require(_0x9222('0x2'));var util=require(_0x9222('0x3'));var path=require(_0x9222('0x4'));var fs=require('fs');var _=require('lodash');var juice=require(_0x9222('0x5'));var Redis=require(_0x9222('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x9222('0x7'))(_0x9222('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x9222('0x9'));config[_0x9222('0xa')]=_[_0x9222('0xb')](config[_0x9222('0xa')],{'host':_0x9222('0xc'),'port':0x18eb});var socket=require(_0x9222('0xd'))(new Redis(config[_0x9222('0xa')]));require(_0x9222('0xe'))[_0x9222('0xf')](socket);function respondWithStatusCode(_0x59c62b,_0x5917f4){_0x5917f4=_0x5917f4||0xcc;return function(_0x4fe165){if(_0x4fe165){return _0x59c62b[_0x9222('0x10')](_0x5917f4);}return _0x59c62b[_0x9222('0x11')](_0x5917f4)['end']();};}function respondWithResult(_0x149e53,_0xffb4ed){_0xffb4ed=_0xffb4ed||0xc8;return function(_0x17e599){if(_0x17e599){return _0x149e53['status'](_0xffb4ed)[_0x9222('0x12')](_0x17e599);}};}function respondWithFilteredResult(_0x3742e9,_0x438a03){return function(_0x265be0){if(_0x265be0){var _0x1c5f21=typeof _0x438a03['offset']===_0x9222('0x13')&&typeof _0x438a03[_0x9222('0x14')]===_0x9222('0x13');var _0x1a9eec=_0x265be0[_0x9222('0x15')];var _0x4fc904=_0x1c5f21?0x0:_0x438a03[_0x9222('0x16')];var _0x4a604a=_0x1c5f21?_0x265be0['count']:_0x438a03[_0x9222('0x16')]+_0x438a03['limit'];var _0xac0ae1;if(_0x4a604a>=_0x1a9eec){_0x4a604a=_0x1a9eec;_0xac0ae1=0xc8;}else{_0xac0ae1=0xce;}_0x3742e9[_0x9222('0x11')](_0xac0ae1);return _0x3742e9[_0x9222('0x17')](_0x9222('0x18'),_0x4fc904+'-'+_0x4a604a+'/'+_0x1a9eec)['json'](_0x265be0);}return null;};}function saveUpdates(_0x4e7c94){return function(_0x339f49){if(_0x339f49){return _0x339f49['update'](_0x4e7c94)[_0x9222('0x19')](function(_0x5a1ed3){return _0x5a1ed3;});}return null;};}function removeEntity(_0x497eec){return function(_0x34618e){if(_0x34618e){return _0x34618e[_0x9222('0x1a')]()[_0x9222('0x19')](function(){_0x497eec[_0x9222('0x11')](0xcc)[_0x9222('0x1b')]();});}};}function handleEntityNotFound(_0x2a397b){return function(_0x43ea5e){if(!_0x43ea5e){_0x2a397b[_0x9222('0x10')](0x194);}return _0x43ea5e;};}function handleError(_0x27d26c,_0x49ee96){_0x49ee96=_0x49ee96||0x1f4;return function(_0x43c58a){logger[_0x9222('0x1c')](_0x43c58a[_0x9222('0x1d')]);if(_0x43c58a[_0x9222('0x1e')]){delete _0x43c58a[_0x9222('0x1e')];}_0x27d26c[_0x9222('0x11')](_0x49ee96)[_0x9222('0x1f')](_0x43c58a);};}exports[_0x9222('0x20')]=function(_0x2adc0d,_0x596d1d){var _0x51441b={};var _0x448a3f=_[_0x9222('0x21')](db['MailInteraction'][_0x9222('0x22')],function(_0x36ba01){return{'name':_0x36ba01[_0x9222('0x23')],'type':_0x36ba01[_0x9222('0x24')][_0x9222('0x25')]};});_0x51441b=qs['getOptions'](_0x448a3f,_0x2adc0d);return interaction['findAll'](_0x9222('0x26'),_0x2adc0d[_0x9222('0x27')],_0x2adc0d[_0x9222('0x28')],_0x51441b,_0x448a3f)[_0x9222('0x19')](respondWithFilteredResult(_0x596d1d,_0x51441b))[_0x9222('0x29')](handleError(_0x596d1d,null));};exports['show']=function(_0x438241,_0x399456){var _0x413977={'raw':![],'where':{'id':_0x438241[_0x9222('0x2a')]['id']}},_0x2def77={};_0x2def77[_0x9222('0x2b')]=_[_0x9222('0x2c')](db[_0x9222('0x2d')][_0x9222('0x22')]);_0x2def77[_0x9222('0x27')]=_['keys'](_0x438241['query']);_0x2def77[_0x9222('0x2e')]=_[_0x9222('0x2f')](_0x2def77[_0x9222('0x2b')],_0x2def77[_0x9222('0x27')]);_0x413977[_0x9222('0x30')]=_[_0x9222('0x2f')](_0x2def77['model'],qs[_0x9222('0x31')](_0x438241[_0x9222('0x27')][_0x9222('0x31')]));_0x413977[_0x9222('0x30')]=_0x413977[_0x9222('0x30')]['length']?_0x413977['attributes']:_0x2def77[_0x9222('0x2b')];if(_0x438241[_0x9222('0x27')][_0x9222('0x32')]){_0x413977[_0x9222('0x33')]=[{'all':!![]}];}_0x413977=_[_0x9222('0x34')]({},_0x413977,_0x438241[_0x9222('0x35')]);return db[_0x9222('0x2d')][_0x9222('0x36')](_0x413977)[_0x9222('0x19')](handleEntityNotFound(_0x399456,null))[_0x9222('0x19')](respondWithResult(_0x399456,null))[_0x9222('0x29')](handleError(_0x399456,null));};exports[_0x9222('0x37')]=function(_0x392c5c,_0x24da55){return db[_0x9222('0x2d')][_0x9222('0x37')](_0x392c5c[_0x9222('0x38')],{})['then'](respondWithResult(_0x24da55,0xc9))[_0x9222('0x29')](handleError(_0x24da55,null));};exports[_0x9222('0x39')]=function(_0x26be91,_0xea4a0e){if(_0x26be91[_0x9222('0x38')]['id']){delete _0x26be91[_0x9222('0x38')]['id'];}return db[_0x9222('0x2d')]['find']({'where':{'id':_0x26be91[_0x9222('0x2a')]['id']}})[_0x9222('0x19')](handleEntityNotFound(_0xea4a0e,null))[_0x9222('0x19')](saveUpdates(_0x26be91[_0x9222('0x38')],null))[_0x9222('0x19')](respondWithResult(_0xea4a0e,null))[_0x9222('0x29')](handleError(_0xea4a0e,null));};exports[_0x9222('0x1a')]=function(_0x4c45d5,_0x25c347){return db[_0x9222('0x2d')][_0x9222('0x36')]({'where':{'id':_0x4c45d5[_0x9222('0x2a')]['id']}})[_0x9222('0x19')](handleEntityNotFound(_0x25c347,null))[_0x9222('0x19')](removeEntity(_0x25c347,null))['catch'](handleError(_0x25c347,null));};exports['describe']=function(_0x4b5722,_0x4abf6f){return db[_0x9222('0x2d')][_0x9222('0x3a')]()['then'](respondWithResult(_0x4abf6f,null))['catch'](handleError(_0x4abf6f,null));};exports[_0x9222('0x3b')]=function(_0x7ae3fd,_0x2fb3f2){return db[_0x9222('0x3c')][_0x9222('0x36')]({'where':{'id':_0x7ae3fd[_0x9222('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2fb3f2,null))[_0x9222('0x19')](function(_0x279fa8){if(_0x279fa8){return _0x279fa8[_0x9222('0x3b')](_0x7ae3fd[_0x9222('0x38')][_0x9222('0x3d')],_['omit'](_0x7ae3fd[_0x9222('0x38')],[_0x9222('0x3d'),'id'])||{});}})[_0x9222('0x19')](respondWithResult(_0x2fb3f2,null))[_0x9222('0x29')](handleError(_0x2fb3f2,null));};exports[_0x9222('0x3e')]=function(_0x190c92,_0x409b9b){var _0x40fe2e={'raw':![],'where':{}};var _0x2cb1e0={};var _0x548379={'count':0x0,'rows':[]};return db[_0x9222('0x2d')][_0x9222('0x3f')]({'where':{'id':_0x190c92[_0x9222('0x2a')]['id']}})[_0x9222('0x19')](handleEntityNotFound(_0x409b9b,null))['then'](function(_0x320da2){if(_0x320da2){_0x2cb1e0[_0x9222('0x2b')]=_[_0x9222('0x2c')](db['MailMessage'][_0x9222('0x22')]);_0x2cb1e0['query']=_[_0x9222('0x2c')](_0x190c92[_0x9222('0x27')]);_0x2cb1e0[_0x9222('0x2e')]=_[_0x9222('0x2f')](_0x2cb1e0[_0x9222('0x2b')],_0x2cb1e0[_0x9222('0x27')]);_0x40fe2e[_0x9222('0x30')]=_['intersection'](_0x2cb1e0['model'],qs['fields'](_0x190c92['query'][_0x9222('0x31')]));_0x40fe2e[_0x9222('0x30')]=_0x40fe2e[_0x9222('0x30')][_0x9222('0x40')]?_0x40fe2e[_0x9222('0x30')]:_0x2cb1e0[_0x9222('0x2b')];if(!_0x190c92[_0x9222('0x27')][_0x9222('0x41')](_0x9222('0x42'))){_0x40fe2e[_0x9222('0x14')]=qs[_0x9222('0x14')](_0x190c92['query'][_0x9222('0x14')]);_0x40fe2e[_0x9222('0x16')]=qs[_0x9222('0x16')](_0x190c92[_0x9222('0x27')][_0x9222('0x16')]);}_0x40fe2e[_0x9222('0x43')]=qs[_0x9222('0x44')](_0x190c92[_0x9222('0x27')][_0x9222('0x44')]);_0x40fe2e['where']=qs['filters'](_[_0x9222('0x45')](_0x190c92[_0x9222('0x27')],_0x2cb1e0['filters']));_0x40fe2e[_0x9222('0x46')][_0x9222('0x47')]=_0x320da2['id'];if(_0x190c92[_0x9222('0x27')][_0x9222('0x48')]){_0x40fe2e[_0x9222('0x46')]=_['merge'](_0x40fe2e[_0x9222('0x46')],{'$or':_[_0x9222('0x21')](_0x40fe2e[_0x9222('0x30')],function(_0x32e988){var _0x30eb95={};_0x30eb95[_0x32e988]={'$like':'%'+_0x190c92[_0x9222('0x27')][_0x9222('0x48')]+'%'};return _0x30eb95;})});}if(_0x190c92[_0x9222('0x27')][_0x9222('0x49')]){var _0x503454=_0x190c92[_0x9222('0x27')][_0x9222('0x49')][_0x9222('0x4a')](',');var _0x19bddf={};_0x19bddf[_0x503454[0x0]]={'$gte':moment(_0x503454[0x1])['format'](_0x9222('0x4b'))};_0x40fe2e[_0x9222('0x46')]=_[_0x9222('0x34')](_0x40fe2e[_0x9222('0x46')],_0x19bddf);}_0x40fe2e=_[_0x9222('0x34')]({},_0x40fe2e,_0x190c92[_0x9222('0x35')]);return db[_0x9222('0x3c')][_0x9222('0x15')]({'where':_0x40fe2e[_0x9222('0x46')]})[_0x9222('0x19')](function(_0x5a07d4){_0x548379['count']=_0x5a07d4;if(_0x190c92['query']['includeAll']){_0x40fe2e[_0x9222('0x33')]=[{'all':!![]}];}return db['MailMessage'][_0x9222('0x4c')](_0x40fe2e);})['then'](function(_0x3280e7){if(_0x190c92['query'][_0x9222('0x4d')]===_0x9222('0x4e')){for(var _0x300b30=0x0;_0x300b30<_0x3280e7['length'];_0x300b30++){_0x3280e7[_0x300b30][_0x9222('0x38')]=juice(_0x3280e7[_0x300b30][_0x9222('0x38')]);}}_0x548379[_0x9222('0x4f')]=_0x3280e7;return _0x548379;});}})['then'](respondWithFilteredResult(_0x409b9b,_0x40fe2e))['catch'](handleError(_0x409b9b,null));};exports[_0x9222('0x50')]=function(_0x4a95d1,_0x52c3a2){return db[_0x9222('0x2d')][_0x9222('0x36')]({'where':{'id':_0x4a95d1[_0x9222('0x2a')]['id']}})[_0x9222('0x19')](handleEntityNotFound(_0x52c3a2,null))[_0x9222('0x19')](function(_0xb9e0b3){if(_0xb9e0b3){return _0xb9e0b3[_0x9222('0x51')](_0x4a95d1[_0x9222('0x38')][_0x9222('0x3d')],_['omit'](_0x4a95d1[_0x9222('0x38')],[_0x9222('0x3d'),'id'])||{})[_0x9222('0x52')](function(){return db['Tag'][_0x9222('0x4c')]({'attributes':['id',_0x9222('0x1e'),_0x9222('0x53')],'where':{'id':_0x4a95d1['body'][_0x9222('0x3d')]}});})[_0x9222('0x19')](function(_0x55150a){socket[_0x9222('0x54')]('mailInteractionTags:save',{'id':Number(_0x4a95d1[_0x9222('0x2a')]['id']),'tags':_0x55150a||[]});return{'id':Number(_0x4a95d1[_0x9222('0x2a')]['id']),'tags':_0x55150a||[]};});}})['then'](respondWithResult(_0x52c3a2,null))['catch'](handleError(_0x52c3a2,null));};exports[_0x9222('0x55')]=function(_0x425aae,_0x5b4997){return db['MailInteraction'][_0x9222('0x36')]({'where':{'id':_0x425aae['params']['id']}})[_0x9222('0x19')](handleEntityNotFound(_0x5b4997,null))[_0x9222('0x19')](function(_0x3cd948){if(_0x3cd948){return _0x3cd948[_0x9222('0x55')](_0x425aae[_0x9222('0x27')][_0x9222('0x3d')]);}})[_0x9222('0x19')](respondWithStatusCode(_0x5b4997,null))[_0x9222('0x29')](handleError(_0x5b4997,null));};exports[_0x9222('0x56')]=function(_0x1fe269,_0xf6a499){var _0x3109a3=moment()[_0x9222('0x57')]()[_0x9222('0x58')]();var _0x299102=path['join'](config[_0x9222('0x59')],_0x9222('0x5a'),_0x9222('0x5b'),_0x9222('0x5c'));var _0xedc9be=path['join'](config[_0x9222('0x59')],_0x9222('0x5a'),_0x9222('0x5b'),_0x9222('0x5d'));var _0x4a608d=path[_0x9222('0x5e')](_0x299102,_0x3109a3);var _0x2ac9ba=util[_0x9222('0x5f')]('transcript-%d-%s.zip',_0x1fe269[_0x9222('0x2a')]['id'],_0x3109a3);var _0x565611=path[_0x9222('0x5e')](_0x299102,_0x2ac9ba);var _0x27c230=[];if(_0x1fe269['query'][_0x9222('0x5d')]){_0x27c230[_0x9222('0x60')]({'model':db[_0x9222('0x61')],'as':_0x9222('0x62'),'raw':!![]});}var _0x1cd77e=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x9222('0x38'),_0x9222('0x63'),'to','cc',_0x9222('0x64'),_0x9222('0x65'),_0x9222('0x66')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x27c230}];return db['MailInteraction'][_0x9222('0x36')]({'where':{'id':_0x1fe269[_0x9222('0x2a')]['id']},'include':_0x1cd77e})['then'](handleEntityNotFound(_0xf6a499,null))['then'](function(_0x65ef4f){if(_0x65ef4f&&_0x65ef4f[_0x9222('0x67')]){var _0x46df98=_0x65ef4f[_0x9222('0x68')]({'plain':!![]});fs[_0x9222('0x69')](_0x4a608d);return BPromise['each'](_0x46df98[_0x9222('0x67')],function(_0x9a3fd1,_0x3ccab2){var _0x5aa1cf={'from':_0x9a3fd1[_0x9222('0x63')],'to':_0x9a3fd1['to']||'missing.recipient@your.company.com','subject':_0x9a3fd1[_0x9222('0x65')],'html':htmlEntities['decode'](_0x9a3fd1['body']),'headers':{'Date':moment(_0x9a3fd1[_0x9222('0x66')])[_0x9222('0x5f')](_0x9222('0x6a'))},'attachments':[]};if(_0x9a3fd1['cc']){_0x5aa1cf[_0x9222('0x6b')]['Cc']=_0x9a3fd1['cc'];}if(_0x9a3fd1[_0x9222('0x64')]){_0x5aa1cf['headers'][_0x9222('0x6c')]=_0x9a3fd1[_0x9222('0x64')];}return new BPromise(function(_0x1387d5,_0xf3e766){if(_0x9a3fd1[_0x9222('0x62')]){for(var _0x30c576=0x0;_0x30c576<_0x9a3fd1[_0x9222('0x62')]['length'];_0x30c576++){var _0x56dd48=_0x9a3fd1[_0x9222('0x62')][_0x30c576];var _0x64f19=path['join'](_0xedc9be,_0x56dd48[_0x9222('0x6d')]);if(fs[_0x9222('0x6e')](_0x64f19)){_0x5aa1cf[_0x9222('0x5d')][_0x9222('0x60')]({'name':_0x56dd48[_0x9222('0x1e')],'contentType':_0x56dd48[_0x9222('0x24')],'data':fs[_0x9222('0x6f')](_0x64f19)});}}}emlformat[_0x9222('0x70')](_0x5aa1cf,function(_0x7297dd,_0x5633cd){if(_0x7297dd)return _0xf3e766(_0x7297dd);fs[_0x9222('0x71')](path[_0x9222('0x5e')](_0x4a608d,util['format']('message%d.eml',_0x3ccab2)),_0x5633cd);return _0x1387d5(_0x5633cd);});});})[_0x9222('0x19')](function(){return new BPromise(function(_0x5eb0a1,_0x184e78){zipdir(_0x4a608d,{'saveTo':_0x565611},function(_0x4e8a5b,_0x1d68f0){if(_0x4e8a5b)return _0x184e78(_0x4e8a5b);return _0x5eb0a1(_0x1d68f0);});})[_0x9222('0x19')](function(){return new BPromise(function(_0x1a79a0,_0xb898c6){rimraf(_0x4a608d,function(_0x1d36bb){if(_0x1d36bb)_0xb898c6(_0x1d36bb);return _0x1a79a0();});});})[_0x9222('0x19')](function(){return _0xf6a499[_0x9222('0x56')](_0x565611,_0x2ac9ba,function(_0x3bbc97){if(!_0x3bbc97)fs[_0x9222('0x72')](_0x565611);});});});}else{return _0xf6a499['sendStatus'](0xc8);}})[_0x9222('0x29')](handleError(_0xf6a499,null));}; \ No newline at end of file +var _0xa3d6=['true','rows','addTags','omit','color','emit','mailInteractionTags:save','unix','toString','join','server','files','root','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','subject','get','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','existsSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','redis','defaults','localhost','./mailInteraction.socket','sendStatus','status','json','offset','undefined','count','limit','set','update','then','end','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','query','user','catch','show','model','keys','filters','intersection','attributes','fields','length','merge','options','find','body','params','destroy','describe','addMessage','MailMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','where','filter','$gte','split','format','includeAll','include','inlineCss'];(function(_0x2d7e66,_0x44633c){var _0x58b07c=function(_0x28d399){while(--_0x28d399){_0x2d7e66['push'](_0x2d7e66['shift']());}};_0x58b07c(++_0x44633c);}(_0xa3d6,0x92));var _0x6a3d=function(_0x4f9e17,_0x4cf03f){_0x4f9e17=_0x4f9e17-0x0;var _0x4e7af7=_0xa3d6[_0x4f9e17];return _0x4e7af7;};'use strict';var emlformat=require(_0x6a3d('0x0'));var rimraf=require(_0x6a3d('0x1'));var zipdir=require(_0x6a3d('0x2'));var moment=require(_0x6a3d('0x3'));var BPromise=require(_0x6a3d('0x4'));var util=require(_0x6a3d('0x5'));var path=require(_0x6a3d('0x6'));var fs=require('fs');var _=require(_0x6a3d('0x7'));var juice=require(_0x6a3d('0x8'));var Redis=require(_0x6a3d('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0x6a3d('0xa'));var logger=require(_0x6a3d('0xb'))(_0x6a3d('0xc'));var config=require(_0x6a3d('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x6a3d('0xe'));config[_0x6a3d('0xf')]=_[_0x6a3d('0x10')](config[_0x6a3d('0xf')],{'host':_0x6a3d('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a3d('0xf')]));require(_0x6a3d('0x12'))['register'](socket);function respondWithStatusCode(_0x1a03bf,_0x18651d){_0x18651d=_0x18651d||0xcc;return function(_0x23faf5){if(_0x23faf5){return _0x1a03bf[_0x6a3d('0x13')](_0x18651d);}return _0x1a03bf['status'](_0x18651d)['end']();};}function respondWithResult(_0x59cb2c,_0x26b847){_0x26b847=_0x26b847||0xc8;return function(_0x12b98d){if(_0x12b98d){return _0x59cb2c[_0x6a3d('0x14')](_0x26b847)[_0x6a3d('0x15')](_0x12b98d);}};}function respondWithFilteredResult(_0x238ed3,_0x4346c9){return function(_0x11765c){if(_0x11765c){var _0x433e52=typeof _0x4346c9[_0x6a3d('0x16')]===_0x6a3d('0x17')&&typeof _0x4346c9['limit']===_0x6a3d('0x17');var _0x56f719=_0x11765c[_0x6a3d('0x18')];var _0x5b6a11=_0x433e52?0x0:_0x4346c9[_0x6a3d('0x16')];var _0x4b46e3=_0x433e52?_0x11765c['count']:_0x4346c9[_0x6a3d('0x16')]+_0x4346c9[_0x6a3d('0x19')];var _0x23edc5;if(_0x4b46e3>=_0x56f719){_0x4b46e3=_0x56f719;_0x23edc5=0xc8;}else{_0x23edc5=0xce;}_0x238ed3[_0x6a3d('0x14')](_0x23edc5);return _0x238ed3[_0x6a3d('0x1a')]('Content-Range',_0x5b6a11+'-'+_0x4b46e3+'/'+_0x56f719)[_0x6a3d('0x15')](_0x11765c);}return null;};}function saveUpdates(_0x26b5a0){return function(_0x58b737){if(_0x58b737){return _0x58b737[_0x6a3d('0x1b')](_0x26b5a0)[_0x6a3d('0x1c')](function(_0x1a50d5){return _0x1a50d5;});}return null;};}function removeEntity(_0x4821a2){return function(_0x47ce01){if(_0x47ce01){return _0x47ce01['destroy']()['then'](function(){_0x4821a2[_0x6a3d('0x14')](0xcc)[_0x6a3d('0x1d')]();});}};}function handleEntityNotFound(_0x5b1089){return function(_0xb9d97b){if(!_0xb9d97b){_0x5b1089[_0x6a3d('0x13')](0x194);}return _0xb9d97b;};}function handleError(_0x52bf2a,_0x261b96){_0x261b96=_0x261b96||0x1f4;return function(_0x365505){logger['error'](_0x365505[_0x6a3d('0x1e')]);if(_0x365505[_0x6a3d('0x1f')]){delete _0x365505[_0x6a3d('0x1f')];}_0x52bf2a['status'](_0x261b96)[_0x6a3d('0x20')](_0x365505);};}exports[_0x6a3d('0x21')]=function(_0xc5518f,_0x35e8d7){var _0x4b32cf={};var _0x4966dc=_[_0x6a3d('0x22')](db[_0x6a3d('0x23')][_0x6a3d('0x24')],function(_0x288b04){return{'name':_0x288b04[_0x6a3d('0x25')],'type':_0x288b04[_0x6a3d('0x26')][_0x6a3d('0x27')]};});_0x4b32cf=qs['getOptions'](_0x4966dc,_0xc5518f);return interaction[_0x6a3d('0x28')](_0x6a3d('0x29'),_0xc5518f[_0x6a3d('0x2a')],_0xc5518f[_0x6a3d('0x2b')],_0x4b32cf,_0x4966dc)[_0x6a3d('0x1c')](respondWithFilteredResult(_0x35e8d7,_0x4b32cf))[_0x6a3d('0x2c')](handleError(_0x35e8d7,null));};exports[_0x6a3d('0x2d')]=function(_0x3beff0,_0x45eda4){var _0x58ce8c={'raw':![],'where':{'id':_0x3beff0['params']['id']}},_0x5be19a={};_0x5be19a[_0x6a3d('0x2e')]=_[_0x6a3d('0x2f')](db[_0x6a3d('0x23')]['rawAttributes']);_0x5be19a[_0x6a3d('0x2a')]=_[_0x6a3d('0x2f')](_0x3beff0[_0x6a3d('0x2a')]);_0x5be19a[_0x6a3d('0x30')]=_[_0x6a3d('0x31')](_0x5be19a['model'],_0x5be19a['query']);_0x58ce8c[_0x6a3d('0x32')]=_[_0x6a3d('0x31')](_0x5be19a[_0x6a3d('0x2e')],qs['fields'](_0x3beff0[_0x6a3d('0x2a')][_0x6a3d('0x33')]));_0x58ce8c[_0x6a3d('0x32')]=_0x58ce8c['attributes'][_0x6a3d('0x34')]?_0x58ce8c[_0x6a3d('0x32')]:_0x5be19a[_0x6a3d('0x2e')];if(_0x3beff0[_0x6a3d('0x2a')]['includeAll']){_0x58ce8c['include']=[{'all':!![]}];}_0x58ce8c=_[_0x6a3d('0x35')]({},_0x58ce8c,_0x3beff0[_0x6a3d('0x36')]);return db[_0x6a3d('0x23')][_0x6a3d('0x37')](_0x58ce8c)[_0x6a3d('0x1c')](handleEntityNotFound(_0x45eda4,null))[_0x6a3d('0x1c')](respondWithResult(_0x45eda4,null))['catch'](handleError(_0x45eda4,null));};exports['create']=function(_0x37d8ef,_0x5d4a5e){return db[_0x6a3d('0x23')]['create'](_0x37d8ef['body'],{})[_0x6a3d('0x1c')](respondWithResult(_0x5d4a5e,0xc9))[_0x6a3d('0x2c')](handleError(_0x5d4a5e,null));};exports[_0x6a3d('0x1b')]=function(_0x44b080,_0x101031){if(_0x44b080[_0x6a3d('0x38')]['id']){delete _0x44b080[_0x6a3d('0x38')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x44b080[_0x6a3d('0x39')]['id']}})[_0x6a3d('0x1c')](handleEntityNotFound(_0x101031,null))[_0x6a3d('0x1c')](saveUpdates(_0x44b080[_0x6a3d('0x38')],null))[_0x6a3d('0x1c')](respondWithResult(_0x101031,null))[_0x6a3d('0x2c')](handleError(_0x101031,null));};exports[_0x6a3d('0x3a')]=function(_0x2c87d3,_0x3fe14d){return db[_0x6a3d('0x23')][_0x6a3d('0x37')]({'where':{'id':_0x2c87d3[_0x6a3d('0x39')]['id']}})['then'](handleEntityNotFound(_0x3fe14d,null))[_0x6a3d('0x1c')](removeEntity(_0x3fe14d,null))[_0x6a3d('0x2c')](handleError(_0x3fe14d,null));};exports['describe']=function(_0x50480b,_0x497943){return db[_0x6a3d('0x23')][_0x6a3d('0x3b')]()['then'](respondWithResult(_0x497943,null))[_0x6a3d('0x2c')](handleError(_0x497943,null));};exports[_0x6a3d('0x3c')]=function(_0x56e930,_0xb176b1){return db[_0x6a3d('0x3d')][_0x6a3d('0x37')]({'where':{'id':_0x56e930['params']['id']}})[_0x6a3d('0x1c')](handleEntityNotFound(_0xb176b1,null))[_0x6a3d('0x1c')](function(_0x3e5ae8){if(_0x3e5ae8){return _0x3e5ae8['addMessage'](_0x56e930[_0x6a3d('0x38')][_0x6a3d('0x3e')],_['omit'](_0x56e930[_0x6a3d('0x38')],[_0x6a3d('0x3e'),'id'])||{});}})['then'](respondWithResult(_0xb176b1,null))[_0x6a3d('0x2c')](handleError(_0xb176b1,null));};exports['getMessages']=function(_0xc04f9f,_0xfa7811){var _0x25b241={'raw':![],'where':{}};var _0x572f57={};var _0x3859fd={'count':0x0,'rows':[]};return db[_0x6a3d('0x23')][_0x6a3d('0x3f')]({'where':{'id':_0xc04f9f[_0x6a3d('0x39')]['id']}})[_0x6a3d('0x1c')](handleEntityNotFound(_0xfa7811,null))[_0x6a3d('0x1c')](function(_0x5c74f8){if(_0x5c74f8){_0x572f57[_0x6a3d('0x2e')]=_[_0x6a3d('0x2f')](db[_0x6a3d('0x3d')]['rawAttributes']);_0x572f57[_0x6a3d('0x2a')]=_[_0x6a3d('0x2f')](_0xc04f9f[_0x6a3d('0x2a')]);_0x572f57[_0x6a3d('0x30')]=_[_0x6a3d('0x31')](_0x572f57[_0x6a3d('0x2e')],_0x572f57[_0x6a3d('0x2a')]);_0x25b241[_0x6a3d('0x32')]=_[_0x6a3d('0x31')](_0x572f57[_0x6a3d('0x2e')],qs['fields'](_0xc04f9f[_0x6a3d('0x2a')][_0x6a3d('0x33')]));_0x25b241[_0x6a3d('0x32')]=_0x25b241[_0x6a3d('0x32')][_0x6a3d('0x34')]?_0x25b241[_0x6a3d('0x32')]:_0x572f57[_0x6a3d('0x2e')];if(!_0xc04f9f[_0x6a3d('0x2a')][_0x6a3d('0x40')](_0x6a3d('0x41'))){_0x25b241[_0x6a3d('0x19')]=qs[_0x6a3d('0x19')](_0xc04f9f[_0x6a3d('0x2a')][_0x6a3d('0x19')]);_0x25b241['offset']=qs[_0x6a3d('0x16')](_0xc04f9f[_0x6a3d('0x2a')][_0x6a3d('0x16')]);}_0x25b241[_0x6a3d('0x42')]=qs[_0x6a3d('0x43')](_0xc04f9f[_0x6a3d('0x2a')]['sort']);_0x25b241[_0x6a3d('0x44')]=qs[_0x6a3d('0x30')](_['pick'](_0xc04f9f[_0x6a3d('0x2a')],_0x572f57[_0x6a3d('0x30')]));_0x25b241[_0x6a3d('0x44')]['MailInteractionId']=_0x5c74f8['id'];if(_0xc04f9f['query'][_0x6a3d('0x45')]){_0x25b241['where']=_[_0x6a3d('0x35')](_0x25b241[_0x6a3d('0x44')],{'$or':_['map'](_0x25b241[_0x6a3d('0x32')],function(_0x19f8cf){var _0x595c5a={};_0x595c5a[_0x19f8cf]={'$like':'%'+_0xc04f9f[_0x6a3d('0x2a')][_0x6a3d('0x45')]+'%'};return _0x595c5a;})});}if(_0xc04f9f[_0x6a3d('0x2a')][_0x6a3d('0x46')]){var _0x47f20c=_0xc04f9f[_0x6a3d('0x2a')][_0x6a3d('0x46')][_0x6a3d('0x47')](',');var _0x3a509={};_0x3a509[_0x47f20c[0x0]]={'$gte':moment(_0x47f20c[0x1])[_0x6a3d('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x25b241['where']=_[_0x6a3d('0x35')](_0x25b241['where'],_0x3a509);}_0x25b241=_[_0x6a3d('0x35')]({},_0x25b241,_0xc04f9f['options']);return db[_0x6a3d('0x3d')][_0x6a3d('0x18')]({'where':_0x25b241['where']})[_0x6a3d('0x1c')](function(_0x1bc118){_0x3859fd[_0x6a3d('0x18')]=_0x1bc118;if(_0xc04f9f['query'][_0x6a3d('0x49')]){_0x25b241[_0x6a3d('0x4a')]=[{'all':!![]}];}return db[_0x6a3d('0x3d')]['findAll'](_0x25b241);})[_0x6a3d('0x1c')](function(_0x535a2c){if(_0xc04f9f[_0x6a3d('0x2a')][_0x6a3d('0x4b')]===_0x6a3d('0x4c')){for(var _0x57ec73=0x0;_0x57ec73<_0x535a2c['length'];_0x57ec73++){_0x535a2c[_0x57ec73][_0x6a3d('0x38')]=juice(_0x535a2c[_0x57ec73][_0x6a3d('0x38')]);}}_0x3859fd[_0x6a3d('0x4d')]=_0x535a2c;return _0x3859fd;});}})[_0x6a3d('0x1c')](respondWithFilteredResult(_0xfa7811,_0x25b241))['catch'](handleError(_0xfa7811,null));};exports[_0x6a3d('0x4e')]=function(_0x495f8a,_0x2ea646){return db['MailInteraction'][_0x6a3d('0x37')]({'where':{'id':_0x495f8a['params']['id']}})[_0x6a3d('0x1c')](handleEntityNotFound(_0x2ea646,null))[_0x6a3d('0x1c')](function(_0x50c4a1){if(_0x50c4a1){return _0x50c4a1['setTags'](_0x495f8a[_0x6a3d('0x38')][_0x6a3d('0x3e')],_[_0x6a3d('0x4f')](_0x495f8a[_0x6a3d('0x38')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x6a3d('0x28')]({'attributes':['id',_0x6a3d('0x1f'),_0x6a3d('0x50')],'where':{'id':_0x495f8a[_0x6a3d('0x38')][_0x6a3d('0x3e')]}});})[_0x6a3d('0x1c')](function(_0xcdee51){socket[_0x6a3d('0x51')](_0x6a3d('0x52'),{'id':Number(_0x495f8a['params']['id']),'tags':_0xcdee51||[]});return{'id':Number(_0x495f8a[_0x6a3d('0x39')]['id']),'tags':_0xcdee51||[]};});}})[_0x6a3d('0x1c')](respondWithResult(_0x2ea646,null))[_0x6a3d('0x2c')](handleError(_0x2ea646,null));};exports['removeTags']=function(_0x2cf46a,_0x20695e){return db[_0x6a3d('0x23')]['find']({'where':{'id':_0x2cf46a[_0x6a3d('0x39')]['id']}})[_0x6a3d('0x1c')](handleEntityNotFound(_0x20695e,null))['then'](function(_0x5cc46a){if(_0x5cc46a){return _0x5cc46a['removeTags'](_0x2cf46a[_0x6a3d('0x2a')][_0x6a3d('0x3e')]);}})[_0x6a3d('0x1c')](respondWithStatusCode(_0x20695e,null))['catch'](handleError(_0x20695e,null));};exports['download']=function(_0x3706b9,_0x9cd836){var _0x5edcf2=moment()[_0x6a3d('0x53')]()[_0x6a3d('0x54')]();var _0x26869c=path[_0x6a3d('0x55')](config['root'],_0x6a3d('0x56'),_0x6a3d('0x57'),'tmp');var _0x4e1483=path[_0x6a3d('0x55')](config[_0x6a3d('0x58')],_0x6a3d('0x56'),_0x6a3d('0x57'),_0x6a3d('0x59'));var _0x230288=path[_0x6a3d('0x55')](_0x26869c,_0x5edcf2);var _0x2ae24d=util['format'](_0x6a3d('0x5a'),_0x3706b9['params']['id'],_0x5edcf2);var _0x250b5a=path[_0x6a3d('0x55')](_0x26869c,_0x2ae24d);var _0x11abfa=[];if(_0x3706b9[_0x6a3d('0x2a')]['attachments']){_0x11abfa[_0x6a3d('0x5b')]({'model':db[_0x6a3d('0x5c')],'as':_0x6a3d('0x5d'),'raw':!![]});}var _0x176766=[{'model':db['MailMessage'],'as':_0x6a3d('0x5e'),'attributes':['id',_0x6a3d('0x38'),_0x6a3d('0x5f'),'to','cc','bcc',_0x6a3d('0x60'),'createdAt'],'where':{'secret':![]},'order':qs[_0x6a3d('0x43')]('id'),'include':_0x11abfa}];return db['MailInteraction'][_0x6a3d('0x37')]({'where':{'id':_0x3706b9[_0x6a3d('0x39')]['id']},'include':_0x176766})[_0x6a3d('0x1c')](handleEntityNotFound(_0x9cd836,null))[_0x6a3d('0x1c')](function(_0x3ab104){if(_0x3ab104&&_0x3ab104[_0x6a3d('0x5e')]){var _0x354d0e=_0x3ab104[_0x6a3d('0x61')]({'plain':!![]});fs['mkdirSync'](_0x230288);return BPromise['each'](_0x354d0e[_0x6a3d('0x5e')],function(_0x2efa65,_0x89740e){var _0x295fb3={'from':_0x2efa65['from'],'to':_0x2efa65['to']||_0x6a3d('0x62'),'subject':_0x2efa65['subject'],'html':htmlEntities[_0x6a3d('0x63')](_0x2efa65[_0x6a3d('0x38')]),'headers':{'Date':moment(_0x2efa65[_0x6a3d('0x64')])[_0x6a3d('0x48')](_0x6a3d('0x65'))},'attachments':[]};if(_0x2efa65['cc']){_0x295fb3['headers']['Cc']=_0x2efa65['cc'];}if(_0x2efa65['bcc']){_0x295fb3[_0x6a3d('0x66')]['Bcc']=_0x2efa65[_0x6a3d('0x67')];}return new BPromise(function(_0x409a07,_0x1c26f6){if(_0x2efa65[_0x6a3d('0x5d')]){for(var _0x166b0d=0x0;_0x166b0d<_0x2efa65[_0x6a3d('0x5d')][_0x6a3d('0x34')];_0x166b0d++){var _0x5497b4=_0x2efa65['Attachments'][_0x166b0d];var _0x2d9705=path['join'](_0x4e1483,_0x5497b4[_0x6a3d('0x68')]);if(fs[_0x6a3d('0x69')](_0x2d9705)){_0x295fb3[_0x6a3d('0x59')][_0x6a3d('0x5b')]({'name':_0x5497b4[_0x6a3d('0x1f')],'contentType':_0x5497b4[_0x6a3d('0x26')],'data':fs['readFileSync'](_0x2d9705)});}}}emlformat[_0x6a3d('0x6a')](_0x295fb3,function(_0x362fa2,_0x3e1c9f){if(_0x362fa2)return _0x1c26f6(_0x362fa2);fs[_0x6a3d('0x6b')](path[_0x6a3d('0x55')](_0x230288,util[_0x6a3d('0x48')](_0x6a3d('0x6c'),_0x89740e)),_0x3e1c9f);return _0x409a07(_0x3e1c9f);});});})[_0x6a3d('0x1c')](function(){return new BPromise(function(_0x535600,_0x52c83d){zipdir(_0x230288,{'saveTo':_0x250b5a},function(_0xd98ed2,_0xedecf0){if(_0xd98ed2)return _0x52c83d(_0xd98ed2);return _0x535600(_0xedecf0);});})['then'](function(){return new BPromise(function(_0x51e6bf,_0x24bd8c){rimraf(_0x230288,function(_0x2ad253){if(_0x2ad253)_0x24bd8c(_0x2ad253);return _0x51e6bf();});});})[_0x6a3d('0x1c')](function(){return _0x9cd836[_0x6a3d('0x6d')](_0x250b5a,_0x2ae24d,function(_0xe4c764){if(!_0xe4c764)fs[_0x6a3d('0x6e')](_0x250b5a);});});});}else{return _0x9cd836[_0x6a3d('0x13')](0xc8);}})[_0x6a3d('0x2c')](handleError(_0x9cd836,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 1351911..53fcec6 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 _0x71e7=['events','MailInteraction','MailMessage','save','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports'];(function(_0xc4d9ac,_0x313006){var _0x17f386=function(_0x273365){while(--_0x273365){_0xc4d9ac['push'](_0xc4d9ac['shift']());}};_0x17f386(++_0x313006);}(_0x71e7,0x188));var _0x771e=function(_0x5d7d2e,_0x197aab){_0x5d7d2e=_0x5d7d2e-0x0;var _0x5c96dd=_0x71e7[_0x5d7d2e];return _0x5c96dd;};'use strict';var EventEmitter=require(_0x771e('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x771e('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x771e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x771e('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x38e1cb){return function(_0x31b81b,_0x2e65d9,_0x18d262){_0x31b81b['getUsers']({'attributes':['id'],'raw':!![]})[_0x771e('0x4')](function(_0x5f5cd4){_0x31b81b[_0x771e('0x5')](_0x771e('0x6'),_0x5f5cd4[_0x771e('0x7')](function(_0x7b8e93){return{'id':_0x7b8e93['id']};}));return MailMessage[_0x771e('0x8')]({'where':{'MailInteractionId':_0x31b81b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x771e('0x4')](function(_0x4b09cb){_0x31b81b[_0x771e('0x5')](_0x771e('0x9'),_0x4b09cb['length']);MailInteractionEvents[_0x771e('0xa')](_0x38e1cb+':'+_0x31b81b['id'],_0x31b81b);MailInteractionEvents['emit'](_0x38e1cb,_0x31b81b);_0x18d262(null);})[_0x771e('0xb')](_0x18d262(null));};}for(var e in events){if(events[_0x771e('0xc')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x771e('0xd')]=MailInteractionEvents; \ No newline at end of file +var _0x2fbc=['Users','findAll','length','emit','catch','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','getUsers','setDataValue'];(function(_0x351c63,_0x3c529d){var _0x1fce30=function(_0x2e94b0){while(--_0x2e94b0){_0x351c63['push'](_0x351c63['shift']());}};_0x1fce30(++_0x3c529d);}(_0x2fbc,0x106));var _0xc2fb=function(_0x10fabe,_0x275970){_0x10fabe=_0x10fabe-0x0;var _0x230a35=_0x2fbc[_0x10fabe];return _0x230a35;};'use strict';var EventEmitter=require(_0xc2fb('0x0'));var MailInteraction=require(_0xc2fb('0x1'))['db'][_0xc2fb('0x2')];var MailMessage=require(_0xc2fb('0x1'))['db'][_0xc2fb('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc2fb('0x4')](0x0);var events={'afterCreate':_0xc2fb('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2cf307){return function(_0x2748bf,_0x4dc56f,_0x42131d){_0x2748bf[_0xc2fb('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x595a63){_0x2748bf[_0xc2fb('0x7')](_0xc2fb('0x8'),_0x595a63['map'](function(_0x3a13ab){return{'id':_0x3a13ab['id']};}));return MailMessage[_0xc2fb('0x9')]({'where':{'MailInteractionId':_0x2748bf['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x509583){_0x2748bf['setDataValue']('unreadMessages',_0x509583[_0xc2fb('0xa')]);MailInteractionEvents[_0xc2fb('0xb')](_0x2cf307+':'+_0x2748bf['id'],_0x2748bf);MailInteractionEvents[_0xc2fb('0xb')](_0x2cf307,_0x2748bf);_0x42131d(null);})[_0xc2fb('0xc')](_0x42131d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xc2fb('0xd')](e,emitEvent(event));}}module[_0xc2fb('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index add575d..ccdf9f7 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 _0x48de=['closed','closedAt','format','changed','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x173eff,_0x3a6077){var _0xa2b560=function(_0x25b24d){while(--_0x25b24d){_0x173eff['push'](_0x173eff['shift']());}};_0xa2b560(++_0x3a6077);}(_0x48de,0x169));var _0xe48d=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x48de[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe48d('0x0'))('api');var moment=require(_0xe48d('0x1'));var BPromise=require(_0xe48d('0x2'));var rp=require(_0xe48d('0x3'));var fs=require('fs');var path=require(_0xe48d('0x4'));var rimraf=require(_0xe48d('0x5'));var config=require(_0xe48d('0x6'));var attributes=require(_0xe48d('0x7'));module['exports']=function(_0xb30220,_0x203629){return _0xb30220[_0xe48d('0x8')](_0xe48d('0x9'),attributes,{'tableName':_0xe48d('0xa'),'paranoid':![],'indexes':[{'name':_0xe48d('0xb'),'fields':[_0xe48d('0xc'),'to'],'type':_0xe48d('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x870a8,_0x57ffc4,_0x3ce22d){if(_0x870a8[_0xe48d('0xe')]){_0x870a8[_0xe48d('0xf')]=moment()['format'](_0xe48d('0x10'));}if(_0x870a8[_0xe48d('0x11')]){_0x870a8[_0xe48d('0x12')]=moment()[_0xe48d('0x13')](_0xe48d('0x10'));}_0x3ce22d(null,_0x57ffc4);},'beforeUpdate':function(_0xb5faac,_0x192296,_0x5a2a07){if(_0xb5faac[_0xe48d('0x14')]('substatus')){_0xb5faac['substatusAt']=_0xb5faac[_0xe48d('0xe')]?moment()['format'](_0xe48d('0x10')):null;}if(_0xb5faac[_0xe48d('0x14')](_0xe48d('0x11'))){_0xb5faac[_0xe48d('0x12')]=moment()[_0xe48d('0x13')](_0xe48d('0x10'));_0xb5faac[_0xe48d('0xe')]=null;_0xb5faac[_0xe48d('0xf')]=null;}_0x5a2a07(null,_0xb5faac);},'afterUpdate':function(_0x10b9f3,_0x240a63,_0x449b1d){var _0x5e91d2=_0xb30220['models'];var _0x1bad95=_0x10b9f3[_0xe48d('0x15')]({'plain':!![]});if(_0x1bad95[_0xe48d('0x11')]){return _0x5e91d2[_0xe48d('0x16')][_0xe48d('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x1bad95['id']}})['then'](function(){_0x449b1d();})[_0xe48d('0x18')](function(_0x2d429c){_0x449b1d(_0x2d429c);});}else{_0x449b1d();}}},'charset':_0xe48d('0x19'),'collate':_0xe48d('0x1a')});}; \ No newline at end of file +var _0xfec4=['closed','closedAt','models','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x17992f,_0x522a86){var _0x4cf2e3=function(_0x90dff2){while(--_0x90dff2){_0x17992f['push'](_0x17992f['shift']());}};_0x4cf2e3(++_0x522a86);}(_0xfec4,0xdb));var _0x4fec=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0xfec4[_0xdeefbd];return _0x4ff63f;};'use strict';var _=require(_0x4fec('0x0'));var util=require(_0x4fec('0x1'));var logger=require(_0x4fec('0x2'))(_0x4fec('0x3'));var moment=require('moment');var BPromise=require(_0x4fec('0x4'));var rp=require(_0x4fec('0x5'));var fs=require('fs');var path=require(_0x4fec('0x6'));var rimraf=require(_0x4fec('0x7'));var config=require(_0x4fec('0x8'));var attributes=require(_0x4fec('0x9'));module[_0x4fec('0xa')]=function(_0x2b3b6f,_0x20696a){return _0x2b3b6f[_0x4fec('0xb')](_0x4fec('0xc'),attributes,{'tableName':_0x4fec('0xd'),'paranoid':![],'indexes':[{'name':_0x4fec('0xe'),'fields':[_0x4fec('0xf'),'to'],'type':_0x4fec('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x34ccc0,_0x4827a5,_0x22fdea){if(_0x34ccc0[_0x4fec('0x11')]){_0x34ccc0[_0x4fec('0x12')]=moment()[_0x4fec('0x13')](_0x4fec('0x14'));}if(_0x34ccc0[_0x4fec('0x15')]){_0x34ccc0[_0x4fec('0x16')]=moment()[_0x4fec('0x13')](_0x4fec('0x14'));}_0x22fdea(null,_0x4827a5);},'beforeUpdate':function(_0x4ccdca,_0x3341b8,_0x54db49){if(_0x4ccdca['changed']('substatus')){_0x4ccdca[_0x4fec('0x12')]=_0x4ccdca[_0x4fec('0x11')]?moment()[_0x4fec('0x13')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x4ccdca['changed'](_0x4fec('0x15'))){_0x4ccdca[_0x4fec('0x16')]=moment()[_0x4fec('0x13')](_0x4fec('0x14'));_0x4ccdca[_0x4fec('0x11')]=null;_0x4ccdca[_0x4fec('0x12')]=null;}_0x54db49(null,_0x4ccdca);},'afterUpdate':function(_0x10d6ed,_0x436484,_0x385aeb){var _0x586ad4=_0x2b3b6f[_0x4fec('0x17')];var _0x4aabb4=_0x10d6ed[_0x4fec('0x18')]({'plain':!![]});if(_0x4aabb4[_0x4fec('0x15')]){return _0x586ad4[_0x4fec('0x19')][_0x4fec('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x4aabb4['id']}})['then'](function(){_0x385aeb();})[_0x4fec('0x1b')](function(_0x3f8d73){_0x385aeb(_0x3f8d73);});}else{_0x385aeb();}}},'charset':_0x4fec('0x1c'),'collate':_0x4fec('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b05d49b..96a2351 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 _0x323f=['MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x323f,0x1ee));var _0xf323=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x323f[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});config[_0xf323('0xb')]=_[_0xf323('0xc')](config[_0xf323('0xb')],{'host':_0xf323('0xd'),'port':0x18eb});var socket=require(_0xf323('0xe'))(new Redis(config[_0xf323('0xb')]));require(_0xf323('0xf'))[_0xf323('0x10')](socket);function respondWithRpcPromise(_0x10d1ff,_0x21e82e,_0x22fd48){return new BPromise(function(_0x4196b5,_0x8825ef){return client[_0xf323('0x11')](_0x10d1ff,_0x22fd48)[_0xf323('0x12')](function(_0xb6ec37){logger[_0xf323('0x13')]('MailInteraction,\x20%s,\x20%s',_0x21e82e,_0xf323('0x14'));logger[_0xf323('0x15')](_0xf323('0x16'),_0x21e82e,'request\x20sent',JSON[_0xf323('0x17')](_0xb6ec37));if(_0xb6ec37[_0xf323('0x18')]){if(_0xb6ec37[_0xf323('0x18')][_0xf323('0x19')]===0x1f4){logger[_0xf323('0x18')](_0xf323('0x1a'),_0x21e82e,_0xb6ec37['error']['message']);return _0x8825ef(_0xb6ec37[_0xf323('0x18')][_0xf323('0x1b')]);}logger[_0xf323('0x18')](_0xf323('0x1a'),_0x21e82e,_0xb6ec37[_0xf323('0x18')]['message']);return _0x4196b5(_0xb6ec37[_0xf323('0x18')][_0xf323('0x1b')]);}else{logger[_0xf323('0x13')](_0xf323('0x1a'),_0x21e82e,'request\x20sent');_0x4196b5(_0xb6ec37[_0xf323('0x1c')][_0xf323('0x1b')]);}})[_0xf323('0x1d')](function(_0x41b2cb){logger['error'](_0xf323('0x1a'),_0x21e82e,_0x41b2cb);_0x8825ef(_0x41b2cb);});});}exports[_0xf323('0x1e')]=function(_0x5baab2){var _0x32d7b0=this;return new Promise(function(_0x44378e,_0x32a942){return db[_0xf323('0x1f')]['update'](_0x5baab2[_0xf323('0x20')],{'raw':_0x5baab2[_0xf323('0x21')]?_0x5baab2[_0xf323('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5baab2[_0xf323('0x21')]?_0x5baab2[_0xf323('0x21')][_0xf323('0x22')]||null:null,'attributes':_0x5baab2[_0xf323('0x21')]?_0x5baab2[_0xf323('0x21')][_0xf323('0x23')]||null:null,'limit':_0x5baab2[_0xf323('0x21')]?_0x5baab2[_0xf323('0x21')][_0xf323('0x24')]||null:null})['then'](function(_0xf85efe){logger[_0xf323('0x13')](_0xf323('0x1e'),_0x5baab2);logger[_0xf323('0x15')](_0xf323('0x1e'),_0x5baab2,JSON[_0xf323('0x17')](_0xf85efe));_0x44378e(_0xf85efe);})['catch'](function(_0x30ed93){logger['error'](_0xf323('0x1e'),_0x30ed93[_0xf323('0x1b')],_0x5baab2);_0x32a942(_0x32d7b0['error'](0x1f4,_0x30ed93[_0xf323('0x1b')]));});});};exports[_0xf323('0x25')]=function(_0x2b6254){return new Promise(function(_0x3dcf65,_0x46e3b1){return db['MailInteraction'][_0xf323('0x26')]({'where':_0x2b6254[_0xf323('0x21')]?_0x2b6254[_0xf323('0x21')][_0xf323('0x22')]||null:null})[_0xf323('0x12')](function(_0x36bd3f){if(_0x36bd3f){return _0x36bd3f[_0xf323('0x27')](_0x2b6254[_0xf323('0x20')][_0xf323('0x28')],_['omit'](_0x2b6254[_0xf323('0x20')],[_0xf323('0x28'),'id'])||{});}})[_0xf323('0x29')](function(_0x3d09d8){logger[_0xf323('0x13')]('AddTags',_0x2b6254);logger[_0xf323('0x15')](_0xf323('0x2a'),_0x2b6254,JSON[_0xf323('0x17')](_0x3d09d8));_0x3dcf65(_0x3d09d8);})[_0xf323('0x1d')](function(_0x3c849a){logger['error'](_0xf323('0x2a'),_0x3c849a[_0xf323('0x1b')],_0x2b6254);_0x46e3b1(_this[_0xf323('0x18')](0x1f4,_0x3c849a[_0xf323('0x1b')]));});});}; \ No newline at end of file +var _0xbaee=['omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','./mailInteraction.socket','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','attributes','limit','then','AddTagsToMailInteraction','find','where','addTags','ids'];(function(_0x1ddf1b,_0x2774a8){var _0x104c1f=function(_0xa7530){while(--_0xa7530){_0x1ddf1b['push'](_0x1ddf1b['shift']());}};_0x104c1f(++_0x2774a8);}(_0xbaee,0x186));var _0xebae=function(_0x3929a8,_0x3c35b3){_0x3929a8=_0x3929a8-0x0;var _0xcd7475=_0xbaee[_0x3929a8];return _0xcd7475;};'use strict';var _=require(_0xebae('0x0'));var util=require(_0xebae('0x1'));var moment=require(_0xebae('0x2'));var BPromise=require(_0xebae('0x3'));var rs=require(_0xebae('0x4'));var fs=require('fs');var Redis=require(_0xebae('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xebae('0x6'));var logger=require(_0xebae('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xebae('0x8'));var client=jayson['client'][_0xebae('0x9')]({'port':0x232a});config[_0xebae('0xa')]=_[_0xebae('0xb')](config['redis'],{'host':_0xebae('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xebae('0xd'))[_0xebae('0xe')](socket);function respondWithRpcPromise(_0x55bd84,_0x265ee4,_0x24a76a){return new BPromise(function(_0xc65748,_0x538bf0){return client[_0xebae('0xf')](_0x55bd84,_0x24a76a)['then'](function(_0x1d783b){logger['info'](_0xebae('0x10'),_0x265ee4,_0xebae('0x11'));logger[_0xebae('0x12')](_0xebae('0x13'),_0x265ee4,_0xebae('0x11'),JSON[_0xebae('0x14')](_0x1d783b));if(_0x1d783b[_0xebae('0x15')]){if(_0x1d783b[_0xebae('0x15')][_0xebae('0x16')]===0x1f4){logger['error'](_0xebae('0x10'),_0x265ee4,_0x1d783b['error'][_0xebae('0x17')]);return _0x538bf0(_0x1d783b['error']['message']);}logger[_0xebae('0x15')](_0xebae('0x10'),_0x265ee4,_0x1d783b['error']['message']);return _0xc65748(_0x1d783b[_0xebae('0x15')][_0xebae('0x17')]);}else{logger[_0xebae('0x18')](_0xebae('0x10'),_0x265ee4,_0xebae('0x11'));_0xc65748(_0x1d783b[_0xebae('0x19')][_0xebae('0x17')]);}})[_0xebae('0x1a')](function(_0x73cbb2){logger[_0xebae('0x15')](_0xebae('0x10'),_0x265ee4,_0x73cbb2);_0x538bf0(_0x73cbb2);});});}exports[_0xebae('0x1b')]=function(_0x27af4b){var _0x11afdb=this;return new Promise(function(_0x18db4c,_0x5a710c){return db[_0xebae('0x1c')][_0xebae('0x1d')](_0x27af4b[_0xebae('0x1e')],{'raw':_0x27af4b[_0xebae('0x1f')]?_0x27af4b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27af4b[_0xebae('0x1f')]?_0x27af4b[_0xebae('0x1f')]['where']||null:null,'attributes':_0x27af4b['options']?_0x27af4b[_0xebae('0x1f')][_0xebae('0x20')]||null:null,'limit':_0x27af4b['options']?_0x27af4b[_0xebae('0x1f')][_0xebae('0x21')]||null:null})[_0xebae('0x22')](function(_0x249def){logger[_0xebae('0x18')](_0xebae('0x1b'),_0x27af4b);logger[_0xebae('0x12')]('UpdateMailInteraction',_0x27af4b,JSON[_0xebae('0x14')](_0x249def));_0x18db4c(_0x249def);})[_0xebae('0x1a')](function(_0x3572fa){logger[_0xebae('0x15')](_0xebae('0x1b'),_0x3572fa[_0xebae('0x17')],_0x27af4b);_0x5a710c(_0x11afdb[_0xebae('0x15')](0x1f4,_0x3572fa[_0xebae('0x17')]));});});};exports[_0xebae('0x23')]=function(_0x57887c){return new Promise(function(_0x9d4fcc,_0x55b386){return db['MailInteraction'][_0xebae('0x24')]({'where':_0x57887c['options']?_0x57887c['options'][_0xebae('0x25')]||null:null})['then'](function(_0x469e18){if(_0x469e18){return _0x469e18[_0xebae('0x26')](_0x57887c['body'][_0xebae('0x27')],_[_0xebae('0x28')](_0x57887c[_0xebae('0x1e')],[_0xebae('0x27'),'id'])||{});}})[_0xebae('0x29')](function(_0x2fbf8b){logger[_0xebae('0x18')](_0xebae('0x2a'),_0x57887c);logger[_0xebae('0x12')](_0xebae('0x2a'),_0x57887c,JSON[_0xebae('0x14')](_0x2fbf8b));_0x9d4fcc(_0x2fbf8b);})[_0xebae('0x1a')](function(_0x4a75c8){logger[_0xebae('0x15')](_0xebae('0x2a'),_0x4a75c8['message'],_0x57887c);_0x55b386(_this[_0xebae('0x15')](0x1f4,_0x4a75c8[_0xebae('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c5e3525..e55e445 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 _0xbe2c=['register','length','mailInteraction:','./mailInteraction.events','remove','update','emit','removeListener'];(function(_0x551924,_0x3618ac){var _0xaf15be=function(_0x32ccba){while(--_0x32ccba){_0x551924['push'](_0x551924['shift']());}};_0xaf15be(++_0x3618ac);}(_0xbe2c,0xbb));var _0xcbe2=function(_0x2463d4,_0x122560){_0x2463d4=_0x2463d4-0x0;var _0x32c467=_0xbe2c[_0x2463d4];return _0x32c467;};'use strict';var MailInteractionEvents=require(_0xcbe2('0x0'));var events=['save',_0xcbe2('0x1'),_0xcbe2('0x2')];function createListener(_0x38af0b,_0x29c350){return function(_0x1df0c2){_0x29c350[_0xcbe2('0x3')](_0x38af0b,_0x1df0c2);};}function removeListener(_0x3df729,_0x105d44){return function(){MailInteractionEvents[_0xcbe2('0x4')](_0x3df729,_0x105d44);};}exports[_0xcbe2('0x5')]=function(_0x18c332){for(var _0x568ece=0x0,_0x5ad0fc=events[_0xcbe2('0x6')];_0x568ece<_0x5ad0fc;_0x568ece++){var _0x39db5e=events[_0x568ece];var _0x5275a9=createListener(_0xcbe2('0x7')+_0x39db5e,_0x18c332);MailInteractionEvents['on'](_0x39db5e,_0x5275a9);}}; \ No newline at end of file +var _0xee88=['register','./mailInteraction.events','remove','update','emit'];(function(_0x100e55,_0x53a8e1){var _0x18635a=function(_0x5b6ae1){while(--_0x5b6ae1){_0x100e55['push'](_0x100e55['shift']());}};_0x18635a(++_0x53a8e1);}(_0xee88,0xf1));var _0x8ee8=function(_0x23516b,_0x4f9de4){_0x23516b=_0x23516b-0x0;var _0x45d5fe=_0xee88[_0x23516b];return _0x45d5fe;};'use strict';var MailInteractionEvents=require(_0x8ee8('0x0'));var events=['save',_0x8ee8('0x1'),_0x8ee8('0x2')];function createListener(_0x3ce53a,_0x153fe8){return function(_0x5a63c5){_0x153fe8[_0x8ee8('0x3')](_0x3ce53a,_0x5a63c5);};}function removeListener(_0x25ba4c,_0x5c15bf){return function(){MailInteractionEvents['removeListener'](_0x25ba4c,_0x5c15bf);};}exports[_0x8ee8('0x4')]=function(_0x28e6f6){for(var _0x4c985a=0x0,_0x2f5efd=events['length'];_0x4c985a<_0x2f5efd;_0x4c985a++){var _0x425af7=events[_0x4c985a];var _0x4b12dd=createListener('mailInteraction:'+_0x425af7,_0x28e6f6);MailInteractionEvents['on'](_0x425af7,_0x4b12dd);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 42b081d..1019785 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89b2=['isAuthenticated','exports','express','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe'];(function(_0x3190bb,_0x3b7e15){var _0x470cde=function(_0x26e9e2){while(--_0x26e9e2){_0x3190bb['push'](_0x3190bb['shift']());}};_0x470cde(++_0x3b7e15);}(_0x89b2,0x1de));var _0x289b=function(_0x4639d2,_0x41bf0a){_0x4639d2=_0x4639d2-0x0;var _0x5c1f9d=_0x89b2[_0x4639d2];return _0x5c1f9d;};'use strict';var express=require(_0x289b('0x0'));var router=express['Router']();var auth=require(_0x289b('0x1'));var controller=require(_0x289b('0x2'));router[_0x289b('0x3')](_0x289b('0x4'),auth[_0x289b('0x5')](),controller['describe']);module[_0x289b('0x6')]=router; \ No newline at end of file +var _0xf2c5=['get','/describe','isAuthenticated','describe','exports','express','Router','../../components/auth/service'];(function(_0x2c5598,_0x2044bd){var _0xa50b6c=function(_0x544972){while(--_0x544972){_0x2c5598['push'](_0x2c5598['shift']());}};_0xa50b6c(++_0x2044bd);}(_0xf2c5,0x6d));var _0x5f2c=function(_0x6b07f,_0x11b5fc){_0x6b07f=_0x6b07f-0x0;var _0x1146e0=_0xf2c5[_0x6b07f];return _0x1146e0;};'use strict';var express=require(_0x5f2c('0x0'));var router=express[_0x5f2c('0x1')]();var auth=require(_0x5f2c('0x2'));var controller=require('./mailInteractionHasTag.controller');router[_0x5f2c('0x3')](_0x5f2c('0x4'),auth[_0x5f2c('0x5')](),controller[_0x5f2c('0x6')]);module[_0x5f2c('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index ba61ce6..a31d271 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x3c5d73,_0x27b1cd){var _0x308eb1=function(_0x1264ad){while(--_0x1264ad){_0x3c5d73['push'](_0x3c5d73['shift']());}};_0x308eb1(++_0x27b1cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x2065e8,_0x49c6c9){var _0x4318a5=function(_0x373edf){while(--_0x373edf){_0x2065e8['push'](_0x2065e8['shift']());}};_0x4318a5(++_0x49c6c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index e0a44ca..58e94ef 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc82d=['exports','INTEGER','sequelize'];(function(_0x13de53,_0x5cbc31){var _0x13c459=function(_0x2270ca){while(--_0x2270ca){_0x13de53['push'](_0x13de53['shift']());}};_0x13c459(++_0x5cbc31);}(_0xc82d,0x1df));var _0xdc82=function(_0x45937f,_0x256a25){_0x45937f=_0x45937f-0x0;var _0x5bf5d1=_0xc82d[_0x45937f];return _0x5bf5d1;};'use strict';var Sequelize=require(_0xdc82('0x0'));module[_0xdc82('0x1')]={'MailInteractionId':{'type':Sequelize[_0xdc82('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xdc82('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xf25c=['exports','INTEGER','sequelize'];(function(_0x482a96,_0x326a59){var _0x354b56=function(_0x5936a2){while(--_0x5936a2){_0x482a96['push'](_0x482a96['shift']());}};_0x354b56(++_0x326a59);}(_0xf25c,0x1f4));var _0xcf25=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0xf25c[_0x45f111];return _0x483508;};'use strict';var Sequelize=require(_0xcf25('0x0'));module[_0xcf25('0x1')]={'MailInteractionId':{'type':Sequelize[_0xcf25('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xcf25('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 2dfbe82..141c091 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc97=['MailInteractionHasTag','mail_interaction_has_tags','exports','define'];(function(_0x9e786d,_0x153247){var _0x3479ba=function(_0x4de0cc){while(--_0x4de0cc){_0x9e786d['push'](_0x9e786d['shift']());}};_0x3479ba(++_0x153247);}(_0xdc97,0x186));var _0x7dc9=function(_0x2edf60,_0x73c83f){_0x2edf60=_0x2edf60-0x0;var _0x57f87a=_0xdc97[_0x2edf60];return _0x57f87a;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x7dc9('0x0')]=function(_0x2a0d01){return _0x2a0d01[_0x7dc9('0x1')](_0x7dc9('0x2'),attributes,{'tableName':_0x7dc9('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf58b=['mail_interaction_has_tags','./mailInteractionHasTag','define','MailInteractionHasTag'];(function(_0x1b7900,_0x53b775){var _0x1a91c4=function(_0xa83743){while(--_0xa83743){_0x1b7900['push'](_0x1b7900['shift']());}};_0x1a91c4(++_0x53b775);}(_0xf58b,0x199));var _0xbf58=function(_0x2af009,_0x5432ee){_0x2af009=_0x2af009-0x0;var _0x46d15f=_0xf58b[_0x2af009];return _0x46d15f;};'use strict';var attributes=require(_0xbf58('0x0'));module['exports']=function(_0x3cfcef){return _0x3cfcef[_0xbf58('0x1')](_0xbf58('0x2'),attributes,{'tableName':_0xbf58('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 06eff77..4e5579c 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 _0x3dbb=['../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','show','/:id/download','download','tracked','mail','mailmessage:create','create','/:id','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x179a3c,_0x42e410){var _0x531f98=function(_0x558041){while(--_0x558041){_0x179a3c['push'](_0x179a3c['shift']());}};_0x531f98(++_0x42e410);}(_0x3dbb,0x67));var _0xb3db=function(_0x574159,_0x952110){_0x574159=_0x574159-0x0;var _0x5dd226=_0x3dbb[_0x574159];return _0x5dd226;};'use strict';var multer=require(_0xb3db('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb3db('0x1'));var express=require(_0xb3db('0x2'));var router=express['Router']();var fs_extra=require(_0xb3db('0x3'));var auth=require(_0xb3db('0x4'));var interaction=require(_0xb3db('0x5'));var config=require(_0xb3db('0x6'));var controller=require('./mailMessage.controller');router[_0xb3db('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb3db('0x7')](_0xb3db('0x8'),auth[_0xb3db('0x9')](),controller['describe']);router[_0xb3db('0x7')]('/:id',auth[_0xb3db('0x9')](),controller[_0xb3db('0xa')]);router['get'](_0xb3db('0xb'),auth[_0xb3db('0x9')](),controller[_0xb3db('0xc')]);router['post']('/',auth[_0xb3db('0x9')](),interaction[_0xb3db('0xd')](_0xb3db('0xe'),_0xb3db('0xf')),controller[_0xb3db('0x10')]);router['put'](_0xb3db('0x11'),auth['isAuthenticated'](),controller[_0xb3db('0x12')]);router[_0xb3db('0x13')](_0xb3db('0x14'),auth['isAuthenticated'](),controller[_0xb3db('0x15')]);router[_0xb3db('0x13')](_0xb3db('0x16'),auth['isAuthenticated'](),controller[_0xb3db('0x17')]);router[_0xb3db('0x18')]('/:id',auth[_0xb3db('0x9')](),controller[_0xb3db('0x19')]);module[_0xb3db('0x1a')]=router; \ No newline at end of file +var _0x2083=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','/:id/download','download','post','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0xdd6c6d,_0x4dc039){var _0x54c0eb=function(_0x57304b){while(--_0x57304b){_0xdd6c6d['push'](_0xdd6c6d['shift']());}};_0x54c0eb(++_0x4dc039);}(_0x2083,0x137));var _0x3208=function(_0x4f91d1,_0x1a2451){_0x4f91d1=_0x4f91d1-0x0;var _0x382379=_0x2083[_0x4f91d1];return _0x382379;};'use strict';var multer=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var path=require('path');var timeout=require(_0x3208('0x2'));var express=require(_0x3208('0x3'));var router=express[_0x3208('0x4')]();var fs_extra=require(_0x3208('0x5'));var auth=require(_0x3208('0x6'));var interaction=require(_0x3208('0x7'));var config=require(_0x3208('0x8'));var controller=require('./mailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3208('0x9')]);router[_0x3208('0xa')](_0x3208('0xb'),auth[_0x3208('0xc')](),controller['describe']);router[_0x3208('0xa')](_0x3208('0xd'),auth[_0x3208('0xc')](),controller['show']);router['get'](_0x3208('0xe'),auth[_0x3208('0xc')](),controller[_0x3208('0xf')]);router[_0x3208('0x10')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x3208('0x11'),_0x3208('0x12')),controller[_0x3208('0x13')]);router[_0x3208('0x14')](_0x3208('0xd'),auth[_0x3208('0xc')](),controller[_0x3208('0x15')]);router[_0x3208('0x14')](_0x3208('0x16'),auth[_0x3208('0xc')](),controller[_0x3208('0x17')]);router[_0x3208('0x14')](_0x3208('0x18'),auth[_0x3208('0xc')](),controller['reject']);router[_0x3208('0x19')](_0x3208('0xd'),auth[_0x3208('0xc')](),controller[_0x3208('0x1a')]);module[_0x3208('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c5e12aa..e039e6f 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 _0xa2d4=['medium','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email','Chat','lodash','TEXT','long'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa2d4,0x159));var _0x4a2d=function(_0x8db008,_0x4ad8bd){_0x8db008=_0x8db008-0x0;var _0x2e6dba=_0xa2d4[_0x8db008];return _0x2e6dba;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4a2d('0x0'));module['exports']={'body':{'type':Sequelize[_0x4a2d('0x1')](_0x4a2d('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4a2d('0x1')](_0x4a2d('0x3'))},'read':{'type':Sequelize[_0x4a2d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4a2d('0x5')]('in',_0x4a2d('0x6')),'defaultValue':_0x4a2d('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4a2d('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x4a2d('0x1')](_0x4a2d('0x2'))},'cc':{'type':Sequelize[_0x4a2d('0x1')](_0x4a2d('0x2'))},'bcc':{'type':Sequelize[_0x4a2d('0x1')](_0x4a2d('0x2'))},'subject':{'type':Sequelize[_0x4a2d('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x4a2d('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4a2d('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4a2d('0x9')]},'originTo':{'type':Sequelize[_0x4a2d('0x1')](_0x4a2d('0x2'))},'originCc':{'type':Sequelize['TEXT'](_0x4a2d('0x2'))},'originChannel':{'type':Sequelize['ENUM'](_0x4a2d('0xa'),_0x4a2d('0xb')),'defaultValue':_0x4a2d('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xa6fa=['TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','Chat','Email','exports'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0xa6fa,0x99));var _0xaa6f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa6fa[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xaa6f('0x0')]={'body':{'type':Sequelize[_0xaa6f('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xaa6f('0x1')](_0xaa6f('0x2'))},'read':{'type':Sequelize[_0xaa6f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa6f('0x4')]('in','out'),'defaultValue':_0xaa6f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaa6f('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0xaa6f('0x7'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0xaa6f('0x1')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xaa6f('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaa6f('0x8')]},'originTo':{'type':Sequelize[_0xaa6f('0x1')](_0xaa6f('0x7'))},'originCc':{'type':Sequelize[_0xaa6f('0x1')](_0xaa6f('0x7'))},'originChannel':{'type':Sequelize[_0xaa6f('0x4')]('Email',_0xaa6f('0x9')),'defaultValue':_0xaa6f('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 67db2de..30bba44 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 _0x2092=['send','index','map','MailMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','update','body','describe','create','direction','secret','split','findOne','List','CmContact','Contacts','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','acceptMessage','reject','mail','UserId','agent','get','MailInteractionId','user','role','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','fromString','EventManager','download','unix','join','files','tmp','server','message-%s.eml','from','bcc','subject','createdAt','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','push','type','readFileSync','build','writeFileSync','unlinkSync','eml-format','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','undefined','count','offset','limit','set','Content-Range','json','destroy','end','name'];(function(_0x57a4d0,_0xa6e6b){var _0xaaadee=function(_0x544da2){while(--_0x544da2){_0x57a4d0['push'](_0x57a4d0['shift']());}};_0xaaadee(++_0xa6e6b);}(_0x2092,0xf1));var _0x2209=function(_0x5e2b3a,_0xe8963f){_0x5e2b3a=_0x5e2b3a-0x0;var _0x3d5930=_0x2092[_0x5e2b3a];return _0x3d5930;};'use strict';var emlformat=require(_0x2209('0x0'));var moment=require('moment');var util=require(_0x2209('0x1'));var path=require(_0x2209('0x2'));var fs=require('fs');var _=require(_0x2209('0x3'));var Redis=require(_0x2209('0x4'));var htmlToText=require('html-to-text');var interactionService=require('../../components/interaction/service');var qs=require(_0x2209('0x5'));var logger=require('../../config/logger')(_0x2209('0x6'));var interaction_log=require(_0x2209('0x7'))(_0x2209('0x8'));var config=require(_0x2209('0x9'));var db=require(_0x2209('0xa'))['db'];config[_0x2209('0xb')]=_[_0x2209('0xc')](config[_0x2209('0xb')],{'host':_0x2209('0xd'),'port':0x18eb});var socket=require(_0x2209('0xe'))(new Redis(config[_0x2209('0xb')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x2209('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2209('0x10')]['http']({'port':0x232c});var client9003=jayson['client'][_0x2209('0x11')]({'port':0x232b});var client9002=jayson[_0x2209('0x10')][_0x2209('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x24ebe6,_0x35dd2f,_0x241058,_0x1aa5fc){return new Promise(function(_0xa44fde,_0x2a95d6){var _0x225428=_0x1aa5fc||client;return _0x225428['request'](_0x24ebe6,_0x241058)[_0x2209('0x12')](function(_0x4ac20e){logger[_0x2209('0x13')](_0x2209('0x14'),_0x35dd2f,_0x2209('0x15'));logger[_0x2209('0x16')](_0x2209('0x17'),_0x35dd2f,_0x2209('0x15'),JSON[_0x2209('0x18')](_0x4ac20e));if(_0x4ac20e[_0x2209('0x19')]){if(_0x4ac20e[_0x2209('0x19')]['code']===0x1f4){logger['error'](_0x2209('0x14'),_0x35dd2f,_0x4ac20e[_0x2209('0x19')]['message']);return _0x2a95d6(_0x4ac20e['error']['message']);}logger[_0x2209('0x19')](_0x2209('0x14'),_0x35dd2f,_0x4ac20e[_0x2209('0x19')]['message']);return _0xa44fde(_0x4ac20e[_0x2209('0x19')]['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x35dd2f,_0x2209('0x15'));_0xa44fde(_0x4ac20e['result'][_0x2209('0x1a')]);}})[_0x2209('0x1b')](function(_0xf02d2a){logger[_0x2209('0x19')](_0x2209('0x14'),_0x35dd2f,_0xf02d2a);_0x2a95d6(_0xf02d2a);});});}function respondWithResult(_0x385db0,_0x748d17){_0x748d17=_0x748d17||0xc8;return function(_0x246355){if(_0x246355){return _0x385db0[_0x2209('0x1c')](_0x748d17)['json'](_0x246355);}};}function respondWithFilteredResult(_0x3de985,_0x20654b){return function(_0x238dd7){if(_0x238dd7){var _0x56e831=typeof _0x20654b['offset']===_0x2209('0x1d')&&typeof _0x20654b['limit']==='undefined';var _0x311486=_0x238dd7[_0x2209('0x1e')];var _0x58555a=_0x56e831?0x0:_0x20654b[_0x2209('0x1f')];var _0x872ac9=_0x56e831?_0x238dd7['count']:_0x20654b['offset']+_0x20654b[_0x2209('0x20')];var _0x2821c9;if(_0x872ac9>=_0x311486){_0x872ac9=_0x311486;_0x2821c9=0xc8;}else{_0x2821c9=0xce;}_0x3de985[_0x2209('0x1c')](_0x2821c9);return _0x3de985[_0x2209('0x21')](_0x2209('0x22'),_0x58555a+'-'+_0x872ac9+'/'+_0x311486)[_0x2209('0x23')](_0x238dd7);}return null;};}function saveUpdates(_0x38b1fd){return function(_0xe407ce){if(_0xe407ce){return _0xe407ce['update'](_0x38b1fd)['then'](function(_0xd588f7){return _0xd588f7;});}return null;};}function removeEntity(_0x36a0d2){return function(_0x455274){if(_0x455274){return _0x455274[_0x2209('0x24')]()[_0x2209('0x12')](function(){_0x36a0d2[_0x2209('0x1c')](0xcc)[_0x2209('0x25')]();});}};}function handleEntityNotFound(_0x1570d7){return function(_0x40a7fc){if(!_0x40a7fc){_0x1570d7['sendStatus'](0x194);}return _0x40a7fc;};}function handleError(_0x1a7db1,_0x1e9bb4){_0x1e9bb4=_0x1e9bb4||0x1f4;return function(_0x455708){logger[_0x2209('0x19')](_0x455708['stack']);if(_0x455708[_0x2209('0x26')]){delete _0x455708['name'];}_0x1a7db1[_0x2209('0x1c')](_0x1e9bb4)[_0x2209('0x27')](_0x455708);};}exports[_0x2209('0x28')]=function(_0x373d67,_0x8b2473){var _0x30e716={},_0x841e05={},_0x2b4220={'count':0x0,'rows':[]};var _0x3e34d4=_[_0x2209('0x29')](db[_0x2209('0x2a')][_0x2209('0x2b')],function(_0x3997b3){return{'name':_0x3997b3[_0x2209('0x2c')],'type':_0x3997b3['type'][_0x2209('0x2d')]};});_0x841e05[_0x2209('0x2e')]=_[_0x2209('0x29')](_0x3e34d4,'name');_0x841e05['query']=_[_0x2209('0x2f')](_0x373d67[_0x2209('0x30')]);_0x841e05[_0x2209('0x31')]=_[_0x2209('0x32')](_0x841e05[_0x2209('0x2e')],_0x841e05[_0x2209('0x30')]);_0x30e716[_0x2209('0x33')]=_['intersection'](_0x841e05[_0x2209('0x2e')],qs['fields'](_0x373d67[_0x2209('0x30')][_0x2209('0x34')]));_0x30e716[_0x2209('0x33')]=_0x30e716['attributes'][_0x2209('0x35')]?_0x30e716[_0x2209('0x33')]:_0x841e05[_0x2209('0x2e')];if(!_0x373d67[_0x2209('0x30')]['hasOwnProperty'](_0x2209('0x36'))){_0x30e716[_0x2209('0x20')]=qs[_0x2209('0x20')](_0x373d67[_0x2209('0x30')][_0x2209('0x20')]);_0x30e716[_0x2209('0x1f')]=qs['offset'](_0x373d67['query'][_0x2209('0x1f')]);}_0x30e716[_0x2209('0x37')]=qs['sort'](_0x373d67[_0x2209('0x30')][_0x2209('0x38')]);_0x30e716['where']=qs[_0x2209('0x31')](_[_0x2209('0x39')](_0x373d67['query'],_0x841e05[_0x2209('0x31')]),_0x3e34d4);if(_0x373d67['query'][_0x2209('0x3a')]){_0x30e716[_0x2209('0x3b')]=_[_0x2209('0x3c')](_0x30e716['where'],{'$or':_['map'](_0x3e34d4,function(_0x56e21b){if(_0x56e21b['type']!==_0x2209('0x3d')){var _0xc74a28={};_0xc74a28[_0x56e21b[_0x2209('0x26')]]={'$like':'%'+_0x373d67[_0x2209('0x30')][_0x2209('0x3a')]+'%'};return _0xc74a28;}})});}_0x30e716=_['merge']({},_0x30e716,_0x373d67[_0x2209('0x3e')]);var _0x1b3d3f={'where':_0x30e716['where']};return db['MailMessage'][_0x2209('0x1e')](_0x1b3d3f)[_0x2209('0x12')](function(_0x2b028f){_0x2b4220[_0x2209('0x1e')]=_0x2b028f;if(_0x373d67[_0x2209('0x30')][_0x2209('0x3f')]){_0x30e716['include']=[{'all':!![]}];}return db['MailMessage'][_0x2209('0x40')](_0x30e716);})[_0x2209('0x12')](function(_0x1e7266){_0x2b4220[_0x2209('0x41')]=_0x1e7266;return _0x2b4220;})[_0x2209('0x12')](respondWithFilteredResult(_0x8b2473,_0x30e716))['catch'](handleError(_0x8b2473,null));};exports[_0x2209('0x42')]=function(_0x29f924,_0x1f4cef){var _0x516a42={'raw':!![],'where':{'id':_0x29f924[_0x2209('0x43')]['id']}},_0x4799b2={};_0x4799b2[_0x2209('0x2e')]=_['keys'](db[_0x2209('0x2a')]['rawAttributes']);_0x4799b2['query']=_['keys'](_0x29f924[_0x2209('0x30')]);_0x4799b2['filters']=_[_0x2209('0x32')](_0x4799b2[_0x2209('0x2e')],_0x4799b2[_0x2209('0x30')]);_0x516a42['attributes']=_['intersection'](_0x4799b2['model'],qs[_0x2209('0x34')](_0x29f924['query'][_0x2209('0x34')]));_0x516a42[_0x2209('0x33')]=_0x516a42[_0x2209('0x33')][_0x2209('0x35')]?_0x516a42[_0x2209('0x33')]:_0x4799b2[_0x2209('0x2e')];if(_0x29f924[_0x2209('0x30')][_0x2209('0x3f')]){_0x516a42['include']=[{'all':!![]}];}_0x516a42=_[_0x2209('0x3c')]({},_0x516a42,_0x29f924['options']);return db['MailMessage'][_0x2209('0x44')](_0x516a42)[_0x2209('0x12')](handleEntityNotFound(_0x1f4cef,null))[_0x2209('0x12')](respondWithResult(_0x1f4cef,null))[_0x2209('0x1b')](handleError(_0x1f4cef,null));};exports[_0x2209('0x45')]=function(_0x33e687,_0x5d087b){if(_0x33e687[_0x2209('0x46')]['id']){delete _0x33e687[_0x2209('0x46')]['id'];}return db[_0x2209('0x2a')]['find']({'where':{'id':_0x33e687['params']['id']}})[_0x2209('0x12')](handleEntityNotFound(_0x5d087b,null))[_0x2209('0x12')](saveUpdates(_0x33e687[_0x2209('0x46')],null))[_0x2209('0x12')](respondWithResult(_0x5d087b,null))[_0x2209('0x1b')](handleError(_0x5d087b,null));};exports[_0x2209('0x24')]=function(_0x54b726,_0x7e4ad8){return db[_0x2209('0x2a')][_0x2209('0x44')]({'where':{'id':_0x54b726[_0x2209('0x43')]['id']}})['then'](handleEntityNotFound(_0x7e4ad8,null))[_0x2209('0x12')](removeEntity(_0x7e4ad8,null))['catch'](handleError(_0x7e4ad8,null));};exports[_0x2209('0x47')]=function(_0x2cf8bf,_0x3a3f1c){return db[_0x2209('0x2a')][_0x2209('0x47')]()[_0x2209('0x12')](respondWithResult(_0x3a3f1c,null))[_0x2209('0x1b')](handleError(_0x3a3f1c,null));};exports['create']=function(_0x4bf4c0,_0x2207a9){return db[_0x2209('0x2a')][_0x2209('0x48')](_0x4bf4c0[_0x2209('0x46')])[_0x2209('0x12')](function(_0x1b3ae8){if(_0x1b3ae8){if(_0x1b3ae8[_0x2209('0x49')]==='out'&&!_0x1b3ae8[_0x2209('0x4a')]){var _0x1bb5eb,_0x18db56,_0x20e57d;if(_0x4bf4c0['body']['to']){_0x18db56=_0x4bf4c0['body']['to'][_0x2209('0x4b')](',')[0x0];}return db['MailAccount'][_0x2209('0x4c')]({'where':{'id':_0x1b3ae8['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x2209('0x4d'),'include':[{'model':db[_0x2209('0x4e')],'as':_0x2209('0x4f'),'where':{'email':_0x18db56},'limit':0x1,'order':[['updatedAt',_0x2209('0x50')]]}]},{'model':db['MailServerOut'],'as':_0x2209('0x51'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2209('0x52'),'raw':!![]}]}]})[_0x2209('0x12')](function(_0x556c03){_0x1bb5eb=_0x556c03;if(!_0x1bb5eb||!_0x1bb5eb['Smtp'])return;var _0x5ea791=_0x1bb5eb[_0x2209('0x53')]();if(_0x4bf4c0[_0x2209('0x46')][_0x2209('0x54')]&&_0x4bf4c0[_0x2209('0x46')][_0x2209('0x54')][_0x2209('0x35')]){for(var _0x25bdb5=0x0;_0x25bdb5<_0x4bf4c0['body'][_0x2209('0x54')][_0x2209('0x35')];_0x25bdb5+=0x1){_0x4bf4c0['body'][_0x2209('0x54')][_0x25bdb5]={'filename':_0x4bf4c0[_0x2209('0x46')]['attachments'][_0x25bdb5]['name'],'path':path['join'](config['root'],_0x2209('0x55'),_0x4bf4c0[_0x2209('0x46')][_0x2209('0x54')][_0x25bdb5][_0x2209('0x56')])};}}_0x20e57d={'account':_0x5ea791,'message':_0x4bf4c0[_0x2209('0x46')]};return;})['then'](function(){if(_0x1bb5eb[_0x2209('0x4d')]){if(_0x1bb5eb[_0x2209('0x4d')]['Contacts'][_0x2209('0x35')]){return _0x1bb5eb[_0x2209('0x4d')]['Contacts'][0x0];}else{return db[_0x2209('0x4e')][_0x2209('0x48')](_['defaults'](_0x4bf4c0[_0x2209('0x46')],{'firstName':_0x4bf4c0[_0x2209('0x46')]['to'],'email':_0x4bf4c0[_0x2209('0x46')]['to'],'phone':_0x4bf4c0[_0x2209('0x46')]['to'],'ListId':_0x1bb5eb[_0x2209('0x57')]}));}}else{throw new Error(_0x2209('0x58'));}})[_0x2209('0x12')](function(){if(_0x20e57d){return respondWithRpcPromise(_0x2209('0x59'),'sendMail',_0x20e57d,client9003)[_0x2209('0x12')](function(_0x22e5ef){return _0x1b3ae8[_0x2209('0x45')]({'read':!![],'messageId':_0x22e5ef['messageId'],'sentAt':moment()[_0x2209('0x5a')](_0x2209('0x5b'))});})[_0x2209('0x1b')](function(_0xaf586a){logger[_0x2209('0x19')]('%s',JSON['stringify'](_0xaf586a));return _0x1b3ae8;});}return _0x1b3ae8;});}return _0x1b3ae8;}})['then'](respondWithResult(_0x2207a9,0xc9))[_0x2209('0x1b')](handleError(_0x2207a9,null));};exports['accept']=function(_0x3d43af,_0x6d356a){var _0x4f4a43='mail';return interactionService[_0x2209('0x5c')](_0x3d43af,_0x4f4a43)['then'](respondWithResult(_0x6d356a,null))['catch'](handleError(_0x6d356a,null));};exports[_0x2209('0x5d')]=function(_0x377a2a,_0x563417){var _0x3e77d4={'agent':{},'channel':_0x2209('0x5e')};if(_0x377a2a[_0x2209('0x46')]['id']){delete _0x377a2a[_0x2209('0x46')]['id'];}_0x377a2a[_0x2209('0x46')][_0x2209('0x5f')]=_0x377a2a['body']['UserId']||_0x377a2a['user']['id'];_0x3e77d4[_0x2209('0x60')]['id']=_0x377a2a['body'][_0x2209('0x5f')];return db[_0x2209('0x2a')]['find']({'where':{'id':_0x377a2a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x563417,null))['then'](function(_0x1fb53e){if(_0x1fb53e){_0x3e77d4['message']=_0x1fb53e[_0x2209('0x61')]({'plain':!![]});return db['MailInteraction'][_0x2209('0x44')]({'where':{'id':_0x1fb53e[_0x2209('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x563417,null))[_0x2209('0x12')](function(_0x1305e6){if(_0x1305e6){_0x3e77d4['interaction']=_0x1305e6[_0x2209('0x61')]({'plain':!![]});interaction_log[_0x2209('0x13')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x377a2a['user']['id'],_0x377a2a[_0x2209('0x63')]['name'],_0x377a2a[_0x2209('0x63')][_0x2209('0x64')],_0x3e77d4[_0x2209('0x65')]['id'],_0x377a2a['body']?JSON[_0x2209('0x18')](_0x377a2a[_0x2209('0x46')]):_0x2209('0x66'));return respondWithRpcPromise(_0x2209('0x67'),_0x2209('0x68'),_0x3e77d4);}return null;})[_0x2209('0x12')](function(_0x1e9106){var _0x384f1f=_0x2209('0x69')+_0x1e9106[_0x2209('0x1a')][_0x2209('0x6a')];return db['sequelize']['query'](_0x384f1f,{'type':db['Sequelize'][_0x2209('0x6b')][_0x2209('0x6c')],'raw':!![]})[_0x2209('0x12')](function(_0x145a5f){return _0x145a5f;});})[_0x2209('0x12')](function(_0x341b55){if(_0x341b55){_0x3e77d4['message'][_0x2209('0x6d')]=_0x341b55[0x0];if(!_0x377a2a[_0x2209('0x46')][_0x2209('0x5f')])return;return db[_0x2209('0x6e')][_0x2209('0x44')]({'where':{'id':_0x377a2a[_0x2209('0x46')][_0x2209('0x5f')],'role':'agent'},'attributes':['id','name',_0x2209('0x6f'),_0x2209('0x70'),_0x2209('0x71')],'raw':!![]});}return null;})[_0x2209('0x12')](function(_0x3eb271){if(!_0x3eb271)return null;_0x3e77d4[_0x2209('0x1a')][_0x2209('0x60')]=_0x3eb271;return _0x3e77d4;})['then'](function(_0x1097d0){if(_0x1097d0){_0x1097d0[_0x2209('0x1a')]['interface']=util['format'](_0x2209('0x72'),_0x377a2a[_0x2209('0x63')][_0x2209('0x26')]);_0x1097d0[_0x2209('0x1a')]['channel']=_0x3e77d4[_0x2209('0x73')];_0x1097d0['message']['motionChannel']=_0x3e77d4[_0x2209('0x73')];_0x1097d0['message']['event']=_0x2209('0x5d');_0x1097d0[_0x2209('0x1a')][_0x2209('0x46')]=htmlToText[_0x2209('0x74')](_0x3e77d4[_0x2209('0x1a')][_0x2209('0x46')]);respondWithRpcPromise(_0x2209('0x75'),_0x2209('0x75'),{'event':'rejectmessage','message':_0x1097d0[_0x2209('0x1a')]},client9002);return _0x3e77d4;}return null;})['then'](respondWithResult(_0x563417,null))['catch'](handleError(_0x563417,null));};exports[_0x2209('0x76')]=function(_0x49b801,_0x1db0a9){var _0x212fbd=moment()[_0x2209('0x77')]()['toString']();var _0x44abef=path[_0x2209('0x78')](config['root'],'server',_0x2209('0x79'),_0x2209('0x7a'));var _0x265894=path[_0x2209('0x78')](config['root'],_0x2209('0x7b'),'files',_0x2209('0x54'));var _0x270ed5=util['format'](_0x2209('0x7c'),_0x212fbd);return db[_0x2209('0x2a')][_0x2209('0x44')]({'where':{'id':_0x49b801[_0x2209('0x43')]['id']},'attributes':['id','body',_0x2209('0x7d'),'to','cc',_0x2209('0x7e'),_0x2209('0x7f'),_0x2209('0x80')],'include':_0x49b801[_0x2209('0x30')][_0x2209('0x54')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x2209('0x12')](handleEntityNotFound(_0x1db0a9,null))['then'](function(_0x162a49){if(_0x162a49){var _0x1d467e=_0x162a49;var _0x3c6a23={'from':_0x1d467e[_0x2209('0x7d')],'to':_0x1d467e['to'],'subject':_0x1d467e[_0x2209('0x7f')],'html':htmlEntities[_0x2209('0x81')](_0x1d467e[_0x2209('0x46')]),'headers':{'Date':moment(_0x1d467e[_0x2209('0x80')])[_0x2209('0x5a')](_0x2209('0x82'))},'attachments':[]};if(_0x162a49['cc']){_0x3c6a23[_0x2209('0x83')]['Cc']=_0x162a49['cc'];}if(_0x162a49['bcc']){_0x3c6a23[_0x2209('0x83')][_0x2209('0x84')]=_0x162a49[_0x2209('0x7e')];}return new Promise(function(_0x216357,_0x1f5bcf){if(_0x162a49[_0x2209('0x85')]){for(var _0x2aecdf=0x0;_0x2aecdf<_0x162a49[_0x2209('0x85')][_0x2209('0x35')];_0x2aecdf++){var _0x312338=_0x162a49[_0x2209('0x85')][_0x2aecdf];var _0x4eeae8=path[_0x2209('0x78')](_0x265894,_0x312338['basename']);if(fs['existsSync'](_0x4eeae8)){_0x3c6a23[_0x2209('0x54')][_0x2209('0x86')]({'name':_0x312338[_0x2209('0x26')],'contentType':_0x312338[_0x2209('0x87')],'data':fs[_0x2209('0x88')](_0x4eeae8)});}}}emlformat[_0x2209('0x89')](_0x3c6a23,function(_0xca63ec,_0x5413e9){if(_0xca63ec)return _0x1f5bcf(_0xca63ec);fs[_0x2209('0x8a')](path[_0x2209('0x78')](_0x44abef,_0x270ed5),_0x5413e9);return _0x216357(_0x5413e9);});});}})[_0x2209('0x12')](function(_0xbd54a){if(_0xbd54a){return _0x1db0a9['download'](path[_0x2209('0x78')](_0x44abef,_0x270ed5),_0x270ed5,function(_0x3d805c){if(!_0x3d805c)fs[_0x2209('0x8b')](path[_0x2209('0x78')](_0x44abef,_0x270ed5));});}})[_0x2209('0x1b')](handleError(_0x1db0a9,null));}; \ No newline at end of file +var _0x02eb=['end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','filters','where','merge','VIRTUAL','include','findAll','rows','show','params','length','includeAll','options','body','find','describe','create','out','secret','MailAccount','findOne','CmList','CmContact','Contacts','updatedAt','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','sendMail','messageId','format','stringify','mail','acceptMessage','UserId','user','agent','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','ContactId','sequelize','SELECT','fullname','email','interface','SIP/%s','channel','motionChannel','event','reject','fromString','EventManager','rejectmessage','toString','server','tmp','files','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','download','unlinkSync','eml-format','util','path','lodash','html-to-text','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','json','offset','undefined','count','limit','status','set','Content-Range','update'];(function(_0x5293f6,_0x5d56c8){var _0x508c3a=function(_0x19cb1b){while(--_0x19cb1b){_0x5293f6['push'](_0x5293f6['shift']());}};_0x508c3a(++_0x5d56c8);}(_0x02eb,0x185));var _0xb02e=function(_0x5b4d76,_0x2bcc1e){_0x5b4d76=_0x5b4d76-0x0;var _0x1e222f=_0x02eb[_0x5b4d76];return _0x1e222f;};'use strict';var emlformat=require(_0xb02e('0x0'));var moment=require('moment');var util=require(_0xb02e('0x1'));var path=require(_0xb02e('0x2'));var fs=require('fs');var _=require(_0xb02e('0x3'));var Redis=require('ioredis');var htmlToText=require(_0xb02e('0x4'));var interactionService=require(_0xb02e('0x5'));var qs=require(_0xb02e('0x6'));var logger=require(_0xb02e('0x7'))(_0xb02e('0x8'));var interaction_log=require(_0xb02e('0x7'))(_0xb02e('0x9'));var config=require(_0xb02e('0xa'));var db=require(_0xb02e('0xb'))['db'];config['redis']=_[_0xb02e('0xc')](config[_0xb02e('0xd')],{'host':_0xb02e('0xe'),'port':0x18eb});var socket=require(_0xb02e('0xf'))(new Redis(config[_0xb02e('0xd')]));var htmlEntities=require(_0xb02e('0x10'));require(_0xb02e('0x11'))[_0xb02e('0x12')](socket);var jayson=require(_0xb02e('0x13'));var client=jayson[_0xb02e('0x14')][_0xb02e('0x15')]({'port':0x232c});var client9003=jayson[_0xb02e('0x14')][_0xb02e('0x15')]({'port':0x232b});var client9002=jayson[_0xb02e('0x14')][_0xb02e('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x528144,_0x36f3e8,_0x64eed2,_0xd317a4){return new Promise(function(_0x3b3ebf,_0x25abad){var _0x223191=_0xd317a4||client;return _0x223191['request'](_0x528144,_0x64eed2)[_0xb02e('0x16')](function(_0x67e24d){logger[_0xb02e('0x17')](_0xb02e('0x18'),_0x36f3e8,'request\x20sent');logger['debug'](_0xb02e('0x19'),_0x36f3e8,_0xb02e('0x1a'),JSON['stringify'](_0x67e24d));if(_0x67e24d[_0xb02e('0x1b')]){if(_0x67e24d[_0xb02e('0x1b')][_0xb02e('0x1c')]===0x1f4){logger[_0xb02e('0x1b')](_0xb02e('0x18'),_0x36f3e8,_0x67e24d['error'][_0xb02e('0x1d')]);return _0x25abad(_0x67e24d['error'][_0xb02e('0x1d')]);}logger['error'](_0xb02e('0x18'),_0x36f3e8,_0x67e24d[_0xb02e('0x1b')][_0xb02e('0x1d')]);return _0x3b3ebf(_0x67e24d['error'][_0xb02e('0x1d')]);}else{logger[_0xb02e('0x17')]('MailMessage,\x20%s,\x20%s',_0x36f3e8,_0xb02e('0x1a'));_0x3b3ebf(_0x67e24d['result']['message']);}})[_0xb02e('0x1e')](function(_0x28a7aa){logger[_0xb02e('0x1b')](_0xb02e('0x18'),_0x36f3e8,_0x28a7aa);_0x25abad(_0x28a7aa);});});}function respondWithResult(_0xc5d4c9,_0x3dc730){_0x3dc730=_0x3dc730||0xc8;return function(_0x24c73e){if(_0x24c73e){return _0xc5d4c9['status'](_0x3dc730)[_0xb02e('0x1f')](_0x24c73e);}};}function respondWithFilteredResult(_0x2a2ef1,_0x18401a){return function(_0xe02405){if(_0xe02405){var _0x14e3ea=typeof _0x18401a[_0xb02e('0x20')]===_0xb02e('0x21')&&typeof _0x18401a['limit']===_0xb02e('0x21');var _0x5cbaf9=_0xe02405[_0xb02e('0x22')];var _0x35b847=_0x14e3ea?0x0:_0x18401a[_0xb02e('0x20')];var _0x99efe9=_0x14e3ea?_0xe02405['count']:_0x18401a[_0xb02e('0x20')]+_0x18401a[_0xb02e('0x23')];var _0x3f3e33;if(_0x99efe9>=_0x5cbaf9){_0x99efe9=_0x5cbaf9;_0x3f3e33=0xc8;}else{_0x3f3e33=0xce;}_0x2a2ef1[_0xb02e('0x24')](_0x3f3e33);return _0x2a2ef1[_0xb02e('0x25')](_0xb02e('0x26'),_0x35b847+'-'+_0x99efe9+'/'+_0x5cbaf9)[_0xb02e('0x1f')](_0xe02405);}return null;};}function saveUpdates(_0x297564){return function(_0x380b34){if(_0x380b34){return _0x380b34[_0xb02e('0x27')](_0x297564)[_0xb02e('0x16')](function(_0x194fc5){return _0x194fc5;});}return null;};}function removeEntity(_0x409ef3){return function(_0x57a903){if(_0x57a903){return _0x57a903['destroy']()['then'](function(){_0x409ef3[_0xb02e('0x24')](0xcc)[_0xb02e('0x28')]();});}};}function handleEntityNotFound(_0x3b5619){return function(_0x2bfd30){if(!_0x2bfd30){_0x3b5619[_0xb02e('0x29')](0x194);}return _0x2bfd30;};}function handleError(_0x38581a,_0x1f69da){_0x1f69da=_0x1f69da||0x1f4;return function(_0x4e239d){logger[_0xb02e('0x1b')](_0x4e239d[_0xb02e('0x2a')]);if(_0x4e239d[_0xb02e('0x2b')]){delete _0x4e239d[_0xb02e('0x2b')];}_0x38581a[_0xb02e('0x24')](_0x1f69da)[_0xb02e('0x2c')](_0x4e239d);};}exports['index']=function(_0x2635d7,_0x1b2b4b){var _0x438e2f={},_0x3e2e1a={},_0x2afcca={'count':0x0,'rows':[]};var _0x484b3e=_[_0xb02e('0x2d')](db[_0xb02e('0x2e')][_0xb02e('0x2f')],function(_0x50af77){return{'name':_0x50af77[_0xb02e('0x30')],'type':_0x50af77[_0xb02e('0x31')]['key']};});_0x3e2e1a['model']=_[_0xb02e('0x2d')](_0x484b3e,_0xb02e('0x2b'));_0x3e2e1a[_0xb02e('0x32')]=_[_0xb02e('0x33')](_0x2635d7[_0xb02e('0x32')]);_0x3e2e1a['filters']=_[_0xb02e('0x34')](_0x3e2e1a[_0xb02e('0x35')],_0x3e2e1a[_0xb02e('0x32')]);_0x438e2f[_0xb02e('0x36')]=_[_0xb02e('0x34')](_0x3e2e1a[_0xb02e('0x35')],qs[_0xb02e('0x37')](_0x2635d7[_0xb02e('0x32')][_0xb02e('0x37')]));_0x438e2f[_0xb02e('0x36')]=_0x438e2f[_0xb02e('0x36')]['length']?_0x438e2f[_0xb02e('0x36')]:_0x3e2e1a[_0xb02e('0x35')];if(!_0x2635d7[_0xb02e('0x32')][_0xb02e('0x38')]('nolimit')){_0x438e2f[_0xb02e('0x23')]=qs[_0xb02e('0x23')](_0x2635d7[_0xb02e('0x32')]['limit']);_0x438e2f[_0xb02e('0x20')]=qs[_0xb02e('0x20')](_0x2635d7['query'][_0xb02e('0x20')]);}_0x438e2f['order']=qs[_0xb02e('0x39')](_0x2635d7[_0xb02e('0x32')][_0xb02e('0x39')]);_0x438e2f['where']=qs[_0xb02e('0x3a')](_['pick'](_0x2635d7[_0xb02e('0x32')],_0x3e2e1a[_0xb02e('0x3a')]),_0x484b3e);if(_0x2635d7[_0xb02e('0x32')]['filter']){_0x438e2f[_0xb02e('0x3b')]=_[_0xb02e('0x3c')](_0x438e2f[_0xb02e('0x3b')],{'$or':_[_0xb02e('0x2d')](_0x484b3e,function(_0x3e43e4){if(_0x3e43e4['type']!==_0xb02e('0x3d')){var _0x3431ad={};_0x3431ad[_0x3e43e4[_0xb02e('0x2b')]]={'$like':'%'+_0x2635d7[_0xb02e('0x32')]['filter']+'%'};return _0x3431ad;}})});}_0x438e2f=_['merge']({},_0x438e2f,_0x2635d7['options']);var _0x34a721={'where':_0x438e2f['where']};return db[_0xb02e('0x2e')][_0xb02e('0x22')](_0x34a721)[_0xb02e('0x16')](function(_0x5b1c3c){_0x2afcca[_0xb02e('0x22')]=_0x5b1c3c;if(_0x2635d7['query']['includeAll']){_0x438e2f[_0xb02e('0x3e')]=[{'all':!![]}];}return db[_0xb02e('0x2e')][_0xb02e('0x3f')](_0x438e2f);})[_0xb02e('0x16')](function(_0x74224){_0x2afcca[_0xb02e('0x40')]=_0x74224;return _0x2afcca;})[_0xb02e('0x16')](respondWithFilteredResult(_0x1b2b4b,_0x438e2f))[_0xb02e('0x1e')](handleError(_0x1b2b4b,null));};exports[_0xb02e('0x41')]=function(_0x4f0041,_0x4922ad){var _0x3a126={'raw':!![],'where':{'id':_0x4f0041[_0xb02e('0x42')]['id']}},_0x58e53a={};_0x58e53a[_0xb02e('0x35')]=_['keys'](db['MailMessage'][_0xb02e('0x2f')]);_0x58e53a[_0xb02e('0x32')]=_[_0xb02e('0x33')](_0x4f0041[_0xb02e('0x32')]);_0x58e53a['filters']=_[_0xb02e('0x34')](_0x58e53a[_0xb02e('0x35')],_0x58e53a[_0xb02e('0x32')]);_0x3a126[_0xb02e('0x36')]=_[_0xb02e('0x34')](_0x58e53a[_0xb02e('0x35')],qs[_0xb02e('0x37')](_0x4f0041[_0xb02e('0x32')][_0xb02e('0x37')]));_0x3a126[_0xb02e('0x36')]=_0x3a126[_0xb02e('0x36')][_0xb02e('0x43')]?_0x3a126[_0xb02e('0x36')]:_0x58e53a[_0xb02e('0x35')];if(_0x4f0041[_0xb02e('0x32')][_0xb02e('0x44')]){_0x3a126[_0xb02e('0x3e')]=[{'all':!![]}];}_0x3a126=_[_0xb02e('0x3c')]({},_0x3a126,_0x4f0041[_0xb02e('0x45')]);return db[_0xb02e('0x2e')]['find'](_0x3a126)[_0xb02e('0x16')](handleEntityNotFound(_0x4922ad,null))[_0xb02e('0x16')](respondWithResult(_0x4922ad,null))[_0xb02e('0x1e')](handleError(_0x4922ad,null));};exports[_0xb02e('0x27')]=function(_0x559fae,_0x19bbcb){if(_0x559fae[_0xb02e('0x46')]['id']){delete _0x559fae[_0xb02e('0x46')]['id'];}return db['MailMessage'][_0xb02e('0x47')]({'where':{'id':_0x559fae[_0xb02e('0x42')]['id']}})[_0xb02e('0x16')](handleEntityNotFound(_0x19bbcb,null))['then'](saveUpdates(_0x559fae[_0xb02e('0x46')],null))[_0xb02e('0x16')](respondWithResult(_0x19bbcb,null))['catch'](handleError(_0x19bbcb,null));};exports['destroy']=function(_0x4f10d7,_0x382d16){return db[_0xb02e('0x2e')]['find']({'where':{'id':_0x4f10d7['params']['id']}})[_0xb02e('0x16')](handleEntityNotFound(_0x382d16,null))[_0xb02e('0x16')](removeEntity(_0x382d16,null))[_0xb02e('0x1e')](handleError(_0x382d16,null));};exports[_0xb02e('0x48')]=function(_0x6cf073,_0x134a39){return db['MailMessage'][_0xb02e('0x48')]()['then'](respondWithResult(_0x134a39,null))[_0xb02e('0x1e')](handleError(_0x134a39,null));};exports[_0xb02e('0x49')]=function(_0x88d579,_0x3f49e5){return db['MailMessage']['create'](_0x88d579[_0xb02e('0x46')])[_0xb02e('0x16')](function(_0x57089a){if(_0x57089a){if(_0x57089a['direction']===_0xb02e('0x4a')&&!_0x57089a[_0xb02e('0x4b')]){var _0x24f251,_0x184696,_0x13f9ab;if(_0x88d579[_0xb02e('0x46')]['to']){_0x184696=_0x88d579[_0xb02e('0x46')]['to']['split'](',')[0x0];}return db[_0xb02e('0x4c')][_0xb02e('0x4d')]({'where':{'id':_0x57089a['MailAccountId']},'include':[{'model':db[_0xb02e('0x4e')],'as':'List','include':[{'model':db[_0xb02e('0x4f')],'as':_0xb02e('0x50'),'where':{'email':_0x184696},'limit':0x1,'order':[[_0xb02e('0x51'),_0xb02e('0x52')]]}]},{'model':db['MailServerOut'],'as':_0xb02e('0x53'),'raw':!![],'include':[{'model':db[_0xb02e('0x54')],'as':_0xb02e('0x54'),'raw':!![]}]}]})['then'](function(_0x473a6c){_0x24f251=_0x473a6c;if(!_0x24f251||!_0x24f251[_0xb02e('0x53')])return;var _0x2ea98d=_0x24f251[_0xb02e('0x55')]();if(_0x88d579[_0xb02e('0x46')][_0xb02e('0x56')]&&_0x88d579[_0xb02e('0x46')][_0xb02e('0x56')][_0xb02e('0x43')]){for(var _0x152939=0x0;_0x152939<_0x88d579[_0xb02e('0x46')]['attachments'][_0xb02e('0x43')];_0x152939+=0x1){_0x88d579[_0xb02e('0x46')][_0xb02e('0x56')][_0x152939]={'filename':_0x88d579[_0xb02e('0x46')][_0xb02e('0x56')][_0x152939][_0xb02e('0x2b')],'path':path[_0xb02e('0x57')](config[_0xb02e('0x58')],_0xb02e('0x59'),_0x88d579['body']['attachments'][_0x152939][_0xb02e('0x5a')])};}}_0x13f9ab={'account':_0x2ea98d,'message':_0x88d579[_0xb02e('0x46')]};return;})[_0xb02e('0x16')](function(){if(_0x24f251[_0xb02e('0x5b')]){if(_0x24f251[_0xb02e('0x5b')]['Contacts'][_0xb02e('0x43')]){return _0x24f251[_0xb02e('0x5b')][_0xb02e('0x50')][0x0];}else{return db[_0xb02e('0x4f')][_0xb02e('0x49')](_['defaults'](_0x88d579[_0xb02e('0x46')],{'firstName':_0x88d579[_0xb02e('0x46')]['to'],'email':_0x88d579[_0xb02e('0x46')]['to'],'phone':_0x88d579['body']['to'],'ListId':_0x24f251['ListId']}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x13f9ab){return respondWithRpcPromise('SendMail',_0xb02e('0x5c'),_0x13f9ab,client9003)[_0xb02e('0x16')](function(_0x247d6e){return _0x57089a[_0xb02e('0x27')]({'read':!![],'messageId':_0x247d6e[_0xb02e('0x5d')],'sentAt':moment()[_0xb02e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xb02e('0x1e')](function(_0x5ed674){logger[_0xb02e('0x1b')]('%s',JSON[_0xb02e('0x5f')](_0x5ed674));return _0x57089a;});}return _0x57089a;});}return _0x57089a;}})[_0xb02e('0x16')](respondWithResult(_0x3f49e5,0xc9))[_0xb02e('0x1e')](handleError(_0x3f49e5,null));};exports['accept']=function(_0x9c8e4f,_0x55458b){var _0x3d7a3a=_0xb02e('0x60');return interactionService[_0xb02e('0x61')](_0x9c8e4f,_0x3d7a3a)[_0xb02e('0x16')](respondWithResult(_0x55458b,null))[_0xb02e('0x1e')](handleError(_0x55458b,null));};exports['reject']=function(_0x5d06b0,_0x33ca9e){var _0x48218a={'agent':{},'channel':_0xb02e('0x60')};if(_0x5d06b0['body']['id']){delete _0x5d06b0['body']['id'];}_0x5d06b0['body']['UserId']=_0x5d06b0[_0xb02e('0x46')][_0xb02e('0x62')]||_0x5d06b0[_0xb02e('0x63')]['id'];_0x48218a[_0xb02e('0x64')]['id']=_0x5d06b0[_0xb02e('0x46')][_0xb02e('0x62')];return db['MailMessage'][_0xb02e('0x47')]({'where':{'id':_0x5d06b0[_0xb02e('0x42')]['id'],'UserId':null}})[_0xb02e('0x16')](handleEntityNotFound(_0x33ca9e,null))[_0xb02e('0x16')](function(_0x56038d){if(_0x56038d){_0x48218a['message']=_0x56038d[_0xb02e('0x65')]({'plain':!![]});return db[_0xb02e('0x66')][_0xb02e('0x47')]({'where':{'id':_0x56038d[_0xb02e('0x67')]}});}return null;})[_0xb02e('0x16')](handleEntityNotFound(_0x33ca9e,null))[_0xb02e('0x16')](function(_0x962da1){if(_0x962da1){_0x48218a[_0xb02e('0x68')]=_0x962da1[_0xb02e('0x65')]({'plain':!![]});interaction_log['info'](_0xb02e('0x69'),_0x5d06b0['user']['id'],_0x5d06b0[_0xb02e('0x63')][_0xb02e('0x2b')],_0x5d06b0[_0xb02e('0x63')][_0xb02e('0x6a')],_0x48218a[_0xb02e('0x68')]['id'],_0x5d06b0[_0xb02e('0x46')]?JSON[_0xb02e('0x5f')](_0x5d06b0[_0xb02e('0x46')]):_0xb02e('0x6b'));return respondWithRpcPromise(_0xb02e('0x6c'),'rejectMessage',_0x48218a);}return null;})[_0xb02e('0x16')](function(_0x4a16df){var _0x226efa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4a16df[_0xb02e('0x1d')][_0xb02e('0x6d')];return db[_0xb02e('0x6e')][_0xb02e('0x32')](_0x226efa,{'type':db['Sequelize']['QueryTypes'][_0xb02e('0x6f')],'raw':!![]})[_0xb02e('0x16')](function(_0x5315fc){return _0x5315fc;});})[_0xb02e('0x16')](function(_0x15031e){if(_0x15031e){_0x48218a[_0xb02e('0x1d')]['contact']=_0x15031e[0x0];if(!_0x5d06b0[_0xb02e('0x46')][_0xb02e('0x62')])return;return db['User']['find']({'where':{'id':_0x5d06b0[_0xb02e('0x46')][_0xb02e('0x62')],'role':_0xb02e('0x64')},'attributes':['id',_0xb02e('0x2b'),_0xb02e('0x70'),_0xb02e('0x71'),'internal'],'raw':!![]});}return null;})[_0xb02e('0x16')](function(_0x598e91){if(!_0x598e91)return null;_0x48218a[_0xb02e('0x1d')]['agent']=_0x598e91;return _0x48218a;})[_0xb02e('0x16')](function(_0x4f3d32){if(_0x4f3d32){_0x4f3d32['message'][_0xb02e('0x72')]=util['format'](_0xb02e('0x73'),_0x5d06b0[_0xb02e('0x63')][_0xb02e('0x2b')]);_0x4f3d32[_0xb02e('0x1d')][_0xb02e('0x74')]=_0x48218a[_0xb02e('0x74')];_0x4f3d32[_0xb02e('0x1d')][_0xb02e('0x75')]=_0x48218a[_0xb02e('0x74')];_0x4f3d32['message'][_0xb02e('0x76')]=_0xb02e('0x77');_0x4f3d32[_0xb02e('0x1d')][_0xb02e('0x46')]=htmlToText[_0xb02e('0x78')](_0x48218a[_0xb02e('0x1d')][_0xb02e('0x46')]);respondWithRpcPromise(_0xb02e('0x79'),_0xb02e('0x79'),{'event':_0xb02e('0x7a'),'message':_0x4f3d32[_0xb02e('0x1d')]},client9002);return _0x48218a;}return null;})[_0xb02e('0x16')](respondWithResult(_0x33ca9e,null))[_0xb02e('0x1e')](handleError(_0x33ca9e,null));};exports['download']=function(_0xa0b685,_0x526a70){var _0x11c3df=moment()['unix']()[_0xb02e('0x7b')]();var _0x176f8b=path[_0xb02e('0x57')](config['root'],_0xb02e('0x7c'),'files',_0xb02e('0x7d'));var _0x153f44=path[_0xb02e('0x57')](config[_0xb02e('0x58')],_0xb02e('0x7c'),_0xb02e('0x7e'),_0xb02e('0x56'));var _0x7d75c9=util[_0xb02e('0x5e')](_0xb02e('0x7f'),_0x11c3df);return db[_0xb02e('0x2e')][_0xb02e('0x47')]({'where':{'id':_0xa0b685[_0xb02e('0x42')]['id']},'attributes':['id',_0xb02e('0x46'),_0xb02e('0x80'),'to','cc',_0xb02e('0x81'),_0xb02e('0x82'),'createdAt'],'include':_0xa0b685[_0xb02e('0x32')][_0xb02e('0x56')]?[{'model':db[_0xb02e('0x83')],'as':_0xb02e('0x84')}]:undefined})[_0xb02e('0x16')](handleEntityNotFound(_0x526a70,null))[_0xb02e('0x16')](function(_0xbbfc5f){if(_0xbbfc5f){var _0x48e93f=_0xbbfc5f;var _0x3c3075={'from':_0x48e93f['from'],'to':_0x48e93f['to'],'subject':_0x48e93f[_0xb02e('0x82')],'html':htmlEntities[_0xb02e('0x85')](_0x48e93f[_0xb02e('0x46')]),'headers':{'Date':moment(_0x48e93f[_0xb02e('0x86')])[_0xb02e('0x5e')](_0xb02e('0x87'))},'attachments':[]};if(_0xbbfc5f['cc']){_0x3c3075[_0xb02e('0x88')]['Cc']=_0xbbfc5f['cc'];}if(_0xbbfc5f[_0xb02e('0x81')]){_0x3c3075[_0xb02e('0x88')][_0xb02e('0x89')]=_0xbbfc5f[_0xb02e('0x81')];}return new Promise(function(_0x4c5d13,_0x27d930){if(_0xbbfc5f[_0xb02e('0x84')]){for(var _0x553e4e=0x0;_0x553e4e<_0xbbfc5f[_0xb02e('0x84')][_0xb02e('0x43')];_0x553e4e++){var _0x5791c6=_0xbbfc5f[_0xb02e('0x84')][_0x553e4e];var _0x5c9f41=path[_0xb02e('0x57')](_0x153f44,_0x5791c6[_0xb02e('0x5a')]);if(fs['existsSync'](_0x5c9f41)){_0x3c3075[_0xb02e('0x56')][_0xb02e('0x8a')]({'name':_0x5791c6[_0xb02e('0x2b')],'contentType':_0x5791c6[_0xb02e('0x31')],'data':fs[_0xb02e('0x8b')](_0x5c9f41)});}}}emlformat[_0xb02e('0x8c')](_0x3c3075,function(_0x4aa61f,_0x2b6390){if(_0x4aa61f)return _0x27d930(_0x4aa61f);fs['writeFileSync'](path[_0xb02e('0x57')](_0x176f8b,_0x7d75c9),_0x2b6390);return _0x4c5d13(_0x2b6390);});});}})['then'](function(_0x67672b){if(_0x67672b){return _0x526a70[_0xb02e('0x8d')](path['join'](_0x176f8b,_0x7d75c9),_0x7d75c9,function(_0x317425){if(!_0x317425)fs[_0xb02e('0x8e')](path['join'](_0x176f8b,_0x7d75c9));});}})['catch'](handleError(_0x526a70,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5cf24ca..dff0660 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 _0x08c9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x2312ab,_0xcd7188){var _0x2d998b=function(_0x1ed4b8){while(--_0x1ed4b8){_0x2312ab['push'](_0x2312ab['shift']());}};_0x2d998b(++_0xcd7188);}(_0x08c9,0x1c6));var _0x908c=function(_0x13e357,_0x3f073a){_0x13e357=_0x13e357-0x0;var _0x2960aa=_0x08c9[_0x13e357];return _0x2960aa;};'use strict';var EventEmitter=require(_0x908c('0x0'));var MailMessage=require(_0x908c('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x908c('0x2')](0x0);var events={'afterCreate':_0x908c('0x3'),'afterUpdate':_0x908c('0x4'),'afterDestroy':_0x908c('0x5')};function emitEvent(_0x3835cb){return function(_0x14cb24,_0x1e4aed,_0x1bea5d){MailMessageEvents['emit'](_0x3835cb+':'+_0x14cb24['id'],_0x14cb24);MailMessageEvents[_0x908c('0x6')](_0x3835cb,_0x14cb24);_0x1bea5d(null);};}for(var e in events){if(events[_0x908c('0x7')](e)){var event=events[e];MailMessage[_0x908c('0x8')](e,emitEvent(event));}}module[_0x908c('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x395f=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x37e630,_0x10cd91){var _0x5517b8=function(_0x273e62){while(--_0x273e62){_0x37e630['push'](_0x37e630['shift']());}};_0x5517b8(++_0x10cd91);}(_0x395f,0x170));var _0xf395=function(_0x4fdb16,_0x132961){_0x4fdb16=_0x4fdb16-0x0;var _0x530d9b=_0x395f[_0x4fdb16];return _0x530d9b;};'use strict';var EventEmitter=require(_0xf395('0x0'));var MailMessage=require(_0xf395('0x1'))['db'][_0xf395('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf395('0x3')](0x0);var events={'afterCreate':_0xf395('0x4'),'afterUpdate':_0xf395('0x5'),'afterDestroy':_0xf395('0x6')};function emitEvent(_0x26d7a1){return function(_0x5bbe67,_0x4b0f4f,_0x545cb8){MailMessageEvents[_0xf395('0x7')](_0x26d7a1+':'+_0x5bbe67['id'],_0x5bbe67);MailMessageEvents[_0xf395('0x7')](_0x26d7a1,_0x5bbe67);_0x545cb8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xf395('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index d9ab18e..4f70665 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 _0xf9b3=['isNil','MailInteraction','findOne','MailInteractionId','update','catch','error','utf8mb4_unicode_ci','lodash','util','moment','request-promise','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xf9b3,0x7c));var _0x3f9b=function(_0x48a284,_0x5099e5){_0x48a284=_0x48a284-0x0;var _0x3c88c1=_0xf9b3[_0x48a284];return _0x3c88c1;};'use strict';var _=require(_0x3f9b('0x0'));var util=require(_0x3f9b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3f9b('0x2'));var BPromise=require('bluebird');var rp=require(_0x3f9b('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x3f9b('0x4'));var config=require('../../config/environment');var attributes=require(_0x3f9b('0x5'));module['exports']=function(_0x422759,_0x4b2630){return _0x422759[_0x3f9b('0x6')](_0x3f9b('0x7'),attributes,{'tableName':_0x3f9b('0x8'),'paranoid':![],'indexes':[{'name':_0x3f9b('0x9'),'fields':[_0x3f9b('0x9')]},{'name':_0x3f9b('0xa'),'fields':[_0x3f9b('0xb'),_0x3f9b('0xc')],'type':_0x3f9b('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4db530,_0x5de938,_0x35dd9b){if(_0x4db530[_0x3f9b('0xe')]){_0x4db530['plainBody']=htmlToText[_0x3f9b('0xf')](_0x4db530['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x35dd9b(null,_0x5de938);},'afterCreate':function(_0x2515cd,_0x79f080,_0x478d07){var _0x4c03e4=_0x422759[_0x3f9b('0x10')];var _0x38f6c7=_0x2515cd[_0x3f9b('0x11')]({'plain':!![]});if(_0x38f6c7[_0x3f9b('0x12')][_0x3f9b('0x13')]()==='in'||_0x38f6c7[_0x3f9b('0x12')]['toLowerCase']()==='out'&&!_0x38f6c7[_0x3f9b('0x14')]&&!_[_0x3f9b('0x15')](_0x38f6c7['UserId'])){_0x4c03e4[_0x3f9b('0x16')][_0x3f9b('0x17')]({'where':{'id':_0x38f6c7[_0x3f9b('0x18')]}})['then'](function(_0x1543a0){if(_0x1543a0){_0x1543a0[_0x3f9b('0x19')]({'lastMsgAt':_0x38f6c7['createdAt'],'lastMsgDirection':_0x38f6c7[_0x3f9b('0x12')][_0x3f9b('0x13')]()});}})[_0x3f9b('0x1a')](function(_0xff3977){console[_0x3f9b('0x1b')](_0xff3977);});}_0x478d07();}},'charset':'utf8mb4','collate':_0x3f9b('0x1c')});}; \ No newline at end of file +var _0x39d0=['body','plainBody','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','subject'];(function(_0x2d0d97,_0x2d9560){var _0xfb96e9=function(_0x52a340){while(--_0x52a340){_0x2d0d97['push'](_0x2d0d97['shift']());}};_0xfb96e9(++_0x2d9560);}(_0x39d0,0x96));var _0x039d=function(_0x42cb64,_0x20d2d9){_0x42cb64=_0x42cb64-0x0;var _0x327bbd=_0x39d0[_0x42cb64];return _0x327bbd;};'use strict';var _=require(_0x039d('0x0'));var util=require(_0x039d('0x1'));var logger=require(_0x039d('0x2'))(_0x039d('0x3'));var moment=require(_0x039d('0x4'));var BPromise=require(_0x039d('0x5'));var rp=require(_0x039d('0x6'));var htmlToText=require(_0x039d('0x7'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x039d('0x8'));module[_0x039d('0x9')]=function(_0x482258,_0x48c3ee){return _0x482258[_0x039d('0xa')]('MailMessage',attributes,{'tableName':_0x039d('0xb'),'paranoid':![],'indexes':[{'name':_0x039d('0xc'),'fields':[_0x039d('0xc')]},{'name':_0x039d('0xd'),'fields':['plainBody',_0x039d('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x170777,_0x1f0e73,_0x693606){if(_0x170777[_0x039d('0xf')]){_0x170777[_0x039d('0x10')]=htmlToText['fromString'](_0x170777[_0x039d('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x693606(null,_0x1f0e73);},'afterCreate':function(_0x583e16,_0x9621ea,_0x86ab3d){var _0x955ccf=_0x482258[_0x039d('0x11')];var _0x47ffcf=_0x583e16[_0x039d('0x12')]({'plain':!![]});if(_0x47ffcf[_0x039d('0x13')]['toLowerCase']()==='in'||_0x47ffcf['direction'][_0x039d('0x14')]()==='out'&&!_0x47ffcf[_0x039d('0x15')]&&!_[_0x039d('0x16')](_0x47ffcf[_0x039d('0x17')])){_0x955ccf['MailInteraction'][_0x039d('0x18')]({'where':{'id':_0x47ffcf[_0x039d('0x19')]}})[_0x039d('0x1a')](function(_0x255329){if(_0x255329){_0x255329[_0x039d('0x1b')]({'lastMsgAt':_0x47ffcf[_0x039d('0x1c')],'lastMsgDirection':_0x47ffcf[_0x039d('0x13')][_0x039d('0x14')]()});}})[_0x039d('0x1d')](function(_0x6a98ed){console[_0x039d('0x1e')](_0x6a98ed);});}_0x86ab3d();}},'charset':_0x039d('0x1f'),'collate':_0x039d('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 104604c..8e96a2d 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 _0xab40=['raw','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','register','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateMailMessage','MailMessage','create','options'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xab40,0xcd));var _0x0ab4=function(_0x374796,_0x18b165){_0x374796=_0x374796-0x0;var _0x2836a3=_0xab40[_0x374796];return _0x2836a3;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});config[_0x0ab4('0x8')]=_[_0x0ab4('0x9')](config[_0x0ab4('0x8')],{'host':_0x0ab4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0x0ab4('0xb')](socket);function respondWithRpcPromise(_0x30e726,_0x40e4d1,_0x464f7e){return new BPromise(function(_0x413d9b,_0x24c6c1){return client[_0x0ab4('0xc')](_0x30e726,_0x464f7e)[_0x0ab4('0xd')](function(_0x4e1708){logger['info'](_0x0ab4('0xe'),_0x40e4d1,'request\x20sent');logger[_0x0ab4('0xf')](_0x0ab4('0x10'),_0x40e4d1,_0x0ab4('0x11'),JSON[_0x0ab4('0x12')](_0x4e1708));if(_0x4e1708[_0x0ab4('0x13')]){if(_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x14')]===0x1f4){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);return _0x24c6c1(_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);}logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);return _0x413d9b(_0x4e1708[_0x0ab4('0x13')]['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x40e4d1,_0x0ab4('0x11'));_0x413d9b(_0x4e1708[_0x0ab4('0x16')][_0x0ab4('0x15')]);}})['catch'](function(_0x1e3fe2){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x1e3fe2);_0x24c6c1(_0x1e3fe2);});});}exports[_0x0ab4('0x17')]=function(_0x4e7852){var _0x4ff836=this;return new Promise(function(_0xdb0797,_0x5b1ed5){return db[_0x0ab4('0x18')][_0x0ab4('0x19')](_0x4e7852['body'],{'raw':_0x4e7852[_0x0ab4('0x1a')]?_0x4e7852[_0x0ab4('0x1a')][_0x0ab4('0x1b')]===undefined?!![]:![]:!![]})[_0x0ab4('0xd')](function(_0x12d06d){logger['info']('CreateMailMessage',_0x4e7852);logger[_0x0ab4('0xf')](_0x0ab4('0x17'),_0x4e7852,JSON[_0x0ab4('0x12')](_0x12d06d));_0xdb0797(_0x12d06d);})[_0x0ab4('0x1c')](function(_0x4e4b80){logger[_0x0ab4('0x13')](_0x0ab4('0x17'),_0x4e4b80[_0x0ab4('0x15')],_0x4e7852);_0x5b1ed5(_0x4ff836['error'](0x1f4,_0x4e4b80['message']));});});}; \ No newline at end of file +var _0x2da6=['defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','MailMessage','create','body','options','info','CreateMailMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5a5e06,_0x3f6b09){var _0xe25da5=function(_0xa76da7){while(--_0xa76da7){_0x5a5e06['push'](_0x5a5e06['shift']());}};_0xe25da5(++_0x3f6b09);}(_0x2da6,0x1dd));var _0x62da=function(_0x9f4f0e,_0x13a617){_0x9f4f0e=_0x9f4f0e-0x0;var _0x5713c2=_0x2da6[_0x9f4f0e];return _0x5713c2;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});config[_0x62da('0xc')]=_[_0x62da('0xd')](config[_0x62da('0xc')],{'host':_0x62da('0xe'),'port':0x18eb});var socket=require(_0x62da('0xf'))(new Redis(config['redis']));require(_0x62da('0x10'))[_0x62da('0x11')](socket);function respondWithRpcPromise(_0x2a3d7c,_0x1b68f8,_0x4cd5a2){return new BPromise(function(_0x241090,_0x3afe3b){return client[_0x62da('0x12')](_0x2a3d7c,_0x4cd5a2)[_0x62da('0x13')](function(_0x23be32){logger['info'](_0x62da('0x14'),_0x1b68f8,_0x62da('0x15'));logger[_0x62da('0x16')](_0x62da('0x17'),_0x1b68f8,_0x62da('0x15'),JSON['stringify'](_0x23be32));if(_0x23be32['error']){if(_0x23be32[_0x62da('0x18')][_0x62da('0x19')]===0x1f4){logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x3afe3b(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x241090(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x1b68f8,_0x62da('0x15'));_0x241090(_0x23be32['result'][_0x62da('0x1a')]);}})[_0x62da('0x1b')](function(_0x15b8d0){logger['error'](_0x62da('0x14'),_0x1b68f8,_0x15b8d0);_0x3afe3b(_0x15b8d0);});});}exports['CreateMailMessage']=function(_0x2e6b7e){var _0x37c15d=this;return new Promise(function(_0x3b90c8,_0x2f7b01){return db[_0x62da('0x1c')][_0x62da('0x1d')](_0x2e6b7e[_0x62da('0x1e')],{'raw':_0x2e6b7e[_0x62da('0x1f')]?_0x2e6b7e[_0x62da('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x62da('0x13')](function(_0x866a76){logger[_0x62da('0x20')](_0x62da('0x21'),_0x2e6b7e);logger[_0x62da('0x16')](_0x62da('0x21'),_0x2e6b7e,JSON[_0x62da('0x22')](_0x866a76));_0x3b90c8(_0x866a76);})['catch'](function(_0x55fd3b){logger['error'](_0x62da('0x21'),_0x55fd3b[_0x62da('0x1a')],_0x2e6b7e);_0x2f7b01(_0x37c15d[_0x62da('0x18')](0x1f4,_0x55fd3b[_0x62da('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 84472fe..7069d9c 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 _0x2354=['register','mailMessage:','./mailMessage.events','save','remove','update','removeListener'];(function(_0x4c6ad2,_0x51092b){var _0x215c13=function(_0xf76c84){while(--_0xf76c84){_0x4c6ad2['push'](_0x4c6ad2['shift']());}};_0x215c13(++_0x51092b);}(_0x2354,0x159));var _0x4235=function(_0x2765c5,_0x384244){_0x2765c5=_0x2765c5-0x0;var _0x4491dd=_0x2354[_0x2765c5];return _0x4491dd;};'use strict';var MailMessageEvents=require(_0x4235('0x0'));var events=[_0x4235('0x1'),_0x4235('0x2'),_0x4235('0x3')];function createListener(_0x3b6274,_0x3e2e42){return function(_0x5eedb5){_0x3e2e42['emit'](_0x3b6274,_0x5eedb5);};}function removeListener(_0x20001c,_0xcbb54f){return function(){MailMessageEvents[_0x4235('0x4')](_0x20001c,_0xcbb54f);};}exports[_0x4235('0x5')]=function(_0x1359d8){for(var _0x524a22=0x0,_0x1b5378=events['length'];_0x524a22<_0x1b5378;_0x524a22++){var _0x488dba=events[_0x524a22];var _0x19c5a2=createListener(_0x4235('0x6')+_0x488dba,_0x1359d8);MailMessageEvents['on'](_0x488dba,_0x19c5a2);}}; \ No newline at end of file +var _0xdafe=['register','length','./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x54dc4f,_0x39a861){var _0x22e5e7=function(_0x1ea6a9){while(--_0x1ea6a9){_0x54dc4f['push'](_0x54dc4f['shift']());}};_0x22e5e7(++_0x39a861);}(_0xdafe,0x6a));var _0xedaf=function(_0x39d7a9,_0x1f32e3){_0x39d7a9=_0x39d7a9-0x0;var _0x3af602=_0xdafe[_0x39d7a9];return _0x3af602;};'use strict';var MailMessageEvents=require(_0xedaf('0x0'));var events=[_0xedaf('0x1'),_0xedaf('0x2'),_0xedaf('0x3')];function createListener(_0x372e81,_0x359a93){return function(_0x217a9a){_0x359a93[_0xedaf('0x4')](_0x372e81,_0x217a9a);};}function removeListener(_0xb75813,_0x4037e0){return function(){MailMessageEvents[_0xedaf('0x5')](_0xb75813,_0x4037e0);};}exports[_0xedaf('0x6')]=function(_0x5a85a7){for(var _0x1b0c20=0x0,_0x4ed160=events[_0xedaf('0x7')];_0x1b0c20<_0x4ed160;_0x1b0c20++){var _0x3f2380=events[_0x1b0c20];var _0x54129e=createListener('mailMessage:'+_0x3f2380,_0x5a85a7);MailMessageEvents['on'](_0x3f2380,_0x54129e);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 8344fe1..baaeec0 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 _0xa5d9=['/:id/teams','/:id/users','getAgents','post','create','addAgents','/:id','destroy','delete','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','getMembers'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa5d9,0x142));var _0x9a5d=function(_0x553b86,_0x1d23ec){_0x553b86=_0x553b86-0x0;var _0x2a11eb=_0xa5d9[_0x553b86];return _0x2a11eb;};'use strict';var multer=require(_0x9a5d('0x0'));var util=require(_0x9a5d('0x1'));var path=require(_0x9a5d('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a5d('0x3'));var router=express[_0x9a5d('0x4')]();var fs_extra=require(_0x9a5d('0x5'));var auth=require(_0x9a5d('0x6'));var interaction=require(_0x9a5d('0x7'));var config=require(_0x9a5d('0x8'));var controller=require(_0x9a5d('0x9'));router[_0x9a5d('0xa')]('/',auth[_0x9a5d('0xb')](),controller[_0x9a5d('0xc')]);router['get'](_0x9a5d('0xd'),auth[_0x9a5d('0xb')](),controller[_0x9a5d('0xe')]);router[_0x9a5d('0xa')]('/:id',auth[_0x9a5d('0xb')](),controller['show']);router[_0x9a5d('0xa')]('/:id/members',auth[_0x9a5d('0xb')](),controller[_0x9a5d('0xf')]);router[_0x9a5d('0xa')](_0x9a5d('0x10'),auth[_0x9a5d('0xb')](),controller['getTeams']);router['get'](_0x9a5d('0x11'),auth[_0x9a5d('0xb')](),controller[_0x9a5d('0x12')]);router[_0x9a5d('0x13')]('/',auth[_0x9a5d('0xb')](),controller[_0x9a5d('0x14')]);router[_0x9a5d('0x13')](_0x9a5d('0x10'),auth[_0x9a5d('0xb')](),controller['addTeams']);router['post'](_0x9a5d('0x11'),auth['isAuthenticated'](),controller[_0x9a5d('0x15')]);router['put'](_0x9a5d('0x16'),auth[_0x9a5d('0xb')](),controller['update']);router['delete']('/:id',auth[_0x9a5d('0xb')](),controller[_0x9a5d('0x17')]);router['delete'](_0x9a5d('0x10'),auth[_0x9a5d('0xb')](),controller['removeTeams']);router[_0x9a5d('0x18')](_0x9a5d('0x11'),auth[_0x9a5d('0xb')](),controller[_0x9a5d('0x19')]);module['exports']=router; \ No newline at end of file +var _0xcf27=['fs-extra','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xcf27,0xdb));var _0x7cf2=function(_0x26387f,_0x1b3d16){_0x26387f=_0x26387f-0x0;var _0x11cc13=_0xcf27[_0x26387f];return _0x11cc13;};'use strict';var multer=require(_0x7cf2('0x0'));var util=require(_0x7cf2('0x1'));var path=require(_0x7cf2('0x2'));var timeout=require(_0x7cf2('0x3'));var express=require('express');var router=express[_0x7cf2('0x4')]();var fs_extra=require(_0x7cf2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7cf2('0x6'));router[_0x7cf2('0x7')]('/',auth[_0x7cf2('0x8')](),controller[_0x7cf2('0x9')]);router[_0x7cf2('0x7')](_0x7cf2('0xa'),auth[_0x7cf2('0x8')](),controller[_0x7cf2('0xb')]);router[_0x7cf2('0x7')](_0x7cf2('0xc'),auth[_0x7cf2('0x8')](),controller[_0x7cf2('0xd')]);router[_0x7cf2('0x7')](_0x7cf2('0xe'),auth[_0x7cf2('0x8')](),controller[_0x7cf2('0xf')]);router[_0x7cf2('0x7')](_0x7cf2('0x10'),auth['isAuthenticated'](),controller[_0x7cf2('0x11')]);router[_0x7cf2('0x7')](_0x7cf2('0x12'),auth[_0x7cf2('0x8')](),controller[_0x7cf2('0x13')]);router[_0x7cf2('0x14')]('/',auth[_0x7cf2('0x8')](),controller[_0x7cf2('0x15')]);router[_0x7cf2('0x14')]('/:id/teams',auth[_0x7cf2('0x8')](),controller[_0x7cf2('0x16')]);router[_0x7cf2('0x14')](_0x7cf2('0x12'),auth[_0x7cf2('0x8')](),controller['addAgents']);router[_0x7cf2('0x17')](_0x7cf2('0xc'),auth[_0x7cf2('0x8')](),controller['update']);router[_0x7cf2('0x18')](_0x7cf2('0xc'),auth[_0x7cf2('0x8')](),controller['destroy']);router['delete']('/:id/teams',auth[_0x7cf2('0x8')](),controller[_0x7cf2('0x19')]);router[_0x7cf2('0x18')](_0x7cf2('0x12'),auth[_0x7cf2('0x8')](),controller[_0x7cf2('0x1a')]);module[_0x7cf2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8fc79fe..607c540 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 _0xa0bc=['STRING','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x2308db,_0x2e95c9){var _0x38d5de=function(_0x553804){while(--_0x553804){_0x2308db['push'](_0x2308db['shift']());}};_0x38d5de(++_0x2e95c9);}(_0xa0bc,0xb8));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xca0b('0x0'));module[_0xca0b('0x1')]={'name':{'type':Sequelize[_0xca0b('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xca0b('0x2')]},'timeout':{'type':Sequelize[_0xca0b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xca0b('0x4')](_0xca0b('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xd023=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x547160,_0x537a78){var _0x3f7b71=function(_0x58be0c){while(--_0x58be0c){_0x547160['push'](_0x547160['shift']());}};_0x3f7b71(++_0x537a78);}(_0xd023,0xfb));var _0x3d02=function(_0x2a0346,_0x2c1300){_0x2a0346=_0x2a0346-0x0;var _0x1f5232=_0xd023[_0x2a0346];return _0x1f5232;};'use strict';var Sequelize=require(_0x3d02('0x0'));module[_0x3d02('0x1')]={'name':{'type':Sequelize[_0x3d02('0x2')],'unique':_0x3d02('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3d02('0x2')]},'timeout':{'type':Sequelize[_0x3d02('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3d02('0x5')]('rrmemory',_0x3d02('0x6'),_0x3d02('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 0d496df..10e3401 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 _0x31ad=['describe','getMembers','findOne','UserMailQueue','nolimit','order','sort','MailQueueId','filter','map','findAll','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','pick','addTeams','ids','Team','User','Agents','online','interface','flatMap','sequelize','each','forEach','emit','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','isEmpty','userMailQueue:remove','addAgents','spread','userMailQueue:save','removeAgents','isArray','options','getAgents','hasOwnProperty','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','./mailQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','get','MailQueues','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','key','where','MailQueue','include','query','rows','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x31ad,0xbd));var _0xd31a=function(_0x379264,_0x3d4f0f){_0x379264=_0x379264-0x0;var _0x3528e8=_0x31ad[_0x379264];return _0x3528e8;};'use strict';var BPromise=require(_0xd31a('0x0'));var util=require(_0xd31a('0x1'));var _=require(_0xd31a('0x2'));var squel=require('squel');var Redis=require(_0xd31a('0x3'));var qs=require(_0xd31a('0x4'));var logger=require(_0xd31a('0x5'))(_0xd31a('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd31a('0x7')]=_[_0xd31a('0x8')](config[_0xd31a('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd31a('0x7')]));require(_0xd31a('0x9'))[_0xd31a('0xa')](socket);function respondWithStatusCode(_0x14bc9e,_0x477b46){_0x477b46=_0x477b46||0xcc;return function(_0x3df89d){if(_0x3df89d){return _0x14bc9e[_0xd31a('0xb')](_0x477b46);}return _0x14bc9e['status'](_0x477b46)[_0xd31a('0xc')]();};}function respondWithResult(_0x18028b,_0x52b1c1){_0x52b1c1=_0x52b1c1||0xc8;return function(_0x2d0209){if(_0x2d0209){return _0x18028b[_0xd31a('0xd')](_0x52b1c1)[_0xd31a('0xe')](_0x2d0209);}};}function respondWithFilteredResult(_0x1ae36a,_0x980c3d){return function(_0xa92f1e){if(_0xa92f1e){var _0x3ede4c=typeof _0x980c3d['offset']===_0xd31a('0xf')&&typeof _0x980c3d[_0xd31a('0x10')]===_0xd31a('0xf');var _0x1c4dd8=_0xa92f1e[_0xd31a('0x11')];var _0x43c494=_0x3ede4c?0x0:_0x980c3d[_0xd31a('0x12')];var _0x486f6e=_0x3ede4c?_0xa92f1e[_0xd31a('0x11')]:_0x980c3d['offset']+_0x980c3d[_0xd31a('0x10')];var _0x227bd4;if(_0x486f6e>=_0x1c4dd8){_0x486f6e=_0x1c4dd8;_0x227bd4=0xc8;}else{_0x227bd4=0xce;}_0x1ae36a[_0xd31a('0xd')](_0x227bd4);return _0x1ae36a[_0xd31a('0x13')](_0xd31a('0x14'),_0x43c494+'-'+_0x486f6e+'/'+_0x1c4dd8)[_0xd31a('0xe')](_0xa92f1e);}return null;};}function saveUpdates(_0x1ea596){return function(_0x2fa499){if(_0x2fa499){return _0x2fa499['update'](_0x1ea596)['then'](function(_0x4fa2db){return _0x4fa2db;});}return null;};}function removeEntity(_0x333fa7){return function(_0x392cde){if(_0x392cde){return _0x392cde[_0xd31a('0x15')]()[_0xd31a('0x16')](function(){var _0x345023=_0x392cde[_0xd31a('0x17')]({'plain':!![]});var _0x516a08=_0xd31a('0x18');return db[_0xd31a('0x19')][_0xd31a('0x15')]({'where':{'type':_0x516a08,'resourceId':_0x345023['id']}})[_0xd31a('0x16')](function(){return _0x392cde;});})[_0xd31a('0x16')](function(){_0x333fa7[_0xd31a('0xd')](0xcc)[_0xd31a('0xc')]();});}};}function handleEntityNotFound(_0x3c3eb1){return function(_0x57fb41){if(!_0x57fb41){_0x3c3eb1[_0xd31a('0xb')](0x194);}return _0x57fb41;};}function handleError(_0x374459,_0x5247ca){_0x5247ca=_0x5247ca||0x1f4;return function(_0x57f43a){logger[_0xd31a('0x1a')](_0x57f43a[_0xd31a('0x1b')]);if(_0x57f43a['name']){delete _0x57f43a[_0xd31a('0x1c')];}_0x374459[_0xd31a('0xd')](_0x5247ca)['send'](_0x57f43a);};}exports[_0xd31a('0x1d')]=function(_0x339480,_0x58d8c9){var _0x31fa36={};var _0x36a79f={'count':0x0,'rows':[]};var _0x5d1b79=_['map'](db['MailQueue'][_0xd31a('0x1e')],function(_0x22f6e1){return{'name':_0x22f6e1[_0xd31a('0x1f')],'type':_0x22f6e1[_0xd31a('0x20')][_0xd31a('0x21')]};});_0x31fa36=qs['getOptions'](_0x5d1b79,_0x339480);var _0x272529={'where':_0x31fa36[_0xd31a('0x22')]};return db[_0xd31a('0x23')][_0xd31a('0x11')](_0x272529)['then'](function(_0x3cded5){_0x36a79f[_0xd31a('0x11')]=_0x3cded5;_0x31fa36[_0xd31a('0x24')]=qs[_0xd31a('0x24')](_0x339480[_0xd31a('0x25')]);return db[_0xd31a('0x23')]['findAll'](_0x31fa36);})['then'](function(_0x4798e7){_0x36a79f[_0xd31a('0x26')]=_0x4798e7;return _0x36a79f;})[_0xd31a('0x16')](respondWithFilteredResult(_0x58d8c9,_0x31fa36))[_0xd31a('0x27')](handleError(_0x58d8c9,null));};exports['show']=function(_0x5be2a2,_0x2c865f){var _0x36e35e={'raw':!![],'where':{'id':_0x5be2a2[_0xd31a('0x28')]['id']}},_0xf70404={};_0xf70404[_0xd31a('0x29')]=_[_0xd31a('0x2a')](db[_0xd31a('0x23')]['rawAttributes']);_0xf70404['query']=_['keys'](_0x5be2a2[_0xd31a('0x25')]);_0xf70404[_0xd31a('0x2b')]=_[_0xd31a('0x2c')](_0xf70404[_0xd31a('0x29')],_0xf70404[_0xd31a('0x25')]);_0x36e35e[_0xd31a('0x2d')]=_[_0xd31a('0x2c')](_0xf70404[_0xd31a('0x29')],qs['fields'](_0x5be2a2[_0xd31a('0x25')][_0xd31a('0x2e')]));_0x36e35e[_0xd31a('0x2d')]=_0x36e35e['attributes'][_0xd31a('0x2f')]?_0x36e35e[_0xd31a('0x2d')]:_0xf70404['model'];if(_0x5be2a2['query'][_0xd31a('0x30')]){_0x36e35e[_0xd31a('0x24')]=[{'all':!![]}];}_0x36e35e=_[_0xd31a('0x31')]({},_0x36e35e,_0x5be2a2['options']);return db[_0xd31a('0x23')][_0xd31a('0x32')](_0x36e35e)[_0xd31a('0x16')](handleEntityNotFound(_0x2c865f,null))['then'](respondWithResult(_0x2c865f,null))[_0xd31a('0x27')](handleError(_0x2c865f,null));};exports['create']=function(_0x21d1d2,_0x38a5bc){return db['MailQueue'][_0xd31a('0x33')](_0x21d1d2[_0xd31a('0x34')],{})[_0xd31a('0x16')](function(_0x3617a4){var _0xed8bdf=_0x21d1d2[_0xd31a('0x35')][_0xd31a('0x17')]({'plain':!![]});if(!_0xed8bdf)throw new Error(_0xd31a('0x36'));if(_0xed8bdf[_0xd31a('0x37')]===_0xd31a('0x35')){var _0x57fc9f=_0x3617a4[_0xd31a('0x17')]({'plain':!![]});var _0x59c5a5=_0xd31a('0x18');return db[_0xd31a('0x38')][_0xd31a('0x32')]({'where':{'name':_0x59c5a5,'userProfileId':_0xed8bdf[_0xd31a('0x39')]},'raw':!![]})['then'](function(_0x389b6d){if(_0x389b6d&&_0x389b6d[_0xd31a('0x3a')]===0x0){return db[_0xd31a('0x19')][_0xd31a('0x33')]({'name':_0x57fc9f['name'],'resourceId':_0x57fc9f['id'],'type':_0x389b6d[_0xd31a('0x1c')],'sectionId':_0x389b6d['id']},{})[_0xd31a('0x16')](function(){return _0x3617a4;});}else{return _0x3617a4;}})['catch'](function(_0x4e8d53){logger[_0xd31a('0x1a')](_0xd31a('0x3b'),_0x4e8d53);throw _0x4e8d53;});}return _0x3617a4;})[_0xd31a('0x16')](respondWithResult(_0x38a5bc,0xc9))[_0xd31a('0x27')](handleError(_0x38a5bc,null));};exports[_0xd31a('0x3c')]=function(_0x89fc25,_0x30327f){if(_0x89fc25[_0xd31a('0x34')]['id']){delete _0x89fc25[_0xd31a('0x34')]['id'];}return db['MailQueue'][_0xd31a('0x32')]({'where':{'id':_0x89fc25[_0xd31a('0x28')]['id']}})[_0xd31a('0x16')](handleEntityNotFound(_0x30327f,null))[_0xd31a('0x16')](saveUpdates(_0x89fc25[_0xd31a('0x34')],null))[_0xd31a('0x16')](respondWithResult(_0x30327f,null))[_0xd31a('0x27')](handleError(_0x30327f,null));};exports[_0xd31a('0x15')]=function(_0x3c97ca,_0x3e4c4d){return db[_0xd31a('0x23')][_0xd31a('0x32')]({'where':{'id':_0x3c97ca['params']['id']}})[_0xd31a('0x16')](handleEntityNotFound(_0x3e4c4d,null))['then'](removeEntity(_0x3e4c4d,null))[_0xd31a('0x27')](handleError(_0x3e4c4d,null));};exports['describe']=function(_0x45c3d2,_0x2fe7ab){return db[_0xd31a('0x23')][_0xd31a('0x3d')]()[_0xd31a('0x16')](respondWithResult(_0x2fe7ab,null))[_0xd31a('0x27')](handleError(_0x2fe7ab,null));};exports[_0xd31a('0x3e')]=function(_0x5615d8,_0x3bc7bc){var _0x19b02a={'raw':!![],'where':{}},_0x124199={},_0x47ae53;return db['MailQueue'][_0xd31a('0x3f')]({'where':{'id':_0x5615d8[_0xd31a('0x28')]['id']}})[_0xd31a('0x16')](handleEntityNotFound(_0x3bc7bc,null))[_0xd31a('0x16')](function(_0x133344){if(_0x133344){_0x47ae53=_0x133344[_0xd31a('0x17')]({'plain':!![]});_0x124199['model']=_['keys'](db[_0xd31a('0x40')][_0xd31a('0x1e')]);_0x124199[_0xd31a('0x25')]=_[_0xd31a('0x2a')](_0x5615d8[_0xd31a('0x25')]);_0x124199[_0xd31a('0x2b')]=_[_0xd31a('0x2c')](_0x124199[_0xd31a('0x29')],_0x124199['query']);_0x19b02a['attributes']=_[_0xd31a('0x2c')](_0x124199[_0xd31a('0x29')],qs['fields'](_0x5615d8[_0xd31a('0x25')][_0xd31a('0x2e')]));_0x19b02a[_0xd31a('0x2d')]=_0x19b02a[_0xd31a('0x2d')][_0xd31a('0x2f')]?_0x19b02a[_0xd31a('0x2d')]:_0x124199['model'];if(!_0x5615d8[_0xd31a('0x25')]['hasOwnProperty'](_0xd31a('0x41'))){_0x19b02a['limit']=qs['limit'](_0x5615d8[_0xd31a('0x25')]['limit']);_0x19b02a[_0xd31a('0x12')]=qs[_0xd31a('0x12')](_0x5615d8['query'][_0xd31a('0x12')]);}_0x19b02a[_0xd31a('0x42')]=qs[_0xd31a('0x43')](_0x5615d8[_0xd31a('0x25')][_0xd31a('0x43')]);_0x19b02a[_0xd31a('0x22')]=qs[_0xd31a('0x2b')](_['pick'](_0x5615d8[_0xd31a('0x25')],_0x124199[_0xd31a('0x2b')]));_0x19b02a[_0xd31a('0x22')][_0xd31a('0x44')]=_0x133344['id'];if(_0x5615d8[_0xd31a('0x25')][_0xd31a('0x45')]){_0x19b02a['where']=_[_0xd31a('0x31')](_0x19b02a[_0xd31a('0x22')],{'$or':_[_0xd31a('0x46')](_0x19b02a[_0xd31a('0x2d')],function(_0x20e056){var _0x4f8eee={};_0x4f8eee[_0x20e056]={'$like':'%'+_0x5615d8[_0xd31a('0x25')][_0xd31a('0x45')]+'%'};return _0x4f8eee;})});}_0x19b02a=_[_0xd31a('0x31')]({},_0x19b02a,_0x5615d8['options']);return db[_0xd31a('0x40')][_0xd31a('0x47')](_0x19b02a);}})[_0xd31a('0x16')](function(_0x48b731){if(_0x48b731){return db['User'][_0xd31a('0x48')]({'where':{'id':_[_0xd31a('0x46')](_0x48b731,_0xd31a('0x49')),'role':'agent'},'attributes':['id',_0xd31a('0x1c'),_0xd31a('0x4a'),_0xd31a('0x4b'),_0xd31a('0x4c')]});}})[_0xd31a('0x16')](function(_0x8a2695){if(_0x8a2695){return{'count':_0x8a2695[_0xd31a('0x11')],'rows':_['map'](_0x8a2695[_0xd31a('0x26')],function(_0x5c1fcc){return{'membername':_0x5c1fcc[_0xd31a('0x1c')],'UserId':_0x5c1fcc['id'],'queue_name':_0x47ae53[_0xd31a('0x1c')],'MailQueueId':_0x47ae53['id'],'interface':util[_0xd31a('0x4d')](_0xd31a('0x4e'),_0xd31a('0x4f'),_0x5c1fcc[_0xd31a('0x1c')]),'penalty':0x0,'paused':_0x5c1fcc[_0xd31a('0x4a')],'createdAt':_0x5c1fcc[_0xd31a('0x4c')],'updatedAt':_0x5c1fcc[_0xd31a('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd31a('0x16')](respondWithFilteredResult(_0x3bc7bc,_0x19b02a))['catch'](handleError(_0x3bc7bc,null));};exports[_0xd31a('0x50')]=function(_0x2be9a2,_0xbdd742){var _0x58f6ef={};var _0x308205={};var _0x3596ef;var _0x13daf7;return db[_0xd31a('0x23')]['findOne']({'where':{'id':_0x2be9a2['params']['id']}})['then'](handleEntityNotFound(_0xbdd742,null))[_0xd31a('0x16')](function(_0x5b04e8){if(_0x5b04e8){_0x3596ef=_0x5b04e8;_0x308205['model']=_['keys'](db['Team'][_0xd31a('0x1e')]);_0x308205[_0xd31a('0x25')]=_[_0xd31a('0x2a')](_0x2be9a2[_0xd31a('0x25')]);_0x308205['filters']=_[_0xd31a('0x2c')](_0x308205['model'],_0x308205['query']);_0x58f6ef[_0xd31a('0x2d')]=_[_0xd31a('0x2c')](_0x308205[_0xd31a('0x29')],qs[_0xd31a('0x2e')](_0x2be9a2[_0xd31a('0x25')][_0xd31a('0x2e')]));_0x58f6ef['attributes']=_0x58f6ef[_0xd31a('0x2d')][_0xd31a('0x2f')]?_0x58f6ef['attributes']:_0x308205[_0xd31a('0x29')];_0x58f6ef[_0xd31a('0x42')]=qs['sort'](_0x2be9a2[_0xd31a('0x25')][_0xd31a('0x43')]);_0x58f6ef[_0xd31a('0x22')]=qs['filters'](_[_0xd31a('0x51')](_0x2be9a2[_0xd31a('0x25')],_0x308205[_0xd31a('0x2b')]));if(_0x2be9a2['query'][_0xd31a('0x45')]){_0x58f6ef[_0xd31a('0x22')]=_[_0xd31a('0x31')](_0x58f6ef[_0xd31a('0x22')],{'$or':_['map'](_0x58f6ef['attributes'],function(_0x2cb61b){var _0x7e1a9f={};_0x7e1a9f[_0x2cb61b]={'$like':'%'+_0x2be9a2['query'][_0xd31a('0x45')]+'%'};return _0x7e1a9f;})});}_0x58f6ef=_[_0xd31a('0x31')]({},_0x58f6ef,_0x2be9a2['options']);return _0x3596ef['getTeams'](_0x58f6ef);}})['then'](function(_0x96ba75){if(_0x96ba75){_0x13daf7=_0x96ba75[_0xd31a('0x2f')];if(!_0x2be9a2[_0xd31a('0x25')]['hasOwnProperty'](_0xd31a('0x41'))){_0x58f6ef[_0xd31a('0x10')]=qs[_0xd31a('0x10')](_0x2be9a2[_0xd31a('0x25')]['limit']);_0x58f6ef['offset']=qs[_0xd31a('0x12')](_0x2be9a2[_0xd31a('0x25')][_0xd31a('0x12')]);}return _0x3596ef[_0xd31a('0x50')](_0x58f6ef);}})['then'](function(_0xe7c246){if(_0xe7c246){return _0xe7c246?{'count':_0x13daf7,'rows':_0xe7c246}:null;}})[_0xd31a('0x16')](respondWithResult(_0xbdd742,null))['catch'](handleError(_0xbdd742,null));};exports[_0xd31a('0x52')]=function(_0x300e20,_0x451169){var _0x4c6fad=_0x300e20[_0xd31a('0x34')][_0xd31a('0x53')];return db[_0xd31a('0x54')][_0xd31a('0x47')]({'where':{'id':_0x4c6fad},'attributes':['id'],'include':[{'model':db[_0xd31a('0x55')],'as':_0xd31a('0x56'),'attributes':['id','name',_0xd31a('0x57'),'voicePause',_0xd31a('0x58')],'raw':!![]}]})['then'](function(_0x3b3fae){if(_0x3b3fae){var _0xea6028=_[_0xd31a('0x59')](_0x3b3fae,function(_0x212228){var _0x591da9=_0x212228[_0xd31a('0x17')]({'plain':!![]});return _0x591da9[_0xd31a('0x56')];});return db[_0xd31a('0x23')][_0xd31a('0x32')]({'where':{'id':_0x300e20[_0xd31a('0x28')]['id']}})[_0xd31a('0x16')](function(_0x3100e4){return db[_0xd31a('0x5a')]['transaction'](function(_0x3972dd){return _0x3100e4[_0xd31a('0x52')](_0x4c6fad,{'transaction':_0x3972dd})[_0xd31a('0x16')](function(){return BPromise[_0xd31a('0x5b')](_0xea6028,function(_0x5c476e){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x5c476e['id'],'MailQueueId':_0x300e20[_0xd31a('0x28')]['id']},'transaction':_0x3972dd});});})[_0xd31a('0x16')](function(){_0xea6028[_0xd31a('0x5c')](function(_0x2c8f72){socket[_0xd31a('0x5d')]('userMailQueue:save',{'UserId':_0x2c8f72['id'],'MailQueueId':_0x3100e4['id']});});});});});}})[_0xd31a('0x16')](respondWithStatusCode(_0x451169,null))['catch'](handleError(_0x451169,null));};exports['removeTeams']=function(_0x39488f,_0x330a8c){return db[_0xd31a('0x54')][_0xd31a('0x47')]({'where':{'id':_0x39488f[_0xd31a('0x25')][_0xd31a('0x53')]},'attributes':['id'],'include':[{'model':db[_0xd31a('0x55')],'as':_0xd31a('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x330a8c,null))[_0xd31a('0x16')](function(_0x11885a){var _0x3faa46=_[_0xd31a('0x46')](_0x11885a,'id');var _0x4236ac=[];var _0x2d55be=[];var _0x3559bf=squel[_0xd31a('0x5e')]();_0x3559bf[_0xd31a('0x5f')](_0xd31a('0x60'))[_0xd31a('0x61')]('team_has_mail_queues','tq')[_0xd31a('0x62')]('user_has_teams','ut',_0xd31a('0x63'))[_0xd31a('0x22')](_0xd31a('0x64'),_0x39488f[_0xd31a('0x28')]['id']);for(var _0x5c59b7=0x0;_0x5c59b7<_0x11885a['length'];_0x5c59b7+=0x1){let _0x554257=_0x11885a[_0x5c59b7];for(var _0x31c925=0x0;_0x31c925<_0x554257[_0xd31a('0x56')]['length'];_0x31c925+=0x1){let _0xdadabc=_0x554257[_0xd31a('0x56')][_0x31c925];var _0x4023cf=_0x3559bf['clone']();_0x4023cf['where'](_0xd31a('0x65'),_0xdadabc['id']);_0x2d55be[_0xd31a('0x66')](db[_0xd31a('0x5a')][_0xd31a('0x25')](_0x4023cf[_0xd31a('0x67')](),{'type':db['sequelize'][_0xd31a('0x68')][_0xd31a('0x69')]})['then'](function(_0x5195bd){if(_0x5195bd[_0xd31a('0x2f')]===0x1){return _0xdadabc['id'];}else{var _0x2f4d5f=_[_0xd31a('0x6a')](_[_0xd31a('0x46')](_0x5195bd,_0xd31a('0x6b')),function(_0x221f75){return _[_0xd31a('0x6c')](_0x3faa46,_0x221f75);});if(_0x2f4d5f){return _0xdadabc['id'];}}}));}}return BPromise[_0xd31a('0x6d')](_0x2d55be)[_0xd31a('0x16')](function(_0x4dfdcb){_0x4236ac=_(_0x4236ac)[_0xd31a('0x6e')](_0x4dfdcb)[_0xd31a('0x6f')]()[_0xd31a('0x70')]();return db['MailQueue'][_0xd31a('0x32')]({'where':{'id':_0x39488f[_0xd31a('0x28')]['id']}})['then'](function(_0x5a4886){return db[_0xd31a('0x5a')][_0xd31a('0x71')](function(_0x588de7){return _0x5a4886[_0xd31a('0x72')](_0x39488f[_0xd31a('0x25')][_0xd31a('0x53')],{'transaction':_0x588de7})['then'](function(){if(!_[_0xd31a('0x73')](_0x4236ac)){return _0x5a4886['removeAgents'](_0x4236ac,{'transaction':_0x588de7});}})[_0xd31a('0x16')](function(){_0x4236ac[_0xd31a('0x5c')](function(_0x2bc8a8){socket[_0xd31a('0x5d')](_0xd31a('0x74'),{'UserId':_0x2bc8a8,'MailQueueId':_0x5a4886['id']});});});});});});})[_0xd31a('0x16')](respondWithStatusCode(_0x330a8c,null))[_0xd31a('0x27')](handleError(_0x330a8c,null));};exports[_0xd31a('0x75')]=function(_0x3c804c,_0xc1ec23){return db[_0xd31a('0x23')][_0xd31a('0x32')]({'where':{'id':_0x3c804c[_0xd31a('0x28')]['id']}})[_0xd31a('0x16')](handleEntityNotFound(_0xc1ec23,null))['then'](function(_0x2fbc0b){if(_0x2fbc0b){return _0x2fbc0b['addAgents'](_0x3c804c[_0xd31a('0x34')][_0xd31a('0x53')],_['omit'](_0x3c804c['body'],[_0xd31a('0x53'),'id'])||{})[_0xd31a('0x76')](function(_0x21ac85){for(var _0x32ed88=0x0;_0x32ed88<_0x3c804c[_0xd31a('0x34')][_0xd31a('0x53')][_0xd31a('0x2f')];_0x32ed88+=0x1){socket[_0xd31a('0x5d')](_0xd31a('0x77'),{'UserId':Number(_0x3c804c['body']['ids'][_0x32ed88]),'MailQueueId':Number(_0x3c804c[_0xd31a('0x28')]['id'])});}return _0x21ac85;});}})[_0xd31a('0x16')](respondWithResult(_0xc1ec23,null))['catch'](handleError(_0xc1ec23,null));};exports[_0xd31a('0x78')]=function(_0x429586,_0x374036){return db[_0xd31a('0x23')][_0xd31a('0x32')]({'where':{'id':_0x429586['params']['id']}})[_0xd31a('0x16')](handleEntityNotFound(_0x374036,null))[_0xd31a('0x16')](function(_0x57a9a5){if(_0x57a9a5){return _0x57a9a5[_0xd31a('0x78')](_0x429586[_0xd31a('0x25')]['ids'])[_0xd31a('0x16')](function(){if(_[_0xd31a('0x79')](_0x429586['query'][_0xd31a('0x53')])){for(var _0x1172a1=0x0;_0x1172a1<_0x429586['query'][_0xd31a('0x53')][_0xd31a('0x2f')];_0x1172a1+=0x1){socket[_0xd31a('0x5d')](_0xd31a('0x74'),{'UserId':Number(_0x429586[_0xd31a('0x25')][_0xd31a('0x53')][_0x1172a1]),'MailQueueId':Number(_0x429586[_0xd31a('0x28')]['id'])});}}else{socket[_0xd31a('0x5d')](_0xd31a('0x74'),{'UserId':Number(_0x429586['query'][_0xd31a('0x53')]),'MailQueueId':Number(_0x429586[_0xd31a('0x28')]['id'])});}});}})[_0xd31a('0x16')](respondWithStatusCode(_0x374036,null))[_0xd31a('0x27')](handleError(_0x374036,null));};exports['getAgents']=function(_0x4f4a9c,_0x1f2c61){var _0xcdabde={};var _0x18adba={};var _0x1ba639;var _0x519cf6;return db[_0xd31a('0x23')][_0xd31a('0x3f')]({'where':{'id':_0x4f4a9c[_0xd31a('0x28')]['id']}})[_0xd31a('0x16')](handleEntityNotFound(_0x1f2c61,null))['then'](function(_0x325a78){if(_0x325a78){_0x1ba639=_0x325a78;_0x18adba['model']=_[_0xd31a('0x2a')](db[_0xd31a('0x55')][_0xd31a('0x1e')]);_0x18adba[_0xd31a('0x25')]=_['keys'](_0x4f4a9c['query']);_0x18adba['filters']=_[_0xd31a('0x2c')](_0x18adba[_0xd31a('0x29')],_0x18adba['query']);_0xcdabde['attributes']=_[_0xd31a('0x2c')](_0x18adba[_0xd31a('0x29')],qs[_0xd31a('0x2e')](_0x4f4a9c[_0xd31a('0x25')]['fields']));_0xcdabde['attributes']=_0xcdabde[_0xd31a('0x2d')]['length']?_0xcdabde[_0xd31a('0x2d')]:_0x18adba[_0xd31a('0x29')];_0xcdabde[_0xd31a('0x42')]=qs['sort'](_0x4f4a9c[_0xd31a('0x25')][_0xd31a('0x43')]);_0xcdabde['where']=qs[_0xd31a('0x2b')](_[_0xd31a('0x51')](_0x4f4a9c[_0xd31a('0x25')],_0x18adba['filters']));if(_0x4f4a9c['query'][_0xd31a('0x45')]){_0xcdabde[_0xd31a('0x22')]=_[_0xd31a('0x31')](_0xcdabde[_0xd31a('0x22')],{'$or':_['map'](_0xcdabde[_0xd31a('0x2d')],function(_0x706ac2){var _0x40add7={};_0x40add7[_0x706ac2]={'$like':'%'+_0x4f4a9c[_0xd31a('0x25')][_0xd31a('0x45')]+'%'};return _0x40add7;})});}_0xcdabde=_[_0xd31a('0x31')]({},_0xcdabde,_0x4f4a9c[_0xd31a('0x7a')]);return _0x1ba639[_0xd31a('0x7b')](_0xcdabde);}})[_0xd31a('0x16')](function(_0x94e479){if(_0x94e479){_0x519cf6=_0x94e479[_0xd31a('0x2f')];if(!_0x4f4a9c['query'][_0xd31a('0x7c')](_0xd31a('0x41'))){_0xcdabde[_0xd31a('0x10')]=qs[_0xd31a('0x10')](_0x4f4a9c['query'][_0xd31a('0x10')]);_0xcdabde[_0xd31a('0x12')]=qs[_0xd31a('0x12')](_0x4f4a9c[_0xd31a('0x25')][_0xd31a('0x12')]);}return _0x1ba639['getAgents'](_0xcdabde);}})[_0xd31a('0x16')](function(_0x1a4100){if(_0x1a4100){return _0x1a4100?{'count':_0x519cf6,'rows':_0x1a4100}:null;}})[_0xd31a('0x16')](respondWithResult(_0x1f2c61,null))['catch'](handleError(_0x1f2c61,null));}; \ No newline at end of file +var _0xb178=['then','destroy','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type','key','where','MailQueue','include','catch','show','params','model','query','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','user','get','role','userProfileId','autoAssociation','describe','getMembers','findOne','UserMailQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','MailQueueId','filter','findAll','User','findAndCountAll','UserId','mailPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','pick','ids','Agents','online','voicePause','interface','flatMap','each','findOrCreate','emit','userMailQueue:save','select','field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','sequelize','QueryTypes','every','includes','all','compact','value','transaction','removeTeams','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','status','end','json','offset','undefined','count','limit','set','Content-Range','update'];(function(_0xf0421f,_0x294e4f){var _0x4c3fc4=function(_0x40d277){while(--_0x40d277){_0xf0421f['push'](_0xf0421f['shift']());}};_0x4c3fc4(++_0x294e4f);}(_0xb178,0xd7));var _0x8b17=function(_0xd4f90b,_0x148333){_0xd4f90b=_0xd4f90b-0x0;var _0x451848=_0xb178[_0xd4f90b];return _0x451848;};'use strict';var BPromise=require(_0x8b17('0x0'));var util=require('util');var _=require(_0x8b17('0x1'));var squel=require(_0x8b17('0x2'));var Redis=require(_0x8b17('0x3'));var qs=require(_0x8b17('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x8b17('0x5'));var db=require(_0x8b17('0x6'))['db'];config[_0x8b17('0x7')]=_[_0x8b17('0x8')](config['redis'],{'host':_0x8b17('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b17('0x7')]));require(_0x8b17('0xa'))['register'](socket);function respondWithStatusCode(_0x504260,_0x46e47f){_0x46e47f=_0x46e47f||0xcc;return function(_0x1b3a41){if(_0x1b3a41){return _0x504260['sendStatus'](_0x46e47f);}return _0x504260[_0x8b17('0xb')](_0x46e47f)[_0x8b17('0xc')]();};}function respondWithResult(_0x1dc292,_0x2d44d9){_0x2d44d9=_0x2d44d9||0xc8;return function(_0x385a7c){if(_0x385a7c){return _0x1dc292[_0x8b17('0xb')](_0x2d44d9)[_0x8b17('0xd')](_0x385a7c);}};}function respondWithFilteredResult(_0x3adca2,_0x4184a9){return function(_0x13feb7){if(_0x13feb7){var _0x455832=typeof _0x4184a9[_0x8b17('0xe')]===_0x8b17('0xf')&&typeof _0x4184a9['limit']===_0x8b17('0xf');var _0x784714=_0x13feb7[_0x8b17('0x10')];var _0x1ddedb=_0x455832?0x0:_0x4184a9['offset'];var _0x2c8b05=_0x455832?_0x13feb7[_0x8b17('0x10')]:_0x4184a9['offset']+_0x4184a9[_0x8b17('0x11')];var _0x2a1a52;if(_0x2c8b05>=_0x784714){_0x2c8b05=_0x784714;_0x2a1a52=0xc8;}else{_0x2a1a52=0xce;}_0x3adca2['status'](_0x2a1a52);return _0x3adca2[_0x8b17('0x12')](_0x8b17('0x13'),_0x1ddedb+'-'+_0x2c8b05+'/'+_0x784714)['json'](_0x13feb7);}return null;};}function saveUpdates(_0x564eab){return function(_0x15e992){if(_0x15e992){return _0x15e992[_0x8b17('0x14')](_0x564eab)[_0x8b17('0x15')](function(_0x33c245){return _0x33c245;});}return null;};}function removeEntity(_0xac5524){return function(_0x4baf82){if(_0x4baf82){return _0x4baf82[_0x8b17('0x16')]()[_0x8b17('0x15')](function(){var _0x54f01e=_0x4baf82['get']({'plain':!![]});var _0x581aec=_0x8b17('0x17');return db[_0x8b17('0x18')][_0x8b17('0x16')]({'where':{'type':_0x581aec,'resourceId':_0x54f01e['id']}})[_0x8b17('0x15')](function(){return _0x4baf82;});})[_0x8b17('0x15')](function(){_0xac5524[_0x8b17('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c7a0c){return function(_0x564f89){if(!_0x564f89){_0x2c7a0c[_0x8b17('0x19')](0x194);}return _0x564f89;};}function handleError(_0x44afd2,_0x2c2dcd){_0x2c2dcd=_0x2c2dcd||0x1f4;return function(_0x2a8e55){logger[_0x8b17('0x1a')](_0x2a8e55[_0x8b17('0x1b')]);if(_0x2a8e55[_0x8b17('0x1c')]){delete _0x2a8e55[_0x8b17('0x1c')];}_0x44afd2['status'](_0x2c2dcd)[_0x8b17('0x1d')](_0x2a8e55);};}exports[_0x8b17('0x1e')]=function(_0x1e9324,_0x16783c){var _0x4960e8={};var _0x3e0e73={'count':0x0,'rows':[]};var _0xc9bcd4=_[_0x8b17('0x1f')](db['MailQueue']['rawAttributes'],function(_0x39034a){return{'name':_0x39034a[_0x8b17('0x20')],'type':_0x39034a[_0x8b17('0x21')][_0x8b17('0x22')]};});_0x4960e8=qs['getOptions'](_0xc9bcd4,_0x1e9324);var _0xa67d03={'where':_0x4960e8[_0x8b17('0x23')]};return db[_0x8b17('0x24')]['count'](_0xa67d03)[_0x8b17('0x15')](function(_0x3d0ab3){_0x3e0e73[_0x8b17('0x10')]=_0x3d0ab3;_0x4960e8[_0x8b17('0x25')]=qs[_0x8b17('0x25')](_0x1e9324['query']);return db[_0x8b17('0x24')]['findAll'](_0x4960e8);})['then'](function(_0x26c4ad){_0x3e0e73['rows']=_0x26c4ad;return _0x3e0e73;})['then'](respondWithFilteredResult(_0x16783c,_0x4960e8))[_0x8b17('0x26')](handleError(_0x16783c,null));};exports[_0x8b17('0x27')]=function(_0x320124,_0x166d2e){var _0x51bf10={'raw':!![],'where':{'id':_0x320124[_0x8b17('0x28')]['id']}},_0x3f0a83={};_0x3f0a83[_0x8b17('0x29')]=_['keys'](db['MailQueue']['rawAttributes']);_0x3f0a83[_0x8b17('0x2a')]=_[_0x8b17('0x2b')](_0x320124['query']);_0x3f0a83[_0x8b17('0x2c')]=_['intersection'](_0x3f0a83[_0x8b17('0x29')],_0x3f0a83['query']);_0x51bf10[_0x8b17('0x2d')]=_[_0x8b17('0x2e')](_0x3f0a83[_0x8b17('0x29')],qs[_0x8b17('0x2f')](_0x320124[_0x8b17('0x2a')][_0x8b17('0x2f')]));_0x51bf10[_0x8b17('0x2d')]=_0x51bf10[_0x8b17('0x2d')][_0x8b17('0x30')]?_0x51bf10[_0x8b17('0x2d')]:_0x3f0a83[_0x8b17('0x29')];if(_0x320124[_0x8b17('0x2a')][_0x8b17('0x31')]){_0x51bf10[_0x8b17('0x25')]=[{'all':!![]}];}_0x51bf10=_[_0x8b17('0x32')]({},_0x51bf10,_0x320124[_0x8b17('0x33')]);return db['MailQueue'][_0x8b17('0x34')](_0x51bf10)[_0x8b17('0x15')](handleEntityNotFound(_0x166d2e,null))[_0x8b17('0x15')](respondWithResult(_0x166d2e,null))[_0x8b17('0x26')](handleError(_0x166d2e,null));};exports[_0x8b17('0x35')]=function(_0x1282b9,_0x4faa2d){return db[_0x8b17('0x24')][_0x8b17('0x35')](_0x1282b9[_0x8b17('0x36')],{})['then'](function(_0x45f10b){var _0x3599a2=_0x1282b9[_0x8b17('0x37')][_0x8b17('0x38')]({'plain':!![]});if(!_0x3599a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3599a2[_0x8b17('0x39')]==='user'){var _0x467e1a=_0x45f10b[_0x8b17('0x38')]({'plain':!![]});var _0x46573a='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x46573a,'userProfileId':_0x3599a2[_0x8b17('0x3a')]},'raw':!![]})['then'](function(_0x33fa3e){if(_0x33fa3e&&_0x33fa3e[_0x8b17('0x3b')]===0x0){return db[_0x8b17('0x18')]['create']({'name':_0x467e1a[_0x8b17('0x1c')],'resourceId':_0x467e1a['id'],'type':_0x33fa3e[_0x8b17('0x1c')],'sectionId':_0x33fa3e['id']},{})['then'](function(){return _0x45f10b;});}else{return _0x45f10b;}})['catch'](function(_0x16c900){logger[_0x8b17('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16c900);throw _0x16c900;});}return _0x45f10b;})['then'](respondWithResult(_0x4faa2d,0xc9))[_0x8b17('0x26')](handleError(_0x4faa2d,null));};exports[_0x8b17('0x14')]=function(_0x4891d8,_0x1e848b){if(_0x4891d8[_0x8b17('0x36')]['id']){delete _0x4891d8[_0x8b17('0x36')]['id'];}return db[_0x8b17('0x24')][_0x8b17('0x34')]({'where':{'id':_0x4891d8[_0x8b17('0x28')]['id']}})[_0x8b17('0x15')](handleEntityNotFound(_0x1e848b,null))[_0x8b17('0x15')](saveUpdates(_0x4891d8[_0x8b17('0x36')],null))[_0x8b17('0x15')](respondWithResult(_0x1e848b,null))['catch'](handleError(_0x1e848b,null));};exports[_0x8b17('0x16')]=function(_0xe7a557,_0x234cc8){return db['MailQueue'][_0x8b17('0x34')]({'where':{'id':_0xe7a557['params']['id']}})[_0x8b17('0x15')](handleEntityNotFound(_0x234cc8,null))[_0x8b17('0x15')](removeEntity(_0x234cc8,null))[_0x8b17('0x26')](handleError(_0x234cc8,null));};exports[_0x8b17('0x3c')]=function(_0x373541,_0x2d9e05){return db[_0x8b17('0x24')][_0x8b17('0x3c')]()[_0x8b17('0x15')](respondWithResult(_0x2d9e05,null))[_0x8b17('0x26')](handleError(_0x2d9e05,null));};exports[_0x8b17('0x3d')]=function(_0x4c036c,_0x58094c){var _0x507a2b={'raw':!![],'where':{}},_0x13883c={},_0x1979b3;return db[_0x8b17('0x24')][_0x8b17('0x3e')]({'where':{'id':_0x4c036c[_0x8b17('0x28')]['id']}})['then'](handleEntityNotFound(_0x58094c,null))[_0x8b17('0x15')](function(_0x3fa858){if(_0x3fa858){_0x1979b3=_0x3fa858[_0x8b17('0x38')]({'plain':!![]});_0x13883c['model']=_[_0x8b17('0x2b')](db[_0x8b17('0x3f')][_0x8b17('0x40')]);_0x13883c['query']=_[_0x8b17('0x2b')](_0x4c036c['query']);_0x13883c[_0x8b17('0x2c')]=_[_0x8b17('0x2e')](_0x13883c['model'],_0x13883c['query']);_0x507a2b['attributes']=_['intersection'](_0x13883c[_0x8b17('0x29')],qs[_0x8b17('0x2f')](_0x4c036c[_0x8b17('0x2a')][_0x8b17('0x2f')]));_0x507a2b['attributes']=_0x507a2b[_0x8b17('0x2d')][_0x8b17('0x30')]?_0x507a2b['attributes']:_0x13883c[_0x8b17('0x29')];if(!_0x4c036c[_0x8b17('0x2a')][_0x8b17('0x41')](_0x8b17('0x42'))){_0x507a2b[_0x8b17('0x11')]=qs[_0x8b17('0x11')](_0x4c036c['query'][_0x8b17('0x11')]);_0x507a2b[_0x8b17('0xe')]=qs[_0x8b17('0xe')](_0x4c036c[_0x8b17('0x2a')][_0x8b17('0xe')]);}_0x507a2b[_0x8b17('0x43')]=qs[_0x8b17('0x44')](_0x4c036c[_0x8b17('0x2a')][_0x8b17('0x44')]);_0x507a2b[_0x8b17('0x23')]=qs[_0x8b17('0x2c')](_['pick'](_0x4c036c[_0x8b17('0x2a')],_0x13883c[_0x8b17('0x2c')]));_0x507a2b[_0x8b17('0x23')][_0x8b17('0x45')]=_0x3fa858['id'];if(_0x4c036c[_0x8b17('0x2a')][_0x8b17('0x46')]){_0x507a2b[_0x8b17('0x23')]=_['merge'](_0x507a2b[_0x8b17('0x23')],{'$or':_[_0x8b17('0x1f')](_0x507a2b[_0x8b17('0x2d')],function(_0x181243){var _0x4238f5={};_0x4238f5[_0x181243]={'$like':'%'+_0x4c036c[_0x8b17('0x2a')][_0x8b17('0x46')]+'%'};return _0x4238f5;})});}_0x507a2b=_['merge']({},_0x507a2b,_0x4c036c[_0x8b17('0x33')]);return db[_0x8b17('0x3f')][_0x8b17('0x47')](_0x507a2b);}})[_0x8b17('0x15')](function(_0x15e3be){if(_0x15e3be){return db[_0x8b17('0x48')][_0x8b17('0x49')]({'where':{'id':_[_0x8b17('0x1f')](_0x15e3be,_0x8b17('0x4a')),'role':'agent'},'attributes':['id','name',_0x8b17('0x4b'),_0x8b17('0x4c'),'createdAt']});}})[_0x8b17('0x15')](function(_0x4dfa62){if(_0x4dfa62){return{'count':_0x4dfa62[_0x8b17('0x10')],'rows':_[_0x8b17('0x1f')](_0x4dfa62[_0x8b17('0x4d')],function(_0xa58814){return{'membername':_0xa58814[_0x8b17('0x1c')],'UserId':_0xa58814['id'],'queue_name':_0x1979b3[_0x8b17('0x1c')],'MailQueueId':_0x1979b3['id'],'interface':util[_0x8b17('0x4e')](_0x8b17('0x4f'),_0x8b17('0x50'),_0xa58814[_0x8b17('0x1c')]),'penalty':0x0,'paused':_0xa58814[_0x8b17('0x4b')],'createdAt':_0xa58814[_0x8b17('0x51')],'updatedAt':_0xa58814[_0x8b17('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x58094c,_0x507a2b))[_0x8b17('0x26')](handleError(_0x58094c,null));};exports[_0x8b17('0x52')]=function(_0x279975,_0x155388){var _0x330b2c={};var _0x418268={};var _0x48a471;var _0x561884;return db[_0x8b17('0x24')][_0x8b17('0x3e')]({'where':{'id':_0x279975[_0x8b17('0x28')]['id']}})['then'](handleEntityNotFound(_0x155388,null))['then'](function(_0x559680){if(_0x559680){_0x48a471=_0x559680;_0x418268[_0x8b17('0x29')]=_[_0x8b17('0x2b')](db[_0x8b17('0x53')][_0x8b17('0x40')]);_0x418268['query']=_[_0x8b17('0x2b')](_0x279975[_0x8b17('0x2a')]);_0x418268[_0x8b17('0x2c')]=_[_0x8b17('0x2e')](_0x418268[_0x8b17('0x29')],_0x418268['query']);_0x330b2c[_0x8b17('0x2d')]=_[_0x8b17('0x2e')](_0x418268['model'],qs['fields'](_0x279975[_0x8b17('0x2a')][_0x8b17('0x2f')]));_0x330b2c['attributes']=_0x330b2c[_0x8b17('0x2d')]['length']?_0x330b2c[_0x8b17('0x2d')]:_0x418268['model'];_0x330b2c[_0x8b17('0x43')]=qs[_0x8b17('0x44')](_0x279975['query'][_0x8b17('0x44')]);_0x330b2c[_0x8b17('0x23')]=qs[_0x8b17('0x2c')](_[_0x8b17('0x54')](_0x279975[_0x8b17('0x2a')],_0x418268[_0x8b17('0x2c')]));if(_0x279975['query'][_0x8b17('0x46')]){_0x330b2c[_0x8b17('0x23')]=_[_0x8b17('0x32')](_0x330b2c[_0x8b17('0x23')],{'$or':_['map'](_0x330b2c[_0x8b17('0x2d')],function(_0x38f71e){var _0x550e6a={};_0x550e6a[_0x38f71e]={'$like':'%'+_0x279975[_0x8b17('0x2a')][_0x8b17('0x46')]+'%'};return _0x550e6a;})});}_0x330b2c=_[_0x8b17('0x32')]({},_0x330b2c,_0x279975[_0x8b17('0x33')]);return _0x48a471['getTeams'](_0x330b2c);}})['then'](function(_0x65efd5){if(_0x65efd5){_0x561884=_0x65efd5[_0x8b17('0x30')];if(!_0x279975[_0x8b17('0x2a')][_0x8b17('0x41')]('nolimit')){_0x330b2c[_0x8b17('0x11')]=qs[_0x8b17('0x11')](_0x279975['query'][_0x8b17('0x11')]);_0x330b2c['offset']=qs[_0x8b17('0xe')](_0x279975[_0x8b17('0x2a')][_0x8b17('0xe')]);}return _0x48a471['getTeams'](_0x330b2c);}})[_0x8b17('0x15')](function(_0x1c7ea2){if(_0x1c7ea2){return _0x1c7ea2?{'count':_0x561884,'rows':_0x1c7ea2}:null;}})[_0x8b17('0x15')](respondWithResult(_0x155388,null))[_0x8b17('0x26')](handleError(_0x155388,null));};exports['addTeams']=function(_0x344162,_0x522d2d){var _0x410b9e=_0x344162[_0x8b17('0x36')][_0x8b17('0x55')];return db[_0x8b17('0x53')][_0x8b17('0x47')]({'where':{'id':_0x410b9e},'attributes':['id'],'include':[{'model':db[_0x8b17('0x48')],'as':_0x8b17('0x56'),'attributes':['id',_0x8b17('0x1c'),_0x8b17('0x57'),_0x8b17('0x58'),_0x8b17('0x59')],'raw':!![]}]})['then'](function(_0x38f12f){if(_0x38f12f){var _0x2a43f7=_[_0x8b17('0x5a')](_0x38f12f,function(_0x1ee706){var _0x319822=_0x1ee706[_0x8b17('0x38')]({'plain':!![]});return _0x319822[_0x8b17('0x56')];});return db[_0x8b17('0x24')][_0x8b17('0x34')]({'where':{'id':_0x344162[_0x8b17('0x28')]['id']}})[_0x8b17('0x15')](function(_0x247d5f){return db['sequelize']['transaction'](function(_0x179417){return _0x247d5f['addTeams'](_0x410b9e,{'transaction':_0x179417})[_0x8b17('0x15')](function(){return BPromise[_0x8b17('0x5b')](_0x2a43f7,function(_0x44b88e){return db['UserMailQueue'][_0x8b17('0x5c')]({'where':{'UserId':_0x44b88e['id'],'MailQueueId':_0x344162[_0x8b17('0x28')]['id']},'transaction':_0x179417});});})['then'](function(){_0x2a43f7['forEach'](function(_0x2528ab){socket[_0x8b17('0x5d')](_0x8b17('0x5e'),{'UserId':_0x2528ab['id'],'MailQueueId':_0x247d5f['id']});});});});});}})[_0x8b17('0x15')](respondWithStatusCode(_0x522d2d,null))[_0x8b17('0x26')](handleError(_0x522d2d,null));};exports['removeTeams']=function(_0x2d6a73,_0x36bcf9){return db[_0x8b17('0x53')][_0x8b17('0x47')]({'where':{'id':_0x2d6a73['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x36bcf9,null))[_0x8b17('0x15')](function(_0x48e322){var _0x3dde7e=_[_0x8b17('0x1f')](_0x48e322,'id');var _0x1d3ba8=[];var _0x39ea87=[];var _0x1dc81d=squel[_0x8b17('0x5f')]();_0x1dc81d[_0x8b17('0x60')]('tq.TeamId')[_0x8b17('0x61')](_0x8b17('0x62'),'tq')[_0x8b17('0x63')]('user_has_teams','ut',_0x8b17('0x64'))[_0x8b17('0x23')]('MailQueueId\x20=\x20?',_0x2d6a73[_0x8b17('0x28')]['id']);for(var _0x581e4a=0x0;_0x581e4a<_0x48e322['length'];_0x581e4a+=0x1){let _0x5ba589=_0x48e322[_0x581e4a];for(var _0x56bab8=0x0;_0x56bab8<_0x5ba589[_0x8b17('0x56')][_0x8b17('0x30')];_0x56bab8+=0x1){let _0x49e34f=_0x5ba589[_0x8b17('0x56')][_0x56bab8];var _0x524b55=_0x1dc81d[_0x8b17('0x65')]();_0x524b55[_0x8b17('0x23')]('ut.UserId\x20=\x20?',_0x49e34f['id']);_0x39ea87['push'](db[_0x8b17('0x66')]['query'](_0x524b55['toString'](),{'type':db[_0x8b17('0x66')][_0x8b17('0x67')]['SELECT']})[_0x8b17('0x15')](function(_0x232d63){if(_0x232d63['length']===0x1){return _0x49e34f['id'];}else{var _0x587628=_[_0x8b17('0x68')](_[_0x8b17('0x1f')](_0x232d63,'TeamId'),function(_0x1e699c){return _[_0x8b17('0x69')](_0x3dde7e,_0x1e699c);});if(_0x587628){return _0x49e34f['id'];}}}));}}return BPromise[_0x8b17('0x6a')](_0x39ea87)[_0x8b17('0x15')](function(_0x4f58e8){_0x1d3ba8=_(_0x1d3ba8)['union'](_0x4f58e8)[_0x8b17('0x6b')]()[_0x8b17('0x6c')]();return db[_0x8b17('0x24')][_0x8b17('0x34')]({'where':{'id':_0x2d6a73['params']['id']}})[_0x8b17('0x15')](function(_0x8640f){return db[_0x8b17('0x66')][_0x8b17('0x6d')](function(_0x43e685){return _0x8640f[_0x8b17('0x6e')](_0x2d6a73[_0x8b17('0x2a')][_0x8b17('0x55')],{'transaction':_0x43e685})[_0x8b17('0x15')](function(){if(!_['isEmpty'](_0x1d3ba8)){return _0x8640f[_0x8b17('0x6f')](_0x1d3ba8,{'transaction':_0x43e685});}})[_0x8b17('0x15')](function(){_0x1d3ba8['forEach'](function(_0x477039){socket[_0x8b17('0x5d')](_0x8b17('0x70'),{'UserId':_0x477039,'MailQueueId':_0x8640f['id']});});});});});});})[_0x8b17('0x15')](respondWithStatusCode(_0x36bcf9,null))[_0x8b17('0x26')](handleError(_0x36bcf9,null));};exports[_0x8b17('0x71')]=function(_0x1fea01,_0x14f6ff){return db[_0x8b17('0x24')][_0x8b17('0x34')]({'where':{'id':_0x1fea01[_0x8b17('0x28')]['id']}})[_0x8b17('0x15')](handleEntityNotFound(_0x14f6ff,null))[_0x8b17('0x15')](function(_0x100655){if(_0x100655){return _0x100655[_0x8b17('0x71')](_0x1fea01['body']['ids'],_[_0x8b17('0x72')](_0x1fea01[_0x8b17('0x36')],[_0x8b17('0x55'),'id'])||{})[_0x8b17('0x73')](function(_0x363f6a){for(var _0x3fc917=0x0;_0x3fc917<_0x1fea01[_0x8b17('0x36')]['ids']['length'];_0x3fc917+=0x1){socket[_0x8b17('0x5d')](_0x8b17('0x5e'),{'UserId':Number(_0x1fea01['body']['ids'][_0x3fc917]),'MailQueueId':Number(_0x1fea01[_0x8b17('0x28')]['id'])});}return _0x363f6a;});}})[_0x8b17('0x15')](respondWithResult(_0x14f6ff,null))[_0x8b17('0x26')](handleError(_0x14f6ff,null));};exports[_0x8b17('0x6f')]=function(_0x446fa0,_0x5db9ba){return db[_0x8b17('0x24')][_0x8b17('0x34')]({'where':{'id':_0x446fa0[_0x8b17('0x28')]['id']}})[_0x8b17('0x15')](handleEntityNotFound(_0x5db9ba,null))[_0x8b17('0x15')](function(_0x78debe){if(_0x78debe){return _0x78debe[_0x8b17('0x6f')](_0x446fa0[_0x8b17('0x2a')][_0x8b17('0x55')])[_0x8b17('0x15')](function(){if(_[_0x8b17('0x74')](_0x446fa0[_0x8b17('0x2a')]['ids'])){for(var _0xc43143=0x0;_0xc43143<_0x446fa0[_0x8b17('0x2a')][_0x8b17('0x55')][_0x8b17('0x30')];_0xc43143+=0x1){socket[_0x8b17('0x5d')](_0x8b17('0x70'),{'UserId':Number(_0x446fa0[_0x8b17('0x2a')][_0x8b17('0x55')][_0xc43143]),'MailQueueId':Number(_0x446fa0['params']['id'])});}}else{socket[_0x8b17('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x446fa0[_0x8b17('0x2a')][_0x8b17('0x55')]),'MailQueueId':Number(_0x446fa0['params']['id'])});}});}})[_0x8b17('0x15')](respondWithStatusCode(_0x5db9ba,null))['catch'](handleError(_0x5db9ba,null));};exports[_0x8b17('0x75')]=function(_0x98e429,_0x150d83){var _0x5dd187={};var _0x27b2ca={};var _0x5a8af7;var _0x3d30ac;return db[_0x8b17('0x24')][_0x8b17('0x3e')]({'where':{'id':_0x98e429[_0x8b17('0x28')]['id']}})[_0x8b17('0x15')](handleEntityNotFound(_0x150d83,null))[_0x8b17('0x15')](function(_0x2c1b04){if(_0x2c1b04){_0x5a8af7=_0x2c1b04;_0x27b2ca[_0x8b17('0x29')]=_['keys'](db[_0x8b17('0x48')][_0x8b17('0x40')]);_0x27b2ca[_0x8b17('0x2a')]=_[_0x8b17('0x2b')](_0x98e429[_0x8b17('0x2a')]);_0x27b2ca[_0x8b17('0x2c')]=_[_0x8b17('0x2e')](_0x27b2ca[_0x8b17('0x29')],_0x27b2ca[_0x8b17('0x2a')]);_0x5dd187[_0x8b17('0x2d')]=_[_0x8b17('0x2e')](_0x27b2ca['model'],qs['fields'](_0x98e429['query'][_0x8b17('0x2f')]));_0x5dd187[_0x8b17('0x2d')]=_0x5dd187['attributes'][_0x8b17('0x30')]?_0x5dd187[_0x8b17('0x2d')]:_0x27b2ca[_0x8b17('0x29')];_0x5dd187[_0x8b17('0x43')]=qs['sort'](_0x98e429['query'][_0x8b17('0x44')]);_0x5dd187[_0x8b17('0x23')]=qs[_0x8b17('0x2c')](_[_0x8b17('0x54')](_0x98e429[_0x8b17('0x2a')],_0x27b2ca[_0x8b17('0x2c')]));if(_0x98e429[_0x8b17('0x2a')][_0x8b17('0x46')]){_0x5dd187[_0x8b17('0x23')]=_[_0x8b17('0x32')](_0x5dd187[_0x8b17('0x23')],{'$or':_[_0x8b17('0x1f')](_0x5dd187[_0x8b17('0x2d')],function(_0x44e1f3){var _0x4c1cda={};_0x4c1cda[_0x44e1f3]={'$like':'%'+_0x98e429[_0x8b17('0x2a')][_0x8b17('0x46')]+'%'};return _0x4c1cda;})});}_0x5dd187=_[_0x8b17('0x32')]({},_0x5dd187,_0x98e429[_0x8b17('0x33')]);return _0x5a8af7[_0x8b17('0x75')](_0x5dd187);}})[_0x8b17('0x15')](function(_0x41041d){if(_0x41041d){_0x3d30ac=_0x41041d[_0x8b17('0x30')];if(!_0x98e429[_0x8b17('0x2a')][_0x8b17('0x41')]('nolimit')){_0x5dd187[_0x8b17('0x11')]=qs['limit'](_0x98e429[_0x8b17('0x2a')][_0x8b17('0x11')]);_0x5dd187['offset']=qs[_0x8b17('0xe')](_0x98e429[_0x8b17('0x2a')][_0x8b17('0xe')]);}return _0x5a8af7['getAgents'](_0x5dd187);}})[_0x8b17('0x15')](function(_0x187c58){if(_0x187c58){return _0x187c58?{'count':_0x3d30ac,'rows':_0x187c58}:null;}})['then'](respondWithResult(_0x150d83,null))[_0x8b17('0x26')](handleError(_0x150d83,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c94f828..ecefddb 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 _0x6c7b=['hasOwnProperty','events','../../mysqldb','MailQueue','save','update','emit'];(function(_0x4bb8a,_0x4dab63){var _0x3ef06c=function(_0x5a0d8f){while(--_0x5a0d8f){_0x4bb8a['push'](_0x4bb8a['shift']());}};_0x3ef06c(++_0x4dab63);}(_0x6c7b,0x13c));var _0xb6c7=function(_0x20de73,_0x2cbf6e){_0x20de73=_0x20de73-0x0;var _0x4d315c=_0x6c7b[_0x20de73];return _0x4d315c;};'use strict';var EventEmitter=require(_0xb6c7('0x0'));var MailQueue=require(_0xb6c7('0x1'))['db'][_0xb6c7('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6c7('0x3'),'afterUpdate':_0xb6c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5b6d8f){return function(_0x178245,_0x4fca47,_0x3e4bbf){MailQueueEvents[_0xb6c7('0x5')](_0x5b6d8f+':'+_0x178245['id'],_0x178245);MailQueueEvents[_0xb6c7('0x5')](_0x5b6d8f,_0x178245);_0x3e4bbf(null);};}for(var e in events){if(events[_0xb6c7('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x4fc9=['hook','exports','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1bba6c,_0x1f94cf){var _0x415735=function(_0x3ef30d){while(--_0x3ef30d){_0x1bba6c['push'](_0x1bba6c['shift']());}};_0x415735(++_0x1f94cf);}(_0x4fc9,0xbf));var _0x94fc=function(_0x3f91c7,_0x4b584d){_0x3f91c7=_0x3f91c7-0x0;var _0x5ed600=_0x4fc9[_0x3f91c7];return _0x5ed600;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x94fc('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x94fc('0x1'),'afterDestroy':_0x94fc('0x2')};function emitEvent(_0x321c31){return function(_0x4530c3,_0xf34be6,_0x20bb09){MailQueueEvents[_0x94fc('0x3')](_0x321c31+':'+_0x4530c3['id'],_0x4530c3);MailQueueEvents['emit'](_0x321c31,_0x4530c3);_0x20bb09(null);};}for(var e in events){if(events[_0x94fc('0x4')](e)){var event=events[e];MailQueue[_0x94fc('0x5')](e,emitEvent(event));}}module[_0x94fc('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9af3681..973c14f 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 _0xc124=['./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4e5d98,_0x16583b){var _0x218ac1=function(_0x5da98b){while(--_0x5da98b){_0x4e5d98['push'](_0x4e5d98['shift']());}};_0x218ac1(++_0x16583b);}(_0xc124,0xa0));var _0x4c12=function(_0x87a231,_0x47c997){_0x87a231=_0x87a231-0x0;var _0x1298de=_0xc124[_0x87a231];return _0x1298de;};'use strict';var _=require(_0x4c12('0x0'));var util=require(_0x4c12('0x1'));var logger=require(_0x4c12('0x2'))(_0x4c12('0x3'));var moment=require(_0x4c12('0x4'));var BPromise=require(_0x4c12('0x5'));var rp=require(_0x4c12('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c12('0x7'));var config=require(_0x4c12('0x8'));var attributes=require(_0x4c12('0x9'));module[_0x4c12('0xa')]=function(_0x49497f,_0x11f6e2){return _0x49497f['define'](_0x4c12('0xb'),attributes,{'tableName':_0x4c12('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28bc=['api','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','lodash','util','../../config/logger'];(function(_0x315585,_0x5c5425){var _0x591a08=function(_0x47c804){while(--_0x47c804){_0x315585['push'](_0x315585['shift']());}};_0x591a08(++_0x5c5425);}(_0x28bc,0x8d));var _0xc28b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x28bc[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc28b('0x0'));var util=require(_0xc28b('0x1'));var logger=require(_0xc28b('0x2'))(_0xc28b('0x3'));var moment=require('moment');var BPromise=require(_0xc28b('0x4'));var rp=require(_0xc28b('0x5'));var fs=require('fs');var path=require(_0xc28b('0x6'));var rimraf=require(_0xc28b('0x7'));var config=require('../../config/environment');var attributes=require(_0xc28b('0x8'));module[_0xc28b('0x9')]=function(_0x542cd3,_0x33497c){return _0x542cd3[_0xc28b('0xa')](_0xc28b('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index d1691c1..bf5d715 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 _0xa923=['message','result','catch','MailQueue','findAll','options','raw','attributes','include','map','model','GetMailQueue','debug','where','ShowMailQueue','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1445d4,_0x3db2df){var _0x15d47b=function(_0x511372){while(--_0x511372){_0x1445d4['push'](_0x1445d4['shift']());}};_0x15d47b(++_0x3db2df);}(_0xa923,0xc8));var _0x3a92=function(_0x4acdee,_0x178e20){_0x4acdee=_0x4acdee-0x0;var _0x53cb5f=_0xa923[_0x4acdee];return _0x53cb5f;};'use strict';var _=require(_0x3a92('0x0'));var util=require(_0x3a92('0x1'));var moment=require(_0x3a92('0x2'));var BPromise=require('bluebird');var rs=require(_0x3a92('0x3'));var fs=require('fs');var Redis=require(_0x3a92('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a92('0x5'))('rpc');var config=require(_0x3a92('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3a92('0x7')][_0x3a92('0x8')]({'port':0x232a});config[_0x3a92('0x9')]=_[_0x3a92('0xa')](config[_0x3a92('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a92('0xb'))(new Redis(config[_0x3a92('0x9')]));require('./mailQueue.socket')[_0x3a92('0xc')](socket);function respondWithRpcPromise(_0x5396da,_0x5c8b9d,_0x1d0447){return new BPromise(function(_0x4a725f,_0x47a216){return client[_0x3a92('0xd')](_0x5396da,_0x1d0447)[_0x3a92('0xe')](function(_0x35255b){logger[_0x3a92('0xf')](_0x3a92('0x10'),_0x5c8b9d,_0x3a92('0x11'));logger['debug'](_0x3a92('0x12'),_0x5c8b9d,_0x3a92('0x11'),JSON[_0x3a92('0x13')](_0x35255b));if(_0x35255b[_0x3a92('0x14')]){if(_0x35255b['error'][_0x3a92('0x15')]===0x1f4){logger[_0x3a92('0x14')](_0x3a92('0x10'),_0x5c8b9d,_0x35255b['error'][_0x3a92('0x16')]);return _0x47a216(_0x35255b[_0x3a92('0x14')][_0x3a92('0x16')]);}logger[_0x3a92('0x14')](_0x3a92('0x10'),_0x5c8b9d,_0x35255b['error']['message']);return _0x4a725f(_0x35255b[_0x3a92('0x14')][_0x3a92('0x16')]);}else{logger[_0x3a92('0xf')]('MailQueue,\x20%s,\x20%s',_0x5c8b9d,_0x3a92('0x11'));_0x4a725f(_0x35255b[_0x3a92('0x17')][_0x3a92('0x16')]);}})[_0x3a92('0x18')](function(_0x55fa95){logger[_0x3a92('0x14')](_0x3a92('0x10'),_0x5c8b9d,_0x55fa95);_0x47a216(_0x55fa95);});});}exports['GetMailQueue']=function(_0x58d000){var _0x28273d=this;return new Promise(function(_0x3a89d2,_0x2e0588){return db[_0x3a92('0x19')][_0x3a92('0x1a')]({'raw':_0x58d000[_0x3a92('0x1b')]?_0x58d000[_0x3a92('0x1b')][_0x3a92('0x1c')]===undefined?!![]:![]:!![],'where':_0x58d000[_0x3a92('0x1b')]?_0x58d000[_0x3a92('0x1b')]['where']||null:null,'attributes':_0x58d000[_0x3a92('0x1b')]?_0x58d000['options'][_0x3a92('0x1d')]||null:null,'limit':_0x58d000[_0x3a92('0x1b')]?_0x58d000[_0x3a92('0x1b')]['limit']||null:null,'include':_0x58d000[_0x3a92('0x1b')]?_0x58d000[_0x3a92('0x1b')][_0x3a92('0x1e')]?_[_0x3a92('0x1f')](_0x58d000['options'][_0x3a92('0x1e')],function(_0x54e0d9){return{'model':db[_0x54e0d9[_0x3a92('0x20')]],'as':_0x54e0d9['as'],'attributes':_0x54e0d9[_0x3a92('0x1d')],'include':_0x54e0d9[_0x3a92('0x1e')]?_[_0x3a92('0x1f')](_0x54e0d9[_0x3a92('0x1e')],function(_0x4ddaa0){return{'model':db[_0x4ddaa0[_0x3a92('0x20')]],'as':_0x4ddaa0['as'],'attributes':_0x4ddaa0[_0x3a92('0x1d')],'include':_0x4ddaa0['include']?_[_0x3a92('0x1f')](_0x4ddaa0['include'],function(_0x53e269){return{'model':db[_0x53e269[_0x3a92('0x20')]],'as':_0x53e269['as'],'attributes':_0x53e269['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ba558){logger[_0x3a92('0xf')](_0x3a92('0x21'),_0x58d000);logger[_0x3a92('0x22')]('GetMailQueue',_0x58d000,JSON['stringify'](_0x4ba558));_0x3a89d2(_0x4ba558);})['catch'](function(_0x3bcfe0){logger[_0x3a92('0x14')](_0x3a92('0x21'),_0x3bcfe0['message'],_0x58d000);_0x2e0588(_0x28273d[_0x3a92('0x14')](0x1f4,_0x3bcfe0[_0x3a92('0x16')]));});});};exports['ShowMailQueue']=function(_0xc59e02){var _0x490d9b=this;return new Promise(function(_0x1a90e1,_0x32a0f0){return db[_0x3a92('0x19')]['find']({'raw':_0xc59e02[_0x3a92('0x1b')]?_0xc59e02['options'][_0x3a92('0x1c')]===undefined?!![]:![]:!![],'where':_0xc59e02[_0x3a92('0x1b')]?_0xc59e02['options'][_0x3a92('0x23')]||null:null,'attributes':_0xc59e02[_0x3a92('0x1b')]?_0xc59e02[_0x3a92('0x1b')][_0x3a92('0x1d')]||null:null,'include':_0xc59e02[_0x3a92('0x1b')]?_0xc59e02[_0x3a92('0x1b')][_0x3a92('0x1e')]?_[_0x3a92('0x1f')](_0xc59e02[_0x3a92('0x1b')]['include'],function(_0x12bd3f){return{'model':db[_0x12bd3f[_0x3a92('0x20')]],'as':_0x12bd3f['as'],'attributes':_0x12bd3f[_0x3a92('0x1d')],'include':_0x12bd3f[_0x3a92('0x1e')]?_[_0x3a92('0x1f')](_0x12bd3f['include'],function(_0x37ec8d){return{'model':db[_0x37ec8d[_0x3a92('0x20')]],'as':_0x37ec8d['as'],'attributes':_0x37ec8d[_0x3a92('0x1d')],'include':_0x37ec8d[_0x3a92('0x1e')]?_[_0x3a92('0x1f')](_0x37ec8d['include'],function(_0x9e7e55){return{'model':db[_0x9e7e55[_0x3a92('0x20')]],'as':_0x9e7e55['as'],'attributes':_0x9e7e55[_0x3a92('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30a421){logger[_0x3a92('0xf')](_0x3a92('0x24'),_0xc59e02);logger[_0x3a92('0x22')](_0x3a92('0x24'),_0xc59e02,JSON[_0x3a92('0x13')](_0x30a421));_0x1a90e1(_0x30a421);})['catch'](function(_0x31d681){logger[_0x3a92('0x14')]('ShowMailQueue',_0x31d681[_0x3a92('0x16')],_0xc59e02);_0x32a0f0(_0x490d9b[_0x3a92('0x14')](0x1f4,_0x31d681[_0x3a92('0x16')]));});});}; \ No newline at end of file +var _0x2356=['debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailQueue','options','raw','where','attributes','limit','include','model','map','ShowMailQueue','find','util','moment','ioredis','../../mysqldb','rpc','client','http','redis','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x52f14e,_0x14b5d2){var _0x5c6398=function(_0x1d03b5){while(--_0x1d03b5){_0x52f14e['push'](_0x52f14e['shift']());}};_0x5c6398(++_0x14b5d2);}(_0x2356,0x14f));var _0x6235=function(_0x589cd1,_0x428041){_0x589cd1=_0x589cd1-0x0;var _0x59bb7e=_0x2356[_0x589cd1];return _0x59bb7e;};'use strict';var _=require('lodash');var util=require(_0x6235('0x0'));var moment=require(_0x6235('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6235('0x2'));var db=require(_0x6235('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6235('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6235('0x5')][_0x6235('0x6')]({'port':0x232a});config[_0x6235('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6235('0x8'))(new Redis(config['redis']));require(_0x6235('0x9'))[_0x6235('0xa')](socket);function respondWithRpcPromise(_0x3e0f96,_0x31fc6e,_0x5de19a){return new BPromise(function(_0x46fecf,_0x1b34a5){return client[_0x6235('0xb')](_0x3e0f96,_0x5de19a)[_0x6235('0xc')](function(_0x14342d){logger['info'](_0x6235('0xd'),_0x31fc6e,_0x6235('0xe'));logger[_0x6235('0xf')](_0x6235('0x10'),_0x31fc6e,'request\x20sent',JSON[_0x6235('0x11')](_0x14342d));if(_0x14342d[_0x6235('0x12')]){if(_0x14342d['error'][_0x6235('0x13')]===0x1f4){logger['error'](_0x6235('0xd'),_0x31fc6e,_0x14342d[_0x6235('0x12')]['message']);return _0x1b34a5(_0x14342d[_0x6235('0x12')][_0x6235('0x14')]);}logger[_0x6235('0x12')](_0x6235('0xd'),_0x31fc6e,_0x14342d['error'][_0x6235('0x14')]);return _0x46fecf(_0x14342d[_0x6235('0x12')][_0x6235('0x14')]);}else{logger[_0x6235('0x15')](_0x6235('0xd'),_0x31fc6e,_0x6235('0xe'));_0x46fecf(_0x14342d[_0x6235('0x16')][_0x6235('0x14')]);}})[_0x6235('0x17')](function(_0x1f8cd3){logger['error'](_0x6235('0xd'),_0x31fc6e,_0x1f8cd3);_0x1b34a5(_0x1f8cd3);});});}exports[_0x6235('0x18')]=function(_0x4a9846){var _0x534dab=this;return new Promise(function(_0x19075e,_0x4f0aa2){return db['MailQueue']['findAll']({'raw':_0x4a9846[_0x6235('0x19')]?_0x4a9846[_0x6235('0x19')][_0x6235('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a9846[_0x6235('0x19')]?_0x4a9846[_0x6235('0x19')][_0x6235('0x1b')]||null:null,'attributes':_0x4a9846['options']?_0x4a9846['options'][_0x6235('0x1c')]||null:null,'limit':_0x4a9846['options']?_0x4a9846[_0x6235('0x19')][_0x6235('0x1d')]||null:null,'include':_0x4a9846[_0x6235('0x19')]?_0x4a9846[_0x6235('0x19')][_0x6235('0x1e')]?_['map'](_0x4a9846[_0x6235('0x19')][_0x6235('0x1e')],function(_0x168b01){return{'model':db[_0x168b01[_0x6235('0x1f')]],'as':_0x168b01['as'],'attributes':_0x168b01[_0x6235('0x1c')],'include':_0x168b01['include']?_['map'](_0x168b01['include'],function(_0x4f28f2){return{'model':db[_0x4f28f2[_0x6235('0x1f')]],'as':_0x4f28f2['as'],'attributes':_0x4f28f2[_0x6235('0x1c')],'include':_0x4f28f2[_0x6235('0x1e')]?_[_0x6235('0x20')](_0x4f28f2[_0x6235('0x1e')],function(_0x2acc8c){return{'model':db[_0x2acc8c['model']],'as':_0x2acc8c['as'],'attributes':_0x2acc8c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x94db3c){logger['info'](_0x6235('0x18'),_0x4a9846);logger[_0x6235('0xf')]('GetMailQueue',_0x4a9846,JSON[_0x6235('0x11')](_0x94db3c));_0x19075e(_0x94db3c);})[_0x6235('0x17')](function(_0x5bb691){logger[_0x6235('0x12')](_0x6235('0x18'),_0x5bb691[_0x6235('0x14')],_0x4a9846);_0x4f0aa2(_0x534dab[_0x6235('0x12')](0x1f4,_0x5bb691[_0x6235('0x14')]));});});};exports[_0x6235('0x21')]=function(_0x281e01){var _0x43a430=this;return new Promise(function(_0x2bdeda,_0x2e233d){return db['MailQueue'][_0x6235('0x22')]({'raw':_0x281e01['options']?_0x281e01['options'][_0x6235('0x1a')]===undefined?!![]:![]:!![],'where':_0x281e01['options']?_0x281e01['options'][_0x6235('0x1b')]||null:null,'attributes':_0x281e01['options']?_0x281e01['options'][_0x6235('0x1c')]||null:null,'include':_0x281e01[_0x6235('0x19')]?_0x281e01[_0x6235('0x19')]['include']?_[_0x6235('0x20')](_0x281e01[_0x6235('0x19')][_0x6235('0x1e')],function(_0x4db26d){return{'model':db[_0x4db26d[_0x6235('0x1f')]],'as':_0x4db26d['as'],'attributes':_0x4db26d['attributes'],'include':_0x4db26d[_0x6235('0x1e')]?_[_0x6235('0x20')](_0x4db26d[_0x6235('0x1e')],function(_0xcb0901){return{'model':db[_0xcb0901[_0x6235('0x1f')]],'as':_0xcb0901['as'],'attributes':_0xcb0901['attributes'],'include':_0xcb0901[_0x6235('0x1e')]?_['map'](_0xcb0901[_0x6235('0x1e')],function(_0x706301){return{'model':db[_0x706301[_0x6235('0x1f')]],'as':_0x706301['as'],'attributes':_0x706301[_0x6235('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6235('0xc')](function(_0x4f0461){logger['info'](_0x6235('0x21'),_0x281e01);logger[_0x6235('0xf')](_0x6235('0x21'),_0x281e01,JSON[_0x6235('0x11')](_0x4f0461));_0x2bdeda(_0x4f0461);})[_0x6235('0x17')](function(_0x4057aa){logger[_0x6235('0x12')](_0x6235('0x21'),_0x4057aa[_0x6235('0x14')],_0x281e01);_0x2e233d(_0x43a430[_0x6235('0x12')](0x1f4,_0x4057aa['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 000304d..a3e6bba 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 _0x5577=['register','length','mailQueue:','./mailQueue.events','save','remove','update','emit'];(function(_0x471780,_0x2682cb){var _0x5ac9ea=function(_0x2503c5){while(--_0x2503c5){_0x471780['push'](_0x471780['shift']());}};_0x5ac9ea(++_0x2682cb);}(_0x5577,0xe3));var _0x7557=function(_0x579a16,_0x27986b){_0x579a16=_0x579a16-0x0;var _0x489de6=_0x5577[_0x579a16];return _0x489de6;};'use strict';var MailQueueEvents=require(_0x7557('0x0'));var events=[_0x7557('0x1'),_0x7557('0x2'),_0x7557('0x3')];function createListener(_0x68706b,_0x4c9745){return function(_0x37b00c){_0x4c9745[_0x7557('0x4')](_0x68706b,_0x37b00c);};}function removeListener(_0x2e56cc,_0xe4dc27){return function(){MailQueueEvents['removeListener'](_0x2e56cc,_0xe4dc27);};}exports[_0x7557('0x5')]=function(_0x2b18aa){for(var _0x5e8405=0x0,_0x1e3d11=events[_0x7557('0x6')];_0x5e8405<_0x1e3d11;_0x5e8405++){var _0x4f7fbf=events[_0x5e8405];var _0x5c1308=createListener(_0x7557('0x7')+_0x4f7fbf,_0x2b18aa);MailQueueEvents['on'](_0x4f7fbf,_0x5c1308);}}; \ No newline at end of file +var _0x2f38=['removeListener','length','mailQueue:','save','update','emit'];(function(_0x1f0398,_0x37a6dd){var _0x3f0ad5=function(_0x415f6c){while(--_0x415f6c){_0x1f0398['push'](_0x1f0398['shift']());}};_0x3f0ad5(++_0x37a6dd);}(_0x2f38,0x1a7));var _0x82f3=function(_0x5b2966,_0x46b811){_0x5b2966=_0x5b2966-0x0;var _0xcc60a0=_0x2f38[_0x5b2966];return _0xcc60a0;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x82f3('0x0'),'remove',_0x82f3('0x1')];function createListener(_0x5d800f,_0x656185){return function(_0x68d97e){_0x656185[_0x82f3('0x2')](_0x5d800f,_0x68d97e);};}function removeListener(_0x466e73,_0x4c5ab1){return function(){MailQueueEvents[_0x82f3('0x3')](_0x466e73,_0x4c5ab1);};}exports['register']=function(_0x5e4ca6){for(var _0x3a7717=0x0,_0x1c09a0=events[_0x82f3('0x4')];_0x3a7717<_0x1c09a0;_0x3a7717++){var _0x2c69d2=events[_0x3a7717];var _0x659a85=createListener(_0x82f3('0x5')+_0x2c69d2,_0x5e4ca6);MailQueueEvents['on'](_0x2c69d2,_0x659a85);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 67aca0b..66744ad 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 _0x4ebe=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5515a7,_0x2c4af1){var _0x43f4bf=function(_0x3d519d){while(--_0x3d519d){_0x5515a7['push'](_0x5515a7['shift']());}};_0x43f4bf(++_0x2c4af1);}(_0x4ebe,0x13a));var _0xe4eb=function(_0x2791df,_0x5828ef){_0x2791df=_0x2791df-0x0;var _0x18a89b=_0x4ebe[_0x2791df];return _0x18a89b;};'use strict';var multer=require(_0xe4eb('0x0'));var util=require('util');var path=require(_0xe4eb('0x1'));var timeout=require('connect-timeout');var express=require(_0xe4eb('0x2'));var router=express[_0xe4eb('0x3')]();var fs_extra=require(_0xe4eb('0x4'));var auth=require(_0xe4eb('0x5'));var interaction=require(_0xe4eb('0x6'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0xe4eb('0x7')]('/',auth[_0xe4eb('0x8')](),controller[_0xe4eb('0x9')]);router['get'](_0xe4eb('0xa'),auth['isAuthenticated'](),controller[_0xe4eb('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe4eb('0xc')]);router[_0xe4eb('0xd')]('/',auth[_0xe4eb('0x8')](),controller[_0xe4eb('0xe')]);router[_0xe4eb('0xf')](_0xe4eb('0x10'),auth[_0xe4eb('0x8')](),controller[_0xe4eb('0x11')]);router[_0xe4eb('0x12')](_0xe4eb('0x10'),auth['isAuthenticated'](),controller[_0xe4eb('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd2d6=['isAuthenticated','/:id','show','post','put','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','index'];(function(_0x3e020a,_0x13288a){var _0xb67446=function(_0x9d949f){while(--_0x9d949f){_0x3e020a['push'](_0x3e020a['shift']());}};_0xb67446(++_0x13288a);}(_0xd2d6,0x97));var _0x6d2d=function(_0x45811d,_0x4c81b1){_0x45811d=_0x45811d-0x0;var _0x3ee425=_0xd2d6[_0x45811d];return _0x3ee425;};'use strict';var multer=require(_0x6d2d('0x0'));var util=require('util');var path=require(_0x6d2d('0x1'));var timeout=require(_0x6d2d('0x2'));var express=require(_0x6d2d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6d2d('0x4'));var interaction=require(_0x6d2d('0x5'));var config=require('../../config/environment');var controller=require(_0x6d2d('0x6'));router[_0x6d2d('0x7')]('/',auth['isAuthenticated'](),controller[_0x6d2d('0x8')]);router[_0x6d2d('0x7')]('/describe',auth[_0x6d2d('0x9')](),controller['describe']);router[_0x6d2d('0x7')](_0x6d2d('0xa'),auth[_0x6d2d('0x9')](),controller[_0x6d2d('0xb')]);router[_0x6d2d('0xc')]('/',auth[_0x6d2d('0x9')](),controller['create']);router[_0x6d2d('0xd')](_0x6d2d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6d2d('0xe')](_0x6d2d('0xa'),auth[_0x6d2d('0x9')](),controller[_0x6d2d('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 4dbda49..c640a29 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 _0x8910=['moment','sequelize','exports','STRING','DATE'];(function(_0x4ed0a9,_0x292529){var _0x2b0944=function(_0x4814a4){while(--_0x4814a4){_0x4ed0a9['push'](_0x4ed0a9['shift']());}};_0x2b0944(++_0x292529);}(_0x8910,0xc8));var _0x0891=function(_0xef0ce4,_0x5c2cba){_0xef0ce4=_0xef0ce4-0x0;var _0x4193c3=_0x8910[_0xef0ce4];return _0x4193c3;};'use strict';var moment=require(_0x0891('0x0'));var Sequelize=require(_0x0891('0x1'));module[_0x0891('0x2')]={'uniqueid':{'type':Sequelize[_0x0891('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0891('0x3')]},'joinAt':{'type':Sequelize[_0x0891('0x4')]},'leaveAt':{'type':Sequelize[_0x0891('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0891('0x4')]},'reason':{'type':Sequelize[_0x0891('0x3')]}}; \ No newline at end of file +var _0x91ed=['exports','STRING','DATE','sequelize'];(function(_0x40bb0a,_0x199337){var _0x1d1a97=function(_0x14faa7){while(--_0x14faa7){_0x40bb0a['push'](_0x40bb0a['shift']());}};_0x1d1a97(++_0x199337);}(_0x91ed,0x7f));var _0xd91e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x91ed[_0x42cae2];return _0x5f256f;};'use strict';var moment=require('moment');var Sequelize=require(_0xd91e('0x0'));module[_0xd91e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd91e('0x2')]},'joinAt':{'type':Sequelize[_0xd91e('0x3')]},'leaveAt':{'type':Sequelize[_0xd91e('0x3')]},'acceptAt':{'type':Sequelize[_0xd91e('0x3')]},'exitAt':{'type':Sequelize[_0xd91e('0x3')]},'reason':{'type':Sequelize[_0xd91e('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6e11667..204a338 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 _0xb016=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','MailQueueReport','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body','describe','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0x5ba591,_0x3b64c2){var _0x64d937=function(_0x33794c){while(--_0x33794c){_0x5ba591['push'](_0x5ba591['shift']());}};_0x64d937(++_0x3b64c2);}(_0xb016,0x159));var _0x6b01=function(_0x37b619,_0x568827){_0x37b619=_0x37b619-0x0;var _0x1cc8ed=_0xb016[_0x37b619];return _0x1cc8ed;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['MailQueueReport'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));};exports[_0x6b01('0x45')]=function(_0x13ab4f,_0x5617d7){return db[_0x6b01('0x29')][_0x6b01('0x45')]()[_0x6b01('0x21')](respondWithResult(_0x5617d7,null))[_0x6b01('0x40')](handleError(_0x5617d7,null));}; \ No newline at end of file +var _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','MailQueueReport','find','catch','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x38ac66,_0x261995){var _0x2c041d=function(_0x47fbe2){while(--_0x47fbe2){_0x38ac66['push'](_0x38ac66['shift']());}};_0x2c041d(++_0x261995);}(_0x7096,0x10c));var _0x6709=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x7096[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['MailQueueReport'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['MailQueueReport'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':!![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['MailQueueReport'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['MailQueueReport']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['MailQueueReport'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['MailQueueReport'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index c700341..68cc4ed 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 _0x4662=['moment','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x52dbd5,_0x493a12){var _0x5570ff=function(_0x363e32){while(--_0x363e32){_0x52dbd5['push'](_0x52dbd5['shift']());}};_0x5570ff(++_0x493a12);}(_0x4662,0x1c4));var _0x2466=function(_0x7d272c,_0x302b37){_0x7d272c=_0x7d272c-0x0;var _0x381078=_0x4662[_0x7d272c];return _0x381078;};'use strict';var _=require(_0x2466('0x0'));var util=require('util');var logger=require(_0x2466('0x1'))(_0x2466('0x2'));var moment=require(_0x2466('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2466('0x4'));var rimraf=require(_0x2466('0x5'));var config=require(_0x2466('0x6'));var attributes=require(_0x2466('0x7'));module[_0x2466('0x8')]=function(_0x1321f1,_0x533b60){return _0x1321f1[_0x2466('0x9')](_0x2466('0xa'),attributes,{'tableName':_0x2466('0xb'),'paranoid':![],'indexes':[{'name':_0x2466('0xc'),'fields':[_0x2466('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec13=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x455c4a,_0x331a46){var _0x5af9f8=function(_0x110b11){while(--_0x110b11){_0x455c4a['push'](_0x455c4a['shift']());}};_0x5af9f8(++_0x331a46);}(_0xec13,0x8f));var _0x3ec1=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xec13[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x3ec1('0x0'));var util=require(_0x3ec1('0x1'));var logger=require(_0x3ec1('0x2'))('api');var moment=require(_0x3ec1('0x3'));var BPromise=require(_0x3ec1('0x4'));var rp=require(_0x3ec1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ec1('0x6'));var config=require(_0x3ec1('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x3ec1('0x8')]=function(_0x3e34f8,_0x44c946){return _0x3e34f8['define'](_0x3ec1('0x9'),attributes,{'tableName':_0x3ec1('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3ec1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index f443bcf..959a75e 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x88e8b0,_0x4a89e6){var _0x360960=function(_0x3a46f3){while(--_0x3a46f3){_0x88e8b0['push'](_0x88e8b0['shift']());}};_0x360960(++_0x4a89e6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x402529,_0x463584){var _0x8881d7=function(_0x750783){while(--_0x750783){_0x402529['push'](_0x402529['shift']());}};_0x8881d7(++_0x463584);}(_0x7a54,0x106));var _0x47a5=function(_0x33da6a,_0x1bc19){_0x33da6a=_0x33da6a-0x0;var _0x4c0f2b=_0x7a54[_0x33da6a];return _0x4c0f2b;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 0e368d6..1eb8443 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1e6352,_0x18dfcc){var _0x42ce5d=function(_0x531c47){while(--_0x531c47){_0x1e6352['push'](_0x1e6352['shift']());}};_0x42ce5d(++_0x18dfcc);}(_0xedd9,0xfc));var _0x9edd=function(_0x458d44,_0x45224c){_0x458d44=_0x458d44-0x0;var _0x5ac860=_0xedd9[_0x458d44];return _0x5ac860;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index f9445ad..bd187c3 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 _0x5cb8=['STRING','BOOLEAN','INTEGER','INBOX','exports'];(function(_0xda0c7b,_0x47a820){var _0x1c6567=function(_0x2870ea){while(--_0x2870ea){_0xda0c7b['push'](_0xda0c7b['shift']());}};_0x1c6567(++_0x47a820);}(_0x5cb8,0xef));var _0x85cb=function(_0x3134d2,_0xd6b6ed){_0x3134d2=_0x3134d2-0x0;var _0x2c5053=_0x5cb8[_0x3134d2];return _0x2c5053;};'use strict';var Sequelize=require('sequelize');module[_0x85cb('0x0')]={'description':{'type':Sequelize[_0x85cb('0x1')]},'host':{'type':Sequelize[_0x85cb('0x1')]},'authentication':{'type':Sequelize[_0x85cb('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x85cb('0x1')]},'password':{'type':Sequelize[_0x85cb('0x1')]},'port':{'type':Sequelize[_0x85cb('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x85cb('0x4')},'connTimeout':{'type':Sequelize[_0x85cb('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x85cb('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x85cb('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9ee9=['STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x33ffb0,_0x55842d){var _0x50cedb=function(_0x16aca3){while(--_0x16aca3){_0x33ffb0['push'](_0x33ffb0['shift']());}};_0x50cedb(++_0x55842d);}(_0x9ee9,0x144));var _0x99ee=function(_0x5c3941,_0x2f7f66){_0x5c3941=_0x5c3941-0x0;var _0x4f2b8b=_0x9ee9[_0x5c3941];return _0x4f2b8b;};'use strict';var Sequelize=require(_0x99ee('0x0'));module['exports']={'description':{'type':Sequelize[_0x99ee('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x99ee('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x99ee('0x1')]},'port':{'type':Sequelize[_0x99ee('0x3')]},'tls':{'type':Sequelize[_0x99ee('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x99ee('0x1')],'defaultValue':_0x99ee('0x4')},'connTimeout':{'type':Sequelize[_0x99ee('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x99ee('0x1')]},'modernAuthentication':{'type':Sequelize[_0x99ee('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index daf2cfa..a90b2a3 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 _0xf43f=['rimraf','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','util','moment','bluebird','request-promise','path'];(function(_0x2fafde,_0x341570){var _0x1b41f6=function(_0x1dc3e7){while(--_0x1dc3e7){_0x2fafde['push'](_0x2fafde['shift']());}};_0x1b41f6(++_0x341570);}(_0xf43f,0x1db));var _0xff43=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf43f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xff43('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xff43('0x1'));var BPromise=require(_0xff43('0x2'));var rp=require(_0xff43('0x3'));var fs=require('fs');var path=require(_0xff43('0x4'));var rimraf=require(_0xff43('0x5'));var config=require(_0xff43('0x6'));var attributes=require(_0xff43('0x7'));module['exports']=function(_0x552a9d,_0x790285){return _0x552a9d['define'](_0xff43('0x8'),attributes,{'tableName':_0xff43('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ba9=['../../config/environment','./mailServerIn.attributes','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x16d39b,_0x100769){var _0x1bf6da=function(_0x40e3e0){while(--_0x40e3e0){_0x16d39b['push'](_0x16d39b['shift']());}};_0x1bf6da(++_0x100769);}(_0x8ba9,0x163));var _0x98ba=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8ba9[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x98ba('0x0'));var util=require(_0x98ba('0x1'));var logger=require(_0x98ba('0x2'))('api');var moment=require(_0x98ba('0x3'));var BPromise=require(_0x98ba('0x4'));var rp=require(_0x98ba('0x5'));var fs=require('fs');var path=require(_0x98ba('0x6'));var rimraf=require(_0x98ba('0x7'));var config=require(_0x98ba('0x8'));var attributes=require(_0x98ba('0x9'));module['exports']=function(_0x168f64,_0x5b8936){return _0x168f64['define']('MailServerIn',attributes,{'tableName':_0x98ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 77670eb..2fa466e 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 _0xc94f=['include','model','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0xc94f,0xcd));var _0xfc94=function(_0x150aef,_0xb74cf6){_0x150aef=_0x150aef-0x0;var _0x254a5e=_0xc94f[_0x150aef];return _0x254a5e;};'use strict';var _=require(_0xfc94('0x0'));var util=require('util');var moment=require(_0xfc94('0x1'));var BPromise=require(_0xfc94('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc94('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc94('0x4'));var logger=require(_0xfc94('0x5'))(_0xfc94('0x6'));var config=require(_0xfc94('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x402ee9,_0xff28ad,_0x4dc395){return new BPromise(function(_0xe044e8,_0x47afb8){return client[_0xfc94('0x8')](_0x402ee9,_0x4dc395)[_0xfc94('0x9')](function(_0x4212af){logger[_0xfc94('0xa')]('MailServerIn,\x20%s,\x20%s',_0xff28ad,'request\x20sent');logger[_0xfc94('0xb')](_0xfc94('0xc'),_0xff28ad,_0xfc94('0xd'),JSON[_0xfc94('0xe')](_0x4212af));if(_0x4212af[_0xfc94('0xf')]){if(_0x4212af[_0xfc94('0xf')]['code']===0x1f4){logger['error'](_0xfc94('0x10'),_0xff28ad,_0x4212af[_0xfc94('0xf')][_0xfc94('0x11')]);return _0x47afb8(_0x4212af[_0xfc94('0xf')]['message']);}logger[_0xfc94('0xf')](_0xfc94('0x10'),_0xff28ad,_0x4212af[_0xfc94('0xf')][_0xfc94('0x11')]);return _0xe044e8(_0x4212af[_0xfc94('0xf')]['message']);}else{logger[_0xfc94('0xa')]('MailServerIn,\x20%s,\x20%s',_0xff28ad,_0xfc94('0xd'));_0xe044e8(_0x4212af['result'][_0xfc94('0x11')]);}})[_0xfc94('0x12')](function(_0x2f7bd6){logger['error'](_0xfc94('0x10'),_0xff28ad,_0x2f7bd6);_0x47afb8(_0x2f7bd6);});});}exports[_0xfc94('0x13')]=function(_0x2bf314){var _0x42b4f9=this;return new Promise(function(_0x4fc5f6,_0x40f5d1){return db[_0xfc94('0x14')][_0xfc94('0x15')]({'raw':_0x2bf314['options']?_0x2bf314[_0xfc94('0x16')][_0xfc94('0x17')]===undefined?!![]:![]:!![],'where':_0x2bf314[_0xfc94('0x16')]?_0x2bf314[_0xfc94('0x16')][_0xfc94('0x18')]||null:null,'attributes':_0x2bf314['options']?_0x2bf314[_0xfc94('0x16')][_0xfc94('0x19')]||null:null,'limit':_0x2bf314['options']?_0x2bf314[_0xfc94('0x16')][_0xfc94('0x1a')]||null:null,'include':_0x2bf314[_0xfc94('0x16')]?_0x2bf314['options'][_0xfc94('0x1b')]?_['map'](_0x2bf314[_0xfc94('0x16')][_0xfc94('0x1b')],function(_0x35cb26){return{'model':db[_0x35cb26[_0xfc94('0x1c')]],'as':_0x35cb26['as'],'attributes':_0x35cb26[_0xfc94('0x19')],'include':_0x35cb26['include']?_['map'](_0x35cb26[_0xfc94('0x1b')],function(_0x5be0e4){return{'model':db[_0x5be0e4[_0xfc94('0x1c')]],'as':_0x5be0e4['as'],'attributes':_0x5be0e4['attributes'],'include':_0x5be0e4[_0xfc94('0x1b')]?_['map'](_0x5be0e4[_0xfc94('0x1b')],function(_0x44a583){return{'model':db[_0x44a583[_0xfc94('0x1c')]],'as':_0x44a583['as'],'attributes':_0x44a583[_0xfc94('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x94a15a){logger[_0xfc94('0xa')](_0xfc94('0x13'),_0x2bf314);logger['debug'](_0xfc94('0x13'),_0x2bf314,JSON[_0xfc94('0xe')](_0x94a15a));_0x4fc5f6(_0x94a15a);})[_0xfc94('0x12')](function(_0x37e20e){logger[_0xfc94('0xf')](_0xfc94('0x13'),_0x37e20e['message'],_0x2bf314);_0x40f5d1(_0x42b4f9[_0xfc94('0xf')](0x1f4,_0x37e20e[_0xfc94('0x11')]));});});}; \ No newline at end of file +var _0x9585=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','info','result','catch','GetMailServerIn','findAll','options','raw','where','attributes','limit','include','model','map','util','bluebird'];(function(_0x273209,_0x3256df){var _0x57bf46=function(_0x40b4a7){while(--_0x40b4a7){_0x273209['push'](_0x273209['shift']());}};_0x57bf46(++_0x3256df);}(_0x9585,0x15e));var _0x5958=function(_0x1ea358,_0x924bfa){_0x1ea358=_0x1ea358-0x0;var _0x45fa24=_0x9585[_0x1ea358];return _0x45fa24;};'use strict';var _=require('lodash');var util=require(_0x5958('0x0'));var moment=require('moment');var BPromise=require(_0x5958('0x1'));var rs=require(_0x5958('0x2'));var fs=require('fs');var Redis=require(_0x5958('0x3'));var db=require(_0x5958('0x4'))['db'];var utils=require(_0x5958('0x5'));var logger=require(_0x5958('0x6'))(_0x5958('0x7'));var config=require(_0x5958('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5958('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc050d5,_0xd655ec,_0x264827){return new BPromise(function(_0x5be2d9,_0x1e2de1){return client['request'](_0xc050d5,_0x264827)[_0x5958('0xa')](function(_0x12aa98){logger['info']('MailServerIn,\x20%s,\x20%s',_0xd655ec,_0x5958('0xb'));logger[_0x5958('0xc')](_0x5958('0xd'),_0xd655ec,_0x5958('0xb'),JSON[_0x5958('0xe')](_0x12aa98));if(_0x12aa98['error']){if(_0x12aa98[_0x5958('0xf')][_0x5958('0x10')]===0x1f4){logger[_0x5958('0xf')](_0x5958('0x11'),_0xd655ec,_0x12aa98[_0x5958('0xf')]['message']);return _0x1e2de1(_0x12aa98['error'][_0x5958('0x12')]);}logger[_0x5958('0xf')](_0x5958('0x11'),_0xd655ec,_0x12aa98['error'][_0x5958('0x12')]);return _0x5be2d9(_0x12aa98[_0x5958('0xf')][_0x5958('0x12')]);}else{logger[_0x5958('0x13')]('MailServerIn,\x20%s,\x20%s',_0xd655ec,_0x5958('0xb'));_0x5be2d9(_0x12aa98[_0x5958('0x14')][_0x5958('0x12')]);}})[_0x5958('0x15')](function(_0x2c9bcf){logger[_0x5958('0xf')]('MailServerIn,\x20%s,\x20%s',_0xd655ec,_0x2c9bcf);_0x1e2de1(_0x2c9bcf);});});}exports[_0x5958('0x16')]=function(_0x7cd01c){var _0x146ef3=this;return new Promise(function(_0x26c29d,_0x394bef){return db['MailServerIn'][_0x5958('0x17')]({'raw':_0x7cd01c[_0x5958('0x18')]?_0x7cd01c[_0x5958('0x18')][_0x5958('0x19')]===undefined?!![]:![]:!![],'where':_0x7cd01c[_0x5958('0x18')]?_0x7cd01c['options'][_0x5958('0x1a')]||null:null,'attributes':_0x7cd01c['options']?_0x7cd01c['options'][_0x5958('0x1b')]||null:null,'limit':_0x7cd01c['options']?_0x7cd01c[_0x5958('0x18')][_0x5958('0x1c')]||null:null,'include':_0x7cd01c[_0x5958('0x18')]?_0x7cd01c[_0x5958('0x18')][_0x5958('0x1d')]?_['map'](_0x7cd01c['options']['include'],function(_0x154aa3){return{'model':db[_0x154aa3[_0x5958('0x1e')]],'as':_0x154aa3['as'],'attributes':_0x154aa3[_0x5958('0x1b')],'include':_0x154aa3[_0x5958('0x1d')]?_['map'](_0x154aa3[_0x5958('0x1d')],function(_0x46888d){return{'model':db[_0x46888d[_0x5958('0x1e')]],'as':_0x46888d['as'],'attributes':_0x46888d['attributes'],'include':_0x46888d[_0x5958('0x1d')]?_[_0x5958('0x1f')](_0x46888d[_0x5958('0x1d')],function(_0x29b7f7){return{'model':db[_0x29b7f7[_0x5958('0x1e')]],'as':_0x29b7f7['as'],'attributes':_0x29b7f7[_0x5958('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5958('0xa')](function(_0x54ab3c){logger['info'](_0x5958('0x16'),_0x7cd01c);logger[_0x5958('0xc')](_0x5958('0x16'),_0x7cd01c,JSON['stringify'](_0x54ab3c));_0x26c29d(_0x54ab3c);})[_0x5958('0x15')](function(_0x388123){logger[_0x5958('0xf')](_0x5958('0x16'),_0x388123[_0x5958('0x12')],_0x7cd01c);_0x394bef(_0x146ef3[_0x5958('0xf')](0x1f4,_0x388123[_0x5958('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3ee2c8a..41bbded 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_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 48c17b2..17ee194 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 _0x6324=['STRING','BOOLEAN','sequelize','exports'];(function(_0x426711,_0x12264c){var _0x592991=function(_0x564614){while(--_0x564614){_0x426711['push'](_0x426711['shift']());}};_0x592991(++_0x12264c);}(_0x6324,0x142));var _0x4632=function(_0x21929f,_0xb96182){_0x21929f=_0x21929f-0x0;var _0x1a6077=_0x6324[_0x21929f];return _0x1a6077;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'description':{'type':Sequelize[_0x4632('0x2')]},'host':{'type':Sequelize[_0x4632('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x4632('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4632('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x4632('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5423=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x5ab71b,_0x456bb2){var _0x5dd6fb=function(_0x208891){while(--_0x208891){_0x5ab71b['push'](_0x5ab71b['shift']());}};_0x5dd6fb(++_0x456bb2);}(_0x5423,0xe3));var _0x3542=function(_0x494f71,_0x400d2a){_0x494f71=_0x494f71-0x0;var _0x3d6a58=_0x5423[_0x494f71];return _0x3d6a58;};'use strict';var Sequelize=require(_0x3542('0x0'));module[_0x3542('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3542('0x2')]},'user':{'type':Sequelize[_0x3542('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3542('0x3')]},'secure':{'type':Sequelize[_0x3542('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x3542('0x2')]},'authentication':{'type':Sequelize[_0x3542('0x4')],'defaultValue':!![]},'modernAuthentication':{'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 ef8857c..ab966a8 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 _0x3382=['apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range'];(function(_0x447ef1,_0x374cd2){var _0x3d72ec=function(_0x3e10b){while(--_0x3e10b){_0x447ef1['push'](_0x447ef1['shift']());}};_0x3d72ec(++_0x374cd2);}(_0x3382,0xcc));var _0x2338=function(_0x92ec9c,_0x5e4216){_0x92ec9c=_0x92ec9c-0x0;var _0x5f06d6=_0x3382[_0x92ec9c];return _0x5f06d6;};'use strict';var emlformat=require(_0x2338('0x0'));var rimraf=require(_0x2338('0x1'));var zipdir=require(_0x2338('0x2'));var jsonpatch=require(_0x2338('0x3'));var rp=require(_0x2338('0x4'));var moment=require('moment');var BPromise=require(_0x2338('0x5'));var Mustache=require('mustache');var util=require(_0x2338('0x6'));var path=require(_0x2338('0x7'));var sox=require('sox');var csv=require(_0x2338('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2338('0x9'));var _=require(_0x2338('0xa'));var squel=require(_0x2338('0xb'));var crypto=require(_0x2338('0xc'));var jsforce=require(_0x2338('0xd'));var deskjs=require(_0x2338('0xe'));var toCsv=require(_0x2338('0x8'));var querystring=require('querystring');var Papa=require(_0x2338('0xf'));var Redis=require(_0x2338('0x10'));var authService=require(_0x2338('0x11'));var qs=require(_0x2338('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2338('0x13'));var logger=require(_0x2338('0x14'))(_0x2338('0x15'));var utils=require(_0x2338('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2338('0x17'));var db=require(_0x2338('0x18'))['db'];function respondWithStatusCode(_0x1adff4,_0xd426b6){_0xd426b6=_0xd426b6||0xcc;return function(_0x4dc5b7){if(_0x4dc5b7){return _0x1adff4['sendStatus'](_0xd426b6);}return _0x1adff4['status'](_0xd426b6)[_0x2338('0x19')]();};}function respondWithResult(_0x49dc4a,_0x32dc72){_0x32dc72=_0x32dc72||0xc8;return function(_0x41e43d){if(_0x41e43d){return _0x49dc4a['status'](_0x32dc72)[_0x2338('0x1a')](_0x41e43d);}};}function respondWithFilteredResult(_0x246a0d,_0x3de999){return function(_0x22f4a4){if(_0x22f4a4){var _0x392e9d=typeof _0x3de999[_0x2338('0x1b')]===_0x2338('0x1c')&&typeof _0x3de999[_0x2338('0x1d')]==='undefined';var _0x4bd809=_0x22f4a4[_0x2338('0x1e')];var _0x53e754=_0x392e9d?0x0:_0x3de999[_0x2338('0x1b')];var _0x4c58a3=_0x392e9d?_0x22f4a4[_0x2338('0x1e')]:_0x3de999[_0x2338('0x1b')]+_0x3de999[_0x2338('0x1d')];var _0x423a8f;if(_0x4c58a3>=_0x4bd809){_0x4c58a3=_0x4bd809;_0x423a8f=0xc8;}else{_0x423a8f=0xce;}_0x246a0d[_0x2338('0x1f')](_0x423a8f);return _0x246a0d['set'](_0x2338('0x20'),_0x53e754+'-'+_0x4c58a3+'/'+_0x4bd809)[_0x2338('0x1a')](_0x22f4a4);}return null;};}function patchUpdates(_0x5df75d){return function(_0x85c4d){try{jsonpatch[_0x2338('0x21')](_0x85c4d,_0x5df75d,!![]);}catch(_0x146708){return BPromise[_0x2338('0x22')](_0x146708);}return _0x85c4d[_0x2338('0x23')]();};}function saveUpdates(_0x405f82,_0x594dac){return function(_0x388c62){if(_0x388c62){return _0x388c62['update'](_0x405f82)[_0x2338('0x24')](function(_0x57d7dc){return _0x57d7dc;});}return null;};}function removeEntity(_0x445be0,_0x556d57){return function(_0x366285){if(_0x366285){return _0x366285[_0x2338('0x25')]()['then'](function(){_0x445be0[_0x2338('0x1f')](0xcc)[_0x2338('0x19')]();});}};}function handleEntityNotFound(_0x30f3f2,_0x512981){return function(_0x4f2248){if(!_0x4f2248){_0x30f3f2[_0x2338('0x26')](0x194);}return _0x4f2248;};}function handleError(_0x7d6583,_0x16860d){_0x16860d=_0x16860d||0x1f4;return function(_0x1d6f27){logger[_0x2338('0x27')](_0x1d6f27[_0x2338('0x28')]);if(_0x1d6f27[_0x2338('0x29')]){delete _0x1d6f27[_0x2338('0x29')];}_0x7d6583[_0x2338('0x1f')](_0x16860d)[_0x2338('0x2a')](_0x1d6f27);};}exports[_0x2338('0x2b')]=function(_0x382485,_0x41f634){var _0x156cc2={},_0x449d73={},_0x19afff={'count':0x0,'rows':[]};var _0x49dfd3=_[_0x2338('0x2c')](db['MailServerOut'][_0x2338('0x2d')],function(_0x38b49e){return{'name':_0x38b49e[_0x2338('0x2e')],'type':_0x38b49e[_0x2338('0x2f')][_0x2338('0x30')]};});_0x449d73[_0x2338('0x31')]=_['map'](_0x49dfd3,_0x2338('0x29'));_0x449d73[_0x2338('0x32')]=_[_0x2338('0x33')](_0x382485[_0x2338('0x32')]);_0x449d73['filters']=_[_0x2338('0x34')](_0x449d73[_0x2338('0x31')],_0x449d73['query']);_0x156cc2[_0x2338('0x35')]=_[_0x2338('0x34')](_0x449d73[_0x2338('0x31')],qs[_0x2338('0x36')](_0x382485[_0x2338('0x32')][_0x2338('0x36')]));_0x156cc2[_0x2338('0x35')]=_0x156cc2['attributes'][_0x2338('0x37')]?_0x156cc2['attributes']:_0x449d73[_0x2338('0x31')];if(!_0x382485[_0x2338('0x32')][_0x2338('0x38')](_0x2338('0x39'))){_0x156cc2[_0x2338('0x1d')]=qs['limit'](_0x382485[_0x2338('0x32')][_0x2338('0x1d')]);_0x156cc2[_0x2338('0x1b')]=qs[_0x2338('0x1b')](_0x382485[_0x2338('0x32')]['offset']);}_0x156cc2[_0x2338('0x3a')]=qs['sort'](_0x382485[_0x2338('0x32')][_0x2338('0x3b')]);_0x156cc2['where']=qs[_0x2338('0x3c')](_[_0x2338('0x3d')](_0x382485[_0x2338('0x32')],_0x449d73[_0x2338('0x3c')]),_0x49dfd3);if(_0x382485[_0x2338('0x32')][_0x2338('0x3e')]){_0x156cc2[_0x2338('0x3f')]=_[_0x2338('0x40')](_0x156cc2[_0x2338('0x3f')],{'$or':_[_0x2338('0x2c')](_0x49dfd3,function(_0x5cf140){if(_0x5cf140['type']!==_0x2338('0x41')){var _0x546f51={};_0x546f51[_0x5cf140['name']]={'$like':'%'+_0x382485[_0x2338('0x32')][_0x2338('0x3e')]+'%'};return _0x546f51;}})});}_0x156cc2=_[_0x2338('0x40')]({},_0x156cc2,_0x382485[_0x2338('0x42')]);var _0x5691f6={'where':_0x156cc2[_0x2338('0x3f')]};return db[_0x2338('0x43')][_0x2338('0x1e')](_0x5691f6)[_0x2338('0x24')](function(_0x5f2b84){_0x19afff['count']=_0x5f2b84;if(_0x382485[_0x2338('0x32')][_0x2338('0x44')]){_0x156cc2[_0x2338('0x45')]=[{'all':!![]}];}return db[_0x2338('0x43')][_0x2338('0x46')](_0x156cc2);})['then'](function(_0x112bc9){_0x19afff[_0x2338('0x47')]=_0x112bc9;return _0x19afff;})[_0x2338('0x24')](respondWithFilteredResult(_0x41f634,_0x156cc2))['catch'](handleError(_0x41f634,null));};exports[_0x2338('0x48')]=function(_0x2471d7,_0x5d153a){var _0x271505={'raw':!![],'where':{'id':_0x2471d7[_0x2338('0x49')]['id']}},_0x5888f6={};_0x5888f6[_0x2338('0x31')]=_[_0x2338('0x33')](db[_0x2338('0x43')][_0x2338('0x2d')]);_0x5888f6['query']=_[_0x2338('0x33')](_0x2471d7[_0x2338('0x32')]);_0x5888f6[_0x2338('0x3c')]=_[_0x2338('0x34')](_0x5888f6[_0x2338('0x31')],_0x5888f6[_0x2338('0x32')]);_0x271505['attributes']=_[_0x2338('0x34')](_0x5888f6[_0x2338('0x31')],qs[_0x2338('0x36')](_0x2471d7[_0x2338('0x32')]['fields']));_0x271505[_0x2338('0x35')]=_0x271505['attributes'][_0x2338('0x37')]?_0x271505[_0x2338('0x35')]:_0x5888f6[_0x2338('0x31')];if(_0x2471d7[_0x2338('0x32')][_0x2338('0x44')]){_0x271505[_0x2338('0x45')]=[{'all':!![]}];}_0x271505=_['merge']({},_0x271505,_0x2471d7[_0x2338('0x42')]);return db[_0x2338('0x43')][_0x2338('0x4a')](_0x271505)['then'](handleEntityNotFound(_0x5d153a,null))[_0x2338('0x24')](respondWithResult(_0x5d153a,null))[_0x2338('0x4b')](handleError(_0x5d153a,null));};exports[_0x2338('0x4c')]=function(_0x2fd149,_0x5240fa){return db[_0x2338('0x43')][_0x2338('0x4c')](_0x2fd149[_0x2338('0x4d')],{})[_0x2338('0x24')](respondWithResult(_0x5240fa,0xc9))[_0x2338('0x4b')](handleError(_0x5240fa,null));};exports[_0x2338('0x4e')]=function(_0x390eb0,_0x193c6a){if(_0x390eb0['body']['id']){delete _0x390eb0[_0x2338('0x4d')]['id'];}return db[_0x2338('0x43')][_0x2338('0x4a')]({'where':{'id':_0x390eb0[_0x2338('0x49')]['id']}})[_0x2338('0x24')](handleEntityNotFound(_0x193c6a,null))['then'](saveUpdates(_0x390eb0[_0x2338('0x4d')],null))[_0x2338('0x24')](respondWithResult(_0x193c6a,null))[_0x2338('0x4b')](handleError(_0x193c6a,null));};exports[_0x2338('0x25')]=function(_0x29f8c1,_0x3a9d81){return db['MailServerOut']['find']({'where':{'id':_0x29f8c1[_0x2338('0x49')]['id']}})[_0x2338('0x24')](handleEntityNotFound(_0x3a9d81,null))[_0x2338('0x24')](removeEntity(_0x3a9d81,null))[_0x2338('0x4b')](handleError(_0x3a9d81,null));}; \ No newline at end of file +var _0xdea1=['destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then'];(function(_0x20d06a,_0x16b092){var _0x1c48ef=function(_0x2da6d5){while(--_0x2da6d5){_0x20d06a['push'](_0x20d06a['shift']());}};_0x1c48ef(++_0x16b092);}(_0xdea1,0x149));var _0x1dea=function(_0x1048b0,_0x532676){_0x1048b0=_0x1048b0-0x0;var _0xe9780=_0xdea1[_0x1048b0];return _0xe9780;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1dea('0x0'));var zipdir=require(_0x1dea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1dea('0x2'));var moment=require(_0x1dea('0x3'));var BPromise=require(_0x1dea('0x4'));var Mustache=require(_0x1dea('0x5'));var util=require('util');var path=require(_0x1dea('0x6'));var sox=require(_0x1dea('0x7'));var csv=require(_0x1dea('0x8'));var ejs=require(_0x1dea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1dea('0xa'));var crypto=require(_0x1dea('0xb'));var jsforce=require(_0x1dea('0xc'));var deskjs=require(_0x1dea('0xd'));var toCsv=require(_0x1dea('0x8'));var querystring=require(_0x1dea('0xe'));var Papa=require(_0x1dea('0xf'));var Redis=require(_0x1dea('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1dea('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1dea('0x12'));var logger=require('../../config/logger')(_0x1dea('0x13'));var utils=require(_0x1dea('0x14'));var config=require(_0x1dea('0x15'));var licenseUtil=require(_0x1dea('0x16'));var db=require(_0x1dea('0x17'))['db'];function respondWithStatusCode(_0x2f502b,_0xccdef0){_0xccdef0=_0xccdef0||0xcc;return function(_0x5baa74){if(_0x5baa74){return _0x2f502b[_0x1dea('0x18')](_0xccdef0);}return _0x2f502b[_0x1dea('0x19')](_0xccdef0)[_0x1dea('0x1a')]();};}function respondWithResult(_0x2ba86f,_0x5d2aca){_0x5d2aca=_0x5d2aca||0xc8;return function(_0x5cdf9f){if(_0x5cdf9f){return _0x2ba86f[_0x1dea('0x19')](_0x5d2aca)[_0x1dea('0x1b')](_0x5cdf9f);}};}function respondWithFilteredResult(_0x71622,_0x197194){return function(_0x4e168f){if(_0x4e168f){var _0x4b3527=typeof _0x197194[_0x1dea('0x1c')]==='undefined'&&typeof _0x197194[_0x1dea('0x1d')]==='undefined';var _0x56fe49=_0x4e168f[_0x1dea('0x1e')];var _0x38a8b2=_0x4b3527?0x0:_0x197194[_0x1dea('0x1c')];var _0x5eba21=_0x4b3527?_0x4e168f[_0x1dea('0x1e')]:_0x197194['offset']+_0x197194['limit'];var _0x315f8d;if(_0x5eba21>=_0x56fe49){_0x5eba21=_0x56fe49;_0x315f8d=0xc8;}else{_0x315f8d=0xce;}_0x71622['status'](_0x315f8d);return _0x71622[_0x1dea('0x1f')](_0x1dea('0x20'),_0x38a8b2+'-'+_0x5eba21+'/'+_0x56fe49)[_0x1dea('0x1b')](_0x4e168f);}return null;};}function patchUpdates(_0x1d2b93){return function(_0x3c9a37){try{jsonpatch[_0x1dea('0x21')](_0x3c9a37,_0x1d2b93,!![]);}catch(_0x3d3196){return BPromise['reject'](_0x3d3196);}return _0x3c9a37['save']();};}function saveUpdates(_0x545c52,_0x384b34){return function(_0x1933e3){if(_0x1933e3){return _0x1933e3[_0x1dea('0x22')](_0x545c52)[_0x1dea('0x23')](function(_0x1c4b99){return _0x1c4b99;});}return null;};}function removeEntity(_0x294c1f,_0x4a941b){return function(_0x250f88){if(_0x250f88){return _0x250f88[_0x1dea('0x24')]()[_0x1dea('0x23')](function(){_0x294c1f[_0x1dea('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44058e,_0x4edef1){return function(_0x530d28){if(!_0x530d28){_0x44058e['sendStatus'](0x194);}return _0x530d28;};}function handleError(_0x12aace,_0x1c6042){_0x1c6042=_0x1c6042||0x1f4;return function(_0x2d0cd1){logger[_0x1dea('0x25')](_0x2d0cd1[_0x1dea('0x26')]);if(_0x2d0cd1[_0x1dea('0x27')]){delete _0x2d0cd1[_0x1dea('0x27')];}_0x12aace[_0x1dea('0x19')](_0x1c6042)[_0x1dea('0x28')](_0x2d0cd1);};}exports[_0x1dea('0x29')]=function(_0x3c2b44,_0x1f12cc){var _0x3ad104={},_0x21e6fa={},_0x5d8229={'count':0x0,'rows':[]};var _0xd30c35=_[_0x1dea('0x2a')](db['MailServerOut']['rawAttributes'],function(_0x4afb12){return{'name':_0x4afb12[_0x1dea('0x2b')],'type':_0x4afb12[_0x1dea('0x2c')][_0x1dea('0x2d')]};});_0x21e6fa['model']=_[_0x1dea('0x2a')](_0xd30c35,_0x1dea('0x27'));_0x21e6fa[_0x1dea('0x2e')]=_[_0x1dea('0x2f')](_0x3c2b44[_0x1dea('0x2e')]);_0x21e6fa['filters']=_[_0x1dea('0x30')](_0x21e6fa[_0x1dea('0x31')],_0x21e6fa[_0x1dea('0x2e')]);_0x3ad104[_0x1dea('0x32')]=_[_0x1dea('0x30')](_0x21e6fa[_0x1dea('0x31')],qs[_0x1dea('0x33')](_0x3c2b44[_0x1dea('0x2e')][_0x1dea('0x33')]));_0x3ad104[_0x1dea('0x32')]=_0x3ad104['attributes'][_0x1dea('0x34')]?_0x3ad104[_0x1dea('0x32')]:_0x21e6fa[_0x1dea('0x31')];if(!_0x3c2b44[_0x1dea('0x2e')][_0x1dea('0x35')]('nolimit')){_0x3ad104['limit']=qs['limit'](_0x3c2b44[_0x1dea('0x2e')][_0x1dea('0x1d')]);_0x3ad104[_0x1dea('0x1c')]=qs[_0x1dea('0x1c')](_0x3c2b44['query'][_0x1dea('0x1c')]);}_0x3ad104['order']=qs[_0x1dea('0x36')](_0x3c2b44[_0x1dea('0x2e')]['sort']);_0x3ad104[_0x1dea('0x37')]=qs[_0x1dea('0x38')](_[_0x1dea('0x39')](_0x3c2b44[_0x1dea('0x2e')],_0x21e6fa[_0x1dea('0x38')]),_0xd30c35);if(_0x3c2b44[_0x1dea('0x2e')][_0x1dea('0x3a')]){_0x3ad104[_0x1dea('0x37')]=_[_0x1dea('0x3b')](_0x3ad104[_0x1dea('0x37')],{'$or':_[_0x1dea('0x2a')](_0xd30c35,function(_0xb1c927){if(_0xb1c927['type']!==_0x1dea('0x3c')){var _0x10147d={};_0x10147d[_0xb1c927[_0x1dea('0x27')]]={'$like':'%'+_0x3c2b44[_0x1dea('0x2e')]['filter']+'%'};return _0x10147d;}})});}_0x3ad104=_[_0x1dea('0x3b')]({},_0x3ad104,_0x3c2b44[_0x1dea('0x3d')]);var _0x43a74d={'where':_0x3ad104[_0x1dea('0x37')]};return db[_0x1dea('0x3e')][_0x1dea('0x1e')](_0x43a74d)['then'](function(_0x34d7ce){_0x5d8229[_0x1dea('0x1e')]=_0x34d7ce;if(_0x3c2b44[_0x1dea('0x2e')][_0x1dea('0x3f')]){_0x3ad104[_0x1dea('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0x1dea('0x41')](_0x3ad104);})[_0x1dea('0x23')](function(_0x550b6c){_0x5d8229[_0x1dea('0x42')]=_0x550b6c;return _0x5d8229;})[_0x1dea('0x23')](respondWithFilteredResult(_0x1f12cc,_0x3ad104))[_0x1dea('0x43')](handleError(_0x1f12cc,null));};exports['show']=function(_0x3dac07,_0x3b31f8){var _0x277450={'raw':!![],'where':{'id':_0x3dac07[_0x1dea('0x44')]['id']}},_0x8fde31={};_0x8fde31[_0x1dea('0x31')]=_[_0x1dea('0x2f')](db[_0x1dea('0x3e')][_0x1dea('0x45')]);_0x8fde31[_0x1dea('0x2e')]=_['keys'](_0x3dac07[_0x1dea('0x2e')]);_0x8fde31['filters']=_[_0x1dea('0x30')](_0x8fde31[_0x1dea('0x31')],_0x8fde31[_0x1dea('0x2e')]);_0x277450[_0x1dea('0x32')]=_[_0x1dea('0x30')](_0x8fde31[_0x1dea('0x31')],qs[_0x1dea('0x33')](_0x3dac07[_0x1dea('0x2e')]['fields']));_0x277450[_0x1dea('0x32')]=_0x277450[_0x1dea('0x32')][_0x1dea('0x34')]?_0x277450['attributes']:_0x8fde31[_0x1dea('0x31')];if(_0x3dac07['query'][_0x1dea('0x3f')]){_0x277450['include']=[{'all':!![]}];}_0x277450=_['merge']({},_0x277450,_0x3dac07[_0x1dea('0x3d')]);return db['MailServerOut']['find'](_0x277450)[_0x1dea('0x23')](handleEntityNotFound(_0x3b31f8,null))[_0x1dea('0x23')](respondWithResult(_0x3b31f8,null))[_0x1dea('0x43')](handleError(_0x3b31f8,null));};exports['create']=function(_0x1e185f,_0x5f5694){return db[_0x1dea('0x3e')][_0x1dea('0x46')](_0x1e185f[_0x1dea('0x47')],{})['then'](respondWithResult(_0x5f5694,0xc9))[_0x1dea('0x43')](handleError(_0x5f5694,null));};exports[_0x1dea('0x22')]=function(_0x177434,_0x333d65){if(_0x177434[_0x1dea('0x47')]['id']){delete _0x177434['body']['id'];}return db['MailServerOut'][_0x1dea('0x48')]({'where':{'id':_0x177434[_0x1dea('0x44')]['id']}})[_0x1dea('0x23')](handleEntityNotFound(_0x333d65,null))[_0x1dea('0x23')](saveUpdates(_0x177434[_0x1dea('0x47')],null))[_0x1dea('0x23')](respondWithResult(_0x333d65,null))[_0x1dea('0x43')](handleError(_0x333d65,null));};exports[_0x1dea('0x24')]=function(_0x3ab70b,_0x1bc1cb){return db[_0x1dea('0x3e')][_0x1dea('0x48')]({'where':{'id':_0x3ab70b[_0x1dea('0x44')]['id']}})['then'](handleEntityNotFound(_0x1bc1cb,null))[_0x1dea('0x23')](removeEntity(_0x1bc1cb,null))[_0x1dea('0x43')](handleError(_0x1bc1cb,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4152811..0e8183c 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 _0x21da=['./mailServerOut.attributes','define','mail_servers_out','util','moment','bluebird','path'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0x21da,0x16f));var _0xa21d=function(_0x4a1c46,_0x7bc16c){_0x4a1c46=_0x4a1c46-0x0;var _0x49012b=_0x21da[_0x4a1c46];return _0x49012b;};'use strict';var _=require('lodash');var util=require(_0xa21d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa21d('0x1'));var BPromise=require(_0xa21d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa21d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa21d('0x4'));module['exports']=function(_0xd5bae,_0x1435a5){return _0xd5bae[_0xa21d('0x5')]('MailServerOut',attributes,{'tableName':_0xa21d('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd997=['request-promise','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment','bluebird'];(function(_0x449678,_0x9f2d7a){var _0x2d0366=function(_0x4d8851){while(--_0x4d8851){_0x449678['push'](_0x449678['shift']());}};_0x2d0366(++_0x9f2d7a);}(_0xd997,0x133));var _0x7d99=function(_0x625543,_0x29ebe5){_0x625543=_0x625543-0x0;var _0x52f953=_0xd997[_0x625543];return _0x52f953;};'use strict';var _=require(_0x7d99('0x0'));var util=require(_0x7d99('0x1'));var logger=require(_0x7d99('0x2'))('api');var moment=require(_0x7d99('0x3'));var BPromise=require(_0x7d99('0x4'));var rp=require(_0x7d99('0x5'));var fs=require('fs');var path=require(_0x7d99('0x6'));var rimraf=require(_0x7d99('0x7'));var config=require('../../config/environment');var attributes=require(_0x7d99('0x8'));module[_0x7d99('0x9')]=function(_0x4a0d32,_0x551ba6){return _0x4a0d32[_0x7d99('0xa')](_0x7d99('0xb'),attributes,{'tableName':_0x7d99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index f8fea60..44b24ab 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x20865b,_0x1dd78e){_0x20865b=_0x20865b-0x0;var _0xd49890=_0x7a54[_0x20865b];return _0xd49890;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x25b115,_0x19b278){_0x25b115=_0x25b115-0x0;var _0x4ff56c=_0x7a54[_0x25b115];return _0x4ff56c;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 1f79f67..9b31ac9 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 _0x2f64=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x14540b,_0x85d32d){var _0x394822=function(_0x2e9b0e){while(--_0x2e9b0e){_0x14540b['push'](_0x14540b['shift']());}};_0x394822(++_0x85d32d);}(_0x2f64,0x160));var _0x42f6=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x2f64[_0x20845e];return _0x28cf2b;};'use strict';var multer=require(_0x42f6('0x0'));var util=require(_0x42f6('0x1'));var path=require(_0x42f6('0x2'));var timeout=require(_0x42f6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x42f6('0x4'));var interaction=require(_0x42f6('0x5'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x42f6('0x6')]('/',auth[_0x42f6('0x7')](),controller[_0x42f6('0x8')]);router[_0x42f6('0x6')](_0x42f6('0x9'),auth[_0x42f6('0x7')](),controller[_0x42f6('0xa')]);router[_0x42f6('0x6')](_0x42f6('0xb'),auth[_0x42f6('0x7')](),controller[_0x42f6('0xc')]);router[_0x42f6('0xd')]('/',auth[_0x42f6('0x7')](),controller[_0x42f6('0xe')]);router[_0x42f6('0xf')](_0x42f6('0xb'),auth[_0x42f6('0x7')](),controller[_0x42f6('0x10')]);router[_0x42f6('0x11')]('/:id',auth[_0x42f6('0x7')](),controller[_0x42f6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7013=['index','describe','get','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated'];(function(_0x9d5a92,_0x34875d){var _0x3d84f2=function(_0x4bde89){while(--_0x4bde89){_0x9d5a92['push'](_0x9d5a92['shift']());}};_0x3d84f2(++_0x34875d);}(_0x7013,0xbb));var _0x3701=function(_0x297922,_0x3c6b93){_0x297922=_0x297922-0x0;var _0x180394=_0x7013[_0x297922];return _0x180394;};'use strict';var multer=require(_0x3701('0x0'));var util=require(_0x3701('0x1'));var path=require(_0x3701('0x2'));var timeout=require(_0x3701('0x3'));var express=require(_0x3701('0x4'));var router=express[_0x3701('0x5')]();var fs_extra=require(_0x3701('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3701('0x7'));var config=require(_0x3701('0x8'));var controller=require(_0x3701('0x9'));router['get']('/',auth[_0x3701('0xa')](),controller[_0x3701('0xb')]);router['get']('/describe',auth[_0x3701('0xa')](),controller[_0x3701('0xc')]);router[_0x3701('0xd')]('/:id',auth[_0x3701('0xa')](),controller[_0x3701('0xe')]);router[_0x3701('0xf')]('/',auth[_0x3701('0xa')](),controller['create']);router[_0x3701('0x10')](_0x3701('0x11'),auth[_0x3701('0xa')](),controller[_0x3701('0x12')]);router[_0x3701('0x13')](_0x3701('0x11'),auth[_0x3701('0xa')](),controller[_0x3701('0x14')]);module[_0x3701('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 9d286e5..00ee840 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 _0x5e0e=['STRING','sequelize','exports','name'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5e0e,0x89));var _0xe5e0=function(_0x52a08b,_0x12388d){_0x52a08b=_0x52a08b-0x0;var _0x2c6670=_0x5e0e[_0x52a08b];return _0x2c6670;};'use strict';var Sequelize=require(_0xe5e0('0x0'));module[_0xe5e0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe5e0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe5e0('0x3')]}}; \ No newline at end of file +var _0x1dcc=['STRING','name','sequelize','exports'];(function(_0x2979b9,_0x16fe86){var _0x5e4840=function(_0x30b607){while(--_0x30b607){_0x2979b9['push'](_0x2979b9['shift']());}};_0x5e4840(++_0x16fe86);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x2ec59a,_0x91830){_0x2ec59a=_0x2ec59a-0x0;var _0x260f8b=_0x1dcc[_0x2ec59a];return _0x260f8b;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'name':{'type':Sequelize[_0xc1dc('0x2')],'unique':_0xc1dc('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8b18e81..38b718e 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 _0x8066=['nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','apply','save','update','then','error','stack','name','send','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x8066,0x1c4));var _0x6806=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x8066[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x6806('0x0'));var rimraf=require(_0x6806('0x1'));var zipdir=require(_0x6806('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6806('0x3'));var BPromise=require(_0x6806('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6806('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6806('0x6'));var squel=require('squel');var crypto=require(_0x6806('0x7'));var jsforce=require(_0x6806('0x8'));var deskjs=require(_0x6806('0x9'));var toCsv=require(_0x6806('0xa'));var querystring=require(_0x6806('0xb'));var Papa=require('papaparse');var Redis=require(_0x6806('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6806('0xd'));var as=require(_0x6806('0xe'));var hardwareService=require(_0x6806('0xf'));var logger=require(_0x6806('0x10'))(_0x6806('0x11'));var utils=require(_0x6806('0x12'));var config=require(_0x6806('0x13'));var licenseUtil=require(_0x6806('0x14'));var db=require(_0x6806('0x15'))['db'];function respondWithStatusCode(_0x5d2993,_0x38eff0){_0x38eff0=_0x38eff0||0xcc;return function(_0xf4a7c4){if(_0xf4a7c4){return _0x5d2993[_0x6806('0x16')](_0x38eff0);}return _0x5d2993[_0x6806('0x17')](_0x38eff0)[_0x6806('0x18')]();};}function respondWithResult(_0xc1a35d,_0x5a95fa){_0x5a95fa=_0x5a95fa||0xc8;return function(_0x371212){if(_0x371212){return _0xc1a35d[_0x6806('0x17')](_0x5a95fa)[_0x6806('0x19')](_0x371212);}};}function respondWithFilteredResult(_0x5e38fe,_0x3b606f){return function(_0x58596d){if(_0x58596d){var _0x16ef24=typeof _0x3b606f['offset']==='undefined'&&typeof _0x3b606f[_0x6806('0x1a')]===_0x6806('0x1b');var _0x534100=_0x58596d[_0x6806('0x1c')];var _0x2411ec=_0x16ef24?0x0:_0x3b606f[_0x6806('0x1d')];var _0x421c8d=_0x16ef24?_0x58596d[_0x6806('0x1c')]:_0x3b606f[_0x6806('0x1d')]+_0x3b606f['limit'];var _0x257f91;if(_0x421c8d>=_0x534100){_0x421c8d=_0x534100;_0x257f91=0xc8;}else{_0x257f91=0xce;}_0x5e38fe[_0x6806('0x17')](_0x257f91);return _0x5e38fe['set']('Content-Range',_0x2411ec+'-'+_0x421c8d+'/'+_0x534100)['json'](_0x58596d);}return null;};}function patchUpdates(_0x56b7af){return function(_0x1873b8){try{jsonpatch[_0x6806('0x1e')](_0x1873b8,_0x56b7af,!![]);}catch(_0x48d107){return BPromise['reject'](_0x48d107);}return _0x1873b8[_0x6806('0x1f')]();};}function saveUpdates(_0x4a4fe9,_0x51a55c){return function(_0xcd5d58){if(_0xcd5d58){return _0xcd5d58[_0x6806('0x20')](_0x4a4fe9)[_0x6806('0x21')](function(_0x2d9597){return _0x2d9597;});}return null;};}function removeEntity(_0x559fcc,_0xf6dc08){return function(_0x5786f6){if(_0x5786f6){return _0x5786f6['destroy']()[_0x6806('0x21')](function(){_0x559fcc['status'](0xcc)[_0x6806('0x18')]();});}};}function handleEntityNotFound(_0x4f9288,_0x33f445){return function(_0x573518){if(!_0x573518){_0x4f9288[_0x6806('0x16')](0x194);}return _0x573518;};}function handleError(_0x59b1ea,_0x5097ec){_0x5097ec=_0x5097ec||0x1f4;return function(_0x189403){logger[_0x6806('0x22')](_0x189403[_0x6806('0x23')]);if(_0x189403[_0x6806('0x24')]){delete _0x189403['name'];}_0x59b1ea[_0x6806('0x17')](_0x5097ec)[_0x6806('0x25')](_0x189403);};}exports[_0x6806('0x26')]=function(_0xdfcce7,_0x2cf1ca){var _0x2a265a={},_0x2b60e3={},_0x213dbe={'count':0x0,'rows':[]};var _0x1c296d=_[_0x6806('0x27')](db[_0x6806('0x28')]['rawAttributes'],function(_0x348bfc){return{'name':_0x348bfc[_0x6806('0x29')],'type':_0x348bfc[_0x6806('0x2a')][_0x6806('0x2b')]};});_0x2b60e3[_0x6806('0x2c')]=_[_0x6806('0x27')](_0x1c296d,'name');_0x2b60e3[_0x6806('0x2d')]=_[_0x6806('0x2e')](_0xdfcce7[_0x6806('0x2d')]);_0x2b60e3[_0x6806('0x2f')]=_[_0x6806('0x30')](_0x2b60e3[_0x6806('0x2c')],_0x2b60e3[_0x6806('0x2d')]);_0x2a265a[_0x6806('0x31')]=_[_0x6806('0x30')](_0x2b60e3[_0x6806('0x2c')],qs[_0x6806('0x32')](_0xdfcce7[_0x6806('0x2d')]['fields']));_0x2a265a[_0x6806('0x31')]=_0x2a265a['attributes']['length']?_0x2a265a[_0x6806('0x31')]:_0x2b60e3[_0x6806('0x2c')];if(!_0xdfcce7[_0x6806('0x2d')][_0x6806('0x33')](_0x6806('0x34'))){_0x2a265a[_0x6806('0x1a')]=qs['limit'](_0xdfcce7[_0x6806('0x2d')][_0x6806('0x1a')]);_0x2a265a['offset']=qs[_0x6806('0x1d')](_0xdfcce7['query']['offset']);}_0x2a265a[_0x6806('0x35')]=qs['sort'](_0xdfcce7['query'][_0x6806('0x36')]);_0x2a265a[_0x6806('0x37')]=qs[_0x6806('0x2f')](_[_0x6806('0x38')](_0xdfcce7[_0x6806('0x2d')],_0x2b60e3[_0x6806('0x2f')]),_0x1c296d);if(_0xdfcce7[_0x6806('0x2d')][_0x6806('0x39')]){_0x2a265a['where']=_[_0x6806('0x3a')](_0x2a265a['where'],{'$or':_[_0x6806('0x27')](_0x1c296d,function(_0x29ba63){if(_0x29ba63['type']!=='VIRTUAL'){var _0x428d2d={};_0x428d2d[_0x29ba63[_0x6806('0x24')]]={'$like':'%'+_0xdfcce7[_0x6806('0x2d')][_0x6806('0x39')]+'%'};return _0x428d2d;}})});}_0x2a265a=_[_0x6806('0x3a')]({},_0x2a265a,_0xdfcce7['options']);var _0x43db7a={'where':_0x2a265a[_0x6806('0x37')]};return db[_0x6806('0x28')][_0x6806('0x1c')](_0x43db7a)[_0x6806('0x21')](function(_0x3b6af4){_0x213dbe[_0x6806('0x1c')]=_0x3b6af4;if(_0xdfcce7[_0x6806('0x2d')][_0x6806('0x3b')]){_0x2a265a[_0x6806('0x3c')]=[{'all':!![]}];}return db[_0x6806('0x28')]['findAll'](_0x2a265a);})['then'](function(_0x4c5945){_0x213dbe[_0x6806('0x3d')]=_0x4c5945;return _0x213dbe;})[_0x6806('0x21')](respondWithFilteredResult(_0x2cf1ca,_0x2a265a))[_0x6806('0x3e')](handleError(_0x2cf1ca,null));};exports[_0x6806('0x3f')]=function(_0x269902,_0x40bcad){var _0x54f4bd={'raw':!![],'where':{'id':_0x269902[_0x6806('0x40')]['id']}},_0x30fa1b={};_0x30fa1b[_0x6806('0x2c')]=_['keys'](db[_0x6806('0x28')][_0x6806('0x41')]);_0x30fa1b['query']=_[_0x6806('0x2e')](_0x269902[_0x6806('0x2d')]);_0x30fa1b[_0x6806('0x2f')]=_[_0x6806('0x30')](_0x30fa1b[_0x6806('0x2c')],_0x30fa1b[_0x6806('0x2d')]);_0x54f4bd['attributes']=_[_0x6806('0x30')](_0x30fa1b[_0x6806('0x2c')],qs[_0x6806('0x32')](_0x269902['query'][_0x6806('0x32')]));_0x54f4bd[_0x6806('0x31')]=_0x54f4bd['attributes']['length']?_0x54f4bd[_0x6806('0x31')]:_0x30fa1b['model'];if(_0x269902['query'][_0x6806('0x3b')]){_0x54f4bd[_0x6806('0x3c')]=[{'all':!![]}];}_0x54f4bd=_[_0x6806('0x3a')]({},_0x54f4bd,_0x269902[_0x6806('0x42')]);return db['MailSubstatus'][_0x6806('0x43')](_0x54f4bd)[_0x6806('0x21')](handleEntityNotFound(_0x40bcad,null))[_0x6806('0x21')](respondWithResult(_0x40bcad,null))[_0x6806('0x3e')](handleError(_0x40bcad,null));};exports[_0x6806('0x44')]=function(_0x271ee7,_0x3db799){return db[_0x6806('0x28')][_0x6806('0x44')](_0x271ee7['body'],{})[_0x6806('0x21')](respondWithResult(_0x3db799,0xc9))['catch'](handleError(_0x3db799,null));};exports[_0x6806('0x20')]=function(_0x42c917,_0x2b1405){if(_0x42c917[_0x6806('0x45')]['id']){delete _0x42c917[_0x6806('0x45')]['id'];}return db['MailSubstatus'][_0x6806('0x43')]({'where':{'id':_0x42c917['params']['id']}})[_0x6806('0x21')](handleEntityNotFound(_0x2b1405,null))[_0x6806('0x21')](saveUpdates(_0x42c917[_0x6806('0x45')],null))['then'](respondWithResult(_0x2b1405,null))['catch'](handleError(_0x2b1405,null));};exports[_0x6806('0x46')]=function(_0x1eec18,_0x2b86b3){return db[_0x6806('0x28')][_0x6806('0x43')]({'where':{'id':_0x1eec18['params']['id']}})[_0x6806('0x21')](handleEntityNotFound(_0x2b86b3,null))[_0x6806('0x21')](removeEntity(_0x2b86b3,null))[_0x6806('0x3e')](handleError(_0x2b86b3,null));};exports['describe']=function(_0x528107,_0x1f828a){return db[_0x6806('0x28')][_0x6806('0x47')]()[_0x6806('0x21')](respondWithResult(_0x1f828a,null))[_0x6806('0x3e')](handleError(_0x1f828a,null));}; \ No newline at end of file +var _0xae47=['error','name','send','map','MailSubstatus','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','update','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x2256ed,_0x316d4c){var _0xd0410f=function(_0x3597ab){while(--_0x3597ab){_0x2256ed['push'](_0x2256ed['shift']());}};_0xd0410f(++_0x316d4c);}(_0xae47,0x140));var _0x7ae4=function(_0x370e2a,_0x51086a){_0x370e2a=_0x370e2a-0x0;var _0x27c781=_0xae47[_0x370e2a];return _0x27c781;};'use strict';var emlformat=require(_0x7ae4('0x0'));var rimraf=require(_0x7ae4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ae4('0x2'));var rp=require(_0x7ae4('0x3'));var moment=require(_0x7ae4('0x4'));var BPromise=require(_0x7ae4('0x5'));var Mustache=require('mustache');var util=require(_0x7ae4('0x6'));var path=require(_0x7ae4('0x7'));var sox=require(_0x7ae4('0x8'));var csv=require(_0x7ae4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ae4('0xa'));var _=require(_0x7ae4('0xb'));var squel=require('squel');var crypto=require(_0x7ae4('0xc'));var jsforce=require(_0x7ae4('0xd'));var deskjs=require(_0x7ae4('0xe'));var toCsv=require(_0x7ae4('0x9'));var querystring=require(_0x7ae4('0xf'));var Papa=require('papaparse');var Redis=require(_0x7ae4('0x10'));var authService=require(_0x7ae4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7ae4('0x12'));var hardwareService=require(_0x7ae4('0x13'));var logger=require('../../config/logger')(_0x7ae4('0x14'));var utils=require(_0x7ae4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ae4('0x16'))['db'];function respondWithStatusCode(_0xf6054d,_0x4056d9){_0x4056d9=_0x4056d9||0xcc;return function(_0x4c2a8d){if(_0x4c2a8d){return _0xf6054d[_0x7ae4('0x17')](_0x4056d9);}return _0xf6054d[_0x7ae4('0x18')](_0x4056d9)[_0x7ae4('0x19')]();};}function respondWithResult(_0x58a895,_0x5ead8c){_0x5ead8c=_0x5ead8c||0xc8;return function(_0x4e7944){if(_0x4e7944){return _0x58a895[_0x7ae4('0x18')](_0x5ead8c)['json'](_0x4e7944);}};}function respondWithFilteredResult(_0x3ef5bd,_0x2c7616){return function(_0x507b64){if(_0x507b64){var _0x227dd4=typeof _0x2c7616[_0x7ae4('0x1a')]==='undefined'&&typeof _0x2c7616[_0x7ae4('0x1b')]==='undefined';var _0x28595b=_0x507b64[_0x7ae4('0x1c')];var _0x142ee1=_0x227dd4?0x0:_0x2c7616[_0x7ae4('0x1a')];var _0xe56a82=_0x227dd4?_0x507b64[_0x7ae4('0x1c')]:_0x2c7616['offset']+_0x2c7616[_0x7ae4('0x1b')];var _0x83ccfd;if(_0xe56a82>=_0x28595b){_0xe56a82=_0x28595b;_0x83ccfd=0xc8;}else{_0x83ccfd=0xce;}_0x3ef5bd['status'](_0x83ccfd);return _0x3ef5bd[_0x7ae4('0x1d')](_0x7ae4('0x1e'),_0x142ee1+'-'+_0xe56a82+'/'+_0x28595b)['json'](_0x507b64);}return null;};}function patchUpdates(_0x2e09d5){return function(_0x276e70){try{jsonpatch[_0x7ae4('0x1f')](_0x276e70,_0x2e09d5,!![]);}catch(_0x584917){return BPromise[_0x7ae4('0x20')](_0x584917);}return _0x276e70[_0x7ae4('0x21')]();};}function saveUpdates(_0xa06e38,_0x51f72c){return function(_0x4b5b03){if(_0x4b5b03){return _0x4b5b03['update'](_0xa06e38)[_0x7ae4('0x22')](function(_0x65efd3){return _0x65efd3;});}return null;};}function removeEntity(_0x1d0e4c,_0x2a877c){return function(_0x54252b){if(_0x54252b){return _0x54252b['destroy']()[_0x7ae4('0x22')](function(){_0x1d0e4c[_0x7ae4('0x18')](0xcc)[_0x7ae4('0x19')]();});}};}function handleEntityNotFound(_0x50af9a,_0xd031b3){return function(_0x3fa922){if(!_0x3fa922){_0x50af9a[_0x7ae4('0x17')](0x194);}return _0x3fa922;};}function handleError(_0xe92335,_0x56e088){_0x56e088=_0x56e088||0x1f4;return function(_0x2570a0){logger[_0x7ae4('0x23')](_0x2570a0['stack']);if(_0x2570a0[_0x7ae4('0x24')]){delete _0x2570a0['name'];}_0xe92335[_0x7ae4('0x18')](_0x56e088)[_0x7ae4('0x25')](_0x2570a0);};}exports['index']=function(_0x9b4a52,_0x17b096){var _0x42f718={},_0x2840ad={},_0x3afb7e={'count':0x0,'rows':[]};var _0x2626f0=_[_0x7ae4('0x26')](db[_0x7ae4('0x27')][_0x7ae4('0x28')],function(_0x104708){return{'name':_0x104708[_0x7ae4('0x29')],'type':_0x104708['type']['key']};});_0x2840ad[_0x7ae4('0x2a')]=_[_0x7ae4('0x26')](_0x2626f0,'name');_0x2840ad[_0x7ae4('0x2b')]=_[_0x7ae4('0x2c')](_0x9b4a52[_0x7ae4('0x2b')]);_0x2840ad[_0x7ae4('0x2d')]=_[_0x7ae4('0x2e')](_0x2840ad[_0x7ae4('0x2a')],_0x2840ad[_0x7ae4('0x2b')]);_0x42f718['attributes']=_[_0x7ae4('0x2e')](_0x2840ad[_0x7ae4('0x2a')],qs[_0x7ae4('0x2f')](_0x9b4a52[_0x7ae4('0x2b')]['fields']));_0x42f718['attributes']=_0x42f718[_0x7ae4('0x30')][_0x7ae4('0x31')]?_0x42f718['attributes']:_0x2840ad[_0x7ae4('0x2a')];if(!_0x9b4a52['query']['hasOwnProperty']('nolimit')){_0x42f718[_0x7ae4('0x1b')]=qs[_0x7ae4('0x1b')](_0x9b4a52[_0x7ae4('0x2b')]['limit']);_0x42f718[_0x7ae4('0x1a')]=qs[_0x7ae4('0x1a')](_0x9b4a52['query'][_0x7ae4('0x1a')]);}_0x42f718[_0x7ae4('0x32')]=qs[_0x7ae4('0x33')](_0x9b4a52[_0x7ae4('0x2b')][_0x7ae4('0x33')]);_0x42f718[_0x7ae4('0x34')]=qs['filters'](_[_0x7ae4('0x35')](_0x9b4a52[_0x7ae4('0x2b')],_0x2840ad['filters']),_0x2626f0);if(_0x9b4a52['query'][_0x7ae4('0x36')]){_0x42f718[_0x7ae4('0x34')]=_['merge'](_0x42f718[_0x7ae4('0x34')],{'$or':_[_0x7ae4('0x26')](_0x2626f0,function(_0x37ee58){if(_0x37ee58['type']!==_0x7ae4('0x37')){var _0x178461={};_0x178461[_0x37ee58[_0x7ae4('0x24')]]={'$like':'%'+_0x9b4a52[_0x7ae4('0x2b')][_0x7ae4('0x36')]+'%'};return _0x178461;}})});}_0x42f718=_['merge']({},_0x42f718,_0x9b4a52[_0x7ae4('0x38')]);var _0x41041f={'where':_0x42f718[_0x7ae4('0x34')]};return db[_0x7ae4('0x27')][_0x7ae4('0x1c')](_0x41041f)[_0x7ae4('0x22')](function(_0x9b14da){_0x3afb7e[_0x7ae4('0x1c')]=_0x9b14da;if(_0x9b4a52[_0x7ae4('0x2b')][_0x7ae4('0x39')]){_0x42f718[_0x7ae4('0x3a')]=[{'all':!![]}];}return db['MailSubstatus'][_0x7ae4('0x3b')](_0x42f718);})['then'](function(_0x17437f){_0x3afb7e[_0x7ae4('0x3c')]=_0x17437f;return _0x3afb7e;})[_0x7ae4('0x22')](respondWithFilteredResult(_0x17b096,_0x42f718))[_0x7ae4('0x3d')](handleError(_0x17b096,null));};exports[_0x7ae4('0x3e')]=function(_0x135d67,_0x4498ef){var _0x1af5b9={'raw':!![],'where':{'id':_0x135d67['params']['id']}},_0x11c963={};_0x11c963['model']=_['keys'](db['MailSubstatus']['rawAttributes']);_0x11c963[_0x7ae4('0x2b')]=_[_0x7ae4('0x2c')](_0x135d67[_0x7ae4('0x2b')]);_0x11c963[_0x7ae4('0x2d')]=_[_0x7ae4('0x2e')](_0x11c963[_0x7ae4('0x2a')],_0x11c963[_0x7ae4('0x2b')]);_0x1af5b9['attributes']=_[_0x7ae4('0x2e')](_0x11c963[_0x7ae4('0x2a')],qs['fields'](_0x135d67['query'][_0x7ae4('0x2f')]));_0x1af5b9[_0x7ae4('0x30')]=_0x1af5b9['attributes'][_0x7ae4('0x31')]?_0x1af5b9['attributes']:_0x11c963['model'];if(_0x135d67[_0x7ae4('0x2b')][_0x7ae4('0x39')]){_0x1af5b9[_0x7ae4('0x3a')]=[{'all':!![]}];}_0x1af5b9=_[_0x7ae4('0x3f')]({},_0x1af5b9,_0x135d67['options']);return db[_0x7ae4('0x27')][_0x7ae4('0x40')](_0x1af5b9)[_0x7ae4('0x22')](handleEntityNotFound(_0x4498ef,null))[_0x7ae4('0x22')](respondWithResult(_0x4498ef,null))[_0x7ae4('0x3d')](handleError(_0x4498ef,null));};exports[_0x7ae4('0x41')]=function(_0xd87b7c,_0x105c82){return db['MailSubstatus'][_0x7ae4('0x41')](_0xd87b7c[_0x7ae4('0x42')],{})[_0x7ae4('0x22')](respondWithResult(_0x105c82,0xc9))[_0x7ae4('0x3d')](handleError(_0x105c82,null));};exports[_0x7ae4('0x43')]=function(_0x5e1f2b,_0x5090b6){if(_0x5e1f2b[_0x7ae4('0x42')]['id']){delete _0x5e1f2b[_0x7ae4('0x42')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x5e1f2b[_0x7ae4('0x44')]['id']}})[_0x7ae4('0x22')](handleEntityNotFound(_0x5090b6,null))[_0x7ae4('0x22')](saveUpdates(_0x5e1f2b['body'],null))['then'](respondWithResult(_0x5090b6,null))[_0x7ae4('0x3d')](handleError(_0x5090b6,null));};exports[_0x7ae4('0x45')]=function(_0x40f5e0,_0xc81030){return db['MailSubstatus'][_0x7ae4('0x40')]({'where':{'id':_0x40f5e0[_0x7ae4('0x44')]['id']}})[_0x7ae4('0x22')](handleEntityNotFound(_0xc81030,null))['then'](removeEntity(_0xc81030,null))[_0x7ae4('0x3d')](handleError(_0xc81030,null));};exports[_0x7ae4('0x46')]=function(_0x3ba6db,_0x3a51dd){return db[_0x7ae4('0x27')][_0x7ae4('0x46')]()[_0x7ae4('0x22')](respondWithResult(_0x3a51dd,null))['catch'](handleError(_0x3a51dd,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index f34c3bb..847c61e 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74de=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x74de,0x187));var _0xe74d=function(_0x26cd6a,_0x5ed59c){_0x26cd6a=_0x26cd6a-0x0;var _0x1ae60a=_0x74de[_0x26cd6a];return _0x1ae60a;};'use strict';var EventEmitter=require(_0xe74d('0x0'));var MailSubstatus=require(_0xe74d('0x1'))['db'][_0xe74d('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe74d('0x3')](0x0);var events={'afterUpdate':_0xe74d('0x4')};function emitEvent(_0x2e55fd){return function(_0x7395ec,_0x43ffbc,_0x15ae07){MailSubstatusEvents[_0xe74d('0x5')](_0x2e55fd+':'+_0x7395ec['id'],_0x7395ec);MailSubstatusEvents['emit'](_0x2e55fd,_0x7395ec);_0x15ae07(null);};}for(var e in events){if(events[_0xe74d('0x6')](e)){var event=events[e];MailSubstatus[_0xe74d('0x7')](e,emitEvent(event));}}module[_0xe74d('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0xed67=['setMaxListeners','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x4a5437,_0x373721){var _0x387aad=function(_0x1dbf15){while(--_0x1dbf15){_0x4a5437['push'](_0x4a5437['shift']());}};_0x387aad(++_0x373721);}(_0xed67,0xed));var _0x7ed6=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0xed67[_0x2a8c21];return _0x5f3061;};'use strict';var EventEmitter=require(_0x7ed6('0x0'));var MailSubstatus=require(_0x7ed6('0x1'))['db'][_0x7ed6('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x7ed6('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x289441){return function(_0x5ed099,_0x524ef7,_0x19e377){MailSubstatusEvents[_0x7ed6('0x4')](_0x289441+':'+_0x5ed099['id'],_0x5ed099);MailSubstatusEvents['emit'](_0x289441,_0x5ed099);_0x19e377(null);};}for(var e in events){if(events[_0x7ed6('0x5')](e)){var event=events[e];MailSubstatus[_0x7ed6('0x6')](e,emitEvent(event));}}module[_0x7ed6('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index ae5b43e..32e1b2b 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 _0x6a63=['MailSubstatus','mail_substatuses','update','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','define'];(function(_0x3fc9f1,_0x39e46f){var _0x5b7c86=function(_0x4cbaa9){while(--_0x4cbaa9){_0x3fc9f1['push'](_0x3fc9f1['shift']());}};_0x5b7c86(++_0x39e46f);}(_0x6a63,0x141));var _0x36a6=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x6a63[_0x40ac5e];return _0x2839d6;};'use strict';var attributes=require(_0x36a6('0x0'));module[_0x36a6('0x1')]=function(_0x178e75){var _0x3dd4d8=_0x178e75['models'];return _0x178e75[_0x36a6('0x2')](_0x36a6('0x3'),attributes,{'tableName':_0x36a6('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x30bc40,_0x2328bb,_0x342567){return _0x3dd4d8['Condition'][_0x36a6('0x5')]({'value':_0x30bc40['name']},{'where':{'field':_0x36a6('0x6'),'value':_0x30bc40[_0x36a6('0x7')]['name']}})[_0x36a6('0x8')](function(){_0x342567();})['catch'](function(_0x2ba94f){_0x342567(_0x2ba94f);});}}});}; \ No newline at end of file +var _0x73cb=['exports','MailSubstatus','Condition','name','then','./mailSubstatus.attributes'];(function(_0x34be37,_0x5eb56a){var _0x3cca7f=function(_0x229b07){while(--_0x229b07){_0x34be37['push'](_0x34be37['shift']());}};_0x3cca7f(++_0x5eb56a);}(_0x73cb,0x101));var _0xb73c=function(_0xac1121,_0x11a0af){_0xac1121=_0xac1121-0x0;var _0x34d794=_0x73cb[_0xac1121];return _0x34d794;};'use strict';var attributes=require(_0xb73c('0x0'));module[_0xb73c('0x1')]=function(_0x292bb3){var _0x35d9d8=_0x292bb3['models'];return _0x292bb3['define'](_0xb73c('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x42d885,_0x593bd6,_0x2dda00){return _0x35d9d8[_0xb73c('0x3')]['update']({'value':_0x42d885[_0xb73c('0x4')]},{'where':{'field':'mailSubstatus','value':_0x42d885['_previousDataValues'][_0xb73c('0x4')]}})[_0xb73c('0x5')](function(){_0x2dda00();})['catch'](function(_0x1f73ec){_0x2dda00(_0x1f73ec);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d937ecc..166fe77 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 _0xd449=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','lodash','../../config/utils','../../config/logger'];(function(_0x5c41ae,_0x24b26b){var _0x1aee9f=function(_0x51d3b8){while(--_0x51d3b8){_0x5c41ae['push'](_0x5c41ae['shift']());}};_0x1aee9f(++_0x24b26b);}(_0xd449,0x153));var _0x9d44=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0xd449[_0x4c4042];return _0xbd10dc;};'use strict';var _=require(_0x9d44('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9d44('0x1'));var logger=require(_0x9d44('0x2'))(_0x9d44('0x3'));var config=require(_0x9d44('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9d44('0x5')][_0x9d44('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x333c78,_0x166c44,_0x158bb1){return new BPromise(function(_0x52df6c,_0x40439){return client[_0x9d44('0x7')](_0x333c78,_0x158bb1)[_0x9d44('0x8')](function(_0x1946fe){logger[_0x9d44('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x166c44,_0x9d44('0xa'));logger['debug'](_0x9d44('0xb'),_0x166c44,'request\x20sent',JSON[_0x9d44('0xc')](_0x1946fe));if(_0x1946fe[_0x9d44('0xd')]){if(_0x1946fe[_0x9d44('0xd')][_0x9d44('0xe')]===0x1f4){logger[_0x9d44('0xd')](_0x9d44('0xf'),_0x166c44,_0x1946fe[_0x9d44('0xd')][_0x9d44('0x10')]);return _0x40439(_0x1946fe[_0x9d44('0xd')]['message']);}logger[_0x9d44('0xd')](_0x9d44('0xf'),_0x166c44,_0x1946fe[_0x9d44('0xd')]['message']);return _0x52df6c(_0x1946fe[_0x9d44('0xd')][_0x9d44('0x10')]);}else{logger['info'](_0x9d44('0xf'),_0x166c44,_0x9d44('0xa'));_0x52df6c(_0x1946fe['result'][_0x9d44('0x10')]);}})[_0x9d44('0x11')](function(_0x2bce68){logger[_0x9d44('0xd')](_0x9d44('0xf'),_0x166c44,_0x2bce68);_0x40439(_0x2bce68);});});} \ No newline at end of file +var _0x7951=['request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','code','MailSubstatus,\x20%s,\x20%s','error','message'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7951,0x1cb));var _0x1795=function(_0x2491d1,_0xcd3bb3){_0x2491d1=_0x2491d1-0x0;var _0x4f2ffc=_0x7951[_0x2491d1];return _0x4f2ffc;};'use strict';var _=require(_0x1795('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1795('0x1'));var rs=require(_0x1795('0x2'));var fs=require('fs');var Redis=require(_0x1795('0x3'));var db=require(_0x1795('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1795('0x5'))(_0x1795('0x6'));var config=require(_0x1795('0x7'));var jayson=require(_0x1795('0x8'));var client=jayson[_0x1795('0x9')][_0x1795('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e2e3b,_0x39eff4,_0x4156e9){return new BPromise(function(_0x39d549,_0x9bbd84){return client[_0x1795('0xb')](_0x2e2e3b,_0x4156e9)[_0x1795('0xc')](function(_0x42b883){logger[_0x1795('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x39eff4,'request\x20sent');logger[_0x1795('0xe')](_0x1795('0xf'),_0x39eff4,'request\x20sent',JSON[_0x1795('0x10')](_0x42b883));if(_0x42b883['error']){if(_0x42b883['error'][_0x1795('0x11')]===0x1f4){logger['error'](_0x1795('0x12'),_0x39eff4,_0x42b883[_0x1795('0x13')][_0x1795('0x14')]);return _0x9bbd84(_0x42b883[_0x1795('0x13')][_0x1795('0x14')]);}logger[_0x1795('0x13')](_0x1795('0x12'),_0x39eff4,_0x42b883[_0x1795('0x13')][_0x1795('0x14')]);return _0x39d549(_0x42b883['error']['message']);}else{logger[_0x1795('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x39eff4,_0x1795('0x15'));_0x39d549(_0x42b883[_0x1795('0x16')][_0x1795('0x14')]);}})[_0x1795('0x17')](function(_0x25b13a){logger['error'](_0x1795('0x12'),_0x39eff4,_0x25b13a);_0x9bbd84(_0x25b13a);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index cabe0ce..b8ce182 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 _0x86f5=['destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','create','update','delete'];(function(_0x4a2a0d,_0x2aae5e){var _0x4d8c8d=function(_0x4d14e6){while(--_0x4d14e6){_0x4a2a0d['push'](_0x4a2a0d['shift']());}};_0x4d8c8d(++_0x2aae5e);}(_0x86f5,0x157));var _0x586f=function(_0x252ef1,_0x2e0041){_0x252ef1=_0x252ef1-0x0;var _0x25817c=_0x86f5[_0x252ef1];return _0x25817c;};'use strict';var multer=require(_0x586f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x586f('0x1'));var express=require(_0x586f('0x2'));var router=express[_0x586f('0x3')]();var fs_extra=require(_0x586f('0x4'));var auth=require(_0x586f('0x5'));var interaction=require(_0x586f('0x6'));var config=require(_0x586f('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x586f('0x8')](_0x586f('0x9'),auth[_0x586f('0xa')](),controller[_0x586f('0xb')]);router[_0x586f('0x8')](_0x586f('0xc'),auth[_0x586f('0xa')](),controller[_0x586f('0xd')]);router['post']('/',auth[_0x586f('0xa')](),controller[_0x586f('0xe')]);router['put'](_0x586f('0xc'),auth[_0x586f('0xa')](),controller[_0x586f('0xf')]);router[_0x586f('0x10')](_0x586f('0xc'),auth[_0x586f('0xa')](),controller[_0x586f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6f09=['/:id','post','put','update','delete','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x336982,_0x2fe6c6){var _0x4c399b=function(_0x3dcb8b){while(--_0x3dcb8b){_0x336982['push'](_0x336982['shift']());}};_0x4c399b(++_0x2fe6c6);}(_0x6f09,0x14a));var _0x96f0=function(_0x55c52b,_0x31571e){_0x55c52b=_0x55c52b-0x0;var _0x646475=_0x6f09[_0x55c52b];return _0x646475;};'use strict';var multer=require('multer');var util=require(_0x96f0('0x0'));var path=require(_0x96f0('0x1'));var timeout=require(_0x96f0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x96f0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x96f0('0x4'));var config=require(_0x96f0('0x5'));var controller=require(_0x96f0('0x6'));router[_0x96f0('0x7')]('/',auth['isAuthenticated'](),controller[_0x96f0('0x8')]);router[_0x96f0('0x7')](_0x96f0('0x9'),auth[_0x96f0('0xa')](),controller[_0x96f0('0xb')]);router['get'](_0x96f0('0xc'),auth[_0x96f0('0xa')](),controller['show']);router[_0x96f0('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x96f0('0xe')](_0x96f0('0xc'),auth[_0x96f0('0xa')](),controller[_0x96f0('0xf')]);router[_0x96f0('0x10')]('/:id',auth[_0x96f0('0xa')](),controller['destroy']);module[_0x96f0('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 53b7fe4..a25e95a 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x53ea79,_0x2f64a1){var _0x538b59=function(_0x946114){while(--_0x946114){_0x53ea79['push'](_0x53ea79['shift']());}};_0x538b59(++_0x2f64a1);}(_0xaa88,0x137));var _0x8aa8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xaa88[_0x138adb];return _0x1b27f2;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1799d0,_0x2f9136){var _0x13dfdc=function(_0x12b42e){while(--_0x12b42e){_0x1799d0['push'](_0x1799d0['shift']());}};_0x13dfdc(++_0x2f9136);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0xcb91[_0x3a6e4b];return _0x36572d;};'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 24249cb..140dab3 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 _0x9b8a=['Content-Range','apply','save','update','then','destroy','error','name','send','index','MailTransferReport','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x9b8a,0xc1));var _0xa9b8=function(_0x584683,_0x46a0a4){_0x584683=_0x584683-0x0;var _0x57bbf4=_0x9b8a[_0x584683];return _0x57bbf4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9b8('0x1'));var rp=require(_0xa9b8('0x2'));var moment=require(_0xa9b8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa9b8('0x4'));var util=require(_0xa9b8('0x5'));var path=require(_0xa9b8('0x6'));var sox=require(_0xa9b8('0x7'));var csv=require(_0xa9b8('0x8'));var ejs=require(_0xa9b8('0x9'));var fs=require('fs');var fs_extra=require(_0xa9b8('0xa'));var _=require(_0xa9b8('0xb'));var squel=require(_0xa9b8('0xc'));var crypto=require(_0xa9b8('0xd'));var jsforce=require(_0xa9b8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa9b8('0x8'));var querystring=require(_0xa9b8('0xf'));var Papa=require('papaparse');var Redis=require(_0xa9b8('0x10'));var authService=require(_0xa9b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa9b8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9b8('0x13'));var utils=require(_0xa9b8('0x14'));var config=require(_0xa9b8('0x15'));var licenseUtil=require(_0xa9b8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ce1c2,_0x4a5a89){_0x4a5a89=_0x4a5a89||0xcc;return function(_0x1a3ae0){if(_0x1a3ae0){return _0x2ce1c2[_0xa9b8('0x17')](_0x4a5a89);}return _0x2ce1c2[_0xa9b8('0x18')](_0x4a5a89)[_0xa9b8('0x19')]();};}function respondWithResult(_0x3927fd,_0x41f331){_0x41f331=_0x41f331||0xc8;return function(_0x241664){if(_0x241664){return _0x3927fd[_0xa9b8('0x18')](_0x41f331)[_0xa9b8('0x1a')](_0x241664);}};}function respondWithFilteredResult(_0x4887cf,_0x208f18){return function(_0x3b1772){if(_0x3b1772){var _0x52dfc4=typeof _0x208f18[_0xa9b8('0x1b')]===_0xa9b8('0x1c')&&typeof _0x208f18[_0xa9b8('0x1d')]==='undefined';var _0x49037d=_0x3b1772[_0xa9b8('0x1e')];var _0x19a728=_0x52dfc4?0x0:_0x208f18[_0xa9b8('0x1b')];var _0x182433=_0x52dfc4?_0x3b1772[_0xa9b8('0x1e')]:_0x208f18['offset']+_0x208f18[_0xa9b8('0x1d')];var _0x394816;if(_0x182433>=_0x49037d){_0x182433=_0x49037d;_0x394816=0xc8;}else{_0x394816=0xce;}_0x4887cf['status'](_0x394816);return _0x4887cf[_0xa9b8('0x1f')](_0xa9b8('0x20'),_0x19a728+'-'+_0x182433+'/'+_0x49037d)[_0xa9b8('0x1a')](_0x3b1772);}return null;};}function patchUpdates(_0x57fe7b){return function(_0x1c586c){try{jsonpatch[_0xa9b8('0x21')](_0x1c586c,_0x57fe7b,!![]);}catch(_0x239c56){return BPromise['reject'](_0x239c56);}return _0x1c586c[_0xa9b8('0x22')]();};}function saveUpdates(_0x1c5e87,_0x46ec8c){return function(_0x7fdbdc){if(_0x7fdbdc){return _0x7fdbdc[_0xa9b8('0x23')](_0x1c5e87)[_0xa9b8('0x24')](function(_0x5761ee){return _0x5761ee;});}return null;};}function removeEntity(_0x45be2c,_0x351ccb){return function(_0x5eab39){if(_0x5eab39){return _0x5eab39[_0xa9b8('0x25')]()[_0xa9b8('0x24')](function(){_0x45be2c['status'](0xcc)[_0xa9b8('0x19')]();});}};}function handleEntityNotFound(_0x2c9111,_0x40ea86){return function(_0x5b3008){if(!_0x5b3008){_0x2c9111[_0xa9b8('0x17')](0x194);}return _0x5b3008;};}function handleError(_0x2f67e8,_0x34f29a){_0x34f29a=_0x34f29a||0x1f4;return function(_0x12e6a5){logger[_0xa9b8('0x26')](_0x12e6a5['stack']);if(_0x12e6a5[_0xa9b8('0x27')]){delete _0x12e6a5['name'];}_0x2f67e8[_0xa9b8('0x18')](_0x34f29a)[_0xa9b8('0x28')](_0x12e6a5);};}exports[_0xa9b8('0x29')]=function(_0x8d22f9,_0x2dddfd){var _0x581e7a={},_0x4cf279={},_0x24f976={'count':0x0,'rows':[]};var _0x582213=_['map'](db[_0xa9b8('0x2a')]['rawAttributes'],function(_0x14b696){return{'name':_0x14b696[_0xa9b8('0x2b')],'type':_0x14b696[_0xa9b8('0x2c')][_0xa9b8('0x2d')]};});_0x4cf279['model']=_[_0xa9b8('0x2e')](_0x582213,_0xa9b8('0x27'));_0x4cf279[_0xa9b8('0x2f')]=_[_0xa9b8('0x30')](_0x8d22f9['query']);_0x4cf279[_0xa9b8('0x31')]=_['intersection'](_0x4cf279['model'],_0x4cf279[_0xa9b8('0x2f')]);_0x581e7a['attributes']=_[_0xa9b8('0x32')](_0x4cf279[_0xa9b8('0x33')],qs[_0xa9b8('0x34')](_0x8d22f9[_0xa9b8('0x2f')]['fields']));_0x581e7a[_0xa9b8('0x35')]=_0x581e7a['attributes'][_0xa9b8('0x36')]?_0x581e7a[_0xa9b8('0x35')]:_0x4cf279[_0xa9b8('0x33')];if(!_0x8d22f9[_0xa9b8('0x2f')][_0xa9b8('0x37')](_0xa9b8('0x38'))){_0x581e7a['limit']=qs['limit'](_0x8d22f9['query']['limit']);_0x581e7a[_0xa9b8('0x1b')]=qs[_0xa9b8('0x1b')](_0x8d22f9['query']['offset']);}_0x581e7a[_0xa9b8('0x39')]=qs[_0xa9b8('0x3a')](_0x8d22f9['query']['sort']);_0x581e7a[_0xa9b8('0x3b')]=qs['filters'](_[_0xa9b8('0x3c')](_0x8d22f9[_0xa9b8('0x2f')],_0x4cf279[_0xa9b8('0x31')]),_0x582213);if(_0x8d22f9[_0xa9b8('0x2f')]['filter']){_0x581e7a[_0xa9b8('0x3b')]=_['merge'](_0x581e7a[_0xa9b8('0x3b')],{'$or':_[_0xa9b8('0x2e')](_0x582213,function(_0x52e8fe){if(_0x52e8fe[_0xa9b8('0x2c')]!==_0xa9b8('0x3d')){var _0x28cc92={};_0x28cc92[_0x52e8fe[_0xa9b8('0x27')]]={'$like':'%'+_0x8d22f9['query'][_0xa9b8('0x3e')]+'%'};return _0x28cc92;}})});}_0x581e7a=_[_0xa9b8('0x3f')]({},_0x581e7a,_0x8d22f9['options']);var _0x99512f={'where':_0x581e7a[_0xa9b8('0x3b')]};return db[_0xa9b8('0x2a')][_0xa9b8('0x1e')](_0x99512f)[_0xa9b8('0x24')](function(_0x471e18){_0x24f976[_0xa9b8('0x1e')]=_0x471e18;if(_0x8d22f9['query']['includeAll']){_0x581e7a[_0xa9b8('0x40')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x581e7a);})[_0xa9b8('0x24')](function(_0x33a94f){_0x24f976[_0xa9b8('0x41')]=_0x33a94f;return _0x24f976;})[_0xa9b8('0x24')](respondWithFilteredResult(_0x2dddfd,_0x581e7a))[_0xa9b8('0x42')](handleError(_0x2dddfd,null));};exports[_0xa9b8('0x43')]=function(_0xa5400a,_0x5c064c){var _0x46e834={'raw':!![],'where':{'id':_0xa5400a[_0xa9b8('0x44')]['id']}},_0x30156a={};_0x30156a[_0xa9b8('0x33')]=_[_0xa9b8('0x30')](db[_0xa9b8('0x2a')][_0xa9b8('0x45')]);_0x30156a[_0xa9b8('0x2f')]=_[_0xa9b8('0x30')](_0xa5400a[_0xa9b8('0x2f')]);_0x30156a[_0xa9b8('0x31')]=_['intersection'](_0x30156a[_0xa9b8('0x33')],_0x30156a[_0xa9b8('0x2f')]);_0x46e834[_0xa9b8('0x35')]=_[_0xa9b8('0x32')](_0x30156a[_0xa9b8('0x33')],qs[_0xa9b8('0x34')](_0xa5400a['query'][_0xa9b8('0x34')]));_0x46e834[_0xa9b8('0x35')]=_0x46e834[_0xa9b8('0x35')]['length']?_0x46e834[_0xa9b8('0x35')]:_0x30156a[_0xa9b8('0x33')];if(_0xa5400a[_0xa9b8('0x2f')][_0xa9b8('0x46')]){_0x46e834[_0xa9b8('0x40')]=[{'all':!![]}];}_0x46e834=_[_0xa9b8('0x3f')]({},_0x46e834,_0xa5400a['options']);return db[_0xa9b8('0x2a')][_0xa9b8('0x47')](_0x46e834)['then'](handleEntityNotFound(_0x5c064c,null))[_0xa9b8('0x24')](respondWithResult(_0x5c064c,null))[_0xa9b8('0x42')](handleError(_0x5c064c,null));};exports[_0xa9b8('0x48')]=function(_0xcdcb14,_0x38fac4){return db[_0xa9b8('0x2a')][_0xa9b8('0x48')](_0xcdcb14[_0xa9b8('0x49')],{})['then'](respondWithResult(_0x38fac4,0xc9))[_0xa9b8('0x42')](handleError(_0x38fac4,null));};exports[_0xa9b8('0x23')]=function(_0x3cb662,_0x2067c6){if(_0x3cb662[_0xa9b8('0x49')]['id']){delete _0x3cb662[_0xa9b8('0x49')]['id'];}return db[_0xa9b8('0x2a')][_0xa9b8('0x47')]({'where':{'id':_0x3cb662['params']['id']}})['then'](handleEntityNotFound(_0x2067c6,null))[_0xa9b8('0x24')](saveUpdates(_0x3cb662[_0xa9b8('0x49')],null))[_0xa9b8('0x24')](respondWithResult(_0x2067c6,null))[_0xa9b8('0x42')](handleError(_0x2067c6,null));};exports[_0xa9b8('0x25')]=function(_0x279e21,_0x1381a0){return db[_0xa9b8('0x2a')]['find']({'where':{'id':_0x279e21[_0xa9b8('0x44')]['id']}})[_0xa9b8('0x24')](handleEntityNotFound(_0x1381a0,null))[_0xa9b8('0x24')](removeEntity(_0x1381a0,null))[_0xa9b8('0x42')](handleError(_0x1381a0,null));};exports['describe']=function(_0x446514,_0x4f4790){return db[_0xa9b8('0x2a')][_0xa9b8('0x4a')]()[_0xa9b8('0x24')](respondWithResult(_0x4f4790,null))[_0xa9b8('0x42')](handleError(_0x4f4790,null));}; \ No newline at end of file +var _0xac37=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','query','intersection','model','fields','attributes','length','hasOwnProperty','limit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac37,0x1c0));var _0x7ac3=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xac37[_0x38ced4];return _0x547c07;};'use strict';var emlformat=require(_0x7ac3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7ac3('0x1'));var rp=require(_0x7ac3('0x2'));var moment=require('moment');var BPromise=require(_0x7ac3('0x3'));var Mustache=require('mustache');var util=require(_0x7ac3('0x4'));var path=require(_0x7ac3('0x5'));var sox=require('sox');var csv=require(_0x7ac3('0x6'));var ejs=require(_0x7ac3('0x7'));var fs=require('fs');var fs_extra=require(_0x7ac3('0x8'));var _=require(_0x7ac3('0x9'));var squel=require(_0x7ac3('0xa'));var crypto=require(_0x7ac3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7ac3('0xc'));var toCsv=require(_0x7ac3('0x6'));var querystring=require(_0x7ac3('0xd'));var Papa=require(_0x7ac3('0xe'));var Redis=require(_0x7ac3('0xf'));var authService=require(_0x7ac3('0x10'));var qs=require(_0x7ac3('0x11'));var as=require(_0x7ac3('0x12'));var hardwareService=require(_0x7ac3('0x13'));var logger=require(_0x7ac3('0x14'))(_0x7ac3('0x15'));var utils=require(_0x7ac3('0x16'));var config=require(_0x7ac3('0x17'));var licenseUtil=require(_0x7ac3('0x18'));var db=require(_0x7ac3('0x19'))['db'];function respondWithStatusCode(_0x26d7d3,_0x538e57){_0x538e57=_0x538e57||0xcc;return function(_0xb54822){if(_0xb54822){return _0x26d7d3[_0x7ac3('0x1a')](_0x538e57);}return _0x26d7d3[_0x7ac3('0x1b')](_0x538e57)[_0x7ac3('0x1c')]();};}function respondWithResult(_0x23c134,_0x4fc45){_0x4fc45=_0x4fc45||0xc8;return function(_0x5a8964){if(_0x5a8964){return _0x23c134[_0x7ac3('0x1b')](_0x4fc45)[_0x7ac3('0x1d')](_0x5a8964);}};}function respondWithFilteredResult(_0x1f7ba2,_0x5ce1d5){return function(_0x48da82){if(_0x48da82){var _0x14fc25=typeof _0x5ce1d5[_0x7ac3('0x1e')]===_0x7ac3('0x1f')&&typeof _0x5ce1d5['limit']==='undefined';var _0x316633=_0x48da82[_0x7ac3('0x20')];var _0xf7a2c=_0x14fc25?0x0:_0x5ce1d5['offset'];var _0x4ce26f=_0x14fc25?_0x48da82['count']:_0x5ce1d5[_0x7ac3('0x1e')]+_0x5ce1d5['limit'];var _0x5d529e;if(_0x4ce26f>=_0x316633){_0x4ce26f=_0x316633;_0x5d529e=0xc8;}else{_0x5d529e=0xce;}_0x1f7ba2[_0x7ac3('0x1b')](_0x5d529e);return _0x1f7ba2[_0x7ac3('0x21')]('Content-Range',_0xf7a2c+'-'+_0x4ce26f+'/'+_0x316633)['json'](_0x48da82);}return null;};}function patchUpdates(_0x33f8d3){return function(_0x58cf20){try{jsonpatch[_0x7ac3('0x22')](_0x58cf20,_0x33f8d3,!![]);}catch(_0x3a608e){return BPromise[_0x7ac3('0x23')](_0x3a608e);}return _0x58cf20[_0x7ac3('0x24')]();};}function saveUpdates(_0x4cbe97,_0x5d2c9d){return function(_0x3d365b){if(_0x3d365b){return _0x3d365b[_0x7ac3('0x25')](_0x4cbe97)[_0x7ac3('0x26')](function(_0x5622bf){return _0x5622bf;});}return null;};}function removeEntity(_0x1f559f,_0x3745f3){return function(_0x49a1a7){if(_0x49a1a7){return _0x49a1a7[_0x7ac3('0x27')]()['then'](function(){_0x1f559f[_0x7ac3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2adc5a,_0x2bc0ad){return function(_0x117545){if(!_0x117545){_0x2adc5a[_0x7ac3('0x1a')](0x194);}return _0x117545;};}function handleError(_0x57beaa,_0x2414c9){_0x2414c9=_0x2414c9||0x1f4;return function(_0x1eae4e){logger[_0x7ac3('0x28')](_0x1eae4e[_0x7ac3('0x29')]);if(_0x1eae4e[_0x7ac3('0x2a')]){delete _0x1eae4e[_0x7ac3('0x2a')];}_0x57beaa[_0x7ac3('0x1b')](_0x2414c9)[_0x7ac3('0x2b')](_0x1eae4e);};}exports[_0x7ac3('0x2c')]=function(_0x2e1af7,_0x3e8b28){var _0x443ffe={},_0x1aafc4={},_0xa57481={'count':0x0,'rows':[]};var _0xabbec7=_[_0x7ac3('0x2d')](db[_0x7ac3('0x2e')][_0x7ac3('0x2f')],function(_0x4e270d){return{'name':_0x4e270d[_0x7ac3('0x30')],'type':_0x4e270d['type']['key']};});_0x1aafc4['model']=_[_0x7ac3('0x2d')](_0xabbec7,_0x7ac3('0x2a'));_0x1aafc4[_0x7ac3('0x31')]=_['keys'](_0x2e1af7[_0x7ac3('0x31')]);_0x1aafc4['filters']=_['intersection'](_0x1aafc4['model'],_0x1aafc4[_0x7ac3('0x31')]);_0x443ffe['attributes']=_[_0x7ac3('0x32')](_0x1aafc4[_0x7ac3('0x33')],qs[_0x7ac3('0x34')](_0x2e1af7['query'][_0x7ac3('0x34')]));_0x443ffe[_0x7ac3('0x35')]=_0x443ffe[_0x7ac3('0x35')][_0x7ac3('0x36')]?_0x443ffe[_0x7ac3('0x35')]:_0x1aafc4['model'];if(!_0x2e1af7[_0x7ac3('0x31')][_0x7ac3('0x37')]('nolimit')){_0x443ffe[_0x7ac3('0x38')]=qs[_0x7ac3('0x38')](_0x2e1af7[_0x7ac3('0x31')][_0x7ac3('0x38')]);_0x443ffe[_0x7ac3('0x1e')]=qs['offset'](_0x2e1af7[_0x7ac3('0x31')][_0x7ac3('0x1e')]);}_0x443ffe['order']=qs['sort'](_0x2e1af7['query'][_0x7ac3('0x39')]);_0x443ffe['where']=qs[_0x7ac3('0x3a')](_[_0x7ac3('0x3b')](_0x2e1af7[_0x7ac3('0x31')],_0x1aafc4['filters']),_0xabbec7);if(_0x2e1af7['query'][_0x7ac3('0x3c')]){_0x443ffe[_0x7ac3('0x3d')]=_[_0x7ac3('0x3e')](_0x443ffe[_0x7ac3('0x3d')],{'$or':_[_0x7ac3('0x2d')](_0xabbec7,function(_0x29a7d9){if(_0x29a7d9['type']!==_0x7ac3('0x3f')){var _0x53f697={};_0x53f697[_0x29a7d9['name']]={'$like':'%'+_0x2e1af7[_0x7ac3('0x31')][_0x7ac3('0x3c')]+'%'};return _0x53f697;}})});}_0x443ffe=_['merge']({},_0x443ffe,_0x2e1af7[_0x7ac3('0x40')]);var _0x5f3d9d={'where':_0x443ffe[_0x7ac3('0x3d')]};return db[_0x7ac3('0x2e')][_0x7ac3('0x20')](_0x5f3d9d)[_0x7ac3('0x26')](function(_0x37350b){_0xa57481[_0x7ac3('0x20')]=_0x37350b;if(_0x2e1af7['query'][_0x7ac3('0x41')]){_0x443ffe[_0x7ac3('0x42')]=[{'all':!![]}];}return db[_0x7ac3('0x2e')][_0x7ac3('0x43')](_0x443ffe);})[_0x7ac3('0x26')](function(_0x14ef98){_0xa57481[_0x7ac3('0x44')]=_0x14ef98;return _0xa57481;})[_0x7ac3('0x26')](respondWithFilteredResult(_0x3e8b28,_0x443ffe))['catch'](handleError(_0x3e8b28,null));};exports[_0x7ac3('0x45')]=function(_0x5b102e,_0x34a291){var _0x259f2a={'raw':!![],'where':{'id':_0x5b102e[_0x7ac3('0x46')]['id']}},_0xd41ff8={};_0xd41ff8['model']=_[_0x7ac3('0x47')](db[_0x7ac3('0x2e')]['rawAttributes']);_0xd41ff8[_0x7ac3('0x31')]=_[_0x7ac3('0x47')](_0x5b102e[_0x7ac3('0x31')]);_0xd41ff8[_0x7ac3('0x3a')]=_['intersection'](_0xd41ff8[_0x7ac3('0x33')],_0xd41ff8[_0x7ac3('0x31')]);_0x259f2a[_0x7ac3('0x35')]=_[_0x7ac3('0x32')](_0xd41ff8['model'],qs[_0x7ac3('0x34')](_0x5b102e[_0x7ac3('0x31')][_0x7ac3('0x34')]));_0x259f2a['attributes']=_0x259f2a[_0x7ac3('0x35')]['length']?_0x259f2a[_0x7ac3('0x35')]:_0xd41ff8[_0x7ac3('0x33')];if(_0x5b102e['query'][_0x7ac3('0x41')]){_0x259f2a[_0x7ac3('0x42')]=[{'all':!![]}];}_0x259f2a=_[_0x7ac3('0x3e')]({},_0x259f2a,_0x5b102e[_0x7ac3('0x40')]);return db[_0x7ac3('0x2e')][_0x7ac3('0x48')](_0x259f2a)['then'](handleEntityNotFound(_0x34a291,null))[_0x7ac3('0x26')](respondWithResult(_0x34a291,null))[_0x7ac3('0x49')](handleError(_0x34a291,null));};exports[_0x7ac3('0x4a')]=function(_0x448645,_0x1af269){return db[_0x7ac3('0x2e')][_0x7ac3('0x4a')](_0x448645[_0x7ac3('0x4b')],{})['then'](respondWithResult(_0x1af269,0xc9))[_0x7ac3('0x49')](handleError(_0x1af269,null));};exports['update']=function(_0x49de99,_0x3379e3){if(_0x49de99['body']['id']){delete _0x49de99[_0x7ac3('0x4b')]['id'];}return db[_0x7ac3('0x2e')]['find']({'where':{'id':_0x49de99['params']['id']}})[_0x7ac3('0x26')](handleEntityNotFound(_0x3379e3,null))[_0x7ac3('0x26')](saveUpdates(_0x49de99['body'],null))['then'](respondWithResult(_0x3379e3,null))[_0x7ac3('0x49')](handleError(_0x3379e3,null));};exports[_0x7ac3('0x27')]=function(_0x446df7,_0x1d9bdb){return db['MailTransferReport']['find']({'where':{'id':_0x446df7['params']['id']}})[_0x7ac3('0x26')](handleEntityNotFound(_0x1d9bdb,null))[_0x7ac3('0x26')](removeEntity(_0x1d9bdb,null))[_0x7ac3('0x49')](handleError(_0x1d9bdb,null));};exports[_0x7ac3('0x4c')]=function(_0x73d591,_0x416a66){return db['MailTransferReport']['describe']()[_0x7ac3('0x26')](respondWithResult(_0x416a66,null))[_0x7ac3('0x49')](handleError(_0x416a66,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 91e41b5..97575a3 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 _0x70a1=['util','../../config/logger','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash'];(function(_0x471c80,_0x3d9e5f){var _0x188adc=function(_0x21f1bd){while(--_0x21f1bd){_0x471c80['push'](_0x471c80['shift']());}};_0x188adc(++_0x3d9e5f);}(_0x70a1,0x154));var _0x170a=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x70a1[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0x170a('0x0'));var util=require(_0x170a('0x1'));var logger=require(_0x170a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x170a('0x3'));var fs=require('fs');var path=require(_0x170a('0x4'));var rimraf=require(_0x170a('0x5'));var config=require('../../config/environment');var attributes=require(_0x170a('0x6'));module[_0x170a('0x7')]=function(_0x21c8f2,_0x1d6e4f){return _0x21c8f2[_0x170a('0x8')](_0x170a('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x170a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b1d=['bluebird','request-promise','path','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','api','moment'];(function(_0x58e7be,_0x4ff570){var _0x56589e=function(_0x5f1d45){while(--_0x5f1d45){_0x58e7be['push'](_0x58e7be['shift']());}};_0x56589e(++_0x4ff570);}(_0x6b1d,0xc9));var _0xd6b1=function(_0x746739,_0x289561){_0x746739=_0x746739-0x0;var _0x4b7447=_0x6b1d[_0x746739];return _0x4b7447;};'use strict';var _=require('lodash');var util=require(_0xd6b1('0x0'));var logger=require('../../config/logger')(_0xd6b1('0x1'));var moment=require(_0xd6b1('0x2'));var BPromise=require(_0xd6b1('0x3'));var rp=require(_0xd6b1('0x4'));var fs=require('fs');var path=require(_0xd6b1('0x5'));var rimraf=require('rimraf');var config=require(_0xd6b1('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0xd6b1('0x7')]=function(_0x37345b,_0x106639){return _0x37345b[_0xd6b1('0x8')](_0xd6b1('0x9'),attributes,{'tableName':_0xd6b1('0xa'),'paranoid':![],'indexes':[{'name':_0xd6b1('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index c70d588..8a90359 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 _0x8c48=['client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x41699c,_0x317092){var _0xb1e0ad=function(_0x205f83){while(--_0x205f83){_0x41699c['push'](_0x41699c['shift']());}};_0xb1e0ad(++_0x317092);}(_0x8c48,0x12b));var _0x88c4=function(_0x5e3156,_0x402b3b){_0x5e3156=_0x5e3156-0x0;var _0x2d8d49=_0x8c48[_0x5e3156];return _0x2d8d49;};'use strict';var _=require(_0x88c4('0x0'));var util=require(_0x88c4('0x1'));var moment=require(_0x88c4('0x2'));var BPromise=require('bluebird');var rs=require(_0x88c4('0x3'));var fs=require('fs');var Redis=require(_0x88c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x88c4('0x5'))(_0x88c4('0x6'));var config=require(_0x88c4('0x7'));var jayson=require(_0x88c4('0x8'));var client=jayson[_0x88c4('0x9')][_0x88c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x451568,_0x2365b8,_0xd9b22a){return new BPromise(function(_0x1606c9,_0x4c93ee){return client['request'](_0x451568,_0xd9b22a)[_0x88c4('0xb')](function(_0x2e0e00){logger[_0x88c4('0xc')](_0x88c4('0xd'),_0x2365b8,_0x88c4('0xe'));logger[_0x88c4('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2365b8,_0x88c4('0xe'),JSON[_0x88c4('0x10')](_0x2e0e00));if(_0x2e0e00['error']){if(_0x2e0e00[_0x88c4('0x11')][_0x88c4('0x12')]===0x1f4){logger[_0x88c4('0x11')](_0x88c4('0xd'),_0x2365b8,_0x2e0e00[_0x88c4('0x11')][_0x88c4('0x13')]);return _0x4c93ee(_0x2e0e00[_0x88c4('0x11')][_0x88c4('0x13')]);}logger[_0x88c4('0x11')](_0x88c4('0xd'),_0x2365b8,_0x2e0e00[_0x88c4('0x11')][_0x88c4('0x13')]);return _0x1606c9(_0x2e0e00[_0x88c4('0x11')][_0x88c4('0x13')]);}else{logger[_0x88c4('0xc')](_0x88c4('0xd'),_0x2365b8,'request\x20sent');_0x1606c9(_0x2e0e00[_0x88c4('0x14')][_0x88c4('0x13')]);}})[_0x88c4('0x15')](function(_0x715881){logger[_0x88c4('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x2365b8,_0x715881);_0x4c93ee(_0x715881);});});} \ No newline at end of file +var _0xc84a=['jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xc84a,0xd4));var _0xac84=function(_0x13e337,_0x5276b6){_0x13e337=_0x13e337-0x0;var _0x19db03=_0xc84a[_0x13e337];return _0x19db03;};'use strict';var _=require(_0xac84('0x0'));var util=require(_0xac84('0x1'));var moment=require(_0xac84('0x2'));var BPromise=require('bluebird');var rs=require(_0xac84('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac84('0x4'))['db'];var utils=require(_0xac84('0x5'));var logger=require(_0xac84('0x6'))('rpc');var config=require(_0xac84('0x7'));var jayson=require(_0xac84('0x8'));var client=jayson[_0xac84('0x9')][_0xac84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x787a5f,_0x222f07,_0x11bc1e){return new BPromise(function(_0x25e952,_0x4eb3dc){return client[_0xac84('0xb')](_0x787a5f,_0x11bc1e)[_0xac84('0xc')](function(_0x388499){logger[_0xac84('0xd')](_0xac84('0xe'),_0x222f07,'request\x20sent');logger[_0xac84('0xf')](_0xac84('0x10'),_0x222f07,_0xac84('0x11'),JSON['stringify'](_0x388499));if(_0x388499[_0xac84('0x12')]){if(_0x388499[_0xac84('0x12')][_0xac84('0x13')]===0x1f4){logger[_0xac84('0x12')](_0xac84('0xe'),_0x222f07,_0x388499[_0xac84('0x12')][_0xac84('0x14')]);return _0x4eb3dc(_0x388499[_0xac84('0x12')][_0xac84('0x14')]);}logger[_0xac84('0x12')](_0xac84('0xe'),_0x222f07,_0x388499[_0xac84('0x12')]['message']);return _0x25e952(_0x388499[_0xac84('0x12')][_0xac84('0x14')]);}else{logger['info'](_0xac84('0xe'),_0x222f07,_0xac84('0x11'));_0x25e952(_0x388499[_0xac84('0x15')][_0xac84('0x14')]);}})['catch'](function(_0x2b13a0){logger[_0xac84('0x12')](_0xac84('0xe'),_0x222f07,_0x2b13a0);_0x4eb3dc(_0x2b13a0);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 7bce819..c9fbcaf 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 _0xd6e0=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/:id','post','put','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd6e0,0x1b3));var _0x0d6e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xd6e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0d6e('0x0'));var util=require(_0x0d6e('0x1'));var path=require(_0x0d6e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d6e('0x3')]();var fs_extra=require(_0x0d6e('0x4'));var auth=require(_0x0d6e('0x5'));var interaction=require(_0x0d6e('0x6'));var config=require(_0x0d6e('0x7'));var controller=require(_0x0d6e('0x8'));router[_0x0d6e('0x9')]('/',auth[_0x0d6e('0xa')](),controller['index']);router[_0x0d6e('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0d6e('0x9')](_0x0d6e('0xb'),auth[_0x0d6e('0xa')](),controller['show']);router[_0x0d6e('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0d6e('0xd')](_0x0d6e('0xb'),auth[_0x0d6e('0xa')](),controller['update']);router['delete'](_0x0d6e('0xb'),auth[_0x0d6e('0xa')](),controller['destroy']);module[_0x0d6e('0xe')]=router; \ No newline at end of file +var _0x027f=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','/:id','show','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x027f,0x140));var _0xf027=function(_0x101ac5,_0x3fa8a1){_0x101ac5=_0x101ac5-0x0;var _0x39a1a3=_0x027f[_0x101ac5];return _0x39a1a3;};'use strict';var multer=require(_0xf027('0x0'));var util=require(_0xf027('0x1'));var path=require(_0xf027('0x2'));var timeout=require(_0xf027('0x3'));var express=require(_0xf027('0x4'));var router=express[_0xf027('0x5')]();var fs_extra=require(_0xf027('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf027('0x7'));var config=require(_0xf027('0x8'));var controller=require(_0xf027('0x9'));router[_0xf027('0xa')]('/',auth[_0xf027('0xb')](),controller['index']);router[_0xf027('0xa')](_0xf027('0xc'),auth[_0xf027('0xb')](),controller['describe']);router['get'](_0xf027('0xd'),auth[_0xf027('0xb')](),controller[_0xf027('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf027('0xf')](_0xf027('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf027('0xb')](),controller[_0xf027('0x10')]);module[_0xf027('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ea53f73..52b2b70 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 _0xa405=['exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue'];(function(_0x593499,_0x586773){var _0x13c7d0=function(_0x53c7bc){while(--_0x53c7bc){_0x593499['push'](_0x593499['shift']());}};_0x13c7d0(++_0x586773);}(_0xa405,0x195));var _0x5a40=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa405[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x5a40('0x0'));var moment=require(_0x5a40('0x1'));module[_0x5a40('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5a40('0x3')]},'interface':{'type':Sequelize[_0x5a40('0x3')]},'type':{'type':Sequelize[_0x5a40('0x3')],'defaultValue':_0x5a40('0x4'),'comment':_0x5a40('0x5')},'duration':{'type':Sequelize[_0x5a40('0x6')]},'enterAt':{'type':Sequelize[_0x5a40('0x7')]},'exitAt':{'type':Sequelize[_0x5a40('0x7')],'set':function(_0x424e3a){var _0x5c7b50=moment(_0x424e3a);var _0x53acad=moment(this[_0x5a40('0x8')](_0x5a40('0x9')));var _0x663f88=_0x5c7b50[_0x5a40('0xa')](_0x53acad,_0x5a40('0xb'));this[_0x5a40('0xc')](_0x5a40('0xd'),_0x424e3a);this[_0x5a40('0xc')]('duration',_0x663f88>=0x0?_0x663f88:null);}},'data1':{'type':Sequelize[_0x5a40('0x3')],'comment':_0x5a40('0xe')},'data2':{'type':Sequelize[_0x5a40('0x3')],'comment':_0x5a40('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0x5a40('0x10')},'data4':{'type':Sequelize['STRING'],'comment':_0x5a40('0x11')},'data5':{'type':Sequelize[_0x5a40('0x3')],'comment':_0x5a40('0x12')},'role':{'type':Sequelize[_0x5a40('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x5a40('0x3')]}}; \ No newline at end of file +var _0xdc4c=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','exports'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xdc4c,0x166));var _0xcdc4=function(_0x27fe02,_0x4b1e01){_0x27fe02=_0x27fe02-0x0;var _0x2064d7=_0xdc4c[_0x27fe02];return _0x2064d7;};'use strict';var Sequelize=require(_0xcdc4('0x0'));var moment=require('moment');module[_0xcdc4('0x1')]={'channel':{'type':Sequelize[_0xcdc4('0x2')]},'membername':{'type':Sequelize[_0xcdc4('0x2')]},'interface':{'type':Sequelize[_0xcdc4('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xcdc4('0x3'),'comment':_0xcdc4('0x4')},'duration':{'type':Sequelize[_0xcdc4('0x5')]},'enterAt':{'type':Sequelize[_0xcdc4('0x6')]},'exitAt':{'type':Sequelize[_0xcdc4('0x6')],'set':function(_0x1bda2f){var _0x563aeb=moment(_0x1bda2f);var _0x50850e=moment(this[_0xcdc4('0x7')](_0xcdc4('0x8')));var _0x1f978a=_0x563aeb[_0xcdc4('0x9')](_0x50850e,_0xcdc4('0xa'));this[_0xcdc4('0xb')](_0xcdc4('0xc'),_0x1bda2f);this[_0xcdc4('0xb')](_0xcdc4('0xd'),_0x1f978a>=0x0?_0x1f978a:null);}},'data1':{'type':Sequelize[_0xcdc4('0x2')],'comment':_0xcdc4('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0xcdc4('0xf')},'data3':{'type':Sequelize[_0xcdc4('0x2')],'comment':_0xcdc4('0x10')},'data4':{'type':Sequelize[_0xcdc4('0x2')],'comment':_0xcdc4('0x11')},'data5':{'type':Sequelize[_0xcdc4('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xcdc4('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xcdc4('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 4b30bc1..4c873e6 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x34e8,0x12c));var _0x834e=function(_0x255b89,_0x4b326d){_0x255b89=_0x255b89-0x0;var _0x565a70=_0x34e8[_0x255b89];return _0x565a70;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xedd9,0xfc));var _0x9edd=function(_0x1436e1,_0x1d596d){_0x1436e1=_0x1436e1-0x0;var _0x4d70c1=_0xedd9[_0x1436e1];return _0x4d70c1;};'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 63a0135..8a13059 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 _0xbb55=['bluebird','request-promise','path','rimraf','../../config/environment','define','MemberReport','report_member','membername_interface','interface','util','../../config/logger','api'];(function(_0x28b9fd,_0x53c953){var _0x3c34fa=function(_0x147f4f){while(--_0x147f4f){_0x28b9fd['push'](_0x28b9fd['shift']());}};_0x3c34fa(++_0x53c953);}(_0xbb55,0xb3));var _0x5bb5=function(_0x5a0e45,_0x4f07ec){_0x5a0e45=_0x5a0e45-0x0;var _0x182f9f=_0xbb55[_0x5a0e45];return _0x182f9f;};'use strict';var _=require('lodash');var util=require(_0x5bb5('0x0'));var logger=require(_0x5bb5('0x1'))(_0x5bb5('0x2'));var moment=require('moment');var BPromise=require(_0x5bb5('0x3'));var rp=require(_0x5bb5('0x4'));var fs=require('fs');var path=require(_0x5bb5('0x5'));var rimraf=require(_0x5bb5('0x6'));var config=require(_0x5bb5('0x7'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x2807ff,_0xe33f9f){return _0x2807ff[_0x5bb5('0x8')](_0x5bb5('0x9'),attributes,{'tableName':_0x5bb5('0xa'),'paranoid':![],'indexes':[{'name':_0x5bb5('0xb'),'fields':['membername',_0x5bb5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e29=['rimraf','../../config/environment','exports','define','MemberReport','membername_interface','membername','interface','util','../../config/logger','api','bluebird','path'];(function(_0x1e81b5,_0x153b8e){var _0x63fc4f=function(_0x491bc2){while(--_0x491bc2){_0x1e81b5['push'](_0x1e81b5['shift']());}};_0x63fc4f(++_0x153b8e);}(_0x8e29,0xbe));var _0x98e2=function(_0x5a95e9,_0xde2ff9){_0x5a95e9=_0x5a95e9-0x0;var _0x5b0220=_0x8e29[_0x5a95e9];return _0x5b0220;};'use strict';var _=require('lodash');var util=require(_0x98e2('0x0'));var logger=require(_0x98e2('0x1'))(_0x98e2('0x2'));var moment=require('moment');var BPromise=require(_0x98e2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98e2('0x4'));var rimraf=require(_0x98e2('0x5'));var config=require(_0x98e2('0x6'));var attributes=require('./memberReport.attributes');module[_0x98e2('0x7')]=function(_0x9c4b93,_0x23bbe9){return _0x9c4b93[_0x98e2('0x8')](_0x98e2('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x98e2('0xa'),'fields':[_0x98e2('0xb'),_0x98e2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index a6a38da..1ddd191 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 _0x6869=['where','attributes','include','map','model','stringify','body','CreateMemberReport','update','UpdateMemberReport','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','code','error','message','info','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0x11df3e,_0x21249e){var _0x5139c4=function(_0x5d8f55){while(--_0x5d8f55){_0x11df3e['push'](_0x11df3e['shift']());}};_0x5139c4(++_0x21249e);}(_0x6869,0xe2));var _0x9686=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6869[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x9686('0x0'));var util=require(_0x9686('0x1'));var moment=require(_0x9686('0x2'));var BPromise=require('bluebird');var rs=require(_0x9686('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9686('0x4'));var logger=require(_0x9686('0x5'))(_0x9686('0x6'));var config=require(_0x9686('0x7'));var jayson=require(_0x9686('0x8'));var client=jayson['client'][_0x9686('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e4b89,_0x55ec19,_0x561279){return new BPromise(function(_0x4ef16f,_0x1eb65b){return client[_0x9686('0xa')](_0x1e4b89,_0x561279)[_0x9686('0xb')](function(_0x316f3e){logger['info'](_0x9686('0xc'),_0x55ec19,_0x9686('0xd'));logger[_0x9686('0xe')](_0x9686('0xf'),_0x55ec19,_0x9686('0xd'),JSON['stringify'](_0x316f3e));if(_0x316f3e['error']){if(_0x316f3e['error'][_0x9686('0x10')]===0x1f4){logger[_0x9686('0x11')](_0x9686('0xc'),_0x55ec19,_0x316f3e[_0x9686('0x11')][_0x9686('0x12')]);return _0x1eb65b(_0x316f3e[_0x9686('0x11')]['message']);}logger[_0x9686('0x11')](_0x9686('0xc'),_0x55ec19,_0x316f3e['error'][_0x9686('0x12')]);return _0x4ef16f(_0x316f3e[_0x9686('0x11')][_0x9686('0x12')]);}else{logger[_0x9686('0x13')](_0x9686('0xc'),_0x55ec19,_0x9686('0xd'));_0x4ef16f(_0x316f3e['result'][_0x9686('0x12')]);}})[_0x9686('0x14')](function(_0x33026f){logger[_0x9686('0x11')](_0x9686('0xc'),_0x55ec19,_0x33026f);_0x1eb65b(_0x33026f);});});}exports[_0x9686('0x15')]=function(_0x3ed0d2){var _0x2c3919=this;return new Promise(function(_0x33213a,_0x4ff6e7){return db[_0x9686('0x16')][_0x9686('0x17')]({'raw':_0x3ed0d2[_0x9686('0x18')]?_0x3ed0d2[_0x9686('0x18')][_0x9686('0x19')]===undefined?!![]:![]:!![],'where':_0x3ed0d2[_0x9686('0x18')]?_0x3ed0d2[_0x9686('0x18')][_0x9686('0x1a')]||null:null,'attributes':_0x3ed0d2[_0x9686('0x18')]?_0x3ed0d2[_0x9686('0x18')][_0x9686('0x1b')]||null:null,'limit':_0x3ed0d2['options']?_0x3ed0d2[_0x9686('0x18')]['limit']||null:null,'include':_0x3ed0d2[_0x9686('0x18')]?_0x3ed0d2[_0x9686('0x18')][_0x9686('0x1c')]?_[_0x9686('0x1d')](_0x3ed0d2[_0x9686('0x18')]['include'],function(_0x26011e){return{'model':db[_0x26011e[_0x9686('0x1e')]],'as':_0x26011e['as'],'attributes':_0x26011e[_0x9686('0x1b')],'include':_0x26011e[_0x9686('0x1c')]?_[_0x9686('0x1d')](_0x26011e[_0x9686('0x1c')],function(_0x2f6d0e){return{'model':db[_0x2f6d0e[_0x9686('0x1e')]],'as':_0x2f6d0e['as'],'attributes':_0x2f6d0e['attributes'],'include':_0x2f6d0e['include']?_['map'](_0x2f6d0e[_0x9686('0x1c')],function(_0x6d8b87){return{'model':db[_0x6d8b87[_0x9686('0x1e')]],'as':_0x6d8b87['as'],'attributes':_0x6d8b87[_0x9686('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9686('0xb')](function(_0x33c88d){logger[_0x9686('0x13')](_0x9686('0x15'),_0x3ed0d2);logger[_0x9686('0xe')](_0x9686('0x15'),_0x3ed0d2,JSON[_0x9686('0x1f')](_0x33c88d));_0x33213a(_0x33c88d);})[_0x9686('0x14')](function(_0x4b9160){logger['error'](_0x9686('0x15'),_0x4b9160['message'],_0x3ed0d2);_0x4ff6e7(_0x2c3919['error'](0x1f4,_0x4b9160[_0x9686('0x12')]));});});};exports['CreateMemberReport']=function(_0x369a46){var _0x4d6495=this;return new Promise(function(_0x25d228,_0x188def){return db[_0x9686('0x16')]['create'](_0x369a46[_0x9686('0x20')],{'raw':_0x369a46[_0x9686('0x18')]?_0x369a46[_0x9686('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9686('0xb')](function(_0x219b24){logger[_0x9686('0x13')](_0x9686('0x21'),_0x369a46);logger[_0x9686('0xe')]('CreateMemberReport',_0x369a46,JSON[_0x9686('0x1f')](_0x219b24));_0x25d228(_0x219b24);})[_0x9686('0x14')](function(_0x4e77b3){logger[_0x9686('0x11')](_0x9686('0x21'),_0x4e77b3[_0x9686('0x12')],_0x369a46);_0x188def(_0x4d6495[_0x9686('0x11')](0x1f4,_0x4e77b3[_0x9686('0x12')]));});});};exports['UpdateMemberReport']=function(_0x19cb2a){var _0x495c4b=this;return new Promise(function(_0x186216,_0x1d765c){return db[_0x9686('0x16')][_0x9686('0x22')](_0x19cb2a[_0x9686('0x20')],{'raw':_0x19cb2a[_0x9686('0x18')]?_0x19cb2a['options'][_0x9686('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19cb2a[_0x9686('0x18')]?_0x19cb2a[_0x9686('0x18')][_0x9686('0x1a')]||null:null,'attributes':_0x19cb2a['options']?_0x19cb2a[_0x9686('0x18')][_0x9686('0x1b')]||null:null,'limit':_0x19cb2a[_0x9686('0x18')]?_0x19cb2a[_0x9686('0x18')]['limit']||null:null})[_0x9686('0xb')](function(_0x5eafb9){logger['info']('UpdateMemberReport',_0x19cb2a);logger[_0x9686('0xe')]('UpdateMemberReport',_0x19cb2a,JSON[_0x9686('0x1f')](_0x5eafb9));_0x186216(_0x5eafb9);})['catch'](function(_0x4b3a98){logger['error'](_0x9686('0x23'),_0x4b3a98[_0x9686('0x12')],_0x19cb2a);_0x1d765c(_0x495c4b[_0x9686('0x11')](0x1f4,_0x4b3a98['message']));});});}; \ No newline at end of file +var _0xe767=['result','catch','GetMemberReport','findAll','options','raw','where','attributes','limit','include','map','model','then','CreateMemberReport','MemberReport','create','stringify','UpdateMemberReport','update','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','info'];(function(_0x3d354b,_0x2c7cc4){var _0x44f6bc=function(_0x162cac){while(--_0x162cac){_0x3d354b['push'](_0x3d354b['shift']());}};_0x44f6bc(++_0x2c7cc4);}(_0xe767,0x11e));var _0x7e76=function(_0x437f62,_0xf713dc){_0x437f62=_0x437f62-0x0;var _0x14875b=_0xe767[_0x437f62];return _0x14875b;};'use strict';var _=require('lodash');var util=require(_0x7e76('0x0'));var moment=require(_0x7e76('0x1'));var BPromise=require(_0x7e76('0x2'));var rs=require(_0x7e76('0x3'));var fs=require('fs');var Redis=require(_0x7e76('0x4'));var db=require(_0x7e76('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e76('0x6'));var config=require('../../config/environment');var jayson=require(_0x7e76('0x7'));var client=jayson['client'][_0x7e76('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a703b,_0xd52307,_0x3aaa07){return new BPromise(function(_0x46ddea,_0x177223){return client[_0x7e76('0x9')](_0x2a703b,_0x3aaa07)['then'](function(_0x49ffa4){logger['info']('MemberReport,\x20%s,\x20%s',_0xd52307,_0x7e76('0xa'));logger[_0x7e76('0xb')](_0x7e76('0xc'),_0xd52307,'request\x20sent',JSON['stringify'](_0x49ffa4));if(_0x49ffa4[_0x7e76('0xd')]){if(_0x49ffa4['error'][_0x7e76('0xe')]===0x1f4){logger[_0x7e76('0xd')](_0x7e76('0xf'),_0xd52307,_0x49ffa4['error'][_0x7e76('0x10')]);return _0x177223(_0x49ffa4[_0x7e76('0xd')][_0x7e76('0x10')]);}logger[_0x7e76('0xd')](_0x7e76('0xf'),_0xd52307,_0x49ffa4[_0x7e76('0xd')][_0x7e76('0x10')]);return _0x46ddea(_0x49ffa4[_0x7e76('0xd')][_0x7e76('0x10')]);}else{logger[_0x7e76('0x11')]('MemberReport,\x20%s,\x20%s',_0xd52307,_0x7e76('0xa'));_0x46ddea(_0x49ffa4[_0x7e76('0x12')][_0x7e76('0x10')]);}})[_0x7e76('0x13')](function(_0x5aeeb0){logger[_0x7e76('0xd')](_0x7e76('0xf'),_0xd52307,_0x5aeeb0);_0x177223(_0x5aeeb0);});});}exports[_0x7e76('0x14')]=function(_0x479313){var _0x21d37c=this;return new Promise(function(_0x329a4d,_0x28d658){return db['MemberReport'][_0x7e76('0x15')]({'raw':_0x479313[_0x7e76('0x16')]?_0x479313['options'][_0x7e76('0x17')]===undefined?!![]:![]:!![],'where':_0x479313['options']?_0x479313[_0x7e76('0x16')][_0x7e76('0x18')]||null:null,'attributes':_0x479313[_0x7e76('0x16')]?_0x479313[_0x7e76('0x16')][_0x7e76('0x19')]||null:null,'limit':_0x479313[_0x7e76('0x16')]?_0x479313['options'][_0x7e76('0x1a')]||null:null,'include':_0x479313['options']?_0x479313[_0x7e76('0x16')][_0x7e76('0x1b')]?_[_0x7e76('0x1c')](_0x479313['options'][_0x7e76('0x1b')],function(_0x3178ce){return{'model':db[_0x3178ce['model']],'as':_0x3178ce['as'],'attributes':_0x3178ce['attributes'],'include':_0x3178ce['include']?_[_0x7e76('0x1c')](_0x3178ce[_0x7e76('0x1b')],function(_0x223f28){return{'model':db[_0x223f28[_0x7e76('0x1d')]],'as':_0x223f28['as'],'attributes':_0x223f28[_0x7e76('0x19')],'include':_0x223f28['include']?_[_0x7e76('0x1c')](_0x223f28[_0x7e76('0x1b')],function(_0x3e5716){return{'model':db[_0x3e5716[_0x7e76('0x1d')]],'as':_0x3e5716['as'],'attributes':_0x3e5716[_0x7e76('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7e76('0x1e')](function(_0x320cac){logger['info'](_0x7e76('0x14'),_0x479313);logger['debug'](_0x7e76('0x14'),_0x479313,JSON['stringify'](_0x320cac));_0x329a4d(_0x320cac);})['catch'](function(_0x7e631a){logger[_0x7e76('0xd')]('GetMemberReport',_0x7e631a[_0x7e76('0x10')],_0x479313);_0x28d658(_0x21d37c['error'](0x1f4,_0x7e631a['message']));});});};exports[_0x7e76('0x1f')]=function(_0x4d7ca8){var _0x473115=this;return new Promise(function(_0x453be3,_0x3dbcf0){return db[_0x7e76('0x20')][_0x7e76('0x21')](_0x4d7ca8['body'],{'raw':_0x4d7ca8['options']?_0x4d7ca8[_0x7e76('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x428b02){logger[_0x7e76('0x11')]('CreateMemberReport',_0x4d7ca8);logger[_0x7e76('0xb')](_0x7e76('0x1f'),_0x4d7ca8,JSON[_0x7e76('0x22')](_0x428b02));_0x453be3(_0x428b02);})[_0x7e76('0x13')](function(_0x984ea0){logger[_0x7e76('0xd')]('CreateMemberReport',_0x984ea0['message'],_0x4d7ca8);_0x3dbcf0(_0x473115[_0x7e76('0xd')](0x1f4,_0x984ea0[_0x7e76('0x10')]));});});};exports[_0x7e76('0x23')]=function(_0x5e9b81){var _0x16607d=this;return new Promise(function(_0x2c08ef,_0x18674e){return db[_0x7e76('0x20')][_0x7e76('0x24')](_0x5e9b81[_0x7e76('0x25')],{'raw':_0x5e9b81[_0x7e76('0x16')]?_0x5e9b81['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e9b81[_0x7e76('0x16')]?_0x5e9b81[_0x7e76('0x16')][_0x7e76('0x18')]||null:null,'attributes':_0x5e9b81[_0x7e76('0x16')]?_0x5e9b81['options']['attributes']||null:null,'limit':_0x5e9b81[_0x7e76('0x16')]?_0x5e9b81[_0x7e76('0x16')][_0x7e76('0x1a')]||null:null})['then'](function(_0x329bc4){logger[_0x7e76('0x11')](_0x7e76('0x23'),_0x5e9b81);logger[_0x7e76('0xb')]('UpdateMemberReport',_0x5e9b81,JSON[_0x7e76('0x22')](_0x329bc4));_0x2c08ef(_0x329bc4);})['catch'](function(_0x289105){logger[_0x7e76('0xd')](_0x7e76('0x23'),_0x289105[_0x7e76('0x10')],_0x5e9b81);_0x18674e(_0x16607d[_0x7e76('0xd')](0x1f4,_0x289105['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 3ec7fa7..f8388ec 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 _0x9652=['./migration.controller','exports','multer','path','express','Router','../../config/environment'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x9652,0x198));var _0x2965=function(_0x1dd467,_0x4a19b4){_0x1dd467=_0x1dd467-0x0;var _0x106e44=_0x9652[_0x1dd467];return _0x106e44;};'use strict';var multer=require(_0x2965('0x0'));var util=require('util');var path=require(_0x2965('0x1'));var timeout=require('connect-timeout');var express=require(_0x2965('0x2'));var router=express[_0x2965('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2965('0x4'));var controller=require(_0x2965('0x5'));router['get']('/',controller['index']);module[_0x2965('0x6')]=router; \ No newline at end of file +var _0x0af1=['./migration.controller','get','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0af1,0x135));var _0x10af=function(_0x2cdb60,_0x567e90){_0x2cdb60=_0x2cdb60-0x0;var _0x46e72c=_0x0af1[_0x2cdb60];return _0x46e72c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x10af('0x0'));var timeout=require(_0x10af('0x1'));var express=require(_0x10af('0x2'));var router=express[_0x10af('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x10af('0x4'));var interaction=require(_0x10af('0x5'));var config=require('../../config/environment');var controller=require(_0x10af('0x6'));router[_0x10af('0x7')]('/',controller['index']);module[_0x10af('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index bef6639..dd76705 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 _0x20c4=['exports'];(function(_0xf00f73,_0x147a86){var _0x38e363=function(_0x5af1d2){while(--_0x5af1d2){_0xf00f73['push'](_0xf00f73['shift']());}};_0x38e363(++_0x147a86);}(_0x20c4,0x114));var _0x420c=function(_0x3a6b47,_0x3d28c4){_0x3a6b47=_0x3a6b47-0x0;var _0x170a81=_0x20c4[_0x3a6b47];return _0x170a81;};'use strict';var Sequelize=require('sequelize');module[_0x420c('0x0')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x8c0a=['exports','sequelize'];(function(_0xa00f76,_0x166cb8){var _0x160937=function(_0xfa519c){while(--_0xfa519c){_0xa00f76['push'](_0xa00f76['shift']());}};_0x160937(++_0x166cb8);}(_0x8c0a,0xbd));var _0xa8c0=function(_0x78b38a,_0x111bbf){_0x78b38a=_0x78b38a-0x0;var _0x284da6=_0x8c0a[_0x78b38a];return _0x284da6;};'use strict';var Sequelize=require(_0xa8c0('0x0'));module[_0xa8c0('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index af112ff..b5aaf72 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 _0x49d9=['pick','filter','merge','type','includeAll','include','findAll','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','reject','save','update','then','end','error','name','send','index','map','Migration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','where'];(function(_0x338e5b,_0x2510d3){var _0x1c9b04=function(_0x157190){while(--_0x157190){_0x338e5b['push'](_0x338e5b['shift']());}};_0x1c9b04(++_0x2510d3);}(_0x49d9,0x100));var _0x949d=function(_0x12084c,_0xbb4544){_0x12084c=_0x12084c-0x0;var _0x4a3f85=_0x49d9[_0x12084c];return _0x4a3f85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x949d('0x0'));var zipdir=require(_0x949d('0x1'));var jsonpatch=require(_0x949d('0x2'));var rp=require(_0x949d('0x3'));var moment=require(_0x949d('0x4'));var BPromise=require(_0x949d('0x5'));var Mustache=require(_0x949d('0x6'));var util=require(_0x949d('0x7'));var path=require('path');var sox=require(_0x949d('0x8'));var csv=require(_0x949d('0x9'));var ejs=require(_0x949d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x949d('0xb'));var crypto=require(_0x949d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x949d('0xd'));var Papa=require(_0x949d('0xe'));var Redis=require(_0x949d('0xf'));var authService=require(_0x949d('0x10'));var qs=require(_0x949d('0x11'));var as=require(_0x949d('0x12'));var hardwareService=require(_0x949d('0x13'));var logger=require(_0x949d('0x14'))('api');var utils=require(_0x949d('0x15'));var config=require(_0x949d('0x16'));var licenseUtil=require(_0x949d('0x17'));var db=require(_0x949d('0x18'))['db'];function respondWithStatusCode(_0x1f2cb1,_0x16fcbd){_0x16fcbd=_0x16fcbd||0xcc;return function(_0x4ef82d){if(_0x4ef82d){return _0x1f2cb1[_0x949d('0x19')](_0x16fcbd);}return _0x1f2cb1['status'](_0x16fcbd)['end']();};}function respondWithResult(_0x150288,_0x539a3a){_0x539a3a=_0x539a3a||0xc8;return function(_0x26886e){if(_0x26886e){return _0x150288[_0x949d('0x1a')](_0x539a3a)['json'](_0x26886e);}};}function respondWithFilteredResult(_0x5c88bf,_0x2aaa42){return function(_0x47ef31){if(_0x47ef31){var _0x30efe7=typeof _0x2aaa42[_0x949d('0x1b')]===_0x949d('0x1c')&&typeof _0x2aaa42['limit']===_0x949d('0x1c');var _0x5313d8=_0x47ef31['count'];var _0x539140=_0x30efe7?0x0:_0x2aaa42[_0x949d('0x1b')];var _0x56f9c7=_0x30efe7?_0x47ef31[_0x949d('0x1d')]:_0x2aaa42[_0x949d('0x1b')]+_0x2aaa42[_0x949d('0x1e')];var _0x30038b;if(_0x56f9c7>=_0x5313d8){_0x56f9c7=_0x5313d8;_0x30038b=0xc8;}else{_0x30038b=0xce;}_0x5c88bf[_0x949d('0x1a')](_0x30038b);return _0x5c88bf['set']('Content-Range',_0x539140+'-'+_0x56f9c7+'/'+_0x5313d8)[_0x949d('0x1f')](_0x47ef31);}return null;};}function patchUpdates(_0x550373){return function(_0x47613b){try{jsonpatch['apply'](_0x47613b,_0x550373,!![]);}catch(_0x1b48a7){return BPromise[_0x949d('0x20')](_0x1b48a7);}return _0x47613b[_0x949d('0x21')]();};}function saveUpdates(_0x4015bb,_0x21385c){return function(_0x66bbc1){if(_0x66bbc1){return _0x66bbc1[_0x949d('0x22')](_0x4015bb)[_0x949d('0x23')](function(_0x45775a){return _0x45775a;});}return null;};}function removeEntity(_0x177678,_0x22097e){return function(_0x3a2397){if(_0x3a2397){return _0x3a2397['destroy']()[_0x949d('0x23')](function(){_0x177678[_0x949d('0x1a')](0xcc)[_0x949d('0x24')]();});}};}function handleEntityNotFound(_0x4b1ab4,_0x1915a1){return function(_0x2d24f3){if(!_0x2d24f3){_0x4b1ab4[_0x949d('0x19')](0x194);}return _0x2d24f3;};}function handleError(_0x4573eb,_0x4537d2){_0x4537d2=_0x4537d2||0x1f4;return function(_0x2874f3){logger[_0x949d('0x25')](_0x2874f3['stack']);if(_0x2874f3[_0x949d('0x26')]){delete _0x2874f3[_0x949d('0x26')];}_0x4573eb[_0x949d('0x1a')](_0x4537d2)[_0x949d('0x27')](_0x2874f3);};}exports[_0x949d('0x28')]=function(_0x241bf5,_0x1a4414){var _0x24ae4c={},_0x473609={},_0x58ff97={'count':0x0,'rows':[]};var _0x55cc0f=_[_0x949d('0x29')](db[_0x949d('0x2a')]['rawAttributes'],function(_0x3442aa){return{'name':_0x3442aa[_0x949d('0x2b')],'type':_0x3442aa['type'][_0x949d('0x2c')]};});_0x473609[_0x949d('0x2d')]=_[_0x949d('0x29')](_0x55cc0f,_0x949d('0x26'));_0x473609[_0x949d('0x2e')]=_[_0x949d('0x2f')](_0x241bf5[_0x949d('0x2e')]);_0x473609[_0x949d('0x30')]=_[_0x949d('0x31')](_0x473609[_0x949d('0x2d')],_0x473609[_0x949d('0x2e')]);_0x24ae4c[_0x949d('0x32')]=_[_0x949d('0x31')](_0x473609[_0x949d('0x2d')],qs['fields'](_0x241bf5[_0x949d('0x2e')][_0x949d('0x33')]));_0x24ae4c[_0x949d('0x32')]=_0x24ae4c[_0x949d('0x32')]['length']?_0x24ae4c[_0x949d('0x32')]:_0x473609[_0x949d('0x2d')];if(!_0x241bf5[_0x949d('0x2e')]['hasOwnProperty'](_0x949d('0x34'))){_0x24ae4c[_0x949d('0x1e')]=qs['limit'](_0x241bf5['query']['limit']);_0x24ae4c[_0x949d('0x1b')]=qs[_0x949d('0x1b')](_0x241bf5[_0x949d('0x2e')][_0x949d('0x1b')]);}_0x24ae4c['order']=qs['sort'](_0x241bf5[_0x949d('0x2e')]['sort']);_0x24ae4c[_0x949d('0x35')]=qs[_0x949d('0x30')](_[_0x949d('0x36')](_0x241bf5[_0x949d('0x2e')],_0x473609[_0x949d('0x30')]),_0x55cc0f);if(_0x241bf5[_0x949d('0x2e')][_0x949d('0x37')]){_0x24ae4c[_0x949d('0x35')]=_[_0x949d('0x38')](_0x24ae4c['where'],{'$or':_[_0x949d('0x29')](_0x55cc0f,function(_0x37d026){if(_0x37d026[_0x949d('0x39')]!=='VIRTUAL'){var _0x886499={};_0x886499[_0x37d026[_0x949d('0x26')]]={'$like':'%'+_0x241bf5[_0x949d('0x2e')]['filter']+'%'};return _0x886499;}})});}_0x24ae4c=_[_0x949d('0x38')]({},_0x24ae4c,_0x241bf5['options']);var _0x4d0731={'where':_0x24ae4c[_0x949d('0x35')]};return db[_0x949d('0x2a')][_0x949d('0x1d')](_0x4d0731)[_0x949d('0x23')](function(_0x5c1724){_0x58ff97[_0x949d('0x1d')]=_0x5c1724;if(_0x241bf5[_0x949d('0x2e')][_0x949d('0x3a')]){_0x24ae4c[_0x949d('0x3b')]=[{'all':!![]}];}return db[_0x949d('0x2a')][_0x949d('0x3c')](_0x24ae4c);})['then'](function(_0x2bd7ca){_0x58ff97['rows']=_0x2bd7ca;return _0x58ff97;})['then'](respondWithFilteredResult(_0x1a4414,_0x24ae4c))[_0x949d('0x3d')](handleError(_0x1a4414,null));}; \ No newline at end of file +var _0x8267=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel'];(function(_0x3c574d,_0x11e6e2){var _0x3bfb0f=function(_0x5af88c){while(--_0x5af88c){_0x3c574d['push'](_0x3c574d['shift']());}};_0x3bfb0f(++_0x11e6e2);}(_0x8267,0xc3));var _0x7826=function(_0x403926,_0x298a72){_0x403926=_0x403926-0x0;var _0x2b11e1=_0x8267[_0x403926];return _0x2b11e1;};'use strict';var emlformat=require(_0x7826('0x0'));var rimraf=require(_0x7826('0x1'));var zipdir=require(_0x7826('0x2'));var jsonpatch=require(_0x7826('0x3'));var rp=require(_0x7826('0x4'));var moment=require(_0x7826('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7826('0x6'));var path=require(_0x7826('0x7'));var sox=require('sox');var csv=require(_0x7826('0x8'));var ejs=require(_0x7826('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7826('0xa'));var squel=require(_0x7826('0xb'));var crypto=require('crypto');var jsforce=require(_0x7826('0xc'));var deskjs=require(_0x7826('0xd'));var toCsv=require(_0x7826('0x8'));var querystring=require('querystring');var Papa=require(_0x7826('0xe'));var Redis=require('ioredis');var authService=require(_0x7826('0xf'));var qs=require(_0x7826('0x10'));var as=require(_0x7826('0x11'));var hardwareService=require(_0x7826('0x12'));var logger=require(_0x7826('0x13'))(_0x7826('0x14'));var utils=require(_0x7826('0x15'));var config=require(_0x7826('0x16'));var licenseUtil=require(_0x7826('0x17'));var db=require(_0x7826('0x18'))['db'];function respondWithStatusCode(_0x2c6a6f,_0x39e348){_0x39e348=_0x39e348||0xcc;return function(_0x4ad322){if(_0x4ad322){return _0x2c6a6f[_0x7826('0x19')](_0x39e348);}return _0x2c6a6f[_0x7826('0x1a')](_0x39e348)['end']();};}function respondWithResult(_0x163961,_0x347c85){_0x347c85=_0x347c85||0xc8;return function(_0x4b5469){if(_0x4b5469){return _0x163961[_0x7826('0x1a')](_0x347c85)[_0x7826('0x1b')](_0x4b5469);}};}function respondWithFilteredResult(_0x67d41,_0x3a79d7){return function(_0x231561){if(_0x231561){var _0xdcb944=typeof _0x3a79d7[_0x7826('0x1c')]===_0x7826('0x1d')&&typeof _0x3a79d7[_0x7826('0x1e')]===_0x7826('0x1d');var _0x555ae9=_0x231561[_0x7826('0x1f')];var _0x1d818d=_0xdcb944?0x0:_0x3a79d7['offset'];var _0x4ac2d8=_0xdcb944?_0x231561[_0x7826('0x1f')]:_0x3a79d7[_0x7826('0x1c')]+_0x3a79d7[_0x7826('0x1e')];var _0x71092f;if(_0x4ac2d8>=_0x555ae9){_0x4ac2d8=_0x555ae9;_0x71092f=0xc8;}else{_0x71092f=0xce;}_0x67d41['status'](_0x71092f);return _0x67d41[_0x7826('0x20')](_0x7826('0x21'),_0x1d818d+'-'+_0x4ac2d8+'/'+_0x555ae9)[_0x7826('0x1b')](_0x231561);}return null;};}function patchUpdates(_0x191aad){return function(_0x1001df){try{jsonpatch['apply'](_0x1001df,_0x191aad,!![]);}catch(_0xe6ce6f){return BPromise[_0x7826('0x22')](_0xe6ce6f);}return _0x1001df[_0x7826('0x23')]();};}function saveUpdates(_0x2e2dbd,_0x41b1a7){return function(_0x5bf8cc){if(_0x5bf8cc){return _0x5bf8cc[_0x7826('0x24')](_0x2e2dbd)[_0x7826('0x25')](function(_0x555752){return _0x555752;});}return null;};}function removeEntity(_0x5aac31,_0x320598){return function(_0x1ec87f){if(_0x1ec87f){return _0x1ec87f['destroy']()[_0x7826('0x25')](function(){_0x5aac31[_0x7826('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36ee4f,_0x2d8840){return function(_0x45bded){if(!_0x45bded){_0x36ee4f[_0x7826('0x19')](0x194);}return _0x45bded;};}function handleError(_0x368a5f,_0x46643e){_0x46643e=_0x46643e||0x1f4;return function(_0x105c1e){logger[_0x7826('0x26')](_0x105c1e[_0x7826('0x27')]);if(_0x105c1e[_0x7826('0x28')]){delete _0x105c1e[_0x7826('0x28')];}_0x368a5f['status'](_0x46643e)[_0x7826('0x29')](_0x105c1e);};}exports[_0x7826('0x2a')]=function(_0x3a54a0,_0x595913){var _0xb645fa={},_0x1265be={},_0x455908={'count':0x0,'rows':[]};var _0x207302=_[_0x7826('0x2b')](db[_0x7826('0x2c')][_0x7826('0x2d')],function(_0x5d0eb1){return{'name':_0x5d0eb1[_0x7826('0x2e')],'type':_0x5d0eb1[_0x7826('0x2f')][_0x7826('0x30')]};});_0x1265be[_0x7826('0x31')]=_[_0x7826('0x2b')](_0x207302,_0x7826('0x28'));_0x1265be[_0x7826('0x32')]=_['keys'](_0x3a54a0[_0x7826('0x32')]);_0x1265be[_0x7826('0x33')]=_['intersection'](_0x1265be[_0x7826('0x31')],_0x1265be[_0x7826('0x32')]);_0xb645fa[_0x7826('0x34')]=_['intersection'](_0x1265be[_0x7826('0x31')],qs[_0x7826('0x35')](_0x3a54a0['query'][_0x7826('0x35')]));_0xb645fa[_0x7826('0x34')]=_0xb645fa['attributes'][_0x7826('0x36')]?_0xb645fa[_0x7826('0x34')]:_0x1265be['model'];if(!_0x3a54a0[_0x7826('0x32')]['hasOwnProperty'](_0x7826('0x37'))){_0xb645fa[_0x7826('0x1e')]=qs[_0x7826('0x1e')](_0x3a54a0[_0x7826('0x32')][_0x7826('0x1e')]);_0xb645fa[_0x7826('0x1c')]=qs['offset'](_0x3a54a0['query'][_0x7826('0x1c')]);}_0xb645fa[_0x7826('0x38')]=qs[_0x7826('0x39')](_0x3a54a0['query'][_0x7826('0x39')]);_0xb645fa['where']=qs[_0x7826('0x33')](_[_0x7826('0x3a')](_0x3a54a0[_0x7826('0x32')],_0x1265be[_0x7826('0x33')]),_0x207302);if(_0x3a54a0[_0x7826('0x32')][_0x7826('0x3b')]){_0xb645fa[_0x7826('0x3c')]=_[_0x7826('0x3d')](_0xb645fa[_0x7826('0x3c')],{'$or':_['map'](_0x207302,function(_0x59a6e5){if(_0x59a6e5[_0x7826('0x2f')]!==_0x7826('0x3e')){var _0x241402={};_0x241402[_0x59a6e5[_0x7826('0x28')]]={'$like':'%'+_0x3a54a0[_0x7826('0x32')]['filter']+'%'};return _0x241402;}})});}_0xb645fa=_[_0x7826('0x3d')]({},_0xb645fa,_0x3a54a0[_0x7826('0x3f')]);var _0x341cbb={'where':_0xb645fa[_0x7826('0x3c')]};return db[_0x7826('0x2c')][_0x7826('0x1f')](_0x341cbb)[_0x7826('0x25')](function(_0x2a5307){_0x455908[_0x7826('0x1f')]=_0x2a5307;if(_0x3a54a0[_0x7826('0x32')][_0x7826('0x40')]){_0xb645fa[_0x7826('0x41')]=[{'all':!![]}];}return db[_0x7826('0x2c')][_0x7826('0x42')](_0xb645fa);})[_0x7826('0x25')](function(_0x488f5a){_0x455908[_0x7826('0x43')]=_0x488f5a;return _0x455908;})[_0x7826('0x25')](respondWithFilteredResult(_0x595913,_0xb645fa))[_0x7826('0x44')](handleError(_0x595913,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 62f1647..723ace7 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 _0xdb31=['util','../../config/logger','api','moment','bluebird','rimraf','exports','define','Migration','migrations'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0xdb31,0x17c));var _0x1db3=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xdb31[_0x13ce0c];return _0x4388fb;};'use strict';var _=require('lodash');var util=require(_0x1db3('0x0'));var logger=require(_0x1db3('0x1'))(_0x1db3('0x2'));var moment=require(_0x1db3('0x3'));var BPromise=require(_0x1db3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1db3('0x5'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x1db3('0x6')]=function(_0x25ed7f,_0x564872){return _0x25ed7f[_0x1db3('0x7')](_0x1db3('0x8'),attributes,{'tableName':_0x1db3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4f4=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','migrations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4f4,0xea));var _0x4a4f=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xa4f4[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0x4a4f('0x0'));var util=require('util');var logger=require(_0x4a4f('0x1'))(_0x4a4f('0x2'));var moment=require('moment');var BPromise=require(_0x4a4f('0x3'));var rp=require(_0x4a4f('0x4'));var fs=require('fs');var path=require(_0x4a4f('0x5'));var rimraf=require('rimraf');var config=require(_0x4a4f('0x6'));var attributes=require('./migration.attributes');module[_0x4a4f('0x7')]=function(_0xac1dc,_0x241e8a){return _0xac1dc['define']('Migration',attributes,{'tableName':_0x4a4f('0x8'),'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 2f93c77..9db1c43 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 _0xb627=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xb627,0x144));var _0x7b62=function(_0x36a2ed,_0x3815d4){_0x36a2ed=_0x36a2ed-0x0;var _0x2b7be4=_0xb627[_0x36a2ed];return _0x2b7be4;};'use strict';var _=require(_0x7b62('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7b62('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b62('0x2'));var db=require(_0x7b62('0x3'))['db'];var utils=require(_0x7b62('0x4'));var logger=require(_0x7b62('0x5'))(_0x7b62('0x6'));var config=require(_0x7b62('0x7'));var jayson=require(_0x7b62('0x8'));var client=jayson['client'][_0x7b62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x547533,_0x387d76,_0x264cfa){return new BPromise(function(_0x4ae3ef,_0x30652e){return client['request'](_0x547533,_0x264cfa)[_0x7b62('0xa')](function(_0x379d07){logger[_0x7b62('0xb')]('Migration,\x20%s,\x20%s',_0x387d76,_0x7b62('0xc'));logger[_0x7b62('0xd')](_0x7b62('0xe'),_0x387d76,_0x7b62('0xc'),JSON[_0x7b62('0xf')](_0x379d07));if(_0x379d07[_0x7b62('0x10')]){if(_0x379d07[_0x7b62('0x10')][_0x7b62('0x11')]===0x1f4){logger[_0x7b62('0x10')](_0x7b62('0x12'),_0x387d76,_0x379d07[_0x7b62('0x10')][_0x7b62('0x13')]);return _0x30652e(_0x379d07[_0x7b62('0x10')]['message']);}logger[_0x7b62('0x10')]('Migration,\x20%s,\x20%s',_0x387d76,_0x379d07[_0x7b62('0x10')]['message']);return _0x4ae3ef(_0x379d07[_0x7b62('0x10')]['message']);}else{logger['info'](_0x7b62('0x12'),_0x387d76,'request\x20sent');_0x4ae3ef(_0x379d07[_0x7b62('0x14')][_0x7b62('0x13')]);}})[_0x7b62('0x15')](function(_0x4ebaa2){logger[_0x7b62('0x10')]('Migration,\x20%s,\x20%s',_0x387d76,_0x4ebaa2);_0x30652e(_0x4ebaa2);});});} \ No newline at end of file +var _0x33a4=['rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x3e09dc,_0x2b9dc0){var _0x50c2c8=function(_0x2c1558){while(--_0x2c1558){_0x3e09dc['push'](_0x3e09dc['shift']());}};_0x50c2c8(++_0x2b9dc0);}(_0x33a4,0x88));var _0x433a=function(_0x3e8ad7,_0x414768){_0x3e8ad7=_0x3e8ad7-0x0;var _0x4b881a=_0x33a4[_0x3e8ad7];return _0x4b881a;};'use strict';var _=require('lodash');var util=require(_0x433a('0x0'));var moment=require('moment');var BPromise=require(_0x433a('0x1'));var rs=require(_0x433a('0x2'));var fs=require('fs');var Redis=require(_0x433a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x433a('0x4'));var config=require(_0x433a('0x5'));var jayson=require(_0x433a('0x6'));var client=jayson[_0x433a('0x7')][_0x433a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fcc88,_0x422eb9,_0x58e65c){return new BPromise(function(_0x2c2404,_0x3156ec){return client[_0x433a('0x9')](_0x4fcc88,_0x58e65c)[_0x433a('0xa')](function(_0x4c1057){logger['info'](_0x433a('0xb'),_0x422eb9,_0x433a('0xc'));logger[_0x433a('0xd')](_0x433a('0xe'),_0x422eb9,_0x433a('0xc'),JSON['stringify'](_0x4c1057));if(_0x4c1057['error']){if(_0x4c1057[_0x433a('0xf')][_0x433a('0x10')]===0x1f4){logger[_0x433a('0xf')](_0x433a('0xb'),_0x422eb9,_0x4c1057['error'][_0x433a('0x11')]);return _0x3156ec(_0x4c1057[_0x433a('0xf')]['message']);}logger[_0x433a('0xf')]('Migration,\x20%s,\x20%s',_0x422eb9,_0x4c1057[_0x433a('0xf')][_0x433a('0x11')]);return _0x2c2404(_0x4c1057[_0x433a('0xf')]['message']);}else{logger['info'](_0x433a('0xb'),_0x422eb9,_0x433a('0xc'));_0x2c2404(_0x4c1057[_0x433a('0x12')][_0x433a('0x11')]);}})[_0x433a('0x13')](function(_0x4df77a){logger['error'](_0x433a('0xb'),_0x422eb9,_0x4df77a);_0x3156ec(_0x4df77a);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7f49f90..45e8d65 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 _0x6144=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete'];(function(_0x52334f,_0x26a15f){var _0x474448=function(_0x3b5d0c){while(--_0x3b5d0c){_0x52334f['push'](_0x52334f['shift']());}};_0x474448(++_0x26a15f);}(_0x6144,0x99));var _0x4614=function(_0x1e2166,_0x3d8aab){_0x1e2166=_0x1e2166-0x0;var _0x2a5f02=_0x6144[_0x1e2166];return _0x2a5f02;};'use strict';var multer=require(_0x4614('0x0'));var util=require(_0x4614('0x1'));var path=require(_0x4614('0x2'));var timeout=require(_0x4614('0x3'));var express=require('express');var router=express[_0x4614('0x4')]();var fs_extra=require(_0x4614('0x5'));var auth=require(_0x4614('0x6'));var interaction=require(_0x4614('0x7'));var config=require('../../config/environment');var controller=require(_0x4614('0x8'));router[_0x4614('0x9')]('/',auth[_0x4614('0xa')](),controller[_0x4614('0xb')]);router[_0x4614('0x9')]('/:id',auth[_0x4614('0xa')](),controller[_0x4614('0xc')]);router[_0x4614('0xd')]('/',auth[_0x4614('0xa')](),controller['create']);router[_0x4614('0xe')](_0x4614('0xf'),auth[_0x4614('0xa')](),controller[_0x4614('0x10')]);router[_0x4614('0x11')](_0x4614('0xf'),auth[_0x4614('0xa')](),controller['destroy']);module[_0x4614('0x12')]=router; \ No newline at end of file +var _0x87d8=['index','/:id','show','post','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x87d8,0x1a9));var _0x887d=function(_0x557ba5,_0x55735b){_0x557ba5=_0x557ba5-0x0;var _0x4c7d96=_0x87d8[_0x557ba5];return _0x4c7d96;};'use strict';var multer=require('multer');var util=require(_0x887d('0x0'));var path=require(_0x887d('0x1'));var timeout=require(_0x887d('0x2'));var express=require(_0x887d('0x3'));var router=express[_0x887d('0x4')]();var fs_extra=require(_0x887d('0x5'));var auth=require(_0x887d('0x6'));var interaction=require(_0x887d('0x7'));var config=require(_0x887d('0x8'));var controller=require(_0x887d('0x9'));router[_0x887d('0xa')]('/',auth[_0x887d('0xb')](),controller[_0x887d('0xc')]);router[_0x887d('0xa')](_0x887d('0xd'),auth['isAuthenticated'](),controller[_0x887d('0xe')]);router[_0x887d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x887d('0xb')](),controller[_0x887d('0x10')]);router[_0x887d('0x11')](_0x887d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x887d('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f65d94a..6653b0f 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 _0xc132=['externip','stun','STRING','sequelize','ENUM'];(function(_0x45600b,_0x2e9e9e){var _0x398642=function(_0x18d6c1){while(--_0x18d6c1){_0x45600b['push'](_0x45600b['shift']());}};_0x398642(++_0x2e9e9e);}(_0xc132,0x152));var _0x2c13=function(_0x354540,_0x2d7deb){_0x354540=_0x354540-0x0;var _0x5941f8=_0xc132[_0x354540];return _0x5941f8;};'use strict';var Sequelize=require(_0x2c13('0x0'));module['exports']={'type':{'type':Sequelize[_0x2c13('0x1')]('localnet',_0x2c13('0x2'),_0x2c13('0x3'),'turn')},'value':{'type':Sequelize[_0x2c13('0x4')]},'username':{'type':Sequelize[_0x2c13('0x4')]},'password':{'type':Sequelize[_0x2c13('0x4')]}}; \ No newline at end of file +var _0x488f=['localnet','STRING','sequelize','exports'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0x488f,0xfa));var _0xf488=function(_0x5a4a9e,_0x470a68){_0x5a4a9e=_0x5a4a9e-0x0;var _0x354847=_0x488f[_0x5a4a9e];return _0x354847;};'use strict';var Sequelize=require(_0xf488('0x0'));module[_0xf488('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf488('0x2'),'externip','stun','turn')},'value':{'type':Sequelize[_0xf488('0x3')]},'username':{'type':Sequelize[_0xf488('0x3')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b36975c..39f5909 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 _0xae6e=['api','../../mysqldb','jayson/promise','client','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','json','offset','undefined','limit','count','status','set','Content-Range','then','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','findAll','rows','includeAll','include','merge','find','catch','create','body','type','toUpperCase','STUN','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','update','util','path','ejs','lodash','../../config/logger'];(function(_0x4f0add,_0x583904){var _0x6a96c1=function(_0x49b09e){while(--_0x49b09e){_0x4f0add['push'](_0x4f0add['shift']());}};_0x6a96c1(++_0x583904);}(_0xae6e,0x103));var _0xeae6=function(_0x37e3eb,_0x264cd3){_0x37e3eb=_0x37e3eb-0x0;var _0x477028=_0xae6e[_0x37e3eb];return _0x477028;};'use strict';var util=require(_0xeae6('0x0'));var path=require(_0xeae6('0x1'));var ejs=require(_0xeae6('0x2'));var fs=require('fs');var _=require(_0xeae6('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xeae6('0x4'))(_0xeae6('0x5'));var config=require('../../config/environment');var db=require(_0xeae6('0x6'))['db'];var jayson=require(_0xeae6('0x7'));var client=jayson[_0xeae6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7b9629,_0x2deeb5,_0x1ec8d5,_0x6bb8a9){return new Promise(function(_0x2fe3a9,_0x337e84){var _0x251813=_0x6bb8a9||client;return _0x251813[_0xeae6('0x9')](_0x7b9629,_0x1ec8d5)['then'](function(_0x1badee){logger[_0xeae6('0xa')](_0xeae6('0xb'),_0x2deeb5,_0xeae6('0xc'));logger[_0xeae6('0xd')](_0xeae6('0xe'),_0x2deeb5,_0xeae6('0xc'),JSON[_0xeae6('0xf')](_0x1badee));if(_0x1badee['error']){if(_0x1badee['error'][_0xeae6('0x10')]===0x1f4){logger[_0xeae6('0x11')]('Network,\x20%s,\x20%s',_0x2deeb5,_0x1badee[_0xeae6('0x11')][_0xeae6('0x12')]);return _0x337e84(_0x1badee['error'][_0xeae6('0x12')]);}logger[_0xeae6('0x11')](_0xeae6('0xb'),_0x2deeb5,_0x1badee['error'][_0xeae6('0x12')]);return _0x2fe3a9(_0x1badee[_0xeae6('0x11')]['message']);}else{logger['info'](_0xeae6('0xb'),_0x2deeb5,_0xeae6('0xc'));_0x2fe3a9(_0x1badee['result'][_0xeae6('0x12')]);}})['catch'](function(_0x38e7ea){logger[_0xeae6('0x11')]('Network,\x20%s,\x20%s',_0x2deeb5,_0x38e7ea);_0x337e84(_0x38e7ea);});});}function respondWithResult(_0x160483,_0x536a5c){_0x536a5c=_0x536a5c||0xc8;return function(_0xb75eae){if(_0xb75eae){return _0x160483['status'](_0x536a5c)[_0xeae6('0x13')](_0xb75eae);}};}function respondWithFilteredResult(_0x72a874,_0x4c7a75){return function(_0x4f1285){if(_0x4f1285){var _0x4805b1=typeof _0x4c7a75[_0xeae6('0x14')]===_0xeae6('0x15')&&typeof _0x4c7a75[_0xeae6('0x16')]==='undefined';var _0x19e41c=_0x4f1285['count'];var _0x35c516=_0x4805b1?0x0:_0x4c7a75[_0xeae6('0x14')];var _0x5558cc=_0x4805b1?_0x4f1285[_0xeae6('0x17')]:_0x4c7a75[_0xeae6('0x14')]+_0x4c7a75[_0xeae6('0x16')];var _0x56b85f;if(_0x5558cc>=_0x19e41c){_0x5558cc=_0x19e41c;_0x56b85f=0xc8;}else{_0x56b85f=0xce;}_0x72a874[_0xeae6('0x18')](_0x56b85f);return _0x72a874[_0xeae6('0x19')](_0xeae6('0x1a'),_0x35c516+'-'+_0x5558cc+'/'+_0x19e41c)[_0xeae6('0x13')](_0x4f1285);}return null;};}function saveUpdates(_0x379f14){return function(_0x1a1f21){if(_0x1a1f21){return _0x1a1f21['update'](_0x379f14)[_0xeae6('0x1b')](function(_0x19fe7c){return _0x19fe7c;});}return null;};}function removeEntity(_0x409296){return function(_0x138d91){if(_0x138d91){return _0x138d91[_0xeae6('0x1c')]()[_0xeae6('0x1b')](function(){_0x409296[_0xeae6('0x18')](0xcc)[_0xeae6('0x1d')]();});}};}function handleEntityNotFound(_0x32b4c2){return function(_0x16863c){if(!_0x16863c){_0x32b4c2[_0xeae6('0x1e')](0x194);}return _0x16863c;};}function handleError(_0x3581d6,_0x14cbcb){_0x14cbcb=_0x14cbcb||0x1f4;return function(_0x46fb79){logger[_0xeae6('0x11')](_0x46fb79[_0xeae6('0x1f')]);if(_0x46fb79['name']){delete _0x46fb79[_0xeae6('0x20')];}_0x3581d6[_0xeae6('0x18')](_0x14cbcb)[_0xeae6('0x21')](_0x46fb79);};}exports[_0xeae6('0x22')]=function(_0x48a507,_0x57ae4e){var _0x4215c6={},_0x75ccd7={},_0x10c812={'count':0x0,'rows':[]};var _0x2652d4=_[_0xeae6('0x23')](db[_0xeae6('0x24')][_0xeae6('0x25')],function(_0x4c6807){return{'name':_0x4c6807[_0xeae6('0x26')],'type':_0x4c6807['type'][_0xeae6('0x27')]};});_0x75ccd7[_0xeae6('0x28')]=_[_0xeae6('0x23')](_0x2652d4,'name');_0x75ccd7['query']=_[_0xeae6('0x29')](_0x48a507[_0xeae6('0x2a')]);_0x75ccd7[_0xeae6('0x2b')]=_[_0xeae6('0x2c')](_0x75ccd7[_0xeae6('0x28')],_0x75ccd7[_0xeae6('0x2a')]);_0x4215c6[_0xeae6('0x2d')]=_[_0xeae6('0x2c')](_0x75ccd7['model'],qs[_0xeae6('0x2e')](_0x48a507['query'][_0xeae6('0x2e')]));_0x4215c6[_0xeae6('0x2d')]=_0x4215c6[_0xeae6('0x2d')][_0xeae6('0x2f')]?_0x4215c6['attributes']:_0x75ccd7['model'];if(!_0x48a507[_0xeae6('0x2a')][_0xeae6('0x30')](_0xeae6('0x31'))){_0x4215c6['limit']=qs[_0xeae6('0x16')](_0x48a507['query'][_0xeae6('0x16')]);_0x4215c6[_0xeae6('0x14')]=qs[_0xeae6('0x14')](_0x48a507[_0xeae6('0x2a')]['offset']);}_0x4215c6['order']=qs[_0xeae6('0x32')](_0x48a507[_0xeae6('0x2a')][_0xeae6('0x32')]);_0x4215c6[_0xeae6('0x33')]=qs[_0xeae6('0x2b')](_[_0xeae6('0x34')](_0x48a507[_0xeae6('0x2a')],_0x75ccd7[_0xeae6('0x2b')]),_0x2652d4);if(_0x48a507[_0xeae6('0x2a')]['filter']){_0x4215c6[_0xeae6('0x33')]=_['merge'](_0x4215c6[_0xeae6('0x33')],{'$or':_[_0xeae6('0x23')](_0x2652d4,function(_0x181989){if(_0x181989['type']!==_0xeae6('0x35')){var _0x3891e4={};_0x3891e4[_0x181989[_0xeae6('0x20')]]={'$like':'%'+_0x48a507[_0xeae6('0x2a')][_0xeae6('0x36')]+'%'};return _0x3891e4;}})});}_0x4215c6=_['merge']({},_0x4215c6,_0x48a507[_0xeae6('0x37')]);var _0x302b3d={'where':_0x4215c6['where']};return db[_0xeae6('0x24')][_0xeae6('0x17')](_0x302b3d)[_0xeae6('0x1b')](function(_0x42cdf0){_0x10c812[_0xeae6('0x17')]=_0x42cdf0;if(_0x48a507['query']['includeAll']){_0x4215c6['include']=[{'all':!![]}];}return db[_0xeae6('0x24')][_0xeae6('0x38')](_0x4215c6);})[_0xeae6('0x1b')](function(_0x40c56f){_0x10c812[_0xeae6('0x39')]=_0x40c56f;return _0x10c812;})[_0xeae6('0x1b')](respondWithFilteredResult(_0x57ae4e,_0x4215c6))['catch'](handleError(_0x57ae4e,null));};exports['show']=function(_0x3f5081,_0x1b8985){var _0x4568d5={'raw':!![],'where':{'id':_0x3f5081['params']['id']}},_0x9c7421={};_0x9c7421[_0xeae6('0x28')]=_[_0xeae6('0x29')](db[_0xeae6('0x24')]['rawAttributes']);_0x9c7421['query']=_[_0xeae6('0x29')](_0x3f5081[_0xeae6('0x2a')]);_0x9c7421[_0xeae6('0x2b')]=_['intersection'](_0x9c7421[_0xeae6('0x28')],_0x9c7421[_0xeae6('0x2a')]);_0x4568d5[_0xeae6('0x2d')]=_['intersection'](_0x9c7421[_0xeae6('0x28')],qs[_0xeae6('0x2e')](_0x3f5081[_0xeae6('0x2a')][_0xeae6('0x2e')]));_0x4568d5['attributes']=_0x4568d5['attributes'][_0xeae6('0x2f')]?_0x4568d5[_0xeae6('0x2d')]:_0x9c7421[_0xeae6('0x28')];if(_0x3f5081[_0xeae6('0x2a')][_0xeae6('0x3a')]){_0x4568d5[_0xeae6('0x3b')]=[{'all':!![]}];}_0x4568d5=_[_0xeae6('0x3c')]({},_0x4568d5,_0x3f5081[_0xeae6('0x37')]);return db[_0xeae6('0x24')][_0xeae6('0x3d')](_0x4568d5)[_0xeae6('0x1b')](handleEntityNotFound(_0x1b8985,null))[_0xeae6('0x1b')](respondWithResult(_0x1b8985,null))[_0xeae6('0x3e')](handleError(_0x1b8985,null));};exports[_0xeae6('0x3f')]=function(_0x32ac97,_0x9f405a){var _0x5a72e8;return db['Network']['create'](_0x32ac97[_0xeae6('0x40')],{'raw':!![]})['then'](function(_0x4a9aa9){_0x5a72e8=_0x4a9aa9;return db[_0xeae6('0x24')][_0xeae6('0x38')]({'where':{'type':_0x32ac97[_0xeae6('0x40')][_0xeae6('0x41')]},'raw':!![]});})['then'](function(_0x6b2986){if(_0x5a72e8[_0xeae6('0x41')][_0xeae6('0x42')]()==_0xeae6('0x43')){var _0x4208f7=fs['readFileSync'](path[_0xeae6('0x44')](config[_0xeae6('0x45')],'server/files/templates/stun_multiple.ejs'),_0xeae6('0x46'));var _0x49fb93=ejs[_0xeae6('0x47')](_0x4208f7,{'networks':_0x6b2986||[]});fs[_0xeae6('0x48')](_0xeae6('0x49'),_0x49fb93);return respondWithRpcPromise(_0xeae6('0x4a'),'create',{'module':'res_stun_monitor.so'});}else if(_0x5a72e8[_0xeae6('0x41')][_0xeae6('0x42')]()==_0xeae6('0x4b')){var _0x12025b=fs[_0xeae6('0x4c')](path[_0xeae6('0x44')](config[_0xeae6('0x45')],'server/files/templates/turn_multiple.ejs'),_0xeae6('0x46'));var _0x8201d9=ejs['render'](_0x12025b,{'networks':_0x6b2986||[]});fs[_0xeae6('0x48')](_0xeae6('0x4d'),_0x8201d9);return respondWithRpcPromise('Reload',_0xeae6('0x3f'),{'module':_0xeae6('0x4e')});}else{var _0x5ef7b5=fs['readFileSync'](path[_0xeae6('0x44')](config['root'],_0xeae6('0x4f')),_0xeae6('0x46'));var _0x1020e4=ejs[_0xeae6('0x47')](_0x5ef7b5,{'networks':_0x6b2986||[]});fs[_0xeae6('0x48')](util[_0xeae6('0x50')](_0xeae6('0x51'),_0x32ac97[_0xeae6('0x40')][_0xeae6('0x41')][_0xeae6('0x52')]()),_0x1020e4);return respondWithRpcPromise(_0xeae6('0x4a'),_0xeae6('0x3f'),{'module':_0xeae6('0x53')});}})[_0xeae6('0x1b')](function(){return _0x5a72e8;})[_0xeae6('0x1b')](respondWithResult(_0x9f405a,0xc9))[_0xeae6('0x3e')](handleError(_0x9f405a,null));};exports['update']=function(_0x37abc2,_0x58e431){var _0x22d4fc;return db['Network'][_0xeae6('0x3d')]({'where':{'id':_0x37abc2[_0xeae6('0x54')]['id']}})[_0xeae6('0x1b')](handleEntityNotFound(_0x58e431,null))[_0xeae6('0x1b')](saveUpdates(_0x37abc2['body'],null))[_0xeae6('0x1b')](function(_0x14b18f){if(_0x14b18f){_0x22d4fc=_0x14b18f;return db[_0xeae6('0x24')][_0xeae6('0x38')]({'where':{'type':_0x22d4fc[_0xeae6('0x41')]},'raw':!![]});}return null;})[_0xeae6('0x1b')](function(_0x26ce31){if(_0x22d4fc['type'][_0xeae6('0x42')]()==_0xeae6('0x43')){var _0x3211a6=fs['readFileSync'](path[_0xeae6('0x44')](config[_0xeae6('0x45')],_0xeae6('0x55')),'utf8');var _0x488a61=ejs[_0xeae6('0x47')](_0x3211a6,{'networks':_0x26ce31||[]});fs[_0xeae6('0x48')](_0xeae6('0x49'),_0x488a61);return respondWithRpcPromise('Reload','update',{'module':_0xeae6('0x4e')});}else if(_0x22d4fc[_0xeae6('0x41')][_0xeae6('0x42')]()==_0xeae6('0x4b')){var _0x2c0c85=fs[_0xeae6('0x4c')](path[_0xeae6('0x44')](config[_0xeae6('0x45')],_0xeae6('0x56')),_0xeae6('0x46'));var _0x4c9ab5=ejs[_0xeae6('0x47')](_0x2c0c85,{'networks':_0x26ce31||[]});fs[_0xeae6('0x48')](_0xeae6('0x4d'),_0x4c9ab5);return respondWithRpcPromise('Reload','update',{'module':_0xeae6('0x4e')});}else{var _0x2913cd=fs[_0xeae6('0x4c')](path[_0xeae6('0x44')](config[_0xeae6('0x45')],_0xeae6('0x4f')),_0xeae6('0x46'));var _0x4232c5=ejs[_0xeae6('0x47')](_0x2913cd,{'networks':_0x26ce31||[]});fs['writeFileSync'](util[_0xeae6('0x50')](_0xeae6('0x51'),_0x37abc2[_0xeae6('0x40')][_0xeae6('0x41')][_0xeae6('0x52')]()),_0x4232c5);return respondWithRpcPromise(_0xeae6('0x4a'),_0xeae6('0x57'),{'module':_0xeae6('0x53')});}})[_0xeae6('0x1b')](function(_0x3056d4){if(_0x3056d4){return _0x22d4fc;}return null;})[_0xeae6('0x1b')](respondWithResult(_0x58e431,null))['catch'](handleError(_0x58e431,null));};exports[_0xeae6('0x1c')]=function(_0x3eb868,_0x19a415){var _0x1ef8fc;return db[_0xeae6('0x24')][_0xeae6('0x3d')]({'where':{'id':_0x3eb868['params']['id']}})[_0xeae6('0x1b')](function(_0x137d4d){_0x1ef8fc=_0x137d4d;return _0x137d4d;})[_0xeae6('0x1b')](handleEntityNotFound(_0x19a415,null))[_0xeae6('0x1b')](removeEntity(_0x19a415,null))[_0xeae6('0x1b')](function(){if(_0x1ef8fc){return db['Network'][_0xeae6('0x38')]({'where':{'type':_0x1ef8fc['type']},'raw':!![]});}})[_0xeae6('0x1b')](function(_0x3ba206){if(_0x1ef8fc[_0xeae6('0x41')][_0xeae6('0x42')]()==_0xeae6('0x43')){var _0x2873dd=fs[_0xeae6('0x4c')](path['join'](config['root'],_0xeae6('0x55')),_0xeae6('0x46'));var _0x5670b3=ejs['render'](_0x2873dd,{'networks':_0x3ba206||[]});fs[_0xeae6('0x48')](_0xeae6('0x49'),_0x5670b3);return respondWithRpcPromise(_0xeae6('0x4a'),_0xeae6('0x1c'),{'module':_0xeae6('0x4e')});}else if(_0x1ef8fc['type'][_0xeae6('0x42')]()==_0xeae6('0x4b')){var _0x2438b3=fs[_0xeae6('0x4c')](path[_0xeae6('0x44')](config['root'],_0xeae6('0x56')),_0xeae6('0x46'));var _0x57bfd6=ejs[_0xeae6('0x47')](_0x2438b3,{'networks':_0x3ba206||[]});fs[_0xeae6('0x48')]('/etc/asterisk/turn_xcally.conf',_0x57bfd6);return respondWithRpcPromise(_0xeae6('0x4a'),_0xeae6('0x1c'),{'module':_0xeae6('0x4e')});}else{var _0x4f2cd5=fs['readFileSync'](path[_0xeae6('0x44')](config['root'],_0xeae6('0x4f')),_0xeae6('0x46'));var _0x4cd920=ejs[_0xeae6('0x47')](_0x4f2cd5,{'networks':_0x3ba206||[]});fs[_0xeae6('0x48')](util['format'](_0xeae6('0x51'),_0x1ef8fc['type']['toLowerCase']()),_0x4cd920);return respondWithRpcPromise(_0xeae6('0x4a'),_0xeae6('0x1c'),{'module':'chan_sip.so'});}})[_0xeae6('0x3e')](handleError(_0x19a415,null));}; \ No newline at end of file +var _0x7f7d=['then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','Network','includeAll','findAll','show','params','keys','find','create','body','toUpperCase','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','destroy','STUN','util','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','undefined','limit','count','offset','set','update'];(function(_0x1801e1,_0x5bd410){var _0x18301d=function(_0x43a4be){while(--_0x43a4be){_0x1801e1['push'](_0x1801e1['shift']());}};_0x18301d(++_0x5bd410);}(_0x7f7d,0x8c));var _0xd7f7=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x7f7d[_0x3b96cf];return _0x2e315a;};'use strict';var util=require(_0xd7f7('0x0'));var path=require('path');var ejs=require(_0xd7f7('0x1'));var fs=require('fs');var _=require(_0xd7f7('0x2'));var qs=require(_0xd7f7('0x3'));var logger=require(_0xd7f7('0x4'))(_0xd7f7('0x5'));var config=require(_0xd7f7('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd7f7('0x7'));var client=jayson['client'][_0xd7f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c10ac,_0x39ab8a,_0x261c57,_0x378245){return new Promise(function(_0x38543c,_0x4ac9fd){var _0x123713=_0x378245||client;return _0x123713[_0xd7f7('0x9')](_0x3c10ac,_0x261c57)['then'](function(_0xfcbc56){logger[_0xd7f7('0xa')](_0xd7f7('0xb'),_0x39ab8a,_0xd7f7('0xc'));logger[_0xd7f7('0xd')](_0xd7f7('0xe'),_0x39ab8a,_0xd7f7('0xc'),JSON[_0xd7f7('0xf')](_0xfcbc56));if(_0xfcbc56[_0xd7f7('0x10')]){if(_0xfcbc56['error']['code']===0x1f4){logger[_0xd7f7('0x10')](_0xd7f7('0xb'),_0x39ab8a,_0xfcbc56[_0xd7f7('0x10')]['message']);return _0x4ac9fd(_0xfcbc56[_0xd7f7('0x10')][_0xd7f7('0x11')]);}logger['error']('Network,\x20%s,\x20%s',_0x39ab8a,_0xfcbc56[_0xd7f7('0x10')][_0xd7f7('0x11')]);return _0x38543c(_0xfcbc56[_0xd7f7('0x10')][_0xd7f7('0x11')]);}else{logger[_0xd7f7('0xa')](_0xd7f7('0xb'),_0x39ab8a,_0xd7f7('0xc'));_0x38543c(_0xfcbc56[_0xd7f7('0x12')]['message']);}})[_0xd7f7('0x13')](function(_0x43ed1d){logger[_0xd7f7('0x10')]('Network,\x20%s,\x20%s',_0x39ab8a,_0x43ed1d);_0x4ac9fd(_0x43ed1d);});});}function respondWithResult(_0x49a990,_0x167ae3){_0x167ae3=_0x167ae3||0xc8;return function(_0x556a0b){if(_0x556a0b){return _0x49a990[_0xd7f7('0x14')](_0x167ae3)[_0xd7f7('0x15')](_0x556a0b);}};}function respondWithFilteredResult(_0x374d9e,_0x1db076){return function(_0x3316b9){if(_0x3316b9){var _0x413d75=typeof _0x1db076['offset']===_0xd7f7('0x16')&&typeof _0x1db076[_0xd7f7('0x17')]===_0xd7f7('0x16');var _0x54575d=_0x3316b9[_0xd7f7('0x18')];var _0x40b040=_0x413d75?0x0:_0x1db076['offset'];var _0x4da7dc=_0x413d75?_0x3316b9[_0xd7f7('0x18')]:_0x1db076[_0xd7f7('0x19')]+_0x1db076[_0xd7f7('0x17')];var _0x4c0794;if(_0x4da7dc>=_0x54575d){_0x4da7dc=_0x54575d;_0x4c0794=0xc8;}else{_0x4c0794=0xce;}_0x374d9e['status'](_0x4c0794);return _0x374d9e[_0xd7f7('0x1a')]('Content-Range',_0x40b040+'-'+_0x4da7dc+'/'+_0x54575d)[_0xd7f7('0x15')](_0x3316b9);}return null;};}function saveUpdates(_0x132827){return function(_0x494d94){if(_0x494d94){return _0x494d94[_0xd7f7('0x1b')](_0x132827)[_0xd7f7('0x1c')](function(_0x2546c6){return _0x2546c6;});}return null;};}function removeEntity(_0x4801e1){return function(_0x1a744f){if(_0x1a744f){return _0x1a744f['destroy']()['then'](function(){_0x4801e1[_0xd7f7('0x14')](0xcc)[_0xd7f7('0x1d')]();});}};}function handleEntityNotFound(_0x550b97){return function(_0x3d2420){if(!_0x3d2420){_0x550b97[_0xd7f7('0x1e')](0x194);}return _0x3d2420;};}function handleError(_0x3eef76,_0x10b496){_0x10b496=_0x10b496||0x1f4;return function(_0x1df859){logger[_0xd7f7('0x10')](_0x1df859[_0xd7f7('0x1f')]);if(_0x1df859[_0xd7f7('0x20')]){delete _0x1df859[_0xd7f7('0x20')];}_0x3eef76[_0xd7f7('0x14')](_0x10b496)[_0xd7f7('0x21')](_0x1df859);};}exports[_0xd7f7('0x22')]=function(_0x2ccc0b,_0x1395dc){var _0x494c7d={},_0xf2440f={},_0x42211a={'count':0x0,'rows':[]};var _0x2f3378=_[_0xd7f7('0x23')](db['Network'][_0xd7f7('0x24')],function(_0x24d50f){return{'name':_0x24d50f[_0xd7f7('0x25')],'type':_0x24d50f[_0xd7f7('0x26')][_0xd7f7('0x27')]};});_0xf2440f['model']=_[_0xd7f7('0x23')](_0x2f3378,_0xd7f7('0x20'));_0xf2440f[_0xd7f7('0x28')]=_['keys'](_0x2ccc0b[_0xd7f7('0x28')]);_0xf2440f[_0xd7f7('0x29')]=_[_0xd7f7('0x2a')](_0xf2440f[_0xd7f7('0x2b')],_0xf2440f[_0xd7f7('0x28')]);_0x494c7d[_0xd7f7('0x2c')]=_[_0xd7f7('0x2a')](_0xf2440f[_0xd7f7('0x2b')],qs[_0xd7f7('0x2d')](_0x2ccc0b[_0xd7f7('0x28')]['fields']));_0x494c7d['attributes']=_0x494c7d[_0xd7f7('0x2c')][_0xd7f7('0x2e')]?_0x494c7d['attributes']:_0xf2440f[_0xd7f7('0x2b')];if(!_0x2ccc0b[_0xd7f7('0x28')][_0xd7f7('0x2f')]('nolimit')){_0x494c7d[_0xd7f7('0x17')]=qs[_0xd7f7('0x17')](_0x2ccc0b[_0xd7f7('0x28')][_0xd7f7('0x17')]);_0x494c7d[_0xd7f7('0x19')]=qs['offset'](_0x2ccc0b[_0xd7f7('0x28')][_0xd7f7('0x19')]);}_0x494c7d['order']=qs[_0xd7f7('0x30')](_0x2ccc0b[_0xd7f7('0x28')]['sort']);_0x494c7d[_0xd7f7('0x31')]=qs[_0xd7f7('0x29')](_['pick'](_0x2ccc0b[_0xd7f7('0x28')],_0xf2440f[_0xd7f7('0x29')]),_0x2f3378);if(_0x2ccc0b[_0xd7f7('0x28')][_0xd7f7('0x32')]){_0x494c7d[_0xd7f7('0x31')]=_['merge'](_0x494c7d[_0xd7f7('0x31')],{'$or':_['map'](_0x2f3378,function(_0x31c97c){if(_0x31c97c['type']!==_0xd7f7('0x33')){var _0x5b18a4={};_0x5b18a4[_0x31c97c[_0xd7f7('0x20')]]={'$like':'%'+_0x2ccc0b[_0xd7f7('0x28')][_0xd7f7('0x32')]+'%'};return _0x5b18a4;}})});}_0x494c7d=_[_0xd7f7('0x34')]({},_0x494c7d,_0x2ccc0b[_0xd7f7('0x35')]);var _0x531bd0={'where':_0x494c7d[_0xd7f7('0x31')]};return db[_0xd7f7('0x36')][_0xd7f7('0x18')](_0x531bd0)[_0xd7f7('0x1c')](function(_0xae4471){_0x42211a[_0xd7f7('0x18')]=_0xae4471;if(_0x2ccc0b[_0xd7f7('0x28')][_0xd7f7('0x37')]){_0x494c7d['include']=[{'all':!![]}];}return db[_0xd7f7('0x36')][_0xd7f7('0x38')](_0x494c7d);})[_0xd7f7('0x1c')](function(_0x56ef65){_0x42211a['rows']=_0x56ef65;return _0x42211a;})['then'](respondWithFilteredResult(_0x1395dc,_0x494c7d))[_0xd7f7('0x13')](handleError(_0x1395dc,null));};exports[_0xd7f7('0x39')]=function(_0x264886,_0x2ec0fb){var _0x7b918a={'raw':!![],'where':{'id':_0x264886[_0xd7f7('0x3a')]['id']}},_0x40dd10={};_0x40dd10[_0xd7f7('0x2b')]=_[_0xd7f7('0x3b')](db['Network'][_0xd7f7('0x24')]);_0x40dd10[_0xd7f7('0x28')]=_[_0xd7f7('0x3b')](_0x264886['query']);_0x40dd10['filters']=_['intersection'](_0x40dd10['model'],_0x40dd10[_0xd7f7('0x28')]);_0x7b918a[_0xd7f7('0x2c')]=_['intersection'](_0x40dd10[_0xd7f7('0x2b')],qs[_0xd7f7('0x2d')](_0x264886[_0xd7f7('0x28')]['fields']));_0x7b918a[_0xd7f7('0x2c')]=_0x7b918a[_0xd7f7('0x2c')][_0xd7f7('0x2e')]?_0x7b918a['attributes']:_0x40dd10[_0xd7f7('0x2b')];if(_0x264886['query'][_0xd7f7('0x37')]){_0x7b918a['include']=[{'all':!![]}];}_0x7b918a=_['merge']({},_0x7b918a,_0x264886[_0xd7f7('0x35')]);return db[_0xd7f7('0x36')][_0xd7f7('0x3c')](_0x7b918a)[_0xd7f7('0x1c')](handleEntityNotFound(_0x2ec0fb,null))[_0xd7f7('0x1c')](respondWithResult(_0x2ec0fb,null))[_0xd7f7('0x13')](handleError(_0x2ec0fb,null));};exports[_0xd7f7('0x3d')]=function(_0x20912a,_0x13fcc1){var _0x294f5b;return db['Network'][_0xd7f7('0x3d')](_0x20912a[_0xd7f7('0x3e')],{'raw':!![]})['then'](function(_0x155c29){_0x294f5b=_0x155c29;return db[_0xd7f7('0x36')][_0xd7f7('0x38')]({'where':{'type':_0x20912a[_0xd7f7('0x3e')][_0xd7f7('0x26')]},'raw':!![]});})[_0xd7f7('0x1c')](function(_0x35e290){if(_0x294f5b['type'][_0xd7f7('0x3f')]()=='STUN'){var _0x1da9ae=fs['readFileSync'](path['join'](config[_0xd7f7('0x40')],'server/files/templates/stun_multiple.ejs'),_0xd7f7('0x41'));var _0x5b42d5=ejs[_0xd7f7('0x42')](_0x1da9ae,{'networks':_0x35e290||[]});fs[_0xd7f7('0x43')](_0xd7f7('0x44'),_0x5b42d5);return respondWithRpcPromise(_0xd7f7('0x45'),_0xd7f7('0x3d'),{'module':_0xd7f7('0x46')});}else if(_0x294f5b[_0xd7f7('0x26')][_0xd7f7('0x3f')]()==_0xd7f7('0x47')){var _0x4c4cd7=fs[_0xd7f7('0x48')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x4dc71c=ejs[_0xd7f7('0x42')](_0x4c4cd7,{'networks':_0x35e290||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x4dc71c);return respondWithRpcPromise(_0xd7f7('0x45'),_0xd7f7('0x3d'),{'module':'res_stun_monitor.so'});}else{var _0x1499e4=fs['readFileSync'](path[_0xd7f7('0x49')](config[_0xd7f7('0x40')],_0xd7f7('0x4a')),_0xd7f7('0x41'));var _0x1ee3dd=ejs[_0xd7f7('0x42')](_0x1499e4,{'networks':_0x35e290||[]});fs['writeFileSync'](util[_0xd7f7('0x4b')](_0xd7f7('0x4c'),_0x20912a[_0xd7f7('0x3e')][_0xd7f7('0x26')][_0xd7f7('0x4d')]()),_0x1ee3dd);return respondWithRpcPromise(_0xd7f7('0x45'),_0xd7f7('0x3d'),{'module':_0xd7f7('0x4e')});}})[_0xd7f7('0x1c')](function(){return _0x294f5b;})[_0xd7f7('0x1c')](respondWithResult(_0x13fcc1,0xc9))[_0xd7f7('0x13')](handleError(_0x13fcc1,null));};exports[_0xd7f7('0x1b')]=function(_0x5d2724,_0x489598){var _0x523039;return db[_0xd7f7('0x36')][_0xd7f7('0x3c')]({'where':{'id':_0x5d2724['params']['id']}})[_0xd7f7('0x1c')](handleEntityNotFound(_0x489598,null))[_0xd7f7('0x1c')](saveUpdates(_0x5d2724[_0xd7f7('0x3e')],null))['then'](function(_0x30b6ca){if(_0x30b6ca){_0x523039=_0x30b6ca;return db[_0xd7f7('0x36')][_0xd7f7('0x38')]({'where':{'type':_0x523039[_0xd7f7('0x26')]},'raw':!![]});}return null;})[_0xd7f7('0x1c')](function(_0x238daa){if(_0x523039[_0xd7f7('0x26')][_0xd7f7('0x3f')]()=='STUN'){var _0x375fa8=fs[_0xd7f7('0x48')](path['join'](config[_0xd7f7('0x40')],_0xd7f7('0x4f')),'utf8');var _0x332ebe=ejs[_0xd7f7('0x42')](_0x375fa8,{'networks':_0x238daa||[]});fs['writeFileSync'](_0xd7f7('0x44'),_0x332ebe);return respondWithRpcPromise('Reload',_0xd7f7('0x1b'),{'module':_0xd7f7('0x46')});}else if(_0x523039[_0xd7f7('0x26')]['toUpperCase']()=='TURN'){var _0x4e68a6=fs[_0xd7f7('0x48')](path['join'](config[_0xd7f7('0x40')],_0xd7f7('0x50')),_0xd7f7('0x41'));var _0xb52f37=ejs[_0xd7f7('0x42')](_0x4e68a6,{'networks':_0x238daa||[]});fs[_0xd7f7('0x43')](_0xd7f7('0x51'),_0xb52f37);return respondWithRpcPromise(_0xd7f7('0x45'),_0xd7f7('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0x38b1c7=fs[_0xd7f7('0x48')](path[_0xd7f7('0x49')](config[_0xd7f7('0x40')],_0xd7f7('0x4a')),_0xd7f7('0x41'));var _0x1cc1fc=ejs[_0xd7f7('0x42')](_0x38b1c7,{'networks':_0x238daa||[]});fs[_0xd7f7('0x43')](util[_0xd7f7('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x5d2724[_0xd7f7('0x3e')][_0xd7f7('0x26')]['toLowerCase']()),_0x1cc1fc);return respondWithRpcPromise(_0xd7f7('0x45'),_0xd7f7('0x1b'),{'module':_0xd7f7('0x4e')});}})[_0xd7f7('0x1c')](function(_0x3425a4){if(_0x3425a4){return _0x523039;}return null;})[_0xd7f7('0x1c')](respondWithResult(_0x489598,null))[_0xd7f7('0x13')](handleError(_0x489598,null));};exports[_0xd7f7('0x52')]=function(_0x23226f,_0x43ada6){var _0x13a51b;return db[_0xd7f7('0x36')]['find']({'where':{'id':_0x23226f[_0xd7f7('0x3a')]['id']}})[_0xd7f7('0x1c')](function(_0x4973aa){_0x13a51b=_0x4973aa;return _0x4973aa;})[_0xd7f7('0x1c')](handleEntityNotFound(_0x43ada6,null))[_0xd7f7('0x1c')](removeEntity(_0x43ada6,null))['then'](function(){if(_0x13a51b){return db[_0xd7f7('0x36')][_0xd7f7('0x38')]({'where':{'type':_0x13a51b[_0xd7f7('0x26')]},'raw':!![]});}})['then'](function(_0x535eeb){if(_0x13a51b[_0xd7f7('0x26')][_0xd7f7('0x3f')]()==_0xd7f7('0x53')){var _0xa2c5f0=fs[_0xd7f7('0x48')](path['join'](config[_0xd7f7('0x40')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x1ca57b=ejs['render'](_0xa2c5f0,{'networks':_0x535eeb||[]});fs[_0xd7f7('0x43')](_0xd7f7('0x44'),_0x1ca57b);return respondWithRpcPromise(_0xd7f7('0x45'),_0xd7f7('0x52'),{'module':'res_stun_monitor.so'});}else if(_0x13a51b[_0xd7f7('0x26')][_0xd7f7('0x3f')]()==_0xd7f7('0x47')){var _0x44263e=fs[_0xd7f7('0x48')](path[_0xd7f7('0x49')](config[_0xd7f7('0x40')],_0xd7f7('0x50')),_0xd7f7('0x41'));var _0x3cd8ed=ejs['render'](_0x44263e,{'networks':_0x535eeb||[]});fs[_0xd7f7('0x43')]('/etc/asterisk/turn_xcally.conf',_0x3cd8ed);return respondWithRpcPromise(_0xd7f7('0x45'),_0xd7f7('0x52'),{'module':'res_stun_monitor.so'});}else{var _0x49faf0=fs[_0xd7f7('0x48')](path[_0xd7f7('0x49')](config[_0xd7f7('0x40')],_0xd7f7('0x4a')),_0xd7f7('0x41'));var _0x490354=ejs['render'](_0x49faf0,{'networks':_0x535eeb||[]});fs[_0xd7f7('0x43')](util['format'](_0xd7f7('0x4c'),_0x13a51b[_0xd7f7('0x26')][_0xd7f7('0x4d')]()),_0x490354);return respondWithRpcPromise(_0xd7f7('0x45'),_0xd7f7('0x52'),{'module':_0xd7f7('0x4e')});}})['catch'](handleError(_0x43ada6,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a119b88..3ead4ed 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 _0x3c81=['moment','../../config/environment','./network.attributes','exports','define','Network','lodash','util','api'];(function(_0x5dd052,_0xb2738e){var _0x273cd2=function(_0xe43251){while(--_0xe43251){_0x5dd052['push'](_0x5dd052['shift']());}};_0x273cd2(++_0xb2738e);}(_0x3c81,0x102));var _0x13c8=function(_0x57cef6,_0xa8ee4c){_0x57cef6=_0x57cef6-0x0;var _0x4675d8=_0x3c81[_0x57cef6];return _0x4675d8;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x13c8('0x4'));var attributes=require(_0x13c8('0x5'));module[_0x13c8('0x6')]=function(_0x1c16f1,_0x2a4d66){return _0x1c16f1[_0x13c8('0x7')](_0x13c8('0x8'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0427=['api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','../../config/logger'];(function(_0xc4a608,_0x45fecd){var _0x5e2730=function(_0x38c3c5){while(--_0x38c3c5){_0xc4a608['push'](_0xc4a608['shift']());}};_0x5e2730(++_0x45fecd);}(_0x0427,0x137));var _0x7042=function(_0x2ae5b4,_0x4e49a7){_0x2ae5b4=_0x2ae5b4-0x0;var _0x5e1249=_0x0427[_0x2ae5b4];return _0x5e1249;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7042('0x0'))(_0x7042('0x1'));var moment=require('moment');var BPromise=require(_0x7042('0x2'));var rp=require(_0x7042('0x3'));var fs=require('fs');var path=require(_0x7042('0x4'));var rimraf=require(_0x7042('0x5'));var config=require(_0x7042('0x6'));var attributes=require(_0x7042('0x7'));module[_0x7042('0x8')]=function(_0x53ab81,_0x37a35b){return _0x53ab81[_0x7042('0x9')](_0x7042('0xa'),attributes,{'tableName':_0x7042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 37a1d27..a67ab29 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0xe1a3bf,_0x293179){_0xe1a3bf=_0xe1a3bf-0x0;var _0x66f168=_0x7a54[_0xe1a3bf];return _0x66f168;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1d08e7,_0x15abfa){var _0x33b2ea=function(_0xb305c5){while(--_0xb305c5){_0x1d08e7['push'](_0x1d08e7['shift']());}};_0x33b2ea(++_0x15abfa);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index eb1a597..0a26285 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 _0xe5af=['exports','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','send','put','delete','/:id','removeAnswers'];(function(_0x1ce323,_0x28cb41){var _0x12b7d5=function(_0xed362a){while(--_0xed362a){_0x1ce323['push'](_0x1ce323['shift']());}};_0x12b7d5(++_0x28cb41);}(_0xe5af,0x9c));var _0xfe5a=function(_0x5a99e8,_0x5784cc){_0x5a99e8=_0x5a99e8-0x0;var _0x241ebf=_0xe5af[_0x5a99e8];return _0x241ebf;};'use strict';var multer=require('multer');var util=require(_0xfe5a('0x0'));var path=require(_0xfe5a('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe5a('0x2'));var router=express[_0xfe5a('0x3')]();var fs_extra=require(_0xfe5a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfe5a('0x5'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0xfe5a('0x6')]('/',auth[_0xfe5a('0x7')](),controller['index']);router['get'](_0xfe5a('0x8'),auth[_0xfe5a('0x7')](),controller[_0xfe5a('0x9')]);router[_0xfe5a('0x6')]('/:id',auth[_0xfe5a('0x7')](),controller['show']);router['get'](_0xfe5a('0xa'),auth[_0xfe5a('0x7')](),controller['getDispositions']);router[_0xfe5a('0x6')](_0xfe5a('0xb'),auth[_0xfe5a('0x7')](),controller[_0xfe5a('0xc')]);router[_0xfe5a('0x6')]('/:id/applications',auth[_0xfe5a('0x7')](),controller[_0xfe5a('0xd')]);router[_0xfe5a('0x6')](_0xfe5a('0xe'),auth[_0xfe5a('0x7')](),controller['getInteractions']);router[_0xfe5a('0x6')](_0xfe5a('0xf'),auth[_0xfe5a('0x7')](),controller[_0xfe5a('0x10')]);router[_0xfe5a('0x11')]('/',auth[_0xfe5a('0x7')](),controller[_0xfe5a('0x12')]);router[_0xfe5a('0x11')](_0xfe5a('0xa'),auth[_0xfe5a('0x7')](),controller[_0xfe5a('0x13')]);router[_0xfe5a('0x11')](_0xfe5a('0xb'),auth[_0xfe5a('0x7')](),controller[_0xfe5a('0x14')]);router[_0xfe5a('0x11')]('/:id/notify',controller[_0xfe5a('0x15')]);router[_0xfe5a('0x11')]('/:id/applications',auth[_0xfe5a('0x7')](),controller[_0xfe5a('0x16')]);router[_0xfe5a('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0xfe5a('0x17')]);router[_0xfe5a('0x11')](_0xfe5a('0x18'),auth[_0xfe5a('0x7')](),controller[_0xfe5a('0x19')]);router[_0xfe5a('0x1a')]('/:id',auth[_0xfe5a('0x7')](),controller['update']);router[_0xfe5a('0x1b')](_0xfe5a('0x1c'),auth[_0xfe5a('0x7')](),controller['destroy']);router['delete'](_0xfe5a('0xa'),auth[_0xfe5a('0x7')](),controller['removeDispositions']);router[_0xfe5a('0x1b')](_0xfe5a('0xb'),auth['isAuthenticated'](),controller[_0xfe5a('0x1d')]);router[_0xfe5a('0x1b')](_0xfe5a('0xf'),auth[_0xfe5a('0x7')](),controller['removeAgents']);module[_0xfe5a('0x1e')]=router; \ No newline at end of file +var _0xb03e=['addApplications','/:id/users','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','addAnswer','/:id/notify','notify'];(function(_0xf65ecb,_0x331801){var _0x213052=function(_0x3ddf70){while(--_0x3ddf70){_0xf65ecb['push'](_0xf65ecb['shift']());}};_0x213052(++_0x331801);}(_0xb03e,0x1eb));var _0xeb03=function(_0x37d675,_0x2b1f4a){_0x37d675=_0x37d675-0x0;var _0x3b6d58=_0xb03e[_0x37d675];return _0x3b6d58;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0xa')](_0xeb03('0x14'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0xa')](_0xeb03('0x16'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x17')]);router[_0xeb03('0xa')]('/:id/users',auth[_0xeb03('0xb')](),controller[_0xeb03('0x18')]);router[_0xeb03('0x19')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0x19')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller['addDisposition']);router[_0xeb03('0x19')](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x1a')]);router[_0xeb03('0x19')](_0xeb03('0x1b'),controller[_0xeb03('0x1c')]);router[_0xeb03('0x19')](_0xeb03('0x14'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x1d')]);router[_0xeb03('0x19')](_0xeb03('0x1e'),auth[_0xeb03('0xb')](),controller['addAgents']);router[_0xeb03('0x19')](_0xeb03('0x1f'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x20')]);router[_0xeb03('0x21')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x22')]);router[_0xeb03('0x23')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x24')]);router[_0xeb03('0x23')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller['removeDispositions']);router[_0xeb03('0x23')](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x25')]);router[_0xeb03('0x23')](_0xeb03('0x1e'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x26')]);module[_0xeb03('0x27')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index b75d5b8..05116af 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 _0xdf91=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','STRING','generate','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'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdf91,0xe1));var _0x1df9=function(_0x572518,_0x1df00e){_0x572518=_0x572518-0x0;var _0x4d06bc=_0xdf91[_0x572518];return _0x4d06bc;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x1df9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1df9('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x1df9('0x2')]},'token':{'type':Sequelize[_0x1df9('0x2')],'defaultValue':function(){return rs[_0x1df9('0x3')]();}},'replyUri':{'type':Sequelize[_0x1df9('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1df9('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1df9('0x4')],'defaultValue':function(){return _0x1df9('0x5');}},'notificationSound':{'type':Sequelize[_0x1df9('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1df9('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1df9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x1df9('0x2')]},'queueTransfer':{'type':Sequelize[_0x1df9('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1df9('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1df9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1df9('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x1df9('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x1df9('0x6')],'defaultValue':![],'comment':_0x1df9('0x9'),'set':function(_0x17386e){if(!_0x17386e)this[_0x1df9('0xa')](_0x1df9('0xb'),null);this['setDataValue'](_0x1df9('0xc'),_0x17386e);}}}; \ No newline at end of file +var _0x8909=['setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3a441a,_0x43eb56){var _0x3128a2=function(_0x5d5a17){while(--_0x5d5a17){_0x3a441a['push'](_0x3a441a['shift']());}};_0x3128a2(++_0x43eb56);}(_0x8909,0xd3));var _0x9890=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0x8909[_0x2b152a];return _0x2ad4c7;};'use strict';var Sequelize=require(_0x9890('0x0'));var rs=require('randomstring');module[_0x9890('0x1')]={'name':{'type':Sequelize[_0x9890('0x2')],'unique':_0x9890('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9890('0x2')]},'token':{'type':Sequelize[_0x9890('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x9890('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9890('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9890('0x4');}},'notificationSound':{'type':Sequelize[_0x9890('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9890('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9890('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9890('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x9890('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9890('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9890('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9890('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9890('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x9890('0x5')],'defaultValue':![],'comment':_0x9890('0x8'),'set':function(_0x4fe257){if(!_0x4fe257)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x9890('0x9')](_0x9890('0xa'),_0x4fe257);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index af8446d..43c92f0 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 _0xe548=['getInteractions','Contact','fullname','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','defaults','redis','localhost','./openchannelAccount.socket','client','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','include','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','includes','mapKey','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','queue','Start','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications'];(function(_0x47fe45,_0x3f7272){var _0x354d31=function(_0x326893){while(--_0x326893){_0x47fe45['push'](_0x47fe45['shift']());}};_0x354d31(++_0x3f7272);}(_0xe548,0x184));var _0x8e54=function(_0x26299e,_0x394ad1){_0x26299e=_0x26299e-0x0;var _0x6c4f4a=_0xe548[_0x26299e];return _0x6c4f4a;};'use strict';var emlformat=require(_0x8e54('0x0'));var rimraf=require(_0x8e54('0x1'));var zipdir=require(_0x8e54('0x2'));var jsonpatch=require(_0x8e54('0x3'));var rp=require(_0x8e54('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8e54('0x5'));var csv=require('to-csv');var ejs=require(_0x8e54('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e54('0x7'));var squel=require(_0x8e54('0x8'));var crypto=require(_0x8e54('0x9'));var jsforce=require(_0x8e54('0xa'));var deskjs=require(_0x8e54('0xb'));var toCsv=require(_0x8e54('0xc'));var querystring=require(_0x8e54('0xd'));var Papa=require('papaparse');var Redis=require(_0x8e54('0xe'));var authService=require(_0x8e54('0xf'));var qs=require(_0x8e54('0x10'));var as=require(_0x8e54('0x11'));var hardwareService=require(_0x8e54('0x12'));var logger=require('../../config/logger')(_0x8e54('0x13'));var utils=require(_0x8e54('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8e54('0x15')](config[_0x8e54('0x16')],{'host':_0x8e54('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e54('0x16')]));require(_0x8e54('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8e54('0x19')]['http']({'port':0x232c});var client9002=jayson[_0x8e54('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c453f,_0x2c75d8,_0x861ebe,_0x5760a5){return new BPromise(function(_0x45896b,_0x400aa7){var _0x20caac=_0x5760a5||client;return _0x20caac['request'](_0x5c453f,_0x861ebe)[_0x8e54('0x1a')](function(_0xed22ea){logger['info'](_0x8e54('0x1b'),_0x2c75d8,_0x8e54('0x1c'));logger[_0x8e54('0x1d')](_0x8e54('0x1e'),_0x2c75d8,_0x8e54('0x1c'),JSON['stringify'](_0xed22ea));if(_0xed22ea[_0x8e54('0x1f')]){if(_0xed22ea[_0x8e54('0x1f')][_0x8e54('0x20')]===0x1f4){logger['error'](_0x8e54('0x1b'),_0x2c75d8,_0xed22ea[_0x8e54('0x1f')][_0x8e54('0x21')]);return _0x400aa7(_0xed22ea['error']['message']);}logger['error'](_0x8e54('0x1b'),_0x2c75d8,_0xed22ea[_0x8e54('0x1f')]['message']);return _0x45896b(_0xed22ea[_0x8e54('0x1f')][_0x8e54('0x21')]);}else{logger[_0x8e54('0x22')](_0x8e54('0x1b'),_0x2c75d8,'request\x20sent');_0x45896b(_0xed22ea[_0x8e54('0x23')][_0x8e54('0x21')]);}})[_0x8e54('0x24')](function(_0xfeed5f){logger[_0x8e54('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x2c75d8,_0xfeed5f);_0x400aa7(_0xfeed5f);});});}function respondWithStatusCode(_0x210dac,_0x3307a5){_0x3307a5=_0x3307a5||0xcc;return function(_0x591fe4){if(_0x591fe4){return _0x210dac[_0x8e54('0x25')](_0x3307a5);}return _0x210dac[_0x8e54('0x26')](_0x3307a5)[_0x8e54('0x27')]();};}function respondWithResult(_0x38cea9,_0x5f1f7b){_0x5f1f7b=_0x5f1f7b||0xc8;return function(_0x3a36a3){if(_0x3a36a3){return _0x38cea9[_0x8e54('0x26')](_0x5f1f7b)[_0x8e54('0x28')](_0x3a36a3);}};}function respondWithFilteredResult(_0x1e5975,_0x43eccc){return function(_0x1996d0){if(_0x1996d0){var _0x44d18d=typeof _0x43eccc['offset']==='undefined'&&typeof _0x43eccc['limit']==='undefined';var _0x311818=_0x1996d0[_0x8e54('0x29')];var _0x26e1bd=_0x44d18d?0x0:_0x43eccc['offset'];var _0x15e176=_0x44d18d?_0x1996d0[_0x8e54('0x29')]:_0x43eccc[_0x8e54('0x2a')]+_0x43eccc[_0x8e54('0x2b')];var _0x5bc501;if(_0x15e176>=_0x311818){_0x15e176=_0x311818;_0x5bc501=0xc8;}else{_0x5bc501=0xce;}_0x1e5975[_0x8e54('0x26')](_0x5bc501);return _0x1e5975[_0x8e54('0x2c')](_0x8e54('0x2d'),_0x26e1bd+'-'+_0x15e176+'/'+_0x311818)[_0x8e54('0x28')](_0x1996d0);}return null;};}function patchUpdates(_0x378bba){return function(_0x52b7be){try{jsonpatch[_0x8e54('0x2e')](_0x52b7be,_0x378bba,!![]);}catch(_0x28f459){return BPromise[_0x8e54('0x2f')](_0x28f459);}return _0x52b7be['save']();};}function saveUpdates(_0x4079d5,_0xdb85dc){return function(_0x3fee9a){if(_0x3fee9a){return _0x3fee9a[_0x8e54('0x30')](_0x4079d5)[_0x8e54('0x1a')](function(_0x546de7){return _0x546de7;});}return null;};}function removeEntity(_0x4d630d,_0x380016){return function(_0x110ef9){if(_0x110ef9){return _0x110ef9[_0x8e54('0x31')]()[_0x8e54('0x1a')](function(){var _0x431ef2=_0x110ef9[_0x8e54('0x32')]({'plain':!![]});var _0xe922ef=_0x8e54('0x33');return db[_0x8e54('0x34')][_0x8e54('0x31')]({'where':{'type':_0xe922ef,'resourceId':_0x431ef2['id']}})[_0x8e54('0x1a')](function(){return _0x110ef9;});})[_0x8e54('0x1a')](function(){_0x4d630d[_0x8e54('0x26')](0xcc)[_0x8e54('0x27')]();});}};}function handleEntityNotFound(_0x171a35,_0xea7c52){return function(_0x1ee01f){if(!_0x1ee01f){_0x171a35[_0x8e54('0x25')](0x194);}return _0x1ee01f;};}function handleError(_0xce2804,_0x16fc64){_0x16fc64=_0x16fc64||0x1f4;return function(_0x5adf56){logger['error'](_0x5adf56['stack']);if(_0x5adf56[_0x8e54('0x35')]){delete _0x5adf56[_0x8e54('0x35')];}_0xce2804[_0x8e54('0x26')](_0x16fc64)[_0x8e54('0x36')](_0x5adf56);};}exports[_0x8e54('0x37')]=function(_0x105a63,_0x1c063a){var _0x3ed1aa={'include':[{'model':db[_0x8e54('0x38')],'as':_0x8e54('0x39')}]},_0x3a1503={},_0xfbda37={'count':0x0,'rows':[]};var _0x1d805b=_[_0x8e54('0x3a')](db[_0x8e54('0x3b')][_0x8e54('0x3c')],function(_0x321f75){return{'name':_0x321f75[_0x8e54('0x3d')],'type':_0x321f75[_0x8e54('0x3e')][_0x8e54('0x3f')]};});_0x3a1503[_0x8e54('0x40')]=_[_0x8e54('0x3a')](_0x1d805b,'name');_0x3a1503[_0x8e54('0x41')]=_[_0x8e54('0x42')](_0x105a63[_0x8e54('0x41')]);_0x3a1503[_0x8e54('0x43')]=_['intersection'](_0x3a1503[_0x8e54('0x40')],_0x3a1503[_0x8e54('0x41')]);_0x3ed1aa[_0x8e54('0x44')]=_['intersection'](_0x3a1503[_0x8e54('0x40')],qs[_0x8e54('0x45')](_0x105a63['query']['fields']));_0x3ed1aa['attributes']=_0x3ed1aa[_0x8e54('0x44')][_0x8e54('0x46')]?_0x3ed1aa[_0x8e54('0x44')]:_0x3a1503[_0x8e54('0x40')];if(!_0x105a63[_0x8e54('0x41')][_0x8e54('0x47')](_0x8e54('0x48'))){_0x3ed1aa[_0x8e54('0x2b')]=qs[_0x8e54('0x2b')](_0x105a63[_0x8e54('0x41')][_0x8e54('0x2b')]);_0x3ed1aa[_0x8e54('0x2a')]=qs[_0x8e54('0x2a')](_0x105a63[_0x8e54('0x41')]['offset']);}_0x3ed1aa[_0x8e54('0x49')]=qs['sort'](_0x105a63[_0x8e54('0x41')][_0x8e54('0x4a')]);_0x3ed1aa[_0x8e54('0x4b')]=qs[_0x8e54('0x43')](_[_0x8e54('0x4c')](_0x105a63['query'],_0x3a1503[_0x8e54('0x43')]),_0x1d805b);if(_0x105a63[_0x8e54('0x41')][_0x8e54('0x4d')]){_0x3ed1aa[_0x8e54('0x4b')]=_[_0x8e54('0x4e')](_0x3ed1aa[_0x8e54('0x4b')],{'$or':_['map'](_0x1d805b,function(_0x3b3bd3){if(_0x3b3bd3[_0x8e54('0x3e')]!==_0x8e54('0x4f')){var _0x2ec413={};_0x2ec413[_0x3b3bd3[_0x8e54('0x35')]]={'$like':'%'+_0x105a63[_0x8e54('0x41')][_0x8e54('0x4d')]+'%'};return _0x2ec413;}})});}_0x3ed1aa=_[_0x8e54('0x4e')]({},_0x3ed1aa,_0x105a63[_0x8e54('0x50')]);var _0x333f31={'where':_0x3ed1aa[_0x8e54('0x4b')]};return db[_0x8e54('0x3b')][_0x8e54('0x29')](_0x333f31)[_0x8e54('0x1a')](function(_0x11fb0b){_0xfbda37['count']=_0x11fb0b;if(_0x105a63[_0x8e54('0x41')][_0x8e54('0x51')]){_0x3ed1aa['include']=[{'all':!![]}];}return db[_0x8e54('0x3b')][_0x8e54('0x52')](_0x3ed1aa);})[_0x8e54('0x1a')](function(_0x3aa49b){_0xfbda37[_0x8e54('0x53')]=_0x3aa49b;return _0xfbda37;})[_0x8e54('0x1a')](respondWithFilteredResult(_0x1c063a,_0x3ed1aa))[_0x8e54('0x24')](handleError(_0x1c063a,null));};exports['show']=function(_0x3505f2,_0x54f303){var _0x483c2a={'raw':![],'where':{'id':_0x3505f2[_0x8e54('0x54')]['id']},'include':[{'model':db[_0x8e54('0x38')],'as':_0x8e54('0x39')}]},_0x1b4455={};_0x1b4455['model']=_['keys'](db[_0x8e54('0x3b')][_0x8e54('0x3c')]);_0x1b4455['query']=_[_0x8e54('0x42')](_0x3505f2[_0x8e54('0x41')]);_0x1b4455[_0x8e54('0x43')]=_['intersection'](_0x1b4455[_0x8e54('0x40')],_0x1b4455['query']);_0x483c2a[_0x8e54('0x44')]=_[_0x8e54('0x55')](_0x1b4455['model'],qs[_0x8e54('0x45')](_0x3505f2[_0x8e54('0x41')][_0x8e54('0x45')]));_0x483c2a[_0x8e54('0x44')]=_0x483c2a[_0x8e54('0x44')][_0x8e54('0x46')]?_0x483c2a[_0x8e54('0x44')]:_0x1b4455[_0x8e54('0x40')];if(_0x3505f2['query'][_0x8e54('0x51')]){_0x483c2a['include']=[{'all':!![]}];}_0x483c2a=_[_0x8e54('0x4e')]({},_0x483c2a,_0x3505f2[_0x8e54('0x50')]);return db[_0x8e54('0x3b')][_0x8e54('0x56')](_0x483c2a)['then'](handleEntityNotFound(_0x54f303,null))[_0x8e54('0x1a')](respondWithResult(_0x54f303,null))[_0x8e54('0x24')](handleError(_0x54f303,null));};exports[_0x8e54('0x57')]=function(_0xddd230,_0x2a98f0){return db[_0x8e54('0x3b')]['create'](_0xddd230[_0x8e54('0x58')],{})[_0x8e54('0x1a')](function(_0x56b0fa){var _0x39ff4a=_0xddd230['user'][_0x8e54('0x32')]({'plain':!![]});if(!_0x39ff4a)throw new Error(_0x8e54('0x59'));if(_0x39ff4a['role']===_0x8e54('0x5a')){var _0x2ea972=_0x56b0fa[_0x8e54('0x32')]({'plain':!![]});var _0x38a5d6=_0x8e54('0x33');return db[_0x8e54('0x5b')][_0x8e54('0x56')]({'where':{'name':_0x38a5d6,'userProfileId':_0x39ff4a['userProfileId']},'raw':!![]})[_0x8e54('0x1a')](function(_0x3875a7){if(_0x3875a7&&_0x3875a7[_0x8e54('0x5c')]===0x0){return db[_0x8e54('0x34')]['create']({'name':_0x2ea972[_0x8e54('0x35')],'resourceId':_0x2ea972['id'],'type':_0x3875a7[_0x8e54('0x35')],'sectionId':_0x3875a7['id']},{})[_0x8e54('0x1a')](function(){return _0x56b0fa;});}else{return _0x56b0fa;}})[_0x8e54('0x24')](function(_0x4cf3b7){logger[_0x8e54('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cf3b7);throw _0x4cf3b7;});}return _0x56b0fa;})[_0x8e54('0x1a')](respondWithResult(_0x2a98f0,0xc9))['catch'](handleError(_0x2a98f0,null));};exports[_0x8e54('0x30')]=function(_0x3b6d13,_0x2983ff){if(_0x3b6d13['body']['id']){delete _0x3b6d13[_0x8e54('0x58')]['id'];}return db[_0x8e54('0x3b')]['find']({'where':{'id':_0x3b6d13[_0x8e54('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x8e54('0x39')}]})[_0x8e54('0x1a')](handleEntityNotFound(_0x2983ff,null))[_0x8e54('0x1a')](saveUpdates(_0x3b6d13[_0x8e54('0x58')],null))[_0x8e54('0x1a')](respondWithResult(_0x2983ff,null))[_0x8e54('0x24')](handleError(_0x2983ff,null));};exports[_0x8e54('0x31')]=function(_0x504022,_0x4257f9){return db[_0x8e54('0x3b')][_0x8e54('0x56')]({'where':{'id':_0x504022[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x4257f9,null))[_0x8e54('0x1a')](removeEntity(_0x4257f9,null))[_0x8e54('0x24')](handleError(_0x4257f9,null));};exports[_0x8e54('0x5d')]=function(_0x41e9ba,_0x2e1898){return db[_0x8e54('0x3b')][_0x8e54('0x5d')]()['then'](respondWithResult(_0x2e1898,null))[_0x8e54('0x24')](handleError(_0x2e1898,null));};exports[_0x8e54('0x5e')]=function(_0x2cd2c2,_0x370d27,_0x3689e6){if(_0x2cd2c2['body']['id']){delete _0x2cd2c2[_0x8e54('0x58')]['id'];}return db[_0x8e54('0x3b')]['find']({'where':{'id':_0x2cd2c2[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x370d27,null))[_0x8e54('0x1a')](function(_0x262c7e){if(_0x262c7e){_0x2cd2c2[_0x8e54('0x58')][_0x8e54('0x5f')]=_0x262c7e['id'];return db[_0x8e54('0x60')]['create'](_0x2cd2c2[_0x8e54('0x58')]);}})[_0x8e54('0x1a')](respondWithResult(_0x370d27,null))[_0x8e54('0x24')](handleError(_0x370d27,null));};exports[_0x8e54('0x61')]=function(_0x58e8a0,_0x378a04,_0x3d57a8){var _0x23671f={'raw':![],'where':{}};var _0x10388b={};var _0x1ed055={'count':0x0,'rows':[]};return db[_0x8e54('0x3b')][_0x8e54('0x62')]({'where':{'id':_0x58e8a0[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x378a04,null))[_0x8e54('0x1a')](function(_0x375318){if(_0x375318){_0x10388b[_0x8e54('0x40')]=_[_0x8e54('0x42')](db[_0x8e54('0x60')][_0x8e54('0x3c')]);_0x10388b[_0x8e54('0x41')]=_[_0x8e54('0x42')](_0x58e8a0[_0x8e54('0x41')]);_0x10388b[_0x8e54('0x43')]=_['intersection'](_0x10388b[_0x8e54('0x40')],_0x10388b[_0x8e54('0x41')]);_0x23671f[_0x8e54('0x44')]=_[_0x8e54('0x55')](_0x10388b[_0x8e54('0x40')],qs[_0x8e54('0x45')](_0x58e8a0[_0x8e54('0x41')]['fields']));_0x23671f[_0x8e54('0x44')]=_0x23671f[_0x8e54('0x44')]['length']?_0x23671f[_0x8e54('0x44')]:_0x10388b[_0x8e54('0x40')];if(!_0x58e8a0[_0x8e54('0x41')]['hasOwnProperty'](_0x8e54('0x48'))){_0x23671f['limit']=qs[_0x8e54('0x2b')](_0x58e8a0['query']['limit']);_0x23671f[_0x8e54('0x2a')]=qs[_0x8e54('0x2a')](_0x58e8a0[_0x8e54('0x41')][_0x8e54('0x2a')]);}_0x23671f[_0x8e54('0x49')]=qs[_0x8e54('0x4a')](_0x58e8a0[_0x8e54('0x41')][_0x8e54('0x4a')]);_0x23671f[_0x8e54('0x4b')]=qs[_0x8e54('0x43')](_[_0x8e54('0x4c')](_0x58e8a0[_0x8e54('0x41')],_0x10388b[_0x8e54('0x43')]));_0x23671f[_0x8e54('0x4b')][_0x8e54('0x5f')]=_0x375318['id'];if(_0x58e8a0['query']['filter']){_0x23671f[_0x8e54('0x4b')]=_[_0x8e54('0x4e')](_0x23671f[_0x8e54('0x4b')],{'$or':_[_0x8e54('0x3a')](_0x23671f['attributes'],function(_0x5807d1){var _0x32720c={};_0x32720c[_0x5807d1]={'$like':'%'+_0x58e8a0[_0x8e54('0x41')][_0x8e54('0x4d')]+'%'};return _0x32720c;})});}_0x23671f=_[_0x8e54('0x4e')]({},_0x23671f,_0x58e8a0['options']);return db[_0x8e54('0x60')][_0x8e54('0x29')]({'where':_0x23671f[_0x8e54('0x4b')]})[_0x8e54('0x1a')](function(_0xf97f3c){_0x1ed055[_0x8e54('0x29')]=_0xf97f3c;if(_0x58e8a0[_0x8e54('0x41')][_0x8e54('0x51')]){_0x23671f['include']=[{'all':!![]}];}return db[_0x8e54('0x60')]['findAll'](_0x23671f);})[_0x8e54('0x1a')](function(_0x40e7a1){_0x1ed055[_0x8e54('0x53')]=_0x40e7a1;return _0x1ed055;});}})[_0x8e54('0x1a')](respondWithFilteredResult(_0x378a04,_0x23671f))['catch'](handleError(_0x378a04,null));};exports[_0x8e54('0x63')]=function(_0x14048e,_0x568dea,_0x290b5d){return db[_0x8e54('0x3b')][_0x8e54('0x56')]({'where':{'id':_0x14048e[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x568dea,null))[_0x8e54('0x1a')](function(_0xe28e8){if(_0xe28e8){return _0xe28e8[_0x8e54('0x63')](_0x14048e[_0x8e54('0x41')][_0x8e54('0x64')]);}})[_0x8e54('0x1a')](respondWithStatusCode(_0x568dea,null))[_0x8e54('0x24')](handleError(_0x568dea,null));};exports['addAnswer']=function(_0x5d1517,_0x4d14b8,_0x399a66){if(_0x5d1517[_0x8e54('0x58')]['id']){delete _0x5d1517[_0x8e54('0x58')]['id'];}return db[_0x8e54('0x3b')][_0x8e54('0x56')]({'where':{'id':_0x5d1517[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x4d14b8,null))[_0x8e54('0x1a')](function(_0x241d37){if(_0x241d37){_0x5d1517['body'][_0x8e54('0x5f')]=_0x241d37['id'];return db[_0x8e54('0x65')]['create'](_0x5d1517[_0x8e54('0x58')]);}})[_0x8e54('0x1a')](respondWithResult(_0x4d14b8,null))['catch'](handleError(_0x4d14b8,null));};exports['getAnswers']=function(_0x2e6fa0,_0x376edb,_0x2c7414){var _0x264cfb={'raw':![],'where':{}};var _0x2eecd5={};var _0x4b576d={'count':0x0,'rows':[]};return db[_0x8e54('0x3b')][_0x8e54('0x62')]({'where':{'id':_0x2e6fa0[_0x8e54('0x54')]['id']}})['then'](handleEntityNotFound(_0x376edb,null))[_0x8e54('0x1a')](function(_0x466d0d){if(_0x466d0d){_0x2eecd5[_0x8e54('0x40')]=_['keys'](db[_0x8e54('0x65')][_0x8e54('0x3c')]);_0x2eecd5[_0x8e54('0x41')]=_['keys'](_0x2e6fa0[_0x8e54('0x41')]);_0x2eecd5[_0x8e54('0x43')]=_['intersection'](_0x2eecd5[_0x8e54('0x40')],_0x2eecd5[_0x8e54('0x41')]);_0x264cfb[_0x8e54('0x44')]=_[_0x8e54('0x55')](_0x2eecd5[_0x8e54('0x40')],qs[_0x8e54('0x45')](_0x2e6fa0[_0x8e54('0x41')][_0x8e54('0x45')]));_0x264cfb[_0x8e54('0x44')]=_0x264cfb[_0x8e54('0x44')]['length']?_0x264cfb[_0x8e54('0x44')]:_0x2eecd5['model'];if(!_0x2e6fa0[_0x8e54('0x41')][_0x8e54('0x47')](_0x8e54('0x48'))){_0x264cfb[_0x8e54('0x2b')]=qs[_0x8e54('0x2b')](_0x2e6fa0[_0x8e54('0x41')][_0x8e54('0x2b')]);_0x264cfb[_0x8e54('0x2a')]=qs[_0x8e54('0x2a')](_0x2e6fa0['query'][_0x8e54('0x2a')]);}_0x264cfb[_0x8e54('0x49')]=qs[_0x8e54('0x4a')](_0x2e6fa0[_0x8e54('0x41')][_0x8e54('0x4a')]);_0x264cfb[_0x8e54('0x4b')]=qs[_0x8e54('0x43')](_[_0x8e54('0x4c')](_0x2e6fa0[_0x8e54('0x41')],_0x2eecd5[_0x8e54('0x43')]));_0x264cfb['where'][_0x8e54('0x5f')]=_0x466d0d['id'];if(_0x2e6fa0[_0x8e54('0x41')][_0x8e54('0x4d')]){_0x264cfb[_0x8e54('0x4b')]=_[_0x8e54('0x4e')](_0x264cfb[_0x8e54('0x4b')],{'$or':_[_0x8e54('0x3a')](_0x264cfb['attributes'],function(_0x228d69){var _0x57e733={};_0x57e733[_0x228d69]={'$like':'%'+_0x2e6fa0[_0x8e54('0x41')][_0x8e54('0x4d')]+'%'};return _0x57e733;})});}_0x264cfb=_[_0x8e54('0x4e')]({},_0x264cfb,_0x2e6fa0[_0x8e54('0x50')]);return db[_0x8e54('0x65')][_0x8e54('0x29')]({'where':_0x264cfb[_0x8e54('0x4b')]})[_0x8e54('0x1a')](function(_0x1359e3){_0x4b576d[_0x8e54('0x29')]=_0x1359e3;if(_0x2e6fa0[_0x8e54('0x41')][_0x8e54('0x51')]){_0x264cfb[_0x8e54('0x66')]=[{'all':!![]}];}return db[_0x8e54('0x65')][_0x8e54('0x52')](_0x264cfb);})[_0x8e54('0x1a')](function(_0x31a350){_0x4b576d['rows']=_0x31a350;return _0x4b576d;});}})['then'](respondWithFilteredResult(_0x376edb,_0x264cfb))['catch'](handleError(_0x376edb,null));};exports['removeAnswers']=function(_0x21b78b,_0x2ecb9f,_0x3fab04){return db['OpenchannelAccount'][_0x8e54('0x56')]({'where':{'id':_0x21b78b[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x2ecb9f,null))[_0x8e54('0x1a')](function(_0x537091){if(_0x537091){return _0x537091[_0x8e54('0x67')](_0x21b78b['query'][_0x8e54('0x64')]);}})[_0x8e54('0x1a')](respondWithStatusCode(_0x2ecb9f,null))['catch'](handleError(_0x2ecb9f,null));};exports[_0x8e54('0x68')]=function(_0x1dcd12,_0x16c206,_0x391004){var _0x3fba0d={'body':_0x1dcd12[_0x8e54('0x58')],'channel':_0x8e54('0x69')};var _0x45aaed=[];var _0xfa87eb=[];var _0x519e7f={};var _0x5863ae=![];return db[_0x8e54('0x6a')][_0x8e54('0x5d')]()[_0x8e54('0x1a')](function(_0x349c7c){if(!_0x349c7c){throw new db[(_0x8e54('0x6b'))][(_0x8e54('0x6c'))](_0x8e54('0x6d'));}_0x45aaed=_[_0x8e54('0x6e')](_[_0x8e54('0x42')](_0x349c7c),[_0x8e54('0x6f'),_0x8e54('0x70')]);_0xfa87eb=_[_0x8e54('0x6e')](_[_0x8e54('0x42')](_0x349c7c),[_0x8e54('0x6f'),_0x8e54('0x70'),'CompanyId',_0x8e54('0x71')]);if(_0x1dcd12[_0x8e54('0x58')]['id']){delete _0x1dcd12[_0x8e54('0x58')]['id'];}if(_['isNil'](_0x1dcd12[_0x8e54('0x58')][_0x8e54('0x72')])){throw new db[(_0x8e54('0x6b'))]['ValidationError'](_0x8e54('0x73'));}if(_[_0x8e54('0x74')](_0x1dcd12['body'][_0x8e54('0x58')])||_0x1dcd12['body'][_0x8e54('0x58')]===''){throw new db['Sequelize'][(_0x8e54('0x6c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8e54('0x74')](_0x1dcd12['body']['mapKey'])){throw new db[(_0x8e54('0x6b'))][(_0x8e54('0x6c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xfa87eb);}if(!_[_0x8e54('0x75')](_0xfa87eb,_0x1dcd12[_0x8e54('0x58')][_0x8e54('0x76')])){throw new db['Sequelize'][(_0x8e54('0x6c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xfa87eb);}_0x519e7f[_0x1dcd12['body'][_0x8e54('0x76')]]=_0x1dcd12[_0x8e54('0x58')][_0x8e54('0x72')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x1dcd12[_0x8e54('0x54')]['id']},'include':[{'model':db[_0x8e54('0x77')],'as':_0x8e54('0x78'),'include':[{'model':db[_0x8e54('0x6a')],'as':_0x8e54('0x79'),'where':_0x519e7f,'limit':0x1,'order':[[_0x8e54('0x70'),_0x8e54('0x7a')]]}]},{'model':db[_0x8e54('0x7b')],'as':_0x8e54('0x7c')}]});})[_0x8e54('0x1a')](handleEntityNotFound(_0x16c206,null))['then'](function(_0x177f1a){if(_0x177f1a&&_0x177f1a[_0x8e54('0x78')]){_0x3fba0d[_0x8e54('0x7d')]=_0x177f1a;_0x3fba0d[_0x8e54('0x7e')]=_0x177f1a[_0x8e54('0x7c')];_0x3fba0d[_0x8e54('0x7f')]=_0x177f1a[_0x8e54('0x78')];_0x3fba0d[_0x8e54('0x7e')]=_[_0x8e54('0x80')](_0x3fba0d[_0x8e54('0x7e')],[_0x8e54('0x81')],[_0x8e54('0x82')]);if(_0x3fba0d[_0x8e54('0x7d')][_0x8e54('0x7c')]){delete _0x3fba0d[_0x8e54('0x7d')][_0x8e54('0x7c')];}if(_0x3fba0d[_0x8e54('0x7d')][_0x8e54('0x78')]&&_0x3fba0d['account']['List']['Contacts']['length']){return _0x3fba0d[_0x8e54('0x7d')][_0x8e54('0x78')][_0x8e54('0x79')][0x0];}var _0x51943c=_[_0x8e54('0x15')](_0x1dcd12[_0x8e54('0x58')],{'firstName':_0x1dcd12[_0x8e54('0x58')]['from'],'ListId':_0x177f1a[_0x8e54('0x71')]});_0x51943c[_0x1dcd12[_0x8e54('0x58')][_0x8e54('0x76')]]=_0x1dcd12[_0x8e54('0x58')][_0x8e54('0x72')];return db[_0x8e54('0x6a')][_0x8e54('0x57')](_0x51943c,{'fields':_0x45aaed,'raw':!![]});}})[_0x8e54('0x1a')](handleEntityNotFound(_0x16c206,null))[_0x8e54('0x1a')](function(_0x581934){_0x3fba0d[_0x8e54('0x83')]=_0x581934;if(_0x581934){var _0x194de9={'ContactId':_0x581934['id'],'OpenchannelAccountId':_0x1dcd12['params']['id'],'from':(_0x581934['firstName']||'')+'\x20'+(_0x581934[_0x8e54('0x84')]||'')};var _0x4cbaab={'OpenchannelAccountId':_0x1dcd12[_0x8e54('0x54')]['id'],'closed':![]};if(_0x1dcd12[_0x8e54('0x58')]['threadId']){_0x4cbaab[_0x8e54('0x85')]=_0x1dcd12['body'][_0x8e54('0x85')];return db[_0x8e54('0x86')][_0x8e54('0x56')]({'where':_0x4cbaab})[_0x8e54('0x1a')](function(_0x48a8eb){if(_0x48a8eb){return[_0x48a8eb,![]];}_0x194de9[_0x8e54('0x85')]=_0x1dcd12[_0x8e54('0x58')][_0x8e54('0x85')];_0x194de9['externalUrl']=_0x1dcd12[_0x8e54('0x58')][_0x8e54('0x87')];return db[_0x8e54('0x86')][_0x8e54('0x57')](_0x194de9)[_0x8e54('0x1a')](function(_0x4e605f){return[_0x4e605f,!![]];});});}else{_0x4cbaab['threadId']=null;}_0x4cbaab[_0x8e54('0x88')]=_0x581934['id'];return db['OpenchannelInteraction']['find']({'where':_0x4cbaab})[_0x8e54('0x1a')](function(_0x470a53){if(_0x470a53){return[_0x470a53,![]];}return db[_0x8e54('0x86')][_0x8e54('0x57')](_0x194de9)['then'](function(_0x5c0a1e){return[_0x5c0a1e,!![]];});});}})[_0x8e54('0x89')](function(_0x21db2f,_0x34042b){if(_0x21db2f){_0x5863ae=_0x34042b;if(!_0x34042b){var _0x5f2f1f={'from':(_0x3fba0d[_0x8e54('0x83')][_0x8e54('0x8a')]||'')+'\x20'+(_0x3fba0d[_0x8e54('0x83')]['lastName']||'')};if(_0x1dcd12[_0x8e54('0x58')]['threadId']&&_0x1dcd12[_0x8e54('0x58')]['messageId']&&_0x1dcd12['body'][_0x8e54('0x85')]!=_0x1dcd12['body'][_0x8e54('0x8b')]){_0x5f2f1f[_0x8e54('0x85')]=_0x1dcd12[_0x8e54('0x58')][_0x8e54('0x8b')];}return _0x21db2f[_0x8e54('0x30')](_0x5f2f1f);}else{return _0x21db2f;}}})['then'](function(_0x5f3395){_0x3fba0d[_0x8e54('0x8c')]=_0x5f3395[_0x8e54('0x32')]({'plain':!![]});_0x3fba0d[_0x8e54('0x8c')][_0x8e54('0x8d')]=_0x5863ae;if(_0x3fba0d[_0x8e54('0x8c')][_0x8e54('0x8d')]){if(_0x3fba0d[_0x8e54('0x7d')][_0x8e54('0x8e')]){_0x3fba0d[_0x8e54('0x7e')][_0x8e54('0x8f')]({'id':0x0,'priority':_0x3fba0d[_0x8e54('0x7e')]['length']+0x1,'app':'close','appdata':_0x8e54('0x90'),'interval':_0x8e54('0x91')});}}return db[_0x8e54('0x92')][_0x8e54('0x57')]({'body':_0x1dcd12[_0x8e54('0x58')][_0x8e54('0x58')],'OpenchannelAccountId':_0x1dcd12[_0x8e54('0x54')]['id'],'OpenchannelInteractionId':_0x5f3395['id'],'direction':'in','ContactId':_0x3fba0d[_0x8e54('0x83')]['id'],'AttachmentId':_0x1dcd12['body'][_0x8e54('0x93')]});})[_0x8e54('0x1a')](function(_0x2f906c){_0x3fba0d[_0x8e54('0x21')]=_0x2f906c;if(!_0x3fba0d[_0x8e54('0x8c')][_0x8e54('0x94')])return;return db[_0x8e54('0x95')][_0x8e54('0x56')]({'attributes':['id',_0x8e54('0x35')],'where':{'id':_0x3fba0d[_0x8e54('0x8c')]['UserId']}});})[_0x8e54('0x1a')](function(_0x3b3344){if(_0x3b3344){_0x3fba0d[_0x8e54('0x7e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8e54('0x96'),'appdata':_0x3b3344[_0x8e54('0x35')]+','+(_0x3fba0d[_0x8e54('0x7d')][_0x8e54('0x97')]||0xa),'interval':'*,*,*,*'});}if(!_0x3fba0d[_0x8e54('0x8c')]['queueId'])return;return db[_0x8e54('0x98')]['find']({'attributes':['id',_0x8e54('0x35')],'where':{'id':_0x3fba0d['interaction'][_0x8e54('0x99')]}});})['then'](function(_0x1f93bc){if(_0x1f93bc){_0x3fba0d[_0x8e54('0x7e')]['unshift']({'id':0x0,'priority':0x1,'app':_0x8e54('0x9a'),'appdata':_0x1f93bc[_0x8e54('0x35')]+','+(_0x3fba0d[_0x8e54('0x7d')]['waitForTheAssignedQueue']||0x12c),'interval':_0x8e54('0x91')});}return respondWithRpcPromise(_0x8e54('0x9b'),'startRouting',_0x3fba0d);})[_0x8e54('0x1a')](function(_0x7ba84f){respondWithRpcPromise(_0x8e54('0x9c'),_0x8e54('0x9c'),{'event':_0x8e54('0x68'),'message':_0x7ba84f},client9002);return _0x7ba84f;})['then'](respondWithResult(_0x16c206,null))[_0x8e54('0x24')](handleError(_0x16c206,null));};exports[_0x8e54('0x9d')]=function(_0x4c7a41,_0x4771c0){var _0x53767c=_0x4c7a41[_0x8e54('0x54')]['id'];var _0x129197=_0x4c7a41[_0x8e54('0x58')];var _0xa5c2a9=0xc8;var _0x3fb50e=null;return db[_0x8e54('0x9e')][_0x8e54('0x9f')]({'isolationLevel':db[_0x8e54('0x9e')]['Transaction'][_0x8e54('0xa0')][_0x8e54('0xa1')]},function(_0x53905e){return db[_0x8e54('0x3b')][_0x8e54('0x62')]({'where':{'id':_0x53767c},'transaction':_0x53905e})['then'](function(_0x1347dc){if(_0x1347dc){return db[_0x8e54('0x7b')][_0x8e54('0x31')]({'where':{'OpenchannelAccountId':_0x53767c},'transaction':_0x53905e})[_0x8e54('0x1a')](function(){var _0x2c3cc9=_[_0x8e54('0x3a')](_0x129197,function(_0x45fa1b){_0x45fa1b[_0x8e54('0x5f')]=_0x53767c;return _0x45fa1b;});return db['OpenchannelApplication'][_0x8e54('0xa2')](_0x2c3cc9,{'transaction':_0x53905e});});}else{_0xa5c2a9=0x194;_0x3fb50e=[];}});})[_0x8e54('0x1a')](function(){if(_0xa5c2a9!==0x194){return db[_0x8e54('0x7b')][_0x8e54('0xa3')]({'where':{'OpenchannelAccountId':_0x53767c},'order':_0x8e54('0x81')})[_0x8e54('0x1a')](function(_0x1a7071){_0x3fb50e=_0x1a7071;});}})[_0x8e54('0x24')](function(_0x26a1b3){_0xa5c2a9=0x1f4;logger[_0x8e54('0x1f')](_0x26a1b3[_0x8e54('0xa4')]);if(_0x26a1b3['name']){delete _0x26a1b3['name'];}_0x3fb50e=_0x26a1b3;})[_0x8e54('0xa5')](function(){if(_0x3fb50e===null){_0x4771c0[_0x8e54('0x25')](_0xa5c2a9);}else{if(_0xa5c2a9===0x1f4){_0x4771c0[_0x8e54('0x26')](_0xa5c2a9)[_0x8e54('0x36')](_0x3fb50e);}else{_0x4771c0['status'](_0xa5c2a9)[_0x8e54('0x28')](_0x3fb50e);}}});};exports[_0x8e54('0xa6')]=function(_0x4521d8,_0x42d768,_0x5b8f95){var _0x1e64dd={};var _0x2d2d5f={};var _0x244801;var _0x52f037;return db[_0x8e54('0x3b')]['findOne']({'where':{'id':_0x4521d8[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x42d768,null))['then'](function(_0x2bac97){if(_0x2bac97){_0x244801=_0x2bac97;_0x2d2d5f[_0x8e54('0x40')]=_[_0x8e54('0x42')](db[_0x8e54('0x7b')]['rawAttributes']);_0x2d2d5f['query']=_[_0x8e54('0x42')](_0x4521d8['query']);_0x2d2d5f['filters']=_[_0x8e54('0x55')](_0x2d2d5f['model'],_0x2d2d5f[_0x8e54('0x41')]);_0x1e64dd[_0x8e54('0x44')]=_['intersection'](_0x2d2d5f[_0x8e54('0x40')],qs[_0x8e54('0x45')](_0x4521d8[_0x8e54('0x41')][_0x8e54('0x45')]));_0x1e64dd[_0x8e54('0x44')]=_0x1e64dd[_0x8e54('0x44')]['length']?_0x1e64dd[_0x8e54('0x44')]:_0x2d2d5f['model'];_0x1e64dd[_0x8e54('0x49')]=qs[_0x8e54('0x4a')](_0x4521d8[_0x8e54('0x41')][_0x8e54('0x4a')]);_0x1e64dd['where']=qs[_0x8e54('0x43')](_[_0x8e54('0x4c')](_0x4521d8[_0x8e54('0x41')],_0x2d2d5f['filters']));if(_0x4521d8[_0x8e54('0x41')][_0x8e54('0x4d')]){_0x1e64dd[_0x8e54('0x4b')]=_[_0x8e54('0x4e')](_0x1e64dd[_0x8e54('0x4b')],{'$or':_[_0x8e54('0x3a')](_0x1e64dd[_0x8e54('0x44')],function(_0x3bf293){var _0x4d1a5f={};_0x4d1a5f[_0x3bf293]={'$like':'%'+_0x4521d8[_0x8e54('0x41')]['filter']+'%'};return _0x4d1a5f;})});}_0x1e64dd=_['merge']({},_0x1e64dd,_0x4521d8['options']);return _0x244801['getApplications'](_0x1e64dd);}})[_0x8e54('0x1a')](function(_0x43d997){if(_0x43d997){_0x52f037=_0x43d997[_0x8e54('0x46')];if(!_0x4521d8[_0x8e54('0x41')][_0x8e54('0x47')]('nolimit')){_0x1e64dd['limit']=qs[_0x8e54('0x2b')](_0x4521d8[_0x8e54('0x41')][_0x8e54('0x2b')]);_0x1e64dd[_0x8e54('0x2a')]=qs[_0x8e54('0x2a')](_0x4521d8['query'][_0x8e54('0x2a')]);}return _0x244801[_0x8e54('0xa6')](_0x1e64dd);}})['then'](function(_0x36eb25){if(_0x36eb25){return _0x36eb25?{'count':_0x52f037,'rows':_0x36eb25}:null;}})[_0x8e54('0x1a')](respondWithResult(_0x42d768,null))['catch'](handleError(_0x42d768,null));};exports[_0x8e54('0xa7')]=function(_0x2a6beb,_0x4b210c,_0x58e7a0){var _0x28a63c={'raw':![],'where':{}};var _0x40db6e={};var _0xd2bae2={'count':0x0,'rows':[]};return db[_0x8e54('0x3b')]['findOne']({'where':{'id':_0x2a6beb[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x4b210c,null))[_0x8e54('0x1a')](function(_0x3ac96a){if(_0x3ac96a){_0x40db6e[_0x8e54('0x40')]=_[_0x8e54('0x42')](db['OpenchannelInteraction'][_0x8e54('0x3c')]);_0x40db6e[_0x8e54('0x41')]=_['keys'](_0x2a6beb[_0x8e54('0x41')]);_0x40db6e[_0x8e54('0x43')]=_['intersection'](_0x40db6e[_0x8e54('0x40')],_0x40db6e[_0x8e54('0x41')]);_0x28a63c['attributes']=_[_0x8e54('0x55')](_0x40db6e[_0x8e54('0x40')],qs[_0x8e54('0x45')](_0x2a6beb[_0x8e54('0x41')][_0x8e54('0x45')]));_0x28a63c[_0x8e54('0x44')]=_0x28a63c['attributes'][_0x8e54('0x46')]?_0x28a63c[_0x8e54('0x44')]:_0x40db6e['model'];if(!_0x2a6beb['query'][_0x8e54('0x47')]('nolimit')){_0x28a63c[_0x8e54('0x2b')]=qs[_0x8e54('0x2b')](_0x2a6beb[_0x8e54('0x41')][_0x8e54('0x2b')]);_0x28a63c[_0x8e54('0x2a')]=qs[_0x8e54('0x2a')](_0x2a6beb[_0x8e54('0x41')][_0x8e54('0x2a')]);}_0x28a63c[_0x8e54('0x49')]=qs[_0x8e54('0x4a')](_0x2a6beb[_0x8e54('0x41')][_0x8e54('0x4a')]);_0x28a63c[_0x8e54('0x4b')]=qs['filters'](_[_0x8e54('0x4c')](_0x2a6beb[_0x8e54('0x41')],_0x40db6e[_0x8e54('0x43')]));_0x28a63c[_0x8e54('0x4b')][_0x8e54('0x5f')]=_0x3ac96a['id'];if(_0x2a6beb[_0x8e54('0x41')][_0x8e54('0x4d')]){_0x28a63c[_0x8e54('0x4b')]=_[_0x8e54('0x4e')](_0x28a63c['where'],{'$or':_[_0x8e54('0x3a')](_0x28a63c[_0x8e54('0x44')],function(_0x334047){var _0x25d3cc={};_0x25d3cc[_0x334047]={'$like':'%'+_0x2a6beb[_0x8e54('0x41')]['filter']+'%'};return _0x25d3cc;})});}_0x28a63c=_[_0x8e54('0x4e')]({},_0x28a63c,_0x2a6beb['options']);return db[_0x8e54('0x86')][_0x8e54('0x29')]({'where':_0x28a63c['where']})[_0x8e54('0x1a')](function(_0x32efbe){_0xd2bae2['count']=_0x32efbe;if(_0x2a6beb[_0x8e54('0x41')][_0x8e54('0x51')]){_0x28a63c['include']=[{'model':db[_0x8e54('0x6a')],'as':_0x8e54('0xa8'),'required':![]},{'model':db[_0x8e54('0x95')],'as':'Owner','attributes':['name',_0x8e54('0xa9'),'internal'],'required':![]},{'model':db[_0x8e54('0xaa')],'as':'Tags','attributes':['id',_0x8e54('0x35'),_0x8e54('0xab')],'where':_0x2a6beb[_0x8e54('0x41')][_0x8e54('0xac')]?{'id':_0x2a6beb['query'][_0x8e54('0xac')]}:undefined,'required':_0x2a6beb['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x8e54('0x52')](_0x28a63c);})['then'](function(_0x2a1f9a){_0xd2bae2[_0x8e54('0x53')]=_0x2a1f9a;return _0xd2bae2;});}})['then'](respondWithFilteredResult(_0x4b210c,_0x28a63c))['catch'](handleError(_0x4b210c,null));};exports[_0x8e54('0xad')]=function(_0x377172,_0x514094,_0x581f50){return db[_0x8e54('0x3b')][_0x8e54('0x56')]({'where':{'id':_0x377172[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x514094,null))['then'](function(_0x2b6229){if(_0x2b6229){return _0x2b6229[_0x8e54('0xad')](_0x377172[_0x8e54('0x58')]['ids'],_[_0x8e54('0xae')](_0x377172[_0x8e54('0x58')],[_0x8e54('0x64'),'id'])||{})[_0x8e54('0x89')](function(_0x558876){for(var _0x5821ef=0x0;_0x5821ef<_0x377172['body'][_0x8e54('0x64')][_0x8e54('0x46')];_0x5821ef+=0x1){socket[_0x8e54('0xaf')](_0x8e54('0xb0'),{'UserId':Number(_0x377172['body'][_0x8e54('0x64')][_0x5821ef]),'OpenchannelAccountId':Number(_0x377172['params']['id'])});}return _0x558876;});}})['then'](respondWithResult(_0x514094,null))['catch'](handleError(_0x514094,null));};exports[_0x8e54('0xb1')]=function(_0x53e706,_0x4b2c32,_0x321abb){return db[_0x8e54('0x3b')]['find']({'where':{'id':_0x53e706[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x4b2c32,null))[_0x8e54('0x1a')](function(_0x33fd49){if(_0x33fd49){return _0x33fd49[_0x8e54('0xb1')](_0x53e706[_0x8e54('0x41')][_0x8e54('0x64')])[_0x8e54('0x1a')](function(){if(_[_0x8e54('0xb2')](_0x53e706[_0x8e54('0x41')][_0x8e54('0x64')])){for(var _0x14e783=0x0;_0x14e783<_0x53e706['query'][_0x8e54('0x64')][_0x8e54('0x46')];_0x14e783+=0x1){socket['emit'](_0x8e54('0xb3'),{'UserId':Number(_0x53e706[_0x8e54('0x41')][_0x8e54('0x64')][_0x14e783]),'OpenchannelAccountId':Number(_0x53e706[_0x8e54('0x54')]['id'])});}}else{socket[_0x8e54('0xaf')]('userOpenchannelAccount:remove',{'UserId':Number(_0x53e706[_0x8e54('0x41')][_0x8e54('0x64')]),'OpenchannelAccountId':Number(_0x53e706[_0x8e54('0x54')]['id'])});}});}})[_0x8e54('0x1a')](respondWithStatusCode(_0x4b2c32,null))['catch'](handleError(_0x4b2c32,null));};exports['getAgents']=function(_0x4cfab7,_0x86cafd,_0x2fb3f4){var _0x5b7bf9={};var _0x25693e={};var _0xe1930c;var _0x1b5e6c;return db[_0x8e54('0x3b')]['findOne']({'where':{'id':_0x4cfab7['params']['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x86cafd,null))[_0x8e54('0x1a')](function(_0xd7acc0){if(_0xd7acc0){_0xe1930c=_0xd7acc0;_0x25693e[_0x8e54('0x40')]=_[_0x8e54('0x42')](db['User'][_0x8e54('0x3c')]);_0x25693e[_0x8e54('0x41')]=_[_0x8e54('0x42')](_0x4cfab7['query']);_0x25693e[_0x8e54('0x43')]=_[_0x8e54('0x55')](_0x25693e[_0x8e54('0x40')],_0x25693e[_0x8e54('0x41')]);_0x5b7bf9[_0x8e54('0x44')]=_[_0x8e54('0x55')](_0x25693e[_0x8e54('0x40')],qs[_0x8e54('0x45')](_0x4cfab7[_0x8e54('0x41')]['fields']));_0x5b7bf9[_0x8e54('0x44')]=_0x5b7bf9['attributes'][_0x8e54('0x46')]?_0x5b7bf9[_0x8e54('0x44')]:_0x25693e[_0x8e54('0x40')];_0x5b7bf9[_0x8e54('0x49')]=qs[_0x8e54('0x4a')](_0x4cfab7[_0x8e54('0x41')]['sort']);_0x5b7bf9[_0x8e54('0x4b')]=qs[_0x8e54('0x43')](_[_0x8e54('0x4c')](_0x4cfab7['query'],_0x25693e['filters']));if(_0x4cfab7['query'][_0x8e54('0x4d')]){_0x5b7bf9[_0x8e54('0x4b')]=_[_0x8e54('0x4e')](_0x5b7bf9[_0x8e54('0x4b')],{'$or':_['map'](_0x5b7bf9[_0x8e54('0x44')],function(_0x9a8635){var _0x2342ef={};_0x2342ef[_0x9a8635]={'$like':'%'+_0x4cfab7['query'][_0x8e54('0x4d')]+'%'};return _0x2342ef;})});}_0x5b7bf9=_[_0x8e54('0x4e')]({},_0x5b7bf9,_0x4cfab7['options']);return _0xe1930c[_0x8e54('0xb4')](_0x5b7bf9);}})[_0x8e54('0x1a')](function(_0x72963b){if(_0x72963b){_0x1b5e6c=_0x72963b[_0x8e54('0x46')];if(!_0x4cfab7[_0x8e54('0x41')][_0x8e54('0x47')]('nolimit')){_0x5b7bf9[_0x8e54('0x2b')]=qs[_0x8e54('0x2b')](_0x4cfab7[_0x8e54('0x41')][_0x8e54('0x2b')]);_0x5b7bf9[_0x8e54('0x2a')]=qs[_0x8e54('0x2a')](_0x4cfab7['query'][_0x8e54('0x2a')]);}return _0xe1930c[_0x8e54('0xb4')](_0x5b7bf9);}})[_0x8e54('0x1a')](function(_0x1b226f){if(_0x1b226f){return _0x1b226f?{'count':_0x1b5e6c,'rows':_0x1b226f}:null;}})['then'](respondWithResult(_0x86cafd,null))['catch'](handleError(_0x86cafd,null));};exports[_0x8e54('0x36')]=function(_0x23a4f6,_0x4eca3a,_0x16a130){var _0x9163b,_0x515717,_0x3285e1;if(_['isNil'](_0x23a4f6[_0x8e54('0x58')][_0x8e54('0x58')])||_0x23a4f6[_0x8e54('0x58')][_0x8e54('0x58')]===''){throw new db[(_0x8e54('0x6b'))]['ValidationError'](_0x8e54('0xb5'));}if(_['isNil'](_0x23a4f6[_0x8e54('0x58')]['to'])){}_0x9163b=_0x23a4f6[_0x8e54('0x58')]['to'];return db[_0x8e54('0x3b')][_0x8e54('0x62')]({'where':{'id':_0x23a4f6[_0x8e54('0x54')]['id']}})[_0x8e54('0x1a')](handleEntityNotFound(_0x4eca3a,null))[_0x8e54('0x1a')](function(_0x1d1784){if(_0x1d1784){return db['OpenchannelAccount'][_0x8e54('0x56')]({'where':{'id':_0x1d1784['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8e54('0x6a')],'as':_0x8e54('0x79'),'where':{[_0x1d1784['mapKey']]:_0x9163b},'limit':0x1,'order':[[_0x8e54('0x70'),_0x8e54('0x7a')]]}]}]})[_0x8e54('0x1a')](handleEntityNotFound(_0x4eca3a,null))[_0x8e54('0x1a')](function(_0x36f390){if(_0x36f390&&_0x36f390[_0x8e54('0x78')]){_0x515717=_0x36f390[_0x8e54('0x32')]({'plain':!![]});if(_0x515717[_0x8e54('0x78')]&&_0x515717[_0x8e54('0x78')][_0x8e54('0x79')]['length']){return _0x515717[_0x8e54('0x78')][_0x8e54('0x79')][0x0];}return db[_0x8e54('0x6a')][_0x8e54('0x57')](_['defaults'](_0x23a4f6['body'],{'firstName':_0x9163b,[_0x36f390[_0x8e54('0x76')]]:_0x9163b,'phone':_0x9163b,'ListId':_0x515717[_0x8e54('0x71')]}));}})[_0x8e54('0x1a')](handleEntityNotFound(_0x4eca3a,null))[_0x8e54('0x1a')](function(_0x1dd853){if(_0x1dd853){_0x3285e1=_0x1dd853;return db[_0x8e54('0x86')]['find']({'where':{'ContactId':_0x3285e1['id'],'closed':![],'OpenchannelAccountId':_0x515717['id']}})[_0x8e54('0x1a')](function(_0x67f504){if(_0x67f504){return[_0x67f504,![]];}return db[_0x8e54('0x86')]['create']({'UserId':_0x23a4f6[_0x8e54('0x5a')]['id'],'ContactId':_0x3285e1['id'],'OpenchannelAccountId':_0x515717['id'],'lastMsgDirection':_0x8e54('0xb6'),'firstMsgDirection':_0x8e54('0xb6'),'Messages':[_[_0x8e54('0x4e')](_0x23a4f6['body'],{'read':![],'body':_0x23a4f6[_0x8e54('0x58')]['body'],'OpenchannelAccountId':_0x515717['id'],'UserId':_0x23a4f6[_0x8e54('0x5a')]['id'],'ContactId':_0x3285e1['id']})]},{'include':[{'model':db[_0x8e54('0x92')],'as':_0x8e54('0xb7')}]})['then'](function(_0x45f0e1){return[_0x45f0e1,!![]];});});}})[_0x8e54('0x89')](function(_0x391303,_0x2bc1ed){if(_0x2bc1ed){return _0x391303;}return db['OpenchannelMessage'][_0x8e54('0x57')](_[_0x8e54('0x4e')](_0x23a4f6[_0x8e54('0x58')],{'read':![],'body':_0x23a4f6[_0x8e54('0x58')][_0x8e54('0x58')],'OpenchannelAccountId':_0x515717['id'],'OpenchannelInteractionId':_0x391303['id'],'UserId':_0x23a4f6[_0x8e54('0x5a')]['id'],'ContactId':_0x3285e1['id']}))[_0x8e54('0x1a')](function(_0x2d5cf2){_0x391303[_0x8e54('0xb8')][_0x8e54('0xb7')]=[];_0x391303[_0x8e54('0xb8')][_0x8e54('0xb7')][_0x8e54('0x8f')](_0x2d5cf2[_0x8e54('0xb8')]);return _0x391303;});});}})[_0x8e54('0x1a')](respondWithResult(_0x4eca3a,null))[_0x8e54('0x24')](handleError(_0x4eca3a,null));}; \ No newline at end of file +var _0x46e1=['result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','get','OpenchannelAccounts','sendStatus','stack','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','include','rows','show','params','length','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','getDispositions','findOne','Disposition','nolimit','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','contact','threadId','externalUrl','OpenchannelInteraction','spread','lastName','messageId','created','interaction','push','close','unmanaged','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','OpenchannelQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','getInteractions','Owner','fullname','internal','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x47dc42,_0x128e22){var _0x2524b6=function(_0x4f3458){while(--_0x4f3458){_0x47dc42['push'](_0x47dc42['shift']());}};_0x2524b6(++_0x128e22);}(_0x46e1,0x155));var _0x146e=function(_0x1bd800,_0x27b21a){_0x1bd800=_0x1bd800-0x0;var _0x4f6060=_0x46e1[_0x1bd800];return _0x4f6060;};'use strict';var emlformat=require(_0x146e('0x0'));var rimraf=require(_0x146e('0x1'));var zipdir=require(_0x146e('0x2'));var jsonpatch=require(_0x146e('0x3'));var rp=require(_0x146e('0x4'));var moment=require(_0x146e('0x5'));var BPromise=require(_0x146e('0x6'));var Mustache=require(_0x146e('0x7'));var util=require(_0x146e('0x8'));var path=require(_0x146e('0x9'));var sox=require('sox');var csv=require(_0x146e('0xa'));var ejs=require(_0x146e('0xb'));var fs=require('fs');var fs_extra=require(_0x146e('0xc'));var _=require(_0x146e('0xd'));var squel=require(_0x146e('0xe'));var crypto=require(_0x146e('0xf'));var jsforce=require(_0x146e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x146e('0xa'));var querystring=require('querystring');var Papa=require(_0x146e('0x11'));var Redis=require(_0x146e('0x12'));var authService=require(_0x146e('0x13'));var qs=require(_0x146e('0x14'));var as=require(_0x146e('0x15'));var hardwareService=require(_0x146e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x146e('0x17'));var config=require(_0x146e('0x18'));var licenseUtil=require(_0x146e('0x19'));var db=require(_0x146e('0x1a'))['db'];config[_0x146e('0x1b')]=_[_0x146e('0x1c')](config[_0x146e('0x1b')],{'host':_0x146e('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x146e('0x1e'))[_0x146e('0x1f')](socket);var jayson=require(_0x146e('0x20'));var client=jayson[_0x146e('0x21')][_0x146e('0x22')]({'port':0x232c});var client9002=jayson[_0x146e('0x21')][_0x146e('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x1130d0,_0x44c82f,_0xe3699,_0x39e41f){return new BPromise(function(_0x55fddc,_0xcfd5f6){var _0x1a8a20=_0x39e41f||client;return _0x1a8a20[_0x146e('0x23')](_0x1130d0,_0xe3699)[_0x146e('0x24')](function(_0x2286f6){logger[_0x146e('0x25')](_0x146e('0x26'),_0x44c82f,'request\x20sent');logger[_0x146e('0x27')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x44c82f,_0x146e('0x28'),JSON[_0x146e('0x29')](_0x2286f6));if(_0x2286f6[_0x146e('0x2a')]){if(_0x2286f6['error'][_0x146e('0x2b')]===0x1f4){logger['error'](_0x146e('0x26'),_0x44c82f,_0x2286f6['error'][_0x146e('0x2c')]);return _0xcfd5f6(_0x2286f6[_0x146e('0x2a')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x44c82f,_0x2286f6['error']['message']);return _0x55fddc(_0x2286f6['error'][_0x146e('0x2c')]);}else{logger['info'](_0x146e('0x26'),_0x44c82f,_0x146e('0x28'));_0x55fddc(_0x2286f6[_0x146e('0x2d')][_0x146e('0x2c')]);}})[_0x146e('0x2e')](function(_0xed7b99){logger[_0x146e('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x44c82f,_0xed7b99);_0xcfd5f6(_0xed7b99);});});}function respondWithStatusCode(_0x96522c,_0x50e167){_0x50e167=_0x50e167||0xcc;return function(_0x2a31b8){if(_0x2a31b8){return _0x96522c['sendStatus'](_0x50e167);}return _0x96522c['status'](_0x50e167)[_0x146e('0x2f')]();};}function respondWithResult(_0x486c6a,_0x402faf){_0x402faf=_0x402faf||0xc8;return function(_0x43e3b5){if(_0x43e3b5){return _0x486c6a[_0x146e('0x30')](_0x402faf)[_0x146e('0x31')](_0x43e3b5);}};}function respondWithFilteredResult(_0x3a0bf3,_0x5bd280){return function(_0x1ce964){if(_0x1ce964){var _0x46cf9a=typeof _0x5bd280[_0x146e('0x32')]===_0x146e('0x33')&&typeof _0x5bd280[_0x146e('0x34')]===_0x146e('0x33');var _0x2d95c6=_0x1ce964[_0x146e('0x35')];var _0x502324=_0x46cf9a?0x0:_0x5bd280['offset'];var _0x37c5d8=_0x46cf9a?_0x1ce964['count']:_0x5bd280[_0x146e('0x32')]+_0x5bd280['limit'];var _0x52b279;if(_0x37c5d8>=_0x2d95c6){_0x37c5d8=_0x2d95c6;_0x52b279=0xc8;}else{_0x52b279=0xce;}_0x3a0bf3[_0x146e('0x30')](_0x52b279);return _0x3a0bf3[_0x146e('0x36')](_0x146e('0x37'),_0x502324+'-'+_0x37c5d8+'/'+_0x2d95c6)[_0x146e('0x31')](_0x1ce964);}return null;};}function patchUpdates(_0x1d4b9f){return function(_0x2ea76e){try{jsonpatch['apply'](_0x2ea76e,_0x1d4b9f,!![]);}catch(_0x1630bd){return BPromise['reject'](_0x1630bd);}return _0x2ea76e[_0x146e('0x38')]();};}function saveUpdates(_0x5ea880,_0x14b5c2){return function(_0x2b9dd2){if(_0x2b9dd2){return _0x2b9dd2[_0x146e('0x39')](_0x5ea880)['then'](function(_0x2847fc){return _0x2847fc;});}return null;};}function removeEntity(_0x8454fd,_0x4cc605){return function(_0x781123){if(_0x781123){return _0x781123[_0x146e('0x3a')]()[_0x146e('0x24')](function(){var _0x10e007=_0x781123[_0x146e('0x3b')]({'plain':!![]});var _0xf26fea=_0x146e('0x3c');return db['UserProfileResource']['destroy']({'where':{'type':_0xf26fea,'resourceId':_0x10e007['id']}})[_0x146e('0x24')](function(){return _0x781123;});})[_0x146e('0x24')](function(){_0x8454fd[_0x146e('0x30')](0xcc)[_0x146e('0x2f')]();});}};}function handleEntityNotFound(_0x3cbf6f,_0x1602e7){return function(_0x5afc85){if(!_0x5afc85){_0x3cbf6f[_0x146e('0x3d')](0x194);}return _0x5afc85;};}function handleError(_0x5d63a0,_0x14217b){_0x14217b=_0x14217b||0x1f4;return function(_0xbdb2aa){logger[_0x146e('0x2a')](_0xbdb2aa[_0x146e('0x3e')]);if(_0xbdb2aa[_0x146e('0x3f')]){delete _0xbdb2aa[_0x146e('0x3f')];}_0x5d63a0['status'](_0x14217b)['send'](_0xbdb2aa);};}exports['index']=function(_0x574daf,_0x783b55){var _0xa06a50={'include':[{'model':db[_0x146e('0x40')],'as':_0x146e('0x41')}]},_0x3c97eb={},_0x45be48={'count':0x0,'rows':[]};var _0x341a3a=_[_0x146e('0x42')](db[_0x146e('0x43')][_0x146e('0x44')],function(_0x4bf1bb){return{'name':_0x4bf1bb[_0x146e('0x45')],'type':_0x4bf1bb[_0x146e('0x46')][_0x146e('0x47')]};});_0x3c97eb[_0x146e('0x48')]=_[_0x146e('0x42')](_0x341a3a,'name');_0x3c97eb[_0x146e('0x49')]=_[_0x146e('0x4a')](_0x574daf[_0x146e('0x49')]);_0x3c97eb[_0x146e('0x4b')]=_[_0x146e('0x4c')](_0x3c97eb[_0x146e('0x48')],_0x3c97eb['query']);_0xa06a50[_0x146e('0x4d')]=_[_0x146e('0x4c')](_0x3c97eb[_0x146e('0x48')],qs['fields'](_0x574daf[_0x146e('0x49')][_0x146e('0x4e')]));_0xa06a50['attributes']=_0xa06a50['attributes']['length']?_0xa06a50[_0x146e('0x4d')]:_0x3c97eb[_0x146e('0x48')];if(!_0x574daf[_0x146e('0x49')][_0x146e('0x4f')]('nolimit')){_0xa06a50[_0x146e('0x34')]=qs[_0x146e('0x34')](_0x574daf[_0x146e('0x49')][_0x146e('0x34')]);_0xa06a50[_0x146e('0x32')]=qs['offset'](_0x574daf[_0x146e('0x49')]['offset']);}_0xa06a50[_0x146e('0x50')]=qs[_0x146e('0x51')](_0x574daf[_0x146e('0x49')][_0x146e('0x51')]);_0xa06a50['where']=qs[_0x146e('0x4b')](_['pick'](_0x574daf[_0x146e('0x49')],_0x3c97eb[_0x146e('0x4b')]),_0x341a3a);if(_0x574daf[_0x146e('0x49')][_0x146e('0x52')]){_0xa06a50[_0x146e('0x53')]=_[_0x146e('0x54')](_0xa06a50['where'],{'$or':_[_0x146e('0x42')](_0x341a3a,function(_0xde1d9f){if(_0xde1d9f['type']!==_0x146e('0x55')){var _0x11968c={};_0x11968c[_0xde1d9f[_0x146e('0x3f')]]={'$like':'%'+_0x574daf[_0x146e('0x49')][_0x146e('0x52')]+'%'};return _0x11968c;}})});}_0xa06a50=_[_0x146e('0x54')]({},_0xa06a50,_0x574daf['options']);var _0x178161={'where':_0xa06a50[_0x146e('0x53')]};return db[_0x146e('0x43')][_0x146e('0x35')](_0x178161)[_0x146e('0x24')](function(_0x161dd7){_0x45be48[_0x146e('0x35')]=_0x161dd7;if(_0x574daf[_0x146e('0x49')]['includeAll']){_0xa06a50[_0x146e('0x56')]=[{'all':!![]}];}return db[_0x146e('0x43')]['findAll'](_0xa06a50);})[_0x146e('0x24')](function(_0x42d2a7){_0x45be48[_0x146e('0x57')]=_0x42d2a7;return _0x45be48;})[_0x146e('0x24')](respondWithFilteredResult(_0x783b55,_0xa06a50))['catch'](handleError(_0x783b55,null));};exports[_0x146e('0x58')]=function(_0x1c62e5,_0x2e4d94){var _0x418a56={'raw':![],'where':{'id':_0x1c62e5[_0x146e('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x146e('0x41')}]},_0xa957f0={};_0xa957f0[_0x146e('0x48')]=_[_0x146e('0x4a')](db[_0x146e('0x43')]['rawAttributes']);_0xa957f0[_0x146e('0x49')]=_[_0x146e('0x4a')](_0x1c62e5[_0x146e('0x49')]);_0xa957f0[_0x146e('0x4b')]=_[_0x146e('0x4c')](_0xa957f0['model'],_0xa957f0[_0x146e('0x49')]);_0x418a56[_0x146e('0x4d')]=_[_0x146e('0x4c')](_0xa957f0[_0x146e('0x48')],qs['fields'](_0x1c62e5[_0x146e('0x49')][_0x146e('0x4e')]));_0x418a56['attributes']=_0x418a56[_0x146e('0x4d')][_0x146e('0x5a')]?_0x418a56[_0x146e('0x4d')]:_0xa957f0[_0x146e('0x48')];if(_0x1c62e5['query'][_0x146e('0x5b')]){_0x418a56['include']=[{'all':!![]}];}_0x418a56=_[_0x146e('0x54')]({},_0x418a56,_0x1c62e5[_0x146e('0x5c')]);return db[_0x146e('0x43')]['find'](_0x418a56)['then'](handleEntityNotFound(_0x2e4d94,null))[_0x146e('0x24')](respondWithResult(_0x2e4d94,null))[_0x146e('0x2e')](handleError(_0x2e4d94,null));};exports[_0x146e('0x5d')]=function(_0xf1067f,_0x2c29a2){return db[_0x146e('0x43')]['create'](_0xf1067f[_0x146e('0x5e')],{})['then'](function(_0x1956a0){var _0x523c00=_0xf1067f['user']['get']({'plain':!![]});if(!_0x523c00)throw new Error(_0x146e('0x5f'));if(_0x523c00[_0x146e('0x60')]===_0x146e('0x61')){var _0x1e5c86=_0x1956a0[_0x146e('0x3b')]({'plain':!![]});var _0x45955b='OpenchannelAccounts';return db[_0x146e('0x62')][_0x146e('0x63')]({'where':{'name':_0x45955b,'userProfileId':_0x523c00[_0x146e('0x64')]},'raw':!![]})[_0x146e('0x24')](function(_0x4644a7){if(_0x4644a7&&_0x4644a7['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1e5c86[_0x146e('0x3f')],'resourceId':_0x1e5c86['id'],'type':_0x4644a7[_0x146e('0x3f')],'sectionId':_0x4644a7['id']},{})[_0x146e('0x24')](function(){return _0x1956a0;});}else{return _0x1956a0;}})[_0x146e('0x2e')](function(_0x267080){logger[_0x146e('0x2a')](_0x146e('0x65'),_0x267080);throw _0x267080;});}return _0x1956a0;})[_0x146e('0x24')](respondWithResult(_0x2c29a2,0xc9))[_0x146e('0x2e')](handleError(_0x2c29a2,null));};exports[_0x146e('0x39')]=function(_0x5e7950,_0x1cc657){if(_0x5e7950[_0x146e('0x5e')]['id']){delete _0x5e7950['body']['id'];}return db[_0x146e('0x43')][_0x146e('0x63')]({'where':{'id':_0x5e7950[_0x146e('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x146e('0x41')}]})[_0x146e('0x24')](handleEntityNotFound(_0x1cc657,null))[_0x146e('0x24')](saveUpdates(_0x5e7950[_0x146e('0x5e')],null))[_0x146e('0x24')](respondWithResult(_0x1cc657,null))[_0x146e('0x2e')](handleError(_0x1cc657,null));};exports[_0x146e('0x3a')]=function(_0x89f27f,_0x5ed136){return db['OpenchannelAccount']['find']({'where':{'id':_0x89f27f[_0x146e('0x59')]['id']}})[_0x146e('0x24')](handleEntityNotFound(_0x5ed136,null))[_0x146e('0x24')](removeEntity(_0x5ed136,null))['catch'](handleError(_0x5ed136,null));};exports['describe']=function(_0x6060da,_0x15b5fd){return db[_0x146e('0x43')][_0x146e('0x66')]()[_0x146e('0x24')](respondWithResult(_0x15b5fd,null))[_0x146e('0x2e')](handleError(_0x15b5fd,null));};exports['addDisposition']=function(_0x56eda6,_0x58380f,_0x5474da){if(_0x56eda6[_0x146e('0x5e')]['id']){delete _0x56eda6[_0x146e('0x5e')]['id'];}return db[_0x146e('0x43')]['find']({'where':{'id':_0x56eda6[_0x146e('0x59')]['id']}})[_0x146e('0x24')](handleEntityNotFound(_0x58380f,null))['then'](function(_0x79d72a){if(_0x79d72a){_0x56eda6[_0x146e('0x5e')][_0x146e('0x67')]=_0x79d72a['id'];return db['Disposition'][_0x146e('0x5d')](_0x56eda6[_0x146e('0x5e')]);}})[_0x146e('0x24')](respondWithResult(_0x58380f,null))['catch'](handleError(_0x58380f,null));};exports[_0x146e('0x68')]=function(_0x29de52,_0x333bff,_0x27e10a){var _0x2f26b5={'raw':![],'where':{}};var _0x1b32a7={};var _0x10a1d5={'count':0x0,'rows':[]};return db[_0x146e('0x43')][_0x146e('0x69')]({'where':{'id':_0x29de52[_0x146e('0x59')]['id']}})[_0x146e('0x24')](handleEntityNotFound(_0x333bff,null))[_0x146e('0x24')](function(_0x48888c){if(_0x48888c){_0x1b32a7[_0x146e('0x48')]=_['keys'](db[_0x146e('0x6a')][_0x146e('0x44')]);_0x1b32a7[_0x146e('0x49')]=_[_0x146e('0x4a')](_0x29de52[_0x146e('0x49')]);_0x1b32a7[_0x146e('0x4b')]=_[_0x146e('0x4c')](_0x1b32a7[_0x146e('0x48')],_0x1b32a7[_0x146e('0x49')]);_0x2f26b5[_0x146e('0x4d')]=_['intersection'](_0x1b32a7[_0x146e('0x48')],qs['fields'](_0x29de52[_0x146e('0x49')][_0x146e('0x4e')]));_0x2f26b5[_0x146e('0x4d')]=_0x2f26b5[_0x146e('0x4d')]['length']?_0x2f26b5['attributes']:_0x1b32a7['model'];if(!_0x29de52[_0x146e('0x49')][_0x146e('0x4f')](_0x146e('0x6b'))){_0x2f26b5[_0x146e('0x34')]=qs['limit'](_0x29de52[_0x146e('0x49')]['limit']);_0x2f26b5['offset']=qs[_0x146e('0x32')](_0x29de52[_0x146e('0x49')]['offset']);}_0x2f26b5['order']=qs[_0x146e('0x51')](_0x29de52[_0x146e('0x49')][_0x146e('0x51')]);_0x2f26b5[_0x146e('0x53')]=qs[_0x146e('0x4b')](_[_0x146e('0x6c')](_0x29de52[_0x146e('0x49')],_0x1b32a7[_0x146e('0x4b')]));_0x2f26b5['where'][_0x146e('0x67')]=_0x48888c['id'];if(_0x29de52[_0x146e('0x49')][_0x146e('0x52')]){_0x2f26b5[_0x146e('0x53')]=_['merge'](_0x2f26b5[_0x146e('0x53')],{'$or':_['map'](_0x2f26b5[_0x146e('0x4d')],function(_0x4612f7){var _0xb1529e={};_0xb1529e[_0x4612f7]={'$like':'%'+_0x29de52[_0x146e('0x49')][_0x146e('0x52')]+'%'};return _0xb1529e;})});}_0x2f26b5=_[_0x146e('0x54')]({},_0x2f26b5,_0x29de52['options']);return db['Disposition'][_0x146e('0x35')]({'where':_0x2f26b5['where']})[_0x146e('0x24')](function(_0xe1debc){_0x10a1d5[_0x146e('0x35')]=_0xe1debc;if(_0x29de52[_0x146e('0x49')]['includeAll']){_0x2f26b5['include']=[{'all':!![]}];}return db[_0x146e('0x6a')][_0x146e('0x6d')](_0x2f26b5);})[_0x146e('0x24')](function(_0x101840){_0x10a1d5[_0x146e('0x57')]=_0x101840;return _0x10a1d5;});}})[_0x146e('0x24')](respondWithFilteredResult(_0x333bff,_0x2f26b5))['catch'](handleError(_0x333bff,null));};exports[_0x146e('0x6e')]=function(_0x54815a,_0x31985e,_0x5b3cf5){return db[_0x146e('0x43')][_0x146e('0x63')]({'where':{'id':_0x54815a['params']['id']}})[_0x146e('0x24')](handleEntityNotFound(_0x31985e,null))[_0x146e('0x24')](function(_0x178315){if(_0x178315){return _0x178315[_0x146e('0x6e')](_0x54815a[_0x146e('0x49')][_0x146e('0x6f')]);}})['then'](respondWithStatusCode(_0x31985e,null))[_0x146e('0x2e')](handleError(_0x31985e,null));};exports[_0x146e('0x70')]=function(_0x322d6d,_0x2d6a24,_0x54317f){if(_0x322d6d[_0x146e('0x5e')]['id']){delete _0x322d6d[_0x146e('0x5e')]['id'];}return db[_0x146e('0x43')][_0x146e('0x63')]({'where':{'id':_0x322d6d[_0x146e('0x59')]['id']}})[_0x146e('0x24')](handleEntityNotFound(_0x2d6a24,null))[_0x146e('0x24')](function(_0x453189){if(_0x453189){_0x322d6d[_0x146e('0x5e')]['OpenchannelAccountId']=_0x453189['id'];return db[_0x146e('0x71')]['create'](_0x322d6d[_0x146e('0x5e')]);}})[_0x146e('0x24')](respondWithResult(_0x2d6a24,null))[_0x146e('0x2e')](handleError(_0x2d6a24,null));};exports[_0x146e('0x72')]=function(_0x55714c,_0x3aa261,_0x44191d){var _0x2a0085={'raw':![],'where':{}};var _0x45b9fa={};var _0x5d7e21={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x146e('0x69')]({'where':{'id':_0x55714c['params']['id']}})['then'](handleEntityNotFound(_0x3aa261,null))[_0x146e('0x24')](function(_0x3f80be){if(_0x3f80be){_0x45b9fa[_0x146e('0x48')]=_[_0x146e('0x4a')](db['CannedAnswer'][_0x146e('0x44')]);_0x45b9fa[_0x146e('0x49')]=_[_0x146e('0x4a')](_0x55714c['query']);_0x45b9fa[_0x146e('0x4b')]=_[_0x146e('0x4c')](_0x45b9fa['model'],_0x45b9fa[_0x146e('0x49')]);_0x2a0085['attributes']=_['intersection'](_0x45b9fa[_0x146e('0x48')],qs['fields'](_0x55714c[_0x146e('0x49')]['fields']));_0x2a0085[_0x146e('0x4d')]=_0x2a0085['attributes'][_0x146e('0x5a')]?_0x2a0085[_0x146e('0x4d')]:_0x45b9fa[_0x146e('0x48')];if(!_0x55714c[_0x146e('0x49')]['hasOwnProperty'](_0x146e('0x6b'))){_0x2a0085[_0x146e('0x34')]=qs[_0x146e('0x34')](_0x55714c['query'][_0x146e('0x34')]);_0x2a0085[_0x146e('0x32')]=qs[_0x146e('0x32')](_0x55714c[_0x146e('0x49')][_0x146e('0x32')]);}_0x2a0085[_0x146e('0x50')]=qs[_0x146e('0x51')](_0x55714c['query']['sort']);_0x2a0085['where']=qs[_0x146e('0x4b')](_['pick'](_0x55714c['query'],_0x45b9fa[_0x146e('0x4b')]));_0x2a0085[_0x146e('0x53')][_0x146e('0x67')]=_0x3f80be['id'];if(_0x55714c[_0x146e('0x49')][_0x146e('0x52')]){_0x2a0085['where']=_[_0x146e('0x54')](_0x2a0085[_0x146e('0x53')],{'$or':_[_0x146e('0x42')](_0x2a0085[_0x146e('0x4d')],function(_0x2a8c55){var _0x346550={};_0x346550[_0x2a8c55]={'$like':'%'+_0x55714c[_0x146e('0x49')][_0x146e('0x52')]+'%'};return _0x346550;})});}_0x2a0085=_[_0x146e('0x54')]({},_0x2a0085,_0x55714c[_0x146e('0x5c')]);return db[_0x146e('0x71')][_0x146e('0x35')]({'where':_0x2a0085[_0x146e('0x53')]})[_0x146e('0x24')](function(_0x3fc328){_0x5d7e21['count']=_0x3fc328;if(_0x55714c['query'][_0x146e('0x5b')]){_0x2a0085[_0x146e('0x56')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2a0085);})[_0x146e('0x24')](function(_0x44e85e){_0x5d7e21[_0x146e('0x57')]=_0x44e85e;return _0x5d7e21;});}})[_0x146e('0x24')](respondWithFilteredResult(_0x3aa261,_0x2a0085))['catch'](handleError(_0x3aa261,null));};exports[_0x146e('0x73')]=function(_0xf6e508,_0x4034b4,_0x304a62){return db['OpenchannelAccount'][_0x146e('0x63')]({'where':{'id':_0xf6e508[_0x146e('0x59')]['id']}})[_0x146e('0x24')](handleEntityNotFound(_0x4034b4,null))[_0x146e('0x24')](function(_0x1188d0){if(_0x1188d0){return _0x1188d0['removeAnswers'](_0xf6e508[_0x146e('0x49')][_0x146e('0x6f')]);}})['then'](respondWithStatusCode(_0x4034b4,null))[_0x146e('0x2e')](handleError(_0x4034b4,null));};exports[_0x146e('0x74')]=function(_0x3117ac,_0x34122f,_0x249023){var _0x4612ef={'body':_0x3117ac[_0x146e('0x5e')],'channel':_0x146e('0x75')};var _0x1e8abc=[];var _0x2ef65f=[];var _0xdfcd00={};var _0x116638=![];return db[_0x146e('0x76')][_0x146e('0x66')]()[_0x146e('0x24')](function(_0x83b80){if(!_0x83b80){throw new db[(_0x146e('0x77'))]['ValidationError']('no\x20available\x20attributes');}_0x1e8abc=_['difference'](_[_0x146e('0x4a')](_0x83b80),[_0x146e('0x78'),_0x146e('0x79')]);_0x2ef65f=_[_0x146e('0x7a')](_[_0x146e('0x4a')](_0x83b80),['createdAt',_0x146e('0x79'),_0x146e('0x7b'),_0x146e('0x7c')]);if(_0x3117ac[_0x146e('0x5e')]['id']){delete _0x3117ac[_0x146e('0x5e')]['id'];}if(_[_0x146e('0x7d')](_0x3117ac[_0x146e('0x5e')][_0x146e('0x7e')])){throw new db[(_0x146e('0x77'))][(_0x146e('0x7f'))](_0x146e('0x80'));}if(_[_0x146e('0x7d')](_0x3117ac['body'][_0x146e('0x5e')])||_0x3117ac[_0x146e('0x5e')][_0x146e('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0x146e('0x81'));}if(_['isNil'](_0x3117ac['body'][_0x146e('0x82')])){throw new db['Sequelize'][(_0x146e('0x7f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ef65f);}if(!_[_0x146e('0x83')](_0x2ef65f,_0x3117ac[_0x146e('0x5e')][_0x146e('0x82')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ef65f);}_0xdfcd00[_0x3117ac[_0x146e('0x5e')][_0x146e('0x82')]]=_0x3117ac[_0x146e('0x5e')][_0x146e('0x7e')];})[_0x146e('0x24')](function(){return db[_0x146e('0x43')][_0x146e('0x63')]({'where':{'id':_0x3117ac['params']['id']},'include':[{'model':db[_0x146e('0x84')],'as':_0x146e('0x85'),'include':[{'model':db[_0x146e('0x76')],'as':_0x146e('0x86'),'where':_0xdfcd00,'limit':0x1,'order':[['updatedAt',_0x146e('0x87')]]}]},{'model':db[_0x146e('0x88')],'as':_0x146e('0x89')}]});})['then'](handleEntityNotFound(_0x34122f,null))[_0x146e('0x24')](function(_0x1f085b){if(_0x1f085b&&_0x1f085b['List']){_0x4612ef[_0x146e('0x8a')]=_0x1f085b;_0x4612ef['applications']=_0x1f085b['Applications'];_0x4612ef[_0x146e('0x8b')]=_0x1f085b[_0x146e('0x85')];_0x4612ef[_0x146e('0x8c')]=_[_0x146e('0x8d')](_0x4612ef[_0x146e('0x8c')],[_0x146e('0x8e')],[_0x146e('0x8f')]);if(_0x4612ef[_0x146e('0x8a')][_0x146e('0x89')]){delete _0x4612ef['account'][_0x146e('0x89')];}if(_0x4612ef['account']['List']&&_0x4612ef[_0x146e('0x8a')][_0x146e('0x85')][_0x146e('0x86')][_0x146e('0x5a')]){return _0x4612ef['account'][_0x146e('0x85')]['Contacts'][0x0];}var _0x16058a=_[_0x146e('0x1c')](_0x3117ac['body'],{'firstName':_0x3117ac[_0x146e('0x5e')][_0x146e('0x7e')],'ListId':_0x1f085b[_0x146e('0x7c')]});_0x16058a[_0x3117ac[_0x146e('0x5e')][_0x146e('0x82')]]=_0x3117ac[_0x146e('0x5e')]['from'];return db[_0x146e('0x76')]['create'](_0x16058a,{'fields':_0x1e8abc,'raw':!![]});}})[_0x146e('0x24')](handleEntityNotFound(_0x34122f,null))[_0x146e('0x24')](function(_0x1365ac){_0x4612ef[_0x146e('0x90')]=_0x1365ac;if(_0x1365ac){var _0x28d752={'ContactId':_0x1365ac['id'],'OpenchannelAccountId':_0x3117ac[_0x146e('0x59')]['id'],'from':(_0x1365ac['firstName']||'')+'\x20'+(_0x1365ac['lastName']||'')};var _0x55cfec={'OpenchannelAccountId':_0x3117ac[_0x146e('0x59')]['id'],'closed':![]};if(_0x3117ac['body']['threadId']){_0x55cfec[_0x146e('0x91')]=_0x3117ac[_0x146e('0x5e')]['threadId'];return db['OpenchannelInteraction'][_0x146e('0x63')]({'where':_0x55cfec})[_0x146e('0x24')](function(_0x58d7a2){if(_0x58d7a2){return[_0x58d7a2,![]];}_0x28d752[_0x146e('0x91')]=_0x3117ac[_0x146e('0x5e')][_0x146e('0x91')];_0x28d752[_0x146e('0x92')]=_0x3117ac[_0x146e('0x5e')][_0x146e('0x92')];return db[_0x146e('0x93')]['create'](_0x28d752)[_0x146e('0x24')](function(_0x4a38d5){return[_0x4a38d5,!![]];});});}else{_0x55cfec[_0x146e('0x91')]=null;}_0x55cfec['ContactId']=_0x1365ac['id'];return db[_0x146e('0x93')][_0x146e('0x63')]({'where':_0x55cfec})[_0x146e('0x24')](function(_0x44b227){if(_0x44b227){return[_0x44b227,![]];}return db['OpenchannelInteraction']['create'](_0x28d752)[_0x146e('0x24')](function(_0x18bb6e){return[_0x18bb6e,!![]];});});}})[_0x146e('0x94')](function(_0x2225e2,_0x370ecc){if(_0x2225e2){_0x116638=_0x370ecc;if(!_0x370ecc){var _0x63107b={'from':(_0x4612ef['contact']['firstName']||'')+'\x20'+(_0x4612ef[_0x146e('0x90')][_0x146e('0x95')]||'')};if(_0x3117ac[_0x146e('0x5e')][_0x146e('0x91')]&&_0x3117ac['body'][_0x146e('0x96')]&&_0x3117ac[_0x146e('0x5e')][_0x146e('0x91')]!=_0x3117ac[_0x146e('0x5e')][_0x146e('0x96')]){_0x63107b[_0x146e('0x91')]=_0x3117ac['body'][_0x146e('0x96')];}return _0x2225e2[_0x146e('0x39')](_0x63107b);}else{return _0x2225e2;}}})[_0x146e('0x24')](function(_0x2b2180){_0x4612ef['interaction']=_0x2b2180[_0x146e('0x3b')]({'plain':!![]});_0x4612ef['interaction'][_0x146e('0x97')]=_0x116638;if(_0x4612ef[_0x146e('0x98')][_0x146e('0x97')]){if(_0x4612ef[_0x146e('0x8a')]['autoclose']){_0x4612ef['applications'][_0x146e('0x99')]({'id':0x0,'priority':_0x4612ef[_0x146e('0x8c')][_0x146e('0x5a')]+0x1,'app':_0x146e('0x9a'),'appdata':_0x146e('0x9b'),'interval':'*,*,*,*'});}}return db[_0x146e('0x9c')]['create']({'body':_0x3117ac[_0x146e('0x5e')][_0x146e('0x5e')],'OpenchannelAccountId':_0x3117ac['params']['id'],'OpenchannelInteractionId':_0x2b2180['id'],'direction':'in','ContactId':_0x4612ef['contact']['id'],'AttachmentId':_0x3117ac['body']['AttachmentId']});})[_0x146e('0x24')](function(_0x2f18e0){_0x4612ef['message']=_0x2f18e0;if(!_0x4612ef['interaction'][_0x146e('0x9d')])return;return db[_0x146e('0x9e')]['find']({'attributes':['id',_0x146e('0x3f')],'where':{'id':_0x4612ef[_0x146e('0x98')]['UserId']}});})[_0x146e('0x24')](function(_0x1d6700){if(_0x1d6700){_0x4612ef[_0x146e('0x8c')][_0x146e('0x9f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1d6700[_0x146e('0x3f')]+','+(_0x4612ef['account'][_0x146e('0xa0')]||0xa),'interval':_0x146e('0xa1')});}if(!_0x4612ef[_0x146e('0x98')]['queueId'])return;return db[_0x146e('0xa2')][_0x146e('0x63')]({'attributes':['id',_0x146e('0x3f')],'where':{'id':_0x4612ef[_0x146e('0x98')][_0x146e('0xa3')]}});})[_0x146e('0x24')](function(_0x1fedb9){if(_0x1fedb9){_0x4612ef[_0x146e('0x8c')][_0x146e('0x9f')]({'id':0x0,'priority':0x1,'app':_0x146e('0xa4'),'appdata':_0x1fedb9[_0x146e('0x3f')]+','+(_0x4612ef['account'][_0x146e('0xa5')]||0x12c),'interval':_0x146e('0xa1')});}return respondWithRpcPromise(_0x146e('0xa6'),_0x146e('0xa7'),_0x4612ef);})[_0x146e('0x24')](function(_0x4eda1b){respondWithRpcPromise('EventManager',_0x146e('0xa8'),{'event':_0x146e('0x74'),'message':_0x4eda1b},client9002);return _0x4eda1b;})[_0x146e('0x24')](respondWithResult(_0x34122f,null))[_0x146e('0x2e')](handleError(_0x34122f,null));};exports[_0x146e('0xa9')]=function(_0x457f5c,_0x18e92c){var _0x3fb69a=_0x457f5c[_0x146e('0x59')]['id'];var _0x4e56fa=_0x457f5c[_0x146e('0x5e')];var _0x8b6c9=0xc8;var _0x592cd6=null;return db[_0x146e('0xaa')][_0x146e('0xab')]({'isolationLevel':db[_0x146e('0xaa')]['Transaction'][_0x146e('0xac')][_0x146e('0xad')]},function(_0x455daa){return db[_0x146e('0x43')][_0x146e('0x69')]({'where':{'id':_0x3fb69a},'transaction':_0x455daa})[_0x146e('0x24')](function(_0x33d5dd){if(_0x33d5dd){return db['OpenchannelApplication'][_0x146e('0x3a')]({'where':{'OpenchannelAccountId':_0x3fb69a},'transaction':_0x455daa})[_0x146e('0x24')](function(){var _0x3e7236=_[_0x146e('0x42')](_0x4e56fa,function(_0x5c637f){_0x5c637f[_0x146e('0x67')]=_0x3fb69a;return _0x5c637f;});return db[_0x146e('0x88')]['bulkCreate'](_0x3e7236,{'transaction':_0x455daa});});}else{_0x8b6c9=0x194;_0x592cd6=[];}});})[_0x146e('0x24')](function(){if(_0x8b6c9!==0x194){return db[_0x146e('0x88')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x3fb69a},'order':_0x146e('0x8e')})['then'](function(_0x599b16){_0x592cd6=_0x599b16;});}})[_0x146e('0x2e')](function(_0x4f2fae){_0x8b6c9=0x1f4;logger[_0x146e('0x2a')](_0x4f2fae[_0x146e('0x3e')]);if(_0x4f2fae[_0x146e('0x3f')]){delete _0x4f2fae[_0x146e('0x3f')];}_0x592cd6=_0x4f2fae;})[_0x146e('0xae')](function(){if(_0x592cd6===null){_0x18e92c[_0x146e('0x3d')](_0x8b6c9);}else{if(_0x8b6c9===0x1f4){_0x18e92c['status'](_0x8b6c9)['send'](_0x592cd6);}else{_0x18e92c[_0x146e('0x30')](_0x8b6c9)[_0x146e('0x31')](_0x592cd6);}}});};exports[_0x146e('0xaf')]=function(_0x502736,_0xbb6b1,_0x1c425e){var _0x3e0605={};var _0x2ccce2={};var _0x213099;var _0x373327;return db[_0x146e('0x43')][_0x146e('0x69')]({'where':{'id':_0x502736[_0x146e('0x59')]['id']}})['then'](handleEntityNotFound(_0xbb6b1,null))[_0x146e('0x24')](function(_0x5d766d){if(_0x5d766d){_0x213099=_0x5d766d;_0x2ccce2[_0x146e('0x48')]=_['keys'](db[_0x146e('0x88')]['rawAttributes']);_0x2ccce2[_0x146e('0x49')]=_[_0x146e('0x4a')](_0x502736[_0x146e('0x49')]);_0x2ccce2[_0x146e('0x4b')]=_[_0x146e('0x4c')](_0x2ccce2[_0x146e('0x48')],_0x2ccce2[_0x146e('0x49')]);_0x3e0605['attributes']=_[_0x146e('0x4c')](_0x2ccce2[_0x146e('0x48')],qs[_0x146e('0x4e')](_0x502736['query'][_0x146e('0x4e')]));_0x3e0605[_0x146e('0x4d')]=_0x3e0605[_0x146e('0x4d')][_0x146e('0x5a')]?_0x3e0605[_0x146e('0x4d')]:_0x2ccce2[_0x146e('0x48')];_0x3e0605[_0x146e('0x50')]=qs[_0x146e('0x51')](_0x502736[_0x146e('0x49')]['sort']);_0x3e0605['where']=qs[_0x146e('0x4b')](_['pick'](_0x502736['query'],_0x2ccce2[_0x146e('0x4b')]));if(_0x502736['query'][_0x146e('0x52')]){_0x3e0605[_0x146e('0x53')]=_['merge'](_0x3e0605['where'],{'$or':_[_0x146e('0x42')](_0x3e0605['attributes'],function(_0xa1e03c){var _0x235152={};_0x235152[_0xa1e03c]={'$like':'%'+_0x502736[_0x146e('0x49')][_0x146e('0x52')]+'%'};return _0x235152;})});}_0x3e0605=_[_0x146e('0x54')]({},_0x3e0605,_0x502736[_0x146e('0x5c')]);return _0x213099[_0x146e('0xaf')](_0x3e0605);}})[_0x146e('0x24')](function(_0x23d4ba){if(_0x23d4ba){_0x373327=_0x23d4ba[_0x146e('0x5a')];if(!_0x502736[_0x146e('0x49')][_0x146e('0x4f')]('nolimit')){_0x3e0605[_0x146e('0x34')]=qs['limit'](_0x502736[_0x146e('0x49')][_0x146e('0x34')]);_0x3e0605['offset']=qs[_0x146e('0x32')](_0x502736[_0x146e('0x49')]['offset']);}return _0x213099['getApplications'](_0x3e0605);}})[_0x146e('0x24')](function(_0x4a4330){if(_0x4a4330){return _0x4a4330?{'count':_0x373327,'rows':_0x4a4330}:null;}})[_0x146e('0x24')](respondWithResult(_0xbb6b1,null))[_0x146e('0x2e')](handleError(_0xbb6b1,null));};exports[_0x146e('0xb0')]=function(_0x2f534c,_0x12bcff,_0x8cdde6){var _0x55ca59={'raw':![],'where':{}};var _0x3ae0ce={};var _0x5cbe15={'count':0x0,'rows':[]};return db[_0x146e('0x43')][_0x146e('0x69')]({'where':{'id':_0x2f534c[_0x146e('0x59')]['id']}})['then'](handleEntityNotFound(_0x12bcff,null))[_0x146e('0x24')](function(_0xfb5cc8){if(_0xfb5cc8){_0x3ae0ce[_0x146e('0x48')]=_[_0x146e('0x4a')](db[_0x146e('0x93')]['rawAttributes']);_0x3ae0ce[_0x146e('0x49')]=_['keys'](_0x2f534c[_0x146e('0x49')]);_0x3ae0ce['filters']=_[_0x146e('0x4c')](_0x3ae0ce[_0x146e('0x48')],_0x3ae0ce[_0x146e('0x49')]);_0x55ca59[_0x146e('0x4d')]=_[_0x146e('0x4c')](_0x3ae0ce[_0x146e('0x48')],qs[_0x146e('0x4e')](_0x2f534c[_0x146e('0x49')][_0x146e('0x4e')]));_0x55ca59['attributes']=_0x55ca59['attributes'][_0x146e('0x5a')]?_0x55ca59['attributes']:_0x3ae0ce[_0x146e('0x48')];if(!_0x2f534c[_0x146e('0x49')][_0x146e('0x4f')](_0x146e('0x6b'))){_0x55ca59[_0x146e('0x34')]=qs['limit'](_0x2f534c[_0x146e('0x49')]['limit']);_0x55ca59['offset']=qs[_0x146e('0x32')](_0x2f534c[_0x146e('0x49')][_0x146e('0x32')]);}_0x55ca59['order']=qs[_0x146e('0x51')](_0x2f534c[_0x146e('0x49')]['sort']);_0x55ca59[_0x146e('0x53')]=qs[_0x146e('0x4b')](_[_0x146e('0x6c')](_0x2f534c[_0x146e('0x49')],_0x3ae0ce['filters']));_0x55ca59[_0x146e('0x53')][_0x146e('0x67')]=_0xfb5cc8['id'];if(_0x2f534c['query'][_0x146e('0x52')]){_0x55ca59[_0x146e('0x53')]=_[_0x146e('0x54')](_0x55ca59[_0x146e('0x53')],{'$or':_[_0x146e('0x42')](_0x55ca59[_0x146e('0x4d')],function(_0x44ee36){var _0x3f0ac0={};_0x3f0ac0[_0x44ee36]={'$like':'%'+_0x2f534c['query']['filter']+'%'};return _0x3f0ac0;})});}_0x55ca59=_[_0x146e('0x54')]({},_0x55ca59,_0x2f534c['options']);return db[_0x146e('0x93')][_0x146e('0x35')]({'where':_0x55ca59[_0x146e('0x53')]})[_0x146e('0x24')](function(_0x11f5b7){_0x5cbe15['count']=_0x11f5b7;if(_0x2f534c[_0x146e('0x49')][_0x146e('0x5b')]){_0x55ca59[_0x146e('0x56')]=[{'model':db[_0x146e('0x76')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x146e('0xb1'),'attributes':['name',_0x146e('0xb2'),_0x146e('0xb3')],'required':![]},{'model':db['Tag'],'as':_0x146e('0xb4'),'attributes':['id','name',_0x146e('0xb5')],'where':_0x2f534c[_0x146e('0x49')][_0x146e('0xb6')]?{'id':_0x2f534c[_0x146e('0x49')]['tag']}:undefined,'required':_0x2f534c[_0x146e('0x49')]['tag']?!![]:![]}];}return db[_0x146e('0x93')]['findAll'](_0x55ca59);})['then'](function(_0x2159e1){_0x5cbe15['rows']=_0x2159e1;return _0x5cbe15;});}})[_0x146e('0x24')](respondWithFilteredResult(_0x12bcff,_0x55ca59))[_0x146e('0x2e')](handleError(_0x12bcff,null));};exports['addAgents']=function(_0x3e60a8,_0x13d031,_0x1924bd){return db[_0x146e('0x43')][_0x146e('0x63')]({'where':{'id':_0x3e60a8['params']['id']}})[_0x146e('0x24')](handleEntityNotFound(_0x13d031,null))[_0x146e('0x24')](function(_0x5bcdfd){if(_0x5bcdfd){return _0x5bcdfd[_0x146e('0xb7')](_0x3e60a8['body']['ids'],_['omit'](_0x3e60a8[_0x146e('0x5e')],[_0x146e('0x6f'),'id'])||{})[_0x146e('0x94')](function(_0x47ae68){for(var _0x19cd51=0x0;_0x19cd51<_0x3e60a8['body'][_0x146e('0x6f')]['length'];_0x19cd51+=0x1){socket[_0x146e('0xb8')](_0x146e('0xb9'),{'UserId':Number(_0x3e60a8[_0x146e('0x5e')][_0x146e('0x6f')][_0x19cd51]),'OpenchannelAccountId':Number(_0x3e60a8[_0x146e('0x59')]['id'])});}return _0x47ae68;});}})[_0x146e('0x24')](respondWithResult(_0x13d031,null))[_0x146e('0x2e')](handleError(_0x13d031,null));};exports[_0x146e('0xba')]=function(_0x35e55d,_0x2cf934,_0x3ecd15){return db['OpenchannelAccount'][_0x146e('0x63')]({'where':{'id':_0x35e55d['params']['id']}})[_0x146e('0x24')](handleEntityNotFound(_0x2cf934,null))[_0x146e('0x24')](function(_0x3d45a6){if(_0x3d45a6){return _0x3d45a6[_0x146e('0xba')](_0x35e55d[_0x146e('0x49')][_0x146e('0x6f')])[_0x146e('0x24')](function(){if(_['isArray'](_0x35e55d[_0x146e('0x49')][_0x146e('0x6f')])){for(var _0x1ef106=0x0;_0x1ef106<_0x35e55d[_0x146e('0x49')][_0x146e('0x6f')][_0x146e('0x5a')];_0x1ef106+=0x1){socket['emit'](_0x146e('0xbb'),{'UserId':Number(_0x35e55d['query'][_0x146e('0x6f')][_0x1ef106]),'OpenchannelAccountId':Number(_0x35e55d[_0x146e('0x59')]['id'])});}}else{socket[_0x146e('0xb8')](_0x146e('0xbb'),{'UserId':Number(_0x35e55d[_0x146e('0x49')]['ids']),'OpenchannelAccountId':Number(_0x35e55d[_0x146e('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x2cf934,null))[_0x146e('0x2e')](handleError(_0x2cf934,null));};exports['getAgents']=function(_0x2e5f79,_0x5c0c08,_0x1d99e2){var _0x56fefa={};var _0x85d5a9={};var _0x21a9e7;var _0x510813;return db['OpenchannelAccount'][_0x146e('0x69')]({'where':{'id':_0x2e5f79[_0x146e('0x59')]['id']}})[_0x146e('0x24')](handleEntityNotFound(_0x5c0c08,null))[_0x146e('0x24')](function(_0xeeaa0f){if(_0xeeaa0f){_0x21a9e7=_0xeeaa0f;_0x85d5a9['model']=_[_0x146e('0x4a')](db['User'][_0x146e('0x44')]);_0x85d5a9[_0x146e('0x49')]=_[_0x146e('0x4a')](_0x2e5f79['query']);_0x85d5a9[_0x146e('0x4b')]=_[_0x146e('0x4c')](_0x85d5a9[_0x146e('0x48')],_0x85d5a9[_0x146e('0x49')]);_0x56fefa[_0x146e('0x4d')]=_[_0x146e('0x4c')](_0x85d5a9[_0x146e('0x48')],qs[_0x146e('0x4e')](_0x2e5f79[_0x146e('0x49')]['fields']));_0x56fefa['attributes']=_0x56fefa[_0x146e('0x4d')][_0x146e('0x5a')]?_0x56fefa[_0x146e('0x4d')]:_0x85d5a9[_0x146e('0x48')];_0x56fefa[_0x146e('0x50')]=qs[_0x146e('0x51')](_0x2e5f79[_0x146e('0x49')]['sort']);_0x56fefa[_0x146e('0x53')]=qs[_0x146e('0x4b')](_[_0x146e('0x6c')](_0x2e5f79[_0x146e('0x49')],_0x85d5a9['filters']));if(_0x2e5f79[_0x146e('0x49')]['filter']){_0x56fefa[_0x146e('0x53')]=_[_0x146e('0x54')](_0x56fefa[_0x146e('0x53')],{'$or':_[_0x146e('0x42')](_0x56fefa[_0x146e('0x4d')],function(_0x4dd2e6){var _0x532e0e={};_0x532e0e[_0x4dd2e6]={'$like':'%'+_0x2e5f79['query']['filter']+'%'};return _0x532e0e;})});}_0x56fefa=_[_0x146e('0x54')]({},_0x56fefa,_0x2e5f79['options']);return _0x21a9e7[_0x146e('0xbc')](_0x56fefa);}})[_0x146e('0x24')](function(_0x5906db){if(_0x5906db){_0x510813=_0x5906db['length'];if(!_0x2e5f79[_0x146e('0x49')][_0x146e('0x4f')](_0x146e('0x6b'))){_0x56fefa[_0x146e('0x34')]=qs[_0x146e('0x34')](_0x2e5f79[_0x146e('0x49')][_0x146e('0x34')]);_0x56fefa[_0x146e('0x32')]=qs[_0x146e('0x32')](_0x2e5f79[_0x146e('0x49')][_0x146e('0x32')]);}return _0x21a9e7[_0x146e('0xbc')](_0x56fefa);}})[_0x146e('0x24')](function(_0x2285f2){if(_0x2285f2){return _0x2285f2?{'count':_0x510813,'rows':_0x2285f2}:null;}})['then'](respondWithResult(_0x5c0c08,null))[_0x146e('0x2e')](handleError(_0x5c0c08,null));};exports[_0x146e('0xbd')]=function(_0x1cc57f,_0x318c63,_0x18d32d){var _0x568da4,_0x117bbd,_0x4b74ed;if(_[_0x146e('0x7d')](_0x1cc57f[_0x146e('0x5e')]['body'])||_0x1cc57f[_0x146e('0x5e')][_0x146e('0x5e')]===''){throw new db[(_0x146e('0x77'))][(_0x146e('0x7f'))](_0x146e('0x81'));}if(_[_0x146e('0x7d')](_0x1cc57f[_0x146e('0x5e')]['to'])){}_0x568da4=_0x1cc57f[_0x146e('0x5e')]['to'];return db[_0x146e('0x43')]['findOne']({'where':{'id':_0x1cc57f['params']['id']}})['then'](handleEntityNotFound(_0x318c63,null))[_0x146e('0x24')](function(_0x8f1973){if(_0x8f1973){return db['OpenchannelAccount'][_0x146e('0x63')]({'where':{'id':_0x8f1973['id']},'include':[{'model':db[_0x146e('0x84')],'as':_0x146e('0x85'),'include':[{'model':db[_0x146e('0x76')],'as':_0x146e('0x86'),'where':{[_0x8f1973[_0x146e('0x82')]]:_0x568da4},'limit':0x1,'order':[[_0x146e('0x79'),_0x146e('0x87')]]}]}]})[_0x146e('0x24')](handleEntityNotFound(_0x318c63,null))[_0x146e('0x24')](function(_0x3a9037){if(_0x3a9037&&_0x3a9037[_0x146e('0x85')]){_0x117bbd=_0x3a9037[_0x146e('0x3b')]({'plain':!![]});if(_0x117bbd['List']&&_0x117bbd['List']['Contacts'][_0x146e('0x5a')]){return _0x117bbd[_0x146e('0x85')]['Contacts'][0x0];}return db[_0x146e('0x76')][_0x146e('0x5d')](_[_0x146e('0x1c')](_0x1cc57f['body'],{'firstName':_0x568da4,[_0x3a9037['mapKey']]:_0x568da4,'phone':_0x568da4,'ListId':_0x117bbd[_0x146e('0x7c')]}));}})[_0x146e('0x24')](handleEntityNotFound(_0x318c63,null))[_0x146e('0x24')](function(_0x45fc85){if(_0x45fc85){_0x4b74ed=_0x45fc85;return db[_0x146e('0x93')][_0x146e('0x63')]({'where':{'ContactId':_0x4b74ed['id'],'closed':![],'OpenchannelAccountId':_0x117bbd['id']}})[_0x146e('0x24')](function(_0x1463dd){if(_0x1463dd){return[_0x1463dd,![]];}return db[_0x146e('0x93')][_0x146e('0x5d')]({'UserId':_0x1cc57f[_0x146e('0x61')]['id'],'ContactId':_0x4b74ed['id'],'OpenchannelAccountId':_0x117bbd['id'],'lastMsgDirection':_0x146e('0xbe'),'firstMsgDirection':_0x146e('0xbe'),'Messages':[_['merge'](_0x1cc57f[_0x146e('0x5e')],{'read':![],'body':_0x1cc57f['body']['body'],'OpenchannelAccountId':_0x117bbd['id'],'UserId':_0x1cc57f[_0x146e('0x61')]['id'],'ContactId':_0x4b74ed['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x146e('0x24')](function(_0x16ac0b){return[_0x16ac0b,!![]];});});}})[_0x146e('0x94')](function(_0x48128e,_0x433d5b){if(_0x433d5b){return _0x48128e;}return db[_0x146e('0x9c')]['create'](_[_0x146e('0x54')](_0x1cc57f[_0x146e('0x5e')],{'read':![],'body':_0x1cc57f[_0x146e('0x5e')]['body'],'OpenchannelAccountId':_0x117bbd['id'],'OpenchannelInteractionId':_0x48128e['id'],'UserId':_0x1cc57f[_0x146e('0x61')]['id'],'ContactId':_0x4b74ed['id']}))[_0x146e('0x24')](function(_0x38eb2a){_0x48128e[_0x146e('0xbf')]['Messages']=[];_0x48128e[_0x146e('0xbf')][_0x146e('0xc0')][_0x146e('0x99')](_0x38eb2a[_0x146e('0xbf')]);return _0x48128e;});});}})['then'](respondWithResult(_0x318c63,null))[_0x146e('0x2e')](handleError(_0x318c63,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 818eeb8..b47df62 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 _0xec56=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0xe5b3e1,_0x57a645){var _0x121dad=function(_0x3aa300){while(--_0x3aa300){_0xe5b3e1['push'](_0xe5b3e1['shift']());}};_0x121dad(++_0x57a645);}(_0xec56,0x1bd));var _0x6ec5=function(_0x299576,_0x5360de){_0x299576=_0x299576-0x0;var _0x3c48d2=_0xec56[_0x299576];return _0x3c48d2;};'use strict';var EventEmitter=require(_0x6ec5('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6ec5('0x1')](0x0);var events={'afterCreate':_0x6ec5('0x2'),'afterUpdate':_0x6ec5('0x3'),'afterDestroy':_0x6ec5('0x4')};function emitEvent(_0x43c2cd){return function(_0x399441,_0x469679,_0x173aeb){OpenchannelAccountEvents[_0x6ec5('0x5')](_0x43c2cd+':'+_0x399441['id'],_0x399441);OpenchannelAccountEvents[_0x6ec5('0x5')](_0x43c2cd,_0x399441);_0x173aeb(null);};}for(var e in events){if(events[_0x6ec5('0x6')](e)){var event=events[e];OpenchannelAccount[_0x6ec5('0x7')](e,emitEvent(event));}}module[_0x6ec5('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x91a7=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x91a7,0xe7));var _0x791a=function(_0x2ffd40,_0x66e6e){_0x2ffd40=_0x2ffd40-0x0;var _0x2d13b2=_0x91a7[_0x2ffd40];return _0x2d13b2;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x791a('0x0'))['db'][_0x791a('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x791a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x791a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6392){return function(_0x535640,_0x50ab29,_0x32fe2b){OpenchannelAccountEvents[_0x791a('0x4')](_0x2f6392+':'+_0x535640['id'],_0x535640);OpenchannelAccountEvents['emit'](_0x2f6392,_0x535640);_0x32fe2b(null);};}for(var e in events){if(events[_0x791a('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x791a('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8896140..e6a322d 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(_0x200a20,_0x4fa7a4){var _0x491d6c=function(_0x20d1c9){while(--_0x20d1c9){_0x200a20['push'](_0x200a20['shift']());}};_0x491d6c(++_0x4fa7a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x3e9cd4,_0x3b9cac){var _0x464402=function(_0x267f18){while(--_0x267f18){_0x3e9cd4['push'](_0x3e9cd4['shift']());}};_0x464402(++_0x3b9cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 d473d93..259b7ce 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 _0x7072=['localhost','socket.io-emitter','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x46cf86,_0x4eba3e){var _0x443601=function(_0x206b07){while(--_0x206b07){_0x46cf86['push'](_0x46cf86['shift']());}};_0x443601(++_0x4eba3e);}(_0x7072,0x138));var _0x2707=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x7072[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});config[_0x2707('0xa')]=_[_0x2707('0xb')](config[_0x2707('0xa')],{'host':_0x2707('0xc'),'port':0x18eb});var socket=require(_0x2707('0xd'))(new Redis(config[_0x2707('0xa')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x380339,_0x179cef,_0x379ac5){return new BPromise(function(_0x56406b,_0x30090e){return client[_0x2707('0xe')](_0x380339,_0x379ac5)[_0x2707('0xf')](function(_0x19881c){logger[_0x2707('0x10')](_0x2707('0x11'),_0x179cef,_0x2707('0x12'));logger[_0x2707('0x13')](_0x2707('0x14'),_0x179cef,'request\x20sent',JSON[_0x2707('0x15')](_0x19881c));if(_0x19881c['error']){if(_0x19881c[_0x2707('0x16')][_0x2707('0x17')]===0x1f4){logger[_0x2707('0x16')](_0x2707('0x11'),_0x179cef,_0x19881c[_0x2707('0x16')]['message']);return _0x30090e(_0x19881c[_0x2707('0x16')][_0x2707('0x18')]);}logger[_0x2707('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x179cef,_0x19881c[_0x2707('0x16')][_0x2707('0x18')]);return _0x56406b(_0x19881c[_0x2707('0x16')][_0x2707('0x18')]);}else{logger[_0x2707('0x10')](_0x2707('0x11'),_0x179cef,'request\x20sent');_0x56406b(_0x19881c[_0x2707('0x19')][_0x2707('0x18')]);}})[_0x2707('0x1a')](function(_0x518262){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x179cef,_0x518262);_0x30090e(_0x518262);});});} \ No newline at end of file +var _0x2884=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x515d8d,_0x5a7b53){var _0x296990=function(_0x172593){while(--_0x172593){_0x515d8d['push'](_0x515d8d['shift']());}};_0x296990(++_0x5a7b53);}(_0x2884,0x1eb));var _0x4288=function(_0x11bf38,_0x213d7f){_0x11bf38=_0x11bf38-0x0;var _0x202699=_0x2884[_0x11bf38];return _0x202699;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4288('0x9')](config['redis'],{'host':_0x4288('0xa'),'port':0x18eb});var socket=require(_0x4288('0xb'))(new Redis(config['redis']));require(_0x4288('0xc'))[_0x4288('0xd')](socket);function respondWithRpcPromise(_0x41794a,_0x55c9ee,_0x55a4f7){return new BPromise(function(_0x5c0e2d,_0x42a234){return client[_0x4288('0xe')](_0x41794a,_0x55a4f7)[_0x4288('0xf')](function(_0x2445eb){logger[_0x4288('0x10')](_0x4288('0x11'),_0x55c9ee,'request\x20sent');logger[_0x4288('0x12')](_0x4288('0x13'),_0x55c9ee,_0x4288('0x14'),JSON[_0x4288('0x15')](_0x2445eb));if(_0x2445eb['error']){if(_0x2445eb[_0x4288('0x16')][_0x4288('0x17')]===0x1f4){logger['error'](_0x4288('0x11'),_0x55c9ee,_0x2445eb['error'][_0x4288('0x18')]);return _0x42a234(_0x2445eb['error'][_0x4288('0x18')]);}logger[_0x4288('0x16')](_0x4288('0x11'),_0x55c9ee,_0x2445eb[_0x4288('0x16')][_0x4288('0x18')]);return _0x5c0e2d(_0x2445eb[_0x4288('0x16')][_0x4288('0x18')]);}else{logger[_0x4288('0x10')](_0x4288('0x11'),_0x55c9ee,'request\x20sent');_0x5c0e2d(_0x2445eb[_0x4288('0x19')][_0x4288('0x18')]);}})['catch'](function(_0x479d52){logger['error'](_0x4288('0x11'),_0x55c9ee,_0x479d52);_0x42a234(_0x479d52);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5cc77ea..7ac72b0 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 _0x09dd=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x09dd,0x81));var _0xd09d=function(_0x1541c6,_0x170408){_0x1541c6=_0x1541c6-0x0;var _0x41901b=_0x09dd[_0x1541c6];return _0x41901b;};'use strict';var OpenchannelAccountEvents=require(_0xd09d('0x0'));var events=[_0xd09d('0x1'),_0xd09d('0x2'),_0xd09d('0x3')];function createListener(_0x45dad5,_0x2a77ce){return function(_0x28a63a){_0x2a77ce[_0xd09d('0x4')](_0x45dad5,_0x28a63a);};}function removeListener(_0x44faf7,_0x3e1b57){return function(){OpenchannelAccountEvents[_0xd09d('0x5')](_0x44faf7,_0x3e1b57);};}exports[_0xd09d('0x6')]=function(_0x3410c4){for(var _0x2034af=0x0,_0x5621cf=events[_0xd09d('0x7')];_0x2034af<_0x5621cf;_0x2034af++){var _0x1fce72=events[_0x2034af];var _0x3e062b=createListener(_0xd09d('0x8')+_0x1fce72,_0x3410c4);OpenchannelAccountEvents['on'](_0x1fce72,_0x3e062b);}}; \ No newline at end of file +var _0xbed7=['removeListener','register','./openchannelAccount.events','save','remove','update','emit'];(function(_0x4f3e6e,_0x1cdd78){var _0x32e729=function(_0x243c7f){while(--_0x243c7f){_0x4f3e6e['push'](_0x4f3e6e['shift']());}};_0x32e729(++_0x1cdd78);}(_0xbed7,0x14b));var _0x7bed=function(_0x3d5a5b,_0x2f9397){_0x3d5a5b=_0x3d5a5b-0x0;var _0x318dfc=_0xbed7[_0x3d5a5b];return _0x318dfc;};'use strict';var OpenchannelAccountEvents=require(_0x7bed('0x0'));var events=[_0x7bed('0x1'),_0x7bed('0x2'),_0x7bed('0x3')];function createListener(_0x3c9a9f,_0x47b9cb){return function(_0x44da5a){_0x47b9cb[_0x7bed('0x4')](_0x3c9a9f,_0x44da5a);};}function removeListener(_0x1da710,_0x18c2c7){return function(){OpenchannelAccountEvents[_0x7bed('0x5')](_0x1da710,_0x18c2c7);};}exports[_0x7bed('0x6')]=function(_0x41c148){for(var _0x3aa0e9=0x0,_0x38a818=events['length'];_0x3aa0e9<_0x38a818;_0x3aa0e9++){var _0x27434d=events[_0x3aa0e9];var _0x27f7d9=createListener('openchannelAccount:'+_0x27434d,_0x41c148);OpenchannelAccountEvents['on'](_0x27434d,_0x27f7d9);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3e98a7d..9998a06 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 _0xefed=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','update','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefed,0x165));var _0xdefe=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0xefed[_0x314a8c];return _0x1d4607;};'use strict';var multer=require(_0xdefe('0x0'));var util=require(_0xdefe('0x1'));var path=require('path');var timeout=require(_0xdefe('0x2'));var express=require(_0xdefe('0x3'));var router=express[_0xdefe('0x4')]();var fs_extra=require(_0xdefe('0x5'));var auth=require(_0xdefe('0x6'));var interaction=require(_0xdefe('0x7'));var config=require('../../config/environment');var controller=require(_0xdefe('0x8'));router[_0xdefe('0x9')]('/',auth[_0xdefe('0xa')](),controller['index']);router[_0xdefe('0x9')](_0xdefe('0xb'),auth['isAuthenticated'](),controller[_0xdefe('0xc')]);router[_0xdefe('0xd')]('/',auth[_0xdefe('0xa')](),controller['create']);router['put'](_0xdefe('0xb'),auth[_0xdefe('0xa')](),controller[_0xdefe('0xe')]);router['delete'](_0xdefe('0xb'),auth[_0xdefe('0xa')](),controller[_0xdefe('0xf')]);module[_0xdefe('0x10')]=router; \ No newline at end of file +var _0xe02e=['isAuthenticated','index','/:id','show','post','create','put','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x46d642,_0x3a0bed){var _0x3a56b2=function(_0xf0aa76){while(--_0xf0aa76){_0x46d642['push'](_0x46d642['shift']());}};_0x3a56b2(++_0x3a0bed);}(_0xe02e,0x1b1));var _0xee02=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe02e[_0x28947d];return _0x12d2ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee02('0x0'));var timeout=require(_0xee02('0x1'));var express=require(_0xee02('0x2'));var router=express[_0xee02('0x3')]();var fs_extra=require(_0xee02('0x4'));var auth=require(_0xee02('0x5'));var interaction=require(_0xee02('0x6'));var config=require(_0xee02('0x7'));var controller=require('./openchannelApplication.controller');router[_0xee02('0x8')]('/',auth[_0xee02('0x9')](),controller[_0xee02('0xa')]);router['get'](_0xee02('0xb'),auth[_0xee02('0x9')](),controller[_0xee02('0xc')]);router[_0xee02('0xd')]('/',auth['isAuthenticated'](),controller[_0xee02('0xe')]);router[_0xee02('0xf')](_0xee02('0xb'),auth[_0xee02('0x9')](),controller['update']);router['delete'](_0xee02('0xb'),auth[_0xee02('0x9')](),controller[_0xee02('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 5c58adc..f2d6ec9 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 _0x4c7e=['exports','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4c7e,0xe6));var _0xe4c7=function(_0x5c9317,_0x38bba4){_0x5c9317=_0x5c9317-0x0;var _0x50ccb4=_0x4c7e[_0x5c9317];return _0x50ccb4;};'use strict';var Sequelize=require('sequelize');module[_0xe4c7('0x0')]={'priority':{'type':Sequelize[_0xe4c7('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe4c7('0x2')]()},'description':{'type':Sequelize[_0xe4c7('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe4c7('0x4')}}; \ No newline at end of file +var _0x7cbf=['INTEGER','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x1b4b3c,_0x508734){var _0x343c17=function(_0x1c3d5b){while(--_0x1c3d5b){_0x1b4b3c['push'](_0x1b4b3c['shift']());}};_0x343c17(++_0x508734);}(_0x7cbf,0xbe));var _0xf7cb=function(_0x5ae6f0,_0x3bfd6d){_0x5ae6f0=_0x5ae6f0-0x0;var _0x4095c6=_0x7cbf[_0x5ae6f0];return _0x4095c6;};'use strict';var Sequelize=require(_0xf7cb('0x0'));module[_0xf7cb('0x1')]={'priority':{'type':Sequelize[_0xf7cb('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf7cb('0x3')]()},'description':{'type':Sequelize[_0xf7cb('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf7cb('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a7b4635..f2bfffb 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 _0xc382=['api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x13ff4f,_0x4defc2){var _0xd04dee=function(_0x516beb){while(--_0x516beb){_0x13ff4f['push'](_0x13ff4f['shift']());}};_0xd04dee(++_0x4defc2);}(_0xc382,0x11e));var _0x2c38=function(_0x34cbbf,_0x540ce2){_0x34cbbf=_0x34cbbf-0x0;var _0x3ec76e=_0xc382[_0x34cbbf];return _0x3ec76e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c38('0x0'));var zipdir=require(_0x2c38('0x1'));var jsonpatch=require(_0x2c38('0x2'));var rp=require('request-promise');var moment=require(_0x2c38('0x3'));var BPromise=require(_0x2c38('0x4'));var Mustache=require(_0x2c38('0x5'));var util=require(_0x2c38('0x6'));var path=require(_0x2c38('0x7'));var sox=require(_0x2c38('0x8'));var csv=require(_0x2c38('0x9'));var ejs=require(_0x2c38('0xa'));var fs=require('fs');var fs_extra=require(_0x2c38('0xb'));var _=require('lodash');var squel=require(_0x2c38('0xc'));var crypto=require(_0x2c38('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2c38('0xe'));var toCsv=require(_0x2c38('0x9'));var querystring=require(_0x2c38('0xf'));var Papa=require(_0x2c38('0x10'));var Redis=require(_0x2c38('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2c38('0x12'));var as=require(_0x2c38('0x13'));var hardwareService=require(_0x2c38('0x14'));var logger=require(_0x2c38('0x15'))(_0x2c38('0x16'));var utils=require(_0x2c38('0x17'));var config=require(_0x2c38('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x336b4b,_0x7ff21b){_0x7ff21b=_0x7ff21b||0xcc;return function(_0x44e9b3){if(_0x44e9b3){return _0x336b4b[_0x2c38('0x19')](_0x7ff21b);}return _0x336b4b[_0x2c38('0x1a')](_0x7ff21b)[_0x2c38('0x1b')]();};}function respondWithResult(_0x296515,_0x24be51){_0x24be51=_0x24be51||0xc8;return function(_0xf0d505){if(_0xf0d505){return _0x296515[_0x2c38('0x1a')](_0x24be51)['json'](_0xf0d505);}};}function respondWithFilteredResult(_0x196855,_0x51988d){return function(_0xa0e6b8){if(_0xa0e6b8){var _0x46da25=typeof _0x51988d[_0x2c38('0x1c')]===_0x2c38('0x1d')&&typeof _0x51988d[_0x2c38('0x1e')]===_0x2c38('0x1d');var _0x2e899d=_0xa0e6b8[_0x2c38('0x1f')];var _0x193730=_0x46da25?0x0:_0x51988d[_0x2c38('0x1c')];var _0x1a5ce3=_0x46da25?_0xa0e6b8[_0x2c38('0x1f')]:_0x51988d[_0x2c38('0x1c')]+_0x51988d[_0x2c38('0x1e')];var _0x168556;if(_0x1a5ce3>=_0x2e899d){_0x1a5ce3=_0x2e899d;_0x168556=0xc8;}else{_0x168556=0xce;}_0x196855[_0x2c38('0x1a')](_0x168556);return _0x196855[_0x2c38('0x20')](_0x2c38('0x21'),_0x193730+'-'+_0x1a5ce3+'/'+_0x2e899d)['json'](_0xa0e6b8);}return null;};}function patchUpdates(_0x574f76){return function(_0x3c60c8){try{jsonpatch[_0x2c38('0x22')](_0x3c60c8,_0x574f76,!![]);}catch(_0x1ef117){return BPromise['reject'](_0x1ef117);}return _0x3c60c8[_0x2c38('0x23')]();};}function saveUpdates(_0x1f2837,_0x44aff1){return function(_0x294377){if(_0x294377){return _0x294377['update'](_0x1f2837)[_0x2c38('0x24')](function(_0x14cded){return _0x14cded;});}return null;};}function removeEntity(_0xb71b5b,_0x151e36){return function(_0x3d63f4){if(_0x3d63f4){return _0x3d63f4[_0x2c38('0x25')]()[_0x2c38('0x24')](function(){_0xb71b5b[_0x2c38('0x1a')](0xcc)[_0x2c38('0x1b')]();});}};}function handleEntityNotFound(_0x26314e,_0x4b3d53){return function(_0xc905b1){if(!_0xc905b1){_0x26314e[_0x2c38('0x19')](0x194);}return _0xc905b1;};}function handleError(_0xcc4c28,_0x2a0120){_0x2a0120=_0x2a0120||0x1f4;return function(_0x58e410){logger[_0x2c38('0x26')](_0x58e410[_0x2c38('0x27')]);if(_0x58e410[_0x2c38('0x28')]){delete _0x58e410[_0x2c38('0x28')];}_0xcc4c28[_0x2c38('0x1a')](_0x2a0120)[_0x2c38('0x29')](_0x58e410);};}exports[_0x2c38('0x2a')]=function(_0x5791a7,_0x1f2895){var _0x47afdf={},_0x3e6d9f={},_0x156acd={'count':0x0,'rows':[]};var _0x2edab0=_[_0x2c38('0x2b')](db[_0x2c38('0x2c')][_0x2c38('0x2d')],function(_0x587703){return{'name':_0x587703[_0x2c38('0x2e')],'type':_0x587703[_0x2c38('0x2f')][_0x2c38('0x30')]};});_0x3e6d9f[_0x2c38('0x31')]=_[_0x2c38('0x2b')](_0x2edab0,_0x2c38('0x28'));_0x3e6d9f[_0x2c38('0x32')]=_[_0x2c38('0x33')](_0x5791a7[_0x2c38('0x32')]);_0x3e6d9f[_0x2c38('0x34')]=_[_0x2c38('0x35')](_0x3e6d9f[_0x2c38('0x31')],_0x3e6d9f['query']);_0x47afdf[_0x2c38('0x36')]=_[_0x2c38('0x35')](_0x3e6d9f['model'],qs['fields'](_0x5791a7[_0x2c38('0x32')][_0x2c38('0x37')]));_0x47afdf[_0x2c38('0x36')]=_0x47afdf['attributes'][_0x2c38('0x38')]?_0x47afdf[_0x2c38('0x36')]:_0x3e6d9f[_0x2c38('0x31')];if(!_0x5791a7['query'][_0x2c38('0x39')](_0x2c38('0x3a'))){_0x47afdf[_0x2c38('0x1e')]=qs[_0x2c38('0x1e')](_0x5791a7[_0x2c38('0x32')][_0x2c38('0x1e')]);_0x47afdf[_0x2c38('0x1c')]=qs['offset'](_0x5791a7['query'][_0x2c38('0x1c')]);}_0x47afdf[_0x2c38('0x3b')]=qs['sort'](_0x5791a7[_0x2c38('0x32')][_0x2c38('0x3c')]);_0x47afdf[_0x2c38('0x3d')]=qs[_0x2c38('0x34')](_[_0x2c38('0x3e')](_0x5791a7[_0x2c38('0x32')],_0x3e6d9f[_0x2c38('0x34')]),_0x2edab0);if(_0x5791a7['query'][_0x2c38('0x3f')]){_0x47afdf['where']=_['merge'](_0x47afdf[_0x2c38('0x3d')],{'$or':_[_0x2c38('0x2b')](_0x2edab0,function(_0x515f24){if(_0x515f24[_0x2c38('0x2f')]!==_0x2c38('0x40')){var _0x149b10={};_0x149b10[_0x515f24[_0x2c38('0x28')]]={'$like':'%'+_0x5791a7[_0x2c38('0x32')]['filter']+'%'};return _0x149b10;}})});}_0x47afdf=_[_0x2c38('0x41')]({},_0x47afdf,_0x5791a7[_0x2c38('0x42')]);var _0x2d058d={'where':_0x47afdf[_0x2c38('0x3d')]};return db[_0x2c38('0x2c')][_0x2c38('0x1f')](_0x2d058d)[_0x2c38('0x24')](function(_0xba83a2){_0x156acd['count']=_0xba83a2;if(_0x5791a7['query'][_0x2c38('0x43')]){_0x47afdf[_0x2c38('0x44')]=[{'all':!![]}];}return db[_0x2c38('0x2c')][_0x2c38('0x45')](_0x47afdf);})[_0x2c38('0x24')](function(_0x1f306c){_0x156acd[_0x2c38('0x46')]=_0x1f306c;return _0x156acd;})[_0x2c38('0x24')](respondWithFilteredResult(_0x1f2895,_0x47afdf))[_0x2c38('0x47')](handleError(_0x1f2895,null));};exports[_0x2c38('0x48')]=function(_0x59cb2e,_0x31923c){var _0x5a26eb={'raw':!![],'where':{'id':_0x59cb2e[_0x2c38('0x49')]['id']}},_0x7c2708={};_0x7c2708[_0x2c38('0x31')]=_[_0x2c38('0x33')](db[_0x2c38('0x2c')]['rawAttributes']);_0x7c2708[_0x2c38('0x32')]=_[_0x2c38('0x33')](_0x59cb2e[_0x2c38('0x32')]);_0x7c2708['filters']=_[_0x2c38('0x35')](_0x7c2708[_0x2c38('0x31')],_0x7c2708['query']);_0x5a26eb[_0x2c38('0x36')]=_['intersection'](_0x7c2708['model'],qs[_0x2c38('0x37')](_0x59cb2e[_0x2c38('0x32')]['fields']));_0x5a26eb[_0x2c38('0x36')]=_0x5a26eb[_0x2c38('0x36')][_0x2c38('0x38')]?_0x5a26eb[_0x2c38('0x36')]:_0x7c2708[_0x2c38('0x31')];if(_0x59cb2e['query'][_0x2c38('0x43')]){_0x5a26eb[_0x2c38('0x44')]=[{'all':!![]}];}_0x5a26eb=_['merge']({},_0x5a26eb,_0x59cb2e[_0x2c38('0x42')]);return db[_0x2c38('0x2c')][_0x2c38('0x4a')](_0x5a26eb)[_0x2c38('0x24')](handleEntityNotFound(_0x31923c,null))[_0x2c38('0x24')](respondWithResult(_0x31923c,null))[_0x2c38('0x47')](handleError(_0x31923c,null));};exports[_0x2c38('0x4b')]=function(_0x2931e3,_0x2f4e37){return db['OpenchannelApplication']['create'](_0x2931e3[_0x2c38('0x4c')],{})[_0x2c38('0x24')](respondWithResult(_0x2f4e37,0xc9))['catch'](handleError(_0x2f4e37,null));};exports['update']=function(_0x39ddac,_0x249ca8){if(_0x39ddac[_0x2c38('0x4c')]['id']){delete _0x39ddac[_0x2c38('0x4c')]['id'];}return db[_0x2c38('0x2c')]['find']({'where':{'id':_0x39ddac[_0x2c38('0x49')]['id']}})[_0x2c38('0x24')](handleEntityNotFound(_0x249ca8,null))[_0x2c38('0x24')](saveUpdates(_0x39ddac[_0x2c38('0x4c')],null))[_0x2c38('0x24')](respondWithResult(_0x249ca8,null))[_0x2c38('0x47')](handleError(_0x249ca8,null));};exports['destroy']=function(_0x385801,_0x16d759){return db[_0x2c38('0x2c')][_0x2c38('0x4a')]({'where':{'id':_0x385801[_0x2c38('0x49')]['id']}})[_0x2c38('0x24')](handleEntityNotFound(_0x16d759,null))['then'](removeEntity(_0x16d759,null))[_0x2c38('0x47')](handleError(_0x16d759,null));}; \ No newline at end of file +var _0x982a=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','OpenchannelApplication','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x5056f7,_0x45b918){var _0x4bdbd8=function(_0x2bd367){while(--_0x2bd367){_0x5056f7['push'](_0x5056f7['shift']());}};_0x4bdbd8(++_0x45b918);}(_0x982a,0x1a0));var _0xa982=function(_0x103a9f,_0x2b90e3){_0x103a9f=_0x103a9f-0x0;var _0xdc15e7=_0x982a[_0x103a9f];return _0xdc15e7;};'use strict';var emlformat=require(_0xa982('0x0'));var rimraf=require(_0xa982('0x1'));var zipdir=require(_0xa982('0x2'));var jsonpatch=require(_0xa982('0x3'));var rp=require(_0xa982('0x4'));var moment=require('moment');var BPromise=require(_0xa982('0x5'));var Mustache=require('mustache');var util=require(_0xa982('0x6'));var path=require('path');var sox=require(_0xa982('0x7'));var csv=require(_0xa982('0x8'));var ejs=require(_0xa982('0x9'));var fs=require('fs');var fs_extra=require(_0xa982('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa982('0xb'));var jsforce=require(_0xa982('0xc'));var deskjs=require(_0xa982('0xd'));var toCsv=require(_0xa982('0x8'));var querystring=require(_0xa982('0xe'));var Papa=require('papaparse');var Redis=require(_0xa982('0xf'));var authService=require(_0xa982('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa982('0x11'));var hardwareService=require(_0xa982('0x12'));var logger=require(_0xa982('0x13'))(_0xa982('0x14'));var utils=require('../../config/utils');var config=require(_0xa982('0x15'));var licenseUtil=require(_0xa982('0x16'));var db=require(_0xa982('0x17'))['db'];function respondWithStatusCode(_0x5974f1,_0x1918c4){_0x1918c4=_0x1918c4||0xcc;return function(_0x135dd3){if(_0x135dd3){return _0x5974f1['sendStatus'](_0x1918c4);}return _0x5974f1['status'](_0x1918c4)['end']();};}function respondWithResult(_0x6c2648,_0xeb3b67){_0xeb3b67=_0xeb3b67||0xc8;return function(_0x75852d){if(_0x75852d){return _0x6c2648[_0xa982('0x18')](_0xeb3b67)['json'](_0x75852d);}};}function respondWithFilteredResult(_0x113ea0,_0x2f1564){return function(_0x34279c){if(_0x34279c){var _0xa151a7=typeof _0x2f1564[_0xa982('0x19')]==='undefined'&&typeof _0x2f1564[_0xa982('0x1a')]==='undefined';var _0x344233=_0x34279c['count'];var _0x50a4fa=_0xa151a7?0x0:_0x2f1564[_0xa982('0x19')];var _0x4db903=_0xa151a7?_0x34279c['count']:_0x2f1564[_0xa982('0x19')]+_0x2f1564['limit'];var _0x350b61;if(_0x4db903>=_0x344233){_0x4db903=_0x344233;_0x350b61=0xc8;}else{_0x350b61=0xce;}_0x113ea0[_0xa982('0x18')](_0x350b61);return _0x113ea0[_0xa982('0x1b')](_0xa982('0x1c'),_0x50a4fa+'-'+_0x4db903+'/'+_0x344233)[_0xa982('0x1d')](_0x34279c);}return null;};}function patchUpdates(_0x1df26b){return function(_0x228030){try{jsonpatch[_0xa982('0x1e')](_0x228030,_0x1df26b,!![]);}catch(_0x48f37c){return BPromise[_0xa982('0x1f')](_0x48f37c);}return _0x228030[_0xa982('0x20')]();};}function saveUpdates(_0x65b7c9,_0x56284d){return function(_0x43af60){if(_0x43af60){return _0x43af60[_0xa982('0x21')](_0x65b7c9)[_0xa982('0x22')](function(_0x1d68e3){return _0x1d68e3;});}return null;};}function removeEntity(_0x3c99e7,_0x47346d){return function(_0x3e8f4c){if(_0x3e8f4c){return _0x3e8f4c[_0xa982('0x23')]()[_0xa982('0x22')](function(){_0x3c99e7[_0xa982('0x18')](0xcc)[_0xa982('0x24')]();});}};}function handleEntityNotFound(_0x242634,_0x4c29f7){return function(_0xc7470c){if(!_0xc7470c){_0x242634[_0xa982('0x25')](0x194);}return _0xc7470c;};}function handleError(_0x176edd,_0x527897){_0x527897=_0x527897||0x1f4;return function(_0x1581ef){logger[_0xa982('0x26')](_0x1581ef[_0xa982('0x27')]);if(_0x1581ef[_0xa982('0x28')]){delete _0x1581ef[_0xa982('0x28')];}_0x176edd['status'](_0x527897)[_0xa982('0x29')](_0x1581ef);};}exports['index']=function(_0x3ce714,_0x273325){var _0x246ed4={},_0x5b7d71={},_0x6887b={'count':0x0,'rows':[]};var _0x15369c=_['map'](db[_0xa982('0x2a')][_0xa982('0x2b')],function(_0xa76d18){return{'name':_0xa76d18['fieldName'],'type':_0xa76d18['type'][_0xa982('0x2c')]};});_0x5b7d71[_0xa982('0x2d')]=_[_0xa982('0x2e')](_0x15369c,_0xa982('0x28'));_0x5b7d71[_0xa982('0x2f')]=_[_0xa982('0x30')](_0x3ce714[_0xa982('0x2f')]);_0x5b7d71[_0xa982('0x31')]=_[_0xa982('0x32')](_0x5b7d71[_0xa982('0x2d')],_0x5b7d71['query']);_0x246ed4[_0xa982('0x33')]=_['intersection'](_0x5b7d71[_0xa982('0x2d')],qs[_0xa982('0x34')](_0x3ce714[_0xa982('0x2f')][_0xa982('0x34')]));_0x246ed4[_0xa982('0x33')]=_0x246ed4[_0xa982('0x33')][_0xa982('0x35')]?_0x246ed4[_0xa982('0x33')]:_0x5b7d71[_0xa982('0x2d')];if(!_0x3ce714[_0xa982('0x2f')][_0xa982('0x36')](_0xa982('0x37'))){_0x246ed4[_0xa982('0x1a')]=qs[_0xa982('0x1a')](_0x3ce714[_0xa982('0x2f')][_0xa982('0x1a')]);_0x246ed4[_0xa982('0x19')]=qs[_0xa982('0x19')](_0x3ce714['query']['offset']);}_0x246ed4['order']=qs[_0xa982('0x38')](_0x3ce714[_0xa982('0x2f')][_0xa982('0x38')]);_0x246ed4[_0xa982('0x39')]=qs[_0xa982('0x31')](_[_0xa982('0x3a')](_0x3ce714[_0xa982('0x2f')],_0x5b7d71[_0xa982('0x31')]),_0x15369c);if(_0x3ce714[_0xa982('0x2f')][_0xa982('0x3b')]){_0x246ed4[_0xa982('0x39')]=_[_0xa982('0x3c')](_0x246ed4[_0xa982('0x39')],{'$or':_[_0xa982('0x2e')](_0x15369c,function(_0x4b4a53){if(_0x4b4a53['type']!==_0xa982('0x3d')){var _0x3c8261={};_0x3c8261[_0x4b4a53[_0xa982('0x28')]]={'$like':'%'+_0x3ce714[_0xa982('0x2f')][_0xa982('0x3b')]+'%'};return _0x3c8261;}})});}_0x246ed4=_[_0xa982('0x3c')]({},_0x246ed4,_0x3ce714[_0xa982('0x3e')]);var _0x167587={'where':_0x246ed4[_0xa982('0x39')]};return db[_0xa982('0x2a')][_0xa982('0x3f')](_0x167587)[_0xa982('0x22')](function(_0x3a6b00){_0x6887b[_0xa982('0x3f')]=_0x3a6b00;if(_0x3ce714[_0xa982('0x2f')]['includeAll']){_0x246ed4['include']=[{'all':!![]}];}return db[_0xa982('0x2a')][_0xa982('0x40')](_0x246ed4);})[_0xa982('0x22')](function(_0x29db4d){_0x6887b['rows']=_0x29db4d;return _0x6887b;})['then'](respondWithFilteredResult(_0x273325,_0x246ed4))[_0xa982('0x41')](handleError(_0x273325,null));};exports[_0xa982('0x42')]=function(_0x490848,_0x5536fc){var _0x83ba5f={'raw':!![],'where':{'id':_0x490848[_0xa982('0x43')]['id']}},_0x56eae1={};_0x56eae1[_0xa982('0x2d')]=_[_0xa982('0x30')](db[_0xa982('0x2a')][_0xa982('0x2b')]);_0x56eae1[_0xa982('0x2f')]=_[_0xa982('0x30')](_0x490848[_0xa982('0x2f')]);_0x56eae1[_0xa982('0x31')]=_[_0xa982('0x32')](_0x56eae1[_0xa982('0x2d')],_0x56eae1[_0xa982('0x2f')]);_0x83ba5f[_0xa982('0x33')]=_[_0xa982('0x32')](_0x56eae1[_0xa982('0x2d')],qs[_0xa982('0x34')](_0x490848[_0xa982('0x2f')][_0xa982('0x34')]));_0x83ba5f[_0xa982('0x33')]=_0x83ba5f[_0xa982('0x33')][_0xa982('0x35')]?_0x83ba5f[_0xa982('0x33')]:_0x56eae1[_0xa982('0x2d')];if(_0x490848[_0xa982('0x2f')][_0xa982('0x44')]){_0x83ba5f['include']=[{'all':!![]}];}_0x83ba5f=_[_0xa982('0x3c')]({},_0x83ba5f,_0x490848[_0xa982('0x3e')]);return db[_0xa982('0x2a')][_0xa982('0x45')](_0x83ba5f)['then'](handleEntityNotFound(_0x5536fc,null))[_0xa982('0x22')](respondWithResult(_0x5536fc,null))['catch'](handleError(_0x5536fc,null));};exports[_0xa982('0x46')]=function(_0x3f6b46,_0x286430){return db[_0xa982('0x2a')]['create'](_0x3f6b46[_0xa982('0x47')],{})[_0xa982('0x22')](respondWithResult(_0x286430,0xc9))[_0xa982('0x41')](handleError(_0x286430,null));};exports[_0xa982('0x21')]=function(_0x44d80d,_0x2f4671){if(_0x44d80d[_0xa982('0x47')]['id']){delete _0x44d80d[_0xa982('0x47')]['id'];}return db[_0xa982('0x2a')][_0xa982('0x45')]({'where':{'id':_0x44d80d[_0xa982('0x43')]['id']}})[_0xa982('0x22')](handleEntityNotFound(_0x2f4671,null))[_0xa982('0x22')](saveUpdates(_0x44d80d['body'],null))[_0xa982('0x22')](respondWithResult(_0x2f4671,null))[_0xa982('0x41')](handleError(_0x2f4671,null));};exports[_0xa982('0x23')]=function(_0x55b85a,_0x41f34d){return db['OpenchannelApplication']['find']({'where':{'id':_0x55b85a[_0xa982('0x43')]['id']}})[_0xa982('0x22')](handleEntityNotFound(_0x41f34d,null))[_0xa982('0x22')](removeEntity(_0x41f34d,null))[_0xa982('0x41')](handleError(_0x41f34d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1ae294e..c497af2 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 _0x26be=['bluebird','request-promise','path','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x3c4024,_0x1fb7c9){var _0x20f126=function(_0x572d54){while(--_0x572d54){_0x3c4024['push'](_0x3c4024['shift']());}};_0x20f126(++_0x1fb7c9);}(_0x26be,0x113));var _0xe26b=function(_0x27ea74,_0x5399f5){_0x27ea74=_0x27ea74-0x0;var _0x1ebf2b=_0x26be[_0x27ea74];return _0x1ebf2b;};'use strict';var _=require(_0xe26b('0x0'));var util=require(_0xe26b('0x1'));var logger=require(_0xe26b('0x2'))(_0xe26b('0x3'));var moment=require(_0xe26b('0x4'));var BPromise=require(_0xe26b('0x5'));var rp=require(_0xe26b('0x6'));var fs=require('fs');var path=require(_0xe26b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe26b('0x8'));module[_0xe26b('0x9')]=function(_0x361125,_0x176214){return _0x361125['define'](_0xe26b('0xa'),attributes,{'tableName':_0xe26b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe26b('0xc'),'collate':_0xe26b('0xd')});}; \ No newline at end of file +var _0x59fe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x4d6562,_0x54b4b6){var _0x55a920=function(_0xc80f8a){while(--_0xc80f8a){_0x4d6562['push'](_0x4d6562['shift']());}};_0x55a920(++_0x54b4b6);}(_0x59fe,0xa7));var _0xe59f=function(_0xe0f347,_0x352a98){_0xe0f347=_0xe0f347-0x0;var _0xe18e3d=_0x59fe[_0xe0f347];return _0xe18e3d;};'use strict';var _=require('lodash');var util=require(_0xe59f('0x0'));var logger=require(_0xe59f('0x1'))(_0xe59f('0x2'));var moment=require(_0xe59f('0x3'));var BPromise=require(_0xe59f('0x4'));var rp=require(_0xe59f('0x5'));var fs=require('fs');var path=require(_0xe59f('0x6'));var rimraf=require(_0xe59f('0x7'));var config=require(_0xe59f('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0xe59f('0x9')]=function(_0x50b532,_0x5f3132){return _0x50b532[_0xe59f('0xa')]('OpenchannelApplication',attributes,{'tableName':_0xe59f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe59f('0xc'),'collate':_0xe59f('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index fe2de62..7c786d3 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 _0x6b76=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','code','OpenchannelApplication,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','limit','lodash','ioredis','../../mysqldb'];(function(_0x5f1b1a,_0xcaba6d){var _0x197d87=function(_0x535e52){while(--_0x535e52){_0x5f1b1a['push'](_0x5f1b1a['shift']());}};_0x197d87(++_0xcaba6d);}(_0x6b76,0x1a1));var _0x66b7=function(_0xf72f09,_0x73eb46){_0xf72f09=_0xf72f09-0x0;var _0x870e5f=_0x6b76[_0xf72f09];return _0x870e5f;};'use strict';var _=require(_0x66b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66b7('0x1'));var db=require(_0x66b7('0x2'))['db'];var utils=require(_0x66b7('0x3'));var logger=require(_0x66b7('0x4'))(_0x66b7('0x5'));var config=require(_0x66b7('0x6'));var jayson=require(_0x66b7('0x7'));var client=jayson[_0x66b7('0x8')][_0x66b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7902cf,_0x550f01,_0x388800){return new BPromise(function(_0x55cbc9,_0x2cc8cf){return client[_0x66b7('0xa')](_0x7902cf,_0x388800)[_0x66b7('0xb')](function(_0x1a0f67){logger[_0x66b7('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x550f01,_0x66b7('0xd'));logger[_0x66b7('0xe')](_0x66b7('0xf'),_0x550f01,_0x66b7('0xd'),JSON[_0x66b7('0x10')](_0x1a0f67));if(_0x1a0f67['error']){if(_0x1a0f67['error'][_0x66b7('0x11')]===0x1f4){logger['error'](_0x66b7('0x12'),_0x550f01,_0x1a0f67[_0x66b7('0x13')][_0x66b7('0x14')]);return _0x2cc8cf(_0x1a0f67[_0x66b7('0x13')]['message']);}logger[_0x66b7('0x13')](_0x66b7('0x12'),_0x550f01,_0x1a0f67[_0x66b7('0x13')][_0x66b7('0x14')]);return _0x55cbc9(_0x1a0f67[_0x66b7('0x13')][_0x66b7('0x14')]);}else{logger[_0x66b7('0xc')](_0x66b7('0x12'),_0x550f01,_0x66b7('0xd'));_0x55cbc9(_0x1a0f67[_0x66b7('0x15')][_0x66b7('0x14')]);}})[_0x66b7('0x16')](function(_0x5b98a3){logger[_0x66b7('0x13')](_0x66b7('0x12'),_0x550f01,_0x5b98a3);_0x2cc8cf(_0x5b98a3);});});}exports[_0x66b7('0x17')]=function(_0x2076e0){var _0x428a42=this;return new Promise(function(_0x361ef5,_0x30225b){return db[_0x66b7('0x18')][_0x66b7('0x19')](_0x2076e0[_0x66b7('0x1a')],{'raw':_0x2076e0[_0x66b7('0x1b')]?_0x2076e0[_0x66b7('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2076e0[_0x66b7('0x1b')]?_0x2076e0[_0x66b7('0x1b')][_0x66b7('0x1c')]||null:null,'attributes':_0x2076e0[_0x66b7('0x1b')]?_0x2076e0['options']['attributes']||null:null,'limit':_0x2076e0[_0x66b7('0x1b')]?_0x2076e0['options'][_0x66b7('0x1d')]||null:null})['then'](function(_0x481ae1){logger['info'](_0x66b7('0x17'),_0x2076e0);logger[_0x66b7('0xe')](_0x66b7('0x17'),_0x2076e0,JSON['stringify'](_0x481ae1));_0x361ef5(_0x481ae1);})[_0x66b7('0x16')](function(_0x2aea12){logger[_0x66b7('0x13')]('UpdateOpenchannelApplication',_0x2aea12[_0x66b7('0x14')],_0x2076e0);_0x30225b(_0x428a42[_0x66b7('0x13')](0x1f4,_0x2aea12[_0x66b7('0x14')]));});});}; \ No newline at end of file +var _0xf61a=['error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','attributes','limit','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x366545,_0xb0e092){var _0x50eee6=function(_0x37f4e6){while(--_0x37f4e6){_0x366545['push'](_0x366545['shift']());}};_0x50eee6(++_0xb0e092);}(_0xf61a,0x140));var _0xaf61=function(_0x39a734,_0x5e328e){_0x39a734=_0x39a734-0x0;var _0x116785=_0xf61a[_0x39a734];return _0x116785;};'use strict';var _=require(_0xaf61('0x0'));var util=require('util');var moment=require(_0xaf61('0x1'));var BPromise=require(_0xaf61('0x2'));var rs=require(_0xaf61('0x3'));var fs=require('fs');var Redis=require(_0xaf61('0x4'));var db=require(_0xaf61('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf61('0x6'))(_0xaf61('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf61('0x8')][_0xaf61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16fa69,_0xe927d2,_0x258fa0){return new BPromise(function(_0x206b5a,_0x49e84d){return client[_0xaf61('0xa')](_0x16fa69,_0x258fa0)[_0xaf61('0xb')](function(_0x4b8cc4){logger[_0xaf61('0xc')](_0xaf61('0xd'),_0xe927d2,'request\x20sent');logger['debug'](_0xaf61('0xe'),_0xe927d2,_0xaf61('0xf'),JSON['stringify'](_0x4b8cc4));if(_0x4b8cc4[_0xaf61('0x10')]){if(_0x4b8cc4[_0xaf61('0x10')][_0xaf61('0x11')]===0x1f4){logger[_0xaf61('0x10')](_0xaf61('0xd'),_0xe927d2,_0x4b8cc4[_0xaf61('0x10')]['message']);return _0x49e84d(_0x4b8cc4[_0xaf61('0x10')][_0xaf61('0x12')]);}logger[_0xaf61('0x10')](_0xaf61('0xd'),_0xe927d2,_0x4b8cc4['error'][_0xaf61('0x12')]);return _0x206b5a(_0x4b8cc4[_0xaf61('0x10')][_0xaf61('0x12')]);}else{logger[_0xaf61('0xc')](_0xaf61('0xd'),_0xe927d2,_0xaf61('0xf'));_0x206b5a(_0x4b8cc4[_0xaf61('0x13')][_0xaf61('0x12')]);}})[_0xaf61('0x14')](function(_0x1f1f14){logger[_0xaf61('0x10')](_0xaf61('0xd'),_0xe927d2,_0x1f1f14);_0x49e84d(_0x1f1f14);});});}exports[_0xaf61('0x15')]=function(_0xd802e9){var _0x46130d=this;return new Promise(function(_0x457ad1,_0x5b4057){return db[_0xaf61('0x16')]['update'](_0xd802e9['body'],{'raw':_0xd802e9[_0xaf61('0x17')]?_0xd802e9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd802e9['options']?_0xd802e9[_0xaf61('0x17')]['where']||null:null,'attributes':_0xd802e9[_0xaf61('0x17')]?_0xd802e9[_0xaf61('0x17')][_0xaf61('0x18')]||null:null,'limit':_0xd802e9[_0xaf61('0x17')]?_0xd802e9['options'][_0xaf61('0x19')]||null:null})[_0xaf61('0xb')](function(_0x35adfd){logger[_0xaf61('0xc')]('UpdateOpenchannelApplication',_0xd802e9);logger[_0xaf61('0x1a')](_0xaf61('0x15'),_0xd802e9,JSON[_0xaf61('0x1b')](_0x35adfd));_0x457ad1(_0x35adfd);})[_0xaf61('0x14')](function(_0x868f4c){logger[_0xaf61('0x10')](_0xaf61('0x15'),_0x868f4c[_0xaf61('0x12')],_0xd802e9);_0x5b4057(_0x46130d['error'](0x1f4,_0x868f4c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 43ebc95..f81c91a 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 _0x2238=['/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','/:id/download','download','post','create','addMessage'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x2238,0x1eb));var _0x8223=function(_0x571b33,_0x206708){_0x571b33=_0x571b33-0x0;var _0x5ab6e0=_0x2238[_0x571b33];return _0x5ab6e0;};'use strict';var multer=require(_0x8223('0x0'));var util=require(_0x8223('0x1'));var path=require(_0x8223('0x2'));var timeout=require(_0x8223('0x3'));var express=require('express');var router=express[_0x8223('0x4')]();var fs_extra=require(_0x8223('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8223('0x6'));var controller=require(_0x8223('0x7'));router[_0x8223('0x8')]('/',auth[_0x8223('0x9')](),controller[_0x8223('0xa')]);router[_0x8223('0x8')](_0x8223('0xb'),auth['isAuthenticated'](),controller[_0x8223('0xc')]);router['get']('/:id',auth[_0x8223('0x9')](),controller['show']);router[_0x8223('0x8')](_0x8223('0xd'),auth[_0x8223('0x9')](),controller['getMessages']);router[_0x8223('0x8')](_0x8223('0xe'),auth[_0x8223('0x9')](),controller[_0x8223('0xf')]);router[_0x8223('0x10')]('/',auth[_0x8223('0x9')](),controller[_0x8223('0x11')]);router[_0x8223('0x10')](_0x8223('0xd'),auth[_0x8223('0x9')](),controller[_0x8223('0x12')]);router['post'](_0x8223('0x13'),auth[_0x8223('0x9')](),interaction[_0x8223('0x14')](_0x8223('0x15'),_0x8223('0x16')),controller[_0x8223('0x17')]);router[_0x8223('0x18')]('/:id',auth[_0x8223('0x9')](),interaction[_0x8223('0x14')]('openchannel','openchannelinteraction:update'),controller[_0x8223('0x19')]);router[_0x8223('0x1a')]('/:id',auth[_0x8223('0x9')](),interaction[_0x8223('0x14')](_0x8223('0x15'),_0x8223('0x1b')),controller[_0x8223('0x1c')]);router[_0x8223('0x1a')](_0x8223('0x13'),auth[_0x8223('0x9')](),controller['removeTags']);module[_0x8223('0x1d')]=router; \ No newline at end of file +var _0xc769=['/:id','show','/:id/messages','create','post','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','update','delete','openchannelinteraction:destroy','destroy','util','path','Router','./openchannelInteraction.controller','get','isAuthenticated','index','describe'];(function(_0x5d3292,_0x13b181){var _0x413fad=function(_0x1b023b){while(--_0x1b023b){_0x5d3292['push'](_0x5d3292['shift']());}};_0x413fad(++_0x13b181);}(_0xc769,0xb0));var _0x9c76=function(_0x483793,_0x37dd5b){_0x483793=_0x483793-0x0;var _0x1ca493=_0xc769[_0x483793];return _0x1ca493;};'use strict';var multer=require('multer');var util=require(_0x9c76('0x0'));var path=require(_0x9c76('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9c76('0x2')]();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(_0x9c76('0x3'));router[_0x9c76('0x4')]('/',auth[_0x9c76('0x5')](),controller[_0x9c76('0x6')]);router[_0x9c76('0x4')]('/describe',auth[_0x9c76('0x5')](),controller[_0x9c76('0x7')]);router[_0x9c76('0x4')](_0x9c76('0x8'),auth[_0x9c76('0x5')](),controller[_0x9c76('0x9')]);router[_0x9c76('0x4')](_0x9c76('0xa'),auth[_0x9c76('0x5')](),controller['getMessages']);router[_0x9c76('0x4')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x9c76('0xb')]);router[_0x9c76('0xc')](_0x9c76('0xa'),auth[_0x9c76('0x5')](),controller['addMessage']);router[_0x9c76('0xc')](_0x9c76('0xd'),auth[_0x9c76('0x5')](),interaction['tracked'](_0x9c76('0xe'),_0x9c76('0xf')),controller[_0x9c76('0x10')]);router[_0x9c76('0x11')](_0x9c76('0x8'),auth['isAuthenticated'](),interaction[_0x9c76('0x12')](_0x9c76('0xe'),'openchannelinteraction:update'),controller[_0x9c76('0x13')]);router[_0x9c76('0x14')](_0x9c76('0x8'),auth[_0x9c76('0x5')](),interaction[_0x9c76('0x12')](_0x9c76('0xe'),_0x9c76('0x15')),controller[_0x9c76('0x16')]);router[_0x9c76('0x14')](_0x9c76('0xd'),auth[_0x9c76('0x5')](),controller['removeTags']);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 ab41e58..a76ab87 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 _0xac7f=['out','INTEGER','sequelize','BOOLEAN','DATE','STRING'];(function(_0x2ed95e,_0x5c0b7f){var _0x8b2b2e=function(_0x100ef5){while(--_0x100ef5){_0x2ed95e['push'](_0x2ed95e['shift']());}};_0x8b2b2e(++_0x5c0b7f);}(_0xac7f,0x1e2));var _0xfac7=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xac7f[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0xfac7('0x0'));module['exports']={'closed':{'type':Sequelize[_0xfac7('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfac7('0x2')]},'disposition':{'type':Sequelize[_0xfac7('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfac7('0x3')]},'note':{'type':Sequelize[_0xfac7('0x3')]},'read1stAt':{'type':Sequelize[_0xfac7('0x2')]},'threadId':{'type':Sequelize[_0xfac7('0x3')]},'externalUrl':{'type':Sequelize[_0xfac7('0x3')]},'lastMsgAt':{'type':Sequelize[_0xfac7('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfac7('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfac7('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xfac7('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfac7('0x5')]}}; \ No newline at end of file +var _0xb7aa=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7aa,0x11a));var _0xab7a=function(_0x46df05,_0xdfcece){_0x46df05=_0x46df05-0x0;var _0x5576d6=_0xb7aa[_0x46df05];return _0x5576d6;};'use strict';var Sequelize=require(_0xab7a('0x0'));module[_0xab7a('0x1')]={'closed':{'type':Sequelize[_0xab7a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xab7a('0x3')]},'disposition':{'type':Sequelize[_0xab7a('0x4')]},'secondDisposition':{'type':Sequelize[_0xab7a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xab7a('0x4')]},'note':{'type':Sequelize[_0xab7a('0x4')]},'read1stAt':{'type':Sequelize[_0xab7a('0x3')]},'threadId':{'type':Sequelize[_0xab7a('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xab7a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xab7a('0x5')]('in',_0xab7a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xab7a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xab7a('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xab7a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index c87a472..5786d43 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 _0x144d=['rimraf','zip-dir','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','error','name','send','OpenchannelInteraction','rawAttributes','fieldName','type','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','includeAll','options','create','body','find','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','fields','length','nolimit','order','where','pick','merge','map','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','root','files','attachments','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','createdAt','secret','read','OpenchannelAccount','Account','Owner','get','N.A.','toString','threadId','Public','Private','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','Unable\x20to\x20delete\x20zip\x20file','unlinkSync'];(function(_0x4edce5,_0x5a2fda){var _0x376312=function(_0x101294){while(--_0x101294){_0x4edce5['push'](_0x4edce5['shift']());}};_0x376312(++_0x5a2fda);}(_0x144d,0x81));var _0xd144=function(_0x1e1d47,_0x4133c8){_0x1e1d47=_0x1e1d47-0x0;var _0x48c2c7=_0x144d[_0x1e1d47];return _0x48c2c7;};'use strict';var rimraf=require(_0xd144('0x0'));var zipdir=require(_0xd144('0x1'));var moment=require(_0xd144('0x2'));var util=require(_0xd144('0x3'));var path=require(_0xd144('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xd144('0x5'));var interaction=require(_0xd144('0x6'));var qs=require(_0xd144('0x7'));var pdf=require(_0xd144('0x8'));var logger=require(_0xd144('0x9'))('api');var config=require('../../config/environment');var db=require(_0xd144('0xa'))['db'];config[_0xd144('0xb')]=_[_0xd144('0xc')](config['redis'],{'host':_0xd144('0xd'),'port':0x18eb});var socket=require(_0xd144('0xe'))(new Redis(config['redis']));require(_0xd144('0xf'))[_0xd144('0x10')](socket);function respondWithStatusCode(_0x55cb8e,_0x3cfb14){_0x3cfb14=_0x3cfb14||0xcc;return function(_0x2a6b9b){if(_0x2a6b9b){return _0x55cb8e[_0xd144('0x11')](_0x3cfb14);}return _0x55cb8e[_0xd144('0x12')](_0x3cfb14)[_0xd144('0x13')]();};}function respondWithResult(_0x51be9a,_0x545009){_0x545009=_0x545009||0xc8;return function(_0x478a25){if(_0x478a25){return _0x51be9a[_0xd144('0x12')](_0x545009)['json'](_0x478a25);}};}function respondWithFilteredResult(_0x294721,_0xce9814){return function(_0x24df29){if(_0x24df29){var _0x12169b=typeof _0xce9814[_0xd144('0x14')]===_0xd144('0x15')&&typeof _0xce9814[_0xd144('0x16')]===_0xd144('0x15');var _0x4aea85=_0x24df29[_0xd144('0x17')];var _0x1707ad=_0x12169b?0x0:_0xce9814[_0xd144('0x14')];var _0x47a4d6=_0x12169b?_0x24df29[_0xd144('0x17')]:_0xce9814[_0xd144('0x14')]+_0xce9814[_0xd144('0x16')];var _0x160587;if(_0x47a4d6>=_0x4aea85){_0x47a4d6=_0x4aea85;_0x160587=0xc8;}else{_0x160587=0xce;}_0x294721['status'](_0x160587);return _0x294721['set'](_0xd144('0x18'),_0x1707ad+'-'+_0x47a4d6+'/'+_0x4aea85)[_0xd144('0x19')](_0x24df29);}return null;};}function saveUpdates(_0x44b49e){return function(_0x5c98a4){if(_0x5c98a4){return _0x5c98a4[_0xd144('0x1a')](_0x44b49e)[_0xd144('0x1b')](function(_0x147912){return _0x147912;});}return null;};}function removeEntity(_0x2528e7){return function(_0x534cff){if(_0x534cff){return _0x534cff['destroy']()['then'](function(){_0x2528e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cd4dd){return function(_0x393e4b){if(!_0x393e4b){_0x4cd4dd[_0xd144('0x11')](0x194);}return _0x393e4b;};}function handleError(_0xdd2adf,_0x7bb6b2){_0x7bb6b2=_0x7bb6b2||0x1f4;return function(_0x170e55){logger[_0xd144('0x1c')](_0x170e55['stack']);if(_0x170e55[_0xd144('0x1d')]){delete _0x170e55[_0xd144('0x1d')];}_0xdd2adf['status'](_0x7bb6b2)[_0xd144('0x1e')](_0x170e55);};}exports['index']=function(_0x157559,_0x5b9793){var _0x38bc76={};var _0x2f42e2=_['map'](db[_0xd144('0x1f')][_0xd144('0x20')],function(_0x231d8a){return{'name':_0x231d8a[_0xd144('0x21')],'type':_0x231d8a[_0xd144('0x22')]['key']};});_0x38bc76=qs['getOptions'](_0x2f42e2,_0x157559);return interaction[_0xd144('0x23')](_0xd144('0x24'),_0x157559[_0xd144('0x25')],_0x157559[_0xd144('0x26')],_0x38bc76,_0x2f42e2)[_0xd144('0x1b')](respondWithFilteredResult(_0x5b9793,_0x38bc76))[_0xd144('0x27')](handleError(_0x5b9793,null));};exports[_0xd144('0x28')]=function(_0x244664,_0xfeeeb1){var _0x29c165={};if(_0x244664[_0xd144('0x25')][_0xd144('0x22')]&&_0x244664[_0xd144('0x25')][_0xd144('0x22')]==='from'){_0x29c165[_0xd144('0x29')]=_0x244664[_0xd144('0x2a')]['id'];}else{_0x29c165['id']=_0x244664[_0xd144('0x2a')]['id'];}var _0x459c5b={'raw':![],'where':_0x29c165},_0x3b5e1d={};_0x3b5e1d[_0xd144('0x2b')]=_[_0xd144('0x2c')](db[_0xd144('0x1f')][_0xd144('0x20')]);_0x3b5e1d[_0xd144('0x25')]=_[_0xd144('0x2c')](_0x244664[_0xd144('0x25')]);_0x3b5e1d[_0xd144('0x2d')]=_[_0xd144('0x2e')](_0x3b5e1d[_0xd144('0x2b')],_0x3b5e1d[_0xd144('0x25')]);_0x459c5b[_0xd144('0x2f')]=_['intersection'](_0x3b5e1d['model'],qs['fields'](_0x244664['query']['fields']));_0x459c5b[_0xd144('0x2f')]=_0x459c5b[_0xd144('0x2f')]['length']?_0x459c5b[_0xd144('0x2f')]:_0x3b5e1d[_0xd144('0x2b')];if(_0x244664[_0xd144('0x25')][_0xd144('0x30')]){_0x459c5b['include']=[{'all':!![]}];}_0x459c5b=_['merge']({},_0x459c5b,_0x244664[_0xd144('0x31')]);return db[_0xd144('0x1f')]['find'](_0x459c5b)[_0xd144('0x1b')](handleEntityNotFound(_0xfeeeb1,null))['then'](respondWithResult(_0xfeeeb1,null))[_0xd144('0x27')](handleError(_0xfeeeb1,null));};exports[_0xd144('0x32')]=function(_0xf108f3,_0x1c96a8){return db[_0xd144('0x1f')]['create'](_0xf108f3[_0xd144('0x33')],{})[_0xd144('0x1b')](respondWithResult(_0x1c96a8,0xc9))[_0xd144('0x27')](handleError(_0x1c96a8,null));};exports[_0xd144('0x1a')]=function(_0x426a96,_0x1bbdcf){if(_0x426a96[_0xd144('0x33')]['id']){delete _0x426a96[_0xd144('0x33')]['id'];}return db[_0xd144('0x1f')][_0xd144('0x34')]({'where':{'id':_0x426a96[_0xd144('0x2a')]['id']}})[_0xd144('0x1b')](handleEntityNotFound(_0x1bbdcf,null))[_0xd144('0x1b')](saveUpdates(_0x426a96[_0xd144('0x33')],null))[_0xd144('0x1b')](respondWithResult(_0x1bbdcf,null))[_0xd144('0x27')](handleError(_0x1bbdcf,null));};exports[_0xd144('0x35')]=function(_0x2f7922,_0x191e80){return db[_0xd144('0x1f')]['find']({'where':{'id':_0x2f7922[_0xd144('0x2a')]['id']}})[_0xd144('0x1b')](handleEntityNotFound(_0x191e80,null))[_0xd144('0x1b')](removeEntity(_0x191e80,null))['catch'](handleError(_0x191e80,null));};exports[_0xd144('0x36')]=function(_0x2c85fb,_0xbc0c02){return db[_0xd144('0x1f')][_0xd144('0x36')]()[_0xd144('0x1b')](respondWithResult(_0xbc0c02,null))[_0xd144('0x27')](handleError(_0xbc0c02,null));};exports[_0xd144('0x37')]=function(_0x1161fb,_0x1c6205){return db[_0xd144('0x38')][_0xd144('0x34')]({'where':{'id':_0x1161fb['params']['id']}})['then'](handleEntityNotFound(_0x1c6205,null))[_0xd144('0x1b')](function(_0x5bb357){if(_0x5bb357){return _0x5bb357['addMessage'](_0x1161fb[_0xd144('0x33')][_0xd144('0x39')],_[_0xd144('0x3a')](_0x1161fb[_0xd144('0x33')],[_0xd144('0x39'),'id'])||{});}})[_0xd144('0x1b')](respondWithResult(_0x1c6205,null))['catch'](handleError(_0x1c6205,null));};exports[_0xd144('0x3b')]=function(_0x525b06,_0x3b4c40){var _0x2ec280={'raw':![],'where':{}};var _0xb942d5={};var _0x499ea5={'count':0x0,'rows':[]};return db[_0xd144('0x1f')][_0xd144('0x3c')]({'where':{'id':_0x525b06['params']['id']}})[_0xd144('0x1b')](handleEntityNotFound(_0x3b4c40,null))['then'](function(_0x2ece4b){if(_0x2ece4b){_0xb942d5[_0xd144('0x2b')]=_[_0xd144('0x2c')](db[_0xd144('0x38')][_0xd144('0x20')]);_0xb942d5[_0xd144('0x25')]=_[_0xd144('0x2c')](_0x525b06['query']);_0xb942d5['filters']=_[_0xd144('0x2e')](_0xb942d5[_0xd144('0x2b')],_0xb942d5[_0xd144('0x25')]);_0x2ec280[_0xd144('0x2f')]=_[_0xd144('0x2e')](_0xb942d5[_0xd144('0x2b')],qs[_0xd144('0x3d')](_0x525b06[_0xd144('0x25')][_0xd144('0x3d')]));_0x2ec280[_0xd144('0x2f')]=_0x2ec280[_0xd144('0x2f')][_0xd144('0x3e')]?_0x2ec280[_0xd144('0x2f')]:_0xb942d5[_0xd144('0x2b')];if(!_0x525b06['query']['hasOwnProperty'](_0xd144('0x3f'))){_0x2ec280[_0xd144('0x16')]=qs[_0xd144('0x16')](_0x525b06[_0xd144('0x25')][_0xd144('0x16')]);_0x2ec280['offset']=qs['offset'](_0x525b06[_0xd144('0x25')][_0xd144('0x14')]);}_0x2ec280[_0xd144('0x40')]=qs['sort'](_0x525b06[_0xd144('0x25')]['sort']);_0x2ec280[_0xd144('0x41')]=qs['filters'](_[_0xd144('0x42')](_0x525b06[_0xd144('0x25')],_0xb942d5[_0xd144('0x2d')]));_0x2ec280[_0xd144('0x41')]['OpenchannelInteractionId']=_0x2ece4b['id'];if(_0x525b06['query']['filter']){_0x2ec280[_0xd144('0x41')]=_[_0xd144('0x43')](_0x2ec280[_0xd144('0x41')],{'$or':_[_0xd144('0x44')](_0x2ec280['attributes'],function(_0x5b9789){var _0xa822ad={};_0xa822ad[_0x5b9789]={'$like':'%'+_0x525b06['query'][_0xd144('0x45')]+'%'};return _0xa822ad;})});}if(_0x525b06['query'][_0xd144('0x46')]){var _0x3079e3=_0x525b06[_0xd144('0x25')][_0xd144('0x46')][_0xd144('0x47')](',');var _0x226003={};_0x226003[_0x3079e3[0x0]]={'$gte':moment(_0x3079e3[0x1])['format'](_0xd144('0x48'))};_0x2ec280[_0xd144('0x41')]=_[_0xd144('0x43')](_0x2ec280[_0xd144('0x41')],_0x226003);}_0x2ec280=_[_0xd144('0x43')]({},_0x2ec280,_0x525b06[_0xd144('0x31')]);return db[_0xd144('0x38')]['count']({'where':_0x2ec280[_0xd144('0x41')]})[_0xd144('0x1b')](function(_0x43d6f6){_0x499ea5[_0xd144('0x17')]=_0x43d6f6;if(_0x525b06['query']['includeAll']){_0x2ec280[_0xd144('0x49')]=[{'all':!![]}];}return db[_0xd144('0x38')][_0xd144('0x23')](_0x2ec280);})[_0xd144('0x1b')](function(_0x150071){_0x499ea5[_0xd144('0x4a')]=_0x150071;return _0x499ea5;});}})[_0xd144('0x1b')](respondWithFilteredResult(_0x3b4c40,_0x2ec280))[_0xd144('0x27')](handleError(_0x3b4c40,null));};exports[_0xd144('0x4b')]=function(_0x40bb68,_0x1d985a){return db[_0xd144('0x1f')][_0xd144('0x34')]({'where':{'id':_0x40bb68[_0xd144('0x2a')]['id']}})[_0xd144('0x1b')](handleEntityNotFound(_0x1d985a,null))[_0xd144('0x1b')](function(_0x7d8153){if(_0x7d8153){return _0x7d8153[_0xd144('0x4c')](_0x40bb68[_0xd144('0x33')]['ids'],_[_0xd144('0x3a')](_0x40bb68[_0xd144('0x33')],[_0xd144('0x39'),'id'])||{})[_0xd144('0x4d')](function(){return db[_0xd144('0x4e')][_0xd144('0x23')]({'attributes':['id','name',_0xd144('0x4f')],'where':{'id':_0x40bb68[_0xd144('0x33')][_0xd144('0x39')]}});})[_0xd144('0x1b')](function(_0xe8ae49){socket[_0xd144('0x50')](_0xd144('0x51'),{'id':Number(_0x40bb68[_0xd144('0x2a')]['id']),'tags':_0xe8ae49||[]});return{'id':Number(_0x40bb68[_0xd144('0x2a')]['id']),'tags':_0xe8ae49||[]};});}})[_0xd144('0x1b')](respondWithResult(_0x1d985a,null))['catch'](handleError(_0x1d985a,null));};exports[_0xd144('0x52')]=function(_0x20dbab,_0x5b6142){return db[_0xd144('0x1f')][_0xd144('0x34')]({'where':{'id':_0x20dbab[_0xd144('0x2a')]['id']}})[_0xd144('0x1b')](handleEntityNotFound(_0x5b6142,null))[_0xd144('0x1b')](function(_0x22a17d){if(_0x22a17d){return _0x22a17d['removeTags'](_0x20dbab['query'][_0xd144('0x39')]);}})[_0xd144('0x1b')](respondWithStatusCode(_0x5b6142,null))['catch'](handleError(_0x5b6142,null));};exports[_0xd144('0x53')]=function(_0x53ce08,_0x3276aa){var _0x14fc2a=moment()[_0xd144('0x54')]()['toString']();var _0x9368c0=path[_0xd144('0x55')](config['root'],_0xd144('0x56'),'files','tmp');var _0x46664a=path[_0xd144('0x55')](config[_0xd144('0x57')],'server',_0xd144('0x58'),_0xd144('0x59'));var _0x3aefef=path['join'](_0x9368c0,_0x14fc2a);var _0x1925fc=util[_0xd144('0x5a')](_0xd144('0x5b'),_0x53ce08['params']['id'],_0x14fc2a);var _0x1ca47a=path[_0xd144('0x55')](_0x9368c0,_0x1925fc);var _0x452fc4=[];_0x452fc4[_0xd144('0x5c')]({'model':db[_0xd144('0x5d')],'as':_0xd144('0x5d'),'attributes':['id',_0xd144('0x5e')],'raw':!![]});_0x452fc4[_0xd144('0x5c')]({'model':db['CmContact'],'as':_0xd144('0x5f'),'attributes':['id',_0xd144('0x60'),_0xd144('0x61')],'raw':!![]});if(_0x53ce08['query']['attachments']){_0x452fc4['push']({'model':db[_0xd144('0x62')],'as':'Attachment','raw':!![]});}var _0x5b1100=[{'model':db[_0xd144('0x38')],'as':'Messages','attributes':['id','body',_0xd144('0x63'),'direction',_0xd144('0x64'),_0xd144('0x65')],'include':_0x452fc4}];_0x5b1100[_0xd144('0x5c')]({'model':db[_0xd144('0x66')],'as':_0xd144('0x67'),'attributes':['id','name']});_0x5b1100[_0xd144('0x5c')]({'model':db['User'],'as':_0xd144('0x68'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0xd144('0x34')]({'where':{'id':_0x53ce08['params']['id']},'include':_0x5b1100})[_0xd144('0x1b')](handleEntityNotFound(_0x3276aa,null))['then'](function(_0x287008){if(_0x287008){var _0x2d0651=_0x287008[_0xd144('0x69')]({'plain':!![]});fs['mkdirSync'](_0x3aefef);var _0x4e8d93={'channel':'Openchannel','account':_0x2d0651[_0xd144('0x67')][_0xd144('0x1d')],'agent':_0x2d0651[_0xd144('0x68')]?_0x2d0651['Owner'][_0xd144('0x5e')]:_0xd144('0x6a'),'createdAt':moment(_0x2d0651[_0xd144('0x63')])[_0xd144('0x5a')](_0xd144('0x48'))[_0xd144('0x6b')](),'closedAt':_0x2d0651['closed']?moment(_0x2d0651['closedAt'])[_0xd144('0x5a')](_0xd144('0x48'))[_0xd144('0x6b')]():'','disposition':_0x2d0651['disposition'],'visibility':_0x2d0651[_0xd144('0x6c')]?_0xd144('0x6d'):_0xd144('0x6e'),'messages':_(_0x2d0651[_0xd144('0x6f')])[_0xd144('0x45')]({'secret':![]})['map'](function(_0x2ff9a1){if(_0x2ff9a1[_0xd144('0x62')]){var _0x2f9615=path[_0xd144('0x55')](_0x46664a,_0x2ff9a1[_0xd144('0x62')]['basename']);if(fs[_0xd144('0x70')](_0x2f9615)){fs[_0xd144('0x71')](_0x2f9615)[_0xd144('0x72')](fs[_0xd144('0x73')](path['join'](_0x3aefef,_0x2ff9a1[_0xd144('0x62')][_0xd144('0x74')])));}}return{'date':moment(_0x2ff9a1[_0xd144('0x63')])[_0xd144('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd144('0x6b')](),'sender':_0x2ff9a1[_0xd144('0x75')]===_0xd144('0x76')?_0x2ff9a1[_0xd144('0x5d')]?_0x2ff9a1[_0xd144('0x5d')][_0xd144('0x5e')]:_0xd144('0x77'):_0x2ff9a1[_0xd144('0x5f')][_0xd144('0x60')]+(_0x2ff9a1['Contact'][_0xd144('0x61')]?'\x20'+_0x2ff9a1[_0xd144('0x5f')][_0xd144('0x61')]:''),'body':_0x2ff9a1['Attachment']?_0x2ff9a1[_0xd144('0x62')][_0xd144('0x74')]:_0x2ff9a1['body'],'direction':_0x2ff9a1[_0xd144('0x75')]===_0xd144('0x76')?'A':'C','secret':_0x2ff9a1[_0xd144('0x64')],'read':_0x2ff9a1[_0xd144('0x65')],'attachment':_0x2ff9a1['Attachment']};})[_0xd144('0x78')]()};return ejs[_0xd144('0x79')](path['join'](config[_0xd144('0x57')],'server',_0xd144('0x7a'),_0xd144('0x7b')),{'interaction':_0x4e8d93})[_0xd144('0x1b')](function(_0x1c9b15){var _0x3b63cd=path[_0xd144('0x55')](_0x3aefef,_0xd144('0x7c')+_0x2d0651['id']+'-'+_0x14fc2a+_0xd144('0x7d'));var _0x2667d2={'path':_0x3b63cd,'channel':_0xd144('0x7e'),'interactionId':_0x2d0651['id']};return pdf['createPdfFromHTML'](_0x1c9b15,_0x2667d2);})['then'](function(){return new Promise(function(_0x1a4273,_0x888e50){zipdir(_0x3aefef,{'saveTo':_0x1ca47a},function(_0x37eddb,_0x384513){if(_0x37eddb)return _0x888e50(_0x37eddb);return _0x1a4273(_0x384513);});})[_0xd144('0x1b')](function(){return new Promise(function(_0x2c2eec,_0x4ea817){rimraf(_0x3aefef,function(_0x769896){if(_0x769896)_0x4ea817(_0x769896);return _0x2c2eec();});});})[_0xd144('0x1b')](function(){return _0x3276aa[_0xd144('0x53')](_0x1ca47a,_0x1925fc,function(_0x2b57a9){if(_0x2b57a9){logger[_0xd144('0x1c')](_0xd144('0x7f'),_0x2b57a9);}else{fs[_0xd144('0x80')](_0x1ca47a);}});});});}else{return _0x3276aa[_0xd144('0x11')](0xc8);}})[_0xd144('0x27')](handleError(_0x3276aa,null));}; \ No newline at end of file +var _0xb5c0=['transcript-%d-%s.zip','User','fullname','push','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','System','lastName','out','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','stack','name','index','map','OpenchannelInteraction','type','key','getOptions','findAll','openchannel','user','catch','show','query','from','params','rawAttributes','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','pick','where','filter','$gte','split','format','options','OpenchannelMessage','include','rows','addTags','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments'];(function(_0x341e16,_0x5b7929){var _0x5f3224=function(_0x58002c){while(--_0x58002c){_0x341e16['push'](_0x341e16['shift']());}};_0x5f3224(++_0x5b7929);}(_0xb5c0,0x1ad));var _0x0b5c=function(_0x4e62ed,_0x3ba0c0){_0x4e62ed=_0x4e62ed-0x0;var _0x528c21=_0xb5c0[_0x4e62ed];return _0x528c21;};'use strict';var rimraf=require(_0x0b5c('0x0'));var zipdir=require(_0x0b5c('0x1'));var moment=require(_0x0b5c('0x2'));var util=require(_0x0b5c('0x3'));var path=require(_0x0b5c('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x0b5c('0x5'));var interaction=require(_0x0b5c('0x6'));var qs=require(_0x0b5c('0x7'));var pdf=require(_0x0b5c('0x8'));var logger=require(_0x0b5c('0x9'))(_0x0b5c('0xa'));var config=require(_0x0b5c('0xb'));var db=require('../../mysqldb')['db'];config[_0x0b5c('0xc')]=_[_0x0b5c('0xd')](config[_0x0b5c('0xc')],{'host':_0x0b5c('0xe'),'port':0x18eb});var socket=require(_0x0b5c('0xf'))(new Redis(config[_0x0b5c('0xc')]));require(_0x0b5c('0x10'))[_0x0b5c('0x11')](socket);function respondWithStatusCode(_0x1172a0,_0xfe4af){_0xfe4af=_0xfe4af||0xcc;return function(_0x1cb8e6){if(_0x1cb8e6){return _0x1172a0[_0x0b5c('0x12')](_0xfe4af);}return _0x1172a0[_0x0b5c('0x13')](_0xfe4af)[_0x0b5c('0x14')]();};}function respondWithResult(_0x8d7678,_0x11c1bf){_0x11c1bf=_0x11c1bf||0xc8;return function(_0xbf08b9){if(_0xbf08b9){return _0x8d7678['status'](_0x11c1bf)[_0x0b5c('0x15')](_0xbf08b9);}};}function respondWithFilteredResult(_0xbd113b,_0x56fa9b){return function(_0xe638c3){if(_0xe638c3){var _0x559f8c=typeof _0x56fa9b[_0x0b5c('0x16')]===_0x0b5c('0x17')&&typeof _0x56fa9b[_0x0b5c('0x18')]==='undefined';var _0x485d4b=_0xe638c3[_0x0b5c('0x19')];var _0x3a8452=_0x559f8c?0x0:_0x56fa9b[_0x0b5c('0x16')];var _0x221c61=_0x559f8c?_0xe638c3[_0x0b5c('0x19')]:_0x56fa9b[_0x0b5c('0x16')]+_0x56fa9b[_0x0b5c('0x18')];var _0x222e36;if(_0x221c61>=_0x485d4b){_0x221c61=_0x485d4b;_0x222e36=0xc8;}else{_0x222e36=0xce;}_0xbd113b[_0x0b5c('0x13')](_0x222e36);return _0xbd113b[_0x0b5c('0x1a')]('Content-Range',_0x3a8452+'-'+_0x221c61+'/'+_0x485d4b)[_0x0b5c('0x15')](_0xe638c3);}return null;};}function saveUpdates(_0x911d){return function(_0x2a0e5d){if(_0x2a0e5d){return _0x2a0e5d[_0x0b5c('0x1b')](_0x911d)[_0x0b5c('0x1c')](function(_0x5798f7){return _0x5798f7;});}return null;};}function removeEntity(_0x287cb9){return function(_0x424a05){if(_0x424a05){return _0x424a05['destroy']()[_0x0b5c('0x1c')](function(){_0x287cb9[_0x0b5c('0x13')](0xcc)[_0x0b5c('0x14')]();});}};}function handleEntityNotFound(_0x528839){return function(_0x532efa){if(!_0x532efa){_0x528839[_0x0b5c('0x12')](0x194);}return _0x532efa;};}function handleError(_0x5aa2af,_0x7039f8){_0x7039f8=_0x7039f8||0x1f4;return function(_0x476313){logger['error'](_0x476313[_0x0b5c('0x1d')]);if(_0x476313[_0x0b5c('0x1e')]){delete _0x476313[_0x0b5c('0x1e')];}_0x5aa2af[_0x0b5c('0x13')](_0x7039f8)['send'](_0x476313);};}exports[_0x0b5c('0x1f')]=function(_0x49e3be,_0x593a1c){var _0x218694={};var _0x5029b7=_[_0x0b5c('0x20')](db[_0x0b5c('0x21')]['rawAttributes'],function(_0x498330){return{'name':_0x498330['fieldName'],'type':_0x498330[_0x0b5c('0x22')][_0x0b5c('0x23')]};});_0x218694=qs[_0x0b5c('0x24')](_0x5029b7,_0x49e3be);return interaction[_0x0b5c('0x25')](_0x0b5c('0x26'),_0x49e3be['query'],_0x49e3be[_0x0b5c('0x27')],_0x218694,_0x5029b7)['then'](respondWithFilteredResult(_0x593a1c,_0x218694))[_0x0b5c('0x28')](handleError(_0x593a1c,null));};exports[_0x0b5c('0x29')]=function(_0x2d17b2,_0xb41269){var _0xd30c03={};if(_0x2d17b2[_0x0b5c('0x2a')][_0x0b5c('0x22')]&&_0x2d17b2[_0x0b5c('0x2a')][_0x0b5c('0x22')]==='from'){_0xd30c03[_0x0b5c('0x2b')]=_0x2d17b2[_0x0b5c('0x2c')]['id'];}else{_0xd30c03['id']=_0x2d17b2[_0x0b5c('0x2c')]['id'];}var _0x1aa63c={'raw':![],'where':_0xd30c03},_0x441906={};_0x441906['model']=_['keys'](db[_0x0b5c('0x21')][_0x0b5c('0x2d')]);_0x441906[_0x0b5c('0x2a')]=_[_0x0b5c('0x2e')](_0x2d17b2[_0x0b5c('0x2a')]);_0x441906[_0x0b5c('0x2f')]=_[_0x0b5c('0x30')](_0x441906[_0x0b5c('0x31')],_0x441906[_0x0b5c('0x2a')]);_0x1aa63c[_0x0b5c('0x32')]=_[_0x0b5c('0x30')](_0x441906[_0x0b5c('0x31')],qs[_0x0b5c('0x33')](_0x2d17b2[_0x0b5c('0x2a')]['fields']));_0x1aa63c[_0x0b5c('0x32')]=_0x1aa63c['attributes'][_0x0b5c('0x34')]?_0x1aa63c[_0x0b5c('0x32')]:_0x441906[_0x0b5c('0x31')];if(_0x2d17b2[_0x0b5c('0x2a')][_0x0b5c('0x35')]){_0x1aa63c['include']=[{'all':!![]}];}_0x1aa63c=_[_0x0b5c('0x36')]({},_0x1aa63c,_0x2d17b2['options']);return db[_0x0b5c('0x21')][_0x0b5c('0x37')](_0x1aa63c)[_0x0b5c('0x1c')](handleEntityNotFound(_0xb41269,null))[_0x0b5c('0x1c')](respondWithResult(_0xb41269,null))[_0x0b5c('0x28')](handleError(_0xb41269,null));};exports[_0x0b5c('0x38')]=function(_0x56c9f5,_0x51a1b9){return db[_0x0b5c('0x21')][_0x0b5c('0x38')](_0x56c9f5['body'],{})[_0x0b5c('0x1c')](respondWithResult(_0x51a1b9,0xc9))[_0x0b5c('0x28')](handleError(_0x51a1b9,null));};exports['update']=function(_0x289e78,_0x2b1280){if(_0x289e78['body']['id']){delete _0x289e78[_0x0b5c('0x39')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x289e78[_0x0b5c('0x2c')]['id']}})[_0x0b5c('0x1c')](handleEntityNotFound(_0x2b1280,null))[_0x0b5c('0x1c')](saveUpdates(_0x289e78[_0x0b5c('0x39')],null))[_0x0b5c('0x1c')](respondWithResult(_0x2b1280,null))['catch'](handleError(_0x2b1280,null));};exports[_0x0b5c('0x3a')]=function(_0x51fd2b,_0x193a6b){return db[_0x0b5c('0x21')][_0x0b5c('0x37')]({'where':{'id':_0x51fd2b[_0x0b5c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x193a6b,null))[_0x0b5c('0x1c')](removeEntity(_0x193a6b,null))['catch'](handleError(_0x193a6b,null));};exports[_0x0b5c('0x3b')]=function(_0x962d31,_0xe52698){return db[_0x0b5c('0x21')]['describe']()[_0x0b5c('0x1c')](respondWithResult(_0xe52698,null))['catch'](handleError(_0xe52698,null));};exports[_0x0b5c('0x3c')]=function(_0x505643,_0x4ca7d5){return db['OpenchannelMessage'][_0x0b5c('0x37')]({'where':{'id':_0x505643[_0x0b5c('0x2c')]['id']}})[_0x0b5c('0x1c')](handleEntityNotFound(_0x4ca7d5,null))['then'](function(_0x56e971){if(_0x56e971){return _0x56e971[_0x0b5c('0x3c')](_0x505643[_0x0b5c('0x39')][_0x0b5c('0x3d')],_[_0x0b5c('0x3e')](_0x505643['body'],['ids','id'])||{});}})[_0x0b5c('0x1c')](respondWithResult(_0x4ca7d5,null))[_0x0b5c('0x28')](handleError(_0x4ca7d5,null));};exports[_0x0b5c('0x3f')]=function(_0x59b0e2,_0x314ba4){var _0x1807bb={'raw':![],'where':{}};var _0x26867c={};var _0x2a0416={'count':0x0,'rows':[]};return db[_0x0b5c('0x21')][_0x0b5c('0x40')]({'where':{'id':_0x59b0e2[_0x0b5c('0x2c')]['id']}})[_0x0b5c('0x1c')](handleEntityNotFound(_0x314ba4,null))[_0x0b5c('0x1c')](function(_0x3cb30a){if(_0x3cb30a){_0x26867c[_0x0b5c('0x31')]=_['keys'](db['OpenchannelMessage'][_0x0b5c('0x2d')]);_0x26867c[_0x0b5c('0x2a')]=_[_0x0b5c('0x2e')](_0x59b0e2['query']);_0x26867c[_0x0b5c('0x2f')]=_[_0x0b5c('0x30')](_0x26867c[_0x0b5c('0x31')],_0x26867c[_0x0b5c('0x2a')]);_0x1807bb[_0x0b5c('0x32')]=_[_0x0b5c('0x30')](_0x26867c[_0x0b5c('0x31')],qs['fields'](_0x59b0e2[_0x0b5c('0x2a')]['fields']));_0x1807bb[_0x0b5c('0x32')]=_0x1807bb['attributes'][_0x0b5c('0x34')]?_0x1807bb['attributes']:_0x26867c[_0x0b5c('0x31')];if(!_0x59b0e2['query'][_0x0b5c('0x41')]('nolimit')){_0x1807bb[_0x0b5c('0x18')]=qs[_0x0b5c('0x18')](_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x18')]);_0x1807bb['offset']=qs['offset'](_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x16')]);}_0x1807bb[_0x0b5c('0x42')]=qs[_0x0b5c('0x43')](_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x43')]);_0x1807bb['where']=qs[_0x0b5c('0x2f')](_[_0x0b5c('0x44')](_0x59b0e2[_0x0b5c('0x2a')],_0x26867c[_0x0b5c('0x2f')]));_0x1807bb[_0x0b5c('0x45')]['OpenchannelInteractionId']=_0x3cb30a['id'];if(_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x46')]){_0x1807bb[_0x0b5c('0x45')]=_[_0x0b5c('0x36')](_0x1807bb['where'],{'$or':_[_0x0b5c('0x20')](_0x1807bb[_0x0b5c('0x32')],function(_0x3e078d){var _0x257d14={};_0x257d14[_0x3e078d]={'$like':'%'+_0x59b0e2['query'][_0x0b5c('0x46')]+'%'};return _0x257d14;})});}if(_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x47')]){var _0x2f3445=_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x47')][_0x0b5c('0x48')](',');var _0x409407={};_0x409407[_0x2f3445[0x0]]={'$gte':moment(_0x2f3445[0x1])[_0x0b5c('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1807bb['where']=_['merge'](_0x1807bb['where'],_0x409407);}_0x1807bb=_[_0x0b5c('0x36')]({},_0x1807bb,_0x59b0e2[_0x0b5c('0x4a')]);return db[_0x0b5c('0x4b')]['count']({'where':_0x1807bb['where']})['then'](function(_0x972c31){_0x2a0416[_0x0b5c('0x19')]=_0x972c31;if(_0x59b0e2[_0x0b5c('0x2a')][_0x0b5c('0x35')]){_0x1807bb[_0x0b5c('0x4c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0b5c('0x25')](_0x1807bb);})[_0x0b5c('0x1c')](function(_0x265f74){_0x2a0416[_0x0b5c('0x4d')]=_0x265f74;return _0x2a0416;});}})['then'](respondWithFilteredResult(_0x314ba4,_0x1807bb))[_0x0b5c('0x28')](handleError(_0x314ba4,null));};exports[_0x0b5c('0x4e')]=function(_0x5af1cc,_0x5d9e87){return db[_0x0b5c('0x21')][_0x0b5c('0x37')]({'where':{'id':_0x5af1cc[_0x0b5c('0x2c')]['id']}})[_0x0b5c('0x1c')](handleEntityNotFound(_0x5d9e87,null))[_0x0b5c('0x1c')](function(_0x329fc6){if(_0x329fc6){return _0x329fc6['setTags'](_0x5af1cc['body']['ids'],_[_0x0b5c('0x3e')](_0x5af1cc['body'],[_0x0b5c('0x3d'),'id'])||{})['spread'](function(){return db[_0x0b5c('0x4f')][_0x0b5c('0x25')]({'attributes':['id',_0x0b5c('0x1e'),'color'],'where':{'id':_0x5af1cc[_0x0b5c('0x39')][_0x0b5c('0x3d')]}});})['then'](function(_0x1a8e48){socket[_0x0b5c('0x50')](_0x0b5c('0x51'),{'id':Number(_0x5af1cc[_0x0b5c('0x2c')]['id']),'tags':_0x1a8e48||[]});return{'id':Number(_0x5af1cc[_0x0b5c('0x2c')]['id']),'tags':_0x1a8e48||[]};});}})[_0x0b5c('0x1c')](respondWithResult(_0x5d9e87,null))[_0x0b5c('0x28')](handleError(_0x5d9e87,null));};exports[_0x0b5c('0x52')]=function(_0x4ebb05,_0x5d3724){return db['OpenchannelInteraction'][_0x0b5c('0x37')]({'where':{'id':_0x4ebb05[_0x0b5c('0x2c')]['id']}})[_0x0b5c('0x1c')](handleEntityNotFound(_0x5d3724,null))[_0x0b5c('0x1c')](function(_0x2aa968){if(_0x2aa968){return _0x2aa968[_0x0b5c('0x52')](_0x4ebb05[_0x0b5c('0x2a')][_0x0b5c('0x3d')]);}})[_0x0b5c('0x1c')](respondWithStatusCode(_0x5d3724,null))[_0x0b5c('0x28')](handleError(_0x5d3724,null));};exports[_0x0b5c('0x53')]=function(_0xef070a,_0x571a39){var _0xc819f5=moment()[_0x0b5c('0x54')]()[_0x0b5c('0x55')]();var _0x44d404=path[_0x0b5c('0x56')](config[_0x0b5c('0x57')],_0x0b5c('0x58'),_0x0b5c('0x59'),'tmp');var _0xf90168=path[_0x0b5c('0x56')](config[_0x0b5c('0x57')],_0x0b5c('0x58'),_0x0b5c('0x59'),_0x0b5c('0x5a'));var _0x4381ad=path[_0x0b5c('0x56')](_0x44d404,_0xc819f5);var _0x15ca7a=util[_0x0b5c('0x49')](_0x0b5c('0x5b'),_0xef070a['params']['id'],_0xc819f5);var _0x53c6bd=path[_0x0b5c('0x56')](_0x44d404,_0x15ca7a);var _0x336140=[];_0x336140['push']({'model':db[_0x0b5c('0x5c')],'as':'User','attributes':['id',_0x0b5c('0x5d')],'raw':!![]});_0x336140[_0x0b5c('0x5e')]({'model':db['CmContact'],'as':_0x0b5c('0x5f'),'attributes':['id',_0x0b5c('0x60'),'lastName'],'raw':!![]});if(_0xef070a[_0x0b5c('0x2a')][_0x0b5c('0x5a')]){_0x336140[_0x0b5c('0x5e')]({'model':db[_0x0b5c('0x61')],'as':_0x0b5c('0x61'),'raw':!![]});}var _0x436b03=[{'model':db[_0x0b5c('0x4b')],'as':_0x0b5c('0x62'),'attributes':['id',_0x0b5c('0x39'),_0x0b5c('0x63'),_0x0b5c('0x64'),_0x0b5c('0x65'),_0x0b5c('0x66')],'include':_0x336140}];_0x436b03[_0x0b5c('0x5e')]({'model':db[_0x0b5c('0x67')],'as':_0x0b5c('0x68'),'attributes':['id',_0x0b5c('0x1e')]});_0x436b03[_0x0b5c('0x5e')]({'model':db[_0x0b5c('0x5c')],'as':_0x0b5c('0x69'),'attributes':['id',_0x0b5c('0x5d')]});return db[_0x0b5c('0x21')][_0x0b5c('0x37')]({'where':{'id':_0xef070a[_0x0b5c('0x2c')]['id']},'include':_0x436b03})['then'](handleEntityNotFound(_0x571a39,null))[_0x0b5c('0x1c')](function(_0x470dbc){if(_0x470dbc){var _0x3ca102=_0x470dbc[_0x0b5c('0x6a')]({'plain':!![]});fs[_0x0b5c('0x6b')](_0x4381ad);var _0x3bc028={'channel':_0x0b5c('0x6c'),'account':_0x3ca102['Account']['name'],'agent':_0x3ca102[_0x0b5c('0x69')]?_0x3ca102[_0x0b5c('0x69')][_0x0b5c('0x5d')]:'N.A.','createdAt':moment(_0x3ca102['createdAt'])[_0x0b5c('0x49')](_0x0b5c('0x6d'))[_0x0b5c('0x55')](),'closedAt':_0x3ca102['closed']?moment(_0x3ca102[_0x0b5c('0x6e')])['format'](_0x0b5c('0x6d'))['toString']():'','disposition':_0x3ca102[_0x0b5c('0x6f')],'visibility':_0x3ca102[_0x0b5c('0x70')]?_0x0b5c('0x71'):_0x0b5c('0x72'),'messages':_(_0x3ca102[_0x0b5c('0x62')])[_0x0b5c('0x46')]({'secret':![]})[_0x0b5c('0x20')](function(_0x2b3923){if(_0x2b3923[_0x0b5c('0x61')]){var _0x3c1114=path['join'](_0xf90168,_0x2b3923[_0x0b5c('0x61')][_0x0b5c('0x73')]);if(fs['existsSync'](_0x3c1114)){fs[_0x0b5c('0x74')](_0x3c1114)[_0x0b5c('0x75')](fs[_0x0b5c('0x76')](path[_0x0b5c('0x56')](_0x4381ad,_0x2b3923[_0x0b5c('0x61')][_0x0b5c('0x73')])));}}return{'date':moment(_0x2b3923[_0x0b5c('0x63')])[_0x0b5c('0x49')](_0x0b5c('0x6d'))['toString'](),'sender':_0x2b3923[_0x0b5c('0x64')]==='out'?_0x2b3923[_0x0b5c('0x5c')]?_0x2b3923[_0x0b5c('0x5c')][_0x0b5c('0x5d')]:_0x0b5c('0x77'):_0x2b3923[_0x0b5c('0x5f')][_0x0b5c('0x60')]+(_0x2b3923[_0x0b5c('0x5f')][_0x0b5c('0x78')]?'\x20'+_0x2b3923['Contact'][_0x0b5c('0x78')]:''),'body':_0x2b3923[_0x0b5c('0x61')]?_0x2b3923[_0x0b5c('0x61')]['basename']:_0x2b3923[_0x0b5c('0x39')],'direction':_0x2b3923[_0x0b5c('0x64')]===_0x0b5c('0x79')?'A':'C','secret':_0x2b3923[_0x0b5c('0x65')],'read':_0x2b3923[_0x0b5c('0x66')],'attachment':_0x2b3923[_0x0b5c('0x61')]};})['value']()};return ejs[_0x0b5c('0x7a')](path['join'](config[_0x0b5c('0x57')],_0x0b5c('0x58'),_0x0b5c('0x7b'),_0x0b5c('0x7c')),{'interaction':_0x3bc028})[_0x0b5c('0x1c')](function(_0x23a6e9){var _0x4a9f31=path[_0x0b5c('0x56')](_0x4381ad,'transcript-'+_0x3ca102['id']+'-'+_0xc819f5+_0x0b5c('0x7d'));var _0x3e3da4={'path':_0x4a9f31,'channel':_0x0b5c('0x6c'),'interactionId':_0x3ca102['id']};return pdf[_0x0b5c('0x7e')](_0x23a6e9,_0x3e3da4);})[_0x0b5c('0x1c')](function(){return new Promise(function(_0x413bca,_0x1b161b){zipdir(_0x4381ad,{'saveTo':_0x53c6bd},function(_0x46a4fb,_0x28a2c1){if(_0x46a4fb)return _0x1b161b(_0x46a4fb);return _0x413bca(_0x28a2c1);});})[_0x0b5c('0x1c')](function(){return new Promise(function(_0x3034d4,_0x3bd988){rimraf(_0x4381ad,function(_0xbb73a0){if(_0xbb73a0)_0x3bd988(_0xbb73a0);return _0x3034d4();});});})[_0x0b5c('0x1c')](function(){return _0x571a39['download'](_0x53c6bd,_0x15ca7a,function(_0x268ecf){if(_0x268ecf){logger[_0x0b5c('0x7f')](_0x0b5c('0x80'),_0x268ecf);}else{fs[_0x0b5c('0x81')](_0x53c6bd);}});});});}else{return _0x571a39[_0x0b5c('0x12')](0xc8);}})[_0x0b5c('0x28')](handleError(_0x571a39,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 63a9510..773e162 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 _0x9c49=['exports','events','../../mysqldb','setMaxListeners','update','getUsers','setDataValue','map','then','unreadMessages','emit','catch','hook'];(function(_0x25fa3b,_0x57ab14){var _0x147210=function(_0x540989){while(--_0x540989){_0x25fa3b['push'](_0x25fa3b['shift']());}};_0x147210(++_0x57ab14);}(_0x9c49,0x1c8));var _0x99c4=function(_0x451e9a,_0x352964){_0x451e9a=_0x451e9a-0x0;var _0x5bd0cd=_0x9c49[_0x451e9a];return _0x5bd0cd;};'use strict';var EventEmitter=require(_0x99c4('0x0'));var OpenchannelInteraction=require(_0x99c4('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x99c4('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x99c4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x99c4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d9f30){return function(_0x57ab54,_0x4db02c,_0x433661){_0x57ab54[_0x99c4('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0xc213a2){_0x57ab54[_0x99c4('0x5')]('Users',_0xc213a2[_0x99c4('0x6')](function(_0x54a241){return{'id':_0x54a241['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x57ab54['id'],'direction':'in','read':![]},'raw':!![]});})[_0x99c4('0x7')](function(_0x4a5997){_0x57ab54[_0x99c4('0x5')](_0x99c4('0x8'),_0x4a5997['length']);OpenchannelInteractionEvents[_0x99c4('0x9')](_0x3d9f30+':'+_0x57ab54['id'],_0x57ab54);OpenchannelInteractionEvents[_0x99c4('0x9')](_0x3d9f30,_0x57ab54);_0x433661(null);})[_0x99c4('0xa')](_0x433661(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x99c4('0xb')](e,emitEvent(event));}}module[_0x99c4('0xc')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x343a=['remove','getUsers','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x20685a,_0x1afc7c){var _0xdd670e=function(_0x56891c){while(--_0x56891c){_0x20685a['push'](_0x20685a['shift']());}};_0xdd670e(++_0x1afc7c);}(_0x343a,0x1f1));var _0xa343=function(_0x2d311a,_0x4e4472){_0x2d311a=_0x2d311a-0x0;var _0x37b895=_0x343a[_0x2d311a];return _0x37b895;};'use strict';var EventEmitter=require(_0xa343('0x0'));var OpenchannelInteraction=require(_0xa343('0x1'))['db'][_0xa343('0x2')];var OpenchannelMessage=require(_0xa343('0x1'))['db'][_0xa343('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa343('0x4')](0x0);var events={'afterCreate':_0xa343('0x5'),'afterUpdate':_0xa343('0x6'),'afterDestroy':_0xa343('0x7')};function emitEvent(_0xfe0fc){return function(_0x3de8ef,_0x4088ad,_0x206d86){_0x3de8ef[_0xa343('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x39a49e){_0x3de8ef['setDataValue'](_0xa343('0x9'),_0x39a49e[_0xa343('0xa')](function(_0x227856){return{'id':_0x227856['id']};}));return OpenchannelMessage[_0xa343('0xb')]({'where':{'OpenchannelInteractionId':_0x3de8ef['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5258fc){_0x3de8ef[_0xa343('0xc')](_0xa343('0xd'),_0x5258fc['length']);OpenchannelInteractionEvents[_0xa343('0xe')](_0xfe0fc+':'+_0x3de8ef['id'],_0x3de8ef);OpenchannelInteractionEvents['emit'](_0xfe0fc,_0x3de8ef);_0x206d86(null);})[_0xa343('0xf')](_0x206d86(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xa343('0x10')](e,emitEvent(event));}}module[_0xa343('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 77e9080..8eb5a06 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 _0x4ec4=['utf8mb4','utf8mb4_unicode_ci','changed','closed','format','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x5f036e,_0x5ef0da){var _0x593b9b=function(_0x45fb24){while(--_0x45fb24){_0x5f036e['push'](_0x5f036e['shift']());}};_0x593b9b(++_0x5ef0da);}(_0x4ec4,0x125));var _0x44ec=function(_0x53ddcb,_0xc1a547){_0x53ddcb=_0x53ddcb-0x0;var _0x48afdb=_0x4ec4[_0x53ddcb];return _0x48afdb;};'use strict';var _=require(_0x44ec('0x0'));var util=require(_0x44ec('0x1'));var logger=require(_0x44ec('0x2'))('api');var moment=require(_0x44ec('0x3'));var BPromise=require(_0x44ec('0x4'));var rp=require(_0x44ec('0x5'));var fs=require('fs');var path=require(_0x44ec('0x6'));var rimraf=require(_0x44ec('0x7'));var config=require(_0x44ec('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x44ec('0x9')]=function(_0x16b97d,_0x525902){return _0x16b97d[_0x44ec('0xa')](_0x44ec('0xb'),attributes,{'tableName':_0x44ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x44ec('0xd'),'collate':_0x44ec('0xe'),'hooks':{'beforeUpdate':function(_0x750cac,_0x11f248,_0x49beea){if(_0x750cac[_0x44ec('0xf')](_0x44ec('0x10'))){_0x750cac['closedAt']=moment()[_0x44ec('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x49beea(null,_0x750cac);}}});}; \ No newline at end of file +var _0x17bf=['api','moment','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x3ee1a1,_0x28152b){var _0x166cb1=function(_0x3d6c9e){while(--_0x3d6c9e){_0x3ee1a1['push'](_0x3ee1a1['shift']());}};_0x166cb1(++_0x28152b);}(_0x17bf,0x11d));var _0xf17b=function(_0x5ce650,_0x5c377a){_0x5ce650=_0x5ce650-0x0;var _0x1eadbd=_0x17bf[_0x5ce650];return _0x1eadbd;};'use strict';var _=require(_0xf17b('0x0'));var util=require(_0xf17b('0x1'));var logger=require(_0xf17b('0x2'))(_0xf17b('0x3'));var moment=require(_0xf17b('0x4'));var BPromise=require(_0xf17b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf17b('0x6'));var config=require(_0xf17b('0x7'));var attributes=require(_0xf17b('0x8'));module[_0xf17b('0x9')]=function(_0x209017,_0x4635f7){return _0x209017['define'](_0xf17b('0xa'),attributes,{'tableName':_0xf17b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf17b('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x25b76c,_0x4d8de2,_0xa953c1){if(_0x25b76c['changed'](_0xf17b('0xd'))){_0x25b76c['closedAt']=moment()[_0xf17b('0xe')](_0xf17b('0xf'));}_0xa953c1(null,_0x25b76c);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 190f279..918ce80 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 _0x2a46=['OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','body','options','where','attributes','limit','OpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info'];(function(_0xe641ba,_0x421140){var _0x3eabe7=function(_0x4c4d18){while(--_0x4c4d18){_0xe641ba['push'](_0xe641ba['shift']());}};_0x3eabe7(++_0x421140);}(_0x2a46,0xfa));var _0x62a4=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x2a46[_0x2fee96];return _0x2e6ad1;};'use strict';var _=require(_0x62a4('0x0'));var util=require('util');var moment=require(_0x62a4('0x1'));var BPromise=require(_0x62a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x62a4('0x3'));var config=require(_0x62a4('0x4'));var jayson=require(_0x62a4('0x5'));var client=jayson[_0x62a4('0x6')]['http']({'port':0x232a});config['redis']=_[_0x62a4('0x7')](config[_0x62a4('0x8')],{'host':_0x62a4('0x9'),'port':0x18eb});var socket=require(_0x62a4('0xa'))(new Redis(config[_0x62a4('0x8')]));require(_0x62a4('0xb'))[_0x62a4('0xc')](socket);function respondWithRpcPromise(_0x4c835d,_0x3d1b90,_0x1c1f9a){return new BPromise(function(_0x16a051,_0xdafe54){return client[_0x62a4('0xd')](_0x4c835d,_0x1c1f9a)[_0x62a4('0xe')](function(_0x1af4af){logger[_0x62a4('0xf')](_0x62a4('0x10'),_0x3d1b90,'request\x20sent');logger[_0x62a4('0x11')](_0x62a4('0x12'),_0x3d1b90,_0x62a4('0x13'),JSON[_0x62a4('0x14')](_0x1af4af));if(_0x1af4af[_0x62a4('0x15')]){if(_0x1af4af[_0x62a4('0x15')][_0x62a4('0x16')]===0x1f4){logger[_0x62a4('0x15')](_0x62a4('0x10'),_0x3d1b90,_0x1af4af[_0x62a4('0x15')][_0x62a4('0x17')]);return _0xdafe54(_0x1af4af[_0x62a4('0x15')]['message']);}logger[_0x62a4('0x15')](_0x62a4('0x10'),_0x3d1b90,_0x1af4af[_0x62a4('0x15')][_0x62a4('0x17')]);return _0x16a051(_0x1af4af[_0x62a4('0x15')][_0x62a4('0x17')]);}else{logger[_0x62a4('0xf')](_0x62a4('0x10'),_0x3d1b90,_0x62a4('0x13'));_0x16a051(_0x1af4af[_0x62a4('0x18')][_0x62a4('0x17')]);}})[_0x62a4('0x19')](function(_0x166529){logger[_0x62a4('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3d1b90,_0x166529);_0xdafe54(_0x166529);});});}exports[_0x62a4('0x1a')]=function(_0x606733){var _0x12d61f=this;return new Promise(function(_0x42e98e,_0x541405){return db['OpenchannelInteraction']['update'](_0x606733[_0x62a4('0x1b')],{'raw':_0x606733[_0x62a4('0x1c')]?_0x606733['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x606733[_0x62a4('0x1c')]?_0x606733['options'][_0x62a4('0x1d')]||null:null,'attributes':_0x606733[_0x62a4('0x1c')]?_0x606733[_0x62a4('0x1c')][_0x62a4('0x1e')]||null:null,'limit':_0x606733[_0x62a4('0x1c')]?_0x606733[_0x62a4('0x1c')][_0x62a4('0x1f')]||null:null})[_0x62a4('0xe')](function(_0x309993){logger['info'](_0x62a4('0x1a'),_0x606733);logger[_0x62a4('0x11')](_0x62a4('0x1a'),_0x606733,JSON[_0x62a4('0x14')](_0x309993));_0x42e98e(_0x309993);})['catch'](function(_0x42b72f){logger[_0x62a4('0x15')](_0x62a4('0x1a'),_0x42b72f[_0x62a4('0x17')],_0x606733);_0x541405(_0x12d61f[_0x62a4('0x15')](0x1f4,_0x42b72f[_0x62a4('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x29688f){return new Promise(function(_0x37c926,_0x448f74){return db[_0x62a4('0x20')][_0x62a4('0x21')]({'where':_0x29688f[_0x62a4('0x1c')]?_0x29688f[_0x62a4('0x1c')][_0x62a4('0x1d')]||null:null})['then'](function(_0x582c80){if(_0x582c80){return _0x582c80[_0x62a4('0x22')](_0x29688f[_0x62a4('0x1b')][_0x62a4('0x23')],_['omit'](_0x29688f[_0x62a4('0x1b')],[_0x62a4('0x23'),'id'])||{});}})[_0x62a4('0x24')](function(_0xb09293){logger[_0x62a4('0xf')](_0x62a4('0x25'),_0x29688f);logger[_0x62a4('0x11')](_0x62a4('0x25'),_0x29688f,JSON['stringify'](_0xb09293));_0x37c926(_0xb09293);})[_0x62a4('0x19')](function(_0x498fdb){logger[_0x62a4('0x15')](_0x62a4('0x25'),_0x498fdb[_0x62a4('0x17')],_0x29688f);_0x448f74(_this[_0x62a4('0x15')](0x1f4,_0x498fdb[_0x62a4('0x17')]));});});}; \ No newline at end of file +var _0xcc24=['message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','debug','stringify','AddTagsToOpenchannelInteraction','find','where','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc24,0x91));var _0x4cc2=function(_0x4caaa0,_0x4b578e){_0x4caaa0=_0x4caaa0-0x0;var _0x544dda=_0xcc24[_0x4caaa0];return _0x544dda;};'use strict';var _=require(_0x4cc2('0x0'));var util=require(_0x4cc2('0x1'));var moment=require(_0x4cc2('0x2'));var BPromise=require(_0x4cc2('0x3'));var rs=require(_0x4cc2('0x4'));var fs=require('fs');var Redis=require(_0x4cc2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4cc2('0x6'))(_0x4cc2('0x7'));var config=require(_0x4cc2('0x8'));var jayson=require(_0x4cc2('0x9'));var client=jayson['client'][_0x4cc2('0xa')]({'port':0x232a});config[_0x4cc2('0xb')]=_[_0x4cc2('0xc')](config['redis'],{'host':_0x4cc2('0xd'),'port':0x18eb});var socket=require(_0x4cc2('0xe'))(new Redis(config[_0x4cc2('0xb')]));require('./openchannelInteraction.socket')[_0x4cc2('0xf')](socket);function respondWithRpcPromise(_0x5812ac,_0x2f0b8a,_0xc61915){return new BPromise(function(_0x4511f5,_0x1c8f49){return client[_0x4cc2('0x10')](_0x5812ac,_0xc61915)[_0x4cc2('0x11')](function(_0x2bc4c0){logger[_0x4cc2('0x12')](_0x4cc2('0x13'),_0x2f0b8a,_0x4cc2('0x14'));logger['debug'](_0x4cc2('0x15'),_0x2f0b8a,_0x4cc2('0x14'),JSON['stringify'](_0x2bc4c0));if(_0x2bc4c0['error']){if(_0x2bc4c0[_0x4cc2('0x16')]['code']===0x1f4){logger[_0x4cc2('0x16')](_0x4cc2('0x13'),_0x2f0b8a,_0x2bc4c0['error']['message']);return _0x1c8f49(_0x2bc4c0[_0x4cc2('0x16')][_0x4cc2('0x17')]);}logger[_0x4cc2('0x16')](_0x4cc2('0x13'),_0x2f0b8a,_0x2bc4c0['error'][_0x4cc2('0x17')]);return _0x4511f5(_0x2bc4c0[_0x4cc2('0x16')][_0x4cc2('0x17')]);}else{logger['info'](_0x4cc2('0x13'),_0x2f0b8a,'request\x20sent');_0x4511f5(_0x2bc4c0[_0x4cc2('0x18')]['message']);}})[_0x4cc2('0x19')](function(_0x3cf9a8){logger[_0x4cc2('0x16')](_0x4cc2('0x13'),_0x2f0b8a,_0x3cf9a8);_0x1c8f49(_0x3cf9a8);});});}exports[_0x4cc2('0x1a')]=function(_0x5da9ab){var _0x1e8ee1=this;return new Promise(function(_0x20c600,_0x45fa2b){return db[_0x4cc2('0x1b')][_0x4cc2('0x1c')](_0x5da9ab[_0x4cc2('0x1d')],{'raw':_0x5da9ab[_0x4cc2('0x1e')]?_0x5da9ab['options'][_0x4cc2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5da9ab[_0x4cc2('0x1e')]?_0x5da9ab['options']['where']||null:null,'attributes':_0x5da9ab['options']?_0x5da9ab[_0x4cc2('0x1e')][_0x4cc2('0x20')]||null:null,'limit':_0x5da9ab[_0x4cc2('0x1e')]?_0x5da9ab[_0x4cc2('0x1e')][_0x4cc2('0x21')]||null:null})[_0x4cc2('0x11')](function(_0x224b4a){logger[_0x4cc2('0x12')](_0x4cc2('0x1a'),_0x5da9ab);logger[_0x4cc2('0x22')](_0x4cc2('0x1a'),_0x5da9ab,JSON[_0x4cc2('0x23')](_0x224b4a));_0x20c600(_0x224b4a);})['catch'](function(_0x101f17){logger[_0x4cc2('0x16')](_0x4cc2('0x1a'),_0x101f17['message'],_0x5da9ab);_0x45fa2b(_0x1e8ee1['error'](0x1f4,_0x101f17['message']));});});};exports[_0x4cc2('0x24')]=function(_0x4f8ea5){return new Promise(function(_0x5eda5f,_0x367d07){return db[_0x4cc2('0x1b')][_0x4cc2('0x25')]({'where':_0x4f8ea5[_0x4cc2('0x1e')]?_0x4f8ea5[_0x4cc2('0x1e')][_0x4cc2('0x26')]||null:null})[_0x4cc2('0x11')](function(_0x4482c6){if(_0x4482c6){return _0x4482c6['addTags'](_0x4f8ea5[_0x4cc2('0x1d')][_0x4cc2('0x27')],_['omit'](_0x4f8ea5['body'],[_0x4cc2('0x27'),'id'])||{});}})[_0x4cc2('0x28')](function(_0x5c73f6){logger[_0x4cc2('0x12')](_0x4cc2('0x29'),_0x4f8ea5);logger['debug'](_0x4cc2('0x29'),_0x4f8ea5,JSON['stringify'](_0x5c73f6));_0x5eda5f(_0x5c73f6);})[_0x4cc2('0x19')](function(_0x17de5b){logger[_0x4cc2('0x16')]('AddTags',_0x17de5b[_0x4cc2('0x17')],_0x4f8ea5);_0x367d07(_this['error'](0x1f4,_0x17de5b[_0x4cc2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 8da52c0..a42dea9 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 _0x5cf2=['length','openchannelInteraction:','save','remove','update','removeListener','register'];(function(_0x259aaf,_0x5dbec1){var _0x366663=function(_0x24a61a){while(--_0x24a61a){_0x259aaf['push'](_0x259aaf['shift']());}};_0x366663(++_0x5dbec1);}(_0x5cf2,0x79));var _0x25cf=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0x5cf2[_0x595013];return _0x2a29e3;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x25cf('0x0'),_0x25cf('0x1'),_0x25cf('0x2')];function createListener(_0x21d698,_0x2511b2){return function(_0x38f934){_0x2511b2['emit'](_0x21d698,_0x38f934);};}function removeListener(_0x415bff,_0x56be9c){return function(){OpenchannelInteractionEvents[_0x25cf('0x3')](_0x415bff,_0x56be9c);};}exports[_0x25cf('0x4')]=function(_0x472b3f){for(var _0x5e00c1=0x0,_0x4dc8a0=events[_0x25cf('0x5')];_0x5e00c1<_0x4dc8a0;_0x5e00c1++){var _0x4388c4=events[_0x5e00c1];var _0x483792=createListener(_0x25cf('0x6')+_0x4388c4,_0x472b3f);OpenchannelInteractionEvents['on'](_0x4388c4,_0x483792);}}; \ No newline at end of file +var _0x6e07=['./openchannelInteraction.events','save','remove','update','emit','register','length','openchannelInteraction:'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x6e07,0xb8));var _0x76e0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6e07[_0x3947c9];return _0x2e7871;};'use strict';var OpenchannelInteractionEvents=require(_0x76e0('0x0'));var events=[_0x76e0('0x1'),_0x76e0('0x2'),_0x76e0('0x3')];function createListener(_0x3545fc,_0x4ea0d7){return function(_0x2744d1){_0x4ea0d7[_0x76e0('0x4')](_0x3545fc,_0x2744d1);};}function removeListener(_0x179a4d,_0x5c47e5){return function(){OpenchannelInteractionEvents['removeListener'](_0x179a4d,_0x5c47e5);};}exports[_0x76e0('0x5')]=function(_0x492fa6){for(var _0x1d5820=0x0,_0x2122e8=events[_0x76e0('0x6')];_0x1d5820<_0x2122e8;_0x1d5820++){var _0xbd4027=events[_0x1d5820];var _0x5c1f94=createListener(_0x76e0('0x7')+_0xbd4027,_0x492fa6);OpenchannelInteractionEvents['on'](_0xbd4027,_0x5c1f94);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6e0799d..f6de285 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x463cb2,_0x47d1e9){var _0xa1cccb=function(_0x3808a6){while(--_0x3808a6){_0x463cb2['push'](_0x463cb2['shift']());}};_0xa1cccb(++_0x47d1e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +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(_0x39c745,_0xa4b72a){var _0x3b4c9c=function(_0xe81398){while(--_0xe81398){_0x39c745['push'](_0x39c745['shift']());}};_0x3b4c9c(++_0xa4b72a);}(_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 f702cca..c280160 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 _0x96cc=['sequelize','TEXT','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96cc,0x16c));var _0xc96c=function(_0x1ce3cc,_0x4f0bfa){_0x1ce3cc=_0x1ce3cc-0x0;var _0x1de825=_0x96cc[_0x1ce3cc];return _0x1de825;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'body':{'type':Sequelize[_0xc96c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc96c('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc96c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc96c('0x3')]('in',_0xc96c('0x4')),'defaultValue':_0xc96c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc96c('0x5')]},'providerName':{'type':Sequelize[_0xc96c('0x6')]},'providerResponse':{'type':Sequelize[_0xc96c('0x1')]}}; \ No newline at end of file +var _0xb4f8=['medium','BOOLEAN','ENUM','out','STRING','exports','TEXT'];(function(_0x4cb92e,_0x3926c8){var _0x29079f=function(_0x2f538d){while(--_0x2f538d){_0x4cb92e['push'](_0x4cb92e['shift']());}};_0x29079f(++_0x3926c8);}(_0xb4f8,0x83));var _0x8b4f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb4f8[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x8b4f('0x0')]={'body':{'type':Sequelize[_0x8b4f('0x1')](_0x8b4f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8b4f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8b4f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8b4f('0x4')]('in','out'),'defaultValue':_0x8b4f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x8b4f('0x6')]},'providerResponse':{'type':Sequelize[_0x8b4f('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 45da05d..8d8e956 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 _0xc331=['stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','body','update','destroy','describe','accept','openchannel','acceptMessage','reject','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','agent','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./openchannelMessage.socket','register','jayson/promise','http','client','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','limit','count','set','Content-Range','end','sendStatus'];(function(_0x5d4e3b,_0x4c5743){var _0x459192=function(_0x5b3d74){while(--_0x5b3d74){_0x5d4e3b['push'](_0x5d4e3b['shift']());}};_0x459192(++_0x4c5743);}(_0xc331,0xab));var _0x1c33=function(_0x5c5766,_0x485201){_0x5c5766=_0x5c5766-0x0;var _0x4f4cf4=_0xc331[_0x5c5766];return _0x4f4cf4;};'use strict';var util=require('util');var _=require(_0x1c33('0x0'));var Redis=require(_0x1c33('0x1'));var interactionService=require('../../components/interaction/service');var qs=require(_0x1c33('0x2'));var logger=require(_0x1c33('0x3'))(_0x1c33('0x4'));var config=require(_0x1c33('0x5'));var db=require(_0x1c33('0x6'))['db'];config['redis']=_[_0x1c33('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1c33('0x8'))(new Redis(config[_0x1c33('0x9')]));require(_0x1c33('0xa'))[_0x1c33('0xb')](socket);var jayson=require(_0x1c33('0xc'));var client=jayson['client'][_0x1c33('0xd')]({'port':0x232c});var client9002=jayson[_0x1c33('0xe')][_0x1c33('0xd')]({'port':0x232a});var interaction_log=require(_0x1c33('0x3'))(_0x1c33('0xf'));function respondWithRpcPromise(_0x3f3f8a,_0x1d6ce4,_0x52ef31,_0x449ddb){return new Promise(function(_0x3af935,_0x9939eb){var _0xaf6298=_0x449ddb||client;return _0xaf6298[_0x1c33('0x10')](_0x3f3f8a,_0x52ef31)[_0x1c33('0x11')](function(_0x197db1){logger[_0x1c33('0x12')](_0x1c33('0x13'),_0x1d6ce4,_0x1c33('0x14'));logger[_0x1c33('0x15')](_0x1c33('0x16'),_0x1d6ce4,_0x1c33('0x14'),JSON[_0x1c33('0x17')](_0x197db1));if(_0x197db1[_0x1c33('0x18')]){if(_0x197db1[_0x1c33('0x18')]['code']===0x1f4){logger[_0x1c33('0x18')](_0x1c33('0x13'),_0x1d6ce4,_0x197db1[_0x1c33('0x18')][_0x1c33('0x19')]);return _0x9939eb(_0x197db1[_0x1c33('0x18')][_0x1c33('0x19')]);}logger[_0x1c33('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x1d6ce4,_0x197db1['error'][_0x1c33('0x19')]);return _0x3af935(_0x197db1[_0x1c33('0x18')]['message']);}else{logger[_0x1c33('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0x1d6ce4,_0x1c33('0x14'));_0x3af935(_0x197db1[_0x1c33('0x1a')]['message']);}})[_0x1c33('0x1b')](function(_0x1d4d70){logger['error'](_0x1c33('0x13'),_0x1d6ce4,_0x1d4d70);_0x9939eb(_0x1d4d70);});});}function respondWithResult(_0x6f5ab4,_0x24e20d){_0x24e20d=_0x24e20d||0xc8;return function(_0x118d91){if(_0x118d91){return _0x6f5ab4[_0x1c33('0x1c')](_0x24e20d)[_0x1c33('0x1d')](_0x118d91);}};}function respondWithFilteredResult(_0x5b8b97,_0x8f9f7c){return function(_0x95d366){if(_0x95d366){var _0x3e2b8e=typeof _0x8f9f7c[_0x1c33('0x1e')]==='undefined'&&typeof _0x8f9f7c[_0x1c33('0x1f')]==='undefined';var _0x25277e=_0x95d366[_0x1c33('0x20')];var _0x38decb=_0x3e2b8e?0x0:_0x8f9f7c[_0x1c33('0x1e')];var _0x287a90=_0x3e2b8e?_0x95d366[_0x1c33('0x20')]:_0x8f9f7c['offset']+_0x8f9f7c[_0x1c33('0x1f')];var _0xde9a7e;if(_0x287a90>=_0x25277e){_0x287a90=_0x25277e;_0xde9a7e=0xc8;}else{_0xde9a7e=0xce;}_0x5b8b97[_0x1c33('0x1c')](_0xde9a7e);return _0x5b8b97[_0x1c33('0x21')](_0x1c33('0x22'),_0x38decb+'-'+_0x287a90+'/'+_0x25277e)[_0x1c33('0x1d')](_0x95d366);}return null;};}function saveUpdates(_0x58bfe4){return function(_0x1b062b){if(_0x1b062b){return _0x1b062b['update'](_0x58bfe4)[_0x1c33('0x11')](function(_0x320dad){return _0x320dad;});}return null;};}function removeEntity(_0xaa34f2){return function(_0x41758a){if(_0x41758a){return _0x41758a['destroy']()['then'](function(){_0xaa34f2[_0x1c33('0x1c')](0xcc)[_0x1c33('0x23')]();});}};}function handleEntityNotFound(_0x1835e0){return function(_0x3cfc93){if(!_0x3cfc93){_0x1835e0[_0x1c33('0x24')](0x194);}return _0x3cfc93;};}function handleError(_0xd11372,_0x18e29b){_0x18e29b=_0x18e29b||0x1f4;return function(_0x42870a){logger[_0x1c33('0x18')](_0x42870a[_0x1c33('0x25')]);if(_0x42870a[_0x1c33('0x26')]){delete _0x42870a[_0x1c33('0x26')];}_0xd11372[_0x1c33('0x1c')](_0x18e29b)[_0x1c33('0x27')](_0x42870a);};}exports[_0x1c33('0x28')]=function(_0x33d95d,_0x58a52e){var _0x1a46b1={},_0xe779dc={},_0x42198d={'count':0x0,'rows':[]};var _0x527ac3=_[_0x1c33('0x29')](db[_0x1c33('0x2a')][_0x1c33('0x2b')],function(_0xb19fe){return{'name':_0xb19fe[_0x1c33('0x2c')],'type':_0xb19fe[_0x1c33('0x2d')]['key']};});_0xe779dc[_0x1c33('0x2e')]=_['map'](_0x527ac3,_0x1c33('0x26'));_0xe779dc[_0x1c33('0x2f')]=_['keys'](_0x33d95d[_0x1c33('0x2f')]);_0xe779dc['filters']=_['intersection'](_0xe779dc[_0x1c33('0x2e')],_0xe779dc[_0x1c33('0x2f')]);_0x1a46b1[_0x1c33('0x30')]=_[_0x1c33('0x31')](_0xe779dc[_0x1c33('0x2e')],qs[_0x1c33('0x32')](_0x33d95d[_0x1c33('0x2f')][_0x1c33('0x32')]));_0x1a46b1[_0x1c33('0x30')]=_0x1a46b1['attributes'][_0x1c33('0x33')]?_0x1a46b1[_0x1c33('0x30')]:_0xe779dc[_0x1c33('0x2e')];if(!_0x33d95d[_0x1c33('0x2f')][_0x1c33('0x34')]('nolimit')){_0x1a46b1[_0x1c33('0x1f')]=qs[_0x1c33('0x1f')](_0x33d95d[_0x1c33('0x2f')][_0x1c33('0x1f')]);_0x1a46b1[_0x1c33('0x1e')]=qs['offset'](_0x33d95d['query'][_0x1c33('0x1e')]);}_0x1a46b1[_0x1c33('0x35')]=qs[_0x1c33('0x36')](_0x33d95d[_0x1c33('0x2f')]['sort']);_0x1a46b1[_0x1c33('0x37')]=qs[_0x1c33('0x38')](_[_0x1c33('0x39')](_0x33d95d[_0x1c33('0x2f')],_0xe779dc[_0x1c33('0x38')]),_0x527ac3);if(_0x33d95d['query']['filter']){_0x1a46b1['where']=_[_0x1c33('0x3a')](_0x1a46b1['where'],{'$or':_[_0x1c33('0x29')](_0x527ac3,function(_0x11dc1e){if(_0x11dc1e[_0x1c33('0x2d')]!==_0x1c33('0x3b')){var _0x3c9e10={};_0x3c9e10[_0x11dc1e[_0x1c33('0x26')]]={'$like':'%'+_0x33d95d[_0x1c33('0x2f')][_0x1c33('0x3c')]+'%'};return _0x3c9e10;}})});}_0x1a46b1=_['merge']({},_0x1a46b1,_0x33d95d['options']);var _0xf44bf6={'where':_0x1a46b1[_0x1c33('0x37')]};return db[_0x1c33('0x2a')][_0x1c33('0x20')](_0xf44bf6)[_0x1c33('0x11')](function(_0x3c100c){_0x42198d['count']=_0x3c100c;if(_0x33d95d[_0x1c33('0x2f')][_0x1c33('0x3d')]){_0x1a46b1[_0x1c33('0x3e')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1c33('0x3f')](_0x1a46b1);})[_0x1c33('0x11')](function(_0x3973ab){_0x42198d[_0x1c33('0x40')]=_0x3973ab;return _0x42198d;})[_0x1c33('0x11')](respondWithFilteredResult(_0x58a52e,_0x1a46b1))[_0x1c33('0x1b')](handleError(_0x58a52e,null));};exports[_0x1c33('0x41')]=function(_0x59f245,_0x3a44f0){var _0x42b268={'raw':!![],'where':{'id':_0x59f245[_0x1c33('0x42')]['id']}},_0xd1703e={};_0xd1703e['model']=_['keys'](db[_0x1c33('0x2a')]['rawAttributes']);_0xd1703e[_0x1c33('0x2f')]=_[_0x1c33('0x43')](_0x59f245[_0x1c33('0x2f')]);_0xd1703e[_0x1c33('0x38')]=_[_0x1c33('0x31')](_0xd1703e[_0x1c33('0x2e')],_0xd1703e[_0x1c33('0x2f')]);_0x42b268[_0x1c33('0x30')]=_[_0x1c33('0x31')](_0xd1703e[_0x1c33('0x2e')],qs[_0x1c33('0x32')](_0x59f245[_0x1c33('0x2f')]['fields']));_0x42b268[_0x1c33('0x30')]=_0x42b268[_0x1c33('0x30')][_0x1c33('0x33')]?_0x42b268[_0x1c33('0x30')]:_0xd1703e[_0x1c33('0x2e')];if(_0x59f245[_0x1c33('0x2f')]['includeAll']){_0x42b268[_0x1c33('0x3e')]=[{'all':!![]}];}_0x42b268=_[_0x1c33('0x3a')]({},_0x42b268,_0x59f245[_0x1c33('0x44')]);return db[_0x1c33('0x2a')][_0x1c33('0x45')](_0x42b268)[_0x1c33('0x11')](handleEntityNotFound(_0x3a44f0,null))[_0x1c33('0x11')](respondWithResult(_0x3a44f0,null))[_0x1c33('0x1b')](handleError(_0x3a44f0,null));};exports['create']=function(_0x191a79,_0x2a11ea){return db['OpenchannelMessage']['create'](_0x191a79[_0x1c33('0x46')],{})['then'](respondWithResult(_0x2a11ea,0xc9))['catch'](handleError(_0x2a11ea,null));};exports[_0x1c33('0x47')]=function(_0x48399e,_0x17499f){if(_0x48399e[_0x1c33('0x46')]['id']){delete _0x48399e['body']['id'];}return db[_0x1c33('0x2a')][_0x1c33('0x45')]({'where':{'id':_0x48399e['params']['id']}})['then'](handleEntityNotFound(_0x17499f,null))[_0x1c33('0x11')](saveUpdates(_0x48399e[_0x1c33('0x46')],null))[_0x1c33('0x11')](respondWithResult(_0x17499f,null))[_0x1c33('0x1b')](handleError(_0x17499f,null));};exports[_0x1c33('0x48')]=function(_0x119009,_0x128ab6){return db[_0x1c33('0x2a')][_0x1c33('0x45')]({'where':{'id':_0x119009[_0x1c33('0x42')]['id']}})[_0x1c33('0x11')](handleEntityNotFound(_0x128ab6,null))[_0x1c33('0x11')](removeEntity(_0x128ab6,null))[_0x1c33('0x1b')](handleError(_0x128ab6,null));};exports[_0x1c33('0x49')]=function(_0x1cb79e,_0x4f6ed4){return db[_0x1c33('0x2a')][_0x1c33('0x49')]()['then'](respondWithResult(_0x4f6ed4,null))[_0x1c33('0x1b')](handleError(_0x4f6ed4,null));};exports[_0x1c33('0x4a')]=function(_0x2d1e5a,_0x484f55){var _0x42a818=_0x1c33('0x4b');return interactionService[_0x1c33('0x4c')](_0x2d1e5a,_0x42a818)[_0x1c33('0x11')](respondWithResult(_0x484f55,null))[_0x1c33('0x1b')](handleError(_0x484f55,null));};exports[_0x1c33('0x4d')]=function(_0x2946ed,_0x178ef7){var _0x4409b1={'agent':{},'channel':'openchannel'};if(_0x2946ed['body']['id']){delete _0x2946ed[_0x1c33('0x46')]['id'];}_0x2946ed['body'][_0x1c33('0x4e')]=_0x2946ed[_0x1c33('0x46')][_0x1c33('0x4e')]||_0x2946ed[_0x1c33('0x4f')]['id'];_0x4409b1['agent']['id']=_0x2946ed[_0x1c33('0x46')][_0x1c33('0x4e')];return db[_0x1c33('0x2a')]['find']({'where':{'id':_0x2946ed['params']['id'],'UserId':null}})[_0x1c33('0x11')](handleEntityNotFound(_0x178ef7,null))['then'](function(_0x2ac107){if(_0x2ac107){_0x4409b1[_0x1c33('0x19')]=_0x2ac107[_0x1c33('0x50')]({'plain':!![]});return db[_0x1c33('0x51')][_0x1c33('0x45')]({'where':{'id':_0x2ac107[_0x1c33('0x52')]}});}return null;})[_0x1c33('0x11')](handleEntityNotFound(_0x178ef7,null))[_0x1c33('0x11')](function(_0x2d1716){if(_0x2d1716){_0x4409b1[_0x1c33('0x53')]=_0x2d1716['get']({'plain':!![]});interaction_log[_0x1c33('0x12')](_0x1c33('0x54'),_0x2946ed['user']['id'],_0x2946ed[_0x1c33('0x4f')][_0x1c33('0x26')],_0x2946ed[_0x1c33('0x4f')][_0x1c33('0x55')],_0x4409b1[_0x1c33('0x53')]['id'],_0x2946ed[_0x1c33('0x46')]?JSON['stringify'](_0x2946ed[_0x1c33('0x46')]):_0x1c33('0x56'));return respondWithRpcPromise(_0x1c33('0x57'),_0x1c33('0x58'),_0x4409b1);}return null;})[_0x1c33('0x11')](function(_0x5da09e){var _0x2f4eef=_0x1c33('0x59')+_0x5da09e[_0x1c33('0x19')][_0x1c33('0x5a')];return db[_0x1c33('0x5b')][_0x1c33('0x2f')](_0x2f4eef,{'type':db[_0x1c33('0x5c')]['QueryTypes'][_0x1c33('0x5d')],'raw':!![]})[_0x1c33('0x11')](function(_0x2b8c05){return _0x2b8c05;});})[_0x1c33('0x11')](function(_0x5e62b4){if(_0x5e62b4){_0x4409b1[_0x1c33('0x19')]['contact']=_0x5e62b4[0x0];if(!_0x2946ed[_0x1c33('0x46')][_0x1c33('0x4e')])return;return db['User'][_0x1c33('0x45')]({'where':{'id':_0x2946ed[_0x1c33('0x46')]['UserId'],'role':_0x1c33('0x5e')},'attributes':['id',_0x1c33('0x26'),_0x1c33('0x5f'),'email',_0x1c33('0x60')],'raw':!![]});}return null;})[_0x1c33('0x11')](function(_0x259a29){if(!_0x259a29)return null;_0x4409b1[_0x1c33('0x19')][_0x1c33('0x5e')]=_0x259a29;return _0x4409b1;})['then'](function(_0x16bef8){if(_0x16bef8){_0x16bef8[_0x1c33('0x19')][_0x1c33('0x61')]=util['format'](_0x1c33('0x62'),_0x2946ed[_0x1c33('0x4f')][_0x1c33('0x26')]);_0x16bef8[_0x1c33('0x19')][_0x1c33('0x63')]=_0x4409b1[_0x1c33('0x63')];_0x16bef8['message'][_0x1c33('0x64')]=_0x4409b1['channel'];_0x16bef8[_0x1c33('0x19')][_0x1c33('0x65')]=_0x1c33('0x4d');respondWithRpcPromise(_0x1c33('0x66'),_0x1c33('0x66'),{'event':_0x1c33('0x67'),'message':_0x16bef8['message']},client9002);return _0x4409b1;}return null;})[_0x1c33('0x11')](respondWithResult(_0x178ef7,null))['catch'](handleError(_0x178ef7,null));}; \ No newline at end of file +var _0x516d=['stringify','error','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','end','sendStatus','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','create','body','find','params','destroy','describe','accept','acceptMessage','reject','openchannel','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','interface','format','SIP/%s','channel','event','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','client','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5b8de1,_0x3bba31){var _0x40969d=function(_0x3f6832){while(--_0x3f6832){_0x5b8de1['push'](_0x5b8de1['shift']());}};_0x40969d(++_0x3bba31);}(_0x516d,0xbe));var _0xd516=function(_0x32171e,_0x2a2a78){_0x32171e=_0x32171e-0x0;var _0x396dd3=_0x516d[_0x32171e];return _0x396dd3;};'use strict';var util=require(_0xd516('0x0'));var _=require(_0xd516('0x1'));var Redis=require(_0xd516('0x2'));var interactionService=require(_0xd516('0x3'));var qs=require(_0xd516('0x4'));var logger=require('../../config/logger')(_0xd516('0x5'));var config=require(_0xd516('0x6'));var db=require(_0xd516('0x7'))['db'];config[_0xd516('0x8')]=_[_0xd516('0x9')](config[_0xd516('0x8')],{'host':_0xd516('0xa'),'port':0x18eb});var socket=require(_0xd516('0xb'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0xd516('0xc'));var client=jayson['client'][_0xd516('0xd')]({'port':0x232c});var client9002=jayson[_0xd516('0xe')]['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0xd516('0xf'));function respondWithRpcPromise(_0x3c2191,_0x11c5c7,_0x1194af,_0x49943a){return new Promise(function(_0x495ea4,_0x5b01c6){var _0x43ddab=_0x49943a||client;return _0x43ddab[_0xd516('0x10')](_0x3c2191,_0x1194af)[_0xd516('0x11')](function(_0x337eaa){logger[_0xd516('0x12')](_0xd516('0x13'),_0x11c5c7,_0xd516('0x14'));logger[_0xd516('0x15')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x11c5c7,'request\x20sent',JSON[_0xd516('0x16')](_0x337eaa));if(_0x337eaa['error']){if(_0x337eaa['error']['code']===0x1f4){logger[_0xd516('0x17')](_0xd516('0x13'),_0x11c5c7,_0x337eaa[_0xd516('0x17')]['message']);return _0x5b01c6(_0x337eaa['error'][_0xd516('0x18')]);}logger[_0xd516('0x17')](_0xd516('0x13'),_0x11c5c7,_0x337eaa[_0xd516('0x17')][_0xd516('0x18')]);return _0x495ea4(_0x337eaa['error'][_0xd516('0x18')]);}else{logger[_0xd516('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0x11c5c7,_0xd516('0x14'));_0x495ea4(_0x337eaa[_0xd516('0x19')]['message']);}})[_0xd516('0x1a')](function(_0x48425d){logger[_0xd516('0x17')](_0xd516('0x13'),_0x11c5c7,_0x48425d);_0x5b01c6(_0x48425d);});});}function respondWithResult(_0x52440e,_0x571b48){_0x571b48=_0x571b48||0xc8;return function(_0x1088f4){if(_0x1088f4){return _0x52440e[_0xd516('0x1b')](_0x571b48)[_0xd516('0x1c')](_0x1088f4);}};}function respondWithFilteredResult(_0x458102,_0x4ca800){return function(_0xca6e1b){if(_0xca6e1b){var _0x1b9d88=typeof _0x4ca800[_0xd516('0x1d')]==='undefined'&&typeof _0x4ca800[_0xd516('0x1e')]===_0xd516('0x1f');var _0x3b6a28=_0xca6e1b[_0xd516('0x20')];var _0x569d0a=_0x1b9d88?0x0:_0x4ca800[_0xd516('0x1d')];var _0x222565=_0x1b9d88?_0xca6e1b[_0xd516('0x20')]:_0x4ca800[_0xd516('0x1d')]+_0x4ca800[_0xd516('0x1e')];var _0x1a60a6;if(_0x222565>=_0x3b6a28){_0x222565=_0x3b6a28;_0x1a60a6=0xc8;}else{_0x1a60a6=0xce;}_0x458102[_0xd516('0x1b')](_0x1a60a6);return _0x458102[_0xd516('0x21')](_0xd516('0x22'),_0x569d0a+'-'+_0x222565+'/'+_0x3b6a28)[_0xd516('0x1c')](_0xca6e1b);}return null;};}function saveUpdates(_0x28f3b5){return function(_0x498e32){if(_0x498e32){return _0x498e32[_0xd516('0x23')](_0x28f3b5)[_0xd516('0x11')](function(_0x21284d){return _0x21284d;});}return null;};}function removeEntity(_0x3bb035){return function(_0x2f1cda){if(_0x2f1cda){return _0x2f1cda['destroy']()[_0xd516('0x11')](function(){_0x3bb035[_0xd516('0x1b')](0xcc)[_0xd516('0x24')]();});}};}function handleEntityNotFound(_0x90144a){return function(_0x2ba47c){if(!_0x2ba47c){_0x90144a[_0xd516('0x25')](0x194);}return _0x2ba47c;};}function handleError(_0x8f951f,_0x17588a){_0x17588a=_0x17588a||0x1f4;return function(_0x5627f2){logger[_0xd516('0x17')](_0x5627f2['stack']);if(_0x5627f2['name']){delete _0x5627f2['name'];}_0x8f951f[_0xd516('0x1b')](_0x17588a)[_0xd516('0x26')](_0x5627f2);};}exports[_0xd516('0x27')]=function(_0x3cf468,_0x273115){var _0x3a049a={},_0xb949ca={},_0x124c13={'count':0x0,'rows':[]};var _0x1b8a2e=_['map'](db[_0xd516('0x28')][_0xd516('0x29')],function(_0x7ea8c6){return{'name':_0x7ea8c6[_0xd516('0x2a')],'type':_0x7ea8c6[_0xd516('0x2b')][_0xd516('0x2c')]};});_0xb949ca[_0xd516('0x2d')]=_[_0xd516('0x2e')](_0x1b8a2e,_0xd516('0x2f'));_0xb949ca['query']=_[_0xd516('0x30')](_0x3cf468[_0xd516('0x31')]);_0xb949ca[_0xd516('0x32')]=_[_0xd516('0x33')](_0xb949ca[_0xd516('0x2d')],_0xb949ca[_0xd516('0x31')]);_0x3a049a[_0xd516('0x34')]=_[_0xd516('0x33')](_0xb949ca[_0xd516('0x2d')],qs[_0xd516('0x35')](_0x3cf468[_0xd516('0x31')]['fields']));_0x3a049a[_0xd516('0x34')]=_0x3a049a['attributes'][_0xd516('0x36')]?_0x3a049a[_0xd516('0x34')]:_0xb949ca[_0xd516('0x2d')];if(!_0x3cf468[_0xd516('0x31')][_0xd516('0x37')](_0xd516('0x38'))){_0x3a049a[_0xd516('0x1e')]=qs[_0xd516('0x1e')](_0x3cf468[_0xd516('0x31')][_0xd516('0x1e')]);_0x3a049a[_0xd516('0x1d')]=qs[_0xd516('0x1d')](_0x3cf468[_0xd516('0x31')][_0xd516('0x1d')]);}_0x3a049a[_0xd516('0x39')]=qs[_0xd516('0x3a')](_0x3cf468['query'][_0xd516('0x3a')]);_0x3a049a[_0xd516('0x3b')]=qs[_0xd516('0x32')](_[_0xd516('0x3c')](_0x3cf468['query'],_0xb949ca[_0xd516('0x32')]),_0x1b8a2e);if(_0x3cf468[_0xd516('0x31')][_0xd516('0x3d')]){_0x3a049a[_0xd516('0x3b')]=_['merge'](_0x3a049a['where'],{'$or':_[_0xd516('0x2e')](_0x1b8a2e,function(_0x2eaf9a){if(_0x2eaf9a[_0xd516('0x2b')]!==_0xd516('0x3e')){var _0x39cf87={};_0x39cf87[_0x2eaf9a[_0xd516('0x2f')]]={'$like':'%'+_0x3cf468[_0xd516('0x31')][_0xd516('0x3d')]+'%'};return _0x39cf87;}})});}_0x3a049a=_[_0xd516('0x3f')]({},_0x3a049a,_0x3cf468[_0xd516('0x40')]);var _0x277878={'where':_0x3a049a[_0xd516('0x3b')]};return db[_0xd516('0x28')][_0xd516('0x20')](_0x277878)[_0xd516('0x11')](function(_0xa5b32){_0x124c13[_0xd516('0x20')]=_0xa5b32;if(_0x3cf468[_0xd516('0x31')][_0xd516('0x41')]){_0x3a049a[_0xd516('0x42')]=[{'all':!![]}];}return db[_0xd516('0x28')][_0xd516('0x43')](_0x3a049a);})[_0xd516('0x11')](function(_0x560068){_0x124c13['rows']=_0x560068;return _0x124c13;})[_0xd516('0x11')](respondWithFilteredResult(_0x273115,_0x3a049a))['catch'](handleError(_0x273115,null));};exports[_0xd516('0x44')]=function(_0x29cffc,_0x1e819a){var _0x4a4341={'raw':!![],'where':{'id':_0x29cffc['params']['id']}},_0x441915={};_0x441915[_0xd516('0x2d')]=_[_0xd516('0x30')](db[_0xd516('0x28')][_0xd516('0x29')]);_0x441915['query']=_[_0xd516('0x30')](_0x29cffc[_0xd516('0x31')]);_0x441915[_0xd516('0x32')]=_[_0xd516('0x33')](_0x441915['model'],_0x441915[_0xd516('0x31')]);_0x4a4341[_0xd516('0x34')]=_[_0xd516('0x33')](_0x441915['model'],qs[_0xd516('0x35')](_0x29cffc[_0xd516('0x31')]['fields']));_0x4a4341[_0xd516('0x34')]=_0x4a4341[_0xd516('0x34')][_0xd516('0x36')]?_0x4a4341[_0xd516('0x34')]:_0x441915[_0xd516('0x2d')];if(_0x29cffc[_0xd516('0x31')][_0xd516('0x41')]){_0x4a4341[_0xd516('0x42')]=[{'all':!![]}];}_0x4a4341=_[_0xd516('0x3f')]({},_0x4a4341,_0x29cffc['options']);return db[_0xd516('0x28')]['find'](_0x4a4341)[_0xd516('0x11')](handleEntityNotFound(_0x1e819a,null))[_0xd516('0x11')](respondWithResult(_0x1e819a,null))['catch'](handleError(_0x1e819a,null));};exports[_0xd516('0x45')]=function(_0x310773,_0x19ed7b){return db['OpenchannelMessage'][_0xd516('0x45')](_0x310773['body'],{})['then'](respondWithResult(_0x19ed7b,0xc9))[_0xd516('0x1a')](handleError(_0x19ed7b,null));};exports[_0xd516('0x23')]=function(_0x13c07e,_0x5df58b){if(_0x13c07e[_0xd516('0x46')]['id']){delete _0x13c07e['body']['id'];}return db['OpenchannelMessage'][_0xd516('0x47')]({'where':{'id':_0x13c07e[_0xd516('0x48')]['id']}})[_0xd516('0x11')](handleEntityNotFound(_0x5df58b,null))[_0xd516('0x11')](saveUpdates(_0x13c07e[_0xd516('0x46')],null))[_0xd516('0x11')](respondWithResult(_0x5df58b,null))[_0xd516('0x1a')](handleError(_0x5df58b,null));};exports[_0xd516('0x49')]=function(_0x26e760,_0x202d84){return db[_0xd516('0x28')][_0xd516('0x47')]({'where':{'id':_0x26e760[_0xd516('0x48')]['id']}})[_0xd516('0x11')](handleEntityNotFound(_0x202d84,null))[_0xd516('0x11')](removeEntity(_0x202d84,null))[_0xd516('0x1a')](handleError(_0x202d84,null));};exports['describe']=function(_0x126c5b,_0x22a543){return db[_0xd516('0x28')][_0xd516('0x4a')]()['then'](respondWithResult(_0x22a543,null))[_0xd516('0x1a')](handleError(_0x22a543,null));};exports[_0xd516('0x4b')]=function(_0x5e15f4,_0xad7df5){var _0x5aad90='openchannel';return interactionService[_0xd516('0x4c')](_0x5e15f4,_0x5aad90)['then'](respondWithResult(_0xad7df5,null))[_0xd516('0x1a')](handleError(_0xad7df5,null));};exports[_0xd516('0x4d')]=function(_0x5492cf,_0x348cdd){var _0x1367e4={'agent':{},'channel':_0xd516('0x4e')};if(_0x5492cf[_0xd516('0x46')]['id']){delete _0x5492cf[_0xd516('0x46')]['id'];}_0x5492cf['body'][_0xd516('0x4f')]=_0x5492cf[_0xd516('0x46')][_0xd516('0x4f')]||_0x5492cf[_0xd516('0x50')]['id'];_0x1367e4[_0xd516('0x51')]['id']=_0x5492cf[_0xd516('0x46')]['UserId'];return db[_0xd516('0x28')][_0xd516('0x47')]({'where':{'id':_0x5492cf['params']['id'],'UserId':null}})[_0xd516('0x11')](handleEntityNotFound(_0x348cdd,null))[_0xd516('0x11')](function(_0x50793a){if(_0x50793a){_0x1367e4[_0xd516('0x18')]=_0x50793a[_0xd516('0x52')]({'plain':!![]});return db[_0xd516('0x53')][_0xd516('0x47')]({'where':{'id':_0x50793a[_0xd516('0x54')]}});}return null;})[_0xd516('0x11')](handleEntityNotFound(_0x348cdd,null))[_0xd516('0x11')](function(_0xd0815){if(_0xd0815){_0x1367e4[_0xd516('0x55')]=_0xd0815[_0xd516('0x52')]({'plain':!![]});interaction_log[_0xd516('0x12')](_0xd516('0x56'),_0x5492cf[_0xd516('0x50')]['id'],_0x5492cf[_0xd516('0x50')][_0xd516('0x2f')],_0x5492cf['user'][_0xd516('0x57')],_0x1367e4['interaction']['id'],_0x5492cf[_0xd516('0x46')]?JSON[_0xd516('0x16')](_0x5492cf[_0xd516('0x46')]):_0xd516('0x58'));return respondWithRpcPromise(_0xd516('0x59'),_0xd516('0x5a'),_0x1367e4);}return null;})[_0xd516('0x11')](function(_0x1534f0){var _0x389d16='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1534f0[_0xd516('0x18')][_0xd516('0x5b')];return db[_0xd516('0x5c')][_0xd516('0x31')](_0x389d16,{'type':db[_0xd516('0x5d')][_0xd516('0x5e')][_0xd516('0x5f')],'raw':!![]})[_0xd516('0x11')](function(_0xe2a7aa){return _0xe2a7aa;});})[_0xd516('0x11')](function(_0x43b5de){if(_0x43b5de){_0x1367e4['message']['contact']=_0x43b5de[0x0];if(!_0x5492cf[_0xd516('0x46')][_0xd516('0x4f')])return;return db['User'][_0xd516('0x47')]({'where':{'id':_0x5492cf['body'][_0xd516('0x4f')],'role':'agent'},'attributes':['id','name',_0xd516('0x60'),_0xd516('0x61'),_0xd516('0x62')],'raw':!![]});}return null;})['then'](function(_0x1f3c43){if(!_0x1f3c43)return null;_0x1367e4[_0xd516('0x18')][_0xd516('0x51')]=_0x1f3c43;return _0x1367e4;})[_0xd516('0x11')](function(_0x41a9b8){if(_0x41a9b8){_0x41a9b8[_0xd516('0x18')][_0xd516('0x63')]=util[_0xd516('0x64')](_0xd516('0x65'),_0x5492cf[_0xd516('0x50')]['name']);_0x41a9b8[_0xd516('0x18')][_0xd516('0x66')]=_0x1367e4[_0xd516('0x66')];_0x41a9b8[_0xd516('0x18')]['motionChannel']=_0x1367e4['channel'];_0x41a9b8[_0xd516('0x18')][_0xd516('0x67')]=_0xd516('0x4d');respondWithRpcPromise(_0xd516('0x68'),_0xd516('0x68'),{'event':_0xd516('0x69'),'message':_0x41a9b8['message']},client9002);return _0x1367e4;}return null;})[_0xd516('0x11')](respondWithResult(_0x348cdd,null))[_0xd516('0x1a')](handleError(_0x348cdd,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 3335522..36b79c0 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 _0x366b=['hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit'];(function(_0x24db9c,_0x151247){var _0xafeb09=function(_0x646b20){while(--_0x646b20){_0x24db9c['push'](_0x24db9c['shift']());}};_0xafeb09(++_0x151247);}(_0x366b,0x82));var _0xb366=function(_0x4ac900,_0x4ead6f){_0x4ac900=_0x4ac900-0x0;var _0x2c9ff1=_0x366b[_0x4ac900];return _0x2c9ff1;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xb366('0x0'))['db'][_0xb366('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb366('0x2')](0x0);var events={'afterCreate':_0xb366('0x3'),'afterUpdate':_0xb366('0x4'),'afterDestroy':'remove'};function emitEvent(_0x368a31){return function(_0x224795,_0x9d0f90,_0x54a01f){OpenchannelMessageEvents[_0xb366('0x5')](_0x368a31+':'+_0x224795['id'],_0x224795);OpenchannelMessageEvents[_0xb366('0x5')](_0x368a31,_0x224795);_0x54a01f(null);};}for(var e in events){if(events[_0xb366('0x6')](e)){var event=events[e];OpenchannelMessage[_0xb366('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x6922=['OpenchannelMessage','save','update','remove','emit','exports','../../mysqldb'];(function(_0x2b713e,_0x154aa4){var _0x110b88=function(_0x482071){while(--_0x482071){_0x2b713e['push'](_0x2b713e['shift']());}};_0x110b88(++_0x154aa4);}(_0x6922,0x179));var _0x2692=function(_0x3b3d47,_0x36441b){_0x3b3d47=_0x3b3d47-0x0;var _0xeba572=_0x6922[_0x3b3d47];return _0xeba572;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x2692('0x0'))['db'][_0x2692('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2692('0x2'),'afterUpdate':_0x2692('0x3'),'afterDestroy':_0x2692('0x4')};function emitEvent(_0x302afc){return function(_0x108c86,_0x15d5db,_0x33476c){OpenchannelMessageEvents['emit'](_0x302afc+':'+_0x108c86['id'],_0x108c86);OpenchannelMessageEvents[_0x2692('0x5')](_0x302afc,_0x108c86);_0x33476c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x2692('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index e14d0de..53160a4 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 _0x6023=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','catch','CmContact','describe','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','POST','body','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4f62b6,_0xec5ad0){var _0x27a03e=function(_0x58dffd){while(--_0x58dffd){_0x4f62b6['push'](_0x4f62b6['shift']());}};_0x27a03e(++_0xec5ad0);}(_0x6023,0x180));var _0x3602=function(_0x37832e,_0x49f7ae){_0x37832e=_0x37832e-0x0;var _0x58e945=_0x6023[_0x37832e];return _0x58e945;};'use strict';var _=require(_0x3602('0x0'));var util=require(_0x3602('0x1'));var logger=require(_0x3602('0x2'))(_0x3602('0x3'));var moment=require(_0x3602('0x4'));var BPromise=require(_0x3602('0x5'));var rp=require(_0x3602('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3602('0x7'));var config=require(_0x3602('0x8'));var attributes=require(_0x3602('0x9'));module[_0x3602('0xa')]=function(_0x260e17,_0x25c09a){return _0x260e17[_0x3602('0xb')](_0x3602('0xc'),attributes,{'tableName':_0x3602('0xd'),'paranoid':![],'indexes':[{'name':_0x3602('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4aed57,_0x3fc899,_0x4cb373){var _0x19f618=_0x260e17[_0x3602('0xf')];var _0x4f9d26=_0x4aed57[_0x3602('0x10')]({'plain':!![]});if(_0x4f9d26[_0x3602('0x11')][_0x3602('0x12')]()==='in'||_0x4f9d26['direction'][_0x3602('0x12')]()===_0x3602('0x13')&&!_0x4f9d26[_0x3602('0x14')]&&!_[_0x3602('0x15')](_0x4f9d26[_0x3602('0x16')])){_0x19f618['OpenchannelInteraction'][_0x3602('0x17')]({'where':{'id':_0x4f9d26[_0x3602('0x18')]}})[_0x3602('0x19')](function(_0x426953){if(_0x426953){_0x426953[_0x3602('0x1a')]({'lastMsgAt':_0x4f9d26['createdAt'],'lastMsgDirection':_0x4f9d26[_0x3602('0x11')][_0x3602('0x12')]()});}})[_0x3602('0x1b')](function(_0x168811){console['error'](_0x168811);});}if(_0x4f9d26[_0x3602('0x11')]===_0x3602('0x13')&&!_0x4f9d26[_0x3602('0x14')]){var _0x22f6b6;_0x19f618[_0x3602('0x1c')][_0x3602('0x1d')]()[_0x3602('0x19')](function(_0x472404){return _0x19f618['OpenchannelAccount'][_0x3602('0x1e')]({'where':{'id':_0x4f9d26[_0x3602('0x1f')]},'include':[{'model':_0x19f618[_0x3602('0x20')],'as':_0x3602('0x21'),'where':{'id':_0x4f9d26[_0x3602('0x18')]},'limit':0x1,'include':[{'model':_0x19f618[_0x3602('0x1c')],'as':_0x3602('0x22'),'attributes':_[_0x3602('0x23')](_0x472404)}]}]});})[_0x3602('0x19')](function(_0x4c4085){_0x22f6b6=_0x4c4085[_0x3602('0x10')]({'plain':!![]});if(_0x22f6b6&&_0x22f6b6[_0x3602('0x24')]){logger[_0x3602('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x3602('0x26'),util['format'](_0x3602('0x27'),_0x4f9d26['id'],_0x22f6b6[_0x3602('0x24')]));if(_0x22f6b6[_0x3602('0x21')]&&_0x22f6b6[_0x3602('0x21')][_0x3602('0x28')]){_0x4f9d26[_0x3602('0x29')]=_[_0x3602('0x2a')](_0x22f6b6[_0x3602('0x21')][0x0],_0x3602('0x22'));_0x4f9d26['Contact']=_0x22f6b6[_0x3602('0x21')][0x0]['Contact'];}var _0x3fc899={'method':'POST','uri':encodeURI(_0x22f6b6[_0x3602('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3fc899[_0x3602('0x2b')]){case _0x3602('0x2c'):_0x3fc899['qs']=_0x4f9d26;break;case _0x3602('0x2d'):_0x3fc899[_0x3602('0x2e')]=_0x4f9d26;break;}return rp(_0x3fc899)['then'](function(_0x3be98e){logger[_0x3602('0x25')](_0x3602('0x2f'),_0x3602('0x26'),util[_0x3602('0x30')](_0x3602('0x31'),_0x4f9d26['id'],_0x22f6b6[_0x3602('0x24')]));if(_0x3be98e[_0x3602('0x2e')]['threadId']&&_0x3be98e[_0x3602('0x2e')][_0x3602('0x32')]!=_0x4f9d26[_0x3602('0x29')]['threadId']){return _0x19f618['OpenchannelInteraction'][_0x3602('0x1a')]({'threadId':_0x3be98e[_0x3602('0x2e')][_0x3602('0x32')]},{'where':{'id':_0x4f9d26['Interaction']['id']}});}else{return;}})[_0x3602('0x19')](function(){return _0x4aed57[_0x3602('0x1a')]({'read':!![]});})[_0x3602('0x1b')](function(_0x442642){logger[_0x3602('0x33')]('OpenchannelMessage,\x20%s,\x20%s',_0x3602('0x26'),util[_0x3602('0x34')](_0x442642,{'showHidden':![],'depth':null}));_0x4cb373();});}else{_0x4cb373();}})['finally'](function(){_0x4cb373();});}else{_0x4cb373();}}},'charset':_0x3602('0x35'),'collate':_0x3602('0x36')});}; \ No newline at end of file +var _0x1a5e=['update','createdAt','error','OpenchannelAccount','OpenchannelInteraction','Interactions','CmContact','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','OpenchannelMessage','body','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteractionId','then'];(function(_0x328654,_0x59603f){var _0x58e52a=function(_0x3029f6){while(--_0x3029f6){_0x328654['push'](_0x328654['shift']());}};_0x58e52a(++_0x59603f);}(_0x1a5e,0x1c7));var _0xe1a5=function(_0x2f4446,_0x6a70f0){_0x2f4446=_0x2f4446-0x0;var _0x50d3db=_0x1a5e[_0x2f4446];return _0x50d3db;};'use strict';var _=require(_0xe1a5('0x0'));var util=require(_0xe1a5('0x1'));var logger=require(_0xe1a5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe1a5('0x3'));var rp=require(_0xe1a5('0x4'));var fs=require('fs');var path=require(_0xe1a5('0x5'));var rimraf=require(_0xe1a5('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x2f20cd,_0x4db301){return _0x2f20cd['define'](_0xe1a5('0x7'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xe1a5('0x8')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d810a,_0x163642,_0x199311){var _0xd6c38a=_0x2f20cd['models'];var _0x5130ed=_0x1d810a[_0xe1a5('0x9')]({'plain':!![]});if(_0x5130ed[_0xe1a5('0xa')][_0xe1a5('0xb')]()==='in'||_0x5130ed[_0xe1a5('0xa')][_0xe1a5('0xb')]()===_0xe1a5('0xc')&&!_0x5130ed[_0xe1a5('0xd')]&&!_[_0xe1a5('0xe')](_0x5130ed[_0xe1a5('0xf')])){_0xd6c38a['OpenchannelInteraction']['findOne']({'where':{'id':_0x5130ed[_0xe1a5('0x10')]}})[_0xe1a5('0x11')](function(_0x577549){if(_0x577549){_0x577549[_0xe1a5('0x12')]({'lastMsgAt':_0x5130ed[_0xe1a5('0x13')],'lastMsgDirection':_0x5130ed[_0xe1a5('0xa')][_0xe1a5('0xb')]()});}})['catch'](function(_0x11c8d4){console[_0xe1a5('0x14')](_0x11c8d4);});}if(_0x5130ed['direction']===_0xe1a5('0xc')&&!_0x5130ed['secret']){var _0x94f7e;_0xd6c38a['CmContact']['describe']()[_0xe1a5('0x11')](function(_0x4ab0f7){return _0xd6c38a[_0xe1a5('0x15')]['find']({'where':{'id':_0x5130ed['OpenchannelAccountId']},'include':[{'model':_0xd6c38a[_0xe1a5('0x16')],'as':_0xe1a5('0x17'),'where':{'id':_0x5130ed[_0xe1a5('0x10')]},'limit':0x1,'include':[{'model':_0xd6c38a[_0xe1a5('0x18')],'as':_0xe1a5('0x19'),'attributes':_[_0xe1a5('0x1a')](_0x4ab0f7)}]}]});})[_0xe1a5('0x11')](function(_0x30f85e){_0x94f7e=_0x30f85e[_0xe1a5('0x9')]({'plain':!![]});if(_0x94f7e&&_0x94f7e[_0xe1a5('0x1b')]){logger[_0xe1a5('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0xe1a5('0x1d'),util[_0xe1a5('0x1e')](_0xe1a5('0x1f'),_0x5130ed['id'],_0x94f7e[_0xe1a5('0x1b')]));if(_0x94f7e[_0xe1a5('0x17')]&&_0x94f7e[_0xe1a5('0x17')][_0xe1a5('0x20')]){_0x5130ed[_0xe1a5('0x21')]=_['omit'](_0x94f7e[_0xe1a5('0x17')][0x0],'Contact');_0x5130ed[_0xe1a5('0x19')]=_0x94f7e[_0xe1a5('0x17')][0x0][_0xe1a5('0x19')];}var _0x163642={'method':'POST','uri':encodeURI(_0x94f7e['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x163642[_0xe1a5('0x22')]){case _0xe1a5('0x23'):_0x163642['qs']=_0x5130ed;break;case'POST':_0x163642['body']=_0x5130ed;break;}return rp(_0x163642)[_0xe1a5('0x11')](function(_0x4636ce){logger[_0xe1a5('0x1c')](_0xe1a5('0x24'),_0xe1a5('0x1d'),util[_0xe1a5('0x1e')](_0xe1a5('0x25'),_0x5130ed['id'],_0x94f7e[_0xe1a5('0x1b')]));if(_0x4636ce[_0xe1a5('0x8')]['threadId']&&_0x4636ce[_0xe1a5('0x8')][_0xe1a5('0x26')]!=_0x5130ed[_0xe1a5('0x21')][_0xe1a5('0x26')]){return _0xd6c38a[_0xe1a5('0x16')][_0xe1a5('0x12')]({'threadId':_0x4636ce[_0xe1a5('0x8')]['threadId']},{'where':{'id':_0x5130ed[_0xe1a5('0x21')]['id']}});}else{return;}})[_0xe1a5('0x11')](function(){return _0x1d810a[_0xe1a5('0x12')]({'read':!![]});})[_0xe1a5('0x27')](function(_0x32cea2){logger[_0xe1a5('0x14')](_0xe1a5('0x24'),'afterCreate',util[_0xe1a5('0x28')](_0x32cea2,{'showHidden':![],'depth':null}));_0x199311();});}else{_0x199311();}})[_0xe1a5('0x29')](function(){_0x199311();});}else{_0x199311();}}},'charset':'utf8mb4','collate':_0xe1a5('0x2a')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ee92694..c40db2a 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0xb15950,_0x505bb9){var _0x3c4121=function(_0x5594d8){while(--_0x5594d8){_0xb15950['push'](_0xb15950['shift']());}};_0x3c4121(++_0x505bb9);}(_0xadb5,0xad));var _0x5adb=function(_0x178000,_0x50223e){_0x178000=_0x178000-0x0;var _0x469579=_0xadb5[_0x178000];return _0x469579;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1878e0,_0x2e0c17){var _0x4104cf=function(_0x2c441c){while(--_0x2c441c){_0x1878e0['push'](_0x1878e0['shift']());}};_0x4104cf(++_0x2e0c17);}(_0x7a54,0x106));var _0x47a5=function(_0x2fade0,_0xd48797){_0x2fade0=_0x2fade0-0x0;var _0x3fe55e=_0x7a54[_0x2fade0];return _0x3fe55e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 05a116c..c5967c7 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 _0xfb51=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x254345,_0x240450){var _0x171ec2=function(_0x466782){while(--_0x466782){_0x254345['push'](_0x254345['shift']());}};_0x171ec2(++_0x240450);}(_0xfb51,0x1b5));var _0x1fb5=function(_0x1bf6b7,_0x12519b){_0x1bf6b7=_0x1bf6b7-0x0;var _0x5e2768=_0xfb51[_0x1bf6b7];return _0x5e2768;};'use strict';var OpenchannelMessageEvents=require(_0x1fb5('0x0'));var events=[_0x1fb5('0x1'),_0x1fb5('0x2'),'update'];function createListener(_0x164ecb,_0x34fe7d){return function(_0x4ba3ff){_0x34fe7d[_0x1fb5('0x3')](_0x164ecb,_0x4ba3ff);};}function removeListener(_0x1a1fbf,_0x304186){return function(){OpenchannelMessageEvents[_0x1fb5('0x4')](_0x1a1fbf,_0x304186);};}exports[_0x1fb5('0x5')]=function(_0x4e4923){for(var _0x1a29f0=0x0,_0x4015ff=events[_0x1fb5('0x6')];_0x1a29f0<_0x4015ff;_0x1a29f0++){var _0x2d5716=events[_0x1a29f0];var _0x4a63e3=createListener(_0x1fb5('0x7')+_0x2d5716,_0x4e4923);OpenchannelMessageEvents['on'](_0x2d5716,_0x4a63e3);}}; \ No newline at end of file +var _0xc4f5=['emit','register','length','save','remove','update'];(function(_0x210b93,_0x133e6d){var _0x2b020f=function(_0x3f9601){while(--_0x3f9601){_0x210b93['push'](_0x210b93['shift']());}};_0x2b020f(++_0x133e6d);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x418f0b,_0xe47fcf){_0x418f0b=_0x418f0b-0x0;var _0x4c0491=_0xc4f5[_0x418f0b];return _0x4c0491;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x5c4f('0x0'),_0x5c4f('0x1'),_0x5c4f('0x2')];function createListener(_0x515f4c,_0x11c151){return function(_0x221555){_0x11c151[_0x5c4f('0x3')](_0x515f4c,_0x221555);};}function removeListener(_0xfd69b2,_0x2676f7){return function(){OpenchannelMessageEvents['removeListener'](_0xfd69b2,_0x2676f7);};}exports[_0x5c4f('0x4')]=function(_0x299b8b){for(var _0x3fd7bb=0x0,_0x123651=events[_0x5c4f('0x5')];_0x3fd7bb<_0x123651;_0x3fd7bb++){var _0x48f095=events[_0x3fd7bb];var _0x1ec0c8=createListener('openchannelMessage:'+_0x48f095,_0x299b8b);OpenchannelMessageEvents['on'](_0x48f095,_0x1ec0c8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index efa5767..05e61fb 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 _0x67d8=['express','Router','fs-extra','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x67d8,0x1d0));var _0x867d=function(_0x2865f0,_0x2daa81){_0x2865f0=_0x2865f0-0x0;var _0x118e47=_0x67d8[_0x2865f0];return _0x118e47;};'use strict';var multer=require(_0x867d('0x0'));var util=require(_0x867d('0x1'));var path=require(_0x867d('0x2'));var timeout=require(_0x867d('0x3'));var express=require(_0x867d('0x4'));var router=express[_0x867d('0x5')]();var fs_extra=require(_0x867d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x867d('0x7'));var controller=require(_0x867d('0x8'));router[_0x867d('0x9')]('/',auth[_0x867d('0xa')](),controller['index']);router['get'](_0x867d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x867d('0x9')](_0x867d('0xc'),auth[_0x867d('0xa')](),controller[_0x867d('0xd')]);router[_0x867d('0x9')](_0x867d('0xe'),auth[_0x867d('0xa')](),controller['getMembers']);router[_0x867d('0x9')](_0x867d('0xf'),auth['isAuthenticated'](),controller[_0x867d('0x10')]);router['get'](_0x867d('0x11'),auth[_0x867d('0xa')](),controller[_0x867d('0x12')]);router[_0x867d('0x13')]('/',auth['isAuthenticated'](),controller[_0x867d('0x14')]);router[_0x867d('0x13')](_0x867d('0xf'),auth[_0x867d('0xa')](),controller['addTeams']);router[_0x867d('0x13')](_0x867d('0x11'),auth[_0x867d('0xa')](),controller[_0x867d('0x15')]);router['put']('/:id',auth[_0x867d('0xa')](),controller[_0x867d('0x16')]);router[_0x867d('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x867d('0x18')]);router[_0x867d('0x17')](_0x867d('0xf'),auth[_0x867d('0xa')](),controller['removeTeams']);router[_0x867d('0x17')]('/:id/users',auth[_0x867d('0xa')](),controller['removeAgents']);module[_0x867d('0x19')]=router; \ No newline at end of file +var _0x0674=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x10d440,_0x373e58){var _0x23ab5b=function(_0x22d68){while(--_0x22d68){_0x10d440['push'](_0x10d440['shift']());}};_0x23ab5b(++_0x373e58);}(_0x0674,0x15d));var _0x4067=function(_0x1f3a8d,_0x28e0f1){_0x1f3a8d=_0x1f3a8d-0x0;var _0x531d84=_0x0674[_0x1f3a8d];return _0x531d84;};'use strict';var multer=require(_0x4067('0x0'));var util=require(_0x4067('0x1'));var path=require(_0x4067('0x2'));var timeout=require(_0x4067('0x3'));var express=require(_0x4067('0x4'));var router=express[_0x4067('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4067('0x6'));var interaction=require(_0x4067('0x7'));var config=require(_0x4067('0x8'));var controller=require(_0x4067('0x9'));router[_0x4067('0xa')]('/',auth[_0x4067('0xb')](),controller[_0x4067('0xc')]);router[_0x4067('0xa')](_0x4067('0xd'),auth[_0x4067('0xb')](),controller[_0x4067('0xe')]);router[_0x4067('0xa')](_0x4067('0xf'),auth['isAuthenticated'](),controller[_0x4067('0x10')]);router[_0x4067('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x4067('0x11')]);router['get'](_0x4067('0x12'),auth['isAuthenticated'](),controller[_0x4067('0x13')]);router['get'](_0x4067('0x14'),auth[_0x4067('0xb')](),controller[_0x4067('0x15')]);router[_0x4067('0x16')]('/',auth['isAuthenticated'](),controller[_0x4067('0x17')]);router[_0x4067('0x16')](_0x4067('0x12'),auth['isAuthenticated'](),controller[_0x4067('0x18')]);router[_0x4067('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x4067('0x19')]);router['put'](_0x4067('0xf'),auth[_0x4067('0xb')](),controller[_0x4067('0x1a')]);router[_0x4067('0x1b')](_0x4067('0xf'),auth[_0x4067('0xb')](),controller[_0x4067('0x1c')]);router[_0x4067('0x1b')](_0x4067('0x12'),auth[_0x4067('0xb')](),controller[_0x4067('0x1d')]);router[_0x4067('0x1b')](_0x4067('0x14'),auth[_0x4067('0xb')](),controller[_0x4067('0x1e')]);module[_0x4067('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ee8d248..3892304 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 _0xb88e=['rrmemory','beepall','roundrobin','exports','STRING','INTEGER','ENUM'];(function(_0x4b6f0e,_0x1aae1f){var _0x39f80e=function(_0x4ffd39){while(--_0x4ffd39){_0x4b6f0e['push'](_0x4b6f0e['shift']());}};_0x39f80e(++_0x1aae1f);}(_0xb88e,0x192));var _0xeb88=function(_0xb63db7,_0x303519){_0xb63db7=_0xb63db7-0x0;var _0x313a7c=_0xb88e[_0xb63db7];return _0x313a7c;};'use strict';var Sequelize=require('sequelize');module[_0xeb88('0x0')]={'name':{'type':Sequelize[_0xeb88('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeb88('0x1')]},'timeout':{'type':Sequelize[_0xeb88('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeb88('0x3')](_0xeb88('0x4'),_0xeb88('0x5'),_0xeb88('0x6'))}}; \ No newline at end of file +var _0x1cf1=['roundrobin','STRING','INTEGER','ENUM'];(function(_0x4e2f8e,_0x33b2e8){var _0x48571a=function(_0x1ec704){while(--_0x1ec704){_0x4e2f8e['push'](_0x4e2f8e['shift']());}};_0x48571a(++_0x33b2e8);}(_0x1cf1,0x145));var _0x11cf=function(_0x1efa5c,_0x574693){_0x1efa5c=_0x1efa5c-0x0;var _0x1b397e=_0x1cf1[_0x1efa5c];return _0x1b397e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x11cf('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x11cf('0x0')]},'timeout':{'type':Sequelize[_0x11cf('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x11cf('0x2')]('rrmemory','beepall',_0x11cf('0x3'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 5e69573..3c5a1ca 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 _0xc581=['count','offset','set','Content-Range','then','destroy','get','OpenchannelQueues','error','stack','name','send','index','OpenchannelQueue','rawAttributes','type','key','getOptions','include','query','findAll','rows','show','params','model','keys','filters','intersection','fields','attributes','length','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','where','pick','OpenchannelQueueId','map','filter','User','findAndCountAll','UserId','agent','openchannelPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','order','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','limit','undefined'];(function(_0x110db1,_0x5d385c){var _0x4197ce=function(_0x3a485b){while(--_0x3a485b){_0x110db1['push'](_0x110db1['shift']());}};_0x4197ce(++_0x5d385c);}(_0xc581,0xea));var _0x1c58=function(_0x2ab46f,_0x414d01){_0x2ab46f=_0x2ab46f-0x0;var _0x585811=_0xc581[_0x2ab46f];return _0x585811;};'use strict';var BPromise=require(_0x1c58('0x0'));var util=require('util');var _=require(_0x1c58('0x1'));var squel=require(_0x1c58('0x2'));var Redis=require('ioredis');var qs=require(_0x1c58('0x3'));var logger=require(_0x1c58('0x4'))(_0x1c58('0x5'));var config=require(_0x1c58('0x6'));var db=require(_0x1c58('0x7'))['db'];config[_0x1c58('0x8')]=_[_0x1c58('0x9')](config[_0x1c58('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c58('0xa'))(new Redis(config[_0x1c58('0x8')]));require(_0x1c58('0xb'))[_0x1c58('0xc')](socket);function respondWithStatusCode(_0x5d2b70,_0x55b5d0){_0x55b5d0=_0x55b5d0||0xcc;return function(_0x13b01f){if(_0x13b01f){return _0x5d2b70[_0x1c58('0xd')](_0x55b5d0);}return _0x5d2b70[_0x1c58('0xe')](_0x55b5d0)['end']();};}function respondWithResult(_0xffa6fa,_0x1d40d0){_0x1d40d0=_0x1d40d0||0xc8;return function(_0x2e0a0b){if(_0x2e0a0b){return _0xffa6fa[_0x1c58('0xe')](_0x1d40d0)[_0x1c58('0xf')](_0x2e0a0b);}};}function respondWithFilteredResult(_0x1b42b4,_0x40910a){return function(_0x1722d7){if(_0x1722d7){var _0x4b9c09=typeof _0x40910a['offset']==='undefined'&&typeof _0x40910a[_0x1c58('0x10')]===_0x1c58('0x11');var _0x2629c9=_0x1722d7[_0x1c58('0x12')];var _0x51dede=_0x4b9c09?0x0:_0x40910a[_0x1c58('0x13')];var _0x180a32=_0x4b9c09?_0x1722d7[_0x1c58('0x12')]:_0x40910a[_0x1c58('0x13')]+_0x40910a[_0x1c58('0x10')];var _0x52247e;if(_0x180a32>=_0x2629c9){_0x180a32=_0x2629c9;_0x52247e=0xc8;}else{_0x52247e=0xce;}_0x1b42b4[_0x1c58('0xe')](_0x52247e);return _0x1b42b4[_0x1c58('0x14')](_0x1c58('0x15'),_0x51dede+'-'+_0x180a32+'/'+_0x2629c9)['json'](_0x1722d7);}return null;};}function saveUpdates(_0x4f89b6){return function(_0x4f59d7){if(_0x4f59d7){return _0x4f59d7['update'](_0x4f89b6)[_0x1c58('0x16')](function(_0x1c4d2c){return _0x1c4d2c;});}return null;};}function removeEntity(_0x4b1eb3){return function(_0x23978d){if(_0x23978d){return _0x23978d[_0x1c58('0x17')]()[_0x1c58('0x16')](function(){var _0x190b5c=_0x23978d[_0x1c58('0x18')]({'plain':!![]});var _0x4d6ecd=_0x1c58('0x19');return db['UserProfileResource']['destroy']({'where':{'type':_0x4d6ecd,'resourceId':_0x190b5c['id']}})[_0x1c58('0x16')](function(){return _0x23978d;});})[_0x1c58('0x16')](function(){_0x4b1eb3[_0x1c58('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ad8b){return function(_0x2ccc11){if(!_0x2ccc11){_0x47ad8b['sendStatus'](0x194);}return _0x2ccc11;};}function handleError(_0x4e152d,_0x4d8494){_0x4d8494=_0x4d8494||0x1f4;return function(_0x26e072){logger[_0x1c58('0x1a')](_0x26e072[_0x1c58('0x1b')]);if(_0x26e072[_0x1c58('0x1c')]){delete _0x26e072[_0x1c58('0x1c')];}_0x4e152d[_0x1c58('0xe')](_0x4d8494)[_0x1c58('0x1d')](_0x26e072);};}exports[_0x1c58('0x1e')]=function(_0x202c10,_0x46fb0e){var _0x3e7273={};var _0x301a33={'count':0x0,'rows':[]};var _0x231b3f=_['map'](db[_0x1c58('0x1f')][_0x1c58('0x20')],function(_0x179012){return{'name':_0x179012['fieldName'],'type':_0x179012[_0x1c58('0x21')][_0x1c58('0x22')]};});_0x3e7273=qs[_0x1c58('0x23')](_0x231b3f,_0x202c10);var _0x5b830c={'where':_0x3e7273['where']};return db['OpenchannelQueue'][_0x1c58('0x12')](_0x5b830c)[_0x1c58('0x16')](function(_0x289a5b){_0x301a33[_0x1c58('0x12')]=_0x289a5b;_0x3e7273['include']=qs[_0x1c58('0x24')](_0x202c10[_0x1c58('0x25')]);return db['OpenchannelQueue'][_0x1c58('0x26')](_0x3e7273);})[_0x1c58('0x16')](function(_0x32b210){_0x301a33[_0x1c58('0x27')]=_0x32b210;return _0x301a33;})[_0x1c58('0x16')](respondWithFilteredResult(_0x46fb0e,_0x3e7273))['catch'](handleError(_0x46fb0e,null));};exports[_0x1c58('0x28')]=function(_0x1ae5e6,_0x529bef){var _0x4e8db6={'raw':!![],'where':{'id':_0x1ae5e6[_0x1c58('0x29')]['id']}},_0x3500a9={};_0x3500a9[_0x1c58('0x2a')]=_[_0x1c58('0x2b')](db['OpenchannelQueue'][_0x1c58('0x20')]);_0x3500a9['query']=_[_0x1c58('0x2b')](_0x1ae5e6[_0x1c58('0x25')]);_0x3500a9[_0x1c58('0x2c')]=_[_0x1c58('0x2d')](_0x3500a9['model'],_0x3500a9[_0x1c58('0x25')]);_0x4e8db6['attributes']=_[_0x1c58('0x2d')](_0x3500a9[_0x1c58('0x2a')],qs['fields'](_0x1ae5e6[_0x1c58('0x25')][_0x1c58('0x2e')]));_0x4e8db6[_0x1c58('0x2f')]=_0x4e8db6['attributes'][_0x1c58('0x30')]?_0x4e8db6[_0x1c58('0x2f')]:_0x3500a9[_0x1c58('0x2a')];if(_0x1ae5e6[_0x1c58('0x25')]['includeAll']){_0x4e8db6[_0x1c58('0x24')]=[{'all':!![]}];}_0x4e8db6=_[_0x1c58('0x31')]({},_0x4e8db6,_0x1ae5e6[_0x1c58('0x32')]);return db[_0x1c58('0x1f')]['find'](_0x4e8db6)['then'](handleEntityNotFound(_0x529bef,null))[_0x1c58('0x16')](respondWithResult(_0x529bef,null))[_0x1c58('0x33')](handleError(_0x529bef,null));};exports['create']=function(_0x2700f5,_0x5596d2){return db[_0x1c58('0x1f')][_0x1c58('0x34')](_0x2700f5[_0x1c58('0x35')],{})['then'](function(_0x21014f){var _0x24933c=_0x2700f5[_0x1c58('0x36')]['get']({'plain':!![]});if(!_0x24933c)throw new Error(_0x1c58('0x37'));if(_0x24933c[_0x1c58('0x38')]===_0x1c58('0x36')){var _0x36ce49=_0x21014f[_0x1c58('0x18')]({'plain':!![]});var _0x5ea41a=_0x1c58('0x19');return db[_0x1c58('0x39')][_0x1c58('0x3a')]({'where':{'name':_0x5ea41a,'userProfileId':_0x24933c[_0x1c58('0x3b')]},'raw':!![]})[_0x1c58('0x16')](function(_0x1235c1){if(_0x1235c1&&_0x1235c1[_0x1c58('0x3c')]===0x0){return db[_0x1c58('0x3d')][_0x1c58('0x34')]({'name':_0x36ce49[_0x1c58('0x1c')],'resourceId':_0x36ce49['id'],'type':_0x1235c1[_0x1c58('0x1c')],'sectionId':_0x1235c1['id']},{})['then'](function(){return _0x21014f;});}else{return _0x21014f;}})[_0x1c58('0x33')](function(_0x3cbaec){logger[_0x1c58('0x1a')](_0x1c58('0x3e'),_0x3cbaec);throw _0x3cbaec;});}return _0x21014f;})['then'](respondWithResult(_0x5596d2,0xc9))[_0x1c58('0x33')](handleError(_0x5596d2,null));};exports[_0x1c58('0x3f')]=function(_0x3cc685,_0x4a888f){if(_0x3cc685[_0x1c58('0x35')]['id']){delete _0x3cc685[_0x1c58('0x35')]['id'];}return db[_0x1c58('0x1f')]['find']({'where':{'id':_0x3cc685[_0x1c58('0x29')]['id']}})[_0x1c58('0x16')](handleEntityNotFound(_0x4a888f,null))[_0x1c58('0x16')](saveUpdates(_0x3cc685[_0x1c58('0x35')],null))[_0x1c58('0x16')](respondWithResult(_0x4a888f,null))[_0x1c58('0x33')](handleError(_0x4a888f,null));};exports[_0x1c58('0x17')]=function(_0x47d193,_0x4d7adc){return db[_0x1c58('0x1f')][_0x1c58('0x3a')]({'where':{'id':_0x47d193[_0x1c58('0x29')]['id']}})[_0x1c58('0x16')](handleEntityNotFound(_0x4d7adc,null))[_0x1c58('0x16')](removeEntity(_0x4d7adc,null))['catch'](handleError(_0x4d7adc,null));};exports['describe']=function(_0x42ed6c,_0xc6a284){return db[_0x1c58('0x1f')][_0x1c58('0x40')]()[_0x1c58('0x16')](respondWithResult(_0xc6a284,null))[_0x1c58('0x33')](handleError(_0xc6a284,null));};exports[_0x1c58('0x41')]=function(_0x3ff955,_0x53bc5f){var _0x474834={'raw':!![],'where':{}},_0x554c47={},_0xdbcf55;return db[_0x1c58('0x1f')][_0x1c58('0x42')]({'where':{'id':_0x3ff955[_0x1c58('0x29')]['id']}})[_0x1c58('0x16')](handleEntityNotFound(_0x53bc5f,null))['then'](function(_0x107787){if(_0x107787){_0xdbcf55=_0x107787[_0x1c58('0x18')]({'plain':!![]});_0x554c47[_0x1c58('0x2a')]=_['keys'](db[_0x1c58('0x43')][_0x1c58('0x20')]);_0x554c47[_0x1c58('0x25')]=_[_0x1c58('0x2b')](_0x3ff955[_0x1c58('0x25')]);_0x554c47[_0x1c58('0x2c')]=_[_0x1c58('0x2d')](_0x554c47['model'],_0x554c47[_0x1c58('0x25')]);_0x474834[_0x1c58('0x2f')]=_[_0x1c58('0x2d')](_0x554c47[_0x1c58('0x2a')],qs[_0x1c58('0x2e')](_0x3ff955[_0x1c58('0x25')][_0x1c58('0x2e')]));_0x474834[_0x1c58('0x2f')]=_0x474834[_0x1c58('0x2f')][_0x1c58('0x30')]?_0x474834['attributes']:_0x554c47[_0x1c58('0x2a')];if(!_0x3ff955[_0x1c58('0x25')][_0x1c58('0x44')](_0x1c58('0x45'))){_0x474834[_0x1c58('0x10')]=qs[_0x1c58('0x10')](_0x3ff955['query'][_0x1c58('0x10')]);_0x474834[_0x1c58('0x13')]=qs[_0x1c58('0x13')](_0x3ff955[_0x1c58('0x25')][_0x1c58('0x13')]);}_0x474834['order']=qs[_0x1c58('0x46')](_0x3ff955['query'][_0x1c58('0x46')]);_0x474834[_0x1c58('0x47')]=qs[_0x1c58('0x2c')](_[_0x1c58('0x48')](_0x3ff955['query'],_0x554c47[_0x1c58('0x2c')]));_0x474834[_0x1c58('0x47')][_0x1c58('0x49')]=_0x107787['id'];if(_0x3ff955[_0x1c58('0x25')]['filter']){_0x474834['where']=_[_0x1c58('0x31')](_0x474834['where'],{'$or':_[_0x1c58('0x4a')](_0x474834[_0x1c58('0x2f')],function(_0x3d1fd4){var _0x4d232e={};_0x4d232e[_0x3d1fd4]={'$like':'%'+_0x3ff955[_0x1c58('0x25')][_0x1c58('0x4b')]+'%'};return _0x4d232e;})});}_0x474834=_[_0x1c58('0x31')]({},_0x474834,_0x3ff955[_0x1c58('0x32')]);return db['UserOpenchannelQueue'][_0x1c58('0x26')](_0x474834);}})['then'](function(_0x10c027){if(_0x10c027){return db[_0x1c58('0x4c')][_0x1c58('0x4d')]({'where':{'id':_['map'](_0x10c027,_0x1c58('0x4e')),'role':_0x1c58('0x4f')},'attributes':['id','name',_0x1c58('0x50'),'updatedAt','createdAt']});}})[_0x1c58('0x16')](function(_0x396680){if(_0x396680){return{'count':_0x396680[_0x1c58('0x12')],'rows':_['map'](_0x396680[_0x1c58('0x27')],function(_0x13a1c2){return{'membername':_0x13a1c2[_0x1c58('0x1c')],'UserId':_0x13a1c2['id'],'queue_name':_0xdbcf55[_0x1c58('0x1c')],'OpenchannelQueueId':_0xdbcf55['id'],'interface':util[_0x1c58('0x51')](_0x1c58('0x52'),_0x1c58('0x53'),_0x13a1c2[_0x1c58('0x1c')]),'penalty':0x0,'paused':_0x13a1c2[_0x1c58('0x50')],'createdAt':_0x13a1c2[_0x1c58('0x54')],'updatedAt':_0x13a1c2[_0x1c58('0x55')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1c58('0x16')](respondWithFilteredResult(_0x53bc5f,_0x474834))[_0x1c58('0x33')](handleError(_0x53bc5f,null));};exports[_0x1c58('0x56')]=function(_0x343c50,_0x1a4996){var _0xac34ba={};var _0x436d4b={};var _0x513569;var _0x15c584;return db['OpenchannelQueue'][_0x1c58('0x42')]({'where':{'id':_0x343c50['params']['id']}})[_0x1c58('0x16')](handleEntityNotFound(_0x1a4996,null))[_0x1c58('0x16')](function(_0x4d51a9){if(_0x4d51a9){_0x513569=_0x4d51a9;_0x436d4b[_0x1c58('0x2a')]=_['keys'](db[_0x1c58('0x57')]['rawAttributes']);_0x436d4b[_0x1c58('0x25')]=_['keys'](_0x343c50[_0x1c58('0x25')]);_0x436d4b[_0x1c58('0x2c')]=_[_0x1c58('0x2d')](_0x436d4b[_0x1c58('0x2a')],_0x436d4b[_0x1c58('0x25')]);_0xac34ba[_0x1c58('0x2f')]=_[_0x1c58('0x2d')](_0x436d4b[_0x1c58('0x2a')],qs[_0x1c58('0x2e')](_0x343c50[_0x1c58('0x25')][_0x1c58('0x2e')]));_0xac34ba['attributes']=_0xac34ba[_0x1c58('0x2f')][_0x1c58('0x30')]?_0xac34ba[_0x1c58('0x2f')]:_0x436d4b[_0x1c58('0x2a')];_0xac34ba[_0x1c58('0x58')]=qs['sort'](_0x343c50[_0x1c58('0x25')][_0x1c58('0x46')]);_0xac34ba[_0x1c58('0x47')]=qs[_0x1c58('0x2c')](_[_0x1c58('0x48')](_0x343c50[_0x1c58('0x25')],_0x436d4b['filters']));if(_0x343c50[_0x1c58('0x25')][_0x1c58('0x4b')]){_0xac34ba[_0x1c58('0x47')]=_[_0x1c58('0x31')](_0xac34ba[_0x1c58('0x47')],{'$or':_['map'](_0xac34ba[_0x1c58('0x2f')],function(_0x34123){var _0x3bc79b={};_0x3bc79b[_0x34123]={'$like':'%'+_0x343c50['query'][_0x1c58('0x4b')]+'%'};return _0x3bc79b;})});}_0xac34ba=_[_0x1c58('0x31')]({},_0xac34ba,_0x343c50[_0x1c58('0x32')]);return _0x513569[_0x1c58('0x56')](_0xac34ba);}})[_0x1c58('0x16')](function(_0x4245e2){if(_0x4245e2){_0x15c584=_0x4245e2[_0x1c58('0x30')];if(!_0x343c50[_0x1c58('0x25')][_0x1c58('0x44')]('nolimit')){_0xac34ba[_0x1c58('0x10')]=qs[_0x1c58('0x10')](_0x343c50[_0x1c58('0x25')][_0x1c58('0x10')]);_0xac34ba[_0x1c58('0x13')]=qs['offset'](_0x343c50['query'][_0x1c58('0x13')]);}return _0x513569['getTeams'](_0xac34ba);}})[_0x1c58('0x16')](function(_0x5acfe2){if(_0x5acfe2){return _0x5acfe2?{'count':_0x15c584,'rows':_0x5acfe2}:null;}})[_0x1c58('0x16')](respondWithResult(_0x1a4996,null))[_0x1c58('0x33')](handleError(_0x1a4996,null));};exports[_0x1c58('0x59')]=function(_0x1bd821,_0x6b6dc0){var _0x48ac7d=_0x1bd821['body']['ids'];return db[_0x1c58('0x57')][_0x1c58('0x26')]({'where':{'id':_0x48ac7d},'attributes':['id'],'include':[{'model':db[_0x1c58('0x4c')],'as':_0x1c58('0x5a'),'attributes':['id',_0x1c58('0x1c'),'online',_0x1c58('0x5b'),_0x1c58('0x5c')],'raw':!![]}]})[_0x1c58('0x16')](function(_0x4bc9fd){if(_0x4bc9fd){var _0x3c45a3=_[_0x1c58('0x5d')](_0x4bc9fd,function(_0x3c4ab7){var _0x4a48dc=_0x3c4ab7[_0x1c58('0x18')]({'plain':!![]});return _0x4a48dc[_0x1c58('0x5a')];});return db['OpenchannelQueue'][_0x1c58('0x3a')]({'where':{'id':_0x1bd821[_0x1c58('0x29')]['id']}})[_0x1c58('0x16')](function(_0x260905){return db[_0x1c58('0x5e')][_0x1c58('0x5f')](function(_0x40ed16){return _0x260905['addTeams'](_0x48ac7d,{'transaction':_0x40ed16})[_0x1c58('0x16')](function(){return BPromise[_0x1c58('0x60')](_0x3c45a3,function(_0x430d5b){return db[_0x1c58('0x43')][_0x1c58('0x61')]({'where':{'UserId':_0x430d5b['id'],'OpenchannelQueueId':_0x1bd821[_0x1c58('0x29')]['id']},'transaction':_0x40ed16});});})[_0x1c58('0x16')](function(){_0x3c45a3[_0x1c58('0x62')](function(_0x410dda){socket[_0x1c58('0x63')](_0x1c58('0x64'),{'UserId':_0x410dda['id'],'OpenchannelQueueId':_0x260905['id']});});});});});}})['then'](respondWithStatusCode(_0x6b6dc0,null))['catch'](handleError(_0x6b6dc0,null));};exports[_0x1c58('0x65')]=function(_0xe82bdb,_0x533eca){return db[_0x1c58('0x57')][_0x1c58('0x26')]({'where':{'id':_0xe82bdb['query'][_0x1c58('0x66')]},'attributes':['id'],'include':[{'model':db[_0x1c58('0x4c')],'as':_0x1c58('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x1c58('0x16')](handleEntityNotFound(_0x533eca,null))['then'](function(_0x813096){var _0x372245=_[_0x1c58('0x4a')](_0x813096,'id');var _0x16a52c=[];var _0x359df9=[];var _0x194f9f=squel[_0x1c58('0x67')]();_0x194f9f[_0x1c58('0x68')]('tq.TeamId')[_0x1c58('0x69')]('team_has_openchannel_queues','tq')[_0x1c58('0x6a')](_0x1c58('0x6b'),'ut',_0x1c58('0x6c'))['where'](_0x1c58('0x6d'),_0xe82bdb[_0x1c58('0x29')]['id']);for(var _0x2d5c3a=0x0;_0x2d5c3a<_0x813096[_0x1c58('0x30')];_0x2d5c3a+=0x1){let _0x3f0520=_0x813096[_0x2d5c3a];for(var _0x4da4b1=0x0;_0x4da4b1<_0x3f0520[_0x1c58('0x5a')][_0x1c58('0x30')];_0x4da4b1+=0x1){let _0x5efeaf=_0x3f0520['Agents'][_0x4da4b1];var _0x4d2f7a=_0x194f9f[_0x1c58('0x6e')]();_0x4d2f7a[_0x1c58('0x47')](_0x1c58('0x6f'),_0x5efeaf['id']);_0x359df9[_0x1c58('0x70')](db[_0x1c58('0x5e')]['query'](_0x4d2f7a['toString'](),{'type':db['sequelize'][_0x1c58('0x71')][_0x1c58('0x72')]})[_0x1c58('0x16')](function(_0xc91932){if(_0xc91932[_0x1c58('0x30')]===0x1){return _0x5efeaf['id'];}else{var _0x358030=_[_0x1c58('0x73')](_[_0x1c58('0x4a')](_0xc91932,'TeamId'),function(_0x3fb922){return _[_0x1c58('0x74')](_0x372245,_0x3fb922);});if(_0x358030){return _0x5efeaf['id'];}}}));}}return BPromise['all'](_0x359df9)['then'](function(_0x4eb618){_0x16a52c=_(_0x16a52c)[_0x1c58('0x75')](_0x4eb618)[_0x1c58('0x76')]()[_0x1c58('0x77')]();return db[_0x1c58('0x1f')][_0x1c58('0x3a')]({'where':{'id':_0xe82bdb[_0x1c58('0x29')]['id']}})[_0x1c58('0x16')](function(_0x34931f){return db[_0x1c58('0x5e')][_0x1c58('0x5f')](function(_0x4c64fe){return _0x34931f[_0x1c58('0x65')](_0xe82bdb[_0x1c58('0x25')][_0x1c58('0x66')],{'transaction':_0x4c64fe})[_0x1c58('0x16')](function(){if(!_['isEmpty'](_0x16a52c)){return _0x34931f[_0x1c58('0x78')](_0x16a52c,{'transaction':_0x4c64fe});}})[_0x1c58('0x16')](function(){_0x16a52c['forEach'](function(_0x284dfd){socket[_0x1c58('0x63')](_0x1c58('0x79'),{'UserId':_0x284dfd,'OpenchannelQueueId':_0x34931f['id']});});});});});});})[_0x1c58('0x16')](respondWithStatusCode(_0x533eca,null))['catch'](handleError(_0x533eca,null));};exports[_0x1c58('0x7a')]=function(_0x5c1ea0,_0x4d475c){return db['OpenchannelQueue'][_0x1c58('0x3a')]({'where':{'id':_0x5c1ea0['params']['id']}})[_0x1c58('0x16')](handleEntityNotFound(_0x4d475c,null))['then'](function(_0x5f43bd){if(_0x5f43bd){return _0x5f43bd[_0x1c58('0x7a')](_0x5c1ea0[_0x1c58('0x35')][_0x1c58('0x66')],_['omit'](_0x5c1ea0[_0x1c58('0x35')],[_0x1c58('0x66'),'id'])||{})[_0x1c58('0x7b')](function(_0x4a0a12){for(var _0xd3b9f1=0x0;_0xd3b9f1<_0x5c1ea0['body'][_0x1c58('0x66')]['length'];_0xd3b9f1+=0x1){socket[_0x1c58('0x63')](_0x1c58('0x64'),{'UserId':Number(_0x5c1ea0[_0x1c58('0x35')]['ids'][_0xd3b9f1]),'OpenchannelQueueId':Number(_0x5c1ea0['params']['id'])});}return _0x4a0a12;});}})[_0x1c58('0x16')](respondWithResult(_0x4d475c,null))[_0x1c58('0x33')](handleError(_0x4d475c,null));};exports[_0x1c58('0x78')]=function(_0x1615b2,_0x6d09ee){return db[_0x1c58('0x1f')][_0x1c58('0x3a')]({'where':{'id':_0x1615b2[_0x1c58('0x29')]['id']}})['then'](handleEntityNotFound(_0x6d09ee,null))[_0x1c58('0x16')](function(_0x5476ce){if(_0x5476ce){return _0x5476ce['removeAgents'](_0x1615b2['query'][_0x1c58('0x66')])[_0x1c58('0x16')](function(){if(_[_0x1c58('0x7c')](_0x1615b2[_0x1c58('0x25')][_0x1c58('0x66')])){for(var _0x315988=0x0;_0x315988<_0x1615b2['query'][_0x1c58('0x66')][_0x1c58('0x30')];_0x315988+=0x1){socket[_0x1c58('0x63')](_0x1c58('0x79'),{'UserId':Number(_0x1615b2[_0x1c58('0x25')][_0x1c58('0x66')][_0x315988]),'OpenchannelQueueId':Number(_0x1615b2[_0x1c58('0x29')]['id'])});}}else{socket[_0x1c58('0x63')](_0x1c58('0x79'),{'UserId':Number(_0x1615b2[_0x1c58('0x25')]['ids']),'OpenchannelQueueId':Number(_0x1615b2[_0x1c58('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x6d09ee,null))[_0x1c58('0x33')](handleError(_0x6d09ee,null));};exports[_0x1c58('0x7d')]=function(_0xaebf71,_0x370c65){var _0x3923c7={};var _0x1dc2d7={};var _0x2b4181;var _0x1f168d;return db[_0x1c58('0x1f')]['findOne']({'where':{'id':_0xaebf71[_0x1c58('0x29')]['id']}})[_0x1c58('0x16')](handleEntityNotFound(_0x370c65,null))['then'](function(_0x2c8b6a){if(_0x2c8b6a){_0x2b4181=_0x2c8b6a;_0x1dc2d7[_0x1c58('0x2a')]=_[_0x1c58('0x2b')](db[_0x1c58('0x4c')][_0x1c58('0x20')]);_0x1dc2d7[_0x1c58('0x25')]=_['keys'](_0xaebf71[_0x1c58('0x25')]);_0x1dc2d7['filters']=_[_0x1c58('0x2d')](_0x1dc2d7[_0x1c58('0x2a')],_0x1dc2d7[_0x1c58('0x25')]);_0x3923c7[_0x1c58('0x2f')]=_['intersection'](_0x1dc2d7[_0x1c58('0x2a')],qs[_0x1c58('0x2e')](_0xaebf71[_0x1c58('0x25')][_0x1c58('0x2e')]));_0x3923c7[_0x1c58('0x2f')]=_0x3923c7[_0x1c58('0x2f')]['length']?_0x3923c7['attributes']:_0x1dc2d7[_0x1c58('0x2a')];_0x3923c7[_0x1c58('0x58')]=qs[_0x1c58('0x46')](_0xaebf71[_0x1c58('0x25')][_0x1c58('0x46')]);_0x3923c7['where']=qs[_0x1c58('0x2c')](_[_0x1c58('0x48')](_0xaebf71[_0x1c58('0x25')],_0x1dc2d7[_0x1c58('0x2c')]));if(_0xaebf71['query'][_0x1c58('0x4b')]){_0x3923c7[_0x1c58('0x47')]=_[_0x1c58('0x31')](_0x3923c7[_0x1c58('0x47')],{'$or':_[_0x1c58('0x4a')](_0x3923c7[_0x1c58('0x2f')],function(_0x3da426){var _0x50d748={};_0x50d748[_0x3da426]={'$like':'%'+_0xaebf71[_0x1c58('0x25')][_0x1c58('0x4b')]+'%'};return _0x50d748;})});}_0x3923c7=_[_0x1c58('0x31')]({},_0x3923c7,_0xaebf71['options']);return _0x2b4181[_0x1c58('0x7d')](_0x3923c7);}})['then'](function(_0x1f1545){if(_0x1f1545){_0x1f168d=_0x1f1545[_0x1c58('0x30')];if(!_0xaebf71['query'][_0x1c58('0x44')](_0x1c58('0x45'))){_0x3923c7[_0x1c58('0x10')]=qs[_0x1c58('0x10')](_0xaebf71['query'][_0x1c58('0x10')]);_0x3923c7[_0x1c58('0x13')]=qs[_0x1c58('0x13')](_0xaebf71[_0x1c58('0x25')]['offset']);}return _0x2b4181[_0x1c58('0x7d')](_0x3923c7);}})[_0x1c58('0x16')](function(_0x4f4e19){if(_0x4f4e19){return _0x4f4e19?{'count':_0x1f168d,'rows':_0x4f4e19}:null;}})[_0x1c58('0x16')](respondWithResult(_0x370c65,null))['catch'](handleError(_0x370c65,null));}; \ No newline at end of file +var _0x0c88=['addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserOpenchannelQueue','findOrCreate','emit','removeTeams','select','field','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','compact','value','ids','isEmpty','removeAgents','userOpenchannelQueue:remove','omit','spread','userOpenchannelQueue:save','isArray','getAgents','bluebird','util','lodash','squel','api','../../config/environment','redis','defaults','localhost','./openchannelQueue.socket','register','end','json','undefined','count','offset','status','set','update','then','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','destroy','describe','getMembers','findOne','hasOwnProperty','nolimit','limit','sort','where','pick','filter','User','updatedAt','createdAt','format','openchannelPause','Team','order','getTeams'];(function(_0x81d7c0,_0x11ac68){var _0x3d8ff5=function(_0x2280ea){while(--_0x2280ea){_0x81d7c0['push'](_0x81d7c0['shift']());}};_0x3d8ff5(++_0x11ac68);}(_0x0c88,0x115));var _0x80c8=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x0c88[_0x9307ea];return _0x295554;};'use strict';var BPromise=require(_0x80c8('0x0'));var util=require(_0x80c8('0x1'));var _=require(_0x80c8('0x2'));var squel=require(_0x80c8('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x80c8('0x4'));var config=require(_0x80c8('0x5'));var db=require('../../mysqldb')['db'];config[_0x80c8('0x6')]=_[_0x80c8('0x7')](config[_0x80c8('0x6')],{'host':_0x80c8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x80c8('0x6')]));require(_0x80c8('0x9'))[_0x80c8('0xa')](socket);function respondWithStatusCode(_0x1b1668,_0x487dca){_0x487dca=_0x487dca||0xcc;return function(_0x17f00e){if(_0x17f00e){return _0x1b1668['sendStatus'](_0x487dca);}return _0x1b1668['status'](_0x487dca)[_0x80c8('0xb')]();};}function respondWithResult(_0x426163,_0x2527b5){_0x2527b5=_0x2527b5||0xc8;return function(_0x2aba6e){if(_0x2aba6e){return _0x426163['status'](_0x2527b5)[_0x80c8('0xc')](_0x2aba6e);}};}function respondWithFilteredResult(_0xe83350,_0xdeeac2){return function(_0x2511e3){if(_0x2511e3){var _0x3f0ccd=typeof _0xdeeac2['offset']==='undefined'&&typeof _0xdeeac2['limit']===_0x80c8('0xd');var _0x681287=_0x2511e3[_0x80c8('0xe')];var _0x120b2=_0x3f0ccd?0x0:_0xdeeac2[_0x80c8('0xf')];var _0x3bdb31=_0x3f0ccd?_0x2511e3[_0x80c8('0xe')]:_0xdeeac2[_0x80c8('0xf')]+_0xdeeac2['limit'];var _0x49faf8;if(_0x3bdb31>=_0x681287){_0x3bdb31=_0x681287;_0x49faf8=0xc8;}else{_0x49faf8=0xce;}_0xe83350[_0x80c8('0x10')](_0x49faf8);return _0xe83350[_0x80c8('0x11')]('Content-Range',_0x120b2+'-'+_0x3bdb31+'/'+_0x681287)[_0x80c8('0xc')](_0x2511e3);}return null;};}function saveUpdates(_0x2d448b){return function(_0x4db956){if(_0x4db956){return _0x4db956[_0x80c8('0x12')](_0x2d448b)[_0x80c8('0x13')](function(_0x88cff3){return _0x88cff3;});}return null;};}function removeEntity(_0xa9c925){return function(_0x4645c3){if(_0x4645c3){return _0x4645c3['destroy']()[_0x80c8('0x13')](function(){var _0x3ca52e=_0x4645c3[_0x80c8('0x14')]({'plain':!![]});var _0xce0231=_0x80c8('0x15');return db[_0x80c8('0x16')]['destroy']({'where':{'type':_0xce0231,'resourceId':_0x3ca52e['id']}})[_0x80c8('0x13')](function(){return _0x4645c3;});})[_0x80c8('0x13')](function(){_0xa9c925['status'](0xcc)[_0x80c8('0xb')]();});}};}function handleEntityNotFound(_0x148599){return function(_0x5580a1){if(!_0x5580a1){_0x148599[_0x80c8('0x17')](0x194);}return _0x5580a1;};}function handleError(_0x2f716b,_0x67d800){_0x67d800=_0x67d800||0x1f4;return function(_0x5eb430){logger[_0x80c8('0x18')](_0x5eb430[_0x80c8('0x19')]);if(_0x5eb430[_0x80c8('0x1a')]){delete _0x5eb430[_0x80c8('0x1a')];}_0x2f716b['status'](_0x67d800)[_0x80c8('0x1b')](_0x5eb430);};}exports[_0x80c8('0x1c')]=function(_0x5cef14,_0x19da9d){var _0x1ea594={};var _0x3cafd0={'count':0x0,'rows':[]};var _0x5be5e4=_[_0x80c8('0x1d')](db[_0x80c8('0x1e')][_0x80c8('0x1f')],function(_0x3ac767){return{'name':_0x3ac767[_0x80c8('0x20')],'type':_0x3ac767[_0x80c8('0x21')][_0x80c8('0x22')]};});_0x1ea594=qs[_0x80c8('0x23')](_0x5be5e4,_0x5cef14);var _0x379023={'where':_0x1ea594['where']};return db[_0x80c8('0x1e')][_0x80c8('0xe')](_0x379023)[_0x80c8('0x13')](function(_0x4fc969){_0x3cafd0[_0x80c8('0xe')]=_0x4fc969;_0x1ea594[_0x80c8('0x24')]=qs['include'](_0x5cef14[_0x80c8('0x25')]);return db['OpenchannelQueue'][_0x80c8('0x26')](_0x1ea594);})['then'](function(_0x76247c){_0x3cafd0[_0x80c8('0x27')]=_0x76247c;return _0x3cafd0;})['then'](respondWithFilteredResult(_0x19da9d,_0x1ea594))[_0x80c8('0x28')](handleError(_0x19da9d,null));};exports[_0x80c8('0x29')]=function(_0x2ba41c,_0x3f7a55){var _0x354453={'raw':!![],'where':{'id':_0x2ba41c[_0x80c8('0x2a')]['id']}},_0x5eeccd={};_0x5eeccd[_0x80c8('0x2b')]=_[_0x80c8('0x2c')](db[_0x80c8('0x1e')][_0x80c8('0x1f')]);_0x5eeccd[_0x80c8('0x25')]=_['keys'](_0x2ba41c['query']);_0x5eeccd[_0x80c8('0x2d')]=_[_0x80c8('0x2e')](_0x5eeccd['model'],_0x5eeccd['query']);_0x354453[_0x80c8('0x2f')]=_[_0x80c8('0x2e')](_0x5eeccd[_0x80c8('0x2b')],qs[_0x80c8('0x30')](_0x2ba41c[_0x80c8('0x25')][_0x80c8('0x30')]));_0x354453[_0x80c8('0x2f')]=_0x354453[_0x80c8('0x2f')][_0x80c8('0x31')]?_0x354453[_0x80c8('0x2f')]:_0x5eeccd[_0x80c8('0x2b')];if(_0x2ba41c[_0x80c8('0x25')][_0x80c8('0x32')]){_0x354453['include']=[{'all':!![]}];}_0x354453=_[_0x80c8('0x33')]({},_0x354453,_0x2ba41c[_0x80c8('0x34')]);return db[_0x80c8('0x1e')][_0x80c8('0x35')](_0x354453)[_0x80c8('0x13')](handleEntityNotFound(_0x3f7a55,null))[_0x80c8('0x13')](respondWithResult(_0x3f7a55,null))['catch'](handleError(_0x3f7a55,null));};exports[_0x80c8('0x36')]=function(_0x1e5943,_0x2a5351){return db['OpenchannelQueue']['create'](_0x1e5943[_0x80c8('0x37')],{})[_0x80c8('0x13')](function(_0x120077){var _0x244cf1=_0x1e5943[_0x80c8('0x38')][_0x80c8('0x14')]({'plain':!![]});if(!_0x244cf1)throw new Error(_0x80c8('0x39'));if(_0x244cf1[_0x80c8('0x3a')]===_0x80c8('0x38')){var _0x4dc02c=_0x120077[_0x80c8('0x14')]({'plain':!![]});var _0xda07a=_0x80c8('0x15');return db[_0x80c8('0x3b')]['find']({'where':{'name':_0xda07a,'userProfileId':_0x244cf1['userProfileId']},'raw':!![]})['then'](function(_0x5d75ae){if(_0x5d75ae&&_0x5d75ae[_0x80c8('0x3c')]===0x0){return db['UserProfileResource'][_0x80c8('0x36')]({'name':_0x4dc02c['name'],'resourceId':_0x4dc02c['id'],'type':_0x5d75ae[_0x80c8('0x1a')],'sectionId':_0x5d75ae['id']},{})[_0x80c8('0x13')](function(){return _0x120077;});}else{return _0x120077;}})[_0x80c8('0x28')](function(_0x3a7ff8){logger[_0x80c8('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a7ff8);throw _0x3a7ff8;});}return _0x120077;})[_0x80c8('0x13')](respondWithResult(_0x2a5351,0xc9))[_0x80c8('0x28')](handleError(_0x2a5351,null));};exports['update']=function(_0x3a2f82,_0x5d5bb2){if(_0x3a2f82[_0x80c8('0x37')]['id']){delete _0x3a2f82[_0x80c8('0x37')]['id'];}return db[_0x80c8('0x1e')][_0x80c8('0x35')]({'where':{'id':_0x3a2f82[_0x80c8('0x2a')]['id']}})[_0x80c8('0x13')](handleEntityNotFound(_0x5d5bb2,null))[_0x80c8('0x13')](saveUpdates(_0x3a2f82[_0x80c8('0x37')],null))[_0x80c8('0x13')](respondWithResult(_0x5d5bb2,null))[_0x80c8('0x28')](handleError(_0x5d5bb2,null));};exports[_0x80c8('0x3d')]=function(_0xa77689,_0x3cd8ef){return db[_0x80c8('0x1e')][_0x80c8('0x35')]({'where':{'id':_0xa77689[_0x80c8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3cd8ef,null))[_0x80c8('0x13')](removeEntity(_0x3cd8ef,null))[_0x80c8('0x28')](handleError(_0x3cd8ef,null));};exports['describe']=function(_0x5230f4,_0x3985d8){return db[_0x80c8('0x1e')][_0x80c8('0x3e')]()[_0x80c8('0x13')](respondWithResult(_0x3985d8,null))['catch'](handleError(_0x3985d8,null));};exports[_0x80c8('0x3f')]=function(_0x26b6fa,_0x44b4ed){var _0x5a72ef={'raw':!![],'where':{}},_0x181fee={},_0x56219f;return db[_0x80c8('0x1e')][_0x80c8('0x40')]({'where':{'id':_0x26b6fa[_0x80c8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x44b4ed,null))[_0x80c8('0x13')](function(_0x210cbf){if(_0x210cbf){_0x56219f=_0x210cbf[_0x80c8('0x14')]({'plain':!![]});_0x181fee[_0x80c8('0x2b')]=_[_0x80c8('0x2c')](db['UserOpenchannelQueue']['rawAttributes']);_0x181fee[_0x80c8('0x25')]=_['keys'](_0x26b6fa['query']);_0x181fee[_0x80c8('0x2d')]=_[_0x80c8('0x2e')](_0x181fee[_0x80c8('0x2b')],_0x181fee['query']);_0x5a72ef[_0x80c8('0x2f')]=_[_0x80c8('0x2e')](_0x181fee['model'],qs[_0x80c8('0x30')](_0x26b6fa[_0x80c8('0x25')][_0x80c8('0x30')]));_0x5a72ef[_0x80c8('0x2f')]=_0x5a72ef[_0x80c8('0x2f')][_0x80c8('0x31')]?_0x5a72ef[_0x80c8('0x2f')]:_0x181fee[_0x80c8('0x2b')];if(!_0x26b6fa['query'][_0x80c8('0x41')](_0x80c8('0x42'))){_0x5a72ef[_0x80c8('0x43')]=qs[_0x80c8('0x43')](_0x26b6fa[_0x80c8('0x25')]['limit']);_0x5a72ef[_0x80c8('0xf')]=qs[_0x80c8('0xf')](_0x26b6fa[_0x80c8('0x25')][_0x80c8('0xf')]);}_0x5a72ef['order']=qs[_0x80c8('0x44')](_0x26b6fa[_0x80c8('0x25')][_0x80c8('0x44')]);_0x5a72ef[_0x80c8('0x45')]=qs[_0x80c8('0x2d')](_[_0x80c8('0x46')](_0x26b6fa[_0x80c8('0x25')],_0x181fee[_0x80c8('0x2d')]));_0x5a72ef[_0x80c8('0x45')]['OpenchannelQueueId']=_0x210cbf['id'];if(_0x26b6fa[_0x80c8('0x25')]['filter']){_0x5a72ef[_0x80c8('0x45')]=_[_0x80c8('0x33')](_0x5a72ef[_0x80c8('0x45')],{'$or':_[_0x80c8('0x1d')](_0x5a72ef['attributes'],function(_0x499a89){var _0x543cf8={};_0x543cf8[_0x499a89]={'$like':'%'+_0x26b6fa[_0x80c8('0x25')][_0x80c8('0x47')]+'%'};return _0x543cf8;})});}_0x5a72ef=_[_0x80c8('0x33')]({},_0x5a72ef,_0x26b6fa['options']);return db['UserOpenchannelQueue'][_0x80c8('0x26')](_0x5a72ef);}})['then'](function(_0x5bfb64){if(_0x5bfb64){return db[_0x80c8('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x5bfb64,'UserId'),'role':'agent'},'attributes':['id',_0x80c8('0x1a'),'openchannelPause',_0x80c8('0x49'),_0x80c8('0x4a')]});}})['then'](function(_0x38cc26){if(_0x38cc26){return{'count':_0x38cc26[_0x80c8('0xe')],'rows':_['map'](_0x38cc26['rows'],function(_0x3e2c8f){return{'membername':_0x3e2c8f['name'],'UserId':_0x3e2c8f['id'],'queue_name':_0x56219f[_0x80c8('0x1a')],'OpenchannelQueueId':_0x56219f['id'],'interface':util[_0x80c8('0x4b')]('%s/%s','SIP',_0x3e2c8f['name']),'penalty':0x0,'paused':_0x3e2c8f[_0x80c8('0x4c')],'createdAt':_0x3e2c8f[_0x80c8('0x4a')],'updatedAt':_0x3e2c8f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x80c8('0x13')](respondWithFilteredResult(_0x44b4ed,_0x5a72ef))['catch'](handleError(_0x44b4ed,null));};exports['getTeams']=function(_0x47bc2e,_0x530ff4){var _0x479507={};var _0x273f32={};var _0x188dc8;var _0x3b7c4;return db['OpenchannelQueue'][_0x80c8('0x40')]({'where':{'id':_0x47bc2e['params']['id']}})['then'](handleEntityNotFound(_0x530ff4,null))['then'](function(_0x2174d5){if(_0x2174d5){_0x188dc8=_0x2174d5;_0x273f32[_0x80c8('0x2b')]=_[_0x80c8('0x2c')](db[_0x80c8('0x4d')][_0x80c8('0x1f')]);_0x273f32[_0x80c8('0x25')]=_[_0x80c8('0x2c')](_0x47bc2e['query']);_0x273f32[_0x80c8('0x2d')]=_[_0x80c8('0x2e')](_0x273f32[_0x80c8('0x2b')],_0x273f32[_0x80c8('0x25')]);_0x479507['attributes']=_[_0x80c8('0x2e')](_0x273f32[_0x80c8('0x2b')],qs[_0x80c8('0x30')](_0x47bc2e[_0x80c8('0x25')][_0x80c8('0x30')]));_0x479507[_0x80c8('0x2f')]=_0x479507[_0x80c8('0x2f')][_0x80c8('0x31')]?_0x479507[_0x80c8('0x2f')]:_0x273f32[_0x80c8('0x2b')];_0x479507[_0x80c8('0x4e')]=qs[_0x80c8('0x44')](_0x47bc2e['query'][_0x80c8('0x44')]);_0x479507[_0x80c8('0x45')]=qs[_0x80c8('0x2d')](_[_0x80c8('0x46')](_0x47bc2e[_0x80c8('0x25')],_0x273f32[_0x80c8('0x2d')]));if(_0x47bc2e[_0x80c8('0x25')]['filter']){_0x479507[_0x80c8('0x45')]=_[_0x80c8('0x33')](_0x479507[_0x80c8('0x45')],{'$or':_[_0x80c8('0x1d')](_0x479507[_0x80c8('0x2f')],function(_0x4ae961){var _0x445189={};_0x445189[_0x4ae961]={'$like':'%'+_0x47bc2e[_0x80c8('0x25')][_0x80c8('0x47')]+'%'};return _0x445189;})});}_0x479507=_[_0x80c8('0x33')]({},_0x479507,_0x47bc2e[_0x80c8('0x34')]);return _0x188dc8[_0x80c8('0x4f')](_0x479507);}})['then'](function(_0xc85596){if(_0xc85596){_0x3b7c4=_0xc85596['length'];if(!_0x47bc2e[_0x80c8('0x25')][_0x80c8('0x41')]('nolimit')){_0x479507[_0x80c8('0x43')]=qs[_0x80c8('0x43')](_0x47bc2e[_0x80c8('0x25')][_0x80c8('0x43')]);_0x479507[_0x80c8('0xf')]=qs[_0x80c8('0xf')](_0x47bc2e[_0x80c8('0x25')][_0x80c8('0xf')]);}return _0x188dc8[_0x80c8('0x4f')](_0x479507);}})[_0x80c8('0x13')](function(_0x4a1d41){if(_0x4a1d41){return _0x4a1d41?{'count':_0x3b7c4,'rows':_0x4a1d41}:null;}})[_0x80c8('0x13')](respondWithResult(_0x530ff4,null))[_0x80c8('0x28')](handleError(_0x530ff4,null));};exports[_0x80c8('0x50')]=function(_0x848704,_0x3c240c){var _0xb0966e=_0x848704['body']['ids'];return db[_0x80c8('0x4d')][_0x80c8('0x26')]({'where':{'id':_0xb0966e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x80c8('0x51'),'attributes':['id',_0x80c8('0x1a'),'online',_0x80c8('0x52'),_0x80c8('0x53')],'raw':!![]}]})['then'](function(_0x2d4c38){if(_0x2d4c38){var _0xf1b814=_[_0x80c8('0x54')](_0x2d4c38,function(_0x29bf71){var _0x1d6fa2=_0x29bf71[_0x80c8('0x14')]({'plain':!![]});return _0x1d6fa2[_0x80c8('0x51')];});return db[_0x80c8('0x1e')][_0x80c8('0x35')]({'where':{'id':_0x848704[_0x80c8('0x2a')]['id']}})[_0x80c8('0x13')](function(_0x3c46e3){return db[_0x80c8('0x55')][_0x80c8('0x56')](function(_0x491737){return _0x3c46e3['addTeams'](_0xb0966e,{'transaction':_0x491737})[_0x80c8('0x13')](function(){return BPromise[_0x80c8('0x57')](_0xf1b814,function(_0x44dd4f){return db[_0x80c8('0x58')][_0x80c8('0x59')]({'where':{'UserId':_0x44dd4f['id'],'OpenchannelQueueId':_0x848704[_0x80c8('0x2a')]['id']},'transaction':_0x491737});});})[_0x80c8('0x13')](function(){_0xf1b814['forEach'](function(_0x518264){socket[_0x80c8('0x5a')]('userOpenchannelQueue:save',{'UserId':_0x518264['id'],'OpenchannelQueueId':_0x3c46e3['id']});});});});});}})['then'](respondWithStatusCode(_0x3c240c,null))['catch'](handleError(_0x3c240c,null));};exports[_0x80c8('0x5b')]=function(_0x793ad7,_0x510fd5){return db['Team'][_0x80c8('0x26')]({'where':{'id':_0x793ad7[_0x80c8('0x25')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x80c8('0x51'),'attributes':['id'],'raw':!![]}]})[_0x80c8('0x13')](handleEntityNotFound(_0x510fd5,null))['then'](function(_0x25def5){var _0x12bd46=_['map'](_0x25def5,'id');var _0x25a452=[];var _0x34add9=[];var _0x4b7901=squel[_0x80c8('0x5c')]();_0x4b7901[_0x80c8('0x5d')]('tq.TeamId')[_0x80c8('0x5e')](_0x80c8('0x5f'),'tq')['join'](_0x80c8('0x60'),'ut',_0x80c8('0x61'))['where'](_0x80c8('0x62'),_0x793ad7[_0x80c8('0x2a')]['id']);for(var _0xe62775=0x0;_0xe62775<_0x25def5[_0x80c8('0x31')];_0xe62775+=0x1){let _0x200143=_0x25def5[_0xe62775];for(var _0x4c6f7e=0x0;_0x4c6f7e<_0x200143[_0x80c8('0x51')]['length'];_0x4c6f7e+=0x1){let _0x5d338e=_0x200143[_0x80c8('0x51')][_0x4c6f7e];var _0x513f16=_0x4b7901[_0x80c8('0x63')]();_0x513f16[_0x80c8('0x45')](_0x80c8('0x64'),_0x5d338e['id']);_0x34add9[_0x80c8('0x65')](db[_0x80c8('0x55')][_0x80c8('0x25')](_0x513f16[_0x80c8('0x66')](),{'type':db[_0x80c8('0x55')][_0x80c8('0x67')][_0x80c8('0x68')]})[_0x80c8('0x13')](function(_0x42164b){if(_0x42164b[_0x80c8('0x31')]===0x1){return _0x5d338e['id'];}else{var _0x1365bf=_[_0x80c8('0x69')](_[_0x80c8('0x1d')](_0x42164b,'TeamId'),function(_0x161550){return _[_0x80c8('0x6a')](_0x12bd46,_0x161550);});if(_0x1365bf){return _0x5d338e['id'];}}}));}}return BPromise[_0x80c8('0x6b')](_0x34add9)[_0x80c8('0x13')](function(_0x86bb9d){_0x25a452=_(_0x25a452)['union'](_0x86bb9d)[_0x80c8('0x6c')]()[_0x80c8('0x6d')]();return db[_0x80c8('0x1e')][_0x80c8('0x35')]({'where':{'id':_0x793ad7[_0x80c8('0x2a')]['id']}})[_0x80c8('0x13')](function(_0x5e34e6){return db[_0x80c8('0x55')]['transaction'](function(_0x3048d3){return _0x5e34e6[_0x80c8('0x5b')](_0x793ad7[_0x80c8('0x25')][_0x80c8('0x6e')],{'transaction':_0x3048d3})[_0x80c8('0x13')](function(){if(!_[_0x80c8('0x6f')](_0x25a452)){return _0x5e34e6[_0x80c8('0x70')](_0x25a452,{'transaction':_0x3048d3});}})['then'](function(){_0x25a452['forEach'](function(_0xd1d529){socket[_0x80c8('0x5a')](_0x80c8('0x71'),{'UserId':_0xd1d529,'OpenchannelQueueId':_0x5e34e6['id']});});});});});});})[_0x80c8('0x13')](respondWithStatusCode(_0x510fd5,null))['catch'](handleError(_0x510fd5,null));};exports['addAgents']=function(_0x3fc789,_0x3a06ec){return db['OpenchannelQueue'][_0x80c8('0x35')]({'where':{'id':_0x3fc789['params']['id']}})[_0x80c8('0x13')](handleEntityNotFound(_0x3a06ec,null))['then'](function(_0x4c8724){if(_0x4c8724){return _0x4c8724['addAgents'](_0x3fc789[_0x80c8('0x37')][_0x80c8('0x6e')],_[_0x80c8('0x72')](_0x3fc789[_0x80c8('0x37')],['ids','id'])||{})[_0x80c8('0x73')](function(_0x32f18b){for(var _0x42b37d=0x0;_0x42b37d<_0x3fc789[_0x80c8('0x37')][_0x80c8('0x6e')][_0x80c8('0x31')];_0x42b37d+=0x1){socket[_0x80c8('0x5a')](_0x80c8('0x74'),{'UserId':Number(_0x3fc789[_0x80c8('0x37')]['ids'][_0x42b37d]),'OpenchannelQueueId':Number(_0x3fc789[_0x80c8('0x2a')]['id'])});}return _0x32f18b;});}})[_0x80c8('0x13')](respondWithResult(_0x3a06ec,null))[_0x80c8('0x28')](handleError(_0x3a06ec,null));};exports['removeAgents']=function(_0x16c9ac,_0x42d4b8){return db['OpenchannelQueue'][_0x80c8('0x35')]({'where':{'id':_0x16c9ac['params']['id']}})[_0x80c8('0x13')](handleEntityNotFound(_0x42d4b8,null))[_0x80c8('0x13')](function(_0x5f0ee3){if(_0x5f0ee3){return _0x5f0ee3['removeAgents'](_0x16c9ac[_0x80c8('0x25')][_0x80c8('0x6e')])[_0x80c8('0x13')](function(){if(_[_0x80c8('0x75')](_0x16c9ac[_0x80c8('0x25')]['ids'])){for(var _0x56403a=0x0;_0x56403a<_0x16c9ac[_0x80c8('0x25')][_0x80c8('0x6e')]['length'];_0x56403a+=0x1){socket[_0x80c8('0x5a')](_0x80c8('0x71'),{'UserId':Number(_0x16c9ac[_0x80c8('0x25')][_0x80c8('0x6e')][_0x56403a]),'OpenchannelQueueId':Number(_0x16c9ac['params']['id'])});}}else{socket[_0x80c8('0x5a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x16c9ac[_0x80c8('0x25')][_0x80c8('0x6e')]),'OpenchannelQueueId':Number(_0x16c9ac[_0x80c8('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x42d4b8,null))[_0x80c8('0x28')](handleError(_0x42d4b8,null));};exports['getAgents']=function(_0x461be2,_0x5cbaaf){var _0x21b86c={};var _0x1d4f4a={};var _0x17e545;var _0x46fd5d;return db[_0x80c8('0x1e')][_0x80c8('0x40')]({'where':{'id':_0x461be2[_0x80c8('0x2a')]['id']}})[_0x80c8('0x13')](handleEntityNotFound(_0x5cbaaf,null))[_0x80c8('0x13')](function(_0x2d3ba5){if(_0x2d3ba5){_0x17e545=_0x2d3ba5;_0x1d4f4a['model']=_[_0x80c8('0x2c')](db[_0x80c8('0x48')][_0x80c8('0x1f')]);_0x1d4f4a[_0x80c8('0x25')]=_['keys'](_0x461be2[_0x80c8('0x25')]);_0x1d4f4a[_0x80c8('0x2d')]=_[_0x80c8('0x2e')](_0x1d4f4a[_0x80c8('0x2b')],_0x1d4f4a['query']);_0x21b86c[_0x80c8('0x2f')]=_[_0x80c8('0x2e')](_0x1d4f4a[_0x80c8('0x2b')],qs[_0x80c8('0x30')](_0x461be2['query'][_0x80c8('0x30')]));_0x21b86c[_0x80c8('0x2f')]=_0x21b86c[_0x80c8('0x2f')][_0x80c8('0x31')]?_0x21b86c[_0x80c8('0x2f')]:_0x1d4f4a[_0x80c8('0x2b')];_0x21b86c[_0x80c8('0x4e')]=qs['sort'](_0x461be2[_0x80c8('0x25')]['sort']);_0x21b86c[_0x80c8('0x45')]=qs['filters'](_[_0x80c8('0x46')](_0x461be2[_0x80c8('0x25')],_0x1d4f4a[_0x80c8('0x2d')]));if(_0x461be2[_0x80c8('0x25')]['filter']){_0x21b86c[_0x80c8('0x45')]=_[_0x80c8('0x33')](_0x21b86c[_0x80c8('0x45')],{'$or':_[_0x80c8('0x1d')](_0x21b86c[_0x80c8('0x2f')],function(_0x2c1972){var _0xc64028={};_0xc64028[_0x2c1972]={'$like':'%'+_0x461be2[_0x80c8('0x25')][_0x80c8('0x47')]+'%'};return _0xc64028;})});}_0x21b86c=_[_0x80c8('0x33')]({},_0x21b86c,_0x461be2[_0x80c8('0x34')]);return _0x17e545[_0x80c8('0x76')](_0x21b86c);}})[_0x80c8('0x13')](function(_0x4e5aa7){if(_0x4e5aa7){_0x46fd5d=_0x4e5aa7[_0x80c8('0x31')];if(!_0x461be2['query']['hasOwnProperty'](_0x80c8('0x42'))){_0x21b86c['limit']=qs['limit'](_0x461be2[_0x80c8('0x25')][_0x80c8('0x43')]);_0x21b86c[_0x80c8('0xf')]=qs[_0x80c8('0xf')](_0x461be2[_0x80c8('0x25')][_0x80c8('0xf')]);}return _0x17e545[_0x80c8('0x76')](_0x21b86c);}})[_0x80c8('0x13')](function(_0x214c37){if(_0x214c37){return _0x214c37?{'count':_0x46fd5d,'rows':_0x214c37}:null;}})[_0x80c8('0x13')](respondWithResult(_0x5cbaaf,null))[_0x80c8('0x28')](handleError(_0x5cbaaf,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index ff94305..d508e32 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 _0x5d85=['events','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x2d63f2,_0x389dc8){var _0x414068=function(_0xfe4b75){while(--_0xfe4b75){_0x2d63f2['push'](_0x2d63f2['shift']());}};_0x414068(++_0x389dc8);}(_0x5d85,0x77));var _0x55d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5d85[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x55d8('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x55d8('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x55d8('0x2'),'afterDestroy':_0x55d8('0x3')};function emitEvent(_0x228488){return function(_0x35c7aa,_0x29ad1f,_0x165774){OpenchannelQueueEvents[_0x55d8('0x4')](_0x228488+':'+_0x35c7aa['id'],_0x35c7aa);OpenchannelQueueEvents[_0x55d8('0x4')](_0x228488,_0x35c7aa);_0x165774(null);};}for(var e in events){if(events[_0x55d8('0x5')](e)){var event=events[e];OpenchannelQueue[_0x55d8('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xdac5=['OpenchannelQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x22de84,_0x56142b){var _0x54fc49=function(_0x3be7bc){while(--_0x3be7bc){_0x22de84['push'](_0x22de84['shift']());}};_0x54fc49(++_0x56142b);}(_0xdac5,0xfc));var _0x5dac=function(_0x55ecba,_0x3a94e1){_0x55ecba=_0x55ecba-0x0;var _0xfb6474=_0xdac5[_0x55ecba];return _0xfb6474;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x5dac('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5dac('0x1')](0x0);var events={'afterCreate':_0x5dac('0x2'),'afterUpdate':'update','afterDestroy':_0x5dac('0x3')};function emitEvent(_0x451b6f){return function(_0x35e632,_0x3b4bda,_0x530353){OpenchannelQueueEvents[_0x5dac('0x4')](_0x451b6f+':'+_0x35e632['id'],_0x35e632);OpenchannelQueueEvents[_0x5dac('0x4')](_0x451b6f,_0x35e632);_0x530353(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x5dac('0x5')](e,emitEvent(event));}}module[_0x5dac('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 2da7ce2..03f833e 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 _0x2fb8=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment'];(function(_0x3f70cd,_0x6bf4ed){var _0x3feb93=function(_0x4a045a){while(--_0x4a045a){_0x3f70cd['push'](_0x3f70cd['shift']());}};_0x3feb93(++_0x6bf4ed);}(_0x2fb8,0x1e8));var _0x82fb=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2fb8[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x82fb('0x0'));var util=require('util');var logger=require(_0x82fb('0x1'))(_0x82fb('0x2'));var moment=require(_0x82fb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x82fb('0x4'));var rimraf=require(_0x82fb('0x5'));var config=require(_0x82fb('0x6'));var attributes=require(_0x82fb('0x7'));module[_0x82fb('0x8')]=function(_0x467c11,_0x1695f6){return _0x467c11[_0x82fb('0x9')](_0x82fb('0xa'),attributes,{'tableName':_0x82fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f30=['request-promise','path','../../config/environment','exports','define','OpenchannelQueue','lodash','util','../../config/logger','bluebird'];(function(_0x21c722,_0x40fb86){var _0x48a8f6=function(_0x201259){while(--_0x201259){_0x21c722['push'](_0x21c722['shift']());}};_0x48a8f6(++_0x40fb86);}(_0x9f30,0xce));var _0x09f3=function(_0x44014f,_0x17fa9c){_0x44014f=_0x44014f-0x0;var _0x4b1af9=_0x9f30[_0x44014f];return _0x4b1af9;};'use strict';var _=require(_0x09f3('0x0'));var util=require(_0x09f3('0x1'));var logger=require(_0x09f3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x09f3('0x3'));var rp=require(_0x09f3('0x4'));var fs=require('fs');var path=require(_0x09f3('0x5'));var rimraf=require('rimraf');var config=require(_0x09f3('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x09f3('0x7')]=function(_0x3217bd,_0x5bee0c){return _0x3217bd[_0x09f3('0x8')](_0x09f3('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index c3056ee..3ff2609 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 _0xcdde=['localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','model','include','map','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','client','http','redis','defaults'];(function(_0x16d3a7,_0x405ebe){var _0xa91a65=function(_0x2c1828){while(--_0x2c1828){_0x16d3a7['push'](_0x16d3a7['shift']());}};_0xa91a65(++_0x405ebe);}(_0xcdde,0x197));var _0xecdd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcdde[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xecdd('0x0'));var util=require(_0xecdd('0x1'));var moment=require(_0xecdd('0x2'));var BPromise=require(_0xecdd('0x3'));var rs=require(_0xecdd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xecdd('0x5'))(_0xecdd('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xecdd('0x7')][_0xecdd('0x8')]({'port':0x232a});config[_0xecdd('0x9')]=_[_0xecdd('0xa')](config[_0xecdd('0x9')],{'host':_0xecdd('0xb'),'port':0x18eb});var socket=require(_0xecdd('0xc'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xecdd('0xd')](socket);function respondWithRpcPromise(_0x126ead,_0x1c3124,_0x49e601){return new BPromise(function(_0x4a3576,_0x3f4056){return client[_0xecdd('0xe')](_0x126ead,_0x49e601)[_0xecdd('0xf')](function(_0x3ca557){logger[_0xecdd('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x1c3124,_0xecdd('0x11'));logger[_0xecdd('0x12')](_0xecdd('0x13'),_0x1c3124,_0xecdd('0x11'),JSON[_0xecdd('0x14')](_0x3ca557));if(_0x3ca557[_0xecdd('0x15')]){if(_0x3ca557[_0xecdd('0x15')][_0xecdd('0x16')]===0x1f4){logger[_0xecdd('0x15')](_0xecdd('0x17'),_0x1c3124,_0x3ca557['error'][_0xecdd('0x18')]);return _0x3f4056(_0x3ca557[_0xecdd('0x15')][_0xecdd('0x18')]);}logger[_0xecdd('0x15')](_0xecdd('0x17'),_0x1c3124,_0x3ca557[_0xecdd('0x15')][_0xecdd('0x18')]);return _0x4a3576(_0x3ca557['error'][_0xecdd('0x18')]);}else{logger[_0xecdd('0x10')](_0xecdd('0x17'),_0x1c3124,_0xecdd('0x11'));_0x4a3576(_0x3ca557[_0xecdd('0x19')][_0xecdd('0x18')]);}})[_0xecdd('0x1a')](function(_0x53e6f1){logger[_0xecdd('0x15')](_0xecdd('0x17'),_0x1c3124,_0x53e6f1);_0x3f4056(_0x53e6f1);});});}exports[_0xecdd('0x1b')]=function(_0x1e16f0){var _0x805232=this;return new Promise(function(_0x4ee292,_0x7a21d8){return db[_0xecdd('0x1c')][_0xecdd('0x1d')]({'raw':_0x1e16f0[_0xecdd('0x1e')]?_0x1e16f0[_0xecdd('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1e16f0[_0xecdd('0x1e')]?_0x1e16f0['options'][_0xecdd('0x1f')]||null:null,'attributes':_0x1e16f0[_0xecdd('0x1e')]?_0x1e16f0[_0xecdd('0x1e')][_0xecdd('0x20')]||null:null,'limit':_0x1e16f0[_0xecdd('0x1e')]?_0x1e16f0['options'][_0xecdd('0x21')]||null:null,'include':_0x1e16f0[_0xecdd('0x1e')]?_0x1e16f0['options']['include']?_['map'](_0x1e16f0[_0xecdd('0x1e')]['include'],function(_0x206311){return{'model':db[_0x206311[_0xecdd('0x22')]],'as':_0x206311['as'],'attributes':_0x206311[_0xecdd('0x20')],'include':_0x206311[_0xecdd('0x23')]?_['map'](_0x206311[_0xecdd('0x23')],function(_0x2e2944){return{'model':db[_0x2e2944[_0xecdd('0x22')]],'as':_0x2e2944['as'],'attributes':_0x2e2944['attributes'],'include':_0x2e2944['include']?_[_0xecdd('0x24')](_0x2e2944[_0xecdd('0x23')],function(_0x11913e){return{'model':db[_0x11913e[_0xecdd('0x22')]],'as':_0x11913e['as'],'attributes':_0x11913e[_0xecdd('0x20')]};}):[]};}):[]};}):[]:[]})[_0xecdd('0xf')](function(_0x5b0bfe){logger[_0xecdd('0x10')](_0xecdd('0x1b'),_0x1e16f0);logger[_0xecdd('0x12')](_0xecdd('0x1b'),_0x1e16f0,JSON[_0xecdd('0x14')](_0x5b0bfe));_0x4ee292(_0x5b0bfe);})[_0xecdd('0x1a')](function(_0x164e0e){logger[_0xecdd('0x15')]('GetOpenchannelQueue',_0x164e0e[_0xecdd('0x18')],_0x1e16f0);_0x7a21d8(_0x805232[_0xecdd('0x15')](0x1f4,_0x164e0e[_0xecdd('0x18')]));});});};exports['ShowOpenchannelQueue']=function(_0x3bf3ee){var _0x578edc=this;return new Promise(function(_0x51d46e,_0x4bf901){return db[_0xecdd('0x1c')]['find']({'raw':_0x3bf3ee[_0xecdd('0x1e')]?_0x3bf3ee[_0xecdd('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3bf3ee['options']?_0x3bf3ee[_0xecdd('0x1e')]['where']||null:null,'attributes':_0x3bf3ee['options']?_0x3bf3ee[_0xecdd('0x1e')][_0xecdd('0x20')]||null:null,'include':_0x3bf3ee[_0xecdd('0x1e')]?_0x3bf3ee[_0xecdd('0x1e')]['include']?_['map'](_0x3bf3ee['options']['include'],function(_0x4d80ca){return{'model':db[_0x4d80ca[_0xecdd('0x22')]],'as':_0x4d80ca['as'],'attributes':_0x4d80ca[_0xecdd('0x20')],'include':_0x4d80ca[_0xecdd('0x23')]?_['map'](_0x4d80ca['include'],function(_0x3721cd){return{'model':db[_0x3721cd[_0xecdd('0x22')]],'as':_0x3721cd['as'],'attributes':_0x3721cd[_0xecdd('0x20')],'include':_0x3721cd[_0xecdd('0x23')]?_['map'](_0x3721cd[_0xecdd('0x23')],function(_0x18056d){return{'model':db[_0x18056d[_0xecdd('0x22')]],'as':_0x18056d['as'],'attributes':_0x18056d[_0xecdd('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19b964){logger[_0xecdd('0x10')]('ShowOpenchannelQueue',_0x3bf3ee);logger[_0xecdd('0x12')](_0xecdd('0x25'),_0x3bf3ee,JSON['stringify'](_0x19b964));_0x51d46e(_0x19b964);})[_0xecdd('0x1a')](function(_0x90e6c6){logger[_0xecdd('0x15')](_0xecdd('0x25'),_0x90e6c6[_0xecdd('0x18')],_0x3bf3ee);_0x4bf901(_0x578edc[_0xecdd('0x15')](0x1f4,_0x90e6c6[_0xecdd('0x18')]));});});}; \ No newline at end of file +var _0xac5a=['find','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue'];(function(_0x2e0482,_0x1ffe16){var _0x3636e1=function(_0x14c95b){while(--_0x14c95b){_0x2e0482['push'](_0x2e0482['shift']());}};_0x3636e1(++_0x1ffe16);}(_0xac5a,0x192));var _0xaac5=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0xac5a[_0x545bed];return _0x16c79c;};'use strict';var _=require('lodash');var util=require(_0xaac5('0x0'));var moment=require(_0xaac5('0x1'));var BPromise=require(_0xaac5('0x2'));var rs=require(_0xaac5('0x3'));var fs=require('fs');var Redis=require(_0xaac5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaac5('0x5'));var logger=require(_0xaac5('0x6'))(_0xaac5('0x7'));var config=require(_0xaac5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac5('0x9')][_0xaac5('0xa')]({'port':0x232a});config[_0xaac5('0xb')]=_['defaults'](config[_0xaac5('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaac5('0xb')]));require(_0xaac5('0xc'))[_0xaac5('0xd')](socket);function respondWithRpcPromise(_0x1fe214,_0x304196,_0xa74974){return new BPromise(function(_0x14d328,_0xe433ea){return client[_0xaac5('0xe')](_0x1fe214,_0xa74974)[_0xaac5('0xf')](function(_0x23393e){logger[_0xaac5('0x10')](_0xaac5('0x11'),_0x304196,_0xaac5('0x12'));logger[_0xaac5('0x13')](_0xaac5('0x14'),_0x304196,_0xaac5('0x12'),JSON[_0xaac5('0x15')](_0x23393e));if(_0x23393e[_0xaac5('0x16')]){if(_0x23393e[_0xaac5('0x16')][_0xaac5('0x17')]===0x1f4){logger['error'](_0xaac5('0x11'),_0x304196,_0x23393e[_0xaac5('0x16')][_0xaac5('0x18')]);return _0xe433ea(_0x23393e[_0xaac5('0x16')]['message']);}logger['error'](_0xaac5('0x11'),_0x304196,_0x23393e[_0xaac5('0x16')][_0xaac5('0x18')]);return _0x14d328(_0x23393e[_0xaac5('0x16')]['message']);}else{logger[_0xaac5('0x10')](_0xaac5('0x11'),_0x304196,_0xaac5('0x12'));_0x14d328(_0x23393e[_0xaac5('0x19')][_0xaac5('0x18')]);}})[_0xaac5('0x1a')](function(_0x411ec7){logger[_0xaac5('0x16')](_0xaac5('0x11'),_0x304196,_0x411ec7);_0xe433ea(_0x411ec7);});});}exports[_0xaac5('0x1b')]=function(_0x59ec83){var _0x401116=this;return new Promise(function(_0x5aa620,_0x2e4516){return db[_0xaac5('0x1c')][_0xaac5('0x1d')]({'raw':_0x59ec83[_0xaac5('0x1e')]?_0x59ec83[_0xaac5('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x59ec83['options']?_0x59ec83[_0xaac5('0x1e')][_0xaac5('0x1f')]||null:null,'attributes':_0x59ec83[_0xaac5('0x1e')]?_0x59ec83[_0xaac5('0x1e')][_0xaac5('0x20')]||null:null,'limit':_0x59ec83[_0xaac5('0x1e')]?_0x59ec83[_0xaac5('0x1e')][_0xaac5('0x21')]||null:null,'include':_0x59ec83[_0xaac5('0x1e')]?_0x59ec83['options'][_0xaac5('0x22')]?_[_0xaac5('0x23')](_0x59ec83[_0xaac5('0x1e')][_0xaac5('0x22')],function(_0x3a4a2f){return{'model':db[_0x3a4a2f[_0xaac5('0x24')]],'as':_0x3a4a2f['as'],'attributes':_0x3a4a2f['attributes'],'include':_0x3a4a2f[_0xaac5('0x22')]?_[_0xaac5('0x23')](_0x3a4a2f['include'],function(_0x2a0e61){return{'model':db[_0x2a0e61[_0xaac5('0x24')]],'as':_0x2a0e61['as'],'attributes':_0x2a0e61[_0xaac5('0x20')],'include':_0x2a0e61[_0xaac5('0x22')]?_['map'](_0x2a0e61[_0xaac5('0x22')],function(_0x343034){return{'model':db[_0x343034[_0xaac5('0x24')]],'as':_0x343034['as'],'attributes':_0x343034[_0xaac5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaac5('0xf')](function(_0x35f9c0){logger[_0xaac5('0x10')](_0xaac5('0x1b'),_0x59ec83);logger[_0xaac5('0x13')](_0xaac5('0x1b'),_0x59ec83,JSON[_0xaac5('0x15')](_0x35f9c0));_0x5aa620(_0x35f9c0);})['catch'](function(_0x9ad569){logger[_0xaac5('0x16')](_0xaac5('0x1b'),_0x9ad569[_0xaac5('0x18')],_0x59ec83);_0x2e4516(_0x401116[_0xaac5('0x16')](0x1f4,_0x9ad569[_0xaac5('0x18')]));});});};exports[_0xaac5('0x25')]=function(_0x4003ce){var _0x4bd6ff=this;return new Promise(function(_0x2cc73d,_0x1a6445){return db[_0xaac5('0x1c')][_0xaac5('0x26')]({'raw':_0x4003ce[_0xaac5('0x1e')]?_0x4003ce['options'][_0xaac5('0x27')]===undefined?!![]:![]:!![],'where':_0x4003ce[_0xaac5('0x1e')]?_0x4003ce[_0xaac5('0x1e')][_0xaac5('0x1f')]||null:null,'attributes':_0x4003ce[_0xaac5('0x1e')]?_0x4003ce[_0xaac5('0x1e')][_0xaac5('0x20')]||null:null,'include':_0x4003ce[_0xaac5('0x1e')]?_0x4003ce[_0xaac5('0x1e')][_0xaac5('0x22')]?_[_0xaac5('0x23')](_0x4003ce[_0xaac5('0x1e')][_0xaac5('0x22')],function(_0x9cbd65){return{'model':db[_0x9cbd65[_0xaac5('0x24')]],'as':_0x9cbd65['as'],'attributes':_0x9cbd65['attributes'],'include':_0x9cbd65[_0xaac5('0x22')]?_[_0xaac5('0x23')](_0x9cbd65[_0xaac5('0x22')],function(_0x85115d){return{'model':db[_0x85115d[_0xaac5('0x24')]],'as':_0x85115d['as'],'attributes':_0x85115d['attributes'],'include':_0x85115d['include']?_[_0xaac5('0x23')](_0x85115d['include'],function(_0x124f8b){return{'model':db[_0x124f8b['model']],'as':_0x124f8b['as'],'attributes':_0x124f8b[_0xaac5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaac5('0xf')](function(_0x186cc0){logger[_0xaac5('0x10')](_0xaac5('0x25'),_0x4003ce);logger[_0xaac5('0x13')](_0xaac5('0x25'),_0x4003ce,JSON[_0xaac5('0x15')](_0x186cc0));_0x2cc73d(_0x186cc0);})[_0xaac5('0x1a')](function(_0x5abe7c){logger[_0xaac5('0x16')](_0xaac5('0x25'),_0x5abe7c[_0xaac5('0x18')],_0x4003ce);_0x1a6445(_0x4bd6ff[_0xaac5('0x16')](0x1f4,_0x5abe7c[_0xaac5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index df2385e..5961a75 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 _0xbe1a=['length','openchannelQueue:','./openchannelQueue.events','save','remove','register'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0xbe1a,0x11c));var _0xabe1=function(_0x53c253,_0x3baf5d){_0x53c253=_0x53c253-0x0;var _0x1a6b27=_0xbe1a[_0x53c253];return _0x1a6b27;};'use strict';var OpenchannelQueueEvents=require(_0xabe1('0x0'));var events=[_0xabe1('0x1'),_0xabe1('0x2'),'update'];function createListener(_0x34c893,_0x256464){return function(_0x296e3b){_0x256464['emit'](_0x34c893,_0x296e3b);};}function removeListener(_0x2ac4ad,_0x144ce8){return function(){OpenchannelQueueEvents['removeListener'](_0x2ac4ad,_0x144ce8);};}exports[_0xabe1('0x3')]=function(_0x4e802c){for(var _0x489def=0x0,_0x28e0fb=events[_0xabe1('0x4')];_0x489def<_0x28e0fb;_0x489def++){var _0x2de453=events[_0x489def];var _0x18fe9c=createListener(_0xabe1('0x5')+_0x2de453,_0x4e802c);OpenchannelQueueEvents['on'](_0x2de453,_0x18fe9c);}}; \ No newline at end of file +var _0x7c13=['./openchannelQueue.events','save','remove','update','emit','removeListener','length','openchannelQueue:'];(function(_0x31a912,_0x287cb7){var _0x53c32b=function(_0x2187c4){while(--_0x2187c4){_0x31a912['push'](_0x31a912['shift']());}};_0x53c32b(++_0x287cb7);}(_0x7c13,0x120));var _0x37c1=function(_0x3c1312,_0x45bfdb){_0x3c1312=_0x3c1312-0x0;var _0x5b4831=_0x7c13[_0x3c1312];return _0x5b4831;};'use strict';var OpenchannelQueueEvents=require(_0x37c1('0x0'));var events=[_0x37c1('0x1'),_0x37c1('0x2'),_0x37c1('0x3')];function createListener(_0x21d9a4,_0x3cd673){return function(_0x5ee768){_0x3cd673[_0x37c1('0x4')](_0x21d9a4,_0x5ee768);};}function removeListener(_0x4a38eb,_0x3c789e){return function(){OpenchannelQueueEvents[_0x37c1('0x5')](_0x4a38eb,_0x3c789e);};}exports['register']=function(_0x39ee01){for(var _0x77dc48=0x0,_0x42284b=events[_0x37c1('0x6')];_0x77dc48<_0x42284b;_0x77dc48++){var _0x227b89=events[_0x77dc48];var _0xdfa6d0=createListener(_0x37c1('0x7')+_0x227b89,_0x39ee01);OpenchannelQueueEvents['on'](_0x227b89,_0xdfa6d0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f4e5961..d7b8aa0 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 _0xa6e0=['create','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','post'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xa6e0,0x1d3));var _0x0a6e=function(_0x1edcc1,_0x296c39){_0x1edcc1=_0x1edcc1-0x0;var _0x526f58=_0xa6e0[_0x1edcc1];return _0x526f58;};'use strict';var multer=require(_0x0a6e('0x0'));var util=require(_0x0a6e('0x1'));var path=require(_0x0a6e('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a6e('0x3'));var router=express[_0x0a6e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0a6e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0a6e('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0x0a6e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a6e('0x8')]);router['get'](_0x0a6e('0x9'),auth[_0x0a6e('0xa')](),controller[_0x0a6e('0xb')]);router[_0x0a6e('0x7')]('/:id',auth[_0x0a6e('0xa')](),controller['show']);router[_0x0a6e('0xc')]('/',auth[_0x0a6e('0xa')](),controller[_0x0a6e('0xd')]);router[_0x0a6e('0xe')]('/:id',auth[_0x0a6e('0xa')](),controller[_0x0a6e('0xf')]);router[_0x0a6e('0x10')](_0x0a6e('0x11'),auth[_0x0a6e('0xa')](),controller[_0x0a6e('0x12')]);module[_0x0a6e('0x13')]=router; \ No newline at end of file +var _0xd3da=['isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','index','/describe','describe','/:id'];(function(_0x1d0e5e,_0x596f00){var _0x3ba445=function(_0x2c153f){while(--_0x2c153f){_0x1d0e5e['push'](_0x1d0e5e['shift']());}};_0x3ba445(++_0x596f00);}(_0xd3da,0x194));var _0xad3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3da[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xad3d('0x0'));var util=require('util');var path=require(_0xad3d('0x1'));var timeout=require(_0xad3d('0x2'));var express=require(_0xad3d('0x3'));var router=express[_0xad3d('0x4')]();var fs_extra=require(_0xad3d('0x5'));var auth=require(_0xad3d('0x6'));var interaction=require(_0xad3d('0x7'));var config=require('../../config/environment');var controller=require(_0xad3d('0x8'));router[_0xad3d('0x9')]('/',auth['isAuthenticated'](),controller[_0xad3d('0xa')]);router[_0xad3d('0x9')](_0xad3d('0xb'),auth['isAuthenticated'](),controller[_0xad3d('0xc')]);router['get'](_0xad3d('0xd'),auth[_0xad3d('0xe')](),controller[_0xad3d('0xf')]);router[_0xad3d('0x10')]('/',auth[_0xad3d('0xe')](),controller[_0xad3d('0x11')]);router['put'](_0xad3d('0xd'),auth[_0xad3d('0xe')](),controller[_0xad3d('0x12')]);router[_0xad3d('0x13')](_0xad3d('0xd'),auth[_0xad3d('0xe')](),controller[_0xad3d('0x14')]);module[_0xad3d('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 9b6bbfa..0df171c 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 _0x24d3=['STRING','DATE','moment','sequelize','exports'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0x24d3,0x1b5));var _0x324d=function(_0x168466,_0x5f37e5){_0x168466=_0x168466-0x0;var _0xcf8a4=_0x24d3[_0x168466];return _0xcf8a4;};'use strict';var moment=require(_0x324d('0x0'));var Sequelize=require(_0x324d('0x1'));module[_0x324d('0x2')]={'uniqueid':{'type':Sequelize[_0x324d('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x324d('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x324d('0x4')]},'reason':{'type':Sequelize[_0x324d('0x3')]}}; \ No newline at end of file +var _0x14bb=['exports','STRING','DATE','sequelize'];(function(_0x3a25cd,_0x387b08){var _0x56e9ce=function(_0x86bb5f){while(--_0x86bb5f){_0x3a25cd['push'](_0x3a25cd['shift']());}};_0x56e9ce(++_0x387b08);}(_0x14bb,0x15f));var _0xb14b=function(_0x4b300d,_0x5b8856){_0x4b300d=_0x4b300d-0x0;var _0x4e5aa5=_0x14bb[_0x4b300d];return _0x4e5aa5;};'use strict';var moment=require('moment');var Sequelize=require(_0xb14b('0x0'));module[_0xb14b('0x1')]={'uniqueid':{'type':Sequelize[_0xb14b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb14b('0x2')]},'joinAt':{'type':Sequelize[_0xb14b('0x3')]},'leaveAt':{'type':Sequelize[_0xb14b('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb14b('0x3')]},'reason':{'type':Sequelize[_0xb14b('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 624391e..31787b1 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 _0x8f9e=['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','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelQueueReport','then','includeAll','include','catch','show','params','rawAttributes','create','update','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8f9e,0x93));var _0xe8f9=function(_0x46b164,_0x20e395){_0x46b164=_0x46b164-0x0;var _0x2f0c6a=_0x8f9e[_0x46b164];return _0x2f0c6a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe8f9('0x0'));var zipdir=require(_0xe8f9('0x1'));var jsonpatch=require(_0xe8f9('0x2'));var rp=require('request-promise');var moment=require(_0xe8f9('0x3'));var BPromise=require(_0xe8f9('0x4'));var Mustache=require(_0xe8f9('0x5'));var util=require(_0xe8f9('0x6'));var path=require(_0xe8f9('0x7'));var sox=require('sox');var csv=require(_0xe8f9('0x8'));var ejs=require(_0xe8f9('0x9'));var fs=require('fs');var fs_extra=require(_0xe8f9('0xa'));var _=require(_0xe8f9('0xb'));var squel=require(_0xe8f9('0xc'));var crypto=require(_0xe8f9('0xd'));var jsforce=require(_0xe8f9('0xe'));var deskjs=require(_0xe8f9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe8f9('0x10'));var Papa=require(_0xe8f9('0x11'));var Redis=require(_0xe8f9('0x12'));var authService=require(_0xe8f9('0x13'));var qs=require(_0xe8f9('0x14'));var as=require(_0xe8f9('0x15'));var hardwareService=require(_0xe8f9('0x16'));var logger=require(_0xe8f9('0x17'))(_0xe8f9('0x18'));var utils=require(_0xe8f9('0x19'));var config=require(_0xe8f9('0x1a'));var licenseUtil=require(_0xe8f9('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e17a0,_0xb191bb){_0xb191bb=_0xb191bb||0xcc;return function(_0x49c862){if(_0x49c862){return _0x1e17a0[_0xe8f9('0x1c')](_0xb191bb);}return _0x1e17a0[_0xe8f9('0x1d')](_0xb191bb)[_0xe8f9('0x1e')]();};}function respondWithResult(_0x26e447,_0x558f5f){_0x558f5f=_0x558f5f||0xc8;return function(_0x56a633){if(_0x56a633){return _0x26e447[_0xe8f9('0x1d')](_0x558f5f)[_0xe8f9('0x1f')](_0x56a633);}};}function respondWithFilteredResult(_0x2c0f31,_0x3d8f8e){return function(_0x34483a){if(_0x34483a){var _0x21afe2=typeof _0x3d8f8e[_0xe8f9('0x20')]==='undefined'&&typeof _0x3d8f8e['limit']===_0xe8f9('0x21');var _0x12c708=_0x34483a[_0xe8f9('0x22')];var _0x272a22=_0x21afe2?0x0:_0x3d8f8e[_0xe8f9('0x20')];var _0x5695de=_0x21afe2?_0x34483a[_0xe8f9('0x22')]:_0x3d8f8e[_0xe8f9('0x20')]+_0x3d8f8e['limit'];var _0x5c9cd9;if(_0x5695de>=_0x12c708){_0x5695de=_0x12c708;_0x5c9cd9=0xc8;}else{_0x5c9cd9=0xce;}_0x2c0f31[_0xe8f9('0x1d')](_0x5c9cd9);return _0x2c0f31[_0xe8f9('0x23')]('Content-Range',_0x272a22+'-'+_0x5695de+'/'+_0x12c708)[_0xe8f9('0x1f')](_0x34483a);}return null;};}function patchUpdates(_0x24bea6){return function(_0x755fbd){try{jsonpatch[_0xe8f9('0x24')](_0x755fbd,_0x24bea6,!![]);}catch(_0xe1d9ee){return BPromise[_0xe8f9('0x25')](_0xe1d9ee);}return _0x755fbd[_0xe8f9('0x26')]();};}function saveUpdates(_0x4a1b4d,_0x6c913c){return function(_0xb907c4){if(_0xb907c4){return _0xb907c4['update'](_0x4a1b4d)['then'](function(_0xd88c6f){return _0xd88c6f;});}return null;};}function removeEntity(_0x36c476,_0x5edd9e){return function(_0x240215){if(_0x240215){return _0x240215[_0xe8f9('0x27')]()['then'](function(){_0x36c476['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bb5f5,_0x149335){return function(_0x48afae){if(!_0x48afae){_0x4bb5f5['sendStatus'](0x194);}return _0x48afae;};}function handleError(_0xd9cac,_0x39ae3b){_0x39ae3b=_0x39ae3b||0x1f4;return function(_0x23232f){logger[_0xe8f9('0x28')](_0x23232f[_0xe8f9('0x29')]);if(_0x23232f[_0xe8f9('0x2a')]){delete _0x23232f[_0xe8f9('0x2a')];}_0xd9cac[_0xe8f9('0x1d')](_0x39ae3b)[_0xe8f9('0x2b')](_0x23232f);};}exports[_0xe8f9('0x2c')]=function(_0x2f89ab,_0x3b7e08){var _0x395e94={},_0xb074e5={},_0x1aa066={'count':0x0,'rows':[]};var _0x4b9579=_[_0xe8f9('0x2d')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x2e9e4d){return{'name':_0x2e9e4d[_0xe8f9('0x2e')],'type':_0x2e9e4d[_0xe8f9('0x2f')][_0xe8f9('0x30')]};});_0xb074e5[_0xe8f9('0x31')]=_['map'](_0x4b9579,_0xe8f9('0x2a'));_0xb074e5['query']=_[_0xe8f9('0x32')](_0x2f89ab[_0xe8f9('0x33')]);_0xb074e5[_0xe8f9('0x34')]=_['intersection'](_0xb074e5[_0xe8f9('0x31')],_0xb074e5[_0xe8f9('0x33')]);_0x395e94[_0xe8f9('0x35')]=_[_0xe8f9('0x36')](_0xb074e5['model'],qs[_0xe8f9('0x37')](_0x2f89ab[_0xe8f9('0x33')]['fields']));_0x395e94[_0xe8f9('0x35')]=_0x395e94['attributes'][_0xe8f9('0x38')]?_0x395e94['attributes']:_0xb074e5[_0xe8f9('0x31')];if(!_0x2f89ab[_0xe8f9('0x33')][_0xe8f9('0x39')](_0xe8f9('0x3a'))){_0x395e94[_0xe8f9('0x3b')]=qs[_0xe8f9('0x3b')](_0x2f89ab[_0xe8f9('0x33')][_0xe8f9('0x3b')]);_0x395e94[_0xe8f9('0x20')]=qs[_0xe8f9('0x20')](_0x2f89ab['query']['offset']);}_0x395e94['order']=qs['sort'](_0x2f89ab[_0xe8f9('0x33')][_0xe8f9('0x3c')]);_0x395e94['where']=qs['filters'](_[_0xe8f9('0x3d')](_0x2f89ab[_0xe8f9('0x33')],_0xb074e5[_0xe8f9('0x34')]),_0x4b9579);if(_0x2f89ab['query'][_0xe8f9('0x3e')]){_0x395e94[_0xe8f9('0x3f')]=_[_0xe8f9('0x40')](_0x395e94[_0xe8f9('0x3f')],{'$or':_['map'](_0x4b9579,function(_0x24d728){if(_0x24d728[_0xe8f9('0x2f')]!==_0xe8f9('0x41')){var _0x6422e2={};_0x6422e2[_0x24d728['name']]={'$like':'%'+_0x2f89ab[_0xe8f9('0x33')][_0xe8f9('0x3e')]+'%'};return _0x6422e2;}})});}_0x395e94=_['merge']({},_0x395e94,_0x2f89ab[_0xe8f9('0x42')]);var _0x58a452={'where':_0x395e94[_0xe8f9('0x3f')]};return db[_0xe8f9('0x43')][_0xe8f9('0x22')](_0x58a452)[_0xe8f9('0x44')](function(_0x3d8679){_0x1aa066[_0xe8f9('0x22')]=_0x3d8679;if(_0x2f89ab[_0xe8f9('0x33')][_0xe8f9('0x45')]){_0x395e94[_0xe8f9('0x46')]=[{'all':!![]}];}return db[_0xe8f9('0x43')]['findAll'](_0x395e94);})[_0xe8f9('0x44')](function(_0x26bd7f){_0x1aa066['rows']=_0x26bd7f;return _0x1aa066;})[_0xe8f9('0x44')](respondWithFilteredResult(_0x3b7e08,_0x395e94))[_0xe8f9('0x47')](handleError(_0x3b7e08,null));};exports[_0xe8f9('0x48')]=function(_0x5d8395,_0x282c55){var _0x28abd6={'raw':!![],'where':{'id':_0x5d8395[_0xe8f9('0x49')]['id']}},_0x10c929={};_0x10c929['model']=_[_0xe8f9('0x32')](db[_0xe8f9('0x43')][_0xe8f9('0x4a')]);_0x10c929[_0xe8f9('0x33')]=_['keys'](_0x5d8395[_0xe8f9('0x33')]);_0x10c929['filters']=_[_0xe8f9('0x36')](_0x10c929[_0xe8f9('0x31')],_0x10c929[_0xe8f9('0x33')]);_0x28abd6['attributes']=_['intersection'](_0x10c929[_0xe8f9('0x31')],qs[_0xe8f9('0x37')](_0x5d8395[_0xe8f9('0x33')][_0xe8f9('0x37')]));_0x28abd6[_0xe8f9('0x35')]=_0x28abd6[_0xe8f9('0x35')]['length']?_0x28abd6[_0xe8f9('0x35')]:_0x10c929[_0xe8f9('0x31')];if(_0x5d8395['query'][_0xe8f9('0x45')]){_0x28abd6['include']=[{'all':!![]}];}_0x28abd6=_[_0xe8f9('0x40')]({},_0x28abd6,_0x5d8395[_0xe8f9('0x42')]);return db['OpenchannelQueueReport']['find'](_0x28abd6)[_0xe8f9('0x44')](handleEntityNotFound(_0x282c55,null))['then'](respondWithResult(_0x282c55,null))[_0xe8f9('0x47')](handleError(_0x282c55,null));};exports['create']=function(_0x54a385,_0x2ca268){return db[_0xe8f9('0x43')][_0xe8f9('0x4b')](_0x54a385['body'],{})[_0xe8f9('0x44')](respondWithResult(_0x2ca268,0xc9))[_0xe8f9('0x47')](handleError(_0x2ca268,null));};exports[_0xe8f9('0x4c')]=function(_0x833293,_0x167ba7){if(_0x833293['body']['id']){delete _0x833293['body']['id'];}return db[_0xe8f9('0x43')]['find']({'where':{'id':_0x833293[_0xe8f9('0x49')]['id']}})[_0xe8f9('0x44')](handleEntityNotFound(_0x167ba7,null))['then'](saveUpdates(_0x833293[_0xe8f9('0x4d')],null))[_0xe8f9('0x44')](respondWithResult(_0x167ba7,null))[_0xe8f9('0x47')](handleError(_0x167ba7,null));};exports['destroy']=function(_0x5d1605,_0x787765){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x5d1605[_0xe8f9('0x49')]['id']}})['then'](handleEntityNotFound(_0x787765,null))['then'](removeEntity(_0x787765,null))[_0xe8f9('0x47')](handleError(_0x787765,null));};exports[_0xe8f9('0x4e')]=function(_0x14a0c9,_0x389c90){return db[_0xe8f9('0x43')][_0xe8f9('0x4e')]()[_0xe8f9('0x44')](respondWithResult(_0x389c90,null))[_0xe8f9('0x47')](handleError(_0x389c90,null));}; \ No newline at end of file +var _0x022e=['status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','name','map','OpenchannelQueueReport','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','params','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x022e,0xbd));var _0xe022=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x022e[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0xe022('0x0'));var rimraf=require(_0xe022('0x1'));var zipdir=require(_0xe022('0x2'));var jsonpatch=require(_0xe022('0x3'));var rp=require(_0xe022('0x4'));var moment=require(_0xe022('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe022('0x6'));var util=require(_0xe022('0x7'));var path=require('path');var sox=require(_0xe022('0x8'));var csv=require(_0xe022('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe022('0xa'));var squel=require('squel');var crypto=require(_0xe022('0xb'));var jsforce=require(_0xe022('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe022('0x9'));var querystring=require('querystring');var Papa=require(_0xe022('0xd'));var Redis=require(_0xe022('0xe'));var authService=require(_0xe022('0xf'));var qs=require(_0xe022('0x10'));var as=require(_0xe022('0x11'));var hardwareService=require(_0xe022('0x12'));var logger=require(_0xe022('0x13'))(_0xe022('0x14'));var utils=require(_0xe022('0x15'));var config=require(_0xe022('0x16'));var licenseUtil=require(_0xe022('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31c93e,_0x252afc){_0x252afc=_0x252afc||0xcc;return function(_0x5a5161){if(_0x5a5161){return _0x31c93e['sendStatus'](_0x252afc);}return _0x31c93e[_0xe022('0x18')](_0x252afc)[_0xe022('0x19')]();};}function respondWithResult(_0x305ec3,_0x14b9be){_0x14b9be=_0x14b9be||0xc8;return function(_0x2ea283){if(_0x2ea283){return _0x305ec3[_0xe022('0x18')](_0x14b9be)[_0xe022('0x1a')](_0x2ea283);}};}function respondWithFilteredResult(_0x2dac88,_0x54a8cb){return function(_0x3d78a4){if(_0x3d78a4){var _0x470196=typeof _0x54a8cb[_0xe022('0x1b')]===_0xe022('0x1c')&&typeof _0x54a8cb[_0xe022('0x1d')]===_0xe022('0x1c');var _0xfa72eb=_0x3d78a4[_0xe022('0x1e')];var _0x44d403=_0x470196?0x0:_0x54a8cb['offset'];var _0x2e19b=_0x470196?_0x3d78a4[_0xe022('0x1e')]:_0x54a8cb[_0xe022('0x1b')]+_0x54a8cb[_0xe022('0x1d')];var _0x46d506;if(_0x2e19b>=_0xfa72eb){_0x2e19b=_0xfa72eb;_0x46d506=0xc8;}else{_0x46d506=0xce;}_0x2dac88['status'](_0x46d506);return _0x2dac88[_0xe022('0x1f')]('Content-Range',_0x44d403+'-'+_0x2e19b+'/'+_0xfa72eb)[_0xe022('0x1a')](_0x3d78a4);}return null;};}function patchUpdates(_0x707a6b){return function(_0x4cf210){try{jsonpatch[_0xe022('0x20')](_0x4cf210,_0x707a6b,!![]);}catch(_0x34222c){return BPromise['reject'](_0x34222c);}return _0x4cf210[_0xe022('0x21')]();};}function saveUpdates(_0x2b68a2,_0x1dc8ed){return function(_0x2a6001){if(_0x2a6001){return _0x2a6001[_0xe022('0x22')](_0x2b68a2)[_0xe022('0x23')](function(_0x38611b){return _0x38611b;});}return null;};}function removeEntity(_0x2f65a5,_0x21ffab){return function(_0x2a0e47){if(_0x2a0e47){return _0x2a0e47[_0xe022('0x24')]()[_0xe022('0x23')](function(){_0x2f65a5[_0xe022('0x18')](0xcc)[_0xe022('0x19')]();});}};}function handleEntityNotFound(_0xeea5b0,_0x32cbd4){return function(_0x2dfdf4){if(!_0x2dfdf4){_0xeea5b0[_0xe022('0x25')](0x194);}return _0x2dfdf4;};}function handleError(_0x292c32,_0x14b001){_0x14b001=_0x14b001||0x1f4;return function(_0x4f3009){logger['error'](_0x4f3009['stack']);if(_0x4f3009[_0xe022('0x26')]){delete _0x4f3009['name'];}_0x292c32[_0xe022('0x18')](_0x14b001)['send'](_0x4f3009);};}exports['index']=function(_0x5dcfdd,_0x206b8f){var _0x458b12={},_0x3a14bc={},_0x6679d3={'count':0x0,'rows':[]};var _0x535c3e=_[_0xe022('0x27')](db[_0xe022('0x28')][_0xe022('0x29')],function(_0xb8c2db){return{'name':_0xb8c2db[_0xe022('0x2a')],'type':_0xb8c2db['type']['key']};});_0x3a14bc[_0xe022('0x2b')]=_[_0xe022('0x27')](_0x535c3e,_0xe022('0x26'));_0x3a14bc['query']=_[_0xe022('0x2c')](_0x5dcfdd[_0xe022('0x2d')]);_0x3a14bc[_0xe022('0x2e')]=_[_0xe022('0x2f')](_0x3a14bc[_0xe022('0x2b')],_0x3a14bc[_0xe022('0x2d')]);_0x458b12[_0xe022('0x30')]=_[_0xe022('0x2f')](_0x3a14bc[_0xe022('0x2b')],qs[_0xe022('0x31')](_0x5dcfdd[_0xe022('0x2d')]['fields']));_0x458b12[_0xe022('0x30')]=_0x458b12['attributes'][_0xe022('0x32')]?_0x458b12[_0xe022('0x30')]:_0x3a14bc[_0xe022('0x2b')];if(!_0x5dcfdd[_0xe022('0x2d')]['hasOwnProperty'](_0xe022('0x33'))){_0x458b12[_0xe022('0x1d')]=qs[_0xe022('0x1d')](_0x5dcfdd['query']['limit']);_0x458b12[_0xe022('0x1b')]=qs[_0xe022('0x1b')](_0x5dcfdd[_0xe022('0x2d')]['offset']);}_0x458b12[_0xe022('0x34')]=qs[_0xe022('0x35')](_0x5dcfdd[_0xe022('0x2d')][_0xe022('0x35')]);_0x458b12[_0xe022('0x36')]=qs[_0xe022('0x2e')](_[_0xe022('0x37')](_0x5dcfdd[_0xe022('0x2d')],_0x3a14bc['filters']),_0x535c3e);if(_0x5dcfdd['query'][_0xe022('0x38')]){_0x458b12[_0xe022('0x36')]=_[_0xe022('0x39')](_0x458b12['where'],{'$or':_[_0xe022('0x27')](_0x535c3e,function(_0x24adea){if(_0x24adea[_0xe022('0x3a')]!==_0xe022('0x3b')){var _0x2b00e3={};_0x2b00e3[_0x24adea[_0xe022('0x26')]]={'$like':'%'+_0x5dcfdd[_0xe022('0x2d')][_0xe022('0x38')]+'%'};return _0x2b00e3;}})});}_0x458b12=_[_0xe022('0x39')]({},_0x458b12,_0x5dcfdd[_0xe022('0x3c')]);var _0x5e3a6f={'where':_0x458b12[_0xe022('0x36')]};return db['OpenchannelQueueReport'][_0xe022('0x1e')](_0x5e3a6f)[_0xe022('0x23')](function(_0x4d1db1){_0x6679d3[_0xe022('0x1e')]=_0x4d1db1;if(_0x5dcfdd[_0xe022('0x2d')][_0xe022('0x3d')]){_0x458b12[_0xe022('0x3e')]=[{'all':!![]}];}return db[_0xe022('0x28')][_0xe022('0x3f')](_0x458b12);})[_0xe022('0x23')](function(_0x86f6e2){_0x6679d3[_0xe022('0x40')]=_0x86f6e2;return _0x6679d3;})['then'](respondWithFilteredResult(_0x206b8f,_0x458b12))['catch'](handleError(_0x206b8f,null));};exports['show']=function(_0xe43e3f,_0x468468){var _0x1b21de={'raw':!![],'where':{'id':_0xe43e3f['params']['id']}},_0x432fd8={};_0x432fd8['model']=_[_0xe022('0x2c')](db[_0xe022('0x28')][_0xe022('0x29')]);_0x432fd8['query']=_[_0xe022('0x2c')](_0xe43e3f['query']);_0x432fd8[_0xe022('0x2e')]=_[_0xe022('0x2f')](_0x432fd8[_0xe022('0x2b')],_0x432fd8['query']);_0x1b21de['attributes']=_[_0xe022('0x2f')](_0x432fd8['model'],qs[_0xe022('0x31')](_0xe43e3f[_0xe022('0x2d')][_0xe022('0x31')]));_0x1b21de[_0xe022('0x30')]=_0x1b21de[_0xe022('0x30')][_0xe022('0x32')]?_0x1b21de[_0xe022('0x30')]:_0x432fd8[_0xe022('0x2b')];if(_0xe43e3f[_0xe022('0x2d')][_0xe022('0x3d')]){_0x1b21de[_0xe022('0x3e')]=[{'all':!![]}];}_0x1b21de=_['merge']({},_0x1b21de,_0xe43e3f[_0xe022('0x3c')]);return db[_0xe022('0x28')]['find'](_0x1b21de)[_0xe022('0x23')](handleEntityNotFound(_0x468468,null))[_0xe022('0x23')](respondWithResult(_0x468468,null))[_0xe022('0x41')](handleError(_0x468468,null));};exports[_0xe022('0x42')]=function(_0x397a80,_0x508530){return db[_0xe022('0x28')][_0xe022('0x42')](_0x397a80['body'],{})[_0xe022('0x23')](respondWithResult(_0x508530,0xc9))[_0xe022('0x41')](handleError(_0x508530,null));};exports[_0xe022('0x22')]=function(_0x1a2473,_0x52578e){if(_0x1a2473[_0xe022('0x43')]['id']){delete _0x1a2473['body']['id'];}return db[_0xe022('0x28')]['find']({'where':{'id':_0x1a2473[_0xe022('0x44')]['id']}})[_0xe022('0x23')](handleEntityNotFound(_0x52578e,null))[_0xe022('0x23')](saveUpdates(_0x1a2473[_0xe022('0x43')],null))['then'](respondWithResult(_0x52578e,null))['catch'](handleError(_0x52578e,null));};exports[_0xe022('0x24')]=function(_0x41540c,_0x230707){return db['OpenchannelQueueReport'][_0xe022('0x45')]({'where':{'id':_0x41540c[_0xe022('0x44')]['id']}})[_0xe022('0x23')](handleEntityNotFound(_0x230707,null))[_0xe022('0x23')](removeEntity(_0x230707,null))['catch'](handleError(_0x230707,null));};exports[_0xe022('0x46')]=function(_0x14fd93,_0x11985a){return db['OpenchannelQueueReport'][_0xe022('0x46')]()[_0xe022('0x23')](respondWithResult(_0x11985a,null))[_0xe022('0x41')](handleError(_0x11985a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index dc93910..ad9d284 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x14ddf0,_0x4be6a2){var _0x2ff31c=function(_0x5c9b61){while(--_0x5c9b61){_0x14ddf0['push'](_0x14ddf0['shift']());}};_0x2ff31c(++_0x4be6a2);}(_0x1261,0x144));var _0x1126=function(_0x1f404a,_0x5088b2){_0x1f404a=_0x1f404a-0x0;var _0x2cdcd5=_0x1261[_0x1f404a];return _0x2cdcd5;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x4941a2,_0x51dd7b){var _0x16c677=function(_0x2ec2a1){while(--_0x2ec2a1){_0x4941a2['push'](_0x4941a2['shift']());}};_0x16c677(++_0x51dd7b);}(_0x1261,0x144));var _0x1126=function(_0x33eca6,_0x891651){_0x33eca6=_0x33eca6-0x0;var _0x1ada39=_0x1261[_0x33eca6];return _0x1ada39;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 839c133..a2f116b 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 _0x0b0e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','create','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','raw','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2742b9,_0xff2841){var _0x106e28=function(_0x2c22da){while(--_0x2c22da){_0x2742b9['push'](_0x2742b9['shift']());}};_0x106e28(++_0xff2841);}(_0x0b0e,0x187));var _0xe0b0=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x0b0e[_0x95411e];return _0x2c8718;};'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});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['CreateOpenchannelQueueReport']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['OpenchannelQueueReport'][_0xe0b0('0x18')](_0x54a3eb['body'],{'raw':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe0b0('0xd')](function(_0x5dba2f){logger[_0xe0b0('0xe')](_0xe0b0('0x1a'),_0x54a3eb);logger[_0xe0b0('0x10')](_0xe0b0('0x1a'),_0x54a3eb,JSON[_0xe0b0('0x12')](_0x5dba2f));_0x50a441(_0x5dba2f);})['catch'](function(_0x4cae54){logger[_0xe0b0('0x13')]('CreateOpenchannelQueueReport',_0x4cae54[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44[_0xe0b0('0x13')](0x1f4,_0x4cae54['message']));});});};exports[_0xe0b0('0x1b')]=function(_0x503883){var _0x2208d0=this;return new Promise(function(_0x49a727,_0x28586d){return db['OpenchannelQueueReport'][_0xe0b0('0x1c')](_0x503883['body'],{'raw':_0x503883[_0xe0b0('0x19')]?_0x503883['options'][_0xe0b0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503883['options']?_0x503883[_0xe0b0('0x19')][_0xe0b0('0x1e')]||null:null,'attributes':_0x503883[_0xe0b0('0x19')]?_0x503883[_0xe0b0('0x19')][_0xe0b0('0x1f')]||null:null,'limit':_0x503883[_0xe0b0('0x19')]?_0x503883['options'][_0xe0b0('0x20')]||null:null})[_0xe0b0('0xd')](function(_0x5b7a64){logger[_0xe0b0('0xe')](_0xe0b0('0x1b'),_0x503883);logger[_0xe0b0('0x10')](_0xe0b0('0x1b'),_0x503883,JSON[_0xe0b0('0x12')](_0x5b7a64));_0x49a727(_0x5b7a64);})[_0xe0b0('0x17')](function(_0x136bd4){logger['error'](_0xe0b0('0x1b'),_0x136bd4[_0xe0b0('0x14')],_0x503883);_0x28586d(_0x2208d0['error'](0x1f4,_0x136bd4['message']));});});}; \ No newline at end of file +var _0x28f2=['catch','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelQueueReport','options','raw','CreateOpenchannelQueueReport'];(function(_0x10f1c5,_0x2b6610){var _0x5cdfaa=function(_0x46ddbd){while(--_0x46ddbd){_0x10f1c5['push'](_0x10f1c5['shift']());}};_0x5cdfaa(++_0x2b6610);}(_0x28f2,0x193));var _0x228f=function(_0x45b2a8,_0x2b83c7){_0x45b2a8=_0x45b2a8-0x0;var _0xd3d9f6=_0x28f2[_0x45b2a8];return _0xd3d9f6;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10da58,_0x4a4a44,_0x3ca074){return new BPromise(function(_0x455eb6,_0xf4b011){return client['request'](_0x10da58,_0x3ca074)[_0x228f('0xc')](function(_0x4d0038){logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,'request\x20sent');logger[_0x228f('0xf')](_0x228f('0x10'),_0x4a4a44,_0x228f('0x11'),JSON[_0x228f('0x12')](_0x4d0038));if(_0x4d0038[_0x228f('0x13')]){if(_0x4d0038['error'][_0x228f('0x14')]===0x1f4){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0xf4b011(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}logger[_0x228f('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0x455eb6(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}else{logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,_0x228f('0x11'));_0x455eb6(_0x4d0038['result'][_0x228f('0x15')]);}})['catch'](function(_0x20e687){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x20e687);_0xf4b011(_0x20e687);});});}exports['CreateOpenchannelQueueReport']=function(_0x2d4819){var _0x4e1968=this;return new Promise(function(_0x33e32e,_0x5b33a6){return db[_0x228f('0x16')]['create'](_0x2d4819['body'],{'raw':_0x2d4819[_0x228f('0x17')]?_0x2d4819['options'][_0x228f('0x18')]===undefined?!![]:![]:!![]})[_0x228f('0xc')](function(_0x1294a8){logger[_0x228f('0xd')](_0x228f('0x19'),_0x2d4819);logger[_0x228f('0xf')](_0x228f('0x19'),_0x2d4819,JSON[_0x228f('0x12')](_0x1294a8));_0x33e32e(_0x1294a8);})[_0x228f('0x1a')](function(_0x4ee0c9){logger[_0x228f('0x13')](_0x228f('0x19'),_0x4ee0c9[_0x228f('0x15')],_0x2d4819);_0x5b33a6(_0x4e1968[_0x228f('0x13')](0x1f4,_0x4ee0c9[_0x228f('0x15')]));});});};exports[_0x228f('0x1b')]=function(_0x33e882){var _0x20c111=this;return new Promise(function(_0x2dcf68,_0x56fbc2){return db[_0x228f('0x16')][_0x228f('0x1c')](_0x33e882[_0x228f('0x1d')],{'raw':_0x33e882[_0x228f('0x17')]?_0x33e882[_0x228f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33e882[_0x228f('0x17')]?_0x33e882['options'][_0x228f('0x1e')]||null:null,'attributes':_0x33e882['options']?_0x33e882['options'][_0x228f('0x1f')]||null:null,'limit':_0x33e882[_0x228f('0x17')]?_0x33e882[_0x228f('0x17')][_0x228f('0x20')]||null:null})[_0x228f('0xc')](function(_0x2c964e){logger[_0x228f('0xd')](_0x228f('0x1b'),_0x33e882);logger[_0x228f('0xf')](_0x228f('0x1b'),_0x33e882,JSON[_0x228f('0x12')](_0x2c964e));_0x2dcf68(_0x2c964e);})[_0x228f('0x1a')](function(_0xc25917){logger[_0x228f('0x13')](_0x228f('0x1b'),_0xc25917['message'],_0x33e882);_0x56fbc2(_0x20c111[_0x228f('0x13')](0x1f4,_0xc25917[_0x228f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 1cb6ab0..70e9c19 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 _0xccce=['update','destroy','exports','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x1fac17,_0x2539a8){var _0x57ec5d=function(_0x38ce4e){while(--_0x38ce4e){_0x1fac17['push'](_0x1fac17['shift']());}};_0x57ec5d(++_0x2539a8);}(_0xccce,0x1ce));var _0xeccc=function(_0x353222,_0x2e391e){_0x353222=_0x353222-0x0;var _0x4e304e=_0xccce[_0x353222];return _0x4e304e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeccc('0x0'));var timeout=require(_0xeccc('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xeccc('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xeccc('0x3'));var config=require(_0xeccc('0x4'));var controller=require('./openchannelTransferReport.controller');router[_0xeccc('0x5')]('/',auth[_0xeccc('0x6')](),controller[_0xeccc('0x7')]);router[_0xeccc('0x5')]('/describe',auth[_0xeccc('0x6')](),controller[_0xeccc('0x8')]);router[_0xeccc('0x5')](_0xeccc('0x9'),auth[_0xeccc('0x6')](),controller[_0xeccc('0xa')]);router[_0xeccc('0xb')]('/',auth[_0xeccc('0x6')](),controller[_0xeccc('0xc')]);router[_0xeccc('0xd')](_0xeccc('0x9'),auth[_0xeccc('0x6')](),controller[_0xeccc('0xe')]);router['delete'](_0xeccc('0x9'),auth[_0xeccc('0x6')](),controller[_0xeccc('0xf')]);module[_0xeccc('0x10')]=router; \ No newline at end of file +var _0xfcf9=['connect-timeout','express','Router','../../components/auth/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer'];(function(_0x24cf6e,_0x1da6e7){var _0x1181c5=function(_0x24a21a){while(--_0x24a21a){_0x24cf6e['push'](_0x24cf6e['shift']());}};_0x1181c5(++_0x1da6e7);}(_0xfcf9,0xaa));var _0x9fcf=function(_0x4cfa79,_0x2ce8f8){_0x4cfa79=_0x4cfa79-0x0;var _0x2f33b0=_0xfcf9[_0x4cfa79];return _0x2f33b0;};'use strict';var multer=require(_0x9fcf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9fcf('0x1'));var express=require(_0x9fcf('0x2'));var router=express[_0x9fcf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9fcf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9fcf('0x5'));router[_0x9fcf('0x6')]('/',auth[_0x9fcf('0x7')](),controller[_0x9fcf('0x8')]);router['get'](_0x9fcf('0x9'),auth[_0x9fcf('0x7')](),controller[_0x9fcf('0xa')]);router['get']('/:id',auth[_0x9fcf('0x7')](),controller[_0x9fcf('0xb')]);router[_0x9fcf('0xc')]('/',auth[_0x9fcf('0x7')](),controller['create']);router[_0x9fcf('0xd')](_0x9fcf('0xe'),auth['isAuthenticated'](),controller[_0x9fcf('0xf')]);router[_0x9fcf('0x10')](_0x9fcf('0xe'),auth[_0x9fcf('0x7')](),controller[_0x9fcf('0x11')]);module[_0x9fcf('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index f3b5571..26eeebe 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x57c4ec,_0xfb1ad0){var _0x157f3c=function(_0x283be4){while(--_0x283be4){_0x57c4ec['push'](_0x57c4ec['shift']());}};_0x157f3c(++_0xfb1ad0);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x158876,_0x8600fe){var _0x51c285=function(_0x30b13e){while(--_0x30b13e){_0x158876['push'](_0x158876['shift']());}};_0x51c285(++_0x8600fe);}(_0x34e8,0x12c));var _0x834e=function(_0xa95e3c,_0x80c06b){_0xa95e3c=_0xa95e3c-0x0;var _0x8e7557=_0x34e8[_0xa95e3c];return _0x8e7557;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c7c12f2..671fb60 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 _0xf029=['error','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x198e36,_0x3951b3){var _0x266c31=function(_0x5804ef){while(--_0x5804ef){_0x198e36['push'](_0x198e36['shift']());}};_0x266c31(++_0x3951b3);}(_0xf029,0x6d));var _0x9f02=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf029[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x9f02('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9f02('0x1'));var rp=require('request-promise');var moment=require(_0x9f02('0x2'));var BPromise=require(_0x9f02('0x3'));var Mustache=require(_0x9f02('0x4'));var util=require(_0x9f02('0x5'));var path=require(_0x9f02('0x6'));var sox=require(_0x9f02('0x7'));var csv=require(_0x9f02('0x8'));var ejs=require(_0x9f02('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f02('0xa'));var squel=require(_0x9f02('0xb'));var crypto=require(_0x9f02('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9f02('0xd'));var toCsv=require(_0x9f02('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9f02('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f02('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f02('0x10'))(_0x9f02('0x11'));var utils=require(_0x9f02('0x12'));var config=require(_0x9f02('0x13'));var licenseUtil=require(_0x9f02('0x14'));var db=require(_0x9f02('0x15'))['db'];function respondWithStatusCode(_0x30259f,_0x13b419){_0x13b419=_0x13b419||0xcc;return function(_0x3cfabe){if(_0x3cfabe){return _0x30259f[_0x9f02('0x16')](_0x13b419);}return _0x30259f['status'](_0x13b419)[_0x9f02('0x17')]();};}function respondWithResult(_0x3177a2,_0x1d1e77){_0x1d1e77=_0x1d1e77||0xc8;return function(_0x8ff71){if(_0x8ff71){return _0x3177a2[_0x9f02('0x18')](_0x1d1e77)[_0x9f02('0x19')](_0x8ff71);}};}function respondWithFilteredResult(_0x292501,_0x39ef44){return function(_0x581869){if(_0x581869){var _0x2dfa59=typeof _0x39ef44['offset']===_0x9f02('0x1a')&&typeof _0x39ef44['limit']===_0x9f02('0x1a');var _0x22642f=_0x581869[_0x9f02('0x1b')];var _0x2cf723=_0x2dfa59?0x0:_0x39ef44['offset'];var _0x19010d=_0x2dfa59?_0x581869['count']:_0x39ef44[_0x9f02('0x1c')]+_0x39ef44[_0x9f02('0x1d')];var _0x4219f0;if(_0x19010d>=_0x22642f){_0x19010d=_0x22642f;_0x4219f0=0xc8;}else{_0x4219f0=0xce;}_0x292501[_0x9f02('0x18')](_0x4219f0);return _0x292501['set'](_0x9f02('0x1e'),_0x2cf723+'-'+_0x19010d+'/'+_0x22642f)['json'](_0x581869);}return null;};}function patchUpdates(_0x343fb1){return function(_0x3ac407){try{jsonpatch[_0x9f02('0x1f')](_0x3ac407,_0x343fb1,!![]);}catch(_0x2d4789){return BPromise[_0x9f02('0x20')](_0x2d4789);}return _0x3ac407[_0x9f02('0x21')]();};}function saveUpdates(_0x536095,_0x473d1d){return function(_0x26dcac){if(_0x26dcac){return _0x26dcac[_0x9f02('0x22')](_0x536095)[_0x9f02('0x23')](function(_0x228022){return _0x228022;});}return null;};}function removeEntity(_0x545d82,_0x384aea){return function(_0x58403b){if(_0x58403b){return _0x58403b[_0x9f02('0x24')]()['then'](function(){_0x545d82[_0x9f02('0x18')](0xcc)[_0x9f02('0x17')]();});}};}function handleEntityNotFound(_0x28c53d,_0x448772){return function(_0x24dea4){if(!_0x24dea4){_0x28c53d[_0x9f02('0x16')](0x194);}return _0x24dea4;};}function handleError(_0x414866,_0x32276f){_0x32276f=_0x32276f||0x1f4;return function(_0x5480ee){logger[_0x9f02('0x25')](_0x5480ee['stack']);if(_0x5480ee[_0x9f02('0x26')]){delete _0x5480ee['name'];}_0x414866[_0x9f02('0x18')](_0x32276f)[_0x9f02('0x27')](_0x5480ee);};}exports[_0x9f02('0x28')]=function(_0x81d1e7,_0x470216){var _0x16801a={},_0x39cf8c={},_0x465e5a={'count':0x0,'rows':[]};var _0x25bc2b=_[_0x9f02('0x29')](db[_0x9f02('0x2a')][_0x9f02('0x2b')],function(_0x121ede){return{'name':_0x121ede['fieldName'],'type':_0x121ede[_0x9f02('0x2c')][_0x9f02('0x2d')]};});_0x39cf8c[_0x9f02('0x2e')]=_[_0x9f02('0x29')](_0x25bc2b,_0x9f02('0x26'));_0x39cf8c['query']=_[_0x9f02('0x2f')](_0x81d1e7['query']);_0x39cf8c[_0x9f02('0x30')]=_[_0x9f02('0x31')](_0x39cf8c[_0x9f02('0x2e')],_0x39cf8c[_0x9f02('0x32')]);_0x16801a['attributes']=_[_0x9f02('0x31')](_0x39cf8c[_0x9f02('0x2e')],qs[_0x9f02('0x33')](_0x81d1e7[_0x9f02('0x32')][_0x9f02('0x33')]));_0x16801a[_0x9f02('0x34')]=_0x16801a[_0x9f02('0x34')]['length']?_0x16801a['attributes']:_0x39cf8c[_0x9f02('0x2e')];if(!_0x81d1e7[_0x9f02('0x32')][_0x9f02('0x35')]('nolimit')){_0x16801a[_0x9f02('0x1d')]=qs[_0x9f02('0x1d')](_0x81d1e7[_0x9f02('0x32')]['limit']);_0x16801a['offset']=qs['offset'](_0x81d1e7['query']['offset']);}_0x16801a[_0x9f02('0x36')]=qs['sort'](_0x81d1e7[_0x9f02('0x32')][_0x9f02('0x37')]);_0x16801a['where']=qs[_0x9f02('0x30')](_[_0x9f02('0x38')](_0x81d1e7[_0x9f02('0x32')],_0x39cf8c[_0x9f02('0x30')]),_0x25bc2b);if(_0x81d1e7[_0x9f02('0x32')][_0x9f02('0x39')]){_0x16801a[_0x9f02('0x3a')]=_[_0x9f02('0x3b')](_0x16801a[_0x9f02('0x3a')],{'$or':_[_0x9f02('0x29')](_0x25bc2b,function(_0x2658c8){if(_0x2658c8[_0x9f02('0x2c')]!=='VIRTUAL'){var _0x519055={};_0x519055[_0x2658c8[_0x9f02('0x26')]]={'$like':'%'+_0x81d1e7['query']['filter']+'%'};return _0x519055;}})});}_0x16801a=_[_0x9f02('0x3b')]({},_0x16801a,_0x81d1e7[_0x9f02('0x3c')]);var _0x794954={'where':_0x16801a[_0x9f02('0x3a')]};return db['OpenchannelTransferReport'][_0x9f02('0x1b')](_0x794954)['then'](function(_0x2a6109){_0x465e5a['count']=_0x2a6109;if(_0x81d1e7['query'][_0x9f02('0x3d')]){_0x16801a[_0x9f02('0x3e')]=[{'all':!![]}];}return db[_0x9f02('0x2a')][_0x9f02('0x3f')](_0x16801a);})[_0x9f02('0x23')](function(_0x273816){_0x465e5a[_0x9f02('0x40')]=_0x273816;return _0x465e5a;})[_0x9f02('0x23')](respondWithFilteredResult(_0x470216,_0x16801a))[_0x9f02('0x41')](handleError(_0x470216,null));};exports[_0x9f02('0x42')]=function(_0x835e57,_0x562fae){var _0x5210e4={'raw':!![],'where':{'id':_0x835e57[_0x9f02('0x43')]['id']}},_0x5a4790={};_0x5a4790[_0x9f02('0x2e')]=_[_0x9f02('0x2f')](db[_0x9f02('0x2a')][_0x9f02('0x2b')]);_0x5a4790['query']=_['keys'](_0x835e57[_0x9f02('0x32')]);_0x5a4790['filters']=_['intersection'](_0x5a4790['model'],_0x5a4790[_0x9f02('0x32')]);_0x5210e4[_0x9f02('0x34')]=_[_0x9f02('0x31')](_0x5a4790[_0x9f02('0x2e')],qs['fields'](_0x835e57['query'][_0x9f02('0x33')]));_0x5210e4['attributes']=_0x5210e4['attributes'][_0x9f02('0x44')]?_0x5210e4[_0x9f02('0x34')]:_0x5a4790[_0x9f02('0x2e')];if(_0x835e57[_0x9f02('0x32')][_0x9f02('0x3d')]){_0x5210e4[_0x9f02('0x3e')]=[{'all':!![]}];}_0x5210e4=_[_0x9f02('0x3b')]({},_0x5210e4,_0x835e57['options']);return db[_0x9f02('0x2a')]['find'](_0x5210e4)[_0x9f02('0x23')](handleEntityNotFound(_0x562fae,null))['then'](respondWithResult(_0x562fae,null))['catch'](handleError(_0x562fae,null));};exports[_0x9f02('0x45')]=function(_0x473d20,_0x582549){return db['OpenchannelTransferReport'][_0x9f02('0x45')](_0x473d20['body'],{})[_0x9f02('0x23')](respondWithResult(_0x582549,0xc9))[_0x9f02('0x41')](handleError(_0x582549,null));};exports[_0x9f02('0x22')]=function(_0x6e4ce2,_0x2181e7){if(_0x6e4ce2[_0x9f02('0x46')]['id']){delete _0x6e4ce2['body']['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x6e4ce2[_0x9f02('0x43')]['id']}})['then'](handleEntityNotFound(_0x2181e7,null))[_0x9f02('0x23')](saveUpdates(_0x6e4ce2[_0x9f02('0x46')],null))[_0x9f02('0x23')](respondWithResult(_0x2181e7,null))[_0x9f02('0x41')](handleError(_0x2181e7,null));};exports[_0x9f02('0x24')]=function(_0x557e13,_0x3e357d){return db['OpenchannelTransferReport'][_0x9f02('0x47')]({'where':{'id':_0x557e13[_0x9f02('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e357d,null))[_0x9f02('0x23')](removeEntity(_0x3e357d,null))['catch'](handleError(_0x3e357d,null));};exports['describe']=function(_0x1b1f3c,_0xa01425){return db[_0x9f02('0x2a')][_0x9f02('0x48')]()[_0x9f02('0x23')](respondWithResult(_0xa01425,null))['catch'](handleError(_0xa01425,null));}; \ No newline at end of file +var _0xc210=['keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x1f75f6,_0x3654e1){var _0x5c06c1=function(_0x21b3ba){while(--_0x21b3ba){_0x1f75f6['push'](_0x1f75f6['shift']());}};_0x5c06c1(++_0x3654e1);}(_0xc210,0xfe));var _0x0c21=function(_0x582e57,_0x85fded){_0x582e57=_0x582e57-0x0;var _0xfef0e6=_0xc210[_0x582e57];return _0xfef0e6;};'use strict';var emlformat=require(_0x0c21('0x0'));var rimraf=require(_0x0c21('0x1'));var zipdir=require(_0x0c21('0x2'));var jsonpatch=require(_0x0c21('0x3'));var rp=require(_0x0c21('0x4'));var moment=require(_0x0c21('0x5'));var BPromise=require(_0x0c21('0x6'));var Mustache=require(_0x0c21('0x7'));var util=require(_0x0c21('0x8'));var path=require(_0x0c21('0x9'));var sox=require(_0x0c21('0xa'));var csv=require(_0x0c21('0xb'));var ejs=require(_0x0c21('0xc'));var fs=require('fs');var fs_extra=require(_0x0c21('0xd'));var _=require('lodash');var squel=require(_0x0c21('0xe'));var crypto=require(_0x0c21('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0c21('0x10'));var toCsv=require(_0x0c21('0xb'));var querystring=require(_0x0c21('0x11'));var Papa=require(_0x0c21('0x12'));var Redis=require('ioredis');var authService=require(_0x0c21('0x13'));var qs=require(_0x0c21('0x14'));var as=require(_0x0c21('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c21('0x16'))(_0x0c21('0x17'));var utils=require('../../config/utils');var config=require(_0x0c21('0x18'));var licenseUtil=require(_0x0c21('0x19'));var db=require(_0x0c21('0x1a'))['db'];function respondWithStatusCode(_0x408498,_0x1d6ee6){_0x1d6ee6=_0x1d6ee6||0xcc;return function(_0x34ba6e){if(_0x34ba6e){return _0x408498['sendStatus'](_0x1d6ee6);}return _0x408498[_0x0c21('0x1b')](_0x1d6ee6)['end']();};}function respondWithResult(_0x84eb2e,_0x6b4688){_0x6b4688=_0x6b4688||0xc8;return function(_0x4b6efe){if(_0x4b6efe){return _0x84eb2e[_0x0c21('0x1b')](_0x6b4688)[_0x0c21('0x1c')](_0x4b6efe);}};}function respondWithFilteredResult(_0x3ac4be,_0x7633da){return function(_0x518ca3){if(_0x518ca3){var _0x2d13f2=typeof _0x7633da[_0x0c21('0x1d')]===_0x0c21('0x1e')&&typeof _0x7633da[_0x0c21('0x1f')]==='undefined';var _0x596008=_0x518ca3[_0x0c21('0x20')];var _0x17d950=_0x2d13f2?0x0:_0x7633da['offset'];var _0x9130f7=_0x2d13f2?_0x518ca3['count']:_0x7633da['offset']+_0x7633da['limit'];var _0x2593b9;if(_0x9130f7>=_0x596008){_0x9130f7=_0x596008;_0x2593b9=0xc8;}else{_0x2593b9=0xce;}_0x3ac4be['status'](_0x2593b9);return _0x3ac4be[_0x0c21('0x21')]('Content-Range',_0x17d950+'-'+_0x9130f7+'/'+_0x596008)[_0x0c21('0x1c')](_0x518ca3);}return null;};}function patchUpdates(_0x426278){return function(_0x40d29a){try{jsonpatch[_0x0c21('0x22')](_0x40d29a,_0x426278,!![]);}catch(_0x215c55){return BPromise[_0x0c21('0x23')](_0x215c55);}return _0x40d29a['save']();};}function saveUpdates(_0x19d2f5,_0x51a381){return function(_0x441296){if(_0x441296){return _0x441296[_0x0c21('0x24')](_0x19d2f5)['then'](function(_0x544b82){return _0x544b82;});}return null;};}function removeEntity(_0x557e44,_0x586a10){return function(_0x3ac4db){if(_0x3ac4db){return _0x3ac4db[_0x0c21('0x25')]()[_0x0c21('0x26')](function(){_0x557e44[_0x0c21('0x1b')](0xcc)[_0x0c21('0x27')]();});}};}function handleEntityNotFound(_0x35d5e7,_0x1b95aa){return function(_0x96404){if(!_0x96404){_0x35d5e7[_0x0c21('0x28')](0x194);}return _0x96404;};}function handleError(_0x1c0f1e,_0x582745){_0x582745=_0x582745||0x1f4;return function(_0x2a6d29){logger[_0x0c21('0x29')](_0x2a6d29[_0x0c21('0x2a')]);if(_0x2a6d29['name']){delete _0x2a6d29[_0x0c21('0x2b')];}_0x1c0f1e['status'](_0x582745)[_0x0c21('0x2c')](_0x2a6d29);};}exports[_0x0c21('0x2d')]=function(_0x5a9f05,_0x90b22d){var _0x23edca={},_0x430612={},_0x2a1eaa={'count':0x0,'rows':[]};var _0x4d2fa7=_[_0x0c21('0x2e')](db[_0x0c21('0x2f')][_0x0c21('0x30')],function(_0x2fa625){return{'name':_0x2fa625[_0x0c21('0x31')],'type':_0x2fa625[_0x0c21('0x32')][_0x0c21('0x33')]};});_0x430612[_0x0c21('0x34')]=_[_0x0c21('0x2e')](_0x4d2fa7,_0x0c21('0x2b'));_0x430612[_0x0c21('0x35')]=_[_0x0c21('0x36')](_0x5a9f05[_0x0c21('0x35')]);_0x430612['filters']=_[_0x0c21('0x37')](_0x430612[_0x0c21('0x34')],_0x430612[_0x0c21('0x35')]);_0x23edca[_0x0c21('0x38')]=_['intersection'](_0x430612[_0x0c21('0x34')],qs[_0x0c21('0x39')](_0x5a9f05[_0x0c21('0x35')]['fields']));_0x23edca['attributes']=_0x23edca[_0x0c21('0x38')]['length']?_0x23edca[_0x0c21('0x38')]:_0x430612[_0x0c21('0x34')];if(!_0x5a9f05[_0x0c21('0x35')][_0x0c21('0x3a')](_0x0c21('0x3b'))){_0x23edca['limit']=qs[_0x0c21('0x1f')](_0x5a9f05[_0x0c21('0x35')][_0x0c21('0x1f')]);_0x23edca['offset']=qs['offset'](_0x5a9f05['query']['offset']);}_0x23edca['order']=qs[_0x0c21('0x3c')](_0x5a9f05[_0x0c21('0x35')][_0x0c21('0x3c')]);_0x23edca[_0x0c21('0x3d')]=qs[_0x0c21('0x3e')](_[_0x0c21('0x3f')](_0x5a9f05[_0x0c21('0x35')],_0x430612[_0x0c21('0x3e')]),_0x4d2fa7);if(_0x5a9f05['query'][_0x0c21('0x40')]){_0x23edca[_0x0c21('0x3d')]=_['merge'](_0x23edca['where'],{'$or':_[_0x0c21('0x2e')](_0x4d2fa7,function(_0x2ee356){if(_0x2ee356[_0x0c21('0x32')]!==_0x0c21('0x41')){var _0x40fcf3={};_0x40fcf3[_0x2ee356[_0x0c21('0x2b')]]={'$like':'%'+_0x5a9f05[_0x0c21('0x35')]['filter']+'%'};return _0x40fcf3;}})});}_0x23edca=_[_0x0c21('0x42')]({},_0x23edca,_0x5a9f05[_0x0c21('0x43')]);var _0x2aa170={'where':_0x23edca[_0x0c21('0x3d')]};return db['OpenchannelTransferReport'][_0x0c21('0x20')](_0x2aa170)[_0x0c21('0x26')](function(_0xaa0885){_0x2a1eaa['count']=_0xaa0885;if(_0x5a9f05[_0x0c21('0x35')][_0x0c21('0x44')]){_0x23edca[_0x0c21('0x45')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x23edca);})[_0x0c21('0x26')](function(_0x55a1ef){_0x2a1eaa['rows']=_0x55a1ef;return _0x2a1eaa;})[_0x0c21('0x26')](respondWithFilteredResult(_0x90b22d,_0x23edca))['catch'](handleError(_0x90b22d,null));};exports[_0x0c21('0x46')]=function(_0x2a699a,_0x3843e4){var _0x1a7c02={'raw':!![],'where':{'id':_0x2a699a[_0x0c21('0x47')]['id']}},_0x49a844={};_0x49a844[_0x0c21('0x34')]=_[_0x0c21('0x36')](db['OpenchannelTransferReport'][_0x0c21('0x30')]);_0x49a844['query']=_[_0x0c21('0x36')](_0x2a699a[_0x0c21('0x35')]);_0x49a844[_0x0c21('0x3e')]=_['intersection'](_0x49a844[_0x0c21('0x34')],_0x49a844['query']);_0x1a7c02[_0x0c21('0x38')]=_[_0x0c21('0x37')](_0x49a844['model'],qs[_0x0c21('0x39')](_0x2a699a[_0x0c21('0x35')][_0x0c21('0x39')]));_0x1a7c02['attributes']=_0x1a7c02[_0x0c21('0x38')][_0x0c21('0x48')]?_0x1a7c02[_0x0c21('0x38')]:_0x49a844['model'];if(_0x2a699a[_0x0c21('0x35')]['includeAll']){_0x1a7c02[_0x0c21('0x45')]=[{'all':!![]}];}_0x1a7c02=_['merge']({},_0x1a7c02,_0x2a699a['options']);return db['OpenchannelTransferReport'][_0x0c21('0x49')](_0x1a7c02)['then'](handleEntityNotFound(_0x3843e4,null))[_0x0c21('0x26')](respondWithResult(_0x3843e4,null))[_0x0c21('0x4a')](handleError(_0x3843e4,null));};exports[_0x0c21('0x4b')]=function(_0x58cec2,_0x1f855a){return db['OpenchannelTransferReport'][_0x0c21('0x4b')](_0x58cec2[_0x0c21('0x4c')],{})[_0x0c21('0x26')](respondWithResult(_0x1f855a,0xc9))['catch'](handleError(_0x1f855a,null));};exports['update']=function(_0x2e2a0c,_0x36df7a){if(_0x2e2a0c[_0x0c21('0x4c')]['id']){delete _0x2e2a0c['body']['id'];}return db[_0x0c21('0x2f')][_0x0c21('0x49')]({'where':{'id':_0x2e2a0c[_0x0c21('0x47')]['id']}})[_0x0c21('0x26')](handleEntityNotFound(_0x36df7a,null))[_0x0c21('0x26')](saveUpdates(_0x2e2a0c[_0x0c21('0x4c')],null))[_0x0c21('0x26')](respondWithResult(_0x36df7a,null))[_0x0c21('0x4a')](handleError(_0x36df7a,null));};exports[_0x0c21('0x25')]=function(_0x2799e4,_0x32c1fc){return db[_0x0c21('0x2f')][_0x0c21('0x49')]({'where':{'id':_0x2799e4[_0x0c21('0x47')]['id']}})['then'](handleEntityNotFound(_0x32c1fc,null))[_0x0c21('0x26')](removeEntity(_0x32c1fc,null))[_0x0c21('0x4a')](handleError(_0x32c1fc,null));};exports['describe']=function(_0x58b1d6,_0x20d3cb){return db[_0x0c21('0x2f')]['describe']()['then'](respondWithResult(_0x20d3cb,null))[_0x0c21('0x4a')](handleError(_0x20d3cb,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e4a070d..913e5d7 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 _0x4146=['exports','define','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4146,0x1ed));var _0x6414=function(_0x5c7bd0,_0x3264cd){_0x5c7bd0=_0x5c7bd0-0x0;var _0x47b3af=_0x4146[_0x5c7bd0];return _0x47b3af;};'use strict';var _=require(_0x6414('0x0'));var util=require('util');var logger=require(_0x6414('0x1'))('api');var moment=require(_0x6414('0x2'));var BPromise=require(_0x6414('0x3'));var rp=require(_0x6414('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6414('0x5'));var attributes=require(_0x6414('0x6'));module[_0x6414('0x7')]=function(_0x40cdee,_0x4ea0fc){return _0x40cdee[_0x6414('0x8')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x6414('0x9'),'fields':[_0x6414('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x37ee=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e4a91,_0x14a668){var _0x2a2ec4=function(_0x54ee68){while(--_0x54ee68){_0x1e4a91['push'](_0x1e4a91['shift']());}};_0x2a2ec4(++_0x14a668);}(_0x37ee,0x19e));var _0xe37e=function(_0x1466e5,_0x34dd96){_0x1466e5=_0x1466e5-0x0;var _0x95a878=_0x37ee[_0x1466e5];return _0x95a878;};'use strict';var _=require(_0xe37e('0x0'));var util=require('util');var logger=require(_0xe37e('0x1'))(_0xe37e('0x2'));var moment=require(_0xe37e('0x3'));var BPromise=require(_0xe37e('0x4'));var rp=require(_0xe37e('0x5'));var fs=require('fs');var path=require(_0xe37e('0x6'));var rimraf=require(_0xe37e('0x7'));var config=require(_0xe37e('0x8'));var attributes=require(_0xe37e('0x9'));module[_0xe37e('0xa')]=function(_0x1d9019,_0x5b1907){return _0x1d9019[_0xe37e('0xb')](_0xe37e('0xc'),attributes,{'tableName':_0xe37e('0xd'),'paranoid':![],'indexes':[{'name':_0xe37e('0xe'),'fields':[_0xe37e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 3424f10..dafe4ea 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 _0x60c2=['stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x55d282,_0x4577bf){var _0x5a1956=function(_0x5f301a){while(--_0x5f301a){_0x55d282['push'](_0x55d282['shift']());}};_0x5a1956(++_0x4577bf);}(_0x60c2,0x8f));var _0x260c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x60c2[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x260c('0x0'));var moment=require(_0x260c('0x1'));var BPromise=require(_0x260c('0x2'));var rs=require(_0x260c('0x3'));var fs=require('fs');var Redis=require(_0x260c('0x4'));var db=require(_0x260c('0x5'))['db'];var utils=require(_0x260c('0x6'));var logger=require(_0x260c('0x7'))(_0x260c('0x8'));var config=require(_0x260c('0x9'));var jayson=require(_0x260c('0xa'));var client=jayson[_0x260c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14fab2,_0x2c2cd8,_0x3b432d){return new BPromise(function(_0xf22c37,_0x4b2992){return client[_0x260c('0xc')](_0x14fab2,_0x3b432d)[_0x260c('0xd')](function(_0x8378bb){logger[_0x260c('0xe')](_0x260c('0xf'),_0x2c2cd8,_0x260c('0x10'));logger[_0x260c('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2c2cd8,_0x260c('0x10'),JSON[_0x260c('0x12')](_0x8378bb));if(_0x8378bb[_0x260c('0x13')]){if(_0x8378bb['error'][_0x260c('0x14')]===0x1f4){logger[_0x260c('0x13')](_0x260c('0xf'),_0x2c2cd8,_0x8378bb['error'][_0x260c('0x15')]);return _0x4b2992(_0x8378bb[_0x260c('0x13')][_0x260c('0x15')]);}logger[_0x260c('0x13')](_0x260c('0xf'),_0x2c2cd8,_0x8378bb['error'][_0x260c('0x15')]);return _0xf22c37(_0x8378bb['error'][_0x260c('0x15')]);}else{logger[_0x260c('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2c2cd8,_0x260c('0x10'));_0xf22c37(_0x8378bb['result'][_0x260c('0x15')]);}})[_0x260c('0x16')](function(_0x411970){logger[_0x260c('0x13')](_0x260c('0xf'),_0x2c2cd8,_0x411970);_0x4b2992(_0x411970);});});} \ No newline at end of file +var _0xec39=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xec39,0x19f));var _0x9ec3=function(_0x4fdc92,_0x4456ab){_0x4fdc92=_0x4fdc92-0x0;var _0x1417d3=_0xec39[_0x4fdc92];return _0x1417d3;};'use strict';var _=require(_0x9ec3('0x0'));var util=require(_0x9ec3('0x1'));var moment=require(_0x9ec3('0x2'));var BPromise=require(_0x9ec3('0x3'));var rs=require(_0x9ec3('0x4'));var fs=require('fs');var Redis=require(_0x9ec3('0x5'));var db=require(_0x9ec3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ec3('0x7'))(_0x9ec3('0x8'));var config=require(_0x9ec3('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3742c5,_0x11c4d1,_0x29a6a2){return new BPromise(function(_0x595e3a,_0x570a91){return client[_0x9ec3('0xa')](_0x3742c5,_0x29a6a2)[_0x9ec3('0xb')](function(_0x2d0c30){logger[_0x9ec3('0xc')](_0x9ec3('0xd'),_0x11c4d1,_0x9ec3('0xe'));logger['debug'](_0x9ec3('0xf'),_0x11c4d1,_0x9ec3('0xe'),JSON[_0x9ec3('0x10')](_0x2d0c30));if(_0x2d0c30[_0x9ec3('0x11')]){if(_0x2d0c30[_0x9ec3('0x11')][_0x9ec3('0x12')]===0x1f4){logger[_0x9ec3('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x11c4d1,_0x2d0c30[_0x9ec3('0x11')][_0x9ec3('0x13')]);return _0x570a91(_0x2d0c30[_0x9ec3('0x11')]['message']);}logger[_0x9ec3('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x11c4d1,_0x2d0c30[_0x9ec3('0x11')][_0x9ec3('0x13')]);return _0x595e3a(_0x2d0c30[_0x9ec3('0x11')][_0x9ec3('0x13')]);}else{logger[_0x9ec3('0xc')](_0x9ec3('0xd'),_0x11c4d1,_0x9ec3('0xe'));_0x595e3a(_0x2d0c30[_0x9ec3('0x14')][_0x9ec3('0x13')]);}})['catch'](function(_0x39ca26){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x11c4d1,_0x39ca26);_0x570a91(_0x39ca26);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1df32b4..fddcbed 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 _0x328f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x328f,0x188));var _0xf328=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0x328f[_0x305c31];return _0x17f39f;};'use strict';var multer=require('multer');var util=require(_0xf328('0x0'));var path=require(_0xf328('0x1'));var timeout=require(_0xf328('0x2'));var express=require(_0xf328('0x3'));var router=express[_0xf328('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf328('0x5'));var interaction=require(_0xf328('0x6'));var config=require(_0xf328('0x7'));var controller=require('./pause.controller');router[_0xf328('0x8')]('/',auth[_0xf328('0x9')](),controller['index']);router[_0xf328('0x8')](_0xf328('0xa'),auth['isAuthenticated'](),controller[_0xf328('0xb')]);router[_0xf328('0xc')]('/',auth[_0xf328('0x9')](),controller[_0xf328('0xd')]);router[_0xf328('0xe')](_0xf328('0xa'),auth[_0xf328('0x9')](),controller[_0xf328('0xf')]);router[_0xf328('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf328('0x11')]);module[_0xf328('0x12')]=router; \ No newline at end of file +var _0x26ef=['post','update','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x586212,_0x2f8e35){var _0x14855f=function(_0x1f1345){while(--_0x1f1345){_0x586212['push'](_0x586212['shift']());}};_0x14855f(++_0x2f8e35);}(_0x26ef,0x13e));var _0xf26e=function(_0x2c5807,_0x50a219){_0x2c5807=_0x2c5807-0x0;var _0x42d217=_0x26ef[_0x2c5807];return _0x42d217;};'use strict';var multer=require('multer');var util=require(_0xf26e('0x0'));var path=require(_0xf26e('0x1'));var timeout=require(_0xf26e('0x2'));var express=require(_0xf26e('0x3'));var router=express['Router']();var fs_extra=require(_0xf26e('0x4'));var auth=require(_0xf26e('0x5'));var interaction=require(_0xf26e('0x6'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0xf26e('0x7')]('/',auth[_0xf26e('0x8')](),controller[_0xf26e('0x9')]);router[_0xf26e('0x7')](_0xf26e('0xa'),auth[_0xf26e('0x8')](),controller[_0xf26e('0xb')]);router[_0xf26e('0xc')]('/',auth[_0xf26e('0x8')](),controller['create']);router['put'](_0xf26e('0xa'),auth[_0xf26e('0x8')](),controller[_0xf26e('0xd')]);router['delete'](_0xf26e('0xa'),auth[_0xf26e('0x8')](),controller[_0xf26e('0xe')]);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 7e430cd..d256ab1 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 _0xd2a5=['STRING','name'];(function(_0x314e50,_0xe9a4a4){var _0x1c9149=function(_0x171772){while(--_0x171772){_0x314e50['push'](_0x314e50['shift']());}};_0x1c9149(++_0xe9a4a4);}(_0xd2a5,0x80));var _0x5d2a=function(_0x1afea4,_0x106601){_0x1afea4=_0x1afea4-0x0;var _0x3df48a=_0xd2a5[_0x1afea4];return _0x3df48a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5d2a('0x0')],'unique':_0x5d2a('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x5d2a('0x0')]}}; \ No newline at end of file +var _0x45a0=['STRING','name','exports'];(function(_0x8c03b1,_0x3584a6){var _0x214d01=function(_0x39c32b){while(--_0x39c32b){_0x8c03b1['push'](_0x8c03b1['shift']());}};_0x214d01(++_0x3584a6);}(_0x45a0,0xd7));var _0x045a=function(_0x5a03b6,_0x4d6d61){_0x5a03b6=_0x5a03b6-0x0;var _0x43850c=_0x45a0[_0x5a03b6];return _0x43850c;};'use strict';var Sequelize=require('sequelize');module[_0x045a('0x0')]={'name':{'type':Sequelize[_0x045a('0x1')],'unique':_0x045a('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 d81c2f1..1150f18 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 _0x3073=['length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','end','error','name','send','index','Pause','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x11e362,_0xe7e25c){var _0x280d4f=function(_0x21b6e5){while(--_0x21b6e5){_0x11e362['push'](_0x11e362['shift']());}};_0x280d4f(++_0xe7e25c);}(_0x3073,0xab));var _0x3307=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x3073[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require(_0x3307('0x0'));var rimraf=require(_0x3307('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3307('0x2'));var moment=require(_0x3307('0x3'));var BPromise=require(_0x3307('0x4'));var Mustache=require(_0x3307('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3307('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3307('0x7'));var squel=require(_0x3307('0x8'));var crypto=require(_0x3307('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3307('0xa'));var querystring=require(_0x3307('0xb'));var Papa=require('papaparse');var Redis=require(_0x3307('0xc'));var authService=require(_0x3307('0xd'));var qs=require(_0x3307('0xe'));var as=require(_0x3307('0xf'));var hardwareService=require(_0x3307('0x10'));var logger=require(_0x3307('0x11'))('api');var utils=require(_0x3307('0x12'));var config=require(_0x3307('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7996,_0xee7fde){_0xee7fde=_0xee7fde||0xcc;return function(_0x1d1eb0){if(_0x1d1eb0){return _0x1f7996[_0x3307('0x14')](_0xee7fde);}return _0x1f7996[_0x3307('0x15')](_0xee7fde)['end']();};}function respondWithResult(_0x2fe7b2,_0x4bd876){_0x4bd876=_0x4bd876||0xc8;return function(_0x3411aa){if(_0x3411aa){return _0x2fe7b2[_0x3307('0x15')](_0x4bd876)[_0x3307('0x16')](_0x3411aa);}};}function respondWithFilteredResult(_0x6c901f,_0x5d3ca2){return function(_0x30899a){if(_0x30899a){var _0x4479b8=typeof _0x5d3ca2[_0x3307('0x17')]==='undefined'&&typeof _0x5d3ca2['limit']===_0x3307('0x18');var _0x172158=_0x30899a[_0x3307('0x19')];var _0x242b65=_0x4479b8?0x0:_0x5d3ca2[_0x3307('0x17')];var _0x517068=_0x4479b8?_0x30899a[_0x3307('0x19')]:_0x5d3ca2[_0x3307('0x17')]+_0x5d3ca2['limit'];var _0x1b6a66;if(_0x517068>=_0x172158){_0x517068=_0x172158;_0x1b6a66=0xc8;}else{_0x1b6a66=0xce;}_0x6c901f['status'](_0x1b6a66);return _0x6c901f['set'](_0x3307('0x1a'),_0x242b65+'-'+_0x517068+'/'+_0x172158)[_0x3307('0x16')](_0x30899a);}return null;};}function patchUpdates(_0x1c66c1){return function(_0x3397c9){try{jsonpatch[_0x3307('0x1b')](_0x3397c9,_0x1c66c1,!![]);}catch(_0x53c173){return BPromise['reject'](_0x53c173);}return _0x3397c9[_0x3307('0x1c')]();};}function saveUpdates(_0x3d56ce,_0x5c23b7){return function(_0x3740d1){if(_0x3740d1){return _0x3740d1[_0x3307('0x1d')](_0x3d56ce)[_0x3307('0x1e')](function(_0x5689a4){return _0x5689a4;});}return null;};}function removeEntity(_0x5c6ebb,_0x306818){return function(_0x15997b){if(_0x15997b){return _0x15997b[_0x3307('0x1f')]()[_0x3307('0x1e')](function(){var _0x1675b5=_0x15997b[_0x3307('0x20')]({'plain':!![]});var _0x29eb54=_0x3307('0x21');return db[_0x3307('0x22')]['destroy']({'where':{'type':_0x29eb54,'resourceId':_0x1675b5['id']}})['then'](function(){return _0x15997b;});})[_0x3307('0x1e')](function(){_0x5c6ebb[_0x3307('0x15')](0xcc)[_0x3307('0x23')]();});}};}function handleEntityNotFound(_0x3a4d89,_0x2773bc){return function(_0x478ad2){if(!_0x478ad2){_0x3a4d89['sendStatus'](0x194);}return _0x478ad2;};}function handleError(_0x559a4e,_0x56d936){_0x56d936=_0x56d936||0x1f4;return function(_0xb7da13){logger[_0x3307('0x24')](_0xb7da13['stack']);if(_0xb7da13['name']){delete _0xb7da13[_0x3307('0x25')];}_0x559a4e[_0x3307('0x15')](_0x56d936)[_0x3307('0x26')](_0xb7da13);};}exports[_0x3307('0x27')]=function(_0x272f00,_0x58ed12){var _0x1782b5={},_0x556ae3={},_0x4dc1e1={'count':0x0,'rows':[]};var _0x111079=_['map'](db[_0x3307('0x28')][_0x3307('0x29')],function(_0x3ba4d5){return{'name':_0x3ba4d5[_0x3307('0x2a')],'type':_0x3ba4d5[_0x3307('0x2b')]['key']};});_0x556ae3[_0x3307('0x2c')]=_['map'](_0x111079,_0x3307('0x25'));_0x556ae3[_0x3307('0x2d')]=_['keys'](_0x272f00['query']);_0x556ae3[_0x3307('0x2e')]=_[_0x3307('0x2f')](_0x556ae3[_0x3307('0x2c')],_0x556ae3['query']);_0x1782b5['attributes']=_[_0x3307('0x2f')](_0x556ae3['model'],qs[_0x3307('0x30')](_0x272f00[_0x3307('0x2d')]['fields']));_0x1782b5['attributes']=_0x1782b5[_0x3307('0x31')]['length']?_0x1782b5[_0x3307('0x31')]:_0x556ae3[_0x3307('0x2c')];if(!_0x272f00[_0x3307('0x2d')]['hasOwnProperty'](_0x3307('0x32'))){_0x1782b5[_0x3307('0x33')]=qs['limit'](_0x272f00[_0x3307('0x2d')][_0x3307('0x33')]);_0x1782b5[_0x3307('0x17')]=qs[_0x3307('0x17')](_0x272f00[_0x3307('0x2d')][_0x3307('0x17')]);}_0x1782b5[_0x3307('0x34')]=qs[_0x3307('0x35')](_0x272f00[_0x3307('0x2d')][_0x3307('0x35')]);_0x1782b5['where']=qs[_0x3307('0x2e')](_[_0x3307('0x36')](_0x272f00['query'],_0x556ae3[_0x3307('0x2e')]),_0x111079);if(_0x272f00[_0x3307('0x2d')][_0x3307('0x37')]){_0x1782b5[_0x3307('0x38')]=_[_0x3307('0x39')](_0x1782b5[_0x3307('0x38')],{'$or':_[_0x3307('0x3a')](_0x111079,function(_0x44d14e){if(_0x44d14e['type']!==_0x3307('0x3b')){var _0x4b9e70={};_0x4b9e70[_0x44d14e[_0x3307('0x25')]]={'$like':'%'+_0x272f00[_0x3307('0x2d')][_0x3307('0x37')]+'%'};return _0x4b9e70;}})});}_0x1782b5=_[_0x3307('0x39')]({},_0x1782b5,_0x272f00[_0x3307('0x3c')]);var _0x24e7e3={'where':_0x1782b5['where']};return db[_0x3307('0x28')][_0x3307('0x19')](_0x24e7e3)['then'](function(_0x7c55a2){_0x4dc1e1[_0x3307('0x19')]=_0x7c55a2;if(_0x272f00[_0x3307('0x2d')][_0x3307('0x3d')]){_0x1782b5[_0x3307('0x3e')]=[{'all':!![]}];}return db[_0x3307('0x28')][_0x3307('0x3f')](_0x1782b5);})['then'](function(_0x5a32f3){_0x4dc1e1[_0x3307('0x40')]=_0x5a32f3;return _0x4dc1e1;})['then'](respondWithFilteredResult(_0x58ed12,_0x1782b5))['catch'](handleError(_0x58ed12,null));};exports[_0x3307('0x41')]=function(_0x319ab0,_0x17269e){var _0x5f54ce={'raw':!![],'where':{'id':_0x319ab0['params']['id']}},_0x3d350f={};_0x3d350f[_0x3307('0x2c')]=_['keys'](db[_0x3307('0x28')]['rawAttributes']);_0x3d350f[_0x3307('0x2d')]=_['keys'](_0x319ab0[_0x3307('0x2d')]);_0x3d350f[_0x3307('0x2e')]=_['intersection'](_0x3d350f[_0x3307('0x2c')],_0x3d350f['query']);_0x5f54ce['attributes']=_['intersection'](_0x3d350f[_0x3307('0x2c')],qs[_0x3307('0x30')](_0x319ab0[_0x3307('0x2d')][_0x3307('0x30')]));_0x5f54ce[_0x3307('0x31')]=_0x5f54ce[_0x3307('0x31')][_0x3307('0x42')]?_0x5f54ce[_0x3307('0x31')]:_0x3d350f[_0x3307('0x2c')];if(_0x319ab0[_0x3307('0x2d')][_0x3307('0x3d')]){_0x5f54ce[_0x3307('0x3e')]=[{'all':!![]}];}_0x5f54ce=_['merge']({},_0x5f54ce,_0x319ab0['options']);return db[_0x3307('0x28')]['find'](_0x5f54ce)[_0x3307('0x1e')](handleEntityNotFound(_0x17269e,null))[_0x3307('0x1e')](respondWithResult(_0x17269e,null))[_0x3307('0x43')](handleError(_0x17269e,null));};exports[_0x3307('0x44')]=function(_0x417dc2,_0x14b8c0){return db[_0x3307('0x28')][_0x3307('0x44')](_0x417dc2[_0x3307('0x45')],{})[_0x3307('0x1e')](function(_0x3bce68){var _0x1b9b0a=_0x417dc2[_0x3307('0x46')][_0x3307('0x20')]({'plain':!![]});if(!_0x1b9b0a)throw new Error(_0x3307('0x47'));if(_0x1b9b0a[_0x3307('0x48')]===_0x3307('0x46')){var _0x501dea=_0x3bce68[_0x3307('0x20')]({'plain':!![]});var _0x12c50c=_0x3307('0x21');return db[_0x3307('0x49')]['find']({'where':{'name':_0x12c50c,'userProfileId':_0x1b9b0a[_0x3307('0x4a')]},'raw':!![]})[_0x3307('0x1e')](function(_0x5a1ded){if(_0x5a1ded&&_0x5a1ded[_0x3307('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x501dea[_0x3307('0x25')],'resourceId':_0x501dea['id'],'type':_0x5a1ded[_0x3307('0x25')],'sectionId':_0x5a1ded['id']},{})[_0x3307('0x1e')](function(){return _0x3bce68;});}else{return _0x3bce68;}})[_0x3307('0x43')](function(_0xd55fed){logger[_0x3307('0x24')](_0x3307('0x4c'),_0xd55fed);throw _0xd55fed;});}return _0x3bce68;})[_0x3307('0x1e')](respondWithResult(_0x14b8c0,0xc9))[_0x3307('0x43')](handleError(_0x14b8c0,null));};exports['update']=function(_0x1c45dc,_0xcf690e){if(_0x1c45dc[_0x3307('0x45')]['id']){delete _0x1c45dc['body']['id'];}return db['Pause']['find']({'where':{'id':_0x1c45dc['params']['id']}})[_0x3307('0x1e')](handleEntityNotFound(_0xcf690e,null))['then'](saveUpdates(_0x1c45dc[_0x3307('0x45')],null))[_0x3307('0x1e')](respondWithResult(_0xcf690e,null))[_0x3307('0x43')](handleError(_0xcf690e,null));};exports[_0x3307('0x1f')]=function(_0x5d334b,_0x2dfdc4){return db[_0x3307('0x28')][_0x3307('0x4d')]({'where':{'id':_0x5d334b[_0x3307('0x4e')]['id']}})[_0x3307('0x1e')](handleEntityNotFound(_0x2dfdc4,null))['then'](removeEntity(_0x2dfdc4,null))[_0x3307('0x43')](handleError(_0x2dfdc4,null));}; \ No newline at end of file +var _0x462e=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','get','Pauses','UserProfileResource','stack','name','index','Pause','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path'];(function(_0x2caa85,_0x462dc1){var _0x3d437f=function(_0x47551f){while(--_0x47551f){_0x2caa85['push'](_0x2caa85['shift']());}};_0x3d437f(++_0x462dc1);}(_0x462e,0x9e));var _0xe462=function(_0x1c7591,_0x4ce5cb){_0x1c7591=_0x1c7591-0x0;var _0x57e921=_0x462e[_0x1c7591];return _0x57e921;};'use strict';var emlformat=require(_0xe462('0x0'));var rimraf=require(_0xe462('0x1'));var zipdir=require(_0xe462('0x2'));var jsonpatch=require(_0xe462('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe462('0x4'));var util=require('util');var path=require(_0xe462('0x5'));var sox=require('sox');var csv=require(_0xe462('0x6'));var ejs=require(_0xe462('0x7'));var fs=require('fs');var fs_extra=require(_0xe462('0x8'));var _=require(_0xe462('0x9'));var squel=require(_0xe462('0xa'));var crypto=require(_0xe462('0xb'));var jsforce=require(_0xe462('0xc'));var deskjs=require(_0xe462('0xd'));var toCsv=require(_0xe462('0x6'));var querystring=require(_0xe462('0xe'));var Papa=require(_0xe462('0xf'));var Redis=require('ioredis');var authService=require(_0xe462('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe462('0x11'));var logger=require(_0xe462('0x12'))(_0xe462('0x13'));var utils=require(_0xe462('0x14'));var config=require(_0xe462('0x15'));var licenseUtil=require(_0xe462('0x16'));var db=require(_0xe462('0x17'))['db'];function respondWithStatusCode(_0x41c981,_0x37274e){_0x37274e=_0x37274e||0xcc;return function(_0x5d32db){if(_0x5d32db){return _0x41c981[_0xe462('0x18')](_0x37274e);}return _0x41c981[_0xe462('0x19')](_0x37274e)[_0xe462('0x1a')]();};}function respondWithResult(_0x1b3a66,_0xeebf12){_0xeebf12=_0xeebf12||0xc8;return function(_0x2e9bcb){if(_0x2e9bcb){return _0x1b3a66['status'](_0xeebf12)[_0xe462('0x1b')](_0x2e9bcb);}};}function respondWithFilteredResult(_0x11b4d4,_0xa40275){return function(_0x4af989){if(_0x4af989){var _0x597b4a=typeof _0xa40275[_0xe462('0x1c')]===_0xe462('0x1d')&&typeof _0xa40275[_0xe462('0x1e')]===_0xe462('0x1d');var _0x5afdb3=_0x4af989[_0xe462('0x1f')];var _0x3582c8=_0x597b4a?0x0:_0xa40275[_0xe462('0x1c')];var _0x1adb25=_0x597b4a?_0x4af989[_0xe462('0x1f')]:_0xa40275['offset']+_0xa40275[_0xe462('0x1e')];var _0x32ed3c;if(_0x1adb25>=_0x5afdb3){_0x1adb25=_0x5afdb3;_0x32ed3c=0xc8;}else{_0x32ed3c=0xce;}_0x11b4d4['status'](_0x32ed3c);return _0x11b4d4[_0xe462('0x20')]('Content-Range',_0x3582c8+'-'+_0x1adb25+'/'+_0x5afdb3)[_0xe462('0x1b')](_0x4af989);}return null;};}function patchUpdates(_0x1e12b7){return function(_0x10d57b){try{jsonpatch['apply'](_0x10d57b,_0x1e12b7,!![]);}catch(_0x57d73a){return BPromise[_0xe462('0x21')](_0x57d73a);}return _0x10d57b['save']();};}function saveUpdates(_0x5d9412,_0x4e8b47){return function(_0x80aaab){if(_0x80aaab){return _0x80aaab[_0xe462('0x22')](_0x5d9412)[_0xe462('0x23')](function(_0x3c2106){return _0x3c2106;});}return null;};}function removeEntity(_0x3bfd94,_0x1391da){return function(_0xc02480){if(_0xc02480){return _0xc02480[_0xe462('0x24')]()['then'](function(){var _0x2a068a=_0xc02480[_0xe462('0x25')]({'plain':!![]});var _0x2df8bc=_0xe462('0x26');return db[_0xe462('0x27')][_0xe462('0x24')]({'where':{'type':_0x2df8bc,'resourceId':_0x2a068a['id']}})[_0xe462('0x23')](function(){return _0xc02480;});})[_0xe462('0x23')](function(){_0x3bfd94[_0xe462('0x19')](0xcc)[_0xe462('0x1a')]();});}};}function handleEntityNotFound(_0x4ae984,_0x13c80c){return function(_0x52c0e2){if(!_0x52c0e2){_0x4ae984[_0xe462('0x18')](0x194);}return _0x52c0e2;};}function handleError(_0x18c559,_0x117a33){_0x117a33=_0x117a33||0x1f4;return function(_0x5b539c){logger['error'](_0x5b539c[_0xe462('0x28')]);if(_0x5b539c[_0xe462('0x29')]){delete _0x5b539c['name'];}_0x18c559[_0xe462('0x19')](_0x117a33)['send'](_0x5b539c);};}exports[_0xe462('0x2a')]=function(_0x1c3846,_0x4c7f19){var _0x8b9798={},_0x4e2293={},_0x2739a7={'count':0x0,'rows':[]};var _0x37d760=_['map'](db[_0xe462('0x2b')][_0xe462('0x2c')],function(_0x5588e9){return{'name':_0x5588e9[_0xe462('0x2d')],'type':_0x5588e9[_0xe462('0x2e')]['key']};});_0x4e2293[_0xe462('0x2f')]=_[_0xe462('0x30')](_0x37d760,_0xe462('0x29'));_0x4e2293[_0xe462('0x31')]=_['keys'](_0x1c3846['query']);_0x4e2293[_0xe462('0x32')]=_[_0xe462('0x33')](_0x4e2293[_0xe462('0x2f')],_0x4e2293['query']);_0x8b9798[_0xe462('0x34')]=_['intersection'](_0x4e2293[_0xe462('0x2f')],qs[_0xe462('0x35')](_0x1c3846['query'][_0xe462('0x35')]));_0x8b9798['attributes']=_0x8b9798[_0xe462('0x34')][_0xe462('0x36')]?_0x8b9798['attributes']:_0x4e2293[_0xe462('0x2f')];if(!_0x1c3846[_0xe462('0x31')][_0xe462('0x37')](_0xe462('0x38'))){_0x8b9798['limit']=qs['limit'](_0x1c3846['query'][_0xe462('0x1e')]);_0x8b9798[_0xe462('0x1c')]=qs[_0xe462('0x1c')](_0x1c3846[_0xe462('0x31')]['offset']);}_0x8b9798[_0xe462('0x39')]=qs[_0xe462('0x3a')](_0x1c3846[_0xe462('0x31')][_0xe462('0x3a')]);_0x8b9798[_0xe462('0x3b')]=qs['filters'](_[_0xe462('0x3c')](_0x1c3846[_0xe462('0x31')],_0x4e2293[_0xe462('0x32')]),_0x37d760);if(_0x1c3846[_0xe462('0x31')][_0xe462('0x3d')]){_0x8b9798[_0xe462('0x3b')]=_[_0xe462('0x3e')](_0x8b9798[_0xe462('0x3b')],{'$or':_[_0xe462('0x30')](_0x37d760,function(_0x1107c6){if(_0x1107c6['type']!==_0xe462('0x3f')){var _0x1096a0={};_0x1096a0[_0x1107c6[_0xe462('0x29')]]={'$like':'%'+_0x1c3846[_0xe462('0x31')][_0xe462('0x3d')]+'%'};return _0x1096a0;}})});}_0x8b9798=_[_0xe462('0x3e')]({},_0x8b9798,_0x1c3846[_0xe462('0x40')]);var _0x82de4b={'where':_0x8b9798['where']};return db[_0xe462('0x2b')][_0xe462('0x1f')](_0x82de4b)[_0xe462('0x23')](function(_0xab25a8){_0x2739a7[_0xe462('0x1f')]=_0xab25a8;if(_0x1c3846[_0xe462('0x31')][_0xe462('0x41')]){_0x8b9798[_0xe462('0x42')]=[{'all':!![]}];}return db[_0xe462('0x2b')][_0xe462('0x43')](_0x8b9798);})[_0xe462('0x23')](function(_0x2fa60c){_0x2739a7[_0xe462('0x44')]=_0x2fa60c;return _0x2739a7;})[_0xe462('0x23')](respondWithFilteredResult(_0x4c7f19,_0x8b9798))[_0xe462('0x45')](handleError(_0x4c7f19,null));};exports[_0xe462('0x46')]=function(_0x23ea7f,_0x5848e7){var _0x3a84b6={'raw':!![],'where':{'id':_0x23ea7f['params']['id']}},_0x3178b7={};_0x3178b7[_0xe462('0x2f')]=_[_0xe462('0x47')](db[_0xe462('0x2b')][_0xe462('0x2c')]);_0x3178b7[_0xe462('0x31')]=_['keys'](_0x23ea7f[_0xe462('0x31')]);_0x3178b7[_0xe462('0x32')]=_[_0xe462('0x33')](_0x3178b7['model'],_0x3178b7['query']);_0x3a84b6[_0xe462('0x34')]=_[_0xe462('0x33')](_0x3178b7['model'],qs[_0xe462('0x35')](_0x23ea7f['query']['fields']));_0x3a84b6['attributes']=_0x3a84b6['attributes'][_0xe462('0x36')]?_0x3a84b6['attributes']:_0x3178b7['model'];if(_0x23ea7f[_0xe462('0x31')][_0xe462('0x41')]){_0x3a84b6[_0xe462('0x42')]=[{'all':!![]}];}_0x3a84b6=_[_0xe462('0x3e')]({},_0x3a84b6,_0x23ea7f[_0xe462('0x40')]);return db[_0xe462('0x2b')]['find'](_0x3a84b6)['then'](handleEntityNotFound(_0x5848e7,null))[_0xe462('0x23')](respondWithResult(_0x5848e7,null))[_0xe462('0x45')](handleError(_0x5848e7,null));};exports[_0xe462('0x48')]=function(_0x385008,_0x9532e){return db['Pause'][_0xe462('0x48')](_0x385008[_0xe462('0x49')],{})[_0xe462('0x23')](function(_0x3a938a){var _0x572e80=_0x385008[_0xe462('0x4a')][_0xe462('0x25')]({'plain':!![]});if(!_0x572e80)throw new Error(_0xe462('0x4b'));if(_0x572e80[_0xe462('0x4c')]===_0xe462('0x4a')){var _0x1c83ce=_0x3a938a[_0xe462('0x25')]({'plain':!![]});var _0x28973e=_0xe462('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x28973e,'userProfileId':_0x572e80[_0xe462('0x4d')]},'raw':!![]})[_0xe462('0x23')](function(_0x24ee49){if(_0x24ee49&&_0x24ee49[_0xe462('0x4e')]===0x0){return db[_0xe462('0x27')][_0xe462('0x48')]({'name':_0x1c83ce[_0xe462('0x29')],'resourceId':_0x1c83ce['id'],'type':_0x24ee49[_0xe462('0x29')],'sectionId':_0x24ee49['id']},{})[_0xe462('0x23')](function(){return _0x3a938a;});}else{return _0x3a938a;}})[_0xe462('0x45')](function(_0x236c52){logger['error'](_0xe462('0x4f'),_0x236c52);throw _0x236c52;});}return _0x3a938a;})[_0xe462('0x23')](respondWithResult(_0x9532e,0xc9))[_0xe462('0x45')](handleError(_0x9532e,null));};exports[_0xe462('0x22')]=function(_0x8ebbc6,_0x5ae3f5){if(_0x8ebbc6[_0xe462('0x49')]['id']){delete _0x8ebbc6[_0xe462('0x49')]['id'];}return db[_0xe462('0x2b')][_0xe462('0x50')]({'where':{'id':_0x8ebbc6[_0xe462('0x51')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x5ae3f5,null))[_0xe462('0x23')](saveUpdates(_0x8ebbc6[_0xe462('0x49')],null))[_0xe462('0x23')](respondWithResult(_0x5ae3f5,null))[_0xe462('0x45')](handleError(_0x5ae3f5,null));};exports['destroy']=function(_0x21e75d,_0x24123b){return db[_0xe462('0x2b')][_0xe462('0x50')]({'where':{'id':_0x21e75d[_0xe462('0x51')]['id']}})[_0xe462('0x23')](handleEntityNotFound(_0x24123b,null))[_0xe462('0x23')](removeEntity(_0x24123b,null))[_0xe462('0x45')](handleError(_0x24123b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0342c33..2e4e3fd 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 _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x25902a,_0x491bef){var _0x551e27=function(_0x24108b){while(--_0x24108b){_0x25902a['push'](_0x25902a['shift']());}};_0x551e27(++_0x491bef);}(_0x326f,0xd1));var _0xf326=function(_0x41b862,_0x30a635){_0x41b862=_0x41b862-0x0;var _0x529f5f=_0x326f[_0x41b862];return _0x529f5f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x1932de,_0x4c36c6){var _0x28dc9d=function(_0x2b4ab2){while(--_0x2b4ab2){_0x1932de['push'](_0x1932de['shift']());}};_0x28dc9d(++_0x4c36c6);}(_0x53ec,0x192));var _0xc53e=function(_0x2657f7,_0x15c229){_0x2657f7=_0x2657f7-0x0;var _0x6d956=_0x53ec[_0x2657f7];return _0x6d956;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index b401bcd..c6410b3 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x203612,_0x5f3708){var _0x4f341b=function(_0x273c7f){while(--_0x273c7f){_0x203612['push'](_0x203612['shift']());}};_0x4f341b(++_0x5f3708);}(_0x7a54,0x106));var _0x47a5=function(_0x4ea9f3,_0x5291b4){_0x4ea9f3=_0x4ea9f3-0x0;var _0x314c9f=_0x7a54[_0x4ea9f3];return _0x314c9f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0xe1c1de,_0xfff5e6){var _0xfc7958=function(_0x21b5f5){while(--_0x21b5f5){_0xe1c1de['push'](_0xe1c1de['shift']());}};_0xfc7958(++_0xfff5e6);}(_0x7a54,0x106));var _0x47a5=function(_0x447c4c,_0x689614){_0x447c4c=_0x447c4c-0x0;var _0x5298d1=_0x7a54[_0x447c4c];return _0x5298d1;};'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 e30eb71..c0dacd8 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 _0x99e9=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','post','single','file','upload','update','delete'];(function(_0x3f00a7,_0x359027){var _0x496533=function(_0x2a40b6){while(--_0x2a40b6){_0x3f00a7['push'](_0x3f00a7['shift']());}};_0x496533(++_0x359027);}(_0x99e9,0xb4));var _0x999e=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x99e9[_0x40b3f2];return _0x4ce90c;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),controller['webhookGet']);router[_0x999e('0xa')](_0x999e('0xc'),auth[_0x999e('0x8')](),controller[_0x999e('0xd')]);router[_0x999e('0xa')](_0x999e('0xe'),auth[_0x999e('0x8')](),controller[_0x999e('0xf')]);var upload=multer({'storage':multer[_0x999e('0x10')]({'destination':function(_0xf40130,_0x9368cf,_0x1d19b0){_0x1d19b0(null,path[_0x999e('0x11')](config[_0x999e('0x12')],_0x999e('0x13')));},'filename':function(_0xdb587b,_0x26b55a,_0x47a3c1){_0x26b55a[_0x999e('0x14')]=_0x26b55a['originalname'][_0x999e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x47a3c1(null,util[_0x999e('0x16')](_0x999e('0x17'),path['basename'](_0x26b55a[_0x999e('0x14')],path['extname'](_0x26b55a[_0x999e('0x14')])),Date['now'](),path['extname'](_0x26b55a[_0x999e('0x14')])));}})});router[_0x999e('0x18')]('/',upload[_0x999e('0x19')](_0x999e('0x1a')),controller[_0x999e('0x1b')]);router[_0x999e('0x18')]('/webhook',controller['webhookPost']);router['put'](_0x999e('0xc'),auth[_0x999e('0x8')](),controller[_0x999e('0x1c')]);router[_0x999e('0x1d')](_0x999e('0xc'),auth[_0x999e('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x4c4e=['webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook'];(function(_0x28dbf6,_0x2f69c7){var _0x1473bd=function(_0x11c5ef){while(--_0x11c5ef){_0x28dbf6['push'](_0x28dbf6['shift']());}};_0x1473bd(++_0x2f69c7);}(_0x4c4e,0x152));var _0xe4c4=function(_0x259158,_0x29c8a4){_0x259158=_0x259158-0x0;var _0x27e6ab=_0x4c4e[_0x259158];return _0x27e6ab;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var fs_extra=require(_0xe4c4('0x4'));var auth=require(_0xe4c4('0x5'));var interaction=require(_0xe4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c4('0x7'));router['get']('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x9')]);router[_0xe4c4('0xa')](_0xe4c4('0xb'),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['show']);router['get'](_0xe4c4('0xe'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);var upload=multer({'storage':multer[_0xe4c4('0x10')]({'destination':function(_0x333c08,_0x2f4d5f,_0x50264f){_0x50264f(null,path[_0xe4c4('0x11')](config[_0xe4c4('0x12')],_0xe4c4('0x13')));},'filename':function(_0x2483d0,_0x50bfab,_0x262083){_0x50bfab[_0xe4c4('0x14')]=_0x50bfab['originalname'][_0xe4c4('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x262083(null,util[_0xe4c4('0x16')]('%s-%s%s',path[_0xe4c4('0x17')](_0x50bfab[_0xe4c4('0x14')],path['extname'](_0x50bfab[_0xe4c4('0x14')])),Date[_0xe4c4('0x18')](),path[_0xe4c4('0x19')](_0x50bfab[_0xe4c4('0x14')])));}})});router[_0xe4c4('0x1a')]('/',upload[_0xe4c4('0x1b')](_0xe4c4('0x1c')),controller[_0xe4c4('0x1d')]);router[_0xe4c4('0x1a')](_0xe4c4('0xb'),controller[_0xe4c4('0x1e')]);router[_0xe4c4('0x1f')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x20')]);router['delete'](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x21')]);module[_0xe4c4('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 0f5388f..ef29512 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 _0x4383=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x4383,0x181));var _0x3438=function(_0x2bad31,_0x1c7eb4){_0x2bad31=_0x2bad31-0x0;var _0x549f4d=_0x4383[_0x2bad31];return _0x549f4d;};'use strict';var Sequelize=require(_0x3438('0x0'));module[_0x3438('0x1')]={'name':{'type':Sequelize[_0x3438('0x2')]},'type':{'type':Sequelize[_0x3438('0x3')](_0x3438('0x4'),_0x3438('0x5'))},'description':{'type':Sequelize[_0x3438('0x6')]},'version':{'type':Sequelize[_0x3438('0x6')]},'path':{'type':Sequelize[_0x3438('0x2')],'comment':_0x3438('0x7')},'active':{'type':Sequelize[_0x3438('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x3438('0x9'),_0x3438('0xa'),_0x3438('0xb'),_0x3438('0xc')),'defaultValue':_0x3438('0xb'),'comment':_0x3438('0xd')},'icon':{'type':Sequelize[_0x3438('0x2')]},'adminUrl':{'type':Sequelize[_0x3438('0x2')]},'agentUrl':{'type':Sequelize[_0x3438('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x3438('0x2')]}}; \ No newline at end of file +var _0x675d=['sequelize','exports','STRING','ENUM','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x675d,0x186));var _0xd675=function(_0x34021f,_0x3f60cb){_0x34021f=_0x34021f-0x0;var _0x1d5834=_0x675d[_0x34021f];return _0x1d5834;};'use strict';var Sequelize=require(_0xd675('0x0'));module[_0xd675('0x1')]={'name':{'type':Sequelize[_0xd675('0x2')]},'type':{'type':Sequelize[_0xd675('0x3')](_0xd675('0x4'),_0xd675('0x5'))},'description':{'type':Sequelize[_0xd675('0x6')]},'version':{'type':Sequelize[_0xd675('0x6')]},'path':{'type':Sequelize[_0xd675('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xd675('0x7')],'defaultValue':0x0,'comment':_0xd675('0x8')},'sidebar':{'type':Sequelize[_0xd675('0x3')](_0xd675('0x9'),'agentOnly','always',_0xd675('0xa')),'defaultValue':_0xd675('0xb'),'comment':_0xd675('0xc')},'icon':{'type':Sequelize[_0xd675('0x2')]},'adminUrl':{'type':Sequelize[_0xd675('0x2')]},'agentUrl':{'type':Sequelize[_0xd675('0x2')]},'scriptName':{'type':Sequelize[_0xd675('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 261c9fc..d796770 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 _0x4188=['where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','include','find','catch','join','server/files/plugins','format','%s.zip','createWriteStream','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','download','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','params','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-length','content-type','endsWith','sendStatus','statusCode','webhookPost','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','extract-zip','archiver','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','Plugins','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3848b8,_0x2bb0b9){var _0x43bc25=function(_0x4db7a7){while(--_0x4db7a7){_0x3848b8['push'](_0x3848b8['shift']());}};_0x43bc25(++_0x2bb0b9);}(_0x4188,0x10f));var _0x8418=function(_0x4f1a36,_0x444767){_0x4f1a36=_0x4f1a36-0x0;var _0x11af55=_0x4188[_0x4f1a36];return _0x11af55;};'use strict';var emlformat=require(_0x8418('0x0'));var rimraf=require(_0x8418('0x1'));var zipdir=require(_0x8418('0x2'));var jsonpatch=require(_0x8418('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8418('0x4'));var Mustache=require(_0x8418('0x5'));var util=require(_0x8418('0x6'));var path=require(_0x8418('0x7'));var sox=require(_0x8418('0x8'));var csv=require('to-csv');var ejs=require(_0x8418('0x9'));var fs=require('fs');var fs_extra=require(_0x8418('0xa'));var _=require(_0x8418('0xb'));var squel=require('squel');var crypto=require(_0x8418('0xc'));var jsforce=require(_0x8418('0xd'));var deskjs=require(_0x8418('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x8418('0xf'));var rimraf=require(_0x8418('0x1'));var archiver=require(_0x8418('0x10'));var Redis=require('ioredis');var authService=require(_0x8418('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8418('0x12'));var hardwareService=require(_0x8418('0x13'));var logger=require(_0x8418('0x14'))('api');var utils=require(_0x8418('0x15'));var config=require(_0x8418('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8418('0x17'))['db'];config[_0x8418('0x18')]=_[_0x8418('0x19')](config[_0x8418('0x18')],{'host':_0x8418('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8418('0x18')]));require(_0x8418('0x1b'))[_0x8418('0x1c')](socket);function respondWithStatusCode(_0x1acfc4,_0x5ee17f){_0x5ee17f=_0x5ee17f||0xcc;return function(_0x2c3c1c){if(_0x2c3c1c){return _0x1acfc4['sendStatus'](_0x5ee17f);}return _0x1acfc4['status'](_0x5ee17f)['end']();};}function respondWithResult(_0x266016,_0x56c688){_0x56c688=_0x56c688||0xc8;return function(_0x43b5e6){if(_0x43b5e6){return _0x266016[_0x8418('0x1d')](_0x56c688)[_0x8418('0x1e')](_0x43b5e6);}};}function respondWithFilteredResult(_0x798f39,_0xecda2f){return function(_0x5c42cf){if(_0x5c42cf){var _0x2d767c=typeof _0xecda2f[_0x8418('0x1f')]===_0x8418('0x20')&&typeof _0xecda2f['limit']===_0x8418('0x20');var _0x1b471d=_0x5c42cf[_0x8418('0x21')];var _0x503001=_0x2d767c?0x0:_0xecda2f[_0x8418('0x1f')];var _0x43ed23=_0x2d767c?_0x5c42cf[_0x8418('0x21')]:_0xecda2f[_0x8418('0x1f')]+_0xecda2f[_0x8418('0x22')];var _0x534600;if(_0x43ed23>=_0x1b471d){_0x43ed23=_0x1b471d;_0x534600=0xc8;}else{_0x534600=0xce;}_0x798f39[_0x8418('0x1d')](_0x534600);return _0x798f39[_0x8418('0x23')]('Content-Range',_0x503001+'-'+_0x43ed23+'/'+_0x1b471d)[_0x8418('0x1e')](_0x5c42cf);}return null;};}function patchUpdates(_0x45c7ae){return function(_0x5c9679){try{jsonpatch[_0x8418('0x24')](_0x5c9679,_0x45c7ae,!![]);}catch(_0x43a146){return BPromise[_0x8418('0x25')](_0x43a146);}return _0x5c9679[_0x8418('0x26')]();};}function saveUpdates(_0x3224c7,_0x319b3d){return function(_0x4a9587){if(_0x4a9587){return _0x4a9587[_0x8418('0x27')](_0x3224c7)[_0x8418('0x28')](function(_0x298c4c){return _0x298c4c;});}return null;};}function removeEntity(_0x3f4c06,_0x3cdebb){return function(_0x290e24){if(_0x290e24){return _0x290e24[_0x8418('0x29')]()[_0x8418('0x28')](function(){var _0x4866af=_0x290e24['get']({'plain':!![]});var _0x3629ae=_0x8418('0x2a');return db[_0x8418('0x2b')][_0x8418('0x29')]({'where':{'type':_0x3629ae,'resourceId':_0x4866af['id']}})['then'](function(){return _0x290e24;});})[_0x8418('0x28')](function(){_0x3f4c06[_0x8418('0x1d')](0xcc)[_0x8418('0x2c')]();});}};}function handleEntityNotFound(_0x3ccca2,_0x511ec7){return function(_0x2dc9d5){if(!_0x2dc9d5){_0x3ccca2['sendStatus'](0x194);}return _0x2dc9d5;};}function handleError(_0x41fdc6,_0x3c190b){_0x3c190b=_0x3c190b||0x1f4;return function(_0xc56da){logger[_0x8418('0x2d')](_0xc56da[_0x8418('0x2e')]);if(_0xc56da[_0x8418('0x2f')]){delete _0xc56da[_0x8418('0x2f')];}_0x41fdc6[_0x8418('0x1d')](_0x3c190b)[_0x8418('0x30')](_0xc56da);};}exports[_0x8418('0x31')]=function(_0x52adc3,_0x520d99){var _0x4858c0={},_0xf42db6={},_0x2e207c={'count':0x0,'rows':[]};var _0x402b67=_[_0x8418('0x32')](db[_0x8418('0x33')][_0x8418('0x34')],function(_0x3dae70){return{'name':_0x3dae70[_0x8418('0x35')],'type':_0x3dae70[_0x8418('0x36')][_0x8418('0x37')]};});_0xf42db6[_0x8418('0x38')]=_[_0x8418('0x32')](_0x402b67,_0x8418('0x2f'));_0xf42db6['query']=_[_0x8418('0x39')](_0x52adc3[_0x8418('0x3a')]);_0xf42db6['filters']=_[_0x8418('0x3b')](_0xf42db6[_0x8418('0x38')],_0xf42db6[_0x8418('0x3a')]);_0x4858c0[_0x8418('0x3c')]=_['intersection'](_0xf42db6[_0x8418('0x38')],qs['fields'](_0x52adc3[_0x8418('0x3a')][_0x8418('0x3d')]));_0x4858c0[_0x8418('0x3c')]=_0x4858c0[_0x8418('0x3c')][_0x8418('0x3e')]?_0x4858c0[_0x8418('0x3c')]:_0xf42db6['model'];if(!_0x52adc3[_0x8418('0x3a')][_0x8418('0x3f')](_0x8418('0x40'))){_0x4858c0[_0x8418('0x22')]=qs[_0x8418('0x22')](_0x52adc3[_0x8418('0x3a')][_0x8418('0x22')]);_0x4858c0['offset']=qs['offset'](_0x52adc3[_0x8418('0x3a')][_0x8418('0x1f')]);}_0x4858c0[_0x8418('0x41')]=qs[_0x8418('0x42')](_0x52adc3[_0x8418('0x3a')][_0x8418('0x42')]);_0x4858c0[_0x8418('0x43')]=qs[_0x8418('0x44')](_[_0x8418('0x45')](_0x52adc3[_0x8418('0x3a')],_0xf42db6[_0x8418('0x44')]),_0x402b67);if(_0x52adc3['query'][_0x8418('0x46')]){_0x4858c0[_0x8418('0x43')]=_[_0x8418('0x47')](_0x4858c0[_0x8418('0x43')],{'$or':_[_0x8418('0x32')](_0x402b67,function(_0x4d9ead){if(_0x4d9ead[_0x8418('0x36')]!==_0x8418('0x48')){var _0x228953={};_0x228953[_0x4d9ead[_0x8418('0x2f')]]={'$like':'%'+_0x52adc3['query'][_0x8418('0x46')]+'%'};return _0x228953;}})});}_0x4858c0=_[_0x8418('0x47')]({},_0x4858c0,_0x52adc3[_0x8418('0x49')]);var _0x1f0689={'where':_0x4858c0[_0x8418('0x43')]};return db[_0x8418('0x33')][_0x8418('0x21')](_0x1f0689)[_0x8418('0x28')](function(_0x3f61dd){_0x2e207c[_0x8418('0x21')]=_0x3f61dd;if(_0x52adc3['query'][_0x8418('0x4a')]){_0x4858c0['include']=[{'all':!![]}];}return db[_0x8418('0x33')][_0x8418('0x4b')](_0x4858c0);})[_0x8418('0x28')](function(_0x335cae){_0x2e207c[_0x8418('0x4c')]=_0x335cae;return _0x2e207c;})[_0x8418('0x28')](respondWithFilteredResult(_0x520d99,_0x4858c0))['catch'](handleError(_0x520d99,null));};exports['show']=function(_0x5d1b67,_0x3fdea2){var _0x170d1b={'raw':!![],'where':{'id':_0x5d1b67['params']['id']}},_0x45c6ab={};_0x45c6ab['model']=_[_0x8418('0x39')](db[_0x8418('0x33')][_0x8418('0x34')]);_0x45c6ab['query']=_[_0x8418('0x39')](_0x5d1b67[_0x8418('0x3a')]);_0x45c6ab['filters']=_[_0x8418('0x3b')](_0x45c6ab['model'],_0x45c6ab[_0x8418('0x3a')]);_0x170d1b[_0x8418('0x3c')]=_[_0x8418('0x3b')](_0x45c6ab['model'],qs[_0x8418('0x3d')](_0x5d1b67[_0x8418('0x3a')]['fields']));_0x170d1b['attributes']=_0x170d1b['attributes'][_0x8418('0x3e')]?_0x170d1b[_0x8418('0x3c')]:_0x45c6ab[_0x8418('0x38')];if(_0x5d1b67[_0x8418('0x3a')][_0x8418('0x4a')]){_0x170d1b[_0x8418('0x4d')]=[{'all':!![]}];}_0x170d1b=_[_0x8418('0x47')]({},_0x170d1b,_0x5d1b67[_0x8418('0x49')]);return db[_0x8418('0x33')][_0x8418('0x4e')](_0x170d1b)['then'](handleEntityNotFound(_0x3fdea2,null))[_0x8418('0x28')](respondWithResult(_0x3fdea2,null))[_0x8418('0x4f')](handleError(_0x3fdea2,null));};exports['download']=function(_0x45b88c,_0xe17f0c,_0x2e3cec){return db[_0x8418('0x33')]['find']({'where':{'id':_0x45b88c['params']['id']},'attributes':['name',_0x8418('0x7')],'raw':!![]})[_0x8418('0x28')](handleEntityNotFound(_0xe17f0c,null))[_0x8418('0x28')](function(_0x2a2db8){if(_0x2a2db8){var _0x36f815=path[_0x8418('0x50')](config['root'],_0x8418('0x51'),util[_0x8418('0x52')](_0x8418('0x53'),path['basename'](_0x2a2db8[_0x8418('0x7')])));var _0x3844f6=fs[_0x8418('0x54')](_0x36f815);var _0xcaa83f=archiver('zip',{'zlib':{'level':0x9}});_0xcaa83f['on'](_0x8418('0x55'),function(_0x409c40){if(_0x409c40['code']===_0x8418('0x56')){logger[_0x8418('0x2d')](_0x409c40);}else{throw new db[(_0x8418('0x57'))][(_0x8418('0x58'))](_0x8418('0x59'));}});_0xcaa83f['on'](_0x8418('0x2d'),function(_0x387498){throw new db[(_0x8418('0x57'))][(_0x8418('0x58'))](_0x8418('0x59'));});_0xcaa83f[_0x8418('0x5a')](_0x3844f6);_0xcaa83f[_0x8418('0x5b')](_0x8418('0x5c'),{'cwd':path['join'](config['root'],_0x8418('0x51'),path[_0x8418('0x5d')](_0x2a2db8[_0x8418('0x7')])),'ignore':[path[_0x8418('0x50')](path[_0x8418('0x5e')](_0x2a2db8['path']),_0x8418('0x5f')),path[_0x8418('0x50')](path[_0x8418('0x5e')](_0x2a2db8[_0x8418('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x8418('0x60')]();_0x3844f6['on']('close',function(){if(!fs[_0x8418('0x61')](_0x36f815)){throw new db['Sequelize'][(_0x8418('0x58'))](_0x8418('0x62'));}return _0xe17f0c[_0x8418('0x63')](_0x36f815,util['format'](_0x8418('0x53'),path[_0x8418('0x5e')](_0x2a2db8['path'])),function(_0x2ea4a0){if(_0x2ea4a0){throw new db[(_0x8418('0x57'))][(_0x8418('0x58'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x8418('0x64')](_0x36f815);logger[_0x8418('0x65')](_0x8418('0x66'));logger[_0x8418('0x65')](_0x8418('0x67'));});});}return null;})[_0x8418('0x4f')](handleError(_0xe17f0c,null));};exports[_0x8418('0x68')]=function(_0x308285,_0x1815f9,_0x20557b){var _0x561e7e=path['basename'](_0x308285[_0x8418('0x69')]['filename'],path['extname'](_0x308285[_0x8418('0x69')][_0x8418('0x6a')]));var _0x368650=path['join'](config[_0x8418('0x6b')],_0x8418('0x51'),_0x308285[_0x8418('0x69')][_0x8418('0x6a')]);var _0x2f48e7=path['join'](config[_0x8418('0x6b')],_0x8418('0x51'),_0x561e7e);logger[_0x8418('0x65')](_0x8418('0x6c'),_0x368650);logger[_0x8418('0x65')](_0x8418('0x6d'),_0x2f48e7);try{fs[_0x8418('0x6e')](_0x368650,parseInt('0777',0x8));extract(_0x368650,{'dir':_0x2f48e7},function(_0x5bd6be){if(_0x5bd6be){logger[_0x8418('0x2d')](_0x5bd6be);handleError(_0x5bd6be,!![]);};var _0x4c2b3f=fs[_0x8418('0x6f')](_0x2f48e7);if(_0x4c2b3f['length']>0x1){removeReferences(_0x368650,_0x2f48e7);logger[_0x8418('0x2d')](_0x8418('0x70'));return _0x20557b(new Error(_0x8418('0x70')));}var _0x486c40=fs[_0x8418('0x71')](path['join'](_0x2f48e7,_0x4c2b3f[0x0]));if(_0x486c40['isFile']()){removeReferences(_0x368650,_0x2f48e7);logger[_0x8418('0x2d')](_0x8418('0x70'));return _0x20557b(new Error(_0x8418('0x70')));}if(_0x486c40[_0x8418('0x72')]()){var _0x5c5bb4=fs['readdirSync'](path[_0x8418('0x50')](_0x2f48e7,_0x4c2b3f[0x0]));if(_0x5c5bb4['length']===0x0){removeReferences(_0x368650,_0x2f48e7);logger[_0x8418('0x2d')](_0x8418('0x70'));return _0x20557b(new Error(_0x8418('0x70')));}var _0x37d230=_0x5c5bb4['some'](function(_0x196e43){return _0x196e43==='manifest.json';});if(!_0x37d230){return _0x20557b(new Error(_0x8418('0x73')));}var _0x20b6c9=fs[_0x8418('0x74')](path['join'](_0x2f48e7,_0x4c2b3f[0x0],_0x8418('0x75')));var _0x491706=JSON[_0x8418('0x76')](_0x20b6c9);if(_0x8418('0x20')==typeof _0x491706[_0x8418('0x2f')]){return _0x20557b(new Error(_0x8418('0x77')));}if(_0x8418('0x20')==typeof _0x491706[_0x8418('0x36')]){return _0x20557b(new Error(_0x8418('0x78')));}if(_0x8418('0x20')==typeof _0x491706[_0x8418('0x79')]){return _0x20557b(new Error(_0x8418('0x7a')));}if(_0x8418('0x20')==typeof _0x491706['parameters']){return _0x20557b(new Error(_0x8418('0x7b')));}if(_0x491706[_0x8418('0x36')]==='html'){if('undefined'==typeof _0x491706[_0x8418('0x7c')][_0x8418('0x7d')]){return _0x20557b(new Error(_0x8418('0x7e')));}if(_0x8418('0x20')==typeof _0x491706['parameters']['views'][_0x8418('0x7f')]&&'undefined'==typeof _0x491706[_0x8418('0x7c')]['views'][_0x8418('0x80')]){return _0x20557b(new Error(_0x8418('0x81')));}}else if(_0x491706[_0x8418('0x36')]==='script'){if(_0x8418('0x20')==typeof _0x491706[_0x8418('0x7c')][_0x8418('0x82')]){return _0x20557b(new Error(_0x8418('0x83')));}if(_0x8418('0x20')==typeof _0x491706[_0x8418('0x7c')][_0x8418('0x84')]){return _0x20557b(new Error(_0x8418('0x85')));}}else{return _0x20557b(new Error(_0x8418('0x86')));}var _0x21ddaf=_0x491706['name'];var _0x3cf5d9=_0x491706['description'];var _0x128a1b=_0x491706[_0x8418('0x36')];var _0x370e15=_0x491706[_0x8418('0x87')]?_0x491706[_0x8418('0x87')]:_0x8418('0x88');var _0x18c0ab=_0x491706[_0x8418('0x89')]?_0x491706['icon']:_0x8418('0x8a');var _0x53b198='';var _0x448d62='';var _0x1e3d2c='';var _0x466f56='';var _0x3ae94c=_0x491706[_0x8418('0x79')];if(_0x128a1b===_0x8418('0x8b')){if(_0x8418('0x20')!=typeof _0x491706[_0x8418('0x7c')]['views'][_0x8418('0x7f')]){var _0x2eb08a=_0x491706[_0x8418('0x7c')]['views'][_0x8418('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x8418('0x8c')](_0x2eb08a)){_0x53b198=path[_0x8418('0x50')](_0x8418('0x8d'),_0x561e7e,_0x4c2b3f[0x0],_0x2eb08a);}else{_0x53b198=_0x2eb08a;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x8418('0x20')!=typeof _0x491706[_0x8418('0x7c')]['views'][_0x8418('0x80')]){var _0x3840be=_0x491706[_0x8418('0x7c')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3840be)){_0x448d62=path['join'](_0x8418('0x8d'),_0x561e7e,_0x4c2b3f[0x0],_0x3840be);}else{_0x448d62=_0x3840be;}}else{logger['info'](_0x8418('0x8e'));}}else if(_0x128a1b==='script'){_0x1e3d2c=_0x491706['parameters'][_0x8418('0x82')];_0x466f56=_0x491706[_0x8418('0x7c')][_0x8418('0x84')];if('undefined'!=typeof _0x491706[_0x8418('0x7c')][_0x8418('0x7d')]){if(_0x8418('0x20')!=typeof _0x491706[_0x8418('0x7c')][_0x8418('0x7d')]['admin']){var _0x2eb08a=_0x491706[_0x8418('0x7c')][_0x8418('0x7d')][_0x8418('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2eb08a)){_0x53b198=path['join']('plugins',_0x561e7e,_0x4c2b3f[0x0],_0x2eb08a);}else{_0x53b198=_0x2eb08a;}}if(_0x8418('0x20')!=typeof _0x491706[_0x8418('0x7c')][_0x8418('0x7d')][_0x8418('0x80')]){var _0x3840be=_0x491706[_0x8418('0x7c')][_0x8418('0x7d')][_0x8418('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3840be)){_0x448d62=path[_0x8418('0x50')](_0x8418('0x8d'),_0x561e7e,_0x4c2b3f[0x0],_0x3840be);}else{_0x448d62=_0x3840be;}}}}var _0x55e8e7={'name':_0x21ddaf,'description':_0x3cf5d9,'path':path['join'](_0x561e7e,_0x4c2b3f[0x0]),'type':_0x128a1b,'sidebar':_0x370e15,'icon':_0x18c0ab,'adminUrl':_0x53b198,'agentUrl':_0x448d62,'scriptName':_0x1e3d2c,'scriptPath':_0x466f56,'version':_0x3ae94c};removeReferences(_0x368650,null);return db[_0x8418('0x33')][_0x8418('0x8f')](_0x55e8e7)['then'](function(_0x3ece93){var _0x16434a={'role':_0x308285[_0x8418('0x90')][_0x8418('0x91')],'userProfileId':_0x308285[_0x8418('0x90')][_0x8418('0x92')]};if(!_0x16434a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16434a[_0x8418('0x91')]===_0x8418('0x93')){var _0x1ab803=_0x3ece93['get']({'plain':!![]});return db[_0x8418('0x94')]['find']({'where':{'name':'Plugins','userProfileId':_0x16434a[_0x8418('0x92')]},'raw':!![]})[_0x8418('0x28')](function(_0x65a0a0){if(_0x65a0a0&&_0x65a0a0[_0x8418('0x95')]===0x0){return db[_0x8418('0x2b')][_0x8418('0x8f')]({'name':_0x1ab803['name'],'resourceId':_0x1ab803['id'],'type':_0x65a0a0[_0x8418('0x2f')],'sectionId':_0x65a0a0['id']},{})[_0x8418('0x28')](function(){return _0x3ece93;});}else{return _0x3ece93;}})['catch'](function(_0x1b2c9c){logger[_0x8418('0x2d')](_0x8418('0x96'),_0x1b2c9c);throw _0x1b2c9c;});}return _0x3ece93;})[_0x8418('0x28')](respondWithResult(_0x1815f9,null))[_0x8418('0x4f')](handleError(_0x1815f9,null));}});}catch(_0x23d55d){_0x1815f9[_0x8418('0x1d')](0x1f4)[_0x8418('0x30')](_0x23d55d);}};function removeReferences(_0x4dfbdc,_0x3965fd){try{if(_0x4dfbdc){fs[_0x8418('0x64')](_0x4dfbdc);logger[_0x8418('0x65')]('Zip\x20archive\x20removed');}if(_0x3965fd){rimraf(_0x3965fd,function(){});logger[_0x8418('0x65')](_0x8418('0x97'));}}catch(_0x139cb2){logger[_0x8418('0x2d')](_0x139cb2);}}exports[_0x8418('0x27')]=function(_0x185cac,_0x151272,_0x1ec696){return db[_0x8418('0x33')][_0x8418('0x4e')]({'where':{'id':_0x185cac[_0x8418('0x98')]['id']}})[_0x8418('0x28')](handleEntityNotFound(_0x151272,null))['then'](saveUpdates(_0x185cac['body'],null))['then'](respondWithResult(_0x151272,null))[_0x8418('0x4f')](handleError(_0x151272,null));};exports['delete']=function(_0x973446,_0x1d1467,_0x452c48){return db[_0x8418('0x33')][_0x8418('0x4e')]({'where':{'id':_0x973446['params']['id']}})[_0x8418('0x28')](function(_0x1c177b){if(_0x1c177b){return _0x1c177b[_0x8418('0x29')]();}})[_0x8418('0x28')](function(_0x3105e2){rimraf(path[_0x8418('0x50')](config[_0x8418('0x6b')],_0x8418('0x51'),path[_0x8418('0x5d')](_0x3105e2[_0x8418('0x7')])),function(){});return _0x3105e2;})['then'](handleEntityNotFound(_0x1d1467,null))[_0x8418('0x28')](respondWithStatusCode(_0x1d1467,null))[_0x8418('0x4f')](handleError(_0x1d1467,null));};exports[_0x8418('0x99')]=function(_0x3e59d7,_0x2cb48e,_0x558143){return BPromise[_0x8418('0x9a')]()[_0x8418('0x28')](function(){if(!_0x3e59d7[_0x8418('0x3a')][_0x8418('0x7')]){throw new Error(_0x8418('0x9b'));}if(!_0x3e59d7[_0x8418('0x3a')][_0x8418('0x9c')]){throw new Error(_0x8418('0x9d'));}var _0x4586bf=_0x3e59d7[_0x8418('0x3a')][_0x8418('0x9e')]?_0x3e59d7[_0x8418('0x3a')]['hostname']+':'+_0x3e59d7['query'][_0x8418('0x9c')]:'http://localhost:'+_0x3e59d7[_0x8418('0x3a')][_0x8418('0x9c')];var _0xb2f80d=_0x3e59d7[_0x8418('0x3a')][_0x8418('0x1e')]?_0x3e59d7[_0x8418('0x3a')][_0x8418('0x1e')]:!![];var _0x23bdf9=_0x3e59d7['query'][_0x8418('0x9f')]?_0x3e59d7[_0x8418('0x3a')][_0x8418('0x9f')]:null;var _0x46fcf2={'method':_0x3e59d7[_0x8418('0xa0')],'uri':util[_0x8418('0x52')]('%s%s',_0x4586bf,_0x3e59d7[_0x8418('0x3a')][_0x8418('0x7')]),'json':_0xb2f80d,'resolveWithFullResponse':!![],'encoding':_0x23bdf9,'qs':_0x3e59d7[_0x8418('0x3a')]};if(_0x3e59d7[_0x8418('0xa1')]){_0x46fcf2[_0x8418('0xa1')]=_0x3e59d7[_0x8418('0xa1')];if(_0x46fcf2[_0x8418('0xa1')][_0x8418('0xa2')]){delete _0x46fcf2[_0x8418('0xa1')]['content-length'];}}if(_0x46fcf2[_0x8418('0xa1')]['content-type']){delete _0x46fcf2[_0x8418('0xa1')][_0x8418('0xa3')];}return rp(_0x46fcf2);})['then'](function(_0x19ab44){if(_0x19ab44){_0x2cb48e['set'](_0x19ab44[_0x8418('0xa1')]);logger[_0x8418('0x65')](_0x19ab44[_0x8418('0x90')]);if(_[_0x8418('0xa4')](_0x3e59d7[_0x8418('0x3a')][_0x8418('0x7')],_0x8418('0x63'))&&_0x19ab44['statusCode']==0x1f4){return _0x2cb48e[_0x8418('0xa5')](_0x19ab44[_0x8418('0xa6')]);}else{return _0x2cb48e[_0x8418('0x1d')](_0x19ab44['statusCode'])[_0x8418('0x30')](_0x19ab44[_0x8418('0x90')]);}}else{return _0x2cb48e[_0x8418('0xa5')](0xc8);}})['catch'](handleError(_0x2cb48e,null));};exports[_0x8418('0xa7')]=function(_0x464f5b,_0xd0d997,_0x3cba67){return BPromise[_0x8418('0x9a')]()[_0x8418('0x28')](function(){if(!_0x464f5b[_0x8418('0x3a')][_0x8418('0x7')]){throw new Error(_0x8418('0x9b'));}if(!_0x464f5b[_0x8418('0x3a')][_0x8418('0x9c')]){throw new Error(_0x8418('0x9d'));}var _0x5579e7=_0x464f5b[_0x8418('0x3a')][_0x8418('0x9e')]?_0x464f5b[_0x8418('0x3a')][_0x8418('0x9e')]+':'+_0x464f5b[_0x8418('0x3a')][_0x8418('0x9c')]:'http://localhost:'+_0x464f5b[_0x8418('0x3a')][_0x8418('0x9c')];var _0x349722=_0x464f5b[_0x8418('0x3a')]['json']?_0x464f5b['query'][_0x8418('0x1e')]:!![];var _0x138f1=_0x464f5b[_0x8418('0x3a')][_0x8418('0x9f')]?_0x464f5b[_0x8418('0x3a')][_0x8418('0x9f')]:null;var _0x1ed09c={'method':_0x464f5b['method'],'uri':util[_0x8418('0x52')](_0x8418('0xa8'),_0x5579e7,_0x464f5b['query']['path']),'json':_0x349722,'resolveWithFullResponse':!![],'encoding':_0x138f1,'body':_0x464f5b[_0x8418('0x90')]};if(_0x464f5b[_0x8418('0xa1')]){_0x1ed09c[_0x8418('0xa1')]=_0x464f5b[_0x8418('0xa1')];if(_0x1ed09c[_0x8418('0xa1')][_0x8418('0xa2')]){delete _0x1ed09c[_0x8418('0xa1')][_0x8418('0xa2')];}}if(_0x1ed09c[_0x8418('0xa1')]['content-type']){delete _0x1ed09c['headers'][_0x8418('0xa3')];}return rp(_0x1ed09c);})[_0x8418('0x28')](function(_0x56b7bb){if(_0x56b7bb){_0xd0d997['set'](_0x56b7bb[_0x8418('0xa1')]);logger[_0x8418('0x65')](_0x56b7bb['body']);return _0xd0d997['status'](_0x56b7bb[_0x8418('0xa6')])[_0x8418('0x30')](_0x56b7bb['body']);}else{return _0xd0d997['sendStatus'](0xc8);}})[_0x8418('0x4f')](handleError(_0xd0d997,null));}; \ No newline at end of file +var _0xe545=['lodash','crypto','jsforce','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','Plugins','destroy','status','error','stack','name','index','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','params','length','include','find','download','path','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','**/*','join','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','admin','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra'];(function(_0x42fa80,_0x322f71){var _0x596501=function(_0x109717){while(--_0x109717){_0x42fa80['push'](_0x42fa80['shift']());}};_0x596501(++_0x322f71);}(_0xe545,0x9e));var _0x5e54=function(_0x13b267,_0x2b4d59){_0x13b267=_0x13b267-0x0;var _0x550283=_0xe545[_0x13b267];return _0x550283;};'use strict';var emlformat=require(_0x5e54('0x0'));var rimraf=require(_0x5e54('0x1'));var zipdir=require(_0x5e54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e54('0x3'));var moment=require(_0x5e54('0x4'));var BPromise=require(_0x5e54('0x5'));var Mustache=require(_0x5e54('0x6'));var util=require(_0x5e54('0x7'));var path=require('path');var sox=require(_0x5e54('0x8'));var csv=require(_0x5e54('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e54('0xa'));var _=require(_0x5e54('0xb'));var squel=require('squel');var crypto=require(_0x5e54('0xc'));var jsforce=require(_0x5e54('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e54('0xe'));var extract=require(_0x5e54('0xf'));var rimraf=require(_0x5e54('0x1'));var archiver=require(_0x5e54('0x10'));var Redis=require(_0x5e54('0x11'));var authService=require(_0x5e54('0x12'));var qs=require(_0x5e54('0x13'));var as=require(_0x5e54('0x14'));var hardwareService=require(_0x5e54('0x15'));var logger=require('../../config/logger')(_0x5e54('0x16'));var utils=require('../../config/utils');var config=require(_0x5e54('0x17'));var licenseUtil=require(_0x5e54('0x18'));var db=require(_0x5e54('0x19'))['db'];config[_0x5e54('0x1a')]=_[_0x5e54('0x1b')](config[_0x5e54('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e54('0x1c'))(new Redis(config['redis']));require(_0x5e54('0x1d'))['register'](socket);function respondWithStatusCode(_0x52b6e9,_0x545e59){_0x545e59=_0x545e59||0xcc;return function(_0x255d30){if(_0x255d30){return _0x52b6e9[_0x5e54('0x1e')](_0x545e59);}return _0x52b6e9['status'](_0x545e59)[_0x5e54('0x1f')]();};}function respondWithResult(_0x33e050,_0x7f5b1d){_0x7f5b1d=_0x7f5b1d||0xc8;return function(_0x18fc23){if(_0x18fc23){return _0x33e050['status'](_0x7f5b1d)[_0x5e54('0x20')](_0x18fc23);}};}function respondWithFilteredResult(_0x103f30,_0x1dd08d){return function(_0x3a189c){if(_0x3a189c){var _0x369328=typeof _0x1dd08d[_0x5e54('0x21')]===_0x5e54('0x22')&&typeof _0x1dd08d['limit']===_0x5e54('0x22');var _0x50c549=_0x3a189c[_0x5e54('0x23')];var _0x29b016=_0x369328?0x0:_0x1dd08d[_0x5e54('0x21')];var _0x5bb9ea=_0x369328?_0x3a189c[_0x5e54('0x23')]:_0x1dd08d[_0x5e54('0x21')]+_0x1dd08d[_0x5e54('0x24')];var _0x4a718f;if(_0x5bb9ea>=_0x50c549){_0x5bb9ea=_0x50c549;_0x4a718f=0xc8;}else{_0x4a718f=0xce;}_0x103f30['status'](_0x4a718f);return _0x103f30[_0x5e54('0x25')](_0x5e54('0x26'),_0x29b016+'-'+_0x5bb9ea+'/'+_0x50c549)[_0x5e54('0x20')](_0x3a189c);}return null;};}function patchUpdates(_0x241ed2){return function(_0x40708f){try{jsonpatch[_0x5e54('0x27')](_0x40708f,_0x241ed2,!![]);}catch(_0x3a158f){return BPromise[_0x5e54('0x28')](_0x3a158f);}return _0x40708f[_0x5e54('0x29')]();};}function saveUpdates(_0x4a97aa,_0x4f52d4){return function(_0x542508){if(_0x542508){return _0x542508[_0x5e54('0x2a')](_0x4a97aa)['then'](function(_0x2d0d14){return _0x2d0d14;});}return null;};}function removeEntity(_0x515bdd,_0x17515d){return function(_0x5ca7cd){if(_0x5ca7cd){return _0x5ca7cd['destroy']()[_0x5e54('0x2b')](function(){var _0xa93459=_0x5ca7cd[_0x5e54('0x2c')]({'plain':!![]});var _0x4fffc3=_0x5e54('0x2d');return db['UserProfileResource'][_0x5e54('0x2e')]({'where':{'type':_0x4fffc3,'resourceId':_0xa93459['id']}})[_0x5e54('0x2b')](function(){return _0x5ca7cd;});})[_0x5e54('0x2b')](function(){_0x515bdd[_0x5e54('0x2f')](0xcc)[_0x5e54('0x1f')]();});}};}function handleEntityNotFound(_0x2be0ad,_0x49e67b){return function(_0xf161f1){if(!_0xf161f1){_0x2be0ad[_0x5e54('0x1e')](0x194);}return _0xf161f1;};}function handleError(_0x162ed6,_0x3457f5){_0x3457f5=_0x3457f5||0x1f4;return function(_0x20a400){logger[_0x5e54('0x30')](_0x20a400[_0x5e54('0x31')]);if(_0x20a400['name']){delete _0x20a400[_0x5e54('0x32')];}_0x162ed6['status'](_0x3457f5)['send'](_0x20a400);};}exports[_0x5e54('0x33')]=function(_0x4d7400,_0x5da8b6){var _0x239eb7={},_0x93587a={},_0x544062={'count':0x0,'rows':[]};var _0x4c0e08=_[_0x5e54('0x34')](db[_0x5e54('0x35')][_0x5e54('0x36')],function(_0x4429e4){return{'name':_0x4429e4[_0x5e54('0x37')],'type':_0x4429e4['type'][_0x5e54('0x38')]};});_0x93587a[_0x5e54('0x39')]=_[_0x5e54('0x34')](_0x4c0e08,'name');_0x93587a[_0x5e54('0x3a')]=_[_0x5e54('0x3b')](_0x4d7400['query']);_0x93587a[_0x5e54('0x3c')]=_[_0x5e54('0x3d')](_0x93587a[_0x5e54('0x39')],_0x93587a[_0x5e54('0x3a')]);_0x239eb7[_0x5e54('0x3e')]=_[_0x5e54('0x3d')](_0x93587a['model'],qs['fields'](_0x4d7400['query'][_0x5e54('0x3f')]));_0x239eb7[_0x5e54('0x3e')]=_0x239eb7['attributes']['length']?_0x239eb7[_0x5e54('0x3e')]:_0x93587a[_0x5e54('0x39')];if(!_0x4d7400[_0x5e54('0x3a')][_0x5e54('0x40')](_0x5e54('0x41'))){_0x239eb7[_0x5e54('0x24')]=qs['limit'](_0x4d7400[_0x5e54('0x3a')][_0x5e54('0x24')]);_0x239eb7[_0x5e54('0x21')]=qs[_0x5e54('0x21')](_0x4d7400[_0x5e54('0x3a')][_0x5e54('0x21')]);}_0x239eb7['order']=qs[_0x5e54('0x42')](_0x4d7400['query'][_0x5e54('0x42')]);_0x239eb7[_0x5e54('0x43')]=qs[_0x5e54('0x3c')](_[_0x5e54('0x44')](_0x4d7400[_0x5e54('0x3a')],_0x93587a[_0x5e54('0x3c')]),_0x4c0e08);if(_0x4d7400[_0x5e54('0x3a')]['filter']){_0x239eb7['where']=_[_0x5e54('0x45')](_0x239eb7[_0x5e54('0x43')],{'$or':_[_0x5e54('0x34')](_0x4c0e08,function(_0x478a4c){if(_0x478a4c[_0x5e54('0x46')]!==_0x5e54('0x47')){var _0xffa8fa={};_0xffa8fa[_0x478a4c[_0x5e54('0x32')]]={'$like':'%'+_0x4d7400['query'][_0x5e54('0x48')]+'%'};return _0xffa8fa;}})});}_0x239eb7=_['merge']({},_0x239eb7,_0x4d7400[_0x5e54('0x49')]);var _0x490de6={'where':_0x239eb7[_0x5e54('0x43')]};return db[_0x5e54('0x35')][_0x5e54('0x23')](_0x490de6)[_0x5e54('0x2b')](function(_0xb5362a){_0x544062[_0x5e54('0x23')]=_0xb5362a;if(_0x4d7400[_0x5e54('0x3a')]['includeAll']){_0x239eb7['include']=[{'all':!![]}];}return db['Plugin'][_0x5e54('0x4a')](_0x239eb7);})[_0x5e54('0x2b')](function(_0x19ee8b){_0x544062[_0x5e54('0x4b')]=_0x19ee8b;return _0x544062;})[_0x5e54('0x2b')](respondWithFilteredResult(_0x5da8b6,_0x239eb7))[_0x5e54('0x4c')](handleError(_0x5da8b6,null));};exports[_0x5e54('0x4d')]=function(_0x34f690,_0x39edc1){var _0x55e120={'raw':!![],'where':{'id':_0x34f690[_0x5e54('0x4e')]['id']}},_0x1fab61={};_0x1fab61[_0x5e54('0x39')]=_[_0x5e54('0x3b')](db['Plugin']['rawAttributes']);_0x1fab61['query']=_[_0x5e54('0x3b')](_0x34f690[_0x5e54('0x3a')]);_0x1fab61[_0x5e54('0x3c')]=_[_0x5e54('0x3d')](_0x1fab61[_0x5e54('0x39')],_0x1fab61[_0x5e54('0x3a')]);_0x55e120[_0x5e54('0x3e')]=_[_0x5e54('0x3d')](_0x1fab61[_0x5e54('0x39')],qs[_0x5e54('0x3f')](_0x34f690['query'][_0x5e54('0x3f')]));_0x55e120['attributes']=_0x55e120[_0x5e54('0x3e')][_0x5e54('0x4f')]?_0x55e120['attributes']:_0x1fab61[_0x5e54('0x39')];if(_0x34f690[_0x5e54('0x3a')]['includeAll']){_0x55e120[_0x5e54('0x50')]=[{'all':!![]}];}_0x55e120=_[_0x5e54('0x45')]({},_0x55e120,_0x34f690[_0x5e54('0x49')]);return db[_0x5e54('0x35')][_0x5e54('0x51')](_0x55e120)[_0x5e54('0x2b')](handleEntityNotFound(_0x39edc1,null))['then'](respondWithResult(_0x39edc1,null))[_0x5e54('0x4c')](handleError(_0x39edc1,null));};exports[_0x5e54('0x52')]=function(_0x5379de,_0x32f1d5,_0x5f34d6){return db[_0x5e54('0x35')][_0x5e54('0x51')]({'where':{'id':_0x5379de[_0x5e54('0x4e')]['id']},'attributes':[_0x5e54('0x32'),_0x5e54('0x53')],'raw':!![]})[_0x5e54('0x2b')](handleEntityNotFound(_0x32f1d5,null))[_0x5e54('0x2b')](function(_0x117cac){if(_0x117cac){var _0xe3f4c=path['join'](config[_0x5e54('0x54')],_0x5e54('0x55'),util[_0x5e54('0x56')](_0x5e54('0x57'),path[_0x5e54('0x58')](_0x117cac[_0x5e54('0x53')])));var _0x439837=fs[_0x5e54('0x59')](_0xe3f4c);var _0x15e459=archiver(_0x5e54('0x5a'),{'zlib':{'level':0x9}});_0x15e459['on'](_0x5e54('0x5b'),function(_0x2bd121){if(_0x2bd121['code']===_0x5e54('0x5c')){logger[_0x5e54('0x30')](_0x2bd121);}else{throw new db[(_0x5e54('0x5d'))]['Error'](_0x5e54('0x5e'));}});_0x15e459['on'](_0x5e54('0x30'),function(_0x1bbb74){throw new db[(_0x5e54('0x5d'))][(_0x5e54('0x5f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x15e459[_0x5e54('0x60')](_0x439837);_0x15e459['glob'](_0x5e54('0x61'),{'cwd':path[_0x5e54('0x62')](config[_0x5e54('0x54')],'server/files/plugins',path['dirname'](_0x117cac[_0x5e54('0x53')])),'ignore':[path['join'](path['basename'](_0x117cac[_0x5e54('0x53')]),'node_modules/**/*'),path[_0x5e54('0x62')](path['basename'](_0x117cac[_0x5e54('0x53')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x439837['on']('close',function(){if(!fs[_0x5e54('0x63')](_0xe3f4c)){throw new db[(_0x5e54('0x5d'))][(_0x5e54('0x5f'))](_0x5e54('0x64'));}return _0x32f1d5[_0x5e54('0x52')](_0xe3f4c,util[_0x5e54('0x56')](_0x5e54('0x57'),path[_0x5e54('0x58')](_0x117cac['path'])),function(_0x134832){if(_0x134832){throw new db['Sequelize']['Error'](_0x5e54('0x65'));}fs[_0x5e54('0x66')](_0xe3f4c);logger[_0x5e54('0x67')](_0x5e54('0x68'));logger[_0x5e54('0x67')](_0x5e54('0x69'));});});}return null;})[_0x5e54('0x4c')](handleError(_0x32f1d5,null));};exports[_0x5e54('0x6a')]=function(_0x2fad83,_0x180243,_0x3722d1){var _0x4e5d83=path['basename'](_0x2fad83[_0x5e54('0x6b')][_0x5e54('0x6c')],path[_0x5e54('0x6d')](_0x2fad83[_0x5e54('0x6b')][_0x5e54('0x6c')]));var _0x2d3543=path[_0x5e54('0x62')](config[_0x5e54('0x54')],_0x5e54('0x55'),_0x2fad83[_0x5e54('0x6b')][_0x5e54('0x6c')]);var _0x4f8ec4=path[_0x5e54('0x62')](config[_0x5e54('0x54')],'server/files/plugins',_0x4e5d83);logger[_0x5e54('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x2d3543);logger['info'](_0x5e54('0x6e'),_0x4f8ec4);try{fs[_0x5e54('0x6f')](_0x2d3543,parseInt('0777',0x8));extract(_0x2d3543,{'dir':_0x4f8ec4},function(_0x1b44c3){if(_0x1b44c3){logger['error'](_0x1b44c3);handleError(_0x1b44c3,!![]);};var _0x2f2420=fs[_0x5e54('0x70')](_0x4f8ec4);if(_0x2f2420[_0x5e54('0x4f')]>0x1){removeReferences(_0x2d3543,_0x4f8ec4);logger[_0x5e54('0x30')](_0x5e54('0x71'));return _0x3722d1(new Error(_0x5e54('0x71')));}var _0x3d666b=fs[_0x5e54('0x72')](path[_0x5e54('0x62')](_0x4f8ec4,_0x2f2420[0x0]));if(_0x3d666b['isFile']()){removeReferences(_0x2d3543,_0x4f8ec4);logger['error']('Invalid\x20plugin\x20structure');return _0x3722d1(new Error(_0x5e54('0x71')));}if(_0x3d666b[_0x5e54('0x73')]()){var _0xab35bd=fs[_0x5e54('0x70')](path[_0x5e54('0x62')](_0x4f8ec4,_0x2f2420[0x0]));if(_0xab35bd[_0x5e54('0x4f')]===0x0){removeReferences(_0x2d3543,_0x4f8ec4);logger[_0x5e54('0x30')](_0x5e54('0x71'));return _0x3722d1(new Error(_0x5e54('0x71')));}var _0x909cda=_0xab35bd[_0x5e54('0x74')](function(_0x190497){return _0x190497===_0x5e54('0x75');});if(!_0x909cda){return _0x3722d1(new Error(_0x5e54('0x76')));}var _0x4ee0ae=fs[_0x5e54('0x77')](path[_0x5e54('0x62')](_0x4f8ec4,_0x2f2420[0x0],'manifest.json'));var _0x4ef7be=JSON['parse'](_0x4ee0ae);if(_0x5e54('0x22')==typeof _0x4ef7be[_0x5e54('0x32')]){return _0x3722d1(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x5e54('0x22')==typeof _0x4ef7be[_0x5e54('0x46')]){return _0x3722d1(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x4ef7be[_0x5e54('0x78')]){return _0x3722d1(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x5e54('0x22')==typeof _0x4ef7be[_0x5e54('0x79')]){return _0x3722d1(new Error(_0x5e54('0x7a')));}if(_0x4ef7be[_0x5e54('0x46')]===_0x5e54('0x7b')){if('undefined'==typeof _0x4ef7be[_0x5e54('0x79')]['views']){return _0x3722d1(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x5e54('0x22')==typeof _0x4ef7be[_0x5e54('0x79')]['views'][_0x5e54('0x7c')]&&'undefined'==typeof _0x4ef7be['parameters'][_0x5e54('0x7d')][_0x5e54('0x7e')]){return _0x3722d1(new Error(_0x5e54('0x7f')));}}else if(_0x4ef7be[_0x5e54('0x46')]==='script'){if(_0x5e54('0x22')==typeof _0x4ef7be['parameters'][_0x5e54('0x80')]){return _0x3722d1(new Error(_0x5e54('0x81')));}if('undefined'==typeof _0x4ef7be[_0x5e54('0x79')][_0x5e54('0x82')]){return _0x3722d1(new Error(_0x5e54('0x83')));}}else{return _0x3722d1(new Error(_0x5e54('0x84')));}var _0xadb2e7=_0x4ef7be['name'];var _0x49df51=_0x4ef7be['description'];var _0x1e2fc7=_0x4ef7be['type'];var _0x1d5c03=_0x4ef7be[_0x5e54('0x85')]?_0x4ef7be[_0x5e54('0x85')]:_0x5e54('0x86');var _0x2e1565=_0x4ef7be[_0x5e54('0x87')]?_0x4ef7be['icon']:'icon-apps';var _0x68c871='';var _0x14745c='';var _0x49c739='';var _0x393c4e='';var _0x38eb36=_0x4ef7be[_0x5e54('0x78')];if(_0x1e2fc7==='html'){if(_0x5e54('0x22')!=typeof _0x4ef7be['parameters'][_0x5e54('0x7d')][_0x5e54('0x7c')]){var _0x122fc2=_0x4ef7be[_0x5e54('0x79')]['views'][_0x5e54('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x5e54('0x88')](_0x122fc2)){_0x68c871=path['join']('plugins',_0x4e5d83,_0x2f2420[0x0],_0x122fc2);}else{_0x68c871=_0x122fc2;}}else{logger[_0x5e54('0x67')](_0x5e54('0x89'));}if(_0x5e54('0x22')!=typeof _0x4ef7be[_0x5e54('0x79')][_0x5e54('0x7d')]['agent']){var _0x96aa9=_0x4ef7be[_0x5e54('0x79')][_0x5e54('0x7d')][_0x5e54('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x5e54('0x88')](_0x96aa9)){_0x14745c=path['join'](_0x5e54('0x8a'),_0x4e5d83,_0x2f2420[0x0],_0x96aa9);}else{_0x14745c=_0x96aa9;}}else{logger['info'](_0x5e54('0x8b'));}}else if(_0x1e2fc7===_0x5e54('0x8c')){_0x49c739=_0x4ef7be[_0x5e54('0x79')][_0x5e54('0x80')];_0x393c4e=_0x4ef7be[_0x5e54('0x79')][_0x5e54('0x82')];if(_0x5e54('0x22')!=typeof _0x4ef7be[_0x5e54('0x79')][_0x5e54('0x7d')]){if('undefined'!=typeof _0x4ef7be['parameters'][_0x5e54('0x7d')][_0x5e54('0x7c')]){var _0x122fc2=_0x4ef7be[_0x5e54('0x79')][_0x5e54('0x7d')][_0x5e54('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x5e54('0x88')](_0x122fc2)){_0x68c871=path[_0x5e54('0x62')](_0x5e54('0x8a'),_0x4e5d83,_0x2f2420[0x0],_0x122fc2);}else{_0x68c871=_0x122fc2;}}if(_0x5e54('0x22')!=typeof _0x4ef7be[_0x5e54('0x79')]['views'][_0x5e54('0x7e')]){var _0x96aa9=_0x4ef7be['parameters'][_0x5e54('0x7d')][_0x5e54('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x5e54('0x88')](_0x96aa9)){_0x14745c=path['join']('plugins',_0x4e5d83,_0x2f2420[0x0],_0x96aa9);}else{_0x14745c=_0x96aa9;}}}}var _0xa1a1cf={'name':_0xadb2e7,'description':_0x49df51,'path':path[_0x5e54('0x62')](_0x4e5d83,_0x2f2420[0x0]),'type':_0x1e2fc7,'sidebar':_0x1d5c03,'icon':_0x2e1565,'adminUrl':_0x68c871,'agentUrl':_0x14745c,'scriptName':_0x49c739,'scriptPath':_0x393c4e,'version':_0x38eb36};removeReferences(_0x2d3543,null);return db[_0x5e54('0x35')][_0x5e54('0x8d')](_0xa1a1cf)[_0x5e54('0x2b')](function(_0x21314c){var _0x2ee3c5={'role':_0x2fad83['body'][_0x5e54('0x8e')],'userProfileId':_0x2fad83[_0x5e54('0x8f')][_0x5e54('0x90')]};if(!_0x2ee3c5)throw new Error(_0x5e54('0x91'));if(_0x2ee3c5[_0x5e54('0x8e')]===_0x5e54('0x92')){var _0x145aaf=_0x21314c[_0x5e54('0x2c')]({'plain':!![]});return db[_0x5e54('0x93')][_0x5e54('0x51')]({'where':{'name':'Plugins','userProfileId':_0x2ee3c5[_0x5e54('0x90')]},'raw':!![]})[_0x5e54('0x2b')](function(_0x482ba4){if(_0x482ba4&&_0x482ba4[_0x5e54('0x94')]===0x0){return db['UserProfileResource'][_0x5e54('0x8d')]({'name':_0x145aaf[_0x5e54('0x32')],'resourceId':_0x145aaf['id'],'type':_0x482ba4['name'],'sectionId':_0x482ba4['id']},{})[_0x5e54('0x2b')](function(){return _0x21314c;});}else{return _0x21314c;}})[_0x5e54('0x4c')](function(_0x3e0a04){logger[_0x5e54('0x30')](_0x5e54('0x95'),_0x3e0a04);throw _0x3e0a04;});}return _0x21314c;})[_0x5e54('0x2b')](respondWithResult(_0x180243,null))[_0x5e54('0x4c')](handleError(_0x180243,null));}});}catch(_0x35eba7){_0x180243[_0x5e54('0x2f')](0x1f4)[_0x5e54('0x96')](_0x35eba7);}};function removeReferences(_0x89eb3,_0x99bdd2){try{if(_0x89eb3){fs[_0x5e54('0x66')](_0x89eb3);logger[_0x5e54('0x67')](_0x5e54('0x97'));}if(_0x99bdd2){rimraf(_0x99bdd2,function(){});logger[_0x5e54('0x67')](_0x5e54('0x98'));}}catch(_0x1532a3){logger[_0x5e54('0x30')](_0x1532a3);}}exports[_0x5e54('0x2a')]=function(_0x19010a,_0x2320b1,_0x34845d){return db[_0x5e54('0x35')][_0x5e54('0x51')]({'where':{'id':_0x19010a['params']['id']}})[_0x5e54('0x2b')](handleEntityNotFound(_0x2320b1,null))[_0x5e54('0x2b')](saveUpdates(_0x19010a[_0x5e54('0x8f')],null))[_0x5e54('0x2b')](respondWithResult(_0x2320b1,null))[_0x5e54('0x4c')](handleError(_0x2320b1,null));};exports[_0x5e54('0x99')]=function(_0x5b0a74,_0x26254c,_0x5383a0){return db[_0x5e54('0x35')]['find']({'where':{'id':_0x5b0a74[_0x5e54('0x4e')]['id']}})['then'](function(_0x575ace){if(_0x575ace){return _0x575ace[_0x5e54('0x2e')]();}})['then'](function(_0x250ae4){rimraf(path[_0x5e54('0x62')](config['root'],_0x5e54('0x55'),path['dirname'](_0x250ae4[_0x5e54('0x53')])),function(){});return _0x250ae4;})['then'](handleEntityNotFound(_0x26254c,null))[_0x5e54('0x2b')](respondWithStatusCode(_0x26254c,null))[_0x5e54('0x4c')](handleError(_0x26254c,null));};exports['webhookGet']=function(_0x35f3f7,_0x12ef8c,_0xfc26f6){return BPromise[_0x5e54('0x9a')]()[_0x5e54('0x2b')](function(){if(!_0x35f3f7[_0x5e54('0x3a')][_0x5e54('0x53')]){throw new Error(_0x5e54('0x9b'));}if(!_0x35f3f7[_0x5e54('0x3a')][_0x5e54('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3f5583=_0x35f3f7[_0x5e54('0x3a')][_0x5e54('0x9d')]?_0x35f3f7['query'][_0x5e54('0x9d')]+':'+_0x35f3f7['query'][_0x5e54('0x9c')]:_0x5e54('0x9e')+_0x35f3f7[_0x5e54('0x3a')]['port'];var _0x10b4fe=_0x35f3f7[_0x5e54('0x3a')][_0x5e54('0x20')]?_0x35f3f7['query'][_0x5e54('0x20')]:!![];var _0x5b5a7d=_0x35f3f7['query'][_0x5e54('0x9f')]?_0x35f3f7[_0x5e54('0x3a')][_0x5e54('0x9f')]:null;var _0xa05fc7={'method':_0x35f3f7[_0x5e54('0xa0')],'uri':util[_0x5e54('0x56')](_0x5e54('0xa1'),_0x3f5583,_0x35f3f7[_0x5e54('0x3a')][_0x5e54('0x53')]),'json':_0x10b4fe,'resolveWithFullResponse':!![],'encoding':_0x5b5a7d,'qs':_0x35f3f7[_0x5e54('0x3a')]};if(_0x35f3f7['headers']){_0xa05fc7[_0x5e54('0xa2')]=_0x35f3f7[_0x5e54('0xa2')];if(_0xa05fc7[_0x5e54('0xa2')][_0x5e54('0xa3')]){delete _0xa05fc7[_0x5e54('0xa2')][_0x5e54('0xa3')];}}if(_0xa05fc7['headers'][_0x5e54('0xa4')]){delete _0xa05fc7[_0x5e54('0xa2')][_0x5e54('0xa4')];}return rp(_0xa05fc7);})[_0x5e54('0x2b')](function(_0x587bac){if(_0x587bac){_0x12ef8c[_0x5e54('0x25')](_0x587bac[_0x5e54('0xa2')]);logger[_0x5e54('0x67')](_0x587bac[_0x5e54('0x8f')]);if(_[_0x5e54('0xa5')](_0x35f3f7[_0x5e54('0x3a')][_0x5e54('0x53')],_0x5e54('0x52'))&&_0x587bac[_0x5e54('0xa6')]==0x1f4){return _0x12ef8c[_0x5e54('0x1e')](_0x587bac['statusCode']);}else{return _0x12ef8c[_0x5e54('0x2f')](_0x587bac['statusCode'])[_0x5e54('0x96')](_0x587bac[_0x5e54('0x8f')]);}}else{return _0x12ef8c[_0x5e54('0x1e')](0xc8);}})['catch'](handleError(_0x12ef8c,null));};exports[_0x5e54('0xa7')]=function(_0x3b3af5,_0x4c815a,_0x9ed128){return BPromise[_0x5e54('0x9a')]()['then'](function(){if(!_0x3b3af5[_0x5e54('0x3a')][_0x5e54('0x53')]){throw new Error(_0x5e54('0x9b'));}if(!_0x3b3af5[_0x5e54('0x3a')][_0x5e54('0x9c')]){throw new Error(_0x5e54('0xa8'));}var _0x40cf8e=_0x3b3af5[_0x5e54('0x3a')][_0x5e54('0x9d')]?_0x3b3af5[_0x5e54('0x3a')][_0x5e54('0x9d')]+':'+_0x3b3af5['query'][_0x5e54('0x9c')]:_0x5e54('0x9e')+_0x3b3af5[_0x5e54('0x3a')][_0x5e54('0x9c')];var _0x596631=_0x3b3af5[_0x5e54('0x3a')][_0x5e54('0x20')]?_0x3b3af5[_0x5e54('0x3a')][_0x5e54('0x20')]:!![];var _0x5dd6bc=_0x3b3af5[_0x5e54('0x3a')][_0x5e54('0x9f')]?_0x3b3af5[_0x5e54('0x3a')][_0x5e54('0x9f')]:null;var _0x6efa59={'method':_0x3b3af5['method'],'uri':util[_0x5e54('0x56')](_0x5e54('0xa1'),_0x40cf8e,_0x3b3af5[_0x5e54('0x3a')][_0x5e54('0x53')]),'json':_0x596631,'resolveWithFullResponse':!![],'encoding':_0x5dd6bc,'body':_0x3b3af5['body']};if(_0x3b3af5[_0x5e54('0xa2')]){_0x6efa59[_0x5e54('0xa2')]=_0x3b3af5[_0x5e54('0xa2')];if(_0x6efa59[_0x5e54('0xa2')][_0x5e54('0xa3')]){delete _0x6efa59[_0x5e54('0xa2')][_0x5e54('0xa3')];}}if(_0x6efa59[_0x5e54('0xa2')][_0x5e54('0xa4')]){delete _0x6efa59[_0x5e54('0xa2')][_0x5e54('0xa4')];}return rp(_0x6efa59);})[_0x5e54('0x2b')](function(_0x4033b8){if(_0x4033b8){_0x4c815a['set'](_0x4033b8['headers']);logger[_0x5e54('0x67')](_0x4033b8[_0x5e54('0x8f')]);return _0x4c815a['status'](_0x4033b8[_0x5e54('0xa6')])[_0x5e54('0x96')](_0x4033b8[_0x5e54('0x8f')]);}else{return _0x4c815a['sendStatus'](0xc8);}})['catch'](handleError(_0x4c815a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index f4ac5f1..811f452 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 _0xbea5=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x373a99,_0x1efeaf){var _0xd7034c=function(_0x16b3a9){while(--_0x16b3a9){_0x373a99['push'](_0x373a99['shift']());}};_0xd7034c(++_0x1efeaf);}(_0xbea5,0x177));var _0x5bea=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0xbea5[_0x5d225a];return _0x1e7761;};'use strict';var EventEmitter=require(_0x5bea('0x0'));var Plugin=require(_0x5bea('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5bea('0x2')](0x0);var events={'afterCreate':_0x5bea('0x3'),'afterUpdate':_0x5bea('0x4'),'afterDestroy':_0x5bea('0x5')};function emitEvent(_0x1eb3b6){return function(_0x528183,_0x5cd985,_0xbf43f5){PluginEvents['emit'](_0x1eb3b6+':'+_0x528183['id'],_0x528183);PluginEvents[_0x5bea('0x6')](_0x1eb3b6,_0x528183);_0xbf43f5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x5bea('0x7')]=PluginEvents; \ No newline at end of file +var _0x75a2=['../../mysqldb','Plugin','save','update','remove','hook','exports','events'];(function(_0xf5f819,_0xb8b34c){var _0x398d9d=function(_0x1d9b55){while(--_0x1d9b55){_0xf5f819['push'](_0xf5f819['shift']());}};_0x398d9d(++_0xb8b34c);}(_0x75a2,0x187));var _0x275a=function(_0x27b4af,_0x5c1fcc){_0x27b4af=_0x27b4af-0x0;var _0xf6feef=_0x75a2[_0x27b4af];return _0xf6feef;};'use strict';var EventEmitter=require(_0x275a('0x0'));var Plugin=require(_0x275a('0x1'))['db'][_0x275a('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x275a('0x3'),'afterUpdate':_0x275a('0x4'),'afterDestroy':_0x275a('0x5')};function emitEvent(_0x6c21e9){return function(_0x5019d2,_0x251db9,_0x4f1945){PluginEvents['emit'](_0x6c21e9+':'+_0x5019d2['id'],_0x5019d2);PluginEvents['emit'](_0x6c21e9,_0x5019d2);_0x4f1945(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x275a('0x6')](e,emitEvent(event));}}module[_0x275a('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 173a5a9..e975050 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 _0xfa1e=['plugins','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Plugin'];(function(_0x171595,_0x15bd85){var _0x5cb341=function(_0x15580f){while(--_0x15580f){_0x171595['push'](_0x171595['shift']());}};_0x5cb341(++_0x15bd85);}(_0xfa1e,0xb1));var _0xefa1=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0xfa1e[_0x3bef2c];return _0x331503;};'use strict';var _=require(_0xefa1('0x0'));var util=require('util');var logger=require(_0xefa1('0x1'))(_0xefa1('0x2'));var moment=require(_0xefa1('0x3'));var BPromise=require(_0xefa1('0x4'));var rp=require(_0xefa1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefa1('0x6'));var config=require(_0xefa1('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x1b7a93,_0x13e091){return _0x1b7a93[_0xefa1('0x8')](_0xefa1('0x9'),attributes,{'tableName':_0xefa1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x214b=['../../config/logger','moment','bluebird','request-promise','../../config/environment','define','Plugin','lodash','util'];(function(_0x1d3084,_0x1e051a){var _0x473d7c=function(_0x3c57f0){while(--_0x3c57f0){_0x1d3084['push'](_0x1d3084['shift']());}};_0x473d7c(++_0x1e051a);}(_0x214b,0x1e4));var _0xb214=function(_0x1a8f79,_0x135920){_0x1a8f79=_0x1a8f79-0x0;var _0x35985b=_0x214b[_0x1a8f79];return _0x35985b;};'use strict';var _=require(_0xb214('0x0'));var util=require(_0xb214('0x1'));var logger=require(_0xb214('0x2'))('api');var moment=require(_0xb214('0x3'));var BPromise=require(_0xb214('0x4'));var rp=require(_0xb214('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb214('0x6'));var attributes=require('./plugin.attributes');module['exports']=function(_0xd5418d,_0x25f99d){return _0xd5418d[_0xb214('0x7')](_0xb214('0x8'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 73e8805..e1ffe49 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 _0x9fbb=['message','result','catch','CreatePlugin','Plugin','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','defaults','redis','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9fbb,0x83));var _0xb9fb=function(_0x1819cf,_0x1633ac){_0x1819cf=_0x1819cf-0x0;var _0x367124=_0x9fbb[_0x1819cf];return _0x367124;};'use strict';var _=require(_0xb9fb('0x0'));var util=require(_0xb9fb('0x1'));var moment=require(_0xb9fb('0x2'));var BPromise=require(_0xb9fb('0x3'));var rs=require(_0xb9fb('0x4'));var fs=require('fs');var Redis=require(_0xb9fb('0x5'));var db=require(_0xb9fb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb9fb('0x7'));var config=require(_0xb9fb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb9fb('0x9')][_0xb9fb('0xa')]({'port':0x232a});config['redis']=_[_0xb9fb('0xb')](config[_0xb9fb('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9fb('0xc')]));require(_0xb9fb('0xd'))[_0xb9fb('0xe')](socket);function respondWithRpcPromise(_0x21b021,_0x5b1813,_0x25d505){return new BPromise(function(_0x4027bf,_0x488ce9){return client[_0xb9fb('0xf')](_0x21b021,_0x25d505)[_0xb9fb('0x10')](function(_0x58a086){logger[_0xb9fb('0x11')](_0xb9fb('0x12'),_0x5b1813,_0xb9fb('0x13'));logger[_0xb9fb('0x14')](_0xb9fb('0x15'),_0x5b1813,_0xb9fb('0x13'),JSON[_0xb9fb('0x16')](_0x58a086));if(_0x58a086['error']){if(_0x58a086[_0xb9fb('0x17')]['code']===0x1f4){logger[_0xb9fb('0x17')](_0xb9fb('0x12'),_0x5b1813,_0x58a086['error'][_0xb9fb('0x18')]);return _0x488ce9(_0x58a086['error'][_0xb9fb('0x18')]);}logger[_0xb9fb('0x17')](_0xb9fb('0x12'),_0x5b1813,_0x58a086[_0xb9fb('0x17')]['message']);return _0x4027bf(_0x58a086[_0xb9fb('0x17')][_0xb9fb('0x18')]);}else{logger[_0xb9fb('0x11')](_0xb9fb('0x12'),_0x5b1813,_0xb9fb('0x13'));_0x4027bf(_0x58a086[_0xb9fb('0x19')][_0xb9fb('0x18')]);}})[_0xb9fb('0x1a')](function(_0x33ea9e){logger[_0xb9fb('0x17')](_0xb9fb('0x12'),_0x5b1813,_0x33ea9e);_0x488ce9(_0x33ea9e);});});}exports[_0xb9fb('0x1b')]=function(_0x2c4cb1){var _0x1ef77e=this;return new Promise(function(_0x5381d5,_0x115ecf){return db[_0xb9fb('0x1c')]['create'](_0x2c4cb1['body'],{'raw':_0x2c4cb1['options']?_0x2c4cb1[_0xb9fb('0x1d')][_0xb9fb('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2ee5fb){logger[_0xb9fb('0x11')]('CreatePlugin',_0x2c4cb1);logger[_0xb9fb('0x14')]('CreatePlugin',_0x2c4cb1,JSON[_0xb9fb('0x16')](_0x2ee5fb));_0x5381d5(_0x2ee5fb);})['catch'](function(_0x1f54c3){logger['error']('CreatePlugin',_0x1f54c3['message'],_0x2c4cb1);_0x115ecf(_0x1ef77e[_0xb9fb('0x17')](0x1f4,_0x1f54c3[_0xb9fb('0x18')]));});});}; \ No newline at end of file +var _0x5c38=['client','redis','defaults','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','result','CreatePlugin','Plugin','body','options','stringify','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x22e11c,_0x32ef49){var _0x4fd8ed=function(_0x1098b7){while(--_0x1098b7){_0x22e11c['push'](_0x22e11c['shift']());}};_0x4fd8ed(++_0x32ef49);}(_0x5c38,0x189));var _0x85c3=function(_0x5153fd,_0x237b93){_0x5153fd=_0x5153fd-0x0;var _0x5ee7bc=_0x5c38[_0x5153fd];return _0x5ee7bc;};'use strict';var _=require('lodash');var util=require(_0x85c3('0x0'));var moment=require(_0x85c3('0x1'));var BPromise=require(_0x85c3('0x2'));var rs=require(_0x85c3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85c3('0x4'))['db'];var utils=require(_0x85c3('0x5'));var logger=require(_0x85c3('0x6'))(_0x85c3('0x7'));var config=require(_0x85c3('0x8'));var jayson=require(_0x85c3('0x9'));var client=jayson[_0x85c3('0xa')]['http']({'port':0x232a});config[_0x85c3('0xb')]=_[_0x85c3('0xc')](config[_0x85c3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x85c3('0xd'))(new Redis(config['redis']));require(_0x85c3('0xe'))[_0x85c3('0xf')](socket);function respondWithRpcPromise(_0x5b13dc,_0x2eb2aa,_0x38f5b3){return new BPromise(function(_0x46076e,_0x211f2a){return client['request'](_0x5b13dc,_0x38f5b3)[_0x85c3('0x10')](function(_0x32a29c){logger[_0x85c3('0x11')](_0x85c3('0x12'),_0x2eb2aa,_0x85c3('0x13'));logger[_0x85c3('0x14')](_0x85c3('0x15'),_0x2eb2aa,_0x85c3('0x13'),JSON['stringify'](_0x32a29c));if(_0x32a29c['error']){if(_0x32a29c['error']['code']===0x1f4){logger['error'](_0x85c3('0x12'),_0x2eb2aa,_0x32a29c[_0x85c3('0x16')][_0x85c3('0x17')]);return _0x211f2a(_0x32a29c[_0x85c3('0x16')][_0x85c3('0x17')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x2eb2aa,_0x32a29c['error'][_0x85c3('0x17')]);return _0x46076e(_0x32a29c[_0x85c3('0x16')][_0x85c3('0x17')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x2eb2aa,_0x85c3('0x13'));_0x46076e(_0x32a29c[_0x85c3('0x18')][_0x85c3('0x17')]);}})['catch'](function(_0x2fe249){logger[_0x85c3('0x16')](_0x85c3('0x12'),_0x2eb2aa,_0x2fe249);_0x211f2a(_0x2fe249);});});}exports[_0x85c3('0x19')]=function(_0x4c2815){var _0x2d2d9e=this;return new Promise(function(_0x586f2b,_0x5b268b){return db[_0x85c3('0x1a')]['create'](_0x4c2815[_0x85c3('0x1b')],{'raw':_0x4c2815[_0x85c3('0x1c')]?_0x4c2815[_0x85c3('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x85c3('0x10')](function(_0x3a339a){logger['info'](_0x85c3('0x19'),_0x4c2815);logger['debug'](_0x85c3('0x19'),_0x4c2815,JSON[_0x85c3('0x1d')](_0x3a339a));_0x586f2b(_0x3a339a);})[_0x85c3('0x1e')](function(_0x5bbb7d){logger[_0x85c3('0x16')](_0x85c3('0x19'),_0x5bbb7d['message'],_0x4c2815);_0x5b268b(_0x2d2d9e['error'](0x1f4,_0x5bbb7d[_0x85c3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b3c9d21..691280a 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 _0x4a4c=['remove','update','emit','removeListener','register','plugin:','./plugin.events','save'];(function(_0x1aea2e,_0x1fbf25){var _0x2d0737=function(_0x9811e6){while(--_0x9811e6){_0x1aea2e['push'](_0x1aea2e['shift']());}};_0x2d0737(++_0x1fbf25);}(_0x4a4c,0x11e));var _0xc4a4=function(_0x9ddad9,_0x4d475c){_0x9ddad9=_0x9ddad9-0x0;var _0x363c96=_0x4a4c[_0x9ddad9];return _0x363c96;};'use strict';var PluginEvents=require(_0xc4a4('0x0'));var events=[_0xc4a4('0x1'),_0xc4a4('0x2'),_0xc4a4('0x3')];function createListener(_0x3a8642,_0x20bdd4){return function(_0x335079){_0x20bdd4[_0xc4a4('0x4')](_0x3a8642,_0x335079);};}function removeListener(_0xa7cd04,_0x1b48c6){return function(){PluginEvents[_0xc4a4('0x5')](_0xa7cd04,_0x1b48c6);};}exports[_0xc4a4('0x6')]=function(_0x5eb361){for(var _0x40f50a=0x0,_0xacb45b=events['length'];_0x40f50a<_0xacb45b;_0x40f50a++){var _0x33adac=events[_0x40f50a];var _0x56b6b6=createListener(_0xc4a4('0x7')+_0x33adac,_0x5eb361);PluginEvents['on'](_0x33adac,_0x56b6b6);}}; \ No newline at end of file +var _0x1775=['update','emit','removeListener','plugin:','./plugin.events','save','remove'];(function(_0x16e89f,_0xd13e87){var _0x2a041d=function(_0x6022e6){while(--_0x6022e6){_0x16e89f['push'](_0x16e89f['shift']());}};_0x2a041d(++_0xd13e87);}(_0x1775,0xa5));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var PluginEvents=require(_0x5177('0x0'));var events=[_0x5177('0x1'),_0x5177('0x2'),_0x5177('0x3')];function createListener(_0x5151f4,_0x4c6b4a){return function(_0x1d8f64){_0x4c6b4a[_0x5177('0x4')](_0x5151f4,_0x1d8f64);};}function removeListener(_0x4ca381,_0x2ff3b3){return function(){PluginEvents[_0x5177('0x5')](_0x4ca381,_0x2ff3b3);};}exports['register']=function(_0x14099d){for(var _0x277312=0x0,_0x13c7ad=events['length'];_0x277312<_0x13c7ad;_0x277312++){var _0x3afc7d=events[_0x277312];var _0x30e354=createListener(_0x5177('0x6')+_0x3afc7d,_0x14099d);PluginEvents['on'](_0x3afc7d,_0x30e354);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 22c9cbc..4a70384 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(_0x31d5af,_0x478df9){var _0x4339e7=function(_0x5876a3){while(--_0x5876a3){_0x31d5af['push'](_0x31d5af['shift']());}};_0x4339e7(++_0x478df9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x325821,_0x2f8e6f){var _0x48548d=function(_0x5d7a93){while(--_0x5d7a93){_0x325821['push'](_0x325821['shift']());}};_0x48548d(++_0x2f8e6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 6ed7526..73403ee 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 _0xb469=['motion2','show','create','body','join','../../files/plugins','chdir','dirname','start','dump','catch','status','update','restart','hasOwnProperty','params','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','error','stack','name','send','info','index','list','then','reject','express'];(function(_0xf30356,_0x1b534a){var _0x1e0cd7=function(_0x1e72a4){while(--_0x1e72a4){_0xf30356['push'](_0xf30356['shift']());}};_0x1e0cd7(++_0x1b534a);}(_0xb469,0x13b));var _0x9b46=function(_0x59e8e6,_0xfa69c1){_0x59e8e6=_0x59e8e6-0x0;var _0x38a166=_0xb469[_0x59e8e6];return _0x38a166;};'use strict';var _=require(_0x9b46('0x0'));var pm2=require(_0x9b46('0x1'));var logger=require(_0x9b46('0x2'))(_0x9b46('0x3'));var path=require(_0x9b46('0x4'));var exec=require(_0x9b46('0x5'))[_0x9b46('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x31f853,_0x45322f){return function(_0x538fc4){if(!_0x538fc4){_0x31f853[_0x9b46('0x7')](0x194);;}return _0x538fc4;};}function respondWithResult(_0x405d1c,_0x50b49e){_0x50b49e=_0x50b49e||0xc8;return function(_0x1b2dd3){if(_0x1b2dd3){return _0x405d1c['status'](_0x50b49e)['json'](_0x1b2dd3);}return null;};}function handleError(_0x34c0de,_0x545b6c){_0x545b6c=_0x545b6c||0x1f4;return function(_0x402595){logger[_0x9b46('0x8')](_0x402595[_0x9b46('0x9')]);if(_0x402595['name']){delete _0x402595[_0x9b46('0xa')];}_0x34c0de['status'](_0x545b6c)[_0x9b46('0xb')](_0x402595);};}function execChildProcess(){return new BPromise(function(_0x568d9a,_0x2c29a7){exec('npm\x20install',function(_0x672157,_0x233b6b,_0x563de4){logger[_0x9b46('0xc')](_0x233b6b);logger[_0x9b46('0xc')](_0x563de4);if(_0x672157){logger['error'](_0x672157);return _0x2c29a7(_0x672157);}return _0x568d9a(_0x233b6b);});});}exports[_0x9b46('0xd')]=function(_0x2cfb35,_0x3d9618){return pm2[_0x9b46('0xe')]()[_0x9b46('0xf')](function(_0x35c5c1){if(_0x35c5c1){var _0x2136bc=_[_0x9b46('0x10')](_0x35c5c1,function(_0x3f2b28){return _0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x11')||_0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x12');});return{'rows':_0x2136bc,'count':_0x2136bc['length']};}return null;})['then'](respondWithResult(_0x3d9618,null))['catch'](handleError(_0x3d9618,null));};exports[_0x9b46('0x13')]=function(_0x5a380c,_0x29fec9){return pm2['describe'](_0x5a380c['params']['id'])[_0x9b46('0xf')](respondWithResult(_0x29fec9,null))['then'](handleEntityNotFound(_0x29fec9,null))['catch'](handleError(_0x29fec9,null));};exports[_0x9b46('0x14')]=function(_0x3a15cc,_0x5a0d25){if(_0x3a15cc[_0x9b46('0x15')][_0x9b46('0xa')]&&_0x3a15cc['body']['script']){var _0xbec2ea=path[_0x9b46('0x16')](__dirname,_0x9b46('0x17'),_0x3a15cc['body']['script']);var _0x2b3440=process['cwd']();process[_0x9b46('0x18')](path[_0x9b46('0x19')](_0xbec2ea));return execChildProcess()['then'](function(_0xadff19){process['chdir'](_0x2b3440);return pm2[_0x9b46('0x1a')]({'name':_0x3a15cc[_0x9b46('0x15')]['name'],'script':_0xbec2ea});})[_0x9b46('0xf')](function(_0x31ca63){pm2[_0x9b46('0x1b')]();return _0x31ca63[0x0];})[_0x9b46('0xf')](respondWithResult(_0x5a0d25,0xc9))[_0x9b46('0x1c')](handleError(_0x5a0d25,null));}else{return _0x5a0d25[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x9b46('0x1e')]=function(_0x3ac37e,_0x478105){if(_0x3ac37e[_0x9b46('0x15')]['id']){delete _0x3ac37e[_0x9b46('0x15')]['id'];}var _0x2a79a5={'online':_0x9b46('0x1f'),'stopped':'stop'};if(_0x2a79a5[_0x9b46('0x20')](_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')])){return pm2[_0x2a79a5[_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')]]](_0x3ac37e[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](respondWithResult(_0x478105,0xc8))[_0x9b46('0x1c')](handleError(_0x478105,null));}else{return _0x478105[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':_0x9b46('0x22')});}};exports['destroy']=function(_0x1f722d,_0x27f326){if(_0x1f722d[_0x9b46('0x15')]['id']){delete _0x1f722d[_0x9b46('0x15')]['id'];}if(_0x1f722d[_0x9b46('0x21')]['id']){return pm2[_0x9b46('0x23')](_0x1f722d[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](function(_0x3ab49a){pm2[_0x9b46('0x1b')]();return _0x3ab49a[0x0];})[_0x9b46('0xf')](respondWithResult(_0x27f326,null))['catch'](handleError(_0x27f326,null));}else{return _0x27f326[_0x9b46('0x1d')](0x1f4)['send']({'message':_0x9b46('0x24')});}}; \ No newline at end of file +var _0x2f68=['dump','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','sendStatus','status','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','delete'];(function(_0x165ab5,_0x310ad6){var _0xd00a42=function(_0x533ebf){while(--_0x533ebf){_0x165ab5['push'](_0x165ab5['shift']());}};_0xd00a42(++_0x310ad6);}(_0x2f68,0x9a));var _0x82f6=function(_0x587dd9,_0x19b2c8){_0x587dd9=_0x587dd9-0x0;var _0x540d64=_0x2f68[_0x587dd9];return _0x540d64;};'use strict';var _=require('lodash');var pm2=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var path=require(_0x82f6('0x3'));var exec=require('child_process')[_0x82f6('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2a06dc,_0x2ab73d){return function(_0x5dad09){if(!_0x5dad09){_0x2a06dc[_0x82f6('0x5')](0x194);;}return _0x5dad09;};}function respondWithResult(_0x2c4302,_0x542737){_0x542737=_0x542737||0xc8;return function(_0x5a8089){if(_0x5a8089){return _0x2c4302[_0x82f6('0x6')](_0x542737)['json'](_0x5a8089);}return null;};}function handleError(_0x5daa3c,_0x864400){_0x864400=_0x864400||0x1f4;return function(_0xbd30d5){logger[_0x82f6('0x7')](_0xbd30d5['stack']);if(_0xbd30d5[_0x82f6('0x8')]){delete _0xbd30d5[_0x82f6('0x8')];}_0x5daa3c['status'](_0x864400)[_0x82f6('0x9')](_0xbd30d5);};}function execChildProcess(){return new BPromise(function(_0x1eec2f,_0x3f8320){exec(_0x82f6('0xa'),function(_0x1a68c4,_0x34bd7c,_0x4c870e){logger[_0x82f6('0xb')](_0x34bd7c);logger[_0x82f6('0xb')](_0x4c870e);if(_0x1a68c4){logger['error'](_0x1a68c4);return _0x3f8320(_0x1a68c4);}return _0x1eec2f(_0x34bd7c);});});}exports[_0x82f6('0xc')]=function(_0x1f8bf5,_0x397527){return pm2[_0x82f6('0xd')]()[_0x82f6('0xe')](function(_0xa00275){if(_0xa00275){var _0x115c7b=_[_0x82f6('0xf')](_0xa00275,function(_0x1e7cbc){return _0x1e7cbc['name']===_0x82f6('0x10')||_0x1e7cbc['name']===_0x82f6('0x11');});return{'rows':_0x115c7b,'count':_0x115c7b[_0x82f6('0x12')]};}return null;})[_0x82f6('0xe')](respondWithResult(_0x397527,null))[_0x82f6('0x13')](handleError(_0x397527,null));};exports[_0x82f6('0x14')]=function(_0x2326ae,_0x326378){return pm2[_0x82f6('0x15')](_0x2326ae[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x326378,null))[_0x82f6('0xe')](handleEntityNotFound(_0x326378,null))[_0x82f6('0x13')](handleError(_0x326378,null));};exports[_0x82f6('0x17')]=function(_0x4fe226,_0x3a8269){if(_0x4fe226['body'][_0x82f6('0x8')]&&_0x4fe226[_0x82f6('0x18')]['script']){var _0x2b03ad=path[_0x82f6('0x19')](__dirname,_0x82f6('0x1a'),_0x4fe226[_0x82f6('0x18')]['script']);var _0xdc4dea=process['cwd']();process[_0x82f6('0x1b')](path[_0x82f6('0x1c')](_0x2b03ad));return execChildProcess()['then'](function(_0x516deb){process[_0x82f6('0x1b')](_0xdc4dea);return pm2[_0x82f6('0x1d')]({'name':_0x4fe226['body']['name'],'script':_0x2b03ad});})[_0x82f6('0xe')](function(_0x31face){pm2['dump']();return _0x31face[0x0];})[_0x82f6('0xe')](respondWithResult(_0x3a8269,0xc9))[_0x82f6('0x13')](handleError(_0x3a8269,null));}else{return _0x3a8269['status'](0x1f4)['send']({'message':_0x82f6('0x1e')});}};exports['update']=function(_0x469b6b,_0x5a6d69){if(_0x469b6b['body']['id']){delete _0x469b6b[_0x82f6('0x18')]['id'];}var _0x15c9b7={'online':_0x82f6('0x1f'),'stopped':_0x82f6('0x20')};if(_0x15c9b7['hasOwnProperty'](_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')])){return pm2[_0x15c9b7[_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')]]](_0x469b6b[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x5a6d69,0xc8))[_0x82f6('0x13')](handleError(_0x5a6d69,null));}else{return _0x5a6d69[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x21')});}};exports[_0x82f6('0x22')]=function(_0x20d1c5,_0x6ce179){if(_0x20d1c5[_0x82f6('0x18')]['id']){delete _0x20d1c5['body']['id'];}if(_0x20d1c5[_0x82f6('0x16')]['id']){return pm2[_0x82f6('0x23')](_0x20d1c5[_0x82f6('0x16')]['id'])['then'](function(_0x36f37a){pm2[_0x82f6('0x24')]();return _0x36f37a[0x0];})[_0x82f6('0xe')](respondWithResult(_0x6ce179,null))[_0x82f6('0x13')](handleError(_0x6ce179,null));}else{return _0x6ce179[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 901255c..7623948 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 _0x2bc6=['express','get','/agents','/queues','getQueues','exports'];(function(_0x4d5c41,_0x1b7df3){var _0x11129b=function(_0x23c9d0){while(--_0x23c9d0){_0x4d5c41['push'](_0x4d5c41['shift']());}};_0x11129b(++_0x1b7df3);}(_0x2bc6,0x1ec));var _0x62bc=function(_0x481df5,_0x216652){_0x481df5=_0x481df5-0x0;var _0x32726e=_0x2bc6[_0x481df5];return _0x32726e;};'use strict';var express=require(_0x62bc('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0x62bc('0x1')](_0x62bc('0x2'),auth['isAuthenticated'](),controller['getAgents']);router[_0x62bc('0x1')](_0x62bc('0x3'),auth['isAuthenticated'](),controller[_0x62bc('0x4')]);module[_0x62bc('0x5')]=router; \ No newline at end of file +var _0xa537=['isAuthenticated','getAgents','getQueues','exports','express','Router','./realtime.controller','get','/agents'];(function(_0x199b0b,_0x38dacb){var _0x4a70ec=function(_0x4d7022){while(--_0x4d7022){_0x199b0b['push'](_0x199b0b['shift']());}};_0x4a70ec(++_0x38dacb);}(_0xa537,0x1b4));var _0x7a53=function(_0x5f4c3e,_0x11899c){_0x5f4c3e=_0x5f4c3e-0x0;var _0x92f694=_0xa537[_0x5f4c3e];return _0x92f694;};'use strict';var express=require(_0x7a53('0x0'));var router=express[_0x7a53('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x7a53('0x2'));router[_0x7a53('0x3')](_0x7a53('0x4'),auth[_0x7a53('0x5')](),controller[_0x7a53('0x6')]);router[_0x7a53('0x3')]('/queues',auth[_0x7a53('0x5')](),controller[_0x7a53('0x7')]);module[_0x7a53('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 7e99c3f..3da6934 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 _0xc6fc=['fields','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','key','role','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','Pause','forEach','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','omit','findAndCountAll','rows','find','filterAgentAttributes','globalStatus','getAgentStatus','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','resolve','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','rawAttributes','name','outbound','dialActive','dialMethod','join','QueueCampaigns','Queues','filter','getResources','getRealtimeQueues','initializeQueues','catch','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','set','Content-Range','getAgents','query','globalQueueFilter','globalStatusFilter','pause','*pause','then','channel','isValidChannel','format','toLowerCase','sort','includes','validateSortParameter'];(function(_0x5a125c,_0x155fa2){var _0x4c70af=function(_0x5dccb6){while(--_0x5dccb6){_0x5a125c['push'](_0x5a125c['shift']());}};_0x4c70af(++_0x155fa2);}(_0xc6fc,0x92));var _0xcc6f=function(_0x15876c,_0x510dd4){_0x15876c=_0x15876c-0x0;var _0x39d91b=_0xc6fc[_0x15876c];return _0x39d91b;};'use strict';var _=require(_0xcc6f('0x0'));var util=require(_0xcc6f('0x1'));var rta=require(_0xcc6f('0x2'));var rtq=require(_0xcc6f('0x3'));var qs=require(_0xcc6f('0x4'));var utils=require(_0xcc6f('0x5'));var db=require(_0xcc6f('0x6'))['db'];var APIBadRequestError=require(_0xcc6f('0x7'))[_0xcc6f('0x8')];var APIHandleError=require(_0xcc6f('0x7'))[_0xcc6f('0x9')];function respondWithFilteredResult(_0x2c48fb,_0x5bea14){return function(_0x4c1c81){if(_0x4c1c81){var _0x340ab4=typeof _0x5bea14[_0xcc6f('0xa')]===_0xcc6f('0xb')&&typeof _0x5bea14[_0xcc6f('0xc')]===_0xcc6f('0xb');var _0x7ef54d=_0x4c1c81[_0xcc6f('0xd')];var _0x476e38=_0x340ab4?0x0:_0x5bea14[_0xcc6f('0xa')];var _0x6f56b9=_0x340ab4?_0x4c1c81['count']:_0x5bea14['offset']+_0x5bea14[_0xcc6f('0xc')];var _0x550a8b;if(_0x6f56b9>=_0x7ef54d){_0x6f56b9=_0x7ef54d;_0x550a8b=0xc8;}else{_0x550a8b=0xce;}_0x2c48fb['status'](_0x550a8b);return _0x2c48fb[_0xcc6f('0xe')](_0xcc6f('0xf'),_0x476e38+'-'+_0x6f56b9+'/'+_0x7ef54d)['json'](_0x4c1c81);}return null;};}exports[_0xcc6f('0x10')]=function(_0x51ff26,_0x599d5c){var _0x22835f={'count':0x0,'rows':[]};var _0x5e374e={};var _0x219640;var _0x23d53f=utils['getChannels']();var _0x450adf;var _0x5ba7bc;var _0x39f493=_0x51ff26[_0xcc6f('0x11')][_0xcc6f('0x12')];var _0x5dabd0=_0x51ff26[_0xcc6f('0x11')][_0xcc6f('0x13')];var _0x3e9b6e=_0x51ff26[_0xcc6f('0x11')]['pauseTypeFilter'];var _0x59bf43=_0x5dabd0===_0xcc6f('0x14')||_0x5dabd0===_0xcc6f('0x15')?!![]:![];var _0xd58b28=[];var _0x13feac;var _0xdeb69c;Promise['resolve']()[_0xcc6f('0x16')](function(){if(_0x51ff26[_0xcc6f('0x11')][_0xcc6f('0x17')]){if(!utils[_0xcc6f('0x18')](_0x51ff26['query'][_0xcc6f('0x17')])){throw new APIBadRequestError(util[_0xcc6f('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x51ff26[_0xcc6f('0x11')][_0xcc6f('0x17')]));}_0x219640=_0x51ff26[_0xcc6f('0x11')][_0xcc6f('0x17')][_0xcc6f('0x1a')]();}if(!_0x51ff26[_0xcc6f('0x11')]['sort']||!_0x51ff26[_0xcc6f('0x11')][_0xcc6f('0x1b')][_0xcc6f('0x1c')]('globalStatus')){_0x51ff26[_0xcc6f('0x11')][_0xcc6f('0x1b')]=rta[_0xcc6f('0x1d')](_0x51ff26['query'][_0xcc6f('0x1b')]);return;}var _0x673e2d=rta['getUpdatedSortOptions'](_0x51ff26['query'][_0xcc6f('0x1b')]);_0x51ff26[_0xcc6f('0x11')][_0xcc6f('0x1b')]=_0x673e2d[_0xcc6f('0x1e')]['join'](',');_0x13feac=_0x673e2d[_0xcc6f('0x1f')];})[_0xcc6f('0x16')](function(){if(!_0x39f493){return[];}return rta[_0xcc6f('0x20')](_0x39f493,_0x219640);})[_0xcc6f('0x16')](function(_0x56f551){_0xd58b28=_0x56f551;return rta[_0xcc6f('0x21')]();})[_0xcc6f('0x16')](function(_0x25db49){_0x5ba7bc=_0x25db49['rows'];if((!_0x5dabd0||_0x59bf43)&&!_0x13feac){return _0xd58b28;}if(_0x13feac&&!_0x5dabd0){return rta[_0xcc6f('0x22')](_0x5ba7bc,_0xd58b28,_0x13feac);}else{return rta[_0xcc6f('0x23')](_0x5ba7bc,_0xd58b28,_0x5dabd0);}})[_0xcc6f('0x16')](function(_0x2e1a2f){_0xd58b28=_0x2e1a2f;var _0x20364f=![];if(_0xd58b28[_0xcc6f('0x24')]===0x0){if(_0x39f493||_0x5dabd0){_0x20364f=!![];}if(_0x59bf43){_0x20364f=![];}}if(_0x20364f){return _0x22835f;}var _0x39b1e3=_[_0xcc6f('0x25')](db[_0xcc6f('0x26')]['rawAttributes'],function(_0x31fc2a){return{'name':_0x31fc2a[_0xcc6f('0x27')],'type':_0x31fc2a[_0xcc6f('0x28')][_0xcc6f('0x29')]};});_0x51ff26[_0xcc6f('0x11')][_0xcc6f('0x2a')]=_0xcc6f('0x2b');_0x5e374e=qs[_0xcc6f('0x2c')](_0x39b1e3,_0x51ff26);_0x5e374e[_0xcc6f('0x2d')]=!![];var _0x1daa15=[];if(_0xd58b28['length']>0x0){_0x1daa15[_0xcc6f('0x2e')]({'id':{'$in':_0xd58b28}});if(_0x13feac&&!_0x5dabd0){_0xdeb69c=[db[_0xcc6f('0x2f')][_0xcc6f('0x30')](_0xcc6f('0x31')+_0xd58b28+')')];_0x5e374e[_0xcc6f('0x1f')]=_0xdeb69c;}}if(_0x59bf43){_0x23d53f['forEach'](function(_0x25b068){var _0x42a0dd=!![];if(_0x5dabd0===_0xcc6f('0x15')&&_0x219640!==_0x25b068){_0x42a0dd=![];}_0x1daa15[_0xcc6f('0x2e')]({[_0x25b068+_0xcc6f('0x32')]:_0x42a0dd});});if(_0x3e9b6e){_0x1daa15[_0xcc6f('0x2e')]({'pauseType':_0x3e9b6e});}}else if(_0x5dabd0){_0x23d53f[_0xcc6f('0x33')](function(_0x314033){_0x1daa15['push']({[_0x314033+_0xcc6f('0x32')]:![]});});}_0x5e374e[_0xcc6f('0x34')]=_[_0xcc6f('0x35')](_0x5e374e[_0xcc6f('0x34')],{'$and':_0x1daa15});if(_0x51ff26[_0xcc6f('0x36')][_0xcc6f('0x2a')]==='user'){var _0xd27134={'params':{'id':_0x51ff26[_0xcc6f('0x36')][_0xcc6f('0x37')]},'query':{'section':_0xcc6f('0x38'),'role':_0xcc6f('0x2b'),'raw':!![],'ids':_0xd58b28,'customSorting':_0xdeb69c}};if(_0x51ff26[_0xcc6f('0x11')][_0xcc6f('0x39')]){_0xd27134[_0xcc6f('0x11')][_0xcc6f('0x39')]=!![];}if(_0x59bf43){_0xd27134['query'][_0xcc6f('0x3a')]=_0x1daa15;}_0xd27134['query']=Object[_0xcc6f('0x3b')](_0xd27134['query'],_[_0xcc6f('0x3c')](_0x51ff26[_0xcc6f('0x11')],'id'));return db['UserProfile']['getResources'](_0xd27134);}return db[_0xcc6f('0x26')][_0xcc6f('0x3d')](_0x5e374e);})[_0xcc6f('0x16')](function(_0x282c07){_0x22835f[_0xcc6f('0xd')]=_0x282c07[_0xcc6f('0xd')];_0x450adf=_0x282c07[_0xcc6f('0x3e')];return _0x450adf[_0xcc6f('0x25')](function(_0x237be2){var _0x423ac8=_[_0xcc6f('0x3f')](_0x5ba7bc,['id',_0x237be2['id']]);if(_0x423ac8){var _0x31e674=rta[_0xcc6f('0x40')](_0x423ac8);_[_0xcc6f('0x35')](_0x237be2,_0x31e674);}_0x237be2[_0xcc6f('0x41')]=rta[_0xcc6f('0x42')](_0x237be2);if(_0x237be2[_0xcc6f('0x41')][_0xcc6f('0x1c')](_0xcc6f('0x14'))){_0x23d53f[_0xcc6f('0x33')](function(_0x572b5e){if(_0x237be2[_0x572b5e+_0xcc6f('0x32')]){if(_0x572b5e===_0xcc6f('0x43')){if(_0x237be2[_0xcc6f('0x44')]!==_0xcc6f('0x45')){_0x237be2[_0xcc6f('0x44')]=_0xcc6f('0x14');}}else{_0x237be2[_0x572b5e+'Status']=_0xcc6f('0x14');}}});}return _0x237be2;});})[_0xcc6f('0x16')](function(_0x45df9f){if(!_0x13feac||_0xdeb69c){return _0x45df9f;}return rta[_0xcc6f('0x46')](_0x45df9f,_0x13feac);})[_0xcc6f('0x16')](function(_0x36b539){var _0x2777bd=rta[_0xcc6f('0x47')]();_0x22835f['rows']=_0x36b539[_0xcc6f('0x25')](function(_0x47dc95){return _['pick'](_0x47dc95,_0x2777bd);});return _0x22835f;})[_0xcc6f('0x16')](respondWithFilteredResult(_0x599d5c,_0x5e374e))['catch'](APIHandleError(_0x599d5c));};exports['getQueues']=function(_0x445351,_0x38ddee){var _0x1aab8b={'count':0x0,'rows':[]};var _0xe10979={};var _0x38489f;var _0x871325;var _0x27bfd4;Promise[_0xcc6f('0x48')]()['then'](function(){if(_0x445351[_0xcc6f('0x11')][_0xcc6f('0x17')]){if(!utils['isValidChannel'](_0x445351[_0xcc6f('0x11')][_0xcc6f('0x17')])){throw new APIBadRequestError(util[_0xcc6f('0x19')](_0xcc6f('0x49'),_0x445351[_0xcc6f('0x11')]['channel']));}_0x38489f=_0x445351[_0xcc6f('0x11')]['channel'][_0xcc6f('0x1a')]();}var _0x5e2bfb=_[_0xcc6f('0x4a')](_0x38489f)+'Queue';var _0x152dd5=_[_0xcc6f('0x25')](db[_0x5e2bfb][_0xcc6f('0x4b')],function(_0x18d1e7){return{'name':_0x18d1e7[_0xcc6f('0x27')],'type':_0x18d1e7['type'][_0xcc6f('0x29')]};});if(!_0x445351['query'][_0xcc6f('0x1e')]){var _0x44fd47=['id',_0xcc6f('0x4c')];if(_0x38489f===_0xcc6f('0x43')){_0x44fd47[_0xcc6f('0x2e')](_0xcc6f('0x28'));if(_0x445351[_0xcc6f('0x11')][_0xcc6f('0x28')]===_0xcc6f('0x4d')){_0x44fd47[_0xcc6f('0x2e')]([_0xcc6f('0x4e'),_0xcc6f('0x4f')]);}}_0x445351[_0xcc6f('0x11')][_0xcc6f('0x1e')]=_0x44fd47[_0xcc6f('0x50')](',');}_0xe10979=qs['getOptions'](_0x152dd5,_0x445351);if(_0x445351[_0xcc6f('0x36')][_0xcc6f('0x2a')]===_0xcc6f('0x36')){var _0x45778f={'params':{'id':_0x445351[_0xcc6f('0x36')][_0xcc6f('0x37')]},'query':{'section':_0x38489f===_0xcc6f('0x43')&&_0x445351[_0xcc6f('0x11')]['type']===_0xcc6f('0x4d')?_0xcc6f('0x51'):_[_0xcc6f('0x4a')](_0x38489f)+_0xcc6f('0x52'),'type':_0x445351['query'][_0xcc6f('0x28')],'nolimit':!![],'sort':_0xcc6f('0x4c'),'filter':_0x445351['query'][_0xcc6f('0x53')]}};_0x45778f['query']=Object[_0xcc6f('0x3b')](_0x45778f[_0xcc6f('0x11')],_0x445351[_0xcc6f('0x11')]);delete _0x45778f[_0xcc6f('0x11')]['id'];return db['UserProfile'][_0xcc6f('0x54')](_0x45778f);}return db[_0x5e2bfb][_0xcc6f('0x3d')](_0xe10979);})[_0xcc6f('0x16')](function(_0x55cdf8){_0x1aab8b[_0xcc6f('0xd')]=_0x55cdf8[_0xcc6f('0xd')];_0x871325=_0x55cdf8[_0xcc6f('0x3e')];return rtq[_0xcc6f('0x55')](_0x445351,_0x38489f);})['then'](function(_0x182246){_0x27bfd4=_0x182246[_0xcc6f('0x3e')];return rtq[_0xcc6f('0x56')](_0x871325,_0x27bfd4,_0x38489f,_0x445351[_0xcc6f('0x11')][_0xcc6f('0x28')]);})[_0xcc6f('0x16')](function(_0x29dcc0){_0x1aab8b[_0xcc6f('0x3e')]=_0x29dcc0;return _0x1aab8b;})['then'](respondWithFilteredResult(_0x38ddee,_0xe10979))[_0xcc6f('0x57')](APIHandleError(_0x38ddee));}; \ No newline at end of file +var _0xe051=['query','globalQueueFilter','globalStatusFilter','pause','resolve','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','getUpdatedSortOptions','fields','order','then','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','FIELD(id,','*pause','Pause','forEach','where','merge','user','Agents','online','extraQueryConditions','omit','UserProfile','findAndCountAll','map','find','filterAgentAttributes','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','catch','isValidChannel','startCase','Queue','name','dialActive','join','userProfileId','outbound','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','APIBadRequestError','undefined','count','offset','limit','status','set','Content-Range','json','getChannels'];(function(_0x3dde30,_0xd2eb96){var _0x19574b=function(_0x88308){while(--_0x88308){_0x3dde30['push'](_0x3dde30['shift']());}};_0x19574b(++_0xd2eb96);}(_0xe051,0xe9));var _0x1e05=function(_0x321ee6,_0x55caee){_0x321ee6=_0x321ee6-0x0;var _0x3c4f1a=_0xe051[_0x321ee6];return _0x3c4f1a;};'use strict';var _=require(_0x1e05('0x0'));var util=require(_0x1e05('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x1e05('0x2'));var qs=require(_0x1e05('0x3'));var utils=require('../../config/utils');var db=require(_0x1e05('0x4'))['db'];var APIBadRequestError=require(_0x1e05('0x5'))[_0x1e05('0x6')];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x4f1c22,_0x4ae84d){return function(_0x5ce5ff){if(_0x5ce5ff){var _0x1211ae=typeof _0x4ae84d['offset']===_0x1e05('0x7')&&typeof _0x4ae84d['limit']===_0x1e05('0x7');var _0x58867d=_0x5ce5ff[_0x1e05('0x8')];var _0x16b3ed=_0x1211ae?0x0:_0x4ae84d[_0x1e05('0x9')];var _0x1cc278=_0x1211ae?_0x5ce5ff[_0x1e05('0x8')]:_0x4ae84d[_0x1e05('0x9')]+_0x4ae84d[_0x1e05('0xa')];var _0x3ceec3;if(_0x1cc278>=_0x58867d){_0x1cc278=_0x58867d;_0x3ceec3=0xc8;}else{_0x3ceec3=0xce;}_0x4f1c22[_0x1e05('0xb')](_0x3ceec3);return _0x4f1c22[_0x1e05('0xc')](_0x1e05('0xd'),_0x16b3ed+'-'+_0x1cc278+'/'+_0x58867d)[_0x1e05('0xe')](_0x5ce5ff);}return null;};}exports['getAgents']=function(_0x4b2aac,_0x3bafcb){var _0x387513={'count':0x0,'rows':[]};var _0x9d0db={};var _0xf8152c;var _0x5acfe8=utils[_0x1e05('0xf')]();var _0x3370ed;var _0x41b0d5;var _0x126853=_0x4b2aac[_0x1e05('0x10')][_0x1e05('0x11')];var _0x43f37f=_0x4b2aac[_0x1e05('0x10')][_0x1e05('0x12')];var _0x404a64=_0x4b2aac[_0x1e05('0x10')]['pauseTypeFilter'];var _0x271eae=_0x43f37f===_0x1e05('0x13')||_0x43f37f==='*pause'?!![]:![];var _0x1bc12d=[];var _0x2d2033;var _0x263330;Promise[_0x1e05('0x14')]()['then'](function(){if(_0x4b2aac['query'][_0x1e05('0x15')]){if(!utils['isValidChannel'](_0x4b2aac[_0x1e05('0x10')][_0x1e05('0x15')])){throw new APIBadRequestError(util[_0x1e05('0x16')](_0x1e05('0x17'),_0x4b2aac['query']['channel']));}_0xf8152c=_0x4b2aac['query'][_0x1e05('0x15')][_0x1e05('0x18')]();}if(!_0x4b2aac[_0x1e05('0x10')][_0x1e05('0x19')]||!_0x4b2aac[_0x1e05('0x10')][_0x1e05('0x19')][_0x1e05('0x1a')](_0x1e05('0x1b'))){_0x4b2aac[_0x1e05('0x10')]['sort']=rta['validateSortParameter'](_0x4b2aac[_0x1e05('0x10')][_0x1e05('0x19')]);return;}var _0x102de3=rta[_0x1e05('0x1c')](_0x4b2aac[_0x1e05('0x10')]['sort']);_0x4b2aac['query'][_0x1e05('0x19')]=_0x102de3[_0x1e05('0x1d')]['join'](',');_0x2d2033=_0x102de3[_0x1e05('0x1e')];})[_0x1e05('0x1f')](function(){if(!_0x126853){return[];}return rta['getAgentIdsByQueues'](_0x126853,_0xf8152c);})[_0x1e05('0x1f')](function(_0x2e995f){_0x1bc12d=_0x2e995f;return rta[_0x1e05('0x20')]();})[_0x1e05('0x1f')](function(_0x2978eb){_0x41b0d5=_0x2978eb[_0x1e05('0x21')];if((!_0x43f37f||_0x271eae)&&!_0x2d2033){return _0x1bc12d;}if(_0x2d2033&&!_0x43f37f){return rta[_0x1e05('0x22')](_0x41b0d5,_0x1bc12d,_0x2d2033);}else{return rta[_0x1e05('0x23')](_0x41b0d5,_0x1bc12d,_0x43f37f);}})[_0x1e05('0x1f')](function(_0x2f3335){_0x1bc12d=_0x2f3335;var _0x2cf14a=![];if(_0x1bc12d[_0x1e05('0x24')]===0x0){if(_0x126853||_0x43f37f){_0x2cf14a=!![];}if(_0x271eae){_0x2cf14a=![];}}if(_0x2cf14a){return _0x387513;}var _0x5ee702=_['map'](db[_0x1e05('0x25')][_0x1e05('0x26')],function(_0x58368b){return{'name':_0x58368b[_0x1e05('0x27')],'type':_0x58368b[_0x1e05('0x28')][_0x1e05('0x29')]};});_0x4b2aac[_0x1e05('0x10')][_0x1e05('0x2a')]=_0x1e05('0x2b');_0x9d0db=qs[_0x1e05('0x2c')](_0x5ee702,_0x4b2aac);_0x9d0db[_0x1e05('0x2d')]=!![];var _0x1934bf=[];if(_0x1bc12d[_0x1e05('0x24')]>0x0){_0x1934bf[_0x1e05('0x2e')]({'id':{'$in':_0x1bc12d}});if(_0x2d2033&&!_0x43f37f){_0x263330=[db['sequelize']['literal'](_0x1e05('0x2f')+_0x1bc12d+')')];_0x9d0db[_0x1e05('0x1e')]=_0x263330;}}if(_0x271eae){_0x5acfe8['forEach'](function(_0x2252f5){var _0x2d33cd=!![];if(_0x43f37f===_0x1e05('0x30')&&_0xf8152c!==_0x2252f5){_0x2d33cd=![];}_0x1934bf[_0x1e05('0x2e')]({[_0x2252f5+_0x1e05('0x31')]:_0x2d33cd});});if(_0x404a64){_0x1934bf[_0x1e05('0x2e')]({'pauseType':_0x404a64});}}else if(_0x43f37f){_0x5acfe8[_0x1e05('0x32')](function(_0x10371d){_0x1934bf['push']({[_0x10371d+_0x1e05('0x31')]:![]});});}_0x9d0db[_0x1e05('0x33')]=_[_0x1e05('0x34')](_0x9d0db[_0x1e05('0x33')],{'$and':_0x1934bf});if(_0x4b2aac[_0x1e05('0x35')][_0x1e05('0x2a')]===_0x1e05('0x35')){var _0x593045={'params':{'id':_0x4b2aac['user']['userProfileId']},'query':{'section':_0x1e05('0x36'),'role':_0x1e05('0x2b'),'raw':!![],'ids':_0x1bc12d,'customSorting':_0x263330}};if(_0x4b2aac[_0x1e05('0x10')]['online']){_0x593045['query'][_0x1e05('0x37')]=!![];}if(_0x271eae){_0x593045[_0x1e05('0x10')][_0x1e05('0x38')]=_0x1934bf;}_0x593045[_0x1e05('0x10')]=Object['assign'](_0x593045['query'],_[_0x1e05('0x39')](_0x4b2aac[_0x1e05('0x10')],'id'));return db[_0x1e05('0x3a')]['getResources'](_0x593045);}return db[_0x1e05('0x25')][_0x1e05('0x3b')](_0x9d0db);})[_0x1e05('0x1f')](function(_0x444d11){_0x387513[_0x1e05('0x8')]=_0x444d11['count'];_0x3370ed=_0x444d11[_0x1e05('0x21')];return _0x3370ed[_0x1e05('0x3c')](function(_0x39059f){var _0x2e94b2=_[_0x1e05('0x3d')](_0x41b0d5,['id',_0x39059f['id']]);if(_0x2e94b2){var _0x4af172=rta[_0x1e05('0x3e')](_0x2e94b2);_[_0x1e05('0x34')](_0x39059f,_0x4af172);}_0x39059f[_0x1e05('0x1b')]=rta[_0x1e05('0x3f')](_0x39059f);if(_0x39059f[_0x1e05('0x1b')][_0x1e05('0x1a')]('pause')){_0x5acfe8[_0x1e05('0x32')](function(_0xbdfdd8){if(_0x39059f[_0xbdfdd8+'Pause']){if(_0xbdfdd8===_0x1e05('0x40')){if(_0x39059f[_0x1e05('0x41')]!==_0x1e05('0x42')){_0x39059f['voiceStatus']=_0x1e05('0x13');}}else{_0x39059f[_0xbdfdd8+_0x1e05('0x43')]='pause';}}});}return _0x39059f;});})['then'](function(_0x241154){if(!_0x2d2033||_0x263330){return _0x241154;}return rta[_0x1e05('0x44')](_0x241154,_0x2d2033);})[_0x1e05('0x1f')](function(_0x345792){var _0x2c1fb2=rta['getRealtimeAgentsQueryFields']();_0x387513['rows']=_0x345792[_0x1e05('0x3c')](function(_0x60acd2){return _['pick'](_0x60acd2,_0x2c1fb2);});return _0x387513;})[_0x1e05('0x1f')](respondWithFilteredResult(_0x3bafcb,_0x9d0db))[_0x1e05('0x45')](APIHandleError(_0x3bafcb));};exports['getQueues']=function(_0x1c4cb0,_0x111937){var _0x3602cc={'count':0x0,'rows':[]};var _0x2ccaf0={};var _0xc90aae;var _0x56fd83;var _0x4fbfb4;Promise[_0x1e05('0x14')]()[_0x1e05('0x1f')](function(){if(_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x15')]){if(!utils[_0x1e05('0x46')](_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x15')])){throw new APIBadRequestError(util[_0x1e05('0x16')](_0x1e05('0x17'),_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x15')]));}_0xc90aae=_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x15')][_0x1e05('0x18')]();}var _0x2a4d76=_[_0x1e05('0x47')](_0xc90aae)+_0x1e05('0x48');var _0x3e20bc=_[_0x1e05('0x3c')](db[_0x2a4d76][_0x1e05('0x26')],function(_0x2aab6b){return{'name':_0x2aab6b['fieldName'],'type':_0x2aab6b[_0x1e05('0x28')][_0x1e05('0x29')]};});if(!_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x1d')]){var _0x6e732a=['id',_0x1e05('0x49')];if(_0xc90aae===_0x1e05('0x40')){_0x6e732a['push'](_0x1e05('0x28'));if(_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x28')]==='outbound'){_0x6e732a[_0x1e05('0x2e')]([_0x1e05('0x4a'),'dialMethod']);}}_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x1d')]=_0x6e732a[_0x1e05('0x4b')](',');}_0x2ccaf0=qs[_0x1e05('0x2c')](_0x3e20bc,_0x1c4cb0);if(_0x1c4cb0[_0x1e05('0x35')][_0x1e05('0x2a')]===_0x1e05('0x35')){var _0x4230d7={'params':{'id':_0x1c4cb0[_0x1e05('0x35')][_0x1e05('0x4c')]},'query':{'section':_0xc90aae==='voice'&&_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x28')]===_0x1e05('0x4d')?_0x1e05('0x4e'):_[_0x1e05('0x47')](_0xc90aae)+_0x1e05('0x4f'),'type':_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x28')],'nolimit':!![],'sort':'name','filter':_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x50')]}};_0x4230d7[_0x1e05('0x10')]=Object['assign'](_0x4230d7[_0x1e05('0x10')],_0x1c4cb0[_0x1e05('0x10')]);delete _0x4230d7[_0x1e05('0x10')]['id'];return db[_0x1e05('0x3a')]['getResources'](_0x4230d7);}return db[_0x2a4d76][_0x1e05('0x3b')](_0x2ccaf0);})['then'](function(_0x39ed8e){_0x3602cc[_0x1e05('0x8')]=_0x39ed8e['count'];_0x56fd83=_0x39ed8e['rows'];return rtq[_0x1e05('0x51')](_0x1c4cb0,_0xc90aae);})['then'](function(_0x2c80d4){_0x4fbfb4=_0x2c80d4[_0x1e05('0x21')];return rtq[_0x1e05('0x52')](_0x56fd83,_0x4fbfb4,_0xc90aae,_0x1c4cb0[_0x1e05('0x10')][_0x1e05('0x28')]);})['then'](function(_0x4c32b2){_0x3602cc[_0x1e05('0x21')]=_0x4c32b2;return _0x3602cc;})['then'](respondWithFilteredResult(_0x111937,_0x2ccaf0))['catch'](APIHandleError(_0x111937));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 15c1362..50b5f0f 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5ab1e9,_0x32211f){var _0x59bff9=function(_0xf182d8){while(--_0xf182d8){_0x5ab1e9['push'](_0x5ab1e9['shift']());}};_0x59bff9(++_0x32211f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0xcb91[_0xc69f39];return _0x93be41;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xaca348,_0x4d3993){var _0x560057=function(_0x41e145){while(--_0x41e145){_0xaca348['push'](_0xaca348['shift']());}};_0x560057(++_0x4d3993);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index db67a2e..e7d6344 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 _0x7d9f=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x59437e,_0x2a1147){var _0x383e16=function(_0x191682){while(--_0x191682){_0x59437e['push'](_0x59437e['shift']());}};_0x383e16(++_0x2a1147);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x63de62,_0xe5cc89){_0x63de62=_0x63de62-0x0;var _0x3daddf=_0x7d9f[_0x63de62];return _0x3daddf;};'use strict';var Sequelize=require(_0xf7d9('0x0'));module[_0xf7d9('0x1')]={'state':{'type':Sequelize[_0xf7d9('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf7d9('0x3')]},'scheduledat':{'type':Sequelize[_0xf7d9('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf7d9('0x4')]},'responsetime':{'type':Sequelize[_0xf7d9('0x4')]},'ringtime':{'type':Sequelize[_0xf7d9('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf7d9('0x3')]},'campaigntype':{'type':Sequelize[_0xf7d9('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe978=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xe978,0x70));var _0x8e97=function(_0x24901c,_0x3e7b0a){_0x24901c=_0x24901c-0x0;var _0x34ddaa=_0xe978[_0x24901c];return _0x34ddaa;};'use strict';var Sequelize=require(_0x8e97('0x0'));module[_0x8e97('0x1')]={'state':{'type':Sequelize[_0x8e97('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x8e97('0x3')]},'starttime':{'type':Sequelize[_0x8e97('0x4')]},'responsetime':{'type':Sequelize[_0x8e97('0x4')]},'ringtime':{'type':Sequelize[_0x8e97('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8e97('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8e97('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 938c4e0..38b51b9 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 _0x83ef=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83ef,0x186));var _0xf83e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x83ef[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xf83e('0x0'));var util=require('util');var logger=require(_0xf83e('0x1'))('api');var moment=require(_0xf83e('0x2'));var BPromise=require(_0xf83e('0x3'));var rp=require(_0xf83e('0x4'));var fs=require('fs');var path=require(_0xf83e('0x5'));var rimraf=require(_0xf83e('0x6'));var config=require(_0xf83e('0x7'));var attributes=require(_0xf83e('0x8'));module[_0xf83e('0x9')]=function(_0x5e88ea,_0x5c3450){return _0x5e88ea['define'](_0xf83e('0xa'),attributes,{'tableName':_0xf83e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb802=['exports','define','ReportAgentPreview','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./reportAgentPreview.attributes'];(function(_0x241f20,_0xcfd3fa){var _0x21b5f4=function(_0xb84eb8){while(--_0xb84eb8){_0x241f20['push'](_0x241f20['shift']());}};_0x21b5f4(++_0xcfd3fa);}(_0xb802,0x121));var _0x2b80=function(_0x546158,_0x85a482){_0x546158=_0x546158-0x0;var _0xaf7a66=_0xb802[_0x546158];return _0xaf7a66;};'use strict';var _=require(_0x2b80('0x0'));var util=require(_0x2b80('0x1'));var logger=require(_0x2b80('0x2'))('api');var moment=require(_0x2b80('0x3'));var BPromise=require(_0x2b80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b80('0x5'));var rimraf=require(_0x2b80('0x6'));var config=require('../../config/environment');var attributes=require(_0x2b80('0x7'));module[_0x2b80('0x8')]=function(_0x30297b,_0x109c70){return _0x30297b[_0x2b80('0x9')](_0x2b80('0xa'),attributes,{'tableName':'report_agent_preview','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 f52cba7..ebe6a78 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 _0x094c=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','result','CreateReportAgentPreview','create','body','options','raw'];(function(_0x14fa63,_0x44d855){var _0x438554=function(_0x2b3389){while(--_0x2b3389){_0x14fa63['push'](_0x14fa63['shift']());}};_0x438554(++_0x44d855);}(_0x094c,0x97));var _0xc094=function(_0xe8360c,_0x4b51d5){_0xe8360c=_0xe8360c-0x0;var _0x377630=_0x094c[_0xe8360c];return _0x377630;};'use strict';var _=require(_0xc094('0x0'));var util=require(_0xc094('0x1'));var moment=require(_0xc094('0x2'));var BPromise=require(_0xc094('0x3'));var rs=require(_0xc094('0x4'));var fs=require('fs');var Redis=require(_0xc094('0x5'));var db=require(_0xc094('0x6'))['db'];var utils=require(_0xc094('0x7'));var logger=require(_0xc094('0x8'))(_0xc094('0x9'));var config=require('../../config/environment');var jayson=require(_0xc094('0xa'));var client=jayson[_0xc094('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x281735,_0x10c0af,_0x550268){return new BPromise(function(_0x42381a,_0x454561){return client[_0xc094('0xc')](_0x281735,_0x550268)[_0xc094('0xd')](function(_0x583a8a){logger[_0xc094('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x10c0af,'request\x20sent');logger[_0xc094('0xf')](_0xc094('0x10'),_0x10c0af,'request\x20sent',JSON[_0xc094('0x11')](_0x583a8a));if(_0x583a8a[_0xc094('0x12')]){if(_0x583a8a['error'][_0xc094('0x13')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x10c0af,_0x583a8a[_0xc094('0x12')][_0xc094('0x14')]);return _0x454561(_0x583a8a[_0xc094('0x12')]['message']);}logger['error'](_0xc094('0x15'),_0x10c0af,_0x583a8a[_0xc094('0x12')]['message']);return _0x42381a(_0x583a8a['error'][_0xc094('0x14')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x10c0af,_0xc094('0x16'));_0x42381a(_0x583a8a[_0xc094('0x17')]['message']);}})['catch'](function(_0x27f972){logger[_0xc094('0x12')](_0xc094('0x15'),_0x10c0af,_0x27f972);_0x454561(_0x27f972);});});}exports[_0xc094('0x18')]=function(_0x34b7ed){var _0x1c8022=this;return new Promise(function(_0x53a80b,_0x5500a5){return db['ReportAgentPreview'][_0xc094('0x19')](_0x34b7ed[_0xc094('0x1a')],{'raw':_0x34b7ed['options']?_0x34b7ed[_0xc094('0x1b')][_0xc094('0x1c')]===undefined?!![]:![]:!![]})[_0xc094('0xd')](function(_0x34ebb7){logger[_0xc094('0xe')]('CreateReportAgentPreview',_0x34b7ed);logger[_0xc094('0xf')]('CreateReportAgentPreview',_0x34b7ed,JSON[_0xc094('0x11')](_0x34ebb7));_0x53a80b(_0x34ebb7);})[_0xc094('0x1d')](function(_0x5916ac){logger[_0xc094('0x12')]('CreateReportAgentPreview',_0x5916ac[_0xc094('0x14')],_0x34b7ed);_0x5500a5(_0x1c8022[_0xc094('0x12')](0x1f4,_0x5916ac[_0xc094('0x14')]));});});}; \ No newline at end of file +var _0xe484=['info','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ReportAgentPreview','create','body','options','raw'];(function(_0x39bcaa,_0x304e2e){var _0x1bdd4e=function(_0x441a8c){while(--_0x441a8c){_0x39bcaa['push'](_0x39bcaa['shift']());}};_0x1bdd4e(++_0x304e2e);}(_0xe484,0x1b4));var _0x4e48=function(_0x46c993,_0x2fbd91){_0x46c993=_0x46c993-0x0;var _0x3e95b2=_0xe484[_0x46c993];return _0x3e95b2;};'use strict';var _=require(_0x4e48('0x0'));var util=require(_0x4e48('0x1'));var moment=require(_0x4e48('0x2'));var BPromise=require(_0x4e48('0x3'));var rs=require(_0x4e48('0x4'));var fs=require('fs');var Redis=require(_0x4e48('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e48('0x6'));var logger=require(_0x4e48('0x7'))(_0x4e48('0x8'));var config=require(_0x4e48('0x9'));var jayson=require(_0x4e48('0xa'));var client=jayson[_0x4e48('0xb')][_0x4e48('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d0d71,_0x3681ed,_0x159375){return new BPromise(function(_0x9c21a4,_0x15a379){return client[_0x4e48('0xd')](_0x1d0d71,_0x159375)[_0x4e48('0xe')](function(_0x41cea0){logger['info'](_0x4e48('0xf'),_0x3681ed,_0x4e48('0x10'));logger[_0x4e48('0x11')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x3681ed,_0x4e48('0x10'),JSON[_0x4e48('0x12')](_0x41cea0));if(_0x41cea0[_0x4e48('0x13')]){if(_0x41cea0[_0x4e48('0x13')][_0x4e48('0x14')]===0x1f4){logger[_0x4e48('0x13')](_0x4e48('0xf'),_0x3681ed,_0x41cea0[_0x4e48('0x13')]['message']);return _0x15a379(_0x41cea0['error']['message']);}logger[_0x4e48('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x3681ed,_0x41cea0['error'][_0x4e48('0x15')]);return _0x9c21a4(_0x41cea0[_0x4e48('0x13')]['message']);}else{logger['info'](_0x4e48('0xf'),_0x3681ed,'request\x20sent');_0x9c21a4(_0x41cea0[_0x4e48('0x16')][_0x4e48('0x15')]);}})[_0x4e48('0x17')](function(_0x113f87){logger[_0x4e48('0x13')](_0x4e48('0xf'),_0x3681ed,_0x113f87);_0x15a379(_0x113f87);});});}exports['CreateReportAgentPreview']=function(_0x141e9b){var _0xb56ca3=this;return new Promise(function(_0x3121e4,_0x5b23a2){return db[_0x4e48('0x18')][_0x4e48('0x19')](_0x141e9b[_0x4e48('0x1a')],{'raw':_0x141e9b[_0x4e48('0x1b')]?_0x141e9b[_0x4e48('0x1b')][_0x4e48('0x1c')]===undefined?!![]:![]:!![]})[_0x4e48('0xe')](function(_0xd6f9d1){logger[_0x4e48('0x1d')](_0x4e48('0x1e'),_0x141e9b);logger[_0x4e48('0x11')](_0x4e48('0x1e'),_0x141e9b,JSON[_0x4e48('0x12')](_0xd6f9d1));_0x3121e4(_0xd6f9d1);})[_0x4e48('0x17')](function(_0x515669){logger[_0x4e48('0x13')]('CreateReportAgentPreview',_0x515669[_0x4e48('0x15')],_0x141e9b);_0x5b23a2(_0xb56ca3[_0x4e48('0x13')](0x1f4,_0x515669[_0x4e48('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index f244693..bdb93a9 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 _0x67cf=['get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','../../components/auth/service','./rpc.controller'];(function(_0x409186,_0x4b8b73){var _0x3deb43=function(_0x358728){while(--_0x358728){_0x409186['push'](_0x409186['shift']());}};_0x3deb43(++_0x4b8b73);}(_0x67cf,0x9d));var _0xf67c=function(_0x22d655,_0x3941dd){_0x22d655=_0x22d655-0x0;var _0x257739=_0x67cf[_0x22d655];return _0x257739;};'use strict';var multer=require(_0xf67c('0x0'));var util=require(_0xf67c('0x1'));var path=require(_0xf67c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf67c('0x3'));var controller=require(_0xf67c('0x4'));router[_0xf67c('0x5')]('/voice/channels',auth[_0xf67c('0x6')](),controller['voiceChannels']);router['get'](_0xf67c('0x7'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x8')]);router[_0xf67c('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xf67c('0x6')](),controller[_0xf67c('0x9')]);router[_0xf67c('0x5')](_0xf67c('0xa'),auth[_0xf67c('0x6')](),controller[_0xf67c('0xb')]);router[_0xf67c('0x5')](_0xf67c('0xc'),auth['isAuthenticated'](),controller[_0xf67c('0xd')]);router[_0xf67c('0x5')](_0xf67c('0xe'),auth[_0xf67c('0x6')](),controller[_0xf67c('0xf')]);router[_0xf67c('0x5')](_0xf67c('0x10'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x11')]);router[_0xf67c('0x5')](_0xf67c('0x12'),auth['isAuthenticated'](),controller[_0xf67c('0x13')]);router[_0xf67c('0x5')](_0xf67c('0x14'),auth['isAuthenticated'](),controller['smsQueues']);router[_0xf67c('0x5')](_0xf67c('0x15'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x16')]);router[_0xf67c('0x5')](_0xf67c('0x17'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x18')]);router['get'](_0xf67c('0x19'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x1a')]);router[_0xf67c('0x5')](_0xf67c('0x1b'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x1c')]);router[_0xf67c('0x5')]('/voice/queues/channels/:uniqueid',auth[_0xf67c('0x6')](),controller[_0xf67c('0x1d')]);router[_0xf67c('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xf67c('0x6')](),controller['voiceQueuesChannelHangup']);router[_0xf67c('0x5')](_0xf67c('0x1e'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x1f')]);router[_0xf67c('0x5')](_0xf67c('0x20'),auth['isAuthenticated'](),controller[_0xf67c('0x21')]);router[_0xf67c('0x22')](_0xf67c('0x20'),auth['isAuthenticated'](),controller[_0xf67c('0x23')]);router['get'](_0xf67c('0x24'),auth[_0xf67c('0x6')](),controller['outbound']);router['get'](_0xf67c('0x25'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x26')]);router[_0xf67c('0x5')]('/agents',auth['isAuthenticated'](),controller[_0xf67c('0x27')]);router[_0xf67c('0x22')](_0xf67c('0x28'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x29')]);router[_0xf67c('0x5')]('/telephones',auth[_0xf67c('0x6')](),controller[_0xf67c('0x2a')]);router[_0xf67c('0x5')]('/trunks',auth[_0xf67c('0x6')](),controller[_0xf67c('0x2b')]);router[_0xf67c('0x5')](_0xf67c('0x2c'),auth['isAuthenticated'](),controller[_0xf67c('0x2d')]);router[_0xf67c('0x5')](_0xf67c('0x2e'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x2f')]);router['get']('/chat/queues/waitinginteractions',auth[_0xf67c('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0xf67c('0x5')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xf67c('0x5')](_0xf67c('0x30'),auth[_0xf67c('0x6')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xf67c('0x31'),auth[_0xf67c('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0xf67c('0x6')](),controller[_0xf67c('0x32')]);router['get'](_0xf67c('0x33'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x34')]);router['get']('/fax/queues/waitinginteractions',auth[_0xf67c('0x6')](),controller[_0xf67c('0x35')]);router['post'](_0xf67c('0x36'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x37')](_0xf67c('0x38')));router[_0xf67c('0x5')](_0xf67c('0x39'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x3a')]);router[_0xf67c('0x3b')](_0xf67c('0x3c'),auth['isAuthenticated'](),controller[_0xf67c('0x37')](_0xf67c('0x3d')));router[_0xf67c('0x5')](_0xf67c('0x3e'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x3f')]);router['post'](_0xf67c('0x40'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x37')](_0xf67c('0x41')));router[_0xf67c('0x5')](_0xf67c('0x42'),auth[_0xf67c('0x6')](),controller['showFaxQueues']);router['post'](_0xf67c('0x43'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x37')](_0xf67c('0x44')));router[_0xf67c('0x5')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0xf67c('0x45')]);router[_0xf67c('0x3b')](_0xf67c('0x46'),auth['isAuthenticated'](),controller['queueNotify'](_0xf67c('0x47')));router[_0xf67c('0x3b')](_0xf67c('0x48'),auth['isAuthenticated'](),controller['queueNotify'](_0xf67c('0x49')));router[_0xf67c('0x5')](_0xf67c('0x4a'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x4b')]);router[_0xf67c('0x5')](_0xf67c('0x4c'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x4d')]);router[_0xf67c('0x3b')](_0xf67c('0x4e'),auth[_0xf67c('0x6')](),controller[_0xf67c('0x4f')]);module[_0xf67c('0x50')]=router; \ No newline at end of file +var _0x3da4=['/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','/trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','showMailQueues','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3da4,0x7e));var _0x43da=function(_0x50c93f,_0x549ec1){_0x50c93f=_0x50c93f-0x0;var _0x362515=_0x3da4[_0x50c93f];return _0x362515;};'use strict';var multer=require(_0x43da('0x0'));var util=require(_0x43da('0x1'));var path=require(_0x43da('0x2'));var express=require(_0x43da('0x3'));var router=express['Router']();var auth=require(_0x43da('0x4'));var controller=require(_0x43da('0x5'));router[_0x43da('0x6')](_0x43da('0x7'),auth['isAuthenticated'](),controller[_0x43da('0x8')]);router[_0x43da('0x6')](_0x43da('0x9'),auth[_0x43da('0xa')](),controller[_0x43da('0xb')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x43da('0xa')](),controller['voiceChannelStopMixMonitor']);router[_0x43da('0x6')]('/voice/queues',auth['isAuthenticated'](),controller[_0x43da('0xc')]);router[_0x43da('0x6')](_0x43da('0xd'),auth['isAuthenticated'](),controller[_0x43da('0xe')]);router['get'](_0x43da('0xf'),auth[_0x43da('0xa')](),controller[_0x43da('0x10')]);router[_0x43da('0x6')]('/mail/accounts',auth[_0x43da('0xa')](),controller[_0x43da('0x11')]);router[_0x43da('0x6')](_0x43da('0x12'),auth[_0x43da('0xa')](),controller[_0x43da('0x13')]);router[_0x43da('0x6')](_0x43da('0x14'),auth[_0x43da('0xa')](),controller[_0x43da('0x15')]);router[_0x43da('0x6')](_0x43da('0x16'),auth['isAuthenticated'](),controller[_0x43da('0x17')]);router['get'](_0x43da('0x18'),auth['isAuthenticated'](),controller[_0x43da('0x19')]);router['get'](_0x43da('0x1a'),auth[_0x43da('0xa')](),controller[_0x43da('0x1b')]);router['get'](_0x43da('0x1c'),auth[_0x43da('0xa')](),controller[_0x43da('0x1d')]);router['get'](_0x43da('0x1e'),auth['isAuthenticated'](),controller[_0x43da('0x1f')]);router[_0x43da('0x6')](_0x43da('0x20'),auth[_0x43da('0xa')](),controller['voiceQueuesChannelHangup']);router[_0x43da('0x6')](_0x43da('0x21'),auth['isAuthenticated'](),controller[_0x43da('0x22')]);router[_0x43da('0x6')](_0x43da('0x23'),auth[_0x43da('0xa')](),controller[_0x43da('0x24')]);router['put'](_0x43da('0x23'),auth[_0x43da('0xa')](),controller[_0x43da('0x25')]);router[_0x43da('0x6')]('/outbound',auth[_0x43da('0xa')](),controller[_0x43da('0x26')]);router[_0x43da('0x6')](_0x43da('0x27'),auth[_0x43da('0xa')](),controller['outboundChannels']);router[_0x43da('0x6')](_0x43da('0x28'),auth['isAuthenticated'](),controller[_0x43da('0x29')]);router[_0x43da('0x2a')]('/agents/:id/capacity',auth[_0x43da('0xa')](),controller[_0x43da('0x2b')]);router[_0x43da('0x6')](_0x43da('0x2c'),auth[_0x43da('0xa')](),controller['telephones']);router[_0x43da('0x6')](_0x43da('0x2d'),auth[_0x43da('0xa')](),controller['trunks']);router[_0x43da('0x6')](_0x43da('0x2e'),auth[_0x43da('0xa')](),controller['campaigns']);router[_0x43da('0x6')]('/fax/accounts',auth[_0x43da('0xa')](),controller[_0x43da('0x2f')]);router[_0x43da('0x6')](_0x43da('0x30'),auth[_0x43da('0xa')](),controller[_0x43da('0x31')]);router[_0x43da('0x6')](_0x43da('0x32'),auth[_0x43da('0xa')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x43da('0x33'),auth['isAuthenticated'](),controller[_0x43da('0x34')]);router[_0x43da('0x6')](_0x43da('0x35'),auth[_0x43da('0xa')](),controller[_0x43da('0x36')]);router[_0x43da('0x6')](_0x43da('0x37'),auth[_0x43da('0xa')](),controller[_0x43da('0x38')]);router[_0x43da('0x6')](_0x43da('0x39'),auth[_0x43da('0xa')](),controller[_0x43da('0x3a')]);router[_0x43da('0x6')](_0x43da('0x3b'),auth[_0x43da('0xa')](),controller[_0x43da('0x3c')]);router[_0x43da('0x3d')]('/mail/queues/:id/notify',auth[_0x43da('0xa')](),controller['queueNotify']('mail'));router['get']('/mail/queues/:id',auth['isAuthenticated'](),controller[_0x43da('0x3e')]);router[_0x43da('0x3d')]('/chat/queues/:id/notify',auth[_0x43da('0xa')](),controller[_0x43da('0x3f')](_0x43da('0x40')));router[_0x43da('0x6')](_0x43da('0x41'),auth[_0x43da('0xa')](),controller[_0x43da('0x42')]);router['post'](_0x43da('0x43'),auth[_0x43da('0xa')](),controller[_0x43da('0x3f')]('fax'));router[_0x43da('0x6')](_0x43da('0x44'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x43da('0x3d')](_0x43da('0x45'),auth[_0x43da('0xa')](),controller[_0x43da('0x3f')](_0x43da('0x46')));router[_0x43da('0x6')](_0x43da('0x47'),auth[_0x43da('0xa')](),controller[_0x43da('0x48')]);router[_0x43da('0x3d')]('/sms/queues/:id/notify',auth[_0x43da('0xa')](),controller[_0x43da('0x3f')]('sms'));router['post']('/whatsapp/queues/:id/notify',auth[_0x43da('0xa')](),controller[_0x43da('0x3f')](_0x43da('0x49')));router['get']('/sms/queues/:id',auth['isAuthenticated'](),controller['showSmsQueues']);router['get'](_0x43da('0x4a'),auth[_0x43da('0xa')](),controller[_0x43da('0x4b')]);router[_0x43da('0x3d')](_0x43da('0x4c'),auth[_0x43da('0xa')](),controller['agentNotify']);module[_0x43da('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 e7b0c1e..2d5471d 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 _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0xf2583b,_0x2dfb00){var _0x5c50fc=function(_0x5f291b){while(--_0x5f291b){_0xf2583b['push'](_0xf2583b['shift']());}};_0x5c50fc(++_0x2dfb00);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xb10b=['showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues'];(function(_0x2d8a23,_0x522080){var _0xd7bce1=function(_0x6adbdd){while(--_0x6adbdd){_0x2d8a23['push'](_0x2d8a23['shift']());}};_0xd7bce1(++_0x522080);}(_0xb10b,0x12a));var _0xbb10=function(_0x57b5d5,_0x25b4ee){_0x57b5d5=_0x57b5d5-0x0;var _0x24e2b5=_0xb10b[_0x57b5d5];return _0x24e2b5;};'use strict';var BPromise=require(_0xbb10('0x0'));var moment=require('moment');var _=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var db=require(_0xbb10('0x3'))['db'];var logger=require('../../config/logger')(_0xbb10('0x4'));var jayson=require(_0xbb10('0x5'));var amiClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232a});var mailClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xbb10('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){var _0x1c3ee5=_0x1b9e94?_0x1b9e94:amiClient;return _0x1c3ee5[_0xbb10('0x8')](_0x3cdd53,_0x513741)[_0xbb10('0x9')](function(_0x229887){if(_0x229887[_0xbb10('0xa')]){if(_0x229887['error']['code']===0x1f4){return _0x21370f(_0x229887[_0xbb10('0xa')][_0xbb10('0xb')]);}return _0x3fb675(_0x229887[_0xbb10('0xa')]['message']);}else{_0x3fb675(_0x229887[_0xbb10('0xc')]);}})['catch'](function(_0x44fb19){_0x21370f(_0x44fb19);});});}function respondWithResult(_0x916a32,_0x285009){_0x285009=_0x285009||0xc8;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0xd')](_0x285009)[_0xbb10('0xe')](_0x193a27);}return _0x916a32['sendStatus'](0x194);};}function handleError(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0x1f4;return function(_0x45b9d6){logger[_0xbb10('0xa')](_0x45b9d6[_0xbb10('0xf')]);if(_0x45b9d6[_0xbb10('0x10')]){delete _0x45b9d6[_0xbb10('0x10')];}_0x26e021[_0xbb10('0xd')](_0x42d7e4)[_0xbb10('0x11')](_0x45b9d6);};}function findById(_0x2b184e){return function(_0x4a2bfc){if(!_[_0xbb10('0x12')](_0x2b184e)&&!_[_0xbb10('0x12')](_0x4a2bfc)&&!_[_0xbb10('0x12')](_0x4a2bfc[_0xbb10('0x13')])){return _[_0xbb10('0x14')](_0x4a2bfc[_0xbb10('0x13')],function(_0x575cca){return _0x575cca['id']==_0x2b184e;});}return null;};}exports[_0xbb10('0x15')]=function(_0xbf2906,_0xe1c665){return respondWithRpcPromise('VoiceChannels',_0xbf2906[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0xe1c665,null))[_0xbb10('0x17')](handleError(_0xe1c665,null));};exports[_0xbb10('0x18')]=function(_0xdf237d,_0x44e563){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbb10('0x19')](_0xdf237d[_0xbb10('0x16')],_0xdf237d['params']))['then'](respondWithResult(_0x44e563,null))[_0xbb10('0x17')](handleError(_0x44e563,null));};exports[_0xbb10('0x1a')]=function(_0x2e911d,_0x317da4){return respondWithRpcPromise(_0xbb10('0x1b'),_[_0xbb10('0x19')](_0x2e911d[_0xbb10('0x16')],_0x2e911d[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x317da4,null))[_0xbb10('0x17')](handleError(_0x317da4,null));};exports[_0xbb10('0x1d')]=function(_0x26ad93,_0x537898){return respondWithRpcPromise('VoiceQueues',_0x26ad93['query'])[_0xbb10('0x9')](respondWithResult(_0x537898,null))[_0xbb10('0x17')](handleError(_0x537898,null));};exports[_0xbb10('0x1e')]=function(_0x4e25ff,_0x2fdde9){return respondWithRpcPromise(_0xbb10('0x1f'),_0x4e25ff[_0xbb10('0x16')])[_0xbb10('0x9')](findById(_0x4e25ff[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x2fdde9,null))[_0xbb10('0x17')](handleError(_0x2fdde9,null));};exports['updateVoiceQueue']=function(_0x3796c7,_0x21ac54){return respondWithRpcPromise(_0xbb10('0x20'),_[_0xbb10('0x19')](_0x3796c7[_0xbb10('0x21')],_0x3796c7[_0xbb10('0x1c')]))['then'](respondWithResult(_0x21ac54,null))[_0xbb10('0x17')](handleError(_0x21ac54,null));};exports['voiceQueuesPreview']=function(_0x448d5c,_0x56f2da){return respondWithRpcPromise(_0xbb10('0x22'),_[_0xbb10('0x19')](_0x448d5c[_0xbb10('0x16')],_0x448d5c['params']))['then'](respondWithResult(_0x56f2da,null))[_0xbb10('0x17')](handleError(_0x56f2da,null));};exports[_0xbb10('0x23')]=function(_0x4f590d,_0x359ad4){return respondWithRpcPromise(_0xbb10('0x24'),_0x4f590d[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x359ad4,null))[_0xbb10('0x17')](handleError(_0x359ad4,null));};exports[_0xbb10('0x25')]=function(_0xf85197,_0x4975f5){return respondWithRpcPromise(_0xbb10('0x26'),_[_0xbb10('0x19')](_0xf85197[_0xbb10('0x16')],_0xf85197[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4975f5,null))[_0xbb10('0x17')](handleError(_0x4975f5,null));};exports[_0xbb10('0x27')]=function(_0x10202c,_0x3c8d7d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xbb10('0x19')](_0x10202c[_0xbb10('0x16')],_0x10202c[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x3c8d7d,null))['catch'](handleError(_0x3c8d7d,null));};exports[_0xbb10('0x28')]=function(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x29'),_[_0xbb10('0x19')](_0x5de37b[_0xbb10('0x16')],_0x5de37b[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4e2754,null))[_0xbb10('0x17')](handleError(_0x4e2754,null));};exports['outbound']=function(_0x1e5bbd,_0x25d72f){return respondWithRpcPromise('Outbound',_0x1e5bbd['query'])['then'](respondWithResult(_0x25d72f,null))[_0xbb10('0x17')](handleError(_0x25d72f,null));};exports[_0xbb10('0x2a')]=function(_0x2b658a,_0x4d5a9b){return respondWithRpcPromise(_0xbb10('0x2b'),_0x2b658a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4d5a9b,null))['catch'](handleError(_0x4d5a9b,null));};exports[_0xbb10('0x2c')]=function(_0x12238a,_0x1dcd38){var _0x446f49;return respondWithRpcPromise('Agents',_0x12238a[_0xbb10('0x16')])[_0xbb10('0x9')](function(_0x5835fd){_0x446f49=_0x5835fd;return respondWithRpcPromise(_0xbb10('0x2d'),_0x12238a[_0xbb10('0x16')],routingClient);})[_0xbb10('0x9')](function(_0x3a9934){return _[_0xbb10('0x19')]({},_0x3a9934,_0x446f49);})[_0xbb10('0x9')](respondWithResult(_0x1dcd38,null))['catch'](handleError(_0x1dcd38,null));};exports[_0xbb10('0x2e')]=function(_0x1c7fae,_0x3e7b4c){if(_0x1c7fae[_0xbb10('0x21')]&&_0x1c7fae['body'][_0xbb10('0x2f')]&&_0x1c7fae[_0xbb10('0x30')]&&_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]){for(var _0x5e2cfa in _0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')]){if(_0x1c7fae['body']['interaction'][_0xbb10('0x31')](_0x5e2cfa)){db['MemberReport'][_0xbb10('0x32')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')]['name'],'type':_0xbb10('0x33'),'exitAt':null,'uniqueid':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]&&_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0xbb10('0x34')]?{'$notIn':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]}:{'$ne':null}}})[_0xbb10('0x9')](function(_0x19f94d){var _0x190781=moment()[_0xbb10('0x35')](_0xbb10('0x36'));for(var _0x43b948=0x0,_0x197871=_0x19f94d[_0xbb10('0x34')];_0x43b948<_0x197871;_0x43b948+=0x1){_0x19f94d[_0x43b948]['updateAttributes']({'exitAt':_0x190781});}});for(var _0x426b95=0x0;_0x426b95<_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0xbb10('0x34')];_0x426b95+=0x1){db[_0xbb10('0x37')][_0xbb10('0x38')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')],'type':_0xbb10('0x33'),'uniqueid':_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0x426b95],'exitAt':null},'defaults':{'channel':_0x5e2cfa,'membername':_0x1c7fae['user'][_0xbb10('0x10')],'interface':_[_0xbb10('0x12')](_0x1c7fae[_0xbb10('0x30')]['interface'])?util['format'](_0xbb10('0x39'),_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]):_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x3a')],'type':_0xbb10('0x33'),'enterAt':moment()[_0xbb10('0x35')](_0xbb10('0x36')),'role':_0xbb10('0x3b'),'internal':_0x1c7fae[_0xbb10('0x30')]['internal'],'uniqueid':_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0x426b95]}});}}}}return respondWithRpcPromise(_0xbb10('0x3c'),{'id':_0x1c7fae[_0xbb10('0x1c')]['id'],'capacity':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x3d')]},routingClient)[_0xbb10('0x9')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x17')](handleError(_0x3e7b4c,null));};exports[_0xbb10('0x3e')]=function(_0x1c0d8f,_0x1214f7){return respondWithRpcPromise(_0xbb10('0x3f'),_0x1c0d8f[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x1214f7,null))[_0xbb10('0x17')](handleError(_0x1214f7,null));};exports[_0xbb10('0x40')]=function(_0x547a7a,_0x124052){return respondWithRpcPromise('Trunks',_0x547a7a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x124052,null))[_0xbb10('0x17')](handleError(_0x124052,null));};exports[_0xbb10('0x41')]=function(_0x26e66e,_0x32d8e9){return respondWithRpcPromise(_0xbb10('0x42'),_0x26e66e[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x32d8e9,null))[_0xbb10('0x17')](handleError(_0x32d8e9,null));};exports[_0xbb10('0x43')]=function(_0x1c2dce,_0x1d49e1){return respondWithRpcPromise(_0xbb10('0x44'),_0x1c2dce[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d49e1,null))[_0xbb10('0x17')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x45')]=function(_0x1b83a9,_0x4ce8e7){return respondWithRpcPromise(_0xbb10('0x44'),_0x1b83a9[_0xbb10('0x16')],routingClient)['then'](findById(_0x1b83a9[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x4ce8e7,null))[_0xbb10('0x17')](handleError(_0x4ce8e7,null));};exports[_0xbb10('0x46')]=function(_0x432728,_0x22de7f){return respondWithRpcPromise(_0xbb10('0x47'),_0x432728[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x22de7f,null))[_0xbb10('0x17')](handleError(_0x22de7f,null));};exports[_0xbb10('0x48')]=function(_0x2a1ce1,_0x16932f){return respondWithRpcPromise('MailQueues',_0x2a1ce1['query'],routingClient)[_0xbb10('0x9')](findById(_0x2a1ce1[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x16932f,null))[_0xbb10('0x17')](handleError(_0x16932f,null));};exports['mailAccounts']=function(_0x506498,_0x79411e){return respondWithRpcPromise(_0xbb10('0x49'),_0x506498[_0xbb10('0x16')],mailClient)[_0xbb10('0x9')](respondWithResult(_0x79411e,null))[_0xbb10('0x17')](handleError(_0x79411e,null));};exports[_0xbb10('0x4a')]=function(_0x45c0dc,_0x4a5fb9){return respondWithRpcPromise(_0xbb10('0x4b'),_0x45c0dc[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x4a5fb9,null))['catch'](handleError(_0x4a5fb9,null));};exports['showOpenchannelQueues']=function(_0x32c1e8,_0x31c727){return respondWithRpcPromise(_0xbb10('0x4b'),_0x32c1e8['query'],routingClient)['then'](findById(_0x32c1e8['params']['id']))[_0xbb10('0x9')](respondWithResult(_0x31c727,null))[_0xbb10('0x17')](handleError(_0x31c727,null));};exports[_0xbb10('0x4c')]=function(_0x4e9fbd,_0xa1bbd9){return respondWithRpcPromise(_0xbb10('0x4d'),_0x4e9fbd['query'],routingClient)['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x17')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x4e')]=function(_0xd77753,_0x237246){return respondWithRpcPromise('SmsQueues',_0xd77753[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](findById(_0xd77753[_0xbb10('0x1c')]['id']))['then'](respondWithResult(_0x237246,null))[_0xbb10('0x17')](handleError(_0x237246,null));};exports[_0xbb10('0x4f')]=function(_0x3e3617,_0x5b2bd4){return respondWithRpcPromise(_0xbb10('0x50'),_0x3e3617[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x17')](handleError(_0x5b2bd4,null));};exports['showWhatsappQueues']=function(_0x251417,_0x258e55){return respondWithRpcPromise(_0xbb10('0x50'),_0x251417[_0xbb10('0x16')],routingClient)['then'](findById(_0x251417[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x258e55,null))[_0xbb10('0x17')](handleError(_0x258e55,null));};exports[_0xbb10('0x51')]=function(_0x12f750,_0x17807e){return respondWithRpcPromise(_0xbb10('0x52'),_0x12f750['query'],routingClient)['then'](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0xbb10('0x53')]=function(_0x9c672d,_0x3eda96){return respondWithRpcPromise('FaxQueues',_0x9c672d['query'],routingClient)[_0xbb10('0x9')](findById(_0x9c672d[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x3eda96,null))[_0xbb10('0x17')](handleError(_0x3eda96,null));};exports[_0xbb10('0x54')]=function(_0x1ad2ed,_0x4cf2f3){return respondWithRpcPromise(_0xbb10('0x55'),_0x1ad2ed[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4cf2f3,null))[_0xbb10('0x17')](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x56')]=function(_0x5bfc68,_0x56094a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5bfc68[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x56094a,null))[_0xbb10('0x17')](handleError(_0x56094a,null));};exports[_0xbb10('0x57')]=function(_0x2f7d2a,_0x1d40b8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f7d2a[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d40b8,null))['catch'](handleError(_0x1d40b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xdf634f,_0x13040d){return respondWithRpcPromise(_0xbb10('0x58'),_0xdf634f[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x13040d,null))[_0xbb10('0x17')](handleError(_0x13040d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x576179,_0x165fe9){return respondWithRpcPromise(_0xbb10('0x58'),_0x576179[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](function(_0xfa3c7c){if(_0x576179['query'][_0xbb10('0x59')]!==undefined){var _0x19fcec=_(_0xfa3c7c[_0xbb10('0x13')])[_0xbb10('0x5a')]([_0x576179[_0xbb10('0x16')][_0xbb10('0x59')],_0x576179[_0xbb10('0x1c')]['id']])['map'](_0xbb10('0x5b'))[_0xbb10('0x5c')]()[_0xbb10('0x5d')]();return _0xfa3c7c[_0xbb10('0x13')][_0xbb10('0x5a')](function(_0x172be3){return _0x19fcec[_0xbb10('0x5e')](_0x172be3[_0xbb10('0x5b')])>-0x1;});}else{return _0xfa3c7c['rows'][_0xbb10('0x5a')](function(_0x218690){return _0x218690[_0xbb10('0x5b')]===parseInt(_0x576179['params']['id']);});}})['then'](respondWithResult(_0x165fe9,null))['catch'](handleError(_0x165fe9,null));};exports[_0xbb10('0x5f')]=function(_0x5a3c44,_0x4e3d6a){return respondWithRpcPromise(_0xbb10('0x60'),_0x5a3c44[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x4e3d6a,null))[_0xbb10('0x17')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x61')]=function(_0x24dca6,_0x33116){return respondWithRpcPromise(_0xbb10('0x62'),_0x24dca6[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x33116,null))[_0xbb10('0x17')](handleError(_0x33116,null));};exports[_0xbb10('0x63')]=function(_0x46b6d2,_0x35b811){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x46b6d2['query'],routingClient)[_0xbb10('0x9')](respondWithResult(_0x35b811,null))[_0xbb10('0x17')](handleError(_0x35b811,null));};exports[_0xbb10('0x64')]=function(_0x32bb25){return function(_0x5ee705,_0x17d596){var _0x275bce,_0x3f0d74;var _0xf7b3e1=_[_0xbb10('0x65')](_0x32bb25);var _0x517185=_0x32bb25==='chat'?_0xbb10('0x66'):_0xbb10('0x67');return db[_0xf7b3e1+_0xbb10('0x68')]['findOne']({'raw':!![],'where':{'id':_0x5ee705[_0xbb10('0x1c')]['id']}})[_0xbb10('0x9')](function(_0x50bcc9){if(_['isNil'](_0x50bcc9)){throw new Error(_0xf7b3e1+_0xbb10('0x69'));}_0x275bce=_0x50bcc9;return db[_0xf7b3e1+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x5ee705['body'][_0xbb10('0x6c')]},'include':[{'model':db[_0xf7b3e1+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xf7b3e1+_0x517185],'as':_0xbb10('0x67')}]});})[_0xbb10('0x9')](function(_0x5de006){if(_[_0xbb10('0x12')](_0x5de006)){throw new Error(_0xf7b3e1+_0xbb10('0x6e'));}_0x3f0d74=_0x5de006;return _0x5de006[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3367d4={'uniqueid':_0x32bb25+'.'+_0x3f0d74['id']+'.'+_0x3f0d74[_0xbb10('0x6d')]['id'],'FromUserId':_0x5ee705[_0xbb10('0x30')]['id'],'type':_0xbb10('0x70')};_0x3367d4[_0xf7b3e1+_0xbb10('0x71')]=_0x3f0d74['id'];_0x3367d4[_0xf7b3e1+_0xbb10('0x72')]=_0x3f0d74[_0xbb10('0x6d')]['id'];_0x3367d4[_0xbb10('0x73')+_0xf7b3e1+_0x517185+'Id']=_0x3f0d74[_0xbb10('0x67')]['id'];_0x3367d4['To'+_0xf7b3e1+_0xbb10('0x74')]=_0x275bce['id'];return db[_0xf7b3e1+_0xbb10('0x75')][_0xbb10('0x76')](_0x3367d4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x32bb25,'interaction':_0x3f0d74[_0xbb10('0x6d')],'message':_0x3f0d74,'account':_0x3f0d74[_0xbb10('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x70'),'appdata':_0x275bce[_0xbb10('0x10')]+','+(_0x3f0d74[_0xbb10('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x17d596,null))[_0xbb10('0x17')](handleError(_0x17d596,null));};};exports[_0xbb10('0x78')]=function(_0x19694d,_0x379d49){var _0x546db5,_0xb25e71;if(_[_0xbb10('0x12')](_0x19694d['body'][_0xbb10('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xc53c87=_0x19694d[_0xbb10('0x21')][_0xbb10('0x79')];var _0xa99bf5=_[_0xbb10('0x65')](_0xc53c87);var _0x556d7b=_0xc53c87===_0xbb10('0x7a')?'Website':_0xbb10('0x67');return db[_0xbb10('0x7b')]['findOne']({'raw':!![],'where':{'id':_0x19694d['params']['id'],'role':_0xbb10('0x3b')}})[_0xbb10('0x9')](function(_0x1b77c2){if(_[_0xbb10('0x12')](_0x1b77c2)){throw new Error(_0xbb10('0x7c'));}_0x546db5=_0x1b77c2;return db[_0xa99bf5+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x19694d[_0xbb10('0x21')][_0xbb10('0x6c')]},'include':[{'model':db[_0xa99bf5+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xa99bf5+_0x556d7b],'as':'Account'}]});})[_0xbb10('0x9')](function(_0x3eeceb){if(_[_0xbb10('0x12')](_0x3eeceb)){throw new Error(_0xa99bf5+_0xbb10('0x6e'));}_0xb25e71=_0x3eeceb;return _0x3eeceb[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbb10('0x9')](function(){var _0xfefa17={'uniqueid':_0xc53c87+'.'+_0xb25e71['id']+'.'+_0xb25e71[_0xbb10('0x6d')]['id'],'FromUserId':_0x19694d[_0xbb10('0x30')]['id'],'type':_0xbb10('0x3b'),'ToUserId':_0x546db5['id']};_0xfefa17[_0xa99bf5+_0xbb10('0x71')]=_0xb25e71['id'];_0xfefa17[_0xa99bf5+_0xbb10('0x72')]=_0xb25e71['Interaction']['id'];_0xfefa17[_0xbb10('0x73')+_0xa99bf5+_0x556d7b+'Id']=_0xb25e71['Account']['id'];return db[_0xa99bf5+_0xbb10('0x75')][_0xbb10('0x76')](_0xfefa17);})[_0xbb10('0x9')](function(){return respondWithRpcPromise(_0xbb10('0x7d'),{'channel':_0xc53c87,'interaction':_0xb25e71[_0xbb10('0x6d')],'message':_0xb25e71,'account':_0xb25e71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x3b'),'appdata':_0x546db5[_0xbb10('0x10')]+','+(_0xb25e71[_0xbb10('0x67')][_0xbb10('0x7e')]||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x379d49,null))['catch'](handleError(_0x379d49,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 88c46ea..cd895f8 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 _0xb65f=['../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xdbff26,_0xfc8995){var _0x4adb23=function(_0x291780){while(--_0x291780){_0xdbff26['push'](_0xdbff26['shift']());}};_0x4adb23(++_0xfc8995);}(_0xb65f,0x126));var _0xfb65=function(_0x5d60d1,_0x325ad0){_0x5d60d1=_0x5d60d1-0x0;var _0x5e94a7=_0xb65f[_0x5d60d1];return _0x5e94a7;};'use strict';var multer=require('multer');var util=require(_0xfb65('0x0'));var path=require(_0xfb65('0x1'));var timeout=require(_0xfb65('0x2'));var express=require(_0xfb65('0x3'));var router=express['Router']();var fs_extra=require(_0xfb65('0x4'));var auth=require(_0xfb65('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfb65('0x6'));var controller=require(_0xfb65('0x7'));router[_0xfb65('0x8')]('/',auth[_0xfb65('0x9')](),controller['index']);router['get'](_0xfb65('0xa'),auth[_0xfb65('0x9')](),controller[_0xfb65('0xb')]);router[_0xfb65('0x8')](_0xfb65('0xc'),auth[_0xfb65('0x9')](),controller[_0xfb65('0xd')]);router[_0xfb65('0xe')]('/',auth[_0xfb65('0x9')](),controller[_0xfb65('0xf')]);router[_0xfb65('0x10')](_0xfb65('0xa'),auth[_0xfb65('0x9')](),controller['update']);router[_0xfb65('0x11')](_0xfb65('0xa'),auth['isAuthenticated'](),controller[_0xfb65('0x12')]);module[_0xfb65('0x13')]=router; \ No newline at end of file +var _0xbf32=['path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/run','run','post','create','put','update','delete','destroy','exports'];(function(_0x3492b3,_0x952ecd){var _0x30dd2c=function(_0x2b189b){while(--_0x2b189b){_0x3492b3['push'](_0x3492b3['shift']());}};_0x30dd2c(++_0x952ecd);}(_0xbf32,0x190));var _0x2bf3=function(_0x25249f,_0x1f95e6){_0x25249f=_0x25249f-0x0;var _0x219846=_0xbf32[_0x25249f];return _0x219846;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2bf3('0x0'));var timeout=require(_0x2bf3('0x1'));var express=require(_0x2bf3('0x2'));var router=express[_0x2bf3('0x3')]();var fs_extra=require(_0x2bf3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2bf3('0x5'));var controller=require('./schedule.controller');router['get']('/',auth[_0x2bf3('0x6')](),controller[_0x2bf3('0x7')]);router['get'](_0x2bf3('0x8'),auth[_0x2bf3('0x6')](),controller[_0x2bf3('0x9')]);router[_0x2bf3('0xa')](_0x2bf3('0xb'),auth[_0x2bf3('0x6')](),controller[_0x2bf3('0xc')]);router[_0x2bf3('0xd')]('/',auth[_0x2bf3('0x6')](),controller[_0x2bf3('0xe')]);router[_0x2bf3('0xf')](_0x2bf3('0x8'),auth[_0x2bf3('0x6')](),controller[_0x2bf3('0x10')]);router[_0x2bf3('0x11')](_0x2bf3('0x8'),auth[_0x2bf3('0x6')](),controller[_0x2bf3('0x12')]);module[_0x2bf3('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b3adad6..68b5986 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 _0x5cf8=['ENUM','quarters','months','weeks','minutes','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE'];(function(_0x41221d,_0xc4cd84){var _0x58ca14=function(_0x38b0dc){while(--_0x38b0dc){_0x41221d['push'](_0x41221d['shift']());}};_0x58ca14(++_0xc4cd84);}(_0x5cf8,0x1b5));var _0x85cf=function(_0x1439e6,_0x2634b8){_0x1439e6=_0x1439e6-0x0;var _0x1101a9=_0x5cf8[_0x1439e6];return _0x1101a9;};'use strict';var Sequelize=require(_0x85cf('0x0'));module[_0x85cf('0x1')]={'name':{'type':Sequelize[_0x85cf('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x85cf('0x3')},'startAt':{'type':Sequelize[_0x85cf('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x85cf('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x85cf('0x5')]('years',_0x85cf('0x6'),_0x85cf('0x7'),_0x85cf('0x8'),'days','hours',_0x85cf('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x85cf('0x5')](_0x85cf('0xa'),_0x85cf('0xb'),_0x85cf('0xc')),'allowNull':![],'defaultValue':_0x85cf('0xa')},'type':{'type':Sequelize[_0x85cf('0x5')](_0x85cf('0xd'),_0x85cf('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x85cf('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0x85cf('0x2')]},'cc':{'type':Sequelize[_0x85cf('0x10')]},'bcc':{'type':Sequelize[_0x85cf('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x85cf('0xf')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe716=['weeks','days','hours','minutes','ENUM','csv','pdf','custom','TEXT','sequelize','STRING','BOOLEAN','DATE','years','quarters'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xe716,0x18f));var _0x6e71=function(_0x34b42e,_0x5c5533){_0x34b42e=_0x34b42e-0x0;var _0x2b69b7=_0xe716[_0x34b42e];return _0x2b69b7;};'use strict';var Sequelize=require(_0x6e71('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6e71('0x1')]},'active':{'type':Sequelize[_0x6e71('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6e71('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x6e71('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x6e71('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x6e71('0x4'),_0x6e71('0x5'),'months',_0x6e71('0x6'),_0x6e71('0x7'),_0x6e71('0x8'),_0x6e71('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x6e71('0xa')](_0x6e71('0xb'),_0x6e71('0xc'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x6e71('0xa')]('custom','default'),'allowNull':![],'defaultValue':_0x6e71('0xd')},'sendMail':{'type':Sequelize[_0x6e71('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x6e71('0xe')]},'sendIfEmpty':{'type':Sequelize[_0x6e71('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 364520a..58ec846 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 _0xa889=['show','keys','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa889,0x64));var _0x9a88=function(_0x5674ed,_0x460022){_0x5674ed=_0x5674ed-0x0;var _0x2b60d5=_0xa889[_0x5674ed];return _0x2b60d5;};'use strict';var emlformat=require(_0x9a88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a88('0x1'));var jsonpatch=require(_0x9a88('0x2'));var rp=require(_0x9a88('0x3'));var moment=require('moment');var BPromise=require(_0x9a88('0x4'));var Mustache=require(_0x9a88('0x5'));var util=require(_0x9a88('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9a88('0x7'));var ejs=require(_0x9a88('0x8'));var fs=require('fs');var fs_extra=require(_0x9a88('0x9'));var _=require(_0x9a88('0xa'));var squel=require(_0x9a88('0xb'));var crypto=require('crypto');var jsforce=require(_0x9a88('0xc'));var deskjs=require(_0x9a88('0xd'));var toCsv=require(_0x9a88('0x7'));var querystring=require(_0x9a88('0xe'));var Papa=require(_0x9a88('0xf'));var Redis=require(_0x9a88('0x10'));var authService=require(_0x9a88('0x11'));var qs=require(_0x9a88('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a88('0x13'));var logger=require(_0x9a88('0x14'))(_0x9a88('0x15'));var utils=require(_0x9a88('0x16'));var config=require(_0x9a88('0x17'));var licenseUtil=require(_0x9a88('0x18'));var db=require(_0x9a88('0x19'))['db'];function respondWithStatusCode(_0x148709,_0x425891){_0x425891=_0x425891||0xcc;return function(_0x412add){if(_0x412add){return _0x148709[_0x9a88('0x1a')](_0x425891);}return _0x148709[_0x9a88('0x1b')](_0x425891)[_0x9a88('0x1c')]();};}function respondWithResult(_0x283370,_0x5aa725){_0x5aa725=_0x5aa725||0xc8;return function(_0x22e2be){if(_0x22e2be){return _0x283370[_0x9a88('0x1b')](_0x5aa725)['json'](_0x22e2be);}};}function respondWithFilteredResult(_0x147b25,_0x756571){return function(_0xbcbee6){if(_0xbcbee6){var _0x8188ec=typeof _0x756571[_0x9a88('0x1d')]===_0x9a88('0x1e')&&typeof _0x756571[_0x9a88('0x1f')]===_0x9a88('0x1e');var _0x1534fb=_0xbcbee6[_0x9a88('0x20')];var _0x31290a=_0x8188ec?0x0:_0x756571['offset'];var _0x2c7b7f=_0x8188ec?_0xbcbee6[_0x9a88('0x20')]:_0x756571['offset']+_0x756571[_0x9a88('0x1f')];var _0x50393f;if(_0x2c7b7f>=_0x1534fb){_0x2c7b7f=_0x1534fb;_0x50393f=0xc8;}else{_0x50393f=0xce;}_0x147b25[_0x9a88('0x1b')](_0x50393f);return _0x147b25[_0x9a88('0x21')](_0x9a88('0x22'),_0x31290a+'-'+_0x2c7b7f+'/'+_0x1534fb)['json'](_0xbcbee6);}return null;};}function patchUpdates(_0x42076c){return function(_0x1a8a7b){try{jsonpatch[_0x9a88('0x23')](_0x1a8a7b,_0x42076c,!![]);}catch(_0xba3d38){return BPromise[_0x9a88('0x24')](_0xba3d38);}return _0x1a8a7b[_0x9a88('0x25')]();};}function saveUpdates(_0xa4776c,_0x199008){return function(_0x42e285){if(_0x42e285){return _0x42e285[_0x9a88('0x26')](_0xa4776c)['then'](function(_0x5585fe){return _0x5585fe;});}return null;};}function removeEntity(_0x49f927,_0x3a243e){return function(_0x4295a9){if(_0x4295a9){return _0x4295a9[_0x9a88('0x27')]()[_0x9a88('0x28')](function(){var _0x33666b=_0x4295a9[_0x9a88('0x29')]({'plain':!![]});var _0x5d33b4='Scheduler';return db[_0x9a88('0x2a')]['destroy']({'where':{'type':_0x5d33b4,'resourceId':_0x33666b['id']}})[_0x9a88('0x28')](function(){return _0x4295a9;});})[_0x9a88('0x28')](function(){_0x49f927[_0x9a88('0x1b')](0xcc)[_0x9a88('0x1c')]();});}};}function handleEntityNotFound(_0x59dd0b,_0x4c5d18){return function(_0x2494bb){if(!_0x2494bb){_0x59dd0b[_0x9a88('0x1a')](0x194);}return _0x2494bb;};}function handleError(_0x27d438,_0x45e258){_0x45e258=_0x45e258||0x1f4;return function(_0x340ee3){logger[_0x9a88('0x2b')](_0x340ee3['stack']);if(_0x340ee3['name']){delete _0x340ee3['name'];}_0x27d438[_0x9a88('0x1b')](_0x45e258)[_0x9a88('0x2c')](_0x340ee3);};}exports[_0x9a88('0x2d')]=function(_0x16bcab,_0x4c8355){var _0x6d1c2a={},_0x259515={},_0x56f55f={'count':0x0,'rows':[]};var _0x8ae0ce=_[_0x9a88('0x2e')](db[_0x9a88('0x2f')][_0x9a88('0x30')],function(_0x3cd7c3){return{'name':_0x3cd7c3[_0x9a88('0x31')],'type':_0x3cd7c3[_0x9a88('0x32')][_0x9a88('0x33')]};});_0x259515[_0x9a88('0x34')]=_[_0x9a88('0x2e')](_0x8ae0ce,_0x9a88('0x35'));_0x259515[_0x9a88('0x36')]=_['keys'](_0x16bcab[_0x9a88('0x36')]);_0x259515['filters']=_[_0x9a88('0x37')](_0x259515[_0x9a88('0x34')],_0x259515[_0x9a88('0x36')]);_0x6d1c2a['attributes']=_[_0x9a88('0x37')](_0x259515[_0x9a88('0x34')],qs['fields'](_0x16bcab[_0x9a88('0x36')][_0x9a88('0x38')]));_0x6d1c2a[_0x9a88('0x39')]=_0x6d1c2a[_0x9a88('0x39')][_0x9a88('0x3a')]?_0x6d1c2a['attributes']:_0x259515['model'];if(!_0x16bcab['query'][_0x9a88('0x3b')](_0x9a88('0x3c'))){_0x6d1c2a[_0x9a88('0x1f')]=qs[_0x9a88('0x1f')](_0x16bcab[_0x9a88('0x36')][_0x9a88('0x1f')]);_0x6d1c2a[_0x9a88('0x1d')]=qs[_0x9a88('0x1d')](_0x16bcab['query'][_0x9a88('0x1d')]);}_0x6d1c2a[_0x9a88('0x3d')]=qs[_0x9a88('0x3e')](_0x16bcab['query'][_0x9a88('0x3e')]);_0x6d1c2a[_0x9a88('0x3f')]=qs['filters'](_[_0x9a88('0x40')](_0x16bcab[_0x9a88('0x36')],_0x259515[_0x9a88('0x41')]),_0x8ae0ce);if(_0x16bcab['query'][_0x9a88('0x42')]){_0x6d1c2a[_0x9a88('0x3f')]=_[_0x9a88('0x43')](_0x6d1c2a[_0x9a88('0x3f')],{'$or':_['map'](_0x8ae0ce,function(_0xa7e6ea){if(_0xa7e6ea[_0x9a88('0x32')]!=='VIRTUAL'){var _0x4c91e9={};_0x4c91e9[_0xa7e6ea['name']]={'$like':'%'+_0x16bcab['query']['filter']+'%'};return _0x4c91e9;}})});}_0x6d1c2a=_[_0x9a88('0x43')]({},_0x6d1c2a,_0x16bcab[_0x9a88('0x44')]);var _0x25cbbd={'where':_0x6d1c2a['where']};return db[_0x9a88('0x2f')][_0x9a88('0x20')](_0x25cbbd)[_0x9a88('0x28')](function(_0x334fb6){_0x56f55f[_0x9a88('0x20')]=_0x334fb6;if(_0x16bcab[_0x9a88('0x36')][_0x9a88('0x45')]){_0x6d1c2a[_0x9a88('0x46')]=[{'all':!![]}];}return db[_0x9a88('0x2f')][_0x9a88('0x47')](_0x6d1c2a);})[_0x9a88('0x28')](function(_0x1504c3){_0x56f55f[_0x9a88('0x48')]=_0x1504c3;return _0x56f55f;})['then'](respondWithFilteredResult(_0x4c8355,_0x6d1c2a))[_0x9a88('0x49')](handleError(_0x4c8355,null));};exports[_0x9a88('0x4a')]=function(_0x11035b,_0x41e2df){var _0x18f6c1={'raw':![],'where':{'id':_0x11035b['params']['id']}},_0x26d798={};_0x26d798['model']=_[_0x9a88('0x4b')](db['Schedule'][_0x9a88('0x30')]);_0x26d798['query']=_[_0x9a88('0x4b')](_0x11035b[_0x9a88('0x36')]);_0x26d798[_0x9a88('0x41')]=_[_0x9a88('0x37')](_0x26d798[_0x9a88('0x34')],_0x26d798['query']);_0x18f6c1[_0x9a88('0x39')]=_[_0x9a88('0x37')](_0x26d798[_0x9a88('0x34')],qs[_0x9a88('0x38')](_0x11035b[_0x9a88('0x36')][_0x9a88('0x38')]));_0x18f6c1[_0x9a88('0x39')]=_0x18f6c1[_0x9a88('0x39')][_0x9a88('0x3a')]?_0x18f6c1[_0x9a88('0x39')]:_0x26d798[_0x9a88('0x34')];if(_0x11035b[_0x9a88('0x36')]['includeAll']){_0x18f6c1[_0x9a88('0x46')]=[{'all':!![]}];}_0x18f6c1=_[_0x9a88('0x43')]({},_0x18f6c1,_0x11035b[_0x9a88('0x44')]);return db['Schedule'][_0x9a88('0x4c')](_0x18f6c1)['then'](handleEntityNotFound(_0x41e2df,null))['then'](respondWithResult(_0x41e2df,null))[_0x9a88('0x49')](handleError(_0x41e2df,null));};exports[_0x9a88('0x4d')]=function(_0xff211d,_0x4afd96){return db[_0x9a88('0x2f')][_0x9a88('0x4d')](_0xff211d[_0x9a88('0x4e')],{})[_0x9a88('0x28')](function(_0x4bdfe2){var _0x39f87b=_0xff211d['user']['get']({'plain':!![]});if(!_0x39f87b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39f87b[_0x9a88('0x4f')]===_0x9a88('0x50')){var _0x5bbe47=_0x4bdfe2[_0x9a88('0x29')]({'plain':!![]});var _0x1a7d5a='Scheduler';return db[_0x9a88('0x51')][_0x9a88('0x4c')]({'where':{'name':_0x1a7d5a,'userProfileId':_0x39f87b[_0x9a88('0x52')]},'raw':!![]})[_0x9a88('0x28')](function(_0x2297c9){if(_0x2297c9&&_0x2297c9['autoAssociation']===0x0){return db[_0x9a88('0x2a')][_0x9a88('0x4d')]({'name':_0x5bbe47[_0x9a88('0x35')],'resourceId':_0x5bbe47['id'],'type':_0x2297c9['name'],'sectionId':_0x2297c9['id']},{})[_0x9a88('0x28')](function(){return _0x4bdfe2;});}else{return _0x4bdfe2;}})[_0x9a88('0x49')](function(_0x4b4b5c){logger[_0x9a88('0x2b')](_0x9a88('0x53'),_0x4b4b5c);throw _0x4b4b5c;});}return _0x4bdfe2;})['then'](respondWithResult(_0x4afd96,0xc9))[_0x9a88('0x49')](handleError(_0x4afd96,null));};exports[_0x9a88('0x26')]=function(_0x2034cb,_0x4b41a5){if(_0x2034cb[_0x9a88('0x4e')]['id']){delete _0x2034cb[_0x9a88('0x4e')]['id'];}return db[_0x9a88('0x2f')][_0x9a88('0x4c')]({'where':{'id':_0x2034cb[_0x9a88('0x54')]['id']}})[_0x9a88('0x28')](handleEntityNotFound(_0x4b41a5,null))[_0x9a88('0x28')](saveUpdates(_0x2034cb[_0x9a88('0x4e')],null))[_0x9a88('0x28')](respondWithResult(_0x4b41a5,null))['catch'](handleError(_0x4b41a5,null));};exports[_0x9a88('0x27')]=function(_0x1bec1d,_0x175b71){return db[_0x9a88('0x2f')][_0x9a88('0x4c')]({'where':{'id':_0x1bec1d['params']['id']}})[_0x9a88('0x28')](handleEntityNotFound(_0x175b71,null))[_0x9a88('0x28')](removeEntity(_0x175b71,null))[_0x9a88('0x49')](handleError(_0x175b71,null));};exports[_0x9a88('0x55')]=function(_0x4079de,_0x53bb8b,_0x195372){var _0x2ec88c=require(_0x9a88('0x56'));return db[_0x9a88('0x2f')][_0x9a88('0x4c')]({'where':{'id':_0x4079de[_0x9a88('0x54')]['id']},'raw':!![]})[_0x9a88('0x28')](handleEntityNotFound(_0x53bb8b,null))[_0x9a88('0x28')](function(){_0x2ec88c[_0x9a88('0x55')](_0x4079de[_0x9a88('0x54')]['id']);})[_0x9a88('0x28')](respondWithStatusCode(_0x53bb8b,null))['catch'](handleError(_0x53bb8b,null));}; \ No newline at end of file +var _0xbc10=['lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','Schedule','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','run','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra'];(function(_0x6d02f6,_0x21e16f){var _0x372791=function(_0x102a2a){while(--_0x102a2a){_0x6d02f6['push'](_0x6d02f6['shift']());}};_0x372791(++_0x21e16f);}(_0xbc10,0x13a));var _0x0bc1=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xbc10[_0x5e3b04];return _0x1fc44d;};'use strict';var emlformat=require(_0x0bc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0bc1('0x1'));var jsonpatch=require(_0x0bc1('0x2'));var rp=require(_0x0bc1('0x3'));var moment=require(_0x0bc1('0x4'));var BPromise=require(_0x0bc1('0x5'));var Mustache=require(_0x0bc1('0x6'));var util=require(_0x0bc1('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bc1('0x8'));var fs=require('fs');var fs_extra=require(_0x0bc1('0x9'));var _=require(_0x0bc1('0xa'));var squel=require('squel');var crypto=require(_0x0bc1('0xb'));var jsforce=require(_0x0bc1('0xc'));var deskjs=require(_0x0bc1('0xd'));var toCsv=require(_0x0bc1('0xe'));var querystring=require('querystring');var Papa=require(_0x0bc1('0xf'));var Redis=require(_0x0bc1('0x10'));var authService=require(_0x0bc1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0bc1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0bc1('0x13'));var utils=require('../../config/utils');var config=require(_0x0bc1('0x14'));var licenseUtil=require(_0x0bc1('0x15'));var db=require(_0x0bc1('0x16'))['db'];function respondWithStatusCode(_0x410ed7,_0x4933cd){_0x4933cd=_0x4933cd||0xcc;return function(_0xe786d2){if(_0xe786d2){return _0x410ed7[_0x0bc1('0x17')](_0x4933cd);}return _0x410ed7['status'](_0x4933cd)[_0x0bc1('0x18')]();};}function respondWithResult(_0x4b9fd2,_0x1a2f08){_0x1a2f08=_0x1a2f08||0xc8;return function(_0x3947ea){if(_0x3947ea){return _0x4b9fd2[_0x0bc1('0x19')](_0x1a2f08)[_0x0bc1('0x1a')](_0x3947ea);}};}function respondWithFilteredResult(_0x692030,_0x41ca6f){return function(_0x1e4255){if(_0x1e4255){var _0x5acc92=typeof _0x41ca6f[_0x0bc1('0x1b')]===_0x0bc1('0x1c')&&typeof _0x41ca6f['limit']===_0x0bc1('0x1c');var _0x3b4061=_0x1e4255[_0x0bc1('0x1d')];var _0x296b80=_0x5acc92?0x0:_0x41ca6f[_0x0bc1('0x1b')];var _0x57d4c8=_0x5acc92?_0x1e4255[_0x0bc1('0x1d')]:_0x41ca6f['offset']+_0x41ca6f[_0x0bc1('0x1e')];var _0x42b143;if(_0x57d4c8>=_0x3b4061){_0x57d4c8=_0x3b4061;_0x42b143=0xc8;}else{_0x42b143=0xce;}_0x692030[_0x0bc1('0x19')](_0x42b143);return _0x692030['set'](_0x0bc1('0x1f'),_0x296b80+'-'+_0x57d4c8+'/'+_0x3b4061)[_0x0bc1('0x1a')](_0x1e4255);}return null;};}function patchUpdates(_0x53df26){return function(_0x45c365){try{jsonpatch[_0x0bc1('0x20')](_0x45c365,_0x53df26,!![]);}catch(_0x5ac187){return BPromise['reject'](_0x5ac187);}return _0x45c365[_0x0bc1('0x21')]();};}function saveUpdates(_0x19f5c1,_0x111bb0){return function(_0x47e4f0){if(_0x47e4f0){return _0x47e4f0[_0x0bc1('0x22')](_0x19f5c1)['then'](function(_0x5c0900){return _0x5c0900;});}return null;};}function removeEntity(_0x5e6353,_0x4d20e4){return function(_0x3ec837){if(_0x3ec837){return _0x3ec837['destroy']()[_0x0bc1('0x23')](function(){var _0x2ced5c=_0x3ec837['get']({'plain':!![]});var _0x435a29='Scheduler';return db[_0x0bc1('0x24')][_0x0bc1('0x25')]({'where':{'type':_0x435a29,'resourceId':_0x2ced5c['id']}})['then'](function(){return _0x3ec837;});})['then'](function(){_0x5e6353[_0x0bc1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1086b7,_0x225439){return function(_0x598565){if(!_0x598565){_0x1086b7[_0x0bc1('0x17')](0x194);}return _0x598565;};}function handleError(_0x15430d,_0x380f59){_0x380f59=_0x380f59||0x1f4;return function(_0x1a42dc){logger[_0x0bc1('0x26')](_0x1a42dc[_0x0bc1('0x27')]);if(_0x1a42dc['name']){delete _0x1a42dc[_0x0bc1('0x28')];}_0x15430d[_0x0bc1('0x19')](_0x380f59)[_0x0bc1('0x29')](_0x1a42dc);};}exports[_0x0bc1('0x2a')]=function(_0xcd5bc5,_0x9fd58c){var _0xf81553={},_0x1e238b={},_0x540b5c={'count':0x0,'rows':[]};var _0x174c9a=_['map'](db[_0x0bc1('0x2b')][_0x0bc1('0x2c')],function(_0xa9a8cb){return{'name':_0xa9a8cb[_0x0bc1('0x2d')],'type':_0xa9a8cb['type'][_0x0bc1('0x2e')]};});_0x1e238b['model']=_[_0x0bc1('0x2f')](_0x174c9a,'name');_0x1e238b[_0x0bc1('0x30')]=_[_0x0bc1('0x31')](_0xcd5bc5[_0x0bc1('0x30')]);_0x1e238b[_0x0bc1('0x32')]=_[_0x0bc1('0x33')](_0x1e238b['model'],_0x1e238b[_0x0bc1('0x30')]);_0xf81553[_0x0bc1('0x34')]=_[_0x0bc1('0x33')](_0x1e238b[_0x0bc1('0x35')],qs[_0x0bc1('0x36')](_0xcd5bc5[_0x0bc1('0x30')][_0x0bc1('0x36')]));_0xf81553[_0x0bc1('0x34')]=_0xf81553['attributes'][_0x0bc1('0x37')]?_0xf81553['attributes']:_0x1e238b[_0x0bc1('0x35')];if(!_0xcd5bc5[_0x0bc1('0x30')]['hasOwnProperty'](_0x0bc1('0x38'))){_0xf81553[_0x0bc1('0x1e')]=qs[_0x0bc1('0x1e')](_0xcd5bc5[_0x0bc1('0x30')][_0x0bc1('0x1e')]);_0xf81553['offset']=qs[_0x0bc1('0x1b')](_0xcd5bc5[_0x0bc1('0x30')][_0x0bc1('0x1b')]);}_0xf81553[_0x0bc1('0x39')]=qs[_0x0bc1('0x3a')](_0xcd5bc5[_0x0bc1('0x30')][_0x0bc1('0x3a')]);_0xf81553[_0x0bc1('0x3b')]=qs[_0x0bc1('0x32')](_[_0x0bc1('0x3c')](_0xcd5bc5[_0x0bc1('0x30')],_0x1e238b['filters']),_0x174c9a);if(_0xcd5bc5[_0x0bc1('0x30')][_0x0bc1('0x3d')]){_0xf81553[_0x0bc1('0x3b')]=_[_0x0bc1('0x3e')](_0xf81553[_0x0bc1('0x3b')],{'$or':_[_0x0bc1('0x2f')](_0x174c9a,function(_0x53aebb){if(_0x53aebb[_0x0bc1('0x3f')]!=='VIRTUAL'){var _0x4c8580={};_0x4c8580[_0x53aebb[_0x0bc1('0x28')]]={'$like':'%'+_0xcd5bc5[_0x0bc1('0x30')][_0x0bc1('0x3d')]+'%'};return _0x4c8580;}})});}_0xf81553=_['merge']({},_0xf81553,_0xcd5bc5[_0x0bc1('0x40')]);var _0x3eefde={'where':_0xf81553['where']};return db[_0x0bc1('0x2b')]['count'](_0x3eefde)[_0x0bc1('0x23')](function(_0x566bc8){_0x540b5c[_0x0bc1('0x1d')]=_0x566bc8;if(_0xcd5bc5[_0x0bc1('0x30')][_0x0bc1('0x41')]){_0xf81553[_0x0bc1('0x42')]=[{'all':!![]}];}return db['Schedule'][_0x0bc1('0x43')](_0xf81553);})[_0x0bc1('0x23')](function(_0x4b5191){_0x540b5c[_0x0bc1('0x44')]=_0x4b5191;return _0x540b5c;})['then'](respondWithFilteredResult(_0x9fd58c,_0xf81553))[_0x0bc1('0x45')](handleError(_0x9fd58c,null));};exports[_0x0bc1('0x46')]=function(_0x51acb0,_0x22c0b9){var _0x51eeed={'raw':![],'where':{'id':_0x51acb0[_0x0bc1('0x47')]['id']}},_0x5e10e2={};_0x5e10e2[_0x0bc1('0x35')]=_[_0x0bc1('0x31')](db[_0x0bc1('0x2b')][_0x0bc1('0x2c')]);_0x5e10e2[_0x0bc1('0x30')]=_[_0x0bc1('0x31')](_0x51acb0[_0x0bc1('0x30')]);_0x5e10e2[_0x0bc1('0x32')]=_[_0x0bc1('0x33')](_0x5e10e2[_0x0bc1('0x35')],_0x5e10e2[_0x0bc1('0x30')]);_0x51eeed[_0x0bc1('0x34')]=_[_0x0bc1('0x33')](_0x5e10e2[_0x0bc1('0x35')],qs['fields'](_0x51acb0['query'][_0x0bc1('0x36')]));_0x51eeed[_0x0bc1('0x34')]=_0x51eeed['attributes'][_0x0bc1('0x37')]?_0x51eeed[_0x0bc1('0x34')]:_0x5e10e2[_0x0bc1('0x35')];if(_0x51acb0[_0x0bc1('0x30')]['includeAll']){_0x51eeed[_0x0bc1('0x42')]=[{'all':!![]}];}_0x51eeed=_[_0x0bc1('0x3e')]({},_0x51eeed,_0x51acb0[_0x0bc1('0x40')]);return db['Schedule'][_0x0bc1('0x48')](_0x51eeed)[_0x0bc1('0x23')](handleEntityNotFound(_0x22c0b9,null))[_0x0bc1('0x23')](respondWithResult(_0x22c0b9,null))['catch'](handleError(_0x22c0b9,null));};exports['create']=function(_0x5cacde,_0x5a28ab){return db[_0x0bc1('0x2b')]['create'](_0x5cacde[_0x0bc1('0x49')],{})[_0x0bc1('0x23')](function(_0x1b2506){var _0x13db0a=_0x5cacde[_0x0bc1('0x4a')][_0x0bc1('0x4b')]({'plain':!![]});if(!_0x13db0a)throw new Error(_0x0bc1('0x4c'));if(_0x13db0a[_0x0bc1('0x4d')]===_0x0bc1('0x4a')){var _0x3ee36a=_0x1b2506['get']({'plain':!![]});var _0x1806d5='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x1806d5,'userProfileId':_0x13db0a[_0x0bc1('0x4e')]},'raw':!![]})[_0x0bc1('0x23')](function(_0x1481f0){if(_0x1481f0&&_0x1481f0[_0x0bc1('0x4f')]===0x0){return db[_0x0bc1('0x24')]['create']({'name':_0x3ee36a[_0x0bc1('0x28')],'resourceId':_0x3ee36a['id'],'type':_0x1481f0[_0x0bc1('0x28')],'sectionId':_0x1481f0['id']},{})[_0x0bc1('0x23')](function(){return _0x1b2506;});}else{return _0x1b2506;}})[_0x0bc1('0x45')](function(_0x4a22e7){logger[_0x0bc1('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a22e7);throw _0x4a22e7;});}return _0x1b2506;})[_0x0bc1('0x23')](respondWithResult(_0x5a28ab,0xc9))['catch'](handleError(_0x5a28ab,null));};exports[_0x0bc1('0x22')]=function(_0x5e0657,_0x39cef1){if(_0x5e0657[_0x0bc1('0x49')]['id']){delete _0x5e0657[_0x0bc1('0x49')]['id'];}return db['Schedule'][_0x0bc1('0x48')]({'where':{'id':_0x5e0657[_0x0bc1('0x47')]['id']}})[_0x0bc1('0x23')](handleEntityNotFound(_0x39cef1,null))[_0x0bc1('0x23')](saveUpdates(_0x5e0657[_0x0bc1('0x49')],null))['then'](respondWithResult(_0x39cef1,null))[_0x0bc1('0x45')](handleError(_0x39cef1,null));};exports[_0x0bc1('0x25')]=function(_0x1de8cd,_0x318a68){return db['Schedule'][_0x0bc1('0x48')]({'where':{'id':_0x1de8cd[_0x0bc1('0x47')]['id']}})[_0x0bc1('0x23')](handleEntityNotFound(_0x318a68,null))[_0x0bc1('0x23')](removeEntity(_0x318a68,null))[_0x0bc1('0x45')](handleError(_0x318a68,null));};exports[_0x0bc1('0x50')]=function(_0x3bc28c,_0x15c00d,_0x1df7f0){var _0x5d744a=require('../../config/schedule');return db[_0x0bc1('0x2b')][_0x0bc1('0x48')]({'where':{'id':_0x3bc28c['params']['id']},'raw':!![]})[_0x0bc1('0x23')](handleEntityNotFound(_0x15c00d,null))[_0x0bc1('0x23')](function(){_0x5d744a[_0x0bc1('0x50')](_0x3bc28c[_0x0bc1('0x47')]['id']);})[_0x0bc1('0x23')](respondWithStatusCode(_0x15c00d,null))['catch'](handleError(_0x15c00d,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index e4e15c8..9845141 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 _0x7d78=['path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird'];(function(_0x5df651,_0x2f877b){var _0xe12ee6=function(_0x1884c4){while(--_0x1884c4){_0x5df651['push'](_0x5df651['shift']());}};_0xe12ee6(++_0x2f877b);}(_0x7d78,0x1c3));var _0x87d7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7d78[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x87d7('0x0'));var util=require(_0x87d7('0x1'));var logger=require(_0x87d7('0x2'))(_0x87d7('0x3'));var moment=require('moment');var BPromise=require(_0x87d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87d7('0x5'));var rimraf=require('rimraf');var config=require(_0x87d7('0x6'));var attributes=require(_0x87d7('0x7'));module[_0x87d7('0x8')]=function(_0x553386,_0x4b3752){return _0x553386[_0x87d7('0x9')](_0x87d7('0xa'),attributes,{'tableName':_0x87d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeba6=['request-promise','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xeba6,0x125));var _0x6eba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeba6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6eba('0x0'));var util=require(_0x6eba('0x1'));var logger=require(_0x6eba('0x2'))(_0x6eba('0x3'));var moment=require(_0x6eba('0x4'));var BPromise=require(_0x6eba('0x5'));var rp=require(_0x6eba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6eba('0x7'));var attributes=require(_0x6eba('0x8'));module[_0x6eba('0x9')]=function(_0x3d4f1a,_0x3299b7){return _0x3d4f1a[_0x6eba('0xa')](_0x6eba('0xb'),attributes,{'tableName':_0x6eba('0xc'),'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 1a16441..d4fdc8b 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 _0x7145=['then','info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x356932,_0xdc04ba){var _0x3f8ea9=function(_0x572ea9){while(--_0x572ea9){_0x356932['push'](_0x356932['shift']());}};_0x3f8ea9(++_0xdc04ba);}(_0x7145,0x1d0));var _0x5714=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7145[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5714('0x0'));var util=require(_0x5714('0x1'));var moment=require(_0x5714('0x2'));var BPromise=require(_0x5714('0x3'));var rs=require(_0x5714('0x4'));var fs=require('fs');var Redis=require(_0x5714('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5714('0x6'));var logger=require(_0x5714('0x7'))('rpc');var config=require(_0x5714('0x8'));var jayson=require(_0x5714('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d2a1d,_0x73ee73,_0x130bb9){return new BPromise(function(_0x5ef9b9,_0x45f810){return client[_0x5714('0xa')](_0x1d2a1d,_0x130bb9)[_0x5714('0xb')](function(_0x5cfdd6){logger[_0x5714('0xc')](_0x5714('0xd'),_0x73ee73,'request\x20sent');logger[_0x5714('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x73ee73,_0x5714('0xf'),JSON[_0x5714('0x10')](_0x5cfdd6));if(_0x5cfdd6[_0x5714('0x11')]){if(_0x5cfdd6[_0x5714('0x11')]['code']===0x1f4){logger[_0x5714('0x11')](_0x5714('0xd'),_0x73ee73,_0x5cfdd6[_0x5714('0x11')]['message']);return _0x45f810(_0x5cfdd6[_0x5714('0x11')][_0x5714('0x12')]);}logger[_0x5714('0x11')]('Schedule,\x20%s,\x20%s',_0x73ee73,_0x5cfdd6[_0x5714('0x11')][_0x5714('0x12')]);return _0x5ef9b9(_0x5cfdd6[_0x5714('0x11')]['message']);}else{logger[_0x5714('0xc')](_0x5714('0xd'),_0x73ee73,_0x5714('0xf'));_0x5ef9b9(_0x5cfdd6['result'][_0x5714('0x12')]);}})['catch'](function(_0x40e118){logger['error']('Schedule,\x20%s,\x20%s',_0x73ee73,_0x40e118);_0x45f810(_0x40e118);});});} \ No newline at end of file +var _0xdf30=['rpc','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x44b2be,_0x1f924f){var _0x48353c=function(_0x8e7cda){while(--_0x8e7cda){_0x44b2be['push'](_0x44b2be['shift']());}};_0x48353c(++_0x1f924f);}(_0xdf30,0x1dc));var _0x0df3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf30[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0df3('0x0'));var moment=require('moment');var BPromise=require(_0x0df3('0x1'));var rs=require(_0x0df3('0x2'));var fs=require('fs');var Redis=require(_0x0df3('0x3'));var db=require(_0x0df3('0x4'))['db'];var utils=require(_0x0df3('0x5'));var logger=require(_0x0df3('0x6'))(_0x0df3('0x7'));var config=require('../../config/environment');var jayson=require(_0x0df3('0x8'));var client=jayson[_0x0df3('0x9')][_0x0df3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d9b9d,_0x1f1dd9,_0x257107){return new BPromise(function(_0x24b5f8,_0x4302de){return client[_0x0df3('0xb')](_0x4d9b9d,_0x257107)[_0x0df3('0xc')](function(_0x221711){logger['info'](_0x0df3('0xd'),_0x1f1dd9,'request\x20sent');logger[_0x0df3('0xe')](_0x0df3('0xf'),_0x1f1dd9,_0x0df3('0x10'),JSON['stringify'](_0x221711));if(_0x221711[_0x0df3('0x11')]){if(_0x221711[_0x0df3('0x11')]['code']===0x1f4){logger['error'](_0x0df3('0xd'),_0x1f1dd9,_0x221711[_0x0df3('0x11')][_0x0df3('0x12')]);return _0x4302de(_0x221711[_0x0df3('0x11')][_0x0df3('0x12')]);}logger['error'](_0x0df3('0xd'),_0x1f1dd9,_0x221711[_0x0df3('0x11')][_0x0df3('0x12')]);return _0x24b5f8(_0x221711[_0x0df3('0x11')]['message']);}else{logger['info'](_0x0df3('0xd'),_0x1f1dd9,_0x0df3('0x10'));_0x24b5f8(_0x221711[_0x0df3('0x13')][_0x0df3('0x12')]);}})[_0x0df3('0x14')](function(_0x51b612){logger['error'](_0x0df3('0xd'),_0x1f1dd9,_0x51b612);_0x4302de(_0x51b612);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index a344754..bdd1c40 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 _0xb99d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x14ea8a,_0x32d29b){var _0x4a22c7=function(_0x5eebfe){while(--_0x5eebfe){_0x14ea8a['push'](_0x14ea8a['shift']());}};_0x4a22c7(++_0x32d29b);}(_0xb99d,0x10e));var _0xdb99=function(_0x38d2a5,_0x3e4915){_0x38d2a5=_0x38d2a5-0x0;var _0x4d0941=_0xb99d[_0x38d2a5];return _0x4d0941;};'use strict';var multer=require(_0xdb99('0x0'));var util=require('util');var path=require(_0xdb99('0x1'));var timeout=require(_0xdb99('0x2'));var express=require('express');var router=express[_0xdb99('0x3')]();var fs_extra=require(_0xdb99('0x4'));var auth=require(_0xdb99('0x5'));var interaction=require(_0xdb99('0x6'));var config=require(_0xdb99('0x7'));var controller=require(_0xdb99('0x8'));router['get']('/',auth[_0xdb99('0x9')](),controller[_0xdb99('0xa')]);router['get'](_0xdb99('0xb'),auth[_0xdb99('0x9')](),controller[_0xdb99('0xc')]);router[_0xdb99('0xd')](_0xdb99('0xe'),auth[_0xdb99('0x9')](),controller[_0xdb99('0xf')]);router['get'](_0xdb99('0x10'),auth[_0xdb99('0x9')](),controller[_0xdb99('0x11')]);router[_0xdb99('0x12')]('/',auth[_0xdb99('0x9')](),controller[_0xdb99('0x13')]);router[_0xdb99('0x14')]('/:id',auth[_0xdb99('0x9')](),controller[_0xdb99('0x15')]);router[_0xdb99('0x16')]('/:id',auth[_0xdb99('0x9')](),controller[_0xdb99('0x17')]);module[_0xdb99('0x18')]=router; \ No newline at end of file +var _0xe283=['isAuthenticated','index','describe','/:id','show','post','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./screenRecording.controller','get'];(function(_0x582877,_0x3a80a8){var _0x4bb230=function(_0x24f614){while(--_0x24f614){_0x582877['push'](_0x582877['shift']());}};_0x4bb230(++_0x3a80a8);}(_0xe283,0x196));var _0x3e28=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xe283[_0x4e93a9];return _0x43013c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3e28('0x0'));var timeout=require(_0x3e28('0x1'));var express=require(_0x3e28('0x2'));var router=express[_0x3e28('0x3')]();var fs_extra=require(_0x3e28('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3e28('0x5'));var config=require('../../config/environment');var controller=require(_0x3e28('0x6'));router[_0x3e28('0x7')]('/',auth[_0x3e28('0x8')](),controller[_0x3e28('0x9')]);router[_0x3e28('0x7')]('/describe',auth[_0x3e28('0x8')](),controller[_0x3e28('0xa')]);router[_0x3e28('0x7')](_0x3e28('0xb'),auth[_0x3e28('0x8')](),controller[_0x3e28('0xc')]);router['get']('/:id/download',auth[_0x3e28('0x8')](),controller['download']);router[_0x3e28('0xd')]('/',auth[_0x3e28('0x8')](),controller['create']);router['put']('/:id',auth[_0x3e28('0x8')](),controller[_0x3e28('0xe')]);router[_0x3e28('0xf')](_0x3e28('0xb'),auth['isAuthenticated'](),controller[_0x3e28('0x10')]);module[_0x3e28('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index fe08223..ad1c65a 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 _0x3e22=['duration','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','INTEGER','setDataValue','subtract','closedAt'];(function(_0x36a073,_0x2ce3ce){var _0xc9762b=function(_0x416bfe){while(--_0x416bfe){_0x36a073['push'](_0x36a073['shift']());}};_0xc9762b(++_0x2ce3ce);}(_0x3e22,0xa8));var _0x23e2=function(_0x360f17,_0xf88d45){_0x360f17=_0x360f17-0x0;var _0x128eb3=_0x3e22[_0x360f17];return _0x128eb3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x23e2('0x0'));var path=require('path');var config=require(_0x23e2('0x1'));module[_0x23e2('0x2')]={'format':{'type':Sequelize[_0x23e2('0x3')],'get':function(){return this[_0x23e2('0x4')]('value')?path['extname'](this[_0x23e2('0x4')](_0x23e2('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x23e2('0x6')]},'value':{'type':Sequelize[_0x23e2('0x6')],'set':function(_0x3a8351){var _0x927fbb=_0x3a8351[_0x23e2('0x7')](/\\/g,'/');this['setDataValue'](_0x23e2('0x5'),_0x927fbb);}},'rating':{'type':Sequelize[_0x23e2('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x23e2('0x8')],'set':function(_0x75da0a){this[_0x23e2('0x9')]('startedAt',moment()[_0x23e2('0xa')](_0x75da0a,'ms'));this[_0x23e2('0x9')](_0x23e2('0xb'),moment());this[_0x23e2('0x9')](_0x23e2('0xc'),_0x75da0a);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x23e2('0xd')))[_0x23e2('0xe')](_0x23e2('0xf'))[_0x23e2('0x10')]();}},'closedAt':{'type':Sequelize[_0x23e2('0x11')],'get':function(){return moment(this[_0x23e2('0x4')](_0x23e2('0xb')))[_0x23e2('0xe')](_0x23e2('0xf'))[_0x23e2('0x10')]();}},'createdAt':{'type':Sequelize[_0x23e2('0x11')],'get':function(){return moment(this[_0x23e2('0x4')](_0x23e2('0x12')))[_0x23e2('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x23e2('0x10')]();}},'updatedAt':{'type':Sequelize[_0x23e2('0x11')],'get':function(){return moment(this[_0x23e2('0x4')](_0x23e2('0x13')))[_0x23e2('0xe')](_0x23e2('0xf'))[_0x23e2('0x10')]();}}}; \ No newline at end of file +var _0xda2d=['replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','toString','format','MM-DD-YYYY\x20HH:mm','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xda2d,0x102));var _0xdda2=function(_0x4f8299,_0x387ad8){_0x4f8299=_0x4f8299-0x0;var _0x4cea5d=_0xda2d[_0x4f8299];return _0x4cea5d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var config=require(_0xdda2('0x2'));module[_0xdda2('0x3')]={'format':{'type':Sequelize[_0xdda2('0x4')],'get':function(){return this['getDataValue']('value')?path['extname'](this[_0xdda2('0x5')](_0xdda2('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xdda2('0x7')]},'channel':{'type':Sequelize[_0xdda2('0x7')]},'value':{'type':Sequelize[_0xdda2('0x7')],'set':function(_0xf38e58){var _0x2f55dc=_0xf38e58[_0xdda2('0x8')](/\\/g,'/');this[_0xdda2('0x9')](_0xdda2('0x6'),_0x2f55dc);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdda2('0xa')],'set':function(_0x22c6e5){this['setDataValue'](_0xdda2('0xb'),moment()[_0xdda2('0xc')](_0x22c6e5,'ms'));this[_0xdda2('0x9')](_0xdda2('0xd'),moment());this[_0xdda2('0x9')](_0xdda2('0xe'),_0x22c6e5);}},'startedAt':{'type':Sequelize[_0xdda2('0xf')],'get':function(){return moment(this[_0xdda2('0x5')]('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xdda2('0x10')]();}},'closedAt':{'type':Sequelize[_0xdda2('0xf')],'get':function(){return moment(this[_0xdda2('0x5')](_0xdda2('0xd')))[_0xdda2('0x11')](_0xdda2('0x12'))[_0xdda2('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xdda2('0x5')]('createdAt'))[_0xdda2('0x11')](_0xdda2('0x12'))[_0xdda2('0x10')]();}},'updatedAt':{'type':Sequelize[_0xdda2('0xf')],'get':function(){return moment(this[_0xdda2('0x5')]('updatedAt'))['format'](_0xdda2('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index b59cbe5..06c28f2 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 _0xe5b3=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','intersection','attributes','fields','query','length','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','catch','show','create','body','duration','createdAt','closedAt','value','find','params','describe','download','uniqueid','join','%s.cypher','existsSync','root','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','send','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0x6922ed,_0x5a8a4b){var _0xd76366=function(_0x4a55c1){while(--_0x4a55c1){_0x6922ed['push'](_0x6922ed['shift']());}};_0xd76366(++_0x5a8a4b);}(_0xe5b3,0x133));var _0x3e5b=function(_0x57a9e5,_0x5009df){_0x57a9e5=_0x57a9e5-0x0;var _0x36d39e=_0xe5b3[_0x57a9e5];return _0x36d39e;};'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(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x31')](_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29')),[_0x3e5b('0x32')]);_0x10d2ed['query']=_[_0x3e5b('0x33')](_0x1f6473['query']);_0x10d2ed['filters']=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],_0x10d2ed['query']);_0x475b39[_0x3e5b('0x35')]=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x475b39[_0x3e5b('0x35')]=_0x475b39[_0x3e5b('0x35')][_0x3e5b('0x38')]?_0x475b39[_0x3e5b('0x35')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x37')]['hasOwnProperty'](_0x3e5b('0x39'))){_0x475b39[_0x3e5b('0x1e')]=qs['limit'](_0x1f6473['query'][_0x3e5b('0x1e')]);_0x475b39['offset']=qs[_0x3e5b('0x20')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x3a')]=qs['sort'](_0x1f6473[_0x3e5b('0x37')]['sort']);_0x475b39[_0x3e5b('0x3b')]=qs['filters'](_['pick'](_0x1f6473['query'],_0x10d2ed[_0x3e5b('0x3c')]),_0x307091);if(_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x3d')]){_0x475b39[_0x3e5b('0x3b')]=_[_0x3e5b('0x3e')](_0x475b39[_0x3e5b('0x3b')],{'$or':_['map'](_0x307091,function(_0x5d0c59){if(_0x5d0c59['type']!=='VIRTUAL'){var _0x5f0271={};_0x5f0271[_0x5d0c59['name']]={'$like':'%'+_0x1f6473['query'][_0x3e5b('0x3d')]+'%'};return _0x5f0271;}})});}_0x475b39=_[_0x3e5b('0x3e')]({},_0x475b39,_0x1f6473[_0x3e5b('0x3f')]);var _0x1aafd5={'where':_0x475b39[_0x3e5b('0x3b')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x1aafd5)[_0x3e5b('0x27')](function(_0x222d0f){_0x3cfaf6[_0x3e5b('0x1f')]=_0x222d0f;if(_0x1f6473[_0x3e5b('0x37')]['includeAll']){_0x475b39[_0x3e5b('0x40')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')][_0x3e5b('0x41')](_0x475b39);})[_0x3e5b('0x27')](function(_0xa262e0){_0x3cfaf6[_0x3e5b('0x42')]=_0xa262e0;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x43')](handleError(_0x1296ec,null));};exports[_0x3e5b('0x44')]=function(_0x39da3f,_0x13c8d5){var _0x559056={'raw':![],'where':{'id':_0x39da3f['params']['id']}},_0x598ab4={};_0x598ab4['model']=_[_0x3e5b('0x33')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x598ab4[_0x3e5b('0x37')]=_[_0x3e5b('0x33')](_0x39da3f[_0x3e5b('0x37')]);_0x598ab4[_0x3e5b('0x3c')]=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],_0x598ab4[_0x3e5b('0x37')]);_0x559056['attributes']=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x39da3f[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x559056['attributes']=_0x559056['attributes']['length']?_0x559056[_0x3e5b('0x35')]:_0x598ab4[_0x3e5b('0x30')];if(_0x39da3f[_0x3e5b('0x37')]['includeAll']){_0x559056['include']=[{'all':!![]}];}_0x559056=_[_0x3e5b('0x3e')]({},_0x559056,_0x39da3f[_0x3e5b('0x3f')]);return db[_0x3e5b('0x2c')]['find'](_0x559056)['then'](handleEntityNotFound(_0x13c8d5,null))[_0x3e5b('0x27')](respondWithResult(_0x13c8d5,null))['catch'](handleError(_0x13c8d5,null));};exports[_0x3e5b('0x45')]=function(_0x3379a1,_0x3f5835){return db[_0x3e5b('0x2c')][_0x3e5b('0x45')](_0x3379a1[_0x3e5b('0x46')],{})[_0x3e5b('0x27')](respondWithResult(_0x3f5835,0xc9))[_0x3e5b('0x43')](handleError(_0x3f5835,null));};exports[_0x3e5b('0x26')]=function(_0x4a2ae1,_0x223185){if(_0x4a2ae1['body']['id']){delete _0x4a2ae1[_0x3e5b('0x46')]['id'];}delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x47')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x48')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x49')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x4a')];return db[_0x3e5b('0x2c')][_0x3e5b('0x4b')]({'where':{'id':_0x4a2ae1[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x223185,null))['then'](saveUpdates(_0x4a2ae1[_0x3e5b('0x46')],null))[_0x3e5b('0x27')](respondWithResult(_0x223185,null))[_0x3e5b('0x43')](handleError(_0x223185,null));};exports[_0x3e5b('0x4d')]=function(_0x16c9f9,_0x2cecd3){return db['ScreenRecording'][_0x3e5b('0x4d')]()[_0x3e5b('0x27')](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x43')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x4e')]=function(_0x3f8646,_0x449d0f,_0x216600){var _0x437430=require('../../components/encryptor');var _0x1e6403=![];var _0x5e702f={};if(_0x3f8646['query'][_0x3e5b('0x2e')]&&_0x3f8646['query'][_0x3e5b('0x2e')]===_0x3e5b('0x4f')){_0x5e702f[_0x3e5b('0x4f')]=_0x3f8646[_0x3e5b('0x4c')]['id'];}else{_0x5e702f['id']=_0x3f8646['params']['id'];}return db['ScreenRecording']['find']({'where':_0x5e702f,'attributes':['id','value'],'raw':!![]})[_0x3e5b('0x27')](handleEntityNotFound(_0x449d0f,null))[_0x3e5b('0x27')](function(_0x1ea02a){if(_0x1ea02a){var _0x4149c8=path[_0x3e5b('0x50')](config['root'],'server/files/screen_recordings',_0x1ea02a[_0x3e5b('0x4a')]);var _0x1b0b32=util[_0x3e5b('0x32')](_0x3e5b('0x51'),_0x4149c8);if(fs[_0x3e5b('0x52')](_0x1b0b32)){_0x1e6403=!![];return _0x437430['decryptFile'](_0x1b0b32,_0x4149c8,config['secrets']['recording'])['then'](function(){return _0x1ea02a;});}return _0x1ea02a;}})[_0x3e5b('0x27')](function(_0x3e3115){if(_0x3e3115){var _0x3088d4=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x3e3115[_0x3e5b('0x4a')]);if(!fs[_0x3e5b('0x52')](_0x3088d4)){throw new db['Sequelize'][(_0x3e5b('0x55'))](_0x3e5b('0x56'));}if(_0x3e3115[_0x3e5b('0x57')]){return _0x449d0f[_0x3e5b('0x4e')](_0x3088d4,_0x3e3115[_0x3e5b('0x57')]+path['extname'](_0x3088d4),function(){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}else{return _0x449d0f['download'](_0x3088d4,function(_0x45ca16){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}}})['catch'](function(_0x4a7d8e){if(_0x4a7d8e['message']===_0x3e5b('0x56')){_0x449d0f['status'](0x194)[_0x3e5b('0x59')](_0x3e5b('0x5a'));}else{return handleError(_0x449d0f,null);}});};exports[_0x3e5b('0x5b')]=function(_0x40197c,_0x14f187){return db['ScreenRecording']['find']({'where':{'id':_0x40197c[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](function(_0x3f7f71){if(_['isNil'](_0x3f7f71)){throw new ReferenceError(_0x3e5b('0x5c'));}return _0x3f7f71;})[_0x3e5b('0x27')](function(_0x32a42f){var _0x1c9526=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x32a42f[_0x3e5b('0x4a')]);logger[_0x3e5b('0x5d')](_0x3e5b('0x5e'),_0x1c9526);if(!_[_0x3e5b('0x5f')](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger[_0x3e5b('0x5d')](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs[_0x3e5b('0x62')](_0x1c9526);}_0x1c9526=_0x1c9526+_0x3e5b('0x63');if(!_['isNil'](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger['info'](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs['unlinkSync'](_0x1c9526);}return _0x32a42f;})['then'](function(_0x4f67d1){if(!_0x4f67d1)throw new InternalError();return _0x4f67d1[_0x3e5b('0x5b')]();})[_0x3e5b('0x27')](function(){_0x14f187['status'](0xcc)[_0x3e5b('0x1a')]();})[_0x3e5b('0x43')](handleError(_0x14f187,null));}; \ No newline at end of file +var _0xbd50=['unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','update','duration','value','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','recording','server/files/screen_recordings','ValidationError','filename','extname','download','unlink','message','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x5c6046,_0x451f04){var _0x5c01d5=function(_0x337b20){while(--_0x337b20){_0x5c6046['push'](_0x5c6046['shift']());}};_0x5c01d5(++_0x451f04);}(_0xbd50,0x196));var _0x0bd5=function(_0x4381e7,_0x40314e){_0x4381e7=_0x4381e7-0x0;var _0x528bb9=_0xbd50[_0x4381e7];return _0x528bb9;};'use strict';var emlformat=require(_0x0bd5('0x0'));var rimraf=require(_0x0bd5('0x1'));var zipdir=require(_0x0bd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd5('0x3'));var moment=require(_0x0bd5('0x4'));var BPromise=require(_0x0bd5('0x5'));var Mustache=require(_0x0bd5('0x6'));var util=require(_0x0bd5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bd5('0x8'));var fs=require('fs');var fs_extra=require(_0x0bd5('0x9'));var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0xd'));var querystring=require(_0x0bd5('0xe'));var Papa=require(_0x0bd5('0xf'));var Redis=require('ioredis');var authService=require(_0x0bd5('0x10'));var qs=require(_0x0bd5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bd5('0x12'));var logger=require(_0x0bd5('0x13'))('api');var utils=require(_0x0bd5('0x14'));var config=require(_0x0bd5('0x15'));var licenseUtil=require(_0x0bd5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f7a0c,_0x23982f){_0x23982f=_0x23982f||0xcc;return function(_0x2f9588){if(_0x2f9588){return _0x2f7a0c[_0x0bd5('0x17')](_0x23982f);}return _0x2f7a0c[_0x0bd5('0x18')](_0x23982f)[_0x0bd5('0x19')]();};}function respondWithResult(_0x30765e,_0x1e961d){_0x1e961d=_0x1e961d||0xc8;return function(_0x4f485b){if(_0x4f485b){return _0x30765e[_0x0bd5('0x18')](_0x1e961d)[_0x0bd5('0x1a')](_0x4f485b);}};}function respondWithFilteredResult(_0x574315,_0x31349f){return function(_0x23ef4e){if(_0x23ef4e){var _0x3a34e4=typeof _0x31349f[_0x0bd5('0x1b')]==='undefined'&&typeof _0x31349f[_0x0bd5('0x1c')]===_0x0bd5('0x1d');var _0xa890be=_0x23ef4e[_0x0bd5('0x1e')];var _0x833c14=_0x3a34e4?0x0:_0x31349f[_0x0bd5('0x1b')];var _0xc58e12=_0x3a34e4?_0x23ef4e[_0x0bd5('0x1e')]:_0x31349f[_0x0bd5('0x1b')]+_0x31349f[_0x0bd5('0x1c')];var _0x27bc1e;if(_0xc58e12>=_0xa890be){_0xc58e12=_0xa890be;_0x27bc1e=0xc8;}else{_0x27bc1e=0xce;}_0x574315[_0x0bd5('0x18')](_0x27bc1e);return _0x574315[_0x0bd5('0x1f')](_0x0bd5('0x20'),_0x833c14+'-'+_0xc58e12+'/'+_0xa890be)['json'](_0x23ef4e);}return null;};}function patchUpdates(_0x5ba943){return function(_0x596b6a){try{jsonpatch['apply'](_0x596b6a,_0x5ba943,!![]);}catch(_0x47d74a){return BPromise[_0x0bd5('0x21')](_0x47d74a);}return _0x596b6a[_0x0bd5('0x22')]();};}function saveUpdates(_0x13ce46,_0x4a6910){return function(_0x6ee1a8){if(_0x6ee1a8){return _0x6ee1a8['update'](_0x13ce46)[_0x0bd5('0x23')](function(_0x3b235b){return _0x3b235b;});}return null;};}function removeEntity(_0x38c21d,_0x5a8139){return function(_0x5b6dde){if(_0x5b6dde){return _0x5b6dde['destroy']()['then'](function(){_0x38c21d[_0x0bd5('0x18')](0xcc)[_0x0bd5('0x19')]();});}};}function handleEntityNotFound(_0x184db3,_0x4fde84){return function(_0x42428c){if(!_0x42428c){_0x184db3['sendStatus'](0x194);}return _0x42428c;};}function handleError(_0x456e87,_0x3ffb08){_0x3ffb08=_0x3ffb08||0x1f4;return function(_0x18cec3){logger[_0x0bd5('0x24')](_0x18cec3[_0x0bd5('0x25')]);if(_0x18cec3[_0x0bd5('0x26')]){delete _0x18cec3[_0x0bd5('0x26')];}_0x456e87[_0x0bd5('0x18')](_0x3ffb08)[_0x0bd5('0x27')](_0x18cec3);};}exports[_0x0bd5('0x28')]=function(_0x15561b,_0xcbfc51){var _0x2e10ce={},_0x2704ee={},_0x5e5a33={'count':0x0,'rows':[]};var _0x461ae3=_[_0x0bd5('0x29')](db['ScreenRecording'][_0x0bd5('0x2a')],function(_0x8eccc9){return{'name':_0x8eccc9['fieldName'],'type':_0x8eccc9[_0x0bd5('0x2b')][_0x0bd5('0x2c')]};});_0x2704ee[_0x0bd5('0x2d')]=_[_0x0bd5('0x2e')](_['map'](_0x461ae3,_0x0bd5('0x26')),[_0x0bd5('0x2f')]);_0x2704ee[_0x0bd5('0x30')]=_[_0x0bd5('0x31')](_0x15561b[_0x0bd5('0x30')]);_0x2704ee[_0x0bd5('0x32')]=_['intersection'](_0x2704ee[_0x0bd5('0x2d')],_0x2704ee['query']);_0x2e10ce[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x2704ee[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x35')]));_0x2e10ce[_0x0bd5('0x33')]=_0x2e10ce[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x2e10ce[_0x0bd5('0x33')]:_0x2704ee[_0x0bd5('0x2d')];if(!_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x37')]('nolimit')){_0x2e10ce[_0x0bd5('0x1c')]=qs[_0x0bd5('0x1c')](_0x15561b['query']['limit']);_0x2e10ce[_0x0bd5('0x1b')]=qs[_0x0bd5('0x1b')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x1b')]);}_0x2e10ce[_0x0bd5('0x38')]=qs[_0x0bd5('0x39')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x39')]);_0x2e10ce[_0x0bd5('0x3a')]=qs[_0x0bd5('0x32')](_[_0x0bd5('0x3b')](_0x15561b[_0x0bd5('0x30')],_0x2704ee[_0x0bd5('0x32')]),_0x461ae3);if(_0x15561b['query'][_0x0bd5('0x3c')]){_0x2e10ce['where']=_[_0x0bd5('0x3d')](_0x2e10ce[_0x0bd5('0x3a')],{'$or':_[_0x0bd5('0x29')](_0x461ae3,function(_0x1fcc49){if(_0x1fcc49[_0x0bd5('0x2b')]!==_0x0bd5('0x3e')){var _0x53a682={};_0x53a682[_0x1fcc49[_0x0bd5('0x26')]]={'$like':'%'+_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x3c')]+'%'};return _0x53a682;}})});}_0x2e10ce=_[_0x0bd5('0x3d')]({},_0x2e10ce,_0x15561b[_0x0bd5('0x3f')]);var _0x493089={'where':_0x2e10ce[_0x0bd5('0x3a')]};return db[_0x0bd5('0x40')][_0x0bd5('0x1e')](_0x493089)['then'](function(_0x177aa3){_0x5e5a33['count']=_0x177aa3;if(_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x41')]){_0x2e10ce['include']=[{'all':!![]}];}return db[_0x0bd5('0x40')][_0x0bd5('0x42')](_0x2e10ce);})[_0x0bd5('0x23')](function(_0x3ec4b0){_0x5e5a33[_0x0bd5('0x43')]=_0x3ec4b0;return _0x5e5a33;})[_0x0bd5('0x23')](respondWithFilteredResult(_0xcbfc51,_0x2e10ce))[_0x0bd5('0x44')](handleError(_0xcbfc51,null));};exports['show']=function(_0x4d3ca5,_0x994f24){var _0x545b63={'raw':![],'where':{'id':_0x4d3ca5[_0x0bd5('0x45')]['id']}},_0x5dd42b={};_0x5dd42b[_0x0bd5('0x2d')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x5dd42b[_0x0bd5('0x30')]=_['keys'](_0x4d3ca5['query']);_0x5dd42b[_0x0bd5('0x32')]=_[_0x0bd5('0x34')](_0x5dd42b['model'],_0x5dd42b['query']);_0x545b63[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x5dd42b[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x4d3ca5['query'][_0x0bd5('0x35')]));_0x545b63[_0x0bd5('0x33')]=_0x545b63[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x545b63[_0x0bd5('0x33')]:_0x5dd42b[_0x0bd5('0x2d')];if(_0x4d3ca5['query'][_0x0bd5('0x41')]){_0x545b63[_0x0bd5('0x46')]=[{'all':!![]}];}_0x545b63=_[_0x0bd5('0x3d')]({},_0x545b63,_0x4d3ca5['options']);return db[_0x0bd5('0x40')][_0x0bd5('0x47')](_0x545b63)[_0x0bd5('0x23')](handleEntityNotFound(_0x994f24,null))['then'](respondWithResult(_0x994f24,null))[_0x0bd5('0x44')](handleError(_0x994f24,null));};exports[_0x0bd5('0x48')]=function(_0x54cd78,_0x18c7c7){return db[_0x0bd5('0x40')]['create'](_0x54cd78[_0x0bd5('0x49')],{})[_0x0bd5('0x23')](respondWithResult(_0x18c7c7,0xc9))['catch'](handleError(_0x18c7c7,null));};exports[_0x0bd5('0x4a')]=function(_0x20960a,_0x146bdc){if(_0x20960a[_0x0bd5('0x49')]['id']){delete _0x20960a[_0x0bd5('0x49')]['id'];}delete _0x20960a['body'][_0x0bd5('0x4b')];delete _0x20960a[_0x0bd5('0x49')]['createdAt'];delete _0x20960a[_0x0bd5('0x49')]['closedAt'];delete _0x20960a[_0x0bd5('0x49')][_0x0bd5('0x4c')];return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x20960a['params']['id']}})[_0x0bd5('0x23')](handleEntityNotFound(_0x146bdc,null))['then'](saveUpdates(_0x20960a['body'],null))[_0x0bd5('0x23')](respondWithResult(_0x146bdc,null))[_0x0bd5('0x44')](handleError(_0x146bdc,null));};exports[_0x0bd5('0x4d')]=function(_0x4c9a79,_0x424187){return db['ScreenRecording'][_0x0bd5('0x4d')]()[_0x0bd5('0x23')](respondWithResult(_0x424187,null))[_0x0bd5('0x44')](handleError(_0x424187,null));};exports['download']=function(_0x512fe3,_0x4f0467,_0x122f84){var _0x21db5d=require(_0x0bd5('0x4e'));var _0x5b06c6=![];var _0x2b174a={};if(_0x512fe3[_0x0bd5('0x30')]['type']&&_0x512fe3[_0x0bd5('0x30')]['type']==='uniqueid'){_0x2b174a[_0x0bd5('0x4f')]=_0x512fe3[_0x0bd5('0x45')]['id'];}else{_0x2b174a['id']=_0x512fe3[_0x0bd5('0x45')]['id'];}return db[_0x0bd5('0x40')]['find']({'where':_0x2b174a,'attributes':['id',_0x0bd5('0x4c')],'raw':!![]})[_0x0bd5('0x23')](handleEntityNotFound(_0x4f0467,null))[_0x0bd5('0x23')](function(_0x5cf2f2){if(_0x5cf2f2){var _0x504e46=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],'server/files/screen_recordings',_0x5cf2f2['value']);var _0x2b11e8=util['format'](_0x0bd5('0x52'),_0x504e46);if(fs[_0x0bd5('0x53')](_0x2b11e8)){_0x5b06c6=!![];return _0x21db5d[_0x0bd5('0x54')](_0x2b11e8,_0x504e46,config['secrets'][_0x0bd5('0x55')])[_0x0bd5('0x23')](function(){return _0x5cf2f2;});}return _0x5cf2f2;}})[_0x0bd5('0x23')](function(_0x38aae5){if(_0x38aae5){var _0x5e93fa=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],_0x0bd5('0x56'),_0x38aae5[_0x0bd5('0x4c')]);if(!fs[_0x0bd5('0x53')](_0x5e93fa)){throw new db['Sequelize'][(_0x0bd5('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x38aae5[_0x0bd5('0x58')]){return _0x4f0467['download'](_0x5e93fa,_0x38aae5['filename']+path[_0x0bd5('0x59')](_0x5e93fa),function(){if(_0x5b06c6){fs['unlink'](_0x5e93fa);}});}else{return _0x4f0467[_0x0bd5('0x5a')](_0x5e93fa,function(_0x3087de){if(_0x5b06c6){fs[_0x0bd5('0x5b')](_0x5e93fa);}});}}})['catch'](function(_0x4f7e86){if(_0x4f7e86[_0x0bd5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x4f0467[_0x0bd5('0x18')](0x194)[_0x0bd5('0x27')]('Not\x20found');}else{return handleError(_0x4f0467,null);}});};exports[_0x0bd5('0x5d')]=function(_0x5a38b1,_0x45ccf5){return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x5a38b1[_0x0bd5('0x45')]['id']}})[_0x0bd5('0x23')](function(_0x467488){if(_[_0x0bd5('0x5e')](_0x467488)){throw new ReferenceError('Entity\x20not\x20found');}return _0x467488;})[_0x0bd5('0x23')](function(_0x1e5e7d){var _0x33c5eb=path['join'](config['root'],_0x0bd5('0x56'),_0x1e5e7d[_0x0bd5('0x4c')]);logger[_0x0bd5('0x5f')](_0x0bd5('0x60'),_0x33c5eb);if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs[_0x0bd5('0x63')](_0x33c5eb);}_0x33c5eb=_0x33c5eb+_0x0bd5('0x64');if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs['unlinkSync'](_0x33c5eb);}return _0x1e5e7d;})[_0x0bd5('0x23')](function(_0x32eaaf){if(!_0x32eaaf)throw new InternalError();return _0x32eaaf['destroy']();})[_0x0bd5('0x23')](function(){_0x45ccf5['status'](0xcc)[_0x0bd5('0x19')]();})[_0x0bd5('0x44')](handleError(_0x45ccf5,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index f8d5cdf..0d72276 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 _0x208d=['path','rimraf','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x208d,0xa3));var _0xd208=function(_0x14c00f,_0x11b192){_0x14c00f=_0x14c00f-0x0;var _0x19fbda=_0x208d[_0x14c00f];return _0x19fbda;};'use strict';var _=require(_0xd208('0x0'));var util=require(_0xd208('0x1'));var logger=require('../../config/logger')(_0xd208('0x2'));var moment=require(_0xd208('0x3'));var BPromise=require(_0xd208('0x4'));var rp=require(_0xd208('0x5'));var fs=require('fs');var path=require(_0xd208('0x6'));var rimraf=require(_0xd208('0x7'));var config=require('../../config/environment');var attributes=require(_0xd208('0x8'));module[_0xd208('0x9')]=function(_0x16c987,_0x488335){return _0x16c987['define'](_0xd208('0xa'),attributes,{'tableName':_0xd208('0xb'),'paranoid':![],'indexes':[{'name':_0xd208('0xc'),'fields':[_0xd208('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65f8=['define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports'];(function(_0x58329b,_0x58f381){var _0x5c7173=function(_0x4296ab){while(--_0x4296ab){_0x58329b['push'](_0x58329b['shift']());}};_0x5c7173(++_0x58f381);}(_0x65f8,0x1a7));var _0x865f=function(_0x11a05f,_0x38a6af){_0x11a05f=_0x11a05f-0x0;var _0xdfea63=_0x65f8[_0x11a05f];return _0xdfea63;};'use strict';var _=require(_0x865f('0x0'));var util=require(_0x865f('0x1'));var logger=require(_0x865f('0x2'))(_0x865f('0x3'));var moment=require(_0x865f('0x4'));var BPromise=require(_0x865f('0x5'));var rp=require(_0x865f('0x6'));var fs=require('fs');var path=require(_0x865f('0x7'));var rimraf=require(_0x865f('0x8'));var config=require(_0x865f('0x9'));var attributes=require(_0x865f('0xa'));module[_0x865f('0xb')]=function(_0xfecb7a,_0x38164c){return _0xfecb7a[_0x865f('0xc')](_0x865f('0xd'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x865f('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 3edada7..fceaa35 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 _0x5261=['ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','request','then','info'];(function(_0x5724d8,_0x4ec2ae){var _0x1d32ce=function(_0x4a673d){while(--_0x4a673d){_0x5724d8['push'](_0x5724d8['shift']());}};_0x1d32ce(++_0x4ec2ae);}(_0x5261,0x124));var _0x1526=function(_0x33b871,_0x4762ce){_0x33b871=_0x33b871-0x0;var _0x51eb2f=_0x5261[_0x33b871];return _0x51eb2f;};'use strict';var _=require(_0x1526('0x0'));var util=require(_0x1526('0x1'));var moment=require(_0x1526('0x2'));var BPromise=require(_0x1526('0x3'));var rs=require(_0x1526('0x4'));var fs=require('fs');var Redis=require(_0x1526('0x5'));var db=require(_0x1526('0x6'))['db'];var utils=require(_0x1526('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1526('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x352497,_0x569dd2,_0xda7930){return new BPromise(function(_0x3260d1,_0xc08505){return client[_0x1526('0x9')](_0x352497,_0xda7930)[_0x1526('0xa')](function(_0xdd3547){logger[_0x1526('0xb')](_0x1526('0xc'),_0x569dd2,_0x1526('0xd'));logger[_0x1526('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x569dd2,_0x1526('0xd'),JSON['stringify'](_0xdd3547));if(_0xdd3547[_0x1526('0xf')]){if(_0xdd3547[_0x1526('0xf')][_0x1526('0x10')]===0x1f4){logger[_0x1526('0xf')](_0x1526('0xc'),_0x569dd2,_0xdd3547[_0x1526('0xf')][_0x1526('0x11')]);return _0xc08505(_0xdd3547[_0x1526('0xf')][_0x1526('0x11')]);}logger[_0x1526('0xf')](_0x1526('0xc'),_0x569dd2,_0xdd3547[_0x1526('0xf')]['message']);return _0x3260d1(_0xdd3547[_0x1526('0xf')][_0x1526('0x11')]);}else{logger[_0x1526('0xb')](_0x1526('0xc'),_0x569dd2,'request\x20sent');_0x3260d1(_0xdd3547[_0x1526('0x12')][_0x1526('0x11')]);}})['catch'](function(_0x1080a8){logger[_0x1526('0xf')](_0x1526('0xc'),_0x569dd2,_0x1080a8);_0xc08505(_0x1080a8);});});} \ No newline at end of file +var _0xa275=['error','code','message','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0xa275,0x8b));var _0x5a27=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa275[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x5a27('0x0'));var util=require(_0x5a27('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5a27('0x2'));var logger=require(_0x5a27('0x3'))(_0x5a27('0x4'));var config=require(_0x5a27('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5a27('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c0709,_0x5c9141,_0x3733c3){return new BPromise(function(_0x16921b,_0x435478){return client[_0x5a27('0x7')](_0x1c0709,_0x3733c3)[_0x5a27('0x8')](function(_0x1d9549){logger[_0x5a27('0x9')](_0x5a27('0xa'),_0x5c9141,_0x5a27('0xb'));logger[_0x5a27('0xc')](_0x5a27('0xd'),_0x5c9141,_0x5a27('0xb'),JSON['stringify'](_0x1d9549));if(_0x1d9549[_0x5a27('0xe')]){if(_0x1d9549[_0x5a27('0xe')][_0x5a27('0xf')]===0x1f4){logger[_0x5a27('0xe')](_0x5a27('0xa'),_0x5c9141,_0x1d9549['error'][_0x5a27('0x10')]);return _0x435478(_0x1d9549[_0x5a27('0xe')][_0x5a27('0x10')]);}logger[_0x5a27('0xe')](_0x5a27('0xa'),_0x5c9141,_0x1d9549[_0x5a27('0xe')][_0x5a27('0x10')]);return _0x16921b(_0x1d9549[_0x5a27('0xe')][_0x5a27('0x10')]);}else{logger['info'](_0x5a27('0xa'),_0x5c9141,_0x5a27('0xb'));_0x16921b(_0x1d9549['result'][_0x5a27('0x10')]);}})['catch'](function(_0x35589b){logger[_0x5a27('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x5c9141,_0x35589b);_0x435478(_0x35589b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 85fa95f..15dcb48 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 _0x2a25=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','single','file','addLogo','server/files/images/logos/','logologin','addLogoLogin','preferred','favicon','/:id/favicon','addFavicon','put','update','multer'];(function(_0x3e8d6d,_0x1e6ab8){var _0x5506b1=function(_0x3d819f){while(--_0x3d819f){_0x3e8d6d['push'](_0x3e8d6d['shift']());}};_0x5506b1(++_0x1e6ab8);}(_0x2a25,0x89));var _0x52a2=function(_0x3bc2a0,_0x1ffe3f){_0x3bc2a0=_0x3bc2a0-0x0;var _0x494431=_0x2a25[_0x3bc2a0];return _0x494431;};'use strict';var multer=require(_0x52a2('0x0'));var util=require(_0x52a2('0x1'));var path=require(_0x52a2('0x2'));var timeout=require(_0x52a2('0x3'));var express=require(_0x52a2('0x4'));var router=express[_0x52a2('0x5')]();var fs_extra=require(_0x52a2('0x6'));var auth=require(_0x52a2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x52a2('0x8'));var controller=require(_0x52a2('0x9'));router[_0x52a2('0xa')]('/',auth[_0x52a2('0xb')](),controller[_0x52a2('0xc')]);router['get'](_0x52a2('0xd'),controller[_0x52a2('0xe')]);router['get'](_0x52a2('0xf'),controller[_0x52a2('0x10')]);router['get'](_0x52a2('0x11'),controller[_0x52a2('0x12')]);router[_0x52a2('0xa')]('/:id/logo_login',controller[_0x52a2('0x13')]);router[_0x52a2('0xa')](_0x52a2('0x14'),controller[_0x52a2('0x15')]);router[_0x52a2('0xa')](_0x52a2('0x16'),controller[_0x52a2('0x17')]);router[_0x52a2('0xa')]('/:id/favicon',controller[_0x52a2('0x18')]);var upload=multer({'storage':multer[_0x52a2('0x19')]({'destination':function(_0x43fcf5,_0x203438,_0x48ac4a){_0x48ac4a(null,path[_0x52a2('0x1a')](config[_0x52a2('0x1b')],'server/files/images/logos/'));},'filename':function(_0x942743,_0xaa96a1,_0xdfd24){_0xdfd24(null,util[_0x52a2('0x1c')](_0x52a2('0x1d'),_0x52a2('0x1e'),path[_0x52a2('0x1f')](_0xaa96a1[_0x52a2('0x20')])));}})});router[_0x52a2('0x21')]('/:id/logo',upload[_0x52a2('0x22')](_0x52a2('0x23')),controller[_0x52a2('0x24')]);var upload=multer({'storage':multer[_0x52a2('0x19')]({'destination':function(_0x3e91c8,_0x1923dc,_0x2a326e){_0x2a326e(null,path[_0x52a2('0x1a')](config['root'],_0x52a2('0x25')));},'filename':function(_0x3d89d4,_0x5d0c0c,_0x1bb2b3){_0x1bb2b3(null,util[_0x52a2('0x1c')](_0x52a2('0x1d'),_0x52a2('0x26'),path[_0x52a2('0x1f')](_0x5d0c0c[_0x52a2('0x20')])));}})});router[_0x52a2('0x21')]('/:id/logo_login',upload[_0x52a2('0x22')](_0x52a2('0x23')),controller[_0x52a2('0x27')]);var upload=multer({'storage':multer[_0x52a2('0x19')]({'destination':function(_0x13e0f1,_0x38c2b5,_0x1e215b){_0x1e215b(null,path[_0x52a2('0x1a')](config['root'],_0x52a2('0x25')));},'filename':function(_0x30c4f5,_0x200157,_0x24cb72){_0x24cb72(null,util[_0x52a2('0x1c')](_0x52a2('0x1d'),_0x52a2('0x28'),path[_0x52a2('0x1f')](_0x200157[_0x52a2('0x20')])));}})});router['post'](_0x52a2('0x16'),upload['single']('file'),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfca048,_0x4a9f7d,_0x27fe4a){_0x27fe4a(null,path[_0x52a2('0x1a')](config['root'],_0x52a2('0x25')));},'filename':function(_0x25aa2e,_0x7e675e,_0x3c1d88){_0x3c1d88(null,util[_0x52a2('0x1c')](_0x52a2('0x1d'),_0x52a2('0x29'),path[_0x52a2('0x1f')](_0x7e675e[_0x52a2('0x20')])));}})});router[_0x52a2('0x21')](_0x52a2('0x2a'),upload['single'](_0x52a2('0x23')),controller[_0x52a2('0x2b')]);router[_0x52a2('0x2c')](_0x52a2('0xf'),auth['isAuthenticated'](),controller[_0x52a2('0x2d')]);module['exports']=router; \ No newline at end of file +var _0xac73=['put','update','exports','util','path','express','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogoLogin','/:id/gdpr','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','addLogo','join','root','logologin','post','preferred','/:id/preferred','addPreferred','favicon'];(function(_0x3af2fa,_0x50911f){var _0x2ded50=function(_0x3ce419){while(--_0x3ce419){_0x3af2fa['push'](_0x3af2fa['shift']());}};_0x2ded50(++_0x50911f);}(_0xac73,0xc1));var _0x3ac7=function(_0x4dff71,_0xf009f9){_0x4dff71=_0x4dff71-0x0;var _0x3dc83b=_0xac73[_0x4dff71];return _0x3dc83b;};'use strict';var multer=require('multer');var util=require(_0x3ac7('0x0'));var path=require(_0x3ac7('0x1'));var timeout=require('connect-timeout');var express=require(_0x3ac7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3ac7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3ac7('0x4'));var controller=require(_0x3ac7('0x5'));router[_0x3ac7('0x6')]('/',auth[_0x3ac7('0x7')](),controller[_0x3ac7('0x8')]);router[_0x3ac7('0x6')](_0x3ac7('0x9'),controller[_0x3ac7('0xa')]);router['get'](_0x3ac7('0xb'),controller['show']);router[_0x3ac7('0x6')](_0x3ac7('0xc'),controller['getLogo']);router[_0x3ac7('0x6')]('/:id/logo_login',controller[_0x3ac7('0xd')]);router[_0x3ac7('0x6')](_0x3ac7('0xe'),controller['gdpr']);router[_0x3ac7('0x6')]('/:id/preferred',controller['getPreferred']);router['get'](_0x3ac7('0xf'),controller[_0x3ac7('0x10')]);var upload=multer({'storage':multer[_0x3ac7('0x11')]({'destination':function(_0x4342af,_0x342844,_0x5a5888){_0x5a5888(null,path['join'](config['root'],_0x3ac7('0x12')));},'filename':function(_0x29eab9,_0x188652,_0x5c132e){_0x5c132e(null,util[_0x3ac7('0x13')](_0x3ac7('0x14'),_0x3ac7('0x15'),path[_0x3ac7('0x16')](_0x188652[_0x3ac7('0x17')])));}})});router['post'](_0x3ac7('0xc'),upload[_0x3ac7('0x18')](_0x3ac7('0x19')),controller[_0x3ac7('0x1a')]);var upload=multer({'storage':multer[_0x3ac7('0x11')]({'destination':function(_0x5a1ba0,_0x27ffee,_0x4d9aa9){_0x4d9aa9(null,path[_0x3ac7('0x1b')](config[_0x3ac7('0x1c')],'server/files/images/logos/'));},'filename':function(_0x1d988b,_0x4a67f1,_0x184107){_0x184107(null,util[_0x3ac7('0x13')](_0x3ac7('0x14'),_0x3ac7('0x1d'),path[_0x3ac7('0x16')](_0x4a67f1[_0x3ac7('0x17')])));}})});router[_0x3ac7('0x1e')]('/:id/logo_login',upload['single']('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x3ac7('0x11')]({'destination':function(_0x217b91,_0x57733a,_0x346698){_0x346698(null,path[_0x3ac7('0x1b')](config[_0x3ac7('0x1c')],_0x3ac7('0x12')));},'filename':function(_0x48343b,_0x1aac28,_0x501b1b){_0x501b1b(null,util[_0x3ac7('0x13')](_0x3ac7('0x14'),_0x3ac7('0x1f'),path[_0x3ac7('0x16')](_0x1aac28[_0x3ac7('0x17')])));}})});router[_0x3ac7('0x1e')](_0x3ac7('0x20'),upload[_0x3ac7('0x18')](_0x3ac7('0x19')),controller[_0x3ac7('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36e2ca,_0x101752,_0x48c349){_0x48c349(null,path['join'](config[_0x3ac7('0x1c')],_0x3ac7('0x12')));},'filename':function(_0x331cc5,_0x4cfdb3,_0xfa83e8){_0xfa83e8(null,util[_0x3ac7('0x13')](_0x3ac7('0x14'),_0x3ac7('0x22'),path[_0x3ac7('0x16')](_0x4cfdb3['originalname'])));}})});router[_0x3ac7('0x1e')]('/:id/favicon',upload[_0x3ac7('0x18')](_0x3ac7('0x19')),controller['addFavicon']);router[_0x3ac7('0x23')](_0x3ac7('0xb'),auth['isAuthenticated'](),controller[_0x3ac7('0x24')]);module[_0x3ac7('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 4891db2..8222913 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 _0x4532=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x4532,0x7d));var _0x2453=function(_0x52488d,_0x146c91){_0x52488d=_0x52488d-0x0;var _0x11d3d4=_0x4532[_0x52488d];return _0x11d3d4;};'use strict';var Sequelize=require('sequelize');module[_0x2453('0x0')]={'min_internal':{'type':Sequelize[_0x2453('0x1')](0xb),'unique':_0x2453('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2453('0x1')](0xb),'unique':_0x2453('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2453('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2453('0x4')],'defaultValue':_0x2453('0x5')},'logo':{'type':Sequelize[_0x2453('0x4')]},'defaultLogo':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2453('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2453('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x2453('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x2453('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2453('0x4')],'defaultValue':_0x2453('0x7')},'enableEmailPreview':{'type':Sequelize[_0x2453('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2453('0x4')],'defaultValue':_0x2453('0x8')},'chatTimeout':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x2453('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x2453('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2453('0x4')]},'defaultFavicon':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2453('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2453('0x1')]},'transcribeRegion':{'type':Sequelize[_0x2453('0x4')]},'sentiment':{'type':Sequelize[_0x2453('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x2453('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x2453('0x1')]},'sentimentRegion':{'type':Sequelize[_0x2453('0x4')]},'language':{'type':Sequelize[_0x2453('0x4')]},'bucket':{'type':Sequelize[_0x2453('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x2453('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x2453('0x1')](0x2)[_0x2453('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x2453('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x2453('0x1')](0x2)[_0x2453('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x2453('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x2453('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x2453('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x2453('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x2453('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x2453('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x747b=['INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','min_internal'];(function(_0x9ad44e,_0x46dc71){var _0x503662=function(_0x15495e){while(--_0x15495e){_0x9ad44e['push'](_0x9ad44e['shift']());}};_0x503662(++_0x46dc71);}(_0x747b,0x189));var _0xb747=function(_0x4a1dfc,_0x206662){_0x4a1dfc=_0x4a1dfc-0x0;var _0x40c67d=_0x747b[_0x4a1dfc];return _0x40c67d;};'use strict';var Sequelize=require(_0xb747('0x0'));module[_0xb747('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xb747('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb747('0x3')](0xb),'unique':_0xb747('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xb747('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xb747('0x5')},'logo':{'type':Sequelize[_0xb747('0x6')]},'defaultLogo':{'type':Sequelize[_0xb747('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xb747('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0xb747('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xb747('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb747('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb747('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xb747('0x6')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xb747('0x6')]},'turnpassword':{'type':Sequelize[_0xb747('0x6')]},'pageTitle':{'type':Sequelize[_0xb747('0x6')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xb747('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb747('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xb747('0x6')],'defaultValue':_0xb747('0x8')},'enableEmailPreview':{'type':Sequelize[_0xb747('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xb747('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb747('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xb747('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xb747('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb747('0x6')]},'defaultPreferred':{'type':Sequelize[_0xb747('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb747('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xb747('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0xb747('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xb747('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xb747('0x6')]},'defaultFavicon':{'type':Sequelize[_0xb747('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb747('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb747('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xb747('0x3')]},'transcribeRegion':{'type':Sequelize[_0xb747('0x6')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb747('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb747('0x3')]},'sentimentRegion':{'type':Sequelize[_0xb747('0x6')]},'language':{'type':Sequelize[_0xb747('0x6')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xb747('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb747('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xb747('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xb747('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xb747('0x3')](0x2)[_0xb747('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xb747('0x3')](0x2)[_0xb747('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xb747('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xb747('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xb747('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xb747('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xb747('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xb747('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xb747('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xb747('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xb747('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index a59ed3e..a0c8950 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 _0x953e=['set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','Setting','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','params','find','body','addLogo','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','existsSync','download','getLogoLogin','favicon','defaultLogo','default_loginLogo.svg','default','Sequelize','\x20not\x20found','gdpr','getPreferred','ValidationError','getFavicon','default_favicon.ico','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x53e7a9,_0x13ec2c){var _0x326125=function(_0x2bbde3){while(--_0x2bbde3){_0x53e7a9['push'](_0x53e7a9['shift']());}};_0x326125(++_0x13ec2c);}(_0x953e,0xc6));var _0xe953=function(_0x28ee70,_0xfcd212){_0x28ee70=_0x28ee70-0x0;var _0x906ee6=_0x953e[_0x28ee70];return _0x906ee6;};'use strict';var emlformat=require(_0xe953('0x0'));var rimraf=require(_0xe953('0x1'));var zipdir=require(_0xe953('0x2'));var jsonpatch=require(_0xe953('0x3'));var rp=require(_0xe953('0x4'));var moment=require('moment');var BPromise=require(_0xe953('0x5'));var Mustache=require(_0xe953('0x6'));var util=require(_0xe953('0x7'));var path=require(_0xe953('0x8'));var sox=require(_0xe953('0x9'));var csv=require(_0xe953('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe953('0xb'));var _=require(_0xe953('0xc'));var squel=require(_0xe953('0xd'));var crypto=require(_0xe953('0xe'));var jsforce=require(_0xe953('0xf'));var deskjs=require(_0xe953('0x10'));var toCsv=require(_0xe953('0xa'));var querystring=require(_0xe953('0x11'));var Papa=require(_0xe953('0x12'));var Redis=require(_0xe953('0x13'));var authService=require(_0xe953('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe953('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe953('0x16'));var config=require(_0xe953('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe953('0x18'))['db'];var jayson=require(_0xe953('0x19'));var client=jayson[_0xe953('0x1a')][_0xe953('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xfcd3b8,_0x254cf8,_0x33c14e,_0x77b73e){return new BPromise(function(_0x3c8f45,_0x491e57){var _0x3156b2=_0x77b73e||client;return _0x3156b2[_0xe953('0x1c')](_0xfcd3b8,_0x33c14e)['then'](function(_0xfa4963){logger[_0xe953('0x1d')](_0xe953('0x1e'),_0x254cf8,_0xe953('0x1f'));logger['debug'](_0xe953('0x20'),_0x254cf8,_0xe953('0x1f'),JSON[_0xe953('0x21')](_0xfa4963));if(_0xfa4963['error']){if(_0xfa4963[_0xe953('0x22')][_0xe953('0x23')]===0x1f4){logger[_0xe953('0x22')]('Setting,\x20%s,\x20%s',_0x254cf8,_0xfa4963['error'][_0xe953('0x24')]);return _0x491e57(_0xfa4963[_0xe953('0x22')][_0xe953('0x24')]);}logger[_0xe953('0x22')](_0xe953('0x1e'),_0x254cf8,_0xfa4963[_0xe953('0x22')][_0xe953('0x24')]);return _0x3c8f45(_0xfa4963[_0xe953('0x22')][_0xe953('0x24')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x254cf8,_0xe953('0x1f'));_0x3c8f45(_0xfa4963[_0xe953('0x25')]['message']);}})[_0xe953('0x26')](function(_0x3808ef){logger[_0xe953('0x22')](_0xe953('0x1e'),_0x254cf8,_0x3808ef);_0x491e57(_0x3808ef);});});}function respondWithStatusCode(_0x6039d6,_0x1871a4){_0x1871a4=_0x1871a4||0xcc;return function(_0x2ebe98){if(_0x2ebe98){return _0x6039d6[_0xe953('0x27')](_0x1871a4);}return _0x6039d6[_0xe953('0x28')](_0x1871a4)[_0xe953('0x29')]();};}function respondWithResult(_0xfa79db,_0x346f94){_0x346f94=_0x346f94||0xc8;return function(_0x845e9c){if(_0x845e9c){return _0xfa79db[_0xe953('0x28')](_0x346f94)['json'](_0x845e9c);}};}function respondWithFilteredResult(_0x12ca92,_0x70b1a){return function(_0x24ec99){if(_0x24ec99){var _0x558e21=typeof _0x70b1a[_0xe953('0x2a')]===_0xe953('0x2b')&&typeof _0x70b1a['limit']==='undefined';var _0x4d71ba=_0x24ec99[_0xe953('0x2c')];var _0x5dd338=_0x558e21?0x0:_0x70b1a[_0xe953('0x2a')];var _0x1acc7=_0x558e21?_0x24ec99['count']:_0x70b1a['offset']+_0x70b1a[_0xe953('0x2d')];var _0x338de7;if(_0x1acc7>=_0x4d71ba){_0x1acc7=_0x4d71ba;_0x338de7=0xc8;}else{_0x338de7=0xce;}_0x12ca92[_0xe953('0x28')](_0x338de7);return _0x12ca92[_0xe953('0x2e')](_0xe953('0x2f'),_0x5dd338+'-'+_0x1acc7+'/'+_0x4d71ba)[_0xe953('0x30')](_0x24ec99);}return null;};}function patchUpdates(_0x40f0af){return function(_0x4bcfae){try{jsonpatch[_0xe953('0x31')](_0x4bcfae,_0x40f0af,!![]);}catch(_0x2d77cc){return BPromise[_0xe953('0x32')](_0x2d77cc);}return _0x4bcfae[_0xe953('0x33')]();};}function saveUpdates(_0x70c5e,_0x1091a4){return function(_0xf0ebea){if(_0xf0ebea){return _0xf0ebea['update'](_0x70c5e)[_0xe953('0x34')](function(_0x1e2105){return _0x1e2105;});}return null;};}function removeEntity(_0x40ddc3,_0x2a6c4b){return function(_0x5e24f3){if(_0x5e24f3){return _0x5e24f3[_0xe953('0x35')]()['then'](function(){_0x40ddc3[_0xe953('0x28')](0xcc)[_0xe953('0x29')]();});}};}function handleEntityNotFound(_0x34d442,_0x165a9c){return function(_0x1fcfe1){if(!_0x1fcfe1){_0x34d442[_0xe953('0x27')](0x194);}return _0x1fcfe1;};}function handleError(_0x2e06b,_0x188315){_0x188315=_0x188315||0x1f4;return function(_0x55246a){logger[_0xe953('0x22')](_0x55246a[_0xe953('0x36')]);if(_0x55246a[_0xe953('0x37')]){delete _0x55246a[_0xe953('0x37')];}_0x2e06b[_0xe953('0x28')](_0x188315)[_0xe953('0x38')](_0x55246a);};}exports[_0xe953('0x39')]=function(_0x409d77,_0x3ee354){var _0x4bc602={},_0x267f9f={},_0x495dd={'count':0x0,'rows':[]};var _0x502e47=_['map'](db[_0xe953('0x3a')][_0xe953('0x3b')],function(_0x2ee824){return{'name':_0x2ee824[_0xe953('0x3c')],'type':_0x2ee824['type'][_0xe953('0x3d')]};});_0x267f9f[_0xe953('0x3e')]=_[_0xe953('0x3f')](_0x502e47,_0xe953('0x37'));_0x267f9f[_0xe953('0x40')]=_[_0xe953('0x41')](_0x409d77['query']);_0x267f9f['filters']=_['intersection'](_0x267f9f[_0xe953('0x3e')],_0x267f9f[_0xe953('0x40')]);_0x4bc602[_0xe953('0x42')]=_[_0xe953('0x43')](_0x267f9f[_0xe953('0x3e')],qs['fields'](_0x409d77['query'][_0xe953('0x44')]));_0x4bc602['attributes']=_0x4bc602[_0xe953('0x42')]['length']?_0x4bc602['attributes']:_0x267f9f[_0xe953('0x3e')];if(!_0x409d77[_0xe953('0x40')][_0xe953('0x45')](_0xe953('0x46'))){_0x4bc602[_0xe953('0x2d')]=qs[_0xe953('0x2d')](_0x409d77['query'][_0xe953('0x2d')]);_0x4bc602[_0xe953('0x2a')]=qs['offset'](_0x409d77[_0xe953('0x40')][_0xe953('0x2a')]);}_0x4bc602['order']=qs[_0xe953('0x47')](_0x409d77[_0xe953('0x40')][_0xe953('0x47')]);_0x4bc602[_0xe953('0x48')]=qs[_0xe953('0x49')](_[_0xe953('0x4a')](_0x409d77[_0xe953('0x40')],_0x267f9f[_0xe953('0x49')]),_0x502e47);if(_0x409d77[_0xe953('0x40')][_0xe953('0x4b')]){_0x4bc602['where']=_[_0xe953('0x4c')](_0x4bc602[_0xe953('0x48')],{'$or':_[_0xe953('0x3f')](_0x502e47,function(_0x3a24af){if(_0x3a24af[_0xe953('0x4d')]!==_0xe953('0x4e')){var _0x107b4e={};_0x107b4e[_0x3a24af[_0xe953('0x37')]]={'$like':'%'+_0x409d77[_0xe953('0x40')][_0xe953('0x4b')]+'%'};return _0x107b4e;}})});}_0x4bc602=_[_0xe953('0x4c')]({},_0x4bc602,_0x409d77[_0xe953('0x4f')]);var _0x5e5caa={'where':_0x4bc602[_0xe953('0x48')]};return db['Setting'][_0xe953('0x2c')](_0x5e5caa)[_0xe953('0x34')](function(_0x392dd3){_0x495dd[_0xe953('0x2c')]=_0x392dd3;if(_0x409d77[_0xe953('0x40')][_0xe953('0x50')]){_0x4bc602[_0xe953('0x51')]=[{'all':!![]}];}return db['Setting'][_0xe953('0x52')](_0x4bc602);})[_0xe953('0x34')](function(_0x165d3d){_0x495dd['rows']=_0x165d3d;return _0x495dd;})[_0xe953('0x34')](respondWithFilteredResult(_0x3ee354,_0x4bc602))[_0xe953('0x26')](handleError(_0x3ee354,null));};exports['show']=function(_0x9d9d8,_0x2e0db1){var _0x49f883={'raw':![],'where':{'id':_0x9d9d8[_0xe953('0x53')]['id']}},_0x3f2a76={};_0x3f2a76[_0xe953('0x3e')]=_['keys'](db[_0xe953('0x3a')][_0xe953('0x3b')]);_0x3f2a76['query']=_['keys'](_0x9d9d8['query']);_0x3f2a76['filters']=_[_0xe953('0x43')](_0x3f2a76[_0xe953('0x3e')],_0x3f2a76[_0xe953('0x40')]);_0x49f883[_0xe953('0x42')]=_['intersection'](_0x3f2a76[_0xe953('0x3e')],qs[_0xe953('0x44')](_0x9d9d8[_0xe953('0x40')]['fields']));_0x49f883['attributes']=_0x49f883[_0xe953('0x42')]['length']?_0x49f883['attributes']:_0x3f2a76[_0xe953('0x3e')];if(_0x9d9d8['query'][_0xe953('0x50')]){_0x49f883[_0xe953('0x51')]=[{'all':!![]}];}_0x49f883=_['merge']({},_0x49f883,_0x9d9d8[_0xe953('0x4f')]);return db['Setting'][_0xe953('0x54')](_0x49f883)['then'](handleEntityNotFound(_0x2e0db1,null))[_0xe953('0x34')](respondWithResult(_0x2e0db1,null))['catch'](handleError(_0x2e0db1,null));};exports['update']=function(_0x35aac6,_0x14393d){if(_0x35aac6['body']['id']){delete _0x35aac6[_0xe953('0x55')]['id'];}return db[_0xe953('0x3a')][_0xe953('0x54')]({'where':{'id':_0x35aac6[_0xe953('0x53')]['id']}})[_0xe953('0x34')](handleEntityNotFound(_0x14393d,null))[_0xe953('0x34')](saveUpdates(_0x35aac6[_0xe953('0x55')],null))[_0xe953('0x34')](respondWithResult(_0x14393d,null))[_0xe953('0x26')](handleError(_0x14393d,null));};exports[_0xe953('0x56')]=function(_0x6d3f1a,_0x414769,_0x36637a){if(_0x6d3f1a[_0xe953('0x57')]&&_0x6d3f1a[_0xe953('0x57')][_0xe953('0x58')]){_0x6d3f1a[_0xe953('0x55')][_0xe953('0x59')]=_0x6d3f1a[_0xe953('0x57')][_0xe953('0x58')];}return db[_0xe953('0x3a')]['find']({'where':{'id':_0x6d3f1a[_0xe953('0x53')]['id']}})[_0xe953('0x34')](handleEntityNotFound(_0x414769,null))[_0xe953('0x34')](saveUpdates(_0x6d3f1a[_0xe953('0x55')],null))[_0xe953('0x34')](respondWithResult(_0x414769,null))['catch'](handleError(_0x414769,null));};exports['addLogoLogin']=function(_0x9509d5,_0x480ffc,_0x2e2b3f){if(_0x9509d5[_0xe953('0x57')]&&_0x9509d5['file'][_0xe953('0x58')]){_0x9509d5['body'][_0xe953('0x5a')]=_0x9509d5[_0xe953('0x57')][_0xe953('0x58')];}return db['Setting'][_0xe953('0x54')]({'where':{'id':_0x9509d5[_0xe953('0x53')]['id']}})[_0xe953('0x34')](handleEntityNotFound(_0x480ffc,null))[_0xe953('0x34')](saveUpdates(_0x9509d5[_0xe953('0x55')],null))[_0xe953('0x34')](respondWithResult(_0x480ffc,null))[_0xe953('0x26')](handleError(_0x480ffc,null));};var utilLicense=require(_0xe953('0x5b'));exports[_0xe953('0x5c')]=function(_0x10de4e,_0x1328e6,_0x801c77){var _0x5656b7=_0xe953('0x5d');var _0x31e27f={'custom':![]};return utilLicense[_0xe953('0x5e')]()[_0xe953('0x34')](function(_0x40d4e5){if(_0x40d4e5){_0x31e27f=_0x40d4e5;}return db['Setting'][_0xe953('0x54')]({'where':{'id':_0x10de4e[_0xe953('0x53')]['id']},'attributes':[_0xe953('0x59'),_0xe953('0x5a'),_0xe953('0x5f'),'favicon','defaultLogo',_0xe953('0x60'),_0xe953('0x61'),_0xe953('0x62')],'raw':!![]});})[_0xe953('0x34')](handleEntityNotFound(_0x1328e6,null))[_0xe953('0x34')](function(_0x25d625){if(_0x25d625){var _0x1abde2=_0x25d625[_0xe953('0x59')]&&fs['existsSync'](path[_0xe953('0x63')](config[_0xe953('0x64')],_0x5656b7,_[_0xe953('0x65')](_0x25d625[_0xe953('0x59')])))?path[_0xe953('0x63')](config[_0xe953('0x64')],_0x5656b7,_['toLower'](_0x25d625[_0xe953('0x59')])):path[_0xe953('0x63')](config['root'],_0x5656b7,_['toLower'](_0xe953('0x66')));var _0x29fa98='default'+_[_0xe953('0x67')](_0xe953('0x59'));if(_0x25d625[_0x29fa98]||!_0x31e27f[_0xe953('0x68')]){_0x1abde2=path['join'](config[_0xe953('0x64')],_0x5656b7,_[_0xe953('0x65')](_0xe953('0x66')));}if(!fs[_0xe953('0x69')](_0x1abde2)){throw new db['Sequelize']['ValidationError'](_[_0xe953('0x67')](_0xe953('0x59'))+'\x20not\x20found');}return _0x1328e6[_0xe953('0x6a')](_0x1abde2);}})['catch'](handleError(_0x1328e6,null));};var utilLicense=require(_0xe953('0x5b'));exports[_0xe953('0x6b')]=function(_0xcec2fb,_0x2df70b,_0x2f4904){var _0x33f75a=_0xe953('0x5d');var _0x1f152c={'custom':![]};return utilLicense['getLicense']()[_0xe953('0x34')](function(_0x2b4226){if(_0x2b4226){_0x1f152c=_0x2b4226;}return db[_0xe953('0x3a')][_0xe953('0x54')]({'where':{'id':_0xcec2fb[_0xe953('0x53')]['id']},'attributes':[_0xe953('0x59'),_0xe953('0x5a'),_0xe953('0x5f'),_0xe953('0x6c'),_0xe953('0x6d'),_0xe953('0x60'),_0xe953('0x61'),'defaultFavicon'],'raw':!![]});})[_0xe953('0x34')](handleEntityNotFound(_0x2df70b,null))[_0xe953('0x34')](function(_0x5cd76a){if(_0x5cd76a){var _0x235dc8=_0x5cd76a[_0xe953('0x5a')]&&fs['existsSync'](path['join'](config[_0xe953('0x64')],_0x33f75a,_[_0xe953('0x65')](_0x5cd76a[_0xe953('0x5a')])))?path['join'](config[_0xe953('0x64')],_0x33f75a,_[_0xe953('0x65')](_0x5cd76a[_0xe953('0x5a')])):path['join'](config[_0xe953('0x64')],_0x33f75a,_[_0xe953('0x65')](_0xe953('0x6e')));var _0x5bbfaa=_0xe953('0x6f')+_[_0xe953('0x67')](_0xe953('0x5a'));if(_0x5cd76a[_0x5bbfaa]||!_0x1f152c[_0xe953('0x68')]){_0x235dc8=path[_0xe953('0x63')](config['root'],_0x33f75a,_[_0xe953('0x65')](_0xe953('0x6e')));}if(!fs[_0xe953('0x69')](_0x235dc8)){throw new db[(_0xe953('0x70'))]['ValidationError'](_[_0xe953('0x67')](_0xe953('0x5a'))+_0xe953('0x71'));}return _0x2df70b[_0xe953('0x6a')](_0x235dc8);}})[_0xe953('0x26')](handleError(_0x2df70b,null));};exports[_0xe953('0x72')]=function(_0x24f55c,_0x2ddb17){return db[_0xe953('0x3a')][_0xe953('0x54')]({'where':{'id':_0x24f55c[_0xe953('0x53')]['id']},'attributes':['securePassword']})[_0xe953('0x34')](respondWithResult(_0x2ddb17,null))['catch'](handleError(_0x2ddb17,null));};exports['addPreferred']=function(_0x32a7eb,_0x1fc63b,_0x44a063){if(_0x32a7eb[_0xe953('0x57')]&&_0x32a7eb[_0xe953('0x57')]['filename']){_0x32a7eb[_0xe953('0x55')][_0xe953('0x5f')]=_0x32a7eb[_0xe953('0x57')][_0xe953('0x58')];}return db[_0xe953('0x3a')][_0xe953('0x54')]({'where':{'id':_0x32a7eb[_0xe953('0x53')]['id']}})[_0xe953('0x34')](handleEntityNotFound(_0x1fc63b,null))['then'](saveUpdates(_0x32a7eb[_0xe953('0x55')],null))[_0xe953('0x34')](respondWithResult(_0x1fc63b,null))[_0xe953('0x26')](handleError(_0x1fc63b,null));};var utilLicense=require(_0xe953('0x5b'));exports[_0xe953('0x73')]=function(_0x462a50,_0x5cb591,_0x4fb3a1){var _0x2e32bc=_0xe953('0x5d');var _0x52daaa={'custom':![]};return utilLicense[_0xe953('0x5e')]()[_0xe953('0x34')](function(_0xdc19fb){if(_0xdc19fb){_0x52daaa=_0xdc19fb;}return db[_0xe953('0x3a')][_0xe953('0x54')]({'where':{'id':_0x462a50[_0xe953('0x53')]['id']},'attributes':[_0xe953('0x59'),_0xe953('0x5a'),_0xe953('0x5f'),_0xe953('0x6c'),_0xe953('0x6d'),_0xe953('0x60'),_0xe953('0x61'),_0xe953('0x62')],'raw':!![]});})[_0xe953('0x34')](handleEntityNotFound(_0x5cb591,null))[_0xe953('0x34')](function(_0x1bb19a){if(_0x1bb19a){var _0x23ee04=_0x1bb19a[_0xe953('0x5f')]&&fs[_0xe953('0x69')](path[_0xe953('0x63')](config['root'],_0x2e32bc,_['toLower'](_0x1bb19a['preferred'])))?path['join'](config[_0xe953('0x64')],_0x2e32bc,_[_0xe953('0x65')](_0x1bb19a['preferred'])):path['join'](config['root'],_0x2e32bc,_[_0xe953('0x65')]('default_preferred.png'));var _0x5910c3='default'+_[_0xe953('0x67')]('preferred');if(_0x1bb19a[_0x5910c3]||!_0x52daaa[_0xe953('0x68')]||!_0x52daaa[_0xe953('0x5f')]){_0x23ee04=path[_0xe953('0x63')](config[_0xe953('0x64')],_0x2e32bc,_[_0xe953('0x65')]('default_preferred.png'));}if(!fs[_0xe953('0x69')](_0x23ee04)){throw new db[(_0xe953('0x70'))][(_0xe953('0x74'))](_['upperFirst'](_0xe953('0x5f'))+_0xe953('0x71'));}return _0x5cb591['download'](_0x23ee04);}})['catch'](handleError(_0x5cb591,null));};exports['addFavicon']=function(_0x2af42a,_0x5d0a86,_0x576264){if(_0x2af42a[_0xe953('0x57')]&&_0x2af42a[_0xe953('0x57')]['filename']){_0x2af42a[_0xe953('0x55')][_0xe953('0x6c')]=_0x2af42a['file'][_0xe953('0x58')];}return db[_0xe953('0x3a')]['find']({'where':{'id':_0x2af42a['params']['id']}})['then'](handleEntityNotFound(_0x5d0a86,null))[_0xe953('0x34')](saveUpdates(_0x2af42a[_0xe953('0x55')],null))['then'](respondWithResult(_0x5d0a86,null))[_0xe953('0x26')](handleError(_0x5d0a86,null));};var utilLicense=require(_0xe953('0x5b'));exports[_0xe953('0x75')]=function(_0x98945e,_0x236ccd,_0x33f2d6){var _0x220409=_0xe953('0x5d');var _0x40fc75={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x348177){if(_0x348177){_0x40fc75=_0x348177;}return db[_0xe953('0x3a')]['find']({'where':{'id':_0x98945e[_0xe953('0x53')]['id']},'attributes':[_0xe953('0x59'),'loginLogo',_0xe953('0x5f'),_0xe953('0x6c'),_0xe953('0x6d'),_0xe953('0x60'),_0xe953('0x61'),_0xe953('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x236ccd,null))[_0xe953('0x34')](function(_0x474807){if(_0x474807){var _0xb423d3=_0x474807[_0xe953('0x6c')]&&fs[_0xe953('0x69')](path['join'](config['root'],_0x220409,_[_0xe953('0x65')](_0x474807[_0xe953('0x6c')])))?path['join'](config['root'],_0x220409,_[_0xe953('0x65')](_0x474807['favicon'])):path[_0xe953('0x63')](config[_0xe953('0x64')],_0x220409,_[_0xe953('0x65')](_0xe953('0x76')));var _0x221cfc=_0xe953('0x6f')+_['upperFirst'](_0xe953('0x6c'));if(_0x474807[_0x221cfc]||!_0x40fc75[_0xe953('0x68')]){_0xb423d3=path[_0xe953('0x63')](config[_0xe953('0x64')],_0x220409,_['toLower'](_0xe953('0x76')));}if(!fs[_0xe953('0x69')](_0xb423d3)){throw new db[(_0xe953('0x70'))][(_0xe953('0x74'))](_['upperFirst'](_0xe953('0x6c'))+_0xe953('0x71'));}return _0x236ccd[_0xe953('0x6a')](_0xb423d3);}})[_0xe953('0x26')](handleError(_0x236ccd,null));};exports['getDate']=function(_0x464a8b,_0x38ef45){var _0x381d88={'offset':moment()['utcOffset']()};_0x381d88[_0xe953('0x77')]=moment()['utcOffset'](_0x381d88[_0xe953('0x2a')])[_0xe953('0x78')](_0xe953('0x79'));return _0x38ef45[_0xe953('0x28')](0xc8)[_0xe953('0x38')](_0x381d88);}; \ No newline at end of file +var _0x4784=['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','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','map','Setting','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','params','rawAttributes','options','find','body','addLogo','filename','logo','addLogoLogin','file','loginLogo','getLicense','preferred','favicon','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','server/files/images/logos','defaultLogo','gdpr','securePassword','addPreferred','defaultPreferred','ValidationError','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse'];(function(_0xd618c8,_0x474cc5){var _0x4815e7=function(_0x29343b){while(--_0x29343b){_0xd618c8['push'](_0xd618c8['shift']());}};_0x4815e7(++_0x474cc5);}(_0x4784,0xe4));var _0x4478=function(_0x888ce1,_0x17f5b6){_0x888ce1=_0x888ce1-0x0;var _0x9e0a30=_0x4784[_0x888ce1];return _0x9e0a30;};'use strict';var emlformat=require(_0x4478('0x0'));var rimraf=require(_0x4478('0x1'));var zipdir=require(_0x4478('0x2'));var jsonpatch=require(_0x4478('0x3'));var rp=require(_0x4478('0x4'));var moment=require(_0x4478('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4478('0x6'));var util=require(_0x4478('0x7'));var path=require(_0x4478('0x8'));var sox=require('sox');var csv=require(_0x4478('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4478('0xa'));var _=require('lodash');var squel=require(_0x4478('0xb'));var crypto=require(_0x4478('0xc'));var jsforce=require(_0x4478('0xd'));var deskjs=require(_0x4478('0xe'));var toCsv=require(_0x4478('0x9'));var querystring=require('querystring');var Papa=require(_0x4478('0xf'));var Redis=require(_0x4478('0x10'));var authService=require(_0x4478('0x11'));var qs=require(_0x4478('0x12'));var as=require(_0x4478('0x13'));var hardwareService=require(_0x4478('0x14'));var logger=require(_0x4478('0x15'))('api');var utils=require(_0x4478('0x16'));var config=require(_0x4478('0x17'));var licenseUtil=require(_0x4478('0x18'));var db=require(_0x4478('0x19'))['db'];var jayson=require(_0x4478('0x1a'));var client=jayson[_0x4478('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4a7f,_0x26b881,_0x4286ce,_0x36dacc){return new BPromise(function(_0x38bcfc,_0x4d74ee){var _0x52cd71=_0x36dacc||client;return _0x52cd71[_0x4478('0x1c')](_0x3a4a7f,_0x4286ce)[_0x4478('0x1d')](function(_0x136574){logger[_0x4478('0x1e')](_0x4478('0x1f'),_0x26b881,_0x4478('0x20'));logger[_0x4478('0x21')]('Setting,\x20%s,\x20%s,\x20%s',_0x26b881,_0x4478('0x20'),JSON[_0x4478('0x22')](_0x136574));if(_0x136574[_0x4478('0x23')]){if(_0x136574[_0x4478('0x23')][_0x4478('0x24')]===0x1f4){logger['error'](_0x4478('0x1f'),_0x26b881,_0x136574[_0x4478('0x23')]['message']);return _0x4d74ee(_0x136574[_0x4478('0x23')][_0x4478('0x25')]);}logger['error'](_0x4478('0x1f'),_0x26b881,_0x136574[_0x4478('0x23')][_0x4478('0x25')]);return _0x38bcfc(_0x136574[_0x4478('0x23')][_0x4478('0x25')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x26b881,_0x4478('0x20'));_0x38bcfc(_0x136574[_0x4478('0x26')]['message']);}})[_0x4478('0x27')](function(_0x2e99ad){logger[_0x4478('0x23')]('Setting,\x20%s,\x20%s',_0x26b881,_0x2e99ad);_0x4d74ee(_0x2e99ad);});});}function respondWithStatusCode(_0x44cfda,_0xc6717d){_0xc6717d=_0xc6717d||0xcc;return function(_0x12a4aa){if(_0x12a4aa){return _0x44cfda['sendStatus'](_0xc6717d);}return _0x44cfda[_0x4478('0x28')](_0xc6717d)[_0x4478('0x29')]();};}function respondWithResult(_0x573ed5,_0x5ce9f6){_0x5ce9f6=_0x5ce9f6||0xc8;return function(_0x25fcaa){if(_0x25fcaa){return _0x573ed5[_0x4478('0x28')](_0x5ce9f6)[_0x4478('0x2a')](_0x25fcaa);}};}function respondWithFilteredResult(_0x5326fb,_0x3d5405){return function(_0xcf0038){if(_0xcf0038){var _0x46055a=typeof _0x3d5405[_0x4478('0x2b')]===_0x4478('0x2c')&&typeof _0x3d5405[_0x4478('0x2d')]===_0x4478('0x2c');var _0x12104d=_0xcf0038['count'];var _0x88b0c8=_0x46055a?0x0:_0x3d5405[_0x4478('0x2b')];var _0x2ba88b=_0x46055a?_0xcf0038['count']:_0x3d5405['offset']+_0x3d5405[_0x4478('0x2d')];var _0x1b027f;if(_0x2ba88b>=_0x12104d){_0x2ba88b=_0x12104d;_0x1b027f=0xc8;}else{_0x1b027f=0xce;}_0x5326fb[_0x4478('0x28')](_0x1b027f);return _0x5326fb[_0x4478('0x2e')](_0x4478('0x2f'),_0x88b0c8+'-'+_0x2ba88b+'/'+_0x12104d)['json'](_0xcf0038);}return null;};}function patchUpdates(_0x2cbe43){return function(_0x400d50){try{jsonpatch[_0x4478('0x30')](_0x400d50,_0x2cbe43,!![]);}catch(_0x20ff66){return BPromise[_0x4478('0x31')](_0x20ff66);}return _0x400d50[_0x4478('0x32')]();};}function saveUpdates(_0x5dfbd3,_0x2f3514){return function(_0x330266){if(_0x330266){return _0x330266[_0x4478('0x33')](_0x5dfbd3)[_0x4478('0x1d')](function(_0x1635da){return _0x1635da;});}return null;};}function removeEntity(_0x5311e8,_0x3a1615){return function(_0x90e6c){if(_0x90e6c){return _0x90e6c[_0x4478('0x34')]()[_0x4478('0x1d')](function(){_0x5311e8[_0x4478('0x28')](0xcc)[_0x4478('0x29')]();});}};}function handleEntityNotFound(_0x4493e1,_0x4b783a){return function(_0x2e6797){if(!_0x2e6797){_0x4493e1[_0x4478('0x35')](0x194);}return _0x2e6797;};}function handleError(_0x426b08,_0x2ea746){_0x2ea746=_0x2ea746||0x1f4;return function(_0x3d1c9a){logger[_0x4478('0x23')](_0x3d1c9a['stack']);if(_0x3d1c9a[_0x4478('0x36')]){delete _0x3d1c9a['name'];}_0x426b08[_0x4478('0x28')](_0x2ea746)[_0x4478('0x37')](_0x3d1c9a);};}exports[_0x4478('0x38')]=function(_0x1f6dee,_0x270a59){var _0x44f4d1={},_0x2a6c1c={},_0x10119f={'count':0x0,'rows':[]};var _0x1d849f=_[_0x4478('0x39')](db[_0x4478('0x3a')]['rawAttributes'],function(_0x4d686a){return{'name':_0x4d686a[_0x4478('0x3b')],'type':_0x4d686a[_0x4478('0x3c')][_0x4478('0x3d')]};});_0x2a6c1c[_0x4478('0x3e')]=_[_0x4478('0x39')](_0x1d849f,_0x4478('0x36'));_0x2a6c1c['query']=_[_0x4478('0x3f')](_0x1f6dee['query']);_0x2a6c1c[_0x4478('0x40')]=_[_0x4478('0x41')](_0x2a6c1c['model'],_0x2a6c1c[_0x4478('0x42')]);_0x44f4d1['attributes']=_[_0x4478('0x41')](_0x2a6c1c[_0x4478('0x3e')],qs[_0x4478('0x43')](_0x1f6dee[_0x4478('0x42')][_0x4478('0x43')]));_0x44f4d1[_0x4478('0x44')]=_0x44f4d1[_0x4478('0x44')][_0x4478('0x45')]?_0x44f4d1['attributes']:_0x2a6c1c['model'];if(!_0x1f6dee[_0x4478('0x42')][_0x4478('0x46')]('nolimit')){_0x44f4d1['limit']=qs[_0x4478('0x2d')](_0x1f6dee[_0x4478('0x42')]['limit']);_0x44f4d1[_0x4478('0x2b')]=qs[_0x4478('0x2b')](_0x1f6dee['query'][_0x4478('0x2b')]);}_0x44f4d1[_0x4478('0x47')]=qs[_0x4478('0x48')](_0x1f6dee['query'][_0x4478('0x48')]);_0x44f4d1['where']=qs['filters'](_['pick'](_0x1f6dee[_0x4478('0x42')],_0x2a6c1c[_0x4478('0x40')]),_0x1d849f);if(_0x1f6dee['query'][_0x4478('0x49')]){_0x44f4d1[_0x4478('0x4a')]=_[_0x4478('0x4b')](_0x44f4d1['where'],{'$or':_[_0x4478('0x39')](_0x1d849f,function(_0x2379a6){if(_0x2379a6[_0x4478('0x3c')]!==_0x4478('0x4c')){var _0x262210={};_0x262210[_0x2379a6[_0x4478('0x36')]]={'$like':'%'+_0x1f6dee[_0x4478('0x42')]['filter']+'%'};return _0x262210;}})});}_0x44f4d1=_[_0x4478('0x4b')]({},_0x44f4d1,_0x1f6dee['options']);var _0x3db312={'where':_0x44f4d1[_0x4478('0x4a')]};return db[_0x4478('0x3a')][_0x4478('0x4d')](_0x3db312)[_0x4478('0x1d')](function(_0x3fd721){_0x10119f[_0x4478('0x4d')]=_0x3fd721;if(_0x1f6dee['query'][_0x4478('0x4e')]){_0x44f4d1[_0x4478('0x4f')]=[{'all':!![]}];}return db[_0x4478('0x3a')][_0x4478('0x50')](_0x44f4d1);})[_0x4478('0x1d')](function(_0x27ebbd){_0x10119f['rows']=_0x27ebbd;return _0x10119f;})['then'](respondWithFilteredResult(_0x270a59,_0x44f4d1))[_0x4478('0x27')](handleError(_0x270a59,null));};exports['show']=function(_0x80882,_0x482b17){var _0x44d2f3={'raw':![],'where':{'id':_0x80882[_0x4478('0x51')]['id']}},_0x58b475={};_0x58b475['model']=_[_0x4478('0x3f')](db[_0x4478('0x3a')][_0x4478('0x52')]);_0x58b475[_0x4478('0x42')]=_[_0x4478('0x3f')](_0x80882[_0x4478('0x42')]);_0x58b475[_0x4478('0x40')]=_[_0x4478('0x41')](_0x58b475['model'],_0x58b475['query']);_0x44d2f3[_0x4478('0x44')]=_['intersection'](_0x58b475[_0x4478('0x3e')],qs[_0x4478('0x43')](_0x80882[_0x4478('0x42')][_0x4478('0x43')]));_0x44d2f3['attributes']=_0x44d2f3[_0x4478('0x44')]['length']?_0x44d2f3[_0x4478('0x44')]:_0x58b475[_0x4478('0x3e')];if(_0x80882[_0x4478('0x42')]['includeAll']){_0x44d2f3[_0x4478('0x4f')]=[{'all':!![]}];}_0x44d2f3=_[_0x4478('0x4b')]({},_0x44d2f3,_0x80882[_0x4478('0x53')]);return db['Setting'][_0x4478('0x54')](_0x44d2f3)[_0x4478('0x1d')](handleEntityNotFound(_0x482b17,null))[_0x4478('0x1d')](respondWithResult(_0x482b17,null))['catch'](handleError(_0x482b17,null));};exports[_0x4478('0x33')]=function(_0x3764a3,_0x2fc501){if(_0x3764a3[_0x4478('0x55')]['id']){delete _0x3764a3[_0x4478('0x55')]['id'];}return db[_0x4478('0x3a')][_0x4478('0x54')]({'where':{'id':_0x3764a3[_0x4478('0x51')]['id']}})[_0x4478('0x1d')](handleEntityNotFound(_0x2fc501,null))[_0x4478('0x1d')](saveUpdates(_0x3764a3['body'],null))[_0x4478('0x1d')](respondWithResult(_0x2fc501,null))[_0x4478('0x27')](handleError(_0x2fc501,null));};exports[_0x4478('0x56')]=function(_0x31430b,_0xed71b7,_0xecff17){if(_0x31430b['file']&&_0x31430b['file'][_0x4478('0x57')]){_0x31430b[_0x4478('0x55')][_0x4478('0x58')]=_0x31430b['file'][_0x4478('0x57')];}return db['Setting']['find']({'where':{'id':_0x31430b[_0x4478('0x51')]['id']}})[_0x4478('0x1d')](handleEntityNotFound(_0xed71b7,null))['then'](saveUpdates(_0x31430b['body'],null))[_0x4478('0x1d')](respondWithResult(_0xed71b7,null))['catch'](handleError(_0xed71b7,null));};exports[_0x4478('0x59')]=function(_0x8bf4e0,_0x41c852,_0x1bbb58){if(_0x8bf4e0[_0x4478('0x5a')]&&_0x8bf4e0[_0x4478('0x5a')][_0x4478('0x57')]){_0x8bf4e0[_0x4478('0x55')][_0x4478('0x5b')]=_0x8bf4e0[_0x4478('0x5a')][_0x4478('0x57')];}return db[_0x4478('0x3a')][_0x4478('0x54')]({'where':{'id':_0x8bf4e0[_0x4478('0x51')]['id']}})[_0x4478('0x1d')](handleEntityNotFound(_0x41c852,null))[_0x4478('0x1d')](saveUpdates(_0x8bf4e0[_0x4478('0x55')],null))['then'](respondWithResult(_0x41c852,null))[_0x4478('0x27')](handleError(_0x41c852,null));};var utilLicense=require(_0x4478('0x18'));exports['getLogo']=function(_0x39fb95,_0x18d245,_0x46bd0a){var _0x1b3a67='server/files/images/logos';var _0x14ff3d={'custom':![]};return utilLicense[_0x4478('0x5c')]()[_0x4478('0x1d')](function(_0x3281e0){if(_0x3281e0){_0x14ff3d=_0x3281e0;}return db['Setting'][_0x4478('0x54')]({'where':{'id':_0x39fb95[_0x4478('0x51')]['id']},'attributes':[_0x4478('0x58'),_0x4478('0x5b'),_0x4478('0x5d'),_0x4478('0x5e'),'defaultLogo',_0x4478('0x5f'),'defaultPreferred',_0x4478('0x60')],'raw':!![]});})[_0x4478('0x1d')](handleEntityNotFound(_0x18d245,null))[_0x4478('0x1d')](function(_0x5eed02){if(_0x5eed02){var _0xc0055e=_0x5eed02['logo']&&fs[_0x4478('0x61')](path[_0x4478('0x62')](config[_0x4478('0x63')],_0x1b3a67,_[_0x4478('0x64')](_0x5eed02[_0x4478('0x58')])))?path[_0x4478('0x62')](config[_0x4478('0x63')],_0x1b3a67,_[_0x4478('0x64')](_0x5eed02[_0x4478('0x58')])):path['join'](config[_0x4478('0x63')],_0x1b3a67,_[_0x4478('0x64')](_0x4478('0x65')));var _0x2afddb=_0x4478('0x66')+_[_0x4478('0x67')]('logo');if(_0x5eed02[_0x2afddb]||!_0x14ff3d[_0x4478('0x68')]){_0xc0055e=path[_0x4478('0x62')](config[_0x4478('0x63')],_0x1b3a67,_['toLower'](_0x4478('0x65')));}if(!fs[_0x4478('0x61')](_0xc0055e)){throw new db[(_0x4478('0x69'))]['ValidationError'](_['upperFirst'](_0x4478('0x58'))+_0x4478('0x6a'));}return _0x18d245[_0x4478('0x6b')](_0xc0055e);}})[_0x4478('0x27')](handleError(_0x18d245,null));};var utilLicense=require(_0x4478('0x18'));exports['getLogoLogin']=function(_0x570c2e,_0x1c69e0,_0x122997){var _0x35397e=_0x4478('0x6c');var _0x422de5={'custom':![]};return utilLicense['getLicense']()[_0x4478('0x1d')](function(_0x598e88){if(_0x598e88){_0x422de5=_0x598e88;}return db['Setting'][_0x4478('0x54')]({'where':{'id':_0x570c2e['params']['id']},'attributes':[_0x4478('0x58'),_0x4478('0x5b'),_0x4478('0x5d'),_0x4478('0x5e'),_0x4478('0x6d'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x4478('0x1d')](handleEntityNotFound(_0x1c69e0,null))['then'](function(_0x4b67fd){if(_0x4b67fd){var _0x3c0ace=_0x4b67fd[_0x4478('0x5b')]&&fs[_0x4478('0x61')](path['join'](config[_0x4478('0x63')],_0x35397e,_[_0x4478('0x64')](_0x4b67fd['loginLogo'])))?path[_0x4478('0x62')](config[_0x4478('0x63')],_0x35397e,_[_0x4478('0x64')](_0x4b67fd[_0x4478('0x5b')])):path[_0x4478('0x62')](config[_0x4478('0x63')],_0x35397e,_[_0x4478('0x64')]('default_loginLogo.svg'));var _0x1b3664=_0x4478('0x66')+_['upperFirst']('loginLogo');if(_0x4b67fd[_0x1b3664]||!_0x422de5[_0x4478('0x68')]){_0x3c0ace=path['join'](config[_0x4478('0x63')],_0x35397e,_[_0x4478('0x64')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x3c0ace)){throw new db[(_0x4478('0x69'))]['ValidationError'](_[_0x4478('0x67')](_0x4478('0x5b'))+_0x4478('0x6a'));}return _0x1c69e0['download'](_0x3c0ace);}})[_0x4478('0x27')](handleError(_0x1c69e0,null));};exports[_0x4478('0x6e')]=function(_0x563f64,_0x5a426c){return db[_0x4478('0x3a')]['find']({'where':{'id':_0x563f64[_0x4478('0x51')]['id']},'attributes':[_0x4478('0x6f')]})[_0x4478('0x1d')](respondWithResult(_0x5a426c,null))[_0x4478('0x27')](handleError(_0x5a426c,null));};exports[_0x4478('0x70')]=function(_0x4bb953,_0x4946e4,_0x4dac0c){if(_0x4bb953[_0x4478('0x5a')]&&_0x4bb953[_0x4478('0x5a')][_0x4478('0x57')]){_0x4bb953['body'][_0x4478('0x5d')]=_0x4bb953['file'][_0x4478('0x57')];}return db['Setting']['find']({'where':{'id':_0x4bb953[_0x4478('0x51')]['id']}})[_0x4478('0x1d')](handleEntityNotFound(_0x4946e4,null))['then'](saveUpdates(_0x4bb953['body'],null))[_0x4478('0x1d')](respondWithResult(_0x4946e4,null))[_0x4478('0x27')](handleError(_0x4946e4,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x1eda7f,_0x5ca843,_0x4c8603){var _0x4766e9='server/files/images/logos';var _0x1a07aa={'custom':![]};return utilLicense[_0x4478('0x5c')]()[_0x4478('0x1d')](function(_0x1c719a){if(_0x1c719a){_0x1a07aa=_0x1c719a;}return db[_0x4478('0x3a')][_0x4478('0x54')]({'where':{'id':_0x1eda7f[_0x4478('0x51')]['id']},'attributes':['logo',_0x4478('0x5b'),'preferred','favicon','defaultLogo',_0x4478('0x5f'),_0x4478('0x71'),_0x4478('0x60')],'raw':!![]});})[_0x4478('0x1d')](handleEntityNotFound(_0x5ca843,null))[_0x4478('0x1d')](function(_0x4f6fb4){if(_0x4f6fb4){var _0x8e5ba8=_0x4f6fb4[_0x4478('0x5d')]&&fs[_0x4478('0x61')](path['join'](config[_0x4478('0x63')],_0x4766e9,_['toLower'](_0x4f6fb4['preferred'])))?path['join'](config[_0x4478('0x63')],_0x4766e9,_[_0x4478('0x64')](_0x4f6fb4['preferred'])):path[_0x4478('0x62')](config['root'],_0x4766e9,_[_0x4478('0x64')]('default_preferred.png'));var _0x41de56=_0x4478('0x66')+_[_0x4478('0x67')](_0x4478('0x5d'));if(_0x4f6fb4[_0x41de56]||!_0x1a07aa[_0x4478('0x68')]||!_0x1a07aa[_0x4478('0x5d')]){_0x8e5ba8=path[_0x4478('0x62')](config['root'],_0x4766e9,_[_0x4478('0x64')]('default_preferred.png'));}if(!fs[_0x4478('0x61')](_0x8e5ba8)){throw new db[(_0x4478('0x69'))][(_0x4478('0x72'))](_['upperFirst'](_0x4478('0x5d'))+'\x20not\x20found');}return _0x5ca843[_0x4478('0x6b')](_0x8e5ba8);}})[_0x4478('0x27')](handleError(_0x5ca843,null));};exports['addFavicon']=function(_0x447d5c,_0x175365,_0x4961e9){if(_0x447d5c[_0x4478('0x5a')]&&_0x447d5c[_0x4478('0x5a')][_0x4478('0x57')]){_0x447d5c[_0x4478('0x55')][_0x4478('0x5e')]=_0x447d5c['file'][_0x4478('0x57')];}return db[_0x4478('0x3a')][_0x4478('0x54')]({'where':{'id':_0x447d5c['params']['id']}})[_0x4478('0x1d')](handleEntityNotFound(_0x175365,null))[_0x4478('0x1d')](saveUpdates(_0x447d5c['body'],null))['then'](respondWithResult(_0x175365,null))[_0x4478('0x27')](handleError(_0x175365,null));};var utilLicense=require(_0x4478('0x18'));exports[_0x4478('0x73')]=function(_0xcad87c,_0x9554a2,_0x1c5b20){var _0xf2aa22='server/files/images/logos';var _0x3941e6={'custom':![]};return utilLicense[_0x4478('0x5c')]()[_0x4478('0x1d')](function(_0x160ef3){if(_0x160ef3){_0x3941e6=_0x160ef3;}return db[_0x4478('0x3a')][_0x4478('0x54')]({'where':{'id':_0xcad87c['params']['id']},'attributes':[_0x4478('0x58'),'loginLogo',_0x4478('0x5d'),_0x4478('0x5e'),_0x4478('0x6d'),'defaultLoginLogo',_0x4478('0x71'),_0x4478('0x60')],'raw':!![]});})[_0x4478('0x1d')](handleEntityNotFound(_0x9554a2,null))['then'](function(_0x53873b){if(_0x53873b){var _0x2fdb62=_0x53873b[_0x4478('0x5e')]&&fs['existsSync'](path[_0x4478('0x62')](config['root'],_0xf2aa22,_[_0x4478('0x64')](_0x53873b[_0x4478('0x5e')])))?path[_0x4478('0x62')](config['root'],_0xf2aa22,_[_0x4478('0x64')](_0x53873b[_0x4478('0x5e')])):path[_0x4478('0x62')](config[_0x4478('0x63')],_0xf2aa22,_[_0x4478('0x64')](_0x4478('0x74')));var _0x17d708=_0x4478('0x66')+_['upperFirst']('favicon');if(_0x53873b[_0x17d708]||!_0x3941e6[_0x4478('0x68')]){_0x2fdb62=path['join'](config[_0x4478('0x63')],_0xf2aa22,_[_0x4478('0x64')](_0x4478('0x74')));}if(!fs['existsSync'](_0x2fdb62)){throw new db['Sequelize'][(_0x4478('0x72'))](_[_0x4478('0x67')]('favicon')+_0x4478('0x6a'));}return _0x9554a2[_0x4478('0x6b')](_0x2fdb62);}})['catch'](handleError(_0x9554a2,null));};exports[_0x4478('0x75')]=function(_0x226986,_0x5177b5){var _0x152ddc={'offset':moment()[_0x4478('0x76')]()};_0x152ddc[_0x4478('0x77')]=moment()[_0x4478('0x76')](_0x152ddc[_0x4478('0x2b')])[_0x4478('0x78')](_0x4478('0x79'));return _0x5177b5[_0x4478('0x28')](0xc8)['send'](_0x152ddc);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a4f65e4..401a713 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x2975f1,_0x453f49){var _0x2c08d5=function(_0x2cf9c5){while(--_0x2cf9c5){_0x2975f1['push'](_0x2975f1['shift']());}};_0x2c08d5(++_0x453f49);}(_0x008c,0x188));var _0xc008=function(_0x51b7c5,_0x218969){_0x51b7c5=_0x51b7c5-0x0;var _0x3355d7=_0x008c[_0x51b7c5];return _0x3355d7;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x280bb5,_0x4a1aff){var _0x2b760c=function(_0x53b65a){while(--_0x53b65a){_0x280bb5['push'](_0x280bb5['shift']());}};_0x2b760c(++_0x4a1aff);}(_0x3e74,0x175));var _0x43e7=function(_0x56256c,_0x440436){_0x56256c=_0x56256c-0x0;var _0x130aa2=_0x3e74[_0x56256c];return _0x130aa2;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index c91c071..ce0cbf4 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 _0x48a4=['catch','Setting','options','raw','where','include','map','model','attributes','debug','ShowSetting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x48a4,0x1be));var _0x448a=function(_0x3e5036,_0x20428f){_0x3e5036=_0x3e5036-0x0;var _0x5a130a=_0x48a4[_0x3e5036];return _0x5a130a;};'use strict';var _=require(_0x448a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x448a('0x1'));var rs=require(_0x448a('0x2'));var fs=require('fs');var Redis=require(_0x448a('0x3'));var db=require(_0x448a('0x4'))['db'];var utils=require(_0x448a('0x5'));var logger=require(_0x448a('0x6'))(_0x448a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x448a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53ea8e,_0xc98a99,_0x2cae96){return new BPromise(function(_0x55bacc,_0x7a5946){return client[_0x448a('0x9')](_0x53ea8e,_0x2cae96)[_0x448a('0xa')](function(_0x12ecad){logger[_0x448a('0xb')](_0x448a('0xc'),_0xc98a99,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0xc98a99,_0x448a('0xd'),JSON[_0x448a('0xe')](_0x12ecad));if(_0x12ecad['error']){if(_0x12ecad[_0x448a('0xf')]['code']===0x1f4){logger[_0x448a('0xf')](_0x448a('0xc'),_0xc98a99,_0x12ecad[_0x448a('0xf')][_0x448a('0x10')]);return _0x7a5946(_0x12ecad[_0x448a('0xf')][_0x448a('0x10')]);}logger[_0x448a('0xf')](_0x448a('0xc'),_0xc98a99,_0x12ecad[_0x448a('0xf')][_0x448a('0x10')]);return _0x55bacc(_0x12ecad['error']['message']);}else{logger[_0x448a('0xb')](_0x448a('0xc'),_0xc98a99,'request\x20sent');_0x55bacc(_0x12ecad[_0x448a('0x11')][_0x448a('0x10')]);}})[_0x448a('0x12')](function(_0x490d51){logger[_0x448a('0xf')](_0x448a('0xc'),_0xc98a99,_0x490d51);_0x7a5946(_0x490d51);});});}exports['ShowSetting']=function(_0x1d6cf0){var _0x319c0b=this;return new Promise(function(_0x16e7fd,_0x426555){return db[_0x448a('0x13')]['find']({'raw':_0x1d6cf0['options']?_0x1d6cf0[_0x448a('0x14')][_0x448a('0x15')]===undefined?!![]:![]:!![],'where':_0x1d6cf0[_0x448a('0x14')]?_0x1d6cf0[_0x448a('0x14')][_0x448a('0x16')]||null:null,'attributes':_0x1d6cf0[_0x448a('0x14')]?_0x1d6cf0['options']['attributes']||null:null,'include':_0x1d6cf0['options']?_0x1d6cf0[_0x448a('0x14')][_0x448a('0x17')]?_[_0x448a('0x18')](_0x1d6cf0[_0x448a('0x14')][_0x448a('0x17')],function(_0x1c191a){return{'model':db[_0x1c191a[_0x448a('0x19')]],'as':_0x1c191a['as'],'attributes':_0x1c191a['attributes'],'include':_0x1c191a[_0x448a('0x17')]?_['map'](_0x1c191a[_0x448a('0x17')],function(_0x118e64){return{'model':db[_0x118e64[_0x448a('0x19')]],'as':_0x118e64['as'],'attributes':_0x118e64['attributes'],'include':_0x118e64[_0x448a('0x17')]?_[_0x448a('0x18')](_0x118e64[_0x448a('0x17')],function(_0x43f139){return{'model':db[_0x43f139[_0x448a('0x19')]],'as':_0x43f139['as'],'attributes':_0x43f139[_0x448a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x448a('0xa')](function(_0x538a72){logger[_0x448a('0xb')]('ShowSetting',_0x1d6cf0);logger[_0x448a('0x1b')](_0x448a('0x1c'),_0x1d6cf0,JSON[_0x448a('0xe')](_0x538a72));_0x16e7fd(_0x538a72);})[_0x448a('0x12')](function(_0x3e5674){logger[_0x448a('0xf')](_0x448a('0x1c'),_0x3e5674[_0x448a('0x10')],_0x1d6cf0);_0x426555(_0x319c0b[_0x448a('0xf')](0x1f4,_0x3e5674[_0x448a('0x10')]));});});}; \ No newline at end of file +var _0x4bb8=['raw','attributes','include','map','model','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSetting','Setting','find','options'];(function(_0x26eefd,_0x21b100){var _0x2bd5f8=function(_0x5a0151){while(--_0x5a0151){_0x26eefd['push'](_0x26eefd['shift']());}};_0x2bd5f8(++_0x21b100);}(_0x4bb8,0x91));var _0x84bb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4bb8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x84bb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84bb('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x84bb('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0x84bb('0x3'));var client=jayson[_0x84bb('0x4')][_0x84bb('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4053d6,_0x3a95e3,_0x5cb3dc){return new BPromise(function(_0x1d3fdc,_0x596480){return client[_0x84bb('0x6')](_0x4053d6,_0x5cb3dc)[_0x84bb('0x7')](function(_0x5269fe){logger['info'](_0x84bb('0x8'),_0x3a95e3,_0x84bb('0x9'));logger[_0x84bb('0xa')](_0x84bb('0xb'),_0x3a95e3,_0x84bb('0x9'),JSON[_0x84bb('0xc')](_0x5269fe));if(_0x5269fe[_0x84bb('0xd')]){if(_0x5269fe[_0x84bb('0xd')][_0x84bb('0xe')]===0x1f4){logger['error'](_0x84bb('0x8'),_0x3a95e3,_0x5269fe[_0x84bb('0xd')]['message']);return _0x596480(_0x5269fe[_0x84bb('0xd')][_0x84bb('0xf')]);}logger[_0x84bb('0xd')](_0x84bb('0x8'),_0x3a95e3,_0x5269fe[_0x84bb('0xd')][_0x84bb('0xf')]);return _0x1d3fdc(_0x5269fe[_0x84bb('0xd')][_0x84bb('0xf')]);}else{logger[_0x84bb('0x10')](_0x84bb('0x8'),_0x3a95e3,_0x84bb('0x9'));_0x1d3fdc(_0x5269fe[_0x84bb('0x11')][_0x84bb('0xf')]);}})[_0x84bb('0x12')](function(_0x6d808f){logger['error'](_0x84bb('0x8'),_0x3a95e3,_0x6d808f);_0x596480(_0x6d808f);});});}exports[_0x84bb('0x13')]=function(_0x5ec67e){var _0x5f30fc=this;return new Promise(function(_0x1fc764,_0x3bc016){return db[_0x84bb('0x14')][_0x84bb('0x15')]({'raw':_0x5ec67e[_0x84bb('0x16')]?_0x5ec67e[_0x84bb('0x16')][_0x84bb('0x17')]===undefined?!![]:![]:!![],'where':_0x5ec67e[_0x84bb('0x16')]?_0x5ec67e[_0x84bb('0x16')]['where']||null:null,'attributes':_0x5ec67e['options']?_0x5ec67e[_0x84bb('0x16')][_0x84bb('0x18')]||null:null,'include':_0x5ec67e['options']?_0x5ec67e[_0x84bb('0x16')][_0x84bb('0x19')]?_[_0x84bb('0x1a')](_0x5ec67e[_0x84bb('0x16')][_0x84bb('0x19')],function(_0x23d24a){return{'model':db[_0x23d24a[_0x84bb('0x1b')]],'as':_0x23d24a['as'],'attributes':_0x23d24a[_0x84bb('0x18')],'include':_0x23d24a[_0x84bb('0x19')]?_[_0x84bb('0x1a')](_0x23d24a['include'],function(_0xe9c80a){return{'model':db[_0xe9c80a[_0x84bb('0x1b')]],'as':_0xe9c80a['as'],'attributes':_0xe9c80a[_0x84bb('0x18')],'include':_0xe9c80a[_0x84bb('0x19')]?_[_0x84bb('0x1a')](_0xe9c80a[_0x84bb('0x19')],function(_0x326289){return{'model':db[_0x326289[_0x84bb('0x1b')]],'as':_0x326289['as'],'attributes':_0x326289[_0x84bb('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1173ca){logger[_0x84bb('0x10')]('ShowSetting',_0x5ec67e);logger[_0x84bb('0xa')]('ShowSetting',_0x5ec67e,JSON['stringify'](_0x1173ca));_0x1fc764(_0x1173ca);})['catch'](function(_0xc59083){logger[_0x84bb('0xd')](_0x84bb('0x13'),_0xc59083[_0x84bb('0xf')],_0x5ec67e);_0x3bc016(_0x5f30fc[_0x84bb('0xd')](0x1f4,_0xc59083['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 3b3fd6c..fd908f6 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x195f89,_0x77768a){var _0x1795da=function(_0x5177d4){while(--_0x5177d4){_0x195f89['push'](_0x195f89['shift']());}};_0x1795da(++_0x77768a);}(_0x7a54,0x106));var _0x47a5=function(_0xd0aea5,_0x417c04){_0xd0aea5=_0xd0aea5-0x0;var _0x23895e=_0x7a54[_0xd0aea5];return _0x23895e;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x5070a4,_0x1db896){var _0x179668=function(_0x43b757){while(--_0x43b757){_0x5070a4['push'](_0x5070a4['shift']());}};_0x179668(++_0x1db896);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index f60958a..d6a9bda 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 _0xaebf=['generate','ENUM','skebby','connectel','clicksend','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING'];(function(_0x15529a,_0x38c0c4){var _0x1545bc=function(_0x43235e){while(--_0x43235e){_0x15529a['push'](_0x15529a['shift']());}};_0x1545bc(++_0x38c0c4);}(_0xaebf,0x1b2));var _0xfaeb=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xaebf[_0x5a9c0c];return _0x53c77d;};'use strict';var Sequelize=require(_0xfaeb('0x0'));var rs=require('randomstring');module[_0xfaeb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xfaeb('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xfaeb('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xfaeb('0x2')],'defaultValue':function(){return rs[_0xfaeb('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfaeb('0x4')]('twilio',_0xfaeb('0x5'),_0xfaeb('0x6'),_0xfaeb('0x7'),'plivo',_0xfaeb('0x8'),_0xfaeb('0x9'),_0xfaeb('0xa'),_0xfaeb('0xb'),_0xfaeb('0xc'))},'accountSid':{'type':Sequelize[_0xfaeb('0x2')]},'authId':{'type':Sequelize[_0xfaeb('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xfaeb('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfaeb('0x2')]},'apiKey':{'type':Sequelize[_0xfaeb('0x2')]},'applicationId':{'type':Sequelize[_0xfaeb('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xfaeb('0x2')]},'deliveryReport':{'type':Sequelize[_0xfaeb('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfaeb('0xe');}},'notificationSound':{'type':Sequelize[_0xfaeb('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfaeb('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfaeb('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfaeb('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfaeb('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfaeb('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xfaeb('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfaeb('0xf')],'comment':_0xfaeb('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfaeb('0x11'),'set':function(_0x3c7363){if(!_0x3c7363)this[_0xfaeb('0x12')]('mandatoryDispositionPauseId',null);this[_0xfaeb('0x12')]('mandatoryDisposition',_0x3c7363);}}}; \ No newline at end of file +var _0x5019=['clicksend','plivo','clickatell','bandwidth','csc','intelepeer','ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','twilio','skebby'];(function(_0x3e6b2f,_0x1ffa07){var _0x323215=function(_0x5c4d82){while(--_0x5c4d82){_0x3e6b2f['push'](_0x3e6b2f['shift']());}};_0x323215(++_0x1ffa07);}(_0x5019,0x1b2));var _0x9501=function(_0x20efa4,_0x22de76){_0x20efa4=_0x20efa4-0x0;var _0x5ebe1b=_0x5019[_0x20efa4];return _0x5ebe1b;};'use strict';var Sequelize=require(_0x9501('0x0'));var rs=require(_0x9501('0x1'));module[_0x9501('0x2')]={'name':{'type':Sequelize[_0x9501('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x9501('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9501('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x9501('0x3')],'defaultValue':function(){return rs[_0x9501('0x4')]();}},'phone':{'type':Sequelize[_0x9501('0x3')]},'type':{'type':Sequelize['ENUM'](_0x9501('0x5'),_0x9501('0x6'),'connectel',_0x9501('0x7'),_0x9501('0x8'),_0x9501('0x9'),_0x9501('0xa'),_0x9501('0xb'),'infobip',_0x9501('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x9501('0x3')]},'authToken':{'type':Sequelize[_0x9501('0x3')]},'smsMethod':{'type':Sequelize[_0x9501('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9501('0x3')]},'password':{'type':Sequelize[_0x9501('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x9501('0x3')]},'accountId':{'type':Sequelize[_0x9501('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x9501('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9501('0xf');}},'notificationSound':{'type':Sequelize[_0x9501('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9501('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9501('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9501('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9501('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9501('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9501('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9501('0xe')],'defaultValue':![],'comment':_0x9501('0x11'),'set':function(_0x30639c){if(!_0x30639c)this[_0x9501('0x12')](_0x9501('0x13'),null);this[_0x9501('0x12')](_0x9501('0x14'),_0x30639c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a3bdbd6..7ed24e2 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 _0x6e38=['Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','includeAll','include','findAll','show','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','account','applications','orderBy','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','From','messageId','MessageSid','sender','text','connectel','clicksend','from','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','clickatell','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId','User','unshift','agent','SmsQueue','queueId','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','stack','finally','getApplications','Contact','fullname','internal','Tags','tag','to\x20is\x20mandatory','List','SmsMessage','dataValues','Messages','skebby_dispatch_id','statusInt','requestid','status_code','DELIVERED','groupName','bandwidth','redif','skebby','inspect','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','SmsAccounts','UserProfileResource','name','send','index'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x6e38,0xa5));var _0x86e3=function(_0x564819,_0xb162de){_0x564819=_0x564819-0x0;var _0x1d3bd2=_0x6e38[_0x564819];return _0x1d3bd2;};'use strict';var emlformat=require(_0x86e3('0x0'));var rimraf=require(_0x86e3('0x1'));var zipdir=require(_0x86e3('0x2'));var jsonpatch=require(_0x86e3('0x3'));var rp=require(_0x86e3('0x4'));var moment=require(_0x86e3('0x5'));var BPromise=require(_0x86e3('0x6'));var Mustache=require(_0x86e3('0x7'));var util=require(_0x86e3('0x8'));var path=require(_0x86e3('0x9'));var sox=require(_0x86e3('0xa'));var csv=require(_0x86e3('0xb'));var ejs=require(_0x86e3('0xc'));var fs=require('fs');var fs_extra=require(_0x86e3('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x86e3('0xe'));var jsforce=require(_0x86e3('0xf'));var deskjs=require(_0x86e3('0x10'));var toCsv=require(_0x86e3('0xb'));var querystring=require(_0x86e3('0x11'));var Papa=require(_0x86e3('0x12'));var Redis=require(_0x86e3('0x13'));var authService=require(_0x86e3('0x14'));var qs=require(_0x86e3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86e3('0x16'));var logger=require(_0x86e3('0x17'))(_0x86e3('0x18'));var utils=require(_0x86e3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x86e3('0x1a'));var db=require(_0x86e3('0x1b'))['db'];config[_0x86e3('0x1c')]=_[_0x86e3('0x1d')](config[_0x86e3('0x1c')],{'host':_0x86e3('0x1e'),'port':0x18eb});var socket=require(_0x86e3('0x1f'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x86e3('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x86e3('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x452722,_0x4c0737,_0x1bbf33,_0x33178d){return new BPromise(function(_0x4f0db2,_0x645a3f){var _0x2f4679=_0x33178d||client;return _0x2f4679[_0x86e3('0x22')](_0x452722,_0x1bbf33)[_0x86e3('0x23')](function(_0x271de8){logger[_0x86e3('0x24')](_0x86e3('0x25'),_0x4c0737,_0x86e3('0x26'));logger[_0x86e3('0x27')](_0x86e3('0x28'),_0x4c0737,'request\x20sent',JSON[_0x86e3('0x29')](_0x271de8));if(_0x271de8['error']){if(_0x271de8[_0x86e3('0x2a')][_0x86e3('0x2b')]===0x1f4){logger[_0x86e3('0x2a')](_0x86e3('0x25'),_0x4c0737,_0x271de8['error'][_0x86e3('0x2c')]);return _0x645a3f(_0x271de8['error']['message']);}logger[_0x86e3('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x4c0737,_0x271de8[_0x86e3('0x2a')][_0x86e3('0x2c')]);return _0x4f0db2(_0x271de8[_0x86e3('0x2a')]['message']);}else{logger['info'](_0x86e3('0x25'),_0x4c0737,_0x86e3('0x26'));_0x4f0db2(_0x271de8[_0x86e3('0x2d')][_0x86e3('0x2c')]);}})[_0x86e3('0x2e')](function(_0x5d1a49){logger[_0x86e3('0x2a')](_0x86e3('0x25'),_0x4c0737,_0x5d1a49);_0x645a3f(_0x5d1a49);});});}function respondWithStatusCode(_0x296625,_0x35d796){_0x35d796=_0x35d796||0xcc;return function(_0x58da35){if(_0x58da35){return _0x296625[_0x86e3('0x2f')](_0x35d796);}return _0x296625[_0x86e3('0x30')](_0x35d796)[_0x86e3('0x31')]();};}function respondWithResult(_0x3f9ce3,_0x2ae12d){_0x2ae12d=_0x2ae12d||0xc8;return function(_0x22f5b6){if(_0x22f5b6){return _0x3f9ce3[_0x86e3('0x30')](_0x2ae12d)[_0x86e3('0x32')](_0x22f5b6);}};}function respondWithFilteredResult(_0x552b00,_0x410d78){return function(_0x310ccb){if(_0x310ccb){var _0x50c050=typeof _0x410d78[_0x86e3('0x33')]===_0x86e3('0x34')&&typeof _0x410d78[_0x86e3('0x35')]===_0x86e3('0x34');var _0x3a0f4f=_0x310ccb[_0x86e3('0x36')];var _0x4de508=_0x50c050?0x0:_0x410d78[_0x86e3('0x33')];var _0x2fc6f0=_0x50c050?_0x310ccb[_0x86e3('0x36')]:_0x410d78[_0x86e3('0x33')]+_0x410d78[_0x86e3('0x35')];var _0x1004a6;if(_0x2fc6f0>=_0x3a0f4f){_0x2fc6f0=_0x3a0f4f;_0x1004a6=0xc8;}else{_0x1004a6=0xce;}_0x552b00[_0x86e3('0x30')](_0x1004a6);return _0x552b00[_0x86e3('0x37')](_0x86e3('0x38'),_0x4de508+'-'+_0x2fc6f0+'/'+_0x3a0f4f)[_0x86e3('0x32')](_0x310ccb);}return null;};}function patchUpdates(_0x3c3cbf){return function(_0x3821cf){try{jsonpatch['apply'](_0x3821cf,_0x3c3cbf,!![]);}catch(_0xdad8ae){return BPromise[_0x86e3('0x39')](_0xdad8ae);}return _0x3821cf[_0x86e3('0x3a')]();};}function saveUpdates(_0x36e2d2,_0x35be68){return function(_0x2541bc){if(_0x2541bc){return _0x2541bc[_0x86e3('0x3b')](_0x36e2d2)[_0x86e3('0x23')](function(_0x3767ef){return _0x3767ef;});}return null;};}function removeEntity(_0x4a975d,_0x14df74){return function(_0x1918ed){if(_0x1918ed){return _0x1918ed[_0x86e3('0x3c')]()['then'](function(){var _0x1b4984=_0x1918ed['get']({'plain':!![]});var _0x23c541=_0x86e3('0x3d');return db[_0x86e3('0x3e')][_0x86e3('0x3c')]({'where':{'type':_0x23c541,'resourceId':_0x1b4984['id']}})[_0x86e3('0x23')](function(){return _0x1918ed;});})[_0x86e3('0x23')](function(){_0x4a975d[_0x86e3('0x30')](0xcc)[_0x86e3('0x31')]();});}};}function handleEntityNotFound(_0xa81759,_0x2f4fbc){return function(_0x29191b){if(!_0x29191b){_0xa81759['sendStatus'](0x194);}return _0x29191b;};}function handleError(_0xeb761,_0x195251){_0x195251=_0x195251||0x1f4;return function(_0x2b8123){logger[_0x86e3('0x2a')](_0x2b8123['stack']);if(_0x2b8123[_0x86e3('0x3f')]){delete _0x2b8123['name'];}_0xeb761['status'](_0x195251)[_0x86e3('0x40')](_0x2b8123);};}exports[_0x86e3('0x41')]=function(_0x136064,_0xa5c5e6){var _0xfbad51={'include':[{'model':db[_0x86e3('0x42')],'as':_0x86e3('0x43')}]},_0x30999f={},_0x22deb9={'count':0x0,'rows':[]};var _0x15ce3e=_['map'](db[_0x86e3('0x44')][_0x86e3('0x45')],function(_0x2a2809){return{'name':_0x2a2809[_0x86e3('0x46')],'type':_0x2a2809[_0x86e3('0x47')][_0x86e3('0x48')]};});_0x30999f[_0x86e3('0x49')]=_[_0x86e3('0x4a')](_0x15ce3e,_0x86e3('0x3f'));_0x30999f[_0x86e3('0x4b')]=_['keys'](_0x136064[_0x86e3('0x4b')]);_0x30999f[_0x86e3('0x4c')]=_[_0x86e3('0x4d')](_0x30999f[_0x86e3('0x49')],_0x30999f[_0x86e3('0x4b')]);_0xfbad51[_0x86e3('0x4e')]=_[_0x86e3('0x4d')](_0x30999f[_0x86e3('0x49')],qs[_0x86e3('0x4f')](_0x136064[_0x86e3('0x4b')][_0x86e3('0x4f')]));_0xfbad51[_0x86e3('0x4e')]=_0xfbad51['attributes'][_0x86e3('0x50')]?_0xfbad51['attributes']:_0x30999f[_0x86e3('0x49')];if(!_0x136064[_0x86e3('0x4b')][_0x86e3('0x51')](_0x86e3('0x52'))){_0xfbad51[_0x86e3('0x35')]=qs[_0x86e3('0x35')](_0x136064['query'][_0x86e3('0x35')]);_0xfbad51[_0x86e3('0x33')]=qs[_0x86e3('0x33')](_0x136064['query']['offset']);}_0xfbad51['order']=qs[_0x86e3('0x53')](_0x136064[_0x86e3('0x4b')]['sort']);_0xfbad51[_0x86e3('0x54')]=qs['filters'](_[_0x86e3('0x55')](_0x136064[_0x86e3('0x4b')],_0x30999f['filters']),_0x15ce3e);if(_0x136064['query']['filter']){_0xfbad51[_0x86e3('0x54')]=_['merge'](_0xfbad51[_0x86e3('0x54')],{'$or':_[_0x86e3('0x4a')](_0x15ce3e,function(_0x3e76ec){if(_0x3e76ec[_0x86e3('0x47')]!==_0x86e3('0x56')){var _0x4839aa={};_0x4839aa[_0x3e76ec['name']]={'$like':'%'+_0x136064[_0x86e3('0x4b')]['filter']+'%'};return _0x4839aa;}})});}_0xfbad51=_[_0x86e3('0x57')]({},_0xfbad51,_0x136064['options']);var _0xd45e3c={'where':_0xfbad51['where']};return db[_0x86e3('0x44')][_0x86e3('0x36')](_0xd45e3c)['then'](function(_0x426de7){_0x22deb9[_0x86e3('0x36')]=_0x426de7;if(_0x136064[_0x86e3('0x4b')][_0x86e3('0x58')]){_0xfbad51[_0x86e3('0x59')]=[{'all':!![]}];}return db[_0x86e3('0x44')][_0x86e3('0x5a')](_0xfbad51);})[_0x86e3('0x23')](function(_0x14d74d){_0x22deb9['rows']=_0x14d74d;return _0x22deb9;})[_0x86e3('0x23')](respondWithFilteredResult(_0xa5c5e6,_0xfbad51))[_0x86e3('0x2e')](handleError(_0xa5c5e6,null));};exports[_0x86e3('0x5b')]=function(_0x33ca55,_0x2c19b3){var _0x1f5154={'raw':![],'where':{'id':_0x33ca55['params']['id']},'include':[{'model':db['Pause'],'as':_0x86e3('0x43')}]},_0x29b436={};_0x29b436[_0x86e3('0x49')]=_[_0x86e3('0x5c')](db[_0x86e3('0x44')][_0x86e3('0x45')]);_0x29b436[_0x86e3('0x4b')]=_[_0x86e3('0x5c')](_0x33ca55[_0x86e3('0x4b')]);_0x29b436[_0x86e3('0x4c')]=_[_0x86e3('0x4d')](_0x29b436[_0x86e3('0x49')],_0x29b436[_0x86e3('0x4b')]);_0x1f5154[_0x86e3('0x4e')]=_[_0x86e3('0x4d')](_0x29b436[_0x86e3('0x49')],qs[_0x86e3('0x4f')](_0x33ca55[_0x86e3('0x4b')][_0x86e3('0x4f')]));_0x1f5154['attributes']=_0x1f5154[_0x86e3('0x4e')]['length']?_0x1f5154[_0x86e3('0x4e')]:_0x29b436[_0x86e3('0x49')];if(_0x33ca55[_0x86e3('0x4b')][_0x86e3('0x58')]){_0x1f5154[_0x86e3('0x59')]=[{'all':!![]}];}_0x1f5154=_[_0x86e3('0x57')]({},_0x1f5154,_0x33ca55[_0x86e3('0x5d')]);return db['SmsAccount'][_0x86e3('0x5e')](_0x1f5154)[_0x86e3('0x23')](handleEntityNotFound(_0x2c19b3,null))[_0x86e3('0x23')](respondWithResult(_0x2c19b3,null))['catch'](handleError(_0x2c19b3,null));};exports[_0x86e3('0x5f')]=function(_0x238970,_0x62a9d4){return db[_0x86e3('0x44')]['create'](_0x238970[_0x86e3('0x60')],{})['then'](function(_0x1767ce){var _0x4ee706=_0x238970[_0x86e3('0x61')][_0x86e3('0x62')]({'plain':!![]});if(!_0x4ee706)throw new Error(_0x86e3('0x63'));if(_0x4ee706[_0x86e3('0x64')]===_0x86e3('0x61')){var _0x2c7ac0=_0x1767ce[_0x86e3('0x62')]({'plain':!![]});var _0xe12540='SmsAccounts';return db['UserProfileSection'][_0x86e3('0x5e')]({'where':{'name':_0xe12540,'userProfileId':_0x4ee706[_0x86e3('0x65')]},'raw':!![]})[_0x86e3('0x23')](function(_0x43be33){if(_0x43be33&&_0x43be33[_0x86e3('0x66')]===0x0){return db[_0x86e3('0x3e')][_0x86e3('0x5f')]({'name':_0x2c7ac0['name'],'resourceId':_0x2c7ac0['id'],'type':_0x43be33[_0x86e3('0x3f')],'sectionId':_0x43be33['id']},{})['then'](function(){return _0x1767ce;});}else{return _0x1767ce;}})[_0x86e3('0x2e')](function(_0x47e9fc){logger[_0x86e3('0x2a')](_0x86e3('0x67'),_0x47e9fc);throw _0x47e9fc;});}return _0x1767ce;})[_0x86e3('0x23')](respondWithResult(_0x62a9d4,0xc9))[_0x86e3('0x2e')](handleError(_0x62a9d4,null));};exports[_0x86e3('0x3b')]=function(_0x35d530,_0x2a75fd){if(_0x35d530[_0x86e3('0x60')]['id']){delete _0x35d530[_0x86e3('0x60')]['id'];}return db[_0x86e3('0x44')]['find']({'where':{'id':_0x35d530[_0x86e3('0x68')]['id']},'include':[{'model':db[_0x86e3('0x42')],'as':_0x86e3('0x43')}]})['then'](handleEntityNotFound(_0x2a75fd,null))[_0x86e3('0x23')](saveUpdates(_0x35d530[_0x86e3('0x60')],null))[_0x86e3('0x23')](respondWithResult(_0x2a75fd,null))[_0x86e3('0x2e')](handleError(_0x2a75fd,null));};exports['destroy']=function(_0x3265a8,_0x34b138){return db[_0x86e3('0x44')][_0x86e3('0x5e')]({'where':{'id':_0x3265a8[_0x86e3('0x68')]['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x34b138,null))[_0x86e3('0x23')](removeEntity(_0x34b138,null))[_0x86e3('0x2e')](handleError(_0x34b138,null));};exports[_0x86e3('0x69')]=function(_0x432202,_0x2d3e53){return db[_0x86e3('0x44')][_0x86e3('0x69')]()[_0x86e3('0x23')](respondWithResult(_0x2d3e53,null))['catch'](handleError(_0x2d3e53,null));};exports[_0x86e3('0x6a')]=function(_0x1a1b0c,_0x396523,_0x2de7f7){if(_0x1a1b0c[_0x86e3('0x60')]['id']){delete _0x1a1b0c[_0x86e3('0x60')]['id'];}return db[_0x86e3('0x44')][_0x86e3('0x5e')]({'where':{'id':_0x1a1b0c[_0x86e3('0x68')]['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x396523,null))[_0x86e3('0x23')](function(_0x5b75dc){if(_0x5b75dc){_0x1a1b0c['body'][_0x86e3('0x6b')]=_0x5b75dc['id'];return db[_0x86e3('0x6c')][_0x86e3('0x5f')](_0x1a1b0c[_0x86e3('0x60')]);}})[_0x86e3('0x23')](respondWithResult(_0x396523,null))[_0x86e3('0x2e')](handleError(_0x396523,null));};exports[_0x86e3('0x6d')]=function(_0x4f6209,_0x2a812a,_0x2e9497){var _0x1e86a2={'raw':![],'where':{}};var _0x320c16={};var _0x5d8696={'count':0x0,'rows':[]};return db['SmsAccount'][_0x86e3('0x6e')]({'where':{'id':_0x4f6209[_0x86e3('0x68')]['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x2a812a,null))[_0x86e3('0x23')](function(_0x1565d2){if(_0x1565d2){_0x320c16[_0x86e3('0x49')]=_[_0x86e3('0x5c')](db['Disposition'][_0x86e3('0x45')]);_0x320c16[_0x86e3('0x4b')]=_[_0x86e3('0x5c')](_0x4f6209['query']);_0x320c16[_0x86e3('0x4c')]=_[_0x86e3('0x4d')](_0x320c16['model'],_0x320c16['query']);_0x1e86a2[_0x86e3('0x4e')]=_[_0x86e3('0x4d')](_0x320c16[_0x86e3('0x49')],qs[_0x86e3('0x4f')](_0x4f6209[_0x86e3('0x4b')][_0x86e3('0x4f')]));_0x1e86a2[_0x86e3('0x4e')]=_0x1e86a2[_0x86e3('0x4e')][_0x86e3('0x50')]?_0x1e86a2['attributes']:_0x320c16[_0x86e3('0x49')];if(!_0x4f6209[_0x86e3('0x4b')][_0x86e3('0x51')](_0x86e3('0x52'))){_0x1e86a2[_0x86e3('0x35')]=qs['limit'](_0x4f6209[_0x86e3('0x4b')]['limit']);_0x1e86a2[_0x86e3('0x33')]=qs[_0x86e3('0x33')](_0x4f6209[_0x86e3('0x4b')][_0x86e3('0x33')]);}_0x1e86a2[_0x86e3('0x6f')]=qs[_0x86e3('0x53')](_0x4f6209[_0x86e3('0x4b')][_0x86e3('0x53')]);_0x1e86a2[_0x86e3('0x54')]=qs[_0x86e3('0x4c')](_[_0x86e3('0x55')](_0x4f6209[_0x86e3('0x4b')],_0x320c16['filters']));_0x1e86a2[_0x86e3('0x54')][_0x86e3('0x6b')]=_0x1565d2['id'];if(_0x4f6209[_0x86e3('0x4b')][_0x86e3('0x70')]){_0x1e86a2[_0x86e3('0x54')]=_['merge'](_0x1e86a2[_0x86e3('0x54')],{'$or':_[_0x86e3('0x4a')](_0x1e86a2[_0x86e3('0x4e')],function(_0x59479b){var _0x4d6afa={};_0x4d6afa[_0x59479b]={'$like':'%'+_0x4f6209['query'][_0x86e3('0x70')]+'%'};return _0x4d6afa;})});}_0x1e86a2=_['merge']({},_0x1e86a2,_0x4f6209[_0x86e3('0x5d')]);return db[_0x86e3('0x6c')]['count']({'where':_0x1e86a2[_0x86e3('0x54')]})['then'](function(_0xacb4b2){_0x5d8696[_0x86e3('0x36')]=_0xacb4b2;if(_0x4f6209[_0x86e3('0x4b')]['includeAll']){_0x1e86a2[_0x86e3('0x59')]=[{'all':!![]}];}return db['Disposition'][_0x86e3('0x5a')](_0x1e86a2);})[_0x86e3('0x23')](function(_0x54b4b6){_0x5d8696[_0x86e3('0x71')]=_0x54b4b6;return _0x5d8696;});}})[_0x86e3('0x23')](respondWithFilteredResult(_0x2a812a,_0x1e86a2))[_0x86e3('0x2e')](handleError(_0x2a812a,null));};exports[_0x86e3('0x72')]=function(_0x30ef76,_0x48c052,_0x95af9b){return db[_0x86e3('0x44')][_0x86e3('0x5e')]({'where':{'id':_0x30ef76['params']['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x48c052,null))[_0x86e3('0x23')](function(_0x445088){if(_0x445088){return _0x445088[_0x86e3('0x72')](_0x30ef76[_0x86e3('0x4b')][_0x86e3('0x73')]);}})[_0x86e3('0x23')](respondWithStatusCode(_0x48c052,null))[_0x86e3('0x2e')](handleError(_0x48c052,null));};exports[_0x86e3('0x74')]=function(_0x5b57e6,_0x39381c,_0x1efd97){if(_0x5b57e6[_0x86e3('0x60')]['id']){delete _0x5b57e6[_0x86e3('0x60')]['id'];}return db[_0x86e3('0x44')][_0x86e3('0x5e')]({'where':{'id':_0x5b57e6[_0x86e3('0x68')]['id']}})['then'](handleEntityNotFound(_0x39381c,null))[_0x86e3('0x23')](function(_0x5d21c5){if(_0x5d21c5){_0x5b57e6[_0x86e3('0x60')][_0x86e3('0x6b')]=_0x5d21c5['id'];return db[_0x86e3('0x75')][_0x86e3('0x5f')](_0x5b57e6[_0x86e3('0x60')]);}})[_0x86e3('0x23')](respondWithResult(_0x39381c,null))[_0x86e3('0x2e')](handleError(_0x39381c,null));};exports[_0x86e3('0x76')]=function(_0x3c1607,_0x44f640,_0x3c2e58){var _0x333a1d={'raw':![],'where':{}};var _0x404e3e={};var _0x1c4764={'count':0x0,'rows':[]};return db[_0x86e3('0x44')][_0x86e3('0x6e')]({'where':{'id':_0x3c1607[_0x86e3('0x68')]['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x44f640,null))[_0x86e3('0x23')](function(_0x5d3ecc){if(_0x5d3ecc){_0x404e3e[_0x86e3('0x49')]=_[_0x86e3('0x5c')](db[_0x86e3('0x75')][_0x86e3('0x45')]);_0x404e3e[_0x86e3('0x4b')]=_[_0x86e3('0x5c')](_0x3c1607[_0x86e3('0x4b')]);_0x404e3e['filters']=_[_0x86e3('0x4d')](_0x404e3e[_0x86e3('0x49')],_0x404e3e[_0x86e3('0x4b')]);_0x333a1d[_0x86e3('0x4e')]=_[_0x86e3('0x4d')](_0x404e3e[_0x86e3('0x49')],qs[_0x86e3('0x4f')](_0x3c1607['query'][_0x86e3('0x4f')]));_0x333a1d[_0x86e3('0x4e')]=_0x333a1d[_0x86e3('0x4e')][_0x86e3('0x50')]?_0x333a1d[_0x86e3('0x4e')]:_0x404e3e[_0x86e3('0x49')];if(!_0x3c1607[_0x86e3('0x4b')][_0x86e3('0x51')](_0x86e3('0x52'))){_0x333a1d['limit']=qs[_0x86e3('0x35')](_0x3c1607['query']['limit']);_0x333a1d[_0x86e3('0x33')]=qs[_0x86e3('0x33')](_0x3c1607[_0x86e3('0x4b')][_0x86e3('0x33')]);}_0x333a1d[_0x86e3('0x6f')]=qs['sort'](_0x3c1607[_0x86e3('0x4b')][_0x86e3('0x53')]);_0x333a1d[_0x86e3('0x54')]=qs[_0x86e3('0x4c')](_[_0x86e3('0x55')](_0x3c1607[_0x86e3('0x4b')],_0x404e3e[_0x86e3('0x4c')]));_0x333a1d[_0x86e3('0x54')][_0x86e3('0x6b')]=_0x5d3ecc['id'];if(_0x3c1607[_0x86e3('0x4b')][_0x86e3('0x70')]){_0x333a1d['where']=_[_0x86e3('0x57')](_0x333a1d[_0x86e3('0x54')],{'$or':_['map'](_0x333a1d[_0x86e3('0x4e')],function(_0x5d7592){var _0x4e6faa={};_0x4e6faa[_0x5d7592]={'$like':'%'+_0x3c1607[_0x86e3('0x4b')][_0x86e3('0x70')]+'%'};return _0x4e6faa;})});}_0x333a1d=_[_0x86e3('0x57')]({},_0x333a1d,_0x3c1607[_0x86e3('0x5d')]);return db['CannedAnswer'][_0x86e3('0x36')]({'where':_0x333a1d[_0x86e3('0x54')]})['then'](function(_0x26800f){_0x1c4764['count']=_0x26800f;if(_0x3c1607['query'][_0x86e3('0x58')]){_0x333a1d[_0x86e3('0x59')]=[{'all':!![]}];}return db[_0x86e3('0x75')][_0x86e3('0x5a')](_0x333a1d);})[_0x86e3('0x23')](function(_0x39a0f0){_0x1c4764[_0x86e3('0x71')]=_0x39a0f0;return _0x1c4764;});}})[_0x86e3('0x23')](respondWithFilteredResult(_0x44f640,_0x333a1d))[_0x86e3('0x2e')](handleError(_0x44f640,null));};exports[_0x86e3('0x77')]=function(_0x144e1a,_0x515aee,_0x19af08){return db[_0x86e3('0x44')][_0x86e3('0x5e')]({'where':{'id':_0x144e1a['params']['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x515aee,null))[_0x86e3('0x23')](function(_0x2f28e6){if(_0x2f28e6){return _0x2f28e6[_0x86e3('0x77')](_0x144e1a['query'][_0x86e3('0x73')]);}})['then'](respondWithStatusCode(_0x515aee,null))[_0x86e3('0x2e')](handleError(_0x515aee,null));};exports['notify']=function(_0x12916d,_0x3f1f98,_0x23c6c8){var _0x3f9260={'channel':_0x86e3('0x78')};var _0x581307=[];var _0x15e9a9=[];var _0x2cbb88={};return db[_0x86e3('0x44')][_0x86e3('0x5e')]({'where':{'id':_0x12916d[_0x86e3('0x68')]['id']},'include':[{'model':db[_0x86e3('0x79')],'as':'Applications'}]})[_0x86e3('0x23')](handleEntityNotFound(_0x3f1f98,null))[_0x86e3('0x23')](function(_0x5e9a5d){_0x3f9260[_0x86e3('0x7a')]=_0x5e9a5d;_0x3f9260[_0x86e3('0x7b')]=_[_0x86e3('0x7c')](_0x5e9a5d['Applications'],['priority'],['asc']);if(_0x3f9260[_0x86e3('0x7a')][_0x86e3('0x7d')]){delete _0x3f9260[_0x86e3('0x7a')]['Applications'];}return db[_0x86e3('0x7e')][_0x86e3('0x69')]();})[_0x86e3('0x23')](function(_0x33e2bb){if(!_0x33e2bb){throw new db[(_0x86e3('0x7f'))][(_0x86e3('0x80'))](_0x86e3('0x81'));}_0x581307=_[_0x86e3('0x82')](_[_0x86e3('0x5c')](_0x33e2bb),[_0x86e3('0x83'),'updatedAt']);_0x15e9a9=_[_0x86e3('0x82')](_[_0x86e3('0x5c')](_0x33e2bb),[_0x86e3('0x83'),_0x86e3('0x84'),'CompanyId',_0x86e3('0x85')]);_0x3f9260[_0x86e3('0x60')]={'mapKey':_0x86e3('0x86')};if(_0x3f9260[_0x86e3('0x7a')][_0x86e3('0x47')]){switch(_0x3f9260[_0x86e3('0x7a')][_0x86e3('0x47')]){case _0x86e3('0x87'):_0x3f9260[_0x86e3('0x60')]['from']=_0x12916d[_0x86e3('0x60')][_0x86e3('0x88')];_0x3f9260['body'][_0x86e3('0x60')]=_0x12916d[_0x86e3('0x60')]['Body'];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x89')]=_0x12916d[_0x86e3('0x60')][_0x86e3('0x8a')];break;case'skebby':_0x3f9260[_0x86e3('0x60')]['from']='+'+_0x12916d[_0x86e3('0x60')][_0x86e3('0x8b')];_0x3f9260[_0x86e3('0x60')]['body']=_0x12916d[_0x86e3('0x60')][_0x86e3('0x8c')];break;case _0x86e3('0x8d'):_0x3f9260[_0x86e3('0x60')]['from']=_0x12916d['body']['from'];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x60')]=_0x12916d['body'][_0x86e3('0x2c')];break;case _0x86e3('0x8e'):_0x3f9260[_0x86e3('0x60')][_0x86e3('0x8f')]=_0x12916d[_0x86e3('0x60')][_0x86e3('0x8f')];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x60')]=_0x12916d[_0x86e3('0x60')][_0x86e3('0x60')];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x89')]=_0x12916d[_0x86e3('0x60')][_0x86e3('0x90')];break;case _0x86e3('0x91'):_0x3f9260[_0x86e3('0x60')][_0x86e3('0x8f')]=_0x12916d['body'][_0x86e3('0x88')];_0x3f9260['body'][_0x86e3('0x60')]=_0x12916d['body']['Text'];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x89')]=_0x12916d[_0x86e3('0x60')][_0x86e3('0x92')];break;case _0x86e3('0x93'):_0x3f9260[_0x86e3('0x60')][_0x86e3('0x8f')]='+'+_0x12916d[_0x86e3('0x60')][_0x86e3('0x94')][0x0][_0x86e3('0x8f')];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x60')]=_0x12916d['body'][_0x86e3('0x94')][0x0][_0x86e3('0x8c')];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x89')]=_0x12916d[_0x86e3('0x60')][_0x86e3('0x94')][0x0]['messageId'];break;case _0x86e3('0x95'):_0x3f9260[_0x86e3('0x60')][_0x86e3('0x8f')]=_0x12916d[_0x86e3('0x60')][_0x86e3('0x96')];_0x3f9260['body'][_0x86e3('0x60')]=_0x12916d[_0x86e3('0x60')]['segmentedMessage'][_0x86e3('0x2c')];break;case _0x86e3('0x97'):_0x3f9260['body']['from']=_0x12916d['body']['fromNumber'];_0x3f9260['body'][_0x86e3('0x60')]=_0x12916d[_0x86e3('0x60')]['text'];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x89')]=_0x12916d['body'][_0x86e3('0x98')];break;case'bandwidth':_0x3f9260[_0x86e3('0x60')][_0x86e3('0x89')]=_0x12916d[_0x86e3('0x60')][0x0]['message']['id'];_0x3f9260['body'][_0x86e3('0x8f')]=_0x12916d[_0x86e3('0x60')][0x0][_0x86e3('0x2c')]['from'];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x60')]=_0x12916d['body'][0x0]['message'][_0x86e3('0x8c')];break;case _0x86e3('0x99'):_0x3f9260[_0x86e3('0x60')]['from']=_0x12916d['body'][_0x86e3('0x8f')];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x60')]=_0x12916d[_0x86e3('0x60')][_0x86e3('0x2c')];_0x3f9260[_0x86e3('0x60')][_0x86e3('0x89')]=_0x12916d[_0x86e3('0x60')]['refid'];break;}}if(_0x3f9260['body']['id']){delete _0x3f9260[_0x86e3('0x60')]['id'];}if(_['isNil'](_0x3f9260[_0x86e3('0x60')]['from'])){throw new db[(_0x86e3('0x7f'))][(_0x86e3('0x80'))]('from\x20is\x20mandatory');}if(_[_0x86e3('0x9a')](_0x3f9260[_0x86e3('0x60')][_0x86e3('0x60')])||_0x3f9260[_0x86e3('0x60')][_0x86e3('0x60')]===''){throw new db[(_0x86e3('0x7f'))][(_0x86e3('0x80'))](_0x86e3('0x9b'));}if(_[_0x86e3('0x9a')](_0x3f9260[_0x86e3('0x60')][_0x86e3('0x9c')])){throw new db[(_0x86e3('0x7f'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x15e9a9);}if(!_[_0x86e3('0x9d')](_0x15e9a9,_0x3f9260[_0x86e3('0x60')][_0x86e3('0x9c')])){throw new db[(_0x86e3('0x7f'))][(_0x86e3('0x80'))](_0x86e3('0x9e')+_0x15e9a9);}_0x2cbb88[_0x3f9260[_0x86e3('0x60')][_0x86e3('0x9c')]]=_0x3f9260[_0x86e3('0x60')]['from'];return db[_0x86e3('0x9f')][_0x86e3('0x5e')]({'where':{'id':_0x3f9260[_0x86e3('0x7a')][_0x86e3('0x85')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2cbb88,'limit':0x1,'order':[[_0x86e3('0x84'),_0x86e3('0xa0')]]}]});})[_0x86e3('0x23')](handleEntityNotFound(_0x3f1f98,null))[_0x86e3('0x23')](function(_0x520e4e){if(_0x520e4e){_0x3f9260[_0x86e3('0xa1')]=_[_0x86e3('0xa2')](_0x520e4e,['Contacts']);if(_0x520e4e['Contacts']['length']){return _0x520e4e[_0x86e3('0xa3')][0x0];}var _0x2a1e5d=_[_0x86e3('0x1d')](_0x3f9260['body'],{'firstName':_0x3f9260['body'][_0x86e3('0x8f')],'ListId':_0x520e4e['id']});_0x2a1e5d[_0x3f9260[_0x86e3('0x60')][_0x86e3('0x9c')]]=_0x3f9260[_0x86e3('0x60')]['from'];return db[_0x86e3('0x7e')][_0x86e3('0x5f')](_0x2a1e5d,{'fields':_0x581307,'raw':!![]});}})[_0x86e3('0x23')](handleEntityNotFound(_0x3f1f98,null))['then'](function(_0x3c917d){if(_0x3c917d){_0x3f9260[_0x86e3('0xa4')]=_0x3c917d;var _0x5eb903={'ContactId':_0x3c917d['id'],'phone':_0x3f9260[_0x86e3('0x60')]['from'],'SmsAccountId':_0x12916d['params']['id']};var _0x58b270={'ContactId':_0x3c917d['id'],'SmsAccountId':_0x12916d[_0x86e3('0x68')]['id'],'closed':![]};return db[_0x86e3('0xa5')][_0x86e3('0x5e')]({'where':_0x58b270})[_0x86e3('0x23')](function(_0x18d88f){if(_0x18d88f){return[_0x18d88f,![]];}return db[_0x86e3('0xa5')][_0x86e3('0x5f')](_0x5eb903)[_0x86e3('0x23')](function(_0x570982){return[_0x570982,!![]];});});}})[_0x86e3('0xa6')](function(_0x246321,_0x438e1b){_0x3f9260[_0x86e3('0xa7')]=_0x246321[_0x86e3('0x62')]({'plain':!![]});_0x3f9260[_0x86e3('0xa7')][_0x86e3('0xa8')]=![];if(_0x438e1b){if(_0x3f9260['account'][_0x86e3('0xa9')]){_0x3f9260['applications'][_0x86e3('0xaa')]({'id':0x0,'priority':_0x3f9260['applications']['length']+0x1,'app':_0x86e3('0xab'),'appdata':_0x86e3('0xac'),'interval':_0x86e3('0xad')});}_0x3f9260['interaction'][_0x86e3('0xa8')]=!![];}return db['SmsMessage'][_0x86e3('0x5f')]({'phone':_0x3f9260[_0x86e3('0x60')]['from'],'messageId':_0x3f9260[_0x86e3('0x60')][_0x86e3('0x89')],'body':_0x3f9260['body']['body'],'SmsAccountId':_0x12916d[_0x86e3('0x68')]['id'],'SmsInteractionId':_0x246321['id'],'direction':'in','ContactId':_0x246321[_0x86e3('0xae')],'AttachmentId':_0x3f9260['body']['AttachmentId']});})[_0x86e3('0x23')](function(_0x3223d0){_0x3f9260[_0x86e3('0x2c')]=_0x3223d0;if(!_0x3f9260['interaction'][_0x86e3('0xaf')])return;return db[_0x86e3('0xb0')]['find']({'attributes':['id',_0x86e3('0x3f')],'where':{'id':_0x3f9260[_0x86e3('0xa7')]['UserId']}});})[_0x86e3('0x23')](function(_0x4640fc){if(_0x4640fc){_0x3f9260['applications'][_0x86e3('0xb1')]({'id':0x0,'priority':0x0,'app':_0x86e3('0xb2'),'appdata':_0x4640fc[_0x86e3('0x3f')]+','+(_0x3f9260[_0x86e3('0x7a')]['waitForTheAssignedAgent']||0xa),'interval':_0x86e3('0xad')});}if(!_0x3f9260[_0x86e3('0xa7')]['queueId'])return;return db[_0x86e3('0xb3')]['find']({'attributes':['id',_0x86e3('0x3f')],'where':{'id':_0x3f9260[_0x86e3('0xa7')][_0x86e3('0xb4')]}});})['then'](function(_0x1e2fcf){if(_0x1e2fcf){_0x3f9260['applications'][_0x86e3('0xb1')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1e2fcf[_0x86e3('0x3f')]+','+(_0x3f9260['account'][_0x86e3('0xb5')]||0x12c),'interval':_0x86e3('0xad')});}return respondWithRpcPromise('Start',_0x86e3('0xb6'),_0x3f9260);})[_0x86e3('0x23')](function(_0xdd69a1){if(_0xdd69a1){var _0x1eb12c=0xc8;var _0x35d820=_0x86e3('0xb7');logger[_0x86e3('0x24')](_0x86e3('0x28'),_0x35d820,_0x1eb12c,_0x86e3('0xb8'));logger[_0x86e3('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x35d820,_0x1eb12c,_0x86e3('0xb8'),JSON[_0x86e3('0x29')](_0xdd69a1));if(_0x3f9260[_0x86e3('0x7a')][_0x86e3('0x47')]===_0x86e3('0x87')){return _0x3f1f98['status'](_0x1eb12c)[_0x86e3('0x37')](_0x86e3('0xb9'),_0x86e3('0xba'))[_0x86e3('0x40')](_0x86e3('0xbb'));}else{return _0x3f1f98[_0x86e3('0x30')](_0x1eb12c)[_0x86e3('0x32')](_0xdd69a1);}}})[_0x86e3('0x2e')](handleError(_0x3f1f98,null));};exports[_0x86e3('0xbc')]=function(_0x413ef7,_0x15b981){var _0x41ddfe=_0x413ef7[_0x86e3('0x68')]['id'];var _0x2a0f08=_0x413ef7[_0x86e3('0x60')];var _0x479eb6=0xc8;var _0x2b3833=null;return db[_0x86e3('0xbd')][_0x86e3('0xbe')]({'isolationLevel':db[_0x86e3('0xbd')][_0x86e3('0xbf')][_0x86e3('0xc0')]['READ_COMMITTED']},function(_0x3e1525){return db[_0x86e3('0x44')][_0x86e3('0x6e')]({'where':{'id':_0x41ddfe},'transaction':_0x3e1525})[_0x86e3('0x23')](function(_0x95ee34){if(_0x95ee34){return db[_0x86e3('0x79')][_0x86e3('0x3c')]({'where':{'SmsAccountId':_0x41ddfe},'transaction':_0x3e1525})[_0x86e3('0x23')](function(){var _0x288837=_[_0x86e3('0x4a')](_0x2a0f08,function(_0xb3d6c2){_0xb3d6c2['SmsAccountId']=_0x41ddfe;return _0xb3d6c2;});return db[_0x86e3('0x79')]['bulkCreate'](_0x288837,{'transaction':_0x3e1525});});}else{_0x479eb6=0x194;_0x2b3833=[];}});})[_0x86e3('0x23')](function(){if(_0x479eb6!==0x194){return db[_0x86e3('0x79')][_0x86e3('0xc1')]({'where':{'SmsAccountId':_0x41ddfe},'order':'priority'})[_0x86e3('0x23')](function(_0x198e5b){_0x2b3833=_0x198e5b;});}})[_0x86e3('0x2e')](function(_0x3a3719){_0x479eb6=0x1f4;logger[_0x86e3('0x2a')](_0x3a3719[_0x86e3('0xc2')]);if(_0x3a3719[_0x86e3('0x3f')]){delete _0x3a3719[_0x86e3('0x3f')];}_0x2b3833=_0x3a3719;})[_0x86e3('0xc3')](function(){if(_0x2b3833===null){_0x15b981[_0x86e3('0x2f')](_0x479eb6);}else{if(_0x479eb6===0x1f4){_0x15b981['status'](_0x479eb6)[_0x86e3('0x40')](_0x2b3833);}else{_0x15b981['status'](_0x479eb6)[_0x86e3('0x32')](_0x2b3833);}}});};exports[_0x86e3('0xc4')]=function(_0x4eecb3,_0x18c5d6,_0x1a34f7){var _0x5d4e05={};var _0x296dae={};var _0x55fdd0;var _0x12e80d;return db[_0x86e3('0x44')][_0x86e3('0x6e')]({'where':{'id':_0x4eecb3[_0x86e3('0x68')]['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x18c5d6,null))[_0x86e3('0x23')](function(_0x3c3408){if(_0x3c3408){_0x55fdd0=_0x3c3408;_0x296dae['model']=_[_0x86e3('0x5c')](db[_0x86e3('0x79')]['rawAttributes']);_0x296dae[_0x86e3('0x4b')]=_[_0x86e3('0x5c')](_0x4eecb3[_0x86e3('0x4b')]);_0x296dae[_0x86e3('0x4c')]=_[_0x86e3('0x4d')](_0x296dae[_0x86e3('0x49')],_0x296dae[_0x86e3('0x4b')]);_0x5d4e05[_0x86e3('0x4e')]=_['intersection'](_0x296dae[_0x86e3('0x49')],qs[_0x86e3('0x4f')](_0x4eecb3['query'][_0x86e3('0x4f')]));_0x5d4e05[_0x86e3('0x4e')]=_0x5d4e05[_0x86e3('0x4e')][_0x86e3('0x50')]?_0x5d4e05[_0x86e3('0x4e')]:_0x296dae[_0x86e3('0x49')];_0x5d4e05['order']=qs[_0x86e3('0x53')](_0x4eecb3[_0x86e3('0x4b')][_0x86e3('0x53')]);_0x5d4e05[_0x86e3('0x54')]=qs[_0x86e3('0x4c')](_['pick'](_0x4eecb3['query'],_0x296dae[_0x86e3('0x4c')]));if(_0x4eecb3['query'][_0x86e3('0x70')]){_0x5d4e05[_0x86e3('0x54')]=_[_0x86e3('0x57')](_0x5d4e05[_0x86e3('0x54')],{'$or':_[_0x86e3('0x4a')](_0x5d4e05[_0x86e3('0x4e')],function(_0x314de4){var _0x94d25b={};_0x94d25b[_0x314de4]={'$like':'%'+_0x4eecb3[_0x86e3('0x4b')][_0x86e3('0x70')]+'%'};return _0x94d25b;})});}_0x5d4e05=_[_0x86e3('0x57')]({},_0x5d4e05,_0x4eecb3['options']);return _0x55fdd0['getApplications'](_0x5d4e05);}})[_0x86e3('0x23')](function(_0x5ece5b){if(_0x5ece5b){_0x12e80d=_0x5ece5b[_0x86e3('0x50')];if(!_0x4eecb3[_0x86e3('0x4b')][_0x86e3('0x51')](_0x86e3('0x52'))){_0x5d4e05[_0x86e3('0x35')]=qs[_0x86e3('0x35')](_0x4eecb3[_0x86e3('0x4b')][_0x86e3('0x35')]);_0x5d4e05[_0x86e3('0x33')]=qs[_0x86e3('0x33')](_0x4eecb3[_0x86e3('0x4b')]['offset']);}return _0x55fdd0[_0x86e3('0xc4')](_0x5d4e05);}})['then'](function(_0x81f03d){if(_0x81f03d){return _0x81f03d?{'count':_0x12e80d,'rows':_0x81f03d}:null;}})[_0x86e3('0x23')](respondWithResult(_0x18c5d6,null))['catch'](handleError(_0x18c5d6,null));};exports['getInteractions']=function(_0x239ac0,_0x57b372,_0x28fa33){var _0x4f2533={'raw':![],'where':{}};var _0xd46be={};var _0x39f7b8={'count':0x0,'rows':[]};return db[_0x86e3('0x44')][_0x86e3('0x6e')]({'where':{'id':_0x239ac0['params']['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x57b372,null))['then'](function(_0x564fd0){if(_0x564fd0){_0xd46be[_0x86e3('0x49')]=_[_0x86e3('0x5c')](db[_0x86e3('0xa5')]['rawAttributes']);_0xd46be[_0x86e3('0x4b')]=_[_0x86e3('0x5c')](_0x239ac0[_0x86e3('0x4b')]);_0xd46be[_0x86e3('0x4c')]=_[_0x86e3('0x4d')](_0xd46be['model'],_0xd46be[_0x86e3('0x4b')]);_0x4f2533[_0x86e3('0x4e')]=_[_0x86e3('0x4d')](_0xd46be['model'],qs[_0x86e3('0x4f')](_0x239ac0[_0x86e3('0x4b')]['fields']));_0x4f2533['attributes']=_0x4f2533['attributes']['length']?_0x4f2533[_0x86e3('0x4e')]:_0xd46be[_0x86e3('0x49')];if(!_0x239ac0[_0x86e3('0x4b')]['hasOwnProperty'](_0x86e3('0x52'))){_0x4f2533[_0x86e3('0x35')]=qs[_0x86e3('0x35')](_0x239ac0[_0x86e3('0x4b')][_0x86e3('0x35')]);_0x4f2533[_0x86e3('0x33')]=qs[_0x86e3('0x33')](_0x239ac0['query'][_0x86e3('0x33')]);}_0x4f2533[_0x86e3('0x6f')]=qs[_0x86e3('0x53')](_0x239ac0[_0x86e3('0x4b')][_0x86e3('0x53')]);_0x4f2533['where']=qs['filters'](_['pick'](_0x239ac0[_0x86e3('0x4b')],_0xd46be[_0x86e3('0x4c')]));_0x4f2533[_0x86e3('0x54')][_0x86e3('0x6b')]=_0x564fd0['id'];if(_0x239ac0[_0x86e3('0x4b')][_0x86e3('0x70')]){_0x4f2533[_0x86e3('0x54')]=_['merge'](_0x4f2533['where'],{'$or':_[_0x86e3('0x4a')](_0x4f2533[_0x86e3('0x4e')],function(_0x3d93d9){var _0x3f7dce={};_0x3f7dce[_0x3d93d9]={'$like':'%'+_0x239ac0[_0x86e3('0x4b')]['filter']+'%'};return _0x3f7dce;})});}_0x4f2533=_[_0x86e3('0x57')]({},_0x4f2533,_0x239ac0[_0x86e3('0x5d')]);return db['SmsInteraction'][_0x86e3('0x36')]({'where':_0x4f2533['where']})[_0x86e3('0x23')](function(_0x21eb00){_0x39f7b8[_0x86e3('0x36')]=_0x21eb00;if(_0x239ac0[_0x86e3('0x4b')]['includeAll']){_0x4f2533[_0x86e3('0x59')]=[{'model':db[_0x86e3('0x7e')],'as':_0x86e3('0xc5'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x86e3('0x3f'),_0x86e3('0xc6'),_0x86e3('0xc7')],'required':![]},{'model':db['Tag'],'as':_0x86e3('0xc8'),'attributes':['id',_0x86e3('0x3f'),'color'],'where':_0x239ac0[_0x86e3('0x4b')][_0x86e3('0xc9')]?{'id':_0x239ac0['query'][_0x86e3('0xc9')]}:undefined,'required':_0x239ac0['query'][_0x86e3('0xc9')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x4f2533);})[_0x86e3('0x23')](function(_0x8459c5){_0x39f7b8[_0x86e3('0x71')]=_0x8459c5;return _0x39f7b8;});}})[_0x86e3('0x23')](respondWithFilteredResult(_0x57b372,_0x4f2533))[_0x86e3('0x2e')](handleError(_0x57b372,null));};exports['send']=function(_0x23f903,_0x24af94,_0x481b4e){var _0x560dbc,_0xce1afd,_0x26124c;if(_[_0x86e3('0x9a')](_0x23f903[_0x86e3('0x60')][_0x86e3('0x60')])||_0x23f903[_0x86e3('0x60')]['body']===''){throw new db[(_0x86e3('0x7f'))][(_0x86e3('0x80'))](_0x86e3('0x9b'));}if(_[_0x86e3('0x9a')](_0x23f903[_0x86e3('0x60')]['to'])){throw new db[(_0x86e3('0x7f'))][(_0x86e3('0x80'))](_0x86e3('0xca'));}_0x560dbc=_0x23f903[_0x86e3('0x60')]['to'];return db[_0x86e3('0x44')][_0x86e3('0x5e')]({'where':{'id':_0x23f903[_0x86e3('0x68')]['id']},'include':[{'model':db[_0x86e3('0x9f')],'as':'List','include':[{'model':db[_0x86e3('0x7e')],'as':'Contacts','where':{'mobile':_0x560dbc},'limit':0x1,'order':[[_0x86e3('0x84'),'DESC']]}]}]})[_0x86e3('0x23')](handleEntityNotFound(_0x24af94,null))[_0x86e3('0x23')](function(_0x45906){if(_0x45906&&_0x45906['List']){_0xce1afd=_0x45906['get']({'plain':!![]});if(_0xce1afd[_0x86e3('0xcb')]&&_0xce1afd['List'][_0x86e3('0xa3')][_0x86e3('0x50')]){return _0xce1afd['List'][_0x86e3('0xa3')][0x0];}return db[_0x86e3('0x7e')][_0x86e3('0x5f')](_[_0x86e3('0x1d')](_0x23f903[_0x86e3('0x60')],{'firstName':_0x560dbc,'mobile':_0x560dbc,'phone':_0x560dbc,'ListId':_0xce1afd[_0x86e3('0x85')]}));}})['then'](handleEntityNotFound(_0x24af94,null))[_0x86e3('0x23')](function(_0x1f173a){if(_0x1f173a){_0x26124c=_0x1f173a;return db[_0x86e3('0xa5')][_0x86e3('0x5e')]({'where':{'ContactId':_0x26124c['id'],'closed':![],'SmsAccountId':_0xce1afd['id']}})['then'](function(_0x29f180){if(_0x29f180){return[_0x29f180,![]];}return db[_0x86e3('0xa5')][_0x86e3('0x5f')]({'UserId':_0x23f903['user']['id'],'ContactId':_0x26124c['id'],'SmsAccountId':_0xce1afd['id'],'phone':_0x560dbc,'firstMsgDirection':'out','Messages':[_['merge'](_0x23f903[_0x86e3('0x60')],{'read':![],'body':_0x23f903[_0x86e3('0x60')][_0x86e3('0x60')],'phone':_0x560dbc,'SmsAccountId':_0xce1afd['id'],'UserId':_0x23f903[_0x86e3('0x61')]['id'],'ContactId':_0x26124c['id']})]},{'include':[{'model':db[_0x86e3('0xcc')],'as':'Messages'}]})[_0x86e3('0x23')](function(_0x4ec120){return[_0x4ec120,!![]];});});}})[_0x86e3('0xa6')](function(_0x1ec539,_0x311fac){if(_0x311fac){return _0x1ec539;}return db[_0x86e3('0xcc')][_0x86e3('0x5f')](_['merge'](_0x23f903['body'],{'read':![],'body':_0x23f903['body'][_0x86e3('0x60')],'phone':_0x560dbc,'SmsAccountId':_0xce1afd['id'],'SmsInteractionId':_0x1ec539['id'],'UserId':_0x23f903[_0x86e3('0x61')]['id'],'ContactId':_0x26124c['id']}))[_0x86e3('0x23')](function(_0x284e8e){_0x1ec539[_0x86e3('0xcd')]['Messages']=[];_0x1ec539[_0x86e3('0xcd')][_0x86e3('0xce')]['push'](_0x284e8e[_0x86e3('0xcd')]);return _0x1ec539;});})[_0x86e3('0x23')](respondWithResult(_0x24af94,null))[_0x86e3('0x2e')](handleError(_0x24af94,null));};exports['status']=function(_0x2717b2,_0x1d55ce,_0x162330){if(_0x2717b2[_0x86e3('0x60')]['id']){delete _0x2717b2['body']['id'];}var _0x5d8458,_0x2bd3aa,_0x48fbb4;return db[_0x86e3('0x44')][_0x86e3('0x5e')]({'where':{'id':_0x2717b2[_0x86e3('0x68')]['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x1d55ce,null))[_0x86e3('0x23')](function(_0x2b2671){if(_0x2b2671){_0x48fbb4=_0x2b2671;logger[_0x86e3('0x27')](_0x86e3('0x28'),_0x86e3('0x30'),'received\x20delivery\x20report\x20from',_0x2b2671[_0x86e3('0x47')],util['inspect'](_0x2717b2['body'],{'showHidden':![],'depth':null}));switch(_0x2b2671['type']){case'skebby':if(_0x2717b2[_0x86e3('0x60')]['skebby_dispatch_id']&&_0x2717b2[_0x86e3('0x60')][_0x86e3('0x30')]){_0x2bd3aa=_0x2717b2['body'][_0x86e3('0x30')];return db[_0x86e3('0xcc')][_0x86e3('0x5e')]({'where':{'messageId':_0x2717b2[_0x86e3('0x60')][_0x86e3('0xcf')]}});}break;case _0x86e3('0x8d'):if(_0x2717b2[_0x86e3('0x60')]['requestid']&&_0x2717b2[_0x86e3('0x60')][_0x86e3('0xd0')]){_0x2bd3aa=_0x2717b2[_0x86e3('0x60')][_0x86e3('0xd0')];return db[_0x86e3('0xcc')]['find']({'where':{'messageId':_0x2717b2[_0x86e3('0x60')][_0x86e3('0xd1')]}});}break;case _0x86e3('0x8e'):if(_0x2717b2['body']['message_id']&&_0x2717b2[_0x86e3('0x60')][_0x86e3('0xd2')]){_0x2bd3aa=_0x2717b2[_0x86e3('0x60')]['status_code'];return db['SmsMessage'][_0x86e3('0x5e')]({'where':{'messageId':_0x2717b2[_0x86e3('0x60')][_0x86e3('0x90')]}});}break;case _0x86e3('0x93'):var _0x24c693=_0x2717b2[_0x86e3('0x60')][_0x86e3('0x94')][0x0];if(_0x24c693[_0x86e3('0x89')]&&_0x24c693['status']['groupName']===_0x86e3('0xd3')){_0x2bd3aa=_0x24c693[_0x86e3('0x30')][_0x86e3('0xd4')];return db['SmsMessage'][_0x86e3('0x5e')]({'where':{'messageId':_0x24c693['messageId']}});}break;case'clickatell':if(_0x2717b2['body'][_0x86e3('0x89')]&&_0x2717b2['body'][_0x86e3('0x30')]){_0x2bd3aa=_0x2717b2[_0x86e3('0x60')][_0x86e3('0x30')];return db[_0x86e3('0xcc')][_0x86e3('0x5e')]({'where':{'messageId':_0x2717b2[_0x86e3('0x60')][_0x86e3('0x89')]}});}break;case _0x86e3('0xd5'):if(_0x2717b2[_0x86e3('0x60')][0x0][_0x86e3('0x2c')]['id']){_0x2bd3aa=_0x2717b2[_0x86e3('0x60')][0x0][_0x86e3('0x47')];return db[_0x86e3('0xcc')][_0x86e3('0x5e')]({'where':{'messageId':_0x2717b2[_0x86e3('0x60')][0x0][_0x86e3('0x2c')]['id']}});}break;case _0x86e3('0x99'):if(_0x2717b2['body'][_0x86e3('0xd6')]&&_0x2717b2[_0x86e3('0x60')][_0x86e3('0x30')]){_0x2bd3aa=_0x2717b2['body']['status'];return db[_0x86e3('0xcc')][_0x86e3('0x5e')]({'where':{'messageId':_0x2717b2[_0x86e3('0x60')][_0x86e3('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x1d55ce,null))[_0x86e3('0x23')](function(_0x1f85b3){if(_0x1f85b3){_0x5d8458=_0x1f85b3;switch(_0x48fbb4[_0x86e3('0x47')]){case _0x86e3('0xd7'):if(_0x2bd3aa==='DELIVERED'){return _0x5d8458[_0x86e3('0x3b')]({'read':!![]});}else{logger[_0x86e3('0x2a')](_0x86e3('0x28'),'status',_0x86e3('0xd7'),util[_0x86e3('0xd8')](_0x2717b2[_0x86e3('0x60')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2bd3aa==='1'){return _0x5d8458['update']({'read':!![]});}else{logger[_0x86e3('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x86e3('0x30'),'skebby',util[_0x86e3('0xd8')](_0x2717b2[_0x86e3('0x60')],{'showHidden':![],'depth':null}));}break;case _0x86e3('0x8e'):if(!_0x2717b2[_0x86e3('0x60')]['error_code']&&_0x2bd3aa>=0xc8&&_0x2bd3aa<=0xce){return _0x5d8458[_0x86e3('0x3b')]({'read':!![]});}else{logger[_0x86e3('0x2a')](_0x86e3('0x28'),_0x86e3('0x30'),_0x86e3('0x8e'),util['inspect'](_0x2717b2['body'],{'showHidden':![],'depth':null}));}break;case _0x86e3('0x93'):var _0x3bf265=_0x2717b2['body'][_0x86e3('0x94')][0x0];if(_0x3bf265[_0x86e3('0x30')][_0x86e3('0xd4')]===_0x86e3('0xd3')){return _0x5d8458['update']({'read':!![]});}else{logger[_0x86e3('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x86e3('0x30'),_0x86e3('0x93'),util[_0x86e3('0xd8')](_0x2717b2[_0x86e3('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x2bd3aa=='DELIVERED_TO_GATEWAY'||_0x2bd3aa==_0x86e3('0xd9')){return _0x5d8458['update']({'read':!![]});}else{logger[_0x86e3('0x2a')](_0x86e3('0x28'),_0x86e3('0x30'),_0x86e3('0x97'),util[_0x86e3('0xd8')](_0x2717b2[_0x86e3('0x60')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x2bd3aa==_0x86e3('0xda')){return _0x5d8458['update']({'read':!![]});}else{logger[_0x86e3('0x2a')](_0x86e3('0x28'),_0x86e3('0x30'),_0x86e3('0xd5'),util['inspect'](_0x2717b2['body'],{'showHidden':![],'depth':null}));}break;case _0x86e3('0x99'):if(_0x2bd3aa==='DELIVRD'||_0x2bd3aa===_0x86e3('0xdb')){return _0x5d8458[_0x86e3('0x3b')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x86e3('0x30'),'intelepeer',util[_0x86e3('0xd8')](_0x2717b2[_0x86e3('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x5d8458;}})[_0x86e3('0x23')](respondWithResult(_0x1d55ce,null))['catch'](handleError(_0x1d55ce,null));};exports[_0x86e3('0xdc')]=function(_0x170c83,_0x5c5e04,_0x1acb15){var _0x1ecc3d,_0x3d8be2,_0x280ae2;return db[_0x86e3('0x44')]['find']({'where':{'id':_0x170c83['params']['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x5c5e04,null))[_0x86e3('0x23')](function(_0x30687d){if(_0x30687d){_0x280ae2=_0x30687d;logger[_0x86e3('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x86e3('0x30'),_0x86e3('0xdd'),_0x30687d[_0x86e3('0x47')],util[_0x86e3('0xd8')](_0x170c83[_0x86e3('0x4b')],{'showHidden':![],'depth':null}));switch(_0x30687d[_0x86e3('0x47')]){case'csc':if(_0x170c83[_0x86e3('0x4b')][_0x86e3('0xde')]&&_0x170c83[_0x86e3('0x4b')]['state']){_0x3d8be2=_0x170c83['query'][_0x86e3('0xdf')];return db[_0x86e3('0xcc')][_0x86e3('0x5e')]({'where':{'messageId':_0x170c83['query'][_0x86e3('0xde')]}});}break;}}})[_0x86e3('0x23')](handleEntityNotFound(_0x5c5e04,null))[_0x86e3('0x23')](function(_0x38dc6c){if(_0x38dc6c){_0x1ecc3d=_0x38dc6c;switch(_0x280ae2['type']){case _0x86e3('0x95'):if(_0x3d8be2==='2'||_0x3d8be2==='6'){return _0x1ecc3d[_0x86e3('0x3b')]({'read':!![]});}else{logger[_0x86e3('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x86e3('0x30'),_0x86e3('0x95'),util['inspect'](_0x170c83[_0x86e3('0x4b')],{'showHidden':![],'depth':null}));};break;}return _0x1ecc3d;}})['then'](respondWithResult(_0x5c5e04,null))[_0x86e3('0x2e')](handleError(_0x5c5e04,null));};exports[_0x86e3('0xe0')]=function(_0x1eee12,_0x3f16f7,_0x37b057){return db[_0x86e3('0x44')]['find']({'where':{'id':_0x1eee12['params']['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x3f16f7,null))[_0x86e3('0x23')](function(_0x194774){if(_0x194774){return _0x194774[_0x86e3('0xe0')](_0x1eee12[_0x86e3('0x60')][_0x86e3('0x73')],_[_0x86e3('0xa2')](_0x1eee12['body'],['ids','id'])||{})['spread'](function(_0xa33770){for(var _0x264211=0x0;_0x264211<_0x1eee12[_0x86e3('0x60')][_0x86e3('0x73')][_0x86e3('0x50')];_0x264211+=0x1){socket[_0x86e3('0xe1')](_0x86e3('0xe2'),{'UserId':Number(_0x1eee12[_0x86e3('0x60')][_0x86e3('0x73')][_0x264211]),'SmsAccountId':Number(_0x1eee12[_0x86e3('0x68')]['id'])});}return _0xa33770;});}})['then'](respondWithResult(_0x3f16f7,null))[_0x86e3('0x2e')](handleError(_0x3f16f7,null));};exports[_0x86e3('0xe3')]=function(_0x553504,_0x107f70,_0x2c4a2a){return db[_0x86e3('0x44')][_0x86e3('0x5e')]({'where':{'id':_0x553504['params']['id']}})['then'](handleEntityNotFound(_0x107f70,null))['then'](function(_0x3ef971){if(_0x3ef971){return _0x3ef971[_0x86e3('0xe3')](_0x553504[_0x86e3('0x4b')][_0x86e3('0x73')])[_0x86e3('0x23')](function(){if(_[_0x86e3('0xe4')](_0x553504['query'][_0x86e3('0x73')])){for(var _0x3ac39f=0x0;_0x3ac39f<_0x553504[_0x86e3('0x4b')]['ids'][_0x86e3('0x50')];_0x3ac39f+=0x1){socket[_0x86e3('0xe1')]('userSmsAccount:remove',{'UserId':Number(_0x553504[_0x86e3('0x4b')]['ids'][_0x3ac39f]),'SmsAccountId':Number(_0x553504[_0x86e3('0x68')]['id'])});}}else{socket['emit'](_0x86e3('0xe5'),{'UserId':Number(_0x553504['query'][_0x86e3('0x73')]),'SmsAccountId':Number(_0x553504[_0x86e3('0x68')]['id'])});}});}})[_0x86e3('0x23')](respondWithStatusCode(_0x107f70,null))[_0x86e3('0x2e')](handleError(_0x107f70,null));};exports[_0x86e3('0xe6')]=function(_0x3194bb,_0x232b50,_0x1843f7){var _0x27a0fe={};var _0x5af5dc={};var _0x3fcad6;var _0x36f4a9;return db[_0x86e3('0x44')][_0x86e3('0x6e')]({'where':{'id':_0x3194bb[_0x86e3('0x68')]['id']}})[_0x86e3('0x23')](handleEntityNotFound(_0x232b50,null))[_0x86e3('0x23')](function(_0xf5f1a1){if(_0xf5f1a1){_0x3fcad6=_0xf5f1a1;_0x5af5dc[_0x86e3('0x49')]=_[_0x86e3('0x5c')](db['User'][_0x86e3('0x45')]);_0x5af5dc[_0x86e3('0x4b')]=_['keys'](_0x3194bb[_0x86e3('0x4b')]);_0x5af5dc[_0x86e3('0x4c')]=_[_0x86e3('0x4d')](_0x5af5dc[_0x86e3('0x49')],_0x5af5dc['query']);_0x27a0fe[_0x86e3('0x4e')]=_[_0x86e3('0x4d')](_0x5af5dc[_0x86e3('0x49')],qs[_0x86e3('0x4f')](_0x3194bb[_0x86e3('0x4b')][_0x86e3('0x4f')]));_0x27a0fe[_0x86e3('0x4e')]=_0x27a0fe[_0x86e3('0x4e')][_0x86e3('0x50')]?_0x27a0fe[_0x86e3('0x4e')]:_0x5af5dc[_0x86e3('0x49')];_0x27a0fe['order']=qs[_0x86e3('0x53')](_0x3194bb[_0x86e3('0x4b')][_0x86e3('0x53')]);_0x27a0fe['where']=qs[_0x86e3('0x4c')](_[_0x86e3('0x55')](_0x3194bb[_0x86e3('0x4b')],_0x5af5dc[_0x86e3('0x4c')]));if(_0x3194bb[_0x86e3('0x4b')][_0x86e3('0x70')]){_0x27a0fe[_0x86e3('0x54')]=_['merge'](_0x27a0fe[_0x86e3('0x54')],{'$or':_[_0x86e3('0x4a')](_0x27a0fe[_0x86e3('0x4e')],function(_0x2bccaa){var _0x41d3ab={};_0x41d3ab[_0x2bccaa]={'$like':'%'+_0x3194bb[_0x86e3('0x4b')][_0x86e3('0x70')]+'%'};return _0x41d3ab;})});}_0x27a0fe=_[_0x86e3('0x57')]({},_0x27a0fe,_0x3194bb[_0x86e3('0x5d')]);return _0x3fcad6[_0x86e3('0xe6')](_0x27a0fe);}})[_0x86e3('0x23')](function(_0x5bd9c3){if(_0x5bd9c3){_0x36f4a9=_0x5bd9c3[_0x86e3('0x50')];if(!_0x3194bb[_0x86e3('0x4b')][_0x86e3('0x51')]('nolimit')){_0x27a0fe[_0x86e3('0x35')]=qs[_0x86e3('0x35')](_0x3194bb[_0x86e3('0x4b')]['limit']);_0x27a0fe['offset']=qs[_0x86e3('0x33')](_0x3194bb['query'][_0x86e3('0x33')]);}return _0x3fcad6[_0x86e3('0xe6')](_0x27a0fe);}})[_0x86e3('0x23')](function(_0xfe0d03){if(_0xfe0d03){return _0xfe0d03?{'count':_0x36f4a9,'rows':_0xfe0d03}:null;}})[_0x86e3('0x23')](respondWithResult(_0x232b50,null))[_0x86e3('0x2e')](handleError(_0x232b50,null));}; \ No newline at end of file +var _0xe4c4=['info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','offset','undefined','count','set','Content-Range','json','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','name','send','index','Pause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','include','findAll','show','params','mandatoryDispositionPause','keys','length','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','getDispositions','findOne','nolimit','Disposition','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','From','messageId','from','sender','text','connectel','clicksend','message_id','Text','MessageUUID','results','originatingAddress','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','list','omit','defaults','contact','SmsInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','DESC','out','Messages','spread','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','clickatell','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','csc','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','request','then'];(function(_0xcbdb24,_0x230764){var _0x283ccb=function(_0x27c2a1){while(--_0x27c2a1){_0xcbdb24['push'](_0xcbdb24['shift']());}};_0x283ccb(++_0x230764);}(_0xe4c4,0xcc));var _0x4e4c=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0xe4c4[_0x2e3545];return _0xcf18f;};'use strict';var emlformat=require(_0x4e4c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4e4c('0x1'));var rp=require(_0x4e4c('0x2'));var moment=require(_0x4e4c('0x3'));var BPromise=require(_0x4e4c('0x4'));var Mustache=require(_0x4e4c('0x5'));var util=require(_0x4e4c('0x6'));var path=require(_0x4e4c('0x7'));var sox=require(_0x4e4c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e4c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4e4c('0xa'));var jsforce=require(_0x4e4c('0xb'));var deskjs=require(_0x4e4c('0xc'));var toCsv=require(_0x4e4c('0xd'));var querystring=require(_0x4e4c('0xe'));var Papa=require(_0x4e4c('0xf'));var Redis=require(_0x4e4c('0x10'));var authService=require(_0x4e4c('0x11'));var qs=require(_0x4e4c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e4c('0x13'));var logger=require(_0x4e4c('0x14'))('api');var utils=require(_0x4e4c('0x15'));var config=require(_0x4e4c('0x16'));var licenseUtil=require(_0x4e4c('0x17'));var db=require(_0x4e4c('0x18'))['db'];config[_0x4e4c('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e4c('0x19')]));require('./smsAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2a76d3,_0x231193,_0x46ad84,_0x1d9111){return new BPromise(function(_0x322056,_0x432dd8){var _0x4ce688=_0x1d9111||client;return _0x4ce688[_0x4e4c('0x1a')](_0x2a76d3,_0x46ad84)[_0x4e4c('0x1b')](function(_0xd23bb8){logger[_0x4e4c('0x1c')](_0x4e4c('0x1d'),_0x231193,_0x4e4c('0x1e'));logger[_0x4e4c('0x1f')](_0x4e4c('0x20'),_0x231193,_0x4e4c('0x1e'),JSON[_0x4e4c('0x21')](_0xd23bb8));if(_0xd23bb8[_0x4e4c('0x22')]){if(_0xd23bb8[_0x4e4c('0x22')][_0x4e4c('0x23')]===0x1f4){logger[_0x4e4c('0x22')]('SmsAccount,\x20%s,\x20%s',_0x231193,_0xd23bb8[_0x4e4c('0x22')][_0x4e4c('0x24')]);return _0x432dd8(_0xd23bb8[_0x4e4c('0x22')][_0x4e4c('0x24')]);}logger[_0x4e4c('0x22')](_0x4e4c('0x1d'),_0x231193,_0xd23bb8[_0x4e4c('0x22')][_0x4e4c('0x24')]);return _0x322056(_0xd23bb8['error'][_0x4e4c('0x24')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x231193,_0x4e4c('0x1e'));_0x322056(_0xd23bb8['result'][_0x4e4c('0x24')]);}})[_0x4e4c('0x25')](function(_0x547997){logger[_0x4e4c('0x22')](_0x4e4c('0x1d'),_0x231193,_0x547997);_0x432dd8(_0x547997);});});}function respondWithStatusCode(_0x3ec277,_0x173719){_0x173719=_0x173719||0xcc;return function(_0x38360d){if(_0x38360d){return _0x3ec277['sendStatus'](_0x173719);}return _0x3ec277[_0x4e4c('0x26')](_0x173719)['end']();};}function respondWithResult(_0x2c4170,_0x2fd9c7){_0x2fd9c7=_0x2fd9c7||0xc8;return function(_0x4f56d8){if(_0x4f56d8){return _0x2c4170[_0x4e4c('0x26')](_0x2fd9c7)['json'](_0x4f56d8);}};}function respondWithFilteredResult(_0x232f56,_0x2a49f3){return function(_0x396778){if(_0x396778){var _0x52fad3=typeof _0x2a49f3[_0x4e4c('0x27')]===_0x4e4c('0x28')&&typeof _0x2a49f3['limit']===_0x4e4c('0x28');var _0x26de2b=_0x396778[_0x4e4c('0x29')];var _0x4af64d=_0x52fad3?0x0:_0x2a49f3['offset'];var _0x20f33f=_0x52fad3?_0x396778[_0x4e4c('0x29')]:_0x2a49f3['offset']+_0x2a49f3['limit'];var _0xc30a2b;if(_0x20f33f>=_0x26de2b){_0x20f33f=_0x26de2b;_0xc30a2b=0xc8;}else{_0xc30a2b=0xce;}_0x232f56[_0x4e4c('0x26')](_0xc30a2b);return _0x232f56[_0x4e4c('0x2a')](_0x4e4c('0x2b'),_0x4af64d+'-'+_0x20f33f+'/'+_0x26de2b)[_0x4e4c('0x2c')](_0x396778);}return null;};}function patchUpdates(_0x42ef9b){return function(_0x11c9e4){try{jsonpatch[_0x4e4c('0x2d')](_0x11c9e4,_0x42ef9b,!![]);}catch(_0x3cf49c){return BPromise[_0x4e4c('0x2e')](_0x3cf49c);}return _0x11c9e4['save']();};}function saveUpdates(_0x465d3c,_0x1324cc){return function(_0x50aaaf){if(_0x50aaaf){return _0x50aaaf[_0x4e4c('0x2f')](_0x465d3c)[_0x4e4c('0x1b')](function(_0x375af3){return _0x375af3;});}return null;};}function removeEntity(_0x458093,_0xc8f00a){return function(_0x559802){if(_0x559802){return _0x559802[_0x4e4c('0x30')]()['then'](function(){var _0x5ed50f=_0x559802[_0x4e4c('0x31')]({'plain':!![]});var _0x5b247f=_0x4e4c('0x32');return db[_0x4e4c('0x33')][_0x4e4c('0x30')]({'where':{'type':_0x5b247f,'resourceId':_0x5ed50f['id']}})['then'](function(){return _0x559802;});})[_0x4e4c('0x1b')](function(){_0x458093['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d0dfc,_0x276d7c){return function(_0x4e0616){if(!_0x4e0616){_0x2d0dfc[_0x4e4c('0x34')](0x194);}return _0x4e0616;};}function handleError(_0x58bc7c,_0x16879d){_0x16879d=_0x16879d||0x1f4;return function(_0x33eb7e){logger[_0x4e4c('0x22')](_0x33eb7e['stack']);if(_0x33eb7e['name']){delete _0x33eb7e[_0x4e4c('0x35')];}_0x58bc7c[_0x4e4c('0x26')](_0x16879d)[_0x4e4c('0x36')](_0x33eb7e);};}exports[_0x4e4c('0x37')]=function(_0x9340ad,_0x26360b){var _0x58e009={'include':[{'model':db[_0x4e4c('0x38')],'as':'mandatoryDispositionPause'}]},_0x28187d={},_0x13d613={'count':0x0,'rows':[]};var _0x1abb0b=_['map'](db[_0x4e4c('0x39')][_0x4e4c('0x3a')],function(_0x112f2b){return{'name':_0x112f2b[_0x4e4c('0x3b')],'type':_0x112f2b[_0x4e4c('0x3c')][_0x4e4c('0x3d')]};});_0x28187d[_0x4e4c('0x3e')]=_[_0x4e4c('0x3f')](_0x1abb0b,'name');_0x28187d['query']=_['keys'](_0x9340ad[_0x4e4c('0x40')]);_0x28187d[_0x4e4c('0x41')]=_[_0x4e4c('0x42')](_0x28187d['model'],_0x28187d[_0x4e4c('0x40')]);_0x58e009[_0x4e4c('0x43')]=_[_0x4e4c('0x42')](_0x28187d['model'],qs['fields'](_0x9340ad[_0x4e4c('0x40')][_0x4e4c('0x44')]));_0x58e009['attributes']=_0x58e009[_0x4e4c('0x43')]['length']?_0x58e009[_0x4e4c('0x43')]:_0x28187d[_0x4e4c('0x3e')];if(!_0x9340ad[_0x4e4c('0x40')][_0x4e4c('0x45')]('nolimit')){_0x58e009[_0x4e4c('0x46')]=qs[_0x4e4c('0x46')](_0x9340ad[_0x4e4c('0x40')][_0x4e4c('0x46')]);_0x58e009['offset']=qs[_0x4e4c('0x27')](_0x9340ad[_0x4e4c('0x40')][_0x4e4c('0x27')]);}_0x58e009[_0x4e4c('0x47')]=qs[_0x4e4c('0x48')](_0x9340ad[_0x4e4c('0x40')]['sort']);_0x58e009[_0x4e4c('0x49')]=qs[_0x4e4c('0x41')](_[_0x4e4c('0x4a')](_0x9340ad[_0x4e4c('0x40')],_0x28187d[_0x4e4c('0x41')]),_0x1abb0b);if(_0x9340ad['query'][_0x4e4c('0x4b')]){_0x58e009['where']=_[_0x4e4c('0x4c')](_0x58e009[_0x4e4c('0x49')],{'$or':_[_0x4e4c('0x3f')](_0x1abb0b,function(_0x311995){if(_0x311995[_0x4e4c('0x3c')]!=='VIRTUAL'){var _0x4ee528={};_0x4ee528[_0x311995[_0x4e4c('0x35')]]={'$like':'%'+_0x9340ad[_0x4e4c('0x40')]['filter']+'%'};return _0x4ee528;}})});}_0x58e009=_[_0x4e4c('0x4c')]({},_0x58e009,_0x9340ad[_0x4e4c('0x4d')]);var _0x25bbf7={'where':_0x58e009['where']};return db[_0x4e4c('0x39')][_0x4e4c('0x29')](_0x25bbf7)[_0x4e4c('0x1b')](function(_0x4eb3a0){_0x13d613[_0x4e4c('0x29')]=_0x4eb3a0;if(_0x9340ad[_0x4e4c('0x40')]['includeAll']){_0x58e009[_0x4e4c('0x4e')]=[{'all':!![]}];}return db[_0x4e4c('0x39')][_0x4e4c('0x4f')](_0x58e009);})[_0x4e4c('0x1b')](function(_0x567da5){_0x13d613['rows']=_0x567da5;return _0x13d613;})[_0x4e4c('0x1b')](respondWithFilteredResult(_0x26360b,_0x58e009))[_0x4e4c('0x25')](handleError(_0x26360b,null));};exports[_0x4e4c('0x50')]=function(_0xad64f0,_0x2de4a0){var _0x199c02={'raw':![],'where':{'id':_0xad64f0[_0x4e4c('0x51')]['id']},'include':[{'model':db[_0x4e4c('0x38')],'as':_0x4e4c('0x52')}]},_0x23e6bc={};_0x23e6bc[_0x4e4c('0x3e')]=_[_0x4e4c('0x53')](db[_0x4e4c('0x39')][_0x4e4c('0x3a')]);_0x23e6bc[_0x4e4c('0x40')]=_[_0x4e4c('0x53')](_0xad64f0[_0x4e4c('0x40')]);_0x23e6bc['filters']=_[_0x4e4c('0x42')](_0x23e6bc[_0x4e4c('0x3e')],_0x23e6bc[_0x4e4c('0x40')]);_0x199c02[_0x4e4c('0x43')]=_[_0x4e4c('0x42')](_0x23e6bc['model'],qs[_0x4e4c('0x44')](_0xad64f0[_0x4e4c('0x40')][_0x4e4c('0x44')]));_0x199c02['attributes']=_0x199c02[_0x4e4c('0x43')][_0x4e4c('0x54')]?_0x199c02[_0x4e4c('0x43')]:_0x23e6bc[_0x4e4c('0x3e')];if(_0xad64f0['query'][_0x4e4c('0x55')]){_0x199c02[_0x4e4c('0x4e')]=[{'all':!![]}];}_0x199c02=_['merge']({},_0x199c02,_0xad64f0['options']);return db[_0x4e4c('0x39')][_0x4e4c('0x56')](_0x199c02)[_0x4e4c('0x1b')](handleEntityNotFound(_0x2de4a0,null))[_0x4e4c('0x1b')](respondWithResult(_0x2de4a0,null))[_0x4e4c('0x25')](handleError(_0x2de4a0,null));};exports['create']=function(_0x169eee,_0x1540f4){return db[_0x4e4c('0x39')][_0x4e4c('0x57')](_0x169eee['body'],{})['then'](function(_0x224153){var _0x35cbeb=_0x169eee[_0x4e4c('0x58')][_0x4e4c('0x31')]({'plain':!![]});if(!_0x35cbeb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35cbeb[_0x4e4c('0x59')]===_0x4e4c('0x58')){var _0x244ed8=_0x224153[_0x4e4c('0x31')]({'plain':!![]});var _0x5cf713=_0x4e4c('0x32');return db[_0x4e4c('0x5a')][_0x4e4c('0x56')]({'where':{'name':_0x5cf713,'userProfileId':_0x35cbeb[_0x4e4c('0x5b')]},'raw':!![]})[_0x4e4c('0x1b')](function(_0x3d3889){if(_0x3d3889&&_0x3d3889[_0x4e4c('0x5c')]===0x0){return db[_0x4e4c('0x33')][_0x4e4c('0x57')]({'name':_0x244ed8[_0x4e4c('0x35')],'resourceId':_0x244ed8['id'],'type':_0x3d3889[_0x4e4c('0x35')],'sectionId':_0x3d3889['id']},{})[_0x4e4c('0x1b')](function(){return _0x224153;});}else{return _0x224153;}})[_0x4e4c('0x25')](function(_0x4dfb1a){logger[_0x4e4c('0x22')](_0x4e4c('0x5d'),_0x4dfb1a);throw _0x4dfb1a;});}return _0x224153;})[_0x4e4c('0x1b')](respondWithResult(_0x1540f4,0xc9))[_0x4e4c('0x25')](handleError(_0x1540f4,null));};exports['update']=function(_0x1b812e,_0x3a5434){if(_0x1b812e[_0x4e4c('0x5e')]['id']){delete _0x1b812e[_0x4e4c('0x5e')]['id'];}return db[_0x4e4c('0x39')][_0x4e4c('0x56')]({'where':{'id':_0x1b812e[_0x4e4c('0x51')]['id']},'include':[{'model':db[_0x4e4c('0x38')],'as':_0x4e4c('0x52')}]})['then'](handleEntityNotFound(_0x3a5434,null))['then'](saveUpdates(_0x1b812e[_0x4e4c('0x5e')],null))['then'](respondWithResult(_0x3a5434,null))['catch'](handleError(_0x3a5434,null));};exports['destroy']=function(_0x4b04a4,_0x1f2a87){return db[_0x4e4c('0x39')]['find']({'where':{'id':_0x4b04a4['params']['id']}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x1f2a87,null))[_0x4e4c('0x1b')](removeEntity(_0x1f2a87,null))[_0x4e4c('0x25')](handleError(_0x1f2a87,null));};exports[_0x4e4c('0x5f')]=function(_0x599bd7,_0x14b311){return db[_0x4e4c('0x39')][_0x4e4c('0x5f')]()[_0x4e4c('0x1b')](respondWithResult(_0x14b311,null))[_0x4e4c('0x25')](handleError(_0x14b311,null));};exports[_0x4e4c('0x60')]=function(_0x8a36b4,_0x21f065,_0x2eb778){if(_0x8a36b4[_0x4e4c('0x5e')]['id']){delete _0x8a36b4[_0x4e4c('0x5e')]['id'];}return db[_0x4e4c('0x39')][_0x4e4c('0x56')]({'where':{'id':_0x8a36b4[_0x4e4c('0x51')]['id']}})['then'](handleEntityNotFound(_0x21f065,null))[_0x4e4c('0x1b')](function(_0x46953c){if(_0x46953c){_0x8a36b4[_0x4e4c('0x5e')][_0x4e4c('0x61')]=_0x46953c['id'];return db['Disposition'][_0x4e4c('0x57')](_0x8a36b4[_0x4e4c('0x5e')]);}})[_0x4e4c('0x1b')](respondWithResult(_0x21f065,null))[_0x4e4c('0x25')](handleError(_0x21f065,null));};exports[_0x4e4c('0x62')]=function(_0x2987b4,_0x4010bd,_0x505ea7){var _0x31c732={'raw':![],'where':{}};var _0x2f27f8={};var _0x205321={'count':0x0,'rows':[]};return db[_0x4e4c('0x39')][_0x4e4c('0x63')]({'where':{'id':_0x2987b4[_0x4e4c('0x51')]['id']}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x4010bd,null))[_0x4e4c('0x1b')](function(_0x43661e){if(_0x43661e){_0x2f27f8[_0x4e4c('0x3e')]=_[_0x4e4c('0x53')](db['Disposition']['rawAttributes']);_0x2f27f8[_0x4e4c('0x40')]=_[_0x4e4c('0x53')](_0x2987b4[_0x4e4c('0x40')]);_0x2f27f8[_0x4e4c('0x41')]=_[_0x4e4c('0x42')](_0x2f27f8[_0x4e4c('0x3e')],_0x2f27f8[_0x4e4c('0x40')]);_0x31c732['attributes']=_[_0x4e4c('0x42')](_0x2f27f8[_0x4e4c('0x3e')],qs[_0x4e4c('0x44')](_0x2987b4[_0x4e4c('0x40')][_0x4e4c('0x44')]));_0x31c732[_0x4e4c('0x43')]=_0x31c732[_0x4e4c('0x43')]['length']?_0x31c732[_0x4e4c('0x43')]:_0x2f27f8[_0x4e4c('0x3e')];if(!_0x2987b4[_0x4e4c('0x40')][_0x4e4c('0x45')](_0x4e4c('0x64'))){_0x31c732[_0x4e4c('0x46')]=qs[_0x4e4c('0x46')](_0x2987b4[_0x4e4c('0x40')][_0x4e4c('0x46')]);_0x31c732[_0x4e4c('0x27')]=qs['offset'](_0x2987b4[_0x4e4c('0x40')]['offset']);}_0x31c732[_0x4e4c('0x47')]=qs[_0x4e4c('0x48')](_0x2987b4['query']['sort']);_0x31c732[_0x4e4c('0x49')]=qs[_0x4e4c('0x41')](_[_0x4e4c('0x4a')](_0x2987b4[_0x4e4c('0x40')],_0x2f27f8['filters']));_0x31c732['where'][_0x4e4c('0x61')]=_0x43661e['id'];if(_0x2987b4['query']['filter']){_0x31c732['where']=_[_0x4e4c('0x4c')](_0x31c732[_0x4e4c('0x49')],{'$or':_['map'](_0x31c732['attributes'],function(_0x18dde0){var _0x1a04a2={};_0x1a04a2[_0x18dde0]={'$like':'%'+_0x2987b4[_0x4e4c('0x40')][_0x4e4c('0x4b')]+'%'};return _0x1a04a2;})});}_0x31c732=_[_0x4e4c('0x4c')]({},_0x31c732,_0x2987b4[_0x4e4c('0x4d')]);return db[_0x4e4c('0x65')][_0x4e4c('0x29')]({'where':_0x31c732[_0x4e4c('0x49')]})['then'](function(_0x484142){_0x205321[_0x4e4c('0x29')]=_0x484142;if(_0x2987b4['query'][_0x4e4c('0x55')]){_0x31c732[_0x4e4c('0x4e')]=[{'all':!![]}];}return db[_0x4e4c('0x65')]['findAll'](_0x31c732);})[_0x4e4c('0x1b')](function(_0x36a07b){_0x205321[_0x4e4c('0x66')]=_0x36a07b;return _0x205321;});}})[_0x4e4c('0x1b')](respondWithFilteredResult(_0x4010bd,_0x31c732))[_0x4e4c('0x25')](handleError(_0x4010bd,null));};exports[_0x4e4c('0x67')]=function(_0x286a3b,_0x2d48ee,_0x4cc7ce){return db['SmsAccount'][_0x4e4c('0x56')]({'where':{'id':_0x286a3b[_0x4e4c('0x51')]['id']}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x2d48ee,null))[_0x4e4c('0x1b')](function(_0x43e1c2){if(_0x43e1c2){return _0x43e1c2[_0x4e4c('0x67')](_0x286a3b[_0x4e4c('0x40')][_0x4e4c('0x68')]);}})['then'](respondWithStatusCode(_0x2d48ee,null))['catch'](handleError(_0x2d48ee,null));};exports['addAnswer']=function(_0x57d0a5,_0x1ed9b0,_0x573ed3){if(_0x57d0a5[_0x4e4c('0x5e')]['id']){delete _0x57d0a5[_0x4e4c('0x5e')]['id'];}return db[_0x4e4c('0x39')][_0x4e4c('0x56')]({'where':{'id':_0x57d0a5['params']['id']}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x1ed9b0,null))['then'](function(_0x1f3b2b){if(_0x1f3b2b){_0x57d0a5['body']['SmsAccountId']=_0x1f3b2b['id'];return db[_0x4e4c('0x69')][_0x4e4c('0x57')](_0x57d0a5[_0x4e4c('0x5e')]);}})[_0x4e4c('0x1b')](respondWithResult(_0x1ed9b0,null))[_0x4e4c('0x25')](handleError(_0x1ed9b0,null));};exports[_0x4e4c('0x6a')]=function(_0x5c4a23,_0x1e9716,_0x126751){var _0x37cdcc={'raw':![],'where':{}};var _0x1d0784={};var _0x7119d2={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4e4c('0x63')]({'where':{'id':_0x5c4a23[_0x4e4c('0x51')]['id']}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x1e9716,null))[_0x4e4c('0x1b')](function(_0x2c3dce){if(_0x2c3dce){_0x1d0784['model']=_['keys'](db[_0x4e4c('0x69')][_0x4e4c('0x3a')]);_0x1d0784[_0x4e4c('0x40')]=_[_0x4e4c('0x53')](_0x5c4a23[_0x4e4c('0x40')]);_0x1d0784[_0x4e4c('0x41')]=_[_0x4e4c('0x42')](_0x1d0784[_0x4e4c('0x3e')],_0x1d0784[_0x4e4c('0x40')]);_0x37cdcc[_0x4e4c('0x43')]=_[_0x4e4c('0x42')](_0x1d0784[_0x4e4c('0x3e')],qs['fields'](_0x5c4a23[_0x4e4c('0x40')][_0x4e4c('0x44')]));_0x37cdcc[_0x4e4c('0x43')]=_0x37cdcc[_0x4e4c('0x43')][_0x4e4c('0x54')]?_0x37cdcc[_0x4e4c('0x43')]:_0x1d0784[_0x4e4c('0x3e')];if(!_0x5c4a23['query'][_0x4e4c('0x45')](_0x4e4c('0x64'))){_0x37cdcc[_0x4e4c('0x46')]=qs['limit'](_0x5c4a23[_0x4e4c('0x40')]['limit']);_0x37cdcc[_0x4e4c('0x27')]=qs[_0x4e4c('0x27')](_0x5c4a23[_0x4e4c('0x40')]['offset']);}_0x37cdcc['order']=qs[_0x4e4c('0x48')](_0x5c4a23[_0x4e4c('0x40')][_0x4e4c('0x48')]);_0x37cdcc[_0x4e4c('0x49')]=qs[_0x4e4c('0x41')](_[_0x4e4c('0x4a')](_0x5c4a23['query'],_0x1d0784[_0x4e4c('0x41')]));_0x37cdcc[_0x4e4c('0x49')][_0x4e4c('0x61')]=_0x2c3dce['id'];if(_0x5c4a23[_0x4e4c('0x40')]['filter']){_0x37cdcc[_0x4e4c('0x49')]=_[_0x4e4c('0x4c')](_0x37cdcc[_0x4e4c('0x49')],{'$or':_['map'](_0x37cdcc[_0x4e4c('0x43')],function(_0x3d4b07){var _0x140d2f={};_0x140d2f[_0x3d4b07]={'$like':'%'+_0x5c4a23[_0x4e4c('0x40')][_0x4e4c('0x4b')]+'%'};return _0x140d2f;})});}_0x37cdcc=_['merge']({},_0x37cdcc,_0x5c4a23['options']);return db[_0x4e4c('0x69')][_0x4e4c('0x29')]({'where':_0x37cdcc['where']})['then'](function(_0x584ee9){_0x7119d2[_0x4e4c('0x29')]=_0x584ee9;if(_0x5c4a23[_0x4e4c('0x40')][_0x4e4c('0x55')]){_0x37cdcc[_0x4e4c('0x4e')]=[{'all':!![]}];}return db[_0x4e4c('0x69')]['findAll'](_0x37cdcc);})['then'](function(_0x10d3a7){_0x7119d2[_0x4e4c('0x66')]=_0x10d3a7;return _0x7119d2;});}})[_0x4e4c('0x1b')](respondWithFilteredResult(_0x1e9716,_0x37cdcc))[_0x4e4c('0x25')](handleError(_0x1e9716,null));};exports[_0x4e4c('0x6b')]=function(_0x1c088d,_0x58c82a,_0x4ac027){return db[_0x4e4c('0x39')][_0x4e4c('0x56')]({'where':{'id':_0x1c088d[_0x4e4c('0x51')]['id']}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x58c82a,null))[_0x4e4c('0x1b')](function(_0x51a227){if(_0x51a227){return _0x51a227[_0x4e4c('0x6b')](_0x1c088d['query'][_0x4e4c('0x68')]);}})[_0x4e4c('0x1b')](respondWithStatusCode(_0x58c82a,null))[_0x4e4c('0x25')](handleError(_0x58c82a,null));};exports[_0x4e4c('0x6c')]=function(_0x17bef6,_0x3bdb1e,_0x240fa5){var _0x4b510a={'channel':_0x4e4c('0x6d')};var _0x28db71=[];var _0x3525d8=[];var _0x20b0c7={};return db[_0x4e4c('0x39')][_0x4e4c('0x56')]({'where':{'id':_0x17bef6[_0x4e4c('0x51')]['id']},'include':[{'model':db[_0x4e4c('0x6e')],'as':'Applications'}]})[_0x4e4c('0x1b')](handleEntityNotFound(_0x3bdb1e,null))[_0x4e4c('0x1b')](function(_0x4ed204){_0x4b510a[_0x4e4c('0x6f')]=_0x4ed204;_0x4b510a[_0x4e4c('0x70')]=_[_0x4e4c('0x71')](_0x4ed204[_0x4e4c('0x72')],[_0x4e4c('0x73')],[_0x4e4c('0x74')]);if(_0x4b510a['account'][_0x4e4c('0x72')]){delete _0x4b510a[_0x4e4c('0x6f')][_0x4e4c('0x72')];}return db['CmContact'][_0x4e4c('0x5f')]();})['then'](function(_0x143b6d){if(!_0x143b6d){throw new db[(_0x4e4c('0x75'))][(_0x4e4c('0x76'))](_0x4e4c('0x77'));}_0x28db71=_['difference'](_[_0x4e4c('0x53')](_0x143b6d),[_0x4e4c('0x78'),_0x4e4c('0x79')]);_0x3525d8=_[_0x4e4c('0x7a')](_[_0x4e4c('0x53')](_0x143b6d),[_0x4e4c('0x78'),_0x4e4c('0x79'),_0x4e4c('0x7b'),'ListId']);_0x4b510a['body']={'mapKey':_0x4e4c('0x7c')};if(_0x4b510a[_0x4e4c('0x6f')][_0x4e4c('0x3c')]){switch(_0x4b510a[_0x4e4c('0x6f')]['type']){case _0x4e4c('0x7d'):_0x4b510a['body']['from']=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x7e')];_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x5e')]=_0x17bef6[_0x4e4c('0x5e')]['Body'];_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x7f')]=_0x17bef6[_0x4e4c('0x5e')]['MessageSid'];break;case'skebby':_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x80')]='+'+_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x81')];_0x4b510a['body'][_0x4e4c('0x5e')]=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x82')];break;case _0x4e4c('0x83'):_0x4b510a[_0x4e4c('0x5e')]['from']=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x80')];_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x5e')]=_0x17bef6[_0x4e4c('0x5e')]['message'];break;case _0x4e4c('0x84'):_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x80')]=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x80')];_0x4b510a[_0x4e4c('0x5e')]['body']=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x5e')];_0x4b510a['body'][_0x4e4c('0x7f')]=_0x17bef6['body'][_0x4e4c('0x85')];break;case'plivo':_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x80')]=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x7e')];_0x4b510a[_0x4e4c('0x5e')]['body']=_0x17bef6['body'][_0x4e4c('0x86')];_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x7f')]=_0x17bef6['body'][_0x4e4c('0x87')];break;case'infobip':_0x4b510a['body'][_0x4e4c('0x80')]='+'+_0x17bef6['body']['results'][0x0][_0x4e4c('0x80')];_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x5e')]=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x88')][0x0][_0x4e4c('0x82')];_0x4b510a[_0x4e4c('0x5e')]['messageId']=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x88')][0x0][_0x4e4c('0x7f')];break;case'csc':_0x4b510a[_0x4e4c('0x5e')]['from']=_0x17bef6['body'][_0x4e4c('0x89')];_0x4b510a['body'][_0x4e4c('0x5e')]=_0x17bef6['body']['segmentedMessage'][_0x4e4c('0x24')];break;case'clickatell':_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x80')]=_0x17bef6['body'][_0x4e4c('0x8a')];_0x4b510a['body']['body']=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x82')];_0x4b510a['body'][_0x4e4c('0x7f')]=_0x17bef6[_0x4e4c('0x5e')]['replyMessageId'];break;case _0x4e4c('0x8b'):_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x7f')]=_0x17bef6['body'][0x0][_0x4e4c('0x24')]['id'];_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x80')]=_0x17bef6[_0x4e4c('0x5e')][0x0]['message'][_0x4e4c('0x80')];_0x4b510a[_0x4e4c('0x5e')]['body']=_0x17bef6[_0x4e4c('0x5e')][0x0][_0x4e4c('0x24')][_0x4e4c('0x82')];break;case _0x4e4c('0x8c'):_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x80')]=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x80')];_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x5e')]=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x24')];_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x7f')]=_0x17bef6[_0x4e4c('0x5e')][_0x4e4c('0x8d')];break;}}if(_0x4b510a[_0x4e4c('0x5e')]['id']){delete _0x4b510a[_0x4e4c('0x5e')]['id'];}if(_[_0x4e4c('0x8e')](_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x80')])){throw new db[(_0x4e4c('0x75'))]['ValidationError'](_0x4e4c('0x8f'));}if(_[_0x4e4c('0x8e')](_0x4b510a[_0x4e4c('0x5e')]['body'])||_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x5e')]===''){throw new db[(_0x4e4c('0x75'))][(_0x4e4c('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4e4c('0x8e')](_0x4b510a['body'][_0x4e4c('0x90')])){throw new db['Sequelize'][(_0x4e4c('0x76'))](_0x4e4c('0x91')+_0x3525d8);}if(!_[_0x4e4c('0x92')](_0x3525d8,_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x90')])){throw new db[(_0x4e4c('0x75'))][(_0x4e4c('0x76'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3525d8);}_0x20b0c7[_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x90')]]=_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x80')];return db[_0x4e4c('0x93')][_0x4e4c('0x56')]({'where':{'id':_0x4b510a[_0x4e4c('0x6f')]['ListId']},'include':[{'model':db[_0x4e4c('0x94')],'as':_0x4e4c('0x95'),'where':_0x20b0c7,'limit':0x1,'order':[[_0x4e4c('0x79'),'DESC']]}]});})[_0x4e4c('0x1b')](handleEntityNotFound(_0x3bdb1e,null))['then'](function(_0x5af852){if(_0x5af852){_0x4b510a[_0x4e4c('0x96')]=_[_0x4e4c('0x97')](_0x5af852,[_0x4e4c('0x95')]);if(_0x5af852['Contacts'][_0x4e4c('0x54')]){return _0x5af852[_0x4e4c('0x95')][0x0];}var _0x463553=_[_0x4e4c('0x98')](_0x4b510a[_0x4e4c('0x5e')],{'firstName':_0x4b510a['body'][_0x4e4c('0x80')],'ListId':_0x5af852['id']});_0x463553[_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x90')]]=_0x4b510a['body'][_0x4e4c('0x80')];return db[_0x4e4c('0x94')][_0x4e4c('0x57')](_0x463553,{'fields':_0x28db71,'raw':!![]});}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x3bdb1e,null))[_0x4e4c('0x1b')](function(_0x21222d){if(_0x21222d){_0x4b510a[_0x4e4c('0x99')]=_0x21222d;var _0x5a51b4={'ContactId':_0x21222d['id'],'phone':_0x4b510a['body']['from'],'SmsAccountId':_0x17bef6[_0x4e4c('0x51')]['id']};var _0x498c33={'ContactId':_0x21222d['id'],'SmsAccountId':_0x17bef6[_0x4e4c('0x51')]['id'],'closed':![]};return db[_0x4e4c('0x9a')][_0x4e4c('0x56')]({'where':_0x498c33})[_0x4e4c('0x1b')](function(_0x21401e){if(_0x21401e){return[_0x21401e,![]];}return db[_0x4e4c('0x9a')]['create'](_0x5a51b4)['then'](function(_0x342346){return[_0x342346,!![]];});});}})['spread'](function(_0xe3ad28,_0x263389){_0x4b510a[_0x4e4c('0x9b')]=_0xe3ad28[_0x4e4c('0x31')]({'plain':!![]});_0x4b510a[_0x4e4c('0x9b')]['created']=![];if(_0x263389){if(_0x4b510a[_0x4e4c('0x6f')][_0x4e4c('0x9c')]){_0x4b510a[_0x4e4c('0x70')]['push']({'id':0x0,'priority':_0x4b510a[_0x4e4c('0x70')][_0x4e4c('0x54')]+0x1,'app':_0x4e4c('0x9d'),'appdata':_0x4e4c('0x9e'),'interval':_0x4e4c('0x9f')});}_0x4b510a[_0x4e4c('0x9b')]['created']=!![];}return db[_0x4e4c('0xa0')][_0x4e4c('0x57')]({'phone':_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x80')],'messageId':_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0x7f')],'body':_0x4b510a['body'][_0x4e4c('0x5e')],'SmsAccountId':_0x17bef6['params']['id'],'SmsInteractionId':_0xe3ad28['id'],'direction':'in','ContactId':_0xe3ad28[_0x4e4c('0xa1')],'AttachmentId':_0x4b510a[_0x4e4c('0x5e')][_0x4e4c('0xa2')]});})[_0x4e4c('0x1b')](function(_0x3aecfa){_0x4b510a['message']=_0x3aecfa;if(!_0x4b510a['interaction']['UserId'])return;return db[_0x4e4c('0xa3')]['find']({'attributes':['id','name'],'where':{'id':_0x4b510a[_0x4e4c('0x9b')][_0x4e4c('0xa4')]}});})['then'](function(_0x222db5){if(_0x222db5){_0x4b510a[_0x4e4c('0x70')][_0x4e4c('0xa5')]({'id':0x0,'priority':0x0,'app':_0x4e4c('0xa6'),'appdata':_0x222db5[_0x4e4c('0x35')]+','+(_0x4b510a[_0x4e4c('0x6f')][_0x4e4c('0xa7')]||0xa),'interval':'*,*,*,*'});}if(!_0x4b510a[_0x4e4c('0x9b')][_0x4e4c('0xa8')])return;return db['SmsQueue']['find']({'attributes':['id',_0x4e4c('0x35')],'where':{'id':_0x4b510a[_0x4e4c('0x9b')][_0x4e4c('0xa8')]}});})['then'](function(_0x209975){if(_0x209975){_0x4b510a['applications'][_0x4e4c('0xa5')]({'id':0x0,'priority':0x1,'app':_0x4e4c('0xa9'),'appdata':_0x209975['name']+','+(_0x4b510a[_0x4e4c('0x6f')][_0x4e4c('0xaa')]||0x12c),'interval':_0x4e4c('0x9f')});}return respondWithRpcPromise(_0x4e4c('0xab'),'startRouting',_0x4b510a);})[_0x4e4c('0x1b')](function(_0x59edd0){if(_0x59edd0){var _0x2e3716=0xc8;var _0x13ba35=_0x4e4c('0xac');logger[_0x4e4c('0x1c')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x13ba35,_0x2e3716,'entity\x20found');logger[_0x4e4c('0x1f')](_0x4e4c('0xad'),_0x13ba35,_0x2e3716,_0x4e4c('0xae'),JSON[_0x4e4c('0x21')](_0x59edd0));if(_0x4b510a['account'][_0x4e4c('0x3c')]===_0x4e4c('0x7d')){return _0x3bdb1e[_0x4e4c('0x26')](_0x2e3716)[_0x4e4c('0x2a')](_0x4e4c('0xaf'),_0x4e4c('0xb0'))[_0x4e4c('0x36')](_0x4e4c('0xb1'));}else{return _0x3bdb1e[_0x4e4c('0x26')](_0x2e3716)['json'](_0x59edd0);}}})[_0x4e4c('0x25')](handleError(_0x3bdb1e,null));};exports[_0x4e4c('0xb2')]=function(_0x2929bc,_0x52c78f){var _0x33c538=_0x2929bc[_0x4e4c('0x51')]['id'];var _0x22bf39=_0x2929bc[_0x4e4c('0x5e')];var _0x4b2ca4=0xc8;var _0xb2e9f4=null;return db[_0x4e4c('0xb3')][_0x4e4c('0xb4')]({'isolationLevel':db['sequelize'][_0x4e4c('0xb5')][_0x4e4c('0xb6')]['READ_COMMITTED']},function(_0x281e83){return db[_0x4e4c('0x39')][_0x4e4c('0x63')]({'where':{'id':_0x33c538},'transaction':_0x281e83})[_0x4e4c('0x1b')](function(_0x1f05e4){if(_0x1f05e4){return db['SmsApplication'][_0x4e4c('0x30')]({'where':{'SmsAccountId':_0x33c538},'transaction':_0x281e83})[_0x4e4c('0x1b')](function(){var _0x55e15f=_[_0x4e4c('0x3f')](_0x22bf39,function(_0x349026){_0x349026[_0x4e4c('0x61')]=_0x33c538;return _0x349026;});return db[_0x4e4c('0x6e')][_0x4e4c('0xb7')](_0x55e15f,{'transaction':_0x281e83});});}else{_0x4b2ca4=0x194;_0xb2e9f4=[];}});})[_0x4e4c('0x1b')](function(){if(_0x4b2ca4!==0x194){return db[_0x4e4c('0x6e')][_0x4e4c('0xb8')]({'where':{'SmsAccountId':_0x33c538},'order':_0x4e4c('0x73')})['then'](function(_0x18c1c5){_0xb2e9f4=_0x18c1c5;});}})[_0x4e4c('0x25')](function(_0x5eade1){_0x4b2ca4=0x1f4;logger['error'](_0x5eade1[_0x4e4c('0xb9')]);if(_0x5eade1[_0x4e4c('0x35')]){delete _0x5eade1[_0x4e4c('0x35')];}_0xb2e9f4=_0x5eade1;})[_0x4e4c('0xba')](function(){if(_0xb2e9f4===null){_0x52c78f[_0x4e4c('0x34')](_0x4b2ca4);}else{if(_0x4b2ca4===0x1f4){_0x52c78f[_0x4e4c('0x26')](_0x4b2ca4)['send'](_0xb2e9f4);}else{_0x52c78f['status'](_0x4b2ca4)[_0x4e4c('0x2c')](_0xb2e9f4);}}});};exports[_0x4e4c('0xbb')]=function(_0x6de39a,_0x390473,_0x4216ff){var _0x5a7860={};var _0x456f39={};var _0x6b3711;var _0x3ca65e;return db['SmsAccount'][_0x4e4c('0x63')]({'where':{'id':_0x6de39a[_0x4e4c('0x51')]['id']}})['then'](handleEntityNotFound(_0x390473,null))[_0x4e4c('0x1b')](function(_0x5b18c6){if(_0x5b18c6){_0x6b3711=_0x5b18c6;_0x456f39[_0x4e4c('0x3e')]=_[_0x4e4c('0x53')](db[_0x4e4c('0x6e')]['rawAttributes']);_0x456f39['query']=_[_0x4e4c('0x53')](_0x6de39a[_0x4e4c('0x40')]);_0x456f39[_0x4e4c('0x41')]=_[_0x4e4c('0x42')](_0x456f39[_0x4e4c('0x3e')],_0x456f39[_0x4e4c('0x40')]);_0x5a7860[_0x4e4c('0x43')]=_[_0x4e4c('0x42')](_0x456f39['model'],qs[_0x4e4c('0x44')](_0x6de39a[_0x4e4c('0x40')][_0x4e4c('0x44')]));_0x5a7860[_0x4e4c('0x43')]=_0x5a7860[_0x4e4c('0x43')][_0x4e4c('0x54')]?_0x5a7860[_0x4e4c('0x43')]:_0x456f39['model'];_0x5a7860['order']=qs['sort'](_0x6de39a[_0x4e4c('0x40')]['sort']);_0x5a7860[_0x4e4c('0x49')]=qs['filters'](_[_0x4e4c('0x4a')](_0x6de39a[_0x4e4c('0x40')],_0x456f39[_0x4e4c('0x41')]));if(_0x6de39a[_0x4e4c('0x40')][_0x4e4c('0x4b')]){_0x5a7860[_0x4e4c('0x49')]=_[_0x4e4c('0x4c')](_0x5a7860['where'],{'$or':_[_0x4e4c('0x3f')](_0x5a7860[_0x4e4c('0x43')],function(_0x36e382){var _0x2edff0={};_0x2edff0[_0x36e382]={'$like':'%'+_0x6de39a['query']['filter']+'%'};return _0x2edff0;})});}_0x5a7860=_[_0x4e4c('0x4c')]({},_0x5a7860,_0x6de39a[_0x4e4c('0x4d')]);return _0x6b3711[_0x4e4c('0xbb')](_0x5a7860);}})['then'](function(_0x2167b8){if(_0x2167b8){_0x3ca65e=_0x2167b8['length'];if(!_0x6de39a[_0x4e4c('0x40')][_0x4e4c('0x45')](_0x4e4c('0x64'))){_0x5a7860[_0x4e4c('0x46')]=qs[_0x4e4c('0x46')](_0x6de39a[_0x4e4c('0x40')]['limit']);_0x5a7860[_0x4e4c('0x27')]=qs[_0x4e4c('0x27')](_0x6de39a[_0x4e4c('0x40')][_0x4e4c('0x27')]);}return _0x6b3711['getApplications'](_0x5a7860);}})[_0x4e4c('0x1b')](function(_0x1cb782){if(_0x1cb782){return _0x1cb782?{'count':_0x3ca65e,'rows':_0x1cb782}:null;}})[_0x4e4c('0x1b')](respondWithResult(_0x390473,null))['catch'](handleError(_0x390473,null));};exports['getInteractions']=function(_0x5e20fd,_0x93c2a,_0x362bad){var _0x1d122f={'raw':![],'where':{}};var _0x109212={};var _0x160f03={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4e4c('0x63')]({'where':{'id':_0x5e20fd[_0x4e4c('0x51')]['id']}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x93c2a,null))[_0x4e4c('0x1b')](function(_0x55651c){if(_0x55651c){_0x109212[_0x4e4c('0x3e')]=_[_0x4e4c('0x53')](db[_0x4e4c('0x9a')]['rawAttributes']);_0x109212[_0x4e4c('0x40')]=_['keys'](_0x5e20fd[_0x4e4c('0x40')]);_0x109212[_0x4e4c('0x41')]=_['intersection'](_0x109212[_0x4e4c('0x3e')],_0x109212[_0x4e4c('0x40')]);_0x1d122f[_0x4e4c('0x43')]=_[_0x4e4c('0x42')](_0x109212[_0x4e4c('0x3e')],qs[_0x4e4c('0x44')](_0x5e20fd[_0x4e4c('0x40')][_0x4e4c('0x44')]));_0x1d122f[_0x4e4c('0x43')]=_0x1d122f[_0x4e4c('0x43')][_0x4e4c('0x54')]?_0x1d122f[_0x4e4c('0x43')]:_0x109212['model'];if(!_0x5e20fd[_0x4e4c('0x40')][_0x4e4c('0x45')](_0x4e4c('0x64'))){_0x1d122f[_0x4e4c('0x46')]=qs[_0x4e4c('0x46')](_0x5e20fd['query'][_0x4e4c('0x46')]);_0x1d122f[_0x4e4c('0x27')]=qs['offset'](_0x5e20fd['query'][_0x4e4c('0x27')]);}_0x1d122f[_0x4e4c('0x47')]=qs[_0x4e4c('0x48')](_0x5e20fd[_0x4e4c('0x40')][_0x4e4c('0x48')]);_0x1d122f[_0x4e4c('0x49')]=qs[_0x4e4c('0x41')](_[_0x4e4c('0x4a')](_0x5e20fd['query'],_0x109212['filters']));_0x1d122f[_0x4e4c('0x49')][_0x4e4c('0x61')]=_0x55651c['id'];if(_0x5e20fd[_0x4e4c('0x40')][_0x4e4c('0x4b')]){_0x1d122f['where']=_[_0x4e4c('0x4c')](_0x1d122f[_0x4e4c('0x49')],{'$or':_['map'](_0x1d122f['attributes'],function(_0x327294){var _0x51ff4c={};_0x51ff4c[_0x327294]={'$like':'%'+_0x5e20fd[_0x4e4c('0x40')][_0x4e4c('0x4b')]+'%'};return _0x51ff4c;})});}_0x1d122f=_[_0x4e4c('0x4c')]({},_0x1d122f,_0x5e20fd[_0x4e4c('0x4d')]);return db[_0x4e4c('0x9a')][_0x4e4c('0x29')]({'where':_0x1d122f[_0x4e4c('0x49')]})[_0x4e4c('0x1b')](function(_0x2e5c04){_0x160f03[_0x4e4c('0x29')]=_0x2e5c04;if(_0x5e20fd[_0x4e4c('0x40')][_0x4e4c('0x55')]){_0x1d122f['include']=[{'model':db['CmContact'],'as':_0x4e4c('0xbc'),'required':![]},{'model':db[_0x4e4c('0xa3')],'as':_0x4e4c('0xbd'),'attributes':['name',_0x4e4c('0xbe'),_0x4e4c('0xbf')],'required':![]},{'model':db[_0x4e4c('0xc0')],'as':_0x4e4c('0xc1'),'attributes':['id',_0x4e4c('0x35'),_0x4e4c('0xc2')],'where':_0x5e20fd['query'][_0x4e4c('0xc3')]?{'id':_0x5e20fd[_0x4e4c('0x40')][_0x4e4c('0xc3')]}:undefined,'required':_0x5e20fd[_0x4e4c('0x40')][_0x4e4c('0xc3')]?!![]:![]}];}return db['SmsInteraction'][_0x4e4c('0x4f')](_0x1d122f);})[_0x4e4c('0x1b')](function(_0x288144){_0x160f03[_0x4e4c('0x66')]=_0x288144;return _0x160f03;});}})['then'](respondWithFilteredResult(_0x93c2a,_0x1d122f))['catch'](handleError(_0x93c2a,null));};exports[_0x4e4c('0x36')]=function(_0x2839e2,_0x46c8c1,_0x3a40fe){var _0x193d84,_0x47852f,_0x3aaadf;if(_[_0x4e4c('0x8e')](_0x2839e2[_0x4e4c('0x5e')]['body'])||_0x2839e2['body'][_0x4e4c('0x5e')]===''){throw new db['Sequelize'][(_0x4e4c('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4e4c('0x8e')](_0x2839e2[_0x4e4c('0x5e')]['to'])){throw new db[(_0x4e4c('0x75'))]['ValidationError'](_0x4e4c('0xc4'));}_0x193d84=_0x2839e2['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x2839e2[_0x4e4c('0x51')]['id']},'include':[{'model':db[_0x4e4c('0x93')],'as':_0x4e4c('0xc5'),'include':[{'model':db[_0x4e4c('0x94')],'as':_0x4e4c('0x95'),'where':{'mobile':_0x193d84},'limit':0x1,'order':[[_0x4e4c('0x79'),_0x4e4c('0xc6')]]}]}]})[_0x4e4c('0x1b')](handleEntityNotFound(_0x46c8c1,null))[_0x4e4c('0x1b')](function(_0x56887e){if(_0x56887e&&_0x56887e[_0x4e4c('0xc5')]){_0x47852f=_0x56887e[_0x4e4c('0x31')]({'plain':!![]});if(_0x47852f['List']&&_0x47852f[_0x4e4c('0xc5')][_0x4e4c('0x95')]['length']){return _0x47852f[_0x4e4c('0xc5')][_0x4e4c('0x95')][0x0];}return db[_0x4e4c('0x94')][_0x4e4c('0x57')](_['defaults'](_0x2839e2[_0x4e4c('0x5e')],{'firstName':_0x193d84,'mobile':_0x193d84,'phone':_0x193d84,'ListId':_0x47852f['ListId']}));}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x46c8c1,null))[_0x4e4c('0x1b')](function(_0x2fcc51){if(_0x2fcc51){_0x3aaadf=_0x2fcc51;return db[_0x4e4c('0x9a')][_0x4e4c('0x56')]({'where':{'ContactId':_0x3aaadf['id'],'closed':![],'SmsAccountId':_0x47852f['id']}})['then'](function(_0x377917){if(_0x377917){return[_0x377917,![]];}return db[_0x4e4c('0x9a')]['create']({'UserId':_0x2839e2[_0x4e4c('0x58')]['id'],'ContactId':_0x3aaadf['id'],'SmsAccountId':_0x47852f['id'],'phone':_0x193d84,'firstMsgDirection':_0x4e4c('0xc7'),'Messages':[_[_0x4e4c('0x4c')](_0x2839e2[_0x4e4c('0x5e')],{'read':![],'body':_0x2839e2[_0x4e4c('0x5e')]['body'],'phone':_0x193d84,'SmsAccountId':_0x47852f['id'],'UserId':_0x2839e2[_0x4e4c('0x58')]['id'],'ContactId':_0x3aaadf['id']})]},{'include':[{'model':db[_0x4e4c('0xa0')],'as':_0x4e4c('0xc8')}]})[_0x4e4c('0x1b')](function(_0x58db21){return[_0x58db21,!![]];});});}})[_0x4e4c('0xc9')](function(_0x3cc6b5,_0x52e7b1){if(_0x52e7b1){return _0x3cc6b5;}return db['SmsMessage'][_0x4e4c('0x57')](_['merge'](_0x2839e2[_0x4e4c('0x5e')],{'read':![],'body':_0x2839e2['body']['body'],'phone':_0x193d84,'SmsAccountId':_0x47852f['id'],'SmsInteractionId':_0x3cc6b5['id'],'UserId':_0x2839e2[_0x4e4c('0x58')]['id'],'ContactId':_0x3aaadf['id']}))[_0x4e4c('0x1b')](function(_0x345d4e){_0x3cc6b5[_0x4e4c('0xca')][_0x4e4c('0xc8')]=[];_0x3cc6b5[_0x4e4c('0xca')][_0x4e4c('0xc8')][_0x4e4c('0xcb')](_0x345d4e[_0x4e4c('0xca')]);return _0x3cc6b5;});})['then'](respondWithResult(_0x46c8c1,null))['catch'](handleError(_0x46c8c1,null));};exports[_0x4e4c('0x26')]=function(_0x5af961,_0x579a98,_0x4faa3e){if(_0x5af961[_0x4e4c('0x5e')]['id']){delete _0x5af961[_0x4e4c('0x5e')]['id'];}var _0x2039ec,_0x32ddef,_0x1f3edb;return db[_0x4e4c('0x39')][_0x4e4c('0x56')]({'where':{'id':_0x5af961[_0x4e4c('0x51')]['id']}})['then'](handleEntityNotFound(_0x579a98,null))[_0x4e4c('0x1b')](function(_0x3ff374){if(_0x3ff374){_0x1f3edb=_0x3ff374;logger[_0x4e4c('0x1f')](_0x4e4c('0x20'),_0x4e4c('0x26'),_0x4e4c('0xcc'),_0x3ff374['type'],util[_0x4e4c('0xcd')](_0x5af961[_0x4e4c('0x5e')],{'showHidden':![],'depth':null}));switch(_0x3ff374[_0x4e4c('0x3c')]){case _0x4e4c('0xce'):if(_0x5af961['body'][_0x4e4c('0xcf')]&&_0x5af961['body'][_0x4e4c('0x26')]){_0x32ddef=_0x5af961['body'][_0x4e4c('0x26')];return db[_0x4e4c('0xa0')][_0x4e4c('0x56')]({'where':{'messageId':_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0xcf')]}});}break;case _0x4e4c('0x83'):if(_0x5af961['body'][_0x4e4c('0xd0')]&&_0x5af961['body']['statusInt']){_0x32ddef=_0x5af961['body'][_0x4e4c('0xd1')];return db[_0x4e4c('0xa0')]['find']({'where':{'messageId':_0x5af961[_0x4e4c('0x5e')]['requestid']}});}break;case _0x4e4c('0x84'):if(_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0x85')]&&_0x5af961[_0x4e4c('0x5e')]['status_code']){_0x32ddef=_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0xd2')];return db['SmsMessage'][_0x4e4c('0x56')]({'where':{'messageId':_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0x85')]}});}break;case _0x4e4c('0xd3'):var _0x101c34=_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0x88')][0x0];if(_0x101c34[_0x4e4c('0x7f')]&&_0x101c34[_0x4e4c('0x26')][_0x4e4c('0xd4')]===_0x4e4c('0xd5')){_0x32ddef=_0x101c34[_0x4e4c('0x26')]['groupName'];return db[_0x4e4c('0xa0')][_0x4e4c('0x56')]({'where':{'messageId':_0x101c34[_0x4e4c('0x7f')]}});}break;case _0x4e4c('0xd6'):if(_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0x7f')]&&_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0x26')]){_0x32ddef=_0x5af961['body']['status'];return db[_0x4e4c('0xa0')][_0x4e4c('0x56')]({'where':{'messageId':_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0x7f')]}});}break;case'bandwidth':if(_0x5af961[_0x4e4c('0x5e')][0x0][_0x4e4c('0x24')]['id']){_0x32ddef=_0x5af961[_0x4e4c('0x5e')][0x0][_0x4e4c('0x3c')];return db['SmsMessage']['find']({'where':{'messageId':_0x5af961['body'][0x0][_0x4e4c('0x24')]['id']}});}break;case'intelepeer':if(_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0xd7')]&&_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0x26')]){_0x32ddef=_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0x26')];return db['SmsMessage'][_0x4e4c('0x56')]({'where':{'messageId':_0x5af961['body'][_0x4e4c('0xd7')]}});}break;}}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x579a98,null))[_0x4e4c('0x1b')](function(_0x57f8d8){if(_0x57f8d8){_0x2039ec=_0x57f8d8;switch(_0x1f3edb['type']){case _0x4e4c('0xce'):if(_0x32ddef==='DELIVERED'){return _0x2039ec[_0x4e4c('0x2f')]({'read':!![]});}else{logger[_0x4e4c('0x22')](_0x4e4c('0x20'),_0x4e4c('0x26'),'skebby',util[_0x4e4c('0xcd')](_0x5af961['body'],{'showHidden':![],'depth':null}));}break;case _0x4e4c('0x83'):if(_0x32ddef==='1'){return _0x2039ec[_0x4e4c('0x2f')]({'read':!![]});}else{logger[_0x4e4c('0x22')](_0x4e4c('0x20'),_0x4e4c('0x26'),_0x4e4c('0xce'),util['inspect'](_0x5af961[_0x4e4c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x4e4c('0x84'):if(!_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0xd8')]&&_0x32ddef>=0xc8&&_0x32ddef<=0xce){return _0x2039ec[_0x4e4c('0x2f')]({'read':!![]});}else{logger[_0x4e4c('0x22')](_0x4e4c('0x20'),_0x4e4c('0x26'),_0x4e4c('0x84'),util['inspect'](_0x5af961[_0x4e4c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x4e4c('0xd3'):var _0x5b4811=_0x5af961[_0x4e4c('0x5e')][_0x4e4c('0x88')][0x0];if(_0x5b4811['status']['groupName']===_0x4e4c('0xd5')){return _0x2039ec[_0x4e4c('0x2f')]({'read':!![]});}else{logger[_0x4e4c('0x22')](_0x4e4c('0x20'),_0x4e4c('0x26'),'infobip',util[_0x4e4c('0xcd')](_0x5af961[_0x4e4c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x4e4c('0xd6'):if(_0x32ddef==_0x4e4c('0xd9')||_0x32ddef==_0x4e4c('0xda')){return _0x2039ec[_0x4e4c('0x2f')]({'read':!![]});}else{logger['error'](_0x4e4c('0x20'),_0x4e4c('0x26'),_0x4e4c('0xd6'),util[_0x4e4c('0xcd')](_0x5af961[_0x4e4c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x4e4c('0x8b'):if(_0x32ddef==_0x4e4c('0xdb')){return _0x2039ec[_0x4e4c('0x2f')]({'read':!![]});}else{logger[_0x4e4c('0x22')](_0x4e4c('0x20'),_0x4e4c('0x26'),_0x4e4c('0x8b'),util[_0x4e4c('0xcd')](_0x5af961[_0x4e4c('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x4e4c('0x8c'):if(_0x32ddef===_0x4e4c('0xdc')||_0x32ddef===_0x4e4c('0xdd')){return _0x2039ec[_0x4e4c('0x2f')]({'read':!![]});}else{logger[_0x4e4c('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4e4c('0x26'),'intelepeer',util['inspect'](_0x5af961['body'],{'showHidden':![],'depth':null}));}break;}return _0x2039ec;}})[_0x4e4c('0x1b')](respondWithResult(_0x579a98,null))['catch'](handleError(_0x579a98,null));};exports[_0x4e4c('0xde')]=function(_0x5ba7ab,_0x266853,_0x579446){var _0x3e81d1,_0x292432,_0x3a43b8;return db[_0x4e4c('0x39')][_0x4e4c('0x56')]({'where':{'id':_0x5ba7ab[_0x4e4c('0x51')]['id']}})['then'](handleEntityNotFound(_0x266853,null))[_0x4e4c('0x1b')](function(_0x30508e){if(_0x30508e){_0x3a43b8=_0x30508e;logger[_0x4e4c('0x1f')](_0x4e4c('0x20'),_0x4e4c('0x26'),'received\x20delivery\x20report\x20from',_0x30508e[_0x4e4c('0x3c')],util[_0x4e4c('0xcd')](_0x5ba7ab[_0x4e4c('0x40')],{'showHidden':![],'depth':null}));switch(_0x30508e[_0x4e4c('0x3c')]){case'csc':if(_0x5ba7ab[_0x4e4c('0x40')][_0x4e4c('0xdf')]&&_0x5ba7ab['query'][_0x4e4c('0xe0')]){_0x292432=_0x5ba7ab[_0x4e4c('0x40')]['state'];return db[_0x4e4c('0xa0')][_0x4e4c('0x56')]({'where':{'messageId':_0x5ba7ab[_0x4e4c('0x40')][_0x4e4c('0xdf')]}});}break;}}})['then'](handleEntityNotFound(_0x266853,null))['then'](function(_0xd7b5b0){if(_0xd7b5b0){_0x3e81d1=_0xd7b5b0;switch(_0x3a43b8[_0x4e4c('0x3c')]){case _0x4e4c('0xe1'):if(_0x292432==='2'||_0x292432==='6'){return _0x3e81d1[_0x4e4c('0x2f')]({'read':!![]});}else{logger[_0x4e4c('0x22')](_0x4e4c('0x20'),_0x4e4c('0x26'),_0x4e4c('0xe1'),util['inspect'](_0x5ba7ab[_0x4e4c('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x3e81d1;}})[_0x4e4c('0x1b')](respondWithResult(_0x266853,null))['catch'](handleError(_0x266853,null));};exports['addAgents']=function(_0xadf722,_0x123b90,_0x2868ec){return db[_0x4e4c('0x39')]['find']({'where':{'id':_0xadf722[_0x4e4c('0x51')]['id']}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x123b90,null))[_0x4e4c('0x1b')](function(_0x35fc8e){if(_0x35fc8e){return _0x35fc8e[_0x4e4c('0xe2')](_0xadf722[_0x4e4c('0x5e')][_0x4e4c('0x68')],_[_0x4e4c('0x97')](_0xadf722[_0x4e4c('0x5e')],[_0x4e4c('0x68'),'id'])||{})[_0x4e4c('0xc9')](function(_0x47eb53){for(var _0x3f4806=0x0;_0x3f4806<_0xadf722[_0x4e4c('0x5e')]['ids'][_0x4e4c('0x54')];_0x3f4806+=0x1){socket[_0x4e4c('0xe3')](_0x4e4c('0xe4'),{'UserId':Number(_0xadf722[_0x4e4c('0x5e')][_0x4e4c('0x68')][_0x3f4806]),'SmsAccountId':Number(_0xadf722[_0x4e4c('0x51')]['id'])});}return _0x47eb53;});}})[_0x4e4c('0x1b')](respondWithResult(_0x123b90,null))[_0x4e4c('0x25')](handleError(_0x123b90,null));};exports['removeAgents']=function(_0x34defd,_0x4115e5,_0x19c49a){return db[_0x4e4c('0x39')]['find']({'where':{'id':_0x34defd[_0x4e4c('0x51')]['id']}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x4115e5,null))[_0x4e4c('0x1b')](function(_0xfb2fbe){if(_0xfb2fbe){return _0xfb2fbe[_0x4e4c('0xe5')](_0x34defd[_0x4e4c('0x40')][_0x4e4c('0x68')])[_0x4e4c('0x1b')](function(){if(_['isArray'](_0x34defd[_0x4e4c('0x40')][_0x4e4c('0x68')])){for(var _0x159fd0=0x0;_0x159fd0<_0x34defd[_0x4e4c('0x40')][_0x4e4c('0x68')][_0x4e4c('0x54')];_0x159fd0+=0x1){socket[_0x4e4c('0xe3')](_0x4e4c('0xe6'),{'UserId':Number(_0x34defd[_0x4e4c('0x40')][_0x4e4c('0x68')][_0x159fd0]),'SmsAccountId':Number(_0x34defd[_0x4e4c('0x51')]['id'])});}}else{socket[_0x4e4c('0xe3')](_0x4e4c('0xe6'),{'UserId':Number(_0x34defd[_0x4e4c('0x40')][_0x4e4c('0x68')]),'SmsAccountId':Number(_0x34defd[_0x4e4c('0x51')]['id'])});}});}})[_0x4e4c('0x1b')](respondWithStatusCode(_0x4115e5,null))['catch'](handleError(_0x4115e5,null));};exports[_0x4e4c('0xe7')]=function(_0x349008,_0x135f90,_0x385c58){var _0x414963={};var _0x2251a0={};var _0x3600ea;var _0x14ae8f;return db[_0x4e4c('0x39')][_0x4e4c('0x63')]({'where':{'id':_0x349008[_0x4e4c('0x51')]['id']}})[_0x4e4c('0x1b')](handleEntityNotFound(_0x135f90,null))['then'](function(_0x41c245){if(_0x41c245){_0x3600ea=_0x41c245;_0x2251a0['model']=_[_0x4e4c('0x53')](db['User']['rawAttributes']);_0x2251a0[_0x4e4c('0x40')]=_[_0x4e4c('0x53')](_0x349008[_0x4e4c('0x40')]);_0x2251a0[_0x4e4c('0x41')]=_['intersection'](_0x2251a0[_0x4e4c('0x3e')],_0x2251a0[_0x4e4c('0x40')]);_0x414963[_0x4e4c('0x43')]=_[_0x4e4c('0x42')](_0x2251a0['model'],qs[_0x4e4c('0x44')](_0x349008['query'][_0x4e4c('0x44')]));_0x414963['attributes']=_0x414963['attributes'][_0x4e4c('0x54')]?_0x414963[_0x4e4c('0x43')]:_0x2251a0[_0x4e4c('0x3e')];_0x414963[_0x4e4c('0x47')]=qs[_0x4e4c('0x48')](_0x349008['query']['sort']);_0x414963[_0x4e4c('0x49')]=qs[_0x4e4c('0x41')](_['pick'](_0x349008[_0x4e4c('0x40')],_0x2251a0[_0x4e4c('0x41')]));if(_0x349008[_0x4e4c('0x40')][_0x4e4c('0x4b')]){_0x414963[_0x4e4c('0x49')]=_[_0x4e4c('0x4c')](_0x414963[_0x4e4c('0x49')],{'$or':_['map'](_0x414963[_0x4e4c('0x43')],function(_0xb10414){var _0x554284={};_0x554284[_0xb10414]={'$like':'%'+_0x349008['query'][_0x4e4c('0x4b')]+'%'};return _0x554284;})});}_0x414963=_[_0x4e4c('0x4c')]({},_0x414963,_0x349008[_0x4e4c('0x4d')]);return _0x3600ea[_0x4e4c('0xe7')](_0x414963);}})[_0x4e4c('0x1b')](function(_0x4a641e){if(_0x4a641e){_0x14ae8f=_0x4a641e[_0x4e4c('0x54')];if(!_0x349008[_0x4e4c('0x40')][_0x4e4c('0x45')](_0x4e4c('0x64'))){_0x414963[_0x4e4c('0x46')]=qs[_0x4e4c('0x46')](_0x349008[_0x4e4c('0x40')][_0x4e4c('0x46')]);_0x414963[_0x4e4c('0x27')]=qs[_0x4e4c('0x27')](_0x349008[_0x4e4c('0x40')]['offset']);}return _0x3600ea[_0x4e4c('0xe7')](_0x414963);}})[_0x4e4c('0x1b')](function(_0x857fc5){if(_0x857fc5){return _0x857fc5?{'count':_0x14ae8f,'rows':_0x857fc5}:null;}})[_0x4e4c('0x1b')](respondWithResult(_0x135f90,null))[_0x4e4c('0x25')](handleError(_0x135f90,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 3cce9fa..299b738 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 _0xfcaa=['../../mysqldb','update','remove','emit','hasOwnProperty','exports'];(function(_0x8bc276,_0x33ce4e){var _0x12d273=function(_0x3c6df9){while(--_0x3c6df9){_0x8bc276['push'](_0x8bc276['shift']());}};_0x12d273(++_0x33ce4e);}(_0xfcaa,0x78));var _0xafca=function(_0x5f1984,_0x53d581){_0x5f1984=_0x5f1984-0x0;var _0x244cdc=_0xfcaa[_0x5f1984];return _0x244cdc;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xafca('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xafca('0x1'),'afterDestroy':_0xafca('0x2')};function emitEvent(_0x2594df){return function(_0x4d796d,_0x47adfa,_0x43dd39){SmsAccountEvents[_0xafca('0x3')](_0x2594df+':'+_0x4d796d['id'],_0x4d796d);SmsAccountEvents[_0xafca('0x3')](_0x2594df,_0x4d796d);_0x43dd39(null);};}for(var e in events){if(events[_0xafca('0x4')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xafca('0x5')]=SmsAccountEvents; \ No newline at end of file +var _0xab31=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xab31,0xa8));var _0x1ab3=function(_0x2003ed,_0x10995e){_0x2003ed=_0x2003ed-0x0;var _0x22e18e=_0xab31[_0x2003ed];return _0x22e18e;};'use strict';var EventEmitter=require(_0x1ab3('0x0'));var SmsAccount=require(_0x1ab3('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1ab3('0x2')](0x0);var events={'afterCreate':_0x1ab3('0x3'),'afterUpdate':'update','afterDestroy':_0x1ab3('0x4')};function emitEvent(_0x4fcef8){return function(_0x26e781,_0x113c34,_0x32f97e){SmsAccountEvents[_0x1ab3('0x5')](_0x4fcef8+':'+_0x26e781['id'],_0x26e781);SmsAccountEvents[_0x1ab3('0x5')](_0x4fcef8,_0x26e781);_0x32f97e(null);};}for(var e in events){if(events[_0x1ab3('0x6')](e)){var event=events[e];SmsAccount[_0x1ab3('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 175a33a..722649d 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 _0x896d=['request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','api','moment','bluebird'];(function(_0x455540,_0x3a8e0e){var _0xf9949f=function(_0x563652){while(--_0x563652){_0x455540['push'](_0x455540['shift']());}};_0xf9949f(++_0x3a8e0e);}(_0x896d,0x1dc));var _0xd896=function(_0x178ca1,_0xba37c8){_0x178ca1=_0x178ca1-0x0;var _0x5f2668=_0x896d[_0x178ca1];return _0x5f2668;};'use strict';var _=require(_0xd896('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd896('0x1'));var moment=require(_0xd896('0x2'));var BPromise=require(_0xd896('0x3'));var rp=require(_0xd896('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd896('0x5'));var config=require(_0xd896('0x6'));var attributes=require(_0xd896('0x7'));module[_0xd896('0x8')]=function(_0x4229d6,_0x24a93c){return _0x4229d6[_0xd896('0x9')](_0xd896('0xa'),attributes,{'tableName':_0xd896('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d4d=['define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0x4d4d,0x196));var _0xd4d4=function(_0x3c62ff,_0x38d84b){_0x3c62ff=_0x3c62ff-0x0;var _0x381d52=_0x4d4d[_0x3c62ff];return _0x381d52;};'use strict';var _=require(_0xd4d4('0x0'));var util=require('util');var logger=require(_0xd4d4('0x1'))(_0xd4d4('0x2'));var moment=require(_0xd4d4('0x3'));var BPromise=require(_0xd4d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4d4('0x5'));var rimraf=require(_0xd4d4('0x6'));var config=require(_0xd4d4('0x7'));var attributes=require(_0xd4d4('0x8'));module[_0xd4d4('0x9')]=function(_0x471d25,_0x830da3){return _0x471d25[_0xd4d4('0xa')](_0xd4d4('0xb'),attributes,{'tableName':_0xd4d4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 7c0a6f6..c220c1e 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 _0x660d=['raw','where','attributes','include','model','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','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','result','catch','ShowSmsAccount','SmsAccount','options'];(function(_0x44d360,_0xd05cb6){var _0x11c382=function(_0x2e103b){while(--_0x2e103b){_0x44d360['push'](_0x44d360['shift']());}};_0x11c382(++_0xd05cb6);}(_0x660d,0x1ce));var _0xd660=function(_0x1391da,_0x5bf609){_0x1391da=_0x1391da-0x0;var _0x41bff5=_0x660d[_0x1391da];return _0x41bff5;};'use strict';var _=require(_0xd660('0x0'));var util=require('util');var moment=require(_0xd660('0x1'));var BPromise=require(_0xd660('0x2'));var rs=require(_0xd660('0x3'));var fs=require('fs');var Redis=require(_0xd660('0x4'));var db=require(_0xd660('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd660('0x6'));var config=require('../../config/environment');var jayson=require(_0xd660('0x7'));var client=jayson[_0xd660('0x8')][_0xd660('0x9')]({'port':0x232a});config[_0xd660('0xa')]=_[_0xd660('0xb')](config[_0xd660('0xa')],{'host':_0xd660('0xc'),'port':0x18eb});var socket=require(_0xd660('0xd'))(new Redis(config[_0xd660('0xa')]));require(_0xd660('0xe'))[_0xd660('0xf')](socket);function respondWithRpcPromise(_0x48e3ed,_0x4c1d8e,_0xbcb8bc){return new BPromise(function(_0x3dfe75,_0x65d0fb){return client[_0xd660('0x10')](_0x48e3ed,_0xbcb8bc)[_0xd660('0x11')](function(_0x29705c){logger[_0xd660('0x12')](_0xd660('0x13'),_0x4c1d8e,_0xd660('0x14'));logger[_0xd660('0x15')](_0xd660('0x16'),_0x4c1d8e,_0xd660('0x14'),JSON[_0xd660('0x17')](_0x29705c));if(_0x29705c[_0xd660('0x18')]){if(_0x29705c['error'][_0xd660('0x19')]===0x1f4){logger[_0xd660('0x18')](_0xd660('0x13'),_0x4c1d8e,_0x29705c['error'][_0xd660('0x1a')]);return _0x65d0fb(_0x29705c[_0xd660('0x18')]['message']);}logger[_0xd660('0x18')](_0xd660('0x13'),_0x4c1d8e,_0x29705c['error'][_0xd660('0x1a')]);return _0x3dfe75(_0x29705c[_0xd660('0x18')][_0xd660('0x1a')]);}else{logger[_0xd660('0x12')](_0xd660('0x13'),_0x4c1d8e,_0xd660('0x14'));_0x3dfe75(_0x29705c[_0xd660('0x1b')][_0xd660('0x1a')]);}})[_0xd660('0x1c')](function(_0x417704){logger[_0xd660('0x18')](_0xd660('0x13'),_0x4c1d8e,_0x417704);_0x65d0fb(_0x417704);});});}exports[_0xd660('0x1d')]=function(_0x5deb3f){var _0x23661c=this;return new Promise(function(_0x36318e,_0x1ebd46){return db[_0xd660('0x1e')]['find']({'raw':_0x5deb3f[_0xd660('0x1f')]?_0x5deb3f[_0xd660('0x1f')][_0xd660('0x20')]===undefined?!![]:![]:!![],'where':_0x5deb3f[_0xd660('0x1f')]?_0x5deb3f[_0xd660('0x1f')][_0xd660('0x21')]||null:null,'attributes':_0x5deb3f[_0xd660('0x1f')]?_0x5deb3f[_0xd660('0x1f')][_0xd660('0x22')]||null:null,'include':_0x5deb3f[_0xd660('0x1f')]?_0x5deb3f[_0xd660('0x1f')][_0xd660('0x23')]?_['map'](_0x5deb3f[_0xd660('0x1f')][_0xd660('0x23')],function(_0x44b673){return{'model':db[_0x44b673[_0xd660('0x24')]],'as':_0x44b673['as'],'attributes':_0x44b673[_0xd660('0x22')],'include':_0x44b673[_0xd660('0x23')]?_[_0xd660('0x25')](_0x44b673[_0xd660('0x23')],function(_0x3d51fa){return{'model':db[_0x3d51fa[_0xd660('0x24')]],'as':_0x3d51fa['as'],'attributes':_0x3d51fa['attributes'],'include':_0x3d51fa[_0xd660('0x23')]?_[_0xd660('0x25')](_0x3d51fa[_0xd660('0x23')],function(_0x195798){return{'model':db[_0x195798[_0xd660('0x24')]],'as':_0x195798['as'],'attributes':_0x195798[_0xd660('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd660('0x11')](function(_0xb93906){logger['info'](_0xd660('0x1d'),_0x5deb3f);logger[_0xd660('0x15')]('ShowSmsAccount',_0x5deb3f,JSON['stringify'](_0xb93906));_0x36318e(_0xb93906);})[_0xd660('0x1c')](function(_0x14e821){logger['error'](_0xd660('0x1d'),_0x14e821[_0xd660('0x1a')],_0x5deb3f);_0x1ebd46(_0x23661c[_0xd660('0x18')](0x1f4,_0x14e821[_0xd660('0x1a')]));});});}; \ No newline at end of file +var _0xb7b8=['jayson/promise','http','redis','localhost','socket.io-emitter','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','options','raw','attributes','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb7b8,0xa0));var _0x8b7b=function(_0x56f27c,_0x16e94b){_0x56f27c=_0x56f27c-0x0;var _0x2ebe73=_0xb7b8[_0x56f27c];return _0x2ebe73;};'use strict';var _=require(_0x8b7b('0x0'));var util=require(_0x8b7b('0x1'));var moment=require(_0x8b7b('0x2'));var BPromise=require(_0x8b7b('0x3'));var rs=require(_0x8b7b('0x4'));var fs=require('fs');var Redis=require(_0x8b7b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b7b('0x6'));var logger=require(_0x8b7b('0x7'))(_0x8b7b('0x8'));var config=require(_0x8b7b('0x9'));var jayson=require(_0x8b7b('0xa'));var client=jayson['client'][_0x8b7b('0xb')]({'port':0x232a});config[_0x8b7b('0xc')]=_['defaults'](config[_0x8b7b('0xc')],{'host':_0x8b7b('0xd'),'port':0x18eb});var socket=require(_0x8b7b('0xe'))(new Redis(config[_0x8b7b('0xc')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2a4650,_0x5be50b,_0x27efb2){return new BPromise(function(_0x541800,_0x173a50){return client[_0x8b7b('0xf')](_0x2a4650,_0x27efb2)['then'](function(_0x3742a2){logger[_0x8b7b('0x10')](_0x8b7b('0x11'),_0x5be50b,_0x8b7b('0x12'));logger[_0x8b7b('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5be50b,'request\x20sent',JSON[_0x8b7b('0x14')](_0x3742a2));if(_0x3742a2[_0x8b7b('0x15')]){if(_0x3742a2['error'][_0x8b7b('0x16')]===0x1f4){logger[_0x8b7b('0x15')]('SmsAccount,\x20%s,\x20%s',_0x5be50b,_0x3742a2[_0x8b7b('0x15')][_0x8b7b('0x17')]);return _0x173a50(_0x3742a2['error'][_0x8b7b('0x17')]);}logger[_0x8b7b('0x15')](_0x8b7b('0x11'),_0x5be50b,_0x3742a2[_0x8b7b('0x15')]['message']);return _0x541800(_0x3742a2[_0x8b7b('0x15')]['message']);}else{logger[_0x8b7b('0x10')]('SmsAccount,\x20%s,\x20%s',_0x5be50b,'request\x20sent');_0x541800(_0x3742a2['result'][_0x8b7b('0x17')]);}})[_0x8b7b('0x18')](function(_0x5fd519){logger[_0x8b7b('0x15')]('SmsAccount,\x20%s,\x20%s',_0x5be50b,_0x5fd519);_0x173a50(_0x5fd519);});});}exports[_0x8b7b('0x19')]=function(_0x1208c1){var _0x199fc2=this;return new Promise(function(_0x2d6650,_0x4dc038){return db[_0x8b7b('0x1a')]['find']({'raw':_0x1208c1[_0x8b7b('0x1b')]?_0x1208c1[_0x8b7b('0x1b')][_0x8b7b('0x1c')]===undefined?!![]:![]:!![],'where':_0x1208c1[_0x8b7b('0x1b')]?_0x1208c1['options']['where']||null:null,'attributes':_0x1208c1['options']?_0x1208c1[_0x8b7b('0x1b')][_0x8b7b('0x1d')]||null:null,'include':_0x1208c1['options']?_0x1208c1[_0x8b7b('0x1b')]['include']?_[_0x8b7b('0x1e')](_0x1208c1['options'][_0x8b7b('0x1f')],function(_0x3faefe){return{'model':db[_0x3faefe[_0x8b7b('0x20')]],'as':_0x3faefe['as'],'attributes':_0x3faefe[_0x8b7b('0x1d')],'include':_0x3faefe[_0x8b7b('0x1f')]?_[_0x8b7b('0x1e')](_0x3faefe['include'],function(_0x34a5f0){return{'model':db[_0x34a5f0['model']],'as':_0x34a5f0['as'],'attributes':_0x34a5f0[_0x8b7b('0x1d')],'include':_0x34a5f0[_0x8b7b('0x1f')]?_[_0x8b7b('0x1e')](_0x34a5f0[_0x8b7b('0x1f')],function(_0x3e9598){return{'model':db[_0x3e9598[_0x8b7b('0x20')]],'as':_0x3e9598['as'],'attributes':_0x3e9598[_0x8b7b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8b7b('0x21')](function(_0x20f951){logger[_0x8b7b('0x10')](_0x8b7b('0x19'),_0x1208c1);logger['debug'](_0x8b7b('0x19'),_0x1208c1,JSON['stringify'](_0x20f951));_0x2d6650(_0x20f951);})[_0x8b7b('0x18')](function(_0x23b483){logger['error'](_0x8b7b('0x19'),_0x23b483[_0x8b7b('0x17')],_0x1208c1);_0x4dc038(_0x199fc2['error'](0x1f4,_0x23b483[_0x8b7b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 14e6d82..d4b45df 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 8bde098..243a4ca 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x52b494,_0x144998){var _0x295940=function(_0x2ee8eb){while(--_0x2ee8eb){_0x52b494['push'](_0x52b494['shift']());}};_0x295940(++_0x144998);}(_0x34e8,0x12c));var _0x834e=function(_0x4c5350,_0x4b750e){_0x4c5350=_0x4c5350-0x0;var _0x3adfa1=_0x34e8[_0x4c5350];return _0x3adfa1;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6ef9f1c..3f013b3 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 _0x5390=['noop','*,*,*,*','sequelize','exports','STRING'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x5390,0x1ab));var _0x0539=function(_0x343c49,_0x61d79c){_0x343c49=_0x343c49-0x0;var _0x103178=_0x5390[_0x343c49];return _0x103178;};'use strict';var Sequelize=require(_0x0539('0x0'));module[_0x0539('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0539('0x2')],'allowNull':![],'defaultValue':_0x0539('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0539('0x2')]},'interval':{'type':Sequelize[_0x0539('0x2')],'defaultValue':_0x0539('0x4')}}; \ No newline at end of file +var _0xedf5=['noop','sequelize','INTEGER','STRING'];(function(_0x1f8f72,_0x1c5882){var _0x1ea333=function(_0x585727){while(--_0x585727){_0x1f8f72['push'](_0x1f8f72['shift']());}};_0x1ea333(++_0x1c5882);}(_0xedf5,0x131));var _0x5edf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xedf5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x5edf('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5edf('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5edf('0x2')],'allowNull':![],'defaultValue':_0x5edf('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5edf('0x2')]},'interval':{'type':Sequelize[_0x5edf('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 184bfd0..f09e9f2 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 _0xb393=['then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','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','status','json','offset','undefined','limit','Content-Range','apply','update'];(function(_0x1f7d23,_0x351ffa){var _0x1bd3f7=function(_0x4b6b06){while(--_0x4b6b06){_0x1f7d23['push'](_0x1f7d23['shift']());}};_0x1bd3f7(++_0x351ffa);}(_0xb393,0xf1));var _0x3b39=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb393[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3b39('0x0'));var rp=require(_0x3b39('0x1'));var moment=require(_0x3b39('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3b39('0x3'));var util=require(_0x3b39('0x4'));var path=require(_0x3b39('0x5'));var sox=require(_0x3b39('0x6'));var csv=require(_0x3b39('0x7'));var ejs=require(_0x3b39('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b39('0x9'));var squel=require('squel');var crypto=require(_0x3b39('0xa'));var jsforce=require(_0x3b39('0xb'));var deskjs=require(_0x3b39('0xc'));var toCsv=require(_0x3b39('0x7'));var querystring=require('querystring');var Papa=require(_0x3b39('0xd'));var Redis=require(_0x3b39('0xe'));var authService=require(_0x3b39('0xf'));var qs=require(_0x3b39('0x10'));var as=require(_0x3b39('0x11'));var hardwareService=require(_0x3b39('0x12'));var logger=require(_0x3b39('0x13'))(_0x3b39('0x14'));var utils=require(_0x3b39('0x15'));var config=require(_0x3b39('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bec84,_0x243dd2){_0x243dd2=_0x243dd2||0xcc;return function(_0x5cb74c){if(_0x5cb74c){return _0x3bec84['sendStatus'](_0x243dd2);}return _0x3bec84[_0x3b39('0x17')](_0x243dd2)['end']();};}function respondWithResult(_0x50d5d7,_0x1b2171){_0x1b2171=_0x1b2171||0xc8;return function(_0x563cce){if(_0x563cce){return _0x50d5d7[_0x3b39('0x17')](_0x1b2171)[_0x3b39('0x18')](_0x563cce);}};}function respondWithFilteredResult(_0xcc0dcf,_0x5259ea){return function(_0xf9a73d){if(_0xf9a73d){var _0x395705=typeof _0x5259ea[_0x3b39('0x19')]===_0x3b39('0x1a')&&typeof _0x5259ea['limit']===_0x3b39('0x1a');var _0x3c9929=_0xf9a73d['count'];var _0x2742bf=_0x395705?0x0:_0x5259ea['offset'];var _0x458684=_0x395705?_0xf9a73d['count']:_0x5259ea[_0x3b39('0x19')]+_0x5259ea[_0x3b39('0x1b')];var _0x42de02;if(_0x458684>=_0x3c9929){_0x458684=_0x3c9929;_0x42de02=0xc8;}else{_0x42de02=0xce;}_0xcc0dcf[_0x3b39('0x17')](_0x42de02);return _0xcc0dcf['set'](_0x3b39('0x1c'),_0x2742bf+'-'+_0x458684+'/'+_0x3c9929)[_0x3b39('0x18')](_0xf9a73d);}return null;};}function patchUpdates(_0x48689d){return function(_0x4d7bae){try{jsonpatch[_0x3b39('0x1d')](_0x4d7bae,_0x48689d,!![]);}catch(_0x220a4b){return BPromise['reject'](_0x220a4b);}return _0x4d7bae['save']();};}function saveUpdates(_0x30fe05,_0x19f1c6){return function(_0x214c5c){if(_0x214c5c){return _0x214c5c[_0x3b39('0x1e')](_0x30fe05)[_0x3b39('0x1f')](function(_0x1a2760){return _0x1a2760;});}return null;};}function removeEntity(_0x20e4b3,_0x38a67f){return function(_0x3f4d92){if(_0x3f4d92){return _0x3f4d92['destroy']()['then'](function(){_0x20e4b3[_0x3b39('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cce41,_0x2046ef){return function(_0x18f1cd){if(!_0x18f1cd){_0x1cce41['sendStatus'](0x194);}return _0x18f1cd;};}function handleError(_0x223bea,_0x1d42e2){_0x1d42e2=_0x1d42e2||0x1f4;return function(_0x29d231){logger[_0x3b39('0x20')](_0x29d231[_0x3b39('0x21')]);if(_0x29d231[_0x3b39('0x22')]){delete _0x29d231[_0x3b39('0x22')];}_0x223bea[_0x3b39('0x17')](_0x1d42e2)[_0x3b39('0x23')](_0x29d231);};}exports[_0x3b39('0x24')]=function(_0x306284,_0x5494e9){var _0x38eca={},_0x1985ff={},_0x329285={'count':0x0,'rows':[]};var _0x6a5593=_[_0x3b39('0x25')](db[_0x3b39('0x26')][_0x3b39('0x27')],function(_0x1c85bd){return{'name':_0x1c85bd[_0x3b39('0x28')],'type':_0x1c85bd[_0x3b39('0x29')]['key']};});_0x1985ff[_0x3b39('0x2a')]=_['map'](_0x6a5593,_0x3b39('0x22'));_0x1985ff[_0x3b39('0x2b')]=_[_0x3b39('0x2c')](_0x306284[_0x3b39('0x2b')]);_0x1985ff[_0x3b39('0x2d')]=_[_0x3b39('0x2e')](_0x1985ff[_0x3b39('0x2a')],_0x1985ff['query']);_0x38eca['attributes']=_[_0x3b39('0x2e')](_0x1985ff[_0x3b39('0x2a')],qs[_0x3b39('0x2f')](_0x306284[_0x3b39('0x2b')][_0x3b39('0x2f')]));_0x38eca[_0x3b39('0x30')]=_0x38eca[_0x3b39('0x30')][_0x3b39('0x31')]?_0x38eca[_0x3b39('0x30')]:_0x1985ff[_0x3b39('0x2a')];if(!_0x306284[_0x3b39('0x2b')][_0x3b39('0x32')]('nolimit')){_0x38eca[_0x3b39('0x1b')]=qs[_0x3b39('0x1b')](_0x306284[_0x3b39('0x2b')][_0x3b39('0x1b')]);_0x38eca[_0x3b39('0x19')]=qs[_0x3b39('0x19')](_0x306284[_0x3b39('0x2b')][_0x3b39('0x19')]);}_0x38eca[_0x3b39('0x33')]=qs['sort'](_0x306284[_0x3b39('0x2b')][_0x3b39('0x34')]);_0x38eca[_0x3b39('0x35')]=qs[_0x3b39('0x2d')](_[_0x3b39('0x36')](_0x306284[_0x3b39('0x2b')],_0x1985ff[_0x3b39('0x2d')]),_0x6a5593);if(_0x306284[_0x3b39('0x2b')][_0x3b39('0x37')]){_0x38eca['where']=_[_0x3b39('0x38')](_0x38eca[_0x3b39('0x35')],{'$or':_['map'](_0x6a5593,function(_0x57310f){if(_0x57310f[_0x3b39('0x29')]!=='VIRTUAL'){var _0x263c58={};_0x263c58[_0x57310f['name']]={'$like':'%'+_0x306284[_0x3b39('0x2b')]['filter']+'%'};return _0x263c58;}})});}_0x38eca=_[_0x3b39('0x38')]({},_0x38eca,_0x306284['options']);var _0x32ee36={'where':_0x38eca['where']};return db[_0x3b39('0x26')][_0x3b39('0x39')](_0x32ee36)[_0x3b39('0x1f')](function(_0x3a6dce){_0x329285['count']=_0x3a6dce;if(_0x306284['query'][_0x3b39('0x3a')]){_0x38eca[_0x3b39('0x3b')]=[{'all':!![]}];}return db[_0x3b39('0x26')][_0x3b39('0x3c')](_0x38eca);})[_0x3b39('0x1f')](function(_0x4e4506){_0x329285[_0x3b39('0x3d')]=_0x4e4506;return _0x329285;})[_0x3b39('0x1f')](respondWithFilteredResult(_0x5494e9,_0x38eca))[_0x3b39('0x3e')](handleError(_0x5494e9,null));};exports[_0x3b39('0x3f')]=function(_0x52ccc7,_0xb817c3){var _0x2b2d59={'raw':!![],'where':{'id':_0x52ccc7[_0x3b39('0x40')]['id']}},_0x38a7c6={};_0x38a7c6[_0x3b39('0x2a')]=_[_0x3b39('0x2c')](db[_0x3b39('0x26')][_0x3b39('0x27')]);_0x38a7c6[_0x3b39('0x2b')]=_[_0x3b39('0x2c')](_0x52ccc7['query']);_0x38a7c6[_0x3b39('0x2d')]=_['intersection'](_0x38a7c6['model'],_0x38a7c6[_0x3b39('0x2b')]);_0x2b2d59[_0x3b39('0x30')]=_[_0x3b39('0x2e')](_0x38a7c6['model'],qs['fields'](_0x52ccc7[_0x3b39('0x2b')][_0x3b39('0x2f')]));_0x2b2d59['attributes']=_0x2b2d59[_0x3b39('0x30')]['length']?_0x2b2d59['attributes']:_0x38a7c6[_0x3b39('0x2a')];if(_0x52ccc7[_0x3b39('0x2b')][_0x3b39('0x3a')]){_0x2b2d59[_0x3b39('0x3b')]=[{'all':!![]}];}_0x2b2d59=_[_0x3b39('0x38')]({},_0x2b2d59,_0x52ccc7['options']);return db[_0x3b39('0x26')]['find'](_0x2b2d59)['then'](handleEntityNotFound(_0xb817c3,null))['then'](respondWithResult(_0xb817c3,null))[_0x3b39('0x3e')](handleError(_0xb817c3,null));};exports['create']=function(_0xe3521f,_0x39d38f){return db['SmsApplication'][_0x3b39('0x41')](_0xe3521f['body'],{})[_0x3b39('0x1f')](respondWithResult(_0x39d38f,0xc9))[_0x3b39('0x3e')](handleError(_0x39d38f,null));};exports[_0x3b39('0x1e')]=function(_0x350c57,_0x388054){if(_0x350c57[_0x3b39('0x42')]['id']){delete _0x350c57[_0x3b39('0x42')]['id'];}return db[_0x3b39('0x26')][_0x3b39('0x43')]({'where':{'id':_0x350c57[_0x3b39('0x40')]['id']}})[_0x3b39('0x1f')](handleEntityNotFound(_0x388054,null))[_0x3b39('0x1f')](saveUpdates(_0x350c57[_0x3b39('0x42')],null))[_0x3b39('0x1f')](respondWithResult(_0x388054,null))[_0x3b39('0x3e')](handleError(_0x388054,null));};exports['destroy']=function(_0x4a8300,_0x1bf085){return db[_0x3b39('0x26')][_0x3b39('0x43')]({'where':{'id':_0x4a8300[_0x3b39('0x40')]['id']}})[_0x3b39('0x1f')](handleEntityNotFound(_0x1bf085,null))[_0x3b39('0x1f')](removeEntity(_0x1bf085,null))[_0x3b39('0x3e')](handleError(_0x1bf085,null));}; \ No newline at end of file +var _0xa6c7=['json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','status','end','error','stack','name','index','SmsApplication','fieldName','type','map','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','rimraf','zip-dir','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/environment','../../mysqldb','sendStatus'];(function(_0x5464d6,_0x33454b){var _0x180eb5=function(_0x2a4b9e){while(--_0x2a4b9e){_0x5464d6['push'](_0x5464d6['shift']());}};_0x180eb5(++_0x33454b);}(_0xa6c7,0x10b));var _0x7a6c=function(_0x4b9f3f,_0x15aeb3){_0x4b9f3f=_0x4b9f3f-0x0;var _0x28c246=_0xa6c7[_0x4b9f3f];return _0x28c246;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a6c('0x0'));var zipdir=require(_0x7a6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7a6c('0x2'));var BPromise=require(_0x7a6c('0x3'));var Mustache=require(_0x7a6c('0x4'));var util=require(_0x7a6c('0x5'));var path=require(_0x7a6c('0x6'));var sox=require(_0x7a6c('0x7'));var csv=require(_0x7a6c('0x8'));var ejs=require(_0x7a6c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a6c('0xa'));var squel=require(_0x7a6c('0xb'));var crypto=require(_0x7a6c('0xc'));var jsforce=require(_0x7a6c('0xd'));var deskjs=require(_0x7a6c('0xe'));var toCsv=require(_0x7a6c('0x8'));var querystring=require(_0x7a6c('0xf'));var Papa=require('papaparse');var Redis=require(_0x7a6c('0x10'));var authService=require(_0x7a6c('0x11'));var qs=require(_0x7a6c('0x12'));var as=require(_0x7a6c('0x13'));var hardwareService=require(_0x7a6c('0x14'));var logger=require('../../config/logger')(_0x7a6c('0x15'));var utils=require('../../config/utils');var config=require(_0x7a6c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a6c('0x17'))['db'];function respondWithStatusCode(_0x5df178,_0x96a447){_0x96a447=_0x96a447||0xcc;return function(_0xa83f0f){if(_0xa83f0f){return _0x5df178[_0x7a6c('0x18')](_0x96a447);}return _0x5df178['status'](_0x96a447)['end']();};}function respondWithResult(_0xf859eb,_0x54f9e3){_0x54f9e3=_0x54f9e3||0xc8;return function(_0x4a6b7a){if(_0x4a6b7a){return _0xf859eb['status'](_0x54f9e3)[_0x7a6c('0x19')](_0x4a6b7a);}};}function respondWithFilteredResult(_0x352596,_0x1354c2){return function(_0x547a72){if(_0x547a72){var _0x2df59f=typeof _0x1354c2[_0x7a6c('0x1a')]===_0x7a6c('0x1b')&&typeof _0x1354c2[_0x7a6c('0x1c')]==='undefined';var _0x3739d2=_0x547a72[_0x7a6c('0x1d')];var _0x38dc8e=_0x2df59f?0x0:_0x1354c2['offset'];var _0x8d7ca4=_0x2df59f?_0x547a72['count']:_0x1354c2[_0x7a6c('0x1a')]+_0x1354c2[_0x7a6c('0x1c')];var _0x273333;if(_0x8d7ca4>=_0x3739d2){_0x8d7ca4=_0x3739d2;_0x273333=0xc8;}else{_0x273333=0xce;}_0x352596['status'](_0x273333);return _0x352596[_0x7a6c('0x1e')](_0x7a6c('0x1f'),_0x38dc8e+'-'+_0x8d7ca4+'/'+_0x3739d2)[_0x7a6c('0x19')](_0x547a72);}return null;};}function patchUpdates(_0x3e935f){return function(_0x1ea45e){try{jsonpatch['apply'](_0x1ea45e,_0x3e935f,!![]);}catch(_0xd8b46b){return BPromise[_0x7a6c('0x20')](_0xd8b46b);}return _0x1ea45e['save']();};}function saveUpdates(_0x5b8249,_0xfbfead){return function(_0x1bb96f){if(_0x1bb96f){return _0x1bb96f[_0x7a6c('0x21')](_0x5b8249)[_0x7a6c('0x22')](function(_0x544985){return _0x544985;});}return null;};}function removeEntity(_0xe87afc,_0x4086cd){return function(_0x32846a){if(_0x32846a){return _0x32846a[_0x7a6c('0x23')]()[_0x7a6c('0x22')](function(){_0xe87afc[_0x7a6c('0x24')](0xcc)[_0x7a6c('0x25')]();});}};}function handleEntityNotFound(_0x20b2a6,_0x5d755e){return function(_0x27ea96){if(!_0x27ea96){_0x20b2a6['sendStatus'](0x194);}return _0x27ea96;};}function handleError(_0x9dc1ea,_0x33ef2d){_0x33ef2d=_0x33ef2d||0x1f4;return function(_0x161ffd){logger[_0x7a6c('0x26')](_0x161ffd[_0x7a6c('0x27')]);if(_0x161ffd[_0x7a6c('0x28')]){delete _0x161ffd['name'];}_0x9dc1ea[_0x7a6c('0x24')](_0x33ef2d)['send'](_0x161ffd);};}exports[_0x7a6c('0x29')]=function(_0x669acf,_0x3aa275){var _0x1b6aa0={},_0x1ac6b2={},_0x51d312={'count':0x0,'rows':[]};var _0x5b4a3d=_['map'](db[_0x7a6c('0x2a')]['rawAttributes'],function(_0x1a2ec1){return{'name':_0x1a2ec1[_0x7a6c('0x2b')],'type':_0x1a2ec1[_0x7a6c('0x2c')]['key']};});_0x1ac6b2['model']=_[_0x7a6c('0x2d')](_0x5b4a3d,_0x7a6c('0x28'));_0x1ac6b2['query']=_[_0x7a6c('0x2e')](_0x669acf['query']);_0x1ac6b2[_0x7a6c('0x2f')]=_[_0x7a6c('0x30')](_0x1ac6b2[_0x7a6c('0x31')],_0x1ac6b2[_0x7a6c('0x32')]);_0x1b6aa0[_0x7a6c('0x33')]=_[_0x7a6c('0x30')](_0x1ac6b2[_0x7a6c('0x31')],qs[_0x7a6c('0x34')](_0x669acf['query'][_0x7a6c('0x34')]));_0x1b6aa0[_0x7a6c('0x33')]=_0x1b6aa0[_0x7a6c('0x33')]['length']?_0x1b6aa0[_0x7a6c('0x33')]:_0x1ac6b2['model'];if(!_0x669acf['query'][_0x7a6c('0x35')](_0x7a6c('0x36'))){_0x1b6aa0[_0x7a6c('0x1c')]=qs[_0x7a6c('0x1c')](_0x669acf['query'][_0x7a6c('0x1c')]);_0x1b6aa0[_0x7a6c('0x1a')]=qs[_0x7a6c('0x1a')](_0x669acf[_0x7a6c('0x32')][_0x7a6c('0x1a')]);}_0x1b6aa0[_0x7a6c('0x37')]=qs[_0x7a6c('0x38')](_0x669acf[_0x7a6c('0x32')][_0x7a6c('0x38')]);_0x1b6aa0[_0x7a6c('0x39')]=qs[_0x7a6c('0x2f')](_[_0x7a6c('0x3a')](_0x669acf[_0x7a6c('0x32')],_0x1ac6b2['filters']),_0x5b4a3d);if(_0x669acf['query']['filter']){_0x1b6aa0[_0x7a6c('0x39')]=_[_0x7a6c('0x3b')](_0x1b6aa0[_0x7a6c('0x39')],{'$or':_[_0x7a6c('0x2d')](_0x5b4a3d,function(_0x373b30){if(_0x373b30[_0x7a6c('0x2c')]!=='VIRTUAL'){var _0x14b0f1={};_0x14b0f1[_0x373b30[_0x7a6c('0x28')]]={'$like':'%'+_0x669acf['query'][_0x7a6c('0x3c')]+'%'};return _0x14b0f1;}})});}_0x1b6aa0=_['merge']({},_0x1b6aa0,_0x669acf[_0x7a6c('0x3d')]);var _0x536577={'where':_0x1b6aa0[_0x7a6c('0x39')]};return db[_0x7a6c('0x2a')][_0x7a6c('0x1d')](_0x536577)['then'](function(_0x24738f){_0x51d312['count']=_0x24738f;if(_0x669acf[_0x7a6c('0x32')][_0x7a6c('0x3e')]){_0x1b6aa0[_0x7a6c('0x3f')]=[{'all':!![]}];}return db[_0x7a6c('0x2a')]['findAll'](_0x1b6aa0);})[_0x7a6c('0x22')](function(_0x396a69){_0x51d312[_0x7a6c('0x40')]=_0x396a69;return _0x51d312;})['then'](respondWithFilteredResult(_0x3aa275,_0x1b6aa0))[_0x7a6c('0x41')](handleError(_0x3aa275,null));};exports[_0x7a6c('0x42')]=function(_0x31cde6,_0x13695e){var _0x2ff699={'raw':!![],'where':{'id':_0x31cde6[_0x7a6c('0x43')]['id']}},_0x241f7d={};_0x241f7d['model']=_[_0x7a6c('0x2e')](db[_0x7a6c('0x2a')][_0x7a6c('0x44')]);_0x241f7d['query']=_[_0x7a6c('0x2e')](_0x31cde6[_0x7a6c('0x32')]);_0x241f7d[_0x7a6c('0x2f')]=_['intersection'](_0x241f7d[_0x7a6c('0x31')],_0x241f7d['query']);_0x2ff699['attributes']=_['intersection'](_0x241f7d[_0x7a6c('0x31')],qs[_0x7a6c('0x34')](_0x31cde6['query']['fields']));_0x2ff699[_0x7a6c('0x33')]=_0x2ff699[_0x7a6c('0x33')][_0x7a6c('0x45')]?_0x2ff699[_0x7a6c('0x33')]:_0x241f7d[_0x7a6c('0x31')];if(_0x31cde6[_0x7a6c('0x32')][_0x7a6c('0x3e')]){_0x2ff699['include']=[{'all':!![]}];}_0x2ff699=_[_0x7a6c('0x3b')]({},_0x2ff699,_0x31cde6['options']);return db['SmsApplication'][_0x7a6c('0x46')](_0x2ff699)['then'](handleEntityNotFound(_0x13695e,null))[_0x7a6c('0x22')](respondWithResult(_0x13695e,null))[_0x7a6c('0x41')](handleError(_0x13695e,null));};exports[_0x7a6c('0x47')]=function(_0x410605,_0x199e65){return db[_0x7a6c('0x2a')][_0x7a6c('0x47')](_0x410605['body'],{})['then'](respondWithResult(_0x199e65,0xc9))['catch'](handleError(_0x199e65,null));};exports[_0x7a6c('0x21')]=function(_0x18e164,_0x20a859){if(_0x18e164[_0x7a6c('0x48')]['id']){delete _0x18e164['body']['id'];}return db[_0x7a6c('0x2a')][_0x7a6c('0x46')]({'where':{'id':_0x18e164[_0x7a6c('0x43')]['id']}})['then'](handleEntityNotFound(_0x20a859,null))[_0x7a6c('0x22')](saveUpdates(_0x18e164[_0x7a6c('0x48')],null))[_0x7a6c('0x22')](respondWithResult(_0x20a859,null))[_0x7a6c('0x41')](handleError(_0x20a859,null));};exports['destroy']=function(_0xb19053,_0x1326db){return db[_0x7a6c('0x2a')][_0x7a6c('0x46')]({'where':{'id':_0xb19053[_0x7a6c('0x43')]['id']}})[_0x7a6c('0x22')](handleEntityNotFound(_0x1326db,null))['then'](removeEntity(_0x1326db,null))[_0x7a6c('0x41')](handleError(_0x1326db,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index bdce266..9267ff8 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 _0xa7f1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','util','api'];(function(_0x310854,_0x39b8b7){var _0x35c9e6=function(_0x4655c8){while(--_0x4655c8){_0x310854['push'](_0x310854['shift']());}};_0x35c9e6(++_0x39b8b7);}(_0xa7f1,0x11c));var _0x1a7f=function(_0x2891d1,_0x2ddd3e){_0x2891d1=_0x2891d1-0x0;var _0x486948=_0xa7f1[_0x2891d1];return _0x486948;};'use strict';var _=require('lodash');var util=require(_0x1a7f('0x0'));var logger=require('../../config/logger')(_0x1a7f('0x1'));var moment=require(_0x1a7f('0x2'));var BPromise=require(_0x1a7f('0x3'));var rp=require(_0x1a7f('0x4'));var fs=require('fs');var path=require(_0x1a7f('0x5'));var rimraf=require(_0x1a7f('0x6'));var config=require(_0x1a7f('0x7'));var attributes=require(_0x1a7f('0x8'));module[_0x1a7f('0x9')]=function(_0x18e97d,_0x10ab09){return _0x18e97d['define'](_0x1a7f('0xa'),attributes,{'tableName':_0x1a7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1a7f('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xaf43=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xaf43,0x182));var _0x3af4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xaf43[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x3af4('0x0'));var logger=require(_0x3af4('0x1'))(_0x3af4('0x2'));var moment=require(_0x3af4('0x3'));var BPromise=require(_0x3af4('0x4'));var rp=require(_0x3af4('0x5'));var fs=require('fs');var path=require(_0x3af4('0x6'));var rimraf=require(_0x3af4('0x7'));var config=require(_0x3af4('0x8'));var attributes=require(_0x3af4('0x9'));module[_0x3af4('0xa')]=function(_0x47d8da,_0x199ee7){return _0x47d8da[_0x3af4('0xb')](_0x3af4('0xc'),attributes,{'tableName':_0x3af4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4f0514e..41f5f03 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 _0xb470=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message'];(function(_0xe8974e,_0x58864e){var _0x8f9c36=function(_0x113173){while(--_0x113173){_0xe8974e['push'](_0xe8974e['shift']());}};_0x8f9c36(++_0x58864e);}(_0xb470,0x75));var _0x0b47=function(_0x105339,_0xb401fb){_0x105339=_0x105339-0x0;var _0x2e7540=_0xb470[_0x105339];return _0x2e7540;};'use strict';var _=require(_0x0b47('0x0'));var util=require(_0x0b47('0x1'));var moment=require(_0x0b47('0x2'));var BPromise=require(_0x0b47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b47('0x4'));var db=require(_0x0b47('0x5'))['db'];var utils=require(_0x0b47('0x6'));var logger=require('../../config/logger')(_0x0b47('0x7'));var config=require(_0x0b47('0x8'));var jayson=require(_0x0b47('0x9'));var client=jayson[_0x0b47('0xa')][_0x0b47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23d960,_0x201ab2,_0x37eb18){return new BPromise(function(_0x4bfebf,_0x56543c){return client['request'](_0x23d960,_0x37eb18)['then'](function(_0x38523d){logger[_0x0b47('0xc')]('SmsApplication,\x20%s,\x20%s',_0x201ab2,_0x0b47('0xd'));logger[_0x0b47('0xe')](_0x0b47('0xf'),_0x201ab2,_0x0b47('0xd'),JSON[_0x0b47('0x10')](_0x38523d));if(_0x38523d[_0x0b47('0x11')]){if(_0x38523d[_0x0b47('0x11')][_0x0b47('0x12')]===0x1f4){logger[_0x0b47('0x11')](_0x0b47('0x13'),_0x201ab2,_0x38523d['error']['message']);return _0x56543c(_0x38523d[_0x0b47('0x11')]['message']);}logger[_0x0b47('0x11')](_0x0b47('0x13'),_0x201ab2,_0x38523d['error'][_0x0b47('0x14')]);return _0x4bfebf(_0x38523d[_0x0b47('0x11')][_0x0b47('0x14')]);}else{logger[_0x0b47('0xc')](_0x0b47('0x13'),_0x201ab2,_0x0b47('0xd'));_0x4bfebf(_0x38523d[_0x0b47('0x15')][_0x0b47('0x14')]);}})[_0x0b47('0x16')](function(_0x1da847){logger['error'](_0x0b47('0x13'),_0x201ab2,_0x1da847);_0x56543c(_0x1da847);});});} \ No newline at end of file +var _0xc5b3=['client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x380a3f,_0x202483){var _0x2b4eca=function(_0x1e99b2){while(--_0x1e99b2){_0x380a3f['push'](_0x380a3f['shift']());}};_0x2b4eca(++_0x202483);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0xc5b3[_0xd39959];return _0x1ff69c;};'use strict';var _=require(_0x3c5b('0x0'));var util=require(_0x3c5b('0x1'));var moment=require(_0x3c5b('0x2'));var BPromise=require(_0x3c5b('0x3'));var rs=require(_0x3c5b('0x4'));var fs=require('fs');var Redis=require(_0x3c5b('0x5'));var db=require(_0x3c5b('0x6'))['db'];var utils=require(_0x3c5b('0x7'));var logger=require('../../config/logger')(_0x3c5b('0x8'));var config=require(_0x3c5b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3c5b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7a363e,_0x4730e9,_0x894f97){return new BPromise(function(_0xae86a0,_0x32586d){return client[_0x3c5b('0xb')](_0x7a363e,_0x894f97)[_0x3c5b('0xc')](function(_0x5f5df9){logger[_0x3c5b('0xd')](_0x3c5b('0xe'),_0x4730e9,_0x3c5b('0xf'));logger[_0x3c5b('0x10')](_0x3c5b('0x11'),_0x4730e9,'request\x20sent',JSON[_0x3c5b('0x12')](_0x5f5df9));if(_0x5f5df9[_0x3c5b('0x13')]){if(_0x5f5df9[_0x3c5b('0x13')][_0x3c5b('0x14')]===0x1f4){logger[_0x3c5b('0x13')](_0x3c5b('0xe'),_0x4730e9,_0x5f5df9[_0x3c5b('0x13')]['message']);return _0x32586d(_0x5f5df9[_0x3c5b('0x13')][_0x3c5b('0x15')]);}logger[_0x3c5b('0x13')](_0x3c5b('0xe'),_0x4730e9,_0x5f5df9['error'][_0x3c5b('0x15')]);return _0xae86a0(_0x5f5df9['error'][_0x3c5b('0x15')]);}else{logger[_0x3c5b('0xd')]('SmsApplication,\x20%s,\x20%s',_0x4730e9,_0x3c5b('0xf'));_0xae86a0(_0x5f5df9[_0x3c5b('0x16')]['message']);}})[_0x3c5b('0x17')](function(_0x1cbe52){logger[_0x3c5b('0x13')]('SmsApplication,\x20%s,\x20%s',_0x4730e9,_0x1cbe52);_0x32586d(_0x1cbe52);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3a94b75..abc82cd 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 _0x6cb4=['./smsInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','/:id/download','create','post','/:id/messages','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5627a6,_0x38cb02){var _0x1b61d7=function(_0x5c1f0d){while(--_0x5c1f0d){_0x5627a6['push'](_0x5627a6['shift']());}};_0x1b61d7(++_0x38cb02);}(_0x6cb4,0xff));var _0x46cb=function(_0x2142f6,_0x5bfa6b){_0x2142f6=_0x2142f6-0x0;var _0x2d6c18=_0x6cb4[_0x2142f6];return _0x2d6c18;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var fs_extra=require(_0x46cb('0x6'));var auth=require(_0x46cb('0x7'));var interaction=require(_0x46cb('0x8'));var config=require('../../config/environment');var controller=require(_0x46cb('0x9'));router['get']('/',auth[_0x46cb('0xa')](),controller['index']);router[_0x46cb('0xb')](_0x46cb('0xc'),auth[_0x46cb('0xa')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xb')](_0x46cb('0xe'),auth['isAuthenticated'](),controller[_0x46cb('0xf')]);router[_0x46cb('0xb')]('/:id/messages',auth[_0x46cb('0xa')](),controller[_0x46cb('0x10')]);router['get'](_0x46cb('0x11'),auth[_0x46cb('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x46cb('0x12')]);router[_0x46cb('0x13')](_0x46cb('0x14'),auth[_0x46cb('0xa')](),controller['addMessage']);router[_0x46cb('0x13')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')](_0x46cb('0x17'),_0x46cb('0x18')),controller[_0x46cb('0x19')]);router[_0x46cb('0x1a')](_0x46cb('0xe'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')]('sms',_0x46cb('0x1b')),controller['update']);router[_0x46cb('0x1c')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x46cb('0x17'),_0x46cb('0x1d')),controller[_0x46cb('0x1e')]);router[_0x46cb('0x1c')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),controller[_0x46cb('0x1f')]);module[_0x46cb('0x20')]=router; \ No newline at end of file +var _0x2032=['./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0x2032,0xd9));var _0x2203=function(_0x10909f,_0x477fd8){_0x10909f=_0x10909f-0x0;var _0x5eea47=_0x2032[_0x10909f];return _0x5eea47;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2203('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction[_0x2203('0x19')](_0x2203('0x14'),_0x2203('0x1a')),controller[_0x2203('0x1b')]);router['delete'](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x1c')),controller['destroy']);router[_0x2203('0x1d')]('/:id/tags',auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);module[_0x2203('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f030d80..d4cffc5 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 _0x1df7=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','moment','exports'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0x1df7,0x6e));var _0x71df=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x1df7[_0xfc0976];return _0x23579f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x71df('0x0'));module[_0x71df('0x1')]={'closed':{'type':Sequelize[_0x71df('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x71df('0x3')]},'disposition':{'type':Sequelize[_0x71df('0x4')]},'secondDisposition':{'type':Sequelize[_0x71df('0x4')]},'thirdDisposition':{'type':Sequelize[_0x71df('0x4')]},'note':{'type':Sequelize[_0x71df('0x4')]},'phone':{'type':Sequelize[_0x71df('0x4')]},'read1stAt':{'type':Sequelize[_0x71df('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x71df('0x5')]('in',_0x71df('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x71df('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x71df('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x71df('0x7')]}}; \ No newline at end of file +var _0x3149=['INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x225581,_0x226eb5){var _0x4b09f6=function(_0x15846f){while(--_0x15846f){_0x225581['push'](_0x225581['shift']());}};_0x4b09f6(++_0x226eb5);}(_0x3149,0x181));var _0x9314=function(_0xe47eff,_0x10ab50){_0xe47eff=_0xe47eff-0x0;var _0x131d7b=_0x3149[_0xe47eff];return _0x131d7b;};'use strict';var Sequelize=require(_0x9314('0x0'));var moment=require('moment');module[_0x9314('0x1')]={'closed':{'type':Sequelize[_0x9314('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9314('0x3')]},'disposition':{'type':Sequelize[_0x9314('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9314('0x4')]},'note':{'type':Sequelize[_0x9314('0x4')]},'phone':{'type':Sequelize[_0x9314('0x4')]},'read1stAt':{'type':Sequelize[_0x9314('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9314('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9314('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9314('0x5')]('in',_0x9314('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9314('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9314('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 64cf22b..abc7708 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 _0x30e6=['sort','where','pick','filter','$gte','split','format','rows','addTags','ids','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','tmp','transcript-%d-%s.zip','join','User','firstName','Messages','createdAt','read','push','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','YYYY-MM-DD\x20HH:mm:ss','toString','closed','closedAt','disposition','out','System','Contact','lastName','direction','secret','value','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','then','destroy','error','stack','name','index','map','SmsInteraction','rawAttributes','fieldName','type','key','findAll','sms','query','show','params','model','keys','intersection','attributes','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','SmsMessage','omit','getMessages','filters','fields','hasOwnProperty','order'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x30e6,0xab));var _0x630e=function(_0x252421,_0x50d741){_0x252421=_0x252421-0x0;var _0x3dd984=_0x30e6[_0x252421];return _0x3dd984;};'use strict';var rimraf=require(_0x630e('0x0'));var zipdir=require(_0x630e('0x1'));var moment=require(_0x630e('0x2'));var BPromise=require('bluebird');var util=require(_0x630e('0x3'));var path=require('path');var ejs=require(_0x630e('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x630e('0x5'));var interaction=require(_0x630e('0x6'));var qs=require(_0x630e('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x630e('0x8'))(_0x630e('0x9'));var config=require(_0x630e('0xa'));var db=require(_0x630e('0xb'))['db'];config[_0x630e('0xc')]=_[_0x630e('0xd')](config[_0x630e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x630e('0xe'))(new Redis(config[_0x630e('0xc')]));require(_0x630e('0xf'))[_0x630e('0x10')](socket);function respondWithStatusCode(_0x3e308f,_0xec7281){_0xec7281=_0xec7281||0xcc;return function(_0x1154b3){if(_0x1154b3){return _0x3e308f[_0x630e('0x11')](_0xec7281);}return _0x3e308f[_0x630e('0x12')](_0xec7281)[_0x630e('0x13')]();};}function respondWithResult(_0xfcd923,_0xbbf1fa){_0xbbf1fa=_0xbbf1fa||0xc8;return function(_0x397169){if(_0x397169){return _0xfcd923[_0x630e('0x12')](_0xbbf1fa)[_0x630e('0x14')](_0x397169);}};}function respondWithFilteredResult(_0x317041,_0x465b68){return function(_0x520a66){if(_0x520a66){var _0x3e6bfd=typeof _0x465b68['offset']===_0x630e('0x15')&&typeof _0x465b68[_0x630e('0x16')]===_0x630e('0x15');var _0x13368c=_0x520a66[_0x630e('0x17')];var _0x1222d1=_0x3e6bfd?0x0:_0x465b68[_0x630e('0x18')];var _0x121d32=_0x3e6bfd?_0x520a66[_0x630e('0x17')]:_0x465b68[_0x630e('0x18')]+_0x465b68[_0x630e('0x16')];var _0x252b23;if(_0x121d32>=_0x13368c){_0x121d32=_0x13368c;_0x252b23=0xc8;}else{_0x252b23=0xce;}_0x317041['status'](_0x252b23);return _0x317041[_0x630e('0x19')]('Content-Range',_0x1222d1+'-'+_0x121d32+'/'+_0x13368c)[_0x630e('0x14')](_0x520a66);}return null;};}function saveUpdates(_0x48b1dc){return function(_0x3d9e13){if(_0x3d9e13){return _0x3d9e13['update'](_0x48b1dc)[_0x630e('0x1a')](function(_0x21875d){return _0x21875d;});}return null;};}function removeEntity(_0x2b0a97){return function(_0x441f82){if(_0x441f82){return _0x441f82[_0x630e('0x1b')]()[_0x630e('0x1a')](function(){_0x2b0a97[_0x630e('0x12')](0xcc)[_0x630e('0x13')]();});}};}function handleEntityNotFound(_0x369385){return function(_0x52835a){if(!_0x52835a){_0x369385[_0x630e('0x11')](0x194);}return _0x52835a;};}function handleError(_0x394c08,_0x576989){_0x576989=_0x576989||0x1f4;return function(_0x2b41eb){logger[_0x630e('0x1c')](_0x2b41eb[_0x630e('0x1d')]);if(_0x2b41eb[_0x630e('0x1e')]){delete _0x2b41eb[_0x630e('0x1e')];}_0x394c08[_0x630e('0x12')](_0x576989)['send'](_0x2b41eb);};}exports[_0x630e('0x1f')]=function(_0xad9c47,_0x66f9eb){var _0x17c7af={};var _0xe210d=_[_0x630e('0x20')](db[_0x630e('0x21')][_0x630e('0x22')],function(_0x230fc0){return{'name':_0x230fc0[_0x630e('0x23')],'type':_0x230fc0[_0x630e('0x24')][_0x630e('0x25')]};});_0x17c7af=qs['getOptions'](_0xe210d,_0xad9c47);return interaction[_0x630e('0x26')](_0x630e('0x27'),_0xad9c47[_0x630e('0x28')],_0xad9c47['user'],_0x17c7af,_0xe210d)[_0x630e('0x1a')](respondWithFilteredResult(_0x66f9eb,_0x17c7af))['catch'](handleError(_0x66f9eb,null));};exports[_0x630e('0x29')]=function(_0x549993,_0x44a7d8){var _0x30d18f={'raw':![],'where':{'id':_0x549993[_0x630e('0x2a')]['id']}},_0x46a2d4={};_0x46a2d4[_0x630e('0x2b')]=_['keys'](db[_0x630e('0x21')][_0x630e('0x22')]);_0x46a2d4[_0x630e('0x28')]=_[_0x630e('0x2c')](_0x549993[_0x630e('0x28')]);_0x46a2d4['filters']=_[_0x630e('0x2d')](_0x46a2d4[_0x630e('0x2b')],_0x46a2d4[_0x630e('0x28')]);_0x30d18f['attributes']=_[_0x630e('0x2d')](_0x46a2d4[_0x630e('0x2b')],qs['fields'](_0x549993[_0x630e('0x28')]['fields']));_0x30d18f['attributes']=_0x30d18f[_0x630e('0x2e')][_0x630e('0x2f')]?_0x30d18f[_0x630e('0x2e')]:_0x46a2d4[_0x630e('0x2b')];if(_0x549993[_0x630e('0x28')][_0x630e('0x30')]){_0x30d18f[_0x630e('0x31')]=[{'all':!![]}];}_0x30d18f=_[_0x630e('0x32')]({},_0x30d18f,_0x549993[_0x630e('0x33')]);return db[_0x630e('0x21')][_0x630e('0x34')](_0x30d18f)['then'](handleEntityNotFound(_0x44a7d8,null))['then'](respondWithResult(_0x44a7d8,null))[_0x630e('0x35')](handleError(_0x44a7d8,null));};exports[_0x630e('0x36')]=function(_0x22ae0c,_0x29784a){return db[_0x630e('0x21')][_0x630e('0x36')](_0x22ae0c['body'],{})[_0x630e('0x1a')](respondWithResult(_0x29784a,0xc9))[_0x630e('0x35')](handleError(_0x29784a,null));};exports['update']=function(_0x1f469b,_0x42b092){if(_0x1f469b[_0x630e('0x37')]['id']){delete _0x1f469b[_0x630e('0x37')]['id'];}return db[_0x630e('0x21')]['find']({'where':{'id':_0x1f469b[_0x630e('0x2a')]['id']}})[_0x630e('0x1a')](handleEntityNotFound(_0x42b092,null))[_0x630e('0x1a')](saveUpdates(_0x1f469b[_0x630e('0x37')],null))[_0x630e('0x1a')](respondWithResult(_0x42b092,null))['catch'](handleError(_0x42b092,null));};exports[_0x630e('0x1b')]=function(_0xc2b5a3,_0xb33500){return db['SmsInteraction'][_0x630e('0x34')]({'where':{'id':_0xc2b5a3[_0x630e('0x2a')]['id']}})[_0x630e('0x1a')](handleEntityNotFound(_0xb33500,null))[_0x630e('0x1a')](removeEntity(_0xb33500,null))[_0x630e('0x35')](handleError(_0xb33500,null));};exports[_0x630e('0x38')]=function(_0xdee6a,_0x5aa935){return db['SmsInteraction'][_0x630e('0x38')]()['then'](respondWithResult(_0x5aa935,null))[_0x630e('0x35')](handleError(_0x5aa935,null));};exports[_0x630e('0x39')]=function(_0x1c23b8,_0x39b4df){return db[_0x630e('0x3a')][_0x630e('0x34')]({'where':{'id':_0x1c23b8[_0x630e('0x2a')]['id']}})[_0x630e('0x1a')](handleEntityNotFound(_0x39b4df,null))[_0x630e('0x1a')](function(_0x24c3e7){if(_0x24c3e7){return _0x24c3e7[_0x630e('0x39')](_0x1c23b8[_0x630e('0x37')]['ids'],_[_0x630e('0x3b')](_0x1c23b8[_0x630e('0x37')],['ids','id'])||{});}})[_0x630e('0x1a')](respondWithResult(_0x39b4df,null))['catch'](handleError(_0x39b4df,null));};exports[_0x630e('0x3c')]=function(_0x59927c,_0x63a7b0){var _0x2ad589={'raw':![],'where':{}};var _0x36912d={};var _0x3529fe={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x59927c[_0x630e('0x2a')]['id']}})[_0x630e('0x1a')](handleEntityNotFound(_0x63a7b0,null))['then'](function(_0x4e9543){if(_0x4e9543){_0x36912d[_0x630e('0x2b')]=_['keys'](db[_0x630e('0x3a')]['rawAttributes']);_0x36912d['query']=_[_0x630e('0x2c')](_0x59927c[_0x630e('0x28')]);_0x36912d[_0x630e('0x3d')]=_[_0x630e('0x2d')](_0x36912d[_0x630e('0x2b')],_0x36912d[_0x630e('0x28')]);_0x2ad589['attributes']=_[_0x630e('0x2d')](_0x36912d[_0x630e('0x2b')],qs[_0x630e('0x3e')](_0x59927c['query'][_0x630e('0x3e')]));_0x2ad589[_0x630e('0x2e')]=_0x2ad589[_0x630e('0x2e')][_0x630e('0x2f')]?_0x2ad589[_0x630e('0x2e')]:_0x36912d[_0x630e('0x2b')];if(!_0x59927c[_0x630e('0x28')][_0x630e('0x3f')]('nolimit')){_0x2ad589[_0x630e('0x16')]=qs[_0x630e('0x16')](_0x59927c[_0x630e('0x28')][_0x630e('0x16')]);_0x2ad589[_0x630e('0x18')]=qs[_0x630e('0x18')](_0x59927c[_0x630e('0x28')][_0x630e('0x18')]);}_0x2ad589[_0x630e('0x40')]=qs['sort'](_0x59927c[_0x630e('0x28')][_0x630e('0x41')]);_0x2ad589[_0x630e('0x42')]=qs['filters'](_[_0x630e('0x43')](_0x59927c[_0x630e('0x28')],_0x36912d[_0x630e('0x3d')]));_0x2ad589[_0x630e('0x42')]['SmsInteractionId']=_0x4e9543['id'];if(_0x59927c['query'][_0x630e('0x44')]){_0x2ad589[_0x630e('0x42')]=_[_0x630e('0x32')](_0x2ad589[_0x630e('0x42')],{'$or':_[_0x630e('0x20')](_0x2ad589[_0x630e('0x2e')],function(_0x24cd18){var _0x1c7883={};_0x1c7883[_0x24cd18]={'$like':'%'+_0x59927c[_0x630e('0x28')]['filter']+'%'};return _0x1c7883;})});}if(_0x59927c[_0x630e('0x28')][_0x630e('0x45')]){var _0x116483=_0x59927c[_0x630e('0x28')][_0x630e('0x45')][_0x630e('0x46')](',');var _0x120f4f={};_0x120f4f[_0x116483[0x0]]={'$gte':moment(_0x116483[0x1])[_0x630e('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2ad589[_0x630e('0x42')]=_[_0x630e('0x32')](_0x2ad589[_0x630e('0x42')],_0x120f4f);}_0x2ad589=_['merge']({},_0x2ad589,_0x59927c[_0x630e('0x33')]);return db[_0x630e('0x3a')][_0x630e('0x17')]({'where':_0x2ad589['where']})[_0x630e('0x1a')](function(_0x4d97ed){_0x3529fe[_0x630e('0x17')]=_0x4d97ed;if(_0x59927c['query'][_0x630e('0x30')]){_0x2ad589[_0x630e('0x31')]=[{'all':!![]}];}return db[_0x630e('0x3a')]['findAll'](_0x2ad589);})[_0x630e('0x1a')](function(_0x1634b1){_0x3529fe[_0x630e('0x48')]=_0x1634b1;return _0x3529fe;});}})['then'](respondWithFilteredResult(_0x63a7b0,_0x2ad589))['catch'](handleError(_0x63a7b0,null));};exports[_0x630e('0x49')]=function(_0x1ea918,_0x408b77){return db[_0x630e('0x21')][_0x630e('0x34')]({'where':{'id':_0x1ea918[_0x630e('0x2a')]['id']}})[_0x630e('0x1a')](handleEntityNotFound(_0x408b77,null))[_0x630e('0x1a')](function(_0x55902f){if(_0x55902f){return _0x55902f['setTags'](_0x1ea918[_0x630e('0x37')][_0x630e('0x4a')],_['omit'](_0x1ea918[_0x630e('0x37')],[_0x630e('0x4a'),'id'])||{})[_0x630e('0x4b')](function(){return db[_0x630e('0x4c')]['findAll']({'attributes':['id',_0x630e('0x1e'),'color'],'where':{'id':_0x1ea918[_0x630e('0x37')][_0x630e('0x4a')]}});})['then'](function(_0x4ff760){socket[_0x630e('0x4d')](_0x630e('0x4e'),{'id':Number(_0x1ea918[_0x630e('0x2a')]['id']),'tags':_0x4ff760||[]});return{'id':Number(_0x1ea918[_0x630e('0x2a')]['id']),'tags':_0x4ff760||[]};});}})[_0x630e('0x1a')](respondWithResult(_0x408b77,null))[_0x630e('0x35')](handleError(_0x408b77,null));};exports[_0x630e('0x4f')]=function(_0xb65e3,_0x2464c0){return db['SmsInteraction'][_0x630e('0x34')]({'where':{'id':_0xb65e3['params']['id']}})[_0x630e('0x1a')](handleEntityNotFound(_0x2464c0,null))['then'](function(_0x51a223){if(_0x51a223){return _0x51a223[_0x630e('0x4f')](_0xb65e3[_0x630e('0x28')][_0x630e('0x4a')]);}})[_0x630e('0x1a')](respondWithStatusCode(_0x2464c0,null))[_0x630e('0x35')](handleError(_0x2464c0,null));};exports[_0x630e('0x50')]=function(_0x3f8fc5,_0x5d958a){var _0x23177a=moment()[_0x630e('0x51')]()['toString']();var _0x25362c=path['join'](config[_0x630e('0x52')],_0x630e('0x53'),'files',_0x630e('0x54'));var _0x2e5f57=path['join'](_0x25362c,_0x23177a);var _0x3cd13d=util['format'](_0x630e('0x55'),_0x3f8fc5['params']['id'],_0x23177a);var _0x322fc3=path[_0x630e('0x56')](_0x25362c,_0x3cd13d);var _0x572a9a=[];_0x572a9a['push']({'model':db['User'],'as':_0x630e('0x57'),'attributes':['id','fullname'],'raw':!![]});_0x572a9a['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x630e('0x58'),'lastName'],'raw':!![]});var _0x3675ee=[{'model':db[_0x630e('0x3a')],'as':_0x630e('0x59'),'attributes':['id','body',_0x630e('0x5a'),'direction','secret',_0x630e('0x5b')],'include':_0x572a9a}];_0x3675ee[_0x630e('0x5c')]({'model':db[_0x630e('0x5d')],'as':_0x630e('0x5e'),'attributes':['id',_0x630e('0x1e')]});_0x3675ee[_0x630e('0x5c')]({'model':db[_0x630e('0x57')],'as':_0x630e('0x5f'),'attributes':['id',_0x630e('0x60')]});return db['SmsInteraction'][_0x630e('0x34')]({'where':{'id':_0x3f8fc5[_0x630e('0x2a')]['id']},'include':_0x3675ee})[_0x630e('0x1a')](handleEntityNotFound(_0x5d958a,null))[_0x630e('0x1a')](function(_0x2119da){if(_0x2119da){var _0x1dbcc0=_0x2119da[_0x630e('0x61')]({'plain':!![]});fs[_0x630e('0x62')](_0x2e5f57);var _0x586e4c={'channel':_0x630e('0x63'),'account':_0x1dbcc0[_0x630e('0x5e')][_0x630e('0x1e')],'agent':_0x1dbcc0[_0x630e('0x5f')]?_0x1dbcc0[_0x630e('0x5f')][_0x630e('0x60')]:'N.A.','createdAt':moment(_0x1dbcc0[_0x630e('0x5a')])[_0x630e('0x47')](_0x630e('0x64'))[_0x630e('0x65')](),'closedAt':_0x1dbcc0[_0x630e('0x66')]?moment(_0x1dbcc0[_0x630e('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x630e('0x65')]():'','disposition':_0x1dbcc0[_0x630e('0x68')],'messages':_(_0x1dbcc0['Messages'])[_0x630e('0x44')]({'secret':![]})[_0x630e('0x20')](function(_0x59a6a3){return{'date':moment(_0x59a6a3[_0x630e('0x5a')])['format'](_0x630e('0x64'))[_0x630e('0x65')](),'sender':_0x59a6a3['direction']===_0x630e('0x69')?_0x59a6a3[_0x630e('0x57')]?_0x59a6a3[_0x630e('0x57')]['fullname']:_0x630e('0x6a'):_0x59a6a3[_0x630e('0x6b')]['firstName']+(_0x59a6a3['Contact'][_0x630e('0x6c')]?'\x20'+_0x59a6a3[_0x630e('0x6b')][_0x630e('0x6c')]:''),'body':_0x59a6a3[_0x630e('0x37')],'direction':_0x59a6a3[_0x630e('0x6d')]===_0x630e('0x69')?'A':'C','secret':_0x59a6a3[_0x630e('0x6e')],'read':_0x59a6a3['read']};})[_0x630e('0x6f')]()};return ejs['renderFile'](path[_0x630e('0x56')](config['root'],_0x630e('0x53'),_0x630e('0x70'),'downloadInteraction.ejs'),{'interaction':_0x586e4c})[_0x630e('0x1a')](function(_0x4304e3){var _0x158356=path[_0x630e('0x56')](_0x2e5f57,_0x630e('0x71')+_0x1dbcc0['id']+'-'+_0x23177a+_0x630e('0x72'));var _0x35a7d4={'path':_0x158356,'channel':_0x630e('0x63'),'interactionId':_0x1dbcc0['id']};return pdf[_0x630e('0x73')](_0x4304e3,_0x35a7d4);})['then'](function(){return new BPromise(function(_0x5e7f89,_0x54c8fc){zipdir(_0x2e5f57,{'saveTo':_0x322fc3},function(_0x43d61c,_0x58744e){if(_0x43d61c)return _0x54c8fc(_0x43d61c);return _0x5e7f89(_0x58744e);});})['then'](function(){return new BPromise(function(_0x3f07ab,_0x355f94){rimraf(_0x2e5f57,function(_0x45689b){if(_0x45689b)_0x355f94(_0x45689b);return _0x3f07ab();});});})['then'](function(){return _0x5d958a[_0x630e('0x50')](_0x322fc3,_0x3cd13d,function(_0x22ab44){if(_0x22ab44){console['log'](_0x630e('0x74'),_0x22ab44);}else{fs[_0x630e('0x75')](_0x322fc3);}});});});}else{return _0x5d958a[_0x630e('0x11')](0xc8);}})['catch'](handleError(_0x5d958a,null));}; \ No newline at end of file +var _0x992a=['util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./smsInteraction.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','end','error','stack','name','index','map','SmsInteraction','rawAttributes','type','key','getOptions','findAll','sms','query','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','find','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','merge','filter','$gte','split','format','options','rows','addTags','setTags','emit','smsInteractionTags:save','removeTags','download','toString','join','files','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','Messages','direction','read','SmsAccount','Account','fullname','get','mkdirSync','Sms','Owner','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','firstName','lastName','secret','renderFile','root','views','transcript-','.pdf','unlinkSync','rimraf','zip-dir','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x992a,0x1e8));var _0xa992=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x992a[_0x257642];return _0x3d813b;};'use strict';var rimraf=require(_0xa992('0x0'));var zipdir=require(_0xa992('0x1'));var moment=require(_0xa992('0x2'));var BPromise=require(_0xa992('0x3'));var util=require(_0xa992('0x4'));var path=require(_0xa992('0x5'));var ejs=require(_0xa992('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xa992('0x7'));var interaction=require(_0xa992('0x8'));var qs=require(_0xa992('0x9'));var pdf=require(_0xa992('0xa'));var logger=require(_0xa992('0xb'))(_0xa992('0xc'));var config=require(_0xa992('0xd'));var db=require(_0xa992('0xe'))['db'];config[_0xa992('0xf')]=_[_0xa992('0x10')](config[_0xa992('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa992('0xf')]));require(_0xa992('0x11'))[_0xa992('0x12')](socket);function respondWithStatusCode(_0x12fd22,_0x225983){_0x225983=_0x225983||0xcc;return function(_0x59dcf1){if(_0x59dcf1){return _0x12fd22[_0xa992('0x13')](_0x225983);}return _0x12fd22['status'](_0x225983)['end']();};}function respondWithResult(_0x258cc8,_0x24579f){_0x24579f=_0x24579f||0xc8;return function(_0xb346d6){if(_0xb346d6){return _0x258cc8[_0xa992('0x14')](_0x24579f)['json'](_0xb346d6);}};}function respondWithFilteredResult(_0x11a8df,_0x509c5b){return function(_0x43b0f6){if(_0x43b0f6){var _0x4a0b92=typeof _0x509c5b[_0xa992('0x15')]===_0xa992('0x16')&&typeof _0x509c5b['limit']===_0xa992('0x16');var _0x4ab3a6=_0x43b0f6[_0xa992('0x17')];var _0x252e5c=_0x4a0b92?0x0:_0x509c5b[_0xa992('0x15')];var _0x12f023=_0x4a0b92?_0x43b0f6[_0xa992('0x17')]:_0x509c5b[_0xa992('0x15')]+_0x509c5b[_0xa992('0x18')];var _0x1232f4;if(_0x12f023>=_0x4ab3a6){_0x12f023=_0x4ab3a6;_0x1232f4=0xc8;}else{_0x1232f4=0xce;}_0x11a8df[_0xa992('0x14')](_0x1232f4);return _0x11a8df[_0xa992('0x19')](_0xa992('0x1a'),_0x252e5c+'-'+_0x12f023+'/'+_0x4ab3a6)[_0xa992('0x1b')](_0x43b0f6);}return null;};}function saveUpdates(_0x300070){return function(_0x377d82){if(_0x377d82){return _0x377d82[_0xa992('0x1c')](_0x300070)[_0xa992('0x1d')](function(_0x4c88f6){return _0x4c88f6;});}return null;};}function removeEntity(_0x5c4948){return function(_0x35a1ec){if(_0x35a1ec){return _0x35a1ec[_0xa992('0x1e')]()[_0xa992('0x1d')](function(){_0x5c4948['status'](0xcc)[_0xa992('0x1f')]();});}};}function handleEntityNotFound(_0x4e2c41){return function(_0x1921fb){if(!_0x1921fb){_0x4e2c41[_0xa992('0x13')](0x194);}return _0x1921fb;};}function handleError(_0x4040d1,_0x493de2){_0x493de2=_0x493de2||0x1f4;return function(_0xb4fb29){logger[_0xa992('0x20')](_0xb4fb29[_0xa992('0x21')]);if(_0xb4fb29[_0xa992('0x22')]){delete _0xb4fb29['name'];}_0x4040d1['status'](_0x493de2)['send'](_0xb4fb29);};}exports[_0xa992('0x23')]=function(_0x2dcfe6,_0x49fcca){var _0x48c4fd={};var _0x498ab0=_[_0xa992('0x24')](db[_0xa992('0x25')][_0xa992('0x26')],function(_0x393c02){return{'name':_0x393c02['fieldName'],'type':_0x393c02[_0xa992('0x27')][_0xa992('0x28')]};});_0x48c4fd=qs[_0xa992('0x29')](_0x498ab0,_0x2dcfe6);return interaction[_0xa992('0x2a')](_0xa992('0x2b'),_0x2dcfe6[_0xa992('0x2c')],_0x2dcfe6['user'],_0x48c4fd,_0x498ab0)[_0xa992('0x1d')](respondWithFilteredResult(_0x49fcca,_0x48c4fd))[_0xa992('0x2d')](handleError(_0x49fcca,null));};exports[_0xa992('0x2e')]=function(_0x25af99,_0x34c96d){var _0x902089={'raw':![],'where':{'id':_0x25af99[_0xa992('0x2f')]['id']}},_0x68baef={};_0x68baef['model']=_[_0xa992('0x30')](db[_0xa992('0x25')][_0xa992('0x26')]);_0x68baef[_0xa992('0x2c')]=_[_0xa992('0x30')](_0x25af99['query']);_0x68baef[_0xa992('0x31')]=_[_0xa992('0x32')](_0x68baef[_0xa992('0x33')],_0x68baef['query']);_0x902089[_0xa992('0x34')]=_[_0xa992('0x32')](_0x68baef[_0xa992('0x33')],qs[_0xa992('0x35')](_0x25af99[_0xa992('0x2c')][_0xa992('0x35')]));_0x902089[_0xa992('0x34')]=_0x902089[_0xa992('0x34')][_0xa992('0x36')]?_0x902089[_0xa992('0x34')]:_0x68baef[_0xa992('0x33')];if(_0x25af99[_0xa992('0x2c')][_0xa992('0x37')]){_0x902089[_0xa992('0x38')]=[{'all':!![]}];}_0x902089=_['merge']({},_0x902089,_0x25af99['options']);return db[_0xa992('0x25')][_0xa992('0x39')](_0x902089)['then'](handleEntityNotFound(_0x34c96d,null))[_0xa992('0x1d')](respondWithResult(_0x34c96d,null))[_0xa992('0x2d')](handleError(_0x34c96d,null));};exports['create']=function(_0x3643a0,_0x3d6102){return db[_0xa992('0x25')][_0xa992('0x3a')](_0x3643a0[_0xa992('0x3b')],{})[_0xa992('0x1d')](respondWithResult(_0x3d6102,0xc9))[_0xa992('0x2d')](handleError(_0x3d6102,null));};exports['update']=function(_0x1e11c4,_0x115bb5){if(_0x1e11c4['body']['id']){delete _0x1e11c4[_0xa992('0x3b')]['id'];}return db[_0xa992('0x25')][_0xa992('0x39')]({'where':{'id':_0x1e11c4[_0xa992('0x2f')]['id']}})[_0xa992('0x1d')](handleEntityNotFound(_0x115bb5,null))['then'](saveUpdates(_0x1e11c4[_0xa992('0x3b')],null))[_0xa992('0x1d')](respondWithResult(_0x115bb5,null))[_0xa992('0x2d')](handleError(_0x115bb5,null));};exports[_0xa992('0x1e')]=function(_0x4af7d9,_0xb7dbb0){return db[_0xa992('0x25')][_0xa992('0x39')]({'where':{'id':_0x4af7d9['params']['id']}})[_0xa992('0x1d')](handleEntityNotFound(_0xb7dbb0,null))['then'](removeEntity(_0xb7dbb0,null))['catch'](handleError(_0xb7dbb0,null));};exports[_0xa992('0x3c')]=function(_0x52b363,_0x533805){return db[_0xa992('0x25')]['describe']()[_0xa992('0x1d')](respondWithResult(_0x533805,null))[_0xa992('0x2d')](handleError(_0x533805,null));};exports['addMessage']=function(_0x521e5c,_0x519bac){return db[_0xa992('0x3d')][_0xa992('0x39')]({'where':{'id':_0x521e5c[_0xa992('0x2f')]['id']}})[_0xa992('0x1d')](handleEntityNotFound(_0x519bac,null))['then'](function(_0x251843){if(_0x251843){return _0x251843[_0xa992('0x3e')](_0x521e5c['body'][_0xa992('0x3f')],_[_0xa992('0x40')](_0x521e5c['body'],[_0xa992('0x3f'),'id'])||{});}})[_0xa992('0x1d')](respondWithResult(_0x519bac,null))[_0xa992('0x2d')](handleError(_0x519bac,null));};exports[_0xa992('0x41')]=function(_0x1e625e,_0x1810fe){var _0x4bfa61={'raw':![],'where':{}};var _0x181649={};var _0x22ecd1={'count':0x0,'rows':[]};return db[_0xa992('0x25')][_0xa992('0x42')]({'where':{'id':_0x1e625e[_0xa992('0x2f')]['id']}})[_0xa992('0x1d')](handleEntityNotFound(_0x1810fe,null))[_0xa992('0x1d')](function(_0x40155c){if(_0x40155c){_0x181649[_0xa992('0x33')]=_[_0xa992('0x30')](db[_0xa992('0x3d')]['rawAttributes']);_0x181649[_0xa992('0x2c')]=_[_0xa992('0x30')](_0x1e625e[_0xa992('0x2c')]);_0x181649[_0xa992('0x31')]=_[_0xa992('0x32')](_0x181649[_0xa992('0x33')],_0x181649[_0xa992('0x2c')]);_0x4bfa61['attributes']=_['intersection'](_0x181649['model'],qs[_0xa992('0x35')](_0x1e625e[_0xa992('0x2c')][_0xa992('0x35')]));_0x4bfa61[_0xa992('0x34')]=_0x4bfa61[_0xa992('0x34')]['length']?_0x4bfa61[_0xa992('0x34')]:_0x181649[_0xa992('0x33')];if(!_0x1e625e['query'][_0xa992('0x43')](_0xa992('0x44'))){_0x4bfa61[_0xa992('0x18')]=qs[_0xa992('0x18')](_0x1e625e[_0xa992('0x2c')]['limit']);_0x4bfa61[_0xa992('0x15')]=qs[_0xa992('0x15')](_0x1e625e['query'][_0xa992('0x15')]);}_0x4bfa61[_0xa992('0x45')]=qs[_0xa992('0x46')](_0x1e625e[_0xa992('0x2c')][_0xa992('0x46')]);_0x4bfa61[_0xa992('0x47')]=qs[_0xa992('0x31')](_[_0xa992('0x48')](_0x1e625e[_0xa992('0x2c')],_0x181649[_0xa992('0x31')]));_0x4bfa61[_0xa992('0x47')][_0xa992('0x49')]=_0x40155c['id'];if(_0x1e625e[_0xa992('0x2c')]['filter']){_0x4bfa61[_0xa992('0x47')]=_[_0xa992('0x4a')](_0x4bfa61[_0xa992('0x47')],{'$or':_[_0xa992('0x24')](_0x4bfa61[_0xa992('0x34')],function(_0x21c07e){var _0x4e815e={};_0x4e815e[_0x21c07e]={'$like':'%'+_0x1e625e[_0xa992('0x2c')][_0xa992('0x4b')]+'%'};return _0x4e815e;})});}if(_0x1e625e['query'][_0xa992('0x4c')]){var _0x29e6f2=_0x1e625e['query'][_0xa992('0x4c')][_0xa992('0x4d')](',');var _0x3fdfab={};_0x3fdfab[_0x29e6f2[0x0]]={'$gte':moment(_0x29e6f2[0x1])[_0xa992('0x4e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4bfa61[_0xa992('0x47')]=_['merge'](_0x4bfa61[_0xa992('0x47')],_0x3fdfab);}_0x4bfa61=_[_0xa992('0x4a')]({},_0x4bfa61,_0x1e625e[_0xa992('0x4f')]);return db[_0xa992('0x3d')]['count']({'where':_0x4bfa61['where']})[_0xa992('0x1d')](function(_0x5a99bc){_0x22ecd1['count']=_0x5a99bc;if(_0x1e625e[_0xa992('0x2c')][_0xa992('0x37')]){_0x4bfa61[_0xa992('0x38')]=[{'all':!![]}];}return db[_0xa992('0x3d')][_0xa992('0x2a')](_0x4bfa61);})[_0xa992('0x1d')](function(_0x52f46f){_0x22ecd1[_0xa992('0x50')]=_0x52f46f;return _0x22ecd1;});}})[_0xa992('0x1d')](respondWithFilteredResult(_0x1810fe,_0x4bfa61))[_0xa992('0x2d')](handleError(_0x1810fe,null));};exports[_0xa992('0x51')]=function(_0x39d69f,_0x2227ab){return db['SmsInteraction']['find']({'where':{'id':_0x39d69f[_0xa992('0x2f')]['id']}})[_0xa992('0x1d')](handleEntityNotFound(_0x2227ab,null))['then'](function(_0x3a7a46){if(_0x3a7a46){return _0x3a7a46[_0xa992('0x52')](_0x39d69f[_0xa992('0x3b')][_0xa992('0x3f')],_[_0xa992('0x40')](_0x39d69f[_0xa992('0x3b')],[_0xa992('0x3f'),'id'])||{})['spread'](function(){return db['Tag'][_0xa992('0x2a')]({'attributes':['id','name','color'],'where':{'id':_0x39d69f[_0xa992('0x3b')][_0xa992('0x3f')]}});})[_0xa992('0x1d')](function(_0x2294f3){socket[_0xa992('0x53')](_0xa992('0x54'),{'id':Number(_0x39d69f['params']['id']),'tags':_0x2294f3||[]});return{'id':Number(_0x39d69f[_0xa992('0x2f')]['id']),'tags':_0x2294f3||[]};});}})['then'](respondWithResult(_0x2227ab,null))[_0xa992('0x2d')](handleError(_0x2227ab,null));};exports[_0xa992('0x55')]=function(_0x5a9ed9,_0x5210bb){return db[_0xa992('0x25')][_0xa992('0x39')]({'where':{'id':_0x5a9ed9[_0xa992('0x2f')]['id']}})[_0xa992('0x1d')](handleEntityNotFound(_0x5210bb,null))[_0xa992('0x1d')](function(_0x362de5){if(_0x362de5){return _0x362de5['removeTags'](_0x5a9ed9[_0xa992('0x2c')][_0xa992('0x3f')]);}})[_0xa992('0x1d')](respondWithStatusCode(_0x5210bb,null))[_0xa992('0x2d')](handleError(_0x5210bb,null));};exports[_0xa992('0x56')]=function(_0xc7456f,_0x23d284){var _0x5c0e1f=moment()['unix']()[_0xa992('0x57')]();var _0x758b3c=path[_0xa992('0x58')](config['root'],'server',_0xa992('0x59'),_0xa992('0x5a'));var _0x43f595=path[_0xa992('0x58')](_0x758b3c,_0x5c0e1f);var _0x2bded0=util['format'](_0xa992('0x5b'),_0xc7456f[_0xa992('0x2f')]['id'],_0x5c0e1f);var _0x3e835c=path['join'](_0x758b3c,_0x2bded0);var _0x3ef622=[];_0x3ef622[_0xa992('0x5c')]({'model':db[_0xa992('0x5d')],'as':_0xa992('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x3ef622[_0xa992('0x5c')]({'model':db[_0xa992('0x5e')],'as':_0xa992('0x5f'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0xf76f23=[{'model':db[_0xa992('0x3d')],'as':_0xa992('0x60'),'attributes':['id',_0xa992('0x3b'),'createdAt',_0xa992('0x61'),'secret',_0xa992('0x62')],'include':_0x3ef622}];_0xf76f23[_0xa992('0x5c')]({'model':db[_0xa992('0x63')],'as':_0xa992('0x64'),'attributes':['id',_0xa992('0x22')]});_0xf76f23['push']({'model':db[_0xa992('0x5d')],'as':'Owner','attributes':['id',_0xa992('0x65')]});return db['SmsInteraction'][_0xa992('0x39')]({'where':{'id':_0xc7456f['params']['id']},'include':_0xf76f23})[_0xa992('0x1d')](handleEntityNotFound(_0x23d284,null))['then'](function(_0x322448){if(_0x322448){var _0x586383=_0x322448[_0xa992('0x66')]({'plain':!![]});fs[_0xa992('0x67')](_0x43f595);var _0x1dd588={'channel':_0xa992('0x68'),'account':_0x586383[_0xa992('0x64')][_0xa992('0x22')],'agent':_0x586383[_0xa992('0x69')]?_0x586383[_0xa992('0x69')]['fullname']:_0xa992('0x6a'),'createdAt':moment(_0x586383[_0xa992('0x6b')])[_0xa992('0x4e')](_0xa992('0x6c'))[_0xa992('0x57')](),'closedAt':_0x586383[_0xa992('0x6d')]?moment(_0x586383[_0xa992('0x6e')])[_0xa992('0x4e')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x586383[_0xa992('0x6f')],'messages':_(_0x586383[_0xa992('0x60')])['filter']({'secret':![]})[_0xa992('0x24')](function(_0x389440){return{'date':moment(_0x389440[_0xa992('0x6b')])[_0xa992('0x4e')](_0xa992('0x6c'))['toString'](),'sender':_0x389440['direction']===_0xa992('0x70')?_0x389440[_0xa992('0x5d')]?_0x389440[_0xa992('0x5d')][_0xa992('0x65')]:_0xa992('0x71'):_0x389440[_0xa992('0x5f')][_0xa992('0x72')]+(_0x389440['Contact'][_0xa992('0x73')]?'\x20'+_0x389440[_0xa992('0x5f')]['lastName']:''),'body':_0x389440[_0xa992('0x3b')],'direction':_0x389440['direction']===_0xa992('0x70')?'A':'C','secret':_0x389440[_0xa992('0x74')],'read':_0x389440[_0xa992('0x62')]};})['value']()};return ejs[_0xa992('0x75')](path[_0xa992('0x58')](config[_0xa992('0x76')],'server',_0xa992('0x77'),'downloadInteraction.ejs'),{'interaction':_0x1dd588})[_0xa992('0x1d')](function(_0x452f01){var _0x596893=path[_0xa992('0x58')](_0x43f595,_0xa992('0x78')+_0x586383['id']+'-'+_0x5c0e1f+_0xa992('0x79'));var _0x14907f={'path':_0x596893,'channel':_0xa992('0x68'),'interactionId':_0x586383['id']};return pdf['createPdfFromHTML'](_0x452f01,_0x14907f);})['then'](function(){return new BPromise(function(_0x1a7c44,_0x19cb8){zipdir(_0x43f595,{'saveTo':_0x3e835c},function(_0x15b516,_0x59a0fc){if(_0x15b516)return _0x19cb8(_0x15b516);return _0x1a7c44(_0x59a0fc);});})['then'](function(){return new BPromise(function(_0x43a233,_0x166072){rimraf(_0x43f595,function(_0x4a0a05){if(_0x4a0a05)_0x166072(_0x4a0a05);return _0x43a233();});});})[_0xa992('0x1d')](function(){return _0x23d284['download'](_0x3e835c,_0x2bded0,function(_0x50c375){if(_0x50c375){console['log']('err',_0x50c375);}else{fs[_0xa992('0x7a')](_0x3e835c);}});});});}else{return _0x23d284[_0xa992('0x13')](0xc8);}})[_0xa992('0x2d')](handleError(_0x23d284,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 1e0df61..7bc715b 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 _0xb016=['setDataValue','Users','findAll','then','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','save','update','remove','getUsers'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xb016,0x159));var _0x6b01=function(_0xc55a42,_0x449785){_0xc55a42=_0xc55a42-0x0;var _0x4b5461=_0xb016[_0xc55a42];return _0x4b5461;};'use strict';var EventEmitter=require(_0x6b01('0x0'));var SmsInteraction=require(_0x6b01('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x6b01('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b01('0x3'),'afterUpdate':_0x6b01('0x4'),'afterDestroy':_0x6b01('0x5')};function emitEvent(_0x3b9de1){return function(_0x5964ca,_0x1b7dd6,_0x65407a){_0x5964ca[_0x6b01('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5c5bfb){_0x5964ca[_0x6b01('0x7')](_0x6b01('0x8'),_0x5c5bfb['map'](function(_0x5f4636){return{'id':_0x5f4636['id']};}));return SmsMessage[_0x6b01('0x9')]({'where':{'SmsInteractionId':_0x5964ca['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6b01('0xa')](function(_0x2c4e48){_0x5964ca[_0x6b01('0x7')](_0x6b01('0xb'),_0x2c4e48['length']);SmsInteractionEvents['emit'](_0x3b9de1+':'+_0x5964ca['id'],_0x5964ca);SmsInteractionEvents[_0x6b01('0xc')](_0x3b9de1,_0x5964ca);_0x65407a(null);})[_0x6b01('0xd')](_0x65407a(null));};}for(var e in events){if(events[_0x6b01('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x6b01('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x0598=['catch','hasOwnProperty','events','../../mysqldb','save','update','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x292bca,_0x18018c){var _0x540dfa=function(_0x40d303){while(--_0x40d303){_0x292bca['push'](_0x292bca['shift']());}};_0x540dfa(++_0x18018c);}(_0x0598,0x92));var _0x8059=function(_0x4abfd2,_0x42cc8a){_0x4abfd2=_0x4abfd2-0x0;var _0x4a855b=_0x0598[_0x4abfd2];return _0x4a855b;};'use strict';var EventEmitter=require(_0x8059('0x0'));var SmsInteraction=require(_0x8059('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8059('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8059('0x2'),'afterUpdate':_0x8059('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54f42f){return function(_0x555fb5,_0x467206,_0xa7d7c1){_0x555fb5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x248273){_0x555fb5[_0x8059('0x4')](_0x8059('0x5'),_0x248273[_0x8059('0x6')](function(_0x5df268){return{'id':_0x5df268['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x555fb5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8059('0x7')](function(_0x1bf5fd){_0x555fb5[_0x8059('0x4')](_0x8059('0x8'),_0x1bf5fd[_0x8059('0x9')]);SmsInteractionEvents['emit'](_0x54f42f+':'+_0x555fb5['id'],_0x555fb5);SmsInteractionEvents['emit'](_0x54f42f,_0x555fb5);_0xa7d7c1(null);})[_0x8059('0xa')](_0xa7d7c1(null));};}for(var e in events){if(events[_0x8059('0xb')](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 d1da53d..c459c9e 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 _0x26bd=['SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','path','./smsInteraction.attributes','exports','define'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x26bd,0x18e));var _0xd26b=function(_0x10b4a4,_0x26101d){_0x10b4a4=_0x10b4a4-0x0;var _0x54b584=_0x26bd[_0x10b4a4];return _0x54b584;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd26b('0x0'));var moment=require(_0xd26b('0x1'));var BPromise=require(_0xd26b('0x2'));var rp=require(_0xd26b('0x3'));var fs=require('fs');var path=require(_0xd26b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd26b('0x5'));module[_0xd26b('0x6')]=function(_0x370fe8,_0x9e08e8){return _0x370fe8[_0xd26b('0x7')](_0xd26b('0x8'),attributes,{'tableName':_0xd26b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x897da5,_0x11d444,_0x7e3b2c){if(_0x897da5['changed'](_0xd26b('0xa'))){_0x897da5[_0xd26b('0xb')]=moment()[_0xd26b('0xc')](_0xd26b('0xd'));}_0x7e3b2c(null,_0x897da5);}}});}; \ No newline at end of file +var _0xbd44=['SmsInteraction','sms_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0xbd44,0xdc));var _0x4bd4=function(_0x4be38f,_0x5eacec){_0x4be38f=_0x4be38f-0x0;var _0x2d3cd3=_0xbd44[_0x4be38f];return _0x2d3cd3;};'use strict';var _=require(_0x4bd4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4bd4('0x1'));var moment=require(_0x4bd4('0x2'));var BPromise=require(_0x4bd4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bd4('0x4'));var rimraf=require(_0x4bd4('0x5'));var config=require(_0x4bd4('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x33f825,_0x4162bf){return _0x33f825[_0x4bd4('0x7')](_0x4bd4('0x8'),attributes,{'tableName':_0x4bd4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e0784,_0x31d572,_0x2d3517){if(_0x2e0784['changed']('closed')){_0x2e0784[_0x4bd4('0xa')]=moment()['format'](_0x4bd4('0xb'));}_0x2d3517(null,_0x2e0784);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 06f5459..cbcf27f 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 _0xb57b=['SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','update','body','raw','options','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','find','where','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then'];(function(_0x26f328,_0x41a628){var _0x341726=function(_0x213539){while(--_0x213539){_0x26f328['push'](_0x26f328['shift']());}};_0x341726(++_0x41a628);}(_0xb57b,0x9f));var _0xbb57=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xb57b[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xbb57('0x0'));var util=require(_0xbb57('0x1'));var moment=require(_0xbb57('0x2'));var BPromise=require(_0xbb57('0x3'));var rs=require(_0xbb57('0x4'));var fs=require('fs');var Redis=require(_0xbb57('0x5'));var db=require(_0xbb57('0x6'))['db'];var utils=require(_0xbb57('0x7'));var logger=require(_0xbb57('0x8'))(_0xbb57('0x9'));var config=require(_0xbb57('0xa'));var jayson=require(_0xbb57('0xb'));var client=jayson[_0xbb57('0xc')][_0xbb57('0xd')]({'port':0x232a});config[_0xbb57('0xe')]=_[_0xbb57('0xf')](config[_0xbb57('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb57('0x10'))(new Redis(config['redis']));require(_0xbb57('0x11'))[_0xbb57('0x12')](socket);function respondWithRpcPromise(_0x41951e,_0x5adc5a,_0x396d65){return new BPromise(function(_0x107262,_0x33d1e0){return client[_0xbb57('0x13')](_0x41951e,_0x396d65)[_0xbb57('0x14')](function(_0xa5676f){logger['info'](_0xbb57('0x15'),_0x5adc5a,'request\x20sent');logger[_0xbb57('0x16')](_0xbb57('0x17'),_0x5adc5a,_0xbb57('0x18'),JSON[_0xbb57('0x19')](_0xa5676f));if(_0xa5676f[_0xbb57('0x1a')]){if(_0xa5676f[_0xbb57('0x1a')][_0xbb57('0x1b')]===0x1f4){logger['error'](_0xbb57('0x15'),_0x5adc5a,_0xa5676f[_0xbb57('0x1a')]['message']);return _0x33d1e0(_0xa5676f[_0xbb57('0x1a')][_0xbb57('0x1c')]);}logger[_0xbb57('0x1a')](_0xbb57('0x15'),_0x5adc5a,_0xa5676f[_0xbb57('0x1a')][_0xbb57('0x1c')]);return _0x107262(_0xa5676f[_0xbb57('0x1a')][_0xbb57('0x1c')]);}else{logger[_0xbb57('0x1d')](_0xbb57('0x15'),_0x5adc5a,_0xbb57('0x18'));_0x107262(_0xa5676f[_0xbb57('0x1e')][_0xbb57('0x1c')]);}})[_0xbb57('0x1f')](function(_0x211cc2){logger[_0xbb57('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x5adc5a,_0x211cc2);_0x33d1e0(_0x211cc2);});});}exports['UpdateSmsInteraction']=function(_0x1a3a78){var _0x5b874a=this;return new Promise(function(_0x4dfa8c,_0x39edf3){return db['SmsInteraction'][_0xbb57('0x20')](_0x1a3a78[_0xbb57('0x21')],{'raw':_0x1a3a78['options']?_0x1a3a78['options'][_0xbb57('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a3a78[_0xbb57('0x23')]?_0x1a3a78['options']['where']||null:null,'attributes':_0x1a3a78[_0xbb57('0x23')]?_0x1a3a78[_0xbb57('0x23')][_0xbb57('0x24')]||null:null,'limit':_0x1a3a78[_0xbb57('0x23')]?_0x1a3a78[_0xbb57('0x23')][_0xbb57('0x25')]||null:null})[_0xbb57('0x14')](function(_0x542da6){logger['info'](_0xbb57('0x26'),_0x1a3a78);logger[_0xbb57('0x16')](_0xbb57('0x26'),_0x1a3a78,JSON[_0xbb57('0x19')](_0x542da6));_0x4dfa8c(_0x542da6);})['catch'](function(_0x4ff91f){logger[_0xbb57('0x1a')]('UpdateSmsInteraction',_0x4ff91f[_0xbb57('0x1c')],_0x1a3a78);_0x39edf3(_0x5b874a['error'](0x1f4,_0x4ff91f[_0xbb57('0x1c')]));});});};exports[_0xbb57('0x27')]=function(_0x3229d9){return new Promise(function(_0x2a43e4,_0xb0ef65){return db[_0xbb57('0x28')][_0xbb57('0x29')]({'where':_0x3229d9[_0xbb57('0x23')]?_0x3229d9[_0xbb57('0x23')][_0xbb57('0x2a')]||null:null})[_0xbb57('0x14')](function(_0x48355f){if(_0x48355f){return _0x48355f['addTags'](_0x3229d9[_0xbb57('0x21')][_0xbb57('0x2b')],_['omit'](_0x3229d9[_0xbb57('0x21')],[_0xbb57('0x2b'),'id'])||{});}})['spread'](function(_0x5f23c0){logger[_0xbb57('0x1d')](_0xbb57('0x2c'),_0x3229d9);logger[_0xbb57('0x16')](_0xbb57('0x2c'),_0x3229d9,JSON[_0xbb57('0x19')](_0x5f23c0));_0x2a43e4(_0x5f23c0);})[_0xbb57('0x1f')](function(_0x69d3bd){logger[_0xbb57('0x1a')](_0xbb57('0x2c'),_0x69d3bd[_0xbb57('0x1c')],_0x3229d9);_0xb0ef65(_this[_0xbb57('0x1a')](0x1f4,_0x69d3bd['message']));});});}; \ No newline at end of file +var _0x1cf8=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5c50ca,_0x1f1634){var _0x58652f=function(_0x47f8c3){while(--_0x47f8c3){_0x5c50ca['push'](_0x5c50ca['shift']());}};_0x58652f(++_0x1f1634);}(_0x1cf8,0xfc));var _0x81cf=function(_0x39c65b,_0x4b5a02){_0x39c65b=_0x39c65b-0x0;var _0x487fee=_0x1cf8[_0x39c65b];return _0x487fee;};'use strict';var _=require(_0x81cf('0x0'));var util=require(_0x81cf('0x1'));var moment=require(_0x81cf('0x2'));var BPromise=require(_0x81cf('0x3'));var rs=require(_0x81cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81cf('0x5'))['db'];var utils=require(_0x81cf('0x6'));var logger=require('../../config/logger')(_0x81cf('0x7'));var config=require(_0x81cf('0x8'));var jayson=require(_0x81cf('0x9'));var client=jayson[_0x81cf('0xa')][_0x81cf('0xb')]({'port':0x232a});config['redis']=_[_0x81cf('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x81cf('0xd'))(new Redis(config['redis']));require(_0x81cf('0xe'))[_0x81cf('0xf')](socket);function respondWithRpcPromise(_0x5d69be,_0x5eff52,_0x4fd5d6){return new BPromise(function(_0x14847d,_0x210882){return client[_0x81cf('0x10')](_0x5d69be,_0x4fd5d6)[_0x81cf('0x11')](function(_0x12d0bf){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x5eff52,_0x81cf('0x12'));logger[_0x81cf('0x13')](_0x81cf('0x14'),_0x5eff52,_0x81cf('0x12'),JSON[_0x81cf('0x15')](_0x12d0bf));if(_0x12d0bf[_0x81cf('0x16')]){if(_0x12d0bf['error']['code']===0x1f4){logger[_0x81cf('0x16')](_0x81cf('0x17'),_0x5eff52,_0x12d0bf[_0x81cf('0x16')]['message']);return _0x210882(_0x12d0bf[_0x81cf('0x16')][_0x81cf('0x18')]);}logger[_0x81cf('0x16')](_0x81cf('0x17'),_0x5eff52,_0x12d0bf['error']['message']);return _0x14847d(_0x12d0bf[_0x81cf('0x16')][_0x81cf('0x18')]);}else{logger[_0x81cf('0x19')](_0x81cf('0x17'),_0x5eff52,'request\x20sent');_0x14847d(_0x12d0bf[_0x81cf('0x1a')][_0x81cf('0x18')]);}})[_0x81cf('0x1b')](function(_0x40c5b0){logger[_0x81cf('0x16')](_0x81cf('0x17'),_0x5eff52,_0x40c5b0);_0x210882(_0x40c5b0);});});}exports[_0x81cf('0x1c')]=function(_0x3b74d7){var _0x27e991=this;return new Promise(function(_0x3070a1,_0x5b890f){return db[_0x81cf('0x1d')][_0x81cf('0x1e')](_0x3b74d7[_0x81cf('0x1f')],{'raw':_0x3b74d7[_0x81cf('0x20')]?_0x3b74d7[_0x81cf('0x20')][_0x81cf('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b74d7[_0x81cf('0x20')]?_0x3b74d7[_0x81cf('0x20')][_0x81cf('0x22')]||null:null,'attributes':_0x3b74d7[_0x81cf('0x20')]?_0x3b74d7[_0x81cf('0x20')][_0x81cf('0x23')]||null:null,'limit':_0x3b74d7[_0x81cf('0x20')]?_0x3b74d7[_0x81cf('0x20')][_0x81cf('0x24')]||null:null})[_0x81cf('0x11')](function(_0x2e4003){logger[_0x81cf('0x19')](_0x81cf('0x1c'),_0x3b74d7);logger[_0x81cf('0x13')](_0x81cf('0x1c'),_0x3b74d7,JSON[_0x81cf('0x15')](_0x2e4003));_0x3070a1(_0x2e4003);})[_0x81cf('0x1b')](function(_0x4e0acd){logger['error'](_0x81cf('0x1c'),_0x4e0acd[_0x81cf('0x18')],_0x3b74d7);_0x5b890f(_0x27e991['error'](0x1f4,_0x4e0acd['message']));});});};exports[_0x81cf('0x25')]=function(_0x18ff90){return new Promise(function(_0x18a12f,_0x4cc5c6){return db[_0x81cf('0x1d')][_0x81cf('0x26')]({'where':_0x18ff90['options']?_0x18ff90[_0x81cf('0x20')][_0x81cf('0x22')]||null:null})[_0x81cf('0x11')](function(_0x37952b){if(_0x37952b){return _0x37952b[_0x81cf('0x27')](_0x18ff90[_0x81cf('0x1f')][_0x81cf('0x28')],_[_0x81cf('0x29')](_0x18ff90[_0x81cf('0x1f')],[_0x81cf('0x28'),'id'])||{});}})['spread'](function(_0x7e5b1){logger['info'](_0x81cf('0x2a'),_0x18ff90);logger[_0x81cf('0x13')](_0x81cf('0x2a'),_0x18ff90,JSON[_0x81cf('0x15')](_0x7e5b1));_0x18a12f(_0x7e5b1);})[_0x81cf('0x1b')](function(_0x1d6d24){logger[_0x81cf('0x16')]('AddTags',_0x1d6d24[_0x81cf('0x18')],_0x18ff90);_0x4cc5c6(_this['error'](0x1f4,_0x1d6d24[_0x81cf('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 287c005..0e07d08 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 _0x2cd0=['./smsInteraction.events','save','remove','emit','length','smsInteraction:'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x2cd0,0x120));var _0x02cd=function(_0x1329ae,_0x28f239){_0x1329ae=_0x1329ae-0x0;var _0x1129cb=_0x2cd0[_0x1329ae];return _0x1129cb;};'use strict';var SmsInteractionEvents=require(_0x02cd('0x0'));var events=[_0x02cd('0x1'),_0x02cd('0x2'),'update'];function createListener(_0x5c083d,_0x15c4af){return function(_0x339af0){_0x15c4af[_0x02cd('0x3')](_0x5c083d,_0x339af0);};}function removeListener(_0x2b0162,_0x595948){return function(){SmsInteractionEvents['removeListener'](_0x2b0162,_0x595948);};}exports['register']=function(_0x857e09){for(var _0x2f1021=0x0,_0x2a5c8b=events[_0x02cd('0x4')];_0x2f1021<_0x2a5c8b;_0x2f1021++){var _0x83711c=events[_0x2f1021];var _0x4db0d0=createListener(_0x02cd('0x5')+_0x83711c,_0x857e09);SmsInteractionEvents['on'](_0x83711c,_0x4db0d0);}}; \ No newline at end of file +var _0xd97e=['./smsInteraction.events','save','remove','update','emit','register','length','smsInteraction:'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xd97e,0xa8));var _0xed97=function(_0x58eb87,_0x642cf7){_0x58eb87=_0x58eb87-0x0;var _0x30e7d8=_0xd97e[_0x58eb87];return _0x30e7d8;};'use strict';var SmsInteractionEvents=require(_0xed97('0x0'));var events=[_0xed97('0x1'),_0xed97('0x2'),_0xed97('0x3')];function createListener(_0xd268a2,_0x351178){return function(_0x440437){_0x351178[_0xed97('0x4')](_0xd268a2,_0x440437);};}function removeListener(_0x137877,_0x442430){return function(){SmsInteractionEvents['removeListener'](_0x137877,_0x442430);};}exports[_0xed97('0x5')]=function(_0x408dd0){for(var _0x22e288=0x0,_0x47b572=events[_0xed97('0x6')];_0x22e288<_0x47b572;_0x22e288++){var _0x220606=events[_0x22e288];var _0x5482c3=createListener(_0xed97('0x7')+_0x220606,_0x408dd0);SmsInteractionEvents['on'](_0x220606,_0x5482c3);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index cf7c895..efe93da 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 _0x68ab=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','post','tracked','sms','smsmessage:create','create','status','put','update','/:id/accept','accept','reject','delete'];(function(_0x6f2de0,_0x3ab709){var _0x2f1587=function(_0x512687){while(--_0x512687){_0x6f2de0['push'](_0x6f2de0['shift']());}};_0x2f1587(++_0x3ab709);}(_0x68ab,0x76));var _0xb68a=function(_0x4e28c0,_0x1ef470){_0x4e28c0=_0x4e28c0-0x0;var _0x4039d4=_0x68ab[_0x4e28c0];return _0x4039d4;};'use strict';var multer=require(_0xb68a('0x0'));var util=require(_0xb68a('0x1'));var path=require(_0xb68a('0x2'));var timeout=require(_0xb68a('0x3'));var express=require(_0xb68a('0x4'));var router=express[_0xb68a('0x5')]();var fs_extra=require(_0xb68a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb68a('0x7'));var controller=require(_0xb68a('0x8'));router[_0xb68a('0x9')]('/',auth['isAuthenticated'](),controller[_0xb68a('0xa')]);router[_0xb68a('0x9')](_0xb68a('0xb'),auth[_0xb68a('0xc')](),controller[_0xb68a('0xd')]);router[_0xb68a('0x9')](_0xb68a('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xb68a('0xf')]('/',auth[_0xb68a('0xc')](),interaction[_0xb68a('0x10')](_0xb68a('0x11'),_0xb68a('0x12')),controller[_0xb68a('0x13')]);router[_0xb68a('0xf')]('/:id/status',controller[_0xb68a('0x14')]);router[_0xb68a('0x15')](_0xb68a('0xe'),auth['isAuthenticated'](),controller[_0xb68a('0x16')]);router[_0xb68a('0x15')](_0xb68a('0x17'),auth[_0xb68a('0xc')](),controller[_0xb68a('0x18')]);router[_0xb68a('0x15')]('/:id/reject',auth[_0xb68a('0xc')](),controller[_0xb68a('0x19')]);router[_0xb68a('0x1a')](_0xb68a('0xe'),auth[_0xb68a('0xc')](),controller[_0xb68a('0x1b')]);module[_0xb68a('0x1c')]=router; \ No newline at end of file +var _0xd920=['index','get','/describe','describe','show','tracked','sms','smsmessage:create','create','status','put','/:id','update','/:id/accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd920,0x1ee));var _0x0d92=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xd920[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require('multer');var util=require(_0x0d92('0x0'));var path=require(_0x0d92('0x1'));var timeout=require(_0x0d92('0x2'));var express=require(_0x0d92('0x3'));var router=express[_0x0d92('0x4')]();var fs_extra=require(_0x0d92('0x5'));var auth=require(_0x0d92('0x6'));var interaction=require(_0x0d92('0x7'));var config=require('../../config/environment');var controller=require(_0x0d92('0x8'));router['get']('/',auth[_0x0d92('0x9')](),controller[_0x0d92('0xa')]);router[_0x0d92('0xb')](_0x0d92('0xc'),auth[_0x0d92('0x9')](),controller[_0x0d92('0xd')]);router['get']('/:id',auth[_0x0d92('0x9')](),controller[_0x0d92('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x0d92('0xf')](_0x0d92('0x10'),_0x0d92('0x11')),controller[_0x0d92('0x12')]);router['post']('/:id/status',controller[_0x0d92('0x13')]);router[_0x0d92('0x14')](_0x0d92('0x15'),auth[_0x0d92('0x9')](),controller[_0x0d92('0x16')]);router[_0x0d92('0x14')](_0x0d92('0x17'),auth[_0x0d92('0x9')](),controller['accept']);router['put'](_0x0d92('0x18'),auth[_0x0d92('0x9')](),controller[_0x0d92('0x19')]);router['delete'](_0x0d92('0x15'),auth[_0x0d92('0x9')](),controller[_0x0d92('0x1a')]);module[_0x0d92('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index bb1697d..8667447 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 _0xe5e0=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x3098a7,_0x490909){var _0x530a7b=function(_0x4c7074){while(--_0x4c7074){_0x3098a7['push'](_0x3098a7['shift']());}};_0x530a7b(++_0x490909);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x4941d8,_0x11eed8){_0x4941d8=_0x4941d8-0x0;var _0x165f71=_0xe5e0[_0x4941d8];return _0x165f71;};'use strict';var Sequelize=require(_0x0e5e('0x0'));module[_0x0e5e('0x1')]={'body':{'type':Sequelize[_0x0e5e('0x2')](_0x0e5e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0e5e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0e5e('0x5')]('in',_0x0e5e('0x6')),'defaultValue':_0x0e5e('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0e5e('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0e5e('0x8')]},'secret':{'type':Sequelize[_0x0e5e('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0e5e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf089=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0xf089,0x1a9));var _0x9f08=function(_0x3660d4,_0x2670ee){_0x3660d4=_0x3660d4-0x0;var _0x31709b=_0xf089[_0x3660d4];return _0x31709b;};'use strict';var Sequelize=require('sequelize');module[_0x9f08('0x0')]={'body':{'type':Sequelize[_0x9f08('0x1')](_0x9f08('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9f08('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9f08('0x4')]('in',_0x9f08('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9f08('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9f08('0x6')]},'readAt':{'type':Sequelize[_0x9f08('0x7')]},'secret':{'type':Sequelize[_0x9f08('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9f08('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 10245c2..c25e34c 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 _0x8e81=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','SmsMessage','includeAll','include','findAll','show','params','length','merge','find','create','body','update','describe','accept','sms','acceptMessage','UserId','agent','SmsInteractionId','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','interface','SIP/%s','motionChannel','channel','event','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','infobip','results','groupName','DELIVERED','util','lodash','ioredis','../../components/interaction/service'];(function(_0x524bc5,_0x1fad5c){var _0x37dca6=function(_0x5d3d5f){while(--_0x5d3d5f){_0x524bc5['push'](_0x524bc5['shift']());}};_0x37dca6(++_0x1fad5c);}(_0x8e81,0x1d0));var _0x18e8=function(_0x40fa47,_0x31ae98){_0x40fa47=_0x40fa47-0x0;var _0x148dad=_0x8e81[_0x40fa47];return _0x148dad;};'use strict';var util=require(_0x18e8('0x0'));var _=require(_0x18e8('0x1'));var Redis=require(_0x18e8('0x2'));var interactionService=require(_0x18e8('0x3'));var qs=require(_0x18e8('0x4'));var logger=require(_0x18e8('0x5'))(_0x18e8('0x6'));var config=require(_0x18e8('0x7'));var db=require(_0x18e8('0x8'))['db'];config[_0x18e8('0x9')]=_[_0x18e8('0xa')](config[_0x18e8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x18e8('0xb'))(new Redis(config[_0x18e8('0x9')]));require(_0x18e8('0xc'))[_0x18e8('0xd')](socket);var jayson=require(_0x18e8('0xe'));var client=jayson[_0x18e8('0xf')]['http']({'port':0x232c});var client9002=jayson[_0x18e8('0xf')][_0x18e8('0x10')]({'port':0x232a});var interaction_log=require(_0x18e8('0x5'))('sms-interactions');function respondWithRpcPromise(_0x481b20,_0xebf2d5,_0x38ebbc,_0x11e099){return new Promise(function(_0x4308cc,_0x862e50){var _0x4d26d0=_0x11e099||client;return _0x4d26d0['request'](_0x481b20,_0x38ebbc)[_0x18e8('0x11')](function(_0x55cc4e){logger[_0x18e8('0x12')](_0x18e8('0x13'),_0xebf2d5,'request\x20sent');logger[_0x18e8('0x14')](_0x18e8('0x15'),_0xebf2d5,_0x18e8('0x16'),JSON[_0x18e8('0x17')](_0x55cc4e));if(_0x55cc4e[_0x18e8('0x18')]){if(_0x55cc4e[_0x18e8('0x18')]['code']===0x1f4){logger[_0x18e8('0x18')](_0x18e8('0x13'),_0xebf2d5,_0x55cc4e['error'][_0x18e8('0x19')]);return _0x862e50(_0x55cc4e[_0x18e8('0x18')]['message']);}logger[_0x18e8('0x18')](_0x18e8('0x13'),_0xebf2d5,_0x55cc4e['error'][_0x18e8('0x19')]);return _0x4308cc(_0x55cc4e[_0x18e8('0x18')][_0x18e8('0x19')]);}else{logger[_0x18e8('0x12')](_0x18e8('0x13'),_0xebf2d5,_0x18e8('0x16'));_0x4308cc(_0x55cc4e[_0x18e8('0x1a')]['message']);}})[_0x18e8('0x1b')](function(_0x3a73d4){logger[_0x18e8('0x18')](_0x18e8('0x13'),_0xebf2d5,_0x3a73d4);_0x862e50(_0x3a73d4);});});}function respondWithResult(_0x47d9d0,_0x227f8d){_0x227f8d=_0x227f8d||0xc8;return function(_0x21d060){if(_0x21d060){return _0x47d9d0[_0x18e8('0x1c')](_0x227f8d)[_0x18e8('0x1d')](_0x21d060);}};}function respondWithFilteredResult(_0xf84470,_0x57eab5){return function(_0x5bfade){if(_0x5bfade){var _0x501b98=typeof _0x57eab5[_0x18e8('0x1e')]===_0x18e8('0x1f')&&typeof _0x57eab5[_0x18e8('0x20')]==='undefined';var _0x3f0830=_0x5bfade['count'];var _0x7127fa=_0x501b98?0x0:_0x57eab5['offset'];var _0x112e0f=_0x501b98?_0x5bfade[_0x18e8('0x21')]:_0x57eab5[_0x18e8('0x1e')]+_0x57eab5[_0x18e8('0x20')];var _0x26c276;if(_0x112e0f>=_0x3f0830){_0x112e0f=_0x3f0830;_0x26c276=0xc8;}else{_0x26c276=0xce;}_0xf84470[_0x18e8('0x1c')](_0x26c276);return _0xf84470[_0x18e8('0x22')](_0x18e8('0x23'),_0x7127fa+'-'+_0x112e0f+'/'+_0x3f0830)[_0x18e8('0x1d')](_0x5bfade);}return null;};}function saveUpdates(_0x3857c1){return function(_0x125cec){if(_0x125cec){return _0x125cec['update'](_0x3857c1)[_0x18e8('0x11')](function(_0x3351f1){return _0x3351f1;});}return null;};}function removeEntity(_0x4573b5){return function(_0x1e3309){if(_0x1e3309){return _0x1e3309[_0x18e8('0x24')]()['then'](function(){_0x4573b5[_0x18e8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51184a){return function(_0x5cab16){if(!_0x5cab16){_0x51184a['sendStatus'](0x194);}return _0x5cab16;};}function handleError(_0x8b3b7d,_0x23935a){_0x23935a=_0x23935a||0x1f4;return function(_0x2a36b9){logger[_0x18e8('0x18')](_0x2a36b9[_0x18e8('0x25')]);if(_0x2a36b9[_0x18e8('0x26')]){delete _0x2a36b9['name'];}_0x8b3b7d[_0x18e8('0x1c')](_0x23935a)[_0x18e8('0x27')](_0x2a36b9);};}exports[_0x18e8('0x28')]=function(_0x3fd009,_0x5cc6ae){var _0x3cce30={},_0x2f0854={},_0xea6669={'count':0x0,'rows':[]};var _0x382901=_[_0x18e8('0x29')](db['SmsMessage'][_0x18e8('0x2a')],function(_0x526d36){return{'name':_0x526d36[_0x18e8('0x2b')],'type':_0x526d36[_0x18e8('0x2c')]['key']};});_0x2f0854['model']=_[_0x18e8('0x29')](_0x382901,_0x18e8('0x26'));_0x2f0854[_0x18e8('0x2d')]=_[_0x18e8('0x2e')](_0x3fd009[_0x18e8('0x2d')]);_0x2f0854['filters']=_[_0x18e8('0x2f')](_0x2f0854[_0x18e8('0x30')],_0x2f0854[_0x18e8('0x2d')]);_0x3cce30['attributes']=_[_0x18e8('0x2f')](_0x2f0854[_0x18e8('0x30')],qs['fields'](_0x3fd009[_0x18e8('0x2d')][_0x18e8('0x31')]));_0x3cce30[_0x18e8('0x32')]=_0x3cce30[_0x18e8('0x32')]['length']?_0x3cce30[_0x18e8('0x32')]:_0x2f0854[_0x18e8('0x30')];if(!_0x3fd009[_0x18e8('0x2d')][_0x18e8('0x33')](_0x18e8('0x34'))){_0x3cce30[_0x18e8('0x20')]=qs[_0x18e8('0x20')](_0x3fd009[_0x18e8('0x2d')][_0x18e8('0x20')]);_0x3cce30[_0x18e8('0x1e')]=qs[_0x18e8('0x1e')](_0x3fd009[_0x18e8('0x2d')]['offset']);}_0x3cce30[_0x18e8('0x35')]=qs[_0x18e8('0x36')](_0x3fd009[_0x18e8('0x2d')][_0x18e8('0x36')]);_0x3cce30['where']=qs[_0x18e8('0x37')](_[_0x18e8('0x38')](_0x3fd009[_0x18e8('0x2d')],_0x2f0854[_0x18e8('0x37')]),_0x382901);if(_0x3fd009[_0x18e8('0x2d')][_0x18e8('0x39')]){_0x3cce30[_0x18e8('0x3a')]=_['merge'](_0x3cce30[_0x18e8('0x3a')],{'$or':_[_0x18e8('0x29')](_0x382901,function(_0x1310f2){if(_0x1310f2[_0x18e8('0x2c')]!==_0x18e8('0x3b')){var _0x3ff436={};_0x3ff436[_0x1310f2[_0x18e8('0x26')]]={'$like':'%'+_0x3fd009[_0x18e8('0x2d')][_0x18e8('0x39')]+'%'};return _0x3ff436;}})});}_0x3cce30=_['merge']({},_0x3cce30,_0x3fd009[_0x18e8('0x3c')]);var _0x405ed3={'where':_0x3cce30['where']};return db[_0x18e8('0x3d')]['count'](_0x405ed3)[_0x18e8('0x11')](function(_0x41112d){_0xea6669['count']=_0x41112d;if(_0x3fd009[_0x18e8('0x2d')][_0x18e8('0x3e')]){_0x3cce30[_0x18e8('0x3f')]=[{'all':!![]}];}return db[_0x18e8('0x3d')][_0x18e8('0x40')](_0x3cce30);})[_0x18e8('0x11')](function(_0x1828ec){_0xea6669['rows']=_0x1828ec;return _0xea6669;})['then'](respondWithFilteredResult(_0x5cc6ae,_0x3cce30))[_0x18e8('0x1b')](handleError(_0x5cc6ae,null));};exports[_0x18e8('0x41')]=function(_0x271bf1,_0xa7c60c){var _0x5f2319={'raw':!![],'where':{'id':_0x271bf1[_0x18e8('0x42')]['id']}},_0x49f6fc={};_0x49f6fc['model']=_[_0x18e8('0x2e')](db['SmsMessage'][_0x18e8('0x2a')]);_0x49f6fc['query']=_[_0x18e8('0x2e')](_0x271bf1[_0x18e8('0x2d')]);_0x49f6fc['filters']=_[_0x18e8('0x2f')](_0x49f6fc[_0x18e8('0x30')],_0x49f6fc[_0x18e8('0x2d')]);_0x5f2319[_0x18e8('0x32')]=_[_0x18e8('0x2f')](_0x49f6fc['model'],qs[_0x18e8('0x31')](_0x271bf1['query'][_0x18e8('0x31')]));_0x5f2319[_0x18e8('0x32')]=_0x5f2319['attributes'][_0x18e8('0x43')]?_0x5f2319[_0x18e8('0x32')]:_0x49f6fc[_0x18e8('0x30')];if(_0x271bf1[_0x18e8('0x2d')]['includeAll']){_0x5f2319[_0x18e8('0x3f')]=[{'all':!![]}];}_0x5f2319=_[_0x18e8('0x44')]({},_0x5f2319,_0x271bf1[_0x18e8('0x3c')]);return db[_0x18e8('0x3d')][_0x18e8('0x45')](_0x5f2319)['then'](handleEntityNotFound(_0xa7c60c,null))['then'](respondWithResult(_0xa7c60c,null))[_0x18e8('0x1b')](handleError(_0xa7c60c,null));};exports[_0x18e8('0x46')]=function(_0x5b245f,_0x4e6918){return db[_0x18e8('0x3d')]['create'](_0x5b245f[_0x18e8('0x47')],{})[_0x18e8('0x11')](respondWithResult(_0x4e6918,0xc9))[_0x18e8('0x1b')](handleError(_0x4e6918,null));};exports[_0x18e8('0x48')]=function(_0xe54995,_0x1017b9){if(_0xe54995['body']['id']){delete _0xe54995[_0x18e8('0x47')]['id'];}return db[_0x18e8('0x3d')][_0x18e8('0x45')]({'where':{'id':_0xe54995[_0x18e8('0x42')]['id']}})[_0x18e8('0x11')](handleEntityNotFound(_0x1017b9,null))[_0x18e8('0x11')](saveUpdates(_0xe54995[_0x18e8('0x47')],null))[_0x18e8('0x11')](respondWithResult(_0x1017b9,null))[_0x18e8('0x1b')](handleError(_0x1017b9,null));};exports['destroy']=function(_0x54070a,_0x559099){return db[_0x18e8('0x3d')][_0x18e8('0x45')]({'where':{'id':_0x54070a[_0x18e8('0x42')]['id']}})['then'](handleEntityNotFound(_0x559099,null))[_0x18e8('0x11')](removeEntity(_0x559099,null))[_0x18e8('0x1b')](handleError(_0x559099,null));};exports[_0x18e8('0x49')]=function(_0x33e370,_0x22a8a1){return db[_0x18e8('0x3d')]['describe']()['then'](respondWithResult(_0x22a8a1,null))['catch'](handleError(_0x22a8a1,null));};exports[_0x18e8('0x4a')]=function(_0x21648e,_0x1955e9){var _0x587bfb=_0x18e8('0x4b');return interactionService[_0x18e8('0x4c')](_0x21648e,_0x587bfb)['then'](respondWithResult(_0x1955e9,null))[_0x18e8('0x1b')](handleError(_0x1955e9,null));};exports['reject']=function(_0x20883b,_0x34061b){var _0x9dc778={'agent':{},'channel':_0x18e8('0x4b')};if(_0x20883b[_0x18e8('0x47')]['id']){delete _0x20883b['body']['id'];}_0x20883b[_0x18e8('0x47')]['UserId']=_0x20883b[_0x18e8('0x47')][_0x18e8('0x4d')]||_0x20883b['user']['id'];_0x9dc778[_0x18e8('0x4e')]['id']=_0x20883b['body']['UserId'];return db[_0x18e8('0x3d')][_0x18e8('0x45')]({'where':{'id':_0x20883b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x34061b,null))[_0x18e8('0x11')](function(_0x554c29){if(_0x554c29){_0x9dc778[_0x18e8('0x19')]=_0x554c29['get']({'plain':!![]});return db['SmsInteraction'][_0x18e8('0x45')]({'where':{'id':_0x554c29[_0x18e8('0x4f')]}});}return null;})['then'](handleEntityNotFound(_0x34061b,null))[_0x18e8('0x11')](function(_0x50032d){if(_0x50032d){_0x9dc778['interaction']=_0x50032d[_0x18e8('0x50')]({'plain':!![]});interaction_log[_0x18e8('0x12')](_0x18e8('0x51'),_0x20883b[_0x18e8('0x52')]['id'],_0x20883b['user']['name'],_0x20883b[_0x18e8('0x52')][_0x18e8('0x53')],_0x9dc778[_0x18e8('0x54')]['id'],_0x20883b['body']?JSON[_0x18e8('0x17')](_0x20883b[_0x18e8('0x47')]):_0x18e8('0x55'));return respondWithRpcPromise(_0x18e8('0x56'),_0x18e8('0x57'),_0x9dc778);}return null;})[_0x18e8('0x11')](function(_0x4c44cb){var _0x40d782=_0x18e8('0x58')+_0x4c44cb[_0x18e8('0x19')][_0x18e8('0x59')];return db['sequelize']['query'](_0x40d782,{'type':db[_0x18e8('0x5a')][_0x18e8('0x5b')][_0x18e8('0x5c')],'raw':!![]})['then'](function(_0x3f9378){return _0x3f9378;});})[_0x18e8('0x11')](function(_0x4511b0){if(_0x4511b0){_0x9dc778['message'][_0x18e8('0x5d')]=_0x4511b0[0x0];if(!_0x20883b['body'][_0x18e8('0x4d')])return;return db[_0x18e8('0x5e')][_0x18e8('0x45')]({'where':{'id':_0x20883b[_0x18e8('0x47')][_0x18e8('0x4d')],'role':'agent'},'attributes':['id',_0x18e8('0x26'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x18e8('0x11')](function(_0x2d1b6f){if(!_0x2d1b6f)return null;_0x9dc778[_0x18e8('0x19')][_0x18e8('0x4e')]=_0x2d1b6f;return _0x9dc778;})['then'](function(_0x2671eb){if(_0x2671eb){_0x2671eb['message'][_0x18e8('0x5f')]=util['format'](_0x18e8('0x60'),_0x20883b['user']['name']);_0x2671eb[_0x18e8('0x19')]['channel']=_0x9dc778['channel'];_0x2671eb['message'][_0x18e8('0x61')]=_0x9dc778[_0x18e8('0x62')];_0x2671eb[_0x18e8('0x19')][_0x18e8('0x63')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x2671eb['message']},client9002);return _0x9dc778;}return null;})['then'](respondWithResult(_0x34061b,null))['catch'](handleError(_0x34061b,null));};exports['status']=function(_0x139fca,_0x5e1f0d){if(_0x139fca[_0x18e8('0x47')]['id']){delete _0x139fca[_0x18e8('0x47')]['id'];}var _0x210fc2;return db[_0x18e8('0x3d')]['find']({'where':{'id':_0x139fca['params']['id']}})[_0x18e8('0x11')](handleEntityNotFound(_0x5e1f0d,null))['then'](function(_0x32d1d1){if(_0x32d1d1){_0x210fc2=_0x32d1d1;return db[_0x18e8('0x64')][_0x18e8('0x45')]({'where':{'id':_0x32d1d1[_0x18e8('0x65')]}});}})['then'](handleEntityNotFound(_0x5e1f0d,null))[_0x18e8('0x11')](function(_0xcc8454){if(_0xcc8454){logger[_0x18e8('0x14')](_0x18e8('0x15'),_0x18e8('0x1c'),_0x18e8('0x66'),_0xcc8454[_0x18e8('0x2c')],util[_0x18e8('0x67')](_0x139fca[_0x18e8('0x47')],{'showHidden':![],'depth':null}));switch(_0xcc8454['type']){case _0x18e8('0x68'):if(_0x139fca[_0x18e8('0x47')]['MessageSid']&&_0x139fca[_0x18e8('0x47')][_0x18e8('0x69')]===_0x210fc2[_0x18e8('0x6a')]){return _0x210fc2['update']({'read':!![]});}else{logger[_0x18e8('0x18')](_0x18e8('0x6b'),_0x18e8('0x1c'),_0x18e8('0x68'),util[_0x18e8('0x67')](_0x139fca[_0x18e8('0x47')],{'showHidden':![],'depth':null}));}break;case _0x18e8('0x6c'):if(_0x139fca['body'][_0x18e8('0x6d')]&&_0x139fca[_0x18e8('0x47')][_0x18e8('0x6d')]===_0x210fc2[_0x18e8('0x6a')]&&_[_0x18e8('0x6e')]([_0x18e8('0x6f'),_0x18e8('0x70')],_0x139fca[_0x18e8('0x47')]['Status'])>=0x0){return _0x210fc2[_0x18e8('0x48')]({'read':!![]});}else{logger[_0x18e8('0x18')](_0x18e8('0x6b'),'status','plivio',util[_0x18e8('0x67')](_0x139fca[_0x18e8('0x47')],{'showHidden':![],'depth':null}));}break;case _0x18e8('0x71'):var _0x1fd84b=_0x139fca[_0x18e8('0x47')][_0x18e8('0x72')][0x0];if(_0x1fd84b[_0x18e8('0x1c')][_0x18e8('0x73')]===_0x18e8('0x74')){return _0x210fc2[_0x18e8('0x48')]({'read':!![]});}else{logger['error'](_0x18e8('0x6b'),'status',_0x18e8('0x71'),util[_0x18e8('0x67')](_0x139fca[_0x18e8('0x47')],{'showHidden':![],'depth':null}));}break;}return _0x210fc2;}})[_0x18e8('0x11')](respondWithResult(_0x5e1f0d,null))[_0x18e8('0x1b')](handleError(_0x5e1f0d,null));}; \ No newline at end of file +var _0xdd8d=['params','keys','SmsMessage','find','create','body','accept','sms','acceptMessage','reject','user','agent','UserId','SmsInteraction','interaction','get','role','RejectMessage','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','interface','format','SIP/%s','channel','event','EventManager','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','infobip','results','groupName','DELIVERED','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','register','client','http','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','end','stack','map','rawAttributes','fieldName','type','key','name','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show'];(function(_0x1d9a70,_0x2cc0f6){var _0x261299=function(_0x34c6ba){while(--_0x34c6ba){_0x1d9a70['push'](_0x1d9a70['shift']());}};_0x261299(++_0x2cc0f6);}(_0xdd8d,0x1e5));var _0xddd8=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xdd8d[_0x12ca5f];return _0xfc3ae9;};'use strict';var util=require(_0xddd8('0x0'));var _=require(_0xddd8('0x1'));var Redis=require(_0xddd8('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0xddd8('0x3'));var logger=require(_0xddd8('0x4'))(_0xddd8('0x5'));var config=require('../../config/environment');var db=require(_0xddd8('0x6'))['db'];config[_0xddd8('0x7')]=_['defaults'](config[_0xddd8('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xddd8('0x8'))(new Redis(config[_0xddd8('0x7')]));require(_0xddd8('0x9'))[_0xddd8('0xa')](socket);var jayson=require('jayson/promise');var client=jayson[_0xddd8('0xb')][_0xddd8('0xc')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0xddd8('0xd'));function respondWithRpcPromise(_0x4ccb2b,_0x56b313,_0x49a9ae,_0x1b3b72){return new Promise(function(_0x2afad4,_0x3795fa){var _0x1570a2=_0x1b3b72||client;return _0x1570a2[_0xddd8('0xe')](_0x4ccb2b,_0x49a9ae)[_0xddd8('0xf')](function(_0x4de0b9){logger[_0xddd8('0x10')](_0xddd8('0x11'),_0x56b313,'request\x20sent');logger[_0xddd8('0x12')](_0xddd8('0x13'),_0x56b313,_0xddd8('0x14'),JSON[_0xddd8('0x15')](_0x4de0b9));if(_0x4de0b9[_0xddd8('0x16')]){if(_0x4de0b9[_0xddd8('0x16')][_0xddd8('0x17')]===0x1f4){logger[_0xddd8('0x16')]('SmsMessage,\x20%s,\x20%s',_0x56b313,_0x4de0b9[_0xddd8('0x16')][_0xddd8('0x18')]);return _0x3795fa(_0x4de0b9[_0xddd8('0x16')][_0xddd8('0x18')]);}logger[_0xddd8('0x16')]('SmsMessage,\x20%s,\x20%s',_0x56b313,_0x4de0b9[_0xddd8('0x16')][_0xddd8('0x18')]);return _0x2afad4(_0x4de0b9[_0xddd8('0x16')][_0xddd8('0x18')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x56b313,_0xddd8('0x14'));_0x2afad4(_0x4de0b9[_0xddd8('0x19')][_0xddd8('0x18')]);}})[_0xddd8('0x1a')](function(_0x2a956b){logger[_0xddd8('0x16')](_0xddd8('0x11'),_0x56b313,_0x2a956b);_0x3795fa(_0x2a956b);});});}function respondWithResult(_0x33b8c0,_0x2fd953){_0x2fd953=_0x2fd953||0xc8;return function(_0x13fe89){if(_0x13fe89){return _0x33b8c0[_0xddd8('0x1b')](_0x2fd953)['json'](_0x13fe89);}};}function respondWithFilteredResult(_0x3d2246,_0x89ee63){return function(_0x5acd5e){if(_0x5acd5e){var _0x49cf1a=typeof _0x89ee63[_0xddd8('0x1c')]===_0xddd8('0x1d')&&typeof _0x89ee63[_0xddd8('0x1e')]==='undefined';var _0x8e6d19=_0x5acd5e[_0xddd8('0x1f')];var _0x518426=_0x49cf1a?0x0:_0x89ee63[_0xddd8('0x1c')];var _0x45646b=_0x49cf1a?_0x5acd5e['count']:_0x89ee63['offset']+_0x89ee63[_0xddd8('0x1e')];var _0x2fa135;if(_0x45646b>=_0x8e6d19){_0x45646b=_0x8e6d19;_0x2fa135=0xc8;}else{_0x2fa135=0xce;}_0x3d2246[_0xddd8('0x1b')](_0x2fa135);return _0x3d2246[_0xddd8('0x20')](_0xddd8('0x21'),_0x518426+'-'+_0x45646b+'/'+_0x8e6d19)[_0xddd8('0x22')](_0x5acd5e);}return null;};}function saveUpdates(_0xa031af){return function(_0x1b5a71){if(_0x1b5a71){return _0x1b5a71[_0xddd8('0x23')](_0xa031af)[_0xddd8('0xf')](function(_0x2bf823){return _0x2bf823;});}return null;};}function removeEntity(_0x3bc4ec){return function(_0x6a72c9){if(_0x6a72c9){return _0x6a72c9[_0xddd8('0x24')]()[_0xddd8('0xf')](function(){_0x3bc4ec['status'](0xcc)[_0xddd8('0x25')]();});}};}function handleEntityNotFound(_0x3de781){return function(_0x36f25f){if(!_0x36f25f){_0x3de781['sendStatus'](0x194);}return _0x36f25f;};}function handleError(_0x323e44,_0x5d167f){_0x5d167f=_0x5d167f||0x1f4;return function(_0x141c93){logger[_0xddd8('0x16')](_0x141c93[_0xddd8('0x26')]);if(_0x141c93['name']){delete _0x141c93['name'];}_0x323e44[_0xddd8('0x1b')](_0x5d167f)['send'](_0x141c93);};}exports['index']=function(_0x4cd039,_0x2d991a){var _0x5f51f4={},_0x433a71={},_0x4d2a94={'count':0x0,'rows':[]};var _0x23ea24=_[_0xddd8('0x27')](db['SmsMessage'][_0xddd8('0x28')],function(_0x1ae839){return{'name':_0x1ae839[_0xddd8('0x29')],'type':_0x1ae839[_0xddd8('0x2a')][_0xddd8('0x2b')]};});_0x433a71['model']=_[_0xddd8('0x27')](_0x23ea24,_0xddd8('0x2c'));_0x433a71[_0xddd8('0x2d')]=_['keys'](_0x4cd039[_0xddd8('0x2d')]);_0x433a71['filters']=_[_0xddd8('0x2e')](_0x433a71['model'],_0x433a71[_0xddd8('0x2d')]);_0x5f51f4[_0xddd8('0x2f')]=_['intersection'](_0x433a71[_0xddd8('0x30')],qs[_0xddd8('0x31')](_0x4cd039['query'][_0xddd8('0x31')]));_0x5f51f4[_0xddd8('0x2f')]=_0x5f51f4[_0xddd8('0x2f')][_0xddd8('0x32')]?_0x5f51f4[_0xddd8('0x2f')]:_0x433a71['model'];if(!_0x4cd039[_0xddd8('0x2d')][_0xddd8('0x33')](_0xddd8('0x34'))){_0x5f51f4[_0xddd8('0x1e')]=qs[_0xddd8('0x1e')](_0x4cd039[_0xddd8('0x2d')][_0xddd8('0x1e')]);_0x5f51f4[_0xddd8('0x1c')]=qs[_0xddd8('0x1c')](_0x4cd039[_0xddd8('0x2d')][_0xddd8('0x1c')]);}_0x5f51f4['order']=qs[_0xddd8('0x35')](_0x4cd039[_0xddd8('0x2d')][_0xddd8('0x35')]);_0x5f51f4[_0xddd8('0x36')]=qs[_0xddd8('0x37')](_[_0xddd8('0x38')](_0x4cd039[_0xddd8('0x2d')],_0x433a71[_0xddd8('0x37')]),_0x23ea24);if(_0x4cd039[_0xddd8('0x2d')][_0xddd8('0x39')]){_0x5f51f4[_0xddd8('0x36')]=_[_0xddd8('0x3a')](_0x5f51f4['where'],{'$or':_[_0xddd8('0x27')](_0x23ea24,function(_0xcbdb00){if(_0xcbdb00[_0xddd8('0x2a')]!==_0xddd8('0x3b')){var _0x1c7614={};_0x1c7614[_0xcbdb00['name']]={'$like':'%'+_0x4cd039[_0xddd8('0x2d')][_0xddd8('0x39')]+'%'};return _0x1c7614;}})});}_0x5f51f4=_['merge']({},_0x5f51f4,_0x4cd039[_0xddd8('0x3c')]);var _0x3fff49={'where':_0x5f51f4[_0xddd8('0x36')]};return db['SmsMessage'][_0xddd8('0x1f')](_0x3fff49)[_0xddd8('0xf')](function(_0x515b26){_0x4d2a94[_0xddd8('0x1f')]=_0x515b26;if(_0x4cd039[_0xddd8('0x2d')][_0xddd8('0x3d')]){_0x5f51f4[_0xddd8('0x3e')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x5f51f4);})[_0xddd8('0xf')](function(_0x34935d){_0x4d2a94[_0xddd8('0x3f')]=_0x34935d;return _0x4d2a94;})[_0xddd8('0xf')](respondWithFilteredResult(_0x2d991a,_0x5f51f4))['catch'](handleError(_0x2d991a,null));};exports[_0xddd8('0x40')]=function(_0x1d528f,_0x1595dd){var _0x1f347e={'raw':!![],'where':{'id':_0x1d528f[_0xddd8('0x41')]['id']}},_0x2606d7={};_0x2606d7['model']=_[_0xddd8('0x42')](db['SmsMessage'][_0xddd8('0x28')]);_0x2606d7['query']=_[_0xddd8('0x42')](_0x1d528f[_0xddd8('0x2d')]);_0x2606d7[_0xddd8('0x37')]=_[_0xddd8('0x2e')](_0x2606d7[_0xddd8('0x30')],_0x2606d7[_0xddd8('0x2d')]);_0x1f347e[_0xddd8('0x2f')]=_[_0xddd8('0x2e')](_0x2606d7[_0xddd8('0x30')],qs['fields'](_0x1d528f[_0xddd8('0x2d')][_0xddd8('0x31')]));_0x1f347e[_0xddd8('0x2f')]=_0x1f347e[_0xddd8('0x2f')][_0xddd8('0x32')]?_0x1f347e[_0xddd8('0x2f')]:_0x2606d7[_0xddd8('0x30')];if(_0x1d528f[_0xddd8('0x2d')][_0xddd8('0x3d')]){_0x1f347e[_0xddd8('0x3e')]=[{'all':!![]}];}_0x1f347e=_[_0xddd8('0x3a')]({},_0x1f347e,_0x1d528f[_0xddd8('0x3c')]);return db[_0xddd8('0x43')][_0xddd8('0x44')](_0x1f347e)[_0xddd8('0xf')](handleEntityNotFound(_0x1595dd,null))[_0xddd8('0xf')](respondWithResult(_0x1595dd,null))[_0xddd8('0x1a')](handleError(_0x1595dd,null));};exports[_0xddd8('0x45')]=function(_0x52fe38,_0x747f22){return db['SmsMessage'][_0xddd8('0x45')](_0x52fe38['body'],{})[_0xddd8('0xf')](respondWithResult(_0x747f22,0xc9))[_0xddd8('0x1a')](handleError(_0x747f22,null));};exports[_0xddd8('0x23')]=function(_0x51feb8,_0x14309e){if(_0x51feb8['body']['id']){delete _0x51feb8['body']['id'];}return db[_0xddd8('0x43')][_0xddd8('0x44')]({'where':{'id':_0x51feb8['params']['id']}})[_0xddd8('0xf')](handleEntityNotFound(_0x14309e,null))['then'](saveUpdates(_0x51feb8[_0xddd8('0x46')],null))[_0xddd8('0xf')](respondWithResult(_0x14309e,null))[_0xddd8('0x1a')](handleError(_0x14309e,null));};exports[_0xddd8('0x24')]=function(_0x5ee2a1,_0x361399){return db['SmsMessage']['find']({'where':{'id':_0x5ee2a1[_0xddd8('0x41')]['id']}})['then'](handleEntityNotFound(_0x361399,null))[_0xddd8('0xf')](removeEntity(_0x361399,null))['catch'](handleError(_0x361399,null));};exports['describe']=function(_0x440b9d,_0x15f80f){return db[_0xddd8('0x43')]['describe']()[_0xddd8('0xf')](respondWithResult(_0x15f80f,null))[_0xddd8('0x1a')](handleError(_0x15f80f,null));};exports[_0xddd8('0x47')]=function(_0x599bf4,_0x28cae3){var _0x1149af=_0xddd8('0x48');return interactionService[_0xddd8('0x49')](_0x599bf4,_0x1149af)[_0xddd8('0xf')](respondWithResult(_0x28cae3,null))['catch'](handleError(_0x28cae3,null));};exports[_0xddd8('0x4a')]=function(_0x585e8a,_0x58b943){var _0x147189={'agent':{},'channel':_0xddd8('0x48')};if(_0x585e8a[_0xddd8('0x46')]['id']){delete _0x585e8a[_0xddd8('0x46')]['id'];}_0x585e8a['body']['UserId']=_0x585e8a[_0xddd8('0x46')]['UserId']||_0x585e8a[_0xddd8('0x4b')]['id'];_0x147189[_0xddd8('0x4c')]['id']=_0x585e8a[_0xddd8('0x46')][_0xddd8('0x4d')];return db[_0xddd8('0x43')][_0xddd8('0x44')]({'where':{'id':_0x585e8a[_0xddd8('0x41')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x58b943,null))['then'](function(_0x20770c){if(_0x20770c){_0x147189[_0xddd8('0x18')]=_0x20770c['get']({'plain':!![]});return db[_0xddd8('0x4e')]['find']({'where':{'id':_0x20770c['SmsInteractionId']}});}return null;})[_0xddd8('0xf')](handleEntityNotFound(_0x58b943,null))[_0xddd8('0xf')](function(_0x4bba4d){if(_0x4bba4d){_0x147189[_0xddd8('0x4f')]=_0x4bba4d[_0xddd8('0x50')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x585e8a[_0xddd8('0x4b')]['id'],_0x585e8a[_0xddd8('0x4b')][_0xddd8('0x2c')],_0x585e8a[_0xddd8('0x4b')][_0xddd8('0x51')],_0x147189[_0xddd8('0x4f')]['id'],_0x585e8a[_0xddd8('0x46')]?JSON[_0xddd8('0x15')](_0x585e8a['body']):'null');return respondWithRpcPromise(_0xddd8('0x52'),'rejectMessage',_0x147189);}return null;})[_0xddd8('0xf')](function(_0x2f2785){var _0x59da4d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2f2785['message'][_0xddd8('0x53')];return db['sequelize'][_0xddd8('0x2d')](_0x59da4d,{'type':db[_0xddd8('0x54')][_0xddd8('0x55')]['SELECT'],'raw':!![]})[_0xddd8('0xf')](function(_0x3c0e31){return _0x3c0e31;});})[_0xddd8('0xf')](function(_0x173fb4){if(_0x173fb4){_0x147189[_0xddd8('0x18')][_0xddd8('0x56')]=_0x173fb4[0x0];if(!_0x585e8a[_0xddd8('0x46')][_0xddd8('0x4d')])return;return db[_0xddd8('0x57')][_0xddd8('0x44')]({'where':{'id':_0x585e8a[_0xddd8('0x46')][_0xddd8('0x4d')],'role':_0xddd8('0x4c')},'attributes':['id',_0xddd8('0x2c'),_0xddd8('0x58'),_0xddd8('0x59'),'internal'],'raw':!![]});}return null;})[_0xddd8('0xf')](function(_0x533112){if(!_0x533112)return null;_0x147189[_0xddd8('0x18')][_0xddd8('0x4c')]=_0x533112;return _0x147189;})[_0xddd8('0xf')](function(_0x4e2c19){if(_0x4e2c19){_0x4e2c19[_0xddd8('0x18')][_0xddd8('0x5a')]=util[_0xddd8('0x5b')](_0xddd8('0x5c'),_0x585e8a[_0xddd8('0x4b')][_0xddd8('0x2c')]);_0x4e2c19['message'][_0xddd8('0x5d')]=_0x147189[_0xddd8('0x5d')];_0x4e2c19['message']['motionChannel']=_0x147189['channel'];_0x4e2c19['message'][_0xddd8('0x5e')]=_0xddd8('0x4a');respondWithRpcPromise(_0xddd8('0x5f'),_0xddd8('0x5f'),{'event':'rejectmessage','message':_0x4e2c19['message']},client9002);return _0x147189;}return null;})[_0xddd8('0xf')](respondWithResult(_0x58b943,null))[_0xddd8('0x1a')](handleError(_0x58b943,null));};exports['status']=function(_0x1d16fc,_0x4662d2){if(_0x1d16fc[_0xddd8('0x46')]['id']){delete _0x1d16fc[_0xddd8('0x46')]['id'];}var _0x313afb;return db[_0xddd8('0x43')][_0xddd8('0x44')]({'where':{'id':_0x1d16fc[_0xddd8('0x41')]['id']}})[_0xddd8('0xf')](handleEntityNotFound(_0x4662d2,null))[_0xddd8('0xf')](function(_0x5860ec){if(_0x5860ec){_0x313afb=_0x5860ec;return db['SmsAccount'][_0xddd8('0x44')]({'where':{'id':_0x5860ec[_0xddd8('0x60')]}});}})[_0xddd8('0xf')](handleEntityNotFound(_0x4662d2,null))[_0xddd8('0xf')](function(_0x28fa4a){if(_0x28fa4a){logger[_0xddd8('0x12')](_0xddd8('0x13'),_0xddd8('0x1b'),'received\x20delivery\x20report\x20from',_0x28fa4a[_0xddd8('0x2a')],util[_0xddd8('0x61')](_0x1d16fc[_0xddd8('0x46')],{'showHidden':![],'depth':null}));switch(_0x28fa4a[_0xddd8('0x2a')]){case _0xddd8('0x62'):if(_0x1d16fc[_0xddd8('0x46')][_0xddd8('0x63')]&&_0x1d16fc['body']['MessageSid']===_0x313afb[_0xddd8('0x64')]){return _0x313afb[_0xddd8('0x23')]({'read':!![]});}else{logger['error'](_0xddd8('0x65'),_0xddd8('0x1b'),_0xddd8('0x62'),util[_0xddd8('0x61')](_0x1d16fc[_0xddd8('0x46')],{'showHidden':![],'depth':null}));}break;case _0xddd8('0x66'):if(_0x1d16fc[_0xddd8('0x46')]['MessageUUID']&&_0x1d16fc[_0xddd8('0x46')][_0xddd8('0x67')]===_0x313afb[_0xddd8('0x64')]&&_[_0xddd8('0x68')]([_0xddd8('0x69'),'delivered'],_0x1d16fc[_0xddd8('0x46')]['Status'])>=0x0){return _0x313afb[_0xddd8('0x23')]({'read':!![]});}else{logger[_0xddd8('0x16')](_0xddd8('0x65'),_0xddd8('0x1b'),'plivio',util['inspect'](_0x1d16fc[_0xddd8('0x46')],{'showHidden':![],'depth':null}));}break;case _0xddd8('0x6a'):var _0x26336f=_0x1d16fc[_0xddd8('0x46')][_0xddd8('0x6b')][0x0];if(_0x26336f[_0xddd8('0x1b')][_0xddd8('0x6c')]===_0xddd8('0x6d')){return _0x313afb[_0xddd8('0x23')]({'read':!![]});}else{logger['error'](_0xddd8('0x65'),_0xddd8('0x1b'),'infobip',util[_0xddd8('0x61')](_0x1d16fc['body'],{'showHidden':![],'depth':null}));}break;}return _0x313afb;}})[_0xddd8('0xf')](respondWithResult(_0x4662d2,null))[_0xddd8('0x1a')](handleError(_0x4662d2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1789d84..744f193 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 _0x1193=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x17a078,_0x3bbef8){var _0x5bae69=function(_0x39fbc2){while(--_0x39fbc2){_0x17a078['push'](_0x17a078['shift']());}};_0x5bae69(++_0x3bbef8);}(_0x1193,0x79));var _0x3119=function(_0x5f4f57,_0x29386a){_0x5f4f57=_0x5f4f57-0x0;var _0x5c3fad=_0x1193[_0x5f4f57];return _0x5c3fad;};'use strict';var EventEmitter=require(_0x3119('0x0'));var SmsMessage=require(_0x3119('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3119('0x2')](0x0);var events={'afterCreate':_0x3119('0x3'),'afterUpdate':_0x3119('0x4'),'afterDestroy':_0x3119('0x5')};function emitEvent(_0x4d4e74){return function(_0x5ed066,_0x4419d8,_0x1bdaec){SmsMessageEvents[_0x3119('0x6')](_0x4d4e74+':'+_0x5ed066['id'],_0x5ed066);SmsMessageEvents[_0x3119('0x6')](_0x4d4e74,_0x5ed066);_0x1bdaec(null);};}for(var e in events){if(events[_0x3119('0x7')](e)){var event=events[e];SmsMessage[_0x3119('0x8')](e,emitEvent(event));}}module[_0x3119('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x6dee=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0x3cc014,_0x3a3124){var _0x2edbcd=function(_0x2141d5){while(--_0x2141d5){_0x3cc014['push'](_0x3cc014['shift']());}};_0x2edbcd(++_0x3a3124);}(_0x6dee,0xdc));var _0xe6de=function(_0x1bf370,_0x166b71){_0x1bf370=_0x1bf370-0x0;var _0x243356=_0x6dee[_0x1bf370];return _0x243356;};'use strict';var EventEmitter=require(_0xe6de('0x0'));var SmsMessage=require(_0xe6de('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe6de('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe6de('0x3'),'afterDestroy':_0xe6de('0x4')};function emitEvent(_0x2604bd){return function(_0x4459b3,_0x5f2755,_0x49aa75){SmsMessageEvents[_0xe6de('0x5')](_0x2604bd+':'+_0x4459b3['id'],_0x4459b3);SmsMessageEvents[_0xe6de('0x5')](_0x2604bd,_0x4459b3);_0x49aa75(null);};}for(var e in events){if(events[_0xe6de('0x6')](e)){var event=events[e];SmsMessage[_0xe6de('0x7')](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 93bfa31..46b387c 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 _0x1675=['keys','sort','length','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','models','get','direction','out','secret','UserId','isNil','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','messages','create','body','/api/sms/messages/','/status?token=','then','sid','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','&password=','password','GET','split','POST','user_key','deliveryReport','read','SmsMessage,\x20%s,\x20%s,\x20%s','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','username','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','token','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','timestamp'];(function(_0x3dec4a,_0x153b54){var _0x2f8f71=function(_0x1d2291){while(--_0x1d2291){_0x3dec4a['push'](_0x3dec4a['shift']());}};_0x2f8f71(++_0x153b54);}(_0x1675,0x199));var _0x5167=function(_0x5477d0,_0x1a9a77){_0x5477d0=_0x5477d0-0x0;var _0x3807c8=_0x1675[_0x5477d0];return _0x3807c8;};'use strict';var _=require(_0x5167('0x0'));var util=require(_0x5167('0x1'));var logger=require(_0x5167('0x2'))(_0x5167('0x3'));var moment=require(_0x5167('0x4'));var BPromise=require(_0x5167('0x5'));var rp=require(_0x5167('0x6'));var fs=require('fs');var path=require(_0x5167('0x7'));var rimraf=require(_0x5167('0x8'));var config=require(_0x5167('0x9'));var attributes=require(_0x5167('0xa'));module[_0x5167('0xb')]=function(_0x3580ce,_0x287b2d){return _0x3580ce[_0x5167('0xc')]('SmsMessage',attributes,{'tableName':_0x5167('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5167('0xe')]},{'name':_0x5167('0xf'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x356d8a,_0x1751c4,_0x1f432a){var _0x209c27=_0x3580ce[_0x5167('0x10')];var _0x349893=_0x356d8a[_0x5167('0x11')]({'plain':!![]});if(_0x349893[_0x5167('0x12')]['toLowerCase']()==='in'||_0x349893[_0x5167('0x12')]['toLowerCase']()===_0x5167('0x13')&&!_0x349893[_0x5167('0x14')]&&!_['isNil'](_0x349893[_0x5167('0x15')])&&!_[_0x5167('0x16')](_0x349893['SmsInteractionId'])){_0x209c27[_0x5167('0x17')][_0x5167('0x18')]({'where':{'id':_0x349893[_0x5167('0x19')]}})['then'](function(_0x1e04e0){if(_0x1e04e0){_0x1e04e0[_0x5167('0x1a')]({'lastMsgAt':_0x349893[_0x5167('0x1b')],'lastMsgDirection':_0x349893[_0x5167('0x12')]['toLowerCase']()});}})[_0x5167('0x1c')](function(_0x52a288){console[_0x5167('0x1d')](_0x52a288);});}if(_0x349893[_0x5167('0x12')]===_0x5167('0x13')&&!_0x349893['secret']){var _0x41834e;_0x209c27[_0x5167('0x1e')][_0x5167('0x1f')]({'where':{'id':_0x349893[_0x5167('0x20')]},'raw':!![]})['then'](function(_0x2a3fd7){_0x41834e=_0x2a3fd7;if(_0x41834e&&_0x41834e[_0x5167('0x21')]){switch(_0x41834e['type']){case'twilio':var _0x1e85c8=require(_0x5167('0x22'));if(_0x41834e['accountSid']&&_0x41834e[_0x5167('0x23')]&&_0x41834e[_0x5167('0x24')]){var _0x479102=new _0x1e85c8(_0x41834e['accountSid'],_0x41834e[_0x5167('0x23')]);_0x479102[_0x5167('0x25')][_0x5167('0x26')]({'body':_0x349893[_0x5167('0x27')],'to':_0x349893[_0x5167('0x24')],'from':_0x41834e[_0x5167('0x24')],'statusCallback':_0x41834e['remote']+_0x5167('0x28')+_0x349893['id']+_0x5167('0x29')+_0x41834e['token']})[_0x5167('0x2a')](function(_0x53d7a6){if(_0x53d7a6[_0x5167('0x2b')]){return _0x356d8a[_0x5167('0x1a')]({'messageId':_0x53d7a6[_0x5167('0x2b')]});}})[_0x5167('0x1c')](function(_0xc47e84){logger[_0x5167('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5167('0x2c'),'twilio',util[_0x5167('0x2d')](_0xc47e84,{'showHidden':![],'depth':null}));});}else{logger[_0x5167('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5167('0x2c'),_0x5167('0x22'),_0x5167('0x2e'));}break;case _0x5167('0x2f'):var _0x4e76ff=_0x5167('0x30');if(_0x41834e['username']&&_0x41834e['password']){var _0x5a0a6e={'recipient':[_0x349893[_0x5167('0x24')]],'message':_0x349893['body'],'message_type':_0x41834e[_0x5167('0x31')]};if(_0x41834e[_0x5167('0x31')]&&_0x41834e[_0x5167('0x31')]!=='SI'){_0x5a0a6e[_0x5167('0x32')]=_0x41834e['phone'];}var _0x29a9eb={'url':_0x4e76ff+_0x5167('0x33')+_0x41834e['username']+_0x5167('0x34')+_0x41834e[_0x5167('0x35')],'method':_0x5167('0x36')};rp(_0x29a9eb)[_0x5167('0x2a')](function(_0x2f2b0a){var _0x6a3822=_0x2f2b0a[_0x5167('0x37')](';');var _0x3cb385={'user_key':_0x6a3822[0x0],'session_key':_0x6a3822[0x1]};_0x29a9eb={'url':_0x4e76ff+'sms','method':_0x5167('0x38'),'headers':{'user_key':_0x3cb385[_0x5167('0x39')],'Session_key':_0x3cb385['session_key']},'json':!![],'body':_0x5a0a6e};return rp(_0x29a9eb);})[_0x5167('0x2a')](function(_0x5e30b4){if(_0x5e30b4['total_sent']>=0x1){var _0x4127fa={'messageId':_0x5e30b4['internal_order_id']};if(_0x41834e[_0x5167('0x31')]!=='GP'||!_0x41834e[_0x5167('0x3a')]){_0x4127fa[_0x5167('0x3b')]=!![];}return _0x356d8a[_0x5167('0x1a')](_0x4127fa);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5167('0x2c'),_0x5167('0x2f'),util['inspect'](_0x5e30b4,{'showHidden':![],'depth':null}));}})[_0x5167('0x1c')](function(_0x56a78a){return logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x2f'),util['inspect'](_0x56a78a,{'showHidden':![],'depth':null}));});}else{logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x41834e[_0x5167('0x23')]){var _0x3b4565={'recipient':_0x349893[_0x5167('0x24')],'message':_0x349893[_0x5167('0x27')],'sender':_0x41834e[_0x5167('0x3d')]||_0x41834e[_0x5167('0x24')],'authorization':_0x41834e[_0x5167('0x23')]};var _0x1751c4={'method':_0x5167('0x38'),'uri':_0x5167('0x3e'),'body':_0x3b4565,'json':!![]};rp(_0x1751c4)[_0x5167('0x2a')](function(_0x1a7ef1){var _0x1784c9={'messageId':_0x1a7ef1[_0x5167('0x3f')]};if(!_0x41834e['deliveryReport']){_0x1784c9['read']=!![];}return _0x356d8a[_0x5167('0x1a')](_0x1784c9);})['catch'](function(_0x49cf08){logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),'connectel',util['inspect'](_0x49cf08,{'showHidden':![],'depth':null}));});}else{logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),'connectel',_0x5167('0x40'));}break;case _0x5167('0x41'):if(_0x41834e[_0x5167('0x42')]&&_0x41834e['password']){var _0x3b4565={'messages':[{'source':_0x5167('0x43'),'to':_0x349893[_0x5167('0x24')],'body':_0x349893['body'],'from':_0x41834e[_0x5167('0x3d')]||_0x41834e[_0x5167('0x24')]}]};var _0x42c40a=util['format'](_0x5167('0x44'),_0x41834e[_0x5167('0x42')],_0x41834e[_0x5167('0x35')]);var _0x1751c4={'method':_0x5167('0x38'),'uri':_0x5167('0x45'),'body':_0x3b4565,'headers':{'Authorization':util[_0x5167('0x46')](_0x5167('0x47'),new Buffer(_0x42c40a)[_0x5167('0x48')](_0x5167('0x49')))},'json':!![]};rp(_0x1751c4)[_0x5167('0x2a')](function(_0x328774){if(_0x328774[_0x5167('0x4a')]>=0xc8&&_0x328774[_0x5167('0x4a')]<=0xce){if(_0x328774[_0x5167('0x4b')]&&_0x328774[_0x5167('0x4b')][_0x5167('0x4c')]>0x0){var _0x699acd=_[_0x5167('0x4d')](_0x328774[_0x5167('0x4b')]['messages']);var _0x2054c1={'messageId':_0x699acd[_0x5167('0x4e')]};if(!_0x41834e['deliveryReport']){_0x2054c1['read']=!![];}return _0x356d8a[_0x5167('0x1a')](_0x2054c1);}else{logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x4f'),util[_0x5167('0x2d')](_0x328774,{'showHidden':![],'depth':null}));}}else{logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x4f'),util[_0x5167('0x2d')](_0x328774,{'showHidden':![],'depth':null}));}})[_0x5167('0x1c')](function(_0x1fe8d2){logger[_0x5167('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5167('0x2c'),'clickSend',util[_0x5167('0x2d')](_0x1fe8d2,{'showHidden':![],'depth':null}));});}else{logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x4f'),_0x5167('0x50'));}break;case _0x5167('0x51'):if(_0x41834e[_0x5167('0x52')]&&_0x41834e[_0x5167('0x23')]){var _0x3b4565={'dst':_0x349893[_0x5167('0x24')],'text':_0x349893[_0x5167('0x27')],'src':_0x41834e[_0x5167('0x3d')]||_0x41834e[_0x5167('0x24')],'url':_0x41834e[_0x5167('0x53')]+_0x5167('0x28')+_0x349893['id']+_0x5167('0x29')+_0x41834e[_0x5167('0x54')]};var _0x42c40a=util[_0x5167('0x46')]('%s:%s',_0x41834e[_0x5167('0x52')],_0x41834e[_0x5167('0x23')]);var _0x1751c4={'method':_0x5167('0x38'),'uri':util[_0x5167('0x46')](_0x5167('0x55'),_0x41834e[_0x5167('0x52')]),'body':_0x3b4565,'headers':{'Authorization':util['format'](_0x5167('0x47'),new Buffer(_0x42c40a)[_0x5167('0x48')](_0x5167('0x49')))},'json':!![]};rp(_0x1751c4)[_0x5167('0x2a')](function(_0x188ff7){var _0x5835ac={'messageId':_0x188ff7['message_uuid'][0x0]};return _0x356d8a['update'](_0x5835ac);})['catch'](function(_0x427a88){logger['error'](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x51'),util[_0x5167('0x2d')](_0x427a88,{'showHidden':![],'depth':null}));});}else{logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),'plivo',_0x5167('0x56'));}break;case _0x5167('0x57'):if(_0x41834e['username']&&_0x41834e[_0x5167('0x35')]){if(_0x41834e[_0x5167('0x58')]){var _0xd4ca2a={'method':'POST','uri':_0x41834e['baseUrl']+_0x5167('0x59'),'body':{'username':_0x41834e[_0x5167('0x42')],'password':_0x41834e['password']},'json':!![]};return rp(_0xd4ca2a)[_0x5167('0x2a')](function(_0x3a68da){var _0x1a86cd={'method':'POST','uri':_0x41834e[_0x5167('0x58')]+_0x5167('0x5a'),'body':{'messages':[{'from':_0x41834e[_0x5167('0x24')],'destinations':[{'to':_0x349893[_0x5167('0x24')]}],'text':_0x349893[_0x5167('0x27')],'notifyUrl':_0x41834e[_0x5167('0x53')]+_0x5167('0x28')+_0x349893['id']+_0x5167('0x29')+_0x41834e[_0x5167('0x54')],'notifyContentType':_0x5167('0x5b'),'callbackData':_0x41834e[_0x5167('0x24')]+';'+_0x349893['body']}]},'headers':{'Authorization':_0x5167('0x5c')+_0x3a68da[_0x5167('0x54')]},'json':!![]};return rp(_0x1a86cd)[_0x5167('0x2a')](function(_0x81d2f5){if(_0x81d2f5['messages']){var _0x298718={'messageId':_0x81d2f5[_0x5167('0x25')][0x0]['messageId']};if(!_0x41834e[_0x5167('0x3a')]){_0x298718[_0x5167('0x3b')]=!![];}return _0x356d8a[_0x5167('0x1a')](_0x298718);}else{return logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x57'),util[_0x5167('0x2d')](_0x81d2f5,{'showHidden':![],'depth':null}));}});})[_0x5167('0x1c')](function(_0x563f25){return logger[_0x5167('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5167('0x2c'),'infobip',util['inspect'](_0x563f25,{'showHidden':![],'depth':null}));});}else{logger[_0x5167('0x1d')](_0x5167('0x3c'),'afterCreate','infobip',_0x5167('0x5d'));}}else{logger[_0x5167('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5167('0x2c'),_0x5167('0x57'),_0x5167('0x50'));}break;case _0x5167('0x5e'):var _0x16fac8=require(_0x5167('0x5f'));if(_0x41834e[_0x5167('0x60')]){var _0x292bed={};_0x292bed['login']=_0x41834e['username'];_0x292bed['phone']=_0x349893[_0x5167('0x24')];_0x292bed['sender']=_0x41834e[_0x5167('0x24')];_0x292bed[_0x5167('0x61')]=_0x349893[_0x5167('0x27')];_0x292bed[_0x5167('0x62')]=+new Date();var _0x517fd1='';var _0x14beb8='';var _0x4f1842=Object[_0x5167('0x63')](_0x292bed);_0x4f1842[_0x5167('0x64')]();for(var _0x39d195=0x0;_0x39d195<_0x4f1842[_0x5167('0x65')];_0x39d195++){if(_0x517fd1!=''){_0x517fd1+='&';}_0x517fd1+=_0x4f1842[_0x39d195]+'='+encodeURIComponent(_0x292bed[_0x4f1842[_0x39d195]]);_0x14beb8+=_0x292bed[_0x4f1842[_0x39d195]];}_0x14beb8+=_0x41834e[_0x5167('0x60')];_0x14beb8=_0x16fac8['createHash'](_0x5167('0x66'))[_0x5167('0x1a')](_0x14beb8)[_0x5167('0x67')](_0x5167('0x68'));if(_0x517fd1!==''){_0x517fd1+='&';}_0x517fd1+='signature='+_0x14beb8;var _0x29a9eb={'method':_0x5167('0x36'),'uri':_0x41834e[_0x5167('0x58')]+_0x5167('0x69')+_0x517fd1,'json':!![]};return rp(_0x29a9eb)[_0x5167('0x2a')](function(_0x49a6c7){var _0x291977=Object[_0x5167('0x63')](_0x49a6c7);if(_0x49a6c7[_0x291977[0x0]][_0x5167('0x1d')]&&parseInt(_0x49a6c7[_0x291977[0x0]][_0x5167('0x1d')])===0x0){var _0x1cff91={'messageId':_0x49a6c7[_0x291977[0x0]][_0x5167('0x6a')]};if(!_0x41834e['deliveryReport']){_0x1cff91['read']=!![];}return _0x356d8a[_0x5167('0x1a')](_0x1cff91);}else{return logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x5e'),util['inspect'](_0x49a6c7[_0x5167('0x1d')],{'showHidden':![],'depth':null}));}})[_0x5167('0x1c')](function(_0x2e5a55){return logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x5e'),util[_0x5167('0x2d')](_0x2e5a55,{'showHidden':![],'depth':null}));});}else{logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),'csc',_0x5167('0x6b'));}break;case _0x5167('0x6c'):if(_0x41834e[_0x5167('0x60')]){var _0x38c6f4={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x41834e[_0x5167('0x60')]},'body':{'content':_0x349893[_0x5167('0x27')],'to':[_0x349893[_0x5167('0x24')]],'from':_0x41834e[_0x5167('0x24')],'binary':![],'clientMessageId':_0x5167('0x6d'),'charset':'UTF-8'},'json':!![]};rp(_0x38c6f4)[_0x5167('0x2a')](function(_0x3310b5){if(!_0x3310b5[_0x5167('0x1d')]){var _0x857150={'messageId':_0x3310b5[_0x5167('0x25')][0x0][_0x5167('0x6e')]};if(!_0x41834e[_0x5167('0x3a')]){_0x857150[_0x5167('0x3b')]=!![];}return _0x356d8a['update'](_0x857150);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5167('0x2c'),_0x5167('0x6c'),util[_0x5167('0x2d')](_0x3310b5[_0x5167('0x1d')],{'showHidden':![],'depth':null}));}})[_0x5167('0x1c')](function(_0x4b0fef){return logger[_0x5167('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5167('0x2c'),'clickatell',util[_0x5167('0x2d')](_0x4b0fef,{'showHidden':![],'depth':null}));});}else{logger[_0x5167('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5167('0x2c'),_0x5167('0x6c'),'Missing\x20parameters:\x20apiKey');}break;case _0x5167('0x6f'):if(_0x41834e['username']&&_0x41834e[_0x5167('0x35')]){var _0x42c40a=util[_0x5167('0x46')](_0x5167('0x44'),_0x41834e[_0x5167('0x42')],_0x41834e[_0x5167('0x35')]);var _0x1751c4={'method':'POST','uri':_0x5167('0x70')+_0x41834e[_0x5167('0x71')]+_0x5167('0x72'),'body':{'to':[_0x349893[_0x5167('0x24')]],'text':_0x349893[_0x5167('0x27')],'from':_0x41834e[_0x5167('0x24')],'applicationId':_0x41834e[_0x5167('0x73')]},'headers':{'Authorization':util[_0x5167('0x46')](_0x5167('0x47'),new Buffer(_0x42c40a)[_0x5167('0x48')](_0x5167('0x49')))},'json':!![]};rp(_0x1751c4)[_0x5167('0x2a')](function(_0x28b09e){if(_0x28b09e['id']){var _0x13b0f0={'messageId':_0x28b09e['id']};return _0x356d8a[_0x5167('0x1a')](_0x13b0f0);}else{logger['error'](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x6f'),util[_0x5167('0x2d')](_0x28b09e,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3a9a02){logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x6f'),util[_0x5167('0x2d')](_0x3a9a02,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x6f'),_0x5167('0x50'));}break;case _0x5167('0x74'):if(_0x41834e[_0x5167('0x60')]){var _0x4fb858={};var _0x29a9eb={'method':_0x5167('0x38'),'uri':_0x5167('0x75'),'headers':{'Authorization':_0x5167('0x76')+_0x41834e[_0x5167('0x60')],'Content-Type':'application/json'},'body':{'from':_0x41834e['phone'],'to':_0x349893[_0x5167('0x24')],'text':_0x349893[_0x5167('0x27')]},'json':!![]};return rp(_0x29a9eb)[_0x5167('0x2a')](function(_0x423c16){if(_0x423c16[_0x5167('0x77')]==0xca){_0x4fb858[_0x5167('0x78')]=_0x423c16;var _0x64be62={'method':_0x5167('0x38'),'uri':_0x5167('0x79'),'headers':{'Authorization':_0x5167('0x76')+_0x41834e[_0x5167('0x60')],'Content-Type':_0x5167('0x5b')},'body':{'refid':_0x4fb858[_0x5167('0x78')][_0x5167('0x7a')]},'json':!![]};return rp(_0x64be62)[_0x5167('0x2a')](function(_0x54bfb0){_0x4fb858[_0x5167('0x7b')]=_0x54bfb0;var _0x531f76={'messageId':_0x4fb858[_0x5167('0x78')]['refid'],'read':!![]};return _0x356d8a[_0x5167('0x1a')](_0x531f76);});}else{return logger['error'](_0x5167('0x3c'),_0x5167('0x2c'),'intelepeer',util[_0x5167('0x2d')](_0x423c16,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5f06c1){return logger[_0x5167('0x1d')](_0x5167('0x3c'),_0x5167('0x2c'),_0x5167('0x74'),util[_0x5167('0x2d')](_0x5f06c1,{'showHidden':![],'depth':null}));});}else{return logger[_0x5167('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5167('0x2c'),_0x5167('0x74'),_0x5167('0x7c'));}break;}}})[_0x5167('0x7d')](function(){_0x1f432a();});}else{_0x1f432a();}}},'charset':_0x5167('0x7e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xff1f=['isNil','UserId','SmsInteractionId','findOne','update','createdAt','SmsAccount','find','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','then','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','username','&password=','password','GET','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','sort','length','createHash','md5','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0xff1f,0xe5));var _0xfff1=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0xff1f[_0x231a47];return _0x48d7c9;};'use strict';var _=require(_0xfff1('0x0'));var util=require(_0xfff1('0x1'));var logger=require(_0xfff1('0x2'))(_0xfff1('0x3'));var moment=require(_0xfff1('0x4'));var BPromise=require(_0xfff1('0x5'));var rp=require(_0xfff1('0x6'));var fs=require('fs');var path=require(_0xfff1('0x7'));var rimraf=require(_0xfff1('0x8'));var config=require(_0xfff1('0x9'));var attributes=require(_0xfff1('0xa'));module[_0xfff1('0xb')]=function(_0x128140,_0xd92b8e){return _0x128140[_0xfff1('0xc')](_0xfff1('0xd'),attributes,{'tableName':_0xfff1('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xfff1('0xf')]},{'name':_0xfff1('0x10'),'fields':[_0xfff1('0x11')],'type':_0xfff1('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x471d5c,_0x59c950,_0x26aa8e){var _0x15183f=_0x128140[_0xfff1('0x13')];var _0x13b467=_0x471d5c[_0xfff1('0x14')]({'plain':!![]});if(_0x13b467['direction']['toLowerCase']()==='in'||_0x13b467[_0xfff1('0x15')][_0xfff1('0x16')]()===_0xfff1('0x17')&&!_0x13b467[_0xfff1('0x18')]&&!_[_0xfff1('0x19')](_0x13b467[_0xfff1('0x1a')])&&!_[_0xfff1('0x19')](_0x13b467[_0xfff1('0x1b')])){_0x15183f['SmsInteraction'][_0xfff1('0x1c')]({'where':{'id':_0x13b467['SmsInteractionId']}})['then'](function(_0x11656e){if(_0x11656e){_0x11656e[_0xfff1('0x1d')]({'lastMsgAt':_0x13b467[_0xfff1('0x1e')],'lastMsgDirection':_0x13b467[_0xfff1('0x15')]['toLowerCase']()});}})['catch'](function(_0x36467b){console['error'](_0x36467b);});}if(_0x13b467[_0xfff1('0x15')]===_0xfff1('0x17')&&!_0x13b467[_0xfff1('0x18')]){var _0x2ac716;_0x15183f[_0xfff1('0x1f')][_0xfff1('0x20')]({'where':{'id':_0x13b467['SmsAccountId']},'raw':!![]})['then'](function(_0x48ff87){_0x2ac716=_0x48ff87;if(_0x2ac716&&_0x2ac716['type']){switch(_0x2ac716['type']){case _0xfff1('0x21'):var _0x47e210=require(_0xfff1('0x21'));if(_0x2ac716[_0xfff1('0x22')]&&_0x2ac716[_0xfff1('0x23')]&&_0x2ac716[_0xfff1('0x24')]){var _0x53454c=new _0x47e210(_0x2ac716[_0xfff1('0x22')],_0x2ac716[_0xfff1('0x23')]);_0x53454c[_0xfff1('0x25')][_0xfff1('0x26')]({'body':_0x13b467['body'],'to':_0x13b467[_0xfff1('0x24')],'from':_0x2ac716[_0xfff1('0x24')],'statusCallback':_0x2ac716[_0xfff1('0x27')]+_0xfff1('0x28')+_0x13b467['id']+_0xfff1('0x29')+_0x2ac716[_0xfff1('0x2a')]})[_0xfff1('0x2b')](function(_0x163f85){if(_0x163f85[_0xfff1('0x2c')]){return _0x471d5c[_0xfff1('0x1d')]({'messageId':_0x163f85[_0xfff1('0x2c')]});}})[_0xfff1('0x2d')](function(_0x59e181){logger[_0xfff1('0x2e')](_0xfff1('0x2f'),'afterCreate',_0xfff1('0x21'),util[_0xfff1('0x30')](_0x59e181,{'showHidden':![],'depth':null}));});}else{logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x21'),_0xfff1('0x32'));}break;case _0xfff1('0x33'):var _0x5e513d=_0xfff1('0x34');if(_0x2ac716['username']&&_0x2ac716['password']){var _0x4aa019={'recipient':[_0x13b467[_0xfff1('0x24')]],'message':_0x13b467[_0xfff1('0x11')],'message_type':_0x2ac716[_0xfff1('0x35')]};if(_0x2ac716[_0xfff1('0x35')]&&_0x2ac716[_0xfff1('0x35')]!=='SI'){_0x4aa019[_0xfff1('0x36')]=_0x2ac716[_0xfff1('0x24')];}var _0x11f5c4={'url':_0x5e513d+'login?username='+_0x2ac716[_0xfff1('0x37')]+_0xfff1('0x38')+_0x2ac716[_0xfff1('0x39')],'method':_0xfff1('0x3a')};rp(_0x11f5c4)['then'](function(_0x289a2b){var _0x40df1c=_0x289a2b['split'](';');var _0x671698={'user_key':_0x40df1c[0x0],'session_key':_0x40df1c[0x1]};_0x11f5c4={'url':_0x5e513d+_0xfff1('0x3b'),'method':_0xfff1('0x3c'),'headers':{'user_key':_0x671698[_0xfff1('0x3d')],'Session_key':_0x671698[_0xfff1('0x3e')]},'json':!![],'body':_0x4aa019};return rp(_0x11f5c4);})['then'](function(_0x102118){if(_0x102118['total_sent']>=0x1){var _0x4d6b20={'messageId':_0x102118[_0xfff1('0x3f')]};if(_0x2ac716[_0xfff1('0x35')]!=='GP'||!_0x2ac716[_0xfff1('0x40')]){_0x4d6b20[_0xfff1('0x41')]=!![];}return _0x471d5c[_0xfff1('0x1d')](_0x4d6b20);}else{return logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),'skebby',util[_0xfff1('0x30')](_0x102118,{'showHidden':![],'depth':null}));}})[_0xfff1('0x2d')](function(_0x41dd30){return logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x33'),util[_0xfff1('0x30')](_0x41dd30,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x33'),_0xfff1('0x42'));}break;case'connectel':if(_0x2ac716[_0xfff1('0x23')]){var _0x374783={'recipient':_0x13b467[_0xfff1('0x24')],'message':_0x13b467[_0xfff1('0x11')],'sender':_0x2ac716[_0xfff1('0x43')]||_0x2ac716[_0xfff1('0x24')],'authorization':_0x2ac716[_0xfff1('0x23')]};var _0x59c950={'method':_0xfff1('0x3c'),'uri':_0xfff1('0x44'),'body':_0x374783,'json':!![]};rp(_0x59c950)[_0xfff1('0x2b')](function(_0x3b0815){var _0x13715e={'messageId':_0x3b0815['requestid']};if(!_0x2ac716['deliveryReport']){_0x13715e['read']=!![];}return _0x471d5c[_0xfff1('0x1d')](_0x13715e);})[_0xfff1('0x2d')](function(_0x2c3867){logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x45'),util[_0xfff1('0x30')](_0x2c3867,{'showHidden':![],'depth':null}));});}else{logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x45'),_0xfff1('0x46'));}break;case _0xfff1('0x47'):if(_0x2ac716[_0xfff1('0x37')]&&_0x2ac716[_0xfff1('0x39')]){var _0x374783={'messages':[{'source':_0xfff1('0x48'),'to':_0x13b467[_0xfff1('0x24')],'body':_0x13b467['body'],'from':_0x2ac716[_0xfff1('0x43')]||_0x2ac716['phone']}]};var _0x449257=util[_0xfff1('0x49')]('%s:%s',_0x2ac716[_0xfff1('0x37')],_0x2ac716['password']);var _0x59c950={'method':'POST','uri':_0xfff1('0x4a'),'body':_0x374783,'headers':{'Authorization':util['format'](_0xfff1('0x4b'),new Buffer(_0x449257)[_0xfff1('0x4c')](_0xfff1('0x4d')))},'json':!![]};rp(_0x59c950)[_0xfff1('0x2b')](function(_0x915f6d){if(_0x915f6d[_0xfff1('0x4e')]>=0xc8&&_0x915f6d[_0xfff1('0x4e')]<=0xce){if(_0x915f6d[_0xfff1('0x4f')]&&_0x915f6d['data'][_0xfff1('0x50')]>0x0){var _0x1fa1a9=_['head'](_0x915f6d[_0xfff1('0x4f')][_0xfff1('0x25')]);var _0x3ff784={'messageId':_0x1fa1a9[_0xfff1('0x51')]};if(!_0x2ac716['deliveryReport']){_0x3ff784['read']=!![];}return _0x471d5c['update'](_0x3ff784);}else{logger[_0xfff1('0x2e')](_0xfff1('0x2f'),'afterCreate',_0xfff1('0x52'),util[_0xfff1('0x30')](_0x915f6d,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xfff1('0x2f'),'afterCreate','clickSend',util[_0xfff1('0x30')](_0x915f6d,{'showHidden':![],'depth':null}));}})[_0xfff1('0x2d')](function(_0x1f0f70){logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x52'),util[_0xfff1('0x30')](_0x1f0f70,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfff1('0x31'),_0xfff1('0x52'),_0xfff1('0x42'));}break;case _0xfff1('0x53'):if(_0x2ac716[_0xfff1('0x54')]&&_0x2ac716['authToken']){var _0x374783={'dst':_0x13b467['phone'],'text':_0x13b467[_0xfff1('0x11')],'src':_0x2ac716[_0xfff1('0x43')]||_0x2ac716[_0xfff1('0x24')],'url':_0x2ac716[_0xfff1('0x27')]+_0xfff1('0x28')+_0x13b467['id']+'/status?token='+_0x2ac716[_0xfff1('0x2a')]};var _0x449257=util[_0xfff1('0x49')](_0xfff1('0x55'),_0x2ac716[_0xfff1('0x54')],_0x2ac716['authToken']);var _0x59c950={'method':'POST','uri':util[_0xfff1('0x49')](_0xfff1('0x56'),_0x2ac716[_0xfff1('0x54')]),'body':_0x374783,'headers':{'Authorization':util[_0xfff1('0x49')](_0xfff1('0x4b'),new Buffer(_0x449257)[_0xfff1('0x4c')]('base64'))},'json':!![]};rp(_0x59c950)[_0xfff1('0x2b')](function(_0x519bd7){var _0x506ddf={'messageId':_0x519bd7[_0xfff1('0x57')][0x0]};return _0x471d5c['update'](_0x506ddf);})[_0xfff1('0x2d')](function(_0x53b16d){logger[_0xfff1('0x2e')](_0xfff1('0x2f'),'afterCreate',_0xfff1('0x53'),util[_0xfff1('0x30')](_0x53b16d,{'showHidden':![],'depth':null}));});}else{logger[_0xfff1('0x2e')](_0xfff1('0x2f'),'afterCreate',_0xfff1('0x53'),_0xfff1('0x58'));}break;case _0xfff1('0x59'):if(_0x2ac716[_0xfff1('0x37')]&&_0x2ac716[_0xfff1('0x39')]){if(_0x2ac716[_0xfff1('0x5a')]){var _0x785ec7={'method':'POST','uri':_0x2ac716[_0xfff1('0x5a')]+'/auth/1/session','body':{'username':_0x2ac716[_0xfff1('0x37')],'password':_0x2ac716[_0xfff1('0x39')]},'json':!![]};return rp(_0x785ec7)[_0xfff1('0x2b')](function(_0x46c8a4){var _0x237d16={'method':'POST','uri':_0x2ac716['baseUrl']+_0xfff1('0x5b'),'body':{'messages':[{'from':_0x2ac716[_0xfff1('0x24')],'destinations':[{'to':_0x13b467[_0xfff1('0x24')]}],'text':_0x13b467[_0xfff1('0x11')],'notifyUrl':_0x2ac716[_0xfff1('0x27')]+'/api/sms/messages/'+_0x13b467['id']+_0xfff1('0x29')+_0x2ac716[_0xfff1('0x2a')],'notifyContentType':_0xfff1('0x5c'),'callbackData':_0x2ac716[_0xfff1('0x24')]+';'+_0x13b467[_0xfff1('0x11')]}]},'headers':{'Authorization':_0xfff1('0x5d')+_0x46c8a4[_0xfff1('0x2a')]},'json':!![]};return rp(_0x237d16)[_0xfff1('0x2b')](function(_0x379c4d){if(_0x379c4d[_0xfff1('0x25')]){var _0x214c6a={'messageId':_0x379c4d[_0xfff1('0x25')][0x0][_0xfff1('0xf')]};if(!_0x2ac716['deliveryReport']){_0x214c6a['read']=!![];}return _0x471d5c[_0xfff1('0x1d')](_0x214c6a);}else{return logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x59'),util[_0xfff1('0x30')](_0x379c4d,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3891f9){return logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),'infobip',util['inspect'](_0x3891f9,{'showHidden':![],'depth':null}));});}else{logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x59'),_0xfff1('0x5e'));}}else{logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x59'),_0xfff1('0x42'));}break;case _0xfff1('0x5f'):var _0x48fd95=require(_0xfff1('0x60'));if(_0x2ac716[_0xfff1('0x61')]){var _0x3414b7={};_0x3414b7[_0xfff1('0x62')]=_0x2ac716['username'];_0x3414b7[_0xfff1('0x24')]=_0x13b467['phone'];_0x3414b7[_0xfff1('0x36')]=_0x2ac716[_0xfff1('0x24')];_0x3414b7[_0xfff1('0x63')]=_0x13b467[_0xfff1('0x11')];_0x3414b7['timestamp']=+new Date();var _0x357e41='';var _0x51dde2='';var _0x303c96=Object[_0xfff1('0x64')](_0x3414b7);_0x303c96[_0xfff1('0x65')]();for(var _0x527506=0x0;_0x527506<_0x303c96[_0xfff1('0x66')];_0x527506++){if(_0x357e41!=''){_0x357e41+='&';}_0x357e41+=_0x303c96[_0x527506]+'='+encodeURIComponent(_0x3414b7[_0x303c96[_0x527506]]);_0x51dde2+=_0x3414b7[_0x303c96[_0x527506]];}_0x51dde2+=_0x2ac716['apiKey'];_0x51dde2=_0x48fd95[_0xfff1('0x67')](_0xfff1('0x68'))[_0xfff1('0x1d')](_0x51dde2)['digest']('hex');if(_0x357e41!==''){_0x357e41+='&';}_0x357e41+=_0xfff1('0x69')+_0x51dde2;var _0x11f5c4={'method':_0xfff1('0x3a'),'uri':_0x2ac716[_0xfff1('0x5a')]+_0xfff1('0x6a')+_0x357e41,'json':!![]};return rp(_0x11f5c4)['then'](function(_0x302047){var _0x5b8798=Object[_0xfff1('0x64')](_0x302047);if(_0x302047[_0x5b8798[0x0]][_0xfff1('0x2e')]&&parseInt(_0x302047[_0x5b8798[0x0]][_0xfff1('0x2e')])===0x0){var _0x849409={'messageId':_0x302047[_0x5b8798[0x0]][_0xfff1('0x6b')]};if(!_0x2ac716[_0xfff1('0x40')]){_0x849409[_0xfff1('0x41')]=!![];}return _0x471d5c[_0xfff1('0x1d')](_0x849409);}else{return logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x5f'),util['inspect'](_0x302047[_0xfff1('0x2e')],{'showHidden':![],'depth':null}));}})[_0xfff1('0x2d')](function(_0xc66d07){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfff1('0x31'),_0xfff1('0x5f'),util[_0xfff1('0x30')](_0xc66d07,{'showHidden':![],'depth':null}));});}else{logger[_0xfff1('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfff1('0x31'),_0xfff1('0x5f'),'Missing\x20parameters:\x20apiKey');}break;case _0xfff1('0x6c'):if(_0x2ac716['apiKey']){var _0x2054bd={'method':_0xfff1('0x3c'),'uri':_0xfff1('0x6d'),'headers':{'Authorization':_0x2ac716[_0xfff1('0x61')]},'body':{'content':_0x13b467[_0xfff1('0x11')],'to':[_0x13b467['phone']],'from':_0x2ac716[_0xfff1('0x24')],'binary':![],'clientMessageId':_0xfff1('0x6e'),'charset':_0xfff1('0x6f')},'json':!![]};rp(_0x2054bd)[_0xfff1('0x2b')](function(_0x52073f){if(!_0x52073f[_0xfff1('0x2e')]){var _0x46aff7={'messageId':_0x52073f[_0xfff1('0x25')][0x0][_0xfff1('0x70')]};if(!_0x2ac716[_0xfff1('0x40')]){_0x46aff7[_0xfff1('0x41')]=!![];}return _0x471d5c[_0xfff1('0x1d')](_0x46aff7);}else{return logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),'clickatell',util[_0xfff1('0x30')](_0x52073f[_0xfff1('0x2e')],{'showHidden':![],'depth':null}));}})[_0xfff1('0x2d')](function(_0x32847a){return logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x6c'),util['inspect'](_0x32847a,{'showHidden':![],'depth':null}));});}else{logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x6c'),_0xfff1('0x71'));}break;case _0xfff1('0x72'):if(_0x2ac716[_0xfff1('0x37')]&&_0x2ac716['password']){var _0x449257=util[_0xfff1('0x49')](_0xfff1('0x55'),_0x2ac716[_0xfff1('0x37')],_0x2ac716['password']);var _0x59c950={'method':'POST','uri':_0xfff1('0x73')+_0x2ac716[_0xfff1('0x74')]+_0xfff1('0x75'),'body':{'to':[_0x13b467[_0xfff1('0x24')]],'text':_0x13b467[_0xfff1('0x11')],'from':_0x2ac716[_0xfff1('0x24')],'applicationId':_0x2ac716['applicationId']},'headers':{'Authorization':util[_0xfff1('0x49')]('Basic\x20%s',new Buffer(_0x449257)[_0xfff1('0x4c')](_0xfff1('0x4d')))},'json':!![]};rp(_0x59c950)['then'](function(_0x4ffc00){if(_0x4ffc00['id']){var _0x348853={'messageId':_0x4ffc00['id']};return _0x471d5c['update'](_0x348853);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfff1('0x31'),_0xfff1('0x72'),util[_0xfff1('0x30')](_0x4ffc00,{'showHidden':![],'depth':null}));}})[_0xfff1('0x2d')](function(_0x721ded){logger[_0xfff1('0x2e')](_0xfff1('0x2f'),'afterCreate','bandwidth',util[_0xfff1('0x30')](_0x721ded,{'showHidden':![],'depth':null}));});}else{logger[_0xfff1('0x2e')](_0xfff1('0x2f'),'afterCreate',_0xfff1('0x72'),_0xfff1('0x42'));}break;case _0xfff1('0x76'):if(_0x2ac716['apiKey']){var _0x5298e4={};var _0x11f5c4={'method':_0xfff1('0x3c'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x2ac716[_0xfff1('0x61')],'Content-Type':'application/json'},'body':{'from':_0x2ac716[_0xfff1('0x24')],'to':_0x13b467['phone'],'text':_0x13b467[_0xfff1('0x11')]},'json':!![]};return rp(_0x11f5c4)[_0xfff1('0x2b')](function(_0x15b735){if(_0x15b735['code']==0xca){_0x5298e4['message']=_0x15b735;var _0x156517={'method':_0xfff1('0x3c'),'uri':_0xfff1('0x77'),'headers':{'Authorization':'Bearer\x20'+_0x2ac716[_0xfff1('0x61')],'Content-Type':_0xfff1('0x5c')},'body':{'refid':_0x5298e4['message'][_0xfff1('0x78')]},'json':!![]};return rp(_0x156517)[_0xfff1('0x2b')](function(_0x15288c){_0x5298e4[_0xfff1('0x79')]=_0x15288c;var _0x4414ed={'messageId':_0x5298e4[_0xfff1('0x7a')]['refid'],'read':!![]};return _0x471d5c['update'](_0x4414ed);});}else{return logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),_0xfff1('0x76'),util[_0xfff1('0x30')](_0x15b735,{'showHidden':![],'depth':null}));}})[_0xfff1('0x2d')](function(_0xc25bf){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfff1('0x31'),_0xfff1('0x76'),util[_0xfff1('0x30')](_0xc25bf,{'showHidden':![],'depth':null}));});}else{return logger[_0xfff1('0x2e')](_0xfff1('0x2f'),_0xfff1('0x31'),'intelepeer',_0xfff1('0x7b'));}break;}}})[_0xfff1('0x7c')](function(){_0x26aa8e();});}else{_0x26aa8e();}}},'charset':_0xfff1('0x7d'),'collate':_0xfff1('0x7e')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 15d13e9..2feb3b0 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 _0xc734=['../../config/environment','jayson/promise','redis','defaults','localhost','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateSmsMessage','create','body','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xc734,0x14e));var _0x4c73=function(_0x528497,_0x147e87){_0x528497=_0x528497-0x0;var _0x392d59=_0xc734[_0x528497];return _0x392d59;};'use strict';var _=require(_0x4c73('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4c73('0x1'));var rs=require(_0x4c73('0x2'));var fs=require('fs');var Redis=require(_0x4c73('0x3'));var db=require(_0x4c73('0x4'))['db'];var utils=require(_0x4c73('0x5'));var logger=require('../../config/logger')(_0x4c73('0x6'));var config=require(_0x4c73('0x7'));var jayson=require(_0x4c73('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x4c73('0x9')]=_[_0x4c73('0xa')](config[_0x4c73('0x9')],{'host':_0x4c73('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4c73('0xc'))[_0x4c73('0xd')](socket);function respondWithRpcPromise(_0x360ce1,_0x3491e8,_0x28b4f9){return new BPromise(function(_0x32e01f,_0x472837){return client[_0x4c73('0xe')](_0x360ce1,_0x28b4f9)[_0x4c73('0xf')](function(_0x521a1b){logger['info'](_0x4c73('0x10'),_0x3491e8,_0x4c73('0x11'));logger[_0x4c73('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3491e8,_0x4c73('0x11'),JSON[_0x4c73('0x13')](_0x521a1b));if(_0x521a1b[_0x4c73('0x14')]){if(_0x521a1b[_0x4c73('0x14')][_0x4c73('0x15')]===0x1f4){logger['error'](_0x4c73('0x10'),_0x3491e8,_0x521a1b['error'][_0x4c73('0x16')]);return _0x472837(_0x521a1b[_0x4c73('0x14')]['message']);}logger[_0x4c73('0x14')]('SmsMessage,\x20%s,\x20%s',_0x3491e8,_0x521a1b[_0x4c73('0x14')]['message']);return _0x32e01f(_0x521a1b['error'][_0x4c73('0x16')]);}else{logger[_0x4c73('0x17')](_0x4c73('0x10'),_0x3491e8,_0x4c73('0x11'));_0x32e01f(_0x521a1b[_0x4c73('0x18')][_0x4c73('0x16')]);}})[_0x4c73('0x19')](function(_0x5f13cf){logger[_0x4c73('0x14')](_0x4c73('0x10'),_0x3491e8,_0x5f13cf);_0x472837(_0x5f13cf);});});}exports[_0x4c73('0x1a')]=function(_0x114ca2){var _0x1f05bf=this;return new Promise(function(_0x739883,_0x243958){return db['SmsMessage'][_0x4c73('0x1b')](_0x114ca2[_0x4c73('0x1c')],{'raw':_0x114ca2[_0x4c73('0x1d')]?_0x114ca2[_0x4c73('0x1d')][_0x4c73('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4ce488){logger[_0x4c73('0x17')](_0x4c73('0x1a'),_0x114ca2);logger[_0x4c73('0x12')](_0x4c73('0x1a'),_0x114ca2,JSON[_0x4c73('0x13')](_0x4ce488));_0x739883(_0x4ce488);})[_0x4c73('0x19')](function(_0x284405){logger[_0x4c73('0x14')](_0x4c73('0x1a'),_0x284405['message'],_0x114ca2);_0x243958(_0x1f05bf[_0x4c73('0x14')](0x1f4,_0x284405['message']));});});}; \ No newline at end of file +var _0xb4bc=['SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','create','body','options','stringify','lodash','util','moment','../../mysqldb','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsMessage.socket','register','request','then','info','debug'];(function(_0x8838b6,_0x38a3d4){var _0x2c1867=function(_0x2f610a){while(--_0x2f610a){_0x8838b6['push'](_0x8838b6['shift']());}};_0x2c1867(++_0x38a3d4);}(_0xb4bc,0x108));var _0xcb4b=function(_0x135c0c,_0x91ac2){_0x135c0c=_0x135c0c-0x0;var _0x2ee417=_0xb4bc[_0x135c0c];return _0x2ee417;};'use strict';var _=require(_0xcb4b('0x0'));var util=require(_0xcb4b('0x1'));var moment=require(_0xcb4b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb4b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xcb4b('0x4'));var jayson=require(_0xcb4b('0x5'));var client=jayson[_0xcb4b('0x6')]['http']({'port':0x232a});config[_0xcb4b('0x7')]=_[_0xcb4b('0x8')](config['redis'],{'host':_0xcb4b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb4b('0x7')]));require(_0xcb4b('0xa'))[_0xcb4b('0xb')](socket);function respondWithRpcPromise(_0xf3a028,_0x5d7a3f,_0x3c24f8){return new BPromise(function(_0x551844,_0xf4e485){return client[_0xcb4b('0xc')](_0xf3a028,_0x3c24f8)[_0xcb4b('0xd')](function(_0x39ec27){logger[_0xcb4b('0xe')]('SmsMessage,\x20%s,\x20%s',_0x5d7a3f,'request\x20sent');logger[_0xcb4b('0xf')](_0xcb4b('0x10'),_0x5d7a3f,'request\x20sent',JSON['stringify'](_0x39ec27));if(_0x39ec27[_0xcb4b('0x11')]){if(_0x39ec27[_0xcb4b('0x11')][_0xcb4b('0x12')]===0x1f4){logger[_0xcb4b('0x11')](_0xcb4b('0x13'),_0x5d7a3f,_0x39ec27['error'][_0xcb4b('0x14')]);return _0xf4e485(_0x39ec27[_0xcb4b('0x11')][_0xcb4b('0x14')]);}logger[_0xcb4b('0x11')](_0xcb4b('0x13'),_0x5d7a3f,_0x39ec27['error']['message']);return _0x551844(_0x39ec27[_0xcb4b('0x11')][_0xcb4b('0x14')]);}else{logger['info'](_0xcb4b('0x13'),_0x5d7a3f,'request\x20sent');_0x551844(_0x39ec27[_0xcb4b('0x15')][_0xcb4b('0x14')]);}})[_0xcb4b('0x16')](function(_0x2e6a16){logger['error'](_0xcb4b('0x13'),_0x5d7a3f,_0x2e6a16);_0xf4e485(_0x2e6a16);});});}exports[_0xcb4b('0x17')]=function(_0x4c544d){var _0x4c4735=this;return new Promise(function(_0x1ab3a4,_0x35e043){return db['SmsMessage'][_0xcb4b('0x18')](_0x4c544d[_0xcb4b('0x19')],{'raw':_0x4c544d[_0xcb4b('0x1a')]?_0x4c544d['options']['raw']===undefined?!![]:![]:!![]})[_0xcb4b('0xd')](function(_0x287c7e){logger['info']('CreateSmsMessage',_0x4c544d);logger[_0xcb4b('0xf')](_0xcb4b('0x17'),_0x4c544d,JSON[_0xcb4b('0x1b')](_0x287c7e));_0x1ab3a4(_0x287c7e);})[_0xcb4b('0x16')](function(_0x3aeed1){logger[_0xcb4b('0x11')](_0xcb4b('0x17'),_0x3aeed1[_0xcb4b('0x14')],_0x4c544d);_0x35e043(_0x4c4735['error'](0x1f4,_0x3aeed1[_0xcb4b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index b4ad33e..7d40ae3 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 _0x4355=['removeListener','register','length','smsMessage:','./smsMessage.events','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4355,0x169));var _0x5435=function(_0x34959f,_0x599d5b){_0x34959f=_0x34959f-0x0;var _0x3240dd=_0x4355[_0x34959f];return _0x3240dd;};'use strict';var SmsMessageEvents=require(_0x5435('0x0'));var events=[_0x5435('0x1'),'remove','update'];function createListener(_0x16bf1c,_0x2a2bf9){return function(_0x546e6b){_0x2a2bf9[_0x5435('0x2')](_0x16bf1c,_0x546e6b);};}function removeListener(_0x3da730,_0x28df12){return function(){SmsMessageEvents[_0x5435('0x3')](_0x3da730,_0x28df12);};}exports[_0x5435('0x4')]=function(_0x39715d){for(var _0x305599=0x0,_0x53a9b5=events[_0x5435('0x5')];_0x305599<_0x53a9b5;_0x305599++){var _0x2661d2=events[_0x305599];var _0x468b01=createListener(_0x5435('0x6')+_0x2661d2,_0x39715d);SmsMessageEvents['on'](_0x2661d2,_0x468b01);}}; \ No newline at end of file +var _0xcdae=['length','save','remove','update','emit','removeListener'];(function(_0x152ef7,_0x221f4c){var _0x33b535=function(_0x4d9ab7){while(--_0x4d9ab7){_0x152ef7['push'](_0x152ef7['shift']());}};_0x33b535(++_0x221f4c);}(_0xcdae,0x139));var _0xecda=function(_0x31d849,_0xe45981){_0x31d849=_0x31d849-0x0;var _0x2e8a8f=_0xcdae[_0x31d849];return _0x2e8a8f;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xecda('0x0'),_0xecda('0x1'),_0xecda('0x2')];function createListener(_0x5ca5c0,_0x129c2a){return function(_0x52deef){_0x129c2a[_0xecda('0x3')](_0x5ca5c0,_0x52deef);};}function removeListener(_0x31397d,_0x545d3f){return function(){SmsMessageEvents[_0xecda('0x4')](_0x31397d,_0x545d3f);};}exports['register']=function(_0x4729e2){for(var _0x354fe6=0x0,_0x3b16ca=events[_0xecda('0x5')];_0x354fe6<_0x3b16ca;_0x354fe6++){var _0x4a60be=events[_0x354fe6];var _0xc3027d=createListener('smsMessage:'+_0x4a60be,_0x4729e2);SmsMessageEvents['on'](_0x4a60be,_0xc3027d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 2857c01..779f18d 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 _0x8f00=['/:id/users','getAgents','post','create','addTeams','addAgents','update','removeTeams','delete','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','/:id','show','/:id/members','/:id/teams'];(function(_0x48c3ec,_0x284be7){var _0x2b7c4e=function(_0x20ca72){while(--_0x20ca72){_0x48c3ec['push'](_0x48c3ec['shift']());}};_0x2b7c4e(++_0x284be7);}(_0x8f00,0xf5));var _0x08f0=function(_0xd950d0,_0x46baef){_0xd950d0=_0xd950d0-0x0;var _0x46958c=_0x8f00[_0xd950d0];return _0x46958c;};'use strict';var multer=require('multer');var util=require(_0x08f0('0x0'));var path=require('path');var timeout=require(_0x08f0('0x1'));var express=require(_0x08f0('0x2'));var router=express[_0x08f0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x08f0('0x4'));var interaction=require(_0x08f0('0x5'));var config=require(_0x08f0('0x6'));var controller=require(_0x08f0('0x7'));router[_0x08f0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x08f0('0x8')](_0x08f0('0x9'),auth[_0x08f0('0xa')](),controller['describe']);router['get'](_0x08f0('0xb'),auth[_0x08f0('0xa')](),controller[_0x08f0('0xc')]);router['get'](_0x08f0('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0x08f0('0x8')](_0x08f0('0xe'),auth[_0x08f0('0xa')](),controller['getTeams']);router[_0x08f0('0x8')](_0x08f0('0xf'),auth[_0x08f0('0xa')](),controller[_0x08f0('0x10')]);router[_0x08f0('0x11')]('/',auth[_0x08f0('0xa')](),controller[_0x08f0('0x12')]);router[_0x08f0('0x11')](_0x08f0('0xe'),auth['isAuthenticated'](),controller[_0x08f0('0x13')]);router['post'](_0x08f0('0xf'),auth[_0x08f0('0xa')](),controller[_0x08f0('0x14')]);router['put'](_0x08f0('0xb'),auth['isAuthenticated'](),controller[_0x08f0('0x15')]);router['delete'](_0x08f0('0xb'),auth[_0x08f0('0xa')](),controller['destroy']);router['delete'](_0x08f0('0xe'),auth[_0x08f0('0xa')](),controller[_0x08f0('0x16')]);router[_0x08f0('0x17')](_0x08f0('0xf'),auth[_0x08f0('0xa')](),controller[_0x08f0('0x18')]);module[_0x08f0('0x19')]=router; \ No newline at end of file +var _0xc830=['addTeams','addAgents','update','delete','destroy','removeTeams','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x3b95e2,_0x3d2dfb){var _0x1191c4=function(_0x4a18b3){while(--_0x4a18b3){_0x3b95e2['push'](_0x3b95e2['shift']());}};_0x1191c4(++_0x3d2dfb);}(_0xc830,0xf6));var _0x0c83=function(_0x1e0d48,_0x44be9d){_0x1e0d48=_0x1e0d48-0x0;var _0x4b2b6e=_0xc830[_0x1e0d48];return _0x4b2b6e;};'use strict';var multer=require('multer');var util=require(_0x0c83('0x0'));var path=require(_0x0c83('0x1'));var timeout=require(_0x0c83('0x2'));var express=require(_0x0c83('0x3'));var router=express[_0x0c83('0x4')]();var fs_extra=require(_0x0c83('0x5'));var auth=require(_0x0c83('0x6'));var interaction=require(_0x0c83('0x7'));var config=require(_0x0c83('0x8'));var controller=require(_0x0c83('0x9'));router[_0x0c83('0xa')]('/',auth[_0x0c83('0xb')](),controller['index']);router[_0x0c83('0xa')](_0x0c83('0xc'),auth[_0x0c83('0xb')](),controller[_0x0c83('0xd')]);router[_0x0c83('0xa')](_0x0c83('0xe'),auth[_0x0c83('0xb')](),controller[_0x0c83('0xf')]);router['get'](_0x0c83('0x10'),auth[_0x0c83('0xb')](),controller[_0x0c83('0x11')]);router[_0x0c83('0xa')](_0x0c83('0x12'),auth[_0x0c83('0xb')](),controller[_0x0c83('0x13')]);router[_0x0c83('0xa')](_0x0c83('0x14'),auth[_0x0c83('0xb')](),controller[_0x0c83('0x15')]);router[_0x0c83('0x16')]('/',auth[_0x0c83('0xb')](),controller[_0x0c83('0x17')]);router[_0x0c83('0x16')](_0x0c83('0x12'),auth[_0x0c83('0xb')](),controller[_0x0c83('0x18')]);router[_0x0c83('0x16')](_0x0c83('0x14'),auth[_0x0c83('0xb')](),controller[_0x0c83('0x19')]);router['put'](_0x0c83('0xe'),auth[_0x0c83('0xb')](),controller[_0x0c83('0x1a')]);router[_0x0c83('0x1b')]('/:id',auth[_0x0c83('0xb')](),controller[_0x0c83('0x1c')]);router[_0x0c83('0x1b')](_0x0c83('0x12'),auth[_0x0c83('0xb')](),controller[_0x0c83('0x1d')]);router[_0x0c83('0x1b')]('/:id/users',auth[_0x0c83('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 042b585..f88164c 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 _0x5998=['name','INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x5998,0xc1));var _0x8599=function(_0x69d865,_0x5da6b3){_0x69d865=_0x69d865-0x0;var _0x2bc7e8=_0x5998[_0x69d865];return _0x2bc7e8;};'use strict';var Sequelize=require(_0x8599('0x0'));module[_0x8599('0x1')]={'name':{'type':Sequelize[_0x8599('0x2')],'unique':_0x8599('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8599('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x8599('0x5'),_0x8599('0x6'))}}; \ No newline at end of file +var _0xa496=['exports','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3051b4,_0x5e34f9){var _0x2ed431=function(_0x28e89f){while(--_0x28e89f){_0x3051b4['push'](_0x3051b4['shift']());}};_0x2ed431(++_0x5e34f9);}(_0xa496,0x8a));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x6a49('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6a49('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6a49('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6a49('0x3')](_0x6a49('0x4'),_0x6a49('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f079961..2691eb2 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 _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0xadb5,0xad));var _0x5adb=function(_0xdd6fd4,_0x9b6439){_0xdd6fd4=_0xdd6fd4-0x0;var _0x5e1c7c=_0xadb5[_0xdd6fd4];return _0x5e1c7c;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x34db21,_0x4256bb){var _0x5e7d82=function(_0x5bee79){while(--_0x5bee79){_0x34db21['push'](_0x34db21['shift']());}};_0x5e7d82(++_0x4256bb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13cfcc,_0x649586){_0x13cfcc=_0x13cfcc-0x0;var _0x39dd87=_0x5f2f[_0x13cfcc];return _0x39dd87;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 4612168..9bf1587 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 _0xbede=['exports','events','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2e5597,_0x305053){var _0x2afecb=function(_0xbc8cba){while(--_0xbc8cba){_0x2e5597['push'](_0x2e5597['shift']());}};_0x2afecb(++_0x305053);}(_0xbede,0x151));var _0xebed=function(_0x4c4213,_0x12fa78){_0x4c4213=_0x4c4213-0x0;var _0x5e95cf=_0xbede[_0x4c4213];return _0x5e95cf;};'use strict';var EventEmitter=require(_0xebed('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xebed('0x1'),'afterUpdate':_0xebed('0x2'),'afterDestroy':_0xebed('0x3')};function emitEvent(_0x29784a){return function(_0x2a802c,_0x1888bc,_0xd30d3c){SmsQueueEvents[_0xebed('0x4')](_0x29784a+':'+_0x2a802c['id'],_0x2a802c);SmsQueueEvents[_0xebed('0x4')](_0x29784a,_0x2a802c);_0xd30d3c(null);};}for(var e in events){if(events[_0xebed('0x5')](e)){var event=events[e];SmsQueue[_0xebed('0x6')](e,emitEvent(event));}}module[_0xebed('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xf52e=['setMaxListeners','save','update','emit','hook','events','../../mysqldb','SmsQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf52e,0x1ed));var _0xef52=function(_0x13d75a,_0x2a248d){_0x13d75a=_0x13d75a-0x0;var _0x2990e9=_0xf52e[_0x13d75a];return _0x2990e9;};'use strict';var EventEmitter=require(_0xef52('0x0'));var SmsQueue=require(_0xef52('0x1'))['db'][_0xef52('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xef52('0x3')](0x0);var events={'afterCreate':_0xef52('0x4'),'afterUpdate':_0xef52('0x5'),'afterDestroy':'remove'};function emitEvent(_0xad255e){return function(_0x54ea19,_0x5b9058,_0x138baa){SmsQueueEvents[_0xef52('0x6')](_0xad255e+':'+_0x54ea19['id'],_0x54ea19);SmsQueueEvents[_0xef52('0x6')](_0xad255e,_0x54ea19);_0x138baa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xef52('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index e6354ff..8f2fb53 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 _0x6061=['request-promise','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x539f89,_0xb53a15){var _0x2d6969=function(_0x46d481){while(--_0x46d481){_0x539f89['push'](_0x539f89['shift']());}};_0x2d6969(++_0xb53a15);}(_0x6061,0xd2));var _0x1606=function(_0x32f856,_0xd64efd){_0x32f856=_0x32f856-0x0;var _0x5c4947=_0x6061[_0x32f856];return _0x5c4947;};'use strict';var _=require(_0x1606('0x0'));var util=require(_0x1606('0x1'));var logger=require(_0x1606('0x2'))(_0x1606('0x3'));var moment=require(_0x1606('0x4'));var BPromise=require(_0x1606('0x5'));var rp=require(_0x1606('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1606('0x7'));var attributes=require(_0x1606('0x8'));module[_0x1606('0x9')]=function(_0x5d291a,_0x1f009d){return _0x5d291a[_0x1606('0xa')]('SmsQueue',attributes,{'tableName':_0x1606('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6259=['./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x6259,0x108));var _0x9625=function(_0x35ba8d,_0x36761f){_0x35ba8d=_0x35ba8d-0x0;var _0x5b20e3=_0x6259[_0x35ba8d];return _0x5b20e3;};'use strict';var _=require(_0x9625('0x0'));var util=require(_0x9625('0x1'));var logger=require(_0x9625('0x2'))(_0x9625('0x3'));var moment=require(_0x9625('0x4'));var BPromise=require(_0x9625('0x5'));var rp=require(_0x9625('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9625('0x7'));var config=require(_0x9625('0x8'));var attributes=require(_0x9625('0x9'));module[_0x9625('0xa')]=function(_0x50e16c,_0x91d67b){return _0x50e16c[_0x9625('0xb')](_0x9625('0xc'),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 8c6c98e..6755f59 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 _0xcaed=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowSmsQueue','find','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4eb44e,_0x223c45){var _0x5084d7=function(_0x409695){while(--_0x409695){_0x4eb44e['push'](_0x4eb44e['shift']());}};_0x5084d7(++_0x223c45);}(_0xcaed,0xf9));var _0xdcae=function(_0x1710bf,_0x16851b){_0x1710bf=_0x1710bf-0x0;var _0x4a07f9=_0xcaed[_0x1710bf];return _0x4a07f9;};'use strict';var _=require(_0xdcae('0x0'));var util=require(_0xdcae('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdcae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdcae('0x3'));var logger=require(_0xdcae('0x4'))(_0xdcae('0x5'));var config=require(_0xdcae('0x6'));var jayson=require(_0xdcae('0x7'));var client=jayson['client'][_0xdcae('0x8')]({'port':0x232a});config[_0xdcae('0x9')]=_[_0xdcae('0xa')](config[_0xdcae('0x9')],{'host':_0xdcae('0xb'),'port':0x18eb});var socket=require(_0xdcae('0xc'))(new Redis(config[_0xdcae('0x9')]));require('./smsQueue.socket')[_0xdcae('0xd')](socket);function respondWithRpcPromise(_0xaa2b64,_0x343557,_0x24cef6){return new BPromise(function(_0x471638,_0x31fca9){return client['request'](_0xaa2b64,_0x24cef6)['then'](function(_0x39dfc6){logger[_0xdcae('0xe')](_0xdcae('0xf'),_0x343557,_0xdcae('0x10'));logger[_0xdcae('0x11')](_0xdcae('0x12'),_0x343557,_0xdcae('0x10'),JSON[_0xdcae('0x13')](_0x39dfc6));if(_0x39dfc6[_0xdcae('0x14')]){if(_0x39dfc6['error']['code']===0x1f4){logger['error'](_0xdcae('0xf'),_0x343557,_0x39dfc6[_0xdcae('0x14')][_0xdcae('0x15')]);return _0x31fca9(_0x39dfc6['error'][_0xdcae('0x15')]);}logger[_0xdcae('0x14')]('SmsQueue,\x20%s,\x20%s',_0x343557,_0x39dfc6[_0xdcae('0x14')]['message']);return _0x471638(_0x39dfc6[_0xdcae('0x14')][_0xdcae('0x15')]);}else{logger[_0xdcae('0xe')](_0xdcae('0xf'),_0x343557,_0xdcae('0x10'));_0x471638(_0x39dfc6[_0xdcae('0x16')][_0xdcae('0x15')]);}})[_0xdcae('0x17')](function(_0x14e70d){logger[_0xdcae('0x14')]('SmsQueue,\x20%s,\x20%s',_0x343557,_0x14e70d);_0x31fca9(_0x14e70d);});});}exports[_0xdcae('0x18')]=function(_0x36a038){var _0x52379e=this;return new Promise(function(_0xa6b664,_0x537dea){return db[_0xdcae('0x19')][_0xdcae('0x1a')]({'raw':_0x36a038['options']?_0x36a038[_0xdcae('0x1b')][_0xdcae('0x1c')]===undefined?!![]:![]:!![],'where':_0x36a038[_0xdcae('0x1b')]?_0x36a038[_0xdcae('0x1b')][_0xdcae('0x1d')]||null:null,'attributes':_0x36a038[_0xdcae('0x1b')]?_0x36a038[_0xdcae('0x1b')][_0xdcae('0x1e')]||null:null,'limit':_0x36a038[_0xdcae('0x1b')]?_0x36a038[_0xdcae('0x1b')][_0xdcae('0x1f')]||null:null,'include':_0x36a038[_0xdcae('0x1b')]?_0x36a038['options'][_0xdcae('0x20')]?_['map'](_0x36a038[_0xdcae('0x1b')][_0xdcae('0x20')],function(_0x2b3128){return{'model':db[_0x2b3128[_0xdcae('0x21')]],'as':_0x2b3128['as'],'attributes':_0x2b3128[_0xdcae('0x1e')],'include':_0x2b3128['include']?_[_0xdcae('0x22')](_0x2b3128[_0xdcae('0x20')],function(_0x210b22){return{'model':db[_0x210b22['model']],'as':_0x210b22['as'],'attributes':_0x210b22['attributes'],'include':_0x210b22[_0xdcae('0x20')]?_[_0xdcae('0x22')](_0x210b22[_0xdcae('0x20')],function(_0x2840c3){return{'model':db[_0x2840c3[_0xdcae('0x21')]],'as':_0x2840c3['as'],'attributes':_0x2840c3[_0xdcae('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdcae('0x23')](function(_0x4ca403){logger[_0xdcae('0xe')]('GetSmsQueue',_0x36a038);logger[_0xdcae('0x11')](_0xdcae('0x18'),_0x36a038,JSON[_0xdcae('0x13')](_0x4ca403));_0xa6b664(_0x4ca403);})[_0xdcae('0x17')](function(_0x3fe29a){logger[_0xdcae('0x14')](_0xdcae('0x18'),_0x3fe29a[_0xdcae('0x15')],_0x36a038);_0x537dea(_0x52379e[_0xdcae('0x14')](0x1f4,_0x3fe29a[_0xdcae('0x15')]));});});};exports[_0xdcae('0x24')]=function(_0x4dca6a){var _0x1d4e02=this;return new Promise(function(_0x5e0f20,_0x54f4cf){return db[_0xdcae('0x19')][_0xdcae('0x25')]({'raw':_0x4dca6a[_0xdcae('0x1b')]?_0x4dca6a[_0xdcae('0x1b')][_0xdcae('0x1c')]===undefined?!![]:![]:!![],'where':_0x4dca6a[_0xdcae('0x1b')]?_0x4dca6a[_0xdcae('0x1b')][_0xdcae('0x1d')]||null:null,'attributes':_0x4dca6a[_0xdcae('0x1b')]?_0x4dca6a['options']['attributes']||null:null,'include':_0x4dca6a[_0xdcae('0x1b')]?_0x4dca6a[_0xdcae('0x1b')][_0xdcae('0x20')]?_[_0xdcae('0x22')](_0x4dca6a[_0xdcae('0x1b')][_0xdcae('0x20')],function(_0x3f2e27){return{'model':db[_0x3f2e27[_0xdcae('0x21')]],'as':_0x3f2e27['as'],'attributes':_0x3f2e27['attributes'],'include':_0x3f2e27['include']?_[_0xdcae('0x22')](_0x3f2e27['include'],function(_0x2fa0be){return{'model':db[_0x2fa0be[_0xdcae('0x21')]],'as':_0x2fa0be['as'],'attributes':_0x2fa0be[_0xdcae('0x1e')],'include':_0x2fa0be[_0xdcae('0x20')]?_['map'](_0x2fa0be[_0xdcae('0x20')],function(_0x5c8c2b){return{'model':db[_0x5c8c2b[_0xdcae('0x21')]],'as':_0x5c8c2b['as'],'attributes':_0x5c8c2b[_0xdcae('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdcae('0x23')](function(_0x3ce53c){logger[_0xdcae('0xe')](_0xdcae('0x24'),_0x4dca6a);logger[_0xdcae('0x11')]('ShowSmsQueue',_0x4dca6a,JSON[_0xdcae('0x13')](_0x3ce53c));_0x5e0f20(_0x3ce53c);})[_0xdcae('0x17')](function(_0x31e1a9){logger[_0xdcae('0x14')]('ShowSmsQueue',_0x31e1a9['message'],_0x4dca6a);_0x54f4cf(_0x1d4e02[_0xdcae('0x14')](0x1f4,_0x31e1a9['message']));});});}; \ No newline at end of file +var _0xf5c2=['defaults','localhost','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','options','raw','where','attributes','include','map','model','GetSmsQueue','ShowSmsQueue','find','debug','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x2f0d4e,_0xa2ddfe){var _0x457d19=function(_0x15e752){while(--_0x15e752){_0x2f0d4e['push'](_0x2f0d4e['shift']());}};_0x457d19(++_0xa2ddfe);}(_0xf5c2,0x1ee));var _0x2f5c=function(_0x26bbd1,_0xb274f3){_0x26bbd1=_0x26bbd1-0x0;var _0x26b1eb=_0xf5c2[_0x26bbd1];return _0x26b1eb;};'use strict';var _=require(_0x2f5c('0x0'));var util=require(_0x2f5c('0x1'));var moment=require(_0x2f5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2f5c('0x3'));var logger=require(_0x2f5c('0x4'))(_0x2f5c('0x5'));var config=require(_0x2f5c('0x6'));var jayson=require(_0x2f5c('0x7'));var client=jayson['client'][_0x2f5c('0x8')]({'port':0x232a});config[_0x2f5c('0x9')]=_[_0x2f5c('0xa')](config['redis'],{'host':_0x2f5c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f5c('0x9')]));require('./smsQueue.socket')[_0x2f5c('0xc')](socket);function respondWithRpcPromise(_0x4b47f0,_0x1f168f,_0x4e301d){return new BPromise(function(_0x4834b3,_0x3bccaf){return client[_0x2f5c('0xd')](_0x4b47f0,_0x4e301d)[_0x2f5c('0xe')](function(_0x47ae14){logger['info'](_0x2f5c('0xf'),_0x1f168f,_0x2f5c('0x10'));logger['debug'](_0x2f5c('0x11'),_0x1f168f,_0x2f5c('0x10'),JSON[_0x2f5c('0x12')](_0x47ae14));if(_0x47ae14['error']){if(_0x47ae14[_0x2f5c('0x13')][_0x2f5c('0x14')]===0x1f4){logger[_0x2f5c('0x13')]('SmsQueue,\x20%s,\x20%s',_0x1f168f,_0x47ae14[_0x2f5c('0x13')]['message']);return _0x3bccaf(_0x47ae14[_0x2f5c('0x13')]['message']);}logger[_0x2f5c('0x13')](_0x2f5c('0xf'),_0x1f168f,_0x47ae14[_0x2f5c('0x13')][_0x2f5c('0x15')]);return _0x4834b3(_0x47ae14[_0x2f5c('0x13')][_0x2f5c('0x15')]);}else{logger[_0x2f5c('0x16')]('SmsQueue,\x20%s,\x20%s',_0x1f168f,_0x2f5c('0x10'));_0x4834b3(_0x47ae14[_0x2f5c('0x17')]['message']);}})[_0x2f5c('0x18')](function(_0x466e43){logger[_0x2f5c('0x13')](_0x2f5c('0xf'),_0x1f168f,_0x466e43);_0x3bccaf(_0x466e43);});});}exports['GetSmsQueue']=function(_0x69ba8b){var _0x343461=this;return new Promise(function(_0x308245,_0x45c3e1){return db['SmsQueue']['findAll']({'raw':_0x69ba8b['options']?_0x69ba8b[_0x2f5c('0x19')][_0x2f5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x69ba8b['options']?_0x69ba8b[_0x2f5c('0x19')][_0x2f5c('0x1b')]||null:null,'attributes':_0x69ba8b['options']?_0x69ba8b[_0x2f5c('0x19')][_0x2f5c('0x1c')]||null:null,'limit':_0x69ba8b[_0x2f5c('0x19')]?_0x69ba8b[_0x2f5c('0x19')]['limit']||null:null,'include':_0x69ba8b['options']?_0x69ba8b[_0x2f5c('0x19')][_0x2f5c('0x1d')]?_[_0x2f5c('0x1e')](_0x69ba8b[_0x2f5c('0x19')]['include'],function(_0x5e0091){return{'model':db[_0x5e0091[_0x2f5c('0x1f')]],'as':_0x5e0091['as'],'attributes':_0x5e0091[_0x2f5c('0x1c')],'include':_0x5e0091[_0x2f5c('0x1d')]?_['map'](_0x5e0091[_0x2f5c('0x1d')],function(_0x3ce5ee){return{'model':db[_0x3ce5ee[_0x2f5c('0x1f')]],'as':_0x3ce5ee['as'],'attributes':_0x3ce5ee[_0x2f5c('0x1c')],'include':_0x3ce5ee[_0x2f5c('0x1d')]?_[_0x2f5c('0x1e')](_0x3ce5ee[_0x2f5c('0x1d')],function(_0x438200){return{'model':db[_0x438200[_0x2f5c('0x1f')]],'as':_0x438200['as'],'attributes':_0x438200[_0x2f5c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8d2e4e){logger['info'](_0x2f5c('0x20'),_0x69ba8b);logger['debug'](_0x2f5c('0x20'),_0x69ba8b,JSON['stringify'](_0x8d2e4e));_0x308245(_0x8d2e4e);})[_0x2f5c('0x18')](function(_0x3815cd){logger[_0x2f5c('0x13')](_0x2f5c('0x20'),_0x3815cd[_0x2f5c('0x15')],_0x69ba8b);_0x45c3e1(_0x343461['error'](0x1f4,_0x3815cd[_0x2f5c('0x15')]));});});};exports[_0x2f5c('0x21')]=function(_0x351bec){var _0x56ac97=this;return new Promise(function(_0x126e7c,_0x53c3e7){return db['SmsQueue'][_0x2f5c('0x22')]({'raw':_0x351bec[_0x2f5c('0x19')]?_0x351bec[_0x2f5c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x351bec[_0x2f5c('0x19')]?_0x351bec[_0x2f5c('0x19')][_0x2f5c('0x1b')]||null:null,'attributes':_0x351bec['options']?_0x351bec[_0x2f5c('0x19')][_0x2f5c('0x1c')]||null:null,'include':_0x351bec['options']?_0x351bec['options'][_0x2f5c('0x1d')]?_[_0x2f5c('0x1e')](_0x351bec[_0x2f5c('0x19')][_0x2f5c('0x1d')],function(_0x5c7cdf){return{'model':db[_0x5c7cdf['model']],'as':_0x5c7cdf['as'],'attributes':_0x5c7cdf[_0x2f5c('0x1c')],'include':_0x5c7cdf[_0x2f5c('0x1d')]?_['map'](_0x5c7cdf['include'],function(_0x28e44a){return{'model':db[_0x28e44a[_0x2f5c('0x1f')]],'as':_0x28e44a['as'],'attributes':_0x28e44a['attributes'],'include':_0x28e44a[_0x2f5c('0x1d')]?_[_0x2f5c('0x1e')](_0x28e44a['include'],function(_0x377fec){return{'model':db[_0x377fec['model']],'as':_0x377fec['as'],'attributes':_0x377fec['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cb62){logger[_0x2f5c('0x16')](_0x2f5c('0x21'),_0x351bec);logger[_0x2f5c('0x23')](_0x2f5c('0x21'),_0x351bec,JSON[_0x2f5c('0x12')](_0x5cb62));_0x126e7c(_0x5cb62);})['catch'](function(_0x17ae66){logger[_0x2f5c('0x13')](_0x2f5c('0x21'),_0x17ae66[_0x2f5c('0x15')],_0x351bec);_0x53c3e7(_0x56ac97[_0x2f5c('0x13')](0x1f4,_0x17ae66[_0x2f5c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index c53dcd0..5ebb7e9 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 _0x903d=['removeListener','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x4724fe,_0x58fc83){var _0x9a955a=function(_0x1d19fb){while(--_0x1d19fb){_0x4724fe['push'](_0x4724fe['shift']());}};_0x9a955a(++_0x58fc83);}(_0x903d,0x1ab));var _0xd903=function(_0x4594bf,_0x3fa293){_0x4594bf=_0x4594bf-0x0;var _0x316738=_0x903d[_0x4594bf];return _0x316738;};'use strict';var SmsQueueEvents=require(_0xd903('0x0'));var events=[_0xd903('0x1'),_0xd903('0x2'),_0xd903('0x3')];function createListener(_0x19e391,_0x18fc34){return function(_0x5d9e36){_0x18fc34[_0xd903('0x4')](_0x19e391,_0x5d9e36);};}function removeListener(_0x211913,_0x11e756){return function(){SmsQueueEvents[_0xd903('0x5')](_0x211913,_0x11e756);};}exports['register']=function(_0x56fd69){for(var _0x25c2fe=0x0,_0x4c6cf8=events[_0xd903('0x6')];_0x25c2fe<_0x4c6cf8;_0x25c2fe++){var _0x1b0745=events[_0x25c2fe];var _0x487ba7=createListener(_0xd903('0x7')+_0x1b0745,_0x56fd69);SmsQueueEvents['on'](_0x1b0745,_0x487ba7);}}; \ No newline at end of file +var _0x2977=['removeListener','register','./smsQueue.events','save','remove','update','emit'];(function(_0x2ea74f,_0x358a70){var _0x448bdc=function(_0x4db43c){while(--_0x4db43c){_0x2ea74f['push'](_0x2ea74f['shift']());}};_0x448bdc(++_0x358a70);}(_0x2977,0x16e));var _0x7297=function(_0x3d7571,_0x18794c){_0x3d7571=_0x3d7571-0x0;var _0x907eb0=_0x2977[_0x3d7571];return _0x907eb0;};'use strict';var SmsQueueEvents=require(_0x7297('0x0'));var events=[_0x7297('0x1'),_0x7297('0x2'),_0x7297('0x3')];function createListener(_0x3b331f,_0x498041){return function(_0x44a71b){_0x498041[_0x7297('0x4')](_0x3b331f,_0x44a71b);};}function removeListener(_0x46b86a,_0x31c886){return function(){SmsQueueEvents[_0x7297('0x5')](_0x46b86a,_0x31c886);};}exports[_0x7297('0x6')]=function(_0x1e54be){for(var _0x220d11=0x0,_0x150d2c=events['length'];_0x220d11<_0x150d2c;_0x220d11++){var _0x30e032=events[_0x220d11];var _0x20e033=createListener('smsQueue:'+_0x30e032,_0x1e54be);SmsQueueEvents['on'](_0x30e032,_0x20e033);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 817d76a..3981e5c 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 _0xf494=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x519768,_0x551182){var _0x231f33=function(_0x11751a){while(--_0x11751a){_0x519768['push'](_0x519768['shift']());}};_0x231f33(++_0x551182);}(_0xf494,0x1c6));var _0x4f49=function(_0xc43928,_0x3890ac){_0xc43928=_0xc43928-0x0;var _0x529606=_0xf494[_0xc43928];return _0x529606;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x13')]);module[_0x4f49('0x14')]=router; \ No newline at end of file +var _0x96ea=['show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x16083b,_0x21dfb4){var _0x582fc2=function(_0x5854d4){while(--_0x5854d4){_0x16083b['push'](_0x16083b['shift']());}};_0x582fc2(++_0x21dfb4);}(_0x96ea,0xc3));var _0xa96e=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x96ea[_0x2d91c6];return _0x3a8d19;};'use strict';var multer=require(_0xa96e('0x0'));var util=require(_0xa96e('0x1'));var path=require(_0xa96e('0x2'));var timeout=require(_0xa96e('0x3'));var express=require(_0xa96e('0x4'));var router=express[_0xa96e('0x5')]();var fs_extra=require(_0xa96e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa96e('0x7'));var config=require('../../config/environment');var controller=require(_0xa96e('0x8'));router[_0xa96e('0x9')]('/',auth[_0xa96e('0xa')](),controller[_0xa96e('0xb')]);router['get'](_0xa96e('0xc'),auth[_0xa96e('0xa')](),controller[_0xa96e('0xd')]);router[_0xa96e('0x9')](_0xa96e('0xe'),auth[_0xa96e('0xa')](),controller[_0xa96e('0xf')]);router[_0xa96e('0x10')]('/',auth[_0xa96e('0xa')](),controller['create']);router[_0xa96e('0x11')](_0xa96e('0xe'),auth[_0xa96e('0xa')](),controller['update']);router[_0xa96e('0x12')](_0xa96e('0xe'),auth[_0xa96e('0xa')](),controller[_0xa96e('0x13')]);module[_0xa96e('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 8b3b28e..4106d9e 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 _0xcea5=['STRING','DATE','moment','sequelize','exports'];(function(_0x21dab1,_0x5476a9){var _0x33c719=function(_0x4e448a){while(--_0x4e448a){_0x21dab1['push'](_0x21dab1['shift']());}};_0x33c719(++_0x5476a9);}(_0xcea5,0xed));var _0x5cea=function(_0x5ec7e5,_0x3714eb){_0x5ec7e5=_0x5ec7e5-0x0;var _0x73db85=_0xcea5[_0x5ec7e5];return _0x73db85;};'use strict';var moment=require(_0x5cea('0x0'));var Sequelize=require(_0x5cea('0x1'));module[_0x5cea('0x2')]={'uniqueid':{'type':Sequelize[_0x5cea('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5cea('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5cea('0x4')]},'acceptAt':{'type':Sequelize[_0x5cea('0x4')]},'exitAt':{'type':Sequelize[_0x5cea('0x4')]},'reason':{'type':Sequelize[_0x5cea('0x3')]}}; \ No newline at end of file +var _0x681b=['STRING','DATE','moment'];(function(_0x40e86c,_0x4ad68d){var _0x34d95e=function(_0x1168d8){while(--_0x1168d8){_0x40e86c['push'](_0x40e86c['shift']());}};_0x34d95e(++_0x4ad68d);}(_0x681b,0x143));var _0xb681=function(_0x4591be,_0x2835bf){_0x4591be=_0x4591be-0x0;var _0x3309bf=_0x681b[_0x4591be];return _0x3309bf;};'use strict';var moment=require(_0xb681('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb681('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb681('0x1')]},'joinAt':{'type':Sequelize[_0xb681('0x2')]},'leaveAt':{'type':Sequelize[_0xb681('0x2')]},'acceptAt':{'type':Sequelize[_0xb681('0x2')]},'exitAt':{'type':Sequelize[_0xb681('0x2')]},'reason':{'type':Sequelize[_0xb681('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1798a31..552d36c 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 _0xef5d=['catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsQueueReport','includeAll','include','rows'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0xef5d,0x9a));var _0xdef5=function(_0x4c2a48,_0x28163a){_0x4c2a48=_0x4c2a48-0x0;var _0x705005=_0xef5d[_0x4c2a48];return _0x705005;};'use strict';var emlformat=require(_0xdef5('0x0'));var rimraf=require(_0xdef5('0x1'));var zipdir=require(_0xdef5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdef5('0x3'));var BPromise=require(_0xdef5('0x4'));var Mustache=require('mustache');var util=require(_0xdef5('0x5'));var path=require(_0xdef5('0x6'));var sox=require(_0xdef5('0x7'));var csv=require(_0xdef5('0x8'));var ejs=require(_0xdef5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdef5('0xa'));var squel=require('squel');var crypto=require(_0xdef5('0xb'));var jsforce=require(_0xdef5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdef5('0x8'));var querystring=require(_0xdef5('0xd'));var Papa=require(_0xdef5('0xe'));var Redis=require(_0xdef5('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdef5('0x10'));var hardwareService=require(_0xdef5('0x11'));var logger=require(_0xdef5('0x12'))(_0xdef5('0x13'));var utils=require('../../config/utils');var config=require(_0xdef5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdef5('0x15'))['db'];function respondWithStatusCode(_0x4f5170,_0x457300){_0x457300=_0x457300||0xcc;return function(_0x1a55c9){if(_0x1a55c9){return _0x4f5170[_0xdef5('0x16')](_0x457300);}return _0x4f5170[_0xdef5('0x17')](_0x457300)[_0xdef5('0x18')]();};}function respondWithResult(_0x2b3755,_0x352151){_0x352151=_0x352151||0xc8;return function(_0x17c3d5){if(_0x17c3d5){return _0x2b3755[_0xdef5('0x17')](_0x352151)[_0xdef5('0x19')](_0x17c3d5);}};}function respondWithFilteredResult(_0x16b1c8,_0x109b70){return function(_0x4ad700){if(_0x4ad700){var _0x20dac3=typeof _0x109b70[_0xdef5('0x1a')]===_0xdef5('0x1b')&&typeof _0x109b70['limit']===_0xdef5('0x1b');var _0x249717=_0x4ad700['count'];var _0x38fbab=_0x20dac3?0x0:_0x109b70[_0xdef5('0x1a')];var _0x658d8e=_0x20dac3?_0x4ad700[_0xdef5('0x1c')]:_0x109b70[_0xdef5('0x1a')]+_0x109b70['limit'];var _0x14f466;if(_0x658d8e>=_0x249717){_0x658d8e=_0x249717;_0x14f466=0xc8;}else{_0x14f466=0xce;}_0x16b1c8[_0xdef5('0x17')](_0x14f466);return _0x16b1c8[_0xdef5('0x1d')](_0xdef5('0x1e'),_0x38fbab+'-'+_0x658d8e+'/'+_0x249717)[_0xdef5('0x19')](_0x4ad700);}return null;};}function patchUpdates(_0x9a1c28){return function(_0x15711a){try{jsonpatch['apply'](_0x15711a,_0x9a1c28,!![]);}catch(_0x5e7e4b){return BPromise[_0xdef5('0x1f')](_0x5e7e4b);}return _0x15711a[_0xdef5('0x20')]();};}function saveUpdates(_0x44d65f,_0x9caf1){return function(_0x32c621){if(_0x32c621){return _0x32c621['update'](_0x44d65f)[_0xdef5('0x21')](function(_0x40b9bd){return _0x40b9bd;});}return null;};}function removeEntity(_0x385e95,_0x2021d5){return function(_0x37b5f5){if(_0x37b5f5){return _0x37b5f5['destroy']()[_0xdef5('0x21')](function(){_0x385e95[_0xdef5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2945a9,_0x14308d){return function(_0x407cfa){if(!_0x407cfa){_0x2945a9['sendStatus'](0x194);}return _0x407cfa;};}function handleError(_0x5ef723,_0x5f07b0){_0x5f07b0=_0x5f07b0||0x1f4;return function(_0x257b32){logger[_0xdef5('0x22')](_0x257b32[_0xdef5('0x23')]);if(_0x257b32[_0xdef5('0x24')]){delete _0x257b32[_0xdef5('0x24')];}_0x5ef723[_0xdef5('0x17')](_0x5f07b0)[_0xdef5('0x25')](_0x257b32);};}exports[_0xdef5('0x26')]=function(_0x6aa60,_0x15f879){var _0x38d996={},_0x3dd110={},_0x16de66={'count':0x0,'rows':[]};var _0x1e5650=_['map'](db['SmsQueueReport'][_0xdef5('0x27')],function(_0x26dfd0){return{'name':_0x26dfd0['fieldName'],'type':_0x26dfd0[_0xdef5('0x28')][_0xdef5('0x29')]};});_0x3dd110[_0xdef5('0x2a')]=_[_0xdef5('0x2b')](_0x1e5650,_0xdef5('0x24'));_0x3dd110[_0xdef5('0x2c')]=_[_0xdef5('0x2d')](_0x6aa60['query']);_0x3dd110['filters']=_[_0xdef5('0x2e')](_0x3dd110[_0xdef5('0x2a')],_0x3dd110[_0xdef5('0x2c')]);_0x38d996[_0xdef5('0x2f')]=_[_0xdef5('0x2e')](_0x3dd110['model'],qs[_0xdef5('0x30')](_0x6aa60[_0xdef5('0x2c')][_0xdef5('0x30')]));_0x38d996[_0xdef5('0x2f')]=_0x38d996[_0xdef5('0x2f')][_0xdef5('0x31')]?_0x38d996[_0xdef5('0x2f')]:_0x3dd110[_0xdef5('0x2a')];if(!_0x6aa60[_0xdef5('0x2c')][_0xdef5('0x32')](_0xdef5('0x33'))){_0x38d996[_0xdef5('0x34')]=qs[_0xdef5('0x34')](_0x6aa60['query'][_0xdef5('0x34')]);_0x38d996[_0xdef5('0x1a')]=qs[_0xdef5('0x1a')](_0x6aa60[_0xdef5('0x2c')][_0xdef5('0x1a')]);}_0x38d996['order']=qs[_0xdef5('0x35')](_0x6aa60[_0xdef5('0x2c')][_0xdef5('0x35')]);_0x38d996[_0xdef5('0x36')]=qs[_0xdef5('0x37')](_[_0xdef5('0x38')](_0x6aa60[_0xdef5('0x2c')],_0x3dd110['filters']),_0x1e5650);if(_0x6aa60[_0xdef5('0x2c')][_0xdef5('0x39')]){_0x38d996['where']=_[_0xdef5('0x3a')](_0x38d996[_0xdef5('0x36')],{'$or':_[_0xdef5('0x2b')](_0x1e5650,function(_0x540c17){if(_0x540c17[_0xdef5('0x28')]!==_0xdef5('0x3b')){var _0x1c823f={};_0x1c823f[_0x540c17[_0xdef5('0x24')]]={'$like':'%'+_0x6aa60[_0xdef5('0x2c')][_0xdef5('0x39')]+'%'};return _0x1c823f;}})});}_0x38d996=_[_0xdef5('0x3a')]({},_0x38d996,_0x6aa60[_0xdef5('0x3c')]);var _0x5ab6eb={'where':_0x38d996[_0xdef5('0x36')]};return db[_0xdef5('0x3d')][_0xdef5('0x1c')](_0x5ab6eb)['then'](function(_0x3cce12){_0x16de66[_0xdef5('0x1c')]=_0x3cce12;if(_0x6aa60[_0xdef5('0x2c')][_0xdef5('0x3e')]){_0x38d996[_0xdef5('0x3f')]=[{'all':!![]}];}return db[_0xdef5('0x3d')]['findAll'](_0x38d996);})[_0xdef5('0x21')](function(_0x29c135){_0x16de66[_0xdef5('0x40')]=_0x29c135;return _0x16de66;})[_0xdef5('0x21')](respondWithFilteredResult(_0x15f879,_0x38d996))[_0xdef5('0x41')](handleError(_0x15f879,null));};exports[_0xdef5('0x42')]=function(_0x4a8616,_0x3c1e6f){var _0x565e18={'raw':!![],'where':{'id':_0x4a8616[_0xdef5('0x43')]['id']}},_0x5d17af={};_0x5d17af[_0xdef5('0x2a')]=_[_0xdef5('0x2d')](db[_0xdef5('0x3d')]['rawAttributes']);_0x5d17af[_0xdef5('0x2c')]=_[_0xdef5('0x2d')](_0x4a8616[_0xdef5('0x2c')]);_0x5d17af[_0xdef5('0x37')]=_[_0xdef5('0x2e')](_0x5d17af[_0xdef5('0x2a')],_0x5d17af[_0xdef5('0x2c')]);_0x565e18[_0xdef5('0x2f')]=_[_0xdef5('0x2e')](_0x5d17af[_0xdef5('0x2a')],qs[_0xdef5('0x30')](_0x4a8616[_0xdef5('0x2c')][_0xdef5('0x30')]));_0x565e18['attributes']=_0x565e18['attributes'][_0xdef5('0x31')]?_0x565e18[_0xdef5('0x2f')]:_0x5d17af[_0xdef5('0x2a')];if(_0x4a8616[_0xdef5('0x2c')][_0xdef5('0x3e')]){_0x565e18[_0xdef5('0x3f')]=[{'all':!![]}];}_0x565e18=_['merge']({},_0x565e18,_0x4a8616[_0xdef5('0x3c')]);return db[_0xdef5('0x3d')][_0xdef5('0x44')](_0x565e18)[_0xdef5('0x21')](handleEntityNotFound(_0x3c1e6f,null))[_0xdef5('0x21')](respondWithResult(_0x3c1e6f,null))[_0xdef5('0x41')](handleError(_0x3c1e6f,null));};exports['create']=function(_0x201d90,_0x229b7e){return db[_0xdef5('0x3d')][_0xdef5('0x45')](_0x201d90[_0xdef5('0x46')],{})[_0xdef5('0x21')](respondWithResult(_0x229b7e,0xc9))[_0xdef5('0x41')](handleError(_0x229b7e,null));};exports['update']=function(_0x5f5abc,_0x3d3941){if(_0x5f5abc[_0xdef5('0x46')]['id']){delete _0x5f5abc[_0xdef5('0x46')]['id'];}return db[_0xdef5('0x3d')][_0xdef5('0x44')]({'where':{'id':_0x5f5abc['params']['id']}})[_0xdef5('0x21')](handleEntityNotFound(_0x3d3941,null))[_0xdef5('0x21')](saveUpdates(_0x5f5abc['body'],null))[_0xdef5('0x21')](respondWithResult(_0x3d3941,null))[_0xdef5('0x41')](handleError(_0x3d3941,null));};exports[_0xdef5('0x47')]=function(_0x2db2e5,_0x56e7af){return db[_0xdef5('0x3d')][_0xdef5('0x44')]({'where':{'id':_0x2db2e5[_0xdef5('0x43')]['id']}})[_0xdef5('0x21')](handleEntityNotFound(_0x56e7af,null))['then'](removeEntity(_0x56e7af,null))[_0xdef5('0x41')](handleError(_0x56e7af,null));};exports[_0xdef5('0x48')]=function(_0x34b44a,_0x5efc20){return db[_0xdef5('0x3d')][_0xdef5('0x48')]()['then'](respondWithResult(_0x5efc20,null))[_0xdef5('0x41')](handleError(_0x5efc20,null));}; \ No newline at end of file +var _0x0739=['util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x16043a,_0x4285ed){var _0x318fb8=function(_0x3bf20e){while(--_0x3bf20e){_0x16043a['push'](_0x16043a['shift']());}};_0x318fb8(++_0x4285ed);}(_0x0739,0x1b5));var _0x9073=function(_0x1410e6,_0x402aa8){_0x1410e6=_0x1410e6-0x0;var _0x2d47d0=_0x0739[_0x1410e6];return _0x2d47d0;};'use strict';var emlformat=require(_0x9073('0x0'));var rimraf=require(_0x9073('0x1'));var zipdir=require(_0x9073('0x2'));var jsonpatch=require(_0x9073('0x3'));var rp=require('request-promise');var moment=require(_0x9073('0x4'));var BPromise=require(_0x9073('0x5'));var Mustache=require(_0x9073('0x6'));var util=require(_0x9073('0x7'));var path=require(_0x9073('0x8'));var sox=require(_0x9073('0x9'));var csv=require(_0x9073('0xa'));var ejs=require(_0x9073('0xb'));var fs=require('fs');var fs_extra=require(_0x9073('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9073('0xd'));var jsforce=require(_0x9073('0xe'));var deskjs=require(_0x9073('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9073('0x10'));var Redis=require(_0x9073('0x11'));var authService=require(_0x9073('0x12'));var qs=require(_0x9073('0x13'));var as=require(_0x9073('0x14'));var hardwareService=require(_0x9073('0x15'));var logger=require(_0x9073('0x16'))(_0x9073('0x17'));var utils=require(_0x9073('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9073('0x19'));var db=require(_0x9073('0x1a'))['db'];function respondWithStatusCode(_0x4d7ab1,_0xe842d4){_0xe842d4=_0xe842d4||0xcc;return function(_0xadcb71){if(_0xadcb71){return _0x4d7ab1['sendStatus'](_0xe842d4);}return _0x4d7ab1[_0x9073('0x1b')](_0xe842d4)[_0x9073('0x1c')]();};}function respondWithResult(_0x19b7e7,_0x27388c){_0x27388c=_0x27388c||0xc8;return function(_0x344b53){if(_0x344b53){return _0x19b7e7[_0x9073('0x1b')](_0x27388c)[_0x9073('0x1d')](_0x344b53);}};}function respondWithFilteredResult(_0x190eb5,_0x7f9574){return function(_0x28a3ab){if(_0x28a3ab){var _0x3a5768=typeof _0x7f9574[_0x9073('0x1e')]===_0x9073('0x1f')&&typeof _0x7f9574[_0x9073('0x20')]==='undefined';var _0x454108=_0x28a3ab[_0x9073('0x21')];var _0x3ee7dc=_0x3a5768?0x0:_0x7f9574[_0x9073('0x1e')];var _0x5cce01=_0x3a5768?_0x28a3ab[_0x9073('0x21')]:_0x7f9574['offset']+_0x7f9574['limit'];var _0x5efbdf;if(_0x5cce01>=_0x454108){_0x5cce01=_0x454108;_0x5efbdf=0xc8;}else{_0x5efbdf=0xce;}_0x190eb5[_0x9073('0x1b')](_0x5efbdf);return _0x190eb5[_0x9073('0x22')](_0x9073('0x23'),_0x3ee7dc+'-'+_0x5cce01+'/'+_0x454108)[_0x9073('0x1d')](_0x28a3ab);}return null;};}function patchUpdates(_0x5a6874){return function(_0x2684cd){try{jsonpatch[_0x9073('0x24')](_0x2684cd,_0x5a6874,!![]);}catch(_0x518a66){return BPromise[_0x9073('0x25')](_0x518a66);}return _0x2684cd[_0x9073('0x26')]();};}function saveUpdates(_0x129dfc,_0x103c58){return function(_0x3a13a4){if(_0x3a13a4){return _0x3a13a4[_0x9073('0x27')](_0x129dfc)[_0x9073('0x28')](function(_0x384d0f){return _0x384d0f;});}return null;};}function removeEntity(_0x1252df,_0x545074){return function(_0xe77e79){if(_0xe77e79){return _0xe77e79[_0x9073('0x29')]()[_0x9073('0x28')](function(){_0x1252df['status'](0xcc)[_0x9073('0x1c')]();});}};}function handleEntityNotFound(_0x2dd37f,_0x4c5818){return function(_0x3beb25){if(!_0x3beb25){_0x2dd37f['sendStatus'](0x194);}return _0x3beb25;};}function handleError(_0x35cf80,_0x3c6449){_0x3c6449=_0x3c6449||0x1f4;return function(_0xae9195){logger['error'](_0xae9195['stack']);if(_0xae9195['name']){delete _0xae9195[_0x9073('0x2a')];}_0x35cf80[_0x9073('0x1b')](_0x3c6449)['send'](_0xae9195);};}exports['index']=function(_0x1f1f28,_0x55d142){var _0xc54fcd={},_0x421ea5={},_0x38c0bb={'count':0x0,'rows':[]};var _0x5bbdf4=_[_0x9073('0x2b')](db[_0x9073('0x2c')][_0x9073('0x2d')],function(_0x19dfd9){return{'name':_0x19dfd9[_0x9073('0x2e')],'type':_0x19dfd9[_0x9073('0x2f')][_0x9073('0x30')]};});_0x421ea5['model']=_[_0x9073('0x2b')](_0x5bbdf4,_0x9073('0x2a'));_0x421ea5[_0x9073('0x31')]=_[_0x9073('0x32')](_0x1f1f28[_0x9073('0x31')]);_0x421ea5[_0x9073('0x33')]=_[_0x9073('0x34')](_0x421ea5[_0x9073('0x35')],_0x421ea5[_0x9073('0x31')]);_0xc54fcd['attributes']=_[_0x9073('0x34')](_0x421ea5[_0x9073('0x35')],qs[_0x9073('0x36')](_0x1f1f28[_0x9073('0x31')]['fields']));_0xc54fcd['attributes']=_0xc54fcd[_0x9073('0x37')]['length']?_0xc54fcd[_0x9073('0x37')]:_0x421ea5[_0x9073('0x35')];if(!_0x1f1f28[_0x9073('0x31')][_0x9073('0x38')](_0x9073('0x39'))){_0xc54fcd['limit']=qs['limit'](_0x1f1f28[_0x9073('0x31')][_0x9073('0x20')]);_0xc54fcd[_0x9073('0x1e')]=qs[_0x9073('0x1e')](_0x1f1f28[_0x9073('0x31')][_0x9073('0x1e')]);}_0xc54fcd[_0x9073('0x3a')]=qs['sort'](_0x1f1f28[_0x9073('0x31')]['sort']);_0xc54fcd[_0x9073('0x3b')]=qs[_0x9073('0x33')](_[_0x9073('0x3c')](_0x1f1f28['query'],_0x421ea5[_0x9073('0x33')]),_0x5bbdf4);if(_0x1f1f28[_0x9073('0x31')][_0x9073('0x3d')]){_0xc54fcd['where']=_['merge'](_0xc54fcd[_0x9073('0x3b')],{'$or':_[_0x9073('0x2b')](_0x5bbdf4,function(_0x15539b){if(_0x15539b[_0x9073('0x2f')]!=='VIRTUAL'){var _0x1ca413={};_0x1ca413[_0x15539b[_0x9073('0x2a')]]={'$like':'%'+_0x1f1f28[_0x9073('0x31')][_0x9073('0x3d')]+'%'};return _0x1ca413;}})});}_0xc54fcd=_['merge']({},_0xc54fcd,_0x1f1f28[_0x9073('0x3e')]);var _0x27215c={'where':_0xc54fcd['where']};return db['SmsQueueReport'][_0x9073('0x21')](_0x27215c)[_0x9073('0x28')](function(_0x49e67a){_0x38c0bb[_0x9073('0x21')]=_0x49e67a;if(_0x1f1f28[_0x9073('0x31')][_0x9073('0x3f')]){_0xc54fcd[_0x9073('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x9073('0x41')](_0xc54fcd);})[_0x9073('0x28')](function(_0x287075){_0x38c0bb[_0x9073('0x42')]=_0x287075;return _0x38c0bb;})[_0x9073('0x28')](respondWithFilteredResult(_0x55d142,_0xc54fcd))[_0x9073('0x43')](handleError(_0x55d142,null));};exports[_0x9073('0x44')]=function(_0x3cba3b,_0x3aed5f){var _0x155406={'raw':!![],'where':{'id':_0x3cba3b[_0x9073('0x45')]['id']}},_0x2346bb={};_0x2346bb['model']=_[_0x9073('0x32')](db[_0x9073('0x2c')][_0x9073('0x2d')]);_0x2346bb[_0x9073('0x31')]=_[_0x9073('0x32')](_0x3cba3b[_0x9073('0x31')]);_0x2346bb[_0x9073('0x33')]=_['intersection'](_0x2346bb[_0x9073('0x35')],_0x2346bb['query']);_0x155406['attributes']=_[_0x9073('0x34')](_0x2346bb[_0x9073('0x35')],qs[_0x9073('0x36')](_0x3cba3b[_0x9073('0x31')]['fields']));_0x155406['attributes']=_0x155406[_0x9073('0x37')]['length']?_0x155406[_0x9073('0x37')]:_0x2346bb[_0x9073('0x35')];if(_0x3cba3b[_0x9073('0x31')][_0x9073('0x3f')]){_0x155406[_0x9073('0x40')]=[{'all':!![]}];}_0x155406=_['merge']({},_0x155406,_0x3cba3b[_0x9073('0x3e')]);return db[_0x9073('0x2c')]['find'](_0x155406)[_0x9073('0x28')](handleEntityNotFound(_0x3aed5f,null))[_0x9073('0x28')](respondWithResult(_0x3aed5f,null))[_0x9073('0x43')](handleError(_0x3aed5f,null));};exports[_0x9073('0x46')]=function(_0x2d23e5,_0x27e198){return db[_0x9073('0x2c')][_0x9073('0x46')](_0x2d23e5[_0x9073('0x47')],{})[_0x9073('0x28')](respondWithResult(_0x27e198,0xc9))['catch'](handleError(_0x27e198,null));};exports[_0x9073('0x27')]=function(_0x289dbf,_0x2d88f5){if(_0x289dbf['body']['id']){delete _0x289dbf[_0x9073('0x47')]['id'];}return db[_0x9073('0x2c')][_0x9073('0x48')]({'where':{'id':_0x289dbf[_0x9073('0x45')]['id']}})[_0x9073('0x28')](handleEntityNotFound(_0x2d88f5,null))['then'](saveUpdates(_0x289dbf['body'],null))[_0x9073('0x28')](respondWithResult(_0x2d88f5,null))[_0x9073('0x43')](handleError(_0x2d88f5,null));};exports[_0x9073('0x29')]=function(_0x372121,_0x94bbef){return db[_0x9073('0x2c')]['find']({'where':{'id':_0x372121['params']['id']}})[_0x9073('0x28')](handleEntityNotFound(_0x94bbef,null))[_0x9073('0x28')](removeEntity(_0x94bbef,null))[_0x9073('0x43')](handleError(_0x94bbef,null));};exports[_0x9073('0x49')]=function(_0x44e518,_0x4dfe69){return db[_0x9073('0x2c')][_0x9073('0x49')]()[_0x9073('0x28')](respondWithResult(_0x4dfe69,null))[_0x9073('0x43')](handleError(_0x4dfe69,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 8906ac1..c9ccd6a 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x2fa363,_0x4f009b){var _0x5afe87=function(_0x323e61){while(--_0x323e61){_0x2fa363['push'](_0x2fa363['shift']());}};_0x5afe87(++_0x4f009b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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 b88e64e..b7ec0f8 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 _0x6caf=['create','body','options','raw','then','debug','UpdateSmsQueueReport','update','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0x42d9db,_0x48a1ed){var _0x556ba5=function(_0x223b07){while(--_0x223b07){_0x42d9db['push'](_0x42d9db['shift']());}};_0x556ba5(++_0x48a1ed);}(_0x6caf,0xf3));var _0xf6ca=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x6caf[_0x2085f3];return _0x384e3c;};'use strict';var _=require(_0xf6ca('0x0'));var util=require(_0xf6ca('0x1'));var moment=require(_0xf6ca('0x2'));var BPromise=require(_0xf6ca('0x3'));var rs=require(_0xf6ca('0x4'));var fs=require('fs');var Redis=require(_0xf6ca('0x5'));var db=require(_0xf6ca('0x6'))['db'];var utils=require(_0xf6ca('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf6ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf6ca('0x9')][_0xf6ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21adb4,_0x21dca5,_0x44cbc3){return new BPromise(function(_0x47a127,_0x30412f){return client['request'](_0x21adb4,_0x44cbc3)['then'](function(_0x278967){logger[_0xf6ca('0xb')](_0xf6ca('0xc'),_0x21dca5,_0xf6ca('0xd'));logger['debug'](_0xf6ca('0xe'),_0x21dca5,_0xf6ca('0xd'),JSON['stringify'](_0x278967));if(_0x278967['error']){if(_0x278967['error'][_0xf6ca('0xf')]===0x1f4){logger['error'](_0xf6ca('0xc'),_0x21dca5,_0x278967[_0xf6ca('0x10')][_0xf6ca('0x11')]);return _0x30412f(_0x278967['error'][_0xf6ca('0x11')]);}logger['error'](_0xf6ca('0xc'),_0x21dca5,_0x278967[_0xf6ca('0x10')][_0xf6ca('0x11')]);return _0x47a127(_0x278967['error'][_0xf6ca('0x11')]);}else{logger[_0xf6ca('0xb')](_0xf6ca('0xc'),_0x21dca5,_0xf6ca('0xd'));_0x47a127(_0x278967['result'][_0xf6ca('0x11')]);}})[_0xf6ca('0x12')](function(_0x274ccf){logger[_0xf6ca('0x10')](_0xf6ca('0xc'),_0x21dca5,_0x274ccf);_0x30412f(_0x274ccf);});});}exports[_0xf6ca('0x13')]=function(_0x363c84){var _0x2d80a8=this;return new Promise(function(_0x20b218,_0x316c3d){return db[_0xf6ca('0x14')][_0xf6ca('0x15')](_0x363c84[_0xf6ca('0x16')],{'raw':_0x363c84[_0xf6ca('0x17')]?_0x363c84[_0xf6ca('0x17')][_0xf6ca('0x18')]===undefined?!![]:![]:!![]})[_0xf6ca('0x19')](function(_0x4e4b03){logger[_0xf6ca('0xb')](_0xf6ca('0x13'),_0x363c84);logger[_0xf6ca('0x1a')](_0xf6ca('0x13'),_0x363c84,JSON['stringify'](_0x4e4b03));_0x20b218(_0x4e4b03);})[_0xf6ca('0x12')](function(_0x1040e0){logger[_0xf6ca('0x10')]('CreateSmsQueueReport',_0x1040e0['message'],_0x363c84);_0x316c3d(_0x2d80a8['error'](0x1f4,_0x1040e0[_0xf6ca('0x11')]));});});};exports[_0xf6ca('0x1b')]=function(_0x4a37a8){var _0x330f6a=this;return new Promise(function(_0x5c56c5,_0x5d91a0){return db[_0xf6ca('0x14')][_0xf6ca('0x1c')](_0x4a37a8[_0xf6ca('0x16')],{'raw':_0x4a37a8[_0xf6ca('0x17')]?_0x4a37a8[_0xf6ca('0x17')][_0xf6ca('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a37a8[_0xf6ca('0x17')]?_0x4a37a8['options'][_0xf6ca('0x1d')]||null:null,'attributes':_0x4a37a8[_0xf6ca('0x17')]?_0x4a37a8[_0xf6ca('0x17')][_0xf6ca('0x1e')]||null:null,'limit':_0x4a37a8[_0xf6ca('0x17')]?_0x4a37a8[_0xf6ca('0x17')][_0xf6ca('0x1f')]||null:null})[_0xf6ca('0x19')](function(_0x23cba7){logger[_0xf6ca('0xb')](_0xf6ca('0x1b'),_0x4a37a8);logger['debug']('UpdateSmsQueueReport',_0x4a37a8,JSON[_0xf6ca('0x20')](_0x23cba7));_0x5c56c5(_0x23cba7);})[_0xf6ca('0x12')](function(_0x34237d){logger[_0xf6ca('0x10')](_0xf6ca('0x1b'),_0x34237d[_0xf6ca('0x11')],_0x4a37a8);_0x5d91a0(_0x330f6a[_0xf6ca('0x10')](0x1f4,_0x34237d[_0xf6ca('0x11')]));});});}; \ No newline at end of file +var _0x7a10=['info','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','raw','where','attributes','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message'];(function(_0x22ddc2,_0x5c9c6d){var _0x45c534=function(_0x2bc0ab){while(--_0x2bc0ab){_0x22ddc2['push'](_0x22ddc2['shift']());}};_0x45c534(++_0x5c9c6d);}(_0x7a10,0x1eb));var _0x07a1=function(_0x16a6fe,_0x5865b5){_0x16a6fe=_0x16a6fe-0x0;var _0x367d5f=_0x7a10[_0x16a6fe];return _0x367d5f;};'use strict';var _=require('lodash');var util=require(_0x07a1('0x0'));var moment=require(_0x07a1('0x1'));var BPromise=require(_0x07a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07a1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x07a1('0x4'));var logger=require(_0x07a1('0x5'))(_0x07a1('0x6'));var config=require(_0x07a1('0x7'));var jayson=require(_0x07a1('0x8'));var client=jayson[_0x07a1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a9d9e,_0x45b702,_0x265dc0){return new BPromise(function(_0x2c6e70,_0xf05a9f){return client['request'](_0x5a9d9e,_0x265dc0)[_0x07a1('0xa')](function(_0x2f8664){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x45b702,_0x07a1('0xb'));logger[_0x07a1('0xc')](_0x07a1('0xd'),_0x45b702,_0x07a1('0xb'),JSON[_0x07a1('0xe')](_0x2f8664));if(_0x2f8664['error']){if(_0x2f8664[_0x07a1('0xf')][_0x07a1('0x10')]===0x1f4){logger[_0x07a1('0xf')](_0x07a1('0x11'),_0x45b702,_0x2f8664[_0x07a1('0xf')]['message']);return _0xf05a9f(_0x2f8664[_0x07a1('0xf')]['message']);}logger[_0x07a1('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x45b702,_0x2f8664['error'][_0x07a1('0x12')]);return _0x2c6e70(_0x2f8664[_0x07a1('0xf')]['message']);}else{logger[_0x07a1('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x45b702,_0x07a1('0xb'));_0x2c6e70(_0x2f8664['result']['message']);}})[_0x07a1('0x14')](function(_0x211d7c){logger['error'](_0x07a1('0x11'),_0x45b702,_0x211d7c);_0xf05a9f(_0x211d7c);});});}exports[_0x07a1('0x15')]=function(_0x24a01c){var _0x2c1690=this;return new Promise(function(_0x121d14,_0x1715bf){return db[_0x07a1('0x16')][_0x07a1('0x17')](_0x24a01c[_0x07a1('0x18')],{'raw':_0x24a01c[_0x07a1('0x19')]?_0x24a01c[_0x07a1('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x07a1('0xa')](function(_0x446175){logger['info']('CreateSmsQueueReport',_0x24a01c);logger[_0x07a1('0xc')]('CreateSmsQueueReport',_0x24a01c,JSON[_0x07a1('0xe')](_0x446175));_0x121d14(_0x446175);})[_0x07a1('0x14')](function(_0x48720e){logger['error'](_0x07a1('0x15'),_0x48720e[_0x07a1('0x12')],_0x24a01c);_0x1715bf(_0x2c1690[_0x07a1('0xf')](0x1f4,_0x48720e[_0x07a1('0x12')]));});});};exports[_0x07a1('0x1a')]=function(_0x464816){var _0x151f18=this;return new Promise(function(_0x20c4e4,_0x49c9af){return db['SmsQueueReport']['update'](_0x464816['body'],{'raw':_0x464816[_0x07a1('0x19')]?_0x464816[_0x07a1('0x19')][_0x07a1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x464816[_0x07a1('0x19')]?_0x464816['options'][_0x07a1('0x1c')]||null:null,'attributes':_0x464816[_0x07a1('0x19')]?_0x464816['options'][_0x07a1('0x1d')]||null:null,'limit':_0x464816[_0x07a1('0x19')]?_0x464816[_0x07a1('0x19')]['limit']||null:null})[_0x07a1('0xa')](function(_0x16808e){logger[_0x07a1('0x13')](_0x07a1('0x1a'),_0x464816);logger[_0x07a1('0xc')]('UpdateSmsQueueReport',_0x464816,JSON[_0x07a1('0xe')](_0x16808e));_0x20c4e4(_0x16808e);})[_0x07a1('0x14')](function(_0x5b4a33){logger[_0x07a1('0xf')]('UpdateSmsQueueReport',_0x5b4a33['message'],_0x464816);_0x49c9af(_0x151f18['error'](0x1f4,_0x5b4a33['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index cd2d51b..971f0bb 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 _0x1c9a=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update'];(function(_0x15c198,_0x30345c){var _0x30f5d5=function(_0x1b6b2e){while(--_0x1b6b2e){_0x15c198['push'](_0x15c198['shift']());}};_0x30f5d5(++_0x30345c);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x496be8,_0x398275){_0x496be8=_0x496be8-0x0;var _0x1407c6=_0x1c9a[_0x496be8];return _0x1407c6;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var path=require('path');var timeout=require(_0xa1c9('0x2'));var express=require(_0xa1c9('0x3'));var router=express[_0xa1c9('0x4')]();var fs_extra=require(_0xa1c9('0x5'));var auth=require(_0xa1c9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x7'));var controller=require('./smsTransferReport.controller');router[_0xa1c9('0x8')]('/',auth[_0xa1c9('0x9')](),controller[_0xa1c9('0xa')]);router[_0xa1c9('0x8')](_0xa1c9('0xb'),auth[_0xa1c9('0x9')](),controller[_0xa1c9('0xc')]);router[_0xa1c9('0x8')](_0xa1c9('0xd'),auth[_0xa1c9('0x9')](),controller[_0xa1c9('0xe')]);router[_0xa1c9('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa1c9('0x10')]('/:id',auth[_0xa1c9('0x9')](),controller[_0xa1c9('0x11')]);router[_0xa1c9('0x12')](_0xa1c9('0xd'),auth[_0xa1c9('0x9')](),controller[_0xa1c9('0x13')]);module[_0xa1c9('0x14')]=router; \ No newline at end of file +var _0xa9b1=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy'];(function(_0x47cfa0,_0x176b87){var _0x386b1d=function(_0x5785e5){while(--_0x5785e5){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x386b1d(++_0x176b87);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a9b('0x0'));var timeout=require(_0x1a9b('0x1'));var express=require(_0x1a9b('0x2'));var router=express[_0x1a9b('0x3')]();var fs_extra=require(_0x1a9b('0x4'));var auth=require(_0x1a9b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x1a9b('0x6')]('/',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0x8')]);router[_0x1a9b('0x6')](_0x1a9b('0x9'),auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xa')]);router[_0x1a9b('0x6')](_0x1a9b('0xb'),auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xc')]);router[_0x1a9b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a9b('0xe')](_0x1a9b('0xb'),auth[_0x1a9b('0x7')](),controller['update']);router['delete']('/:id',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xf')]);module[_0x1a9b('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 21b9525..03dddad 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(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4f0527,_0x284617){_0x4f0527=_0x4f0527-0x0;var _0x31e185=_0x9bde[_0x4f0527];return _0x31e185;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 43ef9d0..5b3e29a 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 _0x066b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','include','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x2ebbaa,_0x36f23d){var _0x533c48=function(_0x16c2a6){while(--_0x16c2a6){_0x2ebbaa['push'](_0x2ebbaa['shift']());}};_0x533c48(++_0x36f23d);}(_0x066b,0x161));var _0xb066=function(_0x2271ec,_0x5a98f8){_0x2271ec=_0x2271ec-0x0;var _0x4347cd=_0x066b[_0x2271ec];return _0x4347cd;};'use strict';var emlformat=require(_0xb066('0x0'));var rimraf=require(_0xb066('0x1'));var zipdir=require(_0xb066('0x2'));var jsonpatch=require(_0xb066('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb066('0x4'));var Mustache=require(_0xb066('0x5'));var util=require(_0xb066('0x6'));var path=require(_0xb066('0x7'));var sox=require(_0xb066('0x8'));var csv=require(_0xb066('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb066('0xa'));var _=require(_0xb066('0xb'));var squel=require(_0xb066('0xc'));var crypto=require('crypto');var jsforce=require(_0xb066('0xd'));var deskjs=require(_0xb066('0xe'));var toCsv=require(_0xb066('0x9'));var querystring=require(_0xb066('0xf'));var Papa=require(_0xb066('0x10'));var Redis=require(_0xb066('0x11'));var authService=require(_0xb066('0x12'));var qs=require(_0xb066('0x13'));var as=require(_0xb066('0x14'));var hardwareService=require(_0xb066('0x15'));var logger=require('../../config/logger')(_0xb066('0x16'));var utils=require(_0xb066('0x17'));var config=require(_0xb066('0x18'));var licenseUtil=require(_0xb066('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b4f2c,_0x1dcc7d){_0x1dcc7d=_0x1dcc7d||0xcc;return function(_0x8bd79f){if(_0x8bd79f){return _0x5b4f2c['sendStatus'](_0x1dcc7d);}return _0x5b4f2c[_0xb066('0x1a')](_0x1dcc7d)[_0xb066('0x1b')]();};}function respondWithResult(_0x23fa56,_0x417434){_0x417434=_0x417434||0xc8;return function(_0x15dbab){if(_0x15dbab){return _0x23fa56[_0xb066('0x1a')](_0x417434)[_0xb066('0x1c')](_0x15dbab);}};}function respondWithFilteredResult(_0x3eee75,_0x5cc90a){return function(_0x15ff19){if(_0x15ff19){var _0x51f79a=typeof _0x5cc90a[_0xb066('0x1d')]===_0xb066('0x1e')&&typeof _0x5cc90a['limit']==='undefined';var _0x3123d2=_0x15ff19[_0xb066('0x1f')];var _0x21b63a=_0x51f79a?0x0:_0x5cc90a[_0xb066('0x1d')];var _0x2fbc6d=_0x51f79a?_0x15ff19['count']:_0x5cc90a['offset']+_0x5cc90a[_0xb066('0x20')];var _0x5ae325;if(_0x2fbc6d>=_0x3123d2){_0x2fbc6d=_0x3123d2;_0x5ae325=0xc8;}else{_0x5ae325=0xce;}_0x3eee75[_0xb066('0x1a')](_0x5ae325);return _0x3eee75[_0xb066('0x21')](_0xb066('0x22'),_0x21b63a+'-'+_0x2fbc6d+'/'+_0x3123d2)[_0xb066('0x1c')](_0x15ff19);}return null;};}function patchUpdates(_0xe078d8){return function(_0xac90cb){try{jsonpatch[_0xb066('0x23')](_0xac90cb,_0xe078d8,!![]);}catch(_0x34253b){return BPromise['reject'](_0x34253b);}return _0xac90cb[_0xb066('0x24')]();};}function saveUpdates(_0x307134,_0x4525aa){return function(_0x195c3c){if(_0x195c3c){return _0x195c3c['update'](_0x307134)[_0xb066('0x25')](function(_0x230711){return _0x230711;});}return null;};}function removeEntity(_0x5515f2,_0x417191){return function(_0x39eddb){if(_0x39eddb){return _0x39eddb[_0xb066('0x26')]()[_0xb066('0x25')](function(){_0x5515f2[_0xb066('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ddc8,_0x339e42){return function(_0x2d1f16){if(!_0x2d1f16){_0x52ddc8[_0xb066('0x27')](0x194);}return _0x2d1f16;};}function handleError(_0x170607,_0x5001b3){_0x5001b3=_0x5001b3||0x1f4;return function(_0x5ad762){logger[_0xb066('0x28')](_0x5ad762[_0xb066('0x29')]);if(_0x5ad762[_0xb066('0x2a')]){delete _0x5ad762[_0xb066('0x2a')];}_0x170607[_0xb066('0x1a')](_0x5001b3)[_0xb066('0x2b')](_0x5ad762);};}exports[_0xb066('0x2c')]=function(_0x15a9d4,_0x4a3247){var _0x4da381={},_0x4243f6={},_0x5db2d1={'count':0x0,'rows':[]};var _0x3a3e7b=_[_0xb066('0x2d')](db[_0xb066('0x2e')][_0xb066('0x2f')],function(_0x43b51e){return{'name':_0x43b51e['fieldName'],'type':_0x43b51e[_0xb066('0x30')]['key']};});_0x4243f6[_0xb066('0x31')]=_[_0xb066('0x2d')](_0x3a3e7b,_0xb066('0x2a'));_0x4243f6[_0xb066('0x32')]=_[_0xb066('0x33')](_0x15a9d4[_0xb066('0x32')]);_0x4243f6['filters']=_['intersection'](_0x4243f6['model'],_0x4243f6[_0xb066('0x32')]);_0x4da381[_0xb066('0x34')]=_[_0xb066('0x35')](_0x4243f6[_0xb066('0x31')],qs['fields'](_0x15a9d4[_0xb066('0x32')][_0xb066('0x36')]));_0x4da381[_0xb066('0x34')]=_0x4da381[_0xb066('0x34')][_0xb066('0x37')]?_0x4da381[_0xb066('0x34')]:_0x4243f6[_0xb066('0x31')];if(!_0x15a9d4['query'][_0xb066('0x38')](_0xb066('0x39'))){_0x4da381[_0xb066('0x20')]=qs[_0xb066('0x20')](_0x15a9d4['query'][_0xb066('0x20')]);_0x4da381[_0xb066('0x1d')]=qs['offset'](_0x15a9d4[_0xb066('0x32')][_0xb066('0x1d')]);}_0x4da381['order']=qs[_0xb066('0x3a')](_0x15a9d4['query']['sort']);_0x4da381['where']=qs['filters'](_[_0xb066('0x3b')](_0x15a9d4[_0xb066('0x32')],_0x4243f6[_0xb066('0x3c')]),_0x3a3e7b);if(_0x15a9d4[_0xb066('0x32')]['filter']){_0x4da381[_0xb066('0x3d')]=_[_0xb066('0x3e')](_0x4da381[_0xb066('0x3d')],{'$or':_[_0xb066('0x2d')](_0x3a3e7b,function(_0x5e5f10){if(_0x5e5f10[_0xb066('0x30')]!==_0xb066('0x3f')){var _0x55da3d={};_0x55da3d[_0x5e5f10[_0xb066('0x2a')]]={'$like':'%'+_0x15a9d4[_0xb066('0x32')][_0xb066('0x40')]+'%'};return _0x55da3d;}})});}_0x4da381=_['merge']({},_0x4da381,_0x15a9d4[_0xb066('0x41')]);var _0x1deb7c={'where':_0x4da381[_0xb066('0x3d')]};return db[_0xb066('0x2e')][_0xb066('0x1f')](_0x1deb7c)[_0xb066('0x25')](function(_0x3b2562){_0x5db2d1[_0xb066('0x1f')]=_0x3b2562;if(_0x15a9d4[_0xb066('0x32')][_0xb066('0x42')]){_0x4da381[_0xb066('0x43')]=[{'all':!![]}];}return db[_0xb066('0x2e')]['findAll'](_0x4da381);})[_0xb066('0x25')](function(_0x34f79e){_0x5db2d1['rows']=_0x34f79e;return _0x5db2d1;})[_0xb066('0x25')](respondWithFilteredResult(_0x4a3247,_0x4da381))[_0xb066('0x44')](handleError(_0x4a3247,null));};exports['show']=function(_0x42962b,_0x4a6783){var _0xe5eb0a={'raw':!![],'where':{'id':_0x42962b['params']['id']}},_0x49c326={};_0x49c326[_0xb066('0x31')]=_[_0xb066('0x33')](db[_0xb066('0x2e')]['rawAttributes']);_0x49c326[_0xb066('0x32')]=_[_0xb066('0x33')](_0x42962b['query']);_0x49c326[_0xb066('0x3c')]=_[_0xb066('0x35')](_0x49c326['model'],_0x49c326[_0xb066('0x32')]);_0xe5eb0a[_0xb066('0x34')]=_[_0xb066('0x35')](_0x49c326[_0xb066('0x31')],qs['fields'](_0x42962b['query'][_0xb066('0x36')]));_0xe5eb0a[_0xb066('0x34')]=_0xe5eb0a['attributes']['length']?_0xe5eb0a['attributes']:_0x49c326[_0xb066('0x31')];if(_0x42962b[_0xb066('0x32')]['includeAll']){_0xe5eb0a[_0xb066('0x43')]=[{'all':!![]}];}_0xe5eb0a=_[_0xb066('0x3e')]({},_0xe5eb0a,_0x42962b[_0xb066('0x41')]);return db[_0xb066('0x2e')][_0xb066('0x45')](_0xe5eb0a)[_0xb066('0x25')](handleEntityNotFound(_0x4a6783,null))['then'](respondWithResult(_0x4a6783,null))[_0xb066('0x44')](handleError(_0x4a6783,null));};exports[_0xb066('0x46')]=function(_0xab2a82,_0xff6bb7){return db[_0xb066('0x2e')][_0xb066('0x46')](_0xab2a82[_0xb066('0x47')],{})[_0xb066('0x25')](respondWithResult(_0xff6bb7,0xc9))[_0xb066('0x44')](handleError(_0xff6bb7,null));};exports['update']=function(_0xd84b97,_0x178be9){if(_0xd84b97[_0xb066('0x47')]['id']){delete _0xd84b97[_0xb066('0x47')]['id'];}return db[_0xb066('0x2e')]['find']({'where':{'id':_0xd84b97['params']['id']}})[_0xb066('0x25')](handleEntityNotFound(_0x178be9,null))[_0xb066('0x25')](saveUpdates(_0xd84b97[_0xb066('0x47')],null))[_0xb066('0x25')](respondWithResult(_0x178be9,null))[_0xb066('0x44')](handleError(_0x178be9,null));};exports[_0xb066('0x26')]=function(_0x34961e,_0x4dbaa5){return db[_0xb066('0x2e')][_0xb066('0x45')]({'where':{'id':_0x34961e[_0xb066('0x48')]['id']}})[_0xb066('0x25')](handleEntityNotFound(_0x4dbaa5,null))[_0xb066('0x25')](removeEntity(_0x4dbaa5,null))['catch'](handleError(_0x4dbaa5,null));};exports['describe']=function(_0x18fa06,_0x17f53a){return db[_0xb066('0x2e')][_0xb066('0x49')]()['then'](respondWithResult(_0x17f53a,null))['catch'](handleError(_0x17f53a,null));}; \ No newline at end of file +var _0x954b=['name','send','index','map','SmsTransferReport','rawAttributes','fieldName','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','find','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','reject','update','then','sendStatus','stack'];(function(_0x43909c,_0x2e8cc9){var _0x37bab7=function(_0x51265a){while(--_0x51265a){_0x43909c['push'](_0x43909c['shift']());}};_0x37bab7(++_0x2e8cc9);}(_0x954b,0x6d));var _0xb954=function(_0x29d87d,_0x23dc31){_0x29d87d=_0x29d87d-0x0;var _0x1fd84b=_0x954b[_0x29d87d];return _0x1fd84b;};'use strict';var emlformat=require(_0xb954('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb954('0x1'));var jsonpatch=require(_0xb954('0x2'));var rp=require(_0xb954('0x3'));var moment=require(_0xb954('0x4'));var BPromise=require(_0xb954('0x5'));var Mustache=require(_0xb954('0x6'));var util=require(_0xb954('0x7'));var path=require(_0xb954('0x8'));var sox=require(_0xb954('0x9'));var csv=require('to-csv');var ejs=require(_0xb954('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb954('0xb'));var squel=require(_0xb954('0xc'));var crypto=require('crypto');var jsforce=require(_0xb954('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb954('0xe'));var querystring=require(_0xb954('0xf'));var Papa=require(_0xb954('0x10'));var Redis=require(_0xb954('0x11'));var authService=require(_0xb954('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb954('0x13'));var hardwareService=require(_0xb954('0x14'));var logger=require(_0xb954('0x15'))(_0xb954('0x16'));var utils=require(_0xb954('0x17'));var config=require(_0xb954('0x18'));var licenseUtil=require(_0xb954('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29bc08,_0x3a5e9b){_0x3a5e9b=_0x3a5e9b||0xcc;return function(_0x1c6102){if(_0x1c6102){return _0x29bc08['sendStatus'](_0x3a5e9b);}return _0x29bc08[_0xb954('0x1a')](_0x3a5e9b)[_0xb954('0x1b')]();};}function respondWithResult(_0x4064f3,_0xcd42c0){_0xcd42c0=_0xcd42c0||0xc8;return function(_0x369549){if(_0x369549){return _0x4064f3[_0xb954('0x1a')](_0xcd42c0)[_0xb954('0x1c')](_0x369549);}};}function respondWithFilteredResult(_0x42b4c0,_0x5e5587){return function(_0x4b5252){if(_0x4b5252){var _0x27b895=typeof _0x5e5587[_0xb954('0x1d')]===_0xb954('0x1e')&&typeof _0x5e5587[_0xb954('0x1f')]===_0xb954('0x1e');var _0x1737a4=_0x4b5252[_0xb954('0x20')];var _0x2487f6=_0x27b895?0x0:_0x5e5587[_0xb954('0x1d')];var _0x4daf1c=_0x27b895?_0x4b5252[_0xb954('0x20')]:_0x5e5587[_0xb954('0x1d')]+_0x5e5587[_0xb954('0x1f')];var _0x9a8ac7;if(_0x4daf1c>=_0x1737a4){_0x4daf1c=_0x1737a4;_0x9a8ac7=0xc8;}else{_0x9a8ac7=0xce;}_0x42b4c0[_0xb954('0x1a')](_0x9a8ac7);return _0x42b4c0[_0xb954('0x21')]('Content-Range',_0x2487f6+'-'+_0x4daf1c+'/'+_0x1737a4)[_0xb954('0x1c')](_0x4b5252);}return null;};}function patchUpdates(_0x378478){return function(_0x158c59){try{jsonpatch['apply'](_0x158c59,_0x378478,!![]);}catch(_0x462e60){return BPromise[_0xb954('0x22')](_0x462e60);}return _0x158c59['save']();};}function saveUpdates(_0x4090f9,_0x5e7e2e){return function(_0x48d9e5){if(_0x48d9e5){return _0x48d9e5[_0xb954('0x23')](_0x4090f9)[_0xb954('0x24')](function(_0x43d381){return _0x43d381;});}return null;};}function removeEntity(_0x2a3e68,_0x4dffb3){return function(_0x3b6029){if(_0x3b6029){return _0x3b6029['destroy']()[_0xb954('0x24')](function(){_0x2a3e68[_0xb954('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4054d3,_0x305a96){return function(_0x15d0e9){if(!_0x15d0e9){_0x4054d3[_0xb954('0x25')](0x194);}return _0x15d0e9;};}function handleError(_0x40c63a,_0x161580){_0x161580=_0x161580||0x1f4;return function(_0x15c4bb){logger['error'](_0x15c4bb[_0xb954('0x26')]);if(_0x15c4bb[_0xb954('0x27')]){delete _0x15c4bb['name'];}_0x40c63a[_0xb954('0x1a')](_0x161580)[_0xb954('0x28')](_0x15c4bb);};}exports[_0xb954('0x29')]=function(_0x361ed1,_0x485de1){var _0x429ffd={},_0x13f24d={},_0x29241b={'count':0x0,'rows':[]};var _0x31cfc1=_[_0xb954('0x2a')](db[_0xb954('0x2b')][_0xb954('0x2c')],function(_0xf07700){return{'name':_0xf07700[_0xb954('0x2d')],'type':_0xf07700['type']['key']};});_0x13f24d['model']=_['map'](_0x31cfc1,_0xb954('0x27'));_0x13f24d[_0xb954('0x2e')]=_[_0xb954('0x2f')](_0x361ed1[_0xb954('0x2e')]);_0x13f24d['filters']=_['intersection'](_0x13f24d[_0xb954('0x30')],_0x13f24d['query']);_0x429ffd[_0xb954('0x31')]=_[_0xb954('0x32')](_0x13f24d[_0xb954('0x30')],qs['fields'](_0x361ed1[_0xb954('0x2e')][_0xb954('0x33')]));_0x429ffd[_0xb954('0x31')]=_0x429ffd['attributes'][_0xb954('0x34')]?_0x429ffd[_0xb954('0x31')]:_0x13f24d[_0xb954('0x30')];if(!_0x361ed1[_0xb954('0x2e')][_0xb954('0x35')](_0xb954('0x36'))){_0x429ffd[_0xb954('0x1f')]=qs[_0xb954('0x1f')](_0x361ed1[_0xb954('0x2e')]['limit']);_0x429ffd[_0xb954('0x1d')]=qs['offset'](_0x361ed1[_0xb954('0x2e')]['offset']);}_0x429ffd[_0xb954('0x37')]=qs[_0xb954('0x38')](_0x361ed1[_0xb954('0x2e')]['sort']);_0x429ffd[_0xb954('0x39')]=qs[_0xb954('0x3a')](_[_0xb954('0x3b')](_0x361ed1[_0xb954('0x2e')],_0x13f24d[_0xb954('0x3a')]),_0x31cfc1);if(_0x361ed1[_0xb954('0x2e')][_0xb954('0x3c')]){_0x429ffd[_0xb954('0x39')]=_[_0xb954('0x3d')](_0x429ffd[_0xb954('0x39')],{'$or':_[_0xb954('0x2a')](_0x31cfc1,function(_0x5d92c3){if(_0x5d92c3[_0xb954('0x3e')]!==_0xb954('0x3f')){var _0x6c7dcf={};_0x6c7dcf[_0x5d92c3[_0xb954('0x27')]]={'$like':'%'+_0x361ed1[_0xb954('0x2e')]['filter']+'%'};return _0x6c7dcf;}})});}_0x429ffd=_['merge']({},_0x429ffd,_0x361ed1[_0xb954('0x40')]);var _0x7da02c={'where':_0x429ffd[_0xb954('0x39')]};return db[_0xb954('0x2b')][_0xb954('0x20')](_0x7da02c)[_0xb954('0x24')](function(_0x384243){_0x29241b['count']=_0x384243;if(_0x361ed1[_0xb954('0x2e')]['includeAll']){_0x429ffd[_0xb954('0x41')]=[{'all':!![]}];}return db[_0xb954('0x2b')][_0xb954('0x42')](_0x429ffd);})[_0xb954('0x24')](function(_0x42dc4f){_0x29241b[_0xb954('0x43')]=_0x42dc4f;return _0x29241b;})['then'](respondWithFilteredResult(_0x485de1,_0x429ffd))[_0xb954('0x44')](handleError(_0x485de1,null));};exports['show']=function(_0x49a76d,_0x397bcb){var _0x360ec9={'raw':!![],'where':{'id':_0x49a76d[_0xb954('0x45')]['id']}},_0x109af2={};_0x109af2[_0xb954('0x30')]=_['keys'](db[_0xb954('0x2b')][_0xb954('0x2c')]);_0x109af2['query']=_[_0xb954('0x2f')](_0x49a76d[_0xb954('0x2e')]);_0x109af2['filters']=_[_0xb954('0x32')](_0x109af2[_0xb954('0x30')],_0x109af2['query']);_0x360ec9[_0xb954('0x31')]=_[_0xb954('0x32')](_0x109af2[_0xb954('0x30')],qs[_0xb954('0x33')](_0x49a76d[_0xb954('0x2e')]['fields']));_0x360ec9['attributes']=_0x360ec9['attributes'][_0xb954('0x34')]?_0x360ec9[_0xb954('0x31')]:_0x109af2[_0xb954('0x30')];if(_0x49a76d[_0xb954('0x2e')]['includeAll']){_0x360ec9[_0xb954('0x41')]=[{'all':!![]}];}_0x360ec9=_['merge']({},_0x360ec9,_0x49a76d[_0xb954('0x40')]);return db[_0xb954('0x2b')][_0xb954('0x46')](_0x360ec9)[_0xb954('0x24')](handleEntityNotFound(_0x397bcb,null))[_0xb954('0x24')](respondWithResult(_0x397bcb,null))['catch'](handleError(_0x397bcb,null));};exports['create']=function(_0x48253c,_0x2b92b6){return db['SmsTransferReport']['create'](_0x48253c[_0xb954('0x47')],{})[_0xb954('0x24')](respondWithResult(_0x2b92b6,0xc9))[_0xb954('0x44')](handleError(_0x2b92b6,null));};exports[_0xb954('0x23')]=function(_0x1d0d1c,_0x7c8aa){if(_0x1d0d1c['body']['id']){delete _0x1d0d1c['body']['id'];}return db[_0xb954('0x2b')][_0xb954('0x46')]({'where':{'id':_0x1d0d1c['params']['id']}})[_0xb954('0x24')](handleEntityNotFound(_0x7c8aa,null))[_0xb954('0x24')](saveUpdates(_0x1d0d1c[_0xb954('0x47')],null))[_0xb954('0x24')](respondWithResult(_0x7c8aa,null))[_0xb954('0x44')](handleError(_0x7c8aa,null));};exports[_0xb954('0x48')]=function(_0x4a82c4,_0x5c62d8){return db['SmsTransferReport'][_0xb954('0x46')]({'where':{'id':_0x4a82c4[_0xb954('0x45')]['id']}})[_0xb954('0x24')](handleEntityNotFound(_0x5c62d8,null))[_0xb954('0x24')](removeEntity(_0x5c62d8,null))['catch'](handleError(_0x5c62d8,null));};exports['describe']=function(_0x1aba28,_0x49317b){return db[_0xb954('0x2b')][_0xb954('0x49')]()[_0xb954('0x24')](respondWithResult(_0x49317b,null))[_0xb954('0x44')](handleError(_0x49317b,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1de415f..def5a0d 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 _0xf29c=['define','SmsTransferReport','report_sms_transfer','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x45c1fb,_0x27942b){var _0x25480a=function(_0x315e81){while(--_0x315e81){_0x45c1fb['push'](_0x45c1fb['shift']());}};_0x25480a(++_0x27942b);}(_0xf29c,0xc7));var _0xcf29=function(_0x554b62,_0x2c2b58){_0x554b62=_0x554b62-0x0;var _0x2b1796=_0xf29c[_0x554b62];return _0x2b1796;};'use strict';var _=require('lodash');var util=require(_0xcf29('0x0'));var logger=require(_0xcf29('0x1'))(_0xcf29('0x2'));var moment=require(_0xcf29('0x3'));var BPromise=require(_0xcf29('0x4'));var rp=require(_0xcf29('0x5'));var fs=require('fs');var path=require(_0xcf29('0x6'));var rimraf=require(_0xcf29('0x7'));var config=require(_0xcf29('0x8'));var attributes=require(_0xcf29('0x9'));module[_0xcf29('0xa')]=function(_0x89a1c8,_0x347493){return _0x89a1c8[_0xcf29('0xb')](_0xcf29('0xc'),attributes,{'tableName':_0xcf29('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3aa2=['../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api','bluebird','path'];(function(_0x3de522,_0x1114a1){var _0x5a3afc=function(_0x1816ed){while(--_0x1816ed){_0x3de522['push'](_0x3de522['shift']());}};_0x5a3afc(++_0x1114a1);}(_0x3aa2,0xd3));var _0x23aa=function(_0x27e2bc,_0x1f5bb1){_0x27e2bc=_0x27e2bc-0x0;var _0x303eed=_0x3aa2[_0x27e2bc];return _0x303eed;};'use strict';var _=require('lodash');var util=require(_0x23aa('0x0'));var logger=require(_0x23aa('0x1'))(_0x23aa('0x2'));var moment=require('moment');var BPromise=require(_0x23aa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23aa('0x4'));var rimraf=require('rimraf');var config=require(_0x23aa('0x5'));var attributes=require(_0x23aa('0x6'));module[_0x23aa('0x7')]=function(_0x1b60a0,_0x828c0){return _0x1b60a0[_0x23aa('0x8')](_0x23aa('0x9'),attributes,{'tableName':_0x23aa('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x23aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d89968d..6500583 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 _0x202c=['message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x11f3c5,_0x4766a3){var _0xc0b593=function(_0x39fd07){while(--_0x39fd07){_0x11f3c5['push'](_0x11f3c5['shift']());}};_0xc0b593(++_0x4766a3);}(_0x202c,0x178));var _0xc202=function(_0x5e23e3,_0x859a20){_0x5e23e3=_0x5e23e3-0x0;var _0x388dba=_0x202c[_0x5e23e3];return _0x388dba;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc202('0x1'));var rs=require(_0xc202('0x2'));var fs=require('fs');var Redis=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc202('0x4'));var logger=require(_0xc202('0x5'))(_0xc202('0x6'));var config=require(_0xc202('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc202('0x8')][_0xc202('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59563a,_0xc2b3eb,_0x574549){return new BPromise(function(_0x872c1a,_0x5978fe){return client[_0xc202('0xa')](_0x59563a,_0x574549)[_0xc202('0xb')](function(_0x36fcb7){logger[_0xc202('0xc')](_0xc202('0xd'),_0xc2b3eb,_0xc202('0xe'));logger[_0xc202('0xf')](_0xc202('0x10'),_0xc2b3eb,_0xc202('0xe'),JSON[_0xc202('0x11')](_0x36fcb7));if(_0x36fcb7[_0xc202('0x12')]){if(_0x36fcb7['error'][_0xc202('0x13')]===0x1f4){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);return _0x5978fe(_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);}logger['error'](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')]['message']);return _0x872c1a(_0x36fcb7['error']['message']);}else{logger[_0xc202('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0xc2b3eb,_0xc202('0xe'));_0x872c1a(_0x36fcb7['result'][_0xc202('0x14')]);}})[_0xc202('0x15')](function(_0x3018c8){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x3018c8);_0x5978fe(_0x3018c8);});});} \ No newline at end of file +var _0x19da=['error','message','info','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x19da,0x9f));var _0xa19d=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x19da[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require(_0xa19d('0x0'));var moment=require('moment');var BPromise=require(_0xa19d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19d('0x2'));var db=require(_0xa19d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa19d('0x4'))(_0xa19d('0x5'));var config=require('../../config/environment');var jayson=require(_0xa19d('0x6'));var client=jayson[_0xa19d('0x7')][_0xa19d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14dc68,_0x32da37,_0x4b4627){return new BPromise(function(_0x197c4e,_0x4e6638){return client[_0xa19d('0x9')](_0x14dc68,_0x4b4627)[_0xa19d('0xa')](function(_0x538dea){logger['info'](_0xa19d('0xb'),_0x32da37,_0xa19d('0xc'));logger[_0xa19d('0xd')](_0xa19d('0xe'),_0x32da37,_0xa19d('0xc'),JSON[_0xa19d('0xf')](_0x538dea));if(_0x538dea['error']){if(_0x538dea['error'][_0xa19d('0x10')]===0x1f4){logger[_0xa19d('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x32da37,_0x538dea['error'][_0xa19d('0x12')]);return _0x4e6638(_0x538dea[_0xa19d('0x11')]['message']);}logger[_0xa19d('0x11')](_0xa19d('0xb'),_0x32da37,_0x538dea[_0xa19d('0x11')]['message']);return _0x197c4e(_0x538dea[_0xa19d('0x11')]['message']);}else{logger[_0xa19d('0x13')](_0xa19d('0xb'),_0x32da37,_0xa19d('0xc'));_0x197c4e(_0x538dea[_0xa19d('0x14')][_0xa19d('0x12')]);}})[_0xa19d('0x15')](function(_0x2f2774){logger[_0xa19d('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x32da37,_0x2f2774);_0x4e6638(_0x2f2774);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index d43088d..9da6f9b 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 _0x4ca3=['isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','format','%s-%s%s','basename','originalname','extname','single','file','create','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x4ca3,0x84));var _0x34ca=function(_0x5b120c,_0x467bef){_0x5b120c=_0x5b120c-0x0;var _0x298274=_0x4ca3[_0x5b120c];return _0x298274;};'use strict';var multer=require(_0x34ca('0x0'));var util=require(_0x34ca('0x1'));var path=require(_0x34ca('0x2'));var timeout=require(_0x34ca('0x3'));var express=require(_0x34ca('0x4'));var router=express['Router']();var fs_extra=require(_0x34ca('0x5'));var auth=require(_0x34ca('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x34ca('0x7')]('/',auth[_0x34ca('0x8')](),controller[_0x34ca('0x9')]);router[_0x34ca('0x7')](_0x34ca('0xa'),auth[_0x34ca('0x8')](),controller[_0x34ca('0xb')]);router['get'](_0x34ca('0xc'),auth[_0x34ca('0x8')](),controller[_0x34ca('0xd')]);var upload=multer({'storage':multer[_0x34ca('0xe')]({'destination':function(_0xc7ec7f,_0x136707,_0x5d6235){_0x5d6235(null,path[_0x34ca('0xf')](config[_0x34ca('0x10')],_0x34ca('0x11')));},'filename':function(_0x2b3c00,_0x54b946,_0x599cf1){_0x54b946['originalname']=_0x54b946['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x599cf1(null,util[_0x34ca('0x12')](_0x34ca('0x13'),path[_0x34ca('0x14')](_0x54b946[_0x34ca('0x15')],path[_0x34ca('0x16')](_0x54b946[_0x34ca('0x15')])),Date['now'](),path[_0x34ca('0x16')](_0x54b946['originalname'])));}})});router['post']('/',upload[_0x34ca('0x17')](_0x34ca('0x18')),controller[_0x34ca('0x19')]);router[_0x34ca('0x1a')](_0x34ca('0xa'),auth[_0x34ca('0x8')](),controller['update']);router['delete']('/:id',auth[_0x34ca('0x8')](),controller['delete']);module[_0x34ca('0x1b')]=router; \ No newline at end of file +var _0x8807=['format','%s-%s%s','extname','now','post','single','file','/:id','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','isAuthenticated','/:id/download','join','server/files/sounds/original/','originalname','replace'];(function(_0x4db972,_0x40d979){var _0x5d6255=function(_0x2fabc8){while(--_0x2fabc8){_0x4db972['push'](_0x4db972['shift']());}};_0x5d6255(++_0x40d979);}(_0x8807,0x1eb));var _0x7880=function(_0x33925b,_0x95cfc6){_0x33925b=_0x33925b-0x0;var _0x375e21=_0x8807[_0x33925b];return _0x375e21;};'use strict';var multer=require(_0x7880('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7880('0x1'));var express=require(_0x7880('0x2'));var router=express['Router']();var fs_extra=require(_0x7880('0x3'));var auth=require(_0x7880('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7880('0x5'));var controller=require(_0x7880('0x6'));router['get']('/',auth[_0x7880('0x7')](),controller['index']);router['get']('/:id',auth[_0x7880('0x7')](),controller['show']);router['get'](_0x7880('0x8'),auth[_0x7880('0x7')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d32f1,_0x57fb44,_0x121535){_0x121535(null,path[_0x7880('0x9')](config['root'],_0x7880('0xa')));},'filename':function(_0x429d64,_0x3e3140,_0x4a0715){_0x3e3140[_0x7880('0xb')]=_0x3e3140[_0x7880('0xb')][_0x7880('0xc')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4a0715(null,util[_0x7880('0xd')](_0x7880('0xe'),path['basename'](_0x3e3140[_0x7880('0xb')],path[_0x7880('0xf')](_0x3e3140['originalname'])),Date[_0x7880('0x10')](),path[_0x7880('0xf')](_0x3e3140['originalname'])));}})});router[_0x7880('0x11')]('/',upload[_0x7880('0x12')](_0x7880('0x13')),controller['create']);router['put'](_0x7880('0x14'),auth[_0x7880('0x7')](),controller[_0x7880('0x15')]);router['delete']('/:id',auth[_0x7880('0x7')](),controller[_0x7880('0x16')]);module[_0x7880('0x17')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index e749517..9b86d10 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 _0x533b=['BIGINT','INTEGER','exports','STRING','FLOAT'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x533b,0x98));var _0xb533=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x533b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xb533('0x0')]={'name':{'type':Sequelize[_0xb533('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xb533('0x1')]},'original_duration':{'type':Sequelize[_0xb533('0x2')]},'original_sampleCount':{'type':Sequelize[_0xb533('0x3')]},'original_channelCount':{'type':Sequelize[_0xb533('0x4')]},'original_bitRate':{'type':Sequelize[_0xb533('0x3')]},'original_sampleRate':{'type':Sequelize[_0xb533('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xb533('0x3')]},'converted_channelCount':{'type':Sequelize[_0xb533('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xb533('0x4')]}}; \ No newline at end of file +var _0x71b6=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x4a0e69,_0x2a2678){var _0x237a91=function(_0x7c1bd0){while(--_0x7c1bd0){_0x4a0e69['push'](_0x4a0e69['shift']());}};_0x237a91(++_0x2a2678);}(_0x71b6,0xbd));var _0x671b=function(_0x3f7487,_0x5e5f2a){_0x3f7487=_0x3f7487-0x0;var _0x51f651=_0x71b6[_0x3f7487];return _0x51f651;};'use strict';var Sequelize=require(_0x671b('0x0'));module[_0x671b('0x1')]={'name':{'type':Sequelize[_0x671b('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x671b('0x2')]},'display_name':{'type':Sequelize[_0x671b('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x671b('0x2')]},'original_format':{'type':Sequelize[_0x671b('0x2')]},'original_duration':{'type':Sequelize[_0x671b('0x3')]},'original_sampleCount':{'type':Sequelize[_0x671b('0x4')]},'original_channelCount':{'type':Sequelize[_0x671b('0x5')]},'original_bitRate':{'type':Sequelize[_0x671b('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x671b('0x2')]},'converted_duration':{'type':Sequelize[_0x671b('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x671b('0x4')]},'converted_channelCount':{'type':Sequelize[_0x671b('0x5')]},'converted_bitRate':{'type':Sequelize[_0x671b('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x671b('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ab7c170..d3db810 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 _0x91d6=['server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','transcode','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','0777','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','Sound','includeAll','include','findAll','rows','catch','params','length','find','download','save_name','converted_format','existsSync','join','root'];(function(_0x14b5a5,_0x231b3a){var _0x2a7706=function(_0x2d451d){while(--_0x2d451d){_0x14b5a5['push'](_0x14b5a5['shift']());}};_0x2a7706(++_0x231b3a);}(_0x91d6,0xa8));var _0x691d=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x91d6[_0x2faddb];return _0x273c05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x691d('0x0'));var zipdir=require(_0x691d('0x1'));var jsonpatch=require(_0x691d('0x2'));var rp=require('request-promise');var moment=require(_0x691d('0x3'));var BPromise=require(_0x691d('0x4'));var Mustache=require(_0x691d('0x5'));var util=require(_0x691d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x691d('0x7'));var ejs=require(_0x691d('0x8'));var fs=require('fs');var fs_extra=require(_0x691d('0x9'));var _=require(_0x691d('0xa'));var squel=require(_0x691d('0xb'));var crypto=require(_0x691d('0xc'));var jsforce=require(_0x691d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x691d('0xe'));var Papa=require(_0x691d('0xf'));var Redis=require(_0x691d('0x10'));var authService=require(_0x691d('0x11'));var qs=require(_0x691d('0x12'));var as=require(_0x691d('0x13'));var hardwareService=require(_0x691d('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x691d('0x15'));var licenseUtil=require(_0x691d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34c3af,_0x1dc15b){_0x1dc15b=_0x1dc15b||0xcc;return function(_0x3e2be1){if(_0x3e2be1){return _0x34c3af['sendStatus'](_0x1dc15b);}return _0x34c3af[_0x691d('0x17')](_0x1dc15b)[_0x691d('0x18')]();};}function respondWithResult(_0x347243,_0x134e3f){_0x134e3f=_0x134e3f||0xc8;return function(_0x1e8690){if(_0x1e8690){return _0x347243[_0x691d('0x17')](_0x134e3f)[_0x691d('0x19')](_0x1e8690);}};}function respondWithFilteredResult(_0x7da222,_0x52077e){return function(_0x5479e7){if(_0x5479e7){var _0x5098a8=typeof _0x52077e[_0x691d('0x1a')]==='undefined'&&typeof _0x52077e['limit']===_0x691d('0x1b');var _0x4d5bbf=_0x5479e7[_0x691d('0x1c')];var _0x3d681b=_0x5098a8?0x0:_0x52077e[_0x691d('0x1a')];var _0x2f1328=_0x5098a8?_0x5479e7[_0x691d('0x1c')]:_0x52077e[_0x691d('0x1a')]+_0x52077e[_0x691d('0x1d')];var _0x16a32d;if(_0x2f1328>=_0x4d5bbf){_0x2f1328=_0x4d5bbf;_0x16a32d=0xc8;}else{_0x16a32d=0xce;}_0x7da222[_0x691d('0x17')](_0x16a32d);return _0x7da222[_0x691d('0x1e')]('Content-Range',_0x3d681b+'-'+_0x2f1328+'/'+_0x4d5bbf)[_0x691d('0x19')](_0x5479e7);}return null;};}function patchUpdates(_0x379b5e){return function(_0x3cf0a7){try{jsonpatch[_0x691d('0x1f')](_0x3cf0a7,_0x379b5e,!![]);}catch(_0x3cc8a6){return BPromise[_0x691d('0x20')](_0x3cc8a6);}return _0x3cf0a7[_0x691d('0x21')]();};}function saveUpdates(_0x1cc31d,_0x352cb7){return function(_0x2be5b8){if(_0x2be5b8){return _0x2be5b8[_0x691d('0x22')](_0x1cc31d)[_0x691d('0x23')](function(_0x1a8698){return _0x1a8698;});}return null;};}function removeEntity(_0x3af6a6,_0x262a86){return function(_0x300e0c){if(_0x300e0c){return _0x300e0c[_0x691d('0x24')]()['then'](function(){var _0x306bd0=_0x300e0c[_0x691d('0x25')]({'plain':!![]});var _0x1cdc54=_0x691d('0x26');return db[_0x691d('0x27')][_0x691d('0x24')]({'where':{'type':_0x1cdc54,'resourceId':_0x306bd0['id']}})['then'](function(){return _0x300e0c;});})[_0x691d('0x23')](function(){_0x3af6a6[_0x691d('0x17')](0xcc)[_0x691d('0x18')]();});}};}function handleEntityNotFound(_0x30a238,_0x18c94a){return function(_0x32f572){if(!_0x32f572){_0x30a238[_0x691d('0x28')](0x194);}return _0x32f572;};}function handleError(_0x1dd848,_0x1f342b){_0x1f342b=_0x1f342b||0x1f4;return function(_0x123237){logger[_0x691d('0x29')](_0x123237[_0x691d('0x2a')]);if(_0x123237[_0x691d('0x2b')]){delete _0x123237['name'];}_0x1dd848[_0x691d('0x17')](_0x1f342b)[_0x691d('0x2c')](_0x123237);};}exports[_0x691d('0x2d')]=function(_0x19af08,_0x29b3b9){var _0x503a2b={},_0x346063={},_0x550894={'count':0x0,'rows':[]};var _0x4065ab=_[_0x691d('0x2e')](db['Sound'][_0x691d('0x2f')],function(_0x63bfa2){return{'name':_0x63bfa2[_0x691d('0x30')],'type':_0x63bfa2['type']['key']};});_0x346063[_0x691d('0x31')]=_[_0x691d('0x2e')](_0x4065ab,_0x691d('0x2b'));_0x346063[_0x691d('0x32')]=_[_0x691d('0x33')](_0x19af08[_0x691d('0x32')]);_0x346063[_0x691d('0x34')]=_[_0x691d('0x35')](_0x346063[_0x691d('0x31')],_0x346063[_0x691d('0x32')]);_0x503a2b['attributes']=_[_0x691d('0x35')](_0x346063['model'],qs[_0x691d('0x36')](_0x19af08['query'][_0x691d('0x36')]));_0x503a2b['attributes']=_0x503a2b[_0x691d('0x37')]['length']?_0x503a2b[_0x691d('0x37')]:_0x346063[_0x691d('0x31')];if(!_0x19af08[_0x691d('0x32')]['hasOwnProperty'](_0x691d('0x38'))){_0x503a2b['limit']=qs[_0x691d('0x1d')](_0x19af08[_0x691d('0x32')][_0x691d('0x1d')]);_0x503a2b[_0x691d('0x1a')]=qs['offset'](_0x19af08[_0x691d('0x32')][_0x691d('0x1a')]);}_0x503a2b['order']=qs[_0x691d('0x39')](_0x19af08[_0x691d('0x32')][_0x691d('0x39')]);_0x503a2b[_0x691d('0x3a')]=qs['filters'](_[_0x691d('0x3b')](_0x19af08[_0x691d('0x32')],_0x346063['filters']),_0x4065ab);if(_0x19af08[_0x691d('0x32')][_0x691d('0x3c')]){_0x503a2b['where']=_[_0x691d('0x3d')](_0x503a2b[_0x691d('0x3a')],{'$or':_[_0x691d('0x2e')](_0x4065ab,function(_0xf7d5a3){if(_0xf7d5a3[_0x691d('0x3e')]!==_0x691d('0x3f')){var _0x17dd30={};_0x17dd30[_0xf7d5a3[_0x691d('0x2b')]]={'$like':'%'+_0x19af08[_0x691d('0x32')][_0x691d('0x3c')]+'%'};return _0x17dd30;}})});}_0x503a2b=_[_0x691d('0x3d')]({},_0x503a2b,_0x19af08[_0x691d('0x40')]);var _0xb80f8e={'where':_0x503a2b['where']};return db[_0x691d('0x41')][_0x691d('0x1c')](_0xb80f8e)[_0x691d('0x23')](function(_0x7c6072){_0x550894[_0x691d('0x1c')]=_0x7c6072;if(_0x19af08[_0x691d('0x32')][_0x691d('0x42')]){_0x503a2b[_0x691d('0x43')]=[{'all':!![]}];}return db[_0x691d('0x41')][_0x691d('0x44')](_0x503a2b);})[_0x691d('0x23')](function(_0x38016b){_0x550894[_0x691d('0x45')]=_0x38016b;return _0x550894;})[_0x691d('0x23')](respondWithFilteredResult(_0x29b3b9,_0x503a2b))[_0x691d('0x46')](handleError(_0x29b3b9,null));};exports['show']=function(_0x1af44c,_0x127f91){var _0x3756b4={'raw':!![],'where':{'id':_0x1af44c[_0x691d('0x47')]['id']}},_0x1a104c={};_0x1a104c[_0x691d('0x31')]=_[_0x691d('0x33')](db['Sound'][_0x691d('0x2f')]);_0x1a104c['query']=_[_0x691d('0x33')](_0x1af44c[_0x691d('0x32')]);_0x1a104c[_0x691d('0x34')]=_[_0x691d('0x35')](_0x1a104c['model'],_0x1a104c[_0x691d('0x32')]);_0x3756b4[_0x691d('0x37')]=_[_0x691d('0x35')](_0x1a104c[_0x691d('0x31')],qs[_0x691d('0x36')](_0x1af44c[_0x691d('0x32')]['fields']));_0x3756b4[_0x691d('0x37')]=_0x3756b4[_0x691d('0x37')][_0x691d('0x48')]?_0x3756b4[_0x691d('0x37')]:_0x1a104c[_0x691d('0x31')];if(_0x1af44c[_0x691d('0x32')][_0x691d('0x42')]){_0x3756b4[_0x691d('0x43')]=[{'all':!![]}];}_0x3756b4=_[_0x691d('0x3d')]({},_0x3756b4,_0x1af44c[_0x691d('0x40')]);return db['Sound'][_0x691d('0x49')](_0x3756b4)[_0x691d('0x23')](handleEntityNotFound(_0x127f91,null))[_0x691d('0x23')](respondWithResult(_0x127f91,null))[_0x691d('0x46')](handleError(_0x127f91,null));};exports[_0x691d('0x4a')]=function(_0x36bf64,_0x62eb06,_0x18e512){return db['Sound'][_0x691d('0x49')]({'where':{'id':_0x36bf64[_0x691d('0x47')]['id']},'attributes':[_0x691d('0x2b'),_0x691d('0x4b'),_0x691d('0x4c')],'raw':!![]})[_0x691d('0x23')](handleEntityNotFound(_0x62eb06,null))[_0x691d('0x23')](function(_0x3de052){if(_0x3de052){if(!fs[_0x691d('0x4d')](path[_0x691d('0x4e')](config[_0x691d('0x4f')],_0x691d('0x50'),_0x3de052[_0x691d('0x4b')]+'.'+_0x3de052[_0x691d('0x4c')]))){throw new db[(_0x691d('0x51'))]['ValidationError'](_0x691d('0x52'));}return _0x62eb06[_0x691d('0x4a')](path[_0x691d('0x4e')](config[_0x691d('0x4f')],'server/files/sounds/converted',util[_0x691d('0x53')]('%s.%s',_0x3de052['save_name'],_0x3de052['converted_format'])),util[_0x691d('0x53')](_0x691d('0x54'),_0x3de052['name'],_0x3de052['converted_format']));}return null;})[_0x691d('0x46')](handleError(_0x62eb06,null));};exports[_0x691d('0x55')]=function(_0x41671a,_0x45bee6,_0x24c5ba){var _0x4646b4={'name':path[_0x691d('0x56')](_0x41671a[_0x691d('0x57')][_0x691d('0x58')],path[_0x691d('0x59')](_0x41671a[_0x691d('0x57')][_0x691d('0x58')])),'save_name':path[_0x691d('0x56')](_0x41671a[_0x691d('0x57')][_0x691d('0x5a')],path[_0x691d('0x59')](_0x41671a[_0x691d('0x57')]['filename'])),'original_format':path['extname'](_0x41671a[_0x691d('0x57')]['originalname'])['substring'](0x1),'converted_format':_0x691d('0x5b')};var _0x5974bc=path['join'](config[_0x691d('0x4f')],_0x691d('0x5c'),_0x41671a['file'][_0x691d('0x5a')]);var _0x2f6305=path[_0x691d('0x4e')](config[_0x691d('0x4f')],_0x691d('0x50'),util['format'](_0x691d('0x54'),path['basename'](_0x41671a[_0x691d('0x57')][_0x691d('0x5a')],path[_0x691d('0x59')](_0x41671a[_0x691d('0x57')][_0x691d('0x5a')])),_0x4646b4[_0x691d('0x4c')]));logger[_0x691d('0x5d')](_0x691d('0x5e'),_0x5974bc);logger[_0x691d('0x5d')](_0x691d('0x5f'),_0x2f6305);try{fs['chmodSync'](_0x5974bc,parseInt('0777',0x8));var _0x85da70=sox[_0x691d('0x60')](_0x5974bc,_0x2f6305,{'sampleRate':0x1f40,'format':_0x691d('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x85da70['on']('error',function(_0x1481bb){fs[_0x691d('0x61')](_0x5974bc);_0x45bee6['status'](0x1f4)['send'](_0x1481bb);});_0x85da70['on']('src',function(_0x35783e){_0x4646b4['original_duration']=isNaN(_0x35783e[_0x691d('0x62')])?null:_0x35783e[_0x691d('0x62')]*0x3e8;_0x4646b4[_0x691d('0x63')]=isNaN(_0x35783e[_0x691d('0x64')])?null:_0x35783e[_0x691d('0x64')];_0x4646b4[_0x691d('0x65')]=isNaN(_0x35783e['channelCount'])?null:_0x35783e['channelCount'];_0x4646b4[_0x691d('0x66')]=isNaN(_0x35783e['bitRate'])?null:_0x35783e[_0x691d('0x67')];_0x4646b4[_0x691d('0x68')]=isNaN(_0x35783e[_0x691d('0x69')])?null:_0x35783e[_0x691d('0x69')];});_0x85da70['on'](_0x691d('0x6a'),function(_0x418f59){_0x4646b4[_0x691d('0x6b')]=isNaN(_0x418f59['duration'])?null:_0x418f59[_0x691d('0x62')]*0x3e8;_0x4646b4[_0x691d('0x6c')]=isNaN(_0x418f59[_0x691d('0x64')])?null:_0x418f59[_0x691d('0x64')];_0x4646b4[_0x691d('0x6d')]=isNaN(_0x418f59[_0x691d('0x6e')])?null:_0x418f59[_0x691d('0x6e')];_0x4646b4[_0x691d('0x6f')]=isNaN(_0x418f59[_0x691d('0x67')])?null:_0x418f59[_0x691d('0x67')];_0x4646b4[_0x691d('0x70')]=isNaN(_0x418f59[_0x691d('0x69')])?null:_0x418f59[_0x691d('0x69')];});_0x85da70['on']('end',function(){fs['chmodSync'](_0x2f6305,parseInt(_0x691d('0x71'),0x8));return db[_0x691d('0x41')][_0x691d('0x55')](_0x4646b4)[_0x691d('0x23')](function(_0x57ab26){var _0x30842d={'role':_0x41671a[_0x691d('0x72')]['role'],'userProfileId':_0x41671a[_0x691d('0x72')]['userProfileId']};if(!_0x30842d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30842d[_0x691d('0x73')]===_0x691d('0x74')){var _0x1afdef=_0x57ab26[_0x691d('0x25')]({'plain':!![]});return db[_0x691d('0x75')]['find']({'where':{'name':_0x691d('0x26'),'userProfileId':_0x30842d[_0x691d('0x76')]},'raw':!![]})[_0x691d('0x23')](function(_0x10f02b){if(_0x10f02b&&_0x10f02b[_0x691d('0x77')]===0x0){return db['UserProfileResource']['create']({'name':_0x1afdef[_0x691d('0x2b')],'resourceId':_0x1afdef['id'],'type':_0x10f02b['name'],'sectionId':_0x10f02b['id']},{})[_0x691d('0x23')](function(){return _0x57ab26;});}else{return _0x57ab26;}})['catch'](function(_0x11eab2){logger[_0x691d('0x29')](_0x691d('0x78'),_0x11eab2);throw _0x11eab2;});}return _0x57ab26;})['then'](respondWithResult(_0x45bee6,null))['catch'](handleError(_0x45bee6,null));});_0x85da70['start']();}catch(_0x4b8f4c){_0x45bee6[_0x691d('0x17')](0x1f4)[_0x691d('0x2c')](_0x4b8f4c);}};exports[_0x691d('0x22')]=function(_0x3b545b,_0x1cf908,_0x1a2ec2){return db['Sound'][_0x691d('0x49')]({'where':{'id':_0x3b545b[_0x691d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1cf908,null))[_0x691d('0x23')](saveUpdates(_[_0x691d('0x3b')](_0x3b545b['body'],['name',_0x691d('0x79')]),null))[_0x691d('0x23')](respondWithResult(_0x1cf908,null))[_0x691d('0x46')](handleError(_0x1cf908,null));};exports[_0x691d('0x7a')]=function(_0x501a0f,_0xa5f3e1,_0x13a875){return db[_0x691d('0x41')]['find']({'where':{'id':_0x501a0f['params']['id']}})[_0x691d('0x23')](function(_0x2a1a4b){if(_0x2a1a4b){return _0x2a1a4b['destroy']();}})[_0x691d('0x23')](function(_0x1ffc95){var _0xc87278=path[_0x691d('0x4e')](config[_0x691d('0x4f')],_0x691d('0x5c'),util[_0x691d('0x53')](_0x691d('0x54'),_0x1ffc95[_0x691d('0x4b')],_0x1ffc95[_0x691d('0x7b')]));var _0x168a6b=path[_0x691d('0x4e')](config[_0x691d('0x4f')],_0x691d('0x50'),util[_0x691d('0x53')](_0x691d('0x54'),_0x1ffc95[_0x691d('0x4b')],_0x1ffc95[_0x691d('0x4c')]));fs[_0x691d('0x61')](_0xc87278);fs[_0x691d('0x61')](_0x168a6b);return _0x1ffc95;})[_0x691d('0x23')](function(_0x307161){if(_0x307161){return _0xa5f3e1[_0x691d('0x17')](0xcc)[_0x691d('0x18')]();}})[_0x691d('0x23')](handleEntityNotFound(_0xa5f3e1,null))[_0x691d('0x46')](handleError(_0xa5f3e1,null));}; \ No newline at end of file +var _0xbbef=['../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','get','Sounds','UserProfileResource','error','name','send','map','Sound','rawAttributes','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','length','find','save_name','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','download','join','format','%s.%s','catch','create','basename','extname','file','originalname','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x373dcd,_0x4756e3){var _0x47113a=function(_0x5c1dfb){while(--_0x5c1dfb){_0x373dcd['push'](_0x373dcd['shift']());}};_0x47113a(++_0x4756e3);}(_0xbbef,0x1de));var _0xfbbe=function(_0x292a58,_0x2384c6){_0x292a58=_0x292a58-0x0;var _0x19f356=_0xbbef[_0x292a58];return _0x19f356;};'use strict';var emlformat=require(_0xfbbe('0x0'));var rimraf=require(_0xfbbe('0x1'));var zipdir=require(_0xfbbe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbbe('0x3'));var moment=require('moment');var BPromise=require(_0xfbbe('0x4'));var Mustache=require(_0xfbbe('0x5'));var util=require(_0xfbbe('0x6'));var path=require(_0xfbbe('0x7'));var sox=require(_0xfbbe('0x8'));var csv=require(_0xfbbe('0x9'));var ejs=require(_0xfbbe('0xa'));var fs=require('fs');var fs_extra=require(_0xfbbe('0xb'));var _=require(_0xfbbe('0xc'));var squel=require(_0xfbbe('0xd'));var crypto=require(_0xfbbe('0xe'));var jsforce=require(_0xfbbe('0xf'));var deskjs=require(_0xfbbe('0x10'));var toCsv=require(_0xfbbe('0x9'));var querystring=require(_0xfbbe('0x11'));var Papa=require(_0xfbbe('0x12'));var Redis=require('ioredis');var authService=require(_0xfbbe('0x13'));var qs=require(_0xfbbe('0x14'));var as=require(_0xfbbe('0x15'));var hardwareService=require(_0xfbbe('0x16'));var logger=require(_0xfbbe('0x17'))(_0xfbbe('0x18'));var utils=require(_0xfbbe('0x19'));var config=require(_0xfbbe('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbbe('0x1b'))['db'];function respondWithStatusCode(_0x366d7c,_0x496e20){_0x496e20=_0x496e20||0xcc;return function(_0x2ea3f3){if(_0x2ea3f3){return _0x366d7c[_0xfbbe('0x1c')](_0x496e20);}return _0x366d7c['status'](_0x496e20)[_0xfbbe('0x1d')]();};}function respondWithResult(_0x4feed8,_0x1dc88f){_0x1dc88f=_0x1dc88f||0xc8;return function(_0x3cbc46){if(_0x3cbc46){return _0x4feed8[_0xfbbe('0x1e')](_0x1dc88f)[_0xfbbe('0x1f')](_0x3cbc46);}};}function respondWithFilteredResult(_0x37d036,_0x1abc89){return function(_0xfde1ba){if(_0xfde1ba){var _0x5c076c=typeof _0x1abc89[_0xfbbe('0x20')]===_0xfbbe('0x21')&&typeof _0x1abc89[_0xfbbe('0x22')]==='undefined';var _0x19b487=_0xfde1ba['count'];var _0x21d2b6=_0x5c076c?0x0:_0x1abc89[_0xfbbe('0x20')];var _0x26c487=_0x5c076c?_0xfde1ba[_0xfbbe('0x23')]:_0x1abc89[_0xfbbe('0x20')]+_0x1abc89['limit'];var _0x3800a6;if(_0x26c487>=_0x19b487){_0x26c487=_0x19b487;_0x3800a6=0xc8;}else{_0x3800a6=0xce;}_0x37d036[_0xfbbe('0x1e')](_0x3800a6);return _0x37d036['set'](_0xfbbe('0x24'),_0x21d2b6+'-'+_0x26c487+'/'+_0x19b487)[_0xfbbe('0x1f')](_0xfde1ba);}return null;};}function patchUpdates(_0x599de0){return function(_0x37fb1b){try{jsonpatch['apply'](_0x37fb1b,_0x599de0,!![]);}catch(_0x1d5439){return BPromise['reject'](_0x1d5439);}return _0x37fb1b[_0xfbbe('0x25')]();};}function saveUpdates(_0x4df98a,_0x35147f){return function(_0x5989ad){if(_0x5989ad){return _0x5989ad[_0xfbbe('0x26')](_0x4df98a)['then'](function(_0x253d21){return _0x253d21;});}return null;};}function removeEntity(_0x1a7bac,_0x25c5e9){return function(_0x1471a8){if(_0x1471a8){return _0x1471a8[_0xfbbe('0x27')]()[_0xfbbe('0x28')](function(){var _0x1db440=_0x1471a8[_0xfbbe('0x29')]({'plain':!![]});var _0x115376=_0xfbbe('0x2a');return db[_0xfbbe('0x2b')]['destroy']({'where':{'type':_0x115376,'resourceId':_0x1db440['id']}})[_0xfbbe('0x28')](function(){return _0x1471a8;});})[_0xfbbe('0x28')](function(){_0x1a7bac[_0xfbbe('0x1e')](0xcc)[_0xfbbe('0x1d')]();});}};}function handleEntityNotFound(_0x12909c,_0x592f45){return function(_0x557843){if(!_0x557843){_0x12909c[_0xfbbe('0x1c')](0x194);}return _0x557843;};}function handleError(_0x4e1ea9,_0x3b9566){_0x3b9566=_0x3b9566||0x1f4;return function(_0x365a69){logger[_0xfbbe('0x2c')](_0x365a69['stack']);if(_0x365a69[_0xfbbe('0x2d')]){delete _0x365a69[_0xfbbe('0x2d')];}_0x4e1ea9['status'](_0x3b9566)[_0xfbbe('0x2e')](_0x365a69);};}exports['index']=function(_0x43aa09,_0x7d8a19){var _0x206900={},_0x2c280b={},_0x2586cc={'count':0x0,'rows':[]};var _0x31d6c6=_[_0xfbbe('0x2f')](db[_0xfbbe('0x30')][_0xfbbe('0x31')],function(_0x3316cf){return{'name':_0x3316cf['fieldName'],'type':_0x3316cf[_0xfbbe('0x32')][_0xfbbe('0x33')]};});_0x2c280b[_0xfbbe('0x34')]=_[_0xfbbe('0x2f')](_0x31d6c6,_0xfbbe('0x2d'));_0x2c280b[_0xfbbe('0x35')]=_[_0xfbbe('0x36')](_0x43aa09[_0xfbbe('0x35')]);_0x2c280b[_0xfbbe('0x37')]=_['intersection'](_0x2c280b['model'],_0x2c280b[_0xfbbe('0x35')]);_0x206900[_0xfbbe('0x38')]=_['intersection'](_0x2c280b[_0xfbbe('0x34')],qs[_0xfbbe('0x39')](_0x43aa09[_0xfbbe('0x35')][_0xfbbe('0x39')]));_0x206900[_0xfbbe('0x38')]=_0x206900['attributes']['length']?_0x206900[_0xfbbe('0x38')]:_0x2c280b['model'];if(!_0x43aa09['query'][_0xfbbe('0x3a')](_0xfbbe('0x3b'))){_0x206900[_0xfbbe('0x22')]=qs[_0xfbbe('0x22')](_0x43aa09[_0xfbbe('0x35')][_0xfbbe('0x22')]);_0x206900[_0xfbbe('0x20')]=qs['offset'](_0x43aa09[_0xfbbe('0x35')][_0xfbbe('0x20')]);}_0x206900['order']=qs[_0xfbbe('0x3c')](_0x43aa09['query']['sort']);_0x206900[_0xfbbe('0x3d')]=qs['filters'](_[_0xfbbe('0x3e')](_0x43aa09['query'],_0x2c280b[_0xfbbe('0x37')]),_0x31d6c6);if(_0x43aa09[_0xfbbe('0x35')][_0xfbbe('0x3f')]){_0x206900[_0xfbbe('0x3d')]=_[_0xfbbe('0x40')](_0x206900[_0xfbbe('0x3d')],{'$or':_[_0xfbbe('0x2f')](_0x31d6c6,function(_0xb4faec){if(_0xb4faec[_0xfbbe('0x32')]!==_0xfbbe('0x41')){var _0x53a019={};_0x53a019[_0xb4faec['name']]={'$like':'%'+_0x43aa09['query'][_0xfbbe('0x3f')]+'%'};return _0x53a019;}})});}_0x206900=_['merge']({},_0x206900,_0x43aa09[_0xfbbe('0x42')]);var _0x3857e5={'where':_0x206900[_0xfbbe('0x3d')]};return db['Sound']['count'](_0x3857e5)[_0xfbbe('0x28')](function(_0x2ba233){_0x2586cc[_0xfbbe('0x23')]=_0x2ba233;if(_0x43aa09[_0xfbbe('0x35')][_0xfbbe('0x43')]){_0x206900[_0xfbbe('0x44')]=[{'all':!![]}];}return db['Sound'][_0xfbbe('0x45')](_0x206900);})['then'](function(_0x1922a2){_0x2586cc[_0xfbbe('0x46')]=_0x1922a2;return _0x2586cc;})[_0xfbbe('0x28')](respondWithFilteredResult(_0x7d8a19,_0x206900))['catch'](handleError(_0x7d8a19,null));};exports[_0xfbbe('0x47')]=function(_0x48166d,_0x185bd1){var _0x4d4b25={'raw':!![],'where':{'id':_0x48166d[_0xfbbe('0x48')]['id']}},_0x26db64={};_0x26db64[_0xfbbe('0x34')]=_['keys'](db[_0xfbbe('0x30')]['rawAttributes']);_0x26db64[_0xfbbe('0x35')]=_[_0xfbbe('0x36')](_0x48166d['query']);_0x26db64[_0xfbbe('0x37')]=_[_0xfbbe('0x49')](_0x26db64[_0xfbbe('0x34')],_0x26db64[_0xfbbe('0x35')]);_0x4d4b25[_0xfbbe('0x38')]=_['intersection'](_0x26db64[_0xfbbe('0x34')],qs['fields'](_0x48166d[_0xfbbe('0x35')][_0xfbbe('0x39')]));_0x4d4b25[_0xfbbe('0x38')]=_0x4d4b25[_0xfbbe('0x38')][_0xfbbe('0x4a')]?_0x4d4b25[_0xfbbe('0x38')]:_0x26db64['model'];if(_0x48166d['query'][_0xfbbe('0x43')]){_0x4d4b25[_0xfbbe('0x44')]=[{'all':!![]}];}_0x4d4b25=_['merge']({},_0x4d4b25,_0x48166d['options']);return db[_0xfbbe('0x30')]['find'](_0x4d4b25)['then'](handleEntityNotFound(_0x185bd1,null))['then'](respondWithResult(_0x185bd1,null))['catch'](handleError(_0x185bd1,null));};exports['download']=function(_0x3df323,_0x159dfe,_0x4ef839){return db[_0xfbbe('0x30')][_0xfbbe('0x4b')]({'where':{'id':_0x3df323[_0xfbbe('0x48')]['id']},'attributes':[_0xfbbe('0x2d'),_0xfbbe('0x4c'),'converted_format'],'raw':!![]})[_0xfbbe('0x28')](handleEntityNotFound(_0x159dfe,null))[_0xfbbe('0x28')](function(_0x45e75e){if(_0x45e75e){if(!fs[_0xfbbe('0x4d')](path['join'](config[_0xfbbe('0x4e')],_0xfbbe('0x4f'),_0x45e75e[_0xfbbe('0x4c')]+'.'+_0x45e75e['converted_format']))){throw new db[(_0xfbbe('0x50'))][(_0xfbbe('0x51'))]('Sound\x20not\x20found');}return _0x159dfe[_0xfbbe('0x52')](path[_0xfbbe('0x53')](config[_0xfbbe('0x4e')],_0xfbbe('0x4f'),util[_0xfbbe('0x54')](_0xfbbe('0x55'),_0x45e75e[_0xfbbe('0x4c')],_0x45e75e['converted_format'])),util[_0xfbbe('0x54')](_0xfbbe('0x55'),_0x45e75e[_0xfbbe('0x2d')],_0x45e75e['converted_format']));}return null;})[_0xfbbe('0x56')](handleError(_0x159dfe,null));};exports[_0xfbbe('0x57')]=function(_0xa518cc,_0x352513,_0x250cb4){var _0x3e65b2={'name':path[_0xfbbe('0x58')](_0xa518cc['file']['originalname'],path[_0xfbbe('0x59')](_0xa518cc[_0xfbbe('0x5a')][_0xfbbe('0x5b')])),'save_name':path[_0xfbbe('0x58')](_0xa518cc['file']['filename'],path[_0xfbbe('0x59')](_0xa518cc[_0xfbbe('0x5a')]['filename'])),'original_format':path['extname'](_0xa518cc[_0xfbbe('0x5a')]['originalname'])['substring'](0x1),'converted_format':_0xfbbe('0x5c')};var _0x120493=path[_0xfbbe('0x53')](config[_0xfbbe('0x4e')],_0xfbbe('0x5d'),_0xa518cc['file'][_0xfbbe('0x5e')]);var _0x29984b=path[_0xfbbe('0x53')](config[_0xfbbe('0x4e')],_0xfbbe('0x4f'),util[_0xfbbe('0x54')](_0xfbbe('0x55'),path[_0xfbbe('0x58')](_0xa518cc[_0xfbbe('0x5a')][_0xfbbe('0x5e')],path[_0xfbbe('0x59')](_0xa518cc[_0xfbbe('0x5a')][_0xfbbe('0x5e')])),_0x3e65b2['converted_format']));logger[_0xfbbe('0x5f')](_0xfbbe('0x60'),_0x120493);logger[_0xfbbe('0x5f')](_0xfbbe('0x61'),_0x29984b);try{fs[_0xfbbe('0x62')](_0x120493,parseInt('0777',0x8));var _0x5367cb=sox[_0xfbbe('0x63')](_0x120493,_0x29984b,{'sampleRate':0x1f40,'format':_0xfbbe('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5367cb['on']('error',function(_0x1ca3e2){fs['unlinkSync'](_0x120493);_0x352513['status'](0x1f4)[_0xfbbe('0x2e')](_0x1ca3e2);});_0x5367cb['on'](_0xfbbe('0x64'),function(_0x13d837){_0x3e65b2[_0xfbbe('0x65')]=isNaN(_0x13d837[_0xfbbe('0x66')])?null:_0x13d837[_0xfbbe('0x66')]*0x3e8;_0x3e65b2[_0xfbbe('0x67')]=isNaN(_0x13d837[_0xfbbe('0x68')])?null:_0x13d837[_0xfbbe('0x68')];_0x3e65b2[_0xfbbe('0x69')]=isNaN(_0x13d837[_0xfbbe('0x6a')])?null:_0x13d837[_0xfbbe('0x6a')];_0x3e65b2[_0xfbbe('0x6b')]=isNaN(_0x13d837[_0xfbbe('0x6c')])?null:_0x13d837[_0xfbbe('0x6c')];_0x3e65b2['original_sampleRate']=isNaN(_0x13d837['sampleRate'])?null:_0x13d837[_0xfbbe('0x6d')];});_0x5367cb['on']('dest',function(_0x8763cc){_0x3e65b2[_0xfbbe('0x6e')]=isNaN(_0x8763cc[_0xfbbe('0x66')])?null:_0x8763cc[_0xfbbe('0x66')]*0x3e8;_0x3e65b2[_0xfbbe('0x6f')]=isNaN(_0x8763cc[_0xfbbe('0x68')])?null:_0x8763cc[_0xfbbe('0x68')];_0x3e65b2['converted_channelCount']=isNaN(_0x8763cc[_0xfbbe('0x6a')])?null:_0x8763cc[_0xfbbe('0x6a')];_0x3e65b2[_0xfbbe('0x70')]=isNaN(_0x8763cc[_0xfbbe('0x6c')])?null:_0x8763cc[_0xfbbe('0x6c')];_0x3e65b2[_0xfbbe('0x71')]=isNaN(_0x8763cc[_0xfbbe('0x6d')])?null:_0x8763cc['sampleRate'];});_0x5367cb['on'](_0xfbbe('0x1d'),function(){fs[_0xfbbe('0x62')](_0x29984b,parseInt(_0xfbbe('0x72'),0x8));return db['Sound']['create'](_0x3e65b2)[_0xfbbe('0x28')](function(_0x3dacc3){var _0x100fc4={'role':_0xa518cc[_0xfbbe('0x73')][_0xfbbe('0x74')],'userProfileId':_0xa518cc[_0xfbbe('0x73')][_0xfbbe('0x75')]};if(!_0x100fc4)throw new Error(_0xfbbe('0x76'));if(_0x100fc4[_0xfbbe('0x74')]===_0xfbbe('0x77')){var _0x4e0ad1=_0x3dacc3[_0xfbbe('0x29')]({'plain':!![]});return db[_0xfbbe('0x78')][_0xfbbe('0x4b')]({'where':{'name':_0xfbbe('0x2a'),'userProfileId':_0x100fc4['userProfileId']},'raw':!![]})[_0xfbbe('0x28')](function(_0x50d999){if(_0x50d999&&_0x50d999[_0xfbbe('0x79')]===0x0){return db[_0xfbbe('0x2b')][_0xfbbe('0x57')]({'name':_0x4e0ad1[_0xfbbe('0x2d')],'resourceId':_0x4e0ad1['id'],'type':_0x50d999[_0xfbbe('0x2d')],'sectionId':_0x50d999['id']},{})[_0xfbbe('0x28')](function(){return _0x3dacc3;});}else{return _0x3dacc3;}})[_0xfbbe('0x56')](function(_0x6286ba){logger[_0xfbbe('0x2c')](_0xfbbe('0x7a'),_0x6286ba);throw _0x6286ba;});}return _0x3dacc3;})[_0xfbbe('0x28')](respondWithResult(_0x352513,null))[_0xfbbe('0x56')](handleError(_0x352513,null));});_0x5367cb['start']();}catch(_0x75c193){_0x352513[_0xfbbe('0x1e')](0x1f4)[_0xfbbe('0x2e')](_0x75c193);}};exports['update']=function(_0x2aade8,_0x2ffebc,_0x44dcbc){return db['Sound']['find']({'where':{'id':_0x2aade8[_0xfbbe('0x48')]['id']}})[_0xfbbe('0x28')](handleEntityNotFound(_0x2ffebc,null))['then'](saveUpdates(_['pick'](_0x2aade8['body'],['name',_0xfbbe('0x7b')]),null))[_0xfbbe('0x28')](respondWithResult(_0x2ffebc,null))['catch'](handleError(_0x2ffebc,null));};exports[_0xfbbe('0x7c')]=function(_0x333810,_0x13ebfa,_0x47ce24){return db[_0xfbbe('0x30')][_0xfbbe('0x4b')]({'where':{'id':_0x333810['params']['id']}})['then'](function(_0x5742e8){if(_0x5742e8){return _0x5742e8[_0xfbbe('0x27')]();}})[_0xfbbe('0x28')](function(_0xf59c3c){var _0x468901=path['join'](config[_0xfbbe('0x4e')],_0xfbbe('0x5d'),util[_0xfbbe('0x54')](_0xfbbe('0x55'),_0xf59c3c['save_name'],_0xf59c3c['original_format']));var _0x212d86=path[_0xfbbe('0x53')](config[_0xfbbe('0x4e')],_0xfbbe('0x4f'),util['format'](_0xfbbe('0x55'),_0xf59c3c[_0xfbbe('0x4c')],_0xf59c3c['converted_format']));fs[_0xfbbe('0x7d')](_0x468901);fs[_0xfbbe('0x7d')](_0x212d86);return _0xf59c3c;})[_0xfbbe('0x28')](function(_0x3763dc){if(_0x3763dc){return _0x13ebfa[_0xfbbe('0x1e')](0xcc)[_0xfbbe('0x1d')]();}})[_0xfbbe('0x28')](handleEntityNotFound(_0x13ebfa,null))[_0xfbbe('0x56')](handleError(_0x13ebfa,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 4469366..4915519 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 _0x1c03=['request-promise','rimraf','../../config/environment','exports','define','Sound','lodash','util','api','moment','bluebird'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x1c03,0x19d));var _0x31c0=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x1c03[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x31c0('0x0'));var util=require(_0x31c0('0x1'));var logger=require('../../config/logger')(_0x31c0('0x2'));var moment=require(_0x31c0('0x3'));var BPromise=require(_0x31c0('0x4'));var rp=require(_0x31c0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31c0('0x6'));var config=require(_0x31c0('0x7'));var attributes=require('./sound.attributes');module[_0x31c0('0x8')]=function(_0x1ed7a1,_0x2024d3){return _0x1ed7a1[_0x31c0('0x9')](_0x31c0('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e23=['rimraf','../../config/environment','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e23,0xba));var _0x38e2=function(_0x32e504,_0x337f17){_0x32e504=_0x32e504-0x0;var _0x273ede=_0x8e23[_0x32e504];return _0x273ede;};'use strict';var _=require(_0x38e2('0x0'));var util=require(_0x38e2('0x1'));var logger=require(_0x38e2('0x2'))(_0x38e2('0x3'));var moment=require('moment');var BPromise=require(_0x38e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38e2('0x5'));var rimraf=require(_0x38e2('0x6'));var config=require(_0x38e2('0x7'));var attributes=require('./sound.attributes');module[_0x38e2('0x8')]=function(_0x292f3d,_0x3c5bf2){return _0x292f3d[_0x38e2('0x9')](_0x38e2('0xa'),attributes,{'tableName':_0x38e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 768c094..9577adf 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 _0x5d3b=['jayson/promise','client','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','message','result','ShowSound','find','options','where','map','include','model','attributes','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5d4070,_0x2f0d87){var _0xfadfa8=function(_0x295d71){while(--_0x295d71){_0x5d4070['push'](_0x5d4070['shift']());}};_0xfadfa8(++_0x2f0d87);}(_0x5d3b,0x189));var _0xb5d3=function(_0x297390,_0x4cba9c){_0x297390=_0x297390-0x0;var _0x4d7ffe=_0x5d3b[_0x297390];return _0x4d7ffe;};'use strict';var _=require(_0xb5d3('0x0'));var util=require(_0xb5d3('0x1'));var moment=require(_0xb5d3('0x2'));var BPromise=require(_0xb5d3('0x3'));var rs=require(_0xb5d3('0x4'));var fs=require('fs');var Redis=require(_0xb5d3('0x5'));var db=require(_0xb5d3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5d3('0x7'))(_0xb5d3('0x8'));var config=require(_0xb5d3('0x9'));var jayson=require(_0xb5d3('0xa'));var client=jayson[_0xb5d3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20d105,_0x4dfca9,_0x4bba20){return new BPromise(function(_0x29538a,_0x387f14){return client['request'](_0x20d105,_0x4bba20)[_0xb5d3('0xc')](function(_0xc688df){logger[_0xb5d3('0xd')](_0xb5d3('0xe'),_0x4dfca9,_0xb5d3('0xf'));logger[_0xb5d3('0x10')](_0xb5d3('0x11'),_0x4dfca9,_0xb5d3('0xf'),JSON['stringify'](_0xc688df));if(_0xc688df[_0xb5d3('0x12')]){if(_0xc688df[_0xb5d3('0x12')]['code']===0x1f4){logger[_0xb5d3('0x12')](_0xb5d3('0xe'),_0x4dfca9,_0xc688df['error'][_0xb5d3('0x13')]);return _0x387f14(_0xc688df[_0xb5d3('0x12')][_0xb5d3('0x13')]);}logger[_0xb5d3('0x12')](_0xb5d3('0xe'),_0x4dfca9,_0xc688df[_0xb5d3('0x12')][_0xb5d3('0x13')]);return _0x29538a(_0xc688df[_0xb5d3('0x12')][_0xb5d3('0x13')]);}else{logger[_0xb5d3('0xd')](_0xb5d3('0xe'),_0x4dfca9,_0xb5d3('0xf'));_0x29538a(_0xc688df[_0xb5d3('0x14')]['message']);}})['catch'](function(_0x289f2a){logger[_0xb5d3('0x12')](_0xb5d3('0xe'),_0x4dfca9,_0x289f2a);_0x387f14(_0x289f2a);});});}exports[_0xb5d3('0x15')]=function(_0xc43d8a){var _0x4c15d2=this;return new Promise(function(_0x52f569,_0x516495){return db['Sound'][_0xb5d3('0x16')]({'raw':_0xc43d8a[_0xb5d3('0x17')]?_0xc43d8a['options']['raw']===undefined?!![]:![]:!![],'where':_0xc43d8a['options']?_0xc43d8a[_0xb5d3('0x17')][_0xb5d3('0x18')]||null:null,'attributes':_0xc43d8a[_0xb5d3('0x17')]?_0xc43d8a[_0xb5d3('0x17')]['attributes']||null:null,'include':_0xc43d8a[_0xb5d3('0x17')]?_0xc43d8a['options']['include']?_[_0xb5d3('0x19')](_0xc43d8a[_0xb5d3('0x17')][_0xb5d3('0x1a')],function(_0x5ae424){return{'model':db[_0x5ae424[_0xb5d3('0x1b')]],'as':_0x5ae424['as'],'attributes':_0x5ae424[_0xb5d3('0x1c')],'include':_0x5ae424[_0xb5d3('0x1a')]?_[_0xb5d3('0x19')](_0x5ae424['include'],function(_0xdd23ea){return{'model':db[_0xdd23ea['model']],'as':_0xdd23ea['as'],'attributes':_0xdd23ea[_0xb5d3('0x1c')],'include':_0xdd23ea['include']?_['map'](_0xdd23ea[_0xb5d3('0x1a')],function(_0x1bf6e7){return{'model':db[_0x1bf6e7['model']],'as':_0x1bf6e7['as'],'attributes':_0x1bf6e7[_0xb5d3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb5d3('0xc')](function(_0x4fdd50){logger['info']('ShowSound',_0xc43d8a);logger[_0xb5d3('0x10')](_0xb5d3('0x15'),_0xc43d8a,JSON[_0xb5d3('0x1d')](_0x4fdd50));_0x52f569(_0x4fdd50);})[_0xb5d3('0x1e')](function(_0x38f05c){logger[_0xb5d3('0x12')](_0xb5d3('0x15'),_0x38f05c[_0xb5d3('0x13')],_0xc43d8a);_0x516495(_0x4c15d2[_0xb5d3('0x12')](0x1f4,_0x38f05c[_0xb5d3('0x13')]));});});}; \ No newline at end of file +var _0x0926=['ShowSound','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Sound','options','raw','where','include','map','model','attributes'];(function(_0x3437d3,_0x5898d6){var _0x398818=function(_0x1bb53f){while(--_0x1bb53f){_0x3437d3['push'](_0x3437d3['shift']());}};_0x398818(++_0x5898d6);}(_0x0926,0x135));var _0x6092=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x0926[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0x6092('0x0'));var moment=require(_0x6092('0x1'));var BPromise=require(_0x6092('0x2'));var rs=require(_0x6092('0x3'));var fs=require('fs');var Redis=require(_0x6092('0x4'));var db=require(_0x6092('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6092('0x6'));var jayson=require(_0x6092('0x7'));var client=jayson['client'][_0x6092('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5418bb,_0x5159d7,_0x37172a){return new BPromise(function(_0x2a8c22,_0x303a0d){return client['request'](_0x5418bb,_0x37172a)[_0x6092('0x9')](function(_0x4f3aa4){logger[_0x6092('0xa')](_0x6092('0xb'),_0x5159d7,_0x6092('0xc'));logger[_0x6092('0xd')](_0x6092('0xe'),_0x5159d7,_0x6092('0xc'),JSON[_0x6092('0xf')](_0x4f3aa4));if(_0x4f3aa4[_0x6092('0x10')]){if(_0x4f3aa4[_0x6092('0x10')][_0x6092('0x11')]===0x1f4){logger[_0x6092('0x10')](_0x6092('0xb'),_0x5159d7,_0x4f3aa4[_0x6092('0x10')]['message']);return _0x303a0d(_0x4f3aa4[_0x6092('0x10')][_0x6092('0x12')]);}logger['error'](_0x6092('0xb'),_0x5159d7,_0x4f3aa4[_0x6092('0x10')]['message']);return _0x2a8c22(_0x4f3aa4[_0x6092('0x10')][_0x6092('0x12')]);}else{logger[_0x6092('0xa')]('Sound,\x20%s,\x20%s',_0x5159d7,_0x6092('0xc'));_0x2a8c22(_0x4f3aa4['result'][_0x6092('0x12')]);}})['catch'](function(_0x1c9831){logger[_0x6092('0x10')](_0x6092('0xb'),_0x5159d7,_0x1c9831);_0x303a0d(_0x1c9831);});});}exports['ShowSound']=function(_0x1cda6c){var _0x221db2=this;return new Promise(function(_0x4c7172,_0x391eb2){return db[_0x6092('0x13')]['find']({'raw':_0x1cda6c[_0x6092('0x14')]?_0x1cda6c[_0x6092('0x14')][_0x6092('0x15')]===undefined?!![]:![]:!![],'where':_0x1cda6c[_0x6092('0x14')]?_0x1cda6c['options'][_0x6092('0x16')]||null:null,'attributes':_0x1cda6c[_0x6092('0x14')]?_0x1cda6c[_0x6092('0x14')]['attributes']||null:null,'include':_0x1cda6c[_0x6092('0x14')]?_0x1cda6c[_0x6092('0x14')][_0x6092('0x17')]?_[_0x6092('0x18')](_0x1cda6c[_0x6092('0x14')][_0x6092('0x17')],function(_0x5c2175){return{'model':db[_0x5c2175[_0x6092('0x19')]],'as':_0x5c2175['as'],'attributes':_0x5c2175[_0x6092('0x1a')],'include':_0x5c2175['include']?_[_0x6092('0x18')](_0x5c2175[_0x6092('0x17')],function(_0x25dd95){return{'model':db[_0x25dd95[_0x6092('0x19')]],'as':_0x25dd95['as'],'attributes':_0x25dd95['attributes'],'include':_0x25dd95['include']?_[_0x6092('0x18')](_0x25dd95[_0x6092('0x17')],function(_0x68cea6){return{'model':db[_0x68cea6[_0x6092('0x19')]],'as':_0x68cea6['as'],'attributes':_0x68cea6[_0x6092('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6092('0x9')](function(_0x254ac0){logger['info'](_0x6092('0x1b'),_0x1cda6c);logger[_0x6092('0xd')](_0x6092('0x1b'),_0x1cda6c,JSON['stringify'](_0x254ac0));_0x4c7172(_0x254ac0);})['catch'](function(_0x11b163){logger[_0x6092('0x10')]('ShowSound',_0x11b163[_0x6092('0x12')],_0x1cda6c);_0x391eb2(_0x221db2[_0x6092('0x10')](0x1f4,_0x11b163['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index afc1203..4004c6c 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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x318a1a,_0x15a0d6){var _0x5c496a=function(_0x52cf81){while(--_0x52cf81){_0x318a1a['push'](_0x318a1a['shift']());}};_0x5c496a(++_0x15a0d6);}(_0x757a,0xde));var _0xa757=function(_0x1eebdd,_0x20187f){_0x1eebdd=_0x1eebdd-0x0;var _0x5412df=_0x757a[_0x1eebdd];return _0x5412df;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=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(_0xd31b48,_0x1f1aec){var _0xdb5d06=function(_0x5d44bc){while(--_0x5d44bc){_0xd31b48['push'](_0xd31b48['shift']());}};_0xdb5d06(++_0x1f1aec);}(_0xb10b,0x12a));var _0xbb10=function(_0x20025e,_0x44c8e1){_0x20025e=_0x20025e-0x0;var _0x4a5ac4=_0xb10b[_0x20025e];return _0x4a5ac4;};'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 21cde9e..d340ea1 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 _0x0d00=['medium','ENUM','out','sequelize','exports','TEXT'];(function(_0x44ff7d,_0x567067){var _0xb5505a=function(_0x158130){while(--_0x158130){_0x44ff7d['push'](_0x44ff7d['shift']());}};_0xb5505a(++_0x567067);}(_0x0d00,0xdb));var _0x00d0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0d00[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x00d0('0x0'));module[_0x00d0('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x00d0('0x2')](_0x00d0('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x00d0('0x4')]('in',_0x00d0('0x5')),'defaultValue':_0x00d0('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x00d0('0x2')]}}; \ No newline at end of file +var _0x6224=['exports','TEXT','medium','out','sequelize'];(function(_0x53b76e,_0x522f28){var _0x1ed6ca=function(_0x1b4dda){while(--_0x1b4dda){_0x53b76e['push'](_0x53b76e['shift']());}};_0x1ed6ca(++_0x522f28);}(_0x6224,0x1df));var _0x4622=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x6224[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require(_0x4622('0x0'));module[_0x4622('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x4622('0x2')](_0x4622('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4622('0x4')),'defaultValue':_0x4622('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4622('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index c70b82b..0ed1b0c 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 _0x023d=['map','SquareMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','body','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x023d,0x67));var _0xd023=function(_0x3c5878,_0x4c5058){_0x3c5878=_0x3c5878-0x0;var _0x49e8cf=_0x023d[_0x3c5878];return _0x49e8cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd023('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd023('0x1'));var rp=require(_0xd023('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd023('0x3'));var util=require('util');var path=require(_0xd023('0x4'));var sox=require(_0xd023('0x5'));var csv=require(_0xd023('0x6'));var ejs=require(_0xd023('0x7'));var fs=require('fs');var fs_extra=require(_0xd023('0x8'));var _=require(_0xd023('0x9'));var squel=require(_0xd023('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd023('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd023('0xc'));var Papa=require(_0xd023('0xd'));var Redis=require('ioredis');var authService=require(_0xd023('0xe'));var qs=require(_0xd023('0xf'));var as=require(_0xd023('0x10'));var hardwareService=require(_0xd023('0x11'));var logger=require(_0xd023('0x12'))(_0xd023('0x13'));var utils=require(_0xd023('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd023('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a0cb8,_0x426567){_0x426567=_0x426567||0xcc;return function(_0x3e9be1){if(_0x3e9be1){return _0x3a0cb8[_0xd023('0x16')](_0x426567);}return _0x3a0cb8['status'](_0x426567)['end']();};}function respondWithResult(_0x56a8bf,_0x32efb9){_0x32efb9=_0x32efb9||0xc8;return function(_0x49a76e){if(_0x49a76e){return _0x56a8bf[_0xd023('0x17')](_0x32efb9)[_0xd023('0x18')](_0x49a76e);}};}function respondWithFilteredResult(_0x551df1,_0x19f1ed){return function(_0x552c9e){if(_0x552c9e){var _0x43f2cf=typeof _0x19f1ed['offset']===_0xd023('0x19')&&typeof _0x19f1ed[_0xd023('0x1a')]===_0xd023('0x19');var _0x1b2974=_0x552c9e[_0xd023('0x1b')];var _0x372bcc=_0x43f2cf?0x0:_0x19f1ed[_0xd023('0x1c')];var _0x154daf=_0x43f2cf?_0x552c9e['count']:_0x19f1ed[_0xd023('0x1c')]+_0x19f1ed[_0xd023('0x1a')];var _0x3288dc;if(_0x154daf>=_0x1b2974){_0x154daf=_0x1b2974;_0x3288dc=0xc8;}else{_0x3288dc=0xce;}_0x551df1[_0xd023('0x17')](_0x3288dc);return _0x551df1[_0xd023('0x1d')](_0xd023('0x1e'),_0x372bcc+'-'+_0x154daf+'/'+_0x1b2974)[_0xd023('0x18')](_0x552c9e);}return null;};}function patchUpdates(_0x2694ce){return function(_0x58f3d8){try{jsonpatch[_0xd023('0x1f')](_0x58f3d8,_0x2694ce,!![]);}catch(_0x346927){return BPromise[_0xd023('0x20')](_0x346927);}return _0x58f3d8[_0xd023('0x21')]();};}function saveUpdates(_0x2a05d8,_0x5eda8b){return function(_0x44536c){if(_0x44536c){return _0x44536c['update'](_0x2a05d8)[_0xd023('0x22')](function(_0xc5d335){return _0xc5d335;});}return null;};}function removeEntity(_0xddafdd,_0x225731){return function(_0x3f05ce){if(_0x3f05ce){return _0x3f05ce[_0xd023('0x23')]()['then'](function(){_0xddafdd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd14642,_0x350adb){return function(_0x21fa1d){if(!_0x21fa1d){_0xd14642['sendStatus'](0x194);}return _0x21fa1d;};}function handleError(_0x35c6f2,_0x351d3a){_0x351d3a=_0x351d3a||0x1f4;return function(_0x31c0c0){logger[_0xd023('0x24')](_0x31c0c0[_0xd023('0x25')]);if(_0x31c0c0['name']){delete _0x31c0c0[_0xd023('0x26')];}_0x35c6f2[_0xd023('0x17')](_0x351d3a)[_0xd023('0x27')](_0x31c0c0);};}exports[_0xd023('0x28')]=function(_0x2155e4,_0x1ddabe){var _0x5b49ca={},_0x181a94={},_0x5bec1e={'count':0x0,'rows':[]};var _0xeba5d2=_[_0xd023('0x29')](db[_0xd023('0x2a')]['rawAttributes'],function(_0x277f2a){return{'name':_0x277f2a[_0xd023('0x2b')],'type':_0x277f2a[_0xd023('0x2c')][_0xd023('0x2d')]};});_0x181a94[_0xd023('0x2e')]=_[_0xd023('0x29')](_0xeba5d2,_0xd023('0x26'));_0x181a94['query']=_[_0xd023('0x2f')](_0x2155e4[_0xd023('0x30')]);_0x181a94[_0xd023('0x31')]=_[_0xd023('0x32')](_0x181a94[_0xd023('0x2e')],_0x181a94[_0xd023('0x30')]);_0x5b49ca[_0xd023('0x33')]=_[_0xd023('0x32')](_0x181a94[_0xd023('0x2e')],qs[_0xd023('0x34')](_0x2155e4['query'][_0xd023('0x34')]));_0x5b49ca['attributes']=_0x5b49ca[_0xd023('0x33')][_0xd023('0x35')]?_0x5b49ca['attributes']:_0x181a94[_0xd023('0x2e')];if(!_0x2155e4['query'][_0xd023('0x36')](_0xd023('0x37'))){_0x5b49ca[_0xd023('0x1a')]=qs['limit'](_0x2155e4['query'][_0xd023('0x1a')]);_0x5b49ca['offset']=qs[_0xd023('0x1c')](_0x2155e4['query'][_0xd023('0x1c')]);}_0x5b49ca['order']=qs[_0xd023('0x38')](_0x2155e4[_0xd023('0x30')]['sort']);_0x5b49ca[_0xd023('0x39')]=qs['filters'](_[_0xd023('0x3a')](_0x2155e4[_0xd023('0x30')],_0x181a94[_0xd023('0x31')]),_0xeba5d2);if(_0x2155e4['query'][_0xd023('0x3b')]){_0x5b49ca[_0xd023('0x39')]=_['merge'](_0x5b49ca[_0xd023('0x39')],{'$or':_[_0xd023('0x29')](_0xeba5d2,function(_0x173aba){if(_0x173aba[_0xd023('0x2c')]!=='VIRTUAL'){var _0x5d31de={};_0x5d31de[_0x173aba[_0xd023('0x26')]]={'$like':'%'+_0x2155e4[_0xd023('0x30')][_0xd023('0x3b')]+'%'};return _0x5d31de;}})});}_0x5b49ca=_[_0xd023('0x3c')]({},_0x5b49ca,_0x2155e4['options']);var _0x173dcd={'where':_0x5b49ca[_0xd023('0x39')]};return db[_0xd023('0x2a')][_0xd023('0x1b')](_0x173dcd)['then'](function(_0x5892d2){_0x5bec1e['count']=_0x5892d2;if(_0x2155e4['query'][_0xd023('0x3d')]){_0x5b49ca[_0xd023('0x3e')]=[{'all':!![]}];}return db[_0xd023('0x2a')][_0xd023('0x3f')](_0x5b49ca);})[_0xd023('0x22')](function(_0xf0b768){_0x5bec1e[_0xd023('0x40')]=_0xf0b768;return _0x5bec1e;})[_0xd023('0x22')](respondWithFilteredResult(_0x1ddabe,_0x5b49ca))['catch'](handleError(_0x1ddabe,null));};exports[_0xd023('0x41')]=function(_0x485985,_0x18c4a4){var _0x366aad={'raw':!![],'where':{'id':_0x485985[_0xd023('0x42')]['id']}},_0x45b304={};_0x45b304[_0xd023('0x2e')]=_['keys'](db[_0xd023('0x2a')][_0xd023('0x43')]);_0x45b304[_0xd023('0x30')]=_[_0xd023('0x2f')](_0x485985['query']);_0x45b304[_0xd023('0x31')]=_['intersection'](_0x45b304[_0xd023('0x2e')],_0x45b304[_0xd023('0x30')]);_0x366aad[_0xd023('0x33')]=_[_0xd023('0x32')](_0x45b304[_0xd023('0x2e')],qs[_0xd023('0x34')](_0x485985[_0xd023('0x30')][_0xd023('0x34')]));_0x366aad[_0xd023('0x33')]=_0x366aad['attributes'][_0xd023('0x35')]?_0x366aad[_0xd023('0x33')]:_0x45b304[_0xd023('0x2e')];if(_0x485985[_0xd023('0x30')][_0xd023('0x3d')]){_0x366aad[_0xd023('0x3e')]=[{'all':!![]}];}_0x366aad=_[_0xd023('0x3c')]({},_0x366aad,_0x485985[_0xd023('0x44')]);return db[_0xd023('0x2a')][_0xd023('0x45')](_0x366aad)['then'](handleEntityNotFound(_0x18c4a4,null))[_0xd023('0x22')](respondWithResult(_0x18c4a4,null))[_0xd023('0x46')](handleError(_0x18c4a4,null));};exports['create']=function(_0x5e4d8e,_0x3f18b7){return db[_0xd023('0x2a')]['create'](_0x5e4d8e['body'],{})[_0xd023('0x22')](respondWithResult(_0x3f18b7,0xc9))[_0xd023('0x46')](handleError(_0x3f18b7,null));};exports['update']=function(_0x258645,_0x5a84d2){if(_0x258645[_0xd023('0x47')]['id']){delete _0x258645[_0xd023('0x47')]['id'];}return db[_0xd023('0x2a')][_0xd023('0x45')]({'where':{'id':_0x258645[_0xd023('0x42')]['id']}})[_0xd023('0x22')](handleEntityNotFound(_0x5a84d2,null))['then'](saveUpdates(_0x258645['body'],null))[_0xd023('0x22')](respondWithResult(_0x5a84d2,null))['catch'](handleError(_0x5a84d2,null));};exports[_0xd023('0x23')]=function(_0x30f265,_0x481420){return db['SquareMessage'][_0xd023('0x45')]({'where':{'id':_0x30f265[_0xd023('0x42')]['id']}})['then'](handleEntityNotFound(_0x481420,null))[_0xd023('0x22')](removeEntity(_0x481420,null))[_0xd023('0x46')](handleError(_0x481420,null));}; \ No newline at end of file +var _0x6fba=['filters','pick','filter','where','VIRTUAL','merge','options','include','SquareMessage','findAll','show','includeAll','find','catch','create','body','update','params','destroy','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','sendStatus','stack','name','send','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x21c21a,_0x167fa3){var _0x2cc73c=function(_0x513b61){while(--_0x513b61){_0x21c21a['push'](_0x21c21a['shift']());}};_0x2cc73c(++_0x167fa3);}(_0x6fba,0x97));var _0xa6fb=function(_0x4e2ea2,_0x28aff7){_0x4e2ea2=_0x4e2ea2-0x0;var _0x171c09=_0x6fba[_0x4e2ea2];return _0x171c09;};'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('request-promise');var moment=require(_0xa6fb('0x0'));var BPromise=require(_0xa6fb('0x1'));var Mustache=require(_0xa6fb('0x2'));var util=require(_0xa6fb('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xa6fb('0x4'));var ejs=require(_0xa6fb('0x5'));var fs=require('fs');var fs_extra=require(_0xa6fb('0x6'));var _=require(_0xa6fb('0x7'));var squel=require(_0xa6fb('0x8'));var crypto=require(_0xa6fb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa6fb('0xa'));var toCsv=require(_0xa6fb('0x4'));var querystring=require(_0xa6fb('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa6fb('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xa6fb('0xd'));var hardwareService=require(_0xa6fb('0xe'));var logger=require(_0xa6fb('0xf'))(_0xa6fb('0x10'));var utils=require(_0xa6fb('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xa6fb('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x506125,_0x32b785){_0x32b785=_0x32b785||0xcc;return function(_0xd02423){if(_0xd02423){return _0x506125['sendStatus'](_0x32b785);}return _0x506125[_0xa6fb('0x13')](_0x32b785)[_0xa6fb('0x14')]();};}function respondWithResult(_0x28ef89,_0x268bdc){_0x268bdc=_0x268bdc||0xc8;return function(_0x3396ef){if(_0x3396ef){return _0x28ef89[_0xa6fb('0x13')](_0x268bdc)['json'](_0x3396ef);}};}function respondWithFilteredResult(_0x3228c6,_0x40bd8e){return function(_0x3e7208){if(_0x3e7208){var _0x26a6d1=typeof _0x40bd8e[_0xa6fb('0x15')]===_0xa6fb('0x16')&&typeof _0x40bd8e[_0xa6fb('0x17')]===_0xa6fb('0x16');var _0x173498=_0x3e7208['count'];var _0x4fa149=_0x26a6d1?0x0:_0x40bd8e[_0xa6fb('0x15')];var _0x1b4bbe=_0x26a6d1?_0x3e7208[_0xa6fb('0x18')]:_0x40bd8e[_0xa6fb('0x15')]+_0x40bd8e[_0xa6fb('0x17')];var _0x4c37dd;if(_0x1b4bbe>=_0x173498){_0x1b4bbe=_0x173498;_0x4c37dd=0xc8;}else{_0x4c37dd=0xce;}_0x3228c6[_0xa6fb('0x13')](_0x4c37dd);return _0x3228c6[_0xa6fb('0x19')](_0xa6fb('0x1a'),_0x4fa149+'-'+_0x1b4bbe+'/'+_0x173498)[_0xa6fb('0x1b')](_0x3e7208);}return null;};}function patchUpdates(_0x4d9514){return function(_0x1f06cf){try{jsonpatch[_0xa6fb('0x1c')](_0x1f06cf,_0x4d9514,!![]);}catch(_0x276fa4){return BPromise[_0xa6fb('0x1d')](_0x276fa4);}return _0x1f06cf['save']();};}function saveUpdates(_0x40d761,_0x36fbd5){return function(_0x7a324d){if(_0x7a324d){return _0x7a324d['update'](_0x40d761)[_0xa6fb('0x1e')](function(_0xf331b6){return _0xf331b6;});}return null;};}function removeEntity(_0xcd0ef8,_0x5533f9){return function(_0x4be3e9){if(_0x4be3e9){return _0x4be3e9['destroy']()[_0xa6fb('0x1e')](function(){_0xcd0ef8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26be24,_0x35aef6){return function(_0x5bbb08){if(!_0x5bbb08){_0x26be24[_0xa6fb('0x1f')](0x194);}return _0x5bbb08;};}function handleError(_0x3b2585,_0x19a7e2){_0x19a7e2=_0x19a7e2||0x1f4;return function(_0x1414b6){logger['error'](_0x1414b6[_0xa6fb('0x20')]);if(_0x1414b6[_0xa6fb('0x21')]){delete _0x1414b6[_0xa6fb('0x21')];}_0x3b2585[_0xa6fb('0x13')](_0x19a7e2)[_0xa6fb('0x22')](_0x1414b6);};}exports['index']=function(_0x209aef,_0x4f178e){var _0x18d8f8={},_0x178ec6={},_0x131ea5={'count':0x0,'rows':[]};var _0x11120c=_[_0xa6fb('0x23')](db['SquareMessage']['rawAttributes'],function(_0x11054d){return{'name':_0x11054d[_0xa6fb('0x24')],'type':_0x11054d[_0xa6fb('0x25')]['key']};});_0x178ec6[_0xa6fb('0x26')]=_['map'](_0x11120c,_0xa6fb('0x21'));_0x178ec6[_0xa6fb('0x27')]=_[_0xa6fb('0x28')](_0x209aef['query']);_0x178ec6['filters']=_[_0xa6fb('0x29')](_0x178ec6[_0xa6fb('0x26')],_0x178ec6['query']);_0x18d8f8[_0xa6fb('0x2a')]=_['intersection'](_0x178ec6[_0xa6fb('0x26')],qs[_0xa6fb('0x2b')](_0x209aef[_0xa6fb('0x27')][_0xa6fb('0x2b')]));_0x18d8f8['attributes']=_0x18d8f8['attributes'][_0xa6fb('0x2c')]?_0x18d8f8['attributes']:_0x178ec6[_0xa6fb('0x26')];if(!_0x209aef[_0xa6fb('0x27')][_0xa6fb('0x2d')](_0xa6fb('0x2e'))){_0x18d8f8[_0xa6fb('0x17')]=qs['limit'](_0x209aef[_0xa6fb('0x27')][_0xa6fb('0x17')]);_0x18d8f8[_0xa6fb('0x15')]=qs[_0xa6fb('0x15')](_0x209aef[_0xa6fb('0x27')][_0xa6fb('0x15')]);}_0x18d8f8['order']=qs['sort'](_0x209aef[_0xa6fb('0x27')]['sort']);_0x18d8f8['where']=qs[_0xa6fb('0x2f')](_[_0xa6fb('0x30')](_0x209aef[_0xa6fb('0x27')],_0x178ec6[_0xa6fb('0x2f')]),_0x11120c);if(_0x209aef['query'][_0xa6fb('0x31')]){_0x18d8f8[_0xa6fb('0x32')]=_['merge'](_0x18d8f8['where'],{'$or':_['map'](_0x11120c,function(_0x16473f){if(_0x16473f[_0xa6fb('0x25')]!==_0xa6fb('0x33')){var _0x23198d={};_0x23198d[_0x16473f[_0xa6fb('0x21')]]={'$like':'%'+_0x209aef[_0xa6fb('0x27')][_0xa6fb('0x31')]+'%'};return _0x23198d;}})});}_0x18d8f8=_[_0xa6fb('0x34')]({},_0x18d8f8,_0x209aef[_0xa6fb('0x35')]);var _0x4b32ef={'where':_0x18d8f8[_0xa6fb('0x32')]};return db['SquareMessage'][_0xa6fb('0x18')](_0x4b32ef)[_0xa6fb('0x1e')](function(_0x3a3e12){_0x131ea5[_0xa6fb('0x18')]=_0x3a3e12;if(_0x209aef[_0xa6fb('0x27')]['includeAll']){_0x18d8f8[_0xa6fb('0x36')]=[{'all':!![]}];}return db[_0xa6fb('0x37')][_0xa6fb('0x38')](_0x18d8f8);})[_0xa6fb('0x1e')](function(_0x1c339e){_0x131ea5['rows']=_0x1c339e;return _0x131ea5;})[_0xa6fb('0x1e')](respondWithFilteredResult(_0x4f178e,_0x18d8f8))['catch'](handleError(_0x4f178e,null));};exports[_0xa6fb('0x39')]=function(_0x357180,_0x2d9db4){var _0x2db059={'raw':!![],'where':{'id':_0x357180['params']['id']}},_0x38a3ab={};_0x38a3ab[_0xa6fb('0x26')]=_['keys'](db[_0xa6fb('0x37')]['rawAttributes']);_0x38a3ab[_0xa6fb('0x27')]=_['keys'](_0x357180['query']);_0x38a3ab['filters']=_[_0xa6fb('0x29')](_0x38a3ab['model'],_0x38a3ab['query']);_0x2db059[_0xa6fb('0x2a')]=_['intersection'](_0x38a3ab[_0xa6fb('0x26')],qs[_0xa6fb('0x2b')](_0x357180[_0xa6fb('0x27')][_0xa6fb('0x2b')]));_0x2db059['attributes']=_0x2db059[_0xa6fb('0x2a')]['length']?_0x2db059['attributes']:_0x38a3ab['model'];if(_0x357180[_0xa6fb('0x27')][_0xa6fb('0x3a')]){_0x2db059[_0xa6fb('0x36')]=[{'all':!![]}];}_0x2db059=_[_0xa6fb('0x34')]({},_0x2db059,_0x357180[_0xa6fb('0x35')]);return db[_0xa6fb('0x37')][_0xa6fb('0x3b')](_0x2db059)['then'](handleEntityNotFound(_0x2d9db4,null))[_0xa6fb('0x1e')](respondWithResult(_0x2d9db4,null))[_0xa6fb('0x3c')](handleError(_0x2d9db4,null));};exports[_0xa6fb('0x3d')]=function(_0x152115,_0x5dcfb0){return db[_0xa6fb('0x37')][_0xa6fb('0x3d')](_0x152115[_0xa6fb('0x3e')],{})[_0xa6fb('0x1e')](respondWithResult(_0x5dcfb0,0xc9))['catch'](handleError(_0x5dcfb0,null));};exports[_0xa6fb('0x3f')]=function(_0x7bcdcc,_0x25682a){if(_0x7bcdcc['body']['id']){delete _0x7bcdcc[_0xa6fb('0x3e')]['id'];}return db[_0xa6fb('0x37')]['find']({'where':{'id':_0x7bcdcc[_0xa6fb('0x40')]['id']}})[_0xa6fb('0x1e')](handleEntityNotFound(_0x25682a,null))[_0xa6fb('0x1e')](saveUpdates(_0x7bcdcc[_0xa6fb('0x3e')],null))[_0xa6fb('0x1e')](respondWithResult(_0x25682a,null))[_0xa6fb('0x3c')](handleError(_0x25682a,null));};exports[_0xa6fb('0x41')]=function(_0xf4b4b0,_0x23a44f){return db[_0xa6fb('0x37')]['find']({'where':{'id':_0xf4b4b0[_0xa6fb('0x40')]['id']}})['then'](handleEntityNotFound(_0x23a44f,null))[_0xa6fb('0x1e')](removeEntity(_0x23a44f,null))[_0xa6fb('0x3c')](handleError(_0x23a44f,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 614f0ff..b6d288f 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 _0x663e=['../../config/environment','define','SquareMessage','square_messages','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x663e,0x1d2));var _0xe663=function(_0x17c1e8,_0x580060){_0x17c1e8=_0x17c1e8-0x0;var _0x2d3eae=_0x663e[_0x17c1e8];return _0x2d3eae;};'use strict';var _=require('lodash');var util=require(_0xe663('0x0'));var logger=require('../../config/logger')(_0xe663('0x1'));var moment=require(_0xe663('0x2'));var BPromise=require(_0xe663('0x3'));var rp=require(_0xe663('0x4'));var fs=require('fs');var path=require(_0xe663('0x5'));var rimraf=require(_0xe663('0x6'));var config=require(_0xe663('0x7'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0xabf02e,_0x354af7){return _0xabf02e[_0xe663('0x8')](_0xe663('0x9'),attributes,{'tableName':_0xe663('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85a4=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x85a4,0x1ef));var _0x485a=function(_0x54bf26,_0x4d097a){_0x54bf26=_0x54bf26-0x0;var _0xa865b5=_0x85a4[_0x54bf26];return _0xa865b5;};'use strict';var _=require(_0x485a('0x0'));var util=require(_0x485a('0x1'));var logger=require(_0x485a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x485a('0x3'));var fs=require('fs');var path=require(_0x485a('0x4'));var rimraf=require(_0x485a('0x5'));var config=require(_0x485a('0x6'));var attributes=require(_0x485a('0x7'));module[_0x485a('0x8')]=function(_0x50501d,_0x321fe6){return _0x50501d['define'](_0x485a('0x9'),attributes,{'tableName':_0x485a('0xa'),'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 54965eb..131177d 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 _0xa40e=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','lodash','bluebird'];(function(_0x555337,_0x1559d1){var _0x49b217=function(_0x3cb634){while(--_0x3cb634){_0x555337['push'](_0x555337['shift']());}};_0x49b217(++_0x1559d1);}(_0xa40e,0xac));var _0xea40=function(_0x7a1686,_0x4e2946){_0x7a1686=_0x7a1686-0x0;var _0xa9c805=_0xa40e[_0x7a1686];return _0xa9c805;};'use strict';var _=require(_0xea40('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xea40('0x1'));var rs=require(_0xea40('0x2'));var fs=require('fs');var Redis=require(_0xea40('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xea40('0x4'));var logger=require(_0xea40('0x5'))(_0xea40('0x6'));var config=require(_0xea40('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xea40('0x8')][_0xea40('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ac755,_0x3f29a3,_0x3f7f4d){return new BPromise(function(_0x44f29e,_0x2fc771){return client[_0xea40('0xa')](_0x2ac755,_0x3f7f4d)['then'](function(_0x1997ee){logger[_0xea40('0xb')](_0xea40('0xc'),_0x3f29a3,_0xea40('0xd'));logger[_0xea40('0xe')](_0xea40('0xf'),_0x3f29a3,'request\x20sent',JSON[_0xea40('0x10')](_0x1997ee));if(_0x1997ee['error']){if(_0x1997ee[_0xea40('0x11')][_0xea40('0x12')]===0x1f4){logger[_0xea40('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3f29a3,_0x1997ee[_0xea40('0x11')]['message']);return _0x2fc771(_0x1997ee[_0xea40('0x11')][_0xea40('0x13')]);}logger['error'](_0xea40('0xc'),_0x3f29a3,_0x1997ee['error'][_0xea40('0x13')]);return _0x44f29e(_0x1997ee['error'][_0xea40('0x13')]);}else{logger[_0xea40('0xb')](_0xea40('0xc'),_0x3f29a3,'request\x20sent');_0x44f29e(_0x1997ee[_0xea40('0x14')][_0xea40('0x13')]);}})[_0xea40('0x15')](function(_0x32e76a){logger['error'](_0xea40('0xc'),_0x3f29a3,_0x32e76a);_0x2fc771(_0x32e76a);});});}exports[_0xea40('0x16')]=function(_0xf23489){var _0x19094f=this;return new Promise(function(_0x41b3ce,_0xf51053){return db[_0xea40('0x17')][_0xea40('0x18')](_0xf23489[_0xea40('0x19')],{'raw':_0xf23489[_0xea40('0x1a')]?_0xf23489['options'][_0xea40('0x1b')]===undefined?!![]:![]:!![]})[_0xea40('0x1c')](function(_0x4ef438){logger['info'](_0xea40('0x16'),_0xf23489);logger['debug'](_0xea40('0x16'),_0xf23489,JSON[_0xea40('0x10')](_0x4ef438));_0x41b3ce(_0x4ef438);})[_0xea40('0x15')](function(_0x3fc248){logger[_0xea40('0x11')]('CreateSquareMessage',_0x3fc248[_0xea40('0x13')],_0xf23489);_0xf51053(_0x19094f[_0xea40('0x11')](0x1f4,_0x3fc248[_0xea40('0x13')]));});});}; \ No newline at end of file +var _0x1f1b=['debug','stringify','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','error','message','CreateSquareMessage','raw'];(function(_0x187ea0,_0x2f7db0){var _0x2b09d3=function(_0xccc48d){while(--_0xccc48d){_0x187ea0['push'](_0x187ea0['shift']());}};_0x2b09d3(++_0x2f7db0);}(_0x1f1b,0x16b));var _0xb1f1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1f1b[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb1f1('0x0'));var util=require(_0xb1f1('0x1'));var moment=require(_0xb1f1('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1f1('0x4'))['db'];var utils=require(_0xb1f1('0x5'));var logger=require(_0xb1f1('0x6'))(_0xb1f1('0x7'));var config=require(_0xb1f1('0x8'));var jayson=require(_0xb1f1('0x9'));var client=jayson[_0xb1f1('0xa')][_0xb1f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4df4ac,_0x5a5456,_0xa75499){return new BPromise(function(_0x8053fe,_0x420da9){return client[_0xb1f1('0xc')](_0x4df4ac,_0xa75499)[_0xb1f1('0xd')](function(_0x28bb06){logger[_0xb1f1('0xe')](_0xb1f1('0xf'),_0x5a5456,_0xb1f1('0x10'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x5a5456,_0xb1f1('0x10'),JSON['stringify'](_0x28bb06));if(_0x28bb06[_0xb1f1('0x11')]){if(_0x28bb06[_0xb1f1('0x11')]['code']===0x1f4){logger['error'](_0xb1f1('0xf'),_0x5a5456,_0x28bb06[_0xb1f1('0x11')][_0xb1f1('0x12')]);return _0x420da9(_0x28bb06[_0xb1f1('0x11')][_0xb1f1('0x12')]);}logger['error'](_0xb1f1('0xf'),_0x5a5456,_0x28bb06[_0xb1f1('0x11')]['message']);return _0x8053fe(_0x28bb06['error'][_0xb1f1('0x12')]);}else{logger[_0xb1f1('0xe')]('SquareMessage,\x20%s,\x20%s',_0x5a5456,_0xb1f1('0x10'));_0x8053fe(_0x28bb06['result'][_0xb1f1('0x12')]);}})['catch'](function(_0x53c710){logger[_0xb1f1('0x11')](_0xb1f1('0xf'),_0x5a5456,_0x53c710);_0x420da9(_0x53c710);});});}exports[_0xb1f1('0x13')]=function(_0x46517e){var _0x594050=this;return new Promise(function(_0x23a015,_0x1b5b67){return db['SquareMessage']['create'](_0x46517e['body'],{'raw':_0x46517e['options']?_0x46517e['options'][_0xb1f1('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0xfa4f58){logger[_0xb1f1('0xe')](_0xb1f1('0x13'),_0x46517e);logger[_0xb1f1('0x15')](_0xb1f1('0x13'),_0x46517e,JSON[_0xb1f1('0x16')](_0xfa4f58));_0x23a015(_0xfa4f58);})[_0xb1f1('0x17')](function(_0x4c6caf){logger[_0xb1f1('0x11')](_0xb1f1('0x13'),_0x4c6caf['message'],_0x46517e);_0x1b5b67(_0x594050[_0xb1f1('0x11')](0x1f4,_0x4c6caf[_0xb1f1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index b5a0b48..622ccec 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 _0xdd98=['/:id','isAuthenticated','/:id/test','15s','test','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','index'];(function(_0x2c2e70,_0x4b87f3){var _0x563575=function(_0x136b66){while(--_0x136b66){_0x2c2e70['push'](_0x2c2e70['shift']());}};_0x563575(++_0x4b87f3);}(_0xdd98,0x129));var _0x8dd9=function(_0x2c7c52,_0x4740cb){_0x2c7c52=_0x2c7c52-0x0;var _0x55d2ea=_0xdd98[_0x2c7c52];return _0x55d2ea;};'use strict';var multer=require(_0x8dd9('0x0'));var util=require(_0x8dd9('0x1'));var path=require(_0x8dd9('0x2'));var timeout=require(_0x8dd9('0x3'));var express=require(_0x8dd9('0x4'));var router=express[_0x8dd9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8dd9('0x6'));var interaction=require(_0x8dd9('0x7'));var config=require('../../config/environment');var controller=require(_0x8dd9('0x8'));router[_0x8dd9('0x9')]('/',auth['isAuthenticated'](),controller[_0x8dd9('0xa')]);router[_0x8dd9('0x9')](_0x8dd9('0xb'),auth[_0x8dd9('0xc')](),controller['show']);router[_0x8dd9('0x9')](_0x8dd9('0xd'),auth['isAuthenticated'](),timeout(_0x8dd9('0xe')),controller[_0x8dd9('0xf')]);router[_0x8dd9('0x10')]('/',auth[_0x8dd9('0xc')](),controller[_0x8dd9('0x11')]);router[_0x8dd9('0x12')]('/:id',auth[_0x8dd9('0xc')](),controller[_0x8dd9('0x13')]);router['delete'](_0x8dd9('0xb'),auth[_0x8dd9('0xc')](),controller[_0x8dd9('0x14')]);module[_0x8dd9('0x15')]=router; \ No newline at end of file +var _0xf35c=['post','put','delete','/:id','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','show','test'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0xf35c,0xe2));var _0xcf35=function(_0x574f56,_0x24404f){_0x574f56=_0x574f56-0x0;var _0x2e8c7e=_0xf35c[_0x574f56];return _0x2e8c7e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcf35('0x0'));var timeout=require(_0xcf35('0x1'));var express=require(_0xcf35('0x2'));var router=express[_0xcf35('0x3')]();var fs_extra=require(_0xcf35('0x4'));var auth=require(_0xcf35('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcf35('0x6'));var controller=require(_0xcf35('0x7'));router[_0xcf35('0x8')]('/',auth[_0xcf35('0x9')](),controller['index']);router[_0xcf35('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xcf35('0xa')]);router['get']('/:id/test',auth['isAuthenticated'](),timeout('15s'),controller[_0xcf35('0xb')]);router[_0xcf35('0xc')]('/',auth[_0xcf35('0x9')](),controller['create']);router[_0xcf35('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcf35('0xe')](_0xcf35('0xf'),auth[_0xcf35('0x9')](),controller[_0xcf35('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 691707f..50066e5 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 _0x5ca1=['name','STRING','sequelize','exports'];(function(_0xee67d8,_0x2fb36a){var _0x469868=function(_0x3be510){while(--_0x3be510){_0xee67d8['push'](_0xee67d8['shift']());}};_0x469868(++_0x2fb36a);}(_0x5ca1,0x10a));var _0x15ca=function(_0x491e0b,_0x1d7904){_0x491e0b=_0x491e0b-0x0;var _0x50d5ae=_0x5ca1[_0x491e0b];return _0x50d5ae;};'use strict';var Sequelize=require(_0x15ca('0x0'));module[_0x15ca('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x15ca('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x15ca('0x3')]},'description':{'type':Sequelize[_0x15ca('0x3')]}}; \ No newline at end of file +var _0x5a70=['STRING','name','exports'];(function(_0x4983fa,_0x2ee08f){var _0x3ee59d=function(_0x3c1d97){while(--_0x3c1d97){_0x4983fa['push'](_0x4983fa['shift']());}};_0x3ee59d(++_0x2ee08f);}(_0x5a70,0x13d));var _0x05a7=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x5a70[_0x445101];return _0x3c3d04;};'use strict';var Sequelize=require('sequelize');module[_0x05a7('0x0')]={'name':{'type':Sequelize[_0x05a7('0x1')],'unique':_0x05a7('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x05a7('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f788917..1dfb45f 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 _0x6957=['get','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set','Content-Range','apply','reject','save','then','ODBC','UserProfileResource','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','params','include','find','catch','create','body'];(function(_0x583b14,_0x59fe86){var _0x8214dc=function(_0x5954a2){while(--_0x5954a2){_0x583b14['push'](_0x583b14['shift']());}};_0x8214dc(++_0x59fe86);}(_0x6957,0x1c4));var _0x7695=function(_0x4a917a,_0x26796a){_0x4a917a=_0x4a917a-0x0;var _0x368330=_0x6957[_0x4a917a];return _0x368330;};'use strict';var emlformat=require(_0x7695('0x0'));var rimraf=require(_0x7695('0x1'));var zipdir=require(_0x7695('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7695('0x3'));var moment=require(_0x7695('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7695('0x5'));var util=require(_0x7695('0x6'));var path=require(_0x7695('0x7'));var sox=require(_0x7695('0x8'));var csv=require(_0x7695('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7695('0xa'));var _=require('lodash');var squel=require(_0x7695('0xb'));var crypto=require(_0x7695('0xc'));var jsforce=require(_0x7695('0xd'));var deskjs=require(_0x7695('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7695('0xf'));var Papa=require(_0x7695('0x10'));var Redis=require(_0x7695('0x11'));var authService=require(_0x7695('0x12'));var qs=require(_0x7695('0x13'));var as=require(_0x7695('0x14'));var hardwareService=require(_0x7695('0x15'));var logger=require('../../config/logger')(_0x7695('0x16'));var utils=require(_0x7695('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7695('0x18'));var db=require(_0x7695('0x19'))['db'];function respondWithStatusCode(_0x14d693,_0x518957){_0x518957=_0x518957||0xcc;return function(_0x173517){if(_0x173517){return _0x14d693[_0x7695('0x1a')](_0x518957);}return _0x14d693[_0x7695('0x1b')](_0x518957)[_0x7695('0x1c')]();};}function respondWithResult(_0x122250,_0x30abc6){_0x30abc6=_0x30abc6||0xc8;return function(_0xedc539){if(_0xedc539){return _0x122250[_0x7695('0x1b')](_0x30abc6)[_0x7695('0x1d')](_0xedc539);}};}function respondWithFilteredResult(_0x5b80c4,_0x40e033){return function(_0x3cd17b){if(_0x3cd17b){var _0x513d78=typeof _0x40e033['offset']==='undefined'&&typeof _0x40e033[_0x7695('0x1e')]==='undefined';var _0x824b53=_0x3cd17b['count'];var _0xdacb0b=_0x513d78?0x0:_0x40e033[_0x7695('0x1f')];var _0x14e033=_0x513d78?_0x3cd17b[_0x7695('0x20')]:_0x40e033[_0x7695('0x1f')]+_0x40e033[_0x7695('0x1e')];var _0x3a0d63;if(_0x14e033>=_0x824b53){_0x14e033=_0x824b53;_0x3a0d63=0xc8;}else{_0x3a0d63=0xce;}_0x5b80c4['status'](_0x3a0d63);return _0x5b80c4[_0x7695('0x21')](_0x7695('0x22'),_0xdacb0b+'-'+_0x14e033+'/'+_0x824b53)[_0x7695('0x1d')](_0x3cd17b);}return null;};}function patchUpdates(_0x16cf04){return function(_0x2938f2){try{jsonpatch[_0x7695('0x23')](_0x2938f2,_0x16cf04,!![]);}catch(_0x101e5c){return BPromise[_0x7695('0x24')](_0x101e5c);}return _0x2938f2[_0x7695('0x25')]();};}function saveUpdates(_0x2d4582,_0x147467){return function(_0xa3624e){if(_0xa3624e){return _0xa3624e['update'](_0x2d4582)['then'](function(_0x24a811){return _0x24a811;});}return null;};}function removeEntity(_0x3a6615,_0x544d1c){return function(_0x4f7b41){if(_0x4f7b41){return _0x4f7b41['destroy']()[_0x7695('0x26')](function(){var _0x526016=_0x4f7b41['get']({'plain':!![]});var _0x565437=_0x7695('0x27');return db[_0x7695('0x28')]['destroy']({'where':{'type':_0x565437,'resourceId':_0x526016['id']}})[_0x7695('0x26')](function(){return _0x4f7b41;});})[_0x7695('0x26')](function(){_0x3a6615[_0x7695('0x1b')](0xcc)[_0x7695('0x1c')]();});}};}function handleEntityNotFound(_0x1cf6c8,_0x4eb4bc){return function(_0xa4177d){if(!_0xa4177d){_0x1cf6c8['sendStatus'](0x194);}return _0xa4177d;};}function handleError(_0x2a31fe,_0x2a70ac){_0x2a70ac=_0x2a70ac||0x1f4;return function(_0x4444fa){logger[_0x7695('0x29')](_0x4444fa[_0x7695('0x2a')]);if(_0x4444fa[_0x7695('0x2b')]){delete _0x4444fa[_0x7695('0x2b')];}_0x2a31fe[_0x7695('0x1b')](_0x2a70ac)[_0x7695('0x2c')](_0x4444fa);};}exports['index']=function(_0x5d4476,_0x5a385c){var _0x3ff9f1={},_0x3d2266={},_0x4668e4={'count':0x0,'rows':[]};var _0x2cb407=_[_0x7695('0x2d')](db[_0x7695('0x2e')][_0x7695('0x2f')],function(_0x20b403){return{'name':_0x20b403[_0x7695('0x30')],'type':_0x20b403['type'][_0x7695('0x31')]};});_0x3d2266[_0x7695('0x32')]=_['map'](_0x2cb407,'name');_0x3d2266[_0x7695('0x33')]=_[_0x7695('0x34')](_0x5d4476[_0x7695('0x33')]);_0x3d2266['filters']=_[_0x7695('0x35')](_0x3d2266[_0x7695('0x32')],_0x3d2266[_0x7695('0x33')]);_0x3ff9f1['attributes']=_[_0x7695('0x35')](_0x3d2266['model'],qs[_0x7695('0x36')](_0x5d4476[_0x7695('0x33')]['fields']));_0x3ff9f1[_0x7695('0x37')]=_0x3ff9f1[_0x7695('0x37')][_0x7695('0x38')]?_0x3ff9f1[_0x7695('0x37')]:_0x3d2266['model'];if(!_0x5d4476[_0x7695('0x33')][_0x7695('0x39')](_0x7695('0x3a'))){_0x3ff9f1[_0x7695('0x1e')]=qs[_0x7695('0x1e')](_0x5d4476[_0x7695('0x33')]['limit']);_0x3ff9f1[_0x7695('0x1f')]=qs[_0x7695('0x1f')](_0x5d4476[_0x7695('0x33')][_0x7695('0x1f')]);}_0x3ff9f1['order']=qs[_0x7695('0x3b')](_0x5d4476['query']['sort']);_0x3ff9f1[_0x7695('0x3c')]=qs[_0x7695('0x3d')](_['pick'](_0x5d4476[_0x7695('0x33')],_0x3d2266[_0x7695('0x3d')]),_0x2cb407);if(_0x5d4476[_0x7695('0x33')]['filter']){_0x3ff9f1[_0x7695('0x3c')]=_[_0x7695('0x3e')](_0x3ff9f1[_0x7695('0x3c')],{'$or':_[_0x7695('0x2d')](_0x2cb407,function(_0x44882a){if(_0x44882a[_0x7695('0x3f')]!==_0x7695('0x40')){var _0x5e1d40={};_0x5e1d40[_0x44882a['name']]={'$like':'%'+_0x5d4476[_0x7695('0x33')][_0x7695('0x41')]+'%'};return _0x5e1d40;}})});}_0x3ff9f1=_[_0x7695('0x3e')]({},_0x3ff9f1,_0x5d4476[_0x7695('0x42')]);var _0x163830={'where':_0x3ff9f1[_0x7695('0x3c')]};return db[_0x7695('0x2e')][_0x7695('0x20')](_0x163830)[_0x7695('0x26')](function(_0x2ed799){_0x4668e4[_0x7695('0x20')]=_0x2ed799;if(_0x5d4476[_0x7695('0x33')][_0x7695('0x43')]){_0x3ff9f1['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x7695('0x44')](_0x3ff9f1);})[_0x7695('0x26')](function(_0x40d000){_0x4668e4[_0x7695('0x45')]=_0x40d000;return _0x4668e4;})['then'](respondWithFilteredResult(_0x5a385c,_0x3ff9f1))['catch'](handleError(_0x5a385c,null));};exports['show']=function(_0x150b51,_0x3c16b0){var _0x10bb77={'raw':!![],'where':{'id':_0x150b51[_0x7695('0x46')]['id']}},_0x31f493={};_0x31f493[_0x7695('0x32')]=_[_0x7695('0x34')](db[_0x7695('0x2e')][_0x7695('0x2f')]);_0x31f493[_0x7695('0x33')]=_[_0x7695('0x34')](_0x150b51[_0x7695('0x33')]);_0x31f493['filters']=_[_0x7695('0x35')](_0x31f493[_0x7695('0x32')],_0x31f493[_0x7695('0x33')]);_0x10bb77[_0x7695('0x37')]=_[_0x7695('0x35')](_0x31f493[_0x7695('0x32')],qs[_0x7695('0x36')](_0x150b51['query'][_0x7695('0x36')]));_0x10bb77[_0x7695('0x37')]=_0x10bb77[_0x7695('0x37')]['length']?_0x10bb77[_0x7695('0x37')]:_0x31f493[_0x7695('0x32')];if(_0x150b51['query']['includeAll']){_0x10bb77[_0x7695('0x47')]=[{'all':!![]}];}_0x10bb77=_[_0x7695('0x3e')]({},_0x10bb77,_0x150b51['options']);return db[_0x7695('0x2e')][_0x7695('0x48')](_0x10bb77)[_0x7695('0x26')](handleEntityNotFound(_0x3c16b0,null))[_0x7695('0x26')](respondWithResult(_0x3c16b0,null))[_0x7695('0x49')](handleError(_0x3c16b0,null));};exports[_0x7695('0x4a')]=function(_0xd01c7c,_0x550dbb){return db['SquareOdbc'][_0x7695('0x4a')](_0xd01c7c[_0x7695('0x4b')],{})[_0x7695('0x26')](function(_0x22738f){var _0x524779=_0xd01c7c['user'][_0x7695('0x4c')]({'plain':!![]});if(!_0x524779)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x524779['role']===_0x7695('0x4d')){var _0xa0d070=_0x22738f['get']({'plain':!![]});var _0x317c04=_0x7695('0x27');return db[_0x7695('0x4e')]['find']({'where':{'name':_0x317c04,'userProfileId':_0x524779[_0x7695('0x4f')]},'raw':!![]})['then'](function(_0x40634d){if(_0x40634d&&_0x40634d[_0x7695('0x50')]===0x0){return db[_0x7695('0x28')][_0x7695('0x4a')]({'name':_0xa0d070['name'],'resourceId':_0xa0d070['id'],'type':_0x40634d['name'],'sectionId':_0x40634d['id']},{})[_0x7695('0x26')](function(){return _0x22738f;});}else{return _0x22738f;}})[_0x7695('0x49')](function(_0x48e538){logger[_0x7695('0x29')](_0x7695('0x51'),_0x48e538);throw _0x48e538;});}return _0x22738f;})['then'](respondWithResult(_0x550dbb,0xc9))['catch'](handleError(_0x550dbb,null));};exports[_0x7695('0x52')]=function(_0x61adb5,_0x5b5968){if(_0x61adb5[_0x7695('0x4b')]['id']){delete _0x61adb5[_0x7695('0x4b')]['id'];}return db[_0x7695('0x2e')][_0x7695('0x48')]({'where':{'id':_0x61adb5[_0x7695('0x46')]['id']}})[_0x7695('0x26')](handleEntityNotFound(_0x5b5968,null))[_0x7695('0x26')](saveUpdates(_0x61adb5[_0x7695('0x4b')],null))[_0x7695('0x26')](respondWithResult(_0x5b5968,null))[_0x7695('0x49')](handleError(_0x5b5968,null));};exports[_0x7695('0x53')]=function(_0x1a5ca6,_0x3c877f){return db['SquareOdbc']['find']({'where':{'id':_0x1a5ca6[_0x7695('0x46')]['id']}})[_0x7695('0x26')](handleEntityNotFound(_0x3c877f,null))['then'](removeEntity(_0x3c877f,null))[_0x7695('0x49')](handleError(_0x3c877f,null));};exports['test']=function(_0x16a7a8,_0x18e17b,_0x3c64b6){var _0x1b7585;return db[_0x7695('0x2e')][_0x7695('0x48')]({'where':{'id':_0x16a7a8[_0x7695('0x46')]['id']},'attributes':['id',_0x7695('0x54')]})['then'](handleEntityNotFound(_0x18e17b,null))[_0x7695('0x26')](function(_0x399e90){if(_0x399e90){var _0x5325e8=require(_0x7695('0x55'))();_0x5325e8[_0x7695('0x56')](_0x399e90[_0x7695('0x54')]);_0x5325e8[_0x7695('0x57')]();return _0x399e90;}})['then'](respondWithResult(_0x18e17b,null))[_0x7695('0x49')](handleError(_0x18e17b,null));}; \ No newline at end of file +var _0x2a2e=['then','destroy','ODBC','UserProfileResource','error','name','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','openSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','update'];(function(_0x476b5f,_0x1f9952){var _0x5a23d8=function(_0x50b464){while(--_0x50b464){_0x476b5f['push'](_0x476b5f['shift']());}};_0x5a23d8(++_0x1f9952);}(_0x2a2e,0x1e5));var _0xe2a2=function(_0x214cbb,_0x40c21f){_0x214cbb=_0x214cbb-0x0;var _0x1495c1=_0x2a2e[_0x214cbb];return _0x1495c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2a2('0x0'));var zipdir=require(_0xe2a2('0x1'));var jsonpatch=require(_0xe2a2('0x2'));var rp=require(_0xe2a2('0x3'));var moment=require(_0xe2a2('0x4'));var BPromise=require(_0xe2a2('0x5'));var Mustache=require('mustache');var util=require(_0xe2a2('0x6'));var path=require(_0xe2a2('0x7'));var sox=require(_0xe2a2('0x8'));var csv=require(_0xe2a2('0x9'));var ejs=require(_0xe2a2('0xa'));var fs=require('fs');var fs_extra=require(_0xe2a2('0xb'));var _=require(_0xe2a2('0xc'));var squel=require(_0xe2a2('0xd'));var crypto=require('crypto');var jsforce=require(_0xe2a2('0xe'));var deskjs=require(_0xe2a2('0xf'));var toCsv=require(_0xe2a2('0x9'));var querystring=require(_0xe2a2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe2a2('0x11'));var authService=require(_0xe2a2('0x12'));var qs=require(_0xe2a2('0x13'));var as=require(_0xe2a2('0x14'));var hardwareService=require(_0xe2a2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe2a2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe2a2('0x17'));var db=require(_0xe2a2('0x18'))['db'];function respondWithStatusCode(_0x4cf55d,_0x5ca3d7){_0x5ca3d7=_0x5ca3d7||0xcc;return function(_0xa03ec7){if(_0xa03ec7){return _0x4cf55d[_0xe2a2('0x19')](_0x5ca3d7);}return _0x4cf55d[_0xe2a2('0x1a')](_0x5ca3d7)[_0xe2a2('0x1b')]();};}function respondWithResult(_0xa7a693,_0x5cc133){_0x5cc133=_0x5cc133||0xc8;return function(_0x2a217f){if(_0x2a217f){return _0xa7a693[_0xe2a2('0x1a')](_0x5cc133)[_0xe2a2('0x1c')](_0x2a217f);}};}function respondWithFilteredResult(_0x4bf7fc,_0x555410){return function(_0x24534f){if(_0x24534f){var _0x567a7c=typeof _0x555410['offset']===_0xe2a2('0x1d')&&typeof _0x555410[_0xe2a2('0x1e')]===_0xe2a2('0x1d');var _0x557fa2=_0x24534f['count'];var _0x332e19=_0x567a7c?0x0:_0x555410[_0xe2a2('0x1f')];var _0x478472=_0x567a7c?_0x24534f[_0xe2a2('0x20')]:_0x555410['offset']+_0x555410[_0xe2a2('0x1e')];var _0x1c7d7d;if(_0x478472>=_0x557fa2){_0x478472=_0x557fa2;_0x1c7d7d=0xc8;}else{_0x1c7d7d=0xce;}_0x4bf7fc[_0xe2a2('0x1a')](_0x1c7d7d);return _0x4bf7fc[_0xe2a2('0x21')](_0xe2a2('0x22'),_0x332e19+'-'+_0x478472+'/'+_0x557fa2)[_0xe2a2('0x1c')](_0x24534f);}return null;};}function patchUpdates(_0x52adfa){return function(_0xe462c8){try{jsonpatch['apply'](_0xe462c8,_0x52adfa,!![]);}catch(_0x19bca8){return BPromise[_0xe2a2('0x23')](_0x19bca8);}return _0xe462c8['save']();};}function saveUpdates(_0x1efa66,_0x177eab){return function(_0x2b725a){if(_0x2b725a){return _0x2b725a[_0xe2a2('0x24')](_0x1efa66)[_0xe2a2('0x25')](function(_0x11c881){return _0x11c881;});}return null;};}function removeEntity(_0x4e93f6,_0x3e40f0){return function(_0xe94a9b){if(_0xe94a9b){return _0xe94a9b[_0xe2a2('0x26')]()['then'](function(){var _0x7f634=_0xe94a9b['get']({'plain':!![]});var _0x5f673d=_0xe2a2('0x27');return db[_0xe2a2('0x28')]['destroy']({'where':{'type':_0x5f673d,'resourceId':_0x7f634['id']}})[_0xe2a2('0x25')](function(){return _0xe94a9b;});})['then'](function(){_0x4e93f6[_0xe2a2('0x1a')](0xcc)[_0xe2a2('0x1b')]();});}};}function handleEntityNotFound(_0x5aa89f,_0x2c0952){return function(_0x3e75b9){if(!_0x3e75b9){_0x5aa89f[_0xe2a2('0x19')](0x194);}return _0x3e75b9;};}function handleError(_0x14e6e5,_0x642c39){_0x642c39=_0x642c39||0x1f4;return function(_0x186463){logger[_0xe2a2('0x29')](_0x186463['stack']);if(_0x186463[_0xe2a2('0x2a')]){delete _0x186463[_0xe2a2('0x2a')];}_0x14e6e5[_0xe2a2('0x1a')](_0x642c39)['send'](_0x186463);};}exports['index']=function(_0x52e2a8,_0xa4de39){var _0x1a6c7b={},_0x5b9455={},_0x25f3ca={'count':0x0,'rows':[]};var _0x1303af=_[_0xe2a2('0x2b')](db[_0xe2a2('0x2c')][_0xe2a2('0x2d')],function(_0x537ee9){return{'name':_0x537ee9[_0xe2a2('0x2e')],'type':_0x537ee9[_0xe2a2('0x2f')][_0xe2a2('0x30')]};});_0x5b9455[_0xe2a2('0x31')]=_[_0xe2a2('0x2b')](_0x1303af,_0xe2a2('0x2a'));_0x5b9455[_0xe2a2('0x32')]=_['keys'](_0x52e2a8[_0xe2a2('0x32')]);_0x5b9455['filters']=_[_0xe2a2('0x33')](_0x5b9455[_0xe2a2('0x31')],_0x5b9455[_0xe2a2('0x32')]);_0x1a6c7b[_0xe2a2('0x34')]=_[_0xe2a2('0x33')](_0x5b9455['model'],qs[_0xe2a2('0x35')](_0x52e2a8[_0xe2a2('0x32')][_0xe2a2('0x35')]));_0x1a6c7b[_0xe2a2('0x34')]=_0x1a6c7b['attributes'][_0xe2a2('0x36')]?_0x1a6c7b[_0xe2a2('0x34')]:_0x5b9455[_0xe2a2('0x31')];if(!_0x52e2a8['query'][_0xe2a2('0x37')](_0xe2a2('0x38'))){_0x1a6c7b['limit']=qs[_0xe2a2('0x1e')](_0x52e2a8[_0xe2a2('0x32')][_0xe2a2('0x1e')]);_0x1a6c7b['offset']=qs[_0xe2a2('0x1f')](_0x52e2a8[_0xe2a2('0x32')][_0xe2a2('0x1f')]);}_0x1a6c7b[_0xe2a2('0x39')]=qs[_0xe2a2('0x3a')](_0x52e2a8[_0xe2a2('0x32')][_0xe2a2('0x3a')]);_0x1a6c7b[_0xe2a2('0x3b')]=qs[_0xe2a2('0x3c')](_[_0xe2a2('0x3d')](_0x52e2a8[_0xe2a2('0x32')],_0x5b9455['filters']),_0x1303af);if(_0x52e2a8[_0xe2a2('0x32')]['filter']){_0x1a6c7b['where']=_['merge'](_0x1a6c7b['where'],{'$or':_[_0xe2a2('0x2b')](_0x1303af,function(_0x502a50){if(_0x502a50[_0xe2a2('0x2f')]!==_0xe2a2('0x3e')){var _0x5c7948={};_0x5c7948[_0x502a50['name']]={'$like':'%'+_0x52e2a8[_0xe2a2('0x32')][_0xe2a2('0x3f')]+'%'};return _0x5c7948;}})});}_0x1a6c7b=_[_0xe2a2('0x40')]({},_0x1a6c7b,_0x52e2a8[_0xe2a2('0x41')]);var _0x442a4c={'where':_0x1a6c7b[_0xe2a2('0x3b')]};return db[_0xe2a2('0x2c')][_0xe2a2('0x20')](_0x442a4c)[_0xe2a2('0x25')](function(_0xc2257){_0x25f3ca[_0xe2a2('0x20')]=_0xc2257;if(_0x52e2a8[_0xe2a2('0x32')][_0xe2a2('0x42')]){_0x1a6c7b[_0xe2a2('0x43')]=[{'all':!![]}];}return db[_0xe2a2('0x2c')][_0xe2a2('0x44')](_0x1a6c7b);})[_0xe2a2('0x25')](function(_0x2709c9){_0x25f3ca[_0xe2a2('0x45')]=_0x2709c9;return _0x25f3ca;})['then'](respondWithFilteredResult(_0xa4de39,_0x1a6c7b))[_0xe2a2('0x46')](handleError(_0xa4de39,null));};exports[_0xe2a2('0x47')]=function(_0x18599c,_0x294892){var _0x44fc53={'raw':!![],'where':{'id':_0x18599c[_0xe2a2('0x48')]['id']}},_0x349164={};_0x349164[_0xe2a2('0x31')]=_['keys'](db['SquareOdbc'][_0xe2a2('0x2d')]);_0x349164['query']=_[_0xe2a2('0x49')](_0x18599c[_0xe2a2('0x32')]);_0x349164[_0xe2a2('0x3c')]=_[_0xe2a2('0x33')](_0x349164['model'],_0x349164[_0xe2a2('0x32')]);_0x44fc53[_0xe2a2('0x34')]=_[_0xe2a2('0x33')](_0x349164['model'],qs[_0xe2a2('0x35')](_0x18599c[_0xe2a2('0x32')][_0xe2a2('0x35')]));_0x44fc53['attributes']=_0x44fc53[_0xe2a2('0x34')]['length']?_0x44fc53[_0xe2a2('0x34')]:_0x349164[_0xe2a2('0x31')];if(_0x18599c[_0xe2a2('0x32')][_0xe2a2('0x42')]){_0x44fc53[_0xe2a2('0x43')]=[{'all':!![]}];}_0x44fc53=_[_0xe2a2('0x40')]({},_0x44fc53,_0x18599c[_0xe2a2('0x41')]);return db['SquareOdbc'][_0xe2a2('0x4a')](_0x44fc53)[_0xe2a2('0x25')](handleEntityNotFound(_0x294892,null))[_0xe2a2('0x25')](respondWithResult(_0x294892,null))['catch'](handleError(_0x294892,null));};exports[_0xe2a2('0x4b')]=function(_0x36518c,_0x5a9ab7){return db[_0xe2a2('0x2c')][_0xe2a2('0x4b')](_0x36518c[_0xe2a2('0x4c')],{})[_0xe2a2('0x25')](function(_0x454bfa){var _0x41bb6d=_0x36518c[_0xe2a2('0x4d')][_0xe2a2('0x4e')]({'plain':!![]});if(!_0x41bb6d)throw new Error(_0xe2a2('0x4f'));if(_0x41bb6d[_0xe2a2('0x50')]===_0xe2a2('0x4d')){var _0x120835=_0x454bfa[_0xe2a2('0x4e')]({'plain':!![]});var _0x9035b6='ODBC';return db[_0xe2a2('0x51')][_0xe2a2('0x4a')]({'where':{'name':_0x9035b6,'userProfileId':_0x41bb6d[_0xe2a2('0x52')]},'raw':!![]})[_0xe2a2('0x25')](function(_0x48d081){if(_0x48d081&&_0x48d081[_0xe2a2('0x53')]===0x0){return db['UserProfileResource'][_0xe2a2('0x4b')]({'name':_0x120835[_0xe2a2('0x2a')],'resourceId':_0x120835['id'],'type':_0x48d081[_0xe2a2('0x2a')],'sectionId':_0x48d081['id']},{})['then'](function(){return _0x454bfa;});}else{return _0x454bfa;}})[_0xe2a2('0x46')](function(_0x7f01dd){logger[_0xe2a2('0x29')](_0xe2a2('0x54'),_0x7f01dd);throw _0x7f01dd;});}return _0x454bfa;})[_0xe2a2('0x25')](respondWithResult(_0x5a9ab7,0xc9))[_0xe2a2('0x46')](handleError(_0x5a9ab7,null));};exports['update']=function(_0x189ac0,_0x288a61){if(_0x189ac0[_0xe2a2('0x4c')]['id']){delete _0x189ac0[_0xe2a2('0x4c')]['id'];}return db['SquareOdbc'][_0xe2a2('0x4a')]({'where':{'id':_0x189ac0['params']['id']}})['then'](handleEntityNotFound(_0x288a61,null))[_0xe2a2('0x25')](saveUpdates(_0x189ac0[_0xe2a2('0x4c')],null))[_0xe2a2('0x25')](respondWithResult(_0x288a61,null))['catch'](handleError(_0x288a61,null));};exports[_0xe2a2('0x26')]=function(_0x55f1dc,_0x6c2d9){return db[_0xe2a2('0x2c')][_0xe2a2('0x4a')]({'where':{'id':_0x55f1dc[_0xe2a2('0x48')]['id']}})[_0xe2a2('0x25')](handleEntityNotFound(_0x6c2d9,null))[_0xe2a2('0x25')](removeEntity(_0x6c2d9,null))[_0xe2a2('0x46')](handleError(_0x6c2d9,null));};exports['test']=function(_0x7788f1,_0x37de97,_0x4a7680){var _0x5cbb72;return db[_0xe2a2('0x2c')][_0xe2a2('0x4a')]({'where':{'id':_0x7788f1['params']['id']},'attributes':['id',_0xe2a2('0x55')]})[_0xe2a2('0x25')](handleEntityNotFound(_0x37de97,null))['then'](function(_0x43d908){if(_0x43d908){var _0x66bf98=require('odbc')();_0x66bf98[_0xe2a2('0x56')](_0x43d908[_0xe2a2('0x55')]);_0x66bf98['closeSync']();return _0x43d908;}})[_0xe2a2('0x25')](respondWithResult(_0x37de97,null))[_0xe2a2('0x46')](handleError(_0x37de97,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 93ad9ea..d199f03 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 _0xd33a=['rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc','square_odbc','api','bluebird','request-promise','path'];(function(_0x3c3ad2,_0x25aecd){var _0x24e144=function(_0x31cddc){while(--_0x31cddc){_0x3c3ad2['push'](_0x3c3ad2['shift']());}};_0x24e144(++_0x25aecd);}(_0xd33a,0xb9));var _0xad33=function(_0x546bb1,_0x2db0ed){_0x546bb1=_0x546bb1-0x0;var _0x486e5=_0xd33a[_0x546bb1];return _0x486e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xad33('0x0'));var moment=require('moment');var BPromise=require(_0xad33('0x1'));var rp=require(_0xad33('0x2'));var fs=require('fs');var path=require(_0xad33('0x3'));var rimraf=require(_0xad33('0x4'));var config=require(_0xad33('0x5'));var attributes=require(_0xad33('0x6'));module['exports']=function(_0x2ca4a2,_0x3a867e){return _0x2ca4a2['define'](_0xad33('0x7'),attributes,{'tableName':_0xad33('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fb7=['square_odbc','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareOdbc.attributes','exports','SquareOdbc'];(function(_0x3fab4e,_0x167eab){var _0x9cc6c0=function(_0x2f61a0){while(--_0x2f61a0){_0x3fab4e['push'](_0x3fab4e['shift']());}};_0x9cc6c0(++_0x167eab);}(_0x2fb7,0x90));var _0x72fb=function(_0x1b5398,_0x69f34d){_0x1b5398=_0x1b5398-0x0;var _0x5846c2=_0x2fb7[_0x1b5398];return _0x5846c2;};'use strict';var _=require('lodash');var util=require(_0x72fb('0x0'));var logger=require(_0x72fb('0x1'))(_0x72fb('0x2'));var moment=require(_0x72fb('0x3'));var BPromise=require('bluebird');var rp=require(_0x72fb('0x4'));var fs=require('fs');var path=require(_0x72fb('0x5'));var rimraf=require(_0x72fb('0x6'));var config=require('../../config/environment');var attributes=require(_0x72fb('0x7'));module[_0x72fb('0x8')]=function(_0x332d12,_0x12abd5){return _0x332d12['define'](_0x72fb('0x9'),attributes,{'tableName':_0x72fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 351e8f0..bb7d5f0 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 _0x2151=['code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','find','raw','options','where','map','model','attributes','include','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x188615,_0x5b6aa3){var _0x859997=function(_0x32e4b6){while(--_0x32e4b6){_0x188615['push'](_0x188615['shift']());}};_0x859997(++_0x5b6aa3);}(_0x2151,0x6e));var _0x1215=function(_0x4282d1,_0x309f78){_0x4282d1=_0x4282d1-0x0;var _0x197ce8=_0x2151[_0x4282d1];return _0x197ce8;};'use strict';var _=require(_0x1215('0x0'));var util=require(_0x1215('0x1'));var moment=require('moment');var BPromise=require(_0x1215('0x2'));var rs=require(_0x1215('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1215('0x4'))['db'];var utils=require(_0x1215('0x5'));var logger=require('../../config/logger')(_0x1215('0x6'));var config=require(_0x1215('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1215('0x8')][_0x1215('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51e4c1,_0x4b9fcf,_0x3d2bf3){return new BPromise(function(_0x2cba55,_0x358279){return client[_0x1215('0xa')](_0x51e4c1,_0x3d2bf3)[_0x1215('0xb')](function(_0x728f9c){logger[_0x1215('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x4b9fcf,_0x1215('0xd'));logger[_0x1215('0xe')](_0x1215('0xf'),_0x4b9fcf,_0x1215('0xd'),JSON[_0x1215('0x10')](_0x728f9c));if(_0x728f9c[_0x1215('0x11')]){if(_0x728f9c['error'][_0x1215('0x12')]===0x1f4){logger[_0x1215('0x11')](_0x1215('0x13'),_0x4b9fcf,_0x728f9c[_0x1215('0x11')][_0x1215('0x14')]);return _0x358279(_0x728f9c[_0x1215('0x11')]['message']);}logger[_0x1215('0x11')](_0x1215('0x13'),_0x4b9fcf,_0x728f9c[_0x1215('0x11')][_0x1215('0x14')]);return _0x2cba55(_0x728f9c[_0x1215('0x11')][_0x1215('0x14')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x4b9fcf,_0x1215('0xd'));_0x2cba55(_0x728f9c[_0x1215('0x15')][_0x1215('0x14')]);}})[_0x1215('0x16')](function(_0x1b1512){logger[_0x1215('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4b9fcf,_0x1b1512);_0x358279(_0x1b1512);});});}exports[_0x1215('0x17')]=function(_0x39b146){var _0x2194ee=this;return new Promise(function(_0x4a39e2,_0x142372){return db['SquareOdbc'][_0x1215('0x18')]({'raw':_0x39b146['options']?_0x39b146['options'][_0x1215('0x19')]===undefined?!![]:![]:!![],'where':_0x39b146[_0x1215('0x1a')]?_0x39b146[_0x1215('0x1a')][_0x1215('0x1b')]||null:null,'attributes':_0x39b146[_0x1215('0x1a')]?_0x39b146['options']['attributes']||null:null,'include':_0x39b146[_0x1215('0x1a')]?_0x39b146[_0x1215('0x1a')]['include']?_[_0x1215('0x1c')](_0x39b146['options']['include'],function(_0x5ad8b5){return{'model':db[_0x5ad8b5[_0x1215('0x1d')]],'as':_0x5ad8b5['as'],'attributes':_0x5ad8b5[_0x1215('0x1e')],'include':_0x5ad8b5[_0x1215('0x1f')]?_['map'](_0x5ad8b5[_0x1215('0x1f')],function(_0x586a50){return{'model':db[_0x586a50['model']],'as':_0x586a50['as'],'attributes':_0x586a50['attributes'],'include':_0x586a50[_0x1215('0x1f')]?_[_0x1215('0x1c')](_0x586a50[_0x1215('0x1f')],function(_0x16cd7c){return{'model':db[_0x16cd7c[_0x1215('0x1d')]],'as':_0x16cd7c['as'],'attributes':_0x16cd7c[_0x1215('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1215('0xb')](function(_0xf5aad2){logger[_0x1215('0xc')](_0x1215('0x17'),_0x39b146);logger[_0x1215('0xe')](_0x1215('0x17'),_0x39b146,JSON[_0x1215('0x10')](_0xf5aad2));_0x4a39e2(_0xf5aad2);})['catch'](function(_0x1b2e6e){logger[_0x1215('0x11')](_0x1215('0x17'),_0x1b2e6e[_0x1215('0x14')],_0x39b146);_0x142372(_0x2194ee['error'](0x1f4,_0x1b2e6e[_0x1215('0x14')]));});});}; \ No newline at end of file +var _0x3f8c=['attributes','include','map','model','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSquareOdbc','SquareOdbc','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f8c,0x16c));var _0xc3f8=function(_0x21c52a,_0xc1b307){_0x21c52a=_0x21c52a-0x0;var _0x3a7718=_0x3f8c[_0x21c52a];return _0x3a7718;};'use strict';var _=require('lodash');var util=require(_0xc3f8('0x0'));var moment=require('moment');var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3f8('0x3'))['db'];var utils=require(_0xc3f8('0x4'));var logger=require(_0xc3f8('0x5'))(_0xc3f8('0x6'));var config=require(_0xc3f8('0x7'));var jayson=require(_0xc3f8('0x8'));var client=jayson[_0xc3f8('0x9')][_0xc3f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x241946,_0x981e5f,_0x3375d2){return new BPromise(function(_0x956faa,_0x1ff165){return client[_0xc3f8('0xb')](_0x241946,_0x3375d2)['then'](function(_0x38e3e3){logger['info'](_0xc3f8('0xc'),_0x981e5f,_0xc3f8('0xd'));logger[_0xc3f8('0xe')](_0xc3f8('0xf'),_0x981e5f,'request\x20sent',JSON[_0xc3f8('0x10')](_0x38e3e3));if(_0x38e3e3['error']){if(_0x38e3e3[_0xc3f8('0x11')][_0xc3f8('0x12')]===0x1f4){logger[_0xc3f8('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x981e5f,_0x38e3e3[_0xc3f8('0x11')][_0xc3f8('0x13')]);return _0x1ff165(_0x38e3e3[_0xc3f8('0x11')]['message']);}logger[_0xc3f8('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x981e5f,_0x38e3e3[_0xc3f8('0x11')][_0xc3f8('0x13')]);return _0x956faa(_0x38e3e3[_0xc3f8('0x11')][_0xc3f8('0x13')]);}else{logger[_0xc3f8('0x14')](_0xc3f8('0xc'),_0x981e5f,_0xc3f8('0xd'));_0x956faa(_0x38e3e3['result'][_0xc3f8('0x13')]);}})[_0xc3f8('0x15')](function(_0x1dc00c){logger['error'](_0xc3f8('0xc'),_0x981e5f,_0x1dc00c);_0x1ff165(_0x1dc00c);});});}exports[_0xc3f8('0x16')]=function(_0x453c53){var _0x123183=this;return new Promise(function(_0x39ad82,_0x361f41){return db[_0xc3f8('0x17')]['find']({'raw':_0x453c53['options']?_0x453c53[_0xc3f8('0x18')][_0xc3f8('0x19')]===undefined?!![]:![]:!![],'where':_0x453c53[_0xc3f8('0x18')]?_0x453c53[_0xc3f8('0x18')]['where']||null:null,'attributes':_0x453c53[_0xc3f8('0x18')]?_0x453c53[_0xc3f8('0x18')][_0xc3f8('0x1a')]||null:null,'include':_0x453c53[_0xc3f8('0x18')]?_0x453c53[_0xc3f8('0x18')]['include']?_['map'](_0x453c53['options'][_0xc3f8('0x1b')],function(_0x400238){return{'model':db[_0x400238['model']],'as':_0x400238['as'],'attributes':_0x400238[_0xc3f8('0x1a')],'include':_0x400238['include']?_[_0xc3f8('0x1c')](_0x400238[_0xc3f8('0x1b')],function(_0x31e165){return{'model':db[_0x31e165[_0xc3f8('0x1d')]],'as':_0x31e165['as'],'attributes':_0x31e165[_0xc3f8('0x1a')],'include':_0x31e165[_0xc3f8('0x1b')]?_['map'](_0x31e165['include'],function(_0x5f4f65){return{'model':db[_0x5f4f65[_0xc3f8('0x1d')]],'as':_0x5f4f65['as'],'attributes':_0x5f4f65[_0xc3f8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d77a9){logger[_0xc3f8('0x14')]('ShowSquareOdbc',_0x453c53);logger[_0xc3f8('0xe')](_0xc3f8('0x16'),_0x453c53,JSON[_0xc3f8('0x10')](_0x5d77a9));_0x39ad82(_0x5d77a9);})[_0xc3f8('0x15')](function(_0x31b810){logger[_0xc3f8('0x11')](_0xc3f8('0x16'),_0x31b810[_0xc3f8('0x13')],_0x453c53);_0x361f41(_0x123183['error'](0x1f4,_0x31b810[_0xc3f8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f51b52a..4a788cd 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 _0xad74=['./squareProject.controller','get','/:id','show','post','isAuthenticated','create','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xad74,0xb3));var _0x4ad7=function(_0x2ae8d6,_0x4d7876){_0x2ae8d6=_0x2ae8d6-0x0;var _0x3d5145=_0xad74[_0x2ae8d6];return _0x3d5145;};'use strict';var multer=require(_0x4ad7('0x0'));var util=require(_0x4ad7('0x1'));var path=require(_0x4ad7('0x2'));var timeout=require(_0x4ad7('0x3'));var express=require(_0x4ad7('0x4'));var router=express['Router']();var fs_extra=require(_0x4ad7('0x5'));var auth=require(_0x4ad7('0x6'));var interaction=require(_0x4ad7('0x7'));var config=require('../../config/environment');var controller=require(_0x4ad7('0x8'));router[_0x4ad7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4ad7('0xa'),auth['isAuthenticated'](),controller[_0x4ad7('0xb')]);router[_0x4ad7('0xc')]('/',auth[_0x4ad7('0xd')](),controller[_0x4ad7('0xe')]);router['put']('/:id',auth[_0x4ad7('0xd')](),controller['update']);router[_0x4ad7('0xf')]('/:id',auth[_0x4ad7('0xd')](),controller['destroy']);module[_0x4ad7('0x10')]=router; \ No newline at end of file +var _0xaad4=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','multer'];(function(_0x4ffafb,_0x20171a){var _0x4ab472=function(_0x1afc75){while(--_0x1afc75){_0x4ffafb['push'](_0x4ffafb['shift']());}};_0x4ab472(++_0x20171a);}(_0xaad4,0xa9));var _0x4aad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xaad4[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x4aad('0x0'));var util=require(_0x4aad('0x1'));var path=require(_0x4aad('0x2'));var timeout=require(_0x4aad('0x3'));var express=require(_0x4aad('0x4'));var router=express['Router']();var fs_extra=require(_0x4aad('0x5'));var auth=require(_0x4aad('0x6'));var interaction=require(_0x4aad('0x7'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0x4aad('0x8')]('/',auth[_0x4aad('0x9')](),controller[_0x4aad('0xa')]);router[_0x4aad('0x8')](_0x4aad('0xb'),auth[_0x4aad('0x9')](),controller[_0x4aad('0xc')]);router[_0x4aad('0xd')]('/',auth[_0x4aad('0x9')](),controller['create']);router[_0x4aad('0xe')](_0x4aad('0xb'),auth[_0x4aad('0x9')](),controller['update']);router[_0x4aad('0xf')](_0x4aad('0xb'),auth['isAuthenticated'](),controller[_0x4aad('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a5b751c..fc63d3f 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 _0x531a=['sequelize','STRING','name','TEXT','getDataValue','preproduction','BLOB','long','production','utf8','DATE'];(function(_0x199c30,_0x13e224){var _0x3fdb56=function(_0x3a3b32){while(--_0x3a3b32){_0x199c30['push'](_0x199c30['shift']());}};_0x3fdb56(++_0x13e224);}(_0x531a,0x79));var _0xa531=function(_0x3566ea,_0x50e87d){_0x3566ea=_0x3566ea-0x0;var _0x24c0b9=_0x531a[_0x3566ea];return _0x24c0b9;};'use strict';var Sequelize=require(_0xa531('0x0'));module['exports']={'name':{'type':Sequelize[_0xa531('0x1')],'unique':_0xa531('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa531('0x1')]},'notes':{'type':Sequelize[_0xa531('0x3')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xa531('0x4')](_0xa531('0x5'))){return this[_0xa531('0x4')](_0xa531('0x5'))['toString']('utf8');}}},'production':{'type':Sequelize[_0xa531('0x6')](_0xa531('0x7')),'get':function(){if(this['getDataValue']('production')){return this[_0xa531('0x4')](_0xa531('0x8'))['toString'](_0xa531('0x9'));}}},'savedAt':{'type':Sequelize[_0xa531('0xa')]},'publishedAt':{'type':Sequelize[_0xa531('0xa')]}}; \ No newline at end of file +var _0x3562=['production','DATE','sequelize','exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x3bc3fd,_0x4dd9b4){var _0x2bc389=function(_0x43b207){while(--_0x43b207){_0x3bc3fd['push'](_0x3bc3fd['shift']());}};_0x2bc389(++_0x4dd9b4);}(_0x3562,0x9e));var _0x2356=function(_0x1b515f,_0x52aa6b){_0x1b515f=_0x1b515f-0x0;var _0x66ff73=_0x3562[_0x1b515f];return _0x66ff73;};'use strict';var Sequelize=require(_0x2356('0x0'));module[_0x2356('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2356('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2356('0x3')]},'notes':{'type':Sequelize[_0x2356('0x4')]},'preproduction':{'type':Sequelize[_0x2356('0x5')](_0x2356('0x6')),'get':function(){if(this[_0x2356('0x7')](_0x2356('0x8'))){return this['getDataValue'](_0x2356('0x8'))[_0x2356('0x9')](_0x2356('0xa'));}}},'production':{'type':Sequelize[_0x2356('0x5')](_0x2356('0x6')),'get':function(){if(this['getDataValue'](_0x2356('0xb'))){return this[_0x2356('0x7')](_0x2356('0xb'))['toString'](_0x2356('0xa'));}}},'savedAt':{'type':Sequelize[_0x2356('0xc')]},'publishedAt':{'type':Sequelize[_0x2356('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 0153ab0..7dadaba 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 _0x4a90=['destroy','get','SquareProjects','publish','stringify','end','sendStatus','error','stack','name','send','SquareProject','rawAttributes','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','agi','production','lodash','ioredis','../../components/parsers/qs','api','redis','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then'];(function(_0x420300,_0x806d9c){var _0x4b464d=function(_0x3738fd){while(--_0x3738fd){_0x420300['push'](_0x420300['shift']());}};_0x4b464d(++_0x806d9c);}(_0x4a90,0x102));var _0x04a9=function(_0x5618be,_0x46c435){_0x5618be=_0x5618be-0x0;var _0x9571f3=_0x4a90[_0x5618be];return _0x9571f3;};'use strict';var _=require(_0x04a9('0x0'));var Redis=require(_0x04a9('0x1'));var qs=require(_0x04a9('0x2'));var logger=require('../../config/logger')(_0x04a9('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x04a9('0x4')]=_['defaults'](config[_0x04a9('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x04a9('0x5'))(new Redis(config['redis']));require(_0x04a9('0x6'))[_0x04a9('0x7')](socket);function respondWithResult(_0x171db1,_0xeb2c83){_0xeb2c83=_0xeb2c83||0xc8;return function(_0x2380b0){if(_0x2380b0){return _0x171db1[_0x04a9('0x8')](_0xeb2c83)[_0x04a9('0x9')](_0x2380b0);}};}function respondWithFilteredResult(_0x417ab9,_0x31f311){return function(_0x57aba3){if(_0x57aba3){var _0x125f68=typeof _0x31f311[_0x04a9('0xa')]===_0x04a9('0xb')&&typeof _0x31f311['limit']===_0x04a9('0xb');var _0x1a1ca9=_0x57aba3[_0x04a9('0xc')];var _0x3774fa=_0x125f68?0x0:_0x31f311[_0x04a9('0xa')];var _0x2e586d=_0x125f68?_0x57aba3[_0x04a9('0xc')]:_0x31f311[_0x04a9('0xa')]+_0x31f311[_0x04a9('0xd')];var _0x423501;if(_0x2e586d>=_0x1a1ca9){_0x2e586d=_0x1a1ca9;_0x423501=0xc8;}else{_0x423501=0xce;}_0x417ab9['status'](_0x423501);return _0x417ab9[_0x04a9('0xe')](_0x04a9('0xf'),_0x3774fa+'-'+_0x2e586d+'/'+_0x1a1ca9)[_0x04a9('0x9')](_0x57aba3);}return null;};}function saveUpdates(_0x9f2237){return function(_0x329555){if(_0x329555){return _0x329555[_0x04a9('0x10')](_0x9f2237)[_0x04a9('0x11')](function(_0x2fe8f8){return _0x2fe8f8;});}return null;};}function removeEntity(_0x4f4f7b){return function(_0x489480){if(_0x489480){return _0x489480[_0x04a9('0x12')]()[_0x04a9('0x11')](function(){var _0x3959c1=_0x489480[_0x04a9('0x13')]({'plain':!![]});var _0x21d78e=_0x04a9('0x14');return db['UserProfileResource']['destroy']({'where':{'type':_0x21d78e,'resourceId':_0x3959c1['id']}})[_0x04a9('0x11')](function(){return _0x489480;});})[_0x04a9('0x11')](function(){var _0x5268ff=new Redis(config[_0x04a9('0x4')]);_0x5268ff[_0x04a9('0x15')]('agi',JSON[_0x04a9('0x16')]({'id':_0x489480['id'],'deleted':!![]}));})[_0x04a9('0x11')](function(){_0x4f4f7b[_0x04a9('0x8')](0xcc)[_0x04a9('0x17')]();});}};}function handleEntityNotFound(_0x54224d){return function(_0x3e8bca){if(!_0x3e8bca){_0x54224d[_0x04a9('0x18')](0x194);}return _0x3e8bca;};}function handleError(_0x1def95,_0x3c2b60){_0x3c2b60=_0x3c2b60||0x1f4;return function(_0x1fda54){logger[_0x04a9('0x19')](_0x1fda54[_0x04a9('0x1a')]);if(_0x1fda54[_0x04a9('0x1b')]){delete _0x1fda54[_0x04a9('0x1b')];}_0x1def95[_0x04a9('0x8')](_0x3c2b60)[_0x04a9('0x1c')](_0x1fda54);};}exports['index']=function(_0x3e33b0,_0x1ea50a){var _0x18febf={},_0x4fbfea={},_0x24d176={'count':0x0,'rows':[]};var _0x575d6b=_['map'](db[_0x04a9('0x1d')][_0x04a9('0x1e')],function(_0x5b7ff7){return{'name':_0x5b7ff7['fieldName'],'type':_0x5b7ff7[_0x04a9('0x1f')]['key']};});_0x4fbfea[_0x04a9('0x20')]=_['map'](_0x575d6b,_0x04a9('0x1b'));_0x4fbfea[_0x04a9('0x21')]=_['keys'](_0x3e33b0[_0x04a9('0x21')]);_0x4fbfea['filters']=_[_0x04a9('0x22')](_0x4fbfea['model'],_0x4fbfea[_0x04a9('0x21')]);_0x18febf[_0x04a9('0x23')]=_[_0x04a9('0x22')](_0x4fbfea[_0x04a9('0x20')],qs[_0x04a9('0x24')](_0x3e33b0[_0x04a9('0x21')][_0x04a9('0x24')]));_0x18febf[_0x04a9('0x23')]=_0x18febf[_0x04a9('0x23')]['length']?_0x18febf[_0x04a9('0x23')]:_0x4fbfea[_0x04a9('0x20')];if(!_0x3e33b0['query'][_0x04a9('0x25')](_0x04a9('0x26'))){_0x18febf[_0x04a9('0xd')]=qs[_0x04a9('0xd')](_0x3e33b0['query']['limit']);_0x18febf[_0x04a9('0xa')]=qs['offset'](_0x3e33b0['query']['offset']);}_0x18febf[_0x04a9('0x27')]=qs[_0x04a9('0x28')](_0x3e33b0[_0x04a9('0x21')]['sort']);_0x18febf[_0x04a9('0x29')]=qs[_0x04a9('0x2a')](_['pick'](_0x3e33b0['query'],_0x4fbfea[_0x04a9('0x2a')]),_0x575d6b);if(_0x3e33b0[_0x04a9('0x21')]['filter']){_0x18febf[_0x04a9('0x29')]=_[_0x04a9('0x2b')](_0x18febf[_0x04a9('0x29')],{'$or':_[_0x04a9('0x2c')](_0x575d6b,function(_0x598c56){if(_0x598c56['type']!==_0x04a9('0x2d')){var _0x2f20e4={};_0x2f20e4[_0x598c56['name']]={'$like':'%'+_0x3e33b0['query'][_0x04a9('0x2e')]+'%'};return _0x2f20e4;}})});}_0x18febf=_[_0x04a9('0x2b')]({},_0x18febf,_0x3e33b0[_0x04a9('0x2f')]);var _0x308de7={'where':_0x18febf['where']};return db[_0x04a9('0x1d')][_0x04a9('0xc')](_0x308de7)['then'](function(_0x4ccee9){_0x24d176[_0x04a9('0xc')]=_0x4ccee9;if(_0x3e33b0['query'][_0x04a9('0x30')]){_0x18febf[_0x04a9('0x31')]=[{'all':!![]}];}return db[_0x04a9('0x1d')][_0x04a9('0x32')](_0x18febf);})['then'](function(_0x79c49b){_0x24d176[_0x04a9('0x33')]=_0x79c49b;return _0x24d176;})[_0x04a9('0x11')](respondWithFilteredResult(_0x1ea50a,_0x18febf))[_0x04a9('0x34')](handleError(_0x1ea50a,null));};exports[_0x04a9('0x35')]=function(_0x55961f,_0x3e4bc6){var _0xd708c9={'raw':![],'where':{'id':_0x55961f[_0x04a9('0x36')]['id']}},_0x29e91f={};_0x29e91f[_0x04a9('0x20')]=_[_0x04a9('0x37')](db[_0x04a9('0x1d')][_0x04a9('0x1e')]);_0x29e91f[_0x04a9('0x21')]=_[_0x04a9('0x37')](_0x55961f[_0x04a9('0x21')]);_0x29e91f[_0x04a9('0x2a')]=_['intersection'](_0x29e91f[_0x04a9('0x20')],_0x29e91f[_0x04a9('0x21')]);_0xd708c9[_0x04a9('0x23')]=_[_0x04a9('0x22')](_0x29e91f[_0x04a9('0x20')],qs[_0x04a9('0x24')](_0x55961f[_0x04a9('0x21')][_0x04a9('0x24')]));_0xd708c9['attributes']=_0xd708c9[_0x04a9('0x23')][_0x04a9('0x38')]?_0xd708c9[_0x04a9('0x23')]:_0x29e91f['model'];if(_0x55961f['query'][_0x04a9('0x30')]){_0xd708c9[_0x04a9('0x31')]=[{'all':!![]}];}_0xd708c9=_['merge']({},_0xd708c9,_0x55961f[_0x04a9('0x2f')]);return db['SquareProject'][_0x04a9('0x39')](_0xd708c9)['then'](handleEntityNotFound(_0x3e4bc6,null))[_0x04a9('0x11')](respondWithResult(_0x3e4bc6,null))[_0x04a9('0x34')](handleError(_0x3e4bc6,null));};exports['create']=function(_0x291ee8,_0x1cc56f){return db['SquareProject'][_0x04a9('0x3a')](_0x291ee8['body'],{})[_0x04a9('0x11')](function(_0xeaec5d){var _0x15339b=_0x291ee8[_0x04a9('0x3b')]['get']({'plain':!![]});if(!_0x15339b)throw new Error(_0x04a9('0x3c'));if(_0x15339b[_0x04a9('0x3d')]==='user'){var _0x8da26f=_0xeaec5d[_0x04a9('0x13')]({'plain':!![]});var _0x2f75ec='SquareProjects';return db[_0x04a9('0x3e')][_0x04a9('0x39')]({'where':{'name':_0x2f75ec,'userProfileId':_0x15339b[_0x04a9('0x3f')]},'raw':!![]})[_0x04a9('0x11')](function(_0x1a08b4){if(_0x1a08b4&&_0x1a08b4[_0x04a9('0x40')]===0x0){return db[_0x04a9('0x41')]['create']({'name':_0x8da26f[_0x04a9('0x1b')],'resourceId':_0x8da26f['id'],'type':_0x1a08b4[_0x04a9('0x1b')],'sectionId':_0x1a08b4['id']},{})['then'](function(){return _0xeaec5d;});}else{return _0xeaec5d;}})['catch'](function(_0x1a8183){logger[_0x04a9('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a8183);throw _0x1a8183;});}return _0xeaec5d;})[_0x04a9('0x11')](respondWithResult(_0x1cc56f,0xc9))[_0x04a9('0x34')](handleError(_0x1cc56f,null));};exports['update']=function(_0x1a2804,_0x28696c){if(_0x1a2804[_0x04a9('0x42')]['id']){delete _0x1a2804[_0x04a9('0x42')]['id'];}return db[_0x04a9('0x1d')][_0x04a9('0x39')]({'where':{'id':_0x1a2804['params']['id']}})['then'](handleEntityNotFound(_0x28696c,null))['then'](saveUpdates(_0x1a2804[_0x04a9('0x42')],null))['then'](function(_0x777dfa){if(!_0x777dfa)return;var _0x362e3f=_0x777dfa['get']({'plain':!![]});return _0x362e3f;})[_0x04a9('0x11')](function(_0x57dee9){var _0x12d551=new Redis(config['redis']);_0x12d551[_0x04a9('0x15')](_0x04a9('0x43'),JSON['stringify'](_['pick'](_0x57dee9,['id',_0x04a9('0x1b'),_0x04a9('0x44')])));return _0x57dee9;})[_0x04a9('0x11')](respondWithResult(_0x28696c,null))['catch'](handleError(_0x28696c,null));};exports['destroy']=function(_0x202cf7,_0x368979){return db[_0x04a9('0x1d')][_0x04a9('0x39')]({'where':{'id':_0x202cf7[_0x04a9('0x36')]['id']}})[_0x04a9('0x11')](handleEntityNotFound(_0x368979,null))[_0x04a9('0x11')](removeEntity(_0x368979,null))['catch'](handleError(_0x368979,null));}; \ No newline at end of file +var _0x4e84=['include','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','production','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','json','limit','undefined','count','offset','set','update','then','get','UserProfileResource','destroy','publish','agi','stringify','end','sendStatus','error','stack','name','index','SquareProject','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x4e84,0x1f3));var _0x44e8=function(_0x41ed04,_0x12bedd){_0x41ed04=_0x41ed04-0x0;var _0x2ce605=_0x4e84[_0x41ed04];return _0x2ce605;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x44e8('0x0'));var logger=require(_0x44e8('0x1'))(_0x44e8('0x2'));var config=require(_0x44e8('0x3'));var db=require('../../mysqldb')['db'];config[_0x44e8('0x4')]=_[_0x44e8('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x44e8('0x6'))(new Redis(config['redis']));require(_0x44e8('0x7'))[_0x44e8('0x8')](socket);function respondWithResult(_0x4b91fa,_0x4d4478){_0x4d4478=_0x4d4478||0xc8;return function(_0x2e2990){if(_0x2e2990){return _0x4b91fa[_0x44e8('0x9')](_0x4d4478)[_0x44e8('0xa')](_0x2e2990);}};}function respondWithFilteredResult(_0x590e5b,_0x3e125e){return function(_0x2fff8e){if(_0x2fff8e){var _0x4ff629=typeof _0x3e125e['offset']==='undefined'&&typeof _0x3e125e[_0x44e8('0xb')]===_0x44e8('0xc');var _0x4051d1=_0x2fff8e[_0x44e8('0xd')];var _0x58737b=_0x4ff629?0x0:_0x3e125e['offset'];var _0x2c622e=_0x4ff629?_0x2fff8e[_0x44e8('0xd')]:_0x3e125e[_0x44e8('0xe')]+_0x3e125e[_0x44e8('0xb')];var _0x14c230;if(_0x2c622e>=_0x4051d1){_0x2c622e=_0x4051d1;_0x14c230=0xc8;}else{_0x14c230=0xce;}_0x590e5b['status'](_0x14c230);return _0x590e5b[_0x44e8('0xf')]('Content-Range',_0x58737b+'-'+_0x2c622e+'/'+_0x4051d1)[_0x44e8('0xa')](_0x2fff8e);}return null;};}function saveUpdates(_0x38dbcb){return function(_0x3a921f){if(_0x3a921f){return _0x3a921f[_0x44e8('0x10')](_0x38dbcb)[_0x44e8('0x11')](function(_0x4d9689){return _0x4d9689;});}return null;};}function removeEntity(_0x2e6042){return function(_0x27452d){if(_0x27452d){return _0x27452d['destroy']()[_0x44e8('0x11')](function(){var _0x176fa4=_0x27452d[_0x44e8('0x12')]({'plain':!![]});var _0x5e74b6='SquareProjects';return db[_0x44e8('0x13')][_0x44e8('0x14')]({'where':{'type':_0x5e74b6,'resourceId':_0x176fa4['id']}})['then'](function(){return _0x27452d;});})[_0x44e8('0x11')](function(){var _0x284666=new Redis(config[_0x44e8('0x4')]);_0x284666[_0x44e8('0x15')](_0x44e8('0x16'),JSON[_0x44e8('0x17')]({'id':_0x27452d['id'],'deleted':!![]}));})[_0x44e8('0x11')](function(){_0x2e6042['status'](0xcc)[_0x44e8('0x18')]();});}};}function handleEntityNotFound(_0x315fd4){return function(_0x298ada){if(!_0x298ada){_0x315fd4[_0x44e8('0x19')](0x194);}return _0x298ada;};}function handleError(_0x113eba,_0x342232){_0x342232=_0x342232||0x1f4;return function(_0xeffeac){logger[_0x44e8('0x1a')](_0xeffeac[_0x44e8('0x1b')]);if(_0xeffeac[_0x44e8('0x1c')]){delete _0xeffeac['name'];}_0x113eba['status'](_0x342232)['send'](_0xeffeac);};}exports[_0x44e8('0x1d')]=function(_0x37a22c,_0x1d9022){var _0x3c150c={},_0x1602d5={},_0x371c04={'count':0x0,'rows':[]};var _0x27df64=_['map'](db[_0x44e8('0x1e')][_0x44e8('0x1f')],function(_0x15c867){return{'name':_0x15c867[_0x44e8('0x20')],'type':_0x15c867[_0x44e8('0x21')][_0x44e8('0x22')]};});_0x1602d5[_0x44e8('0x23')]=_[_0x44e8('0x24')](_0x27df64,_0x44e8('0x1c'));_0x1602d5['query']=_[_0x44e8('0x25')](_0x37a22c[_0x44e8('0x26')]);_0x1602d5[_0x44e8('0x27')]=_[_0x44e8('0x28')](_0x1602d5[_0x44e8('0x23')],_0x1602d5[_0x44e8('0x26')]);_0x3c150c[_0x44e8('0x29')]=_[_0x44e8('0x28')](_0x1602d5[_0x44e8('0x23')],qs[_0x44e8('0x2a')](_0x37a22c[_0x44e8('0x26')][_0x44e8('0x2a')]));_0x3c150c[_0x44e8('0x29')]=_0x3c150c[_0x44e8('0x29')][_0x44e8('0x2b')]?_0x3c150c[_0x44e8('0x29')]:_0x1602d5['model'];if(!_0x37a22c[_0x44e8('0x26')][_0x44e8('0x2c')](_0x44e8('0x2d'))){_0x3c150c['limit']=qs[_0x44e8('0xb')](_0x37a22c['query'][_0x44e8('0xb')]);_0x3c150c[_0x44e8('0xe')]=qs[_0x44e8('0xe')](_0x37a22c[_0x44e8('0x26')][_0x44e8('0xe')]);}_0x3c150c['order']=qs['sort'](_0x37a22c[_0x44e8('0x26')][_0x44e8('0x2e')]);_0x3c150c['where']=qs[_0x44e8('0x27')](_['pick'](_0x37a22c['query'],_0x1602d5[_0x44e8('0x27')]),_0x27df64);if(_0x37a22c[_0x44e8('0x26')][_0x44e8('0x2f')]){_0x3c150c[_0x44e8('0x30')]=_[_0x44e8('0x31')](_0x3c150c[_0x44e8('0x30')],{'$or':_[_0x44e8('0x24')](_0x27df64,function(_0x13b7f9){if(_0x13b7f9[_0x44e8('0x21')]!==_0x44e8('0x32')){var _0xf694d2={};_0xf694d2[_0x13b7f9[_0x44e8('0x1c')]]={'$like':'%'+_0x37a22c['query'][_0x44e8('0x2f')]+'%'};return _0xf694d2;}})});}_0x3c150c=_['merge']({},_0x3c150c,_0x37a22c[_0x44e8('0x33')]);var _0x3cef5f={'where':_0x3c150c['where']};return db[_0x44e8('0x1e')][_0x44e8('0xd')](_0x3cef5f)[_0x44e8('0x11')](function(_0x4a6d4f){_0x371c04['count']=_0x4a6d4f;if(_0x37a22c[_0x44e8('0x26')][_0x44e8('0x34')]){_0x3c150c[_0x44e8('0x35')]=[{'all':!![]}];}return db[_0x44e8('0x1e')]['findAll'](_0x3c150c);})[_0x44e8('0x11')](function(_0x112265){_0x371c04['rows']=_0x112265;return _0x371c04;})['then'](respondWithFilteredResult(_0x1d9022,_0x3c150c))[_0x44e8('0x36')](handleError(_0x1d9022,null));};exports[_0x44e8('0x37')]=function(_0x2175d5,_0x22816a){var _0x3dd397={'raw':![],'where':{'id':_0x2175d5['params']['id']}},_0x38ca9c={};_0x38ca9c[_0x44e8('0x23')]=_[_0x44e8('0x25')](db[_0x44e8('0x1e')][_0x44e8('0x1f')]);_0x38ca9c[_0x44e8('0x26')]=_['keys'](_0x2175d5[_0x44e8('0x26')]);_0x38ca9c['filters']=_['intersection'](_0x38ca9c[_0x44e8('0x23')],_0x38ca9c[_0x44e8('0x26')]);_0x3dd397['attributes']=_[_0x44e8('0x28')](_0x38ca9c[_0x44e8('0x23')],qs[_0x44e8('0x2a')](_0x2175d5['query']['fields']));_0x3dd397[_0x44e8('0x29')]=_0x3dd397[_0x44e8('0x29')][_0x44e8('0x2b')]?_0x3dd397['attributes']:_0x38ca9c[_0x44e8('0x23')];if(_0x2175d5[_0x44e8('0x26')][_0x44e8('0x34')]){_0x3dd397[_0x44e8('0x35')]=[{'all':!![]}];}_0x3dd397=_[_0x44e8('0x31')]({},_0x3dd397,_0x2175d5[_0x44e8('0x33')]);return db[_0x44e8('0x1e')][_0x44e8('0x38')](_0x3dd397)[_0x44e8('0x11')](handleEntityNotFound(_0x22816a,null))[_0x44e8('0x11')](respondWithResult(_0x22816a,null))['catch'](handleError(_0x22816a,null));};exports[_0x44e8('0x39')]=function(_0x3cda24,_0x4a773a){return db[_0x44e8('0x1e')]['create'](_0x3cda24[_0x44e8('0x3a')],{})[_0x44e8('0x11')](function(_0x88bfef){var _0x2fa6ec=_0x3cda24[_0x44e8('0x3b')][_0x44e8('0x12')]({'plain':!![]});if(!_0x2fa6ec)throw new Error(_0x44e8('0x3c'));if(_0x2fa6ec[_0x44e8('0x3d')]===_0x44e8('0x3b')){var _0x34f927=_0x88bfef[_0x44e8('0x12')]({'plain':!![]});var _0x5f6ad6=_0x44e8('0x3e');return db[_0x44e8('0x3f')][_0x44e8('0x38')]({'where':{'name':_0x5f6ad6,'userProfileId':_0x2fa6ec[_0x44e8('0x40')]},'raw':!![]})[_0x44e8('0x11')](function(_0x268664){if(_0x268664&&_0x268664[_0x44e8('0x41')]===0x0){return db['UserProfileResource'][_0x44e8('0x39')]({'name':_0x34f927['name'],'resourceId':_0x34f927['id'],'type':_0x268664[_0x44e8('0x1c')],'sectionId':_0x268664['id']},{})[_0x44e8('0x11')](function(){return _0x88bfef;});}else{return _0x88bfef;}})[_0x44e8('0x36')](function(_0xb01723){logger[_0x44e8('0x1a')](_0x44e8('0x42'),_0xb01723);throw _0xb01723;});}return _0x88bfef;})['then'](respondWithResult(_0x4a773a,0xc9))[_0x44e8('0x36')](handleError(_0x4a773a,null));};exports[_0x44e8('0x10')]=function(_0x163df5,_0x48ecc9){if(_0x163df5[_0x44e8('0x3a')]['id']){delete _0x163df5[_0x44e8('0x3a')]['id'];}return db[_0x44e8('0x1e')][_0x44e8('0x38')]({'where':{'id':_0x163df5['params']['id']}})[_0x44e8('0x11')](handleEntityNotFound(_0x48ecc9,null))[_0x44e8('0x11')](saveUpdates(_0x163df5[_0x44e8('0x3a')],null))[_0x44e8('0x11')](function(_0x178ebc){if(!_0x178ebc)return;var _0x27e381=_0x178ebc['get']({'plain':!![]});return _0x27e381;})[_0x44e8('0x11')](function(_0x295551){var _0x12cd91=new Redis(config[_0x44e8('0x4')]);_0x12cd91[_0x44e8('0x15')](_0x44e8('0x16'),JSON[_0x44e8('0x17')](_[_0x44e8('0x43')](_0x295551,['id','name',_0x44e8('0x44')])));return _0x295551;})[_0x44e8('0x11')](respondWithResult(_0x48ecc9,null))[_0x44e8('0x36')](handleError(_0x48ecc9,null));};exports[_0x44e8('0x14')]=function(_0x55934c,_0x23cb22){return db[_0x44e8('0x1e')]['find']({'where':{'id':_0x55934c['params']['id']}})[_0x44e8('0x11')](handleEntityNotFound(_0x23cb22,null))[_0x44e8('0x11')](removeEntity(_0x23cb22,null))[_0x44e8('0x36')](handleError(_0x23cb22,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0362317..dcfb6ee 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 _0x68ab=['update','remove','emit','hook','exports','events','SquareProject','setMaxListeners','save'];(function(_0x4565eb,_0x167f79){var _0x67832=function(_0x5322ff){while(--_0x5322ff){_0x4565eb['push'](_0x4565eb['shift']());}};_0x67832(++_0x167f79);}(_0x68ab,0xa7));var _0xb68a=function(_0xa31086,_0xdc718a){_0xa31086=_0xa31086-0x0;var _0x732df0=_0x68ab[_0xa31086];return _0x732df0;};'use strict';var EventEmitter=require(_0xb68a('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xb68a('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb68a('0x2')](0x0);var events={'afterCreate':_0xb68a('0x3'),'afterUpdate':_0xb68a('0x4'),'afterDestroy':_0xb68a('0x5')};function emitEvent(_0xc02683){return function(_0x45bbb4,_0x51f26b,_0x3b20c1){SquareProjectEvents[_0xb68a('0x6')](_0xc02683+':'+_0x45bbb4['id'],_0x45bbb4);SquareProjectEvents[_0xb68a('0x6')](_0xc02683,_0x45bbb4);_0x3b20c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb68a('0x7')](e,emitEvent(event));}}module[_0xb68a('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x1010=['emit','hasOwnProperty','hook','events','update','remove'];(function(_0xd38ea,_0x2ce553){var _0x2d0b30=function(_0x29a265){while(--_0x29a265){_0xd38ea['push'](_0xd38ea['shift']());}};_0x2d0b30(++_0x2ce553);}(_0x1010,0x99));var _0x0101=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1010[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x0101('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0101('0x1'),'afterDestroy':_0x0101('0x2')};function emitEvent(_0x206bc3){return function(_0x2d3cb7,_0x3b79dc,_0x4d7fc2){SquareProjectEvents[_0x0101('0x3')](_0x206bc3+':'+_0x2d3cb7['id'],_0x2d3cb7);SquareProjectEvents['emit'](_0x206bc3,_0x2d3cb7);_0x4d7fc2(null);};}for(var e in events){if(events[_0x0101('0x4')](e)){var event=events[e];SquareProject[_0x0101('0x5')](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 7ff0e32..43500a6 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 _0x6742=['bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment'];(function(_0x114ca2,_0x4b8045){var _0x4bab83=function(_0x17e7ed){while(--_0x17e7ed){_0x114ca2['push'](_0x114ca2['shift']());}};_0x4bab83(++_0x4b8045);}(_0x6742,0x8d));var _0x2674=function(_0x53cb50,_0x48dbcc){_0x53cb50=_0x53cb50-0x0;var _0x4522d3=_0x6742[_0x53cb50];return _0x4522d3;};'use strict';var _=require(_0x2674('0x0'));var util=require('util');var logger=require(_0x2674('0x1'))('api');var moment=require(_0x2674('0x2'));var BPromise=require(_0x2674('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2674('0x4'));var rimraf=require(_0x2674('0x5'));var config=require(_0x2674('0x6'));var attributes=require(_0x2674('0x7'));module[_0x2674('0x8')]=function(_0x22bf01,_0x1b7405){return _0x22bf01[_0x2674('0x9')](_0x2674('0xa'),attributes,{'tableName':_0x2674('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x100742,_0x293521,_0x6d9dfd){if(_0x100742[_0x2674('0xc')]('preproduction')){_0x100742[_0x2674('0xd')]=moment()[_0x2674('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x100742['changed'](_0x2674('0xf'))){_0x100742[_0x2674('0x10')]=moment()[_0x2674('0xe')](_0x2674('0x11'));}_0x6d9dfd(null,_0x100742);}}});}; \ No newline at end of file +var _0x355b=['SquareProject','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0x355b,0x170));var _0xb355=function(_0x59ceba,_0x1ad861){_0x59ceba=_0x59ceba-0x0;var _0x32f474=_0x355b[_0x59ceba];return _0x32f474;};'use strict';var _=require(_0xb355('0x0'));var util=require(_0xb355('0x1'));var logger=require(_0xb355('0x2'))(_0xb355('0x3'));var moment=require(_0xb355('0x4'));var BPromise=require('bluebird');var rp=require(_0xb355('0x5'));var fs=require('fs');var path=require(_0xb355('0x6'));var rimraf=require(_0xb355('0x7'));var config=require(_0xb355('0x8'));var attributes=require(_0xb355('0x9'));module[_0xb355('0xa')]=function(_0x5bbd26,_0x2af0aa){return _0x5bbd26[_0xb355('0xb')](_0xb355('0xc'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c342a,_0x608f2a,_0x24e069){if(_0x2c342a['changed'](_0xb355('0xd'))){_0x2c342a[_0xb355('0xe')]=moment()[_0xb355('0xf')](_0xb355('0x10'));}if(_0x2c342a[_0xb355('0x11')](_0xb355('0x12'))){_0x2c342a[_0xb355('0x13')]=moment()[_0xb355('0xf')](_0xb355('0x10'));}_0x24e069(null,_0x2c342a);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 6330ade..234766b 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 _0x6de3=['then','debug','stringify','lodash','ioredis','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','SquareProject','findAll','options','raw','where','limit','map','include','model','attributes','info','GetSquareProjects','catch','error','message','ShowSquareProject','find'];(function(_0x345a6d,_0x137f9a){var _0x2b4df7=function(_0x20ba5c){while(--_0x20ba5c){_0x345a6d['push'](_0x345a6d['shift']());}};_0x2b4df7(++_0x137f9a);}(_0x6de3,0x16b));var _0x36de=function(_0x376a23,_0x4b8386){_0x376a23=_0x376a23-0x0;var _0x9fa71a=_0x6de3[_0x376a23];return _0x9fa71a;};'use strict';var _=require(_0x36de('0x0'));var Redis=require(_0x36de('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x36de('0x2'))(_0x36de('0x3'));var config=require(_0x36de('0x4'));config['redis']=_[_0x36de('0x5')](config[_0x36de('0x6')],{'host':_0x36de('0x7'),'port':0x18eb});var socket=require(_0x36de('0x8'))(new Redis(config['redis']));require('./squareProject.socket')[_0x36de('0x9')](socket);exports['GetSquareProjects']=function(_0x34cf79){var _0x3aaeea=this;return new Promise(function(_0x211def,_0x472362){return db[_0x36de('0xa')][_0x36de('0xb')]({'raw':_0x34cf79[_0x36de('0xc')]?_0x34cf79['options'][_0x36de('0xd')]===undefined?!![]:![]:!![],'where':_0x34cf79['options']?_0x34cf79['options'][_0x36de('0xe')]||null:null,'attributes':_0x34cf79['options']?_0x34cf79[_0x36de('0xc')]['attributes']||null:null,'limit':_0x34cf79['options']?_0x34cf79['options'][_0x36de('0xf')]||null:null,'include':_0x34cf79[_0x36de('0xc')]?_0x34cf79[_0x36de('0xc')]['include']?_[_0x36de('0x10')](_0x34cf79[_0x36de('0xc')][_0x36de('0x11')],function(_0x19a059){return{'model':db[_0x19a059[_0x36de('0x12')]],'as':_0x19a059['as'],'attributes':_0x19a059[_0x36de('0x13')],'include':_0x19a059['include']?_['map'](_0x19a059['include'],function(_0x203c4a){return{'model':db[_0x203c4a['model']],'as':_0x203c4a['as'],'attributes':_0x203c4a[_0x36de('0x13')],'include':_0x203c4a[_0x36de('0x11')]?_['map'](_0x203c4a['include'],function(_0x3e70c1){return{'model':db[_0x3e70c1[_0x36de('0x12')]],'as':_0x3e70c1['as'],'attributes':_0x3e70c1[_0x36de('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e437d){logger[_0x36de('0x14')](_0x36de('0x15'),_0x34cf79);logger['debug'](_0x36de('0x15'),_0x34cf79,JSON['stringify'](_0x4e437d));_0x211def(_0x4e437d);})[_0x36de('0x16')](function(_0x3cef9d){logger[_0x36de('0x17')](_0x36de('0x15'),_0x3cef9d[_0x36de('0x18')],_0x34cf79);_0x472362(_0x3aaeea[_0x36de('0x17')](0x1f4,_0x3cef9d['message']));});});};exports[_0x36de('0x19')]=function(_0x277a67){var _0x2b733f=this;return new Promise(function(_0x1dd3bd,_0x5cead3){return db[_0x36de('0xa')][_0x36de('0x1a')]({'raw':_0x277a67[_0x36de('0xc')]?_0x277a67[_0x36de('0xc')][_0x36de('0xd')]===undefined?!![]:![]:!![],'where':_0x277a67['options']?_0x277a67['options'][_0x36de('0xe')]||null:null,'attributes':_0x277a67[_0x36de('0xc')]?_0x277a67[_0x36de('0xc')][_0x36de('0x13')]||null:null,'include':_0x277a67[_0x36de('0xc')]?_0x277a67[_0x36de('0xc')][_0x36de('0x11')]?_[_0x36de('0x10')](_0x277a67[_0x36de('0xc')][_0x36de('0x11')],function(_0x4c7362){return{'model':db[_0x4c7362[_0x36de('0x12')]],'as':_0x4c7362['as'],'attributes':_0x4c7362[_0x36de('0x13')],'include':_0x4c7362[_0x36de('0x11')]?_[_0x36de('0x10')](_0x4c7362[_0x36de('0x11')],function(_0x18f3a3){return{'model':db[_0x18f3a3['model']],'as':_0x18f3a3['as'],'attributes':_0x18f3a3['attributes'],'include':_0x18f3a3[_0x36de('0x11')]?_[_0x36de('0x10')](_0x18f3a3['include'],function(_0x27aa89){return{'model':db[_0x27aa89[_0x36de('0x12')]],'as':_0x27aa89['as'],'attributes':_0x27aa89[_0x36de('0x13')]};}):[]};}):[]};}):[]:[]})[_0x36de('0x1b')](function(_0x41fb65){logger[_0x36de('0x14')](_0x36de('0x19'),_0x277a67);logger[_0x36de('0x1c')](_0x36de('0x19'),_0x277a67,JSON[_0x36de('0x1d')](_0x41fb65));_0x1dd3bd(_0x41fb65);})[_0x36de('0x16')](function(_0x5445f0){logger['error'](_0x36de('0x19'),_0x5445f0[_0x36de('0x18')],_0x277a67);_0x5cead3(_0x2b733f[_0x36de('0x17')](0x1f4,_0x5445f0[_0x36de('0x18')]));});});}; \ No newline at end of file +var _0xb1f5=['./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','ShowSquareProject','find','message','lodash','ioredis','rpc','../../config/environment','redis','localhost','socket.io-emitter'];(function(_0xce44ee,_0x387d70){var _0xf97a49=function(_0x3ceab0){while(--_0x3ceab0){_0xce44ee['push'](_0xce44ee['shift']());}};_0xf97a49(++_0x387d70);}(_0xb1f5,0x1f1));var _0x5b1f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb1f5[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5b1f('0x0'));var Redis=require(_0x5b1f('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x5b1f('0x2'));var config=require(_0x5b1f('0x3'));config[_0x5b1f('0x4')]=_['defaults'](config[_0x5b1f('0x4')],{'host':_0x5b1f('0x5'),'port':0x18eb});var socket=require(_0x5b1f('0x6'))(new Redis(config['redis']));require(_0x5b1f('0x7'))[_0x5b1f('0x8')](socket);exports[_0x5b1f('0x9')]=function(_0x5a76ae){var _0x4d7599=this;return new Promise(function(_0x2b1736,_0x497a38){return db[_0x5b1f('0xa')]['findAll']({'raw':_0x5a76ae['options']?_0x5a76ae[_0x5b1f('0xb')][_0x5b1f('0xc')]===undefined?!![]:![]:!![],'where':_0x5a76ae[_0x5b1f('0xb')]?_0x5a76ae['options'][_0x5b1f('0xd')]||null:null,'attributes':_0x5a76ae[_0x5b1f('0xb')]?_0x5a76ae[_0x5b1f('0xb')][_0x5b1f('0xe')]||null:null,'limit':_0x5a76ae['options']?_0x5a76ae[_0x5b1f('0xb')][_0x5b1f('0xf')]||null:null,'include':_0x5a76ae['options']?_0x5a76ae['options']['include']?_['map'](_0x5a76ae[_0x5b1f('0xb')][_0x5b1f('0x10')],function(_0x2bae04){return{'model':db[_0x2bae04[_0x5b1f('0x11')]],'as':_0x2bae04['as'],'attributes':_0x2bae04[_0x5b1f('0xe')],'include':_0x2bae04['include']?_[_0x5b1f('0x12')](_0x2bae04[_0x5b1f('0x10')],function(_0x5a9d3c){return{'model':db[_0x5a9d3c[_0x5b1f('0x11')]],'as':_0x5a9d3c['as'],'attributes':_0x5a9d3c['attributes'],'include':_0x5a9d3c[_0x5b1f('0x10')]?_[_0x5b1f('0x12')](_0x5a9d3c[_0x5b1f('0x10')],function(_0x38f46e){return{'model':db[_0x38f46e[_0x5b1f('0x11')]],'as':_0x38f46e['as'],'attributes':_0x38f46e[_0x5b1f('0xe')]};}):[]};}):[]};}):[]:[]})[_0x5b1f('0x13')](function(_0x31f2d6){logger[_0x5b1f('0x14')](_0x5b1f('0x9'),_0x5a76ae);logger[_0x5b1f('0x15')](_0x5b1f('0x9'),_0x5a76ae,JSON[_0x5b1f('0x16')](_0x31f2d6));_0x2b1736(_0x31f2d6);})[_0x5b1f('0x17')](function(_0xfe123b){logger[_0x5b1f('0x18')](_0x5b1f('0x9'),_0xfe123b['message'],_0x5a76ae);_0x497a38(_0x4d7599[_0x5b1f('0x18')](0x1f4,_0xfe123b['message']));});});};exports[_0x5b1f('0x19')]=function(_0x2cbda8){var _0xb5129d=this;return new Promise(function(_0x2bd6d5,_0x25b15c){return db[_0x5b1f('0xa')][_0x5b1f('0x1a')]({'raw':_0x2cbda8[_0x5b1f('0xb')]?_0x2cbda8[_0x5b1f('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x2cbda8[_0x5b1f('0xb')]?_0x2cbda8[_0x5b1f('0xb')][_0x5b1f('0xd')]||null:null,'attributes':_0x2cbda8[_0x5b1f('0xb')]?_0x2cbda8[_0x5b1f('0xb')][_0x5b1f('0xe')]||null:null,'include':_0x2cbda8[_0x5b1f('0xb')]?_0x2cbda8[_0x5b1f('0xb')][_0x5b1f('0x10')]?_['map'](_0x2cbda8[_0x5b1f('0xb')][_0x5b1f('0x10')],function(_0x21de08){return{'model':db[_0x21de08[_0x5b1f('0x11')]],'as':_0x21de08['as'],'attributes':_0x21de08['attributes'],'include':_0x21de08['include']?_[_0x5b1f('0x12')](_0x21de08[_0x5b1f('0x10')],function(_0x2f9119){return{'model':db[_0x2f9119['model']],'as':_0x2f9119['as'],'attributes':_0x2f9119[_0x5b1f('0xe')],'include':_0x2f9119[_0x5b1f('0x10')]?_[_0x5b1f('0x12')](_0x2f9119[_0x5b1f('0x10')],function(_0x138f4b){return{'model':db[_0x138f4b[_0x5b1f('0x11')]],'as':_0x138f4b['as'],'attributes':_0x138f4b[_0x5b1f('0xe')]};}):[]};}):[]};}):[]:[]})[_0x5b1f('0x13')](function(_0x5f3692){logger[_0x5b1f('0x14')](_0x5b1f('0x19'),_0x2cbda8);logger[_0x5b1f('0x15')](_0x5b1f('0x19'),_0x2cbda8,JSON[_0x5b1f('0x16')](_0x5f3692));_0x2bd6d5(_0x5f3692);})[_0x5b1f('0x17')](function(_0x48dfcc){logger[_0x5b1f('0x18')](_0x5b1f('0x19'),_0x48dfcc[_0x5b1f('0x1b')],_0x2cbda8);_0x25b15c(_0xb5129d[_0x5b1f('0x18')](0x1f4,_0x48dfcc[_0x5b1f('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index e1f23af..2274866 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 _0xe58e=['emit','removeListener','register','length','./squareProject.events','save','remove'];(function(_0x12c026,_0x42aaf4){var _0x5737a8=function(_0xb54024){while(--_0xb54024){_0x12c026['push'](_0x12c026['shift']());}};_0x5737a8(++_0x42aaf4);}(_0xe58e,0x1a1));var _0xee58=function(_0x54210c,_0x25611a){_0x54210c=_0x54210c-0x0;var _0x14529c=_0xe58e[_0x54210c];return _0x14529c;};'use strict';var SquareProjectEvents=require(_0xee58('0x0'));var events=[_0xee58('0x1'),_0xee58('0x2'),'update'];function createListener(_0x36f3dd,_0xad0d89){return function(_0xf548b8){_0xad0d89[_0xee58('0x3')](_0x36f3dd,_0xf548b8);};}function removeListener(_0x414406,_0x18d0e6){return function(){SquareProjectEvents[_0xee58('0x4')](_0x414406,_0x18d0e6);};}exports[_0xee58('0x5')]=function(_0xd68f2e){for(var _0xe8433b=0x0,_0xf113a9=events[_0xee58('0x6')];_0xe8433b<_0xf113a9;_0xe8433b++){var _0x15497b=events[_0xe8433b];var _0x242ac5=createListener('squareProject:'+_0x15497b,_0xd68f2e);SquareProjectEvents['on'](_0x15497b,_0x242ac5);}}; \ No newline at end of file +var _0x52be=['save','remove','update','removeListener','./squareProject.events'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x52be,0xc7));var _0xe52b=function(_0x43b21d,_0x5d5677){_0x43b21d=_0x43b21d-0x0;var _0x1de400=_0x52be[_0x43b21d];return _0x1de400;};'use strict';var SquareProjectEvents=require(_0xe52b('0x0'));var events=[_0xe52b('0x1'),_0xe52b('0x2'),_0xe52b('0x3')];function createListener(_0x3f2534,_0xef0a78){return function(_0xcc132d){_0xef0a78['emit'](_0x3f2534,_0xcc132d);};}function removeListener(_0x2cc966,_0x69b444){return function(){SquareProjectEvents[_0xe52b('0x4')](_0x2cc966,_0x69b444);};}exports['register']=function(_0x4203eb){for(var _0x3f693f=0x0,_0x3e1a56=events['length'];_0x3f693f<_0x3e1a56;_0x3f693f++){var _0x12c491=events[_0x3f693f];var _0x2397e6=createListener('squareProject:'+_0x12c491,_0x4203eb);SquareProjectEvents['on'](_0x12c491,_0x2397e6);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e8f62e5..2f984fc 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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2b8a0e,_0x27783d){var _0x128f5d=function(_0x48cd38){while(--_0x48cd38){_0x2b8a0e['push'](_0x2b8a0e['shift']());}};_0x128f5d(++_0x27783d);}(_0xabce,0x103));var _0xeabc=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xabce[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x108f6c,_0x358f5a){var _0x38b8c8=function(_0x312ca7){while(--_0x312ca7){_0x108f6c['push'](_0x108f6c['shift']());}};_0x38b8c8(++_0x358f5a);}(_0x7a54,0x106));var _0x47a5=function(_0x56ce35,_0x33f2eb){_0x56ce35=_0x56ce35-0x0;var _0x4fb3c7=_0x7a54[_0x56ce35];return _0x4fb3c7;};'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('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('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 f80c838..ea65ef3 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf5=['lastIndexOf','exports','STRING','VIRTUAL','savePath'];(function(_0x2b87c8,_0x4cc964){var _0x26c226=function(_0x42758b){while(--_0x42758b){_0x2b87c8['push'](_0x2b87c8['shift']());}};_0x26c226(++_0x4cc964);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x382822,_0x323824){_0x382822=_0x382822-0x0;var _0x4f80d7=_0xdbf5[_0x382822];return _0x4f80d7;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'context':{'type':Sequelize[_0x5dbf('0x1')]},'extension':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize[_0x5dbf('0x1')]},'dnid':{'type':Sequelize[_0x5dbf('0x1')]},'projectName':{'type':Sequelize[_0x5dbf('0x1')]},'saveName':{'type':Sequelize[_0x5dbf('0x1')]},'filename':{'type':Sequelize[_0x5dbf('0x1')]},'savePath':{'type':Sequelize[_0x5dbf('0x1')]},'format':{'type':Sequelize[_0x5dbf('0x2')],'get':function(){var _0x88128e='';var _0x93e657=this['getDataValue'](_0x5dbf('0x3'));if(_0x93e657){_0x88128e=_0x93e657['substring'](_0x93e657[_0x5dbf('0x4')]('.'));}return _0x88128e;}}}; \ No newline at end of file +var _0x8d0e=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0x50ed0b,_0x2885d9){var _0x15c1bf=function(_0xe1afb5){while(--_0xe1afb5){_0x50ed0b['push'](_0x50ed0b['shift']());}};_0x15c1bf(++_0x2885d9);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x1d6ed2,_0x155f9f){_0x1d6ed2=_0x1d6ed2-0x0;var _0x39d517=_0x8d0e[_0x1d6ed2];return _0x39d517;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'callerid':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'context':{'type':Sequelize[_0xe8d0('0x2')]},'extension':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize[_0xe8d0('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xe8d0('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xe8d0('0x2')]},'format':{'type':Sequelize[_0xe8d0('0x3')],'get':function(){var _0x469d37='';var _0xcc03d0=this[_0xe8d0('0x4')](_0xe8d0('0x5'));if(_0xcc03d0){_0x469d37=_0xcc03d0[_0xe8d0('0x6')](_0xcc03d0[_0xe8d0('0x7')]('.'));}return _0x469d37;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1b4a39f..a1f3f98 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 _0x78fb=['then','destroy','error','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','keys','fields','find','catch','create','body','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','SquareRecording\x20not\x20found','extname','download','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update'];(function(_0x57e86d,_0x3379c0){var _0x380b0f=function(_0x2409f6){while(--_0x2409f6){_0x57e86d['push'](_0x57e86d['shift']());}};_0x380b0f(++_0x3379c0);}(_0x78fb,0xfc));var _0xb78f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x78fb[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb78f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb78f('0x1'));var rp=require(_0xb78f('0x2'));var moment=require('moment');var BPromise=require(_0xb78f('0x3'));var Mustache=require(_0xb78f('0x4'));var util=require(_0xb78f('0x5'));var path=require(_0xb78f('0x6'));var sox=require(_0xb78f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb78f('0x8'));var crypto=require(_0xb78f('0x9'));var jsforce=require(_0xb78f('0xa'));var deskjs=require(_0xb78f('0xb'));var toCsv=require(_0xb78f('0xc'));var querystring=require(_0xb78f('0xd'));var Papa=require(_0xb78f('0xe'));var Redis=require('ioredis');var authService=require(_0xb78f('0xf'));var qs=require(_0xb78f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb78f('0x11'));var logger=require(_0xb78f('0x12'))(_0xb78f('0x13'));var utils=require(_0xb78f('0x14'));var config=require(_0xb78f('0x15'));var licenseUtil=require(_0xb78f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f0b28,_0x2ca5e5){_0x2ca5e5=_0x2ca5e5||0xcc;return function(_0x2c8523){if(_0x2c8523){return _0x3f0b28[_0xb78f('0x17')](_0x2ca5e5);}return _0x3f0b28['status'](_0x2ca5e5)[_0xb78f('0x18')]();};}function respondWithResult(_0x174c4d,_0x371b3b){_0x371b3b=_0x371b3b||0xc8;return function(_0x1160d6){if(_0x1160d6){return _0x174c4d[_0xb78f('0x19')](_0x371b3b)[_0xb78f('0x1a')](_0x1160d6);}};}function respondWithFilteredResult(_0x3b3595,_0x44191e){return function(_0x1fa118){if(_0x1fa118){var _0x1ca40a=typeof _0x44191e[_0xb78f('0x1b')]==='undefined'&&typeof _0x44191e['limit']===_0xb78f('0x1c');var _0x8dd708=_0x1fa118['count'];var _0x5a947d=_0x1ca40a?0x0:_0x44191e[_0xb78f('0x1b')];var _0x17517c=_0x1ca40a?_0x1fa118[_0xb78f('0x1d')]:_0x44191e['offset']+_0x44191e[_0xb78f('0x1e')];var _0x5a865f;if(_0x17517c>=_0x8dd708){_0x17517c=_0x8dd708;_0x5a865f=0xc8;}else{_0x5a865f=0xce;}_0x3b3595[_0xb78f('0x19')](_0x5a865f);return _0x3b3595[_0xb78f('0x1f')](_0xb78f('0x20'),_0x5a947d+'-'+_0x17517c+'/'+_0x8dd708)[_0xb78f('0x1a')](_0x1fa118);}return null;};}function patchUpdates(_0x3adc0f){return function(_0x1ecdbd){try{jsonpatch['apply'](_0x1ecdbd,_0x3adc0f,!![]);}catch(_0x15aa10){return BPromise[_0xb78f('0x21')](_0x15aa10);}return _0x1ecdbd[_0xb78f('0x22')]();};}function saveUpdates(_0x15e1c9,_0x167152){return function(_0xc368f1){if(_0xc368f1){return _0xc368f1[_0xb78f('0x23')](_0x15e1c9)[_0xb78f('0x24')](function(_0x180368){return _0x180368;});}return null;};}function removeEntity(_0x54af99,_0x15dcc5){return function(_0x3fee3a){if(_0x3fee3a){return _0x3fee3a[_0xb78f('0x25')]()[_0xb78f('0x24')](function(){_0x54af99[_0xb78f('0x19')](0xcc)[_0xb78f('0x18')]();});}};}function handleEntityNotFound(_0x2e24a2,_0x176bb1){return function(_0x4f61ff){if(!_0x4f61ff){_0x2e24a2[_0xb78f('0x17')](0x194);}return _0x4f61ff;};}function handleError(_0x3aa518,_0x306f49){_0x306f49=_0x306f49||0x1f4;return function(_0x39abba){logger[_0xb78f('0x26')](_0x39abba['stack']);if(_0x39abba['name']){delete _0x39abba[_0xb78f('0x27')];}_0x3aa518['status'](_0x306f49)['send'](_0x39abba);};}exports[_0xb78f('0x28')]=function(_0x48ea34,_0xecc1b){var _0x5d3e3e={},_0x319204={},_0x5f0cba={'count':0x0,'rows':[]};var _0x56020f=_[_0xb78f('0x29')](db[_0xb78f('0x2a')][_0xb78f('0x2b')],function(_0x1c7b60){return{'name':_0x1c7b60[_0xb78f('0x2c')],'type':_0x1c7b60[_0xb78f('0x2d')][_0xb78f('0x2e')]};});_0x319204[_0xb78f('0x2f')]=_[_0xb78f('0x29')](_0x56020f,_0xb78f('0x27'));_0x319204['query']=_['keys'](_0x48ea34[_0xb78f('0x30')]);_0x319204[_0xb78f('0x31')]=_['intersection'](_0x319204['model'],_0x319204[_0xb78f('0x30')]);_0x5d3e3e[_0xb78f('0x32')]=_[_0xb78f('0x33')](_0x319204[_0xb78f('0x2f')],qs['fields'](_0x48ea34[_0xb78f('0x30')]['fields']));_0x5d3e3e[_0xb78f('0x32')]=_0x5d3e3e['attributes'][_0xb78f('0x34')]?_0x5d3e3e['attributes']:_0x319204['model'];if(!_0x48ea34[_0xb78f('0x30')][_0xb78f('0x35')](_0xb78f('0x36'))){_0x5d3e3e[_0xb78f('0x1e')]=qs[_0xb78f('0x1e')](_0x48ea34[_0xb78f('0x30')][_0xb78f('0x1e')]);_0x5d3e3e[_0xb78f('0x1b')]=qs[_0xb78f('0x1b')](_0x48ea34[_0xb78f('0x30')]['offset']);}_0x5d3e3e[_0xb78f('0x37')]=qs[_0xb78f('0x38')](_0x48ea34[_0xb78f('0x30')][_0xb78f('0x38')]);_0x5d3e3e[_0xb78f('0x39')]=qs[_0xb78f('0x31')](_[_0xb78f('0x3a')](_0x48ea34[_0xb78f('0x30')],_0x319204[_0xb78f('0x31')]),_0x56020f);if(_0x48ea34[_0xb78f('0x30')][_0xb78f('0x3b')]){_0x5d3e3e['where']=_[_0xb78f('0x3c')](_0x5d3e3e[_0xb78f('0x39')],{'$or':_[_0xb78f('0x29')](_0x56020f,function(_0x5bf7dc){if(_0x5bf7dc[_0xb78f('0x2d')]!==_0xb78f('0x3d')){var _0x321986={};_0x321986[_0x5bf7dc[_0xb78f('0x27')]]={'$like':'%'+_0x48ea34[_0xb78f('0x30')][_0xb78f('0x3b')]+'%'};return _0x321986;}})});}_0x5d3e3e=_[_0xb78f('0x3c')]({},_0x5d3e3e,_0x48ea34[_0xb78f('0x3e')]);var _0x58dc33={'where':_0x5d3e3e[_0xb78f('0x39')]};return db['SquareRecording'][_0xb78f('0x1d')](_0x58dc33)[_0xb78f('0x24')](function(_0x4d3073){_0x5f0cba[_0xb78f('0x1d')]=_0x4d3073;if(_0x48ea34[_0xb78f('0x30')][_0xb78f('0x3f')]){_0x5d3e3e['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x5d3e3e);})[_0xb78f('0x24')](function(_0x5f1c15){_0x5f0cba[_0xb78f('0x40')]=_0x5f1c15;return _0x5f0cba;})[_0xb78f('0x24')](respondWithFilteredResult(_0xecc1b,_0x5d3e3e))['catch'](handleError(_0xecc1b,null));};exports['show']=function(_0x58fab1,_0x117459){var _0x4142c0={'raw':!![],'where':{'id':_0x58fab1[_0xb78f('0x41')]['id']}},_0x1e0b59={};_0x1e0b59[_0xb78f('0x2f')]=_[_0xb78f('0x42')](db[_0xb78f('0x2a')][_0xb78f('0x2b')]);_0x1e0b59[_0xb78f('0x30')]=_['keys'](_0x58fab1[_0xb78f('0x30')]);_0x1e0b59[_0xb78f('0x31')]=_[_0xb78f('0x33')](_0x1e0b59[_0xb78f('0x2f')],_0x1e0b59[_0xb78f('0x30')]);_0x4142c0['attributes']=_[_0xb78f('0x33')](_0x1e0b59[_0xb78f('0x2f')],qs[_0xb78f('0x43')](_0x58fab1['query'][_0xb78f('0x43')]));_0x4142c0[_0xb78f('0x32')]=_0x4142c0[_0xb78f('0x32')][_0xb78f('0x34')]?_0x4142c0[_0xb78f('0x32')]:_0x1e0b59[_0xb78f('0x2f')];if(_0x58fab1[_0xb78f('0x30')]['includeAll']){_0x4142c0['include']=[{'all':!![]}];}_0x4142c0=_[_0xb78f('0x3c')]({},_0x4142c0,_0x58fab1[_0xb78f('0x3e')]);return db['SquareRecording'][_0xb78f('0x44')](_0x4142c0)[_0xb78f('0x24')](handleEntityNotFound(_0x117459,null))['then'](respondWithResult(_0x117459,null))[_0xb78f('0x45')](handleError(_0x117459,null));};exports['create']=function(_0x2ed50e,_0x1ed837){return db[_0xb78f('0x2a')][_0xb78f('0x46')](_0x2ed50e[_0xb78f('0x47')],{})[_0xb78f('0x24')](respondWithResult(_0x1ed837,0xc9))[_0xb78f('0x45')](handleError(_0x1ed837,null));};exports['update']=function(_0x38657c,_0x972c27){if(_0x38657c['body']['id']){delete _0x38657c[_0xb78f('0x47')]['id'];}return db['SquareRecording'][_0xb78f('0x44')]({'where':{'id':_0x38657c[_0xb78f('0x41')]['id']}})[_0xb78f('0x24')](handleEntityNotFound(_0x972c27,null))['then'](saveUpdates(_0x38657c[_0xb78f('0x47')],null))[_0xb78f('0x24')](respondWithResult(_0x972c27,null))['catch'](handleError(_0x972c27,null));};exports['download']=function(_0x48af5a,_0x72df69,_0x27116b){var _0xf9bff1=require('../../components/encryptor');var _0x5c403c=![];var _0x4174c2={};if(_0x48af5a['query'][_0xb78f('0x2d')]&&_0x48af5a[_0xb78f('0x30')][_0xb78f('0x2d')]===_0xb78f('0x48')){_0x4174c2[_0xb78f('0x48')]=_0x48af5a[_0xb78f('0x41')]['id'];}else{_0x4174c2['id']=_0x48af5a['params']['id'];}return db[_0xb78f('0x2a')][_0xb78f('0x44')]({'where':_0x4174c2,'attributes':['id',_0xb78f('0x49'),_0xb78f('0x4a')],'raw':!![]})[_0xb78f('0x24')](handleEntityNotFound(_0x72df69,null))[_0xb78f('0x24')](function(_0x2366ab){if(_0x2366ab){var _0x2b11f8=_0x2366ab[_0xb78f('0x49')];var _0x348b45=util[_0xb78f('0x4b')](_0xb78f('0x4c'),_0x2b11f8);if(fs['existsSync'](_0x348b45)){_0x5c403c=!![];return _0xf9bff1[_0xb78f('0x4d')](_0x348b45,_0x2b11f8,config[_0xb78f('0x4e')][_0xb78f('0x4f')])[_0xb78f('0x24')](function(){return _0x2366ab;});}return _0x2366ab;}})['then'](function(_0x20604b){if(_0x20604b){var _0x569527=_0x20604b[_0xb78f('0x49')];if(!fs[_0xb78f('0x50')](_0x569527)){throw new db['Sequelize']['ValidationError'](_0xb78f('0x51'));}if(_0x20604b[_0xb78f('0x4a')]){return _0x72df69['download'](_0x569527,_0x20604b['filename']+path[_0xb78f('0x52')](_0x569527),function(){if(_0x5c403c){fs['unlink'](_0x569527);}});}else{return _0x72df69[_0xb78f('0x53')](_0x569527,function(_0xb204ea){if(_0x5c403c){fs[_0xb78f('0x54')](_0x569527);}});}}})[_0xb78f('0x45')](function(_0x175b6c){if(_0x175b6c[_0xb78f('0x55')]===_0xb78f('0x51')){_0x72df69[_0xb78f('0x19')](0x194)[_0xb78f('0x56')](_0xb78f('0x57'));}else{return handleError(_0x72df69,null);}});};exports[_0xb78f('0x25')]=function(_0x1596c8,_0x4ee09a){return db[_0xb78f('0x2a')][_0xb78f('0x44')]({'where':{'id':_0x1596c8[_0xb78f('0x41')]['id']}})[_0xb78f('0x24')](function(_0x48322c){if(_[_0xb78f('0x58')](_0x48322c)){throw new ReferenceError(_0xb78f('0x59'));}return _0x48322c;})[_0xb78f('0x24')](function(_0x3c1570){var _0x1e1dfa=_0x3c1570[_0xb78f('0x49')];logger['info'](_0xb78f('0x5a'),_0x1e1dfa);if(!_[_0xb78f('0x58')](_0x3c1570[_0xb78f('0x49')])&&fs[_0xb78f('0x50')](_0x1e1dfa)){logger[_0xb78f('0x5b')](_0xb78f('0x5c')+_0x1e1dfa+_0xb78f('0x5d'));fs[_0xb78f('0x5e')](_0x1e1dfa);}_0x1e1dfa=_0x1e1dfa+_0xb78f('0x5f');if(!_['isNil'](_0x3c1570['savePath'])&&fs[_0xb78f('0x50')](_0x1e1dfa)){logger[_0xb78f('0x5b')](_0xb78f('0x5c')+_0x1e1dfa+_0xb78f('0x5d'));fs[_0xb78f('0x5e')](_0x1e1dfa);}return _0x3c1570;})[_0xb78f('0x24')](function(_0x2cf2d4){if(!_0x2cf2d4)throw new InternalError();return _0x2cf2d4[_0xb78f('0x25')]();})[_0xb78f('0x24')](function(){_0x4ee09a[_0xb78f('0x19')](0xcc)['end']();})[_0xb78f('0x45')](handleError(_0x4ee09a,null));}; \ No newline at end of file +var _0x12d6=['type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','SquareRecording','includeAll','findAll','params','include','find','catch','create','body','../../components/encryptor','savePath','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','filename','download','extname','unlink','message','SquareRecording\x20not\x20found','destroy','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','sendStatus','error','name','send','index','rawAttributes'];(function(_0x563bac,_0x219b08){var _0x1a89c7=function(_0x20b51e){while(--_0x20b51e){_0x563bac['push'](_0x563bac['shift']());}};_0x1a89c7(++_0x219b08);}(_0x12d6,0x91));var _0x612d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x12d6[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x612d('0x0'));var rimraf=require(_0x612d('0x1'));var zipdir=require(_0x612d('0x2'));var jsonpatch=require(_0x612d('0x3'));var rp=require(_0x612d('0x4'));var moment=require(_0x612d('0x5'));var BPromise=require(_0x612d('0x6'));var Mustache=require(_0x612d('0x7'));var util=require(_0x612d('0x8'));var path=require(_0x612d('0x9'));var sox=require(_0x612d('0xa'));var csv=require(_0x612d('0xb'));var ejs=require(_0x612d('0xc'));var fs=require('fs');var fs_extra=require(_0x612d('0xd'));var _=require(_0x612d('0xe'));var squel=require('squel');var crypto=require(_0x612d('0xf'));var jsforce=require(_0x612d('0x10'));var deskjs=require(_0x612d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x612d('0x12'));var Papa=require(_0x612d('0x13'));var Redis=require(_0x612d('0x14'));var authService=require(_0x612d('0x15'));var qs=require(_0x612d('0x16'));var as=require(_0x612d('0x17'));var hardwareService=require(_0x612d('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x612d('0x19'));var config=require(_0x612d('0x1a'));var licenseUtil=require(_0x612d('0x1b'));var db=require(_0x612d('0x1c'))['db'];function respondWithStatusCode(_0x1f32c2,_0x1a7b80){_0x1a7b80=_0x1a7b80||0xcc;return function(_0x3483d6){if(_0x3483d6){return _0x1f32c2['sendStatus'](_0x1a7b80);}return _0x1f32c2[_0x612d('0x1d')](_0x1a7b80)[_0x612d('0x1e')]();};}function respondWithResult(_0x2d747b,_0x58121c){_0x58121c=_0x58121c||0xc8;return function(_0x403273){if(_0x403273){return _0x2d747b['status'](_0x58121c)[_0x612d('0x1f')](_0x403273);}};}function respondWithFilteredResult(_0x50aaab,_0x31ba62){return function(_0x4c2517){if(_0x4c2517){var _0x1a38ee=typeof _0x31ba62[_0x612d('0x20')]===_0x612d('0x21')&&typeof _0x31ba62['limit']===_0x612d('0x21');var _0x3047cc=_0x4c2517[_0x612d('0x22')];var _0x100fa3=_0x1a38ee?0x0:_0x31ba62['offset'];var _0x15a59b=_0x1a38ee?_0x4c2517['count']:_0x31ba62[_0x612d('0x20')]+_0x31ba62[_0x612d('0x23')];var _0x92f397;if(_0x15a59b>=_0x3047cc){_0x15a59b=_0x3047cc;_0x92f397=0xc8;}else{_0x92f397=0xce;}_0x50aaab[_0x612d('0x1d')](_0x92f397);return _0x50aaab[_0x612d('0x24')]('Content-Range',_0x100fa3+'-'+_0x15a59b+'/'+_0x3047cc)[_0x612d('0x1f')](_0x4c2517);}return null;};}function patchUpdates(_0x2d019a){return function(_0x230467){try{jsonpatch['apply'](_0x230467,_0x2d019a,!![]);}catch(_0x357a00){return BPromise[_0x612d('0x25')](_0x357a00);}return _0x230467[_0x612d('0x26')]();};}function saveUpdates(_0x175745,_0x5afdf6){return function(_0x209310){if(_0x209310){return _0x209310[_0x612d('0x27')](_0x175745)[_0x612d('0x28')](function(_0xa4075f){return _0xa4075f;});}return null;};}function removeEntity(_0x33cce3,_0x3b1d16){return function(_0x476e9d){if(_0x476e9d){return _0x476e9d['destroy']()[_0x612d('0x28')](function(){_0x33cce3[_0x612d('0x1d')](0xcc)[_0x612d('0x1e')]();});}};}function handleEntityNotFound(_0x4c73d0,_0x7be13d){return function(_0x2bd6d6){if(!_0x2bd6d6){_0x4c73d0[_0x612d('0x29')](0x194);}return _0x2bd6d6;};}function handleError(_0x221a56,_0x154e01){_0x154e01=_0x154e01||0x1f4;return function(_0x437928){logger[_0x612d('0x2a')](_0x437928['stack']);if(_0x437928[_0x612d('0x2b')]){delete _0x437928[_0x612d('0x2b')];}_0x221a56[_0x612d('0x1d')](_0x154e01)[_0x612d('0x2c')](_0x437928);};}exports[_0x612d('0x2d')]=function(_0x2452b0,_0x28bada){var _0x57708d={},_0x39eef8={},_0x5646bd={'count':0x0,'rows':[]};var _0x284c38=_['map'](db['SquareRecording'][_0x612d('0x2e')],function(_0x54f78e){return{'name':_0x54f78e['fieldName'],'type':_0x54f78e[_0x612d('0x2f')]['key']};});_0x39eef8[_0x612d('0x30')]=_[_0x612d('0x31')](_0x284c38,_0x612d('0x2b'));_0x39eef8[_0x612d('0x32')]=_[_0x612d('0x33')](_0x2452b0[_0x612d('0x32')]);_0x39eef8[_0x612d('0x34')]=_[_0x612d('0x35')](_0x39eef8['model'],_0x39eef8[_0x612d('0x32')]);_0x57708d[_0x612d('0x36')]=_[_0x612d('0x35')](_0x39eef8[_0x612d('0x30')],qs[_0x612d('0x37')](_0x2452b0[_0x612d('0x32')][_0x612d('0x37')]));_0x57708d['attributes']=_0x57708d[_0x612d('0x36')][_0x612d('0x38')]?_0x57708d[_0x612d('0x36')]:_0x39eef8[_0x612d('0x30')];if(!_0x2452b0[_0x612d('0x32')]['hasOwnProperty'](_0x612d('0x39'))){_0x57708d[_0x612d('0x23')]=qs[_0x612d('0x23')](_0x2452b0[_0x612d('0x32')][_0x612d('0x23')]);_0x57708d[_0x612d('0x20')]=qs[_0x612d('0x20')](_0x2452b0['query'][_0x612d('0x20')]);}_0x57708d[_0x612d('0x3a')]=qs[_0x612d('0x3b')](_0x2452b0['query'][_0x612d('0x3b')]);_0x57708d[_0x612d('0x3c')]=qs['filters'](_[_0x612d('0x3d')](_0x2452b0[_0x612d('0x32')],_0x39eef8[_0x612d('0x34')]),_0x284c38);if(_0x2452b0['query'][_0x612d('0x3e')]){_0x57708d[_0x612d('0x3c')]=_[_0x612d('0x3f')](_0x57708d[_0x612d('0x3c')],{'$or':_['map'](_0x284c38,function(_0x41e8d5){if(_0x41e8d5['type']!=='VIRTUAL'){var _0x5aa0d8={};_0x5aa0d8[_0x41e8d5[_0x612d('0x2b')]]={'$like':'%'+_0x2452b0[_0x612d('0x32')]['filter']+'%'};return _0x5aa0d8;}})});}_0x57708d=_[_0x612d('0x3f')]({},_0x57708d,_0x2452b0[_0x612d('0x40')]);var _0x3a366a={'where':_0x57708d[_0x612d('0x3c')]};return db[_0x612d('0x41')]['count'](_0x3a366a)[_0x612d('0x28')](function(_0x4f2452){_0x5646bd[_0x612d('0x22')]=_0x4f2452;if(_0x2452b0[_0x612d('0x32')][_0x612d('0x42')]){_0x57708d['include']=[{'all':!![]}];}return db['SquareRecording'][_0x612d('0x43')](_0x57708d);})['then'](function(_0x1c79a9){_0x5646bd['rows']=_0x1c79a9;return _0x5646bd;})[_0x612d('0x28')](respondWithFilteredResult(_0x28bada,_0x57708d))['catch'](handleError(_0x28bada,null));};exports['show']=function(_0x4a33f5,_0x22e6ef){var _0xdae05d={'raw':!![],'where':{'id':_0x4a33f5[_0x612d('0x44')]['id']}},_0x408567={};_0x408567[_0x612d('0x30')]=_[_0x612d('0x33')](db[_0x612d('0x41')][_0x612d('0x2e')]);_0x408567[_0x612d('0x32')]=_[_0x612d('0x33')](_0x4a33f5[_0x612d('0x32')]);_0x408567[_0x612d('0x34')]=_['intersection'](_0x408567[_0x612d('0x30')],_0x408567[_0x612d('0x32')]);_0xdae05d[_0x612d('0x36')]=_[_0x612d('0x35')](_0x408567[_0x612d('0x30')],qs[_0x612d('0x37')](_0x4a33f5['query'][_0x612d('0x37')]));_0xdae05d[_0x612d('0x36')]=_0xdae05d[_0x612d('0x36')][_0x612d('0x38')]?_0xdae05d[_0x612d('0x36')]:_0x408567[_0x612d('0x30')];if(_0x4a33f5['query']['includeAll']){_0xdae05d[_0x612d('0x45')]=[{'all':!![]}];}_0xdae05d=_[_0x612d('0x3f')]({},_0xdae05d,_0x4a33f5[_0x612d('0x40')]);return db['SquareRecording'][_0x612d('0x46')](_0xdae05d)['then'](handleEntityNotFound(_0x22e6ef,null))[_0x612d('0x28')](respondWithResult(_0x22e6ef,null))[_0x612d('0x47')](handleError(_0x22e6ef,null));};exports[_0x612d('0x48')]=function(_0xe3cbb7,_0x217f4b){return db['SquareRecording'][_0x612d('0x48')](_0xe3cbb7[_0x612d('0x49')],{})[_0x612d('0x28')](respondWithResult(_0x217f4b,0xc9))[_0x612d('0x47')](handleError(_0x217f4b,null));};exports[_0x612d('0x27')]=function(_0x20af6c,_0x521084){if(_0x20af6c[_0x612d('0x49')]['id']){delete _0x20af6c[_0x612d('0x49')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x20af6c[_0x612d('0x44')]['id']}})['then'](handleEntityNotFound(_0x521084,null))[_0x612d('0x28')](saveUpdates(_0x20af6c[_0x612d('0x49')],null))[_0x612d('0x28')](respondWithResult(_0x521084,null))[_0x612d('0x47')](handleError(_0x521084,null));};exports['download']=function(_0x1e5f60,_0x22d3e4,_0x1f8845){var _0x3ce188=require(_0x612d('0x4a'));var _0x21ca6c=![];var _0x56aff3={};if(_0x1e5f60['query']['type']&&_0x1e5f60[_0x612d('0x32')][_0x612d('0x2f')]==='uniqueid'){_0x56aff3['uniqueid']=_0x1e5f60[_0x612d('0x44')]['id'];}else{_0x56aff3['id']=_0x1e5f60['params']['id'];}return db[_0x612d('0x41')][_0x612d('0x46')]({'where':_0x56aff3,'attributes':['id',_0x612d('0x4b'),'filename'],'raw':!![]})[_0x612d('0x28')](handleEntityNotFound(_0x22d3e4,null))['then'](function(_0x118174){if(_0x118174){var _0x361296=_0x118174[_0x612d('0x4b')];var _0x40e113=util[_0x612d('0x4c')](_0x612d('0x4d'),_0x361296);if(fs[_0x612d('0x4e')](_0x40e113)){_0x21ca6c=!![];return _0x3ce188['decryptFile'](_0x40e113,_0x361296,config[_0x612d('0x4f')][_0x612d('0x50')])[_0x612d('0x28')](function(){return _0x118174;});}return _0x118174;}})['then'](function(_0x1b3cd5){if(_0x1b3cd5){var _0x548836=_0x1b3cd5[_0x612d('0x4b')];if(!fs['existsSync'](_0x548836)){throw new db[(_0x612d('0x51'))][(_0x612d('0x52'))]('SquareRecording\x20not\x20found');}if(_0x1b3cd5[_0x612d('0x53')]){return _0x22d3e4[_0x612d('0x54')](_0x548836,_0x1b3cd5[_0x612d('0x53')]+path[_0x612d('0x55')](_0x548836),function(){if(_0x21ca6c){fs[_0x612d('0x56')](_0x548836);}});}else{return _0x22d3e4['download'](_0x548836,function(_0xc7d6e1){if(_0x21ca6c){fs[_0x612d('0x56')](_0x548836);}});}}})[_0x612d('0x47')](function(_0x33ebf4){if(_0x33ebf4[_0x612d('0x57')]===_0x612d('0x58')){_0x22d3e4[_0x612d('0x1d')](0x194)[_0x612d('0x2c')]('Not\x20found');}else{return handleError(_0x22d3e4,null);}});};exports[_0x612d('0x59')]=function(_0x103a13,_0x45f6ff){return db[_0x612d('0x41')]['find']({'where':{'id':_0x103a13[_0x612d('0x44')]['id']}})[_0x612d('0x28')](function(_0x1821ef){if(_['isNil'](_0x1821ef)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1821ef;})[_0x612d('0x28')](function(_0x3c7653){var _0x2d3500=_0x3c7653[_0x612d('0x4b')];logger[_0x612d('0x5a')](_0x612d('0x5b'),_0x2d3500);if(!_['isNil'](_0x3c7653['savePath'])&&fs[_0x612d('0x4e')](_0x2d3500)){logger[_0x612d('0x5a')](_0x612d('0x5c')+_0x2d3500+_0x612d('0x5d'));fs['unlinkSync'](_0x2d3500);}_0x2d3500=_0x2d3500+_0x612d('0x5e');if(!_['isNil'](_0x3c7653[_0x612d('0x4b')])&&fs[_0x612d('0x4e')](_0x2d3500)){logger['info']('File:\x20\x22'+_0x2d3500+_0x612d('0x5d'));fs[_0x612d('0x5f')](_0x2d3500);}return _0x3c7653;})[_0x612d('0x28')](function(_0x193da4){if(!_0x193da4)throw new InternalError();return _0x193da4[_0x612d('0x59')]();})[_0x612d('0x28')](function(){_0x45f6ff['status'](0xcc)[_0x612d('0x1e')]();})[_0x612d('0x47')](handleError(_0x45f6ff,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index af5c720..073f5fa 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 _0x4351=['exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x4351,0x1b5));var _0x1435=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x4351[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var logger=require(_0x1435('0x2'))(_0x1435('0x3'));var moment=require(_0x1435('0x4'));var BPromise=require(_0x1435('0x5'));var rp=require(_0x1435('0x6'));var fs=require('fs');var path=require(_0x1435('0x7'));var rimraf=require(_0x1435('0x8'));var config=require(_0x1435('0x9'));var attributes=require(_0x1435('0xa'));module[_0x1435('0xb')]=function(_0x1f0838,_0x3a9f9a){return _0x1f0838[_0x1435('0xc')]('SquareRecording',attributes,{'tableName':_0x1435('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a93=['path','define','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2f95c4,_0x3e0358){var _0x1739c3=function(_0xae2aa4){while(--_0xae2aa4){_0x2f95c4['push'](_0x2f95c4['shift']());}};_0x1739c3(++_0x3e0358);}(_0x0a93,0x6a));var _0x30a9=function(_0x887d8a,_0x37540b){_0x887d8a=_0x887d8a-0x0;var _0xfb8036=_0x0a93[_0x887d8a];return _0xfb8036;};'use strict';var _=require(_0x30a9('0x0'));var util=require(_0x30a9('0x1'));var logger=require(_0x30a9('0x2'))('api');var moment=require(_0x30a9('0x3'));var BPromise=require(_0x30a9('0x4'));var rp=require(_0x30a9('0x5'));var fs=require('fs');var path=require(_0x30a9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module['exports']=function(_0x4a7409,_0xe09c11){return _0x4a7409[_0x30a9('0x7')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 0523a3b..0abe667 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 _0x2616=['debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording','body','options','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s'];(function(_0x19d4ae,_0x43245){var _0x1193b8=function(_0x3ce6ed){while(--_0x3ce6ed){_0x19d4ae['push'](_0x19d4ae['shift']());}};_0x1193b8(++_0x43245);}(_0x2616,0x12a));var _0x6261=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0x2616[_0x2525f1];return _0x13c1b5;};'use strict';var _=require(_0x6261('0x0'));var util=require(_0x6261('0x1'));var moment=require(_0x6261('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6261('0x3'));var db=require(_0x6261('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6261('0x5'))(_0x6261('0x6'));var config=require(_0x6261('0x7'));var jayson=require(_0x6261('0x8'));var client=jayson[_0x6261('0x9')][_0x6261('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x419f6f,_0x5d1c88,_0x1ab7a6){return new BPromise(function(_0x1ff60d,_0x575585){return client['request'](_0x419f6f,_0x1ab7a6)[_0x6261('0xb')](function(_0x5bace4){logger[_0x6261('0xc')](_0x6261('0xd'),_0x5d1c88,'request\x20sent');logger[_0x6261('0xe')](_0x6261('0xf'),_0x5d1c88,_0x6261('0x10'),JSON[_0x6261('0x11')](_0x5bace4));if(_0x5bace4[_0x6261('0x12')]){if(_0x5bace4['error'][_0x6261('0x13')]===0x1f4){logger[_0x6261('0x12')](_0x6261('0xd'),_0x5d1c88,_0x5bace4[_0x6261('0x12')][_0x6261('0x14')]);return _0x575585(_0x5bace4[_0x6261('0x12')][_0x6261('0x14')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x5d1c88,_0x5bace4['error'][_0x6261('0x14')]);return _0x1ff60d(_0x5bace4[_0x6261('0x12')]['message']);}else{logger[_0x6261('0xc')](_0x6261('0xd'),_0x5d1c88,_0x6261('0x10'));_0x1ff60d(_0x5bace4[_0x6261('0x15')][_0x6261('0x14')]);}})[_0x6261('0x16')](function(_0x22bee3){logger[_0x6261('0x12')](_0x6261('0xd'),_0x5d1c88,_0x22bee3);_0x575585(_0x22bee3);});});}exports[_0x6261('0x17')]=function(_0xad2ced){var _0x5787de=this;return new Promise(function(_0x3a84df,_0x7eefa0){return db['SquareRecording']['create'](_0xad2ced[_0x6261('0x18')],{'raw':_0xad2ced[_0x6261('0x19')]?_0xad2ced[_0x6261('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x6261('0xb')](function(_0x1e3d19){logger[_0x6261('0xc')](_0x6261('0x17'),_0xad2ced);logger['debug'](_0x6261('0x17'),_0xad2ced,JSON[_0x6261('0x11')](_0x1e3d19));_0x3a84df(_0x1e3d19);})[_0x6261('0x16')](function(_0x21c778){logger['error'](_0x6261('0x17'),_0x21c778['message'],_0xad2ced);_0x7eefa0(_0x5787de[_0x6261('0x12')](0x1f4,_0x21c778[_0x6261('0x14')]));});});}; \ No newline at end of file +var _0x4e10=['SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','util','moment','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x407ffc,_0x2070b6){var _0x29a0e0=function(_0x574fef){while(--_0x574fef){_0x407ffc['push'](_0x407ffc['shift']());}};_0x29a0e0(++_0x2070b6);}(_0x4e10,0x1a1));var _0x04e1=function(_0xeeaf91,_0x542e34){_0xeeaf91=_0xeeaf91-0x0;var _0x3d5eea=_0x4e10[_0xeeaf91];return _0x3d5eea;};'use strict';var _=require('lodash');var util=require(_0x04e1('0x0'));var moment=require(_0x04e1('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(_0x04e1('0x2'));var logger=require(_0x04e1('0x3'))('rpc');var config=require(_0x04e1('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x04e1('0x5')][_0x04e1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4afe69,_0x2f84af,_0x21c047){return new BPromise(function(_0x4f019d,_0x5056ff){return client[_0x04e1('0x7')](_0x4afe69,_0x21c047)[_0x04e1('0x8')](function(_0x4cc144){logger[_0x04e1('0x9')]('SquareRecording,\x20%s,\x20%s',_0x2f84af,_0x04e1('0xa'));logger[_0x04e1('0xb')](_0x04e1('0xc'),_0x2f84af,_0x04e1('0xa'),JSON[_0x04e1('0xd')](_0x4cc144));if(_0x4cc144[_0x04e1('0xe')]){if(_0x4cc144[_0x04e1('0xe')]['code']===0x1f4){logger[_0x04e1('0xe')](_0x04e1('0xf'),_0x2f84af,_0x4cc144[_0x04e1('0xe')][_0x04e1('0x10')]);return _0x5056ff(_0x4cc144[_0x04e1('0xe')]['message']);}logger[_0x04e1('0xe')]('SquareRecording,\x20%s,\x20%s',_0x2f84af,_0x4cc144['error'][_0x04e1('0x10')]);return _0x4f019d(_0x4cc144[_0x04e1('0xe')][_0x04e1('0x10')]);}else{logger[_0x04e1('0x9')](_0x04e1('0xf'),_0x2f84af,_0x04e1('0xa'));_0x4f019d(_0x4cc144['result'][_0x04e1('0x10')]);}})[_0x04e1('0x11')](function(_0x7c927d){logger['error'](_0x04e1('0xf'),_0x2f84af,_0x7c927d);_0x5056ff(_0x7c927d);});});}exports[_0x04e1('0x12')]=function(_0x26918a){var _0x2194b0=this;return new Promise(function(_0x585422,_0x46a76a){return db[_0x04e1('0x13')][_0x04e1('0x14')](_0x26918a[_0x04e1('0x15')],{'raw':_0x26918a[_0x04e1('0x16')]?_0x26918a[_0x04e1('0x16')][_0x04e1('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4d0975){logger[_0x04e1('0x9')](_0x04e1('0x12'),_0x26918a);logger['debug'](_0x04e1('0x12'),_0x26918a,JSON[_0x04e1('0xd')](_0x4d0975));_0x585422(_0x4d0975);})['catch'](function(_0x278154){logger[_0x04e1('0xe')](_0x04e1('0x12'),_0x278154[_0x04e1('0x10')],_0x26918a);_0x46a76a(_0x2194b0['error'](0x1f4,_0x278154[_0x04e1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index c00aebf..29f3626 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +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(_0x14d005,_0xc384aa){var _0x20788e=function(_0x520b22){while(--_0x520b22){_0x14d005['push'](_0x14d005['shift']());}};_0x20788e(++_0xc384aa);}(_0xe706,0xa3));var _0x6e70=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xe706[_0x58afd5];return _0x3e503b;};'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 dc495c7..21e8954 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 _0xec7d=['BOOLEAN','exports','STRING','DATE'];(function(_0x56faaf,_0x1bd471){var _0x5ebeb8=function(_0x84eb){while(--_0x84eb){_0x56faaf['push'](_0x56faaf['shift']());}};_0x5ebeb8(++_0x1bd471);}(_0xec7d,0x99));var _0xdec7=function(_0xce1a87,_0x372c44){_0xce1a87=_0xce1a87-0x0;var _0x26669d=_0xec7d[_0xce1a87];return _0x26669d;};'use strict';var Sequelize=require('sequelize');module[_0xdec7('0x0')]={'network':{'type':Sequelize[_0xdec7('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xdec7('0x1')]},'channel':{'type':Sequelize[_0xdec7('0x1')]},'language':{'type':Sequelize[_0xdec7('0x1')]},'type':{'type':Sequelize[_0xdec7('0x1')]},'uniqueid':{'type':Sequelize[_0xdec7('0x1')]},'version':{'type':Sequelize[_0xdec7('0x1')]},'callerid':{'type':Sequelize[_0xdec7('0x1')]},'calleridname':{'type':Sequelize[_0xdec7('0x1')]},'callingpres':{'type':Sequelize[_0xdec7('0x1')]},'callingani2':{'type':Sequelize[_0xdec7('0x1')]},'callington':{'type':Sequelize[_0xdec7('0x1')]},'callingtns':{'type':Sequelize[_0xdec7('0x1')]},'dnid':{'type':Sequelize[_0xdec7('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xdec7('0x1')]},'priority':{'type':Sequelize[_0xdec7('0x1')]},'enhanced':{'type':Sequelize[_0xdec7('0x1')]},'accountcode':{'type':Sequelize[_0xdec7('0x1')]},'threadid':{'type':Sequelize[_0xdec7('0x1')]},'project_name':{'type':Sequelize[_0xdec7('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdec7('0x2')]},'bot':{'type':Sequelize[_0xdec7('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb984=['exports','STRING','DATE','BOOLEAN'];(function(_0x11faae,_0x2818c8){var _0x316777=function(_0x2b1e6a){while(--_0x2b1e6a){_0x11faae['push'](_0x11faae['shift']());}};_0x316777(++_0x2818c8);}(_0xb984,0x1b8));var _0x4b98=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xb984[_0x3635ce];return _0x97ecd0;};'use strict';var Sequelize=require('sequelize');module[_0x4b98('0x0')]={'network':{'type':Sequelize[_0x4b98('0x1')]},'network_script':{'type':Sequelize[_0x4b98('0x1')]},'request':{'type':Sequelize[_0x4b98('0x1')]},'channel':{'type':Sequelize[_0x4b98('0x1')]},'language':{'type':Sequelize[_0x4b98('0x1')]},'type':{'type':Sequelize[_0x4b98('0x1')]},'uniqueid':{'type':Sequelize[_0x4b98('0x1')]},'version':{'type':Sequelize[_0x4b98('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4b98('0x1')]},'callingpres':{'type':Sequelize[_0x4b98('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x4b98('0x1')]},'callingtns':{'type':Sequelize[_0x4b98('0x1')]},'dnid':{'type':Sequelize[_0x4b98('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4b98('0x1')]},'extension':{'type':Sequelize[_0x4b98('0x1')]},'priority':{'type':Sequelize[_0x4b98('0x1')]},'enhanced':{'type':Sequelize[_0x4b98('0x1')]},'accountcode':{'type':Sequelize[_0x4b98('0x1')]},'threadid':{'type':Sequelize[_0x4b98('0x1')]},'project_name':{'type':Sequelize[_0x4b98('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4b98('0x2')]},'bot':{'type':Sequelize[_0x4b98('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 305f5b2..1588290 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 _0xdec2=['fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x26cc16,_0x4c174f){var _0x345e3e=function(_0x14b4f8){while(--_0x14b4f8){_0x26cc16['push'](_0x26cc16['shift']());}};_0x345e3e(++_0x4c174f);}(_0xdec2,0xfe));var _0x2dec=function(_0x3f772e,_0x251b37){_0x3f772e=_0x3f772e-0x0;var _0x201b6c=_0xdec2[_0x3f772e];return _0x201b6c;};'use strict';var emlformat=require(_0x2dec('0x0'));var rimraf=require(_0x2dec('0x1'));var zipdir=require(_0x2dec('0x2'));var jsonpatch=require(_0x2dec('0x3'));var rp=require('request-promise');var moment=require(_0x2dec('0x4'));var BPromise=require(_0x2dec('0x5'));var Mustache=require(_0x2dec('0x6'));var util=require('util');var path=require(_0x2dec('0x7'));var sox=require(_0x2dec('0x8'));var csv=require(_0x2dec('0x9'));var ejs=require(_0x2dec('0xa'));var fs=require('fs');var fs_extra=require(_0x2dec('0xb'));var _=require(_0x2dec('0xc'));var squel=require(_0x2dec('0xd'));var crypto=require('crypto');var jsforce=require(_0x2dec('0xe'));var deskjs=require(_0x2dec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2dec('0x10'));var Papa=require(_0x2dec('0x11'));var Redis=require(_0x2dec('0x12'));var authService=require(_0x2dec('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2dec('0x14'));var hardwareService=require(_0x2dec('0x15'));var logger=require(_0x2dec('0x16'))('api');var utils=require(_0x2dec('0x17'));var config=require(_0x2dec('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2dec('0x19'))['db'];function respondWithStatusCode(_0xd7827d,_0x228e34){_0x228e34=_0x228e34||0xcc;return function(_0x1812fa){if(_0x1812fa){return _0xd7827d[_0x2dec('0x1a')](_0x228e34);}return _0xd7827d['status'](_0x228e34)[_0x2dec('0x1b')]();};}function respondWithResult(_0x94925f,_0x8402d1){_0x8402d1=_0x8402d1||0xc8;return function(_0x580319){if(_0x580319){return _0x94925f['status'](_0x8402d1)[_0x2dec('0x1c')](_0x580319);}};}function respondWithFilteredResult(_0x3acb42,_0x414527){return function(_0x39a1b7){if(_0x39a1b7){var _0x25d9da=typeof _0x414527[_0x2dec('0x1d')]===_0x2dec('0x1e')&&typeof _0x414527[_0x2dec('0x1f')]==='undefined';var _0x1ac772=_0x39a1b7[_0x2dec('0x20')];var _0x54eddb=_0x25d9da?0x0:_0x414527[_0x2dec('0x1d')];var _0x75e2e5=_0x25d9da?_0x39a1b7[_0x2dec('0x20')]:_0x414527[_0x2dec('0x1d')]+_0x414527['limit'];var _0x51fcfa;if(_0x75e2e5>=_0x1ac772){_0x75e2e5=_0x1ac772;_0x51fcfa=0xc8;}else{_0x51fcfa=0xce;}_0x3acb42[_0x2dec('0x21')](_0x51fcfa);return _0x3acb42[_0x2dec('0x22')](_0x2dec('0x23'),_0x54eddb+'-'+_0x75e2e5+'/'+_0x1ac772)[_0x2dec('0x1c')](_0x39a1b7);}return null;};}function patchUpdates(_0x172138){return function(_0x345f34){try{jsonpatch[_0x2dec('0x24')](_0x345f34,_0x172138,!![]);}catch(_0x1fadc1){return BPromise[_0x2dec('0x25')](_0x1fadc1);}return _0x345f34['save']();};}function saveUpdates(_0xd391be,_0x3d820){return function(_0x3207ea){if(_0x3207ea){return _0x3207ea['update'](_0xd391be)['then'](function(_0x3fee23){return _0x3fee23;});}return null;};}function removeEntity(_0x332ad2,_0x43dae3){return function(_0x2e2d1e){if(_0x2e2d1e){return _0x2e2d1e['destroy']()[_0x2dec('0x26')](function(){_0x332ad2['status'](0xcc)[_0x2dec('0x1b')]();});}};}function handleEntityNotFound(_0x3e0fbb,_0x147829){return function(_0x1ae7c7){if(!_0x1ae7c7){_0x3e0fbb['sendStatus'](0x194);}return _0x1ae7c7;};}function handleError(_0x1a7aaf,_0x5cf860){_0x5cf860=_0x5cf860||0x1f4;return function(_0x2a2425){logger[_0x2dec('0x27')](_0x2a2425['stack']);if(_0x2a2425[_0x2dec('0x28')]){delete _0x2a2425['name'];}_0x1a7aaf[_0x2dec('0x21')](_0x5cf860)[_0x2dec('0x29')](_0x2a2425);};}exports[_0x2dec('0x2a')]=function(_0x439d4c,_0x4114fc){var _0x32f19b={},_0xcd27a8={},_0x4c6f76={'count':0x0,'rows':[]};var _0x442214=_[_0x2dec('0x2b')](db[_0x2dec('0x2c')][_0x2dec('0x2d')],function(_0x183df2){return{'name':_0x183df2[_0x2dec('0x2e')],'type':_0x183df2[_0x2dec('0x2f')][_0x2dec('0x30')]};});_0xcd27a8[_0x2dec('0x31')]=_[_0x2dec('0x2b')](_0x442214,_0x2dec('0x28'));_0xcd27a8[_0x2dec('0x32')]=_['keys'](_0x439d4c[_0x2dec('0x32')]);_0xcd27a8[_0x2dec('0x33')]=_[_0x2dec('0x34')](_0xcd27a8[_0x2dec('0x31')],_0xcd27a8[_0x2dec('0x32')]);_0x32f19b[_0x2dec('0x35')]=_['intersection'](_0xcd27a8[_0x2dec('0x31')],qs[_0x2dec('0x36')](_0x439d4c['query'][_0x2dec('0x36')]));_0x32f19b['attributes']=_0x32f19b['attributes'][_0x2dec('0x37')]?_0x32f19b[_0x2dec('0x35')]:_0xcd27a8[_0x2dec('0x31')];if(!_0x439d4c[_0x2dec('0x32')][_0x2dec('0x38')](_0x2dec('0x39'))){_0x32f19b[_0x2dec('0x1f')]=qs[_0x2dec('0x1f')](_0x439d4c[_0x2dec('0x32')]['limit']);_0x32f19b[_0x2dec('0x1d')]=qs[_0x2dec('0x1d')](_0x439d4c[_0x2dec('0x32')]['offset']);}_0x32f19b[_0x2dec('0x3a')]=qs[_0x2dec('0x3b')](_0x439d4c[_0x2dec('0x32')][_0x2dec('0x3b')]);_0x32f19b[_0x2dec('0x3c')]=qs[_0x2dec('0x33')](_['pick'](_0x439d4c['query'],_0xcd27a8[_0x2dec('0x33')]),_0x442214);if(_0x439d4c[_0x2dec('0x32')]['filter']){_0x32f19b[_0x2dec('0x3c')]=_[_0x2dec('0x3d')](_0x32f19b[_0x2dec('0x3c')],{'$or':_[_0x2dec('0x2b')](_0x442214,function(_0x18012f){if(_0x18012f['type']!=='VIRTUAL'){var _0xaf7322={};_0xaf7322[_0x18012f[_0x2dec('0x28')]]={'$like':'%'+_0x439d4c[_0x2dec('0x32')]['filter']+'%'};return _0xaf7322;}})});}_0x32f19b=_[_0x2dec('0x3d')]({},_0x32f19b,_0x439d4c[_0x2dec('0x3e')]);var _0x157171={'where':_0x32f19b[_0x2dec('0x3c')]};return db[_0x2dec('0x2c')][_0x2dec('0x20')](_0x157171)[_0x2dec('0x26')](function(_0x52c7a0){_0x4c6f76[_0x2dec('0x20')]=_0x52c7a0;if(_0x439d4c[_0x2dec('0x32')][_0x2dec('0x3f')]){_0x32f19b['include']=[{'all':!![]}];}return db[_0x2dec('0x2c')][_0x2dec('0x40')](_0x32f19b);})[_0x2dec('0x26')](function(_0x358e3f){_0x4c6f76[_0x2dec('0x41')]=_0x358e3f;return _0x4c6f76;})[_0x2dec('0x26')](respondWithFilteredResult(_0x4114fc,_0x32f19b))[_0x2dec('0x42')](handleError(_0x4114fc,null));};exports[_0x2dec('0x43')]=function(_0x8ab4e9,_0x580fc7){var _0x2ed0f2={'raw':!![],'where':{'id':_0x8ab4e9[_0x2dec('0x44')]['id']}},_0x1de98e={};_0x1de98e[_0x2dec('0x31')]=_[_0x2dec('0x45')](db[_0x2dec('0x2c')][_0x2dec('0x2d')]);_0x1de98e['query']=_['keys'](_0x8ab4e9['query']);_0x1de98e[_0x2dec('0x33')]=_[_0x2dec('0x34')](_0x1de98e[_0x2dec('0x31')],_0x1de98e[_0x2dec('0x32')]);_0x2ed0f2[_0x2dec('0x35')]=_['intersection'](_0x1de98e['model'],qs['fields'](_0x8ab4e9[_0x2dec('0x32')][_0x2dec('0x36')]));_0x2ed0f2['attributes']=_0x2ed0f2[_0x2dec('0x35')][_0x2dec('0x37')]?_0x2ed0f2['attributes']:_0x1de98e[_0x2dec('0x31')];if(_0x8ab4e9[_0x2dec('0x32')]['includeAll']){_0x2ed0f2[_0x2dec('0x46')]=[{'all':!![]}];}_0x2ed0f2=_['merge']({},_0x2ed0f2,_0x8ab4e9[_0x2dec('0x3e')]);return db[_0x2dec('0x2c')][_0x2dec('0x47')](_0x2ed0f2)[_0x2dec('0x26')](handleEntityNotFound(_0x580fc7,null))[_0x2dec('0x26')](respondWithResult(_0x580fc7,null))[_0x2dec('0x42')](handleError(_0x580fc7,null));};exports[_0x2dec('0x48')]=function(_0x162ea0,_0x3f94e2){return db[_0x2dec('0x2c')][_0x2dec('0x48')](_0x162ea0[_0x2dec('0x49')],{})[_0x2dec('0x26')](respondWithResult(_0x3f94e2,0xc9))['catch'](handleError(_0x3f94e2,null));};exports[_0x2dec('0x4a')]=function(_0xa5ea0d,_0x5c4671){if(_0xa5ea0d[_0x2dec('0x49')]['id']){delete _0xa5ea0d[_0x2dec('0x49')]['id'];}return db[_0x2dec('0x2c')][_0x2dec('0x47')]({'where':{'id':_0xa5ea0d['params']['id']}})['then'](handleEntityNotFound(_0x5c4671,null))[_0x2dec('0x26')](saveUpdates(_0xa5ea0d[_0x2dec('0x49')],null))[_0x2dec('0x26')](respondWithResult(_0x5c4671,null))[_0x2dec('0x42')](handleError(_0x5c4671,null));};exports[_0x2dec('0x4b')]=function(_0x30ac31,_0x10017a){return db[_0x2dec('0x2c')][_0x2dec('0x47')]({'where':{'id':_0x30ac31['params']['id']}})[_0x2dec('0x26')](handleEntityNotFound(_0x10017a,null))[_0x2dec('0x26')](removeEntity(_0x10017a,null))[_0x2dec('0x42')](handleError(_0x10017a,null));};exports[_0x2dec('0x4c')]=function(_0x3d5b82,_0x1d3beb){return db['SquareReport'][_0x2dec('0x4c')]()[_0x2dec('0x26')](respondWithResult(_0x1d3beb,null))['catch'](handleError(_0x1d3beb,null));}; \ No newline at end of file +var _0xee83=['includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','VIRTUAL','merge','options','SquareReport','include','rows','catch','show'];(function(_0x3d13bb,_0x262a54){var _0x4b5a1b=function(_0x53417e){while(--_0x53417e){_0x3d13bb['push'](_0x3d13bb['shift']());}};_0x4b5a1b(++_0x262a54);}(_0xee83,0x1c2));var _0x3ee8=function(_0x33ff7e,_0x4bd12e){_0x33ff7e=_0x33ff7e-0x0;var _0x2ab110=_0xee83[_0x33ff7e];return _0x2ab110;};'use strict';var emlformat=require(_0x3ee8('0x0'));var rimraf=require(_0x3ee8('0x1'));var zipdir=require(_0x3ee8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ee8('0x3'));var moment=require(_0x3ee8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3ee8('0x5'));var path=require(_0x3ee8('0x6'));var sox=require('sox');var csv=require(_0x3ee8('0x7'));var ejs=require(_0x3ee8('0x8'));var fs=require('fs');var fs_extra=require(_0x3ee8('0x9'));var _=require(_0x3ee8('0xa'));var squel=require('squel');var crypto=require(_0x3ee8('0xb'));var jsforce=require(_0x3ee8('0xc'));var deskjs=require(_0x3ee8('0xd'));var toCsv=require(_0x3ee8('0x7'));var querystring=require(_0x3ee8('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3ee8('0xf'));var qs=require(_0x3ee8('0x10'));var as=require(_0x3ee8('0x11'));var hardwareService=require(_0x3ee8('0x12'));var logger=require(_0x3ee8('0x13'))(_0x3ee8('0x14'));var utils=require('../../config/utils');var config=require(_0x3ee8('0x15'));var licenseUtil=require(_0x3ee8('0x16'));var db=require(_0x3ee8('0x17'))['db'];function respondWithStatusCode(_0x538eca,_0x296ae9){_0x296ae9=_0x296ae9||0xcc;return function(_0x2bab47){if(_0x2bab47){return _0x538eca[_0x3ee8('0x18')](_0x296ae9);}return _0x538eca[_0x3ee8('0x19')](_0x296ae9)[_0x3ee8('0x1a')]();};}function respondWithResult(_0x337c6c,_0x5c210e){_0x5c210e=_0x5c210e||0xc8;return function(_0x463289){if(_0x463289){return _0x337c6c[_0x3ee8('0x19')](_0x5c210e)[_0x3ee8('0x1b')](_0x463289);}};}function respondWithFilteredResult(_0x2d32bf,_0x4d48e0){return function(_0x203158){if(_0x203158){var _0x2c8cd6=typeof _0x4d48e0['offset']===_0x3ee8('0x1c')&&typeof _0x4d48e0[_0x3ee8('0x1d')]===_0x3ee8('0x1c');var _0x54ad77=_0x203158['count'];var _0x18a32d=_0x2c8cd6?0x0:_0x4d48e0['offset'];var _0x3c1ff0=_0x2c8cd6?_0x203158[_0x3ee8('0x1e')]:_0x4d48e0['offset']+_0x4d48e0[_0x3ee8('0x1d')];var _0x367f5c;if(_0x3c1ff0>=_0x54ad77){_0x3c1ff0=_0x54ad77;_0x367f5c=0xc8;}else{_0x367f5c=0xce;}_0x2d32bf[_0x3ee8('0x19')](_0x367f5c);return _0x2d32bf['set']('Content-Range',_0x18a32d+'-'+_0x3c1ff0+'/'+_0x54ad77)['json'](_0x203158);}return null;};}function patchUpdates(_0x4c25e9){return function(_0x2261ad){try{jsonpatch[_0x3ee8('0x1f')](_0x2261ad,_0x4c25e9,!![]);}catch(_0x5b24d7){return BPromise[_0x3ee8('0x20')](_0x5b24d7);}return _0x2261ad[_0x3ee8('0x21')]();};}function saveUpdates(_0x3be50b,_0xf6d25a){return function(_0x261226){if(_0x261226){return _0x261226[_0x3ee8('0x22')](_0x3be50b)[_0x3ee8('0x23')](function(_0x34eb15){return _0x34eb15;});}return null;};}function removeEntity(_0x2f2e5d,_0x8203c7){return function(_0x5ae2fe){if(_0x5ae2fe){return _0x5ae2fe[_0x3ee8('0x24')]()[_0x3ee8('0x23')](function(){_0x2f2e5d[_0x3ee8('0x19')](0xcc)[_0x3ee8('0x1a')]();});}};}function handleEntityNotFound(_0x56bac4,_0x5e90ed){return function(_0x44316e){if(!_0x44316e){_0x56bac4['sendStatus'](0x194);}return _0x44316e;};}function handleError(_0xf40011,_0x406f91){_0x406f91=_0x406f91||0x1f4;return function(_0x2b7801){logger[_0x3ee8('0x25')](_0x2b7801['stack']);if(_0x2b7801[_0x3ee8('0x26')]){delete _0x2b7801[_0x3ee8('0x26')];}_0xf40011[_0x3ee8('0x19')](_0x406f91)[_0x3ee8('0x27')](_0x2b7801);};}exports[_0x3ee8('0x28')]=function(_0x4c1904,_0x58df88){var _0x6c6f14={},_0x9ae66f={},_0x14348e={'count':0x0,'rows':[]};var _0x321150=_[_0x3ee8('0x29')](db['SquareReport'][_0x3ee8('0x2a')],function(_0x50dac9){return{'name':_0x50dac9[_0x3ee8('0x2b')],'type':_0x50dac9[_0x3ee8('0x2c')][_0x3ee8('0x2d')]};});_0x9ae66f[_0x3ee8('0x2e')]=_['map'](_0x321150,_0x3ee8('0x26'));_0x9ae66f['query']=_[_0x3ee8('0x2f')](_0x4c1904[_0x3ee8('0x30')]);_0x9ae66f[_0x3ee8('0x31')]=_[_0x3ee8('0x32')](_0x9ae66f['model'],_0x9ae66f[_0x3ee8('0x30')]);_0x6c6f14[_0x3ee8('0x33')]=_[_0x3ee8('0x32')](_0x9ae66f[_0x3ee8('0x2e')],qs[_0x3ee8('0x34')](_0x4c1904[_0x3ee8('0x30')][_0x3ee8('0x34')]));_0x6c6f14['attributes']=_0x6c6f14[_0x3ee8('0x33')][_0x3ee8('0x35')]?_0x6c6f14['attributes']:_0x9ae66f[_0x3ee8('0x2e')];if(!_0x4c1904[_0x3ee8('0x30')][_0x3ee8('0x36')]('nolimit')){_0x6c6f14[_0x3ee8('0x1d')]=qs[_0x3ee8('0x1d')](_0x4c1904['query'][_0x3ee8('0x1d')]);_0x6c6f14['offset']=qs[_0x3ee8('0x37')](_0x4c1904[_0x3ee8('0x30')]['offset']);}_0x6c6f14[_0x3ee8('0x38')]=qs['sort'](_0x4c1904[_0x3ee8('0x30')][_0x3ee8('0x39')]);_0x6c6f14[_0x3ee8('0x3a')]=qs[_0x3ee8('0x31')](_[_0x3ee8('0x3b')](_0x4c1904['query'],_0x9ae66f[_0x3ee8('0x31')]),_0x321150);if(_0x4c1904[_0x3ee8('0x30')]['filter']){_0x6c6f14[_0x3ee8('0x3a')]=_['merge'](_0x6c6f14['where'],{'$or':_[_0x3ee8('0x29')](_0x321150,function(_0x22d9fb){if(_0x22d9fb[_0x3ee8('0x2c')]!==_0x3ee8('0x3c')){var _0x5c79af={};_0x5c79af[_0x22d9fb['name']]={'$like':'%'+_0x4c1904[_0x3ee8('0x30')]['filter']+'%'};return _0x5c79af;}})});}_0x6c6f14=_[_0x3ee8('0x3d')]({},_0x6c6f14,_0x4c1904[_0x3ee8('0x3e')]);var _0x68b306={'where':_0x6c6f14[_0x3ee8('0x3a')]};return db[_0x3ee8('0x3f')][_0x3ee8('0x1e')](_0x68b306)['then'](function(_0x5a14cf){_0x14348e['count']=_0x5a14cf;if(_0x4c1904[_0x3ee8('0x30')]['includeAll']){_0x6c6f14[_0x3ee8('0x40')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x6c6f14);})[_0x3ee8('0x23')](function(_0xfb91cd){_0x14348e[_0x3ee8('0x41')]=_0xfb91cd;return _0x14348e;})[_0x3ee8('0x23')](respondWithFilteredResult(_0x58df88,_0x6c6f14))[_0x3ee8('0x42')](handleError(_0x58df88,null));};exports[_0x3ee8('0x43')]=function(_0x2d9df2,_0x338558){var _0x17269d={'raw':!![],'where':{'id':_0x2d9df2['params']['id']}},_0xd18dcf={};_0xd18dcf['model']=_['keys'](db[_0x3ee8('0x3f')][_0x3ee8('0x2a')]);_0xd18dcf[_0x3ee8('0x30')]=_[_0x3ee8('0x2f')](_0x2d9df2[_0x3ee8('0x30')]);_0xd18dcf[_0x3ee8('0x31')]=_[_0x3ee8('0x32')](_0xd18dcf['model'],_0xd18dcf[_0x3ee8('0x30')]);_0x17269d[_0x3ee8('0x33')]=_['intersection'](_0xd18dcf[_0x3ee8('0x2e')],qs['fields'](_0x2d9df2[_0x3ee8('0x30')]['fields']));_0x17269d[_0x3ee8('0x33')]=_0x17269d[_0x3ee8('0x33')][_0x3ee8('0x35')]?_0x17269d[_0x3ee8('0x33')]:_0xd18dcf[_0x3ee8('0x2e')];if(_0x2d9df2[_0x3ee8('0x30')][_0x3ee8('0x44')]){_0x17269d[_0x3ee8('0x40')]=[{'all':!![]}];}_0x17269d=_[_0x3ee8('0x3d')]({},_0x17269d,_0x2d9df2[_0x3ee8('0x3e')]);return db[_0x3ee8('0x3f')]['find'](_0x17269d)[_0x3ee8('0x23')](handleEntityNotFound(_0x338558,null))['then'](respondWithResult(_0x338558,null))[_0x3ee8('0x42')](handleError(_0x338558,null));};exports[_0x3ee8('0x45')]=function(_0x38a18b,_0x46a582){return db[_0x3ee8('0x3f')]['create'](_0x38a18b['body'],{})['then'](respondWithResult(_0x46a582,0xc9))[_0x3ee8('0x42')](handleError(_0x46a582,null));};exports['update']=function(_0x2ca393,_0x191d80){if(_0x2ca393[_0x3ee8('0x46')]['id']){delete _0x2ca393[_0x3ee8('0x46')]['id'];}return db[_0x3ee8('0x3f')][_0x3ee8('0x47')]({'where':{'id':_0x2ca393[_0x3ee8('0x48')]['id']}})[_0x3ee8('0x23')](handleEntityNotFound(_0x191d80,null))[_0x3ee8('0x23')](saveUpdates(_0x2ca393['body'],null))[_0x3ee8('0x23')](respondWithResult(_0x191d80,null))[_0x3ee8('0x42')](handleError(_0x191d80,null));};exports[_0x3ee8('0x24')]=function(_0x1adb43,_0x1353f6){return db[_0x3ee8('0x3f')]['find']({'where':{'id':_0x1adb43[_0x3ee8('0x48')]['id']}})[_0x3ee8('0x23')](handleEntityNotFound(_0x1353f6,null))[_0x3ee8('0x23')](removeEntity(_0x1353f6,null))['catch'](handleError(_0x1353f6,null));};exports['describe']=function(_0x1f96de,_0xc17883){return db[_0x3ee8('0x3f')][_0x3ee8('0x49')]()['then'](respondWithResult(_0xc17883,null))[_0x3ee8('0x42')](handleError(_0xc17883,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 5428d8d..056fe9d 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 _0x356b=['./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x340942,_0x5b35f0){var _0x3b10d5=function(_0x5252fa){while(--_0x5252fa){_0x340942['push'](_0x340942['shift']());}};_0x3b10d5(++_0x5b35f0);}(_0x356b,0x13b));var _0xb356=function(_0x4ca445,_0x38e103){_0x4ca445=_0x4ca445-0x0;var _0x3a6ff7=_0x356b[_0x4ca445];return _0x3a6ff7;};'use strict';var _=require(_0xb356('0x0'));var util=require(_0xb356('0x1'));var logger=require(_0xb356('0x2'))(_0xb356('0x3'));var moment=require(_0xb356('0x4'));var BPromise=require(_0xb356('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb356('0x6'));var rimraf=require(_0xb356('0x7'));var config=require('../../config/environment');var attributes=require(_0xb356('0x8'));module[_0xb356('0x9')]=function(_0x968168,_0x5f53b0){return _0x968168[_0xb356('0xa')](_0xb356('0xb'),attributes,{'tableName':_0xb356('0xc'),'paranoid':![],'indexes':[{'name':_0xb356('0xd'),'fields':[_0xb356('0xe'),_0xb356('0xf')]},{'name':_0xb356('0x10'),'fields':[_0xb356('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92ed=['leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x92ed,0x19f));var _0xd92e=function(_0x5ee7e6,_0x505de0){_0x5ee7e6=_0x5ee7e6-0x0;var _0xccbe58=_0x92ed[_0x5ee7e6];return _0xccbe58;};'use strict';var _=require(_0xd92e('0x0'));var util=require(_0xd92e('0x1'));var logger=require(_0xd92e('0x2'))(_0xd92e('0x3'));var moment=require('moment');var BPromise=require(_0xd92e('0x4'));var rp=require(_0xd92e('0x5'));var fs=require('fs');var path=require(_0xd92e('0x6'));var rimraf=require(_0xd92e('0x7'));var config=require(_0xd92e('0x8'));var attributes=require(_0xd92e('0x9'));module[_0xd92e('0xa')]=function(_0x26f6b4,_0x1089fa){return _0x26f6b4[_0xd92e('0xb')](_0xd92e('0xc'),attributes,{'tableName':_0xd92e('0xd'),'paranoid':![],'indexes':[{'name':_0xd92e('0xe'),'fields':[_0xd92e('0xf'),_0xd92e('0x10')]},{'name':_0xd92e('0x11'),'fields':[_0xd92e('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 2f1497d..3d6a070 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 _0xb947=['update','where','limit','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','debug','UpdateSquareReport'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xb947,0x1f4));var _0x7b94=function(_0x1a552c,_0xfb02bc){_0x1a552c=_0x1a552c-0x0;var _0x547785=_0xb947[_0x1a552c];return _0x547785;};'use strict';var _=require(_0x7b94('0x0'));var util=require('util');var moment=require(_0x7b94('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b94('0x2'));var db=require(_0x7b94('0x3'))['db'];var utils=require(_0x7b94('0x4'));var logger=require(_0x7b94('0x5'))(_0x7b94('0x6'));var config=require(_0x7b94('0x7'));var jayson=require(_0x7b94('0x8'));var client=jayson[_0x7b94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38f38f,_0x1bef13,_0x2734bd){return new BPromise(function(_0x65fbab,_0x18b998){return client['request'](_0x38f38f,_0x2734bd)[_0x7b94('0xa')](function(_0x35190b){logger[_0x7b94('0xb')](_0x7b94('0xc'),_0x1bef13,_0x7b94('0xd'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x1bef13,_0x7b94('0xd'),JSON['stringify'](_0x35190b));if(_0x35190b[_0x7b94('0xe')]){if(_0x35190b['error'][_0x7b94('0xf')]===0x1f4){logger[_0x7b94('0xe')](_0x7b94('0xc'),_0x1bef13,_0x35190b[_0x7b94('0xe')][_0x7b94('0x10')]);return _0x18b998(_0x35190b['error'][_0x7b94('0x10')]);}logger[_0x7b94('0xe')](_0x7b94('0xc'),_0x1bef13,_0x35190b[_0x7b94('0xe')][_0x7b94('0x10')]);return _0x65fbab(_0x35190b[_0x7b94('0xe')][_0x7b94('0x10')]);}else{logger['info'](_0x7b94('0xc'),_0x1bef13,_0x7b94('0xd'));_0x65fbab(_0x35190b[_0x7b94('0x11')]['message']);}})[_0x7b94('0x12')](function(_0xbae703){logger[_0x7b94('0xe')]('SquareReport,\x20%s,\x20%s',_0x1bef13,_0xbae703);_0x18b998(_0xbae703);});});}exports[_0x7b94('0x13')]=function(_0x530228){var _0x6892a2=this;return new Promise(function(_0x9e904a,_0x577cab){return db[_0x7b94('0x14')][_0x7b94('0x15')](_0x530228[_0x7b94('0x16')],{'raw':_0x530228[_0x7b94('0x17')]?_0x530228[_0x7b94('0x17')][_0x7b94('0x18')]===undefined?!![]:![]:!![]})[_0x7b94('0xa')](function(_0xa72809){logger[_0x7b94('0xb')]('CreateSquareReport',_0x530228);logger[_0x7b94('0x19')]('CreateSquareReport',_0x530228,JSON['stringify'](_0xa72809));_0x9e904a(_0xa72809);})[_0x7b94('0x12')](function(_0x31efc2){logger[_0x7b94('0xe')](_0x7b94('0x13'),_0x31efc2[_0x7b94('0x10')],_0x530228);_0x577cab(_0x6892a2[_0x7b94('0xe')](0x1f4,_0x31efc2['message']));});});};exports[_0x7b94('0x1a')]=function(_0x285d60){var _0x284fa9=this;return new Promise(function(_0x9cbc0f,_0x4eeb1f){return db[_0x7b94('0x14')][_0x7b94('0x1b')](_0x285d60[_0x7b94('0x16')],{'raw':_0x285d60[_0x7b94('0x17')]?_0x285d60[_0x7b94('0x17')][_0x7b94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285d60[_0x7b94('0x17')]?_0x285d60[_0x7b94('0x17')][_0x7b94('0x1c')]||null:null,'attributes':_0x285d60[_0x7b94('0x17')]?_0x285d60[_0x7b94('0x17')]['attributes']||null:null,'limit':_0x285d60[_0x7b94('0x17')]?_0x285d60[_0x7b94('0x17')][_0x7b94('0x1d')]||null:null})[_0x7b94('0xa')](function(_0x16f1b9){logger[_0x7b94('0xb')](_0x7b94('0x1a'),_0x285d60);logger['debug'](_0x7b94('0x1a'),_0x285d60,JSON[_0x7b94('0x1e')](_0x16f1b9));_0x9cbc0f(_0x16f1b9);})[_0x7b94('0x12')](function(_0x5b5cc2){logger['error']('UpdateSquareReport',_0x5b5cc2[_0x7b94('0x10')],_0x285d60);_0x4eeb1f(_0x284fa9[_0x7b94('0xe')](0x1f4,_0x5b5cc2['message']));});});}; \ No newline at end of file +var _0x88e8=['request','then','info','request\x20sent','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','debug','update','where','limit','UpdateSquareReport','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x88e8,0x123));var _0x888e=function(_0xc84cea,_0x7058f1){_0xc84cea=_0xc84cea-0x0;var _0x572c6c=_0x88e8[_0xc84cea];return _0x572c6c;};'use strict';var _=require(_0x888e('0x0'));var util=require(_0x888e('0x1'));var moment=require(_0x888e('0x2'));var BPromise=require('bluebird');var rs=require(_0x888e('0x3'));var fs=require('fs');var Redis=require(_0x888e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x888e('0x5'))(_0x888e('0x6'));var config=require('../../config/environment');var jayson=require(_0x888e('0x7'));var client=jayson[_0x888e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a595a,_0x59c408,_0x3021cd){return new BPromise(function(_0x38e5c3,_0x674ede){return client[_0x888e('0x9')](_0x5a595a,_0x3021cd)[_0x888e('0xa')](function(_0x5e6500){logger[_0x888e('0xb')]('SquareReport,\x20%s,\x20%s',_0x59c408,'request\x20sent');logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x59c408,_0x888e('0xc'),JSON['stringify'](_0x5e6500));if(_0x5e6500[_0x888e('0xd')]){if(_0x5e6500[_0x888e('0xd')][_0x888e('0xe')]===0x1f4){logger['error'](_0x888e('0xf'),_0x59c408,_0x5e6500[_0x888e('0xd')][_0x888e('0x10')]);return _0x674ede(_0x5e6500['error'][_0x888e('0x10')]);}logger[_0x888e('0xd')](_0x888e('0xf'),_0x59c408,_0x5e6500[_0x888e('0xd')][_0x888e('0x10')]);return _0x38e5c3(_0x5e6500[_0x888e('0xd')][_0x888e('0x10')]);}else{logger[_0x888e('0xb')]('SquareReport,\x20%s,\x20%s',_0x59c408,_0x888e('0xc'));_0x38e5c3(_0x5e6500[_0x888e('0x11')][_0x888e('0x10')]);}})[_0x888e('0x12')](function(_0x3968b1){logger[_0x888e('0xd')](_0x888e('0xf'),_0x59c408,_0x3968b1);_0x674ede(_0x3968b1);});});}exports[_0x888e('0x13')]=function(_0x2f31f1){var _0x12b879=this;return new Promise(function(_0x307377,_0xcc954c){return db[_0x888e('0x14')][_0x888e('0x15')](_0x2f31f1[_0x888e('0x16')],{'raw':_0x2f31f1['options']?_0x2f31f1[_0x888e('0x17')][_0x888e('0x18')]===undefined?!![]:![]:!![]})[_0x888e('0xa')](function(_0x3f33ee){logger[_0x888e('0xb')](_0x888e('0x13'),_0x2f31f1);logger[_0x888e('0x19')](_0x888e('0x13'),_0x2f31f1,JSON['stringify'](_0x3f33ee));_0x307377(_0x3f33ee);})[_0x888e('0x12')](function(_0x576b40){logger[_0x888e('0xd')]('CreateSquareReport',_0x576b40[_0x888e('0x10')],_0x2f31f1);_0xcc954c(_0x12b879[_0x888e('0xd')](0x1f4,_0x576b40['message']));});});};exports['UpdateSquareReport']=function(_0xd5e753){var _0x29c5da=this;return new Promise(function(_0x351488,_0x58e118){return db[_0x888e('0x14')][_0x888e('0x1a')](_0xd5e753['body'],{'raw':_0xd5e753[_0x888e('0x17')]?_0xd5e753[_0x888e('0x17')][_0x888e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd5e753[_0x888e('0x17')]?_0xd5e753[_0x888e('0x17')][_0x888e('0x1b')]||null:null,'attributes':_0xd5e753[_0x888e('0x17')]?_0xd5e753['options']['attributes']||null:null,'limit':_0xd5e753[_0x888e('0x17')]?_0xd5e753[_0x888e('0x17')][_0x888e('0x1c')]||null:null})['then'](function(_0x4e09ae){logger[_0x888e('0xb')](_0x888e('0x1d'),_0xd5e753);logger[_0x888e('0x19')](_0x888e('0x1d'),_0xd5e753,JSON['stringify'](_0x4e09ae));_0x351488(_0x4e09ae);})['catch'](function(_0x1532c5){logger[_0x888e('0xd')]('UpdateSquareReport',_0x1532c5[_0x888e('0x10')],_0xd5e753);_0x58e118(_0x29c5da[_0x888e('0xd')](0x1f4,_0x1532c5[_0x888e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index cec31b7..1e3d2de 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 _0xb623=['index','isAuthenticated','describe','/:id','create','put','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x3f499c,_0x5e0972){var _0x2246b2=function(_0x529476){while(--_0x529476){_0x3f499c['push'](_0x3f499c['shift']());}};_0x2246b2(++_0x5e0972);}(_0xb623,0xbb));var _0x3b62=function(_0x4fd547,_0x5dfc5e){_0x4fd547=_0x4fd547-0x0;var _0x8efe42=_0xb623[_0x4fd547];return _0x8efe42;};'use strict';var multer=require(_0x3b62('0x0'));var util=require(_0x3b62('0x1'));var path=require(_0x3b62('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b62('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3b62('0x4'));var config=require(_0x3b62('0x5'));var controller=require(_0x3b62('0x6'));router[_0x3b62('0x7')]('/',auth['isAuthenticated'](),controller[_0x3b62('0x8')]);router[_0x3b62('0x7')]('/describe',auth[_0x3b62('0x9')](),controller[_0x3b62('0xa')]);router[_0x3b62('0x7')](_0x3b62('0xb'),auth[_0x3b62('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3b62('0xc')]);router[_0x3b62('0xd')](_0x3b62('0xb'),auth[_0x3b62('0x9')](),controller['update']);router['delete'](_0x3b62('0xb'),auth[_0x3b62('0x9')](),controller['destroy']);module[_0x3b62('0xe')]=router; \ No newline at end of file +var _0x7419=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','delete','destroy','multer','util'];(function(_0x52dd39,_0xdb90a5){var _0x1d4076=function(_0x19c184){while(--_0x19c184){_0x52dd39['push'](_0x52dd39['shift']());}};_0x1d4076(++_0xdb90a5);}(_0x7419,0x13e));var _0x9741=function(_0x53d8ff,_0x19f5c0){_0x53d8ff=_0x53d8ff-0x0;var _0x3c87c7=_0x7419[_0x53d8ff];return _0x3c87c7;};'use strict';var multer=require(_0x9741('0x0'));var util=require(_0x9741('0x1'));var path=require(_0x9741('0x2'));var timeout=require(_0x9741('0x3'));var express=require(_0x9741('0x4'));var router=express[_0x9741('0x5')]();var fs_extra=require(_0x9741('0x6'));var auth=require(_0x9741('0x7'));var interaction=require(_0x9741('0x8'));var config=require(_0x9741('0x9'));var controller=require('./squareReportDetail.controller');router[_0x9741('0xa')]('/',auth[_0x9741('0xb')](),controller[_0x9741('0xc')]);router['get'](_0x9741('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x9741('0xa')](_0x9741('0xe'),auth[_0x9741('0xb')](),controller[_0x9741('0xf')]);router[_0x9741('0x10')]('/',auth[_0x9741('0xb')](),controller[_0x9741('0x11')]);router['put']('/:id',auth[_0x9741('0xb')](),controller['update']);router[_0x9741('0x12')](_0x9741('0xe'),auth['isAuthenticated'](),controller[_0x9741('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 49d7fa0..249fb5f 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 _0xa1aa=['STRING','TEXT','sequelize','exports'];(function(_0xf87768,_0x31269c){var _0x19ee51=function(_0x19a782){while(--_0x19a782){_0xf87768['push'](_0xf87768['shift']());}};_0x19ee51(++_0x31269c);}(_0xa1aa,0xa2));var _0xaa1a=function(_0x300d9c,_0x540a0b){_0x300d9c=_0x300d9c-0x0;var _0x77a90c=_0xa1aa[_0x300d9c];return _0x77a90c;};'use strict';var Sequelize=require(_0xaa1a('0x0'));module[_0xaa1a('0x1')]={'uniqueid':{'type':Sequelize[_0xaa1a('0x2')]},'node':{'type':Sequelize[_0xaa1a('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xaa1a('0x3')]},'project_name':{'type':Sequelize[_0xaa1a('0x2')]},'callerid':{'type':Sequelize[_0xaa1a('0x2')]}}; \ No newline at end of file +var _0x4235=['exports','STRING','TEXT','sequelize'];(function(_0x5d1173,_0x2b782d){var _0x5cb428=function(_0x406e8c){while(--_0x406e8c){_0x5d1173['push'](_0x5d1173['shift']());}};_0x5cb428(++_0x2b782d);}(_0x4235,0x1af));var _0x5423=function(_0x1df378,_0x2c4af3){_0x1df378=_0x1df378-0x0;var _0x2cb9fe=_0x4235[_0x1df378];return _0x2cb9fe;};'use strict';var Sequelize=require(_0x5423('0x0'));module[_0x5423('0x1')]={'uniqueid':{'type':Sequelize[_0x5423('0x2')]},'node':{'type':Sequelize[_0x5423('0x2')]},'application':{'type':Sequelize[_0x5423('0x2')]},'data':{'type':Sequelize[_0x5423('0x3')]},'project_name':{'type':Sequelize[_0x5423('0x2')]},'callerid':{'type':Sequelize[_0x5423('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f1a938b..c0f69a8 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 _0xf165=['request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','name','keys','filters','intersection','model','attributes','fields','query','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','zip-dir','fast-json-patch'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0xf165,0x11e));var _0x5f16=function(_0x1ecae9,_0x3142f7){_0x1ecae9=_0x1ecae9-0x0;var _0x581043=_0xf165[_0x1ecae9];return _0x581043;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5f16('0x0'));var jsonpatch=require(_0x5f16('0x1'));var rp=require(_0x5f16('0x2'));var moment=require(_0x5f16('0x3'));var BPromise=require(_0x5f16('0x4'));var Mustache=require('mustache');var util=require(_0x5f16('0x5'));var path=require('path');var sox=require(_0x5f16('0x6'));var csv=require(_0x5f16('0x7'));var ejs=require(_0x5f16('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f16('0x9'));var squel=require(_0x5f16('0xa'));var crypto=require(_0x5f16('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5f16('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5f16('0xd'));var Papa=require(_0x5f16('0xe'));var Redis=require(_0x5f16('0xf'));var authService=require(_0x5f16('0x10'));var qs=require(_0x5f16('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f16('0x12'));var logger=require(_0x5f16('0x13'))(_0x5f16('0x14'));var utils=require(_0x5f16('0x15'));var config=require(_0x5f16('0x16'));var licenseUtil=require(_0x5f16('0x17'));var db=require(_0x5f16('0x18'))['db'];function respondWithStatusCode(_0x1b6052,_0x3f2819){_0x3f2819=_0x3f2819||0xcc;return function(_0x5558e9){if(_0x5558e9){return _0x1b6052['sendStatus'](_0x3f2819);}return _0x1b6052[_0x5f16('0x19')](_0x3f2819)[_0x5f16('0x1a')]();};}function respondWithResult(_0x1dae99,_0x4e399d){_0x4e399d=_0x4e399d||0xc8;return function(_0xfce46e){if(_0xfce46e){return _0x1dae99['status'](_0x4e399d)[_0x5f16('0x1b')](_0xfce46e);}};}function respondWithFilteredResult(_0x301466,_0x2e1692){return function(_0x27a937){if(_0x27a937){var _0x3939f8=typeof _0x2e1692[_0x5f16('0x1c')]===_0x5f16('0x1d')&&typeof _0x2e1692[_0x5f16('0x1e')]==='undefined';var _0x3c466f=_0x27a937[_0x5f16('0x1f')];var _0x46d029=_0x3939f8?0x0:_0x2e1692[_0x5f16('0x1c')];var _0x1f2669=_0x3939f8?_0x27a937['count']:_0x2e1692[_0x5f16('0x1c')]+_0x2e1692[_0x5f16('0x1e')];var _0x2935f9;if(_0x1f2669>=_0x3c466f){_0x1f2669=_0x3c466f;_0x2935f9=0xc8;}else{_0x2935f9=0xce;}_0x301466[_0x5f16('0x19')](_0x2935f9);return _0x301466[_0x5f16('0x20')]('Content-Range',_0x46d029+'-'+_0x1f2669+'/'+_0x3c466f)[_0x5f16('0x1b')](_0x27a937);}return null;};}function patchUpdates(_0x2745b3){return function(_0x347905){try{jsonpatch['apply'](_0x347905,_0x2745b3,!![]);}catch(_0x9b8053){return BPromise[_0x5f16('0x21')](_0x9b8053);}return _0x347905['save']();};}function saveUpdates(_0x77efad,_0x21c04c){return function(_0x49f91a){if(_0x49f91a){return _0x49f91a[_0x5f16('0x22')](_0x77efad)[_0x5f16('0x23')](function(_0xe5a540){return _0xe5a540;});}return null;};}function removeEntity(_0x3c81b0,_0x20d2e0){return function(_0x240220){if(_0x240220){return _0x240220[_0x5f16('0x24')]()['then'](function(){_0x3c81b0[_0x5f16('0x19')](0xcc)[_0x5f16('0x1a')]();});}};}function handleEntityNotFound(_0x2dbc26,_0x50f517){return function(_0x2c866b){if(!_0x2c866b){_0x2dbc26['sendStatus'](0x194);}return _0x2c866b;};}function handleError(_0xeb0784,_0x533a46){_0x533a46=_0x533a46||0x1f4;return function(_0x565f7b){logger[_0x5f16('0x25')](_0x565f7b['stack']);if(_0x565f7b['name']){delete _0x565f7b['name'];}_0xeb0784[_0x5f16('0x19')](_0x533a46)[_0x5f16('0x26')](_0x565f7b);};}exports['index']=function(_0x5a59e1,_0x5bca79){var _0x5082a4={},_0x2e47cb={},_0x431597={'count':0x0,'rows':[]};var _0x50a88a=_[_0x5f16('0x27')](db[_0x5f16('0x28')][_0x5f16('0x29')],function(_0x25219b){return{'name':_0x25219b[_0x5f16('0x2a')],'type':_0x25219b[_0x5f16('0x2b')][_0x5f16('0x2c')]};});_0x2e47cb['model']=_['map'](_0x50a88a,_0x5f16('0x2d'));_0x2e47cb['query']=_[_0x5f16('0x2e')](_0x5a59e1['query']);_0x2e47cb[_0x5f16('0x2f')]=_[_0x5f16('0x30')](_0x2e47cb[_0x5f16('0x31')],_0x2e47cb['query']);_0x5082a4[_0x5f16('0x32')]=_['intersection'](_0x2e47cb[_0x5f16('0x31')],qs[_0x5f16('0x33')](_0x5a59e1[_0x5f16('0x34')][_0x5f16('0x33')]));_0x5082a4[_0x5f16('0x32')]=_0x5082a4[_0x5f16('0x32')][_0x5f16('0x35')]?_0x5082a4[_0x5f16('0x32')]:_0x2e47cb[_0x5f16('0x31')];if(!_0x5a59e1[_0x5f16('0x34')]['hasOwnProperty']('nolimit')){_0x5082a4[_0x5f16('0x1e')]=qs[_0x5f16('0x1e')](_0x5a59e1[_0x5f16('0x34')][_0x5f16('0x1e')]);_0x5082a4[_0x5f16('0x1c')]=qs[_0x5f16('0x1c')](_0x5a59e1[_0x5f16('0x34')][_0x5f16('0x1c')]);}_0x5082a4['order']=qs[_0x5f16('0x36')](_0x5a59e1[_0x5f16('0x34')][_0x5f16('0x36')]);_0x5082a4[_0x5f16('0x37')]=qs[_0x5f16('0x2f')](_[_0x5f16('0x38')](_0x5a59e1[_0x5f16('0x34')],_0x2e47cb[_0x5f16('0x2f')]),_0x50a88a);if(_0x5a59e1[_0x5f16('0x34')][_0x5f16('0x39')]){_0x5082a4['where']=_[_0x5f16('0x3a')](_0x5082a4[_0x5f16('0x37')],{'$or':_[_0x5f16('0x27')](_0x50a88a,function(_0x31ec14){if(_0x31ec14['type']!==_0x5f16('0x3b')){var _0x1a9787={};_0x1a9787[_0x31ec14['name']]={'$like':'%'+_0x5a59e1[_0x5f16('0x34')][_0x5f16('0x39')]+'%'};return _0x1a9787;}})});}_0x5082a4=_[_0x5f16('0x3a')]({},_0x5082a4,_0x5a59e1[_0x5f16('0x3c')]);var _0x5c7717={'where':_0x5082a4['where']};return db[_0x5f16('0x28')][_0x5f16('0x1f')](_0x5c7717)[_0x5f16('0x23')](function(_0x3b1491){_0x431597[_0x5f16('0x1f')]=_0x3b1491;if(_0x5a59e1[_0x5f16('0x34')][_0x5f16('0x3d')]){_0x5082a4[_0x5f16('0x3e')]=[{'all':!![]}];}return db[_0x5f16('0x28')][_0x5f16('0x3f')](_0x5082a4);})['then'](function(_0x494ffa){_0x431597[_0x5f16('0x40')]=_0x494ffa;return _0x431597;})[_0x5f16('0x23')](respondWithFilteredResult(_0x5bca79,_0x5082a4))[_0x5f16('0x41')](handleError(_0x5bca79,null));};exports[_0x5f16('0x42')]=function(_0x22b792,_0x357e2d){var _0x13f415={'raw':!![],'where':{'id':_0x22b792[_0x5f16('0x43')]['id']}},_0x22be5a={};_0x22be5a[_0x5f16('0x31')]=_[_0x5f16('0x2e')](db['SquareDetailsReport']['rawAttributes']);_0x22be5a['query']=_[_0x5f16('0x2e')](_0x22b792[_0x5f16('0x34')]);_0x22be5a[_0x5f16('0x2f')]=_[_0x5f16('0x30')](_0x22be5a[_0x5f16('0x31')],_0x22be5a['query']);_0x13f415[_0x5f16('0x32')]=_['intersection'](_0x22be5a[_0x5f16('0x31')],qs[_0x5f16('0x33')](_0x22b792['query'][_0x5f16('0x33')]));_0x13f415[_0x5f16('0x32')]=_0x13f415[_0x5f16('0x32')][_0x5f16('0x35')]?_0x13f415['attributes']:_0x22be5a[_0x5f16('0x31')];if(_0x22b792[_0x5f16('0x34')][_0x5f16('0x3d')]){_0x13f415[_0x5f16('0x3e')]=[{'all':!![]}];}_0x13f415=_[_0x5f16('0x3a')]({},_0x13f415,_0x22b792[_0x5f16('0x3c')]);return db[_0x5f16('0x28')][_0x5f16('0x44')](_0x13f415)[_0x5f16('0x23')](handleEntityNotFound(_0x357e2d,null))[_0x5f16('0x23')](respondWithResult(_0x357e2d,null))[_0x5f16('0x41')](handleError(_0x357e2d,null));};exports['create']=function(_0x48cffa,_0x27c62a){return db[_0x5f16('0x28')][_0x5f16('0x45')](_0x48cffa[_0x5f16('0x46')],{})[_0x5f16('0x23')](respondWithResult(_0x27c62a,0xc9))[_0x5f16('0x41')](handleError(_0x27c62a,null));};exports[_0x5f16('0x22')]=function(_0x222461,_0x3887e5){if(_0x222461[_0x5f16('0x46')]['id']){delete _0x222461['body']['id'];}return db['SquareDetailsReport'][_0x5f16('0x44')]({'where':{'id':_0x222461[_0x5f16('0x43')]['id']}})['then'](handleEntityNotFound(_0x3887e5,null))['then'](saveUpdates(_0x222461['body'],null))['then'](respondWithResult(_0x3887e5,null))[_0x5f16('0x41')](handleError(_0x3887e5,null));};exports[_0x5f16('0x24')]=function(_0x3fb059,_0x1b9b25){return db[_0x5f16('0x28')][_0x5f16('0x44')]({'where':{'id':_0x3fb059[_0x5f16('0x43')]['id']}})['then'](handleEntityNotFound(_0x1b9b25,null))[_0x5f16('0x23')](removeEntity(_0x1b9b25,null))[_0x5f16('0x41')](handleError(_0x1b9b25,null));};exports[_0x5f16('0x47')]=function(_0x47b447,_0x140326){return db[_0x5f16('0x28')][_0x5f16('0x47')]()['then'](respondWithResult(_0x140326,null))['catch'](handleError(_0x140326,null));}; \ No newline at end of file +var _0xed69=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','SquareDetailsReport','includeAll','findAll','rows','show','params','include','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0xed69,0x8b));var _0x9ed6=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0xed69[_0x2c3a8f];return _0x189412;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ed6('0x0'));var zipdir=require(_0x9ed6('0x1'));var jsonpatch=require(_0x9ed6('0x2'));var rp=require(_0x9ed6('0x3'));var moment=require(_0x9ed6('0x4'));var BPromise=require(_0x9ed6('0x5'));var Mustache=require(_0x9ed6('0x6'));var util=require('util');var path=require(_0x9ed6('0x7'));var sox=require(_0x9ed6('0x8'));var csv=require(_0x9ed6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ed6('0xa'));var _=require(_0x9ed6('0xb'));var squel=require(_0x9ed6('0xc'));var crypto=require(_0x9ed6('0xd'));var jsforce=require(_0x9ed6('0xe'));var deskjs=require(_0x9ed6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9ed6('0x10'));var Papa=require(_0x9ed6('0x11'));var Redis=require('ioredis');var authService=require(_0x9ed6('0x12'));var qs=require(_0x9ed6('0x13'));var as=require(_0x9ed6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9ed6('0x15'));var utils=require('../../config/utils');var config=require(_0x9ed6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ed6('0x17'))['db'];function respondWithStatusCode(_0x3c4fed,_0x4ec543){_0x4ec543=_0x4ec543||0xcc;return function(_0x549fec){if(_0x549fec){return _0x3c4fed[_0x9ed6('0x18')](_0x4ec543);}return _0x3c4fed[_0x9ed6('0x19')](_0x4ec543)['end']();};}function respondWithResult(_0x1f82b2,_0x2a54c2){_0x2a54c2=_0x2a54c2||0xc8;return function(_0x4eb19b){if(_0x4eb19b){return _0x1f82b2['status'](_0x2a54c2)[_0x9ed6('0x1a')](_0x4eb19b);}};}function respondWithFilteredResult(_0x3185c8,_0x14b731){return function(_0x7389e){if(_0x7389e){var _0x1680dd=typeof _0x14b731[_0x9ed6('0x1b')]===_0x9ed6('0x1c')&&typeof _0x14b731[_0x9ed6('0x1d')]===_0x9ed6('0x1c');var _0x241140=_0x7389e['count'];var _0x496ad8=_0x1680dd?0x0:_0x14b731[_0x9ed6('0x1b')];var _0x57aeea=_0x1680dd?_0x7389e[_0x9ed6('0x1e')]:_0x14b731[_0x9ed6('0x1b')]+_0x14b731['limit'];var _0x42e283;if(_0x57aeea>=_0x241140){_0x57aeea=_0x241140;_0x42e283=0xc8;}else{_0x42e283=0xce;}_0x3185c8[_0x9ed6('0x19')](_0x42e283);return _0x3185c8['set'](_0x9ed6('0x1f'),_0x496ad8+'-'+_0x57aeea+'/'+_0x241140)[_0x9ed6('0x1a')](_0x7389e);}return null;};}function patchUpdates(_0x4baf79){return function(_0x3a947e){try{jsonpatch['apply'](_0x3a947e,_0x4baf79,!![]);}catch(_0xe7ffd2){return BPromise[_0x9ed6('0x20')](_0xe7ffd2);}return _0x3a947e[_0x9ed6('0x21')]();};}function saveUpdates(_0x54318c,_0x3967db){return function(_0x2d7704){if(_0x2d7704){return _0x2d7704[_0x9ed6('0x22')](_0x54318c)[_0x9ed6('0x23')](function(_0x22dde6){return _0x22dde6;});}return null;};}function removeEntity(_0x408049,_0x672ef2){return function(_0x4d6c44){if(_0x4d6c44){return _0x4d6c44['destroy']()[_0x9ed6('0x23')](function(){_0x408049[_0x9ed6('0x19')](0xcc)[_0x9ed6('0x24')]();});}};}function handleEntityNotFound(_0x40e62f,_0x155315){return function(_0x2d3d89){if(!_0x2d3d89){_0x40e62f['sendStatus'](0x194);}return _0x2d3d89;};}function handleError(_0x41a1d0,_0x23157d){_0x23157d=_0x23157d||0x1f4;return function(_0x24ea7b){logger[_0x9ed6('0x25')](_0x24ea7b[_0x9ed6('0x26')]);if(_0x24ea7b[_0x9ed6('0x27')]){delete _0x24ea7b['name'];}_0x41a1d0['status'](_0x23157d)[_0x9ed6('0x28')](_0x24ea7b);};}exports[_0x9ed6('0x29')]=function(_0x2d20fb,_0xba7173){var _0x390b93={},_0x3d8f07={},_0x2f0d69={'count':0x0,'rows':[]};var _0x2eceb2=_[_0x9ed6('0x2a')](db['SquareDetailsReport'][_0x9ed6('0x2b')],function(_0x184891){return{'name':_0x184891[_0x9ed6('0x2c')],'type':_0x184891[_0x9ed6('0x2d')][_0x9ed6('0x2e')]};});_0x3d8f07[_0x9ed6('0x2f')]=_[_0x9ed6('0x2a')](_0x2eceb2,'name');_0x3d8f07['query']=_[_0x9ed6('0x30')](_0x2d20fb[_0x9ed6('0x31')]);_0x3d8f07[_0x9ed6('0x32')]=_[_0x9ed6('0x33')](_0x3d8f07[_0x9ed6('0x2f')],_0x3d8f07[_0x9ed6('0x31')]);_0x390b93[_0x9ed6('0x34')]=_[_0x9ed6('0x33')](_0x3d8f07[_0x9ed6('0x2f')],qs[_0x9ed6('0x35')](_0x2d20fb[_0x9ed6('0x31')][_0x9ed6('0x35')]));_0x390b93[_0x9ed6('0x34')]=_0x390b93[_0x9ed6('0x34')][_0x9ed6('0x36')]?_0x390b93[_0x9ed6('0x34')]:_0x3d8f07[_0x9ed6('0x2f')];if(!_0x2d20fb[_0x9ed6('0x31')][_0x9ed6('0x37')](_0x9ed6('0x38'))){_0x390b93[_0x9ed6('0x1d')]=qs['limit'](_0x2d20fb[_0x9ed6('0x31')][_0x9ed6('0x1d')]);_0x390b93[_0x9ed6('0x1b')]=qs[_0x9ed6('0x1b')](_0x2d20fb[_0x9ed6('0x31')][_0x9ed6('0x1b')]);}_0x390b93['order']=qs[_0x9ed6('0x39')](_0x2d20fb[_0x9ed6('0x31')][_0x9ed6('0x39')]);_0x390b93[_0x9ed6('0x3a')]=qs['filters'](_['pick'](_0x2d20fb[_0x9ed6('0x31')],_0x3d8f07[_0x9ed6('0x32')]),_0x2eceb2);if(_0x2d20fb[_0x9ed6('0x31')]['filter']){_0x390b93['where']=_[_0x9ed6('0x3b')](_0x390b93[_0x9ed6('0x3a')],{'$or':_[_0x9ed6('0x2a')](_0x2eceb2,function(_0x2da821){if(_0x2da821[_0x9ed6('0x2d')]!==_0x9ed6('0x3c')){var _0x2e3436={};_0x2e3436[_0x2da821[_0x9ed6('0x27')]]={'$like':'%'+_0x2d20fb['query'][_0x9ed6('0x3d')]+'%'};return _0x2e3436;}})});}_0x390b93=_['merge']({},_0x390b93,_0x2d20fb[_0x9ed6('0x3e')]);var _0x38dffb={'where':_0x390b93['where']};return db[_0x9ed6('0x3f')][_0x9ed6('0x1e')](_0x38dffb)[_0x9ed6('0x23')](function(_0x23bb93){_0x2f0d69[_0x9ed6('0x1e')]=_0x23bb93;if(_0x2d20fb['query'][_0x9ed6('0x40')]){_0x390b93['include']=[{'all':!![]}];}return db[_0x9ed6('0x3f')][_0x9ed6('0x41')](_0x390b93);})['then'](function(_0x8583f5){_0x2f0d69[_0x9ed6('0x42')]=_0x8583f5;return _0x2f0d69;})['then'](respondWithFilteredResult(_0xba7173,_0x390b93))['catch'](handleError(_0xba7173,null));};exports[_0x9ed6('0x43')]=function(_0x30869f,_0x30d5b8){var _0x364f1c={'raw':!![],'where':{'id':_0x30869f[_0x9ed6('0x44')]['id']}},_0x153191={};_0x153191[_0x9ed6('0x2f')]=_[_0x9ed6('0x30')](db[_0x9ed6('0x3f')]['rawAttributes']);_0x153191[_0x9ed6('0x31')]=_['keys'](_0x30869f[_0x9ed6('0x31')]);_0x153191['filters']=_[_0x9ed6('0x33')](_0x153191[_0x9ed6('0x2f')],_0x153191[_0x9ed6('0x31')]);_0x364f1c['attributes']=_[_0x9ed6('0x33')](_0x153191['model'],qs[_0x9ed6('0x35')](_0x30869f[_0x9ed6('0x31')]['fields']));_0x364f1c[_0x9ed6('0x34')]=_0x364f1c[_0x9ed6('0x34')][_0x9ed6('0x36')]?_0x364f1c[_0x9ed6('0x34')]:_0x153191[_0x9ed6('0x2f')];if(_0x30869f[_0x9ed6('0x31')][_0x9ed6('0x40')]){_0x364f1c[_0x9ed6('0x45')]=[{'all':!![]}];}_0x364f1c=_[_0x9ed6('0x3b')]({},_0x364f1c,_0x30869f[_0x9ed6('0x3e')]);return db['SquareDetailsReport'][_0x9ed6('0x46')](_0x364f1c)[_0x9ed6('0x23')](handleEntityNotFound(_0x30d5b8,null))[_0x9ed6('0x23')](respondWithResult(_0x30d5b8,null))['catch'](handleError(_0x30d5b8,null));};exports[_0x9ed6('0x47')]=function(_0xccafa8,_0x3f2e6b){return db[_0x9ed6('0x3f')][_0x9ed6('0x47')](_0xccafa8[_0x9ed6('0x48')],{})[_0x9ed6('0x23')](respondWithResult(_0x3f2e6b,0xc9))['catch'](handleError(_0x3f2e6b,null));};exports['update']=function(_0x54a7a7,_0x35164c){if(_0x54a7a7[_0x9ed6('0x48')]['id']){delete _0x54a7a7[_0x9ed6('0x48')]['id'];}return db[_0x9ed6('0x3f')][_0x9ed6('0x46')]({'where':{'id':_0x54a7a7[_0x9ed6('0x44')]['id']}})[_0x9ed6('0x23')](handleEntityNotFound(_0x35164c,null))[_0x9ed6('0x23')](saveUpdates(_0x54a7a7[_0x9ed6('0x48')],null))['then'](respondWithResult(_0x35164c,null))['catch'](handleError(_0x35164c,null));};exports['destroy']=function(_0x31f8b9,_0x13dcea){return db[_0x9ed6('0x3f')][_0x9ed6('0x46')]({'where':{'id':_0x31f8b9[_0x9ed6('0x44')]['id']}})[_0x9ed6('0x23')](handleEntityNotFound(_0x13dcea,null))['then'](removeEntity(_0x13dcea,null))[_0x9ed6('0x49')](handleError(_0x13dcea,null));};exports['describe']=function(_0x571a87,_0x18821d){return db[_0x9ed6('0x3f')][_0x9ed6('0x4a')]()[_0x9ed6('0x23')](respondWithResult(_0x18821d,null))['catch'](handleError(_0x18821d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 34f20f7..38e2b18 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 _0x71cf=['bluebird','request-promise','path','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api'];(function(_0x2ed51e,_0x20d606){var _0x44318c=function(_0x1df2bd){while(--_0x1df2bd){_0x2ed51e['push'](_0x2ed51e['shift']());}};_0x44318c(++_0x20d606);}(_0x71cf,0x96));var _0xf71c=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x71cf[_0x5575cd];return _0x4979a0;};'use strict';var _=require(_0xf71c('0x0'));var util=require(_0xf71c('0x1'));var logger=require(_0xf71c('0x2'))(_0xf71c('0x3'));var moment=require('moment');var BPromise=require(_0xf71c('0x4'));var rp=require(_0xf71c('0x5'));var fs=require('fs');var path=require(_0xf71c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0xf71c('0x7')]=function(_0x4517ac,_0x43f772){return _0x4517ac[_0xf71c('0x8')](_0xf71c('0x9'),attributes,{'tableName':_0xf71c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6ec=['api','bluebird','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger'];(function(_0xe5b3e1,_0x57a645){var _0x121dad=function(_0x3aa300){while(--_0x3aa300){_0xe5b3e1['push'](_0xe5b3e1['shift']());}};_0x121dad(++_0x57a645);}(_0xb6ec,0x159));var _0xcb6e=function(_0x422afb,_0x67ef14){_0x422afb=_0x422afb-0x0;var _0xf4f25d=_0xb6ec[_0x422afb];return _0xf4f25d;};'use strict';var _=require(_0xcb6e('0x0'));var util=require(_0xcb6e('0x1'));var logger=require(_0xcb6e('0x2'))(_0xcb6e('0x3'));var moment=require('moment');var BPromise=require(_0xcb6e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcb6e('0x5'));var config=require(_0xcb6e('0x6'));var attributes=require(_0xcb6e('0x7'));module[_0xcb6e('0x8')]=function(_0x4d6efa,_0x241b93){return _0x4d6efa[_0xcb6e('0x9')](_0xcb6e('0xa'),attributes,{'tableName':_0xcb6e('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 9497bca..9c41153 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 _0x1c9a=['catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1c9a,0x98));var _0xa1c9=function(_0x483a52,_0x3eaec1){_0x483a52=_0x483a52-0x0;var _0x365568=_0x1c9a[_0x483a52];return _0x365568;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5448f2,_0x222624,_0x463c9c){return new BPromise(function(_0x3f07c2,_0x5059df){return client[_0xa1c9('0xa')](_0x5448f2,_0x463c9c)[_0xa1c9('0xb')](function(_0x24136d){logger[_0xa1c9('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x222624,_0xa1c9('0xd'));logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x222624,_0xa1c9('0xd'),JSON[_0xa1c9('0x10')](_0x24136d));if(_0x24136d[_0xa1c9('0x11')]){if(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x5059df(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x3f07c2(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xc')](_0xa1c9('0x13'),_0x222624,_0xa1c9('0xd'));_0x3f07c2(_0x24136d[_0xa1c9('0x15')][_0xa1c9('0x14')]);}})[_0xa1c9('0x16')](function(_0x373f5d){logger['error'](_0xa1c9('0x13'),_0x222624,_0x373f5d);_0x5059df(_0x373f5d);});});}exports[_0xa1c9('0x17')]=function(_0x224ae4){var _0x50db9b=this;return new Promise(function(_0x2fb81e,_0x5ab911){return db[_0xa1c9('0x18')][_0xa1c9('0x19')](_0x224ae4[_0xa1c9('0x1a')],{'raw':_0x224ae4['options']?_0x224ae4[_0xa1c9('0x1b')][_0xa1c9('0x1c')]===undefined?!![]:![]:!![]})[_0xa1c9('0xb')](function(_0x4edf37){logger[_0xa1c9('0xc')](_0xa1c9('0x17'),_0x224ae4);logger['debug'](_0xa1c9('0x17'),_0x224ae4,JSON[_0xa1c9('0x10')](_0x4edf37));_0x2fb81e(_0x4edf37);})[_0xa1c9('0x16')](function(_0x4d05d0){logger[_0xa1c9('0x11')](_0xa1c9('0x17'),_0x4d05d0[_0xa1c9('0x14')],_0x224ae4);_0x5ab911(_0x50db9b[_0xa1c9('0x11')](0x1f4,_0x4d05d0[_0xa1c9('0x14')]));});});}; \ No newline at end of file +var _0x17a7=['debug','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x17a7,0xc2));var _0x717a=function(_0x23a905,_0xaac615){_0x23a905=_0x23a905-0x0;var _0x52140a=_0x17a7[_0x23a905];return _0x52140a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x717a('0x0'));var rs=require(_0x717a('0x1'));var fs=require('fs');var Redis=require(_0x717a('0x2'));var db=require(_0x717a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x717a('0x4'))('rpc');var config=require(_0x717a('0x5'));var jayson=require(_0x717a('0x6'));var client=jayson['client'][_0x717a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ca7a6,_0xd7d2ce,_0x311738){return new BPromise(function(_0x536824,_0x1066d4){return client['request'](_0x1ca7a6,_0x311738)[_0x717a('0x8')](function(_0x567130){logger[_0x717a('0x9')](_0x717a('0xa'),_0xd7d2ce,_0x717a('0xb'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'),JSON[_0x717a('0xc')](_0x567130));if(_0x567130[_0x717a('0xd')]){if(_0x567130[_0x717a('0xd')][_0x717a('0xe')]===0x1f4){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x567130['error'][_0x717a('0xf')]);return _0x1066d4(_0x567130['error']['message']);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xd7d2ce,_0x567130[_0x717a('0xd')]['message']);return _0x536824(_0x567130[_0x717a('0xd')]['message']);}else{logger[_0x717a('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'));_0x536824(_0x567130[_0x717a('0x10')][_0x717a('0xf')]);}})['catch'](function(_0x186b4d){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x186b4d);_0x1066d4(_0x186b4d);});});}exports[_0x717a('0x11')]=function(_0x152e10){var _0x8b295=this;return new Promise(function(_0x45dc38,_0x2fe7a7){return db[_0x717a('0x12')][_0x717a('0x13')](_0x152e10[_0x717a('0x14')],{'raw':_0x152e10[_0x717a('0x15')]?_0x152e10['options']['raw']===undefined?!![]:![]:!![]})[_0x717a('0x8')](function(_0x1d7ebd){logger[_0x717a('0x9')](_0x717a('0x11'),_0x152e10);logger[_0x717a('0x16')](_0x717a('0x11'),_0x152e10,JSON[_0x717a('0xc')](_0x1d7ebd));_0x45dc38(_0x1d7ebd);})[_0x717a('0x17')](function(_0x4e95dc){logger[_0x717a('0xd')](_0x717a('0x11'),_0x4e95dc[_0x717a('0xf')],_0x152e10);_0x2fe7a7(_0x8b295[_0x717a('0xd')](0x1f4,_0x4e95dc[_0x717a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 92be4ee..bd23428 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 _0x17dc=['../../components/auth/service','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x17dc,0x77));var _0xc17d=function(_0x219f7a,_0x5d1ce7){_0x219f7a=_0x219f7a-0x0;var _0x1cdeb2=_0x17dc[_0x219f7a];return _0x1cdeb2;};'use strict';var express=require(_0xc17d('0x0'));var router=express['Router']();var auth=require(_0xc17d('0x1'));var controller=require('./system.controller');router[_0xc17d('0x2')]('/',auth[_0xc17d('0x3')](),controller[_0xc17d('0x4')]);router['get'](_0xc17d('0x5'),auth[_0xc17d('0x3')](),controller[_0xc17d('0x6')]);module[_0xc17d('0x7')]=router; \ No newline at end of file +var _0xfb1f=['get','isAuthenticated','index','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0xfb1f,0x184));var _0xffb1=function(_0x2d471e,_0x22476c){_0x2d471e=_0x2d471e-0x0;var _0x3be630=_0xfb1f[_0x2d471e];return _0x3be630;};'use strict';var express=require(_0xffb1('0x0'));var router=express[_0xffb1('0x1')]();var auth=require(_0xffb1('0x2'));var controller=require(_0xffb1('0x3'));router[_0xffb1('0x4')]('/',auth[_0xffb1('0x5')](),controller[_0xffb1('0x6')]);router[_0xffb1('0x4')]('/process/:pid/kill',auth[_0xffb1('0x5')](),controller['killProcess']);module[_0xffb1('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 3437513..acc6bb9 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 _0xdc93=['pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','getAllData','then','status','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0xdc93,0x1c8));var _0x3dc9=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0xdc93[_0x420f2a];return _0x28f802;};'use strict';var info=require(_0x3dc9('0x0'));var exec=require(_0x3dc9('0x1'))[_0x3dc9('0x2')];var logger=require(_0x3dc9('0x3'))(_0x3dc9('0x4'));var util=require('util');var BPromise=require(_0x3dc9('0x5'));var _=require(_0x3dc9('0x6'));function handleError(_0x2f4afd,_0x13d0a4,_0x517ccd){_0x13d0a4=_0x13d0a4||0x1f4;return function(_0x42ecf1){logger[_0x3dc9('0x7')](_0x3dc9('0x8'),_0x517ccd,_0x13d0a4,util[_0x3dc9('0x9')](_0x42ecf1,{'showHidden':![],'depth':null}));delete _0x42ecf1[_0x3dc9('0xa')];_0x2f4afd['status'](_0x13d0a4)['send'](_0x42ecf1);};}exports['index']=function(_0x463722,_0x15a819){return info[_0x3dc9('0xb')]()[_0x3dc9('0xc')](function(_0x3d39b2){return _0x15a819[_0x3dc9('0xd')](0xc8)[_0x3dc9('0xe')](_0x3d39b2);})[_0x3dc9('0xf')](function(_0xb913b1){return _0x15a819[_0x3dc9('0xd')](0x1f4)[_0x3dc9('0xe')](_0xb913b1);});};exports['killProcess']=function(_0xcf56cc,_0x2cbec9){var _0x32a3a5=[_0x3dc9('0x10')];return new BPromise(function(_0x108863,_0x12a879){return exec(util[_0x3dc9('0x11')](_0x3dc9('0x12'),_0xcf56cc[_0x3dc9('0x13')][_0x3dc9('0x14')]),function(_0x575f3f,_0x1a090e,_0x5d6c90){if(_0x575f3f){return _0x12a879(_0x575f3f);}return _0x108863(_0x1a090e);});})['then'](function(_0x3357b4){var _0x5542aa=![];var _0x41bf7e=_0x3357b4['split'](/\n/);for(var _0x5234e4=0x0,_0x713a4=_0x32a3a5[_0x3dc9('0x15')];_0x5234e4<_0x713a4,_0x5542aa===![];_0x5234e4+=0x1){if(_0x3357b4[_0x3dc9('0x16')](_0x32a3a5[_0x5234e4])>=0x0){_0x5542aa=!![];}}if(!_0x5542aa){throw new Error(util[_0x3dc9('0x11')](_0x3dc9('0x17'),_0xcf56cc['params']['pid']));}process[_0x3dc9('0x18')](_0xcf56cc[_0x3dc9('0x13')][_0x3dc9('0x14')],_0x3dc9('0x19'));return _0x2cbec9[_0x3dc9('0xd')](0xc8)['json']({'message':util[_0x3dc9('0x11')](_0x3dc9('0x1a'),_0xcf56cc[_0x3dc9('0x13')][_0x3dc9('0x14')])});})[_0x3dc9('0xf')](handleError(_0x2cbec9,null,_0x3dc9('0x1b')));}; \ No newline at end of file +var _0xf722=['exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','then','status','json','catch','components/import/cm','params','split','length','indexOf','pid','kill','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process'];(function(_0x24739e,_0x1dbb4d){var _0x4cc70d=function(_0x1463e4){while(--_0x1463e4){_0x24739e['push'](_0x24739e['shift']());}};_0x4cc70d(++_0x1dbb4d);}(_0xf722,0x1be));var _0x2f72=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xf722[_0x2f5ac5];return _0x37c9a8;};'use strict';var info=require(_0x2f72('0x0'));var exec=require(_0x2f72('0x1'))[_0x2f72('0x2')];var logger=require(_0x2f72('0x3'))(_0x2f72('0x4'));var util=require('util');var BPromise=require(_0x2f72('0x5'));var _=require(_0x2f72('0x6'));function handleError(_0x19a350,_0x4ec244,_0x4610b7){_0x4ec244=_0x4ec244||0x1f4;return function(_0x1bf5e8){logger[_0x2f72('0x7')](_0x2f72('0x8'),_0x4610b7,_0x4ec244,util[_0x2f72('0x9')](_0x1bf5e8,{'showHidden':![],'depth':null}));delete _0x1bf5e8[_0x2f72('0xa')];_0x19a350['status'](_0x4ec244)[_0x2f72('0xb')](_0x1bf5e8);};}exports[_0x2f72('0xc')]=function(_0x450c05,_0x8bbef5){return info[_0x2f72('0xd')]()[_0x2f72('0xe')](function(_0x16f2de){return _0x8bbef5[_0x2f72('0xf')](0xc8)[_0x2f72('0x10')](_0x16f2de);})[_0x2f72('0x11')](function(_0x4c876f){return _0x8bbef5['status'](0x1f4)['json'](_0x4c876f);});};exports['killProcess']=function(_0x3d6e43,_0x39c9b8){var _0x5e89fe=[_0x2f72('0x12')];return new BPromise(function(_0x5a239a,_0x3161a9){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x3d6e43[_0x2f72('0x13')]['pid']),function(_0x541457,_0x185aca,_0x19be63){if(_0x541457){return _0x3161a9(_0x541457);}return _0x5a239a(_0x185aca);});})[_0x2f72('0xe')](function(_0x510ee9){var _0x3623a8=![];var _0x4dfc0b=_0x510ee9[_0x2f72('0x14')](/\n/);for(var _0x22b69e=0x0,_0x458624=_0x5e89fe[_0x2f72('0x15')];_0x22b69e<_0x458624,_0x3623a8===![];_0x22b69e+=0x1){if(_0x510ee9[_0x2f72('0x16')](_0x5e89fe[_0x22b69e])>=0x0){_0x3623a8=!![];}}if(!_0x3623a8){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3d6e43[_0x2f72('0x13')][_0x2f72('0x17')]));}process[_0x2f72('0x18')](_0x3d6e43['params'][_0x2f72('0x17')],'SIGINT');return _0x39c9b8[_0x2f72('0xf')](0xc8)[_0x2f72('0x10')]({'message':util[_0x2f72('0x19')](_0x2f72('0x1a'),_0x3d6e43[_0x2f72('0x13')][_0x2f72('0x17')])});})[_0x2f72('0x11')](handleError(_0x39c9b8,null,_0x2f72('0x1b')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6719dae..a263a99 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 _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x65d7c5,_0x13e1e9){var _0x2ac24e=function(_0x1540f4){while(--_0x1540f4){_0x65d7c5['push'](_0x65d7c5['shift']());}};_0x2ac24e(++_0x13e1e9);}(_0x4522,0x1a0));var _0x2452=function(_0x2c94b7,_0x46b3a5){_0x2c94b7=_0x2c94b7-0x0;var _0x40bc13=_0x4522[_0x2c94b7];return _0x40bc13;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2452('0xf')]);router['put']('/:id',auth[_0x2452('0x9')](),controller[_0x2452('0x10')]);router[_0x2452('0x11')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x12')]);module[_0x2452('0x13')]=router; \ No newline at end of file +var _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x21e201,_0xaa1005){var _0x5d2797=function(_0x419fbb){while(--_0x419fbb){_0x21e201['push'](_0x21e201['shift']());}};_0x5d2797(++_0xaa1005);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x56d896,_0x3b4c9c){_0x56d896=_0x56d896-0x0;var _0x293639=_0xd0bb[_0x56d896];return _0x293639;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./tag.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 4ed8d47..284bd13 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 _0xd4f4=['exports','STRING','name','#0091EA','sequelize'];(function(_0x1c423c,_0x5713a0){var _0x5d4020=function(_0x1f40a7){while(--_0x1f40a7){_0x1c423c['push'](_0x1c423c['shift']());}};_0x5d4020(++_0x5713a0);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x508445,_0x4aff84){_0x508445=_0x508445-0x0;var _0x10fe51=_0xd4f4[_0x508445];return _0x10fe51;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'name':{'type':Sequelize[_0x4d4f('0x2')],'unique':_0x4d4f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4d4f('0x2')],'defaultValue':_0x4d4f('0x4')},'description':{'type':Sequelize[_0x4d4f('0x2')]}}; \ No newline at end of file +var _0xbca8=['sequelize','exports','STRING','name'];(function(_0x523c78,_0x14129e){var _0x116745=function(_0x430e7b){while(--_0x430e7b){_0x523c78['push'](_0x523c78['shift']());}};_0x116745(++_0x14129e);}(_0xbca8,0xcc));var _0x8bca=function(_0x340667,_0x612d86){_0x340667=_0x340667-0x0;var _0x295468=_0xbca8[_0x340667];return _0x295468;};'use strict';var Sequelize=require(_0x8bca('0x0'));module[_0x8bca('0x1')]={'name':{'type':Sequelize[_0x8bca('0x2')],'unique':_0x8bca('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8bca('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x8bca('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5dca72b..e482a7e 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 _0x9d9d=['where','pick','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','destroy','end','error','stack','name','send','Tag','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2ba527,_0x5d28e8){var _0x3e5e81=function(_0x4d46c7){while(--_0x4d46c7){_0x2ba527['push'](_0x2ba527['shift']());}};_0x3e5e81(++_0x5d28e8);}(_0x9d9d,0x1ba));var _0xd9d9=function(_0x2752e6,_0x485ddb){_0x2752e6=_0x2752e6-0x0;var _0xfbe536=_0x9d9d[_0x2752e6];return _0xfbe536;};'use strict';var emlformat=require(_0xd9d9('0x0'));var rimraf=require(_0xd9d9('0x1'));var zipdir=require(_0xd9d9('0x2'));var jsonpatch=require(_0xd9d9('0x3'));var rp=require('request-promise');var moment=require(_0xd9d9('0x4'));var BPromise=require(_0xd9d9('0x5'));var Mustache=require('mustache');var util=require(_0xd9d9('0x6'));var path=require('path');var sox=require(_0xd9d9('0x7'));var csv=require(_0xd9d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9d9('0x9'));var _=require(_0xd9d9('0xa'));var squel=require(_0xd9d9('0xb'));var crypto=require(_0xd9d9('0xc'));var jsforce=require(_0xd9d9('0xd'));var deskjs=require(_0xd9d9('0xe'));var toCsv=require(_0xd9d9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd9d9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd9d9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd9d9('0x11'))('api');var utils=require(_0xd9d9('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd9d9('0x13'))['db'];function respondWithStatusCode(_0x257aba,_0x342703){_0x342703=_0x342703||0xcc;return function(_0x5da241){if(_0x5da241){return _0x257aba[_0xd9d9('0x14')](_0x342703);}return _0x257aba['status'](_0x342703)['end']();};}function respondWithResult(_0x5de83b,_0x3b320c){_0x3b320c=_0x3b320c||0xc8;return function(_0x4dc5b0){if(_0x4dc5b0){return _0x5de83b[_0xd9d9('0x15')](_0x3b320c)[_0xd9d9('0x16')](_0x4dc5b0);}};}function respondWithFilteredResult(_0xe6ff49,_0x3cb768){return function(_0x20ffea){if(_0x20ffea){var _0x103c02=typeof _0x3cb768[_0xd9d9('0x17')]===_0xd9d9('0x18')&&typeof _0x3cb768[_0xd9d9('0x19')]==='undefined';var _0x532802=_0x20ffea[_0xd9d9('0x1a')];var _0x1b3fb4=_0x103c02?0x0:_0x3cb768[_0xd9d9('0x17')];var _0x554930=_0x103c02?_0x20ffea[_0xd9d9('0x1a')]:_0x3cb768[_0xd9d9('0x17')]+_0x3cb768['limit'];var _0xcbc441;if(_0x554930>=_0x532802){_0x554930=_0x532802;_0xcbc441=0xc8;}else{_0xcbc441=0xce;}_0xe6ff49[_0xd9d9('0x15')](_0xcbc441);return _0xe6ff49[_0xd9d9('0x1b')](_0xd9d9('0x1c'),_0x1b3fb4+'-'+_0x554930+'/'+_0x532802)[_0xd9d9('0x16')](_0x20ffea);}return null;};}function patchUpdates(_0x503fd6){return function(_0x2eabdb){try{jsonpatch[_0xd9d9('0x1d')](_0x2eabdb,_0x503fd6,!![]);}catch(_0x155051){return BPromise[_0xd9d9('0x1e')](_0x155051);}return _0x2eabdb[_0xd9d9('0x1f')]();};}function saveUpdates(_0x18d26c,_0x374fdb){return function(_0x1ab7bb){if(_0x1ab7bb){return _0x1ab7bb['update'](_0x18d26c)[_0xd9d9('0x20')](function(_0x2114ec){return _0x2114ec;});}return null;};}function removeEntity(_0x3a72f3,_0x529a8e){return function(_0x3042f5){if(_0x3042f5){return _0x3042f5['destroy']()[_0xd9d9('0x20')](function(){var _0x155e0d=_0x3042f5[_0xd9d9('0x21')]({'plain':!![]});var _0x15a040='Tags';return db['UserProfileResource'][_0xd9d9('0x22')]({'where':{'type':_0x15a040,'resourceId':_0x155e0d['id']}})[_0xd9d9('0x20')](function(){return _0x3042f5;});})[_0xd9d9('0x20')](function(){_0x3a72f3['status'](0xcc)[_0xd9d9('0x23')]();});}};}function handleEntityNotFound(_0x510b56,_0x129b8f){return function(_0xc39e56){if(!_0xc39e56){_0x510b56[_0xd9d9('0x14')](0x194);}return _0xc39e56;};}function handleError(_0xa098e8,_0x876eed){_0x876eed=_0x876eed||0x1f4;return function(_0x5243e9){logger[_0xd9d9('0x24')](_0x5243e9[_0xd9d9('0x25')]);if(_0x5243e9[_0xd9d9('0x26')]){delete _0x5243e9[_0xd9d9('0x26')];}_0xa098e8[_0xd9d9('0x15')](_0x876eed)[_0xd9d9('0x27')](_0x5243e9);};}exports['index']=function(_0x366b8b,_0x2d61f6){var _0x3c9f33={},_0x57b4cf={},_0xe8985={'count':0x0,'rows':[]};var _0x43d45a=_['map'](db[_0xd9d9('0x28')][_0xd9d9('0x29')],function(_0x41226e){return{'name':_0x41226e[_0xd9d9('0x2a')],'type':_0x41226e['type'][_0xd9d9('0x2b')]};});_0x57b4cf[_0xd9d9('0x2c')]=_['map'](_0x43d45a,_0xd9d9('0x26'));_0x57b4cf['query']=_[_0xd9d9('0x2d')](_0x366b8b[_0xd9d9('0x2e')]);_0x57b4cf[_0xd9d9('0x2f')]=_[_0xd9d9('0x30')](_0x57b4cf[_0xd9d9('0x2c')],_0x57b4cf['query']);_0x3c9f33['attributes']=_[_0xd9d9('0x30')](_0x57b4cf['model'],qs[_0xd9d9('0x31')](_0x366b8b[_0xd9d9('0x2e')]['fields']));_0x3c9f33[_0xd9d9('0x32')]=_0x3c9f33[_0xd9d9('0x32')][_0xd9d9('0x33')]?_0x3c9f33[_0xd9d9('0x32')]:_0x57b4cf[_0xd9d9('0x2c')];if(!_0x366b8b[_0xd9d9('0x2e')][_0xd9d9('0x34')](_0xd9d9('0x35'))){_0x3c9f33[_0xd9d9('0x19')]=qs[_0xd9d9('0x19')](_0x366b8b[_0xd9d9('0x2e')][_0xd9d9('0x19')]);_0x3c9f33['offset']=qs[_0xd9d9('0x17')](_0x366b8b['query'][_0xd9d9('0x17')]);}_0x3c9f33[_0xd9d9('0x36')]=qs[_0xd9d9('0x37')](_0x366b8b[_0xd9d9('0x2e')][_0xd9d9('0x37')]);_0x3c9f33[_0xd9d9('0x38')]=qs[_0xd9d9('0x2f')](_[_0xd9d9('0x39')](_0x366b8b[_0xd9d9('0x2e')],_0x57b4cf[_0xd9d9('0x2f')]),_0x43d45a);if(_0x366b8b[_0xd9d9('0x2e')][_0xd9d9('0x3a')]){_0x3c9f33['where']=_[_0xd9d9('0x3b')](_0x3c9f33[_0xd9d9('0x38')],{'$or':_[_0xd9d9('0x3c')](_0x43d45a,function(_0x1c4856){if(_0x1c4856[_0xd9d9('0x3d')]!==_0xd9d9('0x3e')){var _0x28403a={};_0x28403a[_0x1c4856[_0xd9d9('0x26')]]={'$like':'%'+_0x366b8b[_0xd9d9('0x2e')]['filter']+'%'};return _0x28403a;}})});}_0x3c9f33=_['merge']({},_0x3c9f33,_0x366b8b[_0xd9d9('0x3f')]);var _0x538134={'where':_0x3c9f33[_0xd9d9('0x38')]};return db[_0xd9d9('0x28')][_0xd9d9('0x1a')](_0x538134)[_0xd9d9('0x20')](function(_0x652274){_0xe8985[_0xd9d9('0x1a')]=_0x652274;if(_0x366b8b[_0xd9d9('0x2e')]['includeAll']){_0x3c9f33[_0xd9d9('0x40')]=[{'all':!![]}];}return db['Tag'][_0xd9d9('0x41')](_0x3c9f33);})[_0xd9d9('0x20')](function(_0x1c8eae){_0xe8985[_0xd9d9('0x42')]=_0x1c8eae;return _0xe8985;})[_0xd9d9('0x20')](respondWithFilteredResult(_0x2d61f6,_0x3c9f33))[_0xd9d9('0x43')](handleError(_0x2d61f6,null));};exports[_0xd9d9('0x44')]=function(_0x4fe90c,_0x5e356e){var _0x2a7ca9={'raw':!![],'where':{'id':_0x4fe90c['params']['id']}},_0x5071a5={};_0x5071a5[_0xd9d9('0x2c')]=_[_0xd9d9('0x2d')](db['Tag']['rawAttributes']);_0x5071a5[_0xd9d9('0x2e')]=_[_0xd9d9('0x2d')](_0x4fe90c['query']);_0x5071a5[_0xd9d9('0x2f')]=_[_0xd9d9('0x30')](_0x5071a5[_0xd9d9('0x2c')],_0x5071a5[_0xd9d9('0x2e')]);_0x2a7ca9[_0xd9d9('0x32')]=_[_0xd9d9('0x30')](_0x5071a5[_0xd9d9('0x2c')],qs[_0xd9d9('0x31')](_0x4fe90c[_0xd9d9('0x2e')][_0xd9d9('0x31')]));_0x2a7ca9['attributes']=_0x2a7ca9[_0xd9d9('0x32')]['length']?_0x2a7ca9[_0xd9d9('0x32')]:_0x5071a5[_0xd9d9('0x2c')];if(_0x4fe90c[_0xd9d9('0x2e')][_0xd9d9('0x45')]){_0x2a7ca9[_0xd9d9('0x40')]=[{'all':!![]}];}_0x2a7ca9=_[_0xd9d9('0x3b')]({},_0x2a7ca9,_0x4fe90c['options']);return db[_0xd9d9('0x28')][_0xd9d9('0x46')](_0x2a7ca9)['then'](handleEntityNotFound(_0x5e356e,null))['then'](respondWithResult(_0x5e356e,null))[_0xd9d9('0x43')](handleError(_0x5e356e,null));};exports[_0xd9d9('0x47')]=function(_0x18dc32,_0x2bdbe4){return db[_0xd9d9('0x28')][_0xd9d9('0x47')](_0x18dc32['body'],{})['then'](function(_0x257e3){var _0xe77909=_0x18dc32[_0xd9d9('0x48')]['get']({'plain':!![]});if(!_0xe77909)throw new Error(_0xd9d9('0x49'));if(_0xe77909[_0xd9d9('0x4a')]===_0xd9d9('0x48')){var _0xc376ae=_0x257e3[_0xd9d9('0x21')]({'plain':!![]});var _0x5bacc4=_0xd9d9('0x4b');return db['UserProfileSection']['find']({'where':{'name':_0x5bacc4,'userProfileId':_0xe77909[_0xd9d9('0x4c')]},'raw':!![]})['then'](function(_0x23b956){if(_0x23b956&&_0x23b956['autoAssociation']===0x0){return db[_0xd9d9('0x4d')][_0xd9d9('0x47')]({'name':_0xc376ae[_0xd9d9('0x26')],'resourceId':_0xc376ae['id'],'type':_0x23b956[_0xd9d9('0x26')],'sectionId':_0x23b956['id']},{})['then'](function(){return _0x257e3;});}else{return _0x257e3;}})[_0xd9d9('0x43')](function(_0x26b0c5){logger[_0xd9d9('0x24')](_0xd9d9('0x4e'),_0x26b0c5);throw _0x26b0c5;});}return _0x257e3;})[_0xd9d9('0x20')](respondWithResult(_0x2bdbe4,0xc9))[_0xd9d9('0x43')](handleError(_0x2bdbe4,null));};exports[_0xd9d9('0x4f')]=function(_0x356c92,_0x3550c5){if(_0x356c92[_0xd9d9('0x50')]['id']){delete _0x356c92[_0xd9d9('0x50')]['id'];}return db['Tag']['find']({'where':{'id':_0x356c92[_0xd9d9('0x51')]['id']}})[_0xd9d9('0x20')](handleEntityNotFound(_0x3550c5,null))[_0xd9d9('0x20')](saveUpdates(_0x356c92['body'],null))['then'](respondWithResult(_0x3550c5,null))[_0xd9d9('0x43')](handleError(_0x3550c5,null));};exports[_0xd9d9('0x22')]=function(_0x166443,_0x35e476){return db[_0xd9d9('0x28')][_0xd9d9('0x46')]({'where':{'id':_0x166443[_0xd9d9('0x51')]['id']}})['then'](handleEntityNotFound(_0x35e476,null))[_0xd9d9('0x20')](removeEntity(_0x35e476,null))[_0xd9d9('0x43')](handleError(_0x35e476,null));};exports[_0xd9d9('0x52')]=function(_0x4d8c61,_0x2bcc22){return db[_0xd9d9('0x28')][_0xd9d9('0x52')]()['then'](respondWithResult(_0x2bcc22,null))[_0xd9d9('0x43')](handleError(_0x2bcc22,null));}; \ No newline at end of file +var _0x949a=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x5b15cd,_0x187865){var _0x357324=function(_0x1f124b){while(--_0x1f124b){_0x5b15cd['push'](_0x5b15cd['shift']());}};_0x357324(++_0x187865);}(_0x949a,0x1a7));var _0xa949=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x949a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xa949('0x0'));var rimraf=require(_0xa949('0x1'));var zipdir=require(_0xa949('0x2'));var jsonpatch=require(_0xa949('0x3'));var rp=require(_0xa949('0x4'));var moment=require(_0xa949('0x5'));var BPromise=require(_0xa949('0x6'));var Mustache=require(_0xa949('0x7'));var util=require(_0xa949('0x8'));var path=require(_0xa949('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa949('0xa'));var fs=require('fs');var fs_extra=require(_0xa949('0xb'));var _=require(_0xa949('0xc'));var squel=require(_0xa949('0xd'));var crypto=require('crypto');var jsforce=require(_0xa949('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa949('0xf'));var Papa=require(_0xa949('0x10'));var Redis=require(_0xa949('0x11'));var authService=require(_0xa949('0x12'));var qs=require(_0xa949('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa949('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa949('0x15'));var db=require(_0xa949('0x16'))['db'];function respondWithStatusCode(_0x5afad1,_0x24350a){_0x24350a=_0x24350a||0xcc;return function(_0x4a1938){if(_0x4a1938){return _0x5afad1[_0xa949('0x17')](_0x24350a);}return _0x5afad1['status'](_0x24350a)[_0xa949('0x18')]();};}function respondWithResult(_0x35c8f2,_0x5f442d){_0x5f442d=_0x5f442d||0xc8;return function(_0x1b1663){if(_0x1b1663){return _0x35c8f2[_0xa949('0x19')](_0x5f442d)[_0xa949('0x1a')](_0x1b1663);}};}function respondWithFilteredResult(_0x2ef502,_0x198847){return function(_0x5ab230){if(_0x5ab230){var _0x46d1e0=typeof _0x198847[_0xa949('0x1b')]===_0xa949('0x1c')&&typeof _0x198847[_0xa949('0x1d')]===_0xa949('0x1c');var _0x37e873=_0x5ab230[_0xa949('0x1e')];var _0x34a84e=_0x46d1e0?0x0:_0x198847[_0xa949('0x1b')];var _0xba711f=_0x46d1e0?_0x5ab230[_0xa949('0x1e')]:_0x198847[_0xa949('0x1b')]+_0x198847[_0xa949('0x1d')];var _0x557044;if(_0xba711f>=_0x37e873){_0xba711f=_0x37e873;_0x557044=0xc8;}else{_0x557044=0xce;}_0x2ef502[_0xa949('0x19')](_0x557044);return _0x2ef502[_0xa949('0x1f')](_0xa949('0x20'),_0x34a84e+'-'+_0xba711f+'/'+_0x37e873)['json'](_0x5ab230);}return null;};}function patchUpdates(_0x125936){return function(_0x4dc431){try{jsonpatch[_0xa949('0x21')](_0x4dc431,_0x125936,!![]);}catch(_0x1b5f79){return BPromise[_0xa949('0x22')](_0x1b5f79);}return _0x4dc431[_0xa949('0x23')]();};}function saveUpdates(_0x61ca6d,_0x54e321){return function(_0x40e8e8){if(_0x40e8e8){return _0x40e8e8[_0xa949('0x24')](_0x61ca6d)[_0xa949('0x25')](function(_0x5c8fbb){return _0x5c8fbb;});}return null;};}function removeEntity(_0x565a46,_0x17e1e0){return function(_0x48627b){if(_0x48627b){return _0x48627b[_0xa949('0x26')]()[_0xa949('0x25')](function(){var _0x5a17ec=_0x48627b[_0xa949('0x27')]({'plain':!![]});var _0xe3fecf=_0xa949('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0xe3fecf,'resourceId':_0x5a17ec['id']}})[_0xa949('0x25')](function(){return _0x48627b;});})[_0xa949('0x25')](function(){_0x565a46[_0xa949('0x19')](0xcc)[_0xa949('0x18')]();});}};}function handleEntityNotFound(_0x2782f7,_0x3acc6c){return function(_0x235dc8){if(!_0x235dc8){_0x2782f7[_0xa949('0x17')](0x194);}return _0x235dc8;};}function handleError(_0x49ac5a,_0x4db19d){_0x4db19d=_0x4db19d||0x1f4;return function(_0x38a005){logger[_0xa949('0x29')](_0x38a005[_0xa949('0x2a')]);if(_0x38a005[_0xa949('0x2b')]){delete _0x38a005['name'];}_0x49ac5a['status'](_0x4db19d)[_0xa949('0x2c')](_0x38a005);};}exports[_0xa949('0x2d')]=function(_0x52674c,_0x561a54){var _0x1080c0={},_0x584c8b={},_0x3b3cf3={'count':0x0,'rows':[]};var _0x51d634=_[_0xa949('0x2e')](db[_0xa949('0x2f')]['rawAttributes'],function(_0x2976c1){return{'name':_0x2976c1[_0xa949('0x30')],'type':_0x2976c1[_0xa949('0x31')][_0xa949('0x32')]};});_0x584c8b[_0xa949('0x33')]=_[_0xa949('0x2e')](_0x51d634,_0xa949('0x2b'));_0x584c8b[_0xa949('0x34')]=_[_0xa949('0x35')](_0x52674c[_0xa949('0x34')]);_0x584c8b[_0xa949('0x36')]=_['intersection'](_0x584c8b[_0xa949('0x33')],_0x584c8b[_0xa949('0x34')]);_0x1080c0[_0xa949('0x37')]=_[_0xa949('0x38')](_0x584c8b[_0xa949('0x33')],qs[_0xa949('0x39')](_0x52674c['query']['fields']));_0x1080c0[_0xa949('0x37')]=_0x1080c0['attributes'][_0xa949('0x3a')]?_0x1080c0[_0xa949('0x37')]:_0x584c8b[_0xa949('0x33')];if(!_0x52674c[_0xa949('0x34')]['hasOwnProperty'](_0xa949('0x3b'))){_0x1080c0['limit']=qs[_0xa949('0x1d')](_0x52674c['query'][_0xa949('0x1d')]);_0x1080c0[_0xa949('0x1b')]=qs['offset'](_0x52674c[_0xa949('0x34')][_0xa949('0x1b')]);}_0x1080c0['order']=qs['sort'](_0x52674c['query'][_0xa949('0x3c')]);_0x1080c0[_0xa949('0x3d')]=qs[_0xa949('0x36')](_[_0xa949('0x3e')](_0x52674c[_0xa949('0x34')],_0x584c8b['filters']),_0x51d634);if(_0x52674c['query'][_0xa949('0x3f')]){_0x1080c0['where']=_[_0xa949('0x40')](_0x1080c0[_0xa949('0x3d')],{'$or':_['map'](_0x51d634,function(_0x4537df){if(_0x4537df[_0xa949('0x31')]!=='VIRTUAL'){var _0x406b84={};_0x406b84[_0x4537df['name']]={'$like':'%'+_0x52674c[_0xa949('0x34')][_0xa949('0x3f')]+'%'};return _0x406b84;}})});}_0x1080c0=_[_0xa949('0x40')]({},_0x1080c0,_0x52674c[_0xa949('0x41')]);var _0x2733eb={'where':_0x1080c0['where']};return db[_0xa949('0x2f')][_0xa949('0x1e')](_0x2733eb)[_0xa949('0x25')](function(_0x3b8377){_0x3b3cf3[_0xa949('0x1e')]=_0x3b8377;if(_0x52674c[_0xa949('0x34')][_0xa949('0x42')]){_0x1080c0[_0xa949('0x43')]=[{'all':!![]}];}return db[_0xa949('0x2f')][_0xa949('0x44')](_0x1080c0);})[_0xa949('0x25')](function(_0x17eaf1){_0x3b3cf3[_0xa949('0x45')]=_0x17eaf1;return _0x3b3cf3;})[_0xa949('0x25')](respondWithFilteredResult(_0x561a54,_0x1080c0))[_0xa949('0x46')](handleError(_0x561a54,null));};exports[_0xa949('0x47')]=function(_0x3ae41e,_0x134882){var _0x44758c={'raw':!![],'where':{'id':_0x3ae41e[_0xa949('0x48')]['id']}},_0x52d09b={};_0x52d09b[_0xa949('0x33')]=_['keys'](db['Tag'][_0xa949('0x49')]);_0x52d09b['query']=_[_0xa949('0x35')](_0x3ae41e[_0xa949('0x34')]);_0x52d09b[_0xa949('0x36')]=_['intersection'](_0x52d09b[_0xa949('0x33')],_0x52d09b[_0xa949('0x34')]);_0x44758c[_0xa949('0x37')]=_[_0xa949('0x38')](_0x52d09b['model'],qs[_0xa949('0x39')](_0x3ae41e[_0xa949('0x34')][_0xa949('0x39')]));_0x44758c['attributes']=_0x44758c[_0xa949('0x37')][_0xa949('0x3a')]?_0x44758c[_0xa949('0x37')]:_0x52d09b[_0xa949('0x33')];if(_0x3ae41e[_0xa949('0x34')]['includeAll']){_0x44758c['include']=[{'all':!![]}];}_0x44758c=_[_0xa949('0x40')]({},_0x44758c,_0x3ae41e[_0xa949('0x41')]);return db[_0xa949('0x2f')][_0xa949('0x4a')](_0x44758c)['then'](handleEntityNotFound(_0x134882,null))[_0xa949('0x25')](respondWithResult(_0x134882,null))[_0xa949('0x46')](handleError(_0x134882,null));};exports[_0xa949('0x4b')]=function(_0x3fc14c,_0x635bc1){return db[_0xa949('0x2f')]['create'](_0x3fc14c['body'],{})[_0xa949('0x25')](function(_0x5cf7a7){var _0x511e03=_0x3fc14c['user'][_0xa949('0x27')]({'plain':!![]});if(!_0x511e03)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x511e03[_0xa949('0x4c')]==='user'){var _0x5f5a90=_0x5cf7a7['get']({'plain':!![]});var _0x5222c4=_0xa949('0x28');return db[_0xa949('0x4d')][_0xa949('0x4a')]({'where':{'name':_0x5222c4,'userProfileId':_0x511e03[_0xa949('0x4e')]},'raw':!![]})[_0xa949('0x25')](function(_0x236dcb){if(_0x236dcb&&_0x236dcb[_0xa949('0x4f')]===0x0){return db[_0xa949('0x50')][_0xa949('0x4b')]({'name':_0x5f5a90[_0xa949('0x2b')],'resourceId':_0x5f5a90['id'],'type':_0x236dcb[_0xa949('0x2b')],'sectionId':_0x236dcb['id']},{})['then'](function(){return _0x5cf7a7;});}else{return _0x5cf7a7;}})[_0xa949('0x46')](function(_0x1662a5){logger[_0xa949('0x29')](_0xa949('0x51'),_0x1662a5);throw _0x1662a5;});}return _0x5cf7a7;})[_0xa949('0x25')](respondWithResult(_0x635bc1,0xc9))[_0xa949('0x46')](handleError(_0x635bc1,null));};exports[_0xa949('0x24')]=function(_0x3db802,_0x3da000){if(_0x3db802[_0xa949('0x52')]['id']){delete _0x3db802['body']['id'];}return db[_0xa949('0x2f')]['find']({'where':{'id':_0x3db802[_0xa949('0x48')]['id']}})[_0xa949('0x25')](handleEntityNotFound(_0x3da000,null))[_0xa949('0x25')](saveUpdates(_0x3db802['body'],null))['then'](respondWithResult(_0x3da000,null))['catch'](handleError(_0x3da000,null));};exports[_0xa949('0x26')]=function(_0x534400,_0x712011){return db[_0xa949('0x2f')][_0xa949('0x4a')]({'where':{'id':_0x534400[_0xa949('0x48')]['id']}})['then'](handleEntityNotFound(_0x712011,null))[_0xa949('0x25')](removeEntity(_0x712011,null))[_0xa949('0x46')](handleError(_0x712011,null));};exports[_0xa949('0x53')]=function(_0x48eea9,_0x1ce1a3){return db[_0xa949('0x2f')]['describe']()[_0xa949('0x25')](respondWithResult(_0x1ce1a3,null))[_0xa949('0x46')](handleError(_0x1ce1a3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index a56a6c3..bd539df 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 _0x6018=['api','bluebird','request-promise','rimraf','exports','define','Tag','tools_tags','../../config/logger'];(function(_0x40804c,_0x146f5c){var _0x4856ad=function(_0x1d8b0e){while(--_0x1d8b0e){_0x40804c['push'](_0x40804c['shift']());}};_0x4856ad(++_0x146f5c);}(_0x6018,0xfb));var _0x8601=function(_0x3a5950,_0x541830){_0x3a5950=_0x3a5950-0x0;var _0x27ed3d=_0x6018[_0x3a5950];return _0x27ed3d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8601('0x0'))(_0x8601('0x1'));var moment=require('moment');var BPromise=require(_0x8601('0x2'));var rp=require(_0x8601('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8601('0x4'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x8601('0x5')]=function(_0x2bc774,_0xf810f5){return _0x2bc774[_0x8601('0x6')](_0x8601('0x7'),attributes,{'tableName':_0x8601('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c8b=['./tag.attributes','define','Tag','lodash','util','moment','bluebird','path','../../config/environment'];(function(_0x5eabc0,_0x11ccd5){var _0x56b4f7=function(_0x507b20){while(--_0x507b20){_0x5eabc0['push'](_0x5eabc0['shift']());}};_0x56b4f7(++_0x11ccd5);}(_0x4c8b,0x17d));var _0xb4c8=function(_0x46f3b4,_0x26f2c6){_0x46f3b4=_0x46f3b4-0x0;var _0x641ca8=_0x4c8b[_0x46f3b4];return _0x641ca8;};'use strict';var _=require(_0xb4c8('0x0'));var util=require(_0xb4c8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb4c8('0x2'));var BPromise=require(_0xb4c8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4c8('0x4'));var rimraf=require('rimraf');var config=require(_0xb4c8('0x5'));var attributes=require(_0xb4c8('0x6'));module['exports']=function(_0x56842e,_0x2b3f3a){return _0x56842e[_0xb4c8('0x7')](_0xb4c8('0x8'),attributes,{'tableName':'tools_tags','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 4ba488b..44f0381 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 _0x4b1f=['stringify','error','code','Tag,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2e2910,_0x3b06e0){var _0x22e05c=function(_0x2a0e31){while(--_0x2a0e31){_0x2e2910['push'](_0x2e2910['shift']());}};_0x22e05c(++_0x3b06e0);}(_0x4b1f,0x195));var _0xf4b1=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x4b1f[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var moment=require('moment');var BPromise=require(_0xf4b1('0x2'));var rs=require(_0xf4b1('0x3'));var fs=require('fs');var Redis=require(_0xf4b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4b1('0x5'));var logger=require(_0xf4b1('0x6'))(_0xf4b1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf4b1('0x8')][_0xf4b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310db5,_0x3b9c78,_0x1abfc7){return new BPromise(function(_0x50738c,_0x59cf77){return client['request'](_0x310db5,_0x1abfc7)[_0xf4b1('0xa')](function(_0x53a786){logger[_0xf4b1('0xb')]('Tag,\x20%s,\x20%s',_0x3b9c78,'request\x20sent');logger[_0xf4b1('0xc')](_0xf4b1('0xd'),_0x3b9c78,_0xf4b1('0xe'),JSON[_0xf4b1('0xf')](_0x53a786));if(_0x53a786[_0xf4b1('0x10')]){if(_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x11')]===0x1f4){logger[_0xf4b1('0x10')](_0xf4b1('0x12'),_0x3b9c78,_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x13')]);return _0x59cf77(_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x13')]);}logger['error']('Tag,\x20%s,\x20%s',_0x3b9c78,_0x53a786[_0xf4b1('0x10')]['message']);return _0x50738c(_0x53a786['error'][_0xf4b1('0x13')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x3b9c78,_0xf4b1('0xe'));_0x50738c(_0x53a786['result']['message']);}})['catch'](function(_0x5cb2a1){logger[_0xf4b1('0x10')](_0xf4b1('0x12'),_0x3b9c78,_0x5cb2a1);_0x59cf77(_0x5cb2a1);});});} \ No newline at end of file +var _0xe181=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0xe181,0x68));var _0x1e18=function(_0x298510,_0x21b06b){_0x298510=_0x298510-0x0;var _0x51f279=_0xe181[_0x298510];return _0x51f279;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var moment=require(_0x1e18('0x1'));var BPromise=require(_0x1e18('0x2'));var rs=require(_0x1e18('0x3'));var fs=require('fs');var Redis=require(_0x1e18('0x4'));var db=require(_0x1e18('0x5'))['db'];var utils=require(_0x1e18('0x6'));var logger=require(_0x1e18('0x7'))('rpc');var config=require(_0x1e18('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x182c98,_0x46ba95,_0x25b786){return new BPromise(function(_0x9f9541,_0x398f77){return client['request'](_0x182c98,_0x25b786)[_0x1e18('0xa')](function(_0x40fda9){logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));logger[_0x1e18('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x46ba95,_0x1e18('0xd'),JSON[_0x1e18('0xf')](_0x40fda9));if(_0x40fda9[_0x1e18('0x10')]){if(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x11')]===0x1f4){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x40fda9[_0x1e18('0x10')]['message']);return _0x398f77(_0x40fda9[_0x1e18('0x10')]['message']);}logger[_0x1e18('0x10')]('Tag,\x20%s,\x20%s',_0x46ba95,_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);return _0x9f9541(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);}else{logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));_0x9f9541(_0x40fda9[_0x1e18('0x13')][_0x1e18('0x12')]);}})[_0x1e18('0x14')](function(_0x12ef98){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x12ef98);_0x398f77(_0x12ef98);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b3d9313..9bf20d3 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 dc33ace..cd0435f 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x1e2393,_0x5e51f1){var _0x451f52=function(_0x45b27b){while(--_0x45b27b){_0x1e2393['push'](_0x1e2393['shift']());}};_0x451f52(++_0x5e51f1);}(_0x757a,0xde));var _0xa757=function(_0x18fb40,_0x565e52){_0x18fb40=_0x18fb40-0x0;var _0x4100ab=_0x757a[_0x18fb40];return _0x4100ab;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xb7e7[_0x1cb18a];return _0x22442e;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index fd4b702..166f6a4 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 _0x9324=['SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','VoicePrefixId','send','channel','Unknown\x20channel','capitalize','toLowerCase','Queue','isValidChannel','ValidationError','add','Queues','ids','findOne','addAgents','isArray','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','spread','Fax','Queue:remove','removeAgents','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./team.socket','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','stack','name','index','map','Team','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','keys','include','create','body','user','get','role','Teams','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0x9324,0x164));var _0x4932=function(_0x15cef4,_0x448b97){_0x15cef4=_0x15cef4-0x0;var _0x384430=_0x9324[_0x15cef4];return _0x384430;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4932('0x0'));var jsonpatch=require(_0x4932('0x1'));var rp=require(_0x4932('0x2'));var moment=require(_0x4932('0x3'));var BPromise=require(_0x4932('0x4'));var Mustache=require(_0x4932('0x5'));var util=require(_0x4932('0x6'));var path=require(_0x4932('0x7'));var sox=require(_0x4932('0x8'));var csv=require(_0x4932('0x9'));var ejs=require(_0x4932('0xa'));var fs=require('fs');var fs_extra=require(_0x4932('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4932('0xc'));var jsforce=require(_0x4932('0xd'));var deskjs=require(_0x4932('0xe'));var toCsv=require(_0x4932('0x9'));var querystring=require(_0x4932('0xf'));var Papa=require(_0x4932('0x10'));var Redis=require(_0x4932('0x11'));var authService=require(_0x4932('0x12'));var qs=require(_0x4932('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4932('0x14'));var logger=require('../../config/logger')(_0x4932('0x15'));var utils=require(_0x4932('0x16'));var config=require(_0x4932('0x17'));var licenseUtil=require(_0x4932('0x18'));var db=require(_0x4932('0x19'))['db'];config['redis']=_[_0x4932('0x1a')](config[_0x4932('0x1b')],{'host':_0x4932('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4932('0x1b')]));require(_0x4932('0x1d'))['register'](socket);function respondWithStatusCode(_0x5e8ee7,_0x243409){_0x243409=_0x243409||0xcc;return function(_0x5a27c8){if(_0x5a27c8){return _0x5e8ee7[_0x4932('0x1e')](_0x243409);}return _0x5e8ee7['status'](_0x243409)[_0x4932('0x1f')]();};}function respondWithResult(_0x5a480a,_0x182d43){_0x182d43=_0x182d43||0xc8;return function(_0x120b92){if(_0x120b92){return _0x5a480a[_0x4932('0x20')](_0x182d43)['json'](_0x120b92);}};}function respondWithFilteredResult(_0x26c789,_0x5b7a49){return function(_0x12e610){if(_0x12e610){var _0x40456c=typeof _0x5b7a49[_0x4932('0x21')]==='undefined'&&typeof _0x5b7a49['limit']===_0x4932('0x22');var _0x4e8ff1=_0x12e610[_0x4932('0x23')];var _0x4afc69=_0x40456c?0x0:_0x5b7a49[_0x4932('0x21')];var _0x19b154=_0x40456c?_0x12e610[_0x4932('0x23')]:_0x5b7a49['offset']+_0x5b7a49[_0x4932('0x24')];var _0x344b6f;if(_0x19b154>=_0x4e8ff1){_0x19b154=_0x4e8ff1;_0x344b6f=0xc8;}else{_0x344b6f=0xce;}_0x26c789[_0x4932('0x20')](_0x344b6f);return _0x26c789[_0x4932('0x25')](_0x4932('0x26'),_0x4afc69+'-'+_0x19b154+'/'+_0x4e8ff1)['json'](_0x12e610);}return null;};}function patchUpdates(_0x2f619c){return function(_0x2c888e){try{jsonpatch[_0x4932('0x27')](_0x2c888e,_0x2f619c,!![]);}catch(_0x151355){return BPromise[_0x4932('0x28')](_0x151355);}return _0x2c888e['save']();};}function saveUpdates(_0xb0531a,_0x748eb8){return function(_0x49b97f){if(_0x49b97f){return _0x49b97f[_0x4932('0x29')](_0xb0531a)[_0x4932('0x2a')](function(_0x495f8d){return _0x495f8d;});}return null;};}function handleEntityNotFound(_0x310845,_0x4ea510){return function(_0x5ba7a0){if(!_0x5ba7a0){_0x310845[_0x4932('0x1e')](0x194);}return _0x5ba7a0;};}function handleError(_0x5ad108,_0x23e485){_0x23e485=_0x23e485||0x1f4;return function(_0x402f02){logger['error'](_0x402f02[_0x4932('0x2b')]);if(_0x402f02[_0x4932('0x2c')]){delete _0x402f02['name'];}_0x5ad108[_0x4932('0x20')](_0x23e485)['send'](_0x402f02);};}exports[_0x4932('0x2d')]=function(_0x196790,_0x48cdfa){var _0x13532a={},_0xe00390={},_0x5a167b={'count':0x0,'rows':[]};var _0x1fc88f=_[_0x4932('0x2e')](db[_0x4932('0x2f')][_0x4932('0x30')],function(_0x301939){return{'name':_0x301939[_0x4932('0x31')],'type':_0x301939[_0x4932('0x32')][_0x4932('0x33')]};});_0xe00390['model']=_[_0x4932('0x2e')](_0x1fc88f,_0x4932('0x2c'));_0xe00390[_0x4932('0x34')]=_['keys'](_0x196790[_0x4932('0x34')]);_0xe00390[_0x4932('0x35')]=_[_0x4932('0x36')](_0xe00390[_0x4932('0x37')],_0xe00390[_0x4932('0x34')]);_0x13532a[_0x4932('0x38')]=_[_0x4932('0x36')](_0xe00390[_0x4932('0x37')],qs['fields'](_0x196790[_0x4932('0x34')][_0x4932('0x39')]));_0x13532a[_0x4932('0x38')]=_0x13532a[_0x4932('0x38')][_0x4932('0x3a')]?_0x13532a['attributes']:_0xe00390[_0x4932('0x37')];if(!_0x196790[_0x4932('0x34')]['hasOwnProperty'](_0x4932('0x3b'))){_0x13532a[_0x4932('0x24')]=qs[_0x4932('0x24')](_0x196790[_0x4932('0x34')][_0x4932('0x24')]);_0x13532a[_0x4932('0x21')]=qs[_0x4932('0x21')](_0x196790[_0x4932('0x34')][_0x4932('0x21')]);}_0x13532a[_0x4932('0x3c')]=qs[_0x4932('0x3d')](_0x196790[_0x4932('0x34')][_0x4932('0x3d')]);_0x13532a['where']=qs[_0x4932('0x35')](_[_0x4932('0x3e')](_0x196790['query'],_0xe00390['filters']),_0x1fc88f);if(_0x196790[_0x4932('0x34')][_0x4932('0x3f')]){_0x13532a[_0x4932('0x40')]=_[_0x4932('0x41')](_0x13532a[_0x4932('0x40')],{'$or':_[_0x4932('0x2e')](_0x1fc88f,function(_0xa61b06){if(_0xa61b06['type']!==_0x4932('0x42')){var _0x12b3ba={};_0x12b3ba[_0xa61b06[_0x4932('0x2c')]]={'$like':'%'+_0x196790[_0x4932('0x34')][_0x4932('0x3f')]+'%'};return _0x12b3ba;}})});}_0x13532a=_[_0x4932('0x41')]({},_0x13532a,_0x196790[_0x4932('0x43')]);var _0x565ce0={'where':_0x13532a[_0x4932('0x40')]};return db[_0x4932('0x2f')][_0x4932('0x23')](_0x565ce0)[_0x4932('0x2a')](function(_0x5a28e9){_0x5a167b[_0x4932('0x23')]=_0x5a28e9;if(_0x196790[_0x4932('0x34')][_0x4932('0x44')]){_0x13532a['include']=[{'all':!![]}];}return db[_0x4932('0x2f')][_0x4932('0x45')](_0x13532a);})[_0x4932('0x2a')](function(_0x437b21){_0x5a167b['rows']=_0x437b21;return _0x5a167b;})['then'](respondWithFilteredResult(_0x48cdfa,_0x13532a))[_0x4932('0x46')](handleError(_0x48cdfa,null));};exports[_0x4932('0x47')]=function(_0x13a59f,_0x4ba495){var _0x193702={'raw':![],'where':{'id':_0x13a59f['params']['id']}},_0x5de367={};_0x5de367[_0x4932('0x37')]=_[_0x4932('0x48')](db['Team'][_0x4932('0x30')]);_0x5de367[_0x4932('0x34')]=_['keys'](_0x13a59f['query']);_0x5de367['filters']=_[_0x4932('0x36')](_0x5de367['model'],_0x5de367[_0x4932('0x34')]);_0x193702[_0x4932('0x38')]=_[_0x4932('0x36')](_0x5de367[_0x4932('0x37')],qs[_0x4932('0x39')](_0x13a59f[_0x4932('0x34')][_0x4932('0x39')]));_0x193702['attributes']=_0x193702[_0x4932('0x38')]['length']?_0x193702['attributes']:_0x5de367[_0x4932('0x37')];if(_0x13a59f[_0x4932('0x34')]['includeAll']){_0x193702[_0x4932('0x49')]=[{'all':!![]}];}_0x193702=_[_0x4932('0x41')]({},_0x193702,_0x13a59f[_0x4932('0x43')]);return db[_0x4932('0x2f')]['find'](_0x193702)[_0x4932('0x2a')](handleEntityNotFound(_0x4ba495,null))[_0x4932('0x2a')](respondWithResult(_0x4ba495,null))[_0x4932('0x46')](handleError(_0x4ba495,null));};exports[_0x4932('0x4a')]=function(_0x4cf603,_0x50473a){return db['Team'][_0x4932('0x4a')](_0x4cf603[_0x4932('0x4b')],{})['then'](function(_0x2c6f90){var _0x5b3da8=_0x4cf603[_0x4932('0x4c')][_0x4932('0x4d')]({'plain':!![]});if(!_0x5b3da8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b3da8[_0x4932('0x4e')]===_0x4932('0x4c')){var _0x3a8e7d=_0x2c6f90[_0x4932('0x4d')]({'plain':!![]});var _0x34f449=_0x4932('0x4f');return db['UserProfileSection'][_0x4932('0x50')]({'where':{'name':_0x34f449,'userProfileId':_0x5b3da8[_0x4932('0x51')]},'raw':!![]})[_0x4932('0x2a')](function(_0x511dbf){if(_0x511dbf&&_0x511dbf[_0x4932('0x52')]===0x0){return db[_0x4932('0x53')][_0x4932('0x4a')]({'name':_0x3a8e7d[_0x4932('0x2c')],'resourceId':_0x3a8e7d['id'],'type':_0x511dbf[_0x4932('0x2c')],'sectionId':_0x511dbf['id']},{})[_0x4932('0x2a')](function(){return _0x2c6f90;});}else{return _0x2c6f90;}})[_0x4932('0x46')](function(_0x1a2b21){logger[_0x4932('0x54')](_0x4932('0x55'),_0x1a2b21);throw _0x1a2b21;});}return _0x2c6f90;})[_0x4932('0x2a')](respondWithResult(_0x50473a,0xc9))[_0x4932('0x46')](handleError(_0x50473a,null));};exports[_0x4932('0x29')]=function(_0x39f8dc,_0x234213){if(_0x39f8dc['body']['id']){delete _0x39f8dc[_0x4932('0x4b')]['id'];}return db[_0x4932('0x2f')][_0x4932('0x50')]({'where':{'id':_0x39f8dc[_0x4932('0x56')]['id']}})[_0x4932('0x2a')](handleEntityNotFound(_0x234213,null))[_0x4932('0x2a')](saveUpdates(_0x39f8dc[_0x4932('0x4b')],null))[_0x4932('0x2a')](respondWithResult(_0x234213,null))[_0x4932('0x46')](handleError(_0x234213,null));};exports[_0x4932('0x57')]=function(_0x2072e5,_0x441d2e){var _0x5ed2f4=_0x2072e5[_0x4932('0x56')]['id'];var _0x1c88e6=[];return db['sequelize'][_0x4932('0x58')](function(_0x2fa96a){var _0x129d7b=_0x4932('0x59')+_0x5ed2f4;return db[_0x4932('0x5a')][_0x4932('0x34')](_0x129d7b,{'type':db[_0x4932('0x5b')]['QueryTypes'][_0x4932('0x5c')],'raw':!![],'transaction':_0x2fa96a})['then'](function(_0x57db0c){_0x1c88e6=_['map'](_0x57db0c,function(_0x1d9f4a){return Number(_0x1d9f4a[_0x4932('0x5d')]);});})[_0x4932('0x2a')](function(){var _0x3d2dd1=_0x4932('0x5e')+_0x5ed2f4;return db[_0x4932('0x5a')][_0x4932('0x34')](_0x3d2dd1,{'type':db[_0x4932('0x5b')]['QueryTypes'][_0x4932('0x5c')],'raw':!![],'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(_0x4eb2d3){var _0x40a667=_[_0x4932('0x2e')](_0x4eb2d3,function(_0x559a1b){return Number(_0x559a1b['VoiceQueueId']);});return db[_0x4932('0x5f')][_0x4932('0x57')]({'where':{'UserId':{'$in':_0x1c88e6},'VoiceQueueId':{'$in':_0x40a667}},'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(){var _0x316102=_0x4932('0x60')+_0x5ed2f4;return db[_0x4932('0x5a')][_0x4932('0x34')](_0x316102,{'type':db[_0x4932('0x5b')][_0x4932('0x61')][_0x4932('0x5c')],'raw':!![],'transaction':_0x2fa96a});})['then'](function(_0x4f2822){var _0x2ffb80=_[_0x4932('0x2e')](_0x4f2822,function(_0x2959f6){return Number(_0x2959f6[_0x4932('0x62')]);});return db[_0x4932('0x63')][_0x4932('0x57')]({'where':{'UserId':{'$in':_0x1c88e6},'MailQueueId':{'$in':_0x2ffb80}},'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(){var _0x2398f1=_0x4932('0x64')+_0x5ed2f4;return db[_0x4932('0x5a')][_0x4932('0x34')](_0x2398f1,{'type':db[_0x4932('0x5b')][_0x4932('0x61')]['SELECT'],'raw':!![],'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(_0x603951){var _0xa93f8b=_['map'](_0x603951,function(_0xe08b7c){return Number(_0xe08b7c['SmsQueueId']);});return db[_0x4932('0x65')][_0x4932('0x57')]({'where':{'UserId':{'$in':_0x1c88e6},'SmsQueueId':{'$in':_0xa93f8b}},'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(){var _0x468e01='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5ed2f4;return db['sequelize'][_0x4932('0x34')](_0x468e01,{'type':db[_0x4932('0x5b')][_0x4932('0x61')][_0x4932('0x5c')],'raw':!![],'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(_0x3e2e3a){var _0x7ce5e5=_[_0x4932('0x2e')](_0x3e2e3a,function(_0x1f1064){return Number(_0x1f1064[_0x4932('0x66')]);});return db[_0x4932('0x67')][_0x4932('0x57')]({'where':{'UserId':{'$in':_0x1c88e6},'ChatQueueId':{'$in':_0x7ce5e5}},'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(){var _0x6b8f54='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5ed2f4;return db['sequelize']['query'](_0x6b8f54,{'type':db['Sequelize']['QueryTypes'][_0x4932('0x5c')],'raw':!![],'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(_0x2509ec){var _0x10d6c7=_[_0x4932('0x2e')](_0x2509ec,function(_0x2183ee){return Number(_0x2183ee[_0x4932('0x68')]);});return db[_0x4932('0x69')][_0x4932('0x57')]({'where':{'UserId':{'$in':_0x1c88e6},'FaxQueueId':{'$in':_0x10d6c7}},'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(){var _0x4fda22=_0x4932('0x6a')+_0x5ed2f4;return db['sequelize']['query'](_0x4fda22,{'type':db[_0x4932('0x5b')]['QueryTypes'][_0x4932('0x5c')],'raw':!![],'transaction':_0x2fa96a});})['then'](function(_0x53e361){var _0xbcf008=_[_0x4932('0x2e')](_0x53e361,function(_0x50ea7c){return Number(_0x50ea7c[_0x4932('0x6b')]);});return db[_0x4932('0x6c')][_0x4932('0x57')]({'where':{'UserId':{'$in':_0x1c88e6},'OpenchannelQueueId':{'$in':_0xbcf008}},'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(){var _0x592f8e=_0x4932('0x6d')+_0x5ed2f4;return db[_0x4932('0x5a')][_0x4932('0x34')](_0x592f8e,{'type':db[_0x4932('0x5b')][_0x4932('0x61')]['SELECT'],'raw':!![],'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(_0x578374){var _0x344324=_[_0x4932('0x2e')](_0x578374,function(_0x2f0761){return Number(_0x2f0761[_0x4932('0x6e')]);});return db['UserWhatsappQueue'][_0x4932('0x57')]({'where':{'UserId':{'$in':_0x1c88e6},'WhatsappQueueId':{'$in':_0x344324}},'transaction':_0x2fa96a});})['then'](function(){return db[_0x4932('0x6f')]['find']({'where':{'TeamId':_0x5ed2f4}});})['then'](function(_0x1604ec){if(_0x1604ec===null){return;}return db['UserVoicePrefix'][_0x4932('0x57')]({'where':{'UserId':{'$in':_0x1c88e6},'VoicePrefixId':_0x1604ec[_0x4932('0x70')]},'transaction':_0x2fa96a});})['then'](function(){return db[_0x4932('0x2f')][_0x4932('0x57')]({'where':{'id':_0x5ed2f4},'cascade':!![],'transaction':_0x2fa96a});})[_0x4932('0x2a')](function(_0x4a892d){if(_0x4a892d===0x0){_0x441d2e[_0x4932('0x1e')](0x194);}else{return db[_0x4932('0x53')][_0x4932('0x57')]({'where':{'type':_0x4932('0x4f'),'resourceId':_0x5ed2f4},'cascade':!![],'transaction':_0x2fa96a})['then'](function(){_0x441d2e[_0x4932('0x20')](0xcc)[_0x4932('0x1f')]();});}})[_0x4932('0x46')](function(_0x465979){_0x441d2e[_0x4932('0x20')](0x1f4)[_0x4932('0x71')](_0x465979);});});};exports['getQueues']=function(_0x51151b,_0x45b803,_0x20cb3c){return db[_0x4932('0x2f')]['findOne']({'where':{'id':_0x51151b[_0x4932('0x56')]['id']}})['then'](handleEntityNotFound(_0x45b803,null))['then'](function(_0x3c4523){if(!_0x51151b[_0x4932('0x34')][_0x4932('0x72')]||!utils['isValidChannel'](_0x51151b['query'][_0x4932('0x72')])){throw new db[(_0x4932('0x5b'))]['ValidationError'](_0x4932('0x73'));}var _0x4f71d5={};var _0x4551bd={};_0x4551bd['model']=_[_0x4932('0x48')](db[_[_0x4932('0x74')](_0x51151b['query'][_0x4932('0x72')][_0x4932('0x75')]())+_0x4932('0x76')][_0x4932('0x30')]);_0x4551bd['query']=_['keys'](_0x51151b[_0x4932('0x34')]);_0x4551bd[_0x4932('0x35')]=_['intersection'](_0x4551bd[_0x4932('0x37')],_0x4551bd['query']);_0x4f71d5[_0x4932('0x38')]=_[_0x4932('0x36')](_0x4551bd[_0x4932('0x37')],qs[_0x4932('0x39')](_0x51151b[_0x4932('0x34')][_0x4932('0x39')]));_0x4f71d5[_0x4932('0x38')]=_0x4f71d5['attributes'][_0x4932('0x3a')]?_0x4f71d5['attributes']:_0x4551bd[_0x4932('0x37')];_0x4f71d5['limit']=qs[_0x4932('0x24')](_0x51151b[_0x4932('0x34')][_0x4932('0x24')]);_0x4f71d5['offset']=qs[_0x4932('0x21')](_0x51151b[_0x4932('0x34')][_0x4932('0x21')]);_0x4f71d5[_0x4932('0x3c')]=qs[_0x4932('0x3d')](_0x51151b[_0x4932('0x34')]['sort']);_0x4f71d5['where']=qs[_0x4932('0x35')](_[_0x4932('0x3e')](_0x51151b[_0x4932('0x34')],_0x4551bd[_0x4932('0x35')]));_0x4f71d5=_[_0x4932('0x41')]({},_0x4f71d5,_0x51151b[_0x4932('0x43')]);return _0x3c4523['get'+_[_0x4932('0x74')](_0x51151b['query'][_0x4932('0x72')][_0x4932('0x75')]())+'Queues'](_0x4f71d5);})[_0x4932('0x2a')](respondWithResult(_0x45b803,null))[_0x4932('0x46')](handleError(_0x45b803,null));};exports['addQueues']=function(_0x43cae6,_0x5bdb2d,_0x4ce4db){return db[_0x4932('0x2f')]['findOne']({'where':{'id':_0x43cae6[_0x4932('0x56')]['id']}})[_0x4932('0x2a')](function(_0x4c2b6f){if(_0x4c2b6f){if(!_0x43cae6['body']['channel']||!utils[_0x4932('0x77')](_0x43cae6[_0x4932('0x4b')][_0x4932('0x72')])){throw new db[(_0x4932('0x5b'))][(_0x4932('0x78'))](_0x4932('0x73'));}return _0x4c2b6f[_0x4932('0x79')+_[_0x4932('0x74')](_0x43cae6[_0x4932('0x4b')][_0x4932('0x72')][_0x4932('0x75')]())+_0x4932('0x7a')](_0x43cae6[_0x4932('0x4b')][_0x4932('0x7b')]);}return null;})[_0x4932('0x2a')](handleEntityNotFound(_0x5bdb2d,null))[_0x4932('0x2a')](respondWithStatusCode(_0x5bdb2d,null))['catch'](handleError(_0x5bdb2d,null));};exports['removeQueues']=function(_0x2ee825,_0x3b57ae,_0xb424f1){return db[_0x4932('0x2f')][_0x4932('0x7c')]({'where':{'id':_0x2ee825[_0x4932('0x56')]['id']}})[_0x4932('0x2a')](function(_0x12153a){if(_0x12153a){if(!_0x2ee825[_0x4932('0x34')][_0x4932('0x72')]||!utils[_0x4932('0x77')](_0x2ee825['query'][_0x4932('0x72')])){throw new db[(_0x4932('0x5b'))][(_0x4932('0x78'))](_0x4932('0x73'));}return _0x12153a['remove'+_[_0x4932('0x74')](_0x2ee825[_0x4932('0x34')][_0x4932('0x72')][_0x4932('0x75')]())+_0x4932('0x7a')](_0x2ee825[_0x4932('0x34')]['ids']);}return null;})[_0x4932('0x2a')](handleEntityNotFound(_0x3b57ae,null))[_0x4932('0x2a')](respondWithStatusCode(_0x3b57ae,null))[_0x4932('0x46')](handleError(_0x3b57ae,null));};exports[_0x4932('0x7d')]=function(_0x5251a4,_0x3eed93){var _0x5a4280=_[_0x4932('0x7e')](_0x5251a4[_0x4932('0x4b')]['ids'])?_0x5251a4[_0x4932('0x4b')][_0x4932('0x7b')]:[_0x5251a4['body'][_0x4932('0x7b')]];var _0x4e3748=_0x5251a4[_0x4932('0x56')]['id'];return db['Team']['find']({'where':{'id':_0x4e3748}})[_0x4932('0x2a')](handleEntityNotFound(_0x3eed93,null))[_0x4932('0x2a')](function(_0x2b9216){if(_0x2b9216){var _0x32696c=[_0x4932('0x7f'),_0x4932('0x80'),_0x4932('0x81'),_0x4932('0x82'),'Fax',_0x4932('0x83'),_0x4932('0x84')];return db[_0x4932('0x5a')][_0x4932('0x58')](function(_0x451104){var _0x2ac36=_['map'](_0x32696c,function(_0xd02f7b){var _0x4dff1d={'attributes':['id','name']};if(_0xd02f7b==='Voice'){_0x4dff1d['through']={'attributes':['penalty']};}return _0x2b9216[_0x4932('0x4d')+_0xd02f7b+_0x4932('0x7a')](_0x4dff1d)['then'](function(_0x387053){var _0x27c399=_['map'](_0x387053,function(_0x31b6bd){var _0x53e635=_['map'](_0x5a4280,function(_0x13f86d){var _0x39006b={'where':{'UserId':_0x13f86d,[_0xd02f7b+_0x4932('0x85')]:_0x31b6bd['id']},'transaction':_0x451104};if(_0xd02f7b===_0x4932('0x7f')){_0x39006b[_0x4932('0x1a')]={'penalty':_0x31b6bd[_0x4932('0x86')][_0x4932('0x87')]};}return db[_0x4932('0x88')+_0xd02f7b+'Queue'][_0x4932('0x89')](_0x39006b)[_0x4932('0x2a')](function(){socket[_0x4932('0x8a')]('user'+_0xd02f7b+_0x4932('0x8b'),{'UserId':_0x13f86d,[_0xd02f7b+_0x4932('0x85')]:_0x31b6bd['id']});if(_0xd02f7b!==_0x4932('0x7f')){return;}return db[_0x4932('0x88')][_0x4932('0x45')]({'where':{'id':_0x5a4280,'online':0x1},'attributes':['id',_0x4932('0x2c'),_0x4932('0x8c'),_0x4932('0x8d'),_0x4932('0x8e')],'raw':!![]})[_0x4932('0x2a')](function(_0x5f2f22){var _0x5eb547=_[_0x4932('0x2e')](_0x5f2f22,function(_0x5d10af){return db[_0x4932('0x8f')][_0x4932('0x90')]({'membername':_0x5d10af['name'],'UserId':_0x5d10af['id'],'queue_name':_0x31b6bd[_0x4932('0x2c')],'VoiceQueueId':_0x31b6bd['id'],'interface':_[_0x4932('0x91')](_0x5d10af[_0x4932('0x8e')])?util[_0x4932('0x92')](_0x4932('0x93'),_0x5d10af['name']):_0x5d10af['interface'],'paused':_0x5d10af[_0x4932('0x8d')]||![],'penalty':_0x31b6bd[_0x4932('0x86')][_0x4932('0x87')]},{'transaction':_0x451104});});return Promise['all'](_0x5eb547);});});});return Promise[_0x4932('0x94')](_0x53e635);});return Promise[_0x4932('0x94')](_0x27c399);})['then'](function(){return db[_0x4932('0x6f')][_0x4932('0x7c')]({'where':{'teamId':_0x4e3748}})[_0x4932('0x2a')](function(_0x3496ff){if(_0x3496ff){var _0x137ddd=_[_0x4932('0x2e')](_0x5a4280,function(_0x545f38){db[_0x4932('0x95')][_0x4932('0x90')]({'UserId':_0x545f38,'VoicePrefixId':_0x3496ff[_0x4932('0x70')]});});return Promise[_0x4932('0x94')](_0x137ddd);}});});});return Promise[_0x4932('0x94')](_0x2ac36)['then'](function(){return _0x2b9216[_0x4932('0x7d')](_0x5a4280,{'transaction':_0x451104})[_0x4932('0x96')](function(_0x3f8b99){return _0x3f8b99;});});});}})['then'](respondWithResult(_0x3eed93,null))[_0x4932('0x46')](handleError(_0x3eed93,null));};exports['removeAgents']=function(_0x208686,_0x43e9e4){var _0xed2958=_[_0x4932('0x7e')](_0x208686[_0x4932('0x34')][_0x4932('0x7b')])?_0x208686['query'][_0x4932('0x7b')]:[_0x208686[_0x4932('0x34')]['ids']];var _0x3a32c1=_0x208686[_0x4932('0x56')]['id'];return db['Team'][_0x4932('0x50')]({'where':{'id':_0x3a32c1}})[_0x4932('0x2a')](handleEntityNotFound(_0x43e9e4,null))[_0x4932('0x2a')](function(_0x1e0471){if(_0x1e0471){var _0x4ee07d=[_0x4932('0x7f'),'Chat','Mail',_0x4932('0x82'),_0x4932('0x97'),_0x4932('0x83'),'Whatsapp'];return db['sequelize'][_0x4932('0x58')](function(_0x5c5c6f){var _0x5ac17a=_[_0x4932('0x2e')](_0x4ee07d,function(_0x4f76c3){var _0x5c0adc={'attributes':['id','name']};return _0x1e0471['get'+_0x4f76c3+_0x4932('0x7a')](_0x5c0adc)[_0x4932('0x2a')](function(_0x527fee){var _0x4a1ca9=_[_0x4932('0x2e')](_0x527fee,function(_0x1ad340){return _0x1ad340['removeAgents'](_0xed2958,{'transaction':_0x5c5c6f})[_0x4932('0x2a')](function(){var _0x390715=_[_0x4932('0x2e')](_0xed2958,function(_0x4312c0){socket[_0x4932('0x8a')]('user'+_0x4f76c3+_0x4932('0x98'),{'UserId':Number(_0x4312c0),[_0x4f76c3+_0x4932('0x85')]:_0x1ad340['id']});if(_0x4f76c3!=='Voice'){return;}return db['UserVoiceQueueRt'][_0x4932('0x57')]({'where':{'VoiceQueueId':_0x1ad340['id'],'UserId':_0x4312c0},'transaction':_0x5c5c6f});});return Promise[_0x4932('0x94')](_0x390715);});});return Promise[_0x4932('0x94')](_0x4a1ca9);});});return Promise[_0x4932('0x94')](_0x5ac17a)['then'](function(){return _0x1e0471[_0x4932('0x99')](_0xed2958,{'transaction':_0x5c5c6f});})[_0x4932('0x2a')](function(){return db[_0x4932('0x6f')]['findOne']({'where':{'teamId':_0x3a32c1}})[_0x4932('0x2a')](function(_0x8ca264){if(_0x8ca264){var _0x349699=_[_0x4932('0x2e')](_0xed2958,function(_0x379478){db[_0x4932('0x95')][_0x4932('0x57')]({'where':{'UserId':_0x379478,'VoicePrefixId':_0x8ca264[_0x4932('0x70')]}});});return Promise[_0x4932('0x94')](_0x349699);}});});});}})['then'](respondWithStatusCode(_0x43e9e4,null))[_0x4932('0x46')](handleError(_0x43e9e4,null));};exports[_0x4932('0x9a')]=function(_0x4b374a,_0x263123,_0x19e5e4){var _0x47cf34={};var _0x483455={};var _0x176f2c;var _0x2d41db;return db['Team']['findOne']({'where':{'id':_0x4b374a[_0x4932('0x56')]['id']}})[_0x4932('0x2a')](handleEntityNotFound(_0x263123,null))['then'](function(_0x4cd897){if(_0x4cd897){_0x176f2c=_0x4cd897;_0x483455[_0x4932('0x37')]=_[_0x4932('0x48')](db[_0x4932('0x88')][_0x4932('0x30')]);_0x483455[_0x4932('0x34')]=_[_0x4932('0x48')](_0x4b374a[_0x4932('0x34')]);_0x483455[_0x4932('0x35')]=_['intersection'](_0x483455[_0x4932('0x37')],_0x483455[_0x4932('0x34')]);_0x47cf34[_0x4932('0x38')]=_[_0x4932('0x36')](_0x483455[_0x4932('0x37')],qs[_0x4932('0x39')](_0x4b374a[_0x4932('0x34')]['fields']));_0x47cf34[_0x4932('0x38')]=_0x47cf34[_0x4932('0x38')][_0x4932('0x3a')]?_0x47cf34[_0x4932('0x38')]:_0x483455[_0x4932('0x37')];_0x47cf34['order']=qs[_0x4932('0x3d')](_0x4b374a[_0x4932('0x34')][_0x4932('0x3d')]);_0x47cf34[_0x4932('0x40')]=qs[_0x4932('0x35')](_[_0x4932('0x3e')](_0x4b374a['query'],_0x483455[_0x4932('0x35')]));if(_0x4b374a['query'][_0x4932('0x3f')]){_0x47cf34['where']=_[_0x4932('0x41')](_0x47cf34[_0x4932('0x40')],{'$or':_[_0x4932('0x2e')](_0x47cf34[_0x4932('0x38')],function(_0x467f4a){var _0x392fb4={};_0x392fb4[_0x467f4a]={'$like':'%'+_0x4b374a['query'][_0x4932('0x3f')]+'%'};return _0x392fb4;})});}_0x47cf34=_[_0x4932('0x41')]({},_0x47cf34,_0x4b374a['options']);return _0x176f2c[_0x4932('0x9a')](_0x47cf34);}})[_0x4932('0x2a')](function(_0x2f00cc){if(_0x2f00cc){_0x2d41db=_0x2f00cc[_0x4932('0x3a')];if(!_0x4b374a[_0x4932('0x34')]['hasOwnProperty'](_0x4932('0x3b'))){_0x47cf34[_0x4932('0x24')]=qs[_0x4932('0x24')](_0x4b374a[_0x4932('0x34')]['limit']);_0x47cf34[_0x4932('0x21')]=qs[_0x4932('0x21')](_0x4b374a[_0x4932('0x34')]['offset']);}return _0x176f2c[_0x4932('0x9a')](_0x47cf34);}})[_0x4932('0x2a')](function(_0x4a93b1){if(_0x4a93b1){return _0x4a93b1?{'count':_0x2d41db,'rows':_0x4a93b1}:null;}})[_0x4932('0x2a')](respondWithResult(_0x263123,null))[_0x4932('0x46')](handleError(_0x263123,null));}; \ No newline at end of file +var _0xf546=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','Team','then','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserVoiceQueue','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','ValidationError','Unknown\x20channel','toLowerCase','Queue','capitalize','addQueues','add','Queues','ids','removeQueues','isValidChannel','remove','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','findAll','online','interface','UserVoiceQueueRt','isNil','voicePause','all','upsert','removeAgents','Mail','Whatsapp','Queue:remove','getAgents','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','offset','undefined','count','limit','json','apply','reject','save','update','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x103801,_0x483bc4){var _0x4dfd13=function(_0x4e8871){while(--_0x4e8871){_0x103801['push'](_0x103801['shift']());}};_0x4dfd13(++_0x483bc4);}(_0xf546,0x1a1));var _0x6f54=function(_0x599b88,_0x3c4ac2){_0x599b88=_0x599b88-0x0;var _0x58fd4e=_0xf546[_0x599b88];return _0x58fd4e;};'use strict';var emlformat=require(_0x6f54('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f54('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f54('0x2'));var BPromise=require(_0x6f54('0x3'));var Mustache=require(_0x6f54('0x4'));var util=require(_0x6f54('0x5'));var path=require('path');var sox=require(_0x6f54('0x6'));var csv=require(_0x6f54('0x7'));var ejs=require(_0x6f54('0x8'));var fs=require('fs');var fs_extra=require(_0x6f54('0x9'));var _=require(_0x6f54('0xa'));var squel=require(_0x6f54('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f54('0xc'));var deskjs=require(_0x6f54('0xd'));var toCsv=require(_0x6f54('0x7'));var querystring=require(_0x6f54('0xe'));var Papa=require(_0x6f54('0xf'));var Redis=require(_0x6f54('0x10'));var authService=require(_0x6f54('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f54('0x12'))(_0x6f54('0x13'));var utils=require(_0x6f54('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6f54('0x15'));var db=require(_0x6f54('0x16'))['db'];config[_0x6f54('0x17')]=_[_0x6f54('0x18')](config[_0x6f54('0x17')],{'host':_0x6f54('0x19'),'port':0x18eb});var socket=require(_0x6f54('0x1a'))(new Redis(config[_0x6f54('0x17')]));require(_0x6f54('0x1b'))[_0x6f54('0x1c')](socket);function respondWithStatusCode(_0x375380,_0x4ac50e){_0x4ac50e=_0x4ac50e||0xcc;return function(_0x5d19f5){if(_0x5d19f5){return _0x375380[_0x6f54('0x1d')](_0x4ac50e);}return _0x375380['status'](_0x4ac50e)[_0x6f54('0x1e')]();};}function respondWithResult(_0x4b93b3,_0x2e2099){_0x2e2099=_0x2e2099||0xc8;return function(_0x39c0ca){if(_0x39c0ca){return _0x4b93b3[_0x6f54('0x1f')](_0x2e2099)['json'](_0x39c0ca);}};}function respondWithFilteredResult(_0x2cde80,_0x554d64){return function(_0x4d67ae){if(_0x4d67ae){var _0x3fbedc=typeof _0x554d64[_0x6f54('0x20')]===_0x6f54('0x21')&&typeof _0x554d64['limit']==='undefined';var _0x39be9f=_0x4d67ae[_0x6f54('0x22')];var _0x3606ed=_0x3fbedc?0x0:_0x554d64[_0x6f54('0x20')];var _0x534aba=_0x3fbedc?_0x4d67ae[_0x6f54('0x22')]:_0x554d64[_0x6f54('0x20')]+_0x554d64[_0x6f54('0x23')];var _0x17bda5;if(_0x534aba>=_0x39be9f){_0x534aba=_0x39be9f;_0x17bda5=0xc8;}else{_0x17bda5=0xce;}_0x2cde80[_0x6f54('0x1f')](_0x17bda5);return _0x2cde80['set']('Content-Range',_0x3606ed+'-'+_0x534aba+'/'+_0x39be9f)[_0x6f54('0x24')](_0x4d67ae);}return null;};}function patchUpdates(_0x5f20ef){return function(_0x3de0f2){try{jsonpatch[_0x6f54('0x25')](_0x3de0f2,_0x5f20ef,!![]);}catch(_0x55483a){return BPromise[_0x6f54('0x26')](_0x55483a);}return _0x3de0f2[_0x6f54('0x27')]();};}function saveUpdates(_0x1af5ee,_0x38d75f){return function(_0x416d80){if(_0x416d80){return _0x416d80[_0x6f54('0x28')](_0x1af5ee)['then'](function(_0x35c3bc){return _0x35c3bc;});}return null;};}function handleEntityNotFound(_0x4c9a20,_0x1675ed){return function(_0x228a36){if(!_0x228a36){_0x4c9a20[_0x6f54('0x1d')](0x194);}return _0x228a36;};}function handleError(_0x5dfe2a,_0x2308ac){_0x2308ac=_0x2308ac||0x1f4;return function(_0x27eb53){logger[_0x6f54('0x29')](_0x27eb53[_0x6f54('0x2a')]);if(_0x27eb53[_0x6f54('0x2b')]){delete _0x27eb53[_0x6f54('0x2b')];}_0x5dfe2a[_0x6f54('0x1f')](_0x2308ac)[_0x6f54('0x2c')](_0x27eb53);};}exports[_0x6f54('0x2d')]=function(_0xf6015e,_0x48138c){var _0x107b32={},_0x53a8d6={},_0x16e8a0={'count':0x0,'rows':[]};var _0x5d53db=_[_0x6f54('0x2e')](db['Team'][_0x6f54('0x2f')],function(_0xc0c315){return{'name':_0xc0c315[_0x6f54('0x30')],'type':_0xc0c315[_0x6f54('0x31')][_0x6f54('0x32')]};});_0x53a8d6[_0x6f54('0x33')]=_[_0x6f54('0x2e')](_0x5d53db,'name');_0x53a8d6[_0x6f54('0x34')]=_['keys'](_0xf6015e[_0x6f54('0x34')]);_0x53a8d6[_0x6f54('0x35')]=_[_0x6f54('0x36')](_0x53a8d6[_0x6f54('0x33')],_0x53a8d6['query']);_0x107b32[_0x6f54('0x37')]=_[_0x6f54('0x36')](_0x53a8d6[_0x6f54('0x33')],qs[_0x6f54('0x38')](_0xf6015e['query']['fields']));_0x107b32[_0x6f54('0x37')]=_0x107b32[_0x6f54('0x37')][_0x6f54('0x39')]?_0x107b32['attributes']:_0x53a8d6[_0x6f54('0x33')];if(!_0xf6015e[_0x6f54('0x34')][_0x6f54('0x3a')](_0x6f54('0x3b'))){_0x107b32['limit']=qs[_0x6f54('0x23')](_0xf6015e[_0x6f54('0x34')][_0x6f54('0x23')]);_0x107b32[_0x6f54('0x20')]=qs['offset'](_0xf6015e['query'][_0x6f54('0x20')]);}_0x107b32[_0x6f54('0x3c')]=qs[_0x6f54('0x3d')](_0xf6015e[_0x6f54('0x34')][_0x6f54('0x3d')]);_0x107b32[_0x6f54('0x3e')]=qs[_0x6f54('0x35')](_[_0x6f54('0x3f')](_0xf6015e[_0x6f54('0x34')],_0x53a8d6[_0x6f54('0x35')]),_0x5d53db);if(_0xf6015e['query']['filter']){_0x107b32['where']=_[_0x6f54('0x40')](_0x107b32[_0x6f54('0x3e')],{'$or':_['map'](_0x5d53db,function(_0x1f7c26){if(_0x1f7c26[_0x6f54('0x31')]!==_0x6f54('0x41')){var _0x7cf962={};_0x7cf962[_0x1f7c26[_0x6f54('0x2b')]]={'$like':'%'+_0xf6015e['query'][_0x6f54('0x42')]+'%'};return _0x7cf962;}})});}_0x107b32=_[_0x6f54('0x40')]({},_0x107b32,_0xf6015e[_0x6f54('0x43')]);var _0x350f0c={'where':_0x107b32[_0x6f54('0x3e')]};return db['Team'][_0x6f54('0x22')](_0x350f0c)['then'](function(_0x16a806){_0x16e8a0['count']=_0x16a806;if(_0xf6015e[_0x6f54('0x34')][_0x6f54('0x44')]){_0x107b32[_0x6f54('0x45')]=[{'all':!![]}];}return db[_0x6f54('0x46')]['findAll'](_0x107b32);})[_0x6f54('0x47')](function(_0x4b65c5){_0x16e8a0[_0x6f54('0x48')]=_0x4b65c5;return _0x16e8a0;})[_0x6f54('0x47')](respondWithFilteredResult(_0x48138c,_0x107b32))[_0x6f54('0x49')](handleError(_0x48138c,null));};exports[_0x6f54('0x4a')]=function(_0x227fc3,_0x283850){var _0x196a72={'raw':![],'where':{'id':_0x227fc3[_0x6f54('0x4b')]['id']}},_0x2dc01a={};_0x2dc01a[_0x6f54('0x33')]=_[_0x6f54('0x4c')](db[_0x6f54('0x46')][_0x6f54('0x2f')]);_0x2dc01a[_0x6f54('0x34')]=_[_0x6f54('0x4c')](_0x227fc3[_0x6f54('0x34')]);_0x2dc01a[_0x6f54('0x35')]=_[_0x6f54('0x36')](_0x2dc01a[_0x6f54('0x33')],_0x2dc01a[_0x6f54('0x34')]);_0x196a72[_0x6f54('0x37')]=_[_0x6f54('0x36')](_0x2dc01a['model'],qs[_0x6f54('0x38')](_0x227fc3['query'][_0x6f54('0x38')]));_0x196a72[_0x6f54('0x37')]=_0x196a72[_0x6f54('0x37')][_0x6f54('0x39')]?_0x196a72[_0x6f54('0x37')]:_0x2dc01a[_0x6f54('0x33')];if(_0x227fc3['query'][_0x6f54('0x44')]){_0x196a72[_0x6f54('0x45')]=[{'all':!![]}];}_0x196a72=_[_0x6f54('0x40')]({},_0x196a72,_0x227fc3['options']);return db[_0x6f54('0x46')][_0x6f54('0x4d')](_0x196a72)[_0x6f54('0x47')](handleEntityNotFound(_0x283850,null))[_0x6f54('0x47')](respondWithResult(_0x283850,null))['catch'](handleError(_0x283850,null));};exports[_0x6f54('0x4e')]=function(_0x18b97d,_0x11074b){return db[_0x6f54('0x46')][_0x6f54('0x4e')](_0x18b97d[_0x6f54('0x4f')],{})[_0x6f54('0x47')](function(_0x2af0c8){var _0x5efcf8=_0x18b97d[_0x6f54('0x50')][_0x6f54('0x51')]({'plain':!![]});if(!_0x5efcf8)throw new Error(_0x6f54('0x52'));if(_0x5efcf8[_0x6f54('0x53')]===_0x6f54('0x50')){var _0x316070=_0x2af0c8[_0x6f54('0x51')]({'plain':!![]});var _0x37e545=_0x6f54('0x54');return db[_0x6f54('0x55')]['find']({'where':{'name':_0x37e545,'userProfileId':_0x5efcf8[_0x6f54('0x56')]},'raw':!![]})['then'](function(_0x5a15d0){if(_0x5a15d0&&_0x5a15d0[_0x6f54('0x57')]===0x0){return db[_0x6f54('0x58')][_0x6f54('0x4e')]({'name':_0x316070[_0x6f54('0x2b')],'resourceId':_0x316070['id'],'type':_0x5a15d0['name'],'sectionId':_0x5a15d0['id']},{})[_0x6f54('0x47')](function(){return _0x2af0c8;});}else{return _0x2af0c8;}})[_0x6f54('0x49')](function(_0x450efb){logger[_0x6f54('0x29')](_0x6f54('0x59'),_0x450efb);throw _0x450efb;});}return _0x2af0c8;})['then'](respondWithResult(_0x11074b,0xc9))[_0x6f54('0x49')](handleError(_0x11074b,null));};exports[_0x6f54('0x28')]=function(_0x199223,_0x7b1a7a){if(_0x199223[_0x6f54('0x4f')]['id']){delete _0x199223[_0x6f54('0x4f')]['id'];}return db[_0x6f54('0x46')][_0x6f54('0x4d')]({'where':{'id':_0x199223[_0x6f54('0x4b')]['id']}})[_0x6f54('0x47')](handleEntityNotFound(_0x7b1a7a,null))['then'](saveUpdates(_0x199223[_0x6f54('0x4f')],null))[_0x6f54('0x47')](respondWithResult(_0x7b1a7a,null))[_0x6f54('0x49')](handleError(_0x7b1a7a,null));};exports[_0x6f54('0x5a')]=function(_0x818073,_0x2dece8){var _0x25821d=_0x818073[_0x6f54('0x4b')]['id'];var _0x39ece0=[];return db[_0x6f54('0x5b')][_0x6f54('0x5c')](function(_0x25b317){var _0x378ab7='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x25821d;return db[_0x6f54('0x5b')]['query'](_0x378ab7,{'type':db[_0x6f54('0x5d')][_0x6f54('0x5e')]['SELECT'],'raw':!![],'transaction':_0x25b317})['then'](function(_0xff1d48){_0x39ece0=_[_0x6f54('0x2e')](_0xff1d48,function(_0x224653){return Number(_0x224653[_0x6f54('0x5f')]);});})['then'](function(){var _0x50521e=_0x6f54('0x60')+_0x25821d;return db[_0x6f54('0x5b')][_0x6f54('0x34')](_0x50521e,{'type':db['Sequelize'][_0x6f54('0x5e')][_0x6f54('0x61')],'raw':!![],'transaction':_0x25b317});})['then'](function(_0x8d66){var _0x1a85b4=_['map'](_0x8d66,function(_0x29e3cf){return Number(_0x29e3cf['VoiceQueueId']);});return db[_0x6f54('0x62')]['destroy']({'where':{'UserId':{'$in':_0x39ece0},'VoiceQueueId':{'$in':_0x1a85b4}},'transaction':_0x25b317});})[_0x6f54('0x47')](function(){var _0x5e770b='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x25821d;return db[_0x6f54('0x5b')]['query'](_0x5e770b,{'type':db[_0x6f54('0x5d')][_0x6f54('0x5e')][_0x6f54('0x61')],'raw':!![],'transaction':_0x25b317});})[_0x6f54('0x47')](function(_0x1234e0){var _0x1ffde5=_[_0x6f54('0x2e')](_0x1234e0,function(_0x1a16b8){return Number(_0x1a16b8[_0x6f54('0x63')]);});return db[_0x6f54('0x64')][_0x6f54('0x5a')]({'where':{'UserId':{'$in':_0x39ece0},'MailQueueId':{'$in':_0x1ffde5}},'transaction':_0x25b317});})[_0x6f54('0x47')](function(){var _0x3ef2dd='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x25821d;return db['sequelize'][_0x6f54('0x34')](_0x3ef2dd,{'type':db[_0x6f54('0x5d')][_0x6f54('0x5e')][_0x6f54('0x61')],'raw':!![],'transaction':_0x25b317});})[_0x6f54('0x47')](function(_0xff812e){var _0x1ca2d4=_[_0x6f54('0x2e')](_0xff812e,function(_0x213c2f){return Number(_0x213c2f[_0x6f54('0x65')]);});return db[_0x6f54('0x66')]['destroy']({'where':{'UserId':{'$in':_0x39ece0},'SmsQueueId':{'$in':_0x1ca2d4}},'transaction':_0x25b317});})['then'](function(){var _0x20ceb9=_0x6f54('0x67')+_0x25821d;return db[_0x6f54('0x5b')][_0x6f54('0x34')](_0x20ceb9,{'type':db['Sequelize'][_0x6f54('0x5e')]['SELECT'],'raw':!![],'transaction':_0x25b317});})[_0x6f54('0x47')](function(_0x331ed6){var _0x50919a=_[_0x6f54('0x2e')](_0x331ed6,function(_0x5bce88){return Number(_0x5bce88[_0x6f54('0x68')]);});return db[_0x6f54('0x69')]['destroy']({'where':{'UserId':{'$in':_0x39ece0},'ChatQueueId':{'$in':_0x50919a}},'transaction':_0x25b317});})[_0x6f54('0x47')](function(){var _0x20ac8e='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x25821d;return db[_0x6f54('0x5b')][_0x6f54('0x34')](_0x20ac8e,{'type':db[_0x6f54('0x5d')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x25b317});})['then'](function(_0xa297b3){var _0x389b36=_[_0x6f54('0x2e')](_0xa297b3,function(_0x3d68ac){return Number(_0x3d68ac['FaxQueueId']);});return db[_0x6f54('0x6a')][_0x6f54('0x5a')]({'where':{'UserId':{'$in':_0x39ece0},'FaxQueueId':{'$in':_0x389b36}},'transaction':_0x25b317});})[_0x6f54('0x47')](function(){var _0x494175=_0x6f54('0x6b')+_0x25821d;return db['sequelize'][_0x6f54('0x34')](_0x494175,{'type':db[_0x6f54('0x5d')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x25b317});})['then'](function(_0x541061){var _0x542658=_[_0x6f54('0x2e')](_0x541061,function(_0x1a7e9e){return Number(_0x1a7e9e[_0x6f54('0x6c')]);});return db[_0x6f54('0x6d')][_0x6f54('0x5a')]({'where':{'UserId':{'$in':_0x39ece0},'OpenchannelQueueId':{'$in':_0x542658}},'transaction':_0x25b317});})[_0x6f54('0x47')](function(){var _0x4b72da=_0x6f54('0x6e')+_0x25821d;return db[_0x6f54('0x5b')][_0x6f54('0x34')](_0x4b72da,{'type':db[_0x6f54('0x5d')]['QueryTypes'][_0x6f54('0x61')],'raw':!![],'transaction':_0x25b317});})[_0x6f54('0x47')](function(_0x42d77b){var _0x2fac5a=_['map'](_0x42d77b,function(_0x21dd65){return Number(_0x21dd65[_0x6f54('0x6f')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x39ece0},'WhatsappQueueId':{'$in':_0x2fac5a}},'transaction':_0x25b317});})[_0x6f54('0x47')](function(){return db[_0x6f54('0x70')]['find']({'where':{'TeamId':_0x25821d}});})[_0x6f54('0x47')](function(_0x3467f1){if(_0x3467f1===null){return;}return db[_0x6f54('0x71')][_0x6f54('0x5a')]({'where':{'UserId':{'$in':_0x39ece0},'VoicePrefixId':_0x3467f1[_0x6f54('0x72')]},'transaction':_0x25b317});})[_0x6f54('0x47')](function(){return db[_0x6f54('0x46')][_0x6f54('0x5a')]({'where':{'id':_0x25821d},'cascade':!![],'transaction':_0x25b317});})['then'](function(_0x5d6e88){if(_0x5d6e88===0x0){_0x2dece8[_0x6f54('0x1d')](0x194);}else{return db[_0x6f54('0x58')][_0x6f54('0x5a')]({'where':{'type':_0x6f54('0x54'),'resourceId':_0x25821d},'cascade':!![],'transaction':_0x25b317})[_0x6f54('0x47')](function(){_0x2dece8[_0x6f54('0x1f')](0xcc)['end']();});}})[_0x6f54('0x49')](function(_0x54ccc1){_0x2dece8[_0x6f54('0x1f')](0x1f4)['send'](_0x54ccc1);});});};exports['getQueues']=function(_0x21b4c6,_0x1c9637,_0x554d9a){return db[_0x6f54('0x46')][_0x6f54('0x73')]({'where':{'id':_0x21b4c6['params']['id']}})[_0x6f54('0x47')](handleEntityNotFound(_0x1c9637,null))[_0x6f54('0x47')](function(_0x4fac4e){if(!_0x21b4c6[_0x6f54('0x34')][_0x6f54('0x74')]||!utils['isValidChannel'](_0x21b4c6[_0x6f54('0x34')][_0x6f54('0x74')])){throw new db[(_0x6f54('0x5d'))][(_0x6f54('0x75'))](_0x6f54('0x76'));}var _0x2a1bb2={};var _0x319afc={};_0x319afc['model']=_['keys'](db[_['capitalize'](_0x21b4c6[_0x6f54('0x34')][_0x6f54('0x74')][_0x6f54('0x77')]())+_0x6f54('0x78')][_0x6f54('0x2f')]);_0x319afc[_0x6f54('0x34')]=_[_0x6f54('0x4c')](_0x21b4c6['query']);_0x319afc[_0x6f54('0x35')]=_[_0x6f54('0x36')](_0x319afc[_0x6f54('0x33')],_0x319afc[_0x6f54('0x34')]);_0x2a1bb2[_0x6f54('0x37')]=_[_0x6f54('0x36')](_0x319afc[_0x6f54('0x33')],qs[_0x6f54('0x38')](_0x21b4c6['query'][_0x6f54('0x38')]));_0x2a1bb2[_0x6f54('0x37')]=_0x2a1bb2[_0x6f54('0x37')][_0x6f54('0x39')]?_0x2a1bb2['attributes']:_0x319afc['model'];_0x2a1bb2['limit']=qs[_0x6f54('0x23')](_0x21b4c6[_0x6f54('0x34')][_0x6f54('0x23')]);_0x2a1bb2[_0x6f54('0x20')]=qs[_0x6f54('0x20')](_0x21b4c6[_0x6f54('0x34')]['offset']);_0x2a1bb2[_0x6f54('0x3c')]=qs[_0x6f54('0x3d')](_0x21b4c6['query']['sort']);_0x2a1bb2[_0x6f54('0x3e')]=qs['filters'](_[_0x6f54('0x3f')](_0x21b4c6['query'],_0x319afc[_0x6f54('0x35')]));_0x2a1bb2=_['merge']({},_0x2a1bb2,_0x21b4c6[_0x6f54('0x43')]);return _0x4fac4e[_0x6f54('0x51')+_[_0x6f54('0x79')](_0x21b4c6[_0x6f54('0x34')][_0x6f54('0x74')][_0x6f54('0x77')]())+'Queues'](_0x2a1bb2);})[_0x6f54('0x47')](respondWithResult(_0x1c9637,null))['catch'](handleError(_0x1c9637,null));};exports[_0x6f54('0x7a')]=function(_0x3f324e,_0x516cee,_0x49a397){return db[_0x6f54('0x46')][_0x6f54('0x73')]({'where':{'id':_0x3f324e[_0x6f54('0x4b')]['id']}})[_0x6f54('0x47')](function(_0x4b3ceb){if(_0x4b3ceb){if(!_0x3f324e[_0x6f54('0x4f')][_0x6f54('0x74')]||!utils['isValidChannel'](_0x3f324e['body'][_0x6f54('0x74')])){throw new db[(_0x6f54('0x5d'))]['ValidationError'](_0x6f54('0x76'));}return _0x4b3ceb[_0x6f54('0x7b')+_[_0x6f54('0x79')](_0x3f324e['body'][_0x6f54('0x74')][_0x6f54('0x77')]())+_0x6f54('0x7c')](_0x3f324e[_0x6f54('0x4f')][_0x6f54('0x7d')]);}return null;})[_0x6f54('0x47')](handleEntityNotFound(_0x516cee,null))['then'](respondWithStatusCode(_0x516cee,null))[_0x6f54('0x49')](handleError(_0x516cee,null));};exports[_0x6f54('0x7e')]=function(_0x517742,_0xffd8b7,_0x5cdf3e){return db[_0x6f54('0x46')][_0x6f54('0x73')]({'where':{'id':_0x517742[_0x6f54('0x4b')]['id']}})['then'](function(_0x477b36){if(_0x477b36){if(!_0x517742['query'][_0x6f54('0x74')]||!utils[_0x6f54('0x7f')](_0x517742[_0x6f54('0x34')]['channel'])){throw new db[(_0x6f54('0x5d'))]['ValidationError']('Unknown\x20channel');}return _0x477b36[_0x6f54('0x80')+_['capitalize'](_0x517742[_0x6f54('0x34')]['channel'][_0x6f54('0x77')]())+_0x6f54('0x7c')](_0x517742[_0x6f54('0x34')][_0x6f54('0x7d')]);}return null;})['then'](handleEntityNotFound(_0xffd8b7,null))[_0x6f54('0x47')](respondWithStatusCode(_0xffd8b7,null))[_0x6f54('0x49')](handleError(_0xffd8b7,null));};exports[_0x6f54('0x81')]=function(_0xc51c6c,_0x247b9b){var _0x2a8113=_[_0x6f54('0x82')](_0xc51c6c[_0x6f54('0x4f')]['ids'])?_0xc51c6c[_0x6f54('0x4f')][_0x6f54('0x7d')]:[_0xc51c6c[_0x6f54('0x4f')]['ids']];var _0x11f8f1=_0xc51c6c[_0x6f54('0x4b')]['id'];return db['Team'][_0x6f54('0x4d')]({'where':{'id':_0x11f8f1}})[_0x6f54('0x47')](handleEntityNotFound(_0x247b9b,null))[_0x6f54('0x47')](function(_0x232a10){if(_0x232a10){var _0x5e8b31=[_0x6f54('0x83'),_0x6f54('0x84'),'Mail',_0x6f54('0x85'),_0x6f54('0x86'),_0x6f54('0x87'),'Whatsapp'];return db[_0x6f54('0x5b')][_0x6f54('0x5c')](function(_0x4738d7){var _0x12ca36=_[_0x6f54('0x2e')](_0x5e8b31,function(_0x144e77){var _0x3b831c={'attributes':['id',_0x6f54('0x2b')]};if(_0x144e77===_0x6f54('0x83')){_0x3b831c[_0x6f54('0x88')]={'attributes':[_0x6f54('0x89')]};}return _0x232a10[_0x6f54('0x51')+_0x144e77+_0x6f54('0x7c')](_0x3b831c)[_0x6f54('0x47')](function(_0x9e724f){var _0x2eec7a=_[_0x6f54('0x2e')](_0x9e724f,function(_0x20eb61){var _0x465b34=_[_0x6f54('0x2e')](_0x2a8113,function(_0x58a640){var _0x219ee0={'where':{'UserId':_0x58a640,[_0x144e77+_0x6f54('0x8a')]:_0x20eb61['id']},'transaction':_0x4738d7};if(_0x144e77===_0x6f54('0x83')){_0x219ee0['defaults']={'penalty':_0x20eb61[_0x6f54('0x8b')][_0x6f54('0x89')]};}return db[_0x6f54('0x8c')+_0x144e77+_0x6f54('0x78')][_0x6f54('0x8d')](_0x219ee0)[_0x6f54('0x47')](function(){socket['emit'](_0x6f54('0x50')+_0x144e77+_0x6f54('0x8e'),{'UserId':_0x58a640,[_0x144e77+_0x6f54('0x8a')]:_0x20eb61['id']});if(_0x144e77!==_0x6f54('0x83')){return;}return db[_0x6f54('0x8c')][_0x6f54('0x8f')]({'where':{'id':_0x2a8113,'online':0x1},'attributes':['id',_0x6f54('0x2b'),_0x6f54('0x90'),'voicePause',_0x6f54('0x91')],'raw':!![]})[_0x6f54('0x47')](function(_0x73d27d){var _0x275895=_[_0x6f54('0x2e')](_0x73d27d,function(_0x3c89ae){return db[_0x6f54('0x92')]['upsert']({'membername':_0x3c89ae[_0x6f54('0x2b')],'UserId':_0x3c89ae['id'],'queue_name':_0x20eb61[_0x6f54('0x2b')],'VoiceQueueId':_0x20eb61['id'],'interface':_[_0x6f54('0x93')](_0x3c89ae['interface'])?util['format']('SIP/%s',_0x3c89ae['name']):_0x3c89ae[_0x6f54('0x91')],'paused':_0x3c89ae[_0x6f54('0x94')]||![],'penalty':_0x20eb61['TeamVoiceQueue']['penalty']},{'transaction':_0x4738d7});});return Promise['all'](_0x275895);});});});return Promise[_0x6f54('0x95')](_0x465b34);});return Promise[_0x6f54('0x95')](_0x2eec7a);})[_0x6f54('0x47')](function(){return db['TeamVoicePrefix'][_0x6f54('0x73')]({'where':{'teamId':_0x11f8f1}})['then'](function(_0x1fb152){if(_0x1fb152){var _0x36d07b=_['map'](_0x2a8113,function(_0x2e1070){db[_0x6f54('0x71')][_0x6f54('0x96')]({'UserId':_0x2e1070,'VoicePrefixId':_0x1fb152[_0x6f54('0x72')]});});return Promise[_0x6f54('0x95')](_0x36d07b);}});});});return Promise[_0x6f54('0x95')](_0x12ca36)[_0x6f54('0x47')](function(){return _0x232a10[_0x6f54('0x81')](_0x2a8113,{'transaction':_0x4738d7})['spread'](function(_0x2ea842){return _0x2ea842;});});});}})[_0x6f54('0x47')](respondWithResult(_0x247b9b,null))[_0x6f54('0x49')](handleError(_0x247b9b,null));};exports[_0x6f54('0x97')]=function(_0x4add51,_0x5db883){var _0x2505a0=_[_0x6f54('0x82')](_0x4add51['query'][_0x6f54('0x7d')])?_0x4add51[_0x6f54('0x34')][_0x6f54('0x7d')]:[_0x4add51[_0x6f54('0x34')][_0x6f54('0x7d')]];var _0x4ff1b5=_0x4add51[_0x6f54('0x4b')]['id'];return db[_0x6f54('0x46')][_0x6f54('0x4d')]({'where':{'id':_0x4ff1b5}})[_0x6f54('0x47')](handleEntityNotFound(_0x5db883,null))[_0x6f54('0x47')](function(_0x592456){if(_0x592456){var _0x16f38e=[_0x6f54('0x83'),'Chat',_0x6f54('0x98'),_0x6f54('0x85'),_0x6f54('0x86'),_0x6f54('0x87'),_0x6f54('0x99')];return db[_0x6f54('0x5b')]['transaction'](function(_0x14b9b2){var _0x5c446f=_[_0x6f54('0x2e')](_0x16f38e,function(_0x26273d){var _0x3c620b={'attributes':['id','name']};return _0x592456['get'+_0x26273d+_0x6f54('0x7c')](_0x3c620b)[_0x6f54('0x47')](function(_0x2f47f0){var _0x532ade=_[_0x6f54('0x2e')](_0x2f47f0,function(_0x3ba86b){return _0x3ba86b[_0x6f54('0x97')](_0x2505a0,{'transaction':_0x14b9b2})[_0x6f54('0x47')](function(){var _0x557457=_[_0x6f54('0x2e')](_0x2505a0,function(_0x28f31d){socket['emit']('user'+_0x26273d+_0x6f54('0x9a'),{'UserId':Number(_0x28f31d),[_0x26273d+'QueueId']:_0x3ba86b['id']});if(_0x26273d!==_0x6f54('0x83')){return;}return db[_0x6f54('0x92')][_0x6f54('0x5a')]({'where':{'VoiceQueueId':_0x3ba86b['id'],'UserId':_0x28f31d},'transaction':_0x14b9b2});});return Promise[_0x6f54('0x95')](_0x557457);});});return Promise[_0x6f54('0x95')](_0x532ade);});});return Promise['all'](_0x5c446f)[_0x6f54('0x47')](function(){return _0x592456[_0x6f54('0x97')](_0x2505a0,{'transaction':_0x14b9b2});})[_0x6f54('0x47')](function(){return db[_0x6f54('0x70')][_0x6f54('0x73')]({'where':{'teamId':_0x4ff1b5}})['then'](function(_0x57f81d){if(_0x57f81d){var _0x312096=_['map'](_0x2505a0,function(_0x3c72d9){db[_0x6f54('0x71')][_0x6f54('0x5a')]({'where':{'UserId':_0x3c72d9,'VoicePrefixId':_0x57f81d[_0x6f54('0x72')]}});});return Promise[_0x6f54('0x95')](_0x312096);}});});});}})[_0x6f54('0x47')](respondWithStatusCode(_0x5db883,null))[_0x6f54('0x49')](handleError(_0x5db883,null));};exports['getAgents']=function(_0x20ebeb,_0x474449,_0x3ec6bd){var _0x4bc81e={};var _0x185906={};var _0x3e7a24;var _0x258111;return db[_0x6f54('0x46')][_0x6f54('0x73')]({'where':{'id':_0x20ebeb[_0x6f54('0x4b')]['id']}})['then'](handleEntityNotFound(_0x474449,null))[_0x6f54('0x47')](function(_0x2e78d4){if(_0x2e78d4){_0x3e7a24=_0x2e78d4;_0x185906[_0x6f54('0x33')]=_[_0x6f54('0x4c')](db[_0x6f54('0x8c')][_0x6f54('0x2f')]);_0x185906[_0x6f54('0x34')]=_[_0x6f54('0x4c')](_0x20ebeb[_0x6f54('0x34')]);_0x185906[_0x6f54('0x35')]=_[_0x6f54('0x36')](_0x185906[_0x6f54('0x33')],_0x185906[_0x6f54('0x34')]);_0x4bc81e[_0x6f54('0x37')]=_[_0x6f54('0x36')](_0x185906[_0x6f54('0x33')],qs[_0x6f54('0x38')](_0x20ebeb['query'][_0x6f54('0x38')]));_0x4bc81e[_0x6f54('0x37')]=_0x4bc81e['attributes'][_0x6f54('0x39')]?_0x4bc81e[_0x6f54('0x37')]:_0x185906['model'];_0x4bc81e[_0x6f54('0x3c')]=qs['sort'](_0x20ebeb[_0x6f54('0x34')][_0x6f54('0x3d')]);_0x4bc81e['where']=qs[_0x6f54('0x35')](_[_0x6f54('0x3f')](_0x20ebeb[_0x6f54('0x34')],_0x185906['filters']));if(_0x20ebeb['query']['filter']){_0x4bc81e[_0x6f54('0x3e')]=_[_0x6f54('0x40')](_0x4bc81e[_0x6f54('0x3e')],{'$or':_[_0x6f54('0x2e')](_0x4bc81e[_0x6f54('0x37')],function(_0x25f398){var _0x4e41c8={};_0x4e41c8[_0x25f398]={'$like':'%'+_0x20ebeb[_0x6f54('0x34')]['filter']+'%'};return _0x4e41c8;})});}_0x4bc81e=_[_0x6f54('0x40')]({},_0x4bc81e,_0x20ebeb[_0x6f54('0x43')]);return _0x3e7a24['getAgents'](_0x4bc81e);}})[_0x6f54('0x47')](function(_0x20a5ad){if(_0x20a5ad){_0x258111=_0x20a5ad['length'];if(!_0x20ebeb['query'][_0x6f54('0x3a')](_0x6f54('0x3b'))){_0x4bc81e[_0x6f54('0x23')]=qs[_0x6f54('0x23')](_0x20ebeb[_0x6f54('0x34')]['limit']);_0x4bc81e[_0x6f54('0x20')]=qs[_0x6f54('0x20')](_0x20ebeb['query'][_0x6f54('0x20')]);}return _0x3e7a24[_0x6f54('0x9b')](_0x4bc81e);}})[_0x6f54('0x47')](function(_0x3f1560){if(_0x3f1560){return _0x3f1560?{'count':_0x258111,'rows':_0x3f1560}:null;}})[_0x6f54('0x47')](respondWithResult(_0x474449,null))['catch'](handleError(_0x474449,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 6a323c5..f176935 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 _0xe468=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x5c92d0,_0x3a8a94){var _0x3c68d4=function(_0x17f499){while(--_0x17f499){_0x5c92d0['push'](_0x5c92d0['shift']());}};_0x3c68d4(++_0x3a8a94);}(_0xe468,0xca));var _0x8e46=function(_0x4cb582,_0x2d744a){_0x4cb582=_0x4cb582-0x0;var _0x2580e2=_0xe468[_0x4cb582];return _0x2580e2;};'use strict';var EventEmitter=require('events');var Team=require(_0x8e46('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x8e46('0x1')](0x0);var events={'afterCreate':_0x8e46('0x2'),'afterUpdate':_0x8e46('0x3'),'afterDestroy':_0x8e46('0x4')};function emitEvent(_0x260acd){return function(_0x5545f5,_0x2aeedd,_0x61d632){TeamEvents[_0x8e46('0x5')](_0x260acd+':'+_0x5545f5['id'],_0x5545f5);TeamEvents[_0x8e46('0x5')](_0x260acd,_0x5545f5);_0x61d632(null);};}for(var e in events){if(events[_0x8e46('0x6')](e)){var event=events[e];Team[_0x8e46('0x7')](e,emitEvent(event));}}module[_0x8e46('0x8')]=TeamEvents; \ No newline at end of file +var _0x96d2=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96d2,0x137));var _0x296d=function(_0x503306,_0x356f2f){_0x503306=_0x503306-0x0;var _0x44a99d=_0x96d2[_0x503306];return _0x44a99d;};'use strict';var EventEmitter=require(_0x296d('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x296d('0x1')](0x0);var events={'afterCreate':_0x296d('0x2'),'afterUpdate':_0x296d('0x3'),'afterDestroy':_0x296d('0x4')};function emitEvent(_0x1c6f72){return function(_0xa742d0,_0x40955b,_0x1f3b32){TeamEvents[_0x296d('0x5')](_0x1c6f72+':'+_0xa742d0['id'],_0xa742d0);TeamEvents[_0x296d('0x5')](_0x1c6f72,_0xa742d0);_0x1f3b32(null);};}for(var e in events){if(events[_0x296d('0x6')](e)){var event=events[e];Team[_0x296d('0x7')](e,emitEvent(event));}}module[_0x296d('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index e067861..b4f002e 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 _0xcf37=['catch','lodash','./team.attributes','get','Queues','then','map','channel','exports','define','Team','teams','Fax','Openchannel','Sms','Voice','Whatsapp','resolve','all'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcf37,0x16a));var _0x7cf3=function(_0x513feb,_0x17635a){_0x513feb=_0x513feb-0x0;var _0x192afe=_0xcf37[_0x513feb];return _0x192afe;};'use strict';var _=require(_0x7cf3('0x0'));var attributes=require(_0x7cf3('0x1'));function getQueuesByChannel(_0x233557,_0x32d848){var _0x12953e=_0x7cf3('0x2')+_0x32d848+_0x7cf3('0x3');return _0x233557[_0x12953e]()[_0x7cf3('0x4')](function(_0x166b02){return _[_0x7cf3('0x5')](_0x166b02,function(_0x17ada3){_0x17ada3['setDataValue'](_0x7cf3('0x6'),_0x32d848);return _0x17ada3;});})['catch'](function(_0x2d71c0){throw _0x2d71c0;});}module[_0x7cf3('0x7')]=function(_0x3be841){return _0x3be841[_0x7cf3('0x8')](_0x7cf3('0x9'),attributes,{'tableName':_0x7cf3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x30c5a7=this;var _0x38f4aa=['Chat',_0x7cf3('0xb'),'Mail',_0x7cf3('0xc'),_0x7cf3('0xd'),_0x7cf3('0xe'),_0x7cf3('0xf')];return Promise[_0x7cf3('0x10')]()[_0x7cf3('0x4')](function(){var _0x38c032=_[_0x7cf3('0x5')](_0x38f4aa,function(_0x13d0ad){return getQueuesByChannel(_0x30c5a7,_0x13d0ad);});return Promise[_0x7cf3('0x11')](_0x38c032);})[_0x7cf3('0x12')](function(_0x5c9bd2){throw _0x5c9bd2;});}}});}; \ No newline at end of file +var _0x829d=['Voice','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','exports','define','Team','teams','Chat','Mail','Openchannel','Sms'];(function(_0x3db464,_0x53fd4e){var _0x81faa2=function(_0x98fc91){while(--_0x98fc91){_0x3db464['push'](_0x3db464['shift']());}};_0x81faa2(++_0x53fd4e);}(_0x829d,0xa4));var _0xd829=function(_0x1be621,_0x4e095f){_0x1be621=_0x1be621-0x0;var _0x34e144=_0x829d[_0x1be621];return _0x34e144;};'use strict';var _=require(_0xd829('0x0'));var attributes=require(_0xd829('0x1'));function getQueuesByChannel(_0x404cf3,_0x5b9d5f){var _0x4db1f1=_0xd829('0x2')+_0x5b9d5f+_0xd829('0x3');return _0x404cf3[_0x4db1f1]()[_0xd829('0x4')](function(_0x3141e6){return _[_0xd829('0x5')](_0x3141e6,function(_0x43eaa1){_0x43eaa1[_0xd829('0x6')](_0xd829('0x7'),_0x5b9d5f);return _0x43eaa1;});})['catch'](function(_0xaf84dd){throw _0xaf84dd;});}module[_0xd829('0x8')]=function(_0x342b08){return _0x342b08[_0xd829('0x9')](_0xd829('0xa'),attributes,{'tableName':_0xd829('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x8d63f=this;var _0x596fbd=[_0xd829('0xc'),'Fax',_0xd829('0xd'),_0xd829('0xe'),_0xd829('0xf'),_0xd829('0x10'),'Whatsapp'];return Promise['resolve']()[_0xd829('0x4')](function(){var _0xe9ceb9=_[_0xd829('0x5')](_0x596fbd,function(_0x3eeebf){return getQueuesByChannel(_0x8d63f,_0x3eeebf);});return Promise[_0xd829('0x11')](_0xe9ceb9);})['catch'](function(_0x3ee75b){throw _0x3ee75b;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f498f8f..585d610 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 _0x887d=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28e27c,_0x2216ff){var _0x45ae93=function(_0x15f539){while(--_0x15f539){_0x28e27c['push'](_0x28e27c['shift']());}};_0x45ae93(++_0x2216ff);}(_0x887d,0x19d));var _0xd887=function(_0x31b1f9,_0x3bfd04){_0x31b1f9=_0x31b1f9-0x0;var _0x40ecc2=_0x887d[_0x31b1f9];return _0x40ecc2;};'use strict';var _=require(_0xd887('0x0'));var util=require(_0xd887('0x1'));var moment=require(_0xd887('0x2'));var BPromise=require(_0xd887('0x3'));var rs=require(_0xd887('0x4'));var fs=require('fs');var Redis=require(_0xd887('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd887('0x6'));var logger=require('../../config/logger')(_0xd887('0x7'));var config=require('../../config/environment');var jayson=require(_0xd887('0x8'));var client=jayson[_0xd887('0x9')]['http']({'port':0x232a});config[_0xd887('0xa')]=_['defaults'](config[_0xd887('0xa')],{'host':_0xd887('0xb'),'port':0x18eb});var socket=require(_0xd887('0xc'))(new Redis(config[_0xd887('0xa')]));require(_0xd887('0xd'))['register'](socket);function respondWithRpcPromise(_0x104343,_0x542a3c,_0x2753b6){return new BPromise(function(_0x576218,_0x14c050){return client[_0xd887('0xe')](_0x104343,_0x2753b6)['then'](function(_0x27f95a){logger[_0xd887('0xf')](_0xd887('0x10'),_0x542a3c,_0xd887('0x11'));logger[_0xd887('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x542a3c,_0xd887('0x11'),JSON[_0xd887('0x13')](_0x27f95a));if(_0x27f95a[_0xd887('0x14')]){if(_0x27f95a[_0xd887('0x14')][_0xd887('0x15')]===0x1f4){logger[_0xd887('0x14')](_0xd887('0x10'),_0x542a3c,_0x27f95a[_0xd887('0x14')][_0xd887('0x16')]);return _0x14c050(_0x27f95a[_0xd887('0x14')][_0xd887('0x16')]);}logger[_0xd887('0x14')]('Team,\x20%s,\x20%s',_0x542a3c,_0x27f95a[_0xd887('0x14')]['message']);return _0x576218(_0x27f95a[_0xd887('0x14')][_0xd887('0x16')]);}else{logger['info'](_0xd887('0x10'),_0x542a3c,_0xd887('0x11'));_0x576218(_0x27f95a[_0xd887('0x17')][_0xd887('0x16')]);}})['catch'](function(_0x44ab52){logger[_0xd887('0x14')](_0xd887('0x10'),_0x542a3c,_0x44ab52);_0x14c050(_0x44ab52);});});} \ No newline at end of file +var _0x5911=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x12e15e,_0x270d4f){var _0x1d81bf=function(_0x25bc0f){while(--_0x25bc0f){_0x12e15e['push'](_0x12e15e['shift']());}};_0x1d81bf(++_0x270d4f);}(_0x5911,0xdb));var _0x1591=function(_0x4f1303,_0x3ec38d){_0x4f1303=_0x4f1303-0x0;var _0x508493=_0x5911[_0x4f1303];return _0x508493;};'use strict';var _=require(_0x1591('0x0'));var util=require(_0x1591('0x1'));var moment=require(_0x1591('0x2'));var BPromise=require('bluebird');var rs=require(_0x1591('0x3'));var fs=require('fs');var Redis=require(_0x1591('0x4'));var db=require(_0x1591('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1591('0x6'));var config=require('../../config/environment');var jayson=require(_0x1591('0x7'));var client=jayson[_0x1591('0x8')][_0x1591('0x9')]({'port':0x232a});config[_0x1591('0xa')]=_[_0x1591('0xb')](config[_0x1591('0xa')],{'host':_0x1591('0xc'),'port':0x18eb});var socket=require(_0x1591('0xd'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x4fe982,_0x18dc3b,_0x2941c1){return new BPromise(function(_0x155b73,_0x65c9c7){return client[_0x1591('0xe')](_0x4fe982,_0x2941c1)[_0x1591('0xf')](function(_0x946e43){logger['info']('Team,\x20%s,\x20%s',_0x18dc3b,_0x1591('0x10'));logger['debug'](_0x1591('0x11'),_0x18dc3b,_0x1591('0x10'),JSON[_0x1591('0x12')](_0x946e43));if(_0x946e43[_0x1591('0x13')]){if(_0x946e43[_0x1591('0x13')][_0x1591('0x14')]===0x1f4){logger[_0x1591('0x13')](_0x1591('0x15'),_0x18dc3b,_0x946e43['error'][_0x1591('0x16')]);return _0x65c9c7(_0x946e43[_0x1591('0x13')]['message']);}logger[_0x1591('0x13')](_0x1591('0x15'),_0x18dc3b,_0x946e43[_0x1591('0x13')][_0x1591('0x16')]);return _0x155b73(_0x946e43[_0x1591('0x13')][_0x1591('0x16')]);}else{logger[_0x1591('0x17')](_0x1591('0x15'),_0x18dc3b,_0x1591('0x10'));_0x155b73(_0x946e43[_0x1591('0x18')]['message']);}})['catch'](function(_0x32fa65){logger[_0x1591('0x13')]('Team,\x20%s,\x20%s',_0x18dc3b,_0x32fa65);_0x65c9c7(_0x32fa65);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 820a7c1..60acc62 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 _0xb077=['update','emit','./team.events'];(function(_0x12f036,_0x27e401){var _0xf0be1b=function(_0x4084c){while(--_0x4084c){_0x12f036['push'](_0x12f036['shift']());}};_0xf0be1b(++_0x27e401);}(_0xb077,0x7a));var _0x7b07=function(_0x9975d9,_0x13bc83){_0x9975d9=_0x9975d9-0x0;var _0x236989=_0xb077[_0x9975d9];return _0x236989;};'use strict';var TeamEvents=require(_0x7b07('0x0'));var events=['save','remove',_0x7b07('0x1')];function createListener(_0x5a1c3d,_0x3b4ddb){return function(_0xb5fbb2){_0x3b4ddb[_0x7b07('0x2')](_0x5a1c3d,_0xb5fbb2);};}function removeListener(_0x2b0c6c,_0x423957){return function(){TeamEvents['removeListener'](_0x2b0c6c,_0x423957);};}exports['register']=function(_0xdc333){for(var _0x325d95=0x0,_0x110ee5=events['length'];_0x325d95<_0x110ee5;_0x325d95++){var _0x561c99=events[_0x325d95];var _0x3a82e8=createListener('team:'+_0x561c99,_0xdc333);TeamEvents['on'](_0x561c99,_0x3a82e8);}}; \ No newline at end of file +var _0x63cf=['remove','update','removeListener','register','team:','./team.events','save'];(function(_0x3f7598,_0x20d69d){var _0x38b8fe=function(_0x43b280){while(--_0x43b280){_0x3f7598['push'](_0x3f7598['shift']());}};_0x38b8fe(++_0x20d69d);}(_0x63cf,0xc9));var _0xf63c=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x63cf[_0x5466ab];return _0x40751a;};'use strict';var TeamEvents=require(_0xf63c('0x0'));var events=[_0xf63c('0x1'),_0xf63c('0x2'),_0xf63c('0x3')];function createListener(_0x112d53,_0x34b27e){return function(_0x1e5162){_0x34b27e['emit'](_0x112d53,_0x1e5162);};}function removeListener(_0x1aa7fd,_0x5844c1){return function(){TeamEvents[_0xf63c('0x4')](_0x1aa7fd,_0x5844c1);};}exports[_0xf63c('0x5')]=function(_0x30da33){for(var _0x2fe800=0x0,_0x6be9b2=events['length'];_0x2fe800<_0x6be9b2;_0x2fe800++){var _0x339935=events[_0x2fe800];var _0x3ba6cc=createListener(_0xf63c('0x6')+_0x339935,_0x30da33);TeamEvents['on'](_0x339935,_0x3ba6cc);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 7f709ea..e4437fc 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 _0x7be9=['INTEGER','exports'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x7be9,0xff));var _0x97be=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x7be9[_0x4fbfd9];return _0x31dc94;};'use strict';var Sequelize=require('sequelize');module[_0x97be('0x0')]={'TeamId':{'type':Sequelize[_0x97be('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x97be('0x1')]}}; \ No newline at end of file +var _0xa9e5=['sequelize','exports','INTEGER'];(function(_0x1c3ece,_0x12227c){var _0x12554f=function(_0x54fa85){while(--_0x54fa85){_0x1c3ece['push'](_0x1c3ece['shift']());}};_0x12554f(++_0x12227c);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x48e11b,_0x3b7fda){_0x48e11b=_0x48e11b-0x0;var _0x560ca6=_0xa9e5[_0x48e11b];return _0x560ca6;};'use strict';var Sequelize=require(_0x5a9e('0x0'));module[_0x5a9e('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x5a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 66ea3d3..23dc758 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 _0x39d0=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x5651a7,_0x43fc7c){var _0x52d2c5=function(_0x3cbc22){while(--_0x3cbc22){_0x5651a7['push'](_0x5651a7['shift']());}};_0x52d2c5(++_0x43fc7c);}(_0x39d0,0x144));var _0x039d=function(_0x26c377,_0xe40b1){_0x26c377=_0x26c377-0x0;var _0x250327=_0x39d0[_0x26c377];return _0x250327;};'use strict';var _=require(_0x039d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x039d('0x1'));var moment=require(_0x039d('0x2'));var BPromise=require(_0x039d('0x3'));var rp=require(_0x039d('0x4'));var fs=require('fs');var path=require(_0x039d('0x5'));var rimraf=require('rimraf');var config=require(_0x039d('0x6'));var attributes=require(_0x039d('0x7'));module[_0x039d('0x8')]=function(_0x1e5075,_0x1ab56f){return _0x1e5075[_0x039d('0x9')](_0x039d('0xa'),attributes,{'tableName':_0x039d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9147=['./teamVoicePrefix.attributes','define','team_has_voice_prefixes','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5d7009,_0x217579){var _0x2f26a2=function(_0x305380){while(--_0x305380){_0x5d7009['push'](_0x5d7009['shift']());}};_0x2f26a2(++_0x217579);}(_0x9147,0x7b));var _0x7914=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9147[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var logger=require('../../config/logger')(_0x7914('0x2'));var moment=require('moment');var BPromise=require(_0x7914('0x3'));var rp=require(_0x7914('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7914('0x5'));var config=require(_0x7914('0x6'));var attributes=require(_0x7914('0x7'));module['exports']=function(_0x34c372,_0x4dd321){return _0x34c372[_0x7914('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x7914('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index dbd0dd2..b1c7438 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x39a7a3,_0x24cf00){var _0x41e026=function(_0x43e68d){while(--_0x43e68d){_0x39a7a3['push'](_0x39a7a3['shift']());}};_0x41e026(++_0x24cf00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 36152f7..d3e5bd7 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 _0x6b45=['exports','INTEGER','sequelize'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6b45,0xb0));var _0x56b4=function(_0x356d1b,_0x2a9fb7){_0x356d1b=_0x356d1b-0x0;var _0x4c2ca4=_0x6b45[_0x356d1b];return _0x4c2ca4;};'use strict';var Sequelize=require(_0x56b4('0x0'));module[_0x56b4('0x1')]={'penalty':{'type':Sequelize[_0x56b4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x05bc=['INTEGER','sequelize','exports'];(function(_0x4d7277,_0x6dbac8){var _0x16d03d=function(_0xd24cdd){while(--_0xd24cdd){_0x4d7277['push'](_0x4d7277['shift']());}};_0x16d03d(++_0x6dbac8);}(_0x05bc,0x109));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc05b('0x0'));module[_0xc05b('0x1')]={'penalty':{'type':Sequelize[_0xc05b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index a00b246..3df93f0 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 _0x6e12=['util','../../config/logger','api','bluebird','request-promise','path','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash'];(function(_0x1cc177,_0x3c50d3){var _0x26fe78=function(_0x40450f){while(--_0x40450f){_0x1cc177['push'](_0x1cc177['shift']());}};_0x26fe78(++_0x3c50d3);}(_0x6e12,0x154));var _0x26e1=function(_0x223c1e,_0x4da8d3){_0x223c1e=_0x223c1e-0x0;var _0xbeaf50=_0x6e12[_0x223c1e];return _0xbeaf50;};'use strict';var _=require(_0x26e1('0x0'));var util=require(_0x26e1('0x1'));var logger=require(_0x26e1('0x2'))(_0x26e1('0x3'));var moment=require('moment');var BPromise=require(_0x26e1('0x4'));var rp=require(_0x26e1('0x5'));var fs=require('fs');var path=require(_0x26e1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26e1('0x7'));module[_0x26e1('0x8')]=function(_0x18467c,_0x2073c9){return _0x18467c[_0x26e1('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0x26e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb4b=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','util','api','moment','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x26d4ca,_0xa2b4a0){_0x26d4ca=_0x26d4ca-0x0;var _0x5583f9=_0xdb4b[_0x26d4ca];return _0x5583f9;};'use strict';var _=require('lodash');var util=require(_0xbdb4('0x0'));var logger=require('../../config/logger')(_0xbdb4('0x1'));var moment=require(_0xbdb4('0x2'));var BPromise=require(_0xbdb4('0x3'));var rp=require(_0xbdb4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdb4('0x5'));var config=require(_0xbdb4('0x6'));var attributes=require(_0xbdb4('0x7'));module[_0xbdb4('0x8')]=function(_0x1c69ed,_0x3c8252){return _0x1c69ed[_0xbdb4('0x9')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index bbea134..0fdc6db 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 _0x4a8c=['info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x2f4406,_0x363dc2){var _0x21036d=function(_0x1ad01a){while(--_0x1ad01a){_0x2f4406['push'](_0x2f4406['shift']());}};_0x21036d(++_0x363dc2);}(_0x4a8c,0x12f));var _0xc4a8=function(_0x5d9522,_0x4abfde){_0x5d9522=_0x5d9522-0x0;var _0x60d7ee=_0x4a8c[_0x5d9522];return _0x60d7ee;};'use strict';var _=require(_0xc4a8('0x0'));var util=require(_0xc4a8('0x1'));var moment=require(_0xc4a8('0x2'));var BPromise=require('bluebird');var rs=require(_0xc4a8('0x3'));var fs=require('fs');var Redis=require(_0xc4a8('0x4'));var db=require(_0xc4a8('0x5'))['db'];var utils=require(_0xc4a8('0x6'));var logger=require(_0xc4a8('0x7'))(_0xc4a8('0x8'));var config=require(_0xc4a8('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c7d2f,_0x1d7343,_0x2cbcb9){return new BPromise(function(_0x3e93a9,_0x5f1197){return client[_0xc4a8('0xa')](_0x2c7d2f,_0x2cbcb9)[_0xc4a8('0xb')](function(_0x1053c3){logger[_0xc4a8('0xc')](_0xc4a8('0xd'),_0x1d7343,_0xc4a8('0xe'));logger[_0xc4a8('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1d7343,_0xc4a8('0xe'),JSON[_0xc4a8('0x10')](_0x1053c3));if(_0x1053c3[_0xc4a8('0x11')]){if(_0x1053c3[_0xc4a8('0x11')]['code']===0x1f4){logger[_0xc4a8('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1d7343,_0x1053c3[_0xc4a8('0x11')][_0xc4a8('0x12')]);return _0x5f1197(_0x1053c3['error'][_0xc4a8('0x12')]);}logger['error'](_0xc4a8('0xd'),_0x1d7343,_0x1053c3[_0xc4a8('0x11')][_0xc4a8('0x12')]);return _0x3e93a9(_0x1053c3[_0xc4a8('0x11')]['message']);}else{logger[_0xc4a8('0xc')](_0xc4a8('0xd'),_0x1d7343,_0xc4a8('0xe'));_0x3e93a9(_0x1053c3[_0xc4a8('0x13')][_0xc4a8('0x12')]);}})[_0xc4a8('0x14')](function(_0x177afa){logger[_0xc4a8('0x11')](_0xc4a8('0xd'),_0x1d7343,_0x177afa);_0x5f1197(_0x177afa);});});} \ No newline at end of file +var _0xae99=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb'];(function(_0x15b230,_0x5845b3){var _0x4ae3f6=function(_0x46cde7){while(--_0x46cde7){_0x15b230['push'](_0x15b230['shift']());}};_0x4ae3f6(++_0x5845b3);}(_0xae99,0x172));var _0x9ae9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xae99[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x9ae9('0x0'));var util=require(_0x9ae9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ae9('0x2'));var db=require(_0x9ae9('0x3'))['db'];var utils=require(_0x9ae9('0x4'));var logger=require(_0x9ae9('0x5'))(_0x9ae9('0x6'));var config=require(_0x9ae9('0x7'));var jayson=require(_0x9ae9('0x8'));var client=jayson[_0x9ae9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e2871,_0x1eeea9,_0x5e1734){return new BPromise(function(_0x61398c,_0x2c6eb5){return client[_0x9ae9('0xa')](_0x5e2871,_0x5e1734)['then'](function(_0x193030){logger[_0x9ae9('0xb')](_0x9ae9('0xc'),_0x1eeea9,_0x9ae9('0xd'));logger[_0x9ae9('0xe')](_0x9ae9('0xf'),_0x1eeea9,_0x9ae9('0xd'),JSON[_0x9ae9('0x10')](_0x193030));if(_0x193030[_0x9ae9('0x11')]){if(_0x193030[_0x9ae9('0x11')][_0x9ae9('0x12')]===0x1f4){logger[_0x9ae9('0x11')](_0x9ae9('0xc'),_0x1eeea9,_0x193030[_0x9ae9('0x11')][_0x9ae9('0x13')]);return _0x2c6eb5(_0x193030[_0x9ae9('0x11')][_0x9ae9('0x13')]);}logger[_0x9ae9('0x11')](_0x9ae9('0xc'),_0x1eeea9,_0x193030[_0x9ae9('0x11')][_0x9ae9('0x13')]);return _0x61398c(_0x193030[_0x9ae9('0x11')][_0x9ae9('0x13')]);}else{logger[_0x9ae9('0xb')](_0x9ae9('0xc'),_0x1eeea9,'request\x20sent');_0x61398c(_0x193030[_0x9ae9('0x14')][_0x9ae9('0x13')]);}})[_0x9ae9('0x15')](function(_0x5bc5d2){logger[_0x9ae9('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1eeea9,_0x5bc5d2);_0x2c6eb5(_0x5bc5d2);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index adb161e..c58091a 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 _0x79bf=['update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','show','post','isAuthenticated','create'];(function(_0x1b3286,_0x497ede){var _0x275c36=function(_0x43bb24){while(--_0x43bb24){_0x1b3286['push'](_0x1b3286['shift']());}};_0x275c36(++_0x497ede);}(_0x79bf,0x1df));var _0xf79b=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x79bf[_0x1fc122];return _0xa2cb13;};'use strict';var multer=require('multer');var util=require(_0xf79b('0x0'));var path=require('path');var timeout=require(_0xf79b('0x1'));var express=require('express');var router=express[_0xf79b('0x2')]();var fs_extra=require(_0xf79b('0x3'));var auth=require(_0xf79b('0x4'));var interaction=require(_0xf79b('0x5'));var config=require(_0xf79b('0x6'));var controller=require(_0xf79b('0x7'));router[_0xf79b('0x8')]('/',auth['isAuthenticated'](),controller[_0xf79b('0x9')]);router[_0xf79b('0x8')](_0xf79b('0xa'),auth['isAuthenticated'](),controller[_0xf79b('0xb')]);router[_0xf79b('0xc')]('/',auth[_0xf79b('0xd')](),controller[_0xf79b('0xe')]);router['put']('/:id',auth[_0xf79b('0xd')](),controller[_0xf79b('0xf')]);router[_0xf79b('0x10')](_0xf79b('0xa'),auth[_0xf79b('0xd')](),controller[_0xf79b('0x11')]);module[_0xf79b('0x12')]=router; \ No newline at end of file +var _0xfa94=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','put','delete','destroy','multer'];(function(_0x59fd85,_0x3666c7){var _0xb79467=function(_0x2c7d10){while(--_0x2c7d10){_0x59fd85['push'](_0x59fd85['shift']());}};_0xb79467(++_0x3666c7);}(_0xfa94,0xef));var _0x4fa9=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xfa94[_0x30a31e];return _0x170879;};'use strict';var multer=require(_0x4fa9('0x0'));var util=require('util');var path=require(_0x4fa9('0x1'));var timeout=require('connect-timeout');var express=require(_0x4fa9('0x2'));var router=express[_0x4fa9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4fa9('0x4'));var interaction=require(_0x4fa9('0x5'));var config=require(_0x4fa9('0x6'));var controller=require(_0x4fa9('0x7'));router[_0x4fa9('0x8')]('/',auth[_0x4fa9('0x9')](),controller[_0x4fa9('0xa')]);router['get'](_0x4fa9('0xb'),auth[_0x4fa9('0x9')](),controller['show']);router['post']('/',auth[_0x4fa9('0x9')](),controller['create']);router[_0x4fa9('0xc')](_0x4fa9('0xb'),auth[_0x4fa9('0x9')](),controller['update']);router[_0x4fa9('0xd')]('/:id',auth[_0x4fa9('0x9')](),controller[_0x4fa9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index d66fb5d..4d32823 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 _0x490c=['sequelize','exports','STRING','TEXT'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x490c,0x130));var _0xc490=function(_0x10dc60,_0x2fcce1){_0x10dc60=_0x10dc60-0x0;var _0x47dec5=_0x490c[_0x10dc60];return _0x47dec5;};'use strict';var Sequelize=require(_0xc490('0x0'));module[_0xc490('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc490('0x2')]},'html':{'type':Sequelize[_0xc490('0x3')]}}; \ No newline at end of file +var _0x5c15=['sequelize','exports','STRING','TEXT'];(function(_0x2e5005,_0x38c4cc){var _0x5135d8=function(_0x2541f2){while(--_0x2541f2){_0x2e5005['push'](_0x2e5005['shift']());}};_0x5135d8(++_0x38c4cc);}(_0x5c15,0xa8));var _0x55c1=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5c15[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x55c1('0x0'));module[_0x55c1('0x1')]={'name':{'type':Sequelize[_0x55c1('0x2')]},'description':{'type':Sequelize[_0x55c1('0x2')]},'html':{'type':Sequelize[_0x55c1('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index a8c01cd..9824806 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 _0x9516=['set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','error','name','send','index','map','Template','rawAttributes','query','filters','intersection','model','attributes','length','nolimit','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','show','params','keys','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','body','eml-format','zip-dir','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count'];(function(_0x5916c5,_0x381e41){var _0x12ed1c=function(_0x532e92){while(--_0x532e92){_0x5916c5['push'](_0x5916c5['shift']());}};_0x12ed1c(++_0x381e41);}(_0x9516,0x82));var _0x6951=function(_0x411b75,_0x4de4ca){_0x411b75=_0x411b75-0x0;var _0x5a9239=_0x9516[_0x411b75];return _0x5a9239;};'use strict';var emlformat=require(_0x6951('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6951('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(_0x6951('0x2'));var path=require(_0x6951('0x3'));var sox=require(_0x6951('0x4'));var csv=require(_0x6951('0x5'));var ejs=require(_0x6951('0x6'));var fs=require('fs');var fs_extra=require(_0x6951('0x7'));var _=require(_0x6951('0x8'));var squel=require('squel');var crypto=require(_0x6951('0x9'));var jsforce=require(_0x6951('0xa'));var deskjs=require(_0x6951('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6951('0xc'));var Papa=require(_0x6951('0xd'));var Redis=require('ioredis');var authService=require(_0x6951('0xe'));var qs=require(_0x6951('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6951('0x10'));var logger=require(_0x6951('0x11'))(_0x6951('0x12'));var utils=require(_0x6951('0x13'));var config=require(_0x6951('0x14'));var licenseUtil=require(_0x6951('0x15'));var db=require(_0x6951('0x16'))['db'];function respondWithStatusCode(_0x5af56b,_0x32ed4d){_0x32ed4d=_0x32ed4d||0xcc;return function(_0x2e2cf8){if(_0x2e2cf8){return _0x5af56b['sendStatus'](_0x32ed4d);}return _0x5af56b['status'](_0x32ed4d)[_0x6951('0x17')]();};}function respondWithResult(_0x31b27f,_0x185441){_0x185441=_0x185441||0xc8;return function(_0xe43032){if(_0xe43032){return _0x31b27f[_0x6951('0x18')](_0x185441)[_0x6951('0x19')](_0xe43032);}};}function respondWithFilteredResult(_0x2e9bd1,_0x92bbb8){return function(_0x181d72){if(_0x181d72){var _0xb23081=typeof _0x92bbb8[_0x6951('0x1a')]===_0x6951('0x1b')&&typeof _0x92bbb8[_0x6951('0x1c')]===_0x6951('0x1b');var _0x4f1591=_0x181d72[_0x6951('0x1d')];var _0x2e6977=_0xb23081?0x0:_0x92bbb8[_0x6951('0x1a')];var _0x40900b=_0xb23081?_0x181d72[_0x6951('0x1d')]:_0x92bbb8[_0x6951('0x1a')]+_0x92bbb8['limit'];var _0x301199;if(_0x40900b>=_0x4f1591){_0x40900b=_0x4f1591;_0x301199=0xc8;}else{_0x301199=0xce;}_0x2e9bd1[_0x6951('0x18')](_0x301199);return _0x2e9bd1[_0x6951('0x1e')](_0x6951('0x1f'),_0x2e6977+'-'+_0x40900b+'/'+_0x4f1591)[_0x6951('0x19')](_0x181d72);}return null;};}function patchUpdates(_0x2c819f){return function(_0x125468){try{jsonpatch[_0x6951('0x20')](_0x125468,_0x2c819f,!![]);}catch(_0x74aa6b){return BPromise[_0x6951('0x21')](_0x74aa6b);}return _0x125468[_0x6951('0x22')]();};}function saveUpdates(_0xb1f0e5,_0x519b09){return function(_0x34219f){if(_0x34219f){return _0x34219f[_0x6951('0x23')](_0xb1f0e5)[_0x6951('0x24')](function(_0xc09d4f){return _0xc09d4f;});}return null;};}function removeEntity(_0x1716ef,_0x573aa4){return function(_0x18c576){if(_0x18c576){return _0x18c576[_0x6951('0x25')]()[_0x6951('0x24')](function(){var _0x6a885a=_0x18c576[_0x6951('0x26')]({'plain':!![]});var _0x457415=_0x6951('0x27');return db[_0x6951('0x28')][_0x6951('0x25')]({'where':{'type':_0x457415,'resourceId':_0x6a885a['id']}})[_0x6951('0x24')](function(){return _0x18c576;});})[_0x6951('0x24')](function(){_0x1716ef[_0x6951('0x18')](0xcc)[_0x6951('0x17')]();});}};}function handleEntityNotFound(_0x493052,_0x2ba698){return function(_0x198f51){if(!_0x198f51){_0x493052[_0x6951('0x29')](0x194);}return _0x198f51;};}function handleError(_0xf5e640,_0x2884f3){_0x2884f3=_0x2884f3||0x1f4;return function(_0x5bcd38){logger[_0x6951('0x2a')](_0x5bcd38['stack']);if(_0x5bcd38[_0x6951('0x2b')]){delete _0x5bcd38[_0x6951('0x2b')];}_0xf5e640[_0x6951('0x18')](_0x2884f3)[_0x6951('0x2c')](_0x5bcd38);};}exports[_0x6951('0x2d')]=function(_0x3dc022,_0x49d16f){var _0x6df540={},_0xd78307={},_0x521687={'count':0x0,'rows':[]};var _0x5ee63b=_[_0x6951('0x2e')](db[_0x6951('0x2f')][_0x6951('0x30')],function(_0x3a9d3e){return{'name':_0x3a9d3e['fieldName'],'type':_0x3a9d3e['type']['key']};});_0xd78307['model']=_['map'](_0x5ee63b,_0x6951('0x2b'));_0xd78307['query']=_['keys'](_0x3dc022[_0x6951('0x31')]);_0xd78307[_0x6951('0x32')]=_[_0x6951('0x33')](_0xd78307[_0x6951('0x34')],_0xd78307[_0x6951('0x31')]);_0x6df540[_0x6951('0x35')]=_[_0x6951('0x33')](_0xd78307[_0x6951('0x34')],qs['fields'](_0x3dc022['query']['fields']));_0x6df540[_0x6951('0x35')]=_0x6df540[_0x6951('0x35')][_0x6951('0x36')]?_0x6df540[_0x6951('0x35')]:_0xd78307['model'];if(!_0x3dc022[_0x6951('0x31')]['hasOwnProperty'](_0x6951('0x37'))){_0x6df540[_0x6951('0x1c')]=qs['limit'](_0x3dc022[_0x6951('0x31')]['limit']);_0x6df540[_0x6951('0x1a')]=qs[_0x6951('0x1a')](_0x3dc022[_0x6951('0x31')][_0x6951('0x1a')]);}_0x6df540['order']=qs['sort'](_0x3dc022['query'][_0x6951('0x38')]);_0x6df540[_0x6951('0x39')]=qs[_0x6951('0x32')](_[_0x6951('0x3a')](_0x3dc022['query'],_0xd78307[_0x6951('0x32')]),_0x5ee63b);if(_0x3dc022[_0x6951('0x31')][_0x6951('0x3b')]){_0x6df540['where']=_['merge'](_0x6df540[_0x6951('0x39')],{'$or':_['map'](_0x5ee63b,function(_0x510dd8){if(_0x510dd8[_0x6951('0x3c')]!=='VIRTUAL'){var _0x5e2938={};_0x5e2938[_0x510dd8[_0x6951('0x2b')]]={'$like':'%'+_0x3dc022['query'][_0x6951('0x3b')]+'%'};return _0x5e2938;}})});}_0x6df540=_[_0x6951('0x3d')]({},_0x6df540,_0x3dc022[_0x6951('0x3e')]);var _0x5696f2={'where':_0x6df540['where']};return db[_0x6951('0x2f')][_0x6951('0x1d')](_0x5696f2)['then'](function(_0x194921){_0x521687['count']=_0x194921;if(_0x3dc022[_0x6951('0x31')][_0x6951('0x3f')]){_0x6df540[_0x6951('0x40')]=[{'all':!![]}];}return db[_0x6951('0x2f')][_0x6951('0x41')](_0x6df540);})[_0x6951('0x24')](function(_0x30dae8){_0x521687['rows']=_0x30dae8;return _0x521687;})[_0x6951('0x24')](respondWithFilteredResult(_0x49d16f,_0x6df540))['catch'](handleError(_0x49d16f,null));};exports[_0x6951('0x42')]=function(_0x112dbe,_0x583b23){var _0x25e244={'raw':!![],'where':{'id':_0x112dbe[_0x6951('0x43')]['id']}},_0x5a9b39={};_0x5a9b39['model']=_['keys'](db[_0x6951('0x2f')][_0x6951('0x30')]);_0x5a9b39[_0x6951('0x31')]=_[_0x6951('0x44')](_0x112dbe[_0x6951('0x31')]);_0x5a9b39['filters']=_[_0x6951('0x33')](_0x5a9b39[_0x6951('0x34')],_0x5a9b39[_0x6951('0x31')]);_0x25e244['attributes']=_[_0x6951('0x33')](_0x5a9b39[_0x6951('0x34')],qs[_0x6951('0x45')](_0x112dbe[_0x6951('0x31')]['fields']));_0x25e244[_0x6951('0x35')]=_0x25e244[_0x6951('0x35')][_0x6951('0x36')]?_0x25e244[_0x6951('0x35')]:_0x5a9b39[_0x6951('0x34')];if(_0x112dbe[_0x6951('0x31')]['includeAll']){_0x25e244[_0x6951('0x40')]=[{'all':!![]}];}_0x25e244=_[_0x6951('0x3d')]({},_0x25e244,_0x112dbe[_0x6951('0x3e')]);return db[_0x6951('0x2f')][_0x6951('0x46')](_0x25e244)[_0x6951('0x24')](handleEntityNotFound(_0x583b23,null))[_0x6951('0x24')](respondWithResult(_0x583b23,null))['catch'](handleError(_0x583b23,null));};exports['create']=function(_0x2f858d,_0x326f41){return db[_0x6951('0x2f')][_0x6951('0x47')](_0x2f858d['body'],{})[_0x6951('0x24')](function(_0x595b69){var _0x2a8c1c=_0x2f858d[_0x6951('0x48')][_0x6951('0x26')]({'plain':!![]});if(!_0x2a8c1c)throw new Error(_0x6951('0x49'));if(_0x2a8c1c[_0x6951('0x4a')]==='user'){var _0x3124ac=_0x595b69[_0x6951('0x26')]({'plain':!![]});var _0x5073ac=_0x6951('0x27');return db[_0x6951('0x4b')]['find']({'where':{'name':_0x5073ac,'userProfileId':_0x2a8c1c[_0x6951('0x4c')]},'raw':!![]})[_0x6951('0x24')](function(_0x5936c2){if(_0x5936c2&&_0x5936c2[_0x6951('0x4d')]===0x0){return db[_0x6951('0x28')][_0x6951('0x47')]({'name':_0x3124ac[_0x6951('0x2b')],'resourceId':_0x3124ac['id'],'type':_0x5936c2[_0x6951('0x2b')],'sectionId':_0x5936c2['id']},{})[_0x6951('0x24')](function(){return _0x595b69;});}else{return _0x595b69;}})[_0x6951('0x4e')](function(_0x1011c9){logger[_0x6951('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1011c9);throw _0x1011c9;});}return _0x595b69;})['then'](respondWithResult(_0x326f41,0xc9))[_0x6951('0x4e')](handleError(_0x326f41,null));};exports['update']=function(_0x1a1ab1,_0x442296){if(_0x1a1ab1[_0x6951('0x4f')]['id']){delete _0x1a1ab1[_0x6951('0x4f')]['id'];}return db[_0x6951('0x2f')][_0x6951('0x46')]({'where':{'id':_0x1a1ab1[_0x6951('0x43')]['id']}})[_0x6951('0x24')](handleEntityNotFound(_0x442296,null))[_0x6951('0x24')](saveUpdates(_0x1a1ab1[_0x6951('0x4f')],null))['then'](respondWithResult(_0x442296,null))['catch'](handleError(_0x442296,null));};exports[_0x6951('0x25')]=function(_0x5f0d39,_0x1578dd){return db[_0x6951('0x2f')]['find']({'where':{'id':_0x5f0d39['params']['id']}})[_0x6951('0x24')](handleEntityNotFound(_0x1578dd,null))[_0x6951('0x24')](removeEntity(_0x1578dd,null))[_0x6951('0x4e')](handleError(_0x1578dd,null));}; \ No newline at end of file +var _0xb460=['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','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','get','Templates','UserProfileResource','destroy','then','stack','name','send','index','map','Template','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create'];(function(_0x3565ae,_0x42ce0e){var _0x1f6ef9=function(_0x27ffd8){while(--_0x27ffd8){_0x3565ae['push'](_0x3565ae['shift']());}};_0x1f6ef9(++_0x42ce0e);}(_0xb460,0x100));var _0x0b46=function(_0x5dee7f,_0x1451af){_0x5dee7f=_0x5dee7f-0x0;var _0x2699fa=_0xb460[_0x5dee7f];return _0x2699fa;};'use strict';var emlformat=require(_0x0b46('0x0'));var rimraf=require(_0x0b46('0x1'));var zipdir=require(_0x0b46('0x2'));var jsonpatch=require(_0x0b46('0x3'));var rp=require('request-promise');var moment=require(_0x0b46('0x4'));var BPromise=require(_0x0b46('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0b46('0x6'));var sox=require(_0x0b46('0x7'));var csv=require(_0x0b46('0x8'));var ejs=require(_0x0b46('0x9'));var fs=require('fs');var fs_extra=require(_0x0b46('0xa'));var _=require(_0x0b46('0xb'));var squel=require(_0x0b46('0xc'));var crypto=require('crypto');var jsforce=require(_0x0b46('0xd'));var deskjs=require(_0x0b46('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0b46('0xf'));var Papa=require(_0x0b46('0x10'));var Redis=require('ioredis');var authService=require(_0x0b46('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0b46('0x12'));var hardwareService=require(_0x0b46('0x13'));var logger=require(_0x0b46('0x14'))(_0x0b46('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0b46('0x16'))['db'];function respondWithStatusCode(_0xf4d219,_0x3470c7){_0x3470c7=_0x3470c7||0xcc;return function(_0x22a8a8){if(_0x22a8a8){return _0xf4d219[_0x0b46('0x17')](_0x3470c7);}return _0xf4d219[_0x0b46('0x18')](_0x3470c7)[_0x0b46('0x19')]();};}function respondWithResult(_0x310a75,_0x81820a){_0x81820a=_0x81820a||0xc8;return function(_0xea587a){if(_0xea587a){return _0x310a75[_0x0b46('0x18')](_0x81820a)[_0x0b46('0x1a')](_0xea587a);}};}function respondWithFilteredResult(_0x14a482,_0x599578){return function(_0x36a226){if(_0x36a226){var _0x1911e3=typeof _0x599578['offset']===_0x0b46('0x1b')&&typeof _0x599578[_0x0b46('0x1c')]===_0x0b46('0x1b');var _0x41f195=_0x36a226[_0x0b46('0x1d')];var _0xe3792=_0x1911e3?0x0:_0x599578[_0x0b46('0x1e')];var _0x17fc0b=_0x1911e3?_0x36a226[_0x0b46('0x1d')]:_0x599578['offset']+_0x599578[_0x0b46('0x1c')];var _0x4ec3e4;if(_0x17fc0b>=_0x41f195){_0x17fc0b=_0x41f195;_0x4ec3e4=0xc8;}else{_0x4ec3e4=0xce;}_0x14a482[_0x0b46('0x18')](_0x4ec3e4);return _0x14a482[_0x0b46('0x1f')](_0x0b46('0x20'),_0xe3792+'-'+_0x17fc0b+'/'+_0x41f195)[_0x0b46('0x1a')](_0x36a226);}return null;};}function patchUpdates(_0x5ef155){return function(_0x18b979){try{jsonpatch[_0x0b46('0x21')](_0x18b979,_0x5ef155,!![]);}catch(_0x449116){return BPromise[_0x0b46('0x22')](_0x449116);}return _0x18b979['save']();};}function saveUpdates(_0x45bde3,_0x78ee7b){return function(_0x3a449e){if(_0x3a449e){return _0x3a449e['update'](_0x45bde3)['then'](function(_0x2c7f6e){return _0x2c7f6e;});}return null;};}function removeEntity(_0x57dfa5,_0x58b24c){return function(_0x235696){if(_0x235696){return _0x235696['destroy']()['then'](function(){var _0x2944ad=_0x235696[_0x0b46('0x23')]({'plain':!![]});var _0x49057e=_0x0b46('0x24');return db[_0x0b46('0x25')][_0x0b46('0x26')]({'where':{'type':_0x49057e,'resourceId':_0x2944ad['id']}})[_0x0b46('0x27')](function(){return _0x235696;});})[_0x0b46('0x27')](function(){_0x57dfa5[_0x0b46('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x382911,_0x414af8){return function(_0x221a39){if(!_0x221a39){_0x382911[_0x0b46('0x17')](0x194);}return _0x221a39;};}function handleError(_0x457968,_0x2d6d74){_0x2d6d74=_0x2d6d74||0x1f4;return function(_0x56abd9){logger['error'](_0x56abd9[_0x0b46('0x28')]);if(_0x56abd9[_0x0b46('0x29')]){delete _0x56abd9[_0x0b46('0x29')];}_0x457968[_0x0b46('0x18')](_0x2d6d74)[_0x0b46('0x2a')](_0x56abd9);};}exports[_0x0b46('0x2b')]=function(_0x49b536,_0x19566e){var _0x5b50f6={},_0xf44c94={},_0x4df1f5={'count':0x0,'rows':[]};var _0x5db314=_[_0x0b46('0x2c')](db[_0x0b46('0x2d')]['rawAttributes'],function(_0x4e4eb3){return{'name':_0x4e4eb3[_0x0b46('0x2e')],'type':_0x4e4eb3[_0x0b46('0x2f')]['key']};});_0xf44c94['model']=_[_0x0b46('0x2c')](_0x5db314,_0x0b46('0x29'));_0xf44c94[_0x0b46('0x30')]=_[_0x0b46('0x31')](_0x49b536[_0x0b46('0x30')]);_0xf44c94['filters']=_[_0x0b46('0x32')](_0xf44c94[_0x0b46('0x33')],_0xf44c94[_0x0b46('0x30')]);_0x5b50f6[_0x0b46('0x34')]=_[_0x0b46('0x32')](_0xf44c94['model'],qs[_0x0b46('0x35')](_0x49b536[_0x0b46('0x30')][_0x0b46('0x35')]));_0x5b50f6[_0x0b46('0x34')]=_0x5b50f6[_0x0b46('0x34')]['length']?_0x5b50f6['attributes']:_0xf44c94['model'];if(!_0x49b536[_0x0b46('0x30')][_0x0b46('0x36')]('nolimit')){_0x5b50f6[_0x0b46('0x1c')]=qs[_0x0b46('0x1c')](_0x49b536['query'][_0x0b46('0x1c')]);_0x5b50f6[_0x0b46('0x1e')]=qs['offset'](_0x49b536['query'][_0x0b46('0x1e')]);}_0x5b50f6[_0x0b46('0x37')]=qs[_0x0b46('0x38')](_0x49b536[_0x0b46('0x30')][_0x0b46('0x38')]);_0x5b50f6[_0x0b46('0x39')]=qs[_0x0b46('0x3a')](_[_0x0b46('0x3b')](_0x49b536[_0x0b46('0x30')],_0xf44c94[_0x0b46('0x3a')]),_0x5db314);if(_0x49b536[_0x0b46('0x30')][_0x0b46('0x3c')]){_0x5b50f6[_0x0b46('0x39')]=_[_0x0b46('0x3d')](_0x5b50f6[_0x0b46('0x39')],{'$or':_[_0x0b46('0x2c')](_0x5db314,function(_0x3639e5){if(_0x3639e5[_0x0b46('0x2f')]!=='VIRTUAL'){var _0x1eda1d={};_0x1eda1d[_0x3639e5['name']]={'$like':'%'+_0x49b536[_0x0b46('0x30')][_0x0b46('0x3c')]+'%'};return _0x1eda1d;}})});}_0x5b50f6=_[_0x0b46('0x3d')]({},_0x5b50f6,_0x49b536[_0x0b46('0x3e')]);var _0x5680aa={'where':_0x5b50f6[_0x0b46('0x39')]};return db['Template'][_0x0b46('0x1d')](_0x5680aa)[_0x0b46('0x27')](function(_0x15c9c6){_0x4df1f5[_0x0b46('0x1d')]=_0x15c9c6;if(_0x49b536[_0x0b46('0x30')][_0x0b46('0x3f')]){_0x5b50f6[_0x0b46('0x40')]=[{'all':!![]}];}return db[_0x0b46('0x2d')]['findAll'](_0x5b50f6);})['then'](function(_0x18956b){_0x4df1f5[_0x0b46('0x41')]=_0x18956b;return _0x4df1f5;})[_0x0b46('0x27')](respondWithFilteredResult(_0x19566e,_0x5b50f6))[_0x0b46('0x42')](handleError(_0x19566e,null));};exports[_0x0b46('0x43')]=function(_0x47f09f,_0x4ae8b9){var _0x344e1f={'raw':!![],'where':{'id':_0x47f09f[_0x0b46('0x44')]['id']}},_0x5445fc={};_0x5445fc[_0x0b46('0x33')]=_['keys'](db[_0x0b46('0x2d')][_0x0b46('0x45')]);_0x5445fc['query']=_[_0x0b46('0x31')](_0x47f09f[_0x0b46('0x30')]);_0x5445fc[_0x0b46('0x3a')]=_[_0x0b46('0x32')](_0x5445fc[_0x0b46('0x33')],_0x5445fc['query']);_0x344e1f[_0x0b46('0x34')]=_[_0x0b46('0x32')](_0x5445fc[_0x0b46('0x33')],qs[_0x0b46('0x35')](_0x47f09f[_0x0b46('0x30')][_0x0b46('0x35')]));_0x344e1f[_0x0b46('0x34')]=_0x344e1f[_0x0b46('0x34')]['length']?_0x344e1f[_0x0b46('0x34')]:_0x5445fc['model'];if(_0x47f09f[_0x0b46('0x30')][_0x0b46('0x3f')]){_0x344e1f['include']=[{'all':!![]}];}_0x344e1f=_['merge']({},_0x344e1f,_0x47f09f[_0x0b46('0x3e')]);return db['Template'][_0x0b46('0x46')](_0x344e1f)[_0x0b46('0x27')](handleEntityNotFound(_0x4ae8b9,null))[_0x0b46('0x27')](respondWithResult(_0x4ae8b9,null))[_0x0b46('0x42')](handleError(_0x4ae8b9,null));};exports[_0x0b46('0x47')]=function(_0x5d8b09,_0x1d9a58){return db['Template'][_0x0b46('0x47')](_0x5d8b09[_0x0b46('0x48')],{})[_0x0b46('0x27')](function(_0x52c14a){var _0x1a9d38=_0x5d8b09[_0x0b46('0x49')]['get']({'plain':!![]});if(!_0x1a9d38)throw new Error(_0x0b46('0x4a'));if(_0x1a9d38[_0x0b46('0x4b')]===_0x0b46('0x49')){var _0xc43138=_0x52c14a[_0x0b46('0x23')]({'plain':!![]});var _0x107e66=_0x0b46('0x24');return db[_0x0b46('0x4c')][_0x0b46('0x46')]({'where':{'name':_0x107e66,'userProfileId':_0x1a9d38[_0x0b46('0x4d')]},'raw':!![]})[_0x0b46('0x27')](function(_0x3ba8e6){if(_0x3ba8e6&&_0x3ba8e6[_0x0b46('0x4e')]===0x0){return db[_0x0b46('0x25')][_0x0b46('0x47')]({'name':_0xc43138[_0x0b46('0x29')],'resourceId':_0xc43138['id'],'type':_0x3ba8e6['name'],'sectionId':_0x3ba8e6['id']},{})[_0x0b46('0x27')](function(){return _0x52c14a;});}else{return _0x52c14a;}})[_0x0b46('0x42')](function(_0x30a8a2){logger[_0x0b46('0x4f')](_0x0b46('0x50'),_0x30a8a2);throw _0x30a8a2;});}return _0x52c14a;})['then'](respondWithResult(_0x1d9a58,0xc9))['catch'](handleError(_0x1d9a58,null));};exports[_0x0b46('0x51')]=function(_0x1259ea,_0x352cf1){if(_0x1259ea[_0x0b46('0x48')]['id']){delete _0x1259ea[_0x0b46('0x48')]['id'];}return db[_0x0b46('0x2d')]['find']({'where':{'id':_0x1259ea[_0x0b46('0x44')]['id']}})[_0x0b46('0x27')](handleEntityNotFound(_0x352cf1,null))[_0x0b46('0x27')](saveUpdates(_0x1259ea[_0x0b46('0x48')],null))[_0x0b46('0x27')](respondWithResult(_0x352cf1,null))['catch'](handleError(_0x352cf1,null));};exports['destroy']=function(_0x2fc10b,_0x5e772d){return db[_0x0b46('0x2d')][_0x0b46('0x46')]({'where':{'id':_0x2fc10b[_0x0b46('0x44')]['id']}})[_0x0b46('0x27')](handleEntityNotFound(_0x5e772d,null))[_0x0b46('0x27')](removeEntity(_0x5e772d,null))[_0x0b46('0x42')](handleError(_0x5e772d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d90f4d6..d42d06f 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 _0x9be5=['bluebird','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x53452e,_0x27e4c0){var _0x134c6f=function(_0x36efa0){while(--_0x36efa0){_0x53452e['push'](_0x53452e['shift']());}};_0x134c6f(++_0x27e4c0);}(_0x9be5,0xc9));var _0x59be=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x9be5[_0x934425];return _0x31d596;};'use strict';var _=require(_0x59be('0x0'));var util=require(_0x59be('0x1'));var logger=require(_0x59be('0x2'))('api');var moment=require('moment');var BPromise=require(_0x59be('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x59be('0x4'));var rimraf=require(_0x59be('0x5'));var config=require(_0x59be('0x6'));var attributes=require(_0x59be('0x7'));module[_0x59be('0x8')]=function(_0x426c5b,_0x8bb591){return _0x426c5b[_0x59be('0x9')](_0x59be('0xa'),attributes,{'tableName':_0x59be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92f9=['request-promise','path','rimraf','../../config/environment','./template.attributes','define','tools_templates','util','api'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x92f9,0x6a));var _0x992f=function(_0x3ad5e8,_0x49cd96){_0x3ad5e8=_0x3ad5e8-0x0;var _0xdd51a4=_0x92f9[_0x3ad5e8];return _0xdd51a4;};'use strict';var _=require('lodash');var util=require(_0x992f('0x0'));var logger=require('../../config/logger')(_0x992f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x992f('0x2'));var fs=require('fs');var path=require(_0x992f('0x3'));var rimraf=require(_0x992f('0x4'));var config=require(_0x992f('0x5'));var attributes=require(_0x992f('0x6'));module['exports']=function(_0x5c251a,_0x367930){return _0x5c251a[_0x992f('0x7')]('Template',attributes,{'tableName':_0x992f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 7480ab2..bba22c8 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 _0x98dd=['http','request','then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetTemplate','Template','findAll','options','raw','where','limit','include','map','model','attributes','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3cf0e7,_0x12cc50){var _0x15369a=function(_0x594c98){while(--_0x594c98){_0x3cf0e7['push'](_0x3cf0e7['shift']());}};_0x15369a(++_0x12cc50);}(_0x98dd,0xdd));var _0xd98d=function(_0x4615cc,_0x2f89d2){_0x4615cc=_0x4615cc-0x0;var _0x221da0=_0x98dd[_0x4615cc];return _0x221da0;};'use strict';var _=require(_0xd98d('0x0'));var util=require(_0xd98d('0x1'));var moment=require(_0xd98d('0x2'));var BPromise=require(_0xd98d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd98d('0x4'))['db'];var utils=require(_0xd98d('0x5'));var logger=require(_0xd98d('0x6'))(_0xd98d('0x7'));var config=require('../../config/environment');var jayson=require(_0xd98d('0x8'));var client=jayson[_0xd98d('0x9')][_0xd98d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5304b7,_0x191326,_0x39bf77){return new BPromise(function(_0x15866b,_0x873a35){return client[_0xd98d('0xb')](_0x5304b7,_0x39bf77)[_0xd98d('0xc')](function(_0x3be229){logger['info'](_0xd98d('0xd'),_0x191326,_0xd98d('0xe'));logger['debug'](_0xd98d('0xf'),_0x191326,_0xd98d('0xe'),JSON[_0xd98d('0x10')](_0x3be229));if(_0x3be229[_0xd98d('0x11')]){if(_0x3be229[_0xd98d('0x11')]['code']===0x1f4){logger[_0xd98d('0x11')]('Template,\x20%s,\x20%s',_0x191326,_0x3be229['error'][_0xd98d('0x12')]);return _0x873a35(_0x3be229[_0xd98d('0x11')][_0xd98d('0x12')]);}logger[_0xd98d('0x11')](_0xd98d('0xd'),_0x191326,_0x3be229[_0xd98d('0x11')][_0xd98d('0x12')]);return _0x15866b(_0x3be229[_0xd98d('0x11')][_0xd98d('0x12')]);}else{logger[_0xd98d('0x13')](_0xd98d('0xd'),_0x191326,_0xd98d('0xe'));_0x15866b(_0x3be229['result']['message']);}})[_0xd98d('0x14')](function(_0x49965c){logger[_0xd98d('0x11')](_0xd98d('0xd'),_0x191326,_0x49965c);_0x873a35(_0x49965c);});});}exports[_0xd98d('0x15')]=function(_0x1a5979){var _0x36a483=this;return new Promise(function(_0xde1cb,_0x43d953){return db[_0xd98d('0x16')][_0xd98d('0x17')]({'raw':_0x1a5979[_0xd98d('0x18')]?_0x1a5979[_0xd98d('0x18')][_0xd98d('0x19')]===undefined?!![]:![]:!![],'where':_0x1a5979[_0xd98d('0x18')]?_0x1a5979[_0xd98d('0x18')][_0xd98d('0x1a')]||null:null,'attributes':_0x1a5979[_0xd98d('0x18')]?_0x1a5979[_0xd98d('0x18')]['attributes']||null:null,'limit':_0x1a5979['options']?_0x1a5979[_0xd98d('0x18')][_0xd98d('0x1b')]||null:null,'include':_0x1a5979[_0xd98d('0x18')]?_0x1a5979[_0xd98d('0x18')][_0xd98d('0x1c')]?_[_0xd98d('0x1d')](_0x1a5979[_0xd98d('0x18')][_0xd98d('0x1c')],function(_0x1dccbc){return{'model':db[_0x1dccbc[_0xd98d('0x1e')]],'as':_0x1dccbc['as'],'attributes':_0x1dccbc[_0xd98d('0x1f')],'include':_0x1dccbc['include']?_['map'](_0x1dccbc[_0xd98d('0x1c')],function(_0x57ce55){return{'model':db[_0x57ce55[_0xd98d('0x1e')]],'as':_0x57ce55['as'],'attributes':_0x57ce55['attributes'],'include':_0x57ce55[_0xd98d('0x1c')]?_[_0xd98d('0x1d')](_0x57ce55[_0xd98d('0x1c')],function(_0x22bea6){return{'model':db[_0x22bea6['model']],'as':_0x22bea6['as'],'attributes':_0x22bea6[_0xd98d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd98d('0xc')](function(_0x446277){logger[_0xd98d('0x13')](_0xd98d('0x15'),_0x1a5979);logger[_0xd98d('0x20')](_0xd98d('0x15'),_0x1a5979,JSON[_0xd98d('0x10')](_0x446277));_0xde1cb(_0x446277);})['catch'](function(_0x82f235){logger[_0xd98d('0x11')](_0xd98d('0x15'),_0x82f235[_0xd98d('0x12')],_0x1a5979);_0x43d953(_0x36a483['error'](0x1f4,_0x82f235['message']));});});}; \ No newline at end of file +var _0xd328=['map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetTemplate','Template','findAll','options','raw','where','limit','include'];(function(_0x1a08ad,_0x21d209){var _0x521649=function(_0x1794e7){while(--_0x1794e7){_0x1a08ad['push'](_0x1a08ad['shift']());}};_0x521649(++_0x21d209);}(_0xd328,0x1e0));var _0x8d32=function(_0x208a85,_0x454bfa){_0x208a85=_0x208a85-0x0;var _0x2c7e6b=_0xd328[_0x208a85];return _0x2c7e6b;};'use strict';var _=require(_0x8d32('0x0'));var util=require(_0x8d32('0x1'));var moment=require(_0x8d32('0x2'));var BPromise=require(_0x8d32('0x3'));var rs=require(_0x8d32('0x4'));var fs=require('fs');var Redis=require(_0x8d32('0x5'));var db=require(_0x8d32('0x6'))['db'];var utils=require(_0x8d32('0x7'));var logger=require(_0x8d32('0x8'))('rpc');var config=require(_0x8d32('0x9'));var jayson=require(_0x8d32('0xa'));var client=jayson['client'][_0x8d32('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b694e,_0x321428,_0x3d0dcb){return new BPromise(function(_0x27aca6,_0x21a44e){return client[_0x8d32('0xc')](_0x1b694e,_0x3d0dcb)['then'](function(_0x525795){logger[_0x8d32('0xd')](_0x8d32('0xe'),_0x321428,_0x8d32('0xf'));logger[_0x8d32('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x321428,_0x8d32('0xf'),JSON[_0x8d32('0x11')](_0x525795));if(_0x525795[_0x8d32('0x12')]){if(_0x525795[_0x8d32('0x12')][_0x8d32('0x13')]===0x1f4){logger[_0x8d32('0x12')](_0x8d32('0xe'),_0x321428,_0x525795['error']['message']);return _0x21a44e(_0x525795[_0x8d32('0x12')][_0x8d32('0x14')]);}logger[_0x8d32('0x12')](_0x8d32('0xe'),_0x321428,_0x525795[_0x8d32('0x12')][_0x8d32('0x14')]);return _0x27aca6(_0x525795[_0x8d32('0x12')]['message']);}else{logger[_0x8d32('0xd')]('Template,\x20%s,\x20%s',_0x321428,_0x8d32('0xf'));_0x27aca6(_0x525795[_0x8d32('0x15')][_0x8d32('0x14')]);}})['catch'](function(_0x3311e4){logger[_0x8d32('0x12')]('Template,\x20%s,\x20%s',_0x321428,_0x3311e4);_0x21a44e(_0x3311e4);});});}exports[_0x8d32('0x16')]=function(_0x1e1a80){var _0x23416a=this;return new Promise(function(_0xa18594,_0x308d4f){return db[_0x8d32('0x17')][_0x8d32('0x18')]({'raw':_0x1e1a80[_0x8d32('0x19')]?_0x1e1a80[_0x8d32('0x19')][_0x8d32('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e1a80[_0x8d32('0x19')]?_0x1e1a80[_0x8d32('0x19')][_0x8d32('0x1b')]||null:null,'attributes':_0x1e1a80['options']?_0x1e1a80['options']['attributes']||null:null,'limit':_0x1e1a80[_0x8d32('0x19')]?_0x1e1a80[_0x8d32('0x19')][_0x8d32('0x1c')]||null:null,'include':_0x1e1a80[_0x8d32('0x19')]?_0x1e1a80[_0x8d32('0x19')][_0x8d32('0x1d')]?_[_0x8d32('0x1e')](_0x1e1a80[_0x8d32('0x19')][_0x8d32('0x1d')],function(_0x46ae60){return{'model':db[_0x46ae60[_0x8d32('0x1f')]],'as':_0x46ae60['as'],'attributes':_0x46ae60[_0x8d32('0x20')],'include':_0x46ae60[_0x8d32('0x1d')]?_[_0x8d32('0x1e')](_0x46ae60[_0x8d32('0x1d')],function(_0x17980d){return{'model':db[_0x17980d['model']],'as':_0x17980d['as'],'attributes':_0x17980d['attributes'],'include':_0x17980d[_0x8d32('0x1d')]?_['map'](_0x17980d[_0x8d32('0x1d')],function(_0x4d7ad7){return{'model':db[_0x4d7ad7[_0x8d32('0x1f')]],'as':_0x4d7ad7['as'],'attributes':_0x4d7ad7[_0x8d32('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1053dc){logger[_0x8d32('0xd')](_0x8d32('0x16'),_0x1e1a80);logger['debug'](_0x8d32('0x16'),_0x1e1a80,JSON['stringify'](_0x1053dc));_0xa18594(_0x1053dc);})[_0x8d32('0x21')](function(_0x1c44a1){logger[_0x8d32('0x12')](_0x8d32('0x16'),_0x1c44a1['message'],_0x1e1a80);_0x308d4f(_0x23416a[_0x8d32('0x12')](0x1f4,_0x1c44a1[_0x8d32('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 603b699..bfeea7d 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 _0xdd2e=['isAuthenticated','index','get','/:id','show','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','/:id/all_conditions','addAnyCondition','addAction','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdd2e,0x13d));var _0xedd2=function(_0x574559,_0x567875){_0x574559=_0x574559-0x0;var _0x5211e8=_0xdd2e[_0x574559];return _0x5211e8;};'use strict';var multer=require(_0xedd2('0x0'));var util=require(_0xedd2('0x1'));var path=require('path');var timeout=require(_0xedd2('0x2'));var express=require(_0xedd2('0x3'));var router=express['Router']();var fs_extra=require(_0xedd2('0x4'));var auth=require(_0xedd2('0x5'));var interaction=require(_0xedd2('0x6'));var config=require(_0xedd2('0x7'));var controller=require('./trigger.controller');router['get']('/',auth[_0xedd2('0x8')](),controller[_0xedd2('0x9')]);router[_0xedd2('0xa')](_0xedd2('0xb'),auth[_0xedd2('0x8')](),controller[_0xedd2('0xc')]);router[_0xedd2('0xa')]('/:id/all_conditions',auth[_0xedd2('0x8')](),controller['getAllConditions']);router[_0xedd2('0xa')](_0xedd2('0xd'),auth[_0xedd2('0x8')](),controller[_0xedd2('0xe')]);router[_0xedd2('0xa')](_0xedd2('0xf'),auth[_0xedd2('0x8')](),controller['getActions']);router['post']('/',auth[_0xedd2('0x8')](),controller[_0xedd2('0x10')]);router[_0xedd2('0x11')](_0xedd2('0x12'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0xedd2('0x11')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xedd2('0x13')]);router['post'](_0xedd2('0xf'),auth['isAuthenticated'](),controller[_0xedd2('0x14')]);router['put'](_0xedd2('0xb'),auth[_0xedd2('0x8')](),controller[_0xedd2('0x15')]);router[_0xedd2('0x16')](_0xedd2('0xb'),auth[_0xedd2('0x8')](),controller[_0xedd2('0x17')]);module[_0xedd2('0x18')]=router; \ No newline at end of file +var _0x5346=['util','path','connect-timeout','express','Router','../../config/environment','./trigger.controller','get','isAuthenticated','index','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','/:id','destroy','multer'];(function(_0x386796,_0x265a97){var _0x5aa7dc=function(_0x26a161){while(--_0x26a161){_0x386796['push'](_0x386796['shift']());}};_0x5aa7dc(++_0x265a97);}(_0x5346,0x112));var _0x6534=function(_0x4aa60e,_0x3ea702){_0x4aa60e=_0x4aa60e-0x0;var _0x12d5f6=_0x5346[_0x4aa60e];return _0x12d5f6;};'use strict';var multer=require(_0x6534('0x0'));var util=require(_0x6534('0x1'));var path=require(_0x6534('0x2'));var timeout=require(_0x6534('0x3'));var express=require(_0x6534('0x4'));var router=express[_0x6534('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6534('0x6'));var controller=require(_0x6534('0x7'));router[_0x6534('0x8')]('/',auth[_0x6534('0x9')](),controller[_0x6534('0xa')]);router[_0x6534('0x8')]('/:id',auth[_0x6534('0x9')](),controller['show']);router[_0x6534('0x8')]('/:id/all_conditions',auth[_0x6534('0x9')](),controller[_0x6534('0xb')]);router[_0x6534('0x8')](_0x6534('0xc'),auth[_0x6534('0x9')](),controller[_0x6534('0xd')]);router[_0x6534('0x8')](_0x6534('0xe'),auth[_0x6534('0x9')](),controller[_0x6534('0xf')]);router[_0x6534('0x10')]('/',auth[_0x6534('0x9')](),controller[_0x6534('0x11')]);router[_0x6534('0x10')](_0x6534('0x12'),auth[_0x6534('0x9')](),controller[_0x6534('0x13')]);router[_0x6534('0x10')](_0x6534('0xc'),auth['isAuthenticated'](),controller[_0x6534('0x14')]);router[_0x6534('0x10')](_0x6534('0xe'),auth[_0x6534('0x9')](),controller[_0x6534('0x15')]);router[_0x6534('0x16')](_0x6534('0x17'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6534('0x17'),auth[_0x6534('0x9')](),controller[_0x6534('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 5019138..86ae7fb 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 _0x4e13=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1bdd6e,_0x4002ed){var _0x2ac422=function(_0x14b037){while(--_0x14b037){_0x1bdd6e['push'](_0x1bdd6e['shift']());}};_0x2ac422(++_0x4002ed);}(_0x4e13,0xdf));var _0x34e1=function(_0x485201,_0x3c533a){_0x485201=_0x485201-0x0;var _0x9ca98a=_0x4e13[_0x485201];return _0x9ca98a;};'use strict';var Sequelize=require(_0x34e1('0x0'));module[_0x34e1('0x1')]={'name':{'type':Sequelize[_0x34e1('0x2')]},'channel':{'type':Sequelize[_0x34e1('0x2')]},'description':{'type':Sequelize[_0x34e1('0x2')]},'status':{'type':Sequelize[_0x34e1('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x554a=['STRING','BOOLEAN','exports'];(function(_0x15a6c0,_0x3b17a2){var _0x14eea3=function(_0x50949a){while(--_0x50949a){_0x15a6c0['push'](_0x15a6c0['shift']());}};_0x14eea3(++_0x3b17a2);}(_0x554a,0x167));var _0xa554=function(_0x370e46,_0xaff1ba){_0x370e46=_0x370e46-0x0;var _0x1b522d=_0x554a[_0x370e46];return _0x1b522d;};'use strict';var Sequelize=require('sequelize');module[_0xa554('0x0')]={'name':{'type':Sequelize[_0xa554('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa554('0x1')]},'status':{'type':Sequelize[_0xa554('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 041f7e3..0e0cada 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 _0x989e=['query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trigger','findAll','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','TriggerAnyId','getAllConditions','findOne','Condition','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','Triggers','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','intersection'];(function(_0x409d51,_0x1f0de6){var _0x13eb4b=function(_0x374388){while(--_0x374388){_0x409d51['push'](_0x409d51['shift']());}};_0x13eb4b(++_0x1f0de6);}(_0x989e,0x80));var _0xe989=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0x989e[_0x2dc7c9];return _0x3e6536;};'use strict';var emlformat=require(_0xe989('0x0'));var rimraf=require(_0xe989('0x1'));var zipdir=require(_0xe989('0x2'));var jsonpatch=require(_0xe989('0x3'));var rp=require(_0xe989('0x4'));var moment=require(_0xe989('0x5'));var BPromise=require(_0xe989('0x6'));var Mustache=require(_0xe989('0x7'));var util=require(_0xe989('0x8'));var path=require('path');var sox=require(_0xe989('0x9'));var csv=require(_0xe989('0xa'));var ejs=require(_0xe989('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe989('0xc'));var squel=require(_0xe989('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe989('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe989('0xf'));var Papa=require(_0xe989('0x10'));var Redis=require(_0xe989('0x11'));var authService=require(_0xe989('0x12'));var qs=require(_0xe989('0x13'));var as=require(_0xe989('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe989('0x15'))(_0xe989('0x16'));var utils=require(_0xe989('0x17'));var config=require(_0xe989('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe989('0x19'))['db'];function respondWithStatusCode(_0x2d18f0,_0x1dc81c){_0x1dc81c=_0x1dc81c||0xcc;return function(_0x1fc51a){if(_0x1fc51a){return _0x2d18f0['sendStatus'](_0x1dc81c);}return _0x2d18f0[_0xe989('0x1a')](_0x1dc81c)[_0xe989('0x1b')]();};}function respondWithResult(_0x2d9e19,_0x39b158){_0x39b158=_0x39b158||0xc8;return function(_0x3e60d3){if(_0x3e60d3){return _0x2d9e19['status'](_0x39b158)[_0xe989('0x1c')](_0x3e60d3);}};}function respondWithFilteredResult(_0x28966c,_0x2e5619){return function(_0x294c4d){if(_0x294c4d){var _0x1a4810=typeof _0x2e5619[_0xe989('0x1d')]==='undefined'&&typeof _0x2e5619[_0xe989('0x1e')]===_0xe989('0x1f');var _0x51c0d5=_0x294c4d[_0xe989('0x20')];var _0x4016ec=_0x1a4810?0x0:_0x2e5619[_0xe989('0x1d')];var _0x32cd4e=_0x1a4810?_0x294c4d[_0xe989('0x20')]:_0x2e5619[_0xe989('0x1d')]+_0x2e5619[_0xe989('0x1e')];var _0xe7189e;if(_0x32cd4e>=_0x51c0d5){_0x32cd4e=_0x51c0d5;_0xe7189e=0xc8;}else{_0xe7189e=0xce;}_0x28966c[_0xe989('0x1a')](_0xe7189e);return _0x28966c[_0xe989('0x21')](_0xe989('0x22'),_0x4016ec+'-'+_0x32cd4e+'/'+_0x51c0d5)[_0xe989('0x1c')](_0x294c4d);}return null;};}function patchUpdates(_0x40fb40){return function(_0x12d3cb){try{jsonpatch[_0xe989('0x23')](_0x12d3cb,_0x40fb40,!![]);}catch(_0x145ce6){return BPromise[_0xe989('0x24')](_0x145ce6);}return _0x12d3cb[_0xe989('0x25')]();};}function saveUpdates(_0x497435,_0x51ab3b){return function(_0x5595c0){if(_0x5595c0){return _0x5595c0['update'](_0x497435)[_0xe989('0x26')](function(_0x51dfe7){return _0x51dfe7;});}return null;};}function removeEntity(_0x30fc3b,_0x1bd5fc){return function(_0x2ec97d){if(_0x2ec97d){return _0x2ec97d[_0xe989('0x27')]()[_0xe989('0x26')](function(){var _0x172424=_0x2ec97d[_0xe989('0x28')]({'plain':!![]});var _0x4ff62f=_0xe989('0x29');return db['UserProfileResource'][_0xe989('0x27')]({'where':{'type':_0x4ff62f,'resourceId':_0x172424['id']}})[_0xe989('0x26')](function(){return _0x2ec97d;});})[_0xe989('0x26')](function(){_0x30fc3b[_0xe989('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0a6a,_0x52d574){return function(_0x432755){if(!_0x432755){_0x4e0a6a[_0xe989('0x2a')](0x194);}return _0x432755;};}function handleError(_0x581ca1,_0x1caca6){_0x1caca6=_0x1caca6||0x1f4;return function(_0x4dac00){logger[_0xe989('0x2b')](_0x4dac00['stack']);if(_0x4dac00[_0xe989('0x2c')]){delete _0x4dac00['name'];}_0x581ca1[_0xe989('0x1a')](_0x1caca6)[_0xe989('0x2d')](_0x4dac00);};}exports[_0xe989('0x2e')]=function(_0x2035f5,_0x27f3da){var _0x34bba7={},_0x245086={},_0xb54661={'count':0x0,'rows':[]};var _0x490c74=_[_0xe989('0x2f')](db['Trigger'][_0xe989('0x30')],function(_0x48086f){return{'name':_0x48086f[_0xe989('0x31')],'type':_0x48086f[_0xe989('0x32')]['key']};});_0x245086[_0xe989('0x33')]=_[_0xe989('0x2f')](_0x490c74,_0xe989('0x2c'));_0x245086['query']=_[_0xe989('0x34')](_0x2035f5['query']);_0x245086['filters']=_[_0xe989('0x35')](_0x245086[_0xe989('0x33')],_0x245086[_0xe989('0x36')]);_0x34bba7['attributes']=_[_0xe989('0x35')](_0x245086['model'],qs[_0xe989('0x37')](_0x2035f5[_0xe989('0x36')]['fields']));_0x34bba7[_0xe989('0x38')]=_0x34bba7[_0xe989('0x38')][_0xe989('0x39')]?_0x34bba7['attributes']:_0x245086[_0xe989('0x33')];if(!_0x2035f5[_0xe989('0x36')][_0xe989('0x3a')](_0xe989('0x3b'))){_0x34bba7[_0xe989('0x1e')]=qs['limit'](_0x2035f5[_0xe989('0x36')][_0xe989('0x1e')]);_0x34bba7[_0xe989('0x1d')]=qs[_0xe989('0x1d')](_0x2035f5['query']['offset']);}_0x34bba7[_0xe989('0x3c')]=qs[_0xe989('0x3d')](_0x2035f5[_0xe989('0x36')]['sort']);_0x34bba7[_0xe989('0x3e')]=qs[_0xe989('0x3f')](_[_0xe989('0x40')](_0x2035f5['query'],_0x245086[_0xe989('0x3f')]),_0x490c74);if(_0x2035f5[_0xe989('0x36')]['filter']){_0x34bba7[_0xe989('0x3e')]=_['merge'](_0x34bba7[_0xe989('0x3e')],{'$or':_[_0xe989('0x2f')](_0x490c74,function(_0x30626e){if(_0x30626e[_0xe989('0x32')]!=='VIRTUAL'){var _0x37c1c9={};_0x37c1c9[_0x30626e[_0xe989('0x2c')]]={'$like':'%'+_0x2035f5[_0xe989('0x36')][_0xe989('0x41')]+'%'};return _0x37c1c9;}})});}_0x34bba7=_[_0xe989('0x42')]({},_0x34bba7,_0x2035f5[_0xe989('0x43')]);var _0x5180ec={'where':_0x34bba7[_0xe989('0x3e')]};return db['Trigger'][_0xe989('0x20')](_0x5180ec)['then'](function(_0x5274fc){_0xb54661[_0xe989('0x20')]=_0x5274fc;if(_0x2035f5[_0xe989('0x36')][_0xe989('0x44')]){_0x34bba7[_0xe989('0x45')]=[{'all':!![]}];}return db[_0xe989('0x46')][_0xe989('0x47')](_0x34bba7);})[_0xe989('0x26')](function(_0x5574ff){_0xb54661['rows']=_0x5574ff;return _0xb54661;})[_0xe989('0x26')](respondWithFilteredResult(_0x27f3da,_0x34bba7))[_0xe989('0x48')](handleError(_0x27f3da,null));};exports[_0xe989('0x49')]=function(_0x4ae796,_0x520952){var _0x1b4024={'raw':![],'where':{'id':_0x4ae796[_0xe989('0x4a')]['id']}},_0x2d5608={};_0x2d5608[_0xe989('0x33')]=_['keys'](db[_0xe989('0x46')][_0xe989('0x30')]);_0x2d5608[_0xe989('0x36')]=_[_0xe989('0x34')](_0x4ae796[_0xe989('0x36')]);_0x2d5608[_0xe989('0x3f')]=_[_0xe989('0x35')](_0x2d5608[_0xe989('0x33')],_0x2d5608['query']);_0x1b4024['attributes']=_[_0xe989('0x35')](_0x2d5608['model'],qs[_0xe989('0x37')](_0x4ae796[_0xe989('0x36')][_0xe989('0x37')]));_0x1b4024[_0xe989('0x38')]=_0x1b4024[_0xe989('0x38')][_0xe989('0x39')]?_0x1b4024[_0xe989('0x38')]:_0x2d5608['model'];if(_0x4ae796[_0xe989('0x36')][_0xe989('0x44')]){_0x1b4024[_0xe989('0x45')]=[{'all':!![]}];}_0x1b4024=_[_0xe989('0x42')]({},_0x1b4024,_0x4ae796['options']);return db[_0xe989('0x46')]['find'](_0x1b4024)[_0xe989('0x26')](handleEntityNotFound(_0x520952,null))[_0xe989('0x26')](respondWithResult(_0x520952,null))[_0xe989('0x48')](handleError(_0x520952,null));};exports['create']=function(_0x2b6e9f,_0x491c1e){return db['Trigger'][_0xe989('0x4b')](_0x2b6e9f[_0xe989('0x4c')],{})[_0xe989('0x26')](function(_0xd9e0a1){var _0x478911=_0x2b6e9f['user']['get']({'plain':!![]});if(!_0x478911)throw new Error(_0xe989('0x4d'));if(_0x478911['role']===_0xe989('0x4e')){var _0xa478b=_0xd9e0a1['get']({'plain':!![]});var _0x1502f9=_0xe989('0x29');return db[_0xe989('0x4f')]['find']({'where':{'name':_0x1502f9,'userProfileId':_0x478911['userProfileId']},'raw':!![]})[_0xe989('0x26')](function(_0x205880){if(_0x205880&&_0x205880['autoAssociation']===0x0){return db[_0xe989('0x50')][_0xe989('0x4b')]({'name':_0xa478b[_0xe989('0x2c')],'resourceId':_0xa478b['id'],'type':_0x205880[_0xe989('0x2c')],'sectionId':_0x205880['id']},{})['then'](function(){return _0xd9e0a1;});}else{return _0xd9e0a1;}})[_0xe989('0x48')](function(_0x562886){logger[_0xe989('0x2b')](_0xe989('0x51'),_0x562886);throw _0x562886;});}return _0xd9e0a1;})[_0xe989('0x26')](respondWithResult(_0x491c1e,0xc9))[_0xe989('0x48')](handleError(_0x491c1e,null));};exports['update']=function(_0x1ef88e,_0x370511){if(_0x1ef88e[_0xe989('0x4c')]['id']){delete _0x1ef88e[_0xe989('0x4c')]['id'];}return db[_0xe989('0x46')]['find']({'where':{'id':_0x1ef88e[_0xe989('0x4a')]['id']}})[_0xe989('0x26')](handleEntityNotFound(_0x370511,null))[_0xe989('0x26')](saveUpdates(_0x1ef88e[_0xe989('0x4c')],null))[_0xe989('0x26')](respondWithResult(_0x370511,null))[_0xe989('0x48')](handleError(_0x370511,null));};exports['destroy']=function(_0x3ffeaa,_0x5ce393){return db[_0xe989('0x46')][_0xe989('0x52')]({'where':{'id':_0x3ffeaa[_0xe989('0x4a')]['id']}})[_0xe989('0x26')](handleEntityNotFound(_0x5ce393,null))[_0xe989('0x26')](removeEntity(_0x5ce393,null))[_0xe989('0x48')](handleError(_0x5ce393,null));};exports['addAllCondition']=function(_0x226e7a,_0x23f97e,_0x7ec260){if(_0x226e7a['body']['id']){delete _0x226e7a[_0xe989('0x4c')]['id'];}return db['Trigger'][_0xe989('0x52')]({'where':{'id':_0x226e7a[_0xe989('0x4a')]['id']}})[_0xe989('0x26')](handleEntityNotFound(_0x23f97e,null))['then'](function(_0xa3ef7c){if(_0xa3ef7c){_0x226e7a[_0xe989('0x4c')]['TriggerAllId']=_0xa3ef7c['id'];return db['Condition'][_0xe989('0x4b')](_0x226e7a[_0xe989('0x4c')]);}})[_0xe989('0x26')](respondWithResult(_0x23f97e,null))['catch'](handleError(_0x23f97e,null));};exports['addAnyCondition']=function(_0x414ccb,_0x56618d,_0x20b7a0){if(_0x414ccb[_0xe989('0x4c')]['id']){delete _0x414ccb['body']['id'];}return db[_0xe989('0x46')][_0xe989('0x52')]({'where':{'id':_0x414ccb[_0xe989('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56618d,null))['then'](function(_0x16ea63){if(_0x16ea63){_0x414ccb[_0xe989('0x4c')][_0xe989('0x53')]=_0x16ea63['id'];return db['Condition'][_0xe989('0x4b')](_0x414ccb[_0xe989('0x4c')]);}})[_0xe989('0x26')](respondWithResult(_0x56618d,null))[_0xe989('0x48')](handleError(_0x56618d,null));};exports[_0xe989('0x54')]=function(_0x4ad2c9,_0x446a27,_0x17d112){var _0x1c3e71={};var _0x5b6507={};var _0x7962;var _0x1dfe07;return db[_0xe989('0x46')][_0xe989('0x55')]({'where':{'id':_0x4ad2c9['params']['id']}})[_0xe989('0x26')](handleEntityNotFound(_0x446a27,null))[_0xe989('0x26')](function(_0x1d044d){if(_0x1d044d){_0x7962=_0x1d044d;_0x5b6507['model']=_['keys'](db[_0xe989('0x56')][_0xe989('0x30')]);_0x5b6507[_0xe989('0x36')]=_[_0xe989('0x34')](_0x4ad2c9['query']);_0x5b6507[_0xe989('0x3f')]=_[_0xe989('0x35')](_0x5b6507[_0xe989('0x33')],_0x5b6507['query']);_0x1c3e71[_0xe989('0x38')]=_[_0xe989('0x35')](_0x5b6507[_0xe989('0x33')],qs[_0xe989('0x37')](_0x4ad2c9[_0xe989('0x36')][_0xe989('0x37')]));_0x1c3e71['attributes']=_0x1c3e71['attributes'][_0xe989('0x39')]?_0x1c3e71[_0xe989('0x38')]:_0x5b6507[_0xe989('0x33')];_0x1c3e71['order']=qs[_0xe989('0x3d')](_0x4ad2c9[_0xe989('0x36')]['sort']);_0x1c3e71[_0xe989('0x3e')]=qs[_0xe989('0x3f')](_[_0xe989('0x40')](_0x4ad2c9[_0xe989('0x36')],_0x5b6507[_0xe989('0x3f')]));if(_0x4ad2c9[_0xe989('0x36')][_0xe989('0x41')]){_0x1c3e71['where']=_['merge'](_0x1c3e71[_0xe989('0x3e')],{'$or':_['map'](_0x1c3e71[_0xe989('0x38')],function(_0x3e71c7){var _0x5dc4e4={};_0x5dc4e4[_0x3e71c7]={'$like':'%'+_0x4ad2c9[_0xe989('0x36')][_0xe989('0x41')]+'%'};return _0x5dc4e4;})});}_0x1c3e71=_[_0xe989('0x42')]({},_0x1c3e71,_0x4ad2c9['options']);return _0x7962['getAllConditions'](_0x1c3e71);}})[_0xe989('0x26')](function(_0x3f1ef8){if(_0x3f1ef8){_0x1dfe07=_0x3f1ef8[_0xe989('0x39')];if(!_0x4ad2c9[_0xe989('0x36')]['hasOwnProperty'](_0xe989('0x3b'))){_0x1c3e71['limit']=qs[_0xe989('0x1e')](_0x4ad2c9[_0xe989('0x36')]['limit']);_0x1c3e71['offset']=qs['offset'](_0x4ad2c9[_0xe989('0x36')][_0xe989('0x1d')]);}return _0x7962[_0xe989('0x54')](_0x1c3e71);}})[_0xe989('0x26')](function(_0x29605c){if(_0x29605c){return _0x29605c?{'count':_0x1dfe07,'rows':_0x29605c}:null;}})[_0xe989('0x26')](respondWithResult(_0x446a27,null))['catch'](handleError(_0x446a27,null));};exports[_0xe989('0x57')]=function(_0x202138,_0x1c37d8,_0x18a188){var _0x1351a1={};var _0x69e090={};var _0xb47fd2;var _0x5ef9e6;return db[_0xe989('0x46')][_0xe989('0x55')]({'where':{'id':_0x202138[_0xe989('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1c37d8,null))[_0xe989('0x26')](function(_0x50d19d){if(_0x50d19d){_0xb47fd2=_0x50d19d;_0x69e090['model']=_['keys'](db[_0xe989('0x56')][_0xe989('0x30')]);_0x69e090[_0xe989('0x36')]=_[_0xe989('0x34')](_0x202138[_0xe989('0x36')]);_0x69e090[_0xe989('0x3f')]=_[_0xe989('0x35')](_0x69e090['model'],_0x69e090[_0xe989('0x36')]);_0x1351a1[_0xe989('0x38')]=_['intersection'](_0x69e090[_0xe989('0x33')],qs[_0xe989('0x37')](_0x202138[_0xe989('0x36')][_0xe989('0x37')]));_0x1351a1[_0xe989('0x38')]=_0x1351a1['attributes'][_0xe989('0x39')]?_0x1351a1[_0xe989('0x38')]:_0x69e090['model'];_0x1351a1[_0xe989('0x3c')]=qs[_0xe989('0x3d')](_0x202138['query'][_0xe989('0x3d')]);_0x1351a1[_0xe989('0x3e')]=qs['filters'](_[_0xe989('0x40')](_0x202138[_0xe989('0x36')],_0x69e090['filters']));if(_0x202138['query']['filter']){_0x1351a1[_0xe989('0x3e')]=_['merge'](_0x1351a1[_0xe989('0x3e')],{'$or':_[_0xe989('0x2f')](_0x1351a1[_0xe989('0x38')],function(_0x4be2df){var _0x1e14e4={};_0x1e14e4[_0x4be2df]={'$like':'%'+_0x202138[_0xe989('0x36')][_0xe989('0x41')]+'%'};return _0x1e14e4;})});}_0x1351a1=_[_0xe989('0x42')]({},_0x1351a1,_0x202138[_0xe989('0x43')]);return _0xb47fd2[_0xe989('0x57')](_0x1351a1);}})[_0xe989('0x26')](function(_0x2d1688){if(_0x2d1688){_0x5ef9e6=_0x2d1688[_0xe989('0x39')];if(!_0x202138[_0xe989('0x36')][_0xe989('0x3a')](_0xe989('0x3b'))){_0x1351a1[_0xe989('0x1e')]=qs['limit'](_0x202138[_0xe989('0x36')][_0xe989('0x1e')]);_0x1351a1[_0xe989('0x1d')]=qs['offset'](_0x202138[_0xe989('0x36')]['offset']);}return _0xb47fd2[_0xe989('0x57')](_0x1351a1);}})[_0xe989('0x26')](function(_0x1efc85){if(_0x1efc85){return _0x1efc85?{'count':_0x5ef9e6,'rows':_0x1efc85}:null;}})[_0xe989('0x26')](respondWithResult(_0x1c37d8,null))[_0xe989('0x48')](handleError(_0x1c37d8,null));};exports['addAction']=function(_0x438bd9,_0x3860bf,_0x3bea59){if(_0x438bd9[_0xe989('0x4c')]['id']){delete _0x438bd9[_0xe989('0x4c')]['id'];}return db[_0xe989('0x46')][_0xe989('0x52')]({'where':{'id':_0x438bd9['params']['id']}})['then'](handleEntityNotFound(_0x3860bf,null))[_0xe989('0x26')](function(_0x2adb82){if(_0x2adb82){_0x438bd9[_0xe989('0x4c')][_0xe989('0x58')]=_0x2adb82['id'];return db[_0xe989('0x59')][_0xe989('0x4b')](_0x438bd9['body']);}})[_0xe989('0x26')](respondWithResult(_0x3860bf,null))['catch'](handleError(_0x3860bf,null));};exports[_0xe989('0x5a')]=function(_0x2641da,_0x1f3bec,_0x5b8f5a){var _0x50cadd={};var _0x34b962={};var _0x418e44;var _0x2b9348;return db['Trigger']['findOne']({'where':{'id':_0x2641da[_0xe989('0x4a')]['id']}})[_0xe989('0x26')](handleEntityNotFound(_0x1f3bec,null))['then'](function(_0x4d6a97){if(_0x4d6a97){_0x418e44=_0x4d6a97;_0x34b962[_0xe989('0x33')]=_['keys'](db[_0xe989('0x59')][_0xe989('0x30')]);_0x34b962['query']=_[_0xe989('0x34')](_0x2641da[_0xe989('0x36')]);_0x34b962[_0xe989('0x3f')]=_[_0xe989('0x35')](_0x34b962[_0xe989('0x33')],_0x34b962['query']);_0x50cadd[_0xe989('0x38')]=_[_0xe989('0x35')](_0x34b962[_0xe989('0x33')],qs[_0xe989('0x37')](_0x2641da['query'][_0xe989('0x37')]));_0x50cadd[_0xe989('0x38')]=_0x50cadd['attributes'][_0xe989('0x39')]?_0x50cadd[_0xe989('0x38')]:_0x34b962[_0xe989('0x33')];_0x50cadd['order']=qs['sort'](_0x2641da['query'][_0xe989('0x3d')]);_0x50cadd[_0xe989('0x3e')]=qs[_0xe989('0x3f')](_[_0xe989('0x40')](_0x2641da['query'],_0x34b962[_0xe989('0x3f')]));if(_0x2641da[_0xe989('0x36')][_0xe989('0x41')]){_0x50cadd['where']=_[_0xe989('0x42')](_0x50cadd['where'],{'$or':_[_0xe989('0x2f')](_0x50cadd['attributes'],function(_0x2a9c4c){var _0x262e36={};_0x262e36[_0x2a9c4c]={'$like':'%'+_0x2641da[_0xe989('0x36')]['filter']+'%'};return _0x262e36;})});}_0x50cadd=_[_0xe989('0x42')]({},_0x50cadd,_0x2641da['options']);return _0x418e44[_0xe989('0x5a')](_0x50cadd);}})[_0xe989('0x26')](function(_0xe4c85b){if(_0xe4c85b){_0x2b9348=_0xe4c85b[_0xe989('0x39')];if(!_0x2641da['query']['hasOwnProperty'](_0xe989('0x3b'))){_0x50cadd[_0xe989('0x1e')]=qs[_0xe989('0x1e')](_0x2641da[_0xe989('0x36')][_0xe989('0x1e')]);_0x50cadd[_0xe989('0x1d')]=qs[_0xe989('0x1d')](_0x2641da[_0xe989('0x36')][_0xe989('0x1d')]);}return _0x418e44[_0xe989('0x5a')](_0x50cadd);}})[_0xe989('0x26')](function(_0x34d212){if(_0x34d212){return _0x34d212?{'count':_0x2b9348,'rows':_0x34d212}:null;}})[_0xe989('0x26')](respondWithResult(_0x1f3bec,null))[_0xe989('0x48')](handleError(_0x1f3bec,null));}; \ No newline at end of file +var _0xf485=['getActions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','Triggers','UserProfileResource','error','stack','name','index','map','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','Trigger','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','TriggerId','Action'];(function(_0x12d6de,_0xccc040){var _0x32923b=function(_0x1b150f){while(--_0x1b150f){_0x12d6de['push'](_0x12d6de['shift']());}};_0x32923b(++_0xccc040);}(_0xf485,0x1e1));var _0x5f48=function(_0x35d940,_0x43bf93){_0x35d940=_0x35d940-0x0;var _0x7bf56c=_0xf485[_0x35d940];return _0x7bf56c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f48('0x0'));var zipdir=require(_0x5f48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f48('0x2'));var moment=require(_0x5f48('0x3'));var BPromise=require(_0x5f48('0x4'));var Mustache=require(_0x5f48('0x5'));var util=require(_0x5f48('0x6'));var path=require(_0x5f48('0x7'));var sox=require(_0x5f48('0x8'));var csv=require(_0x5f48('0x9'));var ejs=require(_0x5f48('0xa'));var fs=require('fs');var fs_extra=require(_0x5f48('0xb'));var _=require(_0x5f48('0xc'));var squel=require(_0x5f48('0xd'));var crypto=require('crypto');var jsforce=require(_0x5f48('0xe'));var deskjs=require(_0x5f48('0xf'));var toCsv=require(_0x5f48('0x9'));var querystring=require(_0x5f48('0x10'));var Papa=require('papaparse');var Redis=require(_0x5f48('0x11'));var authService=require(_0x5f48('0x12'));var qs=require(_0x5f48('0x13'));var as=require(_0x5f48('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f48('0x15'))(_0x5f48('0x16'));var utils=require(_0x5f48('0x17'));var config=require(_0x5f48('0x18'));var licenseUtil=require(_0x5f48('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44c500,_0x3af296){_0x3af296=_0x3af296||0xcc;return function(_0x34ec95){if(_0x34ec95){return _0x44c500[_0x5f48('0x1a')](_0x3af296);}return _0x44c500['status'](_0x3af296)[_0x5f48('0x1b')]();};}function respondWithResult(_0x480def,_0x14e58a){_0x14e58a=_0x14e58a||0xc8;return function(_0x1cd991){if(_0x1cd991){return _0x480def[_0x5f48('0x1c')](_0x14e58a)[_0x5f48('0x1d')](_0x1cd991);}};}function respondWithFilteredResult(_0x5d39da,_0x208bf3){return function(_0x5b20a1){if(_0x5b20a1){var _0x4cf1b7=typeof _0x208bf3[_0x5f48('0x1e')]===_0x5f48('0x1f')&&typeof _0x208bf3[_0x5f48('0x20')]==='undefined';var _0x3314f1=_0x5b20a1[_0x5f48('0x21')];var _0xe5fde8=_0x4cf1b7?0x0:_0x208bf3['offset'];var _0x9b42b3=_0x4cf1b7?_0x5b20a1[_0x5f48('0x21')]:_0x208bf3[_0x5f48('0x1e')]+_0x208bf3[_0x5f48('0x20')];var _0x2b39d5;if(_0x9b42b3>=_0x3314f1){_0x9b42b3=_0x3314f1;_0x2b39d5=0xc8;}else{_0x2b39d5=0xce;}_0x5d39da[_0x5f48('0x1c')](_0x2b39d5);return _0x5d39da[_0x5f48('0x22')](_0x5f48('0x23'),_0xe5fde8+'-'+_0x9b42b3+'/'+_0x3314f1)[_0x5f48('0x1d')](_0x5b20a1);}return null;};}function patchUpdates(_0x6a71dd){return function(_0x3bcac8){try{jsonpatch[_0x5f48('0x24')](_0x3bcac8,_0x6a71dd,!![]);}catch(_0x371a5b){return BPromise[_0x5f48('0x25')](_0x371a5b);}return _0x3bcac8[_0x5f48('0x26')]();};}function saveUpdates(_0x2134cf,_0x4d9aee){return function(_0x475125){if(_0x475125){return _0x475125['update'](_0x2134cf)[_0x5f48('0x27')](function(_0x1e5c7b){return _0x1e5c7b;});}return null;};}function removeEntity(_0x4acdb2,_0x3a59ac){return function(_0xe8e1e5){if(_0xe8e1e5){return _0xe8e1e5[_0x5f48('0x28')]()[_0x5f48('0x27')](function(){var _0x2e053a=_0xe8e1e5['get']({'plain':!![]});var _0x1c77be=_0x5f48('0x29');return db[_0x5f48('0x2a')][_0x5f48('0x28')]({'where':{'type':_0x1c77be,'resourceId':_0x2e053a['id']}})[_0x5f48('0x27')](function(){return _0xe8e1e5;});})[_0x5f48('0x27')](function(){_0x4acdb2[_0x5f48('0x1c')](0xcc)[_0x5f48('0x1b')]();});}};}function handleEntityNotFound(_0xa683c4,_0x1d08b3){return function(_0xe816bb){if(!_0xe816bb){_0xa683c4[_0x5f48('0x1a')](0x194);}return _0xe816bb;};}function handleError(_0x1ae6ac,_0x3c8586){_0x3c8586=_0x3c8586||0x1f4;return function(_0x1efc0d){logger[_0x5f48('0x2b')](_0x1efc0d[_0x5f48('0x2c')]);if(_0x1efc0d[_0x5f48('0x2d')]){delete _0x1efc0d[_0x5f48('0x2d')];}_0x1ae6ac[_0x5f48('0x1c')](_0x3c8586)['send'](_0x1efc0d);};}exports[_0x5f48('0x2e')]=function(_0xe0b060,_0x57dedd){var _0x4ada7a={},_0x205e6b={},_0x5caa34={'count':0x0,'rows':[]};var _0x54d553=_[_0x5f48('0x2f')](db['Trigger']['rawAttributes'],function(_0x32373c){return{'name':_0x32373c[_0x5f48('0x30')],'type':_0x32373c['type']['key']};});_0x205e6b['model']=_[_0x5f48('0x2f')](_0x54d553,_0x5f48('0x2d'));_0x205e6b[_0x5f48('0x31')]=_[_0x5f48('0x32')](_0xe0b060[_0x5f48('0x31')]);_0x205e6b['filters']=_[_0x5f48('0x33')](_0x205e6b[_0x5f48('0x34')],_0x205e6b[_0x5f48('0x31')]);_0x4ada7a[_0x5f48('0x35')]=_[_0x5f48('0x33')](_0x205e6b['model'],qs[_0x5f48('0x36')](_0xe0b060[_0x5f48('0x31')][_0x5f48('0x36')]));_0x4ada7a[_0x5f48('0x35')]=_0x4ada7a['attributes'][_0x5f48('0x37')]?_0x4ada7a[_0x5f48('0x35')]:_0x205e6b['model'];if(!_0xe0b060[_0x5f48('0x31')][_0x5f48('0x38')](_0x5f48('0x39'))){_0x4ada7a['limit']=qs[_0x5f48('0x20')](_0xe0b060[_0x5f48('0x31')][_0x5f48('0x20')]);_0x4ada7a['offset']=qs['offset'](_0xe0b060[_0x5f48('0x31')][_0x5f48('0x1e')]);}_0x4ada7a[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0xe0b060[_0x5f48('0x31')][_0x5f48('0x3b')]);_0x4ada7a[_0x5f48('0x3c')]=qs[_0x5f48('0x3d')](_[_0x5f48('0x3e')](_0xe0b060[_0x5f48('0x31')],_0x205e6b['filters']),_0x54d553);if(_0xe0b060[_0x5f48('0x31')][_0x5f48('0x3f')]){_0x4ada7a[_0x5f48('0x3c')]=_[_0x5f48('0x40')](_0x4ada7a[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2f')](_0x54d553,function(_0x310bca){if(_0x310bca[_0x5f48('0x41')]!=='VIRTUAL'){var _0x28c486={};_0x28c486[_0x310bca['name']]={'$like':'%'+_0xe0b060[_0x5f48('0x31')]['filter']+'%'};return _0x28c486;}})});}_0x4ada7a=_['merge']({},_0x4ada7a,_0xe0b060['options']);var _0x53e53e={'where':_0x4ada7a[_0x5f48('0x3c')]};return db[_0x5f48('0x42')][_0x5f48('0x21')](_0x53e53e)[_0x5f48('0x27')](function(_0x11e112){_0x5caa34['count']=_0x11e112;if(_0xe0b060[_0x5f48('0x31')][_0x5f48('0x43')]){_0x4ada7a['include']=[{'all':!![]}];}return db[_0x5f48('0x42')][_0x5f48('0x44')](_0x4ada7a);})[_0x5f48('0x27')](function(_0x56c0fe){_0x5caa34[_0x5f48('0x45')]=_0x56c0fe;return _0x5caa34;})['then'](respondWithFilteredResult(_0x57dedd,_0x4ada7a))[_0x5f48('0x46')](handleError(_0x57dedd,null));};exports[_0x5f48('0x47')]=function(_0x45fdf2,_0x2c17e3){var _0x5260f1={'raw':![],'where':{'id':_0x45fdf2[_0x5f48('0x48')]['id']}},_0x49885e={};_0x49885e[_0x5f48('0x34')]=_[_0x5f48('0x32')](db[_0x5f48('0x42')][_0x5f48('0x49')]);_0x49885e[_0x5f48('0x31')]=_['keys'](_0x45fdf2[_0x5f48('0x31')]);_0x49885e[_0x5f48('0x3d')]=_[_0x5f48('0x33')](_0x49885e['model'],_0x49885e[_0x5f48('0x31')]);_0x5260f1[_0x5f48('0x35')]=_['intersection'](_0x49885e[_0x5f48('0x34')],qs[_0x5f48('0x36')](_0x45fdf2[_0x5f48('0x31')][_0x5f48('0x36')]));_0x5260f1[_0x5f48('0x35')]=_0x5260f1[_0x5f48('0x35')]['length']?_0x5260f1[_0x5f48('0x35')]:_0x49885e['model'];if(_0x45fdf2[_0x5f48('0x31')][_0x5f48('0x43')]){_0x5260f1[_0x5f48('0x4a')]=[{'all':!![]}];}_0x5260f1=_[_0x5f48('0x40')]({},_0x5260f1,_0x45fdf2[_0x5f48('0x4b')]);return db['Trigger'][_0x5f48('0x4c')](_0x5260f1)['then'](handleEntityNotFound(_0x2c17e3,null))[_0x5f48('0x27')](respondWithResult(_0x2c17e3,null))[_0x5f48('0x46')](handleError(_0x2c17e3,null));};exports[_0x5f48('0x4d')]=function(_0x216060,_0x29ffe5){return db[_0x5f48('0x42')][_0x5f48('0x4d')](_0x216060['body'],{})[_0x5f48('0x27')](function(_0x2fdb3c){var _0x24c033=_0x216060['user']['get']({'plain':!![]});if(!_0x24c033)throw new Error(_0x5f48('0x4e'));if(_0x24c033[_0x5f48('0x4f')]===_0x5f48('0x50')){var _0x2f7ceb=_0x2fdb3c[_0x5f48('0x51')]({'plain':!![]});var _0x988ef4='Triggers';return db['UserProfileSection'][_0x5f48('0x4c')]({'where':{'name':_0x988ef4,'userProfileId':_0x24c033['userProfileId']},'raw':!![]})[_0x5f48('0x27')](function(_0x4f5a2f){if(_0x4f5a2f&&_0x4f5a2f[_0x5f48('0x52')]===0x0){return db[_0x5f48('0x2a')][_0x5f48('0x4d')]({'name':_0x2f7ceb[_0x5f48('0x2d')],'resourceId':_0x2f7ceb['id'],'type':_0x4f5a2f[_0x5f48('0x2d')],'sectionId':_0x4f5a2f['id']},{})[_0x5f48('0x27')](function(){return _0x2fdb3c;});}else{return _0x2fdb3c;}})[_0x5f48('0x46')](function(_0x14b5d3){logger[_0x5f48('0x2b')](_0x5f48('0x53'),_0x14b5d3);throw _0x14b5d3;});}return _0x2fdb3c;})['then'](respondWithResult(_0x29ffe5,0xc9))['catch'](handleError(_0x29ffe5,null));};exports[_0x5f48('0x54')]=function(_0x5f35e8,_0x93a662){if(_0x5f35e8[_0x5f48('0x55')]['id']){delete _0x5f35e8[_0x5f48('0x55')]['id'];}return db[_0x5f48('0x42')]['find']({'where':{'id':_0x5f35e8[_0x5f48('0x48')]['id']}})['then'](handleEntityNotFound(_0x93a662,null))[_0x5f48('0x27')](saveUpdates(_0x5f35e8['body'],null))[_0x5f48('0x27')](respondWithResult(_0x93a662,null))[_0x5f48('0x46')](handleError(_0x93a662,null));};exports[_0x5f48('0x28')]=function(_0x44a085,_0x588041){return db[_0x5f48('0x42')][_0x5f48('0x4c')]({'where':{'id':_0x44a085[_0x5f48('0x48')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x588041,null))['then'](removeEntity(_0x588041,null))[_0x5f48('0x46')](handleError(_0x588041,null));};exports['addAllCondition']=function(_0x5e3e,_0x2fd6ce,_0x3bf215){if(_0x5e3e['body']['id']){delete _0x5e3e[_0x5f48('0x55')]['id'];}return db['Trigger'][_0x5f48('0x4c')]({'where':{'id':_0x5e3e['params']['id']}})['then'](handleEntityNotFound(_0x2fd6ce,null))[_0x5f48('0x27')](function(_0x41a9b8){if(_0x41a9b8){_0x5e3e[_0x5f48('0x55')][_0x5f48('0x56')]=_0x41a9b8['id'];return db[_0x5f48('0x57')][_0x5f48('0x4d')](_0x5e3e['body']);}})[_0x5f48('0x27')](respondWithResult(_0x2fd6ce,null))[_0x5f48('0x46')](handleError(_0x2fd6ce,null));};exports[_0x5f48('0x58')]=function(_0x599b6b,_0x1f6a2c,_0x3445dc){if(_0x599b6b[_0x5f48('0x55')]['id']){delete _0x599b6b[_0x5f48('0x55')]['id'];}return db[_0x5f48('0x42')][_0x5f48('0x4c')]({'where':{'id':_0x599b6b[_0x5f48('0x48')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x1f6a2c,null))['then'](function(_0x456a83){if(_0x456a83){_0x599b6b[_0x5f48('0x55')][_0x5f48('0x59')]=_0x456a83['id'];return db[_0x5f48('0x57')]['create'](_0x599b6b[_0x5f48('0x55')]);}})[_0x5f48('0x27')](respondWithResult(_0x1f6a2c,null))[_0x5f48('0x46')](handleError(_0x1f6a2c,null));};exports['getAllConditions']=function(_0x50b6dc,_0x34b28d,_0x440e7a){var _0x1db09e={};var _0x55955c={};var _0xb4e2f7;var _0x434230;return db[_0x5f48('0x42')][_0x5f48('0x5a')]({'where':{'id':_0x50b6dc[_0x5f48('0x48')]['id']}})['then'](handleEntityNotFound(_0x34b28d,null))[_0x5f48('0x27')](function(_0xc5944){if(_0xc5944){_0xb4e2f7=_0xc5944;_0x55955c[_0x5f48('0x34')]=_[_0x5f48('0x32')](db['Condition']['rawAttributes']);_0x55955c['query']=_[_0x5f48('0x32')](_0x50b6dc['query']);_0x55955c[_0x5f48('0x3d')]=_[_0x5f48('0x33')](_0x55955c[_0x5f48('0x34')],_0x55955c[_0x5f48('0x31')]);_0x1db09e[_0x5f48('0x35')]=_[_0x5f48('0x33')](_0x55955c[_0x5f48('0x34')],qs[_0x5f48('0x36')](_0x50b6dc[_0x5f48('0x31')][_0x5f48('0x36')]));_0x1db09e[_0x5f48('0x35')]=_0x1db09e[_0x5f48('0x35')]['length']?_0x1db09e[_0x5f48('0x35')]:_0x55955c[_0x5f48('0x34')];_0x1db09e[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0x50b6dc[_0x5f48('0x31')]['sort']);_0x1db09e[_0x5f48('0x3c')]=qs[_0x5f48('0x3d')](_[_0x5f48('0x3e')](_0x50b6dc[_0x5f48('0x31')],_0x55955c[_0x5f48('0x3d')]));if(_0x50b6dc[_0x5f48('0x31')][_0x5f48('0x3f')]){_0x1db09e[_0x5f48('0x3c')]=_[_0x5f48('0x40')](_0x1db09e[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2f')](_0x1db09e[_0x5f48('0x35')],function(_0x5f2c6d){var _0xd42dba={};_0xd42dba[_0x5f2c6d]={'$like':'%'+_0x50b6dc[_0x5f48('0x31')][_0x5f48('0x3f')]+'%'};return _0xd42dba;})});}_0x1db09e=_[_0x5f48('0x40')]({},_0x1db09e,_0x50b6dc[_0x5f48('0x4b')]);return _0xb4e2f7[_0x5f48('0x5b')](_0x1db09e);}})[_0x5f48('0x27')](function(_0x265578){if(_0x265578){_0x434230=_0x265578[_0x5f48('0x37')];if(!_0x50b6dc[_0x5f48('0x31')]['hasOwnProperty'](_0x5f48('0x39'))){_0x1db09e['limit']=qs[_0x5f48('0x20')](_0x50b6dc[_0x5f48('0x31')]['limit']);_0x1db09e[_0x5f48('0x1e')]=qs[_0x5f48('0x1e')](_0x50b6dc[_0x5f48('0x31')][_0x5f48('0x1e')]);}return _0xb4e2f7[_0x5f48('0x5b')](_0x1db09e);}})[_0x5f48('0x27')](function(_0x3aa5e3){if(_0x3aa5e3){return _0x3aa5e3?{'count':_0x434230,'rows':_0x3aa5e3}:null;}})[_0x5f48('0x27')](respondWithResult(_0x34b28d,null))['catch'](handleError(_0x34b28d,null));};exports[_0x5f48('0x5c')]=function(_0x26d068,_0x3ece7a,_0x2cb814){var _0x3ddd8e={};var _0x40681b={};var _0x4536e6;var _0x512c0a;return db[_0x5f48('0x42')][_0x5f48('0x5a')]({'where':{'id':_0x26d068['params']['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x3ece7a,null))[_0x5f48('0x27')](function(_0x2e2b9f){if(_0x2e2b9f){_0x4536e6=_0x2e2b9f;_0x40681b[_0x5f48('0x34')]=_[_0x5f48('0x32')](db[_0x5f48('0x57')][_0x5f48('0x49')]);_0x40681b[_0x5f48('0x31')]=_['keys'](_0x26d068[_0x5f48('0x31')]);_0x40681b[_0x5f48('0x3d')]=_[_0x5f48('0x33')](_0x40681b[_0x5f48('0x34')],_0x40681b[_0x5f48('0x31')]);_0x3ddd8e[_0x5f48('0x35')]=_[_0x5f48('0x33')](_0x40681b['model'],qs[_0x5f48('0x36')](_0x26d068[_0x5f48('0x31')][_0x5f48('0x36')]));_0x3ddd8e[_0x5f48('0x35')]=_0x3ddd8e['attributes'][_0x5f48('0x37')]?_0x3ddd8e[_0x5f48('0x35')]:_0x40681b['model'];_0x3ddd8e[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0x26d068['query']['sort']);_0x3ddd8e[_0x5f48('0x3c')]=qs[_0x5f48('0x3d')](_[_0x5f48('0x3e')](_0x26d068[_0x5f48('0x31')],_0x40681b['filters']));if(_0x26d068[_0x5f48('0x31')][_0x5f48('0x3f')]){_0x3ddd8e[_0x5f48('0x3c')]=_[_0x5f48('0x40')](_0x3ddd8e[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2f')](_0x3ddd8e['attributes'],function(_0x3fd369){var _0x4cecf2={};_0x4cecf2[_0x3fd369]={'$like':'%'+_0x26d068['query']['filter']+'%'};return _0x4cecf2;})});}_0x3ddd8e=_[_0x5f48('0x40')]({},_0x3ddd8e,_0x26d068[_0x5f48('0x4b')]);return _0x4536e6[_0x5f48('0x5c')](_0x3ddd8e);}})[_0x5f48('0x27')](function(_0x504e1d){if(_0x504e1d){_0x512c0a=_0x504e1d[_0x5f48('0x37')];if(!_0x26d068['query'][_0x5f48('0x38')](_0x5f48('0x39'))){_0x3ddd8e[_0x5f48('0x20')]=qs[_0x5f48('0x20')](_0x26d068['query']['limit']);_0x3ddd8e[_0x5f48('0x1e')]=qs['offset'](_0x26d068[_0x5f48('0x31')][_0x5f48('0x1e')]);}return _0x4536e6['getAnyConditions'](_0x3ddd8e);}})[_0x5f48('0x27')](function(_0x5578c6){if(_0x5578c6){return _0x5578c6?{'count':_0x512c0a,'rows':_0x5578c6}:null;}})[_0x5f48('0x27')](respondWithResult(_0x3ece7a,null))[_0x5f48('0x46')](handleError(_0x3ece7a,null));};exports['addAction']=function(_0x5bf785,_0x27b615,_0x2f0f21){if(_0x5bf785[_0x5f48('0x55')]['id']){delete _0x5bf785[_0x5f48('0x55')]['id'];}return db[_0x5f48('0x42')][_0x5f48('0x4c')]({'where':{'id':_0x5bf785[_0x5f48('0x48')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x27b615,null))[_0x5f48('0x27')](function(_0xec4fad){if(_0xec4fad){_0x5bf785[_0x5f48('0x55')][_0x5f48('0x5d')]=_0xec4fad['id'];return db[_0x5f48('0x5e')][_0x5f48('0x4d')](_0x5bf785[_0x5f48('0x55')]);}})[_0x5f48('0x27')](respondWithResult(_0x27b615,null))[_0x5f48('0x46')](handleError(_0x27b615,null));};exports[_0x5f48('0x5f')]=function(_0x2dcfdd,_0x2afa6b,_0x3e0a76){var _0x43ce9c={};var _0x24368e={};var _0x57d721;var _0x24dda6;return db[_0x5f48('0x42')][_0x5f48('0x5a')]({'where':{'id':_0x2dcfdd[_0x5f48('0x48')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x2afa6b,null))[_0x5f48('0x27')](function(_0x1c9a95){if(_0x1c9a95){_0x57d721=_0x1c9a95;_0x24368e[_0x5f48('0x34')]=_['keys'](db['Action'][_0x5f48('0x49')]);_0x24368e[_0x5f48('0x31')]=_[_0x5f48('0x32')](_0x2dcfdd[_0x5f48('0x31')]);_0x24368e['filters']=_[_0x5f48('0x33')](_0x24368e['model'],_0x24368e[_0x5f48('0x31')]);_0x43ce9c['attributes']=_[_0x5f48('0x33')](_0x24368e['model'],qs['fields'](_0x2dcfdd[_0x5f48('0x31')][_0x5f48('0x36')]));_0x43ce9c[_0x5f48('0x35')]=_0x43ce9c['attributes'][_0x5f48('0x37')]?_0x43ce9c[_0x5f48('0x35')]:_0x24368e[_0x5f48('0x34')];_0x43ce9c['order']=qs[_0x5f48('0x3b')](_0x2dcfdd[_0x5f48('0x31')][_0x5f48('0x3b')]);_0x43ce9c[_0x5f48('0x3c')]=qs[_0x5f48('0x3d')](_[_0x5f48('0x3e')](_0x2dcfdd[_0x5f48('0x31')],_0x24368e['filters']));if(_0x2dcfdd['query']['filter']){_0x43ce9c[_0x5f48('0x3c')]=_['merge'](_0x43ce9c[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2f')](_0x43ce9c[_0x5f48('0x35')],function(_0x57b0a1){var _0x693f38={};_0x693f38[_0x57b0a1]={'$like':'%'+_0x2dcfdd[_0x5f48('0x31')][_0x5f48('0x3f')]+'%'};return _0x693f38;})});}_0x43ce9c=_['merge']({},_0x43ce9c,_0x2dcfdd['options']);return _0x57d721[_0x5f48('0x5f')](_0x43ce9c);}})[_0x5f48('0x27')](function(_0x33d3cd){if(_0x33d3cd){_0x24dda6=_0x33d3cd['length'];if(!_0x2dcfdd[_0x5f48('0x31')][_0x5f48('0x38')](_0x5f48('0x39'))){_0x43ce9c['limit']=qs['limit'](_0x2dcfdd[_0x5f48('0x31')]['limit']);_0x43ce9c[_0x5f48('0x1e')]=qs[_0x5f48('0x1e')](_0x2dcfdd[_0x5f48('0x31')][_0x5f48('0x1e')]);}return _0x57d721['getActions'](_0x43ce9c);}})[_0x5f48('0x27')](function(_0x37dfde){if(_0x37dfde){return _0x37dfde?{'count':_0x24dda6,'rows':_0x37dfde}:null;}})['then'](respondWithResult(_0x2afa6b,null))[_0x5f48('0x46')](handleError(_0x2afa6b,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f26d1ef..b9bdad7 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 _0xc576=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./trigger.attributes','define','Trigger'];(function(_0x31d6b4,_0x3444b3){var _0x1e99fa=function(_0x5f05e9){while(--_0x5f05e9){_0x31d6b4['push'](_0x31d6b4['shift']());}};_0x1e99fa(++_0x3444b3);}(_0xc576,0x1ea));var _0x6c57=function(_0x5da27f,_0x504b76){_0x5da27f=_0x5da27f-0x0;var _0x54a3fb=_0xc576[_0x5da27f];return _0x54a3fb;};'use strict';var _=require(_0x6c57('0x0'));var util=require(_0x6c57('0x1'));var logger=require(_0x6c57('0x2'))(_0x6c57('0x3'));var moment=require(_0x6c57('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c57('0x5'));var rimraf=require('rimraf');var config=require(_0x6c57('0x6'));var attributes=require(_0x6c57('0x7'));module['exports']=function(_0xa6e0c4,_0x5e81a6){return _0xa6e0c4[_0x6c57('0x8')](_0x6c57('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a28=['Trigger','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports'];(function(_0x2d578b,_0x16ee39){var _0xa6a39e=function(_0x550e25){while(--_0x550e25){_0x2d578b['push'](_0x2d578b['shift']());}};_0xa6a39e(++_0x16ee39);}(_0x8a28,0xfd));var _0x88a2=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x8a28[_0x32d457];return _0x338386;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var moment=require(_0x88a2('0x4'));var BPromise=require(_0x88a2('0x5'));var rp=require(_0x88a2('0x6'));var fs=require('fs');var path=require(_0x88a2('0x7'));var rimraf=require('rimraf');var config=require(_0x88a2('0x8'));var attributes=require(_0x88a2('0x9'));module[_0x88a2('0xa')]=function(_0x438e32,_0x29ce92){return _0x438e32['define'](_0x88a2('0xb'),attributes,{'tableName':'tools_triggers','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 2d059e4..a10ba1b 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 _0xedc1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','GetTrigger','ShowTrigger','find','util','moment','bluebird'];(function(_0x3fd7ab,_0x3dd0bc){var _0x56cb4b=function(_0x2cd862){while(--_0x2cd862){_0x3fd7ab['push'](_0x3fd7ab['shift']());}};_0x56cb4b(++_0x3dd0bc);}(_0xedc1,0x115));var _0x1edc=function(_0x55b3b5,_0x254983){_0x55b3b5=_0x55b3b5-0x0;var _0x5297a9=_0xedc1[_0x55b3b5];return _0x5297a9;};'use strict';var _=require('lodash');var util=require(_0x1edc('0x0'));var moment=require(_0x1edc('0x1'));var BPromise=require(_0x1edc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1edc('0x3'))['db'];var utils=require(_0x1edc('0x4'));var logger=require(_0x1edc('0x5'))(_0x1edc('0x6'));var config=require(_0x1edc('0x7'));var jayson=require(_0x1edc('0x8'));var client=jayson[_0x1edc('0x9')][_0x1edc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5892b7,_0x531ee9,_0x1654c6){return new BPromise(function(_0xdddf03,_0x9f0f2f){return client['request'](_0x5892b7,_0x1654c6)[_0x1edc('0xb')](function(_0x44ac8d){logger[_0x1edc('0xc')]('Trigger,\x20%s,\x20%s',_0x531ee9,'request\x20sent');logger[_0x1edc('0xd')](_0x1edc('0xe'),_0x531ee9,_0x1edc('0xf'),JSON[_0x1edc('0x10')](_0x44ac8d));if(_0x44ac8d[_0x1edc('0x11')]){if(_0x44ac8d[_0x1edc('0x11')]['code']===0x1f4){logger[_0x1edc('0x11')](_0x1edc('0x12'),_0x531ee9,_0x44ac8d[_0x1edc('0x11')][_0x1edc('0x13')]);return _0x9f0f2f(_0x44ac8d[_0x1edc('0x11')][_0x1edc('0x13')]);}logger[_0x1edc('0x11')](_0x1edc('0x12'),_0x531ee9,_0x44ac8d[_0x1edc('0x11')][_0x1edc('0x13')]);return _0xdddf03(_0x44ac8d[_0x1edc('0x11')][_0x1edc('0x13')]);}else{logger[_0x1edc('0xc')]('Trigger,\x20%s,\x20%s',_0x531ee9,'request\x20sent');_0xdddf03(_0x44ac8d[_0x1edc('0x14')][_0x1edc('0x13')]);}})[_0x1edc('0x15')](function(_0x320527){logger[_0x1edc('0x11')](_0x1edc('0x12'),_0x531ee9,_0x320527);_0x9f0f2f(_0x320527);});});}exports['GetTrigger']=function(_0x54b7f9){var _0x4ebf28=this;return new Promise(function(_0x33b2b1,_0x59bf33){return db[_0x1edc('0x16')][_0x1edc('0x17')]({'raw':_0x54b7f9[_0x1edc('0x18')]?_0x54b7f9[_0x1edc('0x18')][_0x1edc('0x19')]===undefined?!![]:![]:!![],'where':_0x54b7f9['options']?_0x54b7f9[_0x1edc('0x18')][_0x1edc('0x1a')]||null:null,'attributes':_0x54b7f9[_0x1edc('0x18')]?_0x54b7f9['options'][_0x1edc('0x1b')]||null:null,'limit':_0x54b7f9[_0x1edc('0x18')]?_0x54b7f9[_0x1edc('0x18')][_0x1edc('0x1c')]||null:null,'include':_0x54b7f9[_0x1edc('0x18')]?_0x54b7f9['options'][_0x1edc('0x1d')]?_[_0x1edc('0x1e')](_0x54b7f9[_0x1edc('0x18')][_0x1edc('0x1d')],function(_0x47b4a1){return{'model':db[_0x47b4a1[_0x1edc('0x1f')]],'as':_0x47b4a1['as'],'attributes':_0x47b4a1['attributes'],'include':_0x47b4a1['include']?_[_0x1edc('0x1e')](_0x47b4a1[_0x1edc('0x1d')],function(_0x1f3e28){return{'model':db[_0x1f3e28[_0x1edc('0x1f')]],'as':_0x1f3e28['as'],'attributes':_0x1f3e28[_0x1edc('0x1b')],'include':_0x1f3e28[_0x1edc('0x1d')]?_[_0x1edc('0x1e')](_0x1f3e28[_0x1edc('0x1d')],function(_0x40ae81){return{'model':db[_0x40ae81[_0x1edc('0x1f')]],'as':_0x40ae81['as'],'attributes':_0x40ae81[_0x1edc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1edc('0xb')](function(_0x4adfe6){logger[_0x1edc('0xc')]('GetTrigger',_0x54b7f9);logger[_0x1edc('0xd')](_0x1edc('0x20'),_0x54b7f9,JSON['stringify'](_0x4adfe6));_0x33b2b1(_0x4adfe6);})[_0x1edc('0x15')](function(_0x4b1b7d){logger[_0x1edc('0x11')]('GetTrigger',_0x4b1b7d[_0x1edc('0x13')],_0x54b7f9);_0x59bf33(_0x4ebf28['error'](0x1f4,_0x4b1b7d[_0x1edc('0x13')]));});});};exports[_0x1edc('0x21')]=function(_0x434ea5){var _0x16ef8e=this;return new Promise(function(_0x130d86,_0x4c1628){return db[_0x1edc('0x16')][_0x1edc('0x22')]({'raw':_0x434ea5['options']?_0x434ea5[_0x1edc('0x18')][_0x1edc('0x19')]===undefined?!![]:![]:!![],'where':_0x434ea5[_0x1edc('0x18')]?_0x434ea5['options'][_0x1edc('0x1a')]||null:null,'attributes':_0x434ea5[_0x1edc('0x18')]?_0x434ea5[_0x1edc('0x18')][_0x1edc('0x1b')]||null:null,'include':_0x434ea5[_0x1edc('0x18')]?_0x434ea5[_0x1edc('0x18')][_0x1edc('0x1d')]?_['map'](_0x434ea5['options']['include'],function(_0x5517c5){return{'model':db[_0x5517c5[_0x1edc('0x1f')]],'as':_0x5517c5['as'],'attributes':_0x5517c5[_0x1edc('0x1b')],'include':_0x5517c5['include']?_[_0x1edc('0x1e')](_0x5517c5[_0x1edc('0x1d')],function(_0x457837){return{'model':db[_0x457837['model']],'as':_0x457837['as'],'attributes':_0x457837[_0x1edc('0x1b')],'include':_0x457837['include']?_[_0x1edc('0x1e')](_0x457837['include'],function(_0x2bef9e){return{'model':db[_0x2bef9e[_0x1edc('0x1f')]],'as':_0x2bef9e['as'],'attributes':_0x2bef9e[_0x1edc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1edc('0xb')](function(_0x120f1a){logger[_0x1edc('0xc')](_0x1edc('0x21'),_0x434ea5);logger[_0x1edc('0xd')](_0x1edc('0x21'),_0x434ea5,JSON[_0x1edc('0x10')](_0x120f1a));_0x130d86(_0x120f1a);})[_0x1edc('0x15')](function(_0x4ecb62){logger[_0x1edc('0x11')](_0x1edc('0x21'),_0x4ecb62[_0x1edc('0x13')],_0x434ea5);_0x4c1628(_0x16ef8e[_0x1edc('0x11')](0x1f4,_0x4ecb62[_0x1edc('0x13')]));});});}; \ No newline at end of file +var _0xfeba=['Trigger,\x20%s,\x20%s,\x20%s','error','Trigger,\x20%s,\x20%s','message','request\x20sent','result','catch','Trigger','findAll','options','raw','where','attributes','include','map','model','GetTrigger','stringify','ShowTrigger','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug'];(function(_0x2c00ab,_0x7ff8de){var _0xbe2216=function(_0x2393e0){while(--_0x2393e0){_0x2c00ab['push'](_0x2c00ab['shift']());}};_0xbe2216(++_0x7ff8de);}(_0xfeba,0x1cd));var _0xafeb=function(_0x21974e,_0x57d7a2){_0x21974e=_0x21974e-0x0;var _0x3e65a5=_0xfeba[_0x21974e];return _0x3e65a5;};'use strict';var _=require(_0xafeb('0x0'));var util=require(_0xafeb('0x1'));var moment=require(_0xafeb('0x2'));var BPromise=require(_0xafeb('0x3'));var rs=require(_0xafeb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafeb('0x5'))['db'];var utils=require(_0xafeb('0x6'));var logger=require(_0xafeb('0x7'))('rpc');var config=require(_0xafeb('0x8'));var jayson=require(_0xafeb('0x9'));var client=jayson[_0xafeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa34f8c,_0xc6e50a,_0x23e126){return new BPromise(function(_0x1b21f8,_0x3d4b18){return client[_0xafeb('0xb')](_0xa34f8c,_0x23e126)[_0xafeb('0xc')](function(_0x5b3a81){logger[_0xafeb('0xd')]('Trigger,\x20%s,\x20%s',_0xc6e50a,'request\x20sent');logger[_0xafeb('0xe')](_0xafeb('0xf'),_0xc6e50a,'request\x20sent',JSON['stringify'](_0x5b3a81));if(_0x5b3a81[_0xafeb('0x10')]){if(_0x5b3a81[_0xafeb('0x10')]['code']===0x1f4){logger[_0xafeb('0x10')](_0xafeb('0x11'),_0xc6e50a,_0x5b3a81[_0xafeb('0x10')][_0xafeb('0x12')]);return _0x3d4b18(_0x5b3a81[_0xafeb('0x10')][_0xafeb('0x12')]);}logger[_0xafeb('0x10')](_0xafeb('0x11'),_0xc6e50a,_0x5b3a81[_0xafeb('0x10')][_0xafeb('0x12')]);return _0x1b21f8(_0x5b3a81['error'][_0xafeb('0x12')]);}else{logger['info'](_0xafeb('0x11'),_0xc6e50a,_0xafeb('0x13'));_0x1b21f8(_0x5b3a81[_0xafeb('0x14')][_0xafeb('0x12')]);}})[_0xafeb('0x15')](function(_0x4b3b72){logger[_0xafeb('0x10')](_0xafeb('0x11'),_0xc6e50a,_0x4b3b72);_0x3d4b18(_0x4b3b72);});});}exports['GetTrigger']=function(_0x599067){var _0x423bc1=this;return new Promise(function(_0x141afe,_0x398c60){return db[_0xafeb('0x16')][_0xafeb('0x17')]({'raw':_0x599067['options']?_0x599067[_0xafeb('0x18')][_0xafeb('0x19')]===undefined?!![]:![]:!![],'where':_0x599067[_0xafeb('0x18')]?_0x599067[_0xafeb('0x18')][_0xafeb('0x1a')]||null:null,'attributes':_0x599067[_0xafeb('0x18')]?_0x599067[_0xafeb('0x18')][_0xafeb('0x1b')]||null:null,'limit':_0x599067[_0xafeb('0x18')]?_0x599067[_0xafeb('0x18')]['limit']||null:null,'include':_0x599067['options']?_0x599067[_0xafeb('0x18')][_0xafeb('0x1c')]?_[_0xafeb('0x1d')](_0x599067['options'][_0xafeb('0x1c')],function(_0x331fe1){return{'model':db[_0x331fe1[_0xafeb('0x1e')]],'as':_0x331fe1['as'],'attributes':_0x331fe1[_0xafeb('0x1b')],'include':_0x331fe1[_0xafeb('0x1c')]?_[_0xafeb('0x1d')](_0x331fe1['include'],function(_0x2b1b52){return{'model':db[_0x2b1b52['model']],'as':_0x2b1b52['as'],'attributes':_0x2b1b52[_0xafeb('0x1b')],'include':_0x2b1b52[_0xafeb('0x1c')]?_[_0xafeb('0x1d')](_0x2b1b52['include'],function(_0x255cdf){return{'model':db[_0x255cdf[_0xafeb('0x1e')]],'as':_0x255cdf['as'],'attributes':_0x255cdf['attributes']};}):[]};}):[]};}):[]:[]})[_0xafeb('0xc')](function(_0x288aa8){logger['info']('GetTrigger',_0x599067);logger[_0xafeb('0xe')](_0xafeb('0x1f'),_0x599067,JSON[_0xafeb('0x20')](_0x288aa8));_0x141afe(_0x288aa8);})[_0xafeb('0x15')](function(_0x5ef8af){logger[_0xafeb('0x10')](_0xafeb('0x1f'),_0x5ef8af[_0xafeb('0x12')],_0x599067);_0x398c60(_0x423bc1['error'](0x1f4,_0x5ef8af[_0xafeb('0x12')]));});});};exports['ShowTrigger']=function(_0x4a08d7){var _0x1ae2f1=this;return new Promise(function(_0x47118a,_0x38eb58){return db[_0xafeb('0x16')]['find']({'raw':_0x4a08d7[_0xafeb('0x18')]?_0x4a08d7['options'][_0xafeb('0x19')]===undefined?!![]:![]:!![],'where':_0x4a08d7[_0xafeb('0x18')]?_0x4a08d7[_0xafeb('0x18')]['where']||null:null,'attributes':_0x4a08d7[_0xafeb('0x18')]?_0x4a08d7[_0xafeb('0x18')]['attributes']||null:null,'include':_0x4a08d7['options']?_0x4a08d7[_0xafeb('0x18')][_0xafeb('0x1c')]?_[_0xafeb('0x1d')](_0x4a08d7['options']['include'],function(_0x4b6d5a){return{'model':db[_0x4b6d5a['model']],'as':_0x4b6d5a['as'],'attributes':_0x4b6d5a[_0xafeb('0x1b')],'include':_0x4b6d5a[_0xafeb('0x1c')]?_['map'](_0x4b6d5a[_0xafeb('0x1c')],function(_0x154f79){return{'model':db[_0x154f79[_0xafeb('0x1e')]],'as':_0x154f79['as'],'attributes':_0x154f79[_0xafeb('0x1b')],'include':_0x154f79['include']?_[_0xafeb('0x1d')](_0x154f79[_0xafeb('0x1c')],function(_0x4403a4){return{'model':db[_0x4403a4[_0xafeb('0x1e')]],'as':_0x4403a4['as'],'attributes':_0x4403a4[_0xafeb('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a57df){logger[_0xafeb('0xd')]('ShowTrigger',_0x4a08d7);logger['debug'](_0xafeb('0x21'),_0x4a08d7,JSON[_0xafeb('0x20')](_0x3a57df));_0x47118a(_0x3a57df);})[_0xafeb('0x15')](function(_0x41a6ee){logger[_0xafeb('0x10')](_0xafeb('0x21'),_0x41a6ee[_0xafeb('0x12')],_0x4a08d7);_0x38eb58(_0x1ae2f1[_0xafeb('0x10')](0x1f4,_0x41a6ee[_0xafeb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index da04b48..058d6c8 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 _0xd0e9=['fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xd0e9,0x13f));var _0x9d0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0e9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9d0e('0x0'));var util=require(_0x9d0e('0x1'));var path=require(_0x9d0e('0x2'));var timeout=require(_0x9d0e('0x3'));var express=require(_0x9d0e('0x4'));var router=express['Router']();var fs_extra=require(_0x9d0e('0x5'));var auth=require(_0x9d0e('0x6'));var interaction=require(_0x9d0e('0x7'));var config=require('../../config/environment');var controller=require(_0x9d0e('0x8'));router[_0x9d0e('0x9')]('/',auth[_0x9d0e('0xa')](),controller[_0x9d0e('0xb')]);router[_0x9d0e('0x9')](_0x9d0e('0xc'),auth[_0x9d0e('0xa')](),controller[_0x9d0e('0xd')]);router[_0x9d0e('0xe')]('/:id/clone',auth[_0x9d0e('0xa')](),controller['clone']);router[_0x9d0e('0xe')]('/',auth[_0x9d0e('0xa')](),controller[_0x9d0e('0xf')]);router['put'](_0x9d0e('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9d0e('0xc'),auth[_0x9d0e('0xa')](),controller[_0x9d0e('0x10')]);module[_0x9d0e('0x11')]=router; \ No newline at end of file +var _0xb88c=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./trunk.controller','index','get','isAuthenticated','post','/:id/clone','clone','create','put','/:id','update','delete'];(function(_0x38a7df,_0x185ae2){var _0x1816d4=function(_0x53e173){while(--_0x53e173){_0x38a7df['push'](_0x38a7df['shift']());}};_0x1816d4(++_0x185ae2);}(_0xb88c,0x1bb));var _0xcb88=function(_0x32cf9b,_0x4b0dca){_0x32cf9b=_0x32cf9b-0x0;var _0x3af8c6=_0xb88c[_0x32cf9b];return _0x3af8c6;};'use strict';var multer=require(_0xcb88('0x0'));var util=require(_0xcb88('0x1'));var path=require(_0xcb88('0x2'));var timeout=require(_0xcb88('0x3'));var express=require(_0xcb88('0x4'));var router=express['Router']();var fs_extra=require(_0xcb88('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcb88('0x6'));var controller=require(_0xcb88('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcb88('0x8')]);router[_0xcb88('0x9')]('/:id',auth[_0xcb88('0xa')](),controller['show']);router[_0xcb88('0xb')](_0xcb88('0xc'),auth[_0xcb88('0xa')](),controller[_0xcb88('0xd')]);router[_0xcb88('0xb')]('/',auth[_0xcb88('0xa')](),controller[_0xcb88('0xe')]);router[_0xcb88('0xf')](_0xcb88('0x10'),auth[_0xcb88('0xa')](),controller[_0xcb88('0x11')]);router[_0xcb88('0x12')](_0xcb88('0x10'),auth['isAuthenticated'](),controller[_0xcb88('0x13')]);module[_0xcb88('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 7e11c1b..b51d0c1 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 _0xd632=['shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','certificate','active','actpass','dynamic','update,nonat','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','rfc2833','info'];(function(_0x397cd0,_0x3dac52){var _0x2e08d0=function(_0x17d6ab){while(--_0x17d6ab){_0x397cd0['push'](_0x397cd0['shift']());}};_0x2e08d0(++_0x3dac52);}(_0xd632,0x87));var _0x2d63=function(_0x3c3b01,_0xbaa847){_0x3c3b01=_0x3c3b01-0x0;var _0xda6617=_0xd632[_0x3c3b01];return _0xda6617;};'use strict';var Sequelize=require('sequelize');module[_0x2d63('0x0')]={'name':{'type':Sequelize[_0x2d63('0x1')],'allowNull':![],'unique':_0x2d63('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x4'),_0x2d63('0x5'),_0x2d63('0x6')),'allowNull':![],'defaultValue':_0x2d63('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2d63('0x7')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x2d63('0x8'),'ALLOWED_FAILED_SCREEN',_0x2d63('0x9'),_0x2d63('0xa'),_0x2d63('0xb'),_0x2d63('0xc'),_0x2d63('0xd'))},'deny':{'type':Sequelize[_0x2d63('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x2d63('0x1')]},'md5secret':{'type':Sequelize[_0x2d63('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x2d63('0x1')],'defaultValue':_0x2d63('0xe'),'set':function(_0x54b44c){this[_0x2d63('0xf')](_0x2d63('0x10'),_0x54b44c?_0x54b44c['join'](','):null);},'get':function(){return this[_0x2d63('0x11')](_0x2d63('0x10'))?this[_0x2d63('0x11')](_0x2d63('0x10'))[_0x2d63('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x13'),_0x2d63('0x14'),_0x2d63('0x15'),_0x2d63('0x16'),_0x2d63('0x17')),'defaultValue':_0x2d63('0x13')},'directmedia':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no',_0x2d63('0x19'),_0x2d63('0x1a'),_0x2d63('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2d63('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2d63('0x1')]},'directmediadeny':{'type':Sequelize[_0x2d63('0x1')]},'nat':{'type':Sequelize[_0x2d63('0x1')],'defaultValue':_0x2d63('0x1c'),'set':function(_0x275f68){this[_0x2d63('0xf')](_0x2d63('0x1d'),_0x275f68?_0x275f68[_0x2d63('0x1e')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x2d63('0x11')](_0x2d63('0x1d'))['split'](','):null;},'comment':_0x2d63('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2d63('0x1')]},'pickupgroup':{'type':Sequelize[_0x2d63('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x2d63('0x1')]},'language':{'type':Sequelize[_0x2d63('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2d63('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2d63('0x1')],'defaultValue':_0x2d63('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2d63('0x21'),'set':function(_0x3745dc){this[_0x2d63('0xf')](_0x2d63('0x22'),_0x3745dc?_0x3745dc[_0x2d63('0x1e')](';'):_0x2d63('0x21'));},'get':function(){return this[_0x2d63('0x11')](_0x2d63('0x22'))?this[_0x2d63('0x11')](_0x2d63('0x22'))[_0x2d63('0x12')](';'):null;},'comment':_0x2d63('0x23')},'autoframing':{'type':Sequelize['ENUM'](_0x2d63('0x18'),'no')},'insecure':{'type':Sequelize[_0x2d63('0x1')],'defaultValue':'port,invite','set':function(_0x46bf4a){this[_0x2d63('0xf')](_0x2d63('0x24'),_0x46bf4a?_0x46bf4a[_0x2d63('0x1e')](','):null);},'get':function(){return this['getDataValue'](_0x2d63('0x24'))?this[_0x2d63('0x11')](_0x2d63('0x24'))['split'](','):null;},'comment':_0x2d63('0x25')},'trustrpid':{'type':Sequelize['ENUM'](_0x2d63('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2d63('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no',_0x2d63('0x26'))},'promiscredir':{'type':Sequelize[_0x2d63('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no')},'accountcode':{'type':Sequelize[_0x2d63('0x27')](0xb)},'setvar':{'type':Sequelize[_0x2d63('0x1')]},'callerid':{'type':Sequelize[_0x2d63('0x1')],'defaultValue':_0x2d63('0x28')},'amaflags':{'type':Sequelize[_0x2d63('0x1')]},'callcounter':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no'),'defaultValue':_0x2d63('0x18')},'busylevel':{'type':Sequelize[_0x2d63('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x2d63('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x2d63('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x2d63('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x2d63('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no',_0x2d63('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2d63('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2d63('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x2d63('0x1')]},'session_timers':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x2a'),_0x2d63('0x2b'),'originate')},'session_expires':{'type':Sequelize[_0x2d63('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x2d63('0x27')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2d63('0x2c'),_0x2d63('0x2d')),'defaultValue':_0x2d63('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x2d63('0x1')]},'regexten':{'type':Sequelize[_0x2d63('0x1')]},'fromdomain':{'type':Sequelize[_0x2d63('0x1')]},'fromuser':{'type':Sequelize[_0x2d63('0x1')]},'port':{'type':Sequelize[_0x2d63('0x27')](0x5)},'qualify':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no'),'defaultValue':_0x2d63('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x2d63('0x1')]},'rtptimeout':{'type':Sequelize[_0x2d63('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2d63('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2d63('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no',_0x2d63('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2d63('0x1')]},'callbackextension':{'type':Sequelize[_0x2d63('0x1')]},'timert1':{'type':Sequelize[_0x2d63('0x27')](0xb)},'timerb':{'type':Sequelize[_0x2d63('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2d63('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2d63('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x2d63('0x1')]},'use_q850_reason':{'type':Sequelize[_0x2d63('0x1')]},'maxforwards':{'type':Sequelize[_0x2d63('0x27')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x2d63('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2d63('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x2d63('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x2d63('0x3')]('yes','no','fingerprint',_0x2d63('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x2d63('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2d63('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x2d63('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x2d63('0x1')]},'dtlssetup':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x30'),'passive',_0x2d63('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2d63('0x1')]},'usereqphone':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x2d63('0x1')]},'call_limit':{'type':Sequelize[_0x2d63('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x2d63('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x2d63('0x1')]},'mohinterpret':{'type':Sequelize[_0x2d63('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2d63('0x1')],'defaultValue':_0x2d63('0x32')},'canreinvite':{'type':Sequelize[_0x2d63('0x3')](_0x2d63('0x18'),'no',_0x2d63('0x19'),'update',_0x2d63('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x2d63('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2d63('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xa35b=['outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','uac','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','yes','nonat','update'];(function(_0x31518e,_0x22dc17){var _0x3e5412=function(_0x46da04){while(--_0x46da04){_0x31518e['push'](_0x31518e['shift']());}};_0x3e5412(++_0x22dc17);}(_0xa35b,0xd7));var _0xba35=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa35b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xba35('0x0'));module[_0xba35('0x1')]={'name':{'type':Sequelize[_0xba35('0x2')],'allowNull':![],'unique':_0xba35('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xba35('0x4')]('friend','user',_0xba35('0x5')),'allowNull':![],'defaultValue':_0xba35('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba35('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xba35('0x8'),_0xba35('0x9'),_0xba35('0xa'),'ALLOWED',_0xba35('0xb'),_0xba35('0xc'),_0xba35('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0xba35('0x2')]},'permit':{'type':Sequelize[_0xba35('0x2')]},'secret':{'type':Sequelize[_0xba35('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xba35('0x2')]},'transport':{'type':Sequelize[_0xba35('0x2')],'defaultValue':_0xba35('0xe'),'set':function(_0x4bcecf){this[_0xba35('0xf')]('transport',_0x4bcecf?_0x4bcecf[_0xba35('0x10')](','):null);},'get':function(){return this[_0xba35('0x11')](_0xba35('0x12'))?this[_0xba35('0x11')](_0xba35('0x12'))[_0xba35('0x13')](','):null;},'comment':_0xba35('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0xba35('0x15'),'info','shortinfo','inband','auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xba35('0x16'),'no',_0xba35('0x17'),_0xba35('0x18'),_0xba35('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xba35('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xba35('0x2')]},'directmediadeny':{'type':Sequelize[_0xba35('0x2')]},'nat':{'type':Sequelize[_0xba35('0x2')],'defaultValue':_0xba35('0x1a'),'set':function(_0x6253b8){this[_0xba35('0xf')](_0xba35('0x1b'),_0x6253b8?_0x6253b8[_0xba35('0x10')](','):null);},'get':function(){return this[_0xba35('0x11')](_0xba35('0x1b'))?this[_0xba35('0x11')]('nat')['split'](','):null;},'comment':_0xba35('0x1c')},'callgroup':{'type':Sequelize[_0xba35('0x2')]},'namedcallgroup':{'type':Sequelize[_0xba35('0x2')]},'pickupgroup':{'type':Sequelize[_0xba35('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xba35('0x2')]},'language':{'type':Sequelize[_0xba35('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xba35('0x2')],'defaultValue':_0xba35('0x1d')},'allow':{'type':Sequelize[_0xba35('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x8849d7){this[_0xba35('0xf')](_0xba35('0x1e'),_0x8849d7?_0x8849d7[_0xba35('0x10')](';'):_0xba35('0x1f'));},'get':function(){return this[_0xba35('0x11')](_0xba35('0x1e'))?this['getDataValue'](_0xba35('0x1e'))['split'](';'):null;},'comment':_0xba35('0x20')},'autoframing':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no')},'insecure':{'type':Sequelize[_0xba35('0x2')],'defaultValue':_0xba35('0x21'),'set':function(_0x1b3980){this[_0xba35('0xf')]('insecure',_0x1b3980?_0x1b3980[_0xba35('0x10')](','):null);},'get':function(){return this[_0xba35('0x11')](_0xba35('0x22'))?this[_0xba35('0x11')](_0xba35('0x22'))[_0xba35('0x13')](','):null;},'comment':_0xba35('0x23')},'trustrpid':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xba35('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no',_0xba35('0x24'))},'promiscredir':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no')},'accountcode':{'type':Sequelize[_0xba35('0x25')](0xb)},'setvar':{'type':Sequelize[_0xba35('0x2')]},'callerid':{'type':Sequelize[_0xba35('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xba35('0x2')]},'callcounter':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xba35('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xba35('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no',_0xba35('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xba35('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xba35('0x16'),'no')},'mailbox':{'type':Sequelize[_0xba35('0x2')]},'session_timers':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x27'),'refuse','originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xba35('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xba35('0x28'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xba35('0x2')]},'fromdomain':{'type':Sequelize[_0xba35('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xba35('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xba35('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xba35('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xba35('0x2')]},'defaultuser':{'type':Sequelize[_0xba35('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xba35('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xba35('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xba35('0x4')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xba35('0x2')]},'callbackextension':{'type':Sequelize[_0xba35('0x2')]},'timert1':{'type':Sequelize[_0xba35('0x25')](0xb)},'timerb':{'type':Sequelize[_0xba35('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xba35('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xba35('0x2')]},'contactacl':{'type':Sequelize[_0xba35('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xba35('0x2')]},'use_q850_reason':{'type':Sequelize[_0xba35('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xba35('0x16'),'no')},'icesupport':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xba35('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no',_0xba35('0x29'),_0xba35('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xba35('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xba35('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xba35('0x2')]},'dtlscipher':{'type':Sequelize[_0xba35('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xba35('0x2')]},'dtlssetup':{'type':Sequelize[_0xba35('0x4')]('active',_0xba35('0x2b'),_0xba35('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xba35('0x2')]},'usereqphone':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xba35('0x2')]},'recordofffeature':{'type':Sequelize[_0xba35('0x2')]},'call_limit':{'type':Sequelize[_0xba35('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xba35('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no')},'vmexten':{'type':Sequelize[_0xba35('0x2')]},'mohinterpret':{'type':Sequelize[_0xba35('0x2')]},'mohsuggest':{'type':Sequelize[_0xba35('0x2')]},'parkinglot':{'type':Sequelize[_0xba35('0x2')]},'description':{'type':Sequelize[_0xba35('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xba35('0x2d')},'canreinvite':{'type':Sequelize[_0xba35('0x4')](_0xba35('0x16'),'no',_0xba35('0x17'),_0xba35('0x18'),_0xba35('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xba35('0x2')]},'otherFields':{'type':Sequelize[_0xba35('0x2')]},'active':{'type':Sequelize[_0xba35('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xba35('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 748d5e5..2131bed 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 _0x9957=['clone','includeAll','merge','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','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','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','Trunk','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','include','rows','show','params','find'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_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'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('Trunk,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=typeof _0x2a307e['offset']===_0x7995('0x2e')&&typeof _0x2a307e[_0x7995('0x2f')]===_0x7995('0x2e');var _0x132a42=_0x56691a[_0x7995('0x30')];var _0x4b6f99=_0x47625f?0x0:_0x2a307e[_0x7995('0x31')];var _0x514445=_0x47625f?_0x56691a[_0x7995('0x30')]:_0x2a307e[_0x7995('0x31')]+_0x2a307e[_0x7995('0x2f')];var _0x574574;if(_0x514445>=_0x132a42){_0x514445=_0x132a42;_0x574574=0xc8;}else{_0x574574=0xce;}_0x3a3fcf['status'](_0x574574);return _0x3a3fcf['set'](_0x7995('0x32'),_0x4b6f99+'-'+_0x514445+'/'+_0x132a42)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x327a81){return function(_0x2b874d){try{jsonpatch[_0x7995('0x33')](_0x2b874d,_0x327a81,!![]);}catch(_0x1ca460){return BPromise['reject'](_0x1ca460);}return _0x2b874d['save']();};}function saveUpdates(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')](_0xfa8f15)[_0x7995('0x1f')](function(_0x1e9fa4){return _0x1e9fa4;});}return null;};}function removeEntity(_0x1f7d27,_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x35')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x36');return db['UserProfileResource'][_0x7995('0x35')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1f')](function(){_0x1f7d27[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x5014d2,_0x52d76d){return function(_0x36d057){if(!_0x36d057){_0x5014d2['sendStatus'](0x194);}return _0x36d057;};}function handleError(_0x5d2428,_0x3e99cd){_0x3e99cd=_0x3e99cd||0x1f4;return function(_0xe328b1){logger['error'](_0xe328b1[_0x7995('0x37')]);if(_0xe328b1[_0x7995('0x38')]){delete _0xe328b1[_0x7995('0x38')];}_0x5d2428[_0x7995('0x2b')](_0x3e99cd)[_0x7995('0x39')](_0xe328b1);};}exports['index']=function(_0x2d4285,_0x242713){var _0xf612e6={},_0x1d60b8={},_0x4b1541={'count':0x0,'rows':[]};var _0x2be2c0=_[_0x7995('0x3a')](db[_0x7995('0x3b')][_0x7995('0x3c')],function(_0x1f5bee){return{'name':_0x1f5bee[_0x7995('0x3d')],'type':_0x1f5bee['type'][_0x7995('0x3e')]};});_0x1d60b8[_0x7995('0x3f')]=_[_0x7995('0x3a')](_0x2be2c0,_0x7995('0x38'));_0x1d60b8[_0x7995('0x40')]=_[_0x7995('0x41')](_0x2d4285[_0x7995('0x40')]);_0x1d60b8[_0x7995('0x42')]=_[_0x7995('0x43')](_0x1d60b8[_0x7995('0x3f')],_0x1d60b8[_0x7995('0x40')]);_0xf612e6[_0x7995('0x44')]=_[_0x7995('0x43')](_0x1d60b8['model'],qs['fields'](_0x2d4285[_0x7995('0x40')][_0x7995('0x45')]));_0xf612e6['attributes']=_0xf612e6['attributes'][_0x7995('0x46')]?_0xf612e6['attributes']:_0x1d60b8['model'];if(!_0x2d4285[_0x7995('0x40')][_0x7995('0x47')](_0x7995('0x48'))){_0xf612e6['limit']=qs[_0x7995('0x2f')](_0x2d4285['query'][_0x7995('0x2f')]);_0xf612e6['offset']=qs['offset'](_0x2d4285[_0x7995('0x40')][_0x7995('0x31')]);}_0xf612e6[_0x7995('0x49')]=qs[_0x7995('0x4a')](_0x2d4285['query'][_0x7995('0x4a')]);_0xf612e6[_0x7995('0x4b')]=qs[_0x7995('0x42')](_[_0x7995('0x4c')](_0x2d4285['query'],_0x1d60b8['filters']),_0x2be2c0);if(_0x2d4285[_0x7995('0x40')]['filter']){_0xf612e6[_0x7995('0x4b')]=_['merge'](_0xf612e6[_0x7995('0x4b')],{'$or':_['map'](_0x2be2c0,function(_0x1e795e){if(_0x1e795e[_0x7995('0x4d')]!=='VIRTUAL'){var _0x3e9e62={};_0x3e9e62[_0x1e795e[_0x7995('0x38')]]={'$like':'%'+_0x2d4285[_0x7995('0x40')][_0x7995('0x4e')]+'%'};return _0x3e9e62;}})});}_0xf612e6=_['merge']({},_0xf612e6,_0x2d4285[_0x7995('0x4f')]);var _0x3e787d={'where':_0xf612e6[_0x7995('0x4b')]};return db['Trunk'][_0x7995('0x30')](_0x3e787d)[_0x7995('0x1f')](function(_0x511567){_0x4b1541[_0x7995('0x30')]=_0x511567;if(_0x2d4285[_0x7995('0x40')]['includeAll']){_0xf612e6[_0x7995('0x50')]=[{'all':!![]}];}return db[_0x7995('0x3b')]['findAll'](_0xf612e6);})[_0x7995('0x1f')](function(_0x5843ba){_0x4b1541[_0x7995('0x51')]=_0x5843ba;return _0x4b1541;})[_0x7995('0x1f')](respondWithFilteredResult(_0x242713,_0xf612e6))[_0x7995('0x29')](handleError(_0x242713,null));};exports[_0x7995('0x52')]=function(_0xddf537,_0x14b537){var _0x1579b9={'raw':![],'where':{'id':_0xddf537[_0x7995('0x53')]['id']}},_0x4d46bc={};_0x4d46bc[_0x7995('0x3f')]=_[_0x7995('0x41')](db['Trunk'][_0x7995('0x3c')]);_0x4d46bc[_0x7995('0x40')]=_[_0x7995('0x41')](_0xddf537['query']);_0x4d46bc['filters']=_['intersection'](_0x4d46bc[_0x7995('0x3f')],_0x4d46bc[_0x7995('0x40')]);_0x1579b9['attributes']=_[_0x7995('0x43')](_0x4d46bc[_0x7995('0x3f')],qs[_0x7995('0x45')](_0xddf537[_0x7995('0x40')][_0x7995('0x45')]));_0x1579b9['attributes']=_0x1579b9[_0x7995('0x44')]['length']?_0x1579b9[_0x7995('0x44')]:_0x4d46bc[_0x7995('0x3f')];if(_0xddf537[_0x7995('0x40')]['includeAll']){_0x1579b9['include']=[{'all':!![]}];}_0x1579b9=_['merge']({},_0x1579b9,_0xddf537['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x1579b9)[_0x7995('0x1f')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x1f')](respondWithResult(_0x14b537,null))[_0x7995('0x29')](handleError(_0x14b537,null));};exports[_0x7995('0x55')]=function(_0x1f4270,_0xda6ce8){var _0x328671={'where':{'id':_0x1f4270[_0x7995('0x53')]['id']}},_0x17ecd3={};_0x17ecd3[_0x7995('0x3f')]=_[_0x7995('0x41')](db[_0x7995('0x3b')][_0x7995('0x3c')]);_0x328671[_0x7995('0x44')]=_[_0x7995('0x43')](_0x17ecd3[_0x7995('0x3f')],qs[_0x7995('0x45')](_0x1f4270['query'][_0x7995('0x45')]));_0x328671[_0x7995('0x44')]=_0x328671[_0x7995('0x44')][_0x7995('0x46')]?_0x328671['attributes']:_0x17ecd3['model'];if(_0x1f4270[_0x7995('0x40')][_0x7995('0x56')]){_0x328671[_0x7995('0x50')]=[{'all':!![]}];}_0x328671=_[_0x7995('0x57')]({},_0x328671,_0x1f4270['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x328671)[_0x7995('0x1f')](handleEntityNotFound(_0xda6ce8,null))[_0x7995('0x1f')](function(_0x502d43){if(_0x502d43){var _0x5e2d97=_0x502d43[_0x7995('0x58')]({'plain':!![]});_0x5e2d97=qs[_0x7995('0x59')](_0x5e2d97,['id',_0x7995('0x5a'),_0x7995('0x5b')]);_0x1f4270[_0x7995('0x5c')]=_[_0x7995('0x59')](_0x1f4270[_0x7995('0x5c')],['id',_0x7995('0x5a'),_0x7995('0x5b')]);return db['Trunk'][_0x7995('0x5d')](_[_0x7995('0x57')](_0x5e2d97,_0x1f4270[_0x7995('0x5c')]),{'include':_0x1f4270[_0x7995('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3053fd){var _0xebb5c8=_0x1f4270['user'][_0x7995('0x58')]({'plain':!![]});if(!_0xebb5c8)throw new Error(_0x7995('0x5e'));if(_0xebb5c8[_0x7995('0x5f')]===_0x7995('0x60')){var _0x32cb04=_0x3053fd['get']({'plain':!![]});var _0x457d09='Trunks';return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':_0x457d09,'userProfileId':_0xebb5c8[_0x7995('0x62')]},'raw':!![]})[_0x7995('0x1f')](function(_0x4388c1){if(_0x4388c1&&_0x4388c1[_0x7995('0x63')]===0x0){return db[_0x7995('0x64')][_0x7995('0x5d')]({'name':_0x32cb04[_0x7995('0x38')],'resourceId':_0x32cb04['id'],'type':_0x4388c1[_0x7995('0x38')],'sectionId':_0x4388c1['id']},{})[_0x7995('0x1f')](function(){return _0x3053fd;});}else{return _0x3053fd;}})[_0x7995('0x29')](function(_0x56eb85){logger[_0x7995('0x25')](_0x7995('0x65'),_0x56eb85);throw _0x56eb85;});}return _0x3053fd;});}})[_0x7995('0x1f')](respondWithResult(_0xda6ce8,0xc9))[_0x7995('0x29')](handleError(_0xda6ce8,null));};exports[_0x7995('0x5d')]=function(_0x54a2e0,_0x4b54f2,_0x268fde){var _0x87e38d;return db[_0x7995('0x3b')][_0x7995('0x5d')](_0x54a2e0['body'],{'raw':!![]})[_0x7995('0x1f')](function(_0x50a12e){_0x87e38d=_0x50a12e;return db['Trunk'][_0x7995('0x66')]({'raw':!![]});})[_0x7995('0x1f')](function(_0x3f0a71){var _0x44bf2b=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x2466df=fs['readFileSync'](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6c')),'utf8');var _0x1fe1cb=ejs[_0x7995('0x6d')](_0x44bf2b,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x1fe1cb);if(_0x87e38d[_0x7995('0x70')]){var _0x51ab1e=ejs[_0x7995('0x6d')](_0x2466df,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x51ab1e);}})[_0x7995('0x1f')](function(){return respondWithRpcPromise(_0x7995('0x72'),'create',{'module':'chan_sip.so'});})[_0x7995('0x1f')](function(){var _0xfe1105=_0x54a2e0[_0x7995('0x60')][_0x7995('0x58')]({'plain':!![]});if(!_0xfe1105)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfe1105[_0x7995('0x5f')]===_0x7995('0x60')){var _0x54b955=_0x87e38d['get']({'plain':!![]});return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':'Trunks','userProfileId':_0xfe1105[_0x7995('0x62')]},'raw':!![]})['then'](function(_0x3758f9){if(_0x3758f9&&_0x3758f9[_0x7995('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x54b955[_0x7995('0x38')],'resourceId':_0x54b955['id'],'type':_0x3758f9['name'],'sectionId':_0x3758f9['id']},{})[_0x7995('0x1f')](function(){return _0x87e38d;});}else{return _0x87e38d;}})[_0x7995('0x29')](function(_0x3dd197){logger[_0x7995('0x25')](_0x7995('0x65'),_0x3dd197);throw _0x3dd197;});}return _0x87e38d;})[_0x7995('0x1f')](respondWithResult(_0x4b54f2,0xc9))[_0x7995('0x29')](handleError(_0x4b54f2,null));};exports[_0x7995('0x34')]=function(_0x29e0ee,_0x117317,_0x1ab590){var _0x16108c;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x29e0ee[_0x7995('0x53')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x117317,null))[_0x7995('0x1f')](saveUpdates(_0x29e0ee[_0x7995('0x5c')],null))[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x16108c=_0xa2fc8e;return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});}})[_0x7995('0x1f')](function(_0x280fbb){if(_0x280fbb){var _0x260ef1=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/trunk.ejs'),_0x7995('0x6b'));var _0x10f4ca=fs['readFileSync'](path['join'](config[_0x7995('0x69')],_0x7995('0x6c')),_0x7995('0x6b'));var _0x38acda=ejs[_0x7995('0x6d')](_0x260ef1,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x38acda);var _0x2f8a2d=ejs[_0x7995('0x6d')](_0x10f4ca,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x2f8a2d);return respondWithRpcPromise(_0x7995('0x72'),_0x7995('0x34'),{'module':_0x7995('0x73')});}return null;})[_0x7995('0x1f')](function(_0x560095){if(_0x560095){return _0x16108c;}})[_0x7995('0x1f')](respondWithResult(_0x117317,null))[_0x7995('0x29')](handleError(_0x117317,null));};exports['destroy']=function(_0x479271,_0xd24c64,_0xf8c2ed){var _0x18e1a2;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x479271['params']['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0xd24c64,null))[_0x7995('0x1f')](removeEntity(_0xd24c64,null))['then'](function(){return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});})['then'](function(_0x1535a3){var _0x4a5bc5=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x5d16da=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/registry.ejs'),_0x7995('0x6b'));var _0x3f3434=ejs[_0x7995('0x6d')](_0x4a5bc5,{'trunks':_0x1535a3});var _0x308a26=ejs['render'](_0x5d16da,{'trunks':_0x1535a3});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x3f3434);fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_registers.conf',_0x308a26);return respondWithRpcPromise('Reload',_0x7995('0x35'),{'module':_0x7995('0x73')});})['catch'](handleError(_0xd24c64,null));}; \ No newline at end of file +var _0x9957=['clone','includeAll','merge','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','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','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','Trunk','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','include','rows','show','params','find'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_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'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('Trunk,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=typeof _0x2a307e['offset']===_0x7995('0x2e')&&typeof _0x2a307e[_0x7995('0x2f')]===_0x7995('0x2e');var _0x132a42=_0x56691a[_0x7995('0x30')];var _0x4b6f99=_0x47625f?0x0:_0x2a307e[_0x7995('0x31')];var _0x514445=_0x47625f?_0x56691a[_0x7995('0x30')]:_0x2a307e[_0x7995('0x31')]+_0x2a307e[_0x7995('0x2f')];var _0x574574;if(_0x514445>=_0x132a42){_0x514445=_0x132a42;_0x574574=0xc8;}else{_0x574574=0xce;}_0x3a3fcf['status'](_0x574574);return _0x3a3fcf['set'](_0x7995('0x32'),_0x4b6f99+'-'+_0x514445+'/'+_0x132a42)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x327a81){return function(_0x2b874d){try{jsonpatch[_0x7995('0x33')](_0x2b874d,_0x327a81,!![]);}catch(_0x1ca460){return BPromise['reject'](_0x1ca460);}return _0x2b874d['save']();};}function saveUpdates(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')](_0xfa8f15)[_0x7995('0x1f')](function(_0x1e9fa4){return _0x1e9fa4;});}return null;};}function removeEntity(_0x1f7d27,_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x35')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x36');return db['UserProfileResource'][_0x7995('0x35')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1f')](function(){_0x1f7d27[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x5014d2,_0x52d76d){return function(_0x36d057){if(!_0x36d057){_0x5014d2['sendStatus'](0x194);}return _0x36d057;};}function handleError(_0x5d2428,_0x3e99cd){_0x3e99cd=_0x3e99cd||0x1f4;return function(_0xe328b1){logger['error'](_0xe328b1[_0x7995('0x37')]);if(_0xe328b1[_0x7995('0x38')]){delete _0xe328b1[_0x7995('0x38')];}_0x5d2428[_0x7995('0x2b')](_0x3e99cd)[_0x7995('0x39')](_0xe328b1);};}exports['index']=function(_0x2d4285,_0x242713){var _0xf612e6={},_0x1d60b8={},_0x4b1541={'count':0x0,'rows':[]};var _0x2be2c0=_[_0x7995('0x3a')](db[_0x7995('0x3b')][_0x7995('0x3c')],function(_0x1f5bee){return{'name':_0x1f5bee[_0x7995('0x3d')],'type':_0x1f5bee['type'][_0x7995('0x3e')]};});_0x1d60b8[_0x7995('0x3f')]=_[_0x7995('0x3a')](_0x2be2c0,_0x7995('0x38'));_0x1d60b8[_0x7995('0x40')]=_[_0x7995('0x41')](_0x2d4285[_0x7995('0x40')]);_0x1d60b8[_0x7995('0x42')]=_[_0x7995('0x43')](_0x1d60b8[_0x7995('0x3f')],_0x1d60b8[_0x7995('0x40')]);_0xf612e6[_0x7995('0x44')]=_[_0x7995('0x43')](_0x1d60b8['model'],qs['fields'](_0x2d4285[_0x7995('0x40')][_0x7995('0x45')]));_0xf612e6['attributes']=_0xf612e6['attributes'][_0x7995('0x46')]?_0xf612e6['attributes']:_0x1d60b8['model'];if(!_0x2d4285[_0x7995('0x40')][_0x7995('0x47')](_0x7995('0x48'))){_0xf612e6['limit']=qs[_0x7995('0x2f')](_0x2d4285['query'][_0x7995('0x2f')]);_0xf612e6['offset']=qs['offset'](_0x2d4285[_0x7995('0x40')][_0x7995('0x31')]);}_0xf612e6[_0x7995('0x49')]=qs[_0x7995('0x4a')](_0x2d4285['query'][_0x7995('0x4a')]);_0xf612e6[_0x7995('0x4b')]=qs[_0x7995('0x42')](_[_0x7995('0x4c')](_0x2d4285['query'],_0x1d60b8['filters']),_0x2be2c0);if(_0x2d4285[_0x7995('0x40')]['filter']){_0xf612e6[_0x7995('0x4b')]=_['merge'](_0xf612e6[_0x7995('0x4b')],{'$or':_['map'](_0x2be2c0,function(_0x1e795e){if(_0x1e795e[_0x7995('0x4d')]!=='VIRTUAL'){var _0x3e9e62={};_0x3e9e62[_0x1e795e[_0x7995('0x38')]]={'$like':'%'+_0x2d4285[_0x7995('0x40')][_0x7995('0x4e')]+'%'};return _0x3e9e62;}})});}_0xf612e6=_['merge']({},_0xf612e6,_0x2d4285[_0x7995('0x4f')]);var _0x3e787d={'where':_0xf612e6[_0x7995('0x4b')]};return db['Trunk'][_0x7995('0x30')](_0x3e787d)[_0x7995('0x1f')](function(_0x511567){_0x4b1541[_0x7995('0x30')]=_0x511567;if(_0x2d4285[_0x7995('0x40')]['includeAll']){_0xf612e6[_0x7995('0x50')]=[{'all':!![]}];}return db[_0x7995('0x3b')]['findAll'](_0xf612e6);})[_0x7995('0x1f')](function(_0x5843ba){_0x4b1541[_0x7995('0x51')]=_0x5843ba;return _0x4b1541;})[_0x7995('0x1f')](respondWithFilteredResult(_0x242713,_0xf612e6))[_0x7995('0x29')](handleError(_0x242713,null));};exports[_0x7995('0x52')]=function(_0xddf537,_0x14b537){var _0x1579b9={'raw':![],'where':{'id':_0xddf537[_0x7995('0x53')]['id']}},_0x4d46bc={};_0x4d46bc[_0x7995('0x3f')]=_[_0x7995('0x41')](db['Trunk'][_0x7995('0x3c')]);_0x4d46bc[_0x7995('0x40')]=_[_0x7995('0x41')](_0xddf537['query']);_0x4d46bc['filters']=_['intersection'](_0x4d46bc[_0x7995('0x3f')],_0x4d46bc[_0x7995('0x40')]);_0x1579b9['attributes']=_[_0x7995('0x43')](_0x4d46bc[_0x7995('0x3f')],qs[_0x7995('0x45')](_0xddf537[_0x7995('0x40')][_0x7995('0x45')]));_0x1579b9['attributes']=_0x1579b9[_0x7995('0x44')]['length']?_0x1579b9[_0x7995('0x44')]:_0x4d46bc[_0x7995('0x3f')];if(_0xddf537[_0x7995('0x40')]['includeAll']){_0x1579b9['include']=[{'all':!![]}];}_0x1579b9=_['merge']({},_0x1579b9,_0xddf537['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x1579b9)[_0x7995('0x1f')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x1f')](respondWithResult(_0x14b537,null))[_0x7995('0x29')](handleError(_0x14b537,null));};exports[_0x7995('0x55')]=function(_0x1f4270,_0xda6ce8){var _0x328671={'where':{'id':_0x1f4270[_0x7995('0x53')]['id']}},_0x17ecd3={};_0x17ecd3[_0x7995('0x3f')]=_[_0x7995('0x41')](db[_0x7995('0x3b')][_0x7995('0x3c')]);_0x328671[_0x7995('0x44')]=_[_0x7995('0x43')](_0x17ecd3[_0x7995('0x3f')],qs[_0x7995('0x45')](_0x1f4270['query'][_0x7995('0x45')]));_0x328671[_0x7995('0x44')]=_0x328671[_0x7995('0x44')][_0x7995('0x46')]?_0x328671['attributes']:_0x17ecd3['model'];if(_0x1f4270[_0x7995('0x40')][_0x7995('0x56')]){_0x328671[_0x7995('0x50')]=[{'all':!![]}];}_0x328671=_[_0x7995('0x57')]({},_0x328671,_0x1f4270['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x328671)[_0x7995('0x1f')](handleEntityNotFound(_0xda6ce8,null))[_0x7995('0x1f')](function(_0x502d43){if(_0x502d43){var _0x5e2d97=_0x502d43[_0x7995('0x58')]({'plain':!![]});_0x5e2d97=qs[_0x7995('0x59')](_0x5e2d97,['id',_0x7995('0x5a'),_0x7995('0x5b')]);_0x1f4270[_0x7995('0x5c')]=_[_0x7995('0x59')](_0x1f4270[_0x7995('0x5c')],['id',_0x7995('0x5a'),_0x7995('0x5b')]);return db['Trunk'][_0x7995('0x5d')](_[_0x7995('0x57')](_0x5e2d97,_0x1f4270[_0x7995('0x5c')]),{'include':_0x1f4270[_0x7995('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3053fd){var _0xebb5c8=_0x1f4270['user'][_0x7995('0x58')]({'plain':!![]});if(!_0xebb5c8)throw new Error(_0x7995('0x5e'));if(_0xebb5c8[_0x7995('0x5f')]===_0x7995('0x60')){var _0x32cb04=_0x3053fd['get']({'plain':!![]});var _0x457d09='Trunks';return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':_0x457d09,'userProfileId':_0xebb5c8[_0x7995('0x62')]},'raw':!![]})[_0x7995('0x1f')](function(_0x4388c1){if(_0x4388c1&&_0x4388c1[_0x7995('0x63')]===0x0){return db[_0x7995('0x64')][_0x7995('0x5d')]({'name':_0x32cb04[_0x7995('0x38')],'resourceId':_0x32cb04['id'],'type':_0x4388c1[_0x7995('0x38')],'sectionId':_0x4388c1['id']},{})[_0x7995('0x1f')](function(){return _0x3053fd;});}else{return _0x3053fd;}})[_0x7995('0x29')](function(_0x56eb85){logger[_0x7995('0x25')](_0x7995('0x65'),_0x56eb85);throw _0x56eb85;});}return _0x3053fd;});}})[_0x7995('0x1f')](respondWithResult(_0xda6ce8,0xc9))[_0x7995('0x29')](handleError(_0xda6ce8,null));};exports[_0x7995('0x5d')]=function(_0x54a2e0,_0x4b54f2,_0x268fde){var _0x87e38d;return db[_0x7995('0x3b')][_0x7995('0x5d')](_0x54a2e0['body'],{'raw':!![]})[_0x7995('0x1f')](function(_0x50a12e){_0x87e38d=_0x50a12e;return db['Trunk'][_0x7995('0x66')]({'raw':!![]});})[_0x7995('0x1f')](function(_0x3f0a71){var _0x44bf2b=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x2466df=fs['readFileSync'](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6c')),'utf8');var _0x1fe1cb=ejs[_0x7995('0x6d')](_0x44bf2b,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x1fe1cb);if(_0x87e38d[_0x7995('0x70')]){var _0x51ab1e=ejs[_0x7995('0x6d')](_0x2466df,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x51ab1e);}})[_0x7995('0x1f')](function(){return respondWithRpcPromise(_0x7995('0x72'),'create',{'module':'chan_sip.so'});})[_0x7995('0x1f')](function(){var _0xfe1105=_0x54a2e0[_0x7995('0x60')][_0x7995('0x58')]({'plain':!![]});if(!_0xfe1105)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfe1105[_0x7995('0x5f')]===_0x7995('0x60')){var _0x54b955=_0x87e38d['get']({'plain':!![]});return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':'Trunks','userProfileId':_0xfe1105[_0x7995('0x62')]},'raw':!![]})['then'](function(_0x3758f9){if(_0x3758f9&&_0x3758f9[_0x7995('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x54b955[_0x7995('0x38')],'resourceId':_0x54b955['id'],'type':_0x3758f9['name'],'sectionId':_0x3758f9['id']},{})[_0x7995('0x1f')](function(){return _0x87e38d;});}else{return _0x87e38d;}})[_0x7995('0x29')](function(_0x3dd197){logger[_0x7995('0x25')](_0x7995('0x65'),_0x3dd197);throw _0x3dd197;});}return _0x87e38d;})[_0x7995('0x1f')](respondWithResult(_0x4b54f2,0xc9))[_0x7995('0x29')](handleError(_0x4b54f2,null));};exports[_0x7995('0x34')]=function(_0x29e0ee,_0x117317,_0x1ab590){var _0x16108c;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x29e0ee[_0x7995('0x53')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x117317,null))[_0x7995('0x1f')](saveUpdates(_0x29e0ee[_0x7995('0x5c')],null))[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x16108c=_0xa2fc8e;return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});}})[_0x7995('0x1f')](function(_0x280fbb){if(_0x280fbb){var _0x260ef1=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/trunk.ejs'),_0x7995('0x6b'));var _0x10f4ca=fs['readFileSync'](path['join'](config[_0x7995('0x69')],_0x7995('0x6c')),_0x7995('0x6b'));var _0x38acda=ejs[_0x7995('0x6d')](_0x260ef1,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x38acda);var _0x2f8a2d=ejs[_0x7995('0x6d')](_0x10f4ca,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x2f8a2d);return respondWithRpcPromise(_0x7995('0x72'),_0x7995('0x34'),{'module':_0x7995('0x73')});}return null;})[_0x7995('0x1f')](function(_0x560095){if(_0x560095){return _0x16108c;}})[_0x7995('0x1f')](respondWithResult(_0x117317,null))[_0x7995('0x29')](handleError(_0x117317,null));};exports['destroy']=function(_0x479271,_0xd24c64,_0xf8c2ed){var _0x18e1a2;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x479271['params']['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0xd24c64,null))[_0x7995('0x1f')](removeEntity(_0xd24c64,null))['then'](function(){return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});})['then'](function(_0x1535a3){var _0x4a5bc5=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x5d16da=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/registry.ejs'),_0x7995('0x6b'));var _0x3f3434=ejs[_0x7995('0x6d')](_0x4a5bc5,{'trunks':_0x1535a3});var _0x308a26=ejs['render'](_0x5d16da,{'trunks':_0x1535a3});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x3f3434);fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_registers.conf',_0x308a26);return respondWithRpcPromise('Reload',_0x7995('0x35'),{'module':_0x7995('0x73')});})['catch'](handleError(_0xd24c64,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 0cd162c..5750a94 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 _0x6c97=['Trunk','tools_trunks','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./trunk.attributes','define'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x6c97,0x14c));var _0x76c9=function(_0x365490,_0x1f0cca){_0x365490=_0x365490-0x0;var _0x5e2242=_0x6c97[_0x365490];return _0x5e2242;};'use strict';var _=require(_0x76c9('0x0'));var util=require(_0x76c9('0x1'));var logger=require(_0x76c9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x76c9('0x3'));var rp=require(_0x76c9('0x4'));var fs=require('fs');var path=require(_0x76c9('0x5'));var rimraf=require(_0x76c9('0x6'));var config=require('../../config/environment');var attributes=require(_0x76c9('0x7'));module['exports']=function(_0x47feca,_0x216dba){return _0x47feca[_0x76c9('0x8')](_0x76c9('0x9'),attributes,{'tableName':_0x76c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e2a=['api','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','tools_trunks','../../config/logger'];(function(_0x558105,_0x4f84af){var _0x39cc0=function(_0x139060){while(--_0x139060){_0x558105['push'](_0x558105['shift']());}};_0x39cc0(++_0x4f84af);}(_0x1e2a,0x18b));var _0xa1e2=function(_0x1870e7,_0x4044b9){_0x1870e7=_0x1870e7-0x0;var _0x4cb2aa=_0x1e2a[_0x1870e7];return _0x4cb2aa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa1e2('0x0'))(_0xa1e2('0x1'));var moment=require(_0xa1e2('0x2'));var BPromise=require('bluebird');var rp=require(_0xa1e2('0x3'));var fs=require('fs');var path=require(_0xa1e2('0x4'));var rimraf=require(_0xa1e2('0x5'));var config=require(_0xa1e2('0x6'));var attributes=require(_0xa1e2('0x7'));module[_0xa1e2('0x8')]=function(_0x110098,_0x2932e3){return _0x110098[_0xa1e2('0x9')]('Trunk',attributes,{'tableName':_0xa1e2('0xa'),'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 b031ae8..93af5f6 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 _0x354a=['limit','include','model','attributes','map','then','debug','catch','ShowTrunk','find','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw','where'];(function(_0x3f3adc,_0x48e732){var _0x5e5edf=function(_0x3900e3){while(--_0x3900e3){_0x3f3adc['push'](_0x3f3adc['shift']());}};_0x5e5edf(++_0x48e732);}(_0x354a,0xd6));var _0xa354=function(_0x4e18bb,_0x2b28df){_0x4e18bb=_0x4e18bb-0x0;var _0x5ebf1f=_0x354a[_0x4e18bb];return _0x5ebf1f;};'use strict';var _=require('lodash');var util=require(_0xa354('0x0'));var moment=require('moment');var BPromise=require(_0xa354('0x1'));var rs=require(_0xa354('0x2'));var fs=require('fs');var Redis=require(_0xa354('0x3'));var db=require(_0xa354('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa354('0x5'));var config=require(_0xa354('0x6'));var jayson=require(_0xa354('0x7'));var client=jayson['client'][_0xa354('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c10d8,_0x4479c1,_0xe3b4a6){return new BPromise(function(_0x4a87b9,_0x492f41){return client[_0xa354('0x9')](_0x3c10d8,_0xe3b4a6)['then'](function(_0x2712fe){logger[_0xa354('0xa')](_0xa354('0xb'),_0x4479c1,_0xa354('0xc'));logger['debug'](_0xa354('0xd'),_0x4479c1,_0xa354('0xc'),JSON[_0xa354('0xe')](_0x2712fe));if(_0x2712fe[_0xa354('0xf')]){if(_0x2712fe[_0xa354('0xf')]['code']===0x1f4){logger[_0xa354('0xf')]('Trunk,\x20%s,\x20%s',_0x4479c1,_0x2712fe[_0xa354('0xf')][_0xa354('0x10')]);return _0x492f41(_0x2712fe[_0xa354('0xf')][_0xa354('0x10')]);}logger[_0xa354('0xf')](_0xa354('0xb'),_0x4479c1,_0x2712fe[_0xa354('0xf')][_0xa354('0x10')]);return _0x4a87b9(_0x2712fe['error']['message']);}else{logger[_0xa354('0xa')](_0xa354('0xb'),_0x4479c1,_0xa354('0xc'));_0x4a87b9(_0x2712fe[_0xa354('0x11')][_0xa354('0x10')]);}})['catch'](function(_0x248e18){logger[_0xa354('0xf')](_0xa354('0xb'),_0x4479c1,_0x248e18);_0x492f41(_0x248e18);});});}exports[_0xa354('0x12')]=function(_0x252123){var _0x4d5032=this;return new Promise(function(_0x54b3d6,_0xf0cf12){return db[_0xa354('0x13')][_0xa354('0x14')]({'raw':_0x252123[_0xa354('0x15')]?_0x252123[_0xa354('0x15')][_0xa354('0x16')]===undefined?!![]:![]:!![],'where':_0x252123[_0xa354('0x15')]?_0x252123[_0xa354('0x15')][_0xa354('0x17')]||null:null,'attributes':_0x252123['options']?_0x252123[_0xa354('0x15')]['attributes']||null:null,'limit':_0x252123[_0xa354('0x15')]?_0x252123[_0xa354('0x15')][_0xa354('0x18')]||null:null,'include':_0x252123[_0xa354('0x15')]?_0x252123[_0xa354('0x15')]['include']?_['map'](_0x252123[_0xa354('0x15')][_0xa354('0x19')],function(_0x57d46e){return{'model':db[_0x57d46e[_0xa354('0x1a')]],'as':_0x57d46e['as'],'attributes':_0x57d46e[_0xa354('0x1b')],'include':_0x57d46e[_0xa354('0x19')]?_['map'](_0x57d46e[_0xa354('0x19')],function(_0x4dd2ac){return{'model':db[_0x4dd2ac[_0xa354('0x1a')]],'as':_0x4dd2ac['as'],'attributes':_0x4dd2ac['attributes'],'include':_0x4dd2ac[_0xa354('0x19')]?_[_0xa354('0x1c')](_0x4dd2ac['include'],function(_0x5a831f){return{'model':db[_0x5a831f[_0xa354('0x1a')]],'as':_0x5a831f['as'],'attributes':_0x5a831f[_0xa354('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa354('0x1d')](function(_0x3d73dd){logger[_0xa354('0xa')](_0xa354('0x12'),_0x252123);logger[_0xa354('0x1e')](_0xa354('0x12'),_0x252123,JSON[_0xa354('0xe')](_0x3d73dd));_0x54b3d6(_0x3d73dd);})[_0xa354('0x1f')](function(_0x18e137){logger[_0xa354('0xf')](_0xa354('0x12'),_0x18e137[_0xa354('0x10')],_0x252123);_0xf0cf12(_0x4d5032[_0xa354('0xf')](0x1f4,_0x18e137[_0xa354('0x10')]));});});};exports[_0xa354('0x20')]=function(_0x41994f){var _0x382f49=this;return new Promise(function(_0x408f50,_0x51610e){return db[_0xa354('0x13')][_0xa354('0x21')]({'raw':_0x41994f['options']?_0x41994f['options']['raw']===undefined?!![]:![]:!![],'where':_0x41994f[_0xa354('0x15')]?_0x41994f['options'][_0xa354('0x17')]||null:null,'attributes':_0x41994f[_0xa354('0x15')]?_0x41994f[_0xa354('0x15')]['attributes']||null:null,'include':_0x41994f['options']?_0x41994f[_0xa354('0x15')][_0xa354('0x19')]?_[_0xa354('0x1c')](_0x41994f[_0xa354('0x15')][_0xa354('0x19')],function(_0x16fd8e){return{'model':db[_0x16fd8e[_0xa354('0x1a')]],'as':_0x16fd8e['as'],'attributes':_0x16fd8e[_0xa354('0x1b')],'include':_0x16fd8e[_0xa354('0x19')]?_[_0xa354('0x1c')](_0x16fd8e[_0xa354('0x19')],function(_0x133f3c){return{'model':db[_0x133f3c[_0xa354('0x1a')]],'as':_0x133f3c['as'],'attributes':_0x133f3c[_0xa354('0x1b')],'include':_0x133f3c[_0xa354('0x19')]?_[_0xa354('0x1c')](_0x133f3c[_0xa354('0x19')],function(_0x416002){return{'model':db[_0x416002[_0xa354('0x1a')]],'as':_0x416002['as'],'attributes':_0x416002[_0xa354('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa354('0x1d')](function(_0xf70ce8){logger[_0xa354('0xa')]('ShowTrunk',_0x41994f);logger[_0xa354('0x1e')]('ShowTrunk',_0x41994f,JSON[_0xa354('0xe')](_0xf70ce8));_0x408f50(_0xf70ce8);})['catch'](function(_0x79e300){logger[_0xa354('0xf')]('ShowTrunk',_0x79e300[_0xa354('0x10')],_0x41994f);_0x51610e(_0x382f49[_0xa354('0xf')](0x1f4,_0x79e300['message']));});});}; \ No newline at end of file +var _0x6ae2=['find','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','Trunk,\x20%s,\x20%s','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowTrunk'];(function(_0x52ecb8,_0x52f4e1){var _0x120399=function(_0x498937){while(--_0x498937){_0x52ecb8['push'](_0x52ecb8['shift']());}};_0x120399(++_0x52f4e1);}(_0x6ae2,0xcd));var _0x26ae=function(_0x2caf3a,_0x1d65d6){_0x2caf3a=_0x2caf3a-0x0;var _0x34f044=_0x6ae2[_0x2caf3a];return _0x34f044;};'use strict';var _=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var moment=require(_0x26ae('0x2'));var BPromise=require(_0x26ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26ae('0x4'));var db=require(_0x26ae('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x26ae('0x6'));var config=require(_0x26ae('0x7'));var jayson=require(_0x26ae('0x8'));var client=jayson['client'][_0x26ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x123f38,_0x206ad6,_0x449ef6){return new BPromise(function(_0x592186,_0x35a66a){return client[_0x26ae('0xa')](_0x123f38,_0x449ef6)[_0x26ae('0xb')](function(_0x1f4bd1){logger[_0x26ae('0xc')]('Trunk,\x20%s,\x20%s',_0x206ad6,_0x26ae('0xd'));logger[_0x26ae('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x206ad6,'request\x20sent',JSON[_0x26ae('0xf')](_0x1f4bd1));if(_0x1f4bd1[_0x26ae('0x10')]){if(_0x1f4bd1[_0x26ae('0x10')]['code']===0x1f4){logger[_0x26ae('0x10')](_0x26ae('0x11'),_0x206ad6,_0x1f4bd1[_0x26ae('0x10')][_0x26ae('0x12')]);return _0x35a66a(_0x1f4bd1[_0x26ae('0x10')][_0x26ae('0x12')]);}logger[_0x26ae('0x10')](_0x26ae('0x11'),_0x206ad6,_0x1f4bd1[_0x26ae('0x10')][_0x26ae('0x12')]);return _0x592186(_0x1f4bd1[_0x26ae('0x10')][_0x26ae('0x12')]);}else{logger[_0x26ae('0xc')](_0x26ae('0x11'),_0x206ad6,_0x26ae('0xd'));_0x592186(_0x1f4bd1[_0x26ae('0x13')][_0x26ae('0x12')]);}})['catch'](function(_0x441524){logger['error']('Trunk,\x20%s,\x20%s',_0x206ad6,_0x441524);_0x35a66a(_0x441524);});});}exports[_0x26ae('0x14')]=function(_0x18cb6e){var _0x529fc4=this;return new Promise(function(_0x4341df,_0x460767){return db[_0x26ae('0x15')][_0x26ae('0x16')]({'raw':_0x18cb6e[_0x26ae('0x17')]?_0x18cb6e[_0x26ae('0x17')][_0x26ae('0x18')]===undefined?!![]:![]:!![],'where':_0x18cb6e['options']?_0x18cb6e[_0x26ae('0x17')][_0x26ae('0x19')]||null:null,'attributes':_0x18cb6e[_0x26ae('0x17')]?_0x18cb6e['options'][_0x26ae('0x1a')]||null:null,'limit':_0x18cb6e['options']?_0x18cb6e[_0x26ae('0x17')][_0x26ae('0x1b')]||null:null,'include':_0x18cb6e['options']?_0x18cb6e[_0x26ae('0x17')][_0x26ae('0x1c')]?_[_0x26ae('0x1d')](_0x18cb6e[_0x26ae('0x17')][_0x26ae('0x1c')],function(_0x16b3d0){return{'model':db[_0x16b3d0['model']],'as':_0x16b3d0['as'],'attributes':_0x16b3d0[_0x26ae('0x1a')],'include':_0x16b3d0['include']?_[_0x26ae('0x1d')](_0x16b3d0[_0x26ae('0x1c')],function(_0x23601e){return{'model':db[_0x23601e[_0x26ae('0x1e')]],'as':_0x23601e['as'],'attributes':_0x23601e[_0x26ae('0x1a')],'include':_0x23601e[_0x26ae('0x1c')]?_['map'](_0x23601e[_0x26ae('0x1c')],function(_0x221761){return{'model':db[_0x221761['model']],'as':_0x221761['as'],'attributes':_0x221761[_0x26ae('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ffbf8){logger['info'](_0x26ae('0x14'),_0x18cb6e);logger['debug'](_0x26ae('0x14'),_0x18cb6e,JSON[_0x26ae('0xf')](_0x1ffbf8));_0x4341df(_0x1ffbf8);})[_0x26ae('0x1f')](function(_0x1a4eb8){logger[_0x26ae('0x10')](_0x26ae('0x14'),_0x1a4eb8[_0x26ae('0x12')],_0x18cb6e);_0x460767(_0x529fc4[_0x26ae('0x10')](0x1f4,_0x1a4eb8[_0x26ae('0x12')]));});});};exports[_0x26ae('0x20')]=function(_0x2c2b02){var _0x111f90=this;return new Promise(function(_0x22ea08,_0x16c76b){return db[_0x26ae('0x15')][_0x26ae('0x21')]({'raw':_0x2c2b02[_0x26ae('0x17')]?_0x2c2b02[_0x26ae('0x17')][_0x26ae('0x18')]===undefined?!![]:![]:!![],'where':_0x2c2b02['options']?_0x2c2b02['options'][_0x26ae('0x19')]||null:null,'attributes':_0x2c2b02[_0x26ae('0x17')]?_0x2c2b02[_0x26ae('0x17')]['attributes']||null:null,'include':_0x2c2b02[_0x26ae('0x17')]?_0x2c2b02[_0x26ae('0x17')][_0x26ae('0x1c')]?_['map'](_0x2c2b02[_0x26ae('0x17')][_0x26ae('0x1c')],function(_0x3474d0){return{'model':db[_0x3474d0[_0x26ae('0x1e')]],'as':_0x3474d0['as'],'attributes':_0x3474d0['attributes'],'include':_0x3474d0[_0x26ae('0x1c')]?_['map'](_0x3474d0[_0x26ae('0x1c')],function(_0x5dad14){return{'model':db[_0x5dad14['model']],'as':_0x5dad14['as'],'attributes':_0x5dad14[_0x26ae('0x1a')],'include':_0x5dad14[_0x26ae('0x1c')]?_['map'](_0x5dad14[_0x26ae('0x1c')],function(_0x475c72){return{'model':db[_0x475c72[_0x26ae('0x1e')]],'as':_0x475c72['as'],'attributes':_0x475c72[_0x26ae('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x26ae('0xb')](function(_0x2ba50b){logger[_0x26ae('0xc')]('ShowTrunk',_0x2c2b02);logger[_0x26ae('0xe')](_0x26ae('0x20'),_0x2c2b02,JSON['stringify'](_0x2ba50b));_0x22ea08(_0x2ba50b);})[_0x26ae('0x1f')](function(_0x29da1e){logger[_0x26ae('0x10')](_0x26ae('0x20'),_0x29da1e[_0x26ae('0x12')],_0x2c2b02);_0x16c76b(_0x111f90[_0x26ae('0x10')](0x1f4,_0x29da1e['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 089b1a5..7f618f3 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4acc=['./user-setting.controller','put','/:id','isAuthenticated','update','exports','express'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x4acc,0x125));var _0xc4ac=function(_0x2a5c5b,_0x2c2c35){_0x2a5c5b=_0x2a5c5b-0x0;var _0x10f8d0=_0x4acc[_0x2a5c5b];return _0x10f8d0;};'use strict';var express=require(_0xc4ac('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xc4ac('0x1'));router[_0xc4ac('0x2')](_0xc4ac('0x3'),auth[_0xc4ac('0x4')](),controller[_0xc4ac('0x5')]);module[_0xc4ac('0x6')]=router; \ No newline at end of file +var _0x9075=['isAuthenticated','exports','Router','../../components/auth/service','./user-setting.controller','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9075,0x1b2));var _0x5907=function(_0x1796bc,_0x1d8a78){_0x1796bc=_0x1796bc-0x0;var _0x3a381f=_0x9075[_0x1796bc];return _0x3a381f;};'use strict';var express=require('express');var router=express[_0x5907('0x0')]();var auth=require(_0x5907('0x1'));var controller=require(_0x5907('0x2'));router['put'](_0x5907('0x3'),auth[_0x5907('0x4')](),controller['update']);module[_0x5907('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 33de3c5..f783227 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6990=['exports','ENUM','BOOLEAN','DATE','UserId','sequelize','error','info','debug'];(function(_0x43a2d7,_0x2cb5ef){var _0x4bb5f2=function(_0x5b4e8e){while(--_0x5b4e8e){_0x43a2d7['push'](_0x43a2d7['shift']());}};_0x4bb5f2(++_0x2cb5ef);}(_0x6990,0x191));var _0x0699=function(_0x34fa30,_0x40aad1){_0x34fa30=_0x34fa30-0x0;var _0x414b4d=_0x6990[_0x34fa30];return _0x414b4d;};'use strict';var Sequelize=require(_0x0699('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0699('0x1'),'warning',_0x0699('0x2'),_0x0699('0x3')];module[_0x0699('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x0699('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0699('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0699('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0699('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x0699('0x8')}}; \ No newline at end of file +var _0xf9dc=['sequelize','error','warning','info','exports','ENUM','BOOLEAN','DATE','INTEGER','UserId'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf9dc,0x8c));var _0xcf9d=function(_0x332a78,_0x4d38b3){_0x332a78=_0x332a78-0x0;var _0x537ac5=_0xf9dc[_0x332a78];return _0x537ac5;};'use strict';var Sequelize=require(_0xcf9d('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xcf9d('0x1'),_0xcf9d('0x2'),_0xcf9d('0x3'),'debug'];module[_0xcf9d('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xcf9d('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xcf9d('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xcf9d('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xcf9d('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xcf9d('0x8')],'unique':_0xcf9d('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 746c41b..916eaf7 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9aee=['send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','status','json','update','then','sendStatus','error','stack','name'];(function(_0x39a4d5,_0x34717d){var _0x111677=function(_0x58eb6f){while(--_0x58eb6f){_0x39a4d5['push'](_0x39a4d5['shift']());}};_0x111677(++_0x34717d);}(_0x9aee,0x71));var _0xe9ae=function(_0x4730a9,_0x249cc8){_0x4730a9=_0x4730a9-0x0;var _0x4c4b05=_0x9aee[_0x4730a9];return _0x4c4b05;};'use strict';var _=require(_0xe9ae('0x0'));var Redis=require(_0xe9ae('0x1'));var logger=require(_0xe9ae('0x2'))(_0xe9ae('0x3'));var config=require(_0xe9ae('0x4'));var db=require(_0xe9ae('0x5'))['db'];var socket=require(_0xe9ae('0x6'))(new Redis(config[_0xe9ae('0x7')]));require(_0xe9ae('0x8'))['register'](socket);config['redis']=_['defaults'](config[_0xe9ae('0x7')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x54e9e7,_0x34cef2){_0x34cef2=_0x34cef2||0xc8;return function(_0x478bf5){if(_0x478bf5){return _0x54e9e7[_0xe9ae('0x9')](_0x34cef2)[_0xe9ae('0xa')](_0x478bf5);}};}function saveUpdates(_0x4a317a){return function(_0x2e3199){if(_0x2e3199){return _0x2e3199[_0xe9ae('0xb')](_0x4a317a)[_0xe9ae('0xc')](function(_0x4dffbd){return _0x4dffbd;});}return null;};}function handleEntityNotFound(_0x359047){return function(_0x17371c){if(!_0x17371c){_0x359047[_0xe9ae('0xd')](0x194);}return _0x17371c;};}function handleError(_0x5689ef,_0xbf049e){_0xbf049e=_0xbf049e||0x1f4;return function(_0x502fac){logger[_0xe9ae('0xe')](_0x502fac[_0xe9ae('0xf')]);if(_0x502fac[_0xe9ae('0x10')]){delete _0x502fac[_0xe9ae('0x10')];}_0x5689ef[_0xe9ae('0x9')](_0xbf049e)[_0xe9ae('0x11')](_0x502fac);};}exports[_0xe9ae('0xb')]=function(_0x3326b9,_0x4e5d3b){if(_0x3326b9[_0xe9ae('0x12')][_0xe9ae('0x13')]!=='admin')throw new Error(_0xe9ae('0x14'));if(isNaN(Number(_0x3326b9[_0xe9ae('0x15')]['id'])))throw new Error(_0xe9ae('0x16'));return db[_0xe9ae('0x17')][_0xe9ae('0x18')]({'where':{'id':_0x3326b9[_0xe9ae('0x15')]['id']}})[_0xe9ae('0xc')](handleEntityNotFound(_0x4e5d3b,null))[_0xe9ae('0xc')](saveUpdates(_0x3326b9[_0xe9ae('0x19')],null))['then'](respondWithResult(_0x4e5d3b,null))['catch'](handleError(_0x4e5d3b,null));}; \ No newline at end of file +var _0x615a=['Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','status','json','then','sendStatus','name','send','update','role','admin','Unauthorized','params'];(function(_0x2e2334,_0x8ffa8b){var _0x31991c=function(_0x14c2bd){while(--_0x14c2bd){_0x2e2334['push'](_0x2e2334['shift']());}};_0x31991c(++_0x8ffa8b);}(_0x615a,0x119));var _0xa615=function(_0x10dc60,_0x2fcce1){_0x10dc60=_0x10dc60-0x0;var _0x47dec5=_0x615a[_0x10dc60];return _0x47dec5;};'use strict';var _=require(_0xa615('0x0'));var Redis=require('ioredis');var logger=require(_0xa615('0x1'))('api');var config=require(_0xa615('0x2'));var db=require(_0xa615('0x3'))['db'];var socket=require(_0xa615('0x4'))(new Redis(config[_0xa615('0x5')]));require('./user-setting.socket')[_0xa615('0x6')](socket);config[_0xa615('0x5')]=_['defaults'](config[_0xa615('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x44afda,_0x389dd4){_0x389dd4=_0x389dd4||0xc8;return function(_0x2db48d){if(_0x2db48d){return _0x44afda[_0xa615('0x7')](_0x389dd4)[_0xa615('0x8')](_0x2db48d);}};}function saveUpdates(_0x59d2a8){return function(_0x25a604){if(_0x25a604){return _0x25a604['update'](_0x59d2a8)[_0xa615('0x9')](function(_0x3fbfe1){return _0x3fbfe1;});}return null;};}function handleEntityNotFound(_0x5a6664){return function(_0x3b1698){if(!_0x3b1698){_0x5a6664[_0xa615('0xa')](0x194);}return _0x3b1698;};}function handleError(_0x16c90b,_0x32ad53){_0x32ad53=_0x32ad53||0x1f4;return function(_0x2530ec){logger['error'](_0x2530ec['stack']);if(_0x2530ec[_0xa615('0xb')]){delete _0x2530ec['name'];}_0x16c90b[_0xa615('0x7')](_0x32ad53)[_0xa615('0xc')](_0x2530ec);};}exports[_0xa615('0xd')]=function(_0x21eb04,_0x5a5b3e){if(_0x21eb04['user'][_0xa615('0xe')]!==_0xa615('0xf'))throw new Error(_0xa615('0x10'));if(isNaN(Number(_0x21eb04[_0xa615('0x11')]['id'])))throw new Error(_0xa615('0x12'));return db[_0xa615('0x13')][_0xa615('0x14')]({'where':{'id':_0x21eb04[_0xa615('0x11')]['id']}})[_0xa615('0x9')](handleEntityNotFound(_0x5a5b3e,null))[_0xa615('0x9')](saveUpdates(_0x21eb04[_0xa615('0x15')],null))[_0xa615('0x9')](respondWithResult(_0x5a5b3e,null))[_0xa615('0x16')](handleError(_0x5a5b3e,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 1b0fe34..a5f4b3e 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52a5=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x52a5,0xd6));var _0x552a=function(_0x51018d,_0xb6c4e8){_0x51018d=_0x51018d-0x0;var _0x132dfa=_0x52a5[_0x51018d];return _0x132dfa;};'use strict';var EventEmitter=require(_0x552a('0x0'));var UserSetting=require(_0x552a('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x552a('0x2'),'afterUpdate':_0x552a('0x3'),'afterDestroy':_0x552a('0x4')};function emitEvent(_0xabc24c){return function(_0x2c7d85,_0x54006d,_0x91d9b){UserSettingEvents[_0x552a('0x5')](_0xabc24c+':'+_0x2c7d85['id'],_0x2c7d85);UserSettingEvents[_0x552a('0x5')](_0xabc24c,_0x2c7d85);_0x91d9b(null);};}for(var e in events){if(events[_0x552a('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x552a('0x7')]=UserSettingEvents; \ No newline at end of file +var _0xba58=['exports','UserSetting','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0xdcfd85,_0xd63264){var _0x3ea132=function(_0xb195f3){while(--_0xb195f3){_0xdcfd85['push'](_0xdcfd85['shift']());}};_0x3ea132(++_0xd63264);}(_0xba58,0x1c8));var _0x8ba5=function(_0x4403dd,_0x2d11ec){_0x4403dd=_0x4403dd-0x0;var _0x44a813=_0xba58[_0x4403dd];return _0x44a813;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0x8ba5('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x8ba5('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ba5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x476580){return function(_0x29e254,_0x56b92e,_0x2bc387){UserSettingEvents['emit'](_0x476580+':'+_0x29e254['id'],_0x29e254);UserSettingEvents[_0x8ba5('0x3')](_0x476580,_0x29e254);_0x2bc387(null);};}for(var e in events){if(events[_0x8ba5('0x4')](e)){var event=events[e];UserSetting[_0x8ba5('0x5')](e,emitEvent(event));}}module[_0x8ba5('0x6')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index dc03099..e0a2b22 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89c4=['./user-setting.attributes','exports','define','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x244ddb,_0x107a6c){var _0x2aa596=function(_0x30fad9){while(--_0x30fad9){_0x244ddb['push'](_0x244ddb['shift']());}};_0x2aa596(++_0x107a6c);}(_0x89c4,0x82));var _0x489c=function(_0x4f1c9b,_0x583f28){_0x4f1c9b=_0x4f1c9b-0x0;var _0x38c6b5=_0x89c4[_0x4f1c9b];return _0x38c6b5;};'use strict';var attributes=require(_0x489c('0x0'));module[_0x489c('0x1')]=function(_0x55c4f5){return _0x55c4f5[_0x489c('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x165089){if(!_0x165089[_0x489c('0x3')])_0x165089[_0x489c('0x4')]=null;else if(_0x165089[_0x489c('0x4')]===null)_0x165089[_0x489c('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x80ed=['define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x380fa9,_0x5123eb){var _0x4f2532=function(_0x4bde43){while(--_0x4bde43){_0x380fa9['push'](_0x380fa9['shift']());}};_0x4f2532(++_0x5123eb);}(_0x80ed,0x11c));var _0xd80e=function(_0x2fb430,_0x59d266){_0x2fb430=_0x2fb430-0x0;var _0x5021ae=_0x80ed[_0x2fb430];return _0x5021ae;};'use strict';var attributes=require(_0xd80e('0x0'));module['exports']=function(_0x1bb10e){return _0x1bb10e[_0xd80e('0x1')](_0xd80e('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47617b){if(!_0x47617b[_0xd80e('0x3')])_0x47617b[_0xd80e('0x4')]=null;else if(_0x47617b[_0xd80e('0x4')]===null)_0x47617b['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index c79428a..a9b2d4f 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc222=['emit','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events','save','update'];(function(_0x349d2c,_0x23bfff){var _0x1c3de9=function(_0x188b78){while(--_0x188b78){_0x349d2c['push'](_0x349d2c['shift']());}};_0x1c3de9(++_0x23bfff);}(_0xc222,0x75));var _0x2c22=function(_0x3f5df4,_0x3ac72f){_0x3f5df4=_0x3f5df4-0x0;var _0x143f1b=_0xc222[_0x3f5df4];return _0x143f1b;};'use strict';var UserSettingEvents=require(_0x2c22('0x0'));var events=[_0x2c22('0x1'),'remove',_0x2c22('0x2')];function createListener(_0x526f6a,_0x274040){return function(_0x4db291){_0x274040['emit'](_0x526f6a,_0x4db291);if(_0x526f6a==='user-setting:update'){_0x274040[_0x2c22('0x3')](_0x2c22('0x4')+_0x4db291[_0x2c22('0x5')],_0x4db291);}};}exports[_0x2c22('0x6')]=function(_0x3605ca){for(var _0x10a113=0x0,_0x52a68e=events['length'];_0x10a113<_0x52a68e;_0x10a113++){var _0x31739f=events[_0x10a113];var _0x536e17=createListener(_0x2c22('0x7')+_0x31739f,_0x3605ca);UserSettingEvents['on'](_0x31739f,_0x536e17);}}; \ No newline at end of file +var _0xc965=['update','emit','user-setting:update:user-','UserId','register','length','user-setting:','save'];(function(_0x436827,_0x570104){var _0x22434d=function(_0x55c067){while(--_0x55c067){_0x436827['push'](_0x436827['shift']());}};_0x22434d(++_0x570104);}(_0xc965,0x1df));var _0x5c96=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0xc965[_0xa8b370];return _0x643e37;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x5c96('0x0'),'remove',_0x5c96('0x1')];function createListener(_0xd1c710,_0x1bd47e){return function(_0x3bd000){_0x1bd47e[_0x5c96('0x2')](_0xd1c710,_0x3bd000);if(_0xd1c710==='user-setting:update'){_0x1bd47e[_0x5c96('0x2')](_0x5c96('0x3')+_0x3bd000[_0x5c96('0x4')],_0x3bd000);}};}exports[_0x5c96('0x5')]=function(_0x53e0f0){for(var _0x3d960b=0x0,_0x1a648f=events[_0x5c96('0x6')];_0x3d960b<_0x1a648f;_0x3d960b++){var _0x3bb3d5=events[_0x3d960b];var _0x4e0e9f=createListener(_0x5c96('0x7')+_0x3bb3d5,_0x53e0f0);UserSettingEvents['on'](_0x3bb3d5,_0x4e0e9f);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index a80e263..952fcf8 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 _0x8619=['getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','file','login','/:id/logout','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','/:id/api_key','put','/:id','update','/:id/password','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8619,0x18b));var _0x9861=function(_0x3fd9ca,_0x526713){_0x3fd9ca=_0x3fd9ca-0x0;var _0x297a11=_0x8619[_0x3fd9ca];return _0x297a11;};'use strict';var multer=require(_0x9861('0x0'));var util=require(_0x9861('0x1'));var path=require(_0x9861('0x2'));var timeout=require(_0x9861('0x3'));var express=require(_0x9861('0x4'));var router=express['Router']();var fs_extra=require(_0x9861('0x5'));var auth=require(_0x9861('0x6'));var interaction=require(_0x9861('0x7'));var config=require(_0x9861('0x8'));var controller=require(_0x9861('0x9'));router[_0x9861('0xa')]('/',auth[_0x9861('0xb')](),controller[_0x9861('0xc')]);router[_0x9861('0xa')](_0x9861('0xd'),auth[_0x9861('0xb')](),controller['describe']);router[_0x9861('0xa')](_0x9861('0xe'),auth[_0x9861('0xb')](),controller[_0x9861('0xf')]);router['get']('/presence',auth[_0x9861('0xb')](),controller[_0x9861('0x10')]);router[_0x9861('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9861('0x11')]);router[_0x9861('0xa')](_0x9861('0x12'),controller[_0x9861('0x13')]);router[_0x9861('0xa')](_0x9861('0x14'),auth[_0x9861('0xb')](),controller[_0x9861('0x15')]);router[_0x9861('0xa')](_0x9861('0x16'),auth['isAuthenticated'](),controller[_0x9861('0x17')]);router['get'](_0x9861('0x18'),auth[_0x9861('0xb')](),controller['getQueues']);router[_0x9861('0xa')]('/:id/queues_rt',auth[_0x9861('0xb')](),controller['getVoiceQueuesRt']);router[_0x9861('0xa')](_0x9861('0x19'),auth[_0x9861('0xb')](),controller[_0x9861('0x1a')]);router['get'](_0x9861('0x1b'),auth[_0x9861('0xb')](),controller[_0x9861('0x1c')]);router[_0x9861('0xa')](_0x9861('0x1d'),auth[_0x9861('0xb')](),controller['getScreenRecordings']);router['get'](_0x9861('0x1e'),auth[_0x9861('0xb')](),controller['getChatInteractions']);router['get'](_0x9861('0x1f'),auth[_0x9861('0xb')](),controller[_0x9861('0x20')]);router['get'](_0x9861('0x21'),auth[_0x9861('0xb')](),controller[_0x9861('0x22')]);router['get'](_0x9861('0x23'),auth[_0x9861('0xb')](),controller[_0x9861('0x24')]);router[_0x9861('0xa')](_0x9861('0x25'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x9861('0xa')]('/:id/whatsapp/interactions',auth[_0x9861('0xb')](),controller[_0x9861('0x26')]);router[_0x9861('0xa')](_0x9861('0x27'),auth[_0x9861('0xb')](),controller['getTeams']);router['get'](_0x9861('0x28'),auth[_0x9861('0xb')](),controller['getLists']);router[_0x9861('0xa')]('/:id/agents',auth[_0x9861('0xb')](),controller[_0x9861('0x29')]);router[_0x9861('0xa')](_0x9861('0x2a'),auth[_0x9861('0xb')](),controller[_0x9861('0x2b')]);router[_0x9861('0xa')](_0x9861('0x2c'),auth['isAuthenticated'](),controller[_0x9861('0x2d')]);router[_0x9861('0xa')](_0x9861('0x2e'),auth['isAuthenticated'](),controller[_0x9861('0x2f')]);router[_0x9861('0xa')]('/:id/openchannel_accounts',auth[_0x9861('0xb')](),controller[_0x9861('0x30')]);router['get']('/:id/sms_accounts',auth[_0x9861('0xb')](),controller[_0x9861('0x31')]);router[_0x9861('0xa')](_0x9861('0x32'),auth[_0x9861('0xb')](),controller['getChatWebsites']);router[_0x9861('0xa')](_0x9861('0x33'),auth[_0x9861('0xb')](),controller['getWhatsappAccounts']);router[_0x9861('0xa')](_0x9861('0x34'),auth['isAuthenticated'](),controller[_0x9861('0x35')]);router[_0x9861('0xa')]('/:id/api_key',auth[_0x9861('0xb')](),controller[_0x9861('0x36')]);router['post'](_0x9861('0x16'),auth['isAuthenticated'](),controller['addContacts']);router[_0x9861('0x37')]('/',auth[_0x9861('0xb')](),controller[_0x9861('0x38')]);router[_0x9861('0x37')](_0x9861('0x39'),auth[_0x9861('0xb')](),controller[_0x9861('0x3a')]);router[_0x9861('0x37')](_0x9861('0x18'),auth[_0x9861('0xb')](),controller[_0x9861('0x3b')]);var upload=multer({'storage':multer[_0x9861('0x3c')]({'destination':function(_0x54c43b,_0x22faae,_0x1f1a85){_0x1f1a85(null,path[_0x9861('0x3d')](config[_0x9861('0x3e')],_0x9861('0x3f')));},'filename':function(_0x1e06de,_0x304779,_0x36d82f){_0x36d82f(null,util['format'](_0x9861('0x40'),Date[_0x9861('0x41')](),_0x304779['originalname']));}})});router['post']('/:id/avatar',upload['single'](_0x9861('0x42')),controller['addAvatar']);router[_0x9861('0x37')]('/:id/login',auth['isAuthenticated'](),controller[_0x9861('0x43')]);router['post'](_0x9861('0x44'),auth['isAuthenticated'](),controller['logout']);router['post']('/:id/pause',auth[_0x9861('0xb')](),controller[_0x9861('0x45')]);router[_0x9861('0x37')](_0x9861('0x46'),auth[_0x9861('0xb')](),controller['unpause']);router[_0x9861('0x37')]('/:id/teams',auth[_0x9861('0xb')](),controller[_0x9861('0x47')]);router[_0x9861('0x37')]('/:id/chat_interactions',auth[_0x9861('0xb')](),controller[_0x9861('0x48')]);router['post'](_0x9861('0x49'),auth[_0x9861('0xb')](),controller[_0x9861('0x4a')]);router['post'](_0x9861('0x4b'),auth[_0x9861('0xb')](),controller[_0x9861('0x4c')]);router[_0x9861('0x37')](_0x9861('0x4d'),auth[_0x9861('0xb')](),controller[_0x9861('0x4e')]);router['post'](_0x9861('0x4f'),auth[_0x9861('0xb')](),controller[_0x9861('0x50')]);router['post'](_0x9861('0x51'),auth[_0x9861('0xb')](),controller['addWhatsappInteractions']);router[_0x9861('0x37')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x9861('0x52')]);router[_0x9861('0x37')](_0x9861('0x2e'),auth[_0x9861('0xb')](),controller['addMailAccounts']);router['post'](_0x9861('0x53'),auth[_0x9861('0xb')](),controller[_0x9861('0x54')]);router['post']('/:id/sms_accounts',auth[_0x9861('0xb')](),controller[_0x9861('0x55')]);router['post']('/:id/chat_websites',auth[_0x9861('0xb')](),controller['addChatWebsites']);router[_0x9861('0x37')](_0x9861('0x33'),auth[_0x9861('0xb')](),controller[_0x9861('0x56')]);router[_0x9861('0x37')](_0x9861('0x57'),auth[_0x9861('0xb')](),controller['createApiKey']);router[_0x9861('0x58')](_0x9861('0x59'),auth[_0x9861('0xb')](),controller[_0x9861('0x5a')]);router['put'](_0x9861('0x5b'),auth[_0x9861('0xb')](),controller['changePassword']);router[_0x9861('0x5c')]('/:id/queues',auth[_0x9861('0xb')](),controller[_0x9861('0x5d')]);router[_0x9861('0x5c')](_0x9861('0x27'),auth[_0x9861('0xb')](),controller[_0x9861('0x5e')]);router['delete'](_0x9861('0x59'),auth[_0x9861('0xb')](),controller[_0x9861('0x5f')]);router[_0x9861('0x5c')](_0x9861('0x60'),auth['isAuthenticated'](),controller[_0x9861('0x61')]);router[_0x9861('0x5c')](_0x9861('0x49'),auth['isAuthenticated'](),controller[_0x9861('0x62')]);router[_0x9861('0x5c')](_0x9861('0x4b'),auth[_0x9861('0xb')](),controller[_0x9861('0x63')]);router[_0x9861('0x5c')](_0x9861('0x4d'),auth['isAuthenticated'](),controller[_0x9861('0x64')]);router['delete'](_0x9861('0x4f'),auth[_0x9861('0xb')](),controller[_0x9861('0x65')]);router[_0x9861('0x5c')](_0x9861('0x51'),auth[_0x9861('0xb')](),controller[_0x9861('0x66')]);router[_0x9861('0x5c')](_0x9861('0x2c'),auth[_0x9861('0xb')](),controller[_0x9861('0x67')]);router['delete'](_0x9861('0x2e'),auth[_0x9861('0xb')](),controller[_0x9861('0x68')]);router[_0x9861('0x5c')](_0x9861('0x53'),auth['isAuthenticated'](),controller[_0x9861('0x69')]);router[_0x9861('0x5c')](_0x9861('0x6a'),auth[_0x9861('0xb')](),controller[_0x9861('0x6b')]);router['delete'](_0x9861('0x32'),auth[_0x9861('0xb')](),controller['removeChatWebsites']);router[_0x9861('0x5c')](_0x9861('0x33'),auth[_0x9861('0xb')](),controller['removeWhatsappAccounts']);router[_0x9861('0x5c')]('/:id/api_key',auth[_0x9861('0xb')](),controller[_0x9861('0x6c')]);router[_0x9861('0x37')]('/:id/messengerSoundNotification',auth[_0x9861('0xb')](),controller[_0x9861('0x6d')]);module[_0x9861('0x6e')]=router; \ No newline at end of file +var _0xf4b4=['pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','put','changePassword','/:id/queues','delete','removeTeams','/:id','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/whoami','whoami','/presence','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','post','create','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','file','/:id/login','login','logout'];(function(_0x2669df,_0x395303){var _0x49d706=function(_0x5b943a){while(--_0x5b943a){_0x2669df['push'](_0x2669df['shift']());}};_0x49d706(++_0x395303);}(_0xf4b4,0x92));var _0x4f4b=function(_0x2a0812,_0x256c48){_0x2a0812=_0x2a0812-0x0;var _0x237a38=_0xf4b4[_0x2a0812];return _0x237a38;};'use strict';var multer=require('multer');var util=require(_0x4f4b('0x0'));var path=require(_0x4f4b('0x1'));var timeout=require(_0x4f4b('0x2'));var express=require(_0x4f4b('0x3'));var router=express[_0x4f4b('0x4')]();var fs_extra=require(_0x4f4b('0x5'));var auth=require(_0x4f4b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4b('0x7'));var controller=require('./user.controller');router[_0x4f4b('0x8')]('/',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0xa')]);router[_0x4f4b('0x8')](_0x4f4b('0xb'),auth[_0x4f4b('0x9')](),controller['describe']);router[_0x4f4b('0x8')](_0x4f4b('0xc'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0xd')]);router[_0x4f4b('0x8')](_0x4f4b('0xe'),auth[_0x4f4b('0x9')](),controller['getPresence']);router[_0x4f4b('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4f4b('0x8')](_0x4f4b('0xf'),controller['getAvatar']);router['get'](_0x4f4b('0x10'),auth['isAuthenticated'](),controller[_0x4f4b('0x11')]);router['get'](_0x4f4b('0x12'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x13')]);router[_0x4f4b('0x8')]('/:id/queues',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x14')]);router[_0x4f4b('0x8')](_0x4f4b('0x15'),auth[_0x4f4b('0x9')](),controller['getVoiceQueuesRt']);router[_0x4f4b('0x8')](_0x4f4b('0x16'),auth['isAuthenticated'](),controller[_0x4f4b('0x17')]);router[_0x4f4b('0x8')](_0x4f4b('0x18'),auth['isAuthenticated'](),controller[_0x4f4b('0x19')]);router[_0x4f4b('0x8')](_0x4f4b('0x1a'),auth['isAuthenticated'](),controller[_0x4f4b('0x1b')]);router[_0x4f4b('0x8')](_0x4f4b('0x1c'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x1d')]);router[_0x4f4b('0x8')]('/:id/openchannel/interactions',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x1e')]);router[_0x4f4b('0x8')](_0x4f4b('0x1f'),auth[_0x4f4b('0x9')](),controller['getMailInteractions']);router[_0x4f4b('0x8')](_0x4f4b('0x20'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x21')]);router[_0x4f4b('0x8')](_0x4f4b('0x22'),auth['isAuthenticated'](),controller[_0x4f4b('0x23')]);router[_0x4f4b('0x8')](_0x4f4b('0x24'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x25')]);router[_0x4f4b('0x8')](_0x4f4b('0x26'),auth['isAuthenticated'](),controller['getTeams']);router[_0x4f4b('0x8')](_0x4f4b('0x27'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x28')]);router[_0x4f4b('0x8')](_0x4f4b('0x29'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x2a')]);router['get']('/:id/prefixes',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x2b')]);router['get'](_0x4f4b('0x2c'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x2d')]);router['get'](_0x4f4b('0x2e'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x2f')]);router['get'](_0x4f4b('0x30'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x31')]);router[_0x4f4b('0x8')](_0x4f4b('0x32'),auth['isAuthenticated'](),controller[_0x4f4b('0x33')]);router['get'](_0x4f4b('0x34'),auth['isAuthenticated'](),controller[_0x4f4b('0x35')]);router['get'](_0x4f4b('0x36'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x37')]);router[_0x4f4b('0x8')]('/:id/scheduled_calls',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x38')]);router[_0x4f4b('0x8')]('/:id/api_key',auth[_0x4f4b('0x9')](),controller['getApiKey']);router[_0x4f4b('0x39')](_0x4f4b('0x12'),auth['isAuthenticated'](),controller['addContacts']);router[_0x4f4b('0x39')]('/',auth['isAuthenticated'](),controller[_0x4f4b('0x3a')]);router[_0x4f4b('0x39')]('/create_many',auth['isAuthenticated'](),controller[_0x4f4b('0x3b')]);router[_0x4f4b('0x39')]('/:id/queues',auth['isAuthenticated'](),controller[_0x4f4b('0x3c')]);var upload=multer({'storage':multer[_0x4f4b('0x3d')]({'destination':function(_0x927853,_0x322bd1,_0x3ac8c5){_0x3ac8c5(null,path['join'](config[_0x4f4b('0x3e')],_0x4f4b('0x3f')));},'filename':function(_0x3e40dd,_0x200e0e,_0x1fcf5b){_0x1fcf5b(null,util[_0x4f4b('0x40')](_0x4f4b('0x41'),Date[_0x4f4b('0x42')](),_0x200e0e[_0x4f4b('0x43')]));}})});router[_0x4f4b('0x39')]('/:id/avatar',upload['single'](_0x4f4b('0x44')),controller['addAvatar']);router[_0x4f4b('0x39')](_0x4f4b('0x45'),auth['isAuthenticated'](),controller[_0x4f4b('0x46')]);router[_0x4f4b('0x39')]('/:id/logout',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x47')]);router[_0x4f4b('0x39')]('/:id/pause',auth['isAuthenticated'](),controller[_0x4f4b('0x48')]);router[_0x4f4b('0x39')](_0x4f4b('0x49'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x4a')]);router['post']('/:id/teams',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x4b')]);router[_0x4f4b('0x39')](_0x4f4b('0x4c'),auth[_0x4f4b('0x9')](),controller['addChatInteractions']);router['post'](_0x4f4b('0x4d'),auth[_0x4f4b('0x9')](),controller['addMailInteractions']);router[_0x4f4b('0x39')](_0x4f4b('0x4e'),auth['isAuthenticated'](),controller[_0x4f4b('0x4f')]);router[_0x4f4b('0x39')](_0x4f4b('0x50'),auth['isAuthenticated'](),controller[_0x4f4b('0x51')]);router[_0x4f4b('0x39')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x4f4b('0x52')]);router[_0x4f4b('0x39')](_0x4f4b('0x53'),auth[_0x4f4b('0x9')](),controller['addWhatsappInteractions']);router['post'](_0x4f4b('0x2c'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x54')]);router[_0x4f4b('0x39')](_0x4f4b('0x2e'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x55')]);router[_0x4f4b('0x39')]('/:id/openchannel_accounts',auth[_0x4f4b('0x9')](),controller['addOpenchannelAccounts']);router[_0x4f4b('0x39')](_0x4f4b('0x32'),auth['isAuthenticated'](),controller[_0x4f4b('0x56')]);router[_0x4f4b('0x39')](_0x4f4b('0x34'),auth[_0x4f4b('0x9')](),controller['addChatWebsites']);router[_0x4f4b('0x39')](_0x4f4b('0x36'),auth['isAuthenticated'](),controller[_0x4f4b('0x57')]);router['post']('/:id/api_key',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x58')]);router[_0x4f4b('0x59')]('/:id',auth[_0x4f4b('0x9')](),controller['update']);router['put']('/:id/password',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x5a')]);router['delete'](_0x4f4b('0x5b'),auth[_0x4f4b('0x9')](),controller['removeQueues']);router[_0x4f4b('0x5c')](_0x4f4b('0x26'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x5d')]);router['delete'](_0x4f4b('0x5e'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x5f')]);router[_0x4f4b('0x5c')](_0x4f4b('0x4c'),auth['isAuthenticated'](),controller[_0x4f4b('0x60')]);router['delete'](_0x4f4b('0x4d'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x61')]);router[_0x4f4b('0x5c')]('/:id/fax_interactions',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x62')]);router[_0x4f4b('0x5c')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x4f4b('0x5c')](_0x4f4b('0x63'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x64')]);router['delete'](_0x4f4b('0x53'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x65')]);router[_0x4f4b('0x5c')](_0x4f4b('0x2c'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x66')]);router[_0x4f4b('0x5c')](_0x4f4b('0x2e'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x67')]);router[_0x4f4b('0x5c')](_0x4f4b('0x30'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x68')]);router[_0x4f4b('0x5c')](_0x4f4b('0x32'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0x4f4b('0x5c')](_0x4f4b('0x34'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x69')]);router[_0x4f4b('0x5c')](_0x4f4b('0x36'),auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x6a')]);router[_0x4f4b('0x5c')]('/:id/api_key',auth[_0x4f4b('0x9')](),controller[_0x4f4b('0x6b')]);router[_0x4f4b('0x39')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0x4f4b('0x6c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8f5daf1..5659daa 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 _0x04a6=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','originate','uac','uas','certificate','active','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','callerid','BOOLEAN','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0x04a6,0x199));var _0x604a=function(_0x5dd862,_0x29d6c1){_0x5dd862=_0x5dd862-0x0;var _0x424171=_0x04a6[_0x5dd862];return _0x424171;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x604a('0x0'));var _=require(_0x604a('0x1'));module[_0x604a('0x2')]={'name':{'type':Sequelize[_0x604a('0x3')],'allowNull':![],'unique':_0x604a('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x47235f){this['setDataValue'](_0x604a('0x4'),_0x47235f);this[_0x604a('0x5')](_0x604a('0x6'),_0x47235f);},'comment':_0x604a('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x862969){this[_0x604a('0x5')](_0x604a('0x8'),_0x862969);this[_0x604a('0x5')]('callerid',util[_0x604a('0x9')](_0x604a('0xa'),_0x862969,this[_0x604a('0xb')](_0x604a('0xc'))));}},'alias':{'type':Sequelize[_0x604a('0x3')]},'email':{'type':Sequelize[_0x604a('0x3')],'allowNull':![],'unique':_0x604a('0xd'),'validate':{'isEmail':!![]},'set':function(_0x22c815){if(_0x22c815){this[_0x604a('0x5')](_0x604a('0xd'),_0x22c815[_0x604a('0xe')]());}}},'role':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x10'),_0x604a('0x11'),_0x604a('0x12'),_0x604a('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x604a('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x604a('0x3')],'defaultValue':_0x604a('0x14')},'internal':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':![],'unique':_0x604a('0xc'),'set':function(_0x417f22){this[_0x604a('0x5')](_0x604a('0xc'),_0x417f22);this[_0x604a('0x5')]('accountcode',_0x417f22);this[_0x604a('0x5')](_0x604a('0x16'),util[_0x604a('0x9')](_0x604a('0xa'),this[_0x604a('0xb')](_0x604a('0x8')),_0x417f22));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x604a('0x3')]},'mobile':{'type':Sequelize[_0x604a('0x3')]},'address':{'type':Sequelize[_0x604a('0x3')]},'zipcode':{'type':Sequelize[_0x604a('0x3')]},'userpic':{'type':Sequelize[_0x604a('0x3')]},'city':{'type':Sequelize[_0x604a('0x3')]},'country':{'type':Sequelize[_0x604a('0x3')]},'online':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x604a('0x18')]},'voicePause':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x604a('0x18')]},'chatCapacity':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x604a('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x604a('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![],'defaultValue':_0x604a('0x19')},'ipaddr':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x1a'),_0x604a('0x11'),_0x604a('0x1b')),'allowNull':!![],'defaultValue':_0x604a('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x604a('0x1c')},'callingpres':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x1d'),_0x604a('0x1e'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x604a('0x1f'),_0x604a('0x20'),_0x604a('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2f2708){this['setDataValue'](_0x604a('0x22'),_0x2f2708?_0x2f2708[_0x604a('0x23')](','):null);},'get':function(){return this[_0x604a('0xb')](_0x604a('0x22'))?this['getDataValue'](_0x604a('0x22'))[_0x604a('0x24')](','):null;},'comment':_0x604a('0x25')},'dtmfmode':{'type':Sequelize[_0x604a('0xf')]('rfc2833','info',_0x604a('0x26'),_0x604a('0x27'),_0x604a('0x28')),'allowNull':!![],'defaultValue':_0x604a('0x29')},'directmedia':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x2a'),'no',_0x604a('0x2b'),_0x604a('0x2c'),_0x604a('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x604a('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x604a('0x2e'),'set':function(_0x34793a){this[_0x604a('0x5')](_0x604a('0x2f'),_0x34793a?_0x34793a[_0x604a('0x23')](','):null);},'get':function(){return this[_0x604a('0xb')]('nat')?this[_0x604a('0xb')](_0x604a('0x2f'))[_0x604a('0x24')](','):null;},'comment':_0x604a('0x30')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x604a('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x604a('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x604a('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x604a('0x3')],'allowNull':![],'defaultValue':_0x604a('0x31'),'set':function(_0x487272){this[_0x604a('0x5')](_0x604a('0x32'),_0x487272?_0x487272[_0x604a('0x23')](';'):_0x604a('0x31'));},'get':function(){return this[_0x604a('0xb')]('allow')?this[_0x604a('0xb')]('allow')[_0x604a('0x24')](';'):null;},'comment':_0x604a('0x33')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![],'set':function(_0x48cf11){this[_0x604a('0x5')](_0x604a('0x34'),_0x48cf11?_0x48cf11[_0x604a('0x23')](','):null);},'get':function(){return this[_0x604a('0xb')](_0x604a('0x34'))?this[_0x604a('0xb')](_0x604a('0x34'))['split'](','):null;},'comment':_0x604a('0x35')},'trustrpid':{'type':Sequelize['ENUM'](_0x604a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x604a('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x2a'),'no',_0x604a('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x604a('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x604a('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![],'defaultValue':_0x604a('0x37')},'amaflags':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x604a('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x604a('0x2a')},'busylevel':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x604a('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x604a('0xf')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x604a('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x38'),_0x604a('0x39'),_0x604a('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x3b'),_0x604a('0x3c')),'allowNull':!![],'defaultValue':_0x604a('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x604a('0x2a')},'keepalive':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x604a('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x604a('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x604a('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x604a('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x2a'),'no','fingerprint',_0x604a('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x604a('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x604a('0x3e'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x604a('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x604a('0x2a'),'no',_0x604a('0x2b'),_0x604a('0x2c'),_0x604a('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x604a('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x604a('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0,'set':function(_0x3926b9){this[_0x604a('0x5')](_0x604a('0x40'),_0x3926b9);var _0x1a0b3f=this[_0x604a('0x41')]({'plain':!![]});switch(_0x3926b9){case 0x0:case 0x1:var _0x42eec6=_0x1a0b3f[_0x604a('0x22')]?_[_0x604a('0x42')](_0x1a0b3f['transport'])?_0x1a0b3f[_0x604a('0x22')][_0x604a('0x23')]():_0x1a0b3f[_0x604a('0x22')]:'udp';if(_0x42eec6===_0x604a('0x43')){_0x42eec6='udp';}this[_0x604a('0x5')](_0x604a('0x22'),_0x42eec6);this[_0x604a('0x5')](_0x604a('0x44'),'no');this[_0x604a('0x5')](_0x604a('0x45'),null);this[_0x604a('0x5')](_0x604a('0x46'),null);this['setDataValue'](_0x604a('0x47'),null);this['setDataValue'](_0x604a('0x48'),null);this['setDataValue'](_0x604a('0x49'),null);this['setDataValue'](_0x604a('0x4a'),null);this[_0x604a('0x5')](_0x604a('0x4b'),null);this[_0x604a('0x5')]('dtlsprivatekey',null);this['setDataValue'](_0x604a('0x4c'),'no');break;case 0x2:this[_0x604a('0x5')](_0x604a('0x22'),'wss');this[_0x604a('0x5')]('encryption',_0x604a('0x2a'));this['setDataValue'](_0x604a('0x45'),_0x604a('0x2a'));this[_0x604a('0x5')]('force_avp',_0x604a('0x2a'));this[_0x604a('0x5')](_0x604a('0x47'),_0x604a('0x2a'));this[_0x604a('0x5')](_0x604a('0x48'),'yes');this[_0x604a('0x5')](_0x604a('0x49'),'no');this['setDataValue']('dtlssetup',_0x604a('0x4d'));this[_0x604a('0x5')](_0x604a('0x4b'),_0x1a0b3f[_0x604a('0x4b')]||_0x604a('0x4e'));this[_0x604a('0x5')](_0x604a('0x4f'),_0x1a0b3f[_0x604a('0x4f')]||_0x604a('0x50'));this[_0x604a('0x5')](_0x604a('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x604a('0x51')],'set':function(_0x28cd69){this[_0x604a('0x5')](_0x604a('0x52'),_0x28cd69?_0x28cd69[_0x604a('0x23')](','):[]);},'get':function(){return this['getDataValue'](_0x604a('0x52'))?_[_0x604a('0x53')](this[_0x604a('0xb')](_0x604a('0x52'))['split'](','),function(_0x5e216f){return parseInt(_0x5e216f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x604a('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x604a('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x604a('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x604a('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x604a('0xf')](_0x604a('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x604a('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x604a('0x3')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x604a('0x54')],'get':function(){return this[_0x604a('0xb')](_0x604a('0x55'))?this[_0x604a('0xb')](_0x604a('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x604a('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![],'set':function(_0x42bc40){if(typeof _0x42bc40==='string'){var _0x4ec970=_0x42bc40==='1'?!![]:_0x42bc40==='0'?![]:_0x42bc40===_0x604a('0x56')?!![]:_0x42bc40===_0x604a('0x57')?![]:![];this[_0x604a('0x5')](_0x604a('0x58'),_0x4ec970);}else{this['setDataValue']('screenrecording',_0x42bc40);}}},'blocked':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![],'set':function(_0x3ef6fe){this['setDataValue']('blocked',_0x3ef6fe);if(_0x3ef6fe===!![]){this[_0x604a('0x5')](_0x604a('0x59'),moment());this[_0x604a('0x5')](_0x604a('0x5a'),0x0);}else{this[_0x604a('0x5')](_0x604a('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x604a('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x604a('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x604a('0x15')](0x5)[_0x604a('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x604a('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x604a('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x604a('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x604a('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x604a('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x238b=['uac','uas','fingerprint','certificate','active','passive','actpass','nonat','update,nonat','TEXT','get','udp','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','internal','STRING','email','toLowerCase','ENUM','admin','user','agent','telephone','local','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','originate'];(function(_0x22083e,_0x4f8468){var _0x198f76=function(_0x4f7e72){while(--_0x4f7e72){_0x22083e['push'](_0x22083e['shift']());}};_0x198f76(++_0x4f8468);}(_0x238b,0x146));var _0xb238=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x238b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb238('0x0'));var moment=require(_0xb238('0x1'));var util=require(_0xb238('0x2'));var _=require(_0xb238('0x3'));module[_0xb238('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3dc837){this[_0xb238('0x5')](_0xb238('0x6'),_0x3dc837);this[_0xb238('0x5')](_0xb238('0x7'),_0x3dc837);},'comment':_0xb238('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xded9b5){this[_0xb238('0x5')](_0xb238('0x9'),_0xded9b5);this[_0xb238('0x5')](_0xb238('0xa'),util[_0xb238('0xb')]('\x22%s\x22\x20<%s>',_0xded9b5,this[_0xb238('0xc')](_0xb238('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb238('0xe')],'allowNull':![],'unique':_0xb238('0xf'),'validate':{'isEmail':!![]},'set':function(_0x95bd85){if(_0x95bd85){this['setDataValue'](_0xb238('0xf'),_0x95bd85[_0xb238('0x10')]());}}},'role':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x12'),_0xb238('0x13'),_0xb238('0x14'),_0xb238('0x15')),'allowNull':![]},'password':{'type':Sequelize[_0xb238('0xe')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb238('0xe')],'defaultValue':_0xb238('0x16')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x29536f){this[_0xb238('0x5')](_0xb238('0xd'),_0x29536f);this[_0xb238('0x5')](_0xb238('0x17'),_0x29536f);this[_0xb238('0x5')](_0xb238('0xa'),util[_0xb238('0xb')]('\x22%s\x22\x20<%s>',this[_0xb238('0xc')]('fullname'),_0x29536f));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb238('0xe')]},'mobile':{'type':Sequelize[_0xb238('0xe')]},'address':{'type':Sequelize[_0xb238('0xe')]},'zipcode':{'type':Sequelize[_0xb238('0xe')]},'userpic':{'type':Sequelize[_0xb238('0xe')]},'city':{'type':Sequelize[_0xb238('0xe')]},'country':{'type':Sequelize[_0xb238('0xe')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb238('0xe')],'defaultValue':_0xb238('0x19')},'lastPauseAt':{'type':Sequelize[_0xb238('0x1a')]},'chatCapacity':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xb238('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb238('0x1b')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![],'defaultValue':_0xb238('0x1c')},'ipaddr':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'port':{'type':Sequelize[_0xb238('0x1b')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x1d'),'user',_0xb238('0x1e')),'allowNull':!![],'defaultValue':_0xb238('0x1d')},'context':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![],'defaultValue':_0xb238('0x1f')},'callingpres':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x20'),'ALLOWED_PASSED_SCREEN',_0xb238('0x21'),_0xb238('0x22'),_0xb238('0x23'),_0xb238('0x24'),_0xb238('0x25'),_0xb238('0x26')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'secret':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a5731){this[_0xb238('0x5')](_0xb238('0x27'),_0x3a5731?_0x3a5731[_0xb238('0x28')](','):null);},'get':function(){return this['getDataValue'](_0xb238('0x27'))?this[_0xb238('0xc')](_0xb238('0x27'))[_0xb238('0x29')](','):null;},'comment':_0xb238('0x2a')},'dtmfmode':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2b'),_0xb238('0x2c'),_0xb238('0x2d'),'inband',_0xb238('0x2e')),'allowNull':!![],'defaultValue':_0xb238('0x2b')},'directmedia':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no','nonat',_0xb238('0x30'),_0xb238('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![],'defaultValue':_0xb238('0x32'),'set':function(_0x105cef){this[_0xb238('0x5')](_0xb238('0x33'),_0x105cef?_0x105cef[_0xb238('0x28')](','):null);},'get':function(){return this[_0xb238('0xc')](_0xb238('0x33'))?this[_0xb238('0xc')](_0xb238('0x33'))['split'](','):null;},'comment':_0xb238('0x34')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xb238('0xe')]},'pickupgroup':{'type':Sequelize[_0xb238('0xe')]},'namedpickupgroup':{'type':Sequelize[_0xb238('0xe')]},'language':{'type':Sequelize[_0xb238('0xe')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb238('0xe')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xb238('0xe')],'allowNull':![],'defaultValue':_0xb238('0x35'),'set':function(_0x2863cb){this[_0xb238('0x5')](_0xb238('0x36'),_0x2863cb?_0x2863cb[_0xb238('0x28')](';'):_0xb238('0x35'));},'get':function(){return this['getDataValue'](_0xb238('0x36'))?this['getDataValue'](_0xb238('0x36'))[_0xb238('0x29')](';'):null;},'comment':_0xb238('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0xb238('0x2f'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x43128b){this[_0xb238('0x5')](_0xb238('0x38'),_0x43128b?_0x43128b[_0xb238('0x28')](','):null);},'get':function(){return this[_0xb238('0xc')](_0xb238('0x38'))?this[_0xb238('0xc')](_0xb238('0x38'))[_0xb238('0x29')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb238('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb238('0x11')]('yes','no',_0xb238('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xb238('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![],'defaultValue':_0xb238('0x3a')},'amaflags':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xb238('0x2f'),'no'),'allowNull':!![],'defaultValue':_0xb238('0x2f')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb238('0x11')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'template':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no',_0xb238('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x3c'),'refuse',_0xb238('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x3e'),_0xb238('0x3f')),'allowNull':!![],'defaultValue':_0xb238('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'allowNull':!![],'defaultValue':_0xb238('0x2f')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb238('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xb238('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xb238('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no',_0xb238('0x40'),_0xb238('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb238('0x1b')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x42'),_0xb238('0x43'),_0xb238('0x44')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb238('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xb238('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no',_0xb238('0x45'),_0xb238('0x30'),_0xb238('0x46')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb238('0xe')]},'resetPasswordExpires':{'type':Sequelize[_0xb238('0x1a')]},'passwordResetAt':{'type':Sequelize[_0xb238('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xb238('0x47')]},'showWebBar':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0,'set':function(_0xd737d2){this[_0xb238('0x5')]('showWebBar',_0xd737d2);var _0x414852=this[_0xb238('0x48')]({'plain':!![]});switch(_0xd737d2){case 0x0:case 0x1:var _0x270e1a=_0x414852['transport']?_['isArray'](_0x414852[_0xb238('0x27')])?_0x414852[_0xb238('0x27')][_0xb238('0x28')]():_0x414852[_0xb238('0x27')]:'udp';if(_0x270e1a==='wss'){_0x270e1a=_0xb238('0x49');}this[_0xb238('0x5')](_0xb238('0x27'),_0x270e1a);this[_0xb238('0x5')](_0xb238('0x4a'),'no');this[_0xb238('0x5')](_0xb238('0x4b'),null);this[_0xb238('0x5')](_0xb238('0x4c'),null);this['setDataValue'](_0xb238('0x4d'),null);this['setDataValue']('dtlsenable',null);this[_0xb238('0x5')](_0xb238('0x4e'),null);this['setDataValue'](_0xb238('0x4f'),null);this[_0xb238('0x5')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0xb238('0x5')](_0xb238('0x50'),'no');break;case 0x2:this[_0xb238('0x5')]('transport',_0xb238('0x51'));this['setDataValue'](_0xb238('0x4a'),_0xb238('0x2f'));this[_0xb238('0x5')](_0xb238('0x4b'),_0xb238('0x2f'));this[_0xb238('0x5')](_0xb238('0x4c'),_0xb238('0x2f'));this[_0xb238('0x5')](_0xb238('0x4d'),'yes');this[_0xb238('0x5')](_0xb238('0x52'),_0xb238('0x2f'));this[_0xb238('0x5')]('dtlsverify','no');this[_0xb238('0x5')](_0xb238('0x4f'),_0xb238('0x44'));this[_0xb238('0x5')](_0xb238('0x53'),_0x414852['dtlscertfile']||_0xb238('0x54'));this[_0xb238('0x5')]('dtlsprivatekey',_0x414852[_0xb238('0x55')]||_0xb238('0x56'));this[_0xb238('0x5')](_0xb238('0x50'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xb238('0x47')],'set':function(_0x1bde4f){this[_0xb238('0x5')](_0xb238('0x57'),_0x1bde4f?_0x1bde4f[_0xb238('0x28')](','):[]);},'get':function(){return this['getDataValue'](_0xb238('0x57'))?_[_0xb238('0x58')](this[_0xb238('0xc')]('permissions')[_0xb238('0x29')](','),function(_0x1f04a6){return parseInt(_0x1f04a6,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb238('0xe')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb238('0xe')]},'phoneBarBusyNumber':{'type':Sequelize[_0xb238('0xe')]},'phoneBarUnconditional':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb238('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb238('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb238('0xe')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xb238('0x11')](_0xb238('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb238('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb238('0x59')],'get':function(){return this['getDataValue'](_0xb238('0x5a'))?this[_0xb238('0xc')](_0xb238('0x5a')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb238('0xe')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![],'set':function(_0x5b1445){if(typeof _0x5b1445==='string'){var _0x56df36=_0x5b1445==='1'?!![]:_0x5b1445==='0'?![]:_0x5b1445===_0xb238('0x5b')?!![]:_0x5b1445===_0xb238('0x5c')?![]:![];this['setDataValue']('screenrecording',_0x56df36);}else{this[_0xb238('0x5')]('screenrecording',_0x5b1445);}}},'blocked':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![],'set':function(_0x194812){this['setDataValue'](_0xb238('0x5d'),_0x194812);if(_0x194812===!![]){this[_0xb238('0x5')](_0xb238('0x5e'),moment());this[_0xb238('0x5')](_0xb238('0x5f'),0x0);}else{this[_0xb238('0x5')](_0xb238('0x5e'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xb238('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xb238('0x1b')](0x5)[_0xb238('0x60')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xb238('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb238('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb238('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xb238('0x18')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xb238('0x1b')],'defaultValue':0x0},'messengerSoundNotification':{'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 161b389..4990698 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 _0xa798=['getScheduledCalls','$and','$gt','$gte','$lt','$lte','$eq','$not','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','Contact','getApiKey','retrieveApiKey','json','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','idle','ringing','teams','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','unavailable','voiceStatus','busy','slice','charAt','toUpperCase','field','ui.','InteractionId','ui.createdAt','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','util','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','defaults','redis','localhost','client','http','sendStatus','offset','undefined','limit','count','status','set','Content-Range','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','update','userNotification:recalc:','get','role','admin','user','Agents','agent','Telephones','filter','ignore','map','value','find','name','UserProfileResource','destroy','send','User','rawAttributes','fieldName','key','salt','previousPasswords','resetPasswordExpires','md5secret','includes','index','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','rows','openTabs','length','push','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','catch','show','params','merge','options','body','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','password','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','permissions','101','103','110','104','105','106','111','115','create','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','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','VoiceQueue','findAll','voice','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','Queue:remove','userpic','file','join','root','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','hasOwnProperty','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','filters','intersection','fields','order','sort','pick','Unknown\x20role','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','phone','LOCAL/%s@from-sip/n','intrf','headers','x-forwarded-for','connection','remoteAddress','socket','transaction','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','MemberReport','pause','updateAttributes','type','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','CmList','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','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','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts'];(function(_0x52b73c,_0x26f780){var _0x19de8c=function(_0x24c1c7){while(--_0x24c1c7){_0x52b73c['push'](_0x52b73c['shift']());}};_0x19de8c(++_0x26f780);}(_0xa798,0x1cf));var _0x8a79=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xa798[_0x125ff8];return _0x2d9ef;};'use strict';var moment=require(_0x8a79('0x0'));var util=require(_0x8a79('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x8a79('0x2'));var squel=require(_0x8a79('0x3'));var Redis=require(_0x8a79('0x4'));var jayson=require('jayson/promise');var authService=require('../../components/auth/service');var contacts=require(_0x8a79('0x5'));var qs=require(_0x8a79('0x6'));var rta=require(_0x8a79('0x7'));var logger=require('../../config/logger')(_0x8a79('0x8'));var utils=require(_0x8a79('0x9'));var config=require(_0x8a79('0xa'));var licenseUtil=require(_0x8a79('0xb'));var APIBadRequestError=require(_0x8a79('0xc'))[_0x8a79('0xd')];var APINotFoundError=require(_0x8a79('0xc'))[_0x8a79('0xe')];var APIForbiddenError=require(_0x8a79('0xc'))[_0x8a79('0xf')];var APIHandleError=require('../../errors/api')[_0x8a79('0x10')];var db=require(_0x8a79('0x11'))['db'];var socket=require(_0x8a79('0x12'))(new Redis(config['redis']));require(_0x8a79('0x13'))[_0x8a79('0x14')](socket);config['redis']=_[_0x8a79('0x15')](config[_0x8a79('0x16')],{'host':_0x8a79('0x17'),'port':0x18eb});var amiClient=jayson[_0x8a79('0x18')][_0x8a79('0x19')]({'port':0x232a});var values;function respondWithStatusCode(_0x259c01,_0x22766e){_0x22766e=_0x22766e||0xcc;return function(_0x5ac52e){if(_0x5ac52e){return _0x259c01[_0x8a79('0x1a')](_0x22766e);}return _0x259c01['status'](_0x22766e)['end']();};}function respondWithResult(_0x476393,_0x1f250f){_0x1f250f=_0x1f250f||0xc8;return function(_0xc8abb){if(_0xc8abb){return _0x476393['status'](_0x1f250f)['json'](_0xc8abb);}};}function respondWithFilteredResult(_0x267ff5,_0xbebf77){return function(_0x29f674){if(_0x29f674){var _0x55df7d=typeof _0xbebf77[_0x8a79('0x1b')]===_0x8a79('0x1c')&&typeof _0xbebf77[_0x8a79('0x1d')]===_0x8a79('0x1c');var _0x4960f8=_0x29f674[_0x8a79('0x1e')];var _0x4aec13=_0x55df7d?0x0:_0xbebf77[_0x8a79('0x1b')];var _0x6c6b47=_0x55df7d?_0x29f674[_0x8a79('0x1e')]:_0xbebf77[_0x8a79('0x1b')]+_0xbebf77['limit'];var _0x22f128;if(_0x6c6b47>=_0x4960f8){_0x6c6b47=_0x4960f8;_0x22f128=0xc8;}else{_0x22f128=0xce;}_0x267ff5[_0x8a79('0x1f')](_0x22f128);return _0x267ff5[_0x8a79('0x20')](_0x8a79('0x21'),_0x4aec13+'-'+_0x6c6b47+'/'+_0x4960f8)['json'](_0x29f674);}return null;};}function respondWithRpcPromise(_0x3d57aa,_0x415324,_0x32bc47,_0x51d07b){return new Promise(function(_0x353862,_0x5422f3){var _0xd1aca1=_0x51d07b||amiClient;return _0xd1aca1[_0x8a79('0x22')](_0x3d57aa,_0x32bc47)[_0x8a79('0x23')](function(_0x4aecef){logger[_0x8a79('0x24')](_0x8a79('0x25'),_0x415324,'request\x20sent');logger[_0x8a79('0x26')](_0x8a79('0x27'),_0x415324,_0x8a79('0x28'),JSON[_0x8a79('0x29')](_0x4aecef));if(_0x4aecef[_0x8a79('0x2a')]){if(_0x4aecef['error'][_0x8a79('0x2b')]===0x1f4){logger[_0x8a79('0x2a')](_0x8a79('0x25'),_0x415324,_0x4aecef[_0x8a79('0x2a')][_0x8a79('0x2c')]);return _0x5422f3(_0x4aecef['error'][_0x8a79('0x2c')]);}logger[_0x8a79('0x2a')]('User,\x20%s,\x20%s',_0x415324,_0x4aecef['error'][_0x8a79('0x2c')]);return _0x353862(_0x4aecef['error'][_0x8a79('0x2c')]);}else{logger['info']('User,\x20%s,\x20%s',_0x415324,_0x8a79('0x28'));_0x353862(_0x4aecef['result']['message']);}})['catch'](function(_0x50cf25){logger[_0x8a79('0x2a')](_0x8a79('0x25'),_0x415324,_0x50cf25);_0x5422f3(_0x50cf25);});});}function saveUpdates(_0x59fbbc){return function(_0x1637d9){if(_0x1637d9){return _0x1637d9[_0x8a79('0x2d')](_0x59fbbc)['then'](function(_0x552ca5){if(_0x552ca5['role']==='agent'){socket['emit'](_0x8a79('0x2e')+_0x552ca5['id'],_0x552ca5);}return _0x552ca5;});}return null;};}function removeEntity(_0x1086ee,_0x5bde12){return function(_0x531a50){if(_0x531a50){return _0x531a50['destroy']({'transaction':_0x5bde12})[_0x8a79('0x23')](function(){var _0x879aa8=_0x531a50[_0x8a79('0x2f')]({'plain':!![]});if(_0x879aa8[_0x8a79('0x30')]===_0x8a79('0x31'))return;var _0x3ae36=[{'name':'Users','value':_0x8a79('0x32'),'ignore':!![]},{'name':_0x8a79('0x33'),'value':_0x8a79('0x34'),'ignore':![]},{'name':_0x8a79('0x35'),'value':'telephone','ignore':![]}];var _0x4d9f6d=_(_0x3ae36)[_0x8a79('0x36')](_0x8a79('0x37'))[_0x8a79('0x38')](_0x8a79('0x39'))[_0x8a79('0x39')]();if(_['includes'](_0x4d9f6d,_0x879aa8[_0x8a79('0x30')])){return;}var _0x246647=_[_0x8a79('0x3a')](_0x3ae36,[_0x8a79('0x39'),_0x879aa8[_0x8a79('0x30')]])[_0x8a79('0x3b')];return db[_0x8a79('0x3c')][_0x8a79('0x3d')]({'where':{'type':_0x246647,'resourceId':_0x879aa8['id']},'transaction':_0x5bde12})[_0x8a79('0x23')](function(){return _0x531a50;});})[_0x8a79('0x23')](function(){_0x1086ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10804a){return function(_0x433d6c){if(!_0x433d6c){_0x10804a[_0x8a79('0x1a')](0x194);}return _0x433d6c;};}function handleError(_0x2b9e58,_0x9c9e41){_0x9c9e41=_0x9c9e41||0x1f4;return function(_0x173a19){logger['error'](_0x173a19['stack']);if(_0x173a19['name']){delete _0x173a19[_0x8a79('0x3b')];}_0x2b9e58[_0x8a79('0x1f')](_0x9c9e41)[_0x8a79('0x3e')](_0x173a19);};}function getUserAttributes(){return _(db[_0x8a79('0x3f')][_0x8a79('0x40')])[_0x8a79('0x38')](function(_0x3979b7){return{'name':_0x3979b7[_0x8a79('0x41')],'type':_0x3979b7['type'][_0x8a79('0x42')]};})[_0x8a79('0x36')](function(_0x5ab0f2){return!['password',_0x8a79('0x43'),_0x8a79('0x44'),'resetPasswordToken',_0x8a79('0x45'),_0x8a79('0x46')][_0x8a79('0x47')](_0x5ab0f2[_0x8a79('0x3b')]);})[_0x8a79('0x39')]();}exports[_0x8a79('0x48')]=function(_0x3d8e90,_0x103235){var _0x3b423f={},_0x54ec5f={'count':0x0,'rows':[]};var _0x31194b=getUserAttributes();_0x3b423f=qs[_0x8a79('0x49')](_0x31194b,_0x3d8e90);var _0x19d198={'where':_0x3b423f[_0x8a79('0x4a')]};return db['User']['count'](_0x19d198)[_0x8a79('0x23')](function(_0x57e347){_0x54ec5f['count']=_0x57e347;if(_0x3d8e90[_0x8a79('0x4b')][_0x8a79('0x4c')]){_0x3b423f[_0x8a79('0x4d')]=[{'all':!![]}];}if(_0x3d8e90[_0x8a79('0x4b')][_0x8a79('0x4e')]===_0x8a79('0x4f')){_0x3b423f[_0x8a79('0x4d')]=[{'model':db[_0x8a79('0x50')],'as':'userSetting'}];}if(!_[_0x8a79('0x47')](_0x3b423f['attributes'],'id')){_0x3b423f[_0x8a79('0x51')]['push']('id');}return db[_0x8a79('0x3f')]['findAll'](_0x3b423f);})[_0x8a79('0x23')](function(_0x3c0b31){_0x54ec5f[_0x8a79('0x52')]=_0x3c0b31;if(_0x3d8e90[_0x8a79('0x4b')][_0x8a79('0x53')]===_0x8a79('0x4f')){var _0x166e7e=[];for(var _0x2424ca=0x0;_0x2424ca<_0x54ec5f['rows'][_0x8a79('0x54')];_0x2424ca++){_0x166e7e[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x56'),_0x54ec5f[_0x8a79('0x52')][_0x2424ca][_0x8a79('0x57')]));_0x166e7e[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x58'),_0x54ec5f['rows'][_0x2424ca]['dataValues']));_0x166e7e[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x59'),_0x54ec5f[_0x8a79('0x52')][_0x2424ca]['dataValues']));_0x166e7e[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x5a'),_0x54ec5f[_0x8a79('0x52')][_0x2424ca][_0x8a79('0x57')]));_0x166e7e[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x5b'),_0x54ec5f[_0x8a79('0x52')][_0x2424ca]['dataValues']));_0x166e7e[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x5c'),_0x54ec5f[_0x8a79('0x52')][_0x2424ca][_0x8a79('0x57')]));}return Promise[_0x8a79('0x5d')](_0x166e7e)[_0x8a79('0x23')](function(){return _0x54ec5f;});}else{return _0x54ec5f;}})['then'](respondWithFilteredResult(_0x103235,_0x3b423f))[_0x8a79('0x5e')](handleError(_0x103235,null));};exports[_0x8a79('0x5f')]=function(_0x354fed,_0x5ecf05){var _0x4deb11=getUserAttributes();_0x354fed[_0x8a79('0x4b')]['id']=_0x354fed[_0x8a79('0x60')]['id'];var _0x37464f=qs[_0x8a79('0x49')](_0x4deb11,_0x354fed);if(_0x354fed[_0x8a79('0x4b')][_0x8a79('0x4c')]){_0x37464f[_0x8a79('0x4d')]=[{'all':!![]}];}if(_0x354fed['query'][_0x8a79('0x4e')]==='true'){_0x37464f[_0x8a79('0x4d')]=[{'model':db['UserSetting'],'as':_0x8a79('0x4e')}];}_0x37464f=_[_0x8a79('0x61')]({},_0x37464f,_0x354fed[_0x8a79('0x62')]);if(!_['includes'](_0x37464f[_0x8a79('0x51')],'id')){_0x37464f[_0x8a79('0x51')][_0x8a79('0x55')]('id');}return db['User'][_0x8a79('0x3a')](_0x37464f)['then'](handleEntityNotFound(_0x5ecf05,null))[_0x8a79('0x23')](function(_0x3569cc){var _0x2e6ba0=[];values=_0x3569cc;if(_0x354fed[_0x8a79('0x4b')][_0x8a79('0x53')]==='true'){_0x2e6ba0[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x56'),_0x3569cc[_0x8a79('0x57')]));_0x2e6ba0['push'](get_open_tabs('sms',_0x3569cc[_0x8a79('0x57')]));_0x2e6ba0[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x5b'),_0x3569cc[_0x8a79('0x57')]));_0x2e6ba0[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x5c'),_0x3569cc[_0x8a79('0x57')]));_0x2e6ba0['push'](get_open_tabs('fax',_0x3569cc['dataValues']));_0x2e6ba0[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x5a'),_0x3569cc['dataValues']));return Promise[_0x8a79('0x5d')](_0x2e6ba0);}else{return values;}})[_0x8a79('0x23')](function(){return values;})[_0x8a79('0x23')](respondWithResult(_0x5ecf05,null))[_0x8a79('0x5e')](handleError(_0x5ecf05,null));};exports[_0x8a79('0x2d')]=function(_0x2b3316,_0x509794){if(_0x2b3316[_0x8a79('0x63')]['id']){delete _0x2b3316[_0x8a79('0x63')]['id'];}delete _0x2b3316[_0x8a79('0x63')][_0x8a79('0x30')];return db['User']['find']({'where':{'id':_0x2b3316[_0x8a79('0x60')]['id']}})['then'](handleEntityNotFound(_0x509794,null))[_0x8a79('0x23')](saveUpdates(_0x2b3316[_0x8a79('0x63')],null))['then'](respondWithResult(_0x509794,null))[_0x8a79('0x5e')](handleError(_0x509794,null));};exports[_0x8a79('0x64')]=function(_0x55c541,_0x24bbd9){return db[_0x8a79('0x3f')][_0x8a79('0x64')]()[_0x8a79('0x23')](respondWithResult(_0x24bbd9,null))['catch'](handleError(_0x24bbd9,null));};exports[_0x8a79('0x65')]=function(_0x360259,_0x3c31f8){return db['User']['find']({'where':{'id':_0x360259['params']['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x3c31f8,null))[_0x8a79('0x23')](function(_0xfc91ae){if(_0xfc91ae){return _0xfc91ae[_0x8a79('0x65')](_0x360259[_0x8a79('0x63')][_0x8a79('0x66')],_[_0x8a79('0x67')](_0x360259['body'],[_0x8a79('0x66'),'id'])||{});}})[_0x8a79('0x23')](respondWithResult(_0x3c31f8,null))[_0x8a79('0x5e')](handleError(_0x3c31f8,null));};function validateUser(_0x6b6e8f){return new Promise(function(_0xa2c077,_0x405f97){if(_0x6b6e8f[_0x8a79('0x68')])return _0xa2c077(_0x6b6e8f);return db[_0x8a79('0x69')]['findById'](0x1)[_0x8a79('0x23')](function(_0x1439fd){if(_0x1439fd[_0x8a79('0x6a')])authService[_0x8a79('0x6b')](_0x6b6e8f[_0x8a79('0x6c')]);db[_0x8a79('0x3f')]['max'](_0x8a79('0x68'))['then'](function(_0x40ff6d){if(_[_0x8a79('0x6d')](_0x40ff6d)){_0x6b6e8f[_0x8a79('0x68')]=_0x1439fd[_0x8a79('0x6e')]||0x1;return;}if(_[_0x8a79('0x6d')](_0x1439fd[_0x8a79('0x6e')])||_0x1439fd['min_internal']===_0x40ff6d){_0x6b6e8f[_0x8a79('0x68')]=_0x40ff6d+0x1;return;}if(_0x1439fd[_0x8a79('0x6e')]>_0x40ff6d){_0x6b6e8f[_0x8a79('0x68')]=_0x1439fd[_0x8a79('0x6e')];return;}return db[_0x8a79('0x6f')][_0x8a79('0x4b')](_0x8a79('0x70'),{'type':db[_0x8a79('0x6f')][_0x8a79('0x71')][_0x8a79('0x72')]})[_0x8a79('0x23')](function(_0x40dbf7){if(_0x40dbf7&&_0x40dbf7['length']){for(var _0x3ecfc4=0x0,_0x53e98c=_0x40dbf7[_0x8a79('0x54')];_0x3ecfc4<_0x53e98c&&_[_0x8a79('0x6d')](_0x6b6e8f[_0x8a79('0x68')]);_0x3ecfc4++){if(_0x1439fd[_0x8a79('0x6e')]<=_0x40dbf7[_0x3ecfc4]['from']){_0x6b6e8f[_0x8a79('0x68')]=_0x40dbf7[_0x3ecfc4][_0x8a79('0x73')];}else if(_0x1439fd[_0x8a79('0x6e')]>_0x40dbf7[_0x3ecfc4][_0x8a79('0x73')]&&_0x1439fd[_0x8a79('0x6e')]<=_0x40dbf7[_0x3ecfc4]['to']){_0x6b6e8f[_0x8a79('0x68')]=_0x1439fd[_0x8a79('0x6e')];}}}if(_['isNil'](_0x6b6e8f[_0x8a79('0x68')])){_0x6b6e8f[_0x8a79('0x68')]=_0x40ff6d+0x1;}return _0xa2c077(_0x6b6e8f);});});})['catch'](function(_0xe95c8b){_0x405f97(_0xe95c8b);});});}function updateUser(_0x4be231){return new Promise(function(_0x5863d1,_0x254f4c){try{if(_0x4be231[_0x8a79('0x74')]){_0x4be231[_0x8a79('0x75')]=_0x4be231[_0x8a79('0x68')];_0x4be231[_0x8a79('0x76')]={'mailbox':_0x4be231['internal'],'password':_0x4be231[_0x8a79('0x6c')],'fullname':_0x4be231['fullname'],'email':_0x4be231['email']};}if(_0x4be231[_0x8a79('0x30')]===_0x8a79('0x34')){if(!_0x4be231['permissions'])_0x4be231[_0x8a79('0x77')]=[_0x8a79('0x78'),'102',_0x8a79('0x79'),'113',_0x8a79('0x7a'),_0x8a79('0x7b'),_0x8a79('0x7c'),_0x8a79('0x7d'),'107','108','109','100',_0x8a79('0x7e'),'114',_0x8a79('0x7f')];}_0x5863d1(_0x4be231);}catch(_0x2fa3ad){_0x254f4c(_0x2fa3ad);}});}exports[_0x8a79('0x80')]=function(_0x24f5cb,_0x235310){if(_0x24f5cb[_0x8a79('0x32')][_0x8a79('0x30')]===_0x8a79('0x34'))throw new Error('Unauthorized');if(_0x24f5cb[_0x8a79('0x63')][_0x8a79('0x30')]==='user'&&_0x24f5cb[_0x8a79('0x32')][_0x8a79('0x30')]!=='admin'){throw new Error(_0x8a79('0x81'));}if(_0x24f5cb[_0x8a79('0x63')][_0x8a79('0x30')]===_0x8a79('0x31')&&_0x24f5cb[_0x8a79('0x32')]['role']!==_0x8a79('0x31')){throw new Error(_0x8a79('0x82'));}return licenseUtil[_0x8a79('0x83')]([_0x24f5cb[_0x8a79('0x63')]])[_0x8a79('0x23')](function(){return validateUser(_0x24f5cb[_0x8a79('0x63')]);})['then'](function(_0x1602bc){return updateUser(_0x1602bc)[_0x8a79('0x23')](function(_0x442bf7){if(_0x442bf7['role']===_0x8a79('0x31')){_0x442bf7[_0x8a79('0x84')]=_0x24f5cb[_0x8a79('0x32')]['settingsEnabled'];delete _0x442bf7[_0x8a79('0x85')];}return _0x442bf7;});})[_0x8a79('0x23')](function(_0x4039b4){return db['User'][_0x8a79('0x80')](_0x4039b4,{'include':[{'model':db[_0x8a79('0x76')],'as':_0x8a79('0x76')}]});})[_0x8a79('0x23')](function(_0x29df45){if(_0x24f5cb['body'][_0x8a79('0x30')]==='user')return _0x29df45;if(_0x24f5cb[_0x8a79('0x32')][_0x8a79('0x30')]!==_0x8a79('0x32'))return _0x29df45;return db[_0x8a79('0x86')][_0x8a79('0x3a')]({'where':{'name':_0x29df45['role']==='agent'?_0x8a79('0x33'):'Telephones','userProfileId':_0x24f5cb[_0x8a79('0x32')]['userProfileId']},'raw':!![]})['then'](function(_0xff8b3b){if(!_0xff8b3b||_0xff8b3b[_0x8a79('0x87')]!=0x0)return _0x29df45;return db[_0x8a79('0x3c')]['create']({'name':_0x29df45[_0x8a79('0x3b')],'resourceId':_0x29df45['id'],'type':_0xff8b3b[_0x8a79('0x3b')],'sectionId':_0xff8b3b['id']},{})[_0x8a79('0x23')](function(){return _0x29df45;});})[_0x8a79('0x5e')](function(_0x555aec){logger[_0x8a79('0x2a')](_0x8a79('0x88'),_0x555aec);throw _0x555aec;});})['then'](respondWithResult(_0x235310,0xc9))[_0x8a79('0x5e')](handleError(_0x235310,null));};exports[_0x8a79('0x89')]=function(_0x5551e5,_0x3026ad){var _0x37e15f=_0x5551e5['body'];var _0x34fb02=[];if(_0x5551e5[_0x8a79('0x32')][_0x8a79('0x30')]===_0x8a79('0x34'))throw new Error(_0x8a79('0x8a'));if(_[_0x8a79('0x8b')](_0x37e15f,[_0x8a79('0x30'),_0x8a79('0x32')])&&_0x5551e5[_0x8a79('0x32')][_0x8a79('0x30')]!==_0x8a79('0x31')){throw new Error(_0x8a79('0x81'));}if(_['some'](_0x37e15f,[_0x8a79('0x30'),_0x8a79('0x31')])&&_0x5551e5[_0x8a79('0x32')][_0x8a79('0x30')]!==_0x8a79('0x31')){throw new Error(_0x8a79('0x8c'));}return licenseUtil[_0x8a79('0x83')](_0x37e15f)[_0x8a79('0x23')](function(){return validateUser(_0x37e15f[0x0]);})[_0x8a79('0x23')](function(){for(var _0x2fd856=0x1;_0x2fd856<_0x37e15f[_0x8a79('0x54')];_0x2fd856++){var _0x4dc870=_0x37e15f[_0x2fd856-0x1][_0x8a79('0x68')];if(!_0x37e15f[_0x2fd856][_0x8a79('0x68')])_0x37e15f[_0x2fd856][_0x8a79('0x68')]=_0x4dc870+0x1;_0x34fb02[_0x8a79('0x55')](validateUser(_0x37e15f[_0x2fd856]));}return Promise[_0x8a79('0x5d')](_0x34fb02);})['then'](function(){_0x34fb02=[];for(var _0x45a6c6=0x0;_0x45a6c6<_0x37e15f['length'];_0x45a6c6++){_0x34fb02[_0x8a79('0x55')](updateUser(_0x37e15f[_0x45a6c6]));}return Promise[_0x8a79('0x5d')](_0x34fb02);})[_0x8a79('0x23')](function(){_0x34fb02=_0x37e15f[_0x8a79('0x38')](function(_0x424f76){return db['User'][_0x8a79('0x80')](_0x424f76,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x8a79('0x23')](function(_0x804b90){_0x424f76['id']=_0x804b90['id'];return _0x424f76;});});return Promise[_0x8a79('0x5d')](_0x34fb02);})[_0x8a79('0x23')](function(_0x4481e9){if(_0x5551e5['body'][_0x8a79('0x30')]===_0x8a79('0x32'))return _0x4481e9;if(_0x5551e5[_0x8a79('0x32')]['role']!==_0x8a79('0x32'))return _0x4481e9;var _0x5d264a=_[_0x8a79('0x8b')](_0x4481e9,function(_0x5516cf){return _0x5516cf[_0x8a79('0x30')]===_0x8a79('0x34')||_0x5516cf[_0x8a79('0x30')]==='telephone';});if(!_0x5d264a)return _0x4481e9;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x8a79('0x33'),_0x8a79('0x35')]},'userProfileId':_0x5551e5[_0x8a79('0x32')][_0x8a79('0x85')]},'raw':!![]})[_0x8a79('0x23')](function(_0x10ef2f){if(_['isEmpty'](_0x10ef2f)||!_[_0x8a79('0x8b')](_0x10ef2f,[_0x8a79('0x87'),0x0]))return _0x4481e9;_0x34fb02=[];var _0x3c001c=_(_0x10ef2f)[_0x8a79('0x38')](function(_0x4c0510){if(_0x4c0510['autoAssociation']===0x1)return;return _0x4c0510[_0x8a79('0x3b')]===_0x8a79('0x33')?'agent':_0x8a79('0x8d');})[_0x8a79('0x8e')]()[_0x8a79('0x39')]();for(var _0x5642f0=0x0;_0x5642f0<_0x4481e9[_0x8a79('0x54')];_0x5642f0++){if(!_[_0x8a79('0x47')](_0x3c001c,_0x4481e9[_0x5642f0]['role']))return;var _0x21a287=_0x4481e9[_0x5642f0][_0x8a79('0x30')]===_0x8a79('0x34')?_0x8a79('0x33'):_0x8a79('0x35');_0x34fb02[_0x8a79('0x55')](db[_0x8a79('0x3c')][_0x8a79('0x80')]({'name':_0x4481e9[_0x5642f0][_0x8a79('0x3b')],'resourceId':_0x4481e9[_0x5642f0]['id'],'type':_0x21a287,'sectionId':_[_0x8a79('0x3a')](_0x10ef2f,[_0x8a79('0x3b'),_0x21a287])['id']},{}));}return Promise[_0x8a79('0x5d')](_0x34fb02);});})[_0x8a79('0x23')](respondWithResult(_0x3026ad,0xc9))[_0x8a79('0x5e')](handleError(_0x3026ad,null));};exports[_0x8a79('0x8f')]=function(_0x5bcb5c,_0xe494fe){if(_0x5bcb5c[_0x8a79('0x63')]['id']){delete _0x5bcb5c[_0x8a79('0x63')]['id'];}return db[_0x8a79('0x3f')][_0x8a79('0x3a')]({'where':{'id':_0x5bcb5c[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](function(_0xe39400){if(!_0xe39400)return null;if(_0xe39400['id']===_0x5bcb5c['user']['id']){if(!_0x5bcb5c[_0x8a79('0x63')][_0x8a79('0x90')]||!_0x5bcb5c['body'][_0x8a79('0x91')]){throw new db[(_0x8a79('0x92'))][(_0x8a79('0x93'))](_0x8a79('0x94'));}if(!_0xe39400[_0x8a79('0x95')](_0x5bcb5c[_0x8a79('0x63')][_0x8a79('0x90')])){throw new db[(_0x8a79('0x92'))][(_0x8a79('0x93'))](_0x8a79('0x96'));}if(_0x5bcb5c[_0x8a79('0x63')]['oldPassword']===_0x5bcb5c[_0x8a79('0x63')][_0x8a79('0x91')]){throw new db['Sequelize'][(_0x8a79('0x93'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5bcb5c[_0x8a79('0x32')][_0x8a79('0x30')]==='admin'){if(!_0x5bcb5c[_0x8a79('0x63')]['newPassword']){throw new db[(_0x8a79('0x92'))]['ValidationError'](_0x8a79('0x97'));}}else if(_0x5bcb5c[_0x8a79('0x32')][_0x8a79('0x30')]===_0x8a79('0x32')){if(!_0x5bcb5c[_0x8a79('0x63')]['newPassword']){throw new db['Sequelize'][(_0x8a79('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0xe39400[_0x8a79('0x30')]!=='agent'){throw new db[(_0x8a79('0x92'))][(_0x8a79('0x93'))](_0x8a79('0x8a'));}}else{throw new db['Sequelize'][(_0x8a79('0x93'))](_0x8a79('0x8a'));}return _0xe39400;})[_0x8a79('0x23')](handleEntityNotFound(_0xe494fe,null))[_0x8a79('0x23')](function(_0x2d39c7){return db[_0x8a79('0x69')][_0x8a79('0x98')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})[_0x8a79('0x23')](function(_0x589ba3){if(_0x589ba3[_0x8a79('0x6a')])authService[_0x8a79('0x6b')](_0x5bcb5c[_0x8a79('0x63')][_0x8a79('0x91')]);if(!_0x589ba3['enforcePasswordHistory']||!_0x2d39c7[_0x8a79('0x44')])return _0x2d39c7;authService[_0x8a79('0x99')](_0x5bcb5c['body'][_0x8a79('0x91')],_0x2d39c7[_0x8a79('0x44')],_0x589ba3[_0x8a79('0x9a')]);return _0x2d39c7;})[_0x8a79('0x23')](saveUpdates({'password':_0x5bcb5c[_0x8a79('0x63')][_0x8a79('0x91')],'passwordResetAt':_0x5bcb5c[_0x8a79('0x32')]['id']==_0x5bcb5c['params']['id']?moment():null,'previousPasswords':authService[_0x8a79('0x9b')](_0x5bcb5c[_0x8a79('0x63')][_0x8a79('0x91')],_0x2d39c7[_0x8a79('0x44')])},null));})[_0x8a79('0x23')](respondWithResult(_0xe494fe,null))['catch'](handleError(_0xe494fe,null));};exports[_0x8a79('0x9c')]=function(_0x323656,_0x36ec38){var _0x51b541=_0x323656[_0x8a79('0x63')][_0x8a79('0x9d')];return db[_0x8a79('0x3f')][_0x8a79('0x3a')]({'where':{'id':_0x323656[_0x8a79('0x60')]['id']},'attributes':['id',_0x8a79('0x3b'),_0x8a79('0x30'),_0x8a79('0x9e'),_0x8a79('0x9f'),_0x8a79('0xa0'),_0x8a79('0xa1')]})[_0x8a79('0x23')](handleEntityNotFound(_0x36ec38,null))[_0x8a79('0x23')](function(_0x2955a1){if(_0x2955a1){if(!utils[_0x8a79('0xa2')](_0x51b541)){throw new db[(_0x8a79('0x92'))][(_0x8a79('0x93'))](_0x8a79('0xa3'));}return _0x2955a1[_0x8a79('0xa4')+_[_0x8a79('0xa5')](_0x51b541[_0x8a79('0xa6')]())+_0x8a79('0xa7')](_0x323656['body']['ids'],{'penalty':_0x323656[_0x8a79('0x63')][_0x8a79('0xa8')]||0x0})[_0x8a79('0xa9')](function(_0x58d1b6){for(var _0x54059b=0x0;_0x54059b<_0x323656[_0x8a79('0x63')][_0x8a79('0x66')][_0x8a79('0x54')];_0x54059b+=0x1){var _0xf5f14d={'UserId':Number(_0x323656[_0x8a79('0x60')]['id'])};_0xf5f14d[_[_0x8a79('0xa5')](_0x51b541[_0x8a79('0xa6')]())+_0x8a79('0xaa')]=Number(_0x323656[_0x8a79('0x63')][_0x8a79('0x66')][_0x54059b]);socket[_0x8a79('0xab')](_0x8a79('0x32')+_[_0x8a79('0xa5')](_0x51b541['toLowerCase']())+_0x8a79('0xac'),_0xf5f14d);}return _0x58d1b6;})[_0x8a79('0x23')](function(){if(_0x51b541==='voice'){return db[_0x8a79('0xad')][_0x8a79('0xae')]({'where':{'id':_0x323656['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0xc5b082){var _0x4f058c=_0x2955a1[_0x8a79('0x2f')]({'plain':!![]});var _0x199064=[];if(_0x51b541===_0x8a79('0xaf')&&_0x4f058c[_0x8a79('0x30')]===_0x8a79('0x34')&&_0x4f058c[_0x8a79('0x9e')]){for(let _0x3d5ecf=0x0;_0x3d5ecf<_0xc5b082[_0x8a79('0x54')];_0x3d5ecf+=0x1){_0x199064['push']({'membername':_0x4f058c[_0x8a79('0x3b')],'UserId':_0x4f058c['id'],'queue_name':_0xc5b082[_0x3d5ecf]['name'],'VoiceQueueId':_0xc5b082[_0x3d5ecf]['id'],'interface':_['isNil'](_0x4f058c['interface'])?util[_0x8a79('0xb0')](_0x8a79('0xb1'),_0x4f058c[_0x8a79('0x3b')]):_0x4f058c[_0x8a79('0xa1')],'paused':_0x4f058c[_0x8a79('0xa0')]||![],'penalty':_0x323656[_0x8a79('0x63')][_0x8a79('0xa8')]||0x0});}return Promise[_0x8a79('0x5d')](_0x199064[_0x8a79('0x38')](function(_0x557a6a){return db[_0x8a79('0xb2')][_0x8a79('0xb3')](_0x557a6a);}));}return _0x2955a1;});}})[_0x8a79('0x23')](respondWithStatusCode(_0x36ec38,null))[_0x8a79('0x5e')](handleError(_0x36ec38,null));};exports[_0x8a79('0xb4')]=function(_0x44aae2,_0x728b04){var _0x5bb634,_0x35ee71;return db['User'][_0x8a79('0x3a')]({'where':{'id':_0x44aae2[_0x8a79('0x60')]['id']},'attributes':['id',_0x8a79('0x3b'),'role']})[_0x8a79('0x23')](handleEntityNotFound(_0x728b04,null))[_0x8a79('0x23')](function(_0x274126){if(_0x274126){_0x5bb634=_0x274126;if(!_0x44aae2[_0x8a79('0x4b')][_0x8a79('0x9d')]||!utils['isValidChannel'](_0x44aae2[_0x8a79('0x4b')][_0x8a79('0x9d')])){throw new db['Sequelize'][(_0x8a79('0x93'))]('Unknown\x20channel');}return _0x274126[_0x8a79('0xb5')+_[_0x8a79('0xa5')](_0x44aae2[_0x8a79('0x4b')][_0x8a79('0x9d')][_0x8a79('0xa6')]())+_0x8a79('0xa7')](_0x44aae2[_0x8a79('0x4b')][_0x8a79('0x66')]);}})[_0x8a79('0x23')](function(_0x2b5e5a){if(_['isArray'](_0x44aae2[_0x8a79('0x4b')][_0x8a79('0x66')])){for(var _0x47d39b=0x0;_0x47d39b<_0x44aae2[_0x8a79('0x4b')][_0x8a79('0x66')]['length'];_0x47d39b+=0x1){_0x35ee71={'UserId':Number(_0x44aae2[_0x8a79('0x60')]['id'])};_0x35ee71[_[_0x8a79('0xa5')](_0x44aae2[_0x8a79('0x4b')][_0x8a79('0x9d')][_0x8a79('0xa6')]())+_0x8a79('0xaa')]=Number(_0x44aae2[_0x8a79('0x4b')][_0x8a79('0x66')][_0x47d39b]);socket['emit'](_0x8a79('0x32')+_[_0x8a79('0xa5')](_0x44aae2[_0x8a79('0x4b')]['channel']['toLowerCase']())+_0x8a79('0xb6'),_0x35ee71);}}else{_0x35ee71={'UserId':Number(_0x44aae2[_0x8a79('0x60')]['id'])};_0x35ee71[_[_0x8a79('0xa5')](_0x44aae2['query']['channel'][_0x8a79('0xa6')]())+_0x8a79('0xaa')]=Number(_0x44aae2['query']['ids']);socket[_0x8a79('0xab')](_0x8a79('0x32')+_[_0x8a79('0xa5')](_0x44aae2['query'][_0x8a79('0x9d')]['toLowerCase']())+_0x8a79('0xb6'),_0x35ee71);}return _0x2b5e5a;})[_0x8a79('0x23')](function(){if(_0x44aae2[_0x8a79('0x4b')][_0x8a79('0x9d')]===_0x8a79('0xaf')){return db['UserVoiceQueueRt'][_0x8a79('0x3d')]({'where':{'UserId':_0x44aae2['params']['id'],'VoiceQueueId':_0x44aae2[_0x8a79('0x4b')][_0x8a79('0x66')]},'individualHooks':!![]})[_0x8a79('0x23')](function(){return _0x5bb634;});}return _0x5bb634;})[_0x8a79('0x23')](respondWithStatusCode(_0x728b04,null))[_0x8a79('0x5e')](handleError(_0x728b04,null));};exports['addAvatar']=function(_0x34427b,_0x14ca12){_0x34427b[_0x8a79('0x63')][_0x8a79('0xb7')]=_0x34427b[_0x8a79('0xb8')]['filename'];return db[_0x8a79('0x3f')]['find']({'where':{'id':_0x34427b[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x14ca12,null))[_0x8a79('0x23')](saveUpdates(_0x34427b[_0x8a79('0x63')],null))[_0x8a79('0x23')](respondWithResult(_0x14ca12,null))[_0x8a79('0x5e')](handleError(_0x14ca12,null));};exports['getAvatar']=function(_0x209062,_0x47fc09){var _0x57610f=path[_0x8a79('0xb9')](config[_0x8a79('0xba')],'server/files/images/logos/default_profile.png');return db[_0x8a79('0x3f')][_0x8a79('0x3a')]({'where':{'id':_0x209062[_0x8a79('0x60')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x8a79('0x23')](handleEntityNotFound(_0x47fc09,null))['then'](function(_0x13f97e){if(_0x13f97e){if(_[_0x8a79('0x6d')](_0x13f97e[_0x8a79('0xb7')])){return _0x47fc09[_0x8a79('0xbb')](_0x57610f);}else{if(!fs[_0x8a79('0xbc')](path['join'](config[_0x8a79('0xba')],_0x8a79('0xbd'),_0x13f97e[_0x8a79('0xb7')]))){return _0x47fc09[_0x8a79('0xbb')](_0x57610f);}return _0x47fc09[_0x8a79('0xbb')](path[_0x8a79('0xb9')](config[_0x8a79('0xba')],'server/files/images/',_0x13f97e[_0x8a79('0xb7')]));}}})[_0x8a79('0x5e')](handleError(_0x47fc09,null));};exports[_0x8a79('0xbe')]=function(_0x1c54e0,_0x3fb212){return db['User'][_0x8a79('0x3a')]({'where':{'id':_0x1c54e0[_0x8a79('0x60')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x3fb212,null))[_0x8a79('0x23')](function(_0xcc264){var _0x5890b9=[];values=_0xcc264[_0x8a79('0x57')];_0x5890b9['push'](get_open_tabs(_0x8a79('0x56'),_0xcc264[_0x8a79('0x57')]));_0x5890b9[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x58'),_0xcc264[_0x8a79('0x57')]));_0x5890b9[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x5b'),_0xcc264[_0x8a79('0x57')]));_0x5890b9[_0x8a79('0x55')](get_open_tabs('whatsapp',_0xcc264[_0x8a79('0x57')]));_0x5890b9[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x59'),_0xcc264['dataValues']));_0x5890b9[_0x8a79('0x55')](get_open_tabs(_0x8a79('0x5a'),_0xcc264[_0x8a79('0x57')]));return Promise[_0x8a79('0x5d')](_0x5890b9);})[_0x8a79('0x23')](function(_0x8840bc){if(_0x8840bc){var _0x440cca=_[_0x8a79('0x38')](values[_0x8a79('0xbf')],function(_0x32f29a){return{'channel':_0x8a79('0xc0'),'id':_0x32f29a['id'],'createdAt':_0x32f29a[_0x8a79('0xc1')]};});var _0x42bb83=_[_0x8a79('0x38')](values[_0x8a79('0xc2')],function(_0x2f1efa){return{'channel':'FAX','id':_0x2f1efa['id'],'createdAt':_0x2f1efa[_0x8a79('0xc1')]};});var _0x50fca1=_[_0x8a79('0x38')](values[_0x8a79('0xc3')],function(_0x3c1a50){return{'channel':'OPENCHANNEL','id':_0x3c1a50['id'],'createdAt':_0x3c1a50['createdAt']};});var _0x2006d2=_[_0x8a79('0x38')](values[_0x8a79('0xc4')],function(_0x4b48a9){return{'channel':'MAIL','id':_0x4b48a9['id'],'createdAt':_0x4b48a9[_0x8a79('0xc1')]};});var _0x52b601=_[_0x8a79('0x38')](values[_0x8a79('0xc5')],function(_0x2d572f){return{'channel':_0x8a79('0xc6'),'id':_0x2d572f['id'],'createdAt':_0x2d572f['createdAt']};});var _0x4e6ac9=_['map'](values[_0x8a79('0xc7')],function(_0x45d93c){return{'channel':_0x8a79('0xc8'),'id':_0x45d93c['id'],'createdAt':_0x45d93c['createdAt']};});var _0x2fad54=_['concat'](_0x440cca,_0x42bb83,_0x50fca1,_0x2006d2,_0x52b601,_0x4e6ac9);var _0x2de354={'count':_0x2fad54[_0x8a79('0x54')],'rows':_0x2fad54};return _0x2de354;}else return null;})[_0x8a79('0x23')](respondWithResult(_0x3fb212,null))['catch'](handleError(_0x3fb212,null));};exports[_0x8a79('0xc9')]=function(_0x5b7bc8,_0x32498a){var _0x1ff743={};return db[_0x8a79('0x3f')][_0x8a79('0x98')]({'where':{'id':_0x5b7bc8[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](function(_0x45b118){if(!_0x45b118){throw new APINotFoundError(util[_0x8a79('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5b7bc8[_0x8a79('0x60')]['id']));}return contacts[_0x8a79('0x64')]();})[_0x8a79('0x23')](function(_0x38e5fe){_0x5b7bc8['query'][_0x8a79('0x3f')]=_0x5b7bc8['params']['id'];_0x1ff743=qs[_0x8a79('0x49')](_0x38e5fe,_0x5b7bc8);if(_0x5b7bc8['query'][_0x8a79('0xca')](_0x8a79('0x4c'))){_0x1ff743[_0x8a79('0x4d')]=[{'model':db['CmList'],'as':_0x8a79('0xcb'),'required':![]},{'model':db[_0x8a79('0xcc')],'as':_0x8a79('0xcd'),'attributes':['id',_0x8a79('0x3b'),_0x8a79('0xce')],'where':_0x5b7bc8[_0x8a79('0x4b')]['tag']?{'id':_0x5b7bc8[_0x8a79('0x4b')]['tag']}:undefined,'required':_0x5b7bc8[_0x8a79('0x4b')][_0x8a79('0xcf')]?!![]:![]}];}return contacts['findAll'](_0x5b7bc8['query'],_0x5b7bc8[_0x8a79('0x32')],_0x1ff743,_0x38e5fe);})[_0x8a79('0x23')](respondWithFilteredResult(_0x32498a,_0x1ff743))[_0x8a79('0x5e')](APIHandleError(_0x32498a));};exports[_0x8a79('0xd0')]=function(_0xd83a3b,_0x13e8bc){var _0x46b7a2;var _0x376925={};var _0x270a44;return db[_0x8a79('0x3f')]['findOne']({'where':{'id':_0xd83a3b[_0x8a79('0x60')]['id']},'attributes':['id',_0x8a79('0x3b'),_0x8a79('0x30')]})[_0x8a79('0x23')](handleEntityNotFound(_0x13e8bc,null))['then'](function(_0x3ec393){if(!utils[_0x8a79('0xa2')](_0xd83a3b['query']['channel'])){throw new db['Sequelize'][(_0x8a79('0x93'))](_0x8a79('0xa3'));}_0x46b7a2=_0x3ec393;var _0x19d20e={};_0x19d20e[_0x8a79('0xd1')]=_[_0x8a79('0xd2')](db[_[_0x8a79('0xa5')](_0xd83a3b[_0x8a79('0x4b')]['channel'])+_0x8a79('0xd3')][_0x8a79('0x40')]);_0x19d20e[_0x8a79('0x4b')]=_[_0x8a79('0xd2')](_0xd83a3b[_0x8a79('0x4b')]);_0x19d20e[_0x8a79('0xd4')]=_[_0x8a79('0xd5')](_0x19d20e[_0x8a79('0xd1')],_0x19d20e[_0x8a79('0x4b')]);_0x376925[_0x8a79('0x51')]=_['intersection'](_0x19d20e[_0x8a79('0xd1')],qs[_0x8a79('0xd6')](_0xd83a3b[_0x8a79('0x4b')]['fields']));_0x376925[_0x8a79('0x51')]=_0x376925[_0x8a79('0x51')][_0x8a79('0x54')]?_0x376925[_0x8a79('0x51')]:_0x19d20e[_0x8a79('0xd1')];_0x376925[_0x8a79('0xd7')]=qs[_0x8a79('0xd8')](_0xd83a3b[_0x8a79('0x4b')]['sort']);_0x376925[_0x8a79('0x4a')]=qs[_0x8a79('0xd4')](_[_0x8a79('0xd9')](_0xd83a3b[_0x8a79('0x4b')],_0x19d20e[_0x8a79('0xd4')]));if(_0xd83a3b[_0x8a79('0x4b')][_0x8a79('0x36')]){_0x376925['where']=_[_0x8a79('0x61')](_0x376925['where'],{'$or':_[_0x8a79('0x38')](_0x376925[_0x8a79('0x51')],function(_0x3df38a){var _0x1e1b8c={};_0x1e1b8c[_0x3df38a]={'$like':'%'+_0xd83a3b['query'][_0x8a79('0x36')]+'%'};return _0x1e1b8c;})});}_0x376925=_[_0x8a79('0x61')]({},_0x376925,_0xd83a3b[_0x8a79('0x62')]);switch(_0x46b7a2['role']){case'admin':return db[_[_0x8a79('0xa5')](_0xd83a3b[_0x8a79('0x4b')][_0x8a79('0x9d')])+_0x8a79('0xd3')]['findAll'](_0x376925);case'user':case _0x8a79('0x34'):return _0x46b7a2['get'+_['capitalize'](_0xd83a3b[_0x8a79('0x4b')][_0x8a79('0x9d')])+'Queues'](_0x376925);default:throw new db[(_0x8a79('0x92'))]['ValidationError'](_0x8a79('0xda'));}})[_0x8a79('0x23')](function(_0x1e386a){_0x270a44=_0x1e386a[_0x8a79('0x54')];if(!_0xd83a3b[_0x8a79('0x4b')][_0x8a79('0xca')]('nolimit')){_0x376925[_0x8a79('0x1d')]=qs[_0x8a79('0x1d')](_0xd83a3b[_0x8a79('0x4b')]['limit']);_0x376925[_0x8a79('0x1b')]=qs['offset'](_0xd83a3b['query']['offset']);}switch(_0x46b7a2[_0x8a79('0x30')]){case _0x8a79('0x31'):return db[_[_0x8a79('0xa5')](_0xd83a3b[_0x8a79('0x4b')]['channel'])+_0x8a79('0xd3')][_0x8a79('0xae')](_0x376925);case'user':case _0x8a79('0x34'):return _0x46b7a2['get'+_['capitalize'](_0xd83a3b['query'][_0x8a79('0x9d')])+_0x8a79('0xa7')](_0x376925);}})[_0x8a79('0x23')](function(_0x415538){return{'count':_0x270a44,'rows':_0x415538};})[_0x8a79('0x23')](respondWithResult(_0x13e8bc,null))[_0x8a79('0x5e')](handleError(_0x13e8bc,null));};exports['getVoiceQueuesRt']=function(_0x1ce449,_0x2765b8){var _0x4282d7={};var _0x489757={};var _0x257334;var _0x4f6a49;return db[_0x8a79('0x3f')][_0x8a79('0x98')]({'where':{'id':_0x1ce449[_0x8a79('0x60')]['id']}})['then'](handleEntityNotFound(_0x2765b8,null))[_0x8a79('0x23')](function(_0x529939){if(_0x529939){_0x257334=_0x529939;_0x489757[_0x8a79('0xd1')]=_['keys'](db['UserVoiceQueueRt'][_0x8a79('0x40')]);_0x489757[_0x8a79('0x4b')]=_['keys'](_0x1ce449[_0x8a79('0x4b')]);_0x489757['filters']=_[_0x8a79('0xd5')](_0x489757['model'],_0x489757[_0x8a79('0x4b')]);_0x4282d7['attributes']=_['intersection'](_0x489757[_0x8a79('0xd1')],qs['fields'](_0x1ce449['query']['fields']));_0x4282d7[_0x8a79('0x51')]=_0x4282d7['attributes'][_0x8a79('0x54')]?_0x4282d7[_0x8a79('0x51')]:_0x489757[_0x8a79('0xd1')];_0x4282d7['order']=qs[_0x8a79('0xd8')](_0x1ce449['query'][_0x8a79('0xd8')]);_0x4282d7[_0x8a79('0x4a')]=qs[_0x8a79('0xd4')](_['pick'](_0x1ce449['query'],_0x489757[_0x8a79('0xd4')]));if(_0x1ce449['query'][_0x8a79('0x36')]){_0x4282d7[_0x8a79('0x4a')]=_[_0x8a79('0x61')](_0x4282d7[_0x8a79('0x4a')],{'$or':_['map'](_0x4282d7[_0x8a79('0x51')],function(_0x2c0bc3){var _0x254988={};_0x254988[_0x2c0bc3]={'$like':'%'+_0x1ce449[_0x8a79('0x4b')][_0x8a79('0x36')]+'%'};return _0x254988;})});}_0x4282d7=_[_0x8a79('0x61')]({},_0x4282d7,_0x1ce449['options']);return _0x257334[_0x8a79('0xdb')](_0x4282d7);}})[_0x8a79('0x23')](function(_0x25eed8){if(_0x25eed8){_0x4f6a49=_0x25eed8[_0x8a79('0x54')];if(!_0x1ce449[_0x8a79('0x4b')][_0x8a79('0xca')](_0x8a79('0xdc'))){_0x4282d7[_0x8a79('0x1d')]=qs['limit'](_0x1ce449['query'][_0x8a79('0x1d')]);_0x4282d7[_0x8a79('0x1b')]=qs[_0x8a79('0x1b')](_0x1ce449[_0x8a79('0x4b')][_0x8a79('0x1b')]);}return _0x257334[_0x8a79('0xdb')](_0x4282d7);}})[_0x8a79('0x23')](function(_0xb33176){if(_0xb33176){return _0xb33176?{'count':_0x4f6a49,'rows':_0xb33176}:null;}})[_0x8a79('0x23')](respondWithResult(_0x2765b8,null))[_0x8a79('0x5e')](handleError(_0x2765b8,null));};exports[_0x8a79('0xdd')]=function(_0x14fa80,_0x23ebc5){var _0x5d4ca7={};var _0x516483={};var _0x1c8d58;var _0x3e1cd1;return db['User'][_0x8a79('0x98')]({'where':{'id':_0x14fa80['params']['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x23ebc5,null))[_0x8a79('0x23')](function(_0x473845){if(_0x473845){_0x1c8d58=_0x473845;_0x516483[_0x8a79('0xd1')]=_[_0x8a79('0xd2')](db[_0x8a79('0xde')][_0x8a79('0x40')]);_0x516483['query']=_['keys'](_0x14fa80[_0x8a79('0x4b')]);_0x516483[_0x8a79('0xd4')]=_[_0x8a79('0xd5')](_0x516483[_0x8a79('0xd1')],_0x516483[_0x8a79('0x4b')]);_0x5d4ca7[_0x8a79('0x51')]=_['intersection'](_0x516483[_0x8a79('0xd1')],qs[_0x8a79('0xd6')](_0x14fa80['query'][_0x8a79('0xd6')]));_0x5d4ca7[_0x8a79('0x51')]=_0x5d4ca7[_0x8a79('0x51')][_0x8a79('0x54')]?_0x5d4ca7[_0x8a79('0x51')]:_0x516483['model'];_0x5d4ca7[_0x8a79('0xd7')]=qs[_0x8a79('0xd8')](_0x14fa80[_0x8a79('0x4b')]['sort']);_0x5d4ca7[_0x8a79('0x4a')]=qs[_0x8a79('0xd4')](_[_0x8a79('0xd9')](_0x14fa80[_0x8a79('0x4b')],_0x516483[_0x8a79('0xd4')]));if(_0x14fa80['query'][_0x8a79('0x36')]){_0x5d4ca7['where']=_[_0x8a79('0x61')](_0x5d4ca7[_0x8a79('0x4a')],{'$or':_[_0x8a79('0x38')](_0x5d4ca7[_0x8a79('0x51')],function(_0x2be3a8){var _0x32e8a3={};_0x32e8a3[_0x2be3a8]={'$like':'%'+_0x14fa80['query'][_0x8a79('0x36')]+'%'};return _0x32e8a3;})});}_0x5d4ca7=_[_0x8a79('0x61')]({},_0x5d4ca7,_0x14fa80[_0x8a79('0x62')]);return _0x1c8d58['getGroups'](_0x5d4ca7);}})[_0x8a79('0x23')](function(_0x13a45d){if(_0x13a45d){_0x3e1cd1=_0x13a45d[_0x8a79('0x54')];if(!_0x14fa80[_0x8a79('0x4b')]['hasOwnProperty'](_0x8a79('0xdc'))){_0x5d4ca7['limit']=qs['limit'](_0x14fa80[_0x8a79('0x4b')][_0x8a79('0x1d')]);_0x5d4ca7[_0x8a79('0x1b')]=qs['offset'](_0x14fa80[_0x8a79('0x4b')][_0x8a79('0x1b')]);}return _0x1c8d58[_0x8a79('0xdd')](_0x5d4ca7);}})[_0x8a79('0x23')](function(_0x1bb885){if(_0x1bb885){return _0x1bb885?{'count':_0x3e1cd1,'rows':_0x1bb885}:null;}})[_0x8a79('0x23')](respondWithResult(_0x23ebc5,null))[_0x8a79('0x5e')](handleError(_0x23ebc5,null));};exports[_0x8a79('0xdf')]=function(_0x52ae61,_0x2004d0){var _0x4d38d2={'raw':!![],'where':{}};var _0x36a59a={};var _0xbe4580={'count':0x0,'rows':[]};return db[_0x8a79('0x3f')][_0x8a79('0x98')]({'where':{'id':_0x52ae61[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x2004d0,null))[_0x8a79('0x23')](function(_0x5915dc){if(_0x5915dc){_0x36a59a[_0x8a79('0xd1')]=_[_0x8a79('0xd2')](db['VoiceRecording'][_0x8a79('0x40')]);_0x36a59a[_0x8a79('0x4b')]=_[_0x8a79('0xd2')](_0x52ae61[_0x8a79('0x4b')]);_0x36a59a[_0x8a79('0xd4')]=_[_0x8a79('0xd5')](_0x36a59a[_0x8a79('0xd1')],_0x36a59a[_0x8a79('0x4b')]);_0x4d38d2[_0x8a79('0x51')]=_[_0x8a79('0xd5')](_0x36a59a[_0x8a79('0xd1')],qs[_0x8a79('0xd6')](_0x52ae61[_0x8a79('0x4b')]['fields']));_0x4d38d2[_0x8a79('0x51')]=_0x4d38d2['attributes']['length']?_0x4d38d2[_0x8a79('0x51')]:_0x36a59a[_0x8a79('0xd1')];if(!_0x52ae61[_0x8a79('0x4b')][_0x8a79('0xca')](_0x8a79('0xdc'))){_0x4d38d2['limit']=qs[_0x8a79('0x1d')](_0x52ae61['query']['limit']);_0x4d38d2[_0x8a79('0x1b')]=qs['offset'](_0x52ae61[_0x8a79('0x4b')][_0x8a79('0x1b')]);}_0x4d38d2[_0x8a79('0xd7')]=qs['sort'](_0x52ae61[_0x8a79('0x4b')][_0x8a79('0xd8')]);_0x4d38d2[_0x8a79('0x4a')]=qs['filters'](_[_0x8a79('0xd9')](_0x52ae61[_0x8a79('0x4b')],_0x36a59a[_0x8a79('0xd4')]));_0x4d38d2[_0x8a79('0x4a')][_0x8a79('0xe0')]=_0x5915dc['id'];if(_0x52ae61[_0x8a79('0x4b')][_0x8a79('0x36')]){_0x4d38d2[_0x8a79('0x4a')]=_[_0x8a79('0x61')](_0x4d38d2[_0x8a79('0x4a')],{'$or':_[_0x8a79('0x38')](_0x4d38d2['attributes'],function(_0x30e1a1){var _0x36c018={};_0x36c018[_0x30e1a1]={'$like':'%'+_0x52ae61[_0x8a79('0x4b')][_0x8a79('0x36')]+'%'};return _0x36c018;})});}_0x4d38d2=_[_0x8a79('0x61')]({},_0x4d38d2,_0x52ae61[_0x8a79('0x62')]);return db[_0x8a79('0xe1')]['count']({'where':_0x4d38d2[_0x8a79('0x4a')]})[_0x8a79('0x23')](function(_0x5655fe){_0xbe4580[_0x8a79('0x1e')]=_0x5655fe;if(_0x52ae61[_0x8a79('0x4b')][_0x8a79('0x4c')]){_0x4d38d2[_0x8a79('0x4d')]=[{'all':!![]}];}return db[_0x8a79('0xe1')][_0x8a79('0xae')](_0x4d38d2);})[_0x8a79('0x23')](function(_0x28b287){_0xbe4580[_0x8a79('0x52')]=_0x28b287;return _0xbe4580;});}})[_0x8a79('0x23')](respondWithFilteredResult(_0x2004d0,_0x4d38d2))['catch'](handleError(_0x2004d0,null));};exports[_0x8a79('0xe2')]=function(_0x314724,_0x14204c){var _0x24dead={'raw':!![],'where':{}};var _0x58dd58={};var _0x2ff69d={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x314724[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x14204c,null))[_0x8a79('0x23')](function(_0x2b2138){if(_0x2b2138){_0x58dd58[_0x8a79('0xd1')]=_[_0x8a79('0xd2')](db['ScreenRecording'][_0x8a79('0x40')]);_0x58dd58['query']=_[_0x8a79('0xd2')](_0x314724[_0x8a79('0x4b')]);_0x58dd58[_0x8a79('0xd4')]=_[_0x8a79('0xd5')](_0x58dd58[_0x8a79('0xd1')],_0x58dd58[_0x8a79('0x4b')]);_0x24dead[_0x8a79('0x51')]=_[_0x8a79('0xd5')](_0x58dd58[_0x8a79('0xd1')],qs[_0x8a79('0xd6')](_0x314724[_0x8a79('0x4b')][_0x8a79('0xd6')]));_0x24dead[_0x8a79('0x51')]=_0x24dead['attributes'][_0x8a79('0x54')]?_0x24dead[_0x8a79('0x51')]:_0x58dd58[_0x8a79('0xd1')];if(!_0x314724['query']['hasOwnProperty']('nolimit')){_0x24dead[_0x8a79('0x1d')]=qs[_0x8a79('0x1d')](_0x314724[_0x8a79('0x4b')][_0x8a79('0x1d')]);_0x24dead[_0x8a79('0x1b')]=qs[_0x8a79('0x1b')](_0x314724[_0x8a79('0x4b')]['offset']);}_0x24dead[_0x8a79('0xd7')]=qs[_0x8a79('0xd8')](_0x314724['query']['sort']);_0x24dead['where']=qs[_0x8a79('0xd4')](_[_0x8a79('0xd9')](_0x314724[_0x8a79('0x4b')],_0x58dd58[_0x8a79('0xd4')]));_0x24dead[_0x8a79('0x4a')]['UserId']=_0x2b2138['id'];if(_0x314724[_0x8a79('0x4b')][_0x8a79('0x36')]){_0x24dead[_0x8a79('0x4a')]=_['merge'](_0x24dead[_0x8a79('0x4a')],{'$or':_[_0x8a79('0x38')](_0x24dead[_0x8a79('0x51')],function(_0x5ecb8e){var _0x10b3b2={};_0x10b3b2[_0x5ecb8e]={'$like':'%'+_0x314724['query'][_0x8a79('0x36')]+'%'};return _0x10b3b2;})});}_0x24dead=_[_0x8a79('0x61')]({},_0x24dead,_0x314724[_0x8a79('0x62')]);return db['ScreenRecording'][_0x8a79('0x1e')]({'where':_0x24dead[_0x8a79('0x4a')]})['then'](function(_0x3ead37){_0x2ff69d[_0x8a79('0x1e')]=_0x3ead37;if(_0x314724['query'][_0x8a79('0x4c')]){_0x24dead['include']=[{'all':!![]}];}return db[_0x8a79('0xe3')][_0x8a79('0xae')](_0x24dead);})['then'](function(_0x12799f){_0x2ff69d[_0x8a79('0x52')]=_0x12799f;return _0x2ff69d;});}})[_0x8a79('0x23')](respondWithFilteredResult(_0x14204c,_0x24dead))['catch'](handleError(_0x14204c,null));};exports[_0x8a79('0xe4')]=function(_0x474787,_0x2173dd){var _0x48c78e={};var _0x1dc409={};var _0x38b8b5;var _0xdd5a11;return db['User'][_0x8a79('0x98')]({'where':{'id':_0x474787[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x2173dd,null))['then'](function(_0x582ef9){if(_0x582ef9){_0x38b8b5=_0x582ef9;_0x1dc409['model']=_['keys'](db[_0x8a79('0xe5')]['rawAttributes']);_0x1dc409[_0x8a79('0x4b')]=_[_0x8a79('0xd2')](_0x474787['query']);_0x1dc409[_0x8a79('0xd4')]=_[_0x8a79('0xd5')](_0x1dc409[_0x8a79('0xd1')],_0x1dc409[_0x8a79('0x4b')]);_0x48c78e[_0x8a79('0x51')]=_[_0x8a79('0xd5')](_0x1dc409[_0x8a79('0xd1')],qs[_0x8a79('0xd6')](_0x474787[_0x8a79('0x4b')][_0x8a79('0xd6')]));_0x48c78e[_0x8a79('0x51')]=_0x48c78e['attributes'][_0x8a79('0x54')]?_0x48c78e['attributes']:_0x1dc409['model'];_0x48c78e['order']=qs[_0x8a79('0xd8')](_0x474787['query'][_0x8a79('0xd8')]);_0x48c78e[_0x8a79('0x4a')]=qs[_0x8a79('0xd4')](_[_0x8a79('0xd9')](_0x474787[_0x8a79('0x4b')],_0x1dc409[_0x8a79('0xd4')]));if(_0x474787['query'][_0x8a79('0x36')]){_0x48c78e[_0x8a79('0x4a')]=_[_0x8a79('0x61')](_0x48c78e['where'],{'$or':_['map'](_0x48c78e['attributes'],function(_0x1bacd3){var _0x3c7e78={};_0x3c7e78[_0x1bacd3]={'$like':'%'+_0x474787['query']['filter']+'%'};return _0x3c7e78;})});}_0x48c78e=_[_0x8a79('0x61')]({},_0x48c78e,_0x474787[_0x8a79('0x62')]);return _0x38b8b5[_0x8a79('0xe4')](_0x48c78e);}})[_0x8a79('0x23')](function(_0x2fc90a){if(_0x2fc90a){_0xdd5a11=_0x2fc90a[_0x8a79('0x54')];if(!_0x474787['query']['hasOwnProperty'](_0x8a79('0xdc'))){_0x48c78e['limit']=qs['limit'](_0x474787[_0x8a79('0x4b')]['limit']);_0x48c78e[_0x8a79('0x1b')]=qs['offset'](_0x474787[_0x8a79('0x4b')][_0x8a79('0x1b')]);}return _0x38b8b5[_0x8a79('0xe4')](_0x48c78e);}})['then'](function(_0x399913){if(_0x399913){return _0x399913?{'count':_0xdd5a11,'rows':_0x399913}:null;}})[_0x8a79('0x23')](respondWithResult(_0x2173dd,null))[_0x8a79('0x5e')](handleError(_0x2173dd,null));};exports[_0x8a79('0xe6')]=function(_0x2de4b9,_0x5bdf79){var _0x20180d={};var _0x1dfeb2={};var _0x3bc486;var _0x38abe9;return db[_0x8a79('0x3f')][_0x8a79('0x98')]({'where':{'id':_0x2de4b9[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x5bdf79,null))[_0x8a79('0x23')](function(_0x4ec43c){if(_0x4ec43c){_0x3bc486=_0x4ec43c;_0x1dfeb2[_0x8a79('0xd1')]=_[_0x8a79('0xd2')](db[_0x8a79('0xe7')][_0x8a79('0x40')]);_0x1dfeb2[_0x8a79('0x4b')]=_['keys'](_0x2de4b9[_0x8a79('0x4b')]);_0x1dfeb2[_0x8a79('0xd4')]=_['intersection'](_0x1dfeb2[_0x8a79('0xd1')],_0x1dfeb2[_0x8a79('0x4b')]);_0x20180d[_0x8a79('0x51')]=_[_0x8a79('0xd5')](_0x1dfeb2['model'],qs['fields'](_0x2de4b9['query'][_0x8a79('0xd6')]));_0x20180d[_0x8a79('0x51')]=_0x20180d[_0x8a79('0x51')][_0x8a79('0x54')]?_0x20180d[_0x8a79('0x51')]:_0x1dfeb2[_0x8a79('0xd1')];_0x20180d[_0x8a79('0xd7')]=qs[_0x8a79('0xd8')](_0x2de4b9[_0x8a79('0x4b')][_0x8a79('0xd8')]);_0x20180d[_0x8a79('0x4a')]=qs[_0x8a79('0xd4')](_[_0x8a79('0xd9')](_0x2de4b9[_0x8a79('0x4b')],_0x1dfeb2['filters']));if(_0x2de4b9[_0x8a79('0x4b')][_0x8a79('0x36')]){_0x20180d['where']=_[_0x8a79('0x61')](_0x20180d[_0x8a79('0x4a')],{'$or':_[_0x8a79('0x38')](_0x20180d[_0x8a79('0x51')],function(_0x4de6b7){var _0x260325={};_0x260325[_0x4de6b7]={'$like':'%'+_0x2de4b9['query']['filter']+'%'};return _0x260325;})});}_0x20180d=_[_0x8a79('0x61')]({},_0x20180d,_0x2de4b9[_0x8a79('0x62')]);return _0x3bc486[_0x8a79('0xe6')](_0x20180d);}})[_0x8a79('0x23')](function(_0x5aa3b0){if(_0x5aa3b0){_0x38abe9=_0x5aa3b0[_0x8a79('0x54')];if(!_0x2de4b9[_0x8a79('0x4b')][_0x8a79('0xca')](_0x8a79('0xdc'))){_0x20180d[_0x8a79('0x1d')]=qs[_0x8a79('0x1d')](_0x2de4b9['query']['limit']);_0x20180d[_0x8a79('0x1b')]=qs[_0x8a79('0x1b')](_0x2de4b9['query'][_0x8a79('0x1b')]);}return _0x3bc486[_0x8a79('0xe6')](_0x20180d);}})[_0x8a79('0x23')](function(_0x4279ec){if(_0x4279ec){return _0x4279ec?{'count':_0x38abe9,'rows':_0x4279ec}:null;}})['then'](respondWithResult(_0x5bdf79,null))[_0x8a79('0x5e')](handleError(_0x5bdf79,null));};exports[_0x8a79('0xe8')]=function(_0x540702,_0x1d96a1){var _0x158a0d={'raw':!![],'where':{}};var _0x26e6a2={};var _0x137dbb={'count':0x0,'rows':[]};return db[_0x8a79('0x3f')][_0x8a79('0x98')]({'where':{'id':_0x540702[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x1d96a1,null))['then'](function(_0x29d6eb){if(_0x29d6eb){_0x26e6a2[_0x8a79('0xd1')]=_['keys'](db[_0x8a79('0xe9')][_0x8a79('0x40')]);_0x26e6a2[_0x8a79('0x4b')]=_[_0x8a79('0xd2')](_0x540702[_0x8a79('0x4b')]);_0x26e6a2['filters']=_[_0x8a79('0xd5')](_0x26e6a2['model'],_0x26e6a2[_0x8a79('0x4b')]);_0x158a0d[_0x8a79('0x51')]=_[_0x8a79('0xd5')](_0x26e6a2[_0x8a79('0xd1')],qs[_0x8a79('0xd6')](_0x540702['query']['fields']));_0x158a0d[_0x8a79('0x51')]=_0x158a0d[_0x8a79('0x51')][_0x8a79('0x54')]?_0x158a0d[_0x8a79('0x51')]:_0x26e6a2[_0x8a79('0xd1')];if(!_0x540702['query'][_0x8a79('0xca')](_0x8a79('0xdc'))){_0x158a0d['limit']=qs['limit'](_0x540702[_0x8a79('0x4b')][_0x8a79('0x1d')]);_0x158a0d[_0x8a79('0x1b')]=qs['offset'](_0x540702[_0x8a79('0x4b')][_0x8a79('0x1b')]);}_0x158a0d[_0x8a79('0xd7')]=qs[_0x8a79('0xd8')](_0x540702[_0x8a79('0x4b')]['sort']);_0x158a0d['where']=qs[_0x8a79('0xd4')](_[_0x8a79('0xd9')](_0x540702[_0x8a79('0x4b')],_0x26e6a2[_0x8a79('0xd4')]));_0x158a0d[_0x8a79('0x4a')]['UserId']=_0x29d6eb['id'];if(_0x540702[_0x8a79('0x4b')][_0x8a79('0x36')]){_0x158a0d[_0x8a79('0x4a')]=_[_0x8a79('0x61')](_0x158a0d['where'],{'$or':_['map'](_0x158a0d['attributes'],function(_0x784d5a){var _0x3c71a8={};_0x3c71a8[_0x784d5a]={'$like':'%'+_0x540702[_0x8a79('0x4b')][_0x8a79('0x36')]+'%'};return _0x3c71a8;})});}_0x158a0d=_['merge']({},_0x158a0d,_0x540702[_0x8a79('0x62')]);return db[_0x8a79('0xe9')]['count']({'where':_0x158a0d[_0x8a79('0x4a')]})['then'](function(_0x131bfb){_0x137dbb[_0x8a79('0x1e')]=_0x131bfb;if(_0x540702[_0x8a79('0x4b')][_0x8a79('0x4c')]){_0x158a0d[_0x8a79('0x4d')]=[{'all':!![]}];}return db['MailInteraction'][_0x8a79('0xae')](_0x158a0d);})[_0x8a79('0x23')](function(_0x592106){_0x137dbb[_0x8a79('0x52')]=_0x592106;return _0x137dbb;});}})['then'](respondWithFilteredResult(_0x1d96a1,_0x158a0d))[_0x8a79('0x5e')](handleError(_0x1d96a1,null));};exports['getSmsInteractions']=function(_0x216747,_0x3fbf59){var _0xdd6bf9={};var _0x44cc59={};var _0xb2ec43;var _0x250535;return db[_0x8a79('0x3f')][_0x8a79('0x98')]({'where':{'id':_0x216747[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x3fbf59,null))[_0x8a79('0x23')](function(_0x1acb91){if(_0x1acb91){_0xb2ec43=_0x1acb91;_0x44cc59[_0x8a79('0xd1')]=_[_0x8a79('0xd2')](db['SmsInteraction'][_0x8a79('0x40')]);_0x44cc59[_0x8a79('0x4b')]=_[_0x8a79('0xd2')](_0x216747[_0x8a79('0x4b')]);_0x44cc59[_0x8a79('0xd4')]=_['intersection'](_0x44cc59[_0x8a79('0xd1')],_0x44cc59[_0x8a79('0x4b')]);_0xdd6bf9[_0x8a79('0x51')]=_[_0x8a79('0xd5')](_0x44cc59[_0x8a79('0xd1')],qs[_0x8a79('0xd6')](_0x216747['query'][_0x8a79('0xd6')]));_0xdd6bf9['attributes']=_0xdd6bf9[_0x8a79('0x51')][_0x8a79('0x54')]?_0xdd6bf9['attributes']:_0x44cc59[_0x8a79('0xd1')];_0xdd6bf9[_0x8a79('0xd7')]=qs['sort'](_0x216747['query'][_0x8a79('0xd8')]);_0xdd6bf9['where']=qs[_0x8a79('0xd4')](_[_0x8a79('0xd9')](_0x216747[_0x8a79('0x4b')],_0x44cc59[_0x8a79('0xd4')]));if(_0x216747['query'][_0x8a79('0x36')]){_0xdd6bf9[_0x8a79('0x4a')]=_['merge'](_0xdd6bf9['where'],{'$or':_[_0x8a79('0x38')](_0xdd6bf9[_0x8a79('0x51')],function(_0x2da7c5){var _0x73bc25={};_0x73bc25[_0x2da7c5]={'$like':'%'+_0x216747[_0x8a79('0x4b')][_0x8a79('0x36')]+'%'};return _0x73bc25;})});}_0xdd6bf9=_['merge']({},_0xdd6bf9,_0x216747[_0x8a79('0x62')]);return _0xb2ec43[_0x8a79('0xea')](_0xdd6bf9);}})[_0x8a79('0x23')](function(_0x4fb8a5){if(_0x4fb8a5){_0x250535=_0x4fb8a5['length'];if(!_0x216747[_0x8a79('0x4b')][_0x8a79('0xca')](_0x8a79('0xdc'))){_0xdd6bf9[_0x8a79('0x1d')]=qs[_0x8a79('0x1d')](_0x216747[_0x8a79('0x4b')][_0x8a79('0x1d')]);_0xdd6bf9[_0x8a79('0x1b')]=qs['offset'](_0x216747['query'][_0x8a79('0x1b')]);}return _0xb2ec43[_0x8a79('0xea')](_0xdd6bf9);}})[_0x8a79('0x23')](function(_0x20492f){if(_0x20492f){return _0x20492f?{'count':_0x250535,'rows':_0x20492f}:null;}})[_0x8a79('0x23')](respondWithResult(_0x3fbf59,null))[_0x8a79('0x5e')](handleError(_0x3fbf59,null));};exports['getFaxInteractions']=function(_0x2304cb,_0x2aafe8){var _0x49db1f={};var _0x428b17={};var _0x380fc0;var _0x170a29;return db[_0x8a79('0x3f')][_0x8a79('0x98')]({'where':{'id':_0x2304cb[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x2aafe8,null))['then'](function(_0xbf6f63){if(_0xbf6f63){_0x380fc0=_0xbf6f63;_0x428b17[_0x8a79('0xd1')]=_[_0x8a79('0xd2')](db[_0x8a79('0xeb')][_0x8a79('0x40')]);_0x428b17['query']=_[_0x8a79('0xd2')](_0x2304cb[_0x8a79('0x4b')]);_0x428b17[_0x8a79('0xd4')]=_[_0x8a79('0xd5')](_0x428b17[_0x8a79('0xd1')],_0x428b17[_0x8a79('0x4b')]);_0x49db1f['attributes']=_['intersection'](_0x428b17[_0x8a79('0xd1')],qs[_0x8a79('0xd6')](_0x2304cb['query'][_0x8a79('0xd6')]));_0x49db1f[_0x8a79('0x51')]=_0x49db1f[_0x8a79('0x51')][_0x8a79('0x54')]?_0x49db1f[_0x8a79('0x51')]:_0x428b17['model'];_0x49db1f[_0x8a79('0xd7')]=qs['sort'](_0x2304cb['query'][_0x8a79('0xd8')]);_0x49db1f['where']=qs[_0x8a79('0xd4')](_['pick'](_0x2304cb['query'],_0x428b17[_0x8a79('0xd4')]));if(_0x2304cb[_0x8a79('0x4b')]['filter']){_0x49db1f['where']=_[_0x8a79('0x61')](_0x49db1f[_0x8a79('0x4a')],{'$or':_[_0x8a79('0x38')](_0x49db1f['attributes'],function(_0xcdb043){var _0x2b8614={};_0x2b8614[_0xcdb043]={'$like':'%'+_0x2304cb[_0x8a79('0x4b')][_0x8a79('0x36')]+'%'};return _0x2b8614;})});}_0x49db1f=_['merge']({},_0x49db1f,_0x2304cb[_0x8a79('0x62')]);return _0x380fc0[_0x8a79('0xec')](_0x49db1f);}})[_0x8a79('0x23')](function(_0x59b9af){if(_0x59b9af){_0x170a29=_0x59b9af['length'];if(!_0x2304cb[_0x8a79('0x4b')][_0x8a79('0xca')]('nolimit')){_0x49db1f[_0x8a79('0x1d')]=qs[_0x8a79('0x1d')](_0x2304cb[_0x8a79('0x4b')][_0x8a79('0x1d')]);_0x49db1f['offset']=qs[_0x8a79('0x1b')](_0x2304cb[_0x8a79('0x4b')][_0x8a79('0x1b')]);}return _0x380fc0[_0x8a79('0xec')](_0x49db1f);}})[_0x8a79('0x23')](function(_0x3923c6){if(_0x3923c6){return _0x3923c6?{'count':_0x170a29,'rows':_0x3923c6}:null;}})[_0x8a79('0x23')](respondWithResult(_0x2aafe8,null))[_0x8a79('0x5e')](handleError(_0x2aafe8,null));};exports[_0x8a79('0xed')]=function(_0x19bb6f,_0x3398da){var _0x403ac6={};var _0x17b784={};var _0x9e901;var _0x473704;return db['User'][_0x8a79('0x98')]({'where':{'id':_0x19bb6f[_0x8a79('0x60')]['id']}})['then'](handleEntityNotFound(_0x3398da,null))[_0x8a79('0x23')](function(_0x4e6b70){if(_0x4e6b70){_0x9e901=_0x4e6b70;_0x17b784[_0x8a79('0xd1')]=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x17b784['query']=_[_0x8a79('0xd2')](_0x19bb6f[_0x8a79('0x4b')]);_0x17b784[_0x8a79('0xd4')]=_[_0x8a79('0xd5')](_0x17b784[_0x8a79('0xd1')],_0x17b784[_0x8a79('0x4b')]);_0x403ac6[_0x8a79('0x51')]=_['intersection'](_0x17b784[_0x8a79('0xd1')],qs[_0x8a79('0xd6')](_0x19bb6f[_0x8a79('0x4b')][_0x8a79('0xd6')]));_0x403ac6['attributes']=_0x403ac6[_0x8a79('0x51')][_0x8a79('0x54')]?_0x403ac6[_0x8a79('0x51')]:_0x17b784[_0x8a79('0xd1')];_0x403ac6[_0x8a79('0xd7')]=qs[_0x8a79('0xd8')](_0x19bb6f[_0x8a79('0x4b')][_0x8a79('0xd8')]);_0x403ac6['where']=qs[_0x8a79('0xd4')](_[_0x8a79('0xd9')](_0x19bb6f['query'],_0x17b784[_0x8a79('0xd4')]));if(_0x19bb6f[_0x8a79('0x4b')][_0x8a79('0x36')]){_0x403ac6['where']=_[_0x8a79('0x61')](_0x403ac6['where'],{'$or':_['map'](_0x403ac6['attributes'],function(_0x37c67b){var _0x572a81={};_0x572a81[_0x37c67b]={'$like':'%'+_0x19bb6f[_0x8a79('0x4b')][_0x8a79('0x36')]+'%'};return _0x572a81;})});}_0x403ac6=_[_0x8a79('0x61')]({},_0x403ac6,_0x19bb6f[_0x8a79('0x62')]);return _0x9e901[_0x8a79('0xed')](_0x403ac6);}})[_0x8a79('0x23')](function(_0x5f10d1){if(_0x5f10d1){_0x473704=_0x5f10d1['length'];if(!_0x19bb6f[_0x8a79('0x4b')][_0x8a79('0xca')](_0x8a79('0xdc'))){_0x403ac6['limit']=qs[_0x8a79('0x1d')](_0x19bb6f[_0x8a79('0x4b')][_0x8a79('0x1d')]);_0x403ac6[_0x8a79('0x1b')]=qs[_0x8a79('0x1b')](_0x19bb6f[_0x8a79('0x4b')]['offset']);}return _0x9e901[_0x8a79('0xed')](_0x403ac6);}})[_0x8a79('0x23')](function(_0x4d91db){if(_0x4d91db){return _0x4d91db?{'count':_0x473704,'rows':_0x4d91db}:null;}})['then'](respondWithResult(_0x3398da,null))[_0x8a79('0x5e')](handleError(_0x3398da,null));};exports['login']=function(_0x12851b,_0x1145da,_0x4cae92){var _0x4d3567;var _0x1d8b06;var _0x1b6e80;var _0x5797cc=!_[_0x8a79('0x6d')](_0x12851b[_0x8a79('0x60')]['id'])?_0x12851b[_0x8a79('0x60')]['id']:!_['isNil'](_0x12851b[_0x8a79('0x32')]['id'])?_0x12851b['user']['id']:null;return db['User']['find']({'where':{'id':_0x5797cc,'role':{'$or':['admin',_0x8a79('0x32'),_0x8a79('0x34')]}},'attributes':['id',_0x8a79('0x3b'),_0x8a79('0xee'),'mobile',_0x8a79('0x30'),'internal','loginInPause']})[_0x8a79('0x23')](function(_0x6d5c0c){if(_0x6d5c0c){if(_0x6d5c0c[_0x8a79('0x30')]===_0x8a79('0x34')){_0x4d3567=_0x6d5c0c;if(_0x12851b[_0x8a79('0x63')][_0x8a79('0xa1')]){_0x1b6e80=util['format'](_0x8a79('0xef'),_0x4d3567[_0x12851b[_0x8a79('0x63')][_0x8a79('0xa1')]]);}else if(_0x12851b[_0x8a79('0x63')][_0x8a79('0xf0')]){_0x1b6e80=util[_0x8a79('0xb0')](_0x8a79('0xb1'),_0x12851b['body']['intrf']);}else{_0x1b6e80=util[_0x8a79('0xb0')](_0x8a79('0xb1'),_0x4d3567[_0x8a79('0x3b')]);}socket['to'](util[_0x8a79('0xb0')]('user:%s',_0x4d3567[_0x8a79('0x3b')]))[_0x8a79('0xab')]('user:forcelogout',{'user':{'id':_0x4d3567['id'],'name':_0x4d3567[_0x8a79('0x3b')]},'ip':_0x12851b[_0x8a79('0xf1')][_0x8a79('0xf2')]||_0x12851b[_0x8a79('0xf3')][_0x8a79('0xf4')]||_0x12851b[_0x8a79('0xf5')][_0x8a79('0xf4')]||_0x12851b[_0x8a79('0xf3')][_0x8a79('0xf5')][_0x8a79('0xf4')]});return new Promise(function(_0x3bf9b5,_0x37a8d7){db['sequelize'][_0x8a79('0xf6')]()[_0x8a79('0x23')](_0x4bc1d2=>{db[_0x8a79('0xb2')][_0x8a79('0x3d')]({'where':{'membername':_0x4d3567[_0x8a79('0x3b')]},'individualHooks':!![]},{'transaction':_0x4bc1d2})['then'](function(){return _0x4bc1d2[_0x8a79('0xf7')]();})[_0x8a79('0x23')](_0x3bf9b5)['catch'](_0x37a8d7);});});}}else{throw new db[(_0x8a79('0x92'))]['ValidationError'](_0x8a79('0xf8'));}})[_0x8a79('0x23')](function(){if(_0x4d3567){return _0x4d3567['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x1620ae){if(_0x4d3567){if(_0x1620ae){_0x1d8b06=_0x1620ae;if(_0x1d8b06['length']){var _0x4ac7e4=_0x1d8b06[_0x8a79('0x38')](function(_0x1e8fd1){return{'membername':_0x4d3567[_0x8a79('0x3b')],'UserId':_0x4d3567['id'],'queue_name':_0x1e8fd1[_0x8a79('0x3b')],'VoiceQueueId':_0x1e8fd1['id'],'interface':_0x1b6e80,'paused':_0x4d3567[_0x8a79('0x9f')]||![],'penalty':_0x1e8fd1['UserVoiceQueue.penalty']||0x0};});return db['UserVoiceQueueRt']['bulkCreate'](_0x4ac7e4);}}}})[_0x8a79('0x23')](function(){if(_0x4d3567){return db['MemberReport']['findAll']({'where':{'membername':_0x4d3567[_0x8a79('0x3b')],'exitAt':null}});}})[_0x8a79('0x23')](function(_0x496e7d){if(_0x4d3567){var _0x5084bb=[];_0x496e7d[_0x8a79('0xf9')](function(_0x42f188){_0x5084bb['push'](_0x42f188[_0x8a79('0x2d')]({'exitAt':moment()[_0x8a79('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x8a79('0x5d')](_0x5084bb);}})['then'](function(){if(_0x4d3567){var _0xf921e8=[];var _0x20914f=[];var _0x1c7ee3=utils[_0x8a79('0xfa')]();var _0x5ac585={'membername':_0x4d3567[_0x8a79('0x3b')],'interface':_0x1b6e80,'enterAt':moment()['format'](_0x8a79('0xfb')),'role':_0x4d3567['role'],'internal':_0x4d3567[_0x8a79('0x68')]};_0x1c7ee3[_0x8a79('0xf9')](function(_0x5bb376){_0xf921e8[_0x8a79('0x55')](_[_0x8a79('0x61')]({'channel':_0x5bb376,'type':'LOGIN','data1':_0x12851b[_0x8a79('0x63')]['device'],'data2':_0x1b6e80},_0x5ac585));if(_0x4d3567[_0x8a79('0x9f')]){_0x20914f['push'](_[_0x8a79('0x61')]({'channel':_0x5bb376,'type':_0x8a79('0xfc'),'data1':_0x8a79('0xfd')},_0x5ac585));}});return db['MemberReport']['bulkCreate'](_0xf921e8[_0x8a79('0xfe')](_0x20914f),{'individualHooks':!![]});}})[_0x8a79('0x23')](function(){if(_0x4d3567){return _0x4d3567['update']({'online':!![],'lastLoginAt':moment()['format'](_0x8a79('0xfb')),'voicePause':_0x4d3567[_0x8a79('0x9f')]||![],'mailPause':_0x4d3567[_0x8a79('0x9f')]||![],'chatPause':_0x4d3567[_0x8a79('0x9f')]||![],'faxPause':_0x4d3567[_0x8a79('0x9f')]||![],'smsPause':_0x4d3567[_0x8a79('0x9f')]||![],'openchannelPause':_0x4d3567[_0x8a79('0x9f')]||![],'whatsappPause':_0x4d3567[_0x8a79('0x9f')]||![],'pauseType':_0x4d3567[_0x8a79('0x9f')]?'LOGININPAUSE':null,'interface':_0x1b6e80,'lastPauseAt':moment()['format'](_0x8a79('0xfb'))});}})[_0x8a79('0x23')](function(_0x3a9a4b){if(_0x12851b[_0x8a79('0xff')]){return _0x4cae92();}else{return Promise[_0x8a79('0x100')](_0x3a9a4b)[_0x8a79('0x23')](respondWithResult(_0x1145da,null));}})[_0x8a79('0x5e')](handleError(_0x1145da,null));};exports[_0x8a79('0x101')]=function(_0x3cf984,_0x4a9b01){var _0x5e32c3;return db[_0x8a79('0x3f')]['find']({'where':{'id':_0x3cf984[_0x8a79('0x60')]['id'],'role':_0x8a79('0x34')},'attributes':['id',_0x8a79('0x3b'),'role']})[_0x8a79('0x23')](handleEntityNotFound(_0x4a9b01,null))[_0x8a79('0x23')](function(_0x432ffc){if(_0x432ffc){_0x5e32c3=_0x432ffc;return db['UserVoiceQueueRt'][_0x8a79('0x3d')]({'where':{'membername':_0x5e32c3[_0x8a79('0x3b')]},'individualHooks':!![]});}})[_0x8a79('0x23')](function(){return db[_0x8a79('0x102')][_0x8a79('0xae')]({'where':{'membername':_0x5e32c3[_0x8a79('0x3b')],'exitAt':null}});})['then'](function(_0x18ca4d){var _0x3de967=[];_0x18ca4d[_0x8a79('0xf9')](function(_0x22b71f){_0x3de967[_0x8a79('0x55')](_0x22b71f['update']({'exitAt':moment()[_0x8a79('0xb0')](_0x8a79('0xfb'))}));});return Promise[_0x8a79('0x5d')](_0x3de967);})[_0x8a79('0x23')](function(){return _0x5e32c3['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x4a9b01,null))['catch'](handleError(_0x4a9b01,null));};exports['pause']=function(_0x5ad2bd,_0x42ead8){var _0x11918f;return db[_0x8a79('0xb2')]['update']({'paused':0x1},{'where':{'UserId':_0x5ad2bd['params']['id']},'individualHooks':!![]})[_0x8a79('0x23')](function(){return db[_0x8a79('0x3f')][_0x8a79('0x3a')]({'where':{'id':_0x5ad2bd['params']['id'],'role':'agent'},'attributes':['id','name',_0x8a79('0x30'),'internal','interface',_0x8a79('0x9e')]});})[_0x8a79('0x23')](handleEntityNotFound(_0x42ead8,null))[_0x8a79('0x23')](function(_0x5733a7){if(_0x5733a7){_0x11918f=_0x5733a7;return respondWithRpcPromise('QueuePause',_0x8a79('0x103'),{'id':_0x11918f['id'],'name':_0x11918f[_0x8a79('0x3b')],'pause':!![]});}})[_0x8a79('0x23')](function(){if(_0x11918f){return db[_0x8a79('0x102')][_0x8a79('0xae')]({'where':{'membername':_0x11918f[_0x8a79('0x3b')],'type':'PAUSE','exitAt':null}});}})[_0x8a79('0x23')](function(_0x1e03a6){if(_0x1e03a6['length']){var _0x3d1815=moment()[_0x8a79('0xb0')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2514b7=0x0,_0x538e53=_0x1e03a6['length'];_0x2514b7<_0x538e53;_0x2514b7++){_0x1e03a6[_0x2514b7][_0x8a79('0x104')]({'exitAt':_0x3d1815});}}})[_0x8a79('0x23')](function(){var _0x9a5f26=[];var _0x122f31=utils[_0x8a79('0xfa')]();_0x122f31[_0x8a79('0xf9')](function(_0x5b10dc){_0x9a5f26[_0x8a79('0x55')]({'channel':_0x5b10dc,'membername':_0x11918f[_0x8a79('0x3b')],'interface':_[_0x8a79('0x6d')](_0x11918f[_0x8a79('0xa1')])?util['format'](_0x8a79('0xb1'),_0x11918f[_0x8a79('0x3b')]):_0x11918f[_0x8a79('0xa1')],'type':'PAUSE','enterAt':moment()[_0x8a79('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5ad2bd[_0x8a79('0x63')][_0x8a79('0x105')]||_0x8a79('0x106'),'role':_0x11918f[_0x8a79('0x30')],'internal':_0x11918f['internal']});});return db[_0x8a79('0x102')]['bulkCreate'](_0x9a5f26,{'individualHooks':!![]});})['then'](function(){return _0x11918f[_0x8a79('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5ad2bd[_0x8a79('0x63')][_0x8a79('0x105')]||_0x8a79('0x106'),'lastPauseAt':moment()[_0x8a79('0xb0')](_0x8a79('0xfb'))});})[_0x8a79('0x23')](respondWithResult(_0x42ead8,null))[_0x8a79('0x5e')](handleError(_0x42ead8,null));};exports['unpause']=function(_0x18b37a,_0x1ff55e){if(_0x18b37a[_0x8a79('0x63')][_0x8a79('0x9d')]&&!utils[_0x8a79('0xa2')](_0x18b37a[_0x8a79('0x63')][_0x8a79('0x9d')])){throw new APIBadRequestError(util[_0x8a79('0xb0')](_0x8a79('0x107'),_0x18b37a['body'][_0x8a79('0x9d')]));}return db[_0x8a79('0x3f')][_0x8a79('0x3a')]({'where':{'id':_0x18b37a[_0x8a79('0x60')]['id']},'attributes':['id',_0x8a79('0x3b'),_0x8a79('0x30'),_0x8a79('0x68'),'interface',_0x8a79('0x9e'),'voicePause','mailPause','chatPause',_0x8a79('0x108'),'openchannelPause',_0x8a79('0x109'),_0x8a79('0x10a'),_0x8a79('0x10b'),_0x8a79('0x10c')]})[_0x8a79('0x23')](function(_0x285111){if(!_0x285111){throw new APINotFoundError(util[_0x8a79('0xb0')](_0x8a79('0x10d'),_0x18b37a[_0x8a79('0x60')]['id']));}return _0x285111[_0x8a79('0x10e')](_0x18b37a[_0x8a79('0x63')][_0x8a79('0x9d')]);})[_0x8a79('0x23')](respondWithResult(_0x1ff55e,null))['catch'](APIHandleError(_0x1ff55e));};exports[_0x8a79('0x10f')]=function(_0x1388b0,_0x3bac2c){var _0x294e86={};var _0x4d86d0={};var _0x2e7dc2;var _0xcd0f94;return db['User'][_0x8a79('0x98')]({'where':{'id':_0x1388b0[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x3bac2c,null))[_0x8a79('0x23')](function(_0x420945){if(_0x420945){_0x2e7dc2=_0x420945;_0x4d86d0[_0x8a79('0xd1')]=_[_0x8a79('0xd2')](db[_0x8a79('0x110')]['rawAttributes']);_0x4d86d0['query']=_['keys'](_0x1388b0[_0x8a79('0x4b')]);_0x4d86d0[_0x8a79('0xd4')]=_[_0x8a79('0xd5')](_0x4d86d0[_0x8a79('0xd1')],_0x4d86d0[_0x8a79('0x4b')]);_0x294e86[_0x8a79('0x51')]=_[_0x8a79('0xd5')](_0x4d86d0[_0x8a79('0xd1')],qs['fields'](_0x1388b0[_0x8a79('0x4b')][_0x8a79('0xd6')]));_0x294e86[_0x8a79('0x51')]=_0x294e86[_0x8a79('0x51')][_0x8a79('0x54')]?_0x294e86[_0x8a79('0x51')]:_0x4d86d0[_0x8a79('0xd1')];_0x294e86[_0x8a79('0xd7')]=qs[_0x8a79('0xd8')](_0x1388b0[_0x8a79('0x4b')][_0x8a79('0xd8')]);_0x294e86[_0x8a79('0x4a')]=qs[_0x8a79('0xd4')](_[_0x8a79('0xd9')](_0x1388b0[_0x8a79('0x4b')],_0x4d86d0[_0x8a79('0xd4')]));if(_0x1388b0[_0x8a79('0x4b')][_0x8a79('0x36')]){_0x294e86[_0x8a79('0x4a')]=_[_0x8a79('0x61')](_0x294e86[_0x8a79('0x4a')],{'$or':_[_0x8a79('0x38')](_0x294e86[_0x8a79('0x51')],function(_0x5b9f03){var _0x52850c={};_0x52850c[_0x5b9f03]={'$like':'%'+_0x1388b0[_0x8a79('0x4b')][_0x8a79('0x36')]+'%'};return _0x52850c;})});}_0x294e86=_['merge']({},_0x294e86,_0x1388b0[_0x8a79('0x62')]);return _0x2e7dc2['getTeams'](_0x294e86);}})['then'](function(_0x32c851){if(_0x32c851){_0xcd0f94=_0x32c851[_0x8a79('0x54')];if(!_0x1388b0['query']['hasOwnProperty'](_0x8a79('0xdc'))){_0x294e86['limit']=qs[_0x8a79('0x1d')](_0x1388b0[_0x8a79('0x4b')]['limit']);_0x294e86[_0x8a79('0x1b')]=qs[_0x8a79('0x1b')](_0x1388b0[_0x8a79('0x4b')][_0x8a79('0x1b')]);}return _0x2e7dc2[_0x8a79('0x10f')](_0x294e86);}})[_0x8a79('0x23')](function(_0x421bad){if(_0x421bad){return _0x421bad?{'count':_0xcd0f94,'rows':_0x421bad}:null;}})[_0x8a79('0x23')](respondWithResult(_0x3bac2c,null))[_0x8a79('0x5e')](handleError(_0x3bac2c,null));};exports[_0x8a79('0x111')]=function(_0x3909fa,_0x1db6bd){var _0x484729=_0x3909fa['params']['id'];var _0x18421b=_0x3909fa[_0x8a79('0x63')]?_0x3909fa[_0x8a79('0x63')][_0x8a79('0x66')]:null;var _0x52ee27=[];return Promise[_0x8a79('0x100')]()[_0x8a79('0x23')](function(){if(!_0x18421b)throw new APIBadRequestError(_0x8a79('0x112'));})[_0x8a79('0x23')](function(){return db[_0x8a79('0x3f')][_0x8a79('0x98')]({'where':{'id':_0x484729}});})[_0x8a79('0x23')](function(_0x582bee){if(!_0x582bee)throw new APINotFoundError(util[_0x8a79('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3909fa[_0x8a79('0x60')]['id']));return db[_0x8a79('0x6f')][_0x8a79('0xf6')](function(_0x35e1fb){return _0x582bee[_0x8a79('0x111')](_0x18421b,{'transaction':_0x35e1fb})[_0x8a79('0x23')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x18421b}}});})[_0x8a79('0x23')](function(_0x57ed01){var _0x5d2ce6=_['map'](_0x57ed01,function(_0x4bed8c){return _0x4bed8c[_0x8a79('0x113')]();});return Promise['all'](_0x5d2ce6);})['then'](function(_0x423490){_0x52ee27=_[_0x8a79('0x114')](_0x423490);var _0x29d3b1=_[_0x8a79('0x38')](_0x52ee27,function(_0x2e84a0){return _0x2e84a0[_0x8a79('0x115')](_0x582bee['id'],{'transaction':_0x35e1fb});});return Promise[_0x8a79('0x5d')](_0x29d3b1);})['then'](function(){if(!_0x582bee['online'])return;var _0x5aaf56=_[_0x8a79('0x36')](_0x52ee27,function(_0x583866){return _0x583866[_0x8a79('0x116')]('channel')===_0x8a79('0x117');});var _0x109cfa=_[_0x8a79('0x38')](_0x5aaf56,function(_0x3bc085){return db['UserVoiceQueueRt'][_0x8a79('0xb3')]({'membername':_0x582bee[_0x8a79('0x3b')],'UserId':_0x582bee['id'],'queue_name':_0x3bc085[_0x8a79('0x3b')],'VoiceQueueId':_0x3bc085['id'],'interface':_[_0x8a79('0x6d')](_0x582bee[_0x8a79('0xa1')])?util['format']('SIP/%s',_0x582bee[_0x8a79('0x3b')]):_0x582bee[_0x8a79('0xa1')],'paused':_0x582bee[_0x8a79('0xa0')]||![],'penalty':_0x582bee[_0x8a79('0xa8')]},{'transaction':_0x35e1fb});});return Promise[_0x8a79('0x5d')](_0x109cfa);})[_0x8a79('0x23')](function(){return db[_0x8a79('0x118')]['findAll']({'where':{'teamId':{'$in':_0x18421b}}});})[_0x8a79('0x23')](function(_0x302e7d){var _0x343d0e=_['map'](_0x302e7d,function(_0x5579e4){return db[_0x8a79('0x119')][_0x8a79('0x80')]({'UserId':_0x582bee['id'],'VoicePrefixId':_0x5579e4[_0x8a79('0x11a')]},{'transaction':_0x35e1fb});});return Promise[_0x8a79('0x5d')](_0x343d0e);});});})[_0x8a79('0x23')](function(){for(var _0x35c44b=0x0;_0x35c44b<_0x52ee27[_0x8a79('0x54')];_0x35c44b++){var _0x3a144c=_0x52ee27[_0x35c44b][_0x8a79('0x116')](_0x8a79('0x9d'));var _0x959015=_0x3a144c+_0x8a79('0xaa');socket[_0x8a79('0xab')](_0x8a79('0x32')+_0x3a144c+_0x8a79('0xac'),{'UserId':_0x484729,['queueField']:_0x52ee27[_0x35c44b]['id']});}})[_0x8a79('0x23')](respondWithStatusCode(_0x1db6bd,null))[_0x8a79('0x5e')](APIHandleError(_0x1db6bd));};exports[_0x8a79('0x11b')]=function(_0x5b7d59,_0x1fb97c){var _0x3c7686=_0x5b7d59['params']['id'];var _0x29a658=null;if(_0x5b7d59[_0x8a79('0x4b')][_0x8a79('0x66')]){_0x29a658=_[_0x8a79('0x11c')](_0x5b7d59[_0x8a79('0x4b')][_0x8a79('0x66')])?_0x5b7d59[_0x8a79('0x4b')][_0x8a79('0x66')]:[_0x5b7d59[_0x8a79('0x4b')][_0x8a79('0x66')]];}var _0x32bc58=[];return Promise[_0x8a79('0x100')]()[_0x8a79('0x23')](function(){if(!_0x29a658)throw new APIBadRequestError(_0x8a79('0x11d'));})[_0x8a79('0x23')](function(){return db['User']['findOne']({'where':{'id':_0x3c7686}});})[_0x8a79('0x23')](function(_0x2ee7c3){if(!_0x2ee7c3)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x5b7d59[_0x8a79('0x60')]['id']));return db['sequelize'][_0x8a79('0xf6')](function(_0x2e282c){return _0x2ee7c3[_0x8a79('0x11b')](_0x29a658,{'transaction':_0x2e282c})[_0x8a79('0x23')](function(){return db[_0x8a79('0x110')]['findAll']({'where':{'id':{'$in':_0x29a658}}});})[_0x8a79('0x23')](function(_0x1b44e0){var _0x4aa21f=_['map'](_0x1b44e0,function(_0x422d4a){return _0x422d4a[_0x8a79('0x113')]();});return Promise[_0x8a79('0x5d')](_0x4aa21f);})[_0x8a79('0x23')](function(_0x53e69a){_0x32bc58=_[_0x8a79('0x114')](_0x53e69a);var _0x2a9916=_['map'](_0x32bc58,function(_0x3aa3a0){return _0x3aa3a0[_0x8a79('0x11e')](_0x2ee7c3['id'],{'transaction':_0x2e282c});});return Promise[_0x8a79('0x5d')](_0x2a9916);})[_0x8a79('0x23')](function(){if(!_0x2ee7c3['online'])return;var _0x31e2da=_[_0x8a79('0x36')](_0x32bc58,function(_0x1d7663){return _0x1d7663[_0x8a79('0x116')](_0x8a79('0x9d'))===_0x8a79('0x117');});var _0x318ff3=_['map'](_0x31e2da,function(_0x3c7a34){return db[_0x8a79('0xb2')][_0x8a79('0x3d')]({'where':{'VoiceQueueId':_0x3c7a34['id'],'UserId':_0x2ee7c3['id']},'transaction':_0x2e282c});});return Promise[_0x8a79('0x5d')](_0x318ff3);})[_0x8a79('0x23')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x29a658}}});})[_0x8a79('0x23')](function(_0x523b8c){var _0x2940d9=_['map'](_0x523b8c,function(_0x3f6858){return db[_0x8a79('0x119')][_0x8a79('0x3d')]({'where':{'UserId':_0x2ee7c3['id'],'VoicePrefixId':_0x3f6858[_0x8a79('0x11a')]}},{'transaction':_0x2e282c});});return Promise['all'](_0x2940d9);});});})['then'](function(){for(var _0x4212e8=0x0;_0x4212e8<_0x32bc58[_0x8a79('0x54')];_0x4212e8++){var _0x32f099=_0x32bc58[_0x4212e8][_0x8a79('0x116')](_0x8a79('0x9d'));var _0x4465d9=_0x32f099+_0x8a79('0xaa');socket[_0x8a79('0xab')](_0x8a79('0x32')+_0x32f099+_0x8a79('0xb6'),{'UserId':_0x3c7686,['queueField']:_0x32bc58[_0x4212e8]['id']});}})[_0x8a79('0x23')](respondWithStatusCode(_0x1fb97c,null))[_0x8a79('0x5e')](APIHandleError(_0x1fb97c));};exports['getLists']=function(_0x5c7e57,_0x41ecfb){var _0x17b4a5={};var _0x35346b={};var _0x3de8ad;var _0x42b650;return db[_0x8a79('0x3f')][_0x8a79('0x98')]({'where':{'id':_0x5c7e57[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x41ecfb,null))['then'](function(_0x2c6edb){if(_0x2c6edb){_0x3de8ad=_0x2c6edb;_0x35346b[_0x8a79('0xd1')]=_['keys'](db[_0x8a79('0x11f')][_0x8a79('0x40')]);_0x35346b[_0x8a79('0x4b')]=_[_0x8a79('0xd2')](_0x5c7e57[_0x8a79('0x4b')]);_0x35346b[_0x8a79('0xd4')]=_[_0x8a79('0xd5')](_0x35346b[_0x8a79('0xd1')],_0x35346b[_0x8a79('0x4b')]);_0x17b4a5['attributes']=_['intersection'](_0x35346b[_0x8a79('0xd1')],qs['fields'](_0x5c7e57[_0x8a79('0x4b')][_0x8a79('0xd6')]));_0x17b4a5[_0x8a79('0x51')]=_0x17b4a5[_0x8a79('0x51')][_0x8a79('0x54')]?_0x17b4a5['attributes']:_0x35346b[_0x8a79('0xd1')];_0x17b4a5[_0x8a79('0xd7')]=qs['sort'](_0x5c7e57['query'][_0x8a79('0xd8')]);_0x17b4a5[_0x8a79('0x4a')]=qs['filters'](_[_0x8a79('0xd9')](_0x5c7e57[_0x8a79('0x4b')],_0x35346b['filters']));if(_0x5c7e57[_0x8a79('0x4b')]['filter']){_0x17b4a5[_0x8a79('0x4a')]=_['merge'](_0x17b4a5[_0x8a79('0x4a')],{'$or':_[_0x8a79('0x38')](_0x17b4a5[_0x8a79('0x51')],function(_0x465e9c){var _0x592dd6={};_0x592dd6[_0x465e9c]={'$like':'%'+_0x5c7e57[_0x8a79('0x4b')][_0x8a79('0x36')]+'%'};return _0x592dd6;})});}_0x17b4a5=_[_0x8a79('0x61')]({},_0x17b4a5,_0x5c7e57[_0x8a79('0x62')]);return _0x3de8ad[_0x8a79('0x120')](_0x17b4a5);}})[_0x8a79('0x23')](function(_0x4d3743){if(_0x4d3743){_0x42b650=_0x4d3743[_0x8a79('0x54')];if(!_0x5c7e57['query'][_0x8a79('0xca')](_0x8a79('0xdc'))){_0x17b4a5[_0x8a79('0x1d')]=qs[_0x8a79('0x1d')](_0x5c7e57[_0x8a79('0x4b')][_0x8a79('0x1d')]);_0x17b4a5[_0x8a79('0x1b')]=qs[_0x8a79('0x1b')](_0x5c7e57[_0x8a79('0x4b')][_0x8a79('0x1b')]);}return _0x3de8ad['getLists'](_0x17b4a5);}})[_0x8a79('0x23')](function(_0x131c1e){if(_0x131c1e){return _0x131c1e?{'count':_0x42b650,'rows':_0x131c1e}:null;}})['then'](respondWithResult(_0x41ecfb,null))[_0x8a79('0x5e')](handleError(_0x41ecfb,null));};exports[_0x8a79('0x121')]=function(_0x117d66,_0x196d6d){var _0x4ce4d6={};var _0x4cbc89={};var _0xbb0e27;return db[_0x8a79('0x3f')][_0x8a79('0x98')]({'where':{'id':_0x117d66[_0x8a79('0x60')]['id']}})[_0x8a79('0x23')](handleEntityNotFound(_0x196d6d,null))[_0x8a79('0x23')](function(_0x278580){if(_0x278580){_0xbb0e27=_0x278580;_0x4cbc89[_0x8a79('0xd1')]=_[_0x8a79('0xd2')](db[_0x8a79('0x3f')]['rawAttributes']);_0x4cbc89['query']=_['keys'](_0x117d66[_0x8a79('0x4b')]);_0x4cbc89[_0x8a79('0xd4')]=_[_0x8a79('0xd5')](_0x4cbc89[_0x8a79('0xd1')],_0x4cbc89[_0x8a79('0x4b')]);_0x4ce4d6[_0x8a79('0x51')]=_[_0x8a79('0xd5')](_0x4cbc89[_0x8a79('0xd1')],qs[_0x8a79('0xd6')](_0x117d66['query']['fields']));_0x4ce4d6[_0x8a79('0x51')]=_0x4ce4d6[_0x8a79('0x51')]['length']?_0x4ce4d6[_0x8a79('0x51')]:_0x4cbc89['model'];_0x4ce4d6['order']=qs['sort'](_0x117d66[_0x8a79('0x4b')][_0x8a79('0xd8')]);_0x4ce4d6[_0x8a79('0x4a')]=qs['filters'](_[_0x8a79('0xd9')](_0x117d66[_0x8a79('0x4b')],_0x4cbc89['filters']));if(_0x117d66[_0x8a79('0x4b')]['filter']){_0x4ce4d6['where']=_[_0x8a79('0x61')](_0x4ce4d6[_0x8a79('0x4a')],{'$or':_['map'](_0x4ce4d6[_0x8a79('0x51')],function(_0x51d001){var _0x44eef6={};_0x44eef6[_0x51d001]={'$like':'%'+_0x117d66['query']['filter']+'%'};return _0x44eef6;})});}_0x4ce4d6['model']=db[_0x8a79('0x3f')];_0x4ce4d6['as']=_0x8a79('0x33');_0x4ce4d6=_[_0x8a79('0x61')]({},_0x4ce4d6,_0x117d66[_0x8a79('0x62')]);return _0xbb0e27['getVoiceQueues']({'include':[_0x4ce4d6]});}})[_0x8a79('0x23')](function(_0x556323){if(_0x556323){var _0x5e9d89={},_0x54befe=[];for(var _0x3d12c6=0x0;_0x3d12c6<_0x556323['length'];_0x3d12c6+=0x1){for(var _0x2a882c=0x0,_0x41d2f8;_0x2a882c<_0x556323[_0x3d12c6][_0x8a79('0x33')][_0x8a79('0x54')];_0x2a882c+=0x1){_0x41d2f8=_0x556323[_0x3d12c6][_0x8a79('0x33')][_0x2a882c][_0x8a79('0x2f')]({'plain':!![]});_0x5e9d89[_0x41d2f8['id']]=_0x41d2f8;}}_0x5e9d89=_[_0x8a79('0x122')](_0x5e9d89);for(var _0x508a2e=qs[_0x8a79('0x1b')](_0x117d66[_0x8a79('0x4b')]['offset']);_0x508a2e<_0x5e9d89['length']&&_0x54befe[_0x8a79('0x54')]=_0x275937){_0x381347=_0x275937;_0x5e85c2=0xc8;}else{_0x5e85c2=0xce;}_0x5539a6[_0xd129('0x16')](_0x5e85c2);return _0x5539a6[_0xd129('0x1d')](_0xd129('0x1e'),_0xb18501+'-'+_0x381347+'/'+_0x275937)[_0xd129('0x18')](_0x321939);}return null;};}function respondWithRpcPromise(_0x365ad5,_0x3f1547,_0x2575a5,_0x491b1a){return new Promise(function(_0x428122,_0x24c861){var _0x225d56=_0x491b1a||amiClient;return _0x225d56[_0xd129('0x1f')](_0x365ad5,_0x2575a5)[_0xd129('0x20')](function(_0x297638){logger[_0xd129('0x21')](_0xd129('0x22'),_0x3f1547,_0xd129('0x23'));logger[_0xd129('0x24')](_0xd129('0x25'),_0x3f1547,_0xd129('0x23'),JSON['stringify'](_0x297638));if(_0x297638['error']){if(_0x297638[_0xd129('0x26')][_0xd129('0x27')]===0x1f4){logger['error'](_0xd129('0x22'),_0x3f1547,_0x297638[_0xd129('0x26')][_0xd129('0x28')]);return _0x24c861(_0x297638[_0xd129('0x26')][_0xd129('0x28')]);}logger['error'](_0xd129('0x22'),_0x3f1547,_0x297638[_0xd129('0x26')]['message']);return _0x428122(_0x297638['error']['message']);}else{logger[_0xd129('0x21')](_0xd129('0x22'),_0x3f1547,_0xd129('0x23'));_0x428122(_0x297638[_0xd129('0x29')][_0xd129('0x28')]);}})['catch'](function(_0x1e334c){logger[_0xd129('0x26')](_0xd129('0x22'),_0x3f1547,_0x1e334c);_0x24c861(_0x1e334c);});});}function saveUpdates(_0x118a4c){return function(_0x4101f3){if(_0x4101f3){return _0x4101f3[_0xd129('0x2a')](_0x118a4c)[_0xd129('0x20')](function(_0x1173c5){if(_0x1173c5[_0xd129('0x2b')]==='agent'){socket[_0xd129('0x2c')](_0xd129('0x2d')+_0x1173c5['id'],_0x1173c5);}return _0x1173c5;});}return null;};}function removeEntity(_0x2c97b7,_0x3064c5){return function(_0x588056){if(_0x588056){return _0x588056[_0xd129('0x2e')]({'transaction':_0x3064c5})[_0xd129('0x20')](function(){var _0x5df7ce=_0x588056[_0xd129('0x2f')]({'plain':!![]});if(_0x5df7ce[_0xd129('0x2b')]===_0xd129('0x30'))return;var _0x1bbc7c=[{'name':_0xd129('0x31'),'value':_0xd129('0x32'),'ignore':!![]},{'name':_0xd129('0x33'),'value':_0xd129('0x34'),'ignore':![]},{'name':'Telephones','value':_0xd129('0x35'),'ignore':![]}];var _0x2f0d62=_(_0x1bbc7c)[_0xd129('0x36')](_0xd129('0x37'))['map']('value')['value']();if(_[_0xd129('0x38')](_0x2f0d62,_0x5df7ce[_0xd129('0x2b')])){return;}var _0x11f8c7=_[_0xd129('0x39')](_0x1bbc7c,[_0xd129('0x3a'),_0x5df7ce['role']])['name'];return db[_0xd129('0x3b')][_0xd129('0x2e')]({'where':{'type':_0x11f8c7,'resourceId':_0x5df7ce['id']},'transaction':_0x3064c5})['then'](function(){return _0x588056;});})[_0xd129('0x20')](function(){_0x2c97b7[_0xd129('0x16')](0xcc)[_0xd129('0x17')]();});}};}function handleEntityNotFound(_0x2f0664){return function(_0x1887eb){if(!_0x1887eb){_0x2f0664['sendStatus'](0x194);}return _0x1887eb;};}function handleError(_0x41fea1,_0x1f6b5){_0x1f6b5=_0x1f6b5||0x1f4;return function(_0x1207a9){logger['error'](_0x1207a9[_0xd129('0x3c')]);if(_0x1207a9['name']){delete _0x1207a9[_0xd129('0x3d')];}_0x41fea1[_0xd129('0x16')](_0x1f6b5)[_0xd129('0x3e')](_0x1207a9);};}function getUserAttributes(){return _(db['User'][_0xd129('0x3f')])[_0xd129('0x40')](function(_0x1f0b89){return{'name':_0x1f0b89[_0xd129('0x41')],'type':_0x1f0b89[_0xd129('0x42')][_0xd129('0x43')]};})['filter'](function(_0x56a9e7){return![_0xd129('0x44'),_0xd129('0x45'),_0xd129('0x46'),_0xd129('0x47'),_0xd129('0x48'),_0xd129('0x49')]['includes'](_0x56a9e7[_0xd129('0x3d')]);})['value']();}exports[_0xd129('0x4a')]=function(_0x2ff543,_0x1cf934){var _0x1d90f5={},_0xf28fac={'count':0x0,'rows':[]};var _0x4c25bc=getUserAttributes();_0x1d90f5=qs[_0xd129('0x4b')](_0x4c25bc,_0x2ff543);var _0x39797a={'where':_0x1d90f5[_0xd129('0x4c')]};return db[_0xd129('0x4d')][_0xd129('0x1c')](_0x39797a)[_0xd129('0x20')](function(_0x3a2822){_0xf28fac[_0xd129('0x1c')]=_0x3a2822;if(_0x2ff543[_0xd129('0x4e')][_0xd129('0x4f')]){_0x1d90f5[_0xd129('0x50')]=[{'all':!![]}];}if(_0x2ff543['query'][_0xd129('0x51')]===_0xd129('0x52')){_0x1d90f5['include']=[{'model':db[_0xd129('0x53')],'as':'userSetting'}];}if(!_[_0xd129('0x38')](_0x1d90f5[_0xd129('0x54')],'id')){_0x1d90f5[_0xd129('0x54')][_0xd129('0x55')]('id');}return db[_0xd129('0x4d')]['findAll'](_0x1d90f5);})[_0xd129('0x20')](function(_0x235759){_0xf28fac[_0xd129('0x56')]=_0x235759;if(_0x2ff543[_0xd129('0x4e')][_0xd129('0x57')]==='true'){var _0x304233=[];for(var _0x47556d=0x0;_0x47556d<_0xf28fac[_0xd129('0x56')][_0xd129('0x58')];_0x47556d++){_0x304233[_0xd129('0x55')](get_open_tabs(_0xd129('0x59'),_0xf28fac[_0xd129('0x56')][_0x47556d]['dataValues']));_0x304233[_0xd129('0x55')](get_open_tabs('sms',_0xf28fac['rows'][_0x47556d][_0xd129('0x5a')]));_0x304233[_0xd129('0x55')](get_open_tabs(_0xd129('0x5b'),_0xf28fac[_0xd129('0x56')][_0x47556d][_0xd129('0x5a')]));_0x304233['push'](get_open_tabs(_0xd129('0x5c'),_0xf28fac[_0xd129('0x56')][_0x47556d][_0xd129('0x5a')]));_0x304233[_0xd129('0x55')](get_open_tabs('openchannel',_0xf28fac['rows'][_0x47556d][_0xd129('0x5a')]));_0x304233['push'](get_open_tabs('whatsapp',_0xf28fac[_0xd129('0x56')][_0x47556d][_0xd129('0x5a')]));}return Promise[_0xd129('0x5d')](_0x304233)['then'](function(){return _0xf28fac;});}else{return _0xf28fac;}})[_0xd129('0x20')](respondWithFilteredResult(_0x1cf934,_0x1d90f5))[_0xd129('0x5e')](handleError(_0x1cf934,null));};exports[_0xd129('0x5f')]=function(_0x3b6c5e,_0x199d29){var _0xc0b92c=getUserAttributes();_0x3b6c5e['query']['id']=_0x3b6c5e[_0xd129('0x60')]['id'];var _0x4caafe=qs[_0xd129('0x4b')](_0xc0b92c,_0x3b6c5e);if(_0x3b6c5e[_0xd129('0x4e')][_0xd129('0x4f')]){_0x4caafe[_0xd129('0x50')]=[{'all':!![]}];}if(_0x3b6c5e[_0xd129('0x4e')][_0xd129('0x51')]===_0xd129('0x52')){_0x4caafe[_0xd129('0x50')]=[{'model':db[_0xd129('0x53')],'as':_0xd129('0x51')}];}_0x4caafe=_['merge']({},_0x4caafe,_0x3b6c5e[_0xd129('0x61')]);if(!_[_0xd129('0x38')](_0x4caafe[_0xd129('0x54')],'id')){_0x4caafe[_0xd129('0x54')]['push']('id');}return db[_0xd129('0x4d')][_0xd129('0x39')](_0x4caafe)[_0xd129('0x20')](handleEntityNotFound(_0x199d29,null))['then'](function(_0x273af4){var _0x5799ae=[];values=_0x273af4;if(_0x3b6c5e['query']['openTabs']===_0xd129('0x52')){_0x5799ae[_0xd129('0x55')](get_open_tabs('chat',_0x273af4[_0xd129('0x5a')]));_0x5799ae[_0xd129('0x55')](get_open_tabs(_0xd129('0x62'),_0x273af4[_0xd129('0x5a')]));_0x5799ae[_0xd129('0x55')](get_open_tabs(_0xd129('0x63'),_0x273af4['dataValues']));_0x5799ae['push'](get_open_tabs('whatsapp',_0x273af4[_0xd129('0x5a')]));_0x5799ae[_0xd129('0x55')](get_open_tabs(_0xd129('0x5b'),_0x273af4[_0xd129('0x5a')]));_0x5799ae[_0xd129('0x55')](get_open_tabs(_0xd129('0x5c'),_0x273af4[_0xd129('0x5a')]));return Promise['all'](_0x5799ae);}else{return values;}})[_0xd129('0x20')](function(){return values;})[_0xd129('0x20')](respondWithResult(_0x199d29,null))['catch'](handleError(_0x199d29,null));};exports['update']=function(_0x472446,_0x4ba27b){if(_0x472446[_0xd129('0x64')]['id']){delete _0x472446['body']['id'];}delete _0x472446['body'][_0xd129('0x2b')];return db[_0xd129('0x4d')][_0xd129('0x39')]({'where':{'id':_0x472446[_0xd129('0x60')]['id']}})[_0xd129('0x20')](handleEntityNotFound(_0x4ba27b,null))['then'](saveUpdates(_0x472446[_0xd129('0x64')],null))[_0xd129('0x20')](respondWithResult(_0x4ba27b,null))[_0xd129('0x5e')](handleError(_0x4ba27b,null));};exports['describe']=function(_0x42a54f,_0x3abc69){return db[_0xd129('0x4d')][_0xd129('0x65')]()['then'](respondWithResult(_0x3abc69,null))['catch'](handleError(_0x3abc69,null));};exports['addContacts']=function(_0x20d23d,_0x4e8bd0){return db[_0xd129('0x4d')][_0xd129('0x39')]({'where':{'id':_0x20d23d['params']['id']}})['then'](handleEntityNotFound(_0x4e8bd0,null))[_0xd129('0x20')](function(_0x2edcda){if(_0x2edcda){return _0x2edcda['addContacts'](_0x20d23d[_0xd129('0x64')][_0xd129('0x66')],_[_0xd129('0x67')](_0x20d23d[_0xd129('0x64')],[_0xd129('0x66'),'id'])||{});}})['then'](respondWithResult(_0x4e8bd0,null))['catch'](handleError(_0x4e8bd0,null));};function validateUser(_0x5a8d67){return new Promise(function(_0xedabdf,_0x539de9){if(_0x5a8d67[_0xd129('0x68')])return _0xedabdf(_0x5a8d67);return db[_0xd129('0x69')][_0xd129('0x6a')](0x1)[_0xd129('0x20')](function(_0x408622){if(_0x408622[_0xd129('0x6b')])authService[_0xd129('0x6c')](_0x5a8d67['password']);db['User'][_0xd129('0x6d')](_0xd129('0x68'))['then'](function(_0x47ec5c){if(_[_0xd129('0x6e')](_0x47ec5c)){_0x5a8d67['internal']=_0x408622[_0xd129('0x6f')]||0x1;return;}if(_[_0xd129('0x6e')](_0x408622[_0xd129('0x6f')])||_0x408622['min_internal']===_0x47ec5c){_0x5a8d67['internal']=_0x47ec5c+0x1;return;}if(_0x408622['min_internal']>_0x47ec5c){_0x5a8d67[_0xd129('0x68')]=_0x408622[_0xd129('0x6f')];return;}return db[_0xd129('0x70')]['query'](_0xd129('0x71'),{'type':db[_0xd129('0x70')][_0xd129('0x72')][_0xd129('0x73')]})[_0xd129('0x20')](function(_0x546208){if(_0x546208&&_0x546208[_0xd129('0x58')]){for(var _0x4b4cea=0x0,_0x27f09d=_0x546208[_0xd129('0x58')];_0x4b4cea<_0x27f09d&&_['isNil'](_0x5a8d67[_0xd129('0x68')]);_0x4b4cea++){if(_0x408622[_0xd129('0x6f')]<=_0x546208[_0x4b4cea][_0xd129('0x74')]){_0x5a8d67[_0xd129('0x68')]=_0x546208[_0x4b4cea][_0xd129('0x74')];}else if(_0x408622['min_internal']>_0x546208[_0x4b4cea][_0xd129('0x74')]&&_0x408622[_0xd129('0x6f')]<=_0x546208[_0x4b4cea]['to']){_0x5a8d67['internal']=_0x408622[_0xd129('0x6f')];}}}if(_['isNil'](_0x5a8d67[_0xd129('0x68')])){_0x5a8d67[_0xd129('0x68')]=_0x47ec5c+0x1;}return _0xedabdf(_0x5a8d67);});});})[_0xd129('0x5e')](function(_0x34a99e){_0x539de9(_0x34a99e);});});}function updateUser(_0x149c75){return new Promise(function(_0x29b8df,_0x146dbd){try{if(_0x149c75[_0xd129('0x75')]){_0x149c75[_0xd129('0x76')]=_0x149c75[_0xd129('0x68')];_0x149c75[_0xd129('0x77')]={'mailbox':_0x149c75[_0xd129('0x68')],'password':_0x149c75['password'],'fullname':_0x149c75[_0xd129('0x78')],'email':_0x149c75['email']};}if(_0x149c75[_0xd129('0x2b')]===_0xd129('0x34')){if(!_0x149c75[_0xd129('0x79')])_0x149c75[_0xd129('0x79')]=['101',_0xd129('0x7a'),_0xd129('0x7b'),_0xd129('0x7c'),_0xd129('0x7d'),_0xd129('0x7e'),'105',_0xd129('0x7f'),'107',_0xd129('0x80'),_0xd129('0x81'),'100',_0xd129('0x82'),'114',_0xd129('0x83')];}_0x29b8df(_0x149c75);}catch(_0x2cf23c){_0x146dbd(_0x2cf23c);}});}exports['create']=function(_0x1902d1,_0x9325df){if(_0x1902d1[_0xd129('0x32')][_0xd129('0x2b')]==='agent')throw new Error(_0xd129('0x84'));if(_0x1902d1[_0xd129('0x64')]['role']===_0xd129('0x32')&&_0x1902d1[_0xd129('0x32')][_0xd129('0x2b')]!=='admin'){throw new Error(_0xd129('0x85'));}if(_0x1902d1[_0xd129('0x64')][_0xd129('0x2b')]==='admin'&&_0x1902d1['user'][_0xd129('0x2b')]!=='admin'){throw new Error(_0xd129('0x86'));}return licenseUtil[_0xd129('0x87')]([_0x1902d1['body']])['then'](function(){return validateUser(_0x1902d1[_0xd129('0x64')]);})['then'](function(_0x2e63dd){return updateUser(_0x2e63dd)['then'](function(_0x3c23dc){if(_0x3c23dc[_0xd129('0x2b')]===_0xd129('0x30')){_0x3c23dc[_0xd129('0x88')]=_0x1902d1[_0xd129('0x32')]['settingsEnabled'];delete _0x3c23dc['userProfileId'];}return _0x3c23dc;});})[_0xd129('0x20')](function(_0x1f071e){return db['User'][_0xd129('0x89')](_0x1f071e,{'include':[{'model':db[_0xd129('0x77')],'as':_0xd129('0x77')}]});})[_0xd129('0x20')](function(_0x1bbe03){if(_0x1902d1[_0xd129('0x64')][_0xd129('0x2b')]===_0xd129('0x32'))return _0x1bbe03;if(_0x1902d1[_0xd129('0x32')]['role']!==_0xd129('0x32'))return _0x1bbe03;return db['UserProfileSection'][_0xd129('0x39')]({'where':{'name':_0x1bbe03[_0xd129('0x2b')]==='agent'?_0xd129('0x33'):_0xd129('0x8a'),'userProfileId':_0x1902d1[_0xd129('0x32')][_0xd129('0x8b')]},'raw':!![]})[_0xd129('0x20')](function(_0xbabdfd){if(!_0xbabdfd||_0xbabdfd[_0xd129('0x8c')]!=0x0)return _0x1bbe03;return db[_0xd129('0x3b')][_0xd129('0x89')]({'name':_0x1bbe03['name'],'resourceId':_0x1bbe03['id'],'type':_0xbabdfd[_0xd129('0x3d')],'sectionId':_0xbabdfd['id']},{})[_0xd129('0x20')](function(){return _0x1bbe03;});})[_0xd129('0x5e')](function(_0x2754bc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2754bc);throw _0x2754bc;});})[_0xd129('0x20')](respondWithResult(_0x9325df,0xc9))[_0xd129('0x5e')](handleError(_0x9325df,null));};exports[_0xd129('0x8d')]=function(_0x38a0e8,_0x57c9e0){var _0x14b1ec=_0x38a0e8['body'];var _0x5b5273=[];if(_0x38a0e8[_0xd129('0x32')][_0xd129('0x2b')]==='agent')throw new Error(_0xd129('0x84'));if(_[_0xd129('0x8e')](_0x14b1ec,[_0xd129('0x2b'),_0xd129('0x32')])&&_0x38a0e8[_0xd129('0x32')][_0xd129('0x2b')]!=='admin'){throw new Error(_0xd129('0x85'));}if(_[_0xd129('0x8e')](_0x14b1ec,[_0xd129('0x2b'),_0xd129('0x30')])&&_0x38a0e8['user']['role']!==_0xd129('0x30')){throw new Error(_0xd129('0x8f'));}return licenseUtil[_0xd129('0x87')](_0x14b1ec)[_0xd129('0x20')](function(){return validateUser(_0x14b1ec[0x0]);})[_0xd129('0x20')](function(){for(var _0x4eace8=0x1;_0x4eace8<_0x14b1ec[_0xd129('0x58')];_0x4eace8++){var _0x54803c=_0x14b1ec[_0x4eace8-0x1][_0xd129('0x68')];if(!_0x14b1ec[_0x4eace8]['internal'])_0x14b1ec[_0x4eace8][_0xd129('0x68')]=_0x54803c+0x1;_0x5b5273[_0xd129('0x55')](validateUser(_0x14b1ec[_0x4eace8]));}return Promise['all'](_0x5b5273);})[_0xd129('0x20')](function(){_0x5b5273=[];for(var _0x4ed138=0x0;_0x4ed138<_0x14b1ec[_0xd129('0x58')];_0x4ed138++){_0x5b5273[_0xd129('0x55')](updateUser(_0x14b1ec[_0x4ed138]));}return Promise[_0xd129('0x5d')](_0x5b5273);})['then'](function(){_0x5b5273=_0x14b1ec[_0xd129('0x40')](function(_0x324259){return db['User'][_0xd129('0x89')](_0x324259,{'include':[{'model':db['VoiceMail'],'as':_0xd129('0x77')}]})[_0xd129('0x20')](function(_0x45541e){_0x324259['id']=_0x45541e['id'];return _0x324259;});});return Promise[_0xd129('0x5d')](_0x5b5273);})[_0xd129('0x20')](function(_0x1fd58d){if(_0x38a0e8[_0xd129('0x64')]['role']===_0xd129('0x32'))return _0x1fd58d;if(_0x38a0e8[_0xd129('0x32')]['role']!==_0xd129('0x32'))return _0x1fd58d;var _0x49914d=_[_0xd129('0x8e')](_0x1fd58d,function(_0x2e75d5){return _0x2e75d5[_0xd129('0x2b')]===_0xd129('0x34')||_0x2e75d5[_0xd129('0x2b')]===_0xd129('0x35');});if(!_0x49914d)return _0x1fd58d;return db[_0xd129('0x90')]['findAll']({'where':{'name':{'$or':[_0xd129('0x33'),_0xd129('0x8a')]},'userProfileId':_0x38a0e8[_0xd129('0x32')][_0xd129('0x8b')]},'raw':!![]})[_0xd129('0x20')](function(_0xcfba8){if(_['isEmpty'](_0xcfba8)||!_[_0xd129('0x8e')](_0xcfba8,[_0xd129('0x8c'),0x0]))return _0x1fd58d;_0x5b5273=[];var _0x2c4957=_(_0xcfba8)[_0xd129('0x40')](function(_0x2d7a58){if(_0x2d7a58['autoAssociation']===0x1)return;return _0x2d7a58[_0xd129('0x3d')]==='Agents'?'agent':_0xd129('0x35');})[_0xd129('0x91')]()[_0xd129('0x3a')]();for(var _0x4e7f0d=0x0;_0x4e7f0d<_0x1fd58d[_0xd129('0x58')];_0x4e7f0d++){if(!_['includes'](_0x2c4957,_0x1fd58d[_0x4e7f0d][_0xd129('0x2b')]))return;var _0x1548b4=_0x1fd58d[_0x4e7f0d]['role']===_0xd129('0x34')?_0xd129('0x33'):_0xd129('0x8a');_0x5b5273['push'](db[_0xd129('0x3b')]['create']({'name':_0x1fd58d[_0x4e7f0d][_0xd129('0x3d')],'resourceId':_0x1fd58d[_0x4e7f0d]['id'],'type':_0x1548b4,'sectionId':_[_0xd129('0x39')](_0xcfba8,[_0xd129('0x3d'),_0x1548b4])['id']},{}));}return Promise['all'](_0x5b5273);});})[_0xd129('0x20')](respondWithResult(_0x57c9e0,0xc9))[_0xd129('0x5e')](handleError(_0x57c9e0,null));};exports[_0xd129('0x92')]=function(_0x222315,_0x37dd20){if(_0x222315['body']['id']){delete _0x222315[_0xd129('0x64')]['id'];}return db[_0xd129('0x4d')][_0xd129('0x39')]({'where':{'id':_0x222315[_0xd129('0x60')]['id']}})['then'](function(_0x4390e7){if(!_0x4390e7)return null;if(_0x4390e7['id']===_0x222315['user']['id']){if(!_0x222315['body'][_0xd129('0x93')]||!_0x222315[_0xd129('0x64')][_0xd129('0x94')]){throw new db['Sequelize'][(_0xd129('0x95'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4390e7[_0xd129('0x96')](_0x222315[_0xd129('0x64')][_0xd129('0x93')])){throw new db[(_0xd129('0x97'))][(_0xd129('0x95'))](_0xd129('0x98'));}if(_0x222315[_0xd129('0x64')][_0xd129('0x93')]===_0x222315[_0xd129('0x64')]['newPassword']){throw new db[(_0xd129('0x97'))][(_0xd129('0x95'))](_0xd129('0x99'));}}else if(_0x222315[_0xd129('0x32')][_0xd129('0x2b')]===_0xd129('0x30')){if(!_0x222315[_0xd129('0x64')][_0xd129('0x94')]){throw new db[(_0xd129('0x97'))][(_0xd129('0x95'))](_0xd129('0x9a'));}}else if(_0x222315['user']['role']===_0xd129('0x32')){if(!_0x222315[_0xd129('0x64')][_0xd129('0x94')]){throw new db[(_0xd129('0x97'))][(_0xd129('0x95'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x4390e7['role']!==_0xd129('0x34')){throw new db[(_0xd129('0x97'))][(_0xd129('0x95'))](_0xd129('0x84'));}}else{throw new db['Sequelize'][(_0xd129('0x95'))](_0xd129('0x84'));}return _0x4390e7;})[_0xd129('0x20')](handleEntityNotFound(_0x37dd20,null))[_0xd129('0x20')](function(_0x2bee54){return db[_0xd129('0x69')][_0xd129('0x9b')]({'attributes':['id','securePassword',_0xd129('0x9c'),_0xd129('0x9d')]})[_0xd129('0x20')](function(_0xe378e2){if(_0xe378e2['securePassword'])authService[_0xd129('0x6c')](_0x222315['body']['newPassword']);if(!_0xe378e2[_0xd129('0x9c')]||!_0x2bee54[_0xd129('0x46')])return _0x2bee54;authService['validatePasswordHistory'](_0x222315[_0xd129('0x64')]['newPassword'],_0x2bee54[_0xd129('0x46')],_0xe378e2[_0xd129('0x9d')]);return _0x2bee54;})[_0xd129('0x20')](saveUpdates({'password':_0x222315[_0xd129('0x64')][_0xd129('0x94')],'passwordResetAt':_0x222315[_0xd129('0x32')]['id']==_0x222315[_0xd129('0x60')]['id']?moment():null,'previousPasswords':authService[_0xd129('0x9e')](_0x222315[_0xd129('0x64')][_0xd129('0x94')],_0x2bee54[_0xd129('0x46')])},null));})['then'](respondWithResult(_0x37dd20,null))['catch'](handleError(_0x37dd20,null));};exports[_0xd129('0x9f')]=function(_0x5b07e6,_0x43e4f0){var _0xf15213=_0x5b07e6[_0xd129('0x64')][_0xd129('0xa0')];return db[_0xd129('0x4d')]['find']({'where':{'id':_0x5b07e6[_0xd129('0x60')]['id']},'attributes':['id',_0xd129('0x3d'),'role',_0xd129('0xa1'),'loginInPause',_0xd129('0xa2'),_0xd129('0xa3')]})['then'](handleEntityNotFound(_0x43e4f0,null))['then'](function(_0x5e6d01){if(_0x5e6d01){if(!utils[_0xd129('0xa4')](_0xf15213)){throw new db[(_0xd129('0x97'))]['ValidationError']('Unknown\x20channel');}return _0x5e6d01[_0xd129('0xa5')+_[_0xd129('0xa6')](_0xf15213[_0xd129('0xa7')]())+_0xd129('0xa8')](_0x5b07e6[_0xd129('0x64')][_0xd129('0x66')],{'penalty':_0x5b07e6[_0xd129('0x64')][_0xd129('0xa9')]||0x0})[_0xd129('0xaa')](function(_0x45ea68){for(var _0x5692e0=0x0;_0x5692e0<_0x5b07e6[_0xd129('0x64')][_0xd129('0x66')][_0xd129('0x58')];_0x5692e0+=0x1){var _0x594747={'UserId':Number(_0x5b07e6[_0xd129('0x60')]['id'])};_0x594747[_[_0xd129('0xa6')](_0xf15213[_0xd129('0xa7')]())+_0xd129('0xab')]=Number(_0x5b07e6[_0xd129('0x64')]['ids'][_0x5692e0]);socket[_0xd129('0x2c')]('user'+_[_0xd129('0xa6')](_0xf15213[_0xd129('0xa7')]())+'Queue:save',_0x594747);}return _0x45ea68;})[_0xd129('0x20')](function(){if(_0xf15213===_0xd129('0xac')){return db['VoiceQueue'][_0xd129('0xad')]({'where':{'id':_0x5b07e6[_0xd129('0x64')][_0xd129('0x66')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xd129('0x20')](function(_0x2ed8d6){var _0xe206dc=_0x5e6d01[_0xd129('0x2f')]({'plain':!![]});var _0x2c1b9f=[];if(_0xf15213===_0xd129('0xac')&&_0xe206dc[_0xd129('0x2b')]==='agent'&&_0xe206dc[_0xd129('0xa1')]){for(let _0x152d20=0x0;_0x152d20<_0x2ed8d6['length'];_0x152d20+=0x1){_0x2c1b9f[_0xd129('0x55')]({'membername':_0xe206dc[_0xd129('0x3d')],'UserId':_0xe206dc['id'],'queue_name':_0x2ed8d6[_0x152d20]['name'],'VoiceQueueId':_0x2ed8d6[_0x152d20]['id'],'interface':_[_0xd129('0x6e')](_0xe206dc[_0xd129('0xa3')])?util[_0xd129('0xae')](_0xd129('0xaf'),_0xe206dc[_0xd129('0x3d')]):_0xe206dc[_0xd129('0xa3')],'paused':_0xe206dc[_0xd129('0xa2')]||![],'penalty':_0x5b07e6[_0xd129('0x64')][_0xd129('0xa9')]||0x0});}return Promise[_0xd129('0x5d')](_0x2c1b9f[_0xd129('0x40')](function(_0xa77182){return db[_0xd129('0xb0')][_0xd129('0xb1')](_0xa77182);}));}return _0x5e6d01;});}})[_0xd129('0x20')](respondWithStatusCode(_0x43e4f0,null))['catch'](handleError(_0x43e4f0,null));};exports[_0xd129('0xb2')]=function(_0x6864f1,_0x205432){var _0x40be82,_0x1f28a2;return db['User'][_0xd129('0x39')]({'where':{'id':_0x6864f1['params']['id']},'attributes':['id',_0xd129('0x3d'),_0xd129('0x2b')]})[_0xd129('0x20')](handleEntityNotFound(_0x205432,null))[_0xd129('0x20')](function(_0x1a0575){if(_0x1a0575){_0x40be82=_0x1a0575;if(!_0x6864f1[_0xd129('0x4e')][_0xd129('0xa0')]||!utils[_0xd129('0xa4')](_0x6864f1[_0xd129('0x4e')][_0xd129('0xa0')])){throw new db[(_0xd129('0x97'))][(_0xd129('0x95'))](_0xd129('0xb3'));}return _0x1a0575[_0xd129('0xb4')+_[_0xd129('0xa6')](_0x6864f1['query'][_0xd129('0xa0')][_0xd129('0xa7')]())+_0xd129('0xa8')](_0x6864f1[_0xd129('0x4e')]['ids']);}})['then'](function(_0xca4f18){if(_[_0xd129('0xb5')](_0x6864f1['query'][_0xd129('0x66')])){for(var _0xcb4ed9=0x0;_0xcb4ed9<_0x6864f1[_0xd129('0x4e')][_0xd129('0x66')][_0xd129('0x58')];_0xcb4ed9+=0x1){_0x1f28a2={'UserId':Number(_0x6864f1['params']['id'])};_0x1f28a2[_[_0xd129('0xa6')](_0x6864f1['query'][_0xd129('0xa0')]['toLowerCase']())+_0xd129('0xab')]=Number(_0x6864f1[_0xd129('0x4e')][_0xd129('0x66')][_0xcb4ed9]);socket[_0xd129('0x2c')]('user'+_[_0xd129('0xa6')](_0x6864f1[_0xd129('0x4e')]['channel']['toLowerCase']())+_0xd129('0xb6'),_0x1f28a2);}}else{_0x1f28a2={'UserId':Number(_0x6864f1[_0xd129('0x60')]['id'])};_0x1f28a2[_['capitalize'](_0x6864f1[_0xd129('0x4e')][_0xd129('0xa0')][_0xd129('0xa7')]())+_0xd129('0xab')]=Number(_0x6864f1[_0xd129('0x4e')]['ids']);socket[_0xd129('0x2c')]('user'+_[_0xd129('0xa6')](_0x6864f1['query']['channel'][_0xd129('0xa7')]())+_0xd129('0xb6'),_0x1f28a2);}return _0xca4f18;})[_0xd129('0x20')](function(){if(_0x6864f1['query']['channel']===_0xd129('0xac')){return db[_0xd129('0xb0')][_0xd129('0x2e')]({'where':{'UserId':_0x6864f1[_0xd129('0x60')]['id'],'VoiceQueueId':_0x6864f1[_0xd129('0x4e')][_0xd129('0x66')]},'individualHooks':!![]})[_0xd129('0x20')](function(){return _0x40be82;});}return _0x40be82;})['then'](respondWithStatusCode(_0x205432,null))[_0xd129('0x5e')](handleError(_0x205432,null));};exports['addAvatar']=function(_0x4f5c91,_0x476f5b){_0x4f5c91['body'][_0xd129('0xb7')]=_0x4f5c91[_0xd129('0xb8')][_0xd129('0xb9')];return db[_0xd129('0x4d')][_0xd129('0x39')]({'where':{'id':_0x4f5c91[_0xd129('0x60')]['id']}})['then'](handleEntityNotFound(_0x476f5b,null))[_0xd129('0x20')](saveUpdates(_0x4f5c91[_0xd129('0x64')],null))[_0xd129('0x20')](respondWithResult(_0x476f5b,null))[_0xd129('0x5e')](handleError(_0x476f5b,null));};exports[_0xd129('0xba')]=function(_0x3e10d7,_0x5880ac){var _0x39e922=path[_0xd129('0xbb')](config[_0xd129('0xbc')],_0xd129('0xbd'));return db[_0xd129('0x4d')]['find']({'where':{'id':_0x3e10d7['params']['id']},'attributes':['id',_0xd129('0xb7')],'raw':!![]})['then'](handleEntityNotFound(_0x5880ac,null))[_0xd129('0x20')](function(_0x3ea72c){if(_0x3ea72c){if(_[_0xd129('0x6e')](_0x3ea72c[_0xd129('0xb7')])){return _0x5880ac['download'](_0x39e922);}else{if(!fs[_0xd129('0xbe')](path[_0xd129('0xbb')](config['root'],'server/files/images/',_0x3ea72c[_0xd129('0xb7')]))){return _0x5880ac['download'](_0x39e922);}return _0x5880ac[_0xd129('0xbf')](path[_0xd129('0xbb')](config[_0xd129('0xbc')],'server/files/images/',_0x3ea72c[_0xd129('0xb7')]));}}})[_0xd129('0x5e')](handleError(_0x5880ac,null));};exports[_0xd129('0xc0')]=function(_0x1aa1aa,_0x3ce5e1){return db['User'][_0xd129('0x39')]({'where':{'id':_0x1aa1aa[_0xd129('0x60')]['id']},'attributes':['id']})[_0xd129('0x20')](handleEntityNotFound(_0x3ce5e1,null))[_0xd129('0x20')](function(_0x3d97e4){var _0xbf8058=[];values=_0x3d97e4[_0xd129('0x5a')];_0xbf8058[_0xd129('0x55')](get_open_tabs(_0xd129('0x59'),_0x3d97e4[_0xd129('0x5a')]));_0xbf8058['push'](get_open_tabs(_0xd129('0x62'),_0x3d97e4[_0xd129('0x5a')]));_0xbf8058[_0xd129('0x55')](get_open_tabs('openchannel',_0x3d97e4[_0xd129('0x5a')]));_0xbf8058[_0xd129('0x55')](get_open_tabs(_0xd129('0xc1'),_0x3d97e4[_0xd129('0x5a')]));_0xbf8058[_0xd129('0x55')](get_open_tabs('fax',_0x3d97e4[_0xd129('0x5a')]));_0xbf8058[_0xd129('0x55')](get_open_tabs(_0xd129('0x5c'),_0x3d97e4[_0xd129('0x5a')]));return Promise['all'](_0xbf8058);})['then'](function(_0x5b4356){if(_0x5b4356){var _0x196029=_[_0xd129('0x40')](values[_0xd129('0xc2')],function(_0x5a895c){return{'channel':_0xd129('0xc3'),'id':_0x5a895c['id'],'createdAt':_0x5a895c[_0xd129('0xc4')]};});var _0x2d2add=_[_0xd129('0x40')](values[_0xd129('0xc5')],function(_0x5478a6){return{'channel':_0xd129('0xc6'),'id':_0x5478a6['id'],'createdAt':_0x5478a6['createdAt']};});var _0x51171a=_[_0xd129('0x40')](values[_0xd129('0xc7')],function(_0x47120b){return{'channel':_0xd129('0xc8'),'id':_0x47120b['id'],'createdAt':_0x47120b[_0xd129('0xc4')]};});var _0x6c236f=_[_0xd129('0x40')](values['MailOpenTabs'],function(_0x2257b1){return{'channel':'MAIL','id':_0x2257b1['id'],'createdAt':_0x2257b1['createdAt']};});var _0x1c1728=_['map'](values[_0xd129('0xc9')],function(_0x313829){return{'channel':'SMS','id':_0x313829['id'],'createdAt':_0x313829[_0xd129('0xc4')]};});var _0x2bd170=_[_0xd129('0x40')](values[_0xd129('0xca')],function(_0x424e1b){return{'channel':'WHATSAPP','id':_0x424e1b['id'],'createdAt':_0x424e1b[_0xd129('0xc4')]};});var _0x45391a=_[_0xd129('0xcb')](_0x196029,_0x2d2add,_0x51171a,_0x6c236f,_0x1c1728,_0x2bd170);var _0x286ed8={'count':_0x45391a[_0xd129('0x58')],'rows':_0x45391a};return _0x286ed8;}else return null;})[_0xd129('0x20')](respondWithResult(_0x3ce5e1,null))[_0xd129('0x5e')](handleError(_0x3ce5e1,null));};exports[_0xd129('0xcc')]=function(_0x5a6c1e,_0x1b0d8d){var _0x25aef={};return db[_0xd129('0x4d')]['findOne']({'where':{'id':_0x5a6c1e[_0xd129('0x60')]['id']}})[_0xd129('0x20')](function(_0x2438b7){if(!_0x2438b7){throw new APINotFoundError(util[_0xd129('0xae')](_0xd129('0xcd'),_0x5a6c1e[_0xd129('0x60')]['id']));}return contacts[_0xd129('0x65')]();})[_0xd129('0x20')](function(_0x3b2b95){_0x5a6c1e[_0xd129('0x4e')][_0xd129('0x4d')]=_0x5a6c1e[_0xd129('0x60')]['id'];_0x25aef=qs['getOptions'](_0x3b2b95,_0x5a6c1e);if(_0x5a6c1e[_0xd129('0x4e')][_0xd129('0xce')]('includeAll')){_0x25aef['include']=[{'model':db[_0xd129('0xcf')],'as':_0xd129('0xd0'),'required':![]},{'model':db[_0xd129('0xd1')],'as':_0xd129('0xd2'),'attributes':['id',_0xd129('0x3d'),'color'],'where':_0x5a6c1e[_0xd129('0x4e')]['tag']?{'id':_0x5a6c1e[_0xd129('0x4e')][_0xd129('0xd3')]}:undefined,'required':_0x5a6c1e['query']['tag']?!![]:![]}];}return contacts[_0xd129('0xad')](_0x5a6c1e['query'],_0x5a6c1e[_0xd129('0x32')],_0x25aef,_0x3b2b95);})[_0xd129('0x20')](respondWithFilteredResult(_0x1b0d8d,_0x25aef))[_0xd129('0x5e')](APIHandleError(_0x1b0d8d));};exports['getQueues']=function(_0x5ab4e3,_0x37d1ed){var _0x2768d5;var _0x810e1d={};var _0x5e8b2c;return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x5ab4e3[_0xd129('0x60')]['id']},'attributes':['id','name',_0xd129('0x2b')]})[_0xd129('0x20')](handleEntityNotFound(_0x37d1ed,null))['then'](function(_0x1aa816){if(!utils['isValidChannel'](_0x5ab4e3[_0xd129('0x4e')]['channel'])){throw new db[(_0xd129('0x97'))][(_0xd129('0x95'))]('Unknown\x20channel');}_0x2768d5=_0x1aa816;var _0x231607={};_0x231607['model']=_[_0xd129('0xd4')](db[_[_0xd129('0xa6')](_0x5ab4e3['query']['channel'])+'Queue'][_0xd129('0x3f')]);_0x231607[_0xd129('0x4e')]=_[_0xd129('0xd4')](_0x5ab4e3[_0xd129('0x4e')]);_0x231607[_0xd129('0xd5')]=_['intersection'](_0x231607[_0xd129('0xd6')],_0x231607[_0xd129('0x4e')]);_0x810e1d[_0xd129('0x54')]=_[_0xd129('0xd7')](_0x231607['model'],qs[_0xd129('0xd8')](_0x5ab4e3[_0xd129('0x4e')][_0xd129('0xd8')]));_0x810e1d['attributes']=_0x810e1d[_0xd129('0x54')]['length']?_0x810e1d[_0xd129('0x54')]:_0x231607[_0xd129('0xd6')];_0x810e1d[_0xd129('0xd9')]=qs[_0xd129('0xda')](_0x5ab4e3[_0xd129('0x4e')][_0xd129('0xda')]);_0x810e1d[_0xd129('0x4c')]=qs[_0xd129('0xd5')](_[_0xd129('0xdb')](_0x5ab4e3[_0xd129('0x4e')],_0x231607[_0xd129('0xd5')]));if(_0x5ab4e3[_0xd129('0x4e')][_0xd129('0x36')]){_0x810e1d[_0xd129('0x4c')]=_[_0xd129('0xdc')](_0x810e1d[_0xd129('0x4c')],{'$or':_['map'](_0x810e1d[_0xd129('0x54')],function(_0x12d202){var _0x238a7e={};_0x238a7e[_0x12d202]={'$like':'%'+_0x5ab4e3[_0xd129('0x4e')][_0xd129('0x36')]+'%'};return _0x238a7e;})});}_0x810e1d=_[_0xd129('0xdc')]({},_0x810e1d,_0x5ab4e3[_0xd129('0x61')]);switch(_0x2768d5[_0xd129('0x2b')]){case _0xd129('0x30'):return db[_[_0xd129('0xa6')](_0x5ab4e3[_0xd129('0x4e')][_0xd129('0xa0')])+_0xd129('0xdd')][_0xd129('0xad')](_0x810e1d);case _0xd129('0x32'):case _0xd129('0x34'):return _0x2768d5['get'+_[_0xd129('0xa6')](_0x5ab4e3[_0xd129('0x4e')][_0xd129('0xa0')])+_0xd129('0xa8')](_0x810e1d);default:throw new db['Sequelize']['ValidationError'](_0xd129('0xde'));}})[_0xd129('0x20')](function(_0x8a74f3){_0x5e8b2c=_0x8a74f3[_0xd129('0x58')];if(!_0x5ab4e3[_0xd129('0x4e')][_0xd129('0xce')]('nolimit')){_0x810e1d[_0xd129('0x1b')]=qs[_0xd129('0x1b')](_0x5ab4e3[_0xd129('0x4e')]['limit']);_0x810e1d[_0xd129('0x19')]=qs[_0xd129('0x19')](_0x5ab4e3[_0xd129('0x4e')][_0xd129('0x19')]);}switch(_0x2768d5[_0xd129('0x2b')]){case'admin':return db[_[_0xd129('0xa6')](_0x5ab4e3[_0xd129('0x4e')]['channel'])+_0xd129('0xdd')][_0xd129('0xad')](_0x810e1d);case'user':case'agent':return _0x2768d5['get'+_['capitalize'](_0x5ab4e3[_0xd129('0x4e')][_0xd129('0xa0')])+'Queues'](_0x810e1d);}})[_0xd129('0x20')](function(_0xbbfe14){return{'count':_0x5e8b2c,'rows':_0xbbfe14};})['then'](respondWithResult(_0x37d1ed,null))[_0xd129('0x5e')](handleError(_0x37d1ed,null));};exports[_0xd129('0xdf')]=function(_0x22b916,_0x5d5aa7){var _0xa23a58={};var _0x495a5e={};var _0x1e8b2d;var _0x2377fc;return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x22b916[_0xd129('0x60')]['id']}})['then'](handleEntityNotFound(_0x5d5aa7,null))[_0xd129('0x20')](function(_0x4af054){if(_0x4af054){_0x1e8b2d=_0x4af054;_0x495a5e[_0xd129('0xd6')]=_[_0xd129('0xd4')](db[_0xd129('0xb0')][_0xd129('0x3f')]);_0x495a5e[_0xd129('0x4e')]=_[_0xd129('0xd4')](_0x22b916['query']);_0x495a5e[_0xd129('0xd5')]=_['intersection'](_0x495a5e[_0xd129('0xd6')],_0x495a5e['query']);_0xa23a58[_0xd129('0x54')]=_[_0xd129('0xd7')](_0x495a5e['model'],qs[_0xd129('0xd8')](_0x22b916[_0xd129('0x4e')]['fields']));_0xa23a58[_0xd129('0x54')]=_0xa23a58[_0xd129('0x54')][_0xd129('0x58')]?_0xa23a58[_0xd129('0x54')]:_0x495a5e[_0xd129('0xd6')];_0xa23a58['order']=qs[_0xd129('0xda')](_0x22b916[_0xd129('0x4e')][_0xd129('0xda')]);_0xa23a58[_0xd129('0x4c')]=qs[_0xd129('0xd5')](_['pick'](_0x22b916[_0xd129('0x4e')],_0x495a5e[_0xd129('0xd5')]));if(_0x22b916['query'][_0xd129('0x36')]){_0xa23a58[_0xd129('0x4c')]=_['merge'](_0xa23a58[_0xd129('0x4c')],{'$or':_[_0xd129('0x40')](_0xa23a58['attributes'],function(_0x3a175b){var _0x3fc7e8={};_0x3fc7e8[_0x3a175b]={'$like':'%'+_0x22b916[_0xd129('0x4e')][_0xd129('0x36')]+'%'};return _0x3fc7e8;})});}_0xa23a58=_[_0xd129('0xdc')]({},_0xa23a58,_0x22b916[_0xd129('0x61')]);return _0x1e8b2d[_0xd129('0xdf')](_0xa23a58);}})[_0xd129('0x20')](function(_0xe00928){if(_0xe00928){_0x2377fc=_0xe00928[_0xd129('0x58')];if(!_0x22b916[_0xd129('0x4e')][_0xd129('0xce')](_0xd129('0xe0'))){_0xa23a58['limit']=qs['limit'](_0x22b916[_0xd129('0x4e')]['limit']);_0xa23a58[_0xd129('0x19')]=qs[_0xd129('0x19')](_0x22b916[_0xd129('0x4e')][_0xd129('0x19')]);}return _0x1e8b2d['getVoiceQueuesRt'](_0xa23a58);}})[_0xd129('0x20')](function(_0x43cf7d){if(_0x43cf7d){return _0x43cf7d?{'count':_0x2377fc,'rows':_0x43cf7d}:null;}})[_0xd129('0x20')](respondWithResult(_0x5d5aa7,null))['catch'](handleError(_0x5d5aa7,null));};exports[_0xd129('0xe1')]=function(_0x55be50,_0x96f90c){var _0x3d4876={};var _0xbb45f={};var _0x4dd18d;var _0x3f502a;return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x55be50[_0xd129('0x60')]['id']}})['then'](handleEntityNotFound(_0x96f90c,null))[_0xd129('0x20')](function(_0x2d0e15){if(_0x2d0e15){_0x4dd18d=_0x2d0e15;_0xbb45f['model']=_[_0xd129('0xd4')](db[_0xd129('0xe2')][_0xd129('0x3f')]);_0xbb45f[_0xd129('0x4e')]=_['keys'](_0x55be50['query']);_0xbb45f[_0xd129('0xd5')]=_[_0xd129('0xd7')](_0xbb45f[_0xd129('0xd6')],_0xbb45f['query']);_0x3d4876[_0xd129('0x54')]=_['intersection'](_0xbb45f[_0xd129('0xd6')],qs['fields'](_0x55be50[_0xd129('0x4e')][_0xd129('0xd8')]));_0x3d4876[_0xd129('0x54')]=_0x3d4876[_0xd129('0x54')][_0xd129('0x58')]?_0x3d4876[_0xd129('0x54')]:_0xbb45f[_0xd129('0xd6')];_0x3d4876[_0xd129('0xd9')]=qs['sort'](_0x55be50[_0xd129('0x4e')][_0xd129('0xda')]);_0x3d4876[_0xd129('0x4c')]=qs[_0xd129('0xd5')](_[_0xd129('0xdb')](_0x55be50['query'],_0xbb45f[_0xd129('0xd5')]));if(_0x55be50[_0xd129('0x4e')][_0xd129('0x36')]){_0x3d4876[_0xd129('0x4c')]=_['merge'](_0x3d4876[_0xd129('0x4c')],{'$or':_[_0xd129('0x40')](_0x3d4876[_0xd129('0x54')],function(_0x44072e){var _0x20daf6={};_0x20daf6[_0x44072e]={'$like':'%'+_0x55be50['query'][_0xd129('0x36')]+'%'};return _0x20daf6;})});}_0x3d4876=_['merge']({},_0x3d4876,_0x55be50['options']);return _0x4dd18d[_0xd129('0xe1')](_0x3d4876);}})['then'](function(_0x5e8921){if(_0x5e8921){_0x3f502a=_0x5e8921['length'];if(!_0x55be50[_0xd129('0x4e')][_0xd129('0xce')]('nolimit')){_0x3d4876[_0xd129('0x1b')]=qs[_0xd129('0x1b')](_0x55be50['query']['limit']);_0x3d4876['offset']=qs['offset'](_0x55be50[_0xd129('0x4e')][_0xd129('0x19')]);}return _0x4dd18d[_0xd129('0xe1')](_0x3d4876);}})['then'](function(_0xdf30d2){if(_0xdf30d2){return _0xdf30d2?{'count':_0x3f502a,'rows':_0xdf30d2}:null;}})[_0xd129('0x20')](respondWithResult(_0x96f90c,null))[_0xd129('0x5e')](handleError(_0x96f90c,null));};exports['getRecordings']=function(_0x242504,_0x4dc4ec){var _0x57b19d={'raw':!![],'where':{}};var _0xc1df33={};var _0x1ff963={'count':0x0,'rows':[]};return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x242504[_0xd129('0x60')]['id']}})['then'](handleEntityNotFound(_0x4dc4ec,null))[_0xd129('0x20')](function(_0x2d300d){if(_0x2d300d){_0xc1df33[_0xd129('0xd6')]=_[_0xd129('0xd4')](db['VoiceRecording'][_0xd129('0x3f')]);_0xc1df33[_0xd129('0x4e')]=_[_0xd129('0xd4')](_0x242504[_0xd129('0x4e')]);_0xc1df33['filters']=_[_0xd129('0xd7')](_0xc1df33[_0xd129('0xd6')],_0xc1df33[_0xd129('0x4e')]);_0x57b19d['attributes']=_[_0xd129('0xd7')](_0xc1df33[_0xd129('0xd6')],qs[_0xd129('0xd8')](_0x242504['query'][_0xd129('0xd8')]));_0x57b19d[_0xd129('0x54')]=_0x57b19d[_0xd129('0x54')]['length']?_0x57b19d[_0xd129('0x54')]:_0xc1df33['model'];if(!_0x242504[_0xd129('0x4e')]['hasOwnProperty'](_0xd129('0xe0'))){_0x57b19d[_0xd129('0x1b')]=qs[_0xd129('0x1b')](_0x242504[_0xd129('0x4e')]['limit']);_0x57b19d[_0xd129('0x19')]=qs[_0xd129('0x19')](_0x242504[_0xd129('0x4e')][_0xd129('0x19')]);}_0x57b19d[_0xd129('0xd9')]=qs[_0xd129('0xda')](_0x242504['query']['sort']);_0x57b19d[_0xd129('0x4c')]=qs['filters'](_['pick'](_0x242504[_0xd129('0x4e')],_0xc1df33[_0xd129('0xd5')]));_0x57b19d[_0xd129('0x4c')]['UserId']=_0x2d300d['id'];if(_0x242504[_0xd129('0x4e')][_0xd129('0x36')]){_0x57b19d['where']=_[_0xd129('0xdc')](_0x57b19d[_0xd129('0x4c')],{'$or':_[_0xd129('0x40')](_0x57b19d[_0xd129('0x54')],function(_0x3c9612){var _0x46e1c0={};_0x46e1c0[_0x3c9612]={'$like':'%'+_0x242504['query'][_0xd129('0x36')]+'%'};return _0x46e1c0;})});}_0x57b19d=_[_0xd129('0xdc')]({},_0x57b19d,_0x242504[_0xd129('0x61')]);return db[_0xd129('0xe3')][_0xd129('0x1c')]({'where':_0x57b19d[_0xd129('0x4c')]})[_0xd129('0x20')](function(_0x3283b8){_0x1ff963[_0xd129('0x1c')]=_0x3283b8;if(_0x242504[_0xd129('0x4e')][_0xd129('0x4f')]){_0x57b19d[_0xd129('0x50')]=[{'all':!![]}];}return db[_0xd129('0xe3')][_0xd129('0xad')](_0x57b19d);})[_0xd129('0x20')](function(_0x411b98){_0x1ff963[_0xd129('0x56')]=_0x411b98;return _0x1ff963;});}})[_0xd129('0x20')](respondWithFilteredResult(_0x4dc4ec,_0x57b19d))[_0xd129('0x5e')](handleError(_0x4dc4ec,null));};exports[_0xd129('0xe4')]=function(_0x29222c,_0x5cd028){var _0x40c06b={'raw':!![],'where':{}};var _0x1bdfb9={};var _0x491bcc={'count':0x0,'rows':[]};return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x29222c[_0xd129('0x60')]['id']}})[_0xd129('0x20')](handleEntityNotFound(_0x5cd028,null))[_0xd129('0x20')](function(_0x525026){if(_0x525026){_0x1bdfb9[_0xd129('0xd6')]=_[_0xd129('0xd4')](db['ScreenRecording'][_0xd129('0x3f')]);_0x1bdfb9[_0xd129('0x4e')]=_['keys'](_0x29222c['query']);_0x1bdfb9[_0xd129('0xd5')]=_['intersection'](_0x1bdfb9['model'],_0x1bdfb9[_0xd129('0x4e')]);_0x40c06b[_0xd129('0x54')]=_[_0xd129('0xd7')](_0x1bdfb9[_0xd129('0xd6')],qs[_0xd129('0xd8')](_0x29222c['query']['fields']));_0x40c06b[_0xd129('0x54')]=_0x40c06b['attributes'][_0xd129('0x58')]?_0x40c06b[_0xd129('0x54')]:_0x1bdfb9[_0xd129('0xd6')];if(!_0x29222c[_0xd129('0x4e')][_0xd129('0xce')](_0xd129('0xe0'))){_0x40c06b['limit']=qs[_0xd129('0x1b')](_0x29222c[_0xd129('0x4e')]['limit']);_0x40c06b[_0xd129('0x19')]=qs[_0xd129('0x19')](_0x29222c[_0xd129('0x4e')][_0xd129('0x19')]);}_0x40c06b[_0xd129('0xd9')]=qs[_0xd129('0xda')](_0x29222c[_0xd129('0x4e')][_0xd129('0xda')]);_0x40c06b[_0xd129('0x4c')]=qs['filters'](_[_0xd129('0xdb')](_0x29222c[_0xd129('0x4e')],_0x1bdfb9[_0xd129('0xd5')]));_0x40c06b[_0xd129('0x4c')][_0xd129('0xe5')]=_0x525026['id'];if(_0x29222c[_0xd129('0x4e')][_0xd129('0x36')]){_0x40c06b[_0xd129('0x4c')]=_['merge'](_0x40c06b['where'],{'$or':_['map'](_0x40c06b['attributes'],function(_0x18e616){var _0x347e97={};_0x347e97[_0x18e616]={'$like':'%'+_0x29222c[_0xd129('0x4e')][_0xd129('0x36')]+'%'};return _0x347e97;})});}_0x40c06b=_[_0xd129('0xdc')]({},_0x40c06b,_0x29222c[_0xd129('0x61')]);return db[_0xd129('0xe6')][_0xd129('0x1c')]({'where':_0x40c06b[_0xd129('0x4c')]})[_0xd129('0x20')](function(_0x53ea29){_0x491bcc[_0xd129('0x1c')]=_0x53ea29;if(_0x29222c['query'][_0xd129('0x4f')]){_0x40c06b['include']=[{'all':!![]}];}return db[_0xd129('0xe6')][_0xd129('0xad')](_0x40c06b);})['then'](function(_0x2511c7){_0x491bcc[_0xd129('0x56')]=_0x2511c7;return _0x491bcc;});}})['then'](respondWithFilteredResult(_0x5cd028,_0x40c06b))[_0xd129('0x5e')](handleError(_0x5cd028,null));};exports[_0xd129('0xe7')]=function(_0x226ad1,_0x2d64c2){var _0x54a61d={};var _0x1b52e6={};var _0x2be08d;var _0x427ea7;return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x226ad1['params']['id']}})[_0xd129('0x20')](handleEntityNotFound(_0x2d64c2,null))['then'](function(_0xc35d5){if(_0xc35d5){_0x2be08d=_0xc35d5;_0x1b52e6['model']=_[_0xd129('0xd4')](db[_0xd129('0xe8')]['rawAttributes']);_0x1b52e6['query']=_[_0xd129('0xd4')](_0x226ad1[_0xd129('0x4e')]);_0x1b52e6[_0xd129('0xd5')]=_['intersection'](_0x1b52e6[_0xd129('0xd6')],_0x1b52e6[_0xd129('0x4e')]);_0x54a61d['attributes']=_[_0xd129('0xd7')](_0x1b52e6['model'],qs[_0xd129('0xd8')](_0x226ad1[_0xd129('0x4e')][_0xd129('0xd8')]));_0x54a61d['attributes']=_0x54a61d[_0xd129('0x54')][_0xd129('0x58')]?_0x54a61d[_0xd129('0x54')]:_0x1b52e6[_0xd129('0xd6')];_0x54a61d['order']=qs[_0xd129('0xda')](_0x226ad1[_0xd129('0x4e')][_0xd129('0xda')]);_0x54a61d[_0xd129('0x4c')]=qs['filters'](_[_0xd129('0xdb')](_0x226ad1['query'],_0x1b52e6[_0xd129('0xd5')]));if(_0x226ad1[_0xd129('0x4e')][_0xd129('0x36')]){_0x54a61d['where']=_[_0xd129('0xdc')](_0x54a61d[_0xd129('0x4c')],{'$or':_[_0xd129('0x40')](_0x54a61d[_0xd129('0x54')],function(_0x137757){var _0x9ad43a={};_0x9ad43a[_0x137757]={'$like':'%'+_0x226ad1[_0xd129('0x4e')][_0xd129('0x36')]+'%'};return _0x9ad43a;})});}_0x54a61d=_[_0xd129('0xdc')]({},_0x54a61d,_0x226ad1[_0xd129('0x61')]);return _0x2be08d[_0xd129('0xe7')](_0x54a61d);}})[_0xd129('0x20')](function(_0x388364){if(_0x388364){_0x427ea7=_0x388364[_0xd129('0x58')];if(!_0x226ad1[_0xd129('0x4e')][_0xd129('0xce')](_0xd129('0xe0'))){_0x54a61d['limit']=qs[_0xd129('0x1b')](_0x226ad1[_0xd129('0x4e')][_0xd129('0x1b')]);_0x54a61d[_0xd129('0x19')]=qs['offset'](_0x226ad1[_0xd129('0x4e')][_0xd129('0x19')]);}return _0x2be08d['getChatInteractions'](_0x54a61d);}})[_0xd129('0x20')](function(_0x2788ee){if(_0x2788ee){return _0x2788ee?{'count':_0x427ea7,'rows':_0x2788ee}:null;}})['then'](respondWithResult(_0x2d64c2,null))['catch'](handleError(_0x2d64c2,null));};exports[_0xd129('0xe9')]=function(_0x13af88,_0xafb5af){var _0x3398ad={};var _0x33b5ab={};var _0xf58c01;var _0x98d445;return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x13af88[_0xd129('0x60')]['id']}})['then'](handleEntityNotFound(_0xafb5af,null))['then'](function(_0x58eb2b){if(_0x58eb2b){_0xf58c01=_0x58eb2b;_0x33b5ab[_0xd129('0xd6')]=_['keys'](db[_0xd129('0xea')][_0xd129('0x3f')]);_0x33b5ab[_0xd129('0x4e')]=_[_0xd129('0xd4')](_0x13af88[_0xd129('0x4e')]);_0x33b5ab[_0xd129('0xd5')]=_[_0xd129('0xd7')](_0x33b5ab['model'],_0x33b5ab[_0xd129('0x4e')]);_0x3398ad[_0xd129('0x54')]=_['intersection'](_0x33b5ab[_0xd129('0xd6')],qs['fields'](_0x13af88[_0xd129('0x4e')]['fields']));_0x3398ad[_0xd129('0x54')]=_0x3398ad['attributes'][_0xd129('0x58')]?_0x3398ad[_0xd129('0x54')]:_0x33b5ab[_0xd129('0xd6')];_0x3398ad['order']=qs[_0xd129('0xda')](_0x13af88['query']['sort']);_0x3398ad['where']=qs[_0xd129('0xd5')](_[_0xd129('0xdb')](_0x13af88[_0xd129('0x4e')],_0x33b5ab[_0xd129('0xd5')]));if(_0x13af88[_0xd129('0x4e')][_0xd129('0x36')]){_0x3398ad['where']=_['merge'](_0x3398ad[_0xd129('0x4c')],{'$or':_[_0xd129('0x40')](_0x3398ad[_0xd129('0x54')],function(_0x53e939){var _0x3207ec={};_0x3207ec[_0x53e939]={'$like':'%'+_0x13af88[_0xd129('0x4e')]['filter']+'%'};return _0x3207ec;})});}_0x3398ad=_[_0xd129('0xdc')]({},_0x3398ad,_0x13af88[_0xd129('0x61')]);return _0xf58c01[_0xd129('0xe9')](_0x3398ad);}})['then'](function(_0x583ef5){if(_0x583ef5){_0x98d445=_0x583ef5[_0xd129('0x58')];if(!_0x13af88[_0xd129('0x4e')]['hasOwnProperty'](_0xd129('0xe0'))){_0x3398ad[_0xd129('0x1b')]=qs['limit'](_0x13af88[_0xd129('0x4e')][_0xd129('0x1b')]);_0x3398ad[_0xd129('0x19')]=qs[_0xd129('0x19')](_0x13af88[_0xd129('0x4e')][_0xd129('0x19')]);}return _0xf58c01['getOpenchannelInteractions'](_0x3398ad);}})[_0xd129('0x20')](function(_0x368fc2){if(_0x368fc2){return _0x368fc2?{'count':_0x98d445,'rows':_0x368fc2}:null;}})[_0xd129('0x20')](respondWithResult(_0xafb5af,null))[_0xd129('0x5e')](handleError(_0xafb5af,null));};exports[_0xd129('0xeb')]=function(_0x9632ba,_0x1377e1){var _0x45f451={'raw':!![],'where':{}};var _0x357994={};var _0x2a77c3={'count':0x0,'rows':[]};return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x9632ba[_0xd129('0x60')]['id']}})['then'](handleEntityNotFound(_0x1377e1,null))[_0xd129('0x20')](function(_0x2f4037){if(_0x2f4037){_0x357994[_0xd129('0xd6')]=_[_0xd129('0xd4')](db[_0xd129('0xec')][_0xd129('0x3f')]);_0x357994[_0xd129('0x4e')]=_['keys'](_0x9632ba['query']);_0x357994[_0xd129('0xd5')]=_[_0xd129('0xd7')](_0x357994[_0xd129('0xd6')],_0x357994['query']);_0x45f451[_0xd129('0x54')]=_['intersection'](_0x357994[_0xd129('0xd6')],qs[_0xd129('0xd8')](_0x9632ba['query']['fields']));_0x45f451['attributes']=_0x45f451[_0xd129('0x54')]['length']?_0x45f451[_0xd129('0x54')]:_0x357994[_0xd129('0xd6')];if(!_0x9632ba[_0xd129('0x4e')]['hasOwnProperty'](_0xd129('0xe0'))){_0x45f451['limit']=qs[_0xd129('0x1b')](_0x9632ba[_0xd129('0x4e')]['limit']);_0x45f451[_0xd129('0x19')]=qs[_0xd129('0x19')](_0x9632ba[_0xd129('0x4e')][_0xd129('0x19')]);}_0x45f451[_0xd129('0xd9')]=qs[_0xd129('0xda')](_0x9632ba[_0xd129('0x4e')][_0xd129('0xda')]);_0x45f451[_0xd129('0x4c')]=qs[_0xd129('0xd5')](_[_0xd129('0xdb')](_0x9632ba[_0xd129('0x4e')],_0x357994[_0xd129('0xd5')]));_0x45f451['where'][_0xd129('0xe5')]=_0x2f4037['id'];if(_0x9632ba[_0xd129('0x4e')][_0xd129('0x36')]){_0x45f451['where']=_[_0xd129('0xdc')](_0x45f451[_0xd129('0x4c')],{'$or':_[_0xd129('0x40')](_0x45f451[_0xd129('0x54')],function(_0x9b39ff){var _0x463c2e={};_0x463c2e[_0x9b39ff]={'$like':'%'+_0x9632ba[_0xd129('0x4e')][_0xd129('0x36')]+'%'};return _0x463c2e;})});}_0x45f451=_['merge']({},_0x45f451,_0x9632ba[_0xd129('0x61')]);return db['MailInteraction']['count']({'where':_0x45f451[_0xd129('0x4c')]})['then'](function(_0x2a94da){_0x2a77c3['count']=_0x2a94da;if(_0x9632ba[_0xd129('0x4e')][_0xd129('0x4f')]){_0x45f451[_0xd129('0x50')]=[{'all':!![]}];}return db[_0xd129('0xec')][_0xd129('0xad')](_0x45f451);})[_0xd129('0x20')](function(_0x23e5c2){_0x2a77c3['rows']=_0x23e5c2;return _0x2a77c3;});}})[_0xd129('0x20')](respondWithFilteredResult(_0x1377e1,_0x45f451))[_0xd129('0x5e')](handleError(_0x1377e1,null));};exports[_0xd129('0xed')]=function(_0x616d45,_0x47d5ec){var _0xccf214={};var _0x20c5d8={};var _0x34c90d;var _0x2926d7;return db[_0xd129('0x4d')]['findOne']({'where':{'id':_0x616d45[_0xd129('0x60')]['id']}})[_0xd129('0x20')](handleEntityNotFound(_0x47d5ec,null))['then'](function(_0x3d62d8){if(_0x3d62d8){_0x34c90d=_0x3d62d8;_0x20c5d8['model']=_['keys'](db['SmsInteraction'][_0xd129('0x3f')]);_0x20c5d8[_0xd129('0x4e')]=_[_0xd129('0xd4')](_0x616d45['query']);_0x20c5d8[_0xd129('0xd5')]=_['intersection'](_0x20c5d8[_0xd129('0xd6')],_0x20c5d8[_0xd129('0x4e')]);_0xccf214[_0xd129('0x54')]=_[_0xd129('0xd7')](_0x20c5d8[_0xd129('0xd6')],qs[_0xd129('0xd8')](_0x616d45[_0xd129('0x4e')]['fields']));_0xccf214[_0xd129('0x54')]=_0xccf214['attributes']['length']?_0xccf214[_0xd129('0x54')]:_0x20c5d8[_0xd129('0xd6')];_0xccf214[_0xd129('0xd9')]=qs[_0xd129('0xda')](_0x616d45[_0xd129('0x4e')][_0xd129('0xda')]);_0xccf214[_0xd129('0x4c')]=qs['filters'](_[_0xd129('0xdb')](_0x616d45[_0xd129('0x4e')],_0x20c5d8['filters']));if(_0x616d45[_0xd129('0x4e')][_0xd129('0x36')]){_0xccf214[_0xd129('0x4c')]=_[_0xd129('0xdc')](_0xccf214[_0xd129('0x4c')],{'$or':_[_0xd129('0x40')](_0xccf214[_0xd129('0x54')],function(_0x1eb4c4){var _0x4d7006={};_0x4d7006[_0x1eb4c4]={'$like':'%'+_0x616d45[_0xd129('0x4e')][_0xd129('0x36')]+'%'};return _0x4d7006;})});}_0xccf214=_['merge']({},_0xccf214,_0x616d45[_0xd129('0x61')]);return _0x34c90d[_0xd129('0xed')](_0xccf214);}})[_0xd129('0x20')](function(_0xdaf598){if(_0xdaf598){_0x2926d7=_0xdaf598[_0xd129('0x58')];if(!_0x616d45[_0xd129('0x4e')][_0xd129('0xce')]('nolimit')){_0xccf214[_0xd129('0x1b')]=qs[_0xd129('0x1b')](_0x616d45[_0xd129('0x4e')][_0xd129('0x1b')]);_0xccf214[_0xd129('0x19')]=qs['offset'](_0x616d45[_0xd129('0x4e')][_0xd129('0x19')]);}return _0x34c90d[_0xd129('0xed')](_0xccf214);}})[_0xd129('0x20')](function(_0x5d2084){if(_0x5d2084){return _0x5d2084?{'count':_0x2926d7,'rows':_0x5d2084}:null;}})[_0xd129('0x20')](respondWithResult(_0x47d5ec,null))[_0xd129('0x5e')](handleError(_0x47d5ec,null));};exports[_0xd129('0xee')]=function(_0x12549e,_0x15d349){var _0x2aaeb7={};var _0x2f3ff4={};var _0x16e2d0;var _0x3f0359;return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x12549e['params']['id']}})['then'](handleEntityNotFound(_0x15d349,null))['then'](function(_0x4980c0){if(_0x4980c0){_0x16e2d0=_0x4980c0;_0x2f3ff4[_0xd129('0xd6')]=_[_0xd129('0xd4')](db['FaxInteraction'][_0xd129('0x3f')]);_0x2f3ff4['query']=_[_0xd129('0xd4')](_0x12549e[_0xd129('0x4e')]);_0x2f3ff4[_0xd129('0xd5')]=_[_0xd129('0xd7')](_0x2f3ff4[_0xd129('0xd6')],_0x2f3ff4[_0xd129('0x4e')]);_0x2aaeb7[_0xd129('0x54')]=_['intersection'](_0x2f3ff4[_0xd129('0xd6')],qs[_0xd129('0xd8')](_0x12549e[_0xd129('0x4e')][_0xd129('0xd8')]));_0x2aaeb7[_0xd129('0x54')]=_0x2aaeb7[_0xd129('0x54')][_0xd129('0x58')]?_0x2aaeb7['attributes']:_0x2f3ff4[_0xd129('0xd6')];_0x2aaeb7['order']=qs[_0xd129('0xda')](_0x12549e[_0xd129('0x4e')][_0xd129('0xda')]);_0x2aaeb7['where']=qs[_0xd129('0xd5')](_[_0xd129('0xdb')](_0x12549e[_0xd129('0x4e')],_0x2f3ff4[_0xd129('0xd5')]));if(_0x12549e[_0xd129('0x4e')][_0xd129('0x36')]){_0x2aaeb7[_0xd129('0x4c')]=_['merge'](_0x2aaeb7[_0xd129('0x4c')],{'$or':_['map'](_0x2aaeb7[_0xd129('0x54')],function(_0x5259ac){var _0x4e4d7c={};_0x4e4d7c[_0x5259ac]={'$like':'%'+_0x12549e['query']['filter']+'%'};return _0x4e4d7c;})});}_0x2aaeb7=_[_0xd129('0xdc')]({},_0x2aaeb7,_0x12549e[_0xd129('0x61')]);return _0x16e2d0['getFaxInteractions'](_0x2aaeb7);}})['then'](function(_0x189dfe){if(_0x189dfe){_0x3f0359=_0x189dfe[_0xd129('0x58')];if(!_0x12549e['query'][_0xd129('0xce')](_0xd129('0xe0'))){_0x2aaeb7[_0xd129('0x1b')]=qs[_0xd129('0x1b')](_0x12549e[_0xd129('0x4e')][_0xd129('0x1b')]);_0x2aaeb7[_0xd129('0x19')]=qs['offset'](_0x12549e[_0xd129('0x4e')]['offset']);}return _0x16e2d0[_0xd129('0xee')](_0x2aaeb7);}})['then'](function(_0x930263){if(_0x930263){return _0x930263?{'count':_0x3f0359,'rows':_0x930263}:null;}})[_0xd129('0x20')](respondWithResult(_0x15d349,null))[_0xd129('0x5e')](handleError(_0x15d349,null));};exports['getWhatsappInteractions']=function(_0x46363b,_0x42c746){var _0x3c806a={};var _0x3e73cd={};var _0x4ce313;var _0x3d84cb;return db[_0xd129('0x4d')]['findOne']({'where':{'id':_0x46363b[_0xd129('0x60')]['id']}})[_0xd129('0x20')](handleEntityNotFound(_0x42c746,null))[_0xd129('0x20')](function(_0x25cad6){if(_0x25cad6){_0x4ce313=_0x25cad6;_0x3e73cd[_0xd129('0xd6')]=_[_0xd129('0xd4')](db[_0xd129('0xef')][_0xd129('0x3f')]);_0x3e73cd[_0xd129('0x4e')]=_['keys'](_0x46363b[_0xd129('0x4e')]);_0x3e73cd[_0xd129('0xd5')]=_[_0xd129('0xd7')](_0x3e73cd[_0xd129('0xd6')],_0x3e73cd['query']);_0x3c806a[_0xd129('0x54')]=_[_0xd129('0xd7')](_0x3e73cd[_0xd129('0xd6')],qs[_0xd129('0xd8')](_0x46363b['query']['fields']));_0x3c806a[_0xd129('0x54')]=_0x3c806a['attributes'][_0xd129('0x58')]?_0x3c806a[_0xd129('0x54')]:_0x3e73cd[_0xd129('0xd6')];_0x3c806a[_0xd129('0xd9')]=qs[_0xd129('0xda')](_0x46363b[_0xd129('0x4e')][_0xd129('0xda')]);_0x3c806a[_0xd129('0x4c')]=qs[_0xd129('0xd5')](_[_0xd129('0xdb')](_0x46363b[_0xd129('0x4e')],_0x3e73cd[_0xd129('0xd5')]));if(_0x46363b['query'][_0xd129('0x36')]){_0x3c806a[_0xd129('0x4c')]=_[_0xd129('0xdc')](_0x3c806a[_0xd129('0x4c')],{'$or':_['map'](_0x3c806a[_0xd129('0x54')],function(_0x35d00b){var _0x2e3c98={};_0x2e3c98[_0x35d00b]={'$like':'%'+_0x46363b[_0xd129('0x4e')][_0xd129('0x36')]+'%'};return _0x2e3c98;})});}_0x3c806a=_[_0xd129('0xdc')]({},_0x3c806a,_0x46363b[_0xd129('0x61')]);return _0x4ce313[_0xd129('0xf0')](_0x3c806a);}})[_0xd129('0x20')](function(_0x4ded81){if(_0x4ded81){_0x3d84cb=_0x4ded81[_0xd129('0x58')];if(!_0x46363b['query'][_0xd129('0xce')](_0xd129('0xe0'))){_0x3c806a[_0xd129('0x1b')]=qs['limit'](_0x46363b[_0xd129('0x4e')][_0xd129('0x1b')]);_0x3c806a[_0xd129('0x19')]=qs['offset'](_0x46363b['query']['offset']);}return _0x4ce313[_0xd129('0xf0')](_0x3c806a);}})[_0xd129('0x20')](function(_0x4da6b1){if(_0x4da6b1){return _0x4da6b1?{'count':_0x3d84cb,'rows':_0x4da6b1}:null;}})[_0xd129('0x20')](respondWithResult(_0x42c746,null))[_0xd129('0x5e')](handleError(_0x42c746,null));};exports[_0xd129('0xf1')]=function(_0x4d669b,_0x24a957,_0x4514a5){var _0x1aca2d;var _0x320936;var _0x1eb60d;var _0x187ba0=!_['isNil'](_0x4d669b['params']['id'])?_0x4d669b[_0xd129('0x60')]['id']:!_[_0xd129('0x6e')](_0x4d669b['user']['id'])?_0x4d669b[_0xd129('0x32')]['id']:null;return db['User'][_0xd129('0x39')]({'where':{'id':_0x187ba0,'role':{'$or':[_0xd129('0x30'),'user',_0xd129('0x34')]}},'attributes':['id','name',_0xd129('0xf2'),'mobile',_0xd129('0x2b'),'internal',_0xd129('0xf3')]})[_0xd129('0x20')](function(_0x167225){if(_0x167225){if(_0x167225[_0xd129('0x2b')]===_0xd129('0x34')){_0x1aca2d=_0x167225;if(_0x4d669b[_0xd129('0x64')][_0xd129('0xa3')]){_0x1eb60d=util['format']('LOCAL/%s@from-sip/n',_0x1aca2d[_0x4d669b[_0xd129('0x64')][_0xd129('0xa3')]]);}else if(_0x4d669b[_0xd129('0x64')]['intrf']){_0x1eb60d=util[_0xd129('0xae')](_0xd129('0xaf'),_0x4d669b[_0xd129('0x64')][_0xd129('0xf4')]);}else{_0x1eb60d=util[_0xd129('0xae')]('SIP/%s',_0x1aca2d['name']);}socket['to'](util[_0xd129('0xae')](_0xd129('0xf5'),_0x1aca2d['name']))[_0xd129('0x2c')](_0xd129('0xf6'),{'user':{'id':_0x1aca2d['id'],'name':_0x1aca2d[_0xd129('0x3d')]},'ip':_0x4d669b[_0xd129('0xf7')][_0xd129('0xf8')]||_0x4d669b['connection'][_0xd129('0xf9')]||_0x4d669b[_0xd129('0xfa')][_0xd129('0xf9')]||_0x4d669b['connection']['socket'][_0xd129('0xf9')]});return new Promise(function(_0x11b522,_0x46fc2f){db[_0xd129('0x70')][_0xd129('0xfb')]()[_0xd129('0x20')](_0x11cde9=>{db['UserVoiceQueueRt'][_0xd129('0x2e')]({'where':{'membername':_0x1aca2d[_0xd129('0x3d')]},'individualHooks':!![]},{'transaction':_0x11cde9})[_0xd129('0x20')](function(){return _0x11cde9[_0xd129('0xfc')]();})[_0xd129('0x20')](_0x11b522)[_0xd129('0x5e')](_0x46fc2f);});});}}else{throw new db[(_0xd129('0x97'))][(_0xd129('0x95'))](_0xd129('0xfd'));}})[_0xd129('0x20')](function(){if(_0x1aca2d){return _0x1aca2d[_0xd129('0xfe')]({'raw':!![]});}})[_0xd129('0x20')](function(_0x722dae){if(_0x1aca2d){if(_0x722dae){_0x320936=_0x722dae;if(_0x320936[_0xd129('0x58')]){var _0x1709d6=_0x320936[_0xd129('0x40')](function(_0xd82737){return{'membername':_0x1aca2d['name'],'UserId':_0x1aca2d['id'],'queue_name':_0xd82737[_0xd129('0x3d')],'VoiceQueueId':_0xd82737['id'],'interface':_0x1eb60d,'paused':_0x1aca2d[_0xd129('0xf3')]||![],'penalty':_0xd82737['UserVoiceQueue.penalty']||0x0};});return db[_0xd129('0xb0')][_0xd129('0x8d')](_0x1709d6);}}}})[_0xd129('0x20')](function(){if(_0x1aca2d){return db['MemberReport'][_0xd129('0xad')]({'where':{'membername':_0x1aca2d['name'],'exitAt':null}});}})[_0xd129('0x20')](function(_0x5037f4){if(_0x1aca2d){var _0x3cefea=[];_0x5037f4[_0xd129('0xff')](function(_0x3220e7){_0x3cefea[_0xd129('0x55')](_0x3220e7['update']({'exitAt':moment()[_0xd129('0xae')](_0xd129('0x100'))}));});return Promise[_0xd129('0x5d')](_0x3cefea);}})[_0xd129('0x20')](function(){if(_0x1aca2d){var _0x1756bf=[];var _0x583d17=[];var _0x4830fa=utils[_0xd129('0x101')]();var _0x1d453f={'membername':_0x1aca2d[_0xd129('0x3d')],'interface':_0x1eb60d,'enterAt':moment()[_0xd129('0xae')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1aca2d[_0xd129('0x2b')],'internal':_0x1aca2d[_0xd129('0x68')]};_0x4830fa[_0xd129('0xff')](function(_0x1d9963){_0x1756bf['push'](_['merge']({'channel':_0x1d9963,'type':_0xd129('0x102'),'data1':_0x4d669b[_0xd129('0x64')]['device'],'data2':_0x1eb60d},_0x1d453f));if(_0x1aca2d['loginInPause']){_0x583d17[_0xd129('0x55')](_[_0xd129('0xdc')]({'channel':_0x1d9963,'type':_0xd129('0x103'),'data1':_0xd129('0x104')},_0x1d453f));}});return db['MemberReport'][_0xd129('0x8d')](_0x1756bf[_0xd129('0xcb')](_0x583d17),{'individualHooks':!![]});}})[_0xd129('0x20')](function(){if(_0x1aca2d){return _0x1aca2d[_0xd129('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xd129('0xae')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1aca2d[_0xd129('0xf3')]||![],'mailPause':_0x1aca2d[_0xd129('0xf3')]||![],'chatPause':_0x1aca2d[_0xd129('0xf3')]||![],'faxPause':_0x1aca2d['loginInPause']||![],'smsPause':_0x1aca2d[_0xd129('0xf3')]||![],'openchannelPause':_0x1aca2d[_0xd129('0xf3')]||![],'whatsappPause':_0x1aca2d['loginInPause']||![],'pauseType':_0x1aca2d[_0xd129('0xf3')]?_0xd129('0x104'):null,'interface':_0x1eb60d,'lastPauseAt':moment()[_0xd129('0xae')](_0xd129('0x100'))});}})[_0xd129('0x20')](function(_0x5b645b){if(_0x4d669b['isMiddleware']){return _0x4514a5();}else{return Promise[_0xd129('0x105')](_0x5b645b)[_0xd129('0x20')](respondWithResult(_0x24a957,null));}})['catch'](handleError(_0x24a957,null));};exports[_0xd129('0x106')]=function(_0x6bfc00,_0x568b1c){var _0xbeb569;return db['User']['find']({'where':{'id':_0x6bfc00[_0xd129('0x60')]['id'],'role':'agent'},'attributes':['id','name','role']})[_0xd129('0x20')](handleEntityNotFound(_0x568b1c,null))[_0xd129('0x20')](function(_0x2230d2){if(_0x2230d2){_0xbeb569=_0x2230d2;return db[_0xd129('0xb0')][_0xd129('0x2e')]({'where':{'membername':_0xbeb569[_0xd129('0x3d')]},'individualHooks':!![]});}})['then'](function(){return db[_0xd129('0x107')][_0xd129('0xad')]({'where':{'membername':_0xbeb569[_0xd129('0x3d')],'exitAt':null}});})[_0xd129('0x20')](function(_0x1bb7c0){var _0x2cff48=[];_0x1bb7c0[_0xd129('0xff')](function(_0x398e87){_0x2cff48[_0xd129('0x55')](_0x398e87[_0xd129('0x2a')]({'exitAt':moment()['format'](_0xd129('0x100'))}));});return Promise[_0xd129('0x5d')](_0x2cff48);})[_0xd129('0x20')](function(){return _0xbeb569[_0xd129('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd129('0x20')](respondWithResult(_0x568b1c,null))[_0xd129('0x5e')](handleError(_0x568b1c,null));};exports['pause']=function(_0x44beeb,_0x2c9204){var _0x1603be;return db[_0xd129('0xb0')][_0xd129('0x2a')]({'paused':0x1},{'where':{'UserId':_0x44beeb['params']['id']},'individualHooks':!![]})[_0xd129('0x20')](function(){return db[_0xd129('0x4d')]['find']({'where':{'id':_0x44beeb['params']['id'],'role':_0xd129('0x34')},'attributes':['id',_0xd129('0x3d'),_0xd129('0x2b'),_0xd129('0x68'),_0xd129('0xa3'),_0xd129('0xa1')]});})[_0xd129('0x20')](handleEntityNotFound(_0x2c9204,null))[_0xd129('0x20')](function(_0x22c7b4){if(_0x22c7b4){_0x1603be=_0x22c7b4;return respondWithRpcPromise('QueuePause',_0xd129('0x108'),{'id':_0x1603be['id'],'name':_0x1603be['name'],'pause':!![]});}})[_0xd129('0x20')](function(){if(_0x1603be){return db[_0xd129('0x107')]['findAll']({'where':{'membername':_0x1603be[_0xd129('0x3d')],'type':_0xd129('0x103'),'exitAt':null}});}})[_0xd129('0x20')](function(_0x4e4753){if(_0x4e4753[_0xd129('0x58')]){var _0x541d74=moment()[_0xd129('0xae')](_0xd129('0x100'));for(var _0x4d9d8a=0x0,_0x205d93=_0x4e4753[_0xd129('0x58')];_0x4d9d8a<_0x205d93;_0x4d9d8a++){_0x4e4753[_0x4d9d8a][_0xd129('0x109')]({'exitAt':_0x541d74});}}})[_0xd129('0x20')](function(){var _0x52f693=[];var _0x5907b0=utils[_0xd129('0x101')]();_0x5907b0[_0xd129('0xff')](function(_0x429247){_0x52f693[_0xd129('0x55')]({'channel':_0x429247,'membername':_0x1603be[_0xd129('0x3d')],'interface':_['isNil'](_0x1603be[_0xd129('0xa3')])?util[_0xd129('0xae')]('SIP/%s',_0x1603be['name']):_0x1603be[_0xd129('0xa3')],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x44beeb['body'][_0xd129('0x42')]||_0xd129('0x10a'),'role':_0x1603be[_0xd129('0x2b')],'internal':_0x1603be['internal']});});return db[_0xd129('0x107')][_0xd129('0x8d')](_0x52f693,{'individualHooks':!![]});})[_0xd129('0x20')](function(){return _0x1603be[_0xd129('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x44beeb[_0xd129('0x64')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd129('0xae')](_0xd129('0x100'))});})[_0xd129('0x20')](respondWithResult(_0x2c9204,null))[_0xd129('0x5e')](handleError(_0x2c9204,null));};exports[_0xd129('0x10b')]=function(_0xbc6a0,_0x108174){if(_0xbc6a0[_0xd129('0x64')][_0xd129('0xa0')]&&!utils[_0xd129('0xa4')](_0xbc6a0[_0xd129('0x64')][_0xd129('0xa0')])){throw new APIBadRequestError(util[_0xd129('0xae')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0xbc6a0[_0xd129('0x64')]['channel']));}return db[_0xd129('0x4d')][_0xd129('0x39')]({'where':{'id':_0xbc6a0['params']['id']},'attributes':['id',_0xd129('0x3d'),'role',_0xd129('0x68'),_0xd129('0xa3'),_0xd129('0xa1'),_0xd129('0xa2'),'mailPause','chatPause','faxPause',_0xd129('0x10c'),_0xd129('0x10d'),_0xd129('0x10e'),_0xd129('0x10f'),_0xd129('0x110')]})[_0xd129('0x20')](function(_0x3cd05b){if(!_0x3cd05b){throw new APINotFoundError(util[_0xd129('0xae')](_0xd129('0xcd'),_0xbc6a0[_0xd129('0x60')]['id']));}return _0x3cd05b[_0xd129('0x10b')](_0xbc6a0[_0xd129('0x64')]['channel']);})[_0xd129('0x20')](respondWithResult(_0x108174,null))['catch'](APIHandleError(_0x108174));};exports[_0xd129('0x111')]=function(_0x3d40eb,_0x5d80c0){var _0x550cdb={};var _0x320aca={};var _0x4a37e6;var _0x102fc3;return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x3d40eb[_0xd129('0x60')]['id']}})[_0xd129('0x20')](handleEntityNotFound(_0x5d80c0,null))[_0xd129('0x20')](function(_0x6b0d68){if(_0x6b0d68){_0x4a37e6=_0x6b0d68;_0x320aca['model']=_[_0xd129('0xd4')](db[_0xd129('0x112')]['rawAttributes']);_0x320aca[_0xd129('0x4e')]=_['keys'](_0x3d40eb[_0xd129('0x4e')]);_0x320aca[_0xd129('0xd5')]=_[_0xd129('0xd7')](_0x320aca[_0xd129('0xd6')],_0x320aca[_0xd129('0x4e')]);_0x550cdb[_0xd129('0x54')]=_[_0xd129('0xd7')](_0x320aca['model'],qs[_0xd129('0xd8')](_0x3d40eb[_0xd129('0x4e')]['fields']));_0x550cdb['attributes']=_0x550cdb[_0xd129('0x54')][_0xd129('0x58')]?_0x550cdb[_0xd129('0x54')]:_0x320aca[_0xd129('0xd6')];_0x550cdb[_0xd129('0xd9')]=qs['sort'](_0x3d40eb[_0xd129('0x4e')]['sort']);_0x550cdb[_0xd129('0x4c')]=qs['filters'](_[_0xd129('0xdb')](_0x3d40eb[_0xd129('0x4e')],_0x320aca[_0xd129('0xd5')]));if(_0x3d40eb[_0xd129('0x4e')]['filter']){_0x550cdb[_0xd129('0x4c')]=_[_0xd129('0xdc')](_0x550cdb[_0xd129('0x4c')],{'$or':_[_0xd129('0x40')](_0x550cdb['attributes'],function(_0x452f9e){var _0x44586f={};_0x44586f[_0x452f9e]={'$like':'%'+_0x3d40eb[_0xd129('0x4e')][_0xd129('0x36')]+'%'};return _0x44586f;})});}_0x550cdb=_[_0xd129('0xdc')]({},_0x550cdb,_0x3d40eb[_0xd129('0x61')]);return _0x4a37e6[_0xd129('0x111')](_0x550cdb);}})['then'](function(_0x1c7caa){if(_0x1c7caa){_0x102fc3=_0x1c7caa['length'];if(!_0x3d40eb[_0xd129('0x4e')][_0xd129('0xce')](_0xd129('0xe0'))){_0x550cdb['limit']=qs[_0xd129('0x1b')](_0x3d40eb[_0xd129('0x4e')][_0xd129('0x1b')]);_0x550cdb[_0xd129('0x19')]=qs['offset'](_0x3d40eb[_0xd129('0x4e')][_0xd129('0x19')]);}return _0x4a37e6[_0xd129('0x111')](_0x550cdb);}})[_0xd129('0x20')](function(_0x37f545){if(_0x37f545){return _0x37f545?{'count':_0x102fc3,'rows':_0x37f545}:null;}})[_0xd129('0x20')](respondWithResult(_0x5d80c0,null))[_0xd129('0x5e')](handleError(_0x5d80c0,null));};exports[_0xd129('0x113')]=function(_0x377623,_0x39b4cd){var _0x1feff2=_0x377623[_0xd129('0x60')]['id'];var _0x4fe945=_0x377623[_0xd129('0x64')]?_0x377623['body'][_0xd129('0x66')]:null;var _0x1b26cf=[];return Promise['resolve']()[_0xd129('0x20')](function(){if(!_0x4fe945)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd129('0x20')](function(){return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x1feff2}});})[_0xd129('0x20')](function(_0x5d4f8b){if(!_0x5d4f8b)throw new APINotFoundError(util['format'](_0xd129('0xcd'),_0x377623[_0xd129('0x60')]['id']));return db[_0xd129('0x70')][_0xd129('0xfb')](function(_0xbccfef){return _0x5d4f8b[_0xd129('0x113')](_0x4fe945,{'transaction':_0xbccfef})[_0xd129('0x20')](function(){return db[_0xd129('0x112')][_0xd129('0xad')]({'where':{'id':{'$in':_0x4fe945}}});})['then'](function(_0x399f86){var _0x119cb6=_['map'](_0x399f86,function(_0x30b18c){return _0x30b18c['getAssociatedQueues']();});return Promise[_0xd129('0x5d')](_0x119cb6);})[_0xd129('0x20')](function(_0x37ef1a){_0x1b26cf=_[_0xd129('0x114')](_0x37ef1a);var _0x20e1df=_[_0xd129('0x40')](_0x1b26cf,function(_0x3b83a9){return _0x3b83a9[_0xd129('0x115')](_0x5d4f8b['id'],{'transaction':_0xbccfef});});return Promise['all'](_0x20e1df);})[_0xd129('0x20')](function(){if(!_0x5d4f8b[_0xd129('0xa1')])return;var _0x1d6cde=_[_0xd129('0x36')](_0x1b26cf,function(_0xef6bf0){return _0xef6bf0[_0xd129('0x116')](_0xd129('0xa0'))===_0xd129('0x117');});var _0x1d974d=_[_0xd129('0x40')](_0x1d6cde,function(_0x4872e7){return db[_0xd129('0xb0')][_0xd129('0xb1')]({'membername':_0x5d4f8b[_0xd129('0x3d')],'UserId':_0x5d4f8b['id'],'queue_name':_0x4872e7[_0xd129('0x3d')],'VoiceQueueId':_0x4872e7['id'],'interface':_['isNil'](_0x5d4f8b[_0xd129('0xa3')])?util[_0xd129('0xae')](_0xd129('0xaf'),_0x5d4f8b[_0xd129('0x3d')]):_0x5d4f8b[_0xd129('0xa3')],'paused':_0x5d4f8b['voicePause']||![],'penalty':_0x5d4f8b[_0xd129('0xa9')]},{'transaction':_0xbccfef});});return Promise[_0xd129('0x5d')](_0x1d974d);})['then'](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x4fe945}}});})['then'](function(_0xf380a2){var _0x579544=_[_0xd129('0x40')](_0xf380a2,function(_0x3a7948){return db['UserVoicePrefix']['create']({'UserId':_0x5d4f8b['id'],'VoicePrefixId':_0x3a7948[_0xd129('0x118')]},{'transaction':_0xbccfef});});return Promise[_0xd129('0x5d')](_0x579544);});});})[_0xd129('0x20')](function(){for(var _0x370a9e=0x0;_0x370a9e<_0x1b26cf[_0xd129('0x58')];_0x370a9e++){var _0x37f798=_0x1b26cf[_0x370a9e][_0xd129('0x116')](_0xd129('0xa0'));var _0x372661=_0x37f798+_0xd129('0xab');socket[_0xd129('0x2c')](_0xd129('0x32')+_0x37f798+'Queue:save',{'UserId':_0x1feff2,['queueField']:_0x1b26cf[_0x370a9e]['id']});}})[_0xd129('0x20')](respondWithStatusCode(_0x39b4cd,null))[_0xd129('0x5e')](APIHandleError(_0x39b4cd));};exports[_0xd129('0x119')]=function(_0x4afe5f,_0x2d3cac){var _0x2e667a=_0x4afe5f[_0xd129('0x60')]['id'];var _0x4fd3fd=null;if(_0x4afe5f[_0xd129('0x4e')]['ids']){_0x4fd3fd=_['isArray'](_0x4afe5f[_0xd129('0x4e')][_0xd129('0x66')])?_0x4afe5f[_0xd129('0x4e')][_0xd129('0x66')]:[_0x4afe5f[_0xd129('0x4e')]['ids']];}var _0x5aefb5=[];return Promise[_0xd129('0x105')]()[_0xd129('0x20')](function(){if(!_0x4fd3fd)throw new APIBadRequestError(_0xd129('0x11a'));})[_0xd129('0x20')](function(){return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x2e667a}});})[_0xd129('0x20')](function(_0x1b2709){if(!_0x1b2709)throw new APINotFoundError(util[_0xd129('0xae')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4afe5f[_0xd129('0x60')]['id']));return db['sequelize'][_0xd129('0xfb')](function(_0x2998b0){return _0x1b2709[_0xd129('0x119')](_0x4fd3fd,{'transaction':_0x2998b0})[_0xd129('0x20')](function(){return db[_0xd129('0x112')]['findAll']({'where':{'id':{'$in':_0x4fd3fd}}});})['then'](function(_0x1670b0){var _0x2a1868=_[_0xd129('0x40')](_0x1670b0,function(_0x560129){return _0x560129['getAssociatedQueues']();});return Promise[_0xd129('0x5d')](_0x2a1868);})[_0xd129('0x20')](function(_0x1ae665){_0x5aefb5=_[_0xd129('0x114')](_0x1ae665);var _0x3a78db=_[_0xd129('0x40')](_0x5aefb5,function(_0x2c9c41){return _0x2c9c41[_0xd129('0x11b')](_0x1b2709['id'],{'transaction':_0x2998b0});});return Promise[_0xd129('0x5d')](_0x3a78db);})[_0xd129('0x20')](function(){if(!_0x1b2709[_0xd129('0xa1')])return;var _0x5a4332=_[_0xd129('0x36')](_0x5aefb5,function(_0x1e00b2){return _0x1e00b2['getDataValue'](_0xd129('0xa0'))===_0xd129('0x117');});var _0x3f64ed=_[_0xd129('0x40')](_0x5a4332,function(_0x52c01e){return db[_0xd129('0xb0')][_0xd129('0x2e')]({'where':{'VoiceQueueId':_0x52c01e['id'],'UserId':_0x1b2709['id']},'transaction':_0x2998b0});});return Promise[_0xd129('0x5d')](_0x3f64ed);})[_0xd129('0x20')](function(){return db[_0xd129('0x11c')][_0xd129('0xad')]({'where':{'teamId':{'$in':_0x4fd3fd}}});})['then'](function(_0x4d0d30){var _0x2cfb8f=_['map'](_0x4d0d30,function(_0x22cea7){return db[_0xd129('0x11d')]['destroy']({'where':{'UserId':_0x1b2709['id'],'VoicePrefixId':_0x22cea7[_0xd129('0x118')]}},{'transaction':_0x2998b0});});return Promise[_0xd129('0x5d')](_0x2cfb8f);});});})[_0xd129('0x20')](function(){for(var _0x5aa6e4=0x0;_0x5aa6e4<_0x5aefb5[_0xd129('0x58')];_0x5aa6e4++){var _0x530890=_0x5aefb5[_0x5aa6e4][_0xd129('0x116')](_0xd129('0xa0'));var _0x47b112=_0x530890+'QueueId';socket['emit'](_0xd129('0x32')+_0x530890+'Queue:remove',{'UserId':_0x2e667a,['queueField']:_0x5aefb5[_0x5aa6e4]['id']});}})[_0xd129('0x20')](respondWithStatusCode(_0x2d3cac,null))[_0xd129('0x5e')](APIHandleError(_0x2d3cac));};exports[_0xd129('0x11e')]=function(_0x297aa7,_0x53328c){var _0x3fe85d={};var _0x30645c={};var _0x2609ef;var _0xc24c69;return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x297aa7['params']['id']}})['then'](handleEntityNotFound(_0x53328c,null))[_0xd129('0x20')](function(_0x179054){if(_0x179054){_0x2609ef=_0x179054;_0x30645c[_0xd129('0xd6')]=_['keys'](db[_0xd129('0xcf')][_0xd129('0x3f')]);_0x30645c[_0xd129('0x4e')]=_[_0xd129('0xd4')](_0x297aa7[_0xd129('0x4e')]);_0x30645c[_0xd129('0xd5')]=_[_0xd129('0xd7')](_0x30645c[_0xd129('0xd6')],_0x30645c['query']);_0x3fe85d[_0xd129('0x54')]=_[_0xd129('0xd7')](_0x30645c[_0xd129('0xd6')],qs[_0xd129('0xd8')](_0x297aa7['query'][_0xd129('0xd8')]));_0x3fe85d[_0xd129('0x54')]=_0x3fe85d[_0xd129('0x54')][_0xd129('0x58')]?_0x3fe85d[_0xd129('0x54')]:_0x30645c[_0xd129('0xd6')];_0x3fe85d['order']=qs[_0xd129('0xda')](_0x297aa7['query'][_0xd129('0xda')]);_0x3fe85d['where']=qs[_0xd129('0xd5')](_['pick'](_0x297aa7[_0xd129('0x4e')],_0x30645c[_0xd129('0xd5')]));if(_0x297aa7['query'][_0xd129('0x36')]){_0x3fe85d[_0xd129('0x4c')]=_[_0xd129('0xdc')](_0x3fe85d['where'],{'$or':_[_0xd129('0x40')](_0x3fe85d[_0xd129('0x54')],function(_0x2388b7){var _0x4213bb={};_0x4213bb[_0x2388b7]={'$like':'%'+_0x297aa7[_0xd129('0x4e')][_0xd129('0x36')]+'%'};return _0x4213bb;})});}_0x3fe85d=_[_0xd129('0xdc')]({},_0x3fe85d,_0x297aa7[_0xd129('0x61')]);return _0x2609ef[_0xd129('0x11e')](_0x3fe85d);}})['then'](function(_0x40cf52){if(_0x40cf52){_0xc24c69=_0x40cf52[_0xd129('0x58')];if(!_0x297aa7[_0xd129('0x4e')][_0xd129('0xce')](_0xd129('0xe0'))){_0x3fe85d[_0xd129('0x1b')]=qs[_0xd129('0x1b')](_0x297aa7[_0xd129('0x4e')]['limit']);_0x3fe85d[_0xd129('0x19')]=qs[_0xd129('0x19')](_0x297aa7['query'][_0xd129('0x19')]);}return _0x2609ef['getLists'](_0x3fe85d);}})[_0xd129('0x20')](function(_0x52d215){if(_0x52d215){return _0x52d215?{'count':_0xc24c69,'rows':_0x52d215}:null;}})[_0xd129('0x20')](respondWithResult(_0x53328c,null))[_0xd129('0x5e')](handleError(_0x53328c,null));};exports[_0xd129('0x11f')]=function(_0x1749fd,_0x3772d3){var _0x30a304={};var _0x467ebd={};var _0x10f5be;return db[_0xd129('0x4d')][_0xd129('0x9b')]({'where':{'id':_0x1749fd[_0xd129('0x60')]['id']}})[_0xd129('0x20')](handleEntityNotFound(_0x3772d3,null))[_0xd129('0x20')](function(_0x4bdc42){if(_0x4bdc42){_0x10f5be=_0x4bdc42;_0x467ebd[_0xd129('0xd6')]=_[_0xd129('0xd4')](db[_0xd129('0x4d')]['rawAttributes']);_0x467ebd['query']=_[_0xd129('0xd4')](_0x1749fd[_0xd129('0x4e')]);_0x467ebd['filters']=_[_0xd129('0xd7')](_0x467ebd['model'],_0x467ebd[_0xd129('0x4e')]);_0x30a304['attributes']=_[_0xd129('0xd7')](_0x467ebd['model'],qs[_0xd129('0xd8')](_0x1749fd[_0xd129('0x4e')][_0xd129('0xd8')]));_0x30a304['attributes']=_0x30a304[_0xd129('0x54')][_0xd129('0x58')]?_0x30a304['attributes']:_0x467ebd[_0xd129('0xd6')];_0x30a304[_0xd129('0xd9')]=qs['sort'](_0x1749fd['query'][_0xd129('0xda')]);_0x30a304[_0xd129('0x4c')]=qs[_0xd129('0xd5')](_[_0xd129('0xdb')](_0x1749fd['query'],_0x467ebd['filters']));if(_0x1749fd[_0xd129('0x4e')][_0xd129('0x36')]){_0x30a304[_0xd129('0x4c')]=_[_0xd129('0xdc')](_0x30a304[_0xd129('0x4c')],{'$or':_['map'](_0x30a304[_0xd129('0x54')],function(_0x44ebdc){var _0x47f805={};_0x47f805[_0x44ebdc]={'$like':'%'+_0x1749fd[_0xd129('0x4e')]['filter']+'%'};return _0x47f805;})});}_0x30a304[_0xd129('0xd6')]=db[_0xd129('0x4d')];_0x30a304['as']='Agents';_0x30a304=_['merge']({},_0x30a304,_0x1749fd[_0xd129('0x61')]);return _0x10f5be[_0xd129('0xfe')]({'include':[_0x30a304]});}})[_0xd129('0x20')](function(_0x1bdeb6){if(_0x1bdeb6){var _0x22eeab={},_0x529268=[];for(var _0x33f9c8=0x0;_0x33f9c8<_0x1bdeb6[_0xd129('0x58')];_0x33f9c8+=0x1){for(var _0x52ef1f=0x0,_0x37a6e9;_0x52ef1f<_0x1bdeb6[_0x33f9c8][_0xd129('0x33')]['length'];_0x52ef1f+=0x1){_0x37a6e9=_0x1bdeb6[_0x33f9c8][_0xd129('0x33')][_0x52ef1f][_0xd129('0x2f')]({'plain':!![]});_0x22eeab[_0x37a6e9['id']]=_0x37a6e9;}}_0x22eeab=_['values'](_0x22eeab);for(var _0x2a731e=qs[_0xd129('0x19')](_0x1749fd[_0xd129('0x4e')][_0xd129('0x19')]);_0x2a731e<_0x22eeab[_0xd129('0x58')]&&_0x529268[_0xd129('0x58')]=_0x2a5e42['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xa7e9('0x1a')](function(){if(_0x2f7301){return db[_0xa7e9('0x28')][_0xa7e9('0x48')]({'where':{'membername':_0x2f7301[_0xa7e9('0x23')]},'individualHooks':!![]});}})[_0xa7e9('0x1a')](function(){if(_0x2f7301){return _0x2f7301[_0xa7e9('0x50')]({'raw':!![]});}})['then'](function(_0x37e867){if(_0x2f7301){if(_0x37e867){var _0x214fdd=[];_0x4e327d=_0x37e867;if(_0x4e327d[_0xa7e9('0x49')]){for(var _0x4d5efd=0x0;_0x4d5efd<_0x4e327d[_0xa7e9('0x49')];_0x4d5efd++){_0x214fdd['push'](db[_0xa7e9('0x28')][_0xa7e9('0x51')]({'membername':_0x2f7301[_0xa7e9('0x23')],'UserId':_0x2f7301['id'],'queue_name':_0x4e327d[_0x4d5efd]['name'],'VoiceQueueId':_0x4e327d[_0x4d5efd]['id'],'interface':_0x3fc989,'paused':_0x2f7301[_0xa7e9('0x52')]||![],'penalty':_0x4e327d[_0x4d5efd][_0xa7e9('0x53')]||0x0}));}return BPromise['all'](_0x214fdd);}}}})['then'](function(){if(_0x2f7301){return db[_0xa7e9('0x2a')][_0xa7e9('0x11')]({'where':{'membername':_0x2f7301[_0xa7e9('0x23')],'exitAt':null}});}})['then'](function(_0x43618d){if(_0x2f7301){if(_0x43618d&&_0x43618d[_0xa7e9('0x49')]){var _0x4c8067=[];_0x43618d[_0xa7e9('0x2e')](function(_0xaeb608){_0x4c8067[_0xa7e9('0x2f')](_0xaeb608[_0xa7e9('0x29')]({'exitAt':moment()[_0xa7e9('0x31')](_0xa7e9('0x2b'))}));});return BPromise[_0xa7e9('0x4a')](_0x4c8067);}}})[_0xa7e9('0x1a')](function(){if(_0x2f7301){var _0x23f5a3=[];var _0x3abde1=[];var _0x596984=utils[_0xa7e9('0x2d')]();var _0x5bd293={'membername':_0x2f7301[_0xa7e9('0x23')],'interface':_0x3fc989,'enterAt':moment()[_0xa7e9('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2f7301[_0xa7e9('0x24')],'internal':_0x2f7301['internal']};_0x596984[_0xa7e9('0x2e')](function(_0x40c533){_0x23f5a3['push'](_['merge']({'channel':_0x40c533,'type':_0xa7e9('0x54'),'data1':'callysquare','data2':_0x3fc989},_0x5bd293));if(_0x2f7301[_0xa7e9('0x52')]){_0x3abde1[_0xa7e9('0x2f')](_['merge']({'channel':_0x40c533,'type':'PAUSE','data1':_0xa7e9('0x55')},_0x5bd293));}});return db['MemberReport']['bulkCreate'](_0x23f5a3['concat'](_0x3abde1),{'individualHooks':!![]});}})[_0xa7e9('0x1a')](function(){if(_0x2f7301){return _0x2f7301[_0xa7e9('0x29')]({'online':!![],'lastLoginAt':moment()[_0xa7e9('0x31')](_0xa7e9('0x2b')),'voicePause':_0x2f7301[_0xa7e9('0x52')]||![],'mailPause':_0x2f7301[_0xa7e9('0x52')]||![],'chatPause':_0x2f7301['loginInPause']||![],'faxPause':_0x2f7301['loginInPause']||![],'smsPause':_0x2f7301['loginInPause']||![],'openchannelPause':_0x2f7301['loginInPause']||![],'pauseType':_0x2f7301['loginInPause']?_0xa7e9('0x55'):null,'lastPauseAt':moment()[_0xa7e9('0x31')](_0xa7e9('0x2b')),'interface':_0x3fc989});}})[_0xa7e9('0x1a')](function(_0xf2566e){_0x52de9e(_0xf2566e);})[_0xa7e9('0x1d')](function(_0x3ed950){_0x62c7c6(_0x2bce8c[_0xa7e9('0x1e')](0x1f4,_0x3ed950[_0xa7e9('0x1f')]));});});}; \ No newline at end of file +var _0x89d2=['count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','all','LOGIN','callysquare','loginInPause','LOGININPAUSE','lodash','util','moment','../../config/utils','rpc','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','message','error','ShowUser','find','catch','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','push','isNil','SIP/%s','body','uniqueid','bulkCreate','type','DEFAULT\x20PAUSE','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','unpause','system','UserVoiceQueueRt','destroy','forEach','LoginUser','mobile'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x89d2,0x109));var _0x289d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x89d2[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x289d('0x0'));var util=require(_0x289d('0x1'));var moment=require(_0x289d('0x2'));var BPromise=require('bluebird');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x289d('0x3'));var logger=require('../../config/logger')(_0x289d('0x4'));var config=require('../../config/environment');config[_0x289d('0x5')]=_['defaults'](config['redis'],{'host':_0x289d('0x6'),'port':0x18eb});var socket=require(_0x289d('0x7'))(new Redis(config[_0x289d('0x5')]));require(_0x289d('0x8'))[_0x289d('0x9')](socket);exports[_0x289d('0xa')]=function(_0x52cc31){var _0x3e4230=this;return new Promise(function(_0x4943af,_0x3ac33f){return db[_0x289d('0xb')][_0x289d('0xc')]({'raw':_0x52cc31[_0x289d('0xd')]?_0x52cc31[_0x289d('0xd')][_0x289d('0xe')]===undefined?!![]:![]:!![],'where':_0x52cc31['options']?_0x52cc31[_0x289d('0xd')][_0x289d('0xf')]||null:null,'attributes':_0x52cc31['options']?_0x52cc31['options'][_0x289d('0x10')]||null:null,'limit':_0x52cc31[_0x289d('0xd')]?_0x52cc31['options'][_0x289d('0x11')]||null:null,'include':_0x52cc31[_0x289d('0xd')]?_0x52cc31[_0x289d('0xd')][_0x289d('0x12')]?_[_0x289d('0x13')](_0x52cc31[_0x289d('0xd')][_0x289d('0x12')],function(_0x2c559f){return{'model':db[_0x2c559f[_0x289d('0x14')]],'as':_0x2c559f['as'],'attributes':_0x2c559f[_0x289d('0x10')],'include':_0x2c559f[_0x289d('0x12')]?_[_0x289d('0x13')](_0x2c559f[_0x289d('0x12')],function(_0x7d128f){return{'model':db[_0x7d128f['model']],'as':_0x7d128f['as'],'attributes':_0x7d128f[_0x289d('0x10')],'include':_0x7d128f[_0x289d('0x12')]?_[_0x289d('0x13')](_0x7d128f[_0x289d('0x12')],function(_0x3e6036){return{'model':db[_0x3e6036['model']],'as':_0x3e6036['as'],'attributes':_0x3e6036[_0x289d('0x10')]};}):[]};}):[]};}):[]:[]})[_0x289d('0x15')](function(_0xdbd098){logger[_0x289d('0x16')](_0x289d('0xa'),_0x52cc31);logger[_0x289d('0x17')]('GetUser',_0x52cc31,JSON[_0x289d('0x18')](_0xdbd098));_0x4943af(_0xdbd098);})['catch'](function(_0x245254){logger['error'](_0x289d('0xa'),_0x245254[_0x289d('0x19')],_0x52cc31);_0x3ac33f(_0x3e4230[_0x289d('0x1a')](0x1f4,_0x245254[_0x289d('0x19')]));});});};exports[_0x289d('0x1b')]=function(_0x1a3ba2){var _0x2e086f=this;return new Promise(function(_0x21e4ec,_0x5a4518){return db[_0x289d('0xb')][_0x289d('0x1c')]({'raw':_0x1a3ba2[_0x289d('0xd')]?_0x1a3ba2[_0x289d('0xd')][_0x289d('0xe')]===undefined?!![]:![]:!![],'where':_0x1a3ba2[_0x289d('0xd')]?_0x1a3ba2['options']['where']||null:null,'attributes':_0x1a3ba2['options']?_0x1a3ba2[_0x289d('0xd')][_0x289d('0x10')]||null:null,'include':_0x1a3ba2[_0x289d('0xd')]?_0x1a3ba2[_0x289d('0xd')]['include']?_[_0x289d('0x13')](_0x1a3ba2[_0x289d('0xd')][_0x289d('0x12')],function(_0x55d6d3){return{'model':db[_0x55d6d3[_0x289d('0x14')]],'as':_0x55d6d3['as'],'attributes':_0x55d6d3[_0x289d('0x10')],'include':_0x55d6d3['include']?_[_0x289d('0x13')](_0x55d6d3['include'],function(_0x48283){return{'model':db[_0x48283['model']],'as':_0x48283['as'],'attributes':_0x48283[_0x289d('0x10')],'include':_0x48283[_0x289d('0x12')]?_[_0x289d('0x13')](_0x48283[_0x289d('0x12')],function(_0x2d392e){return{'model':db[_0x2d392e[_0x289d('0x14')]],'as':_0x2d392e['as'],'attributes':_0x2d392e[_0x289d('0x10')]};}):[]};}):[]};}):[]:[]})[_0x289d('0x15')](function(_0x56e6ba){logger[_0x289d('0x16')](_0x289d('0x1b'),_0x1a3ba2);logger[_0x289d('0x17')](_0x289d('0x1b'),_0x1a3ba2,JSON[_0x289d('0x18')](_0x56e6ba));_0x21e4ec(_0x56e6ba);})[_0x289d('0x1d')](function(_0x528c36){logger[_0x289d('0x1a')]('ShowUser',_0x528c36[_0x289d('0x19')],_0x1a3ba2);_0x5a4518(_0x2e086f[_0x289d('0x1a')](0x1f4,_0x528c36[_0x289d('0x19')]));});});};exports[_0x289d('0x1e')]=function(_0x3190dd){var _0x44c651;return db[_0x289d('0xb')][_0x289d('0x1c')]({'where':_0x3190dd['options'][_0x289d('0xf')]||{},'attributes':['id',_0x289d('0x1f'),_0x289d('0x20'),_0x289d('0x21'),_0x289d('0x22')]})['then'](function(_0x40b7c9){if(!_0x40b7c9){throw new Error(util[_0x289d('0x23')](_0x289d('0x24'),_0x3190dd[_0x289d('0x25')]['id']));}_0x44c651=_0x40b7c9;return db['UserVoiceQueueRt'][_0x289d('0x26')]({'paused':0x1},{'where':{'UserId':_0x44c651['id']},'individualHooks':!![]});})[_0x289d('0x15')](function(){return db[_0x289d('0x27')][_0x289d('0xc')]({'where':{'membername':_0x44c651[_0x289d('0x1f')],'type':_0x289d('0x28'),'exitAt':null}});})[_0x289d('0x15')](function(_0x3859df){if(_0x3859df&&_0x3859df[_0x289d('0x29')]){var _0x22059a=moment()[_0x289d('0x23')](_0x289d('0x2a'));for(var _0x2046b0=0x0,_0x478699=_0x3859df[_0x289d('0x29')];_0x2046b0<_0x478699;_0x2046b0++){_0x3859df[_0x2046b0][_0x289d('0x2b')]({'exitAt':_0x22059a});}}})[_0x289d('0x15')](function(){var _0x48297e=[];var _0xfb898c=utils['getChannels']();_0xfb898c['forEach'](function(_0x2ecca0){_0x48297e[_0x289d('0x2c')]({'channel':_0x2ecca0,'membername':_0x44c651['name'],'interface':_[_0x289d('0x2d')](_0x44c651[_0x289d('0x22')])?util[_0x289d('0x23')](_0x289d('0x2e'),_0x44c651[_0x289d('0x1f')]):_0x44c651[_0x289d('0x22')],'type':_0x289d('0x28'),'enterAt':moment()[_0x289d('0x23')](_0x289d('0x2a')),'data1':_0x3190dd['body']['type']||'DEFAULT\x20PAUSE','role':_0x44c651[_0x289d('0x20')],'internal':_0x44c651[_0x289d('0x21')],'uniqueid':_0x3190dd[_0x289d('0x2f')][_0x289d('0x30')]||null});});return db[_0x289d('0x27')][_0x289d('0x31')](_0x48297e,{'individualHooks':!![]});})[_0x289d('0x15')](function(){return _0x44c651[_0x289d('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3190dd[_0x289d('0x2f')][_0x289d('0x32')]||_0x289d('0x33'),'lastPauseAt':moment()[_0x289d('0x23')](_0x289d('0x2a'))});})[_0x289d('0x1d')](function(_0x5e5212){throw _0x5e5212;});};exports['UnpauseUser']=function(_0x4baaf){return Promise[_0x289d('0x34')]()[_0x289d('0x15')](function(){if(_0x4baaf[_0x289d('0x2f')][_0x289d('0x35')]&&!utils['isValidChannel'](_0x4baaf['body']['channel'])){throw new Error(util[_0x289d('0x23')](_0x289d('0x36'),_0x4baaf['body'][_0x289d('0x35')]));}return db[_0x289d('0xb')][_0x289d('0x37')]({'where':_0x4baaf[_0x289d('0xd')][_0x289d('0xf')]||{},'attributes':['id',_0x289d('0x1f'),_0x289d('0x20'),_0x289d('0x21'),'interface',_0x289d('0x38'),_0x289d('0x39'),_0x289d('0x3a'),'chatPause',_0x289d('0x3b'),_0x289d('0x3c'),_0x289d('0x3d'),_0x289d('0x3e'),'pauseType',_0x289d('0x3f')]});})[_0x289d('0x15')](function(_0x3a6f5f){if(!_0x3a6f5f){throw new Error(util[_0x289d('0x23')](_0x289d('0x24'),_0x4baaf[_0x289d('0x25')]['id']));}return _0x3a6f5f[_0x289d('0x40')](_0x4baaf[_0x289d('0x2f')]['channel'],_0x289d('0x41'));})[_0x289d('0x1d')](function(_0x147823){throw _0x147823;});};exports['LogoutUser']=function(_0xaa3384){var _0x5e1bdf=this;return new Promise(function(_0x323140,_0x62da89){var _0x73b6aa;return db[_0x289d('0xb')][_0x289d('0x37')]({'where':_0xaa3384[_0x289d('0xd')][_0x289d('0xf')]||{},'attributes':['id','name']})[_0x289d('0x15')](function(_0x49c9a5){if(_0x49c9a5){_0x73b6aa=_0x49c9a5;return db[_0x289d('0x42')][_0x289d('0x43')]({'where':{'membername':_0x73b6aa[_0x289d('0x1f')]},'individualHooks':!![]});}})['then'](function(){if(_0x73b6aa){return db['MemberReport'][_0x289d('0xc')]({'where':{'membername':_0x73b6aa['name'],'exitAt':null}});}})[_0x289d('0x15')](function(_0x23e27d){if(_0x73b6aa){if(_0x23e27d&&_0x23e27d['length']){var _0x573532=[];_0x23e27d[_0x289d('0x44')](function(_0x1c8e57){_0x573532['push'](_0x1c8e57[_0x289d('0x26')]({'exitAt':moment()[_0x289d('0x23')](_0x289d('0x2a'))}));});return BPromise['all'](_0x573532);}}})['then'](function(){if(_0x73b6aa){return _0x73b6aa['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x289d('0x15')](function(_0x3c5b4f){_0x323140(_0x3c5b4f);})['catch'](function(_0x28a9d6){_0x62da89(_0x5e1bdf[_0x289d('0x1a')](0x1f4,_0x28a9d6[_0x289d('0x19')]));});});};exports[_0x289d('0x45')]=function(_0x1057da){var _0x114c8f=this;return new Promise(function(_0xf6704e,_0x5d2ed2){var _0x2981ac;var _0x5a6065;var _0x39869a;var _0x2879ce;return db['User'][_0x289d('0x37')]({'where':_0x1057da[_0x289d('0xd')][_0x289d('0xf')]||{},'attributes':['id',_0x289d('0x1f'),_0x289d('0x20'),_0x289d('0x46'),'phone',_0x289d('0x21'),'loginInPause','interface']})[_0x289d('0x15')](function(_0x4ec75b){if(_0x4ec75b){_0x2981ac=_0x4ec75b;_0x2879ce=_0x1057da[_0x289d('0x2f')][_0x289d('0x22')]?_0x1057da['body'][_0x289d('0x22')]:util[_0x289d('0x23')]('SIP/%s',_0x2981ac[_0x289d('0x1f')]);return db[_0x289d('0xb')][_0x289d('0x47')]({'where':{'role':_0x289d('0x48'),'online':!![],'id':{'$ne':_0x2981ac['id']}}});}})['then'](function(_0x398ff7){if(_0x398ff7){_0x39869a=_0x398ff7;return require(_0x289d('0x49'))['getLicense']();}})[_0x289d('0x15')](function(_0x34087a){if(_0x34087a&&_0x34087a['agents']&&_0x39869a>=_0x34087a[_0x289d('0x4a')]){throw new Error(_0x289d('0x4b'));}})[_0x289d('0x15')](function(){if(_0x2981ac){return db[_0x289d('0x42')][_0x289d('0x43')]({'where':{'membername':_0x2981ac[_0x289d('0x1f')]},'individualHooks':!![]});}})[_0x289d('0x15')](function(){if(_0x2981ac){return _0x2981ac[_0x289d('0x4c')]({'raw':!![]});}})['then'](function(_0x59d73e){if(_0x2981ac){if(_0x59d73e){var _0x2dd65e=[];_0x5a6065=_0x59d73e;if(_0x5a6065[_0x289d('0x29')]){for(var _0x4302a9=0x0;_0x4302a9<_0x5a6065[_0x289d('0x29')];_0x4302a9++){_0x2dd65e[_0x289d('0x2c')](db[_0x289d('0x42')][_0x289d('0x4d')]({'membername':_0x2981ac[_0x289d('0x1f')],'UserId':_0x2981ac['id'],'queue_name':_0x5a6065[_0x4302a9][_0x289d('0x1f')],'VoiceQueueId':_0x5a6065[_0x4302a9]['id'],'interface':_0x2879ce,'paused':_0x2981ac['loginInPause']||![],'penalty':_0x5a6065[_0x4302a9][_0x289d('0x4e')]||0x0}));}return BPromise[_0x289d('0x4f')](_0x2dd65e);}}}})[_0x289d('0x15')](function(){if(_0x2981ac){return db[_0x289d('0x27')][_0x289d('0xc')]({'where':{'membername':_0x2981ac[_0x289d('0x1f')],'exitAt':null}});}})[_0x289d('0x15')](function(_0x214fa0){if(_0x2981ac){if(_0x214fa0&&_0x214fa0[_0x289d('0x29')]){var _0x25b91e=[];_0x214fa0[_0x289d('0x44')](function(_0x55e562){_0x25b91e[_0x289d('0x2c')](_0x55e562['update']({'exitAt':moment()['format'](_0x289d('0x2a'))}));});return BPromise[_0x289d('0x4f')](_0x25b91e);}}})[_0x289d('0x15')](function(){if(_0x2981ac){var _0x7542c2=[];var _0x1d8086=[];var _0xe66e7=utils['getChannels']();var _0x135988={'membername':_0x2981ac[_0x289d('0x1f')],'interface':_0x2879ce,'enterAt':moment()[_0x289d('0x23')](_0x289d('0x2a')),'role':_0x2981ac[_0x289d('0x20')],'internal':_0x2981ac[_0x289d('0x21')]};_0xe66e7[_0x289d('0x44')](function(_0x55a0c6){_0x7542c2[_0x289d('0x2c')](_['merge']({'channel':_0x55a0c6,'type':_0x289d('0x50'),'data1':_0x289d('0x51'),'data2':_0x2879ce},_0x135988));if(_0x2981ac[_0x289d('0x52')]){_0x1d8086['push'](_['merge']({'channel':_0x55a0c6,'type':_0x289d('0x28'),'data1':_0x289d('0x53')},_0x135988));}});return db[_0x289d('0x27')][_0x289d('0x31')](_0x7542c2['concat'](_0x1d8086),{'individualHooks':!![]});}})[_0x289d('0x15')](function(){if(_0x2981ac){return _0x2981ac['update']({'online':!![],'lastLoginAt':moment()[_0x289d('0x23')](_0x289d('0x2a')),'voicePause':_0x2981ac['loginInPause']||![],'mailPause':_0x2981ac['loginInPause']||![],'chatPause':_0x2981ac['loginInPause']||![],'faxPause':_0x2981ac[_0x289d('0x52')]||![],'smsPause':_0x2981ac[_0x289d('0x52')]||![],'openchannelPause':_0x2981ac[_0x289d('0x52')]||![],'pauseType':_0x2981ac[_0x289d('0x52')]?_0x289d('0x53'):null,'lastPauseAt':moment()['format'](_0x289d('0x2a')),'interface':_0x2879ce});}})[_0x289d('0x15')](function(_0x4017bf){_0xf6704e(_0x4017bf);})[_0x289d('0x1d')](function(_0x25049b){_0x5d2ed2(_0x114c8f[_0x289d('0x1a')](0x1f4,_0x25049b[_0x289d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d7bac69..0071007 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 _0xa460=['update','emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xa460,0x189));var _0x0a46=function(_0x128056,_0x4f314b){_0x128056=_0x128056-0x0;var _0x47da14=_0xa460[_0x128056];return _0x47da14;};'use strict';var UserEvents=require(_0x0a46('0x0'));var events=[_0x0a46('0x1'),_0x0a46('0x2'),_0x0a46('0x3')];function createListener(_0x56ac44,_0x6faf27){return function(_0x1b740e){_0x6faf27[_0x0a46('0x4')](_0x56ac44,_0x1b740e);};}function removeListener(_0x1c2aeb,_0x7f2df3){return function(){UserEvents[_0x0a46('0x5')](_0x1c2aeb,_0x7f2df3);};}exports[_0x0a46('0x6')]=function(_0xcf9556){for(var _0x2817f8=0x0,_0x540ed4=events[_0x0a46('0x7')];_0x2817f8<_0x540ed4;_0x2817f8++){var _0x334e02=events[_0x2817f8];var _0x45ca56=createListener(_0x0a46('0x8')+_0x334e02,_0xcf9556);UserEvents['on'](_0x334e02,_0x45ca56);}}; \ No newline at end of file +var _0x7e8b=['remove','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x4947c6,_0x51046d){var _0x29db6a=function(_0x38c305){while(--_0x38c305){_0x4947c6['push'](_0x4947c6['shift']());}};_0x29db6a(++_0x51046d);}(_0x7e8b,0xc6));var _0xb7e8=function(_0x48fcee,_0x431a8b){_0x48fcee=_0x48fcee-0x0;var _0x28d65a=_0x7e8b[_0x48fcee];return _0x28d65a;};'use strict';var UserEvents=require(_0xb7e8('0x0'));var events=[_0xb7e8('0x1'),_0xb7e8('0x2'),'update'];function createListener(_0x366569,_0x21dd44){return function(_0x10065c){_0x21dd44[_0xb7e8('0x3')](_0x366569,_0x10065c);};}function removeListener(_0x9f343c,_0x51910e){return function(){UserEvents[_0xb7e8('0x4')](_0x9f343c,_0x51910e);};}exports[_0xb7e8('0x5')]=function(_0x2f4e53){for(var _0x207227=0x0,_0x44f50c=events[_0xb7e8('0x6')];_0x207227<_0x44f50c;_0x207227++){var _0x4248c4=events[_0x207227];var _0x3e9d14=createListener(_0xb7e8('0x7')+_0x4248c4,_0x2f4e53);UserEvents['on'](_0x4248c4,_0x3e9d14);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index de7273c..ff949c2 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(_0x15b6d2,_0x3bf4be){var _0x36a1e2=function(_0x752ef0){while(--_0x752ef0){_0x15b6d2['push'](_0x15b6d2['shift']());}};_0x36a1e2(++_0x3bf4be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x297aff,_0x1340a6){var _0x204049=function(_0x2f6a88){while(--_0x2f6a88){_0x297aff['push'](_0x297aff['shift']());}};_0x204049(++_0x1340a6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xcb91[_0x4d8dc3];return _0x9b03d9;};'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 22b3435..fca8a06 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 _0x7a08=['sequelize','exports'];(function(_0x35339d,_0x406d7a){var _0x4bc173=function(_0x5c1102){while(--_0x5c1102){_0x35339d['push'](_0x35339d['shift']());}};_0x4bc173(++_0x406d7a);}(_0x7a08,0x11e));var _0x87a0=function(_0x16ccc4,_0x439e40){_0x16ccc4=_0x16ccc4-0x0;var _0x2d3fd0=_0x7a08[_0x16ccc4];return _0x2d3fd0;};'use strict';var Sequelize=require(_0x87a0('0x0'));module[_0x87a0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfea8=['INTEGER','exports'];(function(_0x376327,_0x245846){var _0x22d464=function(_0xe75a06){while(--_0xe75a06){_0x376327['push'](_0x376327['shift']());}};_0x22d464(++_0x245846);}(_0xfea8,0x9b));var _0x8fea=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0xfea8[_0x2d9e27];return _0xd35381;};'use strict';var Sequelize=require('sequelize');module[_0x8fea('0x0')]={'penalty':{'type':Sequelize[_0x8fea('0x1')],'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 72bd933..91d8e7b 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 _0xefb0=['exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','request-promise','path','./userChatQueue.attributes'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xefb0,0x1ee));var _0x0efb=function(_0x52e693,_0x287437){_0x52e693=_0x52e693-0x0;var _0x542799=_0xefb0[_0x52e693];return _0x542799;};'use strict';var _=require(_0x0efb('0x0'));var util=require('util');var logger=require(_0x0efb('0x1'))(_0x0efb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0efb('0x3'));var fs=require('fs');var path=require(_0x0efb('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0efb('0x5'));module[_0x0efb('0x6')]=function(_0x53ed5c,_0x398240){return _0x53ed5c[_0x0efb('0x7')](_0x0efb('0x8'),attributes,{'tableName':_0x0efb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecbc=['exports','define','UserChatQueue','util','../../config/logger','api','moment','request-promise','../../config/environment','./userChatQueue.attributes'];(function(_0x46136e,_0x50c928){var _0x3adbc7=function(_0x24fb8e){while(--_0x24fb8e){_0x46136e['push'](_0x46136e['shift']());}};_0x3adbc7(++_0x50c928);}(_0xecbc,0xc1));var _0xcecb=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xecbc[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require(_0xcecb('0x0'));var logger=require(_0xcecb('0x1'))(_0xcecb('0x2'));var moment=require(_0xcecb('0x3'));var BPromise=require('bluebird');var rp=require(_0xcecb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcecb('0x5'));var attributes=require(_0xcecb('0x6'));module[_0xcecb('0x7')]=function(_0x43d30c,_0x5028f7){return _0x43d30c[_0xcecb('0x8')](_0xcecb('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index b60fdb3..046ef92 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 _0xc553=['../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x3f9a81,_0x53550b){var _0x22112c=function(_0xfb425f){while(--_0xfb425f){_0x3f9a81['push'](_0x3f9a81['shift']());}};_0x22112c(++_0x53550b);}(_0xc553,0x152));var _0x3c55=function(_0x159902,_0x2f808c){_0x159902=_0x159902-0x0;var _0x128878=_0xc553[_0x159902];return _0x128878;};'use strict';var _=require(_0x3c55('0x0'));var util=require('util');var moment=require(_0x3c55('0x1'));var BPromise=require(_0x3c55('0x2'));var rs=require(_0x3c55('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c55('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c55('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3c55('0x6'));var client=jayson[_0x3c55('0x7')][_0x3c55('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18ef47,_0x3c89b3,_0x25ef00){return new BPromise(function(_0x46b551,_0x5edafe){return client[_0x3c55('0x9')](_0x18ef47,_0x25ef00)['then'](function(_0x40d071){logger[_0x3c55('0xa')](_0x3c55('0xb'),_0x3c89b3,_0x3c55('0xc'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3c89b3,_0x3c55('0xc'),JSON[_0x3c55('0xd')](_0x40d071));if(_0x40d071['error']){if(_0x40d071['error'][_0x3c55('0xe')]===0x1f4){logger[_0x3c55('0xf')](_0x3c55('0xb'),_0x3c89b3,_0x40d071[_0x3c55('0xf')]['message']);return _0x5edafe(_0x40d071[_0x3c55('0xf')][_0x3c55('0x10')]);}logger['error'](_0x3c55('0xb'),_0x3c89b3,_0x40d071[_0x3c55('0xf')][_0x3c55('0x10')]);return _0x46b551(_0x40d071[_0x3c55('0xf')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x3c89b3,_0x3c55('0xc'));_0x46b551(_0x40d071['result'][_0x3c55('0x10')]);}})[_0x3c55('0x11')](function(_0x490b39){logger['error'](_0x3c55('0xb'),_0x3c89b3,_0x490b39);_0x5edafe(_0x490b39);});});} \ No newline at end of file +var _0xfa3d=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x28b8b6,_0x3f9bf8){var _0x4b2c51=function(_0x237925){while(--_0x237925){_0x28b8b6['push'](_0x28b8b6['shift']());}};_0x4b2c51(++_0x3f9bf8);}(_0xfa3d,0x15b));var _0xdfa3=function(_0x1ceaaf,_0x3aa8e0){_0x1ceaaf=_0x1ceaaf-0x0;var _0x5d1804=_0xfa3d[_0x1ceaaf];return _0x5d1804;};'use strict';var _=require(_0xdfa3('0x0'));var util=require(_0xdfa3('0x1'));var moment=require(_0xdfa3('0x2'));var BPromise=require(_0xdfa3('0x3'));var rs=require(_0xdfa3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfa3('0x5'))['db'];var utils=require(_0xdfa3('0x6'));var logger=require(_0xdfa3('0x7'))(_0xdfa3('0x8'));var config=require(_0xdfa3('0x9'));var jayson=require(_0xdfa3('0xa'));var client=jayson[_0xdfa3('0xb')][_0xdfa3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53f5ca,_0x56b99f,_0x418c34){return new BPromise(function(_0x5afe71,_0x7fa0d4){return client['request'](_0x53f5ca,_0x418c34)[_0xdfa3('0xd')](function(_0x2debe5){logger[_0xdfa3('0xe')](_0xdfa3('0xf'),_0x56b99f,'request\x20sent');logger[_0xdfa3('0x10')](_0xdfa3('0x11'),_0x56b99f,_0xdfa3('0x12'),JSON[_0xdfa3('0x13')](_0x2debe5));if(_0x2debe5[_0xdfa3('0x14')]){if(_0x2debe5[_0xdfa3('0x14')]['code']===0x1f4){logger[_0xdfa3('0x14')](_0xdfa3('0xf'),_0x56b99f,_0x2debe5[_0xdfa3('0x14')]['message']);return _0x7fa0d4(_0x2debe5['error'][_0xdfa3('0x15')]);}logger[_0xdfa3('0x14')](_0xdfa3('0xf'),_0x56b99f,_0x2debe5[_0xdfa3('0x14')][_0xdfa3('0x15')]);return _0x5afe71(_0x2debe5[_0xdfa3('0x14')][_0xdfa3('0x15')]);}else{logger[_0xdfa3('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x56b99f,_0xdfa3('0x12'));_0x5afe71(_0x2debe5['result'][_0xdfa3('0x15')]);}})[_0xdfa3('0x16')](function(_0x5a77c6){logger[_0xdfa3('0x14')](_0xdfa3('0xf'),_0x56b99f,_0x5a77c6);_0x7fa0d4(_0x5a77c6);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index b794e69..19167cd 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(_0x3efbff,_0x3d6b69){var _0x3997e8=function(_0x3b7ecd){while(--_0x3b7ecd){_0x3efbff['push'](_0x3efbff['shift']());}};_0x3997e8(++_0x3d6b69);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x472d01,_0xfd3119){var _0x274773=function(_0x5eae38){while(--_0x5eae38){_0x472d01['push'](_0x472d01['shift']());}};_0x274773(++_0xfd3119);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ab4ca60..c1cfd35 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 _0x30d4=['INTEGER','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30d4,0xc1));var _0x430d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x30d4[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x430d('0x0'));module[_0x430d('0x1')]={'penalty':{'type':Sequelize[_0x430d('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x430d('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6069=['INTEGER','sequelize'];(function(_0x2394da,_0x577d19){var _0x5529ea=function(_0x155ae2){while(--_0x155ae2){_0x2394da['push'](_0x2394da['shift']());}};_0x5529ea(++_0x577d19);}(_0x6069,0x1af));var _0x9606=function(_0x401a6e,_0x1f0e4c){_0x401a6e=_0x401a6e-0x0;var _0x1f5ec6=_0x6069[_0x401a6e];return _0x1f5ec6;};'use strict';var Sequelize=require(_0x9606('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9606('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9606('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index cbd4c52..2f46367 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 _0x8fb5=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','api','bluebird','request-promise','path','rimraf'];(function(_0x4a54f6,_0x2ad4d7){var _0x2e2f31=function(_0x5d2d09){while(--_0x5d2d09){_0x4a54f6['push'](_0x4a54f6['shift']());}};_0x2e2f31(++_0x2ad4d7);}(_0x8fb5,0x7e));var _0x58fb=function(_0x49870c,_0x4d2e2b){_0x49870c=_0x49870c-0x0;var _0x2c98f5=_0x8fb5[_0x49870c];return _0x2c98f5;};'use strict';var _=require('lodash');var util=require(_0x58fb('0x0'));var logger=require('../../config/logger')(_0x58fb('0x1'));var moment=require('moment');var BPromise=require(_0x58fb('0x2'));var rp=require(_0x58fb('0x3'));var fs=require('fs');var path=require(_0x58fb('0x4'));var rimraf=require(_0x58fb('0x5'));var config=require(_0x58fb('0x6'));var attributes=require(_0x58fb('0x7'));module[_0x58fb('0x8')]=function(_0x222d39,_0x1f52bf){return _0x222d39[_0x58fb('0x9')](_0x58fb('0xa'),attributes,{'tableName':_0x58fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fe9=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','UserFaxQueue','user_has_fax_queues','util'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0x0fe9,0x16a));var _0x90fe=function(_0x1a93ce,_0x5aeeb1){_0x1a93ce=_0x1a93ce-0x0;var _0x28371e=_0x0fe9[_0x1a93ce];return _0x28371e;};'use strict';var _=require('lodash');var util=require(_0x90fe('0x0'));var logger=require(_0x90fe('0x1'))('api');var moment=require(_0x90fe('0x2'));var BPromise=require(_0x90fe('0x3'));var rp=require(_0x90fe('0x4'));var fs=require('fs');var path=require(_0x90fe('0x5'));var rimraf=require(_0x90fe('0x6'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0x90fe('0x7')]=function(_0x5b1c0b,_0x4f3346){return _0x5b1c0b[_0x90fe('0x8')](_0x90fe('0x9'),attributes,{'tableName':_0x90fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 46be29d..b72a79f 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 _0xbc57=['code','message','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x111a9d,_0x401ebf){var _0x52e632=function(_0x573703){while(--_0x573703){_0x111a9d['push'](_0x111a9d['shift']());}};_0x52e632(++_0x401ebf);}(_0xbc57,0x10d));var _0x7bc5=function(_0x110596,_0x1faae7){_0x110596=_0x110596-0x0;var _0x51fef2=_0xbc57[_0x110596];return _0x51fef2;};'use strict';var _=require('lodash');var util=require(_0x7bc5('0x0'));var moment=require('moment');var BPromise=require(_0x7bc5('0x1'));var rs=require(_0x7bc5('0x2'));var fs=require('fs');var Redis=require(_0x7bc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7bc5('0x4'))(_0x7bc5('0x5'));var config=require(_0x7bc5('0x6'));var jayson=require(_0x7bc5('0x7'));var client=jayson['client'][_0x7bc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x342c1b,_0x5b1cb5,_0x46b80a){return new BPromise(function(_0x267234,_0x2d140b){return client[_0x7bc5('0x9')](_0x342c1b,_0x46b80a)[_0x7bc5('0xa')](function(_0x194988){logger[_0x7bc5('0xb')](_0x7bc5('0xc'),_0x5b1cb5,_0x7bc5('0xd'));logger[_0x7bc5('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5b1cb5,'request\x20sent',JSON['stringify'](_0x194988));if(_0x194988[_0x7bc5('0xf')]){if(_0x194988['error'][_0x7bc5('0x10')]===0x1f4){logger['error'](_0x7bc5('0xc'),_0x5b1cb5,_0x194988[_0x7bc5('0xf')][_0x7bc5('0x11')]);return _0x2d140b(_0x194988[_0x7bc5('0xf')]['message']);}logger[_0x7bc5('0xf')](_0x7bc5('0xc'),_0x5b1cb5,_0x194988[_0x7bc5('0xf')][_0x7bc5('0x11')]);return _0x267234(_0x194988[_0x7bc5('0xf')][_0x7bc5('0x11')]);}else{logger[_0x7bc5('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x5b1cb5,_0x7bc5('0xd'));_0x267234(_0x194988['result'][_0x7bc5('0x11')]);}})[_0x7bc5('0x12')](function(_0x2540d3){logger[_0x7bc5('0xf')](_0x7bc5('0xc'),_0x5b1cb5,_0x2540d3);_0x2d140b(_0x2540d3);});});} \ No newline at end of file +var _0x20bb=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x1310b4,_0x5e54fd){var _0x300db7=function(_0x285a60){while(--_0x285a60){_0x1310b4['push'](_0x1310b4['shift']());}};_0x300db7(++_0x5e54fd);}(_0x20bb,0xb4));var _0xb20b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb20b('0x0'));var util=require(_0xb20b('0x1'));var moment=require(_0xb20b('0x2'));var BPromise=require(_0xb20b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb20b('0x4'));var db=require(_0xb20b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb20b('0x6'))('rpc');var config=require(_0xb20b('0x7'));var jayson=require(_0xb20b('0x8'));var client=jayson[_0xb20b('0x9')][_0xb20b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d92fb,_0x2b6337,_0x3da2d6){return new BPromise(function(_0x3ac7f1,_0xb426ba){return client[_0xb20b('0xb')](_0x4d92fb,_0x3da2d6)[_0xb20b('0xc')](function(_0xc3f6f5){logger[_0xb20b('0xd')](_0xb20b('0xe'),_0x2b6337,_0xb20b('0xf'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2b6337,_0xb20b('0xf'),JSON[_0xb20b('0x10')](_0xc3f6f5));if(_0xc3f6f5[_0xb20b('0x11')]){if(_0xc3f6f5['error']['code']===0x1f4){logger['error'](_0xb20b('0xe'),_0x2b6337,_0xc3f6f5[_0xb20b('0x11')][_0xb20b('0x12')]);return _0xb426ba(_0xc3f6f5[_0xb20b('0x11')][_0xb20b('0x12')]);}logger[_0xb20b('0x11')](_0xb20b('0xe'),_0x2b6337,_0xc3f6f5[_0xb20b('0x11')][_0xb20b('0x12')]);return _0x3ac7f1(_0xc3f6f5[_0xb20b('0x11')][_0xb20b('0x12')]);}else{logger[_0xb20b('0xd')](_0xb20b('0xe'),_0x2b6337,_0xb20b('0xf'));_0x3ac7f1(_0xc3f6f5[_0xb20b('0x13')][_0xb20b('0x12')]);}})['catch'](function(_0x148784){logger['error'](_0xb20b('0xe'),_0x2b6337,_0x148784);_0xb426ba(_0x148784);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index eb26e42..996cf9c 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(_0x42a7cd,_0x32f06c){var _0x1e482b=function(_0x21de87){while(--_0x21de87){_0x42a7cd['push'](_0x42a7cd['shift']());}};_0x1e482b(++_0x32f06c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3e99cb,_0x1d2fe0){var _0x1bc729=function(_0x40006f){while(--_0x40006f){_0x3e99cb['push'](_0x3e99cb['shift']());}};_0x1bc729(++_0x1d2fe0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 9ece1c2..694a345 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 _0x6a96=['exports','INTEGER','sequelize'];(function(_0x4b9b78,_0x1dc74a){var _0x330388=function(_0x49bcdc){while(--_0x49bcdc){_0x4b9b78['push'](_0x4b9b78['shift']());}};_0x330388(++_0x1dc74a);}(_0x6a96,0x77));var _0x66a9=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0x6a96[_0x2e41e2];return _0x2844d6;};'use strict';var Sequelize=require(_0x66a9('0x0'));module[_0x66a9('0x1')]={'penalty':{'type':Sequelize[_0x66a9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe248=['sequelize','INTEGER'];(function(_0x3d915e,_0x23ff3d){var _0x174227=function(_0x4fa42b){while(--_0x4fa42b){_0x3d915e['push'](_0x3d915e['shift']());}};_0x174227(++_0x23ff3d);}(_0xe248,0x1f0));var _0x8e24=function(_0x27db1d,_0x32fd8f){_0x27db1d=_0x27db1d-0x0;var _0x12c951=_0xe248[_0x27db1d];return _0x12c951;};'use strict';var Sequelize=require(_0x8e24('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8e24('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 3a4fb90..2ae9fc6 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 _0x6a06=['define','user_has_mail_queues','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x6a06,0x192));var _0x66a0=function(_0x29771f,_0x1189ae){_0x29771f=_0x29771f-0x0;var _0x279baf=_0x6a06[_0x29771f];return _0x279baf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66a0('0x0'))('api');var moment=require(_0x66a0('0x1'));var BPromise=require(_0x66a0('0x2'));var rp=require(_0x66a0('0x3'));var fs=require('fs');var path=require(_0x66a0('0x4'));var rimraf=require(_0x66a0('0x5'));var config=require(_0x66a0('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x66a0('0x7')]=function(_0x2cc0df,_0x160cee){return _0x2cc0df[_0x66a0('0x8')]('UserMailQueue',attributes,{'tableName':_0x66a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6da3=['rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','moment','bluebird'];(function(_0xd03c16,_0x4999d1){var _0x2d9e4c=function(_0x162c2f){while(--_0x162c2f){_0xd03c16['push'](_0xd03c16['shift']());}};_0x2d9e4c(++_0x4999d1);}(_0x6da3,0xf9));var _0x36da=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6da3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x36da('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x36da('0x1'));var BPromise=require(_0x36da('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x36da('0x3'));var config=require(_0x36da('0x4'));var attributes=require(_0x36da('0x5'));module['exports']=function(_0x2111b9,_0x2c98a2){return _0x2111b9[_0x36da('0x6')](_0x36da('0x7'),attributes,{'tableName':_0x36da('0x8'),'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 dceea96..c0b9fb2 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 _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(_0x3a9182,_0x3fd68d){var _0x4d556c=function(_0x1e5a35){while(--_0x1e5a35){_0x3a9182['push'](_0x3a9182['shift']());}};_0x4d556c(++_0x3fd68d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 +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(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x28b2b3,_0x3306b7){_0x28b2b3=_0x28b2b3-0x0;var _0xf68dab=_0x1cb9[_0x28b2b3];return _0xf68dab;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 96cf6de..e29ae9d 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 _0x8162=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','util','express'];(function(_0x12ebe0,_0x1cce07){var _0x1ccd93=function(_0x411f74){while(--_0x411f74){_0x12ebe0['push'](_0x12ebe0['shift']());}};_0x1ccd93(++_0x1cce07);}(_0x8162,0x127));var _0x2816=function(_0x2b0084,_0x358502){_0x2b0084=_0x2b0084-0x0;var _0x2ee121=_0x8162[_0x2b0084];return _0x2ee121;};'use strict';var multer=require('multer');var util=require(_0x2816('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2816('0x1'));var router=express[_0x2816('0x2')]();var fs_extra=require(_0x2816('0x3'));var auth=require(_0x2816('0x4'));var interaction=require(_0x2816('0x5'));var config=require(_0x2816('0x6'));var controller=require('./userNotification.controller');router[_0x2816('0x7')]('/',auth[_0x2816('0x8')](),controller[_0x2816('0x9')]);module[_0x2816('0xa')]=router; \ No newline at end of file +var _0xced4=['post','isAuthenticated','sendUserNotification','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x3f9b78,_0x588ee5){var _0x584c20=function(_0x2bd443){while(--_0x2bd443){_0x3f9b78['push'](_0x3f9b78['shift']());}};_0x584c20(++_0x588ee5);}(_0xced4,0x1cc));var _0x4ced=function(_0x4fab09,_0x2e343b){_0x4fab09=_0x4fab09-0x0;var _0xf457df=_0xced4[_0x4fab09];return _0xf457df;};'use strict';var multer=require(_0x4ced('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4ced('0x1'));var express=require('express');var router=express[_0x4ced('0x2')]();var fs_extra=require(_0x4ced('0x3'));var auth=require(_0x4ced('0x4'));var interaction=require(_0x4ced('0x5'));var config=require(_0x4ced('0x6'));var controller=require(_0x4ced('0x7'));router[_0x4ced('0x8')]('/',auth[_0x4ced('0x9')](),controller[_0x4ced('0xa')]);module[_0x4ced('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 6a7ce0c..c979edc 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 _0xf597=['STRING','BOOLEAN','sequelize'];(function(_0x2f19d1,_0x46c57b){var _0x13d741=function(_0x28efc0){while(--_0x28efc0){_0x2f19d1['push'](_0x2f19d1['shift']());}};_0x13d741(++_0x46c57b);}(_0xf597,0x18b));var _0x7f59=function(_0x925a5d,_0x4fd48f){_0x925a5d=_0x925a5d-0x0;var _0x44be50=_0xf597[_0x925a5d];return _0x44be50;};'use strict';var Sequelize=require(_0x7f59('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x7f59('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x7f59('0x1')]},'beep':{'type':Sequelize[_0x7f59('0x2')]}}; \ No newline at end of file +var _0x3185=['TEXT','BOOLEAN','sequelize','exports','STRING'];(function(_0x2610db,_0x454344){var _0x5d4d96=function(_0x3794de){while(--_0x3794de){_0x2610db['push'](_0x2610db['shift']());}};_0x5d4d96(++_0x454344);}(_0x3185,0xa7));var _0x5318=function(_0x50197a,_0x57630b){_0x50197a=_0x50197a-0x0;var _0x4c30df=_0x3185[_0x50197a];return _0x4c30df;};'use strict';var Sequelize=require(_0x5318('0x0'));module[_0x5318('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x5318('0x2')]},'recipientsId':{'type':Sequelize[_0x5318('0x3')]},'recipientsDescription':{'type':Sequelize[_0x5318('0x2')]},'beep':{'type':Sequelize[_0x5318('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 562a7cc..78a4af0 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 _0x0314=['./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','text','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','ids','replace','queue','Queue','all','union','flatten','findOne','getAgents','map','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x51f954,_0x344bec){var _0x186a2a=function(_0x13ce36){while(--_0x13ce36){_0x51f954['push'](_0x51f954['shift']());}};_0x186a2a(++_0x344bec);}(_0x0314,0x119));var _0x4031=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0314[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4031('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4031('0x1'));var rp=require(_0x4031('0x2'));var moment=require(_0x4031('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4031('0x4'));var util=require(_0x4031('0x5'));var path=require(_0x4031('0x6'));var sox=require(_0x4031('0x7'));var csv=require('to-csv');var ejs=require(_0x4031('0x8'));var fs=require('fs');var fs_extra=require(_0x4031('0x9'));var _=require('lodash');var squel=require(_0x4031('0xa'));var crypto=require(_0x4031('0xb'));var jsforce=require(_0x4031('0xc'));var deskjs=require(_0x4031('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4031('0xe'));var Papa=require(_0x4031('0xf'));var Redis=require(_0x4031('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4031('0x11'));var as=require(_0x4031('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4031('0x13'))(_0x4031('0x14'));var utils=require(_0x4031('0x15'));var config=require(_0x4031('0x16'));var licenseUtil=require(_0x4031('0x17'));var db=require(_0x4031('0x18'))['db'];config[_0x4031('0x19')]=_['defaults'](config[_0x4031('0x19')],{'host':_0x4031('0x1a'),'port':0x18eb});var socket=require(_0x4031('0x1b'))(new Redis(config[_0x4031('0x19')]));require(_0x4031('0x1c'))[_0x4031('0x1d')](socket);function respondWithStatusCode(_0x3a90bb,_0x3d03d7){_0x3d03d7=_0x3d03d7||0xcc;return function(_0x3401c2){if(_0x3401c2){return _0x3a90bb[_0x4031('0x1e')](_0x3d03d7);}return _0x3a90bb[_0x4031('0x1f')](_0x3d03d7)[_0x4031('0x20')]();};}function respondWithResult(_0x336e61,_0x33993a){_0x33993a=_0x33993a||0xc8;return function(_0x50f247){if(_0x50f247){return _0x336e61[_0x4031('0x1f')](_0x33993a)[_0x4031('0x21')](_0x50f247);}};}function respondWithFilteredResult(_0x55ac38,_0x41eaab){return function(_0x18891d){if(_0x18891d){var _0x2271d2=typeof _0x41eaab[_0x4031('0x22')]===_0x4031('0x23')&&typeof _0x41eaab[_0x4031('0x24')]===_0x4031('0x23');var _0x137ef1=_0x18891d[_0x4031('0x25')];var _0x345aaa=_0x2271d2?0x0:_0x41eaab['offset'];var _0xdbbd74=_0x2271d2?_0x18891d['count']:_0x41eaab[_0x4031('0x22')]+_0x41eaab[_0x4031('0x24')];var _0x19d3a2;if(_0xdbbd74>=_0x137ef1){_0xdbbd74=_0x137ef1;_0x19d3a2=0xc8;}else{_0x19d3a2=0xce;}_0x55ac38[_0x4031('0x1f')](_0x19d3a2);return _0x55ac38['set'](_0x4031('0x26'),_0x345aaa+'-'+_0xdbbd74+'/'+_0x137ef1)['json'](_0x18891d);}return null;};}function patchUpdates(_0x2975ff){return function(_0x560707){try{jsonpatch['apply'](_0x560707,_0x2975ff,!![]);}catch(_0x5b109a){return BPromise[_0x4031('0x27')](_0x5b109a);}return _0x560707['save']();};}function saveUpdates(_0x466951,_0x220b3c){return function(_0x191765){if(_0x191765){return _0x191765['update'](_0x466951)['then'](function(_0x4ef5b6){return _0x4ef5b6;});}return null;};}function removeEntity(_0x290238,_0x259f20){return function(_0x220f9b){if(_0x220f9b){return _0x220f9b[_0x4031('0x28')]()['then'](function(){_0x290238[_0x4031('0x1f')](0xcc)[_0x4031('0x20')]();});}};}function handleEntityNotFound(_0x482270,_0x54e5a7){return function(_0x37a7c5){if(!_0x37a7c5){_0x482270['sendStatus'](0x194);}return _0x37a7c5;};}function handleError(_0x4a6dea,_0xb7b7ea){_0xb7b7ea=_0xb7b7ea||0x1f4;return function(_0x25ebf4){logger[_0x4031('0x29')](_0x25ebf4[_0x4031('0x2a')]);if(_0x25ebf4['name']){delete _0x25ebf4[_0x4031('0x2b')];}_0x4a6dea['status'](_0xb7b7ea)[_0x4031('0x2c')](_0x25ebf4);};}exports[_0x4031('0x2d')]=function(_0x2a4054,_0x891eb4,_0x160bba){if(!_0x2a4054[_0x4031('0x2e')][_0x4031('0x2f')]('text')&&!_0x2a4054[_0x4031('0x2e')]['hasOwnProperty']('TemplateId')){throw new db['Sequelize']['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2a4054[_0x4031('0x2e')][_0x4031('0x2f')](_0x4031('0x30'))&&!_0x2a4054[_0x4031('0x2e')][_0x4031('0x2f')](_0x4031('0x31'))){throw new db[(_0x4031('0x32'))][(_0x4031('0x33'))](_0x4031('0x34'));}if(!_0x2a4054[_0x4031('0x2e')][_0x4031('0x2f')](_0x4031('0x35'))){throw new db['Sequelize'][(_0x4031('0x33'))](_0x4031('0x36'));}else{try{var _0x4413c0=JSON[_0x4031('0x37')](_0x2a4054[_0x4031('0x2e')][_0x4031('0x35')]);}catch(_0x1a8cf2){logger[_0x4031('0x29')](_0x1a8cf2);throw new db[(_0x4031('0x32'))][(_0x4031('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x569a8b=[_0x4031('0x38'),_0x4031('0x39'),_0x4031('0x3a'),_0x4031('0x3b'),_0x4031('0x3c'),_0x4031('0x3d'),_0x4031('0x3e'),_0x4031('0x3f'),'user'];if(_[_0x4031('0x40')](_0x4413c0,function(_0xea1ef3){return!_[_0x4031('0x41')](_0x569a8b,_0xea1ef3[_0x4031('0x42')][_0x4031('0x43')]());})){throw new db['Sequelize'][(_0x4031('0x33'))](_0x4031('0x44'));}}}var _0x4f2b09={};_0x4f2b09[_0x4031('0x45')]=_0x2a4054[_0x4031('0x2e')]['hasOwnProperty']('senderName')?_0x2a4054['body'][_0x4031('0x45')]:_0x2a4054['user']['fullname'];_0x4f2b09[_0x4031('0x46')]=_[_0x4031('0x47')](_0x2a4054[_0x4031('0x2e')][_0x4031('0x46')])?null:_0x2a4054['body']['recipientsDescription'];_0x4f2b09[_0x4031('0x48')]=_0x2a4054[_0x4031('0x2e')][_0x4031('0x48')]||![];_0x4f2b09[_0x4031('0x49')]=_0x2a4054['user']['id'];return getContent(_0x2a4054[_0x4031('0x2e')])['then'](function(_0x5bfa3e){_0x4f2b09[_0x4031('0x2e')]=_0x5bfa3e;return getRecipients(_0x4413c0);})[_0x4031('0x4a')](function(_0x1c8ffe){_0x4f2b09[_0x4031('0x4b')]=_[_0x4031('0x4c')](_0x1c8ffe)[_0x4031('0x4d')](',');return db[_0x4031('0x4e')][_0x4031('0x4f')](function(_0x1c7984){return db[_0x4031('0x50')][_0x4031('0x51')](_0x4f2b09,{'raw':!![],'transaction':_0x1c7984})[_0x4031('0x4a')](function(_0x26f545){var _0x32b060={'sender':_0x4f2b09[_0x4031('0x45')],'description':_0x4f2b09[_0x4031('0x46')],'content':_0x4f2b09['body'],'beep':_0x4f2b09[_0x4031('0x48')]};_0x1c8ffe['forEach'](function(_0x62ff29){_0x32b060[_0x4031('0x52')]=_0x62ff29;socket[_0x4031('0x53')](_0x4031('0x54'),_0x32b060);});return _0x26f545;});});})['then'](respondWithResult(_0x891eb4,0xc9))[_0x4031('0x55')](handleError(_0x891eb4,null));};function getContent(_0x34c6d1){return new BPromise(function(_0x91d7cf,_0x3d9c5a){if(_0x34c6d1[_0x4031('0x56')]){_0x91d7cf(_0x34c6d1['text']);return;}return db[_0x4031('0x57')]['findOne']({'attributes':[_0x4031('0x58')],'where':{'id':_0x34c6d1[_0x4031('0x30')]},'raw':!![]})[_0x4031('0x4a')](function(_0x4a9e34){if(!_0x4a9e34)throw new db[(_0x4031('0x32'))][(_0x4031('0x33'))](_0x4031('0x59'));var _0x3f4c6c=Mustache[_0x4031('0x5a')](_0x4a9e34['html'],_0x34c6d1[_0x4031('0x31')]);_0x91d7cf(_0x3f4c6c);})[_0x4031('0x55')](function(_0x4f02f9){_0x3d9c5a(_0x4f02f9);});});}function getRecipients(_0x4b9fe9){return new BPromise(function(_0x1bcbce,_0x59f516){var _0x1a8600=[];var _0x14374a=[];_0x4b9fe9[_0x4031('0x5b')](function(_0x2f19a4){var _0x414914=_[_0x4031('0x5c')](_0x2f19a4[_0x4031('0x42')][_0x4031('0x43')]());if(_0x414914==='User'){_0x1a8600=_['union'](_0x1a8600,_0x2f19a4[_0x4031('0x5d')]);}else{if(_[_0x4031('0x41')](_0x414914,'queue'))_0x414914=_0x414914[_0x4031('0x5e')](_0x4031('0x5f'),_0x4031('0x60'));_0x2f19a4['ids'][_0x4031('0x5b')](function(_0x596b27){_0x14374a['push'](getAgents(_0x414914,_0x596b27));});}});return BPromise[_0x4031('0x61')](_0x14374a)[_0x4031('0x4a')](function(_0x5bae35){_0x1a8600=_[_0x4031('0x62')](_0x1a8600,_[_0x4031('0x63')](_0x5bae35));_0x1bcbce(_0x1a8600);})[_0x4031('0x55')](function(_0x2fbef0){_0x59f516(_0x2fbef0);});});}function getAgents(_0x47ea2,_0x3ae8ae){return new BPromise(function(_0x22d718,_0x1322ad){return db[_0x47ea2][_0x4031('0x64')]({'where':{'id':_0x3ae8ae}})[_0x4031('0x4a')](function(_0x47f98e){return _0x47f98e[_0x4031('0x65')]({'attributes':['id'],'raw':!![]})[_0x4031('0x4a')](function(_0x9d499b){var _0x18829f=_[_0x4031('0x66')](_0x9d499b,'id');_0x22d718(_0x18829f);});})['catch'](function(_0x496f9b){_0x1322ad(_0x496f9b);});});} \ No newline at end of file +var _0x123b=['fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','sendStatus','end','json','offset','undefined','count','status','reject','update','then','error','stack','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','catch','User','ids','queue','replace','Queue','push','all','union','flatten','getAgents','map','eml-format','rimraf'];(function(_0x34d07c,_0x4e491e){var _0x132342=function(_0x4b18f0){while(--_0x4b18f0){_0x34d07c['push'](_0x34d07c['shift']());}};_0x132342(++_0x4e491e);}(_0x123b,0x1de));var _0xb123=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x123b[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0xb123('0x0'));var rimraf=require(_0xb123('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb123('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb123('0x3'));var Mustache=require(_0xb123('0x4'));var util=require(_0xb123('0x5'));var path=require(_0xb123('0x6'));var sox=require(_0xb123('0x7'));var csv=require(_0xb123('0x8'));var ejs=require(_0xb123('0x9'));var fs=require('fs');var fs_extra=require(_0xb123('0xa'));var _=require(_0xb123('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb123('0xc'));var toCsv=require(_0xb123('0x8'));var querystring=require('querystring');var Papa=require(_0xb123('0xd'));var Redis=require(_0xb123('0xe'));var authService=require(_0xb123('0xf'));var qs=require(_0xb123('0x10'));var as=require(_0xb123('0x11'));var hardwareService=require(_0xb123('0x12'));var logger=require(_0xb123('0x13'))(_0xb123('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb123('0x15'));var db=require(_0xb123('0x16'))['db'];config[_0xb123('0x17')]=_['defaults'](config[_0xb123('0x17')],{'host':_0xb123('0x18'),'port':0x18eb});var socket=require(_0xb123('0x19'))(new Redis(config[_0xb123('0x17')]));require(_0xb123('0x1a'))['register'](socket);function respondWithStatusCode(_0x562a72,_0x3c6c27){_0x3c6c27=_0x3c6c27||0xcc;return function(_0x241cdb){if(_0x241cdb){return _0x562a72[_0xb123('0x1b')](_0x3c6c27);}return _0x562a72['status'](_0x3c6c27)[_0xb123('0x1c')]();};}function respondWithResult(_0x4beeb1,_0xe85973){_0xe85973=_0xe85973||0xc8;return function(_0x43dd86){if(_0x43dd86){return _0x4beeb1['status'](_0xe85973)[_0xb123('0x1d')](_0x43dd86);}};}function respondWithFilteredResult(_0x7158b3,_0x3d38b4){return function(_0x5444e6){if(_0x5444e6){var _0x15dd23=typeof _0x3d38b4[_0xb123('0x1e')]===_0xb123('0x1f')&&typeof _0x3d38b4['limit']===_0xb123('0x1f');var _0x527541=_0x5444e6[_0xb123('0x20')];var _0x58a42a=_0x15dd23?0x0:_0x3d38b4['offset'];var _0x1dc84a=_0x15dd23?_0x5444e6[_0xb123('0x20')]:_0x3d38b4[_0xb123('0x1e')]+_0x3d38b4['limit'];var _0x27cb04;if(_0x1dc84a>=_0x527541){_0x1dc84a=_0x527541;_0x27cb04=0xc8;}else{_0x27cb04=0xce;}_0x7158b3[_0xb123('0x21')](_0x27cb04);return _0x7158b3['set']('Content-Range',_0x58a42a+'-'+_0x1dc84a+'/'+_0x527541)[_0xb123('0x1d')](_0x5444e6);}return null;};}function patchUpdates(_0x1c6678){return function(_0x14d45f){try{jsonpatch['apply'](_0x14d45f,_0x1c6678,!![]);}catch(_0x31ac72){return BPromise[_0xb123('0x22')](_0x31ac72);}return _0x14d45f['save']();};}function saveUpdates(_0x1078d5,_0x23581c){return function(_0x2dabfc){if(_0x2dabfc){return _0x2dabfc[_0xb123('0x23')](_0x1078d5)['then'](function(_0x331765){return _0x331765;});}return null;};}function removeEntity(_0x3504d8,_0x502509){return function(_0x7ef348){if(_0x7ef348){return _0x7ef348['destroy']()[_0xb123('0x24')](function(){_0x3504d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2e99,_0x5805cc){return function(_0x528d64){if(!_0x528d64){_0x4c2e99[_0xb123('0x1b')](0x194);}return _0x528d64;};}function handleError(_0xfe740d,_0x2f010c){_0x2f010c=_0x2f010c||0x1f4;return function(_0x19df71){logger[_0xb123('0x25')](_0x19df71[_0xb123('0x26')]);if(_0x19df71['name']){delete _0x19df71['name'];}_0xfe740d['status'](_0x2f010c)[_0xb123('0x27')](_0x19df71);};}exports[_0xb123('0x28')]=function(_0x3ec537,_0x30e42f,_0x2f23dc){if(!_0x3ec537[_0xb123('0x29')][_0xb123('0x2a')](_0xb123('0x2b'))&&!_0x3ec537[_0xb123('0x29')][_0xb123('0x2a')](_0xb123('0x2c'))){throw new db['Sequelize'][(_0xb123('0x2d'))](_0xb123('0x2e'));}else{if(_0x3ec537['body'][_0xb123('0x2a')](_0xb123('0x2c'))&&!_0x3ec537[_0xb123('0x29')][_0xb123('0x2a')](_0xb123('0x2f'))){throw new db['Sequelize'][(_0xb123('0x2d'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x3ec537[_0xb123('0x29')][_0xb123('0x2a')]('recipients')){throw new db[(_0xb123('0x30'))][(_0xb123('0x2d'))](_0xb123('0x31'));}else{try{var _0x409137=JSON[_0xb123('0x32')](_0x3ec537[_0xb123('0x29')][_0xb123('0x33')]);}catch(_0x5841df){logger['error'](_0x5841df);throw new db[(_0xb123('0x30'))][(_0xb123('0x2d'))](_0xb123('0x34'));}var _0x2d0767=[_0xb123('0x35'),_0xb123('0x36'),_0xb123('0x37'),_0xb123('0x38'),'smsqueue',_0xb123('0x39'),'whatsappqueue',_0xb123('0x3a'),_0xb123('0x3b')];if(_[_0xb123('0x3c')](_0x409137,function(_0x15a0e7){return!_[_0xb123('0x3d')](_0x2d0767,_0x15a0e7[_0xb123('0x3e')][_0xb123('0x3f')]());})){throw new db[(_0xb123('0x30'))][(_0xb123('0x2d'))](_0xb123('0x40'));}}}var _0x16d30b={};_0x16d30b[_0xb123('0x41')]=_0x3ec537[_0xb123('0x29')][_0xb123('0x2a')]('senderName')?_0x3ec537[_0xb123('0x29')]['senderName']:_0x3ec537[_0xb123('0x3b')][_0xb123('0x42')];_0x16d30b[_0xb123('0x43')]=_[_0xb123('0x44')](_0x3ec537[_0xb123('0x29')]['recipientsDescription'])?null:_0x3ec537[_0xb123('0x29')][_0xb123('0x43')];_0x16d30b[_0xb123('0x45')]=_0x3ec537['body'][_0xb123('0x45')]||![];_0x16d30b[_0xb123('0x46')]=_0x3ec537[_0xb123('0x3b')]['id'];return getContent(_0x3ec537[_0xb123('0x29')])['then'](function(_0x3ef666){_0x16d30b['body']=_0x3ef666;return getRecipients(_0x409137);})['then'](function(_0x2cb23c){_0x16d30b[_0xb123('0x47')]=_['sortBy'](_0x2cb23c)[_0xb123('0x48')](',');return db[_0xb123('0x49')][_0xb123('0x4a')](function(_0x214a55){return db['UserNotification'][_0xb123('0x4b')](_0x16d30b,{'raw':!![],'transaction':_0x214a55})[_0xb123('0x24')](function(_0x530f15){var _0x10ba9d={'sender':_0x16d30b[_0xb123('0x41')],'description':_0x16d30b['recipientsDescription'],'content':_0x16d30b[_0xb123('0x29')],'beep':_0x16d30b[_0xb123('0x45')]};_0x2cb23c[_0xb123('0x4c')](function(_0x46140d){_0x10ba9d[_0xb123('0x4d')]=_0x46140d;socket[_0xb123('0x4e')](_0xb123('0x4f'),_0x10ba9d);});return _0x530f15;});});})[_0xb123('0x24')](respondWithResult(_0x30e42f,0xc9))['catch'](handleError(_0x30e42f,null));};function getContent(_0x4af162){return new BPromise(function(_0x3a8718,_0x249811){if(_0x4af162[_0xb123('0x2b')]){_0x3a8718(_0x4af162[_0xb123('0x2b')]);return;}return db['Template'][_0xb123('0x50')]({'attributes':['html'],'where':{'id':_0x4af162[_0xb123('0x2c')]},'raw':!![]})[_0xb123('0x24')](function(_0x2e6ba7){if(!_0x2e6ba7)throw new db[(_0xb123('0x30'))][(_0xb123('0x2d'))](_0xb123('0x51'));var _0x5bbe99=Mustache[_0xb123('0x52')](_0x2e6ba7[_0xb123('0x53')],_0x4af162[_0xb123('0x2f')]);_0x3a8718(_0x5bbe99);})[_0xb123('0x54')](function(_0x55c62f){_0x249811(_0x55c62f);});});}function getRecipients(_0x1fe575){return new BPromise(function(_0x3ae9f8,_0x5ad295){var _0x16a74c=[];var _0x13a610=[];_0x1fe575['forEach'](function(_0x3cbe6c){var _0x5dba87=_['startCase'](_0x3cbe6c[_0xb123('0x3e')][_0xb123('0x3f')]());if(_0x5dba87===_0xb123('0x55')){_0x16a74c=_['union'](_0x16a74c,_0x3cbe6c[_0xb123('0x56')]);}else{if(_[_0xb123('0x3d')](_0x5dba87,_0xb123('0x57')))_0x5dba87=_0x5dba87[_0xb123('0x58')](_0xb123('0x57'),_0xb123('0x59'));_0x3cbe6c[_0xb123('0x56')][_0xb123('0x4c')](function(_0x2267b1){_0x13a610[_0xb123('0x5a')](getAgents(_0x5dba87,_0x2267b1));});}});return BPromise[_0xb123('0x5b')](_0x13a610)[_0xb123('0x24')](function(_0x1c517d){_0x16a74c=_[_0xb123('0x5c')](_0x16a74c,_[_0xb123('0x5d')](_0x1c517d));_0x3ae9f8(_0x16a74c);})[_0xb123('0x54')](function(_0x107d0a){_0x5ad295(_0x107d0a);});});}function getAgents(_0x20095e,_0x5254a3){return new BPromise(function(_0x513a43,_0x4ec7fb){return db[_0x20095e]['findOne']({'where':{'id':_0x5254a3}})[_0xb123('0x24')](function(_0x2bc603){return _0x2bc603[_0xb123('0x5e')]({'attributes':['id'],'raw':!![]})[_0xb123('0x24')](function(_0x174edb){var _0x4bb224=_[_0xb123('0x5f')](_0x174edb,'id');_0x513a43(_0x4bb224);});})['catch'](function(_0x4e5f21){_0x4ec7fb(_0x4e5f21);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index aa6ae57..a387906 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 _0xb443=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x15e381,_0x433bc6){var _0xc37e16=function(_0x1a7a32){while(--_0x1a7a32){_0x15e381['push'](_0x15e381['shift']());}};_0xc37e16(++_0x433bc6);}(_0xb443,0xcf));var _0x3b44=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xb443[_0x2d34d6];return _0x1d3d12;};'use strict';var EventEmitter=require(_0x3b44('0x0'));var UserNotification=require(_0x3b44('0x1'))['db'][_0x3b44('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3b44('0x3')](0x0);var events={'afterCreate':_0x3b44('0x4'),'afterUpdate':'update','afterDestroy':_0x3b44('0x5')};function emitEvent(_0x2ed192){return function(_0x2d7999,_0x26267c,_0x51ff66){UserNotificationEvents[_0x3b44('0x6')](_0x2ed192+':'+_0x2d7999['id'],_0x2d7999);UserNotificationEvents['emit'](_0x2ed192,_0x2d7999);_0x51ff66(null);};}for(var e in events){if(events[_0x3b44('0x7')](e)){var event=events[e];UserNotification[_0x3b44('0x8')](e,emitEvent(event));}}module[_0x3b44('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x41c0=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners','update'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x41c0,0x136));var _0x041c=function(_0x331639,_0x3ceeaa){_0x331639=_0x331639-0x0;var _0x5420ea=_0x41c0[_0x331639];return _0x5420ea;};'use strict';var EventEmitter=require(_0x041c('0x0'));var UserNotification=require(_0x041c('0x1'))['db'][_0x041c('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x041c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x041c('0x4'),'afterDestroy':_0x041c('0x5')};function emitEvent(_0x3ccfb8){return function(_0x31c7f5,_0x5930f6,_0x58e554){UserNotificationEvents['emit'](_0x3ccfb8+':'+_0x31c7f5['id'],_0x31c7f5);UserNotificationEvents[_0x041c('0x6')](_0x3ccfb8,_0x31c7f5);_0x58e554(null);};}for(var e in events){if(events[_0x041c('0x7')](e)){var event=events[e];UserNotification[_0x041c('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index ed8de45..5401759 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 _0xef3a=['path','rimraf','../../config/environment','./userNotification.attributes','define','userNotifications','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3d2183,_0x76a00f){var _0x297b3e=function(_0x197c92){while(--_0x197c92){_0x3d2183['push'](_0x3d2183['shift']());}};_0x297b3e(++_0x76a00f);}(_0xef3a,0x157));var _0xaef3=function(_0x200aa5,_0x197802){_0x200aa5=_0x200aa5-0x0;var _0x458200=_0xef3a[_0x200aa5];return _0x458200;};'use strict';var _=require('lodash');var util=require(_0xaef3('0x0'));var logger=require(_0xaef3('0x1'))('api');var moment=require(_0xaef3('0x2'));var BPromise=require(_0xaef3('0x3'));var rp=require(_0xaef3('0x4'));var fs=require('fs');var path=require(_0xaef3('0x5'));var rimraf=require(_0xaef3('0x6'));var config=require(_0xaef3('0x7'));var attributes=require(_0xaef3('0x8'));module['exports']=function(_0x340aa6,_0xf95191){return _0x340aa6[_0xaef3('0x9')]('UserNotification',attributes,{'tableName':_0xaef3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaef3('0xb')});}; \ No newline at end of file +var _0x3754=['request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','utf8mb4_unicode_ci','util'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x3754,0xfb));var _0x4375=function(_0x51ff93,_0x26f8c3){_0x51ff93=_0x51ff93-0x0;var _0x1258da=_0x3754[_0x51ff93];return _0x1258da;};'use strict';var _=require('lodash');var util=require(_0x4375('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4375('0x1'));var fs=require('fs');var path=require(_0x4375('0x2'));var rimraf=require(_0x4375('0x3'));var config=require(_0x4375('0x4'));var attributes=require(_0x4375('0x5'));module[_0x4375('0x6')]=function(_0x43c71b,_0x2c41d6){return _0x43c71b['define'](_0x4375('0x7'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4375('0x8')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 16e461b..82f0492 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 _0x2c4d=['localhost','./userNotification.socket','register','request','info','request\x20sent','debug','stringify','error','code','message','UserNotification,\x20%s,\x20%s','result','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x5c4d27,_0x5b0822){var _0x1dda1a=function(_0x5ea638){while(--_0x5ea638){_0x5c4d27['push'](_0x5c4d27['shift']());}};_0x1dda1a(++_0x5b0822);}(_0x2c4d,0x1f0));var _0xd2c4=function(_0xa741fa,_0x14b888){_0xa741fa=_0xa741fa-0x0;var _0xfa882c=_0x2c4d[_0xa741fa];return _0xfa882c;};'use strict';var _=require(_0xd2c4('0x0'));var util=require(_0xd2c4('0x1'));var moment=require(_0xd2c4('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2c4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd2c4('0x5'));var config=require(_0xd2c4('0x6'));var jayson=require(_0xd2c4('0x7'));var client=jayson[_0xd2c4('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xd2c4('0x9')],{'host':_0xd2c4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd2c4('0xb'))[_0xd2c4('0xc')](socket);function respondWithRpcPromise(_0xb36136,_0x430b01,_0x501088){return new BPromise(function(_0xc868bc,_0x5711f2){return client[_0xd2c4('0xd')](_0xb36136,_0x501088)['then'](function(_0x4b6222){logger[_0xd2c4('0xe')]('UserNotification,\x20%s,\x20%s',_0x430b01,_0xd2c4('0xf'));logger[_0xd2c4('0x10')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x430b01,_0xd2c4('0xf'),JSON[_0xd2c4('0x11')](_0x4b6222));if(_0x4b6222[_0xd2c4('0x12')]){if(_0x4b6222[_0xd2c4('0x12')][_0xd2c4('0x13')]===0x1f4){logger[_0xd2c4('0x12')]('UserNotification,\x20%s,\x20%s',_0x430b01,_0x4b6222['error'][_0xd2c4('0x14')]);return _0x5711f2(_0x4b6222['error'][_0xd2c4('0x14')]);}logger[_0xd2c4('0x12')](_0xd2c4('0x15'),_0x430b01,_0x4b6222[_0xd2c4('0x12')][_0xd2c4('0x14')]);return _0xc868bc(_0x4b6222[_0xd2c4('0x12')][_0xd2c4('0x14')]);}else{logger[_0xd2c4('0xe')](_0xd2c4('0x15'),_0x430b01,_0xd2c4('0xf'));_0xc868bc(_0x4b6222[_0xd2c4('0x16')][_0xd2c4('0x14')]);}})['catch'](function(_0x2768c4){logger['error'](_0xd2c4('0x15'),_0x430b01,_0x2768c4);_0x5711f2(_0x2768c4);});});} \ No newline at end of file +var _0x770b=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0x770b,0x123));var _0xb770=function(_0x479372,_0x1bb4d3){_0x479372=_0x479372-0x0;var _0x3a9b00=_0x770b[_0x479372];return _0x3a9b00;};'use strict';var _=require('lodash');var util=require(_0xb770('0x0'));var moment=require(_0xb770('0x1'));var BPromise=require(_0xb770('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb770('0x3'))['db'];var utils=require(_0xb770('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb770('0x5'));var jayson=require(_0xb770('0x6'));var client=jayson[_0xb770('0x7')][_0xb770('0x8')]({'port':0x232a});config[_0xb770('0x9')]=_[_0xb770('0xa')](config['redis'],{'host':_0xb770('0xb'),'port':0x18eb});var socket=require(_0xb770('0xc'))(new Redis(config[_0xb770('0x9')]));require(_0xb770('0xd'))[_0xb770('0xe')](socket);function respondWithRpcPromise(_0x26a1c4,_0x28491f,_0x2cf49e){return new BPromise(function(_0x2cbe2c,_0x44ebe3){return client[_0xb770('0xf')](_0x26a1c4,_0x2cf49e)[_0xb770('0x10')](function(_0x4300e7){logger[_0xb770('0x11')](_0xb770('0x12'),_0x28491f,_0xb770('0x13'));logger[_0xb770('0x14')](_0xb770('0x15'),_0x28491f,_0xb770('0x13'),JSON[_0xb770('0x16')](_0x4300e7));if(_0x4300e7[_0xb770('0x17')]){if(_0x4300e7[_0xb770('0x17')]['code']===0x1f4){logger[_0xb770('0x17')]('UserNotification,\x20%s,\x20%s',_0x28491f,_0x4300e7[_0xb770('0x17')][_0xb770('0x18')]);return _0x44ebe3(_0x4300e7[_0xb770('0x17')][_0xb770('0x18')]);}logger[_0xb770('0x17')](_0xb770('0x12'),_0x28491f,_0x4300e7['error'][_0xb770('0x18')]);return _0x2cbe2c(_0x4300e7['error'][_0xb770('0x18')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x28491f,_0xb770('0x13'));_0x2cbe2c(_0x4300e7[_0xb770('0x19')][_0xb770('0x18')]);}})[_0xb770('0x1a')](function(_0xac0d6){logger[_0xb770('0x17')](_0xb770('0x12'),_0x28491f,_0xac0d6);_0x44ebe3(_0xac0d6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 9933d8f..d78fdab 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 _0xdf77=['./userNotification.events','save','update','register','length','userNotification:'];(function(_0x353738,_0x23d396){var _0x336ed8=function(_0x20937f){while(--_0x20937f){_0x353738['push'](_0x353738['shift']());}};_0x336ed8(++_0x23d396);}(_0xdf77,0x174));var _0x7df7=function(_0x3c30a4,_0x152fd6){_0x3c30a4=_0x3c30a4-0x0;var _0x4f3e14=_0xdf77[_0x3c30a4];return _0x4f3e14;};'use strict';var UserNotificationEvents=require(_0x7df7('0x0'));var events=[_0x7df7('0x1'),'remove',_0x7df7('0x2')];function createListener(_0x4791b6,_0x495bc0){return function(_0x55e5d9){_0x495bc0['emit'](_0x4791b6,_0x55e5d9);};}function removeListener(_0x161060,_0x10ae95){return function(){UserNotificationEvents['removeListener'](_0x161060,_0x10ae95);};}exports[_0x7df7('0x3')]=function(_0x2b908e){for(var _0x461dbd=0x0,_0x2fecad=events[_0x7df7('0x4')];_0x461dbd<_0x2fecad;_0x461dbd++){var _0x16f3aa=events[_0x461dbd];var _0x5c114a=createListener(_0x7df7('0x5')+_0x16f3aa,_0x2b908e);UserNotificationEvents['on'](_0x16f3aa,_0x5c114a);}}; \ No newline at end of file +var _0x6d00=['./userNotification.events','save','remove','update','removeListener','length','userNotification:'];(function(_0x304622,_0x4d073f){var _0x32b0a0=function(_0x281b6b){while(--_0x281b6b){_0x304622['push'](_0x304622['shift']());}};_0x32b0a0(++_0x4d073f);}(_0x6d00,0xd9));var _0x06d0=function(_0x1c7377,_0x8a8698){_0x1c7377=_0x1c7377-0x0;var _0x5d03e3=_0x6d00[_0x1c7377];return _0x5d03e3;};'use strict';var UserNotificationEvents=require(_0x06d0('0x0'));var events=[_0x06d0('0x1'),_0x06d0('0x2'),_0x06d0('0x3')];function createListener(_0x473c63,_0x1db4d9){return function(_0x42b7e9){_0x1db4d9['emit'](_0x473c63,_0x42b7e9);};}function removeListener(_0xde50ec,_0x3d5b12){return function(){UserNotificationEvents[_0x06d0('0x4')](_0xde50ec,_0x3d5b12);};}exports['register']=function(_0x3985fb){for(var _0x12da2e=0x0,_0x182634=events[_0x06d0('0x5')];_0x12da2e<_0x182634;_0x12da2e++){var _0x1502c9=events[_0x12da2e];var _0x12970f=createListener(_0x06d0('0x6')+_0x1502c9,_0x3985fb);UserNotificationEvents['on'](_0x1502c9,_0x12970f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c8cb562..811b58a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3ea5ce,_0x4f9b61){var _0x20e180=function(_0x22702c){while(--_0x22702c){_0x3ea5ce['push'](_0x3ea5ce['shift']());}};_0x20e180(++_0x4f9b61);}(_0xe706,0xa3));var _0x6e70=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0xe706[_0x3c59fc];return _0x2b78d4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5474f6,_0x5b5e5e){var _0x11cc8e=function(_0x277ec9){while(--_0x277ec9){_0x5474f6['push'](_0x5474f6['shift']());}};_0x11cc8e(++_0x5b5e5e);}(_0xe706,0xa3));var _0x6e70=function(_0x3dc6f4,_0x362e2a){_0x3dc6f4=_0x3dc6f4-0x0;var _0x3b18e9=_0xe706[_0x3dc6f4];return _0x3b18e9;};'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 5299339..e44e87a 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 _0xd436=['INTEGER','exports'];(function(_0x33cd28,_0x548ed6){var _0x20476d=function(_0x28fff0){while(--_0x28fff0){_0x33cd28['push'](_0x33cd28['shift']());}};_0x20476d(++_0x548ed6);}(_0xd436,0x1af));var _0x6d43=function(_0x1275e8,_0x40ab85){_0x1275e8=_0x1275e8-0x0;var _0x2bfdbd=_0xd436[_0x1275e8];return _0x2bfdbd;};'use strict';var Sequelize=require('sequelize');module[_0x6d43('0x0')]={'penalty':{'type':Sequelize[_0x6d43('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3232=['sequelize','INTEGER'];(function(_0x126bb0,_0xf021a4){var _0x31b548=function(_0x195779){while(--_0x195779){_0x126bb0['push'](_0x126bb0['shift']());}};_0x31b548(++_0xf021a4);}(_0x3232,0x178));var _0x2323=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x3232[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x2323('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2323('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index d4df42c..33fb017 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 _0xd13d=['request-promise','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x5a9206,_0x5a3833){var _0x49f7fe=function(_0x3d68b9){while(--_0x3d68b9){_0x5a9206['push'](_0x5a9206['shift']());}};_0x49f7fe(++_0x5a3833);}(_0xd13d,0xe3));var _0xdd13=function(_0x229ac2,_0x4f9ae5){_0x229ac2=_0x229ac2-0x0;var _0x4cc6d8=_0xd13d[_0x229ac2];return _0x4cc6d8;};'use strict';var _=require(_0xdd13('0x0'));var util=require(_0xdd13('0x1'));var logger=require(_0xdd13('0x2'))(_0xdd13('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd13('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd13('0x5'));var config=require('../../config/environment');var attributes=require(_0xdd13('0x6'));module[_0xdd13('0x7')]=function(_0x1a4c21,_0x382162){return _0x1a4c21[_0xdd13('0x8')](_0xdd13('0x9'),attributes,{'tableName':_0xdd13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0c8=['path','rimraf','../../config/environment','define','user_has_openchannel_queues','lodash','api','moment','bluebird','request-promise'];(function(_0x59f5fe,_0x4524ed){var _0x398bd2=function(_0x148eda){while(--_0x148eda){_0x59f5fe['push'](_0x59f5fe['shift']());}};_0x398bd2(++_0x4524ed);}(_0xc0c8,0x16d));var _0x8c0c=function(_0x2f91db,_0x3b979a){_0x2f91db=_0x2f91db-0x0;var _0x1f22cf=_0xc0c8[_0x2f91db];return _0x1f22cf;};'use strict';var _=require(_0x8c0c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c0c('0x1'));var moment=require(_0x8c0c('0x2'));var BPromise=require(_0x8c0c('0x3'));var rp=require(_0x8c0c('0x4'));var fs=require('fs');var path=require(_0x8c0c('0x5'));var rimraf=require(_0x8c0c('0x6'));var config=require(_0x8c0c('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x26910f,_0x2f5b86){return _0x26910f[_0x8c0c('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0x8c0c('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 613780c..d6d3273 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 _0x2836=['UserOpenchannelQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x50f398,_0x5a8ce8){var _0x1f8fea=function(_0x1c1692){while(--_0x1c1692){_0x50f398['push'](_0x50f398['shift']());}};_0x1f8fea(++_0x5a8ce8);}(_0x2836,0xa4));var _0x6283=function(_0x106b33,_0x52f65){_0x106b33=_0x106b33-0x0;var _0x6c1fee=_0x2836[_0x106b33];return _0x6c1fee;};'use strict';var _=require(_0x6283('0x0'));var util=require(_0x6283('0x1'));var moment=require(_0x6283('0x2'));var BPromise=require(_0x6283('0x3'));var rs=require(_0x6283('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6283('0x5'))['db'];var utils=require(_0x6283('0x6'));var logger=require('../../config/logger')(_0x6283('0x7'));var config=require(_0x6283('0x8'));var jayson=require(_0x6283('0x9'));var client=jayson[_0x6283('0xa')][_0x6283('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38bc44,_0x309113,_0x34b5cf){return new BPromise(function(_0x3c55fd,_0x43e528){return client['request'](_0x38bc44,_0x34b5cf)[_0x6283('0xc')](function(_0x493b78){logger[_0x6283('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x309113,_0x6283('0xe'));logger[_0x6283('0xf')](_0x6283('0x10'),_0x309113,'request\x20sent',JSON[_0x6283('0x11')](_0x493b78));if(_0x493b78[_0x6283('0x12')]){if(_0x493b78[_0x6283('0x12')][_0x6283('0x13')]===0x1f4){logger['error'](_0x6283('0x14'),_0x309113,_0x493b78[_0x6283('0x12')][_0x6283('0x15')]);return _0x43e528(_0x493b78['error']['message']);}logger['error'](_0x6283('0x14'),_0x309113,_0x493b78['error'][_0x6283('0x15')]);return _0x3c55fd(_0x493b78['error'][_0x6283('0x15')]);}else{logger[_0x6283('0xd')](_0x6283('0x14'),_0x309113,_0x6283('0xe'));_0x3c55fd(_0x493b78[_0x6283('0x16')][_0x6283('0x15')]);}})['catch'](function(_0x3e251a){logger[_0x6283('0x12')](_0x6283('0x14'),_0x309113,_0x3e251a);_0x43e528(_0x3e251a);});});} \ No newline at end of file +var _0x0cae=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a4dc,_0x2bd7c7){var _0x49000f=function(_0x2246e7){while(--_0x2246e7){_0x20a4dc['push'](_0x20a4dc['shift']());}};_0x49000f(++_0x2bd7c7);}(_0x0cae,0xa4));var _0xe0ca=function(_0xb74a3d,_0x8c160f){_0xb74a3d=_0xb74a3d-0x0;var _0x47fcfa=_0x0cae[_0xb74a3d];return _0x47fcfa;};'use strict';var _=require(_0xe0ca('0x0'));var util=require(_0xe0ca('0x1'));var moment=require('moment');var BPromise=require(_0xe0ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0ca('0x3'));var db=require(_0xe0ca('0x4'))['db'];var utils=require(_0xe0ca('0x5'));var logger=require(_0xe0ca('0x6'))(_0xe0ca('0x7'));var config=require(_0xe0ca('0x8'));var jayson=require(_0xe0ca('0x9'));var client=jayson[_0xe0ca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213b96,_0x5c0a0d,_0xe5b6dc){return new BPromise(function(_0x56fd34,_0x53a0e4){return client[_0xe0ca('0xb')](_0x213b96,_0xe5b6dc)[_0xe0ca('0xc')](function(_0x4f5d86){logger[_0xe0ca('0xd')](_0xe0ca('0xe'),_0x5c0a0d,_0xe0ca('0xf'));logger[_0xe0ca('0x10')](_0xe0ca('0x11'),_0x5c0a0d,'request\x20sent',JSON[_0xe0ca('0x12')](_0x4f5d86));if(_0x4f5d86['error']){if(_0x4f5d86[_0xe0ca('0x13')]['code']===0x1f4){logger['error'](_0xe0ca('0xe'),_0x5c0a0d,_0x4f5d86[_0xe0ca('0x13')]['message']);return _0x53a0e4(_0x4f5d86[_0xe0ca('0x13')][_0xe0ca('0x14')]);}logger['error'](_0xe0ca('0xe'),_0x5c0a0d,_0x4f5d86['error'][_0xe0ca('0x14')]);return _0x56fd34(_0x4f5d86[_0xe0ca('0x13')][_0xe0ca('0x14')]);}else{logger[_0xe0ca('0xd')](_0xe0ca('0xe'),_0x5c0a0d,'request\x20sent');_0x56fd34(_0x4f5d86[_0xe0ca('0x15')][_0xe0ca('0x14')]);}})[_0xe0ca('0x16')](function(_0xe72f04){logger[_0xe0ca('0x13')](_0xe0ca('0xe'),_0x5c0a0d,_0xe72f04);_0x53a0e4(_0xe72f04);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 4e850f7..b567b02 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 _0xc421=['isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc421,0x88));var _0x1c42=function(_0x18eb27,_0xbe423){_0x18eb27=_0x18eb27-0x0;var _0x9468e4=_0xc421[_0x18eb27];return _0x9468e4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c42('0x0'));var timeout=require(_0x1c42('0x1'));var express=require(_0x1c42('0x2'));var router=express[_0x1c42('0x3')]();var fs_extra=require(_0x1c42('0x4'));var auth=require(_0x1c42('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1c42('0x6'));var controller=require(_0x1c42('0x7'));router[_0x1c42('0x8')]('/',auth[_0x1c42('0x9')](),controller['index']);router[_0x1c42('0x8')](_0x1c42('0xa'),auth[_0x1c42('0x9')](),controller[_0x1c42('0xb')]);router[_0x1c42('0x8')](_0x1c42('0xc'),auth[_0x1c42('0x9')](),controller[_0x1c42('0xd')]);router[_0x1c42('0x8')](_0x1c42('0xe'),auth['isAuthenticated'](),controller[_0x1c42('0xf')]);router['get'](_0x1c42('0x10'),auth[_0x1c42('0x9')](),controller[_0x1c42('0x11')]);router['post']('/',auth[_0x1c42('0x9')](),controller['create']);router[_0x1c42('0x12')](_0x1c42('0x13'),auth[_0x1c42('0x9')](),controller[_0x1c42('0x14')]);router['post']('/:id/sections',auth['isAuthenticated'](),controller[_0x1c42('0x15')]);router[_0x1c42('0x12')](_0x1c42('0x10'),auth[_0x1c42('0x9')](),controller[_0x1c42('0x16')]);router[_0x1c42('0x17')](_0x1c42('0xc'),auth[_0x1c42('0x9')](),controller[_0x1c42('0x18')]);router[_0x1c42('0x19')](_0x1c42('0xc'),auth[_0x1c42('0x9')](),controller[_0x1c42('0x1a')]);router['delete']('/:id/sections',auth[_0x1c42('0x9')](),controller[_0x1c42('0x1b')]);router['delete']('/:id/resources',auth[_0x1c42('0x9')](),controller['removeResources']);module[_0x1c42('0x1c')]=router; \ No newline at end of file +var _0x54c4=['../../components/interaction/service','../../config/environment','./userProfile.controller','get','describe','show','/:id/sections','isAuthenticated','getResources','create','post','clone','addResources','put','update','delete','destroy','removeSections','/:id/resources','removeResources','exports','multer','path','connect-timeout','../../components/auth/service'];(function(_0x467009,_0x27dbe5){var _0x1ab09c=function(_0x329b68){while(--_0x329b68){_0x467009['push'](_0x467009['shift']());}};_0x1ab09c(++_0x27dbe5);}(_0x54c4,0xdd));var _0x454c=function(_0x2efe85,_0x4b56b8){_0x2efe85=_0x2efe85-0x0;var _0x43d749=_0x54c4[_0x2efe85];return _0x43d749;};'use strict';var multer=require(_0x454c('0x0'));var util=require('util');var path=require(_0x454c('0x1'));var timeout=require(_0x454c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x454c('0x3'));var interaction=require(_0x454c('0x4'));var config=require(_0x454c('0x5'));var controller=require(_0x454c('0x6'));router[_0x454c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x454c('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x454c('0x9')]);router['get'](_0x454c('0xa'),auth['isAuthenticated'](),controller['getSections']);router[_0x454c('0x7')]('/:id/resources',auth[_0x454c('0xb')](),controller[_0x454c('0xc')]);router['post']('/',auth[_0x454c('0xb')](),controller[_0x454c('0xd')]);router[_0x454c('0xe')]('/:id/clone',auth[_0x454c('0xb')](),controller[_0x454c('0xf')]);router[_0x454c('0xe')](_0x454c('0xa'),auth['isAuthenticated'](),controller['addSections']);router[_0x454c('0xe')]('/:id/resources',auth[_0x454c('0xb')](),controller[_0x454c('0x10')]);router[_0x454c('0x11')]('/:id',auth[_0x454c('0xb')](),controller[_0x454c('0x12')]);router[_0x454c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x454c('0x14')]);router[_0x454c('0x13')](_0x454c('0xa'),auth[_0x454c('0xb')](),controller[_0x454c('0x15')]);router[_0x454c('0x13')](_0x454c('0x16'),auth[_0x454c('0xb')](),controller[_0x454c('0x17')]);module[_0x454c('0x18')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index d16b35f..ae94543 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 _0xa409=['exports','STRING','name','crudPermissions','join','split','BOOLEAN','sequelize'];(function(_0x3526e6,_0x53e376){var _0x30faf1=function(_0x3aac24){while(--_0x3aac24){_0x3526e6['push'](_0x3526e6['shift']());}};_0x30faf1(++_0x53e376);}(_0xa409,0xef));var _0x9a40=function(_0x29994c,_0x45b8af){_0x29994c=_0x29994c-0x0;var _0x5b9cf8=_0xa409[_0x29994c];return _0x5b9cf8;};'use strict';var Sequelize=require(_0x9a40('0x0'));module[_0x9a40('0x1')]={'name':{'type':Sequelize[_0x9a40('0x2')],'allowNull':![],'unique':_0x9a40('0x3')},'crudPermissions':{'type':Sequelize[_0x9a40('0x2')],'set':function(_0x27702b){this['setDataValue'](_0x9a40('0x4'),_0x27702b?_0x27702b[_0x9a40('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x9a40('0x4'))?this['getDataValue']('crudPermissions')[_0x9a40('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9a40('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9a40('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9a40('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9a40('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9a40('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9a40('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9a40('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9a40('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x87b3=['crudPermissions','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x87b3,0x1bc));var _0x387b=function(_0x4bc927,_0x25e1da){_0x4bc927=_0x4bc927-0x0;var _0x4f08a8=_0x87b3[_0x4bc927];return _0x4f08a8;};'use strict';var Sequelize=require(_0x387b('0x0'));module[_0x387b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x387b('0x2')},'crudPermissions':{'type':Sequelize[_0x387b('0x3')],'set':function(_0xf27877){this['setDataValue'](_0x387b('0x4'),_0xf27877?_0xf27877['join'](''):[]);},'get':function(){return this['getDataValue'](_0x387b('0x4'))?this[_0x387b('0x5')]('crudPermissions')[_0x387b('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x387b('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x387b('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x387b('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x387b('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x387b('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x387b('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x387b('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x387b('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1292955..17dbe3a 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 _0x81ea=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','clone','omit','createdAt','crudPermissions','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','updatedAt','userProfileId','Resources','describe','addSections','sectionId','push','ids','getSections','enabled','includes','isEmpty','subsections','concat','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x81ea,0xe0));var _0xa81e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x81ea[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa81e('0x0'));var zipdir=require(_0xa81e('0x1'));var jsonpatch=require(_0xa81e('0x2'));var rp=require(_0xa81e('0x3'));var moment=require('moment');var BPromise=require(_0xa81e('0x4'));var Mustache=require(_0xa81e('0x5'));var util=require(_0xa81e('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa81e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa81e('0x8'));var jsforce=require(_0xa81e('0x9'));var deskjs=require(_0xa81e('0xa'));var toCsv=require(_0xa81e('0xb'));var querystring=require(_0xa81e('0xc'));var Papa=require('papaparse');var Redis=require(_0xa81e('0xd'));var authService=require(_0xa81e('0xe'));var qs=require(_0xa81e('0xf'));var as=require(_0xa81e('0x10'));var hardwareService=require(_0xa81e('0x11'));var logger=require('../../config/logger')(_0xa81e('0x12'));var utils=require(_0xa81e('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa81e('0x14')]=_[_0xa81e('0x15')](config[_0xa81e('0x14')],{'host':_0xa81e('0x16'),'port':0x18eb});var socket=require(_0xa81e('0x17'))(new Redis(config[_0xa81e('0x14')]));require(_0xa81e('0x18'))['register'](socket);function respondWithStatusCode(_0x1960b9,_0x525b7b){_0x525b7b=_0x525b7b||0xcc;return function(_0x212b29){if(_0x212b29){return _0x1960b9['sendStatus'](_0x525b7b);}return _0x1960b9[_0xa81e('0x19')](_0x525b7b)[_0xa81e('0x1a')]();};}function respondWithResult(_0x107fc3,_0x428773){_0x428773=_0x428773||0xc8;return function(_0x438f8b){if(_0x438f8b){return _0x107fc3[_0xa81e('0x19')](_0x428773)[_0xa81e('0x1b')](_0x438f8b);}};}function respondWithFilteredResult(_0x3bcc57,_0x5cc6a2){return function(_0x230fa0){if(_0x230fa0){var _0x1da20b=typeof _0x5cc6a2['offset']===_0xa81e('0x1c')&&typeof _0x5cc6a2['limit']==='undefined';var _0x4d26e0=_0x230fa0[_0xa81e('0x1d')];var _0xe861d3=_0x1da20b?0x0:_0x5cc6a2[_0xa81e('0x1e')];var _0xb304bb=_0x1da20b?_0x230fa0[_0xa81e('0x1d')]:_0x5cc6a2[_0xa81e('0x1e')]+_0x5cc6a2[_0xa81e('0x1f')];var _0x196bbb;if(_0xb304bb>=_0x4d26e0){_0xb304bb=_0x4d26e0;_0x196bbb=0xc8;}else{_0x196bbb=0xce;}_0x3bcc57[_0xa81e('0x19')](_0x196bbb);return _0x3bcc57['set'](_0xa81e('0x20'),_0xe861d3+'-'+_0xb304bb+'/'+_0x4d26e0)[_0xa81e('0x1b')](_0x230fa0);}return null;};}function patchUpdates(_0x489bfd){return function(_0x3aabb4){try{jsonpatch[_0xa81e('0x21')](_0x3aabb4,_0x489bfd,!![]);}catch(_0x13a20e){return BPromise['reject'](_0x13a20e);}return _0x3aabb4[_0xa81e('0x22')]();};}function saveUpdates(_0x46604e,_0x26ff25){return function(_0x36ce43){if(_0x36ce43){return _0x36ce43[_0xa81e('0x23')](_0x46604e)['then'](function(_0x956740){return _0x956740;});}return null;};}function removeEntity(_0x2c31bc,_0x2fd673){return function(_0x5ea2bd){if(_0x5ea2bd){return _0x5ea2bd[_0xa81e('0x24')]()[_0xa81e('0x25')](function(){_0x2c31bc[_0xa81e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bf01e,_0x328e88){return function(_0x536d03){if(!_0x536d03){_0x5bf01e[_0xa81e('0x26')](0x194);}return _0x536d03;};}function handleError(_0x217cf8,_0x272c30){_0x272c30=_0x272c30||0x1f4;return function(_0x4fd282){logger[_0xa81e('0x27')](_0x4fd282[_0xa81e('0x28')]);if(_0x4fd282[_0xa81e('0x29')]){delete _0x4fd282[_0xa81e('0x29')];}_0x217cf8[_0xa81e('0x19')](_0x272c30)[_0xa81e('0x2a')](_0x4fd282);};}exports['index']=function(_0x4f4a82,_0x516faa){var _0x1caf01={},_0x340176={},_0x9c0ec5={'count':0x0,'rows':[]};var _0xd4e8a6=_[_0xa81e('0x2b')](db[_0xa81e('0x2c')][_0xa81e('0x2d')],function(_0x5cbfea){return{'name':_0x5cbfea[_0xa81e('0x2e')],'type':_0x5cbfea['type'][_0xa81e('0x2f')]};});_0x340176[_0xa81e('0x30')]=_[_0xa81e('0x2b')](_0xd4e8a6,_0xa81e('0x29'));_0x340176[_0xa81e('0x31')]=_['keys'](_0x4f4a82['query']);_0x340176[_0xa81e('0x32')]=_[_0xa81e('0x33')](_0x340176['model'],_0x340176['query']);_0x1caf01[_0xa81e('0x34')]=_[_0xa81e('0x33')](_0x340176['model'],qs[_0xa81e('0x35')](_0x4f4a82['query']['fields']));_0x1caf01[_0xa81e('0x34')]=_0x1caf01[_0xa81e('0x34')][_0xa81e('0x36')]?_0x1caf01['attributes']:_0x340176[_0xa81e('0x30')];if(!_0x4f4a82[_0xa81e('0x31')][_0xa81e('0x37')]('nolimit')){_0x1caf01[_0xa81e('0x1f')]=qs[_0xa81e('0x1f')](_0x4f4a82['query'][_0xa81e('0x1f')]);_0x1caf01['offset']=qs[_0xa81e('0x1e')](_0x4f4a82[_0xa81e('0x31')][_0xa81e('0x1e')]);}_0x1caf01[_0xa81e('0x38')]=qs[_0xa81e('0x39')](_0x4f4a82[_0xa81e('0x31')][_0xa81e('0x39')]);_0x1caf01['where']=qs['filters'](_[_0xa81e('0x3a')](_0x4f4a82[_0xa81e('0x31')],_0x340176[_0xa81e('0x32')]),_0xd4e8a6);if(_0x4f4a82[_0xa81e('0x31')][_0xa81e('0x3b')]){_0x1caf01[_0xa81e('0x3c')]=_['merge'](_0x1caf01[_0xa81e('0x3c')],{'$or':_[_0xa81e('0x2b')](_0xd4e8a6,function(_0x4fd479){if(_0x4fd479[_0xa81e('0x3d')]!=='VIRTUAL'){var _0x4e9033={};_0x4e9033[_0x4fd479[_0xa81e('0x29')]]={'$like':'%'+_0x4f4a82['query'][_0xa81e('0x3b')]+'%'};return _0x4e9033;}})});}_0x1caf01=_[_0xa81e('0x3e')]({},_0x1caf01,_0x4f4a82[_0xa81e('0x3f')]);var _0x2e2fa3={'where':_0x1caf01[_0xa81e('0x3c')]};return db[_0xa81e('0x2c')]['count'](_0x2e2fa3)[_0xa81e('0x25')](function(_0x4dc1eb){_0x9c0ec5[_0xa81e('0x1d')]=_0x4dc1eb;if(_0x4f4a82[_0xa81e('0x31')][_0xa81e('0x40')]){_0x1caf01[_0xa81e('0x41')]=[{'all':!![]}];}return db['UserProfile'][_0xa81e('0x42')](_0x1caf01);})['then'](function(_0x1097ca){_0x9c0ec5[_0xa81e('0x43')]=_0x1097ca;return _0x9c0ec5;})[_0xa81e('0x25')](respondWithFilteredResult(_0x516faa,_0x1caf01))['catch'](handleError(_0x516faa,null));};exports[_0xa81e('0x44')]=function(_0x3df11e,_0x991ab3){var _0x10e5fa={'raw':![],'where':{'id':_0x3df11e[_0xa81e('0x45')]['id']}},_0x5afbff={};_0x5afbff[_0xa81e('0x30')]=_[_0xa81e('0x46')](db[_0xa81e('0x2c')][_0xa81e('0x2d')]);_0x5afbff[_0xa81e('0x31')]=_['keys'](_0x3df11e[_0xa81e('0x31')]);_0x5afbff[_0xa81e('0x32')]=_[_0xa81e('0x33')](_0x5afbff[_0xa81e('0x30')],_0x5afbff[_0xa81e('0x31')]);_0x10e5fa['attributes']=_[_0xa81e('0x33')](_0x5afbff['model'],qs[_0xa81e('0x35')](_0x3df11e[_0xa81e('0x31')][_0xa81e('0x35')]));_0x10e5fa[_0xa81e('0x34')]=_0x10e5fa[_0xa81e('0x34')][_0xa81e('0x36')]?_0x10e5fa[_0xa81e('0x34')]:_0x5afbff['model'];if(_0x3df11e[_0xa81e('0x31')][_0xa81e('0x40')]){_0x10e5fa[_0xa81e('0x41')]=[{'all':!![]}];}_0x10e5fa=_[_0xa81e('0x3e')]({},_0x10e5fa,_0x3df11e['options']);return db[_0xa81e('0x2c')][_0xa81e('0x47')](_0x10e5fa)['then'](handleEntityNotFound(_0x991ab3,null))[_0xa81e('0x25')](respondWithResult(_0x991ab3,null))['catch'](handleError(_0x991ab3,null));};exports[_0xa81e('0x48')]=function(_0x2edddf,_0x2c11fc){return db[_0xa81e('0x2c')][_0xa81e('0x48')](_0x2edddf[_0xa81e('0x49')],{})['then'](respondWithResult(_0x2c11fc,0xc9))[_0xa81e('0x4a')](handleError(_0x2c11fc,null));};exports[_0xa81e('0x4b')]=function(_0x4906c4,_0x99f635){var _0x539e0c={'where':{'id':_0x4906c4[_0xa81e('0x45')]['id']}},_0x5549c0={};_0x5549c0['model']=_[_0xa81e('0x46')](db[_0xa81e('0x2c')]['rawAttributes']);_0x539e0c['attributes']=_[_0xa81e('0x33')](_0x5549c0[_0xa81e('0x30')],qs[_0xa81e('0x35')](_0x4906c4[_0xa81e('0x31')][_0xa81e('0x35')]));_0x539e0c[_0xa81e('0x34')]=_0x539e0c[_0xa81e('0x34')][_0xa81e('0x36')]?_0x539e0c[_0xa81e('0x34')]:_0x5549c0[_0xa81e('0x30')];if(_0x4906c4[_0xa81e('0x31')][_0xa81e('0x40')]){_0x539e0c[_0xa81e('0x41')]=[{'all':!![]}];}_0x539e0c=_[_0xa81e('0x3e')]({},_0x539e0c,_0x4906c4[_0xa81e('0x3f')]);return db['UserProfile'][_0xa81e('0x47')](_0x539e0c)[_0xa81e('0x25')](handleEntityNotFound(_0x99f635,null))[_0xa81e('0x25')](function(_0x251122){if(_0x251122){var _0x289434=_0x251122['get']({'plain':!![]});_0x289434=qs[_0xa81e('0x4c')](_0x289434,['id',_0xa81e('0x4d'),'updatedAt',_0xa81e('0x4e')]);_0x4906c4[_0xa81e('0x49')]=_['omit'](_0x4906c4[_0xa81e('0x49')],['id',_0xa81e('0x4d'),'updatedAt']);return db[_0xa81e('0x4f')][_0xa81e('0x50')](function(_0x492ca8){return db[_0xa81e('0x2c')][_0xa81e('0x48')](_['merge'](_0x289434,_0x4906c4[_0xa81e('0x49')]),{'include':_0x4906c4[_0xa81e('0x31')][_0xa81e('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x492ca8})[_0xa81e('0x25')](function(_0x4b8637){var _0x47e99c=_0x4b8637[_0xa81e('0x51')]({'plain':!![]});return db[_0xa81e('0x52')]['findAll']({'where':{'userProfileId':_0x4906c4[_0xa81e('0x45')]['id']},'raw':!![]})['then'](function(_0x554ac2){if(_0x554ac2){return BPromise[_0xa81e('0x53')](_0x554ac2,function(_0x311784){return new BPromise(function(_0xa55159,_0x10ffd9){if(_0x311784[_0xa81e('0x54')]===null||_0x311784[_0xa81e('0x54')]===0x1)_0xa55159(null);return db[_0xa81e('0x55')][_0xa81e('0x42')]({'where':{'sectionId':_0x311784['id']},'raw':!![]})['then'](function(_0x1bd5a8){var _0x75a5b5=_[_0xa81e('0x2b')](_0x1bd5a8,function(_0xf03712){return qs[_0xa81e('0x4c')](_0xf03712,['id',_0xa81e('0x4d'),_0xa81e('0x56'),'sectionId']);});_0xa55159(_0x75a5b5);})[_0xa81e('0x4a')](function(_0x5c0448){_0x10ffd9(_0x5c0448);});})[_0xa81e('0x25')](function(_0x57c91f){var _0x4f8d62=qs[_0xa81e('0x4c')](_0x311784,['id','createdAt',_0xa81e('0x56')]);_0x4f8d62[_0xa81e('0x57')]=_0x47e99c['id'];if(_0x57c91f)_0x4f8d62[_0xa81e('0x58')]=_0x57c91f;return _0x4f8d62;})[_0xa81e('0x25')](function(_0x246d99){return db['UserProfileSection'][_0xa81e('0x48')](_0x246d99,{'include':[{'model':db[_0xa81e('0x55')],'as':_0xa81e('0x58')}],'raw':!![],'transaction':_0x492ca8});});})[_0xa81e('0x25')](function(){return _0x47e99c;});}});});});}})[_0xa81e('0x25')](respondWithResult(_0x99f635,0xc9))[_0xa81e('0x4a')](handleError(_0x99f635,null));};exports[_0xa81e('0x23')]=function(_0x5e12b0,_0x50ce78){if(_0x5e12b0[_0xa81e('0x49')]['id']){delete _0x5e12b0['body']['id'];}return db['UserProfile'][_0xa81e('0x47')]({'where':{'id':_0x5e12b0[_0xa81e('0x45')]['id']}})['then'](handleEntityNotFound(_0x50ce78,null))[_0xa81e('0x25')](saveUpdates(_0x5e12b0[_0xa81e('0x49')],null))[_0xa81e('0x25')](respondWithResult(_0x50ce78,null))[_0xa81e('0x4a')](handleError(_0x50ce78,null));};exports[_0xa81e('0x24')]=function(_0x47d8cf,_0x5a3428){return db['UserProfile'][_0xa81e('0x47')]({'where':{'id':_0x47d8cf[_0xa81e('0x45')]['id']}})[_0xa81e('0x25')](handleEntityNotFound(_0x5a3428,null))[_0xa81e('0x25')](removeEntity(_0x5a3428,null))[_0xa81e('0x4a')](handleError(_0x5a3428,null));};exports[_0xa81e('0x59')]=function(_0x175cd0,_0x28516f){return db[_0xa81e('0x2c')][_0xa81e('0x59')]()[_0xa81e('0x25')](respondWithResult(_0x28516f,null))[_0xa81e('0x4a')](handleError(_0x28516f,null));};exports[_0xa81e('0x5a')]=function(_0x5b9006,_0x1b2db6){var _0x480ea9=_0x5b9006[_0xa81e('0x49')];return db[_0xa81e('0x2c')][_0xa81e('0x47')]({'where':{'id':_0x5b9006[_0xa81e('0x45')]['id']}})[_0xa81e('0x25')](handleEntityNotFound(_0x1b2db6,null))[_0xa81e('0x25')](function(_0x5793fb){if(_0x5793fb){return db[_0xa81e('0x4f')]['transaction'](function(_0x30c5a8){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x5b9006[_0xa81e('0x45')]['id'],'sectionId':_[_0xa81e('0x2b')](_0x480ea9,function(_0x44fe12){return _0x44fe12[_0xa81e('0x5b')];})},'transaction':_0x30c5a8})[_0xa81e('0x25')](function(){var _0x2204e9=_[_0xa81e('0x2b')](_0x480ea9,function(_0x59ac00){_0x59ac00[_0xa81e('0x57')]=_0x5b9006[_0xa81e('0x45')]['id'];return _0x59ac00;});var _0xde2ffb=[];return BPromise['each'](_0x2204e9,function(_0x5edec6){return db['UserProfileSection'][_0xa81e('0x48')](_0x5edec6,{'include':[{'model':db[_0xa81e('0x55')],'as':_0xa81e('0x58')}],'raw':!![],'transaction':_0x30c5a8})[_0xa81e('0x25')](function(_0x12c351){_0xde2ffb[_0xa81e('0x5c')](_0x12c351['get']({'plain':!![]}));});})[_0xa81e('0x25')](function(){return _0xde2ffb;});});});}})[_0xa81e('0x25')](function(_0x2d9cdf){return _0x2d9cdf;})['then'](respondWithResult(_0x1b2db6,null))[_0xa81e('0x4a')](handleError(_0x1b2db6,null));};exports['removeSections']=function(_0x928a3e,_0x36aa7f){var _0x2ecdad;return db[_0xa81e('0x2c')][_0xa81e('0x47')]({'where':{'id':_0x928a3e[_0xa81e('0x45')]['id']},'attributes':['id',_0xa81e('0x29')]})[_0xa81e('0x25')](handleEntityNotFound(_0x36aa7f,null))[_0xa81e('0x25')](function(_0x570e7b){if(_0x570e7b){_0x2ecdad=_0x570e7b;return db[_0xa81e('0x52')][_0xa81e('0x24')]({'where':{'userProfileId':_0x928a3e[_0xa81e('0x45')]['id'],'sectionId':_0x928a3e['query'][_0xa81e('0x5d')]}});}})[_0xa81e('0x25')](function(){return _0x2ecdad;})[_0xa81e('0x25')](respondWithStatusCode(_0x36aa7f,null))[_0xa81e('0x4a')](handleError(_0x36aa7f,null));};exports[_0xa81e('0x5e')]=function(_0x49f215,_0x301a5c){var _0x5bba4f=[];var _0x4a543b=[];return db['UserProfileSection'][_0xa81e('0x42')]({'where':{'userProfileId':_0x49f215[_0xa81e('0x45')]['id']},'raw':!![]})[_0xa81e('0x25')](function(_0x164590){_0x5bba4f=_[_0xa81e('0x3b')](_0x164590,function(_0xbe4348){return _0xbe4348[_0xa81e('0x5f')]===0x1||_[_0xa81e('0x60')]([0x3eb,0x709],_0xbe4348[_0xa81e('0x5b')]);});if(!_[_0xa81e('0x61')](_0x5bba4f)){return _[_0xa81e('0x2b')](_0x5bba4f,function(_0x134122){return _0x134122[_0xa81e('0x5b')];});}else{return;}})[_0xa81e('0x25')](function(_0x539ef0){if(_0x539ef0)_0x4a543b=_0x539ef0;if(_[_0xa81e('0x60')](_0x4a543b,0x64)){var _0x16a0a4=_[_0xa81e('0x47')](_0x5bba4f,{'sectionId':0x64});return hasDefaultDashboard(_0x16a0a4)['then'](function(_0x1f4b20){return _['map'](_0x5bba4f,function(_0x44b3c8){if(_0x44b3c8[_0xa81e('0x5b')]===0x64){_0x44b3c8[_0xa81e('0x62')]=_0x1f4b20;}return _0x44b3c8;});});}else{return;}})[_0xa81e('0x25')](function(_0x440d3e){if(_0x440d3e)_0x5bba4f=_0x440d3e;if(_['includes'](_0x4a543b,0x3eb)){var _0x57e33f=_['find'](_0x5bba4f,{'sectionId':0x3eb});return getCustomDashboards(_0x57e33f)[_0xa81e('0x25')](function(_0xe1e1f){return _['map'](_0x5bba4f,function(_0x4430e5){if(_0x57e33f[_0xa81e('0x5f')]){if(_0x4430e5['sectionId']===0x3eb){_0x4430e5[_0xa81e('0x62')]=_0xe1e1f;}}else{if(_0x4430e5['sectionId']===0x64){if(!_0x4430e5[_0xa81e('0x62')]){_0x4430e5[_0xa81e('0x62')]=[];}_0x4430e5[_0xa81e('0x62')]=_0x4430e5[_0xa81e('0x62')][_0xa81e('0x63')](_0xe1e1f);}}return _0x4430e5;});});}else{return;}})['then'](function(_0x56fd25){if(_0x56fd25)_0x5bba4f=_0x56fd25;if(_[_0xa81e('0x60')](_0x4a543b,0x709)){var _0x1c69d3=_[_0xa81e('0x47')](_0x5bba4f,{'sectionId':0x709});return getPlugins(_0x1c69d3)[_0xa81e('0x25')](function(_0x5d5a17){if(_0x1c69d3[_0xa81e('0x5f')]){return _[_0xa81e('0x2b')](_0x5bba4f,function(_0x4a2ee7){if(_0x4a2ee7[_0xa81e('0x5b')]===0x709){_0x4a2ee7[_0xa81e('0x62')]=_0x5d5a17;}return _0x4a2ee7;});}else{var _0x80e7c4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5d5a17};var _0x5b1462=_['map'](_0x5bba4f);_0x5b1462[_0xa81e('0x5c')](_0x80e7c4);return _0x5b1462;}});}else{return;}})[_0xa81e('0x25')](function(_0x3c6c82){if(_0x3c6c82)_0x5bba4f=_0x3c6c82;return _[_0xa81e('0x3b')](_0x5bba4f,[_0xa81e('0x5f'),0x1]);})['then'](respondWithResult(_0x301a5c,null))['catch'](handleError(_0x301a5c,null));};function hasDefaultDashboard(_0x7f928a){var _0xef48dd=[0x65];return new BPromise(function(_0x32fa36,_0x1db5a1){try{if(_0x7f928a[_0xa81e('0x54')]){_0x32fa36(_0xef48dd);}else{return db[_0xa81e('0x55')]['findOne']({'where':{'sectionId':_0x7f928a['id']},'raw':!![]})['then'](function(_0x2006e6){_0x2006e6?_0x32fa36(_0xef48dd):_0x32fa36();});}}catch(_0x32ef0f){_0x1db5a1(_0x32ef0f);}});}function getCustomDashboards(_0xbad022){var _0x19212b=[];return new BPromise(function(_0x53f8a6,_0x1b6fc9){try{if(_0xbad022[_0xa81e('0x54')]){return db[_0xa81e('0x64')][_0xa81e('0x42')]({'raw':!![]})[_0xa81e('0x25')](function(_0x2d3f56){_0x2d3f56[_0xa81e('0x65')](function(_0x406b99){_0x19212b[_0xa81e('0x5c')](_0x406b99['id']+0x1869f);});_0x53f8a6(_0x19212b);});}else{return db[_0xa81e('0x55')][_0xa81e('0x42')]({'where':{'sectionId':_0xbad022['id']},'raw':!![]})[_0xa81e('0x25')](function(_0x438be6){_0x438be6[_0xa81e('0x65')](function(_0x2bf67b){_0x19212b[_0xa81e('0x5c')](_0x2bf67b[_0xa81e('0x66')]+0x1869f);});_0x53f8a6(_0x19212b);});}}catch(_0x4f45f4){_0x1b6fc9(_0x4f45f4);}});}function getPlugins(_0x2cfac3){var _0xc66229=[];return new BPromise(function(_0x32b7f3,_0x1c688c){try{if(_0x2cfac3[_0xa81e('0x54')]){return db[_0xa81e('0x67')]['findAll']({'raw':!![]})[_0xa81e('0x25')](function(_0x5cd4cd){_0x5cd4cd[_0xa81e('0x65')](function(_0x3f586d){_0xc66229[_0xa81e('0x5c')](_0x3f586d['id']+0x15b38);});_0x32b7f3(_0xc66229);});}else{return db[_0xa81e('0x55')][_0xa81e('0x42')]({'where':{'sectionId':_0x2cfac3['id']},'raw':!![]})['then'](function(_0x1a1f4a){_0x1a1f4a[_0xa81e('0x65')](function(_0x26322b){_0xc66229[_0xa81e('0x5c')](_0x26322b[_0xa81e('0x66')]+0x15b38);});_0x32b7f3(_0xc66229);});}}catch(_0x2bd2e8){_0x1c688c(_0x2bd2e8);}});}exports[_0xa81e('0x68')]=function(_0x2ab371,_0x45edcc){return db[_0xa81e('0x2c')][_0xa81e('0x47')]({'where':{'id':_0x2ab371['params']['id']}})[_0xa81e('0x25')](handleEntityNotFound(_0x45edcc,null))[_0xa81e('0x25')](function(_0xfd0385){if(_0xfd0385){return db[_0xa81e('0x4f')][_0xa81e('0x50')](function(_0x11cc81){return db['UserProfileSection'][_0xa81e('0x42')]({'where':{'userProfileId':_0x2ab371[_0xa81e('0x45')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x3a97bf){if(_0x3a97bf){return db[_0xa81e('0x52')][_0xa81e('0x24')]({'where':{'userProfileId':_0x2ab371[_0xa81e('0x45')]['id'],'id':_[_0xa81e('0x2b')](_0x3a97bf,function(_0x4c7758){return _0x4c7758['id'];})},'transaction':_0x11cc81});}})[_0xa81e('0x25')](function(_0x40513f){var _0x43404d=_[_0xa81e('0x2b')](_0x2ab371['body'],function(_0x27cfa2){_0x27cfa2[_0xa81e('0x57')]=_0x2ab371['params']['id'];return _0x27cfa2;});return db[_0xa81e('0x52')][_0xa81e('0x69')](_0x43404d,{'raw':!![],'transaction':_0x11cc81});})[_0xa81e('0x25')](function(_0xaf867){var _0x4e9bd3=_[_0xa81e('0x3b')](_[_0xa81e('0x2b')](_0xaf867,function(_0x52ec73){return _0x52ec73[_0xa81e('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x4e9bd3){return db[_0xa81e('0x52')][_0xa81e('0x42')]({'where':{'userProfileId':_0x2ab371[_0xa81e('0x45')]['id'],'sectionId':_[_0xa81e('0x2b')](_0x4e9bd3,function(_0x2fc35a){return _0x2fc35a['sectionId'];})},'attributes':['id',_0xa81e('0x5b')],'raw':!![]})[_0xa81e('0x25')](function(_0x137d44){var _0x41e939=_[_0xa81e('0x2b')](_0x2ab371[_0xa81e('0x49')],function(_0x1616d5){_0x1616d5['userProfileId']=_0x2ab371['params']['id'];return _0x1616d5;});return db[_0xa81e('0x55')][_0xa81e('0x69')](_0x41e939,{'raw':!![],'transaction':_0x11cc81});});}})[_0xa81e('0x4a')](handleError(_0x45edcc,null));});}})[_0xa81e('0x25')](function(_0x4a6334){var _0x53bea5=_['map'](_0x4a6334,function(_0x352291){return _0x352291[_0xa81e('0x51')]({'plain':!![]});});})[_0xa81e('0x25')](respondWithResult(_0x45edcc,null))[_0xa81e('0x4a')](handleError(_0x45edcc,null));};exports[_0xa81e('0x6a')]=function(_0x2687b2,_0x549f7a,_0x50992a){return db[_0xa81e('0x2c')][_0xa81e('0x47')]({'where':{'id':_0x2687b2[_0xa81e('0x45')]['id']}})['then'](handleEntityNotFound(_0x549f7a,null))[_0xa81e('0x25')](function(_0x6b654){if(_0x6b654){return _0x6b654['removeResources'](_0x2687b2[_0xa81e('0x31')][_0xa81e('0x5d')]);}})[_0xa81e('0x25')](respondWithStatusCode(_0x549f7a,null))['catch'](handleError(_0x549f7a,null));};exports[_0xa81e('0x6b')]=function(_0x48efce,_0x2e17ca){var _0x4eecf6={};if(!_0x48efce[_0xa81e('0x31')][_0xa81e('0x6c')])throw new Error(_0xa81e('0x6d'));if(!_0x48efce[_0xa81e('0x31')]['hasOwnProperty'](_0xa81e('0x6e'))){_0x4eecf6[_0xa81e('0x1f')]=qs[_0xa81e('0x1f')](_0x48efce[_0xa81e('0x31')]['limit']);_0x4eecf6[_0xa81e('0x1e')]=qs['offset'](_0x48efce[_0xa81e('0x31')]['offset']);}return db[_0xa81e('0x2c')][_0xa81e('0x47')]({'where':{'id':_0x48efce['params']['id']}})[_0xa81e('0x25')](function(_0x452a6f){if(!_0x452a6f)throw new Error(_0xa81e('0x6f')+_0x48efce['params']['id']);return db[_0xa81e('0x2c')][_0xa81e('0x6b')](_0x48efce);})[_0xa81e('0x25')](respondWithFilteredResult(_0x2e17ca,_0x4eecf6))[_0xa81e('0x4a')](handleError(_0x2e17ca,null));}; \ No newline at end of file +var _0x9884=['name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','UserProfile','then','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','clone','options','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','each','autoAssociation','userProfileId','Resources','UserProfileResource','destroy','describe','addSections','sectionId','push','enabled','isEmpty','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','transaction','bulkCreate','removeResources','ids','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','sendStatus','error','stack'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9884,0x12c));var _0x4988=function(_0x38209d,_0x282138){_0x38209d=_0x38209d-0x0;var _0x578b0d=_0x9884[_0x38209d];return _0x578b0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4988('0x0'));var zipdir=require(_0x4988('0x1'));var jsonpatch=require(_0x4988('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4988('0x3'));var Mustache=require(_0x4988('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4988('0x5'));var csv=require(_0x4988('0x6'));var ejs=require(_0x4988('0x7'));var fs=require('fs');var fs_extra=require(_0x4988('0x8'));var _=require(_0x4988('0x9'));var squel=require(_0x4988('0xa'));var crypto=require(_0x4988('0xb'));var jsforce=require(_0x4988('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4988('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4988('0xd'));var authService=require(_0x4988('0xe'));var qs=require(_0x4988('0xf'));var as=require(_0x4988('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4988('0x11'))(_0x4988('0x12'));var utils=require(_0x4988('0x13'));var config=require(_0x4988('0x14'));var licenseUtil=require(_0x4988('0x15'));var db=require(_0x4988('0x16'))['db'];config[_0x4988('0x17')]=_[_0x4988('0x18')](config[_0x4988('0x17')],{'host':_0x4988('0x19'),'port':0x18eb});var socket=require(_0x4988('0x1a'))(new Redis(config['redis']));require(_0x4988('0x1b'))['register'](socket);function respondWithStatusCode(_0x364ad2,_0x3a35d2){_0x3a35d2=_0x3a35d2||0xcc;return function(_0x4d55ee){if(_0x4d55ee){return _0x364ad2['sendStatus'](_0x3a35d2);}return _0x364ad2['status'](_0x3a35d2)[_0x4988('0x1c')]();};}function respondWithResult(_0x568068,_0x26bc3e){_0x26bc3e=_0x26bc3e||0xc8;return function(_0x313f42){if(_0x313f42){return _0x568068[_0x4988('0x1d')](_0x26bc3e)[_0x4988('0x1e')](_0x313f42);}};}function respondWithFilteredResult(_0x1fe9ed,_0x31845b){return function(_0xfba2d3){if(_0xfba2d3){var _0x5de256=typeof _0x31845b[_0x4988('0x1f')]===_0x4988('0x20')&&typeof _0x31845b['limit']===_0x4988('0x20');var _0x5167eb=_0xfba2d3[_0x4988('0x21')];var _0x199cab=_0x5de256?0x0:_0x31845b[_0x4988('0x1f')];var _0xc3712=_0x5de256?_0xfba2d3['count']:_0x31845b[_0x4988('0x1f')]+_0x31845b['limit'];var _0x39c98d;if(_0xc3712>=_0x5167eb){_0xc3712=_0x5167eb;_0x39c98d=0xc8;}else{_0x39c98d=0xce;}_0x1fe9ed[_0x4988('0x1d')](_0x39c98d);return _0x1fe9ed[_0x4988('0x22')](_0x4988('0x23'),_0x199cab+'-'+_0xc3712+'/'+_0x5167eb)[_0x4988('0x1e')](_0xfba2d3);}return null;};}function patchUpdates(_0x10f945){return function(_0x36399b){try{jsonpatch[_0x4988('0x24')](_0x36399b,_0x10f945,!![]);}catch(_0x53901b){return BPromise[_0x4988('0x25')](_0x53901b);}return _0x36399b['save']();};}function saveUpdates(_0x24d636,_0x5e212e){return function(_0x1b5ec7){if(_0x1b5ec7){return _0x1b5ec7[_0x4988('0x26')](_0x24d636)['then'](function(_0x4a79b9){return _0x4a79b9;});}return null;};}function removeEntity(_0x5b05cd,_0x521846){return function(_0x49a0f0){if(_0x49a0f0){return _0x49a0f0['destroy']()['then'](function(){_0x5b05cd[_0x4988('0x1d')](0xcc)[_0x4988('0x1c')]();});}};}function handleEntityNotFound(_0x43034e,_0x14b0a5){return function(_0x5715b9){if(!_0x5715b9){_0x43034e[_0x4988('0x27')](0x194);}return _0x5715b9;};}function handleError(_0x951945,_0x568a29){_0x568a29=_0x568a29||0x1f4;return function(_0x1bf6b2){logger[_0x4988('0x28')](_0x1bf6b2[_0x4988('0x29')]);if(_0x1bf6b2[_0x4988('0x2a')]){delete _0x1bf6b2[_0x4988('0x2a')];}_0x951945[_0x4988('0x1d')](_0x568a29)[_0x4988('0x2b')](_0x1bf6b2);};}exports['index']=function(_0x55346e,_0x55a135){var _0x3dec26={},_0x49888f={},_0x10a05c={'count':0x0,'rows':[]};var _0x2e5c63=_[_0x4988('0x2c')](db['UserProfile'][_0x4988('0x2d')],function(_0x454fa3){return{'name':_0x454fa3[_0x4988('0x2e')],'type':_0x454fa3[_0x4988('0x2f')][_0x4988('0x30')]};});_0x49888f['model']=_[_0x4988('0x2c')](_0x2e5c63,_0x4988('0x2a'));_0x49888f[_0x4988('0x31')]=_['keys'](_0x55346e[_0x4988('0x31')]);_0x49888f[_0x4988('0x32')]=_[_0x4988('0x33')](_0x49888f[_0x4988('0x34')],_0x49888f['query']);_0x3dec26[_0x4988('0x35')]=_[_0x4988('0x33')](_0x49888f[_0x4988('0x34')],qs[_0x4988('0x36')](_0x55346e[_0x4988('0x31')][_0x4988('0x36')]));_0x3dec26[_0x4988('0x35')]=_0x3dec26['attributes']['length']?_0x3dec26['attributes']:_0x49888f[_0x4988('0x34')];if(!_0x55346e['query'][_0x4988('0x37')]('nolimit')){_0x3dec26[_0x4988('0x38')]=qs[_0x4988('0x38')](_0x55346e[_0x4988('0x31')]['limit']);_0x3dec26[_0x4988('0x1f')]=qs['offset'](_0x55346e[_0x4988('0x31')][_0x4988('0x1f')]);}_0x3dec26[_0x4988('0x39')]=qs[_0x4988('0x3a')](_0x55346e[_0x4988('0x31')][_0x4988('0x3a')]);_0x3dec26[_0x4988('0x3b')]=qs['filters'](_['pick'](_0x55346e[_0x4988('0x31')],_0x49888f[_0x4988('0x32')]),_0x2e5c63);if(_0x55346e[_0x4988('0x31')][_0x4988('0x3c')]){_0x3dec26['where']=_[_0x4988('0x3d')](_0x3dec26['where'],{'$or':_[_0x4988('0x2c')](_0x2e5c63,function(_0xc31f09){if(_0xc31f09['type']!==_0x4988('0x3e')){var _0x458da5={};_0x458da5[_0xc31f09[_0x4988('0x2a')]]={'$like':'%'+_0x55346e[_0x4988('0x31')][_0x4988('0x3c')]+'%'};return _0x458da5;}})});}_0x3dec26=_['merge']({},_0x3dec26,_0x55346e['options']);var _0x4216be={'where':_0x3dec26['where']};return db[_0x4988('0x3f')]['count'](_0x4216be)[_0x4988('0x40')](function(_0x46889b){_0x10a05c['count']=_0x46889b;if(_0x55346e[_0x4988('0x31')][_0x4988('0x41')]){_0x3dec26[_0x4988('0x42')]=[{'all':!![]}];}return db[_0x4988('0x3f')][_0x4988('0x43')](_0x3dec26);})['then'](function(_0x394b3b){_0x10a05c[_0x4988('0x44')]=_0x394b3b;return _0x10a05c;})['then'](respondWithFilteredResult(_0x55a135,_0x3dec26))[_0x4988('0x45')](handleError(_0x55a135,null));};exports[_0x4988('0x46')]=function(_0x30bd42,_0x47d43d){var _0x736fff={'raw':![],'where':{'id':_0x30bd42[_0x4988('0x47')]['id']}},_0x427d7b={};_0x427d7b[_0x4988('0x34')]=_[_0x4988('0x48')](db['UserProfile'][_0x4988('0x2d')]);_0x427d7b[_0x4988('0x31')]=_['keys'](_0x30bd42[_0x4988('0x31')]);_0x427d7b[_0x4988('0x32')]=_[_0x4988('0x33')](_0x427d7b[_0x4988('0x34')],_0x427d7b['query']);_0x736fff[_0x4988('0x35')]=_['intersection'](_0x427d7b[_0x4988('0x34')],qs['fields'](_0x30bd42[_0x4988('0x31')][_0x4988('0x36')]));_0x736fff[_0x4988('0x35')]=_0x736fff[_0x4988('0x35')][_0x4988('0x49')]?_0x736fff[_0x4988('0x35')]:_0x427d7b['model'];if(_0x30bd42[_0x4988('0x31')][_0x4988('0x41')]){_0x736fff[_0x4988('0x42')]=[{'all':!![]}];}_0x736fff=_[_0x4988('0x3d')]({},_0x736fff,_0x30bd42['options']);return db[_0x4988('0x3f')][_0x4988('0x4a')](_0x736fff)['then'](handleEntityNotFound(_0x47d43d,null))[_0x4988('0x40')](respondWithResult(_0x47d43d,null))[_0x4988('0x45')](handleError(_0x47d43d,null));};exports['create']=function(_0x3bf9b1,_0x46f74d){return db['UserProfile'][_0x4988('0x4b')](_0x3bf9b1[_0x4988('0x4c')],{})['then'](respondWithResult(_0x46f74d,0xc9))[_0x4988('0x45')](handleError(_0x46f74d,null));};exports[_0x4988('0x4d')]=function(_0x9a81ec,_0x23c05b){var _0x2a0928={'where':{'id':_0x9a81ec['params']['id']}},_0x24ec5d={};_0x24ec5d[_0x4988('0x34')]=_[_0x4988('0x48')](db[_0x4988('0x3f')][_0x4988('0x2d')]);_0x2a0928[_0x4988('0x35')]=_['intersection'](_0x24ec5d[_0x4988('0x34')],qs[_0x4988('0x36')](_0x9a81ec[_0x4988('0x31')]['fields']));_0x2a0928[_0x4988('0x35')]=_0x2a0928['attributes'][_0x4988('0x49')]?_0x2a0928[_0x4988('0x35')]:_0x24ec5d[_0x4988('0x34')];if(_0x9a81ec[_0x4988('0x31')][_0x4988('0x41')]){_0x2a0928[_0x4988('0x42')]=[{'all':!![]}];}_0x2a0928=_['merge']({},_0x2a0928,_0x9a81ec[_0x4988('0x4e')]);return db[_0x4988('0x3f')]['find'](_0x2a0928)[_0x4988('0x40')](handleEntityNotFound(_0x23c05b,null))[_0x4988('0x40')](function(_0x55454a){if(_0x55454a){var _0x40750c=_0x55454a[_0x4988('0x4f')]({'plain':!![]});_0x40750c=qs[_0x4988('0x50')](_0x40750c,['id',_0x4988('0x51'),_0x4988('0x52'),_0x4988('0x53')]);_0x9a81ec[_0x4988('0x4c')]=_['omit'](_0x9a81ec['body'],['id',_0x4988('0x51'),'updatedAt']);return db[_0x4988('0x54')]['transaction'](function(_0x167dee){return db[_0x4988('0x3f')][_0x4988('0x4b')](_[_0x4988('0x3d')](_0x40750c,_0x9a81ec[_0x4988('0x4c')]),{'include':_0x9a81ec['query'][_0x4988('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x167dee})['then'](function(_0xb3e11c){var _0xbb3552=_0xb3e11c[_0x4988('0x4f')]({'plain':!![]});return db[_0x4988('0x55')][_0x4988('0x43')]({'where':{'userProfileId':_0x9a81ec['params']['id']},'raw':!![]})[_0x4988('0x40')](function(_0x267e29){if(_0x267e29){return BPromise[_0x4988('0x56')](_0x267e29,function(_0x459ac7){return new BPromise(function(_0x4f6f1e,_0x5b8f9f){if(_0x459ac7[_0x4988('0x57')]===null||_0x459ac7[_0x4988('0x57')]===0x1)_0x4f6f1e(null);return db['UserProfileResource'][_0x4988('0x43')]({'where':{'sectionId':_0x459ac7['id']},'raw':!![]})[_0x4988('0x40')](function(_0x514a94){var _0x3012cc=_[_0x4988('0x2c')](_0x514a94,function(_0x31bdcc){return qs['omit'](_0x31bdcc,['id','createdAt','updatedAt','sectionId']);});_0x4f6f1e(_0x3012cc);})[_0x4988('0x45')](function(_0x2a9d3f){_0x5b8f9f(_0x2a9d3f);});})[_0x4988('0x40')](function(_0x312100){var _0x497a78=qs[_0x4988('0x50')](_0x459ac7,['id',_0x4988('0x51'),_0x4988('0x52')]);_0x497a78[_0x4988('0x58')]=_0xbb3552['id'];if(_0x312100)_0x497a78[_0x4988('0x59')]=_0x312100;return _0x497a78;})['then'](function(_0x5a7f6f){return db['UserProfileSection'][_0x4988('0x4b')](_0x5a7f6f,{'include':[{'model':db[_0x4988('0x5a')],'as':_0x4988('0x59')}],'raw':!![],'transaction':_0x167dee});});})[_0x4988('0x40')](function(){return _0xbb3552;});}});});});}})[_0x4988('0x40')](respondWithResult(_0x23c05b,0xc9))[_0x4988('0x45')](handleError(_0x23c05b,null));};exports[_0x4988('0x26')]=function(_0x19c378,_0x153804){if(_0x19c378[_0x4988('0x4c')]['id']){delete _0x19c378[_0x4988('0x4c')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x19c378[_0x4988('0x47')]['id']}})[_0x4988('0x40')](handleEntityNotFound(_0x153804,null))['then'](saveUpdates(_0x19c378[_0x4988('0x4c')],null))[_0x4988('0x40')](respondWithResult(_0x153804,null))[_0x4988('0x45')](handleError(_0x153804,null));};exports[_0x4988('0x5b')]=function(_0x5ed3e0,_0x35fdb6){return db[_0x4988('0x3f')]['find']({'where':{'id':_0x5ed3e0[_0x4988('0x47')]['id']}})[_0x4988('0x40')](handleEntityNotFound(_0x35fdb6,null))[_0x4988('0x40')](removeEntity(_0x35fdb6,null))['catch'](handleError(_0x35fdb6,null));};exports['describe']=function(_0x463db9,_0x2b8cf8){return db[_0x4988('0x3f')][_0x4988('0x5c')]()['then'](respondWithResult(_0x2b8cf8,null))[_0x4988('0x45')](handleError(_0x2b8cf8,null));};exports[_0x4988('0x5d')]=function(_0x12b0e8,_0x26ce38){var _0x3d793a=_0x12b0e8[_0x4988('0x4c')];return db[_0x4988('0x3f')][_0x4988('0x4a')]({'where':{'id':_0x12b0e8[_0x4988('0x47')]['id']}})[_0x4988('0x40')](handleEntityNotFound(_0x26ce38,null))[_0x4988('0x40')](function(_0x58db84){if(_0x58db84){return db['sequelize']['transaction'](function(_0x6db8f4){return db[_0x4988('0x55')][_0x4988('0x5b')]({'where':{'userProfileId':_0x12b0e8['params']['id'],'sectionId':_['map'](_0x3d793a,function(_0x2dfef9){return _0x2dfef9[_0x4988('0x5e')];})},'transaction':_0x6db8f4})['then'](function(){var _0x556722=_['map'](_0x3d793a,function(_0x352e9d){_0x352e9d[_0x4988('0x58')]=_0x12b0e8[_0x4988('0x47')]['id'];return _0x352e9d;});var _0x23d3e1=[];return BPromise['each'](_0x556722,function(_0x269a73){return db['UserProfileSection'][_0x4988('0x4b')](_0x269a73,{'include':[{'model':db[_0x4988('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x6db8f4})[_0x4988('0x40')](function(_0x447156){_0x23d3e1[_0x4988('0x5f')](_0x447156[_0x4988('0x4f')]({'plain':!![]}));});})[_0x4988('0x40')](function(){return _0x23d3e1;});});});}})[_0x4988('0x40')](function(_0xa036f4){return _0xa036f4;})[_0x4988('0x40')](respondWithResult(_0x26ce38,null))[_0x4988('0x45')](handleError(_0x26ce38,null));};exports['removeSections']=function(_0x40ed1e,_0x26bd3b){var _0x2611b7;return db[_0x4988('0x3f')][_0x4988('0x4a')]({'where':{'id':_0x40ed1e[_0x4988('0x47')]['id']},'attributes':['id',_0x4988('0x2a')]})[_0x4988('0x40')](handleEntityNotFound(_0x26bd3b,null))[_0x4988('0x40')](function(_0x239248){if(_0x239248){_0x2611b7=_0x239248;return db[_0x4988('0x55')][_0x4988('0x5b')]({'where':{'userProfileId':_0x40ed1e['params']['id'],'sectionId':_0x40ed1e[_0x4988('0x31')]['ids']}});}})[_0x4988('0x40')](function(){return _0x2611b7;})[_0x4988('0x40')](respondWithStatusCode(_0x26bd3b,null))[_0x4988('0x45')](handleError(_0x26bd3b,null));};exports['getSections']=function(_0x441277,_0x118b39){var _0x361218=[];var _0x31f7b1=[];return db['UserProfileSection'][_0x4988('0x43')]({'where':{'userProfileId':_0x441277[_0x4988('0x47')]['id']},'raw':!![]})['then'](function(_0x3bd5a9){_0x361218=_[_0x4988('0x3c')](_0x3bd5a9,function(_0x4967ee){return _0x4967ee[_0x4988('0x60')]===0x1||_['includes']([0x3eb,0x709],_0x4967ee[_0x4988('0x5e')]);});if(!_[_0x4988('0x61')](_0x361218)){return _[_0x4988('0x2c')](_0x361218,function(_0x22100b){return _0x22100b['sectionId'];});}else{return;}})[_0x4988('0x40')](function(_0xe4fdf9){if(_0xe4fdf9)_0x31f7b1=_0xe4fdf9;if(_[_0x4988('0x62')](_0x31f7b1,0x64)){var _0x4e05c3=_[_0x4988('0x4a')](_0x361218,{'sectionId':0x64});return hasDefaultDashboard(_0x4e05c3)[_0x4988('0x40')](function(_0x3ede66){return _[_0x4988('0x2c')](_0x361218,function(_0x45870e){if(_0x45870e[_0x4988('0x5e')]===0x64){_0x45870e[_0x4988('0x63')]=_0x3ede66;}return _0x45870e;});});}else{return;}})[_0x4988('0x40')](function(_0x4c7010){if(_0x4c7010)_0x361218=_0x4c7010;if(_[_0x4988('0x62')](_0x31f7b1,0x3eb)){var _0x3863b0=_[_0x4988('0x4a')](_0x361218,{'sectionId':0x3eb});return getCustomDashboards(_0x3863b0)[_0x4988('0x40')](function(_0x2913a6){return _[_0x4988('0x2c')](_0x361218,function(_0x63cdcb){if(_0x3863b0[_0x4988('0x60')]){if(_0x63cdcb[_0x4988('0x5e')]===0x3eb){_0x63cdcb[_0x4988('0x63')]=_0x2913a6;}}else{if(_0x63cdcb[_0x4988('0x5e')]===0x64){if(!_0x63cdcb[_0x4988('0x63')]){_0x63cdcb[_0x4988('0x63')]=[];}_0x63cdcb[_0x4988('0x63')]=_0x63cdcb[_0x4988('0x63')][_0x4988('0x64')](_0x2913a6);}}return _0x63cdcb;});});}else{return;}})[_0x4988('0x40')](function(_0x42e06a){if(_0x42e06a)_0x361218=_0x42e06a;if(_['includes'](_0x31f7b1,0x709)){var _0x4a112f=_[_0x4988('0x4a')](_0x361218,{'sectionId':0x709});return getPlugins(_0x4a112f)[_0x4988('0x40')](function(_0x39e87){if(_0x4a112f['enabled']){return _[_0x4988('0x2c')](_0x361218,function(_0x5bb1da){if(_0x5bb1da[_0x4988('0x5e')]===0x709){_0x5bb1da['subsections']=_0x39e87;}return _0x5bb1da;});}else{var _0x5b6a9c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x39e87};var _0x2b904d=_[_0x4988('0x2c')](_0x361218);_0x2b904d[_0x4988('0x5f')](_0x5b6a9c);return _0x2b904d;}});}else{return;}})[_0x4988('0x40')](function(_0x535714){if(_0x535714)_0x361218=_0x535714;return _[_0x4988('0x3c')](_0x361218,[_0x4988('0x60'),0x1]);})[_0x4988('0x40')](respondWithResult(_0x118b39,null))[_0x4988('0x45')](handleError(_0x118b39,null));};function hasDefaultDashboard(_0x4ba4ed){var _0x4c41f7=[0x65];return new BPromise(function(_0x4f7668,_0x56d28f){try{if(_0x4ba4ed[_0x4988('0x57')]){_0x4f7668(_0x4c41f7);}else{return db[_0x4988('0x5a')][_0x4988('0x65')]({'where':{'sectionId':_0x4ba4ed['id']},'raw':!![]})[_0x4988('0x40')](function(_0x4bdf37){_0x4bdf37?_0x4f7668(_0x4c41f7):_0x4f7668();});}}catch(_0x2a0a93){_0x56d28f(_0x2a0a93);}});}function getCustomDashboards(_0x75d20d){var _0x3790ab=[];return new BPromise(function(_0x45a212,_0x1a3819){try{if(_0x75d20d[_0x4988('0x57')]){return db[_0x4988('0x66')][_0x4988('0x43')]({'raw':!![]})[_0x4988('0x40')](function(_0x2d1773){_0x2d1773[_0x4988('0x67')](function(_0x3d482e){_0x3790ab[_0x4988('0x5f')](_0x3d482e['id']+0x1869f);});_0x45a212(_0x3790ab);});}else{return db[_0x4988('0x5a')][_0x4988('0x43')]({'where':{'sectionId':_0x75d20d['id']},'raw':!![]})[_0x4988('0x40')](function(_0x199459){_0x199459[_0x4988('0x67')](function(_0x37734a){_0x3790ab['push'](_0x37734a[_0x4988('0x68')]+0x1869f);});_0x45a212(_0x3790ab);});}}catch(_0x5e7651){_0x1a3819(_0x5e7651);}});}function getPlugins(_0x3bd70b){var _0x19f278=[];return new BPromise(function(_0x29edf9,_0x2507df){try{if(_0x3bd70b['autoAssociation']){return db[_0x4988('0x69')]['findAll']({'raw':!![]})['then'](function(_0x4e7be3){_0x4e7be3[_0x4988('0x67')](function(_0x837db3){_0x19f278[_0x4988('0x5f')](_0x837db3['id']+0x15b38);});_0x29edf9(_0x19f278);});}else{return db[_0x4988('0x5a')][_0x4988('0x43')]({'where':{'sectionId':_0x3bd70b['id']},'raw':!![]})[_0x4988('0x40')](function(_0x54298e){_0x54298e[_0x4988('0x67')](function(_0x1ad655){_0x19f278[_0x4988('0x5f')](_0x1ad655[_0x4988('0x68')]+0x15b38);});_0x29edf9(_0x19f278);});}}catch(_0x1bee3f){_0x2507df(_0x1bee3f);}});}exports[_0x4988('0x6a')]=function(_0x2e4879,_0x3f3898){return db[_0x4988('0x3f')][_0x4988('0x4a')]({'where':{'id':_0x2e4879[_0x4988('0x47')]['id']}})[_0x4988('0x40')](handleEntityNotFound(_0x3f3898,null))['then'](function(_0x5ef26d){if(_0x5ef26d){return db[_0x4988('0x54')][_0x4988('0x6b')](function(_0x437123){return db[_0x4988('0x55')][_0x4988('0x43')]({'where':{'userProfileId':_0x2e4879[_0x4988('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x4988('0x40')](function(_0x2ba21c){if(_0x2ba21c){return db['UserProfileSection'][_0x4988('0x5b')]({'where':{'userProfileId':_0x2e4879[_0x4988('0x47')]['id'],'id':_[_0x4988('0x2c')](_0x2ba21c,function(_0x38c4e4){return _0x38c4e4['id'];})},'transaction':_0x437123});}})['then'](function(_0xa8d16a){var _0xccbfa4=_[_0x4988('0x2c')](_0x2e4879[_0x4988('0x4c')],function(_0xc0256c){_0xc0256c[_0x4988('0x58')]=_0x2e4879[_0x4988('0x47')]['id'];return _0xc0256c;});return db[_0x4988('0x55')][_0x4988('0x6c')](_0xccbfa4,{'raw':!![],'transaction':_0x437123});})[_0x4988('0x40')](function(_0x499ba8){var _0xd78998=_[_0x4988('0x3c')](_['map'](_0x499ba8,function(_0x2718f5){return _0x2718f5['get']({'plain':!![]});}),{'includeAll':![]});if(_0xd78998){return db[_0x4988('0x55')][_0x4988('0x43')]({'where':{'userProfileId':_0x2e4879['params']['id'],'sectionId':_[_0x4988('0x2c')](_0xd78998,function(_0x2c02d7){return _0x2c02d7[_0x4988('0x5e')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x4988('0x40')](function(_0x2fb910){var _0x4b60a5=_[_0x4988('0x2c')](_0x2e4879[_0x4988('0x4c')],function(_0x5990ca){_0x5990ca[_0x4988('0x58')]=_0x2e4879[_0x4988('0x47')]['id'];return _0x5990ca;});return db[_0x4988('0x5a')][_0x4988('0x6c')](_0x4b60a5,{'raw':!![],'transaction':_0x437123});});}})['catch'](handleError(_0x3f3898,null));});}})[_0x4988('0x40')](function(_0x5d0af7){var _0x44a7de=_[_0x4988('0x2c')](_0x5d0af7,function(_0x34a101){return _0x34a101[_0x4988('0x4f')]({'plain':!![]});});})[_0x4988('0x40')](respondWithResult(_0x3f3898,null))[_0x4988('0x45')](handleError(_0x3f3898,null));};exports[_0x4988('0x6d')]=function(_0x3d44bc,_0x357ba0,_0x2e49da){return db[_0x4988('0x3f')][_0x4988('0x4a')]({'where':{'id':_0x3d44bc[_0x4988('0x47')]['id']}})['then'](handleEntityNotFound(_0x357ba0,null))['then'](function(_0x6b37ad){if(_0x6b37ad){return _0x6b37ad['removeResources'](_0x3d44bc['query'][_0x4988('0x6e')]);}})[_0x4988('0x40')](respondWithStatusCode(_0x357ba0,null))[_0x4988('0x45')](handleError(_0x357ba0,null));};exports[_0x4988('0x6f')]=function(_0x2d7d56,_0x12d897){var _0x418ab4={};if(!_0x2d7d56[_0x4988('0x31')]['section'])throw new Error(_0x4988('0x70'));if(!_0x2d7d56[_0x4988('0x31')][_0x4988('0x37')]('nolimit')){_0x418ab4[_0x4988('0x38')]=qs['limit'](_0x2d7d56[_0x4988('0x31')]['limit']);_0x418ab4[_0x4988('0x1f')]=qs[_0x4988('0x1f')](_0x2d7d56[_0x4988('0x31')][_0x4988('0x1f')]);}return db[_0x4988('0x3f')][_0x4988('0x4a')]({'where':{'id':_0x2d7d56[_0x4988('0x47')]['id']}})[_0x4988('0x40')](function(_0x207351){if(!_0x207351)throw new Error(_0x4988('0x71')+_0x2d7d56[_0x4988('0x47')]['id']);return db[_0x4988('0x3f')]['getResources'](_0x2d7d56);})[_0x4988('0x40')](respondWithFilteredResult(_0x12d897,_0x418ab4))[_0x4988('0x45')](handleError(_0x12d897,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 138141c..8e193ad 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 _0x7b84=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x7b84,0x17c));var _0x47b8=function(_0xca2cb0,_0x2989b7){_0xca2cb0=_0xca2cb0-0x0;var _0xdcc6fe=_0x7b84[_0xca2cb0];return _0xdcc6fe;};'use strict';var EventEmitter=require(_0x47b8('0x0'));var UserProfile=require(_0x47b8('0x1'))['db'][_0x47b8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x47b8('0x3')](0x0);var events={'afterCreate':_0x47b8('0x4'),'afterUpdate':_0x47b8('0x5'),'afterDestroy':_0x47b8('0x6')};function emitEvent(_0x5c7cda){return function(_0x445a5f,_0x1fa41a,_0x2279ea){UserProfileEvents[_0x47b8('0x7')](_0x5c7cda+':'+_0x445a5f['id'],_0x445a5f);UserProfileEvents[_0x47b8('0x7')](_0x5c7cda,_0x445a5f);_0x2279ea(null);};}for(var e in events){if(events[_0x47b8('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x47b8('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xf96b=['update','remove','emit','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x550aed,_0x1ba6cb){var _0x1c43a5=function(_0x39e5f7){while(--_0x39e5f7){_0x550aed['push'](_0x550aed['shift']());}};_0x1c43a5(++_0x1ba6cb);}(_0xf96b,0x109));var _0xbf96=function(_0x5a101e,_0x27a1c8){_0x5a101e=_0x5a101e-0x0;var _0x46b1e8=_0xf96b[_0x5a101e];return _0x46b1e8;};'use strict';var EventEmitter=require(_0xbf96('0x0'));var UserProfile=require(_0xbf96('0x1'))['db'][_0xbf96('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xbf96('0x3')](0x0);var events={'afterCreate':_0xbf96('0x4'),'afterUpdate':_0xbf96('0x5'),'afterDestroy':_0xbf96('0x6')};function emitEvent(_0x25c3d7){return function(_0x42be7e,_0x38565,_0xab8e7){UserProfileEvents[_0xbf96('0x7')](_0x25c3d7+':'+_0x42be7e['id'],_0x42be7e);UserProfileEvents[_0xbf96('0x7')](_0x25c3d7,_0x42be7e);_0xab8e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xbf96('0x8')](e,emitEvent(event));}}module[_0xbf96('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 90d0fff..f523239 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 _0xeedf=['SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Interval','scheduler','sounds','Sound','tags','Tag','templates','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','user_profiles','../../components/parsers/qs','raw','section','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','openTabs','true','dataValues','sms','fax','mail','openchannel','lodash','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','AnalyticExtractedReport','squareprojects','odbc','childModel'];(function(_0x2113cf,_0x5c36c4){var _0x4cf55d=function(_0x4f06a2){while(--_0x4f06a2){_0x2113cf['push'](_0x2113cf['shift']());}};_0x4cf55d(++_0x5c36c4);}(_0xeedf,0x161));var _0xfeed=function(_0x4f9cd5,_0x22a4d7){_0x4f9cd5=_0x4f9cd5-0x0;var _0x33fc0b=_0xeedf[_0x4f9cd5];return _0x33fc0b;};'use strict';var _=require(_0xfeed('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0xfeed('0x1'));module[_0xfeed('0x2')]=function(_0x169792){var _0x53f885=_0x169792[_0xfeed('0x3')];function _0x348df2(_0x34b690,_0x47b808){return new Promise(function(_0x3dce48,_0x2da7d2){if(!_0x47b808)return _0x3dce48(null);var _0x116a3e=_0x47b808[_0xfeed('0x4')]?{[_0x47b808['filter'][_0xfeed('0x5')]]:_0x47b808[_0xfeed('0x4')][_0xfeed('0x6')]}:undefined;return _0x53f885[_0x34b690][_0xfeed('0x7')]({'where':_0x116a3e,'raw':!![]})[_0xfeed('0x8')](function(_0x37428b){_0x47b808[_0xfeed('0x9')]=_[_0xfeed('0xa')](_0x37428b,'id');_0x3dce48(_0x47b808);})[_0xfeed('0xb')](function(_0x2cd8e0){_0x2da7d2(_0x2cd8e0);});});}function _0x5337bb(_0x22fb87,_0x3c68e0){return new Promise(function(_0x2fe320,_0x4f4e88){var _0x2d1cfd=_0x22fb87['filter']?{[_0x22fb87[_0xfeed('0x4')][_0xfeed('0x5')]]:_0x22fb87[_0xfeed('0x4')][_0xfeed('0x6')]}:undefined;return _0x53f885[_0x22fb87[_0xfeed('0xc')]][_0xfeed('0x7')]({'where':_0x2d1cfd,'raw':!![]})[_0xfeed('0x8')](function(_0x369bd1){_0x3c68e0[_0xfeed('0x9')]=_[_0xfeed('0xa')](_0x369bd1,function(_0x3092cd){return _0x3092cd[_0xfeed('0xd')];});_0x2fe320(_0x3c68e0);})[_0xfeed('0xb')](function(_0x1caed0){_0x4f4e88(_0x1caed0);});});}function _0x3dafbb(_0x49cb64,_0x1f14c8,_0x183ed0){if(!_0x1f14c8)return Promise[_0xfeed('0xe')](null);return new Promise(function(_0x2efb25,_0x4d9434){return _0x53f885['UserProfileResource'][_0xfeed('0x7')]({'where':{'sectionId':_0x1f14c8['id']},'raw':!![]})[_0xfeed('0x8')](function(_0x4ebc77){if(_0x49cb64['field']&&_0x49cb64['field']!=='id'){_0x1f14c8[_0xfeed('0x9')]=_[_0xfeed('0xa')](_0x4ebc77,function(_0x1de3fd){return _0x1de3fd[_0x49cb64[_0xfeed('0x5')]];});}else{if(_0x183ed0===_0xfeed('0xf')){_0x1f14c8['associatedResources']=_[_0xfeed('0xa')](_0x4ebc77,function(_0x2acff9){return{'id':_0x2acff9['resourceId'],'type':_0x2acff9['type']};});}else{_0x1f14c8[_0xfeed('0x9')]=_[_0xfeed('0xa')](_0x4ebc77,function(_0x53d48e){return _0x53d48e['resourceId'];});}}_0x2efb25(_0x1f14c8);})[_0xfeed('0xb')](function(_0x3b3525){_0x4d9434(_0x3b3525);});});}function _0x3e1d62(_0x27b5cb,_0x2234a1){var _0x344c45={'parentSections':[]};switch(_0x27b5cb['toLowerCase']()){case _0xfeed('0x10'):_0x344c45['childModel']='SquareProject';break;case _0xfeed('0x11'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x13');break;case'squarerecordings':_0x344c45[_0xfeed('0x12')]=_0xfeed('0x14');_0x344c45[_0xfeed('0x15')]=[{'name':_0xfeed('0x16'),'field':_0xfeed('0xd'),'foreignKey':'projectName'}];break;case _0xfeed('0x17'):_0x344c45[_0xfeed('0x12')]='JscriptyProject';break;case'contacts':_0x344c45[_0xfeed('0x12')]=_0xfeed('0x18');_0x344c45['parentSections']=[{'name':_0xfeed('0x19'),'field':'id','foreignKey':_0xfeed('0x1a')}];break;case _0xfeed('0x1b'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x1c');break;case _0xfeed('0x1d'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x1e');break;case _0xfeed('0x1f'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x20');break;case _0xfeed('0x21'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x22');break;case'chatwebsites':_0x344c45['childModel']=_0xfeed('0x23');break;case _0xfeed('0x24'):_0x344c45['childModel']='FaxQueue';break;case'faxaccounts':_0x344c45[_0xfeed('0x12')]='FaxAccount';break;case _0xfeed('0x25'):case _0xfeed('0x26'):case _0xfeed('0x27'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x28');break;case _0xfeed('0x29'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x2a');break;case _0xfeed('0x2b'):_0x344c45[_0xfeed('0x12')]='VoiceMail';break;case _0xfeed('0x2c'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x2d');_0x344c45[_0xfeed('0x15')]=[{'name':_0xfeed('0x2e'),'field':_0xfeed('0xd'),'foreignKey':_0xfeed('0x2f'),'model':_0xfeed('0x30'),'filter':{'field':'role','value':['agent']}},{'name':_0xfeed('0x31'),'field':_0xfeed('0xd'),'foreignKey':_0xfeed('0x2f'),'model':_0xfeed('0x30'),'filter':{'field':_0xfeed('0x32'),'value':[_0xfeed('0x33')]}},{'name':_0xfeed('0x34'),'field':_0xfeed('0xd'),'foreignKey':_0xfeed('0x35'),'model':_0xfeed('0x36'),'filter':{'field':_0xfeed('0x37'),'value':[_0xfeed('0x38')]}},{'name':_0xfeed('0x39'),'field':_0xfeed('0xd'),'foreignKey':_0xfeed('0x35'),'model':'VoiceQueue','filter':{'field':_0xfeed('0x37'),'value':[_0xfeed('0x3a')]}}];break;case _0xfeed('0x3b'):_0x344c45['childModel']='VoiceMusicOnHold';break;case _0xfeed('0x3c'):_0x344c45['childModel']=_0xfeed('0x3d');break;case _0xfeed('0x3e'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x3f');break;case _0xfeed('0x40'):_0x344c45[_0xfeed('0x12')]='Campaign';break;case _0xfeed('0x41'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x42');break;case _0xfeed('0x43'):_0x344c45['childModel']=_0xfeed('0x44');break;case _0xfeed('0x45'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x46');break;case _0xfeed('0x47'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x48');break;case _0xfeed('0x49'):_0x344c45[_0xfeed('0x12')]='OpenchannelAccount';break;case'smsqueues':_0x344c45[_0xfeed('0x12')]=_0xfeed('0x4a');break;case'smsaccounts':_0x344c45[_0xfeed('0x12')]=_0xfeed('0x4b');break;case _0xfeed('0x4c'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x4d');break;case _0xfeed('0x4e'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x4f');break;case _0xfeed('0x50'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x51');break;case _0xfeed('0x52'):case _0xfeed('0x53'):_0x344c45['childModel']=_0xfeed('0x36');if(_0x2234a1){_0x344c45[_0xfeed('0x15')]=[{'name':_0xfeed('0x34')},{'name':_0xfeed('0x39')}];}break;case'users':case'agents':case _0xfeed('0x54'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x30');if(_0x2234a1){_0x344c45[_0xfeed('0x15')]=[{'name':_0xfeed('0x55'),'filter':{'field':_0xfeed('0x32'),'value':[_0xfeed('0x56'),_0xfeed('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':_0xfeed('0x31')}];}break;case'zendeskaccounts':_0x344c45[_0xfeed('0x12')]=_0xfeed('0x58');break;case _0xfeed('0x59'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x5a');break;case _0xfeed('0x5b'):_0x344c45[_0xfeed('0x12')]='FreshdeskAccount';break;case _0xfeed('0x5c'):_0x344c45['childModel']=_0xfeed('0x5d');break;case'deskaccounts':_0x344c45[_0xfeed('0x12')]='DeskAccount';break;case _0xfeed('0x5e'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x5f');break;case _0xfeed('0x60'):_0x344c45[_0xfeed('0x12')]='User';break;case'cannedanswers':_0x344c45[_0xfeed('0x12')]=_0xfeed('0x61');break;case _0xfeed('0x62'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x63');break;case _0xfeed('0x64'):_0x344c45[_0xfeed('0x12')]='Dashboard';break;case'intervals':_0x344c45['childModel']=_0xfeed('0x65');break;case'pauses':_0x344c45[_0xfeed('0x12')]='Pause';break;case _0xfeed('0x66'):_0x344c45['childModel']='Schedule';break;case _0xfeed('0x67'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x68');break;case _0xfeed('0x69'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x6a');break;case _0xfeed('0x6b'):_0x344c45[_0xfeed('0x12')]='Template';break;case _0xfeed('0x6c'):_0x344c45[_0xfeed('0x12')]='Trigger';break;case _0xfeed('0x6d'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x6e');break;case _0xfeed('0x6f'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x70');break;case _0xfeed('0x71'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x72');break;case'extractedreports':_0x344c45['childModel']='AnalyticExtractedReport';_0x344c45[_0xfeed('0x15')]=[{'name':_0xfeed('0x73'),'field':'id','foreignKey':_0xfeed('0x74')}];break;case _0xfeed('0x75'):_0x344c45[_0xfeed('0x12')]=_0xfeed('0x76');break;}return _0x344c45;}function _0x5b379b(_0x146201,_0x4cf2e5){var _0x4b79b5=_0x146201[_0xfeed('0x77')](0x0)[_0xfeed('0x78')]()+_0x146201[_0xfeed('0x79')](0x1);var _0x4ae764={'type':_0x53f885[_0xfeed('0x7a')]['QueryTypes'][_0xfeed('0x7b')],'raw':!![]};return new Promise(function(_0x4cbd67,_0xca946c){var _0x43f2d9=squel[_0xfeed('0x7c')]()[_0xfeed('0x5')](_0xfeed('0x7d')+_0x4b79b5+'InteractionId','id')['field'](_0xfeed('0x7e'))[_0xfeed('0x7f')](_0xfeed('0x80')+_0x146201+'_interactions','ui')[_0xfeed('0x81')](_0xfeed('0x82'),_0x4cf2e5['id']);return _0x53f885[_0xfeed('0x83')][_0xfeed('0x84')](_0x43f2d9[_0xfeed('0x85')](),_0x4ae764)['then'](function(_0x26ed29){_0x4cf2e5[_0x4b79b5+'OpenTabs']=_0x26ed29;_0x4cbd67(_0x26ed29);})[_0xfeed('0xb')](function(_0x6f28b5){_0xca946c(_0x6f28b5);});});}return _0x169792[_0xfeed('0x86')]('UserProfile',attributes,{'tableName':_0xfeed('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x28dd8a){var _0x25efd4=require(_0xfeed('0x88'));var _0x1e7c63={'raw':_0x28dd8a[_0xfeed('0x84')][_0xfeed('0x89')],'where':{}};var _0x27dd24={};var _0x24ef60={'count':0x0,'rows':[]};var _0x2b78a9=_0x28dd8a[_0xfeed('0x84')][_0xfeed('0x8a')];var _0x59975d=_0x28dd8a[_0xfeed('0x84')]['mergeResources']||![];var _0x5ede4a=_0x3e1d62(_0x2b78a9,_0x59975d);if(!_0x5ede4a[_0xfeed('0x12')])throw new Error('Invalid\x20section\x20\x27'+_0x2b78a9+'\x27');var _0x6ea19e=[{'name':_0x2b78a9}];if(!_[_0xfeed('0x8b')](_0x5ede4a['parentSections']))_0x6ea19e=_0x5ede4a[_0xfeed('0x15')];var _0x21ef97=[];for(var _0x1b4f1c=0x0;_0x1b4f1c<_0x6ea19e[_0xfeed('0x8c')];_0x1b4f1c++){_0x21ef97[_0xfeed('0x8d')](_0x53f885[_0xfeed('0x8e')][_0xfeed('0x8f')]({'where':{'userProfileId':_0x28dd8a[_0xfeed('0x90')]['id'],'name':_0x6ea19e[_0x1b4f1c][_0xfeed('0xd')]},'raw':!![]}));}return Promise[_0xfeed('0x91')](_0x21ef97)[_0xfeed('0x8')](function(_0x5c27b9){var _0x1ba01f=_['filter'](_0x5c27b9,function(_0x272bf7){return _0x272bf7?_0x272bf7:undefined;});var _0x462188=_[_0xfeed('0x4')](_0x6ea19e,[_0xfeed('0x92'),!![]]);var _0x4757f=_[_0xfeed('0x8b')](_0x1ba01f)&&_[_0xfeed('0x8b')](_0x462188)?null:_[_0xfeed('0x93')](_0x462188,_0x1ba01f);if(!_0x4757f)return null;var _0x8b5f4e=[];for(var _0x2c91d8=0x0;_0x2c91d8<_0x4757f['length'];_0x2c91d8++){var _0xc69e34=_[_0xfeed('0x8f')](_0x6ea19e,function(_0x45c09d){return _0x4757f[_0x2c91d8]?_0x45c09d[_0xfeed('0xd')]===_0x4757f[_0x2c91d8]['name']:null;});if(_0xc69e34){if(_0x4757f[_0x2c91d8][_0xfeed('0x92')]){_0x8b5f4e[_0xfeed('0x8d')](_0x348df2(_0x5ede4a['childModel'],_0x4757f[_0x2c91d8]));}else{if(!_0x4757f[_0x2c91d8]['autoAssociation']){_0x8b5f4e[_0xfeed('0x8d')](_0x3dafbb(_0xc69e34,_0x4757f[_0x2c91d8],_0x5ede4a[_0xfeed('0x12')]));}else{if(_0xc69e34[_0xfeed('0xc')]){_0x8b5f4e[_0xfeed('0x8d')](_0x5337bb(_0xc69e34,_0x4757f[_0x2c91d8]));}}}}}return Promise[_0xfeed('0x91')](_0x8b5f4e);})[_0xfeed('0x8')](function(_0x3e93f9){var _0x3977d3=_0x3e93f9;var _0x91bc14=null;if(_0x3977d3){_0x91bc14=_0x3977d3[_0xfeed('0x8c')]===0x1?_0x3977d3[0x0]:null;}if(!_0x91bc14&&!_0x3977d3)return _0x24ef60;var _0x17b94b=_0x53f885[_0x5ede4a['childModel']][_0xfeed('0x94')];_0x27dd24[_0xfeed('0xc')]=_[_0xfeed('0x95')](_0x17b94b);_0x27dd24[_0xfeed('0x84')]=_[_0xfeed('0x95')](_0x28dd8a[_0xfeed('0x84')]);_0x27dd24[_0xfeed('0x96')]=_[_0xfeed('0x97')](_0x27dd24[_0xfeed('0xc')],_0x27dd24['query']);_0x1e7c63[_0xfeed('0x98')]=_['intersection'](_0x27dd24[_0xfeed('0xc')],_0x25efd4['fields'](_0x28dd8a[_0xfeed('0x84')][_0xfeed('0x99')]));_0x1e7c63['attributes']=_0x1e7c63[_0xfeed('0x98')][_0xfeed('0x8c')]?_0x1e7c63[_0xfeed('0x98')]:_0x27dd24[_0xfeed('0xc')];if(!_0x28dd8a[_0xfeed('0x84')][_0xfeed('0x9a')]('nolimit')){_0x1e7c63[_0xfeed('0x9b')]=_0x25efd4[_0xfeed('0x9b')](_0x28dd8a[_0xfeed('0x84')][_0xfeed('0x9b')]);_0x1e7c63[_0xfeed('0x9c')]=_0x25efd4[_0xfeed('0x9c')](_0x28dd8a[_0xfeed('0x84')][_0xfeed('0x9c')]);}_0x1e7c63[_0xfeed('0x9d')]=_0x25efd4['sort'](_0x28dd8a['query'][_0xfeed('0x9e')]);_0x1e7c63['where']=_0x25efd4[_0xfeed('0x96')](_[_0xfeed('0x9f')](_0x28dd8a[_0xfeed('0x84')],_0x27dd24[_0xfeed('0x96')]));if(_0x28dd8a['query']['filter']){_0x1e7c63['where']=_['merge'](_0x1e7c63[_0xfeed('0x81')],{'$or':_[_0xfeed('0xa')](_0x17b94b,function(_0x28a7ac){if(_0x28a7ac[_0xfeed('0x37')][_0xfeed('0xa0')]!==_0xfeed('0xa1')){var _0x3c56a3={};_0x3c56a3[_0x28a7ac['field']]={'$like':'%'+_0x28dd8a[_0xfeed('0x84')][_0xfeed('0x4')]+'%'};return _0x3c56a3;}})});}var _0x5a96ff=[];var _0x4a79cf=null;var _0xfa1e2a={};if(_0x91bc14){_0x4a79cf=_[_0xfeed('0x8f')](_0x6ea19e,[_0xfeed('0xd'),_0x91bc14[_0xfeed('0xd')]]);if(_0x4a79cf[_0xfeed('0x5')]){_0xfa1e2a={};if(_0x5ede4a[_0xfeed('0x12')]===_0xfeed('0xf')){_0xfa1e2a[_0x4a79cf[_0xfeed('0xa2')]]=_[_0xfeed('0xa')](_0x91bc14[_0xfeed('0x9')],'id');}else{_0xfa1e2a[_0x4a79cf[_0xfeed('0xa2')]]=_0x91bc14['associatedResources'];}_0x5a96ff[_0xfeed('0x8d')](_0xfa1e2a);}else{_0x1e7c63['where']['id']=_0x91bc14[_0xfeed('0x9')];}}else{for(var _0x4d45bf=0x0;_0x4d45bf<_0x3977d3[_0xfeed('0x8c')];_0x4d45bf++){_0x4a79cf=_['find'](_0x6ea19e,[_0xfeed('0xd'),_0x3977d3[_0x4d45bf][_0xfeed('0xd')]]);if(_0x4a79cf[_0xfeed('0x5')]){_0xfa1e2a={};_0xfa1e2a[_0x4a79cf[_0xfeed('0xa2')]]=_0x3977d3[_0x4d45bf][_0xfeed('0x9')];_0x5a96ff[_0xfeed('0x8d')](_0xfa1e2a);}else{if(!_0x1e7c63[_0xfeed('0x81')]['id'])_0x1e7c63[_0xfeed('0x81')]['id']=[];_0x3977d3[_0x4d45bf][_0xfeed('0x9')][_0xfeed('0xa3')](function(_0x25eddd){_0x1e7c63['where']['id'][_0xfeed('0x8d')](_0x25eddd);});}}}if(!_[_0xfeed('0x8b')](_0x5a96ff)){_0x1e7c63['where']=_['merge'](_0x1e7c63[_0xfeed('0x81')],{'$and':{'$or':_0x5a96ff}});}_0x1e7c63=_[_0xfeed('0xa4')]({},_0x1e7c63,_0x28dd8a['options']);if(_0x91bc14&&!_0x91bc14['autoAssociation']&&_0x5ede4a['childModel']===_0xfeed('0xf')){if(_0x28dd8a[_0xfeed('0x84')][_0xfeed('0xa5')]){_0x1e7c63[_0xfeed('0xa6')]=[{'all':!![]}];}return _0x53f885[_0x5ede4a[_0xfeed('0x12')]][_0xfeed('0x7')](_0x1e7c63)[_0xfeed('0x8')](function(_0x11b763){var _0xfb9fc=[];_0x11b763[_0xfeed('0xa3')](function(_0x4062c5){var _0x26a17c;switch(_0x4062c5[_0xfeed('0xa7')]){case'default':_0x26a17c=_[_0xfeed('0x8f')](_0x91bc14[_0xfeed('0x9')],function(_0x461df3){return _0x461df3['id']===_0x4062c5[_0xfeed('0x74')]&&_0x461df3[_0xfeed('0x37')]===_0xfeed('0xa8');});break;case _0xfeed('0xa9'):_0x26a17c=_[_0xfeed('0x8f')](_0x91bc14[_0xfeed('0x9')],function(_0x3eeb47){return _0x3eeb47['id']===_0x4062c5[_0xfeed('0x74')]&&_0x3eeb47[_0xfeed('0x37')]===_0xfeed('0xaa');});break;}if(_0x26a17c)_0xfb9fc[_0xfeed('0x8d')](_0x4062c5);});_0x24ef60[_0xfeed('0xab')]=_0xfb9fc[_0xfeed('0x8c')];_0x24ef60[_0xfeed('0xac')]=_0xfb9fc;return _0x24ef60;});}else{if(!_[_0xfeed('0x8b')](_0x28dd8a[_0xfeed('0x84')][_0xfeed('0xad')])){_0x1e7c63[_0xfeed('0x81')]['id']=_0x1e7c63[_0xfeed('0x81')]['id']?_['intersection'](_0x1e7c63[_0xfeed('0x81')]['id'],_0x28dd8a['query']['ids']):_0x28dd8a[_0xfeed('0x84')][_0xfeed('0xad')];if(_0x28dd8a[_0xfeed('0x84')]['customSorting']){_0x1e7c63[_0xfeed('0x9d')]=_0x28dd8a[_0xfeed('0x84')][_0xfeed('0xae')];}}if(_0x28dd8a['query'][_0xfeed('0xaf')]){_0x1e7c63[_0xfeed('0x81')]=_[_0xfeed('0xa4')](_0x1e7c63['where'],{'$and':_0x28dd8a['query'][_0xfeed('0xaf')]});}return _0x53f885[_0x5ede4a[_0xfeed('0x12')]]['count']({'where':_0x1e7c63[_0xfeed('0x81')]})[_0xfeed('0x8')](function(_0x461a32){_0x24ef60[_0xfeed('0xab')]=_0x461a32;if(_0x28dd8a[_0xfeed('0x84')]['includeAll']){if(_0x5ede4a[_0xfeed('0x12')]===_0xfeed('0x18')){_0x1e7c63[_0xfeed('0xa6')]=[{'model':_0x53f885[_0xfeed('0x6a')],'as':_0xfeed('0xb0'),'attributes':['id','name',_0xfeed('0xb1')],'required':_0x28dd8a[_0xfeed('0x84')]['tag']?!![]:![]},{'model':_0x53f885[_0xfeed('0x6a')],'as':'ThroughTags','attributes':['id','name',_0xfeed('0xb1')],'through':_0x28dd8a[_0xfeed('0x84')][_0xfeed('0xb2')]?{'attributes':[],'where':{'TagId':_0x28dd8a[_0xfeed('0x84')][_0xfeed('0xb2')]||undefined}}:{},'required':_0x28dd8a[_0xfeed('0x84')][_0xfeed('0xb2')]?!![]:![]}];}else{_0x1e7c63[_0xfeed('0xa6')]=[{'all':!![]}];}}return _0x53f885[_0x5ede4a[_0xfeed('0x12')]][_0xfeed('0x7')](_0x1e7c63);})[_0xfeed('0x8')](function(_0x472f4e){_0x24ef60[_0xfeed('0xac')]=_0x472f4e;if(_0x2b78a9==='Agents'&&_0x28dd8a[_0xfeed('0x84')][_0xfeed('0xb3')]===_0xfeed('0xb4')){var _0x5522c0=[];for(var _0x3956af=0x0;_0x3956af<_0x24ef60[_0xfeed('0xac')][_0xfeed('0x8c')];_0x3956af++){_0x5522c0[_0xfeed('0x8d')](_0x5b379b('chat',_0x24ef60['rows'][_0x3956af][_0xfeed('0xb5')]));_0x5522c0[_0xfeed('0x8d')](_0x5b379b(_0xfeed('0xb6'),_0x24ef60[_0xfeed('0xac')][_0x3956af][_0xfeed('0xb5')]));_0x5522c0['push'](_0x5b379b(_0xfeed('0xb7'),_0x24ef60[_0xfeed('0xac')][_0x3956af][_0xfeed('0xb5')]));_0x5522c0[_0xfeed('0x8d')](_0x5b379b(_0xfeed('0xb8'),_0x24ef60[_0xfeed('0xac')][_0x3956af][_0xfeed('0xb5')]));_0x5522c0['push'](_0x5b379b(_0xfeed('0xb9'),_0x24ef60[_0xfeed('0xac')][_0x3956af][_0xfeed('0xb5')]));_0x5522c0[_0xfeed('0x8d')](_0x5b379b('whatsapp',_0x24ef60[_0xfeed('0xac')][_0x3956af][_0xfeed('0xb5')]));}return Promise[_0xfeed('0x91')](_0x5522c0)['then'](function(){return _0x24ef60;});}return _0x24ef60;});}});}}});}; \ No newline at end of file +var _0x5168=['user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','raw','section','mergeResources','push','UserProfileSection','find','params','all','ignore','isEmpty','union','length','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','pick','merge','key','VIRTUAL','foreignKey','forEach','options','include','reportType','default','DefaultReports','custom','CustomReports','ids','customSorting','extraQueryConditions','count','includeAll','Tags','tag','color','rows','openTabs','chat','dataValues','fax','mail','openchannel','lodash','./userProfile.attributes','exports','models','filter','field','findAll','then','map','catch','value','model','name','UserProfileResource','associatedResources','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','contacts','CmContact','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','teams','voicequeues','queuecampaigns','User','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','Pause','scheduler','Schedule','Sound','tags','Tag','templates','triggers','Trigger','trunks','Trunk','plugins','Plugin','extractedreports','Reports','reportId','metrics','charAt','slice','SELECT','select','InteractionId','ui.createdAt','from'];(function(_0x453dd5,_0x106140){var _0x28b34e=function(_0x587a7f){while(--_0x587a7f){_0x453dd5['push'](_0x453dd5['shift']());}};_0x28b34e(++_0x106140);}(_0x5168,0xf6));var _0x8516=function(_0x5cc8f6,_0x10ade0){_0x5cc8f6=_0x5cc8f6-0x0;var _0x1986e8=_0x5168[_0x5cc8f6];return _0x1986e8;};'use strict';var _=require(_0x8516('0x0'));var attributes=require(_0x8516('0x1'));var squel=require('squel');module[_0x8516('0x2')]=function(_0x3d3810){var _0x5b97b7=_0x3d3810[_0x8516('0x3')];function _0x5b9b47(_0x7ee731,_0x3424d6){return new Promise(function(_0x531d64,_0x5af281){if(!_0x3424d6)return _0x531d64(null);var _0x2cf71f=_0x3424d6[_0x8516('0x4')]?{[_0x3424d6['filter'][_0x8516('0x5')]]:_0x3424d6[_0x8516('0x4')]['value']}:undefined;return _0x5b97b7[_0x7ee731][_0x8516('0x6')]({'where':_0x2cf71f,'raw':!![]})[_0x8516('0x7')](function(_0x381bb0){_0x3424d6['associatedResources']=_[_0x8516('0x8')](_0x381bb0,'id');_0x531d64(_0x3424d6);})[_0x8516('0x9')](function(_0x55e619){_0x5af281(_0x55e619);});});}function _0x5c48a2(_0x4e8b91,_0x27dac0){return new Promise(function(_0x3f0dac,_0x362362){var _0x32ea29=_0x4e8b91[_0x8516('0x4')]?{[_0x4e8b91[_0x8516('0x4')]['field']]:_0x4e8b91[_0x8516('0x4')][_0x8516('0xa')]}:undefined;return _0x5b97b7[_0x4e8b91[_0x8516('0xb')]][_0x8516('0x6')]({'where':_0x32ea29,'raw':!![]})['then'](function(_0x1e17ac){_0x27dac0['associatedResources']=_[_0x8516('0x8')](_0x1e17ac,function(_0x162e72){return _0x162e72[_0x8516('0xc')];});_0x3f0dac(_0x27dac0);})[_0x8516('0x9')](function(_0x494ec4){_0x362362(_0x494ec4);});});}function _0x2310a2(_0xa373fe,_0x481713,_0x4623bd){if(!_0x481713)return Promise['resolve'](null);return new Promise(function(_0x3c15d0,_0x5217ee){return _0x5b97b7[_0x8516('0xd')][_0x8516('0x6')]({'where':{'sectionId':_0x481713['id']},'raw':!![]})[_0x8516('0x7')](function(_0x109f67){if(_0xa373fe[_0x8516('0x5')]&&_0xa373fe['field']!=='id'){_0x481713[_0x8516('0xe')]=_[_0x8516('0x8')](_0x109f67,function(_0x174344){return _0x174344[_0xa373fe[_0x8516('0x5')]];});}else{if(_0x4623bd===_0x8516('0xf')){_0x481713[_0x8516('0xe')]=_['map'](_0x109f67,function(_0x4345e5){return{'id':_0x4345e5[_0x8516('0x10')],'type':_0x4345e5['type']};});}else{_0x481713[_0x8516('0xe')]=_[_0x8516('0x8')](_0x109f67,function(_0x38db2f){return _0x38db2f[_0x8516('0x10')];});}}_0x3c15d0(_0x481713);})['catch'](function(_0x2da355){_0x5217ee(_0x2da355);});});}function _0x2966dc(_0x1353e,_0x5bad41){var _0x48625c={'parentSections':[]};switch(_0x1353e[_0x8516('0x11')]()){case _0x8516('0x12'):_0x48625c[_0x8516('0x13')]=_0x8516('0x14');break;case'odbc':_0x48625c['childModel']=_0x8516('0x15');break;case _0x8516('0x16'):_0x48625c[_0x8516('0x13')]=_0x8516('0x17');_0x48625c[_0x8516('0x18')]=[{'name':_0x8516('0x19'),'field':'name','foreignKey':_0x8516('0x1a')}];break;case'projects':_0x48625c['childModel']='JscriptyProject';break;case _0x8516('0x1b'):_0x48625c[_0x8516('0x13')]=_0x8516('0x1c');_0x48625c['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x8516('0x1d')}];break;case _0x8516('0x1e'):_0x48625c[_0x8516('0x13')]='CmList';break;case _0x8516('0x1f'):_0x48625c[_0x8516('0x13')]=_0x8516('0x20');break;case'globalcustomfields':_0x48625c['childModel']=_0x8516('0x21');break;case _0x8516('0x22'):_0x48625c[_0x8516('0x13')]=_0x8516('0x23');break;case _0x8516('0x24'):_0x48625c['childModel']=_0x8516('0x25');break;case _0x8516('0x26'):_0x48625c[_0x8516('0x13')]=_0x8516('0x27');break;case _0x8516('0x28'):_0x48625c['childModel']=_0x8516('0x29');break;case _0x8516('0x2a'):case'internalroutes':case'outboundroutes':_0x48625c[_0x8516('0x13')]='VoiceExtension';break;case _0x8516('0x2b'):_0x48625c[_0x8516('0x13')]=_0x8516('0x2c');break;case _0x8516('0x2d'):_0x48625c[_0x8516('0x13')]=_0x8516('0x2e');break;case'voicerecordings':_0x48625c[_0x8516('0x13')]='VoiceRecording';_0x48625c[_0x8516('0x18')]=[{'name':_0x8516('0x2f'),'field':_0x8516('0xc'),'foreignKey':_0x8516('0x30'),'model':'User','filter':{'field':'role','value':['agent']}},{'name':_0x8516('0x31'),'field':_0x8516('0xc'),'foreignKey':_0x8516('0x30'),'model':'User','filter':{'field':_0x8516('0x32'),'value':[_0x8516('0x33')]}},{'name':_0x8516('0x34'),'field':_0x8516('0xc'),'foreignKey':_0x8516('0x35'),'model':_0x8516('0x36'),'filter':{'field':_0x8516('0x37'),'value':[_0x8516('0x38')]}},{'name':_0x8516('0x39'),'field':_0x8516('0xc'),'foreignKey':_0x8516('0x35'),'model':'VoiceQueue','filter':{'field':_0x8516('0x37'),'value':['outbound']}}];break;case _0x8516('0x3a'):_0x48625c[_0x8516('0x13')]=_0x8516('0x3b');break;case _0x8516('0x3c'):_0x48625c['childModel']=_0x8516('0x3d');break;case _0x8516('0x3e'):_0x48625c[_0x8516('0x13')]=_0x8516('0x3f');break;case _0x8516('0x40'):_0x48625c['childModel']='Campaign';break;case _0x8516('0x41'):_0x48625c[_0x8516('0x13')]=_0x8516('0x42');break;case _0x8516('0x43'):_0x48625c['childModel']=_0x8516('0x44');break;case _0x8516('0x45'):_0x48625c[_0x8516('0x13')]=_0x8516('0x46');break;case _0x8516('0x47'):_0x48625c[_0x8516('0x13')]=_0x8516('0x48');break;case _0x8516('0x49'):_0x48625c[_0x8516('0x13')]=_0x8516('0x4a');break;case'smsqueues':_0x48625c['childModel']=_0x8516('0x4b');break;case _0x8516('0x4c'):_0x48625c[_0x8516('0x13')]=_0x8516('0x4d');break;case'whatsappqueues':_0x48625c[_0x8516('0x13')]=_0x8516('0x4e');break;case _0x8516('0x4f'):_0x48625c[_0x8516('0x13')]='WhatsappAccount';break;case _0x8516('0x50'):_0x48625c['childModel']='Team';break;case _0x8516('0x51'):case _0x8516('0x52'):_0x48625c[_0x8516('0x13')]='VoiceQueue';if(_0x5bad41){_0x48625c[_0x8516('0x18')]=[{'name':_0x8516('0x34')},{'name':_0x8516('0x39')}];}break;case'users':case'agents':case'telephones':_0x48625c[_0x8516('0x13')]=_0x8516('0x53');if(_0x5bad41){_0x48625c[_0x8516('0x18')]=[{'name':_0x8516('0x54'),'filter':{'field':_0x8516('0x32'),'value':[_0x8516('0x55'),_0x8516('0x56')]},'ignore':!![]},{'name':_0x8516('0x2f')},{'name':_0x8516('0x31')}];}break;case _0x8516('0x57'):_0x48625c[_0x8516('0x13')]=_0x8516('0x58');break;case _0x8516('0x59'):_0x48625c['childModel']=_0x8516('0x5a');break;case _0x8516('0x5b'):_0x48625c[_0x8516('0x13')]='FreshdeskAccount';break;case _0x8516('0x5c'):_0x48625c['childModel']=_0x8516('0x5d');break;case _0x8516('0x5e'):_0x48625c[_0x8516('0x13')]='DeskAccount';break;case'zohoaccounts':_0x48625c['childModel']=_0x8516('0x5f');break;case _0x8516('0x60'):_0x48625c['childModel']=_0x8516('0x53');break;case _0x8516('0x61'):_0x48625c['childModel']=_0x8516('0x62');break;case _0x8516('0x63'):_0x48625c[_0x8516('0x13')]='Disposition';break;case _0x8516('0x64'):_0x48625c[_0x8516('0x13')]='Dashboard';break;case _0x8516('0x65'):_0x48625c[_0x8516('0x13')]='Interval';break;case'pauses':_0x48625c[_0x8516('0x13')]=_0x8516('0x66');break;case _0x8516('0x67'):_0x48625c[_0x8516('0x13')]=_0x8516('0x68');break;case'sounds':_0x48625c[_0x8516('0x13')]=_0x8516('0x69');break;case _0x8516('0x6a'):_0x48625c[_0x8516('0x13')]=_0x8516('0x6b');break;case _0x8516('0x6c'):_0x48625c[_0x8516('0x13')]='Template';break;case _0x8516('0x6d'):_0x48625c[_0x8516('0x13')]=_0x8516('0x6e');break;case _0x8516('0x6f'):_0x48625c['childModel']=_0x8516('0x70');break;case'variables':_0x48625c['childModel']='Variable';break;case _0x8516('0x71'):_0x48625c[_0x8516('0x13')]=_0x8516('0x72');break;case _0x8516('0x73'):_0x48625c['childModel']=_0x8516('0xf');_0x48625c[_0x8516('0x18')]=[{'name':_0x8516('0x74'),'field':'id','foreignKey':_0x8516('0x75')}];break;case _0x8516('0x76'):_0x48625c[_0x8516('0x13')]='AnalyticMetric';break;}return _0x48625c;}function _0x67013d(_0x5ca186,_0x46fc41){var _0xc2109c=_0x5ca186[_0x8516('0x77')](0x0)['toUpperCase']()+_0x5ca186[_0x8516('0x78')](0x1);var _0x185aff={'type':_0x5b97b7['Sequelize']['QueryTypes'][_0x8516('0x79')],'raw':!![]};return new Promise(function(_0x182240,_0x10b4b5){var _0x52ee5=squel[_0x8516('0x7a')]()[_0x8516('0x5')]('ui.'+_0xc2109c+_0x8516('0x7b'),'id')[_0x8516('0x5')](_0x8516('0x7c'))[_0x8516('0x7d')](_0x8516('0x7e')+_0x5ca186+_0x8516('0x7f'),'ui')[_0x8516('0x80')](_0x8516('0x81'),_0x46fc41['id']);return _0x5b97b7[_0x8516('0x82')][_0x8516('0x83')](_0x52ee5[_0x8516('0x84')](),_0x185aff)[_0x8516('0x7')](function(_0x4153bb){_0x46fc41[_0xc2109c+_0x8516('0x85')]=_0x4153bb;_0x182240(_0x4153bb);})['catch'](function(_0x842eac){_0x10b4b5(_0x842eac);});});}return _0x3d3810[_0x8516('0x86')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x563246){var _0x518a59=require('../../components/parsers/qs');var _0x58a6b1={'raw':_0x563246[_0x8516('0x83')][_0x8516('0x87')],'where':{}};var _0x4a859a={};var _0x1262f5={'count':0x0,'rows':[]};var _0x28647c=_0x563246[_0x8516('0x83')][_0x8516('0x88')];var _0x57ecea=_0x563246[_0x8516('0x83')][_0x8516('0x89')]||![];var _0x17f6eb=_0x2966dc(_0x28647c,_0x57ecea);if(!_0x17f6eb['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x28647c+'\x27');var _0x21fde2=[{'name':_0x28647c}];if(!_['isEmpty'](_0x17f6eb['parentSections']))_0x21fde2=_0x17f6eb[_0x8516('0x18')];var _0x15241e=[];for(var _0x3d3460=0x0;_0x3d3460<_0x21fde2['length'];_0x3d3460++){_0x15241e[_0x8516('0x8a')](_0x5b97b7[_0x8516('0x8b')][_0x8516('0x8c')]({'where':{'userProfileId':_0x563246[_0x8516('0x8d')]['id'],'name':_0x21fde2[_0x3d3460][_0x8516('0xc')]},'raw':!![]}));}return Promise[_0x8516('0x8e')](_0x15241e)[_0x8516('0x7')](function(_0x1719f5){var _0x576046=_['filter'](_0x1719f5,function(_0x53d5e4){return _0x53d5e4?_0x53d5e4:undefined;});var _0x1431bc=_[_0x8516('0x4')](_0x21fde2,[_0x8516('0x8f'),!![]]);var _0x2cfa32=_[_0x8516('0x90')](_0x576046)&&_[_0x8516('0x90')](_0x1431bc)?null:_[_0x8516('0x91')](_0x1431bc,_0x576046);if(!_0x2cfa32)return null;var _0x5a1669=[];for(var _0xb92d9a=0x0;_0xb92d9a<_0x2cfa32[_0x8516('0x92')];_0xb92d9a++){var _0x22071d=_[_0x8516('0x8c')](_0x21fde2,function(_0x3525ac){return _0x2cfa32[_0xb92d9a]?_0x3525ac[_0x8516('0xc')]===_0x2cfa32[_0xb92d9a][_0x8516('0xc')]:null;});if(_0x22071d){if(_0x2cfa32[_0xb92d9a]['ignore']){_0x5a1669[_0x8516('0x8a')](_0x5b9b47(_0x17f6eb[_0x8516('0x13')],_0x2cfa32[_0xb92d9a]));}else{if(!_0x2cfa32[_0xb92d9a]['autoAssociation']){_0x5a1669['push'](_0x2310a2(_0x22071d,_0x2cfa32[_0xb92d9a],_0x17f6eb[_0x8516('0x13')]));}else{if(_0x22071d[_0x8516('0xb')]){_0x5a1669[_0x8516('0x8a')](_0x5c48a2(_0x22071d,_0x2cfa32[_0xb92d9a]));}}}}}return Promise['all'](_0x5a1669);})[_0x8516('0x7')](function(_0x188941){var _0x5dc0c0=_0x188941;var _0x32b16d=null;if(_0x5dc0c0){_0x32b16d=_0x5dc0c0['length']===0x1?_0x5dc0c0[0x0]:null;}if(!_0x32b16d&&!_0x5dc0c0)return _0x1262f5;var _0xe5a53=_0x5b97b7[_0x17f6eb['childModel']][_0x8516('0x93')];_0x4a859a['model']=_[_0x8516('0x94')](_0xe5a53);_0x4a859a[_0x8516('0x83')]=_[_0x8516('0x94')](_0x563246[_0x8516('0x83')]);_0x4a859a[_0x8516('0x95')]=_[_0x8516('0x96')](_0x4a859a['model'],_0x4a859a[_0x8516('0x83')]);_0x58a6b1[_0x8516('0x97')]=_[_0x8516('0x96')](_0x4a859a[_0x8516('0xb')],_0x518a59[_0x8516('0x98')](_0x563246[_0x8516('0x83')][_0x8516('0x98')]));_0x58a6b1[_0x8516('0x97')]=_0x58a6b1[_0x8516('0x97')][_0x8516('0x92')]?_0x58a6b1['attributes']:_0x4a859a[_0x8516('0xb')];if(!_0x563246[_0x8516('0x83')][_0x8516('0x99')](_0x8516('0x9a'))){_0x58a6b1[_0x8516('0x9b')]=_0x518a59[_0x8516('0x9b')](_0x563246['query'][_0x8516('0x9b')]);_0x58a6b1[_0x8516('0x9c')]=_0x518a59[_0x8516('0x9c')](_0x563246[_0x8516('0x83')]['offset']);}_0x58a6b1[_0x8516('0x9d')]=_0x518a59['sort'](_0x563246[_0x8516('0x83')]['sort']);_0x58a6b1[_0x8516('0x80')]=_0x518a59['filters'](_[_0x8516('0x9e')](_0x563246[_0x8516('0x83')],_0x4a859a[_0x8516('0x95')]));if(_0x563246[_0x8516('0x83')][_0x8516('0x4')]){_0x58a6b1[_0x8516('0x80')]=_[_0x8516('0x9f')](_0x58a6b1['where'],{'$or':_[_0x8516('0x8')](_0xe5a53,function(_0x39fcfe){if(_0x39fcfe[_0x8516('0x37')][_0x8516('0xa0')]!==_0x8516('0xa1')){var _0x42a175={};_0x42a175[_0x39fcfe['field']]={'$like':'%'+_0x563246[_0x8516('0x83')]['filter']+'%'};return _0x42a175;}})});}var _0x3fa53e=[];var _0x464b1d=null;var _0x50e12a={};if(_0x32b16d){_0x464b1d=_[_0x8516('0x8c')](_0x21fde2,[_0x8516('0xc'),_0x32b16d[_0x8516('0xc')]]);if(_0x464b1d[_0x8516('0x5')]){_0x50e12a={};if(_0x17f6eb[_0x8516('0x13')]==='AnalyticExtractedReport'){_0x50e12a[_0x464b1d[_0x8516('0xa2')]]=_[_0x8516('0x8')](_0x32b16d[_0x8516('0xe')],'id');}else{_0x50e12a[_0x464b1d[_0x8516('0xa2')]]=_0x32b16d['associatedResources'];}_0x3fa53e[_0x8516('0x8a')](_0x50e12a);}else{_0x58a6b1['where']['id']=_0x32b16d[_0x8516('0xe')];}}else{for(var _0x21b5aa=0x0;_0x21b5aa<_0x5dc0c0[_0x8516('0x92')];_0x21b5aa++){_0x464b1d=_[_0x8516('0x8c')](_0x21fde2,[_0x8516('0xc'),_0x5dc0c0[_0x21b5aa][_0x8516('0xc')]]);if(_0x464b1d['field']){_0x50e12a={};_0x50e12a[_0x464b1d[_0x8516('0xa2')]]=_0x5dc0c0[_0x21b5aa][_0x8516('0xe')];_0x3fa53e[_0x8516('0x8a')](_0x50e12a);}else{if(!_0x58a6b1['where']['id'])_0x58a6b1[_0x8516('0x80')]['id']=[];_0x5dc0c0[_0x21b5aa]['associatedResources'][_0x8516('0xa3')](function(_0x42e5bc){_0x58a6b1[_0x8516('0x80')]['id'][_0x8516('0x8a')](_0x42e5bc);});}}}if(!_[_0x8516('0x90')](_0x3fa53e)){_0x58a6b1[_0x8516('0x80')]=_[_0x8516('0x9f')](_0x58a6b1[_0x8516('0x80')],{'$and':{'$or':_0x3fa53e}});}_0x58a6b1=_[_0x8516('0x9f')]({},_0x58a6b1,_0x563246[_0x8516('0xa4')]);if(_0x32b16d&&!_0x32b16d['autoAssociation']&&_0x17f6eb['childModel']===_0x8516('0xf')){if(_0x563246[_0x8516('0x83')]['includeAll']){_0x58a6b1[_0x8516('0xa5')]=[{'all':!![]}];}return _0x5b97b7[_0x17f6eb[_0x8516('0x13')]][_0x8516('0x6')](_0x58a6b1)['then'](function(_0x363504){var _0x4b0e58=[];_0x363504[_0x8516('0xa3')](function(_0x2bed02){var _0x1758bb;switch(_0x2bed02[_0x8516('0xa6')]){case _0x8516('0xa7'):_0x1758bb=_[_0x8516('0x8c')](_0x32b16d[_0x8516('0xe')],function(_0x18c825){return _0x18c825['id']===_0x2bed02['reportId']&&_0x18c825[_0x8516('0x37')]===_0x8516('0xa8');});break;case _0x8516('0xa9'):_0x1758bb=_['find'](_0x32b16d[_0x8516('0xe')],function(_0x38e60f){return _0x38e60f['id']===_0x2bed02[_0x8516('0x75')]&&_0x38e60f['type']===_0x8516('0xaa');});break;}if(_0x1758bb)_0x4b0e58[_0x8516('0x8a')](_0x2bed02);});_0x1262f5['count']=_0x4b0e58[_0x8516('0x92')];_0x1262f5['rows']=_0x4b0e58;return _0x1262f5;});}else{if(!_[_0x8516('0x90')](_0x563246[_0x8516('0x83')][_0x8516('0xab')])){_0x58a6b1[_0x8516('0x80')]['id']=_0x58a6b1['where']['id']?_[_0x8516('0x96')](_0x58a6b1[_0x8516('0x80')]['id'],_0x563246['query']['ids']):_0x563246[_0x8516('0x83')][_0x8516('0xab')];if(_0x563246['query'][_0x8516('0xac')]){_0x58a6b1['order']=_0x563246[_0x8516('0x83')]['customSorting'];}}if(_0x563246[_0x8516('0x83')][_0x8516('0xad')]){_0x58a6b1[_0x8516('0x80')]=_['merge'](_0x58a6b1[_0x8516('0x80')],{'$and':_0x563246[_0x8516('0x83')][_0x8516('0xad')]});}return _0x5b97b7[_0x17f6eb[_0x8516('0x13')]]['count']({'where':_0x58a6b1[_0x8516('0x80')]})[_0x8516('0x7')](function(_0x5101aa){_0x1262f5[_0x8516('0xae')]=_0x5101aa;if(_0x563246['query'][_0x8516('0xaf')]){if(_0x17f6eb['childModel']===_0x8516('0x1c')){_0x58a6b1[_0x8516('0xa5')]=[{'model':_0x5b97b7['Tag'],'as':_0x8516('0xb0'),'attributes':['id',_0x8516('0xc'),'color'],'required':_0x563246[_0x8516('0x83')][_0x8516('0xb1')]?!![]:![]},{'model':_0x5b97b7['Tag'],'as':'ThroughTags','attributes':['id','name',_0x8516('0xb2')],'through':_0x563246[_0x8516('0x83')]['tag']?{'attributes':[],'where':{'TagId':_0x563246[_0x8516('0x83')]['tag']||undefined}}:{},'required':_0x563246[_0x8516('0x83')][_0x8516('0xb1')]?!![]:![]}];}else{_0x58a6b1[_0x8516('0xa5')]=[{'all':!![]}];}}return _0x5b97b7[_0x17f6eb[_0x8516('0x13')]][_0x8516('0x6')](_0x58a6b1);})[_0x8516('0x7')](function(_0xe4bab0){_0x1262f5[_0x8516('0xb3')]=_0xe4bab0;if(_0x28647c===_0x8516('0x2f')&&_0x563246[_0x8516('0x83')][_0x8516('0xb4')]==='true'){var _0x17418d=[];for(var _0x40893c=0x0;_0x40893c<_0x1262f5[_0x8516('0xb3')][_0x8516('0x92')];_0x40893c++){_0x17418d[_0x8516('0x8a')](_0x67013d(_0x8516('0xb5'),_0x1262f5[_0x8516('0xb3')][_0x40893c]['dataValues']));_0x17418d[_0x8516('0x8a')](_0x67013d('sms',_0x1262f5[_0x8516('0xb3')][_0x40893c][_0x8516('0xb6')]));_0x17418d[_0x8516('0x8a')](_0x67013d(_0x8516('0xb7'),_0x1262f5['rows'][_0x40893c]['dataValues']));_0x17418d[_0x8516('0x8a')](_0x67013d(_0x8516('0xb8'),_0x1262f5['rows'][_0x40893c][_0x8516('0xb6')]));_0x17418d[_0x8516('0x8a')](_0x67013d(_0x8516('0xb9'),_0x1262f5[_0x8516('0xb3')][_0x40893c][_0x8516('0xb6')]));_0x17418d[_0x8516('0x8a')](_0x67013d('whatsapp',_0x1262f5[_0x8516('0xb3')][_0x40893c]['dataValues']));}return Promise[_0x8516('0x8e')](_0x17418d)[_0x8516('0x7')](function(){return _0x1262f5;});}return _0x1262f5;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index cc6160a..c52c14e 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 _0x307e=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x1115f1,_0x4c4008){var _0x523380=function(_0x41ab6c){while(--_0x41ab6c){_0x1115f1['push'](_0x1115f1['shift']());}};_0x523380(++_0x4c4008);}(_0x307e,0xc9));var _0xe307=function(_0x43e6bf,_0x47342a){_0x43e6bf=_0x43e6bf-0x0;var _0x1d93f6=_0x307e[_0x43e6bf];return _0x1d93f6;};'use strict';var _=require(_0xe307('0x0'));var util=require(_0xe307('0x1'));var moment=require(_0xe307('0x2'));var BPromise=require(_0xe307('0x3'));var rs=require(_0xe307('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe307('0x5'))['db'];var utils=require(_0xe307('0x6'));var logger=require('../../config/logger')(_0xe307('0x7'));var config=require('../../config/environment');var jayson=require(_0xe307('0x8'));var client=jayson[_0xe307('0x9')][_0xe307('0xa')]({'port':0x232a});config['redis']=_[_0xe307('0xb')](config[_0xe307('0xc')],{'host':_0xe307('0xd'),'port':0x18eb});var socket=require(_0xe307('0xe'))(new Redis(config[_0xe307('0xc')]));require(_0xe307('0xf'))[_0xe307('0x10')](socket);function respondWithRpcPromise(_0x3ab559,_0x231b98,_0x393a82){return new BPromise(function(_0x217f0a,_0x4219b1){return client[_0xe307('0x11')](_0x3ab559,_0x393a82)[_0xe307('0x12')](function(_0xc521b8){logger[_0xe307('0x13')](_0xe307('0x14'),_0x231b98,_0xe307('0x15'));logger[_0xe307('0x16')](_0xe307('0x17'),_0x231b98,'request\x20sent',JSON[_0xe307('0x18')](_0xc521b8));if(_0xc521b8[_0xe307('0x19')]){if(_0xc521b8['error'][_0xe307('0x1a')]===0x1f4){logger[_0xe307('0x19')](_0xe307('0x14'),_0x231b98,_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);return _0x4219b1(_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);}logger['error'](_0xe307('0x14'),_0x231b98,_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);return _0x217f0a(_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x231b98,_0xe307('0x15'));_0x217f0a(_0xc521b8['result'][_0xe307('0x1b')]);}})[_0xe307('0x1c')](function(_0xe8354d){logger[_0xe307('0x19')](_0xe307('0x14'),_0x231b98,_0xe8354d);_0x4219b1(_0xe8354d);});});} \ No newline at end of file +var _0x68b3=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0x68b3,0x1d8));var _0x368b=function(_0x56539e,_0x142068){_0x56539e=_0x56539e-0x0;var _0x4812d1=_0x68b3[_0x56539e];return _0x4812d1;};'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});config[_0x368b('0xc')]=_[_0x368b('0xd')](config[_0x368b('0xc')],{'host':_0x368b('0xe'),'port':0x18eb});var socket=require(_0x368b('0xf'))(new Redis(config[_0x368b('0xc')]));require(_0x368b('0x10'))[_0x368b('0x11')](socket);function respondWithRpcPromise(_0x5a46f9,_0x160e12,_0xdbd344){return new BPromise(function(_0x34a110,_0x51d513){return client[_0x368b('0x12')](_0x5a46f9,_0xdbd344)[_0x368b('0x13')](function(_0x253e4b){logger['info'](_0x368b('0x14'),_0x160e12,_0x368b('0x15'));logger['debug'](_0x368b('0x16'),_0x160e12,_0x368b('0x15'),JSON[_0x368b('0x17')](_0x253e4b));if(_0x253e4b[_0x368b('0x18')]){if(_0x253e4b[_0x368b('0x18')]['code']===0x1f4){logger[_0x368b('0x18')](_0x368b('0x14'),_0x160e12,_0x253e4b['error'][_0x368b('0x19')]);return _0x51d513(_0x253e4b[_0x368b('0x18')][_0x368b('0x19')]);}logger['error'](_0x368b('0x14'),_0x160e12,_0x253e4b[_0x368b('0x18')][_0x368b('0x19')]);return _0x34a110(_0x253e4b['error'][_0x368b('0x19')]);}else{logger[_0x368b('0x1a')](_0x368b('0x14'),_0x160e12,'request\x20sent');_0x34a110(_0x253e4b['result'][_0x368b('0x19')]);}})[_0x368b('0x1b')](function(_0x2c3cec){logger[_0x368b('0x18')](_0x368b('0x14'),_0x160e12,_0x2c3cec);_0x51d513(_0x2c3cec);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a03d6d6..3e52b16 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 _0xeeae=['emit','removeListener','register','length','./userProfile.events','save','remove','update'];(function(_0x1e5778,_0x274184){var _0x5e636d=function(_0x3b7d65){while(--_0x3b7d65){_0x1e5778['push'](_0x1e5778['shift']());}};_0x5e636d(++_0x274184);}(_0xeeae,0x104));var _0xeeea=function(_0x288cc5,_0x8a06db){_0x288cc5=_0x288cc5-0x0;var _0x1dc69c=_0xeeae[_0x288cc5];return _0x1dc69c;};'use strict';var UserProfileEvents=require(_0xeeea('0x0'));var events=[_0xeeea('0x1'),_0xeeea('0x2'),_0xeeea('0x3')];function createListener(_0x2cd72f,_0x5c783c){return function(_0x40b781){_0x5c783c[_0xeeea('0x4')](_0x2cd72f,_0x40b781);};}function removeListener(_0x2c0019,_0x2fc13f){return function(){UserProfileEvents[_0xeeea('0x5')](_0x2c0019,_0x2fc13f);};}exports[_0xeeea('0x6')]=function(_0x1733b9){for(var _0x368ce3=0x0,_0xa9a027=events[_0xeeea('0x7')];_0x368ce3<_0xa9a027;_0x368ce3++){var _0x1442d2=events[_0x368ce3];var _0x2cc99a=createListener('userProfile:'+_0x1442d2,_0x1733b9);UserProfileEvents['on'](_0x1442d2,_0x2cc99a);}}; \ No newline at end of file +var _0xa343=['length','./userProfile.events','save','update','emit','register'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa343,0x139));var _0x3a34=function(_0x483bae,_0x38122c){_0x483bae=_0x483bae-0x0;var _0x8d8ce0=_0xa343[_0x483bae];return _0x8d8ce0;};'use strict';var UserProfileEvents=require(_0x3a34('0x0'));var events=[_0x3a34('0x1'),'remove',_0x3a34('0x2')];function createListener(_0x4e3ff2,_0x57b676){return function(_0x4687e0){_0x57b676[_0x3a34('0x3')](_0x4e3ff2,_0x4687e0);};}function removeListener(_0x5cf410,_0xee0d9d){return function(){UserProfileEvents['removeListener'](_0x5cf410,_0xee0d9d);};}exports[_0x3a34('0x4')]=function(_0x491a51){for(var _0x4ee498=0x0,_0x1472aa=events[_0x3a34('0x5')];_0x4ee498<_0x1472aa;_0x4ee498++){var _0x36d975=events[_0x4ee498];var _0x1046ff=createListener('userProfile:'+_0x36d975,_0x491a51);UserProfileEvents['on'](_0x36d975,_0x1046ff);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d99efa0..46a87f5 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 _0x87ea=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x87ea,0x1a0));var _0xa87e=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x87ea[_0x3bceea];return _0x30a8d3;};'use strict';var multer=require(_0xa87e('0x0'));var util=require(_0xa87e('0x1'));var path=require('path');var timeout=require(_0xa87e('0x2'));var express=require(_0xa87e('0x3'));var router=express[_0xa87e('0x4')]();var fs_extra=require(_0xa87e('0x5'));var auth=require(_0xa87e('0x6'));var interaction=require(_0xa87e('0x7'));var config=require(_0xa87e('0x8'));var controller=require(_0xa87e('0x9'));router[_0xa87e('0xa')]('/',auth[_0xa87e('0xb')](),controller[_0xa87e('0xc')]);router['get'](_0xa87e('0xd'),auth[_0xa87e('0xb')](),controller[_0xa87e('0xe')]);router[_0xa87e('0xa')](_0xa87e('0xf'),auth[_0xa87e('0xb')](),controller[_0xa87e('0x10')]);router[_0xa87e('0x11')]('/',auth[_0xa87e('0xb')](),controller['create']);router['put'](_0xa87e('0xf'),auth[_0xa87e('0xb')](),controller[_0xa87e('0x12')]);router[_0xa87e('0x13')]('/:id',auth[_0xa87e('0xb')](),controller[_0xa87e('0x14')]);module[_0xa87e('0x15')]=router; \ No newline at end of file +var _0x5e86=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','path','connect-timeout'];(function(_0x36e488,_0x1741a1){var _0x372dd8=function(_0x4ea7d3){while(--_0x4ea7d3){_0x36e488['push'](_0x36e488['shift']());}};_0x372dd8(++_0x1741a1);}(_0x5e86,0x19c));var _0x65e8=function(_0xe1a2d9,_0x3bef10){_0xe1a2d9=_0xe1a2d9-0x0;var _0x33d146=_0x5e86[_0xe1a2d9];return _0x33d146;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x65e8('0x0'));var timeout=require(_0x65e8('0x1'));var express=require(_0x65e8('0x2'));var router=express[_0x65e8('0x3')]();var fs_extra=require(_0x65e8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x65e8('0x5'));var config=require(_0x65e8('0x6'));var controller=require(_0x65e8('0x7'));router['get']('/',auth[_0x65e8('0x8')](),controller[_0x65e8('0x9')]);router[_0x65e8('0xa')](_0x65e8('0xb'),auth[_0x65e8('0x8')](),controller['describe']);router['get'](_0x65e8('0xc'),auth[_0x65e8('0x8')](),controller[_0x65e8('0xd')]);router[_0x65e8('0xe')]('/',auth[_0x65e8('0x8')](),controller[_0x65e8('0xf')]);router[_0x65e8('0x10')](_0x65e8('0xc'),auth[_0x65e8('0x8')](),controller[_0x65e8('0x11')]);router['delete']('/:id',auth[_0x65e8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 1589cfd..9b4094e 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 _0x489f=['STRING','INTEGER','sequelize','exports'];(function(_0x141187,_0x5a0315){var _0x13acfa=function(_0x34a05d){while(--_0x34a05d){_0x141187['push'](_0x141187['shift']());}};_0x13acfa(++_0x5a0315);}(_0x489f,0x142));var _0xf489=function(_0xba472b,_0x1584b9){_0xba472b=_0xba472b-0x0;var _0x1bd3ca=_0x489f[_0xba472b];return _0x1bd3ca;};'use strict';var Sequelize=require(_0xf489('0x0'));module[_0xf489('0x1')]={'name':{'type':Sequelize[_0xf489('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf489('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf489('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd704=['sequelize','STRING'];(function(_0x4abb10,_0x26897f){var _0x2494fe=function(_0x44c085){while(--_0x44c085){_0x4abb10['push'](_0x4abb10['shift']());}};_0x2494fe(++_0x26897f);}(_0xd704,0x154));var _0x4d70=function(_0x2b050d,_0x2530ab){_0x2b050d=_0x2b050d-0x0;var _0x41358=_0xd704[_0x2b050d];return _0x41358;};'use strict';var Sequelize=require(_0x4d70('0x0'));module['exports']={'name':{'type':Sequelize[_0x4d70('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x4d70('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 64ff0b4..af4d3b6 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 _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x72380c,_0x525028){_0x72380c=_0x72380c-0x0;var _0x2735f6=_0x9f0e[_0x72380c];return _0x2735f6;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['UserProfileResource'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['UserProfileResource'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['UserProfileResource'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,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(_0x555263,_0xefc087){var _0x28bf16=function(_0x1c5960){while(--_0x1c5960){_0x555263['push'](_0x555263['shift']());}};_0x28bf16(++_0xefc087);}(_0x4c60,0xc1));var _0x04c6=function(_0x466425,_0x1d277f){_0x466425=_0x466425-0x0;var _0x537cbd=_0x4c60[_0x466425];return _0x537cbd;};'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 e7f6528..a03f63e 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 _0xd4a1=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x8e80d,_0x4b5b4f){var _0x486071=function(_0x1ad9c8){while(--_0x1ad9c8){_0x8e80d['push'](_0x8e80d['shift']());}};_0x486071(++_0x4b5b4f);}(_0xd4a1,0xc3));var _0x1d4a=function(_0x267b69,_0x415e7d){_0x267b69=_0x267b69-0x0;var _0x3487b4=_0xd4a1[_0x267b69];return _0x3487b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1d4a('0x0'))(_0x1d4a('0x1'));var moment=require(_0x1d4a('0x2'));var BPromise=require('bluebird');var rp=require(_0x1d4a('0x3'));var fs=require('fs');var path=require(_0x1d4a('0x4'));var rimraf=require(_0x1d4a('0x5'));var config=require(_0x1d4a('0x6'));var attributes=require(_0x1d4a('0x7'));module[_0x1d4a('0x8')]=function(_0x1733a6,_0x5a3062){return _0x1733a6[_0x1d4a('0x9')](_0x1d4a('0xa'),attributes,{'tableName':_0x1d4a('0xb'),'paranoid':![],'indexes':[{'name':_0x1d4a('0xc'),'fields':[_0x1d4a('0xd'),_0x1d4a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb87=['util','api','request-promise','path','rimraf','../../config/environment','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xcb87,0x8f));var _0x7cb8=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0xcb87[_0x478414];return _0x5eb6b9;};'use strict';var _=require(_0x7cb8('0x0'));var util=require(_0x7cb8('0x1'));var logger=require('../../config/logger')(_0x7cb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7cb8('0x3'));var fs=require('fs');var path=require(_0x7cb8('0x4'));var rimraf=require(_0x7cb8('0x5'));var config=require(_0x7cb8('0x6'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x5bae8d,_0x1a91c8){return _0x5bae8d[_0x7cb8('0x7')]('UserProfileResource',attributes,{'tableName':_0x7cb8('0x8'),'paranoid':![],'indexes':[{'name':_0x7cb8('0x9'),'fields':[_0x7cb8('0xa'),_0x7cb8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index f7f468c..380b925 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 _0xb0a7=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileResource,\x20%s,\x20%s'];(function(_0x2fc66e,_0x2d1990){var _0x410ff2=function(_0x1681ee){while(--_0x1681ee){_0x2fc66e['push'](_0x2fc66e['shift']());}};_0x410ff2(++_0x2d1990);}(_0xb0a7,0x116));var _0x7b0a=function(_0x53bf67,_0x4a3559){_0x53bf67=_0x53bf67-0x0;var _0x1a2701=_0xb0a7[_0x53bf67];return _0x1a2701;};'use strict';var _=require(_0x7b0a('0x0'));var util=require(_0x7b0a('0x1'));var moment=require(_0x7b0a('0x2'));var BPromise=require(_0x7b0a('0x3'));var rs=require(_0x7b0a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b0a('0x5'))['db'];var utils=require(_0x7b0a('0x6'));var logger=require(_0x7b0a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7b0a('0x8'));var client=jayson[_0x7b0a('0x9')][_0x7b0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46255b,_0x25ef00,_0x2f28dc){return new BPromise(function(_0x3807df,_0x21bb69){return client['request'](_0x46255b,_0x2f28dc)[_0x7b0a('0xb')](function(_0xa20161){logger[_0x7b0a('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x25ef00,_0x7b0a('0xd'));logger[_0x7b0a('0xe')](_0x7b0a('0xf'),_0x25ef00,_0x7b0a('0xd'),JSON[_0x7b0a('0x10')](_0xa20161));if(_0xa20161['error']){if(_0xa20161[_0x7b0a('0x11')][_0x7b0a('0x12')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x25ef00,_0xa20161[_0x7b0a('0x11')][_0x7b0a('0x13')]);return _0x21bb69(_0xa20161[_0x7b0a('0x11')][_0x7b0a('0x13')]);}logger[_0x7b0a('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x25ef00,_0xa20161['error']['message']);return _0x3807df(_0xa20161[_0x7b0a('0x11')][_0x7b0a('0x13')]);}else{logger[_0x7b0a('0xc')](_0x7b0a('0x14'),_0x25ef00,_0x7b0a('0xd'));_0x3807df(_0xa20161[_0x7b0a('0x15')][_0x7b0a('0x13')]);}})[_0x7b0a('0x16')](function(_0x55e6fe){logger[_0x7b0a('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x25ef00,_0x55e6fe);_0x21bb69(_0x55e6fe);});});} \ No newline at end of file +var _0x0a91=['../../config/environment','client','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x10ad4e,_0x5003e3){var _0x181ec8=function(_0x5a5ba2){while(--_0x5a5ba2){_0x10ad4e['push'](_0x10ad4e['shift']());}};_0x181ec8(++_0x5003e3);}(_0x0a91,0x1dc));var _0x10a9=function(_0x5f0627,_0x72504a){_0x5f0627=_0x5f0627-0x0;var _0x490fe6=_0x0a91[_0x5f0627];return _0x490fe6;};'use strict';var _=require(_0x10a9('0x0'));var util=require('util');var moment=require(_0x10a9('0x1'));var BPromise=require(_0x10a9('0x2'));var rs=require(_0x10a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10a9('0x4'))['db'];var utils=require(_0x10a9('0x5'));var logger=require(_0x10a9('0x6'))(_0x10a9('0x7'));var config=require(_0x10a9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x10a9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554887,_0x39287e,_0xac4bef){return new BPromise(function(_0x4af1ca,_0x1c132f){return client[_0x10a9('0xa')](_0x554887,_0xac4bef)['then'](function(_0x1b42c1){logger[_0x10a9('0xb')](_0x10a9('0xc'),_0x39287e,_0x10a9('0xd'));logger[_0x10a9('0xe')](_0x10a9('0xf'),_0x39287e,_0x10a9('0xd'),JSON[_0x10a9('0x10')](_0x1b42c1));if(_0x1b42c1[_0x10a9('0x11')]){if(_0x1b42c1[_0x10a9('0x11')][_0x10a9('0x12')]===0x1f4){logger[_0x10a9('0x11')](_0x10a9('0xc'),_0x39287e,_0x1b42c1[_0x10a9('0x11')]['message']);return _0x1c132f(_0x1b42c1[_0x10a9('0x11')][_0x10a9('0x13')]);}logger['error'](_0x10a9('0xc'),_0x39287e,_0x1b42c1[_0x10a9('0x11')][_0x10a9('0x13')]);return _0x4af1ca(_0x1b42c1['error'][_0x10a9('0x13')]);}else{logger[_0x10a9('0xb')](_0x10a9('0xc'),_0x39287e,_0x10a9('0xd'));_0x4af1ca(_0x1b42c1[_0x10a9('0x14')][_0x10a9('0x13')]);}})[_0x10a9('0x15')](function(_0x5199b1){logger[_0x10a9('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x39287e,_0x5199b1);_0x1c132f(_0x5199b1);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index ab60deb..a636283 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 _0x7f4b=['multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete','destroy'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0x7f4b,0x1a9));var _0xb7f4=function(_0x450076,_0x10983b){_0x450076=_0x450076-0x0;var _0x2029cc=_0x7f4b[_0x450076];return _0x2029cc;};'use strict';var multer=require(_0xb7f4('0x0'));var util=require(_0xb7f4('0x1'));var path=require('path');var timeout=require(_0xb7f4('0x2'));var express=require('express');var router=express[_0xb7f4('0x3')]();var fs_extra=require(_0xb7f4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb7f4('0x5'));var config=require('../../config/environment');var controller=require(_0xb7f4('0x6'));router[_0xb7f4('0x7')]('/',auth[_0xb7f4('0x8')](),controller['index']);router[_0xb7f4('0x7')](_0xb7f4('0x9'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0xa')]);router[_0xb7f4('0x7')](_0xb7f4('0xb'),auth[_0xb7f4('0x8')](),controller['show']);router[_0xb7f4('0xc')]('/',auth[_0xb7f4('0x8')](),controller[_0xb7f4('0xd')]);router[_0xb7f4('0xe')]('/:id',auth[_0xb7f4('0x8')](),controller['update']);router[_0xb7f4('0xf')](_0xb7f4('0xb'),auth['isAuthenticated'](),controller[_0xb7f4('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9f33=['./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f33,0x91));var _0x39f3=function(_0x597d5d,_0x35ed74){_0x597d5d=_0x597d5d-0x0;var _0x336289=_0x9f33[_0x597d5d];return _0x336289;};'use strict';var multer=require(_0x39f3('0x0'));var util=require(_0x39f3('0x1'));var path=require(_0x39f3('0x2'));var timeout=require(_0x39f3('0x3'));var express=require(_0x39f3('0x4'));var router=express[_0x39f3('0x5')]();var fs_extra=require(_0x39f3('0x6'));var auth=require(_0x39f3('0x7'));var interaction=require(_0x39f3('0x8'));var config=require('../../config/environment');var controller=require(_0x39f3('0x9'));router[_0x39f3('0xa')]('/',auth[_0x39f3('0xb')](),controller[_0x39f3('0xc')]);router[_0x39f3('0xa')](_0x39f3('0xd'),auth[_0x39f3('0xb')](),controller['describe']);router['get'](_0x39f3('0xe'),auth[_0x39f3('0xb')](),controller[_0x39f3('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x39f3('0x10')]);router[_0x39f3('0x11')](_0x39f3('0xe'),auth[_0x39f3('0xb')](),controller[_0x39f3('0x12')]);router[_0x39f3('0x13')](_0x39f3('0xe'),auth[_0x39f3('0xb')](),controller[_0x39f3('0x14')]);module[_0x39f3('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0cf2cab..a638de9 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 _0xb10b=['split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ec7f2,_0xe24da3){_0x2ec7f2=_0x2ec7f2-0x0;var _0x29de00=_0xb10b[_0x2ec7f2];return _0x29de00;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbb10('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbb10('0x1')],'set':function(_0x460981){this[_0xbb10('0x4')](_0xbb10('0x5'),_0x460981?_0x460981[_0xbb10('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xbb10('0x5'))?this[_0xbb10('0x7')]('crudPermissions')[_0xbb10('0x8')](''):[];}}}; \ No newline at end of file +var _0xdb94=['INTEGER','BOOLEAN','crudPermissions','sequelize','exports','STRING'];(function(_0x2d0d40,_0x550309){var _0x255f69=function(_0x57100b){while(--_0x57100b){_0x2d0d40['push'](_0x2d0d40['shift']());}};_0x255f69(++_0x550309);}(_0xdb94,0xab));var _0x4db9=function(_0x3f140b,_0x2e3418){_0x3f140b=_0x3f140b-0x0;var _0x739cb6=_0xdb94[_0x3f140b];return _0x739cb6;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'name':{'type':Sequelize[_0x4db9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4db9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4db9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4db9('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4db9('0x2')],'set':function(_0x554bd5){this['setDataValue'](_0x4db9('0x5'),_0x554bd5?_0x554bd5['join'](''):[]);},'get':function(){return this['getDataValue'](_0x4db9('0x5'))?this['getDataValue'](_0x4db9('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a919f36..4250f06 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 _0xee9a=['stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','VIRTUAL','merge','options','UserProfileSection','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error'];(function(_0x242152,_0x348c61){var _0x5b391e=function(_0x2d8ffe){while(--_0x2d8ffe){_0x242152['push'](_0x242152['shift']());}};_0x5b391e(++_0x348c61);}(_0xee9a,0x1df));var _0xaee9=function(_0x238bcb,_0x49193f){_0x238bcb=_0x238bcb-0x0;var _0x4d24c9=_0xee9a[_0x238bcb];return _0x4d24c9;};'use strict';var emlformat=require(_0xaee9('0x0'));var rimraf=require(_0xaee9('0x1'));var zipdir=require(_0xaee9('0x2'));var jsonpatch=require(_0xaee9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaee9('0x4'));var util=require('util');var path=require(_0xaee9('0x5'));var sox=require(_0xaee9('0x6'));var csv=require(_0xaee9('0x7'));var ejs=require(_0xaee9('0x8'));var fs=require('fs');var fs_extra=require(_0xaee9('0x9'));var _=require(_0xaee9('0xa'));var squel=require(_0xaee9('0xb'));var crypto=require(_0xaee9('0xc'));var jsforce=require(_0xaee9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaee9('0x7'));var querystring=require(_0xaee9('0xe'));var Papa=require(_0xaee9('0xf'));var Redis=require('ioredis');var authService=require(_0xaee9('0x10'));var qs=require(_0xaee9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaee9('0x12'));var logger=require(_0xaee9('0x13'))(_0xaee9('0x14'));var utils=require(_0xaee9('0x15'));var config=require(_0xaee9('0x16'));var licenseUtil=require(_0xaee9('0x17'));var db=require(_0xaee9('0x18'))['db'];function respondWithStatusCode(_0x1904e5,_0xc86771){_0xc86771=_0xc86771||0xcc;return function(_0x130400){if(_0x130400){return _0x1904e5['sendStatus'](_0xc86771);}return _0x1904e5['status'](_0xc86771)[_0xaee9('0x19')]();};}function respondWithResult(_0x5e394b,_0x6749b2){_0x6749b2=_0x6749b2||0xc8;return function(_0x4b2864){if(_0x4b2864){return _0x5e394b[_0xaee9('0x1a')](_0x6749b2)['json'](_0x4b2864);}};}function respondWithFilteredResult(_0x5cb6ec,_0x3964ef){return function(_0x21a233){if(_0x21a233){var _0x3fdaa4=typeof _0x3964ef[_0xaee9('0x1b')]===_0xaee9('0x1c')&&typeof _0x3964ef[_0xaee9('0x1d')]===_0xaee9('0x1c');var _0x5367ee=_0x21a233[_0xaee9('0x1e')];var _0x4a0205=_0x3fdaa4?0x0:_0x3964ef[_0xaee9('0x1b')];var _0x1faa0d=_0x3fdaa4?_0x21a233[_0xaee9('0x1e')]:_0x3964ef[_0xaee9('0x1b')]+_0x3964ef[_0xaee9('0x1d')];var _0x436195;if(_0x1faa0d>=_0x5367ee){_0x1faa0d=_0x5367ee;_0x436195=0xc8;}else{_0x436195=0xce;}_0x5cb6ec[_0xaee9('0x1a')](_0x436195);return _0x5cb6ec[_0xaee9('0x1f')](_0xaee9('0x20'),_0x4a0205+'-'+_0x1faa0d+'/'+_0x5367ee)[_0xaee9('0x21')](_0x21a233);}return null;};}function patchUpdates(_0x41964){return function(_0x1d5cae){try{jsonpatch['apply'](_0x1d5cae,_0x41964,!![]);}catch(_0x103c6b){return BPromise[_0xaee9('0x22')](_0x103c6b);}return _0x1d5cae[_0xaee9('0x23')]();};}function saveUpdates(_0x307401,_0x3e6dd2){return function(_0x3fbc26){if(_0x3fbc26){return _0x3fbc26['update'](_0x307401)[_0xaee9('0x24')](function(_0x3c7cc5){return _0x3c7cc5;});}return null;};}function removeEntity(_0x193590,_0xb0346d){return function(_0x15f3bd){if(_0x15f3bd){return _0x15f3bd[_0xaee9('0x25')]()[_0xaee9('0x24')](function(){_0x193590[_0xaee9('0x1a')](0xcc)[_0xaee9('0x19')]();});}};}function handleEntityNotFound(_0x8a6e10,_0x2ce579){return function(_0x815f42){if(!_0x815f42){_0x8a6e10['sendStatus'](0x194);}return _0x815f42;};}function handleError(_0x3374cd,_0x2fb8f1){_0x2fb8f1=_0x2fb8f1||0x1f4;return function(_0x14e30e){logger[_0xaee9('0x26')](_0x14e30e[_0xaee9('0x27')]);if(_0x14e30e[_0xaee9('0x28')]){delete _0x14e30e['name'];}_0x3374cd[_0xaee9('0x1a')](_0x2fb8f1)[_0xaee9('0x29')](_0x14e30e);};}exports[_0xaee9('0x2a')]=function(_0x15cfd5,_0x52fc2e){var _0x1dcd32={},_0x4c48fe={},_0x481bc9={'count':0x0,'rows':[]};var _0x4d213a=_[_0xaee9('0x2b')](db['UserProfileSection'][_0xaee9('0x2c')],function(_0x587244){return{'name':_0x587244[_0xaee9('0x2d')],'type':_0x587244[_0xaee9('0x2e')][_0xaee9('0x2f')]};});_0x4c48fe['model']=_[_0xaee9('0x2b')](_0x4d213a,_0xaee9('0x28'));_0x4c48fe['query']=_[_0xaee9('0x30')](_0x15cfd5[_0xaee9('0x31')]);_0x4c48fe[_0xaee9('0x32')]=_[_0xaee9('0x33')](_0x4c48fe[_0xaee9('0x34')],_0x4c48fe[_0xaee9('0x31')]);_0x1dcd32[_0xaee9('0x35')]=_[_0xaee9('0x33')](_0x4c48fe[_0xaee9('0x34')],qs['fields'](_0x15cfd5[_0xaee9('0x31')]['fields']));_0x1dcd32[_0xaee9('0x35')]=_0x1dcd32[_0xaee9('0x35')]['length']?_0x1dcd32[_0xaee9('0x35')]:_0x4c48fe[_0xaee9('0x34')];if(!_0x15cfd5[_0xaee9('0x31')][_0xaee9('0x36')](_0xaee9('0x37'))){_0x1dcd32[_0xaee9('0x1d')]=qs[_0xaee9('0x1d')](_0x15cfd5['query'][_0xaee9('0x1d')]);_0x1dcd32[_0xaee9('0x1b')]=qs[_0xaee9('0x1b')](_0x15cfd5['query'][_0xaee9('0x1b')]);}_0x1dcd32[_0xaee9('0x38')]=qs[_0xaee9('0x39')](_0x15cfd5[_0xaee9('0x31')][_0xaee9('0x39')]);_0x1dcd32['where']=qs['filters'](_['pick'](_0x15cfd5[_0xaee9('0x31')],_0x4c48fe[_0xaee9('0x32')]),_0x4d213a);if(_0x15cfd5['query']['filter']){_0x1dcd32['where']=_['merge'](_0x1dcd32['where'],{'$or':_[_0xaee9('0x2b')](_0x4d213a,function(_0x3fbe3d){if(_0x3fbe3d[_0xaee9('0x2e')]!==_0xaee9('0x3a')){var _0x2e89c5={};_0x2e89c5[_0x3fbe3d[_0xaee9('0x28')]]={'$like':'%'+_0x15cfd5[_0xaee9('0x31')]['filter']+'%'};return _0x2e89c5;}})});}_0x1dcd32=_[_0xaee9('0x3b')]({},_0x1dcd32,_0x15cfd5[_0xaee9('0x3c')]);var _0x56d333={'where':_0x1dcd32['where']};return db[_0xaee9('0x3d')]['count'](_0x56d333)['then'](function(_0x38b8d2){_0x481bc9[_0xaee9('0x1e')]=_0x38b8d2;if(_0x15cfd5['query'][_0xaee9('0x3e')]){_0x1dcd32[_0xaee9('0x3f')]=[{'all':!![]}];}return db[_0xaee9('0x3d')][_0xaee9('0x40')](_0x1dcd32);})['then'](function(_0x3102a9){_0x481bc9[_0xaee9('0x41')]=_0x3102a9;return _0x481bc9;})[_0xaee9('0x24')](respondWithFilteredResult(_0x52fc2e,_0x1dcd32))[_0xaee9('0x42')](handleError(_0x52fc2e,null));};exports['show']=function(_0x32024a,_0x50354c){var _0x31dc27={'raw':![],'where':{'id':_0x32024a[_0xaee9('0x43')]['id']}},_0x140caa={};_0x140caa['model']=_[_0xaee9('0x30')](db[_0xaee9('0x3d')][_0xaee9('0x2c')]);_0x140caa[_0xaee9('0x31')]=_[_0xaee9('0x30')](_0x32024a['query']);_0x140caa[_0xaee9('0x32')]=_[_0xaee9('0x33')](_0x140caa[_0xaee9('0x34')],_0x140caa[_0xaee9('0x31')]);_0x31dc27['attributes']=_[_0xaee9('0x33')](_0x140caa[_0xaee9('0x34')],qs[_0xaee9('0x44')](_0x32024a[_0xaee9('0x31')][_0xaee9('0x44')]));_0x31dc27[_0xaee9('0x35')]=_0x31dc27[_0xaee9('0x35')][_0xaee9('0x45')]?_0x31dc27[_0xaee9('0x35')]:_0x140caa['model'];if(_0x32024a[_0xaee9('0x31')][_0xaee9('0x3e')]){_0x31dc27[_0xaee9('0x3f')]=[{'all':!![]}];}_0x31dc27=_[_0xaee9('0x3b')]({},_0x31dc27,_0x32024a['options']);return db[_0xaee9('0x3d')][_0xaee9('0x46')](_0x31dc27)[_0xaee9('0x24')](handleEntityNotFound(_0x50354c,null))[_0xaee9('0x24')](respondWithResult(_0x50354c,null))[_0xaee9('0x42')](handleError(_0x50354c,null));};exports[_0xaee9('0x47')]=function(_0x24c49e,_0x4cb698){return db['UserProfileSection'][_0xaee9('0x47')](_0x24c49e[_0xaee9('0x48')],{})[_0xaee9('0x24')](respondWithResult(_0x4cb698,0xc9))[_0xaee9('0x42')](handleError(_0x4cb698,null));};exports['update']=function(_0x167902,_0xbb4c71){if(_0x167902[_0xaee9('0x48')]['id']){delete _0x167902['body']['id'];}return db[_0xaee9('0x3d')][_0xaee9('0x46')]({'where':{'id':_0x167902[_0xaee9('0x43')]['id']}})[_0xaee9('0x24')](handleEntityNotFound(_0xbb4c71,null))[_0xaee9('0x24')](saveUpdates(_0x167902['body'],null))[_0xaee9('0x24')](respondWithResult(_0xbb4c71,null))[_0xaee9('0x42')](handleError(_0xbb4c71,null));};exports[_0xaee9('0x25')]=function(_0xf21132,_0x39a425){return db[_0xaee9('0x3d')]['find']({'where':{'id':_0xf21132[_0xaee9('0x43')]['id']}})[_0xaee9('0x24')](handleEntityNotFound(_0x39a425,null))['then'](removeEntity(_0x39a425,null))['catch'](handleError(_0x39a425,null));};exports[_0xaee9('0x49')]=function(_0x4376f7,_0x215b5d){return db[_0xaee9('0x3d')]['describe']()[_0xaee9('0x24')](respondWithResult(_0x215b5d,null))[_0xaee9('0x42')](handleError(_0x215b5d,null));}; \ No newline at end of file +var _0x9c5a=['error','name','send','index','map','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','UserProfileSection','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus'];(function(_0x29ae84,_0x2a26e0){var _0x526794=function(_0x432b73){while(--_0x432b73){_0x29ae84['push'](_0x29ae84['shift']());}};_0x526794(++_0x2a26e0);}(_0x9c5a,0x6e));var _0xa9c5=function(_0x26e6a6,_0x5ca799){_0x26e6a6=_0x26e6a6-0x0;var _0x3194f0=_0x9c5a[_0x26e6a6];return _0x3194f0;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require(_0xa9c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var Mustache=require(_0xa9c5('0x5'));var util=require(_0xa9c5('0x6'));var path=require('path');var sox=require(_0xa9c5('0x7'));var csv=require(_0xa9c5('0x8'));var ejs=require(_0xa9c5('0x9'));var fs=require('fs');var fs_extra=require(_0xa9c5('0xa'));var _=require(_0xa9c5('0xb'));var squel=require(_0xa9c5('0xc'));var crypto=require(_0xa9c5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa9c5('0xe'));var toCsv=require(_0xa9c5('0x8'));var querystring=require(_0xa9c5('0xf'));var Papa=require(_0xa9c5('0x10'));var Redis=require(_0xa9c5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa9c5('0x12'));var as=require(_0xa9c5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa9c5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x2d92ab,_0x2352a2){_0x2352a2=_0x2352a2||0xcc;return function(_0x33b6ed){if(_0x33b6ed){return _0x2d92ab['sendStatus'](_0x2352a2);}return _0x2d92ab[_0xa9c5('0x17')](_0x2352a2)['end']();};}function respondWithResult(_0x50b0c6,_0x195795){_0x195795=_0x195795||0xc8;return function(_0x51fc59){if(_0x51fc59){return _0x50b0c6['status'](_0x195795)[_0xa9c5('0x18')](_0x51fc59);}};}function respondWithFilteredResult(_0x5b6ca1,_0x260f70){return function(_0x648ef0){if(_0x648ef0){var _0x521432=typeof _0x260f70[_0xa9c5('0x19')]===_0xa9c5('0x1a')&&typeof _0x260f70['limit']===_0xa9c5('0x1a');var _0x135334=_0x648ef0['count'];var _0x25afe2=_0x521432?0x0:_0x260f70[_0xa9c5('0x19')];var _0x8b37ad=_0x521432?_0x648ef0[_0xa9c5('0x1b')]:_0x260f70[_0xa9c5('0x19')]+_0x260f70['limit'];var _0x43109a;if(_0x8b37ad>=_0x135334){_0x8b37ad=_0x135334;_0x43109a=0xc8;}else{_0x43109a=0xce;}_0x5b6ca1[_0xa9c5('0x17')](_0x43109a);return _0x5b6ca1[_0xa9c5('0x1c')](_0xa9c5('0x1d'),_0x25afe2+'-'+_0x8b37ad+'/'+_0x135334)[_0xa9c5('0x18')](_0x648ef0);}return null;};}function patchUpdates(_0x1ed35d){return function(_0x5238b4){try{jsonpatch[_0xa9c5('0x1e')](_0x5238b4,_0x1ed35d,!![]);}catch(_0x1ed393){return BPromise[_0xa9c5('0x1f')](_0x1ed393);}return _0x5238b4[_0xa9c5('0x20')]();};}function saveUpdates(_0x54aa13,_0xc4b376){return function(_0x31440c){if(_0x31440c){return _0x31440c[_0xa9c5('0x21')](_0x54aa13)[_0xa9c5('0x22')](function(_0x3dcb69){return _0x3dcb69;});}return null;};}function removeEntity(_0x1d60f5,_0x1f7116){return function(_0x1d5045){if(_0x1d5045){return _0x1d5045['destroy']()[_0xa9c5('0x22')](function(){_0x1d60f5[_0xa9c5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d1e86,_0x65620d){return function(_0x4738b5){if(!_0x4738b5){_0x8d1e86[_0xa9c5('0x23')](0x194);}return _0x4738b5;};}function handleError(_0x971d8a,_0x55601a){_0x55601a=_0x55601a||0x1f4;return function(_0x3bebcf){logger[_0xa9c5('0x24')](_0x3bebcf['stack']);if(_0x3bebcf['name']){delete _0x3bebcf[_0xa9c5('0x25')];}_0x971d8a[_0xa9c5('0x17')](_0x55601a)[_0xa9c5('0x26')](_0x3bebcf);};}exports[_0xa9c5('0x27')]=function(_0x34571b,_0x1e8ec7){var _0xb03d0={},_0x3f1231={},_0x8e4234={'count':0x0,'rows':[]};var _0x1b9b98=_[_0xa9c5('0x28')](db['UserProfileSection']['rawAttributes'],function(_0x1bcc30){return{'name':_0x1bcc30[_0xa9c5('0x29')],'type':_0x1bcc30[_0xa9c5('0x2a')]['key']};});_0x3f1231['model']=_['map'](_0x1b9b98,_0xa9c5('0x25'));_0x3f1231[_0xa9c5('0x2b')]=_['keys'](_0x34571b['query']);_0x3f1231[_0xa9c5('0x2c')]=_[_0xa9c5('0x2d')](_0x3f1231[_0xa9c5('0x2e')],_0x3f1231[_0xa9c5('0x2b')]);_0xb03d0[_0xa9c5('0x2f')]=_[_0xa9c5('0x2d')](_0x3f1231[_0xa9c5('0x2e')],qs[_0xa9c5('0x30')](_0x34571b['query']['fields']));_0xb03d0[_0xa9c5('0x2f')]=_0xb03d0[_0xa9c5('0x2f')][_0xa9c5('0x31')]?_0xb03d0['attributes']:_0x3f1231['model'];if(!_0x34571b[_0xa9c5('0x2b')][_0xa9c5('0x32')]('nolimit')){_0xb03d0[_0xa9c5('0x33')]=qs[_0xa9c5('0x33')](_0x34571b[_0xa9c5('0x2b')][_0xa9c5('0x33')]);_0xb03d0[_0xa9c5('0x19')]=qs[_0xa9c5('0x19')](_0x34571b['query'][_0xa9c5('0x19')]);}_0xb03d0[_0xa9c5('0x34')]=qs['sort'](_0x34571b['query'][_0xa9c5('0x35')]);_0xb03d0[_0xa9c5('0x36')]=qs[_0xa9c5('0x2c')](_[_0xa9c5('0x37')](_0x34571b[_0xa9c5('0x2b')],_0x3f1231[_0xa9c5('0x2c')]),_0x1b9b98);if(_0x34571b[_0xa9c5('0x2b')][_0xa9c5('0x38')]){_0xb03d0['where']=_[_0xa9c5('0x39')](_0xb03d0[_0xa9c5('0x36')],{'$or':_[_0xa9c5('0x28')](_0x1b9b98,function(_0x47fb68){if(_0x47fb68[_0xa9c5('0x2a')]!=='VIRTUAL'){var _0x357997={};_0x357997[_0x47fb68[_0xa9c5('0x25')]]={'$like':'%'+_0x34571b['query'][_0xa9c5('0x38')]+'%'};return _0x357997;}})});}_0xb03d0=_['merge']({},_0xb03d0,_0x34571b[_0xa9c5('0x3a')]);var _0x2ec53e={'where':_0xb03d0[_0xa9c5('0x36')]};return db[_0xa9c5('0x3b')][_0xa9c5('0x1b')](_0x2ec53e)[_0xa9c5('0x22')](function(_0x96678e){_0x8e4234[_0xa9c5('0x1b')]=_0x96678e;if(_0x34571b['query'][_0xa9c5('0x3c')]){_0xb03d0[_0xa9c5('0x3d')]=[{'all':!![]}];}return db['UserProfileSection'][_0xa9c5('0x3e')](_0xb03d0);})['then'](function(_0x44cf28){_0x8e4234[_0xa9c5('0x3f')]=_0x44cf28;return _0x8e4234;})[_0xa9c5('0x22')](respondWithFilteredResult(_0x1e8ec7,_0xb03d0))[_0xa9c5('0x40')](handleError(_0x1e8ec7,null));};exports['show']=function(_0x3a4ec4,_0x37e3c2){var _0x1acc64={'raw':![],'where':{'id':_0x3a4ec4[_0xa9c5('0x41')]['id']}},_0x22c41d={};_0x22c41d[_0xa9c5('0x2e')]=_[_0xa9c5('0x42')](db[_0xa9c5('0x3b')][_0xa9c5('0x43')]);_0x22c41d[_0xa9c5('0x2b')]=_['keys'](_0x3a4ec4[_0xa9c5('0x2b')]);_0x22c41d[_0xa9c5('0x2c')]=_[_0xa9c5('0x2d')](_0x22c41d[_0xa9c5('0x2e')],_0x22c41d[_0xa9c5('0x2b')]);_0x1acc64['attributes']=_['intersection'](_0x22c41d['model'],qs[_0xa9c5('0x30')](_0x3a4ec4['query'][_0xa9c5('0x30')]));_0x1acc64['attributes']=_0x1acc64[_0xa9c5('0x2f')][_0xa9c5('0x31')]?_0x1acc64[_0xa9c5('0x2f')]:_0x22c41d[_0xa9c5('0x2e')];if(_0x3a4ec4[_0xa9c5('0x2b')][_0xa9c5('0x3c')]){_0x1acc64[_0xa9c5('0x3d')]=[{'all':!![]}];}_0x1acc64=_[_0xa9c5('0x39')]({},_0x1acc64,_0x3a4ec4[_0xa9c5('0x3a')]);return db[_0xa9c5('0x3b')]['find'](_0x1acc64)[_0xa9c5('0x22')](handleEntityNotFound(_0x37e3c2,null))[_0xa9c5('0x22')](respondWithResult(_0x37e3c2,null))[_0xa9c5('0x40')](handleError(_0x37e3c2,null));};exports[_0xa9c5('0x44')]=function(_0x242675,_0x1c2ffb){return db[_0xa9c5('0x3b')][_0xa9c5('0x44')](_0x242675[_0xa9c5('0x45')],{})[_0xa9c5('0x22')](respondWithResult(_0x1c2ffb,0xc9))[_0xa9c5('0x40')](handleError(_0x1c2ffb,null));};exports[_0xa9c5('0x21')]=function(_0x5e95bd,_0x375b81){if(_0x5e95bd['body']['id']){delete _0x5e95bd[_0xa9c5('0x45')]['id'];}return db[_0xa9c5('0x3b')][_0xa9c5('0x46')]({'where':{'id':_0x5e95bd[_0xa9c5('0x41')]['id']}})['then'](handleEntityNotFound(_0x375b81,null))[_0xa9c5('0x22')](saveUpdates(_0x5e95bd['body'],null))[_0xa9c5('0x22')](respondWithResult(_0x375b81,null))[_0xa9c5('0x40')](handleError(_0x375b81,null));};exports[_0xa9c5('0x47')]=function(_0x525f3e,_0x55e9b1){return db[_0xa9c5('0x3b')]['find']({'where':{'id':_0x525f3e['params']['id']}})[_0xa9c5('0x22')](handleEntityNotFound(_0x55e9b1,null))[_0xa9c5('0x22')](removeEntity(_0x55e9b1,null))[_0xa9c5('0x40')](handleError(_0x55e9b1,null));};exports[_0xa9c5('0x48')]=function(_0x4c718e,_0x4f77f3){return db[_0xa9c5('0x3b')][_0xa9c5('0x48')]()[_0xa9c5('0x22')](respondWithResult(_0x4f77f3,null))[_0xa9c5('0x40')](handleError(_0x4f77f3,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d17f7cb..9acbaf9 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 _0xe209=['define','UserProfileSection','compositeIndex','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports'];(function(_0x134aae,_0x126c50){var _0xd123c5=function(_0x57f4a7){while(--_0x57f4a7){_0x134aae['push'](_0x134aae['shift']());}};_0xd123c5(++_0x126c50);}(_0xe209,0x16b));var _0x9e20=function(_0x54c149,_0x3680fc){_0x54c149=_0x54c149-0x0;var _0x3fe7a2=_0xe209[_0x54c149];return _0x3fe7a2;};'use strict';var _=require(_0x9e20('0x0'));var util=require('util');var logger=require(_0x9e20('0x1'))(_0x9e20('0x2'));var moment=require('moment');var BPromise=require(_0x9e20('0x3'));var rp=require(_0x9e20('0x4'));var fs=require('fs');var path=require(_0x9e20('0x5'));var rimraf=require(_0x9e20('0x6'));var config=require('../../config/environment');var attributes=require(_0x9e20('0x7'));module[_0x9e20('0x8')]=function(_0x1c115c,_0x2df2f3){return _0x1c115c[_0x9e20('0x9')](_0x9e20('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x9e20('0xb'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa0e=['exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x9ea5f6,_0x422f2d){var _0x1ba35c=function(_0x176fcd){while(--_0x176fcd){_0x9ea5f6['push'](_0x9ea5f6['shift']());}};_0x1ba35c(++_0x422f2d);}(_0xfa0e,0x105));var _0xefa0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xfa0e[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xefa0('0x0'));var util=require(_0xefa0('0x1'));var logger=require(_0xefa0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xefa0('0x3'));var rp=require(_0xefa0('0x4'));var fs=require('fs');var path=require(_0xefa0('0x5'));var rimraf=require(_0xefa0('0x6'));var config=require(_0xefa0('0x7'));var attributes=require(_0xefa0('0x8'));module[_0xefa0('0x9')]=function(_0x317d63,_0x5b47b0){return _0x317d63['define'](_0xefa0('0xa'),attributes,{'tableName':_0xefa0('0xb'),'paranoid':![],'indexes':[{'name':_0xefa0('0xc'),'fields':[_0xefa0('0xd'),_0xefa0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 8a15ba9..a7da647 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 _0x9ea3=['info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x5575af,_0x1a2157){var _0x4ab648=function(_0x1c5a88){while(--_0x1c5a88){_0x5575af['push'](_0x5575af['shift']());}};_0x4ab648(++_0x1a2157);}(_0x9ea3,0x126));var _0x39ea=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x9ea3[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x39ea('0x0'));var util=require(_0x39ea('0x1'));var moment=require(_0x39ea('0x2'));var BPromise=require(_0x39ea('0x3'));var rs=require(_0x39ea('0x4'));var fs=require('fs');var Redis=require(_0x39ea('0x5'));var db=require(_0x39ea('0x6'))['db'];var utils=require(_0x39ea('0x7'));var logger=require(_0x39ea('0x8'))('rpc');var config=require(_0x39ea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x39ea('0xa')][_0x39ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29e097,_0x48b0b6,_0x433300){return new BPromise(function(_0x437f50,_0x3f9583){return client[_0x39ea('0xc')](_0x29e097,_0x433300)[_0x39ea('0xd')](function(_0x371b60){logger[_0x39ea('0xe')](_0x39ea('0xf'),_0x48b0b6,'request\x20sent');logger[_0x39ea('0x10')](_0x39ea('0x11'),_0x48b0b6,'request\x20sent',JSON[_0x39ea('0x12')](_0x371b60));if(_0x371b60['error']){if(_0x371b60[_0x39ea('0x13')][_0x39ea('0x14')]===0x1f4){logger['error'](_0x39ea('0xf'),_0x48b0b6,_0x371b60[_0x39ea('0x13')][_0x39ea('0x15')]);return _0x3f9583(_0x371b60[_0x39ea('0x13')][_0x39ea('0x15')]);}logger['error'](_0x39ea('0xf'),_0x48b0b6,_0x371b60[_0x39ea('0x13')]['message']);return _0x437f50(_0x371b60[_0x39ea('0x13')][_0x39ea('0x15')]);}else{logger[_0x39ea('0xe')](_0x39ea('0xf'),_0x48b0b6,'request\x20sent');_0x437f50(_0x371b60['result'][_0x39ea('0x15')]);}})['catch'](function(_0x1d3024){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x48b0b6,_0x1d3024);_0x3f9583(_0x1d3024);});});} \ No newline at end of file +var _0xf59d=['../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x2c733a,_0x301a78){var _0x4e9180=function(_0x2117fc){while(--_0x2117fc){_0x2c733a['push'](_0x2c733a['shift']());}};_0x4e9180(++_0x301a78);}(_0xf59d,0x13f));var _0xdf59=function(_0x33532f,_0x16d0ec){_0x33532f=_0x33532f-0x0;var _0x2b93aa=_0xf59d[_0x33532f];return _0x2b93aa;};'use strict';var _=require(_0xdf59('0x0'));var util=require('util');var moment=require(_0xdf59('0x1'));var BPromise=require(_0xdf59('0x2'));var rs=require(_0xdf59('0x3'));var fs=require('fs');var Redis=require(_0xdf59('0x4'));var db=require(_0xdf59('0x5'))['db'];var utils=require(_0xdf59('0x6'));var logger=require('../../config/logger')(_0xdf59('0x7'));var config=require('../../config/environment');var jayson=require(_0xdf59('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x315af1,_0x238586,_0x547edb){return new BPromise(function(_0x570bb0,_0x2a4742){return client[_0xdf59('0x9')](_0x315af1,_0x547edb)['then'](function(_0xbf6710){logger[_0xdf59('0xa')](_0xdf59('0xb'),_0x238586,_0xdf59('0xc'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x238586,_0xdf59('0xc'),JSON['stringify'](_0xbf6710));if(_0xbf6710[_0xdf59('0xd')]){if(_0xbf6710[_0xdf59('0xd')][_0xdf59('0xe')]===0x1f4){logger[_0xdf59('0xd')](_0xdf59('0xb'),_0x238586,_0xbf6710[_0xdf59('0xd')]['message']);return _0x2a4742(_0xbf6710[_0xdf59('0xd')][_0xdf59('0xf')]);}logger[_0xdf59('0xd')](_0xdf59('0xb'),_0x238586,_0xbf6710['error'][_0xdf59('0xf')]);return _0x570bb0(_0xbf6710[_0xdf59('0xd')][_0xdf59('0xf')]);}else{logger[_0xdf59('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x238586,_0xdf59('0xc'));_0x570bb0(_0xbf6710[_0xdf59('0x10')][_0xdf59('0xf')]);}})[_0xdf59('0x11')](function(_0x470197){logger[_0xdf59('0xd')](_0xdf59('0xb'),_0x238586,_0x470197);_0x2a4742(_0x470197);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 7274db8..9bb769b 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x859542,_0xa2ea6a){var _0x274e32=function(_0x52d120){while(--_0x52d120){_0x859542['push'](_0x859542['shift']());}};_0x274e32(++_0xa2ea6a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0xcb91[_0x397f37];return _0x31cae6;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4d2552,_0x560684){var _0x56761b=function(_0x33805f){while(--_0x33805f){_0x4d2552['push'](_0x4d2552['shift']());}};_0x56761b(++_0x560684);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7408c4c..ab3b3de 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 _0xcb37=['INTEGER','sequelize','exports'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0xcb37,0x115));var _0x7cb3=function(_0x395264,_0x142cc3){_0x395264=_0x395264-0x0;var _0x32020e=_0xcb37[_0x395264];return _0x32020e;};'use strict';var Sequelize=require(_0x7cb3('0x0'));module[_0x7cb3('0x1')]={'penalty':{'type':Sequelize[_0x7cb3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7c95=['exports','INTEGER','sequelize'];(function(_0x7f69e6,_0x298619){var _0x273afb=function(_0x2756c3){while(--_0x2756c3){_0x7f69e6['push'](_0x7f69e6['shift']());}};_0x273afb(++_0x298619);}(_0x7c95,0x6b));var _0x57c9=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7c95[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x57c9('0x0'));module[_0x57c9('0x1')]={'penalty':{'type':Sequelize[_0x57c9('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index eedadee..592da0a 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 _0x7524=['../../config/logger','moment','bluebird','rimraf','./userSmsQueue.attributes','exports','define','user_has_sms_queues','util'];(function(_0x34c380,_0x4e7564){var _0x1c2d32=function(_0x536248){while(--_0x536248){_0x34c380['push'](_0x34c380['shift']());}};_0x1c2d32(++_0x4e7564);}(_0x7524,0xce));var _0x4752=function(_0x4a86a2,_0x29987f){_0x4a86a2=_0x4a86a2-0x0;var _0x5d441d=_0x7524[_0x4a86a2];return _0x5d441d;};'use strict';var _=require('lodash');var util=require(_0x4752('0x0'));var logger=require(_0x4752('0x1'))('api');var moment=require(_0x4752('0x2'));var BPromise=require(_0x4752('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4752('0x4'));var config=require('../../config/environment');var attributes=require(_0x4752('0x5'));module[_0x4752('0x6')]=function(_0x66a421,_0x55b411){return _0x66a421[_0x4752('0x7')]('UserSmsQueue',attributes,{'tableName':_0x4752('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa498=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue'];(function(_0x5671fc,_0x9e0e55){var _0xdc4e30=function(_0x3f20bc){while(--_0x3f20bc){_0x5671fc['push'](_0x5671fc['shift']());}};_0xdc4e30(++_0x9e0e55);}(_0xa498,0x1d6));var _0x8a49=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0xa498[_0x389832];return _0x59429e;};'use strict';var _=require('lodash');var util=require(_0x8a49('0x0'));var logger=require(_0x8a49('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8a49('0x2'));var rp=require(_0x8a49('0x3'));var fs=require('fs');var path=require(_0x8a49('0x4'));var rimraf=require(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x8a49('0x7')]=function(_0x5c5df6,_0x366d5b){return _0x5c5df6[_0x8a49('0x8')](_0x8a49('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 5aad043..99b19f9 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 _0x6cbd=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','request\x20sent','error','UserSmsQueue,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x6cbd,0x151));var _0xd6cb=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x6cbd[_0x411add];return _0x238242;};'use strict';var _=require(_0xd6cb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd6cb('0x1'));var rs=require(_0xd6cb('0x2'));var fs=require('fs');var Redis=require(_0xd6cb('0x3'));var db=require(_0xd6cb('0x4'))['db'];var utils=require(_0xd6cb('0x5'));var logger=require(_0xd6cb('0x6'))(_0xd6cb('0x7'));var config=require(_0xd6cb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd6cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x490692,_0x587419,_0x30cd76){return new BPromise(function(_0x42c57f,_0x35f9d1){return client[_0xd6cb('0xa')](_0x490692,_0x30cd76)[_0xd6cb('0xb')](function(_0x118726){logger[_0xd6cb('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x587419,'request\x20sent');logger[_0xd6cb('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x587419,_0xd6cb('0xe'),JSON['stringify'](_0x118726));if(_0x118726[_0xd6cb('0xf')]){if(_0x118726['error']['code']===0x1f4){logger[_0xd6cb('0xf')](_0xd6cb('0x10'),_0x587419,_0x118726[_0xd6cb('0xf')][_0xd6cb('0x11')]);return _0x35f9d1(_0x118726[_0xd6cb('0xf')]['message']);}logger[_0xd6cb('0xf')](_0xd6cb('0x10'),_0x587419,_0x118726[_0xd6cb('0xf')][_0xd6cb('0x11')]);return _0x42c57f(_0x118726['error'][_0xd6cb('0x11')]);}else{logger[_0xd6cb('0xc')](_0xd6cb('0x10'),_0x587419,_0xd6cb('0xe'));_0x42c57f(_0x118726['result'][_0xd6cb('0x11')]);}})[_0xd6cb('0x12')](function(_0x453580){logger[_0xd6cb('0xf')](_0xd6cb('0x10'),_0x587419,_0x453580);_0x35f9d1(_0x453580);});});} \ No newline at end of file +var _0xf1d8=['message','UserSmsQueue,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x57ee2b,_0x353509){var _0x25e53f=function(_0x187188){while(--_0x187188){_0x57ee2b['push'](_0x57ee2b['shift']());}};_0x25e53f(++_0x353509);}(_0xf1d8,0x72));var _0x8f1d=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0xf1d8[_0x280ae7];return _0x418b9e;};'use strict';var _=require(_0x8f1d('0x0'));var util=require(_0x8f1d('0x1'));var moment=require(_0x8f1d('0x2'));var BPromise=require(_0x8f1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f1d('0x4'));var db=require(_0x8f1d('0x5'))['db'];var utils=require(_0x8f1d('0x6'));var logger=require('../../config/logger')(_0x8f1d('0x7'));var config=require(_0x8f1d('0x8'));var jayson=require(_0x8f1d('0x9'));var client=jayson['client'][_0x8f1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b373d,_0x278c0d,_0x2ef747){return new BPromise(function(_0x51181e,_0x38705e){return client[_0x8f1d('0xb')](_0x3b373d,_0x2ef747)[_0x8f1d('0xc')](function(_0x5d4e0e){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x278c0d,_0x8f1d('0xd'));logger[_0x8f1d('0xe')](_0x8f1d('0xf'),_0x278c0d,_0x8f1d('0xd'),JSON[_0x8f1d('0x10')](_0x5d4e0e));if(_0x5d4e0e[_0x8f1d('0x11')]){if(_0x5d4e0e['error']['code']===0x1f4){logger[_0x8f1d('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x278c0d,_0x5d4e0e[_0x8f1d('0x11')][_0x8f1d('0x12')]);return _0x38705e(_0x5d4e0e[_0x8f1d('0x11')][_0x8f1d('0x12')]);}logger['error'](_0x8f1d('0x13'),_0x278c0d,_0x5d4e0e['error'][_0x8f1d('0x12')]);return _0x51181e(_0x5d4e0e[_0x8f1d('0x11')][_0x8f1d('0x12')]);}else{logger[_0x8f1d('0x14')](_0x8f1d('0x13'),_0x278c0d,_0x8f1d('0xd'));_0x51181e(_0x5d4e0e[_0x8f1d('0x15')]['message']);}})['catch'](function(_0x573a1e){logger[_0x8f1d('0x11')](_0x8f1d('0x13'),_0x278c0d,_0x573a1e);_0x38705e(_0x573a1e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b0eb348..478baeb 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 _0xf273=['INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf273,0xcf));var _0x3f27=function(_0x25321b,_0x1ea8f5){_0x25321b=_0x25321b-0x0;var _0xb7fd2=_0xf273[_0x25321b];return _0xb7fd2;};'use strict';var Sequelize=require(_0x3f27('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x3f27('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x3f27('0x1')]}}; \ No newline at end of file +var _0x390c=['sequelize'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x390c,0x1da));var _0xc390=function(_0x17f17c,_0x4a8987){_0x17f17c=_0x17f17c-0x0;var _0x1ff334=_0x390c[_0x17f17c];return _0x1ff334;};'use strict';var Sequelize=require(_0xc390('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 7058632..e9cd8ae 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(_0x36d1e9,_0xf0b293){var _0x56ef93=function(_0x16698f){while(--_0x16698f){_0x36d1e9['push'](_0x36d1e9['shift']());}};_0x56ef93(++_0xf0b293);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0xcad883,_0x230e7d){var _0x5751b5=function(_0x429d0c){while(--_0x429d0c){_0xcad883['push'](_0xcad883['shift']());}};_0x5751b5(++_0x230e7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 a42566b..63cc4a8 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x326ad5,_0x128113){var _0x257986=function(_0x5a1707){while(--_0x5a1707){_0x326ad5['push'](_0x326ad5['shift']());}};_0x257986(++_0x128113);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xcb91[_0x398294];return _0x2a872d;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x285d1d,_0x317961){var _0x361695=function(_0x53e1f3){while(--_0x53e1f3){_0x285d1d['push'](_0x285d1d['shift']());}};_0x361695(++_0x317961);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0xcb91[_0x307bf6];return _0x2878fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 0bb6e70..9ac6011 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 _0x7a44=['sequelize','INTEGER'];(function(_0xcc30,_0x14783e){var _0x12c553=function(_0x1b75e3){while(--_0x1b75e3){_0xcc30['push'](_0xcc30['shift']());}};_0x12c553(++_0x14783e);}(_0x7a44,0x196));var _0x47a4=function(_0x146a8c,_0x367543){_0x146a8c=_0x146a8c-0x0;var _0x575e6a=_0x7a44[_0x146a8c];return _0x575e6a;};'use strict';var Sequelize=require(_0x47a4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x47a4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xce3d=['exports','sequelize'];(function(_0x206843,_0x2ce77f){var _0x3bb842=function(_0x553b90){while(--_0x553b90){_0x206843['push'](_0x206843['shift']());}};_0x3bb842(++_0x2ce77f);}(_0xce3d,0xff));var _0xdce3=function(_0x8eb3ce,_0x130a49){_0x8eb3ce=_0x8eb3ce-0x0;var _0x44df65=_0xce3d[_0x8eb3ce];return _0x44df65;};'use strict';var Sequelize=require(_0xdce3('0x0'));module[_0xdce3('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index d79cb6a..cca37da 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 _0x2a0b=['UserVoiceQueue','user_has_voice_queues','util','moment','bluebird','request-promise','path','define'];(function(_0x1e1621,_0x52841a){var _0x3d11fd=function(_0x1008fc){while(--_0x1008fc){_0x1e1621['push'](_0x1e1621['shift']());}};_0x3d11fd(++_0x52841a);}(_0x2a0b,0xba));var _0xb2a0=function(_0x6f645d,_0x5ae1d8){_0x6f645d=_0x6f645d-0x0;var _0x3631ec=_0x2a0b[_0x6f645d];return _0x3631ec;};'use strict';var _=require('lodash');var util=require(_0xb2a0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb2a0('0x1'));var BPromise=require(_0xb2a0('0x2'));var rp=require(_0xb2a0('0x3'));var fs=require('fs');var path=require(_0xb2a0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x6a2fbf,_0x23ee31){return _0x6a2fbf[_0xb2a0('0x5')](_0xb2a0('0x6'),attributes,{'tableName':_0xb2a0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb285=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util'];(function(_0x41b836,_0x2f7d3a){var _0x444ab9=function(_0x30009d){while(--_0x30009d){_0x41b836['push'](_0x41b836['shift']());}};_0x444ab9(++_0x2f7d3a);}(_0xb285,0x1be));var _0x5b28=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0xb285[_0x1ebe90];return _0x447c82;};'use strict';var _=require(_0x5b28('0x0'));var util=require(_0x5b28('0x1'));var logger=require(_0x5b28('0x2'))(_0x5b28('0x3'));var moment=require(_0x5b28('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b28('0x5'));var fs=require('fs');var path=require(_0x5b28('0x6'));var rimraf=require(_0x5b28('0x7'));var config=require(_0x5b28('0x8'));var attributes=require(_0x5b28('0x9'));module[_0x5b28('0xa')]=function(_0x1c3dae,_0x116e31){return _0x1c3dae[_0x5b28('0xb')](_0x5b28('0xc'),attributes,{'tableName':_0x5b28('0xd'),'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 f0d84a0..c0ac0f3 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 _0x7607=['request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x7607,0x79));var _0x7760=function(_0xedfd52,_0x4fd42f){_0xedfd52=_0xedfd52-0x0;var _0x6351c8=_0x7607[_0xedfd52];return _0x6351c8;};'use strict';var _=require(_0x7760('0x0'));var util=require(_0x7760('0x1'));var moment=require(_0x7760('0x2'));var BPromise=require('bluebird');var rs=require(_0x7760('0x3'));var fs=require('fs');var Redis=require(_0x7760('0x4'));var db=require(_0x7760('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7760('0x6'))('rpc');var config=require(_0x7760('0x7'));var jayson=require(_0x7760('0x8'));var client=jayson[_0x7760('0x9')][_0x7760('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35313c,_0x2bb675,_0x1d868f){return new BPromise(function(_0x25eaa3,_0x45708a){return client[_0x7760('0xb')](_0x35313c,_0x1d868f)['then'](function(_0x3d6caa){logger[_0x7760('0xc')](_0x7760('0xd'),_0x2bb675,_0x7760('0xe'));logger[_0x7760('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2bb675,_0x7760('0xe'),JSON[_0x7760('0x10')](_0x3d6caa));if(_0x3d6caa[_0x7760('0x11')]){if(_0x3d6caa[_0x7760('0x11')][_0x7760('0x12')]===0x1f4){logger[_0x7760('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x2bb675,_0x3d6caa[_0x7760('0x11')]['message']);return _0x45708a(_0x3d6caa[_0x7760('0x11')]['message']);}logger[_0x7760('0x11')](_0x7760('0xd'),_0x2bb675,_0x3d6caa[_0x7760('0x11')][_0x7760('0x13')]);return _0x25eaa3(_0x3d6caa[_0x7760('0x11')][_0x7760('0x13')]);}else{logger[_0x7760('0xc')](_0x7760('0xd'),_0x2bb675,_0x7760('0xe'));_0x25eaa3(_0x3d6caa[_0x7760('0x14')][_0x7760('0x13')]);}})[_0x7760('0x15')](function(_0x5a919f){logger[_0x7760('0x11')](_0x7760('0xd'),_0x2bb675,_0x5a919f);_0x45708a(_0x5a919f);});});} \ No newline at end of file +var _0x8a81=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x19ca6e,_0x5e0abc){var _0x175fe1=function(_0x5edc8a){while(--_0x5edc8a){_0x19ca6e['push'](_0x19ca6e['shift']());}};_0x175fe1(++_0x5e0abc);}(_0x8a81,0x67));var _0x18a8=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8a81[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0x18a8('0x0'));var moment=require('moment');var BPromise=require(_0x18a8('0x1'));var rs=require(_0x18a8('0x2'));var fs=require('fs');var Redis=require(_0x18a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x18a8('0x4'));var logger=require(_0x18a8('0x5'))(_0x18a8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x18a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x527e9e,_0x27ead0,_0x5cbbe7){return new BPromise(function(_0xd95564,_0x1c2275){return client[_0x18a8('0x8')](_0x527e9e,_0x5cbbe7)[_0x18a8('0x9')](function(_0x3de6c0){logger[_0x18a8('0xa')](_0x18a8('0xb'),_0x27ead0,_0x18a8('0xc'));logger[_0x18a8('0xd')](_0x18a8('0xe'),_0x27ead0,'request\x20sent',JSON[_0x18a8('0xf')](_0x3de6c0));if(_0x3de6c0[_0x18a8('0x10')]){if(_0x3de6c0['error'][_0x18a8('0x11')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x27ead0,_0x3de6c0[_0x18a8('0x10')]['message']);return _0x1c2275(_0x3de6c0[_0x18a8('0x10')][_0x18a8('0x12')]);}logger[_0x18a8('0x10')](_0x18a8('0xb'),_0x27ead0,_0x3de6c0[_0x18a8('0x10')][_0x18a8('0x12')]);return _0xd95564(_0x3de6c0[_0x18a8('0x10')][_0x18a8('0x12')]);}else{logger[_0x18a8('0xa')](_0x18a8('0xb'),_0x27ead0,_0x18a8('0xc'));_0xd95564(_0x3de6c0[_0x18a8('0x13')][_0x18a8('0x12')]);}})[_0x18a8('0x14')](function(_0x5452cf){logger[_0x18a8('0x10')](_0x18a8('0xb'),_0x27ead0,_0x5452cf);_0x1c2275(_0x5452cf);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4546035..49889d1 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(_0x3b0dd3,_0x2f56f9){var _0x140e3c=function(_0x4a6124){while(--_0x4a6124){_0x3b0dd3['push'](_0x3b0dd3['shift']());}};_0x140e3c(++_0x2f56f9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0xcb91[_0x2aa48b];return _0x48caf8;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x11ae0f,_0x490859){var _0x50fd0a=function(_0x515d17){while(--_0x515d17){_0x11ae0f['push'](_0x11ae0f['shift']());}};_0x50fd0a(++_0x490859);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xcb91[_0x24061a];return _0x82054e;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 8e83a14..3111658 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 _0x9d61=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x9d61,0xbe));var _0x19d6=function(_0x40065a,_0x2deb85){_0x40065a=_0x40065a-0x0;var _0x39aa42=_0x9d61[_0x40065a];return _0x39aa42;};'use strict';var Sequelize=require(_0x19d6('0x0'));module[_0x19d6('0x1')]={'uniqueid':{'type':Sequelize[_0x19d6('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x19d6('0x3')],'allowNull':![],'comment':_0x19d6('0x4')},'UserId':{'type':Sequelize[_0x19d6('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x19d6('0x3')],'allowNull':![],'unique':_0x19d6('0x5'),'comment':_0x19d6('0x4')},'VoiceQueueId':{'type':Sequelize[_0x19d6('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x19d6('0x3')],'allowNull':![],'unique':_0x19d6('0x5'),'comment':_0x19d6('0x4')},'penalty':{'type':Sequelize[_0x19d6('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x3dce=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x3b363a,_0x13d01c){var _0x3f8b2f=function(_0x3a186e){while(--_0x3a186e){_0x3b363a['push'](_0x3b363a['shift']());}};_0x3f8b2f(++_0x13d01c);}(_0x3dce,0x8d));var _0xe3dc=function(_0x10a562,_0x4444a6){_0x10a562=_0x10a562-0x0;var _0x43fe3e=_0x3dce[_0x10a562];return _0x43fe3e;};'use strict';var Sequelize=require('sequelize');module[_0xe3dc('0x0')]={'uniqueid':{'type':Sequelize[_0xe3dc('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe3dc('0x2')},'membername':{'type':Sequelize[_0xe3dc('0x3')],'allowNull':![],'comment':_0xe3dc('0x2')},'UserId':{'type':Sequelize[_0xe3dc('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xe3dc('0x3')],'allowNull':![],'unique':_0xe3dc('0x4'),'comment':_0xe3dc('0x2')},'VoiceQueueId':{'type':Sequelize[_0xe3dc('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xe3dc('0x3')],'allowNull':![],'unique':_0xe3dc('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xe3dc('0x1')](0xb),'defaultValue':0x0,'comment':_0xe3dc('0x2')},'paused':{'type':Sequelize[_0xe3dc('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index b358d9d..c7ba408 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 _0xa5fc=['remove','emit','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xa5fc,0x140));var _0xca5f=function(_0x286699,_0x6c9b0f){_0x286699=_0x286699-0x0;var _0x3b4e3f=_0xa5fc[_0x286699];return _0x3b4e3f;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xca5f('0x0')](0x0);var events={'afterCreate':_0xca5f('0x1'),'afterUpdate':'update','afterDestroy':_0xca5f('0x2')};function emitEvent(_0x1cedf5){return function(_0x24cdf1,_0x191d97,_0x2b1586){UserVoiceQueueRtEvents[_0xca5f('0x3')](_0x1cedf5+':'+_0x24cdf1['id'],_0x24cdf1);UserVoiceQueueRtEvents[_0xca5f('0x3')](_0x1cedf5,_0x24cdf1);_0x2b1586(null);};}for(var e in events){if(events[_0xca5f('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0xca5f('0x5')](e,emitEvent(event));}}module[_0xca5f('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xf60a=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf60a,0xae));var _0xaf60=function(_0x4fa72e,_0x336dda){_0x4fa72e=_0x4fa72e-0x0;var _0x28323a=_0xf60a[_0x4fa72e];return _0x28323a;};'use strict';var EventEmitter=require(_0xaf60('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xaf60('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaf60('0x2'),'afterDestroy':_0xaf60('0x3')};function emitEvent(_0x1bab62){return function(_0x219413,_0x294ed3,_0x3a638f){UserVoiceQueueRtEvents[_0xaf60('0x4')](_0x1bab62+':'+_0x219413['id'],_0x219413);UserVoiceQueueRtEvents[_0xaf60('0x4')](_0x1bab62,_0x219413);_0x3a638f(null);};}for(var e in events){if(events[_0xaf60('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xaf60('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index dfe52b8..1b262b9 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 _0xbae4=['./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','path','rimraf','../../config/environment'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0xbae4,0x69));var _0x4bae=function(_0x267bcf,_0x45e4fa){_0x267bcf=_0x267bcf-0x0;var _0x393d9c=_0xbae4[_0x267bcf];return _0x393d9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bae('0x0'));var rimraf=require(_0x4bae('0x1'));var config=require(_0x4bae('0x2'));var attributes=require(_0x4bae('0x3'));module['exports']=function(_0x31ee3c,_0x2a88f9){return _0x31ee3c[_0x4bae('0x4')](_0x4bae('0x5'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4f9=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1be617,_0x5f4160){var _0x545312=function(_0x526775){while(--_0x526775){_0x1be617['push'](_0x1be617['shift']());}};_0x545312(++_0x5f4160);}(_0xe4f9,0x1e6));var _0x9e4f=function(_0x544915,_0x3721f4){_0x544915=_0x544915-0x0;var _0x5f2a29=_0xe4f9[_0x544915];return _0x5f2a29;};'use strict';var _=require(_0x9e4f('0x0'));var util=require(_0x9e4f('0x1'));var logger=require(_0x9e4f('0x2'))('api');var moment=require(_0x9e4f('0x3'));var BPromise=require(_0x9e4f('0x4'));var rp=require(_0x9e4f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e4f('0x6'));var config=require(_0x9e4f('0x7'));var attributes=require(_0x9e4f('0x8'));module['exports']=function(_0x3b2b05,_0x12c6a6){return _0x3b2b05[_0x9e4f('0x9')](_0x9e4f('0xa'),attributes,{'tableName':_0x9e4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 21ce158..ab65e45 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 _0x04fb=['./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter'];(function(_0x13060e,_0x5564ce){var _0x1a6418=function(_0x4149c6){while(--_0x4149c6){_0x13060e['push'](_0x13060e['shift']());}};_0x1a6418(++_0x5564ce);}(_0x04fb,0x65));var _0xb04f=function(_0x3afb92,_0x44a61a){_0x3afb92=_0x3afb92-0x0;var _0x52a91a=_0x04fb[_0x3afb92];return _0x52a91a;};'use strict';var _=require(_0xb04f('0x0'));var util=require(_0xb04f('0x1'));var moment=require(_0xb04f('0x2'));var BPromise=require(_0xb04f('0x3'));var rs=require(_0xb04f('0x4'));var fs=require('fs');var Redis=require(_0xb04f('0x5'));var db=require(_0xb04f('0x6'))['db'];var utils=require(_0xb04f('0x7'));var logger=require(_0xb04f('0x8'))(_0xb04f('0x9'));var config=require(_0xb04f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb04f('0xb')][_0xb04f('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb04f('0xd')],{'host':_0xb04f('0xe'),'port':0x18eb});var socket=require(_0xb04f('0xf'))(new Redis(config[_0xb04f('0xd')]));require(_0xb04f('0x10'))[_0xb04f('0x11')](socket);function respondWithRpcPromise(_0x2bdd6b,_0x2747e7,_0xe28acf){return new BPromise(function(_0x3f1d72,_0x50b7d1){return client[_0xb04f('0x12')](_0x2bdd6b,_0xe28acf)['then'](function(_0x4e59b0){logger[_0xb04f('0x13')](_0xb04f('0x14'),_0x2747e7,'request\x20sent');logger['debug'](_0xb04f('0x15'),_0x2747e7,_0xb04f('0x16'),JSON[_0xb04f('0x17')](_0x4e59b0));if(_0x4e59b0[_0xb04f('0x18')]){if(_0x4e59b0[_0xb04f('0x18')]['code']===0x1f4){logger[_0xb04f('0x18')](_0xb04f('0x14'),_0x2747e7,_0x4e59b0[_0xb04f('0x18')][_0xb04f('0x19')]);return _0x50b7d1(_0x4e59b0['error']['message']);}logger['error'](_0xb04f('0x14'),_0x2747e7,_0x4e59b0[_0xb04f('0x18')]['message']);return _0x3f1d72(_0x4e59b0[_0xb04f('0x18')][_0xb04f('0x19')]);}else{logger[_0xb04f('0x13')](_0xb04f('0x14'),_0x2747e7,'request\x20sent');_0x3f1d72(_0x4e59b0['result'][_0xb04f('0x19')]);}})[_0xb04f('0x1a')](function(_0x4421c1){logger[_0xb04f('0x18')](_0xb04f('0x14'),_0x2747e7,_0x4421c1);_0x50b7d1(_0x4421c1);});});}exports[_0xb04f('0x1b')]=function(_0x18d90e){var _0x3fd300=this;return new Promise(function(_0x5adf67,_0x10f536){return db['UserVoiceQueueRt'][_0xb04f('0x1c')]({'raw':_0x18d90e['options']?_0x18d90e[_0xb04f('0x1d')][_0xb04f('0x1e')]===undefined?!![]:![]:!![],'where':_0x18d90e[_0xb04f('0x1d')]?_0x18d90e[_0xb04f('0x1d')][_0xb04f('0x1f')]||null:null,'attributes':[[db[_0xb04f('0x20')]['fn'](_0xb04f('0x21'),db['sequelize']['fn']('IF',db[_0xb04f('0x20')][_0xb04f('0x22')](_0xb04f('0x23')))),_0xb04f('0x24')]]})[_0xb04f('0x25')](function(_0x2af5e1){logger[_0xb04f('0x13')](_0xb04f('0x1b'),_0x18d90e);logger[_0xb04f('0x26')](_0xb04f('0x1b'),_0x18d90e,JSON['stringify'](_0x2af5e1));_0x5adf67(_0x2af5e1);})[_0xb04f('0x1a')](function(_0x1ecad0){logger[_0xb04f('0x18')]('GetVoiceQueueRtPauses',_0x1ecad0[_0xb04f('0x19')],_0x18d90e);_0x10f536(_0x3fd300['error'](0x1f4,_0x1ecad0[_0xb04f('0x19')]));});});}; \ No newline at end of file +var _0xdd10=['literal','`paused`\x20=\x201,\x201,\x20null','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdd10,0x174));var _0x0dd1=function(_0x211093,_0x32989b){_0x211093=_0x211093-0x0;var _0x31f0f5=_0xdd10[_0x211093];return _0x31f0f5;};'use strict';var _=require('lodash');var util=require(_0x0dd1('0x0'));var moment=require(_0x0dd1('0x1'));var BPromise=require('bluebird');var rs=require(_0x0dd1('0x2'));var fs=require('fs');var Redis=require(_0x0dd1('0x3'));var db=require(_0x0dd1('0x4'))['db'];var utils=require(_0x0dd1('0x5'));var logger=require('../../config/logger')(_0x0dd1('0x6'));var config=require(_0x0dd1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0dd1('0x8')][_0x0dd1('0x9')]({'port':0x232a});config[_0x0dd1('0xa')]=_[_0x0dd1('0xb')](config[_0x0dd1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0dd1('0xc'))(new Redis(config[_0x0dd1('0xa')]));require(_0x0dd1('0xd'))[_0x0dd1('0xe')](socket);function respondWithRpcPromise(_0x360b34,_0x4fcdb2,_0x1644ab){return new BPromise(function(_0x4e6c8f,_0x53f90b){return client[_0x0dd1('0xf')](_0x360b34,_0x1644ab)[_0x0dd1('0x10')](function(_0x2143ae){logger['info'](_0x0dd1('0x11'),_0x4fcdb2,_0x0dd1('0x12'));logger[_0x0dd1('0x13')](_0x0dd1('0x14'),_0x4fcdb2,'request\x20sent',JSON[_0x0dd1('0x15')](_0x2143ae));if(_0x2143ae[_0x0dd1('0x16')]){if(_0x2143ae[_0x0dd1('0x16')][_0x0dd1('0x17')]===0x1f4){logger[_0x0dd1('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4fcdb2,_0x2143ae[_0x0dd1('0x16')]['message']);return _0x53f90b(_0x2143ae['error'][_0x0dd1('0x18')]);}logger[_0x0dd1('0x16')](_0x0dd1('0x11'),_0x4fcdb2,_0x2143ae[_0x0dd1('0x16')][_0x0dd1('0x18')]);return _0x4e6c8f(_0x2143ae[_0x0dd1('0x16')]['message']);}else{logger[_0x0dd1('0x19')](_0x0dd1('0x11'),_0x4fcdb2,'request\x20sent');_0x4e6c8f(_0x2143ae['result'][_0x0dd1('0x18')]);}})[_0x0dd1('0x1a')](function(_0x2345b1){logger[_0x0dd1('0x16')](_0x0dd1('0x11'),_0x4fcdb2,_0x2345b1);_0x53f90b(_0x2345b1);});});}exports[_0x0dd1('0x1b')]=function(_0x228ccd){var _0x196be9=this;return new Promise(function(_0x90f057,_0xd0bed5){return db[_0x0dd1('0x1c')][_0x0dd1('0x1d')]({'raw':_0x228ccd['options']?_0x228ccd[_0x0dd1('0x1e')][_0x0dd1('0x1f')]===undefined?!![]:![]:!![],'where':_0x228ccd[_0x0dd1('0x1e')]?_0x228ccd[_0x0dd1('0x1e')][_0x0dd1('0x20')]||null:null,'attributes':[[db[_0x0dd1('0x21')]['fn'](_0x0dd1('0x22'),db[_0x0dd1('0x21')]['fn']('IF',db['sequelize'][_0x0dd1('0x23')](_0x0dd1('0x24')))),'outboundQueuePauses']]})[_0x0dd1('0x10')](function(_0x15cd0b){logger[_0x0dd1('0x19')](_0x0dd1('0x1b'),_0x228ccd);logger[_0x0dd1('0x13')]('GetVoiceQueueRtPauses',_0x228ccd,JSON['stringify'](_0x15cd0b));_0x90f057(_0x15cd0b);})[_0x0dd1('0x1a')](function(_0x1a3a91){logger[_0x0dd1('0x16')](_0x0dd1('0x1b'),_0x1a3a91['message'],_0x228ccd);_0xd0bed5(_0x196be9[_0x0dd1('0x16')](0x1f4,_0x1a3a91[_0x0dd1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 810fb0f..510b59e 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 _0xb0df=['length','save','remove','update','emit','register'];(function(_0x21fb2c,_0x4df56b){var _0x49dc3b=function(_0xc6c2d4){while(--_0xc6c2d4){_0x21fb2c['push'](_0x21fb2c['shift']());}};_0x49dc3b(++_0x4df56b);}(_0xb0df,0x85));var _0xfb0d=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0xb0df[_0x44ae0b];return _0x69232a;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xfb0d('0x0'),_0xfb0d('0x1'),_0xfb0d('0x2')];function createListener(_0x1d8a94,_0x3b212b){return function(_0x14e303){_0x3b212b[_0xfb0d('0x3')](_0x1d8a94,_0x14e303);};}function removeListener(_0x823ea6,_0x3348e0){return function(){UserVoiceQueueRtEvents['removeListener'](_0x823ea6,_0x3348e0);};}exports[_0xfb0d('0x4')]=function(_0x12458c){for(var _0x58e4c0=0x0,_0x5b7591=events[_0xfb0d('0x5')];_0x58e4c0<_0x5b7591;_0x58e4c0++){var _0xee3329=events[_0x58e4c0];var _0x5cf723=createListener('userVoiceQueueRt:'+_0xee3329,_0x12458c);UserVoiceQueueRtEvents['on'](_0xee3329,_0x5cf723);}}; \ No newline at end of file +var _0x51f2=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x5aeb9a,_0x44ea0){var _0x3602dc=function(_0x46c4bf){while(--_0x46c4bf){_0x5aeb9a['push'](_0x5aeb9a['shift']());}};_0x3602dc(++_0x44ea0);}(_0x51f2,0xeb));var _0x251f=function(_0x220aa2,_0x37855d){_0x220aa2=_0x220aa2-0x0;var _0x5ec98b=_0x51f2[_0x220aa2];return _0x5ec98b;};'use strict';var UserVoiceQueueRtEvents=require(_0x251f('0x0'));var events=[_0x251f('0x1'),_0x251f('0x2'),_0x251f('0x3')];function createListener(_0x2afc7f,_0x243816){return function(_0x1d0c48){_0x243816[_0x251f('0x4')](_0x2afc7f,_0x1d0c48);};}function removeListener(_0x1dd1c9,_0x4bc4be){return function(){UserVoiceQueueRtEvents[_0x251f('0x5')](_0x1dd1c9,_0x4bc4be);};}exports[_0x251f('0x6')]=function(_0x145630){for(var _0xd9d8e1=0x0,_0x18c6ab=events['length'];_0xd9d8e1<_0x18c6ab;_0xd9d8e1++){var _0x1f01da=events[_0xd9d8e1];var _0x37469e=createListener(_0x251f('0x7')+_0x1f01da,_0x145630);UserVoiceQueueRtEvents['on'](_0x1f01da,_0x37469e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 27caade..1236e63 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x348606,_0x4bce18){var _0xcec422=function(_0x1bae8f){while(--_0x1bae8f){_0x348606['push'](_0x348606['shift']());}};_0xcec422(++_0x4bce18);}(_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(_0x30483c,_0x36fb33){var _0x5c1107=function(_0x44cc84){while(--_0x44cc84){_0x30483c['push'](_0x30483c['shift']());}};_0x5c1107(++_0x36fb33);}(_0x70e0,0x17b));var _0x070e=function(_0x15135f,_0x272ad8){_0x15135f=_0x15135f-0x0;var _0x209caa=_0x70e0[_0x15135f];return _0x209caa;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index faaf1fc..9006424 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 _0x976e=['INTEGER','exports'];(function(_0x1158bb,_0x330ceb){var _0x43d720=function(_0x5434f3){while(--_0x5434f3){_0x1158bb['push'](_0x1158bb['shift']());}};_0x43d720(++_0x330ceb);}(_0x976e,0x1c9));var _0xe976=function(_0x1f7781,_0x4addc8){_0x1f7781=_0x1f7781-0x0;var _0x50977f=_0x976e[_0x1f7781];return _0x50977f;};'use strict';var Sequelize=require('sequelize');module[_0xe976('0x0')]={'penalty':{'type':Sequelize[_0xe976('0x1')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index c3cdded..3ac8d00 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 _0xe566=['util','../../config/logger','moment','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x959162,_0x2b57d3){var _0x2923f6=function(_0xbacddf){while(--_0xbacddf){_0x959162['push'](_0x959162['shift']());}};_0x2923f6(++_0x2b57d3);}(_0xe566,0xe6));var _0x6e56=function(_0x4f232a,_0x529d8){_0x4f232a=_0x4f232a-0x0;var _0x4fda49=_0xe566[_0x4f232a];return _0x4fda49;};'use strict';var _=require(_0x6e56('0x0'));var util=require(_0x6e56('0x1'));var logger=require(_0x6e56('0x2'))('api');var moment=require(_0x6e56('0x3'));var BPromise=require('bluebird');var rp=require(_0x6e56('0x4'));var fs=require('fs');var path=require(_0x6e56('0x5'));var rimraf=require('rimraf');var config=require(_0x6e56('0x6'));var attributes=require(_0x6e56('0x7'));module[_0x6e56('0x8')]=function(_0x3735d5,_0x5db538){return _0x3735d5['define'](_0x6e56('0x9'),attributes,{'tableName':_0x6e56('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69ce=['../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x360276,_0x5abedd){var _0x2e6eb1=function(_0x16debf){while(--_0x16debf){_0x360276['push'](_0x360276['shift']());}};_0x2e6eb1(++_0x5abedd);}(_0x69ce,0x191));var _0xe69c=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x69ce[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xe69c('0x0'));var util=require(_0xe69c('0x1'));var logger=require('../../config/logger')(_0xe69c('0x2'));var moment=require(_0xe69c('0x3'));var BPromise=require(_0xe69c('0x4'));var rp=require(_0xe69c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe69c('0x6'));var config=require(_0xe69c('0x7'));var attributes=require(_0xe69c('0x8'));module['exports']=function(_0x3e72c8,_0x50e812){return _0x3e72c8[_0xe69c('0x9')](_0xe69c('0xa'),attributes,{'tableName':_0xe69c('0xb'),'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 deda590..fba269a 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 _0xdee9=['client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdee9,0xa6));var _0x9dee=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xdee9[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x9dee('0x0'));var util=require(_0x9dee('0x1'));var moment=require(_0x9dee('0x2'));var BPromise=require(_0x9dee('0x3'));var rs=require(_0x9dee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9dee('0x5'));var logger=require(_0x9dee('0x6'))(_0x9dee('0x7'));var config=require(_0x9dee('0x8'));var jayson=require(_0x9dee('0x9'));var client=jayson[_0x9dee('0xa')][_0x9dee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1152b9,_0x268a63,_0x4303e8){return new BPromise(function(_0x535f44,_0x2cea96){return client[_0x9dee('0xc')](_0x1152b9,_0x4303e8)[_0x9dee('0xd')](function(_0x26b0f4){logger['info'](_0x9dee('0xe'),_0x268a63,_0x9dee('0xf'));logger['debug'](_0x9dee('0x10'),_0x268a63,'request\x20sent',JSON['stringify'](_0x26b0f4));if(_0x26b0f4[_0x9dee('0x11')]){if(_0x26b0f4[_0x9dee('0x11')][_0x9dee('0x12')]===0x1f4){logger[_0x9dee('0x11')](_0x9dee('0xe'),_0x268a63,_0x26b0f4[_0x9dee('0x11')][_0x9dee('0x13')]);return _0x2cea96(_0x26b0f4[_0x9dee('0x11')][_0x9dee('0x13')]);}logger[_0x9dee('0x11')](_0x9dee('0xe'),_0x268a63,_0x26b0f4[_0x9dee('0x11')][_0x9dee('0x13')]);return _0x535f44(_0x26b0f4[_0x9dee('0x11')]['message']);}else{logger['info'](_0x9dee('0xe'),_0x268a63,'request\x20sent');_0x535f44(_0x26b0f4[_0x9dee('0x14')][_0x9dee('0x13')]);}})[_0x9dee('0x15')](function(_0x34f590){logger[_0x9dee('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x268a63,_0x34f590);_0x2cea96(_0x34f590);});});} \ No newline at end of file +var _0xd1fb=['debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x11c632,_0x37a6d1){var _0x552909=function(_0x48fd26){while(--_0x48fd26){_0x11c632['push'](_0x11c632['shift']());}};_0x552909(++_0x37a6d1);}(_0xd1fb,0x11e));var _0xbd1f=function(_0x5939f7,_0x83f0d2){_0x5939f7=_0x5939f7-0x0;var _0x12b700=_0xd1fb[_0x5939f7];return _0x12b700;};'use strict';var _=require(_0xbd1f('0x0'));var util=require(_0xbd1f('0x1'));var moment=require('moment');var BPromise=require(_0xbd1f('0x2'));var rs=require(_0xbd1f('0x3'));var fs=require('fs');var Redis=require(_0xbd1f('0x4'));var db=require(_0xbd1f('0x5'))['db'];var utils=require(_0xbd1f('0x6'));var logger=require(_0xbd1f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbd1f('0x8'));var client=jayson[_0xbd1f('0x9')][_0xbd1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2718ba,_0x249a4b,_0x29bdd9){return new BPromise(function(_0x34db09,_0x3c2d6d){return client['request'](_0x2718ba,_0x29bdd9)['then'](function(_0x5a6925){logger[_0xbd1f('0xb')](_0xbd1f('0xc'),_0x249a4b,_0xbd1f('0xd'));logger[_0xbd1f('0xe')](_0xbd1f('0xf'),_0x249a4b,_0xbd1f('0xd'),JSON['stringify'](_0x5a6925));if(_0x5a6925[_0xbd1f('0x10')]){if(_0x5a6925[_0xbd1f('0x10')][_0xbd1f('0x11')]===0x1f4){logger[_0xbd1f('0x10')](_0xbd1f('0xc'),_0x249a4b,_0x5a6925['error'][_0xbd1f('0x12')]);return _0x3c2d6d(_0x5a6925[_0xbd1f('0x10')]['message']);}logger[_0xbd1f('0x10')](_0xbd1f('0xc'),_0x249a4b,_0x5a6925[_0xbd1f('0x10')][_0xbd1f('0x12')]);return _0x34db09(_0x5a6925[_0xbd1f('0x10')][_0xbd1f('0x12')]);}else{logger[_0xbd1f('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x249a4b,'request\x20sent');_0x34db09(_0x5a6925[_0xbd1f('0x13')][_0xbd1f('0x12')]);}})['catch'](function(_0x14155a){logger['error'](_0xbd1f('0xc'),_0x249a4b,_0x14155a);_0x3c2d6d(_0x14155a);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d888fdc..a7ee978 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 _0x0487=['../../config/environment','./variable.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1d3fb0,_0x3bc9ae){var _0x2dbaf5=function(_0x3c1d50){while(--_0x3c1d50){_0x1d3fb0['push'](_0x1d3fb0['shift']());}};_0x2dbaf5(++_0x3bc9ae);}(_0x0487,0x14f));var _0x7048=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x0487[_0x1d1d09];return _0x8827e;};'use strict';var multer=require(_0x7048('0x0'));var util=require(_0x7048('0x1'));var path=require(_0x7048('0x2'));var timeout=require(_0x7048('0x3'));var express=require(_0x7048('0x4'));var router=express[_0x7048('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7048('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7048('0x7'));var controller=require(_0x7048('0x8'));router[_0x7048('0x9')]('/',auth[_0x7048('0xa')](),controller['index']);router[_0x7048('0x9')](_0x7048('0xb'),auth[_0x7048('0xa')](),controller['show']);router[_0x7048('0xc')]('/',auth['isAuthenticated'](),controller[_0x7048('0xd')]);router[_0x7048('0xe')](_0x7048('0xb'),auth[_0x7048('0xa')](),controller[_0x7048('0xf')]);router[_0x7048('0x10')](_0x7048('0xb'),auth['isAuthenticated'](),controller[_0x7048('0x11')]);module[_0x7048('0x12')]=router; \ No newline at end of file +var _0x5395=['index','/:id','post','create','put','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x3a8fb6,_0x52dad8){var _0xe77179=function(_0x10b57f){while(--_0x10b57f){_0x3a8fb6['push'](_0x3a8fb6['shift']());}};_0xe77179(++_0x52dad8);}(_0x5395,0x150));var _0x5539=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5395[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x5539('0x0'));var util=require('util');var path=require(_0x5539('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5539('0x2')]();var fs_extra=require(_0x5539('0x3'));var auth=require(_0x5539('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5539('0x5'));var controller=require(_0x5539('0x6'));router[_0x5539('0x7')]('/',auth[_0x5539('0x8')](),controller[_0x5539('0x9')]);router[_0x5539('0x7')](_0x5539('0xa'),auth[_0x5539('0x8')](),controller['show']);router[_0x5539('0xb')]('/',auth[_0x5539('0x8')](),controller[_0x5539('0xc')]);router[_0x5539('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5539('0xa'),auth['isAuthenticated'](),controller[_0x5539('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index ab8f59d..c4b4c4d 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 _0x2f9a=['STRING','name','sequelize','exports'];(function(_0xb2454d,_0x291753){var _0x5464fb=function(_0x386805){while(--_0x386805){_0xb2454d['push'](_0xb2454d['shift']());}};_0x5464fb(++_0x291753);}(_0x2f9a,0x186));var _0xa2f9=function(_0x20e1fd,_0x506bf0){_0x20e1fd=_0x20e1fd-0x0;var _0x3be635=_0x2f9a[_0x20e1fd];return _0x3be635;};'use strict';var Sequelize=require(_0xa2f9('0x0'));module[_0xa2f9('0x1')]={'name':{'type':Sequelize[_0xa2f9('0x2')],'unique':_0xa2f9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa2f9('0x2')]}}; \ No newline at end of file +var _0x5ee0=['STRING','name','sequelize','exports'];(function(_0xb4e074,_0x53bc26){var _0x1805bd=function(_0x3ac9bb){while(--_0x3ac9bb){_0xb4e074['push'](_0xb4e074['shift']());}};_0x1805bd(++_0x53bc26);}(_0x5ee0,0x17e));var _0x05ee=function(_0xe7d9bb,_0x5a77bb){_0xe7d9bb=_0xe7d9bb-0x0;var _0x34eddd=_0x5ee0[_0xe7d9bb];return _0x34eddd;};'use strict';var Sequelize=require(_0x05ee('0x0'));module[_0x05ee('0x1')]={'name':{'type':Sequelize[_0x05ee('0x2')],'unique':_0x05ee('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x05ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 213b510..0fc671c 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 _0xeb83=['save','then','destroy','UserProfileResource','sendStatus','stack','name','send','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','fields','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xeb83,0x1e7));var _0x3eb8=function(_0x1ab14e,_0x57a55f){_0x1ab14e=_0x1ab14e-0x0;var _0x12ef39=_0xeb83[_0x1ab14e];return _0x12ef39;};'use strict';var emlformat=require(_0x3eb8('0x0'));var rimraf=require(_0x3eb8('0x1'));var zipdir=require(_0x3eb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3eb8('0x3'));var moment=require(_0x3eb8('0x4'));var BPromise=require(_0x3eb8('0x5'));var Mustache=require(_0x3eb8('0x6'));var util=require(_0x3eb8('0x7'));var path=require('path');var sox=require(_0x3eb8('0x8'));var csv=require(_0x3eb8('0x9'));var ejs=require(_0x3eb8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3eb8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3eb8('0xc'));var deskjs=require(_0x3eb8('0xd'));var toCsv=require(_0x3eb8('0x9'));var querystring=require(_0x3eb8('0xe'));var Papa=require(_0x3eb8('0xf'));var Redis=require(_0x3eb8('0x10'));var authService=require(_0x3eb8('0x11'));var qs=require(_0x3eb8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3eb8('0x13'));var logger=require(_0x3eb8('0x14'))(_0x3eb8('0x15'));var utils=require(_0x3eb8('0x16'));var config=require(_0x3eb8('0x17'));var licenseUtil=require(_0x3eb8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x544339,_0x12bf83){_0x12bf83=_0x12bf83||0xcc;return function(_0x336ee6){if(_0x336ee6){return _0x544339['sendStatus'](_0x12bf83);}return _0x544339[_0x3eb8('0x19')](_0x12bf83)[_0x3eb8('0x1a')]();};}function respondWithResult(_0x123292,_0x367d37){_0x367d37=_0x367d37||0xc8;return function(_0x565508){if(_0x565508){return _0x123292[_0x3eb8('0x19')](_0x367d37)[_0x3eb8('0x1b')](_0x565508);}};}function respondWithFilteredResult(_0x3658f7,_0x34f1af){return function(_0x2710dc){if(_0x2710dc){var _0x877b91=typeof _0x34f1af[_0x3eb8('0x1c')]===_0x3eb8('0x1d')&&typeof _0x34f1af[_0x3eb8('0x1e')]===_0x3eb8('0x1d');var _0x1b7956=_0x2710dc[_0x3eb8('0x1f')];var _0x3e58cc=_0x877b91?0x0:_0x34f1af['offset'];var _0x36bd64=_0x877b91?_0x2710dc['count']:_0x34f1af[_0x3eb8('0x1c')]+_0x34f1af[_0x3eb8('0x1e')];var _0x186084;if(_0x36bd64>=_0x1b7956){_0x36bd64=_0x1b7956;_0x186084=0xc8;}else{_0x186084=0xce;}_0x3658f7[_0x3eb8('0x19')](_0x186084);return _0x3658f7[_0x3eb8('0x20')](_0x3eb8('0x21'),_0x3e58cc+'-'+_0x36bd64+'/'+_0x1b7956)['json'](_0x2710dc);}return null;};}function patchUpdates(_0x3500a7){return function(_0x5b38e8){try{jsonpatch[_0x3eb8('0x22')](_0x5b38e8,_0x3500a7,!![]);}catch(_0x3835dd){return BPromise['reject'](_0x3835dd);}return _0x5b38e8[_0x3eb8('0x23')]();};}function saveUpdates(_0x1a2a7d,_0x11b19f){return function(_0x5e33b0){if(_0x5e33b0){return _0x5e33b0['update'](_0x1a2a7d)[_0x3eb8('0x24')](function(_0x714c32){return _0x714c32;});}return null;};}function removeEntity(_0x174b82,_0x4a0642){return function(_0x1523fb){if(_0x1523fb){return _0x1523fb[_0x3eb8('0x25')]()[_0x3eb8('0x24')](function(){var _0x2bece2=_0x1523fb['get']({'plain':!![]});var _0x529403='Variables';return db[_0x3eb8('0x26')][_0x3eb8('0x25')]({'where':{'type':_0x529403,'resourceId':_0x2bece2['id']}})['then'](function(){return _0x1523fb;});})['then'](function(){_0x174b82[_0x3eb8('0x19')](0xcc)[_0x3eb8('0x1a')]();});}};}function handleEntityNotFound(_0x2e16c5,_0x1b112b){return function(_0x4eef60){if(!_0x4eef60){_0x2e16c5[_0x3eb8('0x27')](0x194);}return _0x4eef60;};}function handleError(_0x184fcc,_0x1dc2ae){_0x1dc2ae=_0x1dc2ae||0x1f4;return function(_0x53727f){logger['error'](_0x53727f[_0x3eb8('0x28')]);if(_0x53727f[_0x3eb8('0x29')]){delete _0x53727f[_0x3eb8('0x29')];}_0x184fcc[_0x3eb8('0x19')](_0x1dc2ae)[_0x3eb8('0x2a')](_0x53727f);};}exports['index']=function(_0xfd68d4,_0x30ee10){var _0x29d836={},_0x56c2b4={},_0x69a7b7={'count':0x0,'rows':[]};var _0x36c6ce=_[_0x3eb8('0x2b')](db[_0x3eb8('0x2c')][_0x3eb8('0x2d')],function(_0xc325fa){return{'name':_0xc325fa[_0x3eb8('0x2e')],'type':_0xc325fa[_0x3eb8('0x2f')][_0x3eb8('0x30')]};});_0x56c2b4[_0x3eb8('0x31')]=_[_0x3eb8('0x2b')](_0x36c6ce,_0x3eb8('0x29'));_0x56c2b4[_0x3eb8('0x32')]=_[_0x3eb8('0x33')](_0xfd68d4[_0x3eb8('0x32')]);_0x56c2b4['filters']=_[_0x3eb8('0x34')](_0x56c2b4['model'],_0x56c2b4[_0x3eb8('0x32')]);_0x29d836[_0x3eb8('0x35')]=_['intersection'](_0x56c2b4[_0x3eb8('0x31')],qs['fields'](_0xfd68d4[_0x3eb8('0x32')]['fields']));_0x29d836[_0x3eb8('0x35')]=_0x29d836['attributes']['length']?_0x29d836['attributes']:_0x56c2b4[_0x3eb8('0x31')];if(!_0xfd68d4[_0x3eb8('0x32')][_0x3eb8('0x36')](_0x3eb8('0x37'))){_0x29d836['limit']=qs[_0x3eb8('0x1e')](_0xfd68d4[_0x3eb8('0x32')][_0x3eb8('0x1e')]);_0x29d836['offset']=qs['offset'](_0xfd68d4[_0x3eb8('0x32')][_0x3eb8('0x1c')]);}_0x29d836[_0x3eb8('0x38')]=qs[_0x3eb8('0x39')](_0xfd68d4[_0x3eb8('0x32')][_0x3eb8('0x39')]);_0x29d836[_0x3eb8('0x3a')]=qs[_0x3eb8('0x3b')](_[_0x3eb8('0x3c')](_0xfd68d4[_0x3eb8('0x32')],_0x56c2b4[_0x3eb8('0x3b')]),_0x36c6ce);if(_0xfd68d4[_0x3eb8('0x32')][_0x3eb8('0x3d')]){_0x29d836[_0x3eb8('0x3a')]=_[_0x3eb8('0x3e')](_0x29d836[_0x3eb8('0x3a')],{'$or':_[_0x3eb8('0x2b')](_0x36c6ce,function(_0x24014d){if(_0x24014d[_0x3eb8('0x2f')]!==_0x3eb8('0x3f')){var _0xa3b30a={};_0xa3b30a[_0x24014d[_0x3eb8('0x29')]]={'$like':'%'+_0xfd68d4[_0x3eb8('0x32')][_0x3eb8('0x3d')]+'%'};return _0xa3b30a;}})});}_0x29d836=_['merge']({},_0x29d836,_0xfd68d4[_0x3eb8('0x40')]);var _0xbc17c3={'where':_0x29d836['where']};return db[_0x3eb8('0x2c')][_0x3eb8('0x1f')](_0xbc17c3)[_0x3eb8('0x24')](function(_0x3618a0){_0x69a7b7['count']=_0x3618a0;if(_0xfd68d4[_0x3eb8('0x32')]['includeAll']){_0x29d836[_0x3eb8('0x41')]=[{'all':!![]}];}return db['Variable'][_0x3eb8('0x42')](_0x29d836);})[_0x3eb8('0x24')](function(_0x54ac16){_0x69a7b7[_0x3eb8('0x43')]=_0x54ac16;return _0x69a7b7;})[_0x3eb8('0x24')](respondWithFilteredResult(_0x30ee10,_0x29d836))[_0x3eb8('0x44')](handleError(_0x30ee10,null));};exports[_0x3eb8('0x45')]=function(_0x5d5959,_0x7663bd){var _0x1bca7e={'raw':!![],'where':{'id':_0x5d5959['params']['id']}},_0x368a31={};_0x368a31[_0x3eb8('0x31')]=_[_0x3eb8('0x33')](db['Variable'][_0x3eb8('0x2d')]);_0x368a31[_0x3eb8('0x32')]=_[_0x3eb8('0x33')](_0x5d5959['query']);_0x368a31['filters']=_[_0x3eb8('0x34')](_0x368a31[_0x3eb8('0x31')],_0x368a31[_0x3eb8('0x32')]);_0x1bca7e[_0x3eb8('0x35')]=_[_0x3eb8('0x34')](_0x368a31[_0x3eb8('0x31')],qs[_0x3eb8('0x46')](_0x5d5959[_0x3eb8('0x32')]['fields']));_0x1bca7e['attributes']=_0x1bca7e[_0x3eb8('0x35')][_0x3eb8('0x47')]?_0x1bca7e[_0x3eb8('0x35')]:_0x368a31[_0x3eb8('0x31')];if(_0x5d5959[_0x3eb8('0x32')][_0x3eb8('0x48')]){_0x1bca7e[_0x3eb8('0x41')]=[{'all':!![]}];}_0x1bca7e=_[_0x3eb8('0x3e')]({},_0x1bca7e,_0x5d5959[_0x3eb8('0x40')]);return db['Variable'][_0x3eb8('0x49')](_0x1bca7e)[_0x3eb8('0x24')](handleEntityNotFound(_0x7663bd,null))['then'](respondWithResult(_0x7663bd,null))['catch'](handleError(_0x7663bd,null));};exports[_0x3eb8('0x4a')]=function(_0x4331c2,_0x5c9f7d){return db['Variable']['create'](_0x4331c2[_0x3eb8('0x4b')],{})[_0x3eb8('0x24')](function(_0x3feeae){var _0x1e9ce5=_0x4331c2[_0x3eb8('0x4c')][_0x3eb8('0x4d')]({'plain':!![]});if(!_0x1e9ce5)throw new Error(_0x3eb8('0x4e'));if(_0x1e9ce5[_0x3eb8('0x4f')]===_0x3eb8('0x4c')){var _0x1f49ab=_0x3feeae[_0x3eb8('0x4d')]({'plain':!![]});var _0x57421f=_0x3eb8('0x50');return db[_0x3eb8('0x51')]['find']({'where':{'name':_0x57421f,'userProfileId':_0x1e9ce5['userProfileId']},'raw':!![]})['then'](function(_0x17bf4e){if(_0x17bf4e&&_0x17bf4e[_0x3eb8('0x52')]===0x0){return db[_0x3eb8('0x26')][_0x3eb8('0x4a')]({'name':_0x1f49ab[_0x3eb8('0x29')],'resourceId':_0x1f49ab['id'],'type':_0x17bf4e[_0x3eb8('0x29')],'sectionId':_0x17bf4e['id']},{})[_0x3eb8('0x24')](function(){return _0x3feeae;});}else{return _0x3feeae;}})['catch'](function(_0x3e6dc9){logger[_0x3eb8('0x53')](_0x3eb8('0x54'),_0x3e6dc9);throw _0x3e6dc9;});}return _0x3feeae;})[_0x3eb8('0x24')](respondWithResult(_0x5c9f7d,0xc9))[_0x3eb8('0x44')](handleError(_0x5c9f7d,null));};exports[_0x3eb8('0x55')]=function(_0x4fa8c6,_0x17e975){if(_0x4fa8c6[_0x3eb8('0x4b')]['id']){delete _0x4fa8c6[_0x3eb8('0x4b')]['id'];}return db[_0x3eb8('0x2c')][_0x3eb8('0x49')]({'where':{'id':_0x4fa8c6[_0x3eb8('0x56')]['id']}})[_0x3eb8('0x24')](handleEntityNotFound(_0x17e975,null))[_0x3eb8('0x24')](saveUpdates(_0x4fa8c6[_0x3eb8('0x4b')],null))[_0x3eb8('0x24')](respondWithResult(_0x17e975,null))[_0x3eb8('0x44')](handleError(_0x17e975,null));};exports[_0x3eb8('0x25')]=function(_0x4baaea,_0x347867){return db[_0x3eb8('0x2c')][_0x3eb8('0x49')]({'where':{'id':_0x4baaea[_0x3eb8('0x56')]['id']}})[_0x3eb8('0x24')](handleEntityNotFound(_0x347867,null))['then'](removeEntity(_0x347867,null))[_0x3eb8('0x44')](handleError(_0x347867,null));}; \ No newline at end of file +var _0x56bd=['options','create','body','user','role','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Variables','sendStatus','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','include','rows','catch','show'];(function(_0xfad00d,_0x311d9b){var _0x28328c=function(_0x5bb4b1){while(--_0x5bb4b1){_0xfad00d['push'](_0xfad00d['shift']());}};_0x28328c(++_0x311d9b);}(_0x56bd,0x14e));var _0xd56b=function(_0x43e5e7,_0x13be33){_0x43e5e7=_0x43e5e7-0x0;var _0x166925=_0x56bd[_0x43e5e7];return _0x166925;};'use strict';var emlformat=require(_0xd56b('0x0'));var rimraf=require(_0xd56b('0x1'));var zipdir=require(_0xd56b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd56b('0x3'));var moment=require(_0xd56b('0x4'));var BPromise=require(_0xd56b('0x5'));var Mustache=require(_0xd56b('0x6'));var util=require(_0xd56b('0x7'));var path=require(_0xd56b('0x8'));var sox=require(_0xd56b('0x9'));var csv=require(_0xd56b('0xa'));var ejs=require(_0xd56b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd56b('0xc'));var squel=require(_0xd56b('0xd'));var crypto=require(_0xd56b('0xe'));var jsforce=require(_0xd56b('0xf'));var deskjs=require(_0xd56b('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd56b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd56b('0x12'));var as=require(_0xd56b('0x13'));var hardwareService=require(_0xd56b('0x14'));var logger=require(_0xd56b('0x15'))(_0xd56b('0x16'));var utils=require(_0xd56b('0x17'));var config=require(_0xd56b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x252036,_0x115280){_0x115280=_0x115280||0xcc;return function(_0x5e1492){if(_0x5e1492){return _0x252036['sendStatus'](_0x115280);}return _0x252036['status'](_0x115280)[_0xd56b('0x19')]();};}function respondWithResult(_0x3e58d1,_0x4d23f0){_0x4d23f0=_0x4d23f0||0xc8;return function(_0x2684d4){if(_0x2684d4){return _0x3e58d1[_0xd56b('0x1a')](_0x4d23f0)[_0xd56b('0x1b')](_0x2684d4);}};}function respondWithFilteredResult(_0x3816d1,_0x1a3a55){return function(_0x556050){if(_0x556050){var _0xce2663=typeof _0x1a3a55[_0xd56b('0x1c')]===_0xd56b('0x1d')&&typeof _0x1a3a55[_0xd56b('0x1e')]==='undefined';var _0xbd8842=_0x556050[_0xd56b('0x1f')];var _0xee93f7=_0xce2663?0x0:_0x1a3a55[_0xd56b('0x1c')];var _0x5ce5b7=_0xce2663?_0x556050[_0xd56b('0x1f')]:_0x1a3a55[_0xd56b('0x1c')]+_0x1a3a55[_0xd56b('0x1e')];var _0xd24717;if(_0x5ce5b7>=_0xbd8842){_0x5ce5b7=_0xbd8842;_0xd24717=0xc8;}else{_0xd24717=0xce;}_0x3816d1[_0xd56b('0x1a')](_0xd24717);return _0x3816d1[_0xd56b('0x20')](_0xd56b('0x21'),_0xee93f7+'-'+_0x5ce5b7+'/'+_0xbd8842)[_0xd56b('0x1b')](_0x556050);}return null;};}function patchUpdates(_0x1059c7){return function(_0x2a196c){try{jsonpatch[_0xd56b('0x22')](_0x2a196c,_0x1059c7,!![]);}catch(_0x1dc005){return BPromise['reject'](_0x1dc005);}return _0x2a196c[_0xd56b('0x23')]();};}function saveUpdates(_0x58a33a,_0x136e44){return function(_0x51ddda){if(_0x51ddda){return _0x51ddda[_0xd56b('0x24')](_0x58a33a)[_0xd56b('0x25')](function(_0x243cc8){return _0x243cc8;});}return null;};}function removeEntity(_0x56817a,_0x301ab7){return function(_0x196ea9){if(_0x196ea9){return _0x196ea9[_0xd56b('0x26')]()[_0xd56b('0x25')](function(){var _0x53eabe=_0x196ea9[_0xd56b('0x27')]({'plain':!![]});var _0x583382=_0xd56b('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x583382,'resourceId':_0x53eabe['id']}})['then'](function(){return _0x196ea9;});})['then'](function(){_0x56817a['status'](0xcc)[_0xd56b('0x19')]();});}};}function handleEntityNotFound(_0xdc1887,_0x49089a){return function(_0x15bccf){if(!_0x15bccf){_0xdc1887[_0xd56b('0x29')](0x194);}return _0x15bccf;};}function handleError(_0x494765,_0x1f81e1){_0x1f81e1=_0x1f81e1||0x1f4;return function(_0x38d55a){logger[_0xd56b('0x2a')](_0x38d55a[_0xd56b('0x2b')]);if(_0x38d55a[_0xd56b('0x2c')]){delete _0x38d55a[_0xd56b('0x2c')];}_0x494765[_0xd56b('0x1a')](_0x1f81e1)['send'](_0x38d55a);};}exports[_0xd56b('0x2d')]=function(_0x79b87e,_0xb3603b){var _0x33622f={},_0x567d05={},_0x43b35f={'count':0x0,'rows':[]};var _0x35ca3a=_[_0xd56b('0x2e')](db[_0xd56b('0x2f')][_0xd56b('0x30')],function(_0x1bddd0){return{'name':_0x1bddd0[_0xd56b('0x31')],'type':_0x1bddd0[_0xd56b('0x32')][_0xd56b('0x33')]};});_0x567d05[_0xd56b('0x34')]=_['map'](_0x35ca3a,_0xd56b('0x2c'));_0x567d05[_0xd56b('0x35')]=_[_0xd56b('0x36')](_0x79b87e[_0xd56b('0x35')]);_0x567d05[_0xd56b('0x37')]=_[_0xd56b('0x38')](_0x567d05[_0xd56b('0x34')],_0x567d05['query']);_0x33622f[_0xd56b('0x39')]=_[_0xd56b('0x38')](_0x567d05[_0xd56b('0x34')],qs[_0xd56b('0x3a')](_0x79b87e[_0xd56b('0x35')][_0xd56b('0x3a')]));_0x33622f[_0xd56b('0x39')]=_0x33622f['attributes'][_0xd56b('0x3b')]?_0x33622f[_0xd56b('0x39')]:_0x567d05['model'];if(!_0x79b87e[_0xd56b('0x35')][_0xd56b('0x3c')](_0xd56b('0x3d'))){_0x33622f[_0xd56b('0x1e')]=qs[_0xd56b('0x1e')](_0x79b87e[_0xd56b('0x35')]['limit']);_0x33622f['offset']=qs[_0xd56b('0x1c')](_0x79b87e[_0xd56b('0x35')][_0xd56b('0x1c')]);}_0x33622f[_0xd56b('0x3e')]=qs[_0xd56b('0x3f')](_0x79b87e['query'][_0xd56b('0x3f')]);_0x33622f[_0xd56b('0x40')]=qs[_0xd56b('0x37')](_[_0xd56b('0x41')](_0x79b87e[_0xd56b('0x35')],_0x567d05[_0xd56b('0x37')]),_0x35ca3a);if(_0x79b87e['query']['filter']){_0x33622f[_0xd56b('0x40')]=_[_0xd56b('0x42')](_0x33622f[_0xd56b('0x40')],{'$or':_[_0xd56b('0x2e')](_0x35ca3a,function(_0x4773b1){if(_0x4773b1[_0xd56b('0x32')]!=='VIRTUAL'){var _0x362f00={};_0x362f00[_0x4773b1[_0xd56b('0x2c')]]={'$like':'%'+_0x79b87e[_0xd56b('0x35')]['filter']+'%'};return _0x362f00;}})});}_0x33622f=_[_0xd56b('0x42')]({},_0x33622f,_0x79b87e['options']);var _0x211502={'where':_0x33622f[_0xd56b('0x40')]};return db['Variable'][_0xd56b('0x1f')](_0x211502)[_0xd56b('0x25')](function(_0x4a9a13){_0x43b35f['count']=_0x4a9a13;if(_0x79b87e[_0xd56b('0x35')]['includeAll']){_0x33622f[_0xd56b('0x43')]=[{'all':!![]}];}return db[_0xd56b('0x2f')]['findAll'](_0x33622f);})[_0xd56b('0x25')](function(_0x43e560){_0x43b35f[_0xd56b('0x44')]=_0x43e560;return _0x43b35f;})['then'](respondWithFilteredResult(_0xb3603b,_0x33622f))[_0xd56b('0x45')](handleError(_0xb3603b,null));};exports[_0xd56b('0x46')]=function(_0x5bbfd2,_0x3a95d3){var _0x13f488={'raw':!![],'where':{'id':_0x5bbfd2['params']['id']}},_0x1fb889={};_0x1fb889[_0xd56b('0x34')]=_[_0xd56b('0x36')](db[_0xd56b('0x2f')][_0xd56b('0x30')]);_0x1fb889[_0xd56b('0x35')]=_['keys'](_0x5bbfd2[_0xd56b('0x35')]);_0x1fb889[_0xd56b('0x37')]=_[_0xd56b('0x38')](_0x1fb889[_0xd56b('0x34')],_0x1fb889['query']);_0x13f488[_0xd56b('0x39')]=_['intersection'](_0x1fb889['model'],qs[_0xd56b('0x3a')](_0x5bbfd2[_0xd56b('0x35')]['fields']));_0x13f488[_0xd56b('0x39')]=_0x13f488[_0xd56b('0x39')][_0xd56b('0x3b')]?_0x13f488['attributes']:_0x1fb889['model'];if(_0x5bbfd2[_0xd56b('0x35')]['includeAll']){_0x13f488[_0xd56b('0x43')]=[{'all':!![]}];}_0x13f488=_['merge']({},_0x13f488,_0x5bbfd2[_0xd56b('0x47')]);return db[_0xd56b('0x2f')]['find'](_0x13f488)[_0xd56b('0x25')](handleEntityNotFound(_0x3a95d3,null))[_0xd56b('0x25')](respondWithResult(_0x3a95d3,null))[_0xd56b('0x45')](handleError(_0x3a95d3,null));};exports[_0xd56b('0x48')]=function(_0x47e97b,_0x54c353){return db[_0xd56b('0x2f')][_0xd56b('0x48')](_0x47e97b[_0xd56b('0x49')],{})[_0xd56b('0x25')](function(_0x5d2f65){var _0x131ec0=_0x47e97b[_0xd56b('0x4a')][_0xd56b('0x27')]({'plain':!![]});if(!_0x131ec0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x131ec0[_0xd56b('0x4b')]==='user'){var _0x56792e=_0x5d2f65[_0xd56b('0x27')]({'plain':!![]});var _0x5f354b=_0xd56b('0x28');return db['UserProfileSection'][_0xd56b('0x4c')]({'where':{'name':_0x5f354b,'userProfileId':_0x131ec0['userProfileId']},'raw':!![]})[_0xd56b('0x25')](function(_0x49e6af){if(_0x49e6af&&_0x49e6af[_0xd56b('0x4d')]===0x0){return db[_0xd56b('0x4e')][_0xd56b('0x48')]({'name':_0x56792e[_0xd56b('0x2c')],'resourceId':_0x56792e['id'],'type':_0x49e6af[_0xd56b('0x2c')],'sectionId':_0x49e6af['id']},{})[_0xd56b('0x25')](function(){return _0x5d2f65;});}else{return _0x5d2f65;}})[_0xd56b('0x45')](function(_0x356328){logger[_0xd56b('0x2a')](_0xd56b('0x4f'),_0x356328);throw _0x356328;});}return _0x5d2f65;})[_0xd56b('0x25')](respondWithResult(_0x54c353,0xc9))['catch'](handleError(_0x54c353,null));};exports[_0xd56b('0x24')]=function(_0x2d73f9,_0x3b968e){if(_0x2d73f9['body']['id']){delete _0x2d73f9[_0xd56b('0x49')]['id'];}return db['Variable'][_0xd56b('0x4c')]({'where':{'id':_0x2d73f9[_0xd56b('0x50')]['id']}})[_0xd56b('0x25')](handleEntityNotFound(_0x3b968e,null))[_0xd56b('0x25')](saveUpdates(_0x2d73f9[_0xd56b('0x49')],null))[_0xd56b('0x25')](respondWithResult(_0x3b968e,null))[_0xd56b('0x45')](handleError(_0x3b968e,null));};exports[_0xd56b('0x26')]=function(_0x11e26f,_0x1ba3e1){return db[_0xd56b('0x2f')][_0xd56b('0x4c')]({'where':{'id':_0x11e26f['params']['id']}})['then'](handleEntityNotFound(_0x1ba3e1,null))['then'](removeEntity(_0x1ba3e1,null))['catch'](handleError(_0x1ba3e1,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 382c1ce..3971cd8 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 _0xbf73=['api','moment','request-promise','path','../../config/environment','Variable','tools_variables','lodash','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbf73,0xa9));var _0x3bf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf73[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3bf7('0x0'));var util=require('util');var logger=require(_0x3bf7('0x1'))(_0x3bf7('0x2'));var moment=require(_0x3bf7('0x3'));var BPromise=require('bluebird');var rp=require(_0x3bf7('0x4'));var fs=require('fs');var path=require(_0x3bf7('0x5'));var rimraf=require('rimraf');var config=require(_0x3bf7('0x6'));var attributes=require('./variable.attributes');module['exports']=function(_0x4e1895,_0x17dc72){return _0x4e1895['define'](_0x3bf7('0x7'),attributes,{'tableName':_0x3bf7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd733=['./variable.attributes','exports','Variable','tools_variables','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x5dbeb0,_0x5dd49a){var _0x49a622=function(_0x2e4135){while(--_0x2e4135){_0x5dbeb0['push'](_0x5dbeb0['shift']());}};_0x49a622(++_0x5dd49a);}(_0xd733,0x164));var _0x3d73=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0xd733[_0x87239];return _0x53af1e;};'use strict';var _=require(_0x3d73('0x0'));var util=require(_0x3d73('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3d73('0x2'));var BPromise=require(_0x3d73('0x3'));var rp=require(_0x3d73('0x4'));var fs=require('fs');var path=require(_0x3d73('0x5'));var rimraf=require(_0x3d73('0x6'));var config=require('../../config/environment');var attributes=require(_0x3d73('0x7'));module[_0x3d73('0x8')]=function(_0x40e99d,_0x137948){return _0x40e99d['define'](_0x3d73('0x9'),attributes,{'tableName':_0x3d73('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 772200d..02335d1 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(_0x3e9ef3,_0x21a7e4){var _0x333748=function(_0x3e7c45){while(--_0x3e7c45){_0x3e9ef3['push'](_0x3e9ef3['shift']());}};_0x333748(++_0x21a7e4);}(_0x1cb9,0x14e));var _0x91cb=function(_0x166b6c,_0x193460){_0x166b6c=_0x166b6c-0x0;var _0x170cc5=_0x1cb9[_0x166b6c];return _0x170cc5;};'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 _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x5b46ff,_0x2889bc){var _0x1ded99=function(_0x4de12a){while(--_0x4de12a){_0x5b46ff['push'](_0x5b46ff['shift']());}};_0x1ded99(++_0x2889bc);}(_0xabce,0x103));var _0xeabc=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xabce[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 479cbc3..e4833a5 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 _0x0d73=['reset','/pull','pull','/restart','restart','/migrations','express','./version.controller','get','/fetch','isAuthenticated','fetch','/reset'];(function(_0x42e2fd,_0x2b1e1d){var _0x1ce610=function(_0x1b794e){while(--_0x1b794e){_0x42e2fd['push'](_0x42e2fd['shift']());}};_0x1ce610(++_0x2b1e1d);}(_0x0d73,0x1cd));var _0x30d7=function(_0x5b556b,_0xfa7c40){_0x5b556b=_0x5b556b-0x0;var _0xcc8fde=_0x0d73[_0x5b556b];return _0xcc8fde;};'use strict';var express=require(_0x30d7('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x30d7('0x1'));router['get']('/',controller['index']);router[_0x30d7('0x2')](_0x30d7('0x3'),auth[_0x30d7('0x4')](),auth['canUpdate'](),controller[_0x30d7('0x5')]);router[_0x30d7('0x2')](_0x30d7('0x6'),auth[_0x30d7('0x4')](),auth['canUpdate'](),controller[_0x30d7('0x7')]);router[_0x30d7('0x2')](_0x30d7('0x8'),auth[_0x30d7('0x4')](),auth['canUpdate'](),controller[_0x30d7('0x9')]);router['get'](_0x30d7('0xa'),auth[_0x30d7('0x4')](),controller[_0x30d7('0xb')]);router[_0x30d7('0x2')](_0x30d7('0xc'),controller['migrations']);module['exports']=router; \ No newline at end of file +var _0x41c2=['exports','express','Router','../../components/auth/service','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','restart','/migrations','migrations'];(function(_0x1324d2,_0x5c9db9){var _0x442a24=function(_0x4c68de){while(--_0x4c68de){_0x1324d2['push'](_0x1324d2['shift']());}};_0x442a24(++_0x5c9db9);}(_0x41c2,0x1d1));var _0x241c=function(_0x3389e2,_0x3d5bcf){_0x3389e2=_0x3389e2-0x0;var _0x1313fc=_0x41c2[_0x3389e2];return _0x1313fc;};'use strict';var express=require(_0x241c('0x0'));var router=express[_0x241c('0x1')]();var auth=require(_0x241c('0x2'));var controller=require('./version.controller');router[_0x241c('0x3')]('/',controller['index']);router['get'](_0x241c('0x4'),auth[_0x241c('0x5')](),auth[_0x241c('0x6')](),controller[_0x241c('0x7')]);router[_0x241c('0x3')](_0x241c('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x241c('0x9')]);router[_0x241c('0x3')]('/pull',auth[_0x241c('0x5')](),auth['canUpdate'](),controller[_0x241c('0xa')]);router[_0x241c('0x3')](_0x241c('0xb'),auth[_0x241c('0x5')](),controller[_0x241c('0xc')]);router[_0x241c('0x3')](_0x241c('0xd'),controller[_0x241c('0xe')]);module[_0x241c('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 1369a53..670dcd5 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 _0x4d63=['Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','compare-versions','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','index','exports','version','query','latest','tags','2.0.0','json','fetch','master','error','git\x20fetch\x20origin\x20master','reset','--hard','status','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','server','migrations','replace','.js','push','length','sort','Migration','sequelize','getQueryInterface','join','map'];(function(_0x53b74a,_0x40eddd){var _0x5a7c78=function(_0x465f38){while(--_0x465f38){_0x53b74a['push'](_0x53b74a['shift']());}};_0x5a7c78(++_0x40eddd);}(_0x4d63,0xf3));var _0x34d6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4d63[_0x2641f9];return _0x585741;};'use strict';var Umzug=require(_0x34d6('0x0'));var path=require(_0x34d6('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x34d6('0x2'));var exec=require('child_process')['exec'];var db=require(_0x34d6('0x3'))['db'];var config=require(_0x34d6('0x4'));var pm2=require('../../config/pm2');var logger=require(_0x34d6('0x5'))('update');var git=require(_0x34d6('0x6'))(config[_0x34d6('0x7')]);exports[_0x34d6('0x8')]=function(_0x465cd1,_0x13b571){var _0xe9d64b={'current':module[_0x34d6('0x9')][_0x34d6('0xa')],'phonebar':0x2};if(_0x465cd1[_0x34d6('0xb')]&&_0x465cd1[_0x34d6('0xb')][_0x34d6('0xc')]){return git['fetch']()[_0x34d6('0xd')](function(_0x28db60,_0x128eb1){_0xe9d64b[_0x34d6('0xc')]=(_0x28db60?module[_0x34d6('0x9')][_0x34d6('0xa')]:_0x128eb1[_0x34d6('0xc')])||_0x34d6('0xe');return _0x13b571['status'](0xc8)[_0x34d6('0xf')](_0xe9d64b);});}else{return _0x13b571['status'](0xc8)[_0x34d6('0xf')](_0xe9d64b);}};exports[_0x34d6('0x10')]=function(_0x338f6e,_0x4b72c6){return git[_0x34d6('0x10')](['origin',_0x34d6('0x11')],function(_0x5c2a1a){if(_0x5c2a1a){logger[_0x34d6('0x12')](_0x5c2a1a);return _0x4b72c6['status'](0x1f4)['json'](_0x5c2a1a);}logger['info']('git\x20fetch');return _0x4b72c6['status'](0xc8)[_0x34d6('0xf')]({'output':_0x34d6('0x13')});});};exports['reset']=function(_0x9bcf5c,_0x1807a0){return git[_0x34d6('0x14')]([_0x34d6('0x15'),'FETCH_HEAD'],function(_0x370ef8){if(_0x370ef8){logger[_0x34d6('0x12')](_0x370ef8);return _0x1807a0[_0x34d6('0x16')](0x1f4)['json'](_0x370ef8);}logger[_0x34d6('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1807a0[_0x34d6('0x16')](0xc8)['json']({'output':_0x34d6('0x18')});});};exports[_0x34d6('0x19')]=function(_0x7ee1de,_0x152ff2){exec(_0x34d6('0x1a'),function(_0x163269,_0x4f5bd6,_0x4e6ba7){logger[_0x34d6('0x17')](_0x4f5bd6);logger[_0x34d6('0x17')](_0x4e6ba7);if(_0x163269){logger[_0x34d6('0x12')](_0x163269);return _0x152ff2['status'](0x1f4)[_0x34d6('0xf')](_0x163269);}return _0x152ff2[_0x34d6('0x16')](0xc8)['json']({'output':_0x4f5bd6});});};exports['restart']=function(_0x31ddb8,_0x111870){return pm2[_0x34d6('0x1b')](_0x34d6('0x1c'))[_0x34d6('0x1d')](function(_0x4ed111){logger[_0x34d6('0x17')]('pm2\x20restart\x20motion\x20%s',_0x4ed111);return _0x111870[_0x34d6('0x16')](0xc8)['json']({'output':_0x34d6('0x1e')});})[_0x34d6('0x1f')](function(_0x5d9a48){logger[_0x34d6('0x12')](_0x5d9a48);return _0x111870[_0x34d6('0x16')](0x1f4)[_0x34d6('0xf')](_0x5d9a48);});};exports['migrations']=function(_0x40e3ae,_0x24f8da){var _0x3a72ce=fs[_0x34d6('0x20')](path['join'](config[_0x34d6('0x7')],_0x34d6('0x21'),_0x34d6('0x22')));var _0x509636=[];for(var _0x2f6b3c=0x0;_0x2f6b3c<_0x3a72ce['length'];_0x2f6b3c++){var _0x3806bb=_0x3a72ce[_0x2f6b3c][_0x34d6('0x23')](_0x34d6('0x24'),'');if(compareVersions(module[_0x34d6('0x9')]['version'],_0x3806bb)===-0x1){_0x509636[_0x34d6('0x25')](_0x3806bb);}}if(_0x509636[_0x34d6('0x26')]){var _0x3f33e1=_0x509636[_0x34d6('0x27')](compareVersions);var _0x196937=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x34d6('0x28')],'modelName':_0x34d6('0x28'),'columnName':_0x34d6('0xa')},'migrations':{'params':[db[_0x34d6('0x29')][_0x34d6('0x2a')](),db[_0x34d6('0x29')]['constructor'],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[_0x34d6('0x2b')](config[_0x34d6('0x7')],_0x34d6('0x21'),'migrations'),'pattern':/\.js$/}});_0x196937['up']({'migrations':_[_0x34d6('0x2c')](_0x3f33e1,function(_0x33f612){return _0x33f612+_0x34d6('0x24');})})['then'](function(){return _0x24f8da[_0x34d6('0x16')](0xc8)[_0x34d6('0xf')]({'output':_0x34d6('0x2d')+module[_0x34d6('0x9')][_0x34d6('0xa')]+_0x34d6('0x2e')+_['last'](_0x3f33e1),'migrations':_[_0x34d6('0x2b')](_0x3f33e1)});})[_0x34d6('0x1f')](function(_0x4b88dc){if(_0x4b88dc instanceof db[_0x34d6('0x29')]['UniqueConstraintError']){return _0x24f8da[_0x34d6('0x16')](0xc8)[_0x34d6('0xf')]({'output':_0x34d6('0x2f')});}else{return _0x24f8da[_0x34d6('0x16')](0x1f4)['json'](_0x4b88dc);}});}else{return _0x24f8da[_0x34d6('0x16')](0xc8)[_0x34d6('0xf')]({'output':_0x34d6('0x2f')});}}; \ No newline at end of file +var _0xd9c7=['query','tags','latest','2.0.0','json','fetch','origin','master','error','status','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','root','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','map','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','compare-versions','child_process','exec','../../config/pm2','../../config/logger','simple-git','exports','version'];(function(_0x501794,_0x354578){var _0x24c091=function(_0x271062){while(--_0x271062){_0x501794['push'](_0x501794['shift']());}};_0x24c091(++_0x354578);}(_0xd9c7,0x8c));var _0x7d9c=function(_0x5c1607,_0x327eec){_0x5c1607=_0x5c1607-0x0;var _0x4d7395=_0xd9c7[_0x5c1607];return _0x4d7395;};'use strict';var Umzug=require(_0x7d9c('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x7d9c('0x1'))(module,'version');var compareVersions=require(_0x7d9c('0x2'));var exec=require(_0x7d9c('0x3'))[_0x7d9c('0x4')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x7d9c('0x5'));var logger=require(_0x7d9c('0x6'))('update');var git=require(_0x7d9c('0x7'))(config['root']);exports['index']=function(_0x33d579,_0x16fab8){var _0x9101f3={'current':module[_0x7d9c('0x8')][_0x7d9c('0x9')],'phonebar':0x2};if(_0x33d579[_0x7d9c('0xa')]&&_0x33d579['query']['latest']){return git['fetch']()[_0x7d9c('0xb')](function(_0x20b144,_0x2b8d47){_0x9101f3[_0x7d9c('0xc')]=(_0x20b144?module[_0x7d9c('0x8')][_0x7d9c('0x9')]:_0x2b8d47[_0x7d9c('0xc')])||_0x7d9c('0xd');return _0x16fab8['status'](0xc8)[_0x7d9c('0xe')](_0x9101f3);});}else{return _0x16fab8['status'](0xc8)['json'](_0x9101f3);}};exports[_0x7d9c('0xf')]=function(_0xd8647e,_0x5d5416){return git[_0x7d9c('0xf')]([_0x7d9c('0x10'),_0x7d9c('0x11')],function(_0x3d98ed){if(_0x3d98ed){logger[_0x7d9c('0x12')](_0x3d98ed);return _0x5d5416[_0x7d9c('0x13')](0x1f4)['json'](_0x3d98ed);}logger[_0x7d9c('0x14')](_0x7d9c('0x15'));return _0x5d5416[_0x7d9c('0x13')](0xc8)[_0x7d9c('0xe')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x7d9c('0x16')]=function(_0x1ce4f7,_0x2430a5){return git['reset']([_0x7d9c('0x17'),_0x7d9c('0x18')],function(_0x9a8e41){if(_0x9a8e41){logger[_0x7d9c('0x12')](_0x9a8e41);return _0x2430a5[_0x7d9c('0x13')](0x1f4)[_0x7d9c('0xe')](_0x9a8e41);}logger['info'](_0x7d9c('0x19'));return _0x2430a5[_0x7d9c('0x13')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x7d9c('0x1a')]=function(_0x45bfa1,_0x23d422){exec(_0x7d9c('0x1b'),function(_0x21fe85,_0x226e89,_0x365057){logger['info'](_0x226e89);logger[_0x7d9c('0x14')](_0x365057);if(_0x21fe85){logger[_0x7d9c('0x12')](_0x21fe85);return _0x23d422[_0x7d9c('0x13')](0x1f4)[_0x7d9c('0xe')](_0x21fe85);}return _0x23d422['status'](0xc8)['json']({'output':_0x226e89});});};exports['restart']=function(_0x1321c3,_0x18cfea){return pm2['restart'](_0x7d9c('0x1c'))[_0x7d9c('0x1d')](function(_0xc7c69d){logger['info'](_0x7d9c('0x1e'),_0xc7c69d);return _0x18cfea[_0x7d9c('0x13')](0xc8)[_0x7d9c('0xe')]({'output':_0x7d9c('0x1f')});})[_0x7d9c('0x20')](function(_0x59787b){logger[_0x7d9c('0x12')](_0x59787b);return _0x18cfea[_0x7d9c('0x13')](0x1f4)[_0x7d9c('0xe')](_0x59787b);});};exports[_0x7d9c('0x21')]=function(_0x494abc,_0xde38e5){var _0x4b3058=fs['readdirSync'](path[_0x7d9c('0x22')](config[_0x7d9c('0x23')],_0x7d9c('0x24'),_0x7d9c('0x21')));var _0xcf0bb9=[];for(var _0x33a683=0x0;_0x33a683<_0x4b3058[_0x7d9c('0x25')];_0x33a683++){var _0x42b498=_0x4b3058[_0x33a683][_0x7d9c('0x26')](_0x7d9c('0x27'),'');if(compareVersions(module['exports'][_0x7d9c('0x9')],_0x42b498)===-0x1){_0xcf0bb9[_0x7d9c('0x28')](_0x42b498);}}if(_0xcf0bb9['length']){var _0x20db00=_0xcf0bb9[_0x7d9c('0x29')](compareVersions);var _0x5415d0=new Umzug({'storage':_0x7d9c('0x2a'),'storageOptions':{'model':db[_0x7d9c('0x2b')],'modelName':_0x7d9c('0x2b'),'columnName':_0x7d9c('0x9')},'migrations':{'params':[db[_0x7d9c('0x2a')][_0x7d9c('0x2c')](),db[_0x7d9c('0x2a')][_0x7d9c('0x2d')],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[_0x7d9c('0x22')](config[_0x7d9c('0x23')],_0x7d9c('0x24'),_0x7d9c('0x21')),'pattern':/\.js$/}});_0x5415d0['up']({'migrations':_[_0x7d9c('0x2e')](_0x20db00,function(_0x30be37){return _0x30be37+_0x7d9c('0x27');})})[_0x7d9c('0x1d')](function(){return _0xde38e5[_0x7d9c('0x13')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x7d9c('0x8')][_0x7d9c('0x9')]+'\x20to\x20'+_[_0x7d9c('0x2f')](_0x20db00),'migrations':_['join'](_0x20db00)});})['catch'](function(_0x1fa66b){if(_0x1fa66b instanceof db[_0x7d9c('0x2a')][_0x7d9c('0x30')]){return _0xde38e5[_0x7d9c('0x13')](0xc8)[_0x7d9c('0xe')]({'output':_0x7d9c('0x31')});}else{return _0xde38e5[_0x7d9c('0x13')](0x1f4)[_0x7d9c('0xe')](_0x1fa66b);}});}else{return _0xde38e5['status'](0xc8)[_0x7d9c('0xe')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f24230f..9d767ba 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 _0xab4d=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','/:id','update','delete'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xab4d,0x141));var _0xdab4=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0xab4d[_0x52e363];return _0x3fc2b5;};'use strict';var multer=require(_0xdab4('0x0'));var util=require(_0xdab4('0x1'));var path=require(_0xdab4('0x2'));var timeout=require(_0xdab4('0x3'));var express=require(_0xdab4('0x4'));var router=express['Router']();var fs_extra=require(_0xdab4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdab4('0x6'));var config=require(_0xdab4('0x7'));var controller=require(_0xdab4('0x8'));router[_0xdab4('0x9')]('/',auth[_0xdab4('0xa')](),controller['index']);router[_0xdab4('0x9')](_0xdab4('0xb'),auth[_0xdab4('0xa')](),controller['describe']);router[_0xdab4('0x9')]('/:id',auth[_0xdab4('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xdab4('0xc'),auth['isAuthenticated'](),controller[_0xdab4('0xd')]);router[_0xdab4('0xe')](_0xdab4('0xc'),auth[_0xdab4('0xa')](),controller[_0xdab4('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6baa=['/:id','show','post','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','/describe','describe','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6baa,0x1e2));var _0xa6ba=function(_0x3f9b7f,_0x372fb8){_0x3f9b7f=_0x3f9b7f-0x0;var _0x30e40b=_0x6baa[_0x3f9b7f];return _0x30e40b;};'use strict';var multer=require(_0xa6ba('0x0'));var util=require(_0xa6ba('0x1'));var path=require(_0xa6ba('0x2'));var timeout=require('connect-timeout');var express=require(_0xa6ba('0x3'));var router=express[_0xa6ba('0x4')]();var fs_extra=require(_0xa6ba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa6ba('0x6'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0xa6ba('0x7')](),controller[_0xa6ba('0x8')]);router['get'](_0xa6ba('0x9'),auth[_0xa6ba('0x7')](),controller[_0xa6ba('0xa')]);router[_0xa6ba('0xb')](_0xa6ba('0xc'),auth[_0xa6ba('0x7')](),controller[_0xa6ba('0xd')]);router[_0xa6ba('0xe')]('/',auth[_0xa6ba('0x7')](),controller['create']);router['put'](_0xa6ba('0xc'),auth[_0xa6ba('0x7')](),controller[_0xa6ba('0xf')]);router[_0xa6ba('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa6ba('0x11')]);module[_0xa6ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 3cee8f7..8640b6e 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 _0x373d=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','INTEGER'];(function(_0x457c7f,_0x53e994){var _0x484a44=function(_0x1bea7b){while(--_0x1bea7b){_0x457c7f['push'](_0x457c7f['shift']());}};_0x484a44(++_0x53e994);}(_0x373d,0x1e2));var _0xd373=function(_0x1d52d3,_0x2a0df0){_0x1d52d3=_0x1d52d3-0x0;var _0x1ad74b=_0x373d[_0x1d52d3];return _0x1ad74b;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'type':{'type':Sequelize[_0xd373('0x1')]},'uniqueid':{'type':Sequelize[_0xd373('0x1')]},'calleridnum':{'type':Sequelize[_0xd373('0x1')]},'calleridname':{'type':Sequelize[_0xd373('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd373('0x1')]},'membername':{'type':Sequelize[_0xd373('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd373('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xd373('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd373('0x2')]},'holdtime':{'type':Sequelize[_0xd373('0x3')]},'agentcomplete':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd373('0x1')]},'lastevent':{'type':Sequelize[_0xd373('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd373('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd373('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd373('0x1')]},'accountcode':{'type':Sequelize[_0xd373('0x1')]},'context':{'type':Sequelize[_0xd373('0x1')]},'exten':{'type':Sequelize[_0xd373('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd373('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd373('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd373('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd373('0x1')]},'destlanguage':{'type':Sequelize[_0xd373('0x1')]},'destaccountcode':{'type':Sequelize[_0xd373('0x1')]},'destcontext':{'type':Sequelize[_0xd373('0x1')]},'destexten':{'type':Sequelize[_0xd373('0x1')]},'destpriority':{'type':Sequelize[_0xd373('0x1')]},'destuniqueid':{'type':Sequelize[_0xd373('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd373('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd373('0x1')]},'transfer':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd373('0x1')],'comment':_0xd373('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd373('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x56bd=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x15f972,_0x4a1fc7){var _0x3d916e=function(_0x4efd86){while(--_0x4efd86){_0x15f972['push'](_0x15f972['shift']());}};_0x3d916e(++_0x4a1fc7);}(_0x56bd,0xe9));var _0xd56b=function(_0xbbacc3,_0x142b8c){_0xbbacc3=_0xbbacc3-0x0;var _0x3dac11=_0x56bd[_0xbbacc3];return _0x3dac11;};'use strict';var Sequelize=require('sequelize');module[_0xd56b('0x0')]={'type':{'type':Sequelize[_0xd56b('0x1')]},'uniqueid':{'type':Sequelize[_0xd56b('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd56b('0x1')]},'queue':{'type':Sequelize[_0xd56b('0x1')]},'interface':{'type':Sequelize[_0xd56b('0x1')]},'membername':{'type':Sequelize[_0xd56b('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd56b('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xd56b('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd56b('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd56b('0x2')]},'holdtime':{'type':Sequelize[_0xd56b('0x3')]},'agentcomplete':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd56b('0x3')]},'agentacw':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd56b('0x3')]},'reason':{'type':Sequelize[_0xd56b('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd56b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd56b('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd56b('0x1')]},'language':{'type':Sequelize[_0xd56b('0x1')]},'accountcode':{'type':Sequelize[_0xd56b('0x1')]},'context':{'type':Sequelize[_0xd56b('0x1')]},'exten':{'type':Sequelize[_0xd56b('0x1')]},'priority':{'type':Sequelize[_0xd56b('0x1')]},'destchannel':{'type':Sequelize[_0xd56b('0x1')]},'destchannelstate':{'type':Sequelize[_0xd56b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd56b('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd56b('0x1')]},'destcalleridname':{'type':Sequelize[_0xd56b('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd56b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd56b('0x1')]},'destlanguage':{'type':Sequelize[_0xd56b('0x1')]},'destaccountcode':{'type':Sequelize[_0xd56b('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd56b('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd56b('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd56b('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd56b('0x1')]},'transfer':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd56b('0x1')],'comment':_0xd56b('0x5')},'transferexten':{'type':Sequelize[_0xd56b('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd56b('0x1')]},'agententerreason':{'type':Sequelize[_0xd56b('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 74ac980..e2c7556 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(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 7ede448..f08df65 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 _0x9d92=['report_agent','destuniqueid','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x589925,_0x31fe89){var _0x39ccdd=function(_0x4760fd){while(--_0x4760fd){_0x589925['push'](_0x589925['shift']());}};_0x39ccdd(++_0x31fe89);}(_0x9d92,0xdf));var _0x29d9=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0x9d92[_0x5e3a45];return _0x13419f;};'use strict';var _=require(_0x29d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x29d9('0x1'));var moment=require(_0x29d9('0x2'));var BPromise=require('bluebird');var rp=require(_0x29d9('0x3'));var fs=require('fs');var path=require(_0x29d9('0x4'));var rimraf=require(_0x29d9('0x5'));var config=require(_0x29d9('0x6'));var attributes=require(_0x29d9('0x7'));module[_0x29d9('0x8')]=function(_0x27d032,_0x52932b){return _0x27d032[_0x29d9('0x9')](_0x29d9('0xa'),attributes,{'tableName':_0x29d9('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x29d9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee14=['./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x40d5c8,_0x411c6e){var _0x5f294f=function(_0x573d2b){while(--_0x573d2b){_0x40d5c8['push'](_0x40d5c8['shift']());}};_0x5f294f(++_0x411c6e);}(_0xee14,0x13a));var _0x4ee1=function(_0x39c91a,_0x40f047){_0x39c91a=_0x39c91a-0x0;var _0x602801=_0xee14[_0x39c91a];return _0x602801;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));module['exports']=function(_0xba6d36,_0x573700){return _0xba6d36[_0x4ee1('0x9')](_0x4ee1('0xa'),attributes,{'tableName':_0x4ee1('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4ee1('0xc'),_0x4ee1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e22c5d2..8578b0d 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 _0x677f=['util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','then','debug','UpdateVoiceAgentReport','update','where','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x677f,0x1db));var _0xf677=function(_0x4514be,_0x291dd7){_0x4514be=_0x4514be-0x0;var _0x12931e=_0x677f[_0x4514be];return _0x12931e;};'use strict';var _=require(_0xf677('0x0'));var util=require(_0xf677('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf677('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf677('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf677('0x4'))(_0xf677('0x5'));var config=require(_0xf677('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x380a22,_0x537f58,_0x2955c4){return new BPromise(function(_0xd7fb2,_0x5578d2){return client[_0xf677('0x7')](_0x380a22,_0x2955c4)['then'](function(_0x465205){logger[_0xf677('0x8')](_0xf677('0x9'),_0x537f58,_0xf677('0xa'));logger['debug'](_0xf677('0xb'),_0x537f58,_0xf677('0xa'),JSON[_0xf677('0xc')](_0x465205));if(_0x465205[_0xf677('0xd')]){if(_0x465205[_0xf677('0xd')][_0xf677('0xe')]===0x1f4){logger[_0xf677('0xd')](_0xf677('0x9'),_0x537f58,_0x465205[_0xf677('0xd')]['message']);return _0x5578d2(_0x465205[_0xf677('0xd')]['message']);}logger['error'](_0xf677('0x9'),_0x537f58,_0x465205[_0xf677('0xd')][_0xf677('0xf')]);return _0xd7fb2(_0x465205[_0xf677('0xd')][_0xf677('0xf')]);}else{logger[_0xf677('0x8')](_0xf677('0x9'),_0x537f58,_0xf677('0xa'));_0xd7fb2(_0x465205[_0xf677('0x10')][_0xf677('0xf')]);}})[_0xf677('0x11')](function(_0x133ed5){logger['error'](_0xf677('0x9'),_0x537f58,_0x133ed5);_0x5578d2(_0x133ed5);});});}exports[_0xf677('0x12')]=function(_0x1947f6){var _0x4a70c5=this;return new Promise(function(_0x50e82b,_0x1a2eb5){return db[_0xf677('0x13')]['create'](_0x1947f6[_0xf677('0x14')],{'raw':_0x1947f6[_0xf677('0x15')]?_0x1947f6['options'][_0xf677('0x16')]===undefined?!![]:![]:!![]})[_0xf677('0x17')](function(_0x4a4c7f){logger[_0xf677('0x8')]('CreateVoiceAgentReport',_0x1947f6);logger[_0xf677('0x18')](_0xf677('0x12'),_0x1947f6,JSON[_0xf677('0xc')](_0x4a4c7f));_0x50e82b(_0x4a4c7f);})[_0xf677('0x11')](function(_0x57239d){logger[_0xf677('0xd')](_0xf677('0x12'),_0x57239d['message'],_0x1947f6);_0x1a2eb5(_0x4a70c5[_0xf677('0xd')](0x1f4,_0x57239d[_0xf677('0xf')]));});});};exports[_0xf677('0x19')]=function(_0x5e439f){var _0x43921c=this;return new Promise(function(_0x2e7d35,_0x4c7ab4){return db[_0xf677('0x13')][_0xf677('0x1a')](_0x5e439f[_0xf677('0x14')],{'raw':_0x5e439f['options']?_0x5e439f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e439f[_0xf677('0x15')]?_0x5e439f[_0xf677('0x15')][_0xf677('0x1b')]||null:null,'attributes':_0x5e439f['options']?_0x5e439f[_0xf677('0x15')]['attributes']||null:null,'limit':_0x5e439f[_0xf677('0x15')]?_0x5e439f[_0xf677('0x15')]['limit']||null:null})['then'](function(_0xab2f54){logger[_0xf677('0x8')]('UpdateVoiceAgentReport',_0x5e439f);logger[_0xf677('0x18')]('UpdateVoiceAgentReport',_0x5e439f,JSON[_0xf677('0xc')](_0xab2f54));_0x2e7d35(_0xab2f54);})[_0xf677('0x11')](function(_0x668964){logger[_0xf677('0xd')](_0xf677('0x19'),_0x668964[_0xf677('0xf')],_0x5e439f);_0x4c7ab4(_0x43921c[_0xf677('0xd')](0x1f4,_0x668964['message']));});});}; \ No newline at end of file +var _0x226c=['VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','debug','UpdateVoiceAgentReport','update','body','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x226c,0x1db));var _0xc226=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x226c[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xc226('0x0'));var moment=require(_0xc226('0x1'));var BPromise=require(_0xc226('0x2'));var rs=require(_0xc226('0x3'));var fs=require('fs');var Redis=require(_0xc226('0x4'));var db=require(_0xc226('0x5'))['db'];var utils=require(_0xc226('0x6'));var logger=require(_0xc226('0x7'))('rpc');var config=require(_0xc226('0x8'));var jayson=require(_0xc226('0x9'));var client=jayson[_0xc226('0xa')][_0xc226('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4eee3c,_0x71c1f2,_0x1b5e71){return new BPromise(function(_0x15b73e,_0x5b2edd){return client[_0xc226('0xc')](_0x4eee3c,_0x1b5e71)[_0xc226('0xd')](function(_0xd21409){logger[_0xc226('0xe')](_0xc226('0xf'),_0x71c1f2,'request\x20sent');logger['debug'](_0xc226('0x10'),_0x71c1f2,_0xc226('0x11'),JSON[_0xc226('0x12')](_0xd21409));if(_0xd21409[_0xc226('0x13')]){if(_0xd21409[_0xc226('0x13')]['code']===0x1f4){logger[_0xc226('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x71c1f2,_0xd21409[_0xc226('0x13')][_0xc226('0x14')]);return _0x5b2edd(_0xd21409[_0xc226('0x13')][_0xc226('0x14')]);}logger[_0xc226('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x71c1f2,_0xd21409[_0xc226('0x13')][_0xc226('0x14')]);return _0x15b73e(_0xd21409[_0xc226('0x13')][_0xc226('0x14')]);}else{logger['info'](_0xc226('0xf'),_0x71c1f2,_0xc226('0x11'));_0x15b73e(_0xd21409[_0xc226('0x15')]['message']);}})[_0xc226('0x16')](function(_0x176fea){logger[_0xc226('0x13')](_0xc226('0xf'),_0x71c1f2,_0x176fea);_0x5b2edd(_0x176fea);});});}exports[_0xc226('0x17')]=function(_0x255fa2){var _0x4db6d7=this;return new Promise(function(_0x2afb73,_0x5a908){return db[_0xc226('0x18')][_0xc226('0x19')](_0x255fa2['body'],{'raw':_0x255fa2['options']?_0x255fa2[_0xc226('0x1a')][_0xc226('0x1b')]===undefined?!![]:![]:!![]})[_0xc226('0xd')](function(_0x228cdb){logger[_0xc226('0xe')](_0xc226('0x17'),_0x255fa2);logger[_0xc226('0x1c')](_0xc226('0x17'),_0x255fa2,JSON[_0xc226('0x12')](_0x228cdb));_0x2afb73(_0x228cdb);})['catch'](function(_0x210483){logger[_0xc226('0x13')]('CreateVoiceAgentReport',_0x210483[_0xc226('0x14')],_0x255fa2);_0x5a908(_0x4db6d7[_0xc226('0x13')](0x1f4,_0x210483[_0xc226('0x14')]));});});};exports[_0xc226('0x1d')]=function(_0x59776b){var _0x26794a=this;return new Promise(function(_0x920e7b,_0x209459){return db['VoiceAgentReport'][_0xc226('0x1e')](_0x59776b[_0xc226('0x1f')],{'raw':_0x59776b[_0xc226('0x1a')]?_0x59776b[_0xc226('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59776b[_0xc226('0x1a')]?_0x59776b[_0xc226('0x1a')][_0xc226('0x20')]||null:null,'attributes':_0x59776b['options']?_0x59776b['options'][_0xc226('0x21')]||null:null,'limit':_0x59776b[_0xc226('0x1a')]?_0x59776b[_0xc226('0x1a')][_0xc226('0x22')]||null:null})[_0xc226('0xd')](function(_0x205f8c){logger[_0xc226('0xe')](_0xc226('0x1d'),_0x59776b);logger['debug'](_0xc226('0x1d'),_0x59776b,JSON[_0xc226('0x12')](_0x205f8c));_0x920e7b(_0x205f8c);})[_0xc226('0x16')](function(_0x3de222){logger[_0xc226('0x13')]('UpdateVoiceAgentReport',_0x3de222[_0xc226('0x14')],_0x59776b);_0x209459(_0x26794a[_0xc226('0x13')](0x1f4,_0x3de222[_0xc226('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index acce63e..8e77e4d 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 _0xd493=['Router','../../components/auth/service','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','post','create','put','/:id','update','/with-retry/:id','updateWithRetry','destroy','exports','express'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd493,0xa1));var _0x3d49=function(_0x90ee71,_0x434b2b){_0x90ee71=_0x90ee71-0x0;var _0x1e602e=_0xd493[_0x90ee71];return _0x1e602e;};'use strict';var express=require(_0x3d49('0x0'));var router=express[_0x3d49('0x1')]();var auth=require(_0x3d49('0x2'));var controller=require(_0x3d49('0x3'));router['get']('/',auth[_0x3d49('0x4')](),controller[_0x3d49('0x5')]);router[_0x3d49('0x6')](_0x3d49('0x7'),auth[_0x3d49('0x4')](),controller[_0x3d49('0x8')]);router['get']('/:id',auth[_0x3d49('0x4')](),controller['show']);router[_0x3d49('0x9')]('/',auth[_0x3d49('0x4')](),controller[_0x3d49('0xa')]);router[_0x3d49('0xb')](_0x3d49('0xc'),auth[_0x3d49('0x4')](),controller[_0x3d49('0xd')]);router[_0x3d49('0xb')](_0x3d49('0xe'),auth['isAuthenticated'](),controller[_0x3d49('0xf')]);router['delete'](_0x3d49('0xc'),auth[_0x3d49('0x4')](),controller[_0x3d49('0x10')]);module[_0x3d49('0x11')]=router; \ No newline at end of file +var _0x2b26=['put','update','updateWithRetry','delete','destroy','exports','Router','../../components/auth/service','./voiceCallReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x1a4ca1,_0x30ce5d){var _0x36be94=function(_0x9f6131){while(--_0x9f6131){_0x1a4ca1['push'](_0x1a4ca1['shift']());}};_0x36be94(++_0x30ce5d);}(_0x2b26,0xd2));var _0x62b2=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x2b26[_0x199572];return _0x13cfa3;};'use strict';var express=require('express');var router=express[_0x62b2('0x0')]();var auth=require(_0x62b2('0x1'));var controller=require(_0x62b2('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x62b2('0x3')]);router[_0x62b2('0x4')](_0x62b2('0x5'),auth[_0x62b2('0x6')](),controller[_0x62b2('0x7')]);router[_0x62b2('0x4')](_0x62b2('0x8'),auth[_0x62b2('0x6')](),controller[_0x62b2('0x9')]);router[_0x62b2('0xa')]('/',auth[_0x62b2('0x6')](),controller['create']);router[_0x62b2('0xb')](_0x62b2('0x8'),auth[_0x62b2('0x6')](),controller[_0x62b2('0xc')]);router['put']('/with-retry/:id',auth[_0x62b2('0x6')](),controller[_0x62b2('0xd')]);router[_0x62b2('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x62b2('0xf')]);module[_0x62b2('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index ef45a72..7572c0a 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 _0xde44=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','internal','outbound','inbound-fax','outbound-fax'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0xde44,0x160));var _0x4de4=function(_0x543eb8,_0x9d0495){_0x543eb8=_0x543eb8-0x0;var _0x187a2e=_0xde44[_0x543eb8];return _0x187a2e;};'use strict';var Sequelize=require(_0x4de4('0x0'));module[_0x4de4('0x1')]={'uniqueid':{'type':Sequelize[_0x4de4('0x2')]},'type':{'type':Sequelize[_0x4de4('0x3')]('inbound',_0x4de4('0x4'),_0x4de4('0x5'),_0x4de4('0x6'),_0x4de4('0x7'),_0x4de4('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4de4('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x4de4('0x2')]},'destinationcontext':{'type':Sequelize[_0x4de4('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x4de4('0x2')]},'lastapplication':{'type':Sequelize[_0x4de4('0x2')]},'lastdata':{'type':Sequelize[_0x4de4('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x4de4('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4de4('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4de4('0xb')]},'mohtime':{'type':Sequelize[_0x4de4('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x4de4('0x2')]},'userfield':{'type':Sequelize[_0x4de4('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x4de4('0x2')]},'note':{'type':Sequelize[_0x4de4('0x2')]},'prefix':{'type':Sequelize[_0x4de4('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x4de4('0x2')]}}; \ No newline at end of file +var _0x97a6=['STRING','ENUM','inbound','internal','outbound','inbound-fax','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0x97a6,0x15e));var _0x697a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97a6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x697a('0x0'));module[_0x697a('0x1')]={'uniqueid':{'type':Sequelize[_0x697a('0x2')]},'type':{'type':Sequelize[_0x697a('0x3')](_0x697a('0x4'),_0x697a('0x5'),_0x697a('0x6'),_0x697a('0x7'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x697a('0x2')]},'accountcode':{'type':Sequelize[_0x697a('0x2')]},'source':{'type':Sequelize[_0x697a('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x697a('0x2')]},'destinationchannel':{'type':Sequelize[_0x697a('0x2')]},'lastapplication':{'type':Sequelize[_0x697a('0x2')]},'lastdata':{'type':Sequelize[_0x697a('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x697a('0x9')]},'answertime':{'type':Sequelize[_0x697a('0x9')]},'endtime':{'type':Sequelize[_0x697a('0x9')]},'duration':{'type':Sequelize[_0x697a('0xa')]},'billableseconds':{'type':Sequelize[_0x697a('0xa')]},'mohtime':{'type':Sequelize[_0x697a('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x697a('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x697a('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x697a('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x697a('0xa')]},'sipcallid':{'type':Sequelize[_0x697a('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2ec369f..88606c9 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 _0x73a1=['fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','name','fullname','alias','User','findAll','catch','show','params','find','create','describe','update','body','uniqueid','updateWithRetry','No\x20such\x20report','../../config/logger','api','promise-retry','status','offset','undefined','limit','count','set','json','then','destroy','end','sendStatus','error','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes'];(function(_0x33bf2f,_0x25ba1f){var _0x1ff548=function(_0x3a40e6){while(--_0x3a40e6){_0x33bf2f['push'](_0x33bf2f['shift']());}};_0x1ff548(++_0x25ba1f);}(_0x73a1,0x161));var _0x173a=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0x73a1[_0x337748];return _0x3bb03f;};'use strict';var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x173a('0x0'))(_0x173a('0x1'));var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x173a('0x2'));function respondWithResult(_0x279349,_0xeec920){_0xeec920=_0xeec920||0xc8;return function(_0xf2a2c8){if(_0xf2a2c8){return _0x279349[_0x173a('0x3')](_0xeec920)['json'](_0xf2a2c8);}};}function respondWithFilteredResult(_0x417ec0,_0x1a8b94){return function(_0xac84a){if(_0xac84a){var _0xbd8757=typeof _0x1a8b94[_0x173a('0x4')]===_0x173a('0x5')&&typeof _0x1a8b94[_0x173a('0x6')]===_0x173a('0x5');var _0x3f06d5=_0xac84a[_0x173a('0x7')];var _0x30ffef=_0xbd8757?0x0:_0x1a8b94[_0x173a('0x4')];var _0x4d6b80=_0xbd8757?_0xac84a[_0x173a('0x7')]:_0x1a8b94['offset']+_0x1a8b94[_0x173a('0x6')];var _0x101aeb;if(_0x4d6b80>=_0x3f06d5){_0x4d6b80=_0x3f06d5;_0x101aeb=0xc8;}else{_0x101aeb=0xce;}_0x417ec0[_0x173a('0x3')](_0x101aeb);return _0x417ec0[_0x173a('0x8')]('Content-Range',_0x30ffef+'-'+_0x4d6b80+'/'+_0x3f06d5)[_0x173a('0x9')](_0xac84a);}return null;};}function saveUpdates(_0x53bfd0){return function(_0x28b560){if(_0x28b560){return _0x28b560['update'](_0x53bfd0)[_0x173a('0xa')](function(_0x21534e){return _0x21534e;});}return null;};}function removeEntity(_0x578f77){return function(_0x1cbfdc){if(_0x1cbfdc){return _0x1cbfdc[_0x173a('0xb')]()[_0x173a('0xa')](function(){_0x578f77[_0x173a('0x3')](0xcc)[_0x173a('0xc')]();});}};}function handleEntityNotFound(_0x410dfc){return function(_0x69fe68){if(!_0x69fe68){_0x410dfc[_0x173a('0xd')](0x194);}return _0x69fe68;};}function handleError(_0x5e4252,_0xb8e6b){_0xb8e6b=_0xb8e6b||0x1f4;return function(_0x3bcc3a){logger[_0x173a('0xe')](_0x3bcc3a['stack']);if(_0x3bcc3a['name']){delete _0x3bcc3a['name'];}_0x5e4252[_0x173a('0x3')](_0xb8e6b)['send'](_0x3bcc3a);};}exports['index']=function(_0xd84224,_0x2d3b17){var _0x54985d={},_0x2d1a42={},_0x3d6897={'count':0x0,'rows':[]};var _0x44eec5=_[_0x173a('0xf')](db[_0x173a('0x10')][_0x173a('0x11')],function(_0x47b362){return{'name':_0x47b362[_0x173a('0x12')],'type':_0x47b362[_0x173a('0x13')]['key']};});_0x2d1a42[_0x173a('0x14')]=_['map'](_0x44eec5,'name');_0x2d1a42[_0x173a('0x15')]=_[_0x173a('0x16')](_0xd84224[_0x173a('0x15')]);_0x2d1a42['filters']=_[_0x173a('0x17')](_0x2d1a42[_0x173a('0x14')],_0x2d1a42[_0x173a('0x15')]);_0x54985d[_0x173a('0x18')]=_[_0x173a('0x17')](_0x2d1a42[_0x173a('0x14')],qs['fields'](_0xd84224['query'][_0x173a('0x19')]));_0x54985d[_0x173a('0x18')]=_0x54985d[_0x173a('0x18')][_0x173a('0x1a')]?_0x54985d[_0x173a('0x18')]:_0x2d1a42[_0x173a('0x14')];if(!_0xd84224['query'][_0x173a('0x1b')](_0x173a('0x1c'))){_0x54985d[_0x173a('0x6')]=qs[_0x173a('0x6')](_0xd84224[_0x173a('0x15')][_0x173a('0x6')]);_0x54985d[_0x173a('0x4')]=qs[_0x173a('0x4')](_0xd84224[_0x173a('0x15')][_0x173a('0x4')]);}_0x54985d['order']=qs['sort'](_0xd84224['query'][_0x173a('0x1d')]);_0x54985d[_0x173a('0x1e')]=qs[_0x173a('0x1f')](_[_0x173a('0x20')](_0xd84224[_0x173a('0x15')],_0x2d1a42['filters']),_0x44eec5);if(_0xd84224[_0x173a('0x15')][_0x173a('0x21')]){_0x54985d['where']=_[_0x173a('0x22')](_0x54985d[_0x173a('0x1e')],{'$or':_[_0x173a('0xf')](_0x44eec5,function(_0x546e80){if(_0x546e80[_0x173a('0x13')]!=='VIRTUAL'){var _0xdab384={};_0xdab384[_0x546e80['name']]={'$like':'%'+_0xd84224['query'][_0x173a('0x21')]+'%'};return _0xdab384;}})});}_0x54985d=_[_0x173a('0x22')]({},_0x54985d,_0xd84224[_0x173a('0x23')]);var _0x41c181={'where':_0x54985d['where']};return db[_0x173a('0x10')][_0x173a('0x7')](_0x41c181)['then'](function(_0xe2a0a1){_0x3d6897['count']=_0xe2a0a1;if(_0xd84224[_0x173a('0x15')][_0x173a('0x24')]){_0x54985d[_0x173a('0x25')]=[{'attributes':['id',_0x173a('0x26'),_0x173a('0x27'),_0x173a('0x28')],'model':db[_0x173a('0x29')],'as':'User'}];}return db[_0x173a('0x10')][_0x173a('0x2a')](_0x54985d);})[_0x173a('0xa')](function(_0x5c1a69){_0x3d6897['rows']=_0x5c1a69;return _0x3d6897;})[_0x173a('0xa')](respondWithFilteredResult(_0x2d3b17,_0x54985d))[_0x173a('0x2b')](handleError(_0x2d3b17,null));};exports[_0x173a('0x2c')]=function(_0x4e4a02,_0x1a87c7){var _0x3d7c8c={'raw':!![],'where':{'id':_0x4e4a02[_0x173a('0x2d')]['id']}},_0x141d3f={};_0x141d3f['model']=_['keys'](db[_0x173a('0x10')][_0x173a('0x11')]);_0x141d3f[_0x173a('0x15')]=_[_0x173a('0x16')](_0x4e4a02[_0x173a('0x15')]);_0x141d3f[_0x173a('0x1f')]=_[_0x173a('0x17')](_0x141d3f[_0x173a('0x14')],_0x141d3f['query']);_0x3d7c8c[_0x173a('0x18')]=_[_0x173a('0x17')](_0x141d3f[_0x173a('0x14')],qs[_0x173a('0x19')](_0x4e4a02[_0x173a('0x15')][_0x173a('0x19')]));_0x3d7c8c[_0x173a('0x18')]=_0x3d7c8c[_0x173a('0x18')][_0x173a('0x1a')]?_0x3d7c8c[_0x173a('0x18')]:_0x141d3f[_0x173a('0x14')];if(_0x4e4a02[_0x173a('0x15')][_0x173a('0x24')]){_0x3d7c8c[_0x173a('0x25')]=[{'all':!![]}];}_0x3d7c8c=_['merge']({},_0x3d7c8c,_0x4e4a02[_0x173a('0x23')]);return db['VoiceCallReport'][_0x173a('0x2e')](_0x3d7c8c)[_0x173a('0xa')](handleEntityNotFound(_0x1a87c7,null))['then'](respondWithResult(_0x1a87c7,null))['catch'](handleError(_0x1a87c7,null));};exports[_0x173a('0x2f')]=function(_0x524420,_0x1c036f){return db[_0x173a('0x10')][_0x173a('0x2f')](_0x524420['body'],{})[_0x173a('0xa')](respondWithResult(_0x1c036f,0xc9))[_0x173a('0x2b')](handleError(_0x1c036f,null));};exports[_0x173a('0xb')]=function(_0x55649b,_0x21ffa5){return db[_0x173a('0x10')][_0x173a('0x2e')]({'where':{'id':_0x55649b['params']['id']}})[_0x173a('0xa')](handleEntityNotFound(_0x21ffa5,null))[_0x173a('0xa')](removeEntity(_0x21ffa5,null))['catch'](handleError(_0x21ffa5,null));};exports[_0x173a('0x30')]=function(_0x2d5a8c,_0x577778){return db[_0x173a('0x10')]['describe']()[_0x173a('0xa')](respondWithResult(_0x577778,null))['catch'](handleError(_0x577778,null));};function findForUpdate(_0x626942){return db[_0x173a('0x10')][_0x173a('0x2e')]({'where':{'uniqueid':_0x626942[_0x173a('0x2d')]['id'],'UserId':{'$or':[null,_0x626942['user']['id']]}}});}exports[_0x173a('0x31')]=function(_0xbda804,_0x1958b8){if(_0xbda804[_0x173a('0x32')][_0x173a('0x33')]){delete _0xbda804[_0x173a('0x32')][_0x173a('0x33')];}return findForUpdate(_0xbda804)['then'](handleEntityNotFound(_0x1958b8,null))[_0x173a('0xa')](saveUpdates(_0xbda804['body'],null))[_0x173a('0xa')](respondWithResult(_0x1958b8,null))[_0x173a('0x2b')](handleError(_0x1958b8,null));};exports[_0x173a('0x34')]=function(_0x43969f,_0x49dd52,_0x57de6a){if(_0x43969f[_0x173a('0x32')][_0x173a('0x33')]){delete _0x43969f[_0x173a('0x32')][_0x173a('0x33')];}promiseRetry(function(_0x299bd7){return findForUpdate(_0x43969f)[_0x173a('0xa')](function(_0x2e6d04){if(_0x2e6d04!==null){return _0x2e6d04;}else{_0x299bd7(new Error(_0x173a('0x35')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x173a('0xa')](function(_0x3b19b1){if(!_0x3b19b1){return new Promise(function(_0x8ed463){_0x8ed463(handleEntityNotFound(_0x49dd52)());});}else{return _0x3b19b1[_0x173a('0x31')](_0x43969f[_0x173a('0x32')])['then'](function(_0x4f9d5c){return respondWithResult(_0x49dd52)(_0x4f9d5c);});}},function(){handleEntityNotFound(_0x49dd52)();});}; \ No newline at end of file +var _0x14a0=['where','filters','filter','merge','VIRTUAL','options','includeAll','include','fullname','alias','User','VoiceCallReport','findAll','catch','show','params','keys','length','find','create','describe','user','uniqueid','body','updateWithRetry','No\x20such\x20report','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','json','offset','undefined','limit','count','status','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','sort'];(function(_0x2e3d14,_0x30889a){var _0x4e1acf=function(_0x179548){while(--_0x179548){_0x2e3d14['push'](_0x2e3d14['shift']());}};_0x4e1acf(++_0x30889a);}(_0x14a0,0x8e));var _0x014a=function(_0x20e0d9,_0x157105){_0x20e0d9=_0x20e0d9-0x0;var _0x2a39b3=_0x14a0[_0x20e0d9];return _0x2a39b3;};'use strict';var _=require('lodash');var qs=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var db=require(_0x014a('0x3'))['db'];const promiseRetry=require(_0x014a('0x4'));function respondWithResult(_0xd5cdc6,_0xb2d36a){_0xb2d36a=_0xb2d36a||0xc8;return function(_0x521a59){if(_0x521a59){return _0xd5cdc6['status'](_0xb2d36a)[_0x014a('0x5')](_0x521a59);}};}function respondWithFilteredResult(_0x12e8da,_0x38a22c){return function(_0x5ec84d){if(_0x5ec84d){var _0x5a61ac=typeof _0x38a22c[_0x014a('0x6')]===_0x014a('0x7')&&typeof _0x38a22c[_0x014a('0x8')]==='undefined';var _0x5d3d7f=_0x5ec84d[_0x014a('0x9')];var _0x4f5506=_0x5a61ac?0x0:_0x38a22c['offset'];var _0x5aa52f=_0x5a61ac?_0x5ec84d['count']:_0x38a22c[_0x014a('0x6')]+_0x38a22c['limit'];var _0x431be8;if(_0x5aa52f>=_0x5d3d7f){_0x5aa52f=_0x5d3d7f;_0x431be8=0xc8;}else{_0x431be8=0xce;}_0x12e8da[_0x014a('0xa')](_0x431be8);return _0x12e8da['set'](_0x014a('0xb'),_0x4f5506+'-'+_0x5aa52f+'/'+_0x5d3d7f)[_0x014a('0x5')](_0x5ec84d);}return null;};}function saveUpdates(_0x2c84ad){return function(_0x43bfeb){if(_0x43bfeb){return _0x43bfeb[_0x014a('0xc')](_0x2c84ad)[_0x014a('0xd')](function(_0x200ab8){return _0x200ab8;});}return null;};}function removeEntity(_0x23c917){return function(_0x1e5366){if(_0x1e5366){return _0x1e5366[_0x014a('0xe')]()[_0x014a('0xd')](function(){_0x23c917[_0x014a('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x130d13){return function(_0x3cf92f){if(!_0x3cf92f){_0x130d13['sendStatus'](0x194);}return _0x3cf92f;};}function handleError(_0x3a836f,_0x128c46){_0x128c46=_0x128c46||0x1f4;return function(_0x59a4ea){logger[_0x014a('0xf')](_0x59a4ea[_0x014a('0x10')]);if(_0x59a4ea[_0x014a('0x11')]){delete _0x59a4ea[_0x014a('0x11')];}_0x3a836f[_0x014a('0xa')](_0x128c46)[_0x014a('0x12')](_0x59a4ea);};}exports[_0x014a('0x13')]=function(_0x263b07,_0x16490a){var _0x3b9341={},_0x281224={},_0x89e132={'count':0x0,'rows':[]};var _0x2a41f2=_[_0x014a('0x14')](db['VoiceCallReport'][_0x014a('0x15')],function(_0x109a9c){return{'name':_0x109a9c[_0x014a('0x16')],'type':_0x109a9c[_0x014a('0x17')][_0x014a('0x18')]};});_0x281224[_0x014a('0x19')]=_[_0x014a('0x14')](_0x2a41f2,_0x014a('0x11'));_0x281224[_0x014a('0x1a')]=_['keys'](_0x263b07[_0x014a('0x1a')]);_0x281224['filters']=_[_0x014a('0x1b')](_0x281224[_0x014a('0x19')],_0x281224[_0x014a('0x1a')]);_0x3b9341[_0x014a('0x1c')]=_[_0x014a('0x1b')](_0x281224[_0x014a('0x19')],qs[_0x014a('0x1d')](_0x263b07[_0x014a('0x1a')][_0x014a('0x1d')]));_0x3b9341['attributes']=_0x3b9341[_0x014a('0x1c')]['length']?_0x3b9341[_0x014a('0x1c')]:_0x281224[_0x014a('0x19')];if(!_0x263b07['query']['hasOwnProperty'](_0x014a('0x1e'))){_0x3b9341[_0x014a('0x8')]=qs[_0x014a('0x8')](_0x263b07['query'][_0x014a('0x8')]);_0x3b9341[_0x014a('0x6')]=qs['offset'](_0x263b07[_0x014a('0x1a')][_0x014a('0x6')]);}_0x3b9341['order']=qs['sort'](_0x263b07[_0x014a('0x1a')][_0x014a('0x1f')]);_0x3b9341[_0x014a('0x20')]=qs[_0x014a('0x21')](_['pick'](_0x263b07[_0x014a('0x1a')],_0x281224[_0x014a('0x21')]),_0x2a41f2);if(_0x263b07[_0x014a('0x1a')][_0x014a('0x22')]){_0x3b9341[_0x014a('0x20')]=_[_0x014a('0x23')](_0x3b9341[_0x014a('0x20')],{'$or':_[_0x014a('0x14')](_0x2a41f2,function(_0xc802d5){if(_0xc802d5[_0x014a('0x17')]!==_0x014a('0x24')){var _0x4ed54e={};_0x4ed54e[_0xc802d5[_0x014a('0x11')]]={'$like':'%'+_0x263b07[_0x014a('0x1a')][_0x014a('0x22')]+'%'};return _0x4ed54e;}})});}_0x3b9341=_[_0x014a('0x23')]({},_0x3b9341,_0x263b07[_0x014a('0x25')]);var _0x39b3b8={'where':_0x3b9341[_0x014a('0x20')]};return db['VoiceCallReport'][_0x014a('0x9')](_0x39b3b8)[_0x014a('0xd')](function(_0x5610cb){_0x89e132[_0x014a('0x9')]=_0x5610cb;if(_0x263b07[_0x014a('0x1a')][_0x014a('0x26')]){_0x3b9341[_0x014a('0x27')]=[{'attributes':['id',_0x014a('0x11'),_0x014a('0x28'),_0x014a('0x29')],'model':db[_0x014a('0x2a')],'as':'User'}];}return db[_0x014a('0x2b')][_0x014a('0x2c')](_0x3b9341);})[_0x014a('0xd')](function(_0x1f31c8){_0x89e132['rows']=_0x1f31c8;return _0x89e132;})[_0x014a('0xd')](respondWithFilteredResult(_0x16490a,_0x3b9341))[_0x014a('0x2d')](handleError(_0x16490a,null));};exports[_0x014a('0x2e')]=function(_0x157bd0,_0x35e527){var _0x309925={'raw':!![],'where':{'id':_0x157bd0[_0x014a('0x2f')]['id']}},_0x128fb9={};_0x128fb9[_0x014a('0x19')]=_['keys'](db[_0x014a('0x2b')]['rawAttributes']);_0x128fb9[_0x014a('0x1a')]=_[_0x014a('0x30')](_0x157bd0[_0x014a('0x1a')]);_0x128fb9[_0x014a('0x21')]=_[_0x014a('0x1b')](_0x128fb9['model'],_0x128fb9[_0x014a('0x1a')]);_0x309925[_0x014a('0x1c')]=_['intersection'](_0x128fb9[_0x014a('0x19')],qs[_0x014a('0x1d')](_0x157bd0[_0x014a('0x1a')][_0x014a('0x1d')]));_0x309925[_0x014a('0x1c')]=_0x309925[_0x014a('0x1c')][_0x014a('0x31')]?_0x309925[_0x014a('0x1c')]:_0x128fb9[_0x014a('0x19')];if(_0x157bd0['query'][_0x014a('0x26')]){_0x309925[_0x014a('0x27')]=[{'all':!![]}];}_0x309925=_[_0x014a('0x23')]({},_0x309925,_0x157bd0[_0x014a('0x25')]);return db['VoiceCallReport'][_0x014a('0x32')](_0x309925)[_0x014a('0xd')](handleEntityNotFound(_0x35e527,null))[_0x014a('0xd')](respondWithResult(_0x35e527,null))[_0x014a('0x2d')](handleError(_0x35e527,null));};exports[_0x014a('0x33')]=function(_0x430a56,_0x5f2969){return db[_0x014a('0x2b')][_0x014a('0x33')](_0x430a56['body'],{})[_0x014a('0xd')](respondWithResult(_0x5f2969,0xc9))[_0x014a('0x2d')](handleError(_0x5f2969,null));};exports[_0x014a('0xe')]=function(_0x5dc092,_0x5bcf8){return db['VoiceCallReport']['find']({'where':{'id':_0x5dc092[_0x014a('0x2f')]['id']}})[_0x014a('0xd')](handleEntityNotFound(_0x5bcf8,null))['then'](removeEntity(_0x5bcf8,null))[_0x014a('0x2d')](handleError(_0x5bcf8,null));};exports[_0x014a('0x34')]=function(_0xa4b68e,_0x15c5dc){return db[_0x014a('0x2b')][_0x014a('0x34')]()['then'](respondWithResult(_0x15c5dc,null))[_0x014a('0x2d')](handleError(_0x15c5dc,null));};function findForUpdate(_0xb0d8e0){return db[_0x014a('0x2b')]['find']({'where':{'uniqueid':_0xb0d8e0['params']['id'],'UserId':{'$or':[null,_0xb0d8e0[_0x014a('0x35')]['id']]}}});}exports['update']=function(_0x489590,_0x42c530){if(_0x489590['body'][_0x014a('0x36')]){delete _0x489590[_0x014a('0x37')][_0x014a('0x36')];}return findForUpdate(_0x489590)['then'](handleEntityNotFound(_0x42c530,null))[_0x014a('0xd')](saveUpdates(_0x489590[_0x014a('0x37')],null))[_0x014a('0xd')](respondWithResult(_0x42c530,null))[_0x014a('0x2d')](handleError(_0x42c530,null));};exports[_0x014a('0x38')]=function(_0x16aebc,_0x559954,_0x16e25b){if(_0x16aebc[_0x014a('0x37')]['uniqueid']){delete _0x16aebc[_0x014a('0x37')][_0x014a('0x36')];}promiseRetry(function(_0x20bb0c){return findForUpdate(_0x16aebc)[_0x014a('0xd')](function(_0x40a9c1){if(_0x40a9c1!==null){return _0x40a9c1;}else{_0x20bb0c(new Error(_0x014a('0x39')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x014a('0xd')](function(_0x21680f){if(!_0x21680f){return new Promise(function(_0x4aa72b){_0x4aa72b(handleEntityNotFound(_0x559954)());});}else{return _0x21680f[_0x014a('0xc')](_0x16aebc[_0x014a('0x37')])[_0x014a('0xd')](function(_0x135e7e){return respondWithResult(_0x559954)(_0x135e7e);});}},function(){handleEntityNotFound(_0x559954)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index f3fd7c0..97fa0fd 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 _0xa727=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1c390b,_0x485ec0){var _0xe217bd=function(_0x4cbdf2){while(--_0x4cbdf2){_0x1c390b['push'](_0x1c390b['shift']());}};_0xe217bd(++_0x485ec0);}(_0xa727,0x173));var _0x7a72=function(_0x21235e,_0x1b95b4){_0x21235e=_0x21235e-0x0;var _0x3d947d=_0xa727[_0x21235e];return _0x3d947d;};'use strict';var _=require('lodash');var util=require(_0x7a72('0x0'));var logger=require(_0x7a72('0x1'))('api');var moment=require(_0x7a72('0x2'));var BPromise=require(_0x7a72('0x3'));var rp=require(_0x7a72('0x4'));var fs=require('fs');var path=require(_0x7a72('0x5'));var rimraf=require(_0x7a72('0x6'));var config=require(_0x7a72('0x7'));var attributes=require(_0x7a72('0x8'));module[_0x7a72('0x9')]=function(_0x40e4a9,_0x4c3e48){return _0x40e4a9[_0x7a72('0xa')](_0x7a72('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x7a72('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf98a=['report_call','uniqueid','../../config/logger','api','moment','path','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x2c4c95,_0x5621bd){var _0x1409e4=function(_0x35f5b0){while(--_0x35f5b0){_0x2c4c95['push'](_0x2c4c95['shift']());}};_0x1409e4(++_0x5621bd);}(_0xf98a,0x162));var _0xaf98=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xf98a[_0x238671];return _0x474844;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaf98('0x0'))(_0xaf98('0x1'));var moment=require(_0xaf98('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf98('0x3'));var rimraf=require('rimraf');var config=require(_0xaf98('0x4'));var attributes=require(_0xaf98('0x5'));module[_0xaf98('0x6')]=function(_0x20d54a,_0x1b846c){return _0x20d54a[_0xaf98('0x7')](_0xaf98('0x8'),attributes,{'tableName':_0xaf98('0x9'),'paranoid':![],'indexes':[{'fields':[_0xaf98('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 88c548f..9a9abdb 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 _0x0821=['CreateVoiceCallReport','VoiceCallReport','create','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceCallReport','catch'];(function(_0x1c48f1,_0x103d47){var _0x5b7dce=function(_0x1b1208){while(--_0x1b1208){_0x1c48f1['push'](_0x1c48f1['shift']());}};_0x5b7dce(++_0x103d47);}(_0x0821,0xcd));var _0x1082=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x0821[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0x1082('0x0'));var util=require(_0x1082('0x1'));var moment=require(_0x1082('0x2'));var BPromise=require(_0x1082('0x3'));var rs=require(_0x1082('0x4'));var fs=require('fs');var Redis=require(_0x1082('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1082('0x6'));var logger=require(_0x1082('0x7'))('rpc');var config=require(_0x1082('0x8'));var jayson=require(_0x1082('0x9'));var client=jayson[_0x1082('0xa')][_0x1082('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ccf54,_0x1cbbc3,_0x29a595){return new BPromise(function(_0x277f4f,_0x1e08ff){return client[_0x1082('0xc')](_0x4ccf54,_0x29a595)['then'](function(_0x4c093c){logger['info'](_0x1082('0xd'),_0x1cbbc3,_0x1082('0xe'));logger[_0x1082('0xf')](_0x1082('0x10'),_0x1cbbc3,'request\x20sent',JSON[_0x1082('0x11')](_0x4c093c));if(_0x4c093c['error']){if(_0x4c093c[_0x1082('0x12')][_0x1082('0x13')]===0x1f4){logger['error'](_0x1082('0xd'),_0x1cbbc3,_0x4c093c[_0x1082('0x12')][_0x1082('0x14')]);return _0x1e08ff(_0x4c093c[_0x1082('0x12')][_0x1082('0x14')]);}logger[_0x1082('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x1cbbc3,_0x4c093c[_0x1082('0x12')]['message']);return _0x277f4f(_0x4c093c['error'][_0x1082('0x14')]);}else{logger[_0x1082('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x1cbbc3,'request\x20sent');_0x277f4f(_0x4c093c[_0x1082('0x16')][_0x1082('0x14')]);}})['catch'](function(_0x5d697c){logger[_0x1082('0x12')](_0x1082('0xd'),_0x1cbbc3,_0x5d697c);_0x1e08ff(_0x5d697c);});});}exports['GetVoiceCallReport']=function(_0x494a50){var _0x27fd77=this;return new Promise(function(_0x33f0ab,_0x58db83){return db['VoiceCallReport'][_0x1082('0x17')]({'raw':_0x494a50[_0x1082('0x18')]?_0x494a50[_0x1082('0x18')][_0x1082('0x19')]===undefined?!![]:![]:!![],'where':_0x494a50['options']?_0x494a50[_0x1082('0x18')][_0x1082('0x1a')]||null:null,'attributes':_0x494a50[_0x1082('0x18')]?_0x494a50['options'][_0x1082('0x1b')]||null:null,'limit':_0x494a50[_0x1082('0x18')]?_0x494a50[_0x1082('0x18')][_0x1082('0x1c')]||null:null,'include':_0x494a50[_0x1082('0x18')]?_0x494a50[_0x1082('0x18')][_0x1082('0x1d')]?_[_0x1082('0x1e')](_0x494a50[_0x1082('0x18')][_0x1082('0x1d')],function(_0x404bd5){return{'model':db[_0x404bd5[_0x1082('0x1f')]],'as':_0x404bd5['as'],'attributes':_0x404bd5[_0x1082('0x1b')],'include':_0x404bd5['include']?_[_0x1082('0x1e')](_0x404bd5[_0x1082('0x1d')],function(_0x8a4c0){return{'model':db[_0x8a4c0[_0x1082('0x1f')]],'as':_0x8a4c0['as'],'attributes':_0x8a4c0[_0x1082('0x1b')],'include':_0x8a4c0[_0x1082('0x1d')]?_['map'](_0x8a4c0[_0x1082('0x1d')],function(_0xccccf){return{'model':db[_0xccccf[_0x1082('0x1f')]],'as':_0xccccf['as'],'attributes':_0xccccf['attributes']};}):[]};}):[]};}):[]:[]})[_0x1082('0x20')](function(_0x878bc1){logger['info'](_0x1082('0x21'),_0x494a50);logger[_0x1082('0xf')](_0x1082('0x21'),_0x494a50,JSON[_0x1082('0x11')](_0x878bc1));_0x33f0ab(_0x878bc1);})[_0x1082('0x22')](function(_0x3579ed){logger[_0x1082('0x12')](_0x1082('0x21'),_0x3579ed['message'],_0x494a50);_0x58db83(_0x27fd77[_0x1082('0x12')](0x1f4,_0x3579ed['message']));});});};exports[_0x1082('0x23')]=function(_0x2a03e9){var _0x3830fa=this;return new Promise(function(_0x5be892,_0x24877b){return db[_0x1082('0x24')][_0x1082('0x25')](_0x2a03e9['body'],{'raw':_0x2a03e9[_0x1082('0x18')]?_0x2a03e9[_0x1082('0x18')][_0x1082('0x19')]===undefined?!![]:![]:!![]})[_0x1082('0x20')](function(_0x40743b){logger[_0x1082('0x15')](_0x1082('0x23'),_0x2a03e9);logger[_0x1082('0xf')](_0x1082('0x23'),_0x2a03e9,JSON[_0x1082('0x11')](_0x40743b));_0x5be892(_0x40743b);})[_0x1082('0x22')](function(_0x4e4f1f){logger[_0x1082('0x12')]('CreateVoiceCallReport',_0x4e4f1f['message'],_0x2a03e9);_0x24877b(_0x3830fa[_0x1082('0x12')](0x1f4,_0x4e4f1f['message']));});});};exports[_0x1082('0x26')]=function(_0x97afc8){var _0x233caa=this;return new Promise(function(_0x85a109,_0x4d70c4){return db[_0x1082('0x24')][_0x1082('0x27')](_0x97afc8['body'],{'raw':_0x97afc8[_0x1082('0x18')]?_0x97afc8['options'][_0x1082('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x97afc8[_0x1082('0x18')]?_0x97afc8[_0x1082('0x18')][_0x1082('0x1a')]||null:null,'attributes':_0x97afc8['options']?_0x97afc8[_0x1082('0x18')][_0x1082('0x1b')]||null:null,'limit':_0x97afc8[_0x1082('0x18')]?_0x97afc8['options'][_0x1082('0x1c')]||null:null})[_0x1082('0x20')](function(_0x257b93){logger[_0x1082('0x15')](_0x1082('0x26'),_0x97afc8);logger[_0x1082('0xf')]('UpdateVoiceCallReport',_0x97afc8,JSON[_0x1082('0x11')](_0x257b93));_0x85a109(_0x257b93);})[_0x1082('0x22')](function(_0x47d6d4){logger[_0x1082('0x12')](_0x1082('0x26'),_0x47d6d4['message'],_0x97afc8);_0x4d70c4(_0x233caa['error'](0x1f4,_0x47d6d4[_0x1082('0x14')]));});});}; \ No newline at end of file +var _0xa7ef=['stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','include','map','model','attributes','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa7ef,0x8f));var _0xfa7e=function(_0x83f3f5,_0x3e70b4){_0x83f3f5=_0x83f3f5-0x0;var _0x494f14=_0xa7ef[_0x83f3f5];return _0x494f14;};'use strict';var _=require(_0xfa7e('0x0'));var util=require(_0xfa7e('0x1'));var moment=require('moment');var BPromise=require(_0xfa7e('0x2'));var rs=require(_0xfa7e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa7e('0x4'))['db'];var utils=require(_0xfa7e('0x5'));var logger=require(_0xfa7e('0x6'))(_0xfa7e('0x7'));var config=require(_0xfa7e('0x8'));var jayson=require(_0xfa7e('0x9'));var client=jayson[_0xfa7e('0xa')][_0xfa7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50c07c,_0x1f7c25,_0x5cf999){return new BPromise(function(_0x265820,_0x160355){return client['request'](_0x50c07c,_0x5cf999)[_0xfa7e('0xc')](function(_0x54d02d){logger[_0xfa7e('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x1f7c25,'request\x20sent');logger[_0xfa7e('0xe')](_0xfa7e('0xf'),_0x1f7c25,_0xfa7e('0x10'),JSON[_0xfa7e('0x11')](_0x54d02d));if(_0x54d02d['error']){if(_0x54d02d[_0xfa7e('0x12')][_0xfa7e('0x13')]===0x1f4){logger[_0xfa7e('0x12')](_0xfa7e('0x14'),_0x1f7c25,_0x54d02d[_0xfa7e('0x12')][_0xfa7e('0x15')]);return _0x160355(_0x54d02d[_0xfa7e('0x12')][_0xfa7e('0x15')]);}logger[_0xfa7e('0x12')](_0xfa7e('0x14'),_0x1f7c25,_0x54d02d[_0xfa7e('0x12')][_0xfa7e('0x15')]);return _0x265820(_0x54d02d[_0xfa7e('0x12')][_0xfa7e('0x15')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x1f7c25,_0xfa7e('0x10'));_0x265820(_0x54d02d[_0xfa7e('0x16')]['message']);}})[_0xfa7e('0x17')](function(_0x95c4e6){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x1f7c25,_0x95c4e6);_0x160355(_0x95c4e6);});});}exports[_0xfa7e('0x18')]=function(_0x2328ea){var _0xdee76d=this;return new Promise(function(_0x51ca13,_0x562dda){return db[_0xfa7e('0x19')][_0xfa7e('0x1a')]({'raw':_0x2328ea[_0xfa7e('0x1b')]?_0x2328ea[_0xfa7e('0x1b')][_0xfa7e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2328ea[_0xfa7e('0x1b')]?_0x2328ea[_0xfa7e('0x1b')][_0xfa7e('0x1d')]||null:null,'attributes':_0x2328ea[_0xfa7e('0x1b')]?_0x2328ea['options']['attributes']||null:null,'limit':_0x2328ea[_0xfa7e('0x1b')]?_0x2328ea[_0xfa7e('0x1b')][_0xfa7e('0x1e')]||null:null,'include':_0x2328ea[_0xfa7e('0x1b')]?_0x2328ea['options'][_0xfa7e('0x1f')]?_[_0xfa7e('0x20')](_0x2328ea['options'][_0xfa7e('0x1f')],function(_0x3ee504){return{'model':db[_0x3ee504[_0xfa7e('0x21')]],'as':_0x3ee504['as'],'attributes':_0x3ee504['attributes'],'include':_0x3ee504['include']?_[_0xfa7e('0x20')](_0x3ee504[_0xfa7e('0x1f')],function(_0x44c728){return{'model':db[_0x44c728[_0xfa7e('0x21')]],'as':_0x44c728['as'],'attributes':_0x44c728[_0xfa7e('0x22')],'include':_0x44c728['include']?_[_0xfa7e('0x20')](_0x44c728[_0xfa7e('0x1f')],function(_0xfe6be6){return{'model':db[_0xfe6be6[_0xfa7e('0x21')]],'as':_0xfe6be6['as'],'attributes':_0xfe6be6[_0xfa7e('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfa7e('0xc')](function(_0x419a77){logger[_0xfa7e('0xd')](_0xfa7e('0x18'),_0x2328ea);logger[_0xfa7e('0xe')](_0xfa7e('0x18'),_0x2328ea,JSON['stringify'](_0x419a77));_0x51ca13(_0x419a77);})[_0xfa7e('0x17')](function(_0x1be433){logger[_0xfa7e('0x12')](_0xfa7e('0x18'),_0x1be433[_0xfa7e('0x15')],_0x2328ea);_0x562dda(_0xdee76d['error'](0x1f4,_0x1be433[_0xfa7e('0x15')]));});});};exports[_0xfa7e('0x23')]=function(_0x1f213a){var _0x3c497b=this;return new Promise(function(_0x32809d,_0x8ae3a1){return db[_0xfa7e('0x19')][_0xfa7e('0x24')](_0x1f213a[_0xfa7e('0x25')],{'raw':_0x1f213a['options']?_0x1f213a[_0xfa7e('0x1b')][_0xfa7e('0x1c')]===undefined?!![]:![]:!![]})[_0xfa7e('0xc')](function(_0x2c274a){logger[_0xfa7e('0xd')](_0xfa7e('0x23'),_0x1f213a);logger[_0xfa7e('0xe')](_0xfa7e('0x23'),_0x1f213a,JSON[_0xfa7e('0x11')](_0x2c274a));_0x32809d(_0x2c274a);})[_0xfa7e('0x17')](function(_0x475dba){logger['error'](_0xfa7e('0x23'),_0x475dba['message'],_0x1f213a);_0x8ae3a1(_0x3c497b[_0xfa7e('0x12')](0x1f4,_0x475dba[_0xfa7e('0x15')]));});});};exports[_0xfa7e('0x26')]=function(_0x365b99){var _0x42cbd5=this;return new Promise(function(_0x1f1513,_0x583fd8){return db[_0xfa7e('0x19')][_0xfa7e('0x27')](_0x365b99[_0xfa7e('0x25')],{'raw':_0x365b99[_0xfa7e('0x1b')]?_0x365b99[_0xfa7e('0x1b')][_0xfa7e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x365b99[_0xfa7e('0x1b')]?_0x365b99[_0xfa7e('0x1b')][_0xfa7e('0x1d')]||null:null,'attributes':_0x365b99[_0xfa7e('0x1b')]?_0x365b99['options'][_0xfa7e('0x22')]||null:null,'limit':_0x365b99[_0xfa7e('0x1b')]?_0x365b99['options'][_0xfa7e('0x1e')]||null:null})['then'](function(_0x507f62){logger[_0xfa7e('0xd')]('UpdateVoiceCallReport',_0x365b99);logger['debug'](_0xfa7e('0x26'),_0x365b99,JSON[_0xfa7e('0x11')](_0x507f62));_0x1f1513(_0x507f62);})[_0xfa7e('0x17')](function(_0x5cb067){logger[_0xfa7e('0x12')](_0xfa7e('0x26'),_0x5cb067[_0xfa7e('0x15')],_0x365b99);_0x583fd8(_0x42cbd5[_0xfa7e('0x12')](0x1f4,_0x5cb067['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 1e7448c..cf74282 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 _0xe3ef=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','util','path','express'];(function(_0x3f8759,_0x3fe6fb){var _0x2d33ca=function(_0x39b5c9){while(--_0x39b5c9){_0x3f8759['push'](_0x3f8759['shift']());}};_0x2d33ca(++_0x3fe6fb);}(_0xe3ef,0xdd));var _0xfe3e=function(_0x4acb3c,_0x9d13bb){_0x4acb3c=_0x4acb3c-0x0;var _0x2ee3ab=_0xe3ef[_0x4acb3c];return _0x2ee3ab;};'use strict';var multer=require('multer');var util=require(_0xfe3e('0x0'));var path=require(_0xfe3e('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe3e('0x2'));var router=express[_0xfe3e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe3e('0x4'));var config=require(_0xfe3e('0x5'));var controller=require('./voiceChanSpy.controller');router[_0xfe3e('0x6')]('/',auth[_0xfe3e('0x7')](),controller[_0xfe3e('0x8')]);router['get'](_0xfe3e('0x9'),auth[_0xfe3e('0x7')](),controller[_0xfe3e('0xa')]);router[_0xfe3e('0xb')]('/',auth[_0xfe3e('0x7')](),controller[_0xfe3e('0xc')]);router['put'](_0xfe3e('0x9'),auth[_0xfe3e('0x7')](),controller['update']);router[_0xfe3e('0xd')](_0xfe3e('0x9'),auth[_0xfe3e('0x7')](),controller[_0xfe3e('0xe')]);module[_0xfe3e('0xf')]=router; \ No newline at end of file +var _0x3f7c=['isAuthenticated','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x248ba2,_0x49ed21){var _0x5de84b=function(_0x23f365){while(--_0x23f365){_0x248ba2['push'](_0x248ba2['shift']());}};_0x5de84b(++_0x49ed21);}(_0x3f7c,0xaa));var _0xc3f7=function(_0x1570bf,_0x421ee7){_0x1570bf=_0x1570bf-0x0;var _0x50cb83=_0x3f7c[_0x1570bf];return _0x50cb83;};'use strict';var multer=require(_0xc3f7('0x0'));var util=require(_0xc3f7('0x1'));var path=require(_0xc3f7('0x2'));var timeout=require(_0xc3f7('0x3'));var express=require(_0xc3f7('0x4'));var router=express['Router']();var fs_extra=require(_0xc3f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc3f7('0x6'));var config=require(_0xc3f7('0x7'));var controller=require(_0xc3f7('0x8'));router[_0xc3f7('0x9')]('/',auth[_0xc3f7('0xa')](),controller['index']);router[_0xc3f7('0x9')](_0xc3f7('0xb'),auth[_0xc3f7('0xa')](),controller[_0xc3f7('0xc')]);router[_0xc3f7('0xd')]('/',auth[_0xc3f7('0xa')](),controller[_0xc3f7('0xe')]);router[_0xc3f7('0xf')](_0xc3f7('0xb'),auth['isAuthenticated'](),controller[_0xc3f7('0x10')]);router[_0xc3f7('0x11')]('/:id',auth[_0xc3f7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a12c09b..6276b50 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 _0x165c=['options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x569a75,_0x484918){var _0x2a76c0=function(_0x48935a){while(--_0x48935a){_0x569a75['push'](_0x569a75['shift']());}};_0x2a76c0(++_0x484918);}(_0x165c,0xcc));var _0xc165=function(_0x213a4e,_0xc511ee){_0x213a4e=_0x213a4e-0x0;var _0x5f59da=_0x165c[_0x213a4e];return _0x5f59da;};'use strict';var Sequelize=require(_0xc165('0x0'));module[_0xc165('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xc165('0x2')],'unique':_0xc165('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x13c49e){this['setDataValue'](_0xc165('0x4'),_0x13c49e?_0x13c49e['join'](''):[]);},'get':function(){return this['getDataValue'](_0xc165('0x4'))?this[_0xc165('0x5')](_0xc165('0x4'))[_0xc165('0x6')](''):[];}},'auth':{'type':Sequelize[_0xc165('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xc165('0x2')]},'record':{'type':Sequelize[_0xc165('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc165('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd643=['name','setDataValue','options','join','getDataValue','BOOLEAN','sequelize','STRING'];(function(_0x12a7e8,_0x5497f1){var _0x198c2a=function(_0x502150){while(--_0x502150){_0x12a7e8['push'](_0x12a7e8['shift']());}};_0x198c2a(++_0x5497f1);}(_0xd643,0x146));var _0x3d64=function(_0x345264,_0x2ac630){_0x345264=_0x345264-0x0;var _0x34d106=_0xd643[_0x345264];return _0x34d106;};'use strict';var Sequelize=require(_0x3d64('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d64('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x3d64('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x3d64('0x1')],'set':function(_0x743a0){this[_0x3d64('0x3')](_0x3d64('0x4'),_0x743a0?_0x743a0[_0x3d64('0x5')](''):[]);},'get':function(){return this[_0x3d64('0x6')]('options')?this[_0x3d64('0x6')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x3d64('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x3d64('0x1')]},'record':{'type':Sequelize[_0x3d64('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3d64('0x1')]},'description':{'type':Sequelize[_0x3d64('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 7c05d55..acb5710 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 _0xdace=['ChanSpies','UserProfileResource','name','send','map','VoiceChanSpy','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','get'];(function(_0x49a015,_0x5ec28e){var _0x57a62f=function(_0x3b996c){while(--_0x3b996c){_0x49a015['push'](_0x49a015['shift']());}};_0x57a62f(++_0x5ec28e);}(_0xdace,0xc5));var _0xedac=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0xdace[_0x53d172];return _0x1bd0a2;};'use strict';var emlformat=require(_0xedac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedac('0x1'));var jsonpatch=require(_0xedac('0x2'));var rp=require(_0xedac('0x3'));var moment=require('moment');var BPromise=require(_0xedac('0x4'));var Mustache=require(_0xedac('0x5'));var util=require(_0xedac('0x6'));var path=require(_0xedac('0x7'));var sox=require('sox');var csv=require(_0xedac('0x8'));var ejs=require(_0xedac('0x9'));var fs=require('fs');var fs_extra=require(_0xedac('0xa'));var _=require('lodash');var squel=require(_0xedac('0xb'));var crypto=require(_0xedac('0xc'));var jsforce=require(_0xedac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedac('0x8'));var querystring=require(_0xedac('0xe'));var Papa=require(_0xedac('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xedac('0x10'));var as=require(_0xedac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedac('0x12'));var utils=require(_0xedac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xedac('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21c6ae,_0x1b0503){_0x1b0503=_0x1b0503||0xcc;return function(_0x306af5){if(_0x306af5){return _0x21c6ae[_0xedac('0x15')](_0x1b0503);}return _0x21c6ae[_0xedac('0x16')](_0x1b0503)[_0xedac('0x17')]();};}function respondWithResult(_0x28444a,_0x11f0b0){_0x11f0b0=_0x11f0b0||0xc8;return function(_0x593030){if(_0x593030){return _0x28444a[_0xedac('0x16')](_0x11f0b0)[_0xedac('0x18')](_0x593030);}};}function respondWithFilteredResult(_0x2f0c7c,_0x2676c3){return function(_0x15068){if(_0x15068){var _0x590e9b=typeof _0x2676c3[_0xedac('0x19')]==='undefined'&&typeof _0x2676c3[_0xedac('0x1a')]===_0xedac('0x1b');var _0xdad128=_0x15068[_0xedac('0x1c')];var _0x4fb540=_0x590e9b?0x0:_0x2676c3['offset'];var _0x2d02d7=_0x590e9b?_0x15068[_0xedac('0x1c')]:_0x2676c3[_0xedac('0x19')]+_0x2676c3[_0xedac('0x1a')];var _0x5a5438;if(_0x2d02d7>=_0xdad128){_0x2d02d7=_0xdad128;_0x5a5438=0xc8;}else{_0x5a5438=0xce;}_0x2f0c7c['status'](_0x5a5438);return _0x2f0c7c[_0xedac('0x1d')](_0xedac('0x1e'),_0x4fb540+'-'+_0x2d02d7+'/'+_0xdad128)[_0xedac('0x18')](_0x15068);}return null;};}function patchUpdates(_0xcc1605){return function(_0x2f5eee){try{jsonpatch[_0xedac('0x1f')](_0x2f5eee,_0xcc1605,!![]);}catch(_0x160be7){return BPromise[_0xedac('0x20')](_0x160be7);}return _0x2f5eee['save']();};}function saveUpdates(_0x4593e8,_0x510005){return function(_0x29cd40){if(_0x29cd40){return _0x29cd40[_0xedac('0x21')](_0x4593e8)['then'](function(_0x46e09d){return _0x46e09d;});}return null;};}function removeEntity(_0x404b8d,_0x1c87bf){return function(_0x1e5e47){if(_0x1e5e47){return _0x1e5e47[_0xedac('0x22')]()[_0xedac('0x23')](function(){var _0x5d7c31=_0x1e5e47[_0xedac('0x24')]({'plain':!![]});var _0x87d343=_0xedac('0x25');return db[_0xedac('0x26')][_0xedac('0x22')]({'where':{'type':_0x87d343,'resourceId':_0x5d7c31['id']}})[_0xedac('0x23')](function(){return _0x1e5e47;});})[_0xedac('0x23')](function(){_0x404b8d[_0xedac('0x16')](0xcc)[_0xedac('0x17')]();});}};}function handleEntityNotFound(_0x4663c0,_0x4c5566){return function(_0x25d7f5){if(!_0x25d7f5){_0x4663c0[_0xedac('0x15')](0x194);}return _0x25d7f5;};}function handleError(_0x19aed3,_0x5dff75){_0x5dff75=_0x5dff75||0x1f4;return function(_0x313e06){logger['error'](_0x313e06['stack']);if(_0x313e06[_0xedac('0x27')]){delete _0x313e06[_0xedac('0x27')];}_0x19aed3[_0xedac('0x16')](_0x5dff75)[_0xedac('0x28')](_0x313e06);};}exports['index']=function(_0x4e25da,_0xe813e6){var _0x32d945={},_0x24b182={},_0x2ee8d7={'count':0x0,'rows':[]};var _0x1b2a93=_[_0xedac('0x29')](db[_0xedac('0x2a')]['rawAttributes'],function(_0x3bc910){return{'name':_0x3bc910[_0xedac('0x2b')],'type':_0x3bc910[_0xedac('0x2c')]['key']};});_0x24b182[_0xedac('0x2d')]=_[_0xedac('0x29')](_0x1b2a93,'name');_0x24b182[_0xedac('0x2e')]=_[_0xedac('0x2f')](_0x4e25da['query']);_0x24b182[_0xedac('0x30')]=_[_0xedac('0x31')](_0x24b182[_0xedac('0x2d')],_0x24b182[_0xedac('0x2e')]);_0x32d945[_0xedac('0x32')]=_[_0xedac('0x31')](_0x24b182[_0xedac('0x2d')],qs[_0xedac('0x33')](_0x4e25da[_0xedac('0x2e')][_0xedac('0x33')]));_0x32d945['attributes']=_0x32d945[_0xedac('0x32')][_0xedac('0x34')]?_0x32d945[_0xedac('0x32')]:_0x24b182[_0xedac('0x2d')];if(!_0x4e25da[_0xedac('0x2e')][_0xedac('0x35')](_0xedac('0x36'))){_0x32d945[_0xedac('0x1a')]=qs[_0xedac('0x1a')](_0x4e25da[_0xedac('0x2e')][_0xedac('0x1a')]);_0x32d945[_0xedac('0x19')]=qs[_0xedac('0x19')](_0x4e25da[_0xedac('0x2e')][_0xedac('0x19')]);}_0x32d945['order']=qs[_0xedac('0x37')](_0x4e25da[_0xedac('0x2e')][_0xedac('0x37')]);_0x32d945[_0xedac('0x38')]=qs['filters'](_[_0xedac('0x39')](_0x4e25da[_0xedac('0x2e')],_0x24b182[_0xedac('0x30')]),_0x1b2a93);if(_0x4e25da['query'][_0xedac('0x3a')]){_0x32d945[_0xedac('0x38')]=_[_0xedac('0x3b')](_0x32d945['where'],{'$or':_[_0xedac('0x29')](_0x1b2a93,function(_0x17b7c3){if(_0x17b7c3['type']!==_0xedac('0x3c')){var _0x2fa832={};_0x2fa832[_0x17b7c3['name']]={'$like':'%'+_0x4e25da[_0xedac('0x2e')]['filter']+'%'};return _0x2fa832;}})});}_0x32d945=_[_0xedac('0x3b')]({},_0x32d945,_0x4e25da[_0xedac('0x3d')]);var _0x2e3fcd={'where':_0x32d945[_0xedac('0x38')]};return db[_0xedac('0x2a')][_0xedac('0x1c')](_0x2e3fcd)['then'](function(_0x2370aa){_0x2ee8d7[_0xedac('0x1c')]=_0x2370aa;if(_0x4e25da[_0xedac('0x2e')][_0xedac('0x3e')]){_0x32d945[_0xedac('0x3f')]=[{'all':!![]}];}return db[_0xedac('0x2a')][_0xedac('0x40')](_0x32d945);})[_0xedac('0x23')](function(_0x2dcff4){_0x2ee8d7[_0xedac('0x41')]=_0x2dcff4;return _0x2ee8d7;})[_0xedac('0x23')](respondWithFilteredResult(_0xe813e6,_0x32d945))[_0xedac('0x42')](handleError(_0xe813e6,null));};exports[_0xedac('0x43')]=function(_0x1418ff,_0x8742ea){var _0x46f025={'raw':![],'where':{'id':_0x1418ff[_0xedac('0x44')]['id']}},_0x4cbae0={};_0x4cbae0[_0xedac('0x2d')]=_[_0xedac('0x2f')](db['VoiceChanSpy']['rawAttributes']);_0x4cbae0['query']=_[_0xedac('0x2f')](_0x1418ff[_0xedac('0x2e')]);_0x4cbae0['filters']=_[_0xedac('0x31')](_0x4cbae0['model'],_0x4cbae0[_0xedac('0x2e')]);_0x46f025['attributes']=_[_0xedac('0x31')](_0x4cbae0[_0xedac('0x2d')],qs[_0xedac('0x33')](_0x1418ff[_0xedac('0x2e')][_0xedac('0x33')]));_0x46f025['attributes']=_0x46f025['attributes'][_0xedac('0x34')]?_0x46f025['attributes']:_0x4cbae0[_0xedac('0x2d')];if(_0x1418ff[_0xedac('0x2e')][_0xedac('0x3e')]){_0x46f025['include']=[{'all':!![]}];}_0x46f025=_[_0xedac('0x3b')]({},_0x46f025,_0x1418ff[_0xedac('0x3d')]);return db[_0xedac('0x2a')]['find'](_0x46f025)[_0xedac('0x23')](handleEntityNotFound(_0x8742ea,null))[_0xedac('0x23')](respondWithResult(_0x8742ea,null))[_0xedac('0x42')](handleError(_0x8742ea,null));};exports['create']=function(_0x5e6079,_0x2cb3ca){return db[_0xedac('0x2a')]['create'](_0x5e6079['body'],{})[_0xedac('0x23')](function(_0x38425e){var _0x4e81bc=_0x5e6079[_0xedac('0x45')]['get']({'plain':!![]});if(!_0x4e81bc)throw new Error(_0xedac('0x46'));if(_0x4e81bc[_0xedac('0x47')]===_0xedac('0x45')){var _0x104842=_0x38425e[_0xedac('0x24')]({'plain':!![]});var _0x10ad82='ChanSpies';return db[_0xedac('0x48')][_0xedac('0x49')]({'where':{'name':_0x10ad82,'userProfileId':_0x4e81bc['userProfileId']},'raw':!![]})[_0xedac('0x23')](function(_0x2d0846){if(_0x2d0846&&_0x2d0846[_0xedac('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x104842[_0xedac('0x27')],'resourceId':_0x104842['id'],'type':_0x2d0846[_0xedac('0x27')],'sectionId':_0x2d0846['id']},{})['then'](function(){return _0x38425e;});}else{return _0x38425e;}})[_0xedac('0x42')](function(_0x1bb739){logger[_0xedac('0x4b')](_0xedac('0x4c'),_0x1bb739);throw _0x1bb739;});}return _0x38425e;})[_0xedac('0x23')](respondWithResult(_0x2cb3ca,0xc9))[_0xedac('0x42')](handleError(_0x2cb3ca,null));};exports[_0xedac('0x21')]=function(_0x15d582,_0x5a6e3c){if(_0x15d582['body']['id']){delete _0x15d582[_0xedac('0x4d')]['id'];}return db[_0xedac('0x2a')][_0xedac('0x49')]({'where':{'id':_0x15d582['params']['id']}})[_0xedac('0x23')](handleEntityNotFound(_0x5a6e3c,null))[_0xedac('0x23')](saveUpdates(_0x15d582['body'],null))[_0xedac('0x23')](respondWithResult(_0x5a6e3c,null))[_0xedac('0x42')](handleError(_0x5a6e3c,null));};exports['destroy']=function(_0x575620,_0x5ad779){return db[_0xedac('0x2a')]['find']({'where':{'id':_0x575620[_0xedac('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ad779,null))['then'](removeEntity(_0x5ad779,null))[_0xedac('0x42')](handleError(_0x5ad779,null));}; \ No newline at end of file +var _0xe205=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format'];(function(_0x11a0b0,_0x13077c){var _0x1382e6=function(_0x562ed0){while(--_0x562ed0){_0x11a0b0['push'](_0x11a0b0['shift']());}};_0x1382e6(++_0x13077c);}(_0xe205,0xa7));var _0x5e20=function(_0x58cc49,_0x1eadcf){_0x58cc49=_0x58cc49-0x0;var _0x84cb24=_0xe205[_0x58cc49];return _0x84cb24;};'use strict';var emlformat=require(_0x5e20('0x0'));var rimraf=require(_0x5e20('0x1'));var zipdir=require(_0x5e20('0x2'));var jsonpatch=require(_0x5e20('0x3'));var rp=require(_0x5e20('0x4'));var moment=require(_0x5e20('0x5'));var BPromise=require(_0x5e20('0x6'));var Mustache=require(_0x5e20('0x7'));var util=require(_0x5e20('0x8'));var path=require('path');var sox=require(_0x5e20('0x9'));var csv=require(_0x5e20('0xa'));var ejs=require(_0x5e20('0xb'));var fs=require('fs');var fs_extra=require(_0x5e20('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e20('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e20('0xa'));var querystring=require(_0x5e20('0xe'));var Papa=require('papaparse');var Redis=require(_0x5e20('0xf'));var authService=require(_0x5e20('0x10'));var qs=require(_0x5e20('0x11'));var as=require(_0x5e20('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e20('0x13'))(_0x5e20('0x14'));var utils=require(_0x5e20('0x15'));var config=require(_0x5e20('0x16'));var licenseUtil=require(_0x5e20('0x17'));var db=require(_0x5e20('0x18'))['db'];function respondWithStatusCode(_0x54deee,_0x19eacf){_0x19eacf=_0x19eacf||0xcc;return function(_0x29b7a2){if(_0x29b7a2){return _0x54deee[_0x5e20('0x19')](_0x19eacf);}return _0x54deee['status'](_0x19eacf)[_0x5e20('0x1a')]();};}function respondWithResult(_0x5d827e,_0x1f47f3){_0x1f47f3=_0x1f47f3||0xc8;return function(_0x5ba833){if(_0x5ba833){return _0x5d827e[_0x5e20('0x1b')](_0x1f47f3)[_0x5e20('0x1c')](_0x5ba833);}};}function respondWithFilteredResult(_0x275026,_0x148ada){return function(_0x294df8){if(_0x294df8){var _0x542b3c=typeof _0x148ada[_0x5e20('0x1d')]===_0x5e20('0x1e')&&typeof _0x148ada[_0x5e20('0x1f')]===_0x5e20('0x1e');var _0x2f194b=_0x294df8[_0x5e20('0x20')];var _0x1cc706=_0x542b3c?0x0:_0x148ada[_0x5e20('0x1d')];var _0x4d3e4a=_0x542b3c?_0x294df8[_0x5e20('0x20')]:_0x148ada[_0x5e20('0x1d')]+_0x148ada['limit'];var _0x295eb3;if(_0x4d3e4a>=_0x2f194b){_0x4d3e4a=_0x2f194b;_0x295eb3=0xc8;}else{_0x295eb3=0xce;}_0x275026[_0x5e20('0x1b')](_0x295eb3);return _0x275026[_0x5e20('0x21')](_0x5e20('0x22'),_0x1cc706+'-'+_0x4d3e4a+'/'+_0x2f194b)['json'](_0x294df8);}return null;};}function patchUpdates(_0x2954fc){return function(_0x50f222){try{jsonpatch['apply'](_0x50f222,_0x2954fc,!![]);}catch(_0x57c7c5){return BPromise['reject'](_0x57c7c5);}return _0x50f222[_0x5e20('0x23')]();};}function saveUpdates(_0x5cca90,_0x3d89e4){return function(_0x29b111){if(_0x29b111){return _0x29b111[_0x5e20('0x24')](_0x5cca90)[_0x5e20('0x25')](function(_0x3ef7fa){return _0x3ef7fa;});}return null;};}function removeEntity(_0x2d4614,_0x4c5732){return function(_0x15705f){if(_0x15705f){return _0x15705f['destroy']()['then'](function(){var _0x33993a=_0x15705f[_0x5e20('0x26')]({'plain':!![]});var _0x2bae08=_0x5e20('0x27');return db[_0x5e20('0x28')][_0x5e20('0x29')]({'where':{'type':_0x2bae08,'resourceId':_0x33993a['id']}})[_0x5e20('0x25')](function(){return _0x15705f;});})['then'](function(){_0x2d4614[_0x5e20('0x1b')](0xcc)[_0x5e20('0x1a')]();});}};}function handleEntityNotFound(_0x238758,_0x3032ef){return function(_0x4c799d){if(!_0x4c799d){_0x238758[_0x5e20('0x19')](0x194);}return _0x4c799d;};}function handleError(_0x2c5d80,_0x37f09a){_0x37f09a=_0x37f09a||0x1f4;return function(_0x222e7a){logger[_0x5e20('0x2a')](_0x222e7a[_0x5e20('0x2b')]);if(_0x222e7a['name']){delete _0x222e7a[_0x5e20('0x2c')];}_0x2c5d80[_0x5e20('0x1b')](_0x37f09a)['send'](_0x222e7a);};}exports[_0x5e20('0x2d')]=function(_0x21d1d8,_0x335f1e){var _0x4196a3={},_0x1548c8={},_0x395a27={'count':0x0,'rows':[]};var _0x4ff715=_[_0x5e20('0x2e')](db[_0x5e20('0x2f')][_0x5e20('0x30')],function(_0x5f2f1d){return{'name':_0x5f2f1d[_0x5e20('0x31')],'type':_0x5f2f1d[_0x5e20('0x32')][_0x5e20('0x33')]};});_0x1548c8[_0x5e20('0x34')]=_[_0x5e20('0x2e')](_0x4ff715,_0x5e20('0x2c'));_0x1548c8[_0x5e20('0x35')]=_['keys'](_0x21d1d8[_0x5e20('0x35')]);_0x1548c8[_0x5e20('0x36')]=_[_0x5e20('0x37')](_0x1548c8['model'],_0x1548c8[_0x5e20('0x35')]);_0x4196a3[_0x5e20('0x38')]=_[_0x5e20('0x37')](_0x1548c8[_0x5e20('0x34')],qs[_0x5e20('0x39')](_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x39')]));_0x4196a3[_0x5e20('0x38')]=_0x4196a3[_0x5e20('0x38')][_0x5e20('0x3a')]?_0x4196a3[_0x5e20('0x38')]:_0x1548c8[_0x5e20('0x34')];if(!_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x3b')]('nolimit')){_0x4196a3[_0x5e20('0x1f')]=qs['limit'](_0x21d1d8['query'][_0x5e20('0x1f')]);_0x4196a3[_0x5e20('0x1d')]=qs['offset'](_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x1d')]);}_0x4196a3['order']=qs[_0x5e20('0x3c')](_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x3c')]);_0x4196a3[_0x5e20('0x3d')]=qs[_0x5e20('0x36')](_[_0x5e20('0x3e')](_0x21d1d8[_0x5e20('0x35')],_0x1548c8[_0x5e20('0x36')]),_0x4ff715);if(_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x3f')]){_0x4196a3[_0x5e20('0x3d')]=_[_0x5e20('0x40')](_0x4196a3[_0x5e20('0x3d')],{'$or':_[_0x5e20('0x2e')](_0x4ff715,function(_0x5ad136){if(_0x5ad136[_0x5e20('0x32')]!==_0x5e20('0x41')){var _0x17feb4={};_0x17feb4[_0x5ad136['name']]={'$like':'%'+_0x21d1d8[_0x5e20('0x35')][_0x5e20('0x3f')]+'%'};return _0x17feb4;}})});}_0x4196a3=_[_0x5e20('0x40')]({},_0x4196a3,_0x21d1d8[_0x5e20('0x42')]);var _0x39018d={'where':_0x4196a3['where']};return db[_0x5e20('0x2f')][_0x5e20('0x20')](_0x39018d)[_0x5e20('0x25')](function(_0x24c05f){_0x395a27[_0x5e20('0x20')]=_0x24c05f;if(_0x21d1d8[_0x5e20('0x35')]['includeAll']){_0x4196a3[_0x5e20('0x43')]=[{'all':!![]}];}return db[_0x5e20('0x2f')][_0x5e20('0x44')](_0x4196a3);})['then'](function(_0x2b031d){_0x395a27[_0x5e20('0x45')]=_0x2b031d;return _0x395a27;})[_0x5e20('0x25')](respondWithFilteredResult(_0x335f1e,_0x4196a3))[_0x5e20('0x46')](handleError(_0x335f1e,null));};exports[_0x5e20('0x47')]=function(_0x336d61,_0x113133){var _0x3edea7={'raw':![],'where':{'id':_0x336d61[_0x5e20('0x48')]['id']}},_0x5c9504={};_0x5c9504[_0x5e20('0x34')]=_[_0x5e20('0x49')](db['VoiceChanSpy'][_0x5e20('0x30')]);_0x5c9504['query']=_[_0x5e20('0x49')](_0x336d61[_0x5e20('0x35')]);_0x5c9504[_0x5e20('0x36')]=_[_0x5e20('0x37')](_0x5c9504[_0x5e20('0x34')],_0x5c9504['query']);_0x3edea7[_0x5e20('0x38')]=_['intersection'](_0x5c9504['model'],qs[_0x5e20('0x39')](_0x336d61[_0x5e20('0x35')][_0x5e20('0x39')]));_0x3edea7[_0x5e20('0x38')]=_0x3edea7[_0x5e20('0x38')][_0x5e20('0x3a')]?_0x3edea7[_0x5e20('0x38')]:_0x5c9504['model'];if(_0x336d61['query'][_0x5e20('0x4a')]){_0x3edea7[_0x5e20('0x43')]=[{'all':!![]}];}_0x3edea7=_['merge']({},_0x3edea7,_0x336d61[_0x5e20('0x42')]);return db[_0x5e20('0x2f')][_0x5e20('0x4b')](_0x3edea7)[_0x5e20('0x25')](handleEntityNotFound(_0x113133,null))[_0x5e20('0x25')](respondWithResult(_0x113133,null))['catch'](handleError(_0x113133,null));};exports[_0x5e20('0x4c')]=function(_0x245b52,_0x25491e){return db[_0x5e20('0x2f')][_0x5e20('0x4c')](_0x245b52[_0x5e20('0x4d')],{})[_0x5e20('0x25')](function(_0x4485bb){var _0x4fb004=_0x245b52['user']['get']({'plain':!![]});if(!_0x4fb004)throw new Error(_0x5e20('0x4e'));if(_0x4fb004[_0x5e20('0x4f')]==='user'){var _0x4392ca=_0x4485bb['get']({'plain':!![]});var _0x61a3f1='ChanSpies';return db[_0x5e20('0x50')]['find']({'where':{'name':_0x61a3f1,'userProfileId':_0x4fb004[_0x5e20('0x51')]},'raw':!![]})[_0x5e20('0x25')](function(_0x285d2e){if(_0x285d2e&&_0x285d2e[_0x5e20('0x52')]===0x0){return db[_0x5e20('0x28')][_0x5e20('0x4c')]({'name':_0x4392ca[_0x5e20('0x2c')],'resourceId':_0x4392ca['id'],'type':_0x285d2e[_0x5e20('0x2c')],'sectionId':_0x285d2e['id']},{})[_0x5e20('0x25')](function(){return _0x4485bb;});}else{return _0x4485bb;}})[_0x5e20('0x46')](function(_0x13b716){logger[_0x5e20('0x2a')](_0x5e20('0x53'),_0x13b716);throw _0x13b716;});}return _0x4485bb;})[_0x5e20('0x25')](respondWithResult(_0x25491e,0xc9))[_0x5e20('0x46')](handleError(_0x25491e,null));};exports[_0x5e20('0x24')]=function(_0x1619fa,_0x1ace56){if(_0x1619fa['body']['id']){delete _0x1619fa['body']['id'];}return db[_0x5e20('0x2f')]['find']({'where':{'id':_0x1619fa[_0x5e20('0x48')]['id']}})[_0x5e20('0x25')](handleEntityNotFound(_0x1ace56,null))[_0x5e20('0x25')](saveUpdates(_0x1619fa['body'],null))[_0x5e20('0x25')](respondWithResult(_0x1ace56,null))[_0x5e20('0x46')](handleError(_0x1ace56,null));};exports[_0x5e20('0x29')]=function(_0x5d0345,_0x5d2aa2){return db['VoiceChanSpy'][_0x5e20('0x4b')]({'where':{'id':_0x5d0345[_0x5e20('0x48')]['id']}})[_0x5e20('0x25')](handleEntityNotFound(_0x5d2aa2,null))[_0x5e20('0x25')](removeEntity(_0x5d2aa2,null))[_0x5e20('0x46')](handleError(_0x5d2aa2,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index adb4d0a..cb20ccb 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 _0x0c21=['User','findAll','internal','agent','then','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','system','push','merge','Set','MixMonitor','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','record','StopMixMonitor','length','concat'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0c21,0x1c7));var _0x10c2=function(_0x510baa,_0x2ef9bc){_0x510baa=_0x510baa-0x0;var _0x53da25=_0x0c21[_0x510baa];return _0x53da25;};'use strict';var _=require(_0x10c2('0x0'));var util=require(_0x10c2('0x1'));var BPromise=require(_0x10c2('0x2'));var attributes=require(_0x10c2('0x3'));var getUserApplications=function(_0xfda3ca,_0xc68d66,_0x64a713){var _0x1cd97a=0x1;var _0x20917a=[];var _0x21ea2d={'context':_0xc68d66[_0x10c2('0x4')]||'from-sip','exten':util[_0x10c2('0x5')]('%s%s',_0xfda3ca['prefix'],_0x64a713),'type':_0x10c2('0x6'),'isApp':![],'ChanSpyId':_0xfda3ca['id'],'UserId':_0xc68d66['id']};_0x20917a[_0x10c2('0x7')](_[_0x10c2('0x8')]({'app':_0x10c2('0x9'),'appdata':util[_0x10c2('0x5')]('CDR(type)=%s','chanspy'),'priority':_0x1cd97a++},_0x21ea2d));if(_0xfda3ca['record']){_0x20917a[_0x10c2('0x7')](_['merge']({'app':_0x10c2('0xa'),'appdata':util[_0x10c2('0x5')]('${UNIQUEID}.%s,a',_0xfda3ca['recordingFormat']),'priority':_0x1cd97a++},_0x21ea2d));}if(_0xfda3ca['auth']){_0x20917a[_0x10c2('0x7')](_[_0x10c2('0x8')]({'app':_0x10c2('0xb'),'appdata':_0xfda3ca[_0x10c2('0xc')],'priority':_0x1cd97a++},_0x21ea2d));}_0x20917a[_0x10c2('0x7')](_[_0x10c2('0x8')]({'app':_0x10c2('0xd'),'appdata':util[_0x10c2('0x5')](_0x10c2('0xe'),_0xc68d66[_0x10c2('0xf')],_0xfda3ca[_0x10c2('0x10')]?_0xfda3ca[_0x10c2('0x10')]['join'](''):''),'priority':_0x1cd97a++},_0x21ea2d));if(_0xfda3ca[_0x10c2('0x11')]){_0x20917a[_0x10c2('0x7')](_[_0x10c2('0x8')]({'app':_0x10c2('0x12'),'priority':_0x1cd97a++},_0x21ea2d));}return _0x20917a;};var getChanSpyApplications=function(_0x51b074,_0x57edd6){var _0x1a2673=[];for(var _0x53f0af=0x0,_0x2f5ac2=0x1;_0x53f0af<_0x57edd6[_0x10c2('0x13')];_0x53f0af++,_0x2f5ac2=0x1){_0x1a2673=_0x1a2673[_0x10c2('0x14')](getUserApplications(_0x51b074,_0x57edd6[_0x53f0af],_0x57edd6[_0x53f0af]['internal']));if(_0x57edd6[_0x53f0af]['internal']!=_0x57edd6[_0x53f0af]['name']){_0x1a2673=_0x1a2673[_0x10c2('0x14')](getUserApplications(_0x51b074,_0x57edd6[_0x53f0af],_0x57edd6[_0x53f0af][_0x10c2('0xf')]));}}return _0x1a2673;};var getChanSpyPromise=function(_0x2a8ded,_0x20bcd1){return new BPromise(function(_0x4dc7d2,_0x4d4457){return _0x2a8ded[_0x10c2('0x15')][_0x10c2('0x16')]({'attributes':['id','name',_0x10c2('0x17')],'where':{'role':_0x10c2('0x18'),'chanspy':!![]},'raw':!![]})[_0x10c2('0x19')](function(_0x2bd3bb){if(_0x2bd3bb){return _0x4dc7d2(getChanSpyApplications(_0x20bcd1,_0x2bd3bb));}return _0x4dc7d2([]);})['catch'](function(_0x5f955){_0x4d4457(_0x5f955);});});};module[_0x10c2('0x1a')]=function(_0x12ca50,_0x530723){var _0x3c1e7a=_0x12ca50[_0x10c2('0x1b')];return _0x12ca50['define'](_0x10c2('0x1c'),attributes,{'tableName':_0x10c2('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c1e31,_0x4c4d9a,_0x31cd0a){return getChanSpyPromise(_0x3c1e7a,_0x3c1e31)[_0x10c2('0x19')](function(_0x1ee8e3){if(_0x1ee8e3&&_0x1ee8e3[_0x10c2('0x13')]){return _0x3c1e7a[_0x10c2('0x1e')][_0x10c2('0x1f')](_0x1ee8e3);}})['then'](function(){_0x31cd0a();})[_0x10c2('0x20')](function(_0x38d904){_0x31cd0a(_0x38d904);});},'afterUpdate':function(_0x299013,_0x30f9b3,_0x5a8ded){return _0x3c1e7a[_0x10c2('0x1e')][_0x10c2('0x21')]({'where':{'ChanSpyId':_0x299013['id']}})['then'](function(){return getChanSpyPromise(_0x3c1e7a,_0x299013);})[_0x10c2('0x19')](function(_0x1eae01){if(_0x1eae01&&_0x1eae01['length']){return _0x3c1e7a[_0x10c2('0x1e')]['bulkCreate'](_0x1eae01);}})['then'](function(){_0x5a8ded();})['catch'](function(_0x12dbee){_0x5a8ded(_0x12dbee);});},'afterDestroy':function(_0x53e516,_0x3f4c33,_0x4b6e98){return _0x3c1e7a[_0x10c2('0x1e')]['destroy']({'where':{'ChanSpyId':_0x53e516['id']}})[_0x10c2('0x19')](function(){_0x4b6e98();})[_0x10c2('0x20')](function(_0x4e3b15){_0x4b6e98(_0x4e3b15);});}}});}; \ No newline at end of file +var _0x3579=['recordingFormat','auth','password','name','options','length','concat','internal','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor'];(function(_0x40f4ff,_0x3f1fe4){var _0x228aab=function(_0x2fc3b9){while(--_0x2fc3b9){_0x40f4ff['push'](_0x40f4ff['shift']());}};_0x228aab(++_0x3f1fe4);}(_0x3579,0xe6));var _0x9357=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x3579[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x9357('0x0'));var util=require(_0x9357('0x1'));var BPromise=require(_0x9357('0x2'));var attributes=require(_0x9357('0x3'));var getUserApplications=function(_0x1647ff,_0x2735bc,_0xcc77a7){var _0x543158=0x1;var _0x38663d=[];var _0x4ccc8d={'context':_0x2735bc['context']||_0x9357('0x4'),'exten':util[_0x9357('0x5')](_0x9357('0x6'),_0x1647ff[_0x9357('0x7')],_0xcc77a7),'type':'system','isApp':![],'ChanSpyId':_0x1647ff['id'],'UserId':_0x2735bc['id']};_0x38663d['push'](_[_0x9357('0x8')]({'app':_0x9357('0x9'),'appdata':util[_0x9357('0x5')](_0x9357('0xa'),_0x9357('0xb')),'priority':_0x543158++},_0x4ccc8d));if(_0x1647ff[_0x9357('0xc')]){_0x38663d[_0x9357('0xd')](_[_0x9357('0x8')]({'app':_0x9357('0xe'),'appdata':util[_0x9357('0x5')]('${UNIQUEID}.%s,a',_0x1647ff[_0x9357('0xf')]),'priority':_0x543158++},_0x4ccc8d));}if(_0x1647ff[_0x9357('0x10')]){_0x38663d[_0x9357('0xd')](_['merge']({'app':'Authenticate','appdata':_0x1647ff[_0x9357('0x11')],'priority':_0x543158++},_0x4ccc8d));}_0x38663d[_0x9357('0xd')](_[_0x9357('0x8')]({'app':'ChanSpy','appdata':util[_0x9357('0x5')]('SIP/%s,%s',_0x2735bc[_0x9357('0x12')],_0x1647ff[_0x9357('0x13')]?_0x1647ff['options']['join'](''):''),'priority':_0x543158++},_0x4ccc8d));if(_0x1647ff[_0x9357('0xc')]){_0x38663d[_0x9357('0xd')](_[_0x9357('0x8')]({'app':'StopMixMonitor','priority':_0x543158++},_0x4ccc8d));}return _0x38663d;};var getChanSpyApplications=function(_0x242165,_0x5e5df6){var _0x9bb0a=[];for(var _0x5ac7a6=0x0,_0xbbf01c=0x1;_0x5ac7a6<_0x5e5df6[_0x9357('0x14')];_0x5ac7a6++,_0xbbf01c=0x1){_0x9bb0a=_0x9bb0a[_0x9357('0x15')](getUserApplications(_0x242165,_0x5e5df6[_0x5ac7a6],_0x5e5df6[_0x5ac7a6][_0x9357('0x16')]));if(_0x5e5df6[_0x5ac7a6][_0x9357('0x16')]!=_0x5e5df6[_0x5ac7a6][_0x9357('0x12')]){_0x9bb0a=_0x9bb0a[_0x9357('0x15')](getUserApplications(_0x242165,_0x5e5df6[_0x5ac7a6],_0x5e5df6[_0x5ac7a6]['name']));}}return _0x9bb0a;};var getChanSpyPromise=function(_0x11fe47,_0x2642b7){return new BPromise(function(_0x231d31,_0x10ceb1){return _0x11fe47[_0x9357('0x17')][_0x9357('0x18')]({'attributes':['id','name','internal'],'where':{'role':_0x9357('0x19'),'chanspy':!![]},'raw':!![]})[_0x9357('0x1a')](function(_0x5f4bf3){if(_0x5f4bf3){return _0x231d31(getChanSpyApplications(_0x2642b7,_0x5f4bf3));}return _0x231d31([]);})[_0x9357('0x1b')](function(_0x106a21){_0x10ceb1(_0x106a21);});});};module[_0x9357('0x1c')]=function(_0x243907,_0x5b2bfd){var _0x169eb9=_0x243907['models'];return _0x243907[_0x9357('0x1d')](_0x9357('0x1e'),attributes,{'tableName':_0x9357('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ca9aa,_0x2febfa,_0x382d7e){return getChanSpyPromise(_0x169eb9,_0x2ca9aa)['then'](function(_0x7d900a){if(_0x7d900a&&_0x7d900a[_0x9357('0x14')]){return _0x169eb9[_0x9357('0x20')][_0x9357('0x21')](_0x7d900a);}})[_0x9357('0x1a')](function(){_0x382d7e();})['catch'](function(_0x5daae7){_0x382d7e(_0x5daae7);});},'afterUpdate':function(_0x145336,_0x5d2e4f,_0x1e9372){return _0x169eb9[_0x9357('0x20')][_0x9357('0x22')]({'where':{'ChanSpyId':_0x145336['id']}})[_0x9357('0x1a')](function(){return getChanSpyPromise(_0x169eb9,_0x145336);})[_0x9357('0x1a')](function(_0x51099c){if(_0x51099c&&_0x51099c['length']){return _0x169eb9[_0x9357('0x20')][_0x9357('0x21')](_0x51099c);}})[_0x9357('0x1a')](function(){_0x1e9372();})[_0x9357('0x1b')](function(_0x71b7fa){_0x1e9372(_0x71b7fa);});},'afterDestroy':function(_0x4c77bc,_0x9a7951,_0x43baa1){return _0x169eb9['VoiceExtension'][_0x9357('0x22')]({'where':{'ChanSpyId':_0x4c77bc['id']}})['then'](function(){_0x43baa1();})['catch'](function(_0x237388){_0x43baa1(_0x237388);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 594b9fb..7be5307 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 _0x22fb=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4abf88,_0x4dca2b){var _0x260230=function(_0x46f797){while(--_0x46f797){_0x4abf88['push'](_0x4abf88['shift']());}};_0x260230(++_0x4dca2b);}(_0x22fb,0x192));var _0xb22f=function(_0x1e4823,_0x275be3){_0x1e4823=_0x1e4823-0x0;var _0x2e1ecf=_0x22fb[_0x1e4823];return _0x2e1ecf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file +var _0xaf80=['result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x12fb9e,_0xa26967){var _0x3bd4cb=function(_0xcdac5a){while(--_0xcdac5a){_0x12fb9e['push'](_0x12fb9e['shift']());}};_0x3bd4cb(++_0xa26967);}(_0xaf80,0x1ef));var _0x0af8=function(_0x505939,_0x334b5e){_0x505939=_0x505939-0x0;var _0x221c6e=_0xaf80[_0x505939];return _0x221c6e;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var moment=require(_0x0af8('0x2'));var BPromise=require(_0x0af8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0af8('0x4'));var logger=require(_0x0af8('0x5'))(_0x0af8('0x6'));var config=require(_0x0af8('0x7'));var jayson=require(_0x0af8('0x8'));var client=jayson[_0x0af8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bce2c,_0x28f555,_0x538c1c){return new BPromise(function(_0x207a9b,_0x430bd4){return client[_0x0af8('0xa')](_0x4bce2c,_0x538c1c)['then'](function(_0xc0d5eb){logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,'request\x20sent');logger['debug'](_0x0af8('0xd'),_0x28f555,_0x0af8('0xe'),JSON[_0x0af8('0xf')](_0xc0d5eb));if(_0xc0d5eb[_0x0af8('0x10')]){if(_0xc0d5eb[_0x0af8('0x10')]['code']===0x1f4){logger[_0x0af8('0x10')](_0x0af8('0xc'),_0x28f555,_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);return _0x430bd4(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}logger[_0x0af8('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x28f555,_0xc0d5eb['error'][_0x0af8('0x11')]);return _0x207a9b(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}else{logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,_0x0af8('0xe'));_0x207a9b(_0xc0d5eb[_0x0af8('0x12')][_0x0af8('0x11')]);}})['catch'](function(_0x5f4275){logger['error'](_0x0af8('0xc'),_0x28f555,_0x5f4275);_0x430bd4(_0x5f4275);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8de86ae..a7162a0 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 _0x4656=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0x1fa8f5,_0x1e156c){var _0x4d87bc=function(_0x7490b){while(--_0x7490b){_0x1fa8f5['push'](_0x1fa8f5['shift']());}};_0x4d87bc(++_0x1e156c);}(_0x4656,0xb9));var _0x6465=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x4656[_0x547ff4];return _0xe41057;};'use strict';var multer=require(_0x6465('0x0'));var util=require(_0x6465('0x1'));var path=require(_0x6465('0x2'));var timeout=require(_0x6465('0x3'));var express=require(_0x6465('0x4'));var router=express[_0x6465('0x5')]();var fs_extra=require(_0x6465('0x6'));var auth=require(_0x6465('0x7'));var interaction=require(_0x6465('0x8'));var config=require(_0x6465('0x9'));var controller=require(_0x6465('0xa'));router[_0x6465('0xb')]('/',auth[_0x6465('0xc')](),controller['index']);router[_0x6465('0xb')](_0x6465('0xd'),auth[_0x6465('0xc')](),controller[_0x6465('0xe')]);router[_0x6465('0xf')]('/',auth[_0x6465('0xc')](),controller[_0x6465('0x10')]);router[_0x6465('0x11')](_0x6465('0xd'),auth[_0x6465('0xc')](),controller[_0x6465('0x12')]);router[_0x6465('0x13')](_0x6465('0xd'),auth['isAuthenticated'](),controller[_0x6465('0x14')]);module[_0x6465('0x15')]=router; \ No newline at end of file +var _0x369b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','util'];(function(_0x122c68,_0x42cded){var _0x363ab4=function(_0x3d7129){while(--_0x3d7129){_0x122c68['push'](_0x122c68['shift']());}};_0x363ab4(++_0x42cded);}(_0x369b,0x168));var _0xb369=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x369b[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require('multer');var util=require(_0xb369('0x0'));var path=require(_0xb369('0x1'));var timeout=require(_0xb369('0x2'));var express=require(_0xb369('0x3'));var router=express[_0xb369('0x4')]();var fs_extra=require(_0xb369('0x5'));var auth=require(_0xb369('0x6'));var interaction=require(_0xb369('0x7'));var config=require(_0xb369('0x8'));var controller=require(_0xb369('0x9'));router[_0xb369('0xa')]('/',auth[_0xb369('0xb')](),controller[_0xb369('0xc')]);router[_0xb369('0xa')](_0xb369('0xd'),auth[_0xb369('0xb')](),controller[_0xb369('0xe')]);router['post']('/',auth[_0xb369('0xb')](),controller['create']);router[_0xb369('0xf')](_0xb369('0xd'),auth[_0xb369('0xb')](),controller[_0xb369('0x10')]);router[_0xb369('0x11')](_0xb369('0xd'),auth[_0xb369('0xb')](),controller[_0xb369('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 3fc66bb..5b1f20e 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 _0x178a=['sequelize','exports','STRING'];(function(_0x26c773,_0x4832aa){var _0x4c5305=function(_0x5b623e){while(--_0x5b623e){_0x26c773['push'](_0x26c773['shift']());}};_0x4c5305(++_0x4832aa);}(_0x178a,0x1ad));var _0xa178=function(_0x1b5f74,_0x29bd97){_0x1b5f74=_0x1b5f74-0x0;var _0x33acbd=_0x178a[_0x1b5f74];return _0x33acbd;};'use strict';var Sequelize=require(_0xa178('0x0'));module[_0xa178('0x1')]={'name':{'type':Sequelize[_0xa178('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xa178('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0f01=['exports','STRING','BOOLEAN','sequelize'];(function(_0x18d928,_0x2132a9){var _0x25928c=function(_0x5fdfe1){while(--_0x5fdfe1){_0x18d928['push'](_0x18d928['shift']());}};_0x25928c(++_0x2132a9);}(_0x0f01,0xcf));var _0x10f0=function(_0x59c476,_0xc32b2f){_0x59c476=_0x59c476-0x0;var _0x302f63=_0x0f01[_0x59c476];return _0x302f63;};'use strict';var Sequelize=require(_0x10f0('0x0'));module[_0x10f0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x10f0('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x10f0('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 a08b487..2ed02b9 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 _0xb6b4=['code','message','result','catch','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','destroy','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','sort','pick','filters','filter','merge','where','VIRTUAL','includeAll','include','findAll','show','params','options','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Contexts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Reload','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2f0d58,_0x56ac64){var _0x527598=function(_0xc664bf){while(--_0xc664bf){_0x2f0d58['push'](_0x2f0d58['shift']());}};_0x527598(++_0x56ac64);}(_0xb6b4,0x113));var _0x4b6b=function(_0x2c8905,_0x4c3fa0){_0x2c8905=_0x2c8905-0x0;var _0x568192=_0xb6b4[_0x2c8905];return _0x568192;};'use strict';var emlformat=require(_0x4b6b('0x0'));var rimraf=require(_0x4b6b('0x1'));var zipdir=require(_0x4b6b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b6b('0x3'));var moment=require('moment');var BPromise=require(_0x4b6b('0x4'));var Mustache=require(_0x4b6b('0x5'));var util=require(_0x4b6b('0x6'));var path=require(_0x4b6b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b6b('0x8'));var fs=require('fs');var fs_extra=require(_0x4b6b('0x9'));var _=require(_0x4b6b('0xa'));var squel=require(_0x4b6b('0xb'));var crypto=require(_0x4b6b('0xc'));var jsforce=require(_0x4b6b('0xd'));var deskjs=require(_0x4b6b('0xe'));var toCsv=require(_0x4b6b('0xf'));var querystring=require(_0x4b6b('0x10'));var Papa=require('papaparse');var Redis=require(_0x4b6b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4b6b('0x12'));var as=require(_0x4b6b('0x13'));var hardwareService=require(_0x4b6b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4b6b('0x15'));var licenseUtil=require(_0x4b6b('0x16'));var db=require(_0x4b6b('0x17'))['db'];var jayson=require(_0x4b6b('0x18'));var client=jayson['client'][_0x4b6b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x48235c,_0x381d89,_0x5c89bf,_0x3cb034){return new BPromise(function(_0x34bf99,_0x368b0c){var _0x401b2f=_0x3cb034||client;return _0x401b2f['request'](_0x48235c,_0x5c89bf)[_0x4b6b('0x1a')](function(_0x432ac0){logger[_0x4b6b('0x1b')](_0x4b6b('0x1c'),_0x381d89,_0x4b6b('0x1d'));logger[_0x4b6b('0x1e')](_0x4b6b('0x1f'),_0x381d89,_0x4b6b('0x1d'),JSON[_0x4b6b('0x20')](_0x432ac0));if(_0x432ac0[_0x4b6b('0x21')]){if(_0x432ac0[_0x4b6b('0x21')][_0x4b6b('0x22')]===0x1f4){logger[_0x4b6b('0x21')]('VoiceContext,\x20%s,\x20%s',_0x381d89,_0x432ac0[_0x4b6b('0x21')]['message']);return _0x368b0c(_0x432ac0['error'][_0x4b6b('0x23')]);}logger['error'](_0x4b6b('0x1c'),_0x381d89,_0x432ac0[_0x4b6b('0x21')][_0x4b6b('0x23')]);return _0x34bf99(_0x432ac0[_0x4b6b('0x21')][_0x4b6b('0x23')]);}else{logger[_0x4b6b('0x1b')](_0x4b6b('0x1c'),_0x381d89,'request\x20sent');_0x34bf99(_0x432ac0[_0x4b6b('0x24')][_0x4b6b('0x23')]);}})[_0x4b6b('0x25')](function(_0x118096){logger['error'](_0x4b6b('0x1c'),_0x381d89,_0x118096);_0x368b0c(_0x118096);});});}function respondWithStatusCode(_0x30cbae,_0x140e25){_0x140e25=_0x140e25||0xcc;return function(_0x313cff){if(_0x313cff){return _0x30cbae[_0x4b6b('0x26')](_0x140e25);}return _0x30cbae['status'](_0x140e25)[_0x4b6b('0x27')]();};}function respondWithResult(_0x352e01,_0x2b9643){_0x2b9643=_0x2b9643||0xc8;return function(_0x5c0a56){if(_0x5c0a56){return _0x352e01['status'](_0x2b9643)['json'](_0x5c0a56);}};}function respondWithFilteredResult(_0x15357b,_0x1b8ea1){return function(_0x112220){if(_0x112220){var _0x180416=typeof _0x1b8ea1[_0x4b6b('0x28')]===_0x4b6b('0x29')&&typeof _0x1b8ea1['limit']===_0x4b6b('0x29');var _0xfcd944=_0x112220[_0x4b6b('0x2a')];var _0x4a7451=_0x180416?0x0:_0x1b8ea1[_0x4b6b('0x28')];var _0x3b55b0=_0x180416?_0x112220[_0x4b6b('0x2a')]:_0x1b8ea1['offset']+_0x1b8ea1[_0x4b6b('0x2b')];var _0x477e39;if(_0x3b55b0>=_0xfcd944){_0x3b55b0=_0xfcd944;_0x477e39=0xc8;}else{_0x477e39=0xce;}_0x15357b[_0x4b6b('0x2c')](_0x477e39);return _0x15357b[_0x4b6b('0x2d')](_0x4b6b('0x2e'),_0x4a7451+'-'+_0x3b55b0+'/'+_0xfcd944)[_0x4b6b('0x2f')](_0x112220);}return null;};}function patchUpdates(_0x2b8e86){return function(_0x4d2408){try{jsonpatch[_0x4b6b('0x30')](_0x4d2408,_0x2b8e86,!![]);}catch(_0x4afe31){return BPromise[_0x4b6b('0x31')](_0x4afe31);}return _0x4d2408[_0x4b6b('0x32')]();};}function saveUpdates(_0x34375e,_0x4822d6){return function(_0x4e1a2a){if(_0x4e1a2a){return _0x4e1a2a[_0x4b6b('0x33')](_0x34375e)['then'](function(_0x503918){return _0x503918;});}return null;};}function removeEntity(_0x7c1c29,_0x55e82b){return function(_0xad0918){if(_0xad0918){return _0xad0918[_0x4b6b('0x34')]()[_0x4b6b('0x1a')](function(){var _0x5aaf5c=_0xad0918['get']({'plain':!![]});var _0xee6b99='Contexts';return db[_0x4b6b('0x35')]['destroy']({'where':{'type':_0xee6b99,'resourceId':_0x5aaf5c['id']}})['then'](function(){return _0xad0918;});})[_0x4b6b('0x1a')](function(){_0x7c1c29[_0x4b6b('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcfaeda,_0xb6b718){return function(_0x247442){if(!_0x247442){_0xcfaeda[_0x4b6b('0x26')](0x194);}return _0x247442;};}function handleError(_0x35bd14,_0x2575a3){_0x2575a3=_0x2575a3||0x1f4;return function(_0x4a96d9){logger['error'](_0x4a96d9[_0x4b6b('0x36')]);if(_0x4a96d9[_0x4b6b('0x37')]){delete _0x4a96d9[_0x4b6b('0x37')];}_0x35bd14[_0x4b6b('0x2c')](_0x2575a3)['send'](_0x4a96d9);};}exports[_0x4b6b('0x38')]=function(_0x23ddc3,_0x1e124e){var _0x322c92={},_0x2effb9={},_0x4ea42d={'count':0x0,'rows':[]};var _0x7b911d=_[_0x4b6b('0x39')](db[_0x4b6b('0x3a')][_0x4b6b('0x3b')],function(_0x470f61){return{'name':_0x470f61['fieldName'],'type':_0x470f61[_0x4b6b('0x3c')][_0x4b6b('0x3d')]};});_0x2effb9[_0x4b6b('0x3e')]=_[_0x4b6b('0x39')](_0x7b911d,_0x4b6b('0x37'));_0x2effb9['query']=_[_0x4b6b('0x3f')](_0x23ddc3[_0x4b6b('0x40')]);_0x2effb9['filters']=_[_0x4b6b('0x41')](_0x2effb9[_0x4b6b('0x3e')],_0x2effb9['query']);_0x322c92[_0x4b6b('0x42')]=_[_0x4b6b('0x41')](_0x2effb9[_0x4b6b('0x3e')],qs[_0x4b6b('0x43')](_0x23ddc3[_0x4b6b('0x40')][_0x4b6b('0x43')]));_0x322c92[_0x4b6b('0x42')]=_0x322c92[_0x4b6b('0x42')][_0x4b6b('0x44')]?_0x322c92[_0x4b6b('0x42')]:_0x2effb9[_0x4b6b('0x3e')];if(!_0x23ddc3[_0x4b6b('0x40')]['hasOwnProperty']('nolimit')){_0x322c92['limit']=qs[_0x4b6b('0x2b')](_0x23ddc3[_0x4b6b('0x40')][_0x4b6b('0x2b')]);_0x322c92[_0x4b6b('0x28')]=qs[_0x4b6b('0x28')](_0x23ddc3[_0x4b6b('0x40')][_0x4b6b('0x28')]);}_0x322c92['order']=qs[_0x4b6b('0x45')](_0x23ddc3[_0x4b6b('0x40')][_0x4b6b('0x45')]);_0x322c92['where']=qs['filters'](_[_0x4b6b('0x46')](_0x23ddc3[_0x4b6b('0x40')],_0x2effb9[_0x4b6b('0x47')]),_0x7b911d);if(_0x23ddc3[_0x4b6b('0x40')][_0x4b6b('0x48')]){_0x322c92['where']=_[_0x4b6b('0x49')](_0x322c92[_0x4b6b('0x4a')],{'$or':_[_0x4b6b('0x39')](_0x7b911d,function(_0x534f13){if(_0x534f13[_0x4b6b('0x3c')]!==_0x4b6b('0x4b')){var _0x23ac56={};_0x23ac56[_0x534f13['name']]={'$like':'%'+_0x23ddc3[_0x4b6b('0x40')][_0x4b6b('0x48')]+'%'};return _0x23ac56;}})});}_0x322c92=_[_0x4b6b('0x49')]({},_0x322c92,_0x23ddc3['options']);var _0x3b5e04={'where':_0x322c92[_0x4b6b('0x4a')]};return db[_0x4b6b('0x3a')][_0x4b6b('0x2a')](_0x3b5e04)[_0x4b6b('0x1a')](function(_0x1e4f22){_0x4ea42d[_0x4b6b('0x2a')]=_0x1e4f22;if(_0x23ddc3[_0x4b6b('0x40')][_0x4b6b('0x4c')]){_0x322c92[_0x4b6b('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x4b6b('0x4e')](_0x322c92);})['then'](function(_0x3b37fc){_0x4ea42d['rows']=_0x3b37fc;return _0x4ea42d;})[_0x4b6b('0x1a')](respondWithFilteredResult(_0x1e124e,_0x322c92))[_0x4b6b('0x25')](handleError(_0x1e124e,null));};exports[_0x4b6b('0x4f')]=function(_0x27d975,_0xb526c9){var _0x4c2dae={'raw':![],'where':{'id':_0x27d975[_0x4b6b('0x50')]['id']}},_0x299fd2={};_0x299fd2['model']=_[_0x4b6b('0x3f')](db[_0x4b6b('0x3a')]['rawAttributes']);_0x299fd2[_0x4b6b('0x40')]=_[_0x4b6b('0x3f')](_0x27d975[_0x4b6b('0x40')]);_0x299fd2[_0x4b6b('0x47')]=_[_0x4b6b('0x41')](_0x299fd2[_0x4b6b('0x3e')],_0x299fd2['query']);_0x4c2dae[_0x4b6b('0x42')]=_['intersection'](_0x299fd2[_0x4b6b('0x3e')],qs[_0x4b6b('0x43')](_0x27d975['query'][_0x4b6b('0x43')]));_0x4c2dae[_0x4b6b('0x42')]=_0x4c2dae[_0x4b6b('0x42')]['length']?_0x4c2dae[_0x4b6b('0x42')]:_0x299fd2[_0x4b6b('0x3e')];if(_0x27d975[_0x4b6b('0x40')]['includeAll']){_0x4c2dae[_0x4b6b('0x4d')]=[{'all':!![]}];}_0x4c2dae=_[_0x4b6b('0x49')]({},_0x4c2dae,_0x27d975[_0x4b6b('0x51')]);return db[_0x4b6b('0x3a')]['find'](_0x4c2dae)[_0x4b6b('0x1a')](handleEntityNotFound(_0xb526c9,null))[_0x4b6b('0x1a')](respondWithResult(_0xb526c9,null))[_0x4b6b('0x25')](handleError(_0xb526c9,null));};exports['create']=function(_0x186def,_0x3e25ba,_0x4f7f1c){var _0x18ee34;return db['VoiceContext'][_0x4b6b('0x52')](_0x186def['body'],{'raw':!![]})[_0x4b6b('0x1a')](function(_0x3c0d82){_0x18ee34=_0x3c0d82;return db[_0x4b6b('0x3a')]['findAll']({'raw':!![]});})[_0x4b6b('0x1a')](function(_0x294f5e){var _0x62a38d=fs[_0x4b6b('0x53')](path[_0x4b6b('0x54')](config[_0x4b6b('0x55')],_0x4b6b('0x56')),_0x4b6b('0x57'));var _0x39d50d=ejs[_0x4b6b('0x58')](_0x62a38d,{'contexts':_0x294f5e||[]});fs[_0x4b6b('0x59')](_0x4b6b('0x5a'),_0x39d50d);})['then'](function(){return respondWithRpcPromise('Reload',_0x4b6b('0x52'),{'module':'chan_sip.so'});})[_0x4b6b('0x1a')](function(){var _0x3f9466=_0x186def[_0x4b6b('0x5b')][_0x4b6b('0x5c')]({'plain':!![]});if(!_0x3f9466)throw new Error(_0x4b6b('0x5d'));if(_0x3f9466[_0x4b6b('0x5e')]===_0x4b6b('0x5b')){var _0x47dd78=_0x18ee34[_0x4b6b('0x5c')]({'plain':!![]});return db[_0x4b6b('0x5f')][_0x4b6b('0x60')]({'where':{'name':_0x4b6b('0x61'),'userProfileId':_0x3f9466[_0x4b6b('0x62')]},'raw':!![]})[_0x4b6b('0x1a')](function(_0x3ebaa4){if(_0x3ebaa4&&_0x3ebaa4['autoAssociation']===0x0){return db[_0x4b6b('0x35')][_0x4b6b('0x52')]({'name':_0x47dd78['name'],'resourceId':_0x47dd78['id'],'type':_0x3ebaa4[_0x4b6b('0x37')],'sectionId':_0x3ebaa4['id']},{})['then'](function(){return _0x18ee34;});}else{return _0x18ee34;}})['catch'](function(_0x3f3c81){logger[_0x4b6b('0x21')](_0x4b6b('0x63'),_0x3f3c81);throw _0x3f3c81;});}return _0x18ee34;})['then'](respondWithResult(_0x3e25ba,0xc9))[_0x4b6b('0x25')](handleError(_0x3e25ba,null));};exports[_0x4b6b('0x33')]=function(_0x323400,_0x138997,_0x2b7635){var _0x9b0c09;return db[_0x4b6b('0x3a')][_0x4b6b('0x60')]({'where':{'id':_0x323400['params']['id']}})[_0x4b6b('0x1a')](handleEntityNotFound(_0x138997,null))[_0x4b6b('0x1a')](saveUpdates(_0x323400[_0x4b6b('0x64')],null))[_0x4b6b('0x1a')](function(_0x4e9fb9){if(_0x4e9fb9){_0x9b0c09=_0x4e9fb9;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x4b6b('0x1a')](function(_0x3bfc7b){var _0x8e78cd=fs[_0x4b6b('0x53')](path[_0x4b6b('0x54')](config['root'],_0x4b6b('0x56')),_0x4b6b('0x57'));var _0x5e68c2=ejs[_0x4b6b('0x58')](_0x8e78cd,{'contexts':_0x3bfc7b||[]});fs[_0x4b6b('0x59')](_0x4b6b('0x5a'),_0x5e68c2);})[_0x4b6b('0x1a')](function(){return respondWithRpcPromise(_0x4b6b('0x65'),'update',{'module':_0x4b6b('0x66')});})[_0x4b6b('0x1a')](function(){return _0x9b0c09;})['then'](respondWithResult(_0x138997,null))[_0x4b6b('0x25')](handleError(_0x138997,null));};exports[_0x4b6b('0x34')]=function(_0x33edd7,_0x3e66d3,_0x3d49b8){var _0x4230a3;return db[_0x4b6b('0x3a')]['find']({'where':{'id':_0x33edd7[_0x4b6b('0x50')]['id']}})[_0x4b6b('0x1a')](handleEntityNotFound(_0x3e66d3,null))[_0x4b6b('0x1a')](removeEntity(_0x3e66d3,null))['then'](function(){return db[_0x4b6b('0x3a')][_0x4b6b('0x4e')]({'raw':!![]});})[_0x4b6b('0x1a')](function(_0x3938d3){var _0x326fb3=fs[_0x4b6b('0x53')](path[_0x4b6b('0x54')](config['root'],_0x4b6b('0x56')),_0x4b6b('0x57'));var _0x19cc1d=ejs[_0x4b6b('0x58')](_0x326fb3,{'contexts':_0x3938d3});fs[_0x4b6b('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x19cc1d);return respondWithRpcPromise(_0x4b6b('0x65'),_0x4b6b('0x34'),{'module':_0x4b6b('0x66')});})[_0x4b6b('0x25')](handleError(_0x3e66d3,null));}; \ No newline at end of file +var _0x1388=['includeAll','include','findAll','show','params','rawAttributes','find','body','join','server/files/templates/context.ejs','utf8','render','Reload','create','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','readFileSync','root','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','client','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceContext','fieldName','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x2a5671,_0x2dac05){var _0x1f3431=function(_0x3ae119){while(--_0x3ae119){_0x2a5671['push'](_0x2a5671['shift']());}};_0x1f3431(++_0x2dac05);}(_0x1388,0x1b7));var _0x8138=function(_0x25b40d,_0x3d8e6c){_0x25b40d=_0x25b40d-0x0;var _0x25adab=_0x1388[_0x25b40d];return _0x25adab;};'use strict';var emlformat=require(_0x8138('0x0'));var rimraf=require(_0x8138('0x1'));var zipdir=require(_0x8138('0x2'));var jsonpatch=require(_0x8138('0x3'));var rp=require(_0x8138('0x4'));var moment=require(_0x8138('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8138('0x6'));var util=require(_0x8138('0x7'));var path=require('path');var sox=require(_0x8138('0x8'));var csv=require(_0x8138('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8138('0xa'));var _=require(_0x8138('0xb'));var squel=require(_0x8138('0xc'));var crypto=require(_0x8138('0xd'));var jsforce=require(_0x8138('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8138('0x9'));var querystring=require(_0x8138('0xf'));var Papa=require('papaparse');var Redis=require(_0x8138('0x10'));var authService=require(_0x8138('0x11'));var qs=require(_0x8138('0x12'));var as=require(_0x8138('0x13'));var hardwareService=require(_0x8138('0x14'));var logger=require(_0x8138('0x15'))(_0x8138('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8138('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8138('0x18')][_0x8138('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x388153,_0x117016,_0x3b2fe5,_0x2eb25a){return new BPromise(function(_0xdaed13,_0x2f13be){var _0x4d2e3a=_0x2eb25a||client;return _0x4d2e3a[_0x8138('0x1a')](_0x388153,_0x3b2fe5)['then'](function(_0x2281f9){logger['info'](_0x8138('0x1b'),_0x117016,_0x8138('0x1c'));logger[_0x8138('0x1d')](_0x8138('0x1e'),_0x117016,'request\x20sent',JSON[_0x8138('0x1f')](_0x2281f9));if(_0x2281f9['error']){if(_0x2281f9[_0x8138('0x20')][_0x8138('0x21')]===0x1f4){logger[_0x8138('0x20')](_0x8138('0x1b'),_0x117016,_0x2281f9['error'][_0x8138('0x22')]);return _0x2f13be(_0x2281f9[_0x8138('0x20')][_0x8138('0x22')]);}logger[_0x8138('0x20')]('VoiceContext,\x20%s,\x20%s',_0x117016,_0x2281f9[_0x8138('0x20')][_0x8138('0x22')]);return _0xdaed13(_0x2281f9['error'][_0x8138('0x22')]);}else{logger[_0x8138('0x23')](_0x8138('0x1b'),_0x117016,_0x8138('0x1c'));_0xdaed13(_0x2281f9[_0x8138('0x24')][_0x8138('0x22')]);}})[_0x8138('0x25')](function(_0x281dc0){logger[_0x8138('0x20')](_0x8138('0x1b'),_0x117016,_0x281dc0);_0x2f13be(_0x281dc0);});});}function respondWithStatusCode(_0x44da43,_0x523988){_0x523988=_0x523988||0xcc;return function(_0x657516){if(_0x657516){return _0x44da43['sendStatus'](_0x523988);}return _0x44da43['status'](_0x523988)[_0x8138('0x26')]();};}function respondWithResult(_0x34e0d0,_0x822c65){_0x822c65=_0x822c65||0xc8;return function(_0x3542f1){if(_0x3542f1){return _0x34e0d0[_0x8138('0x27')](_0x822c65)[_0x8138('0x28')](_0x3542f1);}};}function respondWithFilteredResult(_0x74e246,_0x59aebd){return function(_0x212f44){if(_0x212f44){var _0x352cbb=typeof _0x59aebd[_0x8138('0x29')]===_0x8138('0x2a')&&typeof _0x59aebd[_0x8138('0x2b')]===_0x8138('0x2a');var _0x5e3a0f=_0x212f44[_0x8138('0x2c')];var _0x109fbb=_0x352cbb?0x0:_0x59aebd[_0x8138('0x29')];var _0x2c2259=_0x352cbb?_0x212f44[_0x8138('0x2c')]:_0x59aebd[_0x8138('0x29')]+_0x59aebd[_0x8138('0x2b')];var _0x2737c2;if(_0x2c2259>=_0x5e3a0f){_0x2c2259=_0x5e3a0f;_0x2737c2=0xc8;}else{_0x2737c2=0xce;}_0x74e246[_0x8138('0x27')](_0x2737c2);return _0x74e246[_0x8138('0x2d')](_0x8138('0x2e'),_0x109fbb+'-'+_0x2c2259+'/'+_0x5e3a0f)['json'](_0x212f44);}return null;};}function patchUpdates(_0xce63e8){return function(_0x162120){try{jsonpatch[_0x8138('0x2f')](_0x162120,_0xce63e8,!![]);}catch(_0x26ed91){return BPromise[_0x8138('0x30')](_0x26ed91);}return _0x162120['save']();};}function saveUpdates(_0x33120d,_0x4fa8cc){return function(_0x2dd768){if(_0x2dd768){return _0x2dd768[_0x8138('0x31')](_0x33120d)[_0x8138('0x32')](function(_0x26f69f){return _0x26f69f;});}return null;};}function removeEntity(_0x387ddf,_0x2902c3){return function(_0x3d6979){if(_0x3d6979){return _0x3d6979[_0x8138('0x33')]()['then'](function(){var _0x345d26=_0x3d6979[_0x8138('0x34')]({'plain':!![]});var _0x39cb1c=_0x8138('0x35');return db[_0x8138('0x36')][_0x8138('0x33')]({'where':{'type':_0x39cb1c,'resourceId':_0x345d26['id']}})[_0x8138('0x32')](function(){return _0x3d6979;});})['then'](function(){_0x387ddf[_0x8138('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24c48a,_0x29b640){return function(_0x12d649){if(!_0x12d649){_0x24c48a[_0x8138('0x37')](0x194);}return _0x12d649;};}function handleError(_0x2338aa,_0x3dfb94){_0x3dfb94=_0x3dfb94||0x1f4;return function(_0x4aef1a){logger[_0x8138('0x20')](_0x4aef1a[_0x8138('0x38')]);if(_0x4aef1a['name']){delete _0x4aef1a[_0x8138('0x39')];}_0x2338aa[_0x8138('0x27')](_0x3dfb94)[_0x8138('0x3a')](_0x4aef1a);};}exports[_0x8138('0x3b')]=function(_0x1a40ab,_0x56e53c){var _0x11312f={},_0x1b36c4={},_0x28ad17={'count':0x0,'rows':[]};var _0x24e979=_[_0x8138('0x3c')](db[_0x8138('0x3d')]['rawAttributes'],function(_0x21235c){return{'name':_0x21235c[_0x8138('0x3e')],'type':_0x21235c['type']['key']};});_0x1b36c4['model']=_[_0x8138('0x3c')](_0x24e979,_0x8138('0x39'));_0x1b36c4['query']=_[_0x8138('0x3f')](_0x1a40ab[_0x8138('0x40')]);_0x1b36c4[_0x8138('0x41')]=_['intersection'](_0x1b36c4[_0x8138('0x42')],_0x1b36c4[_0x8138('0x40')]);_0x11312f[_0x8138('0x43')]=_[_0x8138('0x44')](_0x1b36c4[_0x8138('0x42')],qs['fields'](_0x1a40ab['query'][_0x8138('0x45')]));_0x11312f[_0x8138('0x43')]=_0x11312f['attributes'][_0x8138('0x46')]?_0x11312f[_0x8138('0x43')]:_0x1b36c4['model'];if(!_0x1a40ab['query'][_0x8138('0x47')]('nolimit')){_0x11312f[_0x8138('0x2b')]=qs[_0x8138('0x2b')](_0x1a40ab[_0x8138('0x40')][_0x8138('0x2b')]);_0x11312f[_0x8138('0x29')]=qs[_0x8138('0x29')](_0x1a40ab[_0x8138('0x40')][_0x8138('0x29')]);}_0x11312f[_0x8138('0x48')]=qs[_0x8138('0x49')](_0x1a40ab[_0x8138('0x40')]['sort']);_0x11312f[_0x8138('0x4a')]=qs['filters'](_[_0x8138('0x4b')](_0x1a40ab[_0x8138('0x40')],_0x1b36c4[_0x8138('0x41')]),_0x24e979);if(_0x1a40ab[_0x8138('0x40')][_0x8138('0x4c')]){_0x11312f['where']=_[_0x8138('0x4d')](_0x11312f[_0x8138('0x4a')],{'$or':_[_0x8138('0x3c')](_0x24e979,function(_0x316b95){if(_0x316b95[_0x8138('0x4e')]!==_0x8138('0x4f')){var _0x21e40e={};_0x21e40e[_0x316b95[_0x8138('0x39')]]={'$like':'%'+_0x1a40ab[_0x8138('0x40')][_0x8138('0x4c')]+'%'};return _0x21e40e;}})});}_0x11312f=_[_0x8138('0x4d')]({},_0x11312f,_0x1a40ab[_0x8138('0x50')]);var _0x88e882={'where':_0x11312f[_0x8138('0x4a')]};return db[_0x8138('0x3d')]['count'](_0x88e882)[_0x8138('0x32')](function(_0x13891b){_0x28ad17[_0x8138('0x2c')]=_0x13891b;if(_0x1a40ab[_0x8138('0x40')][_0x8138('0x51')]){_0x11312f[_0x8138('0x52')]=[{'all':!![]}];}return db[_0x8138('0x3d')][_0x8138('0x53')](_0x11312f);})[_0x8138('0x32')](function(_0x75fc99){_0x28ad17['rows']=_0x75fc99;return _0x28ad17;})['then'](respondWithFilteredResult(_0x56e53c,_0x11312f))[_0x8138('0x25')](handleError(_0x56e53c,null));};exports[_0x8138('0x54')]=function(_0x2832c9,_0x3c84e6){var _0x1bfffa={'raw':![],'where':{'id':_0x2832c9[_0x8138('0x55')]['id']}},_0x4723f8={};_0x4723f8[_0x8138('0x42')]=_[_0x8138('0x3f')](db[_0x8138('0x3d')][_0x8138('0x56')]);_0x4723f8[_0x8138('0x40')]=_[_0x8138('0x3f')](_0x2832c9[_0x8138('0x40')]);_0x4723f8['filters']=_[_0x8138('0x44')](_0x4723f8[_0x8138('0x42')],_0x4723f8['query']);_0x1bfffa['attributes']=_[_0x8138('0x44')](_0x4723f8['model'],qs[_0x8138('0x45')](_0x2832c9[_0x8138('0x40')]['fields']));_0x1bfffa[_0x8138('0x43')]=_0x1bfffa[_0x8138('0x43')][_0x8138('0x46')]?_0x1bfffa['attributes']:_0x4723f8['model'];if(_0x2832c9[_0x8138('0x40')][_0x8138('0x51')]){_0x1bfffa['include']=[{'all':!![]}];}_0x1bfffa=_[_0x8138('0x4d')]({},_0x1bfffa,_0x2832c9[_0x8138('0x50')]);return db[_0x8138('0x3d')][_0x8138('0x57')](_0x1bfffa)['then'](handleEntityNotFound(_0x3c84e6,null))[_0x8138('0x32')](respondWithResult(_0x3c84e6,null))['catch'](handleError(_0x3c84e6,null));};exports['create']=function(_0x193281,_0x4c8975,_0x4f0180){var _0x2a2751;return db['VoiceContext']['create'](_0x193281[_0x8138('0x58')],{'raw':!![]})[_0x8138('0x32')](function(_0x53c6e7){_0x2a2751=_0x53c6e7;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x213aec){var _0x6a2225=fs['readFileSync'](path[_0x8138('0x59')](config['root'],_0x8138('0x5a')),_0x8138('0x5b'));var _0x5ee992=ejs[_0x8138('0x5c')](_0x6a2225,{'contexts':_0x213aec||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x5ee992);})['then'](function(){return respondWithRpcPromise(_0x8138('0x5d'),_0x8138('0x5e'),{'module':_0x8138('0x5f')});})[_0x8138('0x32')](function(){var _0x187993=_0x193281['user'][_0x8138('0x34')]({'plain':!![]});if(!_0x187993)throw new Error(_0x8138('0x60'));if(_0x187993[_0x8138('0x61')]===_0x8138('0x62')){var _0x4cfcbe=_0x2a2751['get']({'plain':!![]});return db['UserProfileSection'][_0x8138('0x57')]({'where':{'name':_0x8138('0x35'),'userProfileId':_0x187993[_0x8138('0x63')]},'raw':!![]})[_0x8138('0x32')](function(_0x4035f5){if(_0x4035f5&&_0x4035f5['autoAssociation']===0x0){return db[_0x8138('0x36')][_0x8138('0x5e')]({'name':_0x4cfcbe[_0x8138('0x39')],'resourceId':_0x4cfcbe['id'],'type':_0x4035f5[_0x8138('0x39')],'sectionId':_0x4035f5['id']},{})['then'](function(){return _0x2a2751;});}else{return _0x2a2751;}})[_0x8138('0x25')](function(_0x5e86d0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e86d0);throw _0x5e86d0;});}return _0x2a2751;})[_0x8138('0x32')](respondWithResult(_0x4c8975,0xc9))[_0x8138('0x25')](handleError(_0x4c8975,null));};exports[_0x8138('0x31')]=function(_0x204853,_0x8bd969,_0x1b94d4){var _0x266a1b;return db[_0x8138('0x3d')][_0x8138('0x57')]({'where':{'id':_0x204853[_0x8138('0x55')]['id']}})[_0x8138('0x32')](handleEntityNotFound(_0x8bd969,null))['then'](saveUpdates(_0x204853[_0x8138('0x58')],null))[_0x8138('0x32')](function(_0x5ed66c){if(_0x5ed66c){_0x266a1b=_0x5ed66c;return db[_0x8138('0x3d')][_0x8138('0x53')]({'raw':!![]});}})[_0x8138('0x32')](function(_0x1bfeee){var _0x2dc6b0=fs[_0x8138('0x64')](path[_0x8138('0x59')](config[_0x8138('0x65')],_0x8138('0x5a')),'utf8');var _0x43e10f=ejs['render'](_0x2dc6b0,{'contexts':_0x1bfeee||[]});fs[_0x8138('0x66')](_0x8138('0x67'),_0x43e10f);})[_0x8138('0x32')](function(){return respondWithRpcPromise(_0x8138('0x5d'),'update',{'module':_0x8138('0x5f')});})['then'](function(){return _0x266a1b;})['then'](respondWithResult(_0x8bd969,null))[_0x8138('0x25')](handleError(_0x8bd969,null));};exports[_0x8138('0x33')]=function(_0x4cc523,_0x2854bd,_0x384e0e){var _0x1b5841;return db['VoiceContext']['find']({'where':{'id':_0x4cc523[_0x8138('0x55')]['id']}})[_0x8138('0x32')](handleEntityNotFound(_0x2854bd,null))[_0x8138('0x32')](removeEntity(_0x2854bd,null))[_0x8138('0x32')](function(){return db['VoiceContext'][_0x8138('0x53')]({'raw':!![]});})[_0x8138('0x32')](function(_0x9dc6a2){var _0x50689d=fs[_0x8138('0x64')](path['join'](config[_0x8138('0x65')],'server/files/templates/context.ejs'),_0x8138('0x5b'));var _0x143a34=ejs[_0x8138('0x5c')](_0x50689d,{'contexts':_0x9dc6a2});fs['writeFileSync'](_0x8138('0x67'),_0x143a34);return respondWithRpcPromise(_0x8138('0x5d'),_0x8138('0x33'),{'module':_0x8138('0x5f')});})[_0x8138('0x25')](handleError(_0x2854bd,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 2a75c5a..efb8f65 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 _0x2129=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts'];(function(_0x2738e0,_0x5e9864){var _0x17e4cd=function(_0xbbf2cd){while(--_0xbbf2cd){_0x2738e0['push'](_0x2738e0['shift']());}};_0x17e4cd(++_0x5e9864);}(_0x2129,0x1ea));var _0x9212=function(_0xa4745c,_0x4caa79){_0xa4745c=_0xa4745c-0x0;var _0x17a87f=_0x2129[_0xa4745c];return _0x17a87f;};'use strict';var _=require('lodash');var util=require(_0x9212('0x0'));var logger=require(_0x9212('0x1'))('api');var moment=require(_0x9212('0x2'));var BPromise=require(_0x9212('0x3'));var rp=require(_0x9212('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9212('0x5'));var attributes=require(_0x9212('0x6'));module[_0x9212('0x7')]=function(_0x32d5c8,_0x400a5e){return _0x32d5c8['define'](_0x9212('0x8'),attributes,{'tableName':_0x9212('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88cc=['bluebird','request-promise','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment'];(function(_0x1bfb0d,_0x56dc90){var _0x5dbd3c=function(_0x4cb67b){while(--_0x4cb67b){_0x1bfb0d['push'](_0x1bfb0d['shift']());}};_0x5dbd3c(++_0x56dc90);}(_0x88cc,0xc1));var _0xc88c=function(_0x5ab340,_0x3bf3e4){_0x5ab340=_0x5ab340-0x0;var _0x2ed5b7=_0x88cc[_0x5ab340];return _0x2ed5b7;};'use strict';var _=require(_0xc88c('0x0'));var util=require(_0xc88c('0x1'));var logger=require(_0xc88c('0x2'))(_0xc88c('0x3'));var moment=require(_0xc88c('0x4'));var BPromise=require(_0xc88c('0x5'));var rp=require(_0xc88c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc88c('0x7'));module['exports']=function(_0x30eef2,_0x4caf1c){return _0x30eef2[_0xc88c('0x8')](_0xc88c('0x9'),attributes,{'tableName':_0xc88c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 2367bd6..aeae8da 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 _0x7fce=['VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error'];(function(_0x278607,_0x52f65f){var _0x162d37=function(_0x34e139){while(--_0x34e139){_0x278607['push'](_0x278607['shift']());}};_0x162d37(++_0x52f65f);}(_0x7fce,0xdc));var _0xe7fc=function(_0x14ddf6,_0xbdeaa3){_0x14ddf6=_0x14ddf6-0x0;var _0x13e9f9=_0x7fce[_0x14ddf6];return _0x13e9f9;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var moment=require(_0xe7fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7fc('0x5'))(_0xe7fc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4665f6,_0x161dca,_0x296b2e){return new BPromise(function(_0x19eeef,_0x22fabf){return client['request'](_0x4665f6,_0x296b2e)[_0xe7fc('0x8')](function(_0x4a1209){logger[_0xe7fc('0x9')]('VoiceContext,\x20%s,\x20%s',_0x161dca,_0xe7fc('0xa'));logger[_0xe7fc('0xb')](_0xe7fc('0xc'),_0x161dca,_0xe7fc('0xa'),JSON['stringify'](_0x4a1209));if(_0x4a1209[_0xe7fc('0xd')]){if(_0x4a1209[_0xe7fc('0xd')]['code']===0x1f4){logger['error'](_0xe7fc('0xe'),_0x161dca,_0x4a1209['error'][_0xe7fc('0xf')]);return _0x22fabf(_0x4a1209['error']['message']);}logger[_0xe7fc('0xd')](_0xe7fc('0xe'),_0x161dca,_0x4a1209[_0xe7fc('0xd')][_0xe7fc('0xf')]);return _0x19eeef(_0x4a1209[_0xe7fc('0xd')]['message']);}else{logger[_0xe7fc('0x9')]('VoiceContext,\x20%s,\x20%s',_0x161dca,'request\x20sent');_0x19eeef(_0x4a1209[_0xe7fc('0x10')][_0xe7fc('0xf')]);}})[_0xe7fc('0x11')](function(_0x3a44a6){logger['error']('VoiceContext,\x20%s,\x20%s',_0x161dca,_0x3a44a6);_0x22fabf(_0x3a44a6);});});} \ No newline at end of file +var _0xb235=['jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2cebb3,_0x4d89bc){var _0x4b1623=function(_0x38693b){while(--_0x38693b){_0x2cebb3['push'](_0x2cebb3['shift']());}};_0x4b1623(++_0x4d89bc);}(_0xb235,0xb5));var _0x5b23=function(_0x453704,_0xcf42a8){_0x453704=_0x453704-0x0;var _0x1d1ba5=_0xb235[_0x453704];return _0x1d1ba5;};'use strict';var _=require(_0x5b23('0x0'));var util=require(_0x5b23('0x1'));var moment=require('moment');var BPromise=require(_0x5b23('0x2'));var rs=require(_0x5b23('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b23('0x4'))['db'];var utils=require(_0x5b23('0x5'));var logger=require(_0x5b23('0x6'))('rpc');var config=require(_0x5b23('0x7'));var jayson=require(_0x5b23('0x8'));var client=jayson[_0x5b23('0x9')][_0x5b23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d94a4,_0x5e390,_0x5ce7c4){return new BPromise(function(_0xe27265,_0x37e7ce){return client[_0x5b23('0xb')](_0x1d94a4,_0x5ce7c4)['then'](function(_0x5af4e2){logger[_0x5b23('0xc')](_0x5b23('0xd'),_0x5e390,_0x5b23('0xe'));logger['debug'](_0x5b23('0xf'),_0x5e390,'request\x20sent',JSON[_0x5b23('0x10')](_0x5af4e2));if(_0x5af4e2[_0x5b23('0x11')]){if(_0x5af4e2[_0x5b23('0x11')][_0x5b23('0x12')]===0x1f4){logger[_0x5b23('0x11')]('VoiceContext,\x20%s,\x20%s',_0x5e390,_0x5af4e2[_0x5b23('0x11')][_0x5b23('0x13')]);return _0x37e7ce(_0x5af4e2[_0x5b23('0x11')][_0x5b23('0x13')]);}logger[_0x5b23('0x11')](_0x5b23('0xd'),_0x5e390,_0x5af4e2[_0x5b23('0x11')]['message']);return _0xe27265(_0x5af4e2[_0x5b23('0x11')][_0x5b23('0x13')]);}else{logger['info'](_0x5b23('0xd'),_0x5e390,_0x5b23('0xe'));_0xe27265(_0x5af4e2['result']['message']);}})[_0x5b23('0x14')](function(_0x515f56){logger[_0x5b23('0x11')](_0x5b23('0xd'),_0x5e390,_0x515f56);_0x37e7ce(_0x515f56);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index aff2b37..8a19b76 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 _0x9926=['/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','describe'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x9926,0x104));var _0x6992=function(_0xf0b39e,_0xcf87c){_0xf0b39e=_0xf0b39e-0x0;var _0x141678=_0x9926[_0xf0b39e];return _0x141678;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6992('0x0'));var timeout=require(_0x6992('0x1'));var express=require(_0x6992('0x2'));var router=express[_0x6992('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6992('0x4'));var config=require('../../config/environment');var controller=require(_0x6992('0x5'));router[_0x6992('0x6')]('/',auth[_0x6992('0x7')](),controller[_0x6992('0x8')]);router[_0x6992('0x6')]('/describe',auth[_0x6992('0x7')](),controller[_0x6992('0x9')]);router[_0x6992('0x6')](_0x6992('0xa'),auth[_0x6992('0x7')](),controller[_0x6992('0xb')]);router[_0x6992('0xc')]('/',auth[_0x6992('0x7')](),controller[_0x6992('0xd')]);router[_0x6992('0xe')](_0x6992('0xa'),auth[_0x6992('0x7')](),controller[_0x6992('0xf')]);router[_0x6992('0x10')](_0x6992('0xa'),auth[_0x6992('0x7')](),controller['destroy']);module[_0x6992('0x11')]=router; \ No newline at end of file +var _0x0bb2=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','delete','destroy','exports','multer'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0x0bb2,0x72));var _0x20bb=function(_0x5f1cda,_0x142aaf){_0x5f1cda=_0x5f1cda-0x0;var _0x1706aa=_0x0bb2[_0x5f1cda];return _0x1706aa;};'use strict';var multer=require(_0x20bb('0x0'));var util=require(_0x20bb('0x1'));var path=require(_0x20bb('0x2'));var timeout=require(_0x20bb('0x3'));var express=require(_0x20bb('0x4'));var router=express[_0x20bb('0x5')]();var fs_extra=require(_0x20bb('0x6'));var auth=require(_0x20bb('0x7'));var interaction=require(_0x20bb('0x8'));var config=require(_0x20bb('0x9'));var controller=require(_0x20bb('0xa'));router[_0x20bb('0xb')]('/',auth[_0x20bb('0xc')](),controller[_0x20bb('0xd')]);router['get'](_0x20bb('0xe'),auth[_0x20bb('0xc')](),controller[_0x20bb('0xf')]);router[_0x20bb('0xb')]('/:id',auth[_0x20bb('0xc')](),controller[_0x20bb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x20bb('0x11')]);router[_0x20bb('0x12')](_0x20bb('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x20bb('0x14')](_0x20bb('0x13'),auth[_0x20bb('0xc')](),controller[_0x20bb('0x15')]);module[_0x20bb('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 0493bb1..529ae13 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0xde9059,_0x750aab){var _0x23197d=function(_0x457724){while(--_0x457724){_0xde9059['push'](_0xde9059['shift']());}};_0x23197d(++_0x750aab);}(_0x98a8,0x12c));var _0x898a=function(_0x1c6258,_0x8d211c){_0x1c6258=_0x1c6258-0x0;var _0x507e29=_0x98a8[_0x1c6258];return _0x507e29;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file +var _0x008c=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x5a2019,_0x22b60a){var _0x2f9250=function(_0x4ff1b2){while(--_0x4ff1b2){_0x5a2019['push'](_0x5a2019['shift']());}};_0x2f9250(++_0x22b60a);}(_0x008c,0x188));var _0xc008=function(_0x4d554d,_0x4e7503){_0x4d554d=_0x4d554d-0x0;var _0x3cf518=_0x008c[_0x4d554d];return _0x3cf518;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'privilege':{'type':Sequelize[_0xc008('0x2')]},'channel':{'type':Sequelize[_0xc008('0x2')]},'channelstate':{'type':Sequelize[_0xc008('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc008('0x2')]},'calleridname':{'type':Sequelize[_0xc008('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'connectedlinename':{'type':Sequelize[_0xc008('0x2')]},'language':{'type':Sequelize[_0xc008('0x2')]},'accountcode':{'type':Sequelize[_0xc008('0x2')]},'context':{'type':Sequelize[_0xc008('0x2')]},'exten':{'type':Sequelize[_0xc008('0x2')]},'priority':{'type':Sequelize[_0xc008('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc008('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc008('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc008('0x2')]},'destexten':{'type':Sequelize[_0xc008('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc008('0x2')]},'destlinkedid':{'type':Sequelize[_0xc008('0x2')]},'dialstring':{'type':Sequelize[_0xc008('0x2')]},'dialstatus':{'type':Sequelize[_0xc008('0x2')]},'starttime':{'type':Sequelize[_0xc008('0x4')]},'answertime':{'type':Sequelize[_0xc008('0x4')]},'endtime':{'type':Sequelize[_0xc008('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xc008('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc008('0x3')]},'billableseconds':{'type':Sequelize[_0xc008('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a76d482..04eb474 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 _0x8165=['then','sendStatus','error','stack','name','send','map','VoiceDialReport','rawAttributes','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','intersection','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy'];(function(_0x15de73,_0x4aaad7){var _0x522d64=function(_0x1f1f67){while(--_0x1f1f67){_0x15de73['push'](_0x15de73['shift']());}};_0x522d64(++_0x4aaad7);}(_0x8165,0xfa));var _0x5816=function(_0x3bf5bd,_0x2c3428){_0x3bf5bd=_0x3bf5bd-0x0;var _0x2eb17e=_0x8165[_0x3bf5bd];return _0x2eb17e;};'use strict';var emlformat=require(_0x5816('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5816('0x1'));var jsonpatch=require(_0x5816('0x2'));var rp=require('request-promise');var moment=require(_0x5816('0x3'));var BPromise=require(_0x5816('0x4'));var Mustache=require(_0x5816('0x5'));var util=require(_0x5816('0x6'));var path=require(_0x5816('0x7'));var sox=require(_0x5816('0x8'));var csv=require(_0x5816('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5816('0xa'));var _=require(_0x5816('0xb'));var squel=require(_0x5816('0xc'));var crypto=require('crypto');var jsforce=require(_0x5816('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5816('0x9'));var querystring=require('querystring');var Papa=require(_0x5816('0xe'));var Redis=require('ioredis');var authService=require(_0x5816('0xf'));var qs=require(_0x5816('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5816('0x11'))(_0x5816('0x12'));var utils=require(_0x5816('0x13'));var config=require(_0x5816('0x14'));var licenseUtil=require(_0x5816('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b6a41,_0x1b56e8){_0x1b56e8=_0x1b56e8||0xcc;return function(_0x188c99){if(_0x188c99){return _0x3b6a41['sendStatus'](_0x1b56e8);}return _0x3b6a41[_0x5816('0x16')](_0x1b56e8)[_0x5816('0x17')]();};}function respondWithResult(_0x15ff6c,_0x23dc0){_0x23dc0=_0x23dc0||0xc8;return function(_0x43b652){if(_0x43b652){return _0x15ff6c[_0x5816('0x16')](_0x23dc0)[_0x5816('0x18')](_0x43b652);}};}function respondWithFilteredResult(_0x4b2566,_0x333873){return function(_0x5638d3){if(_0x5638d3){var _0x58255a=typeof _0x333873[_0x5816('0x19')]===_0x5816('0x1a')&&typeof _0x333873[_0x5816('0x1b')]==='undefined';var _0x44f46c=_0x5638d3[_0x5816('0x1c')];var _0x5409ff=_0x58255a?0x0:_0x333873[_0x5816('0x19')];var _0x359cfc=_0x58255a?_0x5638d3[_0x5816('0x1c')]:_0x333873[_0x5816('0x19')]+_0x333873[_0x5816('0x1b')];var _0x545245;if(_0x359cfc>=_0x44f46c){_0x359cfc=_0x44f46c;_0x545245=0xc8;}else{_0x545245=0xce;}_0x4b2566[_0x5816('0x16')](_0x545245);return _0x4b2566['set']('Content-Range',_0x5409ff+'-'+_0x359cfc+'/'+_0x44f46c)[_0x5816('0x18')](_0x5638d3);}return null;};}function patchUpdates(_0x18fd9f){return function(_0x4f353f){try{jsonpatch[_0x5816('0x1d')](_0x4f353f,_0x18fd9f,!![]);}catch(_0x5c4574){return BPromise[_0x5816('0x1e')](_0x5c4574);}return _0x4f353f[_0x5816('0x1f')]();};}function saveUpdates(_0x4552f9,_0x153abe){return function(_0x233fe7){if(_0x233fe7){return _0x233fe7[_0x5816('0x20')](_0x4552f9)['then'](function(_0x43ce65){return _0x43ce65;});}return null;};}function removeEntity(_0xaf55b9,_0x19ea1e){return function(_0x541332){if(_0x541332){return _0x541332[_0x5816('0x21')]()[_0x5816('0x22')](function(){_0xaf55b9[_0x5816('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5255b1,_0x21698b){return function(_0x35161a){if(!_0x35161a){_0x5255b1[_0x5816('0x23')](0x194);}return _0x35161a;};}function handleError(_0x48b3e2,_0x3b16fa){_0x3b16fa=_0x3b16fa||0x1f4;return function(_0x244e00){logger[_0x5816('0x24')](_0x244e00[_0x5816('0x25')]);if(_0x244e00['name']){delete _0x244e00[_0x5816('0x26')];}_0x48b3e2[_0x5816('0x16')](_0x3b16fa)[_0x5816('0x27')](_0x244e00);};}exports['index']=function(_0x358d5e,_0x54c4f8){var _0x14c4dc={},_0x12bdaf={},_0x5d7be6={'count':0x0,'rows':[]};var _0x3b2b91=_[_0x5816('0x28')](db[_0x5816('0x29')][_0x5816('0x2a')],function(_0x568142){return{'name':_0x568142['fieldName'],'type':_0x568142[_0x5816('0x2b')][_0x5816('0x2c')]};});_0x12bdaf['model']=_[_0x5816('0x28')](_0x3b2b91,'name');_0x12bdaf[_0x5816('0x2d')]=_[_0x5816('0x2e')](_0x358d5e[_0x5816('0x2d')]);_0x12bdaf[_0x5816('0x2f')]=_['intersection'](_0x12bdaf[_0x5816('0x30')],_0x12bdaf[_0x5816('0x2d')]);_0x14c4dc[_0x5816('0x31')]=_['intersection'](_0x12bdaf[_0x5816('0x30')],qs[_0x5816('0x32')](_0x358d5e['query'][_0x5816('0x32')]));_0x14c4dc[_0x5816('0x31')]=_0x14c4dc[_0x5816('0x31')][_0x5816('0x33')]?_0x14c4dc[_0x5816('0x31')]:_0x12bdaf[_0x5816('0x30')];if(!_0x358d5e[_0x5816('0x2d')][_0x5816('0x34')](_0x5816('0x35'))){_0x14c4dc[_0x5816('0x1b')]=qs[_0x5816('0x1b')](_0x358d5e['query'][_0x5816('0x1b')]);_0x14c4dc['offset']=qs[_0x5816('0x19')](_0x358d5e[_0x5816('0x2d')]['offset']);}_0x14c4dc['order']=qs[_0x5816('0x36')](_0x358d5e[_0x5816('0x2d')]['sort']);_0x14c4dc[_0x5816('0x37')]=qs[_0x5816('0x2f')](_[_0x5816('0x38')](_0x358d5e[_0x5816('0x2d')],_0x12bdaf[_0x5816('0x2f')]),_0x3b2b91);if(_0x358d5e['query'][_0x5816('0x39')]){_0x14c4dc[_0x5816('0x37')]=_[_0x5816('0x3a')](_0x14c4dc[_0x5816('0x37')],{'$or':_[_0x5816('0x28')](_0x3b2b91,function(_0x19f43d){if(_0x19f43d['type']!==_0x5816('0x3b')){var _0x332ec7={};_0x332ec7[_0x19f43d[_0x5816('0x26')]]={'$like':'%'+_0x358d5e['query'][_0x5816('0x39')]+'%'};return _0x332ec7;}})});}_0x14c4dc=_[_0x5816('0x3a')]({},_0x14c4dc,_0x358d5e['options']);var _0x22fa22={'where':_0x14c4dc[_0x5816('0x37')]};return db['VoiceDialReport']['count'](_0x22fa22)[_0x5816('0x22')](function(_0x11d0a4){_0x5d7be6[_0x5816('0x1c')]=_0x11d0a4;if(_0x358d5e[_0x5816('0x2d')][_0x5816('0x3c')]){_0x14c4dc[_0x5816('0x3d')]=[{'all':!![]}];}return db[_0x5816('0x29')][_0x5816('0x3e')](_0x14c4dc);})['then'](function(_0x4753b3){_0x5d7be6[_0x5816('0x3f')]=_0x4753b3;return _0x5d7be6;})[_0x5816('0x22')](respondWithFilteredResult(_0x54c4f8,_0x14c4dc))[_0x5816('0x40')](handleError(_0x54c4f8,null));};exports['show']=function(_0x3917ba,_0x322177){var _0x38d720={'raw':!![],'where':{'id':_0x3917ba[_0x5816('0x41')]['id']}},_0x1fa802={};_0x1fa802[_0x5816('0x30')]=_['keys'](db['VoiceDialReport']['rawAttributes']);_0x1fa802['query']=_[_0x5816('0x2e')](_0x3917ba[_0x5816('0x2d')]);_0x1fa802[_0x5816('0x2f')]=_[_0x5816('0x42')](_0x1fa802['model'],_0x1fa802[_0x5816('0x2d')]);_0x38d720[_0x5816('0x31')]=_[_0x5816('0x42')](_0x1fa802[_0x5816('0x30')],qs[_0x5816('0x32')](_0x3917ba['query']['fields']));_0x38d720[_0x5816('0x31')]=_0x38d720['attributes'][_0x5816('0x33')]?_0x38d720[_0x5816('0x31')]:_0x1fa802[_0x5816('0x30')];if(_0x3917ba[_0x5816('0x2d')][_0x5816('0x3c')]){_0x38d720[_0x5816('0x3d')]=[{'all':!![]}];}_0x38d720=_[_0x5816('0x3a')]({},_0x38d720,_0x3917ba['options']);return db[_0x5816('0x29')]['find'](_0x38d720)[_0x5816('0x22')](handleEntityNotFound(_0x322177,null))['then'](respondWithResult(_0x322177,null))[_0x5816('0x40')](handleError(_0x322177,null));};exports[_0x5816('0x43')]=function(_0x4521a7,_0xb74342){return db[_0x5816('0x29')]['create'](_0x4521a7[_0x5816('0x44')],{})[_0x5816('0x22')](respondWithResult(_0xb74342,0xc9))[_0x5816('0x40')](handleError(_0xb74342,null));};exports[_0x5816('0x20')]=function(_0x46d0c2,_0x2b15c2){if(_0x46d0c2[_0x5816('0x44')]['id']){delete _0x46d0c2[_0x5816('0x44')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x46d0c2[_0x5816('0x41')]['id']}})[_0x5816('0x22')](handleEntityNotFound(_0x2b15c2,null))[_0x5816('0x22')](saveUpdates(_0x46d0c2['body'],null))[_0x5816('0x22')](respondWithResult(_0x2b15c2,null))['catch'](handleError(_0x2b15c2,null));};exports[_0x5816('0x21')]=function(_0x30bf76,_0x1d08be){return db[_0x5816('0x29')][_0x5816('0x45')]({'where':{'id':_0x30bf76[_0x5816('0x41')]['id']}})[_0x5816('0x22')](handleEntityNotFound(_0x1d08be,null))[_0x5816('0x22')](removeEntity(_0x1d08be,null))[_0x5816('0x40')](handleError(_0x1d08be,null));};exports[_0x5816('0x46')]=function(_0x1c7c2f,_0x28ed81){return db['VoiceDialReport'][_0x5816('0x46')]()['then'](respondWithResult(_0x28ed81,null))[_0x5816('0x40')](handleError(_0x28ed81,null));}; \ No newline at end of file +var _0x17a7=['options','includeAll','rows','catch','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','map','VoiceDialReport','rawAttributes','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge'];(function(_0x5e316f,_0x52d619){var _0x4435a8=function(_0x5e3082){while(--_0x5e3082){_0x5e316f['push'](_0x5e316f['shift']());}};_0x4435a8(++_0x52d619);}(_0x17a7,0x177));var _0x717a=function(_0x2a1583,_0xb8b550){_0x2a1583=_0x2a1583-0x0;var _0x40367f=_0x17a7[_0x2a1583];return _0x40367f;};'use strict';var emlformat=require(_0x717a('0x0'));var rimraf=require(_0x717a('0x1'));var zipdir=require(_0x717a('0x2'));var jsonpatch=require(_0x717a('0x3'));var rp=require(_0x717a('0x4'));var moment=require(_0x717a('0x5'));var BPromise=require(_0x717a('0x6'));var Mustache=require('mustache');var util=require(_0x717a('0x7'));var path=require(_0x717a('0x8'));var sox=require(_0x717a('0x9'));var csv=require(_0x717a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x717a('0xb'));var _=require(_0x717a('0xc'));var squel=require('squel');var crypto=require(_0x717a('0xd'));var jsforce=require(_0x717a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x717a('0xa'));var querystring=require(_0x717a('0xf'));var Papa=require(_0x717a('0x10'));var Redis=require('ioredis');var authService=require(_0x717a('0x11'));var qs=require(_0x717a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x717a('0x13'))('api');var utils=require(_0x717a('0x14'));var config=require(_0x717a('0x15'));var licenseUtil=require(_0x717a('0x16'));var db=require(_0x717a('0x17'))['db'];function respondWithStatusCode(_0x11d29a,_0x2b0327){_0x2b0327=_0x2b0327||0xcc;return function(_0x30271b){if(_0x30271b){return _0x11d29a[_0x717a('0x18')](_0x2b0327);}return _0x11d29a[_0x717a('0x19')](_0x2b0327)['end']();};}function respondWithResult(_0x9bd675,_0x5d3c1c){_0x5d3c1c=_0x5d3c1c||0xc8;return function(_0x489f53){if(_0x489f53){return _0x9bd675[_0x717a('0x19')](_0x5d3c1c)[_0x717a('0x1a')](_0x489f53);}};}function respondWithFilteredResult(_0x58282f,_0x4f73cd){return function(_0x198a3c){if(_0x198a3c){var _0x1a452f=typeof _0x4f73cd[_0x717a('0x1b')]===_0x717a('0x1c')&&typeof _0x4f73cd[_0x717a('0x1d')]===_0x717a('0x1c');var _0x4bd00f=_0x198a3c['count'];var _0x5318b9=_0x1a452f?0x0:_0x4f73cd[_0x717a('0x1b')];var _0x4025f4=_0x1a452f?_0x198a3c[_0x717a('0x1e')]:_0x4f73cd[_0x717a('0x1b')]+_0x4f73cd[_0x717a('0x1d')];var _0x1ed1db;if(_0x4025f4>=_0x4bd00f){_0x4025f4=_0x4bd00f;_0x1ed1db=0xc8;}else{_0x1ed1db=0xce;}_0x58282f[_0x717a('0x19')](_0x1ed1db);return _0x58282f[_0x717a('0x1f')](_0x717a('0x20'),_0x5318b9+'-'+_0x4025f4+'/'+_0x4bd00f)[_0x717a('0x1a')](_0x198a3c);}return null;};}function patchUpdates(_0x109cc4){return function(_0x45b0c7){try{jsonpatch[_0x717a('0x21')](_0x45b0c7,_0x109cc4,!![]);}catch(_0x383a7d){return BPromise[_0x717a('0x22')](_0x383a7d);}return _0x45b0c7[_0x717a('0x23')]();};}function saveUpdates(_0x33ecda,_0x3d822e){return function(_0x4c3a4e){if(_0x4c3a4e){return _0x4c3a4e[_0x717a('0x24')](_0x33ecda)[_0x717a('0x25')](function(_0x5749b3){return _0x5749b3;});}return null;};}function removeEntity(_0x1bf0e5,_0x445e53){return function(_0xe9c8c3){if(_0xe9c8c3){return _0xe9c8c3[_0x717a('0x26')]()[_0x717a('0x25')](function(){_0x1bf0e5[_0x717a('0x19')](0xcc)[_0x717a('0x27')]();});}};}function handleEntityNotFound(_0x1ed401,_0x138148){return function(_0x3bd960){if(!_0x3bd960){_0x1ed401[_0x717a('0x18')](0x194);}return _0x3bd960;};}function handleError(_0x1fda68,_0x5f4462){_0x5f4462=_0x5f4462||0x1f4;return function(_0x27d7ca){logger[_0x717a('0x28')](_0x27d7ca[_0x717a('0x29')]);if(_0x27d7ca['name']){delete _0x27d7ca['name'];}_0x1fda68[_0x717a('0x19')](_0x5f4462)[_0x717a('0x2a')](_0x27d7ca);};}exports['index']=function(_0x568d4c,_0x2f6e9c){var _0x3c7b0c={},_0x2044e5={},_0xb1b659={'count':0x0,'rows':[]};var _0x58907f=_[_0x717a('0x2b')](db[_0x717a('0x2c')][_0x717a('0x2d')],function(_0x26bd85){return{'name':_0x26bd85['fieldName'],'type':_0x26bd85[_0x717a('0x2e')]['key']};});_0x2044e5[_0x717a('0x2f')]=_[_0x717a('0x2b')](_0x58907f,_0x717a('0x30'));_0x2044e5[_0x717a('0x31')]=_[_0x717a('0x32')](_0x568d4c[_0x717a('0x31')]);_0x2044e5['filters']=_[_0x717a('0x33')](_0x2044e5[_0x717a('0x2f')],_0x2044e5[_0x717a('0x31')]);_0x3c7b0c[_0x717a('0x34')]=_[_0x717a('0x33')](_0x2044e5[_0x717a('0x2f')],qs[_0x717a('0x35')](_0x568d4c['query'][_0x717a('0x35')]));_0x3c7b0c[_0x717a('0x34')]=_0x3c7b0c[_0x717a('0x34')][_0x717a('0x36')]?_0x3c7b0c['attributes']:_0x2044e5[_0x717a('0x2f')];if(!_0x568d4c[_0x717a('0x31')][_0x717a('0x37')]('nolimit')){_0x3c7b0c['limit']=qs[_0x717a('0x1d')](_0x568d4c[_0x717a('0x31')][_0x717a('0x1d')]);_0x3c7b0c['offset']=qs[_0x717a('0x1b')](_0x568d4c['query'][_0x717a('0x1b')]);}_0x3c7b0c[_0x717a('0x38')]=qs[_0x717a('0x39')](_0x568d4c[_0x717a('0x31')]['sort']);_0x3c7b0c[_0x717a('0x3a')]=qs['filters'](_[_0x717a('0x3b')](_0x568d4c[_0x717a('0x31')],_0x2044e5[_0x717a('0x3c')]),_0x58907f);if(_0x568d4c[_0x717a('0x31')][_0x717a('0x3d')]){_0x3c7b0c[_0x717a('0x3a')]=_['merge'](_0x3c7b0c[_0x717a('0x3a')],{'$or':_[_0x717a('0x2b')](_0x58907f,function(_0x405767){if(_0x405767[_0x717a('0x2e')]!=='VIRTUAL'){var _0x447686={};_0x447686[_0x405767[_0x717a('0x30')]]={'$like':'%'+_0x568d4c[_0x717a('0x31')]['filter']+'%'};return _0x447686;}})});}_0x3c7b0c=_[_0x717a('0x3e')]({},_0x3c7b0c,_0x568d4c[_0x717a('0x3f')]);var _0x42b38b={'where':_0x3c7b0c['where']};return db[_0x717a('0x2c')][_0x717a('0x1e')](_0x42b38b)[_0x717a('0x25')](function(_0x7bedad){_0xb1b659[_0x717a('0x1e')]=_0x7bedad;if(_0x568d4c[_0x717a('0x31')][_0x717a('0x40')]){_0x3c7b0c['include']=[{'all':!![]}];}return db[_0x717a('0x2c')]['findAll'](_0x3c7b0c);})[_0x717a('0x25')](function(_0x58f4b2){_0xb1b659[_0x717a('0x41')]=_0x58f4b2;return _0xb1b659;})[_0x717a('0x25')](respondWithFilteredResult(_0x2f6e9c,_0x3c7b0c))[_0x717a('0x42')](handleError(_0x2f6e9c,null));};exports['show']=function(_0x4238ee,_0x334547){var _0x1af869={'raw':!![],'where':{'id':_0x4238ee[_0x717a('0x43')]['id']}},_0x507212={};_0x507212['model']=_[_0x717a('0x32')](db[_0x717a('0x2c')][_0x717a('0x2d')]);_0x507212[_0x717a('0x31')]=_[_0x717a('0x32')](_0x4238ee['query']);_0x507212[_0x717a('0x3c')]=_[_0x717a('0x33')](_0x507212[_0x717a('0x2f')],_0x507212[_0x717a('0x31')]);_0x1af869[_0x717a('0x34')]=_['intersection'](_0x507212[_0x717a('0x2f')],qs[_0x717a('0x35')](_0x4238ee[_0x717a('0x31')]['fields']));_0x1af869[_0x717a('0x34')]=_0x1af869[_0x717a('0x34')][_0x717a('0x36')]?_0x1af869[_0x717a('0x34')]:_0x507212['model'];if(_0x4238ee[_0x717a('0x31')][_0x717a('0x40')]){_0x1af869[_0x717a('0x44')]=[{'all':!![]}];}_0x1af869=_[_0x717a('0x3e')]({},_0x1af869,_0x4238ee['options']);return db[_0x717a('0x2c')][_0x717a('0x45')](_0x1af869)[_0x717a('0x25')](handleEntityNotFound(_0x334547,null))[_0x717a('0x25')](respondWithResult(_0x334547,null))[_0x717a('0x42')](handleError(_0x334547,null));};exports[_0x717a('0x46')]=function(_0x217f1b,_0x7fb566){return db[_0x717a('0x2c')][_0x717a('0x46')](_0x217f1b[_0x717a('0x47')],{})[_0x717a('0x25')](respondWithResult(_0x7fb566,0xc9))[_0x717a('0x42')](handleError(_0x7fb566,null));};exports[_0x717a('0x24')]=function(_0xe30491,_0xecbb17){if(_0xe30491['body']['id']){delete _0xe30491[_0x717a('0x47')]['id'];}return db['VoiceDialReport'][_0x717a('0x45')]({'where':{'id':_0xe30491['params']['id']}})[_0x717a('0x25')](handleEntityNotFound(_0xecbb17,null))[_0x717a('0x25')](saveUpdates(_0xe30491['body'],null))['then'](respondWithResult(_0xecbb17,null))[_0x717a('0x42')](handleError(_0xecbb17,null));};exports[_0x717a('0x26')]=function(_0x316aef,_0x2b2417){return db[_0x717a('0x2c')]['find']({'where':{'id':_0x316aef['params']['id']}})[_0x717a('0x25')](handleEntityNotFound(_0x2b2417,null))[_0x717a('0x25')](removeEntity(_0x2b2417,null))[_0x717a('0x42')](handleError(_0x2b2417,null));};exports[_0x717a('0x48')]=function(_0x4ce541,_0x1a1ea2){return db[_0x717a('0x2c')][_0x717a('0x48')]()[_0x717a('0x25')](respondWithResult(_0x1a1ea2,null))['catch'](handleError(_0x1a1ea2,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 68ba155..dc29dd8 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 _0xebda=['api','moment','bluebird','path','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','uniqueid','util','../../config/logger'];(function(_0x5a3413,_0xae5d84){var _0x3a0e8b=function(_0x59f62b){while(--_0x59f62b){_0x5a3413['push'](_0x5a3413['shift']());}};_0x3a0e8b(++_0xae5d84);}(_0xebda,0x170));var _0xaebd=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xebda[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require('lodash');var util=require(_0xaebd('0x0'));var logger=require(_0xaebd('0x1'))(_0xaebd('0x2'));var moment=require(_0xaebd('0x3'));var BPromise=require(_0xaebd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaebd('0x5'));var rimraf=require('rimraf');var config=require(_0xaebd('0x6'));var attributes=require(_0xaebd('0x7'));module['exports']=function(_0x119123,_0x12aeb5){return _0x119123['define'](_0xaebd('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xaebd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5bf2=['path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x5bf2,0x157));var _0x25bf=function(_0x26edc4,_0x27508a){_0x26edc4=_0x26edc4-0x0;var _0x5d12a3=_0x5bf2[_0x26edc4];return _0x5d12a3;};'use strict';var _=require(_0x25bf('0x0'));var util=require('util');var logger=require(_0x25bf('0x1'))('api');var moment=require(_0x25bf('0x2'));var BPromise=require(_0x25bf('0x3'));var rp=require(_0x25bf('0x4'));var fs=require('fs');var path=require(_0x25bf('0x5'));var rimraf=require(_0x25bf('0x6'));var config=require('../../config/environment');var attributes=require(_0x25bf('0x7'));module[_0x25bf('0x8')]=function(_0x5e2916,_0x1bf99e){return _0x5e2916[_0x25bf('0x9')](_0x25bf('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x25bf('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 14b2bb2..ed5272f 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 _0x9ca3=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','body','limit','UpdateVoiceDialReport','util'];(function(_0x43398c,_0xb73e15){var _0x549323=function(_0x6941ab){while(--_0x6941ab){_0x43398c['push'](_0x43398c['shift']());}};_0x549323(++_0xb73e15);}(_0x9ca3,0x1a3));var _0x39ca=function(_0x5144f3,_0x55f3fe){_0x5144f3=_0x5144f3-0x0;var _0x1d1eb1=_0x9ca3[_0x5144f3];return _0x1d1eb1;};'use strict';var _=require('lodash');var util=require(_0x39ca('0x0'));var moment=require(_0x39ca('0x1'));var BPromise=require(_0x39ca('0x2'));var rs=require(_0x39ca('0x3'));var fs=require('fs');var Redis=require(_0x39ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x39ca('0x5'));var logger=require(_0x39ca('0x6'))(_0x39ca('0x7'));var config=require(_0x39ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x39ca('0x9')][_0x39ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fca37,_0x4fc5f9,_0x1b5c66){return new BPromise(function(_0x54b72a,_0x524cf6){return client[_0x39ca('0xb')](_0x3fca37,_0x1b5c66)[_0x39ca('0xc')](function(_0x2e7f50){logger[_0x39ca('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x4fc5f9,_0x39ca('0xe'));logger[_0x39ca('0xf')](_0x39ca('0x10'),_0x4fc5f9,_0x39ca('0xe'),JSON[_0x39ca('0x11')](_0x2e7f50));if(_0x2e7f50['error']){if(_0x2e7f50[_0x39ca('0x12')]['code']===0x1f4){logger[_0x39ca('0x12')](_0x39ca('0x13'),_0x4fc5f9,_0x2e7f50['error']['message']);return _0x524cf6(_0x2e7f50[_0x39ca('0x12')][_0x39ca('0x14')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x4fc5f9,_0x2e7f50[_0x39ca('0x12')][_0x39ca('0x14')]);return _0x54b72a(_0x2e7f50[_0x39ca('0x12')]['message']);}else{logger[_0x39ca('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x4fc5f9,_0x39ca('0xe'));_0x54b72a(_0x2e7f50['result'][_0x39ca('0x14')]);}})[_0x39ca('0x15')](function(_0x267fc4){logger[_0x39ca('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x4fc5f9,_0x267fc4);_0x524cf6(_0x267fc4);});});}exports[_0x39ca('0x16')]=function(_0x580601){var _0x26fa81=this;return new Promise(function(_0xd527f6,_0x32d398){return db[_0x39ca('0x17')][_0x39ca('0x18')](_0x580601['body'],{'raw':_0x580601[_0x39ca('0x19')]?_0x580601['options'][_0x39ca('0x1a')]===undefined?!![]:![]:!![]})[_0x39ca('0xc')](function(_0x54b09f){logger[_0x39ca('0xd')](_0x39ca('0x16'),_0x580601);logger['debug'](_0x39ca('0x16'),_0x580601,JSON[_0x39ca('0x11')](_0x54b09f));_0xd527f6(_0x54b09f);})[_0x39ca('0x15')](function(_0x4e1c2f){logger[_0x39ca('0x12')]('CreateVoiceDialReport',_0x4e1c2f[_0x39ca('0x14')],_0x580601);_0x32d398(_0x26fa81[_0x39ca('0x12')](0x1f4,_0x4e1c2f[_0x39ca('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0xbcfb7c){var _0x60cdb1=this;return new Promise(function(_0x2b766b,_0x11b36e){return db['VoiceDialReport']['update'](_0xbcfb7c[_0x39ca('0x1b')],{'raw':_0xbcfb7c[_0x39ca('0x19')]?_0xbcfb7c[_0x39ca('0x19')][_0x39ca('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbcfb7c['options']?_0xbcfb7c[_0x39ca('0x19')]['where']||null:null,'attributes':_0xbcfb7c[_0x39ca('0x19')]?_0xbcfb7c['options']['attributes']||null:null,'limit':_0xbcfb7c[_0x39ca('0x19')]?_0xbcfb7c[_0x39ca('0x19')][_0x39ca('0x1c')]||null:null})['then'](function(_0x210d0a){logger['info'](_0x39ca('0x1d'),_0xbcfb7c);logger[_0x39ca('0xf')](_0x39ca('0x1d'),_0xbcfb7c,JSON['stringify'](_0x210d0a));_0x2b766b(_0x210d0a);})[_0x39ca('0x15')](function(_0x5ab0bb){logger['error'](_0x39ca('0x1d'),_0x5ab0bb[_0x39ca('0x14')],_0xbcfb7c);_0x11b36e(_0x60cdb1[_0x39ca('0x12')](0x1f4,_0x5ab0bb[_0x39ca('0x14')]));});});}; \ No newline at end of file +var _0x48a8=['raw','where','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','request\x20sent','debug','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','result','body','options','CreateVoiceDialReport','stringify','catch','UpdateVoiceDialReport'];(function(_0x107ca5,_0x4b7f1c){var _0x47e5ae=function(_0x4e2910){while(--_0x4e2910){_0x107ca5['push'](_0x107ca5['shift']());}};_0x47e5ae(++_0x4b7f1c);}(_0x48a8,0xb8));var _0x848a=function(_0x123a76,_0x1b2a41){_0x123a76=_0x123a76-0x0;var _0x34589f=_0x48a8[_0x123a76];return _0x34589f;};'use strict';var _=require(_0x848a('0x0'));var util=require(_0x848a('0x1'));var moment=require(_0x848a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x848a('0x3'));var db=require(_0x848a('0x4'))['db'];var utils=require(_0x848a('0x5'));var logger=require(_0x848a('0x6'))('rpc');var config=require(_0x848a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x848a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2363bf,_0x2c8eb8,_0x2ed83e){return new BPromise(function(_0x3a66e7,_0x30f355){return client[_0x848a('0x9')](_0x2363bf,_0x2ed83e)['then'](function(_0xd0a1dd){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x2c8eb8,_0x848a('0xa'));logger[_0x848a('0xb')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2c8eb8,_0x848a('0xa'),JSON['stringify'](_0xd0a1dd));if(_0xd0a1dd[_0x848a('0xc')]){if(_0xd0a1dd[_0x848a('0xc')][_0x848a('0xd')]===0x1f4){logger['error'](_0x848a('0xe'),_0x2c8eb8,_0xd0a1dd[_0x848a('0xc')][_0x848a('0xf')]);return _0x30f355(_0xd0a1dd[_0x848a('0xc')][_0x848a('0xf')]);}logger[_0x848a('0xc')](_0x848a('0xe'),_0x2c8eb8,_0xd0a1dd[_0x848a('0xc')][_0x848a('0xf')]);return _0x3a66e7(_0xd0a1dd[_0x848a('0xc')]['message']);}else{logger[_0x848a('0x10')](_0x848a('0xe'),_0x2c8eb8,_0x848a('0xa'));_0x3a66e7(_0xd0a1dd[_0x848a('0x11')][_0x848a('0xf')]);}})['catch'](function(_0x5331b4){logger[_0x848a('0xc')](_0x848a('0xe'),_0x2c8eb8,_0x5331b4);_0x30f355(_0x5331b4);});});}exports['CreateVoiceDialReport']=function(_0x5ba9ed){var _0xb9fde4=this;return new Promise(function(_0x1bf516,_0x3551cd){return db['VoiceDialReport']['create'](_0x5ba9ed[_0x848a('0x12')],{'raw':_0x5ba9ed[_0x848a('0x13')]?_0x5ba9ed[_0x848a('0x13')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x385a07){logger[_0x848a('0x10')](_0x848a('0x14'),_0x5ba9ed);logger[_0x848a('0xb')](_0x848a('0x14'),_0x5ba9ed,JSON[_0x848a('0x15')](_0x385a07));_0x1bf516(_0x385a07);})[_0x848a('0x16')](function(_0x4b92fa){logger[_0x848a('0xc')]('CreateVoiceDialReport',_0x4b92fa[_0x848a('0xf')],_0x5ba9ed);_0x3551cd(_0xb9fde4[_0x848a('0xc')](0x1f4,_0x4b92fa['message']));});});};exports[_0x848a('0x17')]=function(_0x12bd15){var _0x3ae0e6=this;return new Promise(function(_0x201263,_0x5a08af){return db['VoiceDialReport']['update'](_0x12bd15[_0x848a('0x12')],{'raw':_0x12bd15['options']?_0x12bd15[_0x848a('0x13')][_0x848a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12bd15[_0x848a('0x13')]?_0x12bd15[_0x848a('0x13')][_0x848a('0x19')]||null:null,'attributes':_0x12bd15[_0x848a('0x13')]?_0x12bd15[_0x848a('0x13')]['attributes']||null:null,'limit':_0x12bd15[_0x848a('0x13')]?_0x12bd15['options']['limit']||null:null})['then'](function(_0x134fa2){logger[_0x848a('0x10')]('UpdateVoiceDialReport',_0x12bd15);logger['debug'](_0x848a('0x17'),_0x12bd15,JSON['stringify'](_0x134fa2));_0x201263(_0x134fa2);})[_0x848a('0x16')](function(_0x57e158){logger[_0x848a('0xc')](_0x848a('0x17'),_0x57e158[_0x848a('0xf')],_0x12bd15);_0x5a08af(_0x3ae0e6['error'](0x1f4,_0x57e158[_0x848a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 35f3923..55a9c35 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 _0xf168=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','post','/:id/applications','isAuthenticated','addApplications','update','delete','exports','multer'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0xf168,0x68));var _0x8f16=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf168[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x8f16('0x0'));var util=require(_0x8f16('0x1'));var path=require(_0x8f16('0x2'));var timeout=require(_0x8f16('0x3'));var express=require(_0x8f16('0x4'));var router=express[_0x8f16('0x5')]();var fs_extra=require(_0x8f16('0x6'));var auth=require(_0x8f16('0x7'));var interaction=require(_0x8f16('0x8'));var config=require(_0x8f16('0x9'));var controller=require(_0x8f16('0xa'));router[_0x8f16('0xb')]('/',auth['isAuthenticated'](),controller[_0x8f16('0xc')]);router[_0x8f16('0xb')](_0x8f16('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8f16('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8f16('0xe')](_0x8f16('0xf'),auth[_0x8f16('0x10')](),controller[_0x8f16('0x11')]);router['put']('/:id',auth[_0x8f16('0x10')](),controller[_0x8f16('0x12')]);router[_0x8f16('0x13')](_0x8f16('0xd'),auth[_0x8f16('0x10')](),controller['destroy']);module[_0x8f16('0x14')]=router; \ No newline at end of file +var _0x890e=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x890e,0x7d));var _0xe890=function(_0x242ed8,_0x5d969d){_0x242ed8=_0x242ed8-0x0;var _0x3510c6=_0x890e[_0x242ed8];return _0x3510c6;};'use strict';var multer=require(_0xe890('0x0'));var util=require(_0xe890('0x1'));var path=require('path');var timeout=require(_0xe890('0x2'));var express=require(_0xe890('0x3'));var router=express[_0xe890('0x4')]();var fs_extra=require(_0xe890('0x5'));var auth=require(_0xe890('0x6'));var interaction=require(_0xe890('0x7'));var config=require(_0xe890('0x8'));var controller=require(_0xe890('0x9'));router[_0xe890('0xa')]('/',auth[_0xe890('0xb')](),controller['index']);router[_0xe890('0xa')](_0xe890('0xc'),auth[_0xe890('0xb')](),controller[_0xe890('0xd')]);router[_0xe890('0xe')]('/',auth[_0xe890('0xb')](),controller[_0xe890('0xf')]);router[_0xe890('0xe')](_0xe890('0x10'),auth[_0xe890('0xb')](),controller[_0xe890('0x11')]);router[_0xe890('0x12')](_0xe890('0xc'),auth['isAuthenticated'](),controller[_0xe890('0x13')]);router['delete']('/:id',auth[_0xe890('0xb')](),controller[_0xe890('0x14')]);module[_0xe890('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 4a2710d..d5eaa26 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 _0xb7e7=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x21038b,_0x1a2662){var _0x506cd5=function(_0x4319e4){while(--_0x4319e4){_0x21038b['push'](_0x21038b['shift']());}};_0x506cd5(++_0x1a2662);}(_0xb7e7,0x121));var _0x7b7e=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xb7e7[_0x46d0c9];return _0x174506;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'context':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x3'),_0x7b7e('0x4'),_0x7b7e('0x5'),'inbound-fax',_0x7b7e('0x6'),_0x7b7e('0x7'),_0x7b7e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x7b7e('0x1')]},'interval':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x9')},'IntervalId':{'type':Sequelize[_0x7b7e('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7b7e('0xa')]},'recordingFormat':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0xc')},'answer':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7b7e('0xd')],'get':function(){return this[_0x7b7e('0xe')]('exten');}}}; \ No newline at end of file +var _0xd8b0=['VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d8b('0x2')},'priority':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x0d8b('0x2')},'tag':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0d8b('0x4')](_0x0d8b('0x5'),_0x0d8b('0x6'),'internal',_0x0d8b('0x7'),_0x0d8b('0x8'),'system',_0x0d8b('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0d8b('0x3')]},'interval':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':_0x0d8b('0xa')},'IntervalId':{'type':Sequelize[_0x0d8b('0xb')]},'isApp':{'type':Sequelize[_0x0d8b('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0d8b('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0xd')},'answer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0d8b('0xe')],'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index acad3b9..3b28596 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 _0xd84f=['InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','map','value','includes','find','type','name','UserProfileResource','then','error','stack','send','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','findAll','rows','show','params','include','catch','create','startsWith','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','internal','UserProfileSection','autoAssociation','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','destroy','get'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd84f,0x1af));var _0xfd84=function(_0x350b76,_0x2ce3ca){_0x350b76=_0x350b76-0x0;var _0x15d324=_0xd84f[_0x350b76];return _0x15d324;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xfd84('0x0'));var logger=require(_0xfd84('0x1'))('api');var config=require(_0xfd84('0x2'));var db=require('../../mysqldb')['db'];config[_0xfd84('0x3')]=_['defaults'](config[_0xfd84('0x3')],{'host':_0xfd84('0x4'),'port':0x18eb});var socket=require(_0xfd84('0x5'))(new Redis(config[_0xfd84('0x3')]));require('./voiceExtension.socket')[_0xfd84('0x6')](socket);function respondWithStatusCode(_0x2a8a3b,_0x532ece){_0x532ece=_0x532ece||0xcc;return function(_0x3046ab){if(_0x3046ab){return _0x2a8a3b[_0xfd84('0x7')](_0x532ece);}return _0x2a8a3b[_0xfd84('0x8')](_0x532ece)[_0xfd84('0x9')]();};}function respondWithResult(_0x5b123a,_0x27a5f7){_0x27a5f7=_0x27a5f7||0xc8;return function(_0x16c190){if(_0x16c190){return _0x5b123a[_0xfd84('0x8')](_0x27a5f7)['json'](_0x16c190);}};}function respondWithFilteredResult(_0x3898ac,_0x54b26d){return function(_0x3bfb86){if(_0x3bfb86){var _0x1ab594=typeof _0x54b26d[_0xfd84('0xa')]===_0xfd84('0xb')&&typeof _0x54b26d['limit']==='undefined';var _0x487d2a=_0x3bfb86['count'];var _0x2115e8=_0x1ab594?0x0:_0x54b26d[_0xfd84('0xa')];var _0x5a28b9=_0x1ab594?_0x3bfb86[_0xfd84('0xc')]:_0x54b26d[_0xfd84('0xa')]+_0x54b26d[_0xfd84('0xd')];var _0x5403e5;if(_0x5a28b9>=_0x487d2a){_0x5a28b9=_0x487d2a;_0x5403e5=0xc8;}else{_0x5403e5=0xce;}_0x3898ac[_0xfd84('0x8')](_0x5403e5);return _0x3898ac[_0xfd84('0xe')](_0xfd84('0xf'),_0x2115e8+'-'+_0x5a28b9+'/'+_0x487d2a)[_0xfd84('0x10')](_0x3bfb86);}return null;};}function removeEntity(_0x5b4de3){return function(_0x3c0b10){if(_0x3c0b10){return _0x3c0b10[_0xfd84('0x11')]()['then'](function(){var _0xce9139=_0x3c0b10[_0xfd84('0x12')]({'plain':!![]});var _0x14056f=[{'name':_0xfd84('0x13'),'value':_0xfd84('0x14'),'ignore':![]},{'name':_0xfd84('0x15'),'value':_0xfd84('0x16'),'ignore':![]},{'name':_0xfd84('0x17'),'value':'internal','ignore':![]}];var _0x2d120c=_(_0x14056f)[_0xfd84('0x18')]('ignore')[_0xfd84('0x19')](_0xfd84('0x1a'))[_0xfd84('0x1a')]();if(_[_0xfd84('0x1b')](_0x2d120c,_0xce9139['type'])){return;}var _0x11acbd=_[_0xfd84('0x1c')](_0x14056f,['value',_0xce9139[_0xfd84('0x1d')]])[_0xfd84('0x1e')];return db[_0xfd84('0x1f')][_0xfd84('0x11')]({'where':{'type':_0x11acbd,'resourceId':_0xce9139['id']}})[_0xfd84('0x20')](function(){return _0x3c0b10;});})[_0xfd84('0x20')](function(){_0x5b4de3['status'](0xcc)[_0xfd84('0x9')]();});}};}function handleEntityNotFound(_0xe90bc2){return function(_0x176b15){if(!_0x176b15){_0xe90bc2['sendStatus'](0x194);}return _0x176b15;};}function handleError(_0x2dfe69,_0x5a8dd5){_0x5a8dd5=_0x5a8dd5||0x1f4;return function(_0x3450b0){logger[_0xfd84('0x21')](_0x3450b0[_0xfd84('0x22')]);if(_0x3450b0['name']){delete _0x3450b0[_0xfd84('0x1e')];}_0x2dfe69[_0xfd84('0x8')](_0x5a8dd5)[_0xfd84('0x23')](_0x3450b0);};}exports[_0xfd84('0x24')]=function(_0x29cb0b,_0x578917){var _0x4a0c25={},_0xd1fa9b={},_0x23f56d={'count':0x0,'rows':[]};var _0x76fc71=_[_0xfd84('0x19')](db['VoiceExtension'][_0xfd84('0x25')],function(_0x47331a){return{'name':_0x47331a[_0xfd84('0x26')],'type':_0x47331a[_0xfd84('0x1d')][_0xfd84('0x27')]};});_0xd1fa9b[_0xfd84('0x28')]=_[_0xfd84('0x19')](_0x76fc71,'name');_0xd1fa9b['query']=_[_0xfd84('0x29')](_0x29cb0b[_0xfd84('0x2a')]);_0xd1fa9b[_0xfd84('0x2b')]=_[_0xfd84('0x2c')](_0xd1fa9b[_0xfd84('0x28')],_0xd1fa9b[_0xfd84('0x2a')]);_0x4a0c25[_0xfd84('0x2d')]=_['intersection'](_0xd1fa9b['model'],qs[_0xfd84('0x2e')](_0x29cb0b[_0xfd84('0x2a')][_0xfd84('0x2e')]));_0x4a0c25['attributes']=_0x4a0c25[_0xfd84('0x2d')]['length']?_0x4a0c25[_0xfd84('0x2d')]:_0xd1fa9b[_0xfd84('0x28')];if(!_0x29cb0b[_0xfd84('0x2a')]['hasOwnProperty'](_0xfd84('0x2f'))){_0x4a0c25['limit']=qs[_0xfd84('0xd')](_0x29cb0b['query']['limit']);_0x4a0c25[_0xfd84('0xa')]=qs['offset'](_0x29cb0b['query'][_0xfd84('0xa')]);}_0x4a0c25['order']=qs['sort'](_0x29cb0b['query'][_0xfd84('0x30')]);_0x4a0c25[_0xfd84('0x31')]=qs['filters'](_[_0xfd84('0x32')](_0x29cb0b[_0xfd84('0x2a')],_0xd1fa9b[_0xfd84('0x2b')]),_0x76fc71);if(_0x29cb0b[_0xfd84('0x2a')]['filter']){_0x4a0c25[_0xfd84('0x31')]=_[_0xfd84('0x33')](_0x4a0c25['where'],{'$or':_[_0xfd84('0x19')](_0x76fc71,function(_0x4b1c52){if(_0x4b1c52[_0xfd84('0x1d')]!==_0xfd84('0x34')){var _0x4e0672={};_0x4e0672[_0x4b1c52[_0xfd84('0x1e')]]={'$like':'%'+_0x29cb0b[_0xfd84('0x2a')][_0xfd84('0x18')]+'%'};return _0x4e0672;}})});}_0x4a0c25=_[_0xfd84('0x33')]({},_0x4a0c25,_0x29cb0b[_0xfd84('0x35')]);var _0x107bdc={'where':_0x4a0c25['where']};return db[_0xfd84('0x36')]['count'](_0x107bdc)['then'](function(_0x21aa1c){_0x23f56d[_0xfd84('0xc')]=_0x21aa1c;if(_0x29cb0b[_0xfd84('0x2a')][_0xfd84('0x37')]){_0x4a0c25['include']=[{'all':!![]}];}return db[_0xfd84('0x36')][_0xfd84('0x38')](_0x4a0c25);})[_0xfd84('0x20')](function(_0x591315){_0x23f56d[_0xfd84('0x39')]=_0x591315;return _0x23f56d;})[_0xfd84('0x20')](respondWithFilteredResult(_0x578917,_0x4a0c25))['catch'](handleError(_0x578917,null));};exports[_0xfd84('0x3a')]=function(_0x1b1bc0,_0x2e2523){var _0x1f16b3={'raw':![],'where':{'id':_0x1b1bc0[_0xfd84('0x3b')]['id']}},_0x5a4db4={};_0x5a4db4[_0xfd84('0x28')]=_[_0xfd84('0x29')](db['VoiceExtension'][_0xfd84('0x25')]);_0x5a4db4[_0xfd84('0x2a')]=_[_0xfd84('0x29')](_0x1b1bc0[_0xfd84('0x2a')]);_0x5a4db4[_0xfd84('0x2b')]=_['intersection'](_0x5a4db4[_0xfd84('0x28')],_0x5a4db4['query']);_0x1f16b3[_0xfd84('0x2d')]=_[_0xfd84('0x2c')](_0x5a4db4['model'],qs[_0xfd84('0x2e')](_0x1b1bc0[_0xfd84('0x2a')][_0xfd84('0x2e')]));_0x1f16b3[_0xfd84('0x2d')]=_0x1f16b3['attributes']['length']?_0x1f16b3['attributes']:_0x5a4db4[_0xfd84('0x28')];if(_0x1b1bc0[_0xfd84('0x2a')][_0xfd84('0x37')]){_0x1f16b3[_0xfd84('0x3c')]=[{'all':!![]}];}_0x1f16b3=_[_0xfd84('0x33')]({},_0x1f16b3,_0x1b1bc0[_0xfd84('0x35')]);return db[_0xfd84('0x36')][_0xfd84('0x1c')](_0x1f16b3)[_0xfd84('0x20')](handleEntityNotFound(_0x2e2523,null))[_0xfd84('0x20')](respondWithResult(_0x2e2523,null))[_0xfd84('0x3d')](handleError(_0x2e2523,null));};exports[_0xfd84('0x11')]=function(_0x20305c,_0x1463f4){return db['VoiceExtension'][_0xfd84('0x1c')]({'where':{'id':_0x20305c[_0xfd84('0x3b')]['id']}})[_0xfd84('0x20')](handleEntityNotFound(_0x1463f4,null))[_0xfd84('0x20')](removeEntity(_0x1463f4,null))['catch'](handleError(_0x1463f4,null));};exports[_0xfd84('0x3e')]=function(_0x4035a7,_0x496736){if(_0x4035a7['body'][_0xfd84('0x1d')]===_0xfd84('0x16')&&!_[_0xfd84('0x3f')](_0x4035a7[_0xfd84('0x40')][_0xfd84('0x41')],'_')){_0x4035a7['body'][_0xfd84('0x41')]='_'[_0xfd84('0x42')](_0x4035a7[_0xfd84('0x40')][_0xfd84('0x41')]);}return db[_0xfd84('0x36')][_0xfd84('0x3e')](_0x4035a7[_0xfd84('0x40')],{'raw':![]})['then'](function(_0x4857f7){var _0x96a2f8=_0x4035a7['user'][_0xfd84('0x12')]({'plain':!![]});if(!_0x96a2f8)throw new Error(_0xfd84('0x43'));if(_0x96a2f8['role']===_0xfd84('0x44')){var _0x1b5b76=_0x4857f7[_0xfd84('0x12')]({'plain':!![]});var _0x9f1aa2=[{'name':_0xfd84('0x13'),'value':_0xfd84('0x14')},{'name':_0xfd84('0x15'),'value':_0xfd84('0x16')},{'name':_0xfd84('0x17'),'value':_0xfd84('0x45')}];var _0x12d1e3=_[_0xfd84('0x1c')](_0x9f1aa2,[_0xfd84('0x1a'),_0x1b5b76[_0xfd84('0x1d')]])[_0xfd84('0x1e')];return db[_0xfd84('0x46')]['find']({'where':{'name':_0x12d1e3,'userProfileId':_0x96a2f8['userProfileId']},'raw':!![]})[_0xfd84('0x20')](function(_0x5b3dba){if(_0x5b3dba&&_0x5b3dba[_0xfd84('0x47')]===0x0){return db[_0xfd84('0x1f')][_0xfd84('0x3e')]({'name':_0x1b5b76[_0xfd84('0x1e')],'resourceId':_0x1b5b76['id'],'type':_0x5b3dba[_0xfd84('0x1e')],'sectionId':_0x5b3dba['id']},{})['then'](function(){return _0x4857f7;});}else{return _0x4857f7;}})[_0xfd84('0x3d')](function(_0x4011a9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4011a9);throw _0x4011a9;});}return _0x4857f7;})[_0xfd84('0x20')](respondWithResult(_0x496736,0xc9))[_0xfd84('0x3d')](handleError(_0x496736,null));};exports[_0xfd84('0x48')]=function(_0x2dcbcb,_0x294c69){if(_0x2dcbcb[_0xfd84('0x40')]['id']){delete _0x2dcbcb['body']['id'];}return db[_0xfd84('0x36')]['find']({'where':{'id':_0x2dcbcb[_0xfd84('0x3b')]['id']}})['then'](handleEntityNotFound(_0x294c69,null))[_0xfd84('0x20')](function(_0x4edf86){if(_0x4edf86){return db['VoiceExtension']['update'](_[_0xfd84('0x32')](_0x2dcbcb[_0xfd84('0x40')],[_0xfd84('0x41'),_0xfd84('0x49'),_0xfd84('0x4a'),_0xfd84('0x4b'),_0xfd84('0x4c'),_0xfd84('0x4d'),_0xfd84('0x4e')]),{'where':{'context':_0x4edf86[_0xfd84('0x49')],'exten':_0x4edf86['exten']},'individualHooks':!![]})[_0xfd84('0x20')](function(_0x2a56f7){return _0x2a56f7;});}return null;})[_0xfd84('0x20')](respondWithStatusCode(_0x294c69,null))['catch'](handleError(_0x294c69,null));};exports[_0xfd84('0x4f')]=function(_0x283c5b,_0x5acc1d){var _0x49fd31=_0x283c5b[_0xfd84('0x3b')]['id'];var _0x42f040=_0x283c5b[_0xfd84('0x40')];var _0x297cd7=0xc8;var _0x5df931=null;return db[_0xfd84('0x50')][_0xfd84('0x51')]({'isolationLevel':db[_0xfd84('0x50')][_0xfd84('0x52')][_0xfd84('0x53')][_0xfd84('0x54')]},function(_0x3f1bd6){return db[_0xfd84('0x36')][_0xfd84('0x55')]({'where':{'id':_0x49fd31},'transaction':_0x3f1bd6})[_0xfd84('0x20')](function(_0x5e36e2){if(_0x5e36e2){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x49fd31},'transaction':_0x3f1bd6})[_0xfd84('0x20')](function(){var _0x38116b=_[_0xfd84('0x19')](_0x42f040,function(_0x42e2e5){_0x42e2e5[_0xfd84('0x56')]=_0x49fd31;_0x42e2e5['isApp']=!![];return _0x42e2e5;});return _0x5e36e2['createRouting'](_0x38116b);})[_0xfd84('0x20')](function(_0x296351){return db[_0xfd84('0x36')]['bulkCreate'](_0x296351,{'transaction':_0x3f1bd6});});}else{_0x297cd7=0x194;_0x5df931=[];}});})[_0xfd84('0x20')](function(){if(_0x297cd7!==0x194){return db[_0xfd84('0x36')][_0xfd84('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x49fd31},'order':_0xfd84('0x58')})[_0xfd84('0x20')](function(_0x1d13db){_0x5df931=_0x1d13db;});}})[_0xfd84('0x3d')](function(_0x3b2f21){_0x297cd7=0x1f4;logger[_0xfd84('0x21')](_0x3b2f21[_0xfd84('0x22')]);if(_0x3b2f21[_0xfd84('0x1e')]){delete _0x3b2f21[_0xfd84('0x1e')];}_0x5df931=_0x3b2f21;})[_0xfd84('0x59')](function(){if(_0x5df931===null){_0x5acc1d[_0xfd84('0x7')](_0x297cd7);}else{if(_0x297cd7===0x1f4){_0x5acc1d[_0xfd84('0x8')](_0x297cd7)[_0xfd84('0x23')](_0x5df931);}else{_0x5acc1d[_0xfd84('0x8')](_0x297cd7)[_0xfd84('0x10')](_0x5df931);}}});}; \ No newline at end of file +var _0xcfaf=['defaults','localhost','socket.io-emitter','register','end','status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','value','includes','type','name','UserProfileResource','sendStatus','error','stack','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','VoiceExtension','include','findAll','rows','catch','show','params','includeAll','find','body','exten','concat','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','outbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','finally','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis'];(function(_0x11c6fc,_0x388b8a){var _0x21474e=function(_0x22131a){while(--_0x22131a){_0x11c6fc['push'](_0x11c6fc['shift']());}};_0x21474e(++_0x388b8a);}(_0xcfaf,0x176));var _0xfcfa=function(_0x17f95a,_0x32fa48){_0x17f95a=_0x17f95a-0x0;var _0x396a52=_0xcfaf[_0x17f95a];return _0x396a52;};'use strict';var _=require(_0xfcfa('0x0'));var Redis=require('ioredis');var qs=require(_0xfcfa('0x1'));var logger=require('../../config/logger')(_0xfcfa('0x2'));var config=require(_0xfcfa('0x3'));var db=require(_0xfcfa('0x4'))['db'];config[_0xfcfa('0x5')]=_[_0xfcfa('0x6')](config[_0xfcfa('0x5')],{'host':_0xfcfa('0x7'),'port':0x18eb});var socket=require(_0xfcfa('0x8'))(new Redis(config[_0xfcfa('0x5')]));require('./voiceExtension.socket')[_0xfcfa('0x9')](socket);function respondWithStatusCode(_0x124280,_0x38d2e0){_0x38d2e0=_0x38d2e0||0xcc;return function(_0x3c77c1){if(_0x3c77c1){return _0x124280['sendStatus'](_0x38d2e0);}return _0x124280['status'](_0x38d2e0)[_0xfcfa('0xa')]();};}function respondWithResult(_0x281884,_0x413d80){_0x413d80=_0x413d80||0xc8;return function(_0x3b5b8c){if(_0x3b5b8c){return _0x281884[_0xfcfa('0xb')](_0x413d80)[_0xfcfa('0xc')](_0x3b5b8c);}};}function respondWithFilteredResult(_0x2b7683,_0x4bfea2){return function(_0x3fb1a1){if(_0x3fb1a1){var _0x843a26=typeof _0x4bfea2['offset']===_0xfcfa('0xd')&&typeof _0x4bfea2[_0xfcfa('0xe')]==='undefined';var _0x2c872a=_0x3fb1a1[_0xfcfa('0xf')];var _0x4c1cc0=_0x843a26?0x0:_0x4bfea2[_0xfcfa('0x10')];var _0x6a8469=_0x843a26?_0x3fb1a1[_0xfcfa('0xf')]:_0x4bfea2['offset']+_0x4bfea2[_0xfcfa('0xe')];var _0x4fe7f2;if(_0x6a8469>=_0x2c872a){_0x6a8469=_0x2c872a;_0x4fe7f2=0xc8;}else{_0x4fe7f2=0xce;}_0x2b7683[_0xfcfa('0xb')](_0x4fe7f2);return _0x2b7683[_0xfcfa('0x11')](_0xfcfa('0x12'),_0x4c1cc0+'-'+_0x6a8469+'/'+_0x2c872a)[_0xfcfa('0xc')](_0x3fb1a1);}return null;};}function removeEntity(_0x271baa){return function(_0x5a3c78){if(_0x5a3c78){return _0x5a3c78[_0xfcfa('0x13')]()[_0xfcfa('0x14')](function(){var _0xc64d71=_0x5a3c78['get']({'plain':!![]});var _0x2e9c5e=[{'name':_0xfcfa('0x15'),'value':_0xfcfa('0x16'),'ignore':![]},{'name':_0xfcfa('0x17'),'value':'outbound','ignore':![]},{'name':_0xfcfa('0x18'),'value':_0xfcfa('0x19'),'ignore':![]}];var _0x56f0c8=_(_0x2e9c5e)[_0xfcfa('0x1a')](_0xfcfa('0x1b'))['map'](_0xfcfa('0x1c'))[_0xfcfa('0x1c')]();if(_[_0xfcfa('0x1d')](_0x56f0c8,_0xc64d71[_0xfcfa('0x1e')])){return;}var _0x2ce829=_['find'](_0x2e9c5e,[_0xfcfa('0x1c'),_0xc64d71[_0xfcfa('0x1e')]])[_0xfcfa('0x1f')];return db[_0xfcfa('0x20')][_0xfcfa('0x13')]({'where':{'type':_0x2ce829,'resourceId':_0xc64d71['id']}})['then'](function(){return _0x5a3c78;});})[_0xfcfa('0x14')](function(){_0x271baa[_0xfcfa('0xb')](0xcc)[_0xfcfa('0xa')]();});}};}function handleEntityNotFound(_0x26d562){return function(_0x4b365b){if(!_0x4b365b){_0x26d562[_0xfcfa('0x21')](0x194);}return _0x4b365b;};}function handleError(_0x55b299,_0x30b5a7){_0x30b5a7=_0x30b5a7||0x1f4;return function(_0x276667){logger[_0xfcfa('0x22')](_0x276667[_0xfcfa('0x23')]);if(_0x276667[_0xfcfa('0x1f')]){delete _0x276667[_0xfcfa('0x1f')];}_0x55b299[_0xfcfa('0xb')](_0x30b5a7)[_0xfcfa('0x24')](_0x276667);};}exports[_0xfcfa('0x25')]=function(_0x50e571,_0x300985){var _0x4472d1={},_0x4a100e={},_0x5f507b={'count':0x0,'rows':[]};var _0x2759c7=_[_0xfcfa('0x26')](db['VoiceExtension'][_0xfcfa('0x27')],function(_0x4af732){return{'name':_0x4af732['fieldName'],'type':_0x4af732[_0xfcfa('0x1e')][_0xfcfa('0x28')]};});_0x4a100e[_0xfcfa('0x29')]=_['map'](_0x2759c7,'name');_0x4a100e['query']=_[_0xfcfa('0x2a')](_0x50e571[_0xfcfa('0x2b')]);_0x4a100e[_0xfcfa('0x2c')]=_[_0xfcfa('0x2d')](_0x4a100e['model'],_0x4a100e[_0xfcfa('0x2b')]);_0x4472d1[_0xfcfa('0x2e')]=_[_0xfcfa('0x2d')](_0x4a100e['model'],qs[_0xfcfa('0x2f')](_0x50e571[_0xfcfa('0x2b')]['fields']));_0x4472d1[_0xfcfa('0x2e')]=_0x4472d1['attributes'][_0xfcfa('0x30')]?_0x4472d1['attributes']:_0x4a100e['model'];if(!_0x50e571[_0xfcfa('0x2b')][_0xfcfa('0x31')](_0xfcfa('0x32'))){_0x4472d1[_0xfcfa('0xe')]=qs['limit'](_0x50e571[_0xfcfa('0x2b')][_0xfcfa('0xe')]);_0x4472d1[_0xfcfa('0x10')]=qs[_0xfcfa('0x10')](_0x50e571[_0xfcfa('0x2b')]['offset']);}_0x4472d1[_0xfcfa('0x33')]=qs['sort'](_0x50e571[_0xfcfa('0x2b')][_0xfcfa('0x34')]);_0x4472d1[_0xfcfa('0x35')]=qs[_0xfcfa('0x2c')](_[_0xfcfa('0x36')](_0x50e571['query'],_0x4a100e['filters']),_0x2759c7);if(_0x50e571['query'][_0xfcfa('0x1a')]){_0x4472d1[_0xfcfa('0x35')]=_['merge'](_0x4472d1[_0xfcfa('0x35')],{'$or':_[_0xfcfa('0x26')](_0x2759c7,function(_0x2fc4e5){if(_0x2fc4e5[_0xfcfa('0x1e')]!==_0xfcfa('0x37')){var _0x4e905c={};_0x4e905c[_0x2fc4e5[_0xfcfa('0x1f')]]={'$like':'%'+_0x50e571[_0xfcfa('0x2b')][_0xfcfa('0x1a')]+'%'};return _0x4e905c;}})});}_0x4472d1=_[_0xfcfa('0x38')]({},_0x4472d1,_0x50e571[_0xfcfa('0x39')]);var _0x2bcb0d={'where':_0x4472d1[_0xfcfa('0x35')]};return db[_0xfcfa('0x3a')][_0xfcfa('0xf')](_0x2bcb0d)[_0xfcfa('0x14')](function(_0x248a85){_0x5f507b[_0xfcfa('0xf')]=_0x248a85;if(_0x50e571['query']['includeAll']){_0x4472d1[_0xfcfa('0x3b')]=[{'all':!![]}];}return db[_0xfcfa('0x3a')][_0xfcfa('0x3c')](_0x4472d1);})[_0xfcfa('0x14')](function(_0x59ff6e){_0x5f507b[_0xfcfa('0x3d')]=_0x59ff6e;return _0x5f507b;})['then'](respondWithFilteredResult(_0x300985,_0x4472d1))[_0xfcfa('0x3e')](handleError(_0x300985,null));};exports[_0xfcfa('0x3f')]=function(_0x5cd91a,_0x1612a0){var _0x453820={'raw':![],'where':{'id':_0x5cd91a[_0xfcfa('0x40')]['id']}},_0x4db561={};_0x4db561[_0xfcfa('0x29')]=_[_0xfcfa('0x2a')](db['VoiceExtension'][_0xfcfa('0x27')]);_0x4db561['query']=_[_0xfcfa('0x2a')](_0x5cd91a[_0xfcfa('0x2b')]);_0x4db561[_0xfcfa('0x2c')]=_[_0xfcfa('0x2d')](_0x4db561[_0xfcfa('0x29')],_0x4db561[_0xfcfa('0x2b')]);_0x453820[_0xfcfa('0x2e')]=_[_0xfcfa('0x2d')](_0x4db561[_0xfcfa('0x29')],qs['fields'](_0x5cd91a[_0xfcfa('0x2b')][_0xfcfa('0x2f')]));_0x453820[_0xfcfa('0x2e')]=_0x453820[_0xfcfa('0x2e')][_0xfcfa('0x30')]?_0x453820[_0xfcfa('0x2e')]:_0x4db561['model'];if(_0x5cd91a['query'][_0xfcfa('0x41')]){_0x453820[_0xfcfa('0x3b')]=[{'all':!![]}];}_0x453820=_[_0xfcfa('0x38')]({},_0x453820,_0x5cd91a[_0xfcfa('0x39')]);return db[_0xfcfa('0x3a')]['find'](_0x453820)['then'](handleEntityNotFound(_0x1612a0,null))['then'](respondWithResult(_0x1612a0,null))[_0xfcfa('0x3e')](handleError(_0x1612a0,null));};exports['destroy']=function(_0x586aea,_0x2fe616){return db[_0xfcfa('0x3a')][_0xfcfa('0x42')]({'where':{'id':_0x586aea[_0xfcfa('0x40')]['id']}})[_0xfcfa('0x14')](handleEntityNotFound(_0x2fe616,null))[_0xfcfa('0x14')](removeEntity(_0x2fe616,null))[_0xfcfa('0x3e')](handleError(_0x2fe616,null));};exports['create']=function(_0xee3cdc,_0xb6350){if(_0xee3cdc[_0xfcfa('0x43')][_0xfcfa('0x1e')]==='outbound'&&!_['startsWith'](_0xee3cdc[_0xfcfa('0x43')][_0xfcfa('0x44')],'_')){_0xee3cdc[_0xfcfa('0x43')][_0xfcfa('0x44')]='_'[_0xfcfa('0x45')](_0xee3cdc['body'][_0xfcfa('0x44')]);}return db[_0xfcfa('0x3a')][_0xfcfa('0x46')](_0xee3cdc['body'],{'raw':![]})[_0xfcfa('0x14')](function(_0x322d9e){var _0x11154c=_0xee3cdc['user'][_0xfcfa('0x47')]({'plain':!![]});if(!_0x11154c)throw new Error(_0xfcfa('0x48'));if(_0x11154c[_0xfcfa('0x49')]===_0xfcfa('0x4a')){var _0x3bcde9=_0x322d9e[_0xfcfa('0x47')]({'plain':!![]});var _0x5d504d=[{'name':_0xfcfa('0x15'),'value':_0xfcfa('0x16')},{'name':_0xfcfa('0x17'),'value':_0xfcfa('0x4b')},{'name':_0xfcfa('0x18'),'value':_0xfcfa('0x19')}];var _0xb7bcd7=_['find'](_0x5d504d,[_0xfcfa('0x1c'),_0x3bcde9[_0xfcfa('0x1e')]])[_0xfcfa('0x1f')];return db[_0xfcfa('0x4c')][_0xfcfa('0x42')]({'where':{'name':_0xb7bcd7,'userProfileId':_0x11154c[_0xfcfa('0x4d')]},'raw':!![]})['then'](function(_0x1b8c91){if(_0x1b8c91&&_0x1b8c91[_0xfcfa('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x3bcde9[_0xfcfa('0x1f')],'resourceId':_0x3bcde9['id'],'type':_0x1b8c91['name'],'sectionId':_0x1b8c91['id']},{})[_0xfcfa('0x14')](function(){return _0x322d9e;});}else{return _0x322d9e;}})[_0xfcfa('0x3e')](function(_0x41d4b6){logger[_0xfcfa('0x22')](_0xfcfa('0x4f'),_0x41d4b6);throw _0x41d4b6;});}return _0x322d9e;})['then'](respondWithResult(_0xb6350,0xc9))['catch'](handleError(_0xb6350,null));};exports[_0xfcfa('0x50')]=function(_0x93471f,_0x1cdbcc){if(_0x93471f[_0xfcfa('0x43')]['id']){delete _0x93471f[_0xfcfa('0x43')]['id'];}return db[_0xfcfa('0x3a')][_0xfcfa('0x42')]({'where':{'id':_0x93471f['params']['id']}})[_0xfcfa('0x14')](handleEntityNotFound(_0x1cdbcc,null))[_0xfcfa('0x14')](function(_0x34121a){if(_0x34121a){return db[_0xfcfa('0x3a')][_0xfcfa('0x50')](_[_0xfcfa('0x36')](_0x93471f['body'],[_0xfcfa('0x44'),_0xfcfa('0x51'),_0xfcfa('0x52'),'recordingFormat',_0xfcfa('0x53'),'mandatoryDisposition','alias']),{'where':{'context':_0x34121a[_0xfcfa('0x51')],'exten':_0x34121a[_0xfcfa('0x44')]},'individualHooks':!![]})['then'](function(_0x4d404e){return _0x4d404e;});}return null;})[_0xfcfa('0x14')](respondWithStatusCode(_0x1cdbcc,null))[_0xfcfa('0x3e')](handleError(_0x1cdbcc,null));};exports['addApplications']=function(_0x379377,_0x24d07d){var _0x23a53b=_0x379377[_0xfcfa('0x40')]['id'];var _0x26f960=_0x379377[_0xfcfa('0x43')];var _0x40e81f=0xc8;var _0x148802=null;return db['sequelize'][_0xfcfa('0x54')]({'isolationLevel':db[_0xfcfa('0x55')][_0xfcfa('0x56')][_0xfcfa('0x57')][_0xfcfa('0x58')]},function(_0x42c202){return db[_0xfcfa('0x3a')][_0xfcfa('0x59')]({'where':{'id':_0x23a53b},'transaction':_0x42c202})[_0xfcfa('0x14')](function(_0x5423ec){if(_0x5423ec){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x23a53b},'transaction':_0x42c202})[_0xfcfa('0x14')](function(){var _0x23961f=_[_0xfcfa('0x26')](_0x26f960,function(_0x226131){_0x226131[_0xfcfa('0x5a')]=_0x23a53b;_0x226131['isApp']=!![];return _0x226131;});return _0x5423ec[_0xfcfa('0x5b')](_0x23961f);})[_0xfcfa('0x14')](function(_0xd4063){return db[_0xfcfa('0x3a')][_0xfcfa('0x5c')](_0xd4063,{'transaction':_0x42c202});});}else{_0x40e81f=0x194;_0x148802=[];}});})[_0xfcfa('0x14')](function(){if(_0x40e81f!==0x194){return db['VoiceExtension'][_0xfcfa('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x23a53b},'order':'cast(priority\x20as\x20unsigned)'})[_0xfcfa('0x14')](function(_0x41efda){_0x148802=_0x41efda;});}})['catch'](function(_0x36a5ed){_0x40e81f=0x1f4;logger['error'](_0x36a5ed[_0xfcfa('0x23')]);if(_0x36a5ed[_0xfcfa('0x1f')]){delete _0x36a5ed['name'];}_0x148802=_0x36a5ed;})[_0xfcfa('0x5e')](function(){if(_0x148802===null){_0x24d07d[_0xfcfa('0x21')](_0x40e81f);}else{if(_0x40e81f===0x1f4){_0x24d07d['status'](_0x40e81f)['send'](_0x148802);}else{_0x24d07d[_0xfcfa('0xb')](_0x40e81f)[_0xfcfa('0xc')](_0x148802);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 69e3289..3207c65 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 _0xe629=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0xe629,0x18e));var _0x9e62=function(_0x48b674,_0x597b96){_0x48b674=_0x48b674-0x0;var _0x219a4e=_0xe629[_0x48b674];return _0x219a4e;};'use strict';var EventEmitter=require(_0x9e62('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x9e62('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9e62('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9e62('0x3')};function emitEvent(_0x496537){return function(_0x191acd,_0x56919e,_0x35c0ed){VoiceExtensionEvents[_0x9e62('0x4')](_0x496537+':'+_0x191acd['id'],_0x191acd);VoiceExtensionEvents[_0x9e62('0x4')](_0x496537,_0x191acd);_0x35c0ed(null);};}for(var e in events){if(events[_0x9e62('0x5')](e)){var event=events[e];VoiceExtension[_0x9e62('0x6')](e,emitEvent(event));}}module[_0x9e62('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x34e7=['save','remove','emit','hasOwnProperty','hook'];(function(_0xcc94b,_0x3f516d){var _0x342f7c=function(_0xf7475){while(--_0xf7475){_0xcc94b['push'](_0xcc94b['shift']());}};_0x342f7c(++_0x3f516d);}(_0x34e7,0x1f4));var _0x734e=function(_0x579d09,_0x1ac221){_0x579d09=_0x579d09-0x0;var _0x4df6bb=_0x34e7[_0x579d09];return _0x4df6bb;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x734e('0x0'),'afterUpdate':'update','afterDestroy':_0x734e('0x1')};function emitEvent(_0x493fe3){return function(_0x2592e9,_0x4c91f6,_0x2444f6){VoiceExtensionEvents['emit'](_0x493fe3+':'+_0x2592e9['id'],_0x2592e9);VoiceExtensionEvents[_0x734e('0x2')](_0x493fe3,_0x2592e9);_0x2444f6(null);};}for(var e in events){if(events[_0x734e('0x3')](e)){var event=events[e];VoiceExtension[_0x734e('0x4')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index bb3b29e..595215a 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 _0x5c8a=['./voiceExtension.attributes','exports','Set','CDR(type)=','context','exten','type','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','${EXTEN:','cutdigits','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','wav','timeout','split','name','trunk','phone','prefix','${EXTEN}','param','SIP','join','options','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','define','VoiceExtension','voice_extensions','lodash'];(function(_0x46aad6,_0x402d36){var _0x26fa1d=function(_0x55e809){while(--_0x55e809){_0x46aad6['push'](_0x46aad6['shift']());}};_0x26fa1d(++_0x402d36);}(_0x5c8a,0x176));var _0xa5c8=function(_0x2207f4,_0x465326){_0x2207f4=_0x2207f4-0x0;var _0x19969f=_0x5c8a[_0x2207f4];return _0x19969f;};'use strict';var _=require(_0xa5c8('0x0'));var attributes=require(_0xa5c8('0x1'));module[_0xa5c8('0x2')]=function(_0x523a26){var _0x480280=_0x523a26['models'];function _0x280483(_0x1acaaa){var _0x2343d0=0x2;var _0x63bd55=[{'type':_0x1acaaa['type'],'app':_0xa5c8('0x3'),'appdata':_0xa5c8('0x4')+_0x1acaaa['type'],'context':_0x1acaaa[_0xa5c8('0x5')],'exten':_0x1acaaa[_0xa5c8('0x6')],'priority':_0x2343d0++,'VoiceExtensionId':_0x1acaaa['id']}];if(_0x1acaaa[_0xa5c8('0x7')]===_0xa5c8('0x8')){_0x63bd55[_0xa5c8('0x9')]({'type':'inbound','app':_0xa5c8('0x3'),'appdata':_0xa5c8('0xa')+_0x1acaaa['id'],'context':_0x1acaaa[_0xa5c8('0x5')],'exten':_0x1acaaa[_0xa5c8('0x6')],'priority':_0x2343d0++,'VoiceExtensionId':_0x1acaaa['id']});}_0x63bd55[_0xa5c8('0x9')]({'type':_0x1acaaa[_0xa5c8('0x7')],'app':_0xa5c8('0x3'),'appdata':_0xa5c8('0xb'),'context':_0x1acaaa[_0xa5c8('0x5')],'exten':_0x1acaaa['exten'],'priority':_0x2343d0++,'VoiceExtensionId':_0x1acaaa['id']},{'type':_0x1acaaa[_0xa5c8('0x7')],'app':_0xa5c8('0x3'),'appdata':_0xa5c8('0xc'),'context':_0x1acaaa[_0xa5c8('0x5')],'exten':_0x1acaaa[_0xa5c8('0x6')],'priority':_0x2343d0++,'VoiceExtensionId':_0x1acaaa['id']},{'type':_0x1acaaa['type'],'app':_0xa5c8('0x3'),'appdata':_0xa5c8('0xd'),'context':_0x1acaaa[_0xa5c8('0x5')],'exten':_0x1acaaa[_0xa5c8('0x6')],'priority':_0x2343d0++,'VoiceExtensionId':_0x1acaaa['id']});return _0x63bd55;}function _0x12b337(_0x33bb36){var _0x573056=0x2;var _0x2f05c2=[{'type':_0xa5c8('0xe'),'app':_0xa5c8('0x3'),'appdata':_0xa5c8('0xf'),'context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36['exten'],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']},{'type':'outbound','app':_0xa5c8('0x3'),'appdata':'CDR(destination)='+(_0x33bb36['cutdigits']?_0xa5c8('0x10')+_0x33bb36[_0xa5c8('0x11')]+'}':'${EXTEN}'),'context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36[_0xa5c8('0x6')],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']},{'type':_0xa5c8('0xe'),'app':_0xa5c8('0x3'),'appdata':'CDR(routeid)='+_0x33bb36['id'],'context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36[_0xa5c8('0x6')],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']},{'type':_0xa5c8('0xe'),'app':_0xa5c8('0x12'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x573056+0x2)+_0xa5c8('0x13')+(_0x573056+0x1)+')','context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36['exten'],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']},{'type':_0xa5c8('0xe'),'app':'Set','appdata':_0x33bb36['cutdigits']?_0xa5c8('0x14')+_0x33bb36[_0xa5c8('0x11')]+'}':_0xa5c8('0x15'),'context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36[_0xa5c8('0x6')],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']},{'type':_0xa5c8('0xe'),'app':_0xa5c8('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36[_0xa5c8('0x6')],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']},{'type':_0xa5c8('0xe'),'app':'Set','appdata':_0xa5c8('0xc'),'context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36[_0xa5c8('0x6')],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']},{'type':_0xa5c8('0xe'),'app':_0xa5c8('0x3'),'appdata':_0xa5c8('0xd'),'context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36[_0xa5c8('0x6')],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']},{'type':_0xa5c8('0xe'),'app':_0xa5c8('0x3'),'appdata':_0xa5c8('0x16')+_0x33bb36['id'],'context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36[_0xa5c8('0x6')],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']}];if(_0x33bb36[_0xa5c8('0x17')]('recordingFormat')&&_0x33bb36[_0xa5c8('0x18')]!==_0xa5c8('0x19')){_0x2f05c2[_0xa5c8('0x9')]({'type':_0xa5c8('0xe'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36[_0xa5c8('0x6')],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']},{'type':_0xa5c8('0xe'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x33bb36[_0xa5c8('0x18')]||_0xa5c8('0x1a'),'context':_0x33bb36[_0xa5c8('0x5')],'exten':_0x33bb36[_0xa5c8('0x6')],'priority':_0x573056++,'VoiceExtensionId':_0x33bb36['id']});}return _0x2f05c2;}function _0x1452a7(_0x17c851,_0x4fbd8b){var _0x3a0b9e=[{'name':'trunk','param':0x0},{'name':_0xa5c8('0x1b'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x2086fc={};var _0x231756=_0x4fbd8b[_0xa5c8('0x1c')](',');var _0x2d741e=[];for(var _0x3aaf62=0x0;_0x3aaf62<_0x3a0b9e['length'];_0x3aaf62++){switch(_0x3a0b9e[_0x3aaf62][_0xa5c8('0x1d')]){case _0xa5c8('0x1e'):_0x2086fc['trunk']=_0x231756[_0x3a0b9e[_0x3aaf62]['param']][_0xa5c8('0x1c')]('/')[0x1];_0x2086fc[_0xa5c8('0x1f')]=_0x231756[_0x3a0b9e[_0x3aaf62]['param']]['split']('/')[0x2];_0x2086fc[_0xa5c8('0x20')]=_0x2086fc['phone']?_0x2086fc[_0xa5c8('0x1f')][_0xa5c8('0x1c')]('$')[0x0]:undefined;_0x2086fc[_0xa5c8('0x1f')]=_0x17c851['cutdigits']?(_0x2086fc[_0xa5c8('0x20')]||'')+_0xa5c8('0x10')+_0x17c851[_0xa5c8('0x11')]+'}':(_0x2086fc[_0xa5c8('0x20')]||'')+_0xa5c8('0x21');_0x2d741e[_0x3a0b9e[_0x3aaf62][_0xa5c8('0x22')]]=[_0xa5c8('0x23'),_0x2086fc[_0xa5c8('0x1e')],_0x2086fc['phone']][_0xa5c8('0x24')]('/');break;case _0xa5c8('0x25'):_0x2086fc[_0xa5c8('0x25')]=_0x231756[_0x3a0b9e[_0x3aaf62]['param']];if(_0x17c851['recordingFormat']!==_0xa5c8('0x19')){if(_0x2086fc['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x2086fc[_0xa5c8('0x25')]+=_0xa5c8('0x26');}}else{_0x2086fc[_0xa5c8('0x25')]=_0x2086fc[_0xa5c8('0x25')]['replace']('U(xcally-mixmonitor-context)','');}_0x2d741e[_0x3a0b9e[_0x3aaf62][_0xa5c8('0x22')]]=_0x2086fc[_0xa5c8('0x25')];break;default:_0x2d741e[_0x3a0b9e[_0x3aaf62][_0xa5c8('0x22')]]=_0x231756[_0x3a0b9e[_0x3aaf62]['param']];}}return _0x2d741e[_0xa5c8('0x24')](',');}function _0x17bb2a(_0x2ee957,_0x18f15e,_0x4ee77c){return new Promise(function(_0x2ef752,_0x359b62){var _0x3c74a1=[];if(_[_0xa5c8('0x27')](_0x18f15e))return _0x2ef752(_0x3c74a1);_0x480280[_0xa5c8('0x28')][_0xa5c8('0x29')]({'attributes':['id',_0xa5c8('0x2a'),_0xa5c8('0x2b')],'raw':!![]})[_0xa5c8('0x2c')](function(_0x41f09d){for(var _0x191323=0x0,_0x5c81c5=0x0;_0x191323<_0x18f15e[_0xa5c8('0x2d')];_0x191323++,_0x5c81c5=0x0){var _0x2b6a3a=_0x18f15e[_0x191323];var _0x127892=[];var _0x29d8d1=[];delete _0x2b6a3a['id'];if(_0x2b6a3a[_0xa5c8('0x2a')]!==_0xa5c8('0x2e')){_0x2b6a3a[_0xa5c8('0x2f')]=[_0x2b6a3a[_0xa5c8('0x2a')]];}else{_0x2b6a3a[_0xa5c8('0x2f')]=_0x2b6a3a[_0xa5c8('0x2b')]?_[_0xa5c8('0x30')](_[_0xa5c8('0x31')](_0x41f09d,{'IntervalId':_0x2b6a3a[_0xa5c8('0x2b')]}),'interval'):[];}_0x2b6a3a[_0xa5c8('0x5')]=_0x2ee957[_0xa5c8('0x5')];_0x2b6a3a[_0xa5c8('0x6')]=_0x2ee957[_0xa5c8('0x6')];if(_0x2b6a3a[_0xa5c8('0x7')])_0x2b6a3a[_0xa5c8('0x7')]=_0x2b6a3a[_0xa5c8('0x7')][_0xa5c8('0x32')]();if(_0x2ee957[_0xa5c8('0x7')]===_0xa5c8('0xe')){if(_0x2b6a3a[_0xa5c8('0x17')](_0xa5c8('0x33'))&&_0x2b6a3a['tag']&&_0x2b6a3a['tag']!=='--'){_0x127892[_0xa5c8('0x9')]({'type':_0x2b6a3a[_0xa5c8('0x7')]['toLowerCase'](),'app':_0xa5c8('0x3'),'appdata':_0xa5c8('0x34')+_0x2b6a3a[_0xa5c8('0x33')],'context':_0x2ee957[_0xa5c8('0x5')],'exten':_0x2ee957['exten'],'priority':_0x2b6a3a[_0xa5c8('0x2f')][_0xa5c8('0x2d')]+_0x4ee77c+_0x5c81c5++,'VoiceExtensionId':_0x2ee957['id']});}_0x127892['push']({'type':_0x2b6a3a['type'][_0xa5c8('0x32')](),'app':_0xa5c8('0x12'),'appdata':_0xa5c8('0x35')+(_0x2b6a3a[_0xa5c8('0x36')]?'Set(CALLERID(all)='+_0x2b6a3a[_0xa5c8('0x36')]+')':_0xa5c8('0x37')),'context':_0x2ee957[_0xa5c8('0x5')],'exten':_0x2ee957[_0xa5c8('0x6')],'priority':_0x2b6a3a[_0xa5c8('0x2f')][_0xa5c8('0x2d')]+_0x4ee77c+_0x5c81c5++,'VoiceExtensionId':_0x2ee957['id']});}else{if(_0x2b6a3a[_0xa5c8('0x17')](_0xa5c8('0x38'))){if([_0xa5c8('0x39'),'playback'][_0xa5c8('0x3a')](_0x2b6a3a['app'][_0xa5c8('0x32')]())&&_0x2b6a3a['appType']!==_0xa5c8('0x3b')){if(_0x2b6a3a[_0xa5c8('0x38')]){_0x127892[_0xa5c8('0x9')]({'type':_0x2b6a3a['type']['toLowerCase'](),'app':_0xa5c8('0x12'),'appdata':_0xa5c8('0x3c'),'context':_0x2ee957[_0xa5c8('0x5')],'exten':_0x2ee957[_0xa5c8('0x6')],'priority':_0x2b6a3a['intervals'][_0xa5c8('0x2d')]+_0x4ee77c+_0x5c81c5++,'VoiceExtensionId':_0x2ee957['id']});_0x127892[_0xa5c8('0x9')]({'type':_0x2b6a3a['type']['toLowerCase'](),'app':_0xa5c8('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2ee957[_0xa5c8('0x5')],'exten':_0x2ee957['exten'],'priority':_0x2b6a3a[_0xa5c8('0x2f')]['length']+_0x4ee77c+_0x5c81c5++,'VoiceExtensionId':_0x2ee957['id']});}else{_0x127892[_0xa5c8('0x9')]({'type':_0x2b6a3a['type'][_0xa5c8('0x32')](),'app':_0xa5c8('0x12'),'appdata':_0xa5c8('0x3d'),'context':_0x2ee957['context'],'exten':_0x2ee957[_0xa5c8('0x6')],'priority':_0x2b6a3a[_0xa5c8('0x2f')]['length']+_0x4ee77c+_0x5c81c5++,'VoiceExtensionId':_0x2ee957['id']});_0x127892[_0xa5c8('0x9')]({'type':_0x2b6a3a['type'][_0xa5c8('0x32')](),'app':_0xa5c8('0x3'),'appdata':_0xa5c8('0x3e'),'context':_0x2ee957[_0xa5c8('0x5')],'exten':_0x2ee957['exten'],'priority':_0x2b6a3a[_0xa5c8('0x2f')][_0xa5c8('0x2d')]+_0x4ee77c+_0x5c81c5++,'VoiceExtensionId':_0x2ee957['id']});}}}}for(var _0x253e08=0x0;_0x253e08<_0x2b6a3a[_0xa5c8('0x2f')][_0xa5c8('0x2d')];_0x253e08++){var _0x39dcc6=_0x4ee77c+_0x2b6a3a[_0xa5c8('0x2f')][_0xa5c8('0x2d')];var _0x21a5a4=_0x253e08===_0x2b6a3a[_0xa5c8('0x2f')]['length']-0x1?_0x4ee77c+_0x127892[_0xa5c8('0x2d')]+_0x29d8d1[_0xa5c8('0x2d')]+0x2:_0x4ee77c+_0x253e08+0x1;_0x127892['splice'](_0x253e08,0x0,{'type':_0x2ee957['type'],'app':_0xa5c8('0x3f'),'appdata':_0x2b6a3a[_0xa5c8('0x2f')][_0x253e08]+'?'+_0x2ee957['context']+_0xa5c8('0x40')+_0x39dcc6+':'+_0x2ee957['context']+_0xa5c8('0x40')+_0x21a5a4,'exten':_0x2ee957[_0xa5c8('0x6')],'context':_0x2ee957['context'],'priority':_0x4ee77c+_0x253e08,'VoiceExtensionId':_0x2ee957['id']});}if(_0x2b6a3a[_0xa5c8('0x41')]===_0xa5c8('0x42')){_0x2b6a3a[_0xa5c8('0x43')]=_0x1452a7(_0x2ee957,_0x2b6a3a[_0xa5c8('0x43')]);}if(_0x2b6a3a['appType']==='agi'){_0x127892[_0xa5c8('0x9')]({'type':_0x2b6a3a[_0xa5c8('0x7')][_0xa5c8('0x32')](),'app':_0xa5c8('0x3'),'appdata':_0xa5c8('0x44'),'context':_0x2ee957[_0xa5c8('0x5')],'exten':_0x2ee957[_0xa5c8('0x6')],'priority':_0x2b6a3a[_0xa5c8('0x2f')][_0xa5c8('0x2d')]+_0x4ee77c+_0x5c81c5++,'VoiceExtensionId':_0x2ee957['id']});}_0x2b6a3a['priority']=_0x127892[_0xa5c8('0x2d')]?_['last'](_0x127892)[_0xa5c8('0x45')]+0x1:_0x4ee77c;_0x3c74a1=_[_0xa5c8('0x46')](_0x3c74a1,_0x127892,[_0x2b6a3a],_0x29d8d1);_0x4ee77c=_[_0xa5c8('0x47')](_0x3c74a1)[_0xa5c8('0x45')]+0x1;}return _0x2ef752(_0x3c74a1);})['catch'](function(_0x5a1817){_0x359b62(_0x5a1817);});});}return _0x523a26[_0xa5c8('0x48')](_0xa5c8('0x49'),attributes,{'tableName':_0xa5c8('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1c7206){var _0x4f09b9=this['get']({'plain':!![]});var _0x3bcd2b=_0x4f09b9[_0xa5c8('0x7')]==='outbound'?_0x12b337(_0x4f09b9):_0x280483(_0x4f09b9);return _0x17bb2a(_0x4f09b9,_0x1c7206,_['last'](_0x3bcd2b)[_0xa5c8('0x45')]+0x1)['then'](function(_0x44b2cb){var _0x3b6962=_[_0xa5c8('0x46')](_0x3bcd2b,_0x44b2cb);_0x3b6962[_0xa5c8('0x9')]({'type':_0x4f09b9[_0xa5c8('0x7')],'app':'Hangup','exten':_0x4f09b9[_0xa5c8('0x6')],'context':_0x4f09b9[_0xa5c8('0x5')],'priority':_['last'](_0x3b6962)[_0xa5c8('0x45')]+0x1,'VoiceExtensionId':_0x4f09b9['id']});return _0x3b6962;});}}});}; \ No newline at end of file +var _0x5814=['intervals','map','filter','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','toLowerCase','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','exports','type','CDR(type)=','context','exten','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','param','prefix','phone','${EXTEN:','${EXTEN}','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then'];(function(_0x2a8606,_0xcbed1e){var _0x307a2e=function(_0x26554a){while(--_0x26554a){_0x2a8606['push'](_0x2a8606['shift']());}};_0x307a2e(++_0xcbed1e);}(_0x5814,0x6e));var _0x4581=function(_0x10020f,_0x4af5f0){_0x10020f=_0x10020f-0x0;var _0x2b58a4=_0x5814[_0x10020f];return _0x2b58a4;};'use strict';var _=require(_0x4581('0x0'));var attributes=require(_0x4581('0x1'));module[_0x4581('0x2')]=function(_0xa24c1f){var _0x9cb452=_0xa24c1f['models'];function _0x52cea2(_0x2a1d5b){var _0x23e61a=0x2;var _0x3e873a=[{'type':_0x2a1d5b[_0x4581('0x3')],'app':'Set','appdata':_0x4581('0x4')+_0x2a1d5b[_0x4581('0x3')],'context':_0x2a1d5b[_0x4581('0x5')],'exten':_0x2a1d5b[_0x4581('0x6')],'priority':_0x23e61a++,'VoiceExtensionId':_0x2a1d5b['id']}];if(_0x2a1d5b['type']===_0x4581('0x7')){_0x3e873a[_0x4581('0x8')]({'type':_0x4581('0x7'),'app':_0x4581('0x9'),'appdata':_0x4581('0xa')+_0x2a1d5b['id'],'context':_0x2a1d5b[_0x4581('0x5')],'exten':_0x2a1d5b[_0x4581('0x6')],'priority':_0x23e61a++,'VoiceExtensionId':_0x2a1d5b['id']});}_0x3e873a[_0x4581('0x8')]({'type':_0x2a1d5b[_0x4581('0x3')],'app':'Set','appdata':_0x4581('0xb'),'context':_0x2a1d5b[_0x4581('0x5')],'exten':_0x2a1d5b['exten'],'priority':_0x23e61a++,'VoiceExtensionId':_0x2a1d5b['id']},{'type':_0x2a1d5b['type'],'app':_0x4581('0x9'),'appdata':_0x4581('0xc'),'context':_0x2a1d5b[_0x4581('0x5')],'exten':_0x2a1d5b[_0x4581('0x6')],'priority':_0x23e61a++,'VoiceExtensionId':_0x2a1d5b['id']},{'type':_0x2a1d5b[_0x4581('0x3')],'app':_0x4581('0x9'),'appdata':_0x4581('0xd'),'context':_0x2a1d5b[_0x4581('0x5')],'exten':_0x2a1d5b[_0x4581('0x6')],'priority':_0x23e61a++,'VoiceExtensionId':_0x2a1d5b['id']});return _0x3e873a;}function _0x5d1453(_0x54262b){var _0xc4d7a9=0x2;var _0x5c7c04=[{'type':_0x4581('0xe'),'app':_0x4581('0x9'),'appdata':_0x4581('0xf'),'context':_0x54262b[_0x4581('0x5')],'exten':_0x54262b[_0x4581('0x6')],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']},{'type':'outbound','app':'Set','appdata':'CDR(destination)='+(_0x54262b[_0x4581('0x10')]?'${EXTEN:'+_0x54262b[_0x4581('0x10')]+'}':'${EXTEN}'),'context':_0x54262b[_0x4581('0x5')],'exten':_0x54262b['exten'],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']},{'type':_0x4581('0xe'),'app':_0x4581('0x9'),'appdata':_0x4581('0xa')+_0x54262b['id'],'context':_0x54262b[_0x4581('0x5')],'exten':_0x54262b[_0x4581('0x6')],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']},{'type':'outbound','app':'ExecIf','appdata':_0x4581('0x11')+(_0xc4d7a9+0x2)+_0x4581('0x12')+(_0xc4d7a9+0x1)+')','context':_0x54262b['context'],'exten':_0x54262b[_0x4581('0x6')],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']},{'type':'outbound','app':_0x4581('0x9'),'appdata':_0x54262b['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x54262b[_0x4581('0x10')]+'}':_0x4581('0x13'),'context':_0x54262b[_0x4581('0x5')],'exten':_0x54262b[_0x4581('0x6')],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']},{'type':_0x4581('0xe'),'app':_0x4581('0x9'),'appdata':_0x4581('0xb'),'context':_0x54262b[_0x4581('0x5')],'exten':_0x54262b[_0x4581('0x6')],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']},{'type':_0x4581('0xe'),'app':_0x4581('0x9'),'appdata':_0x4581('0xc'),'context':_0x54262b[_0x4581('0x5')],'exten':_0x54262b[_0x4581('0x6')],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']},{'type':_0x4581('0xe'),'app':_0x4581('0x9'),'appdata':_0x4581('0xd'),'context':_0x54262b['context'],'exten':_0x54262b['exten'],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']},{'type':_0x4581('0xe'),'app':_0x4581('0x9'),'appdata':_0x4581('0x14')+_0x54262b['id'],'context':_0x54262b[_0x4581('0x5')],'exten':_0x54262b[_0x4581('0x6')],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']}];if(_0x54262b[_0x4581('0x15')](_0x4581('0x16'))&&_0x54262b[_0x4581('0x16')]!==_0x4581('0x17')){_0x5c7c04[_0x4581('0x8')]({'type':_0x4581('0xe'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x54262b[_0x4581('0x5')],'exten':_0x54262b[_0x4581('0x6')],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']},{'type':_0x4581('0xe'),'app':_0x4581('0x9'),'appdata':_0x4581('0x18')+_0x54262b[_0x4581('0x16')]||_0x4581('0x19'),'context':_0x54262b[_0x4581('0x5')],'exten':_0x54262b['exten'],'priority':_0xc4d7a9++,'VoiceExtensionId':_0x54262b['id']});}return _0x5c7c04;}function _0x141441(_0x28d436,_0x519555){var _0x2445d0=[{'name':_0x4581('0x1a'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x4581('0x1b'),'param':0x2},{'name':_0x4581('0x1c'),'param':0x3}];var _0x33ebe6={};var _0xc2720f=_0x519555[_0x4581('0x1d')](',');var _0x2d544d=[];for(var _0x16ea29=0x0;_0x16ea29<_0x2445d0[_0x4581('0x1e')];_0x16ea29++){switch(_0x2445d0[_0x16ea29]['name']){case _0x4581('0x1a'):_0x33ebe6[_0x4581('0x1a')]=_0xc2720f[_0x2445d0[_0x16ea29][_0x4581('0x1f')]][_0x4581('0x1d')]('/')[0x1];_0x33ebe6['phone']=_0xc2720f[_0x2445d0[_0x16ea29][_0x4581('0x1f')]][_0x4581('0x1d')]('/')[0x2];_0x33ebe6[_0x4581('0x20')]=_0x33ebe6[_0x4581('0x21')]?_0x33ebe6[_0x4581('0x21')]['split']('$')[0x0]:undefined;_0x33ebe6[_0x4581('0x21')]=_0x28d436[_0x4581('0x10')]?(_0x33ebe6[_0x4581('0x20')]||'')+_0x4581('0x22')+_0x28d436[_0x4581('0x10')]+'}':(_0x33ebe6['prefix']||'')+_0x4581('0x23');_0x2d544d[_0x2445d0[_0x16ea29][_0x4581('0x1f')]]=[_0x4581('0x24'),_0x33ebe6[_0x4581('0x1a')],_0x33ebe6[_0x4581('0x21')]][_0x4581('0x25')]('/');break;case _0x4581('0x1b'):_0x33ebe6[_0x4581('0x1b')]=_0xc2720f[_0x2445d0[_0x16ea29][_0x4581('0x1f')]];if(_0x28d436[_0x4581('0x16')]!==_0x4581('0x17')){if(_0x33ebe6['options'][_0x4581('0x26')](_0x4581('0x27'))<0x0){_0x33ebe6[_0x4581('0x1b')]+=_0x4581('0x27');}}else{_0x33ebe6[_0x4581('0x1b')]=_0x33ebe6[_0x4581('0x1b')][_0x4581('0x28')](_0x4581('0x27'),'');}_0x2d544d[_0x2445d0[_0x16ea29][_0x4581('0x1f')]]=_0x33ebe6[_0x4581('0x1b')];break;default:_0x2d544d[_0x2445d0[_0x16ea29][_0x4581('0x1f')]]=_0xc2720f[_0x2445d0[_0x16ea29][_0x4581('0x1f')]];}}return _0x2d544d[_0x4581('0x25')](',');}function _0x5ea1ad(_0x565d69,_0x197d08,_0x515d6f){return new Promise(function(_0x45c496,_0x60f31d){var _0x343bfd=[];if(_[_0x4581('0x29')](_0x197d08))return _0x45c496(_0x343bfd);_0x9cb452[_0x4581('0x2a')]['findAll']({'attributes':['id',_0x4581('0x2b'),_0x4581('0x2c')],'raw':!![]})[_0x4581('0x2d')](function(_0x46edf9){for(var _0x5de704=0x0,_0x17f25a=0x0;_0x5de704<_0x197d08[_0x4581('0x1e')];_0x5de704++,_0x17f25a=0x0){var _0x2f25f2=_0x197d08[_0x5de704];var _0x3c071c=[];var _0x3109ea=[];delete _0x2f25f2['id'];if(_0x2f25f2[_0x4581('0x2b')]!=='*,*,*,*'){_0x2f25f2[_0x4581('0x2e')]=[_0x2f25f2[_0x4581('0x2b')]];}else{_0x2f25f2[_0x4581('0x2e')]=_0x2f25f2['IntervalId']?_[_0x4581('0x2f')](_[_0x4581('0x30')](_0x46edf9,{'IntervalId':_0x2f25f2[_0x4581('0x2c')]}),_0x4581('0x2b')):[];}_0x2f25f2[_0x4581('0x5')]=_0x565d69[_0x4581('0x5')];_0x2f25f2[_0x4581('0x6')]=_0x565d69[_0x4581('0x6')];if(_0x2f25f2[_0x4581('0x3')])_0x2f25f2[_0x4581('0x3')]=_0x2f25f2[_0x4581('0x3')]['toLowerCase']();if(_0x565d69[_0x4581('0x3')]===_0x4581('0xe')){if(_0x2f25f2[_0x4581('0x15')]('tag')&&_0x2f25f2[_0x4581('0x31')]&&_0x2f25f2[_0x4581('0x31')]!=='--'){_0x3c071c[_0x4581('0x8')]({'type':_0x2f25f2[_0x4581('0x3')]['toLowerCase'](),'app':_0x4581('0x9'),'appdata':_0x4581('0x32')+_0x2f25f2[_0x4581('0x31')],'context':_0x565d69[_0x4581('0x5')],'exten':_0x565d69[_0x4581('0x6')],'priority':_0x2f25f2['intervals'][_0x4581('0x1e')]+_0x515d6f+_0x17f25a++,'VoiceExtensionId':_0x565d69['id']});}_0x3c071c['push']({'type':_0x2f25f2[_0x4581('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':_0x4581('0x33')+(_0x2f25f2[_0x4581('0x34')]?_0x4581('0x35')+_0x2f25f2[_0x4581('0x34')]+')':_0x4581('0x36')),'context':_0x565d69[_0x4581('0x5')],'exten':_0x565d69[_0x4581('0x6')],'priority':_0x2f25f2[_0x4581('0x2e')]['length']+_0x515d6f+_0x17f25a++,'VoiceExtensionId':_0x565d69['id']});}else{if(_0x2f25f2[_0x4581('0x15')](_0x4581('0x37'))){if(['queue',_0x4581('0x38')][_0x4581('0x39')](_0x2f25f2[_0x4581('0x3a')]['toLowerCase']())&&_0x2f25f2[_0x4581('0x3b')]!=='custom'){if(_0x2f25f2[_0x4581('0x37')]){_0x3c071c[_0x4581('0x8')]({'type':_0x2f25f2[_0x4581('0x3')][_0x4581('0x3c')](),'app':_0x4581('0x3d'),'appdata':_0x4581('0x3e'),'context':_0x565d69[_0x4581('0x5')],'exten':_0x565d69['exten'],'priority':_0x2f25f2[_0x4581('0x2e')]['length']+_0x515d6f+_0x17f25a++,'VoiceExtensionId':_0x565d69['id']});_0x3c071c[_0x4581('0x8')]({'type':_0x2f25f2[_0x4581('0x3')]['toLowerCase'](),'app':_0x4581('0x9'),'appdata':_0x4581('0x3f'),'context':_0x565d69[_0x4581('0x5')],'exten':_0x565d69[_0x4581('0x6')],'priority':_0x2f25f2['intervals'][_0x4581('0x1e')]+_0x515d6f+_0x17f25a++,'VoiceExtensionId':_0x565d69['id']});}else{_0x3c071c[_0x4581('0x8')]({'type':_0x2f25f2[_0x4581('0x3')][_0x4581('0x3c')](),'app':_0x4581('0x3d'),'appdata':_0x4581('0x40'),'context':_0x565d69['context'],'exten':_0x565d69[_0x4581('0x6')],'priority':_0x2f25f2[_0x4581('0x2e')][_0x4581('0x1e')]+_0x515d6f+_0x17f25a++,'VoiceExtensionId':_0x565d69['id']});_0x3c071c[_0x4581('0x8')]({'type':_0x2f25f2[_0x4581('0x3')][_0x4581('0x3c')](),'app':_0x4581('0x9'),'appdata':_0x4581('0x41'),'context':_0x565d69['context'],'exten':_0x565d69[_0x4581('0x6')],'priority':_0x2f25f2[_0x4581('0x2e')]['length']+_0x515d6f+_0x17f25a++,'VoiceExtensionId':_0x565d69['id']});}}}}for(var _0x205cd0=0x0;_0x205cd0<_0x2f25f2[_0x4581('0x2e')][_0x4581('0x1e')];_0x205cd0++){var _0x11c617=_0x515d6f+_0x2f25f2[_0x4581('0x2e')][_0x4581('0x1e')];var _0x435200=_0x205cd0===_0x2f25f2[_0x4581('0x2e')][_0x4581('0x1e')]-0x1?_0x515d6f+_0x3c071c['length']+_0x3109ea[_0x4581('0x1e')]+0x2:_0x515d6f+_0x205cd0+0x1;_0x3c071c[_0x4581('0x42')](_0x205cd0,0x0,{'type':_0x565d69[_0x4581('0x3')],'app':'GotoIfTime','appdata':_0x2f25f2['intervals'][_0x205cd0]+'?'+_0x565d69[_0x4581('0x5')]+',${EXTEN},'+_0x11c617+':'+_0x565d69[_0x4581('0x5')]+_0x4581('0x43')+_0x435200,'exten':_0x565d69[_0x4581('0x6')],'context':_0x565d69[_0x4581('0x5')],'priority':_0x515d6f+_0x205cd0,'VoiceExtensionId':_0x565d69['id']});}if(_0x2f25f2[_0x4581('0x3b')]==='outboundDial'){_0x2f25f2['appdata']=_0x141441(_0x565d69,_0x2f25f2[_0x4581('0x44')]);}if(_0x2f25f2['appType']===_0x4581('0x45')){_0x3c071c['push']({'type':_0x2f25f2['type'][_0x4581('0x3c')](),'app':'Set','appdata':_0x4581('0x46'),'context':_0x565d69[_0x4581('0x5')],'exten':_0x565d69['exten'],'priority':_0x2f25f2[_0x4581('0x2e')]['length']+_0x515d6f+_0x17f25a++,'VoiceExtensionId':_0x565d69['id']});}_0x2f25f2[_0x4581('0x47')]=_0x3c071c[_0x4581('0x1e')]?_[_0x4581('0x48')](_0x3c071c)[_0x4581('0x47')]+0x1:_0x515d6f;_0x343bfd=_[_0x4581('0x49')](_0x343bfd,_0x3c071c,[_0x2f25f2],_0x3109ea);_0x515d6f=_[_0x4581('0x48')](_0x343bfd)['priority']+0x1;}return _0x45c496(_0x343bfd);})['catch'](function(_0x50c74a){_0x60f31d(_0x50c74a);});});}return _0xa24c1f[_0x4581('0x4a')](_0x4581('0x4b'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1f0717){var _0xd3bd8f=this[_0x4581('0x4c')]({'plain':!![]});var _0x4191d1=_0xd3bd8f[_0x4581('0x3')]===_0x4581('0xe')?_0x5d1453(_0xd3bd8f):_0x52cea2(_0xd3bd8f);return _0x5ea1ad(_0xd3bd8f,_0x1f0717,_[_0x4581('0x48')](_0x4191d1)[_0x4581('0x47')]+0x1)[_0x4581('0x2d')](function(_0x5f1db8){var _0x56d256=_[_0x4581('0x49')](_0x4191d1,_0x5f1db8);_0x56d256['push']({'type':_0xd3bd8f[_0x4581('0x3')],'app':_0x4581('0x4d'),'exten':_0xd3bd8f[_0x4581('0x6')],'context':_0xd3bd8f['context'],'priority':_[_0x4581('0x48')](_0x56d256)['priority']+0x1,'VoiceExtensionId':_0xd3bd8f['id']});return _0x56d256;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 57e2b25..51db716 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 _0x8bc3=['redis','defaults','./voiceExtension.socket','register','request','then','debug','error','code','message','VoiceExtension,\x20%s,\x20%s','request\x20sent','result','catch','VoiceExtension','findAll','options','where','limit','include','map','model','attributes','info','GetVoiceExtension','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bc3,0x82));var _0x38bc=function(_0x27b08a,_0x5166cd){_0x27b08a=_0x27b08a-0x0;var _0x1af9b9=_0x8bc3[_0x27b08a];return _0x1af9b9;};'use strict';var _=require(_0x38bc('0x0'));var util=require('util');var moment=require(_0x38bc('0x1'));var BPromise=require('bluebird');var rs=require(_0x38bc('0x2'));var fs=require('fs');var Redis=require(_0x38bc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x38bc('0x4'));var logger=require(_0x38bc('0x5'))(_0x38bc('0x6'));var config=require(_0x38bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x38bc('0x8')][_0x38bc('0x9')]({'port':0x232a});config[_0x38bc('0xa')]=_[_0x38bc('0xb')](config[_0x38bc('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38bc('0xa')]));require(_0x38bc('0xc'))[_0x38bc('0xd')](socket);function respondWithRpcPromise(_0x35ca89,_0x4b592a,_0x31ae45){return new BPromise(function(_0x122a46,_0x877def){return client[_0x38bc('0xe')](_0x35ca89,_0x31ae45)[_0x38bc('0xf')](function(_0x52abe8){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x4b592a,'request\x20sent');logger[_0x38bc('0x10')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x4b592a,'request\x20sent',JSON['stringify'](_0x52abe8));if(_0x52abe8['error']){if(_0x52abe8[_0x38bc('0x11')][_0x38bc('0x12')]===0x1f4){logger[_0x38bc('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x4b592a,_0x52abe8[_0x38bc('0x11')][_0x38bc('0x13')]);return _0x877def(_0x52abe8[_0x38bc('0x11')][_0x38bc('0x13')]);}logger[_0x38bc('0x11')](_0x38bc('0x14'),_0x4b592a,_0x52abe8[_0x38bc('0x11')][_0x38bc('0x13')]);return _0x122a46(_0x52abe8['error'][_0x38bc('0x13')]);}else{logger['info'](_0x38bc('0x14'),_0x4b592a,_0x38bc('0x15'));_0x122a46(_0x52abe8[_0x38bc('0x16')][_0x38bc('0x13')]);}})[_0x38bc('0x17')](function(_0x405366){logger['error'](_0x38bc('0x14'),_0x4b592a,_0x405366);_0x877def(_0x405366);});});}exports['GetVoiceExtension']=function(_0x5608be){var _0x465d0a=this;return new Promise(function(_0x2c54ac,_0x325b14){return db[_0x38bc('0x18')][_0x38bc('0x19')]({'raw':_0x5608be[_0x38bc('0x1a')]?_0x5608be[_0x38bc('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5608be['options']?_0x5608be[_0x38bc('0x1a')][_0x38bc('0x1b')]||null:null,'attributes':_0x5608be['options']?_0x5608be[_0x38bc('0x1a')]['attributes']||null:null,'limit':_0x5608be[_0x38bc('0x1a')]?_0x5608be[_0x38bc('0x1a')][_0x38bc('0x1c')]||null:null,'include':_0x5608be['options']?_0x5608be[_0x38bc('0x1a')][_0x38bc('0x1d')]?_[_0x38bc('0x1e')](_0x5608be['options'][_0x38bc('0x1d')],function(_0x3daed5){return{'model':db[_0x3daed5[_0x38bc('0x1f')]],'as':_0x3daed5['as'],'attributes':_0x3daed5[_0x38bc('0x20')],'include':_0x3daed5['include']?_['map'](_0x3daed5[_0x38bc('0x1d')],function(_0x114cc8){return{'model':db[_0x114cc8[_0x38bc('0x1f')]],'as':_0x114cc8['as'],'attributes':_0x114cc8[_0x38bc('0x20')],'include':_0x114cc8['include']?_['map'](_0x114cc8['include'],function(_0x456a78){return{'model':db[_0x456a78[_0x38bc('0x1f')]],'as':_0x456a78['as'],'attributes':_0x456a78[_0x38bc('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33f6cf){logger[_0x38bc('0x21')]('GetVoiceExtension',_0x5608be);logger['debug'](_0x38bc('0x22'),_0x5608be,JSON['stringify'](_0x33f6cf));_0x2c54ac(_0x33f6cf);})['catch'](function(_0x3d224c){logger[_0x38bc('0x11')](_0x38bc('0x22'),_0x3d224c[_0x38bc('0x13')],_0x5608be);_0x325b14(_0x465d0a[_0x38bc('0x11')](0x1f4,_0x3d224c['message']));});});}; \ No newline at end of file +var _0xa899=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','VoiceExtension,\x20%s,\x20%s','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceExtension.socket','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa899,0x155));var _0x9a89=function(_0x20118a,_0x3dbdf3){_0x20118a=_0x20118a-0x0;var _0x538b5f=_0xa899[_0x20118a];return _0x538b5f;};'use strict';var _=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var moment=require(_0x9a89('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a89('0x3'));var fs=require('fs');var Redis=require(_0x9a89('0x4'));var db=require(_0x9a89('0x5'))['db'];var utils=require(_0x9a89('0x6'));var logger=require(_0x9a89('0x7'))(_0x9a89('0x8'));var config=require(_0x9a89('0x9'));var jayson=require(_0x9a89('0xa'));var client=jayson[_0x9a89('0xb')][_0x9a89('0xc')]({'port':0x232a});config[_0x9a89('0xd')]=_[_0x9a89('0xe')](config[_0x9a89('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a89('0xd')]));require(_0x9a89('0xf'))['register'](socket);function respondWithRpcPromise(_0xccf078,_0x4f487d,_0x111d99){return new BPromise(function(_0x2a9e30,_0x401680){return client[_0x9a89('0x10')](_0xccf078,_0x111d99)[_0x9a89('0x11')](function(_0xc61526){logger[_0x9a89('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x4f487d,'request\x20sent');logger[_0x9a89('0x13')](_0x9a89('0x14'),_0x4f487d,_0x9a89('0x15'),JSON['stringify'](_0xc61526));if(_0xc61526['error']){if(_0xc61526['error'][_0x9a89('0x16')]===0x1f4){logger[_0x9a89('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x4f487d,_0xc61526[_0x9a89('0x17')][_0x9a89('0x18')]);return _0x401680(_0xc61526[_0x9a89('0x17')][_0x9a89('0x18')]);}logger['error'](_0x9a89('0x19'),_0x4f487d,_0xc61526[_0x9a89('0x17')]['message']);return _0x2a9e30(_0xc61526['error'][_0x9a89('0x18')]);}else{logger['info'](_0x9a89('0x19'),_0x4f487d,_0x9a89('0x15'));_0x2a9e30(_0xc61526['result'][_0x9a89('0x18')]);}})['catch'](function(_0x2d648f){logger[_0x9a89('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x4f487d,_0x2d648f);_0x401680(_0x2d648f);});});}exports[_0x9a89('0x1a')]=function(_0x3759cb){var _0xf60649=this;return new Promise(function(_0x1619e0,_0x66f8c7){return db[_0x9a89('0x1b')][_0x9a89('0x1c')]({'raw':_0x3759cb[_0x9a89('0x1d')]?_0x3759cb['options']['raw']===undefined?!![]:![]:!![],'where':_0x3759cb[_0x9a89('0x1d')]?_0x3759cb[_0x9a89('0x1d')][_0x9a89('0x1e')]||null:null,'attributes':_0x3759cb[_0x9a89('0x1d')]?_0x3759cb[_0x9a89('0x1d')][_0x9a89('0x1f')]||null:null,'limit':_0x3759cb['options']?_0x3759cb['options'][_0x9a89('0x20')]||null:null,'include':_0x3759cb['options']?_0x3759cb[_0x9a89('0x1d')][_0x9a89('0x21')]?_[_0x9a89('0x22')](_0x3759cb[_0x9a89('0x1d')][_0x9a89('0x21')],function(_0x35032a){return{'model':db[_0x35032a[_0x9a89('0x23')]],'as':_0x35032a['as'],'attributes':_0x35032a['attributes'],'include':_0x35032a[_0x9a89('0x21')]?_['map'](_0x35032a[_0x9a89('0x21')],function(_0x5a888b){return{'model':db[_0x5a888b['model']],'as':_0x5a888b['as'],'attributes':_0x5a888b[_0x9a89('0x1f')],'include':_0x5a888b[_0x9a89('0x21')]?_['map'](_0x5a888b[_0x9a89('0x21')],function(_0x5abe70){return{'model':db[_0x5abe70[_0x9a89('0x23')]],'as':_0x5abe70['as'],'attributes':_0x5abe70[_0x9a89('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9a89('0x11')](function(_0x2d019e){logger[_0x9a89('0x12')](_0x9a89('0x1a'),_0x3759cb);logger[_0x9a89('0x13')]('GetVoiceExtension',_0x3759cb,JSON['stringify'](_0x2d019e));_0x1619e0(_0x2d019e);})['catch'](function(_0x44e2fd){logger['error'](_0x9a89('0x1a'),_0x44e2fd[_0x9a89('0x18')],_0x3759cb);_0x66f8c7(_0xf60649[_0x9a89('0x17')](0x1f4,_0x44e2fd['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1a580a0..745f28b 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 _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x18dfbe,_0x1d52c2){var _0x4c2a54=function(_0x3430d5){while(--_0x3430d5){_0x18dfbe['push'](_0x18dfbe['shift']());}};_0x4c2a54(++_0x1d52c2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x53074e,_0x393624){var _0xfe69e8=function(_0x4a8abe){while(--_0x4a8abe){_0x53074e['push'](_0x53074e['shift']());}};_0xfe69e8(++_0x393624);}(_0x7a54,0x106));var _0x47a5=function(_0x4a7319,_0x9e8d7a){_0x4a7319=_0x4a7319-0x0;var _0x5c3a16=_0x7a54[_0x4a7319];return _0x5c3a16;};'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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 952616f..245cf10 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 _0x2a07=['getMessages','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x2a07,0x74));var _0x72a0=function(_0x288371,_0x35f999){_0x288371=_0x288371-0x0;var _0x5a1ad1=_0x2a07[_0x288371];return _0x5a1ad1;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['post']('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x11')]);router['put'](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x12')]);router[_0x72a0('0x13')](_0x72a0('0xd'),auth['isAuthenticated'](),controller[_0x72a0('0x14')]);module[_0x72a0('0x15')]=router; \ No newline at end of file +var _0xcaf2=['create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','post'];(function(_0x58d3b0,_0x51935e){var _0x17b2c1=function(_0x11156c){while(--_0x11156c){_0x58d3b0['push'](_0x58d3b0['shift']());}};_0x17b2c1(++_0x51935e);}(_0xcaf2,0x8a));var _0x2caf=function(_0x3c1309,_0x66e161){_0x3c1309=_0x3c1309-0x0;var _0x4b71bf=_0xcaf2[_0x3c1309];return _0x4b71bf;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var fs_extra=require(_0x2caf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2caf('0x5'));var config=require('../../config/environment');var controller=require(_0x2caf('0x6'));router[_0x2caf('0x7')]('/',auth[_0x2caf('0x8')](),controller['index']);router[_0x2caf('0x7')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xa')]);router['get'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xc')]);router[_0x2caf('0xd')]('/',auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0xf')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller['update']);router[_0x2caf('0x10')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0x11')]);module[_0x2caf('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 751626b..7d440a0 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 _0xd911=['INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x1dad0e,_0x3f68c7){var _0x3b8633=function(_0x1ad5d6){while(--_0x1ad5d6){_0x1dad0e['push'](_0x1dad0e['shift']());}};_0x3b8633(++_0x3f68c7);}(_0xd911,0x124));var _0x1d91=function(_0x46b392,_0x59e8bd){_0x46b392=_0x46b392-0x0;var _0x30963a=_0xd911[_0x46b392];return _0x30963a;};'use strict';var Sequelize=require(_0x1d91('0x0'));module[_0x1d91('0x1')]={'customer_id':{'type':Sequelize[_0x1d91('0x2')]},'context':{'type':Sequelize[_0x1d91('0x2')],'defaultValue':_0x1d91('0x3'),'unique':_0x1d91('0x4')},'mailbox':{'type':Sequelize[_0x1d91('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x1d91('0x2')]},'fullname':{'type':Sequelize[_0x1d91('0x2')]},'email':{'type':Sequelize[_0x1d91('0x2')],'validate':{'isEmail':!![]},'set':function(_0x17023d){this[_0x1d91('0x5')](_0x1d91('0x6'),typeof _0x17023d===_0x1d91('0x7')&&_0x17023d[_0x1d91('0x8')]()?_0x17023d['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x1d91('0x2')],'defaultValue':_0x1d91('0x9')},'attach':{'type':Sequelize[_0x1d91('0xa')](_0x1d91('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x1d91('0xa')](_0x1d91('0xb'),'no'),'defaultValue':_0x1d91('0xb'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x1d91('0x2')]},'review':{'type':Sequelize[_0x1d91('0xa')](_0x1d91('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1d91('0xa')](_0x1d91('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1d91('0xa')](_0x1d91('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x1d91('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1d91('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1d91('0xa')](_0x1d91('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x1d91('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x1d91('0xa')](_0x1d91('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1d91('0xa')](_0x1d91('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1d91('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x1d91('0xd')},'emailsubject':{'type':Sequelize[_0x1d91('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x1d91('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1d91('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1d91('0xf')],'get':function(){return this[_0x1d91('0x10')]('fullname')+'\x20-\x20'+this['getDataValue'](_0x1d91('0x11'));}}}; \ No newline at end of file +var _0x72c2=['contest_mailbox','setDataValue','email','string','trim','ENUM','yes','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail'];(function(_0x368c96,_0x20f1ab){var _0x4fff4b=function(_0x5e15cf){while(--_0x5e15cf){_0x368c96['push'](_0x368c96['shift']());}};_0x4fff4b(++_0x20f1ab);}(_0x72c2,0xbd));var _0x272c=function(_0x4383eb,_0x4aad25){_0x4383eb=_0x4383eb-0x0;var _0x164d77=_0x72c2[_0x4383eb];return _0x164d77;};'use strict';var Sequelize=require('sequelize');module[_0x272c('0x0')]={'customer_id':{'type':Sequelize[_0x272c('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x272c('0x2'),'unique':_0x272c('0x3')},'mailbox':{'type':Sequelize[_0x272c('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x272c('0x1')]},'fullname':{'type':Sequelize[_0x272c('0x1')]},'email':{'type':Sequelize[_0x272c('0x1')],'validate':{'isEmail':!![]},'set':function(_0x2ebc5c){this[_0x272c('0x4')](_0x272c('0x5'),typeof _0x2ebc5c===_0x272c('0x6')&&_0x2ebc5c[_0x272c('0x7')]()?_0x2ebc5c['trim']():null);}},'pager':{'type':Sequelize[_0x272c('0x1')]},'tz':{'type':Sequelize[_0x272c('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x272c('0x8')]('yes','no'),'defaultValue':_0x272c('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x272c('0x8')](_0x272c('0x9'),'no'),'defaultValue':_0x272c('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x272c('0x1')]},'callback':{'type':Sequelize[_0x272c('0x1')]},'review':{'type':Sequelize[_0x272c('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x272c('0x8')](_0x272c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x272c('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x272c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x272c('0x8')](_0x272c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x272c('0x8')](_0x272c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x272c('0x8')](_0x272c('0x9'),'no'),'defaultValue':_0x272c('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x272c('0x8')](_0x272c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x272c('0x8')](_0x272c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x272c('0x8')](_0x272c('0x9'),'no'),'defaultValue':_0x272c('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x272c('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x272c('0xb')],'get':function(){return this[_0x272c('0xc')](_0x272c('0xd'))+_0x272c('0xe')+this[_0x272c('0xc')](_0x272c('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 76604fd..eda592f 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 _0x750a=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','json','destroy','then','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMail','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','getMessages','findOne','VoiceMailMessage','length','findAndCountAll','rimraf','request-promise','moment','bluebird'];(function(_0x189a72,_0x4ac342){var _0x2b457a=function(_0x151b57){while(--_0x151b57){_0x189a72['push'](_0x189a72['shift']());}};_0x2b457a(++_0x4ac342);}(_0x750a,0x140));var _0xa750=function(_0x5243f0,_0x2c767d){_0x5243f0=_0x5243f0-0x0;var _0x39bbff=_0x750a[_0x5243f0];return _0x39bbff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ec62,_0x1c5657){_0x1c5657=_0x1c5657||0xcc;return function(_0x344c67){if(_0x344c67){return _0x24ec62['sendStatus'](_0x1c5657);}return _0x24ec62[_0xa750('0x15')](_0x1c5657)[_0xa750('0x16')]();};}function respondWithResult(_0x2d3421,_0x24e48a){_0x24e48a=_0x24e48a||0xc8;return function(_0xa66181){if(_0xa66181){return _0x2d3421[_0xa750('0x15')](_0x24e48a)['json'](_0xa66181);}};}function respondWithFilteredResult(_0x3ae2a1,_0x8488ea){return function(_0x290d46){if(_0x290d46){var _0x49fe3b=typeof _0x8488ea[_0xa750('0x17')]===_0xa750('0x18')&&typeof _0x8488ea['limit']==='undefined';var _0x321eb2=_0x290d46['count'];var _0x433dbd=_0x49fe3b?0x0:_0x8488ea[_0xa750('0x17')];var _0x4f1faa=_0x49fe3b?_0x290d46[_0xa750('0x19')]:_0x8488ea['offset']+_0x8488ea['limit'];var _0x25e335;if(_0x4f1faa>=_0x321eb2){_0x4f1faa=_0x321eb2;_0x25e335=0xc8;}else{_0x25e335=0xce;}_0x3ae2a1['status'](_0x25e335);return _0x3ae2a1[_0xa750('0x1a')]('Content-Range',_0x433dbd+'-'+_0x4f1faa+'/'+_0x321eb2)[_0xa750('0x1b')](_0x290d46);}return null;};}function patchUpdates(_0x4a007d){return function(_0x3dc7f1){try{jsonpatch['apply'](_0x3dc7f1,_0x4a007d,!![]);}catch(_0x1efb68){return BPromise['reject'](_0x1efb68);}return _0x3dc7f1['save']();};}function saveUpdates(_0xaa9d3e,_0x52da84){return function(_0x216fbf){if(_0x216fbf){return _0x216fbf['update'](_0xaa9d3e)['then'](function(_0x5b433d){return _0x5b433d;});}return null;};}function removeEntity(_0x5d758e,_0x15d72f){return function(_0x2ec6c4){if(_0x2ec6c4){return _0x2ec6c4[_0xa750('0x1c')]()[_0xa750('0x1d')](function(){var _0x1b80a5=_0x2ec6c4[_0xa750('0x1e')]({'plain':!![]});var _0x3001bc=_0xa750('0x1f');return db[_0xa750('0x20')][_0xa750('0x1c')]({'where':{'type':_0x3001bc,'resourceId':_0x1b80a5['id']}})[_0xa750('0x1d')](function(){return _0x2ec6c4;});})[_0xa750('0x1d')](function(){_0x5d758e[_0xa750('0x15')](0xcc)[_0xa750('0x16')]();});}};}function handleEntityNotFound(_0x310e2d,_0x4ffff4){return function(_0x3d3923){if(!_0x3d3923){_0x310e2d[_0xa750('0x21')](0x194);}return _0x3d3923;};}function handleError(_0x21cd2c,_0x4cceee){_0x4cceee=_0x4cceee||0x1f4;return function(_0x35ab53){logger[_0xa750('0x22')](_0x35ab53[_0xa750('0x23')]);if(_0x35ab53[_0xa750('0x24')]){delete _0x35ab53['name'];}_0x21cd2c[_0xa750('0x15')](_0x4cceee)[_0xa750('0x25')](_0x35ab53);};}exports[_0xa750('0x26')]=function(_0x2aef3a,_0x2c5253){var _0x59ab33={},_0x46cc11={},_0x4c2c9e={'count':0x0,'rows':[]};var _0x2d0e93=_[_0xa750('0x27')](db['VoiceMail'][_0xa750('0x28')],function(_0x6bc25d){return{'name':_0x6bc25d[_0xa750('0x29')],'type':_0x6bc25d[_0xa750('0x2a')][_0xa750('0x2b')]};});_0x46cc11[_0xa750('0x2c')]=_[_0xa750('0x27')](_0x2d0e93,_0xa750('0x24'));_0x46cc11['query']=_[_0xa750('0x2d')](_0x2aef3a['query']);_0x46cc11[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],_0x46cc11[_0xa750('0x30')]);_0x59ab33['attributes']=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],qs['fields'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x31')]));_0x59ab33[_0xa750('0x32')]=_0x59ab33[_0xa750('0x32')]['length']?_0x59ab33[_0xa750('0x32')]:_0x46cc11['model'];if(!_0x2aef3a['query'][_0xa750('0x33')](_0xa750('0x34'))){_0x59ab33[_0xa750('0x35')]=qs['limit'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x35')]);_0x59ab33[_0xa750('0x17')]=qs['offset'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x17')]);}_0x59ab33[_0xa750('0x36')]=qs['sort'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x37')]);_0x59ab33[_0xa750('0x38')]=qs['filters'](_[_0xa750('0x39')](_0x2aef3a[_0xa750('0x30')],_0x46cc11[_0xa750('0x2e')]),_0x2d0e93);if(_0x2aef3a[_0xa750('0x30')]['filter']){_0x59ab33['where']=_[_0xa750('0x3a')](_0x59ab33[_0xa750('0x38')],{'$or':_['map'](_0x2d0e93,function(_0x43dc3a){if(_0x43dc3a[_0xa750('0x2a')]!==_0xa750('0x3b')){var _0x1166ff={};_0x1166ff[_0x43dc3a[_0xa750('0x24')]]={'$like':'%'+_0x2aef3a['query'][_0xa750('0x3c')]+'%'};return _0x1166ff;}})});}_0x59ab33=_[_0xa750('0x3a')]({},_0x59ab33,_0x2aef3a[_0xa750('0x3d')]);var _0x134874={'where':_0x59ab33[_0xa750('0x38')]};return db[_0xa750('0x3e')][_0xa750('0x19')](_0x134874)['then'](function(_0x3daa38){_0x4c2c9e['count']=_0x3daa38;if(_0x2aef3a[_0xa750('0x30')]['includeAll']){_0x59ab33[_0xa750('0x3f')]=[{'all':!![]}];}return db[_0xa750('0x3e')][_0xa750('0x40')](_0x59ab33);})[_0xa750('0x1d')](function(_0x430d60){_0x4c2c9e[_0xa750('0x41')]=_0x430d60;return _0x4c2c9e;})[_0xa750('0x1d')](respondWithFilteredResult(_0x2c5253,_0x59ab33))[_0xa750('0x42')](handleError(_0x2c5253,null));};exports[_0xa750('0x43')]=function(_0x108a1a,_0x36a8d6){var _0x1458f1={'raw':!![],'where':{'id':_0x108a1a[_0xa750('0x44')]['id']}},_0x3ec860={};_0x3ec860[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x3e')][_0xa750('0x28')]);_0x3ec860[_0xa750('0x30')]=_[_0xa750('0x2d')](_0x108a1a['query']);_0x3ec860[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],_0x3ec860[_0xa750('0x30')]);_0x1458f1[_0xa750('0x32')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x108a1a[_0xa750('0x30')]['fields']));_0x1458f1[_0xa750('0x32')]=_0x1458f1[_0xa750('0x32')]['length']?_0x1458f1[_0xa750('0x32')]:_0x3ec860[_0xa750('0x2c')];if(_0x108a1a[_0xa750('0x30')][_0xa750('0x45')]){_0x1458f1[_0xa750('0x3f')]=[{'all':!![]}];}_0x1458f1=_[_0xa750('0x3a')]({},_0x1458f1,_0x108a1a[_0xa750('0x3d')]);return db[_0xa750('0x3e')][_0xa750('0x46')](_0x1458f1)[_0xa750('0x1d')](handleEntityNotFound(_0x36a8d6,null))['then'](respondWithResult(_0x36a8d6,null))[_0xa750('0x42')](handleError(_0x36a8d6,null));};exports[_0xa750('0x47')]=function(_0x58afd2,_0x93e49f){return db[_0xa750('0x3e')][_0xa750('0x47')](_0x58afd2['body'],{})[_0xa750('0x1d')](function(_0x3fc623){var _0x1e5a9a=_0x58afd2[_0xa750('0x48')]['get']({'plain':!![]});if(!_0x1e5a9a)throw new Error(_0xa750('0x49'));if(_0x1e5a9a[_0xa750('0x4a')]===_0xa750('0x48')){var _0xed4f88=_0x3fc623['get']({'plain':!![]});var _0x203f2a=_0xa750('0x1f');return db['UserProfileSection'][_0xa750('0x46')]({'where':{'name':_0x203f2a,'userProfileId':_0x1e5a9a['userProfileId']},'raw':!![]})[_0xa750('0x1d')](function(_0x69995b){if(_0x69995b&&_0x69995b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xed4f88[_0xa750('0x24')],'resourceId':_0xed4f88['id'],'type':_0x69995b[_0xa750('0x24')],'sectionId':_0x69995b['id']},{})['then'](function(){return _0x3fc623;});}else{return _0x3fc623;}})[_0xa750('0x42')](function(_0x1a79a9){logger[_0xa750('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a79a9);throw _0x1a79a9;});}return _0x3fc623;})['then'](respondWithResult(_0x93e49f,0xc9))['catch'](handleError(_0x93e49f,null));};exports['update']=function(_0x3c34d4,_0x4a1b5d){if(_0x3c34d4[_0xa750('0x4b')]['id']){delete _0x3c34d4[_0xa750('0x4b')]['id'];}return db['VoiceMail'][_0xa750('0x46')]({'where':{'id':_0x3c34d4['params']['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x4a1b5d,null))['then'](saveUpdates(_0x3c34d4['body'],null))['then'](respondWithResult(_0x4a1b5d,null))['catch'](handleError(_0x4a1b5d,null));};exports[_0xa750('0x1c')]=function(_0x40dac2,_0x5f1313){return db['VoiceMail']['find']({'where':{'id':_0x40dac2[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x5f1313,null))[_0xa750('0x1d')](removeEntity(_0x5f1313,null))[_0xa750('0x42')](handleError(_0x5f1313,null));};exports[_0xa750('0x4c')]=function(_0x13528a,_0x599e7e,_0x590b1c){return db[_0xa750('0x3e')][_0xa750('0x4d')]({'where':{'id':_0x13528a[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x599e7e,null))[_0xa750('0x1d')](function(_0x5a3cd5){var _0x4030b3;var _0xaa63be={},_0x2c7dd0={};_0x2c7dd0[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x4e')][_0xa750('0x28')]);_0x2c7dd0[_0xa750('0x30')]=_['keys'](_0x13528a[_0xa750('0x30')]);_0x2c7dd0[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x2c7dd0[_0xa750('0x2c')],_0x2c7dd0[_0xa750('0x30')]);_0xaa63be['attributes']=_[_0xa750('0x2f')](_0x2c7dd0[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x13528a[_0xa750('0x30')][_0xa750('0x31')]));_0xaa63be[_0xa750('0x32')]=_0xaa63be[_0xa750('0x32')][_0xa750('0x4f')]?_0xaa63be[_0xa750('0x32')]:_0x2c7dd0[_0xa750('0x2c')];if(!_0x13528a[_0xa750('0x30')][_0xa750('0x33')](_0xa750('0x34'))){_0xaa63be[_0xa750('0x35')]=qs[_0xa750('0x35')](_0x13528a[_0xa750('0x30')]['limit']);_0xaa63be[_0xa750('0x17')]=qs['offset'](_0x13528a[_0xa750('0x30')][_0xa750('0x17')]);}_0xaa63be[_0xa750('0x36')]=qs['sort'](_0x13528a[_0xa750('0x30')][_0xa750('0x37')]);_0xaa63be[_0xa750('0x38')]=qs[_0xa750('0x2e')](_[_0xa750('0x39')](_0x13528a[_0xa750('0x30')],_0x2c7dd0['filters']));if(_0x13528a[_0xa750('0x30')][_0xa750('0x3c')]){_0xaa63be['where']=_[_0xa750('0x3a')](_0xaa63be[_0xa750('0x38')],{'$or':_[_0xa750('0x27')](_0xaa63be[_0xa750('0x32')],function(_0x3255c7){var _0x1b7597={};_0x1b7597[_0x3255c7]={'$like':'%'+_0x13528a[_0xa750('0x30')][_0xa750('0x3c')]+'%'};return _0x1b7597;})});}_0xaa63be[_0xa750('0x38')]=_[_0xa750('0x3a')](_0xaa63be[_0xa750('0x38')],{'mailboxuser':_0x5a3cd5['mailbox']});_0xaa63be=_['merge']({},_0xaa63be,_0x13528a[_0xa750('0x3d')]);return db[_0xa750('0x4e')][_0xa750('0x50')](_0xaa63be)[_0xa750('0x1d')](respondWithFilteredResult(_0x599e7e,_0xaa63be));})['catch'](handleError(_0x599e7e,null));}; \ No newline at end of file +var _0xae60=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','order','pick','mailbox','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x133078,_0x337ba5){var _0x3aafd1=function(_0x320aa4){while(--_0x320aa4){_0x133078['push'](_0x133078['shift']());}};_0x3aafd1(++_0x337ba5);}(_0xae60,0x1c7));var _0x0ae6=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xae60[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];function respondWithStatusCode(_0x3b05a4,_0x30f8f9){_0x30f8f9=_0x30f8f9||0xcc;return function(_0x1aefd5){if(_0x1aefd5){return _0x3b05a4[_0x0ae6('0x1c')](_0x30f8f9);}return _0x3b05a4[_0x0ae6('0x1d')](_0x30f8f9)[_0x0ae6('0x1e')]();};}function respondWithResult(_0x4d2da8,_0x3809c6){_0x3809c6=_0x3809c6||0xc8;return function(_0x10c3bc){if(_0x10c3bc){return _0x4d2da8[_0x0ae6('0x1d')](_0x3809c6)[_0x0ae6('0x1f')](_0x10c3bc);}};}function respondWithFilteredResult(_0xce3e23,_0x3a1e26){return function(_0x151144){if(_0x151144){var _0x3b64ac=typeof _0x3a1e26[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x3a1e26[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xa97151=_0x151144[_0x0ae6('0x23')];var _0xda4f01=_0x3b64ac?0x0:_0x3a1e26[_0x0ae6('0x20')];var _0x2fdf25=_0x3b64ac?_0x151144[_0x0ae6('0x23')]:_0x3a1e26[_0x0ae6('0x20')]+_0x3a1e26[_0x0ae6('0x22')];var _0x26b369;if(_0x2fdf25>=_0xa97151){_0x2fdf25=_0xa97151;_0x26b369=0xc8;}else{_0x26b369=0xce;}_0xce3e23[_0x0ae6('0x1d')](_0x26b369);return _0xce3e23['set'](_0x0ae6('0x24'),_0xda4f01+'-'+_0x2fdf25+'/'+_0xa97151)[_0x0ae6('0x1f')](_0x151144);}return null;};}function patchUpdates(_0x140a3b){return function(_0x1027c2){try{jsonpatch[_0x0ae6('0x25')](_0x1027c2,_0x140a3b,!![]);}catch(_0xb4e6af){return BPromise[_0x0ae6('0x26')](_0xb4e6af);}return _0x1027c2[_0x0ae6('0x27')]();};}function saveUpdates(_0x515f3d,_0x39b22e){return function(_0x2a6484){if(_0x2a6484){return _0x2a6484[_0x0ae6('0x28')](_0x515f3d)[_0x0ae6('0x29')](function(_0x31ad85){return _0x31ad85;});}return null;};}function removeEntity(_0x4eba72,_0x296a9d){return function(_0x4e1242){if(_0x4e1242){return _0x4e1242[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){var _0x3c43d8=_0x4e1242[_0x0ae6('0x2b')]({'plain':!![]});var _0x5b86fe=_0x0ae6('0x2c');return db[_0x0ae6('0x2d')]['destroy']({'where':{'type':_0x5b86fe,'resourceId':_0x3c43d8['id']}})['then'](function(){return _0x4e1242;});})[_0x0ae6('0x29')](function(){_0x4eba72[_0x0ae6('0x1d')](0xcc)[_0x0ae6('0x1e')]();});}};}function handleEntityNotFound(_0x4fe77b,_0x3b5f8f){return function(_0xb68cbe){if(!_0xb68cbe){_0x4fe77b[_0x0ae6('0x1c')](0x194);}return _0xb68cbe;};}function handleError(_0x4df796,_0x2428b2){_0x2428b2=_0x2428b2||0x1f4;return function(_0x29fef3){logger[_0x0ae6('0x2e')](_0x29fef3[_0x0ae6('0x2f')]);if(_0x29fef3[_0x0ae6('0x30')]){delete _0x29fef3[_0x0ae6('0x30')];}_0x4df796['status'](_0x2428b2)['send'](_0x29fef3);};}exports[_0x0ae6('0x31')]=function(_0x419384,_0x4e6df8){var _0x4a06f1={},_0x1ca059={},_0x278577={'count':0x0,'rows':[]};var _0x714c6d=_[_0x0ae6('0x32')](db['VoiceMail'][_0x0ae6('0x33')],function(_0x429f06){return{'name':_0x429f06[_0x0ae6('0x34')],'type':_0x429f06['type'][_0x0ae6('0x35')]};});_0x1ca059[_0x0ae6('0x36')]=_[_0x0ae6('0x32')](_0x714c6d,_0x0ae6('0x30'));_0x1ca059[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x419384[_0x0ae6('0x37')]);_0x1ca059[_0x0ae6('0x39')]=_[_0x0ae6('0x3a')](_0x1ca059[_0x0ae6('0x36')],_0x1ca059['query']);_0x4a06f1[_0x0ae6('0x3b')]=_[_0x0ae6('0x3a')](_0x1ca059['model'],qs[_0x0ae6('0x3c')](_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x4a06f1['attributes']=_0x4a06f1[_0x0ae6('0x3b')]['length']?_0x4a06f1['attributes']:_0x1ca059[_0x0ae6('0x36')];if(!_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3d')](_0x0ae6('0x3e'))){_0x4a06f1[_0x0ae6('0x22')]=qs['limit'](_0x419384['query'][_0x0ae6('0x22')]);_0x4a06f1['offset']=qs[_0x0ae6('0x20')](_0x419384['query'][_0x0ae6('0x20')]);}_0x4a06f1['order']=qs[_0x0ae6('0x3f')](_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3f')]);_0x4a06f1[_0x0ae6('0x40')]=qs['filters'](_['pick'](_0x419384[_0x0ae6('0x37')],_0x1ca059[_0x0ae6('0x39')]),_0x714c6d);if(_0x419384[_0x0ae6('0x37')]['filter']){_0x4a06f1[_0x0ae6('0x40')]=_['merge'](_0x4a06f1[_0x0ae6('0x40')],{'$or':_[_0x0ae6('0x32')](_0x714c6d,function(_0x460e3f){if(_0x460e3f[_0x0ae6('0x41')]!==_0x0ae6('0x42')){var _0x1f8258={};_0x1f8258[_0x460e3f['name']]={'$like':'%'+_0x419384[_0x0ae6('0x37')][_0x0ae6('0x43')]+'%'};return _0x1f8258;}})});}_0x4a06f1=_[_0x0ae6('0x44')]({},_0x4a06f1,_0x419384[_0x0ae6('0x45')]);var _0x1ad562={'where':_0x4a06f1[_0x0ae6('0x40')]};return db[_0x0ae6('0x46')][_0x0ae6('0x23')](_0x1ad562)['then'](function(_0x38faeb){_0x278577[_0x0ae6('0x23')]=_0x38faeb;if(_0x419384[_0x0ae6('0x37')][_0x0ae6('0x47')]){_0x4a06f1[_0x0ae6('0x48')]=[{'all':!![]}];}return db[_0x0ae6('0x46')][_0x0ae6('0x49')](_0x4a06f1);})[_0x0ae6('0x29')](function(_0xb38cbb){_0x278577[_0x0ae6('0x4a')]=_0xb38cbb;return _0x278577;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x4e6df8,_0x4a06f1))[_0x0ae6('0x4b')](handleError(_0x4e6df8,null));};exports[_0x0ae6('0x4c')]=function(_0x85d9ce,_0x201e95){var _0x16d225={'raw':!![],'where':{'id':_0x85d9ce[_0x0ae6('0x4d')]['id']}},_0x4235de={};_0x4235de['model']=_[_0x0ae6('0x38')](db[_0x0ae6('0x46')][_0x0ae6('0x33')]);_0x4235de[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x85d9ce[_0x0ae6('0x37')]);_0x4235de['filters']=_[_0x0ae6('0x3a')](_0x4235de[_0x0ae6('0x36')],_0x4235de[_0x0ae6('0x37')]);_0x16d225[_0x0ae6('0x3b')]=_['intersection'](_0x4235de['model'],qs['fields'](_0x85d9ce[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x16d225[_0x0ae6('0x3b')]=_0x16d225['attributes'][_0x0ae6('0x4e')]?_0x16d225[_0x0ae6('0x3b')]:_0x4235de['model'];if(_0x85d9ce[_0x0ae6('0x37')][_0x0ae6('0x47')]){_0x16d225['include']=[{'all':!![]}];}_0x16d225=_[_0x0ae6('0x44')]({},_0x16d225,_0x85d9ce[_0x0ae6('0x45')]);return db['VoiceMail'][_0x0ae6('0x4f')](_0x16d225)[_0x0ae6('0x29')](handleEntityNotFound(_0x201e95,null))[_0x0ae6('0x29')](respondWithResult(_0x201e95,null))['catch'](handleError(_0x201e95,null));};exports[_0x0ae6('0x50')]=function(_0x21de54,_0x46075a){return db[_0x0ae6('0x46')][_0x0ae6('0x50')](_0x21de54[_0x0ae6('0x51')],{})[_0x0ae6('0x29')](function(_0x5ababa){var _0x5afd3b=_0x21de54[_0x0ae6('0x52')][_0x0ae6('0x2b')]({'plain':!![]});if(!_0x5afd3b)throw new Error(_0x0ae6('0x53'));if(_0x5afd3b['role']===_0x0ae6('0x52')){var _0x51df5c=_0x5ababa['get']({'plain':!![]});var _0x23454a=_0x0ae6('0x2c');return db[_0x0ae6('0x54')]['find']({'where':{'name':_0x23454a,'userProfileId':_0x5afd3b[_0x0ae6('0x55')]},'raw':!![]})[_0x0ae6('0x29')](function(_0x31a4db){if(_0x31a4db&&_0x31a4db[_0x0ae6('0x56')]===0x0){return db[_0x0ae6('0x2d')][_0x0ae6('0x50')]({'name':_0x51df5c[_0x0ae6('0x30')],'resourceId':_0x51df5c['id'],'type':_0x31a4db[_0x0ae6('0x30')],'sectionId':_0x31a4db['id']},{})[_0x0ae6('0x29')](function(){return _0x5ababa;});}else{return _0x5ababa;}})[_0x0ae6('0x4b')](function(_0x1cc515){logger[_0x0ae6('0x2e')](_0x0ae6('0x57'),_0x1cc515);throw _0x1cc515;});}return _0x5ababa;})[_0x0ae6('0x29')](respondWithResult(_0x46075a,0xc9))[_0x0ae6('0x4b')](handleError(_0x46075a,null));};exports['update']=function(_0x4cbe19,_0x30a9f1){if(_0x4cbe19[_0x0ae6('0x51')]['id']){delete _0x4cbe19[_0x0ae6('0x51')]['id'];}return db[_0x0ae6('0x46')][_0x0ae6('0x4f')]({'where':{'id':_0x4cbe19[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x30a9f1,null))[_0x0ae6('0x29')](saveUpdates(_0x4cbe19[_0x0ae6('0x51')],null))[_0x0ae6('0x29')](respondWithResult(_0x30a9f1,null))[_0x0ae6('0x4b')](handleError(_0x30a9f1,null));};exports[_0x0ae6('0x2a')]=function(_0x16a311,_0x2babcc){return db[_0x0ae6('0x46')][_0x0ae6('0x4f')]({'where':{'id':_0x16a311[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x2babcc,null))['then'](removeEntity(_0x2babcc,null))[_0x0ae6('0x4b')](handleError(_0x2babcc,null));};exports[_0x0ae6('0x58')]=function(_0x15191e,_0x578125,_0x2648de){return db[_0x0ae6('0x46')][_0x0ae6('0x59')]({'where':{'id':_0x15191e[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x578125,null))[_0x0ae6('0x29')](function(_0x5ec716){var _0x456d2a;var _0x2132d6={},_0x1c53bf={};_0x1c53bf[_0x0ae6('0x36')]=_[_0x0ae6('0x38')](db[_0x0ae6('0x5a')][_0x0ae6('0x33')]);_0x1c53bf[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x15191e['query']);_0x1c53bf['filters']=_[_0x0ae6('0x3a')](_0x1c53bf[_0x0ae6('0x36')],_0x1c53bf['query']);_0x2132d6['attributes']=_[_0x0ae6('0x3a')](_0x1c53bf[_0x0ae6('0x36')],qs[_0x0ae6('0x3c')](_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x2132d6[_0x0ae6('0x3b')]=_0x2132d6[_0x0ae6('0x3b')]['length']?_0x2132d6[_0x0ae6('0x3b')]:_0x1c53bf['model'];if(!_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x3d')]('nolimit')){_0x2132d6[_0x0ae6('0x22')]=qs[_0x0ae6('0x22')](_0x15191e[_0x0ae6('0x37')]['limit']);_0x2132d6[_0x0ae6('0x20')]=qs['offset'](_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x20')]);}_0x2132d6[_0x0ae6('0x5b')]=qs[_0x0ae6('0x3f')](_0x15191e['query']['sort']);_0x2132d6[_0x0ae6('0x40')]=qs[_0x0ae6('0x39')](_[_0x0ae6('0x5c')](_0x15191e[_0x0ae6('0x37')],_0x1c53bf[_0x0ae6('0x39')]));if(_0x15191e[_0x0ae6('0x37')]['filter']){_0x2132d6['where']=_[_0x0ae6('0x44')](_0x2132d6[_0x0ae6('0x40')],{'$or':_[_0x0ae6('0x32')](_0x2132d6[_0x0ae6('0x3b')],function(_0x2bafcc){var _0x15f38f={};_0x15f38f[_0x2bafcc]={'$like':'%'+_0x15191e[_0x0ae6('0x37')][_0x0ae6('0x43')]+'%'};return _0x15f38f;})});}_0x2132d6['where']=_[_0x0ae6('0x44')](_0x2132d6[_0x0ae6('0x40')],{'mailboxuser':_0x5ec716[_0x0ae6('0x5d')]});_0x2132d6=_[_0x0ae6('0x44')]({},_0x2132d6,_0x15191e[_0x0ae6('0x45')]);return db[_0x0ae6('0x5a')]['findAndCountAll'](_0x2132d6)['then'](respondWithFilteredResult(_0x578125,_0x2132d6));})[_0x0ae6('0x4b')](handleError(_0x578125,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0d5caa8..3f7f697 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 _0x7299=['mailbox','context','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','voice_voicemail','mailbox_context'];(function(_0x5a8c51,_0x4637ba){var _0xd398a6=function(_0x2d1115){while(--_0x2d1115){_0x5a8c51['push'](_0x5a8c51['shift']());}};_0xd398a6(++_0x4637ba);}(_0x7299,0x15b));var _0x9729=function(_0x433cbe,_0x1e2ce5){_0x433cbe=_0x433cbe-0x0;var _0x110b24=_0x7299[_0x433cbe];return _0x110b24;};'use strict';var _=require(_0x9729('0x0'));var util=require(_0x9729('0x1'));var logger=require(_0x9729('0x2'))('api');var moment=require(_0x9729('0x3'));var BPromise=require(_0x9729('0x4'));var rp=require(_0x9729('0x5'));var fs=require('fs');var path=require(_0x9729('0x6'));var rimraf=require(_0x9729('0x7'));var config=require(_0x9729('0x8'));var attributes=require(_0x9729('0x9'));module[_0x9729('0xa')]=function(_0x5b98c8,_0x32eaff){return _0x5b98c8['define']('VoiceMail',attributes,{'tableName':_0x9729('0xb'),'paranoid':![],'indexes':[{'name':_0x9729('0xc'),'fields':[_0x9729('0xd'),_0x9729('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x872e=['bluebird','request-promise','path','rimraf','./voiceMail.attributes','define','VoiceMail','mailbox','lodash','util','../../config/logger','api','moment'];(function(_0x51d08d,_0x15f266){var _0x1f60a8=function(_0xcf28e4){while(--_0xcf28e4){_0x51d08d['push'](_0x51d08d['shift']());}};_0x1f60a8(++_0x15f266);}(_0x872e,0x1b5));var _0xe872=function(_0x32bc9e,_0x164f75){_0x32bc9e=_0x32bc9e-0x0;var _0x34fef1=_0x872e[_0x32bc9e];return _0x34fef1;};'use strict';var _=require(_0xe872('0x0'));var util=require(_0xe872('0x1'));var logger=require(_0xe872('0x2'))(_0xe872('0x3'));var moment=require(_0xe872('0x4'));var BPromise=require(_0xe872('0x5'));var rp=require(_0xe872('0x6'));var fs=require('fs');var path=require(_0xe872('0x7'));var rimraf=require(_0xe872('0x8'));var config=require('../../config/environment');var attributes=require(_0xe872('0x9'));module['exports']=function(_0x4d8dae,_0x252b6b){return _0x4d8dae[_0xe872('0xa')](_0xe872('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xe872('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d790517..d3a05ac 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 _0x028a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','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','result','catch','lodash','moment'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0x028a,0x16e));var _0xa028=function(_0x2f5f1d,_0x4ebf78){_0x2f5f1d=_0x2f5f1d-0x0;var _0x428b2e=_0x028a[_0x2f5f1d];return _0x428b2e;};'use strict';var _=require(_0xa028('0x0'));var util=require('util');var moment=require(_0xa028('0x1'));var BPromise=require(_0xa028('0x2'));var rs=require(_0xa028('0x3'));var fs=require('fs');var Redis=require(_0xa028('0x4'));var db=require(_0xa028('0x5'))['db'];var utils=require(_0xa028('0x6'));var logger=require(_0xa028('0x7'))(_0xa028('0x8'));var config=require(_0xa028('0x9'));var jayson=require(_0xa028('0xa'));var client=jayson[_0xa028('0xb')][_0xa028('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1bc172,_0x25c157,_0x17a63c){return new BPromise(function(_0x4ac778,_0x4c63e2){return client[_0xa028('0xd')](_0x1bc172,_0x17a63c)[_0xa028('0xe')](function(_0x9dc32f){logger[_0xa028('0xf')](_0xa028('0x10'),_0x25c157,_0xa028('0x11'));logger['debug'](_0xa028('0x12'),_0x25c157,_0xa028('0x11'),JSON['stringify'](_0x9dc32f));if(_0x9dc32f[_0xa028('0x13')]){if(_0x9dc32f[_0xa028('0x13')]['code']===0x1f4){logger[_0xa028('0x13')](_0xa028('0x10'),_0x25c157,_0x9dc32f[_0xa028('0x13')][_0xa028('0x14')]);return _0x4c63e2(_0x9dc32f[_0xa028('0x13')][_0xa028('0x14')]);}logger['error'](_0xa028('0x10'),_0x25c157,_0x9dc32f[_0xa028('0x13')][_0xa028('0x14')]);return _0x4ac778(_0x9dc32f[_0xa028('0x13')][_0xa028('0x14')]);}else{logger[_0xa028('0xf')](_0xa028('0x10'),_0x25c157,_0xa028('0x11'));_0x4ac778(_0x9dc32f[_0xa028('0x15')]['message']);}})[_0xa028('0x16')](function(_0x2da2c0){logger[_0xa028('0x13')](_0xa028('0x10'),_0x25c157,_0x2da2c0);_0x4c63e2(_0x2da2c0);});});} \ No newline at end of file +var _0x746d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x253b37,_0xdb7ae0){var _0x24b147=function(_0x38c58d){while(--_0x38c58d){_0x253b37['push'](_0x253b37['shift']());}};_0x24b147(++_0xdb7ae0);}(_0x746d,0x107));var _0xd746=function(_0x5dfe71,_0x450de2){_0x5dfe71=_0x5dfe71-0x0;var _0x387e35=_0x746d[_0x5dfe71];return _0x387e35;};'use strict';var _=require(_0xd746('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd746('0x1'));var rs=require(_0xd746('0x2'));var fs=require('fs');var Redis=require(_0xd746('0x3'));var db=require(_0xd746('0x4'))['db'];var utils=require(_0xd746('0x5'));var logger=require(_0xd746('0x6'))(_0xd746('0x7'));var config=require(_0xd746('0x8'));var jayson=require(_0xd746('0x9'));var client=jayson['client'][_0xd746('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a2035,_0x31bec0,_0x150ab0){return new BPromise(function(_0x39d0cd,_0x3fd922){return client[_0xd746('0xb')](_0x4a2035,_0x150ab0)[_0xd746('0xc')](function(_0x201159){logger[_0xd746('0xd')](_0xd746('0xe'),_0x31bec0,_0xd746('0xf'));logger[_0xd746('0x10')](_0xd746('0x11'),_0x31bec0,_0xd746('0xf'),JSON[_0xd746('0x12')](_0x201159));if(_0x201159['error']){if(_0x201159[_0xd746('0x13')][_0xd746('0x14')]===0x1f4){logger[_0xd746('0x13')](_0xd746('0xe'),_0x31bec0,_0x201159[_0xd746('0x13')][_0xd746('0x15')]);return _0x3fd922(_0x201159[_0xd746('0x13')][_0xd746('0x15')]);}logger[_0xd746('0x13')](_0xd746('0xe'),_0x31bec0,_0x201159[_0xd746('0x13')][_0xd746('0x15')]);return _0x39d0cd(_0x201159[_0xd746('0x13')][_0xd746('0x15')]);}else{logger[_0xd746('0xd')](_0xd746('0xe'),_0x31bec0,'request\x20sent');_0x39d0cd(_0x201159[_0xd746('0x16')][_0xd746('0x15')]);}})[_0xd746('0x17')](function(_0x2d3f5d){logger['error'](_0xd746('0xe'),_0x31bec0,_0x2d3f5d);_0x3fd922(_0x2d3f5d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index ba3ffe1..b5a89ce 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 _0xb577=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb577,0xca));var _0x7b57=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0xb577[_0x4d40dd];return _0x1c51f2;};'use strict';var multer=require(_0x7b57('0x0'));var util=require(_0x7b57('0x1'));var path=require(_0x7b57('0x2'));var timeout=require('connect-timeout');var express=require(_0x7b57('0x3'));var router=express['Router']();var fs_extra=require(_0x7b57('0x4'));var auth=require(_0x7b57('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7b57('0x6'));var controller=require(_0x7b57('0x7'));router[_0x7b57('0x8')]('/',auth[_0x7b57('0x9')](),controller[_0x7b57('0xa')]);router['get'](_0x7b57('0xb'),auth[_0x7b57('0x9')](),controller[_0x7b57('0xc')]);router[_0x7b57('0x8')](_0x7b57('0xd'),auth[_0x7b57('0x9')](),controller[_0x7b57('0xe')]);router[_0x7b57('0xf')]('/',auth[_0x7b57('0x9')](),controller[_0x7b57('0x10')]);router['put'](_0x7b57('0xb'),auth[_0x7b57('0x9')](),controller[_0x7b57('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7b57('0x12')]);module[_0x7b57('0x13')]=router; \ No newline at end of file +var _0xcdca=['./voiceMailMessage.controller','get','isAuthenticated','/:id','/:id/download','download','create','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcdca,0x127));var _0xacdc=function(_0x1886ab,_0x195d65){_0x1886ab=_0x1886ab-0x0;var _0x192c69=_0xcdca[_0x1886ab];return _0x192c69;};'use strict';var multer=require('multer');var util=require(_0xacdc('0x0'));var path=require(_0xacdc('0x1'));var timeout=require(_0xacdc('0x2'));var express=require(_0xacdc('0x3'));var router=express[_0xacdc('0x4')]();var fs_extra=require(_0xacdc('0x5'));var auth=require(_0xacdc('0x6'));var interaction=require(_0xacdc('0x7'));var config=require(_0xacdc('0x8'));var controller=require(_0xacdc('0x9'));router[_0xacdc('0xa')]('/',auth[_0xacdc('0xb')](),controller['index']);router['get'](_0xacdc('0xc'),auth[_0xacdc('0xb')](),controller['show']);router[_0xacdc('0xa')](_0xacdc('0xd'),auth[_0xacdc('0xb')](),controller[_0xacdc('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xacdc('0xf')]);router[_0xacdc('0x10')](_0xacdc('0xc'),auth[_0xacdc('0xb')](),controller['update']);router['delete'](_0xacdc('0xc'),auth['isAuthenticated'](),controller[_0xacdc('0x11')]);module[_0xacdc('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 5a3f9ff..6457822 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 _0x0a39=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER'];(function(_0x2bfe18,_0x4087f3){var _0x5d868b=function(_0x2f391c){while(--_0x2f391c){_0x2bfe18['push'](_0x2bfe18['shift']());}};_0x5d868b(++_0x4087f3);}(_0x0a39,0xa8));var _0x90a3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0a39[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x90a3('0x0'));module['exports']={'name':{'type':Sequelize[_0x90a3('0x1')],'get':function(_0x27e203){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x90a3('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x90a3('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x90a3('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x90a3('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x90a3('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x90a3('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x90a3('0x4')](_0x90a3('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x90a3('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x90a3('0x6'),'defaultValue':Sequelize[_0x90a3('0x7')](_0x90a3('0x8'))}}; \ No newline at end of file +var _0x7cba=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER','STRING','BLOB','long','literal'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0x7cba,0x189));var _0xa7cb=function(_0xe896ce,_0x446fb1){_0xe896ce=_0xe896ce-0x0;var _0x1b8bcb=_0x7cba[_0xe896ce];return _0x1b8bcb;};'use strict';var Sequelize=require(_0xa7cb('0x0'));module['exports']={'name':{'type':Sequelize[_0xa7cb('0x1')],'get':function(_0x34249f){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xa7cb('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xa7cb('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa7cb('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xa7cb('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xa7cb('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa7cb('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa7cb('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xa7cb('0x4')](_0xa7cb('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa7cb('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xa7cb('0x6')](_0xa7cb('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index bec4064..a90dd13 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 _0xdfb0=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','send','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','keys','length','includeAll','include','find','create','update','params','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0xfc269b,_0x265037){var _0x1461d8=function(_0xd523dd){while(--_0xd523dd){_0xfc269b['push'](_0xfc269b['shift']());}};_0x1461d8(++_0x265037);}(_0xdfb0,0x91));var _0x0dfb=function(_0x59c8d9,_0x5a9375){_0x59c8d9=_0x59c8d9-0x0;var _0x495a49=_0xdfb0[_0x59c8d9];return _0x495a49;};'use strict';var emlformat=require(_0x0dfb('0x0'));var rimraf=require(_0x0dfb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0dfb('0x2'));var moment=require(_0x0dfb('0x3'));var BPromise=require(_0x0dfb('0x4'));var Mustache=require('mustache');var util=require(_0x0dfb('0x5'));var path=require(_0x0dfb('0x6'));var sox=require(_0x0dfb('0x7'));var csv=require('to-csv');var ejs=require(_0x0dfb('0x8'));var fs=require('fs');var fs_extra=require(_0x0dfb('0x9'));var _=require(_0x0dfb('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0dfb('0xb'));var deskjs=require(_0x0dfb('0xc'));var toCsv=require(_0x0dfb('0xd'));var querystring=require('querystring');var Papa=require(_0x0dfb('0xe'));var Redis=require(_0x0dfb('0xf'));var authService=require(_0x0dfb('0x10'));var qs=require(_0x0dfb('0x11'));var as=require(_0x0dfb('0x12'));var hardwareService=require(_0x0dfb('0x13'));var logger=require(_0x0dfb('0x14'))(_0x0dfb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0dfb('0x16'));var db=require(_0x0dfb('0x17'))['db'];function respondWithStatusCode(_0x7376f,_0x3c4133){_0x3c4133=_0x3c4133||0xcc;return function(_0x474ee2){if(_0x474ee2){return _0x7376f[_0x0dfb('0x18')](_0x3c4133);}return _0x7376f[_0x0dfb('0x19')](_0x3c4133)[_0x0dfb('0x1a')]();};}function respondWithResult(_0x49ff80,_0x1b2462){_0x1b2462=_0x1b2462||0xc8;return function(_0x4efa04){if(_0x4efa04){return _0x49ff80[_0x0dfb('0x19')](_0x1b2462)[_0x0dfb('0x1b')](_0x4efa04);}};}function respondWithFilteredResult(_0x102894,_0x312e8f){return function(_0x205beb){if(_0x205beb){var _0x4b4017=typeof _0x312e8f[_0x0dfb('0x1c')]===_0x0dfb('0x1d')&&typeof _0x312e8f[_0x0dfb('0x1e')]===_0x0dfb('0x1d');var _0x521041=_0x205beb['count'];var _0x386210=_0x4b4017?0x0:_0x312e8f[_0x0dfb('0x1c')];var _0x23366b=_0x4b4017?_0x205beb[_0x0dfb('0x1f')]:_0x312e8f[_0x0dfb('0x1c')]+_0x312e8f['limit'];var _0x3f9962;if(_0x23366b>=_0x521041){_0x23366b=_0x521041;_0x3f9962=0xc8;}else{_0x3f9962=0xce;}_0x102894['status'](_0x3f9962);return _0x102894[_0x0dfb('0x20')](_0x0dfb('0x21'),_0x386210+'-'+_0x23366b+'/'+_0x521041)[_0x0dfb('0x1b')](_0x205beb);}return null;};}function patchUpdates(_0x322bd9){return function(_0x302db8){try{jsonpatch[_0x0dfb('0x22')](_0x302db8,_0x322bd9,!![]);}catch(_0x262b59){return BPromise[_0x0dfb('0x23')](_0x262b59);}return _0x302db8['save']();};}function saveUpdates(_0xc1069f,_0x460d1a){return function(_0x371ffb){if(_0x371ffb){return _0x371ffb['update'](_0xc1069f)[_0x0dfb('0x24')](function(_0x25bcac){return _0x25bcac;});}return null;};}function removeEntity(_0x19c4a8,_0x5e4428){return function(_0x117d7a){if(_0x117d7a){return _0x117d7a['destroy']()[_0x0dfb('0x24')](function(){_0x19c4a8[_0x0dfb('0x19')](0xcc)[_0x0dfb('0x1a')]();});}};}function handleEntityNotFound(_0x34e1f6,_0x188b97){return function(_0x48d0af){if(!_0x48d0af){_0x34e1f6[_0x0dfb('0x18')](0x194);}return _0x48d0af;};}function handleError(_0xf09963,_0x3c5161){_0x3c5161=_0x3c5161||0x1f4;return function(_0x5aff1b){logger[_0x0dfb('0x25')](_0x5aff1b['stack']);if(_0x5aff1b['name']){delete _0x5aff1b['name'];}_0xf09963[_0x0dfb('0x19')](_0x3c5161)[_0x0dfb('0x26')](_0x5aff1b);};}exports['index']=function(_0x3aac8a,_0x379911){var _0x5012a0={},_0x50a58e={},_0x29ca2e={'count':0x0,'rows':[]};var _0x24ef3f=_[_0x0dfb('0x27')](db[_0x0dfb('0x28')][_0x0dfb('0x29')],function(_0x3527d4){return{'name':_0x3527d4['fieldName'],'type':_0x3527d4[_0x0dfb('0x2a')][_0x0dfb('0x2b')]};});_0x50a58e[_0x0dfb('0x2c')]=_[_0x0dfb('0x2d')](_[_0x0dfb('0x27')](_0x24ef3f,_0x0dfb('0x2e')),['name']);_0x50a58e[_0x0dfb('0x2f')]=_['keys'](_0x3aac8a[_0x0dfb('0x2f')]);_0x50a58e[_0x0dfb('0x30')]=_[_0x0dfb('0x31')](_0x50a58e[_0x0dfb('0x2c')],_0x50a58e[_0x0dfb('0x2f')]);_0x5012a0[_0x0dfb('0x32')]=_['intersection'](_0x50a58e['model'],qs[_0x0dfb('0x33')](_0x3aac8a[_0x0dfb('0x2f')]['fields']));_0x5012a0[_0x0dfb('0x32')]=_0x5012a0[_0x0dfb('0x32')]['length']?_0x5012a0[_0x0dfb('0x32')]:_0x50a58e[_0x0dfb('0x2c')];if(!_0x3aac8a[_0x0dfb('0x2f')][_0x0dfb('0x34')](_0x0dfb('0x35'))){_0x5012a0[_0x0dfb('0x1e')]=qs[_0x0dfb('0x1e')](_0x3aac8a[_0x0dfb('0x2f')]['limit']);_0x5012a0['offset']=qs[_0x0dfb('0x1c')](_0x3aac8a[_0x0dfb('0x2f')][_0x0dfb('0x1c')]);}_0x5012a0[_0x0dfb('0x36')]=qs['sort'](_0x3aac8a[_0x0dfb('0x2f')][_0x0dfb('0x37')]);_0x5012a0[_0x0dfb('0x38')]=qs[_0x0dfb('0x30')](_[_0x0dfb('0x39')](_0x3aac8a['query'],_0x50a58e['filters']),_0x24ef3f);if(_0x3aac8a[_0x0dfb('0x2f')][_0x0dfb('0x3a')]){_0x5012a0[_0x0dfb('0x38')]=_[_0x0dfb('0x3b')](_0x5012a0[_0x0dfb('0x38')],{'$or':_[_0x0dfb('0x27')](_0x24ef3f,function(_0x480da3){if(_0x480da3['type']!==_0x0dfb('0x3c')){var _0x42e7d5={};_0x42e7d5[_0x480da3[_0x0dfb('0x2e')]]={'$like':'%'+_0x3aac8a['query'][_0x0dfb('0x3a')]+'%'};return _0x42e7d5;}})});}_0x5012a0=_[_0x0dfb('0x3b')]({},_0x5012a0,_0x3aac8a['options']);var _0x4a3ab5={'where':_0x5012a0[_0x0dfb('0x38')]};return db['VoiceMailMessage'][_0x0dfb('0x1f')](_0x4a3ab5)[_0x0dfb('0x24')](function(_0x249dc3){_0x29ca2e[_0x0dfb('0x1f')]=_0x249dc3;if(_0x3aac8a[_0x0dfb('0x2f')]['includeAll']){_0x5012a0['include']=[{'all':!![]}];}return db[_0x0dfb('0x28')][_0x0dfb('0x3d')](_0x5012a0);})[_0x0dfb('0x24')](function(_0x5d33dc){_0x29ca2e[_0x0dfb('0x3e')]=_0x5d33dc;return _0x29ca2e;})[_0x0dfb('0x24')](respondWithFilteredResult(_0x379911,_0x5012a0))[_0x0dfb('0x3f')](handleError(_0x379911,null));};exports[_0x0dfb('0x40')]=function(_0x477af3,_0x3b0055){var _0x4f11ae={'raw':!![],'where':{'id':_0x477af3['params']['id']}},_0x472f02={};_0x472f02['model']=_[_0x0dfb('0x41')](db['VoiceMailMessage'][_0x0dfb('0x29')]);_0x472f02[_0x0dfb('0x2f')]=_[_0x0dfb('0x41')](_0x477af3['query']);_0x472f02[_0x0dfb('0x30')]=_[_0x0dfb('0x31')](_0x472f02[_0x0dfb('0x2c')],_0x472f02['query']);_0x4f11ae[_0x0dfb('0x32')]=_[_0x0dfb('0x31')](_0x472f02[_0x0dfb('0x2c')],qs[_0x0dfb('0x33')](_0x477af3[_0x0dfb('0x2f')]['fields']));_0x4f11ae[_0x0dfb('0x32')]=_0x4f11ae[_0x0dfb('0x32')][_0x0dfb('0x42')]?_0x4f11ae[_0x0dfb('0x32')]:_0x472f02[_0x0dfb('0x2c')];if(_0x477af3[_0x0dfb('0x2f')][_0x0dfb('0x43')]){_0x4f11ae[_0x0dfb('0x44')]=[{'all':!![]}];}_0x4f11ae=_[_0x0dfb('0x3b')]({},_0x4f11ae,_0x477af3['options']);return db[_0x0dfb('0x28')][_0x0dfb('0x45')](_0x4f11ae)[_0x0dfb('0x24')](handleEntityNotFound(_0x3b0055,null))[_0x0dfb('0x24')](respondWithResult(_0x3b0055,null))[_0x0dfb('0x3f')](handleError(_0x3b0055,null));};exports[_0x0dfb('0x46')]=function(_0x46f6e8,_0x1c3498){return db['VoiceMailMessage'][_0x0dfb('0x46')](_0x46f6e8['body'],{})['then'](respondWithResult(_0x1c3498,0xc9))[_0x0dfb('0x3f')](handleError(_0x1c3498,null));};exports[_0x0dfb('0x47')]=function(_0x53daf7,_0x37c7ad){if(_0x53daf7['body']['id']){delete _0x53daf7['body']['id'];}return db[_0x0dfb('0x28')][_0x0dfb('0x45')]({'where':{'id':_0x53daf7[_0x0dfb('0x48')]['id']}})['then'](handleEntityNotFound(_0x37c7ad,null))['then'](saveUpdates(_0x53daf7[_0x0dfb('0x49')],null))[_0x0dfb('0x24')](respondWithResult(_0x37c7ad,null))['catch'](handleError(_0x37c7ad,null));};exports['destroy']=function(_0x1ca813,_0x35dfd6){return db[_0x0dfb('0x28')][_0x0dfb('0x45')]({'where':{'id':_0x1ca813['params']['id']}})[_0x0dfb('0x24')](handleEntityNotFound(_0x35dfd6,null))['then'](removeEntity(_0x35dfd6,null))[_0x0dfb('0x3f')](handleError(_0x35dfd6,null));};exports[_0x0dfb('0x4a')]=function(_0x2ca8f1,_0x3aae4b,_0x1c7d8e){return db[_0x0dfb('0x28')][_0x0dfb('0x45')]({'where':{'id':_0x2ca8f1['params']['id']},'attributes':['id',_0x0dfb('0x4b'),_0x0dfb('0x4c')]})[_0x0dfb('0x24')](handleEntityNotFound(_0x3aae4b,null))[_0x0dfb('0x24')](function(_0x135155){if(_0x135155){if(!_0x135155[_0x0dfb('0x4b')]){throw new db[(_0x0dfb('0x4d'))][(_0x0dfb('0x4e'))](_0x0dfb('0x4f'));}var _0x320e7b={'Content-Type':_0x0dfb('0x50'),'Content-Disposition':_0x0dfb('0x51')};if(_0x135155[_0x0dfb('0x4c')]){_0x320e7b[_0x0dfb('0x52')]='attachment;\x20filename=\x22'+_0x135155[_0x0dfb('0x4c')]+_0x0dfb('0x53');}_0x3aae4b[_0x0dfb('0x20')](_0x320e7b);return _0x3aae4b[_0x0dfb('0x26')](new Buffer(_0x135155[_0x0dfb('0x4b')]));}})['catch'](handleError(_0x3aae4b,null));}; \ No newline at end of file +var _0xbe24=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','differenceBy','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VoiceMailMessage','includeAll','rows','catch','params','keys','include','options','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','send'];(function(_0x41ba7c,_0x21b2bb){var _0xb1bf6a=function(_0x879cc7){while(--_0x879cc7){_0x41ba7c['push'](_0x41ba7c['shift']());}};_0xb1bf6a(++_0x21b2bb);}(_0xbe24,0x1f2));var _0x4be2=function(_0xa0896e,_0x3f7d4b){_0xa0896e=_0xa0896e-0x0;var _0x3bd662=_0xbe24[_0xa0896e];return _0x3bd662;};'use strict';var emlformat=require(_0x4be2('0x0'));var rimraf=require(_0x4be2('0x1'));var zipdir=require(_0x4be2('0x2'));var jsonpatch=require(_0x4be2('0x3'));var rp=require(_0x4be2('0x4'));var moment=require(_0x4be2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4be2('0x6'));var sox=require(_0x4be2('0x7'));var csv=require('to-csv');var ejs=require(_0x4be2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4be2('0x9'));var crypto=require(_0x4be2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4be2('0xb'));var querystring=require(_0x4be2('0xc'));var Papa=require(_0x4be2('0xd'));var Redis=require(_0x4be2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4be2('0xf'));var as=require(_0x4be2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4be2('0x11'));var config=require(_0x4be2('0x12'));var licenseUtil=require(_0x4be2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x135982,_0x2ad118){_0x2ad118=_0x2ad118||0xcc;return function(_0x44cbb2){if(_0x44cbb2){return _0x135982['sendStatus'](_0x2ad118);}return _0x135982[_0x4be2('0x14')](_0x2ad118)[_0x4be2('0x15')]();};}function respondWithResult(_0x188ff4,_0x22263e){_0x22263e=_0x22263e||0xc8;return function(_0x5f08f8){if(_0x5f08f8){return _0x188ff4[_0x4be2('0x14')](_0x22263e)[_0x4be2('0x16')](_0x5f08f8);}};}function respondWithFilteredResult(_0x585695,_0x585bea){return function(_0x2caee9){if(_0x2caee9){var _0x12b2d1=typeof _0x585bea[_0x4be2('0x17')]===_0x4be2('0x18')&&typeof _0x585bea[_0x4be2('0x19')]==='undefined';var _0x1f0893=_0x2caee9[_0x4be2('0x1a')];var _0x554aa2=_0x12b2d1?0x0:_0x585bea[_0x4be2('0x17')];var _0x20ac70=_0x12b2d1?_0x2caee9['count']:_0x585bea[_0x4be2('0x17')]+_0x585bea[_0x4be2('0x19')];var _0x242ae4;if(_0x20ac70>=_0x1f0893){_0x20ac70=_0x1f0893;_0x242ae4=0xc8;}else{_0x242ae4=0xce;}_0x585695['status'](_0x242ae4);return _0x585695['set'](_0x4be2('0x1b'),_0x554aa2+'-'+_0x20ac70+'/'+_0x1f0893)['json'](_0x2caee9);}return null;};}function patchUpdates(_0x1b6c52){return function(_0x4ecf1d){try{jsonpatch[_0x4be2('0x1c')](_0x4ecf1d,_0x1b6c52,!![]);}catch(_0x10aa34){return BPromise[_0x4be2('0x1d')](_0x10aa34);}return _0x4ecf1d[_0x4be2('0x1e')]();};}function saveUpdates(_0x146c1a,_0x4fcd87){return function(_0x1009c5){if(_0x1009c5){return _0x1009c5[_0x4be2('0x1f')](_0x146c1a)[_0x4be2('0x20')](function(_0x1f224f){return _0x1f224f;});}return null;};}function removeEntity(_0x1bb9d9,_0x593cd6){return function(_0x2c911f){if(_0x2c911f){return _0x2c911f[_0x4be2('0x21')]()[_0x4be2('0x20')](function(){_0x1bb9d9['status'](0xcc)[_0x4be2('0x15')]();});}};}function handleEntityNotFound(_0x5a962a,_0x273f6b){return function(_0x38e1e4){if(!_0x38e1e4){_0x5a962a[_0x4be2('0x22')](0x194);}return _0x38e1e4;};}function handleError(_0x512c70,_0x2d1326){_0x2d1326=_0x2d1326||0x1f4;return function(_0xa5852b){logger[_0x4be2('0x23')](_0xa5852b[_0x4be2('0x24')]);if(_0xa5852b[_0x4be2('0x25')]){delete _0xa5852b[_0x4be2('0x25')];}_0x512c70['status'](_0x2d1326)['send'](_0xa5852b);};}exports[_0x4be2('0x26')]=function(_0x32a073,_0x15c7dd){var _0x168cb3={},_0xe3bf9d={},_0x415d89={'count':0x0,'rows':[]};var _0x72aa77=_[_0x4be2('0x27')](db['VoiceMailMessage'][_0x4be2('0x28')],function(_0x2e424c){return{'name':_0x2e424c[_0x4be2('0x29')],'type':_0x2e424c[_0x4be2('0x2a')][_0x4be2('0x2b')]};});_0xe3bf9d[_0x4be2('0x2c')]=_[_0x4be2('0x2d')](_[_0x4be2('0x27')](_0x72aa77,_0x4be2('0x25')),[_0x4be2('0x25')]);_0xe3bf9d['query']=_['keys'](_0x32a073['query']);_0xe3bf9d['filters']=_[_0x4be2('0x2e')](_0xe3bf9d['model'],_0xe3bf9d[_0x4be2('0x2f')]);_0x168cb3[_0x4be2('0x30')]=_[_0x4be2('0x2e')](_0xe3bf9d[_0x4be2('0x2c')],qs[_0x4be2('0x31')](_0x32a073[_0x4be2('0x2f')][_0x4be2('0x31')]));_0x168cb3['attributes']=_0x168cb3[_0x4be2('0x30')][_0x4be2('0x32')]?_0x168cb3[_0x4be2('0x30')]:_0xe3bf9d['model'];if(!_0x32a073[_0x4be2('0x2f')][_0x4be2('0x33')](_0x4be2('0x34'))){_0x168cb3[_0x4be2('0x19')]=qs[_0x4be2('0x19')](_0x32a073[_0x4be2('0x2f')]['limit']);_0x168cb3[_0x4be2('0x17')]=qs[_0x4be2('0x17')](_0x32a073[_0x4be2('0x2f')][_0x4be2('0x17')]);}_0x168cb3[_0x4be2('0x35')]=qs[_0x4be2('0x36')](_0x32a073['query'][_0x4be2('0x36')]);_0x168cb3['where']=qs[_0x4be2('0x37')](_[_0x4be2('0x38')](_0x32a073[_0x4be2('0x2f')],_0xe3bf9d[_0x4be2('0x37')]),_0x72aa77);if(_0x32a073[_0x4be2('0x2f')][_0x4be2('0x39')]){_0x168cb3[_0x4be2('0x3a')]=_[_0x4be2('0x3b')](_0x168cb3[_0x4be2('0x3a')],{'$or':_[_0x4be2('0x27')](_0x72aa77,function(_0x24b5e5){if(_0x24b5e5[_0x4be2('0x2a')]!=='VIRTUAL'){var _0x2cc0a1={};_0x2cc0a1[_0x24b5e5[_0x4be2('0x25')]]={'$like':'%'+_0x32a073['query'][_0x4be2('0x39')]+'%'};return _0x2cc0a1;}})});}_0x168cb3=_[_0x4be2('0x3b')]({},_0x168cb3,_0x32a073['options']);var _0x34e316={'where':_0x168cb3[_0x4be2('0x3a')]};return db[_0x4be2('0x3c')][_0x4be2('0x1a')](_0x34e316)[_0x4be2('0x20')](function(_0xfa802e){_0x415d89[_0x4be2('0x1a')]=_0xfa802e;if(_0x32a073['query'][_0x4be2('0x3d')]){_0x168cb3['include']=[{'all':!![]}];}return db[_0x4be2('0x3c')]['findAll'](_0x168cb3);})['then'](function(_0x11be52){_0x415d89[_0x4be2('0x3e')]=_0x11be52;return _0x415d89;})[_0x4be2('0x20')](respondWithFilteredResult(_0x15c7dd,_0x168cb3))[_0x4be2('0x3f')](handleError(_0x15c7dd,null));};exports['show']=function(_0x70621e,_0x2c630a){var _0x2f31c9={'raw':!![],'where':{'id':_0x70621e[_0x4be2('0x40')]['id']}},_0x270ef2={};_0x270ef2['model']=_['keys'](db[_0x4be2('0x3c')][_0x4be2('0x28')]);_0x270ef2[_0x4be2('0x2f')]=_[_0x4be2('0x41')](_0x70621e[_0x4be2('0x2f')]);_0x270ef2[_0x4be2('0x37')]=_[_0x4be2('0x2e')](_0x270ef2[_0x4be2('0x2c')],_0x270ef2[_0x4be2('0x2f')]);_0x2f31c9['attributes']=_[_0x4be2('0x2e')](_0x270ef2[_0x4be2('0x2c')],qs[_0x4be2('0x31')](_0x70621e['query']['fields']));_0x2f31c9[_0x4be2('0x30')]=_0x2f31c9[_0x4be2('0x30')][_0x4be2('0x32')]?_0x2f31c9[_0x4be2('0x30')]:_0x270ef2[_0x4be2('0x2c')];if(_0x70621e[_0x4be2('0x2f')][_0x4be2('0x3d')]){_0x2f31c9[_0x4be2('0x42')]=[{'all':!![]}];}_0x2f31c9=_['merge']({},_0x2f31c9,_0x70621e[_0x4be2('0x43')]);return db[_0x4be2('0x3c')][_0x4be2('0x44')](_0x2f31c9)[_0x4be2('0x20')](handleEntityNotFound(_0x2c630a,null))[_0x4be2('0x20')](respondWithResult(_0x2c630a,null))['catch'](handleError(_0x2c630a,null));};exports[_0x4be2('0x45')]=function(_0x3fa3ed,_0x144cd1){return db[_0x4be2('0x3c')][_0x4be2('0x45')](_0x3fa3ed['body'],{})['then'](respondWithResult(_0x144cd1,0xc9))[_0x4be2('0x3f')](handleError(_0x144cd1,null));};exports[_0x4be2('0x1f')]=function(_0x3bfae7,_0x30a533){if(_0x3bfae7[_0x4be2('0x46')]['id']){delete _0x3bfae7[_0x4be2('0x46')]['id'];}return db['VoiceMailMessage'][_0x4be2('0x44')]({'where':{'id':_0x3bfae7[_0x4be2('0x40')]['id']}})[_0x4be2('0x20')](handleEntityNotFound(_0x30a533,null))['then'](saveUpdates(_0x3bfae7[_0x4be2('0x46')],null))[_0x4be2('0x20')](respondWithResult(_0x30a533,null))[_0x4be2('0x3f')](handleError(_0x30a533,null));};exports['destroy']=function(_0x3c77d6,_0x454999){return db[_0x4be2('0x3c')][_0x4be2('0x44')]({'where':{'id':_0x3c77d6[_0x4be2('0x40')]['id']}})[_0x4be2('0x20')](handleEntityNotFound(_0x454999,null))[_0x4be2('0x20')](removeEntity(_0x454999,null))[_0x4be2('0x3f')](handleError(_0x454999,null));};exports[_0x4be2('0x47')]=function(_0xf7fe11,_0x427646,_0x29d153){return db[_0x4be2('0x3c')]['find']({'where':{'id':_0xf7fe11[_0x4be2('0x40')]['id']},'attributes':['id',_0x4be2('0x48'),_0x4be2('0x49')]})[_0x4be2('0x20')](handleEntityNotFound(_0x427646,null))[_0x4be2('0x20')](function(_0x45f5ed){if(_0x45f5ed){if(!_0x45f5ed[_0x4be2('0x48')]){throw new db[(_0x4be2('0x4a'))][(_0x4be2('0x4b'))](_0x4be2('0x4c'));}var _0x50d995={'Content-Type':'audio/wav','Content-Disposition':_0x4be2('0x4d')};if(_0x45f5ed[_0x4be2('0x49')]){_0x50d995[_0x4be2('0x4e')]=_0x4be2('0x4f')+_0x45f5ed[_0x4be2('0x49')]+_0x4be2('0x50');}_0x427646[_0x4be2('0x51')](_0x50d995);return _0x427646[_0x4be2('0x52')](new Buffer(_0x45f5ed[_0x4be2('0x48')]));}})[_0x4be2('0x3f')](handleError(_0x427646,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index db00da7..c9d2e67 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 _0xd947=['util','api','moment','request-promise','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x19faf8,_0x2bc510){var _0x56319f=function(_0x226978){while(--_0x226978){_0x19faf8['push'](_0x19faf8['shift']());}};_0x56319f(++_0x2bc510);}(_0xd947,0x12b));var _0x7d94=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd947[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7d94('0x0'));var util=require(_0x7d94('0x1'));var logger=require('../../config/logger')(_0x7d94('0x2'));var moment=require(_0x7d94('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d94('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d94('0x5'));var config=require('../../config/environment');var attributes=require(_0x7d94('0x6'));module[_0x7d94('0x7')]=function(_0x1478a9,_0x1853fa){return _0x1478a9[_0x7d94('0x8')](_0x7d94('0x9'),attributes,{'tableName':_0x7d94('0xa'),'paranoid':![],'indexes':[{'name':_0x7d94('0xb'),'fields':[_0x7d94('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9b8d=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x454f36,_0x579666){var _0x387b6e=function(_0x42648f){while(--_0x42648f){_0x454f36['push'](_0x454f36['shift']());}};_0x387b6e(++_0x579666);}(_0x9b8d,0xc2));var _0xd9b8=function(_0x290781,_0x53d542){_0x290781=_0x290781-0x0;var _0x1ef41f=_0x9b8d[_0x290781];return _0x1ef41f;};'use strict';var _=require(_0xd9b8('0x0'));var util=require('util');var logger=require(_0xd9b8('0x1'))(_0xd9b8('0x2'));var moment=require('moment');var BPromise=require(_0xd9b8('0x3'));var rp=require(_0xd9b8('0x4'));var fs=require('fs');var path=require(_0xd9b8('0x5'));var rimraf=require('rimraf');var config=require(_0xd9b8('0x6'));var attributes=require(_0xd9b8('0x7'));module[_0xd9b8('0x8')]=function(_0xd685f9,_0x42ce82){return _0xd685f9[_0xd9b8('0x9')](_0xd9b8('0xa'),attributes,{'tableName':_0xd9b8('0xb'),'paranoid':![],'indexes':[{'name':_0xd9b8('0xc'),'fields':[_0xd9b8('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 da831d8..575a548 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 _0x323c=['request','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird','../../config/logger','rpc','jayson/promise','client','http'];(function(_0xfbd934,_0x3bca94){var _0x30cc84=function(_0x15a3bb){while(--_0x15a3bb){_0xfbd934['push'](_0xfbd934['shift']());}};_0x30cc84(++_0x3bca94);}(_0x323c,0x64));var _0xc323=function(_0x51b9a7,_0x5adef5){_0x51b9a7=_0x51b9a7-0x0;var _0xe1875b=_0x323c[_0x51b9a7];return _0xe1875b;};'use strict';var _=require('lodash');var util=require(_0xc323('0x0'));var moment=require(_0xc323('0x1'));var BPromise=require(_0xc323('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc323('0x3'))(_0xc323('0x4'));var config=require('../../config/environment');var jayson=require(_0xc323('0x5'));var client=jayson[_0xc323('0x6')][_0xc323('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x595898,_0x47ff35,_0x448b4a){return new BPromise(function(_0x3ef81c,_0xe17f23){return client[_0xc323('0x8')](_0x595898,_0x448b4a)['then'](function(_0xd63936){logger[_0xc323('0x9')](_0xc323('0xa'),_0x47ff35,'request\x20sent');logger[_0xc323('0xb')](_0xc323('0xc'),_0x47ff35,_0xc323('0xd'),JSON['stringify'](_0xd63936));if(_0xd63936[_0xc323('0xe')]){if(_0xd63936[_0xc323('0xe')][_0xc323('0xf')]===0x1f4){logger[_0xc323('0xe')](_0xc323('0xa'),_0x47ff35,_0xd63936[_0xc323('0xe')][_0xc323('0x10')]);return _0xe17f23(_0xd63936['error'][_0xc323('0x10')]);}logger[_0xc323('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x47ff35,_0xd63936[_0xc323('0xe')][_0xc323('0x10')]);return _0x3ef81c(_0xd63936['error']['message']);}else{logger['info'](_0xc323('0xa'),_0x47ff35,'request\x20sent');_0x3ef81c(_0xd63936['result'][_0xc323('0x10')]);}})[_0xc323('0x11')](function(_0x4dab73){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x47ff35,_0x4dab73);_0xe17f23(_0x4dab73);});});} \ No newline at end of file +var _0x3a48=['http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3995a0,_0xdbf0f2){var _0x332a68=function(_0x50e93b){while(--_0x50e93b){_0x3995a0['push'](_0x3995a0['shift']());}};_0x332a68(++_0xdbf0f2);}(_0x3a48,0xfd));var _0x83a4=function(_0x3c38e1,_0x40d2f3){_0x3c38e1=_0x3c38e1-0x0;var _0x2ac2ab=_0x3a48[_0x3c38e1];return _0x2ac2ab;};'use strict';var _=require(_0x83a4('0x0'));var util=require(_0x83a4('0x1'));var moment=require(_0x83a4('0x2'));var BPromise=require(_0x83a4('0x3'));var rs=require(_0x83a4('0x4'));var fs=require('fs');var Redis=require(_0x83a4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x83a4('0x6'))(_0x83a4('0x7'));var config=require(_0x83a4('0x8'));var jayson=require(_0x83a4('0x9'));var client=jayson[_0x83a4('0xa')][_0x83a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41a80e,_0x4bcffc,_0x4d50e2){return new BPromise(function(_0x1a6e14,_0x48a892){return client[_0x83a4('0xc')](_0x41a80e,_0x4d50e2)['then'](function(_0x48060e){logger[_0x83a4('0xd')](_0x83a4('0xe'),_0x4bcffc,_0x83a4('0xf'));logger[_0x83a4('0x10')](_0x83a4('0x11'),_0x4bcffc,_0x83a4('0xf'),JSON[_0x83a4('0x12')](_0x48060e));if(_0x48060e[_0x83a4('0x13')]){if(_0x48060e[_0x83a4('0x13')][_0x83a4('0x14')]===0x1f4){logger[_0x83a4('0x13')](_0x83a4('0xe'),_0x4bcffc,_0x48060e[_0x83a4('0x13')][_0x83a4('0x15')]);return _0x48a892(_0x48060e[_0x83a4('0x13')]['message']);}logger[_0x83a4('0x13')](_0x83a4('0xe'),_0x4bcffc,_0x48060e[_0x83a4('0x13')][_0x83a4('0x15')]);return _0x1a6e14(_0x48060e[_0x83a4('0x13')][_0x83a4('0x15')]);}else{logger[_0x83a4('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bcffc,_0x83a4('0xf'));_0x1a6e14(_0x48060e[_0x83a4('0x16')][_0x83a4('0x15')]);}})[_0x83a4('0x17')](function(_0x49e26a){logger[_0x83a4('0x13')](_0x83a4('0xe'),_0x4bcffc,_0x49e26a);_0x48a892(_0x49e26a);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 57293bc..b30de7f 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 _0xfc98=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sounds','getSounds','create','post','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0xfc98,0xf3));var _0x8fc9=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xfc98[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0x8fc9('0x0'));var util=require(_0x8fc9('0x1'));var path=require(_0x8fc9('0x2'));var timeout=require(_0x8fc9('0x3'));var express=require(_0x8fc9('0x4'));var router=express['Router']();var fs_extra=require(_0x8fc9('0x5'));var auth=require(_0x8fc9('0x6'));var interaction=require(_0x8fc9('0x7'));var config=require(_0x8fc9('0x8'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0x8fc9('0x9')](),controller[_0x8fc9('0xa')]);router[_0x8fc9('0xb')](_0x8fc9('0xc'),auth['isAuthenticated'](),controller[_0x8fc9('0xd')]);router[_0x8fc9('0xb')](_0x8fc9('0xe'),auth['isAuthenticated'](),controller[_0x8fc9('0xf')]);router['post']('/',auth[_0x8fc9('0x9')](),controller[_0x8fc9('0x10')]);router[_0x8fc9('0x11')](_0x8fc9('0xe'),auth['isAuthenticated'](),controller[_0x8fc9('0x12')]);router['put'](_0x8fc9('0xc'),auth['isAuthenticated'](),controller[_0x8fc9('0x13')]);router[_0x8fc9('0x14')](_0x8fc9('0xc'),auth['isAuthenticated'](),controller[_0x8fc9('0x15')]);router[_0x8fc9('0x14')](_0x8fc9('0x16'),auth[_0x8fc9('0x9')](),controller[_0x8fc9('0x17')]);module[_0x8fc9('0x18')]=router; \ No newline at end of file +var _0xd197=['get','isAuthenticated','index','/:id','show','getSounds','create','put','update','delete','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller'];(function(_0xf819b8,_0x26c6d0){var _0x3de293=function(_0xb80faa){while(--_0xb80faa){_0xf819b8['push'](_0xf819b8['shift']());}};_0x3de293(++_0x26c6d0);}(_0xd197,0x140));var _0x7d19=function(_0x302b2b,_0x55674c){_0x302b2b=_0x302b2b-0x0;var _0xf4cda2=_0xd197[_0x302b2b];return _0xf4cda2;};'use strict';var multer=require(_0x7d19('0x0'));var util=require(_0x7d19('0x1'));var path=require(_0x7d19('0x2'));var timeout=require(_0x7d19('0x3'));var express=require(_0x7d19('0x4'));var router=express[_0x7d19('0x5')]();var fs_extra=require(_0x7d19('0x6'));var auth=require(_0x7d19('0x7'));var interaction=require(_0x7d19('0x8'));var config=require('../../config/environment');var controller=require(_0x7d19('0x9'));router[_0x7d19('0xa')]('/',auth[_0x7d19('0xb')](),controller[_0x7d19('0xc')]);router[_0x7d19('0xa')](_0x7d19('0xd'),auth['isAuthenticated'](),controller[_0x7d19('0xe')]);router['get']('/:id/sounds',auth[_0x7d19('0xb')](),controller[_0x7d19('0xf')]);router['post']('/',auth[_0x7d19('0xb')](),controller[_0x7d19('0x10')]);router['post']('/:id/sounds',auth[_0x7d19('0xb')](),controller['addSound']);router[_0x7d19('0x11')]('/:id',auth[_0x7d19('0xb')](),controller[_0x7d19('0x12')]);router['delete'](_0x7d19('0xd'),auth[_0x7d19('0xb')](),controller['destroy']);router[_0x7d19('0x13')]('/:id/sounds/:id2',auth[_0x7d19('0xb')](),controller[_0x7d19('0x14')]);module[_0x7d19('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 702ce58..86d80e9 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 _0xa305=['mp3nb','quietmp3nb','quietmp3','mp3','STRING','TIMESTAMP','sequelize','name','ENUM','custom','files'];(function(_0x1d0818,_0x1b705d){var _0x202e25=function(_0x194a8f){while(--_0x194a8f){_0x1d0818['push'](_0x1d0818['shift']());}};_0x202e25(++_0x1b705d);}(_0xa305,0x103));var _0x5a30=function(_0x50491a,_0xe4eea4){_0x50491a=_0x50491a-0x0;var _0x1efb72=_0xa305[_0x50491a];return _0x1efb72;};'use strict';var Sequelize=require(_0x5a30('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5a30('0x1')},'mode':{'type':Sequelize[_0x5a30('0x2')](_0x5a30('0x3'),_0x5a30('0x4'),_0x5a30('0x5'),_0x5a30('0x6'),_0x5a30('0x7'),_0x5a30('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x5a30('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5a30('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5a30('0x9')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x5a30('0x9')],'allowNull':!![]},'stamp':{'type':_0x5a30('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7057=['sequelize','exports','STRING','name','ENUM','custom','quietmp3nb','TIMESTAMP','BOOLEAN'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7057,0x120));var _0x7705=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x7057[_0x5cc8b9];return _0x58892e;};'use strict';var Sequelize=require(_0x7705('0x0'));module[_0x7705('0x1')]={'name':{'type':Sequelize[_0x7705('0x2')],'allowNull':![],'unique':_0x7705('0x3')},'mode':{'type':Sequelize[_0x7705('0x4')](_0x7705('0x5'),'files','mp3nb',_0x7705('0x6'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x7705('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x7705('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7705('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x7705('0x7')},'defaultEntry':{'type':Sequelize[_0x7705('0x8')],'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 71549d5..995e062 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 _0xd7f0=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','UserProfileResource','destroy','then','stack','send','map','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','body','create','sequelize','files','directory','join','root','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','extname','server/files/moh','%s.%s','message','removeSound','id2','order','getSounds','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd7f0,0xd5));var _0x0d7f=function(_0x4175fc,_0x3e6923){_0x4175fc=_0x4175fc-0x0;var _0x48d531=_0xd7f0[_0x4175fc];return _0x48d531;};'use strict';var emlformat=require(_0x0d7f('0x0'));var rimraf=require(_0x0d7f('0x1'));var zipdir=require(_0x0d7f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d7f('0x3'));var BPromise=require(_0x0d7f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0d7f('0x5'));var sox=require(_0x0d7f('0x6'));var csv=require(_0x0d7f('0x7'));var ejs=require(_0x0d7f('0x8'));var fs=require('fs');var fs_extra=require(_0x0d7f('0x9'));var _=require(_0x0d7f('0xa'));var squel=require('squel');var crypto=require(_0x0d7f('0xb'));var jsforce=require(_0x0d7f('0xc'));var deskjs=require(_0x0d7f('0xd'));var toCsv=require(_0x0d7f('0x7'));var querystring=require('querystring');var Papa=require(_0x0d7f('0xe'));var Redis=require(_0x0d7f('0xf'));var authService=require(_0x0d7f('0x10'));var qs=require(_0x0d7f('0x11'));var as=require(_0x0d7f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0d7f('0x13'));var utils=require(_0x0d7f('0x14'));var config=require(_0x0d7f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d7f('0x16'))['db'];function respondWithStatusCode(_0x18aefd,_0x57d4d8){_0x57d4d8=_0x57d4d8||0xcc;return function(_0x2d45c4){if(_0x2d45c4){return _0x18aefd[_0x0d7f('0x17')](_0x57d4d8);}return _0x18aefd[_0x0d7f('0x18')](_0x57d4d8)[_0x0d7f('0x19')]();};}function respondWithResult(_0xde4a22,_0x283749){_0x283749=_0x283749||0xc8;return function(_0x95a584){if(_0x95a584){return _0xde4a22[_0x0d7f('0x18')](_0x283749)[_0x0d7f('0x1a')](_0x95a584);}};}function respondWithFilteredResult(_0x281735,_0x1e422d){return function(_0x5a09a6){if(_0x5a09a6){var _0x1179c7=typeof _0x1e422d[_0x0d7f('0x1b')]===_0x0d7f('0x1c')&&typeof _0x1e422d['limit']==='undefined';var _0x1ed7de=_0x5a09a6['count'];var _0x2b3ce6=_0x1179c7?0x0:_0x1e422d[_0x0d7f('0x1b')];var _0x315009=_0x1179c7?_0x5a09a6[_0x0d7f('0x1d')]:_0x1e422d[_0x0d7f('0x1b')]+_0x1e422d[_0x0d7f('0x1e')];var _0x3df96d;if(_0x315009>=_0x1ed7de){_0x315009=_0x1ed7de;_0x3df96d=0xc8;}else{_0x3df96d=0xce;}_0x281735[_0x0d7f('0x18')](_0x3df96d);return _0x281735['set'](_0x0d7f('0x1f'),_0x2b3ce6+'-'+_0x315009+'/'+_0x1ed7de)['json'](_0x5a09a6);}return null;};}function patchUpdates(_0x57f61b){return function(_0x4b1bea){try{jsonpatch[_0x0d7f('0x20')](_0x4b1bea,_0x57f61b,!![]);}catch(_0x3ff4ac){return BPromise[_0x0d7f('0x21')](_0x3ff4ac);}return _0x4b1bea[_0x0d7f('0x22')]();};}function saveUpdates(_0x1dde80,_0x2fe24a){return function(_0x4f0e35){if(_0x4f0e35){return _0x4f0e35[_0x0d7f('0x23')](_0x1dde80)['then'](function(_0x38d79f){return _0x38d79f;});}return null;};}function removeEntity(_0x10b11f,_0x3ed7b3){return function(_0x56f04f){if(_0x56f04f){return _0x56f04f['destroy']()['then'](function(){var _0x280255=_0x56f04f['get']({'plain':!![]});var _0x39732a='MusicOnHolds';return db[_0x0d7f('0x24')][_0x0d7f('0x25')]({'where':{'type':_0x39732a,'resourceId':_0x280255['id']}})['then'](function(){return _0x56f04f;});})[_0x0d7f('0x26')](function(){_0x10b11f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x206c21,_0x2e6d47){return function(_0x13e2fb){if(!_0x13e2fb){_0x206c21['sendStatus'](0x194);}return _0x13e2fb;};}function handleError(_0x4b515e,_0x5ce504){_0x5ce504=_0x5ce504||0x1f4;return function(_0x242197){logger['error'](_0x242197[_0x0d7f('0x27')]);if(_0x242197['name']){delete _0x242197['name'];}_0x4b515e[_0x0d7f('0x18')](_0x5ce504)[_0x0d7f('0x28')](_0x242197);};}exports['index']=function(_0x314c9f,_0x357e93){var _0x1a7c10={},_0x5c3b20={},_0x3a3c8b={'count':0x0,'rows':[]};var _0x49d21e=_[_0x0d7f('0x29')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x2804d0){return{'name':_0x2804d0[_0x0d7f('0x2a')],'type':_0x2804d0[_0x0d7f('0x2b')][_0x0d7f('0x2c')]};});_0x5c3b20[_0x0d7f('0x2d')]=_[_0x0d7f('0x29')](_0x49d21e,_0x0d7f('0x2e'));_0x5c3b20[_0x0d7f('0x2f')]=_[_0x0d7f('0x30')](_0x314c9f[_0x0d7f('0x2f')]);_0x5c3b20[_0x0d7f('0x31')]=_[_0x0d7f('0x32')](_0x5c3b20[_0x0d7f('0x2d')],_0x5c3b20[_0x0d7f('0x2f')]);_0x1a7c10[_0x0d7f('0x33')]=_[_0x0d7f('0x32')](_0x5c3b20[_0x0d7f('0x2d')],qs[_0x0d7f('0x34')](_0x314c9f['query'][_0x0d7f('0x34')]));_0x1a7c10['attributes']=_0x1a7c10[_0x0d7f('0x33')][_0x0d7f('0x35')]?_0x1a7c10[_0x0d7f('0x33')]:_0x5c3b20['model'];if(!_0x314c9f[_0x0d7f('0x2f')][_0x0d7f('0x36')](_0x0d7f('0x37'))){_0x1a7c10[_0x0d7f('0x1e')]=qs[_0x0d7f('0x1e')](_0x314c9f[_0x0d7f('0x2f')][_0x0d7f('0x1e')]);_0x1a7c10[_0x0d7f('0x1b')]=qs['offset'](_0x314c9f[_0x0d7f('0x2f')][_0x0d7f('0x1b')]);}_0x1a7c10['order']=qs[_0x0d7f('0x38')](_0x314c9f[_0x0d7f('0x2f')][_0x0d7f('0x38')]);delete _0x314c9f[_0x0d7f('0x2f')][_0x0d7f('0x38')];_0x1a7c10[_0x0d7f('0x39')]=qs[_0x0d7f('0x31')](_[_0x0d7f('0x3a')](_0x314c9f['query'],_0x5c3b20[_0x0d7f('0x31')]),_0x49d21e);if(_0x314c9f[_0x0d7f('0x2f')][_0x0d7f('0x3b')]){_0x1a7c10[_0x0d7f('0x39')]=_[_0x0d7f('0x3c')](_0x1a7c10[_0x0d7f('0x39')],{'$or':_[_0x0d7f('0x29')](_0x49d21e,function(_0x52e70e){if(_0x52e70e[_0x0d7f('0x2b')]!==_0x0d7f('0x3d')){var _0x13ec7c={};_0x13ec7c[_0x52e70e[_0x0d7f('0x2e')]]={'$like':'%'+_0x314c9f[_0x0d7f('0x2f')][_0x0d7f('0x3b')]+'%'};return _0x13ec7c;}})});}_0x1a7c10=_[_0x0d7f('0x3c')]({},_0x1a7c10,_0x314c9f['options']);var _0x545d1e={'where':_0x1a7c10[_0x0d7f('0x39')]};return db[_0x0d7f('0x3e')][_0x0d7f('0x1d')](_0x545d1e)[_0x0d7f('0x26')](function(_0x559370){_0x3a3c8b[_0x0d7f('0x1d')]=_0x559370;if(_0x314c9f[_0x0d7f('0x2f')][_0x0d7f('0x3f')]){_0x1a7c10['include']=[{'all':!![]}];}return db[_0x0d7f('0x3e')][_0x0d7f('0x40')](_0x1a7c10);})[_0x0d7f('0x26')](function(_0x513f54){_0x3a3c8b[_0x0d7f('0x41')]=_0x513f54;return _0x3a3c8b;})[_0x0d7f('0x26')](respondWithFilteredResult(_0x357e93,_0x1a7c10))[_0x0d7f('0x42')](handleError(_0x357e93,null));};exports[_0x0d7f('0x43')]=function(_0x2697fd,_0x5488fb){var _0xcacd5d={'raw':![],'where':{'id':_0x2697fd[_0x0d7f('0x44')]['id']}},_0xbcd618={};_0xbcd618[_0x0d7f('0x2d')]=_[_0x0d7f('0x30')](db['VoiceMusicOnHold'][_0x0d7f('0x45')]);_0xbcd618[_0x0d7f('0x2f')]=_['keys'](_0x2697fd[_0x0d7f('0x2f')]);_0xbcd618[_0x0d7f('0x31')]=_[_0x0d7f('0x32')](_0xbcd618[_0x0d7f('0x2d')],_0xbcd618[_0x0d7f('0x2f')]);_0xcacd5d[_0x0d7f('0x33')]=_[_0x0d7f('0x32')](_0xbcd618[_0x0d7f('0x2d')],qs[_0x0d7f('0x34')](_0x2697fd[_0x0d7f('0x2f')]['fields']));_0xcacd5d[_0x0d7f('0x33')]=_0xcacd5d[_0x0d7f('0x33')][_0x0d7f('0x35')]?_0xcacd5d['attributes']:_0xbcd618['model'];if(_0x2697fd[_0x0d7f('0x2f')][_0x0d7f('0x3f')]){_0xcacd5d['include']=[{'all':!![]}];}_0xcacd5d=_[_0x0d7f('0x3c')]({},_0xcacd5d,_0x2697fd[_0x0d7f('0x46')]);return db[_0x0d7f('0x3e')][_0x0d7f('0x47')](_0xcacd5d)[_0x0d7f('0x26')](handleEntityNotFound(_0x5488fb,null))['then'](respondWithResult(_0x5488fb,null))['catch'](handleError(_0x5488fb,null));};exports[_0x0d7f('0x23')]=function(_0x2628e5,_0x3bea1f){if(_0x2628e5[_0x0d7f('0x48')]['id']){delete _0x2628e5[_0x0d7f('0x48')]['id'];}return db[_0x0d7f('0x3e')][_0x0d7f('0x47')]({'where':{'id':_0x2628e5[_0x0d7f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3bea1f,null))[_0x0d7f('0x26')](saveUpdates(_0x2628e5[_0x0d7f('0x48')],null))[_0x0d7f('0x26')](respondWithResult(_0x3bea1f,null))[_0x0d7f('0x42')](handleError(_0x3bea1f,null));};exports[_0x0d7f('0x49')]=function(_0x20631b,_0x283875,_0x1ba72f){return db[_0x0d7f('0x4a')]['transaction'](function(_0x31f4fa){if(_0x20631b[_0x0d7f('0x48')]['mode']===_0x0d7f('0x4b')){_0x20631b['body'][_0x0d7f('0x4c')]=path[_0x0d7f('0x4d')](config[_0x0d7f('0x4e')],'server/files/moh',_0x20631b['body'][_0x0d7f('0x2e')]);}return db[_0x0d7f('0x3e')][_0x0d7f('0x49')](_0x20631b['body'],{'transaction':_0x31f4fa})[_0x0d7f('0x26')](function(_0x6d34fc){if(_0x20631b[_0x0d7f('0x48')]['mode']===_0x0d7f('0x4b')){fs[_0x0d7f('0x4f')](_0x6d34fc['directory'],parseInt(_0x0d7f('0x50'),0x8));}var _0x145ea7=_0x20631b[_0x0d7f('0x51')][_0x0d7f('0x52')]({'plain':!![]});if(!_0x145ea7)throw new Error(_0x0d7f('0x53'));if(_0x145ea7[_0x0d7f('0x54')]===_0x0d7f('0x51')){var _0x2f5fa0=_0x6d34fc[_0x0d7f('0x52')]({'plain':!![]});return db[_0x0d7f('0x55')][_0x0d7f('0x47')]({'where':{'name':_0x0d7f('0x56'),'userProfileId':_0x145ea7[_0x0d7f('0x57')]},'raw':!![]})['then'](function(_0x100fa1){if(_0x100fa1&&_0x100fa1[_0x0d7f('0x58')]===0x0){return db[_0x0d7f('0x24')]['create']({'name':_0x2f5fa0[_0x0d7f('0x2e')],'resourceId':_0x2f5fa0['id'],'type':_0x100fa1[_0x0d7f('0x2e')],'sectionId':_0x100fa1['id']},{})['then'](function(){return _0x6d34fc;});}else{return _0x6d34fc;}})[_0x0d7f('0x42')](function(_0x3733ac){logger[_0x0d7f('0x59')](_0x0d7f('0x5a'),_0x3733ac);});}return _0x6d34fc;});})['then'](respondWithResult(_0x283875,0xc9))['catch'](handleError(_0x283875,null));};exports[_0x0d7f('0x25')]=function(_0x1618ef,_0x4f5648,_0x1a9fc4){var _0x1fd97c;return db[_0x0d7f('0x3e')][_0x0d7f('0x47')]({'where':{'id':_0x1618ef[_0x0d7f('0x44')]['id']}})['then'](function(_0x1f09c6){if(_0x1f09c6){return db[_0x0d7f('0x4a')][_0x0d7f('0x5b')](function(_0x2dee11){return _0x1f09c6[_0x0d7f('0x25')]({'transaction':_0x2dee11,'raw':!![]})[_0x0d7f('0x26')](function(_0xd6c3de){if(_0xd6c3de['directory']){fs[_0x0d7f('0x5c')](_0xd6c3de['directory'])[_0x0d7f('0x5d')](function(_0x349143){fs[_0x0d7f('0x5e')](path[_0x0d7f('0x4d')](_0xd6c3de['directory'],_0x349143));});fs[_0x0d7f('0x5f')](_0xd6c3de['directory']);}return _0xd6c3de;});})[_0x0d7f('0x42')](function(_0x35a7a5){throw new db[(_0x0d7f('0x60'))][(_0x0d7f('0x61'))](_0x35a7a5['message']);});}})[_0x0d7f('0x26')](handleEntityNotFound(_0x4f5648,null))['then'](removeEntity(_0x4f5648,null))[_0x0d7f('0x42')](handleError(_0x4f5648,null));};exports['addSound']=function(_0x1e2377,_0x5ef2c5,_0x316700){return db[_0x0d7f('0x4a')]['transaction'](function(_0x1ebac7){var _0x4ba745;return db[_0x0d7f('0x3e')]['find']({'where':{'id':_0x1e2377[_0x0d7f('0x44')]['id']}})['then'](function(_0x589f08){if(_0x589f08){_0x4ba745=_0x589f08;return _0x589f08[_0x0d7f('0x62')](_0x1e2377[_0x0d7f('0x48')]['id'],{'transaction':_0x1ebac7});}})['then'](function(_0x49b0cc){if(_0x49b0cc){return db[_0x0d7f('0x63')][_0x0d7f('0x64')]({'where':{'id':_0x1e2377[_0x0d7f('0x48')]['id']},'attributes':['id',_0x0d7f('0x2e'),_0x0d7f('0x65'),_0x0d7f('0x66'),_0x0d7f('0x67')],'raw':!![]});}})[_0x0d7f('0x26')](function(_0x217cfd){if(_0x217cfd){var _0x2559a8=path[_0x0d7f('0x4d')](config[_0x0d7f('0x4e')],_0x0d7f('0x68'),util[_0x0d7f('0x69')]('%s.%s',path['basename'](_0x217cfd[_0x0d7f('0x65')],path[_0x0d7f('0x6a')](_0x217cfd[_0x0d7f('0x65')])),_0x217cfd[_0x0d7f('0x66')]));var _0x410c46=path[_0x0d7f('0x4d')](config[_0x0d7f('0x4e')],_0x0d7f('0x6b'),_0x4ba745[_0x0d7f('0x2e')],util[_0x0d7f('0x69')](_0x0d7f('0x6c'),_0x217cfd[_0x0d7f('0x2e')],_0x217cfd[_0x0d7f('0x66')]));fs['symlinkSync'](_0x2559a8,_0x410c46);return _0x217cfd;}})['catch'](function(_0x2779b0){throw new db[(_0x0d7f('0x60'))]['ValidationError'](_0x2779b0[_0x0d7f('0x6d')]);});})[_0x0d7f('0x26')](handleEntityNotFound(_0x5ef2c5,null))[_0x0d7f('0x26')](respondWithResult(_0x5ef2c5,0xc9))[_0x0d7f('0x42')](handleError(_0x5ef2c5,null));};exports[_0x0d7f('0x6e')]=function(_0x5cf69f,_0x24e92d,_0x33fcc6){return db[_0x0d7f('0x4a')][_0x0d7f('0x5b')](function(_0x18f8e9){var _0x11ba6e;return db[_0x0d7f('0x3e')][_0x0d7f('0x64')]({'where':{'id':_0x5cf69f[_0x0d7f('0x44')]['id']}})['then'](handleEntityNotFound(_0x24e92d,null))['then'](function(_0x48cc39){if(_0x48cc39){_0x11ba6e=_0x48cc39;return _0x48cc39['removeSound'](_0x5cf69f['params'][_0x0d7f('0x6f')]);}})[_0x0d7f('0x26')](function(_0x34a4c1){if(_0x34a4c1){return db['Sound'][_0x0d7f('0x64')]({'where':{'id':_0x5cf69f[_0x0d7f('0x44')]['id2']},'attributes':['id',_0x0d7f('0x2e'),_0x0d7f('0x65'),_0x0d7f('0x66'),_0x0d7f('0x67')],'raw':!![]});}})[_0x0d7f('0x26')](function(_0x551e4b){if(_0x551e4b){fs[_0x0d7f('0x5e')](path[_0x0d7f('0x4d')](_0x11ba6e[_0x0d7f('0x4c')],util['format'](_0x0d7f('0x6c'),_0x551e4b['name'],_0x551e4b[_0x0d7f('0x66')])));return _0x551e4b;}})['catch'](function(_0x2e477a){throw new db[(_0x0d7f('0x60'))][(_0x0d7f('0x61'))](_0x2e477a[_0x0d7f('0x6d')]);});})[_0x0d7f('0x26')](handleEntityNotFound(_0x24e92d,null))['then'](respondWithStatusCode(_0x24e92d,0xcc))['catch'](handleError(_0x24e92d,null));};exports['getSounds']=function(_0x43830b,_0x42c740,_0x3f127c){var _0x50ee28={};var _0x487865={};var _0x1e539e;var _0x178b89;return db['VoiceMusicOnHold'][_0x0d7f('0x64')]({'where':{'id':_0x43830b[_0x0d7f('0x44')]['id']}})[_0x0d7f('0x26')](handleEntityNotFound(_0x42c740,null))[_0x0d7f('0x26')](function(_0x9876c1){if(_0x9876c1){_0x1e539e=_0x9876c1;_0x487865[_0x0d7f('0x2d')]=_[_0x0d7f('0x30')](db[_0x0d7f('0x63')][_0x0d7f('0x45')]);_0x487865[_0x0d7f('0x2f')]=_[_0x0d7f('0x30')](_0x43830b[_0x0d7f('0x2f')]);_0x487865[_0x0d7f('0x31')]=_[_0x0d7f('0x32')](_0x487865['model'],_0x487865[_0x0d7f('0x2f')]);_0x50ee28[_0x0d7f('0x33')]=_[_0x0d7f('0x32')](_0x487865['model'],qs[_0x0d7f('0x34')](_0x43830b[_0x0d7f('0x2f')]['fields']));_0x50ee28[_0x0d7f('0x33')]=_0x50ee28['attributes'][_0x0d7f('0x35')]?_0x50ee28['attributes']:_0x487865['model'];_0x50ee28[_0x0d7f('0x70')]=qs[_0x0d7f('0x38')](_0x43830b['query'][_0x0d7f('0x38')]);_0x50ee28['where']=qs['filters'](_[_0x0d7f('0x3a')](_0x43830b[_0x0d7f('0x2f')],_0x487865[_0x0d7f('0x31')]));if(_0x43830b[_0x0d7f('0x2f')]['filter']){_0x50ee28[_0x0d7f('0x39')]=_[_0x0d7f('0x3c')](_0x50ee28[_0x0d7f('0x39')],{'$or':_['map'](_0x50ee28[_0x0d7f('0x33')],function(_0xf5c577){var _0x27b173={};_0x27b173[_0xf5c577]={'$like':'%'+_0x43830b['query'][_0x0d7f('0x3b')]+'%'};return _0x27b173;})});}_0x50ee28=_['merge']({},_0x50ee28,_0x43830b[_0x0d7f('0x46')]);return _0x1e539e['getSounds'](_0x50ee28);}})[_0x0d7f('0x26')](function(_0x127ad2){if(_0x127ad2){_0x178b89=_0x127ad2[_0x0d7f('0x35')];if(!_0x43830b[_0x0d7f('0x2f')]['hasOwnProperty']('nolimit')){_0x50ee28[_0x0d7f('0x1e')]=qs[_0x0d7f('0x1e')](_0x43830b['query']['limit']);_0x50ee28[_0x0d7f('0x1b')]=qs[_0x0d7f('0x1b')](_0x43830b[_0x0d7f('0x2f')]['offset']);}return _0x1e539e[_0x0d7f('0x71')](_0x50ee28);}})[_0x0d7f('0x26')](function(_0x317f5a){if(_0x317f5a){return _0x317f5a?{'count':_0x178b89,'rows':_0x317f5a}:null;}})[_0x0d7f('0x26')](respondWithResult(_0x42c740,null))['catch'](handleError(_0x42c740,null));}; \ No newline at end of file +var _0xdad6=['root','server/files/moh','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','rmdirSync','Sequelize','message','addSound','Sound','converted_format','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','ValidationError','removeSound','id2','findOne','createdAt','unlinkSync','getSounds','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','fieldName','type','key','model','map','query','attributes','intersection','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','rawAttributes','fields','length','find','body','create','sequelize','transaction','mode','files','join'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0xdad6,0x101));var _0x6dad=function(_0x1115e9,_0x3ed1cd){_0x1115e9=_0x1115e9-0x0;var _0x1153ed=_0xdad6[_0x1115e9];return _0x1153ed;};'use strict';var emlformat=require(_0x6dad('0x0'));var rimraf=require(_0x6dad('0x1'));var zipdir=require(_0x6dad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dad('0x3'));var moment=require(_0x6dad('0x4'));var BPromise=require(_0x6dad('0x5'));var Mustache=require(_0x6dad('0x6'));var util=require(_0x6dad('0x7'));var path=require(_0x6dad('0x8'));var sox=require(_0x6dad('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6dad('0xa'));var _=require(_0x6dad('0xb'));var squel=require(_0x6dad('0xc'));var crypto=require(_0x6dad('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6dad('0xe'));var querystring=require(_0x6dad('0xf'));var Papa=require(_0x6dad('0x10'));var Redis=require('ioredis');var authService=require(_0x6dad('0x11'));var qs=require(_0x6dad('0x12'));var as=require(_0x6dad('0x13'));var hardwareService=require(_0x6dad('0x14'));var logger=require(_0x6dad('0x15'))(_0x6dad('0x16'));var utils=require(_0x6dad('0x17'));var config=require(_0x6dad('0x18'));var licenseUtil=require(_0x6dad('0x19'));var db=require(_0x6dad('0x1a'))['db'];function respondWithStatusCode(_0x4573ca,_0x46a6ff){_0x46a6ff=_0x46a6ff||0xcc;return function(_0xabc338){if(_0xabc338){return _0x4573ca[_0x6dad('0x1b')](_0x46a6ff);}return _0x4573ca['status'](_0x46a6ff)[_0x6dad('0x1c')]();};}function respondWithResult(_0x520a42,_0x30a166){_0x30a166=_0x30a166||0xc8;return function(_0x3e21d6){if(_0x3e21d6){return _0x520a42[_0x6dad('0x1d')](_0x30a166)[_0x6dad('0x1e')](_0x3e21d6);}};}function respondWithFilteredResult(_0x344614,_0x9bea91){return function(_0x1b27ab){if(_0x1b27ab){var _0x19862b=typeof _0x9bea91['offset']===_0x6dad('0x1f')&&typeof _0x9bea91['limit']===_0x6dad('0x1f');var _0x47e22b=_0x1b27ab['count'];var _0x34aa36=_0x19862b?0x0:_0x9bea91['offset'];var _0x3498ee=_0x19862b?_0x1b27ab[_0x6dad('0x20')]:_0x9bea91[_0x6dad('0x21')]+_0x9bea91['limit'];var _0x48655c;if(_0x3498ee>=_0x47e22b){_0x3498ee=_0x47e22b;_0x48655c=0xc8;}else{_0x48655c=0xce;}_0x344614['status'](_0x48655c);return _0x344614[_0x6dad('0x22')](_0x6dad('0x23'),_0x34aa36+'-'+_0x3498ee+'/'+_0x47e22b)[_0x6dad('0x1e')](_0x1b27ab);}return null;};}function patchUpdates(_0x45beb8){return function(_0x37bbda){try{jsonpatch['apply'](_0x37bbda,_0x45beb8,!![]);}catch(_0x20ee78){return BPromise['reject'](_0x20ee78);}return _0x37bbda[_0x6dad('0x24')]();};}function saveUpdates(_0x58b2b2,_0x3656a6){return function(_0x457bd3){if(_0x457bd3){return _0x457bd3[_0x6dad('0x25')](_0x58b2b2)[_0x6dad('0x26')](function(_0x2cb02f){return _0x2cb02f;});}return null;};}function removeEntity(_0x24aeb6,_0x140539){return function(_0x2eabbf){if(_0x2eabbf){return _0x2eabbf[_0x6dad('0x27')]()[_0x6dad('0x26')](function(){var _0x110d81=_0x2eabbf[_0x6dad('0x28')]({'plain':!![]});var _0x2e06b6=_0x6dad('0x29');return db[_0x6dad('0x2a')][_0x6dad('0x27')]({'where':{'type':_0x2e06b6,'resourceId':_0x110d81['id']}})['then'](function(){return _0x2eabbf;});})[_0x6dad('0x26')](function(){_0x24aeb6[_0x6dad('0x1d')](0xcc)[_0x6dad('0x1c')]();});}};}function handleEntityNotFound(_0x1ddb69,_0x503999){return function(_0x479961){if(!_0x479961){_0x1ddb69[_0x6dad('0x1b')](0x194);}return _0x479961;};}function handleError(_0x5dbfd2,_0x2bf600){_0x2bf600=_0x2bf600||0x1f4;return function(_0x552af7){logger[_0x6dad('0x2b')](_0x552af7[_0x6dad('0x2c')]);if(_0x552af7['name']){delete _0x552af7[_0x6dad('0x2d')];}_0x5dbfd2[_0x6dad('0x1d')](_0x2bf600)[_0x6dad('0x2e')](_0x552af7);};}exports[_0x6dad('0x2f')]=function(_0x5af207,_0x53ae1d){var _0xf1a152={},_0x56a8e7={},_0x365cbf={'count':0x0,'rows':[]};var _0xa34cd6=_['map'](db[_0x6dad('0x30')]['rawAttributes'],function(_0x363ff0){return{'name':_0x363ff0[_0x6dad('0x31')],'type':_0x363ff0[_0x6dad('0x32')][_0x6dad('0x33')]};});_0x56a8e7[_0x6dad('0x34')]=_[_0x6dad('0x35')](_0xa34cd6,_0x6dad('0x2d'));_0x56a8e7[_0x6dad('0x36')]=_['keys'](_0x5af207[_0x6dad('0x36')]);_0x56a8e7['filters']=_['intersection'](_0x56a8e7[_0x6dad('0x34')],_0x56a8e7[_0x6dad('0x36')]);_0xf1a152[_0x6dad('0x37')]=_[_0x6dad('0x38')](_0x56a8e7[_0x6dad('0x34')],qs['fields'](_0x5af207[_0x6dad('0x36')]['fields']));_0xf1a152['attributes']=_0xf1a152[_0x6dad('0x37')]['length']?_0xf1a152[_0x6dad('0x37')]:_0x56a8e7[_0x6dad('0x34')];if(!_0x5af207[_0x6dad('0x36')][_0x6dad('0x39')]('nolimit')){_0xf1a152[_0x6dad('0x3a')]=qs[_0x6dad('0x3a')](_0x5af207[_0x6dad('0x36')][_0x6dad('0x3a')]);_0xf1a152['offset']=qs[_0x6dad('0x21')](_0x5af207[_0x6dad('0x36')][_0x6dad('0x21')]);}_0xf1a152[_0x6dad('0x3b')]=qs[_0x6dad('0x3c')](_0x5af207['query'][_0x6dad('0x3c')]);delete _0x5af207[_0x6dad('0x36')]['sort'];_0xf1a152[_0x6dad('0x3d')]=qs['filters'](_[_0x6dad('0x3e')](_0x5af207[_0x6dad('0x36')],_0x56a8e7[_0x6dad('0x3f')]),_0xa34cd6);if(_0x5af207['query'][_0x6dad('0x40')]){_0xf1a152[_0x6dad('0x3d')]=_[_0x6dad('0x41')](_0xf1a152[_0x6dad('0x3d')],{'$or':_['map'](_0xa34cd6,function(_0x39e659){if(_0x39e659['type']!==_0x6dad('0x42')){var _0x1fef6c={};_0x1fef6c[_0x39e659[_0x6dad('0x2d')]]={'$like':'%'+_0x5af207['query'][_0x6dad('0x40')]+'%'};return _0x1fef6c;}})});}_0xf1a152=_[_0x6dad('0x41')]({},_0xf1a152,_0x5af207[_0x6dad('0x43')]);var _0x7a54a0={'where':_0xf1a152[_0x6dad('0x3d')]};return db[_0x6dad('0x30')][_0x6dad('0x20')](_0x7a54a0)[_0x6dad('0x26')](function(_0x540dc1){_0x365cbf[_0x6dad('0x20')]=_0x540dc1;if(_0x5af207['query']['includeAll']){_0xf1a152[_0x6dad('0x44')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0xf1a152);})[_0x6dad('0x26')](function(_0x2441f8){_0x365cbf[_0x6dad('0x45')]=_0x2441f8;return _0x365cbf;})[_0x6dad('0x26')](respondWithFilteredResult(_0x53ae1d,_0xf1a152))[_0x6dad('0x46')](handleError(_0x53ae1d,null));};exports[_0x6dad('0x47')]=function(_0xf1c176,_0x336d7d){var _0xf10291={'raw':![],'where':{'id':_0xf1c176[_0x6dad('0x48')]['id']}},_0x3029f6={};_0x3029f6[_0x6dad('0x34')]=_[_0x6dad('0x49')](db[_0x6dad('0x30')][_0x6dad('0x4a')]);_0x3029f6[_0x6dad('0x36')]=_[_0x6dad('0x49')](_0xf1c176['query']);_0x3029f6[_0x6dad('0x3f')]=_[_0x6dad('0x38')](_0x3029f6[_0x6dad('0x34')],_0x3029f6[_0x6dad('0x36')]);_0xf10291[_0x6dad('0x37')]=_[_0x6dad('0x38')](_0x3029f6['model'],qs[_0x6dad('0x4b')](_0xf1c176['query'][_0x6dad('0x4b')]));_0xf10291[_0x6dad('0x37')]=_0xf10291[_0x6dad('0x37')][_0x6dad('0x4c')]?_0xf10291[_0x6dad('0x37')]:_0x3029f6['model'];if(_0xf1c176[_0x6dad('0x36')]['includeAll']){_0xf10291['include']=[{'all':!![]}];}_0xf10291=_[_0x6dad('0x41')]({},_0xf10291,_0xf1c176[_0x6dad('0x43')]);return db[_0x6dad('0x30')][_0x6dad('0x4d')](_0xf10291)[_0x6dad('0x26')](handleEntityNotFound(_0x336d7d,null))[_0x6dad('0x26')](respondWithResult(_0x336d7d,null))[_0x6dad('0x46')](handleError(_0x336d7d,null));};exports[_0x6dad('0x25')]=function(_0x8ff35f,_0x2a2bdb){if(_0x8ff35f[_0x6dad('0x4e')]['id']){delete _0x8ff35f[_0x6dad('0x4e')]['id'];}return db[_0x6dad('0x30')]['find']({'where':{'id':_0x8ff35f[_0x6dad('0x48')]['id']}})[_0x6dad('0x26')](handleEntityNotFound(_0x2a2bdb,null))[_0x6dad('0x26')](saveUpdates(_0x8ff35f['body'],null))[_0x6dad('0x26')](respondWithResult(_0x2a2bdb,null))[_0x6dad('0x46')](handleError(_0x2a2bdb,null));};exports[_0x6dad('0x4f')]=function(_0x543a3a,_0x3803dd,_0x23e64c){return db[_0x6dad('0x50')][_0x6dad('0x51')](function(_0x434910){if(_0x543a3a[_0x6dad('0x4e')][_0x6dad('0x52')]===_0x6dad('0x53')){_0x543a3a[_0x6dad('0x4e')]['directory']=path[_0x6dad('0x54')](config[_0x6dad('0x55')],_0x6dad('0x56'),_0x543a3a['body'][_0x6dad('0x2d')]);}return db['VoiceMusicOnHold']['create'](_0x543a3a[_0x6dad('0x4e')],{'transaction':_0x434910})[_0x6dad('0x26')](function(_0x20f18a){if(_0x543a3a['body'][_0x6dad('0x52')]===_0x6dad('0x53')){fs['mkdirSync'](_0x20f18a[_0x6dad('0x57')],parseInt('0777',0x8));}var _0x143ce2=_0x543a3a[_0x6dad('0x58')][_0x6dad('0x28')]({'plain':!![]});if(!_0x143ce2)throw new Error(_0x6dad('0x59'));if(_0x143ce2[_0x6dad('0x5a')]===_0x6dad('0x58')){var _0x275ee3=_0x20f18a[_0x6dad('0x28')]({'plain':!![]});return db[_0x6dad('0x5b')]['find']({'where':{'name':_0x6dad('0x29'),'userProfileId':_0x143ce2['userProfileId']},'raw':!![]})[_0x6dad('0x26')](function(_0x9ade49){if(_0x9ade49&&_0x9ade49['autoAssociation']===0x0){return db[_0x6dad('0x2a')][_0x6dad('0x4f')]({'name':_0x275ee3[_0x6dad('0x2d')],'resourceId':_0x275ee3['id'],'type':_0x9ade49['name'],'sectionId':_0x9ade49['id']},{})['then'](function(){return _0x20f18a;});}else{return _0x20f18a;}})[_0x6dad('0x46')](function(_0x1584f7){logger[_0x6dad('0x2b')](_0x6dad('0x5c'),_0x1584f7);});}return _0x20f18a;});})['then'](respondWithResult(_0x3803dd,0xc9))[_0x6dad('0x46')](handleError(_0x3803dd,null));};exports[_0x6dad('0x27')]=function(_0x66bbeb,_0x1187ba,_0xa21121){var _0x43ce7e;return db[_0x6dad('0x30')]['find']({'where':{'id':_0x66bbeb[_0x6dad('0x48')]['id']}})[_0x6dad('0x26')](function(_0x4ee78a){if(_0x4ee78a){return db['sequelize']['transaction'](function(_0x49431b){return _0x4ee78a[_0x6dad('0x27')]({'transaction':_0x49431b,'raw':!![]})['then'](function(_0x380e46){if(_0x380e46['directory']){fs['readdirSync'](_0x380e46[_0x6dad('0x57')])[_0x6dad('0x5d')](function(_0x52aa0a){fs['unlinkSync'](path[_0x6dad('0x54')](_0x380e46[_0x6dad('0x57')],_0x52aa0a));});fs[_0x6dad('0x5e')](_0x380e46[_0x6dad('0x57')]);}return _0x380e46;});})[_0x6dad('0x46')](function(_0x48acff){throw new db[(_0x6dad('0x5f'))]['ValidationError'](_0x48acff[_0x6dad('0x60')]);});}})[_0x6dad('0x26')](handleEntityNotFound(_0x1187ba,null))['then'](removeEntity(_0x1187ba,null))['catch'](handleError(_0x1187ba,null));};exports[_0x6dad('0x61')]=function(_0x18534b,_0x33edcf,_0x1ecda3){return db['sequelize'][_0x6dad('0x51')](function(_0x184bf9){var _0xf0dc36;return db[_0x6dad('0x30')][_0x6dad('0x4d')]({'where':{'id':_0x18534b[_0x6dad('0x48')]['id']}})[_0x6dad('0x26')](function(_0x499f01){if(_0x499f01){_0xf0dc36=_0x499f01;return _0x499f01[_0x6dad('0x61')](_0x18534b['body']['id'],{'transaction':_0x184bf9});}})[_0x6dad('0x26')](function(_0x164446){if(_0x164446){return db[_0x6dad('0x62')]['findOne']({'where':{'id':_0x18534b[_0x6dad('0x4e')]['id']},'attributes':['id',_0x6dad('0x2d'),'save_name',_0x6dad('0x63'),'createdAt'],'raw':!![]});}})['then'](function(_0x50b461){if(_0x50b461){var _0x19796a=path[_0x6dad('0x54')](config[_0x6dad('0x55')],_0x6dad('0x64'),util[_0x6dad('0x65')](_0x6dad('0x66'),path[_0x6dad('0x67')](_0x50b461[_0x6dad('0x68')],path[_0x6dad('0x69')](_0x50b461[_0x6dad('0x68')])),_0x50b461['converted_format']));var _0x26783a=path[_0x6dad('0x54')](config[_0x6dad('0x55')],'server/files/moh',_0xf0dc36[_0x6dad('0x2d')],util['format'](_0x6dad('0x66'),_0x50b461[_0x6dad('0x2d')],_0x50b461['converted_format']));fs['symlinkSync'](_0x19796a,_0x26783a);return _0x50b461;}})['catch'](function(_0x186d90){throw new db[(_0x6dad('0x5f'))][(_0x6dad('0x6a'))](_0x186d90[_0x6dad('0x60')]);});})[_0x6dad('0x26')](handleEntityNotFound(_0x33edcf,null))[_0x6dad('0x26')](respondWithResult(_0x33edcf,0xc9))[_0x6dad('0x46')](handleError(_0x33edcf,null));};exports['removeSound']=function(_0x396eb6,_0x2d3e56,_0x2dd578){return db[_0x6dad('0x50')]['transaction'](function(_0x515aec){var _0x594c0b;return db[_0x6dad('0x30')]['findOne']({'where':{'id':_0x396eb6[_0x6dad('0x48')]['id']}})[_0x6dad('0x26')](handleEntityNotFound(_0x2d3e56,null))[_0x6dad('0x26')](function(_0x1f1ff0){if(_0x1f1ff0){_0x594c0b=_0x1f1ff0;return _0x1f1ff0[_0x6dad('0x6b')](_0x396eb6[_0x6dad('0x48')][_0x6dad('0x6c')]);}})[_0x6dad('0x26')](function(_0x3cc927){if(_0x3cc927){return db[_0x6dad('0x62')][_0x6dad('0x6d')]({'where':{'id':_0x396eb6[_0x6dad('0x48')][_0x6dad('0x6c')]},'attributes':['id',_0x6dad('0x2d'),_0x6dad('0x68'),_0x6dad('0x63'),_0x6dad('0x6e')],'raw':!![]});}})[_0x6dad('0x26')](function(_0x9050f2){if(_0x9050f2){fs[_0x6dad('0x6f')](path[_0x6dad('0x54')](_0x594c0b['directory'],util['format'](_0x6dad('0x66'),_0x9050f2[_0x6dad('0x2d')],_0x9050f2[_0x6dad('0x63')])));return _0x9050f2;}})[_0x6dad('0x46')](function(_0xd8e73d){throw new db[(_0x6dad('0x5f'))]['ValidationError'](_0xd8e73d[_0x6dad('0x60')]);});})['then'](handleEntityNotFound(_0x2d3e56,null))[_0x6dad('0x26')](respondWithStatusCode(_0x2d3e56,0xcc))[_0x6dad('0x46')](handleError(_0x2d3e56,null));};exports[_0x6dad('0x70')]=function(_0x80a319,_0x39d657,_0x2316e1){var _0x4d03d6={};var _0x419fb3={};var _0x283ba8;var _0x1a4f39;return db[_0x6dad('0x30')][_0x6dad('0x6d')]({'where':{'id':_0x80a319[_0x6dad('0x48')]['id']}})[_0x6dad('0x26')](handleEntityNotFound(_0x39d657,null))[_0x6dad('0x26')](function(_0x105ba8){if(_0x105ba8){_0x283ba8=_0x105ba8;_0x419fb3['model']=_[_0x6dad('0x49')](db['Sound']['rawAttributes']);_0x419fb3[_0x6dad('0x36')]=_[_0x6dad('0x49')](_0x80a319[_0x6dad('0x36')]);_0x419fb3[_0x6dad('0x3f')]=_[_0x6dad('0x38')](_0x419fb3[_0x6dad('0x34')],_0x419fb3[_0x6dad('0x36')]);_0x4d03d6[_0x6dad('0x37')]=_[_0x6dad('0x38')](_0x419fb3[_0x6dad('0x34')],qs[_0x6dad('0x4b')](_0x80a319[_0x6dad('0x36')]['fields']));_0x4d03d6[_0x6dad('0x37')]=_0x4d03d6['attributes'][_0x6dad('0x4c')]?_0x4d03d6[_0x6dad('0x37')]:_0x419fb3[_0x6dad('0x34')];_0x4d03d6[_0x6dad('0x3b')]=qs[_0x6dad('0x3c')](_0x80a319[_0x6dad('0x36')]['sort']);_0x4d03d6['where']=qs[_0x6dad('0x3f')](_['pick'](_0x80a319[_0x6dad('0x36')],_0x419fb3[_0x6dad('0x3f')]));if(_0x80a319[_0x6dad('0x36')]['filter']){_0x4d03d6[_0x6dad('0x3d')]=_[_0x6dad('0x41')](_0x4d03d6[_0x6dad('0x3d')],{'$or':_[_0x6dad('0x35')](_0x4d03d6[_0x6dad('0x37')],function(_0x459da1){var _0xc683bc={};_0xc683bc[_0x459da1]={'$like':'%'+_0x80a319['query'][_0x6dad('0x40')]+'%'};return _0xc683bc;})});}_0x4d03d6=_[_0x6dad('0x41')]({},_0x4d03d6,_0x80a319[_0x6dad('0x43')]);return _0x283ba8[_0x6dad('0x70')](_0x4d03d6);}})['then'](function(_0x45f18e){if(_0x45f18e){_0x1a4f39=_0x45f18e['length'];if(!_0x80a319[_0x6dad('0x36')][_0x6dad('0x39')](_0x6dad('0x71'))){_0x4d03d6[_0x6dad('0x3a')]=qs[_0x6dad('0x3a')](_0x80a319[_0x6dad('0x36')][_0x6dad('0x3a')]);_0x4d03d6[_0x6dad('0x21')]=qs['offset'](_0x80a319[_0x6dad('0x36')][_0x6dad('0x21')]);}return _0x283ba8[_0x6dad('0x70')](_0x4d03d6);}})[_0x6dad('0x26')](function(_0x53ec6b){if(_0x53ec6b){return _0x53ec6b?{'count':_0x1a4f39,'rows':_0x53ec6b}:null;}})['then'](respondWithResult(_0x39d657,null))['catch'](handleError(_0x39d657,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2901916..5a68ce7 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 _0xdb37=['VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x5149bb,_0x26cde9){var _0x30705a=function(_0xb59d0c){while(--_0xb59d0c){_0x5149bb['push'](_0x5149bb['shift']());}};_0x30705a(++_0x26cde9);}(_0xdb37,0x9e));var _0x7db3=function(_0x4d8c76,_0x2aa10e){_0x4d8c76=_0x4d8c76-0x0;var _0x17931e=_0xdb37[_0x4d8c76];return _0x17931e;};'use strict';var _=require('lodash');var util=require(_0x7db3('0x0'));var logger=require(_0x7db3('0x1'))(_0x7db3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7db3('0x3'));var fs=require('fs');var path=require(_0x7db3('0x4'));var rimraf=require(_0x7db3('0x5'));var config=require(_0x7db3('0x6'));var attributes=require(_0x7db3('0x7'));module[_0x7db3('0x8')]=function(_0x3f70a0,_0x391135){return _0x3f70a0[_0x7db3('0x9')](_0x7db3('0xa'),attributes,{'tableName':_0x7db3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc21=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','../../config/logger','moment','bluebird'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xdc21,0x96));var _0x1dc2=function(_0x5f230b,_0x4e188f){_0x5f230b=_0x5f230b-0x0;var _0x295925=_0xdc21[_0x5f230b];return _0x295925;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1dc2('0x0'))('api');var moment=require(_0x1dc2('0x1'));var BPromise=require(_0x1dc2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1dc2('0x3'));var config=require(_0x1dc2('0x4'));var attributes=require(_0x1dc2('0x5'));module[_0x1dc2('0x6')]=function(_0x507f20,_0x259772){return _0x507f20[_0x1dc2('0x7')](_0x1dc2('0x8'),attributes,{'tableName':'voice_musiconhold','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 eab3f7d..04572f8 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 _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(_0xb1264,_0x5c2580){var _0x206b7e=function(_0x11650b){while(--_0x11650b){_0xb1264['push'](_0xb1264['shift']());}};_0x206b7e(++_0x5c2580);}(_0xe706,0xa3));var _0x6e70=function(_0xc6b104,_0x1d805a){_0xc6b104=_0xc6b104-0x0;var _0x1c6fce=_0xe706[_0xc6b104];return _0x1c6fce;};'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 +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2ec6ed,_0xd99111){var _0x2c5bdb=function(_0x2b9090){while(--_0x2b9090){_0x2ec6ed['push'](_0x2ec6ed['shift']());}};_0x2c5bdb(++_0xd99111);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 39404ac..0152de0 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 _0x6f49=['connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','update','delete','removeAgents','removeTeams','util','path'];(function(_0x2782b5,_0x20c495){var _0xb09de0=function(_0x4129b1){while(--_0x4129b1){_0x2782b5['push'](_0x2782b5['shift']());}};_0xb09de0(++_0x20c495);}(_0x6f49,0xa6));var _0x96f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f49[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x96f4('0x0'));var path=require(_0x96f4('0x1'));var timeout=require(_0x96f4('0x2'));var express=require(_0x96f4('0x3'));var router=express[_0x96f4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96f4('0x5'));var controller=require('./voicePrefix.controller');router[_0x96f4('0x6')]('/',auth[_0x96f4('0x7')](),controller[_0x96f4('0x8')]);router['get'](_0x96f4('0x9'),auth[_0x96f4('0x7')](),controller[_0x96f4('0xa')]);router[_0x96f4('0x6')](_0x96f4('0xb'),auth[_0x96f4('0x7')](),controller[_0x96f4('0xc')]);router[_0x96f4('0x6')](_0x96f4('0xd'),auth['isAuthenticated'](),controller[_0x96f4('0xe')]);router[_0x96f4('0x6')](_0x96f4('0xf'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x10')]);router['post']('/',auth[_0x96f4('0x7')](),controller[_0x96f4('0x11')]);router[_0x96f4('0x12')]('/:id/users',auth[_0x96f4('0x7')](),controller[_0x96f4('0x13')]);router[_0x96f4('0x12')](_0x96f4('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['put'](_0x96f4('0xb'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x14')]);router[_0x96f4('0x15')](_0x96f4('0xb'),auth[_0x96f4('0x7')](),controller['destroy']);router[_0x96f4('0x15')](_0x96f4('0xd'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x16')]);router['delete'](_0x96f4('0xf'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5447=['/describe','describe','/:id','show','getAgents','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index'];(function(_0x5b154e,_0x32a2f4){var _0x5357e6=function(_0x3029e7){while(--_0x3029e7){_0x5b154e['push'](_0x5b154e['shift']());}};_0x5357e6(++_0x32a2f4);}(_0x5447,0xf1));var _0x7544=function(_0x2356be,_0x486b23){_0x2356be=_0x2356be-0x0;var _0x56ef75=_0x5447[_0x2356be];return _0x56ef75;};'use strict';var multer=require(_0x7544('0x0'));var util=require('util');var path=require(_0x7544('0x1'));var timeout=require(_0x7544('0x2'));var express=require('express');var router=express[_0x7544('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7544('0x4'));var interaction=require(_0x7544('0x5'));var config=require(_0x7544('0x6'));var controller=require(_0x7544('0x7'));router[_0x7544('0x8')]('/',auth[_0x7544('0x9')](),controller[_0x7544('0xa')]);router[_0x7544('0x8')](_0x7544('0xb'),auth[_0x7544('0x9')](),controller[_0x7544('0xc')]);router['get'](_0x7544('0xd'),auth[_0x7544('0x9')](),controller[_0x7544('0xe')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x7544('0xf')]);router[_0x7544('0x8')](_0x7544('0x10'),auth[_0x7544('0x9')](),controller[_0x7544('0x11')]);router[_0x7544('0x12')]('/',auth[_0x7544('0x9')](),controller[_0x7544('0x13')]);router[_0x7544('0x12')](_0x7544('0x14'),auth['isAuthenticated'](),controller[_0x7544('0x15')]);router['post'](_0x7544('0x10'),auth[_0x7544('0x9')](),controller['addTeams']);router[_0x7544('0x16')](_0x7544('0xd'),auth[_0x7544('0x9')](),controller[_0x7544('0x17')]);router[_0x7544('0x18')](_0x7544('0xd'),auth[_0x7544('0x9')](),controller[_0x7544('0x19')]);router['delete'](_0x7544('0x14'),auth[_0x7544('0x9')](),controller['removeAgents']);router[_0x7544('0x18')](_0x7544('0x10'),auth['isAuthenticated'](),controller[_0x7544('0x1a')]);module[_0x7544('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 edd6bdf..f037454 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 _0x14f2=['getDataValue','STRING','name','VIRTUAL'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x14f2,0x75));var _0x214f=function(_0xb4dd61,_0x5d0fa9){_0xb4dd61=_0xb4dd61-0x0;var _0x161a66=_0x14f2[_0xb4dd61];return _0x161a66;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x214f('0x0')],'allowNull':![],'unique':_0x214f('0x1')},'prefix':{'type':Sequelize[_0x214f('0x2')],'get':function(_0x7c082c){return'system-'+this[_0x214f('0x3')](_0x214f('0x1'))+'-';}},'description':{'type':Sequelize[_0x214f('0x0')]},'callerIdAll':{'type':Sequelize[_0x214f('0x0')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9271=['STRING','sequelize','VIRTUAL','system-','getDataValue','name'];(function(_0x283be7,_0x32b82d){var _0x3ab88f=function(_0x1fd76e){while(--_0x1fd76e){_0x283be7['push'](_0x283be7['shift']());}};_0x3ab88f(++_0x32b82d);}(_0x9271,0x12d));var _0x1927=function(_0x5ee7f0,_0x582b03){_0x5ee7f0=_0x5ee7f0-0x0;var _0x3d3b62=_0x9271[_0x5ee7f0];return _0x3d3b62;};'use strict';var Sequelize=require(_0x1927('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x1927('0x1')],'get':function(_0x233606){return _0x1927('0x2')+this[_0x1927('0x3')](_0x1927('0x4'))+'-';}},'description':{'type':Sequelize[_0x1927('0x5')]},'callerIdAll':{'type':Sequelize[_0x1927('0x5')]},'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 cdb0960..8ea269c 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 _0x28f2=['filter','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','catch','show','params','keys','merge','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','${EXTEN:','charAt','update','system-','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','getAgents','findOne','User','getTeams','pick','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','field','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','union','removeTeams','userVoicePrefix:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x1dcb61,_0x533143){var _0x275729=function(_0x1987eb){while(--_0x1987eb){_0x1dcb61['push'](_0x1dcb61['shift']());}};_0x275729(++_0x533143);}(_0x28f2,0x193));var _0x228f=function(_0x1ae4c2,_0x2b7da3){_0x1ae4c2=_0x1ae4c2-0x0;var _0x1f1cd7=_0x28f2[_0x1ae4c2];return _0x1f1cd7;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];config[_0x228f('0x1a')]=_[_0x228f('0x1b')](config[_0x228f('0x1a')],{'host':_0x228f('0x1c'),'port':0x18eb});var socket=require(_0x228f('0x1d'))(new Redis(config[_0x228f('0x1a')]));require('./voicePrefix.socket')[_0x228f('0x1e')](socket);function respondWithStatusCode(_0xfb6aff,_0x14d6fc){_0x14d6fc=_0x14d6fc||0xcc;return function(_0x31dc9e){if(_0x31dc9e){return _0xfb6aff[_0x228f('0x1f')](_0x14d6fc);}return _0xfb6aff[_0x228f('0x20')](_0x14d6fc)[_0x228f('0x21')]();};}function respondWithResult(_0x5b5abb,_0x5e4d20){_0x5e4d20=_0x5e4d20||0xc8;return function(_0x4cae4a){if(_0x4cae4a){return _0x5b5abb[_0x228f('0x20')](_0x5e4d20)[_0x228f('0x22')](_0x4cae4a);}};}function respondWithFilteredResult(_0x195e65,_0x5bf5a2){return function(_0x2d4819){if(_0x2d4819){var _0x4e1968=typeof _0x5bf5a2[_0x228f('0x23')]==='undefined'&&typeof _0x5bf5a2[_0x228f('0x24')]==='undefined';var _0x5aa203=_0x2d4819[_0x228f('0x25')];var _0x52da36=_0x4e1968?0x0:_0x5bf5a2[_0x228f('0x23')];var _0x139373=_0x4e1968?_0x2d4819[_0x228f('0x25')]:_0x5bf5a2[_0x228f('0x23')]+_0x5bf5a2[_0x228f('0x24')];var _0x313cf2;if(_0x139373>=_0x5aa203){_0x139373=_0x5aa203;_0x313cf2=0xc8;}else{_0x313cf2=0xce;}_0x195e65[_0x228f('0x20')](_0x313cf2);return _0x195e65[_0x228f('0x26')](_0x228f('0x27'),_0x52da36+'-'+_0x139373+'/'+_0x5aa203)['json'](_0x2d4819);}return null;};}function patchUpdates(_0x1e96d4){return function(_0x8f7004){try{jsonpatch[_0x228f('0x28')](_0x8f7004,_0x1e96d4,!![]);}catch(_0x3c00ad){return BPromise[_0x228f('0x29')](_0x3c00ad);}return _0x8f7004[_0x228f('0x2a')]();};}function saveUpdates(_0x33e882,_0x20c111){return function(_0x2dcf68){if(_0x2dcf68){return _0x2dcf68['update'](_0x33e882)[_0x228f('0x2b')](function(_0x306928){return _0x306928;});}return null;};}function removeEntity(_0x2b3553,_0x272c7d){return function(_0x3036d4){if(_0x3036d4){return _0x3036d4['destroy']()[_0x228f('0x2b')](function(){var _0x49efe9=_0x3036d4[_0x228f('0x2c')]({'plain':!![]});var _0x5afa52='VoicePrefixes';return db[_0x228f('0x2d')][_0x228f('0x2e')]({'where':{'type':_0x5afa52,'resourceId':_0x49efe9['id']}})[_0x228f('0x2b')](function(){return _0x3036d4;});})[_0x228f('0x2b')](function(){_0x2b3553[_0x228f('0x20')](0xcc)[_0x228f('0x21')]();});}};}function handleEntityNotFound(_0x2eaf4f,_0x2511e5){return function(_0xe67c83){if(!_0xe67c83){_0x2eaf4f[_0x228f('0x1f')](0x194);}return _0xe67c83;};}function handleError(_0x2ba4f5,_0x136a9e){_0x136a9e=_0x136a9e||0x1f4;return function(_0xc25917){logger[_0x228f('0x2f')](_0xc25917[_0x228f('0x30')]);if(_0xc25917['name']){delete _0xc25917[_0x228f('0x31')];}_0x2ba4f5[_0x228f('0x20')](_0x136a9e)[_0x228f('0x32')](_0xc25917);};}exports['index']=function(_0x32e0ce,_0x41be2d){var _0x5acf64={},_0x38375d={},_0x31abd0={'count':0x0,'rows':[]};var _0x45a67a=_[_0x228f('0x33')](db['VoicePrefix'][_0x228f('0x34')],function(_0x5201ba){return{'name':_0x5201ba[_0x228f('0x35')],'type':_0x5201ba[_0x228f('0x36')][_0x228f('0x37')]};});_0x38375d[_0x228f('0x38')]=_['map'](_0x45a67a,_0x228f('0x31'));_0x38375d[_0x228f('0x39')]=_['keys'](_0x32e0ce['query']);_0x38375d['filters']=_[_0x228f('0x3a')](_0x38375d[_0x228f('0x38')],_0x38375d[_0x228f('0x39')]);_0x5acf64[_0x228f('0x3b')]=_[_0x228f('0x3a')](_0x38375d[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x32e0ce[_0x228f('0x39')][_0x228f('0x3c')]));_0x5acf64['attributes']=_0x5acf64['attributes'][_0x228f('0x3d')]?_0x5acf64[_0x228f('0x3b')]:_0x38375d[_0x228f('0x38')];if(!_0x32e0ce[_0x228f('0x39')][_0x228f('0x3e')](_0x228f('0x3f'))){_0x5acf64[_0x228f('0x24')]=qs[_0x228f('0x24')](_0x32e0ce[_0x228f('0x39')][_0x228f('0x24')]);_0x5acf64['offset']=qs['offset'](_0x32e0ce[_0x228f('0x39')][_0x228f('0x23')]);}_0x5acf64[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x32e0ce['query'][_0x228f('0x41')]);_0x5acf64[_0x228f('0x42')]=qs['filters'](_['pick'](_0x32e0ce[_0x228f('0x39')],_0x38375d[_0x228f('0x43')]),_0x45a67a);if(_0x32e0ce['query'][_0x228f('0x44')]){_0x5acf64[_0x228f('0x42')]=_['merge'](_0x5acf64['where'],{'$or':_[_0x228f('0x33')](_0x45a67a,function(_0x5838e6){if(_0x5838e6[_0x228f('0x36')]!==_0x228f('0x45')){var _0x3da118={};_0x3da118[_0x5838e6[_0x228f('0x31')]]={'$like':'%'+_0x32e0ce[_0x228f('0x39')][_0x228f('0x44')]+'%'};return _0x3da118;}})});}_0x5acf64=_['merge']({},_0x5acf64,_0x32e0ce[_0x228f('0x46')]);var _0x5cdd16={'where':_0x5acf64[_0x228f('0x42')]};return db[_0x228f('0x47')][_0x228f('0x25')](_0x5cdd16)[_0x228f('0x2b')](function(_0x41cba5){_0x31abd0[_0x228f('0x25')]=_0x41cba5;if(_0x32e0ce[_0x228f('0x39')][_0x228f('0x48')]){_0x5acf64[_0x228f('0x49')]=[{'all':!![]}];}return db[_0x228f('0x47')][_0x228f('0x4a')](_0x5acf64);})[_0x228f('0x2b')](function(_0x19839d){_0x31abd0['rows']=_0x19839d;return _0x31abd0;})['then'](respondWithFilteredResult(_0x41be2d,_0x5acf64))[_0x228f('0x4b')](handleError(_0x41be2d,null));};exports[_0x228f('0x4c')]=function(_0x34cd3c,_0xbfa169){var _0x2f2b47={'raw':![],'where':{'id':_0x34cd3c[_0x228f('0x4d')]['id']}},_0x334fb1={};_0x334fb1[_0x228f('0x38')]=_[_0x228f('0x4e')](db[_0x228f('0x47')]['rawAttributes']);_0x334fb1[_0x228f('0x39')]=_[_0x228f('0x4e')](_0x34cd3c['query']);_0x334fb1[_0x228f('0x43')]=_['intersection'](_0x334fb1[_0x228f('0x38')],_0x334fb1['query']);_0x2f2b47[_0x228f('0x3b')]=_['intersection'](_0x334fb1[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x34cd3c[_0x228f('0x39')][_0x228f('0x3c')]));_0x2f2b47[_0x228f('0x3b')]=_0x2f2b47[_0x228f('0x3b')][_0x228f('0x3d')]?_0x2f2b47[_0x228f('0x3b')]:_0x334fb1[_0x228f('0x38')];if(_0x34cd3c[_0x228f('0x39')][_0x228f('0x48')]){_0x2f2b47[_0x228f('0x49')]=[{'all':!![]}];}_0x2f2b47=_[_0x228f('0x4f')]({},_0x2f2b47,_0x34cd3c[_0x228f('0x46')]);return db[_0x228f('0x47')][_0x228f('0x50')](_0x2f2b47)[_0x228f('0x2b')](handleEntityNotFound(_0xbfa169,null))[_0x228f('0x2b')](respondWithResult(_0xbfa169,null))[_0x228f('0x4b')](handleError(_0xbfa169,null));};exports['destroy']=function(_0x47cb21,_0xa538ce){return db[_0x228f('0x47')][_0x228f('0x50')]({'where':{'id':_0x47cb21['params']['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0xa538ce,null))[_0x228f('0x2b')](removeEntity(_0xa538ce,null))[_0x228f('0x4b')](handleError(_0xa538ce,null));};exports['describe']=function(_0x559490,_0x51db80){return db[_0x228f('0x47')][_0x228f('0x51')]()[_0x228f('0x2b')](respondWithResult(_0x51db80,null))[_0x228f('0x4b')](handleError(_0x51db80,null));};exports[_0x228f('0x52')]=function(_0x292c39,_0xafd0e4){var _0x30ff69;return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x43bbd2){return db[_0x228f('0x47')]['create'](_0x292c39[_0x228f('0x55')],{'transaction':_0x43bbd2})[_0x228f('0x2b')](function(_0x472035){_0x30ff69=_0x472035[_0x228f('0x2c')]({'plain':!![]});return db[_0x228f('0x56')][_0x228f('0x50')]({'where':{'id':_0x30ff69[_0x228f('0x57')]},'raw':!![]})[_0x228f('0x2b')](function(_0x4feefb){return createVoicePrefixExtensions(_0x30ff69,_0x4feefb,_0x43bbd2);});});})[_0x228f('0x2b')](function(){var _0x1c6114=_0x292c39[_0x228f('0x58')][_0x228f('0x2c')]({'plain':!![]});if(!_0x1c6114)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c6114[_0x228f('0x59')]===_0x228f('0x58')){var _0x4b516e=_0x30ff69;return db[_0x228f('0x5a')][_0x228f('0x50')]({'where':{'name':_0x228f('0x5b'),'userProfileId':_0x1c6114[_0x228f('0x5c')]},'raw':!![]})[_0x228f('0x2b')](function(_0x9d7417){if(_0x9d7417&&_0x9d7417[_0x228f('0x5d')]===0x0){return db[_0x228f('0x2d')][_0x228f('0x52')]({'name':_0x4b516e[_0x228f('0x31')],'resourceId':_0x4b516e['id'],'type':_0x9d7417['name'],'sectionId':_0x9d7417['id']},{})[_0x228f('0x2b')](function(){return _0x30ff69;});}else{return _0x30ff69;}})['catch'](function(_0x331b33){logger[_0x228f('0x2f')](_0x228f('0x5e'),_0x331b33);throw _0x331b33;});}return _0x30ff69;})[_0x228f('0x2b')](respondWithResult(_0xafd0e4,null))[_0x228f('0x4b')](handleError(_0xafd0e4,null));};function Extension(_0x2860dc,_0x1c8be4,_0xadb0e6,_0x56d70f){this[_0x228f('0x5f')]=_0x228f('0x60');this[_0x228f('0x61')]=_0x2860dc;this['app']=_0xadb0e6;this[_0x228f('0x36')]='system';this[_0x228f('0x62')]=_0x228f('0x63');this['priority']=_0x1c8be4;this[_0x228f('0x64')]=_0x56d70f;}function createVoicePrefixExtensions(_0x26fe6b,_0x16318d,_0xb8200d){return new BPromise(function(_0x3a0454,_0x651060){var _0x11b481=new Extension(formatPrefixName(_0x26fe6b[_0x228f('0x65')]),0x1,_0x228f('0x66'),_0x228f('0x67'));_0x11b481[_0x228f('0x68')]=_0x26fe6b['id'];return db['VoiceExtension'][_0x228f('0x52')](_0x11b481,{'transaction':_0xb8200d})[_0x228f('0x2b')](function(_0x1d4203){var _0x3be1f3=_0x1d4203[_0x228f('0x2c')]({'plain':!![]});var _0x506191=_['map'](addVoicePrefixExtensions(_0x26fe6b,_0x16318d),function(_0x14a732){_0x14a732['VoiceExtensionId']=_0x3be1f3['id'];_0x14a732[_0x228f('0x68')]=_0x26fe6b['id'];return _0x14a732;});return db['VoiceExtension'][_0x228f('0x69')](_0x506191,{'transaction':_0xb8200d})[_0x228f('0x2b')](function(_0x53a6a5){if(!_0x53a6a5){return _0x651060(_0x228f('0x6a'));}else{return _0x3a0454(_0x53a6a5);}})[_0x228f('0x4b')](function(_0x120ae1){return _0x651060(_0x120ae1);});});;});};function addVoicePrefixExtensions(_0x392270,_0x5f0b95){var _0x42dd54=[];var _0x21f860=formatPrefixName(_0x392270[_0x228f('0x65')]);_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x2,_0x228f('0x6c'),_0x228f('0x6d')+_0x392270[_0x228f('0x31')]));if(_0x392270[_0x228f('0x6e')]){_0x42dd54['push'](new Extension(_0x21f860,0x3,_0x228f('0x6c'),_0x228f('0x6f')+_0x392270[_0x228f('0x6e')]));}else{_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x3,_0x228f('0x66'),'No\x20callerid\x20available'));}_0x42dd54[_0x228f('0x6b')](new Extension(_0x21f860,0x4,'goto',_0x5f0b95[_0x228f('0x5f')]+','+_0x228f('0x70')+(0x8+_0x392270['name'][_0x228f('0x3d')])+'}'+','+0x1));return _0x42dd54;}function formatPrefixName(_0x11a657){var _0x260e70='_';for(var _0x5eb9ed=0x0;_0x5eb9ed<_0x11a657[_0x228f('0x3d')];_0x5eb9ed++){if(_0x11a657[_0x228f('0x71')](_0x5eb9ed)=='-'){_0x260e70+=_0x11a657[_0x228f('0x71')](_0x5eb9ed);}else{_0x260e70+='['+_0x11a657[_0x228f('0x71')](_0x5eb9ed)+']';}}_0x260e70+='.';return _0x260e70;}exports[_0x228f('0x72')]=function(_0x5990e9,_0x221b3,_0x187f84){var _0x5718e1=_0x5990e9['body'];_0x5718e1[_0x228f('0x65')]=_0x228f('0x73')+_0x5718e1[_0x228f('0x31')]+'-';return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x1162ca){return db[_0x228f('0x47')][_0x228f('0x72')](_0x5718e1,{'where':{'id':_0x5718e1['id']},'transaction':_0x1162ca})['then'](function(){return db[_0x228f('0x56')]['destroy']({'where':{'VoicePrefixId':_0x5718e1['id']},'transaction':_0x1162ca})[_0x228f('0x2b')](function(){return db[_0x228f('0x56')][_0x228f('0x50')]({'where':{'id':_0x5718e1[_0x228f('0x57')]},'raw':!![]})[_0x228f('0x2b')](function(_0x32a32e){return createVoicePrefixExtensions(_0x5718e1,_0x32a32e,_0x1162ca);});});});})[_0x228f('0x2b')](function(){return db['VoicePrefix']['findById'](_0x5718e1['id']);})[_0x228f('0x2b')](respondWithResult(_0x221b3,null))[_0x228f('0x4b')](handleError(_0x221b3,null));};exports[_0x228f('0x74')]=function(_0x16776b,_0x6854c1,_0x29446b){return db['VoicePrefix'][_0x228f('0x50')]({'where':{'id':_0x16776b[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x6854c1,null))[_0x228f('0x2b')](function(_0x3fa413){if(_0x3fa413){return _0x3fa413[_0x228f('0x74')](_0x16776b[_0x228f('0x55')][_0x228f('0x75')],_[_0x228f('0x76')](_0x16776b['body'],[_0x228f('0x75'),'id'])||{})[_0x228f('0x77')](function(_0x47fe2b){for(var _0x1abf6d=0x0;_0x1abf6d<_0x16776b[_0x228f('0x55')]['ids']['length'];_0x1abf6d+=0x1){socket['emit'](_0x228f('0x78'),{'UserId':Number(_0x16776b['body'][_0x228f('0x75')][_0x1abf6d]),'VoicePrefixId':Number(_0x16776b['params']['id'])});}return _0x47fe2b;});}})[_0x228f('0x2b')](respondWithResult(_0x6854c1,null))[_0x228f('0x4b')](handleError(_0x6854c1,null));};exports['removeAgents']=function(_0x27ffdd,_0x16430e,_0x2dadc9){return db[_0x228f('0x47')][_0x228f('0x50')]({'where':{'id':_0x27ffdd['params']['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x16430e,null))[_0x228f('0x2b')](function(_0xa33189){if(_0xa33189){return _0xa33189[_0x228f('0x79')](_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')])[_0x228f('0x2b')](function(){if(_[_0x228f('0x7a')](_0x27ffdd[_0x228f('0x39')]['ids'])){for(var _0x74fe35=0x0;_0x74fe35<_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')]['length'];_0x74fe35+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x27ffdd[_0x228f('0x39')]['ids'][_0x74fe35]),'VoicePrefixId':Number(_0x27ffdd[_0x228f('0x4d')]['id'])});}}else{socket[_0x228f('0x7b')]('userVoicePrefix:remove',{'UserId':Number(_0x27ffdd[_0x228f('0x39')][_0x228f('0x75')]),'VoicePrefixId':Number(_0x27ffdd['params']['id'])});}});}})[_0x228f('0x2b')](respondWithStatusCode(_0x16430e,null))[_0x228f('0x4b')](handleError(_0x16430e,null));};exports[_0x228f('0x7c')]=function(_0x32ea8d,_0x5b29d3,_0x268e71){var _0x3418b2={};var _0x2240de={};var _0x20f029;var _0x37ab8a;return db[_0x228f('0x47')][_0x228f('0x7d')]({'where':{'id':_0x32ea8d[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x5b29d3,null))['then'](function(_0x257aa6){if(_0x257aa6){_0x20f029=_0x257aa6;_0x2240de[_0x228f('0x38')]=_[_0x228f('0x4e')](db[_0x228f('0x7e')][_0x228f('0x34')]);_0x2240de['query']=_['keys'](_0x32ea8d[_0x228f('0x39')]);_0x2240de['filters']=_[_0x228f('0x3a')](_0x2240de['model'],_0x2240de[_0x228f('0x39')]);_0x3418b2['attributes']=_[_0x228f('0x3a')](_0x2240de[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x32ea8d[_0x228f('0x39')][_0x228f('0x3c')]));_0x3418b2[_0x228f('0x3b')]=_0x3418b2[_0x228f('0x3b')][_0x228f('0x3d')]?_0x3418b2[_0x228f('0x3b')]:_0x2240de[_0x228f('0x38')];_0x3418b2[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x32ea8d[_0x228f('0x39')][_0x228f('0x41')]);_0x3418b2[_0x228f('0x42')]=qs[_0x228f('0x43')](_['pick'](_0x32ea8d[_0x228f('0x39')],_0x2240de[_0x228f('0x43')]));if(_0x32ea8d[_0x228f('0x39')]['filter']){_0x3418b2[_0x228f('0x42')]=_['merge'](_0x3418b2['where'],{'$or':_['map'](_0x3418b2[_0x228f('0x3b')],function(_0x50ed6a){var _0x22448b={};_0x22448b[_0x50ed6a]={'$like':'%'+_0x32ea8d[_0x228f('0x39')]['filter']+'%'};return _0x22448b;})});}_0x3418b2=_[_0x228f('0x4f')]({},_0x3418b2,_0x32ea8d[_0x228f('0x46')]);return _0x20f029['getAgents'](_0x3418b2);}})[_0x228f('0x2b')](function(_0x620f5a){if(_0x620f5a){_0x37ab8a=_0x620f5a['length'];if(!_0x32ea8d['query'][_0x228f('0x3e')](_0x228f('0x3f'))){_0x3418b2[_0x228f('0x24')]=qs[_0x228f('0x24')](_0x32ea8d['query'][_0x228f('0x24')]);_0x3418b2[_0x228f('0x23')]=qs['offset'](_0x32ea8d[_0x228f('0x39')][_0x228f('0x23')]);}return _0x20f029[_0x228f('0x7c')](_0x3418b2);}})[_0x228f('0x2b')](function(_0x39aa20){if(_0x39aa20){return _0x39aa20?{'count':_0x37ab8a,'rows':_0x39aa20}:null;}})[_0x228f('0x2b')](respondWithResult(_0x5b29d3,null))[_0x228f('0x4b')](handleError(_0x5b29d3,null));};exports[_0x228f('0x7f')]=function(_0x5a1a8c,_0x5a7f73,_0x597271){var _0x548882={};var _0x47eba6={};var _0x5ac69a;var _0x182858;return db[_0x228f('0x47')][_0x228f('0x7d')]({'where':{'id':_0x5a1a8c[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](handleEntityNotFound(_0x5a7f73,null))[_0x228f('0x2b')](function(_0x35aa2c){if(_0x35aa2c){_0x5ac69a=_0x35aa2c;_0x47eba6['model']=_[_0x228f('0x4e')](db['Team']['rawAttributes']);_0x47eba6['query']=_['keys'](_0x5a1a8c[_0x228f('0x39')]);_0x47eba6['filters']=_[_0x228f('0x3a')](_0x47eba6[_0x228f('0x38')],_0x47eba6[_0x228f('0x39')]);_0x548882[_0x228f('0x3b')]=_['intersection'](_0x47eba6[_0x228f('0x38')],qs[_0x228f('0x3c')](_0x5a1a8c[_0x228f('0x39')][_0x228f('0x3c')]));_0x548882[_0x228f('0x3b')]=_0x548882[_0x228f('0x3b')][_0x228f('0x3d')]?_0x548882[_0x228f('0x3b')]:_0x47eba6[_0x228f('0x38')];_0x548882[_0x228f('0x40')]=qs[_0x228f('0x41')](_0x5a1a8c['query']['sort']);_0x548882['where']=qs[_0x228f('0x43')](_[_0x228f('0x80')](_0x5a1a8c[_0x228f('0x39')],_0x47eba6[_0x228f('0x43')]));if(_0x5a1a8c[_0x228f('0x39')][_0x228f('0x44')]){_0x548882[_0x228f('0x42')]=_[_0x228f('0x4f')](_0x548882['where'],{'$or':_[_0x228f('0x33')](_0x548882[_0x228f('0x3b')],function(_0x433c1f){var _0xea049c={};_0xea049c[_0x433c1f]={'$like':'%'+_0x5a1a8c[_0x228f('0x39')][_0x228f('0x44')]+'%'};return _0xea049c;})});}_0x548882=_[_0x228f('0x4f')]({},_0x548882,_0x5a1a8c[_0x228f('0x46')]);return _0x5ac69a[_0x228f('0x7f')](_0x548882);}})['then'](function(_0x2db468){if(_0x2db468){_0x182858=_0x2db468[_0x228f('0x3d')];if(!_0x5a1a8c[_0x228f('0x39')]['hasOwnProperty']('nolimit')){_0x548882[_0x228f('0x24')]=qs['limit'](_0x5a1a8c[_0x228f('0x39')][_0x228f('0x24')]);_0x548882[_0x228f('0x23')]=qs[_0x228f('0x23')](_0x5a1a8c['query'][_0x228f('0x23')]);}return _0x5ac69a[_0x228f('0x7f')](_0x548882);}})[_0x228f('0x2b')](function(_0x237b92){if(_0x237b92){return _0x237b92?{'count':_0x182858,'rows':_0x237b92}:null;}})['then'](respondWithResult(_0x5a7f73,null))['catch'](handleError(_0x5a7f73,null));};exports[_0x228f('0x81')]=function(_0x578762,_0x19e488,_0x48c6ee){var _0x59b34c=_0x578762['body'][_0x228f('0x75')];var _0x4865e5;return db[_0x228f('0x82')][_0x228f('0x4a')]({'where':{'id':_0x59b34c},'attributes':['id'],'include':[{'model':db[_0x228f('0x7e')],'as':_0x228f('0x83'),'attributes':['id',_0x228f('0x31'),_0x228f('0x84'),_0x228f('0x85'),_0x228f('0x86')],'raw':!![]}]})[_0x228f('0x2b')](function(_0x1e8511){if(_0x1e8511){_0x4865e5=_0x1e8511;var _0x35363e=_[_0x228f('0x87')](_0x1e8511,function(_0x2f8379){var _0x38fca3=_0x2f8379[_0x228f('0x2c')]({'plain':!![]});return _0x38fca3[_0x228f('0x83')];});return db[_0x228f('0x47')]['find']({'where':{'id':_0x578762[_0x228f('0x4d')]['id']}})[_0x228f('0x2b')](function(_0x553895){return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x3a2c9c){return _0x553895[_0x228f('0x81')](_0x59b34c,{'transaction':_0x3a2c9c})['then'](function(){return BPromise[_0x228f('0x88')](_0x4865e5,function(_0x38da32){return db[_0x228f('0x89')][_0x228f('0x8a')]({'TeamId':_0x38da32['id'],'VoicePrefixId':_0x578762[_0x228f('0x4d')]['id']},{'transaction':_0x3a2c9c});});})['then'](function(){return BPromise['each'](_0x35363e,function(_0x25f726){return db[_0x228f('0x8b')]['findOrCreate']({'where':{'UserId':_0x25f726['id'],'VoicePrefixId':_0x578762[_0x228f('0x4d')]['id']},'transaction':_0x3a2c9c});});})[_0x228f('0x2b')](function(){_0x35363e[_0x228f('0x8c')](function(_0x525439){socket[_0x228f('0x7b')](_0x228f('0x78'),{'UserId':_0x525439['id'],'VoicePrefixId':_0x553895['id']});});});});});}})['then'](respondWithStatusCode(_0x19e488,null))[_0x228f('0x4b')](handleError(_0x19e488,null));};exports['removeTeams']=function(_0x29201c,_0x207d64,_0xff507b){return db[_0x228f('0x82')]['findAll']({'where':{'id':_0x29201c['query'][_0x228f('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x228f('0x83'),'attributes':['id'],'raw':!![]}]})[_0x228f('0x2b')](handleEntityNotFound(_0x207d64,null))[_0x228f('0x2b')](function(_0x16ebcf){var _0x21efb1=_['map'](_0x16ebcf,'id');var _0x3526b0=[];var _0x45da1f=[];var _0x69a9a5=squel['select']();_0x69a9a5[_0x228f('0x8d')]('tq.TeamId')[_0x228f('0x8e')](_0x228f('0x8f'),'tq')['join'](_0x228f('0x90'),'ut',_0x228f('0x91'))[_0x228f('0x42')](_0x228f('0x92'),_0x29201c['params']['id']);for(var _0x2b6a34=0x0;_0x2b6a34<_0x16ebcf[_0x228f('0x3d')];_0x2b6a34+=0x1){let _0x13ba88=_0x16ebcf[_0x2b6a34];for(var _0x106451=0x0;_0x106451<_0x13ba88[_0x228f('0x83')][_0x228f('0x3d')];_0x106451+=0x1){let _0x57b1d6=_0x13ba88[_0x228f('0x83')][_0x106451];var _0x22b0ff=_0x69a9a5[_0x228f('0x93')]();_0x22b0ff[_0x228f('0x42')](_0x228f('0x94'),_0x57b1d6['id']);_0x45da1f[_0x228f('0x6b')](db[_0x228f('0x53')]['query'](_0x22b0ff['toString'](),{'type':db[_0x228f('0x53')][_0x228f('0x95')][_0x228f('0x96')]})['then'](function(_0x348662){if(_0x348662[_0x228f('0x3d')]===0x1){return _0x57b1d6['id'];}else{var _0x3c83e1=_[_0x228f('0x97')](_[_0x228f('0x33')](_0x348662,_0x228f('0x98')),function(_0x437b8b){return _[_0x228f('0x99')](_0x21efb1,_0x437b8b);});if(_0x3c83e1){return _0x57b1d6['id'];}}}));}}return BPromise['all'](_0x45da1f)[_0x228f('0x2b')](function(_0x56d3ee){_0x3526b0=_(_0x3526b0)[_0x228f('0x9a')](_0x56d3ee)['compact']()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x29201c['params']['id']}})[_0x228f('0x2b')](function(_0x24a8ae){return db[_0x228f('0x53')][_0x228f('0x54')](function(_0x298c83){return _0x24a8ae[_0x228f('0x9b')](_0x29201c[_0x228f('0x39')][_0x228f('0x75')],{'transaction':_0x298c83})[_0x228f('0x2b')](function(){if(!_['isEmpty'](_0x3526b0)){return _0x24a8ae[_0x228f('0x79')](_0x3526b0,{'transaction':_0x298c83});}})['then'](function(){_0x3526b0[_0x228f('0x8c')](function(_0x5830f7){socket['emit'](_0x228f('0x9c'),{'UserId':_0x5830f7,'VoicePrefixId':_0x24a8ae['id']});});});});});});})[_0x228f('0x2b')](respondWithStatusCode(_0x207d64,null))[_0x228f('0x4b')](handleError(_0x207d64,null));}; \ No newline at end of file +var _0x6a95=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','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','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','goto','context','charAt','update','system-','transaction','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','hasOwnProperty','Team','getTeams','Agents','online','voicePause','flatMap','addTeams','each','upsert','UserVoicePrefix','findOrCreate','forEach','User','select','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis'];(function(_0x42bd2e,_0xc99541){var _0x2100c9=function(_0x545130){while(--_0x545130){_0x42bd2e['push'](_0x42bd2e['shift']());}};_0x2100c9(++_0xc99541);}(_0x6a95,0x1db));var _0x56a9=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x6a95[_0x53cf8e];return _0x459197;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require(_0x56a9('0x2'));var jsonpatch=require(_0x56a9('0x3'));var rp=require(_0x56a9('0x4'));var moment=require(_0x56a9('0x5'));var BPromise=require(_0x56a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0x9'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];config[_0x56a9('0x19')]=_[_0x56a9('0x1a')](config[_0x56a9('0x19')],{'host':_0x56a9('0x1b'),'port':0x18eb});var socket=require(_0x56a9('0x1c'))(new Redis(config[_0x56a9('0x19')]));require(_0x56a9('0x1d'))[_0x56a9('0x1e')](socket);function respondWithStatusCode(_0x40b2cb,_0x561bec){_0x561bec=_0x561bec||0xcc;return function(_0x582a5b){if(_0x582a5b){return _0x40b2cb[_0x56a9('0x1f')](_0x561bec);}return _0x40b2cb[_0x56a9('0x20')](_0x561bec)[_0x56a9('0x21')]();};}function respondWithResult(_0x46f854,_0x5b2637){_0x5b2637=_0x5b2637||0xc8;return function(_0x414cb5){if(_0x414cb5){return _0x46f854['status'](_0x5b2637)['json'](_0x414cb5);}};}function respondWithFilteredResult(_0x4e292f,_0x312e58){return function(_0x576bdf){if(_0x576bdf){var _0x59c0ec=typeof _0x312e58[_0x56a9('0x22')]===_0x56a9('0x23')&&typeof _0x312e58[_0x56a9('0x24')]===_0x56a9('0x23');var _0xbfeb1a=_0x576bdf[_0x56a9('0x25')];var _0x335cc3=_0x59c0ec?0x0:_0x312e58[_0x56a9('0x22')];var _0x62f79f=_0x59c0ec?_0x576bdf['count']:_0x312e58['offset']+_0x312e58[_0x56a9('0x24')];var _0x16f9de;if(_0x62f79f>=_0xbfeb1a){_0x62f79f=_0xbfeb1a;_0x16f9de=0xc8;}else{_0x16f9de=0xce;}_0x4e292f[_0x56a9('0x20')](_0x16f9de);return _0x4e292f[_0x56a9('0x26')]('Content-Range',_0x335cc3+'-'+_0x62f79f+'/'+_0xbfeb1a)[_0x56a9('0x27')](_0x576bdf);}return null;};}function patchUpdates(_0x3355c4){return function(_0x4036e5){try{jsonpatch[_0x56a9('0x28')](_0x4036e5,_0x3355c4,!![]);}catch(_0x5a82e0){return BPromise[_0x56a9('0x29')](_0x5a82e0);}return _0x4036e5[_0x56a9('0x2a')]();};}function saveUpdates(_0x21ab38,_0xd029f7){return function(_0x497d31){if(_0x497d31){return _0x497d31['update'](_0x21ab38)[_0x56a9('0x2b')](function(_0x217bda){return _0x217bda;});}return null;};}function removeEntity(_0x35fe6d,_0x5e3052){return function(_0x1099ba){if(_0x1099ba){return _0x1099ba['destroy']()[_0x56a9('0x2b')](function(){var _0x8d41d6=_0x1099ba[_0x56a9('0x2c')]({'plain':!![]});var _0x20432a=_0x56a9('0x2d');return db[_0x56a9('0x2e')][_0x56a9('0x2f')]({'where':{'type':_0x20432a,'resourceId':_0x8d41d6['id']}})[_0x56a9('0x2b')](function(){return _0x1099ba;});})['then'](function(){_0x35fe6d[_0x56a9('0x20')](0xcc)[_0x56a9('0x21')]();});}};}function handleEntityNotFound(_0x5f23e1,_0x4441ce){return function(_0x4f9be1){if(!_0x4f9be1){_0x5f23e1['sendStatus'](0x194);}return _0x4f9be1;};}function handleError(_0x20d940,_0x4c1e3e){_0x4c1e3e=_0x4c1e3e||0x1f4;return function(_0x2f933a){logger[_0x56a9('0x30')](_0x2f933a[_0x56a9('0x31')]);if(_0x2f933a[_0x56a9('0x32')]){delete _0x2f933a['name'];}_0x20d940[_0x56a9('0x20')](_0x4c1e3e)[_0x56a9('0x33')](_0x2f933a);};}exports[_0x56a9('0x34')]=function(_0xeabd82,_0xbbb47d){var _0x1fa0a6={},_0x3a7a4e={},_0x2b5447={'count':0x0,'rows':[]};var _0x42c2da=_[_0x56a9('0x35')](db[_0x56a9('0x36')][_0x56a9('0x37')],function(_0x5738fe){return{'name':_0x5738fe[_0x56a9('0x38')],'type':_0x5738fe[_0x56a9('0x39')][_0x56a9('0x3a')]};});_0x3a7a4e['model']=_[_0x56a9('0x35')](_0x42c2da,'name');_0x3a7a4e['query']=_['keys'](_0xeabd82[_0x56a9('0x3b')]);_0x3a7a4e[_0x56a9('0x3c')]=_['intersection'](_0x3a7a4e['model'],_0x3a7a4e[_0x56a9('0x3b')]);_0x1fa0a6[_0x56a9('0x3d')]=_[_0x56a9('0x3e')](_0x3a7a4e[_0x56a9('0x3f')],qs[_0x56a9('0x40')](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x40')]));_0x1fa0a6[_0x56a9('0x3d')]=_0x1fa0a6[_0x56a9('0x3d')][_0x56a9('0x41')]?_0x1fa0a6['attributes']:_0x3a7a4e['model'];if(!_0xeabd82['query']['hasOwnProperty'](_0x56a9('0x42'))){_0x1fa0a6[_0x56a9('0x24')]=qs['limit'](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x24')]);_0x1fa0a6[_0x56a9('0x22')]=qs[_0x56a9('0x22')](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x22')]);}_0x1fa0a6[_0x56a9('0x43')]=qs['sort'](_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x44')]);_0x1fa0a6['where']=qs['filters'](_[_0x56a9('0x45')](_0xeabd82[_0x56a9('0x3b')],_0x3a7a4e[_0x56a9('0x3c')]),_0x42c2da);if(_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x46')]){_0x1fa0a6[_0x56a9('0x47')]=_[_0x56a9('0x48')](_0x1fa0a6[_0x56a9('0x47')],{'$or':_[_0x56a9('0x35')](_0x42c2da,function(_0x24a7e3){if(_0x24a7e3[_0x56a9('0x39')]!==_0x56a9('0x49')){var _0xf2347a={};_0xf2347a[_0x24a7e3[_0x56a9('0x32')]]={'$like':'%'+_0xeabd82[_0x56a9('0x3b')][_0x56a9('0x46')]+'%'};return _0xf2347a;}})});}_0x1fa0a6=_[_0x56a9('0x48')]({},_0x1fa0a6,_0xeabd82[_0x56a9('0x4a')]);var _0x5dad3f={'where':_0x1fa0a6[_0x56a9('0x47')]};return db[_0x56a9('0x36')][_0x56a9('0x25')](_0x5dad3f)['then'](function(_0x1f8b30){_0x2b5447['count']=_0x1f8b30;if(_0xeabd82[_0x56a9('0x3b')]['includeAll']){_0x1fa0a6[_0x56a9('0x4b')]=[{'all':!![]}];}return db[_0x56a9('0x36')][_0x56a9('0x4c')](_0x1fa0a6);})[_0x56a9('0x2b')](function(_0x5192d8){_0x2b5447['rows']=_0x5192d8;return _0x2b5447;})['then'](respondWithFilteredResult(_0xbbb47d,_0x1fa0a6))[_0x56a9('0x4d')](handleError(_0xbbb47d,null));};exports[_0x56a9('0x4e')]=function(_0x288eaa,_0x402a64){var _0x16db39={'raw':![],'where':{'id':_0x288eaa[_0x56a9('0x4f')]['id']}},_0x182990={};_0x182990[_0x56a9('0x3f')]=_[_0x56a9('0x50')](db[_0x56a9('0x36')][_0x56a9('0x37')]);_0x182990[_0x56a9('0x3b')]=_[_0x56a9('0x50')](_0x288eaa[_0x56a9('0x3b')]);_0x182990['filters']=_[_0x56a9('0x3e')](_0x182990[_0x56a9('0x3f')],_0x182990[_0x56a9('0x3b')]);_0x16db39['attributes']=_[_0x56a9('0x3e')](_0x182990[_0x56a9('0x3f')],qs['fields'](_0x288eaa[_0x56a9('0x3b')][_0x56a9('0x40')]));_0x16db39[_0x56a9('0x3d')]=_0x16db39[_0x56a9('0x3d')]['length']?_0x16db39[_0x56a9('0x3d')]:_0x182990[_0x56a9('0x3f')];if(_0x288eaa[_0x56a9('0x3b')][_0x56a9('0x51')]){_0x16db39[_0x56a9('0x4b')]=[{'all':!![]}];}_0x16db39=_[_0x56a9('0x48')]({},_0x16db39,_0x288eaa[_0x56a9('0x4a')]);return db[_0x56a9('0x36')][_0x56a9('0x52')](_0x16db39)[_0x56a9('0x2b')](handleEntityNotFound(_0x402a64,null))[_0x56a9('0x2b')](respondWithResult(_0x402a64,null))['catch'](handleError(_0x402a64,null));};exports['destroy']=function(_0x46aa63,_0x35fb7b){return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0x46aa63['params']['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x35fb7b,null))[_0x56a9('0x2b')](removeEntity(_0x35fb7b,null))[_0x56a9('0x4d')](handleError(_0x35fb7b,null));};exports[_0x56a9('0x53')]=function(_0x52ba21,_0x221a01){return db[_0x56a9('0x36')]['describe']()[_0x56a9('0x2b')](respondWithResult(_0x221a01,null))[_0x56a9('0x4d')](handleError(_0x221a01,null));};exports['create']=function(_0x12179d,_0x338140){var _0x230b53;return db[_0x56a9('0x54')]['transaction'](function(_0x4938d6){return db[_0x56a9('0x36')][_0x56a9('0x55')](_0x12179d[_0x56a9('0x56')],{'transaction':_0x4938d6})[_0x56a9('0x2b')](function(_0x40e660){_0x230b53=_0x40e660[_0x56a9('0x2c')]({'plain':!![]});return db[_0x56a9('0x57')][_0x56a9('0x52')]({'where':{'id':_0x230b53[_0x56a9('0x58')]},'raw':!![]})[_0x56a9('0x2b')](function(_0x5f07f5){return createVoicePrefixExtensions(_0x230b53,_0x5f07f5,_0x4938d6);});});})[_0x56a9('0x2b')](function(){var _0x20ce89=_0x12179d[_0x56a9('0x59')][_0x56a9('0x2c')]({'plain':!![]});if(!_0x20ce89)throw new Error(_0x56a9('0x5a'));if(_0x20ce89[_0x56a9('0x5b')]===_0x56a9('0x59')){var _0x488577=_0x230b53;return db[_0x56a9('0x5c')][_0x56a9('0x52')]({'where':{'name':_0x56a9('0x2d'),'userProfileId':_0x20ce89[_0x56a9('0x5d')]},'raw':!![]})[_0x56a9('0x2b')](function(_0x25830d){if(_0x25830d&&_0x25830d[_0x56a9('0x5e')]===0x0){return db['UserProfileResource'][_0x56a9('0x55')]({'name':_0x488577['name'],'resourceId':_0x488577['id'],'type':_0x25830d['name'],'sectionId':_0x25830d['id']},{})[_0x56a9('0x2b')](function(){return _0x230b53;});}else{return _0x230b53;}})['catch'](function(_0x229c12){logger[_0x56a9('0x30')](_0x56a9('0x5f'),_0x229c12);throw _0x229c12;});}return _0x230b53;})[_0x56a9('0x2b')](respondWithResult(_0x338140,null))[_0x56a9('0x4d')](handleError(_0x338140,null));};function Extension(_0x3e6f16,_0x1628a5,_0xa3850f,_0x91bad6){this['context']=_0x56a9('0x60');this[_0x56a9('0x61')]=_0x3e6f16;this[_0x56a9('0x62')]=_0xa3850f;this[_0x56a9('0x39')]=_0x56a9('0x63');this[_0x56a9('0x64')]=_0x56a9('0x65');this[_0x56a9('0x66')]=_0x1628a5;this[_0x56a9('0x67')]=_0x91bad6;}function createVoicePrefixExtensions(_0x25c6d6,_0x5df43d,_0x359c9c){return new BPromise(function(_0x286939,_0x38e497){var _0x47e4f7=new Extension(formatPrefixName(_0x25c6d6[_0x56a9('0x68')]),0x1,_0x56a9('0x69'),_0x56a9('0x6a'));_0x47e4f7['VoicePrefixId']=_0x25c6d6['id'];return db['VoiceExtension'][_0x56a9('0x55')](_0x47e4f7,{'transaction':_0x359c9c})[_0x56a9('0x2b')](function(_0x302aa0){var _0x1d6497=_0x302aa0[_0x56a9('0x2c')]({'plain':!![]});var _0x5d126f=_[_0x56a9('0x35')](addVoicePrefixExtensions(_0x25c6d6,_0x5df43d),function(_0x52bc63){_0x52bc63[_0x56a9('0x58')]=_0x1d6497['id'];_0x52bc63[_0x56a9('0x6b')]=_0x25c6d6['id'];return _0x52bc63;});return db[_0x56a9('0x57')][_0x56a9('0x6c')](_0x5d126f,{'transaction':_0x359c9c})[_0x56a9('0x2b')](function(_0x5edf65){if(!_0x5edf65){return _0x38e497('Extensions\x20creation\x20failed');}else{return _0x286939(_0x5edf65);}})['catch'](function(_0x2de0da){return _0x38e497(_0x2de0da);});});;});};function addVoicePrefixExtensions(_0x2aa634,_0x41ca05){var _0x5bbbf3=[];var _0x2313c4=formatPrefixName(_0x2aa634['prefix']);_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x2,_0x56a9('0x6e'),_0x56a9('0x6f')+_0x2aa634['name']));if(_0x2aa634['callerIdAll']){_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x3,_0x56a9('0x6e'),_0x56a9('0x70')+_0x2aa634[_0x56a9('0x71')]));}else{_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x3,_0x56a9('0x69'),'No\x20callerid\x20available'));}_0x5bbbf3[_0x56a9('0x6d')](new Extension(_0x2313c4,0x4,_0x56a9('0x72'),_0x41ca05[_0x56a9('0x73')]+','+'${EXTEN:'+(0x8+_0x2aa634['name']['length'])+'}'+','+0x1));return _0x5bbbf3;}function formatPrefixName(_0x57001c){var _0x4270ba='_';for(var _0x35b620=0x0;_0x35b620<_0x57001c['length'];_0x35b620++){if(_0x57001c[_0x56a9('0x74')](_0x35b620)=='-'){_0x4270ba+=_0x57001c[_0x56a9('0x74')](_0x35b620);}else{_0x4270ba+='['+_0x57001c[_0x56a9('0x74')](_0x35b620)+']';}}_0x4270ba+='.';return _0x4270ba;}exports[_0x56a9('0x75')]=function(_0x58108a,_0x26315b,_0x398a63){var _0x25b6b6=_0x58108a[_0x56a9('0x56')];_0x25b6b6[_0x56a9('0x68')]=_0x56a9('0x76')+_0x25b6b6[_0x56a9('0x32')]+'-';return db[_0x56a9('0x54')][_0x56a9('0x77')](function(_0x41437e){return db[_0x56a9('0x36')][_0x56a9('0x75')](_0x25b6b6,{'where':{'id':_0x25b6b6['id']},'transaction':_0x41437e})[_0x56a9('0x2b')](function(){return db[_0x56a9('0x57')][_0x56a9('0x2f')]({'where':{'VoicePrefixId':_0x25b6b6['id']},'transaction':_0x41437e})[_0x56a9('0x2b')](function(){return db['VoiceExtension'][_0x56a9('0x52')]({'where':{'id':_0x25b6b6['VoiceExtensionId']},'raw':!![]})[_0x56a9('0x2b')](function(_0x2ef783){return createVoicePrefixExtensions(_0x25b6b6,_0x2ef783,_0x41437e);});});});})[_0x56a9('0x2b')](function(){return db['VoicePrefix'][_0x56a9('0x78')](_0x25b6b6['id']);})['then'](respondWithResult(_0x26315b,null))['catch'](handleError(_0x26315b,null));};exports[_0x56a9('0x79')]=function(_0x1730ac,_0x17ff8e,_0x15b983){return db['VoicePrefix'][_0x56a9('0x52')]({'where':{'id':_0x1730ac[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x17ff8e,null))[_0x56a9('0x2b')](function(_0x5b144f){if(_0x5b144f){return _0x5b144f['addAgents'](_0x1730ac['body'][_0x56a9('0x7a')],_[_0x56a9('0x7b')](_0x1730ac[_0x56a9('0x56')],[_0x56a9('0x7a'),'id'])||{})[_0x56a9('0x7c')](function(_0x23c0ee){for(var _0x106017=0x0;_0x106017<_0x1730ac[_0x56a9('0x56')]['ids']['length'];_0x106017+=0x1){socket['emit'](_0x56a9('0x7d'),{'UserId':Number(_0x1730ac['body']['ids'][_0x106017]),'VoicePrefixId':Number(_0x1730ac['params']['id'])});}return _0x23c0ee;});}})['then'](respondWithResult(_0x17ff8e,null))[_0x56a9('0x4d')](handleError(_0x17ff8e,null));};exports[_0x56a9('0x7e')]=function(_0x16a293,_0x32ba59,_0x5e35aa){return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0x16a293[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x32ba59,null))[_0x56a9('0x2b')](function(_0x469bf6){if(_0x469bf6){return _0x469bf6[_0x56a9('0x7e')](_0x16a293[_0x56a9('0x3b')][_0x56a9('0x7a')])[_0x56a9('0x2b')](function(){if(_[_0x56a9('0x7f')](_0x16a293[_0x56a9('0x3b')][_0x56a9('0x7a')])){for(var _0x4d8ccc=0x0;_0x4d8ccc<_0x16a293['query']['ids']['length'];_0x4d8ccc+=0x1){socket[_0x56a9('0x80')](_0x56a9('0x81'),{'UserId':Number(_0x16a293['query'][_0x56a9('0x7a')][_0x4d8ccc]),'VoicePrefixId':Number(_0x16a293[_0x56a9('0x4f')]['id'])});}}else{socket[_0x56a9('0x80')](_0x56a9('0x81'),{'UserId':Number(_0x16a293[_0x56a9('0x3b')][_0x56a9('0x7a')]),'VoicePrefixId':Number(_0x16a293['params']['id'])});}});}})[_0x56a9('0x2b')](respondWithStatusCode(_0x32ba59,null))['catch'](handleError(_0x32ba59,null));};exports[_0x56a9('0x82')]=function(_0x296203,_0x6dd6e6,_0x598a82){var _0x19cfef={};var _0xe2f84={};var _0x35731a;var _0x256b26;return db[_0x56a9('0x36')][_0x56a9('0x83')]({'where':{'id':_0x296203['params']['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x6dd6e6,null))[_0x56a9('0x2b')](function(_0x1f42a3){if(_0x1f42a3){_0x35731a=_0x1f42a3;_0xe2f84[_0x56a9('0x3f')]=_[_0x56a9('0x50')](db['User'][_0x56a9('0x37')]);_0xe2f84[_0x56a9('0x3b')]=_[_0x56a9('0x50')](_0x296203[_0x56a9('0x3b')]);_0xe2f84[_0x56a9('0x3c')]=_['intersection'](_0xe2f84[_0x56a9('0x3f')],_0xe2f84[_0x56a9('0x3b')]);_0x19cfef['attributes']=_[_0x56a9('0x3e')](_0xe2f84[_0x56a9('0x3f')],qs[_0x56a9('0x40')](_0x296203['query'][_0x56a9('0x40')]));_0x19cfef[_0x56a9('0x3d')]=_0x19cfef[_0x56a9('0x3d')][_0x56a9('0x41')]?_0x19cfef[_0x56a9('0x3d')]:_0xe2f84[_0x56a9('0x3f')];_0x19cfef[_0x56a9('0x43')]=qs[_0x56a9('0x44')](_0x296203[_0x56a9('0x3b')][_0x56a9('0x44')]);_0x19cfef['where']=qs[_0x56a9('0x3c')](_[_0x56a9('0x45')](_0x296203[_0x56a9('0x3b')],_0xe2f84[_0x56a9('0x3c')]));if(_0x296203[_0x56a9('0x3b')][_0x56a9('0x46')]){_0x19cfef[_0x56a9('0x47')]=_['merge'](_0x19cfef[_0x56a9('0x47')],{'$or':_['map'](_0x19cfef[_0x56a9('0x3d')],function(_0x324a98){var _0x1324ba={};_0x1324ba[_0x324a98]={'$like':'%'+_0x296203[_0x56a9('0x3b')][_0x56a9('0x46')]+'%'};return _0x1324ba;})});}_0x19cfef=_['merge']({},_0x19cfef,_0x296203[_0x56a9('0x4a')]);return _0x35731a['getAgents'](_0x19cfef);}})[_0x56a9('0x2b')](function(_0x131644){if(_0x131644){_0x256b26=_0x131644[_0x56a9('0x41')];if(!_0x296203[_0x56a9('0x3b')][_0x56a9('0x84')](_0x56a9('0x42'))){_0x19cfef[_0x56a9('0x24')]=qs[_0x56a9('0x24')](_0x296203[_0x56a9('0x3b')][_0x56a9('0x24')]);_0x19cfef['offset']=qs[_0x56a9('0x22')](_0x296203['query']['offset']);}return _0x35731a[_0x56a9('0x82')](_0x19cfef);}})[_0x56a9('0x2b')](function(_0x5a2080){if(_0x5a2080){return _0x5a2080?{'count':_0x256b26,'rows':_0x5a2080}:null;}})[_0x56a9('0x2b')](respondWithResult(_0x6dd6e6,null))[_0x56a9('0x4d')](handleError(_0x6dd6e6,null));};exports['getTeams']=function(_0x3c0b9a,_0x5eb05d,_0x2cf047){var _0x18fd5e={};var _0x5f5db6={};var _0xafa83b;var _0x4c3257;return db[_0x56a9('0x36')]['findOne']({'where':{'id':_0x3c0b9a[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](handleEntityNotFound(_0x5eb05d,null))[_0x56a9('0x2b')](function(_0x269369){if(_0x269369){_0xafa83b=_0x269369;_0x5f5db6[_0x56a9('0x3f')]=_['keys'](db[_0x56a9('0x85')][_0x56a9('0x37')]);_0x5f5db6[_0x56a9('0x3b')]=_[_0x56a9('0x50')](_0x3c0b9a[_0x56a9('0x3b')]);_0x5f5db6['filters']=_[_0x56a9('0x3e')](_0x5f5db6[_0x56a9('0x3f')],_0x5f5db6[_0x56a9('0x3b')]);_0x18fd5e['attributes']=_[_0x56a9('0x3e')](_0x5f5db6[_0x56a9('0x3f')],qs[_0x56a9('0x40')](_0x3c0b9a[_0x56a9('0x3b')]['fields']));_0x18fd5e['attributes']=_0x18fd5e[_0x56a9('0x3d')][_0x56a9('0x41')]?_0x18fd5e[_0x56a9('0x3d')]:_0x5f5db6[_0x56a9('0x3f')];_0x18fd5e[_0x56a9('0x43')]=qs[_0x56a9('0x44')](_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x44')]);_0x18fd5e[_0x56a9('0x47')]=qs['filters'](_[_0x56a9('0x45')](_0x3c0b9a['query'],_0x5f5db6[_0x56a9('0x3c')]));if(_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x46')]){_0x18fd5e[_0x56a9('0x47')]=_[_0x56a9('0x48')](_0x18fd5e['where'],{'$or':_[_0x56a9('0x35')](_0x18fd5e[_0x56a9('0x3d')],function(_0x21ffcf){var _0x2d02e7={};_0x2d02e7[_0x21ffcf]={'$like':'%'+_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x46')]+'%'};return _0x2d02e7;})});}_0x18fd5e=_[_0x56a9('0x48')]({},_0x18fd5e,_0x3c0b9a['options']);return _0xafa83b[_0x56a9('0x86')](_0x18fd5e);}})[_0x56a9('0x2b')](function(_0x45e58d){if(_0x45e58d){_0x4c3257=_0x45e58d[_0x56a9('0x41')];if(!_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x84')]('nolimit')){_0x18fd5e[_0x56a9('0x24')]=qs['limit'](_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x24')]);_0x18fd5e[_0x56a9('0x22')]=qs['offset'](_0x3c0b9a[_0x56a9('0x3b')][_0x56a9('0x22')]);}return _0xafa83b[_0x56a9('0x86')](_0x18fd5e);}})[_0x56a9('0x2b')](function(_0x12e70a){if(_0x12e70a){return _0x12e70a?{'count':_0x4c3257,'rows':_0x12e70a}:null;}})[_0x56a9('0x2b')](respondWithResult(_0x5eb05d,null))[_0x56a9('0x4d')](handleError(_0x5eb05d,null));};exports['addTeams']=function(_0x4fee66,_0x444b4,_0x1a3459){var _0x5480b6=_0x4fee66[_0x56a9('0x56')][_0x56a9('0x7a')];var _0x14d54d;return db['Team'][_0x56a9('0x4c')]({'where':{'id':_0x5480b6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x56a9('0x87'),'attributes':['id','name',_0x56a9('0x88'),_0x56a9('0x89'),'interface'],'raw':!![]}]})[_0x56a9('0x2b')](function(_0x41c07e){if(_0x41c07e){_0x14d54d=_0x41c07e;var _0x11a6ab=_[_0x56a9('0x8a')](_0x41c07e,function(_0x474ae4){var _0x3fe3e9=_0x474ae4['get']({'plain':!![]});return _0x3fe3e9[_0x56a9('0x87')];});return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0x4fee66['params']['id']}})[_0x56a9('0x2b')](function(_0x22f222){return db[_0x56a9('0x54')][_0x56a9('0x77')](function(_0x2adb73){return _0x22f222[_0x56a9('0x8b')](_0x5480b6,{'transaction':_0x2adb73})[_0x56a9('0x2b')](function(){return BPromise[_0x56a9('0x8c')](_0x14d54d,function(_0x4252c0){return db['TeamVoicePrefix'][_0x56a9('0x8d')]({'TeamId':_0x4252c0['id'],'VoicePrefixId':_0x4fee66['params']['id']},{'transaction':_0x2adb73});});})[_0x56a9('0x2b')](function(){return BPromise[_0x56a9('0x8c')](_0x11a6ab,function(_0x2ee1ee){return db[_0x56a9('0x8e')][_0x56a9('0x8f')]({'where':{'UserId':_0x2ee1ee['id'],'VoicePrefixId':_0x4fee66['params']['id']},'transaction':_0x2adb73});});})[_0x56a9('0x2b')](function(){_0x11a6ab[_0x56a9('0x90')](function(_0x4959e1){socket[_0x56a9('0x80')](_0x56a9('0x7d'),{'UserId':_0x4959e1['id'],'VoicePrefixId':_0x22f222['id']});});});});});}})[_0x56a9('0x2b')](respondWithStatusCode(_0x444b4,null))[_0x56a9('0x4d')](handleError(_0x444b4,null));};exports['removeTeams']=function(_0xf42b12,_0x487850,_0x3f6373){return db[_0x56a9('0x85')][_0x56a9('0x4c')]({'where':{'id':_0xf42b12[_0x56a9('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x56a9('0x91')],'as':_0x56a9('0x87'),'attributes':['id'],'raw':!![]}]})[_0x56a9('0x2b')](handleEntityNotFound(_0x487850,null))['then'](function(_0x143875){var _0x289604=_[_0x56a9('0x35')](_0x143875,'id');var _0x47ad47=[];var _0x531d93=[];var _0x175da9=squel[_0x56a9('0x92')]();_0x175da9['field'](_0x56a9('0x93'))[_0x56a9('0x94')](_0x56a9('0x95'),'tq')['join'](_0x56a9('0x96'),'ut',_0x56a9('0x97'))[_0x56a9('0x47')](_0x56a9('0x98'),_0xf42b12[_0x56a9('0x4f')]['id']);for(var _0xff2bfb=0x0;_0xff2bfb<_0x143875[_0x56a9('0x41')];_0xff2bfb+=0x1){let _0x11c091=_0x143875[_0xff2bfb];for(var _0xcacd10=0x0;_0xcacd10<_0x11c091[_0x56a9('0x87')][_0x56a9('0x41')];_0xcacd10+=0x1){let _0x142d8d=_0x11c091[_0x56a9('0x87')][_0xcacd10];var _0x35b35a=_0x175da9[_0x56a9('0x99')]();_0x35b35a['where'](_0x56a9('0x9a'),_0x142d8d['id']);_0x531d93[_0x56a9('0x6d')](db['sequelize']['query'](_0x35b35a[_0x56a9('0x9b')](),{'type':db['sequelize'][_0x56a9('0x9c')][_0x56a9('0x9d')]})['then'](function(_0x40526a){if(_0x40526a['length']===0x1){return _0x142d8d['id'];}else{var _0x57e0ca=_[_0x56a9('0x9e')](_[_0x56a9('0x35')](_0x40526a,_0x56a9('0x9f')),function(_0x1ce55c){return _[_0x56a9('0xa0')](_0x289604,_0x1ce55c);});if(_0x57e0ca){return _0x142d8d['id'];}}}));}}return BPromise[_0x56a9('0xa1')](_0x531d93)[_0x56a9('0x2b')](function(_0x1e36c0){_0x47ad47=_(_0x47ad47)[_0x56a9('0xa2')](_0x1e36c0)[_0x56a9('0xa3')]()[_0x56a9('0xa4')]();return db[_0x56a9('0x36')][_0x56a9('0x52')]({'where':{'id':_0xf42b12[_0x56a9('0x4f')]['id']}})[_0x56a9('0x2b')](function(_0x5a2eb4){return db[_0x56a9('0x54')][_0x56a9('0x77')](function(_0x1fe677){return _0x5a2eb4[_0x56a9('0xa5')](_0xf42b12['query'][_0x56a9('0x7a')],{'transaction':_0x1fe677})[_0x56a9('0x2b')](function(){if(!_[_0x56a9('0xa6')](_0x47ad47)){return _0x5a2eb4[_0x56a9('0x7e')](_0x47ad47,{'transaction':_0x1fe677});}})[_0x56a9('0x2b')](function(){_0x47ad47['forEach'](function(_0x33660b){socket[_0x56a9('0x80')](_0x56a9('0x81'),{'UserId':_0x33660b,'VoicePrefixId':_0x5a2eb4['id']});});});});});});})[_0x56a9('0x2b')](respondWithStatusCode(_0x487850,null))[_0x56a9('0x4d')](handleError(_0x487850,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 717aa29..0b234ee 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 _0xf804=['emit','hook','exports','../../mysqldb','remove'];(function(_0x15b6cc,_0x3d607a){var _0x97bf7e=function(_0xb73d86){while(--_0xb73d86){_0x15b6cc['push'](_0x15b6cc['shift']());}};_0x97bf7e(++_0x3d607a);}(_0xf804,0x9e));var _0x4f80=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf804[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x4f80('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4f80('0x1')};function emitEvent(_0x2168d0){return function(_0x41da30,_0x24b1b8,_0x13128e){VoicePrefixEvents[_0x4f80('0x2')](_0x2168d0+':'+_0x41da30['id'],_0x41da30);VoicePrefixEvents[_0x4f80('0x2')](_0x2168d0,_0x41da30);_0x13128e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x4f80('0x3')](e,emitEvent(event));}}module[_0x4f80('0x4')]=VoicePrefixEvents; \ No newline at end of file +var _0xeec2=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x13114d,_0x199cd5){var _0x49a026=function(_0x36343e){while(--_0x36343e){_0x13114d['push'](_0x13114d['shift']());}};_0x49a026(++_0x199cd5);}(_0xeec2,0x1c4));var _0x2eec=function(_0x3a7fbc,_0x382eee){_0x3a7fbc=_0x3a7fbc-0x0;var _0x481feb=_0xeec2[_0x3a7fbc];return _0x481feb;};'use strict';var EventEmitter=require(_0x2eec('0x0'));var VoicePrefix=require(_0x2eec('0x1'))['db'][_0x2eec('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x2eec('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2eec('0x4'),'afterDestroy':_0x2eec('0x5')};function emitEvent(_0x68408f){return function(_0x235abb,_0x1a8d86,_0x35bc33){VoicePrefixEvents[_0x2eec('0x6')](_0x68408f+':'+_0x235abb['id'],_0x235abb);VoicePrefixEvents[_0x2eec('0x6')](_0x68408f,_0x235abb);_0x35bc33(null);};}for(var e in events){if(events[_0x2eec('0x7')](e)){var event=events[e];VoicePrefix[_0x2eec('0x8')](e,emitEvent(event));}}module[_0x2eec('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index abe708c..9749843 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 _0xdbf6=['path','../../config/environment','define','VoicePrefix','util','../../config/logger','api','moment','bluebird'];(function(_0x1bffb8,_0x48a178){var _0x24cd6e=function(_0x214737){while(--_0x214737){_0x1bffb8['push'](_0x1bffb8['shift']());}};_0x24cd6e(++_0x48a178);}(_0xdbf6,0xaf));var _0x6dbf=function(_0x2517c2,_0x54c9f1){_0x2517c2=_0x2517c2-0x0;var _0x37d883=_0xdbf6[_0x2517c2];return _0x37d883;};'use strict';var _=require('lodash');var util=require(_0x6dbf('0x0'));var logger=require(_0x6dbf('0x1'))(_0x6dbf('0x2'));var moment=require(_0x6dbf('0x3'));var BPromise=require(_0x6dbf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6dbf('0x5'));var rimraf=require('rimraf');var config=require(_0x6dbf('0x6'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x583825,_0x1aee58){return _0x583825[_0x6dbf('0x7')](_0x6dbf('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5b9=['request-promise','rimraf','../../config/environment','./voicePrefix.attributes','VoicePrefix','lodash','util','../../config/logger','api'];(function(_0x26631e,_0x4718a7){var _0x281c99=function(_0x216582){while(--_0x216582){_0x26631e['push'](_0x26631e['shift']());}};_0x281c99(++_0x4718a7);}(_0xf5b9,0x176));var _0x9f5b=function(_0x60ffc8,_0x112ad2){_0x60ffc8=_0x60ffc8-0x0;var _0x8c8428=_0xf5b9[_0x60ffc8];return _0x8c8428;};'use strict';var _=require(_0x9f5b('0x0'));var util=require(_0x9f5b('0x1'));var logger=require(_0x9f5b('0x2'))(_0x9f5b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f5b('0x5'));var config=require(_0x9f5b('0x6'));var attributes=require(_0x9f5b('0x7'));module['exports']=function(_0x20df9b,_0xc633a2){return _0x20df9b['define'](_0x9f5b('0x8'),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 3c0407e..e5bd96b 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 _0xa49e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x49ac16,_0x2727f4){var _0x28f5bf=function(_0x42d627){while(--_0x42d627){_0x49ac16['push'](_0x49ac16['shift']());}};_0x28f5bf(++_0x2727f4);}(_0xa49e,0x1de));var _0xea49=function(_0x1268f4,_0x147117){_0x1268f4=_0x1268f4-0x0;var _0x2f1b05=_0xa49e[_0x1268f4];return _0x2f1b05;};'use strict';var _=require(_0xea49('0x0'));var util=require(_0xea49('0x1'));var moment=require(_0xea49('0x2'));var BPromise=require(_0xea49('0x3'));var rs=require(_0xea49('0x4'));var fs=require('fs');var Redis=require(_0xea49('0x5'));var db=require(_0xea49('0x6'))['db'];var utils=require(_0xea49('0x7'));var logger=require('../../config/logger')(_0xea49('0x8'));var config=require(_0xea49('0x9'));var jayson=require(_0xea49('0xa'));var client=jayson['client'][_0xea49('0xb')]({'port':0x232a});config[_0xea49('0xc')]=_[_0xea49('0xd')](config[_0xea49('0xc')],{'host':_0xea49('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea49('0xc')]));require('./voicePrefix.socket')[_0xea49('0xf')](socket);function respondWithRpcPromise(_0x57f940,_0x5dd3f6,_0x5a3eb6){return new BPromise(function(_0x41ebd8,_0x2a4e69){return client[_0xea49('0x10')](_0x57f940,_0x5a3eb6)[_0xea49('0x11')](function(_0x462d94){logger[_0xea49('0x12')](_0xea49('0x13'),_0x5dd3f6,_0xea49('0x14'));logger[_0xea49('0x15')](_0xea49('0x16'),_0x5dd3f6,_0xea49('0x14'),JSON['stringify'](_0x462d94));if(_0x462d94[_0xea49('0x17')]){if(_0x462d94[_0xea49('0x17')][_0xea49('0x18')]===0x1f4){logger[_0xea49('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x5dd3f6,_0x462d94[_0xea49('0x17')][_0xea49('0x19')]);return _0x2a4e69(_0x462d94['error'][_0xea49('0x19')]);}logger[_0xea49('0x17')](_0xea49('0x13'),_0x5dd3f6,_0x462d94[_0xea49('0x17')]['message']);return _0x41ebd8(_0x462d94['error'][_0xea49('0x19')]);}else{logger['info'](_0xea49('0x13'),_0x5dd3f6,_0xea49('0x14'));_0x41ebd8(_0x462d94[_0xea49('0x1a')]['message']);}})[_0xea49('0x1b')](function(_0x32f952){logger[_0xea49('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x5dd3f6,_0x32f952);_0x2a4e69(_0x32f952);});});} \ No newline at end of file +var _0xca6e=['http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xca6e,0x1c1));var _0xeca6=function(_0x19f514,_0x56d767){_0x19f514=_0x19f514-0x0;var _0x19d72f=_0xca6e[_0x19f514];return _0x19d72f;};'use strict';var _=require(_0xeca6('0x0'));var util=require(_0xeca6('0x1'));var moment=require(_0xeca6('0x2'));var BPromise=require(_0xeca6('0x3'));var rs=require(_0xeca6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeca6('0x5'))['db'];var utils=require(_0xeca6('0x6'));var logger=require('../../config/logger')(_0xeca6('0x7'));var config=require('../../config/environment');var jayson=require(_0xeca6('0x8'));var client=jayson[_0xeca6('0x9')][_0xeca6('0xa')]({'port':0x232a});config['redis']=_[_0xeca6('0xb')](config['redis'],{'host':_0xeca6('0xc'),'port':0x18eb});var socket=require(_0xeca6('0xd'))(new Redis(config[_0xeca6('0xe')]));require(_0xeca6('0xf'))[_0xeca6('0x10')](socket);function respondWithRpcPromise(_0x4a3a13,_0xbf428e,_0xd946bf){return new BPromise(function(_0x31db18,_0x1499a2){return client[_0xeca6('0x11')](_0x4a3a13,_0xd946bf)['then'](function(_0x1f8b3d){logger[_0xeca6('0x12')](_0xeca6('0x13'),_0xbf428e,_0xeca6('0x14'));logger[_0xeca6('0x15')](_0xeca6('0x16'),_0xbf428e,'request\x20sent',JSON['stringify'](_0x1f8b3d));if(_0x1f8b3d[_0xeca6('0x17')]){if(_0x1f8b3d[_0xeca6('0x17')][_0xeca6('0x18')]===0x1f4){logger[_0xeca6('0x17')]('VoicePrefix,\x20%s,\x20%s',_0xbf428e,_0x1f8b3d[_0xeca6('0x17')]['message']);return _0x1499a2(_0x1f8b3d[_0xeca6('0x17')][_0xeca6('0x19')]);}logger[_0xeca6('0x17')](_0xeca6('0x13'),_0xbf428e,_0x1f8b3d[_0xeca6('0x17')]['message']);return _0x31db18(_0x1f8b3d[_0xeca6('0x17')]['message']);}else{logger[_0xeca6('0x12')]('VoicePrefix,\x20%s,\x20%s',_0xbf428e,_0xeca6('0x14'));_0x31db18(_0x1f8b3d[_0xeca6('0x1a')][_0xeca6('0x19')]);}})['catch'](function(_0x516b94){logger[_0xeca6('0x17')](_0xeca6('0x13'),_0xbf428e,_0x516b94);_0x1499a2(_0x516b94);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 08c6f3d..26cc111 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 _0xd757=['save','remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd757,0x1e5));var _0x7d75=function(_0x29693b,_0x3d79c8){_0x29693b=_0x29693b-0x0;var _0x46a307=_0xd757[_0x29693b];return _0x46a307;};'use strict';var VoicePrefixEvents=require(_0x7d75('0x0'));var events=[_0x7d75('0x1'),_0x7d75('0x2'),_0x7d75('0x3')];function createListener(_0x479b13,_0x4edafa){return function(_0x379a63){_0x4edafa[_0x7d75('0x4')](_0x479b13,_0x379a63);};}function removeListener(_0x5e4a4c,_0xa7df66){return function(){VoicePrefixEvents[_0x7d75('0x5')](_0x5e4a4c,_0xa7df66);};}exports[_0x7d75('0x6')]=function(_0x52bb43){for(var _0x5d6128=0x0,_0x108c0d=events[_0x7d75('0x7')];_0x5d6128<_0x108c0d;_0x5d6128++){var _0x1cf272=events[_0x5d6128];var _0x276fb0=createListener(_0x7d75('0x8')+_0x1cf272,_0x52bb43);VoicePrefixEvents['on'](_0x1cf272,_0x276fb0);}}; \ No newline at end of file +var _0x80c7=['update','removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x301ca3,_0x4233c5){var _0x131292=function(_0x4b64fd){while(--_0x4b64fd){_0x301ca3['push'](_0x301ca3['shift']());}};_0x131292(++_0x4233c5);}(_0x80c7,0x8d));var _0x780c=function(_0x39661f,_0x28623c){_0x39661f=_0x39661f-0x0;var _0x55e00a=_0x80c7[_0x39661f];return _0x55e00a;};'use strict';var VoicePrefixEvents=require(_0x780c('0x0'));var events=[_0x780c('0x1'),_0x780c('0x2'),_0x780c('0x3')];function createListener(_0x56454c,_0x5589b0){return function(_0x381187){_0x5589b0['emit'](_0x56454c,_0x381187);};}function removeListener(_0x3a8676,_0xccccf8){return function(){VoicePrefixEvents[_0x780c('0x4')](_0x3a8676,_0xccccf8);};}exports[_0x780c('0x5')]=function(_0x26db15){for(var _0x93f0bb=0x0,_0x4170ef=events[_0x780c('0x6')];_0x93f0bb<_0x4170ef;_0x93f0bb++){var _0x4041cb=events[_0x93f0bb];var _0x2d858f=createListener(_0x780c('0x7')+_0x4041cb,_0x26db15);VoicePrefixEvents['on'](_0x4041cb,_0x2d858f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index aa5a682..94e0d20 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a69df,_0xaad1db){_0x1a69df=_0x1a69df-0x0;var _0xb82082=_0xb10b[_0x1a69df];return _0xb82082;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x22c305,_0xc10e90){var _0x11809a=function(_0x2711f6){while(--_0x2711f6){_0x22c305['push'](_0x22c305['shift']());}};_0x11809a(++_0xc10e90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 828910b..599a4e1 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 _0xa273=['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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#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)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','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)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','dialMethod','strategy','preview','booked','includes','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX'];(function(_0x501401,_0x2d8737){var _0xfd0a47=function(_0x57decb){while(--_0x57decb){_0x501401['push'](_0x501401['shift']());}};_0xfd0a47(++_0x2d8737);}(_0xa273,0x79));var _0x3a27=function(_0x257fc0,_0x4fac5b){_0x257fc0=_0x257fc0-0x0;var _0x51859d=_0xa273[_0x257fc0];return _0x51859d;};'use strict';var Sequelize=require(_0x3a27('0x0'));module[_0x3a27('0x1')]={'name':{'type':Sequelize[_0x3a27('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3a27('0x3')]('inbound',_0x3a27('0x4')),'allowNull':![],'defaultValue':_0x3a27('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x3a27('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x3a27('0x3')]('rr',_0x3a27('0x7'),_0x3a27('0x8'),_0x3a27('0x9'),'random',_0x3a27('0xa'),_0x3a27('0xb'),_0x3a27('0xc'),_0x3a27('0xd')),'allowNull':![],'defaultValue':_0x3a27('0x7'),'set':function(_0x407570){this[_0x3a27('0xe')]('strategy',_0x407570?_0x407570:_0x3a27('0xa'));},'get':function(){var _0xc9ebd5=this['getDataValue']('type');var _0x554747=this[_0x3a27('0xf')](_0x3a27('0x10'));var _0x1a088a=this[_0x3a27('0xf')](_0x3a27('0x11'));if(_0xc9ebd5===_0x3a27('0x4')){if(_0x554747===_0x3a27('0x12')){return null;}if(_0x554747===_0x3a27('0x13')&&![_0x3a27('0xa'),'roundrobin'][_0x3a27('0x14')](_0x1a088a)){this[_0x3a27('0xe')](_0x3a27('0x11'),_0x3a27('0xa'));}}return _0x1a088a;}},'servicelevel':{'type':Sequelize[_0x3a27('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x3a27('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3a27('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3a27('0x2')]},'weight':{'type':Sequelize[_0x3a27('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x3a27('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3a27('0x3')](_0x3a27('0x16'),'no'),'defaultValue':_0x3a27('0x16')},'autopause':{'type':Sequelize[_0x3a27('0x3')]('yes','no',_0x3a27('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3a27('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x3a27('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3a27('0x3')](_0x3a27('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3a27('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x3a27('0x3')](_0x3a27('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x3a27('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x3a27('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3a27('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3a27('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3a27('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3a27('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x3a27('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3a27('0x3')](_0x3a27('0x16'),'no'),'defaultValue':_0x3a27('0x16')},'announce_holdtime':{'type':Sequelize[_0x3a27('0x3')](_0x3a27('0x16'),'no',_0x3a27('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3a27('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3a27('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3a27('0x2')]},'queue_youarenext':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3a27('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3a27('0x2')]},'queue_quantity1':{'type':Sequelize[_0x3a27('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x3a27('0x2')]},'queue_less_than':{'type':Sequelize[_0x3a27('0x2')]},'periodic_announce':{'type':Sequelize[_0x3a27('0x19')],'set':function(_0x22642c){this[_0x3a27('0xe')]('periodic_announce',_0x22642c?_0x22642c[_0x3a27('0x1a')](','):[]);},'get':function(){return this[_0x3a27('0xf')](_0x3a27('0x1b'))?this[_0x3a27('0xf')](_0x3a27('0x1b'))[_0x3a27('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x3a27('0x16'),'set':function(_0x40162b){this[_0x3a27('0xe')](_0x3a27('0x1d'),_0x40162b?_0x40162b[_0x3a27('0x1a')](','):undefined);},'get':function(){return this[_0x3a27('0xf')]('joinempty')?this[_0x3a27('0xf')]('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':'no','set':function(_0x1de142){this[_0x3a27('0xe')](_0x3a27('0x1e'),_0x1de142?_0x1de142[_0x3a27('0x1a')](','):undefined);},'get':function(){return this[_0x3a27('0xf')]('leavewhenempty')?this['getDataValue'](_0x3a27('0x1e'))[_0x3a27('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3a27('0x3')](_0x3a27('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3a27('0x3')](_0x3a27('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3a27('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3a27('0x3')](_0x3a27('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3a27('0x2')]},'acw':{'type':Sequelize[_0x3a27('0x1f')],'defaultValue':0x0,'set':function(_0x211765){this[_0x3a27('0xe')](_0x3a27('0x20'),_0x211765);if(_0x211765){if(this[_0x3a27('0xf')]('wrapuptime')<0x2){this[_0x3a27('0xe')](_0x3a27('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3a27('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3a27('0x1f')],'defaultValue':0x0,'comment':_0x3a27('0x22')},'dialMethod':{'type':Sequelize[_0x3a27('0x3')](_0x3a27('0x12'),_0x3a27('0x23'),_0x3a27('0x24'),_0x3a27('0x25'),_0x3a27('0x13')),'defaultValue':_0x3a27('0x23'),'comment':_0x3a27('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x3a27('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x3a27('0x15')](0x4)[_0x3a27('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3a27('0x28')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x3a27('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x3a27('0x29')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x3a27('0x2a')),'defaultValue':_0x3a27('0x2a'),'comment':_0x3a27('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x3a27('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x3a27('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3a27('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3a27('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3a27('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x3a27('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a27('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':_0x3a27('0x2e'),'comment':_0x3a27('0x2f')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a27('0x30')},'dialQueueProject':{'type':Sequelize[_0x3a27('0x2')],'comment':_0x3a27('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3a27('0x15')](0x3)[_0x3a27('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a27('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3a27('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a27('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3a27('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a27('0x34')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3a27('0x15')](0x3)[_0x3a27('0x27')],'defaultValue':0x3,'comment':_0x3a27('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3a27('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a27('0x36')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3a27('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3a27('0x37')},'dialTimezone':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':_0x3a27('0x38')},'dialPrefix':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x3a27('0x39'),'never',_0x3a27('0x3a')),'defaultValue':_0x3a27('0x39')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3a27('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x3a27('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3a27('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3a27('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3a27('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3a27('0x15')](0x9)[_0x3a27('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3a27('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0x3a27('0x15')](0x9)[_0x3a27('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3a27('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3a27('0x15')](0x9)[_0x3a27('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3a27('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3a27('0x15')](0x9)[_0x3a27('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x3a27('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3a27('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3a27('0x15')](0x9)[_0x3a27('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x3a27('0x15')](0x5)[_0x3a27('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x3a27('0x42')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3a27('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3a27('0x3')](_0x3a27('0x44'),_0x3a27('0x45')),'defaultValue':_0x3a27('0x44')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x3a27('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3a27('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3a27('0x15')](0x3)[_0x3a27('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3a27('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x3a27('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3a27('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3a27('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a27('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3a27('0x15')](0x5)[_0x3a27('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a27('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0x3a27('0x15')](0x3)[_0x3a27('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a27('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0x3a27('0x15')](0x5)[_0x3a27('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a27('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3a27('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a27('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3a27('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a27('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0x3a27('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a27('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3a27('0x15')](0x5)[_0x3a27('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a27('0x4f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3a27('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a27('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3a27('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a27('0x51')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3a27('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3a27('0x1f')],'defaultValue':![],'comment':_0x3a27('0x52'),'set':function(_0x2cb64f){if(!_0x2cb64f)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x3a27('0xe')](_0x3a27('0x53'),_0x2cb64f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3a27('0x15')](0x3)[_0x3a27('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3a27('0x15')](0x3)[_0x3a27('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3a27('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3a27('0x15')](0x3)[_0x3a27('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3a27('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x43e3=['joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','progressive','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).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','always','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','STRING','name','inbound','default','ENUM','ringall','leastrecent','rrmemory','linear','wrandom','strategy','getDataValue','type','outbound','preview','booked','roundrobin','setDataValue','INTEGER','all','yes','once','TEXT','join','periodic_announce','split'];(function(_0x21150b,_0xd87110){var _0x28298c=function(_0x5eb84c){while(--_0x5eb84c){_0x21150b['push'](_0x21150b['shift']());}};_0x28298c(++_0xd87110);}(_0x43e3,0x1e3));var _0x343e=function(_0x111fec,_0x55932a){_0x111fec=_0x111fec-0x0;var _0x13b1a4=_0x43e3[_0x111fec];return _0x13b1a4;};'use strict';var Sequelize=require(_0x343e('0x0'));module[_0x343e('0x1')]={'name':{'type':Sequelize[_0x343e('0x2')],'allowNull':![],'unique':_0x343e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x343e('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x343e('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x343e('0x5')},'announce':{'type':Sequelize[_0x343e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x343e('0x6')]('rr',_0x343e('0x7'),_0x343e('0x8'),'fewestcalls','random',_0x343e('0x9'),_0x343e('0xa'),_0x343e('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x28af41){this['setDataValue'](_0x343e('0xc'),_0x28af41?_0x28af41:'rrmemory');},'get':function(){var _0x17f379=this[_0x343e('0xd')](_0x343e('0xe'));var _0x3e180e=this[_0x343e('0xd')]('dialMethod');var _0x1ccaec=this['getDataValue'](_0x343e('0xc'));if(_0x17f379===_0x343e('0xf')){if(_0x3e180e===_0x343e('0x10')){return null;}if(_0x3e180e===_0x343e('0x11')&&![_0x343e('0x9'),_0x343e('0x12')]['includes'](_0x1ccaec)){this[_0x343e('0x13')](_0x343e('0xc'),_0x343e('0x9'));}}return _0x1ccaec;}},'servicelevel':{'type':Sequelize[_0x343e('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x343e('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x343e('0x2')]},'weight':{'type':Sequelize[_0x343e('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x343e('0x6')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x343e('0x6')]('yes','no',_0x343e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x343e('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x343e('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x343e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x343e('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x343e('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x343e('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x343e('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x343e('0x16'),'no'),'defaultValue':_0x343e('0x16')},'announce_holdtime':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no',_0x343e('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x343e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x343e('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x343e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x343e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x343e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x343e('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x343e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x343e('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x343e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x343e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x343e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x343e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x343e('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x343e('0x18')],'set':function(_0x5c6918){this['setDataValue']('periodic_announce',_0x5c6918?_0x5c6918[_0x343e('0x19')](','):[]);},'get':function(){return this[_0x343e('0xd')](_0x343e('0x1a'))?this['getDataValue'](_0x343e('0x1a'))[_0x343e('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x343e('0x2')],'defaultValue':_0x343e('0x16'),'set':function(_0x1e91c0){this[_0x343e('0x13')](_0x343e('0x1c'),_0x1e91c0?_0x1e91c0['join'](','):undefined);},'get':function(){return this[_0x343e('0xd')]('joinempty')?this['getDataValue']('joinempty')[_0x343e('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x343e('0x2')],'defaultValue':'no','set':function(_0x5ac6cb){this[_0x343e('0x13')](_0x343e('0x1d'),_0x5ac6cb?_0x5ac6cb[_0x343e('0x19')](','):undefined);},'get':function(){return this[_0x343e('0xd')](_0x343e('0x1d'))?this[_0x343e('0xd')]('leavewhenempty')[_0x343e('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x343e('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x343e('0x2')]},'description':{'type':Sequelize[_0x343e('0x2')]},'acw':{'type':Sequelize[_0x343e('0x1e')],'defaultValue':0x0,'set':function(_0x470083){this['setDataValue'](_0x343e('0x1f'),_0x470083);if(_0x470083){if(this[_0x343e('0xd')]('wrapuptime')<0x2){this[_0x343e('0x13')](_0x343e('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x343e('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x343e('0x1e')],'defaultValue':0x0,'comment':_0x343e('0x21')},'dialMethod':{'type':Sequelize[_0x343e('0x6')](_0x343e('0x10'),'progressive',_0x343e('0x22'),'predictive',_0x343e('0x11')),'defaultValue':_0x343e('0x23'),'comment':_0x343e('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x343e('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x343e('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x343e('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x343e('0x27')},'dialPowerLevel':{'type':Sequelize[_0x343e('0x28')](0x2)[_0x343e('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x343e('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x343e('0x6')]('agentBusyFactor',_0x343e('0x2a')),'defaultValue':_0x343e('0x2a'),'comment':_0x343e('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x343e('0x28')](0x2)[_0x343e('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x343e('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x343e('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x343e('0x14')](0x3)[_0x343e('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x343e('0x2')],'defaultValue':_0x343e('0x2e'),'comment':_0x343e('0x2f')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x343e('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x343e('0x30')},'dialQueueProject':{'type':Sequelize[_0x343e('0x2')],'comment':_0x343e('0x31')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x343e('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x343e('0x14')](0x5)[_0x343e('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x343e('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x343e('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x343e('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x343e('0x25')],'defaultValue':0x3,'comment':_0x343e('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x343e('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x343e('0x35')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x343e('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x343e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x343e('0x36')},'dialPrefix':{'type':Sequelize[_0x343e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x343e('0x6')]('always',_0x343e('0x37'),'onlyIfOpen'),'defaultValue':_0x343e('0x38')},'dialAMDActive':{'type':Sequelize[_0x343e('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x343e('0x14')](0x9)[_0x343e('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x343e('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x343e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x343e('0x14')](0x9)[_0x343e('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x343e('0x14')](0x9)[_0x343e('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x343e('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x343e('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x343e('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x343e('0x14')](0x9)[_0x343e('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x343e('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x343e('0x14')](0x5)[_0x343e('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x343e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x343e('0x14')](0x9)[_0x343e('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x343e('0x14')](0x5)[_0x343e('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x343e('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x343e('0x6')]('DESC',_0x343e('0x3f')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x343e('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x343e('0x14')](0x3)[_0x343e('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x343e('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x343e('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x343e('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x343e('0x14')](0x5)[_0x343e('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x343e('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0x343e('0x14')](0x3)[_0x343e('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x343e('0x42')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x343e('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x343e('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x343e('0x14')](0x5)[_0x343e('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x343e('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0x343e('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x343e('0x45')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x343e('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x343e('0x14')](0x3)[_0x343e('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x343e('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x343e('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x343e('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x66d333){if(!_0x66d333)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x343e('0x13')](_0x343e('0x48'),_0x66d333);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x343e('0x14')](0x3)[_0x343e('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x343e('0x14')](0x3)[_0x343e('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x343e('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x343e('0x14')](0x3)[_0x343e('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index bbae3fb..21708a1 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x3dc0e4,_0x152834){var _0x2d7e38=function(_0x3b90cf){while(--_0x3b90cf){_0x3dc0e4['push'](_0x3dc0e4['shift']());}};_0x2d7e38(++_0x152834);}(_0xa41a,0x6b));var _0xaa41=function(_0x480eee,_0x387d82){_0x480eee=_0x480eee-0x0;var _0x33b6e2=_0xa41a[_0x480eee];return _0x33b6e2;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file +var _0x55ca=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','updatedAt','VoiceQueues','UserProfileResource','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','where','rows','getHopperHistories','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','transaction','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','COALESCE(phone,\x27\x27)','push','cm_hopper_additional_phones','CmHopperId','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','phone\x20IS\x20NOT\x20NULL','removeBlackLists','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','undefined','count','offset','set','Content-Range','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','sendStatus','error','stack','name','send','index','map','VoiceQueue','key','getOptions','include','query','findAll','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options'];(function(_0x3ec4bb,_0xce2e57){var _0x34c410=function(_0x1d1607){while(--_0x1d1607){_0x3ec4bb['push'](_0x3ec4bb['shift']());}};_0x34c410(++_0xce2e57);}(_0x55ca,0x126));var _0xa55c=function(_0x101d5b,_0x40cfd){_0x101d5b=_0x101d5b-0x0;var _0x382a50=_0x55ca[_0x101d5b];return _0x382a50;};'use strict';var moment=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa55c('0x2'));var qs=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var db=require(_0xa55c('0x6'))['db'];config[_0xa55c('0x7')]=_[_0xa55c('0x8')](config[_0xa55c('0x7')],{'host':_0xa55c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0x7')]));require(_0xa55c('0xa'))['register'](socket);function respondWithStatusCode(_0x291996,_0x290d28){_0x290d28=_0x290d28||0xcc;return function(_0x52a3bc){if(_0x52a3bc){return _0x291996['sendStatus'](_0x290d28);}return _0x291996[_0xa55c('0xb')](_0x290d28)[_0xa55c('0xc')]();};}function respondWithResult(_0x381d07,_0x5d8e5a){_0x5d8e5a=_0x5d8e5a||0xc8;return function(_0x31646d){if(_0x31646d){return _0x381d07[_0xa55c('0xb')](_0x5d8e5a)[_0xa55c('0xd')](_0x31646d);}};}function respondWithFilteredResult(_0x70c2de,_0x3998f7){return function(_0x15eec8){if(_0x15eec8){var _0x5d47ff=typeof _0x3998f7['offset']===_0xa55c('0xe')&&typeof _0x3998f7['limit']==='undefined';var _0x59ea8d=_0x15eec8[_0xa55c('0xf')];var _0x3930e4=_0x5d47ff?0x0:_0x3998f7[_0xa55c('0x10')];var _0x938bd6=_0x5d47ff?_0x15eec8[_0xa55c('0xf')]:_0x3998f7[_0xa55c('0x10')]+_0x3998f7['limit'];var _0x3ccf65;if(_0x938bd6>=_0x59ea8d){_0x938bd6=_0x59ea8d;_0x3ccf65=0xc8;}else{_0x3ccf65=0xce;}_0x70c2de[_0xa55c('0xb')](_0x3ccf65);return _0x70c2de[_0xa55c('0x11')](_0xa55c('0x12'),_0x3930e4+'-'+_0x938bd6+'/'+_0x59ea8d)[_0xa55c('0xd')](_0x15eec8);}return null;};}function saveUpdates(_0x3ae86b){return function(_0x51590e){if(_0x51590e){return _0x51590e[_0xa55c('0x13')](_0x3ae86b)[_0xa55c('0x14')](function(_0x4cee3c){return _0x4cee3c;});}return null;};}function removeEntity(_0x3d4c9e){return function(_0x104a99){if(_0x104a99){return _0x104a99[_0xa55c('0x15')]()[_0xa55c('0x14')](function(){var _0x23a1ae=_0x104a99[_0xa55c('0x16')]({'plain':!![]});var _0x4c0daf=[{'name':'VoiceQueues','value':_0xa55c('0x17'),'ignore':![]},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19'),'ignore':![]}];var _0x4cfe10=_(_0x4c0daf)[_0xa55c('0x1a')](_0xa55c('0x1b'))['map'](_0xa55c('0x1c'))[_0xa55c('0x1c')]();if(_[_0xa55c('0x1d')](_0x4cfe10,_0x23a1ae[_0xa55c('0x1e')])){return;}var _0x234372=_['find'](_0x4c0daf,[_0xa55c('0x1c'),_0x23a1ae['type']])['name'];return db['UserProfileResource'][_0xa55c('0x15')]({'where':{'type':_0x234372,'resourceId':_0x23a1ae['id']}})['then'](function(){return _0x104a99;});})[_0xa55c('0x14')](function(){_0x3d4c9e[_0xa55c('0xb')](0xcc)[_0xa55c('0xc')]();});}};}function handleEntityNotFound(_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0xf0e574[_0xa55c('0x1f')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x20')](_0x192df2[_0xa55c('0x21')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x22')];}_0x1da633[_0xa55c('0xb')](_0x11e7f7)[_0xa55c('0x23')](_0x192df2);};}exports[_0xa55c('0x24')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={};var _0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x25')](db[_0xa55c('0x26')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x1e')][_0xa55c('0x27')]};});_0x22f6b6=qs[_0xa55c('0x28')](_0x201941,_0x5d940d);var _0x223813={'where':_0x22f6b6['where']};return db[_0xa55c('0x26')][_0xa55c('0xf')](_0x223813)[_0xa55c('0x14')](function(_0x20da31){_0x1b8388[_0xa55c('0xf')]=_0x20da31;_0x22f6b6[_0xa55c('0x29')]=qs[_0xa55c('0x29')](_0x5d940d[_0xa55c('0x2a')]);return db[_0xa55c('0x26')][_0xa55c('0x2b')](_0x22f6b6);})[_0xa55c('0x14')](function(_0x4eb7c4){_0x1b8388['rows']=_0x4eb7c4;return _0x1b8388;})[_0xa55c('0x14')](respondWithFilteredResult(_0x1377b0,_0x22f6b6))[_0xa55c('0x2c')](handleError(_0x1377b0,null));};exports['show']=function(_0x30fadd,_0x2f0110){var _0x2e9623={'raw':![],'where':{'id':_0x30fadd[_0xa55c('0x2d')]['id']}},_0x1839ac={};_0x1839ac[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x26')][_0xa55c('0x30')]);_0x1839ac['query']=_['keys'](_0x30fadd['query']);_0x1839ac[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x1839ac[_0xa55c('0x2e')],_0x1839ac['query']);_0x2e9623[_0xa55c('0x33')]=_['intersection'](_0x1839ac[_0xa55c('0x2e')],qs['fields'](_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2e9623[_0xa55c('0x33')]=_0x2e9623['attributes'][_0xa55c('0x35')]?_0x2e9623[_0xa55c('0x33')]:_0x1839ac['model'];if(_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x2e9623['include']=[{'all':!![]}];}_0x2e9623=_['merge']({},_0x2e9623,_0x30fadd[_0xa55c('0x37')]);return db['VoiceQueue'][_0xa55c('0x38')](_0x2e9623)[_0xa55c('0x14')](handleEntityNotFound(_0x2f0110,null))['then'](respondWithResult(_0x2f0110,null))['catch'](handleError(_0x2f0110,null));};exports['create']=function(_0x4de781,_0x3b3308){return db[_0xa55c('0x26')][_0xa55c('0x39')](_0x4de781[_0xa55c('0x3a')],{})[_0xa55c('0x14')](function(_0x56d17c){var _0x3d52d8=_0x4de781[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x3d52d8)throw new Error(_0xa55c('0x3c'));if(_0x3d52d8[_0xa55c('0x3d')]===_0xa55c('0x3b')){var _0x554620=_0x56d17c[_0xa55c('0x16')]({'plain':!![]});var _0x5ee63d=[{'name':'VoiceQueues','value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':'outbound'}];var _0x2bd98b=_['find'](_0x5ee63d,['value',_0x554620[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x2bd98b,'userProfileId':_0x3d52d8[_0xa55c('0x3f')]},'raw':!![]})[_0xa55c('0x14')](function(_0x5d9d5d){if(_0x5d9d5d&&_0x5d9d5d[_0xa55c('0x40')]===0x0){return db['UserProfileResource'][_0xa55c('0x39')]({'name':_0x554620[_0xa55c('0x22')],'resourceId':_0x554620['id'],'type':_0x5d9d5d['name'],'sectionId':_0x5d9d5d['id']},{})[_0xa55c('0x14')](function(){return _0x56d17c;});}else{return _0x56d17c;}})[_0xa55c('0x2c')](function(_0x5d834d){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x5d834d);throw _0x5d834d;});}return _0x56d17c;})[_0xa55c('0x14')](respondWithResult(_0x3b3308,0xc9))['catch'](handleError(_0x3b3308,null));};exports[_0xa55c('0x42')]=function(_0x582901,_0x2f9717){var _0x3a8af4={'where':{'id':_0x582901['params']['id']}},_0x451269={};_0x451269[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['VoiceQueue'][_0xa55c('0x30')]);_0x3a8af4[_0xa55c('0x33')]=_['intersection'](_0x451269[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x582901['query'][_0xa55c('0x34')]));_0x3a8af4[_0xa55c('0x33')]=_0x3a8af4[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3a8af4['attributes']:_0x451269[_0xa55c('0x2e')];if(_0x582901['query'][_0xa55c('0x36')]){_0x3a8af4[_0xa55c('0x29')]=[{'all':!![]}];}_0x3a8af4=_[_0xa55c('0x43')]({},_0x3a8af4,_0x582901['options']);return db[_0xa55c('0x26')][_0xa55c('0x38')](_0x3a8af4)['then'](handleEntityNotFound(_0x2f9717,null))[_0xa55c('0x14')](function(_0x34de95){if(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x16')]({'plain':!![]});_0x3822b7=qs[_0xa55c('0x44')](_0x3822b7,['id',_0xa55c('0x45'),_0xa55c('0x46')]);_0x582901[_0xa55c('0x3a')]=_[_0xa55c('0x44')](_0x582901[_0xa55c('0x3a')],['id','createdAt',_0xa55c('0x46')]);return db[_0xa55c('0x26')][_0xa55c('0x39')](_['merge'](_0x3822b7,_0x582901[_0xa55c('0x3a')]),{'include':_0x582901[_0xa55c('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x14')](function(_0x4fa412){var _0x2b6a0e=_0x582901[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x2b6a0e)throw new Error(_0xa55c('0x3c'));if(_0x2b6a0e[_0xa55c('0x3d')]==='user'){var _0x44b7c1=_0x4fa412[_0xa55c('0x16')]({'plain':!![]});var _0x4b85cc=[{'name':_0xa55c('0x47'),'value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19')}];var _0x50176b=_['find'](_0x4b85cc,[_0xa55c('0x1c'),_0x44b7c1[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x50176b,'userProfileId':_0x2b6a0e[_0xa55c('0x3f')]},'raw':!![]})['then'](function(_0x2742e4){if(_0x2742e4&&_0x2742e4[_0xa55c('0x40')]===0x0){return db[_0xa55c('0x48')][_0xa55c('0x39')]({'name':_0x44b7c1[_0xa55c('0x22')],'resourceId':_0x44b7c1['id'],'type':_0x2742e4['name'],'sectionId':_0x2742e4['id']},{})[_0xa55c('0x14')](function(){return _0x4fa412;});}else{return _0x4fa412;}})['catch'](function(_0x23f67f){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x23f67f);throw _0x23f67f;});}return _0x4fa412;});}})[_0xa55c('0x14')](respondWithResult(_0x2f9717,0xc9))[_0xa55c('0x2c')](handleError(_0x2f9717,null));};exports[_0xa55c('0x13')]=function(_0x5d14e0,_0x53e2be){if(_0x5d14e0[_0xa55c('0x3a')]['id']){delete _0x5d14e0[_0xa55c('0x3a')]['id'];}return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x5d14e0[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x53e2be,null))[_0xa55c('0x14')](saveUpdates(_0x5d14e0[_0xa55c('0x3a')],null))[_0xa55c('0x14')](respondWithResult(_0x53e2be,null))[_0xa55c('0x2c')](handleError(_0x53e2be,null));};exports[_0xa55c('0x15')]=function(_0x493f51,_0xdd92c1){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x493f51[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0xdd92c1,null))['then'](removeEntity(_0xdd92c1,null))[_0xa55c('0x2c')](handleError(_0xdd92c1,null));};exports['getHoppers']=function(_0x2e482a,_0x5e3a28){var _0x3495a7={'raw':![],'where':{}};var _0x5a8897={};var _0x34edc5={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x2e482a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x5e3a28,null))[_0xa55c('0x14')](function(_0xafaf8c){if(_0xafaf8c){_0x5a8897[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x4a')]['rawAttributes']);_0x5a8897[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x2e482a['query']);_0x5a8897[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],_0x5a8897[_0xa55c('0x2a')]);_0x3495a7[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x2e482a['query'][_0xa55c('0x34')]));_0x3495a7[_0xa55c('0x33')]=_0x3495a7[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3495a7[_0xa55c('0x33')]:_0x5a8897[_0xa55c('0x2e')];if(!_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x3495a7['limit']=qs[_0xa55c('0x4d')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x3495a7[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x3495a7[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x3495a7['where']=qs[_0xa55c('0x31')](_['pick'](_0x2e482a[_0xa55c('0x2a')],_0x5a8897[_0xa55c('0x31')]));_0x3495a7[_0xa55c('0x50')]['VoiceQueueId']=_0xafaf8c['id'];if(_0x2e482a['query'][_0xa55c('0x1a')]){_0x3495a7[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x50')],{'$or':_['map'](_0x3495a7[_0xa55c('0x33')],function(_0xd02251){var _0x8ea1c6={};_0x8ea1c6[_0xd02251]={'$like':'%'+_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x8ea1c6;})});}_0x3495a7=_['merge']({},_0x3495a7,_0x2e482a['options']);return db[_0xa55c('0x4a')][_0xa55c('0xf')]({'where':_0x3495a7[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x1af9d5){_0x34edc5['count']=_0x1af9d5;if(_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x3495a7['include']=[{'all':!![]}];}return db[_0xa55c('0x4a')][_0xa55c('0x2b')](_0x3495a7);})[_0xa55c('0x14')](function(_0x4dcb93){_0x34edc5[_0xa55c('0x51')]=_0x4dcb93;return _0x34edc5;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x5e3a28,_0x3495a7))[_0xa55c('0x2c')](handleError(_0x5e3a28,null));};exports[_0xa55c('0x52')]=function(_0x232143,_0x506f74){var _0x25bd5b={'raw':!![],'where':{}};var _0x2e2cf6={};var _0x4bf233={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x232143['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x506f74,null))[_0xa55c('0x14')](function(_0x2f13db){if(_0x2f13db){_0x2e2cf6[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x53')][_0xa55c('0x30')]);_0x2e2cf6[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x232143['query']);_0x2e2cf6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],_0x2e2cf6[_0xa55c('0x2a')]);_0x25bd5b['attributes']=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x232143[_0xa55c('0x2a')]['fields']));_0x25bd5b['attributes']=_0x25bd5b[_0xa55c('0x33')][_0xa55c('0x35')]?_0x25bd5b[_0xa55c('0x33')]:_0x2e2cf6[_0xa55c('0x2e')];if(!_0x232143['query']['hasOwnProperty'](_0xa55c('0x4c'))){_0x25bd5b[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x232143[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x25bd5b[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x232143['query'][_0xa55c('0x10')]);}_0x25bd5b['order']=qs[_0xa55c('0x4f')](_0x232143['query'][_0xa55c('0x4f')]);_0x25bd5b[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x232143[_0xa55c('0x2a')],_0x2e2cf6[_0xa55c('0x31')]));_0x25bd5b[_0xa55c('0x50')][_0xa55c('0x55')]=_0x2f13db['id'];if(_0x232143['query']['filter']){_0x25bd5b[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x25bd5b[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x25bd5b[_0xa55c('0x33')],function(_0x137728){var _0x47e8e2={};_0x47e8e2[_0x137728]={'$like':'%'+_0x232143[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x47e8e2;})});}_0x25bd5b=_[_0xa55c('0x43')]({},_0x25bd5b,_0x232143[_0xa55c('0x37')]);return db[_0xa55c('0x53')][_0xa55c('0xf')]({'where':_0x25bd5b[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x58b670){_0x4bf233[_0xa55c('0xf')]=_0x58b670;if(_0x232143[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x25bd5b[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x53')]['findAll'](_0x25bd5b);})[_0xa55c('0x14')](function(_0x2ab1f2){_0x4bf233['rows']=_0x2ab1f2;return _0x4bf233;});}})['then'](respondWithFilteredResult(_0x506f74,_0x25bd5b))[_0xa55c('0x2c')](handleError(_0x506f74,null));};exports[_0xa55c('0x56')]=function(_0x5c2229,_0x559e71){var _0x579726={'raw':!![],'where':{}};var _0x5ab79e={};var _0xf8e295={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x5c2229[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x559e71,null))[_0xa55c('0x14')](function(_0x568a5b){if(_0x568a5b){_0x5ab79e[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x57')][_0xa55c('0x30')]);_0x5ab79e['query']=_[_0xa55c('0x2f')](_0x5c2229[_0xa55c('0x2a')]);_0x5ab79e[_0xa55c('0x31')]=_['intersection'](_0x5ab79e[_0xa55c('0x2e')],_0x5ab79e['query']);_0x579726['attributes']=_[_0xa55c('0x32')](_0x5ab79e[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x579726[_0xa55c('0x33')]=_0x579726[_0xa55c('0x33')]['length']?_0x579726['attributes']:_0x5ab79e[_0xa55c('0x2e')];if(!_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x579726[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x579726[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x5c2229['query'][_0xa55c('0x10')]);}_0x579726[_0xa55c('0x4e')]=qs['sort'](_0x5c2229[_0xa55c('0x2a')]['sort']);_0x579726[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x5c2229[_0xa55c('0x2a')],_0x5ab79e[_0xa55c('0x31')]));_0x579726['where'][_0xa55c('0x55')]=_0x568a5b['id'];if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x579726[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x579726[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x579726['attributes'],function(_0x49a307){var _0x5c08e5={};_0x5c08e5[_0x49a307]={'$like':'%'+_0x5c2229[_0xa55c('0x2a')]['filter']+'%'};return _0x5c08e5;})});}_0x579726=_[_0xa55c('0x43')]({},_0x579726,_0x5c2229[_0xa55c('0x37')]);return db[_0xa55c('0x57')][_0xa55c('0xf')]({'where':_0x579726[_0xa55c('0x50')]})['then'](function(_0x253d7a){_0xf8e295['count']=_0x253d7a;if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x579726[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x57')]['findAll'](_0x579726);})[_0xa55c('0x14')](function(_0x46f8ab){_0xf8e295[_0xa55c('0x51')]=_0x46f8ab;return _0xf8e295;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x559e71,_0x579726))[_0xa55c('0x2c')](handleError(_0x559e71,null));};exports[_0xa55c('0x58')]=function(_0x270bd0,_0x472c73){var _0x5bae40={'raw':!![],'where':{}};var _0x147962={};var _0x1538dc={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x270bd0[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x472c73,null))['then'](function(_0x46124b){if(_0x46124b){_0x147962['model']=_[_0xa55c('0x2f')](db['CmHopperBlack'][_0xa55c('0x30')]);_0x147962[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x270bd0['query']);_0x147962[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x147962[_0xa55c('0x2e')],_0x147962['query']);_0x5bae40[_0xa55c('0x33')]=_['intersection'](_0x147962[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x270bd0['query'][_0xa55c('0x34')]));_0x5bae40['attributes']=_0x5bae40[_0xa55c('0x33')][_0xa55c('0x35')]?_0x5bae40['attributes']:_0x147962[_0xa55c('0x2e')];if(!_0x270bd0[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x5bae40[_0xa55c('0x4d')]=qs['limit'](_0x270bd0[_0xa55c('0x2a')]['limit']);_0x5bae40['offset']=qs[_0xa55c('0x10')](_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x5bae40[_0xa55c('0x4e')]=qs['sort'](_0x270bd0[_0xa55c('0x2a')]['sort']);_0x5bae40[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x270bd0['query'],_0x147962[_0xa55c('0x31')]));_0x5bae40['where']['VoiceQueueId']=_0x46124b['id'];if(_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x5bae40[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x5bae40[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x5bae40[_0xa55c('0x33')],function(_0x9225d9){var _0x465801={};_0x465801[_0x9225d9]={'$like':'%'+_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x465801;})});}_0x5bae40=_[_0xa55c('0x43')]({},_0x5bae40,_0x270bd0[_0xa55c('0x37')]);return db['CmHopperBlack'][_0xa55c('0xf')]({'where':_0x5bae40['where']})['then'](function(_0x5c8003){_0x1538dc[_0xa55c('0xf')]=_0x5c8003;if(_0x270bd0['query'][_0xa55c('0x36')]){_0x5bae40['include']=[{'all':!![]}];}return db[_0xa55c('0x59')]['findAll'](_0x5bae40);})['then'](function(_0xfb1954){_0x1538dc['rows']=_0xfb1954;return _0x1538dc;});}})['then'](respondWithFilteredResult(_0x472c73,_0x5bae40))[_0xa55c('0x2c')](handleError(_0x472c73,null));};exports[_0xa55c('0x5a')]=function(_0x4ba496,_0x11349d){var _0x55caeb={};var _0x294e54={};var _0x403dff;var _0x1dcd8a;return db['VoiceQueue']['findOne']({'where':{'id':_0x4ba496[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x11349d,null))[_0xa55c('0x14')](function(_0xfda07f){if(_0xfda07f){_0x403dff=_0xfda07f;_0x294e54[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x5b')][_0xa55c('0x30')]);_0x294e54['query']=_[_0xa55c('0x2f')](_0x4ba496[_0xa55c('0x2a')]);_0x294e54[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],_0x294e54[_0xa55c('0x2a')]);_0x55caeb[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],qs['fields'](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x55caeb[_0xa55c('0x33')]=_0x55caeb['attributes']['length']?_0x55caeb['attributes']:_0x294e54[_0xa55c('0x2e')];_0x55caeb['order']=qs[_0xa55c('0x4f')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x55caeb[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x4ba496[_0xa55c('0x2a')],_0x294e54[_0xa55c('0x31')]));if(_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x55caeb[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x55caeb[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x55caeb[_0xa55c('0x33')],function(_0x1c7aec){var _0xf0bcac={};_0xf0bcac[_0x1c7aec]={'$like':'%'+_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0xf0bcac;})});}_0x55caeb=_[_0xa55c('0x43')]({},_0x55caeb,_0x4ba496[_0xa55c('0x37')]);return _0x403dff[_0xa55c('0x5a')](_0x55caeb);}})[_0xa55c('0x14')](function(_0x168b3f){if(_0x168b3f){_0x1dcd8a=_0x168b3f['length'];if(!_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4b')]('nolimit')){_0x55caeb[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x55caeb[_0xa55c('0x10')]=qs['offset'](_0x4ba496[_0xa55c('0x2a')]['offset']);}return _0x403dff['getTeams'](_0x55caeb);}})[_0xa55c('0x14')](function(_0x1c9903){if(_0x1c9903){return _0x1c9903?{'count':_0x1dcd8a,'rows':_0x1c9903}:null;}})[_0xa55c('0x14')](respondWithResult(_0x11349d,null))[_0xa55c('0x2c')](handleError(_0x11349d,null));};exports[_0xa55c('0x5c')]=function(_0x23b513,_0x1e4464){var _0xd9f634=_0x23b513[_0xa55c('0x3a')][_0xa55c('0x5d')];var _0x1036b3=_[_0xa55c('0x25')](_0xd9f634,'id');return db[_0xa55c('0x5b')][_0xa55c('0x2b')]({'where':{'id':_0x1036b3},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':_0xa55c('0x5f'),'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),'interface'],'raw':!![]}]})['then'](function(_0x55a98d){if(_0x55a98d){var _0x200c28=_[_0xa55c('0x62')](_0x55a98d,function(_0x5e41b3){var _0x45b329=_0x5e41b3['get']({'plain':!![]});_0x45b329[_0xa55c('0x5f')]['forEach'](function(_0x3060f2){_0x3060f2[_0xa55c('0x63')]=_[_0xa55c('0x38')](_0xd9f634,{'id':_0x45b329['id']})[_0xa55c('0x63')];});return _0x45b329[_0xa55c('0x5f')];});return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x23b513[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x665054){return db[_0xa55c('0x64')]['transaction'](function(_0x59f3a4){return _0x665054[_0xa55c('0x5c')](_0x1036b3,{'transaction':_0x59f3a4})['then'](function(){return BPromise[_0xa55c('0x65')](_0xd9f634,function(_0x5447a4){return db[_0xa55c('0x66')][_0xa55c('0x67')]({'TeamId':_0x5447a4['id'],'VoiceQueueId':_0x23b513[_0xa55c('0x2d')]['id'],'penalty':_0x5447a4['penalty']},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){return BPromise[_0xa55c('0x65')](_0x200c28,function(_0x130c5f){return db['UserVoiceQueue'][_0xa55c('0x68')]({'where':{'UserId':_0x130c5f['id'],'VoiceQueueId':_0x23b513['params']['id']},'defaults':{'penalty':_0x130c5f[_0xa55c('0x63')]},'transaction':_0x59f3a4});});})['then'](function(){return BPromise['each'](_[_0xa55c('0x1a')](_0x200c28,{'online':!![]}),function(_0x40e121){return db[_0xa55c('0x69')]['upsert']({'membername':_0x40e121[_0xa55c('0x22')],'UserId':_0x40e121['id'],'queue_name':_0x665054[_0xa55c('0x22')],'VoiceQueueId':_0x665054['id'],'interface':_[_0xa55c('0x6a')](_0x40e121[_0xa55c('0x6b')])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0x40e121[_0xa55c('0x22')]):_0x40e121[_0xa55c('0x6b')],'paused':_0x40e121['voicePause']||![],'penalty':_0x40e121[_0xa55c('0x63')]},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){_0x200c28[_0xa55c('0x6e')](function(_0x151533){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':_0x151533['id'],'VoiceQueueId':_0x665054['id']});});});});});}})[_0xa55c('0x14')](respondWithStatusCode(_0x1e4464,null))[_0xa55c('0x2c')](handleError(_0x1e4464,null));};exports[_0xa55c('0x71')]=function(_0x261087,_0x2ef9dd){return db['Team'][_0xa55c('0x2b')]({'where':{'id':_0x261087['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa55c('0x14')](handleEntityNotFound(_0x2ef9dd,null))['then'](function(_0x302284){var _0x231499=_[_0xa55c('0x25')](_0x302284,'id');var _0x2d3e42=[];var _0x97275b=[];var _0x5c7c60=squel[_0xa55c('0x72')]();_0x5c7c60['field'](_0xa55c('0x73'))['from']('team_has_voice_queues','tq')[_0xa55c('0x74')](_0xa55c('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa55c('0x50')](_0xa55c('0x76'),_0x261087[_0xa55c('0x2d')]['id']);for(var _0x485652=0x0;_0x485652<_0x302284['length'];_0x485652+=0x1){let _0x57a1fc=_0x302284[_0x485652];for(var _0x50018c=0x0;_0x50018c<_0x57a1fc[_0xa55c('0x5f')][_0xa55c('0x35')];_0x50018c+=0x1){let _0x4c77c4=_0x57a1fc[_0xa55c('0x5f')][_0x50018c];var _0x1322a0=_0x5c7c60[_0xa55c('0x42')]();_0x1322a0['where'](_0xa55c('0x77'),_0x4c77c4['id']);_0x97275b['push'](db['sequelize']['query'](_0x1322a0[_0xa55c('0x78')](),{'type':db['sequelize'][_0xa55c('0x79')]['SELECT']})[_0xa55c('0x14')](function(_0x21e529){if(_0x21e529[_0xa55c('0x35')]===0x1){return _0x4c77c4['id'];}else{var _0x5063e7=_[_0xa55c('0x7a')](_[_0xa55c('0x25')](_0x21e529,_0xa55c('0x7b')),function(_0x16401f){return _[_0xa55c('0x1d')](_0x231499,_0x16401f);});if(_0x5063e7){return _0x4c77c4['id'];}}}));}}return BPromise[_0xa55c('0x7c')](_0x97275b)[_0xa55c('0x14')](function(_0x34d755){_0x2d3e42=_(_0x2d3e42)[_0xa55c('0x7d')](_0x34d755)['compact']()[_0xa55c('0x1c')]();return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x261087[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x2c0b71){return db['sequelize'][_0xa55c('0x7e')](function(_0x5bae58){return _0x2c0b71[_0xa55c('0x71')](_0x261087[_0xa55c('0x2a')]['ids'],{'transaction':_0x5bae58})[_0xa55c('0x14')](function(){if(!_[_0xa55c('0x7f')](_0x2d3e42)){return _0x2c0b71['removeAgents'](_0x2d3e42,{'transaction':_0x5bae58})['then'](function(){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0x261087[_0xa55c('0x2d')]['id'],'UserId':_0x2d3e42},'transaction':_0x5bae58});});}})[_0xa55c('0x14')](function(){_0x2d3e42[_0xa55c('0x6e')](function(_0x1a335b){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':_0x1a335b,'VoiceQueueId':_0x2c0b71['id']});});});});});});})['then'](respondWithStatusCode(_0x2ef9dd,null))[_0xa55c('0x2c')](handleError(_0x2ef9dd,null));};exports[_0xa55c('0x81')]=function(_0xc8cd97,_0x21a206){var _0x29469d,_0x59a69d;return db[_0xa55c('0x26')]['find']({'where':{'id':_0xc8cd97['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x21a206,null))[_0xa55c('0x14')](function(_0x6fcc){if(_0x6fcc){_0x59a69d=_0x6fcc;return _0x6fcc[_0xa55c('0x81')](_0xc8cd97['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0xc8cd97[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{})[_0xa55c('0x83')](function(_0x4295c1){for(var _0x37f242=0x0;_0x37f242<_0xc8cd97[_0xa55c('0x3a')]['ids'][_0xa55c('0x35')];_0x37f242+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':Number(_0xc8cd97[_0xa55c('0x3a')]['ids'][_0x37f242]),'VoiceQueueId':Number(_0xc8cd97[_0xa55c('0x2d')]['id'])});}return _0x4295c1;});}})[_0xa55c('0x14')](function(_0x65c752){_0x29469d=_0x65c752||[];if(_0x59a69d){return db['User'][_0xa55c('0x2b')]({'where':{'id':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x82')]},'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),_0xa55c('0x6b')],'raw':!![]});}})['then'](function(_0xcd4f3a){if(!_[_0xa55c('0x7f')](_0xcd4f3a)){var _0x496e8c=[];for(var _0x1c930b=0x0;_0x1c930b<_0xcd4f3a[_0xa55c('0x35')];_0x1c930b++){if(_0xcd4f3a[_0x1c930b][_0xa55c('0x60')]){_0x496e8c['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0xcd4f3a[_0x1c930b][_0xa55c('0x22')],'UserId':_0xcd4f3a[_0x1c930b]['id'],'queue_name':_0x59a69d[_0xa55c('0x22')],'VoiceQueueId':_0x59a69d['id'],'interface':_['isNil'](_0xcd4f3a[_0x1c930b]['interface'])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0xcd4f3a[_0x1c930b]['name']):_0xcd4f3a[_0x1c930b]['interface'],'paused':_0xcd4f3a[_0x1c930b][_0xa55c('0x61')]||![],'penalty':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x63')]||0x0}));}}return BPromise['all'](_0x496e8c);}})['then'](function(){return _0x29469d;})[_0xa55c('0x14')](respondWithResult(_0x21a206,null))['catch'](handleError(_0x21a206,null));};exports[_0xa55c('0x84')]=function(_0xe0a356,_0x5a4e69){return db[_0xa55c('0x26')]['find']({'where':{'id':_0xe0a356['params']['id']}})['then'](handleEntityNotFound(_0x5a4e69,null))['then'](function(_0x527669){if(_0x527669){return _0x527669[_0xa55c('0x84')](_0xe0a356['query'][_0xa55c('0x82')])[_0xa55c('0x14')](function(){if(_[_0xa55c('0x85')](_0xe0a356['query'][_0xa55c('0x82')])){for(var _0x111ff8=0x0;_0x111ff8<_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0xa55c('0x35')];_0x111ff8+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0x111ff8]),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}}else{socket['emit'](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')]['ids']),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}});}})[_0xa55c('0x14')](function(_0x940871){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0xe0a356[_0xa55c('0x2d')]['id'],'UserId':_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')]}})[_0xa55c('0x14')](function(){return _0x940871;});})[_0xa55c('0x14')](respondWithStatusCode(_0x5a4e69,null))[_0xa55c('0x2c')](handleError(_0x5a4e69,null));};exports[_0xa55c('0x86')]=function(_0x262d72,_0x228d12){var _0x16e229={};var _0x5c8713={};var _0x2d03b2;var _0x4b2e75;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x262d72[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x228d12,null))['then'](function(_0x537011){if(_0x537011){_0x2d03b2=_0x537011;_0x5c8713[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['User'][_0xa55c('0x30')]);_0x5c8713[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x262d72['query']);_0x5c8713[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5c8713[_0xa55c('0x2e')],_0x5c8713['query']);_0x16e229[_0xa55c('0x33')]=_['intersection'](_0x5c8713[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x16e229[_0xa55c('0x33')]=_0x16e229['attributes'][_0xa55c('0x35')]?_0x16e229[_0xa55c('0x33')]:_0x5c8713[_0xa55c('0x2e')];_0x16e229['order']=qs[_0xa55c('0x4f')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x16e229['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x262d72[_0xa55c('0x2a')],_0x5c8713[_0xa55c('0x31')]));if(_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x16e229[_0xa55c('0x50')]=_['merge'](_0x16e229[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x16e229[_0xa55c('0x33')],function(_0x100ccb){var _0x531e60={};_0x531e60[_0x100ccb]={'$like':'%'+_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x531e60;})});}_0x16e229=_[_0xa55c('0x43')]({},_0x16e229,_0x262d72[_0xa55c('0x37')]);return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0x243cf3){if(_0x243cf3){_0x4b2e75=_0x243cf3['length'];if(!_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x16e229[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x262d72['query']['limit']);_0x16e229['offset']=qs[_0xa55c('0x10')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0xb22076){if(_0xb22076){return _0xb22076?{'count':_0x4b2e75,'rows':_0xb22076}:null;}})[_0xa55c('0x14')](respondWithResult(_0x228d12,null))[_0xa55c('0x2c')](handleError(_0x228d12,null));};exports['getMembers']=function(_0x35c42c,_0x3b2174){var _0x35375e={};var _0x19a5f1={};var _0x3e7cfa;var _0xd511c0;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x35c42c['params']['id']}})['then'](handleEntityNotFound(_0x3b2174,null))['then'](function(_0x58831d){if(_0x58831d){_0x3e7cfa=_0x58831d;_0x19a5f1[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x69')][_0xa55c('0x30')]);_0x19a5f1[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x35c42c[_0xa55c('0x2a')]);_0x19a5f1[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x19a5f1[_0xa55c('0x2e')],_0x19a5f1[_0xa55c('0x2a')]);_0x35375e['attributes']=_['intersection'](_0x19a5f1[_0xa55c('0x2e')],qs['fields'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x35375e[_0xa55c('0x33')]=_0x35375e[_0xa55c('0x33')][_0xa55c('0x35')]?_0x35375e[_0xa55c('0x33')]:_0x19a5f1[_0xa55c('0x2e')];_0x35375e[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x35c42c['query'][_0xa55c('0x4f')]);_0x35375e[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x35c42c[_0xa55c('0x2a')],_0x19a5f1[_0xa55c('0x31')]));if(_0x35c42c[_0xa55c('0x2a')]['filter']){_0x35375e[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x35375e[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x35375e['attributes'],function(_0x55459c){var _0x33d58c={};_0x33d58c[_0x55459c]={'$like':'%'+_0x35c42c['query']['filter']+'%'};return _0x33d58c;})});}_0x35375e=_[_0xa55c('0x43')]({},_0x35375e,_0x35c42c[_0xa55c('0x37')]);return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})[_0xa55c('0x14')](function(_0x5184ea){if(_0x5184ea){_0xd511c0=_0x5184ea[_0xa55c('0x35')];if(!_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x35375e[_0xa55c('0x4d')]=qs['limit'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x35375e[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})['then'](function(_0x2d5e0e){return _0x2d5e0e?{'count':_0xd511c0,'rows':_0x2d5e0e}:null;})['then'](respondWithResult(_0x3b2174,null))[_0xa55c('0x2c')](handleError(_0x3b2174,null));};exports[_0xa55c('0x88')]=function(_0x3755a7,_0x50663f){var _0x50b42f={};var _0x307b39={};var _0x1319c6;var _0x536e1d;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x3755a7[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x50663f,null))[_0xa55c('0x14')](function(_0x568a42){if(_0x568a42){_0x1319c6=_0x568a42;_0x307b39[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x89')][_0xa55c('0x30')]);_0x307b39['query']=_[_0xa55c('0x2f')](_0x3755a7[_0xa55c('0x2a')]);_0x307b39[_0xa55c('0x31')]=_['intersection'](_0x307b39['model'],_0x307b39[_0xa55c('0x2a')]);_0x50b42f['attributes']=_['intersection'](_0x307b39[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x50b42f[_0xa55c('0x33')]=_0x50b42f[_0xa55c('0x33')][_0xa55c('0x35')]?_0x50b42f[_0xa55c('0x33')]:_0x307b39[_0xa55c('0x2e')];_0x50b42f[_0xa55c('0x4e')]=qs['sort'](_0x3755a7['query'][_0xa55c('0x4f')]);_0x50b42f[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x3755a7['query'],_0x307b39[_0xa55c('0x31')]));if(_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x50b42f[_0xa55c('0x50')]=_['merge'](_0x50b42f[_0xa55c('0x50')],{'$or':_['map'](_0x50b42f['attributes'],function(_0x545806){var _0x4fbb59={};_0x4fbb59[_0x545806]={'$like':'%'+_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x4fbb59;})});}_0x50b42f=_['merge']({},_0x50b42f,_0x3755a7[_0xa55c('0x37')]);return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x3899bd){if(_0x3899bd){_0x536e1d=_0x3899bd[_0xa55c('0x35')];if(!_0x3755a7[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x50b42f[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x3755a7[_0xa55c('0x2a')]['limit']);_0x50b42f['offset']=qs['offset'](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x1205cb){if(_0x1205cb){return _0x1205cb?{'count':_0x536e1d,'rows':_0x1205cb}:null;}})[_0xa55c('0x14')](respondWithResult(_0x50663f,null))[_0xa55c('0x2c')](handleError(_0x50663f,null));};exports[_0xa55c('0x8a')]=function(_0x499008,_0x4ef239){var _0x3e3208=moment()[_0xa55c('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e19d6,_0x286b33;return db['VoiceQueue']['find']({'where':{'id':_0x499008[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x4ef239,null))[_0xa55c('0x14')](function(_0x236015){if(_0x236015){_0x286b33=_0x236015;return _0x236015['addLists'](_0x499008['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0x499008[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x18e4fd){var _0x185c5b;_0x1e19d6=_0x18e4fd||[];var _0x2511fe=[];if(_0x18e4fd){for(var _0x3ba948=0x0;_0x3ba948<_0x18e4fd[_0xa55c('0x35')];_0x3ba948+=0x1){var _0x5e83e9=_0x18e4fd[_0x3ba948][_0xa55c('0x16')]({'plain':!![]});_0x286b33['dialCheckDuplicateType']=_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]?_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]:_0x286b33[_0xa55c('0x8b')];switch(_0x286b33[_0xa55c('0x8b')]){case _0xa55c('0x8c'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('phone',_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','scheduledAt')[_0xa55c('0x94')]('id',_0xa55c('0x95'))['field'](_0x5e83e9[_0xa55c('0x96')]['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')]['toString']())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()['field'](_0xa55c('0x9c'))[_0xa55c('0x97')](_0xa55c('0x9d'))[_0xa55c('0x50')]('VoiceQueueId\x20=\x20?',_0x499008['params']['id'][_0xa55c('0x78')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008['params']['id'][_0xa55c('0x78')]())))[_0xa55c('0x78')]();break;case _0xa55c('0x9e'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))['field']('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))['field']('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))['where'](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x9f'))[_0xa55c('0x97')](_0xa55c('0x8f'))[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008[_0xa55c('0x2d')]['id']['toString']())))[_0xa55c('0x78')]();break;default:_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),'VoiceQueueId',_0xa55c('0x45'),'updatedAt'],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))['field'](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL'))[_0xa55c('0x78')]();}_0x2511fe[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x185c5b));}return BPromise[_0xa55c('0x7c')](_0x2511fe);}})[_0xa55c('0x14')](function(){var _0x4457e9=[];var _0x456cb9=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xa1'))[_0xa55c('0x90')]([_0xa55c('0xa2'),_0xa55c('0x91'),'OrderBy',_0xa55c('0x45'),_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0xa3'))['field']('ci.item')['field']('ci.OrderBy+1')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0xa4'),'ci')[_0xa55c('0x74')](_0xa55c('0x8f'),'h',_0xa55c('0xa5'))[_0xa55c('0x50')](_0xa55c('0xa6'),_0x3e3208)[_0xa55c('0x50')](_0xa55c('0xa7'),'PHONE'))[_0xa55c('0x78')]();_0x4457e9[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x456cb9));return BPromise['all'](_0x4457e9);})['then'](function(){return _0x1e19d6;})[_0xa55c('0x14')](respondWithResult(_0x4ef239,null))[_0xa55c('0x2c')](handleError(_0x4ef239,null));};exports[_0xa55c('0xa8')]=function(_0x27cd1b,_0x3ed3a5){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x27cd1b[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x3ed3a5,null))[_0xa55c('0x14')](function(_0x3def57){if(_0x3def57){return _0x3def57[_0xa55c('0xa8')](_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x4f5f1a){if(_0x4f5f1a){return db[_0xa55c('0x4a')]['destroy']({'where':{'ListId':_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x27cd1b[_0xa55c('0x2d')]['id']}})['then'](function(){return _0x4f5f1a;});}})['then'](respondWithStatusCode(_0x3ed3a5,null))[_0xa55c('0x2c')](handleError(_0x3ed3a5,null));};exports[_0xa55c('0xa9')]=function(_0x30af02,_0x5ebd8a){var _0x2420da={};var _0x2a4b78={};var _0x1e4c2d;var _0x2bf777;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x30af02[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5ebd8a,null))[_0xa55c('0x14')](function(_0x266b12){if(_0x266b12){_0x1e4c2d=_0x266b12;_0x2a4b78[_0xa55c('0x2e')]=_['keys'](db[_0xa55c('0x89')]['rawAttributes']);_0x2a4b78[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x30af02['query']);_0x2a4b78[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2a4b78[_0xa55c('0x2e')],_0x2a4b78['query']);_0x2420da[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x2a4b78['model'],qs['fields'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2420da[_0xa55c('0x33')]=_0x2420da[_0xa55c('0x33')][_0xa55c('0x35')]?_0x2420da['attributes']:_0x2a4b78[_0xa55c('0x2e')];_0x2420da['order']=qs['sort'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x2420da['where']=qs[_0xa55c('0x31')](_['pick'](_0x30af02[_0xa55c('0x2a')],_0x2a4b78[_0xa55c('0x31')]));if(_0x30af02['query'][_0xa55c('0x1a')]){_0x2420da[_0xa55c('0x50')]=_['merge'](_0x2420da[_0xa55c('0x50')],{'$or':_['map'](_0x2420da['attributes'],function(_0x37273b){var _0x1cd529={};_0x1cd529[_0x37273b]={'$like':'%'+_0x30af02[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x1cd529;})});}_0x2420da=_[_0xa55c('0x43')]({},_0x2420da,_0x30af02[_0xa55c('0x37')]);return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})['then'](function(_0x27e791){if(_0x27e791){_0x2bf777=_0x27e791[_0xa55c('0x35')];if(!_0x30af02['query'][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x2420da['limit']=qs[_0xa55c('0x4d')](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x2420da[_0xa55c('0x10')]=qs['offset'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})[_0xa55c('0x14')](function(_0x365331){if(_0x365331){return _0x365331?{'count':_0x2bf777,'rows':_0x365331}:null;}})[_0xa55c('0x14')](respondWithResult(_0x5ebd8a,null))['catch'](handleError(_0x5ebd8a,null));};exports[_0xa55c('0xaa')]=function(_0x4d7cd6,_0x1ca9bd){var _0x2bf932;return db['VoiceQueue']['find']({'where':{'id':_0x4d7cd6[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x1ca9bd,null))[_0xa55c('0x14')](function(_0x3c9d2b){if(_0x3c9d2b){return _0x3c9d2b[_0xa55c('0xaa')](_0x4d7cd6[_0xa55c('0x3a')][_0xa55c('0x82')],_['omit'](_0x4d7cd6[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x158b01){var _0x19f576;_0x2bf932=_0x158b01||[];var _0x10da4b=[];if(_0x158b01){for(var _0x3320ab=0x0;_0x3320ab<_0x158b01[_0xa55c('0x35')];_0x3320ab+=0x1){var _0x298cf5=_0x158b01[_0x3320ab][_0xa55c('0x16')]({'plain':!![]});_0x19f576=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xab'))['fromQuery']([_0xa55c('0x91'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))['field']('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x298cf5[_0xa55c('0x96')]['toString'](),'ListId')['field'](_0x4d7cd6[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),'VoiceQueueId')[_0xa55c('0x94')](_0xa55c('0xac'),_0xa55c('0x45'))[_0xa55c('0x94')](_0xa55c('0xac'),'updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')]('ListId\x20=\x20?',_0x298cf5['CmListId'][_0xa55c('0x78')]())[_0xa55c('0x50')](_0xa55c('0xad')))['toString']();_0x10da4b[_0xa55c('0xa0')](db[_0xa55c('0x64')][_0xa55c('0x2a')](_0x19f576));}return BPromise[_0xa55c('0x7c')](_0x10da4b);}})[_0xa55c('0x14')](function(){return _0x2bf932;})[_0xa55c('0x14')](respondWithResult(_0x1ca9bd,null))[_0xa55c('0x2c')](handleError(_0x1ca9bd,null));};exports[_0xa55c('0xae')]=function(_0x23862a,_0xb432d1){return db['VoiceQueue'][_0xa55c('0x38')]({'where':{'id':_0x23862a[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb432d1,null))[_0xa55c('0x14')](function(_0x5bc270){if(_0x5bc270){return _0x5bc270[_0xa55c('0xae')](_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x543b4a){if(_0x543b4a){return db[_0xa55c('0x59')]['destroy']({'where':{'ListId':_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x23862a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(){return _0x543b4a;});}})[_0xa55c('0x14')](respondWithStatusCode(_0xb432d1,null))['catch'](handleError(_0xb432d1,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 00c825f..abc8653 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 _0xf9f7=['exports','events','../../mysqldb','VoiceQueue','remove','emit','hasOwnProperty'];(function(_0x94d643,_0x4aacd4){var _0xdaf0dc=function(_0x12446f){while(--_0x12446f){_0x94d643['push'](_0x94d643['shift']());}};_0xdaf0dc(++_0x4aacd4);}(_0xf9f7,0xd3));var _0x7f9f=function(_0x5d19f8,_0x56a7bb){_0x5d19f8=_0x5d19f8-0x0;var _0x42e896=_0xf9f7[_0x5d19f8];return _0x42e896;};'use strict';var EventEmitter=require(_0x7f9f('0x0'));var VoiceQueue=require(_0x7f9f('0x1'))['db'][_0x7f9f('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7f9f('0x3')};function emitEvent(_0x234531){return function(_0x1d5969,_0x1cedf9,_0x3e0504){VoiceQueueEvents[_0x7f9f('0x4')](_0x234531+':'+_0x1d5969['id'],_0x1d5969);VoiceQueueEvents[_0x7f9f('0x4')](_0x234531,_0x1d5969);_0x3e0504(null);};}for(var e in events){if(events[_0x7f9f('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x7f9f('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x958d=['VoiceQueue','setMaxListeners','save','update','remove','emit','events','../../mysqldb'];(function(_0x414a78,_0x3fc6d0){var _0xd1afe=function(_0x3e4f91){while(--_0x3e4f91){_0x414a78['push'](_0x414a78['shift']());}};_0xd1afe(++_0x3fc6d0);}(_0x958d,0xde));var _0xd958=function(_0x5c3bbe,_0x9f24e2){_0x5c3bbe=_0x5c3bbe-0x0;var _0x11201c=_0x958d[_0x5c3bbe];return _0x11201c;};'use strict';var EventEmitter=require(_0xd958('0x0'));var VoiceQueue=require(_0xd958('0x1'))['db'][_0xd958('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd958('0x3')](0x0);var events={'afterCreate':_0xd958('0x4'),'afterUpdate':_0xd958('0x5'),'afterDestroy':_0xd958('0x6')};function emitEvent(_0xc83365){return function(_0x39a66a,_0x4bd72e,_0x48d663){VoiceQueueEvents['emit'](_0xc83365+':'+_0x39a66a['id'],_0x39a66a);VoiceQueueEvents[_0xd958('0x7')](_0xc83365,_0x39a66a);_0x48d663(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index ff122be..5919455 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3ddae5,_0x3119c0){var _0x518268=function(_0x9ee02e){while(--_0x9ee02e){_0x3ddae5['push'](_0x3ddae5['shift']());}};_0x518268(++_0x3119c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x1c4865,_0x163598){var _0x2a3640=function(_0x16e8d8){while(--_0x16e8d8){_0x1c4865['push'](_0x1c4865['shift']());}};_0x2a3640(++_0x163598);}(_0x70e0,0x17b));var _0x070e=function(_0x88e148,_0x5c1ef0){_0x88e148=_0x88e148-0x0;var _0xa75c3c=_0x70e0[_0x88e148];return _0xa75c3c;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 9a2c2fe..d6c4a50 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 _0xefeb=['ShowVoiceQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xefeb,0x74));var _0xbefe=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xefeb[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xbefe('0x0'));var util=require('util');var moment=require(_0xbefe('0x1'));var BPromise=require(_0xbefe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbefe('0x3'));var db=require(_0xbefe('0x4'))['db'];var utils=require(_0xbefe('0x5'));var logger=require(_0xbefe('0x6'))(_0xbefe('0x7'));var config=require(_0xbefe('0x8'));var jayson=require(_0xbefe('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xbefe('0xa')]=_['defaults'](config['redis'],{'host':_0xbefe('0xb'),'port':0x18eb});var socket=require(_0xbefe('0xc'))(new Redis(config[_0xbefe('0xa')]));require(_0xbefe('0xd'))[_0xbefe('0xe')](socket);function respondWithRpcPromise(_0x594b75,_0xa89415,_0x5aa08b){return new BPromise(function(_0x2f597f,_0x566e74){return client['request'](_0x594b75,_0x5aa08b)[_0xbefe('0xf')](function(_0x35a183){logger['info'](_0xbefe('0x10'),_0xa89415,'request\x20sent');logger[_0xbefe('0x11')](_0xbefe('0x12'),_0xa89415,'request\x20sent',JSON[_0xbefe('0x13')](_0x35a183));if(_0x35a183[_0xbefe('0x14')]){if(_0x35a183[_0xbefe('0x14')]['code']===0x1f4){logger[_0xbefe('0x14')]('VoiceQueue,\x20%s,\x20%s',_0xa89415,_0x35a183[_0xbefe('0x14')][_0xbefe('0x15')]);return _0x566e74(_0x35a183[_0xbefe('0x14')][_0xbefe('0x15')]);}logger[_0xbefe('0x14')](_0xbefe('0x10'),_0xa89415,_0x35a183[_0xbefe('0x14')][_0xbefe('0x15')]);return _0x2f597f(_0x35a183[_0xbefe('0x14')]['message']);}else{logger[_0xbefe('0x16')](_0xbefe('0x10'),_0xa89415,_0xbefe('0x17'));_0x2f597f(_0x35a183['result'][_0xbefe('0x15')]);}})[_0xbefe('0x18')](function(_0xd2259){logger[_0xbefe('0x14')](_0xbefe('0x10'),_0xa89415,_0xd2259);_0x566e74(_0xd2259);});});}exports[_0xbefe('0x19')]=function(_0x2d1d5a){var _0x3ecf29=this;return new Promise(function(_0x40ade8,_0x1f4b8a){return db[_0xbefe('0x1a')][_0xbefe('0x1b')]({'raw':_0x2d1d5a[_0xbefe('0x1c')]?_0x2d1d5a[_0xbefe('0x1c')][_0xbefe('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d1d5a['options']?_0x2d1d5a[_0xbefe('0x1c')][_0xbefe('0x1e')]||null:null,'attributes':_0x2d1d5a[_0xbefe('0x1c')]?_0x2d1d5a[_0xbefe('0x1c')]['attributes']||null:null,'limit':_0x2d1d5a[_0xbefe('0x1c')]?_0x2d1d5a[_0xbefe('0x1c')][_0xbefe('0x1f')]||null:null,'include':_0x2d1d5a['options']?_0x2d1d5a['options'][_0xbefe('0x20')]?_[_0xbefe('0x21')](_0x2d1d5a[_0xbefe('0x1c')]['include'],function(_0x4ca507){return{'model':db[_0x4ca507[_0xbefe('0x22')]],'as':_0x4ca507['as'],'attributes':_0x4ca507[_0xbefe('0x23')],'include':_0x4ca507[_0xbefe('0x20')]?_[_0xbefe('0x21')](_0x4ca507['include'],function(_0x27eb2b){return{'model':db[_0x27eb2b[_0xbefe('0x22')]],'as':_0x27eb2b['as'],'attributes':_0x27eb2b['attributes'],'include':_0x27eb2b['include']?_[_0xbefe('0x21')](_0x27eb2b['include'],function(_0x38bd5f){return{'model':db[_0x38bd5f['model']],'as':_0x38bd5f['as'],'attributes':_0x38bd5f[_0xbefe('0x23')]};}):[]};}):[]};}):[]:[]})[_0xbefe('0xf')](function(_0x4b0551){logger['info']('GetVoiceQueue',_0x2d1d5a);logger['debug'](_0xbefe('0x19'),_0x2d1d5a,JSON[_0xbefe('0x13')](_0x4b0551));_0x40ade8(_0x4b0551);})[_0xbefe('0x18')](function(_0x461e95){logger[_0xbefe('0x14')](_0xbefe('0x19'),_0x461e95[_0xbefe('0x15')],_0x2d1d5a);_0x1f4b8a(_0x3ecf29[_0xbefe('0x14')](0x1f4,_0x461e95[_0xbefe('0x15')]));});});};exports[_0xbefe('0x24')]=function(_0x28f687){var _0x20663d=this;return new Promise(function(_0x23044d,_0x471588){return db[_0xbefe('0x1a')][_0xbefe('0x25')]({'raw':_0x28f687['options']?_0x28f687[_0xbefe('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x28f687['options']?_0x28f687[_0xbefe('0x1c')][_0xbefe('0x1e')]||null:null,'attributes':_0x28f687['options']?_0x28f687['options'][_0xbefe('0x23')]||null:null,'include':_0x28f687[_0xbefe('0x1c')]?_0x28f687['options'][_0xbefe('0x20')]?_[_0xbefe('0x21')](_0x28f687[_0xbefe('0x1c')]['include'],function(_0x1497c1){return{'model':db[_0x1497c1['model']],'as':_0x1497c1['as'],'attributes':_0x1497c1[_0xbefe('0x23')],'include':_0x1497c1['include']?_[_0xbefe('0x21')](_0x1497c1[_0xbefe('0x20')],function(_0x52d333){return{'model':db[_0x52d333[_0xbefe('0x22')]],'as':_0x52d333['as'],'attributes':_0x52d333[_0xbefe('0x23')],'include':_0x52d333['include']?_[_0xbefe('0x21')](_0x52d333[_0xbefe('0x20')],function(_0x1c0f38){return{'model':db[_0x1c0f38[_0xbefe('0x22')]],'as':_0x1c0f38['as'],'attributes':_0x1c0f38[_0xbefe('0x23')]};}):[]};}):[]};}):[]:[]})[_0xbefe('0xf')](function(_0xba27f5){logger[_0xbefe('0x16')](_0xbefe('0x24'),_0x28f687);logger[_0xbefe('0x11')](_0xbefe('0x24'),_0x28f687,JSON[_0xbefe('0x13')](_0xba27f5));_0x23044d(_0xba27f5);})[_0xbefe('0x18')](function(_0x73cb4c){logger[_0xbefe('0x14')]('ShowVoiceQueue',_0x73cb4c['message'],_0x28f687);_0x471588(_0x20663d[_0xbefe('0x14')](0x1f4,_0x73cb4c[_0xbefe('0x15')]));});});}; \ No newline at end of file +var _0x1ebc=['debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s'];(function(_0x18f43c,_0x3a368b){var _0x5369d1=function(_0x869fa2){while(--_0x869fa2){_0x18f43c['push'](_0x18f43c['shift']());}};_0x5369d1(++_0x3a368b);}(_0x1ebc,0xc1));var _0xc1eb=function(_0x37f397,_0x2d5c7f){_0x37f397=_0x37f397-0x0;var _0x46d63c=_0x1ebc[_0x37f397];return _0x46d63c;};'use strict';var _=require(_0xc1eb('0x0'));var util=require(_0xc1eb('0x1'));var moment=require(_0xc1eb('0x2'));var BPromise=require(_0xc1eb('0x3'));var rs=require(_0xc1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1eb('0x5'))['db'];var utils=require(_0xc1eb('0x6'));var logger=require(_0xc1eb('0x7'))(_0xc1eb('0x8'));var config=require('../../config/environment');var jayson=require(_0xc1eb('0x9'));var client=jayson[_0xc1eb('0xa')][_0xc1eb('0xb')]({'port':0x232a});config[_0xc1eb('0xc')]=_[_0xc1eb('0xd')](config[_0xc1eb('0xc')],{'host':_0xc1eb('0xe'),'port':0x18eb});var socket=require(_0xc1eb('0xf'))(new Redis(config[_0xc1eb('0xc')]));require(_0xc1eb('0x10'))[_0xc1eb('0x11')](socket);function respondWithRpcPromise(_0x2aac8c,_0x3df12c,_0x4ac4c5){return new BPromise(function(_0x21a586,_0x1ff978){return client[_0xc1eb('0x12')](_0x2aac8c,_0x4ac4c5)[_0xc1eb('0x13')](function(_0x422cde){logger[_0xc1eb('0x14')](_0xc1eb('0x15'),_0x3df12c,'request\x20sent');logger[_0xc1eb('0x16')](_0xc1eb('0x17'),_0x3df12c,_0xc1eb('0x18'),JSON[_0xc1eb('0x19')](_0x422cde));if(_0x422cde[_0xc1eb('0x1a')]){if(_0x422cde[_0xc1eb('0x1a')]['code']===0x1f4){logger[_0xc1eb('0x1a')](_0xc1eb('0x15'),_0x3df12c,_0x422cde['error'][_0xc1eb('0x1b')]);return _0x1ff978(_0x422cde[_0xc1eb('0x1a')][_0xc1eb('0x1b')]);}logger[_0xc1eb('0x1a')]('VoiceQueue,\x20%s,\x20%s',_0x3df12c,_0x422cde['error'][_0xc1eb('0x1b')]);return _0x21a586(_0x422cde[_0xc1eb('0x1a')][_0xc1eb('0x1b')]);}else{logger['info'](_0xc1eb('0x15'),_0x3df12c,_0xc1eb('0x18'));_0x21a586(_0x422cde[_0xc1eb('0x1c')][_0xc1eb('0x1b')]);}})[_0xc1eb('0x1d')](function(_0x3e3e19){logger[_0xc1eb('0x1a')](_0xc1eb('0x15'),_0x3df12c,_0x3e3e19);_0x1ff978(_0x3e3e19);});});}exports[_0xc1eb('0x1e')]=function(_0x41847c){var _0xf227e5=this;return new Promise(function(_0x42d943,_0x302f7a){return db['VoiceQueue'][_0xc1eb('0x1f')]({'raw':_0x41847c['options']?_0x41847c[_0xc1eb('0x20')][_0xc1eb('0x21')]===undefined?!![]:![]:!![],'where':_0x41847c['options']?_0x41847c[_0xc1eb('0x20')][_0xc1eb('0x22')]||null:null,'attributes':_0x41847c[_0xc1eb('0x20')]?_0x41847c[_0xc1eb('0x20')][_0xc1eb('0x23')]||null:null,'limit':_0x41847c[_0xc1eb('0x20')]?_0x41847c['options'][_0xc1eb('0x24')]||null:null,'include':_0x41847c[_0xc1eb('0x20')]?_0x41847c['options'][_0xc1eb('0x25')]?_['map'](_0x41847c['options'][_0xc1eb('0x25')],function(_0x3da22){return{'model':db[_0x3da22[_0xc1eb('0x26')]],'as':_0x3da22['as'],'attributes':_0x3da22['attributes'],'include':_0x3da22[_0xc1eb('0x25')]?_[_0xc1eb('0x27')](_0x3da22[_0xc1eb('0x25')],function(_0x555126){return{'model':db[_0x555126[_0xc1eb('0x26')]],'as':_0x555126['as'],'attributes':_0x555126['attributes'],'include':_0x555126['include']?_[_0xc1eb('0x27')](_0x555126[_0xc1eb('0x25')],function(_0x15ee22){return{'model':db[_0x15ee22[_0xc1eb('0x26')]],'as':_0x15ee22['as'],'attributes':_0x15ee22['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31549d){logger['info'](_0xc1eb('0x1e'),_0x41847c);logger[_0xc1eb('0x16')](_0xc1eb('0x1e'),_0x41847c,JSON[_0xc1eb('0x19')](_0x31549d));_0x42d943(_0x31549d);})['catch'](function(_0x3e4efb){logger[_0xc1eb('0x1a')](_0xc1eb('0x1e'),_0x3e4efb['message'],_0x41847c);_0x302f7a(_0xf227e5[_0xc1eb('0x1a')](0x1f4,_0x3e4efb[_0xc1eb('0x1b')]));});});};exports[_0xc1eb('0x28')]=function(_0x4137d6){var _0x109f80=this;return new Promise(function(_0x4478e5,_0x31f81b){return db[_0xc1eb('0x29')][_0xc1eb('0x2a')]({'raw':_0x4137d6[_0xc1eb('0x20')]?_0x4137d6[_0xc1eb('0x20')][_0xc1eb('0x21')]===undefined?!![]:![]:!![],'where':_0x4137d6[_0xc1eb('0x20')]?_0x4137d6[_0xc1eb('0x20')]['where']||null:null,'attributes':_0x4137d6[_0xc1eb('0x20')]?_0x4137d6[_0xc1eb('0x20')][_0xc1eb('0x23')]||null:null,'include':_0x4137d6[_0xc1eb('0x20')]?_0x4137d6[_0xc1eb('0x20')][_0xc1eb('0x25')]?_[_0xc1eb('0x27')](_0x4137d6[_0xc1eb('0x20')][_0xc1eb('0x25')],function(_0x3bea5d){return{'model':db[_0x3bea5d[_0xc1eb('0x26')]],'as':_0x3bea5d['as'],'attributes':_0x3bea5d[_0xc1eb('0x23')],'include':_0x3bea5d['include']?_[_0xc1eb('0x27')](_0x3bea5d[_0xc1eb('0x25')],function(_0x1372e6){return{'model':db[_0x1372e6[_0xc1eb('0x26')]],'as':_0x1372e6['as'],'attributes':_0x1372e6[_0xc1eb('0x23')],'include':_0x1372e6[_0xc1eb('0x25')]?_['map'](_0x1372e6[_0xc1eb('0x25')],function(_0x21a0f1){return{'model':db[_0x21a0f1[_0xc1eb('0x26')]],'as':_0x21a0f1['as'],'attributes':_0x21a0f1[_0xc1eb('0x23')]};}):[]};}):[]};}):[]:[]})[_0xc1eb('0x13')](function(_0x44bfe2){logger[_0xc1eb('0x14')](_0xc1eb('0x28'),_0x4137d6);logger[_0xc1eb('0x16')](_0xc1eb('0x28'),_0x4137d6,JSON['stringify'](_0x44bfe2));_0x4478e5(_0x44bfe2);})['catch'](function(_0x13d332){logger[_0xc1eb('0x1a')](_0xc1eb('0x28'),_0x13d332[_0xc1eb('0x1b')],_0x4137d6);_0x31f81b(_0x109f80[_0xc1eb('0x1a')](0x1f4,_0x13d332['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index fbfb67d..853c7cf 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 _0x7355=['voiceQueue:','save','remove','update','emit','removeListener','register'];(function(_0x2869fa,_0x160b29){var _0x4d5892=function(_0x565631){while(--_0x565631){_0x2869fa['push'](_0x2869fa['shift']());}};_0x4d5892(++_0x160b29);}(_0x7355,0xe1));var _0x5735=function(_0x23e185,_0x2e0d35){_0x23e185=_0x23e185-0x0;var _0x398e5b=_0x7355[_0x23e185];return _0x398e5b;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x5735('0x0'),_0x5735('0x1'),_0x5735('0x2')];function createListener(_0x292c04,_0x6b8803){return function(_0x19fe74){_0x6b8803[_0x5735('0x3')](_0x292c04,_0x19fe74);};}function removeListener(_0x59432e,_0x4978a7){return function(){VoiceQueueEvents[_0x5735('0x4')](_0x59432e,_0x4978a7);};}exports[_0x5735('0x5')]=function(_0x3ff405){for(var _0x3927bf=0x0,_0x3ddf36=events['length'];_0x3927bf<_0x3ddf36;_0x3927bf++){var _0x43c5a5=events[_0x3927bf];var _0x44d2b6=createListener(_0x5735('0x6')+_0x43c5a5,_0x3ff405);VoiceQueueEvents['on'](_0x43c5a5,_0x44d2b6);}}; \ No newline at end of file +var _0x7eaa=['update','emit','removeListener','length','./voiceQueue.events'];(function(_0x44e6eb,_0x3d6aad){var _0x4a8912=function(_0x2626b3){while(--_0x2626b3){_0x44e6eb['push'](_0x44e6eb['shift']());}};_0x4a8912(++_0x3d6aad);}(_0x7eaa,0x86));var _0xa7ea=function(_0x3fbba1,_0x138fa4){_0x3fbba1=_0x3fbba1-0x0;var _0x5c75ac=_0x7eaa[_0x3fbba1];return _0x5c75ac;};'use strict';var VoiceQueueEvents=require(_0xa7ea('0x0'));var events=['save','remove',_0xa7ea('0x1')];function createListener(_0x566a5b,_0xa4cf48){return function(_0x3d6965){_0xa4cf48[_0xa7ea('0x2')](_0x566a5b,_0x3d6965);};}function removeListener(_0x400494,_0x332711){return function(){VoiceQueueEvents[_0xa7ea('0x3')](_0x400494,_0x332711);};}exports['register']=function(_0x9766d6){for(var _0x1597c3=0x0,_0x51af0f=events[_0xa7ea('0x4')];_0x1597c3<_0x51af0f;_0x1597c3++){var _0x54435a=events[_0x1597c3];var _0x42cd65=createListener('voiceQueue:'+_0x54435a,_0x9766d6);VoiceQueueEvents['on'](_0x54435a,_0x42cd65);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 70ea872..e767083 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 _0x8bd3=['create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','post'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x8bd3,0xad));var _0x38bd=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0x8bd3[_0x2166a3];return _0x260035;};'use strict';var multer=require(_0x38bd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x38bd('0x1'));var express=require(_0x38bd('0x2'));var router=express[_0x38bd('0x3')]();var fs_extra=require(_0x38bd('0x4'));var auth=require(_0x38bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x38bd('0x6'));var controller=require(_0x38bd('0x7'));router[_0x38bd('0x8')]('/',auth[_0x38bd('0x9')](),controller[_0x38bd('0xa')]);router[_0x38bd('0x8')](_0x38bd('0xb'),auth[_0x38bd('0x9')](),controller[_0x38bd('0xc')]);router[_0x38bd('0x8')](_0x38bd('0xd'),auth[_0x38bd('0x9')](),controller['getVoiceQueuesReport']);router[_0x38bd('0x8')](_0x38bd('0xe'),auth[_0x38bd('0x9')](),controller['show']);router[_0x38bd('0xf')]('/',auth[_0x38bd('0x9')](),controller[_0x38bd('0x10')]);router['put']('/:id',auth[_0x38bd('0x9')](),controller[_0x38bd('0x11')]);router[_0x38bd('0x12')](_0x38bd('0xe'),auth[_0x38bd('0x9')](),controller[_0x38bd('0x13')]);module[_0x38bd('0x14')]=router; \ No newline at end of file +var _0x0447=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','create','put','update','destroy','util'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x0447,0x125));var _0x7044=function(_0x1f99a5,_0x523e8b){_0x1f99a5=_0x1f99a5-0x0;var _0x20107c=_0x0447[_0x1f99a5];return _0x20107c;};'use strict';var multer=require('multer');var util=require(_0x7044('0x0'));var path=require(_0x7044('0x1'));var timeout=require(_0x7044('0x2'));var express=require('express');var router=express[_0x7044('0x3')]();var fs_extra=require(_0x7044('0x4'));var auth=require(_0x7044('0x5'));var interaction=require(_0x7044('0x6'));var config=require('../../config/environment');var controller=require(_0x7044('0x7'));router[_0x7044('0x8')]('/',auth[_0x7044('0x9')](),controller[_0x7044('0xa')]);router[_0x7044('0x8')](_0x7044('0xb'),auth[_0x7044('0x9')](),controller[_0x7044('0xc')]);router[_0x7044('0x8')](_0x7044('0xd'),auth[_0x7044('0x9')](),controller[_0x7044('0xe')]);router[_0x7044('0x8')](_0x7044('0xf'),auth['isAuthenticated'](),controller[_0x7044('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7044('0x11')]);router[_0x7044('0x12')](_0x7044('0xf'),auth['isAuthenticated'](),controller[_0x7044('0x13')]);router['delete'](_0x7044('0xf'),auth['isAuthenticated'](),controller[_0x7044('0x14')]);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 d7e1777..852626b 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 _0xcf6d=['exports','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x527494,_0xbcce51){var _0x37fb5b=function(_0xeb7282){while(--_0xeb7282){_0x527494['push'](_0x527494['shift']());}};_0x37fb5b(++_0xbcce51);}(_0xcf6d,0xde));var _0xdcf6=function(_0x5796c3,_0x3de7ed){_0x5796c3=_0x5796c3-0x0;var _0x441526=_0xcf6d[_0x5796c3];return _0x441526;};'use strict';var Sequelize=require(_0xdcf6('0x0'));var moment=require(_0xdcf6('0x1'));module[_0xdcf6('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdcf6('0x3')]},'calleridnum':{'type':Sequelize[_0xdcf6('0x3')]},'calleridname':{'type':Sequelize[_0xdcf6('0x3')]},'queue':{'type':Sequelize[_0xdcf6('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xdcf6('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x40935e){var _0x5bf7cb=moment(_0x40935e);var _0x589a75=moment(this['getDataValue'](_0xdcf6('0x5')))['format'](_0xdcf6('0x6'));var _0x59cf35=_0x5bf7cb[_0xdcf6('0x7')](_0x589a75,_0xdcf6('0x8'));this[_0xdcf6('0x9')](_0xdcf6('0xa'),_0x40935e);this['setDataValue'](_0xdcf6('0xb'),_0x59cf35||null);}},'position':{'type':Sequelize[_0xdcf6('0xc')]},'count':{'type':Sequelize[_0xdcf6('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xdcf6('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xdcf6('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xdcf6('0x4')]},'queuecallerexit':{'type':Sequelize[_0xdcf6('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xdcf6('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xdcf6('0xe')},'originalposition':{'type':Sequelize[_0xdcf6('0xc')]},'channel':{'type':Sequelize[_0xdcf6('0x3')]},'connectedlinenum':{'type':Sequelize[_0xdcf6('0x3')]},'connectedlinename':{'type':Sequelize[_0xdcf6('0x3')]},'accountcode':{'type':Sequelize[_0xdcf6('0x3')]},'context':{'type':Sequelize[_0xdcf6('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xdcf6('0xc')]},'mohtime':{'type':Sequelize[_0xdcf6('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdcf6('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xdcf6('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xdcf6('0x3')],'comment':_0xdcf6('0xf')},'transferexten':{'type':Sequelize[_0xdcf6('0x3')]},'transferuniqueid':{'type':Sequelize[_0xdcf6('0x3')]},'disposition':{'type':Sequelize[_0xdcf6('0x3')]},'secondDisposition':{'type':Sequelize[_0xdcf6('0x3')]},'thirdDisposition':{'type':Sequelize[_0xdcf6('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8f18=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','INTEGER'];(function(_0x57f45a,_0x5736ff){var _0x1f6966=function(_0x458ea0){while(--_0x458ea0){_0x57f45a['push'](_0x57f45a['shift']());}};_0x1f6966(++_0x5736ff);}(_0x8f18,0x121));var _0x88f1=function(_0x2bf3c4,_0x3563fc){_0x2bf3c4=_0x2bf3c4-0x0;var _0x237c08=_0x8f18[_0x2bf3c4];return _0x237c08;};'use strict';var Sequelize=require(_0x88f1('0x0'));var moment=require('moment');module[_0x88f1('0x1')]={'type':{'type':Sequelize[_0x88f1('0x2')]},'uniqueid':{'type':Sequelize[_0x88f1('0x2')]},'calleridnum':{'type':Sequelize[_0x88f1('0x2')]},'calleridname':{'type':Sequelize[_0x88f1('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x88f1('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x88f1('0x3')],'set':function(_0x4d61e6){var _0x45d218=moment(_0x4d61e6);var _0x19a20f=moment(this[_0x88f1('0x4')]('queuecallerjoinAt'))['format'](_0x88f1('0x5'));var _0x366acf=_0x45d218['diff'](_0x19a20f,_0x88f1('0x6'));this[_0x88f1('0x7')](_0x88f1('0x8'),_0x4d61e6);this['setDataValue']('holdtime',_0x366acf||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x88f1('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x88f1('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x88f1('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x88f1('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x88f1('0x2')],'comment':_0x88f1('0xb')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x88f1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x88f1('0x2')]},'connectedlinename':{'type':Sequelize[_0x88f1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x88f1('0x2')]},'exten':{'type':Sequelize[_0x88f1('0x2')]},'priority':{'type':Sequelize[_0x88f1('0x2')]},'holdtime':{'type':Sequelize[_0x88f1('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x88f1('0xc')},'transferexten':{'type':Sequelize[_0x88f1('0x2')]},'transferuniqueid':{'type':Sequelize[_0x88f1('0x2')]},'disposition':{'type':Sequelize[_0x88f1('0x2')]},'secondDisposition':{'type':Sequelize[_0x88f1('0x2')]},'thirdDisposition':{'type':Sequelize[_0x88f1('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 2f63a81..5f0d77b 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 _0xb946=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','json','save','update','then','destroy','error','name','send','index','map','VoiceQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','getVoiceQueuesReport','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x183682,_0x1ed726){var _0x21e9d2=function(_0x1929c5){while(--_0x1929c5){_0x183682['push'](_0x183682['shift']());}};_0x21e9d2(++_0x1ed726);}(_0xb946,0x92));var _0x6b94=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xb946[_0x3de8a4];return _0x4635cf;};'use strict';var emlformat=require(_0x6b94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b94('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b94('0x2'));var moment=require(_0x6b94('0x3'));var BPromise=require(_0x6b94('0x4'));var Mustache=require('mustache');var util=require(_0x6b94('0x5'));var path=require(_0x6b94('0x6'));var sox=require(_0x6b94('0x7'));var csv=require(_0x6b94('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b94('0x9'));var _=require(_0x6b94('0xa'));var squel=require('squel');var crypto=require(_0x6b94('0xb'));var jsforce=require(_0x6b94('0xc'));var deskjs=require(_0x6b94('0xd'));var toCsv=require(_0x6b94('0x8'));var querystring=require(_0x6b94('0xe'));var Papa=require('papaparse');var Redis=require(_0x6b94('0xf'));var authService=require(_0x6b94('0x10'));var qs=require(_0x6b94('0x11'));var as=require(_0x6b94('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b94('0x13'))(_0x6b94('0x14'));var utils=require(_0x6b94('0x15'));var config=require(_0x6b94('0x16'));var licenseUtil=require(_0x6b94('0x17'));var db=require(_0x6b94('0x18'))['db'];config[_0x6b94('0x19')]=_[_0x6b94('0x1a')](config[_0x6b94('0x19')],{'host':_0x6b94('0x1b'),'port':0x18eb});var socket=require(_0x6b94('0x1c'))(new Redis(config[_0x6b94('0x19')]));require('./voiceQueueReport.socket')[_0x6b94('0x1d')](socket);function respondWithStatusCode(_0x4edd16,_0x2593ce){_0x2593ce=_0x2593ce||0xcc;return function(_0x581ad3){if(_0x581ad3){return _0x4edd16[_0x6b94('0x1e')](_0x2593ce);}return _0x4edd16['status'](_0x2593ce)[_0x6b94('0x1f')]();};}function respondWithResult(_0x51f106,_0x632602){_0x632602=_0x632602||0xc8;return function(_0x4a589f){if(_0x4a589f){return _0x51f106[_0x6b94('0x20')](_0x632602)['json'](_0x4a589f);}};}function respondWithFilteredResult(_0x1a0383,_0x3230f2){return function(_0x365723){if(_0x365723){var _0xa6035a=typeof _0x3230f2['offset']==='undefined'&&typeof _0x3230f2[_0x6b94('0x21')]===_0x6b94('0x22');var _0x9b46ba=_0x365723['count'];var _0x23c87d=_0xa6035a?0x0:_0x3230f2[_0x6b94('0x23')];var _0x2d53d2=_0xa6035a?_0x365723[_0x6b94('0x24')]:_0x3230f2[_0x6b94('0x23')]+_0x3230f2['limit'];var _0x30200d;if(_0x2d53d2>=_0x9b46ba){_0x2d53d2=_0x9b46ba;_0x30200d=0xc8;}else{_0x30200d=0xce;}_0x1a0383[_0x6b94('0x20')](_0x30200d);return _0x1a0383[_0x6b94('0x25')](_0x6b94('0x26'),_0x23c87d+'-'+_0x2d53d2+'/'+_0x9b46ba)[_0x6b94('0x27')](_0x365723);}return null;};}function patchUpdates(_0x46b236){return function(_0xce78df){try{jsonpatch['apply'](_0xce78df,_0x46b236,!![]);}catch(_0x421781){return BPromise['reject'](_0x421781);}return _0xce78df[_0x6b94('0x28')]();};}function saveUpdates(_0x5f3eb1,_0x2d8891){return function(_0x46bed8){if(_0x46bed8){return _0x46bed8[_0x6b94('0x29')](_0x5f3eb1)[_0x6b94('0x2a')](function(_0xd9dca4){return _0xd9dca4;});}return null;};}function removeEntity(_0x3e1344,_0xbf8226){return function(_0x477d15){if(_0x477d15){return _0x477d15[_0x6b94('0x2b')]()[_0x6b94('0x2a')](function(){_0x3e1344[_0x6b94('0x20')](0xcc)[_0x6b94('0x1f')]();});}};}function handleEntityNotFound(_0x1cf08a,_0x31385e){return function(_0xb337be){if(!_0xb337be){_0x1cf08a[_0x6b94('0x1e')](0x194);}return _0xb337be;};}function handleError(_0x4bef60,_0x5f1392){_0x5f1392=_0x5f1392||0x1f4;return function(_0x25d57a){logger[_0x6b94('0x2c')](_0x25d57a['stack']);if(_0x25d57a[_0x6b94('0x2d')]){delete _0x25d57a['name'];}_0x4bef60[_0x6b94('0x20')](_0x5f1392)[_0x6b94('0x2e')](_0x25d57a);};}exports[_0x6b94('0x2f')]=function(_0x2c48ff,_0x14772a){var _0x2e2f07={},_0x1af008={},_0x5991da={'count':0x0,'rows':[]};var _0x1eadb3=_[_0x6b94('0x30')](db[_0x6b94('0x31')][_0x6b94('0x32')],function(_0x282d83){return{'name':_0x282d83['fieldName'],'type':_0x282d83[_0x6b94('0x33')][_0x6b94('0x34')]};});_0x1af008[_0x6b94('0x35')]=_['map'](_0x1eadb3,_0x6b94('0x2d'));_0x1af008[_0x6b94('0x36')]=_[_0x6b94('0x37')](_0x2c48ff[_0x6b94('0x36')]);_0x1af008[_0x6b94('0x38')]=_[_0x6b94('0x39')](_0x1af008[_0x6b94('0x35')],_0x1af008['query']);_0x2e2f07[_0x6b94('0x3a')]=_[_0x6b94('0x39')](_0x1af008[_0x6b94('0x35')],qs[_0x6b94('0x3b')](_0x2c48ff[_0x6b94('0x36')]['fields']));_0x2e2f07[_0x6b94('0x3a')]=_0x2e2f07[_0x6b94('0x3a')][_0x6b94('0x3c')]?_0x2e2f07[_0x6b94('0x3a')]:_0x1af008['model'];if(!_0x2c48ff[_0x6b94('0x36')][_0x6b94('0x3d')](_0x6b94('0x3e'))){_0x2e2f07[_0x6b94('0x21')]=qs['limit'](_0x2c48ff[_0x6b94('0x36')][_0x6b94('0x21')]);_0x2e2f07[_0x6b94('0x23')]=qs[_0x6b94('0x23')](_0x2c48ff[_0x6b94('0x36')][_0x6b94('0x23')]);}_0x2e2f07[_0x6b94('0x3f')]=qs[_0x6b94('0x40')](_0x2c48ff[_0x6b94('0x36')][_0x6b94('0x40')]);_0x2e2f07['where']=qs['filters'](_[_0x6b94('0x41')](_0x2c48ff[_0x6b94('0x36')],_0x1af008[_0x6b94('0x38')]),_0x1eadb3);if(_0x2c48ff[_0x6b94('0x36')]['filter']){_0x2e2f07[_0x6b94('0x42')]=_[_0x6b94('0x43')](_0x2e2f07['where'],{'$or':_[_0x6b94('0x30')](_0x1eadb3,function(_0x1ec261){if(_0x1ec261[_0x6b94('0x33')]!==_0x6b94('0x44')){var _0x5301df={};_0x5301df[_0x1ec261['name']]={'$like':'%'+_0x2c48ff[_0x6b94('0x36')][_0x6b94('0x45')]+'%'};return _0x5301df;}})});}_0x2e2f07=_['merge']({},_0x2e2f07,_0x2c48ff[_0x6b94('0x46')]);var _0x4b4cd6={'where':_0x2e2f07['where']};return db[_0x6b94('0x31')][_0x6b94('0x24')](_0x4b4cd6)[_0x6b94('0x2a')](function(_0x483b7a){_0x5991da['count']=_0x483b7a;if(_0x2c48ff[_0x6b94('0x36')]['includeAll']){_0x2e2f07[_0x6b94('0x47')]=[{'all':!![]}];}return db[_0x6b94('0x31')][_0x6b94('0x48')](_0x2e2f07);})[_0x6b94('0x2a')](function(_0x10899b){_0x5991da[_0x6b94('0x49')]=_0x10899b;return _0x5991da;})[_0x6b94('0x2a')](respondWithFilteredResult(_0x14772a,_0x2e2f07))[_0x6b94('0x4a')](handleError(_0x14772a,null));};exports[_0x6b94('0x4b')]=function(_0x482f0e,_0x34d4cf){var _0x2a3ab0={'raw':![],'where':{'id':_0x482f0e['params']['id']}},_0x1790a9={};_0x1790a9[_0x6b94('0x35')]=_['keys'](db[_0x6b94('0x31')][_0x6b94('0x32')]);_0x1790a9[_0x6b94('0x36')]=_[_0x6b94('0x37')](_0x482f0e['query']);_0x1790a9['filters']=_[_0x6b94('0x39')](_0x1790a9[_0x6b94('0x35')],_0x1790a9['query']);_0x2a3ab0[_0x6b94('0x3a')]=_[_0x6b94('0x39')](_0x1790a9['model'],qs[_0x6b94('0x3b')](_0x482f0e['query'][_0x6b94('0x3b')]));_0x2a3ab0['attributes']=_0x2a3ab0['attributes'][_0x6b94('0x3c')]?_0x2a3ab0[_0x6b94('0x3a')]:_0x1790a9['model'];if(_0x482f0e[_0x6b94('0x36')][_0x6b94('0x4c')]){_0x2a3ab0['include']=[{'all':!![]}];}_0x2a3ab0=_[_0x6b94('0x43')]({},_0x2a3ab0,_0x482f0e[_0x6b94('0x46')]);return db['VoiceQueueReport'][_0x6b94('0x4d')](_0x2a3ab0)[_0x6b94('0x2a')](handleEntityNotFound(_0x34d4cf,null))[_0x6b94('0x2a')](respondWithResult(_0x34d4cf,null))['catch'](handleError(_0x34d4cf,null));};exports['create']=function(_0x55a2d6,_0x21228b){return db['VoiceQueueReport'][_0x6b94('0x4e')](_0x55a2d6[_0x6b94('0x4f')],{})[_0x6b94('0x2a')](respondWithResult(_0x21228b,0xc9))['catch'](handleError(_0x21228b,null));};exports['update']=function(_0x403996,_0x5e9797){if(_0x403996[_0x6b94('0x4f')]['id']){delete _0x403996[_0x6b94('0x4f')]['id'];}return db[_0x6b94('0x31')]['find']({'where':{'id':_0x403996[_0x6b94('0x50')]['id']}})[_0x6b94('0x2a')](handleEntityNotFound(_0x5e9797,null))[_0x6b94('0x2a')](saveUpdates(_0x403996['body'],null))[_0x6b94('0x2a')](respondWithResult(_0x5e9797,null))[_0x6b94('0x4a')](handleError(_0x5e9797,null));};exports[_0x6b94('0x2b')]=function(_0x2db40e,_0x2a4525){return db['VoiceQueueReport'][_0x6b94('0x4d')]({'where':{'id':_0x2db40e[_0x6b94('0x50')]['id']}})[_0x6b94('0x2a')](handleEntityNotFound(_0x2a4525,null))[_0x6b94('0x2a')](removeEntity(_0x2a4525,null))[_0x6b94('0x4a')](handleError(_0x2a4525,null));};exports[_0x6b94('0x51')]=function(_0x5e71cf,_0x4b3e71){return db[_0x6b94('0x31')][_0x6b94('0x51')]()[_0x6b94('0x2a')](respondWithResult(_0x4b3e71,null))['catch'](handleError(_0x4b3e71,null));};exports['getVoiceQueuesReport']=function(_0x7f638b,_0x422821){var _0x2004fe={},_0xaaf6e={},_0x38b7bc={'count':0x0,'rows':[]};_0xaaf6e[_0x6b94('0x35')]=_['keys'](db[_0x6b94('0x31')][_0x6b94('0x32')]);_0xaaf6e[_0x6b94('0x36')]=_['keys'](_0x7f638b[_0x6b94('0x36')]);_0xaaf6e[_0x6b94('0x38')]=_[_0x6b94('0x39')](_0xaaf6e[_0x6b94('0x35')],_0xaaf6e['query']);_0x2004fe[_0x6b94('0x3a')]=_[_0x6b94('0x39')](_0xaaf6e[_0x6b94('0x35')],qs[_0x6b94('0x3b')](_0x7f638b[_0x6b94('0x36')][_0x6b94('0x3b')]));_0x2004fe[_0x6b94('0x3a')]=_0x2004fe[_0x6b94('0x3a')][_0x6b94('0x3c')]?_0x2004fe[_0x6b94('0x3a')]:_0xaaf6e['model'];if(!_0x7f638b[_0x6b94('0x36')]['hasOwnProperty'](_0x6b94('0x3e'))){_0x2004fe[_0x6b94('0x21')]=qs['limit'](_0x7f638b[_0x6b94('0x36')][_0x6b94('0x21')]);_0x2004fe[_0x6b94('0x23')]=qs[_0x6b94('0x23')](_0x7f638b[_0x6b94('0x36')]['offset']);}_0x2004fe[_0x6b94('0x3f')]=qs[_0x6b94('0x40')](_0x7f638b['query'][_0x6b94('0x40')]);_0x2004fe['where']=qs[_0x6b94('0x38')](_[_0x6b94('0x41')](_0x7f638b[_0x6b94('0x36')],_0xaaf6e[_0x6b94('0x38')]));if(_0x7f638b[_0x6b94('0x36')][_0x6b94('0x45')]){_0x2004fe[_0x6b94('0x42')]=_[_0x6b94('0x43')](_0x2004fe['where'],{'$or':_[_0x6b94('0x30')](_0x2004fe[_0x6b94('0x3a')],function(_0x35bbf7){var _0x147f29={};_0x147f29[_0x35bbf7]={'$like':'%'+_0x7f638b[_0x6b94('0x36')][_0x6b94('0x45')]+'%'};return _0x147f29;})});}_0x2004fe=_[_0x6b94('0x43')]({},_0x2004fe,_0x7f638b[_0x6b94('0x46')]);var _0x682184={'where':_0x2004fe[_0x6b94('0x42')]};return db[_0x6b94('0x31')][_0x6b94('0x24')](_0x682184)[_0x6b94('0x2a')](function(_0x138d1d){_0x38b7bc[_0x6b94('0x24')]=_0x138d1d;if(_0x7f638b[_0x6b94('0x36')][_0x6b94('0x4c')]){_0x2004fe['include']=[{'all':!![]}];}return db[_0x6b94('0x31')]['findAll'](_0x2004fe);})[_0x6b94('0x2a')](function(_0x4c7a98){_0x38b7bc['rows']=_0x4c7a98;return _0x38b7bc;})[_0x6b94('0x2a')](respondWithFilteredResult(_0x422821,_0x2004fe,_0x6b94('0x52')))['catch'](handleError(_0x422821,null,_0x6b94('0x52')));}; \ No newline at end of file +var _0x39e6=['rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','then','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy','end','error','stack','name','send','index','map','VoiceQueueReport'];(function(_0x54a028,_0x59baf1){var _0x5db66d=function(_0xb722e0){while(--_0xb722e0){_0x54a028['push'](_0x54a028['shift']());}};_0x5db66d(++_0x59baf1);}(_0x39e6,0x125));var _0x639e=function(_0x327346,_0x213599){_0x327346=_0x327346-0x0;var _0xa548a3=_0x39e6[_0x327346];return _0xa548a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x639e('0x0'));var zipdir=require(_0x639e('0x1'));var jsonpatch=require(_0x639e('0x2'));var rp=require(_0x639e('0x3'));var moment=require(_0x639e('0x4'));var BPromise=require(_0x639e('0x5'));var Mustache=require(_0x639e('0x6'));var util=require('util');var path=require(_0x639e('0x7'));var sox=require(_0x639e('0x8'));var csv=require(_0x639e('0x9'));var ejs=require(_0x639e('0xa'));var fs=require('fs');var fs_extra=require(_0x639e('0xb'));var _=require(_0x639e('0xc'));var squel=require('squel');var crypto=require(_0x639e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x639e('0xe'));var toCsv=require(_0x639e('0x9'));var querystring=require(_0x639e('0xf'));var Papa=require(_0x639e('0x10'));var Redis=require(_0x639e('0x11'));var authService=require(_0x639e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x639e('0x13'));var hardwareService=require(_0x639e('0x14'));var logger=require('../../config/logger')(_0x639e('0x15'));var utils=require(_0x639e('0x16'));var config=require(_0x639e('0x17'));var licenseUtil=require(_0x639e('0x18'));var db=require(_0x639e('0x19'))['db'];config[_0x639e('0x1a')]=_[_0x639e('0x1b')](config[_0x639e('0x1a')],{'host':_0x639e('0x1c'),'port':0x18eb});var socket=require(_0x639e('0x1d'))(new Redis(config[_0x639e('0x1a')]));require(_0x639e('0x1e'))['register'](socket);function respondWithStatusCode(_0x4fc3a3,_0x2482fc){_0x2482fc=_0x2482fc||0xcc;return function(_0x1d88e9){if(_0x1d88e9){return _0x4fc3a3['sendStatus'](_0x2482fc);}return _0x4fc3a3[_0x639e('0x1f')](_0x2482fc)['end']();};}function respondWithResult(_0x351d62,_0x21c438){_0x21c438=_0x21c438||0xc8;return function(_0xa1cdcc){if(_0xa1cdcc){return _0x351d62['status'](_0x21c438)[_0x639e('0x20')](_0xa1cdcc);}};}function respondWithFilteredResult(_0x1797a5,_0xd6a22a){return function(_0x3b7db5){if(_0x3b7db5){var _0x3aa4a6=typeof _0xd6a22a['offset']===_0x639e('0x21')&&typeof _0xd6a22a[_0x639e('0x22')]===_0x639e('0x21');var _0x4af25f=_0x3b7db5['count'];var _0x1b3533=_0x3aa4a6?0x0:_0xd6a22a[_0x639e('0x23')];var _0x4e61d0=_0x3aa4a6?_0x3b7db5[_0x639e('0x24')]:_0xd6a22a['offset']+_0xd6a22a['limit'];var _0x142532;if(_0x4e61d0>=_0x4af25f){_0x4e61d0=_0x4af25f;_0x142532=0xc8;}else{_0x142532=0xce;}_0x1797a5['status'](_0x142532);return _0x1797a5[_0x639e('0x25')](_0x639e('0x26'),_0x1b3533+'-'+_0x4e61d0+'/'+_0x4af25f)['json'](_0x3b7db5);}return null;};}function patchUpdates(_0x1d0561){return function(_0x29f868){try{jsonpatch[_0x639e('0x27')](_0x29f868,_0x1d0561,!![]);}catch(_0xc95de){return BPromise[_0x639e('0x28')](_0xc95de);}return _0x29f868['save']();};}function saveUpdates(_0x79050d,_0x1d25c0){return function(_0x435f42){if(_0x435f42){return _0x435f42[_0x639e('0x29')](_0x79050d)['then'](function(_0x192722){return _0x192722;});}return null;};}function removeEntity(_0x11cdde,_0x356d84){return function(_0x87b3e7){if(_0x87b3e7){return _0x87b3e7[_0x639e('0x2a')]()['then'](function(){_0x11cdde[_0x639e('0x1f')](0xcc)[_0x639e('0x2b')]();});}};}function handleEntityNotFound(_0x262d9a,_0x50c32f){return function(_0x532d4c){if(!_0x532d4c){_0x262d9a['sendStatus'](0x194);}return _0x532d4c;};}function handleError(_0x1e9b09,_0x536335){_0x536335=_0x536335||0x1f4;return function(_0x48bf16){logger[_0x639e('0x2c')](_0x48bf16[_0x639e('0x2d')]);if(_0x48bf16[_0x639e('0x2e')]){delete _0x48bf16[_0x639e('0x2e')];}_0x1e9b09[_0x639e('0x1f')](_0x536335)[_0x639e('0x2f')](_0x48bf16);};}exports[_0x639e('0x30')]=function(_0x39b6bc,_0xeaa3ff){var _0x3d71b3={},_0x21b99c={},_0x303294={'count':0x0,'rows':[]};var _0x1249e6=_[_0x639e('0x31')](db[_0x639e('0x32')][_0x639e('0x33')],function(_0x17b6e6){return{'name':_0x17b6e6[_0x639e('0x34')],'type':_0x17b6e6[_0x639e('0x35')][_0x639e('0x36')]};});_0x21b99c['model']=_[_0x639e('0x31')](_0x1249e6,_0x639e('0x2e'));_0x21b99c['query']=_['keys'](_0x39b6bc[_0x639e('0x37')]);_0x21b99c[_0x639e('0x38')]=_[_0x639e('0x39')](_0x21b99c[_0x639e('0x3a')],_0x21b99c[_0x639e('0x37')]);_0x3d71b3[_0x639e('0x3b')]=_[_0x639e('0x39')](_0x21b99c[_0x639e('0x3a')],qs[_0x639e('0x3c')](_0x39b6bc[_0x639e('0x37')]['fields']));_0x3d71b3[_0x639e('0x3b')]=_0x3d71b3[_0x639e('0x3b')][_0x639e('0x3d')]?_0x3d71b3['attributes']:_0x21b99c['model'];if(!_0x39b6bc[_0x639e('0x37')]['hasOwnProperty']('nolimit')){_0x3d71b3[_0x639e('0x22')]=qs[_0x639e('0x22')](_0x39b6bc[_0x639e('0x37')][_0x639e('0x22')]);_0x3d71b3[_0x639e('0x23')]=qs['offset'](_0x39b6bc[_0x639e('0x37')][_0x639e('0x23')]);}_0x3d71b3['order']=qs[_0x639e('0x3e')](_0x39b6bc[_0x639e('0x37')][_0x639e('0x3e')]);_0x3d71b3[_0x639e('0x3f')]=qs['filters'](_[_0x639e('0x40')](_0x39b6bc[_0x639e('0x37')],_0x21b99c[_0x639e('0x38')]),_0x1249e6);if(_0x39b6bc['query'][_0x639e('0x41')]){_0x3d71b3[_0x639e('0x3f')]=_[_0x639e('0x42')](_0x3d71b3[_0x639e('0x3f')],{'$or':_[_0x639e('0x31')](_0x1249e6,function(_0x3764c9){if(_0x3764c9[_0x639e('0x35')]!==_0x639e('0x43')){var _0x1dd225={};_0x1dd225[_0x3764c9[_0x639e('0x2e')]]={'$like':'%'+_0x39b6bc[_0x639e('0x37')][_0x639e('0x41')]+'%'};return _0x1dd225;}})});}_0x3d71b3=_[_0x639e('0x42')]({},_0x3d71b3,_0x39b6bc['options']);var _0x443b81={'where':_0x3d71b3[_0x639e('0x3f')]};return db[_0x639e('0x32')][_0x639e('0x24')](_0x443b81)[_0x639e('0x44')](function(_0x5229c1){_0x303294[_0x639e('0x24')]=_0x5229c1;if(_0x39b6bc[_0x639e('0x37')]['includeAll']){_0x3d71b3[_0x639e('0x45')]=[{'all':!![]}];}return db[_0x639e('0x32')][_0x639e('0x46')](_0x3d71b3);})[_0x639e('0x44')](function(_0x35d700){_0x303294[_0x639e('0x47')]=_0x35d700;return _0x303294;})[_0x639e('0x44')](respondWithFilteredResult(_0xeaa3ff,_0x3d71b3))[_0x639e('0x48')](handleError(_0xeaa3ff,null));};exports[_0x639e('0x49')]=function(_0x4bbb1b,_0x597074){var _0x1b1f7f={'raw':![],'where':{'id':_0x4bbb1b[_0x639e('0x4a')]['id']}},_0x316836={};_0x316836[_0x639e('0x3a')]=_[_0x639e('0x4b')](db[_0x639e('0x32')][_0x639e('0x33')]);_0x316836[_0x639e('0x37')]=_[_0x639e('0x4b')](_0x4bbb1b['query']);_0x316836['filters']=_['intersection'](_0x316836[_0x639e('0x3a')],_0x316836[_0x639e('0x37')]);_0x1b1f7f['attributes']=_[_0x639e('0x39')](_0x316836[_0x639e('0x3a')],qs['fields'](_0x4bbb1b[_0x639e('0x37')][_0x639e('0x3c')]));_0x1b1f7f[_0x639e('0x3b')]=_0x1b1f7f[_0x639e('0x3b')][_0x639e('0x3d')]?_0x1b1f7f[_0x639e('0x3b')]:_0x316836['model'];if(_0x4bbb1b[_0x639e('0x37')][_0x639e('0x4c')]){_0x1b1f7f['include']=[{'all':!![]}];}_0x1b1f7f=_[_0x639e('0x42')]({},_0x1b1f7f,_0x4bbb1b[_0x639e('0x4d')]);return db[_0x639e('0x32')][_0x639e('0x4e')](_0x1b1f7f)[_0x639e('0x44')](handleEntityNotFound(_0x597074,null))[_0x639e('0x44')](respondWithResult(_0x597074,null))[_0x639e('0x48')](handleError(_0x597074,null));};exports[_0x639e('0x4f')]=function(_0xbed2c7,_0x33bce8){return db[_0x639e('0x32')][_0x639e('0x4f')](_0xbed2c7[_0x639e('0x50')],{})['then'](respondWithResult(_0x33bce8,0xc9))[_0x639e('0x48')](handleError(_0x33bce8,null));};exports[_0x639e('0x29')]=function(_0x45e7fe,_0x2ccc67){if(_0x45e7fe[_0x639e('0x50')]['id']){delete _0x45e7fe[_0x639e('0x50')]['id'];}return db[_0x639e('0x32')]['find']({'where':{'id':_0x45e7fe[_0x639e('0x4a')]['id']}})[_0x639e('0x44')](handleEntityNotFound(_0x2ccc67,null))[_0x639e('0x44')](saveUpdates(_0x45e7fe['body'],null))[_0x639e('0x44')](respondWithResult(_0x2ccc67,null))[_0x639e('0x48')](handleError(_0x2ccc67,null));};exports[_0x639e('0x2a')]=function(_0x143291,_0x5401f5){return db[_0x639e('0x32')]['find']({'where':{'id':_0x143291['params']['id']}})['then'](handleEntityNotFound(_0x5401f5,null))[_0x639e('0x44')](removeEntity(_0x5401f5,null))['catch'](handleError(_0x5401f5,null));};exports[_0x639e('0x51')]=function(_0x40e9cd,_0x566f7a){return db[_0x639e('0x32')][_0x639e('0x51')]()[_0x639e('0x44')](respondWithResult(_0x566f7a,null))[_0x639e('0x48')](handleError(_0x566f7a,null));};exports[_0x639e('0x52')]=function(_0x2576de,_0x350ed6){var _0x1f3970={},_0x2d4d28={},_0x521a39={'count':0x0,'rows':[]};_0x2d4d28[_0x639e('0x3a')]=_['keys'](db[_0x639e('0x32')][_0x639e('0x33')]);_0x2d4d28[_0x639e('0x37')]=_['keys'](_0x2576de['query']);_0x2d4d28[_0x639e('0x38')]=_['intersection'](_0x2d4d28[_0x639e('0x3a')],_0x2d4d28[_0x639e('0x37')]);_0x1f3970[_0x639e('0x3b')]=_['intersection'](_0x2d4d28['model'],qs[_0x639e('0x3c')](_0x2576de[_0x639e('0x37')][_0x639e('0x3c')]));_0x1f3970[_0x639e('0x3b')]=_0x1f3970[_0x639e('0x3b')][_0x639e('0x3d')]?_0x1f3970[_0x639e('0x3b')]:_0x2d4d28[_0x639e('0x3a')];if(!_0x2576de['query'][_0x639e('0x53')](_0x639e('0x54'))){_0x1f3970[_0x639e('0x22')]=qs[_0x639e('0x22')](_0x2576de['query'][_0x639e('0x22')]);_0x1f3970[_0x639e('0x23')]=qs[_0x639e('0x23')](_0x2576de[_0x639e('0x37')][_0x639e('0x23')]);}_0x1f3970[_0x639e('0x55')]=qs[_0x639e('0x3e')](_0x2576de[_0x639e('0x37')][_0x639e('0x3e')]);_0x1f3970['where']=qs[_0x639e('0x38')](_[_0x639e('0x40')](_0x2576de[_0x639e('0x37')],_0x2d4d28[_0x639e('0x38')]));if(_0x2576de[_0x639e('0x37')][_0x639e('0x41')]){_0x1f3970[_0x639e('0x3f')]=_[_0x639e('0x42')](_0x1f3970[_0x639e('0x3f')],{'$or':_[_0x639e('0x31')](_0x1f3970[_0x639e('0x3b')],function(_0x1c40ab){var _0x21c608={};_0x21c608[_0x1c40ab]={'$like':'%'+_0x2576de[_0x639e('0x37')][_0x639e('0x41')]+'%'};return _0x21c608;})});}_0x1f3970=_[_0x639e('0x42')]({},_0x1f3970,_0x2576de['options']);var _0x281670={'where':_0x1f3970[_0x639e('0x3f')]};return db[_0x639e('0x32')][_0x639e('0x24')](_0x281670)['then'](function(_0x1182b2){_0x521a39['count']=_0x1182b2;if(_0x2576de[_0x639e('0x37')][_0x639e('0x4c')]){_0x1f3970[_0x639e('0x45')]=[{'all':!![]}];}return db[_0x639e('0x32')][_0x639e('0x46')](_0x1f3970);})[_0x639e('0x44')](function(_0x40ec89){_0x521a39[_0x639e('0x47')]=_0x40ec89;return _0x521a39;})[_0x639e('0x44')](respondWithFilteredResult(_0x350ed6,_0x1f3970,_0x639e('0x52')))[_0x639e('0x48')](handleError(_0x350ed6,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ffd1406..3f4feb2 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 _0xf3d2=['remove','emit','hasOwnProperty','exports','../../mysqldb','VoiceQueueReport','save','update'];(function(_0x4d2b2c,_0x13d5ec){var _0x58e0fa=function(_0x133108){while(--_0x133108){_0x4d2b2c['push'](_0x4d2b2c['shift']());}};_0x58e0fa(++_0x13d5ec);}(_0xf3d2,0x1bc));var _0x2f3d=function(_0x560d2a,_0x4a9f54){_0x560d2a=_0x560d2a-0x0;var _0x3df62d=_0xf3d2[_0x560d2a];return _0x3df62d;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x2f3d('0x0'))['db'][_0x2f3d('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2f3d('0x2'),'afterUpdate':_0x2f3d('0x3'),'afterDestroy':_0x2f3d('0x4')};function emitEvent(_0x43b520){return function(_0x8877eb,_0x2477ba,_0x2bd232){VoiceQueueReportEvents['emit'](_0x43b520+':'+_0x8877eb['id'],_0x8877eb);VoiceQueueReportEvents[_0x2f3d('0x5')](_0x43b520,_0x8877eb);_0x2bd232(null);};}for(var e in events){if(events[_0x2f3d('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x2f3d('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xb6a9=['events','../../mysqldb','setMaxListeners','update','remove','emit','exports'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0xb6a9,0x165));var _0x9b6a=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb6a9[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require(_0x9b6a('0x0'));var VoiceQueueReport=require(_0x9b6a('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9b6a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b6a('0x3'),'afterDestroy':_0x9b6a('0x4')};function emitEvent(_0x5efbdf){return function(_0x542605,_0x520df4,_0x58acff){VoiceQueueReportEvents[_0x9b6a('0x5')](_0x5efbdf+':'+_0x542605['id'],_0x542605);VoiceQueueReportEvents[_0x9b6a('0x5')](_0x5efbdf,_0x542605);_0x58acff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x9b6a('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 61c5097..06006da 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 _0xe409=['define','VoiceQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x3b0cd,_0x13056f){var _0x2ccb2b=function(_0x3451bd){while(--_0x3451bd){_0x3b0cd['push'](_0x3b0cd['shift']());}};_0x2ccb2b(++_0x13056f);}(_0xe409,0x1d7));var _0x9e40=function(_0x6f6361,_0xd3bf92){_0x6f6361=_0x6f6361-0x0;var _0x584b86=_0xe409[_0x6f6361];return _0x584b86;};'use strict';var _=require(_0x9e40('0x0'));var util=require(_0x9e40('0x1'));var logger=require(_0x9e40('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9e40('0x3'));var rp=require(_0x9e40('0x4'));var fs=require('fs');var path=require(_0x9e40('0x5'));var rimraf=require(_0x9e40('0x6'));var config=require(_0x9e40('0x7'));var attributes=require(_0x9e40('0x8'));module[_0x9e40('0x9')]=function(_0x59177e,_0x32c006){return _0x59177e[_0x9e40('0xa')](_0x9e40('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x9e40('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfaea=['exports','define','VoiceQueueReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xfaea,0x16c));var _0xafae=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0xfaea[_0x3815c2];return _0x271f88;};'use strict';var _=require('lodash');var util=require(_0xafae('0x0'));var logger=require(_0xafae('0x1'))(_0xafae('0x2'));var moment=require(_0xafae('0x3'));var BPromise=require(_0xafae('0x4'));var rp=require(_0xafae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafae('0x6'));var config=require(_0xafae('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0xafae('0x8')]=function(_0x1375fa,_0x8ddbc0){return _0x1375fa[_0xafae('0x9')](_0xafae('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xafae('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6b2c616..79310f6 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 _0x160c=['GetVoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x160c,0x1bf));var _0xc160=function(_0x4bd79e,_0x78efcf){_0x4bd79e=_0x4bd79e-0x0;var _0x23187c=_0x160c[_0x4bd79e];return _0x23187c;};'use strict';var _=require(_0xc160('0x0'));var util=require(_0xc160('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc160('0x2'));var fs=require('fs');var Redis=require(_0xc160('0x3'));var db=require(_0xc160('0x4'))['db'];var utils=require(_0xc160('0x5'));var logger=require(_0xc160('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc160('0x7'));var client=jayson[_0xc160('0x8')][_0xc160('0x9')]({'port':0x232a});config[_0xc160('0xa')]=_[_0xc160('0xb')](config[_0xc160('0xa')],{'host':_0xc160('0xc'),'port':0x18eb});var socket=require(_0xc160('0xd'))(new Redis(config[_0xc160('0xa')]));require(_0xc160('0xe'))[_0xc160('0xf')](socket);function respondWithRpcPromise(_0x4b09ab,_0x61751c,_0x29550e){return new BPromise(function(_0x5d7282,_0x3e8cfb){return client[_0xc160('0x10')](_0x4b09ab,_0x29550e)[_0xc160('0x11')](function(_0x3ab0b8){logger[_0xc160('0x12')](_0xc160('0x13'),_0x61751c,_0xc160('0x14'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x61751c,'request\x20sent',JSON[_0xc160('0x15')](_0x3ab0b8));if(_0x3ab0b8[_0xc160('0x16')]){if(_0x3ab0b8[_0xc160('0x16')][_0xc160('0x17')]===0x1f4){logger[_0xc160('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x61751c,_0x3ab0b8['error'][_0xc160('0x18')]);return _0x3e8cfb(_0x3ab0b8['error'][_0xc160('0x18')]);}logger['error'](_0xc160('0x13'),_0x61751c,_0x3ab0b8[_0xc160('0x16')][_0xc160('0x18')]);return _0x5d7282(_0x3ab0b8[_0xc160('0x16')]['message']);}else{logger[_0xc160('0x12')](_0xc160('0x13'),_0x61751c,_0xc160('0x14'));_0x5d7282(_0x3ab0b8['result']['message']);}})[_0xc160('0x19')](function(_0x3bd91f){logger[_0xc160('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x61751c,_0x3bd91f);_0x3e8cfb(_0x3bd91f);});});}exports[_0xc160('0x1a')]=function(_0x37ae9b){var _0x6c89d6=this;return new Promise(function(_0x5f435e,_0x57043f){return db['VoiceQueueReport'][_0xc160('0x1b')]({'raw':_0x37ae9b['options']?_0x37ae9b[_0xc160('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x37ae9b[_0xc160('0x1c')]?_0x37ae9b[_0xc160('0x1c')][_0xc160('0x1d')]||null:null,'attributes':_0x37ae9b[_0xc160('0x1c')]?_0x37ae9b[_0xc160('0x1c')][_0xc160('0x1e')]||null:null,'limit':_0x37ae9b[_0xc160('0x1c')]?_0x37ae9b[_0xc160('0x1c')][_0xc160('0x1f')]||null:null,'include':_0x37ae9b[_0xc160('0x1c')]?_0x37ae9b[_0xc160('0x1c')][_0xc160('0x20')]?_[_0xc160('0x21')](_0x37ae9b[_0xc160('0x1c')][_0xc160('0x20')],function(_0x11994b){return{'model':db[_0x11994b[_0xc160('0x22')]],'as':_0x11994b['as'],'attributes':_0x11994b[_0xc160('0x1e')],'include':_0x11994b['include']?_[_0xc160('0x21')](_0x11994b[_0xc160('0x20')],function(_0x55f93e){return{'model':db[_0x55f93e[_0xc160('0x22')]],'as':_0x55f93e['as'],'attributes':_0x55f93e[_0xc160('0x1e')],'include':_0x55f93e[_0xc160('0x20')]?_[_0xc160('0x21')](_0x55f93e[_0xc160('0x20')],function(_0x2657a4){return{'model':db[_0x2657a4[_0xc160('0x22')]],'as':_0x2657a4['as'],'attributes':_0x2657a4[_0xc160('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc160('0x11')](function(_0x4ace8c){logger[_0xc160('0x12')]('GetVoiceQueueReport',_0x37ae9b);logger[_0xc160('0x23')](_0xc160('0x1a'),_0x37ae9b,JSON[_0xc160('0x15')](_0x4ace8c));_0x5f435e(_0x4ace8c);})[_0xc160('0x19')](function(_0x860b0c){logger[_0xc160('0x16')](_0xc160('0x1a'),_0x860b0c[_0xc160('0x18')],_0x37ae9b);_0x57043f(_0x6c89d6[_0xc160('0x16')](0x1f4,_0x860b0c[_0xc160('0x18')]));});});};exports[_0xc160('0x24')]=function(_0xaf6067){var _0x46c54e=this;return new Promise(function(_0xa87d73,_0x2c33ea){return db[_0xc160('0x25')][_0xc160('0x26')](_0xaf6067[_0xc160('0x27')],{'raw':_0xaf6067[_0xc160('0x1c')]?_0xaf6067[_0xc160('0x1c')][_0xc160('0x28')]===undefined?!![]:![]:!![]})[_0xc160('0x11')](function(_0xa17c70){logger[_0xc160('0x12')](_0xc160('0x24'),_0xaf6067);logger[_0xc160('0x23')](_0xc160('0x24'),_0xaf6067,JSON['stringify'](_0xa17c70));_0xa87d73(_0xa17c70);})[_0xc160('0x19')](function(_0x56d7c0){logger[_0xc160('0x16')](_0xc160('0x24'),_0x56d7c0[_0xc160('0x18')],_0xaf6067);_0x2c33ea(_0x46c54e['error'](0x1f4,_0x56d7c0['message']));});});};exports[_0xc160('0x29')]=function(_0x458ead){var _0x73cb61=this;return new Promise(function(_0x372065,_0x3e9271){return db[_0xc160('0x25')][_0xc160('0x2a')](_0x458ead[_0xc160('0x27')],{'raw':_0x458ead['options']?_0x458ead['options'][_0xc160('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x458ead[_0xc160('0x1c')]?_0x458ead[_0xc160('0x1c')][_0xc160('0x1d')]||null:null,'attributes':_0x458ead['options']?_0x458ead[_0xc160('0x1c')][_0xc160('0x1e')]||null:null,'limit':_0x458ead[_0xc160('0x1c')]?_0x458ead[_0xc160('0x1c')][_0xc160('0x1f')]||null:null})[_0xc160('0x11')](function(_0xfcf58e){logger[_0xc160('0x12')]('UpdateVoiceQueueReport',_0x458ead);logger['debug'](_0xc160('0x29'),_0x458ead,JSON[_0xc160('0x15')](_0xfcf58e));_0x372065(_0xfcf58e);})[_0xc160('0x19')](function(_0x465e6d){logger[_0xc160('0x16')](_0xc160('0x29'),_0x465e6d[_0xc160('0x18')],_0x458ead);_0x3e9271(_0x73cb61[_0xc160('0x16')](0x1f4,_0x465e6d[_0xc160('0x18')]));});});}; \ No newline at end of file +var _0xe407=['options','raw','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','VoiceQueueReport','update','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','findAll'];(function(_0x8159cb,_0x18ae66){var _0x5f4410=function(_0x1c836a){while(--_0x1c836a){_0x8159cb['push'](_0x8159cb['shift']());}};_0x5f4410(++_0x18ae66);}(_0xe407,0x1ee));var _0x7e40=function(_0x4ca614,_0xf8495d){_0x4ca614=_0x4ca614-0x0;var _0x1b1745=_0xe407[_0x4ca614];return _0x1b1745;};'use strict';var _=require('lodash');var util=require(_0x7e40('0x0'));var moment=require('moment');var BPromise=require(_0x7e40('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e40('0x2'));var db=require(_0x7e40('0x3'))['db'];var utils=require(_0x7e40('0x4'));var logger=require(_0x7e40('0x5'))('rpc');var config=require(_0x7e40('0x6'));var jayson=require(_0x7e40('0x7'));var client=jayson[_0x7e40('0x8')][_0x7e40('0x9')]({'port':0x232a});config['redis']=_[_0x7e40('0xa')](config['redis'],{'host':_0x7e40('0xb'),'port':0x18eb});var socket=require(_0x7e40('0xc'))(new Redis(config[_0x7e40('0xd')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x2a5054,_0x2b9fb9,_0x29662f){return new BPromise(function(_0x2dfe19,_0x374cca){return client['request'](_0x2a5054,_0x29662f)['then'](function(_0x399fca){logger[_0x7e40('0xe')](_0x7e40('0xf'),_0x2b9fb9,_0x7e40('0x10'));logger[_0x7e40('0x11')](_0x7e40('0x12'),_0x2b9fb9,_0x7e40('0x10'),JSON[_0x7e40('0x13')](_0x399fca));if(_0x399fca[_0x7e40('0x14')]){if(_0x399fca[_0x7e40('0x14')]['code']===0x1f4){logger[_0x7e40('0x14')](_0x7e40('0xf'),_0x2b9fb9,_0x399fca[_0x7e40('0x14')][_0x7e40('0x15')]);return _0x374cca(_0x399fca['error']['message']);}logger['error'](_0x7e40('0xf'),_0x2b9fb9,_0x399fca[_0x7e40('0x14')][_0x7e40('0x15')]);return _0x2dfe19(_0x399fca[_0x7e40('0x14')][_0x7e40('0x15')]);}else{logger['info'](_0x7e40('0xf'),_0x2b9fb9,_0x7e40('0x10'));_0x2dfe19(_0x399fca[_0x7e40('0x16')][_0x7e40('0x15')]);}})[_0x7e40('0x17')](function(_0x34a3cc){logger[_0x7e40('0x14')](_0x7e40('0xf'),_0x2b9fb9,_0x34a3cc);_0x374cca(_0x34a3cc);});});}exports[_0x7e40('0x18')]=function(_0xbfb9e){var _0xf4aaf5=this;return new Promise(function(_0x1810e6,_0x155759){return db['VoiceQueueReport'][_0x7e40('0x19')]({'raw':_0xbfb9e[_0x7e40('0x1a')]?_0xbfb9e[_0x7e40('0x1a')][_0x7e40('0x1b')]===undefined?!![]:![]:!![],'where':_0xbfb9e[_0x7e40('0x1a')]?_0xbfb9e[_0x7e40('0x1a')][_0x7e40('0x1c')]||null:null,'attributes':_0xbfb9e[_0x7e40('0x1a')]?_0xbfb9e[_0x7e40('0x1a')][_0x7e40('0x1d')]||null:null,'limit':_0xbfb9e['options']?_0xbfb9e['options'][_0x7e40('0x1e')]||null:null,'include':_0xbfb9e[_0x7e40('0x1a')]?_0xbfb9e[_0x7e40('0x1a')][_0x7e40('0x1f')]?_[_0x7e40('0x20')](_0xbfb9e[_0x7e40('0x1a')][_0x7e40('0x1f')],function(_0x41da58){return{'model':db[_0x41da58['model']],'as':_0x41da58['as'],'attributes':_0x41da58[_0x7e40('0x1d')],'include':_0x41da58['include']?_[_0x7e40('0x20')](_0x41da58['include'],function(_0x26dd22){return{'model':db[_0x26dd22[_0x7e40('0x21')]],'as':_0x26dd22['as'],'attributes':_0x26dd22[_0x7e40('0x1d')],'include':_0x26dd22[_0x7e40('0x1f')]?_[_0x7e40('0x20')](_0x26dd22['include'],function(_0x18d582){return{'model':db[_0x18d582[_0x7e40('0x21')]],'as':_0x18d582['as'],'attributes':_0x18d582['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e40('0x22')](function(_0x25fc22){logger['info'](_0x7e40('0x18'),_0xbfb9e);logger[_0x7e40('0x11')](_0x7e40('0x18'),_0xbfb9e,JSON[_0x7e40('0x13')](_0x25fc22));_0x1810e6(_0x25fc22);})[_0x7e40('0x17')](function(_0x4186e4){logger['error'](_0x7e40('0x18'),_0x4186e4[_0x7e40('0x15')],_0xbfb9e);_0x155759(_0xf4aaf5[_0x7e40('0x14')](0x1f4,_0x4186e4[_0x7e40('0x15')]));});});};exports[_0x7e40('0x23')]=function(_0x13b188){var _0x5b69a0=this;return new Promise(function(_0x1ef3c5,_0x428ae9){return db['VoiceQueueReport'][_0x7e40('0x24')](_0x13b188['body'],{'raw':_0x13b188[_0x7e40('0x1a')]?_0x13b188['options'][_0x7e40('0x1b')]===undefined?!![]:![]:!![]})[_0x7e40('0x22')](function(_0x2c863f){logger[_0x7e40('0xe')]('CreateVoiceQueueReport',_0x13b188);logger[_0x7e40('0x11')](_0x7e40('0x23'),_0x13b188,JSON[_0x7e40('0x13')](_0x2c863f));_0x1ef3c5(_0x2c863f);})['catch'](function(_0x558f66){logger['error']('CreateVoiceQueueReport',_0x558f66[_0x7e40('0x15')],_0x13b188);_0x428ae9(_0x5b69a0[_0x7e40('0x14')](0x1f4,_0x558f66['message']));});});};exports[_0x7e40('0x25')]=function(_0x167962){var _0x3f0245=this;return new Promise(function(_0x52990a,_0x451444){return db[_0x7e40('0x26')][_0x7e40('0x27')](_0x167962['body'],{'raw':_0x167962['options']?_0x167962[_0x7e40('0x1a')][_0x7e40('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x167962[_0x7e40('0x1a')]?_0x167962[_0x7e40('0x1a')][_0x7e40('0x1c')]||null:null,'attributes':_0x167962[_0x7e40('0x1a')]?_0x167962[_0x7e40('0x1a')]['attributes']||null:null,'limit':_0x167962[_0x7e40('0x1a')]?_0x167962[_0x7e40('0x1a')][_0x7e40('0x1e')]||null:null})[_0x7e40('0x22')](function(_0x86cc06){logger[_0x7e40('0xe')]('UpdateVoiceQueueReport',_0x167962);logger[_0x7e40('0x11')](_0x7e40('0x25'),_0x167962,JSON[_0x7e40('0x13')](_0x86cc06));_0x52990a(_0x86cc06);})[_0x7e40('0x17')](function(_0x3f7c82){logger['error'](_0x7e40('0x25'),_0x3f7c82[_0x7e40('0x15')],_0x167962);_0x451444(_0x3f0245[_0x7e40('0x14')](0x1f4,_0x3f7c82['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3b5681b..d3d1858 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 _0xcc05=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','emit','register'];(function(_0x191f72,_0x30cf2b){var _0x423db0=function(_0x395116){while(--_0x395116){_0x191f72['push'](_0x191f72['shift']());}};_0x423db0(++_0x30cf2b);}(_0xcc05,0x95));var _0x5cc0=function(_0xc411d0,_0x118c9c){_0xc411d0=_0xc411d0-0x0;var _0xf9f573=_0xcc05[_0xc411d0];return _0xf9f573;};'use strict';var VoiceQueueReportEvents=require(_0x5cc0('0x0'));var events=[_0x5cc0('0x1'),'remove',_0x5cc0('0x2')];function createListener(_0x31acb,_0x211131){return function(_0x4f85b6){_0x211131[_0x5cc0('0x3')](_0x31acb,_0x4f85b6);};}function removeListener(_0x3148a5,_0x59924d){return function(){VoiceQueueReportEvents['removeListener'](_0x3148a5,_0x59924d);};}exports[_0x5cc0('0x4')]=function(_0x420064){for(var _0x30b9b4=0x0,_0x57768b=events[_0x5cc0('0x5')];_0x30b9b4<_0x57768b;_0x30b9b4++){var _0x14a90c=events[_0x30b9b4];var _0x35a07d=createListener(_0x5cc0('0x6')+_0x14a90c,_0x420064);VoiceQueueReportEvents['on'](_0x14a90c,_0x35a07d);}}; \ No newline at end of file +var _0xe4b8=['save','remove','update','removeListener','register','length','./voiceQueueReport.events'];(function(_0x282389,_0x212532){var _0x570170=function(_0x4e6736){while(--_0x4e6736){_0x282389['push'](_0x282389['shift']());}};_0x570170(++_0x212532);}(_0xe4b8,0x179));var _0x8e4b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe4b8[_0x2c91e9];return _0x13f0ff;};'use strict';var VoiceQueueReportEvents=require(_0x8e4b('0x0'));var events=[_0x8e4b('0x1'),_0x8e4b('0x2'),_0x8e4b('0x3')];function createListener(_0x42c835,_0x365269){return function(_0x1161a8){_0x365269['emit'](_0x42c835,_0x1161a8);};}function removeListener(_0x4fa340,_0x35e679){return function(){VoiceQueueReportEvents[_0x8e4b('0x4')](_0x4fa340,_0x35e679);};}exports[_0x8e4b('0x5')]=function(_0x47e630){for(var _0x2796f8=0x0,_0x4d0472=events[_0x8e4b('0x6')];_0x2796f8<_0x4d0472;_0x2796f8++){var _0x5642a3=events[_0x2796f8];var _0x4e0535=createListener('voiceQueueReport:'+_0x5642a3,_0x47e630);VoiceQueueReportEvents['on'](_0x5642a3,_0x4e0535);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index a289c19..6ceddd8 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 _0x6c41=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x6c41,0x98));var _0x16c4=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0x6c41[_0xf26c2e];return _0x46ecb4;};'use strict';var multer=require(_0x16c4('0x0'));var util=require(_0x16c4('0x1'));var path=require(_0x16c4('0x2'));var timeout=require(_0x16c4('0x3'));var express=require('express');var router=express[_0x16c4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x16c4('0x5'));var config=require(_0x16c4('0x6'));var controller=require(_0x16c4('0x7'));router[_0x16c4('0x8')]('/',auth[_0x16c4('0x9')](),controller[_0x16c4('0xa')]);router[_0x16c4('0x8')]('/:id',auth[_0x16c4('0x9')](),controller[_0x16c4('0xb')]);router[_0x16c4('0xc')]('/',auth[_0x16c4('0x9')](),controller[_0x16c4('0xd')]);router[_0x16c4('0xe')](_0x16c4('0xf'),auth[_0x16c4('0x9')](),controller[_0x16c4('0x10')]);router[_0x16c4('0x11')](_0x16c4('0xf'),auth[_0x16c4('0x9')](),controller[_0x16c4('0x12')]);module[_0x16c4('0x13')]=router; \ No newline at end of file +var _0x0f2c=['get','isAuthenticated','/:id','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x45d705,_0x13cd3e){var _0x46e9b6=function(_0x2ce03f){while(--_0x2ce03f){_0x45d705['push'](_0x45d705['shift']());}};_0x46e9b6(++_0x13cd3e);}(_0x0f2c,0x125));var _0xc0f2=function(_0x9be2c7,_0x1c5232){_0x9be2c7=_0x9be2c7-0x0;var _0x782efb=_0x0f2c[_0x9be2c7];return _0x782efb;};'use strict';var multer=require('multer');var util=require(_0xc0f2('0x0'));var path=require(_0xc0f2('0x1'));var timeout=require(_0xc0f2('0x2'));var express=require(_0xc0f2('0x3'));var router=express['Router']();var fs_extra=require(_0xc0f2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc0f2('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0xc0f2('0x6')]('/',auth[_0xc0f2('0x7')](),controller['index']);router[_0xc0f2('0x6')](_0xc0f2('0x8'),auth[_0xc0f2('0x7')](),controller['show']);router['post']('/',auth[_0xc0f2('0x7')](),controller['create']);router[_0xc0f2('0x9')](_0xc0f2('0x8'),auth[_0xc0f2('0x7')](),controller[_0xc0f2('0xa')]);router['delete'](_0xc0f2('0x8'),auth[_0xc0f2('0x7')](),controller[_0xc0f2('0xb')]);module[_0xc0f2('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6c11c1a..fc97e7b 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 _0x80d3=['moment','exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x1d4a4c,_0xaa240){var _0x15a563=function(_0x763e5a){while(--_0x763e5a){_0x1d4a4c['push'](_0x1d4a4c['shift']());}};_0x15a563(++_0xaa240);}(_0x80d3,0xb9));var _0x380d=function(_0x52e631,_0x4a1226){_0x52e631=_0x52e631-0x0;var _0x37e4c6=_0x80d3[_0x52e631];return _0x37e4c6;};'use strict';var Sequelize=require(_0x380d('0x0'));var moment=require(_0x380d('0x1'));module[_0x380d('0x2')]={'time':{'type':Sequelize[_0x380d('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x380d('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x380d('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x380d('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x380d('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x380d('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x380d('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x380d('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x380d('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x380d('0x4')](_0x380d('0x5'))}}; \ No newline at end of file +var _0x9c88=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','STRING'];(function(_0x16a400,_0x20803e){var _0x4ef7a8=function(_0x136110){while(--_0x136110){_0x16a400['push'](_0x16a400['shift']());}};_0x4ef7a8(++_0x20803e);}(_0x9c88,0x1b6));var _0x89c8=function(_0x2d6d0f,_0x3cf2a5){_0x2d6d0f=_0x2d6d0f-0x0;var _0xd2bee6=_0x9c88[_0x2d6d0f];return _0xd2bee6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x89c8('0x0'));module['exports']={'time':{'type':Sequelize[_0x89c8('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x89c8('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x89c8('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x89c8('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x89c8('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x89c8('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x89c8('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x89c8('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x89c8('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x89c8('0x3')](_0x89c8('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index d4b14e8..783edea 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 _0x748e=['includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VoiceQueuesLog','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options'];(function(_0x160b96,_0x2f9b2d){var _0x53b9ef=function(_0x5d6c6a){while(--_0x5d6c6a){_0x160b96['push'](_0x160b96['shift']());}};_0x53b9ef(++_0x2f9b2d);}(_0x748e,0x12b));var _0xe748=function(_0x1fb038,_0xc3f69b){_0x1fb038=_0x1fb038-0x0;var _0x1600dc=_0x748e[_0x1fb038];return _0x1600dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe748('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe748('0x1'));var rp=require('request-promise');var moment=require(_0xe748('0x2'));var BPromise=require(_0xe748('0x3'));var Mustache=require(_0xe748('0x4'));var util=require(_0xe748('0x5'));var path=require('path');var sox=require(_0xe748('0x6'));var csv=require('to-csv');var ejs=require(_0xe748('0x7'));var fs=require('fs');var fs_extra=require(_0xe748('0x8'));var _=require('lodash');var squel=require(_0xe748('0x9'));var crypto=require('crypto');var jsforce=require(_0xe748('0xa'));var deskjs=require(_0xe748('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe748('0xc'));var Papa=require(_0xe748('0xd'));var Redis=require('ioredis');var authService=require(_0xe748('0xe'));var qs=require(_0xe748('0xf'));var as=require(_0xe748('0x10'));var hardwareService=require(_0xe748('0x11'));var logger=require(_0xe748('0x12'))(_0xe748('0x13'));var utils=require(_0xe748('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe748('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45821b,_0x4e6bbd){_0x4e6bbd=_0x4e6bbd||0xcc;return function(_0x34b2de){if(_0x34b2de){return _0x45821b[_0xe748('0x16')](_0x4e6bbd);}return _0x45821b['status'](_0x4e6bbd)['end']();};}function respondWithResult(_0x285f96,_0x2af554){_0x2af554=_0x2af554||0xc8;return function(_0x4cd04d){if(_0x4cd04d){return _0x285f96[_0xe748('0x17')](_0x2af554)[_0xe748('0x18')](_0x4cd04d);}};}function respondWithFilteredResult(_0x3656bb,_0x349d7d){return function(_0x51e837){if(_0x51e837){var _0x248b8d=typeof _0x349d7d['offset']===_0xe748('0x19')&&typeof _0x349d7d[_0xe748('0x1a')]==='undefined';var _0xa3be65=_0x51e837[_0xe748('0x1b')];var _0x22247b=_0x248b8d?0x0:_0x349d7d[_0xe748('0x1c')];var _0x8fbbe8=_0x248b8d?_0x51e837[_0xe748('0x1b')]:_0x349d7d['offset']+_0x349d7d[_0xe748('0x1a')];var _0x2f12f9;if(_0x8fbbe8>=_0xa3be65){_0x8fbbe8=_0xa3be65;_0x2f12f9=0xc8;}else{_0x2f12f9=0xce;}_0x3656bb[_0xe748('0x17')](_0x2f12f9);return _0x3656bb['set']('Content-Range',_0x22247b+'-'+_0x8fbbe8+'/'+_0xa3be65)[_0xe748('0x18')](_0x51e837);}return null;};}function patchUpdates(_0x35f39a){return function(_0x57142c){try{jsonpatch[_0xe748('0x1d')](_0x57142c,_0x35f39a,!![]);}catch(_0x16dc83){return BPromise[_0xe748('0x1e')](_0x16dc83);}return _0x57142c[_0xe748('0x1f')]();};}function saveUpdates(_0x4b872d,_0x30953){return function(_0x5dc0ca){if(_0x5dc0ca){return _0x5dc0ca[_0xe748('0x20')](_0x4b872d)['then'](function(_0x68f11a){return _0x68f11a;});}return null;};}function removeEntity(_0x2551d1,_0x327245){return function(_0x536a3f){if(_0x536a3f){return _0x536a3f[_0xe748('0x21')]()[_0xe748('0x22')](function(){_0x2551d1['status'](0xcc)[_0xe748('0x23')]();});}};}function handleEntityNotFound(_0x1aacfa,_0x12d06b){return function(_0x5638ed){if(!_0x5638ed){_0x1aacfa[_0xe748('0x16')](0x194);}return _0x5638ed;};}function handleError(_0x52cd9c,_0x19dce0){_0x19dce0=_0x19dce0||0x1f4;return function(_0x236509){logger[_0xe748('0x24')](_0x236509[_0xe748('0x25')]);if(_0x236509[_0xe748('0x26')]){delete _0x236509[_0xe748('0x26')];}_0x52cd9c[_0xe748('0x17')](_0x19dce0)[_0xe748('0x27')](_0x236509);};}exports[_0xe748('0x28')]=function(_0x4b1da5,_0x4b2e6f){var _0x549437={},_0x489749={},_0x7d24c6={'count':0x0,'rows':[]};var _0xef58c=_[_0xe748('0x29')](db[_0xe748('0x2a')]['rawAttributes'],function(_0x37dd3d){return{'name':_0x37dd3d['fieldName'],'type':_0x37dd3d[_0xe748('0x2b')]['key']};});_0x489749[_0xe748('0x2c')]=_[_0xe748('0x29')](_0xef58c,'name');_0x489749[_0xe748('0x2d')]=_[_0xe748('0x2e')](_0x4b1da5['query']);_0x489749[_0xe748('0x2f')]=_[_0xe748('0x30')](_0x489749[_0xe748('0x2c')],_0x489749['query']);_0x549437[_0xe748('0x31')]=_[_0xe748('0x30')](_0x489749['model'],qs[_0xe748('0x32')](_0x4b1da5[_0xe748('0x2d')]['fields']));_0x549437[_0xe748('0x31')]=_0x549437[_0xe748('0x31')][_0xe748('0x33')]?_0x549437[_0xe748('0x31')]:_0x489749[_0xe748('0x2c')];if(!_0x4b1da5[_0xe748('0x2d')][_0xe748('0x34')](_0xe748('0x35'))){_0x549437[_0xe748('0x1a')]=qs[_0xe748('0x1a')](_0x4b1da5[_0xe748('0x2d')][_0xe748('0x1a')]);_0x549437[_0xe748('0x1c')]=qs[_0xe748('0x1c')](_0x4b1da5['query'][_0xe748('0x1c')]);}_0x549437['order']=qs[_0xe748('0x36')](_0x4b1da5['query']['sort']);_0x549437['where']=qs[_0xe748('0x2f')](_[_0xe748('0x37')](_0x4b1da5[_0xe748('0x2d')],_0x489749[_0xe748('0x2f')]),_0xef58c);if(_0x4b1da5[_0xe748('0x2d')][_0xe748('0x38')]){_0x549437['where']=_[_0xe748('0x39')](_0x549437[_0xe748('0x3a')],{'$or':_[_0xe748('0x29')](_0xef58c,function(_0x4aef96){if(_0x4aef96[_0xe748('0x2b')]!==_0xe748('0x3b')){var _0x4aa269={};_0x4aa269[_0x4aef96[_0xe748('0x26')]]={'$like':'%'+_0x4b1da5['query']['filter']+'%'};return _0x4aa269;}})});}_0x549437=_[_0xe748('0x39')]({},_0x549437,_0x4b1da5[_0xe748('0x3c')]);var _0x5927c5={'where':_0x549437[_0xe748('0x3a')]};return db[_0xe748('0x2a')][_0xe748('0x1b')](_0x5927c5)[_0xe748('0x22')](function(_0x25964e){_0x7d24c6[_0xe748('0x1b')]=_0x25964e;if(_0x4b1da5[_0xe748('0x2d')][_0xe748('0x3d')]){_0x549437['include']=[{'all':!![]}];}return db[_0xe748('0x2a')][_0xe748('0x3e')](_0x549437);})[_0xe748('0x22')](function(_0x2c9343){_0x7d24c6[_0xe748('0x3f')]=_0x2c9343;return _0x7d24c6;})['then'](respondWithFilteredResult(_0x4b2e6f,_0x549437))['catch'](handleError(_0x4b2e6f,null));};exports[_0xe748('0x40')]=function(_0x4c4fd1,_0x486360){var _0x20d2c3={'raw':!![],'where':{'id':_0x4c4fd1[_0xe748('0x41')]['id']}},_0x39c877={};_0x39c877['model']=_[_0xe748('0x2e')](db[_0xe748('0x2a')][_0xe748('0x42')]);_0x39c877[_0xe748('0x2d')]=_[_0xe748('0x2e')](_0x4c4fd1[_0xe748('0x2d')]);_0x39c877[_0xe748('0x2f')]=_[_0xe748('0x30')](_0x39c877[_0xe748('0x2c')],_0x39c877[_0xe748('0x2d')]);_0x20d2c3['attributes']=_[_0xe748('0x30')](_0x39c877[_0xe748('0x2c')],qs[_0xe748('0x32')](_0x4c4fd1['query'][_0xe748('0x32')]));_0x20d2c3[_0xe748('0x31')]=_0x20d2c3[_0xe748('0x31')]['length']?_0x20d2c3[_0xe748('0x31')]:_0x39c877[_0xe748('0x2c')];if(_0x4c4fd1[_0xe748('0x2d')][_0xe748('0x3d')]){_0x20d2c3[_0xe748('0x43')]=[{'all':!![]}];}_0x20d2c3=_[_0xe748('0x39')]({},_0x20d2c3,_0x4c4fd1[_0xe748('0x3c')]);return db[_0xe748('0x2a')][_0xe748('0x44')](_0x20d2c3)[_0xe748('0x22')](handleEntityNotFound(_0x486360,null))['then'](respondWithResult(_0x486360,null))[_0xe748('0x45')](handleError(_0x486360,null));};exports[_0xe748('0x46')]=function(_0x15bd90,_0x15da0e){return db[_0xe748('0x2a')]['create'](_0x15bd90['body'],{})[_0xe748('0x22')](respondWithResult(_0x15da0e,0xc9))[_0xe748('0x45')](handleError(_0x15da0e,null));};exports['update']=function(_0x5ad427,_0x33f727){if(_0x5ad427[_0xe748('0x47')]['id']){delete _0x5ad427[_0xe748('0x47')]['id'];}return db[_0xe748('0x2a')]['find']({'where':{'id':_0x5ad427[_0xe748('0x41')]['id']}})['then'](handleEntityNotFound(_0x33f727,null))[_0xe748('0x22')](saveUpdates(_0x5ad427[_0xe748('0x47')],null))[_0xe748('0x22')](respondWithResult(_0x33f727,null))[_0xe748('0x45')](handleError(_0x33f727,null));};exports[_0xe748('0x21')]=function(_0x3264b6,_0x22a781){return db[_0xe748('0x2a')][_0xe748('0x44')]({'where':{'id':_0x3264b6[_0xe748('0x41')]['id']}})[_0xe748('0x22')](handleEntityNotFound(_0x22a781,null))[_0xe748('0x22')](removeEntity(_0x22a781,null))[_0xe748('0x45')](handleError(_0x22a781,null));}; \ No newline at end of file +var _0x6315=['limit','count','Content-Range','json','apply','save','then','destroy','error','stack','name','send','map','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','VIRTUAL','filter','includeAll','include','VoiceQueuesLog','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x41a596,_0x9963c){var _0x48cad1=function(_0x48736e){while(--_0x48736e){_0x41a596['push'](_0x41a596['shift']());}};_0x48cad1(++_0x9963c);}(_0x6315,0x1ce));var _0x5631=function(_0x1df2af,_0x979c5e){_0x1df2af=_0x1df2af-0x0;var _0x2d0f15=_0x6315[_0x1df2af];return _0x2d0f15;};'use strict';var emlformat=require(_0x5631('0x0'));var rimraf=require(_0x5631('0x1'));var zipdir=require(_0x5631('0x2'));var jsonpatch=require(_0x5631('0x3'));var rp=require(_0x5631('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5631('0x5'));var util=require(_0x5631('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5631('0x7'));var ejs=require(_0x5631('0x8'));var fs=require('fs');var fs_extra=require(_0x5631('0x9'));var _=require(_0x5631('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5631('0xb'));var deskjs=require(_0x5631('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5631('0xd'));var Papa=require(_0x5631('0xe'));var Redis=require('ioredis');var authService=require(_0x5631('0xf'));var qs=require(_0x5631('0x10'));var as=require(_0x5631('0x11'));var hardwareService=require(_0x5631('0x12'));var logger=require('../../config/logger')(_0x5631('0x13'));var utils=require(_0x5631('0x14'));var config=require(_0x5631('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5631('0x16'))['db'];function respondWithStatusCode(_0x3b1bb8,_0x3b41cb){_0x3b41cb=_0x3b41cb||0xcc;return function(_0x4c9fe7){if(_0x4c9fe7){return _0x3b1bb8[_0x5631('0x17')](_0x3b41cb);}return _0x3b1bb8[_0x5631('0x18')](_0x3b41cb)[_0x5631('0x19')]();};}function respondWithResult(_0x482ff3,_0x52b9a6){_0x52b9a6=_0x52b9a6||0xc8;return function(_0x2130f6){if(_0x2130f6){return _0x482ff3['status'](_0x52b9a6)['json'](_0x2130f6);}};}function respondWithFilteredResult(_0x490ab4,_0x2f315d){return function(_0xcc948c){if(_0xcc948c){var _0x300d15=typeof _0x2f315d[_0x5631('0x1a')]===_0x5631('0x1b')&&typeof _0x2f315d[_0x5631('0x1c')]===_0x5631('0x1b');var _0x49a16f=_0xcc948c[_0x5631('0x1d')];var _0x594be3=_0x300d15?0x0:_0x2f315d['offset'];var _0x2a2a42=_0x300d15?_0xcc948c[_0x5631('0x1d')]:_0x2f315d['offset']+_0x2f315d[_0x5631('0x1c')];var _0x3fd852;if(_0x2a2a42>=_0x49a16f){_0x2a2a42=_0x49a16f;_0x3fd852=0xc8;}else{_0x3fd852=0xce;}_0x490ab4[_0x5631('0x18')](_0x3fd852);return _0x490ab4['set'](_0x5631('0x1e'),_0x594be3+'-'+_0x2a2a42+'/'+_0x49a16f)[_0x5631('0x1f')](_0xcc948c);}return null;};}function patchUpdates(_0x459baf){return function(_0x38f398){try{jsonpatch[_0x5631('0x20')](_0x38f398,_0x459baf,!![]);}catch(_0x5e7d26){return BPromise['reject'](_0x5e7d26);}return _0x38f398[_0x5631('0x21')]();};}function saveUpdates(_0x5eed68,_0x1ec10d){return function(_0x427447){if(_0x427447){return _0x427447['update'](_0x5eed68)[_0x5631('0x22')](function(_0x63c345){return _0x63c345;});}return null;};}function removeEntity(_0x563c97,_0x194031){return function(_0x3186d3){if(_0x3186d3){return _0x3186d3[_0x5631('0x23')]()['then'](function(){_0x563c97[_0x5631('0x18')](0xcc)[_0x5631('0x19')]();});}};}function handleEntityNotFound(_0x47a2e1,_0x15ca87){return function(_0x5500d3){if(!_0x5500d3){_0x47a2e1[_0x5631('0x17')](0x194);}return _0x5500d3;};}function handleError(_0x5957c9,_0x523bad){_0x523bad=_0x523bad||0x1f4;return function(_0x107125){logger[_0x5631('0x24')](_0x107125[_0x5631('0x25')]);if(_0x107125[_0x5631('0x26')]){delete _0x107125[_0x5631('0x26')];}_0x5957c9[_0x5631('0x18')](_0x523bad)[_0x5631('0x27')](_0x107125);};}exports['index']=function(_0x566cbb,_0x6d5de8){var _0x3614fc={},_0xd121da={},_0x179cce={'count':0x0,'rows':[]};var _0x3c3ac9=_[_0x5631('0x28')](db['VoiceQueuesLog']['rawAttributes'],function(_0x3ec492){return{'name':_0x3ec492[_0x5631('0x29')],'type':_0x3ec492[_0x5631('0x2a')]['key']};});_0xd121da[_0x5631('0x2b')]=_['map'](_0x3c3ac9,_0x5631('0x26'));_0xd121da['query']=_[_0x5631('0x2c')](_0x566cbb[_0x5631('0x2d')]);_0xd121da[_0x5631('0x2e')]=_[_0x5631('0x2f')](_0xd121da[_0x5631('0x2b')],_0xd121da[_0x5631('0x2d')]);_0x3614fc[_0x5631('0x30')]=_['intersection'](_0xd121da['model'],qs[_0x5631('0x31')](_0x566cbb['query'][_0x5631('0x31')]));_0x3614fc[_0x5631('0x30')]=_0x3614fc[_0x5631('0x30')][_0x5631('0x32')]?_0x3614fc[_0x5631('0x30')]:_0xd121da[_0x5631('0x2b')];if(!_0x566cbb['query'][_0x5631('0x33')]('nolimit')){_0x3614fc['limit']=qs[_0x5631('0x1c')](_0x566cbb[_0x5631('0x2d')][_0x5631('0x1c')]);_0x3614fc['offset']=qs[_0x5631('0x1a')](_0x566cbb[_0x5631('0x2d')][_0x5631('0x1a')]);}_0x3614fc['order']=qs[_0x5631('0x34')](_0x566cbb[_0x5631('0x2d')][_0x5631('0x34')]);_0x3614fc[_0x5631('0x35')]=qs[_0x5631('0x2e')](_['pick'](_0x566cbb[_0x5631('0x2d')],_0xd121da[_0x5631('0x2e')]),_0x3c3ac9);if(_0x566cbb[_0x5631('0x2d')]['filter']){_0x3614fc[_0x5631('0x35')]=_['merge'](_0x3614fc['where'],{'$or':_[_0x5631('0x28')](_0x3c3ac9,function(_0x8db662){if(_0x8db662[_0x5631('0x2a')]!==_0x5631('0x36')){var _0x5309a1={};_0x5309a1[_0x8db662['name']]={'$like':'%'+_0x566cbb[_0x5631('0x2d')][_0x5631('0x37')]+'%'};return _0x5309a1;}})});}_0x3614fc=_['merge']({},_0x3614fc,_0x566cbb['options']);var _0x2a5206={'where':_0x3614fc[_0x5631('0x35')]};return db['VoiceQueuesLog']['count'](_0x2a5206)[_0x5631('0x22')](function(_0x3807c8){_0x179cce[_0x5631('0x1d')]=_0x3807c8;if(_0x566cbb[_0x5631('0x2d')][_0x5631('0x38')]){_0x3614fc[_0x5631('0x39')]=[{'all':!![]}];}return db[_0x5631('0x3a')][_0x5631('0x3b')](_0x3614fc);})[_0x5631('0x22')](function(_0x2d3ab7){_0x179cce[_0x5631('0x3c')]=_0x2d3ab7;return _0x179cce;})[_0x5631('0x22')](respondWithFilteredResult(_0x6d5de8,_0x3614fc))[_0x5631('0x3d')](handleError(_0x6d5de8,null));};exports[_0x5631('0x3e')]=function(_0x1abe0d,_0xef5c60){var _0x5e68a5={'raw':!![],'where':{'id':_0x1abe0d[_0x5631('0x3f')]['id']}},_0x23d8c0={};_0x23d8c0[_0x5631('0x2b')]=_['keys'](db[_0x5631('0x3a')][_0x5631('0x40')]);_0x23d8c0[_0x5631('0x2d')]=_[_0x5631('0x2c')](_0x1abe0d[_0x5631('0x2d')]);_0x23d8c0[_0x5631('0x2e')]=_[_0x5631('0x2f')](_0x23d8c0[_0x5631('0x2b')],_0x23d8c0[_0x5631('0x2d')]);_0x5e68a5['attributes']=_[_0x5631('0x2f')](_0x23d8c0[_0x5631('0x2b')],qs[_0x5631('0x31')](_0x1abe0d['query'][_0x5631('0x31')]));_0x5e68a5[_0x5631('0x30')]=_0x5e68a5[_0x5631('0x30')]['length']?_0x5e68a5[_0x5631('0x30')]:_0x23d8c0[_0x5631('0x2b')];if(_0x1abe0d['query'][_0x5631('0x38')]){_0x5e68a5['include']=[{'all':!![]}];}_0x5e68a5=_['merge']({},_0x5e68a5,_0x1abe0d[_0x5631('0x41')]);return db[_0x5631('0x3a')][_0x5631('0x42')](_0x5e68a5)[_0x5631('0x22')](handleEntityNotFound(_0xef5c60,null))['then'](respondWithResult(_0xef5c60,null))[_0x5631('0x3d')](handleError(_0xef5c60,null));};exports[_0x5631('0x43')]=function(_0x2142ee,_0x73567e){return db['VoiceQueuesLog'][_0x5631('0x43')](_0x2142ee[_0x5631('0x44')],{})[_0x5631('0x22')](respondWithResult(_0x73567e,0xc9))[_0x5631('0x3d')](handleError(_0x73567e,null));};exports[_0x5631('0x45')]=function(_0x189edf,_0x58e355){if(_0x189edf['body']['id']){delete _0x189edf[_0x5631('0x44')]['id'];}return db[_0x5631('0x3a')][_0x5631('0x42')]({'where':{'id':_0x189edf[_0x5631('0x3f')]['id']}})[_0x5631('0x22')](handleEntityNotFound(_0x58e355,null))[_0x5631('0x22')](saveUpdates(_0x189edf['body'],null))[_0x5631('0x22')](respondWithResult(_0x58e355,null))['catch'](handleError(_0x58e355,null));};exports[_0x5631('0x23')]=function(_0x49b82c,_0x47aa68){return db['VoiceQueuesLog']['find']({'where':{'id':_0x49b82c[_0x5631('0x3f')]['id']}})[_0x5631('0x22')](handleEntityNotFound(_0x47aa68,null))['then'](removeEntity(_0x47aa68,null))[_0x5631('0x3d')](handleError(_0x47aa68,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d4a2a9d..6da85f3 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 _0x2da5=['./voiceQueuesLog.attributes','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2e50b7,_0x435216){var _0x2ecd00=function(_0x5eefdb){while(--_0x5eefdb){_0x2e50b7['push'](_0x2e50b7['shift']());}};_0x2ecd00(++_0x435216);}(_0x2da5,0x123));var _0x52da=function(_0x598520,_0x5a716){_0x598520=_0x598520-0x0;var _0x30c1f1=_0x2da5[_0x598520];return _0x30c1f1;};'use strict';var _=require(_0x52da('0x0'));var util=require(_0x52da('0x1'));var logger=require(_0x52da('0x2'))('api');var moment=require(_0x52da('0x3'));var BPromise=require(_0x52da('0x4'));var rp=require(_0x52da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52da('0x6'));var config=require(_0x52da('0x7'));var attributes=require(_0x52da('0x8'));module['exports']=function(_0x1d9188,_0x5ab74e){return _0x1d9188['define']('VoiceQueuesLog',attributes,{'tableName':_0x52da('0x9'),'paranoid':![],'indexes':[{'name':_0x52da('0xa'),'fields':[_0x52da('0xb'),_0x52da('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6658=['../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c6c1b,_0x82a1e4){var _0x15170e=function(_0x388a43){while(--_0x388a43){_0x3c6c1b['push'](_0x3c6c1b['shift']());}};_0x15170e(++_0x82a1e4);}(_0x6658,0x198));var _0x8665=function(_0x3ad1aa,_0x1af430){_0x3ad1aa=_0x3ad1aa-0x0;var _0x5da9a1=_0x6658[_0x3ad1aa];return _0x5da9a1;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var logger=require(_0x8665('0x2'))(_0x8665('0x3'));var moment=require(_0x8665('0x4'));var BPromise=require(_0x8665('0x5'));var rp=require(_0x8665('0x6'));var fs=require('fs');var path=require(_0x8665('0x7'));var rimraf=require('rimraf');var config=require(_0x8665('0x8'));var attributes=require(_0x8665('0x9'));module['exports']=function(_0x562829,_0x203780){return _0x562829[_0x8665('0xa')](_0x8665('0xb'),attributes,{'tableName':_0x8665('0xc'),'paranoid':![],'indexes':[{'name':_0x8665('0xd'),'fields':[_0x8665('0xe'),_0x8665('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 09d8b15..34b218a 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 _0xcd54=['rpc','../../config/environment','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/logger'];(function(_0x1f8755,_0x1f387f){var _0x4ee357=function(_0x3feae2){while(--_0x3feae2){_0x1f8755['push'](_0x1f8755['shift']());}};_0x4ee357(++_0x1f387f);}(_0xcd54,0xaf));var _0x4cd5=function(_0x1aa3d6,_0x4c2fd4){_0x1aa3d6=_0x1aa3d6-0x0;var _0x3fe162=_0xcd54[_0x1aa3d6];return _0x3fe162;};'use strict';var _=require(_0x4cd5('0x0'));var util=require(_0x4cd5('0x1'));var moment=require(_0x4cd5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4cd5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4cd5('0x4'))(_0x4cd5('0x5'));var config=require(_0x4cd5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4cd5('0x7')][_0x4cd5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9ad1a5,_0x19eab5,_0x2e216a){return new BPromise(function(_0x5a9277,_0x1759a2){return client[_0x4cd5('0x9')](_0x9ad1a5,_0x2e216a)[_0x4cd5('0xa')](function(_0x456c4c){logger['info'](_0x4cd5('0xb'),_0x19eab5,_0x4cd5('0xc'));logger[_0x4cd5('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x19eab5,_0x4cd5('0xc'),JSON[_0x4cd5('0xe')](_0x456c4c));if(_0x456c4c[_0x4cd5('0xf')]){if(_0x456c4c[_0x4cd5('0xf')]['code']===0x1f4){logger[_0x4cd5('0xf')](_0x4cd5('0xb'),_0x19eab5,_0x456c4c[_0x4cd5('0xf')]['message']);return _0x1759a2(_0x456c4c[_0x4cd5('0xf')][_0x4cd5('0x10')]);}logger[_0x4cd5('0xf')](_0x4cd5('0xb'),_0x19eab5,_0x456c4c[_0x4cd5('0xf')][_0x4cd5('0x10')]);return _0x5a9277(_0x456c4c[_0x4cd5('0xf')][_0x4cd5('0x10')]);}else{logger[_0x4cd5('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x19eab5,_0x4cd5('0xc'));_0x5a9277(_0x456c4c[_0x4cd5('0x12')]['message']);}})[_0x4cd5('0x13')](function(_0x51e78b){logger[_0x4cd5('0xf')](_0x4cd5('0xb'),_0x19eab5,_0x51e78b);_0x1759a2(_0x51e78b);});});} \ No newline at end of file +var _0xc12d=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0xc12d,0x1e2));var _0xdc12=function(_0x40bbe2,_0x17f7b9){_0x40bbe2=_0x40bbe2-0x0;var _0x42652a=_0xc12d[_0x40bbe2];return _0x42652a;};'use strict';var _=require(_0xdc12('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdc12('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc12('0x2'));var db=require(_0xdc12('0x3'))['db'];var utils=require(_0xdc12('0x4'));var logger=require(_0xdc12('0x5'))('rpc');var config=require(_0xdc12('0x6'));var jayson=require(_0xdc12('0x7'));var client=jayson[_0xdc12('0x8')][_0xdc12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26a512,_0x2b2d6e,_0x12ffde){return new BPromise(function(_0x137b0e,_0x480628){return client[_0xdc12('0xa')](_0x26a512,_0x12ffde)[_0xdc12('0xb')](function(_0x27630e){logger[_0xdc12('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2b2d6e,'request\x20sent');logger['debug'](_0xdc12('0xd'),_0x2b2d6e,_0xdc12('0xe'),JSON[_0xdc12('0xf')](_0x27630e));if(_0x27630e['error']){if(_0x27630e[_0xdc12('0x10')][_0xdc12('0x11')]===0x1f4){logger[_0xdc12('0x10')](_0xdc12('0x12'),_0x2b2d6e,_0x27630e['error'][_0xdc12('0x13')]);return _0x480628(_0x27630e[_0xdc12('0x10')]['message']);}logger[_0xdc12('0x10')](_0xdc12('0x12'),_0x2b2d6e,_0x27630e[_0xdc12('0x10')][_0xdc12('0x13')]);return _0x137b0e(_0x27630e[_0xdc12('0x10')][_0xdc12('0x13')]);}else{logger[_0xdc12('0xc')](_0xdc12('0x12'),_0x2b2d6e,_0xdc12('0xe'));_0x137b0e(_0x27630e[_0xdc12('0x14')][_0xdc12('0x13')]);}})['catch'](function(_0x14b37a){logger[_0xdc12('0x10')](_0xdc12('0x12'),_0x2b2d6e,_0x14b37a);_0x480628(_0x14b37a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 67a9503..797657a 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 _0xf24b=['express','Router','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0xf24b,0x191));var _0xbf24=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xf24b[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var path=require(_0xbf24('0x2'));var timeout=require(_0xbf24('0x3'));var express=require(_0xbf24('0x4'));var router=express[_0xbf24('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf24('0x6'));var config=require('../../config/environment');var controller=require(_0xbf24('0x7'));router[_0xbf24('0x8')]('/',auth[_0xbf24('0x9')](),controller[_0xbf24('0xa')]);router[_0xbf24('0x8')](_0xbf24('0xb'),auth[_0xbf24('0x9')](),controller[_0xbf24('0xc')]);router[_0xbf24('0x8')](_0xbf24('0xd'),auth[_0xbf24('0x9')](),controller['show']);router[_0xbf24('0x8')](_0xbf24('0xe'),auth['isAuthenticated'](),controller[_0xbf24('0xf')]);router[_0xbf24('0x8')]('/:id/downloads',controller[_0xbf24('0x10')]);router['get'](_0xbf24('0x11'),auth[_0xbf24('0x9')](),controller[_0xbf24('0x12')]);router[_0xbf24('0x13')]('/',auth['isAuthenticated'](),controller[_0xbf24('0x14')]);router[_0xbf24('0x13')](_0xbf24('0x11'),auth[_0xbf24('0x9')](),controller[_0xbf24('0x15')]);router[_0xbf24('0x16')](_0xbf24('0xd'),auth['isAuthenticated'](),controller[_0xbf24('0x17')]);router[_0xbf24('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xbf24('0x19')]);module[_0xbf24('0x1a')]=router; \ No newline at end of file +var _0x3121=['post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe'];(function(_0xd09ac2,_0x333676){var _0x40f87c=function(_0x31d379){while(--_0x31d379){_0xd09ac2['push'](_0xd09ac2['shift']());}};_0x40f87c(++_0x333676);}(_0x3121,0x11a));var _0x1312=function(_0xf841f5,_0x3b7c65){_0xf841f5=_0xf841f5-0x0;var _0xd099af=_0x3121[_0xf841f5];return _0xd099af;};'use strict';var multer=require(_0x1312('0x0'));var util=require('util');var path=require(_0x1312('0x1'));var timeout=require(_0x1312('0x2'));var express=require('express');var router=express[_0x1312('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1312('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1312('0x5'));var controller=require(_0x1312('0x6'));router[_0x1312('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1312('0x7')]('/describe',auth[_0x1312('0x8')](),controller[_0x1312('0x9')]);router['get'](_0x1312('0xa'),auth[_0x1312('0x8')](),controller[_0x1312('0xb')]);router[_0x1312('0x7')](_0x1312('0xc'),auth[_0x1312('0x8')](),controller[_0x1312('0xd')]);router[_0x1312('0x7')](_0x1312('0xe'),controller['downloads']);router[_0x1312('0x7')](_0x1312('0xf'),auth['isAuthenticated'](),controller[_0x1312('0x10')]);router[_0x1312('0x11')]('/',auth[_0x1312('0x8')](),controller['create']);router['post'](_0x1312('0xf'),auth[_0x1312('0x8')](),controller['runTranscribe']);router[_0x1312('0x12')](_0x1312('0xa'),auth['isAuthenticated'](),controller[_0x1312('0x13')]);router[_0x1312('0x14')](_0x1312('0xa'),auth['isAuthenticated'](),controller[_0x1312('0x15')]);module[_0x1312('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 6a4be9e..d4fb1a9 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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 05ad486..1d0a311 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 _0x75b6=['json','offset','undefined','limit','count','set','reject','save','destroy','then','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','format','keys','intersection','model','query','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','rows','catch','include','options','find','create','body','update','params','describe','download','uniqueid','value','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','col','$and','push','%s.cypher','Sequelize','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','upload','TranscribeService','[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','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0x45c4ac,_0xaf5b27){var _0x3046cb=function(_0x554354){while(--_0x554354){_0x45c4ac['push'](_0x45c4ac['shift']());}};_0x3046cb(++_0xaf5b27);}(_0x75b6,0x74));var _0x675b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b6[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x675b('0x0'));var rimraf=require(_0x675b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x675b('0x2'));var rp=require(_0x675b('0x3'));var moment=require('moment');var BPromise=require(_0x675b('0x4'));var Mustache=require(_0x675b('0x5'));var util=require(_0x675b('0x6'));var path=require(_0x675b('0x7'));var sox=require('sox');var csv=require(_0x675b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x675b('0x9'));var _=require(_0x675b('0xa'));var squel=require('squel');var crypto=require(_0x675b('0xb'));var jsforce=require(_0x675b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x675b('0xd'));var Papa=require(_0x675b('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0x675b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x675b('0x10'));var as=require(_0x675b('0x11'));var hardwareService=require(_0x675b('0x12'));var logger=require(_0x675b('0x13'))(_0x675b('0x14'));var utils=require(_0x675b('0x15'));var config=require(_0x675b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x675b('0x17'))['db'];function respondWithStatusCode(_0x152df8,_0x41f55e){_0x41f55e=_0x41f55e||0xcc;return function(_0x2376d0){if(_0x2376d0){return _0x152df8[_0x675b('0x18')](_0x41f55e);}return _0x152df8['status'](_0x41f55e)[_0x675b('0x19')]();};}function respondWithResult(_0x1af654,_0x5983a6){_0x5983a6=_0x5983a6||0xc8;return function(_0x17b47d){if(_0x17b47d){return _0x1af654[_0x675b('0x1a')](_0x5983a6)[_0x675b('0x1b')](_0x17b47d);}};}function respondWithFilteredResult(_0x13b4b4,_0x5219c9){return function(_0x545600){if(_0x545600){var _0x325ef8=typeof _0x5219c9[_0x675b('0x1c')]===_0x675b('0x1d')&&typeof _0x5219c9[_0x675b('0x1e')]==='undefined';var _0x3c3359=_0x545600[_0x675b('0x1f')];var _0x8b532f=_0x325ef8?0x0:_0x5219c9[_0x675b('0x1c')];var _0x51fe5b=_0x325ef8?_0x545600[_0x675b('0x1f')]:_0x5219c9[_0x675b('0x1c')]+_0x5219c9[_0x675b('0x1e')];var _0x2d4ac9;if(_0x51fe5b>=_0x3c3359){_0x51fe5b=_0x3c3359;_0x2d4ac9=0xc8;}else{_0x2d4ac9=0xce;}_0x13b4b4[_0x675b('0x1a')](_0x2d4ac9);return _0x13b4b4[_0x675b('0x20')]('Content-Range',_0x8b532f+'-'+_0x51fe5b+'/'+_0x3c3359)[_0x675b('0x1b')](_0x545600);}return null;};}function patchUpdates(_0x46176c){return function(_0x441714){try{jsonpatch['apply'](_0x441714,_0x46176c,!![]);}catch(_0x2424ea){return BPromise[_0x675b('0x21')](_0x2424ea);}return _0x441714[_0x675b('0x22')]();};}function saveUpdates(_0x40b202,_0x4d9554){return function(_0x47c0c5){if(_0x47c0c5){return _0x47c0c5['update'](_0x40b202)['then'](function(_0x2597a2){return _0x2597a2;});}return null;};}function removeEntity(_0x348059,_0x59672a){return function(_0x2e4fac){if(_0x2e4fac){return _0x2e4fac[_0x675b('0x23')]()[_0x675b('0x24')](function(){_0x348059[_0x675b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51f30d,_0x1a98d5){return function(_0x3a6286){if(!_0x3a6286){_0x51f30d[_0x675b('0x18')](0x194);}return _0x3a6286;};}function handleError(_0x1d0cc9,_0x144c62){_0x144c62=_0x144c62||0x1f4;return function(_0x1e2dac){logger['error'](_0x1e2dac[_0x675b('0x25')]);if(_0x1e2dac[_0x675b('0x26')]){delete _0x1e2dac['name'];}_0x1d0cc9[_0x675b('0x1a')](_0x144c62)[_0x675b('0x27')](_0x1e2dac);};}exports[_0x675b('0x28')]=function(_0xe0d58a,_0x1bb0dc){var _0xf76e73={},_0x6c0a1c={},_0x15f58d={'count':0x0,'rows':[]};var _0x199c1f=_[_0x675b('0x29')](db[_0x675b('0x2a')][_0x675b('0x2b')],function(_0x40032d){return{'name':_0x40032d[_0x675b('0x2c')],'type':_0x40032d[_0x675b('0x2d')]['key']};});_0x6c0a1c['model']=_['differenceBy'](_[_0x675b('0x29')](_0x199c1f,'name'),[_0x675b('0x2e')]);_0x6c0a1c['query']=_[_0x675b('0x2f')](_0xe0d58a['query']);_0x6c0a1c['filters']=_[_0x675b('0x30')](_0x6c0a1c[_0x675b('0x31')],_0x6c0a1c[_0x675b('0x32')]);_0xf76e73['attributes']=_['intersection'](_0x6c0a1c[_0x675b('0x31')],qs['fields'](_0xe0d58a[_0x675b('0x32')][_0x675b('0x33')]));_0xf76e73[_0x675b('0x34')]=_0xf76e73[_0x675b('0x34')][_0x675b('0x35')]?_0xf76e73['attributes']:_0x6c0a1c['model'];if(!_0xe0d58a['query'][_0x675b('0x36')]('nolimit')){_0xf76e73[_0x675b('0x1e')]=qs[_0x675b('0x1e')](_0xe0d58a['query'][_0x675b('0x1e')]);_0xf76e73[_0x675b('0x1c')]=qs[_0x675b('0x1c')](_0xe0d58a['query'][_0x675b('0x1c')]);}_0xf76e73['order']=qs[_0x675b('0x37')](_0xe0d58a['query']['sort']);_0xf76e73[_0x675b('0x38')]=qs[_0x675b('0x39')](_[_0x675b('0x3a')](_0xe0d58a[_0x675b('0x32')],_0x6c0a1c['filters']),_0x199c1f);if(_0xe0d58a[_0x675b('0x32')][_0x675b('0x3b')]){_0xf76e73['where']=_[_0x675b('0x3c')](_0xf76e73[_0x675b('0x38')],{'$or':_[_0x675b('0x29')](_0x199c1f,function(_0x45436e){if(_0x45436e[_0x675b('0x2d')]!==_0x675b('0x3d')){var _0x156a2d={};_0x156a2d[_0x45436e[_0x675b('0x26')]]={'$like':'%'+_0xe0d58a['query'][_0x675b('0x3b')]+'%'};return _0x156a2d;}})});}_0xf76e73=_[_0x675b('0x3c')]({},_0xf76e73,_0xe0d58a['options']);var _0x333d04={'where':_0xf76e73['where']};return db[_0x675b('0x2a')]['count'](_0x333d04)[_0x675b('0x24')](function(_0x277026){_0x15f58d[_0x675b('0x1f')]=_0x277026;if(_0xe0d58a[_0x675b('0x32')][_0x675b('0x3e')]){_0xf76e73['include']=[{'all':!![]}];}return db[_0x675b('0x2a')]['findAll'](_0xf76e73);})[_0x675b('0x24')](function(_0x3e1670){_0x15f58d[_0x675b('0x3f')]=_0x3e1670;return _0x15f58d;})[_0x675b('0x24')](respondWithFilteredResult(_0x1bb0dc,_0xf76e73))[_0x675b('0x40')](handleError(_0x1bb0dc,null));};exports['show']=function(_0x4dd86d,_0x1f6728){var _0xcd431b={'raw':![],'where':{'id':_0x4dd86d['params']['id']}},_0x2b054d={};_0x2b054d['model']=_[_0x675b('0x2f')](db[_0x675b('0x2a')][_0x675b('0x2b')]);_0x2b054d[_0x675b('0x32')]=_[_0x675b('0x2f')](_0x4dd86d[_0x675b('0x32')]);_0x2b054d[_0x675b('0x39')]=_[_0x675b('0x30')](_0x2b054d[_0x675b('0x31')],_0x2b054d[_0x675b('0x32')]);_0xcd431b[_0x675b('0x34')]=_[_0x675b('0x30')](_0x2b054d['model'],qs[_0x675b('0x33')](_0x4dd86d[_0x675b('0x32')][_0x675b('0x33')]));_0xcd431b[_0x675b('0x34')]=_0xcd431b[_0x675b('0x34')]['length']?_0xcd431b[_0x675b('0x34')]:_0x2b054d[_0x675b('0x31')];if(_0x4dd86d[_0x675b('0x32')][_0x675b('0x3e')]){_0xcd431b[_0x675b('0x41')]=[{'all':!![]}];}_0xcd431b=_[_0x675b('0x3c')]({},_0xcd431b,_0x4dd86d[_0x675b('0x42')]);return db[_0x675b('0x2a')][_0x675b('0x43')](_0xcd431b)['then'](handleEntityNotFound(_0x1f6728,null))['then'](respondWithResult(_0x1f6728,null))[_0x675b('0x40')](handleError(_0x1f6728,null));};exports[_0x675b('0x44')]=function(_0x9251c9,_0x41613d){return db['VoiceRecording'][_0x675b('0x44')](_0x9251c9[_0x675b('0x45')],{})[_0x675b('0x24')](respondWithResult(_0x41613d,0xc9))['catch'](handleError(_0x41613d,null));};exports[_0x675b('0x46')]=function(_0x5ec1e6,_0x51194f){if(_0x5ec1e6[_0x675b('0x45')]['id']){delete _0x5ec1e6[_0x675b('0x45')]['id'];}return db[_0x675b('0x2a')]['find']({'where':{'id':_0x5ec1e6[_0x675b('0x47')]['id']}})['then'](handleEntityNotFound(_0x51194f,null))[_0x675b('0x24')](saveUpdates(_0x5ec1e6[_0x675b('0x45')],null))[_0x675b('0x24')](respondWithResult(_0x51194f,null))['catch'](handleError(_0x51194f,null));};exports['describe']=function(_0x912297,_0x38b627){return db['VoiceRecording'][_0x675b('0x48')]()[_0x675b('0x24')](respondWithResult(_0x38b627,null))['catch'](handleError(_0x38b627,null));};exports[_0x675b('0x49')]=function(_0x56f431,_0x160215,_0x4904b1){var _0x3c1c36=require('../../components/encryptor');var _0x19a2cd=![];var _0x3f521c={};if(_0x56f431[_0x675b('0x32')][_0x675b('0x2d')]&&_0x56f431[_0x675b('0x32')][_0x675b('0x2d')]===_0x675b('0x4a')){_0x3f521c[_0x675b('0x4a')]=_0x56f431[_0x675b('0x47')]['id'];}else{_0x3f521c['id']=_0x56f431['params']['id'];}return db[_0x675b('0x2a')]['find']({'where':_0x3f521c,'attributes':['id',_0x675b('0x4b')],'raw':!![]})[_0x675b('0x24')](handleEntityNotFound(_0x160215,null))[_0x675b('0x24')](function(_0x3aa35e){if(_0x3aa35e){var _0x3a9d90=_0x3aa35e[_0x675b('0x4b')];var _0x4c6945=util[_0x675b('0x2e')]('%s.cypher',_0x3a9d90);if(fs[_0x675b('0x4c')](_0x4c6945)){_0x19a2cd=!![];return _0x3c1c36[_0x675b('0x4d')](_0x4c6945,_0x3a9d90,config[_0x675b('0x4e')][_0x675b('0x4f')])[_0x675b('0x24')](function(){return _0x3aa35e;});}return _0x3aa35e;}})[_0x675b('0x24')](function(_0x80116a){if(_0x80116a){var _0x87120d=_0x80116a[_0x675b('0x4b')];if(!fs['existsSync'](_0x87120d)){throw new db['Sequelize'][(_0x675b('0x50'))](_0x675b('0x51'));}if(_0x80116a[_0x675b('0x52')]){return _0x160215[_0x675b('0x49')](_0x87120d,_0x80116a[_0x675b('0x52')]+path[_0x675b('0x53')](_0x87120d),function(){if(_0x19a2cd){fs['unlink'](_0x87120d);}});}else{return _0x160215[_0x675b('0x49')](_0x87120d,function(_0x3c612b){if(_0x19a2cd){fs[_0x675b('0x54')](_0x87120d);}});}}})[_0x675b('0x40')](function(_0xb80230){if(_0xb80230['message']==='VoiceRecording\x20not\x20found'){_0x160215['status'](0x194)[_0x675b('0x27')](_0x675b('0x55'));}else{return handleError(_0x160215,null);}});};exports[_0x675b('0x56')]=function(_0x28ae55,_0x50c689,_0x1936da){var _0x16ae9e=require('../../components/encryptor');var _0x152498=![];var _0x33b184={'$and':[db[_0x675b('0x57')][_0x675b('0x38')](db[_0x675b('0x57')]['fn'](_0x675b('0x58'),db[_0x675b('0x57')][_0x675b('0x59')]('uniqueid')),_0x28ae55['query']['token'])]};if(_0x28ae55['query']['type']&&_0x28ae55[_0x675b('0x32')][_0x675b('0x2d')]===_0x675b('0x4a')){_0x33b184[_0x675b('0x5a')][_0x675b('0x5b')]({'uniqueid':_0x28ae55[_0x675b('0x47')]['id']});}else{_0x33b184[_0x675b('0x5a')][_0x675b('0x5b')]({'id':_0x28ae55['params']['id']});}return db['VoiceRecording']['find']({'where':_0x33b184,'attributes':['id',_0x675b('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x50c689,null))['then'](function(_0x33ab17){if(_0x33ab17){var _0x246c3a=util[_0x675b('0x2e')](_0x675b('0x5c'),_0x33ab17[_0x675b('0x4b')]);if(fs[_0x675b('0x4c')](_0x246c3a)){_0x152498=!![];return _0x16ae9e[_0x675b('0x4d')](_0x246c3a,_0x33ab17[_0x675b('0x4b')],config[_0x675b('0x4e')][_0x675b('0x4f')])[_0x675b('0x24')](function(){return _0x33ab17;});}return _0x33ab17;}})[_0x675b('0x24')](function(_0x4a24be){if(_0x4a24be){if(!fs[_0x675b('0x4c')](_0x4a24be[_0x675b('0x4b')])){throw new db[(_0x675b('0x5d'))]['ValidationError'](_0x675b('0x51'));}if(_0x4a24be[_0x675b('0x52')]){return _0x50c689['download'](_0x4a24be[_0x675b('0x4b')],_0x4a24be[_0x675b('0x52')]+path[_0x675b('0x53')](_0x4a24be[_0x675b('0x4b')]),function(){if(_0x152498){fs[_0x675b('0x54')](_0x4a24be['value']);}});}else{return _0x50c689[_0x675b('0x49')](_0x4a24be[_0x675b('0x4b')],function(_0x376ec2){if(_0x152498){fs[_0x675b('0x54')](_0x4a24be[_0x675b('0x4b')]);}});}}})[_0x675b('0x40')](handleError(_0x50c689,null));};exports[_0x675b('0x23')]=function(_0x51359e,_0x2972fd){return db[_0x675b('0x2a')][_0x675b('0x43')]({'where':{'id':_0x51359e[_0x675b('0x47')]['id']}})['then'](function(_0x5baf20){if(_[_0x675b('0x5e')](_0x5baf20)){throw new ReferenceError(_0x675b('0x5f'));}return _0x5baf20;})['then'](function(_0x40b68c){var _0x59a78f=_0x40b68c[_0x675b('0x4b')];logger[_0x675b('0x60')](_0x675b('0x61'),_0x59a78f);if(!_[_0x675b('0x5e')](_0x40b68c['value'])&&fs['existsSync'](_0x59a78f)){logger[_0x675b('0x60')](_0x675b('0x62')+_0x59a78f+_0x675b('0x63'));fs[_0x675b('0x64')](_0x59a78f);}_0x59a78f=_0x59a78f+_0x675b('0x65');if(!_['isNil'](_0x40b68c[_0x675b('0x4b')])&&fs[_0x675b('0x4c')](_0x59a78f)){logger[_0x675b('0x60')](_0x675b('0x62')+_0x59a78f+_0x675b('0x63'));fs[_0x675b('0x64')](_0x59a78f);}return _0x40b68c;})[_0x675b('0x24')](function(_0x538184){if(!_0x538184)throw new InternalError();return _0x538184[_0x675b('0x23')]();})[_0x675b('0x24')](function(){_0x2972fd[_0x675b('0x1a')](0xcc)['end']();})[_0x675b('0x40')](handleError(_0x2972fd,null));};function getBucketslist(_0x48fed4,_0x118a51,_0x2bcffa){return new Promise(function(_0x1579fe,_0x3a1282){var _0xdb33ef=new AWS['S3']({'accessKeyId':_0x118a51,'secretAccessKey':_0x48fed4,'region':_0x2bcffa});_0xdb33ef['listBuckets']({},function(_0xc48f6f,_0x286344){if(_0xc48f6f){return _0x3a1282(_0xc48f6f);}else{return _0x1579fe(_0x286344);}});});}function createBucket(_0x25e5f2,_0x50ba35,_0x3c3374,_0x400071){return new Promise(function(_0x4ec767,_0x29ad1b){var _0x238b97=new AWS['S3']({'accessKeyId':_0x50ba35,'secretAccessKey':_0x25e5f2,'region':_0x3c3374});_0x238b97['createBucket']({'Bucket':_0x400071},function(_0x586c1b,_0x33a5a8){if(_0x586c1b){return _0x29ad1b(_0x586c1b);}else{return _0x4ec767(_0x33a5a8);}});});}function uploadFile(_0x42453a,_0x5a7fde,_0x15df03,_0x3ceef7,_0x56867b,_0x1490ee){return new Promise(function(_0x1fc7a1,_0x17fc05){var _0x32058d=new AWS['S3']({'accessKeyId':_0x5a7fde,'secretAccessKey':_0x42453a,'region':_0x15df03});_0x32058d[_0x675b('0x66')]({'Bucket':_0x3ceef7,'Key':_0x56867b,'Body':_0x1490ee},function(_0x46dd2d,_0x4c3824){if(_0x46dd2d){return _0x17fc05(_0x46dd2d);}else{return _0x1fc7a1(_0x4c3824);}});});}function startTranscribe(_0x4dc51f,_0x53455b,_0x5f0dd6,_0x596e22,_0x20dd8e,_0x318a80){return new Promise(function(_0x2253bc,_0x4c6da6){var _0x4a89a8=new AWS[(_0x675b('0x67'))]({'accessKeyId':_0x53455b,'secretAccessKey':_0x4dc51f,'region':_0x5f0dd6});_0x4a89a8['startTranscriptionJob']({'TranscriptionJobName':_0x596e22,'LanguageCode':_0x20dd8e,'Media':{'MediaFileUri':_0x318a80}},function(_0x31d402,_0x1f6698){if(_0x31d402){return _0x4c6da6(_0x31d402);}else{return _0x2253bc(_0x1f6698);}});});}function transcribe(_0x1778ca,_0xd66681,_0x469560,_0x18a9c9,_0x5b759e,_0x2f8884,_0x81da80){return new Promise(function(_0x496743,_0x1a53c4){var _0x4562b3={};logger[_0x675b('0x60')](util[_0x675b('0x2e')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1778ca,_0x5b759e));return uploadFile(_0xd66681,_0x469560,_0x18a9c9,_0x5b759e,path['basename'](_0x2f8884),fs['readFileSync'](_0x2f8884))['then'](function(_0x1a3f11){logger['info'](util[_0x675b('0x2e')](_0x675b('0x68'),_0x1778ca,_0x5b759e,_0x1a3f11[_0x675b('0x69')]));_0x4562b3['bucket']=_0x1a3f11[_0x675b('0x6a')];_0x4562b3[_0x675b('0x6b')]=_0x1a3f11['Location'];logger[_0x675b('0x60')](util[_0x675b('0x2e')](_0x675b('0x6c'),_0x1778ca));return startTranscribe(_0xd66681,_0x469560,_0x18a9c9,uuidv4(),_0x81da80,_0x1a3f11['Location']);})[_0x675b('0x24')](function(_0x355f20){logger[_0x675b('0x60')](util[_0x675b('0x2e')](_0x675b('0x6d'),_0x1778ca,_0x355f20['TranscriptionJob'][_0x675b('0x6e')]));_0x4562b3[_0x675b('0x6f')]=_0x355f20[_0x675b('0x70')][_0x675b('0x6e')];_0x4562b3[_0x675b('0x71')]=_0x355f20[_0x675b('0x70')][_0x675b('0x72')];return _0x496743(_0x4562b3);})['catch'](function(_0x4ccc8d){return _0x1a53c4(_0x4ccc8d);});});}exports[_0x675b('0x73')]=function(_0x145d79,_0x591225,_0x298598){var _0x4fff13;var _0x29f31e;var _0x71f6d2;var _0xab06d4=require('../../components/encryptor');return db[_0x675b('0x2a')][_0x675b('0x74')]({'where':{'id':_0x145d79['params']['id']}})['then'](function(_0x321bbb){if(_0x321bbb){var _0x3741d6=util[_0x675b('0x2e')](_0x675b('0x5c'),_0x321bbb[_0x675b('0x4b')]);if(fs[_0x675b('0x4c')](_0x3741d6)){cypher=!![];return _0xab06d4['decryptFile'](_0x3741d6,_0x321bbb[_0x675b('0x4b')],config[_0x675b('0x4e')][_0x675b('0x4f')])[_0x675b('0x24')](function(){return _0x321bbb;});}return _0x321bbb;}})[_0x675b('0x24')](function(_0x2b246e){if(!_0x2b246e){throw new db[(_0x675b('0x5d'))][(_0x675b('0x50'))]('Voice\x20Recording\x20not\x20found');}_0x29f31e=_0x2b246e;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x675b('0x24')](handleEntityNotFound(_0x591225,null))['then'](function(_0x327cd2){if(_0x327cd2){_0x4fff13=_0x327cd2;if(!_0x4fff13[_0x675b('0x75')]||!_0x4fff13['transcribeAccountId']||!_0x4fff13[_0x675b('0x76')]||!_0x4fff13[_0x675b('0x77')]||!_0x4fff13['bucket']){throw new db[(_0x675b('0x5d'))]['ValidationError'](_0x675b('0x78'));}if(_0x145d79[_0x675b('0x45')][_0x675b('0x79')]&&(!_0x4fff13[_0x675b('0x7a')]||!_0x4fff13[_0x675b('0x7b')]||!_0x4fff13['sentimentRegion']||!_0x4fff13[_0x675b('0x77')]||!_0x4fff13[_0x675b('0x7c')])){throw new db['Sequelize'][(_0x675b('0x50'))](_0x675b('0x7d'));}return db[_0x675b('0x7e')][_0x675b('0x74')]({'where':{'id':_0x4fff13[_0x675b('0x7f')]}});}})[_0x675b('0x24')](function(_0x2b98ec){if(!_0x2b98ec){throw new db[(_0x675b('0x5d'))][(_0x675b('0x50'))](_0x675b('0x80'));}if(!_0x2b98ec['data1']||!_0x2b98ec[_0x675b('0x81')]){throw new db[(_0x675b('0x5d'))]['ValidationError'](_0x675b('0x82'));}_0x71f6d2=_0x2b98ec;return getBucketslist(_0x71f6d2[_0x675b('0x83')],_0x71f6d2[_0x675b('0x81')],_0x4fff13[_0x675b('0x76')]);})[_0x675b('0x24')](function(_0x3d1607){if(_0x3d1607&&_0x3d1607[_0x675b('0x84')]){var _0x703032=_['find'](_0x3d1607[_0x675b('0x84')],function(_0x24674d){return _0x24674d[_0x675b('0x85')]===_0x4fff13[_0x675b('0x7c')];});if(!_0x703032){logger[_0x675b('0x60')](util[_0x675b('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x145d79[_0x675b('0x47')]['id'],_0x4fff13['bucket']));return createBucket(_0x71f6d2[_0x675b('0x83')],_0x71f6d2[_0x675b('0x81')],_0x4fff13['transcribeRegion'],_0x4fff13[_0x675b('0x7c')]);}logger[_0x675b('0x60')](util['format'](_0x675b('0x86'),_0x145d79[_0x675b('0x47')]['id'],_0x4fff13[_0x675b('0x7c')]));return;}})['then'](function(_0x208c67){if(_0x29f31e[_0x675b('0x71')]===_0x675b('0x87')){return transcribe(_0x145d79[_0x675b('0x47')]['id'],_0x71f6d2[_0x675b('0x83')],_0x71f6d2[_0x675b('0x81')],_0x4fff13[_0x675b('0x76')],_0x4fff13[_0x675b('0x7c')],_0x29f31e['value'],_0x4fff13[_0x675b('0x77')]);}else{logger[_0x675b('0x60')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x145d79['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x675b('0x24')](function(_0x4ca652){if(_0x4ca652){_0x4ca652[_0x675b('0x88')]=_0x145d79[_0x675b('0x45')][_0x675b('0x79')];return _0x29f31e[_0x675b('0x89')](_0x4ca652);}})[_0x675b('0x24')](respondWithResult(_0x591225,null))[_0x675b('0x40')](handleError(_0x591225,null));};function writeFile(_0x40ceb1,_0x2560ab){return new Promise(function(_0xa22141,_0x24660e){fs['writeFile'](_0x2560ab,_0x40ceb1,function(_0x485596,_0x52c329){if(_0x485596){return _0x24660e(_0x485596);}else{return _0xa22141(_0x52c329);}});});}exports[_0x675b('0x8a')]=function(_0x13290c,_0xb0bb42,_0x9ef53d){return db['VoiceRecording'][_0x675b('0x74')]({'where':{'id':_0x13290c[_0x675b('0x47')]['id']}})['then'](handleEntityNotFound(_0xb0bb42))[_0x675b('0x24')](function(_0x2476e3){if(_0x2476e3&&_0x2476e3[_0x675b('0x8b')]){var _0x5b5fab=_0x2476e3['fileText'];var _0x3aab2a=config[_0x675b('0x8c')]+_0x675b('0x8d')+_0x2476e3['id']+_0x675b('0x8e');if(fs[_0x675b('0x4c')](_0x3aab2a)){return _0x3aab2a;}return writeFile(_0x5b5fab,_0x3aab2a)[_0x675b('0x24')](function(){return _0x3aab2a;});}else{throw new db['Sequelize'][(_0x675b('0x50'))]('Transcript\x20not\x20available');}})[_0x675b('0x24')](function(_0x3baab2){return _0xb0bb42['download'](_0x3baab2);})[_0x675b('0x40')](handleError(_0xb0bb42));}; \ No newline at end of file +var _0x4842=['tempSentiment','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','token','$and','push','Sequelize','ValidationError','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS'];(function(_0xb1bb5d,_0x51cf53){var _0x4f52a7=function(_0x549ba8){while(--_0x549ba8){_0xb1bb5d['push'](_0xb1bb5d['shift']());}};_0x4f52a7(++_0x51cf53);}(_0x4842,0x138));var _0x2484=function(_0x16e4b4,_0x3f278d){_0x16e4b4=_0x16e4b4-0x0;var _0x9e1cf0=_0x4842[_0x16e4b4];return _0x9e1cf0;};'use strict';var emlformat=require(_0x2484('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2484('0x1'));var jsonpatch=require(_0x2484('0x2'));var rp=require(_0x2484('0x3'));var moment=require(_0x2484('0x4'));var BPromise=require(_0x2484('0x5'));var Mustache=require('mustache');var util=require(_0x2484('0x6'));var path=require(_0x2484('0x7'));var sox=require(_0x2484('0x8'));var csv=require(_0x2484('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2484('0xa'));var _=require('lodash');var squel=require(_0x2484('0xb'));var crypto=require(_0x2484('0xc'));var jsforce=require(_0x2484('0xd'));var deskjs=require(_0x2484('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2484('0xf'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x2484('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2484('0x11'));var as=require(_0x2484('0x12'));var hardwareService=require(_0x2484('0x13'));var logger=require(_0x2484('0x14'))(_0x2484('0x15'));var utils=require(_0x2484('0x16'));var config=require(_0x2484('0x17'));var licenseUtil=require(_0x2484('0x18'));var db=require(_0x2484('0x19'))['db'];function respondWithStatusCode(_0x5ea970,_0x387ba9){_0x387ba9=_0x387ba9||0xcc;return function(_0x34e21b){if(_0x34e21b){return _0x5ea970[_0x2484('0x1a')](_0x387ba9);}return _0x5ea970['status'](_0x387ba9)[_0x2484('0x1b')]();};}function respondWithResult(_0x4dd01b,_0x194ddf){_0x194ddf=_0x194ddf||0xc8;return function(_0x573580){if(_0x573580){return _0x4dd01b['status'](_0x194ddf)[_0x2484('0x1c')](_0x573580);}};}function respondWithFilteredResult(_0x5e9f36,_0x55dd2c){return function(_0x4055fd){if(_0x4055fd){var _0x2bd928=typeof _0x55dd2c['offset']===_0x2484('0x1d')&&typeof _0x55dd2c[_0x2484('0x1e')]===_0x2484('0x1d');var _0x56866e=_0x4055fd[_0x2484('0x1f')];var _0x3199d7=_0x2bd928?0x0:_0x55dd2c['offset'];var _0x3c5a1f=_0x2bd928?_0x4055fd['count']:_0x55dd2c[_0x2484('0x20')]+_0x55dd2c['limit'];var _0x441591;if(_0x3c5a1f>=_0x56866e){_0x3c5a1f=_0x56866e;_0x441591=0xc8;}else{_0x441591=0xce;}_0x5e9f36[_0x2484('0x21')](_0x441591);return _0x5e9f36[_0x2484('0x22')](_0x2484('0x23'),_0x3199d7+'-'+_0x3c5a1f+'/'+_0x56866e)[_0x2484('0x1c')](_0x4055fd);}return null;};}function patchUpdates(_0x183755){return function(_0x2b71a7){try{jsonpatch[_0x2484('0x24')](_0x2b71a7,_0x183755,!![]);}catch(_0x3ddf58){return BPromise[_0x2484('0x25')](_0x3ddf58);}return _0x2b71a7[_0x2484('0x26')]();};}function saveUpdates(_0x4e072d,_0x1e584e){return function(_0x5c25a7){if(_0x5c25a7){return _0x5c25a7[_0x2484('0x27')](_0x4e072d)[_0x2484('0x28')](function(_0xe2af7b){return _0xe2af7b;});}return null;};}function removeEntity(_0xb75e1,_0xbf12dd){return function(_0x7567c){if(_0x7567c){return _0x7567c['destroy']()[_0x2484('0x28')](function(){_0xb75e1[_0x2484('0x21')](0xcc)[_0x2484('0x1b')]();});}};}function handleEntityNotFound(_0x2dcdbd,_0x52b456){return function(_0x33d3e8){if(!_0x33d3e8){_0x2dcdbd[_0x2484('0x1a')](0x194);}return _0x33d3e8;};}function handleError(_0x1fc536,_0x5c88b9){_0x5c88b9=_0x5c88b9||0x1f4;return function(_0x48d074){logger['error'](_0x48d074[_0x2484('0x29')]);if(_0x48d074[_0x2484('0x2a')]){delete _0x48d074[_0x2484('0x2a')];}_0x1fc536[_0x2484('0x21')](_0x5c88b9)[_0x2484('0x2b')](_0x48d074);};}exports[_0x2484('0x2c')]=function(_0x2b1dba,_0x1115a3){var _0x2cd4b5={},_0x159207={},_0x351fc1={'count':0x0,'rows':[]};var _0x55c1c8=_[_0x2484('0x2d')](db[_0x2484('0x2e')][_0x2484('0x2f')],function(_0x22f1b5){return{'name':_0x22f1b5[_0x2484('0x30')],'type':_0x22f1b5['type'][_0x2484('0x31')]};});_0x159207['model']=_[_0x2484('0x32')](_['map'](_0x55c1c8,_0x2484('0x2a')),[_0x2484('0x33')]);_0x159207[_0x2484('0x34')]=_[_0x2484('0x35')](_0x2b1dba['query']);_0x159207[_0x2484('0x36')]=_[_0x2484('0x37')](_0x159207[_0x2484('0x38')],_0x159207[_0x2484('0x34')]);_0x2cd4b5[_0x2484('0x39')]=_[_0x2484('0x37')](_0x159207[_0x2484('0x38')],qs[_0x2484('0x3a')](_0x2b1dba['query'][_0x2484('0x3a')]));_0x2cd4b5['attributes']=_0x2cd4b5[_0x2484('0x39')][_0x2484('0x3b')]?_0x2cd4b5[_0x2484('0x39')]:_0x159207[_0x2484('0x38')];if(!_0x2b1dba[_0x2484('0x34')][_0x2484('0x3c')](_0x2484('0x3d'))){_0x2cd4b5[_0x2484('0x1e')]=qs[_0x2484('0x1e')](_0x2b1dba[_0x2484('0x34')][_0x2484('0x1e')]);_0x2cd4b5[_0x2484('0x20')]=qs[_0x2484('0x20')](_0x2b1dba['query'][_0x2484('0x20')]);}_0x2cd4b5[_0x2484('0x3e')]=qs[_0x2484('0x3f')](_0x2b1dba[_0x2484('0x34')][_0x2484('0x3f')]);_0x2cd4b5[_0x2484('0x40')]=qs[_0x2484('0x36')](_['pick'](_0x2b1dba[_0x2484('0x34')],_0x159207[_0x2484('0x36')]),_0x55c1c8);if(_0x2b1dba[_0x2484('0x34')][_0x2484('0x41')]){_0x2cd4b5[_0x2484('0x40')]=_['merge'](_0x2cd4b5[_0x2484('0x40')],{'$or':_['map'](_0x55c1c8,function(_0x3744e4){if(_0x3744e4[_0x2484('0x42')]!==_0x2484('0x43')){var _0x485ca1={};_0x485ca1[_0x3744e4[_0x2484('0x2a')]]={'$like':'%'+_0x2b1dba[_0x2484('0x34')][_0x2484('0x41')]+'%'};return _0x485ca1;}})});}_0x2cd4b5=_[_0x2484('0x44')]({},_0x2cd4b5,_0x2b1dba['options']);var _0x5d7af8={'where':_0x2cd4b5[_0x2484('0x40')]};return db['VoiceRecording'][_0x2484('0x1f')](_0x5d7af8)[_0x2484('0x28')](function(_0x478454){_0x351fc1['count']=_0x478454;if(_0x2b1dba['query']['includeAll']){_0x2cd4b5[_0x2484('0x45')]=[{'all':!![]}];}return db[_0x2484('0x2e')][_0x2484('0x46')](_0x2cd4b5);})[_0x2484('0x28')](function(_0x1050ec){_0x351fc1[_0x2484('0x47')]=_0x1050ec;return _0x351fc1;})[_0x2484('0x28')](respondWithFilteredResult(_0x1115a3,_0x2cd4b5))[_0x2484('0x48')](handleError(_0x1115a3,null));};exports[_0x2484('0x49')]=function(_0x5f0b19,_0x11271c){var _0x88c9ff={'raw':![],'where':{'id':_0x5f0b19['params']['id']}},_0xf0fc23={};_0xf0fc23[_0x2484('0x38')]=_[_0x2484('0x35')](db[_0x2484('0x2e')][_0x2484('0x2f')]);_0xf0fc23[_0x2484('0x34')]=_[_0x2484('0x35')](_0x5f0b19[_0x2484('0x34')]);_0xf0fc23['filters']=_['intersection'](_0xf0fc23[_0x2484('0x38')],_0xf0fc23[_0x2484('0x34')]);_0x88c9ff[_0x2484('0x39')]=_[_0x2484('0x37')](_0xf0fc23['model'],qs[_0x2484('0x3a')](_0x5f0b19['query'][_0x2484('0x3a')]));_0x88c9ff[_0x2484('0x39')]=_0x88c9ff[_0x2484('0x39')][_0x2484('0x3b')]?_0x88c9ff['attributes']:_0xf0fc23[_0x2484('0x38')];if(_0x5f0b19[_0x2484('0x34')][_0x2484('0x4a')]){_0x88c9ff[_0x2484('0x45')]=[{'all':!![]}];}_0x88c9ff=_[_0x2484('0x44')]({},_0x88c9ff,_0x5f0b19[_0x2484('0x4b')]);return db[_0x2484('0x2e')][_0x2484('0x4c')](_0x88c9ff)['then'](handleEntityNotFound(_0x11271c,null))[_0x2484('0x28')](respondWithResult(_0x11271c,null))['catch'](handleError(_0x11271c,null));};exports[_0x2484('0x4d')]=function(_0x51cb28,_0x5bebfb){return db['VoiceRecording'][_0x2484('0x4d')](_0x51cb28[_0x2484('0x4e')],{})[_0x2484('0x28')](respondWithResult(_0x5bebfb,0xc9))[_0x2484('0x48')](handleError(_0x5bebfb,null));};exports[_0x2484('0x27')]=function(_0x4efde5,_0x5c4d77){if(_0x4efde5['body']['id']){delete _0x4efde5[_0x2484('0x4e')]['id'];}return db[_0x2484('0x2e')]['find']({'where':{'id':_0x4efde5[_0x2484('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5c4d77,null))[_0x2484('0x28')](saveUpdates(_0x4efde5[_0x2484('0x4e')],null))[_0x2484('0x28')](respondWithResult(_0x5c4d77,null))['catch'](handleError(_0x5c4d77,null));};exports[_0x2484('0x50')]=function(_0x86de96,_0x3fdd3d){return db[_0x2484('0x2e')][_0x2484('0x50')]()[_0x2484('0x28')](respondWithResult(_0x3fdd3d,null))[_0x2484('0x48')](handleError(_0x3fdd3d,null));};exports[_0x2484('0x51')]=function(_0x24cf90,_0x48de88,_0x30e972){var _0xf109e2=require(_0x2484('0x52'));var _0xd4106f=![];var _0x48d553={};if(_0x24cf90[_0x2484('0x34')][_0x2484('0x42')]&&_0x24cf90[_0x2484('0x34')][_0x2484('0x42')]===_0x2484('0x53')){_0x48d553[_0x2484('0x53')]=_0x24cf90[_0x2484('0x4f')]['id'];}else{_0x48d553['id']=_0x24cf90['params']['id'];}return db['VoiceRecording'][_0x2484('0x4c')]({'where':_0x48d553,'attributes':['id',_0x2484('0x54')],'raw':!![]})[_0x2484('0x28')](handleEntityNotFound(_0x48de88,null))['then'](function(_0x545e7f){if(_0x545e7f){var _0x222de6=_0x545e7f[_0x2484('0x54')];var _0x42c9fb=util[_0x2484('0x33')](_0x2484('0x55'),_0x222de6);if(fs[_0x2484('0x56')](_0x42c9fb)){_0xd4106f=!![];return _0xf109e2[_0x2484('0x57')](_0x42c9fb,_0x222de6,config[_0x2484('0x58')][_0x2484('0x59')])[_0x2484('0x28')](function(){return _0x545e7f;});}return _0x545e7f;}})[_0x2484('0x28')](function(_0xfcea75){if(_0xfcea75){var _0x19617e=_0xfcea75['value'];if(!fs['existsSync'](_0x19617e)){throw new db['Sequelize']['ValidationError'](_0x2484('0x5a'));}if(_0xfcea75[_0x2484('0x5b')]){return _0x48de88[_0x2484('0x51')](_0x19617e,_0xfcea75[_0x2484('0x5b')]+path[_0x2484('0x5c')](_0x19617e),function(){if(_0xd4106f){fs['unlink'](_0x19617e);}});}else{return _0x48de88[_0x2484('0x51')](_0x19617e,function(_0x58a3d5){if(_0xd4106f){fs[_0x2484('0x5d')](_0x19617e);}});}}})[_0x2484('0x48')](function(_0x48ec4d){if(_0x48ec4d[_0x2484('0x5e')]==='VoiceRecording\x20not\x20found'){_0x48de88[_0x2484('0x21')](0x194)[_0x2484('0x2b')](_0x2484('0x5f'));}else{return handleError(_0x48de88,null);}});};exports[_0x2484('0x60')]=function(_0x169f13,_0x221142,_0x5c04f1){var _0x345f5d=require(_0x2484('0x52'));var _0x3c268d=![];var _0x242c57={'$and':[db['sequelize']['where'](db[_0x2484('0x61')]['fn'](_0x2484('0x62'),db[_0x2484('0x61')]['col']('uniqueid')),_0x169f13[_0x2484('0x34')][_0x2484('0x63')])]};if(_0x169f13[_0x2484('0x34')][_0x2484('0x42')]&&_0x169f13[_0x2484('0x34')][_0x2484('0x42')]===_0x2484('0x53')){_0x242c57[_0x2484('0x64')][_0x2484('0x65')]({'uniqueid':_0x169f13['params']['id']});}else{_0x242c57[_0x2484('0x64')][_0x2484('0x65')]({'id':_0x169f13[_0x2484('0x4f')]['id']});}return db[_0x2484('0x2e')][_0x2484('0x4c')]({'where':_0x242c57,'attributes':['id',_0x2484('0x54')],'raw':!![]})[_0x2484('0x28')](handleEntityNotFound(_0x221142,null))[_0x2484('0x28')](function(_0x559a49){if(_0x559a49){var _0x2c78b7=util['format'](_0x2484('0x55'),_0x559a49['value']);if(fs[_0x2484('0x56')](_0x2c78b7)){_0x3c268d=!![];return _0x345f5d[_0x2484('0x57')](_0x2c78b7,_0x559a49[_0x2484('0x54')],config[_0x2484('0x58')][_0x2484('0x59')])[_0x2484('0x28')](function(){return _0x559a49;});}return _0x559a49;}})[_0x2484('0x28')](function(_0x4bc390){if(_0x4bc390){if(!fs['existsSync'](_0x4bc390[_0x2484('0x54')])){throw new db[(_0x2484('0x66'))][(_0x2484('0x67'))](_0x2484('0x5a'));}if(_0x4bc390[_0x2484('0x5b')]){return _0x221142[_0x2484('0x51')](_0x4bc390[_0x2484('0x54')],_0x4bc390[_0x2484('0x5b')]+path[_0x2484('0x5c')](_0x4bc390[_0x2484('0x54')]),function(){if(_0x3c268d){fs[_0x2484('0x5d')](_0x4bc390[_0x2484('0x54')]);}});}else{return _0x221142[_0x2484('0x51')](_0x4bc390['value'],function(_0x2449a1){if(_0x3c268d){fs[_0x2484('0x5d')](_0x4bc390[_0x2484('0x54')]);}});}}})['catch'](handleError(_0x221142,null));};exports[_0x2484('0x68')]=function(_0x473629,_0x5e28d6){return db[_0x2484('0x2e')][_0x2484('0x4c')]({'where':{'id':_0x473629['params']['id']}})[_0x2484('0x28')](function(_0x299e1c){if(_[_0x2484('0x69')](_0x299e1c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x299e1c;})[_0x2484('0x28')](function(_0x1e1760){var _0x4e762d=_0x1e1760[_0x2484('0x54')];logger[_0x2484('0x6a')](_0x2484('0x6b'),_0x4e762d);if(!_['isNil'](_0x1e1760[_0x2484('0x54')])&&fs[_0x2484('0x56')](_0x4e762d)){logger[_0x2484('0x6a')](_0x2484('0x6c')+_0x4e762d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2484('0x6d')](_0x4e762d);}_0x4e762d=_0x4e762d+_0x2484('0x6e');if(!_[_0x2484('0x69')](_0x1e1760['value'])&&fs[_0x2484('0x56')](_0x4e762d)){logger[_0x2484('0x6a')](_0x2484('0x6c')+_0x4e762d+_0x2484('0x6f'));fs[_0x2484('0x6d')](_0x4e762d);}return _0x1e1760;})[_0x2484('0x28')](function(_0x57725b){if(!_0x57725b)throw new InternalError();return _0x57725b['destroy']();})['then'](function(){_0x5e28d6[_0x2484('0x21')](0xcc)['end']();})[_0x2484('0x48')](handleError(_0x5e28d6,null));};function getBucketslist(_0x416d49,_0xadab46,_0x5df5e2){return new Promise(function(_0xaf6932,_0x224db5){var _0x4b8178=new AWS['S3']({'accessKeyId':_0xadab46,'secretAccessKey':_0x416d49,'region':_0x5df5e2});_0x4b8178['listBuckets']({},function(_0x29752a,_0x2bb16e){if(_0x29752a){return _0x224db5(_0x29752a);}else{return _0xaf6932(_0x2bb16e);}});});}function createBucket(_0x595212,_0x1f7887,_0x300f02,_0x335937){return new Promise(function(_0x7eb2ee,_0x4c8b18){var _0x4a05f5=new AWS['S3']({'accessKeyId':_0x1f7887,'secretAccessKey':_0x595212,'region':_0x300f02});_0x4a05f5['createBucket']({'Bucket':_0x335937},function(_0x1ee105,_0x353c74){if(_0x1ee105){return _0x4c8b18(_0x1ee105);}else{return _0x7eb2ee(_0x353c74);}});});}function uploadFile(_0x2c4e18,_0x33cdcd,_0x2b92c5,_0x4d88ed,_0x5713d1,_0x298342){return new Promise(function(_0x1269bb,_0x710f51){var _0x408648=new AWS['S3']({'accessKeyId':_0x33cdcd,'secretAccessKey':_0x2c4e18,'region':_0x2b92c5});_0x408648[_0x2484('0x70')]({'Bucket':_0x4d88ed,'Key':_0x5713d1,'Body':_0x298342},function(_0x1361f8,_0x736a71){if(_0x1361f8){return _0x710f51(_0x1361f8);}else{return _0x1269bb(_0x736a71);}});});}function startTranscribe(_0x354672,_0x5d6887,_0x23f716,_0x534667,_0x1d91cd,_0x42484d){return new Promise(function(_0x50c11a,_0x48bf08){var _0x4cb1c0=new AWS['TranscribeService']({'accessKeyId':_0x5d6887,'secretAccessKey':_0x354672,'region':_0x23f716});_0x4cb1c0[_0x2484('0x71')]({'TranscriptionJobName':_0x534667,'LanguageCode':_0x1d91cd,'Media':{'MediaFileUri':_0x42484d}},function(_0x13fb0c,_0x41b7a8){if(_0x13fb0c){return _0x48bf08(_0x13fb0c);}else{return _0x50c11a(_0x41b7a8);}});});}function transcribe(_0x5a21cb,_0x58cfc7,_0x339f7c,_0x3de704,_0xcaffd9,_0x42859f,_0x9c97b6){return new Promise(function(_0x15e5b5,_0xa967fc){var _0x228d1c={};logger[_0x2484('0x6a')](util['format'](_0x2484('0x72'),_0x5a21cb,_0xcaffd9));return uploadFile(_0x58cfc7,_0x339f7c,_0x3de704,_0xcaffd9,path[_0x2484('0x73')](_0x42859f),fs['readFileSync'](_0x42859f))['then'](function(_0xf96144){logger[_0x2484('0x6a')](util[_0x2484('0x33')](_0x2484('0x74'),_0x5a21cb,_0xcaffd9,_0xf96144[_0x2484('0x75')]));_0x228d1c[_0x2484('0x76')]=_0xf96144[_0x2484('0x77')];_0x228d1c[_0x2484('0x78')]=_0xf96144['Location'];logger['info'](util[_0x2484('0x33')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x5a21cb));return startTranscribe(_0x58cfc7,_0x339f7c,_0x3de704,uuidv4(),_0x9c97b6,_0xf96144[_0x2484('0x75')]);})['then'](function(_0x43c418){logger[_0x2484('0x6a')](util[_0x2484('0x33')](_0x2484('0x79'),_0x5a21cb,_0x43c418['TranscriptionJob']['TranscriptionJobName']));_0x228d1c['transcribeName']=_0x43c418[_0x2484('0x7a')][_0x2484('0x7b')];_0x228d1c[_0x2484('0x7c')]=_0x43c418[_0x2484('0x7a')][_0x2484('0x7d')];return _0x15e5b5(_0x228d1c);})[_0x2484('0x48')](function(_0x51a280){return _0xa967fc(_0x51a280);});});}exports['runTranscribe']=function(_0x45d77f,_0x3b7de0,_0x4ae691){var _0x19e7a1;var _0x53f332;var _0x1518e6;var _0x1f8415=require(_0x2484('0x52'));return db[_0x2484('0x2e')][_0x2484('0x7e')]({'where':{'id':_0x45d77f['params']['id']}})[_0x2484('0x28')](function(_0x406abe){if(_0x406abe){var _0x345833=util['format'](_0x2484('0x55'),_0x406abe[_0x2484('0x54')]);if(fs['existsSync'](_0x345833)){cypher=!![];return _0x1f8415['decryptFile'](_0x345833,_0x406abe['value'],config['secrets'][_0x2484('0x59')])[_0x2484('0x28')](function(){return _0x406abe;});}return _0x406abe;}})[_0x2484('0x28')](function(_0x538d35){if(!_0x538d35){throw new db[(_0x2484('0x66'))][(_0x2484('0x67'))](_0x2484('0x7f'));}_0x53f332=_0x538d35;return db[_0x2484('0x80')]['findOne']({'where':{'id':0x1}});})[_0x2484('0x28')](handleEntityNotFound(_0x3b7de0,null))['then'](function(_0x3047b5){if(_0x3047b5){_0x19e7a1=_0x3047b5;if(!_0x19e7a1[_0x2484('0x81')]||!_0x19e7a1[_0x2484('0x82')]||!_0x19e7a1[_0x2484('0x83')]||!_0x19e7a1[_0x2484('0x84')]||!_0x19e7a1[_0x2484('0x76')]){throw new db[(_0x2484('0x66'))][(_0x2484('0x67'))]('Transcribe\x20not\x20configured');}if(_0x45d77f[_0x2484('0x4e')][_0x2484('0x85')]&&(!_0x19e7a1[_0x2484('0x86')]||!_0x19e7a1[_0x2484('0x87')]||!_0x19e7a1[_0x2484('0x88')]||!_0x19e7a1[_0x2484('0x84')]||!_0x19e7a1[_0x2484('0x76')])){throw new db[(_0x2484('0x66'))][(_0x2484('0x67'))](_0x2484('0x89'));}return db['CloudProvider']['findOne']({'where':{'id':_0x19e7a1[_0x2484('0x82')]}});}})[_0x2484('0x28')](function(_0x259ac8){if(!_0x259ac8){throw new db[(_0x2484('0x66'))][(_0x2484('0x67'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x259ac8['data1']||!_0x259ac8[_0x2484('0x8a')]){throw new db[(_0x2484('0x66'))]['ValidationError'](_0x2484('0x8b'));}_0x1518e6=_0x259ac8;return getBucketslist(_0x1518e6[_0x2484('0x8c')],_0x1518e6[_0x2484('0x8a')],_0x19e7a1[_0x2484('0x83')]);})['then'](function(_0x2077b4){if(_0x2077b4&&_0x2077b4['Buckets']){var _0x1e6f81=_['find'](_0x2077b4[_0x2484('0x8d')],function(_0x249f1d){return _0x249f1d['Name']===_0x19e7a1[_0x2484('0x76')];});if(!_0x1e6f81){logger['info'](util[_0x2484('0x33')](_0x2484('0x8e'),_0x45d77f[_0x2484('0x4f')]['id'],_0x19e7a1[_0x2484('0x76')]));return createBucket(_0x1518e6[_0x2484('0x8c')],_0x1518e6[_0x2484('0x8a')],_0x19e7a1[_0x2484('0x83')],_0x19e7a1[_0x2484('0x76')]);}logger[_0x2484('0x6a')](util['format'](_0x2484('0x8f'),_0x45d77f[_0x2484('0x4f')]['id'],_0x19e7a1['bucket']));return;}})[_0x2484('0x28')](function(_0xdf6662){if(_0x53f332[_0x2484('0x7c')]===_0x2484('0x90')){return transcribe(_0x45d77f[_0x2484('0x4f')]['id'],_0x1518e6[_0x2484('0x8c')],_0x1518e6[_0x2484('0x8a')],_0x19e7a1[_0x2484('0x83')],_0x19e7a1[_0x2484('0x76')],_0x53f332[_0x2484('0x54')],_0x19e7a1[_0x2484('0x84')]);}else{logger['info'](util[_0x2484('0x33')](_0x2484('0x91'),_0x45d77f[_0x2484('0x4f')]['id']));return{'transcribeStatus':_0x2484('0x92')};}})[_0x2484('0x28')](function(_0x23a651){if(_0x23a651){_0x23a651[_0x2484('0x93')]=_0x45d77f[_0x2484('0x4e')][_0x2484('0x85')];return _0x53f332[_0x2484('0x94')](_0x23a651);}})[_0x2484('0x28')](respondWithResult(_0x3b7de0,null))[_0x2484('0x48')](handleError(_0x3b7de0,null));};function writeFile(_0x131891,_0x277f8a){return new Promise(function(_0x41e635,_0x47d272){fs['writeFile'](_0x277f8a,_0x131891,function(_0x2b57ef,_0x49f269){if(_0x2b57ef){return _0x47d272(_0x2b57ef);}else{return _0x41e635(_0x49f269);}});});}exports[_0x2484('0x95')]=function(_0xa778d4,_0xcdaa50,_0x50b479){return db[_0x2484('0x2e')][_0x2484('0x7e')]({'where':{'id':_0xa778d4[_0x2484('0x4f')]['id']}})[_0x2484('0x28')](handleEntityNotFound(_0xcdaa50))[_0x2484('0x28')](function(_0x23dc79){if(_0x23dc79&&_0x23dc79['fileText']){var _0x48de7a=_0x23dc79[_0x2484('0x96')];var _0x1082a5=config['root']+_0x2484('0x97')+_0x23dc79['id']+'.txt';if(fs['existsSync'](_0x1082a5)){return _0x1082a5;}return writeFile(_0x48de7a,_0x1082a5)[_0x2484('0x28')](function(){return _0x1082a5;});}else{throw new db[(_0x2484('0x66'))][(_0x2484('0x67'))](_0x2484('0x98'));}})[_0x2484('0x28')](function(_0x17603b){return _0xcdaa50[_0x2484('0x51')](_0x17603b);})['catch'](handleError(_0xcdaa50));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ee9e3a3..9ac6706 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 _0x76bc=['define','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0x76bc,0x17f));var _0xc76b=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x76bc[_0x5cb97e];return _0x1714b4;};'use strict';var attributes=require(_0xc76b('0x0'));module[_0xc76b('0x1')]=function(_0x2f2672,_0x158c4f){return _0x2f2672[_0xc76b('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xc76b('0x3'),'fields':[_0xc76b('0x3')]},{'name':_0xc76b('0x4'),'fields':[_0xc76b('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3fb7=['voice_recordings','uniqueid','transcribeStatus','exports','define'];(function(_0x309ad8,_0x3365a0){var _0x3114d4=function(_0x526e93){while(--_0x526e93){_0x309ad8['push'](_0x309ad8['shift']());}};_0x3114d4(++_0x3365a0);}(_0x3fb7,0x189));var _0x73fb=function(_0x13e504,_0x52d2cb){_0x13e504=_0x13e504-0x0;var _0x37e3a0=_0x3fb7[_0x13e504];return _0x37e3a0;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x73fb('0x0')]=function(_0x58700a,_0x3482a5){return _0x58700a[_0x73fb('0x1')]('VoiceRecording',attributes,{'tableName':_0x73fb('0x2'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x73fb('0x3')]},{'name':_0x73fb('0x4'),'fields':[_0x73fb('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 53be264..9900de7 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 _0x160f=['../../config/environment','client','http','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','create','existsSync','format','%s.cypher','encryptFile','value','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x321c08,_0x26cc00){var _0x2652a8=function(_0x43415e){while(--_0x43415e){_0x321c08['push'](_0x321c08['shift']());}};_0x2652a8(++_0x26cc00);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')](_0x4b8185[_0xf160('0x19')],{'raw':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8185['options']?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1c')]||null:null,'attributes':_0x4b8185[_0xf160('0x1a')]?_0x4b8185['options'][_0xf160('0x1d')]||null:null,'limit':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1e')]||null:null})[_0xf160('0xc')](function(_0x1b0081){logger[_0xf160('0xd')]('UpdateVoiceRecording',_0x4b8185);logger[_0xf160('0x1f')](_0xf160('0x16'),_0x4b8185,JSON[_0xf160('0x11')](_0x1b0081));_0x1cf6ba(_0x1b0081);})[_0xf160('0x15')](function(_0x578f7d){logger[_0xf160('0x12')](_0xf160('0x16'),_0x578f7d['message'],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0x578f7d[_0xf160('0x14')]));});});};exports[_0xf160('0x20')]=function(_0x39c0e3){var _0x4c0c51=this;return new Promise(function(_0xcfa9bd,_0x73851f){var _0x2851e8=require(_0xf160('0x21'));var _0x135e0f;return db[_0xf160('0x22')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x26e7b9){_0x135e0f=_0x26e7b9;return db[_0xf160('0x17')][_0xf160('0x23')](_0x39c0e3[_0xf160('0x19')]);})[_0xf160('0xc')](function(_0x563103){if(_0x135e0f['callRecordingEncryption']&&fs[_0xf160('0x24')](_0x563103['value'])){var _0x4ce478=util[_0xf160('0x25')](_0xf160('0x26'),_0x563103['value']);return _0x2851e8[_0xf160('0x27')](_0x563103[_0xf160('0x28')],_0x4ce478,config['secrets']['recording'])['then'](function(){fs['unlink'](_0x563103[_0xf160('0x28')]);logger[_0xf160('0xd')](_0xf160('0x29'));return _0x563103;});}return _0x563103;})[_0xf160('0xc')](function(_0x16c528){logger[_0xf160('0xd')]('CreateVoiceRecording',_0x39c0e3);logger['debug']('CreateVoiceRecording',_0x39c0e3,JSON[_0xf160('0x11')](_0x16c528));_0xcfa9bd(_0x16c528);})['catch'](function(_0x5c65d2){logger[_0xf160('0x12')](_0xf160('0x20'),_0x5c65d2['message'],_0x39c0e3);_0x73851f(_0x4c0c51[_0xf160('0x12')](0x1f4,_0x5c65d2[_0xf160('0x14')]));});});}; \ No newline at end of file +var _0x25e7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','callRecordingEncryption','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','stringify','CreateVoiceRecording','lodash','util','moment'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x25e7,0x1d6));var _0x725e=function(_0x5db4b0,_0x17dfb5){_0x5db4b0=_0x5db4b0-0x0;var _0x126c9f=_0x25e7[_0x5db4b0];return _0x126c9f;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});}exports[_0x725e('0x16')]=function(_0x397e33){var _0x268438=this;return new Promise(function(_0x2811e7,_0x528e7d){return db[_0x725e('0x17')][_0x725e('0x18')](_0x397e33[_0x725e('0x19')],{'raw':_0x397e33[_0x725e('0x1a')]?_0x397e33[_0x725e('0x1a')][_0x725e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x397e33['options']?_0x397e33[_0x725e('0x1a')][_0x725e('0x1c')]||null:null,'attributes':_0x397e33[_0x725e('0x1a')]?_0x397e33[_0x725e('0x1a')][_0x725e('0x1d')]||null:null,'limit':_0x397e33[_0x725e('0x1a')]?_0x397e33[_0x725e('0x1a')][_0x725e('0x1e')]||null:null})[_0x725e('0xc')](function(_0x5c33c1){logger[_0x725e('0xd')](_0x725e('0x16'),_0x397e33);logger[_0x725e('0x10')](_0x725e('0x16'),_0x397e33,JSON['stringify'](_0x5c33c1));_0x2811e7(_0x5c33c1);})[_0x725e('0x15')](function(_0x5268c8){logger['error']('UpdateVoiceRecording',_0x5268c8[_0x725e('0x13')],_0x397e33);_0x528e7d(_0x268438[_0x725e('0x12')](0x1f4,_0x5268c8[_0x725e('0x13')]));});});};exports['CreateVoiceRecording']=function(_0xab6cfd){var _0x8a138f=this;return new Promise(function(_0x5a5bef,_0x14e9e0){var _0x339a58=require('../../components/encryptor');var _0x378ace;return db['Setting']['findOne']({'attributes':['id',_0x725e('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3b42bd){_0x378ace=_0x3b42bd;return db['VoiceRecording']['create'](_0xab6cfd[_0x725e('0x19')]);})[_0x725e('0xc')](function(_0x33fe34){if(_0x378ace['callRecordingEncryption']&&fs[_0x725e('0x20')](_0x33fe34['value'])){var _0x85d29c=util[_0x725e('0x21')](_0x725e('0x22'),_0x33fe34[_0x725e('0x23')]);return _0x339a58[_0x725e('0x24')](_0x33fe34[_0x725e('0x23')],_0x85d29c,config[_0x725e('0x25')][_0x725e('0x26')])[_0x725e('0xc')](function(){fs[_0x725e('0x27')](_0x33fe34[_0x725e('0x23')]);logger['info'](_0x725e('0x28'));return _0x33fe34;});}return _0x33fe34;})[_0x725e('0xc')](function(_0x5d3258){logger[_0x725e('0xd')]('CreateVoiceRecording',_0xab6cfd);logger[_0x725e('0x10')]('CreateVoiceRecording',_0xab6cfd,JSON[_0x725e('0x29')](_0x5d3258));_0x5a5bef(_0x5d3258);})[_0x725e('0x15')](function(_0x1f2898){logger[_0x725e('0x12')](_0x725e('0x2a'),_0x1f2898[_0x725e('0x13')],_0xab6cfd);_0x14e9e0(_0x8a138f['error'](0x1f4,_0x1f2898['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index f4e919c..1520bb5 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 _0x7246=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x50c326,_0xcb6404){var _0x69a342=function(_0x83d667){while(--_0x83d667){_0x50c326['push'](_0x50c326['shift']());}};_0x69a342(++_0xcb6404);}(_0x7246,0x10c));var _0x6724=function(_0x16af7f,_0x590573){_0x16af7f=_0x16af7f-0x0;var _0xe2adde=_0x7246[_0x16af7f];return _0xe2adde;};'use strict';var multer=require(_0x6724('0x0'));var util=require(_0x6724('0x1'));var path=require(_0x6724('0x2'));var timeout=require(_0x6724('0x3'));var express=require(_0x6724('0x4'));var router=express[_0x6724('0x5')]();var fs_extra=require(_0x6724('0x6'));var auth=require(_0x6724('0x7'));var interaction=require(_0x6724('0x8'));var config=require(_0x6724('0x9'));var controller=require(_0x6724('0xa'));router[_0x6724('0xb')]('/',auth[_0x6724('0xc')](),controller['index']);router['get']('/describe',auth[_0x6724('0xc')](),controller[_0x6724('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6724('0xe')]('/',auth['isAuthenticated'](),controller[_0x6724('0xf')]);router[_0x6724('0x10')](_0x6724('0x11'),auth['isAuthenticated'](),controller[_0x6724('0x12')]);router[_0x6724('0x13')]('/:id',auth[_0x6724('0xc')](),controller[_0x6724('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2de5=['show','post','put','update','/:id','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','isAuthenticated'];(function(_0x28caf8,_0x3c8e61){var _0x58b214=function(_0x33cb75){while(--_0x33cb75){_0x28caf8['push'](_0x28caf8['shift']());}};_0x58b214(++_0x3c8e61);}(_0x2de5,0x103));var _0x52de=function(_0x29f80e,_0x9027ff){_0x29f80e=_0x29f80e-0x0;var _0x5c7eaa=_0x2de5[_0x29f80e];return _0x5c7eaa;};'use strict';var multer=require(_0x52de('0x0'));var util=require('util');var path=require(_0x52de('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x52de('0x2')]();var fs_extra=require(_0x52de('0x3'));var auth=require(_0x52de('0x4'));var interaction=require(_0x52de('0x5'));var config=require(_0x52de('0x6'));var controller=require('./voiceTransferReport.controller');router[_0x52de('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x52de('0x7')](_0x52de('0x8'),auth['isAuthenticated'](),controller[_0x52de('0x9')]);router[_0x52de('0x7')]('/:id',auth[_0x52de('0xa')](),controller[_0x52de('0xb')]);router[_0x52de('0xc')]('/',auth[_0x52de('0xa')](),controller['create']);router[_0x52de('0xd')]('/:id',auth[_0x52de('0xa')](),controller[_0x52de('0xe')]);router['delete'](_0x52de('0xf'),auth[_0x52de('0xa')](),controller[_0x52de('0x10')]);module[_0x52de('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 4f17124..467480b 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 _0x5973=['ENUM','attended','STRING','Yes','sequelize','moment'];(function(_0xf6ae70,_0x170430){var _0x494a41=function(_0x11fb9b){while(--_0x11fb9b){_0xf6ae70['push'](_0xf6ae70['shift']());}};_0x494a41(++_0x170430);}(_0x5973,0x172));var _0x3597=function(_0x2d6c1a,_0x2eba95){_0x2d6c1a=_0x2d6c1a-0x0;var _0x530d7f=_0x5973[_0x2d6c1a];return _0x530d7f;};'use strict';var Sequelize=require(_0x3597('0x0'));var moment=require(_0x3597('0x1'));module['exports']={'type':{'type':Sequelize[_0x3597('0x2')]('blind',_0x3597('0x3'))},'result':{'type':Sequelize[_0x3597('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x3597('0x4')]},'transferercalleridname':{'type':Sequelize[_0x3597('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3597('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x3597('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x3597('0x4')]},'transfererexten':{'type':Sequelize[_0x3597('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x3597('0x4')]},'transfereechannel':{'type':Sequelize[_0x3597('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x3597('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x3597('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3597('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3597('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x3597('0x4')]},'transfereecontext':{'type':Sequelize[_0x3597('0x4')]},'transfereeexten':{'type':Sequelize[_0x3597('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x3597('0x4')]},'isexternal':{'type':Sequelize[_0x3597('0x2')](_0x3597('0x5'),'No')},'context':{'type':Sequelize[_0x3597('0x4')]},'extension':{'type':Sequelize[_0x3597('0x4')]}}; \ No newline at end of file +var _0x4685=['exports','ENUM','blind','attended','STRING','moment'];(function(_0x6612c3,_0x3cf921){var _0x956d1=function(_0x3e4521){while(--_0x3e4521){_0x6612c3['push'](_0x6612c3['shift']());}};_0x956d1(++_0x3cf921);}(_0x4685,0x6b));var _0x5468=function(_0x31d6b5,_0x4b4062){_0x31d6b5=_0x31d6b5-0x0;var _0x2982e3=_0x4685[_0x31d6b5];return _0x2982e3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5468('0x0'));module[_0x5468('0x1')]={'type':{'type':Sequelize[_0x5468('0x2')](_0x5468('0x3'),_0x5468('0x4'))},'result':{'type':Sequelize[_0x5468('0x5')]},'transfererchannel':{'type':Sequelize[_0x5468('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x5468('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x5468('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x5468('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x5468('0x5')]},'transferercontext':{'type':Sequelize[_0x5468('0x5')]},'transfererexten':{'type':Sequelize[_0x5468('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x5468('0x5')]},'transfereechannel':{'type':Sequelize[_0x5468('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x5468('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x5468('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x5468('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x5468('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5468('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 2e04497..f937aa5 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 _0x02e0=['error','name','index','VoiceTransferReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x02e0,0x18d));var _0x002e=function(_0x2074a5,_0x26e9db){_0x2074a5=_0x2074a5-0x0;var _0x1c6620=_0x02e0[_0x2074a5];return _0x1c6620;};'use strict';var emlformat=require(_0x002e('0x0'));var rimraf=require(_0x002e('0x1'));var zipdir=require(_0x002e('0x2'));var jsonpatch=require(_0x002e('0x3'));var rp=require('request-promise');var moment=require(_0x002e('0x4'));var BPromise=require(_0x002e('0x5'));var Mustache=require('mustache');var util=require(_0x002e('0x6'));var path=require(_0x002e('0x7'));var sox=require(_0x002e('0x8'));var csv=require(_0x002e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x002e('0xa'));var crypto=require(_0x002e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x002e('0x9'));var querystring=require(_0x002e('0xc'));var Papa=require(_0x002e('0xd'));var Redis=require(_0x002e('0xe'));var authService=require(_0x002e('0xf'));var qs=require(_0x002e('0x10'));var as=require(_0x002e('0x11'));var hardwareService=require(_0x002e('0x12'));var logger=require(_0x002e('0x13'))(_0x002e('0x14'));var utils=require(_0x002e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x002e('0x16'))['db'];function respondWithStatusCode(_0x4067e1,_0x185a22){_0x185a22=_0x185a22||0xcc;return function(_0x2ddb1c){if(_0x2ddb1c){return _0x4067e1['sendStatus'](_0x185a22);}return _0x4067e1[_0x002e('0x17')](_0x185a22)[_0x002e('0x18')]();};}function respondWithResult(_0x362e53,_0x2a3912){_0x2a3912=_0x2a3912||0xc8;return function(_0x4dcd37){if(_0x4dcd37){return _0x362e53['status'](_0x2a3912)['json'](_0x4dcd37);}};}function respondWithFilteredResult(_0x2e6ab2,_0x615dbe){return function(_0xb8d8a0){if(_0xb8d8a0){var _0x424dd9=typeof _0x615dbe[_0x002e('0x19')]===_0x002e('0x1a')&&typeof _0x615dbe[_0x002e('0x1b')]==='undefined';var _0x2e9446=_0xb8d8a0[_0x002e('0x1c')];var _0x13fb40=_0x424dd9?0x0:_0x615dbe[_0x002e('0x19')];var _0xef4736=_0x424dd9?_0xb8d8a0[_0x002e('0x1c')]:_0x615dbe[_0x002e('0x19')]+_0x615dbe[_0x002e('0x1b')];var _0x559be0;if(_0xef4736>=_0x2e9446){_0xef4736=_0x2e9446;_0x559be0=0xc8;}else{_0x559be0=0xce;}_0x2e6ab2[_0x002e('0x17')](_0x559be0);return _0x2e6ab2[_0x002e('0x1d')](_0x002e('0x1e'),_0x13fb40+'-'+_0xef4736+'/'+_0x2e9446)[_0x002e('0x1f')](_0xb8d8a0);}return null;};}function patchUpdates(_0x5c820e){return function(_0x4f1fa9){try{jsonpatch['apply'](_0x4f1fa9,_0x5c820e,!![]);}catch(_0x468670){return BPromise[_0x002e('0x20')](_0x468670);}return _0x4f1fa9[_0x002e('0x21')]();};}function saveUpdates(_0x27bd9f,_0x36e184){return function(_0xb67ccb){if(_0xb67ccb){return _0xb67ccb['update'](_0x27bd9f)[_0x002e('0x22')](function(_0x33c849){return _0x33c849;});}return null;};}function removeEntity(_0x2a11de,_0x4635f8){return function(_0x30e094){if(_0x30e094){return _0x30e094['destroy']()['then'](function(){_0x2a11de['status'](0xcc)[_0x002e('0x18')]();});}};}function handleEntityNotFound(_0x71b861,_0x3a85f2){return function(_0x1011e5){if(!_0x1011e5){_0x71b861['sendStatus'](0x194);}return _0x1011e5;};}function handleError(_0x4cc18a,_0x4029e9){_0x4029e9=_0x4029e9||0x1f4;return function(_0x4d5cf5){logger[_0x002e('0x23')](_0x4d5cf5['stack']);if(_0x4d5cf5['name']){delete _0x4d5cf5[_0x002e('0x24')];}_0x4cc18a['status'](_0x4029e9)['send'](_0x4d5cf5);};}exports[_0x002e('0x25')]=function(_0x2545b8,_0x4ea5a0){var _0x5a1769={},_0x31b491={},_0x2c0cd0={'count':0x0,'rows':[]};var _0xc572bb=_['map'](db[_0x002e('0x26')][_0x002e('0x27')],function(_0x4380a4){return{'name':_0x4380a4['fieldName'],'type':_0x4380a4[_0x002e('0x28')][_0x002e('0x29')]};});_0x31b491[_0x002e('0x2a')]=_['map'](_0xc572bb,'name');_0x31b491['query']=_[_0x002e('0x2b')](_0x2545b8[_0x002e('0x2c')]);_0x31b491[_0x002e('0x2d')]=_[_0x002e('0x2e')](_0x31b491['model'],_0x31b491[_0x002e('0x2c')]);_0x5a1769[_0x002e('0x2f')]=_[_0x002e('0x2e')](_0x31b491['model'],qs['fields'](_0x2545b8[_0x002e('0x2c')]['fields']));_0x5a1769[_0x002e('0x2f')]=_0x5a1769[_0x002e('0x2f')][_0x002e('0x30')]?_0x5a1769[_0x002e('0x2f')]:_0x31b491[_0x002e('0x2a')];if(!_0x2545b8[_0x002e('0x2c')][_0x002e('0x31')]('nolimit')){_0x5a1769[_0x002e('0x1b')]=qs[_0x002e('0x1b')](_0x2545b8[_0x002e('0x2c')][_0x002e('0x1b')]);_0x5a1769['offset']=qs[_0x002e('0x19')](_0x2545b8[_0x002e('0x2c')]['offset']);}_0x5a1769['order']=qs['sort'](_0x2545b8[_0x002e('0x2c')][_0x002e('0x32')]);_0x5a1769[_0x002e('0x33')]=qs[_0x002e('0x2d')](_[_0x002e('0x34')](_0x2545b8[_0x002e('0x2c')],_0x31b491[_0x002e('0x2d')]),_0xc572bb);if(_0x2545b8[_0x002e('0x2c')]['filter']){_0x5a1769[_0x002e('0x33')]=_[_0x002e('0x35')](_0x5a1769['where'],{'$or':_[_0x002e('0x36')](_0xc572bb,function(_0x57fe00){if(_0x57fe00[_0x002e('0x28')]!==_0x002e('0x37')){var _0x521753={};_0x521753[_0x57fe00['name']]={'$like':'%'+_0x2545b8[_0x002e('0x2c')][_0x002e('0x38')]+'%'};return _0x521753;}})});}_0x5a1769=_['merge']({},_0x5a1769,_0x2545b8[_0x002e('0x39')]);var _0x3680bf={'where':_0x5a1769['where']};return db[_0x002e('0x26')][_0x002e('0x1c')](_0x3680bf)[_0x002e('0x22')](function(_0x544bff){_0x2c0cd0['count']=_0x544bff;if(_0x2545b8[_0x002e('0x2c')][_0x002e('0x3a')]){_0x5a1769[_0x002e('0x3b')]=[{'all':!![]}];}return db[_0x002e('0x26')][_0x002e('0x3c')](_0x5a1769);})[_0x002e('0x22')](function(_0x1ebe77){_0x2c0cd0[_0x002e('0x3d')]=_0x1ebe77;return _0x2c0cd0;})['then'](respondWithFilteredResult(_0x4ea5a0,_0x5a1769))[_0x002e('0x3e')](handleError(_0x4ea5a0,null));};exports[_0x002e('0x3f')]=function(_0x2f41c1,_0x5af10f){var _0x6c06a4={'raw':!![],'where':{'id':_0x2f41c1[_0x002e('0x40')]['id']}},_0x2614cc={};_0x2614cc[_0x002e('0x2a')]=_[_0x002e('0x2b')](db[_0x002e('0x26')][_0x002e('0x27')]);_0x2614cc[_0x002e('0x2c')]=_['keys'](_0x2f41c1[_0x002e('0x2c')]);_0x2614cc['filters']=_[_0x002e('0x2e')](_0x2614cc[_0x002e('0x2a')],_0x2614cc[_0x002e('0x2c')]);_0x6c06a4[_0x002e('0x2f')]=_['intersection'](_0x2614cc[_0x002e('0x2a')],qs[_0x002e('0x41')](_0x2f41c1[_0x002e('0x2c')][_0x002e('0x41')]));_0x6c06a4[_0x002e('0x2f')]=_0x6c06a4[_0x002e('0x2f')]['length']?_0x6c06a4[_0x002e('0x2f')]:_0x2614cc['model'];if(_0x2f41c1[_0x002e('0x2c')][_0x002e('0x3a')]){_0x6c06a4[_0x002e('0x3b')]=[{'all':!![]}];}_0x6c06a4=_[_0x002e('0x35')]({},_0x6c06a4,_0x2f41c1[_0x002e('0x39')]);return db[_0x002e('0x26')][_0x002e('0x42')](_0x6c06a4)['then'](handleEntityNotFound(_0x5af10f,null))[_0x002e('0x22')](respondWithResult(_0x5af10f,null))[_0x002e('0x3e')](handleError(_0x5af10f,null));};exports[_0x002e('0x43')]=function(_0x4cde31,_0x292ee1){return db['VoiceTransferReport']['create'](_0x4cde31[_0x002e('0x44')],{})[_0x002e('0x22')](respondWithResult(_0x292ee1,0xc9))[_0x002e('0x3e')](handleError(_0x292ee1,null));};exports[_0x002e('0x45')]=function(_0x4db6a6,_0x1ebf57){if(_0x4db6a6[_0x002e('0x44')]['id']){delete _0x4db6a6[_0x002e('0x44')]['id'];}return db[_0x002e('0x26')][_0x002e('0x42')]({'where':{'id':_0x4db6a6[_0x002e('0x40')]['id']}})[_0x002e('0x22')](handleEntityNotFound(_0x1ebf57,null))[_0x002e('0x22')](saveUpdates(_0x4db6a6[_0x002e('0x44')],null))[_0x002e('0x22')](respondWithResult(_0x1ebf57,null))[_0x002e('0x3e')](handleError(_0x1ebf57,null));};exports[_0x002e('0x46')]=function(_0x13f975,_0x117989){return db['VoiceTransferReport']['find']({'where':{'id':_0x13f975[_0x002e('0x40')]['id']}})['then'](handleEntityNotFound(_0x117989,null))[_0x002e('0x22')](removeEntity(_0x117989,null))[_0x002e('0x3e')](handleError(_0x117989,null));};exports[_0x002e('0x47')]=function(_0x152c6d,_0x32f694){return db[_0x002e('0x26')][_0x002e('0x47')]()[_0x002e('0x22')](respondWithResult(_0x32f694,null))['catch'](handleError(_0x32f694,null));}; \ No newline at end of file +var _0x48dd=['fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','rawAttributes','keys','merge','find','create','body','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceTransferReport','type','key','query','filters','intersection','model'];(function(_0x4e7dad,_0x3f2aa4){var _0x40bc94=function(_0x52adb1){while(--_0x52adb1){_0x4e7dad['push'](_0x4e7dad['shift']());}};_0x40bc94(++_0x3f2aa4);}(_0x48dd,0xa4));var _0xd48d=function(_0x2ae5b7,_0x26d3c6){_0x2ae5b7=_0x2ae5b7-0x0;var _0x309864=_0x48dd[_0x2ae5b7];return _0x309864;};'use strict';var emlformat=require(_0xd48d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd48d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd48d('0x2'));var moment=require('moment');var BPromise=require(_0xd48d('0x3'));var Mustache=require(_0xd48d('0x4'));var util=require(_0xd48d('0x5'));var path=require('path');var sox=require(_0xd48d('0x6'));var csv=require(_0xd48d('0x7'));var ejs=require(_0xd48d('0x8'));var fs=require('fs');var fs_extra=require(_0xd48d('0x9'));var _=require(_0xd48d('0xa'));var squel=require(_0xd48d('0xb'));var crypto=require(_0xd48d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd48d('0xd'));var toCsv=require(_0xd48d('0x7'));var querystring=require('querystring');var Papa=require(_0xd48d('0xe'));var Redis=require('ioredis');var authService=require(_0xd48d('0xf'));var qs=require(_0xd48d('0x10'));var as=require(_0xd48d('0x11'));var hardwareService=require(_0xd48d('0x12'));var logger=require(_0xd48d('0x13'))(_0xd48d('0x14'));var utils=require('../../config/utils');var config=require(_0xd48d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf98ec5,_0x189a23){_0x189a23=_0x189a23||0xcc;return function(_0x4a6eed){if(_0x4a6eed){return _0xf98ec5[_0xd48d('0x16')](_0x189a23);}return _0xf98ec5[_0xd48d('0x17')](_0x189a23)[_0xd48d('0x18')]();};}function respondWithResult(_0x2e568d,_0x5abc56){_0x5abc56=_0x5abc56||0xc8;return function(_0x594eec){if(_0x594eec){return _0x2e568d[_0xd48d('0x17')](_0x5abc56)[_0xd48d('0x19')](_0x594eec);}};}function respondWithFilteredResult(_0x5b7a83,_0x276d0c){return function(_0x3d9091){if(_0x3d9091){var _0xe623c1=typeof _0x276d0c[_0xd48d('0x1a')]==='undefined'&&typeof _0x276d0c[_0xd48d('0x1b')]==='undefined';var _0xcec20d=_0x3d9091['count'];var _0x5f3760=_0xe623c1?0x0:_0x276d0c[_0xd48d('0x1a')];var _0x515248=_0xe623c1?_0x3d9091[_0xd48d('0x1c')]:_0x276d0c[_0xd48d('0x1a')]+_0x276d0c[_0xd48d('0x1b')];var _0x4bd5db;if(_0x515248>=_0xcec20d){_0x515248=_0xcec20d;_0x4bd5db=0xc8;}else{_0x4bd5db=0xce;}_0x5b7a83[_0xd48d('0x17')](_0x4bd5db);return _0x5b7a83[_0xd48d('0x1d')](_0xd48d('0x1e'),_0x5f3760+'-'+_0x515248+'/'+_0xcec20d)['json'](_0x3d9091);}return null;};}function patchUpdates(_0x20ee42){return function(_0x2ec390){try{jsonpatch[_0xd48d('0x1f')](_0x2ec390,_0x20ee42,!![]);}catch(_0x665e08){return BPromise[_0xd48d('0x20')](_0x665e08);}return _0x2ec390[_0xd48d('0x21')]();};}function saveUpdates(_0x426dd0,_0x1b88c4){return function(_0x463601){if(_0x463601){return _0x463601[_0xd48d('0x22')](_0x426dd0)[_0xd48d('0x23')](function(_0xb3dca8){return _0xb3dca8;});}return null;};}function removeEntity(_0x415514,_0x19680b){return function(_0x58384d){if(_0x58384d){return _0x58384d[_0xd48d('0x24')]()['then'](function(){_0x415514[_0xd48d('0x17')](0xcc)[_0xd48d('0x18')]();});}};}function handleEntityNotFound(_0x5b1227,_0x319605){return function(_0x304faa){if(!_0x304faa){_0x5b1227[_0xd48d('0x16')](0x194);}return _0x304faa;};}function handleError(_0x2dab7b,_0x4cde85){_0x4cde85=_0x4cde85||0x1f4;return function(_0x402255){logger['error'](_0x402255[_0xd48d('0x25')]);if(_0x402255[_0xd48d('0x26')]){delete _0x402255[_0xd48d('0x26')];}_0x2dab7b[_0xd48d('0x17')](_0x4cde85)[_0xd48d('0x27')](_0x402255);};}exports[_0xd48d('0x28')]=function(_0x2f41d8,_0x401577){var _0x43e82a={},_0x1e31e8={},_0x5dff5c={'count':0x0,'rows':[]};var _0xca18cc=_[_0xd48d('0x29')](db[_0xd48d('0x2a')]['rawAttributes'],function(_0x4d6d3e){return{'name':_0x4d6d3e['fieldName'],'type':_0x4d6d3e[_0xd48d('0x2b')][_0xd48d('0x2c')]};});_0x1e31e8['model']=_[_0xd48d('0x29')](_0xca18cc,_0xd48d('0x26'));_0x1e31e8[_0xd48d('0x2d')]=_['keys'](_0x2f41d8['query']);_0x1e31e8[_0xd48d('0x2e')]=_[_0xd48d('0x2f')](_0x1e31e8[_0xd48d('0x30')],_0x1e31e8[_0xd48d('0x2d')]);_0x43e82a['attributes']=_[_0xd48d('0x2f')](_0x1e31e8[_0xd48d('0x30')],qs['fields'](_0x2f41d8[_0xd48d('0x2d')][_0xd48d('0x31')]));_0x43e82a['attributes']=_0x43e82a[_0xd48d('0x32')][_0xd48d('0x33')]?_0x43e82a['attributes']:_0x1e31e8[_0xd48d('0x30')];if(!_0x2f41d8[_0xd48d('0x2d')][_0xd48d('0x34')]('nolimit')){_0x43e82a['limit']=qs[_0xd48d('0x1b')](_0x2f41d8['query'][_0xd48d('0x1b')]);_0x43e82a['offset']=qs['offset'](_0x2f41d8[_0xd48d('0x2d')]['offset']);}_0x43e82a['order']=qs[_0xd48d('0x35')](_0x2f41d8[_0xd48d('0x2d')][_0xd48d('0x35')]);_0x43e82a[_0xd48d('0x36')]=qs[_0xd48d('0x2e')](_[_0xd48d('0x37')](_0x2f41d8[_0xd48d('0x2d')],_0x1e31e8['filters']),_0xca18cc);if(_0x2f41d8[_0xd48d('0x2d')]['filter']){_0x43e82a['where']=_['merge'](_0x43e82a['where'],{'$or':_[_0xd48d('0x29')](_0xca18cc,function(_0x43e29e){if(_0x43e29e[_0xd48d('0x2b')]!==_0xd48d('0x38')){var _0x23f525={};_0x23f525[_0x43e29e['name']]={'$like':'%'+_0x2f41d8[_0xd48d('0x2d')][_0xd48d('0x39')]+'%'};return _0x23f525;}})});}_0x43e82a=_['merge']({},_0x43e82a,_0x2f41d8[_0xd48d('0x3a')]);var _0x3dff0f={'where':_0x43e82a[_0xd48d('0x36')]};return db[_0xd48d('0x2a')][_0xd48d('0x1c')](_0x3dff0f)['then'](function(_0x1395f7){_0x5dff5c[_0xd48d('0x1c')]=_0x1395f7;if(_0x2f41d8[_0xd48d('0x2d')][_0xd48d('0x3b')]){_0x43e82a[_0xd48d('0x3c')]=[{'all':!![]}];}return db[_0xd48d('0x2a')][_0xd48d('0x3d')](_0x43e82a);})[_0xd48d('0x23')](function(_0x50c6c3){_0x5dff5c['rows']=_0x50c6c3;return _0x5dff5c;})[_0xd48d('0x23')](respondWithFilteredResult(_0x401577,_0x43e82a))[_0xd48d('0x3e')](handleError(_0x401577,null));};exports['show']=function(_0x204f95,_0x4225aa){var _0x135db4={'raw':!![],'where':{'id':_0x204f95[_0xd48d('0x3f')]['id']}},_0x2679e0={};_0x2679e0[_0xd48d('0x30')]=_['keys'](db['VoiceTransferReport'][_0xd48d('0x40')]);_0x2679e0[_0xd48d('0x2d')]=_[_0xd48d('0x41')](_0x204f95[_0xd48d('0x2d')]);_0x2679e0[_0xd48d('0x2e')]=_['intersection'](_0x2679e0['model'],_0x2679e0[_0xd48d('0x2d')]);_0x135db4[_0xd48d('0x32')]=_[_0xd48d('0x2f')](_0x2679e0['model'],qs[_0xd48d('0x31')](_0x204f95['query']['fields']));_0x135db4[_0xd48d('0x32')]=_0x135db4[_0xd48d('0x32')][_0xd48d('0x33')]?_0x135db4['attributes']:_0x2679e0[_0xd48d('0x30')];if(_0x204f95[_0xd48d('0x2d')][_0xd48d('0x3b')]){_0x135db4['include']=[{'all':!![]}];}_0x135db4=_[_0xd48d('0x42')]({},_0x135db4,_0x204f95[_0xd48d('0x3a')]);return db[_0xd48d('0x2a')][_0xd48d('0x43')](_0x135db4)['then'](handleEntityNotFound(_0x4225aa,null))[_0xd48d('0x23')](respondWithResult(_0x4225aa,null))[_0xd48d('0x3e')](handleError(_0x4225aa,null));};exports['create']=function(_0x44d70c,_0x29360a){return db[_0xd48d('0x2a')][_0xd48d('0x44')](_0x44d70c[_0xd48d('0x45')],{})[_0xd48d('0x23')](respondWithResult(_0x29360a,0xc9))[_0xd48d('0x3e')](handleError(_0x29360a,null));};exports['update']=function(_0x3899af,_0x4c37ce){if(_0x3899af['body']['id']){delete _0x3899af['body']['id'];}return db[_0xd48d('0x2a')]['find']({'where':{'id':_0x3899af[_0xd48d('0x3f')]['id']}})[_0xd48d('0x23')](handleEntityNotFound(_0x4c37ce,null))['then'](saveUpdates(_0x3899af[_0xd48d('0x45')],null))[_0xd48d('0x23')](respondWithResult(_0x4c37ce,null))[_0xd48d('0x3e')](handleError(_0x4c37ce,null));};exports[_0xd48d('0x24')]=function(_0x317ba6,_0x1a7486){return db[_0xd48d('0x2a')][_0xd48d('0x43')]({'where':{'id':_0x317ba6['params']['id']}})[_0xd48d('0x23')](handleEntityNotFound(_0x1a7486,null))[_0xd48d('0x23')](removeEntity(_0x1a7486,null))['catch'](handleError(_0x1a7486,null));};exports[_0xd48d('0x46')]=function(_0x435fb7,_0x57a156){return db[_0xd48d('0x2a')][_0xd48d('0x46')]()[_0xd48d('0x23')](respondWithResult(_0x57a156,null))['catch'](handleError(_0x57a156,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 96d407e..2e61e87 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 _0x47ee=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xa39dd4,_0x1eba04){var _0xaaded8=function(_0x36cf4d){while(--_0x36cf4d){_0xa39dd4['push'](_0xa39dd4['shift']());}};_0xaaded8(++_0x1eba04);}(_0x47ee,0x9d));var _0xe47e=function(_0x14563b,_0x2e6e80){_0x14563b=_0x14563b-0x0;var _0x3b165d=_0x47ee[_0x14563b];return _0x3b165d;};'use strict';var _=require(_0xe47e('0x0'));var util=require(_0xe47e('0x1'));var logger=require(_0xe47e('0x2'))(_0xe47e('0x3'));var moment=require(_0xe47e('0x4'));var BPromise=require(_0xe47e('0x5'));var rp=require(_0xe47e('0x6'));var fs=require('fs');var path=require(_0xe47e('0x7'));var rimraf=require(_0xe47e('0x8'));var config=require(_0xe47e('0x9'));var attributes=require(_0xe47e('0xa'));module[_0xe47e('0xb')]=function(_0x3fc804,_0x1cd9ec){return _0x3fc804[_0xe47e('0xc')](_0xe47e('0xd'),attributes,{'tableName':_0xe47e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f15=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x3abe2f,_0x1bdf2b){var _0x3f81e6=function(_0x51ede5){while(--_0x51ede5){_0x3abe2f['push'](_0x3abe2f['shift']());}};_0x3f81e6(++_0x1bdf2b);}(_0x0f15,0x11c));var _0x50f1=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x0f15[_0x529abc];return _0x453afa;};'use strict';var _=require(_0x50f1('0x0'));var util=require(_0x50f1('0x1'));var logger=require('../../config/logger')(_0x50f1('0x2'));var moment=require(_0x50f1('0x3'));var BPromise=require(_0x50f1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50f1('0x5'));var rimraf=require(_0x50f1('0x6'));var config=require(_0x50f1('0x7'));var attributes=require(_0x50f1('0x8'));module[_0x50f1('0x9')]=function(_0x3ce6db,_0x4b86ba){return _0x3ce6db[_0x50f1('0xa')](_0x50f1('0xb'),attributes,{'tableName':_0x50f1('0xc'),'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 14d1f57..b9504a3 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 _0x8693=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4768c6,_0xff55d6){var _0x41b439=function(_0x9b758c){while(--_0x9b758c){_0x4768c6['push'](_0x4768c6['shift']());}};_0x41b439(++_0xff55d6);}(_0x8693,0x18d));var _0x3869=function(_0x542823,_0x1cf8b2){_0x542823=_0x542823-0x0;var _0x385050=_0x8693[_0x542823];return _0x385050;};'use strict';var _=require(_0x3869('0x0'));var util=require(_0x3869('0x1'));var moment=require(_0x3869('0x2'));var BPromise=require(_0x3869('0x3'));var rs=require(_0x3869('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3869('0x5'));var logger=require(_0x3869('0x6'))('rpc');var config=require(_0x3869('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3869('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x133ac2,_0x4f48ab,_0x2a5c3d){return new BPromise(function(_0x46cb4b,_0x2b4143){return client[_0x3869('0x9')](_0x133ac2,_0x2a5c3d)[_0x3869('0xa')](function(_0x5ee9d0){logger[_0x3869('0xb')](_0x3869('0xc'),_0x4f48ab,_0x3869('0xd'));logger[_0x3869('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4f48ab,'request\x20sent',JSON[_0x3869('0xf')](_0x5ee9d0));if(_0x5ee9d0[_0x3869('0x10')]){if(_0x5ee9d0[_0x3869('0x10')][_0x3869('0x11')]===0x1f4){logger[_0x3869('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f48ab,_0x5ee9d0['error'][_0x3869('0x12')]);return _0x2b4143(_0x5ee9d0[_0x3869('0x10')][_0x3869('0x12')]);}logger['error'](_0x3869('0xc'),_0x4f48ab,_0x5ee9d0[_0x3869('0x10')]['message']);return _0x46cb4b(_0x5ee9d0[_0x3869('0x10')][_0x3869('0x12')]);}else{logger[_0x3869('0xb')](_0x3869('0xc'),_0x4f48ab,_0x3869('0xd'));_0x46cb4b(_0x5ee9d0[_0x3869('0x13')][_0x3869('0x12')]);}})[_0x3869('0x14')](function(_0x3b496a){logger[_0x3869('0x10')](_0x3869('0xc'),_0x4f48ab,_0x3b496a);_0x2b4143(_0x3b496a);});});}exports[_0x3869('0x15')]=function(_0x3c3295){var _0xa4f4c0=this;return new Promise(function(_0xa92dff,_0x1dcfe1){return db[_0x3869('0x16')]['create'](_0x3c3295[_0x3869('0x17')],{'raw':_0x3c3295[_0x3869('0x18')]?_0x3c3295[_0x3869('0x18')][_0x3869('0x19')]===undefined?!![]:![]:!![]})[_0x3869('0xa')](function(_0x23ed08){logger['info'](_0x3869('0x15'),_0x3c3295);logger[_0x3869('0xe')](_0x3869('0x15'),_0x3c3295,JSON[_0x3869('0xf')](_0x23ed08));_0xa92dff(_0x23ed08);})[_0x3869('0x14')](function(_0x4e84cb){logger['error'](_0x3869('0x15'),_0x4e84cb[_0x3869('0x12')],_0x3c3295);_0x1dcfe1(_0xa4f4c0['error'](0x1f4,_0x4e84cb['message']));});});}; \ No newline at end of file +var _0xa764=['request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceTransferReport','create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa764,0x1a4));var _0x4a76=function(_0xe36276,_0x52f69e){_0xe36276=_0xe36276-0x0;var _0x4fdde2=_0xa764[_0xe36276];return _0x4fdde2;};'use strict';var _=require(_0x4a76('0x0'));var util=require(_0x4a76('0x1'));var moment=require(_0x4a76('0x2'));var BPromise=require('bluebird');var rs=require(_0x4a76('0x3'));var fs=require('fs');var Redis=require(_0x4a76('0x4'));var db=require(_0x4a76('0x5'))['db'];var utils=require(_0x4a76('0x6'));var logger=require(_0x4a76('0x7'))(_0x4a76('0x8'));var config=require('../../config/environment');var jayson=require(_0x4a76('0x9'));var client=jayson[_0x4a76('0xa')][_0x4a76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x598438,_0x15417e,_0x190b59){return new BPromise(function(_0x5005f0,_0x4bfaa8){return client[_0x4a76('0xc')](_0x598438,_0x190b59)['then'](function(_0x5c5ca2){logger[_0x4a76('0xd')](_0x4a76('0xe'),_0x15417e,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x15417e,_0x4a76('0xf'),JSON[_0x4a76('0x10')](_0x5c5ca2));if(_0x5c5ca2[_0x4a76('0x11')]){if(_0x5c5ca2[_0x4a76('0x11')][_0x4a76('0x12')]===0x1f4){logger[_0x4a76('0x11')](_0x4a76('0xe'),_0x15417e,_0x5c5ca2[_0x4a76('0x11')][_0x4a76('0x13')]);return _0x4bfaa8(_0x5c5ca2['error'][_0x4a76('0x13')]);}logger['error'](_0x4a76('0xe'),_0x15417e,_0x5c5ca2[_0x4a76('0x11')]['message']);return _0x5005f0(_0x5c5ca2[_0x4a76('0x11')][_0x4a76('0x13')]);}else{logger[_0x4a76('0xd')](_0x4a76('0xe'),_0x15417e,_0x4a76('0xf'));_0x5005f0(_0x5c5ca2['result'][_0x4a76('0x13')]);}})[_0x4a76('0x14')](function(_0x229318){logger[_0x4a76('0x11')](_0x4a76('0xe'),_0x15417e,_0x229318);_0x4bfaa8(_0x229318);});});}exports['CreateVoiceTransferReport']=function(_0xeb25d7){var _0x4b6335=this;return new Promise(function(_0x2251d5,_0xf05555){return db[_0x4a76('0x15')][_0x4a76('0x16')](_0xeb25d7[_0x4a76('0x17')],{'raw':_0xeb25d7[_0x4a76('0x18')]?_0xeb25d7['options'][_0x4a76('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x48c0fe){logger[_0x4a76('0xd')]('CreateVoiceTransferReport',_0xeb25d7);logger[_0x4a76('0x1a')]('CreateVoiceTransferReport',_0xeb25d7,JSON['stringify'](_0x48c0fe));_0x2251d5(_0x48c0fe);})['catch'](function(_0x5de819){logger[_0x4a76('0x11')]('CreateVoiceTransferReport',_0x5de819[_0x4a76('0x13')],_0xeb25d7);_0xf05555(_0x4b6335[_0x4a76('0x11')](0x1f4,_0x5de819[_0x4a76('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 20c187a..6105651 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 _0x153f=['hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','isWebrtcLicence','hangup','answer','/hold'];(function(_0x4f3ba7,_0x35a3f9){var _0x51d980=function(_0x2a51ed){while(--_0x2a51ed){_0x4f3ba7['push'](_0x4f3ba7['shift']());}};_0x51d980(++_0x35a3f9);}(_0x153f,0x15b));var _0xf153=function(_0x4a029b,_0x3120ce){_0x4a029b=_0x4a029b-0x0;var _0x48c458=_0x153f[_0x4a029b];return _0x48c458;};'use strict';var express=require(_0xf153('0x0'));var router=express[_0xf153('0x1')]();var auth=require(_0xf153('0x2'));var controller=require(_0xf153('0x3'));router[_0xf153('0x4')](_0xf153('0x5'),auth[_0xf153('0x6')](),auth['isWebrtcLicence'](),controller[_0xf153('0x7')]);router['post'](_0xf153('0x8'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x4')]('/answer',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xb')]);router[_0xf153('0x4')](_0xf153('0xc'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xd')]);router[_0xf153('0x4')](_0xf153('0xe'),auth['isAuthenticated'](),auth[_0xf153('0x9')](),controller[_0xf153('0xf')]);router[_0xf153('0x4')]('/calls',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x4')](_0xf153('0x11'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x12')]);module[_0xf153('0x13')]=router; \ No newline at end of file +var _0xa9e0=['/transfer','transfer','exports','express','Router','../../components/auth/service','/originate','isWebrtcLicence','originate','post','/hangup','isAuthenticated','hangup','/answer','answer','hold','/unhold','calls'];(function(_0x774c33,_0x451036){var _0x11ee6d=function(_0x2ed72d){while(--_0x2ed72d){_0x774c33['push'](_0x774c33['shift']());}};_0x11ee6d(++_0x451036);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./webbar.controller');router['post'](_0x0a9e('0x3'),auth['isAuthenticated'](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0x5')]);router[_0x0a9e('0x6')](_0x0a9e('0x7'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x6')](_0x0a9e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x0a9e('0xb')]);router['post']('/hold',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x6')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller['unhold']);router['post']('/calls',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x6')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x10')]);module[_0x0a9e('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d1730c6..48da338 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 _0x0b5d=['userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','stack','name','status','send','request','then','error','message','result','catch','findOne','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','entityFound:','user:%s','webbar:originate','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold\x20fired:','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','rows','conference','conference\x20executed!','transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','http','../../config/logger','webbarapi','ioredis','redis','localhost','validate','number','string','callNumber\x20is\x20required'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x0b5d,0x136));var _0xd0b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b5d[_0x3dd15e];return _0x231fd0;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xd0b5('0x0'));var db=require(_0xd0b5('0x1'))['db'];var config=require(_0xd0b5('0x2'));var util=require(_0xd0b5('0x3'));var BPromise=require(_0xd0b5('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xd0b5('0x5')]({'port':0x232a});var logger=require(_0xd0b5('0x6'))(_0xd0b5('0x7'));var Redis=require(_0xd0b5('0x8'));config['redis']=_['defaults'](config[_0xd0b5('0x9')],{'host':_0xd0b5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd0b5('0x9')]));var Schema=require(_0xd0b5('0xb'));var originateValidation=new Schema({'userId':{'type':_0xd0b5('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xd0b5('0xd'),'required':[!![],_0xd0b5('0xe')]},'callerId':{'type':_0xd0b5('0xd')},'callbackUrl':{'type':_0xd0b5('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xd0b5('0xc'),'required':[!![],_0xd0b5('0xf')]},'sessionId':{'type':_0xd0b5('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd0b5('0xf')]},'sessionId':{'type':_0xd0b5('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd0b5('0xf')]},'sessionId':{'type':_0xd0b5('0xd'),'required':[!![],_0xd0b5('0x10')]},'transferNumber':{'type':_0xd0b5('0xd'),'required':[!![],_0xd0b5('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xd0b5('0xc'),'required':[!![],_0xd0b5('0xf')]},'sessionId':{'type':_0xd0b5('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd0b5('0xc'),'required':[!![],_0xd0b5('0xf')]},'sessionId':{'type':_0xd0b5('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd0b5('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xd0b5('0xc'),'required':[!![],_0xd0b5('0xf')]}});function emit(_0x259391,_0x52f5e3,_0x3e7885){logger[_0xd0b5('0x12')](_0x259391,_0x52f5e3,JSON[_0xd0b5('0x13')](_0x3e7885));io['to'](_0x259391)['emit'](_0x52f5e3,_0x3e7885);}function handleError(_0x528fb2){return function(_0x21c9c3){console[_0xd0b5('0x14')](_0xd0b5('0x15'),_0x21c9c3,_0x21c9c3 instanceof RangeError);logger['error'](_0x21c9c3[_0xd0b5('0x16')]);if(_0x21c9c3 instanceof RangeError){if(_0x21c9c3[_0xd0b5('0x17')]){delete _0x21c9c3[_0xd0b5('0x17')];}_0x528fb2[_0xd0b5('0x18')](0x194)[_0xd0b5('0x19')](_0x21c9c3);}else{if(_0x21c9c3[_0xd0b5('0x17')]){delete _0x21c9c3['name'];}_0x528fb2[_0xd0b5('0x18')](0x1f4)['send'](_0x21c9c3);}};}function checkError(){return function(_0x59cd6d){if(!_0x59cd6d){throw new RangeError('NotFound');}return _0x59cd6d;};}function respondWithRpcPromise(_0x401642,_0x323af2){return new BPromise(function(_0x1bd89a,_0x4ccf79){var _0x300fda=amiClient;return _0x300fda[_0xd0b5('0x1a')](_0x401642,_0x323af2)[_0xd0b5('0x1b')](function(_0x18545e){if(_0x18545e[_0xd0b5('0x1c')]){if(_0x18545e[_0xd0b5('0x1c')]['code']===0x1f4){return _0x4ccf79(_0x18545e[_0xd0b5('0x1c')]['message']);}return _0x1bd89a(_0x18545e['error'][_0xd0b5('0x1d')]);}else{_0x1bd89a(_0x18545e[_0xd0b5('0x1e')]);}})[_0xd0b5('0x1f')](function(_0x53ffbb){_0x4ccf79(_0x53ffbb);});});}function getAgent(_0x1a6456){return db['User'][_0xd0b5('0x20')]({'where':{'id':_0x1a6456,'role':'agent'}})[_0xd0b5('0x1b')](checkError());}function getAgentCheckSession(_0xf8f14a,_0x4f5bea){return new BPromise(function(_0x246c78,_0xdebed4){var _0x5a0386=respondWithRpcPromise(_0xd0b5('0x21'));var _0x11e38b=getAgent(_0xf8f14a);Promise['all']([_0x5a0386,_0x11e38b])[_0xd0b5('0x1b')](function(_0x48ec2c){var _0x531440=_0x48ec2c[0x0];var _0x897435=_0x48ec2c[0x1];var _0xa94fe6=_[_0xd0b5('0x22')](_0x531440['rows'],function(_0x1ed37d){return _0x1ed37d[_0xd0b5('0x23')]==_0x897435['id']&&_0x1ed37d[_0xd0b5('0x24')]==_0x4f5bea;});if(_0xa94fe6[_0xd0b5('0x25')]==0x1){_0x246c78(_0x897435);}else{_0xdebed4(new RangeError(_0xd0b5('0x26')+_0x4f5bea+_0xd0b5('0x27')));}});});}exports[_0xd0b5('0x28')]=function(_0x7f92f5,_0x5425ff){logger[_0xd0b5('0x12')](_0xd0b5('0x29'),_0x7f92f5[_0xd0b5('0x2a')]);var _0x2a84a5=originateValidation[_0xd0b5('0xb')](_0x7f92f5[_0xd0b5('0x2a')]);if(_0x2a84a5[_0xd0b5('0x25')]>0x0){return _0x5425ff['status'](0x190)[_0xd0b5('0x2b')](_0x2a84a5);}var _0x2d442e=_0x7f92f5['body'][_0xd0b5('0x2c')];var _0x5b9110=_0x7f92f5[_0xd0b5('0x2a')]['callNumber'];var _0x1f9703=_0x7f92f5['body'][_0xd0b5('0x2d')];var _0x16d62d=_0x7f92f5[_0xd0b5('0x2a')]['callbackUrl'];return getAgent(_0x2d442e)[_0xd0b5('0x1b')](function(_0x3f07ab){logger['info'](_0xd0b5('0x2e'),_0x3f07ab[_0xd0b5('0x17')]);emit(util['format'](_0xd0b5('0x2f'),_0x3f07ab[_0xd0b5('0x17')]),_0xd0b5('0x30'),{'callNumber':_0x5b9110,'callerId':_0x1f9703,'callbackUrl':_0x16d62d});return _0x5425ff['status'](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0xd0b5('0x1f')](handleError(_0x5425ff));};exports['hangup']=function(_0x3da566,_0xa9fdd6){logger['info']('hangup\x20fired:',_0x3da566[_0xd0b5('0x2a')]);var _0x4c6e83=hangupValidation[_0xd0b5('0xb')](_0x3da566['body']);if(_0x4c6e83[_0xd0b5('0x25')]>0x0){return _0xa9fdd6[_0xd0b5('0x18')](0x190)[_0xd0b5('0x2b')](_0x4c6e83);}var _0x5bc1b7=_0x3da566[_0xd0b5('0x2a')][_0xd0b5('0x2c')];var _0x509d40=_0x3da566['body'][_0xd0b5('0x24')];return getAgent(_0x5bc1b7)[_0xd0b5('0x1b')](function(_0x585647){logger[_0xd0b5('0x12')](_0xd0b5('0x2e'),_0x585647['name']);emit(util[_0xd0b5('0x31')](_0xd0b5('0x2f'),_0x585647[_0xd0b5('0x17')]),'webbar:hangup',{'sessionId':_0x509d40});return _0xa9fdd6[_0xd0b5('0x18')](0xc8)['json']({'error':![],'message':_0xd0b5('0x32')});})[_0xd0b5('0x1f')](handleError(_0xa9fdd6));};exports[_0xd0b5('0x33')]=function(_0x18d6e2,_0x4a6115){logger[_0xd0b5('0x12')](_0xd0b5('0x34'),_0x18d6e2[_0xd0b5('0x2a')]);var _0x3b273c=answerValidation[_0xd0b5('0xb')](_0x18d6e2[_0xd0b5('0x2a')]);if(_0x3b273c[_0xd0b5('0x25')]>0x0){return _0x4a6115[_0xd0b5('0x18')](0x190)[_0xd0b5('0x2b')](_0x3b273c);}var _0xbca630=_0x18d6e2[_0xd0b5('0x2a')]['userId'];var _0x17a469=_0x18d6e2[_0xd0b5('0x2a')]['sessionId'];return getAgent(_0xbca630)[_0xd0b5('0x1b')](function(_0x1273ae){logger[_0xd0b5('0x12')](_0xd0b5('0x2e'),_0x1273ae[_0xd0b5('0x17')]);emit(util[_0xd0b5('0x31')](_0xd0b5('0x2f'),_0x1273ae[_0xd0b5('0x17')]),_0xd0b5('0x35'),{'sessionId':_0x17a469});return _0x4a6115[_0xd0b5('0x18')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0xd0b5('0x1f')](handleError(_0x4a6115));};exports['hold']=function(_0x1ae2a5,_0x231e8e){logger[_0xd0b5('0x12')](_0xd0b5('0x36'),_0x1ae2a5[_0xd0b5('0x2a')]);var _0x3af078=holdValidation[_0xd0b5('0xb')](_0x1ae2a5[_0xd0b5('0x2a')]);if(_0x3af078[_0xd0b5('0x25')]>0x0){return _0x231e8e[_0xd0b5('0x18')](0x190)[_0xd0b5('0x2b')](_0x3af078);}var _0x3ce47f=_0x1ae2a5['body'][_0xd0b5('0x2c')];var _0x165386=_0x1ae2a5[_0xd0b5('0x2a')][_0xd0b5('0x24')];return getAgent(_0x3ce47f)[_0xd0b5('0x1b')](function(_0x35f93b){logger[_0xd0b5('0x12')](_0xd0b5('0x2e'),_0x35f93b['name']);emit(util[_0xd0b5('0x31')](_0xd0b5('0x2f'),_0x35f93b['name']),'webbar:hold',{'sessionId':_0x165386});return _0x231e8e[_0xd0b5('0x18')](0xc8)[_0xd0b5('0x2b')]({'error':![],'message':'hold\x20executed!'});})[_0xd0b5('0x1f')](handleError(_0x231e8e));};exports[_0xd0b5('0x37')]=function(_0x6e213f,_0x3c9f27){logger[_0xd0b5('0x12')](_0xd0b5('0x38'),_0x6e213f[_0xd0b5('0x2a')]);var _0x3e346e=unholdValidation['validate'](_0x6e213f['body']);if(_0x3e346e[_0xd0b5('0x25')]>0x0){return _0x3c9f27[_0xd0b5('0x18')](0x190)[_0xd0b5('0x2b')](_0x3e346e);}var _0x3b0504=_0x6e213f['body'][_0xd0b5('0x2c')];var _0x2aa0fc=_0x6e213f[_0xd0b5('0x2a')][_0xd0b5('0x24')];return getAgent(_0x3b0504)[_0xd0b5('0x1b')](function(_0x1bb295){logger[_0xd0b5('0x12')]('entityFound:',_0x1bb295[_0xd0b5('0x17')]);emit(util[_0xd0b5('0x31')](_0xd0b5('0x2f'),_0x1bb295[_0xd0b5('0x17')]),'webbar:unhold',{'sessionId':_0x2aa0fc});return _0x3c9f27[_0xd0b5('0x18')](0xc8)['json']({'error':![],'message':_0xd0b5('0x39')});})[_0xd0b5('0x1f')](handleError(_0x3c9f27));};exports[_0xd0b5('0x3a')]=function(_0x4e68ba,_0x528839){logger['info'](_0xd0b5('0x3b'),_0x528839[_0xd0b5('0x2a')]);var _0x3994b1=callsValidation[_0xd0b5('0xb')](_0x4e68ba[_0xd0b5('0x2a')]);if(_0x3994b1[_0xd0b5('0x25')]>0x0){return _0x528839[_0xd0b5('0x18')](0x190)['json'](_0x3994b1);}var _0x54e0ee=_0x4e68ba[_0xd0b5('0x2a')][_0xd0b5('0x2c')];var _0x4bb772=respondWithRpcPromise(_0xd0b5('0x21'));var _0x17753a=getAgent(_0x54e0ee);return Promise['all']([_0x4bb772,_0x17753a])[_0xd0b5('0x1b')](function(_0x2b92cd){var _0x5e8fea=_0x2b92cd[0x0];var _0x2d6f62=_0x2b92cd[0x1];var _0x2352aa=_[_0xd0b5('0x22')](_0x5e8fea[_0xd0b5('0x3c')],function(_0x10ebcb){return _0x10ebcb['UserId']==_0x2d6f62['id'];});return _0x528839[_0xd0b5('0x18')](0xc8)['json']({'count':_0x2352aa[_0xd0b5('0x25')],'rows':_0x2352aa});})[_0xd0b5('0x1f')](handleError(_0x528839));};exports[_0xd0b5('0x3d')]=function(_0x3385c6,_0x498c21){logger['info']('conference\x20fired:',_0x3385c6[_0xd0b5('0x2a')]);var _0x37c648=conferenceValidation[_0xd0b5('0xb')](_0x3385c6[_0xd0b5('0x2a')]);if(_0x37c648[_0xd0b5('0x25')]>0x0){return _0x498c21['status'](0x190)[_0xd0b5('0x2b')](_0x37c648);}var _0x333dbd=_0x3385c6['body'][_0xd0b5('0x2c')];return getAgent(_0x333dbd)['then'](function(_0xee4d4){logger[_0xd0b5('0x12')](_0xd0b5('0x2e'),_0xee4d4[_0xd0b5('0x17')]);emit(util[_0xd0b5('0x31')](_0xd0b5('0x2f'),_0xee4d4[_0xd0b5('0x17')]),'webbar:conference');return _0x498c21[_0xd0b5('0x18')](0xc8)[_0xd0b5('0x2b')]({'error':![],'message':_0xd0b5('0x3e')});})[_0xd0b5('0x1f')](handleError(_0x498c21));};exports[_0xd0b5('0x3f')]=function(_0x43cb09,_0x48f0da){logger['info']('transfer\x20fired:',_0x43cb09['body']);var _0x279391=transferValidation['validate'](_0x43cb09[_0xd0b5('0x2a')]);if(_0x279391[_0xd0b5('0x25')]>0x0){return _0x48f0da[_0xd0b5('0x18')](0x190)[_0xd0b5('0x2b')](_0x279391);}var _0x34e373=_0x43cb09[_0xd0b5('0x2a')][_0xd0b5('0x2c')];var _0x54f176=_0x43cb09[_0xd0b5('0x2a')][_0xd0b5('0x24')];var _0x3c9ca3=_0x43cb09['body']['transferNumber'];return getAgent(_0x34e373)['then'](function(_0x1e7e5d){logger[_0xd0b5('0x12')]('entityFound:',_0x1e7e5d[_0xd0b5('0x17')]);emit(util[_0xd0b5('0x31')](_0xd0b5('0x2f'),_0x1e7e5d[_0xd0b5('0x17')]),'webbar:transfer',{'sessionId':_0x54f176,'transferNumber':_0x3c9ca3});return _0x48f0da[_0xd0b5('0x18')](0xc8)[_0xd0b5('0x2b')]({'error':![],'message':_0xd0b5('0x40')});})[_0xd0b5('0x1f')](handleError(_0x48f0da));}; \ No newline at end of file +var _0x296f=['callbackUrl','format','user:%s','webbar:originate','json','hangup','hangup\x20fired:','userId','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','all','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','http','../../config/logger','defaults','redis','socket.io-emitter','number','string','callNumber\x20is\x20required','userId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','then','code','message','result','catch','findOne','agent','VoiceChannels','filter','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','length','callerId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x296f,0xf0));var _0xf296=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x296f[_0x5581ba];return _0x1e927f;};'use strict';var path=require(_0xf296('0x0'));var fs=require('fs');var _=require(_0xf296('0x1'));var db=require(_0xf296('0x2'))['db'];var config=require(_0xf296('0x3'));var util=require(_0xf296('0x4'));var BPromise=require(_0xf296('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xf296('0x6')]({'port':0x232a});var logger=require(_0xf296('0x7'))('webbarapi');var Redis=require('ioredis');config['redis']=_[_0xf296('0x8')](config[_0xf296('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf296('0xa'))(new Redis(config[_0xf296('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf296('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xf296('0xc'),'required':[!![],_0xf296('0xd')]},'callerId':{'type':_0xf296('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xf296('0xb'),'required':[!![],_0xf296('0xe')]},'sessionId':{'type':_0xf296('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf296('0xe')]},'sessionId':{'type':_0xf296('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf296('0xb'),'required':[!![],_0xf296('0xe')]},'sessionId':{'type':_0xf296('0xc'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0xf296('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0xf296('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf296('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf296('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf296('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf296('0xb'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x25ba1e,_0x422b54,_0x1f3b5b){logger[_0xf296('0x10')](_0x25ba1e,_0x422b54,JSON[_0xf296('0x11')](_0x1f3b5b));io['to'](_0x25ba1e)[_0xf296('0x12')](_0x422b54,_0x1f3b5b);}function handleError(_0x3db703){return function(_0x2ea567){console['log'](_0xf296('0x13'),_0x2ea567,_0x2ea567 instanceof RangeError);logger[_0xf296('0x14')](_0x2ea567[_0xf296('0x15')]);if(_0x2ea567 instanceof RangeError){if(_0x2ea567[_0xf296('0x16')]){delete _0x2ea567[_0xf296('0x16')];}_0x3db703[_0xf296('0x17')](0x194)['send'](_0x2ea567);}else{if(_0x2ea567[_0xf296('0x16')]){delete _0x2ea567['name'];}_0x3db703[_0xf296('0x17')](0x1f4)[_0xf296('0x18')](_0x2ea567);}};}function checkError(){return function(_0x4a9bc1){if(!_0x4a9bc1){throw new RangeError(_0xf296('0x19'));}return _0x4a9bc1;};}function respondWithRpcPromise(_0x3bdc0e,_0x20ffdf){return new BPromise(function(_0x4f337b,_0x3f8a9e){var _0x396227=amiClient;return _0x396227['request'](_0x3bdc0e,_0x20ffdf)[_0xf296('0x1a')](function(_0xb497cf){if(_0xb497cf[_0xf296('0x14')]){if(_0xb497cf[_0xf296('0x14')][_0xf296('0x1b')]===0x1f4){return _0x3f8a9e(_0xb497cf[_0xf296('0x14')]['message']);}return _0x4f337b(_0xb497cf[_0xf296('0x14')][_0xf296('0x1c')]);}else{_0x4f337b(_0xb497cf[_0xf296('0x1d')]);}})[_0xf296('0x1e')](function(_0x40dfcd){_0x3f8a9e(_0x40dfcd);});});}function getAgent(_0x357fd5){return db['User'][_0xf296('0x1f')]({'where':{'id':_0x357fd5,'role':_0xf296('0x20')}})[_0xf296('0x1a')](checkError());}function getAgentCheckSession(_0x3f5067,_0x380831){return new BPromise(function(_0x1393c1,_0x23a55f){var _0x20693c=respondWithRpcPromise(_0xf296('0x21'));var _0x57b4e5=getAgent(_0x3f5067);Promise['all']([_0x20693c,_0x57b4e5])['then'](function(_0x1609ed){var _0x286498=_0x1609ed[0x0];var _0x21a38a=_0x1609ed[0x1];var _0xc76eef=_[_0xf296('0x22')](_0x286498['rows'],function(_0x95d538){return _0x95d538['UserId']==_0x21a38a['id']&&_0x95d538[_0xf296('0x23')]==_0x380831;});if(_0xc76eef['length']==0x1){_0x1393c1(_0x21a38a);}else{_0x23a55f(new RangeError(_0xf296('0x24')+_0x380831+_0xf296('0x25')));}});});}exports[_0xf296('0x26')]=function(_0x2edf4d,_0x402c95){logger[_0xf296('0x10')](_0xf296('0x27'),_0x2edf4d[_0xf296('0x28')]);var _0x5eb657=originateValidation[_0xf296('0x29')](_0x2edf4d['body']);if(_0x5eb657[_0xf296('0x2a')]>0x0){return _0x402c95[_0xf296('0x17')](0x190)['json'](_0x5eb657);}var _0x21058d=_0x2edf4d[_0xf296('0x28')]['userId'];var _0x30f39c=_0x2edf4d['body']['callNumber'];var _0x1e97c9=_0x2edf4d['body'][_0xf296('0x2b')];var _0x56ba3a=_0x2edf4d[_0xf296('0x28')][_0xf296('0x2c')];return getAgent(_0x21058d)[_0xf296('0x1a')](function(_0x262487){logger[_0xf296('0x10')]('entityFound:',_0x262487['name']);emit(util[_0xf296('0x2d')](_0xf296('0x2e'),_0x262487[_0xf296('0x16')]),_0xf296('0x2f'),{'callNumber':_0x30f39c,'callerId':_0x1e97c9,'callbackUrl':_0x56ba3a});return _0x402c95[_0xf296('0x17')](0xc8)[_0xf296('0x30')]({'error':![],'message':'originate\x20executed!'});})[_0xf296('0x1e')](handleError(_0x402c95));};exports[_0xf296('0x31')]=function(_0x128bb7,_0x157bf0){logger[_0xf296('0x10')](_0xf296('0x32'),_0x128bb7['body']);var _0x4a54d6=hangupValidation[_0xf296('0x29')](_0x128bb7[_0xf296('0x28')]);if(_0x4a54d6[_0xf296('0x2a')]>0x0){return _0x157bf0[_0xf296('0x17')](0x190)['json'](_0x4a54d6);}var _0x1e3255=_0x128bb7['body'][_0xf296('0x33')];var _0x2b098c=_0x128bb7[_0xf296('0x28')]['sessionId'];return getAgent(_0x1e3255)['then'](function(_0xdd90ae){logger['info'](_0xf296('0x34'),_0xdd90ae['name']);emit(util['format'](_0xf296('0x2e'),_0xdd90ae['name']),_0xf296('0x35'),{'sessionId':_0x2b098c});return _0x157bf0['status'](0xc8)[_0xf296('0x30')]({'error':![],'message':_0xf296('0x36')});})[_0xf296('0x1e')](handleError(_0x157bf0));};exports['answer']=function(_0x5333ff,_0x397f02){logger['info'](_0xf296('0x37'),_0x5333ff[_0xf296('0x28')]);var _0x28729c=answerValidation['validate'](_0x5333ff['body']);if(_0x28729c[_0xf296('0x2a')]>0x0){return _0x397f02[_0xf296('0x17')](0x190)[_0xf296('0x30')](_0x28729c);}var _0x15f6ed=_0x5333ff[_0xf296('0x28')][_0xf296('0x33')];var _0x309c8d=_0x5333ff[_0xf296('0x28')]['sessionId'];return getAgent(_0x15f6ed)[_0xf296('0x1a')](function(_0x5eabd6){logger[_0xf296('0x10')](_0xf296('0x34'),_0x5eabd6['name']);emit(util[_0xf296('0x2d')](_0xf296('0x2e'),_0x5eabd6[_0xf296('0x16')]),_0xf296('0x38'),{'sessionId':_0x309c8d});return _0x397f02['status'](0xc8)[_0xf296('0x30')]({'error':![],'message':_0xf296('0x39')});})[_0xf296('0x1e')](handleError(_0x397f02));};exports[_0xf296('0x3a')]=function(_0x1f7e94,_0xef69dc){logger[_0xf296('0x10')](_0xf296('0x3b'),_0x1f7e94[_0xf296('0x28')]);var _0x2cd465=holdValidation[_0xf296('0x29')](_0x1f7e94[_0xf296('0x28')]);if(_0x2cd465[_0xf296('0x2a')]>0x0){return _0xef69dc['status'](0x190)['json'](_0x2cd465);}var _0x16d8b5=_0x1f7e94[_0xf296('0x28')]['userId'];var _0xcf413d=_0x1f7e94['body']['sessionId'];return getAgent(_0x16d8b5)[_0xf296('0x1a')](function(_0xf6f1c9){logger[_0xf296('0x10')]('entityFound:',_0xf6f1c9[_0xf296('0x16')]);emit(util[_0xf296('0x2d')](_0xf296('0x2e'),_0xf6f1c9[_0xf296('0x16')]),_0xf296('0x3c'),{'sessionId':_0xcf413d});return _0xef69dc[_0xf296('0x17')](0xc8)[_0xf296('0x30')]({'error':![],'message':'hold\x20executed!'});})[_0xf296('0x1e')](handleError(_0xef69dc));};exports['unhold']=function(_0x2a7155,_0x181a2b){logger[_0xf296('0x10')](_0xf296('0x3d'),_0x2a7155[_0xf296('0x28')]);var _0x5ed02a=unholdValidation[_0xf296('0x29')](_0x2a7155[_0xf296('0x28')]);if(_0x5ed02a[_0xf296('0x2a')]>0x0){return _0x181a2b[_0xf296('0x17')](0x190)[_0xf296('0x30')](_0x5ed02a);}var _0x15a64f=_0x2a7155[_0xf296('0x28')][_0xf296('0x33')];var _0x4c04fb=_0x2a7155[_0xf296('0x28')][_0xf296('0x23')];return getAgent(_0x15a64f)[_0xf296('0x1a')](function(_0x108c77){logger[_0xf296('0x10')](_0xf296('0x34'),_0x108c77[_0xf296('0x16')]);emit(util['format'](_0xf296('0x2e'),_0x108c77['name']),_0xf296('0x3e'),{'sessionId':_0x4c04fb});return _0x181a2b[_0xf296('0x17')](0xc8)['json']({'error':![],'message':_0xf296('0x3f')});})[_0xf296('0x1e')](handleError(_0x181a2b));};exports[_0xf296('0x40')]=function(_0xf6d81,_0x1478a2){logger[_0xf296('0x10')]('calls\x20fired:',_0x1478a2[_0xf296('0x28')]);var _0xd34b0f=callsValidation[_0xf296('0x29')](_0xf6d81[_0xf296('0x28')]);if(_0xd34b0f['length']>0x0){return _0x1478a2[_0xf296('0x17')](0x190)[_0xf296('0x30')](_0xd34b0f);}var _0x45c1f3=_0xf6d81['body'][_0xf296('0x33')];var _0x4bfff9=respondWithRpcPromise('VoiceChannels');var _0x51628a=getAgent(_0x45c1f3);return Promise[_0xf296('0x41')]([_0x4bfff9,_0x51628a])[_0xf296('0x1a')](function(_0x5f3fae){var _0x56e19c=_0x5f3fae[0x0];var _0x53a384=_0x5f3fae[0x1];var _0x423c4c=_[_0xf296('0x22')](_0x56e19c['rows'],function(_0x3d4f38){return _0x3d4f38['UserId']==_0x53a384['id'];});return _0x1478a2['status'](0xc8)[_0xf296('0x30')]({'count':_0x423c4c[_0xf296('0x2a')],'rows':_0x423c4c});})[_0xf296('0x1e')](handleError(_0x1478a2));};exports['conference']=function(_0x47a6f2,_0x161429){logger[_0xf296('0x10')](_0xf296('0x42'),_0x47a6f2[_0xf296('0x28')]);var _0x2d9d74=conferenceValidation['validate'](_0x47a6f2[_0xf296('0x28')]);if(_0x2d9d74['length']>0x0){return _0x161429['status'](0x190)[_0xf296('0x30')](_0x2d9d74);}var _0xe4f62=_0x47a6f2[_0xf296('0x28')]['userId'];return getAgent(_0xe4f62)[_0xf296('0x1a')](function(_0x17cb02){logger[_0xf296('0x10')](_0xf296('0x34'),_0x17cb02[_0xf296('0x16')]);emit(util['format']('user:%s',_0x17cb02[_0xf296('0x16')]),_0xf296('0x43'));return _0x161429['status'](0xc8)[_0xf296('0x30')]({'error':![],'message':_0xf296('0x44')});})[_0xf296('0x1e')](handleError(_0x161429));};exports[_0xf296('0x45')]=function(_0x186bc5,_0x432edb){logger[_0xf296('0x10')]('transfer\x20fired:',_0x186bc5['body']);var _0x4df190=transferValidation[_0xf296('0x29')](_0x186bc5[_0xf296('0x28')]);if(_0x4df190[_0xf296('0x2a')]>0x0){return _0x432edb['status'](0x190)[_0xf296('0x30')](_0x4df190);}var _0x450b8f=_0x186bc5[_0xf296('0x28')]['userId'];var _0x3eac0b=_0x186bc5['body']['sessionId'];var _0x450206=_0x186bc5['body']['transferNumber'];return getAgent(_0x450b8f)[_0xf296('0x1a')](function(_0x4a045b){logger['info']('entityFound:',_0x4a045b['name']);emit(util[_0xf296('0x2d')](_0xf296('0x2e'),_0x4a045b[_0xf296('0x16')]),'webbar:transfer',{'sessionId':_0x3eac0b,'transferNumber':_0x450206});return _0x432edb['status'](0xc8)[_0xf296('0x30')]({'error':![],'message':_0xf296('0x46')});})[_0xf296('0x1e')](handleError(_0x432edb));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index a91ef11..933c84a 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 _0xab4a=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','post','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab4a,0xa8));var _0xaab4=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0xab4a[_0x2e53e1];return _0x3a23de;};'use strict';var multer=require(_0xaab4('0x0'));var util=require(_0xaab4('0x1'));var path=require(_0xaab4('0x2'));var timeout=require('connect-timeout');var express=require(_0xaab4('0x3'));var router=express['Router']();var fs_extra=require(_0xaab4('0x4'));var auth=require(_0xaab4('0x5'));var interaction=require(_0xaab4('0x6'));var config=require(_0xaab4('0x7'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0xaab4('0x8')](),controller[_0xaab4('0x9')]);router[_0xaab4('0xa')]('/describe',auth[_0xaab4('0x8')](),controller[_0xaab4('0xb')]);router[_0xaab4('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xaab4('0xc')]);router[_0xaab4('0xa')](_0xaab4('0xd'),auth[_0xaab4('0x8')](),controller[_0xaab4('0xe')]);router[_0xaab4('0xa')](_0xaab4('0xf'),auth[_0xaab4('0x8')](),controller[_0xaab4('0x10')]);router[_0xaab4('0xa')](_0xaab4('0x11'),auth['isAuthenticated'](),controller[_0xaab4('0x12')]);router['get']('/:id/applications',auth[_0xaab4('0x8')](),controller['getApplications']);router['post']('/',auth[_0xaab4('0x8')](),controller['create']);router[_0xaab4('0x13')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xaab4('0x14')]);router[_0xaab4('0x13')]('/:id/canned_answers',auth[_0xaab4('0x8')](),controller[_0xaab4('0x15')]);router['post'](_0xaab4('0x11'),auth['isAuthenticated'](),controller['addAgents']);router['post']('/:id/applications',auth[_0xaab4('0x8')](),controller[_0xaab4('0x16')]);router[_0xaab4('0x13')](_0xaab4('0x17'),controller[_0xaab4('0x18')]);router[_0xaab4('0x13')](_0xaab4('0x19'),auth['isAuthenticated'](),controller[_0xaab4('0x1a')]);router[_0xaab4('0x1b')](_0xaab4('0x1c'),auth[_0xaab4('0x8')](),controller[_0xaab4('0x1d')]);router[_0xaab4('0x1e')](_0xaab4('0x1c'),auth[_0xaab4('0x8')](),controller[_0xaab4('0x1f')]);router[_0xaab4('0x1e')](_0xaab4('0xd'),auth[_0xaab4('0x8')](),controller[_0xaab4('0x20')]);router[_0xaab4('0x1e')](_0xaab4('0xf'),auth[_0xaab4('0x8')](),controller[_0xaab4('0x21')]);router[_0xaab4('0x1e')](_0xaab4('0x11'),auth[_0xaab4('0x8')](),controller[_0xaab4('0x22')]);module[_0xaab4('0x23')]=router; \ No newline at end of file +var _0xa085=['send','put','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','/describe','isAuthenticated','describe','get','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','getApplications','post','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0xa085,0xbd));var _0x5a08=function(_0x11298e,_0x17f9f4){_0x11298e=_0x11298e-0x0;var _0x4c71bd=_0xa085[_0x11298e];return _0x4c71bd;};'use strict';var multer=require('multer');var util=require(_0x5a08('0x0'));var path=require(_0x5a08('0x1'));var timeout=require(_0x5a08('0x2'));var express=require(_0x5a08('0x3'));var router=express[_0x5a08('0x4')]();var fs_extra=require(_0x5a08('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5a08('0x6'));var config=require(_0x5a08('0x7'));var controller=require(_0x5a08('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5a08('0x9'),auth[_0x5a08('0xa')](),controller[_0x5a08('0xb')]);router[_0x5a08('0xc')](_0x5a08('0xd'),auth[_0x5a08('0xa')](),controller['show']);router[_0x5a08('0xc')](_0x5a08('0xe'),auth[_0x5a08('0xa')](),controller[_0x5a08('0xf')]);router[_0x5a08('0xc')](_0x5a08('0x10'),auth[_0x5a08('0xa')](),controller[_0x5a08('0x11')]);router[_0x5a08('0xc')]('/:id/users',auth[_0x5a08('0xa')](),controller[_0x5a08('0x12')]);router['get']('/:id/applications',auth[_0x5a08('0xa')](),controller[_0x5a08('0x13')]);router['post']('/',auth[_0x5a08('0xa')](),controller['create']);router[_0x5a08('0x14')](_0x5a08('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x5a08('0x10'),auth[_0x5a08('0xa')](),controller['addAnswer']);router[_0x5a08('0x14')]('/:id/users',auth[_0x5a08('0xa')](),controller[_0x5a08('0x15')]);router['post'](_0x5a08('0x16'),auth[_0x5a08('0xa')](),controller[_0x5a08('0x17')]);router[_0x5a08('0x14')](_0x5a08('0x18'),controller[_0x5a08('0x19')]);router[_0x5a08('0x14')](_0x5a08('0x1a'),auth[_0x5a08('0xa')](),controller[_0x5a08('0x1b')]);router[_0x5a08('0x1c')](_0x5a08('0xd'),auth[_0x5a08('0xa')](),controller[_0x5a08('0x1d')]);router[_0x5a08('0x1e')](_0x5a08('0xd'),auth[_0x5a08('0xa')](),controller[_0x5a08('0x1f')]);router[_0x5a08('0x1e')](_0x5a08('0xe'),auth[_0x5a08('0xa')](),controller[_0x5a08('0x20')]);router[_0x5a08('0x1e')](_0x5a08('0x10'),auth[_0x5a08('0xa')](),controller[_0x5a08('0x21')]);router[_0x5a08('0x1e')](_0x5a08('0x22'),auth[_0x5a08('0xa')](),controller['removeAgents']);module[_0x5a08('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 5667143..ff9e180 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 _0x864a=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio'];(function(_0x54c8ac,_0x330ed4){var _0x2a67b7=function(_0x55d91b){while(--_0x55d91b){_0x54c8ac['push'](_0x54c8ac['shift']());}};_0x2a67b7(++_0x330ed4);}(_0x864a,0x8a));var _0xa864=function(_0xcef7d5,_0x15f198){_0xcef7d5=_0xcef7d5-0x0;var _0x5b0f55=_0x864a[_0xcef7d5];return _0x5b0f55;};'use strict';var Sequelize=require(_0xa864('0x0'));var rs=require(_0xa864('0x1'));module[_0xa864('0x2')]={'name':{'type':Sequelize[_0xa864('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa864('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa864('0x4')](_0xa864('0x5'),_0xa864('0x6'))},'accountSid':{'type':Sequelize[_0xa864('0x3')]},'baseUrl':{'type':Sequelize[_0xa864('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xa864('0x7')],'defaultValue':function(){return _0xa864('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa864('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa864('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa864('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa864('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa864('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa864('0xa')],'comment':_0xa864('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xa864('0x9')],'defaultValue':![],'comment':_0xa864('0xc'),'set':function(_0x40cabc){if(!_0x40cabc){this[_0xa864('0xd')](_0xa864('0xe'),null);}this[_0xa864('0xd')](_0xa864('0xf'),_0x40cabc);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcfa1=['sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','generate','twilio'];(function(_0x44e866,_0x17ce18){var _0x50eb6a=function(_0x75b5ea){while(--_0x75b5ea){_0x44e866['push'](_0x44e866['shift']());}};_0x50eb6a(++_0x17ce18);}(_0xcfa1,0xbe));var _0x1cfa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcfa1[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x1cfa('0x0'));var rs=require('randomstring');module[_0x1cfa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x1cfa('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x1cfa('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1cfa('0x2')],'defaultValue':function(){return rs[_0x1cfa('0x3')]();}},'phone':{'type':Sequelize[_0x1cfa('0x2')]},'type':{'type':Sequelize['ENUM'](_0x1cfa('0x4'),_0x1cfa('0x5'))},'accountSid':{'type':Sequelize[_0x1cfa('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1cfa('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1cfa('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1cfa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1cfa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1cfa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x1cfa('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x1cfa('0x7')],'defaultValue':![],'comment':_0x1cfa('0xa'),'set':function(_0x6d5c70){if(!_0x6d5c70){this[_0x1cfa('0xb')]('mandatoryDispositionPauseId',null);}this[_0x1cfa('0xb')](_0x1cfa('0xc'),_0x6d5c70);}},'description':{'type':Sequelize[_0x1cfa('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 016115e..e8e4ff5 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 _0x6611=['orderBy','asc','Applications','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','From','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','list','defaults','WhatsappInteraction','interaction','created','push','unmanaged','ContactId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','unshift','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','CmList','List','DESC','out','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','WhatsappAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','priority','finally','getApplications','notify','whatsapp','account','sinch','state','WhatsappMessage','statuses','timestamp','message_id','applications'];(function(_0x14e51e,_0xed289b){var _0xf93e94=function(_0x4ed5bb){while(--_0x4ed5bb){_0x14e51e['push'](_0x14e51e['shift']());}};_0xf93e94(++_0xed289b);}(_0x6611,0x1bb));var _0x1661=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6611[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1661('0x0'));var zipdir=require(_0x1661('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1661('0x2'));var moment=require(_0x1661('0x3'));var BPromise=require(_0x1661('0x4'));var Mustache=require('mustache');var util=require(_0x1661('0x5'));var path=require(_0x1661('0x6'));var sox=require(_0x1661('0x7'));var csv=require('to-csv');var ejs=require(_0x1661('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1661('0x9'));var squel=require('squel');var crypto=require(_0x1661('0xa'));var jsforce=require(_0x1661('0xb'));var deskjs=require(_0x1661('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1661('0xd'));var Papa=require(_0x1661('0xe'));var Redis=require(_0x1661('0xf'));var authService=require(_0x1661('0x10'));var qs=require(_0x1661('0x11'));var as=require(_0x1661('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1661('0x13'))(_0x1661('0x14'));var utils=require(_0x1661('0x15'));var config=require(_0x1661('0x16'));var licenseUtil=require(_0x1661('0x17'));var db=require(_0x1661('0x18'))['db'];config[_0x1661('0x19')]=_['defaults'](config['redis'],{'host':_0x1661('0x1a'),'port':0x18eb});var socket=require(_0x1661('0x1b'))(new Redis(config[_0x1661('0x19')]));require('./whatsappAccount.socket')[_0x1661('0x1c')](socket);var jayson=require(_0x1661('0x1d'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x404624,_0x4a90fe,_0x4f0860,_0x5e0910){return new BPromise(function(_0x33c6f5,_0x420b14){var _0x4604b8=_0x5e0910||client;return _0x4604b8[_0x1661('0x1e')](_0x404624,_0x4f0860)[_0x1661('0x1f')](function(_0x2aeeb2){logger['info'](_0x1661('0x20'),_0x4a90fe,_0x1661('0x21'));logger[_0x1661('0x22')](_0x1661('0x23'),_0x4a90fe,_0x1661('0x21'),JSON[_0x1661('0x24')](_0x2aeeb2));if(_0x2aeeb2[_0x1661('0x25')]){if(_0x2aeeb2[_0x1661('0x25')][_0x1661('0x26')]===0x1f4){logger[_0x1661('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x4a90fe,_0x2aeeb2['error']['message']);return _0x420b14(_0x2aeeb2[_0x1661('0x25')][_0x1661('0x27')]);}logger['error'](_0x1661('0x20'),_0x4a90fe,_0x2aeeb2[_0x1661('0x25')][_0x1661('0x27')]);return _0x33c6f5(_0x2aeeb2[_0x1661('0x25')][_0x1661('0x27')]);}else{logger[_0x1661('0x28')](_0x1661('0x20'),_0x4a90fe,'request\x20sent');_0x33c6f5(_0x2aeeb2[_0x1661('0x29')][_0x1661('0x27')]);}})[_0x1661('0x2a')](function(_0x50d0fb){logger['error'](_0x1661('0x20'),_0x4a90fe,_0x50d0fb);_0x420b14(_0x50d0fb);});});}function respondWithStatusCode(_0x441f1a,_0xdf0e85){_0xdf0e85=_0xdf0e85||0xcc;return function(_0x58d8ba){if(_0x58d8ba){return _0x441f1a['sendStatus'](_0xdf0e85);}return _0x441f1a[_0x1661('0x2b')](_0xdf0e85)['end']();};}function respondWithResult(_0x1a19c0,_0x2ecc89){_0x2ecc89=_0x2ecc89||0xc8;return function(_0x220e68){if(_0x220e68){return _0x1a19c0[_0x1661('0x2b')](_0x2ecc89)[_0x1661('0x2c')](_0x220e68);}};}function respondWithFilteredResult(_0x37d6eb,_0xc4e13a){return function(_0x42255a){if(_0x42255a){var _0x19c860=typeof _0xc4e13a[_0x1661('0x2d')]===_0x1661('0x2e')&&typeof _0xc4e13a[_0x1661('0x2f')]===_0x1661('0x2e');var _0x592237=_0x42255a['count'];var _0x4140d2=_0x19c860?0x0:_0xc4e13a[_0x1661('0x2d')];var _0xc33b91=_0x19c860?_0x42255a[_0x1661('0x30')]:_0xc4e13a[_0x1661('0x2d')]+_0xc4e13a['limit'];var _0xe40ab6;if(_0xc33b91>=_0x592237){_0xc33b91=_0x592237;_0xe40ab6=0xc8;}else{_0xe40ab6=0xce;}_0x37d6eb['status'](_0xe40ab6);return _0x37d6eb[_0x1661('0x31')](_0x1661('0x32'),_0x4140d2+'-'+_0xc33b91+'/'+_0x592237)[_0x1661('0x2c')](_0x42255a);}return null;};}function patchUpdates(_0x2a2a7b){return function(_0x17d38e){try{jsonpatch['apply'](_0x17d38e,_0x2a2a7b,!![]);}catch(_0x415230){return BPromise['reject'](_0x415230);}return _0x17d38e['save']();};}function saveUpdates(_0x145dfe,_0x240164){return function(_0x5aa373){if(_0x5aa373){return _0x5aa373[_0x1661('0x33')](_0x145dfe)[_0x1661('0x1f')](function(_0x1ac3da){return _0x1ac3da;});}return null;};}function removeEntity(_0x545f9e,_0x1a8bf7){return function(_0x1c9d7c){if(_0x1c9d7c){return _0x1c9d7c[_0x1661('0x34')]()[_0x1661('0x1f')](function(){var _0x331081=_0x1c9d7c[_0x1661('0x35')]({'plain':!![]});var _0x3b08bd=_0x1661('0x36');return db[_0x1661('0x37')]['destroy']({'where':{'type':_0x3b08bd,'resourceId':_0x331081['id']}})['then'](function(){return _0x1c9d7c;});})['then'](function(){_0x545f9e[_0x1661('0x2b')](0xcc)[_0x1661('0x38')]();});}};}function handleEntityNotFound(_0x3a38bb,_0x158b1a){return function(_0x270fce){if(!_0x270fce){_0x3a38bb[_0x1661('0x39')](0x194);}return _0x270fce;};}function handleError(_0x36d47b,_0x34aca9){_0x34aca9=_0x34aca9||0x1f4;return function(_0xf4bd61){logger[_0x1661('0x25')](_0xf4bd61[_0x1661('0x3a')]);if(_0xf4bd61[_0x1661('0x3b')]){delete _0xf4bd61[_0x1661('0x3b')];}_0x36d47b[_0x1661('0x2b')](_0x34aca9)[_0x1661('0x3c')](_0xf4bd61);};}exports[_0x1661('0x3d')]=function(_0x52336d,_0x33bdf3){var _0xbb9f8b={'include':[{'model':db[_0x1661('0x3e')],'as':_0x1661('0x3f')}]},_0x1397ae={},_0x1db6ec={'count':0x0,'rows':[]};var _0x1e32c1=_[_0x1661('0x40')](db[_0x1661('0x41')]['rawAttributes'],function(_0x4b5f9b){return{'name':_0x4b5f9b[_0x1661('0x42')],'type':_0x4b5f9b[_0x1661('0x43')]['key']};});_0x1397ae[_0x1661('0x44')]=_[_0x1661('0x40')](_0x1e32c1,'name');_0x1397ae[_0x1661('0x45')]=_[_0x1661('0x46')](_0x52336d[_0x1661('0x45')]);_0x1397ae[_0x1661('0x47')]=_[_0x1661('0x48')](_0x1397ae[_0x1661('0x44')],_0x1397ae[_0x1661('0x45')]);_0xbb9f8b[_0x1661('0x49')]=_[_0x1661('0x48')](_0x1397ae[_0x1661('0x44')],qs[_0x1661('0x4a')](_0x52336d[_0x1661('0x45')]['fields']));_0xbb9f8b[_0x1661('0x49')]=_0xbb9f8b[_0x1661('0x49')][_0x1661('0x4b')]?_0xbb9f8b['attributes']:_0x1397ae['model'];if(!_0x52336d[_0x1661('0x45')]['hasOwnProperty']('nolimit')){_0xbb9f8b[_0x1661('0x2f')]=qs[_0x1661('0x2f')](_0x52336d['query'][_0x1661('0x2f')]);_0xbb9f8b[_0x1661('0x2d')]=qs[_0x1661('0x2d')](_0x52336d[_0x1661('0x45')][_0x1661('0x2d')]);}_0xbb9f8b[_0x1661('0x4c')]=qs[_0x1661('0x4d')](_0x52336d[_0x1661('0x45')]['sort']);_0xbb9f8b[_0x1661('0x4e')]=qs[_0x1661('0x47')](_[_0x1661('0x4f')](_0x52336d[_0x1661('0x45')],_0x1397ae[_0x1661('0x47')]),_0x1e32c1);if(_0x52336d[_0x1661('0x45')][_0x1661('0x50')]){_0xbb9f8b[_0x1661('0x4e')]=_[_0x1661('0x51')](_0xbb9f8b[_0x1661('0x4e')],{'$or':_['map'](_0x1e32c1,function(_0x42693e){if(_0x42693e['type']!==_0x1661('0x52')){var _0x4e44bc={};_0x4e44bc[_0x42693e[_0x1661('0x3b')]]={'$like':'%'+_0x52336d['query'][_0x1661('0x50')]+'%'};return _0x4e44bc;}})});}_0xbb9f8b=_[_0x1661('0x51')]({},_0xbb9f8b,_0x52336d[_0x1661('0x53')]);var _0x51ab26={'where':_0xbb9f8b[_0x1661('0x4e')]};return db[_0x1661('0x41')][_0x1661('0x30')](_0x51ab26)[_0x1661('0x1f')](function(_0x4084bb){_0x1db6ec[_0x1661('0x30')]=_0x4084bb;if(_0x52336d[_0x1661('0x45')]['includeAll']){_0xbb9f8b['include']=[{'all':!![]}];}return db[_0x1661('0x41')][_0x1661('0x54')](_0xbb9f8b);})[_0x1661('0x1f')](function(_0x122135){_0x1db6ec[_0x1661('0x55')]=_0x122135;return _0x1db6ec;})[_0x1661('0x1f')](respondWithFilteredResult(_0x33bdf3,_0xbb9f8b))[_0x1661('0x2a')](handleError(_0x33bdf3,null));};exports[_0x1661('0x56')]=function(_0x887cf7,_0x129ef8){var _0x796b56={'raw':![],'where':{'id':_0x887cf7[_0x1661('0x57')]['id']},'include':[{'model':db[_0x1661('0x3e')],'as':_0x1661('0x3f')}]},_0x455f92={};_0x455f92[_0x1661('0x44')]=_[_0x1661('0x46')](db[_0x1661('0x41')][_0x1661('0x58')]);_0x455f92[_0x1661('0x45')]=_[_0x1661('0x46')](_0x887cf7[_0x1661('0x45')]);_0x455f92['filters']=_[_0x1661('0x48')](_0x455f92['model'],_0x455f92[_0x1661('0x45')]);_0x796b56[_0x1661('0x49')]=_[_0x1661('0x48')](_0x455f92[_0x1661('0x44')],qs[_0x1661('0x4a')](_0x887cf7[_0x1661('0x45')][_0x1661('0x4a')]));_0x796b56['attributes']=_0x796b56[_0x1661('0x49')][_0x1661('0x4b')]?_0x796b56['attributes']:_0x455f92['model'];if(_0x887cf7[_0x1661('0x45')][_0x1661('0x59')]){_0x796b56[_0x1661('0x5a')]=[{'all':!![]}];}_0x796b56=_['merge']({},_0x796b56,_0x887cf7[_0x1661('0x53')]);return db['WhatsappAccount'][_0x1661('0x5b')](_0x796b56)['then'](handleEntityNotFound(_0x129ef8,null))['then'](respondWithResult(_0x129ef8,null))[_0x1661('0x2a')](handleError(_0x129ef8,null));};exports[_0x1661('0x5c')]=function(_0x367a61,_0x586b65){return db[_0x1661('0x41')][_0x1661('0x5c')](_0x367a61['body'],{})[_0x1661('0x1f')](function(_0x53fff8){var _0x92198=_0x367a61[_0x1661('0x5d')]['get']({'plain':!![]});if(!_0x92198)throw new Error(_0x1661('0x5e'));if(_0x92198[_0x1661('0x5f')]==='user'){var _0x4d1509=_0x53fff8[_0x1661('0x35')]({'plain':!![]});var _0x487e48=_0x1661('0x36');return db[_0x1661('0x60')]['find']({'where':{'name':_0x487e48,'userProfileId':_0x92198[_0x1661('0x61')]},'raw':!![]})[_0x1661('0x1f')](function(_0x3c22e7){if(_0x3c22e7&&_0x3c22e7[_0x1661('0x62')]===0x0){return db['UserProfileResource'][_0x1661('0x5c')]({'name':_0x4d1509[_0x1661('0x3b')],'resourceId':_0x4d1509['id'],'type':_0x3c22e7[_0x1661('0x3b')],'sectionId':_0x3c22e7['id']},{})['then'](function(){return _0x53fff8;});}else{return _0x53fff8;}})['catch'](function(_0x546e5f){logger[_0x1661('0x25')](_0x1661('0x63'),_0x546e5f);throw _0x546e5f;});}return _0x53fff8;})[_0x1661('0x1f')](respondWithResult(_0x586b65,0xc9))[_0x1661('0x2a')](handleError(_0x586b65,null));};exports['update']=function(_0x308b72,_0x23f71e){if(_0x308b72['body']['id']){delete _0x308b72[_0x1661('0x64')]['id'];}return db[_0x1661('0x41')][_0x1661('0x5b')]({'where':{'id':_0x308b72[_0x1661('0x57')]['id']},'include':[{'model':db[_0x1661('0x3e')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x23f71e,null))[_0x1661('0x1f')](saveUpdates(_0x308b72[_0x1661('0x64')],null))[_0x1661('0x1f')](respondWithResult(_0x23f71e,null))[_0x1661('0x2a')](handleError(_0x23f71e,null));};exports[_0x1661('0x34')]=function(_0x1ae083,_0x460c68){return db[_0x1661('0x41')][_0x1661('0x5b')]({'where':{'id':_0x1ae083[_0x1661('0x57')]['id']}})[_0x1661('0x1f')](handleEntityNotFound(_0x460c68,null))[_0x1661('0x1f')](removeEntity(_0x460c68,null))[_0x1661('0x2a')](handleError(_0x460c68,null));};exports[_0x1661('0x65')]=function(_0x3827ad,_0x4d2897){return db[_0x1661('0x41')]['describe']()[_0x1661('0x1f')](respondWithResult(_0x4d2897,null))[_0x1661('0x2a')](handleError(_0x4d2897,null));};exports[_0x1661('0x66')]=function(_0x5ab3a7,_0x6c1c5b,_0x4b6634){if(_0x5ab3a7[_0x1661('0x64')]['id']){delete _0x5ab3a7[_0x1661('0x64')]['id'];}return db[_0x1661('0x41')]['find']({'where':{'id':_0x5ab3a7[_0x1661('0x57')]['id']}})['then'](handleEntityNotFound(_0x6c1c5b,null))[_0x1661('0x1f')](function(_0x5d8d09){if(_0x5d8d09){_0x5ab3a7[_0x1661('0x64')][_0x1661('0x67')]=_0x5d8d09['id'];return db[_0x1661('0x68')][_0x1661('0x5c')](_0x5ab3a7[_0x1661('0x64')]);}})[_0x1661('0x1f')](respondWithResult(_0x6c1c5b,null))[_0x1661('0x2a')](handleError(_0x6c1c5b,null));};exports[_0x1661('0x69')]=function(_0x1642c4,_0x5f5a79,_0x3aa3e9){var _0x12ae7e={'raw':![],'where':{}};var _0x1c4d63={};var _0x31b587={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x1661('0x6a')]({'where':{'id':_0x1642c4[_0x1661('0x57')]['id']}})['then'](handleEntityNotFound(_0x5f5a79,null))[_0x1661('0x1f')](function(_0x549130){if(_0x549130){_0x1c4d63[_0x1661('0x44')]=_['keys'](db[_0x1661('0x68')]['rawAttributes']);_0x1c4d63[_0x1661('0x45')]=_[_0x1661('0x46')](_0x1642c4[_0x1661('0x45')]);_0x1c4d63[_0x1661('0x47')]=_['intersection'](_0x1c4d63['model'],_0x1c4d63['query']);_0x12ae7e[_0x1661('0x49')]=_['intersection'](_0x1c4d63[_0x1661('0x44')],qs[_0x1661('0x4a')](_0x1642c4[_0x1661('0x45')][_0x1661('0x4a')]));_0x12ae7e[_0x1661('0x49')]=_0x12ae7e[_0x1661('0x49')]['length']?_0x12ae7e[_0x1661('0x49')]:_0x1c4d63[_0x1661('0x44')];if(!_0x1642c4[_0x1661('0x45')][_0x1661('0x6b')](_0x1661('0x6c'))){_0x12ae7e['limit']=qs[_0x1661('0x2f')](_0x1642c4[_0x1661('0x45')][_0x1661('0x2f')]);_0x12ae7e[_0x1661('0x2d')]=qs[_0x1661('0x2d')](_0x1642c4[_0x1661('0x45')][_0x1661('0x2d')]);}_0x12ae7e['order']=qs[_0x1661('0x4d')](_0x1642c4[_0x1661('0x45')][_0x1661('0x4d')]);_0x12ae7e[_0x1661('0x4e')]=qs['filters'](_[_0x1661('0x4f')](_0x1642c4['query'],_0x1c4d63[_0x1661('0x47')]));_0x12ae7e[_0x1661('0x4e')][_0x1661('0x67')]=_0x549130['id'];if(_0x1642c4[_0x1661('0x45')][_0x1661('0x50')]){_0x12ae7e[_0x1661('0x4e')]=_[_0x1661('0x51')](_0x12ae7e[_0x1661('0x4e')],{'$or':_[_0x1661('0x40')](_0x12ae7e[_0x1661('0x49')],function(_0x5a44dd){var _0x2dbe7c={};_0x2dbe7c[_0x5a44dd]={'$like':'%'+_0x1642c4[_0x1661('0x45')][_0x1661('0x50')]+'%'};return _0x2dbe7c;})});}_0x12ae7e=_[_0x1661('0x51')]({},_0x12ae7e,_0x1642c4[_0x1661('0x53')]);return db[_0x1661('0x68')]['count']({'where':_0x12ae7e[_0x1661('0x4e')]})[_0x1661('0x1f')](function(_0x343de8){_0x31b587['count']=_0x343de8;if(_0x1642c4[_0x1661('0x45')][_0x1661('0x59')]){_0x12ae7e[_0x1661('0x5a')]=[{'all':!![]}];}return db[_0x1661('0x68')][_0x1661('0x54')](_0x12ae7e);})[_0x1661('0x1f')](function(_0x2fd00a){_0x31b587[_0x1661('0x55')]=_0x2fd00a;return _0x31b587;});}})[_0x1661('0x1f')](respondWithFilteredResult(_0x5f5a79,_0x12ae7e))[_0x1661('0x2a')](handleError(_0x5f5a79,null));};exports[_0x1661('0x6d')]=function(_0xaf40f4,_0x4953cf,_0x161535){return db[_0x1661('0x41')][_0x1661('0x5b')]({'where':{'id':_0xaf40f4[_0x1661('0x57')]['id']}})['then'](handleEntityNotFound(_0x4953cf,null))['then'](function(_0x4d0471){if(_0x4d0471){return _0x4d0471[_0x1661('0x6d')](_0xaf40f4['query']['ids']);}})[_0x1661('0x1f')](respondWithStatusCode(_0x4953cf,null))[_0x1661('0x2a')](handleError(_0x4953cf,null));};exports[_0x1661('0x6e')]=function(_0x3b5075,_0x18e55f,_0xf3706){if(_0x3b5075['body']['id']){delete _0x3b5075[_0x1661('0x64')]['id'];}return db[_0x1661('0x41')][_0x1661('0x5b')]({'where':{'id':_0x3b5075[_0x1661('0x57')]['id']}})[_0x1661('0x1f')](handleEntityNotFound(_0x18e55f,null))[_0x1661('0x1f')](function(_0x277c0b){if(_0x277c0b){_0x3b5075[_0x1661('0x64')][_0x1661('0x67')]=_0x277c0b['id'];return db[_0x1661('0x6f')][_0x1661('0x5c')](_0x3b5075[_0x1661('0x64')]);}})['then'](respondWithResult(_0x18e55f,null))[_0x1661('0x2a')](handleError(_0x18e55f,null));};exports['getAnswers']=function(_0x44881a,_0x1ce600,_0x5070aa){var _0x5a80a7={'raw':![],'where':{}};var _0x2d423f={};var _0x40d1cd={'count':0x0,'rows':[]};return db[_0x1661('0x41')]['findOne']({'where':{'id':_0x44881a[_0x1661('0x57')]['id']}})['then'](handleEntityNotFound(_0x1ce600,null))[_0x1661('0x1f')](function(_0x366d4d){if(_0x366d4d){_0x2d423f[_0x1661('0x44')]=_[_0x1661('0x46')](db[_0x1661('0x6f')][_0x1661('0x58')]);_0x2d423f[_0x1661('0x45')]=_['keys'](_0x44881a['query']);_0x2d423f[_0x1661('0x47')]=_[_0x1661('0x48')](_0x2d423f[_0x1661('0x44')],_0x2d423f['query']);_0x5a80a7['attributes']=_[_0x1661('0x48')](_0x2d423f['model'],qs[_0x1661('0x4a')](_0x44881a[_0x1661('0x45')][_0x1661('0x4a')]));_0x5a80a7[_0x1661('0x49')]=_0x5a80a7[_0x1661('0x49')][_0x1661('0x4b')]?_0x5a80a7[_0x1661('0x49')]:_0x2d423f[_0x1661('0x44')];if(!_0x44881a['query'][_0x1661('0x6b')](_0x1661('0x6c'))){_0x5a80a7[_0x1661('0x2f')]=qs[_0x1661('0x2f')](_0x44881a[_0x1661('0x45')][_0x1661('0x2f')]);_0x5a80a7['offset']=qs['offset'](_0x44881a[_0x1661('0x45')][_0x1661('0x2d')]);}_0x5a80a7[_0x1661('0x4c')]=qs[_0x1661('0x4d')](_0x44881a[_0x1661('0x45')]['sort']);_0x5a80a7[_0x1661('0x4e')]=qs['filters'](_['pick'](_0x44881a['query'],_0x2d423f[_0x1661('0x47')]));_0x5a80a7[_0x1661('0x4e')][_0x1661('0x67')]=_0x366d4d['id'];if(_0x44881a[_0x1661('0x45')]['filter']){_0x5a80a7[_0x1661('0x4e')]=_[_0x1661('0x51')](_0x5a80a7[_0x1661('0x4e')],{'$or':_[_0x1661('0x40')](_0x5a80a7[_0x1661('0x49')],function(_0x2194e1){var _0x49938c={};_0x49938c[_0x2194e1]={'$like':'%'+_0x44881a[_0x1661('0x45')][_0x1661('0x50')]+'%'};return _0x49938c;})});}_0x5a80a7=_['merge']({},_0x5a80a7,_0x44881a[_0x1661('0x53')]);return db['CannedAnswer']['count']({'where':_0x5a80a7['where']})['then'](function(_0x30d9da){_0x40d1cd[_0x1661('0x30')]=_0x30d9da;if(_0x44881a[_0x1661('0x45')][_0x1661('0x59')]){_0x5a80a7[_0x1661('0x5a')]=[{'all':!![]}];}return db[_0x1661('0x6f')][_0x1661('0x54')](_0x5a80a7);})[_0x1661('0x1f')](function(_0x412525){_0x40d1cd['rows']=_0x412525;return _0x40d1cd;});}})[_0x1661('0x1f')](respondWithFilteredResult(_0x1ce600,_0x5a80a7))[_0x1661('0x2a')](handleError(_0x1ce600,null));};exports[_0x1661('0x70')]=function(_0x3daae3,_0x133cc4,_0x2c629e){return db[_0x1661('0x41')][_0x1661('0x5b')]({'where':{'id':_0x3daae3[_0x1661('0x57')]['id']}})[_0x1661('0x1f')](handleEntityNotFound(_0x133cc4,null))[_0x1661('0x1f')](function(_0x6c532){if(_0x6c532){return _0x6c532[_0x1661('0x70')](_0x3daae3['query'][_0x1661('0x71')]);}})[_0x1661('0x1f')](respondWithStatusCode(_0x133cc4,null))[_0x1661('0x2a')](handleError(_0x133cc4,null));};exports['addAgents']=function(_0x1b43bf,_0x5ba4ce,_0x7dac9a){return db['WhatsappAccount'][_0x1661('0x5b')]({'where':{'id':_0x1b43bf[_0x1661('0x57')]['id']}})[_0x1661('0x1f')](handleEntityNotFound(_0x5ba4ce,null))[_0x1661('0x1f')](function(_0x3c9690){if(_0x3c9690){return _0x3c9690[_0x1661('0x72')](_0x1b43bf[_0x1661('0x64')]['ids'],_[_0x1661('0x73')](_0x1b43bf['body'],['ids','id'])||{})[_0x1661('0x74')](function(_0x4c63f4){for(var _0x117f97=0x0;_0x117f97<_0x1b43bf[_0x1661('0x64')]['ids'][_0x1661('0x4b')];_0x117f97+=0x1){socket[_0x1661('0x75')]('userWhatsappAccount:save',{'UserId':Number(_0x1b43bf[_0x1661('0x64')][_0x1661('0x71')][_0x117f97]),'WhatsappAccountId':Number(_0x1b43bf[_0x1661('0x57')]['id'])});}return _0x4c63f4;});}})['then'](respondWithResult(_0x5ba4ce,null))[_0x1661('0x2a')](handleError(_0x5ba4ce,null));};exports[_0x1661('0x76')]=function(_0x5ec309,_0x3624aa,_0x26ccea){return db[_0x1661('0x41')]['find']({'where':{'id':_0x5ec309[_0x1661('0x57')]['id']}})[_0x1661('0x1f')](handleEntityNotFound(_0x3624aa,null))[_0x1661('0x1f')](function(_0x43eaac){if(_0x43eaac){return _0x43eaac[_0x1661('0x76')](_0x5ec309['query'][_0x1661('0x71')])[_0x1661('0x1f')](function(){if(_[_0x1661('0x77')](_0x5ec309['query'][_0x1661('0x71')])){for(var _0x2fe100=0x0;_0x2fe100<_0x5ec309[_0x1661('0x45')]['ids'][_0x1661('0x4b')];_0x2fe100+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x5ec309[_0x1661('0x45')][_0x1661('0x71')][_0x2fe100]),'WhatsappAccountId':Number(_0x5ec309[_0x1661('0x57')]['id'])});}}else{socket[_0x1661('0x75')](_0x1661('0x78'),{'UserId':Number(_0x5ec309[_0x1661('0x45')][_0x1661('0x71')]),'WhatsappAccountId':Number(_0x5ec309['params']['id'])});}});}})[_0x1661('0x1f')](respondWithStatusCode(_0x3624aa,null))[_0x1661('0x2a')](handleError(_0x3624aa,null));};exports[_0x1661('0x79')]=function(_0x19a365,_0x35739c,_0x407f25){var _0x41702b={};var _0x2da2c6={};var _0x32385e;var _0xeee97f;return db[_0x1661('0x41')]['findOne']({'where':{'id':_0x19a365[_0x1661('0x57')]['id']}})['then'](handleEntityNotFound(_0x35739c,null))['then'](function(_0x87449c){if(_0x87449c){_0x32385e=_0x87449c;_0x2da2c6[_0x1661('0x44')]=_[_0x1661('0x46')](db[_0x1661('0x7a')][_0x1661('0x58')]);_0x2da2c6['query']=_[_0x1661('0x46')](_0x19a365[_0x1661('0x45')]);_0x2da2c6[_0x1661('0x47')]=_[_0x1661('0x48')](_0x2da2c6['model'],_0x2da2c6[_0x1661('0x45')]);_0x41702b[_0x1661('0x49')]=_[_0x1661('0x48')](_0x2da2c6[_0x1661('0x44')],qs['fields'](_0x19a365[_0x1661('0x45')][_0x1661('0x4a')]));_0x41702b[_0x1661('0x49')]=_0x41702b[_0x1661('0x49')]['length']?_0x41702b['attributes']:_0x2da2c6[_0x1661('0x44')];_0x41702b[_0x1661('0x4c')]=qs[_0x1661('0x4d')](_0x19a365[_0x1661('0x45')]['sort']);_0x41702b[_0x1661('0x4e')]=qs[_0x1661('0x47')](_['pick'](_0x19a365[_0x1661('0x45')],_0x2da2c6[_0x1661('0x47')]));if(_0x19a365['query'][_0x1661('0x50')]){_0x41702b[_0x1661('0x4e')]=_[_0x1661('0x51')](_0x41702b['where'],{'$or':_[_0x1661('0x40')](_0x41702b[_0x1661('0x49')],function(_0x5c9ec2){var _0x46e0a9={};_0x46e0a9[_0x5c9ec2]={'$like':'%'+_0x19a365['query']['filter']+'%'};return _0x46e0a9;})});}_0x41702b=_[_0x1661('0x51')]({},_0x41702b,_0x19a365['options']);return _0x32385e[_0x1661('0x79')](_0x41702b);}})[_0x1661('0x1f')](function(_0x2a165e){if(_0x2a165e){_0xeee97f=_0x2a165e['length'];if(!_0x19a365['query'][_0x1661('0x6b')]('nolimit')){_0x41702b['limit']=qs['limit'](_0x19a365[_0x1661('0x45')]['limit']);_0x41702b[_0x1661('0x2d')]=qs[_0x1661('0x2d')](_0x19a365[_0x1661('0x45')][_0x1661('0x2d')]);}return _0x32385e[_0x1661('0x79')](_0x41702b);}})[_0x1661('0x1f')](function(_0x1d0abd){if(_0x1d0abd){return _0x1d0abd?{'count':_0xeee97f,'rows':_0x1d0abd}:null;}})[_0x1661('0x1f')](respondWithResult(_0x35739c,null))['catch'](handleError(_0x35739c,null));};exports[_0x1661('0x7b')]=function(_0x1c6502,_0x58049d){var _0x208286=_0x1c6502[_0x1661('0x57')]['id'];var _0x5aeeb4=_0x1c6502[_0x1661('0x64')];var _0x4e0eda=0xc8;var _0x1fe0c8=null;return db[_0x1661('0x7c')][_0x1661('0x7d')]({'isolationLevel':db[_0x1661('0x7c')][_0x1661('0x7e')][_0x1661('0x7f')]['READ_COMMITTED']},function(_0x57358e){return db[_0x1661('0x41')][_0x1661('0x6a')]({'where':{'id':_0x208286},'transaction':_0x57358e})[_0x1661('0x1f')](function(_0x453b98){if(_0x453b98){return db[_0x1661('0x80')][_0x1661('0x34')]({'where':{'WhatsappAccountId':_0x208286},'transaction':_0x57358e})[_0x1661('0x1f')](function(){var _0x3688a6=_[_0x1661('0x40')](_0x5aeeb4,function(_0x2516d3){_0x2516d3[_0x1661('0x67')]=_0x208286;return _0x2516d3;});return db[_0x1661('0x80')]['bulkCreate'](_0x3688a6,{'transaction':_0x57358e});});}else{_0x4e0eda=0x194;_0x1fe0c8=[];}});})[_0x1661('0x1f')](function(){if(_0x4e0eda!==0x194){return db[_0x1661('0x80')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x208286},'order':_0x1661('0x81')})[_0x1661('0x1f')](function(_0x547fdf){_0x1fe0c8=_0x547fdf;});}})['catch'](function(_0x3d3915){_0x4e0eda=0x1f4;logger['error'](_0x3d3915[_0x1661('0x3a')]);if(_0x3d3915['name']){delete _0x3d3915['name'];}_0x1fe0c8=_0x3d3915;})[_0x1661('0x82')](function(){if(_0x1fe0c8===null){_0x58049d[_0x1661('0x39')](_0x4e0eda);}else{if(_0x4e0eda===0x1f4){_0x58049d[_0x1661('0x2b')](_0x4e0eda)[_0x1661('0x3c')](_0x1fe0c8);}else{_0x58049d[_0x1661('0x2b')](_0x4e0eda)['json'](_0x1fe0c8);}}});};exports[_0x1661('0x83')]=function(_0xe4ea5,_0x10284a,_0x1aba5e){var _0x5010c8={};var _0x421160={};var _0x1c4048;var _0xb224ff;return db['WhatsappAccount']['findOne']({'where':{'id':_0xe4ea5[_0x1661('0x57')]['id']}})[_0x1661('0x1f')](handleEntityNotFound(_0x10284a,null))[_0x1661('0x1f')](function(_0x2d7541){if(_0x2d7541){_0x1c4048=_0x2d7541;_0x421160[_0x1661('0x44')]=_[_0x1661('0x46')](db['WhatsappApplication'][_0x1661('0x58')]);_0x421160[_0x1661('0x45')]=_[_0x1661('0x46')](_0xe4ea5['query']);_0x421160[_0x1661('0x47')]=_[_0x1661('0x48')](_0x421160['model'],_0x421160[_0x1661('0x45')]);_0x5010c8[_0x1661('0x49')]=_[_0x1661('0x48')](_0x421160['model'],qs['fields'](_0xe4ea5[_0x1661('0x45')][_0x1661('0x4a')]));_0x5010c8[_0x1661('0x49')]=_0x5010c8[_0x1661('0x49')][_0x1661('0x4b')]?_0x5010c8[_0x1661('0x49')]:_0x421160['model'];_0x5010c8[_0x1661('0x4c')]=qs['sort'](_0xe4ea5[_0x1661('0x45')][_0x1661('0x4d')]);_0x5010c8[_0x1661('0x4e')]=qs[_0x1661('0x47')](_[_0x1661('0x4f')](_0xe4ea5['query'],_0x421160[_0x1661('0x47')]));if(_0xe4ea5[_0x1661('0x45')][_0x1661('0x50')]){_0x5010c8['where']=_['merge'](_0x5010c8[_0x1661('0x4e')],{'$or':_['map'](_0x5010c8[_0x1661('0x49')],function(_0x4a51b4){var _0x434345={};_0x434345[_0x4a51b4]={'$like':'%'+_0xe4ea5[_0x1661('0x45')][_0x1661('0x50')]+'%'};return _0x434345;})});}_0x5010c8=_[_0x1661('0x51')]({},_0x5010c8,_0xe4ea5['options']);return _0x1c4048[_0x1661('0x83')](_0x5010c8);}})[_0x1661('0x1f')](function(_0xbeb8f7){if(_0xbeb8f7){_0xb224ff=_0xbeb8f7[_0x1661('0x4b')];if(!_0xe4ea5[_0x1661('0x45')][_0x1661('0x6b')]('nolimit')){_0x5010c8[_0x1661('0x2f')]=qs[_0x1661('0x2f')](_0xe4ea5[_0x1661('0x45')][_0x1661('0x2f')]);_0x5010c8[_0x1661('0x2d')]=qs['offset'](_0xe4ea5['query'][_0x1661('0x2d')]);}return _0x1c4048[_0x1661('0x83')](_0x5010c8);}})[_0x1661('0x1f')](function(_0x47d5c6){if(_0x47d5c6){return _0x47d5c6?{'count':_0xb224ff,'rows':_0x47d5c6}:null;}})[_0x1661('0x1f')](respondWithResult(_0x10284a,null))[_0x1661('0x2a')](handleError(_0x10284a,null));};exports[_0x1661('0x84')]=function(_0x7aa505,_0x37c591,_0x67098c){var _0x452c46={'channel':_0x1661('0x85')};var _0x8bf85f=[];var _0x2ec6ba=[];var _0xfde501={};return db['WhatsappAccount']['find']({'where':{'id':_0x7aa505[_0x1661('0x57')]['id']},'include':[{'model':db[_0x1661('0x80')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x37c591,null))[_0x1661('0x1f')](function(_0x996890){_0x452c46['account']=_0x996890;if(_0x452c46[_0x1661('0x86')]&&_0x452c46[_0x1661('0x86')][_0x1661('0x43')]===_0x1661('0x87')&&_0x7aa505[_0x1661('0x64')]['statuses']){if(_0x7aa505[_0x1661('0x64')]['statuses'][_0x1661('0x4b')]===0x0)return;if(_0x7aa505[_0x1661('0x64')]['statuses'][0x0][_0x1661('0x88')]!=='read')return;return db[_0x1661('0x89')]['update']({'read':!![],'readAt':_0x7aa505[_0x1661('0x64')][_0x1661('0x8a')][0x0][_0x1661('0x8b')]},{'where':{'messageId':_0x7aa505['body'][_0x1661('0x8a')][0x0][_0x1661('0x8c')]},'individualHooks':!![]})[_0x1661('0x1f')](function(_0x34c2d1){return _0x37c591[_0x1661('0x2b')](0xc8)[_0x1661('0x2c')](_0x34c2d1);});}_0x452c46[_0x1661('0x8d')]=_[_0x1661('0x8e')](_0x996890['Applications'],['priority'],[_0x1661('0x8f')]);if(_0x452c46[_0x1661('0x86')][_0x1661('0x90')]){delete _0x452c46['account'][_0x1661('0x90')];}return db['CmContact']['describe']()['then'](function(_0x299a2d){if(!_0x299a2d){throw new db['Sequelize'][(_0x1661('0x91'))](_0x1661('0x92'));}_0x8bf85f=_[_0x1661('0x93')](_['keys'](_0x299a2d),[_0x1661('0x94'),'updatedAt']);_0x2ec6ba=_[_0x1661('0x93')](_[_0x1661('0x46')](_0x299a2d),[_0x1661('0x94'),_0x1661('0x95'),'CompanyId',_0x1661('0x96')]);_0x452c46[_0x1661('0x64')]={'mapKey':_0x1661('0x97')};if(_0x452c46[_0x1661('0x86')]&&_0x452c46[_0x1661('0x86')][_0x1661('0x43')]==='twilio'){_0x452c46[_0x1661('0x64')][_0x1661('0x98')]=_0x7aa505[_0x1661('0x64')][_0x1661('0x99')]['replace']('whatsapp:','');_0x452c46[_0x1661('0x64')][_0x1661('0x64')]=_0x7aa505[_0x1661('0x64')][_0x1661('0x9a')];_0x452c46[_0x1661('0x64')][_0x1661('0x9b')]=_0x7aa505[_0x1661('0x64')][_0x1661('0x9c')];}if(_0x452c46[_0x1661('0x86')]&&_0x452c46[_0x1661('0x86')][_0x1661('0x43')]==='sinch'){_0x452c46[_0x1661('0x64')][_0x1661('0x98')]=_0x7aa505[_0x1661('0x64')][_0x1661('0x9d')][0x0][_0x1661('0x98')];_0x452c46[_0x1661('0x64')][_0x1661('0x64')]=_0x7aa505[_0x1661('0x64')]['notifications'][0x0][_0x1661('0x27')]['body'];_0x452c46[_0x1661('0x64')][_0x1661('0x9b')]=_0x7aa505[_0x1661('0x64')]['notifications'][0x0][_0x1661('0x8c')];}if(_0x452c46[_0x1661('0x64')]['id']){delete _0x452c46[_0x1661('0x64')]['id'];}if(_[_0x1661('0x9e')](_0x452c46[_0x1661('0x64')][_0x1661('0x98')])){throw new db['Sequelize']['ValidationError'](_0x1661('0x9f'));}if(_['isNil'](_0x452c46[_0x1661('0x64')]['body'])||_0x452c46[_0x1661('0x64')][_0x1661('0x64')]===''){throw new db['Sequelize'][(_0x1661('0x91'))](_0x1661('0xa0'));}if(_[_0x1661('0x9e')](_0x452c46[_0x1661('0x64')][_0x1661('0xa1')])){throw new db[(_0x1661('0xa2'))][(_0x1661('0x91'))](_0x1661('0xa3')+_0x2ec6ba);}if(!_['includes'](_0x2ec6ba,_0x452c46[_0x1661('0x64')][_0x1661('0xa1')])){throw new db['Sequelize'][(_0x1661('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ec6ba);}_0xfde501[_0x452c46[_0x1661('0x64')]['mapKey']]=_0x452c46[_0x1661('0x64')][_0x1661('0x98')];return db['CmList']['find']({'where':{'id':_0x452c46[_0x1661('0x86')][_0x1661('0x96')]},'include':[{'model':db[_0x1661('0xa4')],'as':_0x1661('0xa5'),'where':_0xfde501,'limit':0x1,'order':[[_0x1661('0x95'),'DESC']]}]});})[_0x1661('0x1f')](handleEntityNotFound(_0x37c591,null))['then'](function(_0x2cb0ba){if(_0x2cb0ba){_0x452c46[_0x1661('0xa6')]=_['omit'](_0x2cb0ba,[_0x1661('0xa5')]);if(_0x2cb0ba['Contacts'][_0x1661('0x4b')]){return _0x2cb0ba[_0x1661('0xa5')][0x0];}var _0x23d20b=_[_0x1661('0xa7')](_0x452c46['body'],{'firstName':_0x452c46['body'][_0x1661('0x98')],'ListId':_0x2cb0ba['id']});_0x23d20b[_0x452c46[_0x1661('0x64')][_0x1661('0xa1')]]=_0x452c46[_0x1661('0x64')][_0x1661('0x98')];return db[_0x1661('0xa4')][_0x1661('0x5c')](_0x23d20b,{'fields':_0x8bf85f,'raw':!![]});}})[_0x1661('0x1f')](handleEntityNotFound(_0x37c591,null))[_0x1661('0x1f')](function(_0x212e50){if(_0x212e50){_0x452c46['contact']=_0x212e50;var _0x5d9c85={'ContactId':_0x212e50['id'],'phone':_0x452c46[_0x1661('0x64')][_0x1661('0x98')],'WhatsappAccountId':_0x7aa505[_0x1661('0x57')]['id']};var _0x1ed814={'ContactId':_0x212e50['id'],'WhatsappAccountId':_0x7aa505[_0x1661('0x57')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x1661('0x5b')]({'where':_0x1ed814})[_0x1661('0x1f')](function(_0x6e09e8){if(_0x6e09e8){return[_0x6e09e8,![]];}return db[_0x1661('0xa8')][_0x1661('0x5c')](_0x5d9c85)[_0x1661('0x1f')](function(_0x5aa9bd){return[_0x5aa9bd,!![]];});});}})[_0x1661('0x74')](function(_0x5d04d8,_0x164426){_0x452c46[_0x1661('0xa9')]=_0x5d04d8[_0x1661('0x35')]({'plain':!![]});_0x452c46[_0x1661('0xa9')][_0x1661('0xaa')]=![];if(_0x164426){if(_0x452c46[_0x1661('0x86')]['autoclose']){_0x452c46['applications'][_0x1661('0xab')]({'id':0x0,'priority':_0x452c46[_0x1661('0x8d')]['length']+0x1,'app':'close','appdata':_0x1661('0xac'),'interval':'*,*,*,*'});}_0x452c46[_0x1661('0xa9')][_0x1661('0xaa')]=!![];}return db[_0x1661('0x89')]['create']({'phone':_0x452c46[_0x1661('0x64')][_0x1661('0x98')],'messageId':_0x452c46['body'][_0x1661('0x9b')],'body':_0x452c46[_0x1661('0x64')][_0x1661('0x64')],'WhatsappAccountId':_0x7aa505[_0x1661('0x57')]['id'],'WhatsappInteractionId':_0x5d04d8['id'],'direction':'in','ContactId':_0x5d04d8[_0x1661('0xad')],'AttachmentId':_0x452c46[_0x1661('0x64')]['AttachmentId']});})['then'](function(_0xf43cef){_0x452c46[_0x1661('0x27')]=_0xf43cef;if(!_0x452c46[_0x1661('0xa9')]['UserId'])return;return db[_0x1661('0x7a')][_0x1661('0x5b')]({'attributes':['id',_0x1661('0x3b')],'where':{'id':_0x452c46['interaction'][_0x1661('0xae')]}});})[_0x1661('0x1f')](function(_0x3f67b5){if(_0x3f67b5){_0x452c46[_0x1661('0x8d')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1661('0xaf'),'appdata':_0x3f67b5[_0x1661('0x3b')]+','+(_0x452c46[_0x1661('0x86')][_0x1661('0xb0')]||0xa),'interval':_0x1661('0xb1')});}if(!_0x452c46[_0x1661('0xa9')][_0x1661('0xb2')])return;return db[_0x1661('0xb3')]['find']({'attributes':['id','name'],'where':{'id':_0x452c46['interaction'][_0x1661('0xb2')]}});})[_0x1661('0x1f')](function(_0x264cf4){if(_0x264cf4){_0x452c46[_0x1661('0x8d')][_0x1661('0xb4')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x264cf4[_0x1661('0x3b')]+','+(_0x452c46[_0x1661('0x86')][_0x1661('0xb5')]||0x12c),'interval':_0x1661('0xb1')});}return respondWithRpcPromise(_0x1661('0xb6'),_0x1661('0xb7'),_0x452c46);})['then'](function(_0x2040f9){if(_0x2040f9){var _0x73199f=0xc8;var _0x410942=_0x1661('0xb8');logger[_0x1661('0x28')](_0x1661('0x23'),_0x410942,_0x73199f,_0x1661('0xb9'));logger[_0x1661('0x22')](_0x1661('0xba'),_0x410942,_0x73199f,_0x1661('0xb9'),JSON['stringify'](_0x2040f9));if(_0x452c46[_0x1661('0x86')][_0x1661('0x43')]==='twilio'){return _0x37c591['status'](_0x73199f)[_0x1661('0x31')](_0x1661('0xbb'),_0x1661('0xbc'))[_0x1661('0x3c')]('\x0a');}else{return _0x37c591[_0x1661('0x2b')](_0x73199f)[_0x1661('0x2c')](_0x2040f9);}}});})['catch'](handleError(_0x37c591,null));};exports[_0x1661('0x3c')]=function(_0x1cef5c,_0x3b16a9,_0x5d8dbc){var _0x4dc175,_0x159859,_0x337fcc;if(_[_0x1661('0x9e')](_0x1cef5c['body'][_0x1661('0x64')])||_0x1cef5c['body'][_0x1661('0x64')]===''){throw new db[(_0x1661('0xa2'))][(_0x1661('0x91'))](_0x1661('0xa0'));}if(_[_0x1661('0x9e')](_0x1cef5c[_0x1661('0x64')]['to'])){throw new db['Sequelize'][(_0x1661('0x91'))]('to\x20is\x20mandatory');}_0x4dc175=_0x1cef5c['body']['to'];return db[_0x1661('0x41')]['find']({'where':{'id':_0x1cef5c[_0x1661('0x57')]['id']},'include':[{'model':db[_0x1661('0xbd')],'as':_0x1661('0xbe'),'include':[{'model':db[_0x1661('0xa4')],'as':'Contacts','where':{'mobile':_0x4dc175},'limit':0x1,'order':[['updatedAt',_0x1661('0xbf')]]}]}]})['then'](handleEntityNotFound(_0x3b16a9,null))[_0x1661('0x1f')](function(_0x5cccaa){if(_0x5cccaa&&_0x5cccaa[_0x1661('0xbe')]){_0x159859=_0x5cccaa[_0x1661('0x35')]({'plain':!![]});if(_0x159859['List']&&_0x159859[_0x1661('0xbe')]['Contacts'][_0x1661('0x4b')]){return _0x159859[_0x1661('0xbe')][_0x1661('0xa5')][0x0];}return db[_0x1661('0xa4')][_0x1661('0x5c')](_[_0x1661('0xa7')](_0x1cef5c[_0x1661('0x64')],{'firstName':_0x4dc175,'mobile':_0x4dc175,'phone':_0x4dc175,'ListId':_0x159859[_0x1661('0x96')]}));}})[_0x1661('0x1f')](handleEntityNotFound(_0x3b16a9,null))[_0x1661('0x1f')](function(_0x7ce9a4){if(_0x7ce9a4){_0x337fcc=_0x7ce9a4;return db[_0x1661('0xa8')][_0x1661('0x5b')]({'where':{'ContactId':_0x337fcc['id'],'closed':![],'WhatsappAccountId':_0x159859['id']}})[_0x1661('0x1f')](function(_0x41063f){if(_0x41063f){return[_0x41063f,![]];}return db[_0x1661('0xa8')]['create']({'UserId':_0x1cef5c[_0x1661('0x5d')]['id'],'ContactId':_0x337fcc['id'],'WhatsappAccountId':_0x159859['id'],'phone':_0x4dc175,'firstMsgDirection':_0x1661('0xc0'),'Messages':[_[_0x1661('0x51')](_0x1cef5c[_0x1661('0x64')],{'read':![],'body':_0x1cef5c[_0x1661('0x64')][_0x1661('0x64')],'phone':_0x4dc175,'WhatsappAccountId':_0x159859['id'],'UserId':_0x1cef5c[_0x1661('0x5d')]['id'],'ContactId':_0x337fcc['id']})]},{'include':[{'model':db[_0x1661('0x89')],'as':_0x1661('0xc1')}]})[_0x1661('0x1f')](function(_0x5ae57b){return[_0x5ae57b,!![]];});});}})[_0x1661('0x74')](function(_0x3a8d20,_0x233211){if(_0x233211){return _0x3a8d20;}return db[_0x1661('0x89')]['create'](_[_0x1661('0x51')](_0x1cef5c['body'],{'read':![],'body':_0x1cef5c[_0x1661('0x64')][_0x1661('0x64')],'phone':_0x4dc175,'WhatsappAccountId':_0x159859['id'],'WhatsappInteractionId':_0x3a8d20['id'],'UserId':_0x1cef5c[_0x1661('0x5d')]['id'],'ContactId':_0x337fcc['id']}))[_0x1661('0x1f')](function(_0x2a7517){_0x3a8d20[_0x1661('0xc2')][_0x1661('0xc1')]=[];_0x3a8d20[_0x1661('0xc2')]['Messages'][_0x1661('0xab')](_0x2a7517[_0x1661('0xc2')]);return _0x3a8d20;});})[_0x1661('0x1f')](respondWithResult(_0x3b16a9,null))[_0x1661('0x2a')](handleError(_0x3b16a9,null));}; \ No newline at end of file +var _0x53eb=['removeAgents','isArray','getAgents','findOne','User','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','timestamp','applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','from','notifications','message_id','Sequelize','from\x20is\x20mandatory','isNil','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','AttachmentId','UserId','agent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','dataValues','Messages','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','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','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','getDispositions','Disposition','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','omit','spread','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53eb,0x115));var _0xb53e=function(_0x156d41,_0x3559cb){_0x156d41=_0x156d41-0x0;var _0x32aa99=_0x53eb[_0x156d41];return _0x32aa99;};'use strict';var emlformat=require(_0xb53e('0x0'));var rimraf=require(_0xb53e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb53e('0x2'));var moment=require('moment');var BPromise=require(_0xb53e('0x3'));var Mustache=require(_0xb53e('0x4'));var util=require('util');var path=require(_0xb53e('0x5'));var sox=require(_0xb53e('0x6'));var csv=require(_0xb53e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb53e('0x8'));var _=require(_0xb53e('0x9'));var squel=require(_0xb53e('0xa'));var crypto=require(_0xb53e('0xb'));var jsforce=require(_0xb53e('0xc'));var deskjs=require(_0xb53e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb53e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb53e('0xf'));var qs=require(_0xb53e('0x10'));var as=require(_0xb53e('0x11'));var hardwareService=require(_0xb53e('0x12'));var logger=require(_0xb53e('0x13'))(_0xb53e('0x14'));var utils=require(_0xb53e('0x15'));var config=require(_0xb53e('0x16'));var licenseUtil=require(_0xb53e('0x17'));var db=require(_0xb53e('0x18'))['db'];config[_0xb53e('0x19')]=_['defaults'](config[_0xb53e('0x19')],{'host':_0xb53e('0x1a'),'port':0x18eb});var socket=require(_0xb53e('0x1b'))(new Redis(config['redis']));require(_0xb53e('0x1c'))['register'](socket);var jayson=require(_0xb53e('0x1d'));var client=jayson[_0xb53e('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x31eba8,_0x1c801b,_0x1c83d9,_0x166e9e){return new BPromise(function(_0x61548a,_0x119a45){var _0x34441d=_0x166e9e||client;return _0x34441d[_0xb53e('0x1f')](_0x31eba8,_0x1c83d9)[_0xb53e('0x20')](function(_0x208970){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1c801b,_0xb53e('0x21'));logger[_0xb53e('0x22')](_0xb53e('0x23'),_0x1c801b,_0xb53e('0x21'),JSON[_0xb53e('0x24')](_0x208970));if(_0x208970[_0xb53e('0x25')]){if(_0x208970['error']['code']===0x1f4){logger[_0xb53e('0x25')](_0xb53e('0x26'),_0x1c801b,_0x208970[_0xb53e('0x25')][_0xb53e('0x27')]);return _0x119a45(_0x208970[_0xb53e('0x25')][_0xb53e('0x27')]);}logger[_0xb53e('0x25')](_0xb53e('0x26'),_0x1c801b,_0x208970[_0xb53e('0x25')][_0xb53e('0x27')]);return _0x61548a(_0x208970[_0xb53e('0x25')][_0xb53e('0x27')]);}else{logger[_0xb53e('0x28')](_0xb53e('0x26'),_0x1c801b,_0xb53e('0x21'));_0x61548a(_0x208970[_0xb53e('0x29')]['message']);}})[_0xb53e('0x2a')](function(_0x4b5be4){logger['error'](_0xb53e('0x26'),_0x1c801b,_0x4b5be4);_0x119a45(_0x4b5be4);});});}function respondWithStatusCode(_0x3cd730,_0x5d0f70){_0x5d0f70=_0x5d0f70||0xcc;return function(_0x25ed47){if(_0x25ed47){return _0x3cd730[_0xb53e('0x2b')](_0x5d0f70);}return _0x3cd730[_0xb53e('0x2c')](_0x5d0f70)[_0xb53e('0x2d')]();};}function respondWithResult(_0x5c7251,_0xb1f42a){_0xb1f42a=_0xb1f42a||0xc8;return function(_0xfd1c28){if(_0xfd1c28){return _0x5c7251['status'](_0xb1f42a)[_0xb53e('0x2e')](_0xfd1c28);}};}function respondWithFilteredResult(_0x31d9da,_0x281d23){return function(_0x211c12){if(_0x211c12){var _0x258bbf=typeof _0x281d23[_0xb53e('0x2f')]===_0xb53e('0x30')&&typeof _0x281d23['limit']==='undefined';var _0x17afe9=_0x211c12[_0xb53e('0x31')];var _0x5ba49f=_0x258bbf?0x0:_0x281d23[_0xb53e('0x2f')];var _0x4edf8b=_0x258bbf?_0x211c12[_0xb53e('0x31')]:_0x281d23[_0xb53e('0x2f')]+_0x281d23[_0xb53e('0x32')];var _0x2d58e1;if(_0x4edf8b>=_0x17afe9){_0x4edf8b=_0x17afe9;_0x2d58e1=0xc8;}else{_0x2d58e1=0xce;}_0x31d9da[_0xb53e('0x2c')](_0x2d58e1);return _0x31d9da[_0xb53e('0x33')](_0xb53e('0x34'),_0x5ba49f+'-'+_0x4edf8b+'/'+_0x17afe9)['json'](_0x211c12);}return null;};}function patchUpdates(_0x4e9be3){return function(_0x14cc08){try{jsonpatch[_0xb53e('0x35')](_0x14cc08,_0x4e9be3,!![]);}catch(_0x3581cb){return BPromise[_0xb53e('0x36')](_0x3581cb);}return _0x14cc08[_0xb53e('0x37')]();};}function saveUpdates(_0x33ce42,_0x6bbe84){return function(_0x53ab72){if(_0x53ab72){return _0x53ab72['update'](_0x33ce42)[_0xb53e('0x20')](function(_0x3a51e7){return _0x3a51e7;});}return null;};}function removeEntity(_0x595c2d,_0x2ce2aa){return function(_0x404ae3){if(_0x404ae3){return _0x404ae3[_0xb53e('0x38')]()['then'](function(){var _0x311b4d=_0x404ae3[_0xb53e('0x39')]({'plain':!![]});var _0x4d0d6f=_0xb53e('0x3a');return db[_0xb53e('0x3b')]['destroy']({'where':{'type':_0x4d0d6f,'resourceId':_0x311b4d['id']}})['then'](function(){return _0x404ae3;});})[_0xb53e('0x20')](function(){_0x595c2d[_0xb53e('0x2c')](0xcc)[_0xb53e('0x2d')]();});}};}function handleEntityNotFound(_0xf4e585,_0x161559){return function(_0x25e8f3){if(!_0x25e8f3){_0xf4e585['sendStatus'](0x194);}return _0x25e8f3;};}function handleError(_0x151020,_0x10920d){_0x10920d=_0x10920d||0x1f4;return function(_0xf6eb0c){logger['error'](_0xf6eb0c['stack']);if(_0xf6eb0c[_0xb53e('0x3c')]){delete _0xf6eb0c[_0xb53e('0x3c')];}_0x151020['status'](_0x10920d)['send'](_0xf6eb0c);};}exports[_0xb53e('0x3d')]=function(_0x2c65ea,_0x4f0f64){var _0x545406={'include':[{'model':db[_0xb53e('0x3e')],'as':_0xb53e('0x3f')}]},_0x4830f2={},_0x341c79={'count':0x0,'rows':[]};var _0x723ea5=_[_0xb53e('0x40')](db[_0xb53e('0x41')][_0xb53e('0x42')],function(_0x2859b3){return{'name':_0x2859b3[_0xb53e('0x43')],'type':_0x2859b3[_0xb53e('0x44')]['key']};});_0x4830f2[_0xb53e('0x45')]=_[_0xb53e('0x40')](_0x723ea5,_0xb53e('0x3c'));_0x4830f2[_0xb53e('0x46')]=_[_0xb53e('0x47')](_0x2c65ea[_0xb53e('0x46')]);_0x4830f2[_0xb53e('0x48')]=_[_0xb53e('0x49')](_0x4830f2[_0xb53e('0x45')],_0x4830f2[_0xb53e('0x46')]);_0x545406[_0xb53e('0x4a')]=_['intersection'](_0x4830f2['model'],qs[_0xb53e('0x4b')](_0x2c65ea['query'][_0xb53e('0x4b')]));_0x545406['attributes']=_0x545406[_0xb53e('0x4a')][_0xb53e('0x4c')]?_0x545406['attributes']:_0x4830f2[_0xb53e('0x45')];if(!_0x2c65ea['query'][_0xb53e('0x4d')](_0xb53e('0x4e'))){_0x545406[_0xb53e('0x32')]=qs[_0xb53e('0x32')](_0x2c65ea['query']['limit']);_0x545406[_0xb53e('0x2f')]=qs['offset'](_0x2c65ea[_0xb53e('0x46')][_0xb53e('0x2f')]);}_0x545406['order']=qs[_0xb53e('0x4f')](_0x2c65ea[_0xb53e('0x46')]['sort']);_0x545406['where']=qs[_0xb53e('0x48')](_[_0xb53e('0x50')](_0x2c65ea[_0xb53e('0x46')],_0x4830f2[_0xb53e('0x48')]),_0x723ea5);if(_0x2c65ea[_0xb53e('0x46')][_0xb53e('0x51')]){_0x545406[_0xb53e('0x52')]=_['merge'](_0x545406[_0xb53e('0x52')],{'$or':_[_0xb53e('0x40')](_0x723ea5,function(_0x16ce23){if(_0x16ce23[_0xb53e('0x44')]!=='VIRTUAL'){var _0x1eeced={};_0x1eeced[_0x16ce23['name']]={'$like':'%'+_0x2c65ea[_0xb53e('0x46')]['filter']+'%'};return _0x1eeced;}})});}_0x545406=_[_0xb53e('0x53')]({},_0x545406,_0x2c65ea[_0xb53e('0x54')]);var _0x543104={'where':_0x545406[_0xb53e('0x52')]};return db[_0xb53e('0x41')][_0xb53e('0x31')](_0x543104)['then'](function(_0x525872){_0x341c79[_0xb53e('0x31')]=_0x525872;if(_0x2c65ea[_0xb53e('0x46')][_0xb53e('0x55')]){_0x545406['include']=[{'all':!![]}];}return db[_0xb53e('0x41')][_0xb53e('0x56')](_0x545406);})[_0xb53e('0x20')](function(_0x2e9810){_0x341c79[_0xb53e('0x57')]=_0x2e9810;return _0x341c79;})[_0xb53e('0x20')](respondWithFilteredResult(_0x4f0f64,_0x545406))[_0xb53e('0x2a')](handleError(_0x4f0f64,null));};exports[_0xb53e('0x58')]=function(_0x2e444f,_0x340b7d){var _0x2990fc={'raw':![],'where':{'id':_0x2e444f[_0xb53e('0x59')]['id']},'include':[{'model':db[_0xb53e('0x3e')],'as':_0xb53e('0x3f')}]},_0x441157={};_0x441157[_0xb53e('0x45')]=_[_0xb53e('0x47')](db[_0xb53e('0x41')]['rawAttributes']);_0x441157[_0xb53e('0x46')]=_[_0xb53e('0x47')](_0x2e444f[_0xb53e('0x46')]);_0x441157['filters']=_[_0xb53e('0x49')](_0x441157['model'],_0x441157[_0xb53e('0x46')]);_0x2990fc[_0xb53e('0x4a')]=_[_0xb53e('0x49')](_0x441157[_0xb53e('0x45')],qs[_0xb53e('0x4b')](_0x2e444f['query'][_0xb53e('0x4b')]));_0x2990fc['attributes']=_0x2990fc[_0xb53e('0x4a')]['length']?_0x2990fc[_0xb53e('0x4a')]:_0x441157[_0xb53e('0x45')];if(_0x2e444f['query'][_0xb53e('0x55')]){_0x2990fc[_0xb53e('0x5a')]=[{'all':!![]}];}_0x2990fc=_[_0xb53e('0x53')]({},_0x2990fc,_0x2e444f[_0xb53e('0x54')]);return db[_0xb53e('0x41')][_0xb53e('0x5b')](_0x2990fc)[_0xb53e('0x20')](handleEntityNotFound(_0x340b7d,null))[_0xb53e('0x20')](respondWithResult(_0x340b7d,null))[_0xb53e('0x2a')](handleError(_0x340b7d,null));};exports['create']=function(_0x4f2bfd,_0x4f6235){return db[_0xb53e('0x41')][_0xb53e('0x5c')](_0x4f2bfd[_0xb53e('0x5d')],{})[_0xb53e('0x20')](function(_0x3e7121){var _0xd7c9c0=_0x4f2bfd[_0xb53e('0x5e')][_0xb53e('0x39')]({'plain':!![]});if(!_0xd7c9c0)throw new Error(_0xb53e('0x5f'));if(_0xd7c9c0['role']===_0xb53e('0x5e')){var _0x49af8f=_0x3e7121[_0xb53e('0x39')]({'plain':!![]});var _0x33f23a=_0xb53e('0x3a');return db[_0xb53e('0x60')][_0xb53e('0x5b')]({'where':{'name':_0x33f23a,'userProfileId':_0xd7c9c0['userProfileId']},'raw':!![]})[_0xb53e('0x20')](function(_0x35c170){if(_0x35c170&&_0x35c170[_0xb53e('0x61')]===0x0){return db[_0xb53e('0x3b')][_0xb53e('0x5c')]({'name':_0x49af8f[_0xb53e('0x3c')],'resourceId':_0x49af8f['id'],'type':_0x35c170['name'],'sectionId':_0x35c170['id']},{})['then'](function(){return _0x3e7121;});}else{return _0x3e7121;}})[_0xb53e('0x2a')](function(_0x27480b){logger[_0xb53e('0x25')](_0xb53e('0x62'),_0x27480b);throw _0x27480b;});}return _0x3e7121;})[_0xb53e('0x20')](respondWithResult(_0x4f6235,0xc9))[_0xb53e('0x2a')](handleError(_0x4f6235,null));};exports[_0xb53e('0x63')]=function(_0xfaf5c0,_0x182962){if(_0xfaf5c0['body']['id']){delete _0xfaf5c0[_0xb53e('0x5d')]['id'];}return db[_0xb53e('0x41')][_0xb53e('0x5b')]({'where':{'id':_0xfaf5c0[_0xb53e('0x59')]['id']},'include':[{'model':db[_0xb53e('0x3e')],'as':_0xb53e('0x3f')}]})[_0xb53e('0x20')](handleEntityNotFound(_0x182962,null))[_0xb53e('0x20')](saveUpdates(_0xfaf5c0[_0xb53e('0x5d')],null))[_0xb53e('0x20')](respondWithResult(_0x182962,null))[_0xb53e('0x2a')](handleError(_0x182962,null));};exports[_0xb53e('0x38')]=function(_0xc760ae,_0x581e72){return db[_0xb53e('0x41')][_0xb53e('0x5b')]({'where':{'id':_0xc760ae['params']['id']}})[_0xb53e('0x20')](handleEntityNotFound(_0x581e72,null))[_0xb53e('0x20')](removeEntity(_0x581e72,null))['catch'](handleError(_0x581e72,null));};exports[_0xb53e('0x64')]=function(_0x31ab94,_0x58d030){return db[_0xb53e('0x41')][_0xb53e('0x64')]()[_0xb53e('0x20')](respondWithResult(_0x58d030,null))[_0xb53e('0x2a')](handleError(_0x58d030,null));};exports[_0xb53e('0x65')]=function(_0x564ef8,_0x4296ee,_0x4571a1){if(_0x564ef8['body']['id']){delete _0x564ef8[_0xb53e('0x5d')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x564ef8[_0xb53e('0x59')]['id']}})[_0xb53e('0x20')](handleEntityNotFound(_0x4296ee,null))[_0xb53e('0x20')](function(_0x2126ec){if(_0x2126ec){_0x564ef8[_0xb53e('0x5d')][_0xb53e('0x66')]=_0x2126ec['id'];return db['Disposition'][_0xb53e('0x5c')](_0x564ef8[_0xb53e('0x5d')]);}})[_0xb53e('0x20')](respondWithResult(_0x4296ee,null))[_0xb53e('0x2a')](handleError(_0x4296ee,null));};exports[_0xb53e('0x67')]=function(_0x5610e3,_0x2078bb,_0x1a246a){var _0x284b49={'raw':![],'where':{}};var _0x31aab5={};var _0x98e176={'count':0x0,'rows':[]};return db[_0xb53e('0x41')]['findOne']({'where':{'id':_0x5610e3[_0xb53e('0x59')]['id']}})[_0xb53e('0x20')](handleEntityNotFound(_0x2078bb,null))[_0xb53e('0x20')](function(_0x55acad){if(_0x55acad){_0x31aab5[_0xb53e('0x45')]=_[_0xb53e('0x47')](db[_0xb53e('0x68')][_0xb53e('0x42')]);_0x31aab5[_0xb53e('0x46')]=_[_0xb53e('0x47')](_0x5610e3[_0xb53e('0x46')]);_0x31aab5[_0xb53e('0x48')]=_['intersection'](_0x31aab5['model'],_0x31aab5[_0xb53e('0x46')]);_0x284b49['attributes']=_[_0xb53e('0x49')](_0x31aab5['model'],qs[_0xb53e('0x4b')](_0x5610e3['query'][_0xb53e('0x4b')]));_0x284b49[_0xb53e('0x4a')]=_0x284b49[_0xb53e('0x4a')]['length']?_0x284b49['attributes']:_0x31aab5[_0xb53e('0x45')];if(!_0x5610e3[_0xb53e('0x46')]['hasOwnProperty'](_0xb53e('0x4e'))){_0x284b49[_0xb53e('0x32')]=qs[_0xb53e('0x32')](_0x5610e3[_0xb53e('0x46')][_0xb53e('0x32')]);_0x284b49['offset']=qs['offset'](_0x5610e3['query']['offset']);}_0x284b49[_0xb53e('0x69')]=qs[_0xb53e('0x4f')](_0x5610e3[_0xb53e('0x46')][_0xb53e('0x4f')]);_0x284b49[_0xb53e('0x52')]=qs[_0xb53e('0x48')](_[_0xb53e('0x50')](_0x5610e3[_0xb53e('0x46')],_0x31aab5[_0xb53e('0x48')]));_0x284b49['where'][_0xb53e('0x66')]=_0x55acad['id'];if(_0x5610e3[_0xb53e('0x46')][_0xb53e('0x51')]){_0x284b49['where']=_[_0xb53e('0x53')](_0x284b49['where'],{'$or':_[_0xb53e('0x40')](_0x284b49['attributes'],function(_0x3a147e){var _0x59704b={};_0x59704b[_0x3a147e]={'$like':'%'+_0x5610e3[_0xb53e('0x46')][_0xb53e('0x51')]+'%'};return _0x59704b;})});}_0x284b49=_[_0xb53e('0x53')]({},_0x284b49,_0x5610e3[_0xb53e('0x54')]);return db[_0xb53e('0x68')][_0xb53e('0x31')]({'where':_0x284b49[_0xb53e('0x52')]})[_0xb53e('0x20')](function(_0x1a9d3d){_0x98e176[_0xb53e('0x31')]=_0x1a9d3d;if(_0x5610e3[_0xb53e('0x46')][_0xb53e('0x55')]){_0x284b49[_0xb53e('0x5a')]=[{'all':!![]}];}return db[_0xb53e('0x68')][_0xb53e('0x56')](_0x284b49);})[_0xb53e('0x20')](function(_0x4b282a){_0x98e176['rows']=_0x4b282a;return _0x98e176;});}})[_0xb53e('0x20')](respondWithFilteredResult(_0x2078bb,_0x284b49))[_0xb53e('0x2a')](handleError(_0x2078bb,null));};exports[_0xb53e('0x6a')]=function(_0xce9884,_0x4ace82,_0x33a205){return db['WhatsappAccount'][_0xb53e('0x5b')]({'where':{'id':_0xce9884[_0xb53e('0x59')]['id']}})[_0xb53e('0x20')](handleEntityNotFound(_0x4ace82,null))[_0xb53e('0x20')](function(_0x4b313d){if(_0x4b313d){return _0x4b313d['removeDispositions'](_0xce9884[_0xb53e('0x46')][_0xb53e('0x6b')]);}})[_0xb53e('0x20')](respondWithStatusCode(_0x4ace82,null))[_0xb53e('0x2a')](handleError(_0x4ace82,null));};exports[_0xb53e('0x6c')]=function(_0x5a36cb,_0x1288c2,_0x2fc391){if(_0x5a36cb[_0xb53e('0x5d')]['id']){delete _0x5a36cb[_0xb53e('0x5d')]['id'];}return db[_0xb53e('0x41')][_0xb53e('0x5b')]({'where':{'id':_0x5a36cb['params']['id']}})[_0xb53e('0x20')](handleEntityNotFound(_0x1288c2,null))[_0xb53e('0x20')](function(_0x547f62){if(_0x547f62){_0x5a36cb[_0xb53e('0x5d')]['WhatsappAccountId']=_0x547f62['id'];return db[_0xb53e('0x6d')][_0xb53e('0x5c')](_0x5a36cb[_0xb53e('0x5d')]);}})[_0xb53e('0x20')](respondWithResult(_0x1288c2,null))['catch'](handleError(_0x1288c2,null));};exports[_0xb53e('0x6e')]=function(_0x5e5513,_0x53d2b9,_0x5bcebf){var _0x1ac807={'raw':![],'where':{}};var _0x495b2d={};var _0x5a1d08={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x5e5513[_0xb53e('0x59')]['id']}})['then'](handleEntityNotFound(_0x53d2b9,null))['then'](function(_0x505021){if(_0x505021){_0x495b2d[_0xb53e('0x45')]=_['keys'](db[_0xb53e('0x6d')][_0xb53e('0x42')]);_0x495b2d[_0xb53e('0x46')]=_[_0xb53e('0x47')](_0x5e5513[_0xb53e('0x46')]);_0x495b2d['filters']=_[_0xb53e('0x49')](_0x495b2d[_0xb53e('0x45')],_0x495b2d['query']);_0x1ac807[_0xb53e('0x4a')]=_[_0xb53e('0x49')](_0x495b2d[_0xb53e('0x45')],qs[_0xb53e('0x4b')](_0x5e5513[_0xb53e('0x46')]['fields']));_0x1ac807[_0xb53e('0x4a')]=_0x1ac807[_0xb53e('0x4a')][_0xb53e('0x4c')]?_0x1ac807[_0xb53e('0x4a')]:_0x495b2d['model'];if(!_0x5e5513[_0xb53e('0x46')]['hasOwnProperty'](_0xb53e('0x4e'))){_0x1ac807[_0xb53e('0x32')]=qs[_0xb53e('0x32')](_0x5e5513[_0xb53e('0x46')][_0xb53e('0x32')]);_0x1ac807[_0xb53e('0x2f')]=qs[_0xb53e('0x2f')](_0x5e5513[_0xb53e('0x46')][_0xb53e('0x2f')]);}_0x1ac807['order']=qs[_0xb53e('0x4f')](_0x5e5513[_0xb53e('0x46')]['sort']);_0x1ac807[_0xb53e('0x52')]=qs['filters'](_[_0xb53e('0x50')](_0x5e5513[_0xb53e('0x46')],_0x495b2d[_0xb53e('0x48')]));_0x1ac807[_0xb53e('0x52')][_0xb53e('0x66')]=_0x505021['id'];if(_0x5e5513[_0xb53e('0x46')][_0xb53e('0x51')]){_0x1ac807[_0xb53e('0x52')]=_[_0xb53e('0x53')](_0x1ac807[_0xb53e('0x52')],{'$or':_[_0xb53e('0x40')](_0x1ac807['attributes'],function(_0x3ec7e3){var _0x48b97f={};_0x48b97f[_0x3ec7e3]={'$like':'%'+_0x5e5513[_0xb53e('0x46')][_0xb53e('0x51')]+'%'};return _0x48b97f;})});}_0x1ac807=_[_0xb53e('0x53')]({},_0x1ac807,_0x5e5513['options']);return db[_0xb53e('0x6d')]['count']({'where':_0x1ac807[_0xb53e('0x52')]})[_0xb53e('0x20')](function(_0x58737f){_0x5a1d08['count']=_0x58737f;if(_0x5e5513['query'][_0xb53e('0x55')]){_0x1ac807[_0xb53e('0x5a')]=[{'all':!![]}];}return db[_0xb53e('0x6d')]['findAll'](_0x1ac807);})[_0xb53e('0x20')](function(_0x106165){_0x5a1d08[_0xb53e('0x57')]=_0x106165;return _0x5a1d08;});}})['then'](respondWithFilteredResult(_0x53d2b9,_0x1ac807))[_0xb53e('0x2a')](handleError(_0x53d2b9,null));};exports[_0xb53e('0x6f')]=function(_0x576da0,_0x1f2135,_0x1d1f74){return db['WhatsappAccount'][_0xb53e('0x5b')]({'where':{'id':_0x576da0['params']['id']}})['then'](handleEntityNotFound(_0x1f2135,null))[_0xb53e('0x20')](function(_0x303720){if(_0x303720){return _0x303720[_0xb53e('0x6f')](_0x576da0['query'][_0xb53e('0x6b')]);}})['then'](respondWithStatusCode(_0x1f2135,null))[_0xb53e('0x2a')](handleError(_0x1f2135,null));};exports['addAgents']=function(_0x10ab7b,_0x38272f,_0x298815){return db['WhatsappAccount'][_0xb53e('0x5b')]({'where':{'id':_0x10ab7b[_0xb53e('0x59')]['id']}})[_0xb53e('0x20')](handleEntityNotFound(_0x38272f,null))[_0xb53e('0x20')](function(_0x32a225){if(_0x32a225){return _0x32a225['addAgents'](_0x10ab7b[_0xb53e('0x5d')][_0xb53e('0x6b')],_[_0xb53e('0x70')](_0x10ab7b[_0xb53e('0x5d')],[_0xb53e('0x6b'),'id'])||{})[_0xb53e('0x71')](function(_0x36e6a8){for(var _0x548da0=0x0;_0x548da0<_0x10ab7b[_0xb53e('0x5d')][_0xb53e('0x6b')][_0xb53e('0x4c')];_0x548da0+=0x1){socket[_0xb53e('0x72')]('userWhatsappAccount:save',{'UserId':Number(_0x10ab7b[_0xb53e('0x5d')][_0xb53e('0x6b')][_0x548da0]),'WhatsappAccountId':Number(_0x10ab7b['params']['id'])});}return _0x36e6a8;});}})[_0xb53e('0x20')](respondWithResult(_0x38272f,null))[_0xb53e('0x2a')](handleError(_0x38272f,null));};exports[_0xb53e('0x73')]=function(_0x323b7b,_0x476517,_0x3790ad){return db[_0xb53e('0x41')]['find']({'where':{'id':_0x323b7b[_0xb53e('0x59')]['id']}})['then'](handleEntityNotFound(_0x476517,null))[_0xb53e('0x20')](function(_0x31719d){if(_0x31719d){return _0x31719d[_0xb53e('0x73')](_0x323b7b[_0xb53e('0x46')][_0xb53e('0x6b')])[_0xb53e('0x20')](function(){if(_[_0xb53e('0x74')](_0x323b7b[_0xb53e('0x46')][_0xb53e('0x6b')])){for(var _0xcd6d23=0x0;_0xcd6d23<_0x323b7b[_0xb53e('0x46')][_0xb53e('0x6b')][_0xb53e('0x4c')];_0xcd6d23+=0x1){socket[_0xb53e('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x323b7b[_0xb53e('0x46')][_0xb53e('0x6b')][_0xcd6d23]),'WhatsappAccountId':Number(_0x323b7b[_0xb53e('0x59')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x323b7b['query'][_0xb53e('0x6b')]),'WhatsappAccountId':Number(_0x323b7b[_0xb53e('0x59')]['id'])});}});}})[_0xb53e('0x20')](respondWithStatusCode(_0x476517,null))[_0xb53e('0x2a')](handleError(_0x476517,null));};exports[_0xb53e('0x75')]=function(_0x430826,_0x345ef5,_0x5be967){var _0x2c8097={};var _0x3fa22b={};var _0x8d81c9;var _0x57d8b1;return db[_0xb53e('0x41')][_0xb53e('0x76')]({'where':{'id':_0x430826[_0xb53e('0x59')]['id']}})[_0xb53e('0x20')](handleEntityNotFound(_0x345ef5,null))[_0xb53e('0x20')](function(_0x68f876){if(_0x68f876){_0x8d81c9=_0x68f876;_0x3fa22b[_0xb53e('0x45')]=_[_0xb53e('0x47')](db[_0xb53e('0x77')][_0xb53e('0x42')]);_0x3fa22b[_0xb53e('0x46')]=_[_0xb53e('0x47')](_0x430826[_0xb53e('0x46')]);_0x3fa22b[_0xb53e('0x48')]=_[_0xb53e('0x49')](_0x3fa22b[_0xb53e('0x45')],_0x3fa22b[_0xb53e('0x46')]);_0x2c8097[_0xb53e('0x4a')]=_['intersection'](_0x3fa22b[_0xb53e('0x45')],qs[_0xb53e('0x4b')](_0x430826[_0xb53e('0x46')][_0xb53e('0x4b')]));_0x2c8097[_0xb53e('0x4a')]=_0x2c8097[_0xb53e('0x4a')][_0xb53e('0x4c')]?_0x2c8097[_0xb53e('0x4a')]:_0x3fa22b[_0xb53e('0x45')];_0x2c8097['order']=qs[_0xb53e('0x4f')](_0x430826[_0xb53e('0x46')][_0xb53e('0x4f')]);_0x2c8097[_0xb53e('0x52')]=qs['filters'](_[_0xb53e('0x50')](_0x430826[_0xb53e('0x46')],_0x3fa22b['filters']));if(_0x430826[_0xb53e('0x46')]['filter']){_0x2c8097[_0xb53e('0x52')]=_[_0xb53e('0x53')](_0x2c8097[_0xb53e('0x52')],{'$or':_[_0xb53e('0x40')](_0x2c8097['attributes'],function(_0x4c4113){var _0x4d3ec5={};_0x4d3ec5[_0x4c4113]={'$like':'%'+_0x430826['query'][_0xb53e('0x51')]+'%'};return _0x4d3ec5;})});}_0x2c8097=_[_0xb53e('0x53')]({},_0x2c8097,_0x430826[_0xb53e('0x54')]);return _0x8d81c9[_0xb53e('0x75')](_0x2c8097);}})[_0xb53e('0x20')](function(_0xe7ba85){if(_0xe7ba85){_0x57d8b1=_0xe7ba85['length'];if(!_0x430826[_0xb53e('0x46')][_0xb53e('0x4d')](_0xb53e('0x4e'))){_0x2c8097['limit']=qs[_0xb53e('0x32')](_0x430826[_0xb53e('0x46')][_0xb53e('0x32')]);_0x2c8097[_0xb53e('0x2f')]=qs[_0xb53e('0x2f')](_0x430826['query'][_0xb53e('0x2f')]);}return _0x8d81c9[_0xb53e('0x75')](_0x2c8097);}})[_0xb53e('0x20')](function(_0x3cef0a){if(_0x3cef0a){return _0x3cef0a?{'count':_0x57d8b1,'rows':_0x3cef0a}:null;}})[_0xb53e('0x20')](respondWithResult(_0x345ef5,null))[_0xb53e('0x2a')](handleError(_0x345ef5,null));};exports[_0xb53e('0x78')]=function(_0x1d9ae8,_0x4421ce){var _0x541bca=_0x1d9ae8[_0xb53e('0x59')]['id'];var _0x456229=_0x1d9ae8[_0xb53e('0x5d')];var _0xcb31b3=0xc8;var _0x51812f=null;return db['sequelize'][_0xb53e('0x79')]({'isolationLevel':db[_0xb53e('0x7a')]['Transaction'][_0xb53e('0x7b')][_0xb53e('0x7c')]},function(_0x387352){return db['WhatsappAccount'][_0xb53e('0x76')]({'where':{'id':_0x541bca},'transaction':_0x387352})[_0xb53e('0x20')](function(_0x2dbaa4){if(_0x2dbaa4){return db[_0xb53e('0x7d')][_0xb53e('0x38')]({'where':{'WhatsappAccountId':_0x541bca},'transaction':_0x387352})[_0xb53e('0x20')](function(){var _0x136f2d=_[_0xb53e('0x40')](_0x456229,function(_0x1c5d8b){_0x1c5d8b[_0xb53e('0x66')]=_0x541bca;return _0x1c5d8b;});return db[_0xb53e('0x7d')][_0xb53e('0x7e')](_0x136f2d,{'transaction':_0x387352});});}else{_0xcb31b3=0x194;_0x51812f=[];}});})['then'](function(){if(_0xcb31b3!==0x194){return db[_0xb53e('0x7d')][_0xb53e('0x7f')]({'where':{'WhatsappAccountId':_0x541bca},'order':'priority'})['then'](function(_0x142dac){_0x51812f=_0x142dac;});}})[_0xb53e('0x2a')](function(_0x3ec6a8){_0xcb31b3=0x1f4;logger[_0xb53e('0x25')](_0x3ec6a8[_0xb53e('0x80')]);if(_0x3ec6a8['name']){delete _0x3ec6a8['name'];}_0x51812f=_0x3ec6a8;})[_0xb53e('0x81')](function(){if(_0x51812f===null){_0x4421ce[_0xb53e('0x2b')](_0xcb31b3);}else{if(_0xcb31b3===0x1f4){_0x4421ce[_0xb53e('0x2c')](_0xcb31b3)['send'](_0x51812f);}else{_0x4421ce['status'](_0xcb31b3)[_0xb53e('0x2e')](_0x51812f);}}});};exports[_0xb53e('0x82')]=function(_0x284e9e,_0x22731e,_0x54502d){var _0x28f664={};var _0x120c13={};var _0x255940;var _0x1e8de4;return db[_0xb53e('0x41')][_0xb53e('0x76')]({'where':{'id':_0x284e9e[_0xb53e('0x59')]['id']}})[_0xb53e('0x20')](handleEntityNotFound(_0x22731e,null))['then'](function(_0x473457){if(_0x473457){_0x255940=_0x473457;_0x120c13['model']=_[_0xb53e('0x47')](db['WhatsappApplication'][_0xb53e('0x42')]);_0x120c13[_0xb53e('0x46')]=_[_0xb53e('0x47')](_0x284e9e[_0xb53e('0x46')]);_0x120c13[_0xb53e('0x48')]=_['intersection'](_0x120c13[_0xb53e('0x45')],_0x120c13['query']);_0x28f664[_0xb53e('0x4a')]=_[_0xb53e('0x49')](_0x120c13[_0xb53e('0x45')],qs[_0xb53e('0x4b')](_0x284e9e[_0xb53e('0x46')][_0xb53e('0x4b')]));_0x28f664[_0xb53e('0x4a')]=_0x28f664[_0xb53e('0x4a')][_0xb53e('0x4c')]?_0x28f664[_0xb53e('0x4a')]:_0x120c13[_0xb53e('0x45')];_0x28f664[_0xb53e('0x69')]=qs['sort'](_0x284e9e[_0xb53e('0x46')][_0xb53e('0x4f')]);_0x28f664[_0xb53e('0x52')]=qs[_0xb53e('0x48')](_[_0xb53e('0x50')](_0x284e9e[_0xb53e('0x46')],_0x120c13[_0xb53e('0x48')]));if(_0x284e9e[_0xb53e('0x46')][_0xb53e('0x51')]){_0x28f664['where']=_[_0xb53e('0x53')](_0x28f664[_0xb53e('0x52')],{'$or':_[_0xb53e('0x40')](_0x28f664[_0xb53e('0x4a')],function(_0xcf0dee){var _0x475e3a={};_0x475e3a[_0xcf0dee]={'$like':'%'+_0x284e9e['query']['filter']+'%'};return _0x475e3a;})});}_0x28f664=_[_0xb53e('0x53')]({},_0x28f664,_0x284e9e['options']);return _0x255940[_0xb53e('0x82')](_0x28f664);}})[_0xb53e('0x20')](function(_0x385caf){if(_0x385caf){_0x1e8de4=_0x385caf[_0xb53e('0x4c')];if(!_0x284e9e[_0xb53e('0x46')][_0xb53e('0x4d')]('nolimit')){_0x28f664['limit']=qs[_0xb53e('0x32')](_0x284e9e[_0xb53e('0x46')][_0xb53e('0x32')]);_0x28f664[_0xb53e('0x2f')]=qs[_0xb53e('0x2f')](_0x284e9e[_0xb53e('0x46')]['offset']);}return _0x255940['getApplications'](_0x28f664);}})[_0xb53e('0x20')](function(_0x5f48f7){if(_0x5f48f7){return _0x5f48f7?{'count':_0x1e8de4,'rows':_0x5f48f7}:null;}})[_0xb53e('0x20')](respondWithResult(_0x22731e,null))[_0xb53e('0x2a')](handleError(_0x22731e,null));};exports[_0xb53e('0x83')]=function(_0x35a2dd,_0x22f14a,_0x11955a){var _0x3e60f6={'channel':'whatsapp'};var _0x457780=[];var _0x2b2942=[];var _0x540f3c={};return db[_0xb53e('0x41')][_0xb53e('0x5b')]({'where':{'id':_0x35a2dd[_0xb53e('0x59')]['id']},'include':[{'model':db[_0xb53e('0x7d')],'as':_0xb53e('0x84')}]})['then'](handleEntityNotFound(_0x22f14a,null))[_0xb53e('0x20')](function(_0x1eb8b0){_0x3e60f6[_0xb53e('0x85')]=_0x1eb8b0;if(_0x3e60f6['account']&&_0x3e60f6[_0xb53e('0x85')]['type']===_0xb53e('0x86')&&_0x35a2dd[_0xb53e('0x5d')]['statuses']){if(_0x35a2dd[_0xb53e('0x5d')][_0xb53e('0x87')]['length']===0x0)return;if(_0x35a2dd[_0xb53e('0x5d')][_0xb53e('0x87')][0x0][_0xb53e('0x88')]!==_0xb53e('0x89'))return;return db['WhatsappMessage'][_0xb53e('0x63')]({'read':!![],'readAt':_0x35a2dd['body'][_0xb53e('0x87')][0x0][_0xb53e('0x8a')]},{'where':{'messageId':_0x35a2dd[_0xb53e('0x5d')][_0xb53e('0x87')][0x0]['message_id']},'individualHooks':!![]})[_0xb53e('0x20')](function(_0x6ca2ef){return _0x22f14a['status'](0xc8)[_0xb53e('0x2e')](_0x6ca2ef);});}_0x3e60f6[_0xb53e('0x8b')]=_['orderBy'](_0x1eb8b0[_0xb53e('0x84')],['priority'],[_0xb53e('0x8c')]);if(_0x3e60f6[_0xb53e('0x85')][_0xb53e('0x84')]){delete _0x3e60f6[_0xb53e('0x85')][_0xb53e('0x84')];}return db[_0xb53e('0x8d')][_0xb53e('0x64')]()[_0xb53e('0x20')](function(_0x3cff9d){if(!_0x3cff9d){throw new db['Sequelize'][(_0xb53e('0x8e'))](_0xb53e('0x8f'));}_0x457780=_[_0xb53e('0x90')](_[_0xb53e('0x47')](_0x3cff9d),['createdAt',_0xb53e('0x91')]);_0x2b2942=_[_0xb53e('0x90')](_[_0xb53e('0x47')](_0x3cff9d),[_0xb53e('0x92'),_0xb53e('0x91'),'CompanyId',_0xb53e('0x93')]);_0x3e60f6[_0xb53e('0x5d')]={'mapKey':'mobile'};if(_0x3e60f6[_0xb53e('0x85')]&&_0x3e60f6[_0xb53e('0x85')][_0xb53e('0x44')]===_0xb53e('0x94')){_0x3e60f6[_0xb53e('0x5d')]['from']=_0x35a2dd[_0xb53e('0x5d')][_0xb53e('0x95')][_0xb53e('0x96')](_0xb53e('0x97'),'');_0x3e60f6[_0xb53e('0x5d')]['body']=_0x35a2dd[_0xb53e('0x5d')][_0xb53e('0x98')];_0x3e60f6[_0xb53e('0x5d')][_0xb53e('0x99')]=_0x35a2dd[_0xb53e('0x5d')][_0xb53e('0x9a')];}if(_0x3e60f6['account']&&_0x3e60f6[_0xb53e('0x85')][_0xb53e('0x44')]==='sinch'){_0x3e60f6[_0xb53e('0x5d')][_0xb53e('0x9b')]=_0x35a2dd[_0xb53e('0x5d')][_0xb53e('0x9c')][0x0]['from'];_0x3e60f6[_0xb53e('0x5d')][_0xb53e('0x5d')]=_0x35a2dd['body'][_0xb53e('0x9c')][0x0][_0xb53e('0x27')]['body'];_0x3e60f6[_0xb53e('0x5d')][_0xb53e('0x99')]=_0x35a2dd['body'][_0xb53e('0x9c')][0x0][_0xb53e('0x9d')];}if(_0x3e60f6[_0xb53e('0x5d')]['id']){delete _0x3e60f6[_0xb53e('0x5d')]['id'];}if(_['isNil'](_0x3e60f6[_0xb53e('0x5d')][_0xb53e('0x9b')])){throw new db[(_0xb53e('0x9e'))][(_0xb53e('0x8e'))](_0xb53e('0x9f'));}if(_['isNil'](_0x3e60f6['body'][_0xb53e('0x5d')])||_0x3e60f6[_0xb53e('0x5d')]['body']===''){throw new db[(_0xb53e('0x9e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb53e('0xa0')](_0x3e60f6[_0xb53e('0x5d')]['mapKey'])){throw new db[(_0xb53e('0x9e'))][(_0xb53e('0x8e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b2942);}if(!_[_0xb53e('0xa1')](_0x2b2942,_0x3e60f6['body'][_0xb53e('0xa2')])){throw new db[(_0xb53e('0x9e'))][(_0xb53e('0x8e'))](_0xb53e('0xa3')+_0x2b2942);}_0x540f3c[_0x3e60f6['body'][_0xb53e('0xa2')]]=_0x3e60f6[_0xb53e('0x5d')]['from'];return db['CmList']['find']({'where':{'id':_0x3e60f6[_0xb53e('0x85')][_0xb53e('0x93')]},'include':[{'model':db[_0xb53e('0x8d')],'as':_0xb53e('0xa4'),'where':_0x540f3c,'limit':0x1,'order':[[_0xb53e('0x91'),_0xb53e('0xa5')]]}]});})[_0xb53e('0x20')](handleEntityNotFound(_0x22f14a,null))[_0xb53e('0x20')](function(_0x1c7c45){if(_0x1c7c45){_0x3e60f6['list']=_['omit'](_0x1c7c45,['Contacts']);if(_0x1c7c45[_0xb53e('0xa4')]['length']){return _0x1c7c45[_0xb53e('0xa4')][0x0];}var _0x39c6ff=_[_0xb53e('0xa6')](_0x3e60f6['body'],{'firstName':_0x3e60f6[_0xb53e('0x5d')]['from'],'ListId':_0x1c7c45['id']});_0x39c6ff[_0x3e60f6[_0xb53e('0x5d')][_0xb53e('0xa2')]]=_0x3e60f6[_0xb53e('0x5d')][_0xb53e('0x9b')];return db[_0xb53e('0x8d')][_0xb53e('0x5c')](_0x39c6ff,{'fields':_0x457780,'raw':!![]});}})['then'](handleEntityNotFound(_0x22f14a,null))[_0xb53e('0x20')](function(_0x5bc23c){if(_0x5bc23c){_0x3e60f6[_0xb53e('0xa7')]=_0x5bc23c;var _0x244475={'ContactId':_0x5bc23c['id'],'phone':_0x3e60f6[_0xb53e('0x5d')]['from'],'WhatsappAccountId':_0x35a2dd['params']['id']};var _0xd602b1={'ContactId':_0x5bc23c['id'],'WhatsappAccountId':_0x35a2dd['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0xb53e('0x5b')]({'where':_0xd602b1})[_0xb53e('0x20')](function(_0x1c31f0){if(_0x1c31f0){return[_0x1c31f0,![]];}return db[_0xb53e('0xa8')][_0xb53e('0x5c')](_0x244475)[_0xb53e('0x20')](function(_0x15da8b){return[_0x15da8b,!![]];});});}})[_0xb53e('0x71')](function(_0x1d36cf,_0x3f77bb){_0x3e60f6[_0xb53e('0xa9')]=_0x1d36cf[_0xb53e('0x39')]({'plain':!![]});_0x3e60f6['interaction'][_0xb53e('0xaa')]=![];if(_0x3f77bb){if(_0x3e60f6[_0xb53e('0x85')][_0xb53e('0xab')]){_0x3e60f6[_0xb53e('0x8b')][_0xb53e('0xac')]({'id':0x0,'priority':_0x3e60f6['applications'][_0xb53e('0x4c')]+0x1,'app':_0xb53e('0xad'),'appdata':'unmanaged','interval':_0xb53e('0xae')});}_0x3e60f6['interaction'][_0xb53e('0xaa')]=!![];}return db[_0xb53e('0xaf')][_0xb53e('0x5c')]({'phone':_0x3e60f6[_0xb53e('0x5d')][_0xb53e('0x9b')],'messageId':_0x3e60f6['body'][_0xb53e('0x99')],'body':_0x3e60f6[_0xb53e('0x5d')][_0xb53e('0x5d')],'WhatsappAccountId':_0x35a2dd['params']['id'],'WhatsappInteractionId':_0x1d36cf['id'],'direction':'in','ContactId':_0x1d36cf['ContactId'],'AttachmentId':_0x3e60f6[_0xb53e('0x5d')][_0xb53e('0xb0')]});})['then'](function(_0x459c35){_0x3e60f6[_0xb53e('0x27')]=_0x459c35;if(!_0x3e60f6[_0xb53e('0xa9')]['UserId'])return;return db[_0xb53e('0x77')][_0xb53e('0x5b')]({'attributes':['id',_0xb53e('0x3c')],'where':{'id':_0x3e60f6[_0xb53e('0xa9')][_0xb53e('0xb1')]}});})[_0xb53e('0x20')](function(_0x3dbebb){if(_0x3dbebb){_0x3e60f6[_0xb53e('0x8b')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb53e('0xb2'),'appdata':_0x3dbebb[_0xb53e('0x3c')]+','+(_0x3e60f6[_0xb53e('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0xb53e('0xae')});}if(!_0x3e60f6[_0xb53e('0xa9')][_0xb53e('0xb3')])return;return db['WhatsappQueue']['find']({'attributes':['id',_0xb53e('0x3c')],'where':{'id':_0x3e60f6[_0xb53e('0xa9')]['queueId']}});})[_0xb53e('0x20')](function(_0x20774c){if(_0x20774c){_0x3e60f6[_0xb53e('0x8b')][_0xb53e('0xb4')]({'id':0x0,'priority':0x1,'app':_0xb53e('0xb5'),'appdata':_0x20774c[_0xb53e('0x3c')]+','+(_0x3e60f6[_0xb53e('0x85')][_0xb53e('0xb6')]||0x12c),'interval':_0xb53e('0xae')});}return respondWithRpcPromise(_0xb53e('0xb7'),_0xb53e('0xb8'),_0x3e60f6);})[_0xb53e('0x20')](function(_0x518de3){if(_0x518de3){var _0x3bf813=0xc8;var _0x2fddd0=_0xb53e('0xb9');logger[_0xb53e('0x28')](_0xb53e('0x23'),_0x2fddd0,_0x3bf813,'entity\x20found');logger[_0xb53e('0x22')](_0xb53e('0xba'),_0x2fddd0,_0x3bf813,'entity\x20found',JSON[_0xb53e('0x24')](_0x518de3));if(_0x3e60f6[_0xb53e('0x85')][_0xb53e('0x44')]===_0xb53e('0x94')){return _0x22f14a['status'](_0x3bf813)[_0xb53e('0x33')](_0xb53e('0xbb'),_0xb53e('0xbc'))[_0xb53e('0xbd')](_0xb53e('0xbe'));}else{return _0x22f14a[_0xb53e('0x2c')](_0x3bf813)['json'](_0x518de3);}}});})[_0xb53e('0x2a')](handleError(_0x22f14a,null));};exports[_0xb53e('0xbd')]=function(_0x18a2e2,_0x3a4c3e,_0x339339){var _0x452d1b,_0x5a2660,_0x26612a;if(_[_0xb53e('0xa0')](_0x18a2e2['body'][_0xb53e('0x5d')])||_0x18a2e2[_0xb53e('0x5d')][_0xb53e('0x5d')]===''){throw new db[(_0xb53e('0x9e'))]['ValidationError'](_0xb53e('0xbf'));}if(_[_0xb53e('0xa0')](_0x18a2e2[_0xb53e('0x5d')]['to'])){throw new db['Sequelize']['ValidationError'](_0xb53e('0xc0'));}_0x452d1b=_0x18a2e2[_0xb53e('0x5d')]['to'];return db[_0xb53e('0x41')][_0xb53e('0x5b')]({'where':{'id':_0x18a2e2['params']['id']},'include':[{'model':db['CmList'],'as':_0xb53e('0xc1'),'include':[{'model':db['CmContact'],'as':_0xb53e('0xa4'),'where':{'mobile':_0x452d1b},'limit':0x1,'order':[[_0xb53e('0x91'),'DESC']]}]}]})[_0xb53e('0x20')](handleEntityNotFound(_0x3a4c3e,null))['then'](function(_0x32b813){if(_0x32b813&&_0x32b813[_0xb53e('0xc1')]){_0x5a2660=_0x32b813[_0xb53e('0x39')]({'plain':!![]});if(_0x5a2660[_0xb53e('0xc1')]&&_0x5a2660['List']['Contacts'][_0xb53e('0x4c')]){return _0x5a2660[_0xb53e('0xc1')][_0xb53e('0xa4')][0x0];}return db[_0xb53e('0x8d')][_0xb53e('0x5c')](_[_0xb53e('0xa6')](_0x18a2e2[_0xb53e('0x5d')],{'firstName':_0x452d1b,'mobile':_0x452d1b,'phone':_0x452d1b,'ListId':_0x5a2660['ListId']}));}})[_0xb53e('0x20')](handleEntityNotFound(_0x3a4c3e,null))[_0xb53e('0x20')](function(_0x3fe18a){if(_0x3fe18a){_0x26612a=_0x3fe18a;return db[_0xb53e('0xa8')][_0xb53e('0x5b')]({'where':{'ContactId':_0x26612a['id'],'closed':![],'WhatsappAccountId':_0x5a2660['id']}})[_0xb53e('0x20')](function(_0xaeab0d){if(_0xaeab0d){return[_0xaeab0d,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x18a2e2[_0xb53e('0x5e')]['id'],'ContactId':_0x26612a['id'],'WhatsappAccountId':_0x5a2660['id'],'phone':_0x452d1b,'firstMsgDirection':'out','Messages':[_[_0xb53e('0x53')](_0x18a2e2[_0xb53e('0x5d')],{'read':![],'body':_0x18a2e2[_0xb53e('0x5d')][_0xb53e('0x5d')],'phone':_0x452d1b,'WhatsappAccountId':_0x5a2660['id'],'UserId':_0x18a2e2[_0xb53e('0x5e')]['id'],'ContactId':_0x26612a['id']})]},{'include':[{'model':db[_0xb53e('0xaf')],'as':'Messages'}]})['then'](function(_0x121e18){return[_0x121e18,!![]];});});}})[_0xb53e('0x71')](function(_0x5c85cb,_0x398617){if(_0x398617){return _0x5c85cb;}return db[_0xb53e('0xaf')]['create'](_[_0xb53e('0x53')](_0x18a2e2['body'],{'read':![],'body':_0x18a2e2[_0xb53e('0x5d')][_0xb53e('0x5d')],'phone':_0x452d1b,'WhatsappAccountId':_0x5a2660['id'],'WhatsappInteractionId':_0x5c85cb['id'],'UserId':_0x18a2e2['user']['id'],'ContactId':_0x26612a['id']}))[_0xb53e('0x20')](function(_0x10143a){_0x5c85cb[_0xb53e('0xc2')][_0xb53e('0xc3')]=[];_0x5c85cb['dataValues']['Messages']['push'](_0x10143a['dataValues']);return _0x5c85cb;});})[_0xb53e('0x20')](respondWithResult(_0x3a4c3e,null))['catch'](handleError(_0x3a4c3e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f278f24..7545a2f 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 _0x4de1=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x30e2ba,_0x180fc4){var _0x170a1a=function(_0x9e15c9){while(--_0x9e15c9){_0x30e2ba['push'](_0x30e2ba['shift']());}};_0x170a1a(++_0x180fc4);}(_0x4de1,0x16d));var _0x14de=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x4de1[_0x541ea6];return _0x3c3e84;};'use strict';var EventEmitter=require(_0x14de('0x0'));var WhatsappAccount=require(_0x14de('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x14de('0x2')](0x0);var events={'afterCreate':_0x14de('0x3'),'afterUpdate':_0x14de('0x4'),'afterDestroy':_0x14de('0x5')};function emitEvent(_0x17c1f4){return function(_0x350ab8,_0x232dfd,_0x22857c){WhatsappAccountEvents['emit'](_0x17c1f4+':'+_0x350ab8['id'],_0x350ab8);WhatsappAccountEvents[_0x14de('0x6')](_0x17c1f4,_0x350ab8);_0x22857c(null);};}for(var e in events){if(events[_0x14de('0x7')](e)){var event=events[e];WhatsappAccount[_0x14de('0x8')](e,emitEvent(event));}}module[_0x14de('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xa4c8=['setMaxListeners','emit','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x3eaec3,_0x568227){var _0x3aba80=function(_0x1abea6){while(--_0x1abea6){_0x3eaec3['push'](_0x3eaec3['shift']());}};_0x3aba80(++_0x568227);}(_0xa4c8,0x6d));var _0x8a4c=function(_0x44b135,_0x3a5899){_0x44b135=_0x44b135-0x0;var _0x4cf6d1=_0xa4c8[_0x44b135];return _0x4cf6d1;};'use strict';var EventEmitter=require(_0x8a4c('0x0'));var WhatsappAccount=require(_0x8a4c('0x1'))['db'][_0x8a4c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8a4c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28fad9){return function(_0x159868,_0x2679da,_0xc92c77){WhatsappAccountEvents[_0x8a4c('0x4')](_0x28fad9+':'+_0x159868['id'],_0x159868);WhatsappAccountEvents['emit'](_0x28fad9,_0x159868);_0xc92c77(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x8a4c('0x5')](e,emitEvent(event));}}module[_0x8a4c('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 617e700..4613883 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 _0xd9c6=['api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xd9c6,0x6d));var _0x6d9c=function(_0x29d1da,_0x5a7a44){_0x29d1da=_0x29d1da-0x0;var _0x43e3f8=_0xd9c6[_0x29d1da];return _0x43e3f8;};'use strict';var _=require(_0x6d9c('0x0'));var util=require(_0x6d9c('0x1'));var logger=require(_0x6d9c('0x2'))(_0x6d9c('0x3'));var moment=require(_0x6d9c('0x4'));var BPromise=require(_0x6d9c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d9c('0x6'));var rimraf=require(_0x6d9c('0x7'));var config=require(_0x6d9c('0x8'));var attributes=require(_0x6d9c('0x9'));module[_0x6d9c('0xa')]=function(_0x1e2289,_0x359eff){return _0x1e2289[_0x6d9c('0xb')](_0x6d9c('0xc'),attributes,{'tableName':_0x6d9c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x220f=['exports','define','whatsapp_accounts','lodash','util','api','path','rimraf','./whatsappAccount.attributes'];(function(_0x23ec34,_0x50cebd){var _0x31ac68=function(_0x5e23b7){while(--_0x5e23b7){_0x23ec34['push'](_0x23ec34['shift']());}};_0x31ac68(++_0x50cebd);}(_0x220f,0x17d));var _0xf220=function(_0x4771f9,_0x11390b){_0x4771f9=_0x4771f9-0x0;var _0x194dd7=_0x220f[_0x4771f9];return _0x194dd7;};'use strict';var _=require(_0xf220('0x0'));var util=require(_0xf220('0x1'));var logger=require('../../config/logger')(_0xf220('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf220('0x3'));var rimraf=require(_0xf220('0x4'));var config=require('../../config/environment');var attributes=require(_0xf220('0x5'));module[_0xf220('0x6')]=function(_0x200856,_0x1e8169){return _0x200856[_0xf220('0x7')]('WhatsappAccount',attributes,{'tableName':_0xf220('0x8'),'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 7b13893..19b20bf 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 _0x0fda=['code','message','result','ShowWhatsappAccount','find','options','raw','where','attributes','include','model','map','debug','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x0fda,0x96));var _0xa0fd=function(_0x11f773,_0xb3f3fa){_0x11f773=_0x11f773-0x0;var _0x2c930c=_0x0fda[_0x11f773];return _0x2c930c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa0fd('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0fd('0x1'));var db=require(_0xa0fd('0x2'))['db'];var utils=require(_0xa0fd('0x3'));var logger=require(_0xa0fd('0x4'))('rpc');var config=require(_0xa0fd('0x5'));var jayson=require(_0xa0fd('0x6'));var client=jayson['client'][_0xa0fd('0x7')]({'port':0x232a});config[_0xa0fd('0x8')]=_[_0xa0fd('0x9')](config[_0xa0fd('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0fd('0xa'))(new Redis(config[_0xa0fd('0x8')]));require(_0xa0fd('0xb'))['register'](socket);function respondWithRpcPromise(_0x4376a5,_0x71955c,_0x1168b1){return new BPromise(function(_0x118e61,_0x5b4607){return client[_0xa0fd('0xc')](_0x4376a5,_0x1168b1)[_0xa0fd('0xd')](function(_0x3f07c8){logger[_0xa0fd('0xe')](_0xa0fd('0xf'),_0x71955c,_0xa0fd('0x10'));logger['debug'](_0xa0fd('0x11'),_0x71955c,_0xa0fd('0x10'),JSON[_0xa0fd('0x12')](_0x3f07c8));if(_0x3f07c8['error']){if(_0x3f07c8[_0xa0fd('0x13')][_0xa0fd('0x14')]===0x1f4){logger[_0xa0fd('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x71955c,_0x3f07c8[_0xa0fd('0x13')][_0xa0fd('0x15')]);return _0x5b4607(_0x3f07c8[_0xa0fd('0x13')]['message']);}logger[_0xa0fd('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x71955c,_0x3f07c8[_0xa0fd('0x13')][_0xa0fd('0x15')]);return _0x118e61(_0x3f07c8[_0xa0fd('0x13')]['message']);}else{logger['info'](_0xa0fd('0xf'),_0x71955c,_0xa0fd('0x10'));_0x118e61(_0x3f07c8[_0xa0fd('0x16')][_0xa0fd('0x15')]);}})['catch'](function(_0x5e47bd){logger[_0xa0fd('0x13')](_0xa0fd('0xf'),_0x71955c,_0x5e47bd);_0x5b4607(_0x5e47bd);});});}exports[_0xa0fd('0x17')]=function(_0x402e75){var _0x13912e=this;return new Promise(function(_0x5c9bd5,_0x1cca79){return db['WhatsappAccount'][_0xa0fd('0x18')]({'raw':_0x402e75['options']?_0x402e75[_0xa0fd('0x19')][_0xa0fd('0x1a')]===undefined?!![]:![]:!![],'where':_0x402e75[_0xa0fd('0x19')]?_0x402e75['options'][_0xa0fd('0x1b')]||null:null,'attributes':_0x402e75[_0xa0fd('0x19')]?_0x402e75[_0xa0fd('0x19')][_0xa0fd('0x1c')]||null:null,'include':_0x402e75['options']?_0x402e75[_0xa0fd('0x19')][_0xa0fd('0x1d')]?_['map'](_0x402e75[_0xa0fd('0x19')][_0xa0fd('0x1d')],function(_0x486c9b){return{'model':db[_0x486c9b[_0xa0fd('0x1e')]],'as':_0x486c9b['as'],'attributes':_0x486c9b[_0xa0fd('0x1c')],'include':_0x486c9b[_0xa0fd('0x1d')]?_[_0xa0fd('0x1f')](_0x486c9b[_0xa0fd('0x1d')],function(_0x562ddc){return{'model':db[_0x562ddc[_0xa0fd('0x1e')]],'as':_0x562ddc['as'],'attributes':_0x562ddc['attributes'],'include':_0x562ddc[_0xa0fd('0x1d')]?_['map'](_0x562ddc[_0xa0fd('0x1d')],function(_0x208336){return{'model':db[_0x208336['model']],'as':_0x208336['as'],'attributes':_0x208336['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0fd('0xd')](function(_0x4a7c39){logger['info'](_0xa0fd('0x17'),_0x402e75);logger[_0xa0fd('0x20')]('ShowWhatsappAccount',_0x402e75,JSON[_0xa0fd('0x12')](_0x4a7c39));_0x5c9bd5(_0x4a7c39);})[_0xa0fd('0x21')](function(_0x1a8820){logger[_0xa0fd('0x13')](_0xa0fd('0x17'),_0x1a8820[_0xa0fd('0x15')],_0x402e75);_0x1cca79(_0x13912e[_0xa0fd('0x13')](0x1f4,_0x1a8820[_0xa0fd('0x15')]));});});}; \ No newline at end of file +var _0x3563=['include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes'];(function(_0x1c28ea,_0xf41885){var _0x3674cd=function(_0x2e3085){while(--_0x2e3085){_0x1c28ea['push'](_0x1c28ea['shift']());}};_0x3674cd(++_0xf41885);}(_0x3563,0x159));var _0x3356=function(_0x160212,_0x1594ce){_0x160212=_0x160212-0x0;var _0x5e8d2f=_0x3563[_0x160212];return _0x5e8d2f;};'use strict';var _=require(_0x3356('0x0'));var util=require(_0x3356('0x1'));var moment=require(_0x3356('0x2'));var BPromise=require(_0x3356('0x3'));var rs=require(_0x3356('0x4'));var fs=require('fs');var Redis=require(_0x3356('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3356('0x6'));var logger=require(_0x3356('0x7'))(_0x3356('0x8'));var config=require(_0x3356('0x9'));var jayson=require(_0x3356('0xa'));var client=jayson[_0x3356('0xb')]['http']({'port':0x232a});config[_0x3356('0xc')]=_[_0x3356('0xd')](config['redis'],{'host':_0x3356('0xe'),'port':0x18eb});var socket=require(_0x3356('0xf'))(new Redis(config[_0x3356('0xc')]));require(_0x3356('0x10'))['register'](socket);function respondWithRpcPromise(_0x5950c8,_0x1ce952,_0x3c2055){return new BPromise(function(_0x3e2dd2,_0x195b7f){return client['request'](_0x5950c8,_0x3c2055)[_0x3356('0x11')](function(_0x59089d){logger['info'](_0x3356('0x12'),_0x1ce952,_0x3356('0x13'));logger[_0x3356('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1ce952,'request\x20sent',JSON[_0x3356('0x15')](_0x59089d));if(_0x59089d[_0x3356('0x16')]){if(_0x59089d[_0x3356('0x16')][_0x3356('0x17')]===0x1f4){logger[_0x3356('0x16')](_0x3356('0x12'),_0x1ce952,_0x59089d[_0x3356('0x16')][_0x3356('0x18')]);return _0x195b7f(_0x59089d[_0x3356('0x16')][_0x3356('0x18')]);}logger[_0x3356('0x16')](_0x3356('0x12'),_0x1ce952,_0x59089d[_0x3356('0x16')][_0x3356('0x18')]);return _0x3e2dd2(_0x59089d[_0x3356('0x16')]['message']);}else{logger[_0x3356('0x19')](_0x3356('0x12'),_0x1ce952,_0x3356('0x13'));_0x3e2dd2(_0x59089d[_0x3356('0x1a')][_0x3356('0x18')]);}})[_0x3356('0x1b')](function(_0x1bdb72){logger[_0x3356('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x1ce952,_0x1bdb72);_0x195b7f(_0x1bdb72);});});}exports[_0x3356('0x1c')]=function(_0x48fac){var _0x422c2d=this;return new Promise(function(_0x109bc2,_0x2e34af){return db[_0x3356('0x1d')][_0x3356('0x1e')]({'raw':_0x48fac[_0x3356('0x1f')]?_0x48fac[_0x3356('0x1f')][_0x3356('0x20')]===undefined?!![]:![]:!![],'where':_0x48fac[_0x3356('0x1f')]?_0x48fac[_0x3356('0x1f')][_0x3356('0x21')]||null:null,'attributes':_0x48fac['options']?_0x48fac[_0x3356('0x1f')][_0x3356('0x22')]||null:null,'include':_0x48fac['options']?_0x48fac[_0x3356('0x1f')][_0x3356('0x23')]?_[_0x3356('0x24')](_0x48fac[_0x3356('0x1f')][_0x3356('0x23')],function(_0x2fe02d){return{'model':db[_0x2fe02d[_0x3356('0x25')]],'as':_0x2fe02d['as'],'attributes':_0x2fe02d[_0x3356('0x22')],'include':_0x2fe02d['include']?_[_0x3356('0x24')](_0x2fe02d['include'],function(_0x476161){return{'model':db[_0x476161[_0x3356('0x25')]],'as':_0x476161['as'],'attributes':_0x476161[_0x3356('0x22')],'include':_0x476161[_0x3356('0x23')]?_[_0x3356('0x24')](_0x476161[_0x3356('0x23')],function(_0x50ddab){return{'model':db[_0x50ddab['model']],'as':_0x50ddab['as'],'attributes':_0x50ddab[_0x3356('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3356('0x11')](function(_0x418dae){logger['info'](_0x3356('0x1c'),_0x48fac);logger[_0x3356('0x14')](_0x3356('0x1c'),_0x48fac,JSON[_0x3356('0x15')](_0x418dae));_0x109bc2(_0x418dae);})[_0x3356('0x1b')](function(_0x2a8a2b){logger['error'](_0x3356('0x1c'),_0x2a8a2b[_0x3356('0x18')],_0x48fac);_0x2e34af(_0x422c2d[_0x3356('0x16')](0x1f4,_0x2a8a2b[_0x3356('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7618976..a7f3f0d 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 _0x819a=['removeListener','length','whatsappAccount:','save','update'];(function(_0x192d08,_0x3d1307){var _0x2fdbce=function(_0x28225a){while(--_0x28225a){_0x192d08['push'](_0x192d08['shift']());}};_0x2fdbce(++_0x3d1307);}(_0x819a,0x12f));var _0xa819=function(_0x2b1a36,_0x52eecd){_0x2b1a36=_0x2b1a36-0x0;var _0x2e03ca=_0x819a[_0x2b1a36];return _0x2e03ca;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xa819('0x0'),'remove',_0xa819('0x1')];function createListener(_0x286218,_0x522148){return function(_0x4a2da9){_0x522148['emit'](_0x286218,_0x4a2da9);};}function removeListener(_0x1cf20f,_0x4a31ab){return function(){WhatsappAccountEvents[_0xa819('0x2')](_0x1cf20f,_0x4a31ab);};}exports['register']=function(_0x557200){for(var _0x4b7639=0x0,_0x451219=events[_0xa819('0x3')];_0x4b7639<_0x451219;_0x4b7639++){var _0x3c7bae=events[_0x4b7639];var _0x240423=createListener(_0xa819('0x4')+_0x3c7bae,_0x557200);WhatsappAccountEvents['on'](_0x3c7bae,_0x240423);}}; \ No newline at end of file +var _0x2846=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','removeListener','register'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x2846,0x1b2));var _0x6284=function(_0x1535cc,_0xf0242c){_0x1535cc=_0x1535cc-0x0;var _0x187330=_0x2846[_0x1535cc];return _0x187330;};'use strict';var WhatsappAccountEvents=require(_0x6284('0x0'));var events=[_0x6284('0x1'),_0x6284('0x2'),_0x6284('0x3')];function createListener(_0x1e9c2f,_0x1a5e6f){return function(_0x494207){_0x1a5e6f['emit'](_0x1e9c2f,_0x494207);};}function removeListener(_0x1becd7,_0x108579){return function(){WhatsappAccountEvents[_0x6284('0x4')](_0x1becd7,_0x108579);};}exports[_0x6284('0x5')]=function(_0x489cbf){for(var _0x3996d8=0x0,_0x33a2ca=events[_0x6284('0x6')];_0x3996d8<_0x33a2ca;_0x3996d8++){var _0x5ccd6c=events[_0x3996d8];var _0xad1ddd=createListener(_0x6284('0x7')+_0x5ccd6c,_0x489cbf);WhatsappAccountEvents['on'](_0x5ccd6c,_0xad1ddd);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 4321ae5..9bffe91 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 _0x4c22=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','/:id','show','put','update','delete','destroy'];(function(_0x4ae6ef,_0x5a0f69){var _0x3ec8a6=function(_0x594062){while(--_0x594062){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3ec8a6(++_0x5a0f69);}(_0x4c22,0xc7));var _0x24c2=function(_0x56a8a9,_0x43c9b8){_0x56a8a9=_0x56a8a9-0x0;var _0x45d13d=_0x4c22[_0x56a8a9];return _0x45d13d;};'use strict';var multer=require('multer');var util=require(_0x24c2('0x0'));var path=require(_0x24c2('0x1'));var timeout=require(_0x24c2('0x2'));var express=require(_0x24c2('0x3'));var router=express[_0x24c2('0x4')]();var fs_extra=require(_0x24c2('0x5'));var auth=require(_0x24c2('0x6'));var interaction=require(_0x24c2('0x7'));var config=require('../../config/environment');var controller=require(_0x24c2('0x8'));router[_0x24c2('0x9')]('/',auth[_0x24c2('0xa')](),controller['index']);router[_0x24c2('0x9')](_0x24c2('0xb'),auth[_0x24c2('0xa')](),controller[_0x24c2('0xc')]);router['post']('/',auth[_0x24c2('0xa')](),controller['create']);router[_0x24c2('0xd')](_0x24c2('0xb'),auth[_0x24c2('0xa')](),controller[_0x24c2('0xe')]);router[_0x24c2('0xf')](_0x24c2('0xb'),auth[_0x24c2('0xa')](),controller[_0x24c2('0x10')]);module[_0x24c2('0x11')]=router; \ No newline at end of file +var _0xc1c5=['/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','./whatsappApplication.controller','get','isAuthenticated','index'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xc1c5,0x157));var _0x5c1c=function(_0x540004,_0x57689f){_0x540004=_0x540004-0x0;var _0x190d07=_0xc1c5[_0x540004];return _0x190d07;};'use strict';var multer=require(_0x5c1c('0x0'));var util=require(_0x5c1c('0x1'));var path=require(_0x5c1c('0x2'));var timeout=require(_0x5c1c('0x3'));var express=require(_0x5c1c('0x4'));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(_0x5c1c('0x5'));router[_0x5c1c('0x6')]('/',auth[_0x5c1c('0x7')](),controller[_0x5c1c('0x8')]);router[_0x5c1c('0x6')](_0x5c1c('0x9'),auth[_0x5c1c('0x7')](),controller['show']);router[_0x5c1c('0xa')]('/',auth[_0x5c1c('0x7')](),controller[_0x5c1c('0xb')]);router[_0x5c1c('0xc')](_0x5c1c('0x9'),auth[_0x5c1c('0x7')](),controller[_0x5c1c('0xd')]);router[_0x5c1c('0xe')](_0x5c1c('0x9'),auth[_0x5c1c('0x7')](),controller[_0x5c1c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 7c40d1e..b461ebd 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 _0xf795=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0x594883,_0x2ac028){var _0x183662=function(_0x2d1ae7){while(--_0x2d1ae7){_0x594883['push'](_0x594883['shift']());}};_0x183662(++_0x2ac028);}(_0xf795,0x106));var _0x5f79=function(_0xb08792,_0x298252){_0xb08792=_0xb08792-0x0;var _0x2d9992=_0xf795[_0xb08792];return _0x2d9992;};'use strict';var Sequelize=require('sequelize');module[_0x5f79('0x0')]={'priority':{'type':Sequelize[_0x5f79('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5f79('0x2')],'allowNull':![],'defaultValue':_0x5f79('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5f79('0x2')],'defaultValue':_0x5f79('0x4')}}; \ No newline at end of file +var _0xcd5e=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x2fd844,_0x4520c2){var _0x423dc7=function(_0x351d5e){while(--_0x351d5e){_0x2fd844['push'](_0x2fd844['shift']());}};_0x423dc7(++_0x4520c2);}(_0xcd5e,0x1db));var _0xecd5=function(_0x4ef330,_0x5c1e1b){_0x4ef330=_0x4ef330-0x0;var _0x4129de=_0xcd5e[_0x4ef330];return _0x4129de;};'use strict';var Sequelize=require(_0xecd5('0x0'));module[_0xecd5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xecd5('0x2')],'allowNull':![],'defaultValue':_0xecd5('0x3')},'appdata':{'type':Sequelize[_0xecd5('0x4')]()},'description':{'type':Sequelize[_0xecd5('0x2')]},'interval':{'type':Sequelize[_0xecd5('0x2')],'defaultValue':_0xecd5('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 5ed3134..cab0352 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 _0xd08d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','update','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xe64f5f,_0x2b9afa){var _0x5ab35d=function(_0x17a3fa){while(--_0x17a3fa){_0xe64f5f['push'](_0xe64f5f['shift']());}};_0x5ab35d(++_0x2b9afa);}(_0xd08d,0x81));var _0xdd08=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xd08d[_0x4bb581];return _0x316bf5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd08('0x0'));var zipdir=require(_0xdd08('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd08('0x2'));var moment=require(_0xdd08('0x3'));var BPromise=require(_0xdd08('0x4'));var Mustache=require('mustache');var util=require(_0xdd08('0x5'));var path=require(_0xdd08('0x6'));var sox=require(_0xdd08('0x7'));var csv=require('to-csv');var ejs=require(_0xdd08('0x8'));var fs=require('fs');var fs_extra=require(_0xdd08('0x9'));var _=require(_0xdd08('0xa'));var squel=require(_0xdd08('0xb'));var crypto=require(_0xdd08('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdd08('0xd'));var toCsv=require(_0xdd08('0xe'));var querystring=require(_0xdd08('0xf'));var Papa=require('papaparse');var Redis=require(_0xdd08('0x10'));var authService=require(_0xdd08('0x11'));var qs=require(_0xdd08('0x12'));var as=require(_0xdd08('0x13'));var hardwareService=require(_0xdd08('0x14'));var logger=require(_0xdd08('0x15'))(_0xdd08('0x16'));var utils=require(_0xdd08('0x17'));var config=require(_0xdd08('0x18'));var licenseUtil=require(_0xdd08('0x19'));var db=require(_0xdd08('0x1a'))['db'];function respondWithStatusCode(_0x1543c8,_0x4bf79b){_0x4bf79b=_0x4bf79b||0xcc;return function(_0x2ef721){if(_0x2ef721){return _0x1543c8[_0xdd08('0x1b')](_0x4bf79b);}return _0x1543c8[_0xdd08('0x1c')](_0x4bf79b)[_0xdd08('0x1d')]();};}function respondWithResult(_0x415169,_0x3ed0d1){_0x3ed0d1=_0x3ed0d1||0xc8;return function(_0x32a6d5){if(_0x32a6d5){return _0x415169[_0xdd08('0x1c')](_0x3ed0d1)[_0xdd08('0x1e')](_0x32a6d5);}};}function respondWithFilteredResult(_0x11aad3,_0x2fc29c){return function(_0x9a6225){if(_0x9a6225){var _0x784541=typeof _0x2fc29c[_0xdd08('0x1f')]===_0xdd08('0x20')&&typeof _0x2fc29c[_0xdd08('0x21')]===_0xdd08('0x20');var _0x46a36f=_0x9a6225[_0xdd08('0x22')];var _0x212100=_0x784541?0x0:_0x2fc29c[_0xdd08('0x1f')];var _0x562b83=_0x784541?_0x9a6225['count']:_0x2fc29c[_0xdd08('0x1f')]+_0x2fc29c[_0xdd08('0x21')];var _0x4d815e;if(_0x562b83>=_0x46a36f){_0x562b83=_0x46a36f;_0x4d815e=0xc8;}else{_0x4d815e=0xce;}_0x11aad3['status'](_0x4d815e);return _0x11aad3['set'](_0xdd08('0x23'),_0x212100+'-'+_0x562b83+'/'+_0x46a36f)[_0xdd08('0x1e')](_0x9a6225);}return null;};}function patchUpdates(_0x1cfc12){return function(_0x4a587b){try{jsonpatch[_0xdd08('0x24')](_0x4a587b,_0x1cfc12,!![]);}catch(_0x39bb81){return BPromise[_0xdd08('0x25')](_0x39bb81);}return _0x4a587b[_0xdd08('0x26')]();};}function saveUpdates(_0x5c9ebe,_0x4f807b){return function(_0x1ef21d){if(_0x1ef21d){return _0x1ef21d['update'](_0x5c9ebe)[_0xdd08('0x27')](function(_0x33f10c){return _0x33f10c;});}return null;};}function removeEntity(_0x5f0166,_0x4b1be1){return function(_0x2f3361){if(_0x2f3361){return _0x2f3361[_0xdd08('0x28')]()['then'](function(){_0x5f0166[_0xdd08('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e84d6,_0x3aeffc){return function(_0x4e677d){if(!_0x4e677d){_0x1e84d6[_0xdd08('0x1b')](0x194);}return _0x4e677d;};}function handleError(_0x281ae6,_0x169796){_0x169796=_0x169796||0x1f4;return function(_0x5a8a84){logger['error'](_0x5a8a84[_0xdd08('0x29')]);if(_0x5a8a84[_0xdd08('0x2a')]){delete _0x5a8a84[_0xdd08('0x2a')];}_0x281ae6[_0xdd08('0x1c')](_0x169796)[_0xdd08('0x2b')](_0x5a8a84);};}exports[_0xdd08('0x2c')]=function(_0x566f1e,_0x4956b4){var _0x2aaf75={},_0xbed010={},_0x1639e4={'count':0x0,'rows':[]};var _0x364a64=_[_0xdd08('0x2d')](db[_0xdd08('0x2e')][_0xdd08('0x2f')],function(_0x5d99d6){return{'name':_0x5d99d6[_0xdd08('0x30')],'type':_0x5d99d6[_0xdd08('0x31')][_0xdd08('0x32')]};});_0xbed010[_0xdd08('0x33')]=_[_0xdd08('0x2d')](_0x364a64,_0xdd08('0x2a'));_0xbed010[_0xdd08('0x34')]=_[_0xdd08('0x35')](_0x566f1e['query']);_0xbed010['filters']=_[_0xdd08('0x36')](_0xbed010[_0xdd08('0x33')],_0xbed010[_0xdd08('0x34')]);_0x2aaf75['attributes']=_['intersection'](_0xbed010[_0xdd08('0x33')],qs[_0xdd08('0x37')](_0x566f1e[_0xdd08('0x34')][_0xdd08('0x37')]));_0x2aaf75[_0xdd08('0x38')]=_0x2aaf75[_0xdd08('0x38')][_0xdd08('0x39')]?_0x2aaf75['attributes']:_0xbed010[_0xdd08('0x33')];if(!_0x566f1e[_0xdd08('0x34')][_0xdd08('0x3a')](_0xdd08('0x3b'))){_0x2aaf75[_0xdd08('0x21')]=qs[_0xdd08('0x21')](_0x566f1e[_0xdd08('0x34')]['limit']);_0x2aaf75[_0xdd08('0x1f')]=qs['offset'](_0x566f1e['query']['offset']);}_0x2aaf75[_0xdd08('0x3c')]=qs['sort'](_0x566f1e[_0xdd08('0x34')][_0xdd08('0x3d')]);_0x2aaf75[_0xdd08('0x3e')]=qs['filters'](_[_0xdd08('0x3f')](_0x566f1e['query'],_0xbed010[_0xdd08('0x40')]),_0x364a64);if(_0x566f1e['query'][_0xdd08('0x41')]){_0x2aaf75[_0xdd08('0x3e')]=_[_0xdd08('0x42')](_0x2aaf75[_0xdd08('0x3e')],{'$or':_[_0xdd08('0x2d')](_0x364a64,function(_0x474bc6){if(_0x474bc6['type']!==_0xdd08('0x43')){var _0x1e0573={};_0x1e0573[_0x474bc6[_0xdd08('0x2a')]]={'$like':'%'+_0x566f1e['query']['filter']+'%'};return _0x1e0573;}})});}_0x2aaf75=_[_0xdd08('0x42')]({},_0x2aaf75,_0x566f1e[_0xdd08('0x44')]);var _0x59f1ef={'where':_0x2aaf75['where']};return db['WhatsappApplication'][_0xdd08('0x22')](_0x59f1ef)[_0xdd08('0x27')](function(_0x5978f1){_0x1639e4[_0xdd08('0x22')]=_0x5978f1;if(_0x566f1e[_0xdd08('0x34')]['includeAll']){_0x2aaf75[_0xdd08('0x45')]=[{'all':!![]}];}return db[_0xdd08('0x2e')]['findAll'](_0x2aaf75);})[_0xdd08('0x27')](function(_0x58f39e){_0x1639e4['rows']=_0x58f39e;return _0x1639e4;})['then'](respondWithFilteredResult(_0x4956b4,_0x2aaf75))[_0xdd08('0x46')](handleError(_0x4956b4,null));};exports[_0xdd08('0x47')]=function(_0x1d0a9b,_0x246f94){var _0x43c78e={'raw':!![],'where':{'id':_0x1d0a9b[_0xdd08('0x48')]['id']}},_0x55d883={};_0x55d883[_0xdd08('0x33')]=_['keys'](db[_0xdd08('0x2e')][_0xdd08('0x2f')]);_0x55d883['query']=_[_0xdd08('0x35')](_0x1d0a9b[_0xdd08('0x34')]);_0x55d883[_0xdd08('0x40')]=_[_0xdd08('0x36')](_0x55d883[_0xdd08('0x33')],_0x55d883['query']);_0x43c78e['attributes']=_[_0xdd08('0x36')](_0x55d883[_0xdd08('0x33')],qs[_0xdd08('0x37')](_0x1d0a9b[_0xdd08('0x34')]['fields']));_0x43c78e[_0xdd08('0x38')]=_0x43c78e[_0xdd08('0x38')][_0xdd08('0x39')]?_0x43c78e[_0xdd08('0x38')]:_0x55d883[_0xdd08('0x33')];if(_0x1d0a9b[_0xdd08('0x34')][_0xdd08('0x49')]){_0x43c78e[_0xdd08('0x45')]=[{'all':!![]}];}_0x43c78e=_[_0xdd08('0x42')]({},_0x43c78e,_0x1d0a9b['options']);return db[_0xdd08('0x2e')][_0xdd08('0x4a')](_0x43c78e)[_0xdd08('0x27')](handleEntityNotFound(_0x246f94,null))['then'](respondWithResult(_0x246f94,null))[_0xdd08('0x46')](handleError(_0x246f94,null));};exports['create']=function(_0x125b5a,_0x590543){return db['WhatsappApplication']['create'](_0x125b5a['body'],{})[_0xdd08('0x27')](respondWithResult(_0x590543,0xc9))[_0xdd08('0x46')](handleError(_0x590543,null));};exports[_0xdd08('0x4b')]=function(_0x3351be,_0x58b8f4){if(_0x3351be[_0xdd08('0x4c')]['id']){delete _0x3351be['body']['id'];}return db[_0xdd08('0x2e')][_0xdd08('0x4a')]({'where':{'id':_0x3351be[_0xdd08('0x48')]['id']}})[_0xdd08('0x27')](handleEntityNotFound(_0x58b8f4,null))[_0xdd08('0x27')](saveUpdates(_0x3351be[_0xdd08('0x4c')],null))['then'](respondWithResult(_0x58b8f4,null))[_0xdd08('0x46')](handleError(_0x58b8f4,null));};exports[_0xdd08('0x28')]=function(_0x350614,_0x3b27fd){return db[_0xdd08('0x2e')]['find']({'where':{'id':_0x350614['params']['id']}})[_0xdd08('0x27')](handleEntityNotFound(_0x3b27fd,null))['then'](removeEntity(_0x3b27fd,null))[_0xdd08('0x46')](handleError(_0x3b27fd,null));}; \ No newline at end of file +var _0x50e5=['map','WhatsappApplication','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','error','stack','name','index'];(function(_0xb9cd01,_0x3bd12e){var _0x1530fb=function(_0x43ee36){while(--_0x43ee36){_0xb9cd01['push'](_0xb9cd01['shift']());}};_0x1530fb(++_0x3bd12e);}(_0x50e5,0xb7));var _0x550e=function(_0x1304b3,_0x5bb5f5){_0x1304b3=_0x1304b3-0x0;var _0x45ce34=_0x50e5[_0x1304b3];return _0x45ce34;};'use strict';var emlformat=require(_0x550e('0x0'));var rimraf=require(_0x550e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x550e('0x2'));var rp=require(_0x550e('0x3'));var moment=require(_0x550e('0x4'));var BPromise=require(_0x550e('0x5'));var Mustache=require(_0x550e('0x6'));var util=require(_0x550e('0x7'));var path=require(_0x550e('0x8'));var sox=require(_0x550e('0x9'));var csv=require(_0x550e('0xa'));var ejs=require(_0x550e('0xb'));var fs=require('fs');var fs_extra=require(_0x550e('0xc'));var _=require(_0x550e('0xd'));var squel=require('squel');var crypto=require(_0x550e('0xe'));var jsforce=require(_0x550e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x550e('0xa'));var querystring=require(_0x550e('0x10'));var Papa=require(_0x550e('0x11'));var Redis=require('ioredis');var authService=require(_0x550e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x550e('0x13'));var logger=require(_0x550e('0x14'))('api');var utils=require(_0x550e('0x15'));var config=require(_0x550e('0x16'));var licenseUtil=require(_0x550e('0x17'));var db=require(_0x550e('0x18'))['db'];function respondWithStatusCode(_0x518cad,_0x335cba){_0x335cba=_0x335cba||0xcc;return function(_0x57214a){if(_0x57214a){return _0x518cad[_0x550e('0x19')](_0x335cba);}return _0x518cad['status'](_0x335cba)[_0x550e('0x1a')]();};}function respondWithResult(_0x4c6070,_0x393055){_0x393055=_0x393055||0xc8;return function(_0x2d4b79){if(_0x2d4b79){return _0x4c6070[_0x550e('0x1b')](_0x393055)['json'](_0x2d4b79);}};}function respondWithFilteredResult(_0x302be0,_0x49787c){return function(_0xf28ba7){if(_0xf28ba7){var _0x49474f=typeof _0x49787c['offset']===_0x550e('0x1c')&&typeof _0x49787c[_0x550e('0x1d')]==='undefined';var _0x4e49bf=_0xf28ba7['count'];var _0x22c264=_0x49474f?0x0:_0x49787c['offset'];var _0x580c6f=_0x49474f?_0xf28ba7[_0x550e('0x1e')]:_0x49787c[_0x550e('0x1f')]+_0x49787c[_0x550e('0x1d')];var _0x846ad;if(_0x580c6f>=_0x4e49bf){_0x580c6f=_0x4e49bf;_0x846ad=0xc8;}else{_0x846ad=0xce;}_0x302be0[_0x550e('0x1b')](_0x846ad);return _0x302be0[_0x550e('0x20')](_0x550e('0x21'),_0x22c264+'-'+_0x580c6f+'/'+_0x4e49bf)[_0x550e('0x22')](_0xf28ba7);}return null;};}function patchUpdates(_0x1b9799){return function(_0x47e6e1){try{jsonpatch[_0x550e('0x23')](_0x47e6e1,_0x1b9799,!![]);}catch(_0x106c68){return BPromise['reject'](_0x106c68);}return _0x47e6e1['save']();};}function saveUpdates(_0x3e9822,_0x2663c7){return function(_0x5769bb){if(_0x5769bb){return _0x5769bb[_0x550e('0x24')](_0x3e9822)[_0x550e('0x25')](function(_0x1762c3){return _0x1762c3;});}return null;};}function removeEntity(_0x317249,_0x3aa1b8){return function(_0x3bbca3){if(_0x3bbca3){return _0x3bbca3['destroy']()[_0x550e('0x25')](function(){_0x317249[_0x550e('0x1b')](0xcc)[_0x550e('0x1a')]();});}};}function handleEntityNotFound(_0x2d10f3,_0x403391){return function(_0xc94de2){if(!_0xc94de2){_0x2d10f3[_0x550e('0x19')](0x194);}return _0xc94de2;};}function handleError(_0x111161,_0x13ca4e){_0x13ca4e=_0x13ca4e||0x1f4;return function(_0x136beb){logger[_0x550e('0x26')](_0x136beb[_0x550e('0x27')]);if(_0x136beb['name']){delete _0x136beb[_0x550e('0x28')];}_0x111161[_0x550e('0x1b')](_0x13ca4e)['send'](_0x136beb);};}exports[_0x550e('0x29')]=function(_0x78f04c,_0x7ae242){var _0x33bc32={},_0x1a4caa={},_0x403472={'count':0x0,'rows':[]};var _0x449da3=_[_0x550e('0x2a')](db[_0x550e('0x2b')][_0x550e('0x2c')],function(_0x25c40a){return{'name':_0x25c40a[_0x550e('0x2d')],'type':_0x25c40a[_0x550e('0x2e')][_0x550e('0x2f')]};});_0x1a4caa['model']=_[_0x550e('0x2a')](_0x449da3,_0x550e('0x28'));_0x1a4caa['query']=_[_0x550e('0x30')](_0x78f04c[_0x550e('0x31')]);_0x1a4caa['filters']=_[_0x550e('0x32')](_0x1a4caa[_0x550e('0x33')],_0x1a4caa[_0x550e('0x31')]);_0x33bc32[_0x550e('0x34')]=_[_0x550e('0x32')](_0x1a4caa[_0x550e('0x33')],qs[_0x550e('0x35')](_0x78f04c[_0x550e('0x31')]['fields']));_0x33bc32[_0x550e('0x34')]=_0x33bc32['attributes'][_0x550e('0x36')]?_0x33bc32[_0x550e('0x34')]:_0x1a4caa['model'];if(!_0x78f04c[_0x550e('0x31')][_0x550e('0x37')]('nolimit')){_0x33bc32['limit']=qs['limit'](_0x78f04c['query'][_0x550e('0x1d')]);_0x33bc32[_0x550e('0x1f')]=qs[_0x550e('0x1f')](_0x78f04c['query']['offset']);}_0x33bc32['order']=qs[_0x550e('0x38')](_0x78f04c[_0x550e('0x31')]['sort']);_0x33bc32['where']=qs['filters'](_[_0x550e('0x39')](_0x78f04c[_0x550e('0x31')],_0x1a4caa[_0x550e('0x3a')]),_0x449da3);if(_0x78f04c['query']['filter']){_0x33bc32[_0x550e('0x3b')]=_[_0x550e('0x3c')](_0x33bc32[_0x550e('0x3b')],{'$or':_[_0x550e('0x2a')](_0x449da3,function(_0x4f4671){if(_0x4f4671[_0x550e('0x2e')]!==_0x550e('0x3d')){var _0x4cfde4={};_0x4cfde4[_0x4f4671['name']]={'$like':'%'+_0x78f04c[_0x550e('0x31')][_0x550e('0x3e')]+'%'};return _0x4cfde4;}})});}_0x33bc32=_[_0x550e('0x3c')]({},_0x33bc32,_0x78f04c[_0x550e('0x3f')]);var _0x5badca={'where':_0x33bc32[_0x550e('0x3b')]};return db[_0x550e('0x2b')][_0x550e('0x1e')](_0x5badca)[_0x550e('0x25')](function(_0x4d7297){_0x403472[_0x550e('0x1e')]=_0x4d7297;if(_0x78f04c[_0x550e('0x31')][_0x550e('0x40')]){_0x33bc32[_0x550e('0x41')]=[{'all':!![]}];}return db[_0x550e('0x2b')][_0x550e('0x42')](_0x33bc32);})['then'](function(_0x2f8cf5){_0x403472[_0x550e('0x43')]=_0x2f8cf5;return _0x403472;})[_0x550e('0x25')](respondWithFilteredResult(_0x7ae242,_0x33bc32))[_0x550e('0x44')](handleError(_0x7ae242,null));};exports[_0x550e('0x45')]=function(_0x4af549,_0x10f18f){var _0x2db9c9={'raw':!![],'where':{'id':_0x4af549[_0x550e('0x46')]['id']}},_0x5ca5fc={};_0x5ca5fc[_0x550e('0x33')]=_[_0x550e('0x30')](db['WhatsappApplication']['rawAttributes']);_0x5ca5fc[_0x550e('0x31')]=_[_0x550e('0x30')](_0x4af549['query']);_0x5ca5fc[_0x550e('0x3a')]=_[_0x550e('0x32')](_0x5ca5fc['model'],_0x5ca5fc[_0x550e('0x31')]);_0x2db9c9[_0x550e('0x34')]=_[_0x550e('0x32')](_0x5ca5fc[_0x550e('0x33')],qs[_0x550e('0x35')](_0x4af549[_0x550e('0x31')]['fields']));_0x2db9c9[_0x550e('0x34')]=_0x2db9c9['attributes'][_0x550e('0x36')]?_0x2db9c9[_0x550e('0x34')]:_0x5ca5fc['model'];if(_0x4af549[_0x550e('0x31')][_0x550e('0x40')]){_0x2db9c9[_0x550e('0x41')]=[{'all':!![]}];}_0x2db9c9=_[_0x550e('0x3c')]({},_0x2db9c9,_0x4af549[_0x550e('0x3f')]);return db[_0x550e('0x2b')]['find'](_0x2db9c9)[_0x550e('0x25')](handleEntityNotFound(_0x10f18f,null))[_0x550e('0x25')](respondWithResult(_0x10f18f,null))[_0x550e('0x44')](handleError(_0x10f18f,null));};exports[_0x550e('0x47')]=function(_0x5a9ef5,_0xbfd031){return db[_0x550e('0x2b')][_0x550e('0x47')](_0x5a9ef5[_0x550e('0x48')],{})[_0x550e('0x25')](respondWithResult(_0xbfd031,0xc9))[_0x550e('0x44')](handleError(_0xbfd031,null));};exports[_0x550e('0x24')]=function(_0xfbad1e,_0x2d233b){if(_0xfbad1e[_0x550e('0x48')]['id']){delete _0xfbad1e[_0x550e('0x48')]['id'];}return db[_0x550e('0x2b')][_0x550e('0x49')]({'where':{'id':_0xfbad1e[_0x550e('0x46')]['id']}})[_0x550e('0x25')](handleEntityNotFound(_0x2d233b,null))[_0x550e('0x25')](saveUpdates(_0xfbad1e[_0x550e('0x48')],null))['then'](respondWithResult(_0x2d233b,null))[_0x550e('0x44')](handleError(_0x2d233b,null));};exports[_0x550e('0x4a')]=function(_0x22dc07,_0x264c4d){return db[_0x550e('0x2b')][_0x550e('0x49')]({'where':{'id':_0x22dc07[_0x550e('0x46')]['id']}})['then'](handleEntityNotFound(_0x264c4d,null))[_0x550e('0x25')](removeEntity(_0x264c4d,null))[_0x550e('0x44')](handleError(_0x264c4d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 4e4e58e..e9731e3 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc73e=['util','api','moment','rimraf','../../config/environment','exports','define','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x4dc70f,_0xdb2c2e){var _0xca2ed0=function(_0x1ec3c5){while(--_0x1ec3c5){_0x4dc70f['push'](_0x4dc70f['shift']());}};_0xca2ed0(++_0xdb2c2e);}(_0xc73e,0x1e9));var _0xec73=function(_0xe45954,_0x4a78b2){_0xe45954=_0xe45954-0x0;var _0x46254c=_0xc73e[_0xe45954];return _0x46254c;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var logger=require('../../config/logger')(_0xec73('0x2'));var moment=require(_0xec73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xec73('0x4'));var config=require(_0xec73('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0xec73('0x6')]=function(_0x26598a,_0x3bd154){return _0x26598a[_0xec73('0x7')]('WhatsappApplication',attributes,{'tableName':_0xec73('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xec73('0x9')});}; \ No newline at end of file +var _0x4b84=['rimraf','../../config/environment','WhatsappApplication','utf8mb4','lodash','util','moment','path'];(function(_0x18e7fa,_0x7417ec){var _0x3677f5=function(_0x5a07ac){while(--_0x5a07ac){_0x18e7fa['push'](_0x18e7fa['shift']());}};_0x3677f5(++_0x7417ec);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x4b84[_0x1e1965];return _0x1a2e96;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x44b8('0x7'),'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 bab7c90..c222a66 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2b4999,_0x57f7c4){var _0x4b17da=function(_0x3f4d30){while(--_0x3f4d30){_0x2b4999['push'](_0x2b4999['shift']());}};_0x4b17da(++_0x57f7c4);}(_0x81bd,0x7c));var _0xd81b=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0x81bd[_0x5e9a69];return _0x5979c8;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file +var _0xac31=['code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3e2d49,_0x29b1ea){var _0x47f51b=function(_0x1ce2a7){while(--_0x1ce2a7){_0x3e2d49['push'](_0x3e2d49['shift']());}};_0x47f51b(++_0x29b1ea);}(_0xac31,0xca));var _0x1ac3=function(_0x32207f,_0x2a3b94){_0x32207f=_0x32207f-0x0;var _0x2d822e=_0xac31[_0x32207f];return _0x2d822e;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){return client['request'](_0x2bf9b1,_0x157604)[_0x1ac3('0xb')](function(_0x40b64c){logger[_0x1ac3('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x1be223,_0x1ac3('0xd'));logger[_0x1ac3('0xe')](_0x1ac3('0xf'),_0x1be223,_0x1ac3('0xd'),JSON[_0x1ac3('0x10')](_0x40b64c));if(_0x40b64c[_0x1ac3('0x11')]){if(_0x40b64c['error'][_0x1ac3('0x12')]===0x1f4){logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c[_0x1ac3('0x11')]['message']);return _0x2d17de(_0x40b64c[_0x1ac3('0x11')][_0x1ac3('0x14')]);}logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c['error'][_0x1ac3('0x14')]);return _0x57893c(_0x40b64c[_0x1ac3('0x11')]['message']);}else{logger[_0x1ac3('0xc')](_0x1ac3('0x13'),_0x1be223,_0x1ac3('0xd'));_0x57893c(_0x40b64c['result'][_0x1ac3('0x14')]);}})[_0x1ac3('0x15')](function(_0x23e6e9){logger['error'](_0x1ac3('0x13'),_0x1be223,_0x23e6e9);_0x2d17de(_0x23e6e9);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ff7c868..23b380f 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 _0x1db9=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id/messages','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1db9,0x176));var _0x91db=function(_0x46df78,_0x4580ce){_0x46df78=_0x46df78-0x0;var _0x2a33af=_0x1db9[_0x46df78];return _0x2a33af;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91db('0x6'));var interaction=require(_0x91db('0x7'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x91db('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x91db('0x8')](_0x91db('0x9'),auth[_0x91db('0xa')](),controller[_0x91db('0xb')]);router[_0x91db('0x8')]('/:id',auth[_0x91db('0xa')](),controller['show']);router[_0x91db('0x8')](_0x91db('0xc'),auth[_0x91db('0xa')](),controller['getMessages']);router[_0x91db('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x91db('0xd')]('/',auth[_0x91db('0xa')](),controller['create']);router['post'](_0x91db('0xc'),auth[_0x91db('0xa')](),controller[_0x91db('0xe')]);router[_0x91db('0xd')](_0x91db('0xf'),auth['isAuthenticated'](),interaction[_0x91db('0x10')](_0x91db('0x11'),_0x91db('0x12')),controller[_0x91db('0x13')]);router[_0x91db('0x14')](_0x91db('0x15'),auth[_0x91db('0xa')](),interaction[_0x91db('0x10')](_0x91db('0x11'),_0x91db('0x16')),controller[_0x91db('0x17')]);router[_0x91db('0x18')]('/:id',auth[_0x91db('0xa')](),interaction[_0x91db('0x10')](_0x91db('0x11'),_0x91db('0x19')),controller[_0x91db('0x1a')]);router[_0x91db('0x18')]('/:id/tags',auth['isAuthenticated'](),controller[_0x91db('0x1b')]);module[_0x91db('0x1c')]=router; \ No newline at end of file +var _0xc7a3=['show','/:id/messages','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','whatsapp','update','whatsappinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x4bff6e,_0x164fbf){_0x4bff6e=_0x4bff6e-0x0;var _0x13f65f=_0xc7a3[_0x4bff6e];return _0x13f65f;};'use strict';var multer=require('multer');var util=require(_0x3c7a('0x0'));var path=require(_0x3c7a('0x1'));var timeout=require(_0x3c7a('0x2'));var express=require(_0x3c7a('0x3'));var router=express[_0x3c7a('0x4')]();var fs_extra=require(_0x3c7a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3c7a('0x6'));var config=require(_0x3c7a('0x7'));var controller=require('./whatsappInteraction.controller');router[_0x3c7a('0x8')]('/',auth[_0x3c7a('0x9')](),controller[_0x3c7a('0xa')]);router['get'](_0x3c7a('0xb'),auth['isAuthenticated'](),controller[_0x3c7a('0xc')]);router['get'](_0x3c7a('0xd'),auth[_0x3c7a('0x9')](),controller[_0x3c7a('0xe')]);router['get'](_0x3c7a('0xf'),auth[_0x3c7a('0x9')](),controller['getMessages']);router[_0x3c7a('0x8')]('/:id/download',auth[_0x3c7a('0x9')](),controller['download']);router[_0x3c7a('0x10')]('/',auth[_0x3c7a('0x9')](),controller[_0x3c7a('0x11')]);router[_0x3c7a('0x10')](_0x3c7a('0xf'),auth['isAuthenticated'](),controller[_0x3c7a('0x12')]);router[_0x3c7a('0x10')](_0x3c7a('0x13'),auth[_0x3c7a('0x9')](),interaction[_0x3c7a('0x14')]('whatsapp',_0x3c7a('0x15')),controller[_0x3c7a('0x16')]);router['put']('/:id',auth[_0x3c7a('0x9')](),interaction[_0x3c7a('0x14')](_0x3c7a('0x17'),'whatsappinteraction:update'),controller[_0x3c7a('0x18')]);router['delete'](_0x3c7a('0xd'),auth[_0x3c7a('0x9')](),interaction[_0x3c7a('0x14')](_0x3c7a('0x17'),_0x3c7a('0x19')),controller[_0x3c7a('0x1a')]);router['delete'](_0x3c7a('0x13'),auth[_0x3c7a('0x9')](),controller[_0x3c7a('0x1b')]);module[_0x3c7a('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 1f64353..bd5ff15 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 _0x30fc=['STRING','ENUM','out','INTEGER','sequelize','moment','BOOLEAN','DATE'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x30fc,0x64));var _0xc30f=function(_0x1d76ff,_0x4432a5){_0x1d76ff=_0x1d76ff-0x0;var _0x225544=_0x30fc[_0x1d76ff];return _0x225544;};'use strict';var Sequelize=require(_0xc30f('0x0'));var moment=require(_0xc30f('0x1'));module['exports']={'closed':{'type':Sequelize[_0xc30f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc30f('0x3')]},'disposition':{'type':Sequelize[_0xc30f('0x4')]},'secondDisposition':{'type':Sequelize[_0xc30f('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc30f('0x4')]},'phone':{'type':Sequelize[_0xc30f('0x4')]},'read1stAt':{'type':Sequelize[_0xc30f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc30f('0x5')]('in',_0xc30f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc30f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc30f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc30f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc30f('0x7')]}}; \ No newline at end of file +var _0x7880=['STRING','ENUM','out','INTEGER','moment','exports','BOOLEAN','DATE'];(function(_0x2230c2,_0x41909e){var _0x2085a8=function(_0x2b5241){while(--_0x2b5241){_0x2230c2['push'](_0x2230c2['shift']());}};_0x2085a8(++_0x41909e);}(_0x7880,0x1f4));var _0x0788=function(_0x36da2a,_0x139b77){_0x36da2a=_0x36da2a-0x0;var _0x457b21=_0x7880[_0x36da2a];return _0x457b21;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0788('0x0'));module[_0x0788('0x1')]={'closed':{'type':Sequelize[_0x0788('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0788('0x3')]},'disposition':{'type':Sequelize[_0x0788('0x4')]},'secondDisposition':{'type':Sequelize[_0x0788('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0788('0x4')]},'phone':{'type':Sequelize[_0x0788('0x4')]},'read1stAt':{'type':Sequelize[_0x0788('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0788('0x5')]('in',_0x0788('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0788('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0788('0x5')]('in',_0x0788('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0788('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0788('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 5cf69c4..0aca277 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 _0xbb4d=['ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','fields','attributes','length','include','merge','options','find','create','body','describe','addMessage','ids','omit','WhatsappMessage','intersection','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','spread','Tag','color','emit','removeTags','unix','join','files','tmp','server','attachments','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','Owner','get','Account','toString','closed','closedAt','format','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','createdAt','direction','out','System','value','transcript-','.pdf','log','err','rimraf','zip-dir','util','path','ejs','lodash'];(function(_0x74a7e5,_0x1326dd){var _0x4e4c41=function(_0x443a74){while(--_0x443a74){_0x74a7e5['push'](_0x74a7e5['shift']());}};_0x4e4c41(++_0x1326dd);}(_0xbb4d,0x74));var _0xdbb4=function(_0x31b4e1,_0x4cbd36){_0x31b4e1=_0x31b4e1-0x0;var _0x149492=_0xbb4d[_0x31b4e1];return _0x149492;};'use strict';var rimraf=require(_0xdbb4('0x0'));var zipdir=require(_0xdbb4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xdbb4('0x2'));var path=require(_0xdbb4('0x3'));var ejs=require(_0xdbb4('0x4'));var fs=require('fs');var _=require(_0xdbb4('0x5'));var Redis=require(_0xdbb4('0x6'));var interaction=require(_0xdbb4('0x7'));var qs=require(_0xdbb4('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xdbb4('0x9'))(_0xdbb4('0xa'));var config=require('../../config/environment');var db=require(_0xdbb4('0xb'))['db'];config[_0xdbb4('0xc')]=_[_0xdbb4('0xd')](config[_0xdbb4('0xc')],{'host':_0xdbb4('0xe'),'port':0x18eb});var socket=require(_0xdbb4('0xf'))(new Redis(config[_0xdbb4('0xc')]));require(_0xdbb4('0x10'))[_0xdbb4('0x11')](socket);function respondWithStatusCode(_0x20638c,_0xf32bb){_0xf32bb=_0xf32bb||0xcc;return function(_0x292278){if(_0x292278){return _0x20638c[_0xdbb4('0x12')](_0xf32bb);}return _0x20638c[_0xdbb4('0x13')](_0xf32bb)['end']();};}function respondWithResult(_0x5358c5,_0x258335){_0x258335=_0x258335||0xc8;return function(_0x565d49){if(_0x565d49){return _0x5358c5['status'](_0x258335)[_0xdbb4('0x14')](_0x565d49);}};}function respondWithFilteredResult(_0x59db0f,_0x21229e){return function(_0x534387){if(_0x534387){var _0x8fb36e=typeof _0x21229e[_0xdbb4('0x15')]===_0xdbb4('0x16')&&typeof _0x21229e[_0xdbb4('0x17')]===_0xdbb4('0x16');var _0x181a09=_0x534387[_0xdbb4('0x18')];var _0x18418c=_0x8fb36e?0x0:_0x21229e[_0xdbb4('0x15')];var _0x2a6883=_0x8fb36e?_0x534387[_0xdbb4('0x18')]:_0x21229e[_0xdbb4('0x15')]+_0x21229e[_0xdbb4('0x17')];var _0x57fc46;if(_0x2a6883>=_0x181a09){_0x2a6883=_0x181a09;_0x57fc46=0xc8;}else{_0x57fc46=0xce;}_0x59db0f[_0xdbb4('0x13')](_0x57fc46);return _0x59db0f[_0xdbb4('0x19')](_0xdbb4('0x1a'),_0x18418c+'-'+_0x2a6883+'/'+_0x181a09)['json'](_0x534387);}return null;};}function saveUpdates(_0x19c72c){return function(_0xbfbee5){if(_0xbfbee5){return _0xbfbee5[_0xdbb4('0x1b')](_0x19c72c)[_0xdbb4('0x1c')](function(_0x4a6a5a){return _0x4a6a5a;});}return null;};}function removeEntity(_0x476b21){return function(_0x44881c){if(_0x44881c){return _0x44881c[_0xdbb4('0x1d')]()[_0xdbb4('0x1c')](function(){_0x476b21['status'](0xcc)[_0xdbb4('0x1e')]();});}};}function handleEntityNotFound(_0x28d38f){return function(_0x578ae6){if(!_0x578ae6){_0x28d38f[_0xdbb4('0x12')](0x194);}return _0x578ae6;};}function handleError(_0x581803,_0x9a7077){_0x9a7077=_0x9a7077||0x1f4;return function(_0x20cdd0){logger['error'](_0x20cdd0[_0xdbb4('0x1f')]);if(_0x20cdd0[_0xdbb4('0x20')]){delete _0x20cdd0['name'];}_0x581803[_0xdbb4('0x13')](_0x9a7077)[_0xdbb4('0x21')](_0x20cdd0);};}exports[_0xdbb4('0x22')]=function(_0x51b292,_0x2b1eee){var _0x1b93ef={};var _0x3b5e44=_[_0xdbb4('0x23')](db[_0xdbb4('0x24')][_0xdbb4('0x25')],function(_0x4f8271){return{'name':_0x4f8271[_0xdbb4('0x26')],'type':_0x4f8271[_0xdbb4('0x27')][_0xdbb4('0x28')]};});_0x1b93ef=qs['getOptions'](_0x3b5e44,_0x51b292);return interaction[_0xdbb4('0x29')](_0xdbb4('0x2a'),_0x51b292[_0xdbb4('0x2b')],_0x51b292[_0xdbb4('0x2c')],_0x1b93ef,_0x3b5e44)[_0xdbb4('0x1c')](respondWithFilteredResult(_0x2b1eee,_0x1b93ef))[_0xdbb4('0x2d')](handleError(_0x2b1eee,null));};exports[_0xdbb4('0x2e')]=function(_0x3ba49c,_0x4a46ab){var _0xd8e200={'raw':![],'where':{'id':_0x3ba49c[_0xdbb4('0x2f')]['id']}},_0x6cd095={};_0x6cd095[_0xdbb4('0x30')]=_['keys'](db[_0xdbb4('0x24')][_0xdbb4('0x25')]);_0x6cd095[_0xdbb4('0x2b')]=_[_0xdbb4('0x31')](_0x3ba49c[_0xdbb4('0x2b')]);_0x6cd095[_0xdbb4('0x32')]=_['intersection'](_0x6cd095['model'],_0x6cd095[_0xdbb4('0x2b')]);_0xd8e200['attributes']=_['intersection'](_0x6cd095[_0xdbb4('0x30')],qs['fields'](_0x3ba49c['query'][_0xdbb4('0x33')]));_0xd8e200['attributes']=_0xd8e200[_0xdbb4('0x34')][_0xdbb4('0x35')]?_0xd8e200[_0xdbb4('0x34')]:_0x6cd095[_0xdbb4('0x30')];if(_0x3ba49c[_0xdbb4('0x2b')]['includeAll']){_0xd8e200[_0xdbb4('0x36')]=[{'all':!![]}];}_0xd8e200=_[_0xdbb4('0x37')]({},_0xd8e200,_0x3ba49c[_0xdbb4('0x38')]);return db['WhatsappInteraction'][_0xdbb4('0x39')](_0xd8e200)[_0xdbb4('0x1c')](handleEntityNotFound(_0x4a46ab,null))[_0xdbb4('0x1c')](respondWithResult(_0x4a46ab,null))['catch'](handleError(_0x4a46ab,null));};exports[_0xdbb4('0x3a')]=function(_0x578c28,_0x19eeda){return db[_0xdbb4('0x24')]['create'](_0x578c28[_0xdbb4('0x3b')],{})[_0xdbb4('0x1c')](respondWithResult(_0x19eeda,0xc9))[_0xdbb4('0x2d')](handleError(_0x19eeda,null));};exports[_0xdbb4('0x1b')]=function(_0x313e5b,_0x12c3a8){if(_0x313e5b[_0xdbb4('0x3b')]['id']){delete _0x313e5b[_0xdbb4('0x3b')]['id'];}return db[_0xdbb4('0x24')][_0xdbb4('0x39')]({'where':{'id':_0x313e5b[_0xdbb4('0x2f')]['id']}})[_0xdbb4('0x1c')](handleEntityNotFound(_0x12c3a8,null))[_0xdbb4('0x1c')](saveUpdates(_0x313e5b[_0xdbb4('0x3b')],null))[_0xdbb4('0x1c')](respondWithResult(_0x12c3a8,null))['catch'](handleError(_0x12c3a8,null));};exports['destroy']=function(_0xa2f2,_0x3d231d){return db['WhatsappInteraction'][_0xdbb4('0x39')]({'where':{'id':_0xa2f2[_0xdbb4('0x2f')]['id']}})[_0xdbb4('0x1c')](handleEntityNotFound(_0x3d231d,null))['then'](removeEntity(_0x3d231d,null))['catch'](handleError(_0x3d231d,null));};exports[_0xdbb4('0x3c')]=function(_0x567948,_0x2c8ef8){return db[_0xdbb4('0x24')][_0xdbb4('0x3c')]()['then'](respondWithResult(_0x2c8ef8,null))[_0xdbb4('0x2d')](handleError(_0x2c8ef8,null));};exports[_0xdbb4('0x3d')]=function(_0x1b136a,_0x417f6d){return db['WhatsappMessage']['find']({'where':{'id':_0x1b136a[_0xdbb4('0x2f')]['id']}})[_0xdbb4('0x1c')](handleEntityNotFound(_0x417f6d,null))[_0xdbb4('0x1c')](function(_0x5a4927){if(_0x5a4927){return _0x5a4927[_0xdbb4('0x3d')](_0x1b136a[_0xdbb4('0x3b')][_0xdbb4('0x3e')],_[_0xdbb4('0x3f')](_0x1b136a[_0xdbb4('0x3b')],[_0xdbb4('0x3e'),'id'])||{});}})[_0xdbb4('0x1c')](respondWithResult(_0x417f6d,null))[_0xdbb4('0x2d')](handleError(_0x417f6d,null));};exports['getMessages']=function(_0x513581,_0x4301d6){var _0x28519b={'raw':![],'where':{}};var _0x1a8024={};var _0x5b2798={'count':0x0,'rows':[]};return db[_0xdbb4('0x24')]['findOne']({'where':{'id':_0x513581['params']['id']}})[_0xdbb4('0x1c')](handleEntityNotFound(_0x4301d6,null))[_0xdbb4('0x1c')](function(_0xee059){if(_0xee059){_0x1a8024[_0xdbb4('0x30')]=_[_0xdbb4('0x31')](db[_0xdbb4('0x40')][_0xdbb4('0x25')]);_0x1a8024[_0xdbb4('0x2b')]=_['keys'](_0x513581[_0xdbb4('0x2b')]);_0x1a8024[_0xdbb4('0x32')]=_[_0xdbb4('0x41')](_0x1a8024[_0xdbb4('0x30')],_0x1a8024[_0xdbb4('0x2b')]);_0x28519b[_0xdbb4('0x34')]=_['intersection'](_0x1a8024[_0xdbb4('0x30')],qs[_0xdbb4('0x33')](_0x513581['query'][_0xdbb4('0x33')]));_0x28519b[_0xdbb4('0x34')]=_0x28519b[_0xdbb4('0x34')]['length']?_0x28519b[_0xdbb4('0x34')]:_0x1a8024[_0xdbb4('0x30')];if(!_0x513581[_0xdbb4('0x2b')][_0xdbb4('0x42')](_0xdbb4('0x43'))){_0x28519b[_0xdbb4('0x17')]=qs[_0xdbb4('0x17')](_0x513581[_0xdbb4('0x2b')][_0xdbb4('0x17')]);_0x28519b[_0xdbb4('0x15')]=qs[_0xdbb4('0x15')](_0x513581[_0xdbb4('0x2b')][_0xdbb4('0x15')]);}_0x28519b[_0xdbb4('0x44')]=qs[_0xdbb4('0x45')](_0x513581['query']['sort']);_0x28519b[_0xdbb4('0x46')]=qs[_0xdbb4('0x32')](_[_0xdbb4('0x47')](_0x513581['query'],_0x1a8024['filters']));_0x28519b['where'][_0xdbb4('0x48')]=_0xee059['id'];if(_0x513581[_0xdbb4('0x2b')][_0xdbb4('0x49')]){_0x28519b[_0xdbb4('0x46')]=_[_0xdbb4('0x37')](_0x28519b[_0xdbb4('0x46')],{'$or':_[_0xdbb4('0x23')](_0x28519b['attributes'],function(_0x1cbdde){var _0x11979a={};_0x11979a[_0x1cbdde]={'$like':'%'+_0x513581[_0xdbb4('0x2b')][_0xdbb4('0x49')]+'%'};return _0x11979a;})});}if(_0x513581[_0xdbb4('0x2b')][_0xdbb4('0x4a')]){var _0x227228=_0x513581[_0xdbb4('0x2b')][_0xdbb4('0x4a')][_0xdbb4('0x4b')](',');var _0x18fa90={};_0x18fa90[_0x227228[0x0]]={'$gte':moment(_0x227228[0x1])['format'](_0xdbb4('0x4c'))};_0x28519b[_0xdbb4('0x46')]=_[_0xdbb4('0x37')](_0x28519b[_0xdbb4('0x46')],_0x18fa90);}_0x28519b=_[_0xdbb4('0x37')]({},_0x28519b,_0x513581[_0xdbb4('0x38')]);return db[_0xdbb4('0x40')]['count']({'where':_0x28519b[_0xdbb4('0x46')]})[_0xdbb4('0x1c')](function(_0x16be61){_0x5b2798[_0xdbb4('0x18')]=_0x16be61;if(_0x513581[_0xdbb4('0x2b')][_0xdbb4('0x4d')]){_0x28519b[_0xdbb4('0x36')]=[{'all':!![]}];}return db[_0xdbb4('0x40')][_0xdbb4('0x29')](_0x28519b);})[_0xdbb4('0x1c')](function(_0x860e2e){_0x5b2798[_0xdbb4('0x4e')]=_0x860e2e;return _0x5b2798;});}})[_0xdbb4('0x1c')](respondWithFilteredResult(_0x4301d6,_0x28519b))[_0xdbb4('0x2d')](handleError(_0x4301d6,null));};exports[_0xdbb4('0x4f')]=function(_0x503e53,_0x216ffa){return db[_0xdbb4('0x24')][_0xdbb4('0x39')]({'where':{'id':_0x503e53[_0xdbb4('0x2f')]['id']}})[_0xdbb4('0x1c')](handleEntityNotFound(_0x216ffa,null))[_0xdbb4('0x1c')](function(_0x51170f){if(_0x51170f){return _0x51170f['setTags'](_0x503e53[_0xdbb4('0x3b')][_0xdbb4('0x3e')],_['omit'](_0x503e53['body'],['ids','id'])||{})[_0xdbb4('0x50')](function(){return db[_0xdbb4('0x51')][_0xdbb4('0x29')]({'attributes':['id',_0xdbb4('0x20'),_0xdbb4('0x52')],'where':{'id':_0x503e53['body']['ids']}});})[_0xdbb4('0x1c')](function(_0x3ae339){socket[_0xdbb4('0x53')]('whatsappInteractionTags:save',{'id':Number(_0x503e53[_0xdbb4('0x2f')]['id']),'tags':_0x3ae339||[]});return{'id':Number(_0x503e53[_0xdbb4('0x2f')]['id']),'tags':_0x3ae339||[]};});}})[_0xdbb4('0x1c')](respondWithResult(_0x216ffa,null))[_0xdbb4('0x2d')](handleError(_0x216ffa,null));};exports[_0xdbb4('0x54')]=function(_0x122023,_0x4e2c48){return db[_0xdbb4('0x24')][_0xdbb4('0x39')]({'where':{'id':_0x122023[_0xdbb4('0x2f')]['id']}})[_0xdbb4('0x1c')](handleEntityNotFound(_0x4e2c48,null))['then'](function(_0x21a3ed){if(_0x21a3ed){return _0x21a3ed[_0xdbb4('0x54')](_0x122023[_0xdbb4('0x2b')][_0xdbb4('0x3e')]);}})[_0xdbb4('0x1c')](respondWithStatusCode(_0x4e2c48,null))[_0xdbb4('0x2d')](handleError(_0x4e2c48,null));};exports['download']=function(_0x5d238f,_0x4fc484){var _0x1e3549=moment()[_0xdbb4('0x55')]()['toString']();var _0x2288e5=path[_0xdbb4('0x56')](config['root'],'server',_0xdbb4('0x57'),_0xdbb4('0x58'));var _0x1bcce7=path[_0xdbb4('0x56')](config['root'],_0xdbb4('0x59'),_0xdbb4('0x57'),_0xdbb4('0x5a'));var _0x2d38a4=path['join'](_0x2288e5,_0x1e3549);var _0x4ca7d4=util['format']('transcript-%d-%s.zip',_0x5d238f[_0xdbb4('0x2f')]['id'],_0x1e3549);var _0x43172c=path[_0xdbb4('0x56')](_0x2288e5,_0x4ca7d4);var _0x17106c=[];_0x17106c[_0xdbb4('0x5b')]({'model':db[_0xdbb4('0x5c')],'as':_0xdbb4('0x5c'),'attributes':['id',_0xdbb4('0x5d')],'raw':!![]});_0x17106c[_0xdbb4('0x5b')]({'model':db[_0xdbb4('0x5e')],'as':_0xdbb4('0x5f'),'attributes':['id',_0xdbb4('0x60'),_0xdbb4('0x61')],'raw':!![]});if(_0x5d238f[_0xdbb4('0x2b')][_0xdbb4('0x5a')]){_0x17106c[_0xdbb4('0x5b')]({'model':db[_0xdbb4('0x62')],'as':'Attachment','raw':!![]});}var _0x390d30=[{'model':db['WhatsappMessage'],'as':_0xdbb4('0x63'),'attributes':['id','body','createdAt','direction','secret','read'],'include':_0x17106c}];_0x390d30['push']({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0xdbb4('0x20')]});_0x390d30['push']({'model':db[_0xdbb4('0x5c')],'as':_0xdbb4('0x64'),'attributes':['id',_0xdbb4('0x5d')]});return db[_0xdbb4('0x24')]['find']({'where':{'id':_0x5d238f[_0xdbb4('0x2f')]['id']},'include':_0x390d30})[_0xdbb4('0x1c')](handleEntityNotFound(_0x4fc484,null))[_0xdbb4('0x1c')](function(_0x1553e7){if(_0x1553e7){var _0x37b5aa=_0x1553e7[_0xdbb4('0x65')]({'plain':!![]});fs['mkdirSync'](_0x2d38a4);var _0x3ed4f2={'channel':'Whatsapp','account':_0x37b5aa[_0xdbb4('0x66')][_0xdbb4('0x20')],'agent':_0x37b5aa[_0xdbb4('0x64')]?_0x37b5aa[_0xdbb4('0x64')][_0xdbb4('0x5d')]:'N.A.','createdAt':moment(_0x37b5aa['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xdbb4('0x67')](),'closedAt':_0x37b5aa[_0xdbb4('0x68')]?moment(_0x37b5aa[_0xdbb4('0x69')])[_0xdbb4('0x6a')](_0xdbb4('0x4c'))[_0xdbb4('0x67')]():'','disposition':_0x37b5aa[_0xdbb4('0x6b')],'messages':_(_0x37b5aa[_0xdbb4('0x63')])['filter']({'secret':![]})[_0xdbb4('0x23')](function(_0x470e5f){if(_0x470e5f['Attachment']){var _0x30e40d=path[_0xdbb4('0x56')](_0x1bcce7,_0x470e5f[_0xdbb4('0x62')][_0xdbb4('0x6c')]);if(fs[_0xdbb4('0x6d')](_0x30e40d)){fs[_0xdbb4('0x6e')](_0x30e40d)[_0xdbb4('0x6f')](fs[_0xdbb4('0x70')](path[_0xdbb4('0x56')](_0x2d38a4,_0x470e5f[_0xdbb4('0x62')][_0xdbb4('0x6c')])));}}return{'date':moment(_0x470e5f[_0xdbb4('0x71')])[_0xdbb4('0x6a')](_0xdbb4('0x4c'))['toString'](),'sender':_0x470e5f[_0xdbb4('0x72')]===_0xdbb4('0x73')?_0x470e5f[_0xdbb4('0x5c')]?_0x470e5f[_0xdbb4('0x5c')][_0xdbb4('0x5d')]:_0xdbb4('0x74'):_0x470e5f[_0xdbb4('0x5f')][_0xdbb4('0x60')]+(_0x470e5f[_0xdbb4('0x5f')][_0xdbb4('0x61')]?'\x20'+_0x470e5f[_0xdbb4('0x5f')]['lastName']:''),'body':_0x470e5f[_0xdbb4('0x62')]?_0x470e5f['Attachment'][_0xdbb4('0x6c')]:_0x470e5f[_0xdbb4('0x3b')],'direction':_0x470e5f[_0xdbb4('0x72')]===_0xdbb4('0x73')?'A':'C','secret':_0x470e5f['secret'],'read':_0x470e5f['read'],'attachment':_0x470e5f[_0xdbb4('0x62')]};})[_0xdbb4('0x75')]()};return ejs['renderFile'](path['join'](config['root'],'server','views','downloadInteraction.ejs'),{'interaction':_0x3ed4f2})[_0xdbb4('0x1c')](function(_0x277f8c){var _0x21d5b3=path[_0xdbb4('0x56')](_0x2d38a4,_0xdbb4('0x76')+_0x37b5aa['id']+'-'+_0x1e3549+_0xdbb4('0x77'));var _0x3b3650={'path':_0x21d5b3,'channel':'Whatsapp','interactionId':_0x37b5aa['id']};return pdf['createPdfFromHTML'](_0x277f8c,_0x3b3650);})[_0xdbb4('0x1c')](function(){return new BPromise(function(_0x23be21,_0x3b61da){zipdir(_0x2d38a4,{'saveTo':_0x43172c},function(_0x59ebc7,_0x2ceb27){if(_0x59ebc7)return _0x3b61da(_0x59ebc7);return _0x23be21(_0x2ceb27);});})[_0xdbb4('0x1c')](function(){return new BPromise(function(_0x3ba6fe,_0x3fae0f){rimraf(_0x2d38a4,function(_0x5b3618){if(_0x5b3618)_0x3fae0f(_0x5b3618);return _0x3ba6fe();});});})[_0xdbb4('0x1c')](function(){return _0x4fc484['download'](_0x43172c,_0x4ca7d4,function(_0x59ec25){if(_0x59ec25){console[_0xdbb4('0x78')](_0xdbb4('0x79'),_0x59ec25);}else{fs['unlinkSync'](_0x43172c);}});});});}else{return _0x4fc484[_0xdbb4('0x12')](0xc8);}})[_0xdbb4('0x2d')](handleError(_0x4fc484,null));}; \ No newline at end of file +var _0xfe70=['closedAt','disposition','createWriteStream','out','System','basename','value','renderFile','views','downloadInteraction.ejs','.pdf','log','rimraf','zip-dir','bluebird','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','findAll','query','user','params','WhatsappInteraction','keys','filters','model','attributes','intersection','fields','length','includeAll','include','options','find','catch','create','body','describe','ids','getMessages','findOne','hasOwnProperty','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','WhatsappMessage','addTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','fullname','mkdirSync','N.A.','createdAt','toString','closed'];(function(_0x169790,_0x48aa33){var _0x4d0f36=function(_0x2a848d){while(--_0x2a848d){_0x169790['push'](_0x169790['shift']());}};_0x4d0f36(++_0x48aa33);}(_0xfe70,0x102));var _0x0fe7=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0xfe70[_0x393500];return _0x120d3b;};'use strict';var rimraf=require(_0x0fe7('0x0'));var zipdir=require(_0x0fe7('0x1'));var moment=require('moment');var BPromise=require(_0x0fe7('0x2'));var util=require(_0x0fe7('0x3'));var path=require(_0x0fe7('0x4'));var ejs=require(_0x0fe7('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x0fe7('0x6'));var qs=require(_0x0fe7('0x7'));var pdf=require(_0x0fe7('0x8'));var logger=require(_0x0fe7('0x9'))(_0x0fe7('0xa'));var config=require(_0x0fe7('0xb'));var db=require(_0x0fe7('0xc'))['db'];config[_0x0fe7('0xd')]=_[_0x0fe7('0xe')](config[_0x0fe7('0xd')],{'host':_0x0fe7('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fe7('0xd')]));require(_0x0fe7('0x10'))[_0x0fe7('0x11')](socket);function respondWithStatusCode(_0x3f9c23,_0x6fb19c){_0x6fb19c=_0x6fb19c||0xcc;return function(_0x5db0fc){if(_0x5db0fc){return _0x3f9c23[_0x0fe7('0x12')](_0x6fb19c);}return _0x3f9c23[_0x0fe7('0x13')](_0x6fb19c)[_0x0fe7('0x14')]();};}function respondWithResult(_0x35ddd2,_0xa99399){_0xa99399=_0xa99399||0xc8;return function(_0xe83fd9){if(_0xe83fd9){return _0x35ddd2[_0x0fe7('0x13')](_0xa99399)[_0x0fe7('0x15')](_0xe83fd9);}};}function respondWithFilteredResult(_0x190323,_0x37f371){return function(_0x3fee6d){if(_0x3fee6d){var _0x47c520=typeof _0x37f371[_0x0fe7('0x16')]===_0x0fe7('0x17')&&typeof _0x37f371['limit']===_0x0fe7('0x17');var _0x31abcb=_0x3fee6d[_0x0fe7('0x18')];var _0x48100f=_0x47c520?0x0:_0x37f371[_0x0fe7('0x16')];var _0x4a27ed=_0x47c520?_0x3fee6d[_0x0fe7('0x18')]:_0x37f371[_0x0fe7('0x16')]+_0x37f371[_0x0fe7('0x19')];var _0xf37f37;if(_0x4a27ed>=_0x31abcb){_0x4a27ed=_0x31abcb;_0xf37f37=0xc8;}else{_0xf37f37=0xce;}_0x190323[_0x0fe7('0x13')](_0xf37f37);return _0x190323[_0x0fe7('0x1a')](_0x0fe7('0x1b'),_0x48100f+'-'+_0x4a27ed+'/'+_0x31abcb)[_0x0fe7('0x15')](_0x3fee6d);}return null;};}function saveUpdates(_0x1cf43f){return function(_0x4cb390){if(_0x4cb390){return _0x4cb390[_0x0fe7('0x1c')](_0x1cf43f)[_0x0fe7('0x1d')](function(_0x123875){return _0x123875;});}return null;};}function removeEntity(_0x325777){return function(_0x2efef8){if(_0x2efef8){return _0x2efef8[_0x0fe7('0x1e')]()[_0x0fe7('0x1d')](function(){_0x325777['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a479){return function(_0xf60d31){if(!_0xf60d31){_0x32a479[_0x0fe7('0x12')](0x194);}return _0xf60d31;};}function handleError(_0x7cd368,_0x534dd9){_0x534dd9=_0x534dd9||0x1f4;return function(_0x1ff208){logger[_0x0fe7('0x1f')](_0x1ff208[_0x0fe7('0x20')]);if(_0x1ff208['name']){delete _0x1ff208[_0x0fe7('0x21')];}_0x7cd368['status'](_0x534dd9)[_0x0fe7('0x22')](_0x1ff208);};}exports[_0x0fe7('0x23')]=function(_0x51c69b,_0x36f5a6){var _0x39a35b={};var _0x262146=_[_0x0fe7('0x24')](db['WhatsappInteraction'][_0x0fe7('0x25')],function(_0x34a3df){return{'name':_0x34a3df[_0x0fe7('0x26')],'type':_0x34a3df['type'][_0x0fe7('0x27')]};});_0x39a35b=qs['getOptions'](_0x262146,_0x51c69b);return interaction[_0x0fe7('0x28')]('whatsapp',_0x51c69b[_0x0fe7('0x29')],_0x51c69b[_0x0fe7('0x2a')],_0x39a35b,_0x262146)[_0x0fe7('0x1d')](respondWithFilteredResult(_0x36f5a6,_0x39a35b))['catch'](handleError(_0x36f5a6,null));};exports['show']=function(_0x1c25ae,_0x12b527){var _0x3e19ec={'raw':![],'where':{'id':_0x1c25ae[_0x0fe7('0x2b')]['id']}},_0x3388c9={};_0x3388c9['model']=_['keys'](db[_0x0fe7('0x2c')][_0x0fe7('0x25')]);_0x3388c9['query']=_[_0x0fe7('0x2d')](_0x1c25ae['query']);_0x3388c9[_0x0fe7('0x2e')]=_['intersection'](_0x3388c9[_0x0fe7('0x2f')],_0x3388c9['query']);_0x3e19ec[_0x0fe7('0x30')]=_[_0x0fe7('0x31')](_0x3388c9['model'],qs[_0x0fe7('0x32')](_0x1c25ae[_0x0fe7('0x29')][_0x0fe7('0x32')]));_0x3e19ec[_0x0fe7('0x30')]=_0x3e19ec[_0x0fe7('0x30')][_0x0fe7('0x33')]?_0x3e19ec[_0x0fe7('0x30')]:_0x3388c9[_0x0fe7('0x2f')];if(_0x1c25ae['query'][_0x0fe7('0x34')]){_0x3e19ec[_0x0fe7('0x35')]=[{'all':!![]}];}_0x3e19ec=_['merge']({},_0x3e19ec,_0x1c25ae[_0x0fe7('0x36')]);return db[_0x0fe7('0x2c')][_0x0fe7('0x37')](_0x3e19ec)['then'](handleEntityNotFound(_0x12b527,null))[_0x0fe7('0x1d')](respondWithResult(_0x12b527,null))[_0x0fe7('0x38')](handleError(_0x12b527,null));};exports[_0x0fe7('0x39')]=function(_0x1a14f4,_0xbbe2d){return db[_0x0fe7('0x2c')][_0x0fe7('0x39')](_0x1a14f4[_0x0fe7('0x3a')],{})[_0x0fe7('0x1d')](respondWithResult(_0xbbe2d,0xc9))[_0x0fe7('0x38')](handleError(_0xbbe2d,null));};exports[_0x0fe7('0x1c')]=function(_0x2994c2,_0x4be3ab){if(_0x2994c2['body']['id']){delete _0x2994c2[_0x0fe7('0x3a')]['id'];}return db[_0x0fe7('0x2c')][_0x0fe7('0x37')]({'where':{'id':_0x2994c2[_0x0fe7('0x2b')]['id']}})[_0x0fe7('0x1d')](handleEntityNotFound(_0x4be3ab,null))[_0x0fe7('0x1d')](saveUpdates(_0x2994c2['body'],null))['then'](respondWithResult(_0x4be3ab,null))['catch'](handleError(_0x4be3ab,null));};exports['destroy']=function(_0x56bedb,_0x2ab407){return db[_0x0fe7('0x2c')][_0x0fe7('0x37')]({'where':{'id':_0x56bedb['params']['id']}})['then'](handleEntityNotFound(_0x2ab407,null))[_0x0fe7('0x1d')](removeEntity(_0x2ab407,null))['catch'](handleError(_0x2ab407,null));};exports[_0x0fe7('0x3b')]=function(_0x4d733d,_0x427da7){return db[_0x0fe7('0x2c')][_0x0fe7('0x3b')]()[_0x0fe7('0x1d')](respondWithResult(_0x427da7,null))['catch'](handleError(_0x427da7,null));};exports['addMessage']=function(_0x40bd15,_0xd46358){return db['WhatsappMessage'][_0x0fe7('0x37')]({'where':{'id':_0x40bd15[_0x0fe7('0x2b')]['id']}})[_0x0fe7('0x1d')](handleEntityNotFound(_0xd46358,null))[_0x0fe7('0x1d')](function(_0x33efcf){if(_0x33efcf){return _0x33efcf['addMessage'](_0x40bd15[_0x0fe7('0x3a')]['ids'],_['omit'](_0x40bd15[_0x0fe7('0x3a')],[_0x0fe7('0x3c'),'id'])||{});}})[_0x0fe7('0x1d')](respondWithResult(_0xd46358,null))[_0x0fe7('0x38')](handleError(_0xd46358,null));};exports[_0x0fe7('0x3d')]=function(_0x45f206,_0x532298){var _0x8623b2={'raw':![],'where':{}};var _0x446380={};var _0x4ec809={'count':0x0,'rows':[]};return db[_0x0fe7('0x2c')][_0x0fe7('0x3e')]({'where':{'id':_0x45f206[_0x0fe7('0x2b')]['id']}})['then'](handleEntityNotFound(_0x532298,null))[_0x0fe7('0x1d')](function(_0x14dbd6){if(_0x14dbd6){_0x446380['model']=_[_0x0fe7('0x2d')](db['WhatsappMessage'][_0x0fe7('0x25')]);_0x446380[_0x0fe7('0x29')]=_['keys'](_0x45f206[_0x0fe7('0x29')]);_0x446380[_0x0fe7('0x2e')]=_[_0x0fe7('0x31')](_0x446380['model'],_0x446380[_0x0fe7('0x29')]);_0x8623b2[_0x0fe7('0x30')]=_['intersection'](_0x446380[_0x0fe7('0x2f')],qs[_0x0fe7('0x32')](_0x45f206[_0x0fe7('0x29')][_0x0fe7('0x32')]));_0x8623b2[_0x0fe7('0x30')]=_0x8623b2['attributes']['length']?_0x8623b2[_0x0fe7('0x30')]:_0x446380[_0x0fe7('0x2f')];if(!_0x45f206[_0x0fe7('0x29')][_0x0fe7('0x3f')]('nolimit')){_0x8623b2[_0x0fe7('0x19')]=qs['limit'](_0x45f206[_0x0fe7('0x29')][_0x0fe7('0x19')]);_0x8623b2[_0x0fe7('0x16')]=qs['offset'](_0x45f206[_0x0fe7('0x29')][_0x0fe7('0x16')]);}_0x8623b2[_0x0fe7('0x40')]=qs[_0x0fe7('0x41')](_0x45f206[_0x0fe7('0x29')][_0x0fe7('0x41')]);_0x8623b2[_0x0fe7('0x42')]=qs[_0x0fe7('0x2e')](_[_0x0fe7('0x43')](_0x45f206[_0x0fe7('0x29')],_0x446380[_0x0fe7('0x2e')]));_0x8623b2[_0x0fe7('0x42')]['WhatsappInteractionId']=_0x14dbd6['id'];if(_0x45f206[_0x0fe7('0x29')][_0x0fe7('0x44')]){_0x8623b2[_0x0fe7('0x42')]=_['merge'](_0x8623b2['where'],{'$or':_[_0x0fe7('0x24')](_0x8623b2[_0x0fe7('0x30')],function(_0xc59220){var _0x35559d={};_0x35559d[_0xc59220]={'$like':'%'+_0x45f206[_0x0fe7('0x29')]['filter']+'%'};return _0x35559d;})});}if(_0x45f206[_0x0fe7('0x29')][_0x0fe7('0x45')]){var _0xdfd569=_0x45f206[_0x0fe7('0x29')][_0x0fe7('0x45')]['split'](',');var _0x1efa90={};_0x1efa90[_0xdfd569[0x0]]={'$gte':moment(_0xdfd569[0x1])[_0x0fe7('0x46')](_0x0fe7('0x47'))};_0x8623b2['where']=_[_0x0fe7('0x48')](_0x8623b2['where'],_0x1efa90);}_0x8623b2=_[_0x0fe7('0x48')]({},_0x8623b2,_0x45f206[_0x0fe7('0x36')]);return db[_0x0fe7('0x49')]['count']({'where':_0x8623b2[_0x0fe7('0x42')]})[_0x0fe7('0x1d')](function(_0xd981cc){_0x4ec809[_0x0fe7('0x18')]=_0xd981cc;if(_0x45f206[_0x0fe7('0x29')]['includeAll']){_0x8623b2[_0x0fe7('0x35')]=[{'all':!![]}];}return db[_0x0fe7('0x49')]['findAll'](_0x8623b2);})[_0x0fe7('0x1d')](function(_0x2ddc91){_0x4ec809['rows']=_0x2ddc91;return _0x4ec809;});}})[_0x0fe7('0x1d')](respondWithFilteredResult(_0x532298,_0x8623b2))[_0x0fe7('0x38')](handleError(_0x532298,null));};exports[_0x0fe7('0x4a')]=function(_0x14aac3,_0x55cd66){return db[_0x0fe7('0x2c')][_0x0fe7('0x37')]({'where':{'id':_0x14aac3['params']['id']}})[_0x0fe7('0x1d')](handleEntityNotFound(_0x55cd66,null))[_0x0fe7('0x1d')](function(_0x112b01){if(_0x112b01){return _0x112b01['setTags'](_0x14aac3[_0x0fe7('0x3a')][_0x0fe7('0x3c')],_[_0x0fe7('0x4b')](_0x14aac3['body'],[_0x0fe7('0x3c'),'id'])||{})[_0x0fe7('0x4c')](function(){return db[_0x0fe7('0x4d')][_0x0fe7('0x28')]({'attributes':['id',_0x0fe7('0x21'),_0x0fe7('0x4e')],'where':{'id':_0x14aac3[_0x0fe7('0x3a')][_0x0fe7('0x3c')]}});})['then'](function(_0x12c9a0){socket[_0x0fe7('0x4f')](_0x0fe7('0x50'),{'id':Number(_0x14aac3[_0x0fe7('0x2b')]['id']),'tags':_0x12c9a0||[]});return{'id':Number(_0x14aac3[_0x0fe7('0x2b')]['id']),'tags':_0x12c9a0||[]};});}})[_0x0fe7('0x1d')](respondWithResult(_0x55cd66,null))[_0x0fe7('0x38')](handleError(_0x55cd66,null));};exports[_0x0fe7('0x51')]=function(_0x584d16,_0xe35056){return db[_0x0fe7('0x2c')][_0x0fe7('0x37')]({'where':{'id':_0x584d16['params']['id']}})[_0x0fe7('0x1d')](handleEntityNotFound(_0xe35056,null))['then'](function(_0x421c92){if(_0x421c92){return _0x421c92['removeTags'](_0x584d16['query']['ids']);}})[_0x0fe7('0x1d')](respondWithStatusCode(_0xe35056,null))[_0x0fe7('0x38')](handleError(_0xe35056,null));};exports[_0x0fe7('0x52')]=function(_0x56f61c,_0x5d4d02){var _0x3a9808=moment()[_0x0fe7('0x53')]()['toString']();var _0x1f17e5=path[_0x0fe7('0x54')](config[_0x0fe7('0x55')],_0x0fe7('0x56'),_0x0fe7('0x57'),_0x0fe7('0x58'));var _0x697102=path[_0x0fe7('0x54')](config[_0x0fe7('0x55')],_0x0fe7('0x56'),_0x0fe7('0x57'),_0x0fe7('0x59'));var _0x27b7c2=path[_0x0fe7('0x54')](_0x1f17e5,_0x3a9808);var _0x279a38=util['format'](_0x0fe7('0x5a'),_0x56f61c[_0x0fe7('0x2b')]['id'],_0x3a9808);var _0x583f48=path[_0x0fe7('0x54')](_0x1f17e5,_0x279a38);var _0x4d0355=[];_0x4d0355[_0x0fe7('0x5b')]({'model':db[_0x0fe7('0x5c')],'as':_0x0fe7('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x4d0355[_0x0fe7('0x5b')]({'model':db[_0x0fe7('0x5d')],'as':_0x0fe7('0x5e'),'attributes':['id',_0x0fe7('0x5f'),_0x0fe7('0x60')],'raw':!![]});if(_0x56f61c[_0x0fe7('0x29')]['attachments']){_0x4d0355[_0x0fe7('0x5b')]({'model':db[_0x0fe7('0x61')],'as':_0x0fe7('0x61'),'raw':!![]});}var _0x11e00b=[{'model':db[_0x0fe7('0x49')],'as':_0x0fe7('0x62'),'attributes':['id',_0x0fe7('0x3a'),'createdAt',_0x0fe7('0x63'),_0x0fe7('0x64'),_0x0fe7('0x65')],'include':_0x4d0355}];_0x11e00b['push']({'model':db[_0x0fe7('0x66')],'as':_0x0fe7('0x67'),'attributes':['id',_0x0fe7('0x21')]});_0x11e00b[_0x0fe7('0x5b')]({'model':db['User'],'as':_0x0fe7('0x68'),'attributes':['id',_0x0fe7('0x69')]});return db['WhatsappInteraction'][_0x0fe7('0x37')]({'where':{'id':_0x56f61c[_0x0fe7('0x2b')]['id']},'include':_0x11e00b})['then'](handleEntityNotFound(_0x5d4d02,null))[_0x0fe7('0x1d')](function(_0x50b705){if(_0x50b705){var _0xe06ba2=_0x50b705['get']({'plain':!![]});fs[_0x0fe7('0x6a')](_0x27b7c2);var _0x245a16={'channel':'Whatsapp','account':_0xe06ba2[_0x0fe7('0x67')][_0x0fe7('0x21')],'agent':_0xe06ba2['Owner']?_0xe06ba2[_0x0fe7('0x68')][_0x0fe7('0x69')]:_0x0fe7('0x6b'),'createdAt':moment(_0xe06ba2[_0x0fe7('0x6c')])[_0x0fe7('0x46')](_0x0fe7('0x47'))[_0x0fe7('0x6d')](),'closedAt':_0xe06ba2[_0x0fe7('0x6e')]?moment(_0xe06ba2[_0x0fe7('0x6f')])[_0x0fe7('0x46')](_0x0fe7('0x47'))[_0x0fe7('0x6d')]():'','disposition':_0xe06ba2[_0x0fe7('0x70')],'messages':_(_0xe06ba2[_0x0fe7('0x62')])[_0x0fe7('0x44')]({'secret':![]})[_0x0fe7('0x24')](function(_0xbc0500){if(_0xbc0500[_0x0fe7('0x61')]){var _0x490982=path[_0x0fe7('0x54')](_0x697102,_0xbc0500[_0x0fe7('0x61')]['basename']);if(fs['existsSync'](_0x490982)){fs['createReadStream'](_0x490982)['pipe'](fs[_0x0fe7('0x71')](path[_0x0fe7('0x54')](_0x27b7c2,_0xbc0500[_0x0fe7('0x61')]['basename'])));}}return{'date':moment(_0xbc0500[_0x0fe7('0x6c')])[_0x0fe7('0x46')](_0x0fe7('0x47'))[_0x0fe7('0x6d')](),'sender':_0xbc0500['direction']===_0x0fe7('0x72')?_0xbc0500[_0x0fe7('0x5c')]?_0xbc0500[_0x0fe7('0x5c')][_0x0fe7('0x69')]:_0x0fe7('0x73'):_0xbc0500['Contact'][_0x0fe7('0x5f')]+(_0xbc0500[_0x0fe7('0x5e')][_0x0fe7('0x60')]?'\x20'+_0xbc0500['Contact'][_0x0fe7('0x60')]:''),'body':_0xbc0500['Attachment']?_0xbc0500[_0x0fe7('0x61')][_0x0fe7('0x74')]:_0xbc0500['body'],'direction':_0xbc0500[_0x0fe7('0x63')]==='out'?'A':'C','secret':_0xbc0500[_0x0fe7('0x64')],'read':_0xbc0500[_0x0fe7('0x65')],'attachment':_0xbc0500[_0x0fe7('0x61')]};})[_0x0fe7('0x75')]()};return ejs[_0x0fe7('0x76')](path[_0x0fe7('0x54')](config[_0x0fe7('0x55')],_0x0fe7('0x56'),_0x0fe7('0x77'),_0x0fe7('0x78')),{'interaction':_0x245a16})['then'](function(_0xa5f8ce){var _0x53ca89=path[_0x0fe7('0x54')](_0x27b7c2,'transcript-'+_0xe06ba2['id']+'-'+_0x3a9808+_0x0fe7('0x79'));var _0x5e43b9={'path':_0x53ca89,'channel':'Whatsapp','interactionId':_0xe06ba2['id']};return pdf['createPdfFromHTML'](_0xa5f8ce,_0x5e43b9);})[_0x0fe7('0x1d')](function(){return new BPromise(function(_0x4af088,_0x33ff9b){zipdir(_0x27b7c2,{'saveTo':_0x583f48},function(_0x840296,_0x2cda5a){if(_0x840296)return _0x33ff9b(_0x840296);return _0x4af088(_0x2cda5a);});})[_0x0fe7('0x1d')](function(){return new BPromise(function(_0x3f573b,_0x169b6e){rimraf(_0x27b7c2,function(_0x2ec449){if(_0x2ec449)_0x169b6e(_0x2ec449);return _0x3f573b();});});})[_0x0fe7('0x1d')](function(){return _0x5d4d02[_0x0fe7('0x52')](_0x583f48,_0x279a38,function(_0x525e86){if(_0x525e86){console[_0x0fe7('0x7a')]('err',_0x525e86);}else{fs['unlinkSync'](_0x583f48);}});});});}else{return _0x5d4d02[_0x0fe7('0x12')](0xc8);}})[_0x0fe7('0x38')](handleError(_0x5d4d02,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 92db991..e37ec5a 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 _0x453b=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x28b686,_0x212267){var _0xb43315=function(_0x19633f){while(--_0x19633f){_0x28b686['push'](_0x28b686['shift']());}};_0xb43315(++_0x212267);}(_0x453b,0x164));var _0xb453=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x453b[_0x2d4661];return _0x42ed1e;};'use strict';var EventEmitter=require(_0xb453('0x0'));var WhatsappInteraction=require(_0xb453('0x1'))['db'][_0xb453('0x2')];var WhatsappMessage=require(_0xb453('0x1'))['db'][_0xb453('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb453('0x4')](0x0);var events={'afterCreate':_0xb453('0x5'),'afterUpdate':_0xb453('0x6'),'afterDestroy':_0xb453('0x7')};function emitEvent(_0x1314f4){return function(_0x6ee7a0,_0x3cfd60,_0x434695){_0x6ee7a0[_0xb453('0x8')]({'attributes':['id'],'raw':!![]})[_0xb453('0x9')](function(_0x2436a7){_0x6ee7a0['setDataValue'](_0xb453('0xa'),_0x2436a7[_0xb453('0xb')](function(_0x55b2fa){return{'id':_0x55b2fa['id']};}));return WhatsappMessage[_0xb453('0xc')]({'where':{'WhatsappInteractionId':_0x6ee7a0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x894303){_0x6ee7a0[_0xb453('0xd')](_0xb453('0xe'),_0x894303[_0xb453('0xf')]);WhatsappInteractionEvents['emit'](_0x1314f4+':'+_0x6ee7a0['id'],_0x6ee7a0);WhatsappInteractionEvents[_0xb453('0x10')](_0x1314f4,_0x6ee7a0);_0x434695(null);})[_0xb453('0x11')](_0x434695(null));};}for(var e in events){if(events[_0xb453('0x12')](e)){var event=events[e];WhatsappInteraction[_0xb453('0x13')](e,emitEvent(event));}}module[_0xb453('0x14')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x8b1a=['hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','setDataValue','map','then','emit','catch','hasOwnProperty'];(function(_0x59367f,_0x4ef562){var _0x14cb44=function(_0x1058f0){while(--_0x1058f0){_0x59367f['push'](_0x59367f['shift']());}};_0x14cb44(++_0x4ef562);}(_0x8b1a,0x152));var _0xa8b1=function(_0x20ca2d,_0x46fbf9){_0x20ca2d=_0x20ca2d-0x0;var _0x20ac11=_0x8b1a[_0x20ca2d];return _0x20ac11;};'use strict';var EventEmitter=require(_0xa8b1('0x0'));var WhatsappInteraction=require(_0xa8b1('0x1'))['db'][_0xa8b1('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xa8b1('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa8b1('0x4')](0x0);var events={'afterCreate':_0xa8b1('0x5'),'afterUpdate':'update','afterDestroy':_0xa8b1('0x6')};function emitEvent(_0x2427cc){return function(_0x1981aa,_0xf65f47,_0x493b8e){_0x1981aa[_0xa8b1('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a3030){_0x1981aa[_0xa8b1('0x8')]('Users',_0x2a3030[_0xa8b1('0x9')](function(_0x27f578){return{'id':_0x27f578['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1981aa['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa8b1('0xa')](function(_0x2f0be9){_0x1981aa[_0xa8b1('0x8')]('unreadMessages',_0x2f0be9['length']);WhatsappInteractionEvents[_0xa8b1('0xb')](_0x2427cc+':'+_0x1981aa['id'],_0x1981aa);WhatsappInteractionEvents['emit'](_0x2427cc,_0x1981aa);_0x493b8e(null);})[_0xa8b1('0xc')](_0x493b8e(null));};}for(var e in events){if(events[_0xa8b1('0xd')](e)){var event=events[e];WhatsappInteraction[_0xa8b1('0xe')](e,emitEvent(event));}}module[_0xa8b1('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index c930672..bce4cb5 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 _0x5c1a=['util','../../config/logger','api','bluebird','request-promise','path','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x31f7f7,_0x91c06c){var _0x24e375=function(_0x617c3e){while(--_0x617c3e){_0x31f7f7['push'](_0x31f7f7['shift']());}};_0x24e375(++_0x91c06c);}(_0x5c1a,0x13f));var _0xa5c1=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0x5c1a[_0x1c7889];return _0x2f14e5;};'use strict';var _=require('lodash');var util=require(_0xa5c1('0x0'));var logger=require(_0xa5c1('0x1'))(_0xa5c1('0x2'));var moment=require('moment');var BPromise=require(_0xa5c1('0x3'));var rp=require(_0xa5c1('0x4'));var fs=require('fs');var path=require(_0xa5c1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa5c1('0x6'));module[_0xa5c1('0x7')]=function(_0x3d0fa6,_0x4f6180){return _0x3d0fa6[_0xa5c1('0x8')](_0xa5c1('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x54a185,_0x57ccd2,_0x1e55c7){if(_0x54a185['changed']('closed')){_0x54a185['closedAt']=moment()['format'](_0xa5c1('0xa'));}_0x1e55c7(null,_0x54a185);}}});}; \ No newline at end of file +var _0xbc5f=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0xbc5f,0x140));var _0xfbc5=function(_0x2dee0c,_0x306288){_0x2dee0c=_0x2dee0c-0x0;var _0x5cbdeb=_0xbc5f[_0x2dee0c];return _0x5cbdeb;};'use strict';var _=require(_0xfbc5('0x0'));var util=require(_0xfbc5('0x1'));var logger=require(_0xfbc5('0x2'))(_0xfbc5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfbc5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbc5('0x5'));var config=require(_0xfbc5('0x6'));var attributes=require(_0xfbc5('0x7'));module[_0xfbc5('0x8')]=function(_0x11d6ba,_0x2d89cf){return _0x11d6ba[_0xfbc5('0x9')](_0xfbc5('0xa'),attributes,{'tableName':_0xfbc5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f891b,_0x5914db,_0x3668df){if(_0x3f891b[_0xfbc5('0xc')](_0xfbc5('0xd'))){_0x3f891b['closedAt']=moment()[_0xfbc5('0xe')](_0xfbc5('0xf'));}_0x3668df(null,_0x3f891b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 7cdb6f7..9d0c94d 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 _0xa834=['error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','then','stringify','catch','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xa834,0x142));var _0x4a83=function(_0x3a5105,_0x11f35c){_0x3a5105=_0x3a5105-0x0;var _0x53633f=_0xa834[_0x3a5105];return _0x53633f;};'use strict';var _=require(_0x4a83('0x0'));var util=require('util');var moment=require(_0x4a83('0x1'));var BPromise=require(_0x4a83('0x2'));var rs=require(_0x4a83('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a83('0x4'))['db'];var utils=require(_0x4a83('0x5'));var logger=require(_0x4a83('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4a83('0x7'));var client=jayson[_0x4a83('0x8')][_0x4a83('0x9')]({'port':0x232a});config[_0x4a83('0xa')]=_[_0x4a83('0xb')](config['redis'],{'host':_0x4a83('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a83('0xa')]));require(_0x4a83('0xd'))[_0x4a83('0xe')](socket);function respondWithRpcPromise(_0x1f70d0,_0x121928,_0x244669){return new BPromise(function(_0x4379f3,_0x544827){return client[_0x4a83('0xf')](_0x1f70d0,_0x244669)['then'](function(_0x5c893a){logger[_0x4a83('0x10')](_0x4a83('0x11'),_0x121928,_0x4a83('0x12'));logger[_0x4a83('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x121928,_0x4a83('0x12'),JSON['stringify'](_0x5c893a));if(_0x5c893a[_0x4a83('0x14')]){if(_0x5c893a[_0x4a83('0x14')]['code']===0x1f4){logger[_0x4a83('0x14')](_0x4a83('0x11'),_0x121928,_0x5c893a[_0x4a83('0x14')][_0x4a83('0x15')]);return _0x544827(_0x5c893a[_0x4a83('0x14')]['message']);}logger[_0x4a83('0x14')](_0x4a83('0x11'),_0x121928,_0x5c893a[_0x4a83('0x14')]['message']);return _0x4379f3(_0x5c893a[_0x4a83('0x14')]['message']);}else{logger[_0x4a83('0x10')](_0x4a83('0x11'),_0x121928,_0x4a83('0x12'));_0x4379f3(_0x5c893a[_0x4a83('0x16')][_0x4a83('0x15')]);}})['catch'](function(_0x4e6c2e){logger[_0x4a83('0x14')](_0x4a83('0x11'),_0x121928,_0x4e6c2e);_0x544827(_0x4e6c2e);});});}exports[_0x4a83('0x17')]=function(_0x34c755){var _0x3f200a=this;return new Promise(function(_0x49e891,_0x4c7f8c){return db[_0x4a83('0x18')]['update'](_0x34c755[_0x4a83('0x19')],{'raw':_0x34c755[_0x4a83('0x1a')]?_0x34c755[_0x4a83('0x1a')][_0x4a83('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34c755[_0x4a83('0x1a')]?_0x34c755['options'][_0x4a83('0x1c')]||null:null,'attributes':_0x34c755[_0x4a83('0x1a')]?_0x34c755[_0x4a83('0x1a')][_0x4a83('0x1d')]||null:null,'limit':_0x34c755[_0x4a83('0x1a')]?_0x34c755[_0x4a83('0x1a')]['limit']||null:null})[_0x4a83('0x1e')](function(_0x260d6d){logger[_0x4a83('0x10')](_0x4a83('0x17'),_0x34c755);logger[_0x4a83('0x13')](_0x4a83('0x17'),_0x34c755,JSON[_0x4a83('0x1f')](_0x260d6d));_0x49e891(_0x260d6d);})[_0x4a83('0x20')](function(_0x563f20){logger[_0x4a83('0x14')](_0x4a83('0x17'),_0x563f20[_0x4a83('0x15')],_0x34c755);_0x4c7f8c(_0x3f200a[_0x4a83('0x14')](0x1f4,_0x563f20['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4ccaef){return new Promise(function(_0xce2315,_0x38f7ef){return db[_0x4a83('0x18')]['find']({'where':_0x4ccaef[_0x4a83('0x1a')]?_0x4ccaef[_0x4a83('0x1a')][_0x4a83('0x1c')]||null:null})[_0x4a83('0x1e')](function(_0x32e109){if(_0x32e109){return _0x32e109[_0x4a83('0x21')](_0x4ccaef['body'][_0x4a83('0x22')],_[_0x4a83('0x23')](_0x4ccaef[_0x4a83('0x19')],[_0x4a83('0x22'),'id'])||{});}})[_0x4a83('0x24')](function(_0x232758){logger[_0x4a83('0x10')](_0x4a83('0x25'),_0x4ccaef);logger['debug']('AddTags',_0x4ccaef,JSON['stringify'](_0x232758));_0xce2315(_0x232758);})[_0x4a83('0x20')](function(_0x441b93){logger[_0x4a83('0x14')](_0x4a83('0x25'),_0x441b93[_0x4a83('0x15')],_0x4ccaef);_0x38f7ef(_this[_0x4a83('0x14')](0x1f4,_0x441b93['message']));});});}; \ No newline at end of file +var _0xe6a0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','limit','catch','AddTagsToWhatsappInteraction','find','ids','spread','AddTags','util','moment','bluebird','randomstring'];(function(_0x5caffd,_0x4a0bad){var _0x4431ce=function(_0x29fea8){while(--_0x29fea8){_0x5caffd['push'](_0x5caffd['shift']());}};_0x4431ce(++_0x4a0bad);}(_0xe6a0,0xbf));var _0x0e6a=function(_0xf36664,_0x38834d){_0xf36664=_0xf36664-0x0;var _0x25a5a9=_0xe6a0[_0xf36664];return _0x25a5a9;};'use strict';var _=require('lodash');var util=require(_0x0e6a('0x0'));var moment=require(_0x0e6a('0x1'));var BPromise=require(_0x0e6a('0x2'));var rs=require(_0x0e6a('0x3'));var fs=require('fs');var Redis=require(_0x0e6a('0x4'));var db=require(_0x0e6a('0x5'))['db'];var utils=require(_0x0e6a('0x6'));var logger=require(_0x0e6a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0e6a('0x8'));var client=jayson[_0x0e6a('0x9')][_0x0e6a('0xa')]({'port':0x232a});config[_0x0e6a('0xb')]=_['defaults'](config['redis'],{'host':_0x0e6a('0xc'),'port':0x18eb});var socket=require(_0x0e6a('0xd'))(new Redis(config['redis']));require(_0x0e6a('0xe'))[_0x0e6a('0xf')](socket);function respondWithRpcPromise(_0x27e4a5,_0x1aa31a,_0x4532f3){return new BPromise(function(_0x1995ca,_0x380398){return client['request'](_0x27e4a5,_0x4532f3)[_0x0e6a('0x10')](function(_0x49825d){logger[_0x0e6a('0x11')](_0x0e6a('0x12'),_0x1aa31a,'request\x20sent');logger[_0x0e6a('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1aa31a,_0x0e6a('0x14'),JSON['stringify'](_0x49825d));if(_0x49825d[_0x0e6a('0x15')]){if(_0x49825d['error'][_0x0e6a('0x16')]===0x1f4){logger[_0x0e6a('0x15')](_0x0e6a('0x12'),_0x1aa31a,_0x49825d['error'][_0x0e6a('0x17')]);return _0x380398(_0x49825d[_0x0e6a('0x15')][_0x0e6a('0x17')]);}logger[_0x0e6a('0x15')](_0x0e6a('0x12'),_0x1aa31a,_0x49825d[_0x0e6a('0x15')][_0x0e6a('0x17')]);return _0x1995ca(_0x49825d[_0x0e6a('0x15')]['message']);}else{logger[_0x0e6a('0x11')](_0x0e6a('0x12'),_0x1aa31a,'request\x20sent');_0x1995ca(_0x49825d[_0x0e6a('0x18')][_0x0e6a('0x17')]);}})['catch'](function(_0x17e716){logger[_0x0e6a('0x15')](_0x0e6a('0x12'),_0x1aa31a,_0x17e716);_0x380398(_0x17e716);});});}exports[_0x0e6a('0x19')]=function(_0xa57b9b){var _0x2cff28=this;return new Promise(function(_0x189802,_0x27daaa){return db[_0x0e6a('0x1a')][_0x0e6a('0x1b')](_0xa57b9b[_0x0e6a('0x1c')],{'raw':_0xa57b9b[_0x0e6a('0x1d')]?_0xa57b9b[_0x0e6a('0x1d')][_0x0e6a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa57b9b[_0x0e6a('0x1d')]?_0xa57b9b['options']['where']||null:null,'attributes':_0xa57b9b[_0x0e6a('0x1d')]?_0xa57b9b[_0x0e6a('0x1d')][_0x0e6a('0x1f')]||null:null,'limit':_0xa57b9b[_0x0e6a('0x1d')]?_0xa57b9b[_0x0e6a('0x1d')][_0x0e6a('0x20')]||null:null})[_0x0e6a('0x10')](function(_0x478437){logger['info'](_0x0e6a('0x19'),_0xa57b9b);logger[_0x0e6a('0x13')](_0x0e6a('0x19'),_0xa57b9b,JSON['stringify'](_0x478437));_0x189802(_0x478437);})[_0x0e6a('0x21')](function(_0x56ad53){logger['error']('UpdateWhatsappInteraction',_0x56ad53['message'],_0xa57b9b);_0x27daaa(_0x2cff28[_0x0e6a('0x15')](0x1f4,_0x56ad53[_0x0e6a('0x17')]));});});};exports[_0x0e6a('0x22')]=function(_0x1d88b3){return new Promise(function(_0xeac59c,_0xea8e7d){return db[_0x0e6a('0x1a')][_0x0e6a('0x23')]({'where':_0x1d88b3[_0x0e6a('0x1d')]?_0x1d88b3[_0x0e6a('0x1d')]['where']||null:null})[_0x0e6a('0x10')](function(_0xe598e3){if(_0xe598e3){return _0xe598e3['addTags'](_0x1d88b3[_0x0e6a('0x1c')]['ids'],_['omit'](_0x1d88b3[_0x0e6a('0x1c')],[_0x0e6a('0x24'),'id'])||{});}})[_0x0e6a('0x25')](function(_0x53bb2e){logger['info']('AddTags',_0x1d88b3);logger['debug']('AddTags',_0x1d88b3,JSON['stringify'](_0x53bb2e));_0xeac59c(_0x53bb2e);})[_0x0e6a('0x21')](function(_0x37e451){logger['error'](_0x0e6a('0x26'),_0x37e451[_0x0e6a('0x17')],_0x1d88b3);_0xea8e7d(_this[_0x0e6a('0x15')](0x1f4,_0x37e451[_0x0e6a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index c44be58..058816d 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 _0x111c=['./whatsappInteraction.events','save','register','length','whatsappInteraction:'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x111c,0xb4));var _0xc111=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x111c[_0x501510];return _0x1e6ee5;};'use strict';var WhatsappInteractionEvents=require(_0xc111('0x0'));var events=[_0xc111('0x1'),'remove','update'];function createListener(_0x17a79a,_0x47534e){return function(_0x1833e2){_0x47534e['emit'](_0x17a79a,_0x1833e2);};}function removeListener(_0x1969c5,_0x417f4c){return function(){WhatsappInteractionEvents['removeListener'](_0x1969c5,_0x417f4c);};}exports[_0xc111('0x2')]=function(_0x1a5ef){for(var _0x53d87e=0x0,_0x1139f4=events[_0xc111('0x3')];_0x53d87e<_0x1139f4;_0x53d87e++){var _0x381f7f=events[_0x53d87e];var _0x43b7a9=createListener(_0xc111('0x4')+_0x381f7f,_0x1a5ef);WhatsappInteractionEvents['on'](_0x381f7f,_0x43b7a9);}}; \ No newline at end of file +var _0xb02c=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x15605c,_0x3cd2cb){var _0x3fd1b0=function(_0x23ee7d){while(--_0x23ee7d){_0x15605c['push'](_0x15605c['shift']());}};_0x3fd1b0(++_0x3cd2cb);}(_0xb02c,0x150));var _0xcb02=function(_0x3ef850,_0x3b1518){_0x3ef850=_0x3ef850-0x0;var _0x4fd306=_0xb02c[_0x3ef850];return _0x4fd306;};'use strict';var WhatsappInteractionEvents=require(_0xcb02('0x0'));var events=[_0xcb02('0x1'),_0xcb02('0x2'),_0xcb02('0x3')];function createListener(_0x237c89,_0x34c6ba){return function(_0x1aa0c6){_0x34c6ba[_0xcb02('0x4')](_0x237c89,_0x1aa0c6);};}function removeListener(_0x41831b,_0x572e8c){return function(){WhatsappInteractionEvents[_0xcb02('0x5')](_0x41831b,_0x572e8c);};}exports[_0xcb02('0x6')]=function(_0x27954a){for(var _0x37fbf2=0x0,_0x234ad3=events[_0xcb02('0x7')];_0x37fbf2<_0x234ad3;_0x37fbf2++){var _0x3e5bf5=events[_0x37fbf2];var _0x3da4a4=createListener(_0xcb02('0x8')+_0x3e5bf5,_0x27954a);WhatsappInteractionEvents['on'](_0x3e5bf5,_0x3da4a4);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d81080d..e3d4965 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 _0x0ca9=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','tracked','whatsappmessage:create','post','/:id/status','put','/:id','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x5a839d,_0x4c4ef7){var _0x1ca7ab=function(_0x400a86){while(--_0x400a86){_0x5a839d['push'](_0x5a839d['shift']());}};_0x1ca7ab(++_0x4c4ef7);}(_0x0ca9,0x1d7));var _0x90ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ca9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x90ca('0x0'));var util=require(_0x90ca('0x1'));var path=require(_0x90ca('0x2'));var timeout=require(_0x90ca('0x3'));var express=require(_0x90ca('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90ca('0x5'));var interaction=require(_0x90ca('0x6'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x90ca('0x7')]('/',auth[_0x90ca('0x8')](),controller['index']);router[_0x90ca('0x7')](_0x90ca('0x9'),auth[_0x90ca('0x8')](),controller[_0x90ca('0xa')]);router[_0x90ca('0x7')]('/:id',auth[_0x90ca('0x8')](),controller[_0x90ca('0xb')]);router['post']('/',auth[_0x90ca('0x8')](),interaction[_0x90ca('0xc')]('whatsapp',_0x90ca('0xd')),controller['create']);router[_0x90ca('0xe')](_0x90ca('0xf'),controller['status']);router[_0x90ca('0x10')](_0x90ca('0x11'),auth[_0x90ca('0x8')](),controller[_0x90ca('0x12')]);router['put'](_0x90ca('0x13'),auth['isAuthenticated'](),controller[_0x90ca('0x14')]);router['put'](_0x90ca('0x15'),auth[_0x90ca('0x8')](),controller[_0x90ca('0x16')]);router[_0x90ca('0x17')](_0x90ca('0x11'),auth[_0x90ca('0x8')](),controller[_0x90ca('0x18')]);module[_0x90ca('0x19')]=router; \ No newline at end of file +var _0x6428=['post','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x6428,0x153));var _0x8642=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x6428[_0x4d1ee9];return _0x9a5456;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8642('0x0'));var timeout=require(_0x8642('0x1'));var express=require(_0x8642('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8642('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8642('0x4'));var controller=require('./whatsappMessage.controller');router[_0x8642('0x5')]('/',auth[_0x8642('0x6')](),controller[_0x8642('0x7')]);router[_0x8642('0x5')](_0x8642('0x8'),auth[_0x8642('0x6')](),controller[_0x8642('0x9')]);router[_0x8642('0x5')]('/:id',auth[_0x8642('0x6')](),controller[_0x8642('0xa')]);router[_0x8642('0xb')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x8642('0xc'),_0x8642('0xd')),controller[_0x8642('0xe')]);router['post'](_0x8642('0xf'),controller['status']);router[_0x8642('0x10')]('/:id',auth[_0x8642('0x6')](),controller[_0x8642('0x11')]);router[_0x8642('0x10')](_0x8642('0x12'),auth[_0x8642('0x6')](),controller[_0x8642('0x13')]);router[_0x8642('0x10')](_0x8642('0x14'),auth[_0x8642('0x6')](),controller[_0x8642('0x15')]);router[_0x8642('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x8642('0x17')]);module[_0x8642('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7db94af..79fe960 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 _0xf76f=['out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x14aa55,_0x3b1edf){var _0x322a06=function(_0x5e2779){while(--_0x5e2779){_0x14aa55['push'](_0x14aa55['shift']());}};_0x322a06(++_0x3b1edf);}(_0xf76f,0x19b));var _0xff76=function(_0x4fdcd6,_0x348c08){_0x4fdcd6=_0x4fdcd6-0x0;var _0x15e49d=_0xf76f[_0x4fdcd6];return _0x15e49d;};'use strict';var Sequelize=require(_0xff76('0x0'));module['exports']={'body':{'type':Sequelize[_0xff76('0x1')](_0xff76('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xff76('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xff76('0x4')]('in',_0xff76('0x5')),'defaultValue':_0xff76('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xff76('0x6')](0xbe)},'phone':{'type':Sequelize[_0xff76('0x6')]},'readAt':{'type':Sequelize[_0xff76('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xff76('0x1')]}}; \ No newline at end of file +var _0x0327=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x36f964,_0x2cc447){var _0x1790d9=function(_0x5a14e4){while(--_0x5a14e4){_0x36f964['push'](_0x36f964['shift']());}};_0x1790d9(++_0x2cc447);}(_0x0327,0x18f));var _0x7032=function(_0x1d4ede,_0x14bd49){_0x1d4ede=_0x1d4ede-0x0;var _0x21fa4e=_0x0327[_0x1d4ede];return _0x21fa4e;};'use strict';var Sequelize=require(_0x7032('0x0'));module[_0x7032('0x1')]={'body':{'type':Sequelize[_0x7032('0x2')](_0x7032('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7032('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7032('0x5')]('in',_0x7032('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7032('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x7032('0x8')]},'secret':{'type':Sequelize[_0x7032('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7032('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index bb374de..60b21d0 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 _0xab76=['include','findAll','rows','show','params','keys','includeAll','find','create','body','destroy','describe','accept','whatsapp','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','RejectMessage','rejectMessage','sequelize','QueryTypes','SELECT','contact','fullname','internal','SIP/%s','channel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','client','whatsapp-interactions','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','undefined','count','offset','limit','status','set','Content-Range','update','then','end','sendStatus','name','send','map','WhatsappMessage','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x64ab38,_0x477a0c){var _0x4c93d9=function(_0x23ab68){while(--_0x23ab68){_0x64ab38['push'](_0x64ab38['shift']());}};_0x4c93d9(++_0x477a0c);}(_0xab76,0x1cc));var _0x6ab7=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xab76[_0x618414];return _0x21c19a;};'use strict';var util=require(_0x6ab7('0x0'));var _=require(_0x6ab7('0x1'));var Redis=require(_0x6ab7('0x2'));var interactionService=require(_0x6ab7('0x3'));var qs=require(_0x6ab7('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x6ab7('0x5'));var db=require(_0x6ab7('0x6'))['db'];config[_0x6ab7('0x7')]=_[_0x6ab7('0x8')](config[_0x6ab7('0x7')],{'host':_0x6ab7('0x9'),'port':0x18eb});var socket=require(_0x6ab7('0xa'))(new Redis(config[_0x6ab7('0x7')]));require(_0x6ab7('0xb'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6ab7('0xc')]['http']({'port':0x232c});var client9002=jayson[_0x6ab7('0xc')]['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0x6ab7('0xd'));function respondWithRpcPromise(_0x1d2f1e,_0x4d1366,_0x5c548f,_0x4f0854){return new Promise(function(_0x2b73fe,_0x2786f2){var _0xe9b4b5=_0x4f0854||client;return _0xe9b4b5[_0x6ab7('0xe')](_0x1d2f1e,_0x5c548f)['then'](function(_0x548921){logger[_0x6ab7('0xf')](_0x6ab7('0x10'),_0x4d1366,_0x6ab7('0x11'));logger[_0x6ab7('0x12')](_0x6ab7('0x13'),_0x4d1366,'request\x20sent',JSON[_0x6ab7('0x14')](_0x548921));if(_0x548921[_0x6ab7('0x15')]){if(_0x548921[_0x6ab7('0x15')][_0x6ab7('0x16')]===0x1f4){logger[_0x6ab7('0x15')](_0x6ab7('0x10'),_0x4d1366,_0x548921[_0x6ab7('0x15')][_0x6ab7('0x17')]);return _0x2786f2(_0x548921[_0x6ab7('0x15')][_0x6ab7('0x17')]);}logger[_0x6ab7('0x15')](_0x6ab7('0x10'),_0x4d1366,_0x548921[_0x6ab7('0x15')][_0x6ab7('0x17')]);return _0x2b73fe(_0x548921[_0x6ab7('0x15')][_0x6ab7('0x17')]);}else{logger[_0x6ab7('0xf')](_0x6ab7('0x10'),_0x4d1366,_0x6ab7('0x11'));_0x2b73fe(_0x548921[_0x6ab7('0x18')][_0x6ab7('0x17')]);}})[_0x6ab7('0x19')](function(_0x4fd060){logger['error'](_0x6ab7('0x10'),_0x4d1366,_0x4fd060);_0x2786f2(_0x4fd060);});});}function respondWithResult(_0x5abf9b,_0x121d8f){_0x121d8f=_0x121d8f||0xc8;return function(_0x314f19){if(_0x314f19){return _0x5abf9b['status'](_0x121d8f)[_0x6ab7('0x1a')](_0x314f19);}};}function respondWithFilteredResult(_0x1a3fc2,_0x3e426d){return function(_0x489d4b){if(_0x489d4b){var _0x2f4d54=typeof _0x3e426d['offset']==='undefined'&&typeof _0x3e426d['limit']===_0x6ab7('0x1b');var _0x1ce1d2=_0x489d4b[_0x6ab7('0x1c')];var _0x5cb9dc=_0x2f4d54?0x0:_0x3e426d[_0x6ab7('0x1d')];var _0x474068=_0x2f4d54?_0x489d4b[_0x6ab7('0x1c')]:_0x3e426d[_0x6ab7('0x1d')]+_0x3e426d[_0x6ab7('0x1e')];var _0xd3c53e;if(_0x474068>=_0x1ce1d2){_0x474068=_0x1ce1d2;_0xd3c53e=0xc8;}else{_0xd3c53e=0xce;}_0x1a3fc2[_0x6ab7('0x1f')](_0xd3c53e);return _0x1a3fc2[_0x6ab7('0x20')](_0x6ab7('0x21'),_0x5cb9dc+'-'+_0x474068+'/'+_0x1ce1d2)[_0x6ab7('0x1a')](_0x489d4b);}return null;};}function saveUpdates(_0x10c2b8){return function(_0x63afb0){if(_0x63afb0){return _0x63afb0[_0x6ab7('0x22')](_0x10c2b8)[_0x6ab7('0x23')](function(_0x499afc){return _0x499afc;});}return null;};}function removeEntity(_0x1748e1){return function(_0x2cb2da){if(_0x2cb2da){return _0x2cb2da['destroy']()['then'](function(){_0x1748e1['status'](0xcc)[_0x6ab7('0x24')]();});}};}function handleEntityNotFound(_0x53f597){return function(_0x52898d){if(!_0x52898d){_0x53f597[_0x6ab7('0x25')](0x194);}return _0x52898d;};}function handleError(_0x14b76d,_0x243f7c){_0x243f7c=_0x243f7c||0x1f4;return function(_0x3cfe2a){logger[_0x6ab7('0x15')](_0x3cfe2a['stack']);if(_0x3cfe2a['name']){delete _0x3cfe2a[_0x6ab7('0x26')];}_0x14b76d[_0x6ab7('0x1f')](_0x243f7c)[_0x6ab7('0x27')](_0x3cfe2a);};}exports['index']=function(_0x389399,_0x168322){var _0x13cd3c={},_0x327a34={},_0x56ccfe={'count':0x0,'rows':[]};var _0xd3992d=_[_0x6ab7('0x28')](db[_0x6ab7('0x29')][_0x6ab7('0x2a')],function(_0x4e5099){return{'name':_0x4e5099['fieldName'],'type':_0x4e5099[_0x6ab7('0x2b')]['key']};});_0x327a34[_0x6ab7('0x2c')]=_[_0x6ab7('0x28')](_0xd3992d,'name');_0x327a34['query']=_['keys'](_0x389399[_0x6ab7('0x2d')]);_0x327a34[_0x6ab7('0x2e')]=_[_0x6ab7('0x2f')](_0x327a34[_0x6ab7('0x2c')],_0x327a34[_0x6ab7('0x2d')]);_0x13cd3c['attributes']=_[_0x6ab7('0x2f')](_0x327a34['model'],qs[_0x6ab7('0x30')](_0x389399[_0x6ab7('0x2d')][_0x6ab7('0x30')]));_0x13cd3c[_0x6ab7('0x31')]=_0x13cd3c[_0x6ab7('0x31')][_0x6ab7('0x32')]?_0x13cd3c[_0x6ab7('0x31')]:_0x327a34[_0x6ab7('0x2c')];if(!_0x389399[_0x6ab7('0x2d')]['hasOwnProperty'](_0x6ab7('0x33'))){_0x13cd3c[_0x6ab7('0x1e')]=qs[_0x6ab7('0x1e')](_0x389399[_0x6ab7('0x2d')][_0x6ab7('0x1e')]);_0x13cd3c[_0x6ab7('0x1d')]=qs[_0x6ab7('0x1d')](_0x389399[_0x6ab7('0x2d')][_0x6ab7('0x1d')]);}_0x13cd3c[_0x6ab7('0x34')]=qs[_0x6ab7('0x35')](_0x389399['query'][_0x6ab7('0x35')]);_0x13cd3c[_0x6ab7('0x36')]=qs[_0x6ab7('0x2e')](_[_0x6ab7('0x37')](_0x389399[_0x6ab7('0x2d')],_0x327a34[_0x6ab7('0x2e')]),_0xd3992d);if(_0x389399[_0x6ab7('0x2d')][_0x6ab7('0x38')]){_0x13cd3c[_0x6ab7('0x36')]=_[_0x6ab7('0x39')](_0x13cd3c[_0x6ab7('0x36')],{'$or':_[_0x6ab7('0x28')](_0xd3992d,function(_0x52c453){if(_0x52c453['type']!==_0x6ab7('0x3a')){var _0x3602c8={};_0x3602c8[_0x52c453['name']]={'$like':'%'+_0x389399[_0x6ab7('0x2d')][_0x6ab7('0x38')]+'%'};return _0x3602c8;}})});}_0x13cd3c=_[_0x6ab7('0x39')]({},_0x13cd3c,_0x389399[_0x6ab7('0x3b')]);var _0x245a92={'where':_0x13cd3c[_0x6ab7('0x36')]};return db[_0x6ab7('0x29')][_0x6ab7('0x1c')](_0x245a92)[_0x6ab7('0x23')](function(_0x53600c){_0x56ccfe['count']=_0x53600c;if(_0x389399[_0x6ab7('0x2d')]['includeAll']){_0x13cd3c[_0x6ab7('0x3c')]=[{'all':!![]}];}return db[_0x6ab7('0x29')][_0x6ab7('0x3d')](_0x13cd3c);})['then'](function(_0x403a31){_0x56ccfe[_0x6ab7('0x3e')]=_0x403a31;return _0x56ccfe;})[_0x6ab7('0x23')](respondWithFilteredResult(_0x168322,_0x13cd3c))[_0x6ab7('0x19')](handleError(_0x168322,null));};exports[_0x6ab7('0x3f')]=function(_0x5eb99f,_0x447985){var _0x5b38fa={'raw':!![],'where':{'id':_0x5eb99f[_0x6ab7('0x40')]['id']}},_0x2ab4f9={};_0x2ab4f9[_0x6ab7('0x2c')]=_[_0x6ab7('0x41')](db['WhatsappMessage'][_0x6ab7('0x2a')]);_0x2ab4f9[_0x6ab7('0x2d')]=_[_0x6ab7('0x41')](_0x5eb99f[_0x6ab7('0x2d')]);_0x2ab4f9[_0x6ab7('0x2e')]=_['intersection'](_0x2ab4f9[_0x6ab7('0x2c')],_0x2ab4f9['query']);_0x5b38fa['attributes']=_[_0x6ab7('0x2f')](_0x2ab4f9[_0x6ab7('0x2c')],qs[_0x6ab7('0x30')](_0x5eb99f['query'][_0x6ab7('0x30')]));_0x5b38fa['attributes']=_0x5b38fa[_0x6ab7('0x31')][_0x6ab7('0x32')]?_0x5b38fa[_0x6ab7('0x31')]:_0x2ab4f9[_0x6ab7('0x2c')];if(_0x5eb99f[_0x6ab7('0x2d')][_0x6ab7('0x42')]){_0x5b38fa['include']=[{'all':!![]}];}_0x5b38fa=_[_0x6ab7('0x39')]({},_0x5b38fa,_0x5eb99f[_0x6ab7('0x3b')]);return db[_0x6ab7('0x29')][_0x6ab7('0x43')](_0x5b38fa)[_0x6ab7('0x23')](handleEntityNotFound(_0x447985,null))[_0x6ab7('0x23')](respondWithResult(_0x447985,null))[_0x6ab7('0x19')](handleError(_0x447985,null));};exports[_0x6ab7('0x44')]=function(_0x1a720f,_0x7b3e9f){return db['WhatsappMessage'][_0x6ab7('0x44')](_0x1a720f[_0x6ab7('0x45')],{})[_0x6ab7('0x23')](respondWithResult(_0x7b3e9f,0xc9))[_0x6ab7('0x19')](handleError(_0x7b3e9f,null));};exports['update']=function(_0x2c1e1b,_0x37f7d5){if(_0x2c1e1b[_0x6ab7('0x45')]['id']){delete _0x2c1e1b[_0x6ab7('0x45')]['id'];}return db[_0x6ab7('0x29')][_0x6ab7('0x43')]({'where':{'id':_0x2c1e1b['params']['id']}})[_0x6ab7('0x23')](handleEntityNotFound(_0x37f7d5,null))[_0x6ab7('0x23')](saveUpdates(_0x2c1e1b[_0x6ab7('0x45')],null))[_0x6ab7('0x23')](respondWithResult(_0x37f7d5,null))[_0x6ab7('0x19')](handleError(_0x37f7d5,null));};exports[_0x6ab7('0x46')]=function(_0x2f010f,_0x1f1504){return db[_0x6ab7('0x29')][_0x6ab7('0x43')]({'where':{'id':_0x2f010f['params']['id']}})[_0x6ab7('0x23')](handleEntityNotFound(_0x1f1504,null))[_0x6ab7('0x23')](removeEntity(_0x1f1504,null))['catch'](handleError(_0x1f1504,null));};exports[_0x6ab7('0x47')]=function(_0x1d2e00,_0x436ac6){return db[_0x6ab7('0x29')][_0x6ab7('0x47')]()[_0x6ab7('0x23')](respondWithResult(_0x436ac6,null))[_0x6ab7('0x19')](handleError(_0x436ac6,null));};exports[_0x6ab7('0x48')]=function(_0x30dd12,_0x495cbd){var _0x4cd762=_0x6ab7('0x49');return interactionService['acceptMessage'](_0x30dd12,_0x4cd762)['then'](respondWithResult(_0x495cbd,null))[_0x6ab7('0x19')](handleError(_0x495cbd,null));};exports['reject']=function(_0x137635,_0x51c51b){var _0x8e011f={'agent':{},'channel':_0x6ab7('0x49')};if(_0x137635[_0x6ab7('0x45')]['id']){delete _0x137635['body']['id'];}_0x137635[_0x6ab7('0x45')][_0x6ab7('0x4a')]=_0x137635[_0x6ab7('0x45')][_0x6ab7('0x4a')]||_0x137635['user']['id'];_0x8e011f[_0x6ab7('0x4b')]['id']=_0x137635[_0x6ab7('0x45')][_0x6ab7('0x4a')];return db[_0x6ab7('0x29')][_0x6ab7('0x43')]({'where':{'id':_0x137635[_0x6ab7('0x40')]['id'],'UserId':null}})[_0x6ab7('0x23')](handleEntityNotFound(_0x51c51b,null))[_0x6ab7('0x23')](function(_0xa1edbc){if(_0xa1edbc){_0x8e011f[_0x6ab7('0x17')]=_0xa1edbc[_0x6ab7('0x4c')]({'plain':!![]});return db[_0x6ab7('0x4d')][_0x6ab7('0x43')]({'where':{'id':_0xa1edbc[_0x6ab7('0x4e')]}});}return null;})[_0x6ab7('0x23')](handleEntityNotFound(_0x51c51b,null))[_0x6ab7('0x23')](function(_0x5b95ba){if(_0x5b95ba){_0x8e011f[_0x6ab7('0x4f')]=_0x5b95ba[_0x6ab7('0x4c')]({'plain':!![]});interaction_log['info'](_0x6ab7('0x50'),_0x137635['user']['id'],_0x137635[_0x6ab7('0x51')]['name'],_0x137635[_0x6ab7('0x51')]['role'],_0x8e011f[_0x6ab7('0x4f')]['id'],_0x137635['body']?JSON[_0x6ab7('0x14')](_0x137635[_0x6ab7('0x45')]):_0x6ab7('0x52'));return respondWithRpcPromise(_0x6ab7('0x53'),_0x6ab7('0x54'),_0x8e011f);}return null;})[_0x6ab7('0x23')](function(_0x2e4234){var _0x3a6a00='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2e4234[_0x6ab7('0x17')]['ContactId'];return db[_0x6ab7('0x55')][_0x6ab7('0x2d')](_0x3a6a00,{'type':db['Sequelize'][_0x6ab7('0x56')][_0x6ab7('0x57')],'raw':!![]})[_0x6ab7('0x23')](function(_0x5793d6){return _0x5793d6;});})['then'](function(_0x464784){if(_0x464784){_0x8e011f[_0x6ab7('0x17')][_0x6ab7('0x58')]=_0x464784[0x0];if(!_0x137635[_0x6ab7('0x45')][_0x6ab7('0x4a')])return;return db['User'][_0x6ab7('0x43')]({'where':{'id':_0x137635[_0x6ab7('0x45')][_0x6ab7('0x4a')],'role':_0x6ab7('0x4b')},'attributes':['id',_0x6ab7('0x26'),_0x6ab7('0x59'),'email',_0x6ab7('0x5a')],'raw':!![]});}return null;})[_0x6ab7('0x23')](function(_0x57e667){if(!_0x57e667)return null;_0x8e011f[_0x6ab7('0x17')][_0x6ab7('0x4b')]=_0x57e667;return _0x8e011f;})[_0x6ab7('0x23')](function(_0x1ad852){if(_0x1ad852){_0x1ad852[_0x6ab7('0x17')]['interface']=util['format'](_0x6ab7('0x5b'),_0x137635[_0x6ab7('0x51')]['name']);_0x1ad852['message'][_0x6ab7('0x5c')]=_0x8e011f['channel'];_0x1ad852['message']['motionChannel']=_0x8e011f['channel'];_0x1ad852[_0x6ab7('0x17')][_0x6ab7('0x5d')]='reject';respondWithRpcPromise(_0x6ab7('0x5e'),_0x6ab7('0x5e'),{'event':_0x6ab7('0x5f'),'message':_0x1ad852[_0x6ab7('0x17')]},client9002);return _0x8e011f;}return null;})[_0x6ab7('0x23')](respondWithResult(_0x51c51b,null))[_0x6ab7('0x19')](handleError(_0x51c51b,null));};exports['status']=function(_0x66d312,_0x5ce40f){if(_0x66d312[_0x6ab7('0x45')]['id']){delete _0x66d312[_0x6ab7('0x45')]['id'];}var _0x25b7be;return db[_0x6ab7('0x29')][_0x6ab7('0x43')]({'where':{'id':_0x66d312['params']['id']}})[_0x6ab7('0x23')](handleEntityNotFound(_0x5ce40f,null))['then'](function(_0x5815f2){if(_0x5815f2){_0x25b7be=_0x5815f2;return db[_0x6ab7('0x60')]['find']({'where':{'id':_0x5815f2[_0x6ab7('0x61')]}});}})[_0x6ab7('0x23')](handleEntityNotFound(_0x5ce40f,null))['then'](function(_0x132eab){if(_0x132eab){logger[_0x6ab7('0x12')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x6ab7('0x62'),_0x132eab[_0x6ab7('0x2b')],util[_0x6ab7('0x63')](_0x66d312[_0x6ab7('0x45')],{'showHidden':![],'depth':null}));switch(_0x132eab['type']){case _0x6ab7('0x64'):if(_0x66d312[_0x6ab7('0x45')][_0x6ab7('0x65')]&&_0x66d312[_0x6ab7('0x45')]['MessageSid']===_0x25b7be[_0x6ab7('0x66')]&&_0x66d312['body']['MessageStatus']&&_0x66d312['body']['MessageStatus']==='read'){return _0x25b7be[_0x6ab7('0x22')]({'read':!![]});}else{logger['error'](_0x6ab7('0x67'),_0x6ab7('0x1f'),_0x6ab7('0x64'),util[_0x6ab7('0x63')](_0x66d312[_0x6ab7('0x45')],{'showHidden':![],'depth':null}));}break;}return _0x25b7be;}})[_0x6ab7('0x23')](respondWithResult(_0x5ce40f,null))[_0x6ab7('0x19')](handleError(_0x5ce40f,null));}; \ No newline at end of file +var _0x8497=['null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','interface','SIP/%s','channel','motionChannel','event','reject','EventManager','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','read','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','./whatsappMessage.socket','jayson/promise','client','http','whatsapp-interactions','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','json','limit','undefined','offset','Content-Range','update','destroy','end','sendStatus','name','index','map','WhatsappMessage','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','rows','params','find','create','body','describe','accept','whatsapp','UserId','user','agent','get','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x1387cb,_0x137c44){var _0x43bc67=function(_0x478a6e){while(--_0x478a6e){_0x1387cb['push'](_0x1387cb['shift']());}};_0x43bc67(++_0x137c44);}(_0x8497,0x1a9));var _0x7849=function(_0x491602,_0x932ba0){_0x491602=_0x491602-0x0;var _0x422f2f=_0x8497[_0x491602];return _0x422f2f;};'use strict';var util=require(_0x7849('0x0'));var _=require('lodash');var Redis=require(_0x7849('0x1'));var interactionService=require(_0x7849('0x2'));var qs=require(_0x7849('0x3'));var logger=require(_0x7849('0x4'))(_0x7849('0x5'));var config=require('../../config/environment');var db=require(_0x7849('0x6'))['db'];config[_0x7849('0x7')]=_['defaults'](config[_0x7849('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7849('0x7')]));require(_0x7849('0x8'))['register'](socket);var jayson=require(_0x7849('0x9'));var client=jayson[_0x7849('0xa')]['http']({'port':0x232c});var client9002=jayson['client'][_0x7849('0xb')]({'port':0x232a});var interaction_log=require(_0x7849('0x4'))(_0x7849('0xc'));function respondWithRpcPromise(_0xa2e564,_0x26f13a,_0x393ccd,_0x349c0b){return new Promise(function(_0x16a5f6,_0x41bc08){var _0xe6d712=_0x349c0b||client;return _0xe6d712[_0x7849('0xd')](_0xa2e564,_0x393ccd)[_0x7849('0xe')](function(_0x48f369){logger['info'](_0x7849('0xf'),_0x26f13a,_0x7849('0x10'));logger[_0x7849('0x11')](_0x7849('0x12'),_0x26f13a,_0x7849('0x10'),JSON[_0x7849('0x13')](_0x48f369));if(_0x48f369[_0x7849('0x14')]){if(_0x48f369[_0x7849('0x14')]['code']===0x1f4){logger['error'](_0x7849('0xf'),_0x26f13a,_0x48f369['error'][_0x7849('0x15')]);return _0x41bc08(_0x48f369[_0x7849('0x14')][_0x7849('0x15')]);}logger[_0x7849('0x14')](_0x7849('0xf'),_0x26f13a,_0x48f369[_0x7849('0x14')][_0x7849('0x15')]);return _0x16a5f6(_0x48f369[_0x7849('0x14')][_0x7849('0x15')]);}else{logger[_0x7849('0x16')](_0x7849('0xf'),_0x26f13a,_0x7849('0x10'));_0x16a5f6(_0x48f369[_0x7849('0x17')]['message']);}})[_0x7849('0x18')](function(_0x3abccc){logger['error'](_0x7849('0xf'),_0x26f13a,_0x3abccc);_0x41bc08(_0x3abccc);});});}function respondWithResult(_0x17e5cb,_0x582813){_0x582813=_0x582813||0xc8;return function(_0x5ee868){if(_0x5ee868){return _0x17e5cb[_0x7849('0x19')](_0x582813)[_0x7849('0x1a')](_0x5ee868);}};}function respondWithFilteredResult(_0x12ec55,_0x48d58c){return function(_0x321df2){if(_0x321df2){var _0x271e04=typeof _0x48d58c['offset']==='undefined'&&typeof _0x48d58c[_0x7849('0x1b')]===_0x7849('0x1c');var _0x2ace89=_0x321df2['count'];var _0x243c0b=_0x271e04?0x0:_0x48d58c[_0x7849('0x1d')];var _0x5f1a25=_0x271e04?_0x321df2['count']:_0x48d58c[_0x7849('0x1d')]+_0x48d58c[_0x7849('0x1b')];var _0x523b6a;if(_0x5f1a25>=_0x2ace89){_0x5f1a25=_0x2ace89;_0x523b6a=0xc8;}else{_0x523b6a=0xce;}_0x12ec55['status'](_0x523b6a);return _0x12ec55['set'](_0x7849('0x1e'),_0x243c0b+'-'+_0x5f1a25+'/'+_0x2ace89)[_0x7849('0x1a')](_0x321df2);}return null;};}function saveUpdates(_0x4d16b9){return function(_0x2c9d8e){if(_0x2c9d8e){return _0x2c9d8e[_0x7849('0x1f')](_0x4d16b9)[_0x7849('0xe')](function(_0x45c6bb){return _0x45c6bb;});}return null;};}function removeEntity(_0x49e3cc){return function(_0x26deb1){if(_0x26deb1){return _0x26deb1[_0x7849('0x20')]()['then'](function(){_0x49e3cc['status'](0xcc)[_0x7849('0x21')]();});}};}function handleEntityNotFound(_0xf3c6b4){return function(_0x285f9b){if(!_0x285f9b){_0xf3c6b4[_0x7849('0x22')](0x194);}return _0x285f9b;};}function handleError(_0x4f5b3a,_0x41a7a8){_0x41a7a8=_0x41a7a8||0x1f4;return function(_0x17b4ad){logger['error'](_0x17b4ad['stack']);if(_0x17b4ad[_0x7849('0x23')]){delete _0x17b4ad[_0x7849('0x23')];}_0x4f5b3a['status'](_0x41a7a8)['send'](_0x17b4ad);};}exports[_0x7849('0x24')]=function(_0x458bd9,_0x584154){var _0x460d85={},_0x231cc1={},_0x53a41a={'count':0x0,'rows':[]};var _0x4f721e=_[_0x7849('0x25')](db[_0x7849('0x26')]['rawAttributes'],function(_0x50933c){return{'name':_0x50933c['fieldName'],'type':_0x50933c[_0x7849('0x27')][_0x7849('0x28')]};});_0x231cc1['model']=_[_0x7849('0x25')](_0x4f721e,'name');_0x231cc1[_0x7849('0x29')]=_[_0x7849('0x2a')](_0x458bd9[_0x7849('0x29')]);_0x231cc1[_0x7849('0x2b')]=_[_0x7849('0x2c')](_0x231cc1[_0x7849('0x2d')],_0x231cc1[_0x7849('0x29')]);_0x460d85[_0x7849('0x2e')]=_[_0x7849('0x2c')](_0x231cc1['model'],qs[_0x7849('0x2f')](_0x458bd9[_0x7849('0x29')]['fields']));_0x460d85['attributes']=_0x460d85[_0x7849('0x2e')][_0x7849('0x30')]?_0x460d85[_0x7849('0x2e')]:_0x231cc1['model'];if(!_0x458bd9[_0x7849('0x29')][_0x7849('0x31')](_0x7849('0x32'))){_0x460d85['limit']=qs[_0x7849('0x1b')](_0x458bd9['query']['limit']);_0x460d85[_0x7849('0x1d')]=qs[_0x7849('0x1d')](_0x458bd9[_0x7849('0x29')][_0x7849('0x1d')]);}_0x460d85[_0x7849('0x33')]=qs[_0x7849('0x34')](_0x458bd9['query'][_0x7849('0x34')]);_0x460d85[_0x7849('0x35')]=qs[_0x7849('0x2b')](_['pick'](_0x458bd9[_0x7849('0x29')],_0x231cc1[_0x7849('0x2b')]),_0x4f721e);if(_0x458bd9[_0x7849('0x29')][_0x7849('0x36')]){_0x460d85[_0x7849('0x35')]=_['merge'](_0x460d85[_0x7849('0x35')],{'$or':_['map'](_0x4f721e,function(_0x5aeb06){if(_0x5aeb06[_0x7849('0x27')]!=='VIRTUAL'){var _0x1abf15={};_0x1abf15[_0x5aeb06['name']]={'$like':'%'+_0x458bd9[_0x7849('0x29')]['filter']+'%'};return _0x1abf15;}})});}_0x460d85=_[_0x7849('0x37')]({},_0x460d85,_0x458bd9[_0x7849('0x38')]);var _0x1f74f1={'where':_0x460d85[_0x7849('0x35')]};return db['WhatsappMessage'][_0x7849('0x39')](_0x1f74f1)[_0x7849('0xe')](function(_0x23f7a2){_0x53a41a[_0x7849('0x39')]=_0x23f7a2;if(_0x458bd9['query'][_0x7849('0x3a')]){_0x460d85[_0x7849('0x3b')]=[{'all':!![]}];}return db[_0x7849('0x26')]['findAll'](_0x460d85);})[_0x7849('0xe')](function(_0x1caf1a){_0x53a41a[_0x7849('0x3c')]=_0x1caf1a;return _0x53a41a;})[_0x7849('0xe')](respondWithFilteredResult(_0x584154,_0x460d85))[_0x7849('0x18')](handleError(_0x584154,null));};exports['show']=function(_0x56a9d4,_0x565baf){var _0x10ff9d={'raw':!![],'where':{'id':_0x56a9d4[_0x7849('0x3d')]['id']}},_0x1b2838={};_0x1b2838[_0x7849('0x2d')]=_[_0x7849('0x2a')](db[_0x7849('0x26')]['rawAttributes']);_0x1b2838['query']=_[_0x7849('0x2a')](_0x56a9d4[_0x7849('0x29')]);_0x1b2838[_0x7849('0x2b')]=_['intersection'](_0x1b2838[_0x7849('0x2d')],_0x1b2838[_0x7849('0x29')]);_0x10ff9d['attributes']=_['intersection'](_0x1b2838[_0x7849('0x2d')],qs[_0x7849('0x2f')](_0x56a9d4[_0x7849('0x29')][_0x7849('0x2f')]));_0x10ff9d[_0x7849('0x2e')]=_0x10ff9d['attributes'][_0x7849('0x30')]?_0x10ff9d[_0x7849('0x2e')]:_0x1b2838[_0x7849('0x2d')];if(_0x56a9d4[_0x7849('0x29')][_0x7849('0x3a')]){_0x10ff9d[_0x7849('0x3b')]=[{'all':!![]}];}_0x10ff9d=_[_0x7849('0x37')]({},_0x10ff9d,_0x56a9d4[_0x7849('0x38')]);return db['WhatsappMessage'][_0x7849('0x3e')](_0x10ff9d)[_0x7849('0xe')](handleEntityNotFound(_0x565baf,null))[_0x7849('0xe')](respondWithResult(_0x565baf,null))['catch'](handleError(_0x565baf,null));};exports[_0x7849('0x3f')]=function(_0x50616a,_0x33ffd0){return db['WhatsappMessage'][_0x7849('0x3f')](_0x50616a['body'],{})[_0x7849('0xe')](respondWithResult(_0x33ffd0,0xc9))[_0x7849('0x18')](handleError(_0x33ffd0,null));};exports[_0x7849('0x1f')]=function(_0x3903d8,_0x133326){if(_0x3903d8[_0x7849('0x40')]['id']){delete _0x3903d8['body']['id'];}return db[_0x7849('0x26')]['find']({'where':{'id':_0x3903d8[_0x7849('0x3d')]['id']}})[_0x7849('0xe')](handleEntityNotFound(_0x133326,null))[_0x7849('0xe')](saveUpdates(_0x3903d8[_0x7849('0x40')],null))[_0x7849('0xe')](respondWithResult(_0x133326,null))[_0x7849('0x18')](handleError(_0x133326,null));};exports['destroy']=function(_0x1badaf,_0x1b1928){return db[_0x7849('0x26')][_0x7849('0x3e')]({'where':{'id':_0x1badaf[_0x7849('0x3d')]['id']}})[_0x7849('0xe')](handleEntityNotFound(_0x1b1928,null))[_0x7849('0xe')](removeEntity(_0x1b1928,null))[_0x7849('0x18')](handleError(_0x1b1928,null));};exports[_0x7849('0x41')]=function(_0xfd3469,_0x38aac5){return db['WhatsappMessage'][_0x7849('0x41')]()['then'](respondWithResult(_0x38aac5,null))[_0x7849('0x18')](handleError(_0x38aac5,null));};exports[_0x7849('0x42')]=function(_0x324d94,_0x1ca588){var _0x96bcc2=_0x7849('0x43');return interactionService['acceptMessage'](_0x324d94,_0x96bcc2)['then'](respondWithResult(_0x1ca588,null))[_0x7849('0x18')](handleError(_0x1ca588,null));};exports['reject']=function(_0x28a3e9,_0xbb4acc){var _0x36f466={'agent':{},'channel':_0x7849('0x43')};if(_0x28a3e9['body']['id']){delete _0x28a3e9['body']['id'];}_0x28a3e9[_0x7849('0x40')][_0x7849('0x44')]=_0x28a3e9['body']['UserId']||_0x28a3e9[_0x7849('0x45')]['id'];_0x36f466[_0x7849('0x46')]['id']=_0x28a3e9['body']['UserId'];return db[_0x7849('0x26')][_0x7849('0x3e')]({'where':{'id':_0x28a3e9[_0x7849('0x3d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xbb4acc,null))['then'](function(_0x44af50){if(_0x44af50){_0x36f466[_0x7849('0x15')]=_0x44af50[_0x7849('0x47')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x44af50[_0x7849('0x48')]}});}return null;})[_0x7849('0xe')](handleEntityNotFound(_0xbb4acc,null))[_0x7849('0xe')](function(_0xf584e){if(_0xf584e){_0x36f466[_0x7849('0x49')]=_0xf584e[_0x7849('0x47')]({'plain':!![]});interaction_log[_0x7849('0x16')](_0x7849('0x4a'),_0x28a3e9[_0x7849('0x45')]['id'],_0x28a3e9[_0x7849('0x45')][_0x7849('0x23')],_0x28a3e9['user']['role'],_0x36f466[_0x7849('0x49')]['id'],_0x28a3e9['body']?JSON[_0x7849('0x13')](_0x28a3e9[_0x7849('0x40')]):_0x7849('0x4b'));return respondWithRpcPromise(_0x7849('0x4c'),_0x7849('0x4d'),_0x36f466);}return null;})[_0x7849('0xe')](function(_0x34ba84){var _0x46cf37=_0x7849('0x4e')+_0x34ba84[_0x7849('0x15')][_0x7849('0x4f')];return db[_0x7849('0x50')]['query'](_0x46cf37,{'type':db['Sequelize'][_0x7849('0x51')]['SELECT'],'raw':!![]})[_0x7849('0xe')](function(_0x41010c){return _0x41010c;});})[_0x7849('0xe')](function(_0x4f6741){if(_0x4f6741){_0x36f466['message'][_0x7849('0x52')]=_0x4f6741[0x0];if(!_0x28a3e9['body']['UserId'])return;return db[_0x7849('0x53')]['find']({'where':{'id':_0x28a3e9[_0x7849('0x40')][_0x7849('0x44')],'role':'agent'},'attributes':['id',_0x7849('0x23'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x7849('0xe')](function(_0x352ec8){if(!_0x352ec8)return null;_0x36f466['message'][_0x7849('0x46')]=_0x352ec8;return _0x36f466;})[_0x7849('0xe')](function(_0x29586b){if(_0x29586b){_0x29586b[_0x7849('0x15')][_0x7849('0x54')]=util['format'](_0x7849('0x55'),_0x28a3e9[_0x7849('0x45')][_0x7849('0x23')]);_0x29586b[_0x7849('0x15')][_0x7849('0x56')]=_0x36f466[_0x7849('0x56')];_0x29586b[_0x7849('0x15')][_0x7849('0x57')]=_0x36f466['channel'];_0x29586b[_0x7849('0x15')][_0x7849('0x58')]=_0x7849('0x59');respondWithRpcPromise(_0x7849('0x5a'),'EventManager',{'event':'rejectmessage','message':_0x29586b['message']},client9002);return _0x36f466;}return null;})[_0x7849('0xe')](respondWithResult(_0xbb4acc,null))[_0x7849('0x18')](handleError(_0xbb4acc,null));};exports[_0x7849('0x19')]=function(_0x516f44,_0x3f4392){if(_0x516f44[_0x7849('0x40')]['id']){delete _0x516f44['body']['id'];}var _0x4f2663;return db[_0x7849('0x26')][_0x7849('0x3e')]({'where':{'id':_0x516f44[_0x7849('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3f4392,null))[_0x7849('0xe')](function(_0x229249){if(_0x229249){_0x4f2663=_0x229249;return db[_0x7849('0x5b')]['find']({'where':{'id':_0x229249[_0x7849('0x5c')]}});}})[_0x7849('0xe')](handleEntityNotFound(_0x3f4392,null))[_0x7849('0xe')](function(_0x30d25f){if(_0x30d25f){logger[_0x7849('0x11')](_0x7849('0x5d'),_0x7849('0x19'),_0x7849('0x5e'),_0x30d25f[_0x7849('0x27')],util[_0x7849('0x5f')](_0x516f44['body'],{'showHidden':![],'depth':null}));switch(_0x30d25f[_0x7849('0x27')]){case'twilio':if(_0x516f44['body'][_0x7849('0x60')]&&_0x516f44['body'][_0x7849('0x60')]===_0x4f2663[_0x7849('0x61')]&&_0x516f44[_0x7849('0x40')][_0x7849('0x62')]&&_0x516f44[_0x7849('0x40')][_0x7849('0x62')]===_0x7849('0x63')){return _0x4f2663['update']({'read':!![]});}else{logger[_0x7849('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x7849('0x5f')](_0x516f44[_0x7849('0x40')],{'showHidden':![],'depth':null}));}break;}return _0x4f2663;}})['then'](respondWithResult(_0x3f4392,null))['catch'](handleError(_0x3f4392,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ceaa3b1..1e773fd 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 _0x44a3=['emit','hasOwnProperty','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x320269,_0x3d5fdb){var _0xd3072c=function(_0x45656b){while(--_0x45656b){_0x320269['push'](_0x320269['shift']());}};_0xd3072c(++_0x3d5fdb);}(_0x44a3,0x1a9));var _0x344a=function(_0x16b13d,_0x2faf09){_0x16b13d=_0x16b13d-0x0;var _0x1f1e77=_0x44a3[_0x16b13d];return _0x1f1e77;};'use strict';var EventEmitter=require(_0x344a('0x0'));var WhatsappMessage=require(_0x344a('0x1'))['db'][_0x344a('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x344a('0x3')](0x0);var events={'afterCreate':_0x344a('0x4'),'afterUpdate':_0x344a('0x5'),'afterDestroy':_0x344a('0x6')};function emitEvent(_0x212a39){return function(_0x528a13,_0x23004c,_0x1bc716){WhatsappMessageEvents[_0x344a('0x7')](_0x212a39+':'+_0x528a13['id'],_0x528a13);WhatsappMessageEvents[_0x344a('0x7')](_0x212a39,_0x528a13);_0x1bc716(null);};}for(var e in events){if(events[_0x344a('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xe493=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe493,0x7e));var _0x3e49=function(_0x546997,_0x2b11ba){_0x546997=_0x546997-0x0;var _0x5096a4=_0xe493[_0x546997];return _0x5096a4;};'use strict';var EventEmitter=require(_0x3e49('0x0'));var WhatsappMessage=require(_0x3e49('0x1'))['db'][_0x3e49('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3e49('0x3')](0x0);var events={'afterCreate':_0x3e49('0x4'),'afterUpdate':'update','afterDestroy':_0x3e49('0x5')};function emitEvent(_0xb4d15e){return function(_0x4c0fa2,_0x43fb5e,_0x5e036c){WhatsappMessageEvents[_0x3e49('0x6')](_0xb4d15e+':'+_0x4c0fa2['id'],_0x4c0fa2);WhatsappMessageEvents[_0x3e49('0x6')](_0xb4d15e,_0x4c0fa2);_0x5e036c(null);};}for(var e in events){if(events[_0x3e49('0x7')](e)){var event=events[e];WhatsappMessage[_0x3e49('0x8')](e,emitEvent(event));}}module[_0x3e49('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index bd64412..3d7c2d4 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 _0x2016=['then','catch','error','secret','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','node-fetch','rimraf','../../config/environment','define','WhatsappMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','isNil','WhatsappInteraction','findOne','WhatsappInteractionId'];(function(_0x20869c,_0x3eab71){var _0x27989a=function(_0x4c07dd){while(--_0x4c07dd){_0x20869c['push'](_0x20869c['shift']());}};_0x27989a(++_0x3eab71);}(_0x2016,0xf5));var _0x6201=function(_0x4fbce4,_0xf1369){_0x4fbce4=_0x4fbce4-0x0;var _0x1978ec=_0x2016[_0x4fbce4];return _0x1978ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6201('0x0'))(_0x6201('0x1'));var moment=require('moment');var BPromise=require(_0x6201('0x2'));var rp=require(_0x6201('0x3'));var fetch=require(_0x6201('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6201('0x5'));var config=require(_0x6201('0x6'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x412364,_0x3af06e){return _0x412364[_0x6201('0x7')](_0x6201('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x6201('0x9'),'fields':[_0x6201('0x9')]},{'name':'fti_whatsapp_messages','fields':[_0x6201('0xa')],'type':_0x6201('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xbc0be,_0x502211,_0x2bcd44){var _0x5ed7b0=_0x412364[_0x6201('0xc')];var _0x64010c=_0xbc0be[_0x6201('0xd')]({'plain':!![]});if(_0x64010c[_0x6201('0xe')]['toLowerCase']()==='in'||_0x64010c[_0x6201('0xe')][_0x6201('0xf')]()==='out'&&!_0x64010c['secret']&&!_[_0x6201('0x10')](_0x64010c['UserId'])){_0x5ed7b0[_0x6201('0x11')][_0x6201('0x12')]({'where':{'id':_0x64010c[_0x6201('0x13')]}})[_0x6201('0x14')](function(_0x445793){if(_0x445793){_0x445793['update']({'lastMsgAt':_0x64010c['createdAt'],'lastMsgDirection':_0x64010c[_0x6201('0xe')][_0x6201('0xf')]()});}})[_0x6201('0x15')](function(_0x580f4d){console[_0x6201('0x16')](_0x580f4d);});}if(_0x64010c['direction']==='out'&&!_0x64010c[_0x6201('0x17')]){var _0x151a8d;_0x5ed7b0[_0x6201('0x18')]['find']({'where':{'id':_0x64010c[_0x6201('0x19')]},'raw':!![]})['then'](function(_0x4847a9){_0x151a8d=_0x4847a9;if(_0x151a8d&&_0x151a8d[_0x6201('0x1a')]){switch(_0x151a8d['type']){case _0x6201('0x1b'):var _0x463dfb=require(_0x6201('0x1b'));if(_0x151a8d[_0x6201('0x1c')]&&_0x151a8d[_0x6201('0x1d')]&&_0x151a8d[_0x6201('0x1e')]){var _0x578457=new _0x463dfb(_0x151a8d[_0x6201('0x1c')],_0x151a8d[_0x6201('0x1d')]);_0x578457[_0x6201('0x1f')][_0x6201('0x20')]({'body':_0x64010c[_0x6201('0xa')],'to':_0x6201('0x21')+_0x64010c[_0x6201('0x1e')],'from':_0x6201('0x21')+_0x151a8d[_0x6201('0x1e')],'statusCallback':_0x151a8d[_0x6201('0x22')]+_0x6201('0x23')+_0x64010c['id']+'/status?token='+_0x151a8d['token']})[_0x6201('0x14')](function(_0x1ce83d){if(_0x1ce83d[_0x6201('0x24')]){return _0xbc0be[_0x6201('0x25')]({'messageId':_0x1ce83d[_0x6201('0x24')]});}})[_0x6201('0x15')](function(_0x4663ce){logger[_0x6201('0x16')](_0x6201('0x26'),_0x6201('0x27'),_0x6201('0x1b'),util['inspect'](_0x4663ce,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6201('0x26'),_0x6201('0x27'),_0x6201('0x1b'),_0x6201('0x28'));}break;case _0x6201('0x29'):var _0x2b1f71=_0x151a8d[_0x6201('0x1c')];var _0x5b41c2=_0x151a8d[_0x6201('0x1d')];var _0x22ee35=_0x151a8d[_0x6201('0x2a')]+'/whatsapp/v1/'+_0x2b1f71+_0x6201('0x2b');var _0x2ab5c4={'to':[_0x64010c[_0x6201('0x1e')]],'message':{'type':_0x6201('0x2c'),'text':_0x64010c[_0x6201('0xa')]}};var _0x2d1555={'method':_0x6201('0x2d'),'uri':_0x22ee35,'headers':{'Authorization':_0x6201('0x2e')+_0x5b41c2,'Content-Type':_0x6201('0x2f')},'body':_0x2ab5c4,'json':!![]};rp(_0x2d1555)[_0x6201('0x14')](function(_0xc9cc60){if(_0xc9cc60[_0x6201('0x30')][0x0][_0x6201('0x31')]){return _0xbc0be[_0x6201('0x25')]({'messageId':_0xc9cc60[_0x6201('0x30')][0x0][_0x6201('0x31')]});}})[_0x6201('0x15')](function(_0x1f474d){logger[_0x6201('0x32')]('WhatsappMessage,\x20%s',_0x1f474d);});break;}}})['finally'](function(){_0x2bcd44();});}else{_0x2bcd44();}}},'charset':_0x6201('0x33'),'collate':_0x6201('0x34')});}; \ No newline at end of file +var _0x5651=['message_id','err','WhatsappMessage,\x20%s','utf8mb4','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','WhatsappInteraction','findOne','WhatsappInteractionId','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','body','whatsapp:','phone','remote','/api/whatsapp/messages/','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses'];(function(_0x482af4,_0x841ba7){var _0x266fbb=function(_0x46244e){while(--_0x46244e){_0x482af4['push'](_0x482af4['shift']());}};_0x266fbb(++_0x841ba7);}(_0x5651,0x1e4));var _0x1565=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x5651[_0x36f47c];return _0x296c55;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1565('0x0'))('api');var moment=require(_0x1565('0x1'));var BPromise=require(_0x1565('0x2'));var rp=require(_0x1565('0x3'));var fetch=require(_0x1565('0x4'));var fs=require('fs');var path=require(_0x1565('0x5'));var rimraf=require(_0x1565('0x6'));var config=require(_0x1565('0x7'));var attributes=require(_0x1565('0x8'));module[_0x1565('0x9')]=function(_0x34f842,_0x15804e){return _0x34f842[_0x1565('0xa')](_0x1565('0xb'),attributes,{'tableName':_0x1565('0xc'),'paranoid':![],'indexes':[{'name':_0x1565('0xd'),'fields':[_0x1565('0xd')]},{'name':_0x1565('0xe'),'fields':['body'],'type':_0x1565('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x115b55,_0x2f1f23,_0x5c7022){var _0x1baab7=_0x34f842[_0x1565('0x10')];var _0x48c52d=_0x115b55[_0x1565('0x11')]({'plain':!![]});if(_0x48c52d[_0x1565('0x12')][_0x1565('0x13')]()==='in'||_0x48c52d[_0x1565('0x12')][_0x1565('0x13')]()===_0x1565('0x14')&&!_0x48c52d['secret']&&!_['isNil'](_0x48c52d['UserId'])){_0x1baab7[_0x1565('0x15')][_0x1565('0x16')]({'where':{'id':_0x48c52d[_0x1565('0x17')]}})['then'](function(_0x122761){if(_0x122761){_0x122761['update']({'lastMsgAt':_0x48c52d[_0x1565('0x18')],'lastMsgDirection':_0x48c52d[_0x1565('0x12')][_0x1565('0x13')]()});}})[_0x1565('0x19')](function(_0x3ee6ae){console[_0x1565('0x1a')](_0x3ee6ae);});}if(_0x48c52d['direction']===_0x1565('0x14')&&!_0x48c52d[_0x1565('0x1b')]){var _0x19a2f1;_0x1baab7[_0x1565('0x1c')][_0x1565('0x1d')]({'where':{'id':_0x48c52d[_0x1565('0x1e')]},'raw':!![]})[_0x1565('0x1f')](function(_0x198aa7){_0x19a2f1=_0x198aa7;if(_0x19a2f1&&_0x19a2f1[_0x1565('0x20')]){switch(_0x19a2f1['type']){case _0x1565('0x21'):var _0x371253=require('twilio');if(_0x19a2f1[_0x1565('0x22')]&&_0x19a2f1[_0x1565('0x23')]&&_0x19a2f1['phone']){var _0x9b8960=new _0x371253(_0x19a2f1[_0x1565('0x22')],_0x19a2f1['authToken']);_0x9b8960[_0x1565('0x24')]['create']({'body':_0x48c52d[_0x1565('0x25')],'to':_0x1565('0x26')+_0x48c52d[_0x1565('0x27')],'from':_0x1565('0x26')+_0x19a2f1[_0x1565('0x27')],'statusCallback':_0x19a2f1[_0x1565('0x28')]+_0x1565('0x29')+_0x48c52d['id']+'/status?token='+_0x19a2f1[_0x1565('0x2a')]})[_0x1565('0x1f')](function(_0x12d4b9){if(_0x12d4b9[_0x1565('0x2b')]){return _0x115b55[_0x1565('0x2c')]({'messageId':_0x12d4b9['sid']});}})[_0x1565('0x19')](function(_0x2dd671){logger[_0x1565('0x1a')](_0x1565('0x2d'),'afterCreate',_0x1565('0x21'),util['inspect'](_0x2dd671,{'showHidden':![],'depth':null}));});}else{logger[_0x1565('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1565('0x2e'),_0x1565('0x21'),_0x1565('0x2f'));}break;case _0x1565('0x30'):var _0x1b73b7=_0x19a2f1['accountSid'];var _0x3fd408=_0x19a2f1[_0x1565('0x23')];var _0x3cefb4=_0x19a2f1[_0x1565('0x31')]+_0x1565('0x32')+_0x1b73b7+_0x1565('0x33');var _0xf532bd={'to':[_0x48c52d['phone']],'message':{'type':'text','text':_0x48c52d[_0x1565('0x25')]}};var _0x57a08b={'method':_0x1565('0x34'),'uri':_0x3cefb4,'headers':{'Authorization':_0x1565('0x35')+_0x3fd408,'Content-Type':_0x1565('0x36')},'body':_0xf532bd,'json':!![]};rp(_0x57a08b)['then'](function(_0x1a7f6a){if(_0x1a7f6a[_0x1565('0x37')][0x0]['message_id']){return _0x115b55[_0x1565('0x2c')]({'messageId':_0x1a7f6a['statuses'][0x0][_0x1565('0x38')]});}})[_0x1565('0x19')](function(_0x4096f9){logger[_0x1565('0x39')](_0x1565('0x3a'),_0x4096f9);});break;}}})['finally'](function(){_0x5c7022();});}else{_0x5c7022();}}},'charset':_0x1565('0x3b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index af1e10b..b9d6578 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 _0xe9b9=['error','code','message','result','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xaadddb,_0x2e5965){var _0x5c9ba2=function(_0x12802a){while(--_0x12802a){_0xaadddb['push'](_0xaadddb['shift']());}};_0x5c9ba2(++_0x2e5965);}(_0xe9b9,0x1be));var _0x9e9b=function(_0x3133c8,_0x1ecaa8){_0x3133c8=_0x3133c8-0x0;var _0x1d4f12=_0xe9b9[_0x3133c8];return _0x1d4f12;};'use strict';var _=require(_0x9e9b('0x0'));var util=require(_0x9e9b('0x1'));var moment=require(_0x9e9b('0x2'));var BPromise=require(_0x9e9b('0x3'));var rs=require(_0x9e9b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9e9b('0x5'));var logger=require(_0x9e9b('0x6'))(_0x9e9b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9e9b('0x8')]({'port':0x232a});config[_0x9e9b('0x9')]=_[_0x9e9b('0xa')](config[_0x9e9b('0x9')],{'host':_0x9e9b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e9b('0x9')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x18f075,_0x25a583,_0x35c2a6){return new BPromise(function(_0x2c4a52,_0x4c611a){return client[_0x9e9b('0xc')](_0x18f075,_0x35c2a6)['then'](function(_0x1cb834){logger[_0x9e9b('0xd')](_0x9e9b('0xe'),_0x25a583,_0x9e9b('0xf'));logger[_0x9e9b('0x10')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x25a583,'request\x20sent',JSON[_0x9e9b('0x11')](_0x1cb834));if(_0x1cb834[_0x9e9b('0x12')]){if(_0x1cb834['error'][_0x9e9b('0x13')]===0x1f4){logger[_0x9e9b('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x25a583,_0x1cb834['error']['message']);return _0x4c611a(_0x1cb834['error'][_0x9e9b('0x14')]);}logger[_0x9e9b('0x12')](_0x9e9b('0xe'),_0x25a583,_0x1cb834['error'][_0x9e9b('0x14')]);return _0x2c4a52(_0x1cb834['error'][_0x9e9b('0x14')]);}else{logger[_0x9e9b('0xd')](_0x9e9b('0xe'),_0x25a583,_0x9e9b('0xf'));_0x2c4a52(_0x1cb834[_0x9e9b('0x15')][_0x9e9b('0x14')]);}})['catch'](function(_0xaa773){logger[_0x9e9b('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x25a583,_0xaa773);_0x4c611a(_0xaa773);});});}exports['CreateWhatsappMessage']=function(_0x1bf2e6){var _0x4c170e=this;return new Promise(function(_0x468c81,_0x556086){return db[_0x9e9b('0x16')][_0x9e9b('0x17')](_0x1bf2e6[_0x9e9b('0x18')],{'raw':_0x1bf2e6[_0x9e9b('0x19')]?_0x1bf2e6[_0x9e9b('0x19')][_0x9e9b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x288998){logger[_0x9e9b('0xd')](_0x9e9b('0x1b'),_0x1bf2e6);logger[_0x9e9b('0x10')](_0x9e9b('0x1b'),_0x1bf2e6,JSON[_0x9e9b('0x11')](_0x288998));_0x468c81(_0x288998);})[_0x9e9b('0x1c')](function(_0x69dcc){logger['error'](_0x9e9b('0x1b'),_0x69dcc[_0x9e9b('0x14')],_0x1bf2e6);_0x556086(_0x4c170e[_0x9e9b('0x12')](0x1f4,_0x69dcc[_0x9e9b('0x14')]));});});}; \ No newline at end of file +var _0xf2d1=['result','catch','CreateWhatsappMessage','create','body','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xc1b4db,_0x360d7e){var _0x3a1711=function(_0x21c4a6){while(--_0x21c4a6){_0xc1b4db['push'](_0xc1b4db['shift']());}};_0x3a1711(++_0x360d7e);}(_0xf2d1,0x69));var _0x1f2d=function(_0x113e82,_0x251993){_0x113e82=_0x113e82-0x0;var _0x44d9d0=_0xf2d1[_0x113e82];return _0x44d9d0;};'use strict';var _=require(_0x1f2d('0x0'));var util=require(_0x1f2d('0x1'));var moment=require(_0x1f2d('0x2'));var BPromise=require(_0x1f2d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f2d('0x4'));var db=require(_0x1f2d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f2d('0x6'))(_0x1f2d('0x7'));var config=require('../../config/environment');var jayson=require(_0x1f2d('0x8'));var client=jayson[_0x1f2d('0x9')][_0x1f2d('0xa')]({'port':0x232a});config[_0x1f2d('0xb')]=_[_0x1f2d('0xc')](config[_0x1f2d('0xb')],{'host':_0x1f2d('0xd'),'port':0x18eb});var socket=require(_0x1f2d('0xe'))(new Redis(config[_0x1f2d('0xb')]));require(_0x1f2d('0xf'))['register'](socket);function respondWithRpcPromise(_0x34dfc5,_0x54bcb0,_0x581443){return new BPromise(function(_0x2b5d78,_0x5badbb){return client[_0x1f2d('0x10')](_0x34dfc5,_0x581443)[_0x1f2d('0x11')](function(_0x36cb9f){logger[_0x1f2d('0x12')](_0x1f2d('0x13'),_0x54bcb0,_0x1f2d('0x14'));logger[_0x1f2d('0x15')](_0x1f2d('0x16'),_0x54bcb0,_0x1f2d('0x14'),JSON[_0x1f2d('0x17')](_0x36cb9f));if(_0x36cb9f[_0x1f2d('0x18')]){if(_0x36cb9f[_0x1f2d('0x18')][_0x1f2d('0x19')]===0x1f4){logger[_0x1f2d('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x54bcb0,_0x36cb9f[_0x1f2d('0x18')][_0x1f2d('0x1a')]);return _0x5badbb(_0x36cb9f['error'][_0x1f2d('0x1a')]);}logger[_0x1f2d('0x18')](_0x1f2d('0x13'),_0x54bcb0,_0x36cb9f[_0x1f2d('0x18')]['message']);return _0x2b5d78(_0x36cb9f[_0x1f2d('0x18')][_0x1f2d('0x1a')]);}else{logger[_0x1f2d('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x54bcb0,_0x1f2d('0x14'));_0x2b5d78(_0x36cb9f[_0x1f2d('0x1b')]['message']);}})[_0x1f2d('0x1c')](function(_0x10030f){logger[_0x1f2d('0x18')](_0x1f2d('0x13'),_0x54bcb0,_0x10030f);_0x5badbb(_0x10030f);});});}exports[_0x1f2d('0x1d')]=function(_0x2c12d2){var _0x32d88b=this;return new Promise(function(_0x5b1f05,_0x33348a){return db['WhatsappMessage'][_0x1f2d('0x1e')](_0x2c12d2[_0x1f2d('0x1f')],{'raw':_0x2c12d2[_0x1f2d('0x20')]?_0x2c12d2[_0x1f2d('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x1f2d('0x11')](function(_0xbd0d89){logger['info'](_0x1f2d('0x1d'),_0x2c12d2);logger[_0x1f2d('0x15')](_0x1f2d('0x1d'),_0x2c12d2,JSON[_0x1f2d('0x17')](_0xbd0d89));_0x5b1f05(_0xbd0d89);})['catch'](function(_0x5acf3e){logger[_0x1f2d('0x18')](_0x1f2d('0x1d'),_0x5acf3e[_0x1f2d('0x1a')],_0x2c12d2);_0x33348a(_0x32d88b['error'](0x1f4,_0x5acf3e[_0x1f2d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 9a31915..570659c 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 _0xd19b=['update','emit','removeListener','length','whatsappMessage:','save','remove'];(function(_0x5e3f9f,_0x5fd839){var _0x2d14f7=function(_0x3ca579){while(--_0x3ca579){_0x5e3f9f['push'](_0x5e3f9f['shift']());}};_0x2d14f7(++_0x5fd839);}(_0xd19b,0x16a));var _0xbd19=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xd19b[_0x5d7227];return _0x15ac55;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xbd19('0x0'),_0xbd19('0x1'),_0xbd19('0x2')];function createListener(_0x49ae40,_0x40902e){return function(_0x1d007e){_0x40902e[_0xbd19('0x3')](_0x49ae40,_0x1d007e);};}function removeListener(_0x4852ba,_0x3d3501){return function(){WhatsappMessageEvents[_0xbd19('0x4')](_0x4852ba,_0x3d3501);};}exports['register']=function(_0x18d4d0){for(var _0x5842f6=0x0,_0x212d6c=events[_0xbd19('0x5')];_0x5842f6<_0x212d6c;_0x5842f6++){var _0x5cdc1c=events[_0x5842f6];var _0x4f7a22=createListener(_0xbd19('0x6')+_0x5cdc1c,_0x18d4d0);WhatsappMessageEvents['on'](_0x5cdc1c,_0x4f7a22);}}; \ No newline at end of file +var _0x3146=['whatsappMessage:','./whatsappMessage.events','remove','update','emit','removeListener','register'];(function(_0x13594e,_0x6f0ed0){var _0x1a4f42=function(_0x30b064){while(--_0x30b064){_0x13594e['push'](_0x13594e['shift']());}};_0x1a4f42(++_0x6f0ed0);}(_0x3146,0xb7));var _0x6314=function(_0xb19736,_0x5c5698){_0xb19736=_0xb19736-0x0;var _0xdb2fb4=_0x3146[_0xb19736];return _0xdb2fb4;};'use strict';var WhatsappMessageEvents=require(_0x6314('0x0'));var events=['save',_0x6314('0x1'),_0x6314('0x2')];function createListener(_0x12d171,_0x4b5fa2){return function(_0x5ea6b1){_0x4b5fa2[_0x6314('0x3')](_0x12d171,_0x5ea6b1);};}function removeListener(_0x15d4d2,_0x145599){return function(){WhatsappMessageEvents[_0x6314('0x4')](_0x15d4d2,_0x145599);};}exports[_0x6314('0x5')]=function(_0x4f6d3e){for(var _0x13069b=0x0,_0x2e2f54=events['length'];_0x13069b<_0x2e2f54;_0x13069b++){var _0x181d03=events[_0x13069b];var _0x1a9754=createListener(_0x6314('0x6')+_0x181d03,_0x4f6d3e);WhatsappMessageEvents['on'](_0x181d03,_0x1a9754);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5c0bac6..08f4f92 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 _0xa871=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','update','delete','/:id','destroy','removeTeams'];(function(_0x59ed5d,_0x5bacd4){var _0x33df7b=function(_0x263901){while(--_0x263901){_0x59ed5d['push'](_0x59ed5d['shift']());}};_0x33df7b(++_0x5bacd4);}(_0xa871,0xfa));var _0x1a87=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0xa871[_0xae1a83];return _0xdb9da8;};'use strict';var multer=require(_0x1a87('0x0'));var util=require(_0x1a87('0x1'));var path=require(_0x1a87('0x2'));var timeout=require(_0x1a87('0x3'));var express=require(_0x1a87('0x4'));var router=express[_0x1a87('0x5')]();var fs_extra=require(_0x1a87('0x6'));var auth=require(_0x1a87('0x7'));var interaction=require(_0x1a87('0x8'));var config=require('../../config/environment');var controller=require(_0x1a87('0x9'));router[_0x1a87('0xa')]('/',auth[_0x1a87('0xb')](),controller[_0x1a87('0xc')]);router[_0x1a87('0xa')]('/describe',auth[_0x1a87('0xb')](),controller[_0x1a87('0xd')]);router[_0x1a87('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1a87('0xe')]);router[_0x1a87('0xa')](_0x1a87('0xf'),auth[_0x1a87('0xb')](),controller['getMembers']);router['get'](_0x1a87('0x10'),auth[_0x1a87('0xb')](),controller[_0x1a87('0x11')]);router[_0x1a87('0xa')](_0x1a87('0x12'),auth['isAuthenticated'](),controller[_0x1a87('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1a87('0x14')]);router[_0x1a87('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1a87('0x16')]);router[_0x1a87('0x15')](_0x1a87('0x12'),auth[_0x1a87('0xb')](),controller[_0x1a87('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1a87('0x18')]);router[_0x1a87('0x19')](_0x1a87('0x1a'),auth[_0x1a87('0xb')](),controller[_0x1a87('0x1b')]);router[_0x1a87('0x19')](_0x1a87('0x10'),auth[_0x1a87('0xb')](),controller[_0x1a87('0x1c')]);router[_0x1a87('0x19')]('/:id/users',auth[_0x1a87('0xb')](),controller[_0x1a87('0x1d')]);module[_0x1a87('0x1e')]=router; \ No newline at end of file +var _0x6961=['getAgents','post','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','index','/describe','describe','get','/:id','isAuthenticated','/:id/teams','getTeams','/:id/users'];(function(_0x11d94c,_0x3c6764){var _0x4ed5c8=function(_0x41e5aa){while(--_0x41e5aa){_0x11d94c['push'](_0x11d94c['shift']());}};_0x4ed5c8(++_0x3c6764);}(_0x6961,0xbf));var _0x1696=function(_0x41c270,_0x1d802f){_0x41c270=_0x41c270-0x0;var _0x31437c=_0x6961[_0x41c270];return _0x31437c;};'use strict';var multer=require(_0x1696('0x0'));var util=require(_0x1696('0x1'));var path=require('path');var timeout=require(_0x1696('0x2'));var express=require(_0x1696('0x3'));var router=express[_0x1696('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1696('0x5'));var config=require(_0x1696('0x6'));var controller=require(_0x1696('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1696('0x8')]);router['get'](_0x1696('0x9'),auth['isAuthenticated'](),controller[_0x1696('0xa')]);router[_0x1696('0xb')](_0x1696('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1696('0xb')]('/:id/members',auth[_0x1696('0xd')](),controller['getMembers']);router['get'](_0x1696('0xe'),auth[_0x1696('0xd')](),controller[_0x1696('0xf')]);router[_0x1696('0xb')](_0x1696('0x10'),auth[_0x1696('0xd')](),controller[_0x1696('0x11')]);router[_0x1696('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1696('0x12')](_0x1696('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x1696('0x10'),auth['isAuthenticated'](),controller[_0x1696('0x13')]);router[_0x1696('0x14')](_0x1696('0xc'),auth['isAuthenticated'](),controller[_0x1696('0x15')]);router[_0x1696('0x16')](_0x1696('0xc'),auth['isAuthenticated'](),controller[_0x1696('0x17')]);router[_0x1696('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1696('0x18')]);router['delete']('/:id/users',auth[_0x1696('0xd')](),controller['removeAgents']);module[_0x1696('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f624ad2..9c4357c 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 _0xcff8=['beepall','roundrobin','sequelize','STRING','name','ENUM','rrmemory'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0xcff8,0x14b));var _0x8cff=function(_0x34260d,_0x401ebb){_0x34260d=_0x34260d-0x0;var _0x174c68=_0xcff8[_0x34260d];return _0x174c68;};'use strict';var Sequelize=require(_0x8cff('0x0'));module['exports']={'name':{'type':Sequelize[_0x8cff('0x1')],'unique':_0x8cff('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8cff('0x3')](_0x8cff('0x4'),_0x8cff('0x5'),_0x8cff('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x167e=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x474035,_0x41e639){var _0x1b58e0=function(_0x91b15c){while(--_0x91b15c){_0x474035['push'](_0x474035['shift']());}};_0x1b58e0(++_0x41e639);}(_0x167e,0xa3));var _0xe167=function(_0x2c36ae,_0x2a28d1){_0x2c36ae=_0x2c36ae-0x0;var _0x194b34=_0x167e[_0x2c36ae];return _0x194b34;};'use strict';var Sequelize=require(_0xe167('0x0'));module[_0xe167('0x1')]={'name':{'type':Sequelize[_0xe167('0x2')],'unique':_0xe167('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe167('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe167('0x5')](_0xe167('0x6'),_0xe167('0x7'),'roundrobin')},'description':{'type':Sequelize[_0xe167('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 016217d..e789a99 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 _0x213d=['createdAt','format','%s/%s','SIP','whatsappPause','getTeams','order','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','User','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','undefined','count','offset','set','then','WhatsappQueues','UserProfileResource','destroy','sendStatus','error','stack','name','index','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','show','params','model','keys','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','filters','fields','hasOwnProperty','nolimit','limit','sort','pick','WhatsappQueueId','filter','findAll','findAndCountAll','map','updatedAt'];(function(_0x34f86d,_0x469a3b){var _0x1c457a=function(_0x102cd4){while(--_0x102cd4){_0x34f86d['push'](_0x34f86d['shift']());}};_0x1c457a(++_0x469a3b);}(_0x213d,0x12c));var _0xd213=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x213d[_0x2b10c6];return _0x3789d2;};'use strict';var BPromise=require(_0xd213('0x0'));var util=require(_0xd213('0x1'));var _=require(_0xd213('0x2'));var squel=require('squel');var Redis=require(_0xd213('0x3'));var qs=require(_0xd213('0x4'));var logger=require(_0xd213('0x5'))('api');var config=require(_0xd213('0x6'));var db=require(_0xd213('0x7'))['db'];config[_0xd213('0x8')]=_['defaults'](config[_0xd213('0x8')],{'host':_0xd213('0x9'),'port':0x18eb});var socket=require(_0xd213('0xa'))(new Redis(config[_0xd213('0x8')]));require(_0xd213('0xb'))[_0xd213('0xc')](socket);function respondWithStatusCode(_0x1d461a,_0x404748){_0x404748=_0x404748||0xcc;return function(_0x2a349e){if(_0x2a349e){return _0x1d461a['sendStatus'](_0x404748);}return _0x1d461a[_0xd213('0xd')](_0x404748)[_0xd213('0xe')]();};}function respondWithResult(_0xbd2302,_0x1608c0){_0x1608c0=_0x1608c0||0xc8;return function(_0x41f9ed){if(_0x41f9ed){return _0xbd2302[_0xd213('0xd')](_0x1608c0)[_0xd213('0xf')](_0x41f9ed);}};}function respondWithFilteredResult(_0x41520d,_0x10947a){return function(_0x58ed26){if(_0x58ed26){var _0x5ecb58=typeof _0x10947a['offset']===_0xd213('0x10')&&typeof _0x10947a['limit']===_0xd213('0x10');var _0x1794ab=_0x58ed26[_0xd213('0x11')];var _0x3bf702=_0x5ecb58?0x0:_0x10947a[_0xd213('0x12')];var _0x56cbaa=_0x5ecb58?_0x58ed26[_0xd213('0x11')]:_0x10947a[_0xd213('0x12')]+_0x10947a['limit'];var _0x533682;if(_0x56cbaa>=_0x1794ab){_0x56cbaa=_0x1794ab;_0x533682=0xc8;}else{_0x533682=0xce;}_0x41520d[_0xd213('0xd')](_0x533682);return _0x41520d[_0xd213('0x13')]('Content-Range',_0x3bf702+'-'+_0x56cbaa+'/'+_0x1794ab)[_0xd213('0xf')](_0x58ed26);}return null;};}function saveUpdates(_0x57b774){return function(_0x5e3949){if(_0x5e3949){return _0x5e3949['update'](_0x57b774)[_0xd213('0x14')](function(_0xd969d2){return _0xd969d2;});}return null;};}function removeEntity(_0x12ac39){return function(_0x3b5527){if(_0x3b5527){return _0x3b5527['destroy']()[_0xd213('0x14')](function(){var _0x118bbe=_0x3b5527['get']({'plain':!![]});var _0x84008d=_0xd213('0x15');return db[_0xd213('0x16')][_0xd213('0x17')]({'where':{'type':_0x84008d,'resourceId':_0x118bbe['id']}})['then'](function(){return _0x3b5527;});})[_0xd213('0x14')](function(){_0x12ac39[_0xd213('0xd')](0xcc)[_0xd213('0xe')]();});}};}function handleEntityNotFound(_0x3b9bba){return function(_0x10d331){if(!_0x10d331){_0x3b9bba[_0xd213('0x18')](0x194);}return _0x10d331;};}function handleError(_0x4eb5c7,_0xe4070){_0xe4070=_0xe4070||0x1f4;return function(_0x8bb990){logger[_0xd213('0x19')](_0x8bb990[_0xd213('0x1a')]);if(_0x8bb990[_0xd213('0x1b')]){delete _0x8bb990['name'];}_0x4eb5c7[_0xd213('0xd')](_0xe4070)['send'](_0x8bb990);};}exports[_0xd213('0x1c')]=function(_0x342504,_0x46c47a){var _0x1e42f9={};var _0x1b7756={'count':0x0,'rows':[]};var _0x103215=_['map'](db[_0xd213('0x1d')][_0xd213('0x1e')],function(_0x4deae2){return{'name':_0x4deae2[_0xd213('0x1f')],'type':_0x4deae2[_0xd213('0x20')][_0xd213('0x21')]};});_0x1e42f9=qs[_0xd213('0x22')](_0x103215,_0x342504);var _0x33ebf7={'where':_0x1e42f9[_0xd213('0x23')]};return db[_0xd213('0x1d')][_0xd213('0x11')](_0x33ebf7)[_0xd213('0x14')](function(_0x5a1ecb){_0x1b7756['count']=_0x5a1ecb;_0x1e42f9[_0xd213('0x24')]=qs['include'](_0x342504[_0xd213('0x25')]);return db[_0xd213('0x1d')]['findAll'](_0x1e42f9);})[_0xd213('0x14')](function(_0x10b9bb){_0x1b7756[_0xd213('0x26')]=_0x10b9bb;return _0x1b7756;})[_0xd213('0x14')](respondWithFilteredResult(_0x46c47a,_0x1e42f9))['catch'](handleError(_0x46c47a,null));};exports[_0xd213('0x27')]=function(_0x5e91fb,_0x52358e){var _0x4e6628={'raw':!![],'where':{'id':_0x5e91fb[_0xd213('0x28')]['id']}},_0x47d0d4={};_0x47d0d4[_0xd213('0x29')]=_[_0xd213('0x2a')](db[_0xd213('0x1d')][_0xd213('0x1e')]);_0x47d0d4[_0xd213('0x25')]=_[_0xd213('0x2a')](_0x5e91fb[_0xd213('0x25')]);_0x47d0d4['filters']=_[_0xd213('0x2b')](_0x47d0d4[_0xd213('0x29')],_0x47d0d4[_0xd213('0x25')]);_0x4e6628[_0xd213('0x2c')]=_[_0xd213('0x2b')](_0x47d0d4[_0xd213('0x29')],qs['fields'](_0x5e91fb[_0xd213('0x25')]['fields']));_0x4e6628['attributes']=_0x4e6628[_0xd213('0x2c')][_0xd213('0x2d')]?_0x4e6628[_0xd213('0x2c')]:_0x47d0d4[_0xd213('0x29')];if(_0x5e91fb[_0xd213('0x25')][_0xd213('0x2e')]){_0x4e6628[_0xd213('0x24')]=[{'all':!![]}];}_0x4e6628=_[_0xd213('0x2f')]({},_0x4e6628,_0x5e91fb[_0xd213('0x30')]);return db[_0xd213('0x1d')][_0xd213('0x31')](_0x4e6628)['then'](handleEntityNotFound(_0x52358e,null))['then'](respondWithResult(_0x52358e,null))[_0xd213('0x32')](handleError(_0x52358e,null));};exports[_0xd213('0x33')]=function(_0x286828,_0xd523a7){return db[_0xd213('0x1d')][_0xd213('0x33')](_0x286828[_0xd213('0x34')],{})[_0xd213('0x14')](function(_0x42b229){var _0x4dc7dd=_0x286828[_0xd213('0x35')][_0xd213('0x36')]({'plain':!![]});if(!_0x4dc7dd)throw new Error(_0xd213('0x37'));if(_0x4dc7dd[_0xd213('0x38')]===_0xd213('0x35')){var _0x1642f3=_0x42b229[_0xd213('0x36')]({'plain':!![]});var _0x38b81d=_0xd213('0x15');return db[_0xd213('0x39')][_0xd213('0x31')]({'where':{'name':_0x38b81d,'userProfileId':_0x4dc7dd[_0xd213('0x3a')]},'raw':!![]})[_0xd213('0x14')](function(_0x117dbb){if(_0x117dbb&&_0x117dbb[_0xd213('0x3b')]===0x0){return db[_0xd213('0x16')][_0xd213('0x33')]({'name':_0x1642f3[_0xd213('0x1b')],'resourceId':_0x1642f3['id'],'type':_0x117dbb[_0xd213('0x1b')],'sectionId':_0x117dbb['id']},{})['then'](function(){return _0x42b229;});}else{return _0x42b229;}})[_0xd213('0x32')](function(_0x23bcc6){logger[_0xd213('0x19')](_0xd213('0x3c'),_0x23bcc6);throw _0x23bcc6;});}return _0x42b229;})[_0xd213('0x14')](respondWithResult(_0xd523a7,0xc9))[_0xd213('0x32')](handleError(_0xd523a7,null));};exports['update']=function(_0x4cad33,_0x18cecc){if(_0x4cad33['body']['id']){delete _0x4cad33[_0xd213('0x34')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x4cad33[_0xd213('0x28')]['id']}})[_0xd213('0x14')](handleEntityNotFound(_0x18cecc,null))[_0xd213('0x14')](saveUpdates(_0x4cad33[_0xd213('0x34')],null))[_0xd213('0x14')](respondWithResult(_0x18cecc,null))['catch'](handleError(_0x18cecc,null));};exports[_0xd213('0x17')]=function(_0x476375,_0x167702){return db[_0xd213('0x1d')][_0xd213('0x31')]({'where':{'id':_0x476375['params']['id']}})[_0xd213('0x14')](handleEntityNotFound(_0x167702,null))[_0xd213('0x14')](removeEntity(_0x167702,null))[_0xd213('0x32')](handleError(_0x167702,null));};exports['describe']=function(_0x581465,_0x323df7){return db[_0xd213('0x1d')][_0xd213('0x3d')]()[_0xd213('0x14')](respondWithResult(_0x323df7,null))['catch'](handleError(_0x323df7,null));};exports[_0xd213('0x3e')]=function(_0x53fe76,_0x4c0db5){var _0x85eb9a={'raw':!![],'where':{}},_0x5783ec={},_0x53ceb4;return db[_0xd213('0x1d')][_0xd213('0x3f')]({'where':{'id':_0x53fe76[_0xd213('0x28')]['id']}})[_0xd213('0x14')](handleEntityNotFound(_0x4c0db5,null))[_0xd213('0x14')](function(_0x4636fb){if(_0x4636fb){_0x53ceb4=_0x4636fb[_0xd213('0x36')]({'plain':!![]});_0x5783ec[_0xd213('0x29')]=_[_0xd213('0x2a')](db[_0xd213('0x40')][_0xd213('0x1e')]);_0x5783ec[_0xd213('0x25')]=_[_0xd213('0x2a')](_0x53fe76[_0xd213('0x25')]);_0x5783ec[_0xd213('0x41')]=_[_0xd213('0x2b')](_0x5783ec[_0xd213('0x29')],_0x5783ec[_0xd213('0x25')]);_0x85eb9a['attributes']=_[_0xd213('0x2b')](_0x5783ec[_0xd213('0x29')],qs[_0xd213('0x42')](_0x53fe76[_0xd213('0x25')][_0xd213('0x42')]));_0x85eb9a['attributes']=_0x85eb9a[_0xd213('0x2c')][_0xd213('0x2d')]?_0x85eb9a[_0xd213('0x2c')]:_0x5783ec[_0xd213('0x29')];if(!_0x53fe76['query'][_0xd213('0x43')](_0xd213('0x44'))){_0x85eb9a[_0xd213('0x45')]=qs[_0xd213('0x45')](_0x53fe76[_0xd213('0x25')][_0xd213('0x45')]);_0x85eb9a[_0xd213('0x12')]=qs[_0xd213('0x12')](_0x53fe76[_0xd213('0x25')]['offset']);}_0x85eb9a['order']=qs[_0xd213('0x46')](_0x53fe76[_0xd213('0x25')][_0xd213('0x46')]);_0x85eb9a['where']=qs[_0xd213('0x41')](_[_0xd213('0x47')](_0x53fe76[_0xd213('0x25')],_0x5783ec['filters']));_0x85eb9a['where'][_0xd213('0x48')]=_0x4636fb['id'];if(_0x53fe76[_0xd213('0x25')]['filter']){_0x85eb9a[_0xd213('0x23')]=_[_0xd213('0x2f')](_0x85eb9a[_0xd213('0x23')],{'$or':_['map'](_0x85eb9a[_0xd213('0x2c')],function(_0x5e3d79){var _0x3e6bfc={};_0x3e6bfc[_0x5e3d79]={'$like':'%'+_0x53fe76[_0xd213('0x25')][_0xd213('0x49')]+'%'};return _0x3e6bfc;})});}_0x85eb9a=_[_0xd213('0x2f')]({},_0x85eb9a,_0x53fe76[_0xd213('0x30')]);return db[_0xd213('0x40')][_0xd213('0x4a')](_0x85eb9a);}})['then'](function(_0x45930b){if(_0x45930b){return db['User'][_0xd213('0x4b')]({'where':{'id':_[_0xd213('0x4c')](_0x45930b,'UserId'),'role':'agent'},'attributes':['id','name','whatsappPause',_0xd213('0x4d'),_0xd213('0x4e')]});}})[_0xd213('0x14')](function(_0x5b10b8){if(_0x5b10b8){return{'count':_0x5b10b8['count'],'rows':_['map'](_0x5b10b8[_0xd213('0x26')],function(_0x2085c5){return{'membername':_0x2085c5[_0xd213('0x1b')],'UserId':_0x2085c5['id'],'queue_name':_0x53ceb4['name'],'WhatsappQueueId':_0x53ceb4['id'],'interface':util[_0xd213('0x4f')](_0xd213('0x50'),_0xd213('0x51'),_0x2085c5[_0xd213('0x1b')]),'penalty':0x0,'paused':_0x2085c5[_0xd213('0x52')],'createdAt':_0x2085c5[_0xd213('0x4e')],'updatedAt':_0x2085c5[_0xd213('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd213('0x14')](respondWithFilteredResult(_0x4c0db5,_0x85eb9a))[_0xd213('0x32')](handleError(_0x4c0db5,null));};exports[_0xd213('0x53')]=function(_0x4b9868,_0x21451d){var _0x1d9602={};var _0x2ca1cc={};var _0x330660;var _0x1ef93a;return db[_0xd213('0x1d')]['findOne']({'where':{'id':_0x4b9868[_0xd213('0x28')]['id']}})[_0xd213('0x14')](handleEntityNotFound(_0x21451d,null))[_0xd213('0x14')](function(_0x519be1){if(_0x519be1){_0x330660=_0x519be1;_0x2ca1cc[_0xd213('0x29')]=_[_0xd213('0x2a')](db['Team'][_0xd213('0x1e')]);_0x2ca1cc['query']=_[_0xd213('0x2a')](_0x4b9868[_0xd213('0x25')]);_0x2ca1cc[_0xd213('0x41')]=_[_0xd213('0x2b')](_0x2ca1cc[_0xd213('0x29')],_0x2ca1cc[_0xd213('0x25')]);_0x1d9602[_0xd213('0x2c')]=_['intersection'](_0x2ca1cc['model'],qs[_0xd213('0x42')](_0x4b9868['query'][_0xd213('0x42')]));_0x1d9602['attributes']=_0x1d9602[_0xd213('0x2c')]['length']?_0x1d9602[_0xd213('0x2c')]:_0x2ca1cc[_0xd213('0x29')];_0x1d9602[_0xd213('0x54')]=qs[_0xd213('0x46')](_0x4b9868[_0xd213('0x25')]['sort']);_0x1d9602[_0xd213('0x23')]=qs[_0xd213('0x41')](_['pick'](_0x4b9868[_0xd213('0x25')],_0x2ca1cc[_0xd213('0x41')]));if(_0x4b9868[_0xd213('0x25')][_0xd213('0x49')]){_0x1d9602[_0xd213('0x23')]=_[_0xd213('0x2f')](_0x1d9602[_0xd213('0x23')],{'$or':_[_0xd213('0x4c')](_0x1d9602['attributes'],function(_0x171d1b){var _0x20ed91={};_0x20ed91[_0x171d1b]={'$like':'%'+_0x4b9868[_0xd213('0x25')][_0xd213('0x49')]+'%'};return _0x20ed91;})});}_0x1d9602=_[_0xd213('0x2f')]({},_0x1d9602,_0x4b9868[_0xd213('0x30')]);return _0x330660[_0xd213('0x53')](_0x1d9602);}})[_0xd213('0x14')](function(_0x40d738){if(_0x40d738){_0x1ef93a=_0x40d738[_0xd213('0x2d')];if(!_0x4b9868[_0xd213('0x25')]['hasOwnProperty']('nolimit')){_0x1d9602[_0xd213('0x45')]=qs[_0xd213('0x45')](_0x4b9868[_0xd213('0x25')][_0xd213('0x45')]);_0x1d9602[_0xd213('0x12')]=qs[_0xd213('0x12')](_0x4b9868[_0xd213('0x25')][_0xd213('0x12')]);}return _0x330660['getTeams'](_0x1d9602);}})[_0xd213('0x14')](function(_0x3051f4){if(_0x3051f4){return _0x3051f4?{'count':_0x1ef93a,'rows':_0x3051f4}:null;}})[_0xd213('0x14')](respondWithResult(_0x21451d,null))['catch'](handleError(_0x21451d,null));};exports[_0xd213('0x55')]=function(_0xe9b4a7,_0x2994ce){var _0x148751=_0xe9b4a7[_0xd213('0x34')][_0xd213('0x56')];return db[_0xd213('0x57')]['findAll']({'where':{'id':_0x148751},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd213('0x58'),'attributes':['id',_0xd213('0x1b'),'online',_0xd213('0x59'),'interface'],'raw':!![]}]})['then'](function(_0x21cb86){if(_0x21cb86){var _0x590b07=_[_0xd213('0x5a')](_0x21cb86,function(_0x16bb20){var _0x5f08f8=_0x16bb20[_0xd213('0x36')]({'plain':!![]});return _0x5f08f8[_0xd213('0x58')];});return db['WhatsappQueue'][_0xd213('0x31')]({'where':{'id':_0xe9b4a7['params']['id']}})[_0xd213('0x14')](function(_0x2c0733){return db[_0xd213('0x5b')]['transaction'](function(_0x2f7dea){return _0x2c0733[_0xd213('0x55')](_0x148751,{'transaction':_0x2f7dea})[_0xd213('0x14')](function(){return BPromise[_0xd213('0x5c')](_0x590b07,function(_0x243c02){return db['UserWhatsappQueue'][_0xd213('0x5d')]({'where':{'UserId':_0x243c02['id'],'WhatsappQueueId':_0xe9b4a7['params']['id']},'transaction':_0x2f7dea});});})[_0xd213('0x14')](function(){_0x590b07[_0xd213('0x5e')](function(_0x2bc16d){socket[_0xd213('0x5f')]('userWhatsappQueue:save',{'UserId':_0x2bc16d['id'],'WhatsappQueueId':_0x2c0733['id']});});});});});}})[_0xd213('0x14')](respondWithStatusCode(_0x2994ce,null))['catch'](handleError(_0x2994ce,null));};exports[_0xd213('0x60')]=function(_0x577c77,_0x29f958){return db[_0xd213('0x57')][_0xd213('0x4a')]({'where':{'id':_0x577c77[_0xd213('0x25')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd213('0x58'),'attributes':['id'],'raw':!![]}]})[_0xd213('0x14')](handleEntityNotFound(_0x29f958,null))[_0xd213('0x14')](function(_0x184df2){var _0x4f7e3c=_[_0xd213('0x4c')](_0x184df2,'id');var _0x357fe0=[];var _0x4fea99=[];var _0x5a8ae3=squel[_0xd213('0x61')]();_0x5a8ae3[_0xd213('0x62')](_0xd213('0x63'))[_0xd213('0x64')](_0xd213('0x65'),'tq')[_0xd213('0x66')](_0xd213('0x67'),'ut',_0xd213('0x68'))[_0xd213('0x23')](_0xd213('0x69'),_0x577c77['params']['id']);for(var _0x126871=0x0;_0x126871<_0x184df2[_0xd213('0x2d')];_0x126871+=0x1){let _0x28d3c0=_0x184df2[_0x126871];for(var _0x4c7c30=0x0;_0x4c7c30<_0x28d3c0[_0xd213('0x58')][_0xd213('0x2d')];_0x4c7c30+=0x1){let _0x478836=_0x28d3c0[_0xd213('0x58')][_0x4c7c30];var _0x34aeba=_0x5a8ae3[_0xd213('0x6a')]();_0x34aeba[_0xd213('0x23')](_0xd213('0x6b'),_0x478836['id']);_0x4fea99[_0xd213('0x6c')](db['sequelize'][_0xd213('0x25')](_0x34aeba[_0xd213('0x6d')](),{'type':db['sequelize'][_0xd213('0x6e')][_0xd213('0x6f')]})['then'](function(_0x5642c2){if(_0x5642c2['length']===0x1){return _0x478836['id'];}else{var _0x961876=_['every'](_['map'](_0x5642c2,_0xd213('0x70')),function(_0x40f289){return _['includes'](_0x4f7e3c,_0x40f289);});if(_0x961876){return _0x478836['id'];}}}));}}return BPromise[_0xd213('0x71')](_0x4fea99)[_0xd213('0x14')](function(_0x2fb33b){_0x357fe0=_(_0x357fe0)[_0xd213('0x72')](_0x2fb33b)[_0xd213('0x73')]()[_0xd213('0x74')]();return db[_0xd213('0x1d')][_0xd213('0x31')]({'where':{'id':_0x577c77[_0xd213('0x28')]['id']}})[_0xd213('0x14')](function(_0x5c1aad){return db[_0xd213('0x5b')]['transaction'](function(_0x1e5efb){return _0x5c1aad[_0xd213('0x60')](_0x577c77['query']['ids'],{'transaction':_0x1e5efb})['then'](function(){if(!_[_0xd213('0x75')](_0x357fe0)){return _0x5c1aad[_0xd213('0x76')](_0x357fe0,{'transaction':_0x1e5efb});}})['then'](function(){_0x357fe0['forEach'](function(_0x3a1a8d){socket[_0xd213('0x5f')](_0xd213('0x77'),{'UserId':_0x3a1a8d,'WhatsappQueueId':_0x5c1aad['id']});});});});});});})[_0xd213('0x14')](respondWithStatusCode(_0x29f958,null))['catch'](handleError(_0x29f958,null));};exports[_0xd213('0x78')]=function(_0x1f6c51,_0x139156){return db[_0xd213('0x1d')][_0xd213('0x31')]({'where':{'id':_0x1f6c51['params']['id']}})[_0xd213('0x14')](handleEntityNotFound(_0x139156,null))[_0xd213('0x14')](function(_0x4cc069){if(_0x4cc069){return _0x4cc069[_0xd213('0x78')](_0x1f6c51[_0xd213('0x34')][_0xd213('0x56')],_[_0xd213('0x79')](_0x1f6c51['body'],[_0xd213('0x56'),'id'])||{})[_0xd213('0x7a')](function(_0x530ffa){for(var _0xe2c876=0x0;_0xe2c876<_0x1f6c51[_0xd213('0x34')]['ids'][_0xd213('0x2d')];_0xe2c876+=0x1){socket[_0xd213('0x5f')]('userWhatsappQueue:save',{'UserId':Number(_0x1f6c51[_0xd213('0x34')]['ids'][_0xe2c876]),'WhatsappQueueId':Number(_0x1f6c51['params']['id'])});}return _0x530ffa;});}})[_0xd213('0x14')](respondWithResult(_0x139156,null))[_0xd213('0x32')](handleError(_0x139156,null));};exports[_0xd213('0x76')]=function(_0x288c37,_0x14ea4c){return db[_0xd213('0x1d')][_0xd213('0x31')]({'where':{'id':_0x288c37[_0xd213('0x28')]['id']}})[_0xd213('0x14')](handleEntityNotFound(_0x14ea4c,null))[_0xd213('0x14')](function(_0x52ac2b){if(_0x52ac2b){return _0x52ac2b['removeAgents'](_0x288c37[_0xd213('0x25')]['ids'])[_0xd213('0x14')](function(){if(_[_0xd213('0x7b')](_0x288c37['query'][_0xd213('0x56')])){for(var _0x13cfae=0x0;_0x13cfae<_0x288c37[_0xd213('0x25')][_0xd213('0x56')]['length'];_0x13cfae+=0x1){socket[_0xd213('0x5f')](_0xd213('0x77'),{'UserId':Number(_0x288c37[_0xd213('0x25')][_0xd213('0x56')][_0x13cfae]),'WhatsappQueueId':Number(_0x288c37['params']['id'])});}}else{socket[_0xd213('0x5f')](_0xd213('0x77'),{'UserId':Number(_0x288c37[_0xd213('0x25')][_0xd213('0x56')]),'WhatsappQueueId':Number(_0x288c37['params']['id'])});}});}})[_0xd213('0x14')](respondWithStatusCode(_0x14ea4c,null))[_0xd213('0x32')](handleError(_0x14ea4c,null));};exports[_0xd213('0x7c')]=function(_0x1671ba,_0x5b8345){var _0x53e1e1={};var _0x14e6b7={};var _0x247462;var _0x3b3d03;return db[_0xd213('0x1d')]['findOne']({'where':{'id':_0x1671ba[_0xd213('0x28')]['id']}})[_0xd213('0x14')](handleEntityNotFound(_0x5b8345,null))[_0xd213('0x14')](function(_0x4a2af9){if(_0x4a2af9){_0x247462=_0x4a2af9;_0x14e6b7[_0xd213('0x29')]=_[_0xd213('0x2a')](db[_0xd213('0x7d')][_0xd213('0x1e')]);_0x14e6b7[_0xd213('0x25')]=_[_0xd213('0x2a')](_0x1671ba[_0xd213('0x25')]);_0x14e6b7['filters']=_['intersection'](_0x14e6b7['model'],_0x14e6b7[_0xd213('0x25')]);_0x53e1e1[_0xd213('0x2c')]=_['intersection'](_0x14e6b7[_0xd213('0x29')],qs[_0xd213('0x42')](_0x1671ba[_0xd213('0x25')][_0xd213('0x42')]));_0x53e1e1[_0xd213('0x2c')]=_0x53e1e1[_0xd213('0x2c')][_0xd213('0x2d')]?_0x53e1e1[_0xd213('0x2c')]:_0x14e6b7[_0xd213('0x29')];_0x53e1e1[_0xd213('0x54')]=qs[_0xd213('0x46')](_0x1671ba['query'][_0xd213('0x46')]);_0x53e1e1[_0xd213('0x23')]=qs[_0xd213('0x41')](_[_0xd213('0x47')](_0x1671ba[_0xd213('0x25')],_0x14e6b7[_0xd213('0x41')]));if(_0x1671ba['query'][_0xd213('0x49')]){_0x53e1e1[_0xd213('0x23')]=_['merge'](_0x53e1e1[_0xd213('0x23')],{'$or':_['map'](_0x53e1e1[_0xd213('0x2c')],function(_0x3b48c4){var _0x4c3851={};_0x4c3851[_0x3b48c4]={'$like':'%'+_0x1671ba[_0xd213('0x25')]['filter']+'%'};return _0x4c3851;})});}_0x53e1e1=_[_0xd213('0x2f')]({},_0x53e1e1,_0x1671ba['options']);return _0x247462[_0xd213('0x7c')](_0x53e1e1);}})[_0xd213('0x14')](function(_0x407b43){if(_0x407b43){_0x3b3d03=_0x407b43['length'];if(!_0x1671ba['query'][_0xd213('0x43')](_0xd213('0x44'))){_0x53e1e1[_0xd213('0x45')]=qs[_0xd213('0x45')](_0x1671ba[_0xd213('0x25')]['limit']);_0x53e1e1[_0xd213('0x12')]=qs[_0xd213('0x12')](_0x1671ba['query'][_0xd213('0x12')]);}return _0x247462['getAgents'](_0x53e1e1);}})[_0xd213('0x14')](function(_0x57a5f5){if(_0x57a5f5){return _0x57a5f5?{'count':_0x3b3d03,'rows':_0x57a5f5}:null;}})[_0xd213('0x14')](respondWithResult(_0x5b8345,null))[_0xd213('0x32')](handleError(_0x5b8345,null));}; \ No newline at end of file +var _0x56fa=['limit','count','set','Content-Range','update','then','WhatsappQueues','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','where','WhatsappQueue','include','query','findAll','rows','show','model','keys','intersection','fields','attributes','length','includeAll','merge','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserWhatsappQueue','filters','hasOwnProperty','nolimit','order','sort','WhatsappQueueId','filter','options','User','findAndCountAll','UserId','whatsappPause','updatedAt','format','%s/%s','createdAt','getTeams','findOne','Team','pick','addTeams','online','voicePause','interface','sequelize','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','ids','Agents','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','offset','undefined'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0x56fa,0x1dd));var _0xa56f=function(_0xc74304,_0x26d046){_0xc74304=_0xc74304-0x0;var _0x56d2f7=_0x56fa[_0xc74304];return _0x56d2f7;};'use strict';var BPromise=require(_0xa56f('0x0'));var util=require(_0xa56f('0x1'));var _=require(_0xa56f('0x2'));var squel=require('squel');var Redis=require(_0xa56f('0x3'));var qs=require(_0xa56f('0x4'));var logger=require(_0xa56f('0x5'))(_0xa56f('0x6'));var config=require(_0xa56f('0x7'));var db=require(_0xa56f('0x8'))['db'];config[_0xa56f('0x9')]=_['defaults'](config['redis'],{'host':_0xa56f('0xa'),'port':0x18eb});var socket=require(_0xa56f('0xb'))(new Redis(config[_0xa56f('0x9')]));require(_0xa56f('0xc'))[_0xa56f('0xd')](socket);function respondWithStatusCode(_0x2394b0,_0x5b4ffc){_0x5b4ffc=_0x5b4ffc||0xcc;return function(_0x2a07ac){if(_0x2a07ac){return _0x2394b0['sendStatus'](_0x5b4ffc);}return _0x2394b0[_0xa56f('0xe')](_0x5b4ffc)[_0xa56f('0xf')]();};}function respondWithResult(_0x371144,_0x26c551){_0x26c551=_0x26c551||0xc8;return function(_0xa90e4b){if(_0xa90e4b){return _0x371144['status'](_0x26c551)[_0xa56f('0x10')](_0xa90e4b);}};}function respondWithFilteredResult(_0x5bc390,_0x551a95){return function(_0x419253){if(_0x419253){var _0x48d050=typeof _0x551a95[_0xa56f('0x11')]===_0xa56f('0x12')&&typeof _0x551a95[_0xa56f('0x13')]==='undefined';var _0x33b47b=_0x419253[_0xa56f('0x14')];var _0x5377bb=_0x48d050?0x0:_0x551a95[_0xa56f('0x11')];var _0x12c505=_0x48d050?_0x419253[_0xa56f('0x14')]:_0x551a95[_0xa56f('0x11')]+_0x551a95[_0xa56f('0x13')];var _0x37c630;if(_0x12c505>=_0x33b47b){_0x12c505=_0x33b47b;_0x37c630=0xc8;}else{_0x37c630=0xce;}_0x5bc390[_0xa56f('0xe')](_0x37c630);return _0x5bc390[_0xa56f('0x15')](_0xa56f('0x16'),_0x5377bb+'-'+_0x12c505+'/'+_0x33b47b)[_0xa56f('0x10')](_0x419253);}return null;};}function saveUpdates(_0x5596c1){return function(_0x6e96d6){if(_0x6e96d6){return _0x6e96d6[_0xa56f('0x17')](_0x5596c1)[_0xa56f('0x18')](function(_0x528d2f){return _0x528d2f;});}return null;};}function removeEntity(_0x5ea851){return function(_0x2868b0){if(_0x2868b0){return _0x2868b0['destroy']()['then'](function(){var _0x5b59bf=_0x2868b0['get']({'plain':!![]});var _0x85ba3c=_0xa56f('0x19');return db['UserProfileResource'][_0xa56f('0x1a')]({'where':{'type':_0x85ba3c,'resourceId':_0x5b59bf['id']}})[_0xa56f('0x18')](function(){return _0x2868b0;});})[_0xa56f('0x18')](function(){_0x5ea851[_0xa56f('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29590c){return function(_0x33779e){if(!_0x33779e){_0x29590c[_0xa56f('0x1b')](0x194);}return _0x33779e;};}function handleError(_0x2fbbfc,_0x2e6fe1){_0x2e6fe1=_0x2e6fe1||0x1f4;return function(_0x543a43){logger[_0xa56f('0x1c')](_0x543a43[_0xa56f('0x1d')]);if(_0x543a43[_0xa56f('0x1e')]){delete _0x543a43['name'];}_0x2fbbfc[_0xa56f('0xe')](_0x2e6fe1)['send'](_0x543a43);};}exports[_0xa56f('0x1f')]=function(_0x538259,_0x340378){var _0x50c6c5={};var _0x4d771a={'count':0x0,'rows':[]};var _0x37a502=_[_0xa56f('0x20')](db['WhatsappQueue'][_0xa56f('0x21')],function(_0x407201){return{'name':_0x407201[_0xa56f('0x22')],'type':_0x407201[_0xa56f('0x23')][_0xa56f('0x24')]};});_0x50c6c5=qs['getOptions'](_0x37a502,_0x538259);var _0x2bd5e0={'where':_0x50c6c5[_0xa56f('0x25')]};return db[_0xa56f('0x26')][_0xa56f('0x14')](_0x2bd5e0)[_0xa56f('0x18')](function(_0x51e1e9){_0x4d771a[_0xa56f('0x14')]=_0x51e1e9;_0x50c6c5[_0xa56f('0x27')]=qs[_0xa56f('0x27')](_0x538259[_0xa56f('0x28')]);return db[_0xa56f('0x26')][_0xa56f('0x29')](_0x50c6c5);})['then'](function(_0x5d9ea3){_0x4d771a[_0xa56f('0x2a')]=_0x5d9ea3;return _0x4d771a;})[_0xa56f('0x18')](respondWithFilteredResult(_0x340378,_0x50c6c5))['catch'](handleError(_0x340378,null));};exports[_0xa56f('0x2b')]=function(_0x10df77,_0x579ce1){var _0x43db20={'raw':!![],'where':{'id':_0x10df77['params']['id']}},_0x298996={};_0x298996[_0xa56f('0x2c')]=_[_0xa56f('0x2d')](db[_0xa56f('0x26')]['rawAttributes']);_0x298996[_0xa56f('0x28')]=_[_0xa56f('0x2d')](_0x10df77[_0xa56f('0x28')]);_0x298996['filters']=_[_0xa56f('0x2e')](_0x298996[_0xa56f('0x2c')],_0x298996['query']);_0x43db20['attributes']=_[_0xa56f('0x2e')](_0x298996['model'],qs[_0xa56f('0x2f')](_0x10df77[_0xa56f('0x28')][_0xa56f('0x2f')]));_0x43db20[_0xa56f('0x30')]=_0x43db20[_0xa56f('0x30')][_0xa56f('0x31')]?_0x43db20[_0xa56f('0x30')]:_0x298996[_0xa56f('0x2c')];if(_0x10df77[_0xa56f('0x28')][_0xa56f('0x32')]){_0x43db20[_0xa56f('0x27')]=[{'all':!![]}];}_0x43db20=_[_0xa56f('0x33')]({},_0x43db20,_0x10df77['options']);return db[_0xa56f('0x26')][_0xa56f('0x34')](_0x43db20)[_0xa56f('0x18')](handleEntityNotFound(_0x579ce1,null))[_0xa56f('0x18')](respondWithResult(_0x579ce1,null))[_0xa56f('0x35')](handleError(_0x579ce1,null));};exports[_0xa56f('0x36')]=function(_0x27f724,_0x4d6124){return db[_0xa56f('0x26')][_0xa56f('0x36')](_0x27f724[_0xa56f('0x37')],{})[_0xa56f('0x18')](function(_0x1c1470){var _0x691de4=_0x27f724['user'][_0xa56f('0x38')]({'plain':!![]});if(!_0x691de4)throw new Error(_0xa56f('0x39'));if(_0x691de4[_0xa56f('0x3a')]===_0xa56f('0x3b')){var _0x992235=_0x1c1470[_0xa56f('0x38')]({'plain':!![]});var _0x417be4=_0xa56f('0x19');return db[_0xa56f('0x3c')]['find']({'where':{'name':_0x417be4,'userProfileId':_0x691de4[_0xa56f('0x3d')]},'raw':!![]})[_0xa56f('0x18')](function(_0x58bbce){if(_0x58bbce&&_0x58bbce[_0xa56f('0x3e')]===0x0){return db['UserProfileResource'][_0xa56f('0x36')]({'name':_0x992235['name'],'resourceId':_0x992235['id'],'type':_0x58bbce[_0xa56f('0x1e')],'sectionId':_0x58bbce['id']},{})[_0xa56f('0x18')](function(){return _0x1c1470;});}else{return _0x1c1470;}})[_0xa56f('0x35')](function(_0x2d8f72){logger[_0xa56f('0x1c')](_0xa56f('0x3f'),_0x2d8f72);throw _0x2d8f72;});}return _0x1c1470;})[_0xa56f('0x18')](respondWithResult(_0x4d6124,0xc9))[_0xa56f('0x35')](handleError(_0x4d6124,null));};exports[_0xa56f('0x17')]=function(_0x981627,_0x371569){if(_0x981627[_0xa56f('0x37')]['id']){delete _0x981627['body']['id'];}return db[_0xa56f('0x26')][_0xa56f('0x34')]({'where':{'id':_0x981627['params']['id']}})['then'](handleEntityNotFound(_0x371569,null))['then'](saveUpdates(_0x981627[_0xa56f('0x37')],null))[_0xa56f('0x18')](respondWithResult(_0x371569,null))[_0xa56f('0x35')](handleError(_0x371569,null));};exports[_0xa56f('0x1a')]=function(_0x22e465,_0x39c6be){return db[_0xa56f('0x26')][_0xa56f('0x34')]({'where':{'id':_0x22e465[_0xa56f('0x40')]['id']}})[_0xa56f('0x18')](handleEntityNotFound(_0x39c6be,null))[_0xa56f('0x18')](removeEntity(_0x39c6be,null))[_0xa56f('0x35')](handleError(_0x39c6be,null));};exports[_0xa56f('0x41')]=function(_0x10c965,_0x318d9f){return db[_0xa56f('0x26')]['describe']()['then'](respondWithResult(_0x318d9f,null))[_0xa56f('0x35')](handleError(_0x318d9f,null));};exports[_0xa56f('0x42')]=function(_0x38aece,_0x5a9d8c){var _0x241fa5={'raw':!![],'where':{}},_0x41fe3c={},_0x1cc947;return db[_0xa56f('0x26')]['findOne']({'where':{'id':_0x38aece['params']['id']}})[_0xa56f('0x18')](handleEntityNotFound(_0x5a9d8c,null))[_0xa56f('0x18')](function(_0x5ac20f){if(_0x5ac20f){_0x1cc947=_0x5ac20f[_0xa56f('0x38')]({'plain':!![]});_0x41fe3c[_0xa56f('0x2c')]=_[_0xa56f('0x2d')](db[_0xa56f('0x43')][_0xa56f('0x21')]);_0x41fe3c[_0xa56f('0x28')]=_[_0xa56f('0x2d')](_0x38aece['query']);_0x41fe3c[_0xa56f('0x44')]=_['intersection'](_0x41fe3c[_0xa56f('0x2c')],_0x41fe3c['query']);_0x241fa5[_0xa56f('0x30')]=_[_0xa56f('0x2e')](_0x41fe3c[_0xa56f('0x2c')],qs['fields'](_0x38aece['query'][_0xa56f('0x2f')]));_0x241fa5[_0xa56f('0x30')]=_0x241fa5['attributes']['length']?_0x241fa5[_0xa56f('0x30')]:_0x41fe3c['model'];if(!_0x38aece[_0xa56f('0x28')][_0xa56f('0x45')](_0xa56f('0x46'))){_0x241fa5['limit']=qs[_0xa56f('0x13')](_0x38aece[_0xa56f('0x28')]['limit']);_0x241fa5[_0xa56f('0x11')]=qs[_0xa56f('0x11')](_0x38aece[_0xa56f('0x28')][_0xa56f('0x11')]);}_0x241fa5[_0xa56f('0x47')]=qs['sort'](_0x38aece[_0xa56f('0x28')][_0xa56f('0x48')]);_0x241fa5[_0xa56f('0x25')]=qs[_0xa56f('0x44')](_['pick'](_0x38aece[_0xa56f('0x28')],_0x41fe3c[_0xa56f('0x44')]));_0x241fa5[_0xa56f('0x25')][_0xa56f('0x49')]=_0x5ac20f['id'];if(_0x38aece[_0xa56f('0x28')][_0xa56f('0x4a')]){_0x241fa5[_0xa56f('0x25')]=_[_0xa56f('0x33')](_0x241fa5[_0xa56f('0x25')],{'$or':_['map'](_0x241fa5['attributes'],function(_0x4395f5){var _0xa10caa={};_0xa10caa[_0x4395f5]={'$like':'%'+_0x38aece[_0xa56f('0x28')][_0xa56f('0x4a')]+'%'};return _0xa10caa;})});}_0x241fa5=_[_0xa56f('0x33')]({},_0x241fa5,_0x38aece[_0xa56f('0x4b')]);return db[_0xa56f('0x43')][_0xa56f('0x29')](_0x241fa5);}})[_0xa56f('0x18')](function(_0x297834){if(_0x297834){return db[_0xa56f('0x4c')][_0xa56f('0x4d')]({'where':{'id':_[_0xa56f('0x20')](_0x297834,_0xa56f('0x4e')),'role':'agent'},'attributes':['id',_0xa56f('0x1e'),_0xa56f('0x4f'),_0xa56f('0x50'),'createdAt']});}})[_0xa56f('0x18')](function(_0x2f6a00){if(_0x2f6a00){return{'count':_0x2f6a00[_0xa56f('0x14')],'rows':_[_0xa56f('0x20')](_0x2f6a00[_0xa56f('0x2a')],function(_0x210510){return{'membername':_0x210510['name'],'UserId':_0x210510['id'],'queue_name':_0x1cc947[_0xa56f('0x1e')],'WhatsappQueueId':_0x1cc947['id'],'interface':util[_0xa56f('0x51')](_0xa56f('0x52'),'SIP',_0x210510[_0xa56f('0x1e')]),'penalty':0x0,'paused':_0x210510[_0xa56f('0x4f')],'createdAt':_0x210510[_0xa56f('0x53')],'updatedAt':_0x210510[_0xa56f('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa56f('0x18')](respondWithFilteredResult(_0x5a9d8c,_0x241fa5))['catch'](handleError(_0x5a9d8c,null));};exports[_0xa56f('0x54')]=function(_0x62c312,_0x27e6a5){var _0x5d2c3f={};var _0x192f46={};var _0x5437a9;var _0x560b7e;return db['WhatsappQueue'][_0xa56f('0x55')]({'where':{'id':_0x62c312[_0xa56f('0x40')]['id']}})[_0xa56f('0x18')](handleEntityNotFound(_0x27e6a5,null))[_0xa56f('0x18')](function(_0x11bfd2){if(_0x11bfd2){_0x5437a9=_0x11bfd2;_0x192f46[_0xa56f('0x2c')]=_[_0xa56f('0x2d')](db[_0xa56f('0x56')]['rawAttributes']);_0x192f46['query']=_[_0xa56f('0x2d')](_0x62c312[_0xa56f('0x28')]);_0x192f46[_0xa56f('0x44')]=_[_0xa56f('0x2e')](_0x192f46[_0xa56f('0x2c')],_0x192f46[_0xa56f('0x28')]);_0x5d2c3f['attributes']=_[_0xa56f('0x2e')](_0x192f46[_0xa56f('0x2c')],qs[_0xa56f('0x2f')](_0x62c312[_0xa56f('0x28')][_0xa56f('0x2f')]));_0x5d2c3f[_0xa56f('0x30')]=_0x5d2c3f[_0xa56f('0x30')][_0xa56f('0x31')]?_0x5d2c3f['attributes']:_0x192f46[_0xa56f('0x2c')];_0x5d2c3f[_0xa56f('0x47')]=qs[_0xa56f('0x48')](_0x62c312[_0xa56f('0x28')][_0xa56f('0x48')]);_0x5d2c3f[_0xa56f('0x25')]=qs[_0xa56f('0x44')](_[_0xa56f('0x57')](_0x62c312['query'],_0x192f46[_0xa56f('0x44')]));if(_0x62c312[_0xa56f('0x28')][_0xa56f('0x4a')]){_0x5d2c3f['where']=_[_0xa56f('0x33')](_0x5d2c3f['where'],{'$or':_['map'](_0x5d2c3f[_0xa56f('0x30')],function(_0x266aa6){var _0xc6b896={};_0xc6b896[_0x266aa6]={'$like':'%'+_0x62c312[_0xa56f('0x28')][_0xa56f('0x4a')]+'%'};return _0xc6b896;})});}_0x5d2c3f=_['merge']({},_0x5d2c3f,_0x62c312[_0xa56f('0x4b')]);return _0x5437a9[_0xa56f('0x54')](_0x5d2c3f);}})[_0xa56f('0x18')](function(_0x44a93f){if(_0x44a93f){_0x560b7e=_0x44a93f[_0xa56f('0x31')];if(!_0x62c312[_0xa56f('0x28')][_0xa56f('0x45')]('nolimit')){_0x5d2c3f['limit']=qs[_0xa56f('0x13')](_0x62c312[_0xa56f('0x28')]['limit']);_0x5d2c3f[_0xa56f('0x11')]=qs['offset'](_0x62c312[_0xa56f('0x28')][_0xa56f('0x11')]);}return _0x5437a9[_0xa56f('0x54')](_0x5d2c3f);}})[_0xa56f('0x18')](function(_0x2ffc52){if(_0x2ffc52){return _0x2ffc52?{'count':_0x560b7e,'rows':_0x2ffc52}:null;}})[_0xa56f('0x18')](respondWithResult(_0x27e6a5,null))[_0xa56f('0x35')](handleError(_0x27e6a5,null));};exports[_0xa56f('0x58')]=function(_0x3d62c4,_0x325e2f){var _0x2f44ec=_0x3d62c4[_0xa56f('0x37')]['ids'];return db[_0xa56f('0x56')][_0xa56f('0x29')]({'where':{'id':_0x2f44ec},'attributes':['id'],'include':[{'model':db[_0xa56f('0x4c')],'as':'Agents','attributes':['id',_0xa56f('0x1e'),_0xa56f('0x59'),_0xa56f('0x5a'),_0xa56f('0x5b')],'raw':!![]}]})[_0xa56f('0x18')](function(_0x132a2d){if(_0x132a2d){var _0x137de9=_['flatMap'](_0x132a2d,function(_0x3abafe){var _0x4a9f4e=_0x3abafe[_0xa56f('0x38')]({'plain':!![]});return _0x4a9f4e['Agents'];});return db[_0xa56f('0x26')][_0xa56f('0x34')]({'where':{'id':_0x3d62c4[_0xa56f('0x40')]['id']}})[_0xa56f('0x18')](function(_0x46ec64){return db[_0xa56f('0x5c')]['transaction'](function(_0x3d7a9e){return _0x46ec64[_0xa56f('0x58')](_0x2f44ec,{'transaction':_0x3d7a9e})['then'](function(){return BPromise[_0xa56f('0x5d')](_0x137de9,function(_0x40b80d){return db[_0xa56f('0x43')][_0xa56f('0x5e')]({'where':{'UserId':_0x40b80d['id'],'WhatsappQueueId':_0x3d62c4['params']['id']},'transaction':_0x3d7a9e});});})[_0xa56f('0x18')](function(){_0x137de9['forEach'](function(_0x45bdd3){socket[_0xa56f('0x5f')](_0xa56f('0x60'),{'UserId':_0x45bdd3['id'],'WhatsappQueueId':_0x46ec64['id']});});});});});}})[_0xa56f('0x18')](respondWithStatusCode(_0x325e2f,null))[_0xa56f('0x35')](handleError(_0x325e2f,null));};exports[_0xa56f('0x61')]=function(_0x4ee78b,_0x248adb){return db[_0xa56f('0x56')][_0xa56f('0x29')]({'where':{'id':_0x4ee78b[_0xa56f('0x28')][_0xa56f('0x62')]},'attributes':['id'],'include':[{'model':db[_0xa56f('0x4c')],'as':_0xa56f('0x63'),'attributes':['id'],'raw':!![]}]})[_0xa56f('0x18')](handleEntityNotFound(_0x248adb,null))[_0xa56f('0x18')](function(_0x3fea85){var _0x2f9ce8=_[_0xa56f('0x20')](_0x3fea85,'id');var _0x319b4f=[];var _0x522724=[];var _0x5d42b6=squel[_0xa56f('0x64')]();_0x5d42b6[_0xa56f('0x65')](_0xa56f('0x66'))[_0xa56f('0x67')](_0xa56f('0x68'),'tq')[_0xa56f('0x69')](_0xa56f('0x6a'),'ut',_0xa56f('0x6b'))[_0xa56f('0x25')]('WhatsappQueueId\x20=\x20?',_0x4ee78b[_0xa56f('0x40')]['id']);for(var _0x1d977f=0x0;_0x1d977f<_0x3fea85[_0xa56f('0x31')];_0x1d977f+=0x1){let _0x57b344=_0x3fea85[_0x1d977f];for(var _0x47bf93=0x0;_0x47bf93<_0x57b344['Agents'][_0xa56f('0x31')];_0x47bf93+=0x1){let _0x41579f=_0x57b344['Agents'][_0x47bf93];var _0x1b647a=_0x5d42b6[_0xa56f('0x6c')]();_0x1b647a[_0xa56f('0x25')](_0xa56f('0x6d'),_0x41579f['id']);_0x522724[_0xa56f('0x6e')](db[_0xa56f('0x5c')]['query'](_0x1b647a[_0xa56f('0x6f')](),{'type':db[_0xa56f('0x5c')][_0xa56f('0x70')][_0xa56f('0x71')]})[_0xa56f('0x18')](function(_0x13b368){if(_0x13b368[_0xa56f('0x31')]===0x1){return _0x41579f['id'];}else{var _0x37051a=_['every'](_[_0xa56f('0x20')](_0x13b368,'TeamId'),function(_0x413675){return _[_0xa56f('0x72')](_0x2f9ce8,_0x413675);});if(_0x37051a){return _0x41579f['id'];}}}));}}return BPromise[_0xa56f('0x73')](_0x522724)[_0xa56f('0x18')](function(_0x3785dc){_0x319b4f=_(_0x319b4f)[_0xa56f('0x74')](_0x3785dc)['compact']()['value']();return db[_0xa56f('0x26')][_0xa56f('0x34')]({'where':{'id':_0x4ee78b[_0xa56f('0x40')]['id']}})[_0xa56f('0x18')](function(_0x272c26){return db['sequelize'][_0xa56f('0x75')](function(_0x48f9a7){return _0x272c26[_0xa56f('0x61')](_0x4ee78b[_0xa56f('0x28')][_0xa56f('0x62')],{'transaction':_0x48f9a7})[_0xa56f('0x18')](function(){if(!_[_0xa56f('0x76')](_0x319b4f)){return _0x272c26[_0xa56f('0x77')](_0x319b4f,{'transaction':_0x48f9a7});}})[_0xa56f('0x18')](function(){_0x319b4f['forEach'](function(_0x5f050d){socket[_0xa56f('0x5f')](_0xa56f('0x78'),{'UserId':_0x5f050d,'WhatsappQueueId':_0x272c26['id']});});});});});});})[_0xa56f('0x18')](respondWithStatusCode(_0x248adb,null))[_0xa56f('0x35')](handleError(_0x248adb,null));};exports[_0xa56f('0x79')]=function(_0x535a23,_0x2098eb){return db[_0xa56f('0x26')][_0xa56f('0x34')]({'where':{'id':_0x535a23[_0xa56f('0x40')]['id']}})[_0xa56f('0x18')](handleEntityNotFound(_0x2098eb,null))[_0xa56f('0x18')](function(_0x2be825){if(_0x2be825){return _0x2be825[_0xa56f('0x79')](_0x535a23[_0xa56f('0x37')][_0xa56f('0x62')],_[_0xa56f('0x7a')](_0x535a23[_0xa56f('0x37')],['ids','id'])||{})['spread'](function(_0x3dc2f9){for(var _0x18e0a1=0x0;_0x18e0a1<_0x535a23[_0xa56f('0x37')][_0xa56f('0x62')]['length'];_0x18e0a1+=0x1){socket[_0xa56f('0x5f')]('userWhatsappQueue:save',{'UserId':Number(_0x535a23[_0xa56f('0x37')][_0xa56f('0x62')][_0x18e0a1]),'WhatsappQueueId':Number(_0x535a23[_0xa56f('0x40')]['id'])});}return _0x3dc2f9;});}})['then'](respondWithResult(_0x2098eb,null))[_0xa56f('0x35')](handleError(_0x2098eb,null));};exports[_0xa56f('0x77')]=function(_0x41c46e,_0x1f84bd){return db['WhatsappQueue'][_0xa56f('0x34')]({'where':{'id':_0x41c46e[_0xa56f('0x40')]['id']}})[_0xa56f('0x18')](handleEntityNotFound(_0x1f84bd,null))[_0xa56f('0x18')](function(_0x11b31b){if(_0x11b31b){return _0x11b31b[_0xa56f('0x77')](_0x41c46e[_0xa56f('0x28')][_0xa56f('0x62')])['then'](function(){if(_['isArray'](_0x41c46e[_0xa56f('0x28')][_0xa56f('0x62')])){for(var _0x57ade5=0x0;_0x57ade5<_0x41c46e[_0xa56f('0x28')]['ids'][_0xa56f('0x31')];_0x57ade5+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x41c46e['query'][_0xa56f('0x62')][_0x57ade5]),'WhatsappQueueId':Number(_0x41c46e['params']['id'])});}}else{socket[_0xa56f('0x5f')](_0xa56f('0x78'),{'UserId':Number(_0x41c46e[_0xa56f('0x28')]['ids']),'WhatsappQueueId':Number(_0x41c46e[_0xa56f('0x40')]['id'])});}});}})[_0xa56f('0x18')](respondWithStatusCode(_0x1f84bd,null))['catch'](handleError(_0x1f84bd,null));};exports[_0xa56f('0x7b')]=function(_0x1a70ae,_0x2201e8){var _0x1e7646={};var _0x3b2215={};var _0x229ac8;var _0x2b9d28;return db[_0xa56f('0x26')][_0xa56f('0x55')]({'where':{'id':_0x1a70ae[_0xa56f('0x40')]['id']}})[_0xa56f('0x18')](handleEntityNotFound(_0x2201e8,null))['then'](function(_0x376fb2){if(_0x376fb2){_0x229ac8=_0x376fb2;_0x3b2215[_0xa56f('0x2c')]=_[_0xa56f('0x2d')](db[_0xa56f('0x4c')][_0xa56f('0x21')]);_0x3b2215['query']=_['keys'](_0x1a70ae['query']);_0x3b2215[_0xa56f('0x44')]=_[_0xa56f('0x2e')](_0x3b2215['model'],_0x3b2215[_0xa56f('0x28')]);_0x1e7646[_0xa56f('0x30')]=_[_0xa56f('0x2e')](_0x3b2215[_0xa56f('0x2c')],qs[_0xa56f('0x2f')](_0x1a70ae[_0xa56f('0x28')][_0xa56f('0x2f')]));_0x1e7646[_0xa56f('0x30')]=_0x1e7646['attributes'][_0xa56f('0x31')]?_0x1e7646['attributes']:_0x3b2215[_0xa56f('0x2c')];_0x1e7646[_0xa56f('0x47')]=qs['sort'](_0x1a70ae[_0xa56f('0x28')][_0xa56f('0x48')]);_0x1e7646[_0xa56f('0x25')]=qs[_0xa56f('0x44')](_[_0xa56f('0x57')](_0x1a70ae[_0xa56f('0x28')],_0x3b2215[_0xa56f('0x44')]));if(_0x1a70ae['query']['filter']){_0x1e7646['where']=_['merge'](_0x1e7646[_0xa56f('0x25')],{'$or':_[_0xa56f('0x20')](_0x1e7646['attributes'],function(_0x3d4770){var _0x2be0f1={};_0x2be0f1[_0x3d4770]={'$like':'%'+_0x1a70ae[_0xa56f('0x28')][_0xa56f('0x4a')]+'%'};return _0x2be0f1;})});}_0x1e7646=_[_0xa56f('0x33')]({},_0x1e7646,_0x1a70ae[_0xa56f('0x4b')]);return _0x229ac8[_0xa56f('0x7b')](_0x1e7646);}})['then'](function(_0x41029a){if(_0x41029a){_0x2b9d28=_0x41029a['length'];if(!_0x1a70ae[_0xa56f('0x28')][_0xa56f('0x45')](_0xa56f('0x46'))){_0x1e7646['limit']=qs['limit'](_0x1a70ae[_0xa56f('0x28')][_0xa56f('0x13')]);_0x1e7646[_0xa56f('0x11')]=qs[_0xa56f('0x11')](_0x1a70ae[_0xa56f('0x28')][_0xa56f('0x11')]);}return _0x229ac8[_0xa56f('0x7b')](_0x1e7646);}})[_0xa56f('0x18')](function(_0x30b23a){if(_0x30b23a){return _0x30b23a?{'count':_0x2b9d28,'rows':_0x30b23a}:null;}})[_0xa56f('0x18')](respondWithResult(_0x2201e8,null))[_0xa56f('0x35')](handleError(_0x2201e8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 072aaef..77419af 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 _0xdad0=['save','emit','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x222c00,_0x4cec78){var _0x20e9c2=function(_0x560f39){while(--_0x560f39){_0x222c00['push'](_0x222c00['shift']());}};_0x20e9c2(++_0x4cec78);}(_0xdad0,0x131));var _0x0dad=function(_0xfdadfe,_0x251fd3){_0xfdadfe=_0xfdadfe-0x0;var _0x1de0b9=_0xdad0[_0xfdadfe];return _0x1de0b9;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x0dad('0x0'))['db'][_0x0dad('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x0dad('0x2')](0x0);var events={'afterCreate':_0x0dad('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x20e007){return function(_0x3a5dc9,_0x59474e,_0x29e4bf){WhatsappQueueEvents[_0x0dad('0x4')](_0x20e007+':'+_0x3a5dc9['id'],_0x3a5dc9);WhatsappQueueEvents[_0x0dad('0x4')](_0x20e007,_0x3a5dc9);_0x29e4bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x0dad('0x5')](e,emitEvent(event));}}module[_0x0dad('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x8e7c=['../../mysqldb','WhatsappQueue','setMaxListeners','update','emit','hasOwnProperty','events'];(function(_0x35ce45,_0x533d08){var _0x1144be=function(_0x1f9a8c){while(--_0x1f9a8c){_0x35ce45['push'](_0x35ce45['shift']());}};_0x1144be(++_0x533d08);}(_0x8e7c,0x11e));var _0xc8e7=function(_0x2d5eab,_0x4243c7){_0x2d5eab=_0x2d5eab-0x0;var _0x48d4c3=_0x8e7c[_0x2d5eab];return _0x48d4c3;};'use strict';var EventEmitter=require(_0xc8e7('0x0'));var WhatsappQueue=require(_0xc8e7('0x1'))['db'][_0xc8e7('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc8e7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc8e7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4e9ae2){return function(_0x3ab9b8,_0x530bc5,_0x5bbaa6){WhatsappQueueEvents[_0xc8e7('0x5')](_0x4e9ae2+':'+_0x3ab9b8['id'],_0x3ab9b8);WhatsappQueueEvents[_0xc8e7('0x5')](_0x4e9ae2,_0x3ab9b8);_0x5bbaa6(null);};}for(var e in events){if(events[_0xc8e7('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f5bdd85..a06d6b2 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 _0x5255=['WhatsappQueue','whatsapp_queues','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0x19b441,_0x4f9b95){var _0x2618db=function(_0x1ad15a){while(--_0x1ad15a){_0x19b441['push'](_0x19b441['shift']());}};_0x2618db(++_0x4f9b95);}(_0x5255,0x12b));var _0x5525=function(_0x50f452,_0x5dbd4f){_0x50f452=_0x50f452-0x0;var _0xc0f3a5=_0x5255[_0x50f452];return _0xc0f3a5;};'use strict';var _=require('lodash');var util=require(_0x5525('0x0'));var logger=require(_0x5525('0x1'))(_0x5525('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5525('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5525('0x4'));var config=require(_0x5525('0x5'));var attributes=require(_0x5525('0x6'));module[_0x5525('0x7')]=function(_0x3f5e60,_0x16819e){return _0x3f5e60[_0x5525('0x8')](_0x5525('0x9'),attributes,{'tableName':_0x5525('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ac9=['../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x19652f,_0x2524fd){var _0x6faae1=function(_0x1e931b){while(--_0x1e931b){_0x19652f['push'](_0x19652f['shift']());}};_0x6faae1(++_0x2524fd);}(_0x8ac9,0x191));var _0x98ac=function(_0x12bf9b,_0x17fdd7){_0x12bf9b=_0x12bf9b-0x0;var _0x28256d=_0x8ac9[_0x12bf9b];return _0x28256d;};'use strict';var _=require(_0x98ac('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x98ac('0x1'));var BPromise=require(_0x98ac('0x2'));var rp=require(_0x98ac('0x3'));var fs=require('fs');var path=require(_0x98ac('0x4'));var rimraf=require(_0x98ac('0x5'));var config=require(_0x98ac('0x6'));var attributes=require(_0x98ac('0x7'));module[_0x98ac('0x8')]=function(_0x4d0cc1,_0x955a9e){return _0x4d0cc1['define'](_0x98ac('0x9'),attributes,{'tableName':_0x98ac('0xa'),'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 818e528..097668f 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 _0x5de2=['then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','GetWhatsappQueue','ShowWhatsappQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request'];(function(_0x54634b,_0x1eff71){var _0x4bbcef=function(_0x2bc2a3){while(--_0x2bc2a3){_0x54634b['push'](_0x54634b['shift']());}};_0x4bbcef(++_0x1eff71);}(_0x5de2,0xeb));var _0x25de=function(_0xe1045c,_0xa56ed5){_0xe1045c=_0xe1045c-0x0;var _0x1ff2e0=_0x5de2[_0xe1045c];return _0x1ff2e0;};'use strict';var _=require(_0x25de('0x0'));var util=require(_0x25de('0x1'));var moment=require(_0x25de('0x2'));var BPromise=require(_0x25de('0x3'));var rs=require(_0x25de('0x4'));var fs=require('fs');var Redis=require(_0x25de('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x25de('0x6'));var config=require(_0x25de('0x7'));var jayson=require(_0x25de('0x8'));var client=jayson[_0x25de('0x9')]['http']({'port':0x232a});config[_0x25de('0xa')]=_[_0x25de('0xb')](config[_0x25de('0xa')],{'host':_0x25de('0xc'),'port':0x18eb});var socket=require(_0x25de('0xd'))(new Redis(config[_0x25de('0xa')]));require(_0x25de('0xe'))[_0x25de('0xf')](socket);function respondWithRpcPromise(_0x2d817f,_0x3ec1d7,_0x1df423){return new BPromise(function(_0x7ef603,_0x396a9c){return client[_0x25de('0x10')](_0x2d817f,_0x1df423)[_0x25de('0x11')](function(_0xbca335){logger[_0x25de('0x12')](_0x25de('0x13'),_0x3ec1d7,_0x25de('0x14'));logger[_0x25de('0x15')](_0x25de('0x16'),_0x3ec1d7,_0x25de('0x14'),JSON[_0x25de('0x17')](_0xbca335));if(_0xbca335['error']){if(_0xbca335[_0x25de('0x18')][_0x25de('0x19')]===0x1f4){logger['error'](_0x25de('0x13'),_0x3ec1d7,_0xbca335[_0x25de('0x18')]['message']);return _0x396a9c(_0xbca335[_0x25de('0x18')]['message']);}logger[_0x25de('0x18')](_0x25de('0x13'),_0x3ec1d7,_0xbca335['error'][_0x25de('0x1a')]);return _0x7ef603(_0xbca335[_0x25de('0x18')][_0x25de('0x1a')]);}else{logger['info'](_0x25de('0x13'),_0x3ec1d7,'request\x20sent');_0x7ef603(_0xbca335[_0x25de('0x1b')][_0x25de('0x1a')]);}})[_0x25de('0x1c')](function(_0x1581e6){logger[_0x25de('0x18')](_0x25de('0x13'),_0x3ec1d7,_0x1581e6);_0x396a9c(_0x1581e6);});});}exports['GetWhatsappQueue']=function(_0x10a221){var _0x29e555=this;return new Promise(function(_0x37d5d5,_0x4a617f){return db[_0x25de('0x1d')][_0x25de('0x1e')]({'raw':_0x10a221[_0x25de('0x1f')]?_0x10a221[_0x25de('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x10a221[_0x25de('0x1f')]?_0x10a221[_0x25de('0x1f')][_0x25de('0x20')]||null:null,'attributes':_0x10a221[_0x25de('0x1f')]?_0x10a221[_0x25de('0x1f')][_0x25de('0x21')]||null:null,'limit':_0x10a221[_0x25de('0x1f')]?_0x10a221['options'][_0x25de('0x22')]||null:null,'include':_0x10a221[_0x25de('0x1f')]?_0x10a221[_0x25de('0x1f')][_0x25de('0x23')]?_[_0x25de('0x24')](_0x10a221[_0x25de('0x1f')][_0x25de('0x23')],function(_0x3e1dba){return{'model':db[_0x3e1dba[_0x25de('0x25')]],'as':_0x3e1dba['as'],'attributes':_0x3e1dba['attributes'],'include':_0x3e1dba['include']?_[_0x25de('0x24')](_0x3e1dba['include'],function(_0x3c90cf){return{'model':db[_0x3c90cf['model']],'as':_0x3c90cf['as'],'attributes':_0x3c90cf['attributes'],'include':_0x3c90cf[_0x25de('0x23')]?_[_0x25de('0x24')](_0x3c90cf[_0x25de('0x23')],function(_0x43a967){return{'model':db[_0x43a967[_0x25de('0x25')]],'as':_0x43a967['as'],'attributes':_0x43a967[_0x25de('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a98fa){logger[_0x25de('0x12')](_0x25de('0x26'),_0x10a221);logger[_0x25de('0x15')](_0x25de('0x26'),_0x10a221,JSON['stringify'](_0x5a98fa));_0x37d5d5(_0x5a98fa);})[_0x25de('0x1c')](function(_0x121a19){logger[_0x25de('0x18')](_0x25de('0x26'),_0x121a19[_0x25de('0x1a')],_0x10a221);_0x4a617f(_0x29e555['error'](0x1f4,_0x121a19[_0x25de('0x1a')]));});});};exports[_0x25de('0x27')]=function(_0x46cac8){var _0x4381cb=this;return new Promise(function(_0x419b28,_0x5f4afa){return db['WhatsappQueue'][_0x25de('0x28')]({'raw':_0x46cac8['options']?_0x46cac8[_0x25de('0x1f')][_0x25de('0x29')]===undefined?!![]:![]:!![],'where':_0x46cac8[_0x25de('0x1f')]?_0x46cac8[_0x25de('0x1f')][_0x25de('0x20')]||null:null,'attributes':_0x46cac8['options']?_0x46cac8[_0x25de('0x1f')][_0x25de('0x21')]||null:null,'include':_0x46cac8[_0x25de('0x1f')]?_0x46cac8[_0x25de('0x1f')][_0x25de('0x23')]?_[_0x25de('0x24')](_0x46cac8['options'][_0x25de('0x23')],function(_0x212c1a){return{'model':db[_0x212c1a[_0x25de('0x25')]],'as':_0x212c1a['as'],'attributes':_0x212c1a['attributes'],'include':_0x212c1a[_0x25de('0x23')]?_[_0x25de('0x24')](_0x212c1a['include'],function(_0x59dbf3){return{'model':db[_0x59dbf3[_0x25de('0x25')]],'as':_0x59dbf3['as'],'attributes':_0x59dbf3[_0x25de('0x21')],'include':_0x59dbf3[_0x25de('0x23')]?_[_0x25de('0x24')](_0x59dbf3[_0x25de('0x23')],function(_0x15d926){return{'model':db[_0x15d926[_0x25de('0x25')]],'as':_0x15d926['as'],'attributes':_0x15d926[_0x25de('0x21')]};}):[]};}):[]};}):[]:[]})[_0x25de('0x11')](function(_0x187184){logger[_0x25de('0x12')](_0x25de('0x27'),_0x46cac8);logger[_0x25de('0x15')](_0x25de('0x27'),_0x46cac8,JSON[_0x25de('0x17')](_0x187184));_0x419b28(_0x187184);})[_0x25de('0x1c')](function(_0x336a4e){logger[_0x25de('0x18')]('ShowWhatsappQueue',_0x336a4e['message'],_0x46cac8);_0x5f4afa(_0x4381cb['error'](0x1f4,_0x336a4e['message']));});});}; \ No newline at end of file +var _0x3b49=['defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','findAll','options','raw','attributes','include','map','model','debug','stringify','catch','find','where','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x50facb,_0x252ed9){var _0xc9bef3=function(_0x477dd1){while(--_0x477dd1){_0x50facb['push'](_0x50facb['shift']());}};_0xc9bef3(++_0x252ed9);}(_0x3b49,0xe4));var _0x93b4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x3b49[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x93b4('0x0'));var util=require(_0x93b4('0x1'));var moment=require(_0x93b4('0x2'));var BPromise=require(_0x93b4('0x3'));var rs=require(_0x93b4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93b4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93b4('0x6'))(_0x93b4('0x7'));var config=require(_0x93b4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x93b4('0x9')][_0x93b4('0xa')]({'port':0x232a});config[_0x93b4('0xb')]=_[_0x93b4('0xc')](config[_0x93b4('0xb')],{'host':_0x93b4('0xd'),'port':0x18eb});var socket=require(_0x93b4('0xe'))(new Redis(config[_0x93b4('0xb')]));require(_0x93b4('0xf'))[_0x93b4('0x10')](socket);function respondWithRpcPromise(_0x2da54e,_0x5ea2a6,_0x4522ce){return new BPromise(function(_0x566859,_0x1c105f){return client[_0x93b4('0x11')](_0x2da54e,_0x4522ce)[_0x93b4('0x12')](function(_0x223893){logger[_0x93b4('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x5ea2a6,_0x93b4('0x14'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5ea2a6,'request\x20sent',JSON['stringify'](_0x223893));if(_0x223893[_0x93b4('0x15')]){if(_0x223893[_0x93b4('0x15')][_0x93b4('0x16')]===0x1f4){logger[_0x93b4('0x15')](_0x93b4('0x17'),_0x5ea2a6,_0x223893[_0x93b4('0x15')][_0x93b4('0x18')]);return _0x1c105f(_0x223893[_0x93b4('0x15')][_0x93b4('0x18')]);}logger['error'](_0x93b4('0x17'),_0x5ea2a6,_0x223893[_0x93b4('0x15')][_0x93b4('0x18')]);return _0x566859(_0x223893[_0x93b4('0x15')][_0x93b4('0x18')]);}else{logger[_0x93b4('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x5ea2a6,_0x93b4('0x14'));_0x566859(_0x223893[_0x93b4('0x19')][_0x93b4('0x18')]);}})['catch'](function(_0x3548bd){logger[_0x93b4('0x15')](_0x93b4('0x17'),_0x5ea2a6,_0x3548bd);_0x1c105f(_0x3548bd);});});}exports[_0x93b4('0x1a')]=function(_0x3af372){var _0x22478a=this;return new Promise(function(_0x1d2efc,_0x1f6df4){return db['WhatsappQueue'][_0x93b4('0x1b')]({'raw':_0x3af372[_0x93b4('0x1c')]?_0x3af372['options'][_0x93b4('0x1d')]===undefined?!![]:![]:!![],'where':_0x3af372['options']?_0x3af372[_0x93b4('0x1c')]['where']||null:null,'attributes':_0x3af372[_0x93b4('0x1c')]?_0x3af372[_0x93b4('0x1c')][_0x93b4('0x1e')]||null:null,'limit':_0x3af372['options']?_0x3af372[_0x93b4('0x1c')]['limit']||null:null,'include':_0x3af372['options']?_0x3af372[_0x93b4('0x1c')][_0x93b4('0x1f')]?_[_0x93b4('0x20')](_0x3af372[_0x93b4('0x1c')][_0x93b4('0x1f')],function(_0x159f14){return{'model':db[_0x159f14[_0x93b4('0x21')]],'as':_0x159f14['as'],'attributes':_0x159f14[_0x93b4('0x1e')],'include':_0x159f14[_0x93b4('0x1f')]?_[_0x93b4('0x20')](_0x159f14[_0x93b4('0x1f')],function(_0x5d7c12){return{'model':db[_0x5d7c12[_0x93b4('0x21')]],'as':_0x5d7c12['as'],'attributes':_0x5d7c12[_0x93b4('0x1e')],'include':_0x5d7c12[_0x93b4('0x1f')]?_['map'](_0x5d7c12['include'],function(_0x2aef45){return{'model':db[_0x2aef45[_0x93b4('0x21')]],'as':_0x2aef45['as'],'attributes':_0x2aef45[_0x93b4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13f125){logger[_0x93b4('0x13')](_0x93b4('0x1a'),_0x3af372);logger[_0x93b4('0x22')]('GetWhatsappQueue',_0x3af372,JSON[_0x93b4('0x23')](_0x13f125));_0x1d2efc(_0x13f125);})[_0x93b4('0x24')](function(_0x306e18){logger[_0x93b4('0x15')](_0x93b4('0x1a'),_0x306e18['message'],_0x3af372);_0x1f6df4(_0x22478a[_0x93b4('0x15')](0x1f4,_0x306e18['message']));});});};exports['ShowWhatsappQueue']=function(_0x25aea7){var _0x1517ff=this;return new Promise(function(_0x49b15d,_0x1a70fb){return db['WhatsappQueue'][_0x93b4('0x25')]({'raw':_0x25aea7[_0x93b4('0x1c')]?_0x25aea7[_0x93b4('0x1c')][_0x93b4('0x1d')]===undefined?!![]:![]:!![],'where':_0x25aea7[_0x93b4('0x1c')]?_0x25aea7[_0x93b4('0x1c')][_0x93b4('0x26')]||null:null,'attributes':_0x25aea7['options']?_0x25aea7[_0x93b4('0x1c')][_0x93b4('0x1e')]||null:null,'include':_0x25aea7[_0x93b4('0x1c')]?_0x25aea7['options']['include']?_['map'](_0x25aea7[_0x93b4('0x1c')]['include'],function(_0x36b6a3){return{'model':db[_0x36b6a3[_0x93b4('0x21')]],'as':_0x36b6a3['as'],'attributes':_0x36b6a3[_0x93b4('0x1e')],'include':_0x36b6a3['include']?_[_0x93b4('0x20')](_0x36b6a3[_0x93b4('0x1f')],function(_0x28f86a){return{'model':db[_0x28f86a[_0x93b4('0x21')]],'as':_0x28f86a['as'],'attributes':_0x28f86a[_0x93b4('0x1e')],'include':_0x28f86a[_0x93b4('0x1f')]?_[_0x93b4('0x20')](_0x28f86a[_0x93b4('0x1f')],function(_0x5048dd){return{'model':db[_0x5048dd[_0x93b4('0x21')]],'as':_0x5048dd['as'],'attributes':_0x5048dd[_0x93b4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x93b4('0x12')](function(_0x50364f){logger[_0x93b4('0x13')]('ShowWhatsappQueue',_0x25aea7);logger['debug'](_0x93b4('0x27'),_0x25aea7,JSON[_0x93b4('0x23')](_0x50364f));_0x49b15d(_0x50364f);})[_0x93b4('0x24')](function(_0x26bd11){logger[_0x93b4('0x15')](_0x93b4('0x27'),_0x26bd11[_0x93b4('0x18')],_0x25aea7);_0x1a70fb(_0x1517ff[_0x93b4('0x15')](0x1f4,_0x26bd11[_0x93b4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index fbec67f..1362123 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 _0xce69=['./whatsappQueue.events','remove','update','register','length','whatsappQueue:'];(function(_0x490074,_0x56bfa5){var _0x1c1d5a=function(_0x51cfd7){while(--_0x51cfd7){_0x490074['push'](_0x490074['shift']());}};_0x1c1d5a(++_0x56bfa5);}(_0xce69,0x198));var _0x9ce6=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0xce69[_0x289a67];return _0x572b49;};'use strict';var WhatsappQueueEvents=require(_0x9ce6('0x0'));var events=['save',_0x9ce6('0x1'),_0x9ce6('0x2')];function createListener(_0x2e3805,_0x1b42c7){return function(_0x2b6aad){_0x1b42c7['emit'](_0x2e3805,_0x2b6aad);};}function removeListener(_0x4b141b,_0x4bc7bc){return function(){WhatsappQueueEvents['removeListener'](_0x4b141b,_0x4bc7bc);};}exports[_0x9ce6('0x3')]=function(_0x397123){for(var _0xce8119=0x0,_0x537b9b=events[_0x9ce6('0x4')];_0xce8119<_0x537b9b;_0xce8119++){var _0x3ce827=events[_0xce8119];var _0x4d3d6c=createListener(_0x9ce6('0x5')+_0x3ce827,_0x397123);WhatsappQueueEvents['on'](_0x3ce827,_0x4d3d6c);}}; \ No newline at end of file +var _0x617c=['removeListener','register','whatsappQueue:','./whatsappQueue.events','save','emit'];(function(_0x2b0552,_0x285005){var _0xb757ef=function(_0xaae136){while(--_0xaae136){_0x2b0552['push'](_0x2b0552['shift']());}};_0xb757ef(++_0x285005);}(_0x617c,0x87));var _0xc617=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x617c[_0x2a8860];return _0x2f47a4;};'use strict';var WhatsappQueueEvents=require(_0xc617('0x0'));var events=[_0xc617('0x1'),'remove','update'];function createListener(_0x3bf75b,_0x2290be){return function(_0x40b9a0){_0x2290be[_0xc617('0x2')](_0x3bf75b,_0x40b9a0);};}function removeListener(_0x118cfb,_0x4b7cc5){return function(){WhatsappQueueEvents[_0xc617('0x3')](_0x118cfb,_0x4b7cc5);};}exports[_0xc617('0x4')]=function(_0x5681d4){for(var _0x33cefb=0x0,_0x343889=events['length'];_0x33cefb<_0x343889;_0x33cefb++){var _0x9bf088=events[_0x33cefb];var _0x53ebf2=createListener(_0xc617('0x5')+_0x9bf088,_0x5681d4);WhatsappQueueEvents['on'](_0x9bf088,_0x53ebf2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 2936d35..6fb3f52 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 _0xf771=['../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4da690,_0x12d136){var _0x263c53=function(_0x1832fa){while(--_0x1832fa){_0x4da690['push'](_0x4da690['shift']());}};_0x263c53(++_0x12d136);}(_0xf771,0xcb));var _0x1f77=function(_0x4b9418,_0xf7f740){_0x4b9418=_0x4b9418-0x0;var _0x363137=_0xf771[_0x4b9418];return _0x363137;};'use strict';var multer=require(_0x1f77('0x0'));var util=require(_0x1f77('0x1'));var path=require(_0x1f77('0x2'));var timeout=require(_0x1f77('0x3'));var express=require(_0x1f77('0x4'));var router=express[_0x1f77('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1f77('0x6'));var interaction=require(_0x1f77('0x7'));var config=require(_0x1f77('0x8'));var controller=require(_0x1f77('0x9'));router[_0x1f77('0xa')]('/',auth[_0x1f77('0xb')](),controller[_0x1f77('0xc')]);router['get'](_0x1f77('0xd'),auth[_0x1f77('0xb')](),controller[_0x1f77('0xe')]);router['get'](_0x1f77('0xf'),auth[_0x1f77('0xb')](),controller[_0x1f77('0x10')]);router['post']('/',auth[_0x1f77('0xb')](),controller[_0x1f77('0x11')]);router[_0x1f77('0x12')](_0x1f77('0xf'),auth[_0x1f77('0xb')](),controller[_0x1f77('0x13')]);router[_0x1f77('0x14')](_0x1f77('0xf'),auth[_0x1f77('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa627=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xa627,0x171));var _0x7a62=function(_0x72546d,_0x3f7c48){_0x72546d=_0x72546d-0x0;var _0x4d94f0=_0xa627[_0x72546d];return _0x4d94f0;};'use strict';var multer=require(_0x7a62('0x0'));var util=require(_0x7a62('0x1'));var path=require(_0x7a62('0x2'));var timeout=require(_0x7a62('0x3'));var express=require(_0x7a62('0x4'));var router=express[_0x7a62('0x5')]();var fs_extra=require(_0x7a62('0x6'));var auth=require(_0x7a62('0x7'));var interaction=require(_0x7a62('0x8'));var config=require(_0x7a62('0x9'));var controller=require('./whatsappQueueReport.controller');router[_0x7a62('0xa')]('/',auth[_0x7a62('0xb')](),controller['index']);router['get'](_0x7a62('0xc'),auth[_0x7a62('0xb')](),controller[_0x7a62('0xd')]);router[_0x7a62('0xa')](_0x7a62('0xe'),auth[_0x7a62('0xb')](),controller[_0x7a62('0xf')]);router[_0x7a62('0x10')]('/',auth[_0x7a62('0xb')](),controller['create']);router[_0x7a62('0x11')](_0x7a62('0xe'),auth[_0x7a62('0xb')](),controller['update']);router[_0x7a62('0x12')](_0x7a62('0xe'),auth[_0x7a62('0xb')](),controller[_0x7a62('0x13')]);module[_0x7a62('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index a3884c7..13eb496 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(_0x3bd2b2,_0x198126){var _0xaae850=function(_0x291152){while(--_0x291152){_0x3bd2b2['push'](_0x3bd2b2['shift']());}};_0xaae850(++_0x198126);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x29f17c,_0x516929){var _0xf1399b=function(_0x3cc341){while(--_0x3cc341){_0x29f17c['push'](_0x29f17c['shift']());}};_0xf1399b(++_0x516929);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c4b61cc..f8b053f 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 _0x0102=['filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','options','then','findAll','rows','catch','params','rawAttributes','intersection','include','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','key','model','query','keys'];(function(_0x557c94,_0x6032a){var _0x1aecf7=function(_0x546cd5){while(--_0x546cd5){_0x557c94['push'](_0x557c94['shift']());}};_0x1aecf7(++_0x6032a);}(_0x0102,0x186));var _0x2010=function(_0x439e0a,_0xbc805f){_0x439e0a=_0x439e0a-0x0;var _0x91b914=_0x0102[_0x439e0a];return _0x91b914;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];function respondWithStatusCode(_0x3f307c,_0x3e8624){_0x3e8624=_0x3e8624||0xcc;return function(_0x388991){if(_0x388991){return _0x3f307c['sendStatus'](_0x3e8624);}return _0x3f307c['status'](_0x3e8624)[_0x2010('0x18')]();};}function respondWithResult(_0x385720,_0x2e8ec2){_0x2e8ec2=_0x2e8ec2||0xc8;return function(_0x10b587){if(_0x10b587){return _0x385720[_0x2010('0x19')](_0x2e8ec2)[_0x2010('0x1a')](_0x10b587);}};}function respondWithFilteredResult(_0x517ff4,_0x3195fa){return function(_0x136418){if(_0x136418){var _0x5ad412=typeof _0x3195fa[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x3195fa[_0x2010('0x1d')]===_0x2010('0x1c');var _0x2d0bf2=_0x136418[_0x2010('0x1e')];var _0x83cd35=_0x5ad412?0x0:_0x3195fa[_0x2010('0x1b')];var _0x309477=_0x5ad412?_0x136418['count']:_0x3195fa['offset']+_0x3195fa[_0x2010('0x1d')];var _0x38a15a;if(_0x309477>=_0x2d0bf2){_0x309477=_0x2d0bf2;_0x38a15a=0xc8;}else{_0x38a15a=0xce;}_0x517ff4[_0x2010('0x19')](_0x38a15a);return _0x517ff4[_0x2010('0x1f')]('Content-Range',_0x83cd35+'-'+_0x309477+'/'+_0x2d0bf2)['json'](_0x136418);}return null;};}function patchUpdates(_0x22c252){return function(_0x171e45){try{jsonpatch[_0x2010('0x20')](_0x171e45,_0x22c252,!![]);}catch(_0x26facc){return BPromise[_0x2010('0x21')](_0x26facc);}return _0x171e45[_0x2010('0x22')]();};}function saveUpdates(_0x4f621c,_0x3db13d){return function(_0x1cfa57){if(_0x1cfa57){return _0x1cfa57['update'](_0x4f621c)['then'](function(_0x50aecc){return _0x50aecc;});}return null;};}function removeEntity(_0x424453,_0x574719){return function(_0x277dcc){if(_0x277dcc){return _0x277dcc['destroy']()['then'](function(){_0x424453[_0x2010('0x19')](0xcc)[_0x2010('0x18')]();});}};}function handleEntityNotFound(_0x52b4fe,_0x99ebe0){return function(_0x4cff59){if(!_0x4cff59){_0x52b4fe[_0x2010('0x23')](0x194);}return _0x4cff59;};}function handleError(_0x27b425,_0x3929d9){_0x3929d9=_0x3929d9||0x1f4;return function(_0x3dcea4){logger[_0x2010('0x24')](_0x3dcea4[_0x2010('0x25')]);if(_0x3dcea4[_0x2010('0x26')]){delete _0x3dcea4[_0x2010('0x26')];}_0x27b425[_0x2010('0x19')](_0x3929d9)[_0x2010('0x27')](_0x3dcea4);};}exports[_0x2010('0x28')]=function(_0x2ebdbb,_0x499cbe){var _0x2a4691={},_0x52fe5e={},_0x5b52fb={'count':0x0,'rows':[]};var _0x147a5a=_[_0x2010('0x29')](db[_0x2010('0x2a')]['rawAttributes'],function(_0x554f66){return{'name':_0x554f66[_0x2010('0x2b')],'type':_0x554f66['type'][_0x2010('0x2c')]};});_0x52fe5e[_0x2010('0x2d')]=_['map'](_0x147a5a,_0x2010('0x26'));_0x52fe5e[_0x2010('0x2e')]=_[_0x2010('0x2f')](_0x2ebdbb[_0x2010('0x2e')]);_0x52fe5e[_0x2010('0x30')]=_['intersection'](_0x52fe5e[_0x2010('0x2d')],_0x52fe5e[_0x2010('0x2e')]);_0x2a4691[_0x2010('0x31')]=_['intersection'](_0x52fe5e['model'],qs[_0x2010('0x32')](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x32')]));_0x2a4691['attributes']=_0x2a4691['attributes'][_0x2010('0x33')]?_0x2a4691[_0x2010('0x31')]:_0x52fe5e[_0x2010('0x2d')];if(!_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x34')]('nolimit')){_0x2a4691['limit']=qs['limit'](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x1d')]);_0x2a4691[_0x2010('0x1b')]=qs['offset'](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x1b')]);}_0x2a4691[_0x2010('0x35')]=qs[_0x2010('0x36')](_0x2ebdbb['query'][_0x2010('0x36')]);_0x2a4691[_0x2010('0x37')]=qs[_0x2010('0x30')](_['pick'](_0x2ebdbb[_0x2010('0x2e')],_0x52fe5e['filters']),_0x147a5a);if(_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x38')]){_0x2a4691[_0x2010('0x37')]=_[_0x2010('0x39')](_0x2a4691[_0x2010('0x37')],{'$or':_[_0x2010('0x29')](_0x147a5a,function(_0x53c09e){if(_0x53c09e[_0x2010('0x3a')]!=='VIRTUAL'){var _0x3e5422={};_0x3e5422[_0x53c09e[_0x2010('0x26')]]={'$like':'%'+_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x38')]+'%'};return _0x3e5422;}})});}_0x2a4691=_[_0x2010('0x39')]({},_0x2a4691,_0x2ebdbb[_0x2010('0x3b')]);var _0x398f10={'where':_0x2a4691[_0x2010('0x37')]};return db[_0x2010('0x2a')][_0x2010('0x1e')](_0x398f10)[_0x2010('0x3c')](function(_0x2f37ca){_0x5b52fb[_0x2010('0x1e')]=_0x2f37ca;if(_0x2ebdbb[_0x2010('0x2e')]['includeAll']){_0x2a4691['include']=[{'all':!![]}];}return db[_0x2010('0x2a')][_0x2010('0x3d')](_0x2a4691);})[_0x2010('0x3c')](function(_0x35d631){_0x5b52fb[_0x2010('0x3e')]=_0x35d631;return _0x5b52fb;})[_0x2010('0x3c')](respondWithFilteredResult(_0x499cbe,_0x2a4691))[_0x2010('0x3f')](handleError(_0x499cbe,null));};exports['show']=function(_0x392576,_0x578645){var _0x27fd64={'raw':!![],'where':{'id':_0x392576[_0x2010('0x40')]['id']}},_0x3ff496={};_0x3ff496[_0x2010('0x2d')]=_[_0x2010('0x2f')](db['WhatsappQueueReport'][_0x2010('0x41')]);_0x3ff496[_0x2010('0x2e')]=_[_0x2010('0x2f')](_0x392576[_0x2010('0x2e')]);_0x3ff496['filters']=_[_0x2010('0x42')](_0x3ff496['model'],_0x3ff496['query']);_0x27fd64['attributes']=_[_0x2010('0x42')](_0x3ff496[_0x2010('0x2d')],qs[_0x2010('0x32')](_0x392576[_0x2010('0x2e')][_0x2010('0x32')]));_0x27fd64[_0x2010('0x31')]=_0x27fd64['attributes'][_0x2010('0x33')]?_0x27fd64[_0x2010('0x31')]:_0x3ff496[_0x2010('0x2d')];if(_0x392576['query']['includeAll']){_0x27fd64[_0x2010('0x43')]=[{'all':!![]}];}_0x27fd64=_['merge']({},_0x27fd64,_0x392576[_0x2010('0x3b')]);return db[_0x2010('0x2a')][_0x2010('0x44')](_0x27fd64)[_0x2010('0x3c')](handleEntityNotFound(_0x578645,null))['then'](respondWithResult(_0x578645,null))[_0x2010('0x3f')](handleError(_0x578645,null));};exports[_0x2010('0x45')]=function(_0x2e2703,_0x231db7){return db[_0x2010('0x2a')][_0x2010('0x45')](_0x2e2703['body'],{})[_0x2010('0x3c')](respondWithResult(_0x231db7,0xc9))[_0x2010('0x3f')](handleError(_0x231db7,null));};exports[_0x2010('0x46')]=function(_0x4dc0cf,_0x30e5d0){if(_0x4dc0cf[_0x2010('0x47')]['id']){delete _0x4dc0cf['body']['id'];}return db[_0x2010('0x2a')][_0x2010('0x44')]({'where':{'id':_0x4dc0cf[_0x2010('0x40')]['id']}})[_0x2010('0x3c')](handleEntityNotFound(_0x30e5d0,null))[_0x2010('0x3c')](saveUpdates(_0x4dc0cf[_0x2010('0x47')],null))[_0x2010('0x3c')](respondWithResult(_0x30e5d0,null))[_0x2010('0x3f')](handleError(_0x30e5d0,null));};exports['destroy']=function(_0x5258b9,_0xc9f070){return db[_0x2010('0x2a')]['find']({'where':{'id':_0x5258b9[_0x2010('0x40')]['id']}})[_0x2010('0x3c')](handleEntityNotFound(_0xc9f070,null))[_0x2010('0x3c')](removeEntity(_0xc9f070,null))[_0x2010('0x3f')](handleError(_0xc9f070,null));};exports[_0x2010('0x48')]=function(_0x506943,_0x5f4e98){return db[_0x2010('0x2a')][_0x2010('0x48')]()[_0x2010('0x3c')](respondWithResult(_0x5f4e98,null))[_0x2010('0x3f')](handleError(_0x5f4e98,null));}; \ No newline at end of file +var _0xcf66=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','WhatsappQueueReport','catch','show','params','rawAttributes','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end'];(function(_0x52c516,_0x480543){var _0x4a7002=function(_0x144c88){while(--_0x144c88){_0x52c516['push'](_0x52c516['shift']());}};_0x4a7002(++_0x480543);}(_0xcf66,0x71));var _0x6cf6=function(_0x3fe884,_0x347e16){_0x3fe884=_0x3fe884-0x0;var _0x41bb2a=_0xcf66[_0x3fe884];return _0x41bb2a;};'use strict';var emlformat=require(_0x6cf6('0x0'));var rimraf=require(_0x6cf6('0x1'));var zipdir=require(_0x6cf6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cf6('0x3'));var moment=require(_0x6cf6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cf6('0x5'));var path=require(_0x6cf6('0x6'));var sox=require('sox');var csv=require(_0x6cf6('0x7'));var ejs=require(_0x6cf6('0x8'));var fs=require('fs');var fs_extra=require(_0x6cf6('0x9'));var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x7'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf6('0x10'));var logger=require(_0x6cf6('0x11'))(_0x6cf6('0x12'));var utils=require(_0x6cf6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fdfea,_0x13b1ad){_0x13b1ad=_0x13b1ad||0xcc;return function(_0x372d12){if(_0x372d12){return _0x3fdfea[_0x6cf6('0x14')](_0x13b1ad);}return _0x3fdfea[_0x6cf6('0x15')](_0x13b1ad)[_0x6cf6('0x16')]();};}function respondWithResult(_0x57909f,_0x32fe64){_0x32fe64=_0x32fe64||0xc8;return function(_0x494ece){if(_0x494ece){return _0x57909f[_0x6cf6('0x15')](_0x32fe64)[_0x6cf6('0x17')](_0x494ece);}};}function respondWithFilteredResult(_0x4b073f,_0x40e413){return function(_0x1b40f8){if(_0x1b40f8){var _0x2d23ab=typeof _0x40e413[_0x6cf6('0x18')]===_0x6cf6('0x19')&&typeof _0x40e413[_0x6cf6('0x1a')]===_0x6cf6('0x19');var _0x39ec25=_0x1b40f8[_0x6cf6('0x1b')];var _0x2ca2b1=_0x2d23ab?0x0:_0x40e413['offset'];var _0x11d994=_0x2d23ab?_0x1b40f8[_0x6cf6('0x1b')]:_0x40e413[_0x6cf6('0x18')]+_0x40e413['limit'];var _0x18abd9;if(_0x11d994>=_0x39ec25){_0x11d994=_0x39ec25;_0x18abd9=0xc8;}else{_0x18abd9=0xce;}_0x4b073f[_0x6cf6('0x15')](_0x18abd9);return _0x4b073f[_0x6cf6('0x1c')](_0x6cf6('0x1d'),_0x2ca2b1+'-'+_0x11d994+'/'+_0x39ec25)[_0x6cf6('0x17')](_0x1b40f8);}return null;};}function patchUpdates(_0x21e903){return function(_0x123993){try{jsonpatch['apply'](_0x123993,_0x21e903,!![]);}catch(_0x19f2cd){return BPromise[_0x6cf6('0x1e')](_0x19f2cd);}return _0x123993[_0x6cf6('0x1f')]();};}function saveUpdates(_0x380a40,_0x5cba3a){return function(_0x470ea4){if(_0x470ea4){return _0x470ea4[_0x6cf6('0x20')](_0x380a40)[_0x6cf6('0x21')](function(_0x5b2767){return _0x5b2767;});}return null;};}function removeEntity(_0x5b30e0,_0x276225){return function(_0x59f838){if(_0x59f838){return _0x59f838[_0x6cf6('0x22')]()[_0x6cf6('0x21')](function(){_0x5b30e0[_0x6cf6('0x15')](0xcc)[_0x6cf6('0x16')]();});}};}function handleEntityNotFound(_0x3f9871,_0x565fad){return function(_0x1c966e){if(!_0x1c966e){_0x3f9871['sendStatus'](0x194);}return _0x1c966e;};}function handleError(_0x2779b7,_0xc7b489){_0xc7b489=_0xc7b489||0x1f4;return function(_0x3eaa31){logger['error'](_0x3eaa31[_0x6cf6('0x23')]);if(_0x3eaa31[_0x6cf6('0x24')]){delete _0x3eaa31[_0x6cf6('0x24')];}_0x2779b7[_0x6cf6('0x15')](_0xc7b489)['send'](_0x3eaa31);};}exports['index']=function(_0x2afe84,_0x4521af){var _0x57099f={},_0x5869e9={},_0x5ccc8f={'count':0x0,'rows':[]};var _0x2afc06=_['map'](db['WhatsappQueueReport']['rawAttributes'],function(_0x10bde5){return{'name':_0x10bde5[_0x6cf6('0x25')],'type':_0x10bde5[_0x6cf6('0x26')][_0x6cf6('0x27')]};});_0x5869e9[_0x6cf6('0x28')]=_['map'](_0x2afc06,_0x6cf6('0x24'));_0x5869e9[_0x6cf6('0x29')]=_[_0x6cf6('0x2a')](_0x2afe84['query']);_0x5869e9[_0x6cf6('0x2b')]=_[_0x6cf6('0x2c')](_0x5869e9[_0x6cf6('0x28')],_0x5869e9[_0x6cf6('0x29')]);_0x57099f[_0x6cf6('0x2d')]=_[_0x6cf6('0x2c')](_0x5869e9[_0x6cf6('0x28')],qs[_0x6cf6('0x2e')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x2e')]));_0x57099f[_0x6cf6('0x2d')]=_0x57099f[_0x6cf6('0x2d')][_0x6cf6('0x2f')]?_0x57099f[_0x6cf6('0x2d')]:_0x5869e9[_0x6cf6('0x28')];if(!_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x30')](_0x6cf6('0x31'))){_0x57099f['limit']=qs[_0x6cf6('0x1a')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x1a')]);_0x57099f[_0x6cf6('0x18')]=qs[_0x6cf6('0x18')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x18')]);}_0x57099f[_0x6cf6('0x32')]=qs[_0x6cf6('0x33')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x33')]);_0x57099f['where']=qs[_0x6cf6('0x2b')](_[_0x6cf6('0x34')](_0x2afe84[_0x6cf6('0x29')],_0x5869e9[_0x6cf6('0x2b')]),_0x2afc06);if(_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x35')]){_0x57099f[_0x6cf6('0x36')]=_[_0x6cf6('0x37')](_0x57099f[_0x6cf6('0x36')],{'$or':_['map'](_0x2afc06,function(_0x1c5eda){if(_0x1c5eda[_0x6cf6('0x26')]!==_0x6cf6('0x38')){var _0x3e906f={};_0x3e906f[_0x1c5eda[_0x6cf6('0x24')]]={'$like':'%'+_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x35')]+'%'};return _0x3e906f;}})});}_0x57099f=_[_0x6cf6('0x37')]({},_0x57099f,_0x2afe84[_0x6cf6('0x39')]);var _0x5ed61f={'where':_0x57099f[_0x6cf6('0x36')]};return db['WhatsappQueueReport'][_0x6cf6('0x1b')](_0x5ed61f)[_0x6cf6('0x21')](function(_0x23d280){_0x5ccc8f[_0x6cf6('0x1b')]=_0x23d280;if(_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x3a')]){_0x57099f[_0x6cf6('0x3b')]=[{'all':!![]}];}return db[_0x6cf6('0x3c')]['findAll'](_0x57099f);})[_0x6cf6('0x21')](function(_0x335dce){_0x5ccc8f['rows']=_0x335dce;return _0x5ccc8f;})[_0x6cf6('0x21')](respondWithFilteredResult(_0x4521af,_0x57099f))[_0x6cf6('0x3d')](handleError(_0x4521af,null));};exports[_0x6cf6('0x3e')]=function(_0x4874c0,_0x10bb9b){var _0x128f7a={'raw':!![],'where':{'id':_0x4874c0[_0x6cf6('0x3f')]['id']}},_0x51d915={};_0x51d915[_0x6cf6('0x28')]=_[_0x6cf6('0x2a')](db[_0x6cf6('0x3c')][_0x6cf6('0x40')]);_0x51d915[_0x6cf6('0x29')]=_[_0x6cf6('0x2a')](_0x4874c0['query']);_0x51d915[_0x6cf6('0x2b')]=_['intersection'](_0x51d915[_0x6cf6('0x28')],_0x51d915[_0x6cf6('0x29')]);_0x128f7a['attributes']=_[_0x6cf6('0x2c')](_0x51d915[_0x6cf6('0x28')],qs[_0x6cf6('0x2e')](_0x4874c0[_0x6cf6('0x29')][_0x6cf6('0x2e')]));_0x128f7a['attributes']=_0x128f7a[_0x6cf6('0x2d')][_0x6cf6('0x2f')]?_0x128f7a[_0x6cf6('0x2d')]:_0x51d915['model'];if(_0x4874c0[_0x6cf6('0x29')][_0x6cf6('0x3a')]){_0x128f7a[_0x6cf6('0x3b')]=[{'all':!![]}];}_0x128f7a=_['merge']({},_0x128f7a,_0x4874c0[_0x6cf6('0x39')]);return db['WhatsappQueueReport']['find'](_0x128f7a)[_0x6cf6('0x21')](handleEntityNotFound(_0x10bb9b,null))[_0x6cf6('0x21')](respondWithResult(_0x10bb9b,null))[_0x6cf6('0x3d')](handleError(_0x10bb9b,null));};exports[_0x6cf6('0x41')]=function(_0xb8788a,_0x311745){return db[_0x6cf6('0x3c')][_0x6cf6('0x41')](_0xb8788a[_0x6cf6('0x42')],{})[_0x6cf6('0x21')](respondWithResult(_0x311745,0xc9))[_0x6cf6('0x3d')](handleError(_0x311745,null));};exports[_0x6cf6('0x20')]=function(_0x3786d1,_0x4c8ada){if(_0x3786d1[_0x6cf6('0x42')]['id']){delete _0x3786d1[_0x6cf6('0x42')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x3786d1[_0x6cf6('0x3f')]['id']}})[_0x6cf6('0x21')](handleEntityNotFound(_0x4c8ada,null))[_0x6cf6('0x21')](saveUpdates(_0x3786d1[_0x6cf6('0x42')],null))[_0x6cf6('0x21')](respondWithResult(_0x4c8ada,null))[_0x6cf6('0x3d')](handleError(_0x4c8ada,null));};exports['destroy']=function(_0x115b9b,_0x262c23){return db[_0x6cf6('0x3c')]['find']({'where':{'id':_0x115b9b['params']['id']}})[_0x6cf6('0x21')](handleEntityNotFound(_0x262c23,null))[_0x6cf6('0x21')](removeEntity(_0x262c23,null))[_0x6cf6('0x3d')](handleError(_0x262c23,null));};exports[_0x6cf6('0x43')]=function(_0x2dbd71,_0x1fb6f1){return db[_0x6cf6('0x3c')][_0x6cf6('0x43')]()[_0x6cf6('0x21')](respondWithResult(_0x1fb6f1,null))[_0x6cf6('0x3d')](handleError(_0x1fb6f1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3aae4bf..7c5465a 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 _0x63ce=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x63ce,0x79));var _0xe63c=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0x63ce[_0x2714ec];return _0x2608e5;};'use strict';var _=require(_0xe63c('0x0'));var util=require('util');var logger=require(_0xe63c('0x1'))(_0xe63c('0x2'));var moment=require(_0xe63c('0x3'));var BPromise=require(_0xe63c('0x4'));var rp=require(_0xe63c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe63c('0x6'));var config=require(_0xe63c('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0xe63c('0x8')]=function(_0x5dce4a,_0x3bb23e){return _0x5dce4a[_0xe63c('0x9')](_0xe63c('0xa'),attributes,{'tableName':_0xe63c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe63c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x03e9=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','request-promise'];(function(_0x123d68,_0x3e4197){var _0x527693=function(_0x5195aa){while(--_0x5195aa){_0x123d68['push'](_0x123d68['shift']());}};_0x527693(++_0x3e4197);}(_0x03e9,0xac));var _0x903e=function(_0x592794,_0x46b377){_0x592794=_0x592794-0x0;var _0x51deca=_0x03e9[_0x592794];return _0x51deca;};'use strict';var _=require(_0x903e('0x0'));var util=require(_0x903e('0x1'));var logger=require(_0x903e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x903e('0x3'));var fs=require('fs');var path=require(_0x903e('0x4'));var rimraf=require(_0x903e('0x5'));var config=require(_0x903e('0x6'));var attributes=require(_0x903e('0x7'));module['exports']=function(_0x2dddfe,_0x4005bb){return _0x2dddfe[_0x903e('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x903e('0x9'),'paranoid':![],'indexes':[{'name':_0x903e('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index bae4def..4cf09ac 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 _0x3a9e=['where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','info','result','catch','body','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','options','raw'];(function(_0x1dbf16,_0x9f799d){var _0x34307d=function(_0xcc8495){while(--_0xcc8495){_0x1dbf16['push'](_0x1dbf16['shift']());}};_0x34307d(++_0x9f799d);}(_0x3a9e,0x162));var _0xe3a9=function(_0x153844,_0x37a9b9){_0x153844=_0x153844-0x0;var _0x4207d0=_0x3a9e[_0x153844];return _0x4207d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe3a9('0x0'));var BPromise=require(_0xe3a9('0x1'));var rs=require(_0xe3a9('0x2'));var fs=require('fs');var Redis=require(_0xe3a9('0x3'));var db=require(_0xe3a9('0x4'))['db'];var utils=require(_0xe3a9('0x5'));var logger=require(_0xe3a9('0x6'))(_0xe3a9('0x7'));var config=require('../../config/environment');var jayson=require(_0xe3a9('0x8'));var client=jayson[_0xe3a9('0x9')][_0xe3a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb118,_0xe40436,_0x22c9ae){return new BPromise(function(_0x31ad40,_0x2e48ac){return client[_0xe3a9('0xb')](_0x2bb118,_0x22c9ae)[_0xe3a9('0xc')](function(_0x1fef77){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0xe40436,_0xe3a9('0xd'));logger[_0xe3a9('0xe')](_0xe3a9('0xf'),_0xe40436,_0xe3a9('0xd'),JSON[_0xe3a9('0x10')](_0x1fef77));if(_0x1fef77['error']){if(_0x1fef77[_0xe3a9('0x11')][_0xe3a9('0x12')]===0x1f4){logger[_0xe3a9('0x11')](_0xe3a9('0x13'),_0xe40436,_0x1fef77['error'][_0xe3a9('0x14')]);return _0x2e48ac(_0x1fef77[_0xe3a9('0x11')][_0xe3a9('0x14')]);}logger[_0xe3a9('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0xe40436,_0x1fef77[_0xe3a9('0x11')][_0xe3a9('0x14')]);return _0x31ad40(_0x1fef77[_0xe3a9('0x11')]['message']);}else{logger[_0xe3a9('0x15')]('WhatsappQueueReport,\x20%s,\x20%s',_0xe40436,_0xe3a9('0xd'));_0x31ad40(_0x1fef77[_0xe3a9('0x16')][_0xe3a9('0x14')]);}})[_0xe3a9('0x17')](function(_0x743956){logger['error'](_0xe3a9('0x13'),_0xe40436,_0x743956);_0x2e48ac(_0x743956);});});}exports['CreateWhatsappQueueReport']=function(_0x12722b){var _0x541b6e=this;return new Promise(function(_0x4eac84,_0x2be4ac){return db['WhatsappQueueReport']['create'](_0x12722b[_0xe3a9('0x18')],{'raw':_0x12722b['options']?_0x12722b['options']['raw']===undefined?!![]:![]:!![]})[_0xe3a9('0xc')](function(_0x53557c){logger['info'](_0xe3a9('0x19'),_0x12722b);logger[_0xe3a9('0xe')](_0xe3a9('0x19'),_0x12722b,JSON['stringify'](_0x53557c));_0x4eac84(_0x53557c);})['catch'](function(_0x517d4e){logger[_0xe3a9('0x11')](_0xe3a9('0x19'),_0x517d4e[_0xe3a9('0x14')],_0x12722b);_0x2be4ac(_0x541b6e[_0xe3a9('0x11')](0x1f4,_0x517d4e[_0xe3a9('0x14')]));});});};exports[_0xe3a9('0x1a')]=function(_0x32f7c4){var _0x4e0790=this;return new Promise(function(_0x56d0bc,_0x103511){return db['WhatsappQueueReport'][_0xe3a9('0x1b')](_0x32f7c4['body'],{'raw':_0x32f7c4['options']?_0x32f7c4[_0xe3a9('0x1c')][_0xe3a9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32f7c4['options']?_0x32f7c4[_0xe3a9('0x1c')][_0xe3a9('0x1e')]||null:null,'attributes':_0x32f7c4[_0xe3a9('0x1c')]?_0x32f7c4[_0xe3a9('0x1c')]['attributes']||null:null,'limit':_0x32f7c4[_0xe3a9('0x1c')]?_0x32f7c4[_0xe3a9('0x1c')][_0xe3a9('0x1f')]||null:null})['then'](function(_0x49295b){logger[_0xe3a9('0x15')](_0xe3a9('0x1a'),_0x32f7c4);logger[_0xe3a9('0xe')](_0xe3a9('0x1a'),_0x32f7c4,JSON['stringify'](_0x49295b));_0x56d0bc(_0x49295b);})[_0xe3a9('0x17')](function(_0x10d4d3){logger['error']('UpdateWhatsappQueueReport',_0x10d4d3[_0xe3a9('0x14')],_0x32f7c4);_0x103511(_0x4e0790[_0xe3a9('0x11')](0x1f4,_0x10d4d3['message']));});});}; \ No newline at end of file +var _0xee56=['UpdateWhatsappQueueReport','WhatsappQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateWhatsappQueueReport','body','options','raw','stringify'];(function(_0x57e54f,_0x51512d){var _0x496ae8=function(_0x224619){while(--_0x224619){_0x57e54f['push'](_0x57e54f['shift']());}};_0x496ae8(++_0x51512d);}(_0xee56,0xd1));var _0x6ee5=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0xee56[_0x1314d4];return _0x584ba5;};'use strict';var _=require(_0x6ee5('0x0'));var util=require(_0x6ee5('0x1'));var moment=require('moment');var BPromise=require(_0x6ee5('0x2'));var rs=require(_0x6ee5('0x3'));var fs=require('fs');var Redis=require(_0x6ee5('0x4'));var db=require(_0x6ee5('0x5'))['db'];var utils=require(_0x6ee5('0x6'));var logger=require(_0x6ee5('0x7'))(_0x6ee5('0x8'));var config=require(_0x6ee5('0x9'));var jayson=require(_0x6ee5('0xa'));var client=jayson[_0x6ee5('0xb')][_0x6ee5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x935a23,_0xb09249,_0x4e69a7){return new BPromise(function(_0x1f2b6f,_0x54b1bc){return client[_0x6ee5('0xd')](_0x935a23,_0x4e69a7)[_0x6ee5('0xe')](function(_0x445138){logger['info'](_0x6ee5('0xf'),_0xb09249,_0x6ee5('0x10'));logger[_0x6ee5('0x11')](_0x6ee5('0x12'),_0xb09249,'request\x20sent',JSON['stringify'](_0x445138));if(_0x445138[_0x6ee5('0x13')]){if(_0x445138[_0x6ee5('0x13')]['code']===0x1f4){logger[_0x6ee5('0x13')](_0x6ee5('0xf'),_0xb09249,_0x445138['error']['message']);return _0x54b1bc(_0x445138[_0x6ee5('0x13')][_0x6ee5('0x14')]);}logger[_0x6ee5('0x13')](_0x6ee5('0xf'),_0xb09249,_0x445138[_0x6ee5('0x13')][_0x6ee5('0x14')]);return _0x1f2b6f(_0x445138[_0x6ee5('0x13')]['message']);}else{logger[_0x6ee5('0x15')](_0x6ee5('0xf'),_0xb09249,_0x6ee5('0x10'));_0x1f2b6f(_0x445138[_0x6ee5('0x16')][_0x6ee5('0x14')]);}})[_0x6ee5('0x17')](function(_0x630c8b){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0xb09249,_0x630c8b);_0x54b1bc(_0x630c8b);});});}exports[_0x6ee5('0x18')]=function(_0x4a123a){var _0x5380d5=this;return new Promise(function(_0x588dcd,_0x11057e){return db['WhatsappQueueReport']['create'](_0x4a123a[_0x6ee5('0x19')],{'raw':_0x4a123a[_0x6ee5('0x1a')]?_0x4a123a['options'][_0x6ee5('0x1b')]===undefined?!![]:![]:!![]})[_0x6ee5('0xe')](function(_0x13487d){logger[_0x6ee5('0x15')](_0x6ee5('0x18'),_0x4a123a);logger[_0x6ee5('0x11')](_0x6ee5('0x18'),_0x4a123a,JSON[_0x6ee5('0x1c')](_0x13487d));_0x588dcd(_0x13487d);})[_0x6ee5('0x17')](function(_0x5b6569){logger[_0x6ee5('0x13')](_0x6ee5('0x18'),_0x5b6569[_0x6ee5('0x14')],_0x4a123a);_0x11057e(_0x5380d5[_0x6ee5('0x13')](0x1f4,_0x5b6569[_0x6ee5('0x14')]));});});};exports[_0x6ee5('0x1d')]=function(_0x4392c8){var _0x36c23a=this;return new Promise(function(_0x1d105f,_0x2c8867){return db[_0x6ee5('0x1e')][_0x6ee5('0x1f')](_0x4392c8[_0x6ee5('0x19')],{'raw':_0x4392c8[_0x6ee5('0x1a')]?_0x4392c8[_0x6ee5('0x1a')][_0x6ee5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4392c8[_0x6ee5('0x1a')]?_0x4392c8[_0x6ee5('0x1a')]['where']||null:null,'attributes':_0x4392c8[_0x6ee5('0x1a')]?_0x4392c8[_0x6ee5('0x1a')][_0x6ee5('0x20')]||null:null,'limit':_0x4392c8['options']?_0x4392c8['options'][_0x6ee5('0x21')]||null:null})[_0x6ee5('0xe')](function(_0x7305e4){logger[_0x6ee5('0x15')]('UpdateWhatsappQueueReport',_0x4392c8);logger[_0x6ee5('0x11')](_0x6ee5('0x1d'),_0x4392c8,JSON[_0x6ee5('0x1c')](_0x7305e4));_0x1d105f(_0x7305e4);})[_0x6ee5('0x17')](function(_0x33caa7){logger[_0x6ee5('0x13')](_0x6ee5('0x1d'),_0x33caa7[_0x6ee5('0x14')],_0x4392c8);_0x2c8867(_0x36c23a[_0x6ee5('0x13')](0x1f4,_0x33caa7['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 53e40e0..bd96f73 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 _0xaec6=['../../config/environment','get','index','/describe','isAuthenticated','describe','post','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2f6ae4,_0x1a41cb){var _0x3b3e40=function(_0x210516){while(--_0x210516){_0x2f6ae4['push'](_0x2f6ae4['shift']());}};_0x3b3e40(++_0x1a41cb);}(_0xaec6,0x1e0));var _0x6aec=function(_0x44b7a7,_0x5cf981){_0x44b7a7=_0x44b7a7-0x0;var _0x3e9a8c=_0xaec6[_0x44b7a7];return _0x3e9a8c;};'use strict';var multer=require(_0x6aec('0x0'));var util=require(_0x6aec('0x1'));var path=require(_0x6aec('0x2'));var timeout=require(_0x6aec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aec('0x4'));var auth=require(_0x6aec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6aec('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x6aec('0x7')]('/',auth['isAuthenticated'](),controller[_0x6aec('0x8')]);router[_0x6aec('0x7')](_0x6aec('0x9'),auth[_0x6aec('0xa')](),controller[_0x6aec('0xb')]);router[_0x6aec('0x7')]('/:id',auth[_0x6aec('0xa')](),controller['show']);router[_0x6aec('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6aec('0xd')]('/:id',auth[_0x6aec('0xa')](),controller[_0x6aec('0xe')]);router[_0x6aec('0xf')](_0x6aec('0x10'),auth[_0x6aec('0xa')](),controller[_0x6aec('0x11')]);module['exports']=router; \ No newline at end of file +var _0xee52=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xee52,0xc4));var _0x2ee5=function(_0x3c631c,_0x2d33a0){_0x3c631c=_0x3c631c-0x0;var _0x16f4c6=_0xee52[_0x3c631c];return _0x16f4c6;};'use strict';var multer=require(_0x2ee5('0x0'));var util=require(_0x2ee5('0x1'));var path=require(_0x2ee5('0x2'));var timeout=require(_0x2ee5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ee5('0x4'));var auth=require(_0x2ee5('0x5'));var interaction=require(_0x2ee5('0x6'));var config=require(_0x2ee5('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0x2ee5('0x8')]('/',auth[_0x2ee5('0x9')](),controller[_0x2ee5('0xa')]);router[_0x2ee5('0x8')](_0x2ee5('0xb'),auth[_0x2ee5('0x9')](),controller[_0x2ee5('0xc')]);router['get'](_0x2ee5('0xd'),auth[_0x2ee5('0x9')](),controller[_0x2ee5('0xe')]);router['post']('/',auth[_0x2ee5('0x9')](),controller[_0x2ee5('0xf')]);router[_0x2ee5('0x10')]('/:id',auth[_0x2ee5('0x9')](),controller[_0x2ee5('0x11')]);router['delete'](_0x2ee5('0xd'),auth[_0x2ee5('0x9')](),controller[_0x2ee5('0x12')]);module[_0x2ee5('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index b882357..9127201 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 _0x2ebd=['sequelize','exports','STRING','agent','queue','DATE'];(function(_0x1448c0,_0x30ee0b){var _0x4f498a=function(_0x3744ef){while(--_0x3744ef){_0x1448c0['push'](_0x1448c0['shift']());}};_0x4f498a(++_0x30ee0b);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x2e13c4,_0xf74c2d){_0x2e13c4=_0x2e13c4-0x0;var _0x5edd60=_0x2ebd[_0x2e13c4];return _0x5edd60;};'use strict';var Sequelize=require(_0xd2eb('0x0'));module[_0xd2eb('0x1')]={'uniqueid':{'type':Sequelize[_0xd2eb('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xd2eb('0x3'),_0xd2eb('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xd2eb('0x5')]}}; \ No newline at end of file +var _0xf960=['account','agent','DATE','sequelize','STRING'];(function(_0xc4966b,_0x6cd5e0){var _0x1802bb=function(_0x12f623){while(--_0x12f623){_0xc4966b['push'](_0xc4966b['shift']());}};_0x1802bb(++_0x6cd5e0);}(_0xf960,0x193));var _0x0f96=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xf960[_0x4c4037];return _0x357862;};'use strict';var Sequelize=require(_0x0f96('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0f96('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0f96('0x2'),_0x0f96('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0f96('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 6b3d52d..b649754 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 _0x6b5f=['rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','apply','save','update','destroy','then','stack','name','send','index','map','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','where','merge','filter','options','includeAll','include','catch','show','params','keys','WhatsappTransferReport'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x6b5f,0x119));var _0xf6b5=function(_0x80f4eb,_0x11aca3){_0x80f4eb=_0x80f4eb-0x0;var _0xaf0a97=_0x6b5f[_0x80f4eb];return _0xaf0a97;};'use strict';var emlformat=require(_0xf6b5('0x0'));var rimraf=require(_0xf6b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b5('0x2'));var rp=require(_0xf6b5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf6b5('0x4'));var util=require(_0xf6b5('0x5'));var path=require(_0xf6b5('0x6'));var sox=require(_0xf6b5('0x7'));var csv=require('to-csv');var ejs=require(_0xf6b5('0x8'));var fs=require('fs');var fs_extra=require(_0xf6b5('0x9'));var _=require(_0xf6b5('0xa'));var squel=require('squel');var crypto=require(_0xf6b5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf6b5('0xc'));var toCsv=require(_0xf6b5('0xd'));var querystring=require(_0xf6b5('0xe'));var Papa=require(_0xf6b5('0xf'));var Redis=require(_0xf6b5('0x10'));var authService=require(_0xf6b5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6b5('0x12'));var logger=require(_0xf6b5('0x13'))(_0xf6b5('0x14'));var utils=require(_0xf6b5('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf6b5('0x16'))['db'];function respondWithStatusCode(_0x4eb544,_0x57e3c8){_0x57e3c8=_0x57e3c8||0xcc;return function(_0x43d411){if(_0x43d411){return _0x4eb544[_0xf6b5('0x17')](_0x57e3c8);}return _0x4eb544[_0xf6b5('0x18')](_0x57e3c8)[_0xf6b5('0x19')]();};}function respondWithResult(_0x1659c0,_0x3831f2){_0x3831f2=_0x3831f2||0xc8;return function(_0x2805dc){if(_0x2805dc){return _0x1659c0[_0xf6b5('0x18')](_0x3831f2)['json'](_0x2805dc);}};}function respondWithFilteredResult(_0x40dacd,_0x19f154){return function(_0x43da20){if(_0x43da20){var _0x30e251=typeof _0x19f154['offset']==='undefined'&&typeof _0x19f154[_0xf6b5('0x1a')]===_0xf6b5('0x1b');var _0x28486c=_0x43da20[_0xf6b5('0x1c')];var _0x34b8a2=_0x30e251?0x0:_0x19f154[_0xf6b5('0x1d')];var _0x5454a4=_0x30e251?_0x43da20[_0xf6b5('0x1c')]:_0x19f154[_0xf6b5('0x1d')]+_0x19f154[_0xf6b5('0x1a')];var _0x1c4b53;if(_0x5454a4>=_0x28486c){_0x5454a4=_0x28486c;_0x1c4b53=0xc8;}else{_0x1c4b53=0xce;}_0x40dacd[_0xf6b5('0x18')](_0x1c4b53);return _0x40dacd['set'](_0xf6b5('0x1e'),_0x34b8a2+'-'+_0x5454a4+'/'+_0x28486c)[_0xf6b5('0x1f')](_0x43da20);}return null;};}function patchUpdates(_0x32f277){return function(_0x4a7a99){try{jsonpatch[_0xf6b5('0x20')](_0x4a7a99,_0x32f277,!![]);}catch(_0x1ec561){return BPromise['reject'](_0x1ec561);}return _0x4a7a99[_0xf6b5('0x21')]();};}function saveUpdates(_0x3d2f77,_0x39ec12){return function(_0x4fc236){if(_0x4fc236){return _0x4fc236[_0xf6b5('0x22')](_0x3d2f77)['then'](function(_0x497461){return _0x497461;});}return null;};}function removeEntity(_0x554b16,_0x4b206f){return function(_0x3417cd){if(_0x3417cd){return _0x3417cd[_0xf6b5('0x23')]()[_0xf6b5('0x24')](function(){_0x554b16['status'](0xcc)[_0xf6b5('0x19')]();});}};}function handleEntityNotFound(_0x1d0dea,_0x646f87){return function(_0x4a2ab3){if(!_0x4a2ab3){_0x1d0dea[_0xf6b5('0x17')](0x194);}return _0x4a2ab3;};}function handleError(_0x179007,_0x31d4db){_0x31d4db=_0x31d4db||0x1f4;return function(_0xb2cda0){logger['error'](_0xb2cda0[_0xf6b5('0x25')]);if(_0xb2cda0[_0xf6b5('0x26')]){delete _0xb2cda0['name'];}_0x179007[_0xf6b5('0x18')](_0x31d4db)[_0xf6b5('0x27')](_0xb2cda0);};}exports[_0xf6b5('0x28')]=function(_0x220c63,_0x35f61e){var _0x3fa73f={},_0x379cac={},_0x54da37={'count':0x0,'rows':[]};var _0x21ac21=_[_0xf6b5('0x29')](db['WhatsappTransferReport']['rawAttributes'],function(_0x176b8e){return{'name':_0x176b8e['fieldName'],'type':_0x176b8e[_0xf6b5('0x2a')][_0xf6b5('0x2b')]};});_0x379cac['model']=_[_0xf6b5('0x29')](_0x21ac21,_0xf6b5('0x26'));_0x379cac[_0xf6b5('0x2c')]=_['keys'](_0x220c63['query']);_0x379cac[_0xf6b5('0x2d')]=_[_0xf6b5('0x2e')](_0x379cac[_0xf6b5('0x2f')],_0x379cac[_0xf6b5('0x2c')]);_0x3fa73f[_0xf6b5('0x30')]=_[_0xf6b5('0x2e')](_0x379cac[_0xf6b5('0x2f')],qs[_0xf6b5('0x31')](_0x220c63[_0xf6b5('0x2c')]['fields']));_0x3fa73f['attributes']=_0x3fa73f[_0xf6b5('0x30')][_0xf6b5('0x32')]?_0x3fa73f[_0xf6b5('0x30')]:_0x379cac[_0xf6b5('0x2f')];if(!_0x220c63[_0xf6b5('0x2c')]['hasOwnProperty']('nolimit')){_0x3fa73f['limit']=qs[_0xf6b5('0x1a')](_0x220c63[_0xf6b5('0x2c')][_0xf6b5('0x1a')]);_0x3fa73f[_0xf6b5('0x1d')]=qs['offset'](_0x220c63[_0xf6b5('0x2c')]['offset']);}_0x3fa73f[_0xf6b5('0x33')]=qs[_0xf6b5('0x34')](_0x220c63[_0xf6b5('0x2c')][_0xf6b5('0x34')]);_0x3fa73f[_0xf6b5('0x35')]=qs[_0xf6b5('0x2d')](_['pick'](_0x220c63['query'],_0x379cac[_0xf6b5('0x2d')]),_0x21ac21);if(_0x220c63[_0xf6b5('0x2c')]['filter']){_0x3fa73f[_0xf6b5('0x35')]=_[_0xf6b5('0x36')](_0x3fa73f[_0xf6b5('0x35')],{'$or':_[_0xf6b5('0x29')](_0x21ac21,function(_0x156b46){if(_0x156b46['type']!=='VIRTUAL'){var _0xb115df={};_0xb115df[_0x156b46[_0xf6b5('0x26')]]={'$like':'%'+_0x220c63[_0xf6b5('0x2c')][_0xf6b5('0x37')]+'%'};return _0xb115df;}})});}_0x3fa73f=_['merge']({},_0x3fa73f,_0x220c63[_0xf6b5('0x38')]);var _0x56dceb={'where':_0x3fa73f[_0xf6b5('0x35')]};return db['WhatsappTransferReport']['count'](_0x56dceb)[_0xf6b5('0x24')](function(_0x3d0ed4){_0x54da37[_0xf6b5('0x1c')]=_0x3d0ed4;if(_0x220c63[_0xf6b5('0x2c')][_0xf6b5('0x39')]){_0x3fa73f[_0xf6b5('0x3a')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x3fa73f);})[_0xf6b5('0x24')](function(_0x55088c){_0x54da37['rows']=_0x55088c;return _0x54da37;})['then'](respondWithFilteredResult(_0x35f61e,_0x3fa73f))[_0xf6b5('0x3b')](handleError(_0x35f61e,null));};exports[_0xf6b5('0x3c')]=function(_0xb82837,_0x14eeb5){var _0x378026={'raw':!![],'where':{'id':_0xb82837[_0xf6b5('0x3d')]['id']}},_0x3047c6={};_0x3047c6[_0xf6b5('0x2f')]=_[_0xf6b5('0x3e')](db[_0xf6b5('0x3f')][_0xf6b5('0x40')]);_0x3047c6[_0xf6b5('0x2c')]=_[_0xf6b5('0x3e')](_0xb82837['query']);_0x3047c6[_0xf6b5('0x2d')]=_[_0xf6b5('0x2e')](_0x3047c6['model'],_0x3047c6['query']);_0x378026[_0xf6b5('0x30')]=_[_0xf6b5('0x2e')](_0x3047c6[_0xf6b5('0x2f')],qs['fields'](_0xb82837[_0xf6b5('0x2c')][_0xf6b5('0x31')]));_0x378026[_0xf6b5('0x30')]=_0x378026[_0xf6b5('0x30')][_0xf6b5('0x32')]?_0x378026[_0xf6b5('0x30')]:_0x3047c6[_0xf6b5('0x2f')];if(_0xb82837[_0xf6b5('0x2c')]['includeAll']){_0x378026[_0xf6b5('0x3a')]=[{'all':!![]}];}_0x378026=_[_0xf6b5('0x36')]({},_0x378026,_0xb82837[_0xf6b5('0x38')]);return db['WhatsappTransferReport'][_0xf6b5('0x41')](_0x378026)['then'](handleEntityNotFound(_0x14eeb5,null))[_0xf6b5('0x24')](respondWithResult(_0x14eeb5,null))['catch'](handleError(_0x14eeb5,null));};exports[_0xf6b5('0x42')]=function(_0x2fe1,_0x5c73a9){return db[_0xf6b5('0x3f')]['create'](_0x2fe1[_0xf6b5('0x43')],{})[_0xf6b5('0x24')](respondWithResult(_0x5c73a9,0xc9))['catch'](handleError(_0x5c73a9,null));};exports[_0xf6b5('0x22')]=function(_0x294100,_0x560991){if(_0x294100[_0xf6b5('0x43')]['id']){delete _0x294100[_0xf6b5('0x43')]['id'];}return db[_0xf6b5('0x3f')][_0xf6b5('0x41')]({'where':{'id':_0x294100['params']['id']}})['then'](handleEntityNotFound(_0x560991,null))[_0xf6b5('0x24')](saveUpdates(_0x294100['body'],null))[_0xf6b5('0x24')](respondWithResult(_0x560991,null))[_0xf6b5('0x3b')](handleError(_0x560991,null));};exports[_0xf6b5('0x23')]=function(_0x4b66fd,_0x5d1318){return db[_0xf6b5('0x3f')][_0xf6b5('0x41')]({'where':{'id':_0x4b66fd[_0xf6b5('0x3d')]['id']}})[_0xf6b5('0x24')](handleEntityNotFound(_0x5d1318,null))['then'](removeEntity(_0x5d1318,null))[_0xf6b5('0x3b')](handleError(_0x5d1318,null));};exports['describe']=function(_0x9f8c64,_0x1f5b4d){return db[_0xf6b5('0x3f')][_0xf6b5('0x44')]()[_0xf6b5('0x24')](respondWithResult(_0x1f5b4d,null))['catch'](handleError(_0x1f5b4d,null));}; \ No newline at end of file +var _0x0790=['count','Content-Range','json','apply','save','update','then','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','describe','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0790,0xf2));var _0x0079=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x0790[_0x4ea69d];return _0x5318e0;};'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(_0x0079('0x0'));var moment=require(_0x0079('0x1'));var BPromise=require(_0x0079('0x2'));var Mustache=require(_0x0079('0x3'));var util=require(_0x0079('0x4'));var path=require(_0x0079('0x5'));var sox=require('sox');var csv=require(_0x0079('0x6'));var ejs=require(_0x0079('0x7'));var fs=require('fs');var fs_extra=require(_0x0079('0x8'));var _=require('lodash');var squel=require(_0x0079('0x9'));var crypto=require(_0x0079('0xa'));var jsforce=require(_0x0079('0xb'));var deskjs=require(_0x0079('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0079('0xd'));var Redis=require(_0x0079('0xe'));var authService=require(_0x0079('0xf'));var qs=require(_0x0079('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0079('0x11'))(_0x0079('0x12'));var utils=require('../../config/utils');var config=require(_0x0079('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0079('0x14'))['db'];function respondWithStatusCode(_0x2574d6,_0x51a457){_0x51a457=_0x51a457||0xcc;return function(_0x4d0c5a){if(_0x4d0c5a){return _0x2574d6[_0x0079('0x15')](_0x51a457);}return _0x2574d6[_0x0079('0x16')](_0x51a457)['end']();};}function respondWithResult(_0x4b82b3,_0x53ed7e){_0x53ed7e=_0x53ed7e||0xc8;return function(_0x4214c0){if(_0x4214c0){return _0x4b82b3[_0x0079('0x16')](_0x53ed7e)['json'](_0x4214c0);}};}function respondWithFilteredResult(_0x1889ed,_0x54c0a2){return function(_0x24e7cb){if(_0x24e7cb){var _0x145ab1=typeof _0x54c0a2[_0x0079('0x17')]===_0x0079('0x18')&&typeof _0x54c0a2[_0x0079('0x19')]===_0x0079('0x18');var _0x40b740=_0x24e7cb['count'];var _0x2d6c63=_0x145ab1?0x0:_0x54c0a2[_0x0079('0x17')];var _0x220bfd=_0x145ab1?_0x24e7cb[_0x0079('0x1a')]:_0x54c0a2[_0x0079('0x17')]+_0x54c0a2[_0x0079('0x19')];var _0x4aee6c;if(_0x220bfd>=_0x40b740){_0x220bfd=_0x40b740;_0x4aee6c=0xc8;}else{_0x4aee6c=0xce;}_0x1889ed['status'](_0x4aee6c);return _0x1889ed['set'](_0x0079('0x1b'),_0x2d6c63+'-'+_0x220bfd+'/'+_0x40b740)[_0x0079('0x1c')](_0x24e7cb);}return null;};}function patchUpdates(_0x533f5c){return function(_0x587f70){try{jsonpatch[_0x0079('0x1d')](_0x587f70,_0x533f5c,!![]);}catch(_0x3ee2c5){return BPromise['reject'](_0x3ee2c5);}return _0x587f70[_0x0079('0x1e')]();};}function saveUpdates(_0x5a2fe5,_0x50d53c){return function(_0x4b7f7b){if(_0x4b7f7b){return _0x4b7f7b[_0x0079('0x1f')](_0x5a2fe5)[_0x0079('0x20')](function(_0x4c0c22){return _0x4c0c22;});}return null;};}function removeEntity(_0x576c61,_0x3dee16){return function(_0x59ed70){if(_0x59ed70){return _0x59ed70['destroy']()[_0x0079('0x20')](function(){_0x576c61['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21fc74,_0x29e5dc){return function(_0x156ebb){if(!_0x156ebb){_0x21fc74[_0x0079('0x15')](0x194);}return _0x156ebb;};}function handleError(_0x46f84b,_0xc1ba3e){_0xc1ba3e=_0xc1ba3e||0x1f4;return function(_0x4fd5){logger[_0x0079('0x21')](_0x4fd5[_0x0079('0x22')]);if(_0x4fd5[_0x0079('0x23')]){delete _0x4fd5[_0x0079('0x23')];}_0x46f84b[_0x0079('0x16')](_0xc1ba3e)[_0x0079('0x24')](_0x4fd5);};}exports[_0x0079('0x25')]=function(_0x1b2020,_0x65c4df){var _0x1113be={},_0x2f84ab={},_0x15e90c={'count':0x0,'rows':[]};var _0x5669ad=_[_0x0079('0x26')](db[_0x0079('0x27')][_0x0079('0x28')],function(_0x22dba8){return{'name':_0x22dba8['fieldName'],'type':_0x22dba8['type']['key']};});_0x2f84ab[_0x0079('0x29')]=_[_0x0079('0x26')](_0x5669ad,_0x0079('0x23'));_0x2f84ab[_0x0079('0x2a')]=_[_0x0079('0x2b')](_0x1b2020[_0x0079('0x2a')]);_0x2f84ab[_0x0079('0x2c')]=_[_0x0079('0x2d')](_0x2f84ab[_0x0079('0x29')],_0x2f84ab[_0x0079('0x2a')]);_0x1113be[_0x0079('0x2e')]=_[_0x0079('0x2d')](_0x2f84ab[_0x0079('0x29')],qs['fields'](_0x1b2020[_0x0079('0x2a')]['fields']));_0x1113be[_0x0079('0x2e')]=_0x1113be['attributes']['length']?_0x1113be['attributes']:_0x2f84ab[_0x0079('0x29')];if(!_0x1b2020[_0x0079('0x2a')][_0x0079('0x2f')](_0x0079('0x30'))){_0x1113be[_0x0079('0x19')]=qs['limit'](_0x1b2020['query'][_0x0079('0x19')]);_0x1113be[_0x0079('0x17')]=qs[_0x0079('0x17')](_0x1b2020['query'][_0x0079('0x17')]);}_0x1113be[_0x0079('0x31')]=qs[_0x0079('0x32')](_0x1b2020[_0x0079('0x2a')][_0x0079('0x32')]);_0x1113be['where']=qs[_0x0079('0x2c')](_[_0x0079('0x33')](_0x1b2020[_0x0079('0x2a')],_0x2f84ab[_0x0079('0x2c')]),_0x5669ad);if(_0x1b2020['query']['filter']){_0x1113be['where']=_[_0x0079('0x34')](_0x1113be['where'],{'$or':_[_0x0079('0x26')](_0x5669ad,function(_0xbd83ae){if(_0xbd83ae[_0x0079('0x35')]!=='VIRTUAL'){var _0x2fd454={};_0x2fd454[_0xbd83ae[_0x0079('0x23')]]={'$like':'%'+_0x1b2020['query'][_0x0079('0x36')]+'%'};return _0x2fd454;}})});}_0x1113be=_['merge']({},_0x1113be,_0x1b2020[_0x0079('0x37')]);var _0x578734={'where':_0x1113be['where']};return db[_0x0079('0x27')][_0x0079('0x1a')](_0x578734)['then'](function(_0x9349f6){_0x15e90c[_0x0079('0x1a')]=_0x9349f6;if(_0x1b2020['query'][_0x0079('0x38')]){_0x1113be[_0x0079('0x39')]=[{'all':!![]}];}return db[_0x0079('0x27')][_0x0079('0x3a')](_0x1113be);})['then'](function(_0x3b649b){_0x15e90c[_0x0079('0x3b')]=_0x3b649b;return _0x15e90c;})['then'](respondWithFilteredResult(_0x65c4df,_0x1113be))[_0x0079('0x3c')](handleError(_0x65c4df,null));};exports['show']=function(_0x2028a5,_0x4344fa){var _0x3040a7={'raw':!![],'where':{'id':_0x2028a5[_0x0079('0x3d')]['id']}},_0x4c3165={};_0x4c3165[_0x0079('0x29')]=_[_0x0079('0x2b')](db[_0x0079('0x27')]['rawAttributes']);_0x4c3165[_0x0079('0x2a')]=_[_0x0079('0x2b')](_0x2028a5[_0x0079('0x2a')]);_0x4c3165[_0x0079('0x2c')]=_[_0x0079('0x2d')](_0x4c3165[_0x0079('0x29')],_0x4c3165[_0x0079('0x2a')]);_0x3040a7[_0x0079('0x2e')]=_[_0x0079('0x2d')](_0x4c3165['model'],qs[_0x0079('0x3e')](_0x2028a5[_0x0079('0x2a')]['fields']));_0x3040a7['attributes']=_0x3040a7[_0x0079('0x2e')]['length']?_0x3040a7[_0x0079('0x2e')]:_0x4c3165[_0x0079('0x29')];if(_0x2028a5[_0x0079('0x2a')][_0x0079('0x38')]){_0x3040a7[_0x0079('0x39')]=[{'all':!![]}];}_0x3040a7=_[_0x0079('0x34')]({},_0x3040a7,_0x2028a5[_0x0079('0x37')]);return db['WhatsappTransferReport'][_0x0079('0x3f')](_0x3040a7)[_0x0079('0x20')](handleEntityNotFound(_0x4344fa,null))[_0x0079('0x20')](respondWithResult(_0x4344fa,null))[_0x0079('0x3c')](handleError(_0x4344fa,null));};exports[_0x0079('0x40')]=function(_0x4eb377,_0xc193d2){return db[_0x0079('0x27')][_0x0079('0x40')](_0x4eb377[_0x0079('0x41')],{})[_0x0079('0x20')](respondWithResult(_0xc193d2,0xc9))[_0x0079('0x3c')](handleError(_0xc193d2,null));};exports[_0x0079('0x1f')]=function(_0xf841d3,_0x253539){if(_0xf841d3[_0x0079('0x41')]['id']){delete _0xf841d3[_0x0079('0x41')]['id'];}return db[_0x0079('0x27')]['find']({'where':{'id':_0xf841d3[_0x0079('0x3d')]['id']}})['then'](handleEntityNotFound(_0x253539,null))[_0x0079('0x20')](saveUpdates(_0xf841d3[_0x0079('0x41')],null))[_0x0079('0x20')](respondWithResult(_0x253539,null))[_0x0079('0x3c')](handleError(_0x253539,null));};exports['destroy']=function(_0x46ea1d,_0x7e036d){return db[_0x0079('0x27')][_0x0079('0x3f')]({'where':{'id':_0x46ea1d[_0x0079('0x3d')]['id']}})[_0x0079('0x20')](handleEntityNotFound(_0x7e036d,null))[_0x0079('0x20')](removeEntity(_0x7e036d,null))[_0x0079('0x3c')](handleError(_0x7e036d,null));};exports[_0x0079('0x42')]=function(_0x2ea1f2,_0x424a4a){return db[_0x0079('0x27')][_0x0079('0x42')]()['then'](respondWithResult(_0x424a4a,null))[_0x0079('0x3c')](handleError(_0x424a4a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index b6e7a22..3aa0e8c 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 _0xc4ef=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappTransferReport','uniqueid','lodash'];(function(_0x3d5aef,_0x64e2d5){var _0x33e385=function(_0x24c86e){while(--_0x24c86e){_0x3d5aef['push'](_0x3d5aef['shift']());}};_0x33e385(++_0x64e2d5);}(_0xc4ef,0x14f));var _0xfc4e=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xc4ef[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xfc4e('0x0'));var util=require('util');var logger=require(_0xfc4e('0x1'))(_0xfc4e('0x2'));var moment=require('moment');var BPromise=require(_0xfc4e('0x3'));var rp=require(_0xfc4e('0x4'));var fs=require('fs');var path=require(_0xfc4e('0x5'));var rimraf=require(_0xfc4e('0x6'));var config=require(_0xfc4e('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0xfc4e('0x8')]=function(_0x1d1b1e,_0x10b025){return _0x1d1b1e[_0xfc4e('0x9')](_0xfc4e('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xfc4e('0xb'),'fields':[_0xfc4e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x08cb=['path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x08cb,0x167));var _0xb08c=function(_0x390e09,_0x359c18){_0x390e09=_0x390e09-0x0;var _0x586d4f=_0x08cb[_0x390e09];return _0x586d4f;};'use strict';var _=require(_0xb08c('0x0'));var util=require('util');var logger=require(_0xb08c('0x1'))(_0xb08c('0x2'));var moment=require(_0xb08c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb08c('0x4'));var fs=require('fs');var path=require(_0xb08c('0x5'));var rimraf=require(_0xb08c('0x6'));var config=require('../../config/environment');var attributes=require(_0xb08c('0x7'));module[_0xb08c('0x8')]=function(_0x5c39ef,_0x5ee93e){return _0x5c39ef[_0xb08c('0x9')](_0xb08c('0xa'),attributes,{'tableName':_0xb08c('0xb'),'paranoid':![],'indexes':[{'name':_0xb08c('0xc'),'fields':[_0xb08c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 45d71a8..7a3beaf 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 _0xba49=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0xba49,0x1b4));var _0x9ba4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xba49[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x9ba4('0x0'));var util=require(_0x9ba4('0x1'));var moment=require('moment');var BPromise=require(_0x9ba4('0x2'));var rs=require(_0x9ba4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ba4('0x4'))['db'];var utils=require(_0x9ba4('0x5'));var logger=require(_0x9ba4('0x6'))(_0x9ba4('0x7'));var config=require(_0x9ba4('0x8'));var jayson=require(_0x9ba4('0x9'));var client=jayson['client'][_0x9ba4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x301721,_0x3753d6,_0x190bd5){return new BPromise(function(_0x1e169f,_0x5ca402){return client[_0x9ba4('0xb')](_0x301721,_0x190bd5)[_0x9ba4('0xc')](function(_0x1d7f8d){logger[_0x9ba4('0xd')](_0x9ba4('0xe'),_0x3753d6,_0x9ba4('0xf'));logger[_0x9ba4('0x10')](_0x9ba4('0x11'),_0x3753d6,_0x9ba4('0xf'),JSON[_0x9ba4('0x12')](_0x1d7f8d));if(_0x1d7f8d[_0x9ba4('0x13')]){if(_0x1d7f8d[_0x9ba4('0x13')]['code']===0x1f4){logger[_0x9ba4('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3753d6,_0x1d7f8d[_0x9ba4('0x13')][_0x9ba4('0x14')]);return _0x5ca402(_0x1d7f8d[_0x9ba4('0x13')][_0x9ba4('0x14')]);}logger[_0x9ba4('0x13')](_0x9ba4('0xe'),_0x3753d6,_0x1d7f8d[_0x9ba4('0x13')][_0x9ba4('0x14')]);return _0x1e169f(_0x1d7f8d['error'][_0x9ba4('0x14')]);}else{logger[_0x9ba4('0xd')](_0x9ba4('0xe'),_0x3753d6,_0x9ba4('0xf'));_0x1e169f(_0x1d7f8d[_0x9ba4('0x15')][_0x9ba4('0x14')]);}})[_0x9ba4('0x16')](function(_0x2339d1){logger[_0x9ba4('0x13')](_0x9ba4('0xe'),_0x3753d6,_0x2339d1);_0x5ca402(_0x2339d1);});});} \ No newline at end of file +var _0x5fd1=['result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x5fd1,0x1e5));var _0x15fd=function(_0x4da7db,_0x365411){_0x4da7db=_0x4da7db-0x0;var _0x54f53d=_0x5fd1[_0x4da7db];return _0x54f53d;};'use strict';var _=require('lodash');var util=require(_0x15fd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x15fd('0x1'));var fs=require('fs');var Redis=require(_0x15fd('0x2'));var db=require(_0x15fd('0x3'))['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require(_0x15fd('0x7'));var jayson=require(_0x15fd('0x8'));var client=jayson['client'][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x73a3b0,_0xdc8bde,_0x42163e){return new BPromise(function(_0x38b540,_0x506176){return client[_0x15fd('0xa')](_0x73a3b0,_0x42163e)['then'](function(_0x3a5c17){logger[_0x15fd('0xb')](_0x15fd('0xc'),_0xdc8bde,'request\x20sent');logger[_0x15fd('0xd')](_0x15fd('0xe'),_0xdc8bde,_0x15fd('0xf'),JSON[_0x15fd('0x10')](_0x3a5c17));if(_0x3a5c17['error']){if(_0x3a5c17[_0x15fd('0x11')]['code']===0x1f4){logger[_0x15fd('0x11')](_0x15fd('0xc'),_0xdc8bde,_0x3a5c17[_0x15fd('0x11')][_0x15fd('0x12')]);return _0x506176(_0x3a5c17['error'][_0x15fd('0x12')]);}logger[_0x15fd('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0xdc8bde,_0x3a5c17[_0x15fd('0x11')][_0x15fd('0x12')]);return _0x38b540(_0x3a5c17['error'][_0x15fd('0x12')]);}else{logger[_0x15fd('0xb')](_0x15fd('0xc'),_0xdc8bde,_0x15fd('0xf'));_0x38b540(_0x3a5c17[_0x15fd('0x13')][_0x15fd('0x12')]);}})[_0x15fd('0x14')](function(_0x2dd3b1){logger['error'](_0x15fd('0xc'),_0xdc8bde,_0x2dd3b1);_0x506176(_0x2dd3b1);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 18df73f..2009e96 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb41=['listen','start','info','filter','exitCode','number','length','map','Online\x20apps:','online','name','join','status','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xcb41,0x1df));var _0x1cb4=function(_0x257f90,_0x8dc2c4){_0x257f90=_0x257f90-0x0;var _0x27efb2=_0xcb41[_0x257f90];return _0x27efb2;};'use strict';var _=require(_0x1cb4('0x0'));var db=require(_0x1cb4('0x1'))['db'];var seedDb=require(_0x1cb4('0x2'));var checkLicense=require(_0x1cb4('0x3'));var rpc=require('./rpc');var config=require(_0x1cb4('0x4'));var logger=require('./config/logger')(_0x1cb4('0x5'));var pm2=require(_0x1cb4('0x6'));var pm2Config=require(_0x1cb4('0x7'));var schedule=require(_0x1cb4('0x8'));var chat=require(_0x1cb4('0x9'));var whatsapp=require(_0x1cb4('0xa'));var transcribe=require(_0x1cb4('0xb'));var provider=require(_0x1cb4('0xc'));function main(){return db['sequelize'][_0x1cb4('0xd')]()[_0x1cb4('0xe')](function(){if(config['seedDB']){return seedDb[_0x1cb4('0xf')]();}})[_0x1cb4('0xe')](function(){return checkLicense[_0x1cb4('0xf')]();})['then'](function(){return rpc[_0x1cb4('0x10')]();})[_0x1cb4('0xe')](function(_0x30c281){logger['info'](_0x30c281);return chat['start']();})[_0x1cb4('0xe')](function(){return whatsapp['start']();})[_0x1cb4('0xe')](function(){return schedule[_0x1cb4('0x11')]();})[_0x1cb4('0xe')](function(){return transcribe[_0x1cb4('0x11')]();})[_0x1cb4('0xe')](function(){return provider['start']();})[_0x1cb4('0xe')](function(_0x4cb3c9){logger[_0x1cb4('0x12')](_0x4cb3c9);return pm2[_0x1cb4('0x11')](pm2Config);})[_0x1cb4('0xe')](function(_0xb01aec){var _0x147d0e=_0xb01aec[_0x1cb4('0x13')](function(_0x34e04e){return typeof _0x34e04e[_0x1cb4('0x14')]===_0x1cb4('0x15')&&_0x34e04e[_0x1cb4('0x14')]>=0x0;});if(_0x147d0e['length']>0x0){throw new Error(_0x147d0e[_0x1cb4('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x1cb4('0x17')](_0x147d0e,function(_0x10326c){return'\x22'+_0x10326c['pm2_env']['name']+'\x22';}));}logger[_0x1cb4('0x12')](_0x1cb4('0x18'),_[_0x1cb4('0x17')](_[_0x1cb4('0x13')](_0xb01aec,{'status':_0x1cb4('0x19')}),_0x1cb4('0x1a'))[_0x1cb4('0x1b')]());logger[_0x1cb4('0x12')]('Offline\x20apps:',_[_0x1cb4('0x17')](_[_0x1cb4('0x13')](_0xb01aec,function(_0x5a24ec){return _0x5a24ec[_0x1cb4('0x1c')]!==_0x1cb4('0x19');}),_0x1cb4('0x1a'))[_0x1cb4('0x1b')]()||'None');console[_0x1cb4('0x1d')]('App\x20Ready!');})['catch'](function(_0x20afe0){console[_0x1cb4('0x1d')](_0x1cb4('0x1e'),_0x20afe0);logger['error'](_0x1cb4('0x1f'),_0x20afe0);process[_0x1cb4('0x20')](0x1);});}main(); \ No newline at end of file +var _0xfd87=['status','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','start','filter','exitCode','number','length','pm2_env','name','Online\x20apps:','map','online','join','info','Offline\x20apps:'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fd8('0x0'));var db=require(_0x7fd8('0x1'))['db'];var seedDb=require(_0x7fd8('0x2'));var checkLicense=require(_0x7fd8('0x3'));var rpc=require(_0x7fd8('0x4'));var config=require(_0x7fd8('0x5'));var logger=require(_0x7fd8('0x6'))(_0x7fd8('0x7'));var pm2=require(_0x7fd8('0x8'));var pm2Config=require(_0x7fd8('0x9'));var schedule=require(_0x7fd8('0xa'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x7fd8('0xb'));var transcribe=require(_0x7fd8('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x7fd8('0xd')][_0x7fd8('0xe')]()[_0x7fd8('0xf')](function(){if(config[_0x7fd8('0x10')]){return seedDb[_0x7fd8('0x11')]();}})['then'](function(){return checkLicense[_0x7fd8('0x11')]();})[_0x7fd8('0xf')](function(){return rpc[_0x7fd8('0x12')]();})['then'](function(_0x5486fc){logger['info'](_0x5486fc);return chat[_0x7fd8('0x13')]();})['then'](function(){return whatsapp[_0x7fd8('0x13')]();})[_0x7fd8('0xf')](function(){return schedule[_0x7fd8('0x13')]();})['then'](function(){return transcribe[_0x7fd8('0x13')]();})[_0x7fd8('0xf')](function(){return provider[_0x7fd8('0x13')]();})[_0x7fd8('0xf')](function(_0x20d1c5){logger['info'](_0x20d1c5);return pm2[_0x7fd8('0x13')](pm2Config);})[_0x7fd8('0xf')](function(_0x1d481a){var _0x1131ef=_0x1d481a[_0x7fd8('0x14')](function(_0x38d45a){return typeof _0x38d45a[_0x7fd8('0x15')]===_0x7fd8('0x16')&&_0x38d45a[_0x7fd8('0x15')]>=0x0;});if(_0x1131ef[_0x7fd8('0x17')]>0x0){throw new Error(_0x1131ef[_0x7fd8('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x1131ef,function(_0x5ca7f6){return'\x22'+_0x5ca7f6[_0x7fd8('0x18')][_0x7fd8('0x19')]+'\x22';}));}logger['info'](_0x7fd8('0x1a'),_[_0x7fd8('0x1b')](_[_0x7fd8('0x14')](_0x1d481a,{'status':_0x7fd8('0x1c')}),_0x7fd8('0x19'))[_0x7fd8('0x1d')]());logger[_0x7fd8('0x1e')](_0x7fd8('0x1f'),_['map'](_[_0x7fd8('0x14')](_0x1d481a,function(_0x3b7b49){return _0x3b7b49[_0x7fd8('0x20')]!==_0x7fd8('0x1c');}),_0x7fd8('0x19'))[_0x7fd8('0x1d')]()||'None');console[_0x7fd8('0x21')](_0x7fd8('0x22'));})[_0x7fd8('0x23')](function(_0x1acfb4){console['log'](_0x7fd8('0x24'),_0x1acfb4);logger[_0x7fd8('0x25')](_0x7fd8('0x26'),_0x1acfb4);process[_0x7fd8('0x27')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 6311d8a..b224161 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 _0x7bf3=['composable-middleware','basic-auth','bluebird','util','secrets','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','then','closed','query','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','find','authenticate','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','add','minutes','User','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','encryptString','join','sign','options','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt'];(function(_0x478b2c,_0x52c9ae){var _0x42dd64=function(_0x29e757){while(--_0x29e757){_0x478b2c['push'](_0x478b2c['shift']());}};_0x42dd64(++_0x52c9ae);}(_0x7bf3,0x107));var _0x37bf=function(_0x1255cd,_0x27e870){_0x1255cd=_0x1255cd-0x0;var _0x1ef8ea=_0x7bf3[_0x1255cd];return _0x1ef8ea;};'use strict';var db=require(_0x37bf('0x0'))['db'];var config=require(_0x37bf('0x1'));var hardwareConf=require(_0x37bf('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x37bf('0x3'));var _=require(_0x37bf('0x4'));var jwt=require(_0x37bf('0x5'));var expressJwt=require(_0x37bf('0x6'));var compose=require(_0x37bf('0x7'));var basicAuth=require(_0x37bf('0x8'));var crypto=require('crypto');var BPromise=require(_0x37bf('0x9'));var util=require(_0x37bf('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x37bf('0xb')]['session']});var userAttributes=['id',_0x37bf('0xc'),_0x37bf('0xd'),_0x37bf('0xe'),_0x37bf('0xf'),_0x37bf('0x10'),_0x37bf('0x11'),_0x37bf('0x12'),_0x37bf('0x13'),_0x37bf('0x14'),_0x37bf('0x15'),_0x37bf('0x16'),_0x37bf('0x17'),_0x37bf('0x18'),'openchannelPause','pauseType',_0x37bf('0x19'),_0x37bf('0x1a'),_0x37bf('0x1b'),_0x37bf('0x1c'),_0x37bf('0x1d'),'passwordResetAt',_0x37bf('0x1e'),_0x37bf('0x1f'),'phoneBarAutoAnswerDelay',_0x37bf('0x20'),_0x37bf('0x21'),_0x37bf('0x22'),'phoneBarEnableSettings',_0x37bf('0x23'),_0x37bf('0x24'),_0x37bf('0x25'),_0x37bf('0x26'),'hotdesk','interface',_0x37bf('0x27'),_0x37bf('0x28'),'settingsEnabled',_0x37bf('0x29'),_0x37bf('0x2a'),_0x37bf('0x2b'),_0x37bf('0x2c'),_0x37bf('0x2d'),_0x37bf('0x2e'),_0x37bf('0x2f'),_0x37bf('0x30'),_0x37bf('0x31'),_0x37bf('0x32'),_0x37bf('0x33'),_0x37bf('0x34'),_0x37bf('0x35'),_0x37bf('0x36'),_0x37bf('0x37'),'faxAutoanswerDelay',_0x37bf('0x38'),_0x37bf('0x39'),'messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this[_0x37bf('0x3a')](!![])[_0x37bf('0x3b')](function(_0x452226,_0x25d33e,_0x5cf92e){if(_0x452226[_0x37bf('0x3c')]){_0x5cf92e();}else{return db[_0x37bf('0x3d')][_0x37bf('0x3e')]({'where':{'id':_0x452226[_0x37bf('0x3f')]['id']},'attributes':['id','closed',_0x37bf('0x40')],'raw':!![]})[_0x37bf('0x41')](function(_0x79f73b){if(_0x79f73b&&_0x79f73b[_0x37bf('0x42')]&&!_0x452226[_0x37bf('0x43')]['forceDownload']){return _0x25d33e[_0x37bf('0x44')](_0x79f73b['disposition']===_0x37bf('0x45')?0x195:0x193)[_0x37bf('0x46')]({'message':_0x79f73b[_0x37bf('0x40')]===_0x37bf('0x45')?_0x37bf('0x47'):_0x37bf('0x48')});}else{_0x5cf92e();}})[_0x37bf('0x49')](function(_0x2fe473){_0x5cf92e(_0x2fe473);});}});};exports[_0x37bf('0x3a')]=function isAuthenticated(_0x3df322){return compose()[_0x37bf('0x3b')](function(_0x101475,_0x5286b5,_0x32ee9b){var _0x3a46f6;if(_0x101475[_0x37bf('0x4a')][_0x37bf('0x4b')]){if(_[_0x37bf('0x4c')](_0x101475[_0x37bf('0x4a')][_0x37bf('0x4b')],_0x37bf('0x4d'))){var _0x3dd452=basicAuth(_0x101475);db['User'][_0x37bf('0x4e')]({'where':{'name':_0x3dd452[_0x37bf('0xe')]}})['then'](function(_0x2d0db9){if(!_0x2d0db9||!_0x2d0db9[_0x37bf('0x4f')](_0x3dd452['pass'])){return _0x5286b5[_0x37bf('0x44')](0x191)[_0x37bf('0x46')]({'message':'Wrong\x20credentials.'});}_0x101475['user']={'id':_0x2d0db9['id']};_0x32ee9b();})['catch'](function(_0x50dee8){_0x32ee9b(_0x50dee8);});}else if(_[_0x37bf('0x4c')](_0x101475['headers'][_0x37bf('0x4b')],_0x37bf('0x50'))){validateJwt(_0x101475,_0x5286b5,_0x32ee9b);}else{if(_0x3df322){_0x32ee9b();}else{return _0x5286b5[_0x37bf('0x44')](0x193)[_0x37bf('0x46')]({'message':_0x37bf('0x51')});}}}else if(_0x101475[_0x37bf('0x43')][_0x37bf('0x52')]){try{var _0x18bc06={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x37bf('0x53')]()};verifyJwt(_0x101475[_0x37bf('0x43')][_0x37bf('0x52')],_0x18bc06)[_0x37bf('0x41')](function(_0x336490){return db['User'][_0x37bf('0x4e')]({'where':{'id':_0x336490[_0x37bf('0x54')]}})[_0x37bf('0x41')](function(_0x38f83c){_0x3a46f6=_0x38f83c;return db['Setting'][_0x37bf('0x3e')]({'where':{'id':0x1},'attributes':[_0x37bf('0x55'),_0x37bf('0x56')],'raw':!![]});})[_0x37bf('0x41')](function(_0x5e8d66){if(!_0x3a46f6||!_[_0x37bf('0x57')](_0x3a46f6[_0x37bf('0x58')],_0x336490[_0x37bf('0x59')])){return _0x5286b5[_0x37bf('0x44')](0x191)[_0x37bf('0x46')]({'message':_0x37bf('0x5a')});}if(_0x3a46f6['disabled']){return _0x5286b5[_0x37bf('0x44')](0x191)[_0x37bf('0x46')]({'message':_0x37bf('0x5b')});}if(_0x3a46f6[_0x37bf('0x5c')]){if(_0x5e8d66[_0x37bf('0x56')]>0x0){if(moment(_0x3a46f6['blockedAt'])[_0x37bf('0x5d')](_0x5e8d66[_0x37bf('0x56')],_0x37bf('0x5e'))>moment()){return _0x5286b5[_0x37bf('0x44')](0x191)[_0x37bf('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5286b5[_0x37bf('0x44')](0x191)['json']({'message':_0x37bf('0x5b')});}}_0x101475[_0x37bf('0x3c')]={'id':_0x3a46f6['id']};_0x32ee9b();});})[_0x37bf('0x49')](function(){return _0x5286b5[_0x37bf('0x44')](0x191)['json']({'message':_0x37bf('0x5b')});});}catch(_0x2d3a95){_0x32ee9b(_0x2d3a95);}}else if(_0x3df322){_0x32ee9b();}else{return _0x5286b5[_0x37bf('0x44')](0x193)['json']({'message':_0x37bf('0x51')});}})[_0x37bf('0x3b')](function(_0x18baf4,_0x373cb1,_0x4eb186){if(_0x18baf4[_0x37bf('0x3c')]){db[_0x37bf('0x5f')]['find']({'where':{'id':_0x18baf4[_0x37bf('0x3c')]['id']},'attributes':userAttributes})['then'](function(_0x5e60e0){if(!_0x5e60e0){return _0x373cb1[_0x37bf('0x44')](0x194)['json']({'message':_0x37bf('0x60')});}_0x18baf4[_0x37bf('0x3c')]=_0x5e60e0;_0x4eb186();})[_0x37bf('0x49')](function(_0xd16c51){_0x4eb186(_0xd16c51);});}else if(_0x3df322){_0x4eb186();}else{return _0x373cb1['status'](0x194)[_0x37bf('0x46')]({'message':_0x37bf('0x61')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x37bf('0x3b')](function(_0x10fb33,_0x2b2556,_0x4aee28){return licenseUtil[_0x37bf('0x62')]()['then'](function(_0x3fe11f){if(_0x3fe11f[_0x37bf('0x63')]){_0x4aee28();}else{return _0x2b2556['status'](0x193)['json']({'message':_0x37bf('0x64')});}})[_0x37bf('0x49')](function(_0x1f9574){_0x4aee28(_0x1f9574);});});};exports[_0x37bf('0x65')]=function isWebrtcLicence(){return compose()['use'](function(_0xb193fe,_0x574a7d,_0x2ca6be){return licenseUtil[_0x37bf('0x62')]()[_0x37bf('0x41')](function(_0x419882){if(_0x419882[_0x37bf('0x66')]){_0x2ca6be();}else{return _0x574a7d[_0x37bf('0x44')](0x193)[_0x37bf('0x46')]({'message':_0x37bf('0x64')});}})[_0x37bf('0x49')](function(_0x433f26){_0x2ca6be(_0x433f26);});});};exports['isMiddleware']=function(_0x4492ec,_0x4f6927,_0x5ac11c){_0x4492ec[_0x37bf('0x67')]=!![];return _0x5ac11c();};exports[_0x37bf('0x68')]=function signToken(_0x4b4deb){return signJwt(_0x4b4deb);};exports[_0x37bf('0x69')]=function(_0xc4fee7,_0x55dffd){if(!_0xc4fee7['user']){return _0x55dffd[_0x37bf('0x44')](0x194)[_0x37bf('0x46')]({'message':_0x37bf('0x6a')});}var _0x16c609={'payload':{'id':_0xc4fee7['user']['id'],'role':_0xc4fee7[_0x37bf('0x3c')][_0x37bf('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x16c609)[_0x37bf('0x41')](function(_0x1b93f0){_0x55dffd['cookie'](_0x37bf('0x6b'),_0x1b93f0);_0x55dffd[_0x37bf('0x6c')](_0x37bf('0x6d'));})[_0x37bf('0x49')](function(_0x1094e1){return _0x55dffd[_0x37bf('0x44')](0x1f4)['send'](_0x1094e1);});};exports[_0x37bf('0x6e')]=function(_0x3cd5ef){if(_[_0x37bf('0x6f')](_0x3cd5ef['apiKeyNonce'])||_['isNil'](_0x3cd5ef[_0x37bf('0x70')])){return null;}else{return createJwt(_0x3cd5ef);}};exports[_0x37bf('0x71')]=function(_0x2713a8){_0x2713a8[_0x37bf('0x58')]=generateNonce();_0x2713a8[_0x37bf('0x70')]=generateIssuedAt();return createJwt(_0x2713a8);};exports[_0x37bf('0x72')]=function(_0x445d70,_0x291df2){var _0x3a8686=_0x445d70[_0x37bf('0x43')][_0x37bf('0x52')];if(_0x3a8686){var _0x2bf97f={'nonce':_0x291df2[_0x37bf('0x58')],'iat':_0x291df2[_0x37bf('0x70')],'audience':hardwareConf[_0x37bf('0x53')](),'issuer':hardwareConf[_0x37bf('0x53')]()};return verifyJwt(_0x3a8686,_0x2bf97f)[_0x37bf('0x41')](function(){return generateApiKey(_0x291df2);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x37bf('0x73')]=function(_0x4f014a){var _0x5aebc6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5aebc6['test'](_0x4f014a))throw new db[(_0x37bf('0x74'))][(_0x37bf('0x75'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x37bf('0x76')]=function(_0x1f05a6,_0x57e655,_0x572273){var _0x502d9c=encryptor['decryptString'](_0x57e655)[_0x37bf('0x77')](',');for(var _0x1a8b19=0x0;_0x1a8b19<_0x572273;_0x1a8b19++){if(!_0x502d9c[_0x1a8b19])break;if(_0x1f05a6['toLowerCase']()===_0x502d9c[_0x1a8b19][_0x37bf('0x78')]()){var _0x14fed5=util[_0x37bf('0x79')](_0x37bf('0x7a'),_0x572273);if(_0x572273===0x1){_0x14fed5=_0x37bf('0x7b');}throw new db[(_0x37bf('0x74'))]['ValidationError'](_0x14fed5);}}return;};exports[_0x37bf('0x7c')]=function(_0x42ce83,_0x2c0c9e){var _0x20da59=_0x2c0c9e?encryptor['decryptString'](_0x2c0c9e)['split'](','):[];if(_0x20da59[_0x37bf('0x7d')]===0x5){_0x20da59['splice'](-0x1,0x1);}_0x20da59['unshift'](_0x42ce83);return encryptor[_0x37bf('0x7e')](_0x20da59[_0x37bf('0x7f')](','));};function signJwt(_0x384df4){var _0x144f80=BPromise['promisify'](jwt[_0x37bf('0x80')],{'context':jwt});var _0x3e1402=_0x384df4['secret']||config[_0x37bf('0xb')]['session'];return new BPromise(function(_0x56d4ca,_0x517174){_0x144f80(_0x384df4['payload'],_0x3e1402,_0x384df4[_0x37bf('0x81')])[_0x37bf('0x41')](function(_0x8c61db){_0x56d4ca(_0x8c61db);})[_0x37bf('0x49')](function(_0x4e47e9){_0x517174(_0x4e47e9);});});}function verifyJwt(_0x62696b,_0x22fc83,_0x3d1d6a){var _0x1b3563=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x2468e4=_0x3d1d6a||config[_0x37bf('0xb')]['session'];return new BPromise(function(_0xac608b,_0x35db33){_0x1b3563(_0x62696b,_0x2468e4,_0x22fc83)[_0x37bf('0x41')](function(_0x2a3d99){_0xac608b(_0x2a3d99);})[_0x37bf('0x49')](function(_0x1fe472){_0x35db33(_0x1fe472);});});}function generateNonce(){return crypto[_0x37bf('0x82')](0x10)[_0x37bf('0x83')](_0x37bf('0x84'));}function generateIssuedAt(){return Math[_0x37bf('0x85')](Date['now']()/0x3e8)[_0x37bf('0x83')]();}function createJwt(_0xd91fbe){var _0x804895={'payload':{'iat':_0xd91fbe['apiKeyIat'],'nonce':_0xd91fbe[_0x37bf('0x58')]},'options':{'algorithm':_0x37bf('0x86'),'subject':_0xd91fbe['id'][_0x37bf('0x83')](),'issuer':hardwareConf[_0x37bf('0x53')](),'audience':hardwareConf[_0x37bf('0x53')]()}};return signJwt(_0x804895)[_0x37bf('0x41')](function(_0xe4cf22){return{'iat':_0xd91fbe[_0x37bf('0x70')],'nonce':_0xd91fbe[_0x37bf('0x58')],'token':_0xe4cf22};});} \ No newline at end of file +var _0xedd4=['status','unmanaged','json','catch','headers','authorization','startsWith','Basic','User','authenticate','Wrong\x20credentials.','Bearer','getUuid','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','getLicense','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify','sign','secret','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','email','md5secret','voicePause','chatPause','mailPause','openchannelPause','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','query','forceDownload'];(function(_0x5e9791,_0x34c262){var _0x43048e=function(_0x452ae6){while(--_0x452ae6){_0x5e9791['push'](_0x5e9791['shift']());}};_0x43048e(++_0x34c262);}(_0xedd4,0x1c4));var _0x4edd=function(_0x57a6e2,_0x240cb7){_0x57a6e2=_0x57a6e2-0x0;var _0x203abd=_0xedd4[_0x57a6e2];return _0x203abd;};'use strict';var db=require(_0x4edd('0x0'))['db'];var config=require(_0x4edd('0x1'));var hardwareConf=require(_0x4edd('0x2'));var licenseUtil=require(_0x4edd('0x3'));var encryptor=require('../encryptor');var _=require(_0x4edd('0x4'));var jwt=require(_0x4edd('0x5'));var expressJwt=require(_0x4edd('0x6'));var compose=require(_0x4edd('0x7'));var basicAuth=require(_0x4edd('0x8'));var crypto=require(_0x4edd('0x9'));var BPromise=require(_0x4edd('0xa'));var util=require('util');var moment=require(_0x4edd('0xb'));var validateJwt=expressJwt({'secret':config[_0x4edd('0xc')][_0x4edd('0xd')]});var userAttributes=['id',_0x4edd('0xe'),_0x4edd('0xf'),_0x4edd('0x10'),'internal',_0x4edd('0x11'),'userpic','permissions',_0x4edd('0x12'),_0x4edd('0x13'),_0x4edd('0x14'),_0x4edd('0x15'),'faxPause','smsPause',_0x4edd('0x16'),'pauseType',_0x4edd('0x17'),_0x4edd('0x18'),'lastPauseAt',_0x4edd('0x19'),_0x4edd('0x1a'),_0x4edd('0x1b'),'alias',_0x4edd('0x1c'),'phoneBarAutoAnswerDelay',_0x4edd('0x1d'),_0x4edd('0x1e'),_0x4edd('0x1f'),'phoneBarEnableSettings',_0x4edd('0x20'),_0x4edd('0x21'),_0x4edd('0x22'),_0x4edd('0x23'),'hotdesk','interface',_0x4edd('0x24'),_0x4edd('0x25'),_0x4edd('0x26'),_0x4edd('0x27'),_0x4edd('0x28'),_0x4edd('0x29'),_0x4edd('0x2a'),_0x4edd('0x2b'),_0x4edd('0x2c'),_0x4edd('0x2d'),_0x4edd('0x2e'),_0x4edd('0x2f'),_0x4edd('0x30'),_0x4edd('0x31'),_0x4edd('0x32'),_0x4edd('0x33'),'openchannelAutoanswerDelay',_0x4edd('0x34'),_0x4edd('0x35'),_0x4edd('0x36'),_0x4edd('0x37'),_0x4edd('0x38')];exports[_0x4edd('0x39')]=function(){return this[_0x4edd('0x3a')](!![])[_0x4edd('0x3b')](function(_0x3dea12,_0x8bc307,_0x3c9c47){if(_0x3dea12[_0x4edd('0x3c')]){_0x3c9c47();}else{return db[_0x4edd('0x3d')][_0x4edd('0x3e')]({'where':{'id':_0x3dea12['params']['id']},'attributes':['id',_0x4edd('0x3f'),_0x4edd('0x40')],'raw':!![]})[_0x4edd('0x41')](function(_0x2a741d){if(_0x2a741d&&_0x2a741d['closed']&&!_0x3dea12[_0x4edd('0x42')][_0x4edd('0x43')]){return _0x8bc307[_0x4edd('0x44')](_0x2a741d[_0x4edd('0x40')]===_0x4edd('0x45')?0x195:0x193)[_0x4edd('0x46')]({'message':_0x2a741d[_0x4edd('0x40')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x3c9c47();}})[_0x4edd('0x47')](function(_0x54e672){_0x3c9c47(_0x54e672);});}});};exports[_0x4edd('0x3a')]=function isAuthenticated(_0x4f0548){return compose()[_0x4edd('0x3b')](function(_0x14f6f6,_0xdda757,_0x3f7f82){var _0x532a6f;if(_0x14f6f6[_0x4edd('0x48')][_0x4edd('0x49')]){if(_[_0x4edd('0x4a')](_0x14f6f6['headers']['authorization'],_0x4edd('0x4b'))){var _0x39a966=basicAuth(_0x14f6f6);db[_0x4edd('0x4c')]['find']({'where':{'name':_0x39a966[_0x4edd('0x10')]}})[_0x4edd('0x41')](function(_0x33df3e){if(!_0x33df3e||!_0x33df3e[_0x4edd('0x4d')](_0x39a966['pass'])){return _0xdda757['status'](0x191)[_0x4edd('0x46')]({'message':_0x4edd('0x4e')});}_0x14f6f6[_0x4edd('0x3c')]={'id':_0x33df3e['id']};_0x3f7f82();})[_0x4edd('0x47')](function(_0x16993e){_0x3f7f82(_0x16993e);});}else if(_[_0x4edd('0x4a')](_0x14f6f6[_0x4edd('0x48')][_0x4edd('0x49')],_0x4edd('0x4f'))){validateJwt(_0x14f6f6,_0xdda757,_0x3f7f82);}else{if(_0x4f0548){_0x3f7f82();}else{return _0xdda757['status'](0x193)[_0x4edd('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x14f6f6[_0x4edd('0x42')]['apikey']){try{var _0x1fc853={'audience':hardwareConf[_0x4edd('0x50')](),'issuer':hardwareConf[_0x4edd('0x50')]()};verifyJwt(_0x14f6f6[_0x4edd('0x42')]['apikey'],_0x1fc853)[_0x4edd('0x41')](function(_0x3f28ee){return db[_0x4edd('0x4c')]['find']({'where':{'id':_0x3f28ee['sub']}})[_0x4edd('0x41')](function(_0x18e978){_0x532a6f=_0x18e978;return db[_0x4edd('0x51')][_0x4edd('0x3e')]({'where':{'id':0x1},'attributes':[_0x4edd('0x52'),_0x4edd('0x53')],'raw':!![]});})[_0x4edd('0x41')](function(_0x1dba00){if(!_0x532a6f||!_[_0x4edd('0x54')](_0x532a6f[_0x4edd('0x55')],_0x3f28ee[_0x4edd('0x56')])){return _0xdda757[_0x4edd('0x44')](0x191)[_0x4edd('0x46')]({'message':_0x4edd('0x57')});}if(_0x532a6f['disabled']){return _0xdda757[_0x4edd('0x44')](0x191)[_0x4edd('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x532a6f[_0x4edd('0x58')]){if(_0x1dba00[_0x4edd('0x53')]>0x0){if(moment(_0x532a6f[_0x4edd('0x59')])[_0x4edd('0x5a')](_0x1dba00['blockDuration'],_0x4edd('0x5b'))>moment()){return _0xdda757[_0x4edd('0x44')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0xdda757[_0x4edd('0x44')](0x191)[_0x4edd('0x46')]({'message':_0x4edd('0x5c')});}}_0x14f6f6[_0x4edd('0x3c')]={'id':_0x532a6f['id']};_0x3f7f82();});})['catch'](function(){return _0xdda757[_0x4edd('0x44')](0x191)['json']({'message':_0x4edd('0x5c')});});}catch(_0x473bab){_0x3f7f82(_0x473bab);}}else if(_0x4f0548){_0x3f7f82();}else{return _0xdda757[_0x4edd('0x44')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x407d8d,_0x1c4f64,_0x48be95){if(_0x407d8d[_0x4edd('0x3c')]){db['User']['find']({'where':{'id':_0x407d8d[_0x4edd('0x3c')]['id']},'attributes':userAttributes})[_0x4edd('0x41')](function(_0xdc0ed2){if(!_0xdc0ed2){return _0x1c4f64[_0x4edd('0x44')](0x194)[_0x4edd('0x46')]({'message':'User\x20not\x20found.'});}_0x407d8d['user']=_0xdc0ed2;_0x48be95();})[_0x4edd('0x47')](function(_0x5a532c){_0x48be95(_0x5a532c);});}else if(_0x4f0548){_0x48be95();}else{return _0x1c4f64[_0x4edd('0x44')](0x194)[_0x4edd('0x46')]({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x4edd('0x3b')](function(_0x3231f8,_0x189646,_0x486bc3){return licenseUtil['getLicense']()[_0x4edd('0x41')](function(_0x183312){if(_0x183312['update']){_0x486bc3();}else{return _0x189646[_0x4edd('0x44')](0x193)[_0x4edd('0x46')]({'message':'Forbidden'});}})[_0x4edd('0x47')](function(_0x1c6091){_0x486bc3(_0x1c6091);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x43f76a,_0x5e645a,_0x457323){return licenseUtil[_0x4edd('0x5d')]()['then'](function(_0x28b88b){if(_0x28b88b[_0x4edd('0x5e')]){_0x457323();}else{return _0x5e645a[_0x4edd('0x44')](0x193)[_0x4edd('0x46')]({'message':_0x4edd('0x5f')});}})[_0x4edd('0x47')](function(_0x90cfbb){_0x457323(_0x90cfbb);});});};exports['isMiddleware']=function(_0x4d7163,_0x1d5885,_0x519934){_0x4d7163[_0x4edd('0x60')]=!![];return _0x519934();};exports[_0x4edd('0x61')]=function signToken(_0x2d9236){return signJwt(_0x2d9236);};exports[_0x4edd('0x62')]=function(_0x45ab53,_0x4b5c36){if(!_0x45ab53[_0x4edd('0x3c')]){return _0x4b5c36[_0x4edd('0x44')](0x194)[_0x4edd('0x46')]({'message':_0x4edd('0x63')});}var _0x2d8fd2={'payload':{'id':_0x45ab53[_0x4edd('0x3c')]['id'],'role':_0x45ab53[_0x4edd('0x3c')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x2d8fd2)['then'](function(_0x651deb){_0x4b5c36[_0x4edd('0x64')]('motion.token',_0x651deb);_0x4b5c36['redirect']('/dashboards/general');})[_0x4edd('0x47')](function(_0x2d0498){return _0x4b5c36[_0x4edd('0x44')](0x1f4)[_0x4edd('0x65')](_0x2d0498);});};exports[_0x4edd('0x66')]=function(_0x3d03e0){if(_[_0x4edd('0x67')](_0x3d03e0[_0x4edd('0x55')])||_[_0x4edd('0x67')](_0x3d03e0[_0x4edd('0x68')])){return null;}else{return createJwt(_0x3d03e0);}};exports[_0x4edd('0x69')]=function(_0x17e3e3){_0x17e3e3['apiKeyNonce']=generateNonce();_0x17e3e3['apiKeyIat']=generateIssuedAt();return createJwt(_0x17e3e3);};exports['regenerateApiKey']=function(_0x4cb384,_0x4c37cb){var _0x3476ac=_0x4cb384[_0x4edd('0x42')]['apikey'];if(_0x3476ac){var _0x343370={'nonce':_0x4c37cb[_0x4edd('0x55')],'iat':_0x4c37cb[_0x4edd('0x68')],'audience':hardwareConf[_0x4edd('0x50')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x3476ac,_0x343370)[_0x4edd('0x41')](function(){return generateApiKey(_0x4c37cb);});}else{throw{'message':_0x4edd('0x6a')};}};exports[_0x4edd('0x6b')]=function(_0x1e078c){var _0x50251d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x50251d[_0x4edd('0x6c')](_0x1e078c))throw new db[(_0x4edd('0x6d'))][(_0x4edd('0x6e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x4edd('0x6f')]=function(_0x4d44a2,_0x24c070,_0xdce3b5){var _0x1a3f4d=encryptor['decryptString'](_0x24c070)[_0x4edd('0x70')](',');for(var _0x5d5d72=0x0;_0x5d5d72<_0xdce3b5;_0x5d5d72++){if(!_0x1a3f4d[_0x5d5d72])break;if(_0x4d44a2[_0x4edd('0x71')]()===_0x1a3f4d[_0x5d5d72]['toLowerCase']()){var _0x69168e=util[_0x4edd('0x72')](_0x4edd('0x73'),_0xdce3b5);if(_0xdce3b5===0x1){_0x69168e=_0x4edd('0x74');}throw new db[(_0x4edd('0x6d'))][(_0x4edd('0x6e'))](_0x69168e);}}return;};exports[_0x4edd('0x75')]=function(_0x267e55,_0x2a1478){var _0x27c672=_0x2a1478?encryptor[_0x4edd('0x76')](_0x2a1478)[_0x4edd('0x70')](','):[];if(_0x27c672[_0x4edd('0x77')]===0x5){_0x27c672[_0x4edd('0x78')](-0x1,0x1);}_0x27c672[_0x4edd('0x79')](_0x267e55);return encryptor['encryptString'](_0x27c672[_0x4edd('0x7a')](','));};function signJwt(_0x578fd4){var _0x40aa1b=BPromise[_0x4edd('0x7b')](jwt[_0x4edd('0x7c')],{'context':jwt});var _0x155ff2=_0x578fd4[_0x4edd('0x7d')]||config[_0x4edd('0xc')][_0x4edd('0xd')];return new BPromise(function(_0x44daf0,_0x392f35){_0x40aa1b(_0x578fd4['payload'],_0x155ff2,_0x578fd4['options'])['then'](function(_0xe23340){_0x44daf0(_0xe23340);})[_0x4edd('0x47')](function(_0x7e7b27){_0x392f35(_0x7e7b27);});});}function verifyJwt(_0x24b5c8,_0x2d3f40,_0x258b43){var _0x2b1d61=BPromise[_0x4edd('0x7b')](jwt['verify'],{'context':jwt});var _0x1c0858=_0x258b43||config[_0x4edd('0xc')][_0x4edd('0xd')];return new BPromise(function(_0x33f506,_0x4c984c){_0x2b1d61(_0x24b5c8,_0x1c0858,_0x2d3f40)['then'](function(_0x412847){_0x33f506(_0x412847);})[_0x4edd('0x47')](function(_0x25b4ad){_0x4c984c(_0x25b4ad);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x4edd('0x7e')](_0x4edd('0x7f'));}function generateIssuedAt(){return Math[_0x4edd('0x80')](Date['now']()/0x3e8)[_0x4edd('0x7e')]();}function createJwt(_0x458891){var _0x40cb2b={'payload':{'iat':_0x458891[_0x4edd('0x68')],'nonce':_0x458891[_0x4edd('0x55')]},'options':{'algorithm':_0x4edd('0x81'),'subject':_0x458891['id'][_0x4edd('0x7e')](),'issuer':hardwareConf[_0x4edd('0x50')](),'audience':hardwareConf[_0x4edd('0x50')]()}};return signJwt(_0x40cb2b)[_0x4edd('0x41')](function(_0x20256d){return{'iat':_0x458891[_0x4edd('0x68')],'nonce':_0x458891[_0x4edd('0x55')],'token':_0x20256d};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 34074a1..f62f986 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b34=['user','clause','tags','skip','checkListsRestrictions','ids','tag','count','User','buildContactsQuery','catch','CmContact','describe','keys','startsWith','cf_','map','CmCustomField','slice','all','length','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b34,0xee));var _0x42b3=function(_0x48603b,_0x2ff26d){_0x48603b=_0x48603b-0x0;var _0x5a2337=_0x2b34[_0x48603b];return _0x5a2337;};'use strict';var _=require(_0x42b3('0x0'));var sqlUtils=require(_0x42b3('0x1'));var db=require(_0x42b3('0x2'))['db'];exports['findAll']=function(_0x1831d9,_0x1000f8,_0x39917a,_0x2bb1cf){var _0x21feac={'count':0x0,'rows':[]};var _0x34dbb8=sqlUtils[_0x42b3('0x3')](_0x1000f8,_0x1831d9);if(_0x34dbb8){return Promise['resolve'](_0x21feac);}var _0x9e4d8c=sqlUtils[_0x42b3('0x4')]();var _0x4af2fc={};var _0x28d42c=![];var _0x382b0a=![];return Promise[_0x42b3('0x5')]()[_0x42b3('0x6')](function(){if(_0x1831d9[_0x42b3('0x7')]){return sqlUtils[_0x42b3('0x8')](_0x1831d9[_0x42b3('0x7')],_0x2bb1cf);}else{return sqlUtils[_0x42b3('0x9')](_0x1831d9,_0x2bb1cf);}})[_0x42b3('0x6')](function(_0x1d1897){_0x9e4d8c[_0x42b3('0xa')](_0x1d1897[_0x42b3('0xb')]);_0x9e4d8c[_0x42b3('0xa')](_0x1d1897[_0x42b3('0xc')]);_0x9e4d8c[_0x42b3('0xa')](_0x1d1897[_0x42b3('0xd')]);_0x9e4d8c['where'](_0x1d1897[_0x42b3('0xe')][_0x42b3('0xf')]);_0x4af2fc=_0x1d1897[_0x42b3('0x10')];_0x382b0a=_0x1d1897[_0x42b3('0xe')][_0x42b3('0x11')];return sqlUtils[_0x42b3('0x12')](_0x1000f8,_0x1831d9,_0x382b0a);})[_0x42b3('0x6')](function(_0x5be489){_0x9e4d8c['where'](_0x5be489);var _0x38ccd4=_0x1831d9[_0x42b3('0x7')]?_0x4af2fc[_0x42b3('0x13')]:_0x1831d9[_0x42b3('0x14')];_0x28d42c=_0x38ccd4?!![]:![];return sqlUtils['countFilteredContacts'](_0x9e4d8c,_0x38ccd4);})[_0x42b3('0x6')](function(_0x31cef4){_0x21feac[_0x42b3('0x15')]=_0x31cef4;if(_0x21feac[_0x42b3('0x15')]===0x0){return;}if(_0x1831d9[_0x42b3('0x16')]){_0x382b0a=!![];}return sqlUtils[_0x42b3('0x17')](_0x9e4d8c,_0x1831d9[_0x42b3('0xc')],_0x39917a,_0x28d42c,_0x4af2fc[_0x42b3('0xf')],_0x382b0a);})[_0x42b3('0x6')](function(_0x2001c9){if(!_0x2001c9){return[];}return sqlUtils['getFilteredContacts'](_0x2001c9,_0x1831d9,_0x39917a);})[_0x42b3('0x6')](function(_0x260aa8){_0x21feac['rows']=_0x260aa8;return _0x21feac;})[_0x42b3('0x18')](function(_0x4dd942){throw _0x4dd942;});};exports['describe']=function(){var _0x2bc6ff={};var _0x347f06=[];return db[_0x42b3('0x19')][_0x42b3('0x1a')]()[_0x42b3('0x6')](function(_0x7f47b0){_0x2bc6ff=_0x7f47b0;var _0x57645a=Object[_0x42b3('0x1b')](_0x2bc6ff)[_0x42b3('0xd')](function(_0x2686d2){return _[_0x42b3('0x1c')](_0x2686d2,_0x42b3('0x1d'))?_0x2686d2:undefined;});var _0x1eda3f=_0x57645a[_0x42b3('0x1e')](function(_0x2e1db8){return db[_0x42b3('0x1f')]['findOne']({'where':{'id':_0x2e1db8[_0x42b3('0x20')](0x3)},'raw':!![]});});return Promise[_0x42b3('0x21')](_0x1eda3f);})[_0x42b3('0x6')](function(_0x1eeb77){for(var _0x52d802=0x0;_0x52d802<_0x1eeb77[_0x42b3('0x22')];_0x52d802++){if(_0x1eeb77[_0x52d802]){var _0x231b80='cf_'+_0x1eeb77[_0x52d802]['id'];_0x2bc6ff[_0x231b80]['fieldType']=_0x1eeb77[_0x52d802][_0x42b3('0x23')];}}_0x347f06=_[_0x42b3('0x1e')](Object[_0x42b3('0x1b')](_0x2bc6ff),function(_0x214caf){return{'name':_0x214caf,'type':_0x2bc6ff[_0x214caf][_0x42b3('0x23')]};});return _0x347f06;})[_0x42b3('0x18')](function(_0x331735){throw _0x331735;});}; \ No newline at end of file +var _0x9035=['cf_','map','CmCustomField','findOne','slice','length','fieldType','type','lodash','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','then','default','where','filter','user','tags','skip','checkListsRestrictions','ids','tag','count','buildContactsQuery','fields','clause','getFilteredContacts','catch','CmContact','describe','keys','startsWith'];(function(_0x44817c,_0x43bb88){var _0x1e66e2=function(_0x28afcf){while(--_0x28afcf){_0x44817c['push'](_0x44817c['shift']());}};_0x1e66e2(++_0x43bb88);}(_0x9035,0x1b8));var _0x5903=function(_0x1afd0b,_0x4add16){_0x1afd0b=_0x1afd0b-0x0;var _0xe22a6=_0x9035[_0x1afd0b];return _0xe22a6;};'use strict';var _=require(_0x5903('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x5903('0x1'))['db'];exports['findAll']=function(_0x2e558f,_0x3953d6,_0x3656fb,_0x29e473){var _0x19e788={'count':0x0,'rows':[]};var _0x2fc071=sqlUtils[_0x5903('0x2')](_0x3953d6,_0x2e558f);if(_0x2fc071){return Promise['resolve'](_0x19e788);}var _0x33e585=sqlUtils[_0x5903('0x3')]();var _0x2920bf={};var _0x3e7121=![];var _0x36621c=![];return Promise[_0x5903('0x4')]()['then'](function(){if(_0x2e558f[_0x5903('0x5')]){return sqlUtils[_0x5903('0x6')](_0x2e558f[_0x5903('0x5')],_0x29e473);}else{return sqlUtils[_0x5903('0x7')](_0x2e558f,_0x29e473);}})[_0x5903('0x8')](function(_0x4fc54a){_0x33e585['where'](_0x4fc54a[_0x5903('0x9')]);_0x33e585[_0x5903('0xa')](_0x4fc54a['fields']);_0x33e585['where'](_0x4fc54a[_0x5903('0xb')]);_0x33e585[_0x5903('0xa')](_0x4fc54a[_0x5903('0xc')]['clause']);_0x2920bf=_0x4fc54a[_0x5903('0xd')];_0x36621c=_0x4fc54a['user'][_0x5903('0xe')];return sqlUtils[_0x5903('0xf')](_0x3953d6,_0x2e558f,_0x36621c);})['then'](function(_0x27fb0c){_0x33e585[_0x5903('0xa')](_0x27fb0c);var _0x1064c4=_0x2e558f['search']?_0x2920bf[_0x5903('0x10')]:_0x2e558f[_0x5903('0x11')];_0x3e7121=_0x1064c4?!![]:![];return sqlUtils['countFilteredContacts'](_0x33e585,_0x1064c4);})[_0x5903('0x8')](function(_0x54730c){_0x19e788['count']=_0x54730c;if(_0x19e788[_0x5903('0x12')]===0x0){return;}if(_0x2e558f['User']){_0x36621c=!![];}return sqlUtils[_0x5903('0x13')](_0x33e585,_0x2e558f[_0x5903('0x14')],_0x3656fb,_0x3e7121,_0x2920bf[_0x5903('0x15')],_0x36621c);})[_0x5903('0x8')](function(_0x4abbba){if(!_0x4abbba){return[];}return sqlUtils[_0x5903('0x16')](_0x4abbba,_0x2e558f,_0x3656fb);})[_0x5903('0x8')](function(_0x5664e3){_0x19e788['rows']=_0x5664e3;return _0x19e788;})[_0x5903('0x17')](function(_0x1206ea){throw _0x1206ea;});};exports['describe']=function(){var _0x314796={};var _0x5b67a2=[];return db[_0x5903('0x18')][_0x5903('0x19')]()[_0x5903('0x8')](function(_0x4da723){_0x314796=_0x4da723;var _0x558120=Object[_0x5903('0x1a')](_0x314796)[_0x5903('0xb')](function(_0x27b286){return _[_0x5903('0x1b')](_0x27b286,_0x5903('0x1c'))?_0x27b286:undefined;});var _0x561d65=_0x558120[_0x5903('0x1d')](function(_0x460ba8){return db[_0x5903('0x1e')][_0x5903('0x1f')]({'where':{'id':_0x460ba8[_0x5903('0x20')](0x3)},'raw':!![]});});return Promise['all'](_0x561d65);})[_0x5903('0x8')](function(_0x45165a){for(var _0x14964a=0x0;_0x14964a<_0x45165a[_0x5903('0x21')];_0x14964a++){if(_0x45165a[_0x14964a]){var _0x2eaa16=_0x5903('0x1c')+_0x45165a[_0x14964a]['id'];_0x314796[_0x2eaa16][_0x5903('0x22')]=_0x45165a[_0x14964a][_0x5903('0x23')];}}_0x5b67a2=_[_0x5903('0x1d')](Object[_0x5903('0x1a')](_0x314796),function(_0x587938){return{'name':_0x587938,'type':_0x314796[_0x587938][_0x5903('0x23')]};});return _0x5b67a2;})['catch'](function(_0x45a78e){throw _0x45a78e;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 799d10f..de1c794 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff30=['CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','fieldType','datetime','castTo','DATE','buildExpression','type','default','value','end','Tag','map','tags','clause','and','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','User','c.ListId\x20IN\x20?','resolve','then','tag','filter','search','role','getLists','attributes','group','limit','offset','subqry.id','having','order','DESC','subqry.','from','findAll','name','keyBy','Sequelize','SELECT','CmContact','sequelize','toString','TagIds','split','Tags','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','QueryTypes','query','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','ListId','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','lastName','fax','email','CompanyId','createdAt','updatedAt','deletedAt','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags'];(function(_0x16ee58,_0x165eb5){var _0x4985cf=function(_0x4806bb){while(--_0x4806bb){_0x16ee58['push'](_0x16ee58['shift']());}};_0x4985cf(++_0x165eb5);}(_0xff30,0x189));var _0x0ff3=function(_0x329e24,_0x35edf8){_0x329e24=_0x329e24-0x0;var _0xa2671b=_0xff30[_0x329e24];return _0xa2671b;};'use strict';var _=require('lodash');var squel=require(_0x0ff3('0x0'));var as=require(_0x0ff3('0x1'));var qs=require(_0x0ff3('0x2'));var utils=require(_0x0ff3('0x3'));var db=require(_0x0ff3('0x4'))['db'];function skipContactsQuery(_0x935648,_0x217e26){var _0x466152=![];if(_0x935648['role']===_0x0ff3('0x5')&&!_0x217e26['search']&&!_0x217e26[_0x0ff3('0x6')]&&_0x217e26[_0x0ff3('0x7')]!==_0x0ff3('0x8')){_0x466152=!![];}return _0x466152;}function getContactsSubquery(){return squel[_0x0ff3('0x9')]()['from'](_0x0ff3('0xa'),'c')[_0x0ff3('0xb')](_0x0ff3('0xc'));}function applyJoinClauses(_0x3a3db9,_0x11c397){var _0x4c0ae2=_0x11c397?'c':_0x0ff3('0xd');_0x3a3db9[_0x0ff3('0xe')](_0x0ff3('0xf'),'uc',_0x0ff3('0x10')+_0x4c0ae2+_0x0ff3('0x11'))[_0x0ff3('0xe')]('cm_contact_has_tags','ct',_0x0ff3('0x12')+_0x4c0ae2+_0x0ff3('0x11'))['left_join'](_0x0ff3('0x13'),'t',_0x0ff3('0x14'));return _0x3a3db9;}function addFieldsToQuery(_0x5895e5,_0x5c1aa4,_0x44ef08,_0x2423ee,_0x482c85){var _0x349ee6=_0x482c85?'c':_0x0ff3('0xd');if(!_0x5c1aa4){_0x5c1aa4=['id','firstName',_0x0ff3('0x15'),'phone','mobile',_0x0ff3('0x16'),_0x0ff3('0x17'),_0x0ff3('0x6'),_0x0ff3('0x18'),_0x0ff3('0x19'),_0x0ff3('0x1a'),_0x0ff3('0x1b'),'TagIds'];}else if(!_0x5c1aa4[_0x0ff3('0x1c')]('id')){_0x5c1aa4[_0x0ff3('0x1d')]('id');}var _0x2b1a35=_0x44ef08&&_0x482c85||!_0x44ef08&&!_0x482c85;if(_0x2423ee){_0x2b1a35=_0x2423ee&&_0x482c85||!_0x2423ee&&!_0x482c85;}_0x5c1aa4[_0x0ff3('0x1e')](function(_0x32281b){if(_0x32281b==='TagIds'){if(_0x2b1a35){_0x5895e5[_0x0ff3('0x1f')](_0x0ff3('0x20'),_0x32281b);}else if(_0x44ef08||_0x2423ee){_0x5895e5[_0x0ff3('0x1f')](_0x349ee6+'.'+_0x32281b);}}else{_0x5895e5[_0x0ff3('0x1f')](_0x349ee6+'.'+_0x32281b);}});return _0x5895e5;}function getSqlClauses(){var _0x3f6316={'default':squel[_0x0ff3('0x21')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0x0ff3('0x21')](),'ids':null},'user':{'clause':squel[_0x0ff3('0x21')](),'skip':![]}};return _0x3f6316;}function parseTagParameter(_0x50b8a0){var _0x4712a7=squel['expr']();if(_0x50b8a0){var _0x486816=utils[_0x0ff3('0x22')](_0x50b8a0);_0x486816[_0x0ff3('0x1e')](function(_0x38cad5){_0x4712a7['or'](_0x0ff3('0x23'),'%,'+_0x38cad5+',%');});}return _0x4712a7;}function parseSearchFilter(_0x362db7){var _0x4aade6=squel[_0x0ff3('0x21')]();if(_0x362db7){var _0x2b729b=_0x362db7['replace']('\x5c','\x5c\x5c')[_0x0ff3('0x24')](/'/g,'\x27\x27');var _0x1fc254=qs['escapeLIKESpecialChars'](_0x2b729b);if(_0x2b729b['split']('\x20')[_0x0ff3('0x25')]>0x1){_0x4aade6['or'](_0x0ff3('0x26'),qs['getFullTextValue'](_0x2b729b,!![]),null);}else{if(qs[_0x0ff3('0x27')](_0x2b729b)){_0x4aade6['or'](_0x0ff3('0x28'),_0x1fc254+'%');_0x4aade6['or'](_0x0ff3('0x29'),_0x1fc254+'%');_0x4aade6['or'](_0x0ff3('0x2a'),_0x1fc254+'%');_0x4aade6['or'](_0x0ff3('0x2b'),_0x1fc254+'%');}else if(qs['isEmail'](_0x2b729b)){_0x4aade6['or'](_0x0ff3('0x2c'),_0x1fc254+'%');}else{_0x4aade6['or']('c.firstName\x20LIKE\x20?','%'+_0x1fc254+'%');_0x4aade6['or']('c.lastName\x20LIKE\x20?','%'+_0x1fc254+'%');_0x4aade6['or'](_0x0ff3('0x2c'),'%'+_0x1fc254+'%');}}}return _0x4aade6;}function parseAdvancedSearchFilter(_0x371e38,_0x150fc9){var _0x54623c=getSqlClauses();var _0x5e1af7=as[_0x0ff3('0x2d')](_0x371e38);var _0x74514e=_0x5e1af7[_0x0ff3('0x2e')];for(var _0x250ed5=0x0;_0x250ed5<_0x5e1af7[_0x0ff3('0x2f')][_0x0ff3('0x25')];_0x250ed5++){var _0x4e99b7=_0x5e1af7[_0x0ff3('0x2f')][_0x250ed5];var _0x5588a6='c';var _0x40606f=_['find'](_0x150fc9,['name',_0x4e99b7[_0x0ff3('0x1f')]]);if(_0x40606f){if(_0x4e99b7[_0x0ff3('0x1f')]==='dateOfBirth'||_0x40606f[_0x0ff3('0x30')]===_0x0ff3('0x31')){_0x4e99b7[_0x0ff3('0x32')]=_0x0ff3('0x33');}var _0x43d771=as[_0x0ff3('0x34')](_0x5588a6,_0x40606f[_0x0ff3('0x35')],_0x4e99b7);_0x54623c[_0x0ff3('0x36')][_0x74514e](_0x43d771['text'],_0x43d771[_0x0ff3('0x37')]['start'],_0x43d771[_0x0ff3('0x37')][_0x0ff3('0x38')]);}else{if(_0x4e99b7[_0x0ff3('0x1f')]===_0x0ff3('0x39')){var _0x2014b3=_0x4e99b7[_0x0ff3('0x37')]['split'](',')[_0x0ff3('0x3a')](function(_0x4c1274){return Number(_0x4c1274);});var _0x325e10=parseTagParameter(_0x2014b3);_0x54623c[_0x0ff3('0x3b')][_0x0ff3('0x3c')][_0x0ff3('0x3d')](_0x325e10);_0x54623c['tags']['ids']=_0x2014b3;}else if(_0x4e99b7[_0x0ff3('0x1f')]==='User'){_0x54623c[_0x0ff3('0x3e')][_0x0ff3('0x3c')]['and'](_0x0ff3('0x3f'),_0x4e99b7['value']);_0x54623c['user'][_0x0ff3('0x40')]=!![];}}}return _0x54623c;}function parseModelFields(_0x3625af,_0x2def48){var _0x57db26=squel[_0x0ff3('0x21')]();var _0x27106f=_(_0x3625af)[_0x0ff3('0x41')]()['map'](function(_0x5c005c){return _[_0x0ff3('0x42')](_0x2def48,['name',_0x5c005c])?_0x5c005c:undefined;})[_0x0ff3('0x43')]()[_0x0ff3('0x37')]();if(_0x3625af[_0x0ff3('0x44')]){_0x27106f['push'](_0x0ff3('0x44'));}if(_0x3625af['User']){_0x27106f[_0x0ff3('0x1d')](_0x0ff3('0x45'));}if(_0x27106f['length']>0x0){_0x27106f[_0x0ff3('0x1e')](function(_0x420104){if(_0x420104===_0x0ff3('0x6')){_0x57db26[_0x0ff3('0x3d')](_0x0ff3('0x46'),[]['concat'](_0x3625af[_0x420104]));}else if(_0x420104===_0x0ff3('0x44')){var _0x316808='%'+_0x3625af[_0x420104]+'%';_0x57db26[_0x0ff3('0x3d')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x316808);}else if(_0x420104===_0x0ff3('0x45')){_0x57db26[_0x0ff3('0x3d')](_0x0ff3('0x3f'),_0x3625af[_0x420104]);}else{_0x57db26[_0x0ff3('0x3d')]('c.'+_0x420104+'\x20=\x20?',_0x3625af[_0x420104]);}});}return _0x57db26;}function parseQueryParameters(_0x592d7d,_0x453832){var _0xedd084=getSqlClauses();return Promise[_0x0ff3('0x47')]()[_0x0ff3('0x48')](function(){return parseModelFields(_0x592d7d,_0x453832);})['then'](function(_0x59b54d){_0xedd084['fields'][_0x0ff3('0x3d')](_0x59b54d);return parseTagParameter(_0x592d7d[_0x0ff3('0x49')]);})['then'](function(_0x4d5098){_0xedd084[_0x0ff3('0x3b')][_0x0ff3('0x3c')][_0x0ff3('0x3d')](_0x4d5098);return parseSearchFilter(_0x592d7d[_0x0ff3('0x4a')]);})[_0x0ff3('0x48')](function(_0x5b80a5){_0xedd084[_0x0ff3('0x4a')]=_0x5b80a5;return _0xedd084;});}function checkListsRestrictions(_0x1210e2,_0x3a3df8,_0x35d20a){var _0x132015=squel[_0x0ff3('0x21')]();return Promise[_0x0ff3('0x47')]()[_0x0ff3('0x48')](function(){if(_0x3a3df8[_0x0ff3('0x4b')]&&_0x1210e2[_0x0ff3('0x4c')]===_0x0ff3('0x5')&&!_0x35d20a){return _0x1210e2[_0x0ff3('0x4d')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x5830e6){if(_0x5830e6){if(_0x5830e6[_0x0ff3('0x25')]===0x0){_0x132015[_0x0ff3('0x3d')]('c.ListId\x20IS\x20NULL');}else{_0x132015[_0x0ff3('0x3d')](_0x0ff3('0x46'),_[_0x0ff3('0x3a')](_0x5830e6,'id'));}}})[_0x0ff3('0x48')](function(){return _0x132015;});}function buildContactsQuery(_0x3970e5,_0x58079f,_0x1aae11,_0x2164f2,_0x3ce86a,_0x60dcaf){if(_0x58079f){_0x58079f=_0x1aae11[_0x0ff3('0x4e')];}_0x3970e5=addFieldsToQuery(_0x3970e5,_0x58079f,_0x2164f2,_0x60dcaf,!![]);var _0x1671c7=squel['select']();_0x1671c7=addFieldsToQuery(_0x1671c7,_0x58079f,_0x2164f2,_0x60dcaf,![]);if(_0x2164f2||_0x60dcaf){_0x3970e5=applyJoinClauses(_0x3970e5,!![]);_0x3970e5[_0x0ff3('0x4f')]('c.id');if(_0x1aae11[_0x0ff3('0x50')]){_0x1671c7[_0x0ff3('0x50')](_0x1aae11[_0x0ff3('0x50')]);}if(_0x1aae11['offset']){_0x1671c7[_0x0ff3('0x51')](_0x1aae11[_0x0ff3('0x51')]);}}else{_0x1671c7=applyJoinClauses(_0x1671c7,![]);_0x1671c7[_0x0ff3('0x4f')](_0x0ff3('0x52'));if(_0x1aae11[_0x0ff3('0x50')]){_0x3970e5[_0x0ff3('0x50')](_0x1aae11[_0x0ff3('0x50')]);}if(_0x1aae11[_0x0ff3('0x51')]){_0x3970e5['offset'](_0x1aae11[_0x0ff3('0x51')]);}}_0x1671c7[_0x0ff3('0x53')](_0x3ce86a);if(_0x1aae11[_0x0ff3('0x54')]){_0x1aae11[_0x0ff3('0x54')][_0x0ff3('0x1e')](function(_0x32736c){_0x3970e5['order']('c.'+_0x32736c[0x0],_0x32736c[0x1]===_0x0ff3('0x55')?![]:!![]);_0x1671c7['order'](_0x0ff3('0x56')+_0x32736c[0x0],_0x32736c[0x1]===_0x0ff3('0x55')?![]:!![]);});}_0x1671c7[_0x0ff3('0x57')](_0x3970e5,'subqry');return _0x1671c7;}function getFilteredContacts(_0x52523e){var _0x416ae8=[];return db['Tag'][_0x0ff3('0x58')]({'attributes':['id',_0x0ff3('0x59'),'color'],'raw':!![]})['then'](function(_0x2e0982){_0x416ae8=_[_0x0ff3('0x5a')](_0x2e0982,'id');var _0x3aa264={'type':db[_0x0ff3('0x5b')]['QueryTypes'][_0x0ff3('0x5c')],'model':db[_0x0ff3('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x0ff3('0x5e')]['query'](_0x52523e[_0x0ff3('0x5f')](),_0x3aa264);})[_0x0ff3('0x48')](function(_0x1802f1){_0x1802f1[_0x0ff3('0x1e')](function(_0x13f7c9){if(_0x13f7c9[_0x0ff3('0x60')]){_0x13f7c9['Tags']=[];_0x13f7c9['TagIds'][_0x0ff3('0x61')](',')[_0x0ff3('0x1e')](function(_0xb45f54){_0x13f7c9[_0x0ff3('0x62')][_0x0ff3('0x1d')](_0x416ae8[_0xb45f54]);});}delete _0x13f7c9[_0x0ff3('0x60')];});return _0x1802f1;});}function countFilteredContacts(_0x1b4c14,_0x18999d){var _0x3db41f=_0x1b4c14[_0x0ff3('0x63')]();_0x3db41f[_0x0ff3('0x1f')](_0x0ff3('0x64'));_0x3db41f=applyJoinClauses(_0x3db41f,!![]);_0x1b4c14[_0x0ff3('0x4f')](_0x0ff3('0x65'));var _0x4c0741=utils[_0x0ff3('0x22')](_0x18999d);if(!_[_0x0ff3('0x66')](_0x4c0741)){_0x3db41f[_0x0ff3('0xb')](_0x0ff3('0x67'),_0x4c0741);}var _0x65f2ab={'type':db[_0x0ff3('0x5b')][_0x0ff3('0x68')][_0x0ff3('0x5c')],'raw':!![]};return db[_0x0ff3('0x5e')][_0x0ff3('0x69')](_0x3db41f[_0x0ff3('0x5f')](),_0x65f2ab)[_0x0ff3('0x48')](function(_0x4bffae){return _0x4bffae[0x0][_0x0ff3('0x64')];});}module[_0x0ff3('0x6a')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x2e8b=['length','find','name','fieldType','datetime','castTo','buildExpression','default','text','value','start','Tag','map','tags','ids','User','user','clause','and','uc.UserId\x20=\x20?','skip','keys','compact','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','filter','getLists','c.id','limit','offset','group','having','order','DESC','color','keyBy','Sequelize','CmContact','sequelize','Tags','TagIds','clone','isEmpty','t.id\x20IN\x20?','QueryTypes','SELECT','query','COUNT(*)','exports','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','t.id\x20=\x20ct.TagId','lastName','phone','fax','CompanyId','createdAt','updatedAt','deletedAt','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','split','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2e8b,0x1c9));var _0xb2e8=function(_0x47e61d,_0x32b15f){_0x47e61d=_0x47e61d-0x0;var _0x42bfd0=_0x2e8b[_0x47e61d];return _0x42bfd0;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0xb2e8('0x0'));var qs=require(_0xb2e8('0x1'));var utils=require(_0xb2e8('0x2'));var db=require(_0xb2e8('0x3'))['db'];function skipContactsQuery(_0x2113c2,_0x41c450){var _0x4c8114=![];if(_0x2113c2[_0xb2e8('0x4')]===_0xb2e8('0x5')&&!_0x41c450[_0xb2e8('0x6')]&&!_0x41c450[_0xb2e8('0x7')]&&_0x41c450[_0xb2e8('0x8')]!==_0xb2e8('0x9')){_0x4c8114=!![];}return _0x4c8114;}function getContactsSubquery(){return squel['select']()[_0xb2e8('0xa')](_0xb2e8('0xb'),'c')[_0xb2e8('0xc')](_0xb2e8('0xd'));}function applyJoinClauses(_0x550949,_0x54e665){var _0xa4b126=_0x54e665?'c':_0xb2e8('0xe');_0x550949[_0xb2e8('0xf')](_0xb2e8('0x10'),'uc',_0xb2e8('0x11')+_0xa4b126+'.id')[_0xb2e8('0xf')](_0xb2e8('0x12'),'ct',_0xb2e8('0x13')+_0xa4b126+_0xb2e8('0x14'))[_0xb2e8('0xf')]('tools_tags','t',_0xb2e8('0x15'));return _0x550949;}function addFieldsToQuery(_0x483636,_0x15fe28,_0xb5ba76,_0x22b82d,_0x218624){var _0x451620=_0x218624?'c':'subqry';if(!_0x15fe28){_0x15fe28=['id','firstName',_0xb2e8('0x16'),_0xb2e8('0x17'),'mobile',_0xb2e8('0x18'),'email',_0xb2e8('0x7'),_0xb2e8('0x19'),_0xb2e8('0x1a'),_0xb2e8('0x1b'),_0xb2e8('0x1c'),'TagIds'];}else if(!_0x15fe28['includes']('id')){_0x15fe28[_0xb2e8('0x1d')]('id');}var _0x4505ac=_0xb5ba76&&_0x218624||!_0xb5ba76&&!_0x218624;if(_0x22b82d){_0x4505ac=_0x22b82d&&_0x218624||!_0x22b82d&&!_0x218624;}_0x15fe28['forEach'](function(_0xd5e00){if(_0xd5e00==='TagIds'){if(_0x4505ac){_0x483636[_0xb2e8('0x1e')](_0xb2e8('0x1f'),_0xd5e00);}else if(_0xb5ba76||_0x22b82d){_0x483636['field'](_0x451620+'.'+_0xd5e00);}}else{_0x483636[_0xb2e8('0x1e')](_0x451620+'.'+_0xd5e00);}});return _0x483636;}function getSqlClauses(){var _0x309fc3={'default':squel[_0xb2e8('0x20')](),'fields':squel[_0xb2e8('0x20')](),'filter':squel[_0xb2e8('0x20')](),'tags':{'clause':squel[_0xb2e8('0x20')](),'ids':null},'user':{'clause':squel[_0xb2e8('0x20')](),'skip':![]}};return _0x309fc3;}function parseTagParameter(_0x449c1a){var _0x2042e7=squel[_0xb2e8('0x20')]();if(_0x449c1a){var _0x56dd30=utils[_0xb2e8('0x21')](_0x449c1a);_0x56dd30[_0xb2e8('0x22')](function(_0x77cc56){_0x2042e7['or'](_0xb2e8('0x23'),'%,'+_0x77cc56+',%');});}return _0x2042e7;}function parseSearchFilter(_0x32ce01){var _0x3e4a71=squel[_0xb2e8('0x20')]();if(_0x32ce01){var _0x49e30a=_0x32ce01['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x229043=qs['escapeLIKESpecialChars'](_0x49e30a);if(_0x49e30a[_0xb2e8('0x24')]('\x20')['length']>0x1){_0x3e4a71['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb2e8('0x25')](_0x49e30a,!![]),null);}else{if(qs[_0xb2e8('0x26')](_0x49e30a)){_0x3e4a71['or'](_0xb2e8('0x27'),_0x229043+'%');_0x3e4a71['or'](_0xb2e8('0x28'),_0x229043+'%');_0x3e4a71['or'](_0xb2e8('0x29'),_0x229043+'%');_0x3e4a71['or'](_0xb2e8('0x2a'),_0x229043+'%');}else if(qs[_0xb2e8('0x2b')](_0x49e30a)){_0x3e4a71['or'](_0xb2e8('0x2c'),_0x229043+'%');}else{_0x3e4a71['or']('c.firstName\x20LIKE\x20?','%'+_0x229043+'%');_0x3e4a71['or']('c.lastName\x20LIKE\x20?','%'+_0x229043+'%');_0x3e4a71['or'](_0xb2e8('0x2c'),'%'+_0x229043+'%');}}}return _0x3e4a71;}function parseAdvancedSearchFilter(_0x2185b6,_0x2194f0){var _0x3ec705=getSqlClauses();var _0x5b4f05=as[_0xb2e8('0x2d')](_0x2185b6);var _0x53ad6d=_0x5b4f05[_0xb2e8('0x2e')];for(var _0x470ee9=0x0;_0x470ee9<_0x5b4f05[_0xb2e8('0x2f')][_0xb2e8('0x30')];_0x470ee9++){var _0x151ca7=_0x5b4f05['conditions'][_0x470ee9];var _0x163cb3='c';var _0x3188da=_[_0xb2e8('0x31')](_0x2194f0,[_0xb2e8('0x32'),_0x151ca7[_0xb2e8('0x1e')]]);if(_0x3188da){if(_0x151ca7[_0xb2e8('0x1e')]==='dateOfBirth'||_0x3188da[_0xb2e8('0x33')]===_0xb2e8('0x34')){_0x151ca7[_0xb2e8('0x35')]='DATE';}var _0x1acd9d=as[_0xb2e8('0x36')](_0x163cb3,_0x3188da['type'],_0x151ca7);_0x3ec705[_0xb2e8('0x37')][_0x53ad6d](_0x1acd9d[_0xb2e8('0x38')],_0x1acd9d[_0xb2e8('0x39')][_0xb2e8('0x3a')],_0x1acd9d[_0xb2e8('0x39')]['end']);}else{if(_0x151ca7[_0xb2e8('0x1e')]===_0xb2e8('0x3b')){var _0xd9f9d8=_0x151ca7['value'][_0xb2e8('0x24')](',')[_0xb2e8('0x3c')](function(_0x53625b){return Number(_0x53625b);});var _0x310f3f=parseTagParameter(_0xd9f9d8);_0x3ec705[_0xb2e8('0x3d')]['clause']['and'](_0x310f3f);_0x3ec705[_0xb2e8('0x3d')][_0xb2e8('0x3e')]=_0xd9f9d8;}else if(_0x151ca7[_0xb2e8('0x1e')]===_0xb2e8('0x3f')){_0x3ec705[_0xb2e8('0x40')][_0xb2e8('0x41')][_0xb2e8('0x42')](_0xb2e8('0x43'),_0x151ca7[_0xb2e8('0x39')]);_0x3ec705['user'][_0xb2e8('0x44')]=!![];}}}return _0x3ec705;}function parseModelFields(_0x50453f,_0x31d9da){var _0x27f086=squel[_0xb2e8('0x20')]();var _0xd3712d=_(_0x50453f)[_0xb2e8('0x45')]()['map'](function(_0x42049f){return _['some'](_0x31d9da,[_0xb2e8('0x32'),_0x42049f])?_0x42049f:undefined;})[_0xb2e8('0x46')]()[_0xb2e8('0x39')]();if(_0x50453f[_0xb2e8('0x47')]){_0xd3712d[_0xb2e8('0x1d')](_0xb2e8('0x47'));}if(_0x50453f[_0xb2e8('0x3f')]){_0xd3712d[_0xb2e8('0x1d')](_0xb2e8('0x3f'));}if(_0xd3712d['length']>0x0){_0xd3712d[_0xb2e8('0x22')](function(_0x5daed6){if(_0x5daed6==='ListId'){_0x27f086[_0xb2e8('0x42')](_0xb2e8('0x48'),[]['concat'](_0x50453f[_0x5daed6]));}else if(_0x5daed6===_0xb2e8('0x47')){var _0x495b04='%'+_0x50453f[_0x5daed6]+'%';_0x27f086[_0xb2e8('0x42')](_0xb2e8('0x49'),_0x495b04);}else if(_0x5daed6==='User'){_0x27f086['and']('uc.UserId\x20=\x20?',_0x50453f[_0x5daed6]);}else{_0x27f086[_0xb2e8('0x42')]('c.'+_0x5daed6+_0xb2e8('0x4a'),_0x50453f[_0x5daed6]);}});}return _0x27f086;}function parseQueryParameters(_0x1b03ae,_0x22ab08){var _0x5521d9=getSqlClauses();return Promise[_0xb2e8('0x4b')]()[_0xb2e8('0x4c')](function(){return parseModelFields(_0x1b03ae,_0x22ab08);})['then'](function(_0x55d647){_0x5521d9['fields'][_0xb2e8('0x42')](_0x55d647);return parseTagParameter(_0x1b03ae['tag']);})[_0xb2e8('0x4c')](function(_0x5f2ce7){_0x5521d9['tags'][_0xb2e8('0x41')][_0xb2e8('0x42')](_0x5f2ce7);return parseSearchFilter(_0x1b03ae[_0xb2e8('0x4d')]);})[_0xb2e8('0x4c')](function(_0x29af94){_0x5521d9['filter']=_0x29af94;return _0x5521d9;});}function checkListsRestrictions(_0x586cac,_0x5a211f,_0x4a8b68){var _0x1dbb60=squel['expr']();return Promise[_0xb2e8('0x4b')]()[_0xb2e8('0x4c')](function(){if(_0x5a211f[_0xb2e8('0x6')]&&_0x586cac[_0xb2e8('0x4')]==='agent'&&!_0x4a8b68){return _0x586cac[_0xb2e8('0x4e')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4da2bd){if(_0x4da2bd){if(_0x4da2bd[_0xb2e8('0x30')]===0x0){_0x1dbb60[_0xb2e8('0x42')]('c.ListId\x20IS\x20NULL');}else{_0x1dbb60['and'](_0xb2e8('0x48'),_[_0xb2e8('0x3c')](_0x4da2bd,'id'));}}})[_0xb2e8('0x4c')](function(){return _0x1dbb60;});}function buildContactsQuery(_0x5988ab,_0x6818b7,_0x1f1c98,_0x24a8f5,_0x53cdb3,_0x1268e7){if(_0x6818b7){_0x6818b7=_0x1f1c98['attributes'];}_0x5988ab=addFieldsToQuery(_0x5988ab,_0x6818b7,_0x24a8f5,_0x1268e7,!![]);var _0x3e988b=squel['select']();_0x3e988b=addFieldsToQuery(_0x3e988b,_0x6818b7,_0x24a8f5,_0x1268e7,![]);if(_0x24a8f5||_0x1268e7){_0x5988ab=applyJoinClauses(_0x5988ab,!![]);_0x5988ab['group'](_0xb2e8('0x4f'));if(_0x1f1c98[_0xb2e8('0x50')]){_0x3e988b['limit'](_0x1f1c98[_0xb2e8('0x50')]);}if(_0x1f1c98[_0xb2e8('0x51')]){_0x3e988b[_0xb2e8('0x51')](_0x1f1c98[_0xb2e8('0x51')]);}}else{_0x3e988b=applyJoinClauses(_0x3e988b,![]);_0x3e988b[_0xb2e8('0x52')]('subqry.id');if(_0x1f1c98[_0xb2e8('0x50')]){_0x5988ab[_0xb2e8('0x50')](_0x1f1c98['limit']);}if(_0x1f1c98[_0xb2e8('0x51')]){_0x5988ab[_0xb2e8('0x51')](_0x1f1c98[_0xb2e8('0x51')]);}}_0x3e988b[_0xb2e8('0x53')](_0x53cdb3);if(_0x1f1c98['order']){_0x1f1c98[_0xb2e8('0x54')]['forEach'](function(_0x4d5c79){_0x5988ab[_0xb2e8('0x54')]('c.'+_0x4d5c79[0x0],_0x4d5c79[0x1]==='DESC'?![]:!![]);_0x3e988b[_0xb2e8('0x54')]('subqry.'+_0x4d5c79[0x0],_0x4d5c79[0x1]===_0xb2e8('0x55')?![]:!![]);});}_0x3e988b['from'](_0x5988ab,_0xb2e8('0xe'));return _0x3e988b;}function getFilteredContacts(_0x21a03c){var _0x375b9d=[];return db[_0xb2e8('0x3b')]['findAll']({'attributes':['id',_0xb2e8('0x32'),_0xb2e8('0x56')],'raw':!![]})[_0xb2e8('0x4c')](function(_0x23b5a3){_0x375b9d=_[_0xb2e8('0x57')](_0x23b5a3,'id');var _0x2c8305={'type':db[_0xb2e8('0x58')]['QueryTypes']['SELECT'],'model':db[_0xb2e8('0x59')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb2e8('0x5a')]['query'](_0x21a03c['toString'](),_0x2c8305);})[_0xb2e8('0x4c')](function(_0x4f16a4){_0x4f16a4['forEach'](function(_0x4eb540){if(_0x4eb540['TagIds']){_0x4eb540[_0xb2e8('0x5b')]=[];_0x4eb540[_0xb2e8('0x5c')][_0xb2e8('0x24')](',')[_0xb2e8('0x22')](function(_0x1c901e){_0x4eb540[_0xb2e8('0x5b')][_0xb2e8('0x1d')](_0x375b9d[_0x1c901e]);});}delete _0x4eb540['TagIds'];});return _0x4f16a4;});}function countFilteredContacts(_0x442266,_0x140eb0){var _0x427967=_0x442266[_0xb2e8('0x5d')]();_0x427967[_0xb2e8('0x1e')]('COUNT(*)');_0x427967=applyJoinClauses(_0x427967,!![]);_0x442266[_0xb2e8('0x52')](_0xb2e8('0x4f'));var _0x35cd39=utils[_0xb2e8('0x21')](_0x140eb0);if(!_[_0xb2e8('0x5e')](_0x35cd39)){_0x427967[_0xb2e8('0xc')](_0xb2e8('0x5f'),_0x35cd39);}var _0x155be0={'type':db[_0xb2e8('0x58')][_0xb2e8('0x60')][_0xb2e8('0x61')],'raw':!![]};return db[_0xb2e8('0x5a')][_0xb2e8('0x62')](_0x427967['toString'](),_0x155be0)[_0xb2e8('0x4c')](function(_0x4c9f90){return _0x4c9f90[0x0][_0xb2e8('0x63')];});}module[_0xb2e8('0x64')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index d357624..a5a6a4c 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 _0xba9e=['close','unlink','createDecipher','final','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','indexOf','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','end','write'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xba9e,0x13b));var _0xeba9=function(_0x57314c,_0x16941d){_0x57314c=_0x57314c-0x0;var _0x281e89=_0xba9e[_0x57314c];return _0x281e89;};'use strict';var crypto=require(_0xeba9('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xeba9('0x1'));var config=require(_0xeba9('0x2'));var logger=require(_0xeba9('0x3'))(_0xeba9('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xeba9('0x5')][_0xeba9('0x6')],'algorithm':_0xeba9('0x7')};const fileOptions={'algorithm':_0xeba9('0x8')};if(config[_0xeba9('0x9')]&&config[_0xeba9('0x9')][_0xeba9('0xa')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xeba9('0xa')]);if(isSupported){fileOptions[_0xeba9('0xa')]=config['encrypt'][_0xeba9('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xeba9('0xb')](',\x20');logger[_0xeba9('0xc')](config['encrypt'][_0xeba9('0xa')],_0xeba9('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x18e4e0){return AES_SUPPORTED_RX['test'](_0x18e4e0);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xeba9('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x5e75d2){return getSupportedCiphers()[_0xeba9('0xf')](_0x5e75d2)>-0x1;}function combineOptions(_0x3f37f3){var _0x198d6d={};for(var _0x2fd7c5 in fileOptions){if(fileOptions['hasOwnProperty'](_0x2fd7c5)){_0x198d6d[_0x2fd7c5]=fileOptions[_0x2fd7c5];}}if(_0x3f37f3){for(var _0x6e98f9 in _0x3f37f3){if(_0x3f37f3['hasOwnProperty'](_0x6e98f9)){_0x198d6d[_0x6e98f9]=_0x3f37f3[_0x6e98f9];}}}return _0x198d6d;}exports[_0xeba9('0x10')]=function(_0x3b50c8,_0x171b94,_0x2ed79f,_0x37edc4){return new BPromise(function(_0x2f8446,_0x3f8598){_0x37edc4=combineOptions(_0x37edc4);var _0x54503d=new Buffer(_0x2ed79f);var _0x13e6f6=fs[_0xeba9('0x11')](_0x3b50c8);var _0x573b2b=fs[_0xeba9('0x12')](_0x171b94);var _0x30babc=crypto[_0xeba9('0x13')](_0x37edc4['algorithm'],_0x54503d);_0x13e6f6['on'](_0xeba9('0x14'),function(_0x6c0c05){var _0x5f472d=new Buffer(_0x30babc[_0xeba9('0x15')](_0x6c0c05),_0xeba9('0x16'));_0x573b2b['write'](_0x5f472d);});_0x13e6f6['on'](_0xeba9('0x17'),function(){try{var _0x83b115=new Buffer(_0x30babc['final'](_0xeba9('0x16')),_0xeba9('0x16'));_0x573b2b[_0xeba9('0x18')](_0x83b115);_0x573b2b[_0xeba9('0x17')]();_0x573b2b['on'](_0xeba9('0x19'),function(){return _0x2f8446(_0x171b94);});}catch(_0x198114){fs[_0xeba9('0x1a')](_0x171b94);return _0x3f8598(_0x198114);}});});};exports['decryptFile']=function(_0x3a8a0a,_0x4ded60,_0x374d81,_0x2d38c6){return new BPromise(function(_0x31457e,_0x32a0c3){_0x2d38c6=combineOptions(_0x2d38c6);var _0x2b9546=new Buffer(_0x374d81);var _0x4c8305=fs[_0xeba9('0x11')](_0x3a8a0a);var _0x5787f0=fs[_0xeba9('0x12')](_0x4ded60);var _0x2a7186=crypto[_0xeba9('0x1b')](_0x2d38c6[_0xeba9('0xa')],_0x2b9546);_0x4c8305['on']('data',function(_0x256199){var _0x2400ce=new Buffer(_0x2a7186[_0xeba9('0x15')](_0x256199),'binary');_0x5787f0[_0xeba9('0x18')](_0x2400ce);});_0x4c8305['on'](_0xeba9('0x17'),function(){try{var _0x51f012=new Buffer(_0x2a7186[_0xeba9('0x1c')](_0xeba9('0x16')),_0xeba9('0x16'));_0x5787f0[_0xeba9('0x18')](_0x51f012);_0x5787f0['end']();_0x5787f0['on'](_0xeba9('0x19'),function(){return _0x31457e(_0x4ded60);});}catch(_0x5ebe52){fs[_0xeba9('0x1a')](_0x4ded60);return _0x32a0c3(_0x5ebe52);}});});};exports[_0xeba9('0x1d')]=function(_0x4de610,_0x51a37b,_0x42cd44){var _0x475174=_0x42cd44||stringOptions['algorithm'];var _0x3c04e5=_0x51a37b||stringOptions[_0xeba9('0x1e')];var _0x5277c8=crypto[_0xeba9('0x13')](_0x475174,_0x3c04e5);var _0xd132f5=_0x5277c8[_0xeba9('0x15')](_0x4de610,_0xeba9('0x1f'),_0xeba9('0x20'));_0xd132f5+=_0x5277c8[_0xeba9('0x1c')](_0xeba9('0x20'));return _0xd132f5;};exports[_0xeba9('0x21')]=function(_0x25c852,_0x4f3c4b,_0x35f3d4){var _0x5c8529=_0x35f3d4||stringOptions[_0xeba9('0xa')];var _0x5361e4=_0x4f3c4b||stringOptions['secret'];var _0x5092b9=crypto[_0xeba9('0x1b')](_0x5c8529,_0x5361e4);var _0xc1c5da=_0x5092b9['update'](_0x25c852,_0xeba9('0x20'),_0xeba9('0x1f'));_0xc1c5da+=_0x5092b9[_0xeba9('0x1c')]('utf8');return _0xc1c5da;}; \ No newline at end of file +var _0xc325=['aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','write','end','unlink','decryptFile','createWriteStream','createDecipher','final','close','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets'];(function(_0x22ee0f,_0x22e6d2){var _0x204696=function(_0x4cab38){while(--_0x4cab38){_0x22ee0f['push'](_0x22ee0f['shift']());}};_0x204696(++_0x22e6d2);}(_0xc325,0x112));var _0x5c32=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc325[_0x3bf83f];return _0x22c4a9;};'use strict';var crypto=require(_0x5c32('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x5c32('0x1'));var config=require(_0x5c32('0x2'));var logger=require(_0x5c32('0x3'))(_0x5c32('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5c32('0x5')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x5c32('0x6')};if(config[_0x5c32('0x7')]&&config[_0x5c32('0x7')][_0x5c32('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x5c32('0x8')]);if(isSupported){fileOptions[_0x5c32('0x8')]=config[_0x5c32('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5c32('0x9')](',\x20');logger['error'](config[_0x5c32('0x7')][_0x5c32('0x8')],_0x5c32('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x2761c3){return AES_SUPPORTED_RX[_0x5c32('0xb')](_0x2761c3);}function getSupportedCiphers(){return crypto[_0x5c32('0xc')]()[_0x5c32('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0xf20692){return getSupportedCiphers()[_0x5c32('0xe')](_0xf20692)>-0x1;}function combineOptions(_0x41be88){var _0x15d004={};for(var _0x2bba0d in fileOptions){if(fileOptions[_0x5c32('0xf')](_0x2bba0d)){_0x15d004[_0x2bba0d]=fileOptions[_0x2bba0d];}}if(_0x41be88){for(var _0x35e7b7 in _0x41be88){if(_0x41be88[_0x5c32('0xf')](_0x35e7b7)){_0x15d004[_0x35e7b7]=_0x41be88[_0x35e7b7];}}}return _0x15d004;}exports[_0x5c32('0x10')]=function(_0xf2af49,_0x59de10,_0x1dec58,_0x52110d){return new BPromise(function(_0x423b12,_0x2bbf4a){_0x52110d=combineOptions(_0x52110d);var _0x161924=new Buffer(_0x1dec58);var _0x32c9dd=fs[_0x5c32('0x11')](_0xf2af49);var _0x4043d9=fs['createWriteStream'](_0x59de10);var _0xc9562=crypto[_0x5c32('0x12')](_0x52110d[_0x5c32('0x8')],_0x161924);_0x32c9dd['on'](_0x5c32('0x13'),function(_0x5f2dcf){var _0x5c4606=new Buffer(_0xc9562[_0x5c32('0x14')](_0x5f2dcf),_0x5c32('0x15'));_0x4043d9[_0x5c32('0x16')](_0x5c4606);});_0x32c9dd['on'](_0x5c32('0x17'),function(){try{var _0x5db851=new Buffer(_0xc9562['final']('binary'),'binary');_0x4043d9['write'](_0x5db851);_0x4043d9[_0x5c32('0x17')]();_0x4043d9['on']('close',function(){return _0x423b12(_0x59de10);});}catch(_0x3477f7){fs[_0x5c32('0x18')](_0x59de10);return _0x2bbf4a(_0x3477f7);}});});};exports[_0x5c32('0x19')]=function(_0x37488e,_0x1f2676,_0x4da24e,_0x566c28){return new BPromise(function(_0x6d7124,_0x29dce0){_0x566c28=combineOptions(_0x566c28);var _0x5a0b3f=new Buffer(_0x4da24e);var _0x4722c8=fs[_0x5c32('0x11')](_0x37488e);var _0x3342e0=fs[_0x5c32('0x1a')](_0x1f2676);var _0xc899e1=crypto[_0x5c32('0x1b')](_0x566c28['algorithm'],_0x5a0b3f);_0x4722c8['on']('data',function(_0x4577f4){var _0x4e2f3a=new Buffer(_0xc899e1['update'](_0x4577f4),_0x5c32('0x15'));_0x3342e0['write'](_0x4e2f3a);});_0x4722c8['on']('end',function(){try{var _0x557365=new Buffer(_0xc899e1[_0x5c32('0x1c')](_0x5c32('0x15')),_0x5c32('0x15'));_0x3342e0[_0x5c32('0x16')](_0x557365);_0x3342e0['end']();_0x3342e0['on'](_0x5c32('0x1d'),function(){return _0x6d7124(_0x1f2676);});}catch(_0xa176bb){fs[_0x5c32('0x18')](_0x1f2676);return _0x29dce0(_0xa176bb);}});});};exports[_0x5c32('0x1e')]=function(_0x23f659,_0x446068,_0x11bb22){var _0xa9188d=_0x11bb22||stringOptions[_0x5c32('0x8')];var _0x34f9ff=_0x446068||stringOptions[_0x5c32('0x1f')];var _0xa9b86c=crypto[_0x5c32('0x12')](_0xa9188d,_0x34f9ff);var _0x3b6c81=_0xa9b86c[_0x5c32('0x14')](_0x23f659,_0x5c32('0x20'),_0x5c32('0x21'));_0x3b6c81+=_0xa9b86c[_0x5c32('0x1c')](_0x5c32('0x21'));return _0x3b6c81;};exports[_0x5c32('0x22')]=function(_0x307a1d,_0x654bd2,_0x28a59c){var _0x11f41f=_0x28a59c||stringOptions[_0x5c32('0x8')];var _0x23496d=_0x654bd2||stringOptions[_0x5c32('0x1f')];var _0x3ab11d=crypto['createDecipher'](_0x11f41f,_0x23496d);var _0x3c04d7=_0x3ab11d[_0x5c32('0x14')](_0x307a1d,'base64',_0x5c32('0x20'));_0x3c04d7+=_0x3ab11d[_0x5c32('0x1c')]('utf8');return _0x3c04d7;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 2c0795a..54fb54e 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 _0x5656=['%s%d.%s','csv','%s.%s','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','CSV','Setting','find','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','split','existsSync','join','each'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5656,0x95));var _0x6565=function(_0x104506,_0x1677de){_0x104506=_0x104506-0x0;var _0xe969fe=_0x5656[_0x104506];return _0xe969fe;};'use strict';var util=require(_0x6565('0x0'));var path=require('path');var _=require(_0x6565('0x1'));var csv=require(_0x6565('0x2'));var fs=require('fs');var BPromise=require(_0x6565('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x6565('0x4'));var db=require(_0x6565('0x5'))['db'];var dbH=require(_0x6565('0x5'))['dbH'];var logger=require(_0x6565('0x6'))(_0x6565('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6565('0x8')][0x3];var PATH=process[_0x6565('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2fbdd8,_0x401c0b){var _0x32904f={'status':_0x2fbdd8};var _0x1b9d2a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x401c0b){_0x32904f['savename']=_0x401c0b;}return db[_0x6565('0x9')][_0x6565('0xa')](_0x32904f,_0x1b9d2a);}function main(){var _0x138d15=0x1388;var _0x5e744b;logger[_0x6565('0xb')](util[_0x6565('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6565('0xd')));return db[_0x6565('0xe')][_0x6565('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})['then'](function(_0x1a2c98){if(_0x1a2c98){_0x5e744b=_0x1a2c98;_0x138d15=_0x5e744b['splitSizeCsv']||0x1388;}})[_0x6565('0x10')](function(){return dbH[_0x6565('0x11')][_0x6565('0x12')](util[_0x6565('0xc')](_0x6565('0x13'),QUERY),{'type':dbH[_0x6565('0x11')][_0x6565('0x14')][_0x6565('0x15')]});})['then'](function(_0x4a28f8){if(!_0x4a28f8[0x0][_0x6565('0x16')]){return analyticExtractedReport(_0x6565('0x17'));}var _0x53ddd2=[];var _0x13292d=0x0;if(_0x5e744b['split']){if(_0x4a28f8&&_0x4a28f8[_0x6565('0x18')]){var _0x3c0833=_['range'](_0x4a28f8[0x0][_0x6565('0x16')]/_0x138d15);var _0x2137d0=Number[_0x6565('0x19')](_0x4a28f8[0x0]['num']/_0x138d15)?_0x4a28f8[0x0][_0x6565('0x16')]%_0x138d15:0x0;_0x3c0833['forEach'](function(_0x2246e9){if(_0x2246e9>0x0){_0x13292d+=_0x138d15;}_0x53ddd2[_0x6565('0x1a')](dbH[_0x6565('0x11')][_0x6565('0x12')](util[_0x6565('0xc')](_0x6565('0x1b'),QUERY,_0x138d15,_0x13292d),{'type':dbH[_0x6565('0x11')][_0x6565('0x14')][_0x6565('0x15')]}));});if(_0x2137d0>0x0){_0x13292d+=_0x138d15;_0x53ddd2[_0x6565('0x1a')](dbH['sequelize'][_0x6565('0x12')](util[_0x6565('0xc')](_0x6565('0x1b'),QUERY,_0x2137d0,_0x13292d),{'type':dbH[_0x6565('0x11')][_0x6565('0x14')]['SELECT']}));}}}else{_0x53ddd2[_0x6565('0x1a')](dbH['sequelize'][_0x6565('0x12')](QUERY,{'type':dbH[_0x6565('0x11')][_0x6565('0x14')]['SELECT']}));}var _0x430891=path[_0x6565('0x1c')](PATH);var _0x1ce684=path[_0x6565('0x1d')](PATH,_0x6565('0x1e'));var _0x450ce4=_0x5e744b[_0x6565('0x1f')]&&_0x53ddd2['length']>0x1;var _0x6c3fd7=[];if(!fs[_0x6565('0x20')](path['join'](_0x430891,_0x1ce684))&&_0x450ce4){fs['mkdirSync'](path[_0x6565('0x21')](_0x430891,_0x1ce684));}return BPromise[_0x6565('0x22')](_0x53ddd2,function(_0x450ecf){_0x6c3fd7[_0x6565('0x1a')](_0x450ecf);})[_0x6565('0x10')](function(){for(var _0x1bc3be=0x0;_0x1bc3be<_0x6c3fd7[_0x6565('0x18')];_0x1bc3be+=0x1){var _0xe98e7c;var _0x2ae6e9=_0x6c3fd7[_0x1bc3be];if(_0x450ce4){_0xe98e7c=path[_0x6565('0x21')](_0x430891,_0x1ce684,util['format'](_0x6565('0x23'),_0x1ce684,_0x1bc3be,_0x6565('0x24')));}else{_0xe98e7c=path[_0x6565('0x21')](_0x430891,util['format'](_0x6565('0x25'),_0x1ce684,'csv'));}fs['writeFileSync'](_0xe98e7c,csv(_0x2ae6e9));}})[_0x6565('0x10')](function(){if(_0x450ce4){return new Promise(function(_0x4540b4){zipdir(path['join'](_0x430891,_0x1ce684),{'saveTo':path[_0x6565('0x21')](_0x430891,util['format'](_0x6565('0x25'),_0x1ce684,'zip'))},function(_0x260585,_0x51c364){rimraf(path['join'](_0x430891,_0x1ce684),function(){});_0x4540b4(_0x6565('0x26'));});});}})[_0x6565('0x10')](function(){logger['info'](util[_0x6565('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6565('0xd')));return analyticExtractedReport(_0x6565('0x27'),_0x450ce4?util[_0x6565('0xc')](_0x6565('0x25'),_0x1ce684,_0x450ce4?'zip':_0x6565('0x24')):null);});})[_0x6565('0x28')](function(_0x9b6dc1){logger[_0x6565('0xb')](util[_0x6565('0xc')](_0x6565('0x29'),EXTRACTED_REPORT_ID,'CSV'),util[_0x6565('0x2a')](_0x9b6dc1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6565('0x2b'));})[_0x6565('0x2c')](function(){process[_0x6565('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3bd2=['format','QueryTypes','num','length','range','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','join','mkdirSync','then','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','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','exit','util','lodash','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','sequelize','query'];(function(_0x7a41db,_0x86c0c5){var _0x11921f=function(_0x36aeaf){while(--_0x36aeaf){_0x7a41db['push'](_0x7a41db['shift']());}};_0x11921f(++_0x86c0c5);}(_0x3bd2,0x1bc));var _0x23bd=function(_0x1807a9,_0x2138c7){_0x1807a9=_0x1807a9-0x0;var _0x1d5c45=_0x3bd2[_0x1807a9];return _0x1d5c45;};'use strict';var util=require(_0x23bd('0x0'));var path=require('path');var _=require(_0x23bd('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x23bd('0x2'));var rimraf=require(_0x23bd('0x3'));var db=require(_0x23bd('0x4'))['db'];var dbH=require('../../mysqldb')[_0x23bd('0x5')];var logger=require(_0x23bd('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x23bd('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x23bd('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x45c7e5,_0x1765c0){var _0x578aab={'status':_0x45c7e5};var _0x2ba941={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1765c0){_0x578aab[_0x23bd('0x8')]=_0x1765c0;}return db['AnalyticExtractedReport']['update'](_0x578aab,_0x2ba941);}function main(){var _0x14abd2=0x1388;var _0x7d34f4;logger[_0x23bd('0x9')](util['format'](_0x23bd('0xa'),EXTRACTED_REPORT_ID,_0x23bd('0xb')));return db[_0x23bd('0xc')][_0x23bd('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x23bd('0xe'),_0x23bd('0xf')]})['then'](function(_0x43a673){if(_0x43a673){_0x7d34f4=_0x43a673;_0x14abd2=_0x7d34f4[_0x23bd('0xf')]||0x1388;}})['then'](function(){return dbH[_0x23bd('0x10')][_0x23bd('0x11')](util[_0x23bd('0x12')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x23bd('0x10')][_0x23bd('0x13')]['SELECT']});})['then'](function(_0x22cb78){if(!_0x22cb78[0x0][_0x23bd('0x14')]){return analyticExtractedReport('Empty');}var _0xbbf6d0=[];var _0x382bba=0x0;if(_0x7d34f4[_0x23bd('0xe')]){if(_0x22cb78&&_0x22cb78[_0x23bd('0x15')]){var _0x5508e6=_[_0x23bd('0x16')](_0x22cb78[0x0][_0x23bd('0x14')]/_0x14abd2);var _0x3db47f=Number['isInteger'](_0x22cb78[0x0]['num']/_0x14abd2)?_0x22cb78[0x0]['num']%_0x14abd2:0x0;_0x5508e6['forEach'](function(_0x192ad9){if(_0x192ad9>0x0){_0x382bba+=_0x14abd2;}_0xbbf6d0[_0x23bd('0x17')](dbH['sequelize'][_0x23bd('0x11')](util[_0x23bd('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14abd2,_0x382bba),{'type':dbH[_0x23bd('0x10')]['QueryTypes'][_0x23bd('0x18')]}));});if(_0x3db47f>0x0){_0x382bba+=_0x14abd2;_0xbbf6d0[_0x23bd('0x17')](dbH[_0x23bd('0x10')]['query'](util[_0x23bd('0x12')](_0x23bd('0x19'),QUERY,_0x3db47f,_0x382bba),{'type':dbH[_0x23bd('0x10')]['QueryTypes'][_0x23bd('0x18')]}));}}}else{_0xbbf6d0[_0x23bd('0x17')](dbH[_0x23bd('0x10')][_0x23bd('0x11')](QUERY,{'type':dbH[_0x23bd('0x10')]['QueryTypes']['SELECT']}));}var _0x343dbd=path[_0x23bd('0x1a')](PATH);var _0x400160=path['basename'](PATH,'.csv');var _0x119172=_0x7d34f4[_0x23bd('0xe')]&&_0xbbf6d0[_0x23bd('0x15')]>0x1;var _0x51f4b7=[];if(!fs['existsSync'](path[_0x23bd('0x1b')](_0x343dbd,_0x400160))&&_0x119172){fs[_0x23bd('0x1c')](path[_0x23bd('0x1b')](_0x343dbd,_0x400160));}return BPromise['each'](_0xbbf6d0,function(_0xcd05a6){_0x51f4b7[_0x23bd('0x17')](_0xcd05a6);})[_0x23bd('0x1d')](function(){for(var _0x162687=0x0;_0x162687<_0x51f4b7[_0x23bd('0x15')];_0x162687+=0x1){var _0x1c77e3;var _0x1aa05e=_0x51f4b7[_0x162687];if(_0x119172){_0x1c77e3=path['join'](_0x343dbd,_0x400160,util[_0x23bd('0x12')](_0x23bd('0x1e'),_0x400160,_0x162687,'csv'));}else{_0x1c77e3=path[_0x23bd('0x1b')](_0x343dbd,util[_0x23bd('0x12')](_0x23bd('0x1f'),_0x400160,_0x23bd('0x20')));}fs[_0x23bd('0x21')](_0x1c77e3,csv(_0x1aa05e));}})['then'](function(){if(_0x119172){return new Promise(function(_0x2e4fe4){zipdir(path[_0x23bd('0x1b')](_0x343dbd,_0x400160),{'saveTo':path[_0x23bd('0x1b')](_0x343dbd,util[_0x23bd('0x12')]('%s.%s',_0x400160,_0x23bd('0x22')))},function(_0x283e78,_0x31b404){rimraf(path[_0x23bd('0x1b')](_0x343dbd,_0x400160),function(){});_0x2e4fe4(_0x23bd('0x23'));});});}})[_0x23bd('0x1d')](function(){logger['info'](util[_0x23bd('0x12')](_0x23bd('0x24'),EXTRACTED_REPORT_ID,_0x23bd('0xb')));return analyticExtractedReport(_0x23bd('0x25'),_0x119172?util[_0x23bd('0x12')](_0x23bd('0x1f'),_0x400160,_0x119172?'zip':'csv'):null);});})[_0x23bd('0x26')](function(_0x30b707){logger['info'](util[_0x23bd('0x12')](_0x23bd('0x27'),EXTRACTED_REPORT_ID,_0x23bd('0xb')),util[_0x23bd('0x28')](_0x30b707,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x23bd('0x29')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 813acf1..7b17265 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 _0x6bd6=['range','isInteger','query','QueryTypes','SELECT','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','createWriteStream','finish','error','createPdfFromHTML','createPdfKitDocument','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','length','auto','body','concat','chunk','keys','forEach','push','format','name','startDate','header','margin','landscape','footer','Arial','black','right','num','Setting','find','split','splitSizePdf','then'];(function(_0x35c482,_0x2d12a5){var _0x22516e=function(_0xfd33b6){while(--_0xfd33b6){_0x35c482['push'](_0x35c482['shift']());}};_0x22516e(++_0x2d12a5);}(_0x6bd6,0x1d8));var _0x66bd=function(_0xf58288,_0x35333c){_0xf58288=_0xf58288-0x0;var _0x196e87=_0x6bd6[_0xf58288];return _0x196e87;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x66bd('0x0'));var moment=require(_0x66bd('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x66bd('0x2'));var zipdir=require(_0x66bd('0x3'));var rimraf=require(_0x66bd('0x4'));var JSDOM=require(_0x66bd('0x5'))[_0x66bd('0x6')];var window=new JSDOM('')[_0x66bd('0x7')];var BPromise=require(_0x66bd('0x8'));var db=require(_0x66bd('0x9'))['db'];var dbH=require(_0x66bd('0x9'))[_0x66bd('0xa')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x66bd('0xb')][0x2]);var QUERY=process[_0x66bd('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x66bd('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4180f7,_0x13f5a8){var _0x9edac6={'status':_0x4180f7};var _0x564790={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x13f5a8){_0x9edac6[_0x66bd('0xd')]=_0x13f5a8;}return db[_0x66bd('0xe')][_0x66bd('0xf')](_0x9edac6,_0x564790);}function getHeaders(_0x4d380c){return _[_0x66bd('0x10')](_0x4d380c,function(_0x1180b4){return{'text':_0x1180b4,'style':_0x66bd('0x11')};});}function getRows(_0x1fd66b,_0x41f99e){return _['map'](_0x41f99e,function(_0x339a1f){return _(_0x339a1f)['pick'](_0x1fd66b)[_0x66bd('0x10')](function(_0x2c0d87){return _0x2c0d87?_[_0x66bd('0x12')](_0x2c0d87):'';})[_0x66bd('0x13')]();});}function createTable(_0xbb398c,_0x393005){var _0x539b3f={'widths':_['fill'](Array(_0xbb398c[_0x66bd('0x14')]),0x91),'heights':function(_0xcf17e1){return _0xcf17e1===0x0?_0x66bd('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x11df50=getHeaders(_0xbb398c);_0x539b3f[_0x66bd('0x16')]['push'](_0x11df50);var _0x15af2b=getRows(_0xbb398c,_0x393005);_0x539b3f[_0x66bd('0x16')]=_0x539b3f['body'][_0x66bd('0x17')](_0x15af2b);return _0x539b3f;}function createTables(_0x12ea28){var _0x4957fb=[];var _0xce9502=_[_0x66bd('0x18')](Object[_0x66bd('0x19')](_0x12ea28[0x0]),0x5);_0xce9502[_0x66bd('0x1a')](function(_0x145e5f){_0x4957fb[_0x66bd('0x1b')](createTable(_0x145e5f,_0x12ea28));});return _0x4957fb;}function getPDFDocDefinition(_0x1a6fee){var _0x1d17f7=util[_0x66bd('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x66bd('0x1d')],moment(EXTRACTED_REPORT[_0x66bd('0x1e')])[_0x66bd('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x66bd('0x1c')](FORMAT));var _0x449150=[];for(var _0x58a825=0x0;_0x58a825<_0x1a6fee[_0x66bd('0x14')];_0x58a825++){var _0x5e80fb=[];if(_0x58a825===0x0){_0x5e80fb[_0x66bd('0x1b')]({'text':_0x1d17f7,'style':_0x66bd('0x1f')});}var _0x36c4d2={'table':_0x1a6fee[_0x58a825]};if(_0x58a825>0x0){_0x36c4d2['pageBreak']='before';_0x36c4d2[_0x66bd('0x20')]=[0x0,0x46,0x0,0x0];}_0x5e80fb['push'](_0x36c4d2);_0x449150[_0x66bd('0x1b')](_0x5e80fb);}return{'pageSize':'A4','pageOrientation':_0x66bd('0x21'),'content':_0x449150,'footer':function(_0x57f74e,_0x43795d){return{'text':_0x57f74e['toString']()+'\x20/\x20'+_0x43795d,'style':_0x66bd('0x22')};},'defaultStyle':{'font':_0x66bd('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x66bd('0x24')},'footer':{'alignment':_0x66bd('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3e5a39){var _0x568da6=0x1388;var _0x16f4a0;if(!_0x3e5a39[0x0][_0x66bd('0x26')]){return analyticExtractedReport('Empty');}return db[_0x66bd('0x27')][_0x66bd('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x66bd('0x29'),_0x66bd('0x2a')]})[_0x66bd('0x2b')](function(_0x3c8304){if(_0x3c8304){_0x16f4a0=_0x3c8304;_0x568da6=_0x16f4a0['splitSizePdf']||0x3e8;}})['then'](function(){var _0xcfdc36=[];var _0x2d58d3=0x0;if(_0x16f4a0[_0x66bd('0x29')]){if(_0x3e5a39&&_0x3e5a39[_0x66bd('0x14')]){var _0x256fba=_[_0x66bd('0x2c')](_0x3e5a39[0x0][_0x66bd('0x26')]/_0x568da6);var _0x4c2422=Number[_0x66bd('0x2d')](_0x3e5a39[0x0][_0x66bd('0x26')]/_0x568da6)?_0x3e5a39[0x0][_0x66bd('0x26')]%_0x568da6:0x0;_0x256fba[_0x66bd('0x1a')](function(_0x3888e4){if(_0x3888e4>0x0){_0x2d58d3+=_0x568da6;}_0xcfdc36[_0x66bd('0x1b')](dbH['sequelize'][_0x66bd('0x2e')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x568da6,_0x2d58d3),{'type':dbH['sequelize'][_0x66bd('0x2f')][_0x66bd('0x30')]}));});if(_0x4c2422>0x0){_0x2d58d3+=_0x568da6;_0xcfdc36[_0x66bd('0x1b')](dbH[_0x66bd('0x31')][_0x66bd('0x2e')](util['format'](_0x66bd('0x32'),QUERY,_0x4c2422,_0x2d58d3),{'type':dbH['sequelize'][_0x66bd('0x2f')][_0x66bd('0x30')]}));}}}else{_0xcfdc36[_0x66bd('0x1b')](dbH[_0x66bd('0x31')][_0x66bd('0x2e')](QUERY,{'type':dbH[_0x66bd('0x31')][_0x66bd('0x2f')][_0x66bd('0x30')]}));}var _0x241faf=path[_0x66bd('0x33')](PATH);var _0x1dc931=path[_0x66bd('0x34')](PATH,_0x66bd('0x35'));var _0x31a7fd=_0x16f4a0[_0x66bd('0x29')]&&_0xcfdc36['length']>0x1;var _0x50a21d=[];if(!fs[_0x66bd('0x36')](path[_0x66bd('0x37')](_0x241faf,_0x1dc931))&&_0x31a7fd){fs[_0x66bd('0x38')](path[_0x66bd('0x37')](_0x241faf,_0x1dc931));}return BPromise['each'](_0xcfdc36,function(_0x19aa20){_0x50a21d[_0x66bd('0x1b')](_0x19aa20);})[_0x66bd('0x2b')](function(){var _0x29936c=[];for(var _0x382359=0x0;_0x382359<_0x50a21d['length'];_0x382359+=0x1){var _0x5ba027=_0x50a21d[_0x382359];var _0x38b64d=createTables(_[_0x66bd('0x39')](_0x5ba027));var _0x2df233;var _0x10e806=getPDFDocDefinition(_0x38b64d);var _0x2a0b81=getPDFPrinter();var _0x5c988f=_0x2a0b81['createPdfKitDocument'](_0x10e806);if(_0x31a7fd){_0x2df233=path[_0x66bd('0x37')](_0x241faf,_0x1dc931,util[_0x66bd('0x1c')](_0x66bd('0x3a'),_0x1dc931,_0x382359,_0x66bd('0x3b')));}else{_0x2df233=path['join'](_0x241faf,util[_0x66bd('0x1c')](_0x66bd('0x3c'),_0x1dc931,'pdf'));}_0x29936c[_0x66bd('0x1b')](writePDFDocument(_0x5c988f,_0x2df233));}return Promise[_0x66bd('0x3d')](_0x29936c);})[_0x66bd('0x2b')](function(){if(_0x31a7fd){return new Promise(function(_0x199dc4){zipdir(path[_0x66bd('0x37')](_0x241faf,_0x1dc931),{'saveTo':path[_0x66bd('0x37')](_0x241faf,util[_0x66bd('0x1c')](_0x66bd('0x3c'),_0x1dc931,'zip'))},function(){rimraf(path[_0x66bd('0x37')](_0x241faf,_0x1dc931),function(){});_0x199dc4(_0x66bd('0x3e'));});});}})[_0x66bd('0x2b')](function(){if(!_0x31a7fd)return;rimraf(path[_0x66bd('0x37')](_0x241faf,_0x1dc931),function(){});})[_0x66bd('0x2b')](function(){logger[_0x66bd('0x3f')](util[_0x66bd('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x66bd('0x40')));return analyticExtractedReport(_0x66bd('0x41'),_0x31a7fd?util[_0x66bd('0x1c')](_0x66bd('0x3c'),_0x1dc931,_0x31a7fd?_0x66bd('0x42'):_0x66bd('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x66bd('0x3f')](util[_0x66bd('0x1c')](_0x66bd('0x43'),EXTRACTED_REPORT_ID,_0x66bd('0x40')));return db[_0x66bd('0xe')][_0x66bd('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x66bd('0x2b')](function(_0x1f69b7){EXTRACTED_REPORT=_0x1f69b7;return dbH['sequelize'][_0x66bd('0x2e')](util['format'](_0x66bd('0x45'),QUERY),{'type':dbH[_0x66bd('0x31')][_0x66bd('0x2f')][_0x66bd('0x30')]});})[_0x66bd('0x2b')](extractReport)['catch'](function(_0x377949){logger[_0x66bd('0x3f')](util[_0x66bd('0x1c')](_0x66bd('0x46'),EXTRACTED_REPORT_ID,'PDF'),util[_0x66bd('0x47')](_0x377949,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x66bd('0x48'));})[_0x66bd('0x49')](function(){process[_0x66bd('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x63e42f=new PdfPrinter({'Arial':{'normal':__dirname+_0x66bd('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x66bd('0x4c')}});return _0x63e42f;}function getPDFDocDefinitionFromHTML(_0x7b62d6,_0xf769fb){var _0x3a0f76=util['format']('%s\x20#%d',_0xf769fb['channel'],_0xf769fb[_0x66bd('0x4d')]);var _0x41e767=moment()[_0x66bd('0x1c')](_0x66bd('0x4e'))[_0x66bd('0x12')]();var _0x59e01a=htmlToPdfmake(_0x7b62d6,{'window':window,'tableAutoSize':!![]});return{'content':[_0x59e01a],'defaultStyle':{'font':_0x66bd('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x66bd('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x66bd('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x66bd('0x4f')}},'header':function(){return[{'text':_0x66bd('0x50'),'style':_0x66bd('0x1f')}];},'footer':function(_0x5b7a2a,_0x2a2aa5){return[{'text':util[_0x66bd('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x3a0f76,_0x5b7a2a,_0x2a2aa5,_0x41e767),'style':_0x66bd('0x22')}];}};}function writePDFDocument(_0x3365db,_0xd60106){return new Promise(function(_0x15bafd,_0x344cc4){var _0x11b637=_0x3365db['pipe'](fs[_0x66bd('0x51')](_0xd60106));_0x11b637['on'](_0x66bd('0x52'),function(){_0x15bafd(_0x66bd('0x52'));});_0x11b637['on'](_0x66bd('0x53'),function(_0x4091f8){_0x344cc4(_0x4091f8);});_0x3365db['end']();});}exports[_0x66bd('0x54')]=function(_0x429486,_0x531c06){var _0x1e4e10=getPDFPrinter();var _0x4254d0=getPDFDocDefinitionFromHTML(_0x429486,_0x531c06);var _0x4bf6c9=_0x1e4e10[_0x66bd('0x55')](_0x4254d0);return writePDFDocument(_0x4bf6c9,_0x531c06['path'])['catch'](function(_0x372b63){throw _0x372b63;});}; \ No newline at end of file +var _0xadde=['map','pick','toString','value','fill','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','length','pageBreak','before','margin','\x20/\x20','Arial','num','Empty','Setting','split','splitSizePdf','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename'];(function(_0x490ef6,_0x2574b4){var _0x1640a7=function(_0x5f09d7){while(--_0x5f09d7){_0x490ef6['push'](_0x490ef6['shift']());}};_0x1640a7(++_0x2574b4);}(_0xadde,0x1ae));var _0xeadd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xadde[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xeadd('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xeadd('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0xeadd('0x2'));var PdfPrinter=require(_0xeadd('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xeadd('0x4'));var JSDOM=require(_0xeadd('0x5'))[_0xeadd('0x6')];var window=new JSDOM('')[_0xeadd('0x7')];var BPromise=require(_0xeadd('0x8'));var db=require(_0xeadd('0x9'))['db'];var dbH=require('../../mysqldb')[_0xeadd('0xa')];var logger=require('../../config/logger')(_0xeadd('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xeadd('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xeadd('0xc')][0x5];var FORMAT=_0xeadd('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x508703,_0x3e4387){var _0x3a8cf4={'status':_0x508703};var _0x4a14e1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e4387){_0x3a8cf4[_0xeadd('0xe')]=_0x3e4387;}return db['AnalyticExtractedReport']['update'](_0x3a8cf4,_0x4a14e1);}function getHeaders(_0x2ccec2){return _[_0xeadd('0xf')](_0x2ccec2,function(_0x2efc11){return{'text':_0x2efc11,'style':'tableHeader'};});}function getRows(_0x3f2e34,_0x9abbd7){return _[_0xeadd('0xf')](_0x9abbd7,function(_0x213232){return _(_0x213232)[_0xeadd('0x10')](_0x3f2e34)['map'](function(_0x1c191f){return _0x1c191f?_[_0xeadd('0x11')](_0x1c191f):'';})[_0xeadd('0x12')]();});}function createTable(_0x442c53,_0x16f66c){var _0x24bb8b={'widths':_[_0xeadd('0x13')](Array(_0x442c53['length']),0x91),'heights':function(_0x14a489){return _0x14a489===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1693e8=getHeaders(_0x442c53);_0x24bb8b[_0xeadd('0x14')][_0xeadd('0x15')](_0x1693e8);var _0x7df301=getRows(_0x442c53,_0x16f66c);_0x24bb8b['body']=_0x24bb8b[_0xeadd('0x14')]['concat'](_0x7df301);return _0x24bb8b;}function createTables(_0x1772d1){var _0x4c1bf8=[];var _0x1d2307=_[_0xeadd('0x16')](Object[_0xeadd('0x17')](_0x1772d1[0x0]),0x5);_0x1d2307[_0xeadd('0x18')](function(_0x1d3674){_0x4c1bf8[_0xeadd('0x15')](createTable(_0x1d3674,_0x1772d1));});return _0x4c1bf8;}function getPDFDocDefinition(_0xa5028e){var _0x11b7ae=util[_0xeadd('0x19')](_0xeadd('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xeadd('0x1b')])[_0xeadd('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0xeadd('0x1c')])['format'](FORMAT));var _0xb2b61e=[];for(var _0x1f363e=0x0;_0x1f363e<_0xa5028e[_0xeadd('0x1d')];_0x1f363e++){var _0x416a9b=[];if(_0x1f363e===0x0){_0x416a9b[_0xeadd('0x15')]({'text':_0x11b7ae,'style':'header'});}var _0x500fba={'table':_0xa5028e[_0x1f363e]};if(_0x1f363e>0x0){_0x500fba[_0xeadd('0x1e')]=_0xeadd('0x1f');_0x500fba[_0xeadd('0x20')]=[0x0,0x46,0x0,0x0];}_0x416a9b[_0xeadd('0x15')](_0x500fba);_0xb2b61e[_0xeadd('0x15')](_0x416a9b);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0xb2b61e,'footer':function(_0x682b38,_0x5da409){return{'text':_0x682b38[_0xeadd('0x11')]()+_0xeadd('0x21')+_0x5da409,'style':'footer'};},'defaultStyle':{'font':_0xeadd('0x22')},'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(_0x4122e7){var _0xd6b3b2=0x1388;var _0x4f25f1;if(!_0x4122e7[0x0][_0xeadd('0x23')]){return analyticExtractedReport(_0xeadd('0x24'));}return db[_0xeadd('0x25')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xeadd('0x26'),_0xeadd('0x27')]})['then'](function(_0x5637e0){if(_0x5637e0){_0x4f25f1=_0x5637e0;_0xd6b3b2=_0x4f25f1['splitSizePdf']||0x3e8;}})[_0xeadd('0x28')](function(){var _0x55b33b=[];var _0x294207=0x0;if(_0x4f25f1[_0xeadd('0x26')]){if(_0x4122e7&&_0x4122e7[_0xeadd('0x1d')]){var _0x502b9f=_['range'](_0x4122e7[0x0][_0xeadd('0x23')]/_0xd6b3b2);var _0x88673=Number[_0xeadd('0x29')](_0x4122e7[0x0][_0xeadd('0x23')]/_0xd6b3b2)?_0x4122e7[0x0][_0xeadd('0x23')]%_0xd6b3b2:0x0;_0x502b9f[_0xeadd('0x18')](function(_0x93891c){if(_0x93891c>0x0){_0x294207+=_0xd6b3b2;}_0x55b33b[_0xeadd('0x15')](dbH[_0xeadd('0x2a')][_0xeadd('0x2b')](util[_0xeadd('0x19')](_0xeadd('0x2c'),QUERY,_0xd6b3b2,_0x294207),{'type':dbH[_0xeadd('0x2a')][_0xeadd('0x2d')]['SELECT']}));});if(_0x88673>0x0){_0x294207+=_0xd6b3b2;_0x55b33b[_0xeadd('0x15')](dbH['sequelize']['query'](util[_0xeadd('0x19')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x88673,_0x294207),{'type':dbH[_0xeadd('0x2a')][_0xeadd('0x2d')][_0xeadd('0x2e')]}));}}}else{_0x55b33b[_0xeadd('0x15')](dbH[_0xeadd('0x2a')]['query'](QUERY,{'type':dbH[_0xeadd('0x2a')][_0xeadd('0x2d')][_0xeadd('0x2e')]}));}var _0x33400d=path[_0xeadd('0x2f')](PATH);var _0x161d52=path[_0xeadd('0x30')](PATH,'.pdf');var _0x4b95ad=_0x4f25f1[_0xeadd('0x26')]&&_0x55b33b[_0xeadd('0x1d')]>0x1;var _0x43a412=[];if(!fs[_0xeadd('0x31')](path[_0xeadd('0x32')](_0x33400d,_0x161d52))&&_0x4b95ad){fs['mkdirSync'](path[_0xeadd('0x32')](_0x33400d,_0x161d52));}return BPromise[_0xeadd('0x33')](_0x55b33b,function(_0xb11e3a){_0x43a412['push'](_0xb11e3a);})[_0xeadd('0x28')](function(){var _0x3204c5=[];for(var _0x50a254=0x0;_0x50a254<_0x43a412[_0xeadd('0x1d')];_0x50a254+=0x1){var _0x4bbc63=_0x43a412[_0x50a254];var _0x3c026d=createTables(_[_0xeadd('0x34')](_0x4bbc63));var _0x4344e4;var _0x1c1fe8=getPDFDocDefinition(_0x3c026d);var _0x42ee7a=getPDFPrinter();var _0x4795ca=_0x42ee7a[_0xeadd('0x35')](_0x1c1fe8);if(_0x4b95ad){_0x4344e4=path[_0xeadd('0x32')](_0x33400d,_0x161d52,util[_0xeadd('0x19')](_0xeadd('0x36'),_0x161d52,_0x50a254,_0xeadd('0x37')));}else{_0x4344e4=path['join'](_0x33400d,util[_0xeadd('0x19')]('%s.%s',_0x161d52,_0xeadd('0x37')));}_0x3204c5[_0xeadd('0x15')](writePDFDocument(_0x4795ca,_0x4344e4));}return Promise[_0xeadd('0x38')](_0x3204c5);})['then'](function(){if(_0x4b95ad){return new Promise(function(_0xbc0822){zipdir(path[_0xeadd('0x32')](_0x33400d,_0x161d52),{'saveTo':path[_0xeadd('0x32')](_0x33400d,util[_0xeadd('0x19')](_0xeadd('0x39'),_0x161d52,_0xeadd('0x3a')))},function(){rimraf(path[_0xeadd('0x32')](_0x33400d,_0x161d52),function(){});_0xbc0822(_0xeadd('0x3b'));});});}})[_0xeadd('0x28')](function(){if(!_0x4b95ad)return;rimraf(path[_0xeadd('0x32')](_0x33400d,_0x161d52),function(){});})[_0xeadd('0x28')](function(){logger[_0xeadd('0x3c')](util['format'](_0xeadd('0x3d'),EXTRACTED_REPORT_ID,_0xeadd('0x3e')));return analyticExtractedReport('Completed',_0x4b95ad?util['format']('%s.%s',_0x161d52,_0x4b95ad?_0xeadd('0x3a'):_0xeadd('0x37')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xeadd('0x19')](_0xeadd('0x3f'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xeadd('0x40')][_0xeadd('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x4a3f3f){EXTRACTED_REPORT=_0x4a3f3f;return dbH[_0xeadd('0x2a')][_0xeadd('0x2b')](util[_0xeadd('0x19')](_0xeadd('0x42'),QUERY),{'type':dbH['sequelize'][_0xeadd('0x2d')][_0xeadd('0x2e')]});})[_0xeadd('0x28')](extractReport)[_0xeadd('0x43')](function(_0x338e2d){logger[_0xeadd('0x3c')](util[_0xeadd('0x19')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xeadd('0x3e')),util[_0xeadd('0x44')](_0x338e2d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xeadd('0x45'));})[_0xeadd('0x46')](function(){process[_0xeadd('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x368831=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xeadd('0x48'),'italics':__dirname+_0xeadd('0x49'),'bolditalics':__dirname+_0xeadd('0x4a')}});return _0x368831;}function getPDFDocDefinitionFromHTML(_0x2318fa,_0x12f5df){var _0x179454=util[_0xeadd('0x19')](_0xeadd('0x4b'),_0x12f5df[_0xeadd('0x4c')],_0x12f5df[_0xeadd('0x4d')]);var _0xf2f6b7=moment()[_0xeadd('0x19')]('YYYY-MM-DD')[_0xeadd('0x11')]();var _0x131306=htmlToPdfmake(_0x2318fa,{'window':window,'tableAutoSize':!![]});return{'content':[_0x131306],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xeadd('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xeadd('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xeadd('0x4e')}},'header':function(){return[{'text':_0xeadd('0x4f'),'style':_0xeadd('0x50')}];},'footer':function(_0x3417b8,_0x525e3d){return[{'text':util[_0xeadd('0x19')](_0xeadd('0x51'),_0x179454,_0x3417b8,_0x525e3d,_0xf2f6b7),'style':_0xeadd('0x52')}];}};}function writePDFDocument(_0x349925,_0x50d95e){return new Promise(function(_0x4fce92,_0x226050){var _0x205d1a=_0x349925[_0xeadd('0x53')](fs[_0xeadd('0x54')](_0x50d95e));_0x205d1a['on']('finish',function(){_0x4fce92(_0xeadd('0x55'));});_0x205d1a['on'](_0xeadd('0x56'),function(_0xa77bbe){_0x226050(_0xa77bbe);});_0x349925[_0xeadd('0x57')]();});}exports[_0xeadd('0x58')]=function(_0xcc662c,_0x3539df){var _0x1a8a43=getPDFPrinter();var _0x2a7d00=getPDFDocDefinitionFromHTML(_0xcc662c,_0x3539df);var _0x2e9271=_0x1a8a43[_0xeadd('0x35')](_0x2a7d00);return writePDFDocument(_0x2e9271,_0x3539df[_0xeadd('0x1')])[_0xeadd('0x43')](function(_0x4973d){throw _0x4973d;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 3ba450c..e4c41c8 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 _0x6f2f=['zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','query','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','path'];(function(_0x2cc842,_0xd6800d){var _0x24adab=function(_0x41ab67){while(--_0x41ab67){_0x2cc842['push'](_0x2cc842['shift']());}};_0x24adab(++_0xd6800d);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x6f2f[_0x4b055c];return _0x4b62bb;};'use strict';var util=require(_0xf6f2('0x0'));var path=require(_0xf6f2('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xf6f2('0x2'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xf6f2('0x3'))[_0xf6f2('0x4')];var logger=require(_0xf6f2('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf6f2('0x6')][0x3];var PATH=process[_0xf6f2('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x26cd28,_0x774922){var _0x15a71c={'status':_0x26cd28};var _0x1873c8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x774922){_0x15a71c[_0xf6f2('0x7')]=_0x774922;}return db[_0xf6f2('0x8')][_0xf6f2('0x9')](_0x15a71c,_0x1873c8);}function main(){var _0x17ffd2=0x1388;var _0x55a260;logger[_0xf6f2('0xa')](util[_0xf6f2('0xb')](_0xf6f2('0xc'),EXTRACTED_REPORT_ID,_0xf6f2('0xd')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf6f2('0xe')]})[_0xf6f2('0xf')](function(_0x131a18){if(_0x131a18){_0x55a260=_0x131a18;_0x17ffd2=_0x55a260[_0xf6f2('0xe')]||0x1388;}})[_0xf6f2('0xf')](function(){return dbH[_0xf6f2('0x10')]['query'](util[_0xf6f2('0xb')](_0xf6f2('0x11'),QUERY),{'type':dbH[_0xf6f2('0x10')][_0xf6f2('0x12')][_0xf6f2('0x13')]});})['then'](function(_0x2b28c1){if(!_0x2b28c1[0x0][_0xf6f2('0x14')]){return analyticExtractedReport(_0xf6f2('0x15'));}var _0x26c176=[];var _0x2d4294=0x0;if(_0x55a260[_0xf6f2('0x16')]){if(_0x2b28c1&&_0x2b28c1[_0xf6f2('0x17')]){var _0x4441f3=_[_0xf6f2('0x18')](_0x2b28c1[0x0][_0xf6f2('0x14')]/_0x17ffd2);var _0x400055=Number[_0xf6f2('0x19')](_0x2b28c1[0x0][_0xf6f2('0x14')]/_0x17ffd2)?_0x2b28c1[0x0][_0xf6f2('0x14')]%_0x17ffd2:0x0;_0x4441f3[_0xf6f2('0x1a')](function(_0x537b35){if(_0x537b35>0x0){_0x2d4294+=_0x17ffd2;}_0x26c176['push'](dbH[_0xf6f2('0x10')]['query'](util[_0xf6f2('0xb')](_0xf6f2('0x1b'),QUERY,_0x17ffd2,_0x2d4294),{'type':dbH[_0xf6f2('0x10')][_0xf6f2('0x12')]['SELECT']}));});if(_0x400055>0x0){_0x2d4294+=_0x17ffd2;_0x26c176[_0xf6f2('0x1c')](dbH[_0xf6f2('0x10')][_0xf6f2('0x1d')](util[_0xf6f2('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x400055,_0x2d4294),{'type':dbH[_0xf6f2('0x10')]['QueryTypes'][_0xf6f2('0x13')]}));}}}else{_0x26c176['push'](dbH[_0xf6f2('0x10')][_0xf6f2('0x1d')](QUERY,{'type':dbH['sequelize'][_0xf6f2('0x12')][_0xf6f2('0x13')]}));}var _0x3b0ed5=path[_0xf6f2('0x1e')](PATH);var _0x219a12=path[_0xf6f2('0x1f')](PATH,_0xf6f2('0x20'));var _0x1f87ab=_0x55a260['split']&&_0x26c176[_0xf6f2('0x17')]>0x1;var _0x2081f6=[];if(!fs[_0xf6f2('0x21')](path[_0xf6f2('0x22')](_0x3b0ed5,_0x219a12))&&_0x1f87ab){fs[_0xf6f2('0x23')](path[_0xf6f2('0x22')](_0x3b0ed5,_0x219a12));}return BPromise[_0xf6f2('0x24')](_0x26c176,function(_0x34ecdc){_0x2081f6[_0xf6f2('0x1c')](_0x34ecdc);})[_0xf6f2('0xf')](function(){for(var _0x2c643d=0x0;_0x2c643d<_0x2081f6['length'];_0x2c643d+=0x1){var _0x2aa645;var _0x26c4dc=_0x2081f6[_0x2c643d];if(_0x1f87ab){_0x2aa645=path[_0xf6f2('0x22')](_0x3b0ed5,_0x219a12,util[_0xf6f2('0xb')](_0xf6f2('0x25'),_0x219a12,_0x2c643d,_0xf6f2('0x26')));}else{_0x2aa645=path[_0xf6f2('0x22')](_0x3b0ed5,util[_0xf6f2('0xb')](_0xf6f2('0x27'),_0x219a12,_0xf6f2('0x26')));}fs[_0xf6f2('0x28')](_0x2aa645,json2xls(_0x26c4dc),_0xf6f2('0x29'));}})['then'](function(){if(_0x1f87ab){return new Promise(function(_0x13145f){zipdir(path[_0xf6f2('0x22')](_0x3b0ed5,_0x219a12),{'saveTo':path[_0xf6f2('0x22')](_0x3b0ed5,util[_0xf6f2('0xb')](_0xf6f2('0x27'),_0x219a12,_0xf6f2('0x2a')))},function(_0x630ebf,_0x18570a){rimraf(path[_0xf6f2('0x22')](_0x3b0ed5,_0x219a12),function(){});_0x13145f(_0xf6f2('0x2b'));});});}})[_0xf6f2('0xf')](function(){logger[_0xf6f2('0xa')](util[_0xf6f2('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x1f87ab?util[_0xf6f2('0xb')](_0xf6f2('0x27'),_0x219a12,_0x1f87ab?'zip':'xlsx'):null);});})[_0xf6f2('0x2c')](function(_0x2975eb){logger[_0xf6f2('0xa')](util[_0xf6f2('0xb')](_0xf6f2('0x2d'),EXTRACTED_REPORT_ID,_0xf6f2('0xd')),util['inspect'](_0x2975eb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf6f2('0x2e'));})['finally'](function(){process[_0xf6f2('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf672=['exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','sequelize','QueryTypes','SELECT','num','Empty','length','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync','mkdirSync','join','each','then','%s%d.%s','xlsx','%s.%s','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally'];(function(_0x1f56a1,_0x5842d9){var _0x495399=function(_0x866906){while(--_0x866906){_0x1f56a1['push'](_0x1f56a1['shift']());}};_0x495399(++_0x5842d9);}(_0xf672,0xc5));var _0x2f67=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xf672[_0x45d3f0];return _0x314b79;};'use strict';var util=require(_0x2f67('0x0'));var path=require(_0x2f67('0x1'));var _=require(_0x2f67('0x2'));var fs=require('fs');var json2xls=require(_0x2f67('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x2f67('0x4'));var rimraf=require(_0x2f67('0x5'));var db=require(_0x2f67('0x6'))['db'];var dbH=require(_0x2f67('0x6'))['dbH'];var logger=require(_0x2f67('0x7'))(_0x2f67('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x2f67('0x9')][0x2]);var QUERY=process[_0x2f67('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cb46f,_0x4fcb30){var _0x4f0106={'status':_0x2cb46f};var _0x32bda0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fcb30){_0x4f0106['savename']=_0x4fcb30;}return db[_0x2f67('0xa')][_0x2f67('0xb')](_0x4f0106,_0x32bda0);}function main(){var _0x2a85ca=0x1388;var _0x398bbb;logger[_0x2f67('0xc')](util[_0x2f67('0xd')](_0x2f67('0xe'),EXTRACTED_REPORT_ID,_0x2f67('0xf')));return db[_0x2f67('0x10')][_0x2f67('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2f67('0x12'),_0x2f67('0x13')]})['then'](function(_0x12ebb4){if(_0x12ebb4){_0x398bbb=_0x12ebb4;_0x2a85ca=_0x398bbb[_0x2f67('0x13')]||0x1388;}})['then'](function(){return dbH[_0x2f67('0x14')]['query'](util[_0x2f67('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2f67('0x14')][_0x2f67('0x15')][_0x2f67('0x16')]});})['then'](function(_0x519931){if(!_0x519931[0x0][_0x2f67('0x17')]){return analyticExtractedReport(_0x2f67('0x18'));}var _0x2b2708=[];var _0x34429e=0x0;if(_0x398bbb[_0x2f67('0x12')]){if(_0x519931&&_0x519931[_0x2f67('0x19')]){var _0x116283=_['range'](_0x519931[0x0]['num']/_0x2a85ca);var _0x493bab=Number['isInteger'](_0x519931[0x0]['num']/_0x2a85ca)?_0x519931[0x0][_0x2f67('0x17')]%_0x2a85ca:0x0;_0x116283[_0x2f67('0x1a')](function(_0x53beeb){if(_0x53beeb>0x0){_0x34429e+=_0x2a85ca;}_0x2b2708['push'](dbH[_0x2f67('0x14')][_0x2f67('0x1b')](util[_0x2f67('0xd')](_0x2f67('0x1c'),QUERY,_0x2a85ca,_0x34429e),{'type':dbH[_0x2f67('0x14')]['QueryTypes']['SELECT']}));});if(_0x493bab>0x0){_0x34429e+=_0x2a85ca;_0x2b2708[_0x2f67('0x1d')](dbH[_0x2f67('0x14')]['query'](util[_0x2f67('0xd')](_0x2f67('0x1c'),QUERY,_0x493bab,_0x34429e),{'type':dbH[_0x2f67('0x14')][_0x2f67('0x15')][_0x2f67('0x16')]}));}}}else{_0x2b2708['push'](dbH[_0x2f67('0x14')][_0x2f67('0x1b')](QUERY,{'type':dbH[_0x2f67('0x14')][_0x2f67('0x15')][_0x2f67('0x16')]}));}var _0x5938e4=path[_0x2f67('0x1e')](PATH);var _0x3b43d7=path[_0x2f67('0x1f')](PATH,'.xlsx');var _0x59f257=_0x398bbb[_0x2f67('0x12')]&&_0x2b2708[_0x2f67('0x19')]>0x1;var _0x109483=[];if(!fs[_0x2f67('0x20')](path['join'](_0x5938e4,_0x3b43d7))&&_0x59f257){fs[_0x2f67('0x21')](path[_0x2f67('0x22')](_0x5938e4,_0x3b43d7));}return BPromise[_0x2f67('0x23')](_0x2b2708,function(_0x3d5d02){_0x109483['push'](_0x3d5d02);})[_0x2f67('0x24')](function(){for(var _0x11a039=0x0;_0x11a039<_0x109483['length'];_0x11a039+=0x1){var _0x113c5e;var _0x35c6ca=_0x109483[_0x11a039];if(_0x59f257){_0x113c5e=path[_0x2f67('0x22')](_0x5938e4,_0x3b43d7,util[_0x2f67('0xd')](_0x2f67('0x25'),_0x3b43d7,_0x11a039,_0x2f67('0x26')));}else{_0x113c5e=path[_0x2f67('0x22')](_0x5938e4,util[_0x2f67('0xd')](_0x2f67('0x27'),_0x3b43d7,'xlsx'));}fs['writeFileSync'](_0x113c5e,json2xls(_0x35c6ca),'binary');}})[_0x2f67('0x24')](function(){if(_0x59f257){return new Promise(function(_0x1a4a56){zipdir(path['join'](_0x5938e4,_0x3b43d7),{'saveTo':path['join'](_0x5938e4,util['format'](_0x2f67('0x27'),_0x3b43d7,_0x2f67('0x28')))},function(_0x4ef8db,_0x4f5d4d){rimraf(path[_0x2f67('0x22')](_0x5938e4,_0x3b43d7),function(){});_0x1a4a56(_0x2f67('0x29'));});});}})[_0x2f67('0x24')](function(){logger['info'](util[_0x2f67('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2f67('0xf')));return analyticExtractedReport(_0x2f67('0x2a'),_0x59f257?util[_0x2f67('0xd')](_0x2f67('0x27'),_0x3b43d7,_0x59f257?_0x2f67('0x28'):'xlsx'):null);});})[_0x2f67('0x2b')](function(_0xbbb25b){logger['info'](util['format'](_0x2f67('0x2c'),EXTRACTED_REPORT_ID,_0x2f67('0xf')),util[_0x2f67('0x2d')](_0xbbb25b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2f67('0x2e'));})[_0x2f67('0x2f')](function(){process[_0x2f67('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c7d6e71..9c9fcfb 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 _0xe4a8=['IntervalId','hasOwnProperty','tag','CDR(tag)=','length','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','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','intervals','VoiceExtension','findAll','then','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','push','Set','format','CDR(type)=%s','context','VoiceExtensionId','type','inbound','outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe4a8,0xe5));var _0x8e4a=function(_0x19ab90,_0x23773c){_0x19ab90=_0x19ab90-0x0;var _0x45b682=_0xe4a8[_0x19ab90];return _0x45b682;};'use strict';var _=require(_0x8e4a('0x0'));var util=require(_0x8e4a('0x1'));function rewrite(_0x32f7f0,_0x297ca1){var _0x3b5248=this;return _0x32f7f0[_0x8e4a('0x2')][_0x8e4a('0x3')]['findAll']({'raw':!![]})['then'](function(_0x2fc3dc){_0x3b5248[_0x8e4a('0x4')]=_0x2fc3dc;return _0x32f7f0[_0x8e4a('0x2')][_0x8e4a('0x5')][_0x8e4a('0x6')]({'where':{'IntervalId':_0x297ca1['IntervalId']},'raw':!![]});})[_0x8e4a('0x7')](function(_0x389681){return _0x32f7f0[_0x8e4a('0x2')][_0x8e4a('0x5')][_0x8e4a('0x6')]({'where':{'exten':{'$in':_['uniq'](_[_0x8e4a('0x8')](_0x389681,_0x8e4a('0x9')))}},'order':[{'raw':_0x8e4a('0xa')}],'raw':!![]});})[_0x8e4a('0x7')](function(_0x29e13b){var _0x43e448=_[_0x8e4a('0xb')](_0x29e13b,{'priority':'1'});var _0x37dd64=_[_0x8e4a('0xb')](_0x29e13b,{'isApp':0x1});var _0x502850=_[_0x8e4a('0xc')](_0x37dd64,'exten');var _0x133aea=[_0x8e4a('0xd'),_0x8e4a('0xe')];var _0x16f7e0=[];var _0x228cc3=[];for(var _0x40ad44 in _0x502850){if(_0x502850['hasOwnProperty'](_0x40ad44)){_0x3b5248[_0x8e4a('0xf')]=0x2;_0x3b5248[_0x8e4a('0x10')]=[];_0x3b5248[_0x8e4a('0x11')]=_['find'](_0x43e448,{'exten':_0x502850[_0x40ad44][0x0]['exten']});_0x3b5248[_0x8e4a('0x10')][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0]['type'],'app':_0x8e4a('0x13'),'appdata':util[_0x8e4a('0x14')](_0x8e4a('0x15'),_0x502850[_0x40ad44][0x0]['type']),'context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0][_0x8e4a('0x9')],'priority':_0x3b5248[_0x8e4a('0xf')]++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});if(_0x502850[_0x40ad44][0x0][_0x8e4a('0x18')]===_0x8e4a('0x19')){_0x3b5248[_0x8e4a('0x10')][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0][_0x8e4a('0x18')],'app':_0x8e4a('0x13'),'appdata':'CDR(routeid)='+_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')],'context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0][_0x8e4a('0x9')],'priority':_0x3b5248[_0x8e4a('0xf')]++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});}else if(_0x502850[_0x40ad44][0x0][_0x8e4a('0x18')]===_0x8e4a('0x1a')){if(_0x3b5248[_0x8e4a('0x11')]){_0x3b5248['extensions'][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0]['type'],'app':'Set','appdata':'CDR(destination)='+(_0x3b5248[_0x8e4a('0x11')][_0x8e4a('0x1b')]?_0x8e4a('0x1c')+_0x3b5248[_0x8e4a('0x11')][_0x8e4a('0x1b')]+'}':_0x8e4a('0x1d')),'context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0]['exten'],'priority':_0x3b5248[_0x8e4a('0xf')]++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0]['VoiceExtensionId']});}_0x3b5248[_0x8e4a('0x10')][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0]['type'],'app':_0x8e4a('0x13'),'appdata':_0x8e4a('0x1e')+_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')],'context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0][_0x8e4a('0x9')],'priority':_0x3b5248[_0x8e4a('0xf')]++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});var _0x44aab=_0x3b5248['priority']++;_0x3b5248[_0x8e4a('0x10')][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0][_0x8e4a('0x18')],'app':'ExecIf','appdata':_0x8e4a('0x1f')+(_0x44aab+0x2)+'):Goto('+(_0x44aab+0x1)+')','context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0][_0x8e4a('0x9')],'priority':_0x44aab,'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});if(_0x3b5248[_0x8e4a('0x11')]){_0x3b5248[_0x8e4a('0x10')][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0]['type'],'app':'Set','appdata':_0x3b5248['extension'][_0x8e4a('0x1b')]?_0x8e4a('0x20')+_0x3b5248[_0x8e4a('0x11')][_0x8e4a('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0][_0x8e4a('0x9')],'priority':_0x3b5248[_0x8e4a('0xf')]++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});}_0x3b5248['extensions'][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0][_0x8e4a('0x18')],'app':_0x8e4a('0x13'),'appdata':_0x8e4a('0x21')+_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')],'context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0][_0x8e4a('0x9')],'priority':_0x3b5248['priority']++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});if(_0x3b5248['extension']&&_0x3b5248['extension']['hasOwnProperty'](_0x8e4a('0x22'))&&_0x3b5248[_0x8e4a('0x11')]['recordingFormat']!=='none'){_0x3b5248[_0x8e4a('0x10')][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0][_0x8e4a('0x18')],'app':_0x8e4a('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0]['exten'],'priority':_0x3b5248[_0x8e4a('0xf')]++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});_0x3b5248[_0x8e4a('0x10')]['push']({'type':_0x502850[_0x40ad44][0x0][_0x8e4a('0x18')],'app':_0x8e4a('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3b5248[_0x8e4a('0x11')][_0x8e4a('0x22')]||_0x8e4a('0x23'),'context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0][_0x8e4a('0x9')],'priority':_0x3b5248[_0x8e4a('0xf')]++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});}}_0x3b5248[_0x8e4a('0x10')][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0][_0x8e4a('0x18')],'app':_0x8e4a('0x13'),'appdata':_0x8e4a('0x24'),'context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0][_0x8e4a('0x9')],'priority':_0x3b5248[_0x8e4a('0xf')]++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0]['VoiceExtensionId']});_0x3b5248[_0x8e4a('0x10')][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0]['type'],'app':_0x8e4a('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'exten':_0x502850[_0x40ad44][0x0]['exten'],'priority':_0x3b5248[_0x8e4a('0xf')]++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});_0x3b5248[_0x8e4a('0x10')][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0]['type'],'app':_0x8e4a('0x13'),'appdata':_0x8e4a('0x25'),'context':_0x502850[_0x40ad44][0x0]['context'],'exten':_0x502850[_0x40ad44][0x0][_0x8e4a('0x9')],'priority':_0x3b5248['priority']++,'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});for(var _0x5bce43=0x0,_0x565452=0x0;_0x5bce43<_0x502850[_0x40ad44]['length'];_0x5bce43+=0x1,_0x565452=0x0){var _0x3bf8d6=_0x502850[_0x40ad44][_0x5bce43];if(_0x3bf8d6['type']){_0x3bf8d6['type']=_0x3bf8d6[_0x8e4a('0x18')][_0x8e4a('0x26')]();}var _0x123777=[];var _0x59dacb=[];delete _0x3bf8d6['id'];delete _0x3bf8d6[_0x8e4a('0x27')];delete _0x3bf8d6[_0x8e4a('0x28')];var _0x27fa05=_0x3bf8d6[_0x8e4a('0x29')]!==_0x8e4a('0x2a')?[_0x3bf8d6[_0x8e4a('0x29')]]:_0x3bf8d6['IntervalId']?_[_0x8e4a('0x8')](_[_0x8e4a('0xb')](_0x3b5248['intervals'],{'IntervalId':_0x3bf8d6[_0x8e4a('0x2b')]}),_0x8e4a('0x29')):[];if(_0x3bf8d6[_0x8e4a('0x2c')]('tag')){if(_0x3bf8d6[_0x8e4a('0x2d')]&&_0x3bf8d6[_0x8e4a('0x2d')]!=='--'){_0x123777[_0x8e4a('0x12')]({'type':_0x3bf8d6[_0x8e4a('0x18')],'app':_0x8e4a('0x13'),'appdata':_0x8e4a('0x2e')+_0x3bf8d6[_0x8e4a('0x2d')],'context':_0x3bf8d6['context'],'exten':_0x3bf8d6[_0x8e4a('0x9')],'priority':_0x27fa05[_0x8e4a('0x2f')]+_0x3b5248[_0x8e4a('0xf')]+_0x565452++,'VoiceExtensionId':_0x3bf8d6[_0x8e4a('0x17')]});}}if(_0x3bf8d6[_0x8e4a('0x18')]===_0x8e4a('0x1a')&&_0x3bf8d6[_0x8e4a('0x2c')]('callerID')){if(_0x3bf8d6[_0x8e4a('0x30')]){_0x123777[_0x8e4a('0x12')]({'type':_0x3bf8d6['type'],'app':_0x8e4a('0x31'),'appdata':_0x8e4a('0x32')+_0x3bf8d6['callerID']+')','context':_0x3bf8d6['context'],'exten':_0x3bf8d6[_0x8e4a('0x9')],'priority':_0x27fa05[_0x8e4a('0x2f')]+_0x3b5248[_0x8e4a('0xf')]+_0x565452++,'VoiceExtensionId':_0x3bf8d6[_0x8e4a('0x17')]});}else{_0x123777[_0x8e4a('0x12')]({'type':_0x3bf8d6[_0x8e4a('0x18')],'app':_0x8e4a('0x31'),'appdata':_0x8e4a('0x33'),'context':_0x3bf8d6[_0x8e4a('0x16')],'exten':_0x3bf8d6['exten'],'priority':_0x27fa05[_0x8e4a('0x2f')]+_0x3b5248[_0x8e4a('0xf')]+_0x565452++,'VoiceExtensionId':_0x3bf8d6[_0x8e4a('0x17')]});}}if(_0x3bf8d6[_0x8e4a('0x2c')](_0x8e4a('0x34'))){if(_0x133aea['indexOf'](_0x3bf8d6['app'][_0x8e4a('0x26')]())>=0x0&&_0x3bf8d6[_0x8e4a('0x35')]!=='custom'){if(_0x3bf8d6['answer']){_0x123777[_0x8e4a('0x12')]({'type':_0x3bf8d6[_0x8e4a('0x18')],'app':'ExecIf','appdata':_0x8e4a('0x36'),'context':_0x3bf8d6[_0x8e4a('0x16')],'exten':_0x3bf8d6['exten'],'priority':_0x27fa05[_0x8e4a('0x2f')]+_0x3b5248[_0x8e4a('0xf')]+_0x565452++,'VoiceExtensionId':_0x3bf8d6[_0x8e4a('0x17')]});_0x123777[_0x8e4a('0x12')]({'type':_0x3bf8d6[_0x8e4a('0x18')],'app':_0x8e4a('0x13'),'appdata':_0x8e4a('0x37'),'context':_0x3bf8d6['context'],'exten':_0x3bf8d6[_0x8e4a('0x9')],'priority':_0x27fa05[_0x8e4a('0x2f')]+_0x3b5248[_0x8e4a('0xf')]+_0x565452++,'VoiceExtensionId':_0x3bf8d6[_0x8e4a('0x17')]});}else{_0x123777['push']({'type':_0x3bf8d6['type'],'app':_0x8e4a('0x31'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3bf8d6[_0x8e4a('0x16')],'exten':_0x3bf8d6[_0x8e4a('0x9')],'priority':_0x27fa05[_0x8e4a('0x2f')]+_0x3b5248[_0x8e4a('0xf')]+_0x565452++,'VoiceExtensionId':_0x3bf8d6['VoiceExtensionId']});_0x123777[_0x8e4a('0x12')]({'type':_0x3bf8d6[_0x8e4a('0x18')],'app':_0x8e4a('0x13'),'appdata':_0x8e4a('0x38'),'context':_0x3bf8d6[_0x8e4a('0x16')],'exten':_0x3bf8d6['exten'],'priority':_0x27fa05[_0x8e4a('0x2f')]+_0x3b5248['priority']+_0x565452++,'VoiceExtensionId':_0x3bf8d6[_0x8e4a('0x17')]});}}}for(var _0x35a76c=0x0;_0x35a76c<_0x27fa05['length'];_0x35a76c+=0x1){var _0x43ce3e=_0x3b5248[_0x8e4a('0xf')]+_0x27fa05['length'];var _0x1ed7a2=_0x35a76c===_0x27fa05[_0x8e4a('0x2f')]-0x1?_0x3b5248[_0x8e4a('0xf')]+_0x123777[_0x8e4a('0x2f')]+_0x59dacb['length']+0x2:_0x3b5248[_0x8e4a('0xf')]+_0x35a76c+0x1;_0x123777[_0x8e4a('0x39')](_0x35a76c,0x0,{'type':_0x3bf8d6['type'],'app':_0x8e4a('0x3a'),'appdata':_0x27fa05[_0x35a76c]+'?'+_0x3bf8d6['context']+_0x8e4a('0x3b')+_0x43ce3e+':'+_0x3bf8d6[_0x8e4a('0x16')]+',${EXTEN},'+_0x1ed7a2,'exten':_0x3bf8d6[_0x8e4a('0x9')],'context':_0x3bf8d6['context'],'priority':_0x3b5248['priority']+_0x35a76c,'VoiceExtensionId':_0x502850[_0x40ad44][0x0]['VoiceExtensionId']});}_0x3bf8d6['priority']=_0x123777[_0x8e4a('0x2f')]?_[_0x8e4a('0x3c')](_0x123777)[_0x8e4a('0xf')]+0x1:_0x3b5248[_0x8e4a('0xf')];_0x3b5248[_0x8e4a('0xf')]=(_0x59dacb['length']?_[_0x8e4a('0x3c')](_0x59dacb)['priority']:_0x3bf8d6['priority'])+0x1;_0x3b5248[_0x8e4a('0x10')]=_['concat'](_0x3b5248[_0x8e4a('0x10')],_0x123777,[_0x3bf8d6],_0x59dacb);}_0x3b5248[_0x8e4a('0x10')][_0x8e4a('0x12')]({'type':_0x502850[_0x40ad44][0x0][_0x8e4a('0x18')],'app':'Hangup','exten':_0x502850[_0x40ad44][0x0][_0x8e4a('0x9')],'context':_0x502850[_0x40ad44][0x0][_0x8e4a('0x16')],'priority':_0x3b5248[_0x8e4a('0xf')],'VoiceExtensionId':_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]});_0x16f7e0[_0x8e4a('0x12')](_0x502850[_0x40ad44][0x0][_0x8e4a('0x17')]);_0x228cc3=_[_0x8e4a('0x3d')](_0x228cc3,_0x3b5248['extensions']);}}return _0x32f7f0['transaction'](function(_0x5289e4){return _0x32f7f0['models'][_0x8e4a('0x5')][_0x8e4a('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x16f7e0}},'transaction':_0x5289e4})[_0x8e4a('0x7')](function(_0x2d8bd0){return _0x32f7f0[_0x8e4a('0x2')]['VoiceExtension'][_0x8e4a('0x3f')](_[_0x8e4a('0x40')](_0x228cc3,_0x8e4a('0xf')),{'transaction':_0x5289e4});});});})[_0x8e4a('0x41')](function(_0x4c8ea9){console[_0x8e4a('0x42')](_0x4c8ea9);});}exports[_0x8e4a('0x43')]=rewrite; \ No newline at end of file +var _0xe622=['playback','hasOwnProperty','priority','extension','exten','extensions','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','push','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','error','util','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe622,0x1e4));var _0x2e62=function(_0x165f36,_0x5917ed){_0x165f36=_0x165f36-0x0;var _0x5eb673=_0xe622[_0x165f36];return _0x5eb673;};'use strict';var _=require('lodash');var util=require(_0x2e62('0x0'));function rewrite(_0x346745,_0x201730){var _0x38f61f=this;return _0x346745[_0x2e62('0x1')]['Interval'][_0x2e62('0x2')]({'raw':!![]})[_0x2e62('0x3')](function(_0x3632dc){_0x38f61f[_0x2e62('0x4')]=_0x3632dc;return _0x346745['models'][_0x2e62('0x5')][_0x2e62('0x2')]({'where':{'IntervalId':_0x201730[_0x2e62('0x6')]},'raw':!![]});})[_0x2e62('0x3')](function(_0x1d81a1){return _0x346745[_0x2e62('0x1')][_0x2e62('0x5')][_0x2e62('0x2')]({'where':{'exten':{'$in':_[_0x2e62('0x7')](_[_0x2e62('0x8')](_0x1d81a1,'exten'))}},'order':[{'raw':_0x2e62('0x9')}],'raw':!![]});})[_0x2e62('0x3')](function(_0x2f042b){var _0x3d271d=_[_0x2e62('0xa')](_0x2f042b,{'priority':'1'});var _0x23f60f=_[_0x2e62('0xa')](_0x2f042b,{'isApp':0x1});var _0x5b4f5f=_[_0x2e62('0xb')](_0x23f60f,'exten');var _0x2b27f1=[_0x2e62('0xc'),_0x2e62('0xd')];var _0x329607=[];var _0x2b0354=[];for(var _0x43483e in _0x5b4f5f){if(_0x5b4f5f[_0x2e62('0xe')](_0x43483e)){_0x38f61f[_0x2e62('0xf')]=0x2;_0x38f61f['extensions']=[];_0x38f61f[_0x2e62('0x10')]=_['find'](_0x3d271d,{'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')]});_0x38f61f[_0x2e62('0x12')]['push']({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':util[_0x2e62('0x15')](_0x2e62('0x16'),_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')]),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f['priority']++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});if(_0x5b4f5f[_0x43483e][0x0]['type']===_0x2e62('0x19')){_0x38f61f['extensions']['push']({'type':_0x5b4f5f[_0x43483e][0x0]['type'],'app':'Set','appdata':_0x2e62('0x1a')+_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')],'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});}else if(_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')]===_0x2e62('0x1b')){if(_0x38f61f['extension']){_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x1d')+(_0x38f61f[_0x2e62('0x10')]['cutdigits']?_0x2e62('0x1e')+_0x38f61f['extension'][_0x2e62('0x1f')]+'}':_0x2e62('0x20')),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});}_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x1a')+_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId'],'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId']});var _0x3d4b2c=_0x38f61f[_0x2e62('0xf')]++;_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x21'),'appdata':_0x2e62('0x22')+(_0x3d4b2c+0x2)+_0x2e62('0x23')+(_0x3d4b2c+0x1)+')','context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0]['exten'],'priority':_0x3d4b2c,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId']});if(_0x38f61f[_0x2e62('0x10')]){_0x38f61f['extensions']['push']({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x38f61f[_0x2e62('0x10')][_0x2e62('0x1f')]?_0x2e62('0x24')+_0x38f61f[_0x2e62('0x10')][_0x2e62('0x1f')]+'}':_0x2e62('0x25'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});}_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x26')+_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')],'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f['priority']++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});if(_0x38f61f['extension']&&_0x38f61f[_0x2e62('0x10')][_0x2e62('0xe')]('recordingFormat')&&_0x38f61f[_0x2e62('0x10')][_0x2e62('0x27')]!=='none'){_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x28'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x38f61f[_0x2e62('0x10')][_0x2e62('0x27')]||_0x2e62('0x29'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});}}_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x2a'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0]['exten'],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});_0x38f61f[_0x2e62('0x12')]['push']({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':'Set','appdata':_0x2e62('0x2b'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId']});_0x38f61f[_0x2e62('0x12')]['push']({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x2c'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});for(var _0x1e7f2e=0x0,_0x2d1fe7=0x0;_0x1e7f2e<_0x5b4f5f[_0x43483e][_0x2e62('0x2d')];_0x1e7f2e+=0x1,_0x2d1fe7=0x0){var _0x29bd3b=_0x5b4f5f[_0x43483e][_0x1e7f2e];if(_0x29bd3b[_0x2e62('0x13')]){_0x29bd3b[_0x2e62('0x13')]=_0x29bd3b['type'][_0x2e62('0x2e')]();}var _0x43ff11=[];var _0x1127f5=[];delete _0x29bd3b['id'];delete _0x29bd3b[_0x2e62('0x2f')];delete _0x29bd3b[_0x2e62('0x30')];var _0x3c5d46=_0x29bd3b[_0x2e62('0x31')]!=='*,*,*,*'?[_0x29bd3b['interval']]:_0x29bd3b[_0x2e62('0x6')]?_[_0x2e62('0x8')](_[_0x2e62('0xa')](_0x38f61f[_0x2e62('0x4')],{'IntervalId':_0x29bd3b['IntervalId']}),_0x2e62('0x31')):[];if(_0x29bd3b[_0x2e62('0xe')](_0x2e62('0x32'))){if(_0x29bd3b[_0x2e62('0x32')]&&_0x29bd3b[_0x2e62('0x32')]!=='--'){_0x43ff11['push']({'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x33')+_0x29bd3b['tag'],'context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f[_0x2e62('0xf')]+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b['VoiceExtensionId']});}}if(_0x29bd3b[_0x2e62('0x13')]===_0x2e62('0x1b')&&_0x29bd3b[_0x2e62('0xe')]('callerID')){if(_0x29bd3b['callerID']){_0x43ff11[_0x2e62('0x1c')]({'type':_0x29bd3b['type'],'app':_0x2e62('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x29bd3b['callerID']+')','context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f[_0x2e62('0xf')]+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b[_0x2e62('0x18')]});}else{_0x43ff11[_0x2e62('0x1c')]({'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x21'),'appdata':_0x2e62('0x34'),'context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f[_0x2e62('0xf')]+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b['VoiceExtensionId']});}}if(_0x29bd3b['hasOwnProperty']('answer')){if(_0x2b27f1[_0x2e62('0x35')](_0x29bd3b[_0x2e62('0x36')]['toLowerCase']())>=0x0&&_0x29bd3b[_0x2e62('0x37')]!==_0x2e62('0x38')){if(_0x29bd3b[_0x2e62('0x39')]){_0x43ff11[_0x2e62('0x1c')]({'type':_0x29bd3b['type'],'app':_0x2e62('0x21'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46['length']+_0x38f61f['priority']+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b[_0x2e62('0x18')]});_0x43ff11[_0x2e62('0x1c')]({'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x3a'),'context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f['priority']+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b[_0x2e62('0x18')]});}else{_0x43ff11['push']({'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x21'),'appdata':_0x2e62('0x3b'),'context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f[_0x2e62('0xf')]+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b[_0x2e62('0x18')]});_0x43ff11[_0x2e62('0x1c')]({'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x3c'),'context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f['priority']+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b[_0x2e62('0x18')]});}}}for(var _0x33f75c=0x0;_0x33f75c<_0x3c5d46[_0x2e62('0x2d')];_0x33f75c+=0x1){var _0x4bff2f=_0x38f61f['priority']+_0x3c5d46[_0x2e62('0x2d')];var _0xcc273d=_0x33f75c===_0x3c5d46[_0x2e62('0x2d')]-0x1?_0x38f61f[_0x2e62('0xf')]+_0x43ff11[_0x2e62('0x2d')]+_0x1127f5['length']+0x2:_0x38f61f[_0x2e62('0xf')]+_0x33f75c+0x1;_0x43ff11[_0x2e62('0x3d')](_0x33f75c,0x0,{'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x3e'),'appdata':_0x3c5d46[_0x33f75c]+'?'+_0x29bd3b[_0x2e62('0x17')]+_0x2e62('0x3f')+_0x4bff2f+':'+_0x29bd3b[_0x2e62('0x17')]+_0x2e62('0x3f')+_0xcc273d,'exten':_0x29bd3b['exten'],'context':_0x29bd3b[_0x2e62('0x17')],'priority':_0x38f61f[_0x2e62('0xf')]+_0x33f75c,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId']});}_0x29bd3b[_0x2e62('0xf')]=_0x43ff11[_0x2e62('0x2d')]?_['last'](_0x43ff11)[_0x2e62('0xf')]+0x1:_0x38f61f['priority'];_0x38f61f['priority']=(_0x1127f5[_0x2e62('0x2d')]?_[_0x2e62('0x40')](_0x1127f5)['priority']:_0x29bd3b['priority'])+0x1;_0x38f61f[_0x2e62('0x12')]=_[_0x2e62('0x41')](_0x38f61f['extensions'],_0x43ff11,[_0x29bd3b],_0x1127f5);}_0x38f61f[_0x2e62('0x12')]['push']({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x42'),'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'context':_0x5b4f5f[_0x43483e][0x0]['context'],'priority':_0x38f61f[_0x2e62('0xf')],'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});_0x329607[_0x2e62('0x1c')](_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId']);_0x2b0354=_[_0x2e62('0x41')](_0x2b0354,_0x38f61f[_0x2e62('0x12')]);}}return _0x346745[_0x2e62('0x43')](function(_0x328790){return _0x346745[_0x2e62('0x1')][_0x2e62('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x329607}},'transaction':_0x328790})[_0x2e62('0x3')](function(_0x48d7a2){return _0x346745[_0x2e62('0x1')][_0x2e62('0x5')][_0x2e62('0x44')](_[_0x2e62('0x45')](_0x2b0354,_0x2e62('0xf')),{'transaction':_0x328790});});});})['catch'](function(_0x105d1c){console[_0x2e62('0x46')](_0x105d1c);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2f174f8..ff7d298 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 _0x5ac2=['isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','inspect','into','scheduledAt','ContactId','createdAt','select','field','toString','NOW()','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','insert','str','calleridnum','\x20=\x20?','fromQuery','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','contact:csv_','resume','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','Missing\x20filepath\x20parameter!','null','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','error','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD'];(function(_0x16e4cc,_0x3049a6){var _0x9bf887=function(_0x128aa4){while(--_0x128aa4){_0x16e4cc['push'](_0x16e4cc['shift']());}};_0x9bf887(++_0x3049a6);}(_0x5ac2,0xc1));var _0x25ac=function(_0x50ea06,_0x263e97){_0x50ea06=_0x50ea06-0x0;var _0x7aefe6=_0x5ac2[_0x50ea06];return _0x7aefe6;};'use strict';var BPromise=require(_0x25ac('0x0'));var util=require(_0x25ac('0x1'));var _=require(_0x25ac('0x2'));var fs=require('fs');var squel=require(_0x25ac('0x3'));var Papa=require(_0x25ac('0x4'));var Redis=require('ioredis');var db=require(_0x25ac('0x5'))['db'];var config=require(_0x25ac('0x6'));var logger=require('../../../config/logger')(_0x25ac('0x7'));config[_0x25ac('0x8')]=_[_0x25ac('0x9')](config[_0x25ac('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x25ac('0xa'))(new Redis(config['redis']));require(_0x25ac('0xb'))[_0x25ac('0xc')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x25ac('0xd')||process[_0x25ac('0xe')][0x2]==='null'){throw new Error(_0x25ac('0xf'));}var FILEPATH=process[_0x25ac('0xe')][0x2];if(!process[_0x25ac('0xe')][0x3]||process[_0x25ac('0xe')][0x3]==='undefined'||process[_0x25ac('0xe')][0x3]===_0x25ac('0x10')||!process[_0x25ac('0xe')][0x4]||process[_0x25ac('0xe')][0x4]==='undefined'||process[_0x25ac('0xe')][0x4]===_0x25ac('0x10')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0x25ac('0xe')][0x3][_0x25ac('0x11')](','),process[_0x25ac('0xe')][0x4][_0x25ac('0x11')](','));if(!process[_0x25ac('0xe')][0x5]||process[_0x25ac('0xe')][0x5]===_0x25ac('0xd')||process[_0x25ac('0xe')][0x5]===_0x25ac('0x10')){throw new Error(_0x25ac('0x12'));}var LISTID=process[_0x25ac('0xe')][0x5];var COMPANYID=process[_0x25ac('0xe')][0x6]&&process[_0x25ac('0xe')][0x6]!=='undefined'&&process[_0x25ac('0xe')][0x6]!==_0x25ac('0x10')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x25ac('0xe')][0x7]!==_0x25ac('0xd')&&process['argv'][0x7]!==_0x25ac('0x10')?process[_0x25ac('0xe')][0x7]:null;if(!process[_0x25ac('0xe')][0x8]||process['argv'][0x8]===_0x25ac('0xd')||process['argv'][0x8]===_0x25ac('0x10')){throw new Error(_0x25ac('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x54ed69){logger['error'](_0x54ed69);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(_0x3a1d06,_0x5a9462,_0x484aea,_0x1104ed){var _0x306905={'message':_0x5a9462};_0x306905[_0x3a1d06]=!![];if(_0x484aea){_0x306905[_0x25ac('0x14')]=_0x484aea;}if(_0x1104ed){_0x306905[_0x25ac('0x15')]=_0x1104ed;}return _0x306905;}function isEmail(_0x43fb63){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))*$/[_0x25ac('0x16')](_0x43fb63);}function checkRow(_0x4c9433,_0x2c9ba5,_0x12d090){return new BPromise(function(_0x188387,_0x317813){if(_[_0x25ac('0x17')](_0x4c9433)){return _0x317813(handleCheckRowError('error',_0x25ac('0x18'),null,_0x12d090));}if(_0x4c9433[_0x25ac('0x19')]&&_0x4c9433['errors']['length']){var _0xeeb453=_[_0x25ac('0x1a')](_0x4c9433[_0x25ac('0x19')],_0x25ac('0x1b'))[_0x25ac('0x1c')](';');return _0x317813(handleCheckRowError(_0x25ac('0x1d'),_0xeeb453,null,_0x12d090));}var _0x3be497={};for(var _0x3688b6 in FIELDS){if(FIELDS['hasOwnProperty'](_0x3688b6)&&FIELDS[_0x3688b6]){_0x3be497[_0x3688b6]=_0x4c9433['data'][0x0][FIELDS[_0x3688b6]]||_0x4c9433[_0x25ac('0x1e')][0x0]['\ufeff'+FIELDS[_0x3688b6]];}}if(!_0x3be497[_0x25ac('0x1f')]){return _0x317813(handleCheckRowError(_0x25ac('0x1d'),_0x25ac('0x20'),null,_0x12d090));}if(!_0x3be497[_0x25ac('0x21')]){return _0x317813(handleCheckRowError(_0x25ac('0x1d'),_0x25ac('0x22'),null,_0x12d090));}if(_0x3be497[_0x25ac('0x23')]){var _0x4ec83f=moment(_0x3be497[_0x25ac('0x23')],_0x25ac('0x24'));if(!_0x4ec83f[_0x25ac('0x25')]()){return _0x317813(handleCheckRowError(_0x25ac('0x1d'),_0x25ac('0x26'),null,_0x12d090));}}if(_0x3be497['email']){if(!isEmail(_0x3be497[_0x25ac('0x27')])){return _0x317813(handleCheckRowError('error',_0x25ac('0x28'),null,_0x12d090));}}_0x3be497[_0x25ac('0x29')]=LISTID;_0x3be497[_0x25ac('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2c9ba5){var _0xde43fa={};for(var _0x5712ac=0x0,_0x9510d1=DUPLICATES[_0x25ac('0x2b')];_0x5712ac<_0x9510d1;_0x5712ac+=0x1){_0xde43fa[DUPLICATES[_0x5712ac]]=_0x3be497[DUPLICATES[_0x5712ac]];}var _0x2badec=_[_0x25ac('0x2c')](_0x2c9ba5,_0xde43fa);if(_0x2badec){return _0x317813(handleCheckRowError(_0x25ac('0x2d'),_0x25ac('0x2e'),_0x2badec,_0x12d090));}}return db[_0x25ac('0x2f')][_0x25ac('0x30')](_0x3be497,{'raw':!![],'hooks':![],'fields':_[_0x25ac('0x31')](_0x3be497)})[_0x25ac('0x32')](function(_0x59e3a0){if(DUPLICATES&&DUPLICATES[_0x25ac('0x2b')]&&_0x2c9ba5){_0x2c9ba5[_0x25ac('0x33')](_[_0x25ac('0x34')](_0x3be497,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x59e3a0['id'];return _0x188387();})[_0x25ac('0x35')](function(_0x1df858){return _0x317813(handleCheckRowError(_0x25ac('0x1d'),_0x25ac('0x36')+(_0x1df858['message']||JSON['stringify'](_0x1df858)),null,_0x12d090));});});}function checkHopper(){function _0x123c88(){return function(_0x27f977){logger[_0x25ac('0x1d')]('cmContact','checkHopper',util[_0x25ac('0x37')](_0x27f977,{'showHidden':![],'depth':null}));};}var _0x34ce1f=function(_0x43f4df,_0x81dfaf){var _0x4ee176=squel['insert']()[_0x25ac('0x38')]('cm_hopper')['fromQuery']([_0x25ac('0x21'),_0x25ac('0x39'),_0x25ac('0x3a'),_0x25ac('0x29'),_0x81dfaf,_0x25ac('0x3b'),'updatedAt'],squel[_0x25ac('0x3c')]()['field']('phone','phone')[_0x25ac('0x3d')]('NOW()','scheduledAt')['field']('id','ContactId')[_0x25ac('0x3d')](LISTID[_0x25ac('0x3e')](),'ListId')[_0x25ac('0x3d')](_0x43f4df['id'][_0x25ac('0x3e')](),_0x81dfaf)[_0x25ac('0x3d')](_0x25ac('0x3f'),_0x25ac('0x3b'))['field'](_0x25ac('0x3f'),_0x25ac('0x40'))[_0x25ac('0x41')](_0x25ac('0x42'))[_0x25ac('0x43')](_0x25ac('0x44'))[_0x25ac('0x43')](_0x25ac('0x45'),LISTID[_0x25ac('0x3e')]())['where'](_0x25ac('0x46'))[_0x25ac('0x43')](_0x25ac('0x47'),squel[_0x25ac('0x3c')]()['field'](_0x25ac('0x21'))[_0x25ac('0x41')](_0x25ac('0x48'))[_0x25ac('0x43')](_0x81dfaf+'\x20=\x20?',_0x43f4df['id'][_0x25ac('0x3e')]())))['toString']();return _0x4ee176;};var _0x4c2cc7=function(_0x45af82,_0x17aa13){var _0x445ede=squel[_0x25ac('0x49')]()[_0x25ac('0x38')]('cm_hopper')['fromQuery']([_0x25ac('0x21'),_0x25ac('0x39'),_0x25ac('0x3a'),_0x25ac('0x29'),_0x17aa13,_0x25ac('0x3b'),_0x25ac('0x40')],squel['select']()[_0x25ac('0x3d')](_0x25ac('0x21'),_0x25ac('0x21'))['field'](_0x25ac('0x3f'),_0x25ac('0x39'))[_0x25ac('0x3d')]('id',_0x25ac('0x3a'))[_0x25ac('0x3d')](LISTID['toString'](),_0x25ac('0x29'))['field'](_0x45af82['id']['toString'](),_0x17aa13)['field'](_0x25ac('0x3f'),'createdAt')[_0x25ac('0x3d')](_0x25ac('0x3f'),_0x25ac('0x40'))[_0x25ac('0x41')](_0x25ac('0x42'))[_0x25ac('0x43')]('deletedAt\x20IS\x20NULL')[_0x25ac('0x43')]('ListId\x20=\x20?',LISTID['toString']())[_0x25ac('0x43')]('id\x20IN\x20?',squel[_0x25ac('0x4a')](hopperContacts))['where'](_0x25ac('0x46'))['where'](_0x25ac('0x47'),squel[_0x25ac('0x3c')]()[_0x25ac('0x3d')](_0x25ac('0x4b'))['from']('cm_hopper_final')['where'](_0x17aa13+_0x25ac('0x4c'),_0x45af82['id'][_0x25ac('0x3e')]()))[_0x25ac('0x43')](_0x25ac('0x47'),squel[_0x25ac('0x3c')]()['field'](_0x25ac('0x21'))[_0x25ac('0x41')]('cm_hopper')['where'](_0x17aa13+_0x25ac('0x4c'),_0x45af82['id'][_0x25ac('0x3e')]())))[_0x25ac('0x3e')]();return _0x445ede;};function _0x234fcc(_0x4e08b0,_0x526dcd){var _0x5dc63d=squel[_0x25ac('0x49')]()[_0x25ac('0x38')](_0x25ac('0x48'))[_0x25ac('0x4d')]([_0x25ac('0x21'),_0x25ac('0x39'),_0x25ac('0x3a'),_0x25ac('0x29'),_0x526dcd,'createdAt',_0x25ac('0x40')],squel[_0x25ac('0x3c')]()['field'](_0x25ac('0x21'),'phone')['field']('NOW()',_0x25ac('0x39'))[_0x25ac('0x3d')]('id',_0x25ac('0x3a'))[_0x25ac('0x3d')](LISTID[_0x25ac('0x3e')](),_0x25ac('0x29'))[_0x25ac('0x3d')](_0x4e08b0['id'][_0x25ac('0x3e')](),_0x526dcd)[_0x25ac('0x3d')](_0x25ac('0x3f'),_0x25ac('0x3b'))[_0x25ac('0x3d')]('NOW()',_0x25ac('0x40'))[_0x25ac('0x41')]('cm_contacts')['where'](_0x25ac('0x44'))['where'](_0x25ac('0x45'),LISTID['toString']())[_0x25ac('0x43')](_0x25ac('0x4e'),squel[_0x25ac('0x4a')](hopperContacts))[_0x25ac('0x43')](_0x25ac('0x46')))['toString']();return _0x5dc63d;}function _0x2736ed(_0x21cf57,_0x272a52){var _0x49faba=squel[_0x25ac('0x49')]()[_0x25ac('0x38')](_0x25ac('0x4f'))[_0x25ac('0x4d')]([_0x25ac('0x21'),_0x25ac('0x3a'),_0x25ac('0x29'),_0x272a52,_0x25ac('0x3b'),'updatedAt'],squel['select']()[_0x25ac('0x3d')](_0x25ac('0x21'),_0x25ac('0x21'))[_0x25ac('0x3d')]('id',_0x25ac('0x3a'))[_0x25ac('0x3d')](LISTID[_0x25ac('0x3e')](),_0x25ac('0x29'))[_0x25ac('0x3d')](_0x21cf57['id'][_0x25ac('0x3e')](),_0x272a52)[_0x25ac('0x3d')](_0x25ac('0x3f'),'createdAt')[_0x25ac('0x3d')](_0x25ac('0x3f'),_0x25ac('0x40'))['from'](_0x25ac('0x42'))[_0x25ac('0x43')]('deletedAt\x20IS\x20NULL')[_0x25ac('0x43')](_0x25ac('0x45'),LISTID['toString']())[_0x25ac('0x43')](_0x25ac('0x4e'),squel['str'](hopperContacts))[_0x25ac('0x43')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x49faba;}return db[_0x25ac('0x50')][_0x25ac('0x51')]({'where':{'type':_0x25ac('0x52')},'attributes':['id',_0x25ac('0x53')],'include':[{'model':db[_0x25ac('0x54')],'as':_0x25ac('0x55'),'where':{'id':LISTID}}]})[_0x25ac('0x32')](function(_0x1d07ca){var _0x448970=[];if(_0x1d07ca){var _0x3313e6;for(var _0x38166a=0x0,_0x446013;_0x38166a<_0x1d07ca[_0x25ac('0x2b')];_0x38166a+=0x1){_0x446013=_0x1d07ca[_0x38166a][_0x25ac('0x56')]({'plain':!![]});switch(_0x446013[_0x25ac('0x53')]){case _0x25ac('0x57'):_0x448970[_0x25ac('0x33')](db[_0x25ac('0x58')][_0x25ac('0x59')](_0x4c2cc7(_0x446013,_0x25ac('0x5a')))['then'](function(){})[_0x25ac('0x35')](_0x123c88()));break;case _0x25ac('0x5b'):_0x448970[_0x25ac('0x33')](db['sequelize'][_0x25ac('0x59')](_0x34ce1f(_0x446013,_0x25ac('0x5a')))['then'](function(){})['catch'](_0x123c88()));break;default:_0x448970[_0x25ac('0x33')](db[_0x25ac('0x58')][_0x25ac('0x59')](_0x234fcc(_0x446013,_0x25ac('0x5a')))[_0x25ac('0x32')](function(){})[_0x25ac('0x35')](_0x123c88()));}}}return _0x448970;})[_0x25ac('0x5c')]()[_0x25ac('0x32')](function(){return db[_0x25ac('0x50')][_0x25ac('0x51')]({'where':{'type':_0x25ac('0x52')},'attributes':['id'],'include':[{'model':db[_0x25ac('0x54')],'as':_0x25ac('0x5d'),'where':{'id':LISTID}}]})[_0x25ac('0x32')](function(_0x9c24e3){var _0x4ac1b9=[];if(_0x9c24e3){var _0x5f3119;for(var _0xd6b2cf=0x0,_0x995bd3;_0xd6b2cf<_0x9c24e3[_0x25ac('0x2b')];_0xd6b2cf+=0x1){_0x995bd3=_0x9c24e3[_0xd6b2cf][_0x25ac('0x56')]({'plain':!![]});_0x4ac1b9[_0x25ac('0x33')](db[_0x25ac('0x58')]['query'](_0x2736ed(_0x995bd3,_0x25ac('0x5a')))[_0x25ac('0x32')](function(){})[_0x25ac('0x35')](_0x123c88()));}}return _0x4ac1b9;})[_0x25ac('0x5c')]();})[_0x25ac('0x32')](function(){return db[_0x25ac('0x5e')]['findAll']({'attributes':['id',_0x25ac('0x53')],'include':[{'model':db[_0x25ac('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x25ac('0x32')](function(_0x2ce004){var _0x2b0a81=[];if(_0x2ce004){for(var _0x2f7e5b=0x0,_0x33863f;_0x2f7e5b<_0x2ce004[_0x25ac('0x2b')];_0x2f7e5b+=0x1){_0x33863f=_0x2ce004[_0x2f7e5b][_0x25ac('0x56')]({'plain':!![]});switch(_0x33863f[_0x25ac('0x53')]){case'always':_0x2b0a81[_0x25ac('0x33')](db['sequelize']['query'](_0x4c2cc7(_0x33863f,_0x25ac('0x5f')))[_0x25ac('0x32')](function(){})['catch'](_0x123c88()));break;case _0x25ac('0x5b'):_0x2b0a81[_0x25ac('0x33')](db[_0x25ac('0x58')][_0x25ac('0x59')](_0x34ce1f(_0x33863f,_0x25ac('0x5f')))['then'](function(){})[_0x25ac('0x35')](_0x123c88()));break;default:_0x2b0a81[_0x25ac('0x33')](db[_0x25ac('0x58')]['query'](_0x234fcc(_0x33863f,_0x25ac('0x5f')))[_0x25ac('0x32')](function(){})[_0x25ac('0x35')](_0x123c88()));}}}return _0x2b0a81;})[_0x25ac('0x5c')]();})['then'](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0x25ac('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x25ac('0x32')](function(_0x332ae8){var _0xf48072=[];if(_0x332ae8){for(var _0x6b201e=0x0,_0x15515c;_0x6b201e<_0x332ae8[_0x25ac('0x2b')];_0x6b201e+=0x1){_0x15515c=_0x332ae8[_0x6b201e]['get']({'plain':!![]});_0xf48072[_0x25ac('0x33')](db[_0x25ac('0x58')][_0x25ac('0x59')](_0x2736ed(_0x15515c,_0x25ac('0x5f')))[_0x25ac('0x32')](function(){})['catch'](_0x123c88()));}}return _0xf48072;})[_0x25ac('0x5c')]();})['catch'](function(_0x5e5564){logger[_0x25ac('0x1d')]('cmContact,\x20%s,\x20%s',_0x25ac('0x60'),_0x5e5564[_0x25ac('0x1b')]);});}var processPromises=function(_0x49cd3d){return BPromise[_0x25ac('0x5c')](promises)['then'](function(_0x5c3a77){})[_0x25ac('0x35')](function(_0x3fc502){logger['error'](_0x25ac('0x61'),JSON[_0x25ac('0x62')](_0x3fc502));})['finally'](function(){socket['emit'](_0x25ac('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x49cd3d){return _0x49cd3d[_0x25ac('0x64')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x25ac('0x32')](function(){socket[_0x25ac('0x65')](_0x25ac('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x25ac('0x66')](FILEPATH);}catch(_0x1c11e0){logger['error'](_0x25ac('0x67'),JSON['stringify'](_0x1c11e0));}finally{process[_0x25ac('0x68')](0x0);}});};process['on'](_0x25ac('0x69'),function(){logger['info'](_0x25ac('0x6a'));endCsv();});function main(){return BPromise[_0x25ac('0x6b')]()[_0x25ac('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x25ac('0x11')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x133643){var _0x4e4176=fs[_0x25ac('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x25ac('0x6d')](_0x4e4176,{'header':!![],'skipEmptyLines':!![],'step':function(_0x32ee95,_0x242368){total+=0x1;var _0x3baa05=total;promises['push'](checkRow(_0x32ee95,_0x133643,_0x3baa05)[_0x25ac('0x32')](function(){success+=0x1;})[_0x25ac('0x35')](function(_0x28b6fe){if(_0x28b6fe[_0x25ac('0x1d')]){errors+=0x1;delete _0x28b6fe[_0x25ac('0x1d')];}else if(_0x28b6fe[_0x25ac('0x2d')]){duplicates+=0x1;delete _0x28b6fe[_0x25ac('0x2d')];}rows[_0x25ac('0x33')](_0x28b6fe);}));if(total%0xc8===0x0){_0x242368[_0x25ac('0x6e')]();return processPromises(_0x242368);}},'complete':function(){return processPromises()[_0x25ac('0x32')](function(){logger[_0x25ac('0x6f')](_0x25ac('0x70'));endCsv();});},'error':function(_0xa2376c,_0x26815a){logger[_0x25ac('0x6f')](_0x25ac('0x71'),JSON[_0x25ac('0x62')](_0xa2376c));endCsv();}});})['catch'](function(_0x59258d){logger[_0x25ac('0x1d')](_0x25ac('0x72'),JSON['stringify'](_0x59258d));});}main(); \ No newline at end of file +var _0x1ebd=['select','field','NOW()','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','id\x20IN\x20?','str','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','BlackLists','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','stringify','finally','emit','resolve','contact:csv_','unlinkSync','SIGINT','info','CmContact','createReadStream','parse','CSV\x20parse\x20error','bluebird','util','papaparse','../../../mysqldb','../../../config/environment','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','duplicate','Duplicate\x20Contact','create','then','push','pick','message','cmContact','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt'];(function(_0x4978dd,_0x12923b){var _0x1e9e7c=function(_0x49fd10){while(--_0x49fd10){_0x4978dd['push'](_0x4978dd['shift']());}};_0x1e9e7c(++_0x12923b);}(_0x1ebd,0x15e));var _0xd1eb=function(_0x2184b6,_0x52ac7e){_0x2184b6=_0x2184b6-0x0;var _0x1c0818=_0x1ebd[_0x2184b6];return _0x1c0818;};'use strict';var BPromise=require(_0xd1eb('0x0'));var util=require(_0xd1eb('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0xd1eb('0x2'));var Redis=require('ioredis');var db=require(_0xd1eb('0x3'))['db'];var config=require(_0xd1eb('0x4'));var logger=require('../../../config/logger')(_0xd1eb('0x5'));config[_0xd1eb('0x6')]=_['defaults'](config[_0xd1eb('0x6')],{'host':_0xd1eb('0x7'),'port':0x18eb});var socket=require(_0xd1eb('0x8'))(new Redis(config[_0xd1eb('0x6')]));require(_0xd1eb('0x9'))[_0xd1eb('0xa')](socket);try{if(!process[_0xd1eb('0xb')][0x2]||process['argv'][0x2]===_0xd1eb('0xc')||process[_0xd1eb('0xb')][0x2]===_0xd1eb('0xd')){throw new Error(_0xd1eb('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0xd1eb('0xb')][0x3]||process[_0xd1eb('0xb')][0x3]===_0xd1eb('0xc')||process['argv'][0x3]===_0xd1eb('0xd')||!process[_0xd1eb('0xb')][0x4]||process[_0xd1eb('0xb')][0x4]==='undefined'||process[_0xd1eb('0xb')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xd1eb('0xf')](process['argv'][0x3][_0xd1eb('0x10')](','),process[_0xd1eb('0xb')][0x4][_0xd1eb('0x10')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0xd1eb('0xc')||process[_0xd1eb('0xb')][0x5]==='null'){throw new Error(_0xd1eb('0x11'));}var LISTID=process[_0xd1eb('0xb')][0x5];var COMPANYID=process[_0xd1eb('0xb')][0x6]&&process['argv'][0x6]!==_0xd1eb('0xc')&&process[_0xd1eb('0xb')][0x6]!==_0xd1eb('0xd')?process[_0xd1eb('0xb')][0x6]:null;var DUPLICATES=process[_0xd1eb('0xb')][0x7]&&process[_0xd1eb('0xb')][0x7]!==_0xd1eb('0xc')&&process['argv'][0x7]!==_0xd1eb('0xd')?process[_0xd1eb('0xb')][0x7]:null;if(!process[_0xd1eb('0xb')][0x8]||process[_0xd1eb('0xb')][0x8]===_0xd1eb('0xc')||process['argv'][0x8]===_0xd1eb('0xd')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xd1eb('0xb')][0x8];}catch(_0x1ae513){logger[_0xd1eb('0x12')](_0x1ae513);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(_0x5b7edf,_0x41b998,_0x4b41d9,_0x20e47b){var _0x55fae9={'message':_0x41b998};_0x55fae9[_0x5b7edf]=!![];if(_0x4b41d9){_0x55fae9[_0xd1eb('0x13')]=_0x4b41d9;}if(_0x20e47b){_0x55fae9[_0xd1eb('0x14')]=_0x20e47b;}return _0x55fae9;}function isEmail(_0x38287b){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))*$/[_0xd1eb('0x15')](_0x38287b);}function checkRow(_0x5db38d,_0x3c2954,_0x5cc2c6){return new BPromise(function(_0x964c4b,_0x1ca550){if(_['isNil'](_0x5db38d)){return _0x1ca550(handleCheckRowError(_0xd1eb('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x5cc2c6));}if(_0x5db38d[_0xd1eb('0x16')]&&_0x5db38d[_0xd1eb('0x16')][_0xd1eb('0x17')]){var _0x5f39d2=_[_0xd1eb('0x18')](_0x5db38d[_0xd1eb('0x16')],'message')[_0xd1eb('0x19')](';');return _0x1ca550(handleCheckRowError(_0xd1eb('0x12'),_0x5f39d2,null,_0x5cc2c6));}var _0x1c8741={};for(var _0xfdf685 in FIELDS){if(FIELDS[_0xd1eb('0x1a')](_0xfdf685)&&FIELDS[_0xfdf685]){_0x1c8741[_0xfdf685]=_0x5db38d[_0xd1eb('0x1b')][0x0][FIELDS[_0xfdf685]]||_0x5db38d[_0xd1eb('0x1b')][0x0]['\ufeff'+FIELDS[_0xfdf685]];}}if(!_0x1c8741[_0xd1eb('0x1c')]){return _0x1ca550(handleCheckRowError(_0xd1eb('0x12'),_0xd1eb('0x1d'),null,_0x5cc2c6));}if(!_0x1c8741['phone']){return _0x1ca550(handleCheckRowError('error',_0xd1eb('0x1e'),null,_0x5cc2c6));}if(_0x1c8741['birthDate']){var _0x4dc709=moment(_0x1c8741[_0xd1eb('0x1f')],_0xd1eb('0x20'));if(!_0x4dc709[_0xd1eb('0x21')]()){return _0x1ca550(handleCheckRowError(_0xd1eb('0x12'),_0xd1eb('0x22'),null,_0x5cc2c6));}}if(_0x1c8741[_0xd1eb('0x23')]){if(!isEmail(_0x1c8741[_0xd1eb('0x23')])){return _0x1ca550(handleCheckRowError('error',_0xd1eb('0x24'),null,_0x5cc2c6));}}_0x1c8741['ListId']=LISTID;_0x1c8741[_0xd1eb('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x3c2954){var _0x1bd5cc={};for(var _0x30cd11=0x0,_0x3ac6e4=DUPLICATES['length'];_0x30cd11<_0x3ac6e4;_0x30cd11+=0x1){_0x1bd5cc[DUPLICATES[_0x30cd11]]=_0x1c8741[DUPLICATES[_0x30cd11]];}var _0x560bd5=_['find'](_0x3c2954,_0x1bd5cc);if(_0x560bd5){return _0x1ca550(handleCheckRowError(_0xd1eb('0x26'),_0xd1eb('0x27'),_0x560bd5,_0x5cc2c6));}}return db['CmContact'][_0xd1eb('0x28')](_0x1c8741,{'raw':!![],'hooks':![],'fields':_['keys'](_0x1c8741)})[_0xd1eb('0x29')](function(_0xef5a3a){if(DUPLICATES&&DUPLICATES[_0xd1eb('0x17')]&&_0x3c2954){_0x3c2954[_0xd1eb('0x2a')](_[_0xd1eb('0x2b')](_0x1c8741,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xef5a3a['id'];return _0x964c4b();})['catch'](function(_0x570212){return _0x1ca550(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x570212[_0xd1eb('0x2c')]||JSON['stringify'](_0x570212)),null,_0x5cc2c6));});});}function checkHopper(){function _0x5f2415(){return function(_0x4c34fe){logger[_0xd1eb('0x12')](_0xd1eb('0x2d'),'checkHopper',util['inspect'](_0x4c34fe,{'showHidden':![],'depth':null}));};}var _0x1c6157=function(_0x567485,_0x429559){var _0x3e3fe5=squel[_0xd1eb('0x2e')]()[_0xd1eb('0x2f')]('cm_hopper')[_0xd1eb('0x30')]([_0xd1eb('0x31'),_0xd1eb('0x32'),_0xd1eb('0x33'),_0xd1eb('0x34'),_0x429559,_0xd1eb('0x35'),'updatedAt'],squel[_0xd1eb('0x36')]()[_0xd1eb('0x37')]('phone','phone')[_0xd1eb('0x37')](_0xd1eb('0x38'),'scheduledAt')['field']('id',_0xd1eb('0x33'))[_0xd1eb('0x37')](LISTID[_0xd1eb('0x39')](),_0xd1eb('0x34'))[_0xd1eb('0x37')](_0x567485['id'][_0xd1eb('0x39')](),_0x429559)[_0xd1eb('0x37')](_0xd1eb('0x38'),_0xd1eb('0x35'))[_0xd1eb('0x37')](_0xd1eb('0x38'),_0xd1eb('0x3a'))[_0xd1eb('0x3b')](_0xd1eb('0x3c'))[_0xd1eb('0x3d')](_0xd1eb('0x3e'))[_0xd1eb('0x3d')]('ListId\x20=\x20?',LISTID['toString']())[_0xd1eb('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xd1eb('0x3d')](_0xd1eb('0x3f'),squel[_0xd1eb('0x36')]()['field']('phone')[_0xd1eb('0x3b')](_0xd1eb('0x40'))[_0xd1eb('0x3d')](_0x429559+_0xd1eb('0x41'),_0x567485['id'][_0xd1eb('0x39')]())))[_0xd1eb('0x39')]();return _0x3e3fe5;};var _0xea1b33=function(_0xfd581c,_0x2a0756){var _0x44c8bb=squel['insert']()[_0xd1eb('0x2f')](_0xd1eb('0x40'))[_0xd1eb('0x30')]([_0xd1eb('0x31'),_0xd1eb('0x32'),_0xd1eb('0x33'),_0xd1eb('0x34'),_0x2a0756,_0xd1eb('0x35'),_0xd1eb('0x3a')],squel[_0xd1eb('0x36')]()[_0xd1eb('0x37')]('phone',_0xd1eb('0x31'))['field'](_0xd1eb('0x38'),_0xd1eb('0x32'))[_0xd1eb('0x37')]('id',_0xd1eb('0x33'))['field'](LISTID[_0xd1eb('0x39')](),_0xd1eb('0x34'))[_0xd1eb('0x37')](_0xfd581c['id'][_0xd1eb('0x39')](),_0x2a0756)[_0xd1eb('0x37')](_0xd1eb('0x38'),_0xd1eb('0x35'))['field'](_0xd1eb('0x38'),_0xd1eb('0x3a'))[_0xd1eb('0x3b')](_0xd1eb('0x3c'))['where'](_0xd1eb('0x3e'))[_0xd1eb('0x3d')]('ListId\x20=\x20?',LISTID[_0xd1eb('0x39')]())['where'](_0xd1eb('0x42'),squel[_0xd1eb('0x43')](hopperContacts))[_0xd1eb('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xd1eb('0x3d')](_0xd1eb('0x3f'),squel[_0xd1eb('0x36')]()[_0xd1eb('0x37')]('calleridnum')['from']('cm_hopper_final')[_0xd1eb('0x3d')](_0x2a0756+_0xd1eb('0x41'),_0xfd581c['id'][_0xd1eb('0x39')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xd1eb('0x37')]('phone')[_0xd1eb('0x3b')](_0xd1eb('0x40'))['where'](_0x2a0756+_0xd1eb('0x41'),_0xfd581c['id'][_0xd1eb('0x39')]())))['toString']();return _0x44c8bb;};function _0x5d2930(_0x554a14,_0x53e135){var _0x21f605=squel[_0xd1eb('0x2e')]()[_0xd1eb('0x2f')]('cm_hopper')[_0xd1eb('0x30')](['phone',_0xd1eb('0x32'),_0xd1eb('0x33'),_0xd1eb('0x34'),_0x53e135,_0xd1eb('0x35'),'updatedAt'],squel['select']()[_0xd1eb('0x37')](_0xd1eb('0x31'),_0xd1eb('0x31'))[_0xd1eb('0x37')]('NOW()','scheduledAt')[_0xd1eb('0x37')]('id','ContactId')[_0xd1eb('0x37')](LISTID[_0xd1eb('0x39')](),_0xd1eb('0x34'))[_0xd1eb('0x37')](_0x554a14['id'][_0xd1eb('0x39')](),_0x53e135)[_0xd1eb('0x37')](_0xd1eb('0x38'),_0xd1eb('0x35'))[_0xd1eb('0x37')](_0xd1eb('0x38'),_0xd1eb('0x3a'))[_0xd1eb('0x3b')]('cm_contacts')[_0xd1eb('0x3d')](_0xd1eb('0x3e'))[_0xd1eb('0x3d')](_0xd1eb('0x44'),LISTID[_0xd1eb('0x39')]())['where'](_0xd1eb('0x42'),squel[_0xd1eb('0x43')](hopperContacts))['where'](_0xd1eb('0x45')))[_0xd1eb('0x39')]();return _0x21f605;}function _0x26c4a9(_0x186785,_0x4112f5){var _0x29eb53=squel[_0xd1eb('0x2e')]()[_0xd1eb('0x2f')](_0xd1eb('0x46'))[_0xd1eb('0x30')]([_0xd1eb('0x31'),_0xd1eb('0x33'),_0xd1eb('0x34'),_0x4112f5,_0xd1eb('0x35'),_0xd1eb('0x3a')],squel[_0xd1eb('0x36')]()[_0xd1eb('0x37')](_0xd1eb('0x31'),'phone')[_0xd1eb('0x37')]('id',_0xd1eb('0x33'))[_0xd1eb('0x37')](LISTID[_0xd1eb('0x39')](),_0xd1eb('0x34'))['field'](_0x186785['id'][_0xd1eb('0x39')](),_0x4112f5)[_0xd1eb('0x37')]('NOW()',_0xd1eb('0x35'))[_0xd1eb('0x37')]('NOW()',_0xd1eb('0x3a'))[_0xd1eb('0x3b')](_0xd1eb('0x3c'))[_0xd1eb('0x3d')]('deletedAt\x20IS\x20NULL')[_0xd1eb('0x3d')]('ListId\x20=\x20?',LISTID['toString']())[_0xd1eb('0x3d')](_0xd1eb('0x42'),squel[_0xd1eb('0x43')](hopperContacts))[_0xd1eb('0x3d')](_0xd1eb('0x45')))[_0xd1eb('0x39')]();return _0x29eb53;}return db[_0xd1eb('0x47')][_0xd1eb('0x48')]({'where':{'type':_0xd1eb('0x49')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xd1eb('0x4a')],'as':'Lists','where':{'id':LISTID}}]})[_0xd1eb('0x29')](function(_0x32f49b){var _0x29b20c=[];if(_0x32f49b){var _0x140f74;for(var _0x1c22ff=0x0,_0x10bc50;_0x1c22ff<_0x32f49b[_0xd1eb('0x17')];_0x1c22ff+=0x1){_0x10bc50=_0x32f49b[_0x1c22ff][_0xd1eb('0x4b')]({'plain':!![]});switch(_0x10bc50[_0xd1eb('0x4c')]){case _0xd1eb('0x4d'):_0x29b20c[_0xd1eb('0x2a')](db[_0xd1eb('0x4e')][_0xd1eb('0x4f')](_0xea1b33(_0x10bc50,_0xd1eb('0x50')))['then'](function(){})[_0xd1eb('0x51')](_0x5f2415()));break;case _0xd1eb('0x52'):_0x29b20c[_0xd1eb('0x2a')](db[_0xd1eb('0x4e')][_0xd1eb('0x4f')](_0x1c6157(_0x10bc50,'VoiceQueueId'))[_0xd1eb('0x29')](function(){})[_0xd1eb('0x51')](_0x5f2415()));break;default:_0x29b20c[_0xd1eb('0x2a')](db[_0xd1eb('0x4e')]['query'](_0x5d2930(_0x10bc50,'VoiceQueueId'))[_0xd1eb('0x29')](function(){})[_0xd1eb('0x51')](_0x5f2415()));}}}return _0x29b20c;})[_0xd1eb('0x53')]()['then'](function(){return db['VoiceQueue'][_0xd1eb('0x48')]({'where':{'type':_0xd1eb('0x49')},'attributes':['id'],'include':[{'model':db[_0xd1eb('0x4a')],'as':_0xd1eb('0x54'),'where':{'id':LISTID}}]})[_0xd1eb('0x29')](function(_0x31d02a){var _0x5d580f=[];if(_0x31d02a){var _0x4c3a91;for(var _0x39c73f=0x0,_0x2d4eaf;_0x39c73f<_0x31d02a[_0xd1eb('0x17')];_0x39c73f+=0x1){_0x2d4eaf=_0x31d02a[_0x39c73f][_0xd1eb('0x4b')]({'plain':!![]});_0x5d580f[_0xd1eb('0x2a')](db['sequelize'][_0xd1eb('0x4f')](_0x26c4a9(_0x2d4eaf,'VoiceQueueId'))[_0xd1eb('0x29')](function(){})[_0xd1eb('0x51')](_0x5f2415()));}}return _0x5d580f;})['all']();})[_0xd1eb('0x29')](function(){return db[_0xd1eb('0x55')][_0xd1eb('0x48')]({'attributes':['id',_0xd1eb('0x4c')],'include':[{'model':db[_0xd1eb('0x4a')],'as':_0xd1eb('0x56'),'where':{'id':LISTID}}]})[_0xd1eb('0x29')](function(_0x101423){var _0x3ecba0=[];if(_0x101423){for(var _0xd1b78a=0x0,_0x254099;_0xd1b78a<_0x101423[_0xd1eb('0x17')];_0xd1b78a+=0x1){_0x254099=_0x101423[_0xd1b78a][_0xd1eb('0x4b')]({'plain':!![]});switch(_0x254099[_0xd1eb('0x4c')]){case _0xd1eb('0x4d'):_0x3ecba0[_0xd1eb('0x2a')](db[_0xd1eb('0x4e')][_0xd1eb('0x4f')](_0xea1b33(_0x254099,'CampaignId'))['then'](function(){})[_0xd1eb('0x51')](_0x5f2415()));break;case'onlyIfOpen':_0x3ecba0[_0xd1eb('0x2a')](db[_0xd1eb('0x4e')]['query'](_0x1c6157(_0x254099,'CampaignId'))['then'](function(){})[_0xd1eb('0x51')](_0x5f2415()));break;default:_0x3ecba0['push'](db['sequelize'][_0xd1eb('0x4f')](_0x5d2930(_0x254099,'CampaignId'))[_0xd1eb('0x29')](function(){})[_0xd1eb('0x51')](_0x5f2415()));}}}return _0x3ecba0;})[_0xd1eb('0x53')]();})[_0xd1eb('0x29')](function(){return db[_0xd1eb('0x55')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd1eb('0x29')](function(_0xcb8cb0){var _0x4803d5=[];if(_0xcb8cb0){for(var _0x155781=0x0,_0x545018;_0x155781<_0xcb8cb0[_0xd1eb('0x17')];_0x155781+=0x1){_0x545018=_0xcb8cb0[_0x155781][_0xd1eb('0x4b')]({'plain':!![]});_0x4803d5[_0xd1eb('0x2a')](db['sequelize']['query'](_0x26c4a9(_0x545018,_0xd1eb('0x57')))['then'](function(){})['catch'](_0x5f2415()));}}return _0x4803d5;})['all']();})[_0xd1eb('0x51')](function(_0x9774ea){logger[_0xd1eb('0x12')](_0xd1eb('0x58'),'generalCheckHopper',_0x9774ea[_0xd1eb('0x2c')]);});}var processPromises=function(_0x362362){return BPromise[_0xd1eb('0x53')](promises)[_0xd1eb('0x29')](function(_0x5bef42){})[_0xd1eb('0x51')](function(_0x822761){logger[_0xd1eb('0x12')]('Error\x20processing\x20rows\x20block:',JSON[_0xd1eb('0x59')](_0x822761));})[_0xd1eb('0x5a')](function(){socket[_0xd1eb('0x5b')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x362362){return _0x362362['resume']();}});};var endCsv=function(){return BPromise[_0xd1eb('0x5c')]()[_0xd1eb('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0xd1eb('0x29')](function(){socket[_0xd1eb('0x5b')](_0xd1eb('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xd1eb('0x5e')](FILEPATH);}catch(_0x362459){logger[_0xd1eb('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x362459));}finally{process['exit'](0x0);}});};process['on'](_0xd1eb('0x5f'),function(){logger[_0xd1eb('0x60')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xd1eb('0x5c')]()[_0xd1eb('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xd1eb('0x61')][_0xd1eb('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xd1eb('0x29')](function(_0x36f773){var _0x345323=fs[_0xd1eb('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xd1eb('0x63')](_0x345323,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4a583a,_0x358c9d){total+=0x1;var _0x96e95=total;promises[_0xd1eb('0x2a')](checkRow(_0x4a583a,_0x36f773,_0x96e95)['then'](function(){success+=0x1;})[_0xd1eb('0x51')](function(_0xdeae92){if(_0xdeae92[_0xd1eb('0x12')]){errors+=0x1;delete _0xdeae92['error'];}else if(_0xdeae92[_0xd1eb('0x26')]){duplicates+=0x1;delete _0xdeae92['duplicate'];}rows[_0xd1eb('0x2a')](_0xdeae92);}));if(total%0xc8===0x0){_0x358c9d['pause']();return processPromises(_0x358c9d);}},'complete':function(){return processPromises()[_0xd1eb('0x29')](function(){logger[_0xd1eb('0x60')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x5b3887,_0x1191e4){logger[_0xd1eb('0x60')](_0xd1eb('0x64'),JSON[_0xd1eb('0x59')](_0x5b3887));endCsv();}});})[_0xd1eb('0x51')](function(_0x2774ff){logger[_0xd1eb('0x12')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xd1eb('0x59')](_0x2774ff));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 926cd04..05b8fe3 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 _0xed75=['voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','sequelize','timezones','dialTimezone','utcOffset','set','offset','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ContactId','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','errors','code','message','query','spread','catch','error','campaigns.dialTimezone','campaigns','voice_queues.dialTimezone','voice_queues'];(function(_0x2624e,_0x1de3b8){var _0x4793d5=function(_0x1e992d){while(--_0x1e992d){_0x2624e['push'](_0x2624e['shift']());}};_0x4793d5(++_0x1de3b8);}(_0xed75,0x1ac));var _0x5ed7=function(_0x12b5f6,_0x2c7184){_0x12b5f6=_0x12b5f6-0x0;var _0x4824ad=_0xed75[_0x12b5f6];return _0x4824ad;};'use strict';var fs=require('fs');var path=require(_0x5ed7('0x0'));var _=require(_0x5ed7('0x1'));var Papa=require(_0x5ed7('0x2'));var util=require(_0x5ed7('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x5ed7('0x4'));var Redis=require(_0x5ed7('0x5'));var db=require(_0x5ed7('0x6'))['db'];var config=require('../../../config/environment');var shared=require(_0x5ed7('0x7'));var logger=require(_0x5ed7('0x8'))(_0x5ed7('0x9'));config[_0x5ed7('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5ed7('0xb'))(new Redis(config[_0x5ed7('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5ed7('0xc')](_0x5ed7('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5ed7('0xc')](_0x5ed7('0xd'));function isEmail(_0x4ad383){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))*$/[_0x5ed7('0xe')](_0x4ad383);}function selectNotIn(_0x3c0a1b,_0x29c242,_0x4382cc,_0x56fb54,_0x1c7a46){return squel[_0x5ed7('0xf')]()[_0x5ed7('0x10')](_0x5ed7('0x11'))[_0x5ed7('0x12')](_0x56fb54)[_0x5ed7('0x13')](_0x29c242,null,_0x29c242+_0x5ed7('0x14')+_0x56fb54+'.'+_0x4382cc)[_0x5ed7('0x15')](_0x56fb54+'.'+_0x4382cc+'\x20=\x20'+_0x3c0a1b+'.'+_0x4382cc)[_0x5ed7('0x15')](_0x29c242+_0x5ed7('0x16')+_0x1c7a46['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2e46aa,_0x5b49a2){promisesAdditionalPhones=[];return db[_0x5ed7('0x17')][_0x5ed7('0x18')]({'raw':!![],'attributes':['id',_0x5ed7('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5ed7('0x1a')](function(_0x5ab8be){if(_0x5ab8be!==null){var _0x5534d6=[];for(var _0x2c7c69=0x0;_0x2c7c69<_0x5ab8be[_0x5ed7('0x1b')];_0x2c7c69++){var _0x5545d5=_0x5ab8be[_0x2c7c69];_0x5534d6[_0x5ed7('0x1c')](insertAdditionalPhones(_0x5545d5));}}Promise[_0x5ed7('0x1d')](_0x5534d6)[_0x5ed7('0x1a')](function(){_0x2e46aa({'val':0x1});});});});}function insertAdditionalPhones(_0x1fac00){return new Promise(function(_0x3a89f7,_0x34a406){var _0x1126d1=_0x1fac00[_0x5ed7('0x19')];var _0x5bed3d=_0x1126d1[_0x5ed7('0x1e')](';');var _0x368fdf=[];orderBy=0x0;for(var _0x508ebe=0x0;_0x508ebe<_0x5bed3d[_0x5ed7('0x1b')];_0x508ebe++){_0x368fdf[_0x5ed7('0x1c')](splitAdditionalPhone(_0x1fac00['id'],_0x5bed3d[_0x508ebe]));}Promise['all'](_0x368fdf)[_0x5ed7('0x1a')](function(){_0x3a89f7({'val':_0x5bed3d['length']});});});}function splitAdditionalPhone(_0x782d3c,_0x58ca20){return new Promise(function(_0x4a9cb4,_0x516ca0){var _0x1132a5=_0x58ca20[_0x5ed7('0x1e')](':');var _0x15a1a1=_0x1132a5[0x0];var _0x4807bd=_0x1132a5[0x1];if(!_[_0x5ed7('0x1f')](_0x4807bd)){var _0x42f949=_0x4807bd[_0x5ed7('0x1e')]('|');var _0x3cba70=[];for(var _0x159ea8=0x0;_0x159ea8<_0x42f949['length'];_0x159ea8++){if(_0x42f949[_0x159ea8]!==''){var _0x28482e=_[_0x5ed7('0x20')](promisesAdditionalPhones,{'contactId':_0x782d3c,'phone':_0x42f949[_0x159ea8]});if(_0x28482e[_0x5ed7('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x5ed7('0x1c')]({'contactId':_0x782d3c,'contactTypeId':_0x15a1a1,'phone':_0x42f949[_0x159ea8],'orderBy':orderBy});}}}_0x4a9cb4({'ok':0x1});}else _0x4a9cb4({'res':0x0});});}function createAdditionalPhone(_0x3f82c3,_0x5dd22f,_0x527f12,_0x339b84){var _0x448529='';var _0x46398d='';var _0x8e2bfe=_0x527f12[_0x5ed7('0x1e')]('§');_0x448529=_0x8e2bfe[0x0];if(_0x8e2bfe[_0x5ed7('0x1b')]==0x2)_0x46398d=_0x8e2bfe[0x1];return new Promise(function(_0x19d338,_0x46b65d){return db[_0x5ed7('0x21')][_0x5ed7('0x22')]({'where':{'CmContactId':_0x3f82c3,'item':_0x448529}})[_0x5ed7('0x1a')](function(_0x14424a){if(_0x14424a){return db[_0x5ed7('0x21')][_0x5ed7('0x23')]({'ItemTypeId':_0x5dd22f,'description':_0x46398d,'OrderBy':_0x339b84},{'where':{'CmContactId':_0x3f82c3,'item':_0x448529}})[_0x5ed7('0x1a')](function(_0x5339f1){_0x19d338({'res':'updated'});});}else{return db[_0x5ed7('0x21')][_0x5ed7('0x24')]({'CmContactId':_0x3f82c3,'item':_0x448529,'description':_0x46398d,'ItemTypeId':_0x5dd22f,'OrderBy':_0x339b84,'ItemClass':_0x5ed7('0x25')})[_0x5ed7('0x1a')](function(_0x3acf5c){_0x19d338({'res':_0x5ed7('0x26')});});}});});}function insertCmHopper(_0x48e5e8,_0x1dd168,_0x179c3d,_0x2aa1d0,_0x447321){var _0x3d1eee=[_0x5ed7('0x27'),'cm_contacts.scheduledat',_0x5ed7('0x28'),'cm_contacts.ListId',_0x1dd168+'.'+_0x2aa1d0,_0x5ed7('0x29'),_0x5ed7('0x2a'),_0x5ed7('0x2b'),_0x5ed7('0x2c'),'\x22'+_0x447321+'\x22'];return squel[_0x5ed7('0x2d')]()[_0x5ed7('0x2e')](_0x5ed7('0x2f'))[_0x5ed7('0x30')]([_0x5ed7('0x11'),_0x5ed7('0x31'),'ContactId',_0x5ed7('0x32'),_0x2aa1d0,_0x5ed7('0x33'),_0x5ed7('0x34'),_0x5ed7('0x35'),_0x5ed7('0x36'),_0x5ed7('0x37')],squel[_0x5ed7('0xf')]()[_0x5ed7('0x38')](_0x3d1eee)['from'](_0x1dd168)[_0x5ed7('0x13')](_0x5ed7('0x39'),null,_0x5ed7('0x3a')+_0x1dd168+_0x5ed7('0x3b'))[_0x5ed7('0x13')](_0x179c3d,null,_0x179c3d+_0x5ed7('0x14')+_0x1dd168+'.'+_0x2aa1d0)[_0x5ed7('0x15')](_0x1dd168+_0x5ed7('0x3c'),_0x48e5e8)[_0x5ed7('0x15')](_0x5ed7('0x3d'),NOW)[_0x5ed7('0x15')](_0x5ed7('0x3e'),selectNotIn(_0x1dd168,_0x179c3d,_0x2aa1d0,_0x5ed7('0x2f'),[_0x5ed7('0x3f'),_0x5ed7('0x40')]))[_0x5ed7('0x15')](_0x5ed7('0x3e'),selectNotIn(_0x1dd168,_0x179c3d,_0x2aa1d0,_0x5ed7('0x2f'),[_0x5ed7('0x3f')])))[_0x5ed7('0x41')]();}function insertCmHopperBlack(_0x53b5dc,_0x3b48a5,_0x4bcc7f,_0x51d3c3){var _0x349afc=[_0x5ed7('0x27'),_0x5ed7('0x28'),'cm_contacts.ListId',_0x3b48a5+'.'+_0x51d3c3,_0x5ed7('0x29'),'cm_contacts.updatedAt'];return squel[_0x5ed7('0x2d')]()[_0x5ed7('0x2e')](_0x5ed7('0x42'))[_0x5ed7('0x30')]([_0x5ed7('0x11'),_0x5ed7('0x43'),_0x5ed7('0x32'),_0x51d3c3,_0x5ed7('0x33'),_0x5ed7('0x34')],squel['select']()[_0x5ed7('0x38')](_0x349afc)[_0x5ed7('0x12')](_0x3b48a5)[_0x5ed7('0x13')]('cm_contacts',null,_0x5ed7('0x3a')+_0x3b48a5+_0x5ed7('0x3b'))[_0x5ed7('0x13')](_0x4bcc7f,null,_0x4bcc7f+_0x5ed7('0x14')+_0x3b48a5+'.'+_0x51d3c3)[_0x5ed7('0x15')](_0x3b48a5+_0x5ed7('0x3c'),_0x53b5dc)[_0x5ed7('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x5ed7('0x3e'),squel[_0x5ed7('0xf')]()['field']('phone')[_0x5ed7('0x12')]('cm_hopper_black')[_0x5ed7('0x15')](_0x5ed7('0x44'),_0x53b5dc)[_0x5ed7('0x15')](_0x51d3c3+'\x20=\x20'+_0x3b48a5+'.'+_0x51d3c3)))[_0x5ed7('0x41')]();}function insertTzCmHopper(_0x34025a,_0x2a59a4,_0x47404c,_0x8cbea7,_0x2777bf,_0x429c91){var _0x2c2582=[_0x5ed7('0x27'),_0x5ed7('0x45')+_0x429c91+_0x5ed7('0x46'),_0x5ed7('0x28'),'cm_contacts.ListId',_0x2a59a4+'.'+_0x8cbea7,_0x5ed7('0x29'),_0x5ed7('0x2a'),_0x5ed7('0x2b'),'cm_contacts.UserId','\x22'+_0x2777bf+'\x22'];var _0x5894d7=squel[_0x5ed7('0x2d')]()[_0x5ed7('0x2e')](_0x5ed7('0x2f'))[_0x5ed7('0x30')]([_0x5ed7('0x11'),'scheduledat','ContactId',_0x5ed7('0x32'),_0x8cbea7,_0x5ed7('0x33'),_0x5ed7('0x34'),_0x5ed7('0x35'),'UserId','recallme'],squel[_0x5ed7('0xf')]()['fields'](_0x2c2582)[_0x5ed7('0x12')](_0x2a59a4)['join'](_0x5ed7('0x39'),null,_0x5ed7('0x3a')+_0x2a59a4+'.CmListId')[_0x5ed7('0x13')](_0x47404c,null,_0x47404c+_0x5ed7('0x14')+_0x2a59a4+'.'+_0x8cbea7)['join'](_0x429c91,null,_0x429c91+_0x5ed7('0x14')+_0x2a59a4+'.'+_0x8cbea7)[_0x5ed7('0x15')](_0x2a59a4+_0x5ed7('0x3c'),_0x34025a)[_0x5ed7('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x5ed7('0x3e'),selectNotIn(_0x2a59a4,_0x47404c,_0x8cbea7,_0x5ed7('0x2f'),[_0x5ed7('0x3f'),_0x5ed7('0x40')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a59a4,_0x47404c,_0x8cbea7,_0x5ed7('0x2f'),[_0x5ed7('0x3f')])))[_0x5ed7('0x41')]();return _0x5894d7;}function insertTzCmHopperBlack(_0x61e73a,_0x31b410,_0x2dd231,_0xf1ee7){var _0x35c8c9=[_0x5ed7('0x27'),_0x5ed7('0x28'),'cm_contacts.ListId',_0x31b410+'.'+_0xf1ee7,'cm_contacts.createdAt',_0x5ed7('0x2a')];return squel[_0x5ed7('0x2d')]()['into'](_0x5ed7('0x42'))['fromQuery']([_0x5ed7('0x11'),'ContactId',_0x5ed7('0x32'),_0xf1ee7,_0x5ed7('0x33'),_0x5ed7('0x34')],squel[_0x5ed7('0xf')]()[_0x5ed7('0x38')](_0x35c8c9)[_0x5ed7('0x12')](_0x31b410)[_0x5ed7('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x31b410+_0x5ed7('0x3b'))[_0x5ed7('0x13')](_0x2dd231,null,_0x2dd231+'.id\x20=\x20'+_0x31b410+'.'+_0xf1ee7)[_0x5ed7('0x15')](_0x31b410+_0x5ed7('0x3c'),_0x61e73a)[_0x5ed7('0x15')](_0x5ed7('0x3d'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x5ed7('0xf')]()['field']('phone')[_0x5ed7('0x12')](_0x5ed7('0x42'))[_0x5ed7('0x15')](_0x5ed7('0x44'),_0x61e73a)[_0x5ed7('0x15')](_0xf1ee7+'\x20=\x20'+_0x31b410+'.'+_0xf1ee7)))[_0x5ed7('0x41')]();}function insertCmHopperAdditionalPhones(_0x2ecc03){var _0x269302=[_0x5ed7('0x47'),_0x5ed7('0x48'),_0x5ed7('0x49'),'cm_contact_has_items.createdAt',_0x5ed7('0x4a')];return squel[_0x5ed7('0x2d')]()['into'](_0x5ed7('0x4b'))[_0x5ed7('0x30')]([_0x5ed7('0x4c'),_0x5ed7('0x11'),_0x5ed7('0x4d'),_0x5ed7('0x33'),_0x5ed7('0x34')],squel[_0x5ed7('0xf')]()[_0x5ed7('0x38')](_0x269302)[_0x5ed7('0x12')]('cm_hopper')[_0x5ed7('0x13')](_0x5ed7('0x39'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x5ed7('0x13')](_0x5ed7('0x4e'),null,_0x5ed7('0x4f'))[_0x5ed7('0x15')](_0x5ed7('0x50'),_0x2ecc03)['where'](_0x5ed7('0x3d'),NOW))[_0x5ed7('0x41')]();}function insertCmContact(_0x40a246,_0xfcf670,_0x24c360,_0x806049){var _0x5c9a68=_['concat'](_[_0x5ed7('0x51')](_0x806049),['ListId',_0x5ed7('0x52'),'createdAt',_0x5ed7('0x34'),'scheduledAt']);return squel['insert']()[_0x5ed7('0x2e')](_0x5ed7('0x39'))[_0x5ed7('0x30')](_0x5c9a68,squel[_0x5ed7('0xf')]()[_0x5ed7('0x38')](_0x5c9a68)['from'](_0xfcf670)[_0x5ed7('0x15')]('('+_0x24c360['join'](',')+_0x5ed7('0x53'),squel[_0x5ed7('0xf')]()[_0x5ed7('0x38')](_0x24c360)['from'](_0x5ed7('0x39'))[_0x5ed7('0x15')](_0x5ed7('0x44'),_0x40a246)[_0x5ed7('0x15')](_0x5ed7('0x54')))['where'](_0x5ed7('0x55'),squel['select']()[_0x5ed7('0x10')]('MIN(id)',_0x5ed7('0x56'))[_0x5ed7('0x12')](_0xfcf670)[_0x5ed7('0x57')](_0x24c360[_0x5ed7('0x13')](','))))[_0x5ed7('0x41')]();}function handleStop(){logger[_0x5ed7('0x58')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4b5f0e){logger['error'](_0x4b5f0e['message']);process['exit'](0x1);}function handleError(_0x51e95a,_0x30d7f9){stats[_0x5ed7('0x59')][_0x5ed7('0x1c')]({'name':_0x30d7f9[_0x5ed7('0x5a')],'message':_0x30d7f9[_0x5ed7('0x5b')],'row':_0x51e95a});}function handleQuery(_0x3dc131){logger[_0x5ed7('0x58')](_0x3dc131);return db['sequelize'][_0x5ed7('0x5c')](_0x3dc131)[_0x5ed7('0x5d')](function(_0x56043a){results['push'](_0x56043a);})[_0x5ed7('0x5e')](function(_0x1dbcb5){logger[_0x5ed7('0x5f')](_0x1dbcb5[_0x5ed7('0x5b')]);});}function updateTzCampaigns(_0x469edb){return new Promise(function(_0x3d5ada,_0x1b0472){var _0x9e62f1=squel['select']()[_0x5ed7('0x38')](['campaigns.id',_0x5ed7('0x60')])[_0x5ed7('0x12')](_0x5ed7('0x61'))[_0x5ed7('0x13')]('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x5ed7('0x15')]('campaigns_has_cm_lists.CmListId='+_0x469edb);db['sequelize'][_0x5ed7('0x5c')](_0x9e62f1[_0x5ed7('0x41')]())[_0x5ed7('0x5d')](function(_0xb7bcd){var _0x4d59b6=[];for(var _0x556506=0x0;_0x556506<_0xb7bcd[_0x5ed7('0x1b')];_0x556506++){_0x4d59b6[_0x5ed7('0x1c')](getTimezoneData(_0xb7bcd[_0x556506],tmp_campaigns));}BPromise['all'](_0x4d59b6)[_0x5ed7('0x1a')](function(){_0x3d5ada({'val':0x1});});})['catch'](function(_0x2098a6){logger[_0x5ed7('0x5f')](_0x2098a6[_0x5ed7('0x5b')]);_0x3d5ada({'val':0x0});});});}function updateTzVoiceQueues(_0x491df3){return new Promise(function(_0x19362d,_0x3a4db1){var _0x56e6ff=squel[_0x5ed7('0xf')]()[_0x5ed7('0x38')](['voice_queues.id',_0x5ed7('0x62')])[_0x5ed7('0x12')](_0x5ed7('0x63'))['join']('voice_queues_has_cm_lists',null,_0x5ed7('0x64'))['where']('voice_queues_has_cm_lists.CmListId='+_0x491df3);db[_0x5ed7('0x65')][_0x5ed7('0x5c')](_0x56e6ff[_0x5ed7('0x41')]())[_0x5ed7('0x5d')](function(_0x1245b0){var _0x2ec27b=[];for(var _0x52223e=0x0;_0x52223e<_0x1245b0[_0x5ed7('0x1b')];_0x52223e++){_0x2ec27b[_0x5ed7('0x1c')](getTimezoneData(_0x1245b0[_0x52223e],tmp_voice_queues));}BPromise[_0x5ed7('0x1d')](_0x2ec27b)[_0x5ed7('0x1a')](function(){_0x19362d({'val':0x1});});})[_0x5ed7('0x5e')](function(_0x34117d){logger[_0x5ed7('0x5f')](_0x34117d[_0x5ed7('0x5b')]);_0x19362d({'val':0x0});});});}function getTimezoneData(_0x4e5d1c,_0x40baf7){return new Promise(function(_0x425be1,_0x15b38e){var _0x540879=shared[_0x5ed7('0x66')];var _0x594e1e=_0x540879[_0x4e5d1c[_0x5ed7('0x67')]];if(_[_0x5ed7('0x1f')](_0x594e1e)){_0x425be1({'ret':0x1});}else{var _0x24e988=_0x594e1e[_0x5ed7('0x68')];var _0x4fd695=squel[_0x5ed7('0x2d')]()[_0x5ed7('0x2e')](_0x40baf7)[_0x5ed7('0x69')]('id',_0x4e5d1c['id'])[_0x5ed7('0x69')](_0x5ed7('0x6a'),_0x24e988)[_0x5ed7('0x69')](_0x5ed7('0x67'),_0x4e5d1c[_0x5ed7('0x67')])['toString']();return db[_0x5ed7('0x65')]['query'](_0x4fd695)[_0x5ed7('0x5d')](function(_0x502f24){_0x425be1({'ret':0x1});})[_0x5ed7('0x5e')](function(_0x368531){logger[_0x5ed7('0x5f')](_0x368531[_0x5ed7('0x5b')]);_0x15b38e({'ret':0x1});});}});}function handleTZQuery(_0x4bec92){logger['info'](_0x4bec92);return db[_0x5ed7('0x65')][_0x5ed7('0x5c')](_0x4bec92)[_0x5ed7('0x5d')](function(_0x2f8781){})[_0x5ed7('0x5e')](function(_0x1f41c7){logger[_0x5ed7('0x5f')](_0x1f41c7[_0x5ed7('0x5b')]);});}function main(_0x4b446d,_0x347e1f,_0x192ae5,_0x10284b){logger[_0x5ed7('0x58')]('main',_0x4b446d,JSON[_0x5ed7('0x6b')](_0x347e1f));process[_0x5ed7('0x6c')](_0x5ed7('0x6d'));var _0x4064d4=_0x347e1f[_0x5ed7('0x6e')];var _0x490333=_['clone'](_0x4064d4);var _0x5ccdb0=_0x347e1f[_0x5ed7('0x6f')];var _0x3cece0=path[_0x5ed7('0x13')](config[_0x5ed7('0x70')],_0x5ed7('0x71'),_0x5ccdb0+_0x5ed7('0x72'));hasTZ=_[_0x5ed7('0x51')](_0x4064d4)[_0x5ed7('0x73')](_0x5ed7('0x67'));var _0x373ab7=_[_0x5ed7('0x51')](_0x4064d4)[_0x5ed7('0x13')]();logger[_0x5ed7('0x58')](_0x5ed7('0x74'),_0x373ab7);db[_0x5ed7('0x75')][_0x5ed7('0x18')]({'raw':!![],'attributes':['id',_0x5ed7('0x76')]})['then'](function(_0x11c6c9){for(var _0x111626=0x0;_0x111626<_0x11c6c9[_0x5ed7('0x1b')];_0x111626++){if(_0x11c6c9[_0x111626][_0x5ed7('0x76')]in _0x4064d4){contactItemTypes['push'](_0x11c6c9[_0x111626]);delete _0x490333[_0x11c6c9[_0x111626][_0x5ed7('0x76')]];hasAdditionalPhones=!![];}for(var _0x4b3c26 in _0x4064d4){if(_0x11c6c9[_0x111626][_0x5ed7('0x76')]+_0x5ed7('0x77')===_0x4b3c26){phoneDescriptions[_0x5ed7('0x1c')]({'itemTypeId':_0x11c6c9[_0x111626]['id'],'description':_0x4b3c26});delete _0x490333[_0x4b3c26];}}}if(hasAdditionalPhones)_0x490333[_0x5ed7('0x19')]='';var _0xd9e42b=_[_0x5ed7('0x51')](_0x490333)[_0x5ed7('0x13')]();logger['info'](_0x5ed7('0x74'),_0xd9e42b);fs[_0x5ed7('0x78')](_0x3cece0,_0xd9e42b+'\x0a');Papa[_0x5ed7('0x79')](fs[_0x5ed7('0x7a')](_0x4b446d),{'header':!![],'skipEmptyLines':!![],'step':function(_0xfd9f8f,_0x25e4b0){try{for(var _0x445fb4=0x0,_0x1e879f=[];_0x445fb4<_0xfd9f8f[_0x5ed7('0x7b')][_0x5ed7('0x1b')];_0x445fb4++){stats[_0x5ed7('0x7c')]+=0x1;if(_0xfd9f8f['errors'][_0x445fb4]){handleError(_0xfd9f8f[_0x5ed7('0x7b')][_0x445fb4],_0xfd9f8f[_0x5ed7('0x59')][_0x445fb4]);}else{var _0x3bef54=[];var _0x49f7f6=[];var _0x191b5a={};for(var _0x366bca in _0x4064d4){let _0x20053e=contactItemTypes[_0x5ed7('0x7d')](_0x5ebcc9=>_0x5ebcc9[_0x5ed7('0x76')]===_0x366bca);let _0x33a5f5=contactItemTypes['find'](_0xd5cf22=>_0xd5cf22[_0x5ed7('0x76')]+'_description'===_0x366bca);if(_[_0x5ed7('0x1f')](_0x20053e)&&_['isNil'](_0x33a5f5)){if(_0x4064d4[_0x5ed7('0x7e')](_0x366bca)){if(_0xfd9f8f[_0x5ed7('0x7b')][_0x445fb4][_0x4064d4[_0x366bca]]){var _0x10daee=_[_0x5ed7('0x7f')](_0xfd9f8f['data'][_0x445fb4][_0x4064d4[_0x366bca]][_0x5ed7('0x80')](/"/g,'\x27'));switch(_0x366bca){case _0x5ed7('0x31'):var _0x125620=moment(_0x10daee,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x125620[_0x5ed7('0x81')]()){_0x1e879f[_0x5ed7('0x1c')]('\x22'+_0x10daee+'\x22');}else{_0x3bef54['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x5ed7('0x35'):var _0x170bce=parseInt(_0x10daee);_0x10daee=_[_0x5ed7('0x82')](_0x170bce)||_0x170bce<0x0||_0x170bce>0x4?_0x10284b?0x3:0x2:_0x170bce;_0x1e879f['push']('\x22'+_0x10daee+'\x22');break;case _0x5ed7('0x36'):var _0x4075eb=parseInt(_0x10daee);if(_[_0x5ed7('0x83')](_0x4075eb)&&_[_0x5ed7('0x73')](_0x192ae5,_0x4075eb)){_0x1e879f[_0x5ed7('0x1c')]('\x22'+_0x4075eb+'\x22');}else{_0x3bef54[_0x5ed7('0x1c')]('agent\x20not\x20exists');}break;case _0x5ed7('0x84'):if(isEmail(_0x10daee)){_0x1e879f[_0x5ed7('0x1c')]('\x22'+_0x10daee+'\x22');}else{_0x3bef54[_0x5ed7('0x1c')](_0x5ed7('0x85'));}break;case _0x5ed7('0x86'):var _0x473c3e=moment(_0x10daee,_0x5ed7('0x87'),!![]);if(_0x473c3e[_0x5ed7('0x81')]()){_0x1e879f[_0x5ed7('0x1c')]('\x22'+_0x10daee+'\x22');}else{_0x3bef54['push'](_0x5ed7('0x88'));}break;case'dialTimezone':var _0x479f2f=shared[_0x5ed7('0x66')];var _0x4a2fa0=_0x479f2f[_0x10daee];if(!_['isNil'](_0x4a2fa0)){var _0x35beae=_0x4a2fa0['utcOffset'];_0x1e879f[_0x5ed7('0x1c')]('\x22'+_0x10daee+'\x22');_0x1e879f['push']('\x22'+_0x35beae+'\x22');}break;default:_0x1e879f[_0x5ed7('0x1c')]('\x22'+_0x10daee+'\x22');}}else{switch(_0x366bca){case _0x5ed7('0x89'):case'phone':_0x3bef54[_0x5ed7('0x1c')](_0x366bca+'\x20not\x20specified');break;default:_0x1e879f[_0x5ed7('0x1c')]('\x22\x22');}}}}else{var _0x2ea19b='';if(!_[_0x5ed7('0x1f')](_0x20053e)){if(!_0x191b5a[_0x5ed7('0x7e')](_0x20053e['id'])){if(!_[_0x5ed7('0x1f')](_0xfd9f8f[_0x5ed7('0x7b')][_0x445fb4][_0x4064d4[_0x366bca]])){var _0x10daee=_['trim'](_0xfd9f8f[_0x5ed7('0x7b')][_0x445fb4][_0x4064d4[_0x366bca]][_0x5ed7('0x80')](/"/g,'\x27'));var _0x1a7be9=phoneDescriptions[_0x5ed7('0x7d')](_0xc3559c=>_0xc3559c[_0x5ed7('0x8a')]===_0x20053e['id']);if(!_['isNil'](_0x1a7be9)){var _0x243ed8=_[_0x5ed7('0x7f')](_0xfd9f8f[_0x5ed7('0x7b')][_0x445fb4][_0x4064d4[_0x1a7be9[_0x5ed7('0x8b')]]]['replace'](/"/g,'\x27'));if(!_[_0x5ed7('0x1f')](_0x243ed8))_0x10daee=_0x10daee+'§'+_0x243ed8;}if(_0x2ea19b=='')_0x2ea19b=_0x10daee;else _0x2ea19b+='|'+_0x10daee;}_0x49f7f6[_0x5ed7('0x1c')](_0x20053e['id']+':'+_0x2ea19b);_0x191b5a[_0x20053e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1e879f[_0x5ed7('0x1c')]('\x22'+_0x49f7f6[_0x5ed7('0x13')](';')+'\x22');}if(_0x3bef54['length']){handleError(_0xfd9f8f['data'][_0x445fb4],{'code':_0x5ed7('0x8c'),'message':_0x3bef54['join']()});}else{fs['appendFileSync'](_0x3cece0,_0x1e879f[_0x5ed7('0x13')]()+'\x0a');}_0x1e879f=[];}if(!(stats[_0x5ed7('0x7c')]%0xc8)){socket[_0x5ed7('0x8d')](_0x5ed7('0x8e')+_0x5ccdb0,stats);stats[_0x5ed7('0x59')]=[];}}if(stopped){logger['info'](_0x5ed7('0x8f'));_0x25e4b0['abort']();}}catch(_0x1a9c57){handleError(_0xfd9f8f[_0x5ed7('0x7b')][_0x445fb4],{'code':'SystemError','message':_0x1a9c57[_0x5ed7('0x5b')]});logger[_0x5ed7('0x5f')](_0x5ed7('0x90'),_0x1a9c57[_0x5ed7('0x5b')]);}},'complete':function(){try{var _0x5d11e5=[];var _0x624458=[];var _0x3e7bd6=_0x5ed7('0x39');if(_0x347e1f[_0x5ed7('0x91')]&&_0x347e1f[_0x5ed7('0x91')]['length']){_0x3e7bd6='cm_contacts_'+_0x5ccdb0;_0x5d11e5[_0x5ed7('0x1c')](_0x5ed7('0x92')+_0x3e7bd6+_0x5ed7('0x93'));}tmp_campaigns='campaigns_'+_0x5ccdb0;tmp_voice_queues='voice_queues_'+_0x5ccdb0;_0x624458[_0x5ed7('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x624458[_0x5ed7('0x1c')](_0x5ed7('0x92')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x5ed7('0x94')](_0x624458,handleTZQuery)[_0x5ed7('0x1a')](function(_0x4f331e){updateTzCampaigns(_0x347e1f['ListId'])[_0x5ed7('0x1a')](function(_0x3e1f38){updateTzVoiceQueues(_0x347e1f[_0x5ed7('0x32')])[_0x5ed7('0x1a')](function(_0xd5be24){if(hasTZ)_0xd9e42b=_0xd9e42b[_0x5ed7('0x80')](_0x5ed7('0x67'),_0x5ed7('0x95'));var _0x562dd5=util['format'](_0x5ed7('0x96'),_0x3cece0,_0x3e7bd6,_0xd9e42b,_0x347e1f['ListId'],_0x347e1f['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x4064d4[_0x5ed7('0x31')])){_0x562dd5+=',\x20scheduledAt\x20=\x20NOW()';}_0x5d11e5[_0x5ed7('0x1c')](_0x562dd5);if(_0x347e1f[_0x5ed7('0x91')]&&_0x347e1f['duplicates']['length']){_0x5d11e5[_0x5ed7('0x1c')](insertCmContact(_0x347e1f['ListId'],_0x3e7bd6,_0x347e1f['duplicates'],_0x4064d4));_0x5d11e5[_0x5ed7('0x1c')](_0x5ed7('0x97')+_0x3e7bd6+';');}BPromise['each'](_0x5d11e5,handleQuery)[_0x5ed7('0x1a')](function(_0x49fe71){BPromise[_0x5ed7('0x1d')]([handleAdditionalPhones()])[_0x5ed7('0x1a')](function(){_0x5d11e5=[];for(var _0x4c07eb=0x0;_0x4c07eb\x20\x20','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','phone','join','\x20=\x20','where','CmContact','findAll','AdditionalPhones','push','split','length','all','then','isNil','filter','CmContactHasItem','findOne','update','updated','create','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','ListId','updatedAt','recallme','select','fields','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper','toString','cm_contacts.phone','into','createdAt','cm_contacts','cm_contacts.ListId\x20=\x20','field','from','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','UserId','.CmListId','cm_hopper_black','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','errors','info','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','offset','dialTimezone','stringify','socket_timestamp','root','server/files/tmp','.csv','keys','includes','header','ContactItemType','name','_description','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','appendFileSync'];(function(_0x24f8a7,_0x2a9620){var _0x1eecaf=function(_0x35ecb0){while(--_0x35ecb0){_0x24f8a7['push'](_0x24f8a7['shift']());}};_0x1eecaf(++_0x2a9620);}(_0x365b,0x18a));var _0xb365=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x365b[_0x17d9e3];return _0x14192d;};'use strict';var fs=require('fs');var path=require(_0xb365('0x0'));var _=require('lodash');var Papa=require(_0xb365('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xb365('0x2'));var squel=require(_0xb365('0x3'));var Redis=require(_0xb365('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xb365('0x5'));var shared=require(_0xb365('0x6'));var logger=require(_0xb365('0x7'))(_0xb365('0x8'));config[_0xb365('0x9')]=_[_0xb365('0xa')](config['redis'],{'host':_0xb365('0xb'),'port':0x18eb});var socket=require(_0xb365('0xc'))(new Redis(config[_0xb365('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xb365('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xb365('0xe')](_0xb365('0xd'));function isEmail(_0x37164d){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'](_0x37164d);}function selectNotIn(_0x1bda77,_0x46856b,_0x9e2fe5,_0x2f6fce,_0x4d7879){return squel['select']()['field'](_0xb365('0xf'))['from'](_0x2f6fce)[_0xb365('0x10')](_0x46856b,null,_0x46856b+'.id\x20=\x20'+_0x2f6fce+'.'+_0x9e2fe5)['where'](_0x2f6fce+'.'+_0x9e2fe5+_0xb365('0x11')+_0x1bda77+'.'+_0x9e2fe5)[_0xb365('0x12')](_0x46856b+'.dialCheckDuplicateType\x20IN\x20('+_0x4d7879[_0xb365('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x99edce,_0xceba3b){promisesAdditionalPhones=[];return db[_0xb365('0x13')][_0xb365('0x14')]({'raw':!![],'attributes':['id',_0xb365('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x6f229c){if(_0x6f229c!==null){var _0x29af07=[];for(var _0x1e47ab=0x0;_0x1e47ab<_0x6f229c['length'];_0x1e47ab++){var _0x5d5323=_0x6f229c[_0x1e47ab];_0x29af07[_0xb365('0x16')](insertAdditionalPhones(_0x5d5323));}}Promise['all'](_0x29af07)['then'](function(){_0x99edce({'val':0x1});});});});}function insertAdditionalPhones(_0x4f537d){return new Promise(function(_0x1b8f3d,_0x3746ca){var _0x595bbd=_0x4f537d['AdditionalPhones'];var _0x431a22=_0x595bbd[_0xb365('0x17')](';');var _0x1bd7c4=[];orderBy=0x0;for(var _0x413ff6=0x0;_0x413ff6<_0x431a22[_0xb365('0x18')];_0x413ff6++){_0x1bd7c4['push'](splitAdditionalPhone(_0x4f537d['id'],_0x431a22[_0x413ff6]));}Promise[_0xb365('0x19')](_0x1bd7c4)[_0xb365('0x1a')](function(){_0x1b8f3d({'val':_0x431a22[_0xb365('0x18')]});});});}function splitAdditionalPhone(_0x3694fb,_0x5af6ae){return new Promise(function(_0x35e1d5,_0x36a544){var _0x252943=_0x5af6ae['split'](':');var _0x29dfbd=_0x252943[0x0];var _0x1d0d31=_0x252943[0x1];if(!_[_0xb365('0x1b')](_0x1d0d31)){var _0x346035=_0x1d0d31[_0xb365('0x17')]('|');var _0x15d3c6=[];for(var _0x19ebb6=0x0;_0x19ebb6<_0x346035[_0xb365('0x18')];_0x19ebb6++){if(_0x346035[_0x19ebb6]!==''){var _0x4b4e43=_[_0xb365('0x1c')](promisesAdditionalPhones,{'contactId':_0x3694fb,'phone':_0x346035[_0x19ebb6]});if(_0x4b4e43[_0xb365('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0xb365('0x16')]({'contactId':_0x3694fb,'contactTypeId':_0x29dfbd,'phone':_0x346035[_0x19ebb6],'orderBy':orderBy});}}}_0x35e1d5({'ok':0x1});}else _0x35e1d5({'res':0x0});});}function createAdditionalPhone(_0x57de58,_0x3f2f5f,_0x4c0abb,_0x351578){var _0xa55add='';var _0x2797b9='';var _0x45cdf2=_0x4c0abb['split']('§');_0xa55add=_0x45cdf2[0x0];if(_0x45cdf2[_0xb365('0x18')]==0x2)_0x2797b9=_0x45cdf2[0x1];return new Promise(function(_0x17d88e,_0x50702e){return db[_0xb365('0x1d')][_0xb365('0x1e')]({'where':{'CmContactId':_0x57de58,'item':_0xa55add}})[_0xb365('0x1a')](function(_0x43d2ec){if(_0x43d2ec){return db[_0xb365('0x1d')][_0xb365('0x1f')]({'ItemTypeId':_0x3f2f5f,'description':_0x2797b9,'OrderBy':_0x351578},{'where':{'CmContactId':_0x57de58,'item':_0xa55add}})[_0xb365('0x1a')](function(_0xf2f1e0){_0x17d88e({'res':_0xb365('0x20')});});}else{return db[_0xb365('0x1d')][_0xb365('0x21')]({'CmContactId':_0x57de58,'item':_0xa55add,'description':_0x2797b9,'ItemTypeId':_0x3f2f5f,'OrderBy':_0x351578,'ItemClass':'PHONE'})['then'](function(_0x31debb){_0x17d88e({'res':_0xb365('0x22')});});}});});}function insertCmHopper(_0x4ce1a6,_0x4294ef,_0x5027e1,_0x3cf406,_0x1f0970){var _0x4b3512=['cm_contacts.phone',_0xb365('0x23'),_0xb365('0x24'),_0xb365('0x25'),_0x4294ef+'.'+_0x3cf406,_0xb365('0x26'),_0xb365('0x27'),_0xb365('0x28'),_0xb365('0x29'),'\x22'+_0x1f0970+'\x22'];return squel[_0xb365('0x2a')]()['into']('cm_hopper')[_0xb365('0x2b')]([_0xb365('0xf'),_0xb365('0x2c'),_0xb365('0x2d'),_0xb365('0x2e'),_0x3cf406,'createdAt',_0xb365('0x2f'),'priority','UserId',_0xb365('0x30')],squel[_0xb365('0x31')]()[_0xb365('0x32')](_0x4b3512)['from'](_0x4294ef)[_0xb365('0x10')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4294ef+'.CmListId')[_0xb365('0x10')](_0x5027e1,null,_0x5027e1+_0xb365('0x33')+_0x4294ef+'.'+_0x3cf406)[_0xb365('0x12')](_0x4294ef+_0xb365('0x34'),_0x4ce1a6)[_0xb365('0x12')](_0xb365('0x35'),NOW)['where'](_0xb365('0x36'),selectNotIn(_0x4294ef,_0x5027e1,_0x3cf406,'cm_hopper',[_0xb365('0x37'),'\x22onlyIfOpen\x22']))[_0xb365('0x12')](_0xb365('0x36'),selectNotIn(_0x4294ef,_0x5027e1,_0x3cf406,_0xb365('0x38'),['\x22always\x22'])))[_0xb365('0x39')]();}function insertCmHopperBlack(_0x4f7b04,_0x4dbb59,_0x53750d,_0xec419e){var _0x493dda=[_0xb365('0x3a'),_0xb365('0x24'),_0xb365('0x25'),_0x4dbb59+'.'+_0xec419e,_0xb365('0x26'),_0xb365('0x27')];return squel[_0xb365('0x2a')]()[_0xb365('0x3b')]('cm_hopper_black')[_0xb365('0x2b')]([_0xb365('0xf'),_0xb365('0x2d'),_0xb365('0x2e'),_0xec419e,_0xb365('0x3c'),'updatedAt'],squel['select']()[_0xb365('0x32')](_0x493dda)['from'](_0x4dbb59)[_0xb365('0x10')](_0xb365('0x3d'),null,_0xb365('0x3e')+_0x4dbb59+'.CmListId')['join'](_0x53750d,null,_0x53750d+_0xb365('0x33')+_0x4dbb59+'.'+_0xec419e)[_0xb365('0x12')](_0x4dbb59+_0xb365('0x34'),_0x4f7b04)[_0xb365('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb365('0x12')](_0xb365('0x36'),squel[_0xb365('0x31')]()[_0xb365('0x3f')]('phone')[_0xb365('0x40')]('cm_hopper_black')[_0xb365('0x12')](_0xb365('0x41'),_0x4f7b04)[_0xb365('0x12')](_0xec419e+_0xb365('0x11')+_0x4dbb59+'.'+_0xec419e)))['toString']();}function insertTzCmHopper(_0x3385cd,_0x2394bb,_0x50f45a,_0x421a06,_0x28aa43,_0x319e3e){var _0x5aba2d=[_0xb365('0x3a'),_0xb365('0x42')+_0x319e3e+_0xb365('0x43'),_0xb365('0x24'),_0xb365('0x25'),_0x2394bb+'.'+_0x421a06,_0xb365('0x26'),_0xb365('0x27'),_0xb365('0x28'),'cm_contacts.UserId','\x22'+_0x28aa43+'\x22'];var _0x32f077=squel[_0xb365('0x2a')]()[_0xb365('0x3b')](_0xb365('0x38'))[_0xb365('0x2b')]([_0xb365('0xf'),'scheduledat','ContactId',_0xb365('0x2e'),_0x421a06,_0xb365('0x3c'),_0xb365('0x2f'),'priority',_0xb365('0x44'),_0xb365('0x30')],squel[_0xb365('0x31')]()[_0xb365('0x32')](_0x5aba2d)[_0xb365('0x40')](_0x2394bb)[_0xb365('0x10')]('cm_contacts',null,_0xb365('0x3e')+_0x2394bb+_0xb365('0x45'))['join'](_0x50f45a,null,_0x50f45a+_0xb365('0x33')+_0x2394bb+'.'+_0x421a06)[_0xb365('0x10')](_0x319e3e,null,_0x319e3e+_0xb365('0x33')+_0x2394bb+'.'+_0x421a06)[_0xb365('0x12')](_0x2394bb+'.CmListId\x20=\x20?',_0x3385cd)[_0xb365('0x12')](_0xb365('0x35'),NOW)['where'](_0xb365('0x36'),selectNotIn(_0x2394bb,_0x50f45a,_0x421a06,'cm_hopper',[_0xb365('0x37'),'\x22onlyIfOpen\x22']))[_0xb365('0x12')](_0xb365('0x36'),selectNotIn(_0x2394bb,_0x50f45a,_0x421a06,'cm_hopper',[_0xb365('0x37')])))[_0xb365('0x39')]();return _0x32f077;}function insertTzCmHopperBlack(_0x1c7d87,_0xc1951b,_0x534400,_0x38ea3d){var _0x2438bd=[_0xb365('0x3a'),_0xb365('0x24'),_0xb365('0x25'),_0xc1951b+'.'+_0x38ea3d,_0xb365('0x26'),_0xb365('0x27')];return squel[_0xb365('0x2a')]()['into'](_0xb365('0x46'))[_0xb365('0x2b')]([_0xb365('0xf'),'ContactId','ListId',_0x38ea3d,_0xb365('0x3c'),_0xb365('0x2f')],squel[_0xb365('0x31')]()[_0xb365('0x32')](_0x2438bd)[_0xb365('0x40')](_0xc1951b)[_0xb365('0x10')](_0xb365('0x3d'),null,_0xb365('0x3e')+_0xc1951b+_0xb365('0x45'))[_0xb365('0x10')](_0x534400,null,_0x534400+_0xb365('0x33')+_0xc1951b+'.'+_0x38ea3d)[_0xb365('0x12')](_0xc1951b+_0xb365('0x34'),_0x1c7d87)[_0xb365('0x12')](_0xb365('0x35'),NOW)['where'](_0xb365('0x36'),squel['select']()[_0xb365('0x3f')](_0xb365('0xf'))[_0xb365('0x40')](_0xb365('0x46'))['where'](_0xb365('0x41'),_0x1c7d87)[_0xb365('0x12')](_0x38ea3d+_0xb365('0x11')+_0xc1951b+'.'+_0x38ea3d)))['toString']();}function insertCmHopperAdditionalPhones(_0xd41182){var _0x5b0b8e=['cm_hopper.id',_0xb365('0x47'),_0xb365('0x48'),'cm_contact_has_items.createdAt',_0xb365('0x49')];return squel['insert']()['into'](_0xb365('0x4a'))['fromQuery'](['CmHopperId','phone','OrderBy','createdAt',_0xb365('0x2f')],squel[_0xb365('0x31')]()[_0xb365('0x32')](_0x5b0b8e)[_0xb365('0x40')](_0xb365('0x38'))['join'](_0xb365('0x3d'),null,_0xb365('0x4b'))[_0xb365('0x10')](_0xb365('0x4c'),null,_0xb365('0x4d'))[_0xb365('0x12')]('cm_hopper.ListId\x20=\x20?',_0xd41182)[_0xb365('0x12')](_0xb365('0x35'),NOW))[_0xb365('0x39')]();}function insertCmContact(_0x1ba541,_0x177a5d,_0x4a00af,_0x623ed8){var _0x4cbf60=_[_0xb365('0x4e')](_['keys'](_0x623ed8),[_0xb365('0x2e'),_0xb365('0x4f'),'createdAt',_0xb365('0x2f'),_0xb365('0x50')]);return squel[_0xb365('0x2a')]()[_0xb365('0x3b')](_0xb365('0x3d'))['fromQuery'](_0x4cbf60,squel[_0xb365('0x31')]()[_0xb365('0x32')](_0x4cbf60)[_0xb365('0x40')](_0x177a5d)[_0xb365('0x12')]('('+_0x4a00af['join'](',')+_0xb365('0x51'),squel['select']()[_0xb365('0x32')](_0x4a00af)[_0xb365('0x40')](_0xb365('0x3d'))[_0xb365('0x12')](_0xb365('0x41'),_0x1ba541)[_0xb365('0x12')](_0xb365('0x52')))['where'](_0xb365('0x53'),squel[_0xb365('0x31')]()[_0xb365('0x3f')](_0xb365('0x54'),_0xb365('0x55'))['from'](_0x177a5d)[_0xb365('0x56')](_0x4a00af[_0xb365('0x10')](','))))[_0xb365('0x39')]();}function handleStop(){logger['info'](_0xb365('0x57'));stopped=!![];}function handleUncaughtException(_0x13dbb1){logger[_0xb365('0x58')](_0x13dbb1[_0xb365('0x59')]);process['exit'](0x1);}function handleError(_0x4690ee,_0x326acc){stats[_0xb365('0x5a')][_0xb365('0x16')]({'name':_0x326acc['code'],'message':_0x326acc['message'],'row':_0x4690ee});}function handleQuery(_0x4d6e59){logger[_0xb365('0x5b')](_0x4d6e59);return db[_0xb365('0x5c')]['query'](_0x4d6e59)[_0xb365('0x5d')](function(_0x51defd){results[_0xb365('0x16')](_0x51defd);})[_0xb365('0x5e')](function(_0xd12eb4){logger[_0xb365('0x58')](_0xd12eb4[_0xb365('0x59')]);});}function updateTzCampaigns(_0x456588){return new Promise(function(_0x4d5230,_0x5185cf){var _0x42723c=squel[_0xb365('0x31')]()['fields']([_0xb365('0x5f'),_0xb365('0x60')])[_0xb365('0x40')](_0xb365('0x61'))[_0xb365('0x10')](_0xb365('0x62'),null,_0xb365('0x63'))[_0xb365('0x12')](_0xb365('0x64')+_0x456588);db['sequelize'][_0xb365('0x65')](_0x42723c['toString']())[_0xb365('0x5d')](function(_0x4a3686){var _0x4ca66b=[];for(var _0x52dd1f=0x0;_0x52dd1f<_0x4a3686[_0xb365('0x18')];_0x52dd1f++){_0x4ca66b[_0xb365('0x16')](getTimezoneData(_0x4a3686[_0x52dd1f],tmp_campaigns));}BPromise[_0xb365('0x19')](_0x4ca66b)[_0xb365('0x1a')](function(){_0x4d5230({'val':0x1});});})[_0xb365('0x5e')](function(_0x382019){logger[_0xb365('0x58')](_0x382019[_0xb365('0x59')]);_0x4d5230({'val':0x0});});});}function updateTzVoiceQueues(_0x32d1a7){return new Promise(function(_0x2c99e3,_0x19f95c){var _0x4f1c71=squel[_0xb365('0x31')]()[_0xb365('0x32')]([_0xb365('0x66'),_0xb365('0x67')])[_0xb365('0x40')]('voice_queues')[_0xb365('0x10')](_0xb365('0x68'),null,_0xb365('0x69'))[_0xb365('0x12')](_0xb365('0x6a')+_0x32d1a7);db['sequelize'][_0xb365('0x65')](_0x4f1c71[_0xb365('0x39')]())['spread'](function(_0x4ba698){var _0x3633ec=[];for(var _0x5be685=0x0;_0x5be685<_0x4ba698[_0xb365('0x18')];_0x5be685++){_0x3633ec[_0xb365('0x16')](getTimezoneData(_0x4ba698[_0x5be685],tmp_voice_queues));}BPromise['all'](_0x3633ec)['then'](function(){_0x2c99e3({'val':0x1});});})['catch'](function(_0x206179){logger[_0xb365('0x58')](_0x206179[_0xb365('0x59')]);_0x2c99e3({'val':0x0});});});}function getTimezoneData(_0x4bf19c,_0x16c779){return new Promise(function(_0xc705bf,_0x212912){var _0x46b4a0=shared[_0xb365('0x6b')];var _0x3f6eee=_0x46b4a0[_0x4bf19c['dialTimezone']];if(_[_0xb365('0x1b')](_0x3f6eee)){_0xc705bf({'ret':0x1});}else{var _0x1527a0=_0x3f6eee[_0xb365('0x6c')];var _0x50e565=squel[_0xb365('0x2a')]()[_0xb365('0x3b')](_0x16c779)[_0xb365('0x6d')]('id',_0x4bf19c['id'])[_0xb365('0x6d')](_0xb365('0x6e'),_0x1527a0)['set'](_0xb365('0x6f'),_0x4bf19c['dialTimezone'])['toString']();return db[_0xb365('0x5c')][_0xb365('0x65')](_0x50e565)['spread'](function(_0x582223){_0xc705bf({'ret':0x1});})[_0xb365('0x5e')](function(_0x291a21){logger[_0xb365('0x58')](_0x291a21[_0xb365('0x59')]);_0x212912({'ret':0x1});});}});}function handleTZQuery(_0x621e30){logger[_0xb365('0x5b')](_0x621e30);return db[_0xb365('0x5c')][_0xb365('0x65')](_0x621e30)['spread'](function(_0xf4bdad){})['catch'](function(_0x5e33e8){logger[_0xb365('0x58')](_0x5e33e8[_0xb365('0x59')]);});}function main(_0x2611ec,_0x437c33,_0x38f25e,_0x35e2c7){logger[_0xb365('0x5b')]('main',_0x2611ec,JSON[_0xb365('0x70')](_0x437c33));process['send']('start');var _0x40c6fa=_0x437c33['binding'];var _0x35355b=_['clone'](_0x40c6fa);var _0x5233d9=_0x437c33[_0xb365('0x71')];var _0x22690a=path[_0xb365('0x10')](config[_0xb365('0x72')],_0xb365('0x73'),_0x5233d9+_0xb365('0x74'));hasTZ=_[_0xb365('0x75')](_0x40c6fa)[_0xb365('0x76')](_0xb365('0x6f'));var _0x369200=_[_0xb365('0x75')](_0x40c6fa)['join']();logger[_0xb365('0x5b')](_0xb365('0x77'),_0x369200);db[_0xb365('0x78')][_0xb365('0x14')]({'raw':!![],'attributes':['id',_0xb365('0x79')]})['then'](function(_0x1aba33){for(var _0x3a587f=0x0;_0x3a587f<_0x1aba33[_0xb365('0x18')];_0x3a587f++){if(_0x1aba33[_0x3a587f][_0xb365('0x79')]in _0x40c6fa){contactItemTypes[_0xb365('0x16')](_0x1aba33[_0x3a587f]);delete _0x35355b[_0x1aba33[_0x3a587f][_0xb365('0x79')]];hasAdditionalPhones=!![];}for(var _0x5c76d3 in _0x40c6fa){if(_0x1aba33[_0x3a587f][_0xb365('0x79')]+_0xb365('0x7a')===_0x5c76d3){phoneDescriptions[_0xb365('0x16')]({'itemTypeId':_0x1aba33[_0x3a587f]['id'],'description':_0x5c76d3});delete _0x35355b[_0x5c76d3];}}}if(hasAdditionalPhones)_0x35355b[_0xb365('0x15')]='';var _0x2a4ce9=_['keys'](_0x35355b)[_0xb365('0x10')]();logger[_0xb365('0x5b')](_0xb365('0x77'),_0x2a4ce9);fs['writeFileSync'](_0x22690a,_0x2a4ce9+'\x0a');Papa[_0xb365('0x7b')](fs[_0xb365('0x7c')](_0x2611ec),{'header':!![],'skipEmptyLines':!![],'step':function(_0x30ec7d,_0x3cd192){try{for(var _0x18828a=0x0,_0x47367a=[];_0x18828a<_0x30ec7d[_0xb365('0x7d')][_0xb365('0x18')];_0x18828a++){stats[_0xb365('0x7e')]+=0x1;if(_0x30ec7d[_0xb365('0x5a')][_0x18828a]){handleError(_0x30ec7d[_0xb365('0x7d')][_0x18828a],_0x30ec7d['errors'][_0x18828a]);}else{var _0x5073e7=[];var _0x26ef1e=[];var _0x172423={};for(var _0x1f0fe5 in _0x40c6fa){let _0x551455=contactItemTypes[_0xb365('0x7f')](_0x1ae2db=>_0x1ae2db[_0xb365('0x79')]===_0x1f0fe5);let _0x4f39eb=contactItemTypes[_0xb365('0x7f')](_0x1fb3cb=>_0x1fb3cb['name']+_0xb365('0x7a')===_0x1f0fe5);if(_[_0xb365('0x1b')](_0x551455)&&_[_0xb365('0x1b')](_0x4f39eb)){if(_0x40c6fa[_0xb365('0x80')](_0x1f0fe5)){if(_0x30ec7d['data'][_0x18828a][_0x40c6fa[_0x1f0fe5]]){var _0x183012=_[_0xb365('0x81')](_0x30ec7d[_0xb365('0x7d')][_0x18828a][_0x40c6fa[_0x1f0fe5]][_0xb365('0x82')](/"/g,'\x27'));switch(_0x1f0fe5){case _0xb365('0x2c'):var _0x442807=moment(_0x183012,_0xb365('0xd'),!![]);if(_0x442807['isValid']()){_0x47367a[_0xb365('0x16')]('\x22'+_0x183012+'\x22');}else{_0x5073e7[_0xb365('0x16')](_0xb365('0x83'));}break;case _0xb365('0x84'):var _0x171fb3=parseInt(_0x183012);_0x183012=_[_0xb365('0x85')](_0x171fb3)||_0x171fb3<0x0||_0x171fb3>0x4?_0x35e2c7?0x3:0x2:_0x171fb3;_0x47367a[_0xb365('0x16')]('\x22'+_0x183012+'\x22');break;case _0xb365('0x44'):var _0x41089a=parseInt(_0x183012);if(_[_0xb365('0x86')](_0x41089a)&&_[_0xb365('0x76')](_0x38f25e,_0x41089a)){_0x47367a['push']('\x22'+_0x41089a+'\x22');}else{_0x5073e7[_0xb365('0x16')](_0xb365('0x87'));}break;case _0xb365('0x88'):if(isEmail(_0x183012)){_0x47367a['push']('\x22'+_0x183012+'\x22');}else{_0x5073e7[_0xb365('0x16')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x15b8bf=moment(_0x183012,_0xb365('0x89'),!![]);if(_0x15b8bf['isValid']()){_0x47367a['push']('\x22'+_0x183012+'\x22');}else{_0x5073e7[_0xb365('0x16')](_0xb365('0x8a'));}break;case _0xb365('0x6f'):var _0x4dc19e=shared[_0xb365('0x6b')];var _0x452486=_0x4dc19e[_0x183012];if(!_[_0xb365('0x1b')](_0x452486)){var _0x2aa79e=_0x452486[_0xb365('0x6c')];_0x47367a[_0xb365('0x16')]('\x22'+_0x183012+'\x22');_0x47367a['push']('\x22'+_0x2aa79e+'\x22');}break;default:_0x47367a[_0xb365('0x16')]('\x22'+_0x183012+'\x22');}}else{switch(_0x1f0fe5){case _0xb365('0x8b'):case _0xb365('0xf'):_0x5073e7[_0xb365('0x16')](_0x1f0fe5+'\x20not\x20specified');break;default:_0x47367a[_0xb365('0x16')]('\x22\x22');}}}}else{var _0x2f2b78='';if(!_['isNil'](_0x551455)){if(!_0x172423[_0xb365('0x80')](_0x551455['id'])){if(!_[_0xb365('0x1b')](_0x30ec7d[_0xb365('0x7d')][_0x18828a][_0x40c6fa[_0x1f0fe5]])){var _0x183012=_[_0xb365('0x81')](_0x30ec7d[_0xb365('0x7d')][_0x18828a][_0x40c6fa[_0x1f0fe5]][_0xb365('0x82')](/"/g,'\x27'));var _0x35564b=phoneDescriptions[_0xb365('0x7f')](_0x2fc6bd=>_0x2fc6bd[_0xb365('0x8c')]===_0x551455['id']);if(!_[_0xb365('0x1b')](_0x35564b)){var _0x1cd790=_[_0xb365('0x81')](_0x30ec7d[_0xb365('0x7d')][_0x18828a][_0x40c6fa[_0x35564b[_0xb365('0x8d')]]][_0xb365('0x82')](/"/g,'\x27'));if(!_['isNil'](_0x1cd790))_0x183012=_0x183012+'§'+_0x1cd790;}if(_0x2f2b78=='')_0x2f2b78=_0x183012;else _0x2f2b78+='|'+_0x183012;}_0x26ef1e['push'](_0x551455['id']+':'+_0x2f2b78);_0x172423[_0x551455['id']]=0x1;}}}}if(hasAdditionalPhones){_0x47367a[_0xb365('0x16')]('\x22'+_0x26ef1e[_0xb365('0x10')](';')+'\x22');}if(_0x5073e7[_0xb365('0x18')]){handleError(_0x30ec7d['data'][_0x18828a],{'code':'SystemRow','message':_0x5073e7['join']()});}else{fs[_0xb365('0x8e')](_0x22690a,_0x47367a[_0xb365('0x10')]()+'\x0a');}_0x47367a=[];}if(!(stats[_0xb365('0x7e')]%0xc8)){socket[_0xb365('0x8f')](_0xb365('0x90')+_0x5233d9,stats);stats[_0xb365('0x5a')]=[];}}if(stopped){logger[_0xb365('0x5b')](_0xb365('0x91'));_0x3cd192['abort']();}}catch(_0x1428e4){handleError(_0x30ec7d['data'][_0x18828a],{'code':_0xb365('0x92'),'message':_0x1428e4['message']});logger[_0xb365('0x58')](_0xb365('0x93'),_0x1428e4[_0xb365('0x59')]);}},'complete':function(){try{var _0x4f7e12=[];var _0x471460=[];var _0x1cb690=_0xb365('0x3d');if(_0x437c33['duplicates']&&_0x437c33[_0xb365('0x94')][_0xb365('0x18')]){_0x1cb690=_0xb365('0x95')+_0x5233d9;_0x4f7e12['push'](_0xb365('0x96')+_0x1cb690+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x5233d9;tmp_voice_queues=_0xb365('0x97')+_0x5233d9;_0x471460['push'](_0xb365('0x96')+tmp_campaigns+_0xb365('0x98'));_0x471460[_0xb365('0x16')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x471460,handleTZQuery)[_0xb365('0x1a')](function(_0x5a5b3c){updateTzCampaigns(_0x437c33[_0xb365('0x2e')])[_0xb365('0x1a')](function(_0x2add2){updateTzVoiceQueues(_0x437c33[_0xb365('0x2e')])[_0xb365('0x1a')](function(_0x29e625){if(hasTZ)_0x2a4ce9=_0x2a4ce9[_0xb365('0x82')](_0xb365('0x6f'),_0xb365('0x99'));var _0x45b0f4=util[_0xb365('0xe')](_0xb365('0x9a'),_0x22690a,_0x1cb690,_0x2a4ce9,_0x437c33[_0xb365('0x2e')],_0x437c33[_0xb365('0x4f')]||null,NOW,NOW);if(_[_0xb365('0x1b')](_0x40c6fa[_0xb365('0x2c')])){_0x45b0f4+=',\x20scheduledAt\x20=\x20NOW()';}_0x4f7e12['push'](_0x45b0f4);if(_0x437c33[_0xb365('0x94')]&&_0x437c33[_0xb365('0x94')][_0xb365('0x18')]){_0x4f7e12['push'](insertCmContact(_0x437c33[_0xb365('0x2e')],_0x1cb690,_0x437c33['duplicates'],_0x40c6fa));_0x4f7e12[_0xb365('0x16')]('DROP\x20TABLE\x20'+_0x1cb690+';');}BPromise['each'](_0x4f7e12,handleQuery)[_0xb365('0x1a')](function(_0x4f5af5){BPromise['all']([handleAdditionalPhones()])[_0xb365('0x1a')](function(){_0x4f7e12=[];for(var _0x390bb7=0x0;_0x390bb7_0x5eae40[_0x7076('0x6d')]===_0x2ee498);let _0xd3c2b8=contactItemTypes[_0x7076('0x74')](_0x46e6fa=>_0x46e6fa[_0x7076('0x6d')]+_0x7076('0x6e')===_0x2ee498);if(_['isNil'](_0x2465a3)&&_[_0x7076('0x1d')](_0xd3c2b8)){if(_0x2e97d9[_0x7076('0x75')](_0x2ee498)){if(_0x2ee846[_0x7076('0x73')][_0x23530d][_0x2e97d9[_0x2ee498]]){var _0x2741a8=_[_0x7076('0x76')](_0x2ee846[_0x7076('0x73')][_0x23530d][_0x2e97d9[_0x2ee498]][_0x7076('0x77')](/"/g,'\x27'));switch(_0x2ee498){case _0x7076('0x3a'):var _0x2a910a=moment(_0x2741a8,_0x7076('0xf'),!![]);if(_0x2a910a[_0x7076('0x78')]()){_0x40ba9b['push']('\x22'+_0x2741a8+'\x22');}else{_0x5c7528[_0x7076('0x1f')](_0x7076('0x79'));}break;case _0x7076('0x3d'):var _0x149391=parseInt(_0x2741a8);_0x2741a8=_['isNaN'](_0x149391)||_0x149391<0x0||_0x149391>0x4?_0x20a9d6?0x3:0x2:_0x149391;_0x40ba9b[_0x7076('0x1f')]('\x22'+_0x2741a8+'\x22');break;case _0x7076('0x3e'):var _0x57f4ba=parseInt(_0x2741a8);if(_[_0x7076('0x7a')](_0x57f4ba)&&_['includes'](_0x44acb5,_0x57f4ba)){_0x40ba9b['push']('\x22'+_0x57f4ba+'\x22');}else{_0x5c7528[_0x7076('0x1f')](_0x7076('0x7b'));}break;case'email':if(isEmail(_0x2741a8)){_0x40ba9b[_0x7076('0x1f')]('\x22'+_0x2741a8+'\x22');}else{_0x5c7528[_0x7076('0x1f')]('email\x20wrong\x20format');}break;case _0x7076('0x7c'):var _0x2514a0=moment(_0x2741a8,_0x7076('0x7d'),!![]);if(_0x2514a0[_0x7076('0x78')]()){_0x40ba9b[_0x7076('0x1f')]('\x22'+_0x2741a8+'\x22');}else{_0x5c7528['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x40ba9b[_0x7076('0x1f')]('\x22'+_0x2741a8+'\x22');}}else{switch(_0x2ee498){case _0x7076('0x7e'):case _0x7076('0x13'):_0x5c7528['push'](_0x2ee498+_0x7076('0x7f'));break;default:_0x40ba9b[_0x7076('0x1f')]('\x22\x22');}}}}else{var _0x20bebc='';if(!_[_0x7076('0x1d')](_0x2465a3)){if(!_0x47b349[_0x7076('0x75')](_0x2465a3['id'])){for(var _0x63559=0x0;_0x63559<_0x2e97d9[_0x2ee498]['length'];_0x63559++){var _0x2741a8=_[_0x7076('0x76')](_0x2ee846[_0x7076('0x73')][_0x23530d][_0x2e97d9[_0x2ee498][_0x63559]][_0x7076('0x77')](/"/g,'\x27'));var _0x1c7c87=phoneDescriptions[_0x7076('0x74')](_0x183ab7=>_0x183ab7[_0x7076('0x80')]===_0x2465a3['id']);if(!_[_0x7076('0x1d')](_0x1c7c87)){var _0x41db88=_[_0x7076('0x76')](_0x2ee846[_0x7076('0x73')][_0x23530d][_0x2e97d9[_0x1c7c87['description']][0x0]][_0x7076('0x77')](/"/g,'\x27'));if(!_[_0x7076('0x1d')](_0x41db88))_0x2741a8=_0x2741a8+'§'+_0x41db88;}if(_0x20bebc=='')_0x20bebc=_0x2741a8;else _0x20bebc+='|'+_0x2741a8;}_0x520ab8[_0x7076('0x1f')](_0x2465a3['id']+':'+_0x20bebc);_0x47b349[_0x2465a3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x40ba9b[_0x7076('0x1f')]('\x22'+_0x520ab8[_0x7076('0x19')](';')+'\x22');}if(_0x5c7528['length']){handleError(_0x2ee846[_0x7076('0x73')][_0x23530d],{'code':_0x7076('0x81'),'message':_0x5c7528[_0x7076('0x19')]()});}else{fs[_0x7076('0x82')](_0x4644ae,_0x40ba9b[_0x7076('0x19')]()+'\x0a');}_0x40ba9b=[];}if(!(stats['rows']%0xc8)){socket[_0x7076('0x83')](_0x7076('0x84')+_0x1f8be4,stats);stats[_0x7076('0x5f')]=[];}}if(stopped){logger[_0x7076('0x5c')]('Abort\x20parser');_0x4abcb3[_0x7076('0x85')]();}}catch(_0x5a861c){handleError(_0x2ee846[_0x7076('0x73')][_0x23530d],{'code':_0x7076('0x86'),'message':_0x5a861c[_0x7076('0x23')]});logger[_0x7076('0x5d')](_0x7076('0x87'),_0x5a861c[_0x7076('0x23')]);}},'complete':function(){try{var _0x88da8b=[];var _0x8f070b=tempTableName;_0x88da8b[_0x7076('0x1f')]('CREATE\x20TABLE\x20'+_0x8f070b+_0x7076('0x88'));logger['info'](_0x7076('0x89'),contactItemTypes[_0x7076('0x1c')]);var _0x15964d=util[_0x7076('0xe')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4644ae,_0x8f070b,_0x4b0dbd,_0x3f6e96['ListId'],_0x3f6e96[_0x7076('0x8a')]||null,NOW,NOW);if(_['isNil'](_0x2e97d9[_0x7076('0x3a')])){_0x15964d+=_0x7076('0x8b');}_0x88da8b['push'](_0x15964d);BPromise[_0x7076('0x8c')](_0x88da8b,handleQuery)['then'](function(_0x3543d4){BPromise[_0x7076('0x20')]([handleAdditionalPhones()])[_0x7076('0x21')](function(){_0x88da8b=[];for(var _0x4cb0cb=0x0;_0x4cb0cb\x20\x20');}var _0x1d2ff5=path[_0x7076('0x19')](config['root'],_0x7076('0x68'),process['argv'][0x2]);if(!fs[_0x7076('0x97')](_0x1d2ff5)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x5341a7={};try{_0x5341a7=JSON[_0x7076('0x70')](process[_0x7076('0x96')][0x3]);if(!_0x5341a7[_0x7076('0x98')]){throw new Error(_0x7076('0x99'));}var _0x300c14=0x0;if(_0x5341a7[_0x7076('0x98')][_0x7076('0x3e')]){_0x300c14=0x1;}if(!_0x5341a7[_0x7076('0x48')]){throw new Error(_0x7076('0x9a'));}}catch(_0xcffa0b){throw new Error(_0x7076('0x9b'));}var _0x27bd82=[];try{_0x27bd82=_['map'](JSON['parse'](process[_0x7076('0x96')][0x4]),'id');}catch(_0x11ddb5){logger['info'](_0x7076('0x9c'));}main(_0x1d2ff5,_0x5341a7,_0x27bd82,_0x300c14);}validate();process['on'](_0x7076('0x9d'),handleStop);process['on'](_0x7076('0x9e'),handleUncaughtException); \ No newline at end of file +var _0x86bc=['select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','error','split','filter','CmContactHasItem','update','create','PHONE','inserted','CmHopper','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','into','ListId','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','code','catch','main','send','start','binding','clone','socket_timestamp','root','.csv','body','ContactItemType','findAll','name','_description','keys','header','parse','createReadStream','data','rows','errors','find','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','itemTypeId','SystemRow','appendFileSync','contact:import:','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','orderBy','DROP\x20TABLE\x20','affectedRows','unlink','complete','argv','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','phone','join','\x20=\x20','where','sequelize','query'];(function(_0x5534ce,_0x26ef5e){var _0x33042b=function(_0x48c033){while(--_0x48c033){_0x5534ce['push'](_0x5534ce['shift']());}};_0x33042b(++_0x26ef5e);}(_0x86bc,0x1b1));var _0xc86b=function(_0x5b75b6,_0x4bb022){_0x5b75b6=_0x5b75b6-0x0;var _0xf96dda=_0x86bc[_0x5b75b6];return _0xf96dda;};'use strict';var fs=require('fs');var path=require(_0xc86b('0x0'));var _=require('lodash');var Papa=require(_0xc86b('0x1'));var util=require(_0xc86b('0x2'));var BPromise=require(_0xc86b('0x3'));var moment=require(_0xc86b('0x4'));var squel=require(_0xc86b('0x5'));var Redis=require(_0xc86b('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xc86b('0x7'))('import');config[_0xc86b('0x8')]=_['defaults'](config['redis'],{'host':_0xc86b('0x9'),'port':0x18eb});var socket=require(_0xc86b('0xa'))(new Redis(config[_0xc86b('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xc86b('0xb')](_0xc86b('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0xc86b('0xb')](_0xc86b('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x207e57){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))*$/[_0xc86b('0xe')](_0x207e57);}function selectNotIn(_0x28de01,_0x3c05c1,_0x24df69,_0x2f3b15,_0x4e2620){return squel[_0xc86b('0xf')]()[_0xc86b('0x10')](_0xc86b('0x11'))['from'](_0x2f3b15)[_0xc86b('0x12')](_0x3c05c1,null,_0x3c05c1+'.id\x20=\x20'+_0x2f3b15+'.'+_0x24df69)['where'](_0x2f3b15+'.'+_0x24df69+_0xc86b('0x13')+_0x28de01+'.'+_0x24df69)[_0xc86b('0x14')](_0x3c05c1+'.dialCheckDuplicateType\x20IN\x20('+_0x4e2620[_0xc86b('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x59d5bf,_0x12dab3){promisesAdditionalPhones=[];promisesContact=[];return db[_0xc86b('0x15')][_0xc86b('0x16')](_0xc86b('0x17')+tempTableName)[_0xc86b('0x18')](function(_0x534b48){if(_0x534b48!==null){var _0x360916=[];for(var _0x22beec=0x0;_0x22beec<_0x534b48[_0xc86b('0x19')];_0x22beec++){var _0x26475e=_0x534b48[_0x22beec];if(!_['isNil'](_0x26475e[_0xc86b('0x11')])){if(!_[_0xc86b('0x1a')](_0x26475e[_0xc86b('0x1b')]))_0x360916[_0xc86b('0x1c')](insertAdditionalPhones(_0x26475e));promisesContact['push']({'contact':_0x26475e});}}}Promise[_0xc86b('0x1d')](_0x360916)[_0xc86b('0x1e')](function(){_0x59d5bf({'val':0x1});});})['catch'](function(_0x264d1f){logger[_0xc86b('0x1f')](_0x264d1f['message']);});});}function insertAdditionalPhones(_0x58446d){return new Promise(function(_0x2d9172,_0x55d55c){var _0x12fa75=_0x58446d['AdditionalPhones'];if(_[_0xc86b('0x1a')](_0x12fa75))_0x55d55c({'val':0x0});else{var _0x36918c=_0x12fa75['split'](';');var _0x28a802=[];orderBy=0x0;for(var _0x4e0322=0x0;_0x4e0322<_0x36918c[_0xc86b('0x19')];_0x4e0322++){_0x28a802[_0xc86b('0x1c')](splitAdditionalPhone(_0x58446d['id'],_0x36918c[_0x4e0322]));}Promise[_0xc86b('0x1d')](_0x28a802)[_0xc86b('0x1e')](function(){_0x2d9172({'val':_0x36918c['length']});});}});}function splitAdditionalPhone(_0x819baf,_0x1a2c27){return new Promise(function(_0x212be7,_0x2911a6){var _0x39bf34=_0x1a2c27['split'](':');var _0x41b99c=_0x39bf34[0x0];var _0x564f1=_0x39bf34[0x1];if(_0x564f1!==''){var _0xe7dc4b=_0x564f1[_0xc86b('0x20')]('|');var _0x1eb6d9=[];for(var _0x4d66bd=0x0;_0x4d66bd<_0xe7dc4b[_0xc86b('0x19')];_0x4d66bd++){if(_0xe7dc4b[_0x4d66bd]!==''){var _0x57c7fd=_[_0xc86b('0x21')](promisesAdditionalPhones,{'contactId':_0x819baf,'phone':_0xe7dc4b[_0x4d66bd]});if(_0x57c7fd[_0xc86b('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xc86b('0x1c')]({'contactId':_0x819baf,'contactTypeId':_0x41b99c,'phone':_0xe7dc4b[_0x4d66bd],'orderBy':orderBy});}}}_0x212be7({'ok':0x1});}else _0x212be7({'res':0x0});});}function createAdditionalPhone(_0xa2d929,_0x222e52,_0x4482dc,_0x2bf385){var _0x259db7='';var _0x37fc26='';var _0x35ca48=_0x4482dc[_0xc86b('0x20')]('§');_0x259db7=_0x35ca48[0x0];if(_0x35ca48['length']==0x2)_0x37fc26=_0x35ca48[0x1];return new Promise(function(_0x5101f0,_0x58767a){return db[_0xc86b('0x22')]['findOne']({'where':{'CmContactId':_0xa2d929,'item':_0x259db7}})['then'](function(_0x426fe7){if(_0x426fe7){return db[_0xc86b('0x22')][_0xc86b('0x23')]({'ItemTypeId':_0x222e52,'description':_0x37fc26,'OrderBy':_0x2bf385},{'where':{'CmContactId':_0xa2d929,'item':_0x259db7}})[_0xc86b('0x1e')](function(_0x1597f7){_0x5101f0({'res':'updated'});});}else{return db['CmContactHasItem'][_0xc86b('0x24')]({'CmContactId':_0xa2d929,'item':_0x259db7,'ItemTypeId':_0x222e52,'description':_0x37fc26,'OrderBy':_0x2bf385,'ItemClass':_0xc86b('0x25')})[_0xc86b('0x1e')](function(_0x28b97f){_0x5101f0({'res':_0xc86b('0x26')});});}});});}function updateContact(_0x2cb945){return new Promise(function(_0x42ca71,_0x5d4046){var _0x41db10=_0x2cb945['id'];delete _0x2cb945['id'];return db['CmContact'][_0xc86b('0x23')](_0x2cb945,{'where':{'id':_0x41db10}})[_0xc86b('0x1e')](function(_0x1a6b08){updatedRows+=0x1;return db[_0xc86b('0x27')][_0xc86b('0x23')]({'phone':_0x2cb945['phone']},{'where':{'ContactId':_0x41db10}})[_0xc86b('0x1e')](function(_0x34936b){_0x42ca71({'ret':'OK'});});});});}function insertCmHopper(_0x42c68f,_0x5701a1,_0x359f35,_0x5a611b,_0x532c7b){var _0x139362=['cm_contacts.phone','cm_contacts.scheduledat',_0xc86b('0x28'),_0xc86b('0x29'),_0x5701a1+'.'+_0x5a611b,_0xc86b('0x2a'),'cm_contacts.updatedAt','cm_contacts.priority',_0xc86b('0x2b'),'\x22'+_0x532c7b+'\x22'];return squel[_0xc86b('0x2c')]()['into']('cm_hopper')[_0xc86b('0x2d')]([_0xc86b('0x11'),_0xc86b('0x2e'),_0xc86b('0x2f'),'ListId',_0x5a611b,_0xc86b('0x30'),_0xc86b('0x31'),_0xc86b('0x32'),_0xc86b('0x33'),_0xc86b('0x34')],squel[_0xc86b('0xf')]()[_0xc86b('0x35')](_0x139362)[_0xc86b('0x36')](_0x5701a1)['join'](_0xc86b('0x37'),null,_0xc86b('0x38')+_0x5701a1+_0xc86b('0x39'))[_0xc86b('0x12')](_0x359f35,null,_0x359f35+_0xc86b('0x3a')+_0x5701a1+'.'+_0x5a611b)[_0xc86b('0x14')](_0x5701a1+_0xc86b('0x3b'),_0x42c68f)[_0xc86b('0x14')](_0xc86b('0x3c'),NOW)[_0xc86b('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5701a1,_0x359f35,_0x5a611b,_0xc86b('0x3d'),[_0xc86b('0x3e'),'\x22onlyIfOpen\x22']))[_0xc86b('0x14')](_0xc86b('0x3f'),selectNotIn(_0x5701a1,_0x359f35,_0x5a611b,_0xc86b('0x3d'),[_0xc86b('0x3e')])))[_0xc86b('0x40')]();}function insertCmHopperBlack(_0x2105ca,_0x4d75ac,_0x4cab08,_0x5d7693){var _0xc92ee4=[_0xc86b('0x41'),_0xc86b('0x28'),_0xc86b('0x29'),_0x4d75ac+'.'+_0x5d7693,_0xc86b('0x2a'),'cm_contacts.updatedAt'];return squel['insert']()[_0xc86b('0x42')]('cm_hopper_black')[_0xc86b('0x2d')]([_0xc86b('0x11'),'ContactId',_0xc86b('0x43'),_0x5d7693,'createdAt','updatedAt'],squel['select']()['fields'](_0xc92ee4)[_0xc86b('0x36')](_0x4d75ac)[_0xc86b('0x12')](_0xc86b('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x4d75ac+'.CmListId')[_0xc86b('0x12')](_0x4cab08,null,_0x4cab08+_0xc86b('0x3a')+_0x4d75ac+'.'+_0x5d7693)[_0xc86b('0x14')](_0x4d75ac+_0xc86b('0x3b'),_0x2105ca)['where'](_0xc86b('0x3c'),NOW)[_0xc86b('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xc86b('0xf')]()[_0xc86b('0x10')]('phone')[_0xc86b('0x36')](_0xc86b('0x44'))[_0xc86b('0x14')](_0xc86b('0x45'),_0x2105ca)[_0xc86b('0x14')](_0x5d7693+_0xc86b('0x46'),_0x4d75ac+'.'+_0x5d7693)))[_0xc86b('0x40')]();}function insertCmHopperAdditionalPhones(_0x12e207){var _0x21d727=[_0xc86b('0x47'),_0xc86b('0x48'),_0xc86b('0x49'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xc86b('0x2c')]()['into'](_0xc86b('0x4a'))[_0xc86b('0x2d')](['CmHopperId','phone',_0xc86b('0x4b'),_0xc86b('0x30'),_0xc86b('0x31')],squel[_0xc86b('0xf')]()['fields'](_0x21d727)[_0xc86b('0x36')](_0xc86b('0x3d'))['join'](_0xc86b('0x37'),null,_0xc86b('0x4c'))[_0xc86b('0x12')](_0xc86b('0x4d'),null,_0xc86b('0x4e'))['where']('cm_hopper.ListId\x20=\x20?',_0x12e207)[_0xc86b('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x389bf3,_0x5e4e81,_0x2f399c,_0x10f106){var _0x346a94=_[_0xc86b('0x4f')](_['keys'](_0x10f106),[_0xc86b('0x43'),_0xc86b('0x50'),_0xc86b('0x30'),_0xc86b('0x31')]);return squel[_0xc86b('0x2c')]()[_0xc86b('0x42')](_0xc86b('0x37'))[_0xc86b('0x2d')](_0x346a94,squel[_0xc86b('0xf')]()[_0xc86b('0x35')](_0x346a94)[_0xc86b('0x36')](_0x5e4e81)[_0xc86b('0x14')]('('+_0x2f399c[_0xc86b('0x12')](',')+_0xc86b('0x51'),squel[_0xc86b('0xf')]()[_0xc86b('0x35')](_0x2f399c)[_0xc86b('0x36')]('cm_contacts')['where'](_0xc86b('0x45'),_0x389bf3))['where'](_0xc86b('0x52'),squel[_0xc86b('0xf')]()[_0xc86b('0x10')](_0xc86b('0x53'),_0xc86b('0x54'))['from'](_0x5e4e81)[_0xc86b('0x55')](_0x2f399c[_0xc86b('0x12')](','))))[_0xc86b('0x40')]();}function handleStop(){logger[_0xc86b('0x56')](_0xc86b('0x57'));stopped=!![];}function handleUncaughtException(_0x528289){logger[_0xc86b('0x1f')](_0x528289[_0xc86b('0x58')]);process[_0xc86b('0x59')](0x1);}function handleError(_0x468218,_0x15a461){stats['errors']['push']({'name':_0x15a461[_0xc86b('0x5a')],'message':_0x15a461[_0xc86b('0x58')],'row':_0x468218});}function handleQuery(_0x2cc5d8){logger[_0xc86b('0x56')](_0x2cc5d8);return db[_0xc86b('0x15')][_0xc86b('0x16')](_0x2cc5d8)[_0xc86b('0x18')](function(_0x1be7cf){results['push'](_0x1be7cf);})[_0xc86b('0x5b')](function(_0x36fd92){logger[_0xc86b('0x1f')](_0x36fd92[_0xc86b('0x58')]);});}function main(_0x355d03,_0x420e95,_0x545e68,_0x2de055){logger[_0xc86b('0x56')](_0xc86b('0x5c'),_0x355d03,JSON['stringify'](_0x420e95));process[_0xc86b('0x5d')](_0xc86b('0x5e'));var _0x5ef9c5=_0x420e95[_0xc86b('0x5f')];var _0x440c53=_[_0xc86b('0x60')](_0x5ef9c5);var _0x490a54=_0x420e95[_0xc86b('0x61')];var _0xbe3aaa=path[_0xc86b('0x12')](config[_0xc86b('0x62')],'server/files/tmp',_0x490a54+_0xc86b('0x63'));logger[_0xc86b('0x56')](_0xc86b('0x64'),_0x420e95);db[_0xc86b('0x65')][_0xc86b('0x66')]({'raw':!![],'attributes':['id',_0xc86b('0x67')]})[_0xc86b('0x1e')](function(_0x2aff04){for(var _0x2e73f3=0x0;_0x2e73f3<_0x2aff04[_0xc86b('0x19')];_0x2e73f3++){if(_0x2aff04[_0x2e73f3]['name']in _0x5ef9c5){contactItemTypes[_0xc86b('0x1c')](_0x2aff04[_0x2e73f3]);delete _0x440c53[_0x2aff04[_0x2e73f3][_0xc86b('0x67')]];hasAdditionalPhones=!![];}for(var _0x3db00f in _0x5ef9c5){if(_0x2aff04[_0x2e73f3][_0xc86b('0x67')]+_0xc86b('0x68')===_0x3db00f){phoneDescriptions[_0xc86b('0x1c')]({'itemTypeId':_0x2aff04[_0x2e73f3]['id'],'description':_0x3db00f});delete _0x440c53[_0x3db00f];}}}if(hasAdditionalPhones)_0x440c53[_0xc86b('0x1b')]='';var _0x4cde10=_[_0xc86b('0x69')](_0x440c53)[_0xc86b('0x12')]();logger[_0xc86b('0x56')](_0xc86b('0x6a'),_0x4cde10);fs['writeFileSync'](_0xbe3aaa,_0x4cde10+'\x0a');Papa[_0xc86b('0x6b')](fs[_0xc86b('0x6c')](_0x355d03),{'header':!![],'skipEmptyLines':!![],'step':function(_0x24504c,_0x4411c2){try{for(var _0x432d39=0x0,_0x3a9022=[];_0x432d39<_0x24504c[_0xc86b('0x6d')]['length'];_0x432d39++){stats[_0xc86b('0x6e')]+=0x1;if(_0x24504c[_0xc86b('0x6f')][_0x432d39]){handleError(_0x24504c[_0xc86b('0x6d')][_0x432d39],_0x24504c[_0xc86b('0x6f')][_0x432d39]);}else{var _0x9eacb5=[];var _0x4b126c=[];var _0x31ee7b={};for(var _0x266545 in _0x5ef9c5){let _0x290a97=contactItemTypes[_0xc86b('0x70')](_0x89ab66=>_0x89ab66['name']===_0x266545);let _0x24d8fb=contactItemTypes[_0xc86b('0x70')](_0x42f2cf=>_0x42f2cf['name']+_0xc86b('0x68')===_0x266545);if(_[_0xc86b('0x1a')](_0x290a97)&&_[_0xc86b('0x1a')](_0x24d8fb)){if(_0x5ef9c5['hasOwnProperty'](_0x266545)){if(_0x24504c[_0xc86b('0x6d')][_0x432d39][_0x5ef9c5[_0x266545]]){var _0x3ff373=_[_0xc86b('0x71')](_0x24504c[_0xc86b('0x6d')][_0x432d39][_0x5ef9c5[_0x266545]][_0xc86b('0x72')](/"/g,'\x27'));switch(_0x266545){case _0xc86b('0x2e'):var _0x489597=moment(_0x3ff373,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x489597['isValid']()){_0x3a9022[_0xc86b('0x1c')]('\x22'+_0x3ff373+'\x22');}else{_0x9eacb5[_0xc86b('0x1c')](_0xc86b('0x73'));}break;case _0xc86b('0x32'):var _0x593f4f=parseInt(_0x3ff373);_0x3ff373=_[_0xc86b('0x74')](_0x593f4f)||_0x593f4f<0x0||_0x593f4f>0x4?_0x2de055?0x3:0x2:_0x593f4f;_0x3a9022[_0xc86b('0x1c')]('\x22'+_0x3ff373+'\x22');break;case'UserId':var _0x3be667=parseInt(_0x3ff373);if(_[_0xc86b('0x75')](_0x3be667)&&_[_0xc86b('0x76')](_0x545e68,_0x3be667)){_0x3a9022['push']('\x22'+_0x3be667+'\x22');}else{_0x9eacb5[_0xc86b('0x1c')](_0xc86b('0x77'));}break;case'email':if(isEmail(_0x3ff373)){_0x3a9022[_0xc86b('0x1c')]('\x22'+_0x3ff373+'\x22');}else{_0x9eacb5[_0xc86b('0x1c')](_0xc86b('0x78'));}break;case _0xc86b('0x79'):var _0x804b52=moment(_0x3ff373,_0xc86b('0x7a'),!![]);if(_0x804b52[_0xc86b('0x7b')]()){_0x3a9022[_0xc86b('0x1c')]('\x22'+_0x3ff373+'\x22');}else{_0x9eacb5[_0xc86b('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x3a9022[_0xc86b('0x1c')]('\x22'+_0x3ff373+'\x22');}}else{switch(_0x266545){case'firstName':case _0xc86b('0x11'):_0x9eacb5[_0xc86b('0x1c')](_0x266545+'\x20not\x20specified');break;default:_0x3a9022[_0xc86b('0x1c')]('\x22\x22');}}}}else{var _0x5e0a21='';if(!_[_0xc86b('0x1a')](_0x290a97)){if(!_0x31ee7b['hasOwnProperty'](_0x290a97['id'])){for(var _0x3171df=0x0;_0x3171df<_0x5ef9c5[_0x266545][_0xc86b('0x19')];_0x3171df++){var _0x3ff373=_[_0xc86b('0x71')](_0x24504c['data'][_0x432d39][_0x5ef9c5[_0x266545][_0x3171df]]['replace'](/"/g,'\x27'));var _0x113e3e=phoneDescriptions[_0xc86b('0x70')](_0x8329d4=>_0x8329d4[_0xc86b('0x7c')]===_0x290a97['id']);if(!_['isNil'](_0x113e3e)){var _0x2aaac4=_[_0xc86b('0x71')](_0x24504c[_0xc86b('0x6d')][_0x432d39][_0x5ef9c5[_0x113e3e['description']][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xc86b('0x1a')](_0x2aaac4))_0x3ff373=_0x3ff373+'§'+_0x2aaac4;}if(_0x5e0a21=='')_0x5e0a21=_0x3ff373;else _0x5e0a21+='|'+_0x3ff373;}_0x4b126c[_0xc86b('0x1c')](_0x290a97['id']+':'+_0x5e0a21);_0x31ee7b[_0x290a97['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3a9022[_0xc86b('0x1c')]('\x22'+_0x4b126c[_0xc86b('0x12')](';')+'\x22');}if(_0x9eacb5[_0xc86b('0x19')]){handleError(_0x24504c['data'][_0x432d39],{'code':_0xc86b('0x7d'),'message':_0x9eacb5[_0xc86b('0x12')]()});}else{fs[_0xc86b('0x7e')](_0xbe3aaa,_0x3a9022[_0xc86b('0x12')]()+'\x0a');}_0x3a9022=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xc86b('0x7f')+_0x490a54,stats);stats[_0xc86b('0x6f')]=[];}}if(stopped){logger[_0xc86b('0x56')](_0xc86b('0x80'));_0x4411c2['abort']();}}catch(_0x5f328a){handleError(_0x24504c['data'][_0x432d39],{'code':_0xc86b('0x81'),'message':_0x5f328a[_0xc86b('0x58')]});logger[_0xc86b('0x1f')](_0xc86b('0x82'),_0x5f328a[_0xc86b('0x58')]);}},'complete':function(){try{var _0x5af967=[];var _0x1f5539=tempTableName;_0x5af967[_0xc86b('0x1c')](_0xc86b('0x83')+_0x1f5539+'\x20LIKE\x20cm_contacts;');logger[_0xc86b('0x56')](_0xc86b('0x84'),contactItemTypes[_0xc86b('0x19')]);var _0x2f628c=util[_0xc86b('0xb')](_0xc86b('0x85'),_0xbe3aaa,_0x1f5539,_0x4cde10,_0x420e95[_0xc86b('0x43')],_0x420e95[_0xc86b('0x50')]||null,NOW,NOW);if(_[_0xc86b('0x1a')](_0x5ef9c5[_0xc86b('0x2e')])){_0x2f628c+=_0xc86b('0x86');}_0x5af967[_0xc86b('0x1c')](_0x2f628c);BPromise[_0xc86b('0x87')](_0x5af967,handleQuery)[_0xc86b('0x1e')](function(_0x5f865){BPromise[_0xc86b('0x1d')]([handleAdditionalPhones()])[_0xc86b('0x1e')](function(){_0x5af967=[];for(var _0x451a5b=0x0;_0x451a5b\x20\x20');}var _0x2e0c11=path[_0xc86b('0x12')](config[_0xc86b('0x62')],_0xc86b('0x8f'),process[_0xc86b('0x8e')][0x2]);if(!fs['existsSync'](_0x2e0c11)){throw new Error(_0xc86b('0x90'));}var _0x15996b={};try{_0x15996b=JSON[_0xc86b('0x6b')](process[_0xc86b('0x8e')][0x3]);if(!_0x15996b[_0xc86b('0x5f')]){throw new Error(_0xc86b('0x91'));}var _0xcd541c=0x0;if(_0x15996b[_0xc86b('0x5f')][_0xc86b('0x33')]){_0xcd541c=0x1;}if(!_0x15996b[_0xc86b('0x43')]){throw new Error(_0xc86b('0x92'));}}catch(_0x36b0ff){throw new Error(_0xc86b('0x93'));}var _0x4fa60a=[];try{_0x4fa60a=_[_0xc86b('0x94')](JSON[_0xc86b('0x6b')](process[_0xc86b('0x8e')][0x4]),'id');}catch(_0x4081d8){logger[_0xc86b('0x56')](_0xc86b('0x95'));}main(_0x2e0c11,_0x15996b,_0x4fa60a,_0xcd541c);}validate();process['on'](_0xc86b('0x96'),handleStop);process['on'](_0xc86b('0x97'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 307c881..0e8b102 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 _0xf99a=['talktime','Called\x20Number','Member\x20Name','membername','uniqueid','starttime','***\x20Time\x20Info\x20***','answertime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','outbound','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','destcalleridnum','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf99a,0xf2));var _0xaf99=function(_0x13c9bd,_0x35ac23){_0x13c9bd=_0x13c9bd-0x0;var _0x6cc6f7=_0xf99a[_0x13c9bd];return _0x6cc6f7;};'use strict';exports[_0xaf99('0x0')]=function(_0x53e412,_0x1006bc){var _0x150ffe=[{'type':_0xaf99('0x1'),'content':_0xaf99('0x2'),'variableName':null}];switch(_0x53e412[_0xaf99('0x3')]()){case _0xaf99('0x4'):switch(_0x1006bc[_0xaf99('0x3')]()){case _0xaf99('0x5'):_0x150ffe[_0xaf99('0x6')]({'type':_0xaf99('0x7'),'content':'','variableName':'queue'});_0x150ffe[_0xaf99('0x6')]({'type':'variable','content':'','variableName':_0xaf99('0x8')});break;case _0xaf99('0x9'):_0x150ffe[_0xaf99('0x6')]({'type':_0xaf99('0x1'),'content':_0xaf99('0xa'),'variableName':null});_0x150ffe[_0xaf99('0x6')]({'type':_0xaf99('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x150ffe;};exports['getDescriptions']=function(_0xf77984,_0x316f51){var _0x2aa637=[];switch(_0xf77984[_0xaf99('0x3')]()){case _0xaf99('0x4'):switch(_0x316f51[_0xaf99('0x3')]()){case _0xaf99('0x5'):_0x2aa637=[{'type':_0xaf99('0x1'),'content':_0xaf99('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0xd'),'keyType':_0xaf99('0x7'),'variableName':_0xaf99('0x8')},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0xe'),'keyType':_0xaf99('0x7'),'variableName':_0xaf99('0xf')},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x10'),'keyType':_0xaf99('0x7'),'variableName':_0xaf99('0x11')},{'type':'keyValue','content':'','key':_0xaf99('0x12'),'keyType':_0xaf99('0x7'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0xaf99('0x13'),'keyType':_0xaf99('0x7'),'variableName':'uniqueid'},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x14'),'keyType':_0xaf99('0x7'),'variableName':_0xaf99('0x15')},{'type':'string','content':_0xaf99('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xaf99('0xc'),'content':'','key':'Agent\x20Name','keyType':_0xaf99('0x7'),'variableName':_0xaf99('0x17')},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x18'),'keyType':_0xaf99('0x7'),'variableName':_0xaf99('0x19')},{'type':_0xaf99('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x1a'),'keyType':'variable','variableName':_0xaf99('0x15')},{'type':'keyValue','content':'','key':_0xaf99('0x1b'),'keyType':'variable','variableName':_0xaf99('0x1c')},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x1d'),'keyType':_0xaf99('0x7'),'variableName':_0xaf99('0x1e')},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x1f'),'keyType':_0xaf99('0x7'),'variableName':_0xaf99('0x20')},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x21'),'keyType':_0xaf99('0x7'),'variableName':_0xaf99('0x22')}];break;case'outbound':_0x2aa637=[{'type':_0xaf99('0x1'),'content':_0xaf99('0xb'),'variableName':null},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x23'),'keyType':_0xaf99('0x7'),'keyContent':'','variableName':_0xaf99('0x19')},{'type':'keyValue','content':'','key':_0xaf99('0x24'),'keyType':'variable','keyContent':'','variableName':_0xaf99('0x25')},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x13'),'keyType':_0xaf99('0x7'),'keyContent':'','variableName':_0xaf99('0x26')},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x14'),'keyType':_0xaf99('0x7'),'keyContent':'','variableName':_0xaf99('0x27')},{'type':_0xaf99('0x1'),'content':_0xaf99('0x28')},{'type':_0xaf99('0xc'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0xaf99('0x29')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0xaf99('0x7'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0xaf99('0x2a'),'keyType':_0xaf99('0x7'),'keyContent':'','variableName':_0xaf99('0x2b')},{'type':_0xaf99('0xc'),'content':'','key':_0xaf99('0x2c'),'keyType':_0xaf99('0x7'),'keyContent':'','variableName':_0xaf99('0x2d')}];break;}}return _0x2aa637;}; \ No newline at end of file +var _0xaa38=['holdtime','Talk\x20Time','talktime','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','billableseconds','string','voice','toLowerCase','inbound','variable','queue','push','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','uniqueid','Date','agentcalledAt','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time'];(function(_0x4e1b3a,_0x3c547c){var _0x2673cf=function(_0x450a77){while(--_0x450a77){_0x4e1b3a['push'](_0x4e1b3a['shift']());}};_0x2673cf(++_0x3c547c);}(_0xaa38,0x132));var _0x8aa3=function(_0x2178ad,_0x4f8933){_0x2178ad=_0x2178ad-0x0;var _0x248cf2=_0xaa38[_0x2178ad];return _0x248cf2;};'use strict';exports['getSubjects']=function(_0x25c853,_0x94f015){var _0x15aa66=[{'type':_0x8aa3('0x0'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x25c853['toLowerCase']()){case _0x8aa3('0x1'):switch(_0x94f015[_0x8aa3('0x2')]()){case _0x8aa3('0x3'):_0x15aa66['push']({'type':_0x8aa3('0x4'),'content':'','variableName':_0x8aa3('0x5')});_0x15aa66[_0x8aa3('0x6')]({'type':'variable','content':'','variableName':_0x8aa3('0x7')});break;case _0x8aa3('0x8'):_0x15aa66['push']({'type':_0x8aa3('0x0'),'content':_0x8aa3('0x9'),'variableName':null});_0x15aa66['push']({'type':_0x8aa3('0x4'),'content':'','variableName':_0x8aa3('0xa')});break;}}return _0x15aa66;};exports[_0x8aa3('0xb')]=function(_0x2e1a02,_0x50c088){var _0x40023c=[];switch(_0x2e1a02[_0x8aa3('0x2')]()){case'voice':switch(_0x50c088['toLowerCase']()){case _0x8aa3('0x3'):_0x40023c=[{'type':'string','content':_0x8aa3('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x8aa3('0xd'),'content':'','key':_0x8aa3('0xe'),'keyType':_0x8aa3('0x4'),'variableName':_0x8aa3('0x7')},{'type':_0x8aa3('0xd'),'content':'','key':'Caller\x20Name','keyType':_0x8aa3('0x4'),'variableName':_0x8aa3('0xf')},{'type':_0x8aa3('0xd'),'content':'','key':_0x8aa3('0x10'),'keyType':_0x8aa3('0x4'),'variableName':_0x8aa3('0x11')},{'type':_0x8aa3('0xd'),'content':'','key':'Queue','keyType':_0x8aa3('0x4'),'variableName':_0x8aa3('0x5')},{'type':_0x8aa3('0xd'),'content':'','key':'UniqueId','keyType':_0x8aa3('0x4'),'variableName':_0x8aa3('0x12')},{'type':_0x8aa3('0xd'),'content':'','key':_0x8aa3('0x13'),'keyType':_0x8aa3('0x4'),'variableName':_0x8aa3('0x14')},{'type':_0x8aa3('0x0'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x8aa3('0x15'),'keyType':_0x8aa3('0x4'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0x8aa3('0x16'),'keyType':'variable','variableName':_0x8aa3('0xa')},{'type':_0x8aa3('0x0'),'content':_0x8aa3('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x8aa3('0xd'),'content':'','key':_0x8aa3('0x18'),'keyType':'variable','variableName':_0x8aa3('0x14')},{'type':_0x8aa3('0xd'),'content':'','key':_0x8aa3('0x19'),'keyType':'variable','variableName':_0x8aa3('0x1a')},{'type':_0x8aa3('0xd'),'content':'','key':_0x8aa3('0x1b'),'keyType':_0x8aa3('0x4'),'variableName':_0x8aa3('0x1c')},{'type':_0x8aa3('0xd'),'content':'','key':_0x8aa3('0x1d'),'keyType':_0x8aa3('0x4'),'variableName':_0x8aa3('0x1e')},{'type':_0x8aa3('0xd'),'content':'','key':_0x8aa3('0x1f'),'keyType':'variable','variableName':_0x8aa3('0x20')}];break;case _0x8aa3('0x8'):_0x40023c=[{'type':_0x8aa3('0x0'),'content':_0x8aa3('0xc'),'variableName':null},{'type':_0x8aa3('0xd'),'content':'','key':'Called\x20Number','keyType':_0x8aa3('0x4'),'keyContent':'','variableName':_0x8aa3('0xa')},{'type':_0x8aa3('0xd'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0x8aa3('0x21')},{'type':'keyValue','content':'','key':_0x8aa3('0x22'),'keyType':'variable','keyContent':'','variableName':_0x8aa3('0x12')},{'type':_0x8aa3('0xd'),'content':'','key':_0x8aa3('0x13'),'keyType':_0x8aa3('0x4'),'keyContent':'','variableName':_0x8aa3('0x23')},{'type':_0x8aa3('0x0'),'content':_0x8aa3('0x17')},{'type':'keyValue','content':'','key':_0x8aa3('0x24'),'keyType':_0x8aa3('0x4'),'keyContent':'','variableName':_0x8aa3('0x25')},{'type':'keyValue','content':'','key':_0x8aa3('0x26'),'keyType':_0x8aa3('0x4'),'keyContent':'','variableName':'endtime'},{'type':_0x8aa3('0xd'),'content':'','key':_0x8aa3('0x27'),'keyType':'variable','keyContent':'','variableName':_0x8aa3('0x28')},{'type':_0x8aa3('0xd'),'content':'','key':'Billable\x20Time','keyType':_0x8aa3('0x4'),'keyContent':'','variableName':_0x8aa3('0x29')}];break;}}return _0x40023c;}; \ No newline at end of file diff --git a/server/components/interaction/accept-message.js b/server/components/interaction/accept-message.js index 17ef7ef..08be90d 100644 --- a/server/components/interaction/accept-message.js +++ b/server/components/interaction/accept-message.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc01=['APINotFoundError','../../config/logger','api','http','info','%s,\x20%s,\x20%s','debug','%s,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','user','get','read','YYYY-MM-DD\x20HH:mm:ss','UserId','getAcceptParams','capitalize','findOne','then','Message\x20with\x20id\x20','\x20not\x20found','update','updateMessageById','Interaction','Interaction\x20with\x20id\x20','read1stAt','format','updateInteractionById','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','Contact\x20with\x20id\x20','findContactById','User','agent','fullname','email','internal','chat','ChatInteractionId','fax','FaxInteractionId','mail','MailInteractionId','openchannel','OpenchannelInteractionId','sms','SmsInteractionId','WhatsappInteractionId','min','col','isNewInteraction','assign','parse','interaction','EventManager','acceptmessage','Message','AcceptMessage','acceptMessage','sendRoutingAcceptEvent','newinteraction','opened','sendInteractionOpenedEvent','lodash','../../mysqldb','../../errors/api'];(function(_0x132641,_0x153b24){var _0xc68b80=function(_0x14dd35){while(--_0x14dd35){_0x132641['push'](_0x132641['shift']());}};_0xc68b80(++_0x153b24);}(_0xbc01,0xd2));var _0x1bc0=function(_0x17be21,_0x311a25){_0x17be21=_0x17be21-0x0;var _0x4cbc37=_0xbc01[_0x17be21];return _0x4cbc37;};'use strict';var _=require(_0x1bc0('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var db=require(_0x1bc0('0x1'))['db'];var APINotFoundError=require(_0x1bc0('0x2'))[_0x1bc0('0x3')];var logger=require(_0x1bc0('0x4'))(_0x1bc0('0x5'));var rpcAmiClient=jayson['client'][_0x1bc0('0x6')]({'port':0x232a});var rpcRoutingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3b968a,_0x22d72c,_0x1972dc,_0x371851,_0x2e9e0d){return new Promise(function(_0x1a96a4,_0x53e05e){return _0x2e9e0d['request'](_0x22d72c,_0x371851)['then'](function(_0xbb47f8){logger[_0x1bc0('0x7')](_0x1bc0('0x8'),_0x3b968a,_0x1972dc,'request\x20sent');logger[_0x1bc0('0x9')](_0x1bc0('0xa'),_0x3b968a,_0x1972dc,'request\x20sent',JSON['stringify'](_0xbb47f8));if(_0xbb47f8[_0x1bc0('0xb')]){if(_0xbb47f8[_0x1bc0('0xb')][_0x1bc0('0xc')]===0x1f4){logger[_0x1bc0('0xb')]('%s,\x20%s,\x20%s',_0x3b968a,_0x1972dc,_0xbb47f8['error'][_0x1bc0('0xd')]);return _0x53e05e(_0xbb47f8['error']['message']);}logger[_0x1bc0('0xb')](_0x1bc0('0x8'),_0x3b968a,_0x1972dc,_0xbb47f8['error']['message']);return _0x1a96a4(_0xbb47f8['error'][_0x1bc0('0xd')]);}else{logger['info'](_0x1bc0('0x8'),_0x3b968a,_0x1972dc,_0x1bc0('0xe'));_0x1a96a4(_0xbb47f8['result']['message']);}})['catch'](function(_0x1b5a58){logger[_0x1bc0('0xb')](_0x1bc0('0x8'),_0x3b968a,_0x1972dc,_0x1b5a58);_0x53e05e(_0x1b5a58);});});}function getAcceptParams(_0x2b44d8){var _0x4db893=_0x2b44d8['params']['id'];var _0x10aaff=_0x2b44d8['body'];delete _0x10aaff['id'];var _0x4ed4a2=_0x2b44d8[_0x1bc0('0xf')][_0x1bc0('0x10')]({'plain':!![]});_0x10aaff[_0x1bc0('0x11')]=!![];_0x10aaff['readAt']=moment()['format'](_0x1bc0('0x12'));_0x10aaff[_0x1bc0('0x13')]=_0x10aaff['UserId']||_0x4ed4a2['id'];return{'messageId':_0x4db893,'payload':_0x10aaff,'user':_0x4ed4a2};}exports[_0x1bc0('0x14')]=getAcceptParams;function updateMessageById(_0xa9e857,_0x540b53,_0x5538d1){var _0x14ce8c=_[_0x1bc0('0x15')](_0xa9e857)+'Message';return db[_0x14ce8c][_0x1bc0('0x16')]({'where':{'id':_0x540b53,'UserId':null}})[_0x1bc0('0x17')](function(_0x50526b){if(!_0x50526b){throw new APINotFoundError(_0x1bc0('0x18')+_0x540b53+_0x1bc0('0x19'));}return _0x50526b[_0x1bc0('0x1a')](_0x5538d1);})[_0x1bc0('0x17')](function(_0x172a7d){return _0x172a7d[_0x1bc0('0x10')]({'plain':!![]});});}exports[_0x1bc0('0x1b')]=updateMessageById;function updateInteractionById(_0x211405,_0x54c123,_0x4c86c0){var _0x42e201=_['capitalize'](_0x211405)+_0x1bc0('0x1c');return db[_0x42e201][_0x1bc0('0x16')]({'where':{'id':_0x54c123}})['then'](function(_0x245f0f){if(!_0x245f0f){throw new APINotFoundError(_0x1bc0('0x1d')+_0x54c123+_0x1bc0('0x19'));}var _0x5091b1=_0x245f0f[_0x1bc0('0x1e')]||moment()[_0x1bc0('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');return _0x245f0f['update']({'UserId':_0x4c86c0,'read1stAt':_0x5091b1});})['then'](function(_0x2e4343){return _0x2e4343['get']({'plain':!![]});});}exports[_0x1bc0('0x20')]=updateInteractionById;function findContactById(_0x644fa6){var _0xd2ab38=_0x1bc0('0x21')+_0x644fa6;return db[_0x1bc0('0x22')][_0x1bc0('0x23')](_0xd2ab38,{'type':db[_0x1bc0('0x22')][_0x1bc0('0x24')][_0x1bc0('0x25')],'raw':!![]})[_0x1bc0('0x17')](function(_0x2813c2){if(_0x2813c2['length']===0x0){throw new APINotFoundError(_0x1bc0('0x26')+_0x644fa6+_0x1bc0('0x19'));}return _0x2813c2[0x0];});}exports[_0x1bc0('0x27')]=findContactById;function findAgentById(_0x31206b){return db[_0x1bc0('0x28')][_0x1bc0('0x16')]({'where':{'id':_0x31206b,'role':_0x1bc0('0x29')},'attributes':['id','name',_0x1bc0('0x2a'),_0x1bc0('0x2b'),_0x1bc0('0x2c')],'raw':!![]});}exports['findAgentById']=findAgentById;function isNewInteraction(_0x2216fe,_0x26347a,_0x3939c4){var _0x16686d=_[_0x1bc0('0x15')](_0x2216fe)+'Message';var _0x32f838={};switch(_0x2216fe){case _0x1bc0('0x2d'):_0x32f838[_0x1bc0('0x2e')]=_0x26347a;break;case _0x1bc0('0x2f'):_0x32f838[_0x1bc0('0x30')]=_0x26347a;break;case _0x1bc0('0x31'):_0x32f838[_0x1bc0('0x32')]=_0x26347a;break;case _0x1bc0('0x33'):_0x32f838[_0x1bc0('0x34')]=_0x26347a;break;case _0x1bc0('0x35'):_0x32f838[_0x1bc0('0x36')]=_0x26347a;break;case'whatsapp':_0x32f838[_0x1bc0('0x37')]=_0x26347a;break;}return db[_0x16686d]['findOne']({'where':_0x32f838,'attributes':[[db['sequelize']['fn'](_0x1bc0('0x38'),db['sequelize'][_0x1bc0('0x39')]('id')),'id']],'raw':!![]})[_0x1bc0('0x17')](function(_0x118913){return _0x3939c4===_0x118913['id'];});}exports[_0x1bc0('0x3a')]=isNewInteraction;function sendAmiAcceptEvent(_0x397e4f,_0x1678ab){var _0x5b7aad=_[_0x1bc0('0x15')](_0x397e4f)+'Message';var _0x3a851c=_0x1678ab[_0x1bc0('0xd')];if(_0x397e4f==='chat'){Object[_0x1bc0('0x3b')](_0x3a851c,JSON[_0x1bc0('0x3c')](_0x1678ab[_0x1bc0('0x3d')]['formData']));}return respondWithRpcPromise(_0x5b7aad,_0x1bc0('0x3e'),_0x1bc0('0x3e'),{'event':_0x1bc0('0x3f'),'message':_0x3a851c},rpcAmiClient);}exports['sendAmiAcceptEvent']=sendAmiAcceptEvent;function sendRoutingAcceptEvent(_0x4131c0,_0x4d80f9){var _0x483395=_[_0x1bc0('0x15')](_0x4131c0)+_0x1bc0('0x40');return respondWithRpcPromise(_0x483395,_0x1bc0('0x41'),_0x1bc0('0x42'),_0x4d80f9,rpcRoutingClient);}exports[_0x1bc0('0x43')]=sendRoutingAcceptEvent;function sendInteractionOpenedEvent(_0x3ca4e8,_0x2976eb){var _0x502272=_['capitalize'](_0x3ca4e8)+_0x1bc0('0x40');return respondWithRpcPromise(_0x502272,_0x1bc0('0x3e'),_0x1bc0('0x3e'),{'event':_0x1bc0('0x44'),'message':Object['assign']({},_0x2976eb,{'event':_0x1bc0('0x45')})},rpcAmiClient);}exports[_0x1bc0('0x46')]=sendInteractionOpenedEvent; \ No newline at end of file +var _0xbf07=['EventManager','acceptmessage','sendAmiAcceptEvent','AcceptMessage','acceptMessage','sendRoutingAcceptEvent','newinteraction','sendInteractionOpenedEvent','../../mysqldb','../../errors/api','APINotFoundError','../../config/logger','api','client','http','then','info','%s,\x20%s,\x20%s','request\x20sent','debug','%s,\x20%s,\x20%s,\x20%s','code','error','message','catch','params','user','get','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','getAcceptParams','capitalize','findOne','Message\x20with\x20id\x20','\x20not\x20found','updateMessageById','Interaction','Interaction\x20with\x20id\x20','read1stAt','updateInteractionById','sequelize','query','QueryTypes','SELECT','length','Contact\x20with\x20id\x20','findContactById','name','fullname','internal','findAgentById','Message','chat','fax','mail','openchannel','OpenchannelInteractionId','sms','SmsInteractionId','WhatsappInteractionId','min','col','isNewInteraction','parse','interaction','formData'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0xbf07,0x92));var _0x7bf0=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0xbf07[_0x2afbb0];return _0x411ff2;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require('jayson/promise');var db=require(_0x7bf0('0x0'))['db'];var APINotFoundError=require(_0x7bf0('0x1'))[_0x7bf0('0x2')];var logger=require(_0x7bf0('0x3'))(_0x7bf0('0x4'));var rpcAmiClient=jayson[_0x7bf0('0x5')][_0x7bf0('0x6')]({'port':0x232a});var rpcRoutingClient=jayson[_0x7bf0('0x5')][_0x7bf0('0x6')]({'port':0x232c});function respondWithRpcPromise(_0xedc5bc,_0x27dd57,_0x5a8a9b,_0x279959,_0x2a40b4){return new Promise(function(_0xfe395b,_0x1c0632){return _0x2a40b4['request'](_0x27dd57,_0x279959)[_0x7bf0('0x7')](function(_0xb3c59d){logger[_0x7bf0('0x8')](_0x7bf0('0x9'),_0xedc5bc,_0x5a8a9b,_0x7bf0('0xa'));logger[_0x7bf0('0xb')](_0x7bf0('0xc'),_0xedc5bc,_0x5a8a9b,'request\x20sent',JSON['stringify'](_0xb3c59d));if(_0xb3c59d['error']){if(_0xb3c59d['error'][_0x7bf0('0xd')]===0x1f4){logger[_0x7bf0('0xe')]('%s,\x20%s,\x20%s',_0xedc5bc,_0x5a8a9b,_0xb3c59d[_0x7bf0('0xe')][_0x7bf0('0xf')]);return _0x1c0632(_0xb3c59d[_0x7bf0('0xe')][_0x7bf0('0xf')]);}logger[_0x7bf0('0xe')](_0x7bf0('0x9'),_0xedc5bc,_0x5a8a9b,_0xb3c59d[_0x7bf0('0xe')][_0x7bf0('0xf')]);return _0xfe395b(_0xb3c59d[_0x7bf0('0xe')][_0x7bf0('0xf')]);}else{logger[_0x7bf0('0x8')](_0x7bf0('0x9'),_0xedc5bc,_0x5a8a9b,'request\x20sent');_0xfe395b(_0xb3c59d['result'][_0x7bf0('0xf')]);}})[_0x7bf0('0x10')](function(_0x2ef9e9){logger['error'](_0x7bf0('0x9'),_0xedc5bc,_0x5a8a9b,_0x2ef9e9);_0x1c0632(_0x2ef9e9);});});}function getAcceptParams(_0x154d50){var _0x7e08ac=_0x154d50[_0x7bf0('0x11')]['id'];var _0x1a10a4=_0x154d50['body'];delete _0x1a10a4['id'];var _0x3a1cf0=_0x154d50[_0x7bf0('0x12')][_0x7bf0('0x13')]({'plain':!![]});_0x1a10a4[_0x7bf0('0x14')]=!![];_0x1a10a4[_0x7bf0('0x15')]=moment()[_0x7bf0('0x16')](_0x7bf0('0x17'));_0x1a10a4[_0x7bf0('0x18')]=_0x1a10a4[_0x7bf0('0x18')]||_0x3a1cf0['id'];return{'messageId':_0x7e08ac,'payload':_0x1a10a4,'user':_0x3a1cf0};}exports[_0x7bf0('0x19')]=getAcceptParams;function updateMessageById(_0x54356f,_0x5c41e7,_0x5a332a){var _0x5339c6=_[_0x7bf0('0x1a')](_0x54356f)+'Message';return db[_0x5339c6][_0x7bf0('0x1b')]({'where':{'id':_0x5c41e7,'UserId':null}})[_0x7bf0('0x7')](function(_0x52eca5){if(!_0x52eca5){throw new APINotFoundError(_0x7bf0('0x1c')+_0x5c41e7+_0x7bf0('0x1d'));}return _0x52eca5['update'](_0x5a332a);})['then'](function(_0xcb9281){return _0xcb9281[_0x7bf0('0x13')]({'plain':!![]});});}exports[_0x7bf0('0x1e')]=updateMessageById;function updateInteractionById(_0x12423d,_0x2f2a18,_0xda04c2){var _0x4c10dd=_[_0x7bf0('0x1a')](_0x12423d)+_0x7bf0('0x1f');return db[_0x4c10dd][_0x7bf0('0x1b')]({'where':{'id':_0x2f2a18}})[_0x7bf0('0x7')](function(_0xeb9d7d){if(!_0xeb9d7d){throw new APINotFoundError(_0x7bf0('0x20')+_0x2f2a18+'\x20not\x20found');}var _0x4f4ec9=_0xeb9d7d[_0x7bf0('0x21')]||moment()['format'](_0x7bf0('0x17'));return _0xeb9d7d['update']({'UserId':_0xda04c2,'read1stAt':_0x4f4ec9});})[_0x7bf0('0x7')](function(_0xe7931a){return _0xe7931a[_0x7bf0('0x13')]({'plain':!![]});});}exports[_0x7bf0('0x22')]=updateInteractionById;function findContactById(_0x180425){var _0xbd19a2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x180425;return db[_0x7bf0('0x23')][_0x7bf0('0x24')](_0xbd19a2,{'type':db[_0x7bf0('0x23')][_0x7bf0('0x25')][_0x7bf0('0x26')],'raw':!![]})[_0x7bf0('0x7')](function(_0x12d750){if(_0x12d750[_0x7bf0('0x27')]===0x0){throw new APINotFoundError(_0x7bf0('0x28')+_0x180425+_0x7bf0('0x1d'));}return _0x12d750[0x0];});}exports[_0x7bf0('0x29')]=findContactById;function findAgentById(_0xeab2af){return db['User'][_0x7bf0('0x1b')]({'where':{'id':_0xeab2af,'role':'agent'},'attributes':['id',_0x7bf0('0x2a'),_0x7bf0('0x2b'),'email',_0x7bf0('0x2c')],'raw':!![]});}exports[_0x7bf0('0x2d')]=findAgentById;function isNewInteraction(_0x30e364,_0x31fcf9,_0x2dc69a){var _0x2ee4df=_['capitalize'](_0x30e364)+_0x7bf0('0x2e');var _0xbb5e05={};switch(_0x30e364){case _0x7bf0('0x2f'):_0xbb5e05['ChatInteractionId']=_0x31fcf9;break;case _0x7bf0('0x30'):_0xbb5e05['FaxInteractionId']=_0x31fcf9;break;case _0x7bf0('0x31'):_0xbb5e05['MailInteractionId']=_0x31fcf9;break;case _0x7bf0('0x32'):_0xbb5e05[_0x7bf0('0x33')]=_0x31fcf9;break;case _0x7bf0('0x34'):_0xbb5e05[_0x7bf0('0x35')]=_0x31fcf9;break;case'whatsapp':_0xbb5e05[_0x7bf0('0x36')]=_0x31fcf9;break;}return db[_0x2ee4df]['findOne']({'where':_0xbb5e05,'attributes':[[db[_0x7bf0('0x23')]['fn'](_0x7bf0('0x37'),db['sequelize'][_0x7bf0('0x38')]('id')),'id']],'raw':!![]})[_0x7bf0('0x7')](function(_0x3afb5b){return _0x2dc69a===_0x3afb5b['id'];});}exports[_0x7bf0('0x39')]=isNewInteraction;function sendAmiAcceptEvent(_0x512ddf,_0x3ebe14){var _0x753f43=_[_0x7bf0('0x1a')](_0x512ddf)+_0x7bf0('0x2e');var _0x3ab51c=_0x3ebe14['message'];if(_0x512ddf===_0x7bf0('0x2f')){Object['assign'](_0x3ab51c,JSON[_0x7bf0('0x3a')](_0x3ebe14[_0x7bf0('0x3b')][_0x7bf0('0x3c')]));}return respondWithRpcPromise(_0x753f43,_0x7bf0('0x3d'),_0x7bf0('0x3d'),{'event':_0x7bf0('0x3e'),'message':_0x3ab51c},rpcAmiClient);}exports[_0x7bf0('0x3f')]=sendAmiAcceptEvent;function sendRoutingAcceptEvent(_0x168026,_0xc4db2e){var _0x4adcf4=_['capitalize'](_0x168026)+'Message';return respondWithRpcPromise(_0x4adcf4,_0x7bf0('0x40'),_0x7bf0('0x41'),_0xc4db2e,rpcRoutingClient);}exports[_0x7bf0('0x42')]=sendRoutingAcceptEvent;function sendInteractionOpenedEvent(_0x1984b5,_0x42503e){var _0xbd4f2d=_[_0x7bf0('0x1a')](_0x1984b5)+_0x7bf0('0x2e');return respondWithRpcPromise(_0xbd4f2d,'EventManager','EventManager',{'event':_0x7bf0('0x43'),'message':Object['assign']({},_0x42503e,{'event':'opened'})},rpcAmiClient);}exports[_0x7bf0('0x44')]=sendInteractionOpenedEvent; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index ed7e836..c4400aa 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 _0xd574=['updateMessageById','message','updateInteractionById','capitalize','InteractionId','interaction','sendRoutingAcceptEvent','ContactId','findAgentById','manual','SIP/','isNewInteraction','assign','sendInteractionOpenedEvent','accept','sendAmiAcceptEvent','acceptMessage','lodash','./accept-message','./sql-utils','findAll','skipInteractionsQuery','getInteractionsQuery','resolve','then','parseAdvancedSearchFilter','parseQueryParameters','body','contact','where','fields','filter','user','having','tags','checkAccountsRestrictions','i.id','search','ids','countFilteredInteractions','count','length','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','query','html','phone','fax','mobile','updateUser','getAcceptParams','messageId','payload','agent','UserId'];(function(_0x1b0893,_0x12827a){var _0x2042cc=function(_0x52719f){while(--_0x52719f){_0x1b0893['push'](_0x1b0893['shift']());}};_0x2042cc(++_0x12827a);}(_0xd574,0x18b));var _0x4d57=function(_0xca493b,_0x7ff2f3){_0xca493b=_0xca493b-0x0;var _0x1433a8=_0xd574[_0xca493b];return _0x1433a8;};'use strict';var _=require(_0x4d57('0x0'));var acceptUtils=require(_0x4d57('0x1'));var sqlUtils=require(_0x4d57('0x2'));var utils=require('./utils');exports[_0x4d57('0x3')]=function(_0x19de11,_0x3c0d2a,_0x1f6c4c,_0x2381df,_0x221e2a){var _0x398a51={'count':0x0,'rows':[]};var _0x243a6e=sqlUtils[_0x4d57('0x4')](_0x19de11,_0x1f6c4c,_0x3c0d2a);if(_0x243a6e){return Promise['resolve'](_0x398a51);}var _0x3951d2=sqlUtils[_0x4d57('0x5')](_0x19de11);var _0x32d1e1={};return Promise[_0x4d57('0x6')]()[_0x4d57('0x7')](function(){if(_0x3c0d2a['search']){return sqlUtils[_0x4d57('0x8')](_0x3c0d2a['search'],_0x221e2a);}else{return sqlUtils[_0x4d57('0x9')](_0x19de11,_0x3c0d2a,_0x221e2a);}})[_0x4d57('0x7')](function(_0x1dbdbb){_0x3951d2['where'](_0x1dbdbb[_0x4d57('0xa')]);_0x3951d2['where'](_0x1dbdbb[_0x4d57('0xb')]);_0x3951d2[_0x4d57('0xc')](_0x1dbdbb['default']);_0x3951d2[_0x4d57('0xc')](_0x1dbdbb[_0x4d57('0xd')]);_0x3951d2[_0x4d57('0xc')](_0x1dbdbb[_0x4d57('0xe')]);_0x3951d2[_0x4d57('0xc')](_0x1dbdbb[_0x4d57('0xf')]);_0x3951d2[_0x4d57('0x10')](_0x1dbdbb['read']);_0x32d1e1=_0x1dbdbb[_0x4d57('0x11')];return sqlUtils[_0x4d57('0x12')](_0x19de11,_0x1f6c4c,_0x3c0d2a);})[_0x4d57('0x7')](function(_0x4cc257){_0x3951d2['where'](_0x4cc257);_0x3951d2['group'](_0x4d57('0x13'));var _0x20ed64=_0x3c0d2a[_0x4d57('0x14')]?_0x32d1e1[_0x4d57('0x15')]:_0x3c0d2a['tag'];return sqlUtils[_0x4d57('0x16')](_0x3951d2,_0x20ed64);})[_0x4d57('0x7')](function(_0x298df0){_0x398a51[_0x4d57('0x17')]=_0x298df0[_0x4d57('0x18')];if(_0x398a51[_0x4d57('0x17')]===0x0){return[];}_0x3951d2[_0x4d57('0x10')](_0x32d1e1['clause']);if(_0x2381df['order']){_0x2381df[_0x4d57('0x19')][_0x4d57('0x1a')](function(_0x253774){var _0x160bcb=_0x253774[0x0]===_0x4d57('0x1b')?_0x253774[0x0]:'i.'+_0x253774[0x0];_0x3951d2['order'](_0x160bcb,_0x253774[0x1]===_0x4d57('0x1c')?![]:!![]);if(_0x253774[0x0]===_0x4d57('0x1d')){var _0x4076ea=sqlUtils[_0x4d57('0x1e')](_0x19de11,_0x3c0d2a);_0x3951d2[_0x4d57('0x19')](_0x4076ea,_0x253774[0x1]===_0x4d57('0x1c')?![]:!![]);}});}return sqlUtils[_0x4d57('0x1f')](_0x19de11,_0x3951d2,_0x3c0d2a,_0x2381df);})[_0x4d57('0x7')](function(_0x639625){_0x398a51[_0x4d57('0x20')]=_0x639625;return _0x398a51;})[_0x4d57('0x21')](function(_0x39d0da){throw _0x39d0da;});};exports[_0x4d57('0x22')]=function(_0x34c215,_0x5c2dcb){return function(_0x1c8c3a,_0x2bf95c,_0x16d69c){var _0x20e46e=_0x1c8c3a[_0x4d57('0xf')];var _0x4017c7={};var _0x223880=_0x1c8c3a[_0x4d57('0x23')];if(_0x4017c7){_0x4017c7=_['clone'](_0x1c8c3a[_0x4d57('0xa')]);_0x4017c7=_['omit'](_0x4017c7,['body',_0x4d57('0x24'),_0x4d57('0x25'),_0x4d57('0x26'),_0x4d57('0x27')]);}utils[_0x4d57('0x28')](_0x20e46e,_0x4017c7,_0x223880,_0x34c215,_0x5c2dcb);_0x16d69c(null);};};function acceptMessage(_0x58f1c6,_0x3d2efc){var _0x17f2a3={'agent':{},'channel':_0x3d2efc};var _0xa00024=acceptUtils[_0x4d57('0x29')](_0x58f1c6);var _0x55e3f4=_0xa00024[_0x4d57('0x2a')];var _0x38d611=_0xa00024[_0x4d57('0x2b')];var _0x2a8b8c=_0xa00024[_0x4d57('0xf')];_0x17f2a3[_0x4d57('0x2c')]['id']=_0x38d611[_0x4d57('0x2d')];return acceptUtils[_0x4d57('0x2e')](_0x3d2efc,_0x55e3f4,_0x38d611)[_0x4d57('0x7')](function(_0x410e6d){_0x17f2a3[_0x4d57('0x2f')]=_0x410e6d;return acceptUtils[_0x4d57('0x30')](_0x3d2efc,_0x410e6d[_[_0x4d57('0x31')](_0x3d2efc)+_0x4d57('0x32')],_0x38d611[_0x4d57('0x2d')]);})[_0x4d57('0x7')](function(_0xd06e5f){_0x17f2a3[_0x4d57('0x33')]=_0xd06e5f;utils['logAcceptMessage'](_0x3d2efc,_0x2a8b8c,_0xd06e5f['id'],_0x38d611);return acceptUtils[_0x4d57('0x34')](_0x3d2efc,_0x17f2a3);})[_0x4d57('0x7')](function(_0x5b3f5d){return acceptUtils['findContactById'](_0x5b3f5d[_0x4d57('0x2f')][_0x4d57('0x35')]);})[_0x4d57('0x7')](function(_0xbaa7bd){_0x17f2a3['message'][_0x4d57('0xb')]=_0xbaa7bd;return _0x38d611['UserId']?acceptUtils[_0x4d57('0x36')](_0x38d611[_0x4d57('0x2d')]):null;})[_0x4d57('0x7')](function(_0x24c831){_0x17f2a3['message']['agent']=_0x24c831;if(_0x38d611[_0x4d57('0x37')]){var _0x52f41b={'interface':_0x4d57('0x38')+_0x2a8b8c['name'],'channel':_0x3d2efc,'motionChannel':_0x3d2efc};return acceptUtils[_0x4d57('0x39')](_0x3d2efc,_0x17f2a3[_0x4d57('0x33')]['id'],_0x17f2a3['message']['id'])[_0x4d57('0x7')](function(_0x119699){if(_0x119699){var _0x200708=Object[_0x4d57('0x3a')]({},_0x17f2a3[_0x4d57('0x33')],_0x52f41b,{'contact':_0x17f2a3[_0x4d57('0x2f')][_0x4d57('0xb')]});return acceptUtils[_0x4d57('0x3b')](_0x3d2efc,_0x200708);}})[_0x4d57('0x7')](function(){Object[_0x4d57('0x3a')](_0x17f2a3[_0x4d57('0x2f')],_0x52f41b,{'event':_0x4d57('0x3c')});return acceptUtils[_0x4d57('0x3d')](_0x3d2efc,_0x17f2a3);});}})[_0x4d57('0x7')](function(){return _0x17f2a3;});}exports[_0x4d57('0x3e')]=acceptMessage; \ No newline at end of file +var _0xa30a=['getFilteredInteractions','rows','tracked','user','clone','phone','fax','mobile','updateUser','getAcceptParams','messageId','payload','agent','UserId','updateMessageById','message','updateInteractionById','capitalize','InteractionId','logAcceptMessage','sendRoutingAcceptEvent','findContactById','findAgentById','manual','SIP/','name','isNewInteraction','assign','interaction','sendInteractionOpenedEvent','accept','sendAmiAcceptEvent','lodash','./accept-message','./sql-utils','findAll','skipInteractionsQuery','getInteractionsQuery','then','search','parseAdvancedSearchFilter','parseQueryParameters','body','contact','where','default','filter','having','read','tags','checkAccountsRestrictions','group','i.id','ids','count','clause','order','forEach','DESC','closed','getClosedOrderClause'];(function(_0x3a7d2c,_0x180ea0){var _0x389df9=function(_0x1259b8){while(--_0x1259b8){_0x3a7d2c['push'](_0x3a7d2c['shift']());}};_0x389df9(++_0x180ea0);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa30('0x0'));var acceptUtils=require(_0xaa30('0x1'));var sqlUtils=require(_0xaa30('0x2'));var utils=require('./utils');exports[_0xaa30('0x3')]=function(_0x1ebf61,_0x36f517,_0x2901b7,_0x2a9b06,_0x271425){var _0x102ad7={'count':0x0,'rows':[]};var _0x555947=sqlUtils[_0xaa30('0x4')](_0x1ebf61,_0x2901b7,_0x36f517);if(_0x555947){return Promise['resolve'](_0x102ad7);}var _0x8af448=sqlUtils[_0xaa30('0x5')](_0x1ebf61);var _0x42dc22={};return Promise['resolve']()[_0xaa30('0x6')](function(){if(_0x36f517[_0xaa30('0x7')]){return sqlUtils[_0xaa30('0x8')](_0x36f517[_0xaa30('0x7')],_0x271425);}else{return sqlUtils[_0xaa30('0x9')](_0x1ebf61,_0x36f517,_0x271425);}})[_0xaa30('0x6')](function(_0x56f686){_0x8af448['where'](_0x56f686[_0xaa30('0xa')]);_0x8af448['where'](_0x56f686[_0xaa30('0xb')]);_0x8af448[_0xaa30('0xc')](_0x56f686[_0xaa30('0xd')]);_0x8af448[_0xaa30('0xc')](_0x56f686['fields']);_0x8af448[_0xaa30('0xc')](_0x56f686[_0xaa30('0xe')]);_0x8af448[_0xaa30('0xc')](_0x56f686['user']);_0x8af448[_0xaa30('0xf')](_0x56f686[_0xaa30('0x10')]);_0x42dc22=_0x56f686[_0xaa30('0x11')];return sqlUtils[_0xaa30('0x12')](_0x1ebf61,_0x2901b7,_0x36f517);})[_0xaa30('0x6')](function(_0x31aa0b){_0x8af448[_0xaa30('0xc')](_0x31aa0b);_0x8af448[_0xaa30('0x13')](_0xaa30('0x14'));var _0xfae724=_0x36f517['search']?_0x42dc22[_0xaa30('0x15')]:_0x36f517['tag'];return sqlUtils['countFilteredInteractions'](_0x8af448,_0xfae724);})[_0xaa30('0x6')](function(_0x153939){_0x102ad7[_0xaa30('0x16')]=_0x153939['length'];if(_0x102ad7['count']===0x0){return[];}_0x8af448['having'](_0x42dc22[_0xaa30('0x17')]);if(_0x2a9b06['order']){_0x2a9b06[_0xaa30('0x18')][_0xaa30('0x19')](function(_0x48561d){var _0x4e29f9=_0x48561d[0x0]==='contactName'?_0x48561d[0x0]:'i.'+_0x48561d[0x0];_0x8af448[_0xaa30('0x18')](_0x4e29f9,_0x48561d[0x1]===_0xaa30('0x1a')?![]:!![]);if(_0x48561d[0x0]===_0xaa30('0x1b')){var _0x35ec07=sqlUtils[_0xaa30('0x1c')](_0x1ebf61,_0x36f517);_0x8af448['order'](_0x35ec07,_0x48561d[0x1]===_0xaa30('0x1a')?![]:!![]);}});}return sqlUtils[_0xaa30('0x1d')](_0x1ebf61,_0x8af448,_0x36f517,_0x2a9b06);})[_0xaa30('0x6')](function(_0x2d9e35){_0x102ad7[_0xaa30('0x1e')]=_0x2d9e35;return _0x102ad7;})['catch'](function(_0x325b42){throw _0x325b42;});};exports[_0xaa30('0x1f')]=function(_0x2fecdd,_0x326f84){return function(_0x57d1ca,_0x14d7fa,_0x1be54c){var _0x19ba52=_0x57d1ca[_0xaa30('0x20')];var _0x97b038={};var _0x2a59ce=_0x57d1ca['query'];if(_0x97b038){_0x97b038=_[_0xaa30('0x21')](_0x57d1ca[_0xaa30('0xa')]);_0x97b038=_['omit'](_0x97b038,[_0xaa30('0xa'),'html',_0xaa30('0x22'),_0xaa30('0x23'),_0xaa30('0x24')]);}utils[_0xaa30('0x25')](_0x19ba52,_0x97b038,_0x2a59ce,_0x2fecdd,_0x326f84);_0x1be54c(null);};};function acceptMessage(_0x37b4a6,_0xc10b8f){var _0x6ff09a={'agent':{},'channel':_0xc10b8f};var _0x39f708=acceptUtils[_0xaa30('0x26')](_0x37b4a6);var _0x43fb30=_0x39f708[_0xaa30('0x27')];var _0x43003f=_0x39f708[_0xaa30('0x28')];var _0x46abb9=_0x39f708[_0xaa30('0x20')];_0x6ff09a[_0xaa30('0x29')]['id']=_0x43003f[_0xaa30('0x2a')];return acceptUtils[_0xaa30('0x2b')](_0xc10b8f,_0x43fb30,_0x43003f)['then'](function(_0x3f5ac0){_0x6ff09a[_0xaa30('0x2c')]=_0x3f5ac0;return acceptUtils[_0xaa30('0x2d')](_0xc10b8f,_0x3f5ac0[_[_0xaa30('0x2e')](_0xc10b8f)+_0xaa30('0x2f')],_0x43003f[_0xaa30('0x2a')]);})['then'](function(_0x5addbf){_0x6ff09a['interaction']=_0x5addbf;utils[_0xaa30('0x30')](_0xc10b8f,_0x46abb9,_0x5addbf['id'],_0x43003f);return acceptUtils[_0xaa30('0x31')](_0xc10b8f,_0x6ff09a);})[_0xaa30('0x6')](function(_0x198595){return acceptUtils[_0xaa30('0x32')](_0x198595['message']['ContactId']);})[_0xaa30('0x6')](function(_0x2d26fb){_0x6ff09a['message'][_0xaa30('0xb')]=_0x2d26fb;return _0x43003f['UserId']?acceptUtils[_0xaa30('0x33')](_0x43003f['UserId']):null;})[_0xaa30('0x6')](function(_0x18e702){_0x6ff09a['message'][_0xaa30('0x29')]=_0x18e702;if(_0x43003f[_0xaa30('0x34')]){var _0x3dd1ed={'interface':_0xaa30('0x35')+_0x46abb9[_0xaa30('0x36')],'channel':_0xc10b8f,'motionChannel':_0xc10b8f};return acceptUtils[_0xaa30('0x37')](_0xc10b8f,_0x6ff09a['interaction']['id'],_0x6ff09a[_0xaa30('0x2c')]['id'])[_0xaa30('0x6')](function(_0x53dd7c){if(_0x53dd7c){var _0x3769ea=Object[_0xaa30('0x38')]({},_0x6ff09a[_0xaa30('0x39')],_0x3dd1ed,{'contact':_0x6ff09a['message']['contact']});return acceptUtils[_0xaa30('0x3a')](_0xc10b8f,_0x3769ea);}})[_0xaa30('0x6')](function(){Object[_0xaa30('0x38')](_0x6ff09a[_0xaa30('0x2c')],_0x3dd1ed,{'event':_0xaa30('0x3b')});return acceptUtils[_0xaa30('0x3c')](_0xc10b8f,_0x6ff09a);});}})['then'](function(){return _0x6ff09a;});}exports['acceptMessage']=acceptMessage; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 64dfa6a..ec23d33 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb60=['body','plainBody','keys','some','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','filter','capitalize','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Sequelize','SELECT','sequelize','query','toString','merge','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','tools_tags','getInteractionFK','u.id','u.fullname','ui.','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','from','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','buildExpression','type','default','text','value','start','end','unreadMessages','read','Contact','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','Tag','split','tags','clause','and','ids','User','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId'];(function(_0x42c7e7,_0x357294){var _0x4f17aa=function(_0x1d158d){while(--_0x1d158d){_0x42c7e7['push'](_0x42c7e7['shift']());}};_0x4f17aa(++_0x357294);}(_0xbb60,0x100));var _0x0bb6=function(_0x46f80c,_0x4dface){_0x46f80c=_0x46f80c-0x0;var _0x5b2d2f=_0xbb60[_0x46f80c];return _0x5b2d2f;};'use strict';var _=require(_0x0bb6('0x0'));var squel=require(_0x0bb6('0x1'));var as=require(_0x0bb6('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0x0bb6('0x3'))[_0x0bb6('0x4')];var utils=require(_0x0bb6('0x5'));var db=require(_0x0bb6('0x6'))['db'];function skipInteractionsQuery(_0x56a4d7,_0x578330,_0x2e06ba){var _0x3a8d4d=![];var _0x25ecee=utils[_0x0bb6('0x7')](_0x56a4d7);if(_0x578330[_0x0bb6('0x8')]===_0x0bb6('0x9')&&!_0x2e06ba[_0x0bb6('0xa')]&&!_0x2e06ba[_0x25ecee]){_0x3a8d4d=!![];}return _0x3a8d4d;}function getTagsQuery(){return squel[_0x0bb6('0xb')]()[_0x0bb6('0xc')]('id')[_0x0bb6('0xc')](_0x0bb6('0xd'))[_0x0bb6('0xc')]('color')['from'](_0x0bb6('0xe'));}function getUsersQuery(_0x2f149c,_0xf85227){var _0x175bb8=utils[_0x0bb6('0xf')](_0x2f149c);var _0x58a45d='user_has_'+_0x2f149c+'_interactions';var _0x7741fa=squel[_0x0bb6('0xb')]()['field'](_0x0bb6('0x10'))[_0x0bb6('0xc')](_0x0bb6('0x11'))['field'](_0x0bb6('0x12')+_0x175bb8)['from'](_0x58a45d,'ui')['left_join']('users','u',_0x0bb6('0x13'));if(_0xf85227[_0x0bb6('0x14')]>0x0){_0x7741fa[_0x0bb6('0x15')](_0x0bb6('0x12')+_0x175bb8+_0x0bb6('0x16'),_[_0x0bb6('0x17')](_0xf85227,'id'));}return _0x7741fa;}function getInteractionsQuery(_0x2c75b6){var _0x32aaf4=utils[_0x0bb6('0x18')](_0x2c75b6);var _0x31c190=utils[_0x0bb6('0x7')](_0x2c75b6);var _0xee7f32=utils['getInteractionFK'](_0x2c75b6);return squel['select']()[_0x0bb6('0x19')](_0x32aaf4[_0x0bb6('0x1a')],'i')[_0x0bb6('0x1b')](_0x0bb6('0x1c'),'c',_0x0bb6('0x1d'))['left_join'](_0x0bb6('0x1e'),'o',_0x0bb6('0x1f'))[_0x0bb6('0x1b')](_0x32aaf4[_0x0bb6('0x20')],'a',_0x0bb6('0x21')+_0x31c190)[_0x0bb6('0x1b')](_0x32aaf4[_0x0bb6('0x22')],'me','me.'+_0xee7f32+_0x0bb6('0x23'))[_0x0bb6('0x1b')](_0x32aaf4[_0x0bb6('0x24')],'it','it.'+_0xee7f32+_0x0bb6('0x23'))[_0x0bb6('0x1b')](_0x0bb6('0xe'),'t',_0x0bb6('0x25'));}function getSqlClauses(){var _0x3310f2={'body':squel[_0x0bb6('0x26')](),'contact':squel[_0x0bb6('0x26')](),'default':squel[_0x0bb6('0x26')](),'fields':squel[_0x0bb6('0x26')](),'filter':squel[_0x0bb6('0x26')](),'read':squel[_0x0bb6('0x26')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x0bb6('0x26')]()};return _0x3310f2;}function parseTagParameter(_0x11f6a4){var _0x7569a3=squel['expr']();if(_0x11f6a4){var _0x2a16dc=utils[_0x0bb6('0x27')](_0x11f6a4);_0x2a16dc[_0x0bb6('0x28')](function(_0x18cfa6){_0x7569a3['or'](_0x0bb6('0x29'),'%,'+_0x18cfa6+',%');});}return _0x7569a3;}function parseReadParameter(_0x5384ef){var _0x5d7e24='';if(_0x5384ef){_0x5d7e24=_0x0bb6('0x2a');if(_0x5384ef==='1'){_0x5d7e24=_0x5d7e24[_0x0bb6('0x2b')]('{OPERATOR}','=');}else{_0x5d7e24=_0x5d7e24[_0x0bb6('0x2b')](_0x0bb6('0x2c'),'>');}}return _0x5d7e24;}function parseSearchFilter(_0x4a5e07,_0x912d7c){var _0x766ec2=squel[_0x0bb6('0x26')]();if(_0x912d7c){var _0x5bc6d8=_0x912d7c[_0x0bb6('0x2b')]('\x5c','\x5c\x5c')[_0x0bb6('0x2b')](/'/g,'\x27\x27');var _0x1a9d1e=qs[_0x0bb6('0x2d')](_0x5bc6d8);if(qs['isNumeric'](_0x5bc6d8)){_0x766ec2['or'](_0x0bb6('0x2e'),_0x1a9d1e+'%');if([_0x0bb6('0x2f'),_0x0bb6('0x30')][_0x0bb6('0x31')](_0x4a5e07)){_0x766ec2['or']('i.phone\x20LIKE\x20?',_0x1a9d1e+'%');}else if(_0x4a5e07===_0x0bb6('0x32')){_0x766ec2['or'](_0x0bb6('0x33'),_0x1a9d1e+'%');}else if(_0x4a5e07===_0x0bb6('0x34')){_0x766ec2['or'](_0x0bb6('0x35'),_0x1a9d1e+'%');}}else if(_0x4a5e07===_0x0bb6('0x36')&&qs[_0x0bb6('0x37')](_0x5bc6d8)){_0x766ec2['or'](_0x0bb6('0x38'),_0x1a9d1e+'%');}else{if(_0x4a5e07==='mail'){_0x766ec2['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0bb6('0x39')](_0x5bc6d8,!![]))['or'](_0x0bb6('0x3a'),qs[_0x0bb6('0x39')](_0x5bc6d8));}else if(_0x4a5e07!=='fax'){_0x766ec2['or'](_0x0bb6('0x3b'),qs[_0x0bb6('0x39')](_0x5bc6d8));}_0x766ec2['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0bb6('0x39')](_0x5bc6d8,!![]),null);}}return _0x766ec2;}function parseAdvancedSearchFilter(_0x5cd9d9,_0x5cc04f){var _0xee74dd=getSqlClauses();var _0x361d35=as['parseSearch'](_0x5cd9d9);var _0x536e3c=_0x361d35[_0x0bb6('0x3c')];for(var _0x21cda3=0x0;_0x21cda3<_0x361d35[_0x0bb6('0x3d')]['length'];_0x21cda3++){var _0x53d5c9=_0x361d35[_0x0bb6('0x3d')][_0x21cda3];var _0x13a482='i';var _0x599429=_['find'](_0x5cc04f,[_0x0bb6('0xd'),_0x53d5c9[_0x0bb6('0xc')]]);if(_0x599429){var _0x2c1c00=as[_0x0bb6('0x3e')](_0x13a482,_0x599429[_0x0bb6('0x3f')],_0x53d5c9);_0xee74dd[_0x0bb6('0x40')][_0x536e3c](_0x2c1c00[_0x0bb6('0x41')],_0x2c1c00[_0x0bb6('0x42')][_0x0bb6('0x43')],_0x2c1c00[_0x0bb6('0x42')][_0x0bb6('0x44')]);}else{switch(_0x53d5c9[_0x0bb6('0xc')]){case _0x0bb6('0x45'):var _0x398679=parseReadParameter(_0x53d5c9['value']);_0xee74dd[_0x0bb6('0x46')]['and'](_0x398679);break;case _0x0bb6('0x47'):if(_0x53d5c9['operator']===_0x0bb6('0x48')){if(_0x53d5c9[_0x0bb6('0x42')]['split']('\x20')['length']>0x1){_0xee74dd[_0x0bb6('0x49')][_0x536e3c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x53d5c9[_0x0bb6('0x42')],!![]),null);}else{var _0x351b2e='%'+_0x53d5c9[_0x0bb6('0x42')]+'%';_0xee74dd['contact'][_0x536e3c](_0x0bb6('0x4a'),_0x351b2e,_0x351b2e,_0x351b2e);}}else{_0x599429=_[_0x0bb6('0x4b')](_0x5cc04f,[_0x0bb6('0xd'),_0x0bb6('0x4c')]);_0x53d5c9[_0x0bb6('0xc')]=_0x0bb6('0x4c');_0x2c1c00=as[_0x0bb6('0x3e')](_0x13a482,_0x599429[_0x0bb6('0x3f')],_0x53d5c9);_0xee74dd['contact'][_0x536e3c](_0x2c1c00['text'],_0x2c1c00[_0x0bb6('0x42')][_0x0bb6('0x43')],_0x2c1c00[_0x0bb6('0x42')]['end']);}break;case _0x0bb6('0x4d'):var _0x4fe920=_0x53d5c9[_0x0bb6('0x42')][_0x0bb6('0x4e')](',')[_0x0bb6('0x17')](function(_0x430b72){return Number(_0x430b72);});var _0x589f50=parseTagParameter(_0x4fe920);_0xee74dd[_0x0bb6('0x4f')][_0x0bb6('0x50')][_0x0bb6('0x51')](_0x589f50);_0xee74dd['tags'][_0x0bb6('0x52')]=_0x4fe920;break;case _0x0bb6('0x53'):if(_0x53d5c9[_0x0bb6('0x54')]===_0x0bb6('0x48')){_0xee74dd[_0x0bb6('0x55')][_0x536e3c](_0x0bb6('0x56'),'%'+_0x53d5c9['value']+'%',null);}else{_0x599429=_[_0x0bb6('0x4b')](_0x5cc04f,[_0x0bb6('0xd'),_0x0bb6('0x57')]);_0x53d5c9['field']=_0x0bb6('0x57');_0x2c1c00=as[_0x0bb6('0x3e')](_0x13a482,_0x599429[_0x0bb6('0x3f')],_0x53d5c9);_0xee74dd['user'][_0x536e3c](_0x2c1c00['text'],_0x2c1c00[_0x0bb6('0x42')][_0x0bb6('0x43')],_0x2c1c00[_0x0bb6('0x42')][_0x0bb6('0x44')]);}break;case _0x0bb6('0x58'):case _0x0bb6('0x59'):_0x2c1c00=as[_0x0bb6('0x3e')]('me',null,_0x53d5c9);_0xee74dd[_0x0bb6('0x58')][_0x536e3c](_0x2c1c00[_0x0bb6('0x41')],_0x2c1c00[_0x0bb6('0x42')][_0x0bb6('0x43')],_0x2c1c00[_0x0bb6('0x42')][_0x0bb6('0x44')]);break;}}}return _0xee74dd;}function parseModelFields(_0x3d9c22,_0x44b944,_0xe12c6f){var _0xe4add7=utils['getAccountFK'](_0x3d9c22);var _0x1212ea=squel['expr']();var _0x5af66b=_(_0x44b944)[_0x0bb6('0x5a')]()[_0x0bb6('0x17')](function(_0x48dcc3){return _[_0x0bb6('0x5b')](_0xe12c6f,['name',_0x48dcc3])?_0x48dcc3:undefined;})['compact']()['value']();if(_0x5af66b[_0x0bb6('0x14')]>0x0){_0x5af66b['forEach'](function(_0x103083){if(_0x103083===_0xe4add7){_0x1212ea[_0x0bb6('0x51')]('i.'+_0xe4add7+'\x20IN\x20?',[][_0x0bb6('0x5c')](_0x44b944[_0x103083]));}else if(_0x103083===_0x0bb6('0x5d')){var _0x55436f=JSON['parse'](_0x44b944[_0x103083])[_0x0bb6('0x5e')];var _0x24af7b=JSON[_0x0bb6('0x5f')](_0x44b944[_0x103083])[_0x0bb6('0x60')];_0x1212ea[_0x0bb6('0x51')](_0x0bb6('0x61'),_0x55436f,_0x24af7b);}else{if(_0x44b944[_0x103083]===_0x0bb6('0x62')){_0x1212ea[_0x0bb6('0x51')]('i.'+_0x103083+_0x0bb6('0x63'));}else{_0x1212ea[_0x0bb6('0x51')]('i.'+_0x103083+'\x20=\x20?',_0x44b944[_0x103083]);}}});}return _0x1212ea;}function parseQueryParameters(_0x2e3760,_0x9a7d9,_0xaf61ca){var _0x2c448c=getSqlClauses();return Promise[_0x0bb6('0x64')]()['then'](function(){return parseModelFields(_0x2e3760,_0x9a7d9,_0xaf61ca);})[_0x0bb6('0x65')](function(_0x384594){_0x2c448c['fields'][_0x0bb6('0x51')](_0x384594);return parseReadParameter(_0x9a7d9[_0x0bb6('0x46')]);})['then'](function(_0x5b86a0){_0x2c448c[_0x0bb6('0x46')]['and'](_0x5b86a0);return parseTagParameter(_0x9a7d9['tag']);})['then'](function(_0x1f59cf){_0x2c448c['tags']['clause'][_0x0bb6('0x51')](_0x1f59cf);return parseSearchFilter(_0x2e3760,_0x9a7d9[_0x0bb6('0x66')]);})[_0x0bb6('0x65')](function(_0x3005c5){_0x2c448c[_0x0bb6('0x66')]=_0x3005c5;return _0x2c448c;});}function checkAccountsRestrictions(_0x46f078,_0x2e8c84,_0x3b4b40){var _0x421722=utils['getAccountFK'](_0x46f078);var _0x3dd643='get'+_[_0x0bb6('0x67')](_0x46f078)+(_0x46f078===_0x0bb6('0x68')?_0x0bb6('0x69'):_0x0bb6('0x6a'));var _0x4583f1=squel[_0x0bb6('0x26')]();return Promise['resolve']()[_0x0bb6('0x65')](function(){if(_0x3b4b40[_0x0bb6('0xa')]&&_0x2e8c84['role']===_0x0bb6('0x9')){return _0x2e8c84[_0x3dd643]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2f2615){if(_0x2f2615){if(_0x2f2615[_0x0bb6('0x14')]===0x0){_0x4583f1[_0x0bb6('0x51')]('i.'+_0x421722+_0x0bb6('0x63'));}else{_0x4583f1[_0x0bb6('0x51')]('i.'+_0x421722+_0x0bb6('0x16'),_['map'](_0x2f2615,'id'));}}else if(!_0x3b4b40[_0x421722]){_0x4583f1[_0x0bb6('0x51')]('i.'+_0x421722+_0x0bb6('0x6b'));}})[_0x0bb6('0x65')](function(){return _0x4583f1;});}function getClosedOrderClause(_0x210920,_0x4cc598){var _0x1c9508='';var _0x377182=[_0x0bb6('0x6c'),_0x0bb6('0x6d'),_0x0bb6('0x6e')];if(_0x210920===_0x0bb6('0x36')){_0x377182[_0x0bb6('0x6f')]('i.substatus');}if(_0x4cc598['closed']==='0'&&_0x210920===_0x0bb6('0x36')){_0x1c9508=_0x0bb6('0x70');}else{if(_0x4cc598[_0x0bb6('0x71')]==='1'){_0x377182[_0x0bb6('0x72')]();}_0x1c9508='CONCAT_WS(\x27\x27,\x20'+_0x377182[_0x0bb6('0x73')](',\x20')+')';}return _0x1c9508;}function getFilteredInteractions(_0x1807ce,_0x23e566,_0x5bda15,_0x2760cf){var _0x632600=utils['getInteractionFK'](_0x1807ce);var _0x484c98=_['capitalize'](_0x1807ce)+'Interaction';var _0x2f803a=[];var _0x80301e=getTagsQuery();var _0x560d7f={'type':db[_0x0bb6('0x74')]['QueryTypes'][_0x0bb6('0x75')],'raw':!![]};var _0x152c82=[];var _0x2585ff=[];return db[_0x0bb6('0x76')][_0x0bb6('0x77')](_0x80301e[_0x0bb6('0x78')](),_0x560d7f)['then'](function(_0x5035f8){_0x2f803a=_['keyBy'](_0x5035f8,'id');_0x560d7f=_[_0x0bb6('0x79')](_0x560d7f,{'model':db[_0x484c98],'mapToModel':!![],'nest':!![]});if(_0x5bda15[_0x0bb6('0x7a')]){_0x2760cf[_0x0bb6('0x7b')][_0x0bb6('0x28')](function(_0x5265df){_0x23e566['field']('i.'+_0x5265df);});}else{_0x23e566['field'](_0x0bb6('0x7c'),_0x0bb6('0x45'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x7d'),_0x0bb6('0x7e'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x7f'),_0x0bb6('0x80'));if(_0x1807ce===_0x0bb6('0x36')){_0x23e566[_0x0bb6('0xc')]('a.email',_0x0bb6('0x81'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x82'),_0x0bb6('0x83'));_0x23e566['field'](_0x0bb6('0x84'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x85'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x86'));_0x23e566['field']('i.closed');_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x87'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x88'));_0x23e566['field'](_0x0bb6('0x89'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x8a'));_0x23e566[_0x0bb6('0xc')]('i.subject');_0x23e566[_0x0bb6('0xc')]('i.disposition');_0x23e566[_0x0bb6('0xc')]('i.secondDisposition');_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x6c'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x70'));_0x23e566['field'](_0x0bb6('0x8b'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x8c'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x8d'));_0x23e566['field'](_0x0bb6('0x8e'));}else if(_0x1807ce===_0x0bb6('0x34')){_0x23e566['field'](_0x0bb6('0x8f'),_0x0bb6('0x83'));}else{_0x23e566[_0x0bb6('0xc')]('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');}if(_0x1807ce!==_0x0bb6('0x36')){_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x90'));}_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x91'),'Contact.firstName');_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x92'),'Contact.lastName');_0x23e566[_0x0bb6('0xc')]('c.email',_0x0bb6('0x93'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x94'),_0x0bb6('0x95'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x96'),_0x0bb6('0x97'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x98'),_0x0bb6('0x99'));_0x23e566[_0x0bb6('0xc')](_0x0bb6('0x9a'),_0x0bb6('0x9b'));_0x23e566['field'](_0x0bb6('0x9c'),_0x0bb6('0x9d'));_0x23e566['field'](_0x0bb6('0x9e'),_0x0bb6('0x9f'));}if(_0x2760cf['limit']){_0x23e566[_0x0bb6('0xa0')](_0x2760cf[_0x0bb6('0xa0')]);}if(_0x2760cf[_0x0bb6('0xa1')]){_0x23e566[_0x0bb6('0xa1')](_0x2760cf[_0x0bb6('0xa1')]);}return db[_0x0bb6('0x76')][_0x0bb6('0x77')](_0x23e566[_0x0bb6('0x78')](),_0x560d7f);})[_0x0bb6('0x65')](function(_0x2504af){_0x152c82=_0x2504af;var _0x32d3cc=getUsersQuery(_0x1807ce,_0x152c82);return db[_0x0bb6('0x76')][_0x0bb6('0x77')](_0x32d3cc[_0x0bb6('0x78')](),_0x560d7f);})[_0x0bb6('0x65')](function(_0x3b4c53){_0x2585ff=_[_0x0bb6('0xa2')](_0x3b4c53,_0x632600);if(_0x1807ce===_0x0bb6('0x36')){return db[_0x0bb6('0xa3')][_0x0bb6('0xa4')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x0bb6('0x65')](function(_0x1f6e8e){var _0x3ce9b1=_0x1f6e8e?_0x1f6e8e['enableEmailPreview']:undefined;var _0x2a7683=_0x152c82[_0x0bb6('0x17')](function(_0x1b9a3d){return updateInteraction(_0x1b9a3d,_0x2f803a,_0x2585ff,_0x3ce9b1);});return Promise[_0x0bb6('0xa5')](_0x2a7683);});}function countFilteredInteractions(_0x3dbdb3,_0x4bc53d){var _0xe9e316=_0x3dbdb3[_0x0bb6('0xa6')]();_0xe9e316[_0x0bb6('0xc')](_0x0bb6('0xa7'));_0xe9e316[_0x0bb6('0xc')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0bb6('0x45'));var _0x4c9a2a=utils[_0x0bb6('0x27')](_0x4bc53d);if(!_[_0x0bb6('0xa8')](_0x4c9a2a)){_0xe9e316['where'](_0x0bb6('0xa9'),_0x4c9a2a);}var _0xa545fd={'type':db[_0x0bb6('0x74')][_0x0bb6('0xaa')]['SELECT'],'raw':!![]};return db[_0x0bb6('0x76')][_0x0bb6('0x77')](_0xe9e316[_0x0bb6('0x78')](),_0xa545fd);}module[_0x0bb6('0xab')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xca4a=['i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','TagIds','limit','offset','query','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','map','getInteractionsTables','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','sms','includes','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','buildExpression','type','default','text','value','end','unreadMessages','read','and','Contact','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','split','tags','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','body','plainBody','some','compact','\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','clause','filter','get','capitalize','chat','Accounts','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','SELECT','sequelize','toString','keyBy','merge','attributes','forEach','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed'];(function(_0x8df7da,_0x496482){var _0x48ecb1=function(_0x2b3a58){while(--_0x2b3a58){_0x8df7da['push'](_0x8df7da['shift']());}};_0x48ecb1(++_0x496482);}(_0xca4a,0x175));var _0xaca4=function(_0x14d2c6,_0x5a687a){_0x14d2c6=_0x14d2c6-0x0;var _0x481ce9=_0xca4a[_0x14d2c6];return _0x481ce9;};'use strict';var _=require(_0xaca4('0x0'));var squel=require(_0xaca4('0x1'));var as=require(_0xaca4('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0xaca4('0x3'))[_0xaca4('0x4')];var utils=require(_0xaca4('0x5'));var db=require(_0xaca4('0x6'))['db'];function skipInteractionsQuery(_0x2956b8,_0x3d1b1c,_0x25b7b8){var _0x2eee78=![];var _0x3f0613=utils[_0xaca4('0x7')](_0x2956b8);if(_0x3d1b1c[_0xaca4('0x8')]===_0xaca4('0x9')&&!_0x25b7b8[_0xaca4('0xa')]&&!_0x25b7b8[_0x3f0613]){_0x2eee78=!![];}return _0x2eee78;}function getTagsQuery(){return squel[_0xaca4('0xb')]()[_0xaca4('0xc')]('id')[_0xaca4('0xc')](_0xaca4('0xd'))[_0xaca4('0xc')](_0xaca4('0xe'))[_0xaca4('0xf')](_0xaca4('0x10'));}function getUsersQuery(_0x56689b,_0x3f6a69){var _0x51d669=utils[_0xaca4('0x11')](_0x56689b);var _0x319740=_0xaca4('0x12')+_0x56689b+_0xaca4('0x13');var _0x1fef6c=squel[_0xaca4('0xb')]()[_0xaca4('0xc')](_0xaca4('0x14'))['field'](_0xaca4('0x15'))[_0xaca4('0xc')](_0xaca4('0x16')+_0x51d669)[_0xaca4('0xf')](_0x319740,'ui')['left_join'](_0xaca4('0x17'),'u',_0xaca4('0x18'));if(_0x3f6a69[_0xaca4('0x19')]>0x0){_0x1fef6c[_0xaca4('0x1a')](_0xaca4('0x16')+_0x51d669+'\x20IN\x20?',_[_0xaca4('0x1b')](_0x3f6a69,'id'));}return _0x1fef6c;}function getInteractionsQuery(_0x3adadb){var _0x269c1c=utils[_0xaca4('0x1c')](_0x3adadb);var _0x55d0d4=utils[_0xaca4('0x7')](_0x3adadb);var _0x384b9e=utils[_0xaca4('0x11')](_0x3adadb);return squel['select']()[_0xaca4('0xf')](_0x269c1c[_0xaca4('0x1d')],'i')[_0xaca4('0x1e')](_0xaca4('0x1f'),'c',_0xaca4('0x20'))['left_join'](_0xaca4('0x17'),'o',_0xaca4('0x21'))['left_join'](_0x269c1c[_0xaca4('0x22')],'a','a.id\x20=\x20i.'+_0x55d0d4)[_0xaca4('0x1e')](_0x269c1c[_0xaca4('0x23')],'me',_0xaca4('0x24')+_0x384b9e+_0xaca4('0x25'))['left_join'](_0x269c1c['interactionsTags'],'it',_0xaca4('0x26')+_0x384b9e+_0xaca4('0x25'))[_0xaca4('0x1e')](_0xaca4('0x10'),'t',_0xaca4('0x27'));}function getSqlClauses(){var _0x101948={'body':squel[_0xaca4('0x28')](),'contact':squel[_0xaca4('0x28')](),'default':squel[_0xaca4('0x28')](),'fields':squel[_0xaca4('0x28')](),'filter':squel[_0xaca4('0x28')](),'read':squel[_0xaca4('0x28')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xaca4('0x28')]()};return _0x101948;}function parseTagParameter(_0x35a8e0){var _0x60109=squel[_0xaca4('0x28')]();if(_0x35a8e0){var _0x1d1e10=utils['getSelectedTags'](_0x35a8e0);_0x1d1e10['forEach'](function(_0x89623e){_0x60109['or'](_0xaca4('0x29'),'%,'+_0x89623e+',%');});}return _0x60109;}function parseReadParameter(_0x586f39){var _0x3e9453='';if(_0x586f39){_0x3e9453=_0xaca4('0x2a');if(_0x586f39==='1'){_0x3e9453=_0x3e9453[_0xaca4('0x2b')]('{OPERATOR}','=');}else{_0x3e9453=_0x3e9453[_0xaca4('0x2b')](_0xaca4('0x2c'),'>');}}return _0x3e9453;}function parseSearchFilter(_0x49e6c5,_0x56ba5e){var _0x5afb36=squel[_0xaca4('0x28')]();if(_0x56ba5e){var _0x252e0d=_0x56ba5e[_0xaca4('0x2b')]('\x5c','\x5c\x5c')[_0xaca4('0x2b')](/'/g,'\x27\x27');var _0x1699dc=qs['escapeLIKESpecialChars'](_0x252e0d);if(qs['isNumeric'](_0x252e0d)){_0x5afb36['or']('i.id\x20LIKE\x20?',_0x1699dc+'%');if([_0xaca4('0x2d'),'whatsapp'][_0xaca4('0x2e')](_0x49e6c5)){_0x5afb36['or']('i.phone\x20LIKE\x20?',_0x1699dc+'%');}else if(_0x49e6c5===_0xaca4('0x2f')){_0x5afb36['or'](_0xaca4('0x30'),_0x1699dc+'%');}else if(_0x49e6c5===_0xaca4('0x31')){_0x5afb36['or'](_0xaca4('0x32'),_0x1699dc+'%');}}else if(_0x49e6c5===_0xaca4('0x33')&&qs['isEmail'](_0x252e0d)){_0x5afb36['or'](_0xaca4('0x34'),_0x1699dc+'%');}else{if(_0x49e6c5==='mail'){_0x5afb36['or'](_0xaca4('0x35'),qs[_0xaca4('0x36')](_0x252e0d,!![]))['or'](_0xaca4('0x37'),qs['getFullTextValue'](_0x252e0d));}else if(_0x49e6c5!==_0xaca4('0x2f')){_0x5afb36['or'](_0xaca4('0x38'),qs[_0xaca4('0x36')](_0x252e0d));}_0x5afb36['or'](_0xaca4('0x39'),qs[_0xaca4('0x36')](_0x252e0d,!![]),null);}}return _0x5afb36;}function parseAdvancedSearchFilter(_0x59aaa6,_0x46528c){var _0x51dba4=getSqlClauses();var _0x3dafe9=as[_0xaca4('0x3a')](_0x59aaa6);var _0x156169=_0x3dafe9['sqlOperator'];for(var _0x1ca088=0x0;_0x1ca088<_0x3dafe9[_0xaca4('0x3b')][_0xaca4('0x19')];_0x1ca088++){var _0xb680d9=_0x3dafe9[_0xaca4('0x3b')][_0x1ca088];var _0x335174='i';var _0x4e4b00=_[_0xaca4('0x3c')](_0x46528c,[_0xaca4('0xd'),_0xb680d9['field']]);if(_0x4e4b00){var _0x3f0a1b=as[_0xaca4('0x3d')](_0x335174,_0x4e4b00[_0xaca4('0x3e')],_0xb680d9);_0x51dba4[_0xaca4('0x3f')][_0x156169](_0x3f0a1b[_0xaca4('0x40')],_0x3f0a1b[_0xaca4('0x41')]['start'],_0x3f0a1b[_0xaca4('0x41')][_0xaca4('0x42')]);}else{switch(_0xb680d9['field']){case _0xaca4('0x43'):var _0x4d2761=parseReadParameter(_0xb680d9['value']);_0x51dba4[_0xaca4('0x44')][_0xaca4('0x45')](_0x4d2761);break;case _0xaca4('0x46'):if(_0xb680d9[_0xaca4('0x47')]===_0xaca4('0x48')){if(_0xb680d9[_0xaca4('0x41')]['split']('\x20')['length']>0x1){_0x51dba4['contact'][_0x156169](_0xaca4('0x39'),qs[_0xaca4('0x36')](_0xb680d9[_0xaca4('0x41')],!![]),null);}else{var _0x4b5c6d='%'+_0xb680d9[_0xaca4('0x41')]+'%';_0x51dba4[_0xaca4('0x49')][_0x156169](_0xaca4('0x4a'),_0x4b5c6d,_0x4b5c6d,_0x4b5c6d);}}else{_0x4e4b00=_['find'](_0x46528c,[_0xaca4('0xd'),_0xaca4('0x4b')]);_0xb680d9['field']=_0xaca4('0x4b');_0x3f0a1b=as[_0xaca4('0x3d')](_0x335174,_0x4e4b00['type'],_0xb680d9);_0x51dba4['contact'][_0x156169](_0x3f0a1b[_0xaca4('0x40')],_0x3f0a1b[_0xaca4('0x41')][_0xaca4('0x4c')],_0x3f0a1b[_0xaca4('0x41')][_0xaca4('0x42')]);}break;case _0xaca4('0x4d'):var _0x59c0c4=_0xb680d9['value'][_0xaca4('0x4e')](',')['map'](function(_0x7657aa){return Number(_0x7657aa);});var _0x4d1f1d=parseTagParameter(_0x59c0c4);_0x51dba4[_0xaca4('0x4f')]['clause'][_0xaca4('0x45')](_0x4d1f1d);_0x51dba4[_0xaca4('0x4f')]['ids']=_0x59c0c4;break;case _0xaca4('0x50'):if(_0xb680d9[_0xaca4('0x47')]==='$substring'){_0x51dba4[_0xaca4('0x51')][_0x156169](_0xaca4('0x52'),'%'+_0xb680d9[_0xaca4('0x41')]+'%',null);}else{_0x4e4b00=_[_0xaca4('0x3c')](_0x46528c,['name','UserId']);_0xb680d9['field']='UserId';_0x3f0a1b=as[_0xaca4('0x3d')](_0x335174,_0x4e4b00[_0xaca4('0x3e')],_0xb680d9);_0x51dba4[_0xaca4('0x51')][_0x156169](_0x3f0a1b['text'],_0x3f0a1b['value'][_0xaca4('0x4c')],_0x3f0a1b[_0xaca4('0x41')][_0xaca4('0x42')]);}break;case _0xaca4('0x53'):case _0xaca4('0x54'):_0x3f0a1b=as[_0xaca4('0x3d')]('me',null,_0xb680d9);_0x51dba4[_0xaca4('0x53')][_0x156169](_0x3f0a1b[_0xaca4('0x40')],_0x3f0a1b[_0xaca4('0x41')][_0xaca4('0x4c')],_0x3f0a1b[_0xaca4('0x41')]['end']);break;}}}return _0x51dba4;}function parseModelFields(_0x3b9ac0,_0x2c9bc9,_0x26f580){var _0x42c2a6=utils[_0xaca4('0x7')](_0x3b9ac0);var _0x35a5b5=squel[_0xaca4('0x28')]();var _0x1eff53=_(_0x2c9bc9)['keys']()[_0xaca4('0x1b')](function(_0x4f2904){return _[_0xaca4('0x55')](_0x26f580,[_0xaca4('0xd'),_0x4f2904])?_0x4f2904:undefined;})[_0xaca4('0x56')]()[_0xaca4('0x41')]();if(_0x1eff53[_0xaca4('0x19')]>0x0){_0x1eff53['forEach'](function(_0x63e852){if(_0x63e852===_0x42c2a6){_0x35a5b5[_0xaca4('0x45')]('i.'+_0x42c2a6+_0xaca4('0x57'),[][_0xaca4('0x58')](_0x2c9bc9[_0x63e852]));}else if(_0x63e852===_0xaca4('0x59')){var _0xf2bdf8=JSON[_0xaca4('0x5a')](_0x2c9bc9[_0x63e852])[_0xaca4('0x5b')];var _0x3f93d1=JSON[_0xaca4('0x5a')](_0x2c9bc9[_0x63e852])[_0xaca4('0x5c')];_0x35a5b5['and'](_0xaca4('0x5d'),_0xf2bdf8,_0x3f93d1);}else{if(_0x2c9bc9[_0x63e852]==='null'){_0x35a5b5['and']('i.'+_0x63e852+_0xaca4('0x5e'));}else{_0x35a5b5[_0xaca4('0x45')]('i.'+_0x63e852+_0xaca4('0x5f'),_0x2c9bc9[_0x63e852]);}}});}return _0x35a5b5;}function parseQueryParameters(_0x3a4b65,_0x198ee1,_0x504155){var _0x325abb=getSqlClauses();return Promise['resolve']()[_0xaca4('0x60')](function(){return parseModelFields(_0x3a4b65,_0x198ee1,_0x504155);})['then'](function(_0x3cb8d5){_0x325abb[_0xaca4('0x61')][_0xaca4('0x45')](_0x3cb8d5);return parseReadParameter(_0x198ee1[_0xaca4('0x44')]);})['then'](function(_0x1f3091){_0x325abb[_0xaca4('0x44')]['and'](_0x1f3091);return parseTagParameter(_0x198ee1[_0xaca4('0x62')]);})[_0xaca4('0x60')](function(_0x1e8e90){_0x325abb[_0xaca4('0x4f')][_0xaca4('0x63')][_0xaca4('0x45')](_0x1e8e90);return parseSearchFilter(_0x3a4b65,_0x198ee1[_0xaca4('0x64')]);})[_0xaca4('0x60')](function(_0x4098ba){_0x325abb[_0xaca4('0x64')]=_0x4098ba;return _0x325abb;});}function checkAccountsRestrictions(_0x4bae78,_0x70867f,_0x559ba7){var _0x5d66f1=utils[_0xaca4('0x7')](_0x4bae78);var _0x8b37cf=_0xaca4('0x65')+_[_0xaca4('0x66')](_0x4bae78)+(_0x4bae78===_0xaca4('0x67')?'Websites':_0xaca4('0x68'));var _0x48ab23=squel[_0xaca4('0x28')]();return Promise['resolve']()['then'](function(){if(_0x559ba7['search']&&_0x70867f[_0xaca4('0x8')]===_0xaca4('0x9')){return _0x70867f[_0x8b37cf]({'attributes':['id'],'raw':!![]});}})[_0xaca4('0x60')](function(_0x4be8e7){if(_0x4be8e7){if(_0x4be8e7[_0xaca4('0x19')]===0x0){_0x48ab23[_0xaca4('0x45')]('i.'+_0x5d66f1+_0xaca4('0x5e'));}else{_0x48ab23['and']('i.'+_0x5d66f1+_0xaca4('0x57'),_[_0xaca4('0x1b')](_0x4be8e7,'id'));}}else if(!_0x559ba7[_0x5d66f1]){_0x48ab23['and']('i.'+_0x5d66f1+'\x20IS\x20NOT\x20NULL');}})[_0xaca4('0x60')](function(){return _0x48ab23;});}function getClosedOrderClause(_0x3283b9,_0x1cb9b3){var _0x108093='';var _0x2dfb3b=[_0xaca4('0x69'),_0xaca4('0x6a'),_0xaca4('0x6b')];if(_0x3283b9===_0xaca4('0x33')){_0x2dfb3b['unshift'](_0xaca4('0x6c'));}if(_0x1cb9b3[_0xaca4('0x6d')]==='0'&&_0x3283b9===_0xaca4('0x33')){_0x108093=_0xaca4('0x6c');}else{if(_0x1cb9b3[_0xaca4('0x6d')]==='1'){_0x2dfb3b['shift']();}_0x108093=_0xaca4('0x6e')+_0x2dfb3b[_0xaca4('0x6f')](',\x20')+')';}return _0x108093;}function getFilteredInteractions(_0x4f2c82,_0x349a69,_0x4afee6,_0x5f4a5a){var _0x40a589=utils[_0xaca4('0x11')](_0x4f2c82);var _0x35f774=_[_0xaca4('0x66')](_0x4f2c82)+_0xaca4('0x70');var _0x679052=[];var _0x5aaec6=getTagsQuery();var _0x58cbce={'type':db['Sequelize']['QueryTypes'][_0xaca4('0x71')],'raw':!![]};var _0x3cdf74=[];var _0x231990=[];return db[_0xaca4('0x72')]['query'](_0x5aaec6[_0xaca4('0x73')](),_0x58cbce)[_0xaca4('0x60')](function(_0x3bc79a){_0x679052=_[_0xaca4('0x74')](_0x3bc79a,'id');_0x58cbce=_[_0xaca4('0x75')](_0x58cbce,{'model':db[_0x35f774],'mapToModel':!![],'nest':!![]});if(_0x4afee6[_0xaca4('0x61')]){_0x5f4a5a[_0xaca4('0x76')][_0xaca4('0x77')](function(_0x41fdeb){_0x349a69[_0xaca4('0xc')]('i.'+_0x41fdeb);});}else{_0x349a69[_0xaca4('0xc')](_0xaca4('0x78'),_0xaca4('0x43'));_0x349a69['field'](_0xaca4('0x79'),'Account.key');_0x349a69['field'](_0xaca4('0x7a'),'Account.mandatoryDisposition');if(_0x4f2c82==='mail'){_0x349a69[_0xaca4('0xc')](_0xaca4('0x7b'),_0xaca4('0x7c'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x7d'),_0xaca4('0x7e'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x7f'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x80'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x81'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x82'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x83'));_0x349a69['field']('i.attach');_0x349a69[_0xaca4('0xc')](_0xaca4('0x84'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x85'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x86'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x6b'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x6a'));_0x349a69[_0xaca4('0xc')]('i.thirdDisposition');_0x349a69['field'](_0xaca4('0x6c'));_0x349a69['field']('i.to');_0x349a69[_0xaca4('0xc')](_0xaca4('0x87'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x88'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x89'));}else if(_0x4f2c82===_0xaca4('0x31')){_0x349a69[_0xaca4('0xc')](_0xaca4('0x8a'),_0xaca4('0x7e'));}else{_0x349a69[_0xaca4('0xc')](_0xaca4('0x8b'),_0xaca4('0x7e'));}if(_0x4f2c82!==_0xaca4('0x33')){_0x349a69['field']('i.*');}_0x349a69[_0xaca4('0xc')](_0xaca4('0x8c'),_0xaca4('0x8d'));_0x349a69[_0xaca4('0xc')](_0xaca4('0x8e'),'Contact.lastName');_0x349a69['field'](_0xaca4('0x8f'),_0xaca4('0x90'));_0x349a69['field'](_0xaca4('0x91'),'Contact.phone');_0x349a69[_0xaca4('0xc')](_0xaca4('0x92'),_0xaca4('0x93'));_0x349a69['field'](_0xaca4('0x94'),_0xaca4('0x95'));_0x349a69['field'](_0xaca4('0x96'),_0xaca4('0x97'));_0x349a69['field'](_0xaca4('0x98'),'Owner.internal');_0x349a69[_0xaca4('0xc')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xaca4('0x99'));}if(_0x5f4a5a['limit']){_0x349a69[_0xaca4('0x9a')](_0x5f4a5a[_0xaca4('0x9a')]);}if(_0x5f4a5a[_0xaca4('0x9b')]){_0x349a69[_0xaca4('0x9b')](_0x5f4a5a[_0xaca4('0x9b')]);}return db['sequelize']['query'](_0x349a69['toString'](),_0x58cbce);})[_0xaca4('0x60')](function(_0x115f33){_0x3cdf74=_0x115f33;var _0x2f5e64=getUsersQuery(_0x4f2c82,_0x3cdf74);return db['sequelize'][_0xaca4('0x9c')](_0x2f5e64[_0xaca4('0x73')](),_0x58cbce);})[_0xaca4('0x60')](function(_0x298648){_0x231990=_[_0xaca4('0x9d')](_0x298648,_0x40a589);if(_0x4f2c82===_0xaca4('0x33')){return db[_0xaca4('0x9e')][_0xaca4('0x9f')]({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x45f771){var _0x2c52a5=_0x45f771?_0x45f771[_0xaca4('0xa0')]:undefined;var _0x11691d=_0x3cdf74[_0xaca4('0x1b')](function(_0x5f0bd3){return updateInteraction(_0x5f0bd3,_0x679052,_0x231990,_0x2c52a5);});return Promise['all'](_0x11691d);});}function countFilteredInteractions(_0x42b3c4,_0x40087e){var _0xc6e19a=_0x42b3c4[_0xaca4('0xa1')]();_0xc6e19a[_0xaca4('0xc')](_0xaca4('0xa2'));_0xc6e19a[_0xaca4('0xc')](_0xaca4('0x78'),_0xaca4('0x43'));var _0x3fb1ab=utils['getSelectedTags'](_0x40087e);if(!_[_0xaca4('0xa3')](_0x3fb1ab)){_0xc6e19a[_0xaca4('0x1a')](_0xaca4('0xa4'),_0x3fb1ab);}var _0x17342c={'type':db[_0xaca4('0xa5')][_0xaca4('0xa6')]['SELECT'],'raw':!![]};return db['sequelize'][_0xaca4('0x9c')](_0xc6e19a[_0xaca4('0x73')](),_0x17342c);}module[_0xaca4('0xa7')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 0ce2625..fa9328f 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc140=['abandoned','UserId','answered','disposition','MailMessage','findOne','plainBody','-id','then','lastMsgText','trimStart','catch','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','unmanaged','total','closed'];(function(_0x26114e,_0x3b1412){var _0x2d85bf=function(_0x239d60){while(--_0x239d60){_0x26114e['push'](_0x26114e['shift']());}};_0x2d85bf(++_0x3b1412);}(_0xc140,0x153));var _0x0c14=function(_0x1385f0,_0x5550bb){_0x1385f0=_0x1385f0-0x0;var _0x36ca00=_0xc140[_0x1385f0];return _0x36ca00;};'use strict';var _=require(_0x0c14('0x0'));var db=require(_0x0c14('0x1'))['db'];function getInteractionUsers(_0x215f0d,_0x8b9550){return new Promise(function(_0x897df7,_0x4ef2cb){try{var _0x3d6ff0=[];if(_0x8b9550[_0x215f0d]){_0x3d6ff0=_0x8b9550[_0x215f0d][_0x0c14('0x2')](function(_0x1717f2){return{'id':_0x1717f2['id'],'fullname':_0x1717f2[_0x0c14('0x3')]};});}return _0x897df7(_0x3d6ff0);}catch(_0x1cd19b){_0x4ef2cb(_0x1cd19b);}});}function getInteractionTags(_0x43f3e4,_0x408b89){var _0x3aa5cd=[];if(_0x43f3e4){_0x43f3e4[_0x0c14('0x4')](',')[_0x0c14('0x5')](function(_0x3d7ac4){_0x3aa5cd[_0x0c14('0x6')](_0x408b89[_0x3d7ac4]);});}return _0x3aa5cd;}function updateWaitingCounter(_0x961e4b){if(_0x961e4b['waiting']){_0x961e4b[_0x0c14('0x7')]-=0x1;}}function updateInteractionCounters(_0x464bec){_0x464bec[_0x0c14('0x7')]=0x0;_0x464bec[_0x0c14('0x8')]=0x0;_0x464bec['answered']=0x0;_0x464bec[_0x0c14('0x9')]=0x0;_0x464bec['abandoned']=0x0;_0x464bec[_0x0c14('0xa')]=0x0;if(_0x464bec[_0x0c14('0xb')]){if(_0x464bec['disposition']===_0x0c14('0xc')){_0x464bec[_0x0c14('0xc')]+=0x1;updateWaitingCounter(_0x464bec);}if(_0x464bec[_0x0c14('0xd')]){_0x464bec[_0x0c14('0xe')]+=0x1;if(_0x464bec[_0x0c14('0x8')]){_0x464bec[_0x0c14('0x8')]-=0x1;}}else{if(_0x464bec[_0x0c14('0xf')]){_0x464bec[_0x0c14('0x9')]+=0x1;updateWaitingCounter(_0x464bec);}}}else{if(!_0x464bec[_0x0c14('0xd')]){_0x464bec[_0x0c14('0x7')]+=0x1;}if(_0x464bec[_0x0c14('0xd')]){_0x464bec['talking']+=0x1;updateWaitingCounter(_0x464bec);}}_0x464bec['total']+=0x1;return _0x464bec;}function getLastMessageText(_0x2d351e){return db[_0x0c14('0x10')][_0x0c14('0x11')]({'where':{'$and':[{'MailInteractionId':_0x2d351e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0c14('0x12')],'order':_0x0c14('0x13'),'raw':!![]})[_0x0c14('0x14')](function(_0x3beba4){if(_0x3beba4&&_0x3beba4[_0x0c14('0x12')]){_0x2d351e[_0x0c14('0x15')]=_[_0x0c14('0x16')](_0x3beba4[_0x0c14('0x12')]);}return _0x2d351e;})[_0x0c14('0x17')](function(_0x4b24ab){throw _0x4b24ab;});}exports['updateInteraction']=function(_0x33c0a3,_0x4d5b3c,_0xe803fb,_0x5f02b8){return new Promise(function(_0x27878d,_0x476251){return getInteractionUsers(_0x33c0a3['id'],_0xe803fb)[_0x0c14('0x14')](function(_0x167b4d){_0x33c0a3[_0x0c14('0x18')]=_0x167b4d;return getInteractionTags(_0x33c0a3[_0x0c14('0x19')],_0x4d5b3c);})[_0x0c14('0x14')](function(_0x1bab10){_0x33c0a3[_0x0c14('0x1a')]=_0x1bab10;delete _0x33c0a3[_0x0c14('0x19')];return updateInteractionCounters(_0x33c0a3);})[_0x0c14('0x14')](function(_0x35e104){if(_0x5f02b8){return getLastMessageText(_0x35e104);}else{return _0x35e104;}})[_0x0c14('0x14')](function(_0x38bfd5){_0x27878d(_0x38bfd5);})['catch'](function(_0x5a2635){_0x476251(_0x5a2635);});});}; \ No newline at end of file +var _0x1766=['lodash','../../mysqldb','map','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','closed','disposition','UserId','MailMessage','findOne','out','plainBody','-id','catch','then','Users','TagIds','Tags'];(function(_0x1ec5b4,_0x587624){var _0x4cf88f=function(_0x5ed999){while(--_0x5ed999){_0x1ec5b4['push'](_0x1ec5b4['shift']());}};_0x4cf88f(++_0x587624);}(_0x1766,0x138));var _0x6176=function(_0x5aca1f,_0x1ea7fa){_0x5aca1f=_0x5aca1f-0x0;var _0x5413c7=_0x1766[_0x5aca1f];return _0x5413c7;};'use strict';var _=require(_0x6176('0x0'));var db=require(_0x6176('0x1'))['db'];function getInteractionUsers(_0x53276a,_0x33662c){return new Promise(function(_0x5ca7be,_0x15ef5a){try{var _0x4a4a1a=[];if(_0x33662c[_0x53276a]){_0x4a4a1a=_0x33662c[_0x53276a][_0x6176('0x2')](function(_0x3b3ccc){return{'id':_0x3b3ccc['id'],'fullname':_0x3b3ccc['fullname']};});}return _0x5ca7be(_0x4a4a1a);}catch(_0x221b58){_0x15ef5a(_0x221b58);}});}function getInteractionTags(_0x5dea80,_0x8c6d7f){var _0x35dfb3=[];if(_0x5dea80){_0x5dea80[_0x6176('0x3')](',')[_0x6176('0x4')](function(_0x1d3627){_0x35dfb3[_0x6176('0x5')](_0x8c6d7f[_0x1d3627]);});}return _0x35dfb3;}function updateWaitingCounter(_0x2d8ddf){if(_0x2d8ddf[_0x6176('0x6')]){_0x2d8ddf['waiting']-=0x1;}}function updateInteractionCounters(_0x464edd){_0x464edd['waiting']=0x0;_0x464edd[_0x6176('0x7')]=0x0;_0x464edd[_0x6176('0x8')]=0x0;_0x464edd[_0x6176('0x9')]=0x0;_0x464edd[_0x6176('0xa')]=0x0;_0x464edd['total']=0x0;if(_0x464edd[_0x6176('0xb')]){if(_0x464edd[_0x6176('0xc')]===_0x6176('0xa')){_0x464edd[_0x6176('0xa')]+=0x1;updateWaitingCounter(_0x464edd);}if(_0x464edd[_0x6176('0xd')]){_0x464edd[_0x6176('0x8')]+=0x1;if(_0x464edd['talking']){_0x464edd[_0x6176('0x7')]-=0x1;}}else{if(_0x464edd['disposition']){_0x464edd[_0x6176('0x9')]+=0x1;updateWaitingCounter(_0x464edd);}}}else{if(!_0x464edd['UserId']){_0x464edd[_0x6176('0x6')]+=0x1;}if(_0x464edd[_0x6176('0xd')]){_0x464edd['talking']+=0x1;updateWaitingCounter(_0x464edd);}}_0x464edd['total']+=0x1;return _0x464edd;}function getLastMessageText(_0x333d6a){return db[_0x6176('0xe')][_0x6176('0xf')]({'where':{'$and':[{'MailInteractionId':_0x333d6a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6176('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x6176('0x11')],'order':_0x6176('0x12'),'raw':!![]})['then'](function(_0x5c376a){if(_0x5c376a&&_0x5c376a['plainBody']){_0x333d6a['lastMsgText']=_['trimStart'](_0x5c376a[_0x6176('0x11')]);}return _0x333d6a;})[_0x6176('0x13')](function(_0x375b4c){throw _0x375b4c;});}exports['updateInteraction']=function(_0x266ed3,_0x299d99,_0x2e31a0,_0x30cf5f){return new Promise(function(_0x1a6256,_0x1965a3){return getInteractionUsers(_0x266ed3['id'],_0x2e31a0)[_0x6176('0x14')](function(_0x171e67){_0x266ed3[_0x6176('0x15')]=_0x171e67;return getInteractionTags(_0x266ed3[_0x6176('0x16')],_0x299d99);})['then'](function(_0x32dd9b){_0x266ed3[_0x6176('0x17')]=_0x32dd9b;delete _0x266ed3[_0x6176('0x16')];return updateInteractionCounters(_0x266ed3);})[_0x6176('0x14')](function(_0x4d3a14){if(_0x30cf5f){return getLastMessageText(_0x4d3a14);}else{return _0x4d3a14;}})[_0x6176('0x14')](function(_0x579930){_0x1a6256(_0x579930);})['catch'](function(_0x5a2a9f){_0x1965a3(_0x5a2a9f);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 75bf3e0..9498ba6 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e1c=['toUpperCase','role','stringify','null','Interaction','findOne','then','error','name','info','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20interaction=','\x20body=','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x1917a4,_0x5bdd51){var _0x1714e3=function(_0x82f4d5){while(--_0x82f4d5){_0x1917a4['push'](_0x1917a4['shift']());}};_0x1714e3(++_0x5bdd51);}(_0x2e1c,0x1b2));var _0xc2e1=function(_0x464f7c,_0x59d40d){_0x464f7c=_0x464f7c-0x0;var _0x1205f3=_0x2e1c[_0x464f7c];return _0x1205f3;};'use strict';var _=require(_0xc2e1('0x0'));var db=require(_0xc2e1('0x1'))['db'];var loggers={'openchannel':require(_0xc2e1('0x2'))('openchannel-interactions'),'mail':require(_0xc2e1('0x2'))(_0xc2e1('0x3')),'fax':require(_0xc2e1('0x2'))(_0xc2e1('0x4')),'sms':require(_0xc2e1('0x2'))(_0xc2e1('0x5')),'chat':require(_0xc2e1('0x2'))(_0xc2e1('0x6')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x30fc54){return _[_0xc2e1('0x7')](_0x30fc54)+(_0x30fc54==='chat'?_0xc2e1('0x8'):_0xc2e1('0x9'))+'Id';}function getInteractionFK(_0x3f24cb){return _[_0xc2e1('0x7')](_0x3f24cb)+_0xc2e1('0xa');}function getInteractionId(_0x66e4b1,_0x31d9ba,_0x518eff){if(_0x66e4b1&&_0x66e4b1[_[_0xc2e1('0xb')](_0x518eff)+_0xc2e1('0xa')]){return _0x66e4b1[_[_0xc2e1('0xb')](_0x518eff)+_0xc2e1('0xa')];}else if(_0x66e4b1&&_0x66e4b1['id']){return _0x66e4b1['id'];}else if(_0x31d9ba&&_0x31d9ba['id']){return _0x31d9ba['id'];}else{return _0xc2e1('0xc');}}function getInteractionsTables(_0x1b761b){return{'accounts':_0x1b761b+'_'+(_0x1b761b==='chat'?_0xc2e1('0xd'):_0xc2e1('0xe')),'interactions':_0x1b761b+_0xc2e1('0xf'),'interactionsTags':_0x1b761b+_0xc2e1('0x10'),'messages':_0x1b761b+_0xc2e1('0x11'),'userInteractions':_0xc2e1('0x12')+_0x1b761b+_0xc2e1('0xf')};}function getSelectedTags(_0x4ec69e){var _0x3dec6e=[];if(_0x4ec69e){_0x3dec6e=Array['isArray'](_0x4ec69e)?_0x4ec69e:[_0x4ec69e];}return _0x3dec6e;}function log(_0x551f28,_0x12a64f,_0x3ed68b,_0x30c9bc,_0x4bfbe0,_0x57c07a){loggers[_0x4bfbe0[_0xc2e1('0x13')]()][_0x551f28](_0xc2e1('0x14'),_0x57c07a[_0xc2e1('0x15')](),_0x12a64f?_0x12a64f['id']:null,_0x12a64f?_0x12a64f['name']:null,_0x12a64f?_0x12a64f[_0xc2e1('0x16')]:null,getInteractionId(_0x3ed68b,_0x30c9bc,_0x4bfbe0),_0x3ed68b?JSON[_0xc2e1('0x17')](_0x3ed68b):_0xc2e1('0x18'));}function updateUser(_0x18acc4,_0x266017,_0x2cb87e,_0x4bc237,_0x3176b2){db[_['upperFirst'](_0x4bc237)+_0xc2e1('0x19')][_0xc2e1('0x1a')]({'where':{'id':getInteractionId(_0x266017,_0x2cb87e,_0x4bc237)}})[_0xc2e1('0x1b')](function(_0xa3f3f4){if(_0xa3f3f4){return _0xa3f3f4['update']({'UserId':_0x18acc4?_0x18acc4['id']:null});}})[_0xc2e1('0x1b')](function(_0x315d20){if(_0x315d20){log('info',_0x18acc4,_0x266017,_0x2cb87e,_0x4bc237,_0x3176b2);}})['catch'](function(){log(_0xc2e1('0x1c'),_0x18acc4,_0x266017,_0x2cb87e,_0x4bc237,_0x3176b2);});}function logAcceptMessage(_0x24bf85,_0x306887,_0x537f9d,_0x4ec559){var _0x49bd7a=loggers[_0x24bf85[_0xc2e1('0x13')]()];var _0xdee876=_0x306887['id'];var _0x410363=_0x306887[_0xc2e1('0x1d')];var _0x222c38=_0x306887[_0xc2e1('0x16')];var _0x5d9cf7=JSON[_0xc2e1('0x17')](_0x4ec559||null);_0x49bd7a[_0xc2e1('0x1e')]('['+_0x24bf85[_0xc2e1('0x15')]()+_0xc2e1('0x1f')+_0xdee876+_0xc2e1('0x20')+_0x410363+'\x20role='+_0x222c38+_0xc2e1('0x21')+_0x537f9d+_0xc2e1('0x22')+_0x5d9cf7);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x35a4=['whatsapp-interactions','chat','Website','Account','upperFirst','InteractionId','unknown','_interaction_has_tags','user_has_','_interactions','isArray','toLowerCase','toUpperCase','name','stringify','null','Interaction','findOne','then','update','info','catch','error','role','\x20name=','\x20role=','\x20body=','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions'];(function(_0x4d30ac,_0x112604){var _0x279f70=function(_0x38475f){while(--_0x38475f){_0x4d30ac['push'](_0x4d30ac['shift']());}};_0x279f70(++_0x112604);}(_0x35a4,0x1d5));var _0x435a=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x35a4[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x435a('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x435a('0x1'))(_0x435a('0x2')),'mail':require('../../config/logger')(_0x435a('0x3')),'fax':require(_0x435a('0x1'))(_0x435a('0x4')),'sms':require(_0x435a('0x1'))(_0x435a('0x5')),'chat':require(_0x435a('0x1'))(_0x435a('0x6')),'whatsapp':require(_0x435a('0x1'))(_0x435a('0x7'))};function getAccountFK(_0xef9a55){return _['capitalize'](_0xef9a55)+(_0xef9a55===_0x435a('0x8')?_0x435a('0x9'):_0x435a('0xa'))+'Id';}function getInteractionFK(_0x247935){return _['capitalize'](_0x247935)+'InteractionId';}function getInteractionId(_0x5b443f,_0x468014,_0x36fe3d){if(_0x5b443f&&_0x5b443f[_[_0x435a('0xb')](_0x36fe3d)+_0x435a('0xc')]){return _0x5b443f[_[_0x435a('0xb')](_0x36fe3d)+'InteractionId'];}else if(_0x5b443f&&_0x5b443f['id']){return _0x5b443f['id'];}else if(_0x468014&&_0x468014['id']){return _0x468014['id'];}else{return _0x435a('0xd');}}function getInteractionsTables(_0x588a63){return{'accounts':_0x588a63+'_'+(_0x588a63==='chat'?'websites':'accounts'),'interactions':_0x588a63+'_interactions','interactionsTags':_0x588a63+_0x435a('0xe'),'messages':_0x588a63+'_messages','userInteractions':_0x435a('0xf')+_0x588a63+_0x435a('0x10')};}function getSelectedTags(_0x68f6bb){var _0x4f68b5=[];if(_0x68f6bb){_0x4f68b5=Array[_0x435a('0x11')](_0x68f6bb)?_0x68f6bb:[_0x68f6bb];}return _0x4f68b5;}function log(_0x5b8f4f,_0x2e511c,_0x2a5e5e,_0x42867c,_0x40457f,_0x376668){loggers[_0x40457f[_0x435a('0x12')]()][_0x5b8f4f]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x376668[_0x435a('0x13')](),_0x2e511c?_0x2e511c['id']:null,_0x2e511c?_0x2e511c[_0x435a('0x14')]:null,_0x2e511c?_0x2e511c['role']:null,getInteractionId(_0x2a5e5e,_0x42867c,_0x40457f),_0x2a5e5e?JSON[_0x435a('0x15')](_0x2a5e5e):_0x435a('0x16'));}function updateUser(_0x4a2c4d,_0x2626e7,_0x5da9e3,_0x720073,_0x3af5ee){db[_[_0x435a('0xb')](_0x720073)+_0x435a('0x17')][_0x435a('0x18')]({'where':{'id':getInteractionId(_0x2626e7,_0x5da9e3,_0x720073)}})[_0x435a('0x19')](function(_0x3d1e5d){if(_0x3d1e5d){return _0x3d1e5d[_0x435a('0x1a')]({'UserId':_0x4a2c4d?_0x4a2c4d['id']:null});}})[_0x435a('0x19')](function(_0x472fc5){if(_0x472fc5){log(_0x435a('0x1b'),_0x4a2c4d,_0x2626e7,_0x5da9e3,_0x720073,_0x3af5ee);}})[_0x435a('0x1c')](function(){log(_0x435a('0x1d'),_0x4a2c4d,_0x2626e7,_0x5da9e3,_0x720073,_0x3af5ee);});}function logAcceptMessage(_0x28d5a5,_0x25d1b1,_0x5b0dbf,_0x2d8eb9){var _0x3c5ae2=loggers[_0x28d5a5[_0x435a('0x12')]()];var _0x563887=_0x25d1b1['id'];var _0x236090=_0x25d1b1['name'];var _0x4142db=_0x25d1b1[_0x435a('0x1e')];var _0x28556a=JSON['stringify'](_0x2d8eb9||null);_0x3c5ae2[_0x435a('0x1b')]('['+_0x28d5a5[_0x435a('0x13')]()+'MESSAGE:ACCEPT]\x20id='+_0x563887+_0x435a('0x1f')+_0x236090+_0x435a('0x20')+_0x4142db+'\x20interaction='+_0x5b0dbf+_0x435a('0x21')+_0x28556a);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 28e51d5..97f0acd 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 _0x7437=['base64','utf8','final','parse','hasOwnProperty','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update'];(function(_0x401a51,_0x11ca2f){var _0x46ced8=function(_0x257af5){while(--_0x257af5){_0x401a51['push'](_0x401a51['shift']());}};_0x46ced8(++_0x11ca2f);}(_0x7437,0xe6));var _0x7743=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x7437[_0x323430];return _0x9eecd1;};'use strict';var crypto=require(_0x7743('0x0'));var util=require(_0x7743('0x1'));var compose=require(_0x7743('0x2'));var db=require(_0x7743('0x3'))['db'];var config=require(_0x7743('0x4'));function getValueFromLicense(_0x2436a4,_0x2ab96c){if(_0x2436a4&&_0x2ab96c){if(_0x2ab96c[_0x7743('0x5')]&&_0x2ab96c[_0x7743('0x6')]){var _0x51f098=_0x2ab96c[_0x7743('0x5')];var _0x22e95a=_0x2ab96c['license'];var _0x5bde2e=_0x51f098['split']('-')[0x4];var _0x5a2129=_0x51f098[_0x7743('0x7')]('-')[0x0];var _0x2da6f7=crypto[_0x7743('0x8')](_0x7743('0x9'),util[_0x7743('0xa')](_0x7743('0xb'),_0x5bde2e,_0x51f098,_0x5a2129));var _0x19998e=_0x2da6f7[_0x7743('0xc')](_0x22e95a,_0x7743('0xd'),_0x7743('0xe'));_0x19998e+=_0x2da6f7[_0x7743('0xf')](_0x7743('0xe'));var _0x4273a4=JSON[_0x7743('0x10')](_0x19998e);return _0x4273a4[_0x7743('0x11')](_0x2436a4)?_0x4273a4[_0x2436a4]:null;}}return null;}function isLimit(_0x311d01,_0x3773cf,_0x2a1398,_0x58f989){var _0x374c8e=_0x3773cf;return compose()['use'](function(_0x408f43,_0x58553d,_0x24ae63){return db[_0x7743('0x12')][_0x7743('0x13')]({'where':{'id':0x1},'raw':!![]})[_0x7743('0x14')](function(_0x394dda){var _0x5eb20e=getValueFromLicense(_0x311d01,_0x394dda);return _0x5eb20e?_0x5eb20e:_0x374c8e;})['then'](function(_0x471fe4){_0x374c8e=_0x471fe4;return _0x2a1398[_0x7743('0x15')](_0x58f989);})['then'](function(_0x507db8){if(_0x507db8>=_0x374c8e){return _0x58553d[_0x7743('0x16')](0x193)[_0x7743('0x17')]({'message':util[_0x7743('0xa')](_0x7743('0x18'),_0x311d01)});}_0x24ae63();})[_0x7743('0x19')](function(_0x3087c8){_0x24ae63(_0x3087c8);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x7743('0x1a')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x5430=['utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64'];(function(_0x1aad46,_0x2f8769){var _0x22de99=function(_0x1d05fe){while(--_0x1d05fe){_0x1aad46['push'](_0x1aad46['shift']());}};_0x22de99(++_0x2f8769);}(_0x5430,0x16f));var _0x0543=function(_0x1f242e,_0x1a136f){_0x1f242e=_0x1f242e-0x0;var _0x39829b=_0x5430[_0x1f242e];return _0x39829b;};'use strict';var crypto=require(_0x0543('0x0'));var util=require('util');var compose=require(_0x0543('0x1'));var db=require(_0x0543('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4104fb,_0x1fef48){if(_0x4104fb&&_0x1fef48){if(_0x1fef48['data1']&&_0x1fef48['license']){var _0x5cd198=_0x1fef48[_0x0543('0x3')];var _0x53347c=_0x1fef48[_0x0543('0x4')];var _0x270144=_0x5cd198['split']('-')[0x4];var _0xf922=_0x5cd198[_0x0543('0x5')]('-')[0x0];var _0x471030=crypto[_0x0543('0x6')](_0x0543('0x7'),util[_0x0543('0x8')](_0x0543('0x9'),_0x270144,_0x5cd198,_0xf922));var _0x60d60e=_0x471030['update'](_0x53347c,_0x0543('0xa'),_0x0543('0xb'));_0x60d60e+=_0x471030[_0x0543('0xc')](_0x0543('0xb'));var _0x38f071=JSON[_0x0543('0xd')](_0x60d60e);return _0x38f071[_0x0543('0xe')](_0x4104fb)?_0x38f071[_0x4104fb]:null;}}return null;}function isLimit(_0xf873c6,_0x4c12de,_0x26a697,_0x565a5c){var _0x51235e=_0x4c12de;return compose()[_0x0543('0xf')](function(_0x10e7b6,_0x50194e,_0x488882){return db[_0x0543('0x10')][_0x0543('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x0543('0x12')](function(_0x353e55){var _0x93c167=getValueFromLicense(_0xf873c6,_0x353e55);return _0x93c167?_0x93c167:_0x51235e;})[_0x0543('0x12')](function(_0x4c4bc8){_0x51235e=_0x4c4bc8;return _0x26a697[_0x0543('0x13')](_0x565a5c);})['then'](function(_0x17ea2e){if(_0x17ea2e>=_0x51235e){return _0x50194e[_0x0543('0x14')](0x193)['json']({'message':util[_0x0543('0x8')](_0x0543('0x15'),_0xf873c6)});}_0x488882();})[_0x0543('0x16')](function(_0x306b1f){_0x488882(_0x306b1f);});});}function isUserLimit(){return isLimit(_0x0543('0x17'),0x1,db['User'],{'where':{'$or':[{'role':_0x0543('0x18')},{'role':_0x0543('0x19')}]}});}exports[_0x0543('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 20a6ee5..14b883f 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 _0xda75=['value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','CAST(','field','$ne','$notIn','text','\x20OR\x20','$in','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','start','pop','format','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','shift','match','forEach','filter','indexOf','map','conditions','buildExpression','operator','$eq','$between'];(function(_0x41414f,_0x13b8c4){var _0x286eda=function(_0x2e0df6){while(--_0x2e0df6){_0x41414f['push'](_0x41414f['shift']());}};_0x286eda(++_0x13b8c4);}(_0xda75,0x18a));var _0x5da7=function(_0x2cc292,_0x56afad){_0x2cc292=_0x2cc292-0x0;var _0x5e27a9=_0xda75[_0x2cc292];return _0x5e27a9;};'use strict';var _=require(_0x5da7('0x0'));var moment=require(_0x5da7('0x1'));exports[_0x5da7('0x2')]=function(_0x201783){var _0x35cb5b={'conditions':[]};_0x35cb5b[_0x5da7('0x3')]=_['startsWith'](_0x201783,_0x5da7('0x4'))?'or':_0x5da7('0x5');var _0x10dccb=_0x201783[_0x5da7('0x6')](_0x5da7('0x7'),'')['replace']('[$or]','')[_0x5da7('0x8')]('||');for(var _0x2a75b1=0x0;_0x2a75b1<_0x10dccb[_0x5da7('0x9')];_0x2a75b1++){var _0x503328=_0x10dccb[_0x2a75b1][_0x5da7('0x8')](':=');var _0x581e3d=_0x503328[0x0];var _0x451860=_0x503328[_0x5da7('0xa')](0x1);_0x451860['forEach'](function(_0x70949d){var _0x5597c3=_0x70949d[_0x5da7('0x8')]('[')[_0x5da7('0xb')]();var _0x54522f=_0x70949d[_0x5da7('0xc')](/\[(.*?)\]/g);_0x54522f[_0x5da7('0xd')](function(_0x47eeef){var _0x2288a5=_0x47eeef['split']('[')[_0x5da7('0xe')](function(_0x2ddb51){return _0x2ddb51[_0x5da7('0xf')](']')>-0x1;})[_0x5da7('0x10')](function(_0x24d9ad){return _0x24d9ad[_0x5da7('0x8')](']')[0x0];})[0x0];_0x35cb5b[_0x5da7('0x11')]['push']({'field':_0x581e3d,'operator':_0x5597c3,'value':_0x2288a5});});});}return _0x35cb5b;};exports[_0x5da7('0x12')]=function(_0x27f44e,_0x5b785d,_0x39dbb5){var _0x2d0f8c={};if(_0x5b785d==='DATE'){if(_0x39dbb5[_0x5da7('0x13')]===_0x5da7('0x14')){_0x39dbb5[_0x5da7('0x13')]=_0x5da7('0x15');_0x39dbb5[_0x5da7('0x16')]+=','+_0x39dbb5[_0x5da7('0x16')];}else if(_[_0x5da7('0x17')]([_0x5da7('0x18'),_0x5da7('0x19')],_0x39dbb5[_0x5da7('0x13')])){_0x39dbb5['value']=moment(_0x39dbb5[_0x5da7('0x16')])[_0x5da7('0x1a')](0x1,_0x5da7('0x1b'))['format'](_0x5da7('0x1c'));}}if(_0x39dbb5['castTo']){_0x5b785d=_0x39dbb5[_0x5da7('0x1d')];_0x2d0f8c['text']=_0x5da7('0x1e')+_0x27f44e+'.'+_0x39dbb5[_0x5da7('0x1f')]+'\x20AS\x20'+_0x39dbb5[_0x5da7('0x1d')]+')\x20'+parseOperator(_0x39dbb5[_0x5da7('0x13')]);}else{_0x2d0f8c['text']=_0x27f44e+'.'+_0x39dbb5[_0x5da7('0x1f')]+'\x20'+parseOperator(_0x39dbb5[_0x5da7('0x13')]);}if(_[_0x5da7('0x17')]([_0x5da7('0x20'),_0x5da7('0x21')],_0x39dbb5[_0x5da7('0x13')]))_0x2d0f8c[_0x5da7('0x22')]='('+_0x2d0f8c['text']+_0x5da7('0x23')+_0x27f44e+'.'+_0x39dbb5[_0x5da7('0x1f')]+'\x20IS\x20NULL)';_0x2d0f8c['value']=parseValue(_0x5b785d,_0x39dbb5[_0x5da7('0x13')],_0x39dbb5[_0x5da7('0x16')]);return _0x2d0f8c;};function parseOperator(_0x1262b1){var _0x4095bb;switch(_0x1262b1){case _0x5da7('0x24'):_0x4095bb='IN\x20?';break;case'$notIn':_0x4095bb=_0x5da7('0x25');break;case'$eq':_0x4095bb='=\x20?';break;case _0x5da7('0x20'):_0x4095bb=_0x5da7('0x26');break;case _0x5da7('0x27'):case _0x5da7('0x28'):case _0x5da7('0x29'):_0x4095bb='LIKE\x20?';break;case _0x5da7('0x2a'):_0x4095bb=_0x5da7('0x2b');break;case _0x5da7('0x18'):_0x4095bb=_0x5da7('0x2c');break;case _0x5da7('0x19'):_0x4095bb=_0x5da7('0x2d');break;case _0x5da7('0x2e'):_0x4095bb='>=\x20?';break;case _0x5da7('0x15'):_0x4095bb='BETWEEN\x20?\x20AND\x20?';break;}return _0x4095bb;}function parseValue(_0x1a8683,_0x2c09b6,_0x324916){var _0x1428e2={'start':undefined,'end':undefined};switch(_0x2c09b6){case'$in':case'$notIn':_0x1428e2['start']=_0x324916['split'](',');break;case _0x5da7('0x27'):_0x1428e2[_0x5da7('0x2f')]='%'+_0x324916+'%';break;case _0x5da7('0x28'):_0x1428e2[_0x5da7('0x2f')]=_0x324916+'%';break;case _0x5da7('0x29'):_0x1428e2[_0x5da7('0x2f')]='%'+_0x324916;break;case _0x5da7('0x15'):var _0x495835=_0x324916[_0x5da7('0x8')](',');var _0x324916=_0x495835[_0x5da7('0xb')]();var _0x45f8fc=_0x495835[_0x5da7('0x30')]();if(_0x1a8683==='DATE'){_0x324916=moment(_0x324916)['utcOffset'](0x0,!![])[_0x5da7('0x31')]();_0x45f8fc=moment(_0x45f8fc)['utcOffset'](0x0,!![])[_0x5da7('0x1a')](0x17,'hours')[_0x5da7('0x1a')](0x3b,_0x5da7('0x32'))[_0x5da7('0x1a')](0x3b,_0x5da7('0x33'))[_0x5da7('0x31')]();}_0x1428e2={'start':_0x324916,'end':_0x45f8fc};break;default:_0x1428e2[_0x5da7('0x2f')]=_0x324916;break;}return _0x1428e2;} \ No newline at end of file +var _0x33a7=['<=\x20?','$gte','>=\x20?','start','$between','shift','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','and','[$and]','replace','split','slice','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?'];(function(_0x47f2c5,_0x40c84b){var _0x38b405=function(_0x22c2aa){while(--_0x22c2aa){_0x47f2c5['push'](_0x47f2c5['shift']());}};_0x38b405(++_0x40c84b);}(_0x33a7,0x1c3));var _0x733a=function(_0x3011b7,_0x56b4b0){_0x3011b7=_0x3011b7-0x0;var _0x304ca2=_0x33a7[_0x3011b7];return _0x304ca2;};'use strict';var _=require(_0x733a('0x0'));var moment=require(_0x733a('0x1'));exports[_0x733a('0x2')]=function(_0x25fbe3){var _0x597ecf={'conditions':[]};_0x597ecf['sqlOperator']=_[_0x733a('0x3')](_0x25fbe3,'[$or]')?'or':_0x733a('0x4');var _0x551bfc=_0x25fbe3['replace'](_0x733a('0x5'),'')[_0x733a('0x6')]('[$or]','')[_0x733a('0x7')]('||');for(var _0x2ab366=0x0;_0x2ab366<_0x551bfc['length'];_0x2ab366++){var _0x73d632=_0x551bfc[_0x2ab366][_0x733a('0x7')](':=');var _0x5e7365=_0x73d632[0x0];var _0x20a53d=_0x73d632[_0x733a('0x8')](0x1);_0x20a53d[_0x733a('0x9')](function(_0xcceb9){var _0x5dcc0c=_0xcceb9[_0x733a('0x7')]('[')['shift']();var _0xc3ecca=_0xcceb9[_0x733a('0xa')](/\[(.*?)\]/g);_0xc3ecca[_0x733a('0x9')](function(_0x47cea8){var _0xdf457f=_0x47cea8['split']('[')[_0x733a('0xb')](function(_0x5a04fd){return _0x5a04fd[_0x733a('0xc')](']')>-0x1;})[_0x733a('0xd')](function(_0x1d0e42){return _0x1d0e42[_0x733a('0x7')](']')[0x0];})[0x0];_0x597ecf[_0x733a('0xe')][_0x733a('0xf')]({'field':_0x5e7365,'operator':_0x5dcc0c,'value':_0xdf457f});});});}return _0x597ecf;};exports[_0x733a('0x10')]=function(_0xf49ae4,_0x429d6d,_0x503a15){var _0x19e1a9={};if(_0x429d6d===_0x733a('0x11')){if(_0x503a15[_0x733a('0x12')]==='$eq'){_0x503a15['operator']='$between';_0x503a15['value']+=','+_0x503a15[_0x733a('0x13')];}else if(_[_0x733a('0x14')]([_0x733a('0x15'),_0x733a('0x16')],_0x503a15[_0x733a('0x12')])){_0x503a15[_0x733a('0x13')]=moment(_0x503a15['value'])[_0x733a('0x17')](0x1,_0x733a('0x18'))['format'](_0x733a('0x19'));}}if(_0x503a15[_0x733a('0x1a')]){_0x429d6d=_0x503a15['castTo'];_0x19e1a9['text']=_0x733a('0x1b')+_0xf49ae4+'.'+_0x503a15[_0x733a('0x1c')]+'\x20AS\x20'+_0x503a15[_0x733a('0x1a')]+')\x20'+parseOperator(_0x503a15[_0x733a('0x12')]);}else{_0x19e1a9[_0x733a('0x1d')]=_0xf49ae4+'.'+_0x503a15[_0x733a('0x1c')]+'\x20'+parseOperator(_0x503a15['operator']);}if(_['includes']([_0x733a('0x1e'),_0x733a('0x1f')],_0x503a15['operator']))_0x19e1a9[_0x733a('0x1d')]='('+_0x19e1a9[_0x733a('0x1d')]+_0x733a('0x20')+_0xf49ae4+'.'+_0x503a15['field']+'\x20IS\x20NULL)';_0x19e1a9['value']=parseValue(_0x429d6d,_0x503a15['operator'],_0x503a15[_0x733a('0x13')]);return _0x19e1a9;};function parseOperator(_0x4708b6){var _0x2a5cd2;switch(_0x4708b6){case _0x733a('0x21'):_0x2a5cd2='IN\x20?';break;case _0x733a('0x1f'):_0x2a5cd2=_0x733a('0x22');break;case _0x733a('0x23'):_0x2a5cd2='=\x20?';break;case _0x733a('0x1e'):_0x2a5cd2=_0x733a('0x24');break;case _0x733a('0x25'):case _0x733a('0x26'):case _0x733a('0x27'):_0x2a5cd2=_0x733a('0x28');break;case _0x733a('0x29'):_0x2a5cd2=_0x733a('0x2a');break;case _0x733a('0x15'):_0x2a5cd2=_0x733a('0x2b');break;case _0x733a('0x16'):_0x2a5cd2=_0x733a('0x2c');break;case _0x733a('0x2d'):_0x2a5cd2=_0x733a('0x2e');break;case'$between':_0x2a5cd2='BETWEEN\x20?\x20AND\x20?';break;}return _0x2a5cd2;}function parseValue(_0x32d36c,_0x1f45d4,_0x33b658){var _0x5514c0={'start':undefined,'end':undefined};switch(_0x1f45d4){case'$in':case'$notIn':_0x5514c0[_0x733a('0x2f')]=_0x33b658[_0x733a('0x7')](',');break;case _0x733a('0x25'):_0x5514c0['start']='%'+_0x33b658+'%';break;case _0x733a('0x26'):_0x5514c0['start']=_0x33b658+'%';break;case _0x733a('0x27'):_0x5514c0[_0x733a('0x2f')]='%'+_0x33b658;break;case _0x733a('0x30'):var _0x451788=_0x33b658[_0x733a('0x7')](',');var _0x33b658=_0x451788[_0x733a('0x31')]();var _0x34792d=_0x451788[_0x733a('0x32')]();if(_0x32d36c===_0x733a('0x11')){_0x33b658=moment(_0x33b658)[_0x733a('0x33')](0x0,!![])['format']();_0x34792d=moment(_0x34792d)[_0x733a('0x33')](0x0,!![])[_0x733a('0x17')](0x17,_0x733a('0x34'))['add'](0x3b,_0x733a('0x35'))[_0x733a('0x17')](0x3b,_0x733a('0x36'))['format']();}_0x5514c0={'start':_0x33b658,'end':_0x34792d};break;default:_0x5514c0[_0x733a('0x2f')]=_0x33b658;break;}return _0x5514c0;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 9b09958..6d4c5e4 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 _0x2502=['merge','map','lower','options','include','push','lodash','moment','../../mysqldb','parse','keys','includes','model','alias','fields','split','filters','isEmpty','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','indexOf','priority','cast','col','unsigned','substr','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','{EXPR}','replace','trim','join','$id','query','intersection','attributes','nolimit','sort','where','pick','filter','object','columns','value'];(function(_0x1a5ad1,_0x357407){var _0x7b8b22=function(_0x312e53){while(--_0x312e53){_0x1a5ad1['push'](_0x1a5ad1['shift']());}};_0x7b8b22(++_0x357407);}(_0x2502,0x1bf));var _0x2250=function(_0x33cd9d,_0x2a0516){_0x33cd9d=_0x33cd9d-0x0;var _0x270fc1=_0x2502[_0x33cd9d];return _0x270fc1;};'use strict';var _=require(_0x2250('0x0'));var sequelize=require('sequelize');var moment=require(_0x2250('0x1'));var db=require(_0x2250('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x353103){var _0xda7e03=['ne'];try{var _0x51db49=JSON[_0x2250('0x3')](_0x353103);var _0xf82f85=Object[_0x2250('0x4')](_0x51db49)[0x0];return _0xda7e03[_0x2250('0x5')](_0xf82f85);}catch(_0x419f8d){return![];}}function getOperatorValue(_0x359585){var _0x3e89bb=JSON[_0x2250('0x3')](_0x359585);var _0x59f691=Object['keys'](_0x3e89bb)[0x0];var _0x1d43f2=_0x3e89bb[_0x59f691];return{['$'+_0x59f691]:_0x1d43f2};}function parseIncludeModel(_0x933f65){var _0x27f932=JSON[_0x2250('0x3')](_0x933f65);return{'model':db[_0x27f932[_0x2250('0x6')]],'as':_0x27f932[_0x2250('0x7')],'attributes':_0x27f932[_0x2250('0x8')],'raw':_0x27f932['raw']};}exports['fields']=function(_0x39cd95){var _0x3b97f0=null;if(_0x39cd95){_0x3b97f0=_0x39cd95[_0x2250('0x9')](',');}return _0x3b97f0;};exports[_0x2250('0xa')]=function(_0x5a709f,_0x2d6081){var _0x54d0b4={};if(!_[_0x2250('0xb')](_0x5a709f)){_['forOwn'](_0x5a709f,function(_0x74672,_0x27f2ce){try{if(_0x2d6081){var _0x1f3d2e=_['find'](_0x2d6081,{'name':_0x27f2ce})||{};if(hasSequelizeOperator(_0x74672)){_0x54d0b4[_0x27f2ce]=getOperatorValue(_0x74672);}else if(_0x1f3d2e[_0x2250('0xc')]===_0x2250('0xd')&&_['isPlainObject'](_0x74672)){var _0x29403c=JSON['parse'](_0x74672);var _0x2afa2c={'$gte':moment(moment(_0x29403c[_0x2250('0xe')])[_0x2250('0xf')](_0x2250('0x10')))[_0x2250('0x11')]()[_0x2250('0xf')](),'$lte':moment(moment(_0x29403c[_0x2250('0x12')])['format'](_0x2250('0x10')))[_0x2250('0x11')]()[_0x2250('0x13')](0x1,'s')[_0x2250('0xf')]()};_0x54d0b4[_0x27f2ce]=_0x2afa2c;}else if(_0x1f3d2e[_0x2250('0x14')]===_0x2250('0x15')){_0x54d0b4[_0x27f2ce]=_0x74672;}else{_0x54d0b4[_0x27f2ce]=_[_0x2250('0x16')](_0x74672)?_0x74672:JSON[_0x2250('0x3')](_0x74672);}}else{_0x54d0b4[_0x27f2ce]=_[_0x2250('0x16')](_0x74672)?_0x74672:JSON[_0x2250('0x3')](_0x74672);}}catch(_0x11dcf2){_0x54d0b4[_0x27f2ce]=_0x74672['split'](',');}});}return _0x54d0b4;};exports[_0x2250('0x17')]=function(_0x4a3a06){_0x4a3a06=parseInt(_0x4a3a06,0xa);if(!_0x4a3a06||_0x4a3a06<0x0){_0x4a3a06=LIMIT_VALUE;}return _0x4a3a06;};exports[_0x2250('0x18')]=function(_0x19795a){_0x19795a=parseInt(_0x19795a,0xa);if(!_0x19795a||_0x19795a<0x0){_0x19795a=0x0;}return _0x19795a;};exports['sort']=function(_0x2e045e){var _0xdad9d7,_0x4b788d=null;if(_0x2e045e){_0xdad9d7=_0x2e045e[_0x2250('0x9')](',');_0x4b788d=_['map'](_0xdad9d7,function(_0x26eeda){if(_0x26eeda[_0x2250('0x19')]('-')===0x0){return[_0x26eeda===_0x2250('0x1a')?sequelize[_0x2250('0x1b')](sequelize[_0x2250('0x1c')](_0x2250('0x1a')),_0x2250('0x1d')):_0x26eeda[_0x2250('0x1e')](0x1),'DESC'];}else{return[_0x26eeda===_0x2250('0x1a')?sequelize[_0x2250('0x1b')](sequelize['col'](_0x2250('0x1a')),_0x2250('0x1d')):_0x26eeda,'ASC'];}});}return _0x4b788d;};exports[_0x2250('0x1f')]=function(_0x4c29ff,_0x184bbe){if(_[_0x2250('0xb')](_0x4c29ff)){return _0x4c29ff;}if(_['isArray'](_0x4c29ff)){for(var _0x3b2e62=0x0;_0x3b2e62<_0x4c29ff[_0x2250('0x20')];_0x3b2e62+=0x1){_0x4c29ff[_0x3b2e62]=this[_0x2250('0x1f')](_0x4c29ff[_0x3b2e62],_0x184bbe);}return _0x4c29ff;}if(!_[_0x2250('0x21')](_0x4c29ff)){return _0x4c29ff;}if(_[_0x2250('0x22')](_0x184bbe)){_0x184bbe=[_0x184bbe];}if(!_[_0x2250('0x16')](_0x184bbe)){return _0x4c29ff;}for(var _0x162aff=0x0;_0x162aff<_0x184bbe[_0x2250('0x20')];_0x162aff+=0x1){_[_0x2250('0x23')](_0x4c29ff,_0x184bbe[_0x162aff]);}for(var _0x53b5c2 in _0x4c29ff){if(_0x4c29ff[_0x2250('0x24')](_0x53b5c2)){_0x4c29ff[_0x53b5c2]=this[_0x2250('0x1f')](_0x4c29ff[_0x53b5c2],_0x184bbe);}}return _0x4c29ff;};exports[_0x2250('0x25')]=function(_0xd4156c){return _0xd4156c[_0x2250('0x26')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x2250('0x27')]=function(_0x3d205e){return _0x3d205e[_0x2250('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x2250('0x28')]=function(_0x2a1068,_0xe80120){var _0x1a7d93=[];var _0x1d1fe1=/([^:]")"+/g;var _0x1de611=/[*<>~@-]/g;var _0x28813e=/[ `!@#$%^&*()_\-?~<>]/;var _0x584289=/[ ,]+/;var _0x588553=_0xe80120?'\x22{EXPR}\x22':_0x2250('0x29');if(_0xe80120){_0x2a1068=_0x2a1068[_0x2250('0x2a')](_0x1de611,'\x20')[_0x2250('0x2b')]();}_0x2a1068['split'](_0x584289)['forEach'](function(_0x3164ce){_0x3164ce=_0x3164ce[_0x2250('0x2a')](_0x1d1fe1,'$1');_0x3164ce='+'+_0x3164ce+'*';var _0x5a4a64=_0x3164ce['match'](_0x28813e);if(_0x5a4a64){_0x3164ce='\x22'+_0x3164ce+'\x22';}_0x1a7d93['push'](_0x3164ce);});_0x588553=_0x588553[_0x2250('0x2a')](_0x2250('0x29'),_0x1a7d93[_0x2250('0x2c')]('\x20'));return _0x588553;};exports['getOptions']=function(_0x218751,_0x54aae7,_0x39cf1a){var _0x425133={},_0x46024e={};if(_0x54aae7['query'][_0x2250('0x2d')]){_0x54aae7['query']['id']=_0x54aae7[_0x2250('0x2e')][_0x2250('0x2d')];delete _0x54aae7['query'][_0x2250('0x2d')];}_0x425133['model']=_['map'](_0x218751,'name');_0x425133[_0x2250('0x2e')]=_[_0x2250('0x4')](_0x54aae7[_0x2250('0x2e')]);_0x425133[_0x2250('0xa')]=_[_0x2250('0x2f')](_0x425133[_0x2250('0x6')],_0x425133[_0x2250('0x2e')]);_0x46024e['attributes']=_[_0x2250('0x2f')](_0x425133[_0x2250('0x6')],this[_0x2250('0x8')](_0x54aae7[_0x2250('0x2e')][_0x2250('0x8')]));_0x46024e[_0x2250('0x30')]=_0x46024e[_0x2250('0x30')][_0x2250('0x20')]?_0x46024e[_0x2250('0x30')]:_0x425133[_0x2250('0x6')];if(!_0x54aae7[_0x2250('0x2e')][_0x2250('0x24')](_0x2250('0x31'))){_0x46024e[_0x2250('0x17')]=this[_0x2250('0x17')](_0x54aae7[_0x2250('0x2e')][_0x2250('0x17')]);_0x46024e[_0x2250('0x18')]=this[_0x2250('0x18')](_0x54aae7[_0x2250('0x2e')][_0x2250('0x18')]);}_0x46024e['order']=this['sort'](_0x54aae7[_0x2250('0x2e')][_0x2250('0x32')]);_0x46024e[_0x2250('0x33')]=this['filters'](_[_0x2250('0x34')](_0x54aae7[_0x2250('0x2e')],_0x425133[_0x2250('0xa')]),_0x218751);if(_0x54aae7['query'][_0x2250('0x35')]){var _0x5b5ecd=_0x218751;var _0x52d204=_0x54aae7[_0x2250('0x2e')][_0x2250('0x35')];if(typeof _0x52d204===_0x2250('0x36')){_0x5b5ecd=_[_0x2250('0x35')](_0x218751,function(_0x2bd242){return _[_0x2250('0x5')](_0x52d204[_0x2250('0x37')],_0x2bd242[_0x2250('0x14')]);});_0x52d204=_0x52d204[_0x2250('0x38')];}_0x46024e[_0x2250('0x33')]=_[_0x2250('0x39')](_0x46024e[_0x2250('0x33')],{'$or':_[_0x2250('0x3a')](_0x5b5ecd,function(_0x34595d){if(_0x34595d['type']!=='VIRTUAL'){if(_0x39cf1a){return sequelize[_0x2250('0x33')](sequelize['fn'](_0x2250('0x3b'),sequelize['col'](_0x34595d[_0x2250('0x14')])),{'$like':sequelize['fn'](_0x2250('0x3b'),'%'+_0x54aae7[_0x2250('0x2e')][_0x2250('0x35')]+'%')});}else{var _0x3aa0e6={};_0x3aa0e6[_0x34595d[_0x2250('0x14')]]={'$like':'%'+_0x54aae7[_0x2250('0x2e')]['filter']+'%'};return _0x3aa0e6;}}})});}_0x46024e=_[_0x2250('0x39')]({},_0x46024e,_0x54aae7[_0x2250('0x3c')]);return _0x46024e;};exports['include']=function(_0x5d188e){var _0x4131c2=[];if(_0x5d188e['includeAll']){_0x4131c2['push']({'all':!![]});}else if(_0x5d188e['include']){if(Array['isArray'](_0x5d188e[_0x2250('0x3d')])){_0x4131c2=Object[_0x2250('0x4')](_0x5d188e[_0x2250('0x3d')])['map'](function(_0x3cea00){return parseIncludeModel(_0x5d188e[_0x2250('0x3d')][_0x3cea00]);});}else{var _0x209e74=parseIncludeModel(_0x5d188e['include']);_0x4131c2[_0x2250('0x3e')](_0x209e74);}}return _0x4131c2;};exports['escapeLIKESpecialChars']=function(_0x41de40){return _0x41de40[_0x2250('0x2a')](/[%_^-]/g,function(_0x39d8c4){return'\x5c'+_0x39d8c4;});}; \ No newline at end of file +var _0x880b=['keys','includes','model','alias','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','utc','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','offset','map','priority','cast','unsigned','substr','DESC','col','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','replace','forEach','push','{EXPR}','query','$id','intersection','fields','attributes','order','sort','pick','filter','object','columns','value','where','lower','merge','options','include','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','parse'];(function(_0x4ac494,_0x27bd53){var _0x1e410f=function(_0x57e87b){while(--_0x57e87b){_0x4ac494['push'](_0x4ac494['shift']());}};_0x1e410f(++_0x27bd53);}(_0x880b,0x18d));var _0xb880=function(_0x1058aa,_0x43c08f){_0x1058aa=_0x1058aa-0x0;var _0x2f9bd8=_0x880b[_0x1058aa];return _0x2f9bd8;};'use strict';var _=require(_0xb880('0x0'));var sequelize=require(_0xb880('0x1'));var moment=require(_0xb880('0x2'));var db=require(_0xb880('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x97a109){var _0x3f0e43=['ne'];try{var _0x54b51f=JSON[_0xb880('0x4')](_0x97a109);var _0x41dac5=Object[_0xb880('0x5')](_0x54b51f)[0x0];return _0x3f0e43[_0xb880('0x6')](_0x41dac5);}catch(_0x117df8){return![];}}function getOperatorValue(_0xcaa234){var _0x580116=JSON['parse'](_0xcaa234);var _0x2ce261=Object['keys'](_0x580116)[0x0];var _0x250fbf=_0x580116[_0x2ce261];return{['$'+_0x2ce261]:_0x250fbf};}function parseIncludeModel(_0x5135ef){var _0x1b8692=JSON[_0xb880('0x4')](_0x5135ef);return{'model':db[_0x1b8692[_0xb880('0x7')]],'as':_0x1b8692[_0xb880('0x8')],'attributes':_0x1b8692['fields'],'raw':_0x1b8692['raw']};}exports['fields']=function(_0x229bdc){var _0x6cff72=null;if(_0x229bdc){_0x6cff72=_0x229bdc[_0xb880('0x9')](',');}return _0x6cff72;};exports[_0xb880('0xa')]=function(_0x5ba637,_0x46efcb){var _0x55a1ac={};if(!_[_0xb880('0xb')](_0x5ba637)){_[_0xb880('0xc')](_0x5ba637,function(_0x29d5b6,_0x49c309){try{if(_0x46efcb){var _0x18217c=_[_0xb880('0xd')](_0x46efcb,{'name':_0x49c309})||{};if(hasSequelizeOperator(_0x29d5b6)){_0x55a1ac[_0x49c309]=getOperatorValue(_0x29d5b6);}else if(_0x18217c[_0xb880('0xe')]===_0xb880('0xf')&&_[_0xb880('0x10')](_0x29d5b6)){var _0xe237ba=JSON[_0xb880('0x4')](_0x29d5b6);var _0x29a7ec={'$gte':moment(moment(_0xe237ba[_0xb880('0x11')])[_0xb880('0x12')]('YYYY-MM-DD'))[_0xb880('0x13')]()['format'](),'$lte':moment(moment(_0xe237ba['$lte'])[_0xb880('0x12')](_0xb880('0x14')))[_0xb880('0x13')]()[_0xb880('0x15')](0x1,'s')[_0xb880('0x12')]()};_0x55a1ac[_0x49c309]=_0x29a7ec;}else if(_0x18217c[_0xb880('0x16')]===_0xb880('0x17')){_0x55a1ac[_0x49c309]=_0x29d5b6;}else{_0x55a1ac[_0x49c309]=_[_0xb880('0x18')](_0x29d5b6)?_0x29d5b6:JSON[_0xb880('0x4')](_0x29d5b6);}}else{_0x55a1ac[_0x49c309]=_[_0xb880('0x18')](_0x29d5b6)?_0x29d5b6:JSON[_0xb880('0x4')](_0x29d5b6);}}catch(_0x2c3d7f){_0x55a1ac[_0x49c309]=_0x29d5b6[_0xb880('0x9')](',');}});}return _0x55a1ac;};exports[_0xb880('0x19')]=function(_0x1a12c9){_0x1a12c9=parseInt(_0x1a12c9,0xa);if(!_0x1a12c9||_0x1a12c9<0x0){_0x1a12c9=LIMIT_VALUE;}return _0x1a12c9;};exports[_0xb880('0x1a')]=function(_0x2729fe){_0x2729fe=parseInt(_0x2729fe,0xa);if(!_0x2729fe||_0x2729fe<0x0){_0x2729fe=0x0;}return _0x2729fe;};exports['sort']=function(_0xae90a9){var _0x45fd2f,_0x238e27=null;if(_0xae90a9){_0x45fd2f=_0xae90a9[_0xb880('0x9')](',');_0x238e27=_[_0xb880('0x1b')](_0x45fd2f,function(_0x126cbb){if(_0x126cbb['indexOf']('-')===0x0){return[_0x126cbb===_0xb880('0x1c')?sequelize[_0xb880('0x1d')](sequelize['col'](_0xb880('0x1c')),_0xb880('0x1e')):_0x126cbb[_0xb880('0x1f')](0x1),_0xb880('0x20')];}else{return[_0x126cbb===_0xb880('0x1c')?sequelize[_0xb880('0x1d')](sequelize[_0xb880('0x21')]('priority'),_0xb880('0x1e')):_0x126cbb,'ASC'];}});}return _0x238e27;};exports[_0xb880('0x22')]=function(_0x405a5c,_0x42cc3f){if(_[_0xb880('0xb')](_0x405a5c)){return _0x405a5c;}if(_[_0xb880('0x18')](_0x405a5c)){for(var _0x138460=0x0;_0x138460<_0x405a5c[_0xb880('0x23')];_0x138460+=0x1){_0x405a5c[_0x138460]=this[_0xb880('0x22')](_0x405a5c[_0x138460],_0x42cc3f);}return _0x405a5c;}if(!_[_0xb880('0x24')](_0x405a5c)){return _0x405a5c;}if(_[_0xb880('0x25')](_0x42cc3f)){_0x42cc3f=[_0x42cc3f];}if(!_[_0xb880('0x18')](_0x42cc3f)){return _0x405a5c;}for(var _0x3f131a=0x0;_0x3f131a<_0x42cc3f[_0xb880('0x23')];_0x3f131a+=0x1){_[_0xb880('0x26')](_0x405a5c,_0x42cc3f[_0x3f131a]);}for(var _0x2d62d2 in _0x405a5c){if(_0x405a5c[_0xb880('0x27')](_0x2d62d2)){_0x405a5c[_0x2d62d2]=this[_0xb880('0x22')](_0x405a5c[_0x2d62d2],_0x42cc3f);}}return _0x405a5c;};exports[_0xb880('0x28')]=function(_0x2939d){return _0x2939d[_0xb880('0x29')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xb880('0x2a')]=function(_0x229194){return _0x229194[_0xb880('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0xb880('0x2b')]=function(_0x59404e,_0x3ae4ac){var _0x3a7b6b=[];var _0x12fce2=/([^:]")"+/g;var _0x1210c9=/[*<>~@-]/g;var _0x5d3560=/[ `!@#$%^&*()_\-?~<>]/;var _0x531d71=/[ ,]+/;var _0x34fb3c=_0x3ae4ac?_0xb880('0x2c'):'{EXPR}';if(_0x3ae4ac){_0x59404e=_0x59404e[_0xb880('0x2d')](_0x1210c9,'\x20')['trim']();}_0x59404e[_0xb880('0x9')](_0x531d71)[_0xb880('0x2e')](function(_0x5c4cd8){_0x5c4cd8=_0x5c4cd8['replace'](_0x12fce2,'$1');_0x5c4cd8='+'+_0x5c4cd8+'*';var _0x33a118=_0x5c4cd8[_0xb880('0x29')](_0x5d3560);if(_0x33a118){_0x5c4cd8='\x22'+_0x5c4cd8+'\x22';}_0x3a7b6b[_0xb880('0x2f')](_0x5c4cd8);});_0x34fb3c=_0x34fb3c[_0xb880('0x2d')](_0xb880('0x30'),_0x3a7b6b['join']('\x20'));return _0x34fb3c;};exports['getOptions']=function(_0x2cadbc,_0x5e7003,_0x1b16b8){var _0x1b8380={},_0x182767={};if(_0x5e7003[_0xb880('0x31')][_0xb880('0x32')]){_0x5e7003[_0xb880('0x31')]['id']=_0x5e7003[_0xb880('0x31')][_0xb880('0x32')];delete _0x5e7003['query'][_0xb880('0x32')];}_0x1b8380[_0xb880('0x7')]=_[_0xb880('0x1b')](_0x2cadbc,_0xb880('0x16'));_0x1b8380['query']=_[_0xb880('0x5')](_0x5e7003[_0xb880('0x31')]);_0x1b8380[_0xb880('0xa')]=_[_0xb880('0x33')](_0x1b8380[_0xb880('0x7')],_0x1b8380[_0xb880('0x31')]);_0x182767['attributes']=_['intersection'](_0x1b8380[_0xb880('0x7')],this[_0xb880('0x34')](_0x5e7003[_0xb880('0x31')][_0xb880('0x34')]));_0x182767['attributes']=_0x182767['attributes']['length']?_0x182767[_0xb880('0x35')]:_0x1b8380['model'];if(!_0x5e7003['query']['hasOwnProperty']('nolimit')){_0x182767[_0xb880('0x19')]=this[_0xb880('0x19')](_0x5e7003['query']['limit']);_0x182767[_0xb880('0x1a')]=this[_0xb880('0x1a')](_0x5e7003[_0xb880('0x31')][_0xb880('0x1a')]);}_0x182767[_0xb880('0x36')]=this[_0xb880('0x37')](_0x5e7003['query'][_0xb880('0x37')]);_0x182767['where']=this[_0xb880('0xa')](_[_0xb880('0x38')](_0x5e7003[_0xb880('0x31')],_0x1b8380[_0xb880('0xa')]),_0x2cadbc);if(_0x5e7003[_0xb880('0x31')][_0xb880('0x39')]){var _0xd9d114=_0x2cadbc;var _0x4ce13c=_0x5e7003[_0xb880('0x31')][_0xb880('0x39')];if(typeof _0x4ce13c===_0xb880('0x3a')){_0xd9d114=_['filter'](_0x2cadbc,function(_0x6a6482){return _['includes'](_0x4ce13c[_0xb880('0x3b')],_0x6a6482[_0xb880('0x16')]);});_0x4ce13c=_0x4ce13c[_0xb880('0x3c')];}_0x182767['where']=_['merge'](_0x182767[_0xb880('0x3d')],{'$or':_[_0xb880('0x1b')](_0xd9d114,function(_0x1918e5){if(_0x1918e5['type']!=='VIRTUAL'){if(_0x1b16b8){return sequelize['where'](sequelize['fn'](_0xb880('0x3e'),sequelize['col'](_0x1918e5[_0xb880('0x16')])),{'$like':sequelize['fn'](_0xb880('0x3e'),'%'+_0x5e7003['query']['filter']+'%')});}else{var _0x805834={};_0x805834[_0x1918e5[_0xb880('0x16')]]={'$like':'%'+_0x5e7003['query'][_0xb880('0x39')]+'%'};return _0x805834;}}})});}_0x182767=_[_0xb880('0x3f')]({},_0x182767,_0x5e7003[_0xb880('0x40')]);return _0x182767;};exports[_0xb880('0x41')]=function(_0x71cdb){var _0x5b7a6e=[];if(_0x71cdb['includeAll']){_0x5b7a6e[_0xb880('0x2f')]({'all':!![]});}else if(_0x71cdb[_0xb880('0x41')]){if(Array[_0xb880('0x18')](_0x71cdb[_0xb880('0x41')])){_0x5b7a6e=Object[_0xb880('0x5')](_0x71cdb[_0xb880('0x41')])['map'](function(_0x3de5cd){return parseIncludeModel(_0x71cdb[_0xb880('0x41')][_0x3de5cd]);});}else{var _0x165d4c=parseIncludeModel(_0x71cdb[_0xb880('0x41')]);_0x5b7a6e[_0xb880('0x2f')](_0x165d4c);}}return _0x5b7a6e;};exports[_0xb880('0x42')]=function(_0x51aa53){return _0x51aa53[_0xb880('0x2d')](/[%_^-]/g,function(_0x2b58f3){return'\x5c'+_0x2b58f3;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 035604d..a52fc4f 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ae9=['merge','globalStatus','getSortedAgentsIdsByStatus','fields','order','DESC','ASC','fullname,internal','fullname','internal','substring','indexOf','sort','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus','openchannelStatusTime','mailStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','omit','pick','whatsappStatusTime','chatCapacity','smsCapacity','chatCurrentCapacity','mailCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','client','http','faxPause','mailPause','openchannelPause','smsPause','voicePause','filter','length','idle','unknown','unavailable','ringing','voiceStatus','every','chatStatus','faxStatus','openchannelStatus','smsStatus','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','catch','pause','*pause','getAgentStatus','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','findAll','name','chatPause','whatsappPause'];(function(_0x145fcb,_0x2cc29c){var _0x24d908=function(_0xc6803){while(--_0xc6803){_0x145fcb['push'](_0x145fcb['shift']());}};_0x24d908(++_0x2cc29c);}(_0x5ae9,0x19b));var _0x95ae=function(_0x4ed9c9,_0x1b9648){_0x4ed9c9=_0x4ed9c9-0x0;var _0x591fc0=_0x5ae9[_0x4ed9c9];return _0x591fc0;};'use strict';var _=require(_0x95ae('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x95ae('0x1')][_0x95ae('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0x95ae('0x2')]({'port':0x232c});function isAgentPaused(_0x43c580,_0x559cb2){var _0x22469d=[_0x43c580['chatPause'],_0x43c580[_0x95ae('0x3')],_0x43c580[_0x95ae('0x4')],_0x43c580[_0x95ae('0x5')],_0x43c580[_0x95ae('0x6')],_0x43c580[_0x95ae('0x7')],_0x43c580['whatsappPause']];if(!_0x559cb2)return _['every'](_0x22469d);var _0x19ba28=_[_0x95ae('0x8')](_0x22469d);return _0x19ba28[_0x95ae('0x9')]>0x0&&_0x19ba28[_0x95ae('0x9')]<_0x22469d['length']?!![]:![];}function isIdle(_0x47c902){return _0x47c902===_0x95ae('0xa')||_0x47c902===_0x95ae('0xb')||_0x47c902===_0x95ae('0xc')||_0x47c902===_0x95ae('0xd')||_['isNil'](_0x47c902);}function isAgentIdle(_0x50c18a){if(_0x50c18a[_0x95ae('0xe')]!=='idle'&&_0x50c18a[_0x95ae('0x7')]){_0x50c18a[_0x95ae('0xe')]='pause';return![];}return _[_0x95ae('0xf')]([_0x50c18a[_0x95ae('0x10')],_0x50c18a[_0x95ae('0x11')],_0x50c18a['mailStatus'],_0x50c18a[_0x95ae('0x12')],_0x50c18a[_0x95ae('0x13')],_0x50c18a[_0x95ae('0xe')],_0x50c18a['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x95ae('0x14')]('Agents',{})[_0x95ae('0x15')](function(_0x57bd67){if(_0x57bd67[_0x95ae('0x16')]){throw new Error(_0x95ae('0x17'));}var _0x3fc518=_0x57bd67[_0x95ae('0x18')];return routingClient[_0x95ae('0x14')](_0x95ae('0x19'),{})[_0x95ae('0x15')](function(_0x24d5d2){if(_0x24d5d2[_0x95ae('0x16')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4ef50f=_0x24d5d2[_0x95ae('0x18')];return _['merge']({},_0x3fc518,_0x4ef50f);});})[_0x95ae('0x1a')](function(_0x13d7a7){throw _0x13d7a7;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x4daf55){var _0x2649c4=_0x95ae('0xb');if(isAgentPaused(_0x4daf55))_0x2649c4=_0x95ae('0x1b');else if(isAgentPaused(_0x4daf55,!![]))_0x2649c4=_0x95ae('0x1c');else if(isAgentIdle(_0x4daf55))_0x2649c4=_0x95ae('0xa');else _0x2649c4='busy';return _0x2649c4;}exports[_0x95ae('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x457324,_0x1ecde4){var _0x2ad155=_['isArray'](_0x457324)?_0x457324:[_0x457324];var _0x176780=_['startCase'](_0x1ecde4)+_0x95ae('0x1e');var _0x59f88a=_[_0x95ae('0x1f')](_0x2ad155,function(_0x199c68){return db[_0x176780][_0x95ae('0x20')]({'where':{'id':_0x199c68}})['then'](function(_0xdc8e7e){if(!_0xdc8e7e)return[];return _0xdc8e7e[_0x95ae('0x21')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x95ae('0x22')](_0x59f88a)[_0x95ae('0x15')](function(_0x36351e){var _0x4d24a6=_(_0x36351e)[_0x95ae('0x23')]()[_0x95ae('0x1f')]('id')[_0x95ae('0x24')]()[_0x95ae('0x25')]();return _0x4d24a6;});}exports[_0x95ae('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x51ba5d,_0x46b590,_0x4d1708){try{if(_0x46b590[_0x95ae('0x9')]>0x0){_0x51ba5d=_0x51ba5d[_0x95ae('0x8')](function(_0x611fca){return _0x46b590[_0x95ae('0x27')](_0x611fca['id']);});}var _0x4fa625=_0x51ba5d[_0x95ae('0x8')](function(_0x2751c9){var _0x2e0b58='busy';if(isAgentIdle(_0x2751c9)){_0x2e0b58=_0x95ae('0xa');}return _0x2e0b58===_0x4d1708;});return _['map'](_0x4fa625,'id');}catch(_0x4c44f4){throw _0x4c44f4;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1820b4,_0x1e893e,_0x1719e6){return Promise['resolve']()[_0x95ae('0x15')](function(){if(_0x1e893e['length']>0x0){_0x1820b4=_0x1820b4[_0x95ae('0x8')](function(_0x5ac97){return _0x1e893e['includes'](_0x5ac97['id']);});}return _0x1820b4;})[_0x95ae('0x15')](function(){return db['User'][_0x95ae('0x28')]({'attributes':['id',_0x95ae('0x29'),'fullname',_0x95ae('0x2a'),_0x95ae('0x3'),_0x95ae('0x4'),_0x95ae('0x5'),_0x95ae('0x6'),_0x95ae('0x7'),_0x95ae('0x2b'),'pauseType'],'where':{'id':{'$in':_['map'](_0x1820b4,'id')}},'raw':!![]});})[_0x95ae('0x15')](function(_0x2aa190){return _0x2aa190[_0x95ae('0x1f')](function(_0x1ae7b0){var _0x3f7585=_['find'](_0x1820b4,['id',_0x1ae7b0['id']]);var _0x140a4d=filterAgentAttributes(_0x3f7585);_[_0x95ae('0x2c')](_0x1ae7b0,_0x140a4d);_0x1ae7b0[_0x95ae('0x2d')]=getAgentStatus(_0x1ae7b0);return _0x1ae7b0;});})[_0x95ae('0x15')](function(_0x26a3de){var _0x45cde9=sortAgentsByStatus(_0x26a3de,_0x1719e6);return _['map'](_0x45cde9,'id');})[_0x95ae('0x1a')](function(_0x43c830){throw _0x43c830;});}exports[_0x95ae('0x2e')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3262b1){var _0x48575f={'fields':[],'order':null};var _0x20a0cc=_0x3262b1['split'](',');_0x48575f[_0x95ae('0x2f')]=_[_0x95ae('0x8')](_0x20a0cc,function(_0x6fa9b5){if(!_0x6fa9b5[_0x95ae('0x27')](_0x95ae('0x2d'))){return!![];}_0x48575f[_0x95ae('0x30')]=_['startsWith'](_0x6fa9b5,'-')?_0x95ae('0x31'):_0x95ae('0x32');return![];});return _0x48575f;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x52ee88){if(!_0x52ee88){_0x52ee88=_0x95ae('0x33');}if(_0x52ee88[_0x95ae('0x27')](_0x95ae('0x34'))&&!_0x52ee88['includes'](_0x95ae('0x35'))){var _0x1763d7=_0x52ee88[_0x95ae('0x36')](0x0,_0x52ee88[_0x95ae('0x37')](_0x95ae('0x34')));_0x52ee88+=','+_0x1763d7+_0x95ae('0x35');}return _0x52ee88;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x3a3923,_0x39941f){var _0x29bba6=_0x3a3923[_0x95ae('0x38')](function(_0x198350,_0xf41d5b){if(_0x198350[_0x95ae('0x2d')]===_0xf41d5b['globalStatus']){if(_0x198350[_0x95ae('0x2d')]===_0x95ae('0x1b')){if(_0x39941f===_0x95ae('0x31')){return(_0x198350[_0x95ae('0x39')]||'')<(_0xf41d5b[_0x95ae('0x39')]||'')||_0x198350['fullname']['toLowerCase']()>_0xf41d5b[_0x95ae('0x34')][_0x95ae('0x3a')]()?0x1:-0x1;}else{return(_0x198350[_0x95ae('0x39')]||'')<(_0xf41d5b[_0x95ae('0x39')]||'')||_0x198350['fullname']['toLowerCase']()>_0xf41d5b['fullname'][_0x95ae('0x3a')]()?-0x1:0x1;}}else{if(_0x39941f==='DESC'){return _0x198350['fullname'][_0x95ae('0x3a')]()<_0xf41d5b[_0x95ae('0x34')]['toLowerCase']()?0x1:-0x1;}else{return _0x198350[_0x95ae('0x34')][_0x95ae('0x3a')]()<_0xf41d5b[_0x95ae('0x34')][_0x95ae('0x3a')]()?-0x1:0x1;}}}else{if(_0x39941f==='DESC'){return _0x198350[_0x95ae('0x2d')]<_0xf41d5b[_0x95ae('0x2d')]?0x1:-0x1;}else{return _0x198350[_0x95ae('0x2d')]<_0xf41d5b['globalStatus']?-0x1:0x1;}}});return _0x29bba6;}exports[_0x95ae('0x3b')]=sortAgentsByStatus;function filterAgentAttributes(_0xe12c05){var _0x13b1d4=[_0x95ae('0x3c'),_0x95ae('0x3d'),_0x95ae('0x3e'),_0x95ae('0x3f'),_0x95ae('0x39'),_0x95ae('0x3f'),'internal',_0x95ae('0x40'),'chatPause',_0x95ae('0x5'),_0x95ae('0x4'),_0x95ae('0x6'),'whatsappPause',_0x95ae('0x3'),_0x95ae('0x7'),'chatCapacity',_0x95ae('0x41'),_0x95ae('0x42'),'smsCapacity',_0x95ae('0x43'),_0x95ae('0x44'),'chatCurrentCapacity',_0x95ae('0x45'),'mailCurrentCapacity',_0x95ae('0x46'),_0x95ae('0x47'),_0x95ae('0x48'),'chatStatus',_0x95ae('0x12'),_0x95ae('0x49'),'smsStatus',_0x95ae('0x4a'),_0x95ae('0x11'),'voiceStatus','chatStatusTime',_0x95ae('0x4b'),_0x95ae('0x4c'),'smsStatusTime','whatsappStatusTime','faxStatusTime',_0x95ae('0x4d'),_0x95ae('0x4e'),_0x95ae('0x4f'),_0x95ae('0x50'),_0x95ae('0x51'),'phoneBarEnableAutomaticScreenRecording'];var _0x38c5b0=[_0x95ae('0x2a'),_0x95ae('0x5'),_0x95ae('0x4'),'smsPause',_0x95ae('0x2b'),_0x95ae('0x3'),'voicePause',_0x95ae('0x3d')];var _0x56ebb4=_(_0xe12c05)[_0x95ae('0x52')](_0x38c5b0)[_0x95ae('0x53')](_0x13b1d4)[_0x95ae('0x25')]();return _0x56ebb4;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x95ae('0x29'),_0x95ae('0x34'),'role',_0x95ae('0x35'),_0x95ae('0x3d'),'globalStatus',_0x95ae('0x3c'),'lastLoginAt',_0x95ae('0x39'),_0x95ae('0x3f'),_0x95ae('0x3'),'chatPause',_0x95ae('0x4'),_0x95ae('0x5'),_0x95ae('0x6'),_0x95ae('0x7'),'whatsappPause','chatStatus',_0x95ae('0x11'),_0x95ae('0x49'),_0x95ae('0x12'),_0x95ae('0x13'),'voiceStatus','whatsappStatus','chatStatusTime','faxStatusTime',_0x95ae('0x4c'),_0x95ae('0x4b'),'smsStatusTime','voiceStatusTime',_0x95ae('0x54'),_0x95ae('0x55'),_0x95ae('0x44'),_0x95ae('0x42'),_0x95ae('0x41'),_0x95ae('0x56'),_0x95ae('0x43'),_0x95ae('0x57'),'faxCurrentCapacity',_0x95ae('0x58'),_0x95ae('0x45'),_0x95ae('0x46'),'whatsappCurrentCapacity',_0x95ae('0x51'),'phoneBarEnableAutomaticScreenRecording',_0x95ae('0x4f'),_0x95ae('0x59'),_0x95ae('0x4e'),_0x95ae('0x50')];}exports[_0x95ae('0x5a')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xf470=['split','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','fullname','internal','substring','indexOf','validateSortParameter','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick','filterAgentAttributes','name','whatsappStatusTime','chatCapacity','mailCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','merge','catch','getRealtimeAgents','*pause','isArray','startCase','Queue','map','getAgents','all','flatten','value','getAgentIdsByQueues','includes','busy','getAgentIdsByStatus','resolve','then','User','pauseType','globalStatus','getSortedAgentsIdsByStatus'];(function(_0x71cc1,_0x252833){var _0x16d5a4=function(_0x2c36fe){while(--_0x2c36fe){_0x71cc1['push'](_0x71cc1['shift']());}};_0x16d5a4(++_0x252833);}(_0xf470,0xfd));var _0x0f47=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xf470[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x0f47('0x0'));var jayson=require(_0x0f47('0x1'));var db=require(_0x0f47('0x2'))['db'];var amiClient=jayson[_0x0f47('0x3')][_0x0f47('0x4')]({'port':0x232a});var routingClient=jayson[_0x0f47('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x8fd765,_0x3e20a3){var _0x493828=[_0x8fd765[_0x0f47('0x5')],_0x8fd765[_0x0f47('0x6')],_0x8fd765[_0x0f47('0x7')],_0x8fd765[_0x0f47('0x8')],_0x8fd765[_0x0f47('0x9')],_0x8fd765[_0x0f47('0xa')],_0x8fd765[_0x0f47('0xb')]];if(!_0x3e20a3)return _[_0x0f47('0xc')](_0x493828);var _0x145344=_[_0x0f47('0xd')](_0x493828);return _0x145344[_0x0f47('0xe')]>0x0&&_0x145344[_0x0f47('0xe')]<_0x493828[_0x0f47('0xe')]?!![]:![];}function isIdle(_0x2256e5){return _0x2256e5===_0x0f47('0xf')||_0x2256e5===_0x0f47('0x10')||_0x2256e5===_0x0f47('0x11')||_0x2256e5===_0x0f47('0x12')||_[_0x0f47('0x13')](_0x2256e5);}function isAgentIdle(_0x4bfa8f){if(_0x4bfa8f[_0x0f47('0x14')]!==_0x0f47('0xf')&&_0x4bfa8f[_0x0f47('0xa')]){_0x4bfa8f[_0x0f47('0x14')]=_0x0f47('0x15');return![];}return _['every']([_0x4bfa8f['chatStatus'],_0x4bfa8f[_0x0f47('0x16')],_0x4bfa8f[_0x0f47('0x17')],_0x4bfa8f[_0x0f47('0x18')],_0x4bfa8f[_0x0f47('0x19')],_0x4bfa8f[_0x0f47('0x14')],_0x4bfa8f['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x0f47('0x1a')]('Agents',{})['then'](function(_0x1e08f6){if(_0x1e08f6[_0x0f47('0x1b')]){throw new Error(_0x0f47('0x1c'));}var _0x1e84eb=_0x1e08f6[_0x0f47('0x1d')];return routingClient[_0x0f47('0x1a')](_0x0f47('0x1e'),{})['then'](function(_0x1d8fe5){if(_0x1d8fe5[_0x0f47('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x22c861=_0x1d8fe5[_0x0f47('0x1d')];return _[_0x0f47('0x1f')]({},_0x1e84eb,_0x22c861);});})[_0x0f47('0x20')](function(_0x22615b){throw _0x22615b;});}exports[_0x0f47('0x21')]=getRealtimeAgents;function getAgentStatus(_0x222831){var _0x160283=_0x0f47('0x10');if(isAgentPaused(_0x222831))_0x160283=_0x0f47('0x15');else if(isAgentPaused(_0x222831,!![]))_0x160283=_0x0f47('0x22');else if(isAgentIdle(_0x222831))_0x160283='idle';else _0x160283='busy';return _0x160283;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x1fe6ea,_0x5a0c8c){var _0x5f1830=_[_0x0f47('0x23')](_0x1fe6ea)?_0x1fe6ea:[_0x1fe6ea];var _0x19d346=_[_0x0f47('0x24')](_0x5a0c8c)+_0x0f47('0x25');var _0x28edc5=_[_0x0f47('0x26')](_0x5f1830,function(_0x2a7f9e){return db[_0x19d346]['findOne']({'where':{'id':_0x2a7f9e}})['then'](function(_0x165f4f){if(!_0x165f4f)return[];return _0x165f4f[_0x0f47('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x0f47('0x28')](_0x28edc5)['then'](function(_0x365482){var _0x41a31e=_(_0x365482)[_0x0f47('0x29')]()[_0x0f47('0x26')]('id')['uniq']()[_0x0f47('0x2a')]();return _0x41a31e;});}exports[_0x0f47('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x44c56d,_0x401aea,_0x19e916){try{if(_0x401aea[_0x0f47('0xe')]>0x0){_0x44c56d=_0x44c56d[_0x0f47('0xd')](function(_0xd47c98){return _0x401aea[_0x0f47('0x2c')](_0xd47c98['id']);});}var _0x2648f1=_0x44c56d[_0x0f47('0xd')](function(_0x3a3687){var _0x4ff1ef=_0x0f47('0x2d');if(isAgentIdle(_0x3a3687)){_0x4ff1ef=_0x0f47('0xf');}return _0x4ff1ef===_0x19e916;});return _[_0x0f47('0x26')](_0x2648f1,'id');}catch(_0x1a0d44){throw _0x1a0d44;}}exports[_0x0f47('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x49c679,_0x9970a5,_0x3e62a4){return Promise[_0x0f47('0x2f')]()['then'](function(){if(_0x9970a5[_0x0f47('0xe')]>0x0){_0x49c679=_0x49c679[_0x0f47('0xd')](function(_0x465b62){return _0x9970a5[_0x0f47('0x2c')](_0x465b62['id']);});}return _0x49c679;})[_0x0f47('0x30')](function(){return db[_0x0f47('0x31')]['findAll']({'attributes':['id','name','fullname',_0x0f47('0x5'),'faxPause',_0x0f47('0x7'),'openchannelPause',_0x0f47('0x9'),_0x0f47('0xa'),_0x0f47('0xb'),_0x0f47('0x32')],'where':{'id':{'$in':_['map'](_0x49c679,'id')}},'raw':!![]});})[_0x0f47('0x30')](function(_0xee9cd){return _0xee9cd[_0x0f47('0x26')](function(_0x164175){var _0x38a3ce=_['find'](_0x49c679,['id',_0x164175['id']]);var _0x1c4e1a=filterAgentAttributes(_0x38a3ce);_[_0x0f47('0x1f')](_0x164175,_0x1c4e1a);_0x164175[_0x0f47('0x33')]=getAgentStatus(_0x164175);return _0x164175;});})[_0x0f47('0x30')](function(_0x2fc8a3){var _0x47cf68=sortAgentsByStatus(_0x2fc8a3,_0x3e62a4);return _['map'](_0x47cf68,'id');})['catch'](function(_0x4081d2){throw _0x4081d2;});}exports[_0x0f47('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x419e5c){var _0x58c7bc={'fields':[],'order':null};var _0x124289=_0x419e5c[_0x0f47('0x35')](',');_0x58c7bc['fields']=_['filter'](_0x124289,function(_0x497833){if(!_0x497833[_0x0f47('0x2c')]('globalStatus')){return!![];}_0x58c7bc[_0x0f47('0x36')]=_[_0x0f47('0x37')](_0x497833,'-')?'DESC':_0x0f47('0x38');return![];});return _0x58c7bc;}exports[_0x0f47('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x13e77b){if(!_0x13e77b){_0x13e77b=_0x0f47('0x3a');}if(_0x13e77b[_0x0f47('0x2c')](_0x0f47('0x3b'))&&!_0x13e77b[_0x0f47('0x2c')](_0x0f47('0x3c'))){var _0x524ee3=_0x13e77b[_0x0f47('0x3d')](0x0,_0x13e77b[_0x0f47('0x3e')](_0x0f47('0x3b')));_0x13e77b+=','+_0x524ee3+_0x0f47('0x3c');}return _0x13e77b;}exports[_0x0f47('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x266e16,_0x5c85a7){var _0x339282=_0x266e16['sort'](function(_0x32eb09,_0x1753be){if(_0x32eb09['globalStatus']===_0x1753be[_0x0f47('0x33')]){if(_0x32eb09[_0x0f47('0x33')]===_0x0f47('0x15')){if(_0x5c85a7===_0x0f47('0x40')){return(_0x32eb09[_0x0f47('0x32')]||'')<(_0x1753be['pauseType']||'')||_0x32eb09['fullname'][_0x0f47('0x41')]()>_0x1753be[_0x0f47('0x3b')][_0x0f47('0x41')]()?0x1:-0x1;}else{return(_0x32eb09[_0x0f47('0x32')]||'')<(_0x1753be[_0x0f47('0x32')]||'')||_0x32eb09[_0x0f47('0x3b')][_0x0f47('0x41')]()>_0x1753be['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x5c85a7===_0x0f47('0x40')){return _0x32eb09[_0x0f47('0x3b')][_0x0f47('0x41')]()<_0x1753be['fullname'][_0x0f47('0x41')]()?0x1:-0x1;}else{return _0x32eb09[_0x0f47('0x3b')][_0x0f47('0x41')]()<_0x1753be[_0x0f47('0x3b')][_0x0f47('0x41')]()?-0x1:0x1;}}}else{if(_0x5c85a7===_0x0f47('0x40')){return _0x32eb09[_0x0f47('0x33')]<_0x1753be[_0x0f47('0x33')]?0x1:-0x1;}else{return _0x32eb09[_0x0f47('0x33')]<_0x1753be['globalStatus']?-0x1:0x1;}}});return _0x339282;}exports[_0x0f47('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x2e975c){var _0x2bddb2=[_0x0f47('0x43'),_0x0f47('0x44'),_0x0f47('0x45'),_0x0f47('0x46'),_0x0f47('0x32'),_0x0f47('0x46'),'internal','address',_0x0f47('0x5'),_0x0f47('0x8'),_0x0f47('0x7'),_0x0f47('0x9'),_0x0f47('0xb'),_0x0f47('0x6'),_0x0f47('0xa'),'chatCapacity',_0x0f47('0x47'),_0x0f47('0x48'),_0x0f47('0x49'),_0x0f47('0x4a'),_0x0f47('0x4b'),_0x0f47('0x4c'),_0x0f47('0x4d'),'mailCurrentCapacity',_0x0f47('0x4e'),_0x0f47('0x4f'),_0x0f47('0x50'),_0x0f47('0x51'),'openchannelStatus',_0x0f47('0x17'),_0x0f47('0x19'),_0x0f47('0x52'),_0x0f47('0x16'),_0x0f47('0x14'),_0x0f47('0x53'),_0x0f47('0x54'),_0x0f47('0x55'),_0x0f47('0x56'),'whatsappStatusTime',_0x0f47('0x57'),_0x0f47('0x58'),_0x0f47('0x59'),_0x0f47('0x5a'),_0x0f47('0x5b'),_0x0f47('0x5c'),_0x0f47('0x5d')];var _0x40eef6=[_0x0f47('0x5'),_0x0f47('0x8'),_0x0f47('0x7'),_0x0f47('0x9'),_0x0f47('0xb'),'faxPause',_0x0f47('0xa'),_0x0f47('0x44')];var _0x16f210=_(_0x2e975c)['omit'](_0x40eef6)[_0x0f47('0x5e')](_0x2bddb2)[_0x0f47('0x2a')]();return _0x16f210;}exports[_0x0f47('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x0f47('0x60'),_0x0f47('0x3b'),'role',_0x0f47('0x3c'),'online',_0x0f47('0x33'),_0x0f47('0x43'),_0x0f47('0x45'),_0x0f47('0x32'),_0x0f47('0x46'),_0x0f47('0x6'),'chatPause','mailPause',_0x0f47('0x8'),'smsPause',_0x0f47('0xa'),_0x0f47('0xb'),_0x0f47('0x51'),'faxStatus','mailStatus','openchannelStatus','smsStatus','voiceStatus',_0x0f47('0x52'),_0x0f47('0x53'),_0x0f47('0x57'),_0x0f47('0x55'),'openchannelStatusTime',_0x0f47('0x56'),'voiceStatusTime',_0x0f47('0x61'),_0x0f47('0x62'),_0x0f47('0x4b'),_0x0f47('0x48'),_0x0f47('0x47'),_0x0f47('0x49'),_0x0f47('0x4a'),_0x0f47('0x4c'),_0x0f47('0x50'),_0x0f47('0x63'),_0x0f47('0x4d'),_0x0f47('0x4e'),_0x0f47('0x4f'),_0x0f47('0x5c'),'phoneBarEnableAutomaticScreenRecording',_0x0f47('0x5a'),_0x0f47('0x64'),_0x0f47('0x59'),_0x0f47('0x5b')];}exports[_0x0f47('0x65')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 16ab9a1..2158e8c 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d49=['format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','concat','outbound','map','available','talking','pTalking','find','pick','lodash','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','unknown','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error'];(function(_0x405c74,_0x26cf4d){var _0x51b8de=function(_0x285556){while(--_0x285556){_0x405c74['push'](_0x405c74['shift']());}};_0x51b8de(++_0x26cf4d);}(_0x6d49,0xdc));var _0x96d4=function(_0x2ec729,_0x5adf4b){_0x2ec729=_0x2ec729-0x0;var _0x4a03af=_0x6d49[_0x2ec729];return _0x4a03af;};'use strict';var _=require(_0x96d4('0x0'));var jayson=require(_0x96d4('0x1'));var util=require(_0x96d4('0x2'));var amiClient=jayson[_0x96d4('0x3')][_0x96d4('0x4')]({'port':0x232a});var routingClient=jayson[_0x96d4('0x3')][_0x96d4('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x96d4('0x5'),_0x96d4('0x6'),_0x96d4('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x96d4('0x8'),_0x96d4('0x9'),_0x96d4('0xa'),_0x96d4('0xb'),_0x96d4('0xc'),_0x96d4('0xd'),_0x96d4('0xe'),'ringInUse','talking','unavailable',_0x96d4('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x96d4('0x10'),_0x96d4('0x11'),_0x96d4('0x12'),_0x96d4('0x13'),_0x96d4('0x14'),_0x96d4('0x15'),_0x96d4('0x16'),_0x96d4('0x17'),_0x96d4('0x18'),'erlangCallToSecond',_0x96d4('0x19'),_0x96d4('0x1a'),_0x96d4('0x1b'),_0x96d4('0x1c'),_0x96d4('0x1d'),_0x96d4('0x1e'),_0x96d4('0x1f'),'predictiveIntervalAnsweredCalls',_0x96d4('0x20'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x96d4('0x21')];function getRealtimeQueues(_0x423a81,_0x363451){var _0x4c4b6a=_0x363451===_0x96d4('0x22')?amiClient:routingClient;return _0x4c4b6a[_0x96d4('0x23')](_[_0x96d4('0x24')](_0x363451)+_0x96d4('0x25'),_0x423a81)[_0x96d4('0x26')](function(_0xc4f428){if(_0xc4f428[_0x96d4('0x27')])throw new Error(util[_0x96d4('0x28')](_0x96d4('0x29'),_0x363451));return _0xc4f428[_0x96d4('0x2a')];})['catch'](function(_0x2436b4){throw _0x2436b4;});}exports[_0x96d4('0x2b')]=getRealtimeQueues;function initializeQueues(_0x155a90,_0x329cb8,_0x3bdd56,_0x2d3b4c){var _0x24f47d=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3bdd56==='voice'){if(_0x2d3b4c==='inbound'){_0x24f47d=_0x24f47d[_0x96d4('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2d3b4c===_0x96d4('0x2d')){_0x24f47d=_0x24f47d[_0x96d4('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x155a90[_0x96d4('0x2e')](function(_0x5859f5){var _0x526231=_0x5859f5['get']({'plain':!![]});_0x526231['paused']=0x0;_0x526231[_0x96d4('0xb')]=0x0;_0x526231['loggedIn']=0x0;_0x526231[_0x96d4('0x2f')]=0x0;_0x526231[_0x96d4('0x7')]=0x0;if(_0x3bdd56===_0x96d4('0x22')){_0x526231[_0x96d4('0x30')]=0x0;_0x526231[_0x96d4('0x8')]=0x0;if(_0x2d3b4c===_0x96d4('0x2d')){_0x526231[_0x96d4('0x31')]=0x0;_0x526231[_0x96d4('0x10')]=0x0;}}var _0x3b8e0d=_[_0x96d4('0x32')](_0x329cb8,['id',_0x526231['id']]);if(_0x3b8e0d){_['merge'](_0x526231,_[_0x96d4('0x33')](_0x3b8e0d,_0x24f47d));}return _0x526231;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x13e0=['waiting','talking','outbound','find','merge','pick','lodash','jayson/promise','client','http','available','paused','busy','inUse','invalid','loggedInDb','onHold','ringing','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','error','format','result','catch','getRealtimeQueues','concat','loggedIn'];(function(_0x50570c,_0x51597d){var _0x46e42a=function(_0x4edc83){while(--_0x4edc83){_0x50570c['push'](_0x50570c['shift']());}};_0x46e42a(++_0x51597d);}(_0x13e0,0x192));var _0x013e=function(_0x3c43a9,_0x50b5a5){_0x3c43a9=_0x3c43a9-0x0;var _0x24d156=_0x13e0[_0x3c43a9];return _0x24d156;};'use strict';var _=require(_0x013e('0x0'));var jayson=require(_0x013e('0x1'));var util=require('util');var amiClient=jayson[_0x013e('0x2')][_0x013e('0x3')]({'port':0x232a});var routingClient=jayson[_0x013e('0x2')][_0x013e('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x013e('0x4'),'loggedIn',_0x013e('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x013e('0x6'),_0x013e('0x7'),_0x013e('0x8'),_0x013e('0x9'),'notInUse',_0x013e('0xa'),_0x013e('0xb'),'ringInUse','talking','unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x013e('0xc'),_0x013e('0xd'),_0x013e('0xe'),_0x013e('0xf'),_0x013e('0x10'),_0x013e('0x11'),_0x013e('0x12'),'startPredictive',_0x013e('0x13'),'erlangCalls','erlangCallToSecond',_0x013e('0x14'),_0x013e('0x15'),'dialPredictiveInterval',_0x013e('0x16'),'dialPredictiveIntervalMinThreshold',_0x013e('0x17'),'predictiveIntervalTotalCalls',_0x013e('0x18'),'predictiveIntervalDroppedCallsTimeout',_0x013e('0x19'),'predictiveIntervalAvgHoldtime',_0x013e('0x1a')];function getRealtimeQueues(_0x1f091c,_0x1986e3){var _0x3ebb72=_0x1986e3===_0x013e('0x1b')?amiClient:routingClient;return _0x3ebb72['request'](_[_0x013e('0x1c')](_0x1986e3)+_0x013e('0x1d'),_0x1f091c)[_0x013e('0x1e')](function(_0x573a01){if(_0x573a01[_0x013e('0x1f')])throw new Error(util[_0x013e('0x20')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x1986e3));return _0x573a01[_0x013e('0x21')];})[_0x013e('0x22')](function(_0x2c575f){throw _0x2c575f;});}exports[_0x013e('0x23')]=getRealtimeQueues;function initializeQueues(_0x142f74,_0x1e9296,_0x344386,_0x10b843){var _0x10d251=DEFAULT_QUEUE_ATTRIBUTES;if(_0x344386===_0x013e('0x1b')){if(_0x10b843==='inbound'){_0x10d251=_0x10d251[_0x013e('0x24')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x10b843==='outbound'){_0x10d251=_0x10d251[_0x013e('0x24')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x142f74['map'](function(_0x3bcd94){var _0x5ebe6d=_0x3bcd94['get']({'plain':!![]});_0x5ebe6d[_0x013e('0x5')]=0x0;_0x5ebe6d[_0x013e('0x9')]=0x0;_0x5ebe6d[_0x013e('0x25')]=0x0;_0x5ebe6d['available']=0x0;_0x5ebe6d[_0x013e('0x26')]=0x0;if(_0x344386===_0x013e('0x1b')){_0x5ebe6d[_0x013e('0x27')]=0x0;_0x5ebe6d['busy']=0x0;if(_0x10b843===_0x013e('0x28')){_0x5ebe6d[_0x013e('0xc')]=0x0;_0x5ebe6d['originated']=0x0;}}var _0x4df98d=_[_0x013e('0x29')](_0x1e9296,['id',_0x5ebe6d['id']]);if(_0x4df98d){_[_0x013e('0x2a')](_0x5ebe6d,_[_0x013e('0x2b')](_0x4df98d,_0x10d251));}return _0x5ebe6d;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/environment/development.js b/server/config/environment/development.js index 9753583..e98170d 100644 --- a/server/config/environment/development.js +++ b/server/config/environment/development.js @@ -88,5 +88,6 @@ module.exports = { baseDN: process.env.AD_BASEDN || '', url: process.env.AD_URL, domain: process.env.AD_DOMAIN - } + }, + emailMaxHTMLbytesLimit: process.env.XC_EMAIL_MAX_HTML_BYTES_LIMIT || 4000000000, }; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 14a3078..27ef6cb 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x3f23f8,_0x2aadcd){var _0x22edc3=function(_0x37e358){while(--_0x37e358){_0x3f23f8['push'](_0x3f23f8['shift']());}};_0x22edc3(++_0x2aadcd);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x3e2936,_0x1d57a9){var _0x35d87a=function(_0x19dd6a){while(--_0x19dd6a){_0x3e2936['push'](_0x3e2936['shift']());}};_0x35d87a(++_0x1d57a9);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a859344..c0bf8eb 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 _0xad6c=['digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','IPv4','internal','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','map','model','join','md5'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xad6c,0x11d));var _0xcad6=function(_0x376be9,_0xec67d0){_0x376be9=_0x376be9-0x0;var _0x5bff28=_0xad6c[_0x376be9];return _0x5bff28;};'use strict';var _=require(_0xcad6('0x0'));var os=require('os');var crypto=require(_0xcad6('0x1'));var machine=require(_0xcad6('0x2'));var exec=require(_0xcad6('0x3'))[_0xcad6('0x4')];var config=require('../environment');function getInterfaces(){var _0x37e8f4=[];var _0x444603=os[_0xcad6('0x5')]();var _0x37f737=_['orderBy'](_[_0xcad6('0x6')](_0x444603));for(var _0x152b2c=0x0;_0x152b2c<_0x37f737[_0xcad6('0x7')];_0x152b2c++){var _0x31f590=_0x444603[_0x37f737[_0x152b2c]]['filter'](function(_0x5053c5){return _0x5053c5['family']===_0xcad6('0x8')&&_0x5053c5[_0xcad6('0x9')]===![];});_0x37e8f4=_0x37e8f4['concat'](_0x31f590);}return _0x37e8f4;}function getFirstInterface(){var _0x5f59a7=_[_0xcad6('0xa')](getInterfaces());return{'macAddress':_0x5f59a7&&_0x5f59a7['mac']?_0x5f59a7[_0xcad6('0xb')]:_0xcad6('0xc'),'ipAddress':_0x5f59a7&&_0x5f59a7['address']?_0x5f59a7[_0xcad6('0xd')]:'127.0.0.1'};}exports[_0xcad6('0xe')]=getFirstInterface;function getCPUhash(){var _0x3acd03=_[_0xcad6('0xf')](os[_0xcad6('0x10')]()[_0xcad6('0x11')](function(_0x2b4db3){return _0x2b4db3[_0xcad6('0x12')];}))[_0xcad6('0x13')](':');return crypto['createHash'](_0xcad6('0x14'))['update'](_0x3acd03)[_0xcad6('0x15')](_0xcad6('0x16'));}exports[_0xcad6('0x17')]=function(){var _0x3a7c96=os[_0xcad6('0x18')]();var _0x4fc638=/[0-9a-f-]{36}/;if(config[_0xcad6('0x19')]&&_0x4fc638[_0xcad6('0x1a')](config[_0xcad6('0x19')])){return config[_0xcad6('0x19')];}else if(_0x3a7c96===_0xcad6('0x1b')){return exec(_0xcad6('0x1c'),{'encoding':_0xcad6('0x1d')})[_0xcad6('0x1e')]('\x0d\x0a','');}else{var _0x516125=getFirstInterface();var _0xd7bf2=getCPUhash();var _0x6445cb=_0xd7bf2+'|'+os[_0xcad6('0x1f')]()+'|'+_0x516125['macAddress']+'|'+_0x516125[_0xcad6('0x20')];var _0x37539e=crypto['createHash'](_0xcad6('0x14'))['update'](_0x6445cb)[_0xcad6('0x15')]('hex');return _0x37539e['substring'](0x0,0x8)+'-'+_0x37539e['substring'](0x8,0xc)+'-'+_0x37539e[_0xcad6('0x21')](0xc,0x10)+'-'+_0x37539e[_0xcad6('0x21')](0x10,0x14)+'-'+_0x37539e[_0xcad6('0x21')](0x14);}}; \ No newline at end of file +var _0x7fba=['md5','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','hex','getUuid','platform','licenseToken','test','utf8','replace','macAddress'];(function(_0x481594,_0xe83115){var _0x203862=function(_0x429288){while(--_0x429288){_0x481594['push'](_0x481594['shift']());}};_0x203862(++_0xe83115);}(_0x7fba,0x1bd));var _0xa7fb=function(_0x42e3b1,_0x19b17d){_0x42e3b1=_0x42e3b1-0x0;var _0x2ab6ad=_0x7fba[_0x42e3b1];return _0x2ab6ad;};'use strict';var _=require(_0xa7fb('0x0'));var os=require('os');var crypto=require(_0xa7fb('0x1'));var machine=require(_0xa7fb('0x2'));var exec=require(_0xa7fb('0x3'))['execSync'];var config=require(_0xa7fb('0x4'));function getInterfaces(){var _0x24e50d=[];var _0x6174e3=os[_0xa7fb('0x5')]();var _0x5b0893=_[_0xa7fb('0x6')](_[_0xa7fb('0x7')](_0x6174e3));for(var _0x1ff265=0x0;_0x1ff265<_0x5b0893['length'];_0x1ff265++){var _0x4ae78f=_0x6174e3[_0x5b0893[_0x1ff265]][_0xa7fb('0x8')](function(_0x478774){return _0x478774['family']===_0xa7fb('0x9')&&_0x478774['internal']===![];});_0x24e50d=_0x24e50d[_0xa7fb('0xa')](_0x4ae78f);}return _0x24e50d;}function getFirstInterface(){var _0x2fb5e7=_[_0xa7fb('0xb')](getInterfaces());return{'macAddress':_0x2fb5e7&&_0x2fb5e7[_0xa7fb('0xc')]?_0x2fb5e7[_0xa7fb('0xc')]:_0xa7fb('0xd'),'ipAddress':_0x2fb5e7&&_0x2fb5e7[_0xa7fb('0xe')]?_0x2fb5e7[_0xa7fb('0xe')]:_0xa7fb('0xf')};}exports[_0xa7fb('0x10')]=getFirstInterface;function getCPUhash(){var _0x33dd90=_['orderBy'](os[_0xa7fb('0x11')]()[_0xa7fb('0x12')](function(_0x20b9f5){return _0x20b9f5[_0xa7fb('0x13')];}))[_0xa7fb('0x14')](':');return crypto[_0xa7fb('0x15')]('md5')[_0xa7fb('0x16')](_0x33dd90)['digest'](_0xa7fb('0x17'));}exports[_0xa7fb('0x18')]=function(){var _0x3e6eba=os[_0xa7fb('0x19')]();var _0xe33afd=/[0-9a-f-]{36}/;if(config[_0xa7fb('0x1a')]&&_0xe33afd[_0xa7fb('0x1b')](config['licenseToken'])){return config['licenseToken'];}else if(_0x3e6eba==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xa7fb('0x1c')})[_0xa7fb('0x1d')]('\x0d\x0a','');}else{var _0xb9490c=getFirstInterface();var _0x39086a=getCPUhash();var _0x4d2328=_0x39086a+'|'+os['hostname']()+'|'+_0xb9490c[_0xa7fb('0x1e')]+'|'+_0xb9490c['ipAddress'];var _0x37701f=crypto[_0xa7fb('0x15')](_0xa7fb('0x1f'))[_0xa7fb('0x16')](_0x4d2328)[_0xa7fb('0x20')](_0xa7fb('0x17'));return _0x37701f[_0xa7fb('0x21')](0x0,0x8)+'-'+_0x37701f[_0xa7fb('0x21')](0x8,0xc)+'-'+_0x37701f[_0xa7fb('0x21')](0xc,0x10)+'-'+_0x37701f[_0xa7fb('0x21')](0x10,0x14)+'-'+_0x37701f[_0xa7fb('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3a1a78c..c9ef5ef 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 _0xa82b=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','then','catch','get','data1','data2','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update'];(function(_0x3f5c42,_0x352305){var _0x25533=function(_0x2ba97b){while(--_0x2ba97b){_0x3f5c42['push'](_0x3f5c42['shift']());}};_0x25533(++_0x352305);}(_0xa82b,0x163));var _0xba82=function(_0x3116c9,_0x1db034){_0x3116c9=_0x3116c9-0x0;var _0x2ca671=_0xa82b[_0x3116c9];return _0x2ca671;};'use strict';var util=require(_0xba82('0x0'));var moment=require(_0xba82('0x1'));var rp=require(_0xba82('0x2'));var BPromise=require(_0xba82('0x3'));var pkginfo=require(_0xba82('0x4'))(module,_0xba82('0x5'));var db=require(_0xba82('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xba82('0x7'));var logger=require(_0xba82('0x8'))('license');var HOST=_0xba82('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x185324){return new BPromise(function(_0x5902c9,_0x22180f){var _0x2538fd=util[_0xba82('0xa')](_0xba82('0xb'),HOST,_0x185324,module[_0xba82('0xc')][_0xba82('0x5')]);if(oldToken){_0x2538fd=util[_0xba82('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x185324,module['exports'][_0xba82('0x5')],oldToken);}var _0x5b0629={'uri':_0x2538fd,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x5b0629)[_0xba82('0xd')](function(_0xf2792b){_0x5902c9(_0xf2792b);})[_0xba82('0xe')](function(_0x56032a){_0x22180f(_0x56032a);});});}function manageLicense(_0x10a512,_0x277f1a){var _0x3508b2=_0x277f1a[_0xba82('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x3508b2[_0xba82('0x10')]!==_0x10a512&&!_0x3508b2[_0xba82('0x11')]){oldToken=_0x3508b2['data1'];}httpRequest(_0x10a512)[_0xba82('0xd')](function(_0x10ee28){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x10ee28['active']){isOldTokenSent=![];if(!_0x3508b2[_0xba82('0x12')]&&_0x3508b2[_0xba82('0x12')]!=_0x10ee28['license']||_0x3508b2[_0xba82('0x12')]&&_0x3508b2[_0xba82('0x11')]){logger['info'](_0xba82('0x13'));}if(_0x3508b2['license']&&!_0x3508b2['data2']&&_0x3508b2['license']!=_0x10ee28['license']){logger[_0xba82('0x14')](_0xba82('0x15'));}if(_0x3508b2[_0xba82('0x12')]&&!_0x3508b2['data2']&&_0x3508b2[_0xba82('0x12')]==_0x10ee28['license']){return _0x277f1a;}return _0x277f1a[_0xba82('0x16')]({'data1':_0x10a512,'data2':null,'license':_0x10ee28[_0xba82('0x12')]});}else{if(_0x10ee28[_0xba82('0x12')]||_0x3508b2[_0xba82('0x12')]){if(!_0x3508b2[_0xba82('0x11')]){if(_0x3508b2[_0xba82('0x10')]==_0x10a512){GRAY_PERIOD_REASON=_0xba82('0x17');logger[_0xba82('0x14')](_0xba82('0x18'));}else{GRAY_PERIOD_REASON=_0xba82('0x19');logger[_0xba82('0x14')](_0xba82('0x1a'),_0x3508b2[_0xba82('0x10')],_0x10a512);}logger['info'](_0xba82('0x1b'),GRAY_PERIOD_REASON[_0xba82('0x1c')](),moment()[_0xba82('0xa')](_0xba82('0x1d')));return _0x277f1a[_0xba82('0x16')]({'data2':encryptor[_0xba82('0x1e')](moment()[_0xba82('0xa')](_0xba82('0x1d')))});}else{if(moment()[_0xba82('0x1f')](encryptor[_0xba82('0x20')](_0x3508b2[_0xba82('0x11')]),_0xba82('0x21'))>DAYS){logger[_0xba82('0x14')](_0xba82('0x22'),moment()[_0xba82('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x277f1a[_0xba82('0x16')]({'data1':_0x10a512,'data2':null,'license':null});}}}else{if(_0x3508b2['data1']!=_0x10a512){logger[_0xba82('0x14')](_0xba82('0x1a'),_0x3508b2['data1'],_0x10a512);return _0x277f1a[_0xba82('0x16')]({'data1':_0x10a512,'data2':null,'license':null});}}}return _0x277f1a;})[_0xba82('0xd')](function(_0x44fffd){_0x277f1a=_0x44fffd;})[_0xba82('0xe')](function(_0x10e299){logger[_0xba82('0x23')](_0x10e299[_0xba82('0x24')]);})[_0xba82('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0xba82('0x26')](),_0x277f1a);},TIME);});}function defaultLicense(){var _0x2d965a=hardware[_0xba82('0x26')]();if(_0x2d965a){return db[_0xba82('0x27')][_0xba82('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x2d965a}})[_0xba82('0x29')](function(_0x462c75,_0x3ace21){logger[_0xba82('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x2d965a);manageLicense(_0x2d965a,_0x462c75);})[_0xba82('0xe')](function(_0x5bdbb2){logger[_0xba82('0x23')](_0x5bdbb2[_0xba82('0x24')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x5d1b=['active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','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','decryptString','days','DEMO\x20START\x20AT\x20%s','message','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0x5d1b,0x1ac));var _0xb5d1=function(_0x450817,_0x1d6ce2){_0x450817=_0x450817-0x0;var _0xa30b13=_0x5d1b[_0x450817];return _0xa30b13;};'use strict';var util=require(_0xb5d1('0x0'));var moment=require('moment');var rp=require(_0xb5d1('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xb5d1('0x2'))(module,_0xb5d1('0x3'));var db=require(_0xb5d1('0x4'))['db'];var encryptor=require(_0xb5d1('0x5'));var hardware=require(_0xb5d1('0x6'));var logger=require('../logger')(_0xb5d1('0x7'));var HOST=_0xb5d1('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1f8637){return new BPromise(function(_0x879f60,_0x23c075){var _0x3b8c60=util[_0xb5d1('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x1f8637,module[_0xb5d1('0xa')]['version']);if(oldToken){_0x3b8c60=util[_0xb5d1('0x9')](_0xb5d1('0xb'),HOST,_0x1f8637,module[_0xb5d1('0xa')][_0xb5d1('0x3')],oldToken);}var _0x1735de={'uri':_0x3b8c60,'method':_0xb5d1('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x1735de)[_0xb5d1('0xd')](function(_0x3a5cbe){_0x879f60(_0x3a5cbe);})['catch'](function(_0x2de036){_0x23c075(_0x2de036);});});}function manageLicense(_0x3debf0,_0x3955d9){var _0xb19248=_0x3955d9[_0xb5d1('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0xb19248[_0xb5d1('0xf')]!==_0x3debf0&&!_0xb19248['data2']){oldToken=_0xb19248[_0xb5d1('0xf')];}httpRequest(_0x3debf0)[_0xb5d1('0xd')](function(_0x28e308){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x28e308[_0xb5d1('0x10')]){isOldTokenSent=![];if(!_0xb19248[_0xb5d1('0x7')]&&_0xb19248[_0xb5d1('0x7')]!=_0x28e308[_0xb5d1('0x7')]||_0xb19248[_0xb5d1('0x7')]&&_0xb19248[_0xb5d1('0x11')]){logger['info'](_0xb5d1('0x12'));}if(_0xb19248[_0xb5d1('0x7')]&&!_0xb19248[_0xb5d1('0x11')]&&_0xb19248[_0xb5d1('0x7')]!=_0x28e308[_0xb5d1('0x7')]){logger[_0xb5d1('0x13')](_0xb5d1('0x14'));}if(_0xb19248[_0xb5d1('0x7')]&&!_0xb19248[_0xb5d1('0x11')]&&_0xb19248[_0xb5d1('0x7')]==_0x28e308[_0xb5d1('0x7')]){return _0x3955d9;}return _0x3955d9['update']({'data1':_0x3debf0,'data2':null,'license':_0x28e308['license']});}else{if(_0x28e308[_0xb5d1('0x7')]||_0xb19248[_0xb5d1('0x7')]){if(!_0xb19248[_0xb5d1('0x11')]){if(_0xb19248[_0xb5d1('0xf')]==_0x3debf0){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xb5d1('0x15'));}else{GRAY_PERIOD_REASON=_0xb5d1('0x16');logger[_0xb5d1('0x13')](_0xb5d1('0x17'),_0xb19248[_0xb5d1('0xf')],_0x3debf0);}logger[_0xb5d1('0x13')](_0xb5d1('0x18'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xb5d1('0x9')](_0xb5d1('0x19')));return _0x3955d9[_0xb5d1('0x1a')]({'data2':encryptor['encryptString'](moment()[_0xb5d1('0x9')](_0xb5d1('0x19')))});}else{if(moment()['diff'](encryptor[_0xb5d1('0x1b')](_0xb19248[_0xb5d1('0x11')]),_0xb5d1('0x1c'))>DAYS){logger['info'](_0xb5d1('0x1d'),moment()[_0xb5d1('0x9')](_0xb5d1('0x19')));isOldTokenSent=![];return _0x3955d9[_0xb5d1('0x1a')]({'data1':_0x3debf0,'data2':null,'license':null});}}}else{if(_0xb19248[_0xb5d1('0xf')]!=_0x3debf0){logger[_0xb5d1('0x13')](_0xb5d1('0x17'),_0xb19248['data1'],_0x3debf0);return _0x3955d9[_0xb5d1('0x1a')]({'data1':_0x3debf0,'data2':null,'license':null});}}}return _0x3955d9;})['then'](function(_0x490066){_0x3955d9=_0x490066;})['catch'](function(_0x1d3007){logger['error'](_0x1d3007[_0xb5d1('0x1e')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xb5d1('0x1f')](),_0x3955d9);},TIME);});}function defaultLicense(){var _0x45cdfe=hardware[_0xb5d1('0x1f')]();if(_0x45cdfe){return db[_0xb5d1('0x20')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x45cdfe}})[_0xb5d1('0x21')](function(_0x20b787,_0x2c485c){logger[_0xb5d1('0x13')](_0xb5d1('0x22'),_0x45cdfe);manageLicense(_0x45cdfe,_0x20b787);})['catch'](function(_0x5dec58){logger[_0xb5d1('0x23')](_0x5dec58[_0xb5d1('0x1e')]);});}}exports[_0xb5d1('0x24')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 47dda0d..2be1e33 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 _0x953f=['role','sequelize','count','admin','user','telephone','users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','find','defaults','then','uuid','data1','license','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','changed','disabled','message','User','findAll'];(function(_0x3877b5,_0x5794e7){var _0xb5ac48=function(_0x2e4ca6){while(--_0x2e4ca6){_0x3877b5['push'](_0x3877b5['shift']());}};_0xb5ac48(++_0x5794e7);}(_0x953f,0x187));var _0xf953=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x953f[_0x1969a7];return _0x3d665f;};'use strict';var util=require(_0xf953('0x0'));var _=require(_0xf953('0x1'));var moment=require(_0xf953('0x2'));var BPromise=require(_0xf953('0x3'));var hardware=require(_0xf953('0x4'));var encryptor=require(_0xf953('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf953('0x6'),'machineUuid':hardware[_0xf953('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf953('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xf953('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4f12ad){return new BPromise(function(_0x1073b5,_0x2c116a){return db['License'][_0xf953('0x9')](_[_0xf953('0xa')](_0x4f12ad,{'raw':!![],'where':{'id':0x1}}))[_0xf953('0xb')](function(_0x40bbdd){return checkLicense(_0x40bbdd,null);})[_0xf953('0xb')](function(_0x153522){_0x1073b5(_0x153522);return;})['catch'](function(_0x5277ec){_0x2c116a(_0x5277ec);});});}function checkLicense(_0x494666,_0x152b81){if(!_0x494666){demoLicense[_0xf953('0xc')]=_0x494666[_0xf953('0xd')];return demoLicense;}try{var _0x16c5c2=_0x152b81||_0x494666[_0xf953('0xe')];if(_['isEmpty'](_0x16c5c2)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x412e48=_0x494666[_0xf953('0xd')];var _0xadc1f9=_0x494666[_0xf953('0xf')];var _0x402581=_0x412e48['split']('-')[0x4];var _0x505d2c=_0x412e48[_0xf953('0x10')]('-')[0x0];var _0x1abe59=encryptor[_0xf953('0x11')](_0x16c5c2,util[_0xf953('0x12')](_0xf953('0x13'),_0x402581,_0x412e48,_0x505d2c));var _0x4396c1=JSON[_0xf953('0x14')](_0x1abe59);_0x4396c1[_0xf953('0x15')]=![];_0x4396c1['uuid']=_0x412e48;_0x4396c1[_0xf953('0x16')]=hardware['getUuid']();if(_0xadc1f9){var _0x5e1614=encryptor['decryptString'](_0xadc1f9);_0x4396c1[_0xf953('0x17')]=_0x5e1614;_0x4396c1[_0xf953('0x18')]=moment(_0x5e1614)[_0xf953('0x19')](0x7,_0xf953('0x1a'))[_0xf953('0x12')]();_0x4396c1['grayReason']=_0x4396c1[_0xf953('0xc')]!=_0x4396c1[_0xf953('0x16')]?_0xf953('0x1b'):_0xf953('0x1c');}return _0x4396c1;}catch(_0x13e3ae){breakingLicense[_0xf953('0xc')]=_0x494666[_0xf953('0xd')];breakingLicense[_0xf953('0x1d')]=_0x13e3ae[_0xf953('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x11022d,_0x4026d2){getLicense()[_0xf953('0xb')](function(_0x39321c){return db[_0xf953('0x1e')][_0xf953('0x1f')]({'attributes':[_0xf953('0x20'),[db[_0xf953('0x21')]['fn']('COUNT',db[_0xf953('0x21')]['col'](_0xf953('0x20'))),_0xf953('0x22')]],'group':_0xf953('0x20'),'where':{'role':{'$or':[_0xf953('0x23'),_0xf953('0x24'),_0xf953('0x25')]}},'raw':!![]})['then'](function(_0x2d7bd1){var _0x2c39f7={'user':_0x39321c[_0xf953('0x26')]||0x0,'telephone':_0x39321c[_0xf953('0x27')]||0x0};_0x2d7bd1[_0xf953('0x28')](function(_0x94d7ca){var _0x258cc2=_0x94d7ca[_0xf953('0x20')]===_0xf953('0x23')?_0xf953('0x24'):_0x94d7ca[_0xf953('0x20')];_0x2c39f7[_0x258cc2]-=_0x94d7ca[_0xf953('0x22')];if(_0x2c39f7[_0x258cc2]<0x0)_0x2c39f7[_0x258cc2]=0x0;});_0x11022d(_0x2c39f7);return;});})[_0xf953('0x29')](function(_0xc0ce23){_0x4026d2(_0xc0ce23);});});}function checkUserLimits(_0x48263c){return new BPromise(function(_0x5c6e9c,_0x10a892){getLimits()[_0xf953('0xb')](function(_0x43d5ba){var _0x2cda50=_[_0xf953('0x2a')](_[_0xf953('0x2b')](_0x48263c,_0xf953('0x20')),['admin','user',_0xf953('0x25')]);var _0x39b090=(_0x2cda50[_0xf953('0x23')]||0x0)+(_0x2cda50[_0xf953('0x24')]||0x0);var _0x21bcee=_0x2cda50[_0xf953('0x25')]||0x0;if(_0x39b090>_0x43d5ba['user'])return _0x10a892(_0xf953('0x2c'));if(_0x21bcee>_0x43d5ba[_0xf953('0x25')])return _0x10a892(_0xf953('0x2d'));return _0x5c6e9c();})['catch'](function(_0x3c9afc){_0x10a892(_0x3c9afc);});});}module[_0xf953('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x409a=['License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','parse','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','col','count','role','user','telephones','forEach','admin','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0x409a,0x81));var _0xa409=function(_0x4a46d2,_0x18abc9){_0x4a46d2=_0x4a46d2-0x0;var _0x5938c1=_0x409a[_0x4a46d2];return _0x5938c1;};'use strict';var util=require(_0xa409('0x0'));var _=require('lodash');var moment=require(_0xa409('0x1'));var BPromise=require(_0xa409('0x2'));var hardware=require('./hardware');var encryptor=require(_0xa409('0x3'));var db=require(_0xa409('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa409('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa409('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa409('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xa409('0x7'),'machineUuid':hardware[_0xa409('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x404c9f){return new BPromise(function(_0x5ecffc,_0x4cf561){return db[_0xa409('0x9')][_0xa409('0xa')](_[_0xa409('0xb')](_0x404c9f,{'raw':!![],'where':{'id':0x1}}))[_0xa409('0xc')](function(_0x255a91){return checkLicense(_0x255a91,null);})[_0xa409('0xc')](function(_0x264649){_0x5ecffc(_0x264649);return;})[_0xa409('0xd')](function(_0x4d42fd){_0x4cf561(_0x4d42fd);});});}function checkLicense(_0x435e90,_0x475e2d){if(!_0x435e90){demoLicense[_0xa409('0xe')]=_0x435e90[_0xa409('0xf')];return demoLicense;}try{var _0x56cc0c=_0x475e2d||_0x435e90[_0xa409('0x10')];if(_[_0xa409('0x11')](_0x56cc0c)){throw new Error(_0xa409('0x12'));}var _0x2f49f1=_0x435e90['data1'];var _0x8a16ad=_0x435e90['data2'];var _0x42e856=_0x2f49f1[_0xa409('0x13')]('-')[0x4];var _0x787051=_0x2f49f1[_0xa409('0x13')]('-')[0x0];var _0x451d90=encryptor[_0xa409('0x14')](_0x56cc0c,util[_0xa409('0x15')]('%s:%s:%s',_0x42e856,_0x2f49f1,_0x787051));var _0x5c757f=JSON[_0xa409('0x16')](_0x451d90);_0x5c757f['demo']=![];_0x5c757f['uuid']=_0x2f49f1;_0x5c757f[_0xa409('0x17')]=hardware[_0xa409('0x8')]();if(_0x8a16ad){var _0x30c597=encryptor[_0xa409('0x14')](_0x8a16ad);_0x5c757f[_0xa409('0x18')]=_0x30c597;_0x5c757f[_0xa409('0x19')]=moment(_0x30c597)[_0xa409('0x1a')](0x7,_0xa409('0x1b'))[_0xa409('0x15')]();_0x5c757f[_0xa409('0x1c')]=_0x5c757f[_0xa409('0xe')]!=_0x5c757f['machineUuid']?_0xa409('0x1d'):_0xa409('0x1e');}return _0x5c757f;}catch(_0x250bb8){breakingLicense['uuid']=_0x435e90[_0xa409('0xf')];breakingLicense['message']=_0x250bb8[_0xa409('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x339014,_0xc6c34a){getLicense()[_0xa409('0xc')](function(_0x27b961){return db[_0xa409('0x20')][_0xa409('0x21')]({'attributes':['role',[db[_0xa409('0x22')]['fn'](_0xa409('0x23'),db[_0xa409('0x22')][_0xa409('0x24')]('role')),_0xa409('0x25')]],'group':_0xa409('0x26'),'where':{'role':{'$or':['admin',_0xa409('0x27'),'telephone']}},'raw':!![]})[_0xa409('0xc')](function(_0x341a14){var _0x1e2293={'user':_0x27b961['users']||0x0,'telephone':_0x27b961[_0xa409('0x28')]||0x0};_0x341a14[_0xa409('0x29')](function(_0x11dbc8){var _0xae7a18=_0x11dbc8[_0xa409('0x26')]===_0xa409('0x2a')?_0xa409('0x27'):_0x11dbc8[_0xa409('0x26')];_0x1e2293[_0xae7a18]-=_0x11dbc8['count'];if(_0x1e2293[_0xae7a18]<0x0)_0x1e2293[_0xae7a18]=0x0;});_0x339014(_0x1e2293);return;});})[_0xa409('0xd')](function(_0x2a43af){_0xc6c34a(_0x2a43af);});});}function checkUserLimits(_0x2117af){return new BPromise(function(_0x3b7780,_0x37b041){getLimits()[_0xa409('0xc')](function(_0x3011bf){var _0x13fe15=_['pick'](_[_0xa409('0x2b')](_0x2117af,_0xa409('0x26')),[_0xa409('0x2a'),_0xa409('0x27'),_0xa409('0x2c')]);var _0x298844=(_0x13fe15[_0xa409('0x2a')]||0x0)+(_0x13fe15[_0xa409('0x27')]||0x0);var _0x172b62=_0x13fe15['telephone']||0x0;if(_0x298844>_0x3011bf['user'])return _0x37b041('License\x20limit\x20reached\x20for\x20users');if(_0x172b62>_0x3011bf[_0xa409('0x2c')])return _0x37b041(_0xa409('0x2d'));return _0x3b7780();})[_0xa409('0xd')](function(_0x425908){_0x37b041(_0x425908);});});}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 a07ad06..c464397 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 _0x4991=['secret','exports','myappanuglar-secret'];(function(_0x4929fd,_0x2c9d98){var _0x1a700d=function(_0xf85861){while(--_0xf85861){_0x4929fd['push'](_0x4929fd['shift']());}};_0x1a700d(++_0x2c9d98);}(_0x4991,0xf7));var _0x1499=function(_0x537596,_0x1cd439){_0x537596=_0x537596-0x0;var _0x10b3b0=_0x4991[_0x537596];return _0x10b3b0;};'use strict';module[_0x1499('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1499('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x1499('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x160f=['http://localhost:9000','myappanuglar-secret','app-id','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xf160('0x0')]={'DOMAIN':_0xf160('0x1'),'SESSION_SECRET':_0xf160('0x2'),'GOOGLE_ID':_0xf160('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index d57824d..9bf314f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe39a=['exports','../utils/loggers','fileLogger'];(function(_0xeb33a4,_0x50e752){var _0x42f924=function(_0x45feb1){while(--_0x45feb1){_0xeb33a4['push'](_0xeb33a4['shift']());}};_0x42f924(++_0x50e752);}(_0xe39a,0xe2));var _0xae39=function(_0x1a60d8,_0x40411a){_0x1a60d8=_0x1a60d8-0x0;var _0x2eaad5=_0xe39a[_0x1a60d8];return _0x2eaad5;};'use strict';var fileLogger=require(_0xae39('0x0'))[_0xae39('0x1')];module[_0xae39('0x2')]=fileLogger; \ No newline at end of file +var _0x61f1=['exports','../utils/loggers','fileLogger'];(function(_0x4ec744,_0x40cec0){var _0x2aedfe=function(_0x19a91d){while(--_0x19a91d){_0x4ec744['push'](_0x4ec744['shift']());}};_0x2aedfe(++_0x40cec0);}(_0x61f1,0x17e));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var fileLogger=require(_0x161f('0x0'))[_0x161f('0x1')];module[_0x161f('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 9bf582c..748c419 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 _0xc436=['routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','legacy-libs','express','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x48cb4b,_0x53d0b0){var _0x3d7868=function(_0x257c3f){while(--_0x257c3f){_0x48cb4b['push'](_0x48cb4b['shift']());}};_0x3d7868(++_0x53d0b0);}(_0xc436,0xa4));var _0x6c43=function(_0x266480,_0x3cf747){_0x266480=_0x266480-0x0;var _0x1f51ef=_0xc436[_0x266480];return _0x1f51ef;};'use strict';var path=require(_0x6c43('0x0'));var cfg=require(_0x6c43('0x1'));var env={'NODE_PATH':path[_0x6c43('0x2')](path[_0x6c43('0x3')](cfg['root'],_0x6c43('0x4')))};var pm2config={'apps':[{'name':_0x6c43('0x5'),'script':path[_0x6c43('0x3')](__dirname,_0x6c43('0x6')),'env':env},{'name':_0x6c43('0x7'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x6c43('0x8'),'script':path['join'](__dirname,_0x6c43('0x9')),'env':env},{'name':_0x6c43('0xa'),'script':path['join'](__dirname,_0x6c43('0xb')),'env':env},{'name':_0x6c43('0xc'),'script':path[_0x6c43('0x3')](__dirname,_0x6c43('0xd')),'env':env},{'name':'xdr','script':path[_0x6c43('0x3')](__dirname,_0x6c43('0xe')),'env':env}]};module[_0x6c43('0xf')]=pm2config; \ No newline at end of file +var _0x053b=['../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','../../config/environment','resolve','join','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x2de500,_0x7175a0){var _0xa6dfa8=function(_0x315ecc){while(--_0x315ecc){_0x2de500['push'](_0x2de500['shift']());}};_0xa6dfa8(++_0x7175a0);}(_0x053b,0x1d8));var _0xb053=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x053b[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xb053('0x0'));var cfg=require(_0xb053('0x1'));var env={'NODE_PATH':path[_0xb053('0x2')](path[_0xb053('0x3')](cfg['root'],_0xb053('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0xb053('0x3')](__dirname,_0xb053('0x5')),'env':env},{'name':_0xb053('0x6'),'script':path['join'](__dirname,_0xb053('0x7')),'env':env},{'name':'agi','script':path['join'](__dirname,_0xb053('0x8')),'env':env},{'name':_0xb053('0x9'),'script':path['join'](__dirname,_0xb053('0xa')),'env':env},{'name':_0xb053('0xb'),'script':path[_0xb053('0x3')](__dirname,_0xb053('0xc')),'env':env},{'name':_0xb053('0xd'),'script':path[_0xb053('0x3')](__dirname,_0xb053('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 0270775..f54a57c 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 _0xf09c=['saved','bluebird','connect','then','start','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xf09c,0x91));var _0xcf09=function(_0xcc2d41,_0x48729c){_0xcc2d41=_0xcc2d41-0x0;var _0x681f78=_0xf09c[_0xcc2d41];return _0x681f78;};'use strict';var pm2=require('pm2');var BPromise=require(_0xcf09('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x4aa52c,_0x61b8c3){return pm2[_0xcf09('0x1')](function(_0x1aa695){if(_0x1aa695){return _0x61b8c3(_0x1aa695);}return _0x4aa52c('connected');});});};exports['start']=function(_0x549ac8){return connect()[_0xcf09('0x2')](function(){return new BPromise(function(_0x2153b7,_0x1d9f12){return pm2[_0xcf09('0x3')](_0x549ac8,function(_0x2e5736,_0x44d24e){if(_0x2e5736){return _0x1d9f12(_0x2e5736);}pm2[_0xcf09('0x4')]();return _0x2153b7(_0x44d24e);});});});};exports[_0xcf09('0x5')]=function(_0x4f9706){return connect()[_0xcf09('0x2')](function(){return new BPromise(function(_0x11d30e,_0x5e0960){return pm2[_0xcf09('0x5')](_0x4f9706,function(_0x5221d0,_0x7a4fc5){if(_0x5221d0){return _0x5e0960(_0x5221d0);}pm2[_0xcf09('0x4')]();return _0x11d30e(_0x7a4fc5);});});});};exports[_0xcf09('0x6')]=function(_0x196f51){return connect()[_0xcf09('0x2')](function(){return new BPromise(function(_0x36c136,_0x26a3aa){return pm2[_0xcf09('0x6')](_0x196f51,function(_0x4f14c0,_0x57547f){if(_0x4f14c0){return _0x26a3aa(_0x4f14c0);}pm2['disconnect']();return _0x36c136(_0x57547f);});});});};exports[_0xcf09('0x7')]=function(){return connect()[_0xcf09('0x2')](function(){return new BPromise(function(_0x31d0cd,_0x3429ab){return pm2[_0xcf09('0x7')](function(_0x4342dd,_0x1eb310){if(_0x4342dd){return _0x3429ab(_0x4342dd);}pm2[_0xcf09('0x4')]();return _0x31d0cd(_0x1eb310);});});});};exports[_0xcf09('0x8')]=function(_0x32fcda){return connect()[_0xcf09('0x2')](function(){return new BPromise(function(_0x21bda7,_0x4f6c73){return pm2[_0xcf09('0x8')](_0x32fcda,function(_0x20faa3,_0x501d4a){if(_0x20faa3){return _0x4f6c73(_0x20faa3);}pm2[_0xcf09('0x4')]();return _0x21bda7(_0x501d4a);});});});};exports['delete']=function(_0x4d63d1){return connect()[_0xcf09('0x2')](function(){return new BPromise(function(_0x3d4e83,_0x2d0a13){return pm2[_0xcf09('0x9')](_0x4d63d1,function(_0x2217d5,_0x5aaf1c){if(_0x2217d5){return _0x2d0a13(_0x2217d5);}pm2[_0xcf09('0x4')]();return _0x3d4e83(_0x5aaf1c);});});});};exports[_0xcf09('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x407fdc,_0x1e95e6){return pm2[_0xcf09('0xa')](function(_0x3491c3){if(_0x3491c3){return _0x1e95e6(_0x3491c3);}return _0x407fdc(_0xcf09('0xb'));});});});}; \ No newline at end of file +var _0x4864=['restart','list','describe','delete','dump','pm2','bluebird','./config','connect','start','then','disconnect','stop'];(function(_0x568480,_0x58aabb){var _0x9623e6=function(_0x3f2ae9){while(--_0x3f2ae9){_0x568480['push'](_0x568480['shift']());}};_0x9623e6(++_0x58aabb);}(_0x4864,0x130));var _0x4486=function(_0x5c7dfa,_0x47cad7){_0x5c7dfa=_0x5c7dfa-0x0;var _0x102bb8=_0x4864[_0x5c7dfa];return _0x102bb8;};'use strict';var pm2=require(_0x4486('0x0'));var BPromise=require(_0x4486('0x1'));var config=require(_0x4486('0x2'));function connect(){return new BPromise(function(_0x3c2140,_0x501f02){return pm2[_0x4486('0x3')](function(_0x573395){if(_0x573395){return _0x501f02(_0x573395);}return _0x3c2140('connected');});});};exports[_0x4486('0x4')]=function(_0x303120){return connect()[_0x4486('0x5')](function(){return new BPromise(function(_0x73e72e,_0x343068){return pm2['start'](_0x303120,function(_0x757a1c,_0x3bcbef){if(_0x757a1c){return _0x343068(_0x757a1c);}pm2[_0x4486('0x6')]();return _0x73e72e(_0x3bcbef);});});});};exports[_0x4486('0x7')]=function(_0x3bda83){return connect()[_0x4486('0x5')](function(){return new BPromise(function(_0x45dcc2,_0x290972){return pm2[_0x4486('0x7')](_0x3bda83,function(_0x4c17f2,_0x3d92c1){if(_0x4c17f2){return _0x290972(_0x4c17f2);}pm2[_0x4486('0x6')]();return _0x45dcc2(_0x3d92c1);});});});};exports['restart']=function(_0x39a3c8){return connect()[_0x4486('0x5')](function(){return new BPromise(function(_0x400482,_0x3deddd){return pm2[_0x4486('0x8')](_0x39a3c8,function(_0x15ddf2,_0x78c74a){if(_0x15ddf2){return _0x3deddd(_0x15ddf2);}pm2[_0x4486('0x6')]();return _0x400482(_0x78c74a);});});});};exports[_0x4486('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4aac9c,_0x47a032){return pm2[_0x4486('0x9')](function(_0x3fe664,_0x1c7618){if(_0x3fe664){return _0x47a032(_0x3fe664);}pm2[_0x4486('0x6')]();return _0x4aac9c(_0x1c7618);});});});};exports['describe']=function(_0x46bc1f){return connect()[_0x4486('0x5')](function(){return new BPromise(function(_0x33bbac,_0x2de72d){return pm2[_0x4486('0xa')](_0x46bc1f,function(_0x58ff03,_0x7c3c98){if(_0x58ff03){return _0x2de72d(_0x58ff03);}pm2[_0x4486('0x6')]();return _0x33bbac(_0x7c3c98);});});});};exports[_0x4486('0xb')]=function(_0x38da44){return connect()[_0x4486('0x5')](function(){return new BPromise(function(_0x3e0e60,_0x3b56e4){return pm2[_0x4486('0xb')](_0x38da44,function(_0x51b1fe,_0x5ba52a){if(_0x51b1fe){return _0x3b56e4(_0x51b1fe);}pm2[_0x4486('0x6')]();return _0x3e0e60(_0x5ba52a);});});});};exports[_0x4486('0xc')]=function(){return connect()[_0x4486('0x5')](function(){return new BPromise(function(_0x2e9e79,_0x2c46df){return pm2['dump'](function(_0x37664f){if(_0x37664f){return _0x2c46df(_0x37664f);}return _0x2e9e79('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 08246a2..7ed1e9c 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 _0x0422=['minutes','then','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','find','chatTimeout','ChatInteraction','findAll','lastMsgAt'];(function(_0x48364c,_0x579a56){var _0x3fafb9=function(_0x3ee3e4){while(--_0x3ee3e4){_0x48364c['push'](_0x48364c['shift']());}};_0x3fafb9(++_0x579a56);}(_0x0422,0x1bf));var _0x2042=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x0422[_0x53fe97];return _0x5c49a2;};'use strict';var _=require(_0x2042('0x0'));var moment=require(_0x2042('0x1'));var Redis=require(_0x2042('0x2'));var util=require(_0x2042('0x3'));var config=require(_0x2042('0x4'));var db=require(_0x2042('0x5'))['db'];var logger=require('../logger')(_0x2042('0x6'));config[_0x2042('0x7')]=_[_0x2042('0x8')](config[_0x2042('0x7')],{'host':_0x2042('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2042('0x7')]));function closeInteractions(){var _0x4ca6bb=0x0;var _0x589324=[];return db['Setting'][_0x2042('0xa')]({'raw':!![],'attributes':['id',_0x2042('0xb')],'where':{'id':0x1}})['then'](function(_0xb42188){_0x4ca6bb=_0xb42188[_0x2042('0xb')];if(_0x4ca6bb){return db[_0x2042('0xc')][_0x2042('0xd')]({'raw':!![],'attributes':['id',_0x2042('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0xb42188[_0x2042('0xb')],_0x2042('0xf'))}}});}else{return[];}})[_0x2042('0x10')](function(_0x6c7a05){if(_0x6c7a05&&_0x6c7a05['length']){_0x589324=_['map'](_0x6c7a05||[],'id');logger[_0x2042('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x589324[_0x2042('0x12')]());return db[_0x2042('0xc')][_0x2042('0x13')]({'closeReason':_0x2042('0x14'),'disposition':_0x2042('0x15'),'closed':!![],'closedAt':moment()[_0x2042('0x16')](_0x2042('0x17'))},{'where':{'id':_0x589324}});}})['then'](function(){if(_0x589324&&_0x589324['length']){logger[_0x2042('0x11')](_0x2042('0x18'),_0x589324[_0x2042('0x12')]());for(var _0x22d6cf=0x0;_0x22d6cf<_0x589324[_0x2042('0x19')];_0x22d6cf++){io[_0x2042('0x1a')](_0x2042('0x1b'),{'id':_0x589324[_0x22d6cf],'closed':!![]});}}})[_0x2042('0x1c')](function(_0x68961d){logger[_0x2042('0x1d')](_0x2042('0x1e'),_0x68961d?util[_0x2042('0x1f')](_0x68961d,{'showHidden':![],'depth':null}):'');});}exports[_0x2042('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbc8f=['socket.io-emitter','Setting','find','chatTimeout','then','lastMsgAt','minutes','length','map','join','ChatInteraction','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost'];(function(_0x54b116,_0x1f8511){var _0x132143=function(_0x53d49a){while(--_0x53d49a){_0x54b116['push'](_0x54b116['shift']());}};_0x132143(++_0x1f8511);}(_0xbc8f,0x67));var _0xfbc8=function(_0x4e91d2,_0x1b0bf0){_0x4e91d2=_0x4e91d2-0x0;var _0x336588=_0xbc8f[_0x4e91d2];return _0x336588;};'use strict';var _=require(_0xfbc8('0x0'));var moment=require(_0xfbc8('0x1'));var Redis=require(_0xfbc8('0x2'));var util=require('util');var config=require(_0xfbc8('0x3'));var db=require(_0xfbc8('0x4'))['db'];var logger=require(_0xfbc8('0x5'))('schedule');config[_0xfbc8('0x6')]=_[_0xfbc8('0x7')](config[_0xfbc8('0x6')],{'host':_0xfbc8('0x8'),'port':0x18eb});var io=require(_0xfbc8('0x9'))(new Redis(config[_0xfbc8('0x6')]));function closeInteractions(){var _0x395382=0x0;var _0x31f0e2=[];return db[_0xfbc8('0xa')][_0xfbc8('0xb')]({'raw':!![],'attributes':['id',_0xfbc8('0xc')],'where':{'id':0x1}})[_0xfbc8('0xd')](function(_0x2f5f5e){_0x395382=_0x2f5f5e[_0xfbc8('0xc')];if(_0x395382){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0xfbc8('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x2f5f5e[_0xfbc8('0xc')],_0xfbc8('0xf'))}}});}else{return[];}})['then'](function(_0x12229){if(_0x12229&&_0x12229[_0xfbc8('0x10')]){_0x31f0e2=_[_0xfbc8('0x11')](_0x12229||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x31f0e2[_0xfbc8('0x12')]());return db[_0xfbc8('0x13')]['update']({'closeReason':_0xfbc8('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xfbc8('0x15')](_0xfbc8('0x16'))},{'where':{'id':_0x31f0e2}});}})['then'](function(){if(_0x31f0e2&&_0x31f0e2[_0xfbc8('0x10')]){logger['info'](_0xfbc8('0x17'),_0x31f0e2[_0xfbc8('0x12')]());for(var _0x362bcc=0x0;_0x362bcc<_0x31f0e2['length'];_0x362bcc++){io['emit']('chatInteraction:update',{'id':_0x31f0e2[_0x362bcc],'closed':!![]});}}})[_0xfbc8('0x18')](function(_0x37b014){logger['error'](_0xfbc8('0x19'),_0x37b014?util[_0xfbc8('0x1a')](_0x37b014,{'showHidden':![],'depth':null}):'');});}exports[_0xfbc8('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 59709fc..c440691 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8eb=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3914a8,_0x13052c){var _0x58ec27=function(_0x20cc47){while(--_0x20cc47){_0x3914a8['push'](_0x3914a8['shift']());}};_0x58ec27(++_0x13052c);}(_0xf8eb,0x101));var _0xbf8e=function(_0x2358c5,_0x4d3152){_0x2358c5=_0x2358c5-0x0;var _0x5418ef=_0xf8eb[_0x2358c5];return _0x5418ef;};'use strict';function start(){var _0x327cfc=require(_0xbf8e('0x0'));return _0x327cfc[_0xbf8e('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xef6d=['exports','startAllRefreshIntervals'];(function(_0x22f48b,_0x1c31d8){var _0x150531=function(_0x44c3e3){while(--_0x44c3e3){_0x22f48b['push'](_0x22f48b['shift']());}};_0x150531(++_0x1c31d8);}(_0xef6d,0xa3));var _0xdef6=function(_0x37db40,_0x2e9679){_0x37db40=_0x37db40-0x0;var _0x1520fa=_0xef6d[_0x37db40];return _0x1520fa;};'use strict';function start(){var _0x302d2f=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x302d2f[_0xdef6('0x0')]();}module[_0xdef6('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 3dd5d36..33cacbf 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 _0xe602=['\x22%s\x22\x20<%s>','MailAccount','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','%s.%s','savename','extname','zip','existsSync','status','Sent','message','attachments','text','stringify','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','catch','case\x20loading','currentAttempt','retries','operation','stop','still\x20loading','case\x20completed','job','case\x20empty','data','case\x20failed','Unrecognized\x20status:','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','toString','keyBy','intersection','difference','length','exists','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','deleteJob','update','stop\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','then','error','email','getSmtpOptions'];(function(_0x38f9ea,_0x1db6da){var _0x141d0d=function(_0x3422cd){while(--_0x3422cd){_0x38f9ea['push'](_0x38f9ea['shift']());}};_0x141d0d(++_0x1db6da);}(_0xe602,0x1b4));var _0x2e60=function(_0x466542,_0x584cc6){_0x466542=_0x466542-0x0;var _0x3b13c2=_0xe602[_0x466542];return _0x3b13c2;};'use strict';var fs=require('fs');var util=require(_0x2e60('0x0'));var path=require(_0x2e60('0x1'));var _=require(_0x2e60('0x2'));var moment=require('moment');var CronJobManager=require(_0x2e60('0x3'));var jayson=require(_0x2e60('0x4'));var BPromise=require(_0x2e60('0x5'));var logger=require(_0x2e60('0x6'))(_0x2e60('0x7'));var db=require(_0x2e60('0x8'))['db'];const retry=require(_0x2e60('0x9'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x2e60('0xa'));var client=jayson[_0x2e60('0xb')][_0x2e60('0xc')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x286e3d){const _0x5b90fb={};if(typeof _0x286e3d===_0x2e60('0xd')){_0x5b90fb['id']=_0x286e3d;}return db[_0x2e60('0xe')][_0x2e60('0xf')]({'where':_0x5b90fb})[_0x2e60('0x10')](function(_0x4d4881){return _0x4d4881;})['catch'](function(_0x1fd653){logger[_0x2e60('0x11')](_0x1fd653);});}function handleSendEmail(_0x1b3257,_0x4b87fb){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x1b3257[_0x2e60('0x12')]);var _0x4fbf01=!![];var _0x33a552=_0x1b3257['MailAccount'][_0x2e60('0x13')]();var _0x95dbe5={'account':_0x33a552,'message':{'from':util['format'](_0x2e60('0x14'),_0x1b3257[_0x2e60('0x15')]['name'],_0x1b3257['MailAccount']['email']||_0x1b3257[_0x2e60('0x15')]['Smtp'][_0x2e60('0x16')]),'to':_0x1b3257[_0x2e60('0x12')],'cc':_0x1b3257['cc'],'bcc':_0x1b3257[_0x2e60('0x17')],'subject':util[_0x2e60('0x18')](_0x2e60('0x19'),_0x4b87fb['name'],_0x1b3257[_0x2e60('0x1a')],_0x1b3257[_0x2e60('0x1b')])}};var _0x1dd6a5=path[_0x2e60('0x1c')](__dirname,'../../files/reports');var _0x4c401f=_0x4b87fb['savename'];var _0x1a7b24=util[_0x2e60('0x18')](_0x2e60('0x1d'),path['basename'](_0x4b87fb[_0x2e60('0x1e')],path[_0x2e60('0x1f')](_0x4b87fb['savename'])),_0x2e60('0x20'));var _0x4c86c4=path[_0x2e60('0x1c')](_0x1dd6a5,_0x4c401f);var _0x36a8af=path[_0x2e60('0x1c')](_0x1dd6a5,_0x1a7b24);if(fs[_0x2e60('0x21')](_0x4c86c4)){_0x4b87fb[_0x2e60('0x22')]=_0x2e60('0x23');_0x95dbe5[_0x2e60('0x24')][_0x2e60('0x25')]=[{'filename':_0x4c401f,'path':_0x4c86c4}];_0x95dbe5[_0x2e60('0x24')][_0x2e60('0x26')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x2e60('0x27')](_0x4b87fb,null,0x2));}else if(fs[_0x2e60('0x21')](_0x36a8af)){_0x4b87fb[_0x2e60('0x22')]=_0x2e60('0x23');_0x95dbe5[_0x2e60('0x24')]['attachments']=[{'filename':_0x1a7b24,'path':_0x36a8af}];}else{if(_0x4b87fb['status']===_0x2e60('0x28')){_0x95dbe5['message'][_0x2e60('0x26')]=_0x2e60('0x29');if(!_0x1b3257[_0x2e60('0x2a')]){_0x4fbf01=![];logger[_0x2e60('0x2b')](_0x2e60('0x2c'));}}else if(_0x4b87fb[_0x2e60('0x22')]===_0x2e60('0x2d')){_0x95dbe5[_0x2e60('0x24')]['text']=_0x2e60('0x2e');}else if(_0x4b87fb[_0x2e60('0x22')]==='Completed'){_0x95dbe5[_0x2e60('0x24')][_0x2e60('0x26')]=_0x2e60('0x2f');}else if(_0x4b87fb[_0x2e60('0x22')]===_0x2e60('0x30')){_0x95dbe5['message'][_0x2e60('0x26')]=_0x2e60('0x31');}else{logger['error'](_0x2e60('0x32'),_0x4b87fb[_0x2e60('0x22')]);}}if(_0x4fbf01){return client[_0x2e60('0x33')](_0x2e60('0x34'),_0x95dbe5)['then'](function(_0x533ffd){if(_0x533ffd[_0x2e60('0x11')]){return logger[_0x2e60('0x11')](_0x2e60('0x35'),JSON[_0x2e60('0x27')](_0x533ffd));}return logger[_0x2e60('0x2b')](_0x2e60('0x36'));})[_0x2e60('0x37')](function(_0x10567f){return logger[_0x2e60('0x11')](_0x2e60('0x35'),JSON[_0x2e60('0x27')](_0x10567f));});}}function handleError(){return function(_0x27efac){return logger['error'](JSON['stringify'](_0x27efac));};}function loading(_0x33f2e9){logger[_0x2e60('0x2b')](_0x2e60('0x38'));if(_0x33f2e9[_0x2e60('0x39')]===_0x33f2e9['retryOptions'][_0x2e60('0x3a')]){handleSendEmail(_0x33f2e9['job'],_0x33f2e9['data']);_0x33f2e9[_0x2e60('0x3b')][_0x2e60('0x3c')]();}else{_0x33f2e9[_0x2e60('0x3b')][_0x2e60('0x9')](_0x2e60('0x3d'));}}function completed(_0x3611bb){logger[_0x2e60('0x2b')](_0x2e60('0x3e'));handleSendEmail(_0x3611bb[_0x2e60('0x3f')],_0x3611bb['data']);_0x3611bb[_0x2e60('0x3b')][_0x2e60('0x3c')]();}function empty(_0x41f20e){logger[_0x2e60('0x2b')](_0x2e60('0x40'));handleSendEmail(_0x41f20e[_0x2e60('0x3f')],_0x41f20e[_0x2e60('0x41')]);_0x41f20e[_0x2e60('0x3b')][_0x2e60('0x3c')]();}function failed(_0x2da624){logger['info'](_0x2e60('0x42'));handleSendEmail(_0x2da624[_0x2e60('0x3f')],_0x2da624['data']);_0x2da624[_0x2e60('0x3b')]['stop']();}function urecognized(_0x37f496){logger['error'](_0x2e60('0x43'),_0x37f496['entity'][_0x2e60('0x44')][_0x2e60('0x22')]);_0x37f496[_0x2e60('0x3b')][_0x2e60('0x3c')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x96f63d,_0x2c8e49){const _0x55e9c7={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x5b85f3=retry[_0x2e60('0x3b')](_0x55e9c7);_0x5b85f3[_0x2e60('0x45')](_0x5a7b75=>{logger[_0x2e60('0x2b')](_0x2e60('0x46')+_0x96f63d['id']+_0x2e60('0x47')+_0x5a7b75);try{getReportData(_0x2c8e49['id'])[_0x2e60('0x10')](function(_0x352d93){_0x2c8e49=_0x352d93;logger[_0x2e60('0x2b')](_0x2e60('0x48'),_0x352d93[_0x2e60('0x44')][_0x2e60('0x22')]);if(!reportStatusStrategies[_0x352d93[_0x2e60('0x44')][_0x2e60('0x22')]]){logger['error'](_0x2e60('0x48'),_0x352d93['dataValues'][_0x2e60('0x22')]);_0x5b85f3[_0x2e60('0x9')]();}reportStatusStrategies[_0x352d93[_0x2e60('0x44')][_0x2e60('0x22')]]({'operation':_0x5b85f3,'currentAttempt':_0x5a7b75,'retryOptions':_0x55e9c7,'job':_0x96f63d,'data':_0x2c8e49,'entity':_0x352d93});});}catch(_0x430764){_0x5b85f3['retry'](_0x430764);}});}function handleResult(_0x484a40){return function(_0x1581b9){if(_0x484a40[_0x2e60('0x49')]&&_0x484a40[_0x2e60('0x15')]&&_0x484a40[_0x2e60('0x15')][_0x2e60('0x4a')]&&!_[_0x2e60('0x4b')](_0x484a40[_0x2e60('0x12')])){retryer(_0x484a40,_0x1581b9);}};}function handleJob(_0x17c208){return function(){try{if(_[_0x2e60('0x4b')](_0x17c208['subtractNumber'])){return logger[_0x2e60('0x2b')](_0x2e60('0x4c'));}if(_[_0x2e60('0x4b')](_0x17c208[_0x2e60('0x1b')])){return logger['info'](_0x2e60('0x4d'));}var _0x592533={'startDate':moment()[_0x2e60('0x4e')](_0x17c208['subtractNumber'],_0x17c208[_0x2e60('0x1b')])[_0x2e60('0x18')](_0x2e60('0x4f')),'endDate':moment()[_0x2e60('0x18')](_0x2e60('0x4f')),'type':_0x2e60('0x50'),'output':_0x17c208[_0x2e60('0x51')],'name':_0x17c208[_0x2e60('0x52')]};if(!_[_0x2e60('0x4b')](_0x17c208['DefaultReportId'])){logger[_0x2e60('0x2b')](_0x2e60('0x53'),_0x17c208[_0x2e60('0x54')]);return analyticDefaultReportController['runReport']({'id':_0x17c208[_0x2e60('0x54')]},_0x592533)['then'](handleResult(_0x17c208))[_0x2e60('0x37')](handleError());}if(!_[_0x2e60('0x4b')](_0x17c208[_0x2e60('0x55')])){logger['info'](_0x2e60('0x56'),_0x17c208['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x17c208[_0x2e60('0x55')]},_0x592533)[_0x2e60('0x10')](handleResult(_0x17c208))['catch'](handleError());}}catch(_0x911289){logger['error'](JSON['stringify'](_0x911289));}return logger[_0x2e60('0x2b')](_0x2e60('0x57'));};}function getJobs(_0x233c8f){var _0x35ffc2={};if(_0x233c8f){_0x35ffc2['id']=_0x233c8f;}return db[_0x2e60('0x58')][_0x2e60('0x59')]({'where':_0x35ffc2,'include':[{'model':db[_0x2e60('0x15')],'attributes':['id',_0x2e60('0x52'),_0x2e60('0x12')],'include':[{'model':db[_0x2e60('0x5a')],'as':_0x2e60('0x4a'),'include':[{'model':db[_0x2e60('0x5b')],'as':'CloudProvider'}]}]}]})[_0x2e60('0x10')](function(_0x234e8f){var _0x3c3c6c=_[_0x2e60('0x5c')](manager['jobs']);var _0x419f04=_['map'](_0x234e8f,function(_0x18dd64){return _0x18dd64['id'][_0x2e60('0x5d')]();});var _0x36e040=_[_0x2e60('0x5e')](_0x234e8f,function(_0x114b72){return _0x114b72['id'][_0x2e60('0x5d')]();});var _0x1cff1e=_0x233c8f?_0x419f04:_['difference'](_0x419f04,_0x3c3c6c);var _0x404058=_[_0x2e60('0x5f')](_0x419f04,_0x3c3c6c);var _0x38f659=_[_0x2e60('0x60')](_0x3c3c6c,_0x419f04);var _0x213fa5;var _0x78e355;for(_0x213fa5=0x0;_0x213fa5<_0x38f659[_0x2e60('0x61')]&&!_0x233c8f;_0x213fa5+=0x1){_0x78e355=_0x38f659[_0x213fa5][_0x2e60('0x5d')]();if(manager[_0x2e60('0x62')](_0x78e355)){manager['stop'](_0x78e355);manager['deleteJob'](_0x78e355);logger['info'](_0x2e60('0x63'),_0x78e355);}}logger[_0x2e60('0x2b')](_0x2e60('0x64'),JSON[_0x2e60('0x27')](_0x1cff1e));for(_0x213fa5=0x0;_0x213fa5<_0x1cff1e[_0x2e60('0x61')];_0x213fa5+=0x1){_0x78e355=_0x1cff1e[_0x213fa5][_0x2e60('0x5d')]();if(_0x233c8f){logger['info'](JSON[_0x2e60('0x27')](_0x36e040[_0x78e355]));BPromise[_0x2e60('0x65')]()['then'](handleJob(_0x36e040[_0x78e355]));logger[_0x2e60('0x2b')](_0x2e60('0x66'),_0x36e040[_0x78e355][_0x2e60('0x52')],_0x36e040[_0x78e355][_0x2e60('0x67')]);}else if(_0x36e040[_0x78e355]['cron']&&_0x36e040[_0x78e355][_0x2e60('0x68')]&&moment()[_0x2e60('0x69')](_0x36e040[_0x78e355][_0x2e60('0x6a')],_0x36e040[_0x78e355][_0x2e60('0x6b')])){manager[_0x2e60('0x6c')](_0x78e355,_0x36e040[_0x78e355][_0x2e60('0x67')],handleJob(_0x36e040[_0x78e355]));manager[_0x2e60('0x6d')](_0x78e355);logger[_0x2e60('0x2b')]('add\x20cron',_0x36e040[_0x78e355][_0x2e60('0x52')],_0x36e040[_0x78e355][_0x2e60('0x67')]);}else if(manager[_0x2e60('0x62')](_0x78e355)){manager['stop'](_0x78e355);manager[_0x2e60('0x6e')](_0x78e355);logger[_0x2e60('0x2b')]('stop\x20cron',_0x36e040[_0x78e355][_0x2e60('0x52')],_0x36e040[_0x78e355][_0x2e60('0x67')]);}}for(_0x213fa5=0x0,_0x78e355;_0x213fa5<_0x404058[_0x2e60('0x61')]&&!_0x233c8f;_0x213fa5+=0x1){_0x78e355=_0x404058[_0x213fa5][_0x2e60('0x5d')]();if(manager[_0x2e60('0x62')](_0x78e355)){if(_0x36e040[_0x78e355][_0x2e60('0x67')]&&_0x36e040[_0x78e355][_0x2e60('0x68')]&&moment()[_0x2e60('0x69')](_0x36e040[_0x78e355][_0x2e60('0x6a')],_0x36e040[_0x78e355][_0x2e60('0x6b')])){manager[_0x2e60('0x6f')](_0x78e355,_0x36e040[_0x78e355]['cron'],handleJob(_0x36e040[_0x78e355]));logger[_0x2e60('0x2b')]('update\x20cron',_0x36e040[_0x78e355]['name'],_0x36e040[_0x78e355][_0x2e60('0x67')]);}else{manager[_0x2e60('0x3c')](_0x78e355);manager[_0x2e60('0x6e')](_0x78e355);logger[_0x2e60('0x2b')](_0x2e60('0x70'),_0x36e040[_0x78e355][_0x2e60('0x52')],_0x36e040[_0x78e355]['cron']);}}}})[_0x2e60('0x37')](function(_0x357c21){logger[_0x2e60('0x11')](JSON[_0x2e60('0x27')](_0x357c21));});}exports[_0x2e60('0x71')]=function(_0x4a5e31){return getJobs(_0x4a5e31);};exports[_0x2e60('0x6d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x8bca=['deleteJob','toRun','length','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','exists','stop\x20cron','update\x20cron','run','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','client','http','number','AnalyticExtractedReport','findOne','catch','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','user','bcc','name','subtractNumber','savename','%s.%s','basename','extname','zip','join','status','message','text','stringify','existsSync','Sent','attachments','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','error','request','SendMail','email\x20sent','case\x20loading','currentAttempt','retries','job','data','operation','stop','case\x20completed','case\x20failed','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','then','report\x20status:','sendMail','Smtp','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','keyBy','toString','intersection','difference'];(function(_0x208d35,_0x310b06){var _0xc95619=function(_0x3dce4b){while(--_0x3dce4b){_0x208d35['push'](_0x208d35['shift']());}};_0xc95619(++_0x310b06);}(_0x8bca,0x145));var _0xa8bc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x8bca[_0x3e5086];return _0xfeb102;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xa8bc('0x0'));var _=require(_0xa8bc('0x1'));var moment=require(_0xa8bc('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xa8bc('0x3'));var BPromise=require(_0xa8bc('0x4'));var logger=require(_0xa8bc('0x5'))(_0xa8bc('0x6'));var db=require(_0xa8bc('0x7'))['db'];const retry=require(_0xa8bc('0x8'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xa8bc('0x9')][_0xa8bc('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x19195f){const _0x2f0692={};if(typeof _0x19195f===_0xa8bc('0xb')){_0x2f0692['id']=_0x19195f;}return db[_0xa8bc('0xc')][_0xa8bc('0xd')]({'where':_0x2f0692})['then'](function(_0x26e510){return _0x26e510;})[_0xa8bc('0xe')](function(_0x3c0dc7){logger['error'](_0x3c0dc7);});}function handleSendEmail(_0x5cbf9e,_0x9ad15){logger['info'](_0xa8bc('0xf'),_0x5cbf9e[_0xa8bc('0x10')]);var _0x105050=!![];var _0x31077c=_0x5cbf9e[_0xa8bc('0x11')][_0xa8bc('0x12')]();var _0x482597={'account':_0x31077c,'message':{'from':util[_0xa8bc('0x13')](_0xa8bc('0x14'),_0x5cbf9e['MailAccount']['name'],_0x5cbf9e['MailAccount'][_0xa8bc('0x10')]||_0x5cbf9e[_0xa8bc('0x11')]['Smtp'][_0xa8bc('0x15')]),'to':_0x5cbf9e[_0xa8bc('0x10')],'cc':_0x5cbf9e['cc'],'bcc':_0x5cbf9e[_0xa8bc('0x16')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x9ad15[_0xa8bc('0x17')],_0x5cbf9e[_0xa8bc('0x18')],_0x5cbf9e['subtractUnit'])}};var _0x215e49=path['join'](__dirname,'../../files/reports');var _0x17bc00=_0x9ad15[_0xa8bc('0x19')];var _0x12362d=util['format'](_0xa8bc('0x1a'),path[_0xa8bc('0x1b')](_0x9ad15['savename'],path[_0xa8bc('0x1c')](_0x9ad15[_0xa8bc('0x19')])),_0xa8bc('0x1d'));var _0x36c788=path[_0xa8bc('0x1e')](_0x215e49,_0x17bc00);var _0x21cc68=path[_0xa8bc('0x1e')](_0x215e49,_0x12362d);if(fs['existsSync'](_0x36c788)){_0x9ad15[_0xa8bc('0x1f')]='Sent';_0x482597[_0xa8bc('0x20')]['attachments']=[{'filename':_0x17bc00,'path':_0x36c788}];_0x482597[_0xa8bc('0x20')][_0xa8bc('0x21')]=util[_0xa8bc('0x13')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xa8bc('0x22')](_0x9ad15,null,0x2));}else if(fs[_0xa8bc('0x23')](_0x21cc68)){_0x9ad15[_0xa8bc('0x1f')]=_0xa8bc('0x24');_0x482597[_0xa8bc('0x20')][_0xa8bc('0x25')]=[{'filename':_0x12362d,'path':_0x21cc68}];}else{if(_0x9ad15['status']===_0xa8bc('0x26')){_0x482597[_0xa8bc('0x20')][_0xa8bc('0x21')]=_0xa8bc('0x27');if(!_0x5cbf9e[_0xa8bc('0x28')]){_0x105050=![];logger[_0xa8bc('0x29')](_0xa8bc('0x2a'));}}else if(_0x9ad15['status']==='Loading'){_0x482597[_0xa8bc('0x20')][_0xa8bc('0x21')]='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x9ad15['status']===_0xa8bc('0x2b')){_0x482597[_0xa8bc('0x20')][_0xa8bc('0x21')]=_0xa8bc('0x2c');}else if(_0x9ad15[_0xa8bc('0x1f')]==='Failed'){_0x482597[_0xa8bc('0x20')][_0xa8bc('0x21')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0xa8bc('0x2d')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x9ad15[_0xa8bc('0x1f')]);}}if(_0x105050){return client[_0xa8bc('0x2e')](_0xa8bc('0x2f'),_0x482597)['then'](function(_0x1116e4){if(_0x1116e4[_0xa8bc('0x2d')]){return logger['error']('error\x20mail',JSON['stringify'](_0x1116e4));}return logger[_0xa8bc('0x29')](_0xa8bc('0x30'));})[_0xa8bc('0xe')](function(_0x3000d9){return logger[_0xa8bc('0x2d')]('error\x20mail',JSON[_0xa8bc('0x22')](_0x3000d9));});}}function handleError(){return function(_0x8e2d1f){return logger['error'](JSON[_0xa8bc('0x22')](_0x8e2d1f));};}function loading(_0x13ad65){logger[_0xa8bc('0x29')](_0xa8bc('0x31'));if(_0x13ad65[_0xa8bc('0x32')]===_0x13ad65['retryOptions'][_0xa8bc('0x33')]){handleSendEmail(_0x13ad65[_0xa8bc('0x34')],_0x13ad65[_0xa8bc('0x35')]);_0x13ad65[_0xa8bc('0x36')][_0xa8bc('0x37')]();}else{_0x13ad65[_0xa8bc('0x36')][_0xa8bc('0x8')]('still\x20loading');}}function completed(_0x51d96e){logger[_0xa8bc('0x29')](_0xa8bc('0x38'));handleSendEmail(_0x51d96e[_0xa8bc('0x34')],_0x51d96e[_0xa8bc('0x35')]);_0x51d96e[_0xa8bc('0x36')][_0xa8bc('0x37')]();}function empty(_0x3b3900){logger['info']('case\x20empty');handleSendEmail(_0x3b3900[_0xa8bc('0x34')],_0x3b3900[_0xa8bc('0x35')]);_0x3b3900[_0xa8bc('0x36')][_0xa8bc('0x37')]();}function failed(_0x525e91){logger['info'](_0xa8bc('0x39'));handleSendEmail(_0x525e91['job'],_0x525e91[_0xa8bc('0x35')]);_0x525e91[_0xa8bc('0x36')][_0xa8bc('0x37')]();}function urecognized(_0x99e27b){logger[_0xa8bc('0x2d')]('Unrecognized\x20status:',_0x99e27b['entity'][_0xa8bc('0x3a')][_0xa8bc('0x1f')]);_0x99e27b[_0xa8bc('0x36')][_0xa8bc('0x37')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x1b8811,_0x3f90b0){const _0x2a94aa={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x3811b1=retry[_0xa8bc('0x36')](_0x2a94aa);_0x3811b1[_0xa8bc('0x3b')](_0x371e06=>{logger['info'](_0xa8bc('0x3c')+_0x1b8811['id']+_0xa8bc('0x3d')+_0x371e06);try{getReportData(_0x3f90b0['id'])[_0xa8bc('0x3e')](function(_0x4af98e){_0x3f90b0=_0x4af98e;logger['info'](_0xa8bc('0x3f'),_0x4af98e[_0xa8bc('0x3a')][_0xa8bc('0x1f')]);if(!reportStatusStrategies[_0x4af98e[_0xa8bc('0x3a')][_0xa8bc('0x1f')]]){logger[_0xa8bc('0x2d')](_0xa8bc('0x3f'),_0x4af98e[_0xa8bc('0x3a')][_0xa8bc('0x1f')]);_0x3811b1[_0xa8bc('0x8')]();}reportStatusStrategies[_0x4af98e[_0xa8bc('0x3a')][_0xa8bc('0x1f')]]({'operation':_0x3811b1,'currentAttempt':_0x371e06,'retryOptions':_0x2a94aa,'job':_0x1b8811,'data':_0x3f90b0,'entity':_0x4af98e});});}catch(_0xad11ac){_0x3811b1['retry'](_0xad11ac);}});}function handleResult(_0x240fcd){return function(_0x25aea7){if(_0x240fcd[_0xa8bc('0x40')]&&_0x240fcd[_0xa8bc('0x11')]&&_0x240fcd[_0xa8bc('0x11')][_0xa8bc('0x41')]&&!_['isNil'](_0x240fcd[_0xa8bc('0x10')])){retryer(_0x240fcd,_0x25aea7);}};}function handleJob(_0x1888e6){return function(){try{if(_[_0xa8bc('0x42')](_0x1888e6[_0xa8bc('0x18')])){return logger[_0xa8bc('0x29')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xa8bc('0x42')](_0x1888e6[_0xa8bc('0x43')])){return logger[_0xa8bc('0x29')](_0xa8bc('0x44'));}var _0x8074f3={'startDate':moment()['subtract'](_0x1888e6['subtractNumber'],_0x1888e6['subtractUnit'])[_0xa8bc('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xa8bc('0x13')](_0xa8bc('0x45')),'type':_0xa8bc('0x46'),'output':_0x1888e6[_0xa8bc('0x47')],'name':_0x1888e6['name']};if(!_[_0xa8bc('0x42')](_0x1888e6['DefaultReportId'])){logger[_0xa8bc('0x29')](_0xa8bc('0x48'),_0x1888e6['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x1888e6[_0xa8bc('0x49')]},_0x8074f3)[_0xa8bc('0x3e')](handleResult(_0x1888e6))['catch'](handleError());}if(!_['isNil'](_0x1888e6[_0xa8bc('0x4a')])){logger[_0xa8bc('0x29')](_0xa8bc('0x4b'),_0x1888e6[_0xa8bc('0x4a')]);return analyticCustomReportController['runReport']({'id':_0x1888e6[_0xa8bc('0x4a')]},_0x8074f3)[_0xa8bc('0x3e')](handleResult(_0x1888e6))['catch'](handleError());}}catch(_0x1adda0){logger[_0xa8bc('0x2d')](JSON[_0xa8bc('0x22')](_0x1adda0));}return logger[_0xa8bc('0x29')](_0xa8bc('0x4c'));};}function getJobs(_0x4e7728){var _0x1f471e={};if(_0x4e7728){_0x1f471e['id']=_0x4e7728;}return db[_0xa8bc('0x4d')][_0xa8bc('0x4e')]({'where':_0x1f471e,'include':[{'model':db[_0xa8bc('0x11')],'attributes':['id',_0xa8bc('0x17'),_0xa8bc('0x10')],'include':[{'model':db[_0xa8bc('0x4f')],'as':_0xa8bc('0x41'),'include':[{'model':db[_0xa8bc('0x50')],'as':_0xa8bc('0x50')}]}]}]})[_0xa8bc('0x3e')](function(_0x3d75bf){var _0x29afb4=_['keys'](manager[_0xa8bc('0x51')]);var _0x510970=_[_0xa8bc('0x52')](_0x3d75bf,function(_0x5ce951){return _0x5ce951['id']['toString']();});var _0x72d48=_[_0xa8bc('0x53')](_0x3d75bf,function(_0x2ab3f7){return _0x2ab3f7['id'][_0xa8bc('0x54')]();});var _0x4c5f18=_0x4e7728?_0x510970:_['difference'](_0x510970,_0x29afb4);var _0x38354d=_[_0xa8bc('0x55')](_0x510970,_0x29afb4);var _0x2bc6c3=_[_0xa8bc('0x56')](_0x29afb4,_0x510970);var _0xf0da1f;var _0x4e7add;for(_0xf0da1f=0x0;_0xf0da1f<_0x2bc6c3['length']&&!_0x4e7728;_0xf0da1f+=0x1){_0x4e7add=_0x2bc6c3[_0xf0da1f]['toString']();if(manager['exists'](_0x4e7add)){manager[_0xa8bc('0x37')](_0x4e7add);manager[_0xa8bc('0x57')](_0x4e7add);logger[_0xa8bc('0x29')]('delete\x20cron',_0x4e7add);}}logger[_0xa8bc('0x29')](_0xa8bc('0x58'),JSON['stringify'](_0x4c5f18));for(_0xf0da1f=0x0;_0xf0da1f<_0x4c5f18[_0xa8bc('0x59')];_0xf0da1f+=0x1){_0x4e7add=_0x4c5f18[_0xf0da1f][_0xa8bc('0x54')]();if(_0x4e7728){logger['info'](JSON[_0xa8bc('0x22')](_0x72d48[_0x4e7add]));BPromise['resolve']()[_0xa8bc('0x3e')](handleJob(_0x72d48[_0x4e7add]));logger[_0xa8bc('0x29')](_0xa8bc('0x5a'),_0x72d48[_0x4e7add][_0xa8bc('0x17')],_0x72d48[_0x4e7add][_0xa8bc('0x5b')]);}else if(_0x72d48[_0x4e7add][_0xa8bc('0x5b')]&&_0x72d48[_0x4e7add][_0xa8bc('0x5c')]&&moment()[_0xa8bc('0x5d')](_0x72d48[_0x4e7add][_0xa8bc('0x5e')],_0x72d48[_0x4e7add][_0xa8bc('0x5f')])){manager[_0xa8bc('0x60')](_0x4e7add,_0x72d48[_0x4e7add][_0xa8bc('0x5b')],handleJob(_0x72d48[_0x4e7add]));manager[_0xa8bc('0x61')](_0x4e7add);logger[_0xa8bc('0x29')](_0xa8bc('0x62'),_0x72d48[_0x4e7add]['name'],_0x72d48[_0x4e7add][_0xa8bc('0x5b')]);}else if(manager[_0xa8bc('0x63')](_0x4e7add)){manager[_0xa8bc('0x37')](_0x4e7add);manager['deleteJob'](_0x4e7add);logger[_0xa8bc('0x29')](_0xa8bc('0x64'),_0x72d48[_0x4e7add][_0xa8bc('0x17')],_0x72d48[_0x4e7add][_0xa8bc('0x5b')]);}}for(_0xf0da1f=0x0,_0x4e7add;_0xf0da1f<_0x38354d['length']&&!_0x4e7728;_0xf0da1f+=0x1){_0x4e7add=_0x38354d[_0xf0da1f][_0xa8bc('0x54')]();if(manager[_0xa8bc('0x63')](_0x4e7add)){if(_0x72d48[_0x4e7add][_0xa8bc('0x5b')]&&_0x72d48[_0x4e7add][_0xa8bc('0x5c')]&&moment()['isBetween'](_0x72d48[_0x4e7add][_0xa8bc('0x5e')],_0x72d48[_0x4e7add][_0xa8bc('0x5f')])){manager['update'](_0x4e7add,_0x72d48[_0x4e7add][_0xa8bc('0x5b')],handleJob(_0x72d48[_0x4e7add]));logger[_0xa8bc('0x29')](_0xa8bc('0x65'),_0x72d48[_0x4e7add][_0xa8bc('0x17')],_0x72d48[_0x4e7add][_0xa8bc('0x5b')]);}else{manager[_0xa8bc('0x37')](_0x4e7add);manager['deleteJob'](_0x4e7add);logger['info']('stop\x20cron',_0x72d48[_0x4e7add][_0xa8bc('0x17')],_0x72d48[_0x4e7add][_0xa8bc('0x5b')]);}}}})[_0xa8bc('0xe')](function(_0x3fb011){logger[_0xa8bc('0x2d')](JSON[_0xa8bc('0x22')](_0x3fb011));});}exports[_0xa8bc('0x66')]=function(_0x219004){return getJobs(_0x219004);};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 c8c7ce0..ad3b9bd 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 _0xf958=['Negative','Neutral','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeRegion','Transcribe\x20not\x20configured','transcribeAccountId','all','lodash','request-promise','bluebird','../../config/logger','transcribe','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Positive','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment'];(function(_0x4babee,_0x322671){var _0x4af828=function(_0xdc3cc){while(--_0xdc3cc){_0x4babee['push'](_0x4babee['shift']());}};_0x4af828(++_0x322671);}(_0xf958,0xe6));var _0x8f95=function(_0x547596,_0x4e1334){_0x547596=_0x547596-0x0;var _0x57a391=_0xf958[_0x547596];return _0x57a391;};var _=require(_0x8f95('0x0'));var AWS=require('aws-sdk');var rp=require(_0x8f95('0x1'));var util=require('util');var BPromise=require(_0x8f95('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x8f95('0x3'))(_0x8f95('0x4'));function getTranscriptionJob(_0x1aeb7b,_0x482c0c,_0x49d448,_0x32df52){return new Promise(function(_0x10a425,_0x281f38){var _0x5c2af8=new AWS['TranscribeService']({'accessKeyId':_0x482c0c,'secretAccessKey':_0x1aeb7b,'region':_0x49d448});_0x5c2af8[_0x8f95('0x5')]({'TranscriptionJobName':_0x32df52},function(_0x109bed,_0x435b5b){if(_0x109bed){return _0x281f38(_0x109bed);}else{return _0x10a425(_0x435b5b);}});});}function sentiment(_0x19cbd0,_0x3b695c,_0x585025,_0x378eb1,_0x604646){return new Promise(function(_0x56d8e2,_0x382f2c){var _0x4e97bd=new AWS[(_0x8f95('0x6'))]({'accessKeyId':_0x3b695c,'secretAccessKey':_0x19cbd0,'region':_0x585025});_0x4e97bd['detectSentiment']({'Text':_0x378eb1,'LanguageCode':_0x604646[_0x8f95('0x7')](0x0,0x2)},function(_0x3e7423,_0x3ffccb){if(_0x3e7423){return _0x382f2c(_0x3e7423);}else{return _0x56d8e2(_0x3ffccb);}});});}function checkTranscribeJob(_0x506b47,_0x464cff,_0x158a35){var _0x7fc65f;return new BPromise(function(_0x5d4acf,_0x19bcc8){logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0xa'),_0x506b47['id'],_0x506b47[_0x8f95('0xb')]));return getTranscriptionJob(_0x158a35[_0x8f95('0xc')],_0x158a35[_0x8f95('0xd')],_0x464cff['transcribeRegion'],_0x506b47['transcribeName'])['then'](function(_0x56e816){logger['info'](util[_0x8f95('0x9')](_0x8f95('0xe'),_0x506b47['id'],_0x506b47[_0x8f95('0xb')],_0x56e816[_0x8f95('0xf')]['TranscriptionJobStatus']));if(!_0x506b47['fileText']){switch(_0x56e816[_0x8f95('0xf')][_0x8f95('0x10')]){case'COMPLETED':var _0x445db0={'transcribeStatus':_0x56e816[_0x8f95('0xf')][_0x8f95('0x10')],'fileUri':_0x56e816[_0x8f95('0xf')]['Transcript'][_0x8f95('0x11')]};logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x12'),_0x506b47['id']));return rp({'uri':_0x56e816['TranscriptionJob']['Transcript'][_0x8f95('0x11')],'json':!![]})[_0x8f95('0x13')](function(_0x13e7c5){logger[_0x8f95('0x8')](util[_0x8f95('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x506b47['id']));if(_0x13e7c5&&_0x13e7c5[_0x8f95('0x14')]&&_0x13e7c5[_0x8f95('0x14')]['transcripts']&&_0x13e7c5[_0x8f95('0x14')][_0x8f95('0x15')]['length']){_0x445db0[_0x8f95('0x16')]='';for(var _0x4c96eb=0x0;_0x4c96eb<_0x13e7c5[_0x8f95('0x14')][_0x8f95('0x15')]['length'];_0x4c96eb++){_0x445db0[_0x8f95('0x16')]+=_0x13e7c5['results']['transcripts'][_0x4c96eb][_0x8f95('0x17')]+'';}}return _0x506b47['update'](_0x445db0);})[_0x8f95('0x13')](function(){logger['info'](util['format'](_0x8f95('0x18'),_0x506b47['id']));if(!_0x506b47['tempSentiment']){throw new db[(_0x8f95('0x19'))]['ValidationError'](_0x8f95('0x1a'));}if(!_0x464cff[_0x8f95('0x1b')]||!_0x464cff[_0x8f95('0x1c')]||!_0x464cff[_0x8f95('0x1d')]||!_0x464cff[_0x8f95('0x1e')]||!_0x464cff[_0x8f95('0x1f')]){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))](_0x8f95('0x21'));}if(!_0x445db0[_0x8f95('0x16')]){throw new Error(_0x8f95('0x22'));}if(_0x464cff['sentimentAccountId']===_0x158a35['id']){return _0x158a35;}else{return db[_0x8f95('0x23')][_0x8f95('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x511043){if(!_0x511043){throw new db[(_0x8f95('0x19'))]['ValidationError'](_0x8f95('0x25'));}if(!_0x511043['data1']||!_0x511043['data2']){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))](_0x8f95('0x26'));}_0x7fc65f=_0x511043;logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x27'),_0x506b47['id']));return sentiment(_0x7fc65f[_0x8f95('0xc')],_0x7fc65f[_0x8f95('0xd')],_0x464cff[_0x8f95('0x1d')],_0x445db0[_0x8f95('0x16')],_0x464cff['language']);})[_0x8f95('0x13')](function(_0x53e273){logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x28'),_0x506b47['id']));return _0x506b47[_0x8f95('0x29')]({'sentiment':_0x53e273['Sentiment'],'sPositive':_0x53e273[_0x8f95('0x2a')][_0x8f95('0x2b')],'sNegative':_0x53e273[_0x8f95('0x2a')]['Negative'],'sMixed':_0x53e273['SentimentScore'][_0x8f95('0x2c')],'sNeutral':_0x53e273[_0x8f95('0x2a')]['Neutral']});})[_0x8f95('0x13')](function(){logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x18'),_0x506b47['id']));_0x5d4acf();});case _0x8f95('0x2d'):return _0x506b47[_0x8f95('0x29')]({'transcribeStatus':_0x8f95('0x2d'),'failureReason':_0x56e816[_0x8f95('0xf')][_0x8f95('0x2e')]})[_0x8f95('0x13')](function(){logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x18'),_0x506b47['id']));_0x5d4acf();});default:logger[_0x8f95('0x8')](util['format'](_0x8f95('0x2f'),_0x506b47['id']));break;}}else{return BPromise[_0x8f95('0x30')]()[_0x8f95('0x13')](function(){if(!_0x506b47[_0x8f95('0x31')]){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))](_0x8f95('0x1a'));}if(!_0x464cff[_0x8f95('0x1b')]||!_0x464cff[_0x8f95('0x1c')]||!_0x464cff[_0x8f95('0x1d')]||!_0x464cff[_0x8f95('0x1e')]||!_0x464cff[_0x8f95('0x1f')]){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x506b47[_0x8f95('0x16')]){throw new Error(_0x8f95('0x22'));}if(_0x464cff[_0x8f95('0x1c')]===_0x158a35['id']){return _0x158a35;}else{return db[_0x8f95('0x23')][_0x8f95('0x24')]({'where':{'id':_settings[_0x8f95('0x1c')]}});}})[_0x8f95('0x13')](function(_0x423329){if(!_0x423329){throw new db['Sequelize'][(_0x8f95('0x20'))](_0x8f95('0x25'));}if(!_0x423329[_0x8f95('0xc')]||!_0x423329[_0x8f95('0xd')]){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x7fc65f=_0x423329;logger[_0x8f95('0x8')](util[_0x8f95('0x9')](_0x8f95('0x27'),_0x506b47['id']));return sentiment(_0x7fc65f[_0x8f95('0xc')],_0x7fc65f['data2'],_0x464cff['sentimentRegion'],_0x506b47['fileText'],_0x464cff[_0x8f95('0x1e')]);})[_0x8f95('0x13')](function(_0x50f94a){logger[_0x8f95('0x8')](util['format'](_0x8f95('0x28'),_0x506b47['id']));return _0x506b47[_0x8f95('0x29')]({'sentiment':_0x50f94a['Sentiment'],'sPositive':_0x50f94a[_0x8f95('0x2a')][_0x8f95('0x2b')],'sNegative':_0x50f94a[_0x8f95('0x2a')][_0x8f95('0x32')],'sMixed':_0x50f94a[_0x8f95('0x2a')][_0x8f95('0x2c')],'sNeutral':_0x50f94a[_0x8f95('0x2a')][_0x8f95('0x33')],'transcribeStatus':_0x8f95('0x34')});})[_0x8f95('0x13')](function(){logger['info'](util[_0x8f95('0x9')](_0x8f95('0x18'),_0x506b47['id']));_0x5d4acf();});}})[_0x8f95('0x35')](function(_0x335940){if(_0x335940){if(!_0x335940[_0x8f95('0x36')]||_0x335940[_0x8f95('0x36')]!==_0x8f95('0x37')){logger[_0x8f95('0x38')](util[_0x8f95('0x9')](_0x8f95('0x39'),_0x506b47['id']),util[_0x8f95('0x3a')](_0x335940,{'showHidden':![],'depth':null}));}}_0x5d4acf();});});}function checkTranscribe(){var _0x704c2a;var _0x55f9ae;var _0x335201;return db[_0x8f95('0x3b')][_0x8f95('0x3c')]({'where':{'transcribeStatus':_0x8f95('0x3d')}})[_0x8f95('0x13')](function(_0x4065a8){if(!_0x4065a8||!_0x4065a8[_0x8f95('0x3e')]){throw new db['Sequelize'][(_0x8f95('0x20'))](_0x8f95('0x3f'));}_0x704c2a=_0x4065a8;return db[_0x8f95('0x40')][_0x8f95('0x24')]({'where':{'id':0x1}});})[_0x8f95('0x13')](function(_0x489813){if(!_0x489813){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))](_0x8f95('0x41'));}_0x55f9ae=_0x489813;if(!_0x55f9ae[_0x8f95('0x4')]||!_0x55f9ae['transcribeAccountId']||!_0x55f9ae[_0x8f95('0x42')]||!_0x55f9ae[_0x8f95('0x1e')]||!_0x55f9ae[_0x8f95('0x1f')]){throw new db[(_0x8f95('0x19'))]['ValidationError'](_0x8f95('0x43'));}return db[_0x8f95('0x23')][_0x8f95('0x24')]({'where':{'id':_0x55f9ae[_0x8f95('0x44')]}});})[_0x8f95('0x13')](function(_0x43b175){if(!_0x43b175){throw new db[(_0x8f95('0x19'))][(_0x8f95('0x20'))](_0x8f95('0x25'));}if(!_0x43b175[_0x8f95('0xc')]||!_0x43b175[_0x8f95('0xd')]){throw new db['Sequelize']['ValidationError'](_0x8f95('0x26'));}_0x335201=_0x43b175;var _0x36d15b=[];_0x704c2a['forEach'](function(_0x24545f){_0x36d15b['push'](checkTranscribeJob(_0x24545f,_0x55f9ae,_0x335201));});return BPromise[_0x8f95('0x45')](_0x36d15b);})[_0x8f95('0x35')](function(_0x4b3c05){if(_0x4b3c05){if(!_0x4b3c05['name']||_0x4b3c05[_0x8f95('0x36')]!==_0x8f95('0x37')){logger['error'](util[_0x8f95('0x3a')](_0x4b3c05,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x58e5=['[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','transcript','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Positive','Mixed','catch','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','forEach','push','all','name','SequelizeValidationError','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','info'];(function(_0x7d5a8b,_0x2aedef){var _0x56ac46=function(_0x55a1ab){while(--_0x55a1ab){_0x7d5a8b['push'](_0x7d5a8b['shift']());}};_0x56ac46(++_0x2aedef);}(_0x58e5,0xd1));var _0x558e=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x58e5[_0x2235bf];return _0x4c3a64;};var _=require(_0x558e('0x0'));var AWS=require(_0x558e('0x1'));var rp=require(_0x558e('0x2'));var util=require(_0x558e('0x3'));var BPromise=require(_0x558e('0x4'));var db=require(_0x558e('0x5'))['db'];var logger=require('../../config/logger')(_0x558e('0x6'));function getTranscriptionJob(_0x550dd2,_0x4959f0,_0xd66d13,_0x58497f){return new Promise(function(_0x33bcd4,_0x586bfa){var _0x2887fe=new AWS[(_0x558e('0x7'))]({'accessKeyId':_0x4959f0,'secretAccessKey':_0x550dd2,'region':_0xd66d13});_0x2887fe['getTranscriptionJob']({'TranscriptionJobName':_0x58497f},function(_0x58c368,_0x5a26b8){if(_0x58c368){return _0x586bfa(_0x58c368);}else{return _0x33bcd4(_0x5a26b8);}});});}function sentiment(_0x537f9f,_0x4d0fa3,_0x29c7ac,_0x8b89a,_0x5d1e17){return new Promise(function(_0x56342b,_0x289317){var _0x12be93=new AWS[(_0x558e('0x8'))]({'accessKeyId':_0x4d0fa3,'secretAccessKey':_0x537f9f,'region':_0x29c7ac});_0x12be93['detectSentiment']({'Text':_0x8b89a,'LanguageCode':_0x5d1e17[_0x558e('0x9')](0x0,0x2)},function(_0x4e29bd,_0xe180b0){if(_0x4e29bd){return _0x289317(_0x4e29bd);}else{return _0x56342b(_0xe180b0);}});});}function checkTranscribeJob(_0x2158f2,_0x1328b5,_0x3bd154){var _0x4a0889;return new BPromise(function(_0x407afd,_0xe70393){logger['info'](util[_0x558e('0xa')](_0x558e('0xb'),_0x2158f2['id'],_0x2158f2['transcribeName']));return getTranscriptionJob(_0x3bd154[_0x558e('0xc')],_0x3bd154['data2'],_0x1328b5[_0x558e('0xd')],_0x2158f2[_0x558e('0xe')])['then'](function(_0x21552c){logger[_0x558e('0xf')](util[_0x558e('0xa')](_0x558e('0x10'),_0x2158f2['id'],_0x2158f2['transcribeName'],_0x21552c[_0x558e('0x11')][_0x558e('0x12')]));if(!_0x2158f2[_0x558e('0x13')]){switch(_0x21552c[_0x558e('0x11')][_0x558e('0x12')]){case _0x558e('0x14'):var _0x392258={'transcribeStatus':_0x21552c['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x21552c[_0x558e('0x11')][_0x558e('0x15')][_0x558e('0x16')]};logger[_0x558e('0xf')](util[_0x558e('0xa')](_0x558e('0x17'),_0x2158f2['id']));return rp({'uri':_0x21552c[_0x558e('0x11')][_0x558e('0x15')][_0x558e('0x16')],'json':!![]})[_0x558e('0x18')](function(_0x4c402d){logger[_0x558e('0xf')](util[_0x558e('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x2158f2['id']));if(_0x4c402d&&_0x4c402d['results']&&_0x4c402d[_0x558e('0x19')][_0x558e('0x1a')]&&_0x4c402d[_0x558e('0x19')][_0x558e('0x1a')]['length']){_0x392258[_0x558e('0x13')]='';for(var _0xb9c059=0x0;_0xb9c059<_0x4c402d['results'][_0x558e('0x1a')]['length'];_0xb9c059++){_0x392258[_0x558e('0x13')]+=_0x4c402d[_0x558e('0x19')][_0x558e('0x1a')][_0xb9c059][_0x558e('0x1b')]+'';}}return _0x2158f2['update'](_0x392258);})['then'](function(){logger[_0x558e('0xf')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2158f2['id']));if(!_0x2158f2[_0x558e('0x1c')]){throw new db[(_0x558e('0x1d'))][(_0x558e('0x1e'))](_0x558e('0x1f'));}if(!_0x1328b5[_0x558e('0x20')]||!_0x1328b5['sentimentAccountId']||!_0x1328b5[_0x558e('0x21')]||!_0x1328b5[_0x558e('0x22')]||!_0x1328b5[_0x558e('0x23')]){throw new db['Sequelize'][(_0x558e('0x1e'))](_0x558e('0x24'));}if(!_0x392258[_0x558e('0x13')]){throw new Error(_0x558e('0x25'));}if(_0x1328b5[_0x558e('0x26')]===_0x3bd154['id']){return _0x3bd154;}else{return db[_0x558e('0x27')][_0x558e('0x28')]({'where':{'id':_settings[_0x558e('0x26')]}});}})[_0x558e('0x18')](function(_0x1f8997){if(!_0x1f8997){throw new db['Sequelize'][(_0x558e('0x1e'))](_0x558e('0x29'));}if(!_0x1f8997[_0x558e('0xc')]||!_0x1f8997[_0x558e('0x2a')]){throw new db['Sequelize']['ValidationError'](_0x558e('0x2b'));}_0x4a0889=_0x1f8997;logger[_0x558e('0xf')](util[_0x558e('0xa')](_0x558e('0x2c'),_0x2158f2['id']));return sentiment(_0x4a0889['data1'],_0x4a0889['data2'],_0x1328b5[_0x558e('0x21')],_0x392258[_0x558e('0x13')],_0x1328b5[_0x558e('0x22')]);})[_0x558e('0x18')](function(_0x44c604){logger[_0x558e('0xf')](util[_0x558e('0xa')](_0x558e('0x2d'),_0x2158f2['id']));return _0x2158f2[_0x558e('0x2e')]({'sentiment':_0x44c604[_0x558e('0x2f')],'sPositive':_0x44c604[_0x558e('0x30')]['Positive'],'sNegative':_0x44c604[_0x558e('0x30')][_0x558e('0x31')],'sMixed':_0x44c604['SentimentScore']['Mixed'],'sNeutral':_0x44c604['SentimentScore'][_0x558e('0x32')]});})[_0x558e('0x18')](function(){logger['info'](util[_0x558e('0xa')](_0x558e('0x33'),_0x2158f2['id']));_0x407afd();});case _0x558e('0x34'):return _0x2158f2[_0x558e('0x2e')]({'transcribeStatus':'FAILED','failureReason':_0x21552c[_0x558e('0x11')][_0x558e('0x35')]})['then'](function(){logger['info'](util[_0x558e('0xa')](_0x558e('0x33'),_0x2158f2['id']));_0x407afd();});default:logger['info'](util[_0x558e('0xa')](_0x558e('0x36'),_0x2158f2['id']));break;}}else{return BPromise[_0x558e('0x37')]()['then'](function(){if(!_0x2158f2[_0x558e('0x1c')]){throw new db[(_0x558e('0x1d'))][(_0x558e('0x1e'))](_0x558e('0x1f'));}if(!_0x1328b5[_0x558e('0x20')]||!_0x1328b5[_0x558e('0x26')]||!_0x1328b5[_0x558e('0x21')]||!_0x1328b5[_0x558e('0x22')]||!_0x1328b5[_0x558e('0x23')]){throw new db['Sequelize'][(_0x558e('0x1e'))](_0x558e('0x24'));}if(!_0x2158f2[_0x558e('0x13')]){throw new Error(_0x558e('0x25'));}if(_0x1328b5[_0x558e('0x26')]===_0x3bd154['id']){return _0x3bd154;}else{return db[_0x558e('0x27')][_0x558e('0x28')]({'where':{'id':_settings[_0x558e('0x26')]}});}})[_0x558e('0x18')](function(_0x3079b9){if(!_0x3079b9){throw new db[(_0x558e('0x1d'))][(_0x558e('0x1e'))](_0x558e('0x29'));}if(!_0x3079b9['data1']||!_0x3079b9[_0x558e('0x2a')]){throw new db[(_0x558e('0x1d'))][(_0x558e('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x4a0889=_0x3079b9;logger[_0x558e('0xf')](util[_0x558e('0xa')](_0x558e('0x2c'),_0x2158f2['id']));return sentiment(_0x4a0889['data1'],_0x4a0889[_0x558e('0x2a')],_0x1328b5[_0x558e('0x21')],_0x2158f2[_0x558e('0x13')],_0x1328b5[_0x558e('0x22')]);})[_0x558e('0x18')](function(_0x1c7ec4){logger[_0x558e('0xf')](util[_0x558e('0xa')](_0x558e('0x2d'),_0x2158f2['id']));return _0x2158f2[_0x558e('0x2e')]({'sentiment':_0x1c7ec4[_0x558e('0x2f')],'sPositive':_0x1c7ec4[_0x558e('0x30')][_0x558e('0x38')],'sNegative':_0x1c7ec4[_0x558e('0x30')]['Negative'],'sMixed':_0x1c7ec4[_0x558e('0x30')][_0x558e('0x39')],'sNeutral':_0x1c7ec4['SentimentScore'][_0x558e('0x32')],'transcribeStatus':'COMPLETED'});})[_0x558e('0x18')](function(){logger[_0x558e('0xf')](util[_0x558e('0xa')](_0x558e('0x33'),_0x2158f2['id']));_0x407afd();});}})[_0x558e('0x3a')](function(_0xc6ecb9){if(_0xc6ecb9){if(!_0xc6ecb9['name']||_0xc6ecb9['name']!=='SequelizeValidationError'){logger['error'](util[_0x558e('0xa')](_0x558e('0x3b'),_0x2158f2['id']),util[_0x558e('0x3c')](_0xc6ecb9,{'showHidden':![],'depth':null}));}}_0x407afd();});});}function checkTranscribe(){var _0x2b5448;var _0x57c3f0;var _0x195801;return db[_0x558e('0x3d')][_0x558e('0x3e')]({'where':{'transcribeStatus':_0x558e('0x3f')}})[_0x558e('0x18')](function(_0x1019b7){if(!_0x1019b7||!_0x1019b7[_0x558e('0x40')]){throw new db[(_0x558e('0x1d'))]['ValidationError'](_0x558e('0x41'));}_0x2b5448=_0x1019b7;return db[_0x558e('0x42')][_0x558e('0x28')]({'where':{'id':0x1}});})['then'](function(_0x1cdaa6){if(!_0x1cdaa6){throw new db[(_0x558e('0x1d'))][(_0x558e('0x1e'))]('Settings\x20not\x20available');}_0x57c3f0=_0x1cdaa6;if(!_0x57c3f0['transcribe']||!_0x57c3f0[_0x558e('0x43')]||!_0x57c3f0[_0x558e('0xd')]||!_0x57c3f0[_0x558e('0x22')]||!_0x57c3f0[_0x558e('0x23')]){throw new db[(_0x558e('0x1d'))][(_0x558e('0x1e'))]('Transcribe\x20not\x20configured');}return db['CloudProvider']['findOne']({'where':{'id':_0x57c3f0[_0x558e('0x43')]}});})[_0x558e('0x18')](function(_0x4cd46f){if(!_0x4cd46f){throw new db[(_0x558e('0x1d'))][(_0x558e('0x1e'))](_0x558e('0x29'));}if(!_0x4cd46f[_0x558e('0xc')]||!_0x4cd46f['data2']){throw new db[(_0x558e('0x1d'))]['ValidationError'](_0x558e('0x2b'));}_0x195801=_0x4cd46f;var _0x4482d6=[];_0x2b5448[_0x558e('0x44')](function(_0x1d879d){_0x4482d6[_0x558e('0x45')](checkTranscribeJob(_0x1d879d,_0x57c3f0,_0x195801));});return BPromise[_0x558e('0x46')](_0x4482d6);})[_0x558e('0x3a')](function(_0x45a5de){if(_0x45a5de){if(!_0x45a5de[_0x558e('0x47')]||_0x45a5de['name']!==_0x558e('0x48')){logger[_0x558e('0x49')](util[_0x558e('0x3c')](_0x45a5de,{'showHidden':![],'depth':null}));}}});}exports[_0x558e('0x4a')]=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 32e4be8..c50996e 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 _0xbe6e=['error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','lastMsgAt','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0xbe6e,0x1ce));var _0xebe6=function(_0x2b0d37,_0x3abf27){_0x2b0d37=_0x2b0d37-0x0;var _0x4272bf=_0xbe6e[_0x2b0d37];return _0x4272bf;};'use strict';var _=require('lodash');var moment=require(_0xebe6('0x0'));var Redis=require(_0xebe6('0x1'));var util=require(_0xebe6('0x2'));var config=require(_0xebe6('0x3'));var db=require(_0xebe6('0x4'))['db'];var logger=require('../logger')(_0xebe6('0x5'));config[_0xebe6('0x6')]=_[_0xebe6('0x7')](config[_0xebe6('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xebe6('0x8'))(new Redis(config[_0xebe6('0x6')]));function closeInteractions(){var _0x323e94=[];return db[_0xebe6('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xebe6('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xebe6('0xb'))}}})[_0xebe6('0xc')](function(_0x160982){if(_0x160982&&_0x160982[_0xebe6('0xd')]){_0x323e94=_[_0xebe6('0xe')](_0x160982||[],'id');logger['info'](_0xebe6('0xf'),_0x323e94[_0xebe6('0x10')]());return db[_0xebe6('0x9')][_0xebe6('0x11')]({'closeReason':_0xebe6('0x12'),'disposition':_0xebe6('0x13'),'closed':!![],'closedAt':moment()[_0xebe6('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x323e94}});}})[_0xebe6('0xc')](function(){if(_0x323e94&&_0x323e94['length']){logger['info'](_0xebe6('0x15'),_0x323e94['join']());for(var _0x3645df=0x0;_0x3645df<_0x323e94['length'];_0x3645df++){io['emit'](_0xebe6('0x16'),{'id':_0x323e94[_0x3645df],'closed':!![]});}}})[_0xebe6('0x17')](function(_0x1f3b26){logger[_0xebe6('0x18')](_0xebe6('0x19'),_0x1f3b26?util[_0xebe6('0x1a')](_0x1f3b26,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1dbb=['whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','defaults','redis','WhatsappInteraction','findAll','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit'];(function(_0x134dfc,_0x1b5684){var _0x354c1c=function(_0x630c2c){while(--_0x630c2c){_0x134dfc['push'](_0x134dfc['shift']());}};_0x354c1c(++_0x1b5684);}(_0x1dbb,0xed));var _0xb1db=function(_0x3cc043,_0x113774){_0x3cc043=_0x3cc043-0x0;var _0x52f12a=_0x1dbb[_0x3cc043];return _0x52f12a;};'use strict';var _=require(_0xb1db('0x0'));var moment=require(_0xb1db('0x1'));var Redis=require(_0xb1db('0x2'));var util=require('util');var config=require(_0xb1db('0x3'));var db=require(_0xb1db('0x4'))['db'];var logger=require('../logger')(_0xb1db('0x5'));config['redis']=_[_0xb1db('0x6')](config[_0xb1db('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb1db('0x7')]));function closeInteractions(){var _0x1d1a16=[];return db[_0xb1db('0x8')][_0xb1db('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb1db('0xa')](0x18,_0xb1db('0xb'))}}})[_0xb1db('0xc')](function(_0x4823b3){if(_0x4823b3&&_0x4823b3[_0xb1db('0xd')]){_0x1d1a16=_[_0xb1db('0xe')](_0x4823b3||[],'id');logger[_0xb1db('0xf')](_0xb1db('0x10'),_0x1d1a16[_0xb1db('0x11')]());return db['WhatsappInteraction'][_0xb1db('0x12')]({'closeReason':_0xb1db('0x13'),'disposition':_0xb1db('0x14'),'closed':!![],'closedAt':moment()[_0xb1db('0x15')](_0xb1db('0x16'))},{'where':{'id':_0x1d1a16}});}})['then'](function(){if(_0x1d1a16&&_0x1d1a16['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x1d1a16[_0xb1db('0x11')]());for(var _0x1a494f=0x0;_0x1a494f<_0x1d1a16['length'];_0x1a494f++){io[_0xb1db('0x17')](_0xb1db('0x18'),{'id':_0x1d1a16[_0x1a494f],'closed':!![]});}}})[_0xb1db('0x19')](function(_0x869b49){logger[_0xb1db('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x869b49?util[_0xb1db('0x1b')](_0x869b49,{'showHidden':![],'depth':null}):'');});}exports[_0xb1db('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 625266a..d85608f 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b67=['innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo'];(function(_0x2395f2,_0x21b369){var _0x3e1a70=function(_0x5984cc){while(--_0x5984cc){_0x2395f2['push'](_0x2395f2['shift']());}};_0x3e1a70(++_0x21b369);}(_0x7b67,0x1be));var _0x77b6=function(_0x4125dc,_0x5e08fa){_0x4125dc=_0x4125dc-0x0;var _0x226e9d=_0x7b67[_0x4125dc];return _0x226e9d;};'use strict';var util=require(_0x77b6('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x77b6('0x1')]({'id':i,'firstName':_0x77b6('0x2')+i,'lastName':_0x77b6('0x3')+i,'phone':0xf879fb460+i,'email':_0x77b6('0x4')+i+_0x77b6('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x77b6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x77b6('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x77b6('0x1')]({'id':i,'firstName':_0x77b6('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x77b6('0x4')+i+_0x77b6('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x77b6('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x77b6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x77b6('0x6')](),'updatedAt':Date[_0x77b6('0x6')]()});}db[_0x77b6('0x7')][_0x77b6('0x8')]({'where':{}})[_0x77b6('0x9')](function(){return db['CmContact'][_0x77b6('0xa')](contacts);})[_0x77b6('0x9')](function(){console[_0x77b6('0xb')](_0x77b6('0xc'),'contacts1');return db[_0x77b6('0xd')][_0x77b6('0x8')]({'where':{}});})[_0x77b6('0x9')](function(){return db[_0x77b6('0xd')][_0x77b6('0xa')](hopper);})['then'](function(){console[_0x77b6('0xb')]('finished\x20populating',_0x77b6('0xe'));return db[_0x77b6('0x7')][_0x77b6('0xa')](contacts2);})[_0x77b6('0x9')](function(){console['log'](_0x77b6('0xc'),_0x77b6('0xf'));return db[_0x77b6('0xd')][_0x77b6('0xa')](hopper2);})['then'](function(){console[_0x77b6('0xb')](_0x77b6('0xc'),_0x77b6('0x10'));})[_0x77b6('0x11')](function(_0x655bb2){console['log'](_0x655bb2);}); \ No newline at end of file +var _0xefe6=['innocenzo.biondo','now','destroy','then','CmContact','bulkCreate','log','finished\x20populating','CmHopper','hopper1','hopper2','catch','util','push','Innocenzo','Biondo'];(function(_0x5c2cf4,_0x125044){var _0x56124b=function(_0x540529){while(--_0x540529){_0x5c2cf4['push'](_0x5c2cf4['shift']());}};_0x56124b(++_0x125044);}(_0xefe6,0x14c));var _0x6efe=function(_0x1b1ed8,_0x2b0f38){_0x1b1ed8=_0x1b1ed8-0x0;var _0x33e1d6=_0xefe6[_0x1b1ed8];return _0x33e1d6;};'use strict';var util=require(_0x6efe('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6efe('0x1')]({'id':i,'firstName':_0x6efe('0x2')+i,'lastName':_0x6efe('0x3')+i,'phone':0xf879fb460+i,'email':_0x6efe('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6efe('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x6efe('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6efe('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6efe('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x6efe('0x3')+i,'phone':0xf879fb460+i,'email':_0x6efe('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6efe('0x1')]({'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[_0x6efe('0x5')]()});}db['CmContact'][_0x6efe('0x6')]({'where':{}})[_0x6efe('0x7')](function(){return db[_0x6efe('0x8')][_0x6efe('0x9')](contacts);})[_0x6efe('0x7')](function(){console[_0x6efe('0xa')](_0x6efe('0xb'),'contacts1');return db['CmHopper'][_0x6efe('0x6')]({'where':{}});})['then'](function(){return db[_0x6efe('0xc')]['bulkCreate'](hopper);})[_0x6efe('0x7')](function(){console[_0x6efe('0xa')](_0x6efe('0xb'),_0x6efe('0xd'));return db['CmContact'][_0x6efe('0x9')](contacts2);})[_0x6efe('0x7')](function(){console[_0x6efe('0xa')]('finished\x20populating','contacts2');return db[_0x6efe('0xc')][_0x6efe('0x9')](hopper2);})['then'](function(){console[_0x6efe('0xa')](_0x6efe('0xb'),_0x6efe('0xe'));})[_0x6efe('0xf')](function(_0x55ebbd){console[_0x6efe('0xa')](_0x55ebbd);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 265c168..78db97e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9132=['agent','%s%s@xcally.com','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','../mysqldb','push','format','%s%s'];(function(_0x42a737,_0x3a81dd){var _0x51788b=function(_0x373cd3){while(--_0x373cd3){_0x42a737['push'](_0x42a737['shift']());}};_0x51788b(++_0x3a81dd);}(_0x9132,0x176));var _0x2913=function(_0x12b04a,_0x11c94c){_0x12b04a=_0x12b04a-0x0;var _0x377bdb=_0x9132[_0x12b04a];return _0x377bdb;};'use strict';var util=require('util');var db=require(_0x2913('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2913('0x1')]({'name':util[_0x2913('0x2')](_0x2913('0x3'),_0x2913('0x4'),i),'fullname':util[_0x2913('0x2')]('%s%s',_0x2913('0x4'),i),'email':util[_0x2913('0x2')](_0x2913('0x5'),_0x2913('0x4'),i),'role':_0x2913('0x4'),'password':'password','internal':0xfa0+i,'type':_0x2913('0x6'),'transport':[_0x2913('0x7'),'ws',_0x2913('0x8')],'disallow':[_0x2913('0x9')],'allow':[_0x2913('0xa')],'defaultuser':util['format']('%s%s',_0x2913('0x4'),i),'encryption':'yes','avpf':_0x2913('0xb'),'force_avp':_0x2913('0xb'),'icesupport':_0x2913('0xb'),'dtlsenable':_0x2913('0xb'),'dtlsverify':'no','dtlscertfile':_0x2913('0xc'),'dtlsprivatekey':_0x2913('0xd'),'dtlssetup':_0x2913('0xe'),'callerid':util[_0x2913('0x2')](_0x2913('0xf'),util[_0x2913('0x2')](_0x2913('0x3'),_0x2913('0x4'),i),0xfa0+i)});}db[_0x2913('0x10')][_0x2913('0x11')](users)['then'](function(){console[_0x2913('0x12')](_0x2913('0x13'));})[_0x2913('0x14')](function(_0x3784aa){console['log'](_0x3784aa);}); \ No newline at end of file +var _0x00c7=['util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','add\x20user','log'];(function(_0x52883a,_0x33b491){var _0x37f3a9=function(_0x25d5b5){while(--_0x25d5b5){_0x52883a['push'](_0x52883a['shift']());}};_0x37f3a9(++_0x33b491);}(_0x00c7,0xab));var _0x700c=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x00c7[_0x1558ab];return _0x53b64a;};'use strict';var util=require(_0x700c('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x700c('0x1')]({'name':util[_0x700c('0x2')](_0x700c('0x3'),_0x700c('0x4'),i),'fullname':util[_0x700c('0x2')]('%s%s',_0x700c('0x4'),i),'email':util[_0x700c('0x2')](_0x700c('0x5'),_0x700c('0x4'),i),'role':_0x700c('0x4'),'password':_0x700c('0x6'),'internal':0xfa0+i,'type':_0x700c('0x7'),'transport':['udp','ws',_0x700c('0x8')],'disallow':[_0x700c('0x9')],'allow':['ulaw'],'defaultuser':util['format'](_0x700c('0x3'),_0x700c('0x4'),i),'encryption':'yes','avpf':_0x700c('0xa'),'force_avp':'yes','icesupport':_0x700c('0xa'),'dtlsenable':_0x700c('0xa'),'dtlsverify':'no','dtlscertfile':_0x700c('0xb'),'dtlsprivatekey':_0x700c('0xc'),'dtlssetup':_0x700c('0xd'),'callerid':util[_0x700c('0x2')]('\x22%s\x22\x20<%s>',util[_0x700c('0x2')]('%s%s',_0x700c('0x4'),i),0xfa0+i)});}db[_0x700c('0xe')][_0x700c('0xf')](users)[_0x700c('0x10')](function(){console['log'](_0x700c('0x11'));})['catch'](function(_0x2d8be0){console[_0x700c('0x12')](_0x2d8be0);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index bad0864..d6f1dfd 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83de=['VoiceQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','then','map','resourceId','where','Campaign','format','%s:queue:%s','length','user:%s','query','find','role','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','ChatQueues','userProfileId','ChatQueue','MailQueues','MailQueue','agent','getChatQueues','getSmsQueues','getWhatsappQueues','all','voice','chat','mail','whatsapp','telephone:%s','trunk:%s','leave','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','./environment','Agents','User','name','telephone','type','ivr','autoAssociation'];(function(_0x23ca3a,_0xe44c43){var _0x5c1aab=function(_0x29bcdd){while(--_0x29bcdd){_0x23ca3a['push'](_0x23ca3a['shift']());}};_0x5c1aab(++_0xe44c43);}(_0x83de,0x116));var _0xe83d=function(_0x4e2e00,_0x2fda72){_0x4e2e00=_0x4e2e00-0x0;var _0x197ba8=_0x83de[_0x4e2e00];return _0x197ba8;};'use strict';var _=require('lodash');var util=require(_0xe83d('0x0'));var BPromise=require('bluebird');var db=require(_0xe83d('0x1'))['db'];var config=require(_0xe83d('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xe83d('0x3'),'model':db[_0xe83d('0x4')],'attributes':['id',_0xe83d('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe83d('0x5')],'where':{'role':_0xe83d('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe83d('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xe83d('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xe83d('0x7')],'where':{'type':_0xe83d('0x8')}};function getAssociatedResources(_0xa747c0,_0x4d2aa0,_0x1527f5){return db['UserProfileSection']['findOne']({'where':{'name':_0xa747c0,'userProfileId':_0x4d2aa0},'raw':!![]})['then'](function(_0x34dd26){if(_0x34dd26){if(_0x34dd26[_0xe83d('0x9')]){switch(_0xa747c0){case _0xe83d('0xa'):case'ChatQueues':case _0xe83d('0xb'):case _0xe83d('0xc'):case'MailQueues':case _0xe83d('0xd'):case'WhatsappQueues':return db[_0x1527f5][_0xe83d('0xe')](queryQueues);case _0xe83d('0xf'):return db[_0x1527f5][_0xe83d('0xe')](queryTelephones);case _0xe83d('0x10'):return db[_0x1527f5][_0xe83d('0xe')](queryTrunks);case _0xe83d('0x11'):return db[_0x1527f5][_0xe83d('0xe')](queryCampaigns);}}else{return db[_0xe83d('0x12')][_0xe83d('0xe')]({'attributes':['resourceId'],'where':{'sectionId':_0x34dd26['id']},'raw':!![]})[_0xe83d('0x13')](function(_0x4c707d){if(_0x4c707d){var _0x36487e={'where':{'id':_[_0xe83d('0x14')](_0x4c707d,_0xe83d('0x15'))},'raw':!![]};switch(_0x1527f5){case _0xe83d('0x4'):_0x36487e[_0xe83d('0x16')]['role']=_0xe83d('0x6');break;case _0xe83d('0x17'):_0x36487e[_0xe83d('0x16')][_0xe83d('0x7')]=_0xe83d('0x8');break;}return db[_0x1527f5][_0xe83d('0xe')](_0x36487e);}else{return[];}});}}else{return[];}})[_0xe83d('0x13')](function(_0x550f4f){return _0x550f4f;});}function joinOrLeaveQueues(_0xb2f3c3,_0x3e3dc1,_0x576a8d,_0x250b41){_0xb2f3c3[_0x3e3dc1](util[_0xe83d('0x18')](_0xe83d('0x19'),_0x576a8d,_0x250b41['name']));if(_0x250b41['Agents']){for(var _0xb4b46e=0x0;_0xb4b46e<_0x250b41[_0xe83d('0x3')][_0xe83d('0x1a')];_0xb4b46e+=0x1){_0xb2f3c3[_0x3e3dc1](util[_0xe83d('0x18')](_0xe83d('0x1b'),_0x250b41['Agents'][_0xb4b46e][_0xe83d('0x5')]));}}}function joinOrLeave(_0x12bcbf,_0x254551,_0x4ea9eb){var _0x1dff3f;if(_0x12bcbf['handshake'][_0xe83d('0x1c')]['id']){db[_0xe83d('0x4')][_0xe83d('0x1d')]({'attributes':['id',_0xe83d('0x5'),_0xe83d('0x1e'),'userProfileId'],'where':{'id':_0x12bcbf['handshake']['query']['id']},'include':[{'model':db[_0xe83d('0x1f')],'as':_0xe83d('0x20'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xe83d('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xe83d('0x22')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe83d('0x23')],'as':_0xe83d('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xe83d('0x25')],'as':_0xe83d('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xe83d('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x2afbab){if(_0x2afbab){_0x1dff3f=_0x2afbab;_0x12bcbf[_0x254551](util[_0xe83d('0x18')](_0xe83d('0x1b'),_0x2afbab[_0xe83d('0x5')]));var _0x4083b0=[];switch(_0x2afbab[_0xe83d('0x1e')]){case _0xe83d('0x28'):_0x12bcbf[_0x254551](_0xe83d('0x29'));_0x12bcbf[_0x254551]('voice:outbound');if(queryQueues[_0xe83d('0x2a')](_0xe83d('0x2b'))){delete queryQueues['include'];}_0x4083b0['push'](db[_0xe83d('0x2c')][_0xe83d('0xe')](queryQueues));_0x4083b0[_0xe83d('0x2d')](db['ChatQueue'][_0xe83d('0xe')](queryQueues));_0x4083b0[_0xe83d('0x2d')](db[_0xe83d('0x2e')]['findAll'](queryQueues));_0x4083b0[_0xe83d('0x2d')](db[_0xe83d('0x2f')][_0xe83d('0xe')](queryQueues));_0x4083b0['push'](db['MailQueue'][_0xe83d('0xe')](queryQueues));_0x4083b0[_0xe83d('0x2d')](db[_0xe83d('0x30')][_0xe83d('0xe')](queryQueues));_0x4083b0[_0xe83d('0x2d')](db[_0xe83d('0x31')][_0xe83d('0xe')](queryQueues));_0x4083b0[_0xe83d('0x2d')](db['User'][_0xe83d('0xe')](queryTelephones));_0x4083b0[_0xe83d('0x2d')](db[_0xe83d('0x32')][_0xe83d('0xe')](queryTrunks));_0x4083b0[_0xe83d('0x2d')](db['Campaign'][_0xe83d('0xe')](queryCampaigns));_0x4083b0['push'](db[_0xe83d('0x4')][_0xe83d('0xe')](queryAgents));break;case _0xe83d('0x33'):_0x12bcbf[_0x254551]('voice:inbound');_0x12bcbf[_0x254551](_0xe83d('0x34'));_0x4083b0['push'](getAssociatedResources(_0xe83d('0xa'),_0x2afbab['userProfileId'],_0xe83d('0x2c')));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources(_0xe83d('0x35'),_0x2afbab[_0xe83d('0x36')],_0xe83d('0x37')));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources('FaxQueues',_0x2afbab['userProfileId'],'FaxQueue'));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources(_0xe83d('0xc'),_0x2afbab[_0xe83d('0x36')],_0xe83d('0x2f')));_0x4083b0['push'](getAssociatedResources(_0xe83d('0x38'),_0x2afbab[_0xe83d('0x36')],_0xe83d('0x39')));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources(_0xe83d('0xd'),_0x2afbab[_0xe83d('0x36')],'OpenchannelQueue'));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources('WhatsappQueues',_0x2afbab[_0xe83d('0x36')],_0xe83d('0x31')));_0x4083b0['push'](getAssociatedResources(_0xe83d('0xf'),_0x2afbab[_0xe83d('0x36')],'User'));_0x4083b0['push'](getAssociatedResources(_0xe83d('0x10'),_0x2afbab[_0xe83d('0x36')],_0xe83d('0x32')));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources(_0xe83d('0x11'),_0x2afbab[_0xe83d('0x36')],_0xe83d('0x17')));_0x4083b0['push'](db[_0xe83d('0x4')]['findAll'](queryAgents));break;case _0xe83d('0x3a'):_0x12bcbf[_0x254551]('voice:inbound');_0x12bcbf[_0x254551](_0xe83d('0x34'));_0x4083b0[_0xe83d('0x2d')](_0x2afbab['getVoiceQueues']({'attributes':['id',_0xe83d('0x5')]}));_0x4083b0['push'](_0x2afbab[_0xe83d('0x3b')]({'attributes':['id',_0xe83d('0x5')]}));_0x4083b0[_0xe83d('0x2d')](_0x2afbab['getFaxQueues']({'attributes':['id','name']}));_0x4083b0[_0xe83d('0x2d')](_0x2afbab[_0xe83d('0x3c')]({'attributes':['id',_0xe83d('0x5')]}));_0x4083b0[_0xe83d('0x2d')](_0x2afbab['getMailQueues']({'attributes':['id',_0xe83d('0x5')]}));_0x4083b0[_0xe83d('0x2d')](_0x2afbab['getOpenchannelQueues']({'attributes':['id','name']}));_0x4083b0[_0xe83d('0x2d')](_0x2afbab[_0xe83d('0x3d')]({'attributes':['id',_0xe83d('0x5')]}));break;}return BPromise[_0xe83d('0x3e')](_0x4083b0);}})[_0xe83d('0x13')](function(_0xed190b){if(_0xed190b&&_0xed190b[_0xe83d('0x1a')]){for(var _0x5ca1de=0x0;_0x5ca1de<_0xed190b[_0xe83d('0x1a')];_0x5ca1de+=0x1){for(var _0x1725c3=0x0;_0x1725c3<_0xed190b[_0x5ca1de][_0xe83d('0x1a')];_0x1725c3+=0x1){switch(_0x5ca1de){case 0x0:joinOrLeaveQueues(_0x12bcbf,_0x254551,_0xe83d('0x3f'),_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x1:joinOrLeaveQueues(_0x12bcbf,_0x254551,_0xe83d('0x40'),_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x2:joinOrLeaveQueues(_0x12bcbf,_0x254551,'fax',_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x3:joinOrLeaveQueues(_0x12bcbf,_0x254551,'sms',_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x4:joinOrLeaveQueues(_0x12bcbf,_0x254551,_0xe83d('0x41'),_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x5:joinOrLeaveQueues(_0x12bcbf,_0x254551,'openchannel',_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x6:joinOrLeaveQueues(_0x12bcbf,_0x254551,_0xe83d('0x42'),_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x7:if(_0x1dff3f[_0xe83d('0x1e')]!==_0xe83d('0x3a'))_0x12bcbf[_0x254551](util['format'](_0xe83d('0x43'),_0xed190b[_0x5ca1de][_0x1725c3][_0xe83d('0x5')]));break;case 0x8:if(_0x1dff3f[_0xe83d('0x1e')]!==_0xe83d('0x3a'))_0x12bcbf[_0x254551](util[_0xe83d('0x18')](_0xe83d('0x44'),_0xed190b[_0x5ca1de][_0x1725c3]['name']));break;case 0x9:if(_0x1dff3f['role']!==_0xe83d('0x3a'))_0x12bcbf[_0x254551](util['format']('campaign:%s:%s',_0xed190b[_0x5ca1de][_0x1725c3][_0xe83d('0x7')],_0xed190b[_0x5ca1de][_0x1725c3][_0xe83d('0x5')]));break;case 0xa:_0x12bcbf[_0x254551](util[_0xe83d('0x18')](_0xe83d('0x1b'),_0xed190b[_0x5ca1de][_0x1725c3][_0xe83d('0x5')]));break;}}}}})[_0xe83d('0x13')](function(){if(_0x254551===_0xe83d('0x45')){var _0x89dcb7=_[_0xe83d('0x14')](_0x1dff3f[_0xe83d('0x20')],'id');return _0x1dff3f['removeChatInteractions'](_0x89dcb7)[_0xe83d('0x13')](function(){for(var _0x22fb6b=0x0;_0x22fb6b<_0x89dcb7[_0xe83d('0x1a')];_0x22fb6b+=0x1){_0x4ea9eb['emit'](_0xe83d('0x46'),{'ChatInteractionId':Number(_0x89dcb7[_0x22fb6b]),'UserId':Number(_0x1dff3f['id'])});}});}})[_0xe83d('0x13')](function(){if(_0x254551==='leave'){var _0x1ad5d2=_[_0xe83d('0x14')](_0x1dff3f[_0xe83d('0x21')],'id');return _0x1dff3f['removeMailInteractions'](_0x1ad5d2)[_0xe83d('0x13')](function(){for(var _0x48fe0c=0x0;_0x48fe0c<_0x1ad5d2['length'];_0x48fe0c+=0x1){_0x4ea9eb[_0xe83d('0x47')](_0xe83d('0x48'),{'MailInteractionId':Number(_0x1ad5d2[_0x48fe0c]),'UserId':Number(_0x1dff3f['id'])});}});}})['then'](function(){if(_0x254551===_0xe83d('0x45')){var _0x382338=_[_0xe83d('0x14')](_0x1dff3f[_0xe83d('0x49')],'id');return _0x1dff3f[_0xe83d('0x4a')](_0x382338)[_0xe83d('0x13')](function(){for(var _0x256a5f=0x0;_0x256a5f<_0x382338[_0xe83d('0x1a')];_0x256a5f+=0x1){_0x4ea9eb[_0xe83d('0x47')](_0xe83d('0x4b'),{'FaxInteractionId':Number(_0x382338[_0x256a5f]),'UserId':Number(_0x1dff3f['id'])});}});}})[_0xe83d('0x13')](function(){if(_0x254551===_0xe83d('0x45')){var _0x5add88=_[_0xe83d('0x14')](_0x1dff3f['SmsInteractions'],'id');return _0x1dff3f[_0xe83d('0x4c')](_0x5add88)[_0xe83d('0x13')](function(){for(var _0x55cd45=0x0;_0x55cd45<_0x5add88['length'];_0x55cd45+=0x1){_0x4ea9eb['emit'](_0xe83d('0x4d'),{'SmsInteractionId':Number(_0x5add88[_0x55cd45]),'UserId':Number(_0x1dff3f['id'])});}});}})[_0xe83d('0x13')](function(){if(_0x254551===_0xe83d('0x45')){var _0x4b850c=_['map'](_0x1dff3f['OpenchannelInteractions'],'id');return _0x1dff3f[_0xe83d('0x4e')](_0x4b850c)[_0xe83d('0x13')](function(){for(var _0x173cab=0x0;_0x173cab<_0x4b850c[_0xe83d('0x1a')];_0x173cab+=0x1){_0x4ea9eb[_0xe83d('0x47')](_0xe83d('0x4f'),{'OpenchannelInteractionId':Number(_0x4b850c[_0x173cab]),'UserId':Number(_0x1dff3f['id'])});}});}})[_0xe83d('0x13')](function(){if(_0x254551==='leave'){var _0x165056=_[_0xe83d('0x14')](_0x1dff3f['WhatsappInteractions'],'id');return _0x1dff3f[_0xe83d('0x50')](_0x165056)['then'](function(){for(var _0x48c6b3=0x0;_0x48c6b3<_0x165056[_0xe83d('0x1a')];_0x48c6b3+=0x1){_0x4ea9eb[_0xe83d('0x47')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x165056[_0x48c6b3]),'UserId':Number(_0x1dff3f['id'])});}});}})[_0xe83d('0x51')](function(_0x5da6f4){_0x12bcbf[_0xe83d('0x52')](_0x5da6f4);});}}function onDisconnect(_0x5d98fe,_0x20021f){joinOrLeave(_0x5d98fe,_0xe83d('0x45'),_0x20021f);}function onConnect(_0x3f7e85){joinOrLeave(_0x3f7e85,_0xe83d('0x53'));}exports[_0xe83d('0x54')]=function(_0x3dc356){_0x3dc356['on'](_0xe83d('0x55'),function(_0x532879){_0x532879['setMaxListeners'](0x0);_0x532879[_0xe83d('0x56')]=_0x532879[_0xe83d('0x57')]['connection'][_0xe83d('0x58')]+':'+_0x532879[_0xe83d('0x57')][_0xe83d('0x55')][_0xe83d('0x59')];_0x532879[_0xe83d('0x5a')]=new Date();_0x532879[_0xe83d('0x52')]=function(_0xb58079){console[_0xe83d('0x52')](_0xe83d('0x5b')+_0x532879[_0xe83d('0x5c')][_0xe83d('0x5')]+'['+_0x532879[_0xe83d('0x56')]+']',_0xb58079);};_0x532879['on'](_0xe83d('0x5d'),function(){onDisconnect(_0x532879,_0x3dc356);_0x532879[_0xe83d('0x52')](_0xe83d('0x5e'));});onConnect(_0x532879);_0x532879[_0xe83d('0x52')](_0xe83d('0x5f'));});}; \ No newline at end of file +var _0x3157=['removeFaxInteractions','user_has_fax_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','remoteAddress','request','remotePort','log','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','User','telephone','agent','ivr','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','map','resourceId','where','role','%s:queue:%s','Agents','length','format','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','user:%s','admin','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','VoiceQueues','userProfileId','SmsQueue','OpenchannelQueues','IvrCampaigns','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','FaxInteractions'];(function(_0x38b2d9,_0x19fd42){var _0x23a3e1=function(_0xd8192f){while(--_0xd8192f){_0x38b2d9['push'](_0x38b2d9['shift']());}};_0x23a3e1(++_0x19fd42);}(_0x3157,0x198));var _0x7315=function(_0x55054c,_0x23fcfa){_0x55054c=_0x55054c-0x0;var _0x32c2ed=_0x3157[_0x55054c];return _0x32c2ed;};'use strict';var _=require(_0x7315('0x0'));var util=require(_0x7315('0x1'));var BPromise=require(_0x7315('0x2'));var db=require(_0x7315('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7315('0x4')],'include':[{'as':'Agents','model':db[_0x7315('0x5')],'attributes':['id',_0x7315('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7315('0x4')],'where':{'role':_0x7315('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7315('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x7315('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7315('0x4'),'type'],'where':{'type':_0x7315('0x8')}};function getAssociatedResources(_0x2f8dda,_0x1cad8b,_0x1b6416){return db['UserProfileSection'][_0x7315('0x9')]({'where':{'name':_0x2f8dda,'userProfileId':_0x1cad8b},'raw':!![]})[_0x7315('0xa')](function(_0x22e958){if(_0x22e958){if(_0x22e958[_0x7315('0xb')]){switch(_0x2f8dda){case'VoiceQueues':case _0x7315('0xc'):case _0x7315('0xd'):case _0x7315('0xe'):case _0x7315('0xf'):case'OpenchannelQueues':case _0x7315('0x10'):return db[_0x1b6416][_0x7315('0x11')](queryQueues);case _0x7315('0x12'):return db[_0x1b6416][_0x7315('0x11')](queryTelephones);case _0x7315('0x13'):return db[_0x1b6416][_0x7315('0x11')](queryTrunks);case'IvrCampaigns':return db[_0x1b6416]['findAll'](queryCampaigns);}}else{return db[_0x7315('0x14')][_0x7315('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x22e958['id']},'raw':!![]})[_0x7315('0xa')](function(_0x25ff8a){if(_0x25ff8a){var _0xd77567={'where':{'id':_[_0x7315('0x15')](_0x25ff8a,_0x7315('0x16'))},'raw':!![]};switch(_0x1b6416){case _0x7315('0x5'):_0xd77567[_0x7315('0x17')][_0x7315('0x18')]=_0x7315('0x6');break;case'Campaign':_0xd77567[_0x7315('0x17')]['type']=_0x7315('0x8');break;}return db[_0x1b6416]['findAll'](_0xd77567);}else{return[];}});}}else{return[];}})[_0x7315('0xa')](function(_0x2848ca){return _0x2848ca;});}function joinOrLeaveQueues(_0xa98946,_0x397f39,_0x145fb4,_0x351914){_0xa98946[_0x397f39](util['format'](_0x7315('0x19'),_0x145fb4,_0x351914['name']));if(_0x351914[_0x7315('0x1a')]){for(var _0x223002=0x0;_0x223002<_0x351914[_0x7315('0x1a')][_0x7315('0x1b')];_0x223002+=0x1){_0xa98946[_0x397f39](util[_0x7315('0x1c')]('user:%s',_0x351914[_0x7315('0x1a')][_0x223002]['name']));}}}function joinOrLeave(_0x1a7eb0,_0x77dbbc,_0x16b24f){var _0x3d1a8a;if(_0x1a7eb0[_0x7315('0x1d')][_0x7315('0x1e')]['id']){db[_0x7315('0x5')]['find']({'attributes':['id',_0x7315('0x4'),_0x7315('0x18'),'userProfileId'],'where':{'id':_0x1a7eb0[_0x7315('0x1d')]['query']['id']},'include':[{'model':db[_0x7315('0x1f')],'as':_0x7315('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x7315('0x21')],'as':_0x7315('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x7315('0x23')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7315('0x24')],'as':_0x7315('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x7315('0x26')],'as':_0x7315('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x7315('0x28')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x7315('0xa')](function(_0x537a83){if(_0x537a83){_0x3d1a8a=_0x537a83;_0x1a7eb0[_0x77dbbc](util[_0x7315('0x1c')](_0x7315('0x29'),_0x537a83[_0x7315('0x4')]));var _0x26cbba=[];switch(_0x537a83['role']){case _0x7315('0x2a'):_0x1a7eb0[_0x77dbbc]('voice:inbound');_0x1a7eb0[_0x77dbbc](_0x7315('0x2b'));if(queryQueues[_0x7315('0x2c')](_0x7315('0x2d'))){delete queryQueues[_0x7315('0x2d')];}_0x26cbba['push'](db[_0x7315('0x2e')][_0x7315('0x11')](queryQueues));_0x26cbba[_0x7315('0x2f')](db[_0x7315('0x30')][_0x7315('0x11')](queryQueues));_0x26cbba[_0x7315('0x2f')](db[_0x7315('0x31')][_0x7315('0x11')](queryQueues));_0x26cbba[_0x7315('0x2f')](db['SmsQueue'][_0x7315('0x11')](queryQueues));_0x26cbba['push'](db['MailQueue'][_0x7315('0x11')](queryQueues));_0x26cbba['push'](db[_0x7315('0x32')][_0x7315('0x11')](queryQueues));_0x26cbba[_0x7315('0x2f')](db[_0x7315('0x33')][_0x7315('0x11')](queryQueues));_0x26cbba[_0x7315('0x2f')](db[_0x7315('0x5')][_0x7315('0x11')](queryTelephones));_0x26cbba[_0x7315('0x2f')](db['Trunk']['findAll'](queryTrunks));_0x26cbba[_0x7315('0x2f')](db[_0x7315('0x34')][_0x7315('0x11')](queryCampaigns));_0x26cbba[_0x7315('0x2f')](db[_0x7315('0x5')]['findAll'](queryAgents));break;case _0x7315('0x35'):_0x1a7eb0[_0x77dbbc]('voice:inbound');_0x1a7eb0[_0x77dbbc](_0x7315('0x2b'));_0x26cbba[_0x7315('0x2f')](getAssociatedResources(_0x7315('0x36'),_0x537a83[_0x7315('0x37')],_0x7315('0x2e')));_0x26cbba[_0x7315('0x2f')](getAssociatedResources(_0x7315('0xc'),_0x537a83['userProfileId'],_0x7315('0x30')));_0x26cbba[_0x7315('0x2f')](getAssociatedResources(_0x7315('0xd'),_0x537a83[_0x7315('0x37')],_0x7315('0x31')));_0x26cbba[_0x7315('0x2f')](getAssociatedResources('SmsQueues',_0x537a83[_0x7315('0x37')],_0x7315('0x38')));_0x26cbba['push'](getAssociatedResources(_0x7315('0xf'),_0x537a83['userProfileId'],'MailQueue'));_0x26cbba[_0x7315('0x2f')](getAssociatedResources(_0x7315('0x39'),_0x537a83[_0x7315('0x37')],_0x7315('0x32')));_0x26cbba[_0x7315('0x2f')](getAssociatedResources('WhatsappQueues',_0x537a83[_0x7315('0x37')],'WhatsappQueue'));_0x26cbba[_0x7315('0x2f')](getAssociatedResources(_0x7315('0x12'),_0x537a83[_0x7315('0x37')],'User'));_0x26cbba['push'](getAssociatedResources(_0x7315('0x13'),_0x537a83[_0x7315('0x37')],'Trunk'));_0x26cbba[_0x7315('0x2f')](getAssociatedResources(_0x7315('0x3a'),_0x537a83['userProfileId'],_0x7315('0x34')));_0x26cbba[_0x7315('0x2f')](db[_0x7315('0x5')][_0x7315('0x11')](queryAgents));break;case _0x7315('0x7'):_0x1a7eb0[_0x77dbbc]('voice:inbound');_0x1a7eb0[_0x77dbbc](_0x7315('0x2b'));_0x26cbba[_0x7315('0x2f')](_0x537a83['getVoiceQueues']({'attributes':['id',_0x7315('0x4')]}));_0x26cbba['push'](_0x537a83[_0x7315('0x3b')]({'attributes':['id',_0x7315('0x4')]}));_0x26cbba['push'](_0x537a83[_0x7315('0x3c')]({'attributes':['id','name']}));_0x26cbba[_0x7315('0x2f')](_0x537a83['getSmsQueues']({'attributes':['id',_0x7315('0x4')]}));_0x26cbba[_0x7315('0x2f')](_0x537a83[_0x7315('0x3d')]({'attributes':['id',_0x7315('0x4')]}));_0x26cbba['push'](_0x537a83[_0x7315('0x3e')]({'attributes':['id',_0x7315('0x4')]}));_0x26cbba[_0x7315('0x2f')](_0x537a83[_0x7315('0x3f')]({'attributes':['id',_0x7315('0x4')]}));break;}return BPromise['all'](_0x26cbba);}})['then'](function(_0xc9ec1){if(_0xc9ec1&&_0xc9ec1[_0x7315('0x1b')]){for(var _0x135202=0x0;_0x135202<_0xc9ec1[_0x7315('0x1b')];_0x135202+=0x1){for(var _0x51310c=0x0;_0x51310c<_0xc9ec1[_0x135202][_0x7315('0x1b')];_0x51310c+=0x1){switch(_0x135202){case 0x0:joinOrLeaveQueues(_0x1a7eb0,_0x77dbbc,_0x7315('0x40'),_0xc9ec1[_0x135202][_0x51310c]);break;case 0x1:joinOrLeaveQueues(_0x1a7eb0,_0x77dbbc,_0x7315('0x41'),_0xc9ec1[_0x135202][_0x51310c]);break;case 0x2:joinOrLeaveQueues(_0x1a7eb0,_0x77dbbc,_0x7315('0x42'),_0xc9ec1[_0x135202][_0x51310c]);break;case 0x3:joinOrLeaveQueues(_0x1a7eb0,_0x77dbbc,_0x7315('0x43'),_0xc9ec1[_0x135202][_0x51310c]);break;case 0x4:joinOrLeaveQueues(_0x1a7eb0,_0x77dbbc,'mail',_0xc9ec1[_0x135202][_0x51310c]);break;case 0x5:joinOrLeaveQueues(_0x1a7eb0,_0x77dbbc,_0x7315('0x44'),_0xc9ec1[_0x135202][_0x51310c]);break;case 0x6:joinOrLeaveQueues(_0x1a7eb0,_0x77dbbc,_0x7315('0x45'),_0xc9ec1[_0x135202][_0x51310c]);break;case 0x7:if(_0x3d1a8a[_0x7315('0x18')]!=='agent')_0x1a7eb0[_0x77dbbc](util[_0x7315('0x1c')](_0x7315('0x46'),_0xc9ec1[_0x135202][_0x51310c][_0x7315('0x4')]));break;case 0x8:if(_0x3d1a8a['role']!==_0x7315('0x7'))_0x1a7eb0[_0x77dbbc](util[_0x7315('0x1c')](_0x7315('0x47'),_0xc9ec1[_0x135202][_0x51310c][_0x7315('0x4')]));break;case 0x9:if(_0x3d1a8a[_0x7315('0x18')]!=='agent')_0x1a7eb0[_0x77dbbc](util['format'](_0x7315('0x48'),_0xc9ec1[_0x135202][_0x51310c]['type'],_0xc9ec1[_0x135202][_0x51310c]['name']));break;case 0xa:_0x1a7eb0[_0x77dbbc](util[_0x7315('0x1c')]('user:%s',_0xc9ec1[_0x135202][_0x51310c][_0x7315('0x4')]));break;}}}}})[_0x7315('0xa')](function(){if(_0x77dbbc===_0x7315('0x49')){var _0x1fd54d=_[_0x7315('0x15')](_0x3d1a8a[_0x7315('0x20')],'id');return _0x3d1a8a[_0x7315('0x4a')](_0x1fd54d)[_0x7315('0xa')](function(){for(var _0x3e7eed=0x0;_0x3e7eed<_0x1fd54d['length'];_0x3e7eed+=0x1){_0x16b24f[_0x7315('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1fd54d[_0x3e7eed]),'UserId':Number(_0x3d1a8a['id'])});}});}})[_0x7315('0xa')](function(){if(_0x77dbbc===_0x7315('0x49')){var _0x57fd73=_['map'](_0x3d1a8a[_0x7315('0x22')],'id');return _0x3d1a8a['removeMailInteractions'](_0x57fd73)[_0x7315('0xa')](function(){for(var _0x517a09=0x0;_0x517a09<_0x57fd73[_0x7315('0x1b')];_0x517a09+=0x1){_0x16b24f[_0x7315('0x4b')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x57fd73[_0x517a09]),'UserId':Number(_0x3d1a8a['id'])});}});}})[_0x7315('0xa')](function(){if(_0x77dbbc===_0x7315('0x49')){var _0x1bfe0f=_[_0x7315('0x15')](_0x3d1a8a[_0x7315('0x4c')],'id');return _0x3d1a8a[_0x7315('0x4d')](_0x1bfe0f)[_0x7315('0xa')](function(){for(var _0x114c92=0x0;_0x114c92<_0x1bfe0f[_0x7315('0x1b')];_0x114c92+=0x1){_0x16b24f['emit'](_0x7315('0x4e'),{'FaxInteractionId':Number(_0x1bfe0f[_0x114c92]),'UserId':Number(_0x3d1a8a['id'])});}});}})[_0x7315('0xa')](function(){if(_0x77dbbc===_0x7315('0x49')){var _0x565791=_[_0x7315('0x15')](_0x3d1a8a['SmsInteractions'],'id');return _0x3d1a8a['removeSmsInteractions'](_0x565791)[_0x7315('0xa')](function(){for(var _0x3a3e33=0x0;_0x3a3e33<_0x565791['length'];_0x3a3e33+=0x1){_0x16b24f['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x565791[_0x3a3e33]),'UserId':Number(_0x3d1a8a['id'])});}});}})[_0x7315('0xa')](function(){if(_0x77dbbc===_0x7315('0x49')){var _0x24cf56=_[_0x7315('0x15')](_0x3d1a8a['OpenchannelInteractions'],'id');return _0x3d1a8a[_0x7315('0x4f')](_0x24cf56)[_0x7315('0xa')](function(){for(var _0xdfeb03=0x0;_0xdfeb03<_0x24cf56[_0x7315('0x1b')];_0xdfeb03+=0x1){_0x16b24f[_0x7315('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x24cf56[_0xdfeb03]),'UserId':Number(_0x3d1a8a['id'])});}});}})['then'](function(){if(_0x77dbbc===_0x7315('0x49')){var _0x1a2265=_['map'](_0x3d1a8a['WhatsappInteractions'],'id');return _0x3d1a8a[_0x7315('0x50')](_0x1a2265)[_0x7315('0xa')](function(){for(var _0x5c823f=0x0;_0x5c823f<_0x1a2265['length'];_0x5c823f+=0x1){_0x16b24f['emit'](_0x7315('0x51'),{'WhatsappInteractionId':Number(_0x1a2265[_0x5c823f]),'UserId':Number(_0x3d1a8a['id'])});}});}})[_0x7315('0x52')](function(_0x1e9a22){_0x1a7eb0['log'](_0x1e9a22);});}}function onDisconnect(_0x438d6f,_0xc40410){joinOrLeave(_0x438d6f,_0x7315('0x49'),_0xc40410);}function onConnect(_0x204503){joinOrLeave(_0x204503,_0x7315('0x53'));}exports[_0x7315('0x54')]=function(_0x1eb86b){_0x1eb86b['on'](_0x7315('0x55'),function(_0x4a5d46){_0x4a5d46[_0x7315('0x56')](0x0);_0x4a5d46['address']=_0x4a5d46['request'][_0x7315('0x55')][_0x7315('0x57')]+':'+_0x4a5d46[_0x7315('0x58')][_0x7315('0x55')][_0x7315('0x59')];_0x4a5d46['connectedAt']=new Date();_0x4a5d46[_0x7315('0x5a')]=function(_0x361730){console[_0x7315('0x5a')](_0x7315('0x5b')+_0x4a5d46[_0x7315('0x5c')][_0x7315('0x4')]+'['+_0x4a5d46[_0x7315('0x5d')]+']',_0x361730);};_0x4a5d46['on'](_0x7315('0x5e'),function(){onDisconnect(_0x4a5d46,_0x1eb86b);_0x4a5d46['log'](_0x7315('0x5f'));});onConnect(_0x4a5d46);_0x4a5d46[_0x7315('0x5a')](_0x7315('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 99c7aa0..aeb1f37 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 _0xb98b=['User','find','fullname','email','internal','default','length','hasOwnProperty','hook','toLowerCase','condition','../../mysqldb','jayson/promise','triggers','client','http','Chat','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','Trigger,\x20%s','get','motionChannel','event','direction','resolve','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','contact','UserId','undefined','name','agent','channel','outgoingmessage','AfterCreateMessage','offlineMessage','opened','Sequelize','catch','changed','closed','substatus','SIP/%s','AfterUpdate'];(function(_0x4cecbd,_0x103c9c){var _0x143b0c=function(_0x453d0d){while(--_0x453d0d){_0x4cecbd['push'](_0x4cecbd['shift']());}};_0x143b0c(++_0x103c9c);}(_0xb98b,0x12f));var _0xbb98=function(_0x30c0af,_0x45701d){_0x30c0af=_0x30c0af-0x0;var _0x357cd1=_0xb98b[_0x30c0af];return _0x357cd1;};'use strict';var util=require('util');var db=require(_0xbb98('0x0'))['db'];var jayson=require(_0xbb98('0x1'));var logger=require('../logger')(_0xbb98('0x2'));var client=jayson[_0xbb98('0x3')][_0xbb98('0x4')]({'port':0x232a});var triggers=[{'channel':_0xbb98('0x5'),'model':'ChatInteraction','event':_0xbb98('0x6'),'condition':_0xbb98('0x7'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0xbb98('0x8'),'condition':_0xbb98('0x9'),'callback':afterUpdate},{'channel':_0xbb98('0x5'),'model':_0xbb98('0xa'),'event':'afterCreate','condition':_0xbb98('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':_0xbb98('0xc'),'event':_0xbb98('0x6'),'condition':_0xbb98('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0xbb98('0xd'),'model':_0xbb98('0xe'),'event':'afterCreate','condition':_0xbb98('0x7'),'callback':afterCreate},{'channel':_0xbb98('0xd'),'model':_0xbb98('0xe'),'event':_0xbb98('0x8'),'condition':_0xbb98('0x9'),'callback':afterUpdate},{'channel':'Sms','model':_0xbb98('0xf'),'event':_0xbb98('0x6'),'condition':_0xbb98('0xb'),'callback':afterCreateMessage},{'channel':_0xbb98('0x10'),'model':_0xbb98('0x11'),'event':_0xbb98('0x6'),'condition':_0xbb98('0x7'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xbb98('0x11'),'event':_0xbb98('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbb98('0x10'),'model':_0xbb98('0x12'),'event':_0xbb98('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0xbb98('0x13'),'event':_0xbb98('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xbb98('0x14'),'model':_0xbb98('0x13'),'event':_0xbb98('0x8'),'condition':_0xbb98('0x9'),'callback':afterUpdate},{'channel':_0xbb98('0x14'),'model':_0xbb98('0x15'),'event':_0xbb98('0x6'),'condition':_0xbb98('0xb'),'callback':afterCreateMessage},{'channel':_0xbb98('0x16'),'model':_0xbb98('0x17'),'event':_0xbb98('0x6'),'condition':_0xbb98('0x7'),'callback':afterCreate},{'channel':_0xbb98('0x16'),'model':'MailInteraction','event':_0xbb98('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbb98('0x16'),'model':_0xbb98('0x18'),'event':_0xbb98('0x6'),'condition':_0xbb98('0xb'),'callback':afterCreateMessage},{'channel':_0xbb98('0x19'),'model':_0xbb98('0x1a'),'event':_0xbb98('0x6'),'condition':_0xbb98('0x7'),'callback':afterCreate},{'channel':_0xbb98('0x19'),'model':_0xbb98('0x1a'),'event':_0xbb98('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbb98('0x19'),'model':_0xbb98('0x1b'),'event':_0xbb98('0x6'),'condition':_0xbb98('0xb'),'callback':afterCreateMessage}];function request(_0x13a3f7){return client[_0xbb98('0x1c')](_0xbb98('0x1d'),_0x13a3f7)[_0xbb98('0x1e')](function(_0x4c35a0){logger[_0xbb98('0x1f')]('Trigger,\x20%s',_0xbb98('0x1d'),_0x4c35a0);if(_0x4c35a0[_0xbb98('0x20')]){if(_0x4c35a0['error']['code']===0x1f4){logger[_0xbb98('0x20')](_0xbb98('0x21'),_0xbb98('0x1d'),_0x4c35a0[_0xbb98('0x20')]);}}})['catch'](function(_0x116a8f){logger['error'](_0xbb98('0x21'),_0xbb98('0x1d'),_0x116a8f);});}function afterCreateMessage(_0x18af5b){return function(_0x1a8a75){_0x1a8a75=_0x1a8a75[_0xbb98('0x22')]({'plain':!![]});_0x1a8a75['channel']=_0x18af5b;_0x1a8a75[_0xbb98('0x23')]=_0x18af5b;_0x1a8a75[_0xbb98('0x24')]=_0x1a8a75[_0xbb98('0x25')];Promise[_0xbb98('0x26')]()[_0xbb98('0x1e')](function(){if(typeof _0x1a8a75[_0xbb98('0x27')]==='undefined')return null;var _0x515f98=_0xbb98('0x28')+_0x1a8a75['ContactId'];return db[_0xbb98('0x29')][_0xbb98('0x2a')](_0x515f98,{'type':db['Sequelize'][_0xbb98('0x2b')][_0xbb98('0x2c')],'raw':!![]});})[_0xbb98('0x1e')](function(_0x24b919){if(_0x24b919){_0x1a8a75[_0xbb98('0x2d')]=_0x24b919[0x0];}if(typeof _0x1a8a75[_0xbb98('0x2e')]===_0xbb98('0x2f'))return;return getAgent(_0x1a8a75[_0xbb98('0x2e')]);})['then'](function(_0x1352e4){if(_0x1352e4){_0x1a8a75['interface']=util['format']('SIP/%s',_0x1352e4[_0xbb98('0x30')]);_0x1a8a75[_0xbb98('0x31')]=_0x1352e4;_0x1a8a75[_0xbb98('0x32')]=_0x18af5b;return request({'event':'incomingmessage','message':_0x1a8a75});}else{return request({'event':_0xbb98('0x33'),'message':_0x1a8a75});}})['catch'](function(_0x297e49){logger[_0xbb98('0x20')]('Trigger,\x20%s',_0xbb98('0x34'),_0x297e49);});};}function afterCreateOfflineMessage(_0x4c1f69){return function(_0x1b70cf){_0x1b70cf=_0x1b70cf[_0xbb98('0x22')]({'plain':!![]});_0x1b70cf[_0xbb98('0x32')]=_0x4c1f69;_0x1b70cf[_0xbb98('0x23')]=_0x4c1f69;_0x1b70cf['event']=_0xbb98('0x35');return request({'event':_0x1b70cf[_0xbb98('0x24')],'message':_0x1b70cf});};}function afterCreate(_0x175a2f,_0xd32c37){return function(_0x245a9b){var _0x5ae227=_0x245a9b[_0xbb98('0x22')]({'plain':!![]});_0x5ae227[_0xbb98('0x32')]=_0x175a2f;_0x5ae227[_0xbb98('0x23')]=_0x175a2f;_0x5ae227[_0xbb98('0x24')]=_0xbb98('0x36');Promise[_0xbb98('0x26')]()['then'](function(){var _0x3d0718=_0xbb98('0x28')+_0x5ae227[_0xbb98('0x27')];return db['sequelize'][_0xbb98('0x2a')](_0x3d0718,{'type':db[_0xbb98('0x37')][_0xbb98('0x2b')][_0xbb98('0x2c')],'raw':!![]});})['then'](function(_0x56a2b0){if(_0x56a2b0){_0x5ae227[_0xbb98('0x2d')]=_0x56a2b0[0x0];}if(_0x5ae227[_0xbb98('0x2e')]){return getAgent(_0x5ae227[_0xbb98('0x2e')]);}return;})[_0xbb98('0x1e')](function(_0xe6cf1a){if(_0xe6cf1a){_0x5ae227['interface']=util['format']('SIP/%s',_0xe6cf1a[_0xbb98('0x30')]);_0x5ae227[_0xbb98('0x31')]=_0xe6cf1a;}return request({'event':_0xd32c37,'message':_0x5ae227});})[_0xbb98('0x38')](function(_0x3dce3a){logger[_0xbb98('0x20')](_0xbb98('0x21'),'AfterCreate',_0x3dce3a);});};}function afterUpdate(_0x5ddc04){return function(_0x2aac34){var _0x2f2f13=_0x2aac34[_0xbb98('0x39')](_0xbb98('0x3a'))&&_0x2aac34[_0xbb98('0x3a')];var _0x38c440=_0x2aac34[_0xbb98('0x39')](_0xbb98('0x3b'));if(_0x2f2f13||_0x38c440){var _0x3dd42a=_0x2f2f13?_0xbb98('0x9'):_0xbb98('0x3b');var _0x545fb6=_0x2aac34[_0xbb98('0x22')]({'plain':!![]});_0x545fb6[_0xbb98('0x32')]=_0x5ddc04;_0x545fb6[_0xbb98('0x23')]=_0x5ddc04;_0x545fb6[_0xbb98('0x24')]=_0x2f2f13?_0xbb98('0x3a'):_0xbb98('0x3b');var _0x18412d=_0xbb98('0x28')+_0x545fb6[_0xbb98('0x27')];return db[_0xbb98('0x29')][_0xbb98('0x2a')](_0x18412d,{'type':db['Sequelize'][_0xbb98('0x2b')][_0xbb98('0x2c')],'raw':!![]})[_0xbb98('0x1e')](function(_0x15e6ed){if(_0x15e6ed){_0x545fb6[_0xbb98('0x2d')]=_0x15e6ed[0x0];}if(typeof _0x545fb6[_0xbb98('0x2e')]===_0xbb98('0x2f'))return;return getAgent(_0x545fb6[_0xbb98('0x2e')]);})['then'](function(_0x2b63fd){if(_0x2b63fd){_0x545fb6['interface']=util['format'](_0xbb98('0x3c'),_0x2b63fd['name']);_0x545fb6[_0xbb98('0x31')]=_0x2b63fd;}return request({'event':_0x3dd42a,'message':_0x545fb6});})[_0xbb98('0x38')](function(_0x529924){logger[_0xbb98('0x20')](_0xbb98('0x21'),_0xbb98('0x3d'),_0x529924);});}};}function getAgent(_0x4b8dfc){return db[_0xbb98('0x3e')][_0xbb98('0x3f')]({'where':{'id':_0x4b8dfc},'attributes':['id',_0xbb98('0x30'),_0xbb98('0x40'),_0xbb98('0x41'),_0xbb98('0x42')],'raw':!![]})[_0xbb98('0x1e')](function(_0x3f6d60){return _0x3f6d60;});}exports[_0xbb98('0x43')]=function(){for(var _0x3b8954=0x0;_0x3b8954=_0x5bf39c['agents']){throw Error(_0x58ee('0x13'));}_0x4e7fed(_0x2427ac);})[_0x58ee('0x14')](function(_0x13e0ab){_0x2f311d(_0x13e0ab);});});}; \ No newline at end of file +var _0xda3c=['bluebird','../mysqldb','./license/util','voice','sms','whatsapp','openchannel','getChannels','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xda3c,0x1cb));var _0xcda3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xda3c[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xcda3('0x0'));var BPromise=require(_0xcda3('0x1'));var db=require(_0xcda3('0x2'))['db'];var util=require(_0xcda3('0x3'));var channels=[_0xcda3('0x4'),'mail','chat','fax',_0xcda3('0x5'),_0xcda3('0x6'),_0xcda3('0x7')];exports[_0xcda3('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x4adb1d){_0x4adb1d=_0x4adb1d[_0xcda3('0x9')]();return _[_0xcda3('0xa')](channels,_0x4adb1d);};exports[_0xcda3('0xb')]=function(_0x12c9d4,_0x9ea3f6,_0x25eea7,_0x48f068){var _0x17d1e9={'loginAttempts':_0x9ea3f6,'blocked':_0x25eea7};if(!_[_0xcda3('0xc')](_0x48f068)){_0x17d1e9[_0xcda3('0xd')]=_0x48f068;}return _0x12c9d4[_0xcda3('0xe')](_0x17d1e9);};exports[_0xcda3('0xf')]=function(_0x25a2c4){return new BPromise(function(_0x3d404a,_0x2face9){var _0x233e9d=0x0;if(_0x25a2c4['role']!=='agent'){_0x3d404a(_0x25a2c4);}db[_0xcda3('0x10')][_0xcda3('0x11')]({'where':{'role':_0xcda3('0x12'),'online':!![],'id':{'$ne':_0x25a2c4['id']}}})[_0xcda3('0x13')](function(_0x4d25ce){_0x233e9d=_0x4d25ce;return util['getLicense']();})[_0xcda3('0x13')](function(_0x32eb93){if(_0x32eb93&&_0x32eb93[_0xcda3('0x14')]&&_0x233e9d>=_0x32eb93[_0xcda3('0x14')]){throw Error(_0xcda3('0x15'));}_0x3d404a(_0x25a2c4);})[_0xcda3('0x16')](function(_0x4e1978){_0x2face9(_0x4e1978);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 935e151..868440c 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00ed=['Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','Conflict','error','stack','statusMessage','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0x00ed,0x128));var _0xd00e=function(_0x241794,_0x3e8336){_0x241794=_0x241794-0x0;var _0x455bf3=_0x00ed[_0x241794];return _0x455bf3;};'use strict';var util=require(_0xd00e('0x0'));var logger=require(_0xd00e('0x1'))(_0xd00e('0x2'));var APIError=function(_0x416668,_0x73766c){this[_0xd00e('0x3')]=_0x416668||'Internal\x20Server\x20Error';this[_0xd00e('0x4')]=_0x73766c||_0xd00e('0x5');util[_0xd00e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4f2407){this[_0xd00e('0x3')]=_0x4f2407||_0xd00e('0x7');this[_0xd00e('0x4')]=_0xd00e('0x7');util[_0xd00e('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x2ee4fa){this[_0xd00e('0x3')]=_0x2ee4fa||'Forbidden';this[_0xd00e('0x4')]=_0xd00e('0x8');util[_0xd00e('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x5c0843){this['message']=_0x5c0843||_0xd00e('0x9');this[_0xd00e('0x4')]=_0xd00e('0xa');util[_0xd00e('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x51aff3){this[_0xd00e('0x3')]=_0x51aff3||_0xd00e('0xb');this[_0xd00e('0x4')]=_0xd00e('0xc');this[_0xd00e('0xd')]=0x193;this[_0xd00e('0xe')]={'type':'OutOfInterval'};util[_0xd00e('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x2e134f){this[_0xd00e('0x3')]=_0x2e134f||'Resource\x20Conflict';this[_0xd00e('0x4')]=_0xd00e('0xf');util[_0xd00e('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x479394){switch(_0x479394){case _0xd00e('0x7'):return 0x190;case _0xd00e('0x8'),_0xd00e('0xc'):return 0x193;case _0xd00e('0xa'):return 0x194;case _0xd00e('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x527ccc){if(_0x527ccc==='Out\x20Of\x20Interval')return _0x527ccc;return null;}function handleError(_0x18d11f){return function(_0x2cc0ae){logger[_0xd00e('0x10')](_0x2cc0ae[_0xd00e('0x11')]);var _0x3f6cad=getStatusCode(_0x2cc0ae[_0xd00e('0x4')]);var _0x3f90fe=getCustomStatusMessage(_0x2cc0ae[_0xd00e('0x4')]);if(_0x2cc0ae[_0xd00e('0x4')]){delete _0x2cc0ae[_0xd00e('0x4')];}if(_0x3f90fe){_0x18d11f[_0xd00e('0x12')]=_0x3f90fe;}return _0x18d11f['status'](_0x3f6cad)['send'](_0x2cc0ae);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xec62=['OutOfInterval','Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Bad\x20Request','inherits','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','details'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xec62,0x144));var _0x2ec6=function(_0x598aa9,_0x36ce33){_0x598aa9=_0x598aa9-0x0;var _0x4ccbc3=_0xec62[_0x598aa9];return _0x4ccbc3;};'use strict';var util=require('util');var logger=require(_0x2ec6('0x0'))(_0x2ec6('0x1'));var APIError=function(_0xdc609c,_0x1b7b30){this[_0x2ec6('0x2')]=_0xdc609c||_0x2ec6('0x3');this[_0x2ec6('0x4')]=_0x1b7b30||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1e4f33){this[_0x2ec6('0x2')]=_0x1e4f33||_0x2ec6('0x5');this[_0x2ec6('0x4')]=_0x2ec6('0x5');util[_0x2ec6('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x1e812d){this[_0x2ec6('0x2')]=_0x1e812d||_0x2ec6('0x7');this[_0x2ec6('0x4')]='Forbidden';util[_0x2ec6('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x43df5d){this['message']=_0x43df5d||_0x2ec6('0x8');this[_0x2ec6('0x4')]=_0x2ec6('0x9');util[_0x2ec6('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4a4821){this[_0x2ec6('0x2')]=_0x4a4821||_0x2ec6('0xa');this[_0x2ec6('0x4')]='Out\x20Of\x20Interval';this['code']=0x193;this[_0x2ec6('0xb')]={'type':_0x2ec6('0xc')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x60526a){this[_0x2ec6('0x2')]=_0x60526a||'Resource\x20Conflict';this[_0x2ec6('0x4')]=_0x2ec6('0xd');util[_0x2ec6('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x11c048){switch(_0x11c048){case _0x2ec6('0x5'):return 0x190;case _0x2ec6('0x7'),_0x2ec6('0xe'):return 0x193;case _0x2ec6('0x9'):return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x93c672){if(_0x93c672===_0x2ec6('0xe'))return _0x93c672;return null;}function handleError(_0x4584a6){return function(_0x659b45){logger[_0x2ec6('0xf')](_0x659b45[_0x2ec6('0x10')]);var _0x5655f7=getStatusCode(_0x659b45[_0x2ec6('0x4')]);var _0x3df1c0=getCustomStatusMessage(_0x659b45[_0x2ec6('0x4')]);if(_0x659b45[_0x2ec6('0x4')]){delete _0x659b45[_0x2ec6('0x4')];}if(_0x3df1c0){_0x4584a6[_0x2ec6('0x11')]=_0x3df1c0;}return _0x4584a6[_0x2ec6('0x12')](_0x5655f7)[_0x2ec6('0x13')](_0x659b45);};}module[_0x2ec6('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b62bbfc..62f94c0 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0c0=['status','render','json','send','exports','404'];(function(_0x553acb,_0xb6dd09){var _0x585842=function(_0x38f4f3){while(--_0x38f4f3){_0x553acb['push'](_0x553acb['shift']());}};_0x585842(++_0xb6dd09);}(_0xc0c0,0x136));var _0x0c0c=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xc0c0[_0x176329];return _0x31997c;};'use strict';module[_0x0c0c('0x0')][0x194]=function pageNotFound(_0x41dbba,_0x2e8349){var _0x1fb5ff=_0x0c0c('0x1');var _0x470763=0x194;var _0x116bcf={'status':_0x470763};_0x2e8349[_0x0c0c('0x2')](_0x116bcf['status']);_0x2e8349[_0x0c0c('0x3')](_0x1fb5ff,{},function(_0x445031,_0x73246c){if(_0x445031){return _0x2e8349['status'](_0x116bcf[_0x0c0c('0x2')])[_0x0c0c('0x4')](_0x116bcf);}_0x2e8349[_0x0c0c('0x5')](_0x73246c);});}; \ No newline at end of file +var _0x2369=['status','render','send'];(function(_0x169b0b,_0x1d426a){var _0x4f88f4=function(_0x5b47a2){while(--_0x5b47a2){_0x169b0b['push'](_0x169b0b['shift']());}};_0x4f88f4(++_0x1d426a);}(_0x2369,0x1e6));var _0x9236=function(_0x54548f,_0x44c508){_0x54548f=_0x54548f-0x0;var _0x4a753b=_0x2369[_0x54548f];return _0x4a753b;};'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/migrations/2.6.33.js b/server/migrations/2.6.33.js new file mode 100644 index 0000000..a59425a --- /dev/null +++ b/server/migrations/2.6.33.js @@ -0,0 +1,169 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); +var logger = require('../config/logger')('migration'); +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface /*, Sequelize */) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + // Add your migration code here + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function( /* queryInterface, Sequelize */ ) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d05b2b1..e37ce5e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94e6=['CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','SET\x20NULL','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','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','SmsInteraction','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','UserVoicePrefix','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperBlacks','JscriptySessions','Trunk','belongsTo','TrunkBackup','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Team','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','Answers','MailAccountId','MailMessage','Messages','Interactions','MailApplication','List','Template','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','MailInteractionId','Owner','Tag','mail_interaction_has_tags','Tags','Account','ChatWebsiteId','ChatOfflineMessage','TagId','MailQueueReport','ListId','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','Interaction','AttachmentId','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','ThroughTags','OpenchannelQueueId','ChatProactiveAction','ProactiveActions','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CompanyId','CmContactId','HopperHistories','Company','cm_contact_has_tags','Campaign','OwnerId','CampaignId','Condition','All','OneAll','AutomationAllId','Automation','Any','OneAny','AutomationAnyId','Action','ParentId','Extensions','ChatApplications','FaxApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','CmContactHasItem','ContactItemType','ItemType','ItemTypeId','Hopper','CmHopperId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','DefaultReportId','MetricId','SalesforceConfiguration','AccountId','Subjects','Descriptions','Subject','SubjectId','Description','FieldId','SugarcrmConfiguration','Configurations','DescriptionId','Field','VariableId','int_desk_configuration_has_tags','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerField','ServicenowConfiguration','Dynamics365Field','FreshsalesConfiguration','FreshsalesField','ToId','SessionId','ProjectId','team_has_openchannel_queues','VoicePrefixes','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','xcall','xC@LL1234','utf8mb4','name','utf8','127.0.0.1','mysql','utf8_general_ci','database','username','sequelizeHistory','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model'];(function(_0x218ba6,_0x19ffc1){var _0x1cc057=function(_0xd17b02){while(--_0xd17b02){_0x218ba6['push'](_0x218ba6['shift']());}};_0x1cc057(++_0x19ffc1);}(_0x94e6,0x194));var _0x694e=function(_0x49ae37,_0x24a002){_0x49ae37=_0x49ae37-0x0;var _0x2bce38=_0x94e6[_0x49ae37];return _0x2bce38;};'use strict';var config=require(_0x694e('0x0'));var Sequelize=require('sequelize');var _=require(_0x694e('0x1'));var jstz=require(_0x694e('0x2'));var timezone=jstz[_0x694e('0x3')]();config[_0x694e('0x4')]=_[_0x694e('0x5')](config[_0x694e('0x4')],{'database':'motion2','username':_0x694e('0x6'),'password':_0x694e('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x694e('0x8')},'logging':![],'timezone':timezone[_0x694e('0x9')](),'define':{'charset':_0x694e('0xa'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x694e('0x5')](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':_0x694e('0x7'),'options':{'host':_0x694e('0xb'),'port':0xcea,'dialect':_0x694e('0xc'),'dialectOptions':{'charset':_0x694e('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x694e('0xa'),'collate':_0x694e('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x694e('0xe')],config[_0x694e('0x4')][_0x694e('0xf')],config[_0x694e('0x4')]['password'],config[_0x694e('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x694e('0x10')][_0x694e('0xe')],config[_0x694e('0x10')][_0x694e('0xf')],config[_0x694e('0x10')][_0x694e('0x11')],config[_0x694e('0x10')][_0x694e('0x12')])};db[_0x694e('0x13')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x15'));db[_0x694e('0x16')]=db['sequelize'][_0x694e('0x14')](_0x694e('0x17'));db[_0x694e('0x18')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x19'));db[_0x694e('0x1a')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x1b'));db[_0x694e('0x1c')]=db['sequelize'][_0x694e('0x14')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x694e('0x1d')]=db[_0x694e('0x4')]['import'](_0x694e('0x1e'));db[_0x694e('0x1f')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x20'));db[_0x694e('0x21')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x22'));db[_0x694e('0x23')]=db[_0x694e('0x4')]['import']('../api/voiceMail/voiceMail.model');db[_0x694e('0x24')]=db[_0x694e('0x4')]['import'](_0x694e('0x25'));db[_0x694e('0x26')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x27'));db[_0x694e('0x28')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0x694e('0x29')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x2a'));db[_0x694e('0x2b')]=db[_0x694e('0x4')]['import'](_0x694e('0x2c'));db['MemberReport']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x2d'));db['Trunk']=db[_0x694e('0x4')]['import']('../api/trunk/trunk.model');db[_0x694e('0x2e')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x694e('0x2f')]=db['sequelize'][_0x694e('0x14')](_0x694e('0x30'));db['UserVoiceQueue']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x31'));db[_0x694e('0x32')]=db['sequelize'][_0x694e('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0x694e('0x33')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x694e('0x34')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x35'));db[_0x694e('0x36')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x37'));db['UserOpenchannelQueue']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x38'));db[_0x694e('0x39')]=db['sequelize'][_0x694e('0x14')](_0x694e('0x3a'));db[_0x694e('0x3b')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x3c'));db[_0x694e('0x3d')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x3e'));db[_0x694e('0x3f')]=db[_0x694e('0x4')]['import'](_0x694e('0x40'));db[_0x694e('0x41')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x42'));db[_0x694e('0x43')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x44'));db['MailMessage']=db[_0x694e('0x4')]['import'](_0x694e('0x45'));db['MailApplication']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x46'));db['MailQueueReport']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x47'));db[_0x694e('0x48')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/dashboard/dashboard.model');db[_0x694e('0x49')]=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db[_0x694e('0x4a')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x4b'));db[_0x694e('0x4c')]=db['sequelize'][_0x694e('0x14')](_0x694e('0x4d'));db[_0x694e('0x4e')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x4f'));db[_0x694e('0x50')]=db[_0x694e('0x4')]['import']('../api/faxMessage/faxMessage.model');db[_0x694e('0x51')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/faxQueue/faxQueue.model');db[_0x694e('0x52')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x53'));db[_0x694e('0x54')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x55'));db['SmsApplication']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x56'));db['SmsInteraction']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x57'));db[_0x694e('0x58')]=db['sequelize'][_0x694e('0x14')](_0x694e('0x59'));db[_0x694e('0x5a')]=db['sequelize'][_0x694e('0x14')](_0x694e('0x5b'));db[_0x694e('0x5c')]=db['sequelize'][_0x694e('0x14')](_0x694e('0x5d'));db[_0x694e('0x5e')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/openchannelApplication/openchannelApplication.model');db[_0x694e('0x5f')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x60'));db[_0x694e('0x61')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x62'));db[_0x694e('0x63')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x64'));db[_0x694e('0x65')]=db[_0x694e('0x4')]['import'](_0x694e('0x66'));db[_0x694e('0x67')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x68'));db[_0x694e('0x69')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x6a'));db[_0x694e('0x6b')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x6c'));db[_0x694e('0x6d')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x6e'));db['ChatOfflineMessage']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x6f'));db[_0x694e('0x70')]=db[_0x694e('0x4')]['import'](_0x694e('0x71'));db[_0x694e('0x72')]=db['sequelize']['import']('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x694e('0x4')]['import'](_0x694e('0x73'));db[_0x694e('0x74')]=db['sequelize'][_0x694e('0x14')](_0x694e('0x75'));db['CmContact']=db['sequelize'][_0x694e('0x14')]('../api/cmContact/cmContact.model');db['CmHopper']=db['sequelize'][_0x694e('0x14')]('../api/cmHopper/cmHopper.model');db[_0x694e('0x76')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x694e('0x77')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x78'));db[_0x694e('0x79')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x7a'));db[_0x694e('0x7b')]=db['sequelize'][_0x694e('0x14')](_0x694e('0x7c'));db[_0x694e('0x7d')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x7e'));db['Action']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x7f'));db['Automation']=db[_0x694e('0x4')][_0x694e('0x14')]('../api/automation/automation.model');db[_0x694e('0x80')]=db['sequelize']['import'](_0x694e('0x81'));db['Disposition']=db[_0x694e('0x4')]['import'](_0x694e('0x82'));db['Condition']=db['sequelize']['import'](_0x694e('0x83'));db[_0x694e('0x84')]=db[_0x694e('0x4')]['import']('../api/interval/interval.model');db[_0x694e('0x85')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/pause/pause.model');db[_0x694e('0x86')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x87'));db[_0x694e('0x88')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x694e('0x89')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x8a'));db['Sound']=db[_0x694e('0x4')][_0x694e('0x14')]('../api/sound/sound.model');db['Tag']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x8b'));db['ContactItemType']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x8c'));db['CmContactHasItem']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x8d'));db[_0x694e('0x8e')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x8f'));db['Template']=db[_0x694e('0x4')]['import']('../api/template/template.model');db[_0x694e('0x90')]=db['sequelize'][_0x694e('0x14')]('../api/trigger/trigger.model');db[_0x694e('0x91')]=db[_0x694e('0x4')]['import'](_0x694e('0x92'));db['Integration']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x93'));db[_0x694e('0x94')]=db[_0x694e('0x4')]['import'](_0x694e('0x95'));db[_0x694e('0x96')]=db['sequelize'][_0x694e('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x694e('0x97')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x98'));db['AnalyticExtractedReport']=db['sequelize'][_0x694e('0x14')](_0x694e('0x99'));db[_0x694e('0x9a')]=db[_0x694e('0x4')]['import'](_0x694e('0x9b'));db['AnalyticFieldReport']=db[_0x694e('0x4')][_0x694e('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x694e('0x4')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x694e('0x9c')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x9d'));db['SalesforceConfiguration']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x9e'));db[_0x694e('0x9f')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xa0'));db[_0x694e('0xa1')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xa2'));db['SugarcrmConfiguration']=db[_0x694e('0x4')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x694e('0xa3')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xa4'));db[_0x694e('0xa5')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0x694e('0xa6')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xa7'));db[_0x694e('0xa8')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/intDeskField/intDeskField.model');db[_0x694e('0xa9')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xaa'));db[_0x694e('0xab')]=db[_0x694e('0x4')]['import'](_0x694e('0xac'));db[_0x694e('0xad')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xae'));db[_0x694e('0xaf')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xb0'));db['ZendeskField']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xb1'));db[_0x694e('0xb2')]=db['sequelize']['import'](_0x694e('0xb3'));db[_0x694e('0xb4')]=db['sequelize']['import'](_0x694e('0xb5'));db['FreshdeskField']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xb6'));db[_0x694e('0xb7')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xb8'));db[_0x694e('0xb9')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x694e('0x4')][_0x694e('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x694e('0xba')]=db[_0x694e('0x4')]['import'](_0x694e('0xbb'));db['ServicenowConfiguration']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xbc'));db[_0x694e('0xbd')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xbe'));db[_0x694e('0xbf')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xc0'));db[_0x694e('0xc1')]=db['sequelize']['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0x694e('0x4')][_0x694e('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x694e('0xc2')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xc3'));db['FreshsalesConfiguration']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xc4'));db['FreshsalesField']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xc5'));db[_0x694e('0xc6')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x93'));db[_0x694e('0xc7')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/network/network.model');db[_0x694e('0xc8')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xc9'));db[_0x694e('0xca')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xcb'));db[_0x694e('0xcc')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xcd'));db[_0x694e('0xce')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xcf'));db[_0x694e('0xd0')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xd1'));db[_0x694e('0xd2')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0x694e('0xd3')]=db['sequelize'][_0x694e('0x14')]('../api/squareReport/squareReport.model');db[_0x694e('0xd4')]=db[_0x694e('0x4')]['import'](_0x694e('0xd5'));db[_0x694e('0xd6')]=db['sequelize'][_0x694e('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x694e('0xd7')]=db[_0x694e('0x4')]['import'](_0x694e('0xd8'));db[_0x694e('0xd9')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xda'));db[_0x694e('0xdb')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/squareProject/squareProject.model');db[_0x694e('0xdc')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xdd'));db['SquareMessage']=db['sequelize']['import'](_0x694e('0xde'));db['Team']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xdf'));db[_0x694e('0xe0')]=db[_0x694e('0x4')]['import'](_0x694e('0xe1'));db['Campaign']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xe2'));db['Migration']=db[_0x694e('0x4')]['import'](_0x694e('0xe3'));db[_0x694e('0xe4')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xe5'));db[_0x694e('0xe6')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xe7'));db['MailTransferReport']=db[_0x694e('0x4')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0x694e('0xe8')]=db[_0x694e('0x4')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x694e('0xe9')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xea'));db[_0x694e('0xeb')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xec'));db[_0x694e('0xed')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xee'));db[_0x694e('0xef')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xf0'));db[_0x694e('0xf1')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xf2'));db[_0x694e('0xf3')]=db['sequelize'][_0x694e('0x14')](_0x694e('0xf4'));db[_0x694e('0xf5')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xf6'));db['UserProfileResource']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xf7'));db[_0x694e('0xf8')]=db[_0x694e('0x4')]['import'](_0x694e('0xf9'));db[_0x694e('0xfa')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xfb'));db['WhatsappApplication']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xfc'));db['WhatsappInteraction']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xfd'));db['WhatsappMessage']=db['sequelize'][_0x694e('0x14')](_0x694e('0xfe'));db['WhatsappQueueReport']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0xff'));db[_0x694e('0x100')]=db[_0x694e('0x4')][_0x694e('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x694e('0x101')]=db[_0x694e('0x4')]['import'](_0x694e('0x102'));db[_0x694e('0x103')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x104'));db['TeamVoiceQueue']=db[_0x694e('0x4')]['import'](_0x694e('0x105'));db[_0x694e('0x106')]=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x107'));db['UserVoicePrefix']=db[_0x694e('0x4')][_0x694e('0x14')](_0x694e('0x108'));db[_0x694e('0x109')]=db[_0x694e('0x4')]['import'](_0x694e('0x10a'));db['MailInteractionHasTag']=db[_0x694e('0x4')]['import'](_0x694e('0x10b'));db[_0x694e('0x13')][_0x694e('0x10c')](db[_0x694e('0x23')],{'as':'VoiceMail','onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x13')][_0x694e('0x10c')](db['UserSetting'],{'as':_0x694e('0x10f'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x13')][_0x694e('0x110')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x694e('0x10e')});db[_0x694e('0x13')][_0x694e('0x110')](db['UserVoiceQueueRt'],{'as':_0x694e('0x111'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x13')][_0x694e('0x110')](db[_0x694e('0x1a')],{'as':'Extensions','onDelete':_0x694e('0x10d'),'hooks':!![]});db['User'][_0x694e('0x110')](db[_0x694e('0x77')],{'as':_0x694e('0x112'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x13')][_0x694e('0x110')](db[_0x694e('0x79')],{'as':_0x694e('0x113'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x13')][_0x694e('0x110')](db[_0x694e('0x7b')],{'as':_0x694e('0x7b'),'foreignKey':'UserId'});db[_0x694e('0x13')][_0x694e('0x110')](db['OpenchannelInteraction'],{'as':_0x694e('0x114'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x13')][_0x694e('0x110')](db[_0x694e('0x6b')],{'as':_0x694e('0x115'),'foreignKey':'UserId'});db[_0x694e('0x13')][_0x694e('0x110')](db['SmsInteraction'],{'as':_0x694e('0x116'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x13')]['hasMany'](db[_0x694e('0x4e')],{'as':_0x694e('0x117'),'foreignKey':'UserId'});db['User'][_0x694e('0x110')](db['MailInteraction'],{'as':_0x694e('0x118'),'foreignKey':'UserId'});db[_0x694e('0x13')][_0x694e('0x110')](db[_0x694e('0x119')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db['User'][_0x694e('0x110')](db[_0x694e('0xf8')],{'as':_0x694e('0x11a'),'foreignKey':_0x694e('0x11b')});db[_0x694e('0x13')][_0x694e('0x110')](db['CmHopper'],{'as':'Hoppers','foreignKey':'UserId','onDelete':_0x694e('0x11c')});db['User']['belongsTo'](db['UserProfile'],{'as':_0x694e('0xf3'),'foreignKey':_0x694e('0x11d')});db[_0x694e('0x13')][_0x694e('0x11e')](db['ChatGroup'],{'as':_0x694e('0x11f'),'through':_0x694e('0x120')});db[_0x694e('0x13')]['belongsToMany'](db[_0x694e('0x121')],{'as':_0x694e('0x122'),'through':_0x694e('0x123')});db['User'][_0x694e('0x11e')](db[_0x694e('0xef')],{'as':_0x694e('0x124'),'through':_0x694e('0x125')});db[_0x694e('0x13')][_0x694e('0x11e')](db['Team'],{'through':_0x694e('0x126')});db['User']['belongsToMany'](db[_0x694e('0x43')],{'as':_0x694e('0x118'),'through':_0x694e('0x127')});db['User'][_0x694e('0x11e')](db[_0x694e('0x6b')],{'as':_0x694e('0x115'),'through':_0x694e('0x128')});db[_0x694e('0x13')][_0x694e('0x11e')](db['FaxInteraction'],{'as':_0x694e('0x117'),'through':_0x694e('0x129')});db[_0x694e('0x13')][_0x694e('0x11e')](db[_0x694e('0x12a')],{'as':_0x694e('0x116'),'through':_0x694e('0x12b')});db['User'][_0x694e('0x11e')](db[_0x694e('0x5f')],{'as':_0x694e('0x114'),'through':_0x694e('0x12c')});db[_0x694e('0x13')][_0x694e('0x11e')](db[_0x694e('0x119')],{'as':'WhatsappInteractions','through':_0x694e('0x12d')});db[_0x694e('0x13')][_0x694e('0x11e')](db[_0x694e('0x1d')],{'as':_0x694e('0x12e'),'through':_0x694e('0x12f'),'required':![]});db[_0x694e('0x13')][_0x694e('0x11e')](db[_0x694e('0xf1')],{'as':'VoicePrefixes','through':_0x694e('0x130'),'required':![]});db['User'][_0x694e('0x11e')](db[_0x694e('0x3f')],{'as':_0x694e('0x131'),'through':_0x694e('0x33'),'required':![]});db[_0x694e('0x13')]['belongsToMany'](db[_0x694e('0x70')],{'as':_0x694e('0x132'),'through':_0x694e('0x32'),'required':![],'hooks':!![]});db['User'][_0x694e('0x11e')](db[_0x694e('0x51')],{'as':_0x694e('0x133'),'through':_0x694e('0x34'),'required':![]});db['User']['belongsToMany'](db[_0x694e('0x5a')],{'as':_0x694e('0x134'),'through':_0x694e('0x36'),'required':![]});db[_0x694e('0x13')][_0x694e('0x11e')](db[_0x694e('0x63')],{'as':_0x694e('0x135'),'through':_0x694e('0x136'),'required':![]});db['User'][_0x694e('0x11e')](db['WhatsappQueue'],{'as':_0x694e('0x137'),'through':_0x694e('0x39'),'required':![]});db[_0x694e('0x13')][_0x694e('0x11e')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x694e('0x13')]['belongsToMany'](db['ChatWebsite'],{'as':_0x694e('0x138'),'through':_0x694e('0x139')});db[_0x694e('0x13')]['belongsToMany'](db[_0x694e('0x4a')],{'as':_0x694e('0x13a'),'through':_0x694e('0x13b')});db['User'][_0x694e('0x11e')](db[_0x694e('0x13c')],{'as':_0x694e('0x13d'),'through':_0x694e('0x13e')});db[_0x694e('0x13')][_0x694e('0x11e')](db[_0x694e('0x5c')],{'as':_0x694e('0x13f'),'through':_0x694e('0x140')});db[_0x694e('0x13')]['belongsToMany'](db[_0x694e('0x54')],{'as':_0x694e('0x141'),'through':_0x694e('0x142')});db[_0x694e('0x13')][_0x694e('0x11e')](db[_0x694e('0xfa')],{'as':_0x694e('0x143'),'through':_0x694e('0x144')});db[_0x694e('0x16')][_0x694e('0x110')](db[_0x694e('0x1a')],{'as':'SpiedAgents','onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x145')});db[_0x694e('0x18')][_0x694e('0x110')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x694e('0x1a')][_0x694e('0x110')](db[_0x694e('0x1a')],{'as':_0x694e('0x146'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x1c')][_0x694e('0x11e')](db[_0x694e('0x147')],{'as':_0x694e('0x148'),'through':_0x694e('0x149')});db['VoiceQueue'][_0x694e('0x110')](db['UserVoiceQueueRt'],{'as':_0x694e('0x14a'),'foreignKey':_0x694e('0x14b')});db[_0x694e('0x1d')][_0x694e('0x110')](db[_0x694e('0x14c')],{'as':_0x694e('0x14d'),'foreignKey':_0x694e('0x14b')});db['VoiceQueue'][_0x694e('0x110')](db['CmHopperFinal'],{'as':_0x694e('0x112'),'foreignKey':_0x694e('0x14b')});db[_0x694e('0x1d')][_0x694e('0x110')](db[_0x694e('0x79')],{'as':'HopperHistories','foreignKey':_0x694e('0x14b')});db['VoiceQueue'][_0x694e('0x110')](db[_0x694e('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x694e('0x14b')});db['VoiceQueue']['hasMany'](db[_0x694e('0x76')],{'as':_0x694e('0x14e'),'foreignKey':_0x694e('0x14b')});db[_0x694e('0x1d')][_0x694e('0x110')](db['JscriptySessionReport'],{'as':_0x694e('0x14f'),'foreignKey':_0x694e('0x14b')});db[_0x694e('0x1d')]['belongsTo'](db[_0x694e('0x150')],{'as':'Trunk','foreignKey':'TrunkId'});db['VoiceQueue'][_0x694e('0x151')](db[_0x694e('0x150')],{'as':_0x694e('0x152'),'foreignKey':'TrunkBackupId'});db['VoiceQueue']['belongsTo'](db[_0x694e('0x84')],{'as':'Interval','foreignKey':_0x694e('0x153')});db['VoiceQueue'][_0x694e('0x151')](db[_0x694e('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x694e('0x154')});db[_0x694e('0x1d')][_0x694e('0x11e')](db[_0x694e('0xef')],{'as':_0x694e('0x124'),'through':_0x694e('0x155')});db[_0x694e('0x1d')][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':'Agents','through':_0x694e('0x12f')});db[_0x694e('0x1d')]['belongsToMany'](db[_0x694e('0x156')],{'as':_0x694e('0x157'),'through':_0x694e('0x158')});db[_0x694e('0x1d')][_0x694e('0x11e')](db[_0x694e('0xef')],{'as':_0x694e('0x159'),'through':_0x694e('0x15a')});db[_0x694e('0x1f')][_0x694e('0x151')](db[_0x694e('0x13')],{'as':_0x694e('0x13'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x21')][_0x694e('0x151')](db[_0x694e('0x13')],{'as':_0x694e('0x13'),'foreignKey':'UserId'});db['VoiceMail'][_0x694e('0x110')](db[_0x694e('0x24')],{'as':'Messages','onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x15b'),'sourceKey':_0x694e('0x15c')});db[_0x694e('0x24')]['belongsTo'](db[_0x694e('0x23')],{'foreignKey':'mailboxuser','targetKey':_0x694e('0x15c')});db[_0x694e('0x26')]['hasMany'](db['VoiceQueueReport'],{'as':_0x694e('0x15d'),'foreignKey':_0x694e('0x15e'),'constraints':![]});db['VoiceCallReport'][_0x694e('0x110')](db[_0x694e('0x29')],{'as':_0x694e('0x15f'),'foreignKey':_0x694e('0x15e'),'constraints':![]});db['VoiceCallReport'][_0x694e('0x151')](db['User'],{'as':_0x694e('0x13'),'foreignKey':_0x694e('0x10e')});db['VoiceCallReport'][_0x694e('0x151')](db['CmContact'],{'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161')});db[_0x694e('0x3b')][_0x694e('0x151')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x694e('0x3b')][_0x694e('0x151')](db[_0x694e('0x103')],{'as':_0x694e('0x103'),'foreignKey':_0x694e('0x162'),'onDelete':'restrict'});db[_0x694e('0x3d')][_0x694e('0x151')](db[_0x694e('0x13c')],{'as':_0x694e('0x13c'),'foreignKey':'MailAccountId'});db[_0x694e('0x3d')]['belongsTo'](db[_0x694e('0x103')],{'as':_0x694e('0x103'),'foreignKey':'CloudProviderId','onDelete':_0x694e('0x163')});db[_0x694e('0x13c')][_0x694e('0x10c')](db[_0x694e('0x3b')],{'as':_0x694e('0x164'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x13c')]['hasOne'](db[_0x694e('0x3d')],{'as':_0x694e('0x165'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x13c')]['hasMany'](db[_0x694e('0x166')],{'as':_0x694e('0x167'),'foreignKey':'MailAccountId','onDelete':_0x694e('0x10d')});db['MailAccount'][_0x694e('0x110')](db['CannedAnswer'],{'as':_0x694e('0x168'),'foreignKey':_0x694e('0x169')});db[_0x694e('0x13c')]['hasMany'](db[_0x694e('0x16a')],{'as':_0x694e('0x16b'),'foreignKey':_0x694e('0x169')});db[_0x694e('0x13c')][_0x694e('0x110')](db[_0x694e('0x43')],{'as':_0x694e('0x16c')});db[_0x694e('0x13c')][_0x694e('0x110')](db[_0x694e('0x16d')],{'as':_0x694e('0x146'),'foreignKey':_0x694e('0x169'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x13c')][_0x694e('0x151')](db['CmList'],{'as':_0x694e('0x16e'),'foreignKey':'ListId'});db[_0x694e('0x13c')][_0x694e('0x151')](db[_0x694e('0x16f')],{'as':'Template','foreignKey':_0x694e('0x170')});db['MailAccount'][_0x694e('0x151')](db['Pause'],{'as':_0x694e('0x171'),'foreignKey':_0x694e('0x154')});db[_0x694e('0x13c')]['belongsToMany'](db[_0x694e('0x13')],{'as':_0x694e('0x172'),'through':_0x694e('0x13e')});db[_0x694e('0x3f')][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':'Agents','through':_0x694e('0x33')});db[_0x694e('0x3f')][_0x694e('0x11e')](db['Team'],{'through':_0x694e('0x173'),'as':_0x694e('0x157')});db['MailInteraction'][_0x694e('0x110')](db[_0x694e('0x16a')],{'as':_0x694e('0x16b'),'onDelete':'cascade','foreignKey':_0x694e('0x174')});db[_0x694e('0x43')][_0x694e('0x151')](db[_0x694e('0x13c')],{'as':'Account','foreignKey':_0x694e('0x169')});db[_0x694e('0x43')]['belongsTo'](db[_0x694e('0x121')],{'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161')});db[_0x694e('0x43')][_0x694e('0x151')](db['User'],{'as':_0x694e('0x175'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x43')][_0x694e('0x11e')](db[_0x694e('0x176')],{'through':_0x694e('0x177'),'as':_0x694e('0x178')});db['MailInteraction'][_0x694e('0x11e')](db['Tag'],{'through':_0x694e('0x177'),'as':'ThroughTags'});db[_0x694e('0x43')][_0x694e('0x11e')](db['User'],{'as':'Users','through':_0x694e('0x127'),'foreignKey':_0x694e('0x174')});db['MailMessage']['hasMany'](db[_0x694e('0xe4')],{'as':'Attachments','onDelete':_0x694e('0x10d')});db[_0x694e('0x16a')][_0x694e('0x151')](db['User'],{'as':_0x694e('0x13')});db[_0x694e('0x16a')][_0x694e('0x151')](db[_0x694e('0x121')],{'onDelete':'cascade','as':_0x694e('0x160')});db[_0x694e('0x16a')]['belongsTo'](db[_0x694e('0x43')],{'as':'Interaction','foreignKey':'MailInteractionId'});db['MailMessage']['belongsTo'](db[_0x694e('0x13c')],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x169')});db[_0x694e('0x16a')][_0x694e('0x151')](db[_0x694e('0x65')],{'as':_0x694e('0x65'),'foreignKey':_0x694e('0x17a')});db['MailMessage'][_0x694e('0x151')](db[_0x694e('0x17b')],{'as':_0x694e('0x17b'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x694e('0x151')](db[_0x694e('0x13')],{'onDelete':_0x694e('0x163')});db[_0x694e('0x16d')][_0x694e('0x151')](db[_0x694e('0x3f')],{'onDelete':_0x694e('0x163')});db[_0x694e('0x16d')][_0x694e('0x151')](db[_0x694e('0x13c')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x694e('0x84')],{'onDelete':'restrict','foreignKey':_0x694e('0x153')});db[_0x694e('0x16d')][_0x694e('0x151')](db[_0x694e('0x176')],{'onDelete':_0x694e('0x163'),'foreignKey':_0x694e('0x17c')});db[_0x694e('0x17d')]['belongsTo'](db['MailAccount'],{});db[_0x694e('0x17d')][_0x694e('0x151')](db['CmList'],{'as':'List','foreignKey':_0x694e('0x17e')});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':_0x694e('0x160'),'foreignKey':'ContactId'});db[_0x694e('0x17d')][_0x694e('0x151')](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db[_0x694e('0x16a')],{});db[_0x694e('0x17d')][_0x694e('0x151')](db['User'],{});db[_0x694e('0x17d')]['belongsTo'](db[_0x694e('0x3f')],{});db[_0x694e('0x48')][_0x694e('0x110')](db[_0x694e('0x49')],{'as':'Items','onDelete':'cascade'});db['FaxAccount'][_0x694e('0x110')](db[_0x694e('0x166')],{'as':_0x694e('0x167'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x694e('0x4a')][_0x694e('0x110')](db[_0x694e('0x80')],{'as':_0x694e('0x168'),'foreignKey':_0x694e('0x17f')});db[_0x694e('0x4a')][_0x694e('0x110')](db[_0x694e('0x4e')],{'as':_0x694e('0x16c')});db[_0x694e('0x4a')][_0x694e('0x110')](db[_0x694e('0x4c')],{'as':_0x694e('0x146'),'foreignKey':_0x694e('0x17f'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x4a')]['hasMany'](db[_0x694e('0x1a')],{'as':_0x694e('0x180'),'onDelete':'cascade'});db[_0x694e('0x4a')][_0x694e('0x110')](db[_0x694e('0x50')],{'as':_0x694e('0x16b')});db['FaxAccount']['belongsTo'](db[_0x694e('0x150')],{'as':'Trunk'});db[_0x694e('0x4a')][_0x694e('0x151')](db['CmList'],{'as':_0x694e('0x16e'),'foreignKey':_0x694e('0x17e')});db['FaxAccount']['belongsTo'](db[_0x694e('0x85')],{'as':_0x694e('0x171'),'foreignKey':_0x694e('0x154')});db[_0x694e('0x4a')][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':_0x694e('0x172'),'through':_0x694e('0x13b')});db[_0x694e('0x4c')]['belongsTo'](db[_0x694e('0x13')],{'onDelete':_0x694e('0x163')});db[_0x694e('0x4c')]['belongsTo'](db[_0x694e('0x51')],{'onDelete':'restrict'});db[_0x694e('0x4c')][_0x694e('0x151')](db[_0x694e('0x4a')],{'onDelete':_0x694e('0x163')});db[_0x694e('0x4c')][_0x694e('0x151')](db[_0x694e('0x176')],{'onDelete':_0x694e('0x163'),'foreignKey':_0x694e('0x17c')});db[_0x694e('0x4e')][_0x694e('0x110')](db[_0x694e('0x50')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x694e('0x181')});db[_0x694e('0x4e')][_0x694e('0x151')](db[_0x694e('0x4a')],{'as':'Account','foreignKey':_0x694e('0x17f')});db[_0x694e('0x4e')][_0x694e('0x151')](db[_0x694e('0x121')],{'as':_0x694e('0x160'),'foreignKey':'ContactId'});db[_0x694e('0x4e')][_0x694e('0x151')](db[_0x694e('0x13')],{'as':_0x694e('0x175'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x4e')][_0x694e('0x11e')](db[_0x694e('0x176')],{'through':_0x694e('0x182'),'as':_0x694e('0x178')});db['FaxInteraction'][_0x694e('0x11e')](db['Tag'],{'through':_0x694e('0x182'),'as':'ThroughTags'});db[_0x694e('0x4e')]['belongsToMany'](db[_0x694e('0x13')],{'as':_0x694e('0x183'),'through':_0x694e('0x129'),'foreignKey':_0x694e('0x181')});db[_0x694e('0x50')][_0x694e('0x151')](db[_0x694e('0x13')],{'onDelete':_0x694e('0x10d'),'as':'User'});db['FaxMessage'][_0x694e('0x151')](db[_0x694e('0x4e')],{'as':_0x694e('0x184'),'foreignKey':_0x694e('0x181')});db[_0x694e('0x50')]['belongsTo'](db[_0x694e('0x121')],{'onDelete':_0x694e('0x10d'),'as':_0x694e('0x160')});db[_0x694e('0x50')][_0x694e('0x151')](db['Attachment'],{'as':_0x694e('0xe4'),'foreignKey':_0x694e('0x185')});db[_0x694e('0x50')]['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxQueue'][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':'Agents','through':_0x694e('0x34')});db[_0x694e('0x51')][_0x694e('0x11e')](db[_0x694e('0x156')],{'through':'team_has_fax_queues','as':_0x694e('0x157')});db[_0x694e('0x52')]['belongsTo'](db['FaxAccount'],{});db[_0x694e('0x52')][_0x694e('0x151')](db[_0x694e('0xef')],{'as':_0x694e('0x16e'),'foreignKey':_0x694e('0x17e')});db['FaxQueueReport'][_0x694e('0x151')](db[_0x694e('0x121')],{'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161')});db['FaxQueueReport']['belongsTo'](db[_0x694e('0x4e')],{});db[_0x694e('0x52')][_0x694e('0x151')](db[_0x694e('0x50')],{});db[_0x694e('0x52')][_0x694e('0x151')](db[_0x694e('0x13')],{});db[_0x694e('0x52')]['belongsTo'](db['FaxQueue'],{});db['SmsAccount'][_0x694e('0x110')](db[_0x694e('0x166')],{'as':_0x694e('0x167'),'foreignKey':_0x694e('0x186'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x54')]['hasMany'](db[_0x694e('0x80')],{'as':'Answers','foreignKey':_0x694e('0x186')});db['SmsAccount'][_0x694e('0x110')](db['SmsMessage'],{'as':_0x694e('0x16b'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0x694e('0x12a')],{'as':_0x694e('0x16c')});db[_0x694e('0x54')]['hasMany'](db[_0x694e('0x187')],{'as':_0x694e('0x146'),'foreignKey':_0x694e('0x186'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x54')][_0x694e('0x151')](db[_0x694e('0xef')],{'as':_0x694e('0x16e'),'foreignKey':_0x694e('0x17e')});db[_0x694e('0x54')]['belongsTo'](db['Pause'],{'as':_0x694e('0x171'),'foreignKey':_0x694e('0x154')});db['SmsAccount'][_0x694e('0x11e')](db['User'],{'as':_0x694e('0x172'),'through':_0x694e('0x142')});db['SmsApplication'][_0x694e('0x151')](db[_0x694e('0x13')],{'onDelete':'restrict'});db[_0x694e('0x187')][_0x694e('0x151')](db[_0x694e('0x5a')],{'onDelete':_0x694e('0x163')});db[_0x694e('0x187')]['belongsTo'](db[_0x694e('0x54')],{'onDelete':'restrict'});db[_0x694e('0x187')][_0x694e('0x151')](db[_0x694e('0x84')],{'onDelete':'restrict','foreignKey':_0x694e('0x153')});db[_0x694e('0x187')][_0x694e('0x151')](db[_0x694e('0x176')],{'onDelete':'restrict','foreignKey':_0x694e('0x17c')});db[_0x694e('0x12a')][_0x694e('0x110')](db[_0x694e('0x58')],{'as':_0x694e('0x16b'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x188')});db['SmsInteraction'][_0x694e('0x151')](db[_0x694e('0x54')],{'as':'Account','foreignKey':_0x694e('0x186')});db[_0x694e('0x12a')][_0x694e('0x151')](db[_0x694e('0x121')],{'as':_0x694e('0x160'),'foreignKey':'ContactId'});db[_0x694e('0x12a')][_0x694e('0x151')](db[_0x694e('0x13')],{'as':_0x694e('0x175'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x12a')][_0x694e('0x11e')](db[_0x694e('0x176')],{'through':_0x694e('0x189'),'as':_0x694e('0x178')});db['SmsInteraction'][_0x694e('0x11e')](db[_0x694e('0x176')],{'through':_0x694e('0x189'),'as':'ThroughTags'});db[_0x694e('0x12a')][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':'Users','through':_0x694e('0x12b'),'foreignKey':_0x694e('0x188')});db['SmsMessage'][_0x694e('0x151')](db[_0x694e('0x13')],{'as':_0x694e('0x13')});db[_0x694e('0x58')][_0x694e('0x151')](db[_0x694e('0x121')],{'onDelete':'cascade','as':'Contact'});db['SmsMessage'][_0x694e('0x151')](db[_0x694e('0x12a')],{'onDelete':_0x694e('0x10d'),'as':_0x694e('0x184'),'foreignKey':_0x694e('0x188')});db[_0x694e('0x58')][_0x694e('0x151')](db[_0x694e('0x54')],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x186')});db[_0x694e('0x5a')][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':'Agents','through':_0x694e('0x36'),'foreignKey':'SmsQueueId'});db[_0x694e('0x5a')][_0x694e('0x11e')](db[_0x694e('0x156')],{'through':_0x694e('0x18a'),'as':_0x694e('0x157')});db[_0x694e('0x5c')][_0x694e('0x110')](db[_0x694e('0x166')],{'as':_0x694e('0x167'),'foreignKey':'OpenchannelAccountId','onDelete':_0x694e('0x10d')});db[_0x694e('0x5c')]['hasMany'](db['CannedAnswer'],{'as':_0x694e('0x168'),'foreignKey':_0x694e('0x18b')});db[_0x694e('0x5c')][_0x694e('0x110')](db['OpenchannelInteraction'],{'as':_0x694e('0x16c'),'foreignKey':_0x694e('0x18b')});db[_0x694e('0x5c')][_0x694e('0x110')](db[_0x694e('0x61')],{'as':_0x694e('0x16b'),'foreignKey':_0x694e('0x18b')});db[_0x694e('0x5c')][_0x694e('0x110')](db[_0x694e('0x5e')],{'as':_0x694e('0x146'),'foreignKey':'OpenchannelAccountId','onDelete':_0x694e('0x10d')});db[_0x694e('0x5c')]['belongsTo'](db[_0x694e('0xef')],{'as':_0x694e('0x16e'),'foreignKey':_0x694e('0x17e')});db['OpenchannelAccount'][_0x694e('0x151')](db['Pause'],{'as':_0x694e('0x171'),'foreignKey':_0x694e('0x154')});db[_0x694e('0x5c')]['belongsToMany'](db[_0x694e('0x13')],{'as':_0x694e('0x172'),'through':'user_has_openchannel_accounts'});db[_0x694e('0x5e')][_0x694e('0x151')](db[_0x694e('0x13')],{'onDelete':_0x694e('0x163')});db[_0x694e('0x5e')][_0x694e('0x151')](db['OpenchannelQueue'],{'onDelete':_0x694e('0x163'),'foreignKey':'OpenchannelQueueId'});db[_0x694e('0x5e')][_0x694e('0x151')](db['OpenchannelAccount'],{'onDelete':_0x694e('0x163'),'foreignKey':_0x694e('0x18b')});db[_0x694e('0x5e')][_0x694e('0x151')](db['Interval'],{'onDelete':_0x694e('0x163'),'foreignKey':'IntervalId'});db[_0x694e('0x5e')][_0x694e('0x151')](db[_0x694e('0x176')],{'onDelete':'restrict','foreignKey':_0x694e('0x17c')});db[_0x694e('0x5f')][_0x694e('0x110')](db[_0x694e('0x61')],{'as':_0x694e('0x16b'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x18c')});db['OpenchannelInteraction']['belongsTo'](db['OpenchannelAccount'],{'as':_0x694e('0x179'),'foreignKey':'OpenchannelAccountId'});db[_0x694e('0x5f')][_0x694e('0x151')](db['CmContact'],{'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161')});db[_0x694e('0x5f')]['belongsTo'](db['User'],{'as':_0x694e('0x175'),'foreignKey':'UserId'});db[_0x694e('0x5f')][_0x694e('0x11e')](db[_0x694e('0x176')],{'through':_0x694e('0x18d'),'as':_0x694e('0x178')});db[_0x694e('0x5f')][_0x694e('0x11e')](db[_0x694e('0x176')],{'through':'openchannel_interaction_has_tags','as':_0x694e('0x18e')});db[_0x694e('0x5f')][_0x694e('0x11e')](db['User'],{'as':_0x694e('0x183'),'through':_0x694e('0x12c'),'foreignKey':_0x694e('0x18c')});db[_0x694e('0x61')][_0x694e('0x151')](db[_0x694e('0x13')],{'onDelete':_0x694e('0x10d'),'as':_0x694e('0x13')});db[_0x694e('0x61')][_0x694e('0x151')](db[_0x694e('0x121')],{'onDelete':'cascade','as':_0x694e('0x160')});db[_0x694e('0x61')][_0x694e('0x151')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x694e('0x184'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x694e('0x151')](db['Attachment'],{'as':'Attachment','foreignKey':_0x694e('0x185')});db[_0x694e('0x61')][_0x694e('0x151')](db[_0x694e('0x5c')],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x18b')});db[_0x694e('0x63')][_0x694e('0x11e')](db['User'],{'as':'Agents','through':_0x694e('0x136'),'foreignKey':_0x694e('0x18f')});db[_0x694e('0x63')][_0x694e('0x11e')](db['Team'],{'through':'team_has_openchannel_queues','as':_0x694e('0x157')});db[_0x694e('0x65')][_0x694e('0x110')](db[_0x694e('0x166')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0x694e('0x10d')});db['ChatWebsite']['hasMany'](db[_0x694e('0x80')],{'as':_0x694e('0x168'),'foreignKey':_0x694e('0x17a')});db[_0x694e('0x65')][_0x694e('0x110')](db[_0x694e('0x190')],{'as':_0x694e('0x191')});db[_0x694e('0x65')][_0x694e('0x110')](db[_0x694e('0x6b')],{'as':_0x694e('0x16c')});db['ChatWebsite'][_0x694e('0x110')](db['ChatApplication'],{'as':_0x694e('0x146'),'foreignKey':_0x694e('0x17a'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x65')][_0x694e('0x110')](db[_0x694e('0x6d')],{'as':_0x694e('0x16b')});db[_0x694e('0x65')][_0x694e('0x151')](db[_0x694e('0xef')],{'as':_0x694e('0x16e'),'foreignKey':_0x694e('0x17e')});db['ChatWebsite'][_0x694e('0x151')](db[_0x694e('0x84')],{'as':_0x694e('0x84'),'foreignKey':_0x694e('0x153')});db[_0x694e('0x65')]['belongsTo'](db[_0x694e('0x13c')],{'as':_0x694e('0x13c'),'foreignKey':_0x694e('0x169')});db['ChatWebsite']['belongsTo'](db[_0x694e('0x85')],{'as':_0x694e('0x171'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite']['belongsToMany'](db[_0x694e('0x13')],{'as':_0x694e('0x172'),'through':_0x694e('0x139')});db[_0x694e('0x67')][_0x694e('0x151')](db[_0x694e('0x5c')],{});db[_0x694e('0x67')]['belongsTo'](db[_0x694e('0xef')],{'as':'List','foreignKey':_0x694e('0x17e')});db[_0x694e('0x67')]['belongsTo'](db[_0x694e('0x121')],{'as':_0x694e('0x160'),'foreignKey':'ContactId'});db[_0x694e('0x67')]['belongsTo'](db[_0x694e('0x5f')],{});db[_0x694e('0x67')]['belongsTo'](db[_0x694e('0x61')],{});db[_0x694e('0x67')]['belongsTo'](db[_0x694e('0x13')],{});db[_0x694e('0x67')][_0x694e('0x151')](db[_0x694e('0x63')],{});db['ChatApplication'][_0x694e('0x151')](db[_0x694e('0x13')],{'as':_0x694e('0x192'),'foreignKey':_0x694e('0x10e'),'onDelete':'restrict'});db[_0x694e('0x69')][_0x694e('0x151')](db['ChatQueue'],{'as':_0x694e('0x193'),'foreignKey':'ChatQueueId','onDelete':_0x694e('0x163')});db[_0x694e('0x69')][_0x694e('0x151')](db[_0x694e('0x65')],{'as':_0x694e('0x194'),'foreignKey':'ChatWebsiteId','onDelete':_0x694e('0x163')});db['ChatApplication'][_0x694e('0x151')](db['Tag'],{'onDelete':_0x694e('0x163'),'foreignKey':_0x694e('0x17c')});db[_0x694e('0x6b')]['hasMany'](db[_0x694e('0x6d')],{'as':_0x694e('0x16b'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x195')});db[_0x694e('0x6b')][_0x694e('0x151')](db[_0x694e('0x65')],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x17a')});db['ChatInteraction'][_0x694e('0x151')](db['CmContact'],{'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161')});db[_0x694e('0x6b')][_0x694e('0x151')](db[_0x694e('0x13')],{'as':_0x694e('0x175'),'foreignKey':_0x694e('0x10e')});db[_0x694e('0x6b')][_0x694e('0x11e')](db[_0x694e('0x176')],{'through':_0x694e('0x196'),'as':_0x694e('0x178')});db[_0x694e('0x6b')][_0x694e('0x11e')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x694e('0x18e')});db[_0x694e('0x6b')][_0x694e('0x11e')](db['User'],{'as':_0x694e('0x183'),'through':_0x694e('0x128'),'foreignKey':_0x694e('0x195')});db[_0x694e('0x6d')][_0x694e('0x151')](db['User'],{'onDelete':_0x694e('0x10d'),'as':_0x694e('0x13')});db[_0x694e('0x6d')]['belongsTo'](db[_0x694e('0x121')],{'onDelete':_0x694e('0x10d'),'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161')});db[_0x694e('0x6d')][_0x694e('0x151')](db[_0x694e('0x6b')],{'onDelete':_0x694e('0x10d'),'as':_0x694e('0x184'),'foreignKey':_0x694e('0x195')});db[_0x694e('0x6d')][_0x694e('0x151')](db[_0x694e('0xe4')],{'as':_0x694e('0xe4'),'foreignKey':_0x694e('0x185')});db[_0x694e('0x6d')][_0x694e('0x151')](db[_0x694e('0x65')],{'as':'Account','foreignKey':_0x694e('0x17a')});db[_0x694e('0x17b')]['hasMany'](db[_0x694e('0xe4')],{'as':_0x694e('0x197'),'foreignKey':_0x694e('0x198'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0x694e('0x151')](db[_0x694e('0x121')],{'onDelete':_0x694e('0x10d'),'as':_0x694e('0x160'),'foreignKey':'ContactId'});db[_0x694e('0x17b')][_0x694e('0x151')](db[_0x694e('0x65')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x694e('0x70')]['belongsToMany'](db[_0x694e('0x13')],{'as':'Agents','through':_0x694e('0x32'),'hooks':!![]});db[_0x694e('0x70')][_0x694e('0x11e')](db['Team'],{'through':_0x694e('0x199'),'as':_0x694e('0x157')});db[_0x694e('0x72')]['hasMany'](db['ChatInternalMessage'],{'as':_0x694e('0x16b'),'foreignKey':_0x694e('0x19a'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x72')][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':_0x694e('0x14a'),'through':_0x694e('0x120')});db[_0x694e('0x190')]['belongsTo'](db[_0x694e('0x65')],{'as':_0x694e('0x194'),'foreignKey':_0x694e('0x17a')});db[_0x694e('0x74')][_0x694e('0x110')](db[_0x694e('0x121')],{'as':'Contacts','foreignKey':_0x694e('0x19b')});db['CmContact'][_0x694e('0x110')](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x694e('0x19c')});db[_0x694e('0x121')]['hasMany'](db[_0x694e('0x14c')],{'as':'Hoppers','foreignKey':_0x694e('0x161')});db[_0x694e('0x121')][_0x694e('0x110')](db[_0x694e('0x77')],{'as':_0x694e('0x112'),'foreignKey':_0x694e('0x161')});db[_0x694e('0x121')]['hasMany'](db[_0x694e('0x79')],{'as':_0x694e('0x19d'),'foreignKey':_0x694e('0x161')});db[_0x694e('0x121')][_0x694e('0x110')](db[_0x694e('0x7b')],{'as':_0x694e('0x7b'),'foreignKey':_0x694e('0x161')});db[_0x694e('0x121')][_0x694e('0x110')](db[_0x694e('0xd0')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x694e('0x121')][_0x694e('0x110')](db['OpenchannelInteraction'],{'as':_0x694e('0x114'),'foreignKey':_0x694e('0x161'),'onDelete':_0x694e('0x163')});db['CmContact'][_0x694e('0x110')](db[_0x694e('0x6b')],{'as':_0x694e('0x115'),'foreignKey':_0x694e('0x161'),'onDelete':_0x694e('0x163')});db['CmContact'][_0x694e('0x110')](db[_0x694e('0x12a')],{'as':_0x694e('0x116'),'foreignKey':_0x694e('0x161'),'onDelete':_0x694e('0x163')});db[_0x694e('0x121')][_0x694e('0x110')](db['FaxInteraction'],{'as':_0x694e('0x117'),'foreignKey':_0x694e('0x161'),'onDelete':_0x694e('0x163')});db['CmContact'][_0x694e('0x110')](db[_0x694e('0x43')],{'as':_0x694e('0x118'),'foreignKey':_0x694e('0x161'),'onDelete':_0x694e('0x163')});db[_0x694e('0x121')][_0x694e('0x151')](db[_0x694e('0x74')],{'as':_0x694e('0x19e'),'foreignKey':_0x694e('0x19b')});db[_0x694e('0x121')]['belongsTo'](db[_0x694e('0xef')],{'as':'List','foreignKey':_0x694e('0x17e'),'onDelete':'cascade'});db[_0x694e('0x121')][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':_0x694e('0x183'),'through':_0x694e('0x123')});db[_0x694e('0x121')][_0x694e('0x11e')](db['Tag'],{'as':_0x694e('0x178'),'through':_0x694e('0x19f')});db[_0x694e('0x121')][_0x694e('0x11e')](db[_0x694e('0x176')],{'through':_0x694e('0x19f'),'as':_0x694e('0x18e')});db[_0x694e('0x14c')][_0x694e('0x110')](db[_0x694e('0x8e')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0x694e('0x14c')][_0x694e('0x151')](db[_0x694e('0x121')],{'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x14c')]['belongsTo'](db[_0x694e('0xef')],{'as':'List','foreignKey':_0x694e('0x17e'),'onDelete':_0x694e('0x10d')});db['CmHopper'][_0x694e('0x151')](db['User'],{'as':'Agent','foreignKey':_0x694e('0x10e')});db[_0x694e('0x14c')][_0x694e('0x151')](db[_0x694e('0x1d')],{'as':_0x694e('0x193'),'foreignKey':_0x694e('0x14b'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x14c')]['belongsTo'](db[_0x694e('0x1a0')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x694e('0x10d')});db[_0x694e('0x14c')][_0x694e('0x151')](db[_0x694e('0x13')],{'as':'Owner','foreignKey':_0x694e('0x1a1')});db[_0x694e('0x76')][_0x694e('0x151')](db[_0x694e('0x121')],{'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161'),'onDelete':_0x694e('0x10d')});db['CmHopperBlack'][_0x694e('0x151')](db[_0x694e('0xef')],{'as':_0x694e('0x16e'),'foreignKey':'ListId','onDelete':_0x694e('0x10d')});db[_0x694e('0x76')][_0x694e('0x151')](db[_0x694e('0x1d')],{'as':_0x694e('0x193'),'foreignKey':_0x694e('0x14b'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x76')][_0x694e('0x151')](db['Campaign'],{'as':_0x694e('0x1a0'),'foreignKey':_0x694e('0x1a2'),'onDelete':'cascade'});db['Automation']['hasMany'](db[_0x694e('0x1a3')],{'as':{'plural':_0x694e('0x1a4'),'singular':_0x694e('0x1a5')},'foreignKey':_0x694e('0x1a6'),'onDelete':'cascade','hooks':!![]});db[_0x694e('0x1a7')][_0x694e('0x110')](db[_0x694e('0x1a3')],{'as':{'plural':_0x694e('0x1a8'),'singular':_0x694e('0x1a9')},'foreignKey':_0x694e('0x1aa'),'onDelete':_0x694e('0x10d'),'hooks':!![]});db[_0x694e('0x1a7')][_0x694e('0x110')](db[_0x694e('0x1ab')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x694e('0x10d'),'hooks':!![]});db[_0x694e('0x166')][_0x694e('0x110')](db[_0x694e('0x166')],{'as':_0x694e('0x167'),'foreignKey':_0x694e('0x1ac'),'onDelete':_0x694e('0x10d')});db[_0x694e('0x84')]['hasMany'](db[_0x694e('0x84')],{'as':'Intervals','foreignKey':_0x694e('0x153'),'onDelete':_0x694e('0x10d'),'hooks':!![],'required':![]});db[_0x694e('0x84')][_0x694e('0x110')](db[_0x694e('0x1a')],{'as':_0x694e('0x1ad'),'foreignKey':_0x694e('0x153'),'onDelete':'restrict'});db['Interval']['hasMany'](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x694e('0x153')});db[_0x694e('0x84')]['hasMany'](db[_0x694e('0x69')],{'as':_0x694e('0x1ae'),'foreignKey':_0x694e('0x153')});db[_0x694e('0x84')][_0x694e('0x110')](db[_0x694e('0x4c')],{'as':_0x694e('0x1af'),'foreignKey':_0x694e('0x153')});db[_0x694e('0x84')]['hasMany'](db[_0x694e('0x187')],{'as':'SmsApplications','foreignKey':_0x694e('0x153')});db['Schedule'][_0x694e('0x151')](db[_0x694e('0x13c')],{});db['Schedule'][_0x694e('0x151')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x694e('0x89')]['belongsTo'](db[_0x694e('0x96')],{'foreignKey':_0x694e('0x1b0')});db[_0x694e('0x147')][_0x694e('0x11e')](db[_0x694e('0x1c')],{'as':_0x694e('0x1b1'),'through':'moh_has_sounds','onDelete':_0x694e('0x163')});db[_0x694e('0x176')]['belongsToMany'](db[_0x694e('0x121')],{'through':_0x694e('0x19f')});db[_0x694e('0x176')][_0x694e('0x11e')](db[_0x694e('0x6b')],{'through':_0x694e('0x196')});db['Tag'][_0x694e('0x11e')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db['Tag'][_0x694e('0x11e')](db[_0x694e('0x12a')],{'through':_0x694e('0x189')});db[_0x694e('0x176')][_0x694e('0x11e')](db[_0x694e('0x4e')],{'through':'fax_interaction_has_tags'});db[_0x694e('0x176')]['belongsToMany'](db[_0x694e('0x5f')],{'through':_0x694e('0x18d')});db['Tag'][_0x694e('0x11e')](db[_0x694e('0x119')],{'through':_0x694e('0x1b2')});db[_0x694e('0x1b3')]['belongsTo'](db[_0x694e('0x1b4')],{'as':_0x694e('0x1b5'),'foreignKey':_0x694e('0x1b6')});db[_0x694e('0x8e')][_0x694e('0x151')](db[_0x694e('0x14c')],{'as':_0x694e('0x1b7'),'foreignKey':_0x694e('0x1b8')});db['CmContactHasItem'][_0x694e('0x151')](db[_0x694e('0x121')],{'as':_0x694e('0x160'),'foreignKey':'CmContactId'});db[_0x694e('0x90')][_0x694e('0x110')](db['Condition'],{'as':{'plural':_0x694e('0x1b9'),'singular':_0x694e('0x1ba')},'foreignKey':_0x694e('0x1bb'),'onDelete':_0x694e('0x10d'),'hooks':!![]});db['Trigger'][_0x694e('0x110')](db[_0x694e('0x1a3')],{'as':{'plural':_0x694e('0x1bc'),'singular':_0x694e('0x1bd')},'foreignKey':_0x694e('0x1be'),'onDelete':_0x694e('0x10d'),'hooks':!![]});db[_0x694e('0x90')][_0x694e('0x110')](db[_0x694e('0x1ab')],{'as':'Actions','foreignKey':_0x694e('0x1bf'),'onDelete':_0x694e('0x10d'),'hooks':!![]});db[_0x694e('0x96')][_0x694e('0x110')](db[_0x694e('0x1c0')],{'as':_0x694e('0x1c1'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1b0'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x694e('0x1c0')],{'as':_0x694e('0x1c1'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1c2')});db['AnalyticMetric'][_0x694e('0x110')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x694e('0x10d'),'foreignKey':'MetricId'});db[_0x694e('0x1c0')][_0x694e('0x151')](db[_0x694e('0x9a')],{'foreignKey':_0x694e('0x1c3')});db[_0x694e('0x9c')][_0x694e('0x110')](db[_0x694e('0x1c4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x694e('0x1c5')});db[_0x694e('0x1c4')][_0x694e('0x110')](db[_0x694e('0x9f')],{'as':_0x694e('0x1c6'),'onDelete':_0x694e('0x10d'),'foreignKey':'SubjectId'});db[_0x694e('0x1c4')][_0x694e('0x110')](db[_0x694e('0x9f')],{'as':_0x694e('0x1c7'),'onDelete':_0x694e('0x10d'),'foreignKey':'DescriptionId'});db[_0x694e('0x1c4')][_0x694e('0x110')](db[_0x694e('0x9f')],{'as':_0x694e('0x1c1'),'onDelete':_0x694e('0x10d'),'foreignKey':'FieldId'});db[_0x694e('0x1c4')]['belongsTo'](db[_0x694e('0x9c')],{'as':'Account','foreignKey':'AccountId'});db[_0x694e('0x9f')][_0x694e('0x110')](db[_0x694e('0x9f')],{'as':_0x694e('0x1c8'),'foreignKey':_0x694e('0x1c9')});db[_0x694e('0x9f')][_0x694e('0x110')](db[_0x694e('0x9f')],{'as':_0x694e('0x1ca'),'foreignKey':'DescriptionId'});db[_0x694e('0x9f')][_0x694e('0x110')](db[_0x694e('0x9f')],{'as':'Field','foreignKey':_0x694e('0x1cb')});db[_0x694e('0x9f')]['belongsTo'](db[_0x694e('0x91')],{'as':_0x694e('0x91'),'foreignKey':'VariableId'});db[_0x694e('0xa1')][_0x694e('0x110')](db[_0x694e('0x1cc')],{'as':_0x694e('0x1cd'),'onDelete':_0x694e('0x10d'),'foreignKey':'AccountId'});db['SugarcrmConfiguration']['hasMany'](db[_0x694e('0xa3')],{'as':_0x694e('0x1c6'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1c9')});db[_0x694e('0x1cc')][_0x694e('0x110')](db[_0x694e('0xa3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x694e('0x1ce')});db[_0x694e('0x1cc')][_0x694e('0x110')](db[_0x694e('0xa3')],{'as':'Fields','onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1cb')});db[_0x694e('0x1cc')][_0x694e('0x151')](db[_0x694e('0xa1')],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x1c5')});db[_0x694e('0xa3')]['hasMany'](db[_0x694e('0xa3')],{'as':_0x694e('0x1c8'),'foreignKey':_0x694e('0x1c9')});db[_0x694e('0xa3')][_0x694e('0x110')](db[_0x694e('0xa3')],{'as':_0x694e('0x1ca'),'foreignKey':_0x694e('0x1ce')});db[_0x694e('0xa3')][_0x694e('0x110')](db['SugarcrmField'],{'as':_0x694e('0x1cf'),'foreignKey':_0x694e('0x1cb')});db[_0x694e('0xa3')][_0x694e('0x151')](db[_0x694e('0x91')],{'as':_0x694e('0x91'),'foreignKey':_0x694e('0x1d0')});db[_0x694e('0xa5')][_0x694e('0x110')](db[_0x694e('0xa6')],{'as':_0x694e('0x1cd'),'onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration'][_0x694e('0x110')](db['DeskField'],{'as':_0x694e('0x1c6'),'onDelete':_0x694e('0x10d'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x694e('0x110')](db['DeskField'],{'as':_0x694e('0x1c7'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1ce')});db[_0x694e('0xa6')][_0x694e('0x110')](db['DeskField'],{'as':_0x694e('0x1c1'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1cb')});db[_0x694e('0xa6')]['belongsTo'](db[_0x694e('0xa5')],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x1c5')});db[_0x694e('0xa6')]['belongsToMany'](db[_0x694e('0x176')],{'through':_0x694e('0x1d1')});db[_0x694e('0xa8')]['hasMany'](db[_0x694e('0xa8')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x694e('0xa8')][_0x694e('0x110')](db[_0x694e('0xa8')],{'as':_0x694e('0x1ca'),'foreignKey':_0x694e('0x1ce')});db[_0x694e('0xa8')][_0x694e('0x110')](db['DeskField'],{'as':_0x694e('0x1cf'),'foreignKey':_0x694e('0x1cb')});db[_0x694e('0xa8')][_0x694e('0x151')](db['Variable'],{'as':'Variable','foreignKey':_0x694e('0x1d0')});db['ZohoAccount'][_0x694e('0x110')](db[_0x694e('0xab')],{'as':_0x694e('0x1cd'),'onDelete':'cascade','foreignKey':_0x694e('0x1c5')});db[_0x694e('0xab')][_0x694e('0x110')](db[_0x694e('0xad')],{'as':_0x694e('0x1c6'),'onDelete':_0x694e('0x10d'),'foreignKey':'SubjectId'});db[_0x694e('0xab')][_0x694e('0x110')](db['ZohoField'],{'as':_0x694e('0x1c7'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1ce')});db['ZohoConfiguration'][_0x694e('0x110')](db[_0x694e('0xad')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x694e('0xab')][_0x694e('0x151')](db[_0x694e('0xa9')],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x1c5')});db[_0x694e('0xad')]['hasMany'](db[_0x694e('0xad')],{'as':'Subject','foreignKey':_0x694e('0x1c9')});db[_0x694e('0xad')][_0x694e('0x110')](db['ZohoField'],{'as':_0x694e('0x1ca'),'foreignKey':_0x694e('0x1ce')});db[_0x694e('0xad')][_0x694e('0x110')](db[_0x694e('0xad')],{'as':'Field','foreignKey':'FieldId'});db[_0x694e('0xad')]['belongsTo'](db[_0x694e('0x91')],{'as':_0x694e('0x91'),'foreignKey':_0x694e('0x1d0')});db[_0x694e('0x1d2')][_0x694e('0x110')](db[_0x694e('0xaf')],{'as':_0x694e('0x1cd'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1c5')});db['ZendeskConfiguration'][_0x694e('0x110')](db[_0x694e('0x1d3')],{'as':_0x694e('0x1c6'),'foreignKey':_0x694e('0x1c9')});db[_0x694e('0xaf')][_0x694e('0x110')](db[_0x694e('0x1d3')],{'as':_0x694e('0x1c7'),'foreignKey':'DescriptionId'});db[_0x694e('0xaf')][_0x694e('0x110')](db['ZendeskField'],{'as':_0x694e('0x1c1'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x694e('0x151')](db[_0x694e('0x1d2')],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x1c5')});db[_0x694e('0xaf')][_0x694e('0x11e')](db[_0x694e('0x176')],{'through':_0x694e('0x1d4')});db[_0x694e('0x1d3')][_0x694e('0x110')](db[_0x694e('0x1d3')],{'as':_0x694e('0x1c8'),'foreignKey':'SubjectId'});db[_0x694e('0x1d3')][_0x694e('0x110')](db['ZendeskField'],{'as':_0x694e('0x1ca'),'foreignKey':_0x694e('0x1ce')});db[_0x694e('0x1d3')][_0x694e('0x110')](db[_0x694e('0x1d3')],{'as':_0x694e('0x1cf'),'foreignKey':'FieldId'});db[_0x694e('0x1d3')][_0x694e('0x151')](db[_0x694e('0x91')],{'as':_0x694e('0x91'),'foreignKey':_0x694e('0x1d0')});db[_0x694e('0xb2')][_0x694e('0x110')](db['FreshdeskConfiguration'],{'as':_0x694e('0x1cd'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1c5')});db[_0x694e('0xb4')][_0x694e('0x110')](db[_0x694e('0x1d5')],{'as':_0x694e('0x1c6'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1c9')});db[_0x694e('0xb4')][_0x694e('0x110')](db[_0x694e('0x1d5')],{'as':_0x694e('0x1c7'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1ce')});db[_0x694e('0xb4')][_0x694e('0x110')](db[_0x694e('0x1d5')],{'as':_0x694e('0x1c1'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1cb')});db['FreshdeskConfiguration'][_0x694e('0x151')](db[_0x694e('0xb2')],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x1c5')});db[_0x694e('0xb4')][_0x694e('0x11e')](db[_0x694e('0x176')],{'through':_0x694e('0x1d6')});db[_0x694e('0x1d5')][_0x694e('0x110')](db[_0x694e('0x1d5')],{'as':_0x694e('0x1c8'),'foreignKey':_0x694e('0x1c9')});db[_0x694e('0x1d5')]['hasMany'](db[_0x694e('0x1d5')],{'as':_0x694e('0x1ca'),'foreignKey':'DescriptionId'});db[_0x694e('0x1d5')]['hasMany'](db[_0x694e('0x1d5')],{'as':'Field','foreignKey':_0x694e('0x1cb')});db['FreshdeskField']['belongsTo'](db[_0x694e('0x91')],{'as':_0x694e('0x91'),'foreignKey':'VariableId'});db[_0x694e('0xb7')][_0x694e('0x110')](db[_0x694e('0xb9')],{'as':_0x694e('0x1cd'),'onDelete':'cascade','foreignKey':_0x694e('0x1c5')});db[_0x694e('0xb9')][_0x694e('0x110')](db[_0x694e('0x1d7')],{'as':_0x694e('0x1c6'),'foreignKey':_0x694e('0x1c9')});db[_0x694e('0xb9')]['hasMany'](db[_0x694e('0x1d7')],{'as':_0x694e('0x1c7'),'foreignKey':'DescriptionId'});db['VtigerConfiguration']['hasMany'](db[_0x694e('0x1d7')],{'as':_0x694e('0x1c1'),'foreignKey':_0x694e('0x1cb')});db[_0x694e('0xb9')][_0x694e('0x151')](db['VtigerAccount'],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x1c5')});db[_0x694e('0x1d7')][_0x694e('0x110')](db['VtigerField'],{'as':_0x694e('0x1c8'),'foreignKey':_0x694e('0x1c9')});db[_0x694e('0x1d7')][_0x694e('0x110')](db[_0x694e('0x1d7')],{'as':_0x694e('0x1ca'),'foreignKey':_0x694e('0x1ce')});db[_0x694e('0x1d7')]['hasMany'](db[_0x694e('0x1d7')],{'as':'Field','foreignKey':_0x694e('0x1cb')});db[_0x694e('0x1d7')][_0x694e('0x151')](db[_0x694e('0x91')],{'as':_0x694e('0x91'),'foreignKey':_0x694e('0x1d0')});db['ServicenowAccount'][_0x694e('0x110')](db[_0x694e('0x1d8')],{'as':'Configurations','onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1c5')});db[_0x694e('0x1d8')]['hasMany'](db[_0x694e('0xbd')],{'as':_0x694e('0x1c6'),'foreignKey':'SubjectId'});db[_0x694e('0x1d8')][_0x694e('0x110')](db[_0x694e('0xbd')],{'as':'Descriptions','foreignKey':_0x694e('0x1ce')});db[_0x694e('0x1d8')][_0x694e('0x110')](db[_0x694e('0xbd')],{'as':'Fields','foreignKey':_0x694e('0x1cb')});db[_0x694e('0x1d8')][_0x694e('0x151')](db['ServicenowAccount'],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0x694e('0x110')](db[_0x694e('0xbd')],{'as':_0x694e('0x1c8'),'foreignKey':_0x694e('0x1c9')});db[_0x694e('0xbd')][_0x694e('0x110')](db[_0x694e('0xbd')],{'as':_0x694e('0x1ca'),'foreignKey':_0x694e('0x1ce')});db[_0x694e('0xbd')][_0x694e('0x110')](db[_0x694e('0xbd')],{'as':'Field','foreignKey':'FieldId'});db[_0x694e('0xbd')][_0x694e('0x151')](db[_0x694e('0x91')],{'as':_0x694e('0x91'),'foreignKey':_0x694e('0x1d0')});db[_0x694e('0xbf')][_0x694e('0x110')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x694e('0x1c5')});db[_0x694e('0xbf')][_0x694e('0x151')](db[_0x694e('0x103')],{'as':'CloudProvider','foreignKey':_0x694e('0x162')});db[_0x694e('0xc1')]['hasMany'](db[_0x694e('0x1d9')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x694e('0x1c9')});db['Dynamics365Configuration'][_0x694e('0x110')](db['Dynamics365Field'],{'as':_0x694e('0x1c7'),'onDelete':'cascade','foreignKey':_0x694e('0x1ce')});db[_0x694e('0xc1')][_0x694e('0x110')](db[_0x694e('0x1d9')],{'as':_0x694e('0x1c1'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1cb')});db['Dynamics365Configuration'][_0x694e('0x151')](db[_0x694e('0xbf')],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x1c5')});db[_0x694e('0x1d9')][_0x694e('0x110')](db[_0x694e('0x1d9')],{'as':_0x694e('0x1c8'),'foreignKey':_0x694e('0x1c9')});db[_0x694e('0x1d9')][_0x694e('0x110')](db['Dynamics365Field'],{'as':_0x694e('0x1ca'),'foreignKey':_0x694e('0x1ce')});db[_0x694e('0x1d9')][_0x694e('0x110')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x694e('0x1cb')});db['Dynamics365Field'][_0x694e('0x151')](db['Variable'],{'as':_0x694e('0x91'),'foreignKey':_0x694e('0x1d0')});db[_0x694e('0xc2')][_0x694e('0x110')](db['FreshsalesConfiguration'],{'as':_0x694e('0x1cd'),'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1c5')});db[_0x694e('0x1da')][_0x694e('0x110')](db['FreshsalesField'],{'as':_0x694e('0x1c6'),'foreignKey':'SubjectId'});db[_0x694e('0x1da')]['hasMany'](db[_0x694e('0x1db')],{'as':'Descriptions','foreignKey':_0x694e('0x1ce')});db[_0x694e('0x1da')][_0x694e('0x110')](db['FreshsalesField'],{'as':_0x694e('0x1c1'),'foreignKey':_0x694e('0x1cb')});db[_0x694e('0x1da')][_0x694e('0x151')](db['FreshsalesAccount'],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x1c5')});db['FreshsalesField'][_0x694e('0x110')](db[_0x694e('0x1db')],{'as':'Subject','foreignKey':_0x694e('0x1c9')});db[_0x694e('0x1db')][_0x694e('0x110')](db[_0x694e('0x1db')],{'as':_0x694e('0x1ca'),'foreignKey':_0x694e('0x1ce')});db[_0x694e('0x1db')][_0x694e('0x110')](db['FreshsalesField'],{'as':'Field','foreignKey':_0x694e('0x1cb')});db[_0x694e('0x1db')][_0x694e('0x151')](db[_0x694e('0x91')],{'as':_0x694e('0x91'),'foreignKey':_0x694e('0x1d0')});db['ChatQueueReport'][_0x694e('0x151')](db[_0x694e('0x65')],{});db[_0x694e('0xc8')][_0x694e('0x151')](db['CmList'],{'as':_0x694e('0x16e'),'foreignKey':_0x694e('0x17e')});db[_0x694e('0xc8')][_0x694e('0x151')](db[_0x694e('0x121')],{'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161')});db[_0x694e('0xc8')][_0x694e('0x151')](db[_0x694e('0x6b')],{});db[_0x694e('0xc8')][_0x694e('0x151')](db[_0x694e('0x6d')],{});db[_0x694e('0xc8')][_0x694e('0x151')](db[_0x694e('0x13')],{});db[_0x694e('0xc8')]['belongsTo'](db[_0x694e('0x70')],{});db[_0x694e('0xca')]['belongsTo'](db[_0x694e('0x13')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x694e('0xca')][_0x694e('0x151')](db[_0x694e('0x13')],{'onDelete':_0x694e('0x10d'),'foreignKey':_0x694e('0x1dc')});db[_0x694e('0xd0')][_0x694e('0x110')](db['JscriptyQuestionReport'],{'foreignKey':_0x694e('0x1dd'),'onDelete':_0x694e('0x10d')});db[_0x694e('0xd0')][_0x694e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':_0x694e('0x1dd'),'onDelete':_0x694e('0x10d')});db[_0x694e('0xd2')][_0x694e('0x151')](db['SmsAccount'],{});db[_0x694e('0xd2')][_0x694e('0x151')](db[_0x694e('0xef')],{'as':_0x694e('0x16e'),'foreignKey':_0x694e('0x17e')});db[_0x694e('0xd2')][_0x694e('0x151')](db['CmContact'],{'as':'Contact','foreignKey':_0x694e('0x161')});db[_0x694e('0xd2')][_0x694e('0x151')](db[_0x694e('0x12a')],{});db[_0x694e('0xd2')][_0x694e('0x151')](db['SmsMessage'],{});db[_0x694e('0xd2')][_0x694e('0x151')](db['User'],{});db[_0x694e('0xd2')]['belongsTo'](db['SmsQueue'],{});db['JscriptyProject'][_0x694e('0x110')](db[_0x694e('0xd0')],{'foreignKey':_0x694e('0x1de')});db[_0x694e('0xd6')][_0x694e('0x110')](db['JscriptyQuestionReport'],{'foreignKey':_0x694e('0x1de')});db['JscriptyProject']['hasMany'](db[_0x694e('0xcc')],{'foreignKey':_0x694e('0x1de')});db['Team'][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':_0x694e('0x172'),'through':'user_has_teams'});db['Team']['belongsToMany'](db[_0x694e('0x1d')],{'through':_0x694e('0x158'),'as':_0x694e('0x12e')});db['Team'][_0x694e('0x11e')](db[_0x694e('0x3f')],{'through':_0x694e('0x173'),'as':_0x694e('0x131')});db[_0x694e('0x156')][_0x694e('0x11e')](db[_0x694e('0x70')],{'through':_0x694e('0x199'),'as':_0x694e('0x132')});db[_0x694e('0x156')][_0x694e('0x11e')](db[_0x694e('0x51')],{'through':'team_has_fax_queues','as':_0x694e('0x133')});db[_0x694e('0x156')][_0x694e('0x11e')](db[_0x694e('0x5a')],{'through':_0x694e('0x18a'),'as':_0x694e('0x134')});db[_0x694e('0x156')]['belongsToMany'](db[_0x694e('0x63')],{'through':_0x694e('0x1df'),'as':'OpenchannelQueues'});db['Team'][_0x694e('0x11e')](db[_0x694e('0x101')],{'through':'team_has_whatsapp_queues','as':_0x694e('0x137')});db[_0x694e('0x156')][_0x694e('0x11e')](db[_0x694e('0xf1')],{'through':'TeamVoicePrefix','as':_0x694e('0x1e0')});db[_0x694e('0x1a0')][_0x694e('0x110')](db[_0x694e('0x14c')],{'as':_0x694e('0x14d'),'foreignKey':'CampaignId'});db[_0x694e('0x1a0')]['hasMany'](db[_0x694e('0x77')],{'as':_0x694e('0x112'),'foreignKey':'CampaignId'});db[_0x694e('0x1a0')][_0x694e('0x110')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0x694e('0x1a0')][_0x694e('0x110')](db[_0x694e('0x76')],{'as':'HopperBlacks','foreignKey':_0x694e('0x1a2')});db[_0x694e('0x1a0')][_0x694e('0x151')](db['Trunk'],{'as':_0x694e('0x150'),'foreignKey':'TrunkId'});db[_0x694e('0x1a0')][_0x694e('0x151')](db['Trunk'],{'as':_0x694e('0x152'),'foreignKey':'TrunkBackupId'});db[_0x694e('0x1a0')][_0x694e('0x151')](db[_0x694e('0x84')],{'as':_0x694e('0x84'),'foreignKey':_0x694e('0x153')});db['Campaign'][_0x694e('0x151')](db['SquareProject'],{'as':_0x694e('0xdb'),'foreignKey':_0x694e('0x1e1')});db['Campaign'][_0x694e('0x11e')](db['CmList'],{'as':_0x694e('0x124'),'through':_0x694e('0x1e2')});db['Campaign'][_0x694e('0x11e')](db[_0x694e('0xef')],{'as':_0x694e('0x159'),'through':_0x694e('0x1e3')});db[_0x694e('0xe4')][_0x694e('0x151')](db['ChatOfflineMessage'],{'as':_0x694e('0x17b'),'foreignKey':_0x694e('0x198')});db['MailTransferReport'][_0x694e('0x151')](db[_0x694e('0x16a')],{});db[_0x694e('0x1e4')][_0x694e('0x151')](db[_0x694e('0x43')],{});db[_0x694e('0x1e4')][_0x694e('0x151')](db['MailAccount'],{'foreignKey':_0x694e('0x1e5'),'as':_0x694e('0x1e6')});db[_0x694e('0x1e4')][_0x694e('0x151')](db['User'],{'foreignKey':_0x694e('0x1e7'),'as':_0x694e('0x1e8')});db[_0x694e('0x1e4')]['belongsTo'](db[_0x694e('0x13')],{'foreignKey':_0x694e('0x1e9'),'as':_0x694e('0x1ea')});db[_0x694e('0x1e4')]['belongsTo'](db[_0x694e('0x3f')],{'foreignKey':_0x694e('0x1eb'),'as':_0x694e('0x1ec')});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x694e('0x1ed')});db[_0x694e('0xe8')][_0x694e('0x151')](db[_0x694e('0x6d')],{});db[_0x694e('0xe8')][_0x694e('0x151')](db[_0x694e('0x6b')],{});db[_0x694e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x694e('0x1ee'),'as':_0x694e('0x1e6')});db['ChatTransferReport'][_0x694e('0x151')](db[_0x694e('0x13')],{'foreignKey':_0x694e('0x1e7'),'as':_0x694e('0x1e8')});db[_0x694e('0xe8')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x694e('0x1ea')});db[_0x694e('0xe8')][_0x694e('0x151')](db[_0x694e('0x70')],{'foreignKey':_0x694e('0x1ef'),'as':_0x694e('0x1ec')});db[_0x694e('0xe8')][_0x694e('0x151')](db[_0x694e('0x65')],{'foreignKey':_0x694e('0x1f0'),'as':_0x694e('0x1ed')});db[_0x694e('0xe9')]['belongsTo'](db[_0x694e('0x50')],{});db[_0x694e('0xe9')][_0x694e('0x151')](db[_0x694e('0x4e')],{});db[_0x694e('0xe9')][_0x694e('0x151')](db[_0x694e('0x4a')],{'foreignKey':_0x694e('0x1f1'),'as':'FromAccount'});db[_0x694e('0xe9')][_0x694e('0x151')](db[_0x694e('0x13')],{'foreignKey':_0x694e('0x1e7'),'as':_0x694e('0x1e8')});db[_0x694e('0xe9')][_0x694e('0x151')](db[_0x694e('0x13')],{'foreignKey':_0x694e('0x1e9'),'as':'ToAgent'});db['FaxTransferReport'][_0x694e('0x151')](db[_0x694e('0x51')],{'foreignKey':_0x694e('0x1f2'),'as':_0x694e('0x1ec')});db[_0x694e('0xe9')][_0x694e('0x151')](db[_0x694e('0x4a')],{'foreignKey':_0x694e('0x1f3'),'as':_0x694e('0x1ed')});db[_0x694e('0xeb')][_0x694e('0x151')](db[_0x694e('0x61')],{});db[_0x694e('0xeb')][_0x694e('0x151')](db[_0x694e('0x5f')],{});db[_0x694e('0xeb')][_0x694e('0x151')](db[_0x694e('0x5c')],{'foreignKey':_0x694e('0x1f4'),'as':_0x694e('0x1e6')});db[_0x694e('0xeb')][_0x694e('0x151')](db[_0x694e('0x13')],{'foreignKey':_0x694e('0x1e7'),'as':_0x694e('0x1e8')});db[_0x694e('0xeb')][_0x694e('0x151')](db[_0x694e('0x13')],{'foreignKey':_0x694e('0x1e9'),'as':_0x694e('0x1ea')});db[_0x694e('0xeb')][_0x694e('0x151')](db[_0x694e('0x63')],{'foreignKey':_0x694e('0x1f5'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x694e('0x151')](db[_0x694e('0x5c')],{'foreignKey':_0x694e('0x1f6'),'as':_0x694e('0x1ed')});db[_0x694e('0xed')][_0x694e('0x151')](db['SmsMessage'],{});db[_0x694e('0xed')][_0x694e('0x151')](db[_0x694e('0x12a')],{});db[_0x694e('0xed')][_0x694e('0x151')](db[_0x694e('0x54')],{'foreignKey':_0x694e('0x1f7'),'as':_0x694e('0x1e6')});db[_0x694e('0xed')][_0x694e('0x151')](db[_0x694e('0x13')],{'foreignKey':'FromUserId','as':_0x694e('0x1e8')});db['SmsTransferReport']['belongsTo'](db[_0x694e('0x13')],{'foreignKey':_0x694e('0x1e9'),'as':_0x694e('0x1ea')});db[_0x694e('0xed')][_0x694e('0x151')](db[_0x694e('0x5a')],{'foreignKey':_0x694e('0x1f8'),'as':_0x694e('0x1ec')});db['SmsTransferReport'][_0x694e('0x151')](db[_0x694e('0x54')],{'foreignKey':_0x694e('0x1f9'),'as':_0x694e('0x1ed')});db[_0x694e('0xef')]['hasMany'](db[_0x694e('0x166')],{'as':'Dispositions','foreignKey':_0x694e('0x17e'),'onDelete':_0x694e('0x10d')});db['CmList'][_0x694e('0x110')](db[_0x694e('0x7d')],{'as':'CustomFields','foreignKey':_0x694e('0x17e')});db[_0x694e('0xef')][_0x694e('0x110')](db[_0x694e('0x121')],{'as':_0x694e('0x122'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x694e('0xef')][_0x694e('0x110')](db['CmHopperFinal'],{'as':_0x694e('0x112'),'foreignKey':_0x694e('0x17e')});db[_0x694e('0xef')][_0x694e('0x110')](db[_0x694e('0x79')],{'as':_0x694e('0x113'),'foreignKey':_0x694e('0x17e')});db['CmList'][_0x694e('0x110')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x694e('0x17e')});db[_0x694e('0xef')]['belongsToMany'](db[_0x694e('0x1d')],{'as':_0x694e('0x1fa'),'through':_0x694e('0x155')});db[_0x694e('0xef')][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':_0x694e('0x172'),'through':_0x694e('0x125')});db['VoicePrefix'][_0x694e('0x110')](db['VoiceExtension'],{'as':_0x694e('0x1ad'),'onDelete':_0x694e('0x10d')});db[_0x694e('0xf1')]['belongsToMany'](db[_0x694e('0x13')],{'as':_0x694e('0x172'),'through':_0x694e('0x130')});db['VoicePrefix'][_0x694e('0x11e')](db[_0x694e('0x156')],{'through':'TeamVoicePrefix','as':_0x694e('0x157')});db[_0x694e('0xf3')][_0x694e('0x110')](db[_0x694e('0x13')],{'as':'Users','foreignKey':_0x694e('0x11d')});db[_0x694e('0xf3')]['hasMany'](db[_0x694e('0xf5')],{'as':_0x694e('0x1fb'),'foreignKey':_0x694e('0x11d'),'onDelete':_0x694e('0x10d')});db[_0x694e('0xf5')][_0x694e('0x110')](db[_0x694e('0x1fc')],{'as':_0x694e('0x1fd'),'foreignKey':_0x694e('0x1fe'),'onDelete':'cascade'});db[_0x694e('0xfa')][_0x694e('0x110')](db[_0x694e('0x166')],{'as':_0x694e('0x167'),'foreignKey':_0x694e('0x1ff'),'onDelete':_0x694e('0x10d')});db[_0x694e('0xfa')][_0x694e('0x110')](db[_0x694e('0x80')],{'as':_0x694e('0x168'),'foreignKey':_0x694e('0x1ff')});db['WhatsappAccount'][_0x694e('0x110')](db[_0x694e('0x200')],{'as':_0x694e('0x16b'),'foreignKey':_0x694e('0x1ff')});db[_0x694e('0xfa')][_0x694e('0x110')](db[_0x694e('0x119')],{'as':_0x694e('0x16c')});db[_0x694e('0xfa')]['hasMany'](db[_0x694e('0x201')],{'as':_0x694e('0x146'),'foreignKey':_0x694e('0x1ff'),'onDelete':_0x694e('0x10d')});db[_0x694e('0xfa')][_0x694e('0x151')](db[_0x694e('0xef')],{'as':_0x694e('0x16e'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x694e('0x151')](db[_0x694e('0x85')],{'as':_0x694e('0x171'),'foreignKey':_0x694e('0x154')});db['WhatsappAccount'][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':'Agents','through':_0x694e('0x144')});db[_0x694e('0x201')][_0x694e('0x151')](db['User'],{'onDelete':_0x694e('0x163')});db[_0x694e('0x201')][_0x694e('0x151')](db[_0x694e('0x101')],{'onDelete':_0x694e('0x163')});db[_0x694e('0x201')][_0x694e('0x151')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x694e('0x201')]['belongsTo'](db[_0x694e('0x84')],{'onDelete':_0x694e('0x163'),'foreignKey':'IntervalId'});db['WhatsappApplication'][_0x694e('0x151')](db[_0x694e('0x176')],{'onDelete':'restrict','foreignKey':_0x694e('0x17c')});db['WhatsappInteraction'][_0x694e('0x110')](db[_0x694e('0x200')],{'as':_0x694e('0x16b'),'onDelete':_0x694e('0x10d'),'foreignKey':'WhatsappInteractionId'});db[_0x694e('0x119')][_0x694e('0x151')](db[_0x694e('0xfa')],{'as':_0x694e('0x179'),'foreignKey':'WhatsappAccountId'});db[_0x694e('0x119')][_0x694e('0x151')](db['CmContact'],{'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161')});db[_0x694e('0x119')][_0x694e('0x151')](db[_0x694e('0x13')],{'as':_0x694e('0x175'),'foreignKey':_0x694e('0x10e')});db['WhatsappInteraction'][_0x694e('0x11e')](db['Tag'],{'through':_0x694e('0x1b2'),'as':_0x694e('0x178')});db['WhatsappInteraction']['belongsToMany'](db[_0x694e('0x176')],{'through':'whatsapp_interaction_has_tags','as':_0x694e('0x18e')});db['WhatsappInteraction']['belongsToMany'](db[_0x694e('0x13')],{'as':_0x694e('0x183'),'through':_0x694e('0x12d'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x694e('0x151')](db[_0x694e('0x13')],{'as':_0x694e('0x13')});db[_0x694e('0x200')][_0x694e('0x151')](db['CmContact'],{'onDelete':_0x694e('0x10d'),'as':_0x694e('0x160')});db[_0x694e('0x200')]['belongsTo'](db[_0x694e('0x119')],{'onDelete':'cascade','as':_0x694e('0x184'),'foreignKey':_0x694e('0x202')});db['WhatsappMessage'][_0x694e('0x151')](db['WhatsappAccount'],{'as':_0x694e('0x179'),'foreignKey':_0x694e('0x1ff')});db[_0x694e('0x203')][_0x694e('0x151')](db['WhatsappAccount'],{});db[_0x694e('0x203')][_0x694e('0x151')](db[_0x694e('0xef')],{'as':_0x694e('0x16e'),'foreignKey':'ListId'});db[_0x694e('0x203')][_0x694e('0x151')](db[_0x694e('0x121')],{'as':_0x694e('0x160'),'foreignKey':_0x694e('0x161')});db[_0x694e('0x203')]['belongsTo'](db[_0x694e('0x119')],{});db[_0x694e('0x203')][_0x694e('0x151')](db[_0x694e('0x101')],{});db[_0x694e('0x203')][_0x694e('0x151')](db['WhatsappMessage'],{});db[_0x694e('0x203')][_0x694e('0x151')](db['User'],{});db[_0x694e('0x100')][_0x694e('0x151')](db[_0x694e('0x200')],{});db[_0x694e('0x100')][_0x694e('0x151')](db[_0x694e('0x119')],{});db[_0x694e('0x100')][_0x694e('0x151')](db[_0x694e('0xfa')],{'foreignKey':'FromWhatsappAccountId','as':_0x694e('0x1e6')});db[_0x694e('0x100')][_0x694e('0x151')](db[_0x694e('0xfa')],{'foreignKey':_0x694e('0x204'),'as':_0x694e('0x1ed')});db[_0x694e('0x100')][_0x694e('0x151')](db[_0x694e('0x101')],{'foreignKey':_0x694e('0x205'),'as':_0x694e('0x1ec')});db[_0x694e('0x100')][_0x694e('0x151')](db[_0x694e('0x13')],{'foreignKey':_0x694e('0x1e7'),'as':_0x694e('0x1e8')});db[_0x694e('0x100')][_0x694e('0x151')](db['User'],{'foreignKey':_0x694e('0x1e9'),'as':'ToAgent'});db['WhatsappQueue'][_0x694e('0x11e')](db[_0x694e('0x13')],{'as':_0x694e('0x172'),'through':_0x694e('0x39'),'foreignKey':_0x694e('0x206')});db[_0x694e('0x101')][_0x694e('0x11e')](db[_0x694e('0x156')],{'through':_0x694e('0x207'),'as':_0x694e('0x157')});db[_0x694e('0x109')][_0x694e('0x151')](db[_0x694e('0x13')],{'as':_0x694e('0x208'),'foreignKey':_0x694e('0x10e'),'onDelete':_0x694e('0x10d'),'hooks':!![]});db[_0x694e('0x103')][_0x694e('0x10c')](db[_0x694e('0xbf')],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0x694e('0x103')][_0x694e('0x10c')](db[_0x694e('0x3b')],{'as':_0x694e('0x164'),'onDelete':_0x694e('0x163')});db[_0x694e('0x103')][_0x694e('0x10c')](db[_0x694e('0x3d')],{'as':'Smtp','onDelete':_0x694e('0x163')});module[_0x694e('0x209')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa668=['cascade','UserId','userSetting','hasMany','Recordings','VoiceExtension','Extensions','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','user_has_teams','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','UserVoiceQueueRt','VoiceQueueId','HopperFinals','HopperHistories','JscriptySessionReport','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','QueueCalls','uniqueid','MailAccountId','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','TemplateId','team_has_mail_queues','MailInteractionId','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Contact','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','List','ListId','Dashboard','FaxAccountId','FaxApplication','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ProactiveActions','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatMessage','team_has_chat_queues','ChatGroupId','Members','ChatProactiveAction','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','Queue','CampaignId','OwnerId','Any','AutomationAnyId','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','ContactItemType','ItemType','ItemTypeId','Hopper','CmHopperId','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Action','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','SalesforceField','Descriptions','FieldId','Subject','SubjectId','Description','DescriptionId','Field','VariableId','Subjects','int_desk_configuration_has_tags','ZendeskConfiguration','FreshdeskField','VtigerField','ServicenowConfiguration','CloudProviderId','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','SessionId','ProjectId','MailQueues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','Queues','UserProfile','UserProfileSections','UserProfileSection','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','xcall','username','password','options','database','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../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','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','Tag','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','SmsQueueReport','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','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne'];(function(_0x29a425,_0xc2c879){var _0x5a3165=function(_0x211fb3){while(--_0x211fb3){_0x29a425['push'](_0x29a425['shift']());}};_0x5a3165(++_0xc2c879);}(_0xa668,0xec));var _0x8a66=function(_0x77e1f4,_0x1f4a2e){_0x77e1f4=_0x77e1f4-0x0;var _0x383ece=_0xa668[_0x77e1f4];return _0x383ece;};'use strict';var config=require(_0x8a66('0x0'));var Sequelize=require(_0x8a66('0x1'));var _=require(_0x8a66('0x2'));var jstz=require(_0x8a66('0x3'));var timezone=jstz[_0x8a66('0x4')]();config[_0x8a66('0x1')]=_[_0x8a66('0x5')](config[_0x8a66('0x1')],{'database':_0x8a66('0x6'),'username':'xcall','password':_0x8a66('0x7'),'options':{'host':_0x8a66('0x8'),'port':0xcea,'dialect':_0x8a66('0x9'),'dialectOptions':{'charset':_0x8a66('0xa')},'logging':![],'timezone':timezone[_0x8a66('0xb')](),'define':{'charset':_0x8a66('0xc'),'collate':'utf8_general_ci'}}});config[_0x8a66('0xd')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':'motion2','username':_0x8a66('0xe'),'password':'xC@LL1234','options':{'host':_0x8a66('0x8'),'port':0xcea,'dialect':_0x8a66('0x9'),'dialectOptions':{'charset':_0x8a66('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x8a66('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8a66('0x1')]['database'],config['sequelize'][_0x8a66('0xf')],config['sequelize'][_0x8a66('0x10')],config[_0x8a66('0x1')][_0x8a66('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x8a66('0x12')],config[_0x8a66('0xd')][_0x8a66('0xf')],config[_0x8a66('0xd')][_0x8a66('0x10')],config[_0x8a66('0xd')][_0x8a66('0x11')])};db[_0x8a66('0x13')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x15'));db['VoiceChanSpy']=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x16'));db[_0x8a66('0x17')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x18'));db['VoiceExtension']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x19'));db[_0x8a66('0x1a')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x1b'));db[_0x8a66('0x1c')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x1d'));db[_0x8a66('0x1e')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x1f'));db[_0x8a66('0x20')]=db['sequelize']['import'](_0x8a66('0x21'));db[_0x8a66('0x22')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x23'));db[_0x8a66('0x24')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x25'));db[_0x8a66('0x26')]=db['sequelize']['import'](_0x8a66('0x27'));db[_0x8a66('0x28')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x29'));db[_0x8a66('0x2a')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x8a66('0x2b')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x2c'));db[_0x8a66('0x2d')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x2e'));db[_0x8a66('0x2f')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x30'));db['UserVoiceQueueRt']=db[_0x8a66('0x1')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x8a66('0x31')]=db[_0x8a66('0x1')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0x8a66('0x1')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x8a66('0x32')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x33'));db[_0x8a66('0x34')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0x8a66('0x35')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x36'));db[_0x8a66('0x37')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x38'));db[_0x8a66('0x39')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x3a'));db[_0x8a66('0x3b')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x3c'));db[_0x8a66('0x3d')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x3e'));db[_0x8a66('0x3f')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x40'));db[_0x8a66('0x41')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x42'));db[_0x8a66('0x43')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x44'));db[_0x8a66('0x45')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x46'));db[_0x8a66('0x47')]=db['sequelize']['import'](_0x8a66('0x48'));db[_0x8a66('0x49')]=db[_0x8a66('0x1')]['import']('../api/mailApplication/mailApplication.model');db[_0x8a66('0x4a')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x4b'));db['Dashboard']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x4c'));db[_0x8a66('0x4d')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0x8a66('0x4e')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x8a66('0x1')]['import'](_0x8a66('0x4f'));db['FaxInteraction']=db['sequelize'][_0x8a66('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0x8a66('0x50')]=db['sequelize']['import'](_0x8a66('0x51'));db[_0x8a66('0x52')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x53'));db['FaxQueueReport']=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x54'));db['SmsApplication']=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/smsApplication/smsApplication.model');db[_0x8a66('0x55')]=db['sequelize']['import'](_0x8a66('0x56'));db[_0x8a66('0x57')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x58'));db[_0x8a66('0x59')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x5a'));db['OpenchannelAccount']=db[_0x8a66('0x1')]['import'](_0x8a66('0x5b'));db['OpenchannelApplication']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x5c'));db[_0x8a66('0x5d')]=db['sequelize'][_0x8a66('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x8a66('0x5e')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x5f'));db['OpenchannelQueue']=db[_0x8a66('0x1')]['import'](_0x8a66('0x60'));db[_0x8a66('0x61')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x62'));db[_0x8a66('0x63')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x64'));db[_0x8a66('0x65')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x66'));db['ChatInteraction']=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x67'));db['ChatMessage']=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x68'));db[_0x8a66('0x69')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x6a'));db[_0x8a66('0x6b')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x6c'));db[_0x8a66('0x6d')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x6e'));db['ChatProactiveAction']=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x6f'));db[_0x8a66('0x70')]=db['sequelize']['import'](_0x8a66('0x71'));db[_0x8a66('0x72')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x73'));db[_0x8a66('0x74')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x75'));db[_0x8a66('0x76')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x77'));db[_0x8a66('0x78')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x79'));db[_0x8a66('0x7a')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x7b'));db[_0x8a66('0x7c')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x7d'));db[_0x8a66('0x7e')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x7f'));db['Action']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x80'));db[_0x8a66('0x81')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x82'));db[_0x8a66('0x83')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x84'));db[_0x8a66('0x85')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x86'));db[_0x8a66('0x87')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x88'));db[_0x8a66('0x89')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x8a'));db[_0x8a66('0x8b')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x8c'));db[_0x8a66('0x8d')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x8e'));db[_0x8a66('0x8f')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/schedule/schedule.model');db[_0x8a66('0x90')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/sound/sound.model');db[_0x8a66('0x91')]=db['sequelize']['import']('../api/tag/tag.model');db['ContactItemType']=db['sequelize']['import'](_0x8a66('0x92'));db[_0x8a66('0x93')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x94'));db[_0x8a66('0x95')]=db['sequelize'][_0x8a66('0x14')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x8a66('0x96')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x97'));db[_0x8a66('0x98')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x99'));db[_0x8a66('0x9a')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x9b'));db[_0x8a66('0x9c')]=db['sequelize'][_0x8a66('0x14')]('../api/integration/integration.model');db[_0x8a66('0x9d')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x9e'));db['AnalyticCustomReport']=db['sequelize'][_0x8a66('0x14')](_0x8a66('0x9f'));db['AnalyticDefaultReport']=db['sequelize'][_0x8a66('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x8a66('0xa0')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xa1'));db[_0x8a66('0xa2')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xa3'));db['AnalyticFieldReport']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xa4'));db['AnalyticTreeReport']=db['sequelize']['import'](_0x8a66('0xa5'));db[_0x8a66('0xa6')]=db['sequelize'][_0x8a66('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x8a66('0xa7')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0xa8'));db['SalesforceField']=db['sequelize'][_0x8a66('0x14')](_0x8a66('0xa9'));db[_0x8a66('0xaa')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0xab'));db[_0x8a66('0xac')]=db[_0x8a66('0x1')]['import'](_0x8a66('0xad'));db[_0x8a66('0xae')]=db[_0x8a66('0x1')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x8a66('0xaf')]=db[_0x8a66('0x1')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x8a66('0xb0')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0xb1'));db[_0x8a66('0xb2')]=db['sequelize'][_0x8a66('0x14')]('../api/intDeskField/intDeskField.model');db[_0x8a66('0xb3')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xb4'));db[_0x8a66('0xb5')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xb6'));db[_0x8a66('0xb7')]=db['sequelize'][_0x8a66('0x14')]('../api/intZohoField/intZohoField.model');db[_0x8a66('0xb8')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xb9'));db[_0x8a66('0xba')]=db['sequelize'][_0x8a66('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0x8a66('0xbb')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x8a66('0xbc')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xbd'));db['FreshdeskField']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xbe'));db['VtigerAccount']=db[_0x8a66('0x1')]['import'](_0x8a66('0xbf'));db[_0x8a66('0xc0')]=db[_0x8a66('0x1')]['import'](_0x8a66('0xc1'));db['VtigerField']=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x8a66('0xc2')]=db[_0x8a66('0x1')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x8a66('0x1')]['import'](_0x8a66('0xc3'));db[_0x8a66('0xc4')]=db[_0x8a66('0x1')]['import'](_0x8a66('0xc5'));db[_0x8a66('0xc6')]=db[_0x8a66('0x1')]['import'](_0x8a66('0xc7'));db[_0x8a66('0xc8')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0xc9'));db[_0x8a66('0xca')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0xcb'));db[_0x8a66('0xcc')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xcd'));db['FreshsalesConfiguration']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xce'));db[_0x8a66('0xcf')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xd0'));db['Integration']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xd1'));db['Network']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xd2'));db['ChatQueueReport']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xd3'));db[_0x8a66('0xd4')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0xd5'));db[_0x8a66('0xd6')]=db[_0x8a66('0x1')]['import'](_0x8a66('0xd7'));db[_0x8a66('0xd8')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x8a66('0xd9')]=db['sequelize'][_0x8a66('0x14')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db['sequelize'][_0x8a66('0x14')]('../api/squareReport/squareReport.model');db[_0x8a66('0xda')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xdb'));db[_0x8a66('0xdc')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xdd'));db[_0x8a66('0xde')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xdf'));db[_0x8a66('0xe0')]=db[_0x8a66('0x1')]['import'](_0x8a66('0xe1'));db[_0x8a66('0xe2')]=db[_0x8a66('0x1')]['import'](_0x8a66('0xe3'));db[_0x8a66('0xe4')]=db[_0x8a66('0x1')]['import'](_0x8a66('0xe5'));db['SquareMessage']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xe6'));db[_0x8a66('0xe7')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xe8'));db[_0x8a66('0xe9')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xea'));db[_0x8a66('0xeb')]=db['sequelize']['import']('../api/campaign/campaign.model');db[_0x8a66('0xec')]=db['sequelize']['import'](_0x8a66('0xed'));db[_0x8a66('0xee')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xef'));db[_0x8a66('0xf0')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xf1'));db['MailTransferReport']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xf2'));db[_0x8a66('0xf3')]=db['sequelize'][_0x8a66('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x8a66('0xf4')]=db[_0x8a66('0x1')][_0x8a66('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0x8a66('0xf5')]=db['sequelize'][_0x8a66('0x14')](_0x8a66('0xf6'));db[_0x8a66('0xf7')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xf8'));db[_0x8a66('0xf9')]=db[_0x8a66('0x1')]['import'](_0x8a66('0xfa'));db[_0x8a66('0xfb')]=db['sequelize'][_0x8a66('0x14')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0x8a66('0x1')]['import'](_0x8a66('0xfc'));db['UserProfileSection']=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0xfd'));db[_0x8a66('0xfe')]=db['sequelize'][_0x8a66('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x8a66('0xff')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x100'));db[_0x8a66('0x101')]=db[_0x8a66('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x8a66('0x102')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x103'));db[_0x8a66('0x104')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x105'));db[_0x8a66('0x106')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x107'));db['WhatsappQueueReport']=db[_0x8a66('0x1')]['import'](_0x8a66('0x108'));db[_0x8a66('0x109')]=db['sequelize'][_0x8a66('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x8a66('0x10a')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x10b'));db[_0x8a66('0x10c')]=db[_0x8a66('0x1')]['import'](_0x8a66('0x10d'));db[_0x8a66('0x10e')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x10f'));db[_0x8a66('0x110')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x111'));db[_0x8a66('0x112')]=db[_0x8a66('0x1')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0x8a66('0x113')]=db[_0x8a66('0x1')][_0x8a66('0x14')](_0x8a66('0x114'));db['MailInteractionHasTag']=db[_0x8a66('0x1')]['import'](_0x8a66('0x115'));db[_0x8a66('0x13')][_0x8a66('0x116')](db[_0x8a66('0x22')],{'as':_0x8a66('0x22'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x118')});db['User'][_0x8a66('0x116')](db[_0x8a66('0x113')],{'as':_0x8a66('0x119'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x118')});db[_0x8a66('0x13')][_0x8a66('0x11a')](db[_0x8a66('0x1e')],{'as':_0x8a66('0x11b'),'foreignKey':_0x8a66('0x118')});db[_0x8a66('0x13')][_0x8a66('0x11a')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0x8a66('0x118')});db[_0x8a66('0x13')][_0x8a66('0x11a')](db[_0x8a66('0x11c')],{'as':_0x8a66('0x11d'),'onDelete':_0x8a66('0x117'),'hooks':!![]});db['User'][_0x8a66('0x11a')](db[_0x8a66('0x78')],{'as':'HopperFinals','foreignKey':_0x8a66('0x118')});db[_0x8a66('0x13')][_0x8a66('0x11a')](db[_0x8a66('0x7a')],{'as':_0x8a66('0x11e'),'foreignKey':_0x8a66('0x118')});db['User'][_0x8a66('0x11a')](db[_0x8a66('0x7c')],{'as':_0x8a66('0x7c'),'foreignKey':_0x8a66('0x118')});db[_0x8a66('0x13')][_0x8a66('0x11a')](db['OpenchannelInteraction'],{'as':_0x8a66('0x11f'),'foreignKey':_0x8a66('0x118')});db['User']['hasMany'](db['ChatInteraction'],{'as':_0x8a66('0x120'),'foreignKey':_0x8a66('0x118')});db[_0x8a66('0x13')]['hasMany'](db['SmsInteraction'],{'as':_0x8a66('0x121'),'foreignKey':'UserId'});db[_0x8a66('0x13')]['hasMany'](db[_0x8a66('0x122')],{'as':_0x8a66('0x123'),'foreignKey':_0x8a66('0x118')});db[_0x8a66('0x13')][_0x8a66('0x11a')](db['MailInteraction'],{'as':_0x8a66('0x124'),'foreignKey':_0x8a66('0x118')});db[_0x8a66('0x13')][_0x8a66('0x11a')](db[_0x8a66('0x104')],{'as':_0x8a66('0x125'),'foreignKey':_0x8a66('0x118')});db[_0x8a66('0x13')][_0x8a66('0x11a')](db[_0x8a66('0xff')],{'as':_0x8a66('0x126'),'foreignKey':_0x8a66('0x127')});db[_0x8a66('0x13')][_0x8a66('0x11a')](db[_0x8a66('0x74')],{'as':_0x8a66('0x128'),'foreignKey':_0x8a66('0x118'),'onDelete':_0x8a66('0x129')});db[_0x8a66('0x13')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x8a66('0x12a')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x6d')],{'as':_0x8a66('0x12c'),'through':_0x8a66('0x12d')});db['User'][_0x8a66('0x12b')](db[_0x8a66('0x72')],{'as':_0x8a66('0x12e'),'through':_0x8a66('0x12f')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0xf9')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x8a66('0x13')][_0x8a66('0x12b')](db['Team'],{'through':_0x8a66('0x130')});db['User'][_0x8a66('0x12b')](db[_0x8a66('0x45')],{'as':_0x8a66('0x124'),'through':'user_has_mail_interactions'});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x131')],{'as':'ChatInteractions','through':_0x8a66('0x132')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x122')],{'as':_0x8a66('0x123'),'through':_0x8a66('0x133')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x55')],{'as':'SmsInteractions','through':_0x8a66('0x134')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db['OpenchannelInteraction'],{'as':_0x8a66('0x11f'),'through':_0x8a66('0x135')});db['User'][_0x8a66('0x12b')](db[_0x8a66('0x104')],{'as':'WhatsappInteractions','through':_0x8a66('0x136')});db['User'][_0x8a66('0x12b')](db[_0x8a66('0x1c')],{'as':_0x8a66('0x137'),'through':'UserVoiceQueue','required':![]});db['User']['belongsToMany'](db[_0x8a66('0xfb')],{'as':_0x8a66('0x138'),'through':_0x8a66('0x112'),'required':![]});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x41')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db['User'][_0x8a66('0x12b')](db[_0x8a66('0x6b')],{'as':_0x8a66('0x139'),'through':_0x8a66('0x13a'),'required':![],'hooks':!![]});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x52')],{'as':_0x8a66('0x13b'),'through':_0x8a66('0x34'),'required':![]});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x59')],{'as':_0x8a66('0x13c'),'through':'UserSmsQueue','required':![]});db[_0x8a66('0x13')]['belongsToMany'](db[_0x8a66('0x13d')],{'as':_0x8a66('0x13e'),'through':_0x8a66('0x37'),'required':![]});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x10a')],{'as':_0x8a66('0x13f'),'through':'UserWhatsappQueue','required':![]});db[_0x8a66('0x13')]['belongsToMany'](db[_0x8a66('0xf9')],{'through':_0x8a66('0x140')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x61')],{'as':_0x8a66('0x141'),'through':_0x8a66('0x142')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db['FaxAccount'],{'as':_0x8a66('0x143'),'through':_0x8a66('0x144')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db['MailAccount'],{'as':'MailAccounts','through':_0x8a66('0x145')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x146')],{'as':'OpenchannelAccounts','through':_0x8a66('0x147')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db[_0x8a66('0x148')],{'as':_0x8a66('0x149'),'through':_0x8a66('0x14a')});db[_0x8a66('0x13')][_0x8a66('0x12b')](db['WhatsappAccount'],{'as':_0x8a66('0x14b'),'through':'user_has_whatsapp_accounts'});db[_0x8a66('0x14c')]['hasMany'](db[_0x8a66('0x11c')],{'as':_0x8a66('0x14d'),'onDelete':'cascade','foreignKey':_0x8a66('0x14e')});db['VoiceContext']['hasMany'](db[_0x8a66('0x11c')],{'onDelete':_0x8a66('0x117')});db[_0x8a66('0x11c')][_0x8a66('0x11a')](db[_0x8a66('0x11c')],{'as':_0x8a66('0x14f'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x1a')]['belongsToMany'](db['Sound'],{'as':_0x8a66('0x150'),'through':_0x8a66('0x151')});db['VoiceQueue']['hasMany'](db[_0x8a66('0x152')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x8a66('0x1c')]['hasMany'](db['CmHopper'],{'as':_0x8a66('0x128'),'foreignKey':_0x8a66('0x153')});db['VoiceQueue'][_0x8a66('0x11a')](db['CmHopperFinal'],{'as':_0x8a66('0x154'),'foreignKey':'VoiceQueueId'});db[_0x8a66('0x1c')][_0x8a66('0x11a')](db[_0x8a66('0x7a')],{'as':_0x8a66('0x155'),'foreignKey':_0x8a66('0x153')});db[_0x8a66('0x1c')][_0x8a66('0x11a')](db[_0x8a66('0x7c')],{'as':_0x8a66('0x7c'),'foreignKey':_0x8a66('0x153')});db[_0x8a66('0x1c')][_0x8a66('0x11a')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x8a66('0x1c')]['hasMany'](db[_0x8a66('0x156')],{'as':_0x8a66('0x157'),'foreignKey':_0x8a66('0x153')});db['VoiceQueue'][_0x8a66('0x158')](db['Trunk'],{'as':_0x8a66('0x2f'),'foreignKey':_0x8a66('0x159')});db['VoiceQueue']['belongsTo'](db[_0x8a66('0x2f')],{'as':_0x8a66('0x15a'),'foreignKey':_0x8a66('0x15b')});db['VoiceQueue']['belongsTo'](db[_0x8a66('0x87')],{'as':_0x8a66('0x87'),'foreignKey':_0x8a66('0x15c')});db[_0x8a66('0x1c')][_0x8a66('0x158')](db[_0x8a66('0x89')],{'as':_0x8a66('0x15d'),'foreignKey':_0x8a66('0x15e')});db[_0x8a66('0x1c')][_0x8a66('0x12b')](db[_0x8a66('0xf9')],{'as':'Lists','through':_0x8a66('0x15f')});db[_0x8a66('0x1c')][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x160'),'through':'UserVoiceQueue'});db[_0x8a66('0x1c')][_0x8a66('0x12b')](db[_0x8a66('0xe7')],{'as':_0x8a66('0x161'),'through':_0x8a66('0x10e')});db[_0x8a66('0x1c')]['belongsToMany'](db[_0x8a66('0xf9')],{'as':_0x8a66('0x162'),'through':_0x8a66('0x163')});db[_0x8a66('0x1e')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'as':'User','foreignKey':_0x8a66('0x118')});db['ScreenRecording'][_0x8a66('0x158')](db[_0x8a66('0x13')],{'as':_0x8a66('0x13'),'foreignKey':_0x8a66('0x118')});db['VoiceMail']['hasMany'](db['VoiceMailMessage'],{'as':_0x8a66('0x164'),'onDelete':_0x8a66('0x117'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x8a66('0x24')][_0x8a66('0x158')](db[_0x8a66('0x22')],{'foreignKey':_0x8a66('0x165'),'targetKey':'mailbox'});db[_0x8a66('0x26')]['hasMany'](db[_0x8a66('0x2b')],{'as':_0x8a66('0x166'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x8a66('0x11a')](db[_0x8a66('0x2a')],{'as':'AgentReports','foreignKey':_0x8a66('0x167'),'constraints':![]});db[_0x8a66('0x26')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'as':'User','foreignKey':_0x8a66('0x118')});db[_0x8a66('0x26')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8a66('0x3b')]['belongsTo'](db['MailAccount'],{'as':_0x8a66('0x3f'),'foreignKey':_0x8a66('0x168')});db[_0x8a66('0x3b')][_0x8a66('0x158')](db[_0x8a66('0x10c')],{'as':_0x8a66('0x10c'),'foreignKey':'CloudProviderId','onDelete':_0x8a66('0x169')});db[_0x8a66('0x3d')][_0x8a66('0x158')](db[_0x8a66('0x3f')],{'as':_0x8a66('0x3f'),'foreignKey':'MailAccountId'});db[_0x8a66('0x3d')][_0x8a66('0x158')](db[_0x8a66('0x10c')],{'as':_0x8a66('0x10c'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db['MailAccount'][_0x8a66('0x116')](db[_0x8a66('0x3b')],{'as':_0x8a66('0x16a'),'onDelete':_0x8a66('0x117')});db['MailAccount'][_0x8a66('0x116')](db[_0x8a66('0x3d')],{'as':_0x8a66('0x16b'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x3f')]['hasMany'](db[_0x8a66('0x16c')],{'as':_0x8a66('0x16d'),'foreignKey':_0x8a66('0x168'),'onDelete':_0x8a66('0x117')});db['MailAccount'][_0x8a66('0x11a')](db[_0x8a66('0x83')],{'as':_0x8a66('0x16e'),'foreignKey':_0x8a66('0x168')});db[_0x8a66('0x3f')][_0x8a66('0x11a')](db['MailMessage'],{'as':_0x8a66('0x164'),'foreignKey':'MailAccountId'});db[_0x8a66('0x3f')]['hasMany'](db['MailInteraction'],{'as':_0x8a66('0x16f')});db[_0x8a66('0x3f')][_0x8a66('0x11a')](db[_0x8a66('0x49')],{'as':'Applications','foreignKey':_0x8a66('0x168'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x3f')][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':'List','foreignKey':'ListId'});db['MailAccount'][_0x8a66('0x158')](db[_0x8a66('0x96')],{'as':_0x8a66('0x96'),'foreignKey':_0x8a66('0x170')});db['MailAccount'][_0x8a66('0x158')](db[_0x8a66('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x8a66('0x15e')});db[_0x8a66('0x3f')][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x160'),'through':_0x8a66('0x145')});db['MailQueue'][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x160'),'through':'UserMailQueue'});db[_0x8a66('0x41')][_0x8a66('0x12b')](db[_0x8a66('0xe7')],{'through':_0x8a66('0x171'),'as':'Teams'});db['MailInteraction'][_0x8a66('0x11a')](db[_0x8a66('0x47')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x8a66('0x172')});db[_0x8a66('0x45')][_0x8a66('0x158')](db[_0x8a66('0x3f')],{'as':'Account','foreignKey':_0x8a66('0x168')});db[_0x8a66('0x45')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'as':'Contact','foreignKey':_0x8a66('0x173')});db[_0x8a66('0x45')][_0x8a66('0x158')](db['User'],{'as':_0x8a66('0x174'),'foreignKey':'UserId'});db[_0x8a66('0x45')]['belongsToMany'](db[_0x8a66('0x91')],{'through':_0x8a66('0x175'),'as':_0x8a66('0x176')});db[_0x8a66('0x45')][_0x8a66('0x12b')](db['Tag'],{'through':_0x8a66('0x175'),'as':_0x8a66('0x177')});db[_0x8a66('0x45')][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x178'),'through':'user_has_mail_interactions','foreignKey':_0x8a66('0x172')});db[_0x8a66('0x47')]['hasMany'](db[_0x8a66('0xee')],{'as':_0x8a66('0x179'),'onDelete':_0x8a66('0x117')});db['MailMessage'][_0x8a66('0x158')](db[_0x8a66('0x13')],{'as':_0x8a66('0x13')});db[_0x8a66('0x47')]['belongsTo'](db[_0x8a66('0x72')],{'onDelete':'cascade','as':_0x8a66('0x17a')});db[_0x8a66('0x47')][_0x8a66('0x158')](db['MailInteraction'],{'as':_0x8a66('0x17b'),'foreignKey':_0x8a66('0x172')});db[_0x8a66('0x47')][_0x8a66('0x158')](db[_0x8a66('0x3f')],{'as':_0x8a66('0x17c'),'foreignKey':'MailAccountId'});db[_0x8a66('0x47')][_0x8a66('0x158')](db[_0x8a66('0x61')],{'as':_0x8a66('0x61'),'foreignKey':_0x8a66('0x17d')});db[_0x8a66('0x47')][_0x8a66('0x158')](db[_0x8a66('0x69')],{'as':_0x8a66('0x69'),'foreignKey':_0x8a66('0x17e')});db[_0x8a66('0x49')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'onDelete':_0x8a66('0x169')});db['MailApplication']['belongsTo'](db[_0x8a66('0x41')],{'onDelete':_0x8a66('0x169')});db['MailApplication'][_0x8a66('0x158')](db[_0x8a66('0x3f')],{'onDelete':_0x8a66('0x169')});db[_0x8a66('0x49')][_0x8a66('0x158')](db['Interval'],{'onDelete':_0x8a66('0x169'),'foreignKey':_0x8a66('0x15c')});db[_0x8a66('0x49')][_0x8a66('0x158')](db[_0x8a66('0x91')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x8a66('0x4a')][_0x8a66('0x158')](db[_0x8a66('0x3f')],{});db['MailQueueReport'][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':_0x8a66('0x180')});db[_0x8a66('0x4a')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'as':'Contact','foreignKey':_0x8a66('0x173')});db[_0x8a66('0x4a')][_0x8a66('0x158')](db['MailInteraction'],{});db[_0x8a66('0x4a')]['belongsTo'](db['MailMessage'],{});db[_0x8a66('0x4a')][_0x8a66('0x158')](db[_0x8a66('0x13')],{});db['MailQueueReport'][_0x8a66('0x158')](db[_0x8a66('0x41')],{});db[_0x8a66('0x181')][_0x8a66('0x11a')](db[_0x8a66('0x4d')],{'as':'Items','onDelete':_0x8a66('0x117')});db[_0x8a66('0x4e')][_0x8a66('0x11a')](db['Disposition'],{'as':_0x8a66('0x16d'),'foreignKey':_0x8a66('0x182'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x4e')][_0x8a66('0x11a')](db['CannedAnswer'],{'as':_0x8a66('0x16e'),'foreignKey':_0x8a66('0x182')});db[_0x8a66('0x4e')][_0x8a66('0x11a')](db[_0x8a66('0x122')],{'as':_0x8a66('0x16f')});db[_0x8a66('0x4e')][_0x8a66('0x11a')](db[_0x8a66('0x183')],{'as':_0x8a66('0x14f'),'foreignKey':_0x8a66('0x182'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x4e')][_0x8a66('0x11a')](db[_0x8a66('0x11c')],{'as':'Exntensions','onDelete':'cascade'});db[_0x8a66('0x4e')]['hasMany'](db[_0x8a66('0x50')],{'as':_0x8a66('0x164')});db[_0x8a66('0x4e')]['belongsTo'](db['Trunk'],{'as':_0x8a66('0x2f')});db[_0x8a66('0x4e')][_0x8a66('0x158')](db['CmList'],{'as':_0x8a66('0x17f'),'foreignKey':'ListId'});db[_0x8a66('0x4e')][_0x8a66('0x158')](db[_0x8a66('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x8a66('0x15e')});db[_0x8a66('0x4e')][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x160'),'through':'user_has_fax_accounts'});db[_0x8a66('0x183')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'onDelete':_0x8a66('0x169')});db['FaxApplication']['belongsTo'](db[_0x8a66('0x52')],{'onDelete':_0x8a66('0x169')});db['FaxApplication'][_0x8a66('0x158')](db[_0x8a66('0x4e')],{'onDelete':_0x8a66('0x169')});db['FaxApplication'][_0x8a66('0x158')](db['Tag'],{'onDelete':_0x8a66('0x169'),'foreignKey':_0x8a66('0x184')});db[_0x8a66('0x122')]['hasMany'](db[_0x8a66('0x50')],{'as':_0x8a66('0x164'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x185')});db['FaxInteraction']['belongsTo'](db[_0x8a66('0x4e')],{'as':'Account','foreignKey':_0x8a66('0x182')});db[_0x8a66('0x122')][_0x8a66('0x158')](db['CmContact'],{'as':_0x8a66('0x17a'),'foreignKey':_0x8a66('0x173')});db[_0x8a66('0x122')]['belongsTo'](db[_0x8a66('0x13')],{'as':'Owner','foreignKey':_0x8a66('0x118')});db['FaxInteraction'][_0x8a66('0x12b')](db['Tag'],{'through':_0x8a66('0x186'),'as':_0x8a66('0x176')});db[_0x8a66('0x122')][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction'][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x178'),'through':_0x8a66('0x133'),'foreignKey':_0x8a66('0x185')});db[_0x8a66('0x50')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'onDelete':_0x8a66('0x117'),'as':'User'});db[_0x8a66('0x50')][_0x8a66('0x158')](db['FaxInteraction'],{'as':_0x8a66('0x17b'),'foreignKey':_0x8a66('0x185')});db[_0x8a66('0x50')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'onDelete':_0x8a66('0x117'),'as':_0x8a66('0x17a')});db[_0x8a66('0x50')][_0x8a66('0x158')](db[_0x8a66('0xee')],{'as':'Attachment','foreignKey':_0x8a66('0x187')});db[_0x8a66('0x50')][_0x8a66('0x158')](db['FaxAccount'],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x182')});db[_0x8a66('0x52')][_0x8a66('0x12b')](db['User'],{'as':_0x8a66('0x160'),'through':_0x8a66('0x34')});db[_0x8a66('0x52')][_0x8a66('0x12b')](db['Team'],{'through':_0x8a66('0x188'),'as':_0x8a66('0x161')});db[_0x8a66('0x189')][_0x8a66('0x158')](db[_0x8a66('0x4e')],{});db['FaxQueueReport'][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':_0x8a66('0x180')});db['FaxQueueReport'][_0x8a66('0x158')](db[_0x8a66('0x72')],{'as':_0x8a66('0x17a'),'foreignKey':_0x8a66('0x173')});db[_0x8a66('0x189')]['belongsTo'](db[_0x8a66('0x122')],{});db['FaxQueueReport'][_0x8a66('0x158')](db[_0x8a66('0x50')],{});db[_0x8a66('0x189')]['belongsTo'](db[_0x8a66('0x13')],{});db[_0x8a66('0x189')]['belongsTo'](db['FaxQueue'],{});db[_0x8a66('0x148')][_0x8a66('0x11a')](db[_0x8a66('0x16c')],{'as':_0x8a66('0x16d'),'foreignKey':'SmsAccountId','onDelete':_0x8a66('0x117')});db[_0x8a66('0x148')][_0x8a66('0x11a')](db[_0x8a66('0x83')],{'as':_0x8a66('0x16e'),'foreignKey':_0x8a66('0x18a')});db[_0x8a66('0x148')]['hasMany'](db[_0x8a66('0x57')],{'as':_0x8a66('0x164'),'foreignKey':_0x8a66('0x18a')});db[_0x8a66('0x148')][_0x8a66('0x11a')](db[_0x8a66('0x55')],{'as':_0x8a66('0x16f')});db['SmsAccount'][_0x8a66('0x11a')](db[_0x8a66('0x18b')],{'as':'Applications','foreignKey':'SmsAccountId','onDelete':_0x8a66('0x117')});db['SmsAccount'][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':'ListId'});db[_0x8a66('0x148')][_0x8a66('0x158')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x8a66('0x148')][_0x8a66('0x12b')](db['User'],{'as':_0x8a66('0x160'),'through':_0x8a66('0x14a')});db['SmsApplication'][_0x8a66('0x158')](db[_0x8a66('0x13')],{'onDelete':_0x8a66('0x169')});db['SmsApplication']['belongsTo'](db[_0x8a66('0x59')],{'onDelete':_0x8a66('0x169')});db[_0x8a66('0x18b')][_0x8a66('0x158')](db['SmsAccount'],{'onDelete':_0x8a66('0x169')});db[_0x8a66('0x18b')]['belongsTo'](db[_0x8a66('0x87')],{'onDelete':'restrict','foreignKey':_0x8a66('0x15c')});db[_0x8a66('0x18b')]['belongsTo'](db[_0x8a66('0x91')],{'onDelete':'restrict','foreignKey':_0x8a66('0x184')});db[_0x8a66('0x55')][_0x8a66('0x11a')](db[_0x8a66('0x57')],{'as':'Messages','onDelete':_0x8a66('0x117'),'foreignKey':'SmsInteractionId'});db[_0x8a66('0x55')][_0x8a66('0x158')](db[_0x8a66('0x148')],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x18a')});db[_0x8a66('0x55')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'as':_0x8a66('0x17a'),'foreignKey':'ContactId'});db[_0x8a66('0x55')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'as':_0x8a66('0x174'),'foreignKey':_0x8a66('0x118')});db[_0x8a66('0x55')][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'through':_0x8a66('0x18c'),'as':'Tags'});db[_0x8a66('0x55')][_0x8a66('0x12b')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x8a66('0x177')});db[_0x8a66('0x55')]['belongsToMany'](db[_0x8a66('0x13')],{'as':'Users','through':_0x8a66('0x134'),'foreignKey':_0x8a66('0x18d')});db[_0x8a66('0x57')][_0x8a66('0x158')](db['User'],{'as':'User'});db['SmsMessage'][_0x8a66('0x158')](db[_0x8a66('0x72')],{'onDelete':_0x8a66('0x117'),'as':_0x8a66('0x17a')});db[_0x8a66('0x57')][_0x8a66('0x158')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x8a66('0x17b'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x8a66('0x158')](db[_0x8a66('0x148')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x8a66('0x59')]['belongsToMany'](db[_0x8a66('0x13')],{'as':_0x8a66('0x160'),'through':'UserSmsQueue','foreignKey':_0x8a66('0x18e')});db[_0x8a66('0x59')]['belongsToMany'](db[_0x8a66('0xe7')],{'through':_0x8a66('0x18f'),'as':_0x8a66('0x161')});db[_0x8a66('0x146')]['hasMany'](db[_0x8a66('0x16c')],{'as':_0x8a66('0x16d'),'foreignKey':_0x8a66('0x190'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x146')][_0x8a66('0x11a')](db[_0x8a66('0x83')],{'as':_0x8a66('0x16e'),'foreignKey':_0x8a66('0x190')});db[_0x8a66('0x146')][_0x8a66('0x11a')](db[_0x8a66('0x5d')],{'as':_0x8a66('0x16f'),'foreignKey':_0x8a66('0x190')});db[_0x8a66('0x146')][_0x8a66('0x11a')](db[_0x8a66('0x5e')],{'as':'Messages','foreignKey':_0x8a66('0x190')});db[_0x8a66('0x146')][_0x8a66('0x11a')](db[_0x8a66('0x191')],{'as':_0x8a66('0x14f'),'foreignKey':'OpenchannelAccountId','onDelete':_0x8a66('0x117')});db[_0x8a66('0x146')]['belongsTo'](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':_0x8a66('0x180')});db['OpenchannelAccount'][_0x8a66('0x158')](db[_0x8a66('0x89')],{'as':_0x8a66('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8a66('0x146')]['belongsToMany'](db[_0x8a66('0x13')],{'as':_0x8a66('0x160'),'through':_0x8a66('0x147')});db[_0x8a66('0x191')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'onDelete':_0x8a66('0x169')});db[_0x8a66('0x191')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x8a66('0x192')});db['OpenchannelApplication'][_0x8a66('0x158')](db[_0x8a66('0x146')],{'onDelete':'restrict','foreignKey':_0x8a66('0x190')});db[_0x8a66('0x191')]['belongsTo'](db['Interval'],{'onDelete':_0x8a66('0x169'),'foreignKey':_0x8a66('0x15c')});db[_0x8a66('0x191')][_0x8a66('0x158')](db[_0x8a66('0x91')],{'onDelete':_0x8a66('0x169'),'foreignKey':_0x8a66('0x184')});db[_0x8a66('0x5d')]['hasMany'](db['OpenchannelMessage'],{'as':_0x8a66('0x164'),'onDelete':_0x8a66('0x117'),'foreignKey':'OpenchannelInteractionId'});db[_0x8a66('0x5d')][_0x8a66('0x158')](db['OpenchannelAccount'],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x190')});db[_0x8a66('0x5d')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'as':'Contact','foreignKey':_0x8a66('0x173')});db['OpenchannelInteraction']['belongsTo'](db[_0x8a66('0x13')],{'as':_0x8a66('0x174'),'foreignKey':_0x8a66('0x118')});db['OpenchannelInteraction'][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'through':_0x8a66('0x193'),'as':'Tags'});db[_0x8a66('0x5d')][_0x8a66('0x12b')](db['Tag'],{'through':_0x8a66('0x193'),'as':_0x8a66('0x177')});db['OpenchannelInteraction'][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x178'),'through':_0x8a66('0x135'),'foreignKey':_0x8a66('0x194')});db[_0x8a66('0x5e')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'onDelete':_0x8a66('0x117'),'as':_0x8a66('0x13')});db[_0x8a66('0x5e')]['belongsTo'](db[_0x8a66('0x72')],{'onDelete':_0x8a66('0x117'),'as':_0x8a66('0x17a')});db[_0x8a66('0x5e')][_0x8a66('0x158')](db[_0x8a66('0x5d')],{'onDelete':_0x8a66('0x117'),'as':'Interaction','foreignKey':_0x8a66('0x194')});db[_0x8a66('0x5e')][_0x8a66('0x158')](db['Attachment'],{'as':_0x8a66('0xee'),'foreignKey':_0x8a66('0x187')});db[_0x8a66('0x5e')][_0x8a66('0x158')](db[_0x8a66('0x146')],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x190')});db[_0x8a66('0x13d')]['belongsToMany'](db['User'],{'as':_0x8a66('0x160'),'through':_0x8a66('0x37'),'foreignKey':_0x8a66('0x192')});db[_0x8a66('0x13d')][_0x8a66('0x12b')](db[_0x8a66('0xe7')],{'through':'team_has_openchannel_queues','as':_0x8a66('0x161')});db[_0x8a66('0x61')]['hasMany'](db[_0x8a66('0x16c')],{'as':_0x8a66('0x16d'),'foreignKey':_0x8a66('0x17d'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x61')][_0x8a66('0x11a')](db[_0x8a66('0x83')],{'as':_0x8a66('0x16e'),'foreignKey':_0x8a66('0x17d')});db[_0x8a66('0x61')][_0x8a66('0x11a')](db['ChatProactiveAction'],{'as':_0x8a66('0x195')});db[_0x8a66('0x61')][_0x8a66('0x11a')](db[_0x8a66('0x131')],{'as':'Interactions'});db[_0x8a66('0x61')][_0x8a66('0x11a')](db[_0x8a66('0x65')],{'as':_0x8a66('0x14f'),'foreignKey':'ChatWebsiteId','onDelete':_0x8a66('0x117')});db[_0x8a66('0x61')][_0x8a66('0x11a')](db['ChatMessage'],{'as':_0x8a66('0x164')});db[_0x8a66('0x61')][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':_0x8a66('0x180')});db[_0x8a66('0x61')][_0x8a66('0x158')](db[_0x8a66('0x87')],{'as':_0x8a66('0x87'),'foreignKey':_0x8a66('0x15c')});db[_0x8a66('0x61')]['belongsTo'](db[_0x8a66('0x3f')],{'as':'MailAccount','foreignKey':_0x8a66('0x168')});db[_0x8a66('0x61')][_0x8a66('0x158')](db[_0x8a66('0x89')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x8a66('0x61')][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x8a66('0x63')][_0x8a66('0x158')](db[_0x8a66('0x146')],{});db[_0x8a66('0x63')][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':_0x8a66('0x180')});db[_0x8a66('0x63')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'as':_0x8a66('0x17a'),'foreignKey':_0x8a66('0x173')});db[_0x8a66('0x63')]['belongsTo'](db[_0x8a66('0x5d')],{});db[_0x8a66('0x63')][_0x8a66('0x158')](db[_0x8a66('0x5e')],{});db[_0x8a66('0x63')][_0x8a66('0x158')](db['User'],{});db[_0x8a66('0x63')][_0x8a66('0x158')](db[_0x8a66('0x13d')],{});db[_0x8a66('0x65')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'as':'Agent','foreignKey':_0x8a66('0x118'),'onDelete':_0x8a66('0x169')});db[_0x8a66('0x65')][_0x8a66('0x158')](db[_0x8a66('0x6b')],{'as':'Queue','foreignKey':_0x8a66('0x196'),'onDelete':'restrict'});db[_0x8a66('0x65')]['belongsTo'](db[_0x8a66('0x61')],{'as':_0x8a66('0x197'),'foreignKey':_0x8a66('0x17d'),'onDelete':_0x8a66('0x169')});db[_0x8a66('0x65')][_0x8a66('0x158')](db[_0x8a66('0x91')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x8a66('0x131')][_0x8a66('0x11a')](db['ChatMessage'],{'as':'Messages','onDelete':_0x8a66('0x117'),'foreignKey':'ChatInteractionId'});db[_0x8a66('0x131')][_0x8a66('0x158')](db['ChatWebsite'],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x17d')});db[_0x8a66('0x131')]['belongsTo'](db['CmContact'],{'as':_0x8a66('0x17a'),'foreignKey':_0x8a66('0x173')});db[_0x8a66('0x131')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'as':_0x8a66('0x174'),'foreignKey':_0x8a66('0x118')});db[_0x8a66('0x131')][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0x8a66('0x131')][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'through':_0x8a66('0x198'),'as':_0x8a66('0x177')});db['ChatInteraction']['belongsToMany'](db['User'],{'as':_0x8a66('0x178'),'through':_0x8a66('0x132'),'foreignKey':_0x8a66('0x199')});db['ChatMessage'][_0x8a66('0x158')](db[_0x8a66('0x13')],{'onDelete':_0x8a66('0x117'),'as':_0x8a66('0x13')});db[_0x8a66('0x19a')][_0x8a66('0x158')](db['CmContact'],{'onDelete':_0x8a66('0x117'),'as':'Contact','foreignKey':_0x8a66('0x173')});db[_0x8a66('0x19a')][_0x8a66('0x158')](db[_0x8a66('0x131')],{'onDelete':_0x8a66('0x117'),'as':_0x8a66('0x17b'),'foreignKey':'ChatInteractionId'});db[_0x8a66('0x19a')][_0x8a66('0x158')](db[_0x8a66('0xee')],{'as':_0x8a66('0xee'),'foreignKey':'AttachmentId'});db[_0x8a66('0x19a')]['belongsTo'](db['ChatWebsite'],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x17d')});db[_0x8a66('0x69')][_0x8a66('0x11a')](db[_0x8a66('0xee')],{'as':_0x8a66('0x179'),'foreignKey':_0x8a66('0x17e'),'onDelete':_0x8a66('0x117'),'hooks':!![]});db[_0x8a66('0x69')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'onDelete':_0x8a66('0x117'),'as':_0x8a66('0x17a'),'foreignKey':'ContactId'});db[_0x8a66('0x69')][_0x8a66('0x158')](db['ChatWebsite'],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x17d')});db['ChatQueue']['belongsToMany'](db[_0x8a66('0x13')],{'as':_0x8a66('0x160'),'through':_0x8a66('0x13a'),'hooks':!![]});db[_0x8a66('0x6b')][_0x8a66('0x12b')](db[_0x8a66('0xe7')],{'through':_0x8a66('0x19b'),'as':_0x8a66('0x161')});db[_0x8a66('0x6d')][_0x8a66('0x11a')](db[_0x8a66('0xd4')],{'as':_0x8a66('0x164'),'foreignKey':_0x8a66('0x19c'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x6d')][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x19d'),'through':_0x8a66('0x12d')});db[_0x8a66('0x19e')]['belongsTo'](db[_0x8a66('0x61')],{'as':_0x8a66('0x197'),'foreignKey':_0x8a66('0x17d')});db[_0x8a66('0x70')][_0x8a66('0x11a')](db[_0x8a66('0x72')],{'as':'Contacts','foreignKey':_0x8a66('0x19f')});db[_0x8a66('0x72')]['hasMany'](db[_0x8a66('0x93')],{'as':_0x8a66('0x1a0'),'foreignKey':_0x8a66('0x1a1')});db[_0x8a66('0x72')][_0x8a66('0x11a')](db[_0x8a66('0x74')],{'as':_0x8a66('0x128'),'foreignKey':_0x8a66('0x173')});db[_0x8a66('0x72')][_0x8a66('0x11a')](db['CmHopperFinal'],{'as':_0x8a66('0x154'),'foreignKey':_0x8a66('0x173')});db[_0x8a66('0x72')][_0x8a66('0x11a')](db['CmHopperHistory'],{'as':_0x8a66('0x155'),'foreignKey':_0x8a66('0x173')});db[_0x8a66('0x72')][_0x8a66('0x11a')](db[_0x8a66('0x7c')],{'as':_0x8a66('0x7c'),'foreignKey':_0x8a66('0x173')});db[_0x8a66('0x72')][_0x8a66('0x11a')](db['JscriptySessionReport'],{'as':_0x8a66('0x157'),'foreignKey':_0x8a66('0x173')});db[_0x8a66('0x72')][_0x8a66('0x11a')](db[_0x8a66('0x5d')],{'as':_0x8a66('0x11f'),'foreignKey':_0x8a66('0x173'),'onDelete':_0x8a66('0x169')});db['CmContact'][_0x8a66('0x11a')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x8a66('0x173'),'onDelete':_0x8a66('0x169')});db[_0x8a66('0x72')][_0x8a66('0x11a')](db['SmsInteraction'],{'as':_0x8a66('0x121'),'foreignKey':_0x8a66('0x173'),'onDelete':_0x8a66('0x169')});db[_0x8a66('0x72')][_0x8a66('0x11a')](db[_0x8a66('0x122')],{'as':'FaxInteractions','foreignKey':_0x8a66('0x173'),'onDelete':_0x8a66('0x169')});db[_0x8a66('0x72')][_0x8a66('0x11a')](db[_0x8a66('0x45')],{'as':_0x8a66('0x124'),'foreignKey':_0x8a66('0x173'),'onDelete':'restrict'});db[_0x8a66('0x72')]['belongsTo'](db['CmCompany'],{'as':_0x8a66('0x1a2'),'foreignKey':'CompanyId'});db[_0x8a66('0x72')][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':_0x8a66('0x180'),'onDelete':_0x8a66('0x117')});db['CmContact'][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x178'),'through':_0x8a66('0x12f')});db[_0x8a66('0x72')][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'as':_0x8a66('0x176'),'through':_0x8a66('0x1a3')});db[_0x8a66('0x72')][_0x8a66('0x12b')](db['Tag'],{'through':_0x8a66('0x1a3'),'as':'ThroughTags'});db[_0x8a66('0x74')][_0x8a66('0x11a')](db[_0x8a66('0x95')],{'as':_0x8a66('0x1a4'),'foreignKey':'CmHopperId'});db[_0x8a66('0x74')]['belongsTo'](db['CmContact'],{'as':_0x8a66('0x17a'),'foreignKey':_0x8a66('0x173'),'onDelete':'cascade'});db[_0x8a66('0x74')][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':_0x8a66('0x180'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x74')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'as':'Agent','foreignKey':_0x8a66('0x118')});db[_0x8a66('0x74')]['belongsTo'](db[_0x8a66('0x1c')],{'as':_0x8a66('0x1a5'),'foreignKey':'VoiceQueueId','onDelete':_0x8a66('0x117')});db['CmHopper'][_0x8a66('0x158')](db[_0x8a66('0xeb')],{'as':_0x8a66('0xeb'),'foreignKey':_0x8a66('0x1a6'),'onDelete':_0x8a66('0x117')});db['CmHopper'][_0x8a66('0x158')](db[_0x8a66('0x13')],{'as':_0x8a66('0x174'),'foreignKey':_0x8a66('0x1a7')});db['CmHopperBlack']['belongsTo'](db[_0x8a66('0x72')],{'as':_0x8a66('0x17a'),'foreignKey':'ContactId','onDelete':_0x8a66('0x117')});db[_0x8a66('0x76')]['belongsTo'](db[_0x8a66('0xf9')],{'as':'List','foreignKey':'ListId','onDelete':_0x8a66('0x117')});db[_0x8a66('0x76')][_0x8a66('0x158')](db[_0x8a66('0x1c')],{'as':_0x8a66('0x1a5'),'foreignKey':_0x8a66('0x153'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x76')][_0x8a66('0x158')](db['Campaign'],{'as':'Campaign','foreignKey':_0x8a66('0x1a6'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x81')][_0x8a66('0x11a')](db[_0x8a66('0x85')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x8a66('0x117'),'hooks':!![]});db['Automation'][_0x8a66('0x11a')](db[_0x8a66('0x85')],{'as':{'plural':_0x8a66('0x1a8'),'singular':'OneAny'},'foreignKey':_0x8a66('0x1a9'),'onDelete':_0x8a66('0x117'),'hooks':!![]});db[_0x8a66('0x81')][_0x8a66('0x11a')](db['Action'],{'as':'Actions','foreignKey':_0x8a66('0x1aa'),'onDelete':_0x8a66('0x117'),'hooks':!![]});db[_0x8a66('0x16c')][_0x8a66('0x11a')](db[_0x8a66('0x16c')],{'as':_0x8a66('0x16d'),'foreignKey':_0x8a66('0x1ab'),'onDelete':'cascade'});db[_0x8a66('0x87')]['hasMany'](db['Interval'],{'as':_0x8a66('0x1ac'),'foreignKey':_0x8a66('0x15c'),'onDelete':_0x8a66('0x117'),'hooks':!![],'required':![]});db[_0x8a66('0x87')]['hasMany'](db[_0x8a66('0x11c')],{'as':_0x8a66('0x11d'),'foreignKey':'IntervalId','onDelete':_0x8a66('0x169')});db[_0x8a66('0x87')][_0x8a66('0x11a')](db[_0x8a66('0x49')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x8a66('0x87')][_0x8a66('0x11a')](db[_0x8a66('0x65')],{'as':_0x8a66('0x1ad'),'foreignKey':_0x8a66('0x15c')});db['Interval'][_0x8a66('0x11a')](db[_0x8a66('0x183')],{'as':_0x8a66('0x1ae'),'foreignKey':_0x8a66('0x15c')});db[_0x8a66('0x87')][_0x8a66('0x11a')](db[_0x8a66('0x18b')],{'as':_0x8a66('0x1af'),'foreignKey':'IntervalId'});db['Schedule'][_0x8a66('0x158')](db[_0x8a66('0x3f')],{});db[_0x8a66('0x8f')][_0x8a66('0x158')](db[_0x8a66('0x1b0')],{'foreignKey':_0x8a66('0x1b1')});db[_0x8a66('0x8f')][_0x8a66('0x158')](db[_0x8a66('0x1b2')],{'foreignKey':_0x8a66('0x1b3')});db[_0x8a66('0x90')]['belongsToMany'](db[_0x8a66('0x1a')],{'as':_0x8a66('0x1b4'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0x8a66('0x91')]['belongsToMany'](db[_0x8a66('0x72')],{'through':_0x8a66('0x1a3')});db['Tag'][_0x8a66('0x12b')](db[_0x8a66('0x131')],{'through':_0x8a66('0x198')});db['Tag']['belongsToMany'](db[_0x8a66('0x45')],{'through':_0x8a66('0x175')});db[_0x8a66('0x91')][_0x8a66('0x12b')](db[_0x8a66('0x55')],{'through':_0x8a66('0x18c')});db[_0x8a66('0x91')][_0x8a66('0x12b')](db[_0x8a66('0x122')],{'through':_0x8a66('0x186')});db[_0x8a66('0x91')]['belongsToMany'](db[_0x8a66('0x5d')],{'through':_0x8a66('0x193')});db[_0x8a66('0x91')][_0x8a66('0x12b')](db[_0x8a66('0x104')],{'through':'whatsapp_interaction_has_tags'});db[_0x8a66('0x93')][_0x8a66('0x158')](db[_0x8a66('0x1b5')],{'as':_0x8a66('0x1b6'),'foreignKey':_0x8a66('0x1b7')});db[_0x8a66('0x95')][_0x8a66('0x158')](db[_0x8a66('0x74')],{'as':_0x8a66('0x1b8'),'foreignKey':_0x8a66('0x1b9')});db[_0x8a66('0x93')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'as':_0x8a66('0x17a'),'foreignKey':_0x8a66('0x1a1')});db['Trigger'][_0x8a66('0x11a')](db[_0x8a66('0x85')],{'as':{'plural':_0x8a66('0x1ba'),'singular':'AllCondition'},'foreignKey':_0x8a66('0x1bb'),'onDelete':_0x8a66('0x117'),'hooks':!![]});db['Trigger'][_0x8a66('0x11a')](db['Condition'],{'as':{'plural':_0x8a66('0x1bc'),'singular':_0x8a66('0x1bd')},'foreignKey':_0x8a66('0x1be'),'onDelete':_0x8a66('0x117'),'hooks':!![]});db[_0x8a66('0x98')][_0x8a66('0x11a')](db[_0x8a66('0x1bf')],{'as':'Actions','foreignKey':_0x8a66('0x1c0'),'onDelete':_0x8a66('0x117'),'hooks':!![]});db[_0x8a66('0x1b2')]['hasMany'](db[_0x8a66('0x1c1')],{'as':_0x8a66('0x1c2'),'onDelete':_0x8a66('0x117'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x8a66('0x1b0')][_0x8a66('0x11a')](db[_0x8a66('0x1c1')],{'as':_0x8a66('0x1c2'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1b1')});db['AnalyticMetric']['hasMany'](db[_0x8a66('0x1c1')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8a66('0x1c3')});db[_0x8a66('0x1c1')]['belongsTo'](db[_0x8a66('0xa2')],{'foreignKey':_0x8a66('0x1c3')});db[_0x8a66('0xa6')][_0x8a66('0x11a')](db[_0x8a66('0xa7')],{'as':_0x8a66('0x1c4'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0xa7')][_0x8a66('0x11a')](db[_0x8a66('0x1c6')],{'as':'Subjects','onDelete':_0x8a66('0x117'),'foreignKey':'SubjectId'});db[_0x8a66('0xa7')]['hasMany'](db[_0x8a66('0x1c6')],{'as':_0x8a66('0x1c7'),'onDelete':_0x8a66('0x117'),'foreignKey':'DescriptionId'});db[_0x8a66('0xa7')]['hasMany'](db[_0x8a66('0x1c6')],{'as':_0x8a66('0x1c2'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0xa7')][_0x8a66('0x158')](db[_0x8a66('0xa6')],{'as':'Account','foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0x1c6')]['hasMany'](db[_0x8a66('0x1c6')],{'as':_0x8a66('0x1c9'),'foreignKey':_0x8a66('0x1ca')});db[_0x8a66('0x1c6')][_0x8a66('0x11a')](db[_0x8a66('0x1c6')],{'as':_0x8a66('0x1cb'),'foreignKey':_0x8a66('0x1cc')});db[_0x8a66('0x1c6')][_0x8a66('0x11a')](db[_0x8a66('0x1c6')],{'as':_0x8a66('0x1cd'),'foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0x1c6')][_0x8a66('0x158')](db[_0x8a66('0x9a')],{'as':'Variable','foreignKey':_0x8a66('0x1ce')});db['SugarcrmAccount'][_0x8a66('0x11a')](db[_0x8a66('0xac')],{'as':'Configurations','onDelete':_0x8a66('0x117'),'foreignKey':'AccountId'});db[_0x8a66('0xac')][_0x8a66('0x11a')](db[_0x8a66('0xae')],{'as':'Subjects','onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1ca')});db['SugarcrmConfiguration']['hasMany'](db[_0x8a66('0xae')],{'as':_0x8a66('0x1c7'),'onDelete':'cascade','foreignKey':_0x8a66('0x1cc')});db[_0x8a66('0xac')]['hasMany'](db[_0x8a66('0xae')],{'as':_0x8a66('0x1c2'),'onDelete':_0x8a66('0x117'),'foreignKey':'FieldId'});db[_0x8a66('0xac')]['belongsTo'](db[_0x8a66('0xaa')],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x1c5')});db['SugarcrmField']['hasMany'](db[_0x8a66('0xae')],{'as':'Subject','foreignKey':_0x8a66('0x1ca')});db['SugarcrmField'][_0x8a66('0x11a')](db[_0x8a66('0xae')],{'as':_0x8a66('0x1cb'),'foreignKey':_0x8a66('0x1cc')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x8a66('0x1cd'),'foreignKey':_0x8a66('0x1c8')});db['SugarcrmField'][_0x8a66('0x158')](db[_0x8a66('0x9a')],{'as':_0x8a66('0x9a'),'foreignKey':'VariableId'});db['DeskAccount'][_0x8a66('0x11a')](db[_0x8a66('0xb0')],{'as':_0x8a66('0x1c4'),'onDelete':_0x8a66('0x117'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x8a66('0x11a')](db['DeskField'],{'as':_0x8a66('0x1cf'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1ca')});db['DeskConfiguration'][_0x8a66('0x11a')](db[_0x8a66('0xb2')],{'as':_0x8a66('0x1c7'),'onDelete':_0x8a66('0x117'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x8a66('0x11a')](db['DeskField'],{'as':_0x8a66('0x1c2'),'onDelete':_0x8a66('0x117'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x8a66('0x158')](db[_0x8a66('0xaf')],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0xb0')][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'through':_0x8a66('0x1d0')});db['DeskField']['hasMany'](db[_0x8a66('0xb2')],{'as':_0x8a66('0x1c9'),'foreignKey':_0x8a66('0x1ca')});db['DeskField']['hasMany'](db[_0x8a66('0xb2')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x8a66('0xb2')]['hasMany'](db[_0x8a66('0xb2')],{'as':_0x8a66('0x1cd'),'foreignKey':_0x8a66('0x1c8')});db['DeskField']['belongsTo'](db['Variable'],{'as':_0x8a66('0x9a'),'foreignKey':_0x8a66('0x1ce')});db[_0x8a66('0xb3')][_0x8a66('0x11a')](db[_0x8a66('0xb5')],{'as':'Configurations','onDelete':_0x8a66('0x117'),'foreignKey':'AccountId'});db[_0x8a66('0xb5')][_0x8a66('0x11a')](db[_0x8a66('0xb7')],{'as':_0x8a66('0x1cf'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1ca')});db[_0x8a66('0xb5')][_0x8a66('0x11a')](db[_0x8a66('0xb7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x8a66('0x11a')](db[_0x8a66('0xb7')],{'as':'Fields','onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0xb5')][_0x8a66('0x158')](db[_0x8a66('0xb3')],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0xb7')][_0x8a66('0x11a')](db[_0x8a66('0xb7')],{'as':_0x8a66('0x1c9'),'foreignKey':_0x8a66('0x1ca')});db['ZohoField'][_0x8a66('0x11a')](db[_0x8a66('0xb7')],{'as':_0x8a66('0x1cb'),'foreignKey':'DescriptionId'});db[_0x8a66('0xb7')]['hasMany'](db[_0x8a66('0xb7')],{'as':'Field','foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0xb7')]['belongsTo'](db[_0x8a66('0x9a')],{'as':_0x8a66('0x9a'),'foreignKey':_0x8a66('0x1ce')});db[_0x8a66('0xb8')][_0x8a66('0x11a')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0x1d1')]['hasMany'](db[_0x8a66('0xba')],{'as':'Subjects','foreignKey':_0x8a66('0x1ca')});db[_0x8a66('0x1d1')][_0x8a66('0x11a')](db[_0x8a66('0xba')],{'as':_0x8a66('0x1c7'),'foreignKey':_0x8a66('0x1cc')});db['ZendeskConfiguration'][_0x8a66('0x11a')](db['ZendeskField'],{'as':'Fields','foreignKey':_0x8a66('0x1c8')});db['ZendeskConfiguration'][_0x8a66('0x158')](db[_0x8a66('0xb8')],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0x1d1')][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'through':'int_zendesk_configuration_has_tags'});db[_0x8a66('0xba')][_0x8a66('0x11a')](db['ZendeskField'],{'as':_0x8a66('0x1c9'),'foreignKey':_0x8a66('0x1ca')});db[_0x8a66('0xba')][_0x8a66('0x11a')](db[_0x8a66('0xba')],{'as':'Description','foreignKey':_0x8a66('0x1cc')});db['ZendeskField'][_0x8a66('0x11a')](db[_0x8a66('0xba')],{'as':_0x8a66('0x1cd'),'foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0xba')]['belongsTo'](db['Variable'],{'as':_0x8a66('0x9a'),'foreignKey':_0x8a66('0x1ce')});db[_0x8a66('0xbb')][_0x8a66('0x11a')](db[_0x8a66('0xbc')],{'as':_0x8a66('0x1c4'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1c5')});db['FreshdeskConfiguration'][_0x8a66('0x11a')](db[_0x8a66('0x1d2')],{'as':'Subjects','onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1ca')});db[_0x8a66('0xbc')][_0x8a66('0x11a')](db[_0x8a66('0x1d2')],{'as':'Descriptions','onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1cc')});db[_0x8a66('0xbc')]['hasMany'](db[_0x8a66('0x1d2')],{'as':_0x8a66('0x1c2'),'onDelete':_0x8a66('0x117'),'foreignKey':'FieldId'});db[_0x8a66('0xbc')][_0x8a66('0x158')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0xbc')][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x8a66('0x11a')](db[_0x8a66('0x1d2')],{'as':_0x8a66('0x1c9'),'foreignKey':_0x8a66('0x1ca')});db['FreshdeskField'][_0x8a66('0x11a')](db[_0x8a66('0x1d2')],{'as':_0x8a66('0x1cb'),'foreignKey':_0x8a66('0x1cc')});db[_0x8a66('0x1d2')][_0x8a66('0x11a')](db[_0x8a66('0x1d2')],{'as':_0x8a66('0x1cd'),'foreignKey':_0x8a66('0x1c8')});db['FreshdeskField'][_0x8a66('0x158')](db[_0x8a66('0x9a')],{'as':_0x8a66('0x9a'),'foreignKey':_0x8a66('0x1ce')});db['VtigerAccount'][_0x8a66('0x11a')](db[_0x8a66('0xc0')],{'as':_0x8a66('0x1c4'),'onDelete':'cascade','foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0xc0')][_0x8a66('0x11a')](db[_0x8a66('0x1d3')],{'as':_0x8a66('0x1cf'),'foreignKey':_0x8a66('0x1ca')});db[_0x8a66('0xc0')][_0x8a66('0x11a')](db[_0x8a66('0x1d3')],{'as':_0x8a66('0x1c7'),'foreignKey':_0x8a66('0x1cc')});db[_0x8a66('0xc0')]['hasMany'](db['VtigerField'],{'as':_0x8a66('0x1c2'),'foreignKey':'FieldId'});db[_0x8a66('0xc0')][_0x8a66('0x158')](db['VtigerAccount'],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x1c5')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':_0x8a66('0x1c9'),'foreignKey':_0x8a66('0x1ca')});db[_0x8a66('0x1d3')][_0x8a66('0x11a')](db[_0x8a66('0x1d3')],{'as':'Description','foreignKey':_0x8a66('0x1cc')});db[_0x8a66('0x1d3')]['hasMany'](db[_0x8a66('0x1d3')],{'as':_0x8a66('0x1cd'),'foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0x1d3')]['belongsTo'](db[_0x8a66('0x9a')],{'as':_0x8a66('0x9a'),'foreignKey':'VariableId'});db[_0x8a66('0xc2')][_0x8a66('0x11a')](db[_0x8a66('0x1d4')],{'as':_0x8a66('0x1c4'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0x1d4')][_0x8a66('0x11a')](db[_0x8a66('0xc4')],{'as':_0x8a66('0x1cf'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x8a66('0x11a')](db[_0x8a66('0xc4')],{'as':'Descriptions','foreignKey':_0x8a66('0x1cc')});db[_0x8a66('0x1d4')][_0x8a66('0x11a')](db['ServicenowField'],{'as':'Fields','foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0x1d4')][_0x8a66('0x158')](db[_0x8a66('0xc2')],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0xc4')][_0x8a66('0x11a')](db[_0x8a66('0xc4')],{'as':'Subject','foreignKey':'SubjectId'});db['ServicenowField'][_0x8a66('0x11a')](db[_0x8a66('0xc4')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x8a66('0xc4')][_0x8a66('0x11a')](db[_0x8a66('0xc4')],{'as':_0x8a66('0x1cd'),'foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0xc4')][_0x8a66('0x158')](db[_0x8a66('0x9a')],{'as':'Variable','foreignKey':'VariableId'});db[_0x8a66('0xc6')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x8a66('0x1c4'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1c5')});db[_0x8a66('0xc6')]['belongsTo'](db['CloudProvider'],{'as':_0x8a66('0x10c'),'foreignKey':_0x8a66('0x1d5')});db[_0x8a66('0xc8')]['hasMany'](db[_0x8a66('0xca')],{'as':_0x8a66('0x1cf'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1ca')});db[_0x8a66('0xc8')][_0x8a66('0x11a')](db[_0x8a66('0xca')],{'as':_0x8a66('0x1c7'),'onDelete':_0x8a66('0x117'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x8a66('0x11a')](db[_0x8a66('0xca')],{'as':_0x8a66('0x1c2'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0xc8')]['belongsTo'](db[_0x8a66('0xc6')],{'as':_0x8a66('0x17c'),'foreignKey':'AccountId'});db[_0x8a66('0xca')][_0x8a66('0x11a')](db[_0x8a66('0xca')],{'as':_0x8a66('0x1c9'),'foreignKey':'SubjectId'});db[_0x8a66('0xca')]['hasMany'](db['Dynamics365Field'],{'as':_0x8a66('0x1cb'),'foreignKey':_0x8a66('0x1cc')});db[_0x8a66('0xca')]['hasMany'](db[_0x8a66('0xca')],{'as':_0x8a66('0x1cd'),'foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0xca')][_0x8a66('0x158')](db['Variable'],{'as':'Variable','foreignKey':_0x8a66('0x1ce')});db['FreshsalesAccount']['hasMany'](db[_0x8a66('0x1d6')],{'as':_0x8a66('0x1c4'),'onDelete':'cascade','foreignKey':_0x8a66('0x1c5')});db['FreshsalesConfiguration'][_0x8a66('0x11a')](db[_0x8a66('0xcf')],{'as':_0x8a66('0x1cf'),'foreignKey':'SubjectId'});db[_0x8a66('0x1d6')]['hasMany'](db[_0x8a66('0xcf')],{'as':_0x8a66('0x1c7'),'foreignKey':_0x8a66('0x1cc')});db[_0x8a66('0x1d6')][_0x8a66('0x11a')](db[_0x8a66('0xcf')],{'as':_0x8a66('0x1c2'),'foreignKey':_0x8a66('0x1c8')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x8a66('0x17c'),'foreignKey':'AccountId'});db[_0x8a66('0xcf')][_0x8a66('0x11a')](db[_0x8a66('0xcf')],{'as':_0x8a66('0x1c9'),'foreignKey':_0x8a66('0x1ca')});db['FreshsalesField']['hasMany'](db[_0x8a66('0xcf')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x8a66('0xcf')][_0x8a66('0x11a')](db['FreshsalesField'],{'as':_0x8a66('0x1cd'),'foreignKey':_0x8a66('0x1c8')});db[_0x8a66('0xcf')][_0x8a66('0x158')](db['Variable'],{'as':_0x8a66('0x9a'),'foreignKey':_0x8a66('0x1ce')});db[_0x8a66('0x1d7')][_0x8a66('0x158')](db[_0x8a66('0x61')],{});db[_0x8a66('0x1d7')][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':'ListId'});db[_0x8a66('0x1d7')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'as':_0x8a66('0x17a'),'foreignKey':_0x8a66('0x173')});db['ChatQueueReport'][_0x8a66('0x158')](db['ChatInteraction'],{});db[_0x8a66('0x1d7')][_0x8a66('0x158')](db[_0x8a66('0x19a')],{});db['ChatQueueReport'][_0x8a66('0x158')](db['User'],{});db[_0x8a66('0x1d7')][_0x8a66('0x158')](db['ChatQueue'],{});db[_0x8a66('0xd4')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1d8')});db['ChatInternalMessage'][_0x8a66('0x158')](db[_0x8a66('0x13')],{'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1d9')});db[_0x8a66('0x156')][_0x8a66('0x11a')](db['JscriptyQuestionReport'],{'foreignKey':_0x8a66('0x1da'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x156')][_0x8a66('0x11a')](db[_0x8a66('0xd6')],{'foreignKey':_0x8a66('0x1da'),'onDelete':'cascade'});db[_0x8a66('0xd9')]['belongsTo'](db['SmsAccount'],{});db[_0x8a66('0xd9')]['belongsTo'](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':'ListId'});db[_0x8a66('0xd9')][_0x8a66('0x158')](db['CmContact'],{'as':_0x8a66('0x17a'),'foreignKey':_0x8a66('0x173')});db[_0x8a66('0xd9')][_0x8a66('0x158')](db[_0x8a66('0x55')],{});db['SmsQueueReport'][_0x8a66('0x158')](db[_0x8a66('0x57')],{});db[_0x8a66('0xd9')][_0x8a66('0x158')](db[_0x8a66('0x13')],{});db[_0x8a66('0xd9')][_0x8a66('0x158')](db[_0x8a66('0x59')],{});db[_0x8a66('0xdc')][_0x8a66('0x11a')](db[_0x8a66('0x156')],{'foreignKey':_0x8a66('0x1db')});db[_0x8a66('0xdc')][_0x8a66('0x11a')](db[_0x8a66('0xd8')],{'foreignKey':_0x8a66('0x1db')});db['JscriptyProject'][_0x8a66('0x11a')](db[_0x8a66('0xd6')],{'foreignKey':_0x8a66('0x1db')});db[_0x8a66('0xe7')]['belongsToMany'](db[_0x8a66('0x13')],{'as':'Agents','through':_0x8a66('0x130')});db['Team']['belongsToMany'](db['VoiceQueue'],{'through':_0x8a66('0x10e'),'as':_0x8a66('0x137')});db[_0x8a66('0xe7')]['belongsToMany'](db[_0x8a66('0x41')],{'through':_0x8a66('0x171'),'as':_0x8a66('0x1dc')});db['Team'][_0x8a66('0x12b')](db[_0x8a66('0x6b')],{'through':_0x8a66('0x19b'),'as':_0x8a66('0x139')});db[_0x8a66('0xe7')][_0x8a66('0x12b')](db['FaxQueue'],{'through':_0x8a66('0x188'),'as':_0x8a66('0x13b')});db[_0x8a66('0xe7')][_0x8a66('0x12b')](db[_0x8a66('0x59')],{'through':'team_has_sms_queues','as':_0x8a66('0x13c')});db['Team'][_0x8a66('0x12b')](db[_0x8a66('0x13d')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x8a66('0xe7')][_0x8a66('0x12b')](db[_0x8a66('0x10a')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db['Team']['belongsToMany'](db['VoicePrefix'],{'through':_0x8a66('0x110'),'as':_0x8a66('0x138')});db['Campaign'][_0x8a66('0x11a')](db[_0x8a66('0x74')],{'as':'Hoppers','foreignKey':'CampaignId'});db['Campaign']['hasMany'](db['CmHopperFinal'],{'as':_0x8a66('0x154'),'foreignKey':_0x8a66('0x1a6')});db[_0x8a66('0xeb')][_0x8a66('0x11a')](db['CmHopperHistory'],{'as':_0x8a66('0x155'),'foreignKey':_0x8a66('0x1a6')});db[_0x8a66('0xeb')][_0x8a66('0x11a')](db[_0x8a66('0x76')],{'as':_0x8a66('0x1dd'),'foreignKey':_0x8a66('0x1a6')});db['Campaign']['belongsTo'](db[_0x8a66('0x2f')],{'as':_0x8a66('0x2f'),'foreignKey':_0x8a66('0x159')});db[_0x8a66('0xeb')]['belongsTo'](db['Trunk'],{'as':_0x8a66('0x15a'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x8a66('0x158')](db[_0x8a66('0x87')],{'as':'Interval','foreignKey':_0x8a66('0x15c')});db[_0x8a66('0xeb')][_0x8a66('0x158')](db[_0x8a66('0xe2')],{'as':_0x8a66('0xe2'),'foreignKey':_0x8a66('0x1de')});db[_0x8a66('0xeb')][_0x8a66('0x12b')](db['CmList'],{'as':'Lists','through':_0x8a66('0x1df')});db[_0x8a66('0xeb')]['belongsToMany'](db[_0x8a66('0xf9')],{'as':_0x8a66('0x162'),'through':_0x8a66('0x1e0')});db['Attachment'][_0x8a66('0x158')](db[_0x8a66('0x69')],{'as':_0x8a66('0x69'),'foreignKey':_0x8a66('0x17e')});db['MailTransferReport'][_0x8a66('0x158')](db['MailMessage'],{});db[_0x8a66('0x1e1')][_0x8a66('0x158')](db[_0x8a66('0x45')],{});db[_0x8a66('0x1e1')][_0x8a66('0x158')](db[_0x8a66('0x3f')],{'foreignKey':_0x8a66('0x1e2'),'as':_0x8a66('0x1e3')});db[_0x8a66('0x1e1')]['belongsTo'](db[_0x8a66('0x13')],{'foreignKey':_0x8a66('0x1e4'),'as':'FromAgent'});db[_0x8a66('0x1e1')][_0x8a66('0x158')](db['User'],{'foreignKey':_0x8a66('0x1e5'),'as':_0x8a66('0x1e6')});db[_0x8a66('0x1e1')][_0x8a66('0x158')](db[_0x8a66('0x41')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport'][_0x8a66('0x158')](db[_0x8a66('0x3f')],{'foreignKey':_0x8a66('0x1e7'),'as':_0x8a66('0x1e8')});db[_0x8a66('0xf3')][_0x8a66('0x158')](db[_0x8a66('0x19a')],{});db[_0x8a66('0xf3')][_0x8a66('0x158')](db[_0x8a66('0x131')],{});db['ChatTransferReport'][_0x8a66('0x158')](db[_0x8a66('0x61')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x8a66('0xf3')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'foreignKey':_0x8a66('0x1e4'),'as':_0x8a66('0x1e9')});db[_0x8a66('0xf3')]['belongsTo'](db[_0x8a66('0x13')],{'foreignKey':_0x8a66('0x1e5'),'as':_0x8a66('0x1e6')});db[_0x8a66('0xf3')]['belongsTo'](db[_0x8a66('0x6b')],{'foreignKey':_0x8a66('0x1ea'),'as':_0x8a66('0x1eb')});db[_0x8a66('0xf3')][_0x8a66('0x158')](db[_0x8a66('0x61')],{'foreignKey':_0x8a66('0x1ec'),'as':_0x8a66('0x1e8')});db[_0x8a66('0xf4')]['belongsTo'](db['FaxMessage'],{});db[_0x8a66('0xf4')][_0x8a66('0x158')](db[_0x8a66('0x122')],{});db[_0x8a66('0xf4')][_0x8a66('0x158')](db['FaxAccount'],{'foreignKey':_0x8a66('0x1ed'),'as':_0x8a66('0x1e3')});db[_0x8a66('0xf4')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'foreignKey':_0x8a66('0x1e4'),'as':_0x8a66('0x1e9')});db['FaxTransferReport']['belongsTo'](db[_0x8a66('0x13')],{'foreignKey':_0x8a66('0x1e5'),'as':'ToAgent'});db[_0x8a66('0xf4')][_0x8a66('0x158')](db[_0x8a66('0x52')],{'foreignKey':_0x8a66('0x1ee'),'as':'ToQueue'});db['FaxTransferReport'][_0x8a66('0x158')](db[_0x8a66('0x4e')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x8a66('0xf5')][_0x8a66('0x158')](db[_0x8a66('0x5e')],{});db[_0x8a66('0xf5')]['belongsTo'](db[_0x8a66('0x5d')],{});db['OpenchannelTransferReport'][_0x8a66('0x158')](db[_0x8a66('0x146')],{'foreignKey':_0x8a66('0x1ef'),'as':_0x8a66('0x1e3')});db['OpenchannelTransferReport'][_0x8a66('0x158')](db[_0x8a66('0x13')],{'foreignKey':_0x8a66('0x1e4'),'as':'FromAgent'});db[_0x8a66('0xf5')]['belongsTo'](db['User'],{'foreignKey':_0x8a66('0x1e5'),'as':_0x8a66('0x1e6')});db[_0x8a66('0xf5')][_0x8a66('0x158')](db[_0x8a66('0x13d')],{'foreignKey':_0x8a66('0x1f0'),'as':_0x8a66('0x1eb')});db[_0x8a66('0xf5')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x8a66('0x1f1'),'as':'ToAccount'});db[_0x8a66('0xf7')][_0x8a66('0x158')](db[_0x8a66('0x57')],{});db[_0x8a66('0xf7')][_0x8a66('0x158')](db[_0x8a66('0x55')],{});db[_0x8a66('0xf7')][_0x8a66('0x158')](db[_0x8a66('0x148')],{'foreignKey':_0x8a66('0x1f2'),'as':_0x8a66('0x1e3')});db[_0x8a66('0xf7')]['belongsTo'](db[_0x8a66('0x13')],{'foreignKey':'FromUserId','as':_0x8a66('0x1e9')});db[_0x8a66('0xf7')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'foreignKey':'ToUserId','as':_0x8a66('0x1e6')});db[_0x8a66('0xf7')][_0x8a66('0x158')](db[_0x8a66('0x59')],{'foreignKey':'ToSmsQueueId','as':_0x8a66('0x1eb')});db[_0x8a66('0xf7')]['belongsTo'](db[_0x8a66('0x148')],{'foreignKey':_0x8a66('0x1f3'),'as':_0x8a66('0x1e8')});db['CmList']['hasMany'](db[_0x8a66('0x16c')],{'as':_0x8a66('0x16d'),'foreignKey':_0x8a66('0x180'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0xf9')][_0x8a66('0x11a')](db[_0x8a66('0x7e')],{'as':'CustomFields','foreignKey':_0x8a66('0x180')});db[_0x8a66('0xf9')][_0x8a66('0x11a')](db[_0x8a66('0x72')],{'as':_0x8a66('0x12e'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x180')});db['CmList']['hasMany'](db[_0x8a66('0x78')],{'as':'HopperFinals','foreignKey':_0x8a66('0x180')});db[_0x8a66('0xf9')]['hasMany'](db['CmHopperHistory'],{'as':_0x8a66('0x11e'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x8a66('0x7c')],{'as':_0x8a66('0x7c'),'foreignKey':_0x8a66('0x180')});db[_0x8a66('0xf9')]['belongsToMany'](db[_0x8a66('0x1c')],{'as':_0x8a66('0x1f4'),'through':_0x8a66('0x15f')});db['CmList'][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x160'),'through':_0x8a66('0x140')});db[_0x8a66('0xfb')][_0x8a66('0x11a')](db[_0x8a66('0x11c')],{'as':_0x8a66('0x11d'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0xfb')][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x160'),'through':_0x8a66('0x112')});db[_0x8a66('0xfb')]['belongsToMany'](db[_0x8a66('0xe7')],{'through':_0x8a66('0x110'),'as':'Teams'});db['UserProfile'][_0x8a66('0x11a')](db[_0x8a66('0x13')],{'as':_0x8a66('0x178'),'foreignKey':_0x8a66('0x12a')});db[_0x8a66('0x1f5')][_0x8a66('0x11a')](db['UserProfileSection'],{'as':_0x8a66('0x1f6'),'foreignKey':_0x8a66('0x12a'),'onDelete':_0x8a66('0x117')});db[_0x8a66('0x1f7')][_0x8a66('0x11a')](db[_0x8a66('0xfe')],{'as':'Resources','foreignKey':_0x8a66('0x1f8'),'onDelete':'cascade'});db['WhatsappAccount'][_0x8a66('0x11a')](db[_0x8a66('0x16c')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x8a66('0x117')});db['WhatsappAccount'][_0x8a66('0x11a')](db['CannedAnswer'],{'as':_0x8a66('0x16e'),'foreignKey':_0x8a66('0x1f9')});db['WhatsappAccount'][_0x8a66('0x11a')](db[_0x8a66('0x106')],{'as':_0x8a66('0x164'),'foreignKey':_0x8a66('0x1f9')});db[_0x8a66('0x101')][_0x8a66('0x11a')](db[_0x8a66('0x104')],{'as':'Interactions'});db['WhatsappAccount'][_0x8a66('0x11a')](db['WhatsappApplication'],{'as':_0x8a66('0x14f'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db['WhatsappAccount'][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':'ListId'});db[_0x8a66('0x101')][_0x8a66('0x158')](db[_0x8a66('0x89')],{'as':_0x8a66('0x15d'),'foreignKey':_0x8a66('0x15e')});db[_0x8a66('0x101')][_0x8a66('0x12b')](db['User'],{'as':_0x8a66('0x160'),'through':_0x8a66('0x1fa')});db[_0x8a66('0x102')]['belongsTo'](db[_0x8a66('0x13')],{'onDelete':_0x8a66('0x169')});db[_0x8a66('0x102')][_0x8a66('0x158')](db[_0x8a66('0x10a')],{'onDelete':_0x8a66('0x169')});db[_0x8a66('0x102')]['belongsTo'](db[_0x8a66('0x101')],{'onDelete':_0x8a66('0x169')});db[_0x8a66('0x102')][_0x8a66('0x158')](db['Interval'],{'onDelete':_0x8a66('0x169'),'foreignKey':_0x8a66('0x15c')});db[_0x8a66('0x102')][_0x8a66('0x158')](db[_0x8a66('0x91')],{'onDelete':_0x8a66('0x169'),'foreignKey':_0x8a66('0x184')});db[_0x8a66('0x104')][_0x8a66('0x11a')](db['WhatsappMessage'],{'as':_0x8a66('0x164'),'onDelete':_0x8a66('0x117'),'foreignKey':_0x8a66('0x1fb')});db['WhatsappInteraction'][_0x8a66('0x158')](db[_0x8a66('0x101')],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x1f9')});db[_0x8a66('0x104')][_0x8a66('0x158')](db['CmContact'],{'as':'Contact','foreignKey':_0x8a66('0x173')});db[_0x8a66('0x104')][_0x8a66('0x158')](db[_0x8a66('0x13')],{'as':_0x8a66('0x174'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'through':_0x8a66('0x1fc'),'as':_0x8a66('0x176')});db[_0x8a66('0x104')][_0x8a66('0x12b')](db[_0x8a66('0x91')],{'through':_0x8a66('0x1fc'),'as':_0x8a66('0x177')});db[_0x8a66('0x104')][_0x8a66('0x12b')](db[_0x8a66('0x13')],{'as':_0x8a66('0x178'),'through':_0x8a66('0x136'),'foreignKey':_0x8a66('0x1fb')});db[_0x8a66('0x106')][_0x8a66('0x158')](db['User'],{'as':'User'});db['WhatsappMessage'][_0x8a66('0x158')](db[_0x8a66('0x72')],{'onDelete':'cascade','as':_0x8a66('0x17a')});db[_0x8a66('0x106')][_0x8a66('0x158')](db[_0x8a66('0x104')],{'onDelete':_0x8a66('0x117'),'as':_0x8a66('0x17b'),'foreignKey':_0x8a66('0x1fb')});db[_0x8a66('0x106')]['belongsTo'](db[_0x8a66('0x101')],{'as':_0x8a66('0x17c'),'foreignKey':_0x8a66('0x1f9')});db[_0x8a66('0x1fd')]['belongsTo'](db[_0x8a66('0x101')],{});db[_0x8a66('0x1fd')][_0x8a66('0x158')](db[_0x8a66('0xf9')],{'as':_0x8a66('0x17f'),'foreignKey':_0x8a66('0x180')});db[_0x8a66('0x1fd')][_0x8a66('0x158')](db[_0x8a66('0x72')],{'as':_0x8a66('0x17a'),'foreignKey':_0x8a66('0x173')});db['WhatsappQueueReport'][_0x8a66('0x158')](db[_0x8a66('0x104')],{});db[_0x8a66('0x1fd')][_0x8a66('0x158')](db['WhatsappQueue'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x8a66('0x106')],{});db[_0x8a66('0x1fd')][_0x8a66('0x158')](db[_0x8a66('0x13')],{});db['WhatsappTransferReport'][_0x8a66('0x158')](db['WhatsappMessage'],{});db[_0x8a66('0x109')]['belongsTo'](db[_0x8a66('0x104')],{});db[_0x8a66('0x109')][_0x8a66('0x158')](db['WhatsappAccount'],{'foreignKey':_0x8a66('0x1fe'),'as':'FromAccount'});db[_0x8a66('0x109')][_0x8a66('0x158')](db[_0x8a66('0x101')],{'foreignKey':_0x8a66('0x1ff'),'as':_0x8a66('0x1e8')});db[_0x8a66('0x109')]['belongsTo'](db[_0x8a66('0x10a')],{'foreignKey':_0x8a66('0x200'),'as':_0x8a66('0x1eb')});db[_0x8a66('0x109')]['belongsTo'](db[_0x8a66('0x13')],{'foreignKey':_0x8a66('0x1e4'),'as':'FromAgent'});db['WhatsappTransferReport']['belongsTo'](db[_0x8a66('0x13')],{'foreignKey':'ToUserId','as':_0x8a66('0x1e6')});db[_0x8a66('0x10a')][_0x8a66('0x12b')](db['User'],{'as':_0x8a66('0x160'),'through':_0x8a66('0x39'),'foreignKey':_0x8a66('0x201')});db[_0x8a66('0x10a')]['belongsToMany'](db[_0x8a66('0xe7')],{'through':_0x8a66('0x202'),'as':_0x8a66('0x161')});db[_0x8a66('0x113')][_0x8a66('0x158')](db['User'],{'as':'user','foreignKey':_0x8a66('0x118'),'onDelete':_0x8a66('0x117'),'hooks':!![]});db[_0x8a66('0x10c')][_0x8a66('0x116')](db[_0x8a66('0xc6')],{'as':_0x8a66('0xc6'),'onDelete':_0x8a66('0x169')});db[_0x8a66('0x10c')]['hasOne'](db[_0x8a66('0x3b')],{'as':_0x8a66('0x16a'),'onDelete':_0x8a66('0x169')});db['CloudProvider'][_0x8a66('0x116')](db[_0x8a66('0x3d')],{'as':_0x8a66('0x16b'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f3b5359..db8ed60 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2e3=['./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xf2e3[_0x2adbeb];return _0x5e18a6;};'use strict';var path=require(_0x3f2e('0x0'));var express=require('express');var errors=require(_0x3f2e('0x1'));var config=require(_0x3f2e('0x2'));var setupLoggers=require(_0x3f2e('0x3'))[_0x3f2e('0x4')];var clientSideLogs=require(_0x3f2e('0x5'));exports[_0x3f2e('0x6')]=function(_0x3938e2){return setupLoggers(_0x3938e2)[_0x3f2e('0x7')](function(){_0x3938e2[_0x3f2e('0x8')]('/api/users',require(_0x3f2e('0x9')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xa'),require(_0x3f2e('0xb')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xc'),require(_0x3f2e('0xd')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xe'),require(_0x3f2e('0xf')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x10'),require(_0x3f2e('0x11')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x12'),require(_0x3f2e('0x13')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x14'),require(_0x3f2e('0x15')));_0x3938e2['use'](_0x3f2e('0x16'),require(_0x3f2e('0x17')));_0x3938e2['use'](_0x3f2e('0x18'),require(_0x3f2e('0x19')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x1a'),require(_0x3f2e('0x1b')));_0x3938e2['use'](_0x3f2e('0x1c'),require(_0x3f2e('0x1d')));_0x3938e2[_0x3f2e('0x8')]('/api/voice/dials/reports',require(_0x3f2e('0x1e')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x1f'),require(_0x3f2e('0x20')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x21'),require(_0x3f2e('0x22')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x23'),require(_0x3f2e('0x24')));_0x3938e2[_0x3f2e('0x8')]('/api/trunks',require(_0x3f2e('0x25')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x26'),require(_0x3f2e('0x27')));_0x3938e2[_0x3f2e('0x8')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x28'),require(_0x3f2e('0x29')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x2a'),require(_0x3f2e('0x2b')));_0x3938e2['use']('/api/mail/substatuses',require(_0x3f2e('0x2c')));_0x3938e2[_0x3f2e('0x8')]('/api/mail/interactions',require('./api/mailInteraction'));_0x3938e2[_0x3f2e('0x8')]('/api/mail/messages',require(_0x3f2e('0x2d')));_0x3938e2[_0x3f2e('0x8')]('/api/mail/applications',require('./api/mailApplication'));_0x3938e2['use'](_0x3f2e('0x2e'),require(_0x3f2e('0x2f')));_0x3938e2['use'](_0x3f2e('0x30'),require('./api/dashboard'));_0x3938e2[_0x3f2e('0x8')]('/api/dashboards/items',require(_0x3f2e('0x31')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x32'),require(_0x3f2e('0x33')));_0x3938e2[_0x3f2e('0x8')]('/api/fax/applications',require(_0x3f2e('0x34')));_0x3938e2[_0x3f2e('0x8')]('/api/fax/interactions',require('./api/faxInteraction'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x35'),require(_0x3f2e('0x36')));_0x3938e2[_0x3f2e('0x8')]('/api/fax/queues',require(_0x3f2e('0x37')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x38'),require('./api/faxQueueReport'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x39'),require(_0x3f2e('0x3a')));_0x3938e2['use'](_0x3f2e('0x3b'),require(_0x3f2e('0x3c')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x3d'),require(_0x3f2e('0x3e')));_0x3938e2[_0x3f2e('0x8')]('/api/sms/messages',require(_0x3f2e('0x3f')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x40'),require(_0x3f2e('0x41')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x42'),require(_0x3f2e('0x43')));_0x3938e2['use'](_0x3f2e('0x44'),require(_0x3f2e('0x45')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x46'),require('./api/openchannelInteraction'));_0x3938e2['use'](_0x3f2e('0x47'),require(_0x3f2e('0x48')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x49'),require(_0x3f2e('0x4a')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x4b'),require(_0x3f2e('0x4c')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x4d'),require('./api/openchannelQueueReport'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x4e'),require(_0x3f2e('0x4f')));_0x3938e2[_0x3f2e('0x8')]('/api/chat/interactions',require(_0x3f2e('0x50')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x51'),require(_0x3f2e('0x52')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x53'),require(_0x3f2e('0x54')));_0x3938e2[_0x3f2e('0x8')]('/api/chat/queues',require(_0x3f2e('0x55')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x56'),require(_0x3f2e('0x57')));_0x3938e2['use'](_0x3f2e('0x58'),require(_0x3f2e('0x59')));_0x3938e2['use'](_0x3f2e('0x5a'),require(_0x3f2e('0x5b')));_0x3938e2['use'](_0x3f2e('0x5c'),require(_0x3f2e('0x5d')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x5e'),require('./api/cmHopper'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x5f'),require('./api/cmHopperBlack'));_0x3938e2['use'](_0x3f2e('0x60'),require(_0x3f2e('0x61')));_0x3938e2[_0x3f2e('0x8')]('/api/cm/hopper_history',require(_0x3f2e('0x62')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x63'),require(_0x3f2e('0x64')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x65'),require(_0x3f2e('0x66')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x67'),require(_0x3f2e('0x68')));_0x3938e2['use']('/api/canned_answers',require(_0x3f2e('0x69')));_0x3938e2[_0x3f2e('0x8')]('/api/dispositions',require('./api/disposition'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x6a'),require(_0x3f2e('0x6b')));_0x3938e2['use'](_0x3f2e('0x6c'),require(_0x3f2e('0x6d')));_0x3938e2[_0x3f2e('0x8')]('/api/pauses',require(_0x3f2e('0x6e')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x6f'),require('./api/cdr'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x70'),require(_0x3f2e('0x71')));_0x3938e2['use'](_0x3f2e('0x72'),require('./api/schedule'));_0x3938e2[_0x3f2e('0x8')]('/api/sounds',require('./api/sound'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x73'),require(_0x3f2e('0x74')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x75'),require('./api/contactItemType'));_0x3938e2['use'](_0x3f2e('0x76'),require(_0x3f2e('0x77')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x78'),require(_0x3f2e('0x79')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x7a'),require(_0x3f2e('0x7b')));_0x3938e2[_0x3f2e('0x8')]('/api/triggers',require('./api/trigger'));_0x3938e2[_0x3f2e('0x8')]('/api/variables',require(_0x3f2e('0x7c')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x7d'),require(_0x3f2e('0x7e')));_0x3938e2['use'](_0x3f2e('0x7f'),require('./api/integrationReport'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x80'),require('./api/analyticCustomReport'));_0x3938e2[_0x3f2e('0x8')]('/api/analytics/default_reports',require(_0x3f2e('0x81')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x82'),require('./api/analyticExtractedReport'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x83'),require(_0x3f2e('0x84')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x85'),require(_0x3f2e('0x86')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x87'),require(_0x3f2e('0x88')));_0x3938e2[_0x3f2e('0x8')]('/api/integrations/salesforce/accounts',require(_0x3f2e('0x89')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x8a'),require(_0x3f2e('0x8b')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x8c'),require(_0x3f2e('0x8d')));_0x3938e2[_0x3f2e('0x8')]('/api/integrations/sugarcrm/accounts',require(_0x3f2e('0x8e')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x8f'),require(_0x3f2e('0x90')));_0x3938e2[_0x3f2e('0x8')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x91'),require(_0x3f2e('0x92')));_0x3938e2['use']('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x93'),require(_0x3f2e('0x94')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x95'),require('./api/intZohoAccount'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x96'),require('./api/intZohoConfiguration'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x97'),require(_0x3f2e('0x98')));_0x3938e2[_0x3f2e('0x8')]('/api/integrations/zendesk/accounts',require(_0x3f2e('0x99')));_0x3938e2['use']('/api/integrations/zendesk/configurations',require(_0x3f2e('0x9a')));_0x3938e2['use']('/api/integrations/zendesk/fields',require(_0x3f2e('0x9b')));_0x3938e2['use'](_0x3f2e('0x9c'),require(_0x3f2e('0x9d')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x9e'),require('./api/intFreshdeskConfiguration'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x9f'),require(_0x3f2e('0xa0')));_0x3938e2[_0x3f2e('0x8')]('/api/integrations/vtiger/accounts',require(_0x3f2e('0xa1')));_0x3938e2['use']('/api/integrations/vtiger/configurations',require(_0x3f2e('0xa2')));_0x3938e2[_0x3f2e('0x8')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xa3'),require(_0x3f2e('0xa4')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xa5'),require(_0x3f2e('0xa6')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xa7'),require('./api/intServicenowField'));_0x3938e2[_0x3f2e('0x8')]('/api/integrations/dynamics365/accounts',require(_0x3f2e('0xa8')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xa9'),require(_0x3f2e('0xaa')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xab'),require(_0x3f2e('0xac')));_0x3938e2[_0x3f2e('0x8')]('/api/integrations/freshsales/accounts',require(_0x3f2e('0xad')));_0x3938e2['use']('/api/integrations/freshsales/configurations',require(_0x3f2e('0xae')));_0x3938e2[_0x3f2e('0x8')]('/api/integrations/freshsales/fields',require(_0x3f2e('0xaf')));_0x3938e2[_0x3f2e('0x8')]('/api/networks',require(_0x3f2e('0xb0')));_0x3938e2['use']('/api/chat/reports/queue',require(_0x3f2e('0xb1')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xb2'),require('./api/chatInternalMessage'));_0x3938e2['use'](_0x3f2e('0xb3'),require(_0x3f2e('0xb4')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xb5'),require(_0x3f2e('0xb6')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xb7'),require(_0x3f2e('0xb8')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xb9'),require(_0x3f2e('0xba')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xbb'),require(_0x3f2e('0xbc')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xbd'),require(_0x3f2e('0xbe')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xbf'),require(_0x3f2e('0xc0')));_0x3938e2['use'](_0x3f2e('0xc1'),require(_0x3f2e('0xc2')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xc3'),require(_0x3f2e('0xc4')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xc5'),require(_0x3f2e('0xc6')));_0x3938e2[_0x3f2e('0x8')]('/api/square/recordings',require(_0x3f2e('0xc7')));_0x3938e2['use'](_0x3f2e('0xc8'),require(_0x3f2e('0xc9')));_0x3938e2['use'](_0x3f2e('0xca'),require(_0x3f2e('0xcb')));_0x3938e2['use'](_0x3f2e('0xcc'),require(_0x3f2e('0xcd')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xce'),require(_0x3f2e('0xcf')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xd0'),require(_0x3f2e('0xd1')));_0x3938e2['use'](_0x3f2e('0xd2'),require('./api/attachment'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xd3'),require(_0x3f2e('0xd4')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xd5'),require(_0x3f2e('0xd6')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xd7'),require(_0x3f2e('0xd8')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xd9'),require(_0x3f2e('0xda')));_0x3938e2['use'](_0x3f2e('0xdb'),require(_0x3f2e('0xdc')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xdd'),require(_0x3f2e('0xde')));_0x3938e2['use'](_0x3f2e('0xdf'),require(_0x3f2e('0xe0')));_0x3938e2['use'](_0x3f2e('0xe1'),require(_0x3f2e('0xe2')));_0x3938e2['use']('/api/userProfiles',require('./api/userProfile'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xe3'),require(_0x3f2e('0xe4')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xe5'),require(_0x3f2e('0xe6')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xe7'),require(_0x3f2e('0xe8')));_0x3938e2['use'](_0x3f2e('0xe9'),require('./api/whatsappAccount'));_0x3938e2[_0x3f2e('0x8')]('/api/whatsapp/applications',require(_0x3f2e('0xea')));_0x3938e2[_0x3f2e('0x8')]('/api/whatsapp/interactions',require(_0x3f2e('0xeb')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xec'),require(_0x3f2e('0xed')));_0x3938e2['use'](_0x3f2e('0xee'),require('./api/whatsappQueueReport'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xef'),require(_0x3f2e('0xf0')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xf1'),require(_0x3f2e('0xf2')));_0x3938e2['use'](_0x3f2e('0xf3'),require(_0x3f2e('0xf4')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xf5'),require(_0x3f2e('0xf6')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xf7'),require('./api/user-setting'));_0x3938e2['use']('/api/mail_interaction_has_tags',require('./api/mailInteractionHasTag'));_0x3938e2[_0x3f2e('0x8')]('/api/auth/local',require(_0x3f2e('0xf8')));_0x3938e2['use'](_0x3f2e('0xf9'),require(_0x3f2e('0xfa')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xfb'),require(_0x3f2e('0xfc')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xfd'),require('./api/jira'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0xfe'),require(_0x3f2e('0xff')));_0x3938e2[_0x3f2e('0x8')]('/api/version',require('./api/version'));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x100'),require(_0x3f2e('0x101')));_0x3938e2['use'](_0x3f2e('0x102'),require(_0x3f2e('0x103')));_0x3938e2['use'](_0x3f2e('0x104'),require(_0x3f2e('0x105')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x106'),clientSideLogs);_0x3938e2['use'](_0x3f2e('0x107'),express[_0x3f2e('0x108')](path[_0x3f2e('0x109')](config[_0x3f2e('0x10a')],_0x3f2e('0x107'))));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x10b'),express[_0x3f2e('0x108')](path[_0x3f2e('0x109')](config['root'],_0x3f2e('0x10b'))));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x10c'),express[_0x3f2e('0x108')](path[_0x3f2e('0x109')](config[_0x3f2e('0x10a')],'/demo')));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x10d'),express[_0x3f2e('0x108')](path[_0x3f2e('0x109')](config['root'],_0x3f2e('0x10e'),_0x3f2e('0x10f'))));_0x3938e2[_0x3f2e('0x8')](_0x3f2e('0x110'),express['static'](path[_0x3f2e('0x109')](config[_0x3f2e('0x10a')],_0x3f2e('0x111'))));_0x3938e2[_0x3f2e('0x112')](_0x3f2e('0x113'))[_0x3f2e('0x114')](errors[0x194]);_0x3938e2[_0x3f2e('0x112')]('/*')[_0x3f2e('0x114')](function(_0x5cb1f8,_0x595db6){_0x595db6[_0x3f2e('0x115')](path[_0x3f2e('0x116')](_0x3938e2[_0x3f2e('0x114')]('appPath')+'/index.html'));});return _0x3938e2;});}; \ No newline at end of file +var _0x6a55=['./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','root','/www','/demo','/snippet','3.13.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','./utils/client-side-logger','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages'];(function(_0xb23119,_0x4a4dcc){var _0x233746=function(_0x2b73a0){while(--_0x2b73a0){_0xb23119['push'](_0xb23119['shift']());}};_0x233746(++_0x4a4dcc);}(_0x6a55,0xdb));var _0x56a5=function(_0x21481c,_0x1b51ba){_0x21481c=_0x21481c-0x0;var _0x5dd77a=_0x6a55[_0x21481c];return _0x5dd77a;};'use strict';var path=require(_0x56a5('0x0'));var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0x56a5('0x1'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x56a5('0x2')]=function(_0x5e5a32){return setupLoggers(_0x5e5a32)[_0x56a5('0x3')](function(){_0x5e5a32['use'](_0x56a5('0x4'),require(_0x56a5('0x5')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x7'),require(_0x56a5('0x8')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x9'),require(_0x56a5('0xa')));_0x5e5a32['use'](_0x56a5('0xb'),require(_0x56a5('0xc')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xd'),require(_0x56a5('0xe')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xf'),require(_0x56a5('0x10')));_0x5e5a32[_0x56a5('0x6')]('/api/voice/recordings',require('./api/voiceRecording'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x11'),require(_0x56a5('0x12')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x13'),require(_0x56a5('0x14')));_0x5e5a32['use']('/api/voice/mails/messages',require(_0x56a5('0x15')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x16'),require(_0x56a5('0x17')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x18'),require(_0x56a5('0x19')));_0x5e5a32['use'](_0x56a5('0x1a'),require('./api/voiceAgentReport'));_0x5e5a32[_0x56a5('0x6')]('/api/voice/queues/reports',require(_0x56a5('0x1b')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x1c'),require(_0x56a5('0x1d')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x1e'),require(_0x56a5('0x1f')));_0x5e5a32['use'](_0x56a5('0x20'),require(_0x56a5('0x21')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x22'),require('./api/mailServerOut'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x23'),require(_0x56a5('0x24')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x25'),require('./api/mailQueue'));_0x5e5a32['use'](_0x56a5('0x26'),require(_0x56a5('0x27')));_0x5e5a32['use'](_0x56a5('0x28'),require(_0x56a5('0x29')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x2a'),require(_0x56a5('0x2b')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x2c'),require(_0x56a5('0x2d')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x2e'),require(_0x56a5('0x2f')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x30'),require('./api/dashboard'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x31'),require(_0x56a5('0x32')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x33'),require('./api/faxAccount'));_0x5e5a32[_0x56a5('0x6')]('/api/fax/applications',require(_0x56a5('0x34')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x35'),require(_0x56a5('0x36')));_0x5e5a32['use'](_0x56a5('0x37'),require(_0x56a5('0x38')));_0x5e5a32[_0x56a5('0x6')]('/api/fax/queues',require(_0x56a5('0x39')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x3a'),require(_0x56a5('0x3b')));_0x5e5a32[_0x56a5('0x6')]('/api/sms/accounts',require(_0x56a5('0x3c')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x3d'),require(_0x56a5('0x3e')));_0x5e5a32[_0x56a5('0x6')]('/api/sms/interactions',require('./api/smsInteraction'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x3f'),require(_0x56a5('0x40')));_0x5e5a32['use'](_0x56a5('0x41'),require(_0x56a5('0x42')));_0x5e5a32['use']('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x5e5a32['use'](_0x56a5('0x43'),require(_0x56a5('0x44')));_0x5e5a32[_0x56a5('0x6')]('/api/openchannel/interactions',require(_0x56a5('0x45')));_0x5e5a32['use'](_0x56a5('0x46'),require(_0x56a5('0x47')));_0x5e5a32['use'](_0x56a5('0x48'),require('./api/openchannelQueue'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x49'),require(_0x56a5('0x4a')));_0x5e5a32['use'](_0x56a5('0x4b'),require(_0x56a5('0x4c')));_0x5e5a32[_0x56a5('0x6')]('/api/chat/applications',require(_0x56a5('0x4d')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x4e'),require(_0x56a5('0x4f')));_0x5e5a32[_0x56a5('0x6')]('/api/chat/messages',require('./api/chatMessage'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x50'),require(_0x56a5('0x51')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x52'),require(_0x56a5('0x53')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x54'),require(_0x56a5('0x55')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x56'),require(_0x56a5('0x57')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x58'),require(_0x56a5('0x59')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x5a'),require(_0x56a5('0x5b')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x5c'),require(_0x56a5('0x5d')));_0x5e5a32[_0x56a5('0x6')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x5e5a32[_0x56a5('0x6')]('/api/cm/hopper_final',require(_0x56a5('0x5e')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x5f'),require(_0x56a5('0x60')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x61'),require('./api/cmCustomField'));_0x5e5a32['use'](_0x56a5('0x62'),require(_0x56a5('0x63')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x64'),require(_0x56a5('0x65')));_0x5e5a32[_0x56a5('0x6')]('/api/canned_answers',require(_0x56a5('0x66')));_0x5e5a32[_0x56a5('0x6')]('/api/dispositions',require(_0x56a5('0x67')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x68'),require(_0x56a5('0x69')));_0x5e5a32['use'](_0x56a5('0x6a'),require('./api/interval'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x6b'),require('./api/pause'));_0x5e5a32[_0x56a5('0x6')]('/api/cdr',require(_0x56a5('0x6c')));_0x5e5a32[_0x56a5('0x6')]('/api/voiceQueuesLog',require(_0x56a5('0x6d')));_0x5e5a32['use'](_0x56a5('0x6e'),require('./api/schedule'));_0x5e5a32[_0x56a5('0x6')]('/api/sounds',require(_0x56a5('0x6f')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x70'),require(_0x56a5('0x71')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x72'),require(_0x56a5('0x73')));_0x5e5a32['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x74'),require(_0x56a5('0x75')));_0x5e5a32['use'](_0x56a5('0x76'),require(_0x56a5('0x77')));_0x5e5a32[_0x56a5('0x6')]('/api/triggers',require(_0x56a5('0x78')));_0x5e5a32[_0x56a5('0x6')]('/api/variables',require(_0x56a5('0x79')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x7a'),require(_0x56a5('0x7b')));_0x5e5a32[_0x56a5('0x6')]('/api/integrations/reports',require(_0x56a5('0x7c')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x7d'),require(_0x56a5('0x7e')));_0x5e5a32[_0x56a5('0x6')]('/api/analytics/default_reports',require(_0x56a5('0x7f')));_0x5e5a32[_0x56a5('0x6')]('/api/analytics/extracted_reports',require(_0x56a5('0x80')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x81'),require('./api/analyticMetric'));_0x5e5a32[_0x56a5('0x6')]('/api/analytics/field_reports',require(_0x56a5('0x82')));_0x5e5a32['use'](_0x56a5('0x83'),require(_0x56a5('0x84')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x85'),require('./api/intSalesforceAccount'));_0x5e5a32[_0x56a5('0x6')]('/api/integrations/salesforce/configurations',require(_0x56a5('0x86')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x87'),require(_0x56a5('0x88')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x89'),require(_0x56a5('0x8a')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x8b'),require(_0x56a5('0x8c')));_0x5e5a32['use'](_0x56a5('0x8d'),require(_0x56a5('0x8e')));_0x5e5a32['use'](_0x56a5('0x8f'),require('./api/intDeskAccount'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x90'),require(_0x56a5('0x91')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x92'),require('./api/intDeskField'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x93'),require(_0x56a5('0x94')));_0x5e5a32[_0x56a5('0x6')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x95'),require(_0x56a5('0x96')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x97'),require(_0x56a5('0x98')));_0x5e5a32[_0x56a5('0x6')]('/api/integrations/zendesk/configurations',require(_0x56a5('0x99')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x9a'),require('./api/intZendeskField'));_0x5e5a32['use'](_0x56a5('0x9b'),require(_0x56a5('0x9c')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x9d'),require(_0x56a5('0x9e')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x9f'),require('./api/intFreshdeskField'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xa0'),require(_0x56a5('0xa1')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xa2'),require(_0x56a5('0xa3')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xa4'),require(_0x56a5('0xa5')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xa6'),require(_0x56a5('0xa7')));_0x5e5a32[_0x56a5('0x6')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xa8'),require(_0x56a5('0xa9')));_0x5e5a32['use'](_0x56a5('0xaa'),require(_0x56a5('0xab')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xac'),require(_0x56a5('0xad')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xae'),require(_0x56a5('0xaf')));_0x5e5a32['use'](_0x56a5('0xb0'),require(_0x56a5('0xb1')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xb2'),require(_0x56a5('0xb3')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xb4'),require(_0x56a5('0xb5')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xb6'),require(_0x56a5('0xb7')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xb8'),require(_0x56a5('0xb9')));_0x5e5a32[_0x56a5('0x6')]('/api/chat/internal/messages',require(_0x56a5('0xba')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xbb'),require('./api/jscriptyAnswerReport'));_0x5e5a32[_0x56a5('0x6')]('/api/jscripty/questions/reports',require(_0x56a5('0xbc')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xbd'),require(_0x56a5('0xbe')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xbf'),require('./api/smsQueueReport'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xc0'),require(_0x56a5('0xc1')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xc2'),require(_0x56a5('0xc3')));_0x5e5a32[_0x56a5('0x6')]('/api/jscripty/projects',require(_0x56a5('0xc4')));_0x5e5a32['use']('/api/settings',require(_0x56a5('0xc5')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xc6'),require(_0x56a5('0xc7')));_0x5e5a32['use'](_0x56a5('0xc8'),require(_0x56a5('0xc9')));_0x5e5a32[_0x56a5('0x6')]('/api/square/recordings',require(_0x56a5('0xca')));_0x5e5a32['use'](_0x56a5('0xcb'),require(_0x56a5('0xcc')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xcd'),require(_0x56a5('0xce')));_0x5e5a32['use'](_0x56a5('0xcf'),require(_0x56a5('0xd0')));_0x5e5a32['use'](_0x56a5('0xd1'),require(_0x56a5('0xd2')));_0x5e5a32[_0x56a5('0x6')]('/api/migrations',require(_0x56a5('0xd3')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xd4'),require(_0x56a5('0xd5')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xd6'),require(_0x56a5('0xd7')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xd8'),require(_0x56a5('0xd9')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xda'),require('./api/chatTransferReport'));_0x5e5a32['use'](_0x56a5('0xdb'),require(_0x56a5('0xdc')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xdd'),require(_0x56a5('0xde')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xdf'),require(_0x56a5('0xe0')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xe1'),require(_0x56a5('0xe2')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xe3'),require(_0x56a5('0xe4')));_0x5e5a32[_0x56a5('0x6')]('/api/userProfiles',require(_0x56a5('0xe5')));_0x5e5a32['use'](_0x56a5('0xe6'),require(_0x56a5('0xe7')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xe8'),require(_0x56a5('0xe9')));_0x5e5a32['use'](_0x56a5('0xea'),require(_0x56a5('0xeb')));_0x5e5a32[_0x56a5('0x6')]('/api/whatsapp/accounts',require(_0x56a5('0xec')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xed'),require(_0x56a5('0xee')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xef'),require('./api/whatsappInteraction'));_0x5e5a32['use'](_0x56a5('0xf0'),require(_0x56a5('0xf1')));_0x5e5a32['use']('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x5e5a32[_0x56a5('0x6')]('/api/whatsapp/reports/transfer',require(_0x56a5('0xf2')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xf3'),require('./api/whatsappQueue'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xf4'),require(_0x56a5('0xf5')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xf6'),require('./api/realtime'));_0x5e5a32['use'](_0x56a5('0xf7'),require(_0x56a5('0xf8')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xf9'),require(_0x56a5('0xfa')));_0x5e5a32['use']('/api/auth/local',require(_0x56a5('0xfb')));_0x5e5a32['use'](_0x56a5('0xfc'),require('./api/authGoogle'));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0xfd'),require(_0x56a5('0xfe')));_0x5e5a32['use'](_0x56a5('0xff'),require(_0x56a5('0x100')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x101'),require(_0x56a5('0x102')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x103'),require(_0x56a5('0x104')));_0x5e5a32['use'](_0x56a5('0x105'),require(_0x56a5('0x106')));_0x5e5a32['use'](_0x56a5('0x107'),require(_0x56a5('0x108')));_0x5e5a32['use'](_0x56a5('0x109'),require(_0x56a5('0x10a')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x10b'),clientSideLogs);_0x5e5a32['use']('/apidoc',express[_0x56a5('0x10c')](path[_0x56a5('0x10d')](config[_0x56a5('0x10e')],'/apidoc')));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x10f'),express[_0x56a5('0x10c')](path['join'](config[_0x56a5('0x10e')],_0x56a5('0x10f'))));_0x5e5a32['use'](_0x56a5('0x110'),express['static'](path[_0x56a5('0x10d')](config[_0x56a5('0x10e')],_0x56a5('0x110'))));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x111'),express[_0x56a5('0x10c')](path[_0x56a5('0x10d')](config[_0x56a5('0x10e')],'snippet',_0x56a5('0x112'))));_0x5e5a32[_0x56a5('0x6')](_0x56a5('0x113'),express['static'](path[_0x56a5('0x10d')](config[_0x56a5('0x10e')],_0x56a5('0x114'))));_0x5e5a32[_0x56a5('0x115')](_0x56a5('0x116'))[_0x56a5('0x117')](errors[0x194]);_0x5e5a32['route']('/*')[_0x56a5('0x117')](function(_0x597926,_0x5e5df3){_0x5e5df3[_0x56a5('0x118')](path[_0x56a5('0x119')](_0x5e5a32[_0x56a5('0x117')](_0x56a5('0x11a'))+'/index.html'));});return _0x5e5a32;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 69b795a..e6d3a72 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f26=['../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.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/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc'];(function(_0x4d593e,_0x131776){var _0x31e2df=function(_0x4787ec){while(--_0x4787ec){_0x4d593e['push'](_0x4d593e['shift']());}};_0x31e2df(++_0x131776);}(_0x1f26,0xb5));var _0x61f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f26[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x61f2('0x0'));var _=require(_0x61f2('0x1'));var config=require(_0x61f2('0x2'));exports['listen']=function(){return new Promise(function(_0x1d98a0,_0x41f9f4){var _0x230a1b={};_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x3')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x5')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/voiceQueue/voiceQueue.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x6')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x7')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x8')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x9')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0xa')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0xb')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0xc')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0xd')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0xe')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0xf')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x10')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x11')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x12')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x13')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/faxAccount/faxAccount.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x14')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x15')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x16')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x17')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x18')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x19')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x1a')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x1b')));_0x230a1b=_['merge'](_0x230a1b,require('../api/smsQueue/smsQueue.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x1c')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x1d')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x1e')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/chatInteraction/chatInteraction.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x1f')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x20')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/cmContact/cmContact.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x21')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x22')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x23')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x24')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x25')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x26')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x27')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x28')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x29')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x2a')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x2b')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/variable/variable.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x2c')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x2d')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x2e')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x2f')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x30')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x230a1b=_['merge'](_0x230a1b,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x31')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x32')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x33')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x34')));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x35')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x36')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/squareProject/squareProject.rpc'));_0x230a1b=_['merge'](_0x230a1b,require(_0x61f2('0x37')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x38')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/campaign/campaign.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/attachment/attachment.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x39')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x3a')));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x3b')));_0x230a1b=_['merge'](_0x230a1b,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x230a1b=_[_0x61f2('0x4')](_0x230a1b,require(_0x61f2('0x3c')));var _0x17fb0c=jayson['server'](_0x230a1b)[_0x61f2('0x3d')]();var _0x543eef=config[_0x61f2('0x3e')][_0x61f2('0x3f')]||config[_0x61f2('0x3f')]+0x1;var _0x521cef=config['rpc']['ip']||_0x61f2('0x40');_0x17fb0c['on'](_0x61f2('0x41'),function(_0x214e47){return _0x41f9f4(_0x214e47);});_0x17fb0c[_0x61f2('0x42')](_0x543eef,_0x521cef,function(){console['log'](_0x61f2('0x43'),_0x521cef,_0x543eef);require('../config/triggers')[_0x61f2('0x44')]();return _0x1d98a0('RPC\x20listening\x20on\x20'+_0x521cef+':'+_0x543eef);});});}; \ No newline at end of file +var _0x4fd8=['../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','../api/voiceExtension/voiceExtension.rpc','merge','../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/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/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc'];(function(_0x4f3b10,_0x35cc88){var _0x454404=function(_0x28fecf){while(--_0x28fecf){_0x4f3b10['push'](_0x4f3b10['shift']());}};_0x454404(++_0x35cc88);}(_0x4fd8,0x129));var _0x84fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fd8[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x84fd('0x0'));var _=require(_0x84fd('0x1'));var config=require(_0x84fd('0x2'));exports['listen']=function(){return new Promise(function(_0x56a027,_0xcb835f){var _0x51b0ee={};_0x51b0ee=_['merge'](_0x51b0ee,require('../api/user/user.rpc'));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x3')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/voiceQueue/voiceQueue.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/voiceRecording/voiceRecording.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x5')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x6')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x7')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x8')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x9')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0xa')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0xb')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0xc')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0xd')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0xe')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0xf')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x10')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x11')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x12')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/faxAccount/faxAccount.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x13')));_0x51b0ee=_['merge'](_0x51b0ee,require('../api/faxInteraction/faxInteraction.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x14')));_0x51b0ee=_['merge'](_0x51b0ee,require('../api/faxQueue/faxQueue.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x15')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x16')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x17')));_0x51b0ee=_['merge'](_0x51b0ee,require('../api/smsMessage/smsMessage.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x18')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x19')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x1a')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x1b')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x1c')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x1d')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x1e')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x1f')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x20')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x21')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x22')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x23')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x24')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x25')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x26')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x27')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x28')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x29')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x2a')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x2b')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x2c')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x2d')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x2e')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x2f')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x30')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x31')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x32')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x33')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/setting/setting.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x34')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x35')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/squareRecording/squareRecording.rpc'));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x36')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/campaign/campaign.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x37')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x38')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x39')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x3a')));_0x51b0ee=_[_0x84fd('0x4')](_0x51b0ee,require(_0x84fd('0x3b')));_0x51b0ee=_['merge'](_0x51b0ee,require(_0x84fd('0x3c')));var _0x21805c=jayson[_0x84fd('0x3d')](_0x51b0ee)[_0x84fd('0x3e')]();var _0x5a393d=config['rpc'][_0x84fd('0x3f')]||config[_0x84fd('0x3f')]+0x1;var _0x413100=config['rpc']['ip']||_0x84fd('0x40');_0x21805c['on'](_0x84fd('0x41'),function(_0x33aab2){return _0xcb835f(_0x33aab2);});_0x21805c[_0x84fd('0x42')](_0x5a393d,_0x413100,function(){console['log'](_0x84fd('0x43'),_0x413100,_0x5a393d);require(_0x84fd('0x44'))[_0x84fd('0x45')]();return _0x56a027('RPC\x20listening\x20on\x20'+_0x413100+':'+_0x5a393d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 680fd38..49e74b7 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 _0x80c3=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','util','EventEmitter','./error','call','setTimeout','setEncoding','utf8','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','getData','beep'];(function(_0x5ad72c,_0x1ec6a6){var _0x2d6ff7=function(_0x123181){while(--_0x123181){_0x5ad72c['push'](_0x5ad72c['shift']());}};_0x2d6ff7(++_0x1ec6a6);}(_0x80c3,0x18f));var _0x380c=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x80c3[_0x102ff9];return _0x24fa97;};'use strict';var util=require(_0x380c('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0x380c('0x1')];var AGIReply=require('./reply');var AGIError=require(_0x380c('0x2'));function AGIChannel(_0x4202d4){var _0x24728a=this,_0x52fd7e=new AGIReply(),_0x565a08=![],_0x553158={};EventEmitter[_0x380c('0x3')](_0x24728a);_0x4202d4['setEncoding']('utf8');_0x4202d4[_0x380c('0x4')](0x8*0x3c*0x3c*0x3e8);_0x52fd7e[_0x380c('0x5')](_0x380c('0x6'));_0x52fd7e['on']('headers',function(_0x1d853e){for(var _0x170062 in _0x1d853e){_0x24728a[_0x170062]=_0x1d853e[_0x170062];}_0x24728a['emit'](_0x380c('0x7'));});_0x52fd7e['on'](_0x380c('0x8'),function(_0x50be52){if(_0x50be52[_0x380c('0x9')]()==_0x380c('0xa')){_0x24728a[_0x380c('0xb')]('hangup');return;}if(_0x50be52[_0x380c('0xc')](0x0,0xb)==_0x380c('0xd')){_0x565a08=!![];}if(_0x565a08){_0x553158['rx']+=_0x50be52+'\x0a';if(_0x50be52[_0x380c('0xe')](_0x380c('0xf'))!=-0x1){_0x565a08=![];}}else{_0x553158['rx']=_0x50be52;}if(_0x565a08){return;}if(typeof _0x553158['cb']==_0x380c('0x10')){var _0x475148=_0x553158['rx'][_0x380c('0xc')](0x0,0x3),_0x39bd46=null,_0x14793b=null;_0x475148=parseInt(_0x475148);if(isNaN(_0x475148)){_0x553158['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x380c('0x11')});return;}if(_0x475148!=0xc8){_0x553158['cb'](null,{'code':_0x475148,'result':-0x1,'extra':'KO'});return;}_0x39bd46=_0x553158['rx']['substring'](0x4)[_0x380c('0x12')](_0x380c('0x13'),'');if(_0x39bd46['indexOf']('\x20')!=-0x1){_0x39bd46=_0x39bd46[_0x380c('0x14')](0x0,_0x39bd46[_0x380c('0x15')]('\x20'));}if(_[_0x380c('0x16')](_0x39bd46,'-1')){_0x39bd46=parseInt(_0x39bd46);}_0x14793b=_0x553158['rx'][_0x380c('0x17')]('\x20');if(_0x14793b[_0x380c('0x18')]==0x3){_0x14793b=_0x14793b[0x2][_0x380c('0xc')](0x1,_0x14793b[0x2][_0x380c('0x18')]-0x1);}else if(_0x14793b[_0x380c('0x18')]>0x3){var _0x3022e6=/\((.+)\)/;var _0x4829c5=_0x553158['rx'][_0x380c('0x19')](_0x3022e6);if(_0x4829c5){_0x14793b=_0x4829c5[0x1];}else{_0x14793b=null;}}else{_0x14793b=null;}_0x553158['cb'](null,{'code':_0x475148,'result':_0x39bd46,'extra':_0x14793b});}});_0x4202d4['on']('error',function(_0x5b2c5c){_0x24728a[_0x380c('0xb')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x5b2c5c['code']));});_0x4202d4['on']('close',function(){_0x24728a[_0x380c('0xb')](_0x380c('0x1a'),new AGIError(_0x380c('0x1b')));});_0x4202d4['on'](_0x380c('0x1c'),function(){_0x24728a[_0x380c('0xb')](_0x380c('0x1c'),new AGIError(_0x380c('0x1d')));_0x4202d4[_0x380c('0x1e')]();});_0x4202d4[_0x380c('0x1f')](_0x52fd7e);this[_0x380c('0x20')]=function(_0x22f8f2,_0x16b9ac){var _0x22f8f2=_0x22f8f2||'',_0x16b9ac=typeof _0x16b9ac==_0x380c('0x10')?_0x16b9ac:new Function();_0x553158={'tx':_0x22f8f2,'rx':'','cb':_0x16b9ac};_0x4202d4[_0x380c('0x21')](_0x22f8f2+'\x0a');},this[_0x380c('0x1a')]=function(){_0x4202d4[_0x380c('0x1e')]();};}util[_0x380c('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x380c('0x23')][_0x380c('0x24')]=function(_0x5b5052){return this[_0x380c('0x20')]['sync'](this,_0x5b5052);};AGIChannel[_0x380c('0x23')]['answer']=function(){return this[_0x380c('0x24')]('ANSWER');};AGIChannel['prototype'][_0x380c('0x25')]=function(_0x290f1c,_0x5bce51,_0x24d551){_0x290f1c=_0x290f1c===undefined?_0x380c('0x26'):_0x290f1c;_0x5bce51=_0x5bce51===undefined?'5':_0x5bce51;_0x24d551=_0x24d551===undefined?'1':_0x24d551;return this[_0x380c('0x24')](util[_0x380c('0x27')](_0x380c('0x28'),_0x290f1c,_0x5bce51*0x3e8,_0x24d551));};AGIChannel[_0x380c('0x23')][_0x380c('0x29')]=function(_0x5ac3c2){_0x5ac3c2=_0x5ac3c2||'NO\x20MESSAGE';return this[_0x380c('0x24')](util[_0x380c('0x27')](_0x380c('0x2a'),_0x5ac3c2));};AGIChannel[_0x380c('0x23')][_0x380c('0x2b')]=function(_0x49a51c,_0x5a2e17){if(_['isArray'](_0x5a2e17)){return this[_0x380c('0x24')](util['format'](_0x380c('0x2c'),_0x49a51c,_0x5a2e17[_0x380c('0x2d')](',')));}return this['sendRequest'](util[_0x380c('0x27')](_0x380c('0x2c'),_0x49a51c,_0x5a2e17));};AGIChannel[_0x380c('0x23')][_0x380c('0x2e')]=function(_0x54b933){return this[_0x380c('0x24')](util[_0x380c('0x27')](_0x380c('0x2f'),_0x54b933));};AGIChannel[_0x380c('0x23')][_0x380c('0x30')]=function(_0x239ea8){return this[_0x380c('0x24')](util[_0x380c('0x27')]('SET\x20EXTENSION\x20%s',_0x239ea8));};AGIChannel['prototype']['setPriority']=function(_0x34e358){return this['sendRequest'](util[_0x380c('0x27')]('SET\x20PRIORITY\x20%s',_0x34e358));};AGIChannel[_0x380c('0x23')][_0x380c('0xa')]=function(){return this[_0x380c('0x24')]('HANGUP');};AGIChannel[_0x380c('0x23')][_0x380c('0x31')]=function(_0xf2fce0,_0x3d9a98){var _0x56898c=_[_0x380c('0x32')](_0x3d9a98)||_['isNumber'](_0x3d9a98)?_0x3d9a98[_0x380c('0x33')]():_0x3d9a98;return this['sendRequest'](util['format'](_0x380c('0x34'),_0xf2fce0,_0x56898c?_0x56898c[_0x380c('0x33')]()[_0x380c('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x380c('0x23')][_0x380c('0x35')]=function(_0x72b4ab,_0x48be48){return this[_0x380c('0x24')](util['format'](_0x380c('0x36'),_0x72b4ab,_0x48be48));};AGIChannel[_0x380c('0x23')][_0x380c('0x37')]=function(_0x4c858a,_0x306c61){return this[_0x380c('0x24')](util[_0x380c('0x27')](_0x380c('0x38'),_0x4c858a,_0x306c61));};AGIChannel['prototype'][_0x380c('0x39')]=function(_0x561772,_0x31d880){return this['sendRequest'](util[_0x380c('0x27')](_0x380c('0x3a'),_0x561772,_0x31d880));};AGIChannel[_0x380c('0x23')][_0x380c('0x3b')]=function(_0x502ad9,_0x19bb94,_0x48c339){_0x19bb94=_0x19bb94||this[_0x380c('0x3c')];_0x48c339=_0x48c339||0x1;this[_0x380c('0x2e')](_0x502ad9);this['setExtension'](_0x19bb94);this[_0x380c('0x3d')](_0x48c339);return this[_0x380c('0x29')](util[_0x380c('0x27')](_0x380c('0x3e'),_0x502ad9,_0x19bb94,_0x48c339));};AGIChannel['prototype'][_0x380c('0x3f')]=function(_0x4019fe){return this[_0x380c('0x24')](util[_0x380c('0x27')](_0x380c('0x40'),_0x4019fe));};AGIChannel[_0x380c('0x23')][_0x380c('0x41')]=function(_0x58ebe2,_0x5a5dce,_0x1a63ad,_0x53c0dd,_0x43d1e0,_0x38917b){_0x5a5dce=_0x5a5dce||_0x380c('0x42');_0x1a63ad=_0x1a63ad||'';_0x53c0dd=_0x53c0dd===undefined?-0x1:_0x53c0dd==='-1'?-0x1:_0x53c0dd*0x3e8;_0x43d1e0=_0x43d1e0===undefined?'':'s='+_0x43d1e0;_0x38917b=_0x38917b?'BEEP':'';return this['sendRequest'](util['format'](_0x380c('0x43'),_0x58ebe2,_0x5a5dce,_0x1a63ad,_0x53c0dd,_0x38917b,_0x43d1e0));};AGIChannel['prototype'][_0x380c('0x44')]=function(_0xafeb59,_0x50d6dc){_0x50d6dc=_0x50d6dc||'';return this[_0x380c('0x24')](util[_0x380c('0x27')](_0x380c('0x45'),_0xafeb59,_0x50d6dc));};AGIChannel[_0x380c('0x23')]['agi']=function(_0x2639db){return this[_0x380c('0x2b')]('AGI',_0x2639db);};AGIChannel[_0x380c('0x23')]['wait']=function(_0x5170fd){return this[_0x380c('0x2b')](_0x380c('0x46'),_0x5170fd);};AGIChannel[_0x380c('0x23')][_0x380c('0x47')]=function(_0x4e7176,_0x6b9c8f){this[_0x380c('0x29')](util[_0x380c('0x27')](_0x380c('0x48'),_0x4e7176['id'],_0x4e7176['label'],_0x6b9c8f));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xfa9f=['ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sync','ANSWER','getData','beep','sendRequest','format','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','isBoolean','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','setPriority','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','WAIT'];(function(_0x1e881d,_0x219a7a){var _0x59e0c5=function(_0x47fe73){while(--_0x47fe73){_0x1e881d['push'](_0x1e881d['shift']());}};_0x59e0c5(++_0x219a7a);}(_0xfa9f,0x93));var _0xffa9=function(_0x40cdfa,_0x1cf634){_0x40cdfa=_0x40cdfa-0x0;var _0x2c5e4d=_0xfa9f[_0x40cdfa];return _0x2c5e4d;};'use strict';var util=require('util');var _=require(_0xffa9('0x0'));var EventEmitter=require(_0xffa9('0x1'))[_0xffa9('0x2')];var AGIReply=require(_0xffa9('0x3'));var AGIError=require(_0xffa9('0x4'));function AGIChannel(_0x492e53){var _0x200b31=this,_0x5bed37=new AGIReply(),_0x2f8db9=![],_0x242026={};EventEmitter['call'](_0x200b31);_0x492e53[_0xffa9('0x5')]('utf8');_0x492e53['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5bed37[_0xffa9('0x5')](_0xffa9('0x6'));_0x5bed37['on'](_0xffa9('0x7'),function(_0x13c3d0){for(var _0x5cc8b2 in _0x13c3d0){_0x200b31[_0x5cc8b2]=_0x13c3d0[_0x5cc8b2];}_0x200b31[_0xffa9('0x8')](_0xffa9('0x9'));});_0x5bed37['on'](_0xffa9('0xa'),function(_0x3a7a1a){if(_0x3a7a1a[_0xffa9('0xb')]()==_0xffa9('0xc')){_0x200b31[_0xffa9('0x8')](_0xffa9('0xc'));return;}if(_0x3a7a1a[_0xffa9('0xd')](0x0,0xb)==_0xffa9('0xe')){_0x2f8db9=!![];}if(_0x2f8db9){_0x242026['rx']+=_0x3a7a1a+'\x0a';if(_0x3a7a1a[_0xffa9('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x2f8db9=![];}}else{_0x242026['rx']=_0x3a7a1a;}if(_0x2f8db9){return;}if(typeof _0x242026['cb']==_0xffa9('0x10')){var _0x21ac24=_0x242026['rx'][_0xffa9('0xd')](0x0,0x3),_0x23b3f9=null,_0x231aad=null;_0x21ac24=parseInt(_0x21ac24);if(isNaN(_0x21ac24)){_0x242026['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xffa9('0x11')});return;}if(_0x21ac24!=0xc8){_0x242026['cb'](null,{'code':_0x21ac24,'result':-0x1,'extra':'KO'});return;}_0x23b3f9=_0x242026['rx'][_0xffa9('0xd')](0x4)[_0xffa9('0x12')](_0xffa9('0x13'),'');if(_0x23b3f9[_0xffa9('0x14')]('\x20')!=-0x1){_0x23b3f9=_0x23b3f9['substr'](0x0,_0x23b3f9[_0xffa9('0x14')]('\x20'));}if(_['startsWith'](_0x23b3f9,'-1')){_0x23b3f9=parseInt(_0x23b3f9);}_0x231aad=_0x242026['rx'][_0xffa9('0x15')]('\x20');if(_0x231aad[_0xffa9('0x16')]==0x3){_0x231aad=_0x231aad[0x2]['substring'](0x1,_0x231aad[0x2][_0xffa9('0x16')]-0x1);}else if(_0x231aad[_0xffa9('0x16')]>0x3){var _0x1ce6c3=/\((.+)\)/;var _0x568950=_0x242026['rx'][_0xffa9('0x17')](_0x1ce6c3);if(_0x568950){_0x231aad=_0x568950[0x1];}else{_0x231aad=null;}}else{_0x231aad=null;}_0x242026['cb'](null,{'code':_0x21ac24,'result':_0x23b3f9,'extra':_0x231aad});}});_0x492e53['on'](_0xffa9('0x18'),function(_0x3cd552){_0x200b31[_0xffa9('0x8')]('error',new AGIError(_0xffa9('0x19'),_0x3cd552['code']));});_0x492e53['on'](_0xffa9('0x1a'),function(){_0x200b31[_0xffa9('0x8')](_0xffa9('0x1a'),new AGIError(_0xffa9('0x1b')));});_0x492e53['on'](_0xffa9('0x1c'),function(){_0x200b31[_0xffa9('0x8')]('timeout',new AGIError(_0xffa9('0x1d')));_0x492e53[_0xffa9('0x1e')]();});_0x492e53[_0xffa9('0x1f')](_0x5bed37);this[_0xffa9('0x20')]=function(_0x2d0784,_0x2c9c20){var _0x2d0784=_0x2d0784||'',_0x2c9c20=typeof _0x2c9c20==_0xffa9('0x10')?_0x2c9c20:new Function();_0x242026={'tx':_0x2d0784,'rx':'','cb':_0x2c9c20};_0x492e53['write'](_0x2d0784+'\x0a');},this['close']=function(){_0x492e53[_0xffa9('0x1e')]();};}util[_0xffa9('0x21')](AGIChannel,EventEmitter);AGIChannel[_0xffa9('0x22')]['sendRequest']=function(_0x5d3401){return this[_0xffa9('0x20')][_0xffa9('0x23')](this,_0x5d3401);};AGIChannel[_0xffa9('0x22')]['answer']=function(){return this['sendRequest'](_0xffa9('0x24'));};AGIChannel['prototype'][_0xffa9('0x25')]=function(_0x2a2ceb,_0x231b50,_0x331606){_0x2a2ceb=_0x2a2ceb===undefined?_0xffa9('0x26'):_0x2a2ceb;_0x231b50=_0x231b50===undefined?'5':_0x231b50;_0x331606=_0x331606===undefined?'1':_0x331606;return this[_0xffa9('0x27')](util[_0xffa9('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2a2ceb,_0x231b50*0x3e8,_0x331606));};AGIChannel[_0xffa9('0x22')][_0xffa9('0x29')]=function(_0xa12be0){_0xa12be0=_0xa12be0||_0xffa9('0x2a');return this[_0xffa9('0x27')](util[_0xffa9('0x28')]('VERBOSE\x20\x22%s\x22',_0xa12be0));};AGIChannel['prototype'][_0xffa9('0x2b')]=function(_0x3484f6,_0x3b01fe){if(_[_0xffa9('0x2c')](_0x3b01fe)){return this[_0xffa9('0x27')](util[_0xffa9('0x28')](_0xffa9('0x2d'),_0x3484f6,_0x3b01fe[_0xffa9('0x2e')](',')));}return this[_0xffa9('0x27')](util['format'](_0xffa9('0x2d'),_0x3484f6,_0x3b01fe));};AGIChannel[_0xffa9('0x22')][_0xffa9('0x2f')]=function(_0x5b86f8){return this[_0xffa9('0x27')](util[_0xffa9('0x28')](_0xffa9('0x30'),_0x5b86f8));};AGIChannel['prototype'][_0xffa9('0x31')]=function(_0xa1b92e){return this[_0xffa9('0x27')](util['format'](_0xffa9('0x32'),_0xa1b92e));};AGIChannel['prototype']['setPriority']=function(_0x412fbc){return this['sendRequest'](util[_0xffa9('0x28')](_0xffa9('0x33'),_0x412fbc));};AGIChannel[_0xffa9('0x22')][_0xffa9('0xc')]=function(){return this[_0xffa9('0x27')]('HANGUP');};AGIChannel[_0xffa9('0x22')]['setVariable']=function(_0x4e9dad,_0x1fea76){var _0x4eef99=_[_0xffa9('0x34')](_0x1fea76)||_[_0xffa9('0x35')](_0x1fea76)?_0x1fea76['toString']():_0x1fea76;return this['sendRequest'](util[_0xffa9('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4e9dad,_0x4eef99?_0x4eef99[_0xffa9('0x36')]()[_0xffa9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x4827a6,_0x5685e4){return this[_0xffa9('0x27')](util[_0xffa9('0x28')](_0xffa9('0x37'),_0x4827a6,_0x5685e4));};AGIChannel['prototype'][_0xffa9('0x38')]=function(_0x3d9cd7,_0xf0f36b){return this[_0xffa9('0x27')](util[_0xffa9('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x3d9cd7,_0xf0f36b));};AGIChannel['prototype'][_0xffa9('0x39')]=function(_0x2ef6cc,_0x44d2e4){return this[_0xffa9('0x27')](util['format'](_0xffa9('0x3a'),_0x2ef6cc,_0x44d2e4));};AGIChannel[_0xffa9('0x22')]['continueAt']=function(_0x410d17,_0x17f5ca,_0x446f87){_0x17f5ca=_0x17f5ca||this['extension'];_0x446f87=_0x446f87||0x1;this['setContext'](_0x410d17);this[_0xffa9('0x31')](_0x17f5ca);this[_0xffa9('0x3b')](_0x446f87);return this[_0xffa9('0x29')](util[_0xffa9('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x410d17,_0x17f5ca,_0x446f87));};AGIChannel[_0xffa9('0x22')][_0xffa9('0x3c')]=function(_0xe18568){return this[_0xffa9('0x27')](util[_0xffa9('0x28')](_0xffa9('0x3d'),_0xe18568));};AGIChannel[_0xffa9('0x22')][_0xffa9('0x3e')]=function(_0x2da10a,_0x3823a6,_0x1a1baa,_0x26c8d8,_0x32645e,_0x26ec89){_0x3823a6=_0x3823a6||_0xffa9('0x3f');_0x1a1baa=_0x1a1baa||'';_0x26c8d8=_0x26c8d8===undefined?-0x1:_0x26c8d8==='-1'?-0x1:_0x26c8d8*0x3e8;_0x32645e=_0x32645e===undefined?'':'s='+_0x32645e;_0x26ec89=_0x26ec89?'BEEP':'';return this['sendRequest'](util[_0xffa9('0x28')](_0xffa9('0x40'),_0x2da10a,_0x3823a6,_0x1a1baa,_0x26c8d8,_0x26ec89,_0x32645e));};AGIChannel[_0xffa9('0x22')][_0xffa9('0x41')]=function(_0x345bb7,_0x3e59df){_0x3e59df=_0x3e59df||'';return this['sendRequest'](util[_0xffa9('0x28')](_0xffa9('0x42'),_0x345bb7,_0x3e59df));};AGIChannel['prototype']['agi']=function(_0x271ad1){return this[_0xffa9('0x2b')](_0xffa9('0x43'),_0x271ad1);};AGIChannel['prototype']['wait']=function(_0x5ad793){return this[_0xffa9('0x2b')](_0xffa9('0x44'),_0x5ad793);};AGIChannel[_0xffa9('0x22')][_0xffa9('0x18')]=function(_0x125d08,_0x50ab4b){this[_0xffa9('0x29')](util['format'](_0xffa9('0x45'),_0x125d08['id'],_0x125d08[_0xffa9('0x46')],_0x50ab4b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xffa9('0x47')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 6928c1d..b042030 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 _0xb523=['Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x39dd40,_0x2373e7){var _0x26e5c9=function(_0x233d36){while(--_0x233d36){_0x39dd40['push'](_0x39dd40['shift']());}};_0x26e5c9(++_0x2373e7);}(_0xb523,0xb1));var _0x3b52=function(_0xc635fd,_0x39315c){_0xc635fd=_0xc635fd-0x0;var _0x59e08a=_0xb523[_0xc635fd];return _0x59e08a;};'use strict';var util=require(_0x3b52('0x0'));var error={'E_AGI_UNDEFINED':_0x3b52('0x1'),'E_AGI_ARGUMENT_PORT':_0x3b52('0x2'),'E_AGI_SERVER_ERROR':_0x3b52('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x3b52('0x4'),'E_AGI_SOCKET_ERROR':_0x3b52('0x5'),'E_AGI_SOCKET_CLOSE':_0x3b52('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x3b52('0x7'),'E_AGI_COMMAND_EMPTY':_0x3b52('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x3b52('0x9')};function AGIError(_0x399d2b){var _0x399d2b=_0x399d2b||null,_0x20d36f=_0x20d36f||[],_0xca22eb=0x1,_0x1a2b8b='';if(!error[_0x399d2b]){_0x399d2b=_0x3b52('0xa');}_0x20d36f[_0x3b52('0xb')](error[_0x399d2b]);while(arguments[_0xca22eb]){_0x20d36f['push'](arguments[_0xca22eb]);_0xca22eb++;}_0x1a2b8b=util[_0x3b52('0xc')][_0x3b52('0xd')](util,_0x20d36f);this['message']=_0x1a2b8b;this[_0x3b52('0xe')]=_0x399d2b;}module['exports']=AGIError; \ No newline at end of file +var _0xed38=['name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x31fce6,_0x4056eb){var _0x682b59=function(_0x5f4e2f){while(--_0x5f4e2f){_0x31fce6['push'](_0x31fce6['shift']());}};_0x682b59(++_0x4056eb);}(_0xed38,0xa2));var _0x8ed3=function(_0x1ab76a,_0x425dcb){_0x1ab76a=_0x1ab76a-0x0;var _0x33dc4f=_0xed38[_0x1ab76a];return _0x33dc4f;};'use strict';var util=require(_0x8ed3('0x0'));var error={'E_AGI_UNDEFINED':_0x8ed3('0x1'),'E_AGI_ARGUMENT_PORT':_0x8ed3('0x2'),'E_AGI_SERVER_ERROR':_0x8ed3('0x3'),'E_AGI_SERVER_CLOSE':_0x8ed3('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x8ed3('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x8ed3('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8ed3('0x7'),'E_AGI_IVR_ENTRY':_0x8ed3('0x8')};function AGIError(_0x48e733){var _0x48e733=_0x48e733||null,_0x1a41b2=_0x1a41b2||[],_0x2b921d=0x1,_0x4c60ce='';if(!error[_0x48e733]){_0x48e733=_0x8ed3('0x9');}_0x1a41b2[_0x8ed3('0xa')](error[_0x48e733]);while(arguments[_0x2b921d]){_0x1a41b2['push'](arguments[_0x2b921d]);_0x2b921d++;}_0x4c60ce=util[_0x8ed3('0xb')][_0x8ed3('0xc')](util,_0x1a41b2);this[_0x8ed3('0xd')]=_0x4c60ce;this[_0x8ed3('0xe')]=_0x48e733;}module[_0x8ed3('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 2eb0302..5565fc2 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e02=['parse','emit','projectUpdate','lodash','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','subscribe','error','E_AGI_SERVER_ERROR','message'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x9e02,0x10d));var _0x29e0=function(_0x1d6990,_0x1511b7){_0x1d6990=_0x1d6990-0x0;var _0x47a520=_0x9e02[_0x1d6990];return _0x47a520;};'use strict';var _=require(_0x29e0('0x0'));var EventEmitter=require('events')[_0x29e0('0x1')];var Redis=require(_0x29e0('0x2'));var AGIError=require(_0x29e0('0x3'));var config=require(_0x29e0('0x4'));config[_0x29e0('0x5')]=_[_0x29e0('0x6')](config[_0x29e0('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x29e0('0x5')]);sub[_0x29e0('0x7')]('agi',function(_0x117d47){if(_0x117d47)return eventEmitter['emit'](_0x29e0('0x8'),new AGIError(_0x29e0('0x9'),_0x117d47));});sub['on'](_0x29e0('0xa'),function(_0xa619dd,_0x3931dd){if(_0xa619dd!=='agi')return;try{var _0x52c170=JSON[_0x29e0('0xb')](_0x3931dd);eventEmitter[_0x29e0('0xc')](_0x29e0('0xd'),_0x52c170);}catch(_0x3f5276){eventEmitter[_0x29e0('0xc')]('error',new AGIError(_0x29e0('0x9'),_0x3f5276));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x5b45=['E_AGI_SERVER_ERROR','parse','projectUpdate','events','ioredis','./error','../../config/environment','redis','defaults','agi','emit','error'];(function(_0x184cc6,_0x4961ee){var _0x3f7435=function(_0x448fed){while(--_0x448fed){_0x184cc6['push'](_0x184cc6['shift']());}};_0x3f7435(++_0x4961ee);}(_0x5b45,0xcf));var _0x55b4=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x5b45[_0x4f431d];return _0x4f31e1;};'use strict';var _=require('lodash');var EventEmitter=require(_0x55b4('0x0'))['EventEmitter'];var Redis=require(_0x55b4('0x1'));var AGIError=require(_0x55b4('0x2'));var config=require(_0x55b4('0x3'));config[_0x55b4('0x4')]=_[_0x55b4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x55b4('0x4')]);sub['subscribe'](_0x55b4('0x6'),function(_0xaadc30){if(_0xaadc30)return eventEmitter[_0x55b4('0x7')](_0x55b4('0x8'),new AGIError(_0x55b4('0x9'),_0xaadc30));});sub['on']('message',function(_0x1951c7,_0x581be0){if(_0x1951c7!=='agi')return;try{var _0x22b781=JSON[_0x55b4('0xa')](_0x581be0);eventEmitter[_0x55b4('0x7')](_0x55b4('0xb'),_0x22b781);}catch(_0x29744a){eventEmitter[_0x55b4('0x7')](_0x55b4('0x8'),new AGIError(_0x55b4('0x9'),_0x29744a));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5b8b89f..88ad61a 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 _0x3984=['vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','push','size','relations','traverseBFS','info','no\x20vertex\x20found','no\x20edge/s\x20available','length','condition','split','agicommand'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x3984,0x1ab));var _0x4398=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0x3984[_0x422be2];return _0x1b820e;};'use strict';var _=require(_0x4398('0x0'));var logger=require(_0x4398('0x1'))(_0x4398('0x2'));var verticesWithRetry=[_0x4398('0x3'),_0x4398('0x4'),_0x4398('0x5')];var Graph=function(){this[_0x4398('0x6')]={};this[_0x4398('0x7')]={};this[_0x4398('0x8')]=0x0;};Graph[_0x4398('0x9')]['addVertex']=function(_0x1a759b){this['vertices'][_0x1a759b['id']]=_0x1a759b;this[_0x4398('0x7')][_0x1a759b['id']]=[];};Graph[_0x4398('0x9')]['addEdge']=function(_0x492099,_0x121862,_0xfd033e){this['edges'][_0x492099][_0x4398('0xa')]({'target':_0x121862,'condition':_0xfd033e});this[_0x4398('0x8')]+=0x1;};Graph[_0x4398('0x9')][_0x4398('0xb')]=function(){return _[_0x4398('0xb')](this[_0x4398('0x6')]);};Graph[_0x4398('0x9')][_0x4398('0xc')]=function(){return this[_0x4398('0x8')];};Graph['prototype']['getVertex']=function(_0x3ee310){return this[_0x4398('0x6')][_0x3ee310];};Graph[_0x4398('0x9')][_0x4398('0xd')]=function(_0x5dc611,_0x3084dd){if(!this[_0x4398('0x6')][_0x5dc611]){return logger[_0x4398('0xe')](_0x4398('0xf'));}var _0x52df9c=_0x3084dd(this['vertices'][_0x5dc611]);if(!_0x52df9c){return logger[_0x4398('0xe')]('stop\x20traverse');}if(this[_0x4398('0x7')][_0x5dc611]['length']===0x0){return logger[_0x4398('0xe')](_0x4398('0x10'));}for(var _0x77d68c=0x0,_0x367650=[],_0x119fa6=![];_0x77d68c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','hangup','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','nextTick','stack','findIndex','deleted','push','error','log','port','format','host.docker.internal','name','message','[%s]\x20%s','[ERROR]\x20%s','arg_1','callerid','dnid','info'];(function(_0x552866,_0x1fccda){var _0x6c426=function(_0x52f481){while(--_0x52f481){_0x552866['push'](_0x552866['shift']());}};_0x6c426(++_0x1fccda);}(_0x5ce0,0x145));var _0x05ce=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x5ce0[_0x57fa33];return _0x12e724;};'use strict';var _=require('lodash');var syncho=require(_0x05ce('0x0'));var util=require(_0x05ce('0x1'));var config=require('../../config/environment');var logger=require(_0x05ce('0x2'))(_0x05ce('0x3'));var utilLicense=require(_0x05ce('0x4'));var rpc=require(_0x05ce('0x5'));var Project=require(_0x05ce('0x6'));var AGIEmitter=require(_0x05ce('0x7'))[_0x05ce('0x8')];var projects=[];config[_0x05ce('0x3')]=_[_0x05ce('0x9')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x05ce('0xa'),projectUpdateHandler);function connectionHandler(_0x2c8352){process[_0x05ce('0xb')](function(){syncho(function(){try{setChannelVariables(_0x2c8352);agiHandler(_0x2c8352);}catch(_0x4ae736){logger['error'](_0x4ae736[_0x05ce('0xc')]);}});});}function projectUpdateHandler(_0x442ba7){try{var _0x16569a=_[_0x05ce('0xd')](projects,['id',_0x442ba7['id']]);if(_0x16569a>-0x1){if(_0x442ba7[_0x05ce('0xe')]===!![]){projects['splice'](_0x16569a,0x1);}else{projects[_0x16569a]=_0x442ba7;}}else{projects[_0x05ce('0xf')](_0x442ba7);}}catch(_0x33334f){logger[_0x05ce('0x10')](_0x33334f[_0x05ce('0xc')]);}}function listeningHandler(){var _0x167cdb=config['env']==='production'||![];console[_0x05ce('0x11')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x05ce('0x12')]);logger['info'](util[_0x05ce('0x13')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x167cdb?config['agi']['ip']:_0x05ce('0x14'),config[_0x05ce('0x3')][_0x05ce('0x12')]));}function errorHandler(_0x23f2b0){if(_0x23f2b0&&_0x23f2b0[_0x05ce('0x15')]&&_0x23f2b0[_0x05ce('0x16')]){logger[_0x05ce('0x10')](util[_0x05ce('0x13')](_0x05ce('0x17'),_0x23f2b0[_0x05ce('0x15')],_0x23f2b0[_0x05ce('0x16')]));}else{logger[_0x05ce('0x10')](util[_0x05ce('0x13')](_0x05ce('0x18'),_0x23f2b0[_0x05ce('0xc')]));}}function closeHandler(){logger['info'](util[_0x05ce('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x05ce('0x19')],this['calleridname'],this[_0x05ce('0x1a')],this[_0x05ce('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x125487){logger[_0x05ce('0x10')](_0x125487[_0x05ce('0xc')]);}}function timeoutHandler(){logger[_0x05ce('0x1c')](util[_0x05ce('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x05ce('0x19')],this[_0x05ce('0x1d')],this[_0x05ce('0x1a')],this['dnid'],this[_0x05ce('0x1e')]));}function hangupHandler(){logger[_0x05ce('0x1c')](util[_0x05ce('0x13')](_0x05ce('0x1f'),this[_0x05ce('0x19')],this[_0x05ce('0x1d')],this[_0x05ce('0x1a')],this['dnid'],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x475881,_0x4475d3){rpc[_0x05ce('0x20')](_0x475881)[_0x05ce('0x21')](function(_0x490200){if(_0x4475d3){_0x4475d3(null,_0x490200);}})[_0x05ce('0x22')](function(_0x4e8f32){if(_0x4475d3){_0x4475d3(null,_0x4e8f32);}});}function setChannelVariables(_0x190b29){for(var _0x3e45f2 in _0x190b29){if(_0x190b29[_0x05ce('0x23')](_0x3e45f2)){if(_0x3e45f2[_0x05ce('0x24')](_0x05ce('0x25'))===0x0){_0x190b29[_0x3e45f2[_0x05ce('0x26')](0x4)]=_0x190b29[_0x3e45f2];delete _0x190b29[_0x3e45f2];}}}}function agiHandler(_0x22b39d){logger[_0x05ce('0x27')](_0x05ce('0x28'),JSON['stringify'](_0x22b39d,null,0x2));logger[_0x05ce('0x1c')](util[_0x05ce('0x13')](_0x05ce('0x29'),_0x22b39d[_0x05ce('0x19')],_0x22b39d[_0x05ce('0x1d')],_0x22b39d[_0x05ce('0x1a')],_0x22b39d[_0x05ce('0x1b')],_0x22b39d['uniqueid']));_0x22b39d['on'](_0x05ce('0x10'),errorHandler);_0x22b39d['on'](_0x05ce('0x2a'),closeHandler);_0x22b39d['on']('timeout',timeoutHandler);_0x22b39d[_0x05ce('0x2b')]=![];_0x22b39d['on'](_0x05ce('0x2c'),hangupHandler);var _0x1824b1=_['find'](projects,[_0x05ce('0x15'),_0x22b39d[_0x05ce('0x19')]]);if(!_0x1824b1)return Project[_0x05ce('0x2d')](_0x22b39d);if(!_0x1824b1[_0x05ce('0x2e')])return Project['handleUnpublished'](_0x22b39d);return Project[_0x05ce('0x2f')](_0x1824b1,_0x22b39d);}function main(){var _0x18b23a;return utilLicense[_0x05ce('0x30')]()[_0x05ce('0x21')](function(_0x2e9423){if(!_0x2e9423)return;if(_0x2e9423[_0x05ce('0x31')]){if(_0x2e9423[_0x05ce('0x32')]&&_0x2e9423[_0x05ce('0x32')]>0x0){logger['info'](util[_0x05ce('0x13')](_0x05ce('0x33'),_0x2e9423[_0x05ce('0x32')]));_0x18b23a=_0x2e9423[_0x05ce('0x32')];}else{logger['info'](_0x05ce('0x34'));}}else{logger[_0x05ce('0x1c')](_0x05ce('0x35'));_0x18b23a=-0x1;}})[_0x05ce('0x21')](function(){return Project[_0x05ce('0x36')]();})[_0x05ce('0x21')](function(_0x599eb7){projects=_0x599eb7;return;})['catch'](function(_0x1f2205){logger[_0x05ce('0x10')](_0x05ce('0x37'),_0x1f2205['stack']);})[_0x05ce('0x38')](function(){var _0x252576=require('./server')(config[_0x05ce('0x3')][_0x05ce('0x12')],config[_0x05ce('0x3')]['ip'],_0x18b23a);_0x252576['on']('error',errorHandler);_0x252576['on'](_0x05ce('0x39'),listeningHandler);_0x252576['on'](_0x05ce('0x3a'),connectionHandler);_0x252576['on'](_0x05ce('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0x4eb4=['./project','./events','EventEmitter','agi','projectUpdate','nextTick','error','stack','deleted','splice','push','production','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','host.docker.internal','port','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','hasOwnProperty','indexOf','agi_','debug','variables','stringify','close','timeout','hangup','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','./server','listening','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc'];(function(_0x4b0726,_0x25640e){var _0x15f709=function(_0x5a2a9c){while(--_0x5a2a9c){_0x4b0726['push'](_0x4b0726['shift']());}};_0x15f709(++_0x25640e);}(_0x4eb4,0x11c));var _0x44eb=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0x4eb4[_0x284506];return _0x1e9ee5;};'use strict';var _=require('lodash');var syncho=require(_0x44eb('0x0'));var util=require(_0x44eb('0x1'));var config=require(_0x44eb('0x2'));var logger=require(_0x44eb('0x3'))('agi');var utilLicense=require(_0x44eb('0x4'));var rpc=require(_0x44eb('0x5'));var Project=require(_0x44eb('0x6'));var AGIEmitter=require(_0x44eb('0x7'))[_0x44eb('0x8')];var projects=[];config[_0x44eb('0x9')]=_['defaults'](config[_0x44eb('0x9')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x44eb('0xa'),projectUpdateHandler);function connectionHandler(_0x244809){process[_0x44eb('0xb')](function(){syncho(function(){try{setChannelVariables(_0x244809);agiHandler(_0x244809);}catch(_0x4a2b95){logger[_0x44eb('0xc')](_0x4a2b95[_0x44eb('0xd')]);}});});}function projectUpdateHandler(_0x43d867){try{var _0x4b6322=_['findIndex'](projects,['id',_0x43d867['id']]);if(_0x4b6322>-0x1){if(_0x43d867[_0x44eb('0xe')]===!![]){projects[_0x44eb('0xf')](_0x4b6322,0x1);}else{projects[_0x4b6322]=_0x43d867;}}else{projects[_0x44eb('0x10')](_0x43d867);}}catch(_0x4eb094){logger['error'](_0x4eb094[_0x44eb('0xd')]);}}function listeningHandler(){var _0x5b4e20=config['env']===_0x44eb('0x11')||![];console[_0x44eb('0x12')](_0x44eb('0x13'),config[_0x44eb('0x9')]['port']);logger[_0x44eb('0x14')](util[_0x44eb('0x15')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x5b4e20?config[_0x44eb('0x9')]['ip']:_0x44eb('0x16'),config[_0x44eb('0x9')][_0x44eb('0x17')]));}function errorHandler(_0x12bf6c){if(_0x12bf6c&&_0x12bf6c[_0x44eb('0x18')]&&_0x12bf6c[_0x44eb('0x19')]){logger[_0x44eb('0xc')](util['format'](_0x44eb('0x1a'),_0x12bf6c['name'],_0x12bf6c['message']));}else{logger[_0x44eb('0xc')](util[_0x44eb('0x15')](_0x44eb('0x1b'),_0x12bf6c['stack']));}}function closeHandler(){logger[_0x44eb('0x14')](util[_0x44eb('0x15')](_0x44eb('0x1c'),this[_0x44eb('0x1d')],this[_0x44eb('0x1e')],this[_0x44eb('0x1f')],this[_0x44eb('0x20')],this[_0x44eb('0x21')]));try{createSquareReport(this);}catch(_0x82078f){logger['error'](_0x82078f['stack']);}}function timeoutHandler(){logger[_0x44eb('0x14')](util[_0x44eb('0x15')](_0x44eb('0x22'),this['arg_1'],this['calleridname'],this[_0x44eb('0x1f')],this['dnid'],this[_0x44eb('0x21')]));}function hangupHandler(){logger['info'](util[_0x44eb('0x15')](_0x44eb('0x23'),this[_0x44eb('0x1d')],this['calleridname'],this[_0x44eb('0x1f')],this['dnid'],this[_0x44eb('0x21')]));this['evtHangup']=!![];}function createSquareReport(_0x2c3e79,_0x4ec26a){rpc[_0x44eb('0x24')](_0x2c3e79)[_0x44eb('0x25')](function(_0xca9d45){if(_0x4ec26a){_0x4ec26a(null,_0xca9d45);}})['catch'](function(_0x4bbb56){if(_0x4ec26a){_0x4ec26a(null,_0x4bbb56);}});}function setChannelVariables(_0xe23cd8){for(var _0xc510c in _0xe23cd8){if(_0xe23cd8[_0x44eb('0x26')](_0xc510c)){if(_0xc510c[_0x44eb('0x27')](_0x44eb('0x28'))===0x0){_0xe23cd8[_0xc510c['substring'](0x4)]=_0xe23cd8[_0xc510c];delete _0xe23cd8[_0xc510c];}}}}function agiHandler(_0x2e850a){logger[_0x44eb('0x29')](_0x44eb('0x2a'),JSON[_0x44eb('0x2b')](_0x2e850a,null,0x2));logger[_0x44eb('0x14')](util[_0x44eb('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2e850a[_0x44eb('0x1d')],_0x2e850a[_0x44eb('0x1e')],_0x2e850a[_0x44eb('0x1f')],_0x2e850a[_0x44eb('0x20')],_0x2e850a['uniqueid']));_0x2e850a['on'](_0x44eb('0xc'),errorHandler);_0x2e850a['on'](_0x44eb('0x2c'),closeHandler);_0x2e850a['on'](_0x44eb('0x2d'),timeoutHandler);_0x2e850a['evtHangup']=![];_0x2e850a['on'](_0x44eb('0x2e'),hangupHandler);var _0x5e71c9=_['find'](projects,['name',_0x2e850a[_0x44eb('0x1d')]]);if(!_0x5e71c9)return Project['handleNotFound'](_0x2e850a);if(!_0x5e71c9[_0x44eb('0x11')])return Project[_0x44eb('0x2f')](_0x2e850a);return Project[_0x44eb('0x30')](_0x5e71c9,_0x2e850a);}function main(){var _0x333525;return utilLicense['getLicense']()[_0x44eb('0x25')](function(_0x5b7963){if(!_0x5b7963)return;if(_0x5b7963[_0x44eb('0x31')]){if(_0x5b7963[_0x44eb('0x32')]&&_0x5b7963['callysquare']>0x0){logger[_0x44eb('0x14')](util['format'](_0x44eb('0x33'),_0x5b7963['callysquare']));_0x333525=_0x5b7963[_0x44eb('0x32')];}else{logger[_0x44eb('0x14')](_0x44eb('0x34'));}}else{logger['info'](_0x44eb('0x35'));_0x333525=-0x1;}})[_0x44eb('0x25')](function(){return Project[_0x44eb('0x36')]();})[_0x44eb('0x25')](function(_0x2ba569){projects=_0x2ba569;return;})['catch'](function(_0xebbce3){logger[_0x44eb('0xc')](_0x44eb('0x37'),_0xebbce3[_0x44eb('0xd')]);})['finally'](function(){var _0x177fee=require(_0x44eb('0x38'))(config[_0x44eb('0x9')]['port'],config['agi']['ip'],_0x333525);_0x177fee['on'](_0x44eb('0xc'),errorHandler);_0x177fee['on'](_0x44eb('0x39'),listeningHandler);_0x177fee['on']('connection',connectionHandler);_0x177fee['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 5a01481..7c06c69 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 _0x213c=['request','then','error','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0x28a245,_0x1d817a){var _0x1bfce6=function(_0x41558a){while(--_0x41558a){_0x28a245['push'](_0x28a245['shift']());}};_0x1bfce6(++_0x1d817a);}(_0x213c,0xcd));var _0xc213=function(_0x58b26b,_0x59691a){_0x58b26b=_0x58b26b-0x0;var _0x1d71af=_0x213c[_0x58b26b];return _0x1d71af;};'use strict';var BPromise=require(_0xc213('0x0'));var jayson=require(_0xc213('0x1'));var client=jayson['client'][_0xc213('0x2')]({'port':0x232b});function request(_0x491ce9,_0x568f52){return new BPromise(function(_0x570c73,_0x5497e0){return client[_0xc213('0x3')](_0x491ce9,_0x568f52)[_0xc213('0x4')](function(_0x27a0db){if(_0x27a0db[_0xc213('0x5')]){return _0x5497e0(_0x27a0db[_0xc213('0x5')]['message']);}else{return _0x570c73(_0x27a0db['result']);}})['catch'](function(_0xfd24a0){return _0x5497e0(_0xfd24a0);});});}exports[_0xc213('0x6')]=function(_0x4ba156,_0x298ae7){return request(_0xc213('0x7'),{'account':_0x4ba156,'message':_0x298ae7});}; \ No newline at end of file +var _0x591a=['error','message','catch','sendMailMessage','SendMail','bluebird','request','then'];(function(_0x44d869,_0x49425f){var _0x1ed521=function(_0x2c2968){while(--_0x2c2968){_0x44d869['push'](_0x44d869['shift']());}};_0x1ed521(++_0x49425f);}(_0x591a,0x9d));var _0xa591=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x591a[_0x5311e8];return _0x582ad8;};'use strict';var BPromise=require(_0xa591('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x418a34,_0x449394){return new BPromise(function(_0x42b309,_0x31bb13){return client[_0xa591('0x1')](_0x418a34,_0x449394)[_0xa591('0x2')](function(_0x550a34){if(_0x550a34[_0xa591('0x3')]){return _0x31bb13(_0x550a34['error'][_0xa591('0x4')]);}else{return _0x42b309(_0x550a34['result']);}})[_0xa591('0x5')](function(_0x58d34f){return _0x31bb13(_0x58d34f);});});}exports[_0xa591('0x6')]=function(_0xafcf1d,_0xee8a46){return request(_0xa591('0x7'),{'account':_0xafcf1d,'message':_0xee8a46});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 49706f8..0990400 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x463a=['addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','mxGraphModel','root','inspect','production','stringify','joinAt','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','traverseBFS','start','clear','debug','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','util','./rpc','./mailRpc','./graph','./vertices','error','stack','agicommand','hasOwnProperty','retry','maxRetry'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0x463a,0x1cb));var _0xa463=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x463a[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xa463('0x0'));var moment=require(_0xa463('0x1'));var parser=require('xml2json');var util=require(_0xa463('0x2'));var logger=require('../../config/logger')('agi');var rpc=require(_0xa463('0x3'));var mailRpc=require(_0xa463('0x4'));var Graph=require(_0xa463('0x5'));var Vertices=require(_0xa463('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x40d9a1){logger[_0xa463('0x7')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x40d9a1[_0xa463('0x8')]);return[];});}function addVertex(_0xcaf14d,_0x2be30c,_0x1fbdec){_0x2be30c[_0xa463('0x9')]=_0x1fbdec;if(_0x2be30c[_0xa463('0xa')](_0xa463('0xb'))){_0x2be30c[_0xa463('0xc')]=parseInt(_0x2be30c[_0xa463('0xb')],0xa);}_0xcaf14d[_0xa463('0xd')](_[_0xa463('0xe')](_0x2be30c,_0xa463('0xf')));}function initGraph(_0x3eebc6,_0x4bd451){var _0x4ee196=new Graph();for(var _0x28e219 in _0x3eebc6){if(_0x3eebc6[_0xa463('0xa')](_0x28e219)){if(_[_0xa463('0x10')](_0x3eebc6[_0x28e219])){for(var _0x5cd692=0x0;_0x5cd692<_0x3eebc6[_0x28e219][_0xa463('0x11')];_0x5cd692+=0x1){addVertex(_0x4ee196,_0x3eebc6[_0x28e219][_0x5cd692],_0x28e219);}}else{addVertex(_0x4ee196,_0x3eebc6[_0x28e219],_0x28e219);}}}for(var _0x75948e=0x0;_0x75948e<_0x4bd451[_0xa463('0x11')];_0x75948e+=0x1){if(_0x4bd451[_0x75948e][_0xa463('0x12')]&&_0x4bd451[_0x75948e][_0xa463('0x13')]){_0x4ee196[_0xa463('0x14')](_0x4bd451[_0x75948e]['source'],_0x4bd451[_0x75948e][_0xa463('0x13')],_0x4bd451[_0x75948e][_0xa463('0x15')]);}}return _0x4ee196;}function getRoot(_0x29bb73){return parser['toJson'](_0x29bb73,{'object':!![]})[_0xa463('0x16')][_0xa463('0x17')];}function inspect(_0xbd422b){return util[_0xa463('0x18')](_0xbd422b,{'showHidden':![],'depth':null});}function initialize(_0x24253f,_0x45d405){var _0x20e257=getRoot(_0x24253f[_0xa463('0x19')]);if(!_0x20e257||!_0x20e257['start'])return;var _0x1e3f30,_0x1911f6,_0x3325b0;logger['debug'](_0xa463('0x17'),JSON[_0xa463('0x1a')](_0x20e257,null,0x2));_0x45d405[_0xa463('0x1b')]=moment()[_0xa463('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e3f30=initGraph(_[_0xa463('0xe')](_0x20e257,_0xa463('0xf')),_0x20e257[_0xa463('0xf')]);_0x1911f6=new Vertices(_0x45d405,rpc,mailRpc);logger[_0xa463('0x1d')](util[_0xa463('0x1c')](_0xa463('0x1e'),_0x45d405['arg_1'],_0x45d405[_0xa463('0x1f')],_0x45d405[_0xa463('0x20')],_0x45d405[_0xa463('0x21')],_0x45d405[_0xa463('0x22')]));_0x1e3f30[_0xa463('0x23')](_0x20e257[_0xa463('0x24')]['id'],function(_0xaf7a70){try{_0xaf7a70=_0x1911f6[_0xa463('0x25')](_0xaf7a70);logger[_0xa463('0x26')]('vertex',JSON['stringify'](_0xaf7a70,null,0x2));if(_0xaf7a70[_0xa463('0x9')]==='gotoc'){logger[_0xa463('0x1d')](_0xa463('0x27'));_0x45d405[_0xa463('0x28')]=_0xaf7a70[_0xa463('0x28')]||_0x45d405['context'];_0x45d405[_0xa463('0x29')]=_0xaf7a70[_0xa463('0x29')];_0x45d405[_0xa463('0x2a')]=_0xaf7a70[_0xa463('0x2a')]?_0xaf7a70['priority']-0x1:0x1;return null;}else if(_0xaf7a70&&_0x1911f6[_0xaf7a70[_0xa463('0x9')]]){_0x3325b0=_0x1911f6[_0xaf7a70['agicommand']](_0xaf7a70);logger[_0xa463('0x1d')](_0xa463('0x2b'),JSON['stringify'](_0x3325b0,null,0x2));if(_0x3325b0&&_0x3325b0['code']===AGI_CODE_SUCCESS&&_0x3325b0['result']!==AGI_RESULT_ERROR&&!_0x45d405[_0xa463('0x2c')]){logger[_0xa463('0x26')](_0xa463('0x2b'),inspect(_0x3325b0));return _[_0xa463('0x2d')](_0x3325b0[_0xa463('0x2e')])?null:_0x3325b0[_0xa463('0x2e')][_0xa463('0x2f')]();}else{logger[_0xa463('0x7')]('response',inspect(_0x3325b0));return null;}}else{logger['error'](_0xa463('0x30'));return null;}}catch(_0x9f7001){logger[_0xa463('0x7')](_0x9f7001[_0xa463('0x8')]);return null;}});if(_0x20e257[_0xa463('0x31')]){logger['info'](util[_0xa463('0x1c')](_0xa463('0x32'),_0x45d405[_0xa463('0x33')],_0x45d405[_0xa463('0x1f')],_0x45d405['callerid'],_0x45d405[_0xa463('0x21')],_0x45d405['uniqueid']));_0x1e3f30[_0xa463('0x23')](_0x20e257[_0xa463('0x31')]['id'],function(_0x505028){try{_0x505028=_0x1911f6[_0xa463('0x25')](_0x505028);logger[_0xa463('0x26')](_0xa463('0x34'),JSON[_0xa463('0x1a')](_0x505028,null,0x2));if(_0x505028&&_0x1911f6[_0x505028[_0xa463('0x9')]]){_0x3325b0=_0x1911f6[_0x505028['agicommand']](_0x505028);if(_0x3325b0){logger[_0xa463('0x26')](_0xa463('0x2b'),inspect(_0x3325b0));return _['isUndefined'](_0x3325b0[_0xa463('0x2e')])?null:_0x3325b0[_0xa463('0x2e')]['toString']();}else{logger[_0xa463('0x7')](_0xa463('0x2b'),inspect(_0x3325b0));return null;}}else{logger[_0xa463('0x7')](_0xa463('0x30'));return null;}}catch(_0x29307f){logger[_0xa463('0x7')](_0x29307f[_0xa463('0x8')]);return null;}});}logger[_0xa463('0x1d')](util[_0xa463('0x1c')](_0xa463('0x35'),_0x45d405['arg_1'],_0x45d405['calleridname'],_0x45d405[_0xa463('0x20')],_0x45d405[_0xa463('0x21')],_0x45d405[_0xa463('0x22')]));logger[_0xa463('0x1d')](util[_0xa463('0x1c')](_0xa463('0x36'),_0x45d405[_0xa463('0x28')],_0x45d405[_0xa463('0x29')],parseInt(_0x45d405[_0xa463('0x2a')],0xa)+0x1));_0x45d405[_0xa463('0x37')](_0x45d405['context'],_0x45d405[_0xa463('0x29')],parseInt(_0x45d405[_0xa463('0x2a')],0xa)+0x1);_0x45d405[_0xa463('0x38')]();}function handleNotFound(_0x40d4ca){logger[_0xa463('0x7')](util[_0xa463('0x1c')](_0xa463('0x39'),_0x40d4ca['arg_1']));_0x40d4ca['continueAt'](_0x40d4ca['context'],_0x40d4ca[_0xa463('0x29')],parseInt(_0x40d4ca[_0xa463('0x2a')],0xa)+0x1);_0x40d4ca[_0xa463('0x38')]();}function handleUnpublished(_0x1f2426){logger[_0xa463('0x7')](util['format']('Project\x20%s\x20not\x20published',_0x1f2426[_0xa463('0x33')]));_0x1f2426['continueAt'](_0x1f2426[_0xa463('0x28')],_0x1f2426[_0xa463('0x29')],parseInt(_0x1f2426['priority'],0xa)+0x1);_0x1f2426['close']();}module[_0xa463('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x6c5a=['YYYY-MM-DD\x20HH:mm:ss','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','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','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','hasOwnProperty','retry','addVertex','mxCell','length','source','target','value','inspect','start','debug','root','stringify','joinAt','format'];(function(_0x23e202,_0x4762da){var _0xdbeddc=function(_0x388e74){while(--_0x388e74){_0x23e202['push'](_0x23e202['shift']());}};_0xdbeddc(++_0x4762da);}(_0x6c5a,0x93));var _0xa6c5=function(_0x95f4e1,_0x5585bf){_0x95f4e1=_0x95f4e1-0x0;var _0xb2c148=_0x6c5a[_0x95f4e1];return _0xb2c148;};'use strict';var _=require(_0xa6c5('0x0'));var moment=require(_0xa6c5('0x1'));var parser=require(_0xa6c5('0x2'));var util=require(_0xa6c5('0x3'));var logger=require('../../config/logger')(_0xa6c5('0x4'));var rpc=require('./rpc');var mailRpc=require(_0xa6c5('0x5'));var Graph=require(_0xa6c5('0x6'));var Vertices=require(_0xa6c5('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xa6c5('0x8')]()[_0xa6c5('0x9')](function(_0x22a475){logger[_0xa6c5('0xa')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x22a475[_0xa6c5('0xb')]);return[];});}function addVertex(_0x78328a,_0x3677b3,_0x1ccc41){_0x3677b3['agicommand']=_0x1ccc41;if(_0x3677b3[_0xa6c5('0xc')](_0xa6c5('0xd'))){_0x3677b3['maxRetry']=parseInt(_0x3677b3['retry'],0xa);}_0x78328a[_0xa6c5('0xe')](_['omit'](_0x3677b3,_0xa6c5('0xf')));}function initGraph(_0x5ab408,_0x895df1){var _0x10c4aa=new Graph();for(var _0x175d82 in _0x5ab408){if(_0x5ab408[_0xa6c5('0xc')](_0x175d82)){if(_['isArray'](_0x5ab408[_0x175d82])){for(var _0x3ff095=0x0;_0x3ff095<_0x5ab408[_0x175d82][_0xa6c5('0x10')];_0x3ff095+=0x1){addVertex(_0x10c4aa,_0x5ab408[_0x175d82][_0x3ff095],_0x175d82);}}else{addVertex(_0x10c4aa,_0x5ab408[_0x175d82],_0x175d82);}}}for(var _0x57f725=0x0;_0x57f725<_0x895df1[_0xa6c5('0x10')];_0x57f725+=0x1){if(_0x895df1[_0x57f725][_0xa6c5('0x11')]&&_0x895df1[_0x57f725]['target']){_0x10c4aa['addEdge'](_0x895df1[_0x57f725][_0xa6c5('0x11')],_0x895df1[_0x57f725][_0xa6c5('0x12')],_0x895df1[_0x57f725][_0xa6c5('0x13')]);}}return _0x10c4aa;}function getRoot(_0x385774){return parser['toJson'](_0x385774,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x662390){return util[_0xa6c5('0x14')](_0x662390,{'showHidden':![],'depth':null});}function initialize(_0x43bf96,_0x2f61d7){var _0x3b5a2a=getRoot(_0x43bf96['production']);if(!_0x3b5a2a||!_0x3b5a2a[_0xa6c5('0x15')])return;var _0x5ec786,_0x18dd14,_0x5d4f71;logger[_0xa6c5('0x16')](_0xa6c5('0x17'),JSON[_0xa6c5('0x18')](_0x3b5a2a,null,0x2));_0x2f61d7[_0xa6c5('0x19')]=moment()[_0xa6c5('0x1a')](_0xa6c5('0x1b'));_0x5ec786=initGraph(_[_0xa6c5('0x1c')](_0x3b5a2a,_0xa6c5('0xf')),_0x3b5a2a[_0xa6c5('0xf')]);_0x18dd14=new Vertices(_0x2f61d7,rpc,mailRpc);logger[_0xa6c5('0x1d')](util['format'](_0xa6c5('0x1e'),_0x2f61d7[_0xa6c5('0x1f')],_0x2f61d7[_0xa6c5('0x20')],_0x2f61d7[_0xa6c5('0x21')],_0x2f61d7[_0xa6c5('0x22')],_0x2f61d7[_0xa6c5('0x23')]));_0x5ec786[_0xa6c5('0x24')](_0x3b5a2a[_0xa6c5('0x15')]['id'],function(_0x30c396){try{_0x30c396=_0x18dd14['clear'](_0x30c396);logger['debug']('vertex',JSON[_0xa6c5('0x18')](_0x30c396,null,0x2));if(_0x30c396[_0xa6c5('0x25')]===_0xa6c5('0x26')){logger['info'](_0xa6c5('0x27'));_0x2f61d7[_0xa6c5('0x28')]=_0x30c396['context']||_0x2f61d7['context'];_0x2f61d7[_0xa6c5('0x29')]=_0x30c396['extension'];_0x2f61d7[_0xa6c5('0x2a')]=_0x30c396['priority']?_0x30c396[_0xa6c5('0x2a')]-0x1:0x1;return null;}else if(_0x30c396&&_0x18dd14[_0x30c396[_0xa6c5('0x25')]]){_0x5d4f71=_0x18dd14[_0x30c396['agicommand']](_0x30c396);logger['info'](_0xa6c5('0x2b'),JSON['stringify'](_0x5d4f71,null,0x2));if(_0x5d4f71&&_0x5d4f71[_0xa6c5('0x2c')]===AGI_CODE_SUCCESS&&_0x5d4f71[_0xa6c5('0x2d')]!==AGI_RESULT_ERROR&&!_0x2f61d7[_0xa6c5('0x2e')]){logger[_0xa6c5('0x16')]('response',inspect(_0x5d4f71));return _[_0xa6c5('0x2f')](_0x5d4f71[_0xa6c5('0x2d')])?null:_0x5d4f71[_0xa6c5('0x2d')][_0xa6c5('0x30')]();}else{logger[_0xa6c5('0xa')]('response',inspect(_0x5d4f71));return null;}}else{logger[_0xa6c5('0xa')](_0xa6c5('0x31'));return null;}}catch(_0xf4fa59){logger['error'](_0xf4fa59[_0xa6c5('0xb')]);return null;}});if(_0x3b5a2a[_0xa6c5('0x32')]){logger[_0xa6c5('0x1d')](util['format'](_0xa6c5('0x33'),_0x2f61d7[_0xa6c5('0x1f')],_0x2f61d7['calleridname'],_0x2f61d7[_0xa6c5('0x21')],_0x2f61d7[_0xa6c5('0x22')],_0x2f61d7['uniqueid']));_0x5ec786[_0xa6c5('0x24')](_0x3b5a2a[_0xa6c5('0x32')]['id'],function(_0x24e945){try{_0x24e945=_0x18dd14[_0xa6c5('0x34')](_0x24e945);logger[_0xa6c5('0x16')]('vertex',JSON[_0xa6c5('0x18')](_0x24e945,null,0x2));if(_0x24e945&&_0x18dd14[_0x24e945[_0xa6c5('0x25')]]){_0x5d4f71=_0x18dd14[_0x24e945[_0xa6c5('0x25')]](_0x24e945);if(_0x5d4f71){logger['debug'](_0xa6c5('0x2b'),inspect(_0x5d4f71));return _[_0xa6c5('0x2f')](_0x5d4f71[_0xa6c5('0x2d')])?null:_0x5d4f71[_0xa6c5('0x2d')][_0xa6c5('0x30')]();}else{logger['error']('response',inspect(_0x5d4f71));return null;}}else{logger['error'](_0xa6c5('0x31'));return null;}}catch(_0x57ed56){logger[_0xa6c5('0xa')](_0x57ed56[_0xa6c5('0xb')]);return null;}});}logger[_0xa6c5('0x1d')](util[_0xa6c5('0x1a')](_0xa6c5('0x35'),_0x2f61d7[_0xa6c5('0x1f')],_0x2f61d7[_0xa6c5('0x20')],_0x2f61d7[_0xa6c5('0x21')],_0x2f61d7[_0xa6c5('0x22')],_0x2f61d7[_0xa6c5('0x23')]));logger['info'](util[_0xa6c5('0x1a')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x2f61d7[_0xa6c5('0x28')],_0x2f61d7['extension'],parseInt(_0x2f61d7['priority'],0xa)+0x1));_0x2f61d7[_0xa6c5('0x36')](_0x2f61d7[_0xa6c5('0x28')],_0x2f61d7[_0xa6c5('0x29')],parseInt(_0x2f61d7['priority'],0xa)+0x1);_0x2f61d7['close']();}function handleNotFound(_0x2845c5){logger[_0xa6c5('0xa')](util['format'](_0xa6c5('0x37'),_0x2845c5[_0xa6c5('0x1f')]));_0x2845c5['continueAt'](_0x2845c5[_0xa6c5('0x28')],_0x2845c5[_0xa6c5('0x29')],parseInt(_0x2845c5[_0xa6c5('0x2a')],0xa)+0x1);_0x2845c5[_0xa6c5('0x38')]();}function handleUnpublished(_0x1ba10d){logger['error'](util[_0xa6c5('0x1a')](_0xa6c5('0x39'),_0x1ba10d[_0xa6c5('0x1f')]));_0x1ba10d[_0xa6c5('0x36')](_0x1ba10d[_0xa6c5('0x28')],_0x1ba10d['extension'],parseInt(_0x1ba10d[_0xa6c5('0x2a')],0xa)+0x1);_0x1ba10d[_0xa6c5('0x38')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 0b6b1ea..3562631 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 _0xbba5=['split','indexOf','slice','trim','headers','emit','line','exports','stream','_localBuffer','inherits','toString','_inBody','substring','length'];(function(_0x19a040,_0x2b1801){var _0x17974b=function(_0x132409){while(--_0x132409){_0x19a040['push'](_0x19a040['shift']());}};_0x17974b(++_0x2b1801);}(_0xbba5,0x1bb));var _0x5bba=function(_0x401883,_0x1d32dc){_0x401883=_0x401883-0x0;var _0x781b87=_0xbba5[_0x401883];return _0x781b87;};'use strict';var util=require('util');var Transform=require(_0x5bba('0x0'))['Transform'];function AGIReply(_0x3abf74){Transform['call'](this,_0x3abf74);this[_0x5bba('0x1')]='';this['_inBody']=![];}util[_0x5bba('0x2')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x208f53,_0x34a464,_0x236460){var _0x5bc2e3='\x0a',_0x4e3b4a=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x60f5d0=-0x1,_0x2f1510=-0x1,_0x42d00b='',_0x176af2=0x0,_0xf71db6='',_0x54bc12='';this['_localBuffer']+=_0x208f53[_0x5bba('0x3')]();_0xf71db6=this[_0x5bba('0x1')];if(!this[_0x5bba('0x4')]){_0x176af2=0x0;while(_0x4e3b4a[_0x176af2]){while((_0x2f1510=_0xf71db6['indexOf'](_0x4e3b4a[_0x176af2]))!=-0x1){_0x42d00b=_0x4e3b4a[_0x176af2];_0x54bc12=_0xf71db6[_0x5bba('0x5')](0x0,_0x2f1510);_0xf71db6=_0xf71db6[_0x5bba('0x5')](_0x2f1510+_0x42d00b[_0x5bba('0x6')]);var _0x488048=_0x54bc12[_0x5bba('0x7')](_0x5bc2e3),_0x108f24=0x0,_0x352004={},_0x581671='',_0x1b14db='',_0x17941b=-0x1;while(_0x488048[_0x108f24]){_0x17941b=_0x488048[_0x108f24][_0x5bba('0x8')](':');if(_0x17941b!=-0x1){_0x581671=_0x488048[_0x108f24][_0x5bba('0x9')](0x0,_0x17941b)[_0x5bba('0xa')]();_0x1b14db=_0x488048[_0x108f24][_0x5bba('0x9')](_0x17941b+0x1)['trim']();if(_0x581671[_0x5bba('0x6')]>0x0){_0x352004[_0x581671]=_0x1b14db;}}else{}_0x108f24++;}this['emit'](_0x5bba('0xb'),_0x352004);this['_inBody']=!![];}_0x176af2++;}this[_0x5bba('0x1')]=_0xf71db6;}else{while((_0x60f5d0=_0xf71db6[_0x5bba('0x8')](_0x5bc2e3))!=-0x1){_0x54bc12=_0xf71db6[_0x5bba('0x5')](0x0,_0x60f5d0);this[_0x5bba('0xc')](_0x5bba('0xd'),_0x54bc12);_0xf71db6=_0xf71db6[_0x5bba('0x5')](_0x60f5d0+_0x5bc2e3[_0x5bba('0x6')]);}this[_0x5bba('0x1')]=_0xf71db6;}_0x236460();};module[_0x5bba('0xe')]=AGIReply; \ No newline at end of file +var _0x102f=['headers','_localBuffer','length','exports','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','trim','slice','emit'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x102f,0x1d2));var _0xf102=function(_0x419ffd,_0x10bdfe){_0x419ffd=_0x419ffd-0x0;var _0xb0b19d=_0x102f[_0x419ffd];return _0xb0b19d;};'use strict';var util=require('util');var Transform=require('stream')['Transform'];function AGIReply(_0x1b768a){Transform['call'](this,_0x1b768a);this['_localBuffer']='';this[_0xf102('0x0')]=![];}util[_0xf102('0x1')](AGIReply,Transform);AGIReply[_0xf102('0x2')][_0xf102('0x3')]=function(_0x5068fe,_0x44d0da,_0x2cc7b7){var _0x5f1c20='\x0a',_0x2cb2d6=['\x0a\x0a',_0xf102('0x4')],_0x2b8fcb=-0x1,_0x1e2873=-0x1,_0x38bd7a='',_0x44b4a7=0x0,_0x3ab013='',_0x1455a9='';this['_localBuffer']+=_0x5068fe['toString']();_0x3ab013=this['_localBuffer'];if(!this[_0xf102('0x0')]){_0x44b4a7=0x0;while(_0x2cb2d6[_0x44b4a7]){while((_0x1e2873=_0x3ab013[_0xf102('0x5')](_0x2cb2d6[_0x44b4a7]))!=-0x1){_0x38bd7a=_0x2cb2d6[_0x44b4a7];_0x1455a9=_0x3ab013['substring'](0x0,_0x1e2873);_0x3ab013=_0x3ab013[_0xf102('0x6')](_0x1e2873+_0x38bd7a['length']);var _0x57d11d=_0x1455a9['split'](_0x5f1c20),_0xa2d260=0x0,_0x2491e1={},_0x3b4764='',_0x410bbe='',_0x48b6a2=-0x1;while(_0x57d11d[_0xa2d260]){_0x48b6a2=_0x57d11d[_0xa2d260]['indexOf'](':');if(_0x48b6a2!=-0x1){_0x3b4764=_0x57d11d[_0xa2d260]['slice'](0x0,_0x48b6a2)[_0xf102('0x7')]();_0x410bbe=_0x57d11d[_0xa2d260][_0xf102('0x8')](_0x48b6a2+0x1)[_0xf102('0x7')]();if(_0x3b4764['length']>0x0){_0x2491e1[_0x3b4764]=_0x410bbe;}}else{}_0xa2d260++;}this[_0xf102('0x9')](_0xf102('0xa'),_0x2491e1);this[_0xf102('0x0')]=!![];}_0x44b4a7++;}this[_0xf102('0xb')]=_0x3ab013;}else{while((_0x2b8fcb=_0x3ab013[_0xf102('0x5')](_0x5f1c20))!=-0x1){_0x1455a9=_0x3ab013[_0xf102('0x6')](0x0,_0x2b8fcb);this[_0xf102('0x9')]('line',_0x1455a9);_0x3ab013=_0x3ab013[_0xf102('0x6')](_0x2b8fcb+_0x5f1c20[_0xf102('0xc')]);}this[_0xf102('0xb')]=_0x3ab013;}_0x2cc7b7();};module[_0xf102('0xd')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index dfe70a2..12c08a2 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 _0x6921=['getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','GetContactByPhone','getTrunkById','ShowTrunk','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','moment','client','then','error','message','result','catch'];(function(_0x4cc1c1,_0x3ad908){var _0x483778=function(_0x358fc5){while(--_0x358fc5){_0x4cc1c1['push'](_0x4cc1c1['shift']());}};_0x483778(++_0x3ad908);}(_0x6921,0x1d1));var _0x1692=function(_0x4fff96,_0x42ae3e){_0x4fff96=_0x4fff96-0x0;var _0x4a0545=_0x6921[_0x4fff96];return _0x4a0545;};'use strict';var _=require('lodash');var moment=require(_0x1692('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x1692('0x1')]['http']({'port':0x2329});function request(_0x434ea2,_0x13a03b){return new Promise(function(_0x4ac00c,_0x3995b3){return client['request'](_0x434ea2,_0x13a03b)[_0x1692('0x2')](function(_0x39cc05){if(_0x39cc05[_0x1692('0x3')]){return _0x3995b3(_0x39cc05[_0x1692('0x3')][_0x1692('0x4')]);}else{return _0x4ac00c(_0x39cc05[_0x1692('0x5')]);}})[_0x1692('0x6')](function(_0x3ffe29){return _0x3995b3(_0x3ffe29);});});}exports[_0x1692('0x7')]=function(){return request(_0x1692('0x8'),{'options':{'raw':![],'attributes':['id',_0x1692('0x9'),'production']}});};exports[_0x1692('0xa')]=function(_0x4ef77e){return request(_0x1692('0xb'),{'options':{'raw':![],'where':{'name':_0x4ef77e},'attributes':[_0x1692('0xc')]}});};exports[_0x1692('0xd')]=function(_0x28964a){return request(_0x1692('0xe'),{'options':{'raw':![],'where':{'id':_0x28964a},'include':[{'model':_0x1692('0xf'),'as':'Smtp','include':[{'model':_0x1692('0x10'),'as':_0x1692('0x10')}]}],'attributes':['id',_0x1692('0x9'),_0x1692('0x11')],'smtp':!![]}});};exports[_0x1692('0x12')]=function(_0x103af7){return request('ShowSquareProject',{'options':{'where':{'id':_0x103af7},'attributes':[_0x1692('0x9')]}});};exports[_0x1692('0x13')]=function(_0xddfb0c){return request(_0x1692('0x14'),{'options':{'where':{'id':_0xddfb0c},'attributes':[_0x1692('0x9')]}});};exports[_0x1692('0x15')]=function(_0x5e33d8){return request(_0x1692('0x16'),{'options':{'where':{'id':_0x5e33d8},'attributes':['name']}});};exports[_0x1692('0x17')]=function(_0x4990b1){return request(_0x1692('0x18'),{'options':{'where':{'id':_0x4990b1},'attributes':['dsn']}});};exports[_0x1692('0x19')]=function(_0x28db17){return request(_0x1692('0x1a'),{'options':{'where':{'id':_0x28db17},'attributes':['name']}});};exports['getContactByPhone']=function(_0x3c0960){return request(_0x1692('0x1b'),{'options':{'where':{'phone':_0x3c0960['phone']},'attributes':['id']}});};exports[_0x1692('0x1c')]=function(_0x4e6bfc){return request(_0x1692('0x1d'),{'options':{'where':{'id':_0x4e6bfc},'attributes':['name']}});};exports['getSoundById']=function(_0xd4e716){return request('ShowSound',{'options':{'where':{'id':_0xd4e716},'attributes':[_0x1692('0x1e')]}});};exports[_0x1692('0x1f')]=function(_0x26571d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x26571d},'include':[{'model':_0x1692('0x20'),'as':_0x1692('0x21')}]}});};exports[_0x1692('0x22')]=function(_0x1bc519){return request(_0x1692('0x23'),{'options':{'where':{'id':_0x1bc519},'attributes':['id',_0x1692('0x9')]}});};exports[_0x1692('0x24')]=function(_0x4e76ff){return request(_0x1692('0x25'),{'body':_0x4e76ff});};exports[_0x1692('0x26')]=function(_0x50a11f){return request('CreateSquareDetailsReport',{'body':_0x50a11f});};exports['createSquareReport']=function(_0x55df5a){return request(_0x1692('0x27'),{'body':_['merge'](_0x55df5a,{'project_name':_0x55df5a[_0x1692('0x28')],'prev_project_name':_0x55df5a[_0x1692('0x29')]||'','is_subproject':_0x55df5a[_0x1692('0x29')]?!![]:![],'leaveAt':moment()[_0x1692('0x2a')](_0x1692('0x2b'))})});};exports[_0x1692('0x2c')]=function(_0x5a355b){return request(_0x1692('0x2d'),{'body':_0x5a355b});};exports[_0x1692('0x2e')]=function(_0x429687){return request(_0x1692('0x2f'),{'body':_0x429687});};exports['createCmContact']=function(_0x5364cd){return request(_0x1692('0x30'),{'options':{'raw':![],'where':{'phone':_0x5364cd[_0x1692('0x31')],'ListId':_0x5364cd[_0x1692('0x32')]}}})[_0x1692('0x2')](function(_0x4a2dba){if(_0x4a2dba){return _0x4a2dba;}return request('CreateCmContact',{'body':_0x5364cd});});};exports['getPauseById']=function(_0x38c5bd){return request(_0x1692('0x33'),{'options':{'where':{'id':_0x38c5bd},'attributes':[_0x1692('0x9')]}});};exports[_0x1692('0x34')]=function(_0x1442d6,_0x44499f){return request(_0x1692('0x35'),{'body':{'interface':_0x44499f},'options':{'where':_0x1442d6}});};exports[_0x1692('0x36')]=function(_0x5eb05b,_0x170884,_0x56a6c5){return request(_0x1692('0x37'),{'body':{'type':_0x170884,'uniqueid':_0x56a6c5},'options':{'where':_0x5eb05b}});};exports[_0x1692('0x38')]=function(_0x30bd6d){return request(_0x1692('0x39'),{'body':{},'options':{'where':_0x30bd6d}});};exports['agentLogout']=function(_0x405cd0){return request(_0x1692('0x3a'),{'body':{},'options':{'where':_0x405cd0}});}; \ No newline at end of file +var _0x7a59=['getTrunkById','getSoundById','getIntervalById','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','LogoutUser','lodash','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','getContactByPhone','GetContactByPhone','phone'];(function(_0x58b196,_0x2aaec0){var _0x55332e=function(_0x3f9399){while(--_0x3f9399){_0x58b196['push'](_0x58b196['shift']());}};_0x55332e(++_0x2aaec0);}(_0x7a59,0x16e));var _0x97a5=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7a59[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x97a5('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var client=jayson[_0x97a5('0x1')][_0x97a5('0x2')]({'port':0x2329});function request(_0x23919f,_0xdc5cf1){return new Promise(function(_0x281bfd,_0x5e2db0){return client[_0x97a5('0x3')](_0x23919f,_0xdc5cf1)[_0x97a5('0x4')](function(_0x3e1524){if(_0x3e1524['error']){return _0x5e2db0(_0x3e1524[_0x97a5('0x5')][_0x97a5('0x6')]);}else{return _0x281bfd(_0x3e1524[_0x97a5('0x7')]);}})[_0x97a5('0x8')](function(_0x27e8a6){return _0x5e2db0(_0x27e8a6);});});}exports[_0x97a5('0x9')]=function(){return request(_0x97a5('0xa'),{'options':{'raw':![],'attributes':['id','name',_0x97a5('0xb')]}});};exports[_0x97a5('0xc')]=function(_0xd70b51){return request(_0x97a5('0xd'),{'options':{'raw':![],'where':{'name':_0xd70b51},'attributes':[_0x97a5('0xb')]}});};exports['getMailAccountById']=function(_0x4ff7ba){return request(_0x97a5('0xe'),{'options':{'raw':![],'where':{'id':_0x4ff7ba},'include':[{'model':_0x97a5('0xf'),'as':_0x97a5('0x10'),'include':[{'model':'CloudProvider','as':_0x97a5('0x11')}]}],'attributes':['id',_0x97a5('0x12'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x3876fc){return request(_0x97a5('0xd'),{'options':{'where':{'id':_0x3876fc},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x51d5e2){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x51d5e2},'attributes':[_0x97a5('0x12')]}});};exports[_0x97a5('0x13')]=function(_0x3603e4){return request('ShowVariable',{'options':{'where':{'id':_0x3603e4},'attributes':[_0x97a5('0x12')]}});};exports[_0x97a5('0x14')]=function(_0x531ed8){return request(_0x97a5('0x15'),{'options':{'where':{'id':_0x531ed8},'attributes':['dsn']}});};exports[_0x97a5('0x16')]=function(_0x55071b){return request('ShowUser',{'options':{'where':{'id':_0x55071b},'attributes':['name']}});};exports[_0x97a5('0x17')]=function(_0x5c5740){return request(_0x97a5('0x18'),{'options':{'where':{'phone':_0x5c5740[_0x97a5('0x19')]},'attributes':['id']}});};exports[_0x97a5('0x1a')]=function(_0x1efe8c){return request('ShowTrunk',{'options':{'where':{'id':_0x1efe8c},'attributes':['name']}});};exports[_0x97a5('0x1b')]=function(_0x114372){return request('ShowSound',{'options':{'where':{'id':_0x114372},'attributes':['save_name']}});};exports[_0x97a5('0x1c')]=function(_0x3d7dba){return request(_0x97a5('0x1d'),{'options':{'raw':![],'where':{'id':_0x3d7dba},'include':[{'model':'Interval','as':_0x97a5('0x1e')}]}});};exports[_0x97a5('0x1f')]=function(_0x23f4f8){return request('ShowSmsAccount',{'options':{'where':{'id':_0x23f4f8},'attributes':['id',_0x97a5('0x12')]}});};exports[_0x97a5('0x20')]=function(_0x4e2074){return request(_0x97a5('0x21'),{'body':_0x4e2074});};exports[_0x97a5('0x22')]=function(_0x233b29){return request(_0x97a5('0x23'),{'body':_0x233b29});};exports[_0x97a5('0x24')]=function(_0x5239f2){return request(_0x97a5('0x25'),{'body':_[_0x97a5('0x26')](_0x5239f2,{'project_name':_0x5239f2[_0x97a5('0x27')],'prev_project_name':_0x5239f2['arg_2']||'','is_subproject':_0x5239f2[_0x97a5('0x28')]?!![]:![],'leaveAt':moment()[_0x97a5('0x29')](_0x97a5('0x2a'))})});};exports[_0x97a5('0x2b')]=function(_0x2076e9){return request(_0x97a5('0x2c'),{'body':_0x2076e9});};exports['createSquareMessage']=function(_0x1dcf5f){return request(_0x97a5('0x2d'),{'body':_0x1dcf5f});};exports['createCmContact']=function(_0x274ccb){return request(_0x97a5('0x2e'),{'options':{'raw':![],'where':{'phone':_0x274ccb['phone'],'ListId':_0x274ccb[_0x97a5('0x2f')]}}})[_0x97a5('0x4')](function(_0x5c1c67){if(_0x5c1c67){return _0x5c1c67;}return request(_0x97a5('0x30'),{'body':_0x274ccb});});};exports['getPauseById']=function(_0x1bb701){return request(_0x97a5('0x31'),{'options':{'where':{'id':_0x1bb701},'attributes':[_0x97a5('0x12')]}});};exports[_0x97a5('0x32')]=function(_0x4845ed,_0x524ee8){return request(_0x97a5('0x33'),{'body':{'interface':_0x524ee8},'options':{'where':_0x4845ed}});};exports[_0x97a5('0x34')]=function(_0x418498,_0x57c7d7,_0x3e2a58){return request(_0x97a5('0x35'),{'body':{'type':_0x57c7d7,'uniqueid':_0x3e2a58},'options':{'where':_0x418498}});};exports['agentUnpause']=function(_0x1bbccd){return request(_0x97a5('0x36'),{'body':{},'options':{'where':_0x1bbccd}});};exports['agentLogout']=function(_0x4817b0){return request(_0x97a5('0x37'),{'body':{},'options':{'where':_0x4817b0}});}; \ 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 14b6f9f..2058124 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 _0xc838=['./polly','./lex','exports'];(function(_0x375ac9,_0x262210){var _0x421ea2=function(_0x10e6ba){while(--_0x10e6ba){_0x375ac9['push'](_0x375ac9['shift']());}};_0x421ea2(++_0x262210);}(_0xc838,0xbd));var _0x8c83=function(_0x5bfcb9,_0x384f03){_0x5bfcb9=_0x5bfcb9-0x0;var _0x15a845=_0xc838[_0x5bfcb9];return _0x15a845;};var polly=require(_0x8c83('0x0'));var lex=require(_0x8c83('0x1'));module[_0x8c83('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xf767=['./lex','exports'];(function(_0x2003cc,_0x259846){var _0x6cba99=function(_0x468720){while(--_0x468720){_0x2003cc['push'](_0x2003cc['shift']());}};_0x6cba99(++_0x259846);}(_0xf767,0x76));var _0x7f76=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0xf767[_0x3e7e96];return _0x13f6f0;};var polly=require('./polly');var lex=require(_0x7f76('0x0'));module[_0x7f76('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index ba8b8de..81da7f4 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 _0x4483=['exports','./lib/api'];(function(_0x1248cf,_0x2573f1){var _0x32d45b=function(_0x454f6a){while(--_0x454f6a){_0x1248cf['push'](_0x1248cf['shift']());}};_0x32d45b(++_0x2573f1);}(_0x4483,0x1a3));var _0x3448=function(_0x2aa710,_0x21e806){_0x2aa710=_0x2aa710-0x0;var _0xff5726=_0x4483[_0x2aa710];return _0xff5726;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ No newline at end of file +var _0xaa88=['exports','./lib/api'];(function(_0x274a54,_0x5988ad){var _0x52e99b=function(_0x1b39fc){while(--_0x1b39fc){_0x274a54['push'](_0x274a54['shift']());}};_0x52e99b(++_0x5988ad);}(_0xaa88,0x137));var _0x8aa8=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xaa88[_0x2a67fe];return _0x57e726;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ 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 8c0978a..5f14798 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(_0x283a37,_0x41c34){var _0x1daff3=function(_0x1853fb){while(--_0x1853fb){_0x283a37['push'](_0x283a37['shift']());}};_0x1daff3(++_0x41c34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x20bc28,_0xadbc0e){var _0x227d0e=function(_0x49571c){while(--_0x49571c){_0x20bc28['push'](_0x20bc28['shift']());}};_0x227d0e(++_0xadbc0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 17cbea8..7b9718d 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 _0xd403=['exports','./lib/api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd403,0xf7));var _0x3d40=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xd403[_0x4a53d];return _0x27410e;};'use strict';var polly=require(_0x3d40('0x0'));module[_0x3d40('0x1')]=function(_0x2a5e0f,_0xff6c7f,_0x467463,_0x56abd0,_0x4a5e33,_0x4c72bf,_0xf73bc6){return polly(_0x2a5e0f,_0xff6c7f,_0x467463,_0x56abd0,_0x4a5e33,_0x4c72bf,_0xf73bc6);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x781699,_0x1998da,_0x566008,_0x2adb5a,_0x17d6fa,_0x438f68,_0x393c62){return polly(_0x781699,_0x1998da,_0x566008,_0x2adb5a,_0x17d6fa,_0x438f68,_0x393c62);}; \ 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 cf1e3ec..1eea4b7 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 _0x2c35=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','exports','text'];(function(_0x436961,_0x1bcd3b){var _0x32ad84=function(_0x4493c4){while(--_0x4493c4){_0x436961['push'](_0x436961['shift']());}};_0x32ad84(++_0x1bcd3b);}(_0x2c35,0x1de));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x52c3('0x0'));var BPromise=require(_0x52c3('0x1'));var rs=require(_0x52c3('0x2'));var AWS=require(_0x52c3('0x3'));function pollyResult(_0x5c3681,_0x3561c1,_0x351d34){return new BPromise(function(_0x504f79,_0x488850){_0x5c3681[_0x52c3('0x4')](_0x3561c1,function(_0x433ad8,_0x553327){if(_0x433ad8){_0x488850(_0x433ad8);}else if(_0x553327){if(_0x553327['AudioStream']instanceof Buffer){fs['writeFile'](_0x351d34,_0x553327[_0x52c3('0x5')],function(_0x26a68c){if(_0x26a68c){_0x488850(_0x26a68c);}else{_0x504f79();}});}else{_0x488850(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x488850(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x52c3('0x6')]=function(_0x1f8e45,_0x1a9c80,_0x4bc263,_0x378da8,_0x4211be,_0x3e0084,_0x23e48b){var _0x5f34fa=new AWS['Polly']({'accessKeyId':_0x1f8e45,'secretAccessKey':_0x1a9c80,'region':_0x4bc263});var _0xbdbdce={'Text':_0x4211be,'TextType':_0x3e0084||_0x52c3('0x7'),'OutputFormat':_0x52c3('0x8'),'VoiceId':_0x378da8};return pollyResult(_0x5f34fa,_0xbdbdce,_0x23e48b);}; \ No newline at end of file +var _0xec21=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','bluebird','aws-sdk','synthesizeSpeech','writeFile','AudioStream'];(function(_0x9a6891,_0x5e1eff){var _0x831b01=function(_0x9135a3){while(--_0x9135a3){_0x9a6891['push'](_0x9a6891['shift']());}};_0x831b01(++_0x5e1eff);}(_0xec21,0x15a));var _0x1ec2=function(_0x5452c9,_0xc7ea83){_0x5452c9=_0x5452c9-0x0;var _0x2ca4e1=_0xec21[_0x5452c9];return _0x2ca4e1;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x1ec2('0x0'));var rs=require('randomstring');var AWS=require(_0x1ec2('0x1'));function pollyResult(_0x341b76,_0x59a378,_0x42e45b){return new BPromise(function(_0x3f01a1,_0x196cd1){_0x341b76[_0x1ec2('0x2')](_0x59a378,function(_0x12bfd9,_0x536800){if(_0x12bfd9){_0x196cd1(_0x12bfd9);}else if(_0x536800){if(_0x536800['AudioStream']instanceof Buffer){fs[_0x1ec2('0x3')](_0x42e45b,_0x536800[_0x1ec2('0x4')],function(_0x554413){if(_0x554413){_0x196cd1(_0x554413);}else{_0x3f01a1();}});}else{_0x196cd1(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x196cd1(new Error(_0x1ec2('0x5')));}});});}module[_0x1ec2('0x6')]=function(_0x3b6764,_0x10ad5f,_0x453de9,_0x1750b8,_0x515e4e,_0x5e15dc,_0xb3df5){var _0x4b4346=new AWS[(_0x1ec2('0x7'))]({'accessKeyId':_0x3b6764,'secretAccessKey':_0x10ad5f,'region':_0x453de9});var _0x5bdabf={'Text':_0x515e4e,'TextType':_0x5e15dc||_0x1ec2('0x8'),'OutputFormat':'mp3','VoiceId':_0x1750b8};return pollyResult(_0x4b4346,_0x5bdabf,_0xb3df5);}; \ 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 24d3c66..851cd11 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x5ba7ad,_0x4323f9,_0x14ce99,_0x2f147f){return asr(_0x5ba7ad,_0x4323f9,_0x14ce99);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x172539,_0x2b64c0,_0x55c198,_0x5739cd){return asr(_0x172539,_0x2b64c0,_0x55c198);}; \ 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 146ce24..6e7cc5e 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 _0xf323=['length','filepath\x20should\x20be\x20a\x20string','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','https://speech.googleapis.com','exports'];(function(_0x1a7cab,_0x47ebc0){var _0x2f5424=function(_0x27a47c){while(--_0x27a47c){_0x1a7cab['push'](_0x1a7cab['shift']());}};_0x2f5424(++_0x47ebc0);}(_0xf323,0x1c6));var _0x3f32=function(_0x154754,_0x5e8ed8){_0x154754=_0x154754-0x0;var _0x3172e1=_0xf323[_0x154754];return _0x3172e1;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x3f32('0x0');module[_0x3f32('0x1')]=function(_0x5420ab,_0x455911,_0x1081c3){return new BPromise(function(_0x3d0d9f,_0x6b7a8d){var _0x319ba4;if(typeof _0x5420ab!=='string'||_0x5420ab[_0x3f32('0x2')]===0x0){return _0x6b7a8d(_0x3f32('0x3'));}if(typeof _0x455911!==_0x3f32('0x4')||_0x455911[_0x3f32('0x2')]===0x0){return _0x6b7a8d('key\x20should\x20be\x20a\x20string');}if(typeof _0x1081c3!=='undefined'&&(typeof _0x1081c3!==_0x3f32('0x4')||_0x1081c3[_0x3f32('0x2')]===0x0)){return _0x6b7a8d(_0x3f32('0x5'));}try{_0x319ba4=fs[_0x3f32('0x6')](_0x5420ab)[_0x3f32('0x7')](_0x3f32('0x8'));}catch(_0x228ac0){return _0x6b7a8d(_0x228ac0);}return _0x3d0d9f({'method':_0x3f32('0x9'),'uri':host+'/v1/speech:recognize?key='+_0x455911,'body':{'config':{'encoding':_0x3f32('0xa'),'sampleRateHertz':_0x3f32('0xb'),'languageCode':_0x1081c3},'audio':{'content':_0x319ba4}},'json':!![]});});}; \ No newline at end of file +var _0x750a=['/v1/speech:recognize?key=','bluebird','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST'];(function(_0x265878,_0xf640cf){var _0x26129c=function(_0x46285f){while(--_0x46285f){_0x265878['push'](_0x265878['shift']());}};_0x26129c(++_0xf640cf);}(_0x750a,0x140));var _0xa750=function(_0x59e703,_0x62b160){_0x59e703=_0x59e703-0x0;var _0x5e46c3=_0x750a[_0x59e703];return _0x5e46c3;};'use strict';var url=require('url');var BPromise=require(_0xa750('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x139fa5,_0xeb020d,_0x1b459c){return new BPromise(function(_0x19bd5f,_0x457cae){var _0x43d704;if(typeof _0x139fa5!==_0xa750('0x1')||_0x139fa5[_0xa750('0x2')]===0x0){return _0x457cae(_0xa750('0x3'));}if(typeof _0xeb020d!==_0xa750('0x1')||_0xeb020d[_0xa750('0x2')]===0x0){return _0x457cae(_0xa750('0x4'));}if(typeof _0x1b459c!==_0xa750('0x5')&&(typeof _0x1b459c!=='string'||_0x1b459c['length']===0x0)){return _0x457cae(_0xa750('0x6'));}try{_0x43d704=fs['readFileSync'](_0x139fa5)[_0xa750('0x7')](_0xa750('0x8'));}catch(_0x51f594){return _0x457cae(_0x51f594);}return _0x19bd5f({'method':_0xa750('0x9'),'uri':host+_0xa750('0xa')+_0xeb020d,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x1b459c},'audio':{'content':_0x43d704}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 10cb4be..6256c2b 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x5597=['./asr','exports'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x5597,0x13c));var _0x7559=function(_0x20627a,_0x274c37){_0x20627a=_0x20627a-0x0;var _0x4e7fb7=_0x5597[_0x20627a];return _0x4e7fb7;};var asr=require(_0x7559('0x0'));module[_0x7559('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 595563e..ea62267 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 _0xe8ab=['queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','CustomAction','channelData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish\x20download\x20file','close','unlink','pipe','host','data','end','transcode','error\x20convert','info','finish\x20to\x20convert','start','resolve','generate','writeFileSync','then','chmodSync','777','readFileSync','toString','base64','googleCloudTTS','?key=','ssml','input','voice','MP3','POST','tmp','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','split','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','textRequest','result','source','resolvedQuery','action','actionIncomplete','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath'];(function(_0x59b8ea,_0x311f9a){var _0x5c1c55=function(_0x5109ae){while(--_0x5109ae){_0x59b8ea['push'](_0x59b8ea['shift']());}};_0x5c1c55(++_0x311f9a);}(_0xe8ab,0x130));var _0xbe8a=function(_0x4d9bd4,_0x49f38b){_0x4d9bd4=_0x4d9bd4-0x0;var _0xf00bfd=_0xe8ab[_0x4d9bd4];return _0xf00bfd;};'use strict';var apiai=require(_0xbe8a('0x0'));var BPromise=require(_0xbe8a('0x1'));var dialogflow=require(_0xbe8a('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xbe8a('0x3'));var md5=require(_0xbe8a('0x4'));var path=require(_0xbe8a('0x5'));var querystring=require(_0xbe8a('0x6'));var rp=require(_0xbe8a('0x7'));var rs=require(_0xbe8a('0x8'));var sox=require(_0xbe8a('0x9'));var tts=require(_0xbe8a('0xa'));var urlParse=require(_0xbe8a('0xb'))[_0xbe8a('0xc')];var util=require('util');var aws=require('./aws');var google=require(_0xbe8a('0xd'));var sestek=require(_0xbe8a('0xe'));var tilde=require(_0xbe8a('0xf'));var logger=require(_0xbe8a('0x10'))('agi');var ISPEECH_API=_0xbe8a('0x11');function downloadFile(_0x1ffe84,_0x41070a){return new BPromise(function(_0x1e435e,_0x241acf){var _0x232b2f=urlParse(_0x1ffe84);var _0x390b44=_0x232b2f[_0xbe8a('0x12')]===_0xbe8a('0x13')?https:http;var _0x4477c2={'host':_0x232b2f['host'],'path':_0x232b2f[_0xbe8a('0x5')],'headers':{'user-agent':_0xbe8a('0x14')}};_0x390b44[_0xbe8a('0x15')](_0x4477c2,function(_0x451efa){if(_0x451efa[_0xbe8a('0x16')]!==0xc8){logger[_0xbe8a('0x17')]('request\x20to\x20'+_0x1ffe84+_0xbe8a('0x18')+_0x451efa[_0xbe8a('0x16')]+'\x20('+_0x451efa[_0xbe8a('0x19')]+')');_0x241acf(new Error(_0xbe8a('0x1a')+_0x1ffe84+_0xbe8a('0x18')+_0x451efa[_0xbe8a('0x16')]+'\x20('+_0x451efa[_0xbe8a('0x19')]+')'));return;}var _0xc19095=fs[_0xbe8a('0x1b')](_0x41070a);_0xc19095['on']('finish',function(){logger['info'](_0xbe8a('0x1c'));_0xc19095[_0xbe8a('0x1d')](_0x1e435e);});_0xc19095['on'](_0xbe8a('0x17'),function(_0x501378){fs[_0xbe8a('0x1e')](_0x41070a);logger[_0xbe8a('0x17')]('download\x20error',_0x501378);_0x241acf(_0x501378);});_0x451efa[_0xbe8a('0x1f')](_0xc19095);})['on'](_0xbe8a('0x17'),function(_0x507cc9){logger[_0xbe8a('0x17')](_0x507cc9);_0x241acf(_0x507cc9);})['end']();});}function uploadFile(_0x559472){return new BPromise(function(_0x4a1f93,_0x495306){var _0x1904ba=urlParse(_0x559472);var _0x578f11=_0x1904ba[_0xbe8a('0x12')]==='https:'?https:http;var _0x66ad7b={'host':_0x1904ba[_0xbe8a('0x20')],'path':_0x1904ba['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x578f11['get'](_0x66ad7b,function(_0xd500e7){if(_0xd500e7[_0xbe8a('0x16')]!==0xc8){_0x495306(new Error(_0xbe8a('0x1a')+_0x559472+_0xbe8a('0x18')+_0xd500e7['statusCode']+'\x20('+_0xd500e7[_0xbe8a('0x19')]+')'));return;}var _0x30e4c5='';_0xd500e7['on'](_0xbe8a('0x21'),function(_0x2777fd){_0x30e4c5+=_0x2777fd;});_0xd500e7['on'](_0xbe8a('0x22'),function(){_0x4a1f93(_0x30e4c5);});})['on'](_0xbe8a('0x17'),function(_0x469fd8){_0x495306(_0x469fd8);})[_0xbe8a('0x22')]();});}function convertFile(_0x43a6bd,_0x22e48f){return new BPromise(function(_0x3aff83,_0x183005){var _0x205f4f=sox[_0xbe8a('0x23')](_0x43a6bd,_0x22e48f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x205f4f['on']('error',function(_0x323621){logger['error'](_0xbe8a('0x24'),_0x323621);_0x183005(_0x323621);});_0x205f4f['on'](_0xbe8a('0x22'),function(){logger[_0xbe8a('0x25')](_0xbe8a('0x26'));_0x3aff83();});_0x205f4f[_0xbe8a('0x27')]();});}function base64Decode(_0x560338,_0x15a4d3){var _0xab6351=path[_0xbe8a('0x28')](__dirname,'tmp',rs[_0xbe8a('0x29')](0x4)+'.wav');fs[_0xbe8a('0x2a')](_0xab6351,_0x560338,'base64');return convertFile(_0xab6351,_0x15a4d3)[_0xbe8a('0x2b')](function(){try{fs[_0xbe8a('0x1e')](_0xab6351);fs[_0xbe8a('0x2c')](_0x15a4d3,_0xbe8a('0x2d'));}catch(_0x20d668){logger[_0xbe8a('0x17')](_0x20d668);}return _0x15a4d3['split']('.')[0x0];});}function base64Encode(_0x4a604a){var _0x127a1a=fs[_0xbe8a('0x2e')](_0x4a604a);return new Buffer(_0x127a1a)[_0xbe8a('0x2f')](_0xbe8a('0x30'));}exports[_0xbe8a('0x31')]=function(_0x148125,_0x267690,_0xf58bd7,_0x50b365,_0x1b6789,_0x4e3749){var _0x44b46e,_0x180d94;var _0x13f327='https://texttospeech.googleapis.com/v1/';var _0x1ed05c=_0xbe8a('0x32')+_0x148125;var _0xd15a38={};if(_0x267690===_0xbe8a('0x33')){_0xd15a38[_0xbe8a('0x34')]={'ssml':_0xf58bd7};}else{_0xd15a38[_0xbe8a('0x34')]={'text':_0xf58bd7};};_0xd15a38[_0xbe8a('0x35')]={'languageCode':_0x50b365,'ssmlGender':_0x1b6789};_0xd15a38['audioConfig']={'audioEncoding':_0xbe8a('0x36'),'sampleRateHertz':0x1f40};var _0x3ae449={'url':_0x13f327+'text:synthesize'+_0x1ed05c,'method':_0xbe8a('0x37'),'json':!![],'body':_0xd15a38};return rp(_0x3ae449)[_0xbe8a('0x2b')](function(_0x6cd5c){return new BPromise(function(_0x180a71,_0x4616f4){_0x44b46e=path[_0xbe8a('0x28')](__dirname,_0xbe8a('0x38'),rs[_0xbe8a('0x29')](0x4)+_0xbe8a('0x39'));var _0x346f1d=Buffer[_0xbe8a('0x3a')](_0x6cd5c[_0xbe8a('0x3b')],_0xbe8a('0x30'));return fs[_0xbe8a('0x3c')](_0x44b46e,_0x346f1d,function(_0x5b1377){_0x4616f4(_0x5b1377);},function(_0x327b3e){fs['chmodSync'](_0x44b46e,_0xbe8a('0x2d'));_0x180a71(_0x327b3e);});});})['then'](function(_0x2dd418){_0x180d94=path['resolve'](__dirname,'tmp',rs[_0xbe8a('0x29')](0x4)+_0xbe8a('0x3d'));return convertFile(_0x44b46e,_0x180d94);})[_0xbe8a('0x2b')](function(){try{fs[_0xbe8a('0x1e')](_0x44b46e);fs[_0xbe8a('0x2c')](_0x180d94,_0xbe8a('0x2d'));}catch(_0x2871a9){logger[_0xbe8a('0x17')](_0x2871a9);}logger[_0xbe8a('0x25')](_0xbe8a('0x3e'),_0x180d94[_0xbe8a('0x3f')]('.')[0x0]);return _0x180d94['split']('.')[0x0];});};exports[_0xbe8a('0x40')]=function(_0x2d04a5,_0x1316a8){var _0x9cb7f2='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x500d4a,_0x23c0c4;var _0x46e979;var _0x1a314c={'encoding':_0xbe8a('0x41'),'method':_0xbe8a('0x37'),'timeout':0x2710,'url':_0x9cb7f2,'headers':{'Content-Type':_0xbe8a('0x42')},'body':_0xbe8a('0x43')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0xbe8a('0x44')]([_0x2d04a5,_0x1316a8||'en',![],_0xbe8a('0x45')]),null,_0xbe8a('0x46')]]]))};return rp(_0x1a314c)[_0xbe8a('0x2b')](function(_0x14f7f4){try{_0x46e979=eval(_0x14f7f4['slice'](0x5))[0x0][0x2];}catch(_0x187bf3){throw new Error(_0xbe8a('0x47')+_0x14f7f4[_0xbe8a('0x21')]);}if(!_0x46e979){if(_0x2d04a5['length']>0xc8){throw new Error(_0xbe8a('0x48'));}else{throw new Error(_0xbe8a('0x49')+_0x1316a8+'\x22\x20might\x20not\x20exist');}}try{_0x46e979=eval(_0x46e979)[0x0];}catch(_0x4e04de){throw new Error(_0xbe8a('0x47')+res[_0xbe8a('0x21')]);}const _0x3abd4f=_0x46e979;_0x500d4a=path[_0xbe8a('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0xbe8a('0x39'));fs[_0xbe8a('0x2a')](_0x500d4a,_0x46e979,{'encoding':_0xbe8a('0x30')});_0x23c0c4=path[_0xbe8a('0x28')](__dirname,_0xbe8a('0x38'),rs[_0xbe8a('0x29')](0x4)+_0xbe8a('0x3d'));return convertFile(_0x500d4a,_0x23c0c4);})['then'](function(){try{fs[_0xbe8a('0x1e')](_0x500d4a);fs[_0xbe8a('0x2c')](_0x23c0c4,_0xbe8a('0x2d'));}catch(_0x43c5c3){logger[_0xbe8a('0x17')](_0x43c5c3);}logger['info']('goggleTTS\x20path',_0x23c0c4[_0xbe8a('0x3f')]('.')[0x0]);return _0x23c0c4[_0xbe8a('0x3f')]('.')[0x0];});};exports[_0xbe8a('0x4a')]=function(_0x44213e,_0x275090,_0x35b2fe){return google['asr'](_0x44213e,_0x275090,_0x35b2fe)[_0xbe8a('0x2b')](function(_0x402bbf){logger['info'](_0x402bbf[_0xbe8a('0x4b')]);return rp(_0x402bbf);})[_0xbe8a('0x2b')](function(_0x49d5db){var _0x1af059='';var _0x3e0206=0x0;try{fs['unlink'](_0x44213e);}catch(_0x2eb053){logger[_0xbe8a('0x17')](_0x2eb053);}if(_0x49d5db&&_0x49d5db[_0xbe8a('0x4c')]){_0x1af059=_0x49d5db[_0xbe8a('0x4c')][_0xbe8a('0x4d')](function(_0x590f59){return _0x590f59&&_0x590f59[_0xbe8a('0x4e')][0x0]&&_0x590f59[_0xbe8a('0x4e')][0x0][_0xbe8a('0x4f')]?_0x590f59['alternatives'][0x0][_0xbe8a('0x4f')]:'';})[_0xbe8a('0x50')]('\x0a');_0x3e0206=_0x49d5db['results'][_0xbe8a('0x4d')](function(_0x2f8ee8){return _0x2f8ee8&&_0x2f8ee8[_0xbe8a('0x4e')][0x0]&&_0x2f8ee8[_0xbe8a('0x4e')][0x0][_0xbe8a('0x51')]?_0x2f8ee8['alternatives'][0x0]['confidence']:0x0;})[_0xbe8a('0x50')]('\x0a');}logger['info'](_0xbe8a('0x52'),_0x1af059);logger[_0xbe8a('0x25')](_0xbe8a('0x53'),_0x3e0206);return{'transcript':_0x1af059,'confidence':_0x3e0206};})['catch'](function(_0x4ce28e){logger[_0xbe8a('0x17')](_0xbe8a('0x54'),_0x4ce28e[_0xbe8a('0x16')],_0x4ce28e[_0xbe8a('0x55')],_0x4ce28e['message']);});};exports['googleDialogflow']=function(_0x4caa68,_0x53a986,_0xd190d8,_0x4931bc){var _0x45704b=apiai(_0x53a986,{'language':_0x4931bc||'en'});return _0x45704b[_0xbe8a('0x56')](_0xd190d8,{'sessionId':md5(_0x4caa68)})[_0xbe8a('0x2b')](function(_0x40d458){logger[_0xbe8a('0x25')](JSON['stringify'](_0x40d458));return{'source':_0x40d458[_0xbe8a('0x57')][_0xbe8a('0x58')],'resolvedQuery':_0x40d458[_0xbe8a('0x57')][_0xbe8a('0x59')],'action':_0x40d458[_0xbe8a('0x57')][_0xbe8a('0x5a')],'actionIncomplete':_0x40d458[_0xbe8a('0x57')][_0xbe8a('0x5b')],'speech':_0x40d458[_0xbe8a('0x57')]['fulfillment'][_0xbe8a('0x5c')],'score':_0x40d458[_0xbe8a('0x57')]['score'],'statusCode':_0x40d458[_0xbe8a('0x5d')][_0xbe8a('0x5e')],'endConversation':_0x40d458[_0xbe8a('0x57')][_0xbe8a('0x5f')][_0xbe8a('0x60')]||![],'isFallbackIntent':_0x40d458['result']['metadata'][_0xbe8a('0x61')]};});};exports[_0xbe8a('0x62')]=function(_0x4a4229,_0x1210b1,_0x51080a,_0xc55b3f,_0xdb2786,_0x41d86e){var _0x497b35=_0xc55b3f['replace'](/\\n/g,'\x0a');var _0x209456={'credentials':{'private_key':_0x497b35,'client_email':_0x51080a}};var _0x22757f=new dialogflow[(_0xbe8a('0x63'))](_0x209456);var _0x558f8a=_0x22757f[_0xbe8a('0x64')](_0x1210b1,md5(_0x4a4229));var _0x43c17d={'session':_0x558f8a,'queryInput':{'text':{'text':_0xdb2786,'languageCode':_0x41d86e}}};return _0x22757f['detectIntent'](_0x43c17d)['then'](function(_0x534170){if(_0x534170&&_0x534170['length']){logger[_0xbe8a('0x25')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x534170));var _0x51f301=_0x534170[0x0];if(_0x51f301){var _0xfda4bd={'action':_0x51f301[_0xbe8a('0x65')][_0xbe8a('0x5a')],'allRequiredParamsPresent':_0x51f301['queryResult'][_0xbe8a('0x66')],'endConversation':_0x51f301[_0xbe8a('0x65')][_0xbe8a('0x67')]&&_0x51f301[_0xbe8a('0x65')][_0xbe8a('0x67')][_0xbe8a('0x68')]?_0x51f301['queryResult'][_0xbe8a('0x67')][_0xbe8a('0x68')]['end_conversation'][_0xbe8a('0x69')]:![],'fulfillmentText':_0x51f301[_0xbe8a('0x65')][_0xbe8a('0x6a')],'intentName':_0x51f301[_0xbe8a('0x65')]['intent'][_0xbe8a('0x55')],'intentDisplayName':_0x51f301[_0xbe8a('0x65')][_0xbe8a('0x6b')][_0xbe8a('0x6c')],'isFallbackIntent':_0x51f301[_0xbe8a('0x65')][_0xbe8a('0x6b')]['isFallback'],'languageCode':_0x51f301[_0xbe8a('0x65')][_0xbe8a('0x6d')],'queryText':_0x51f301['queryResult'][_0xbe8a('0x6e')],'responseId':_0x51f301[_0xbe8a('0x6f')],'score':_0x51f301['queryResult'][_0xbe8a('0x70')],'speech':_0x51f301[_0xbe8a('0x65')][_0xbe8a('0x6a')],'providerResponse':JSON[_0xbe8a('0x44')](_0x534170)};return _0xfda4bd;}}});};exports[_0xbe8a('0x71')]=function(_0x585329,_0x2cecb5,_0x464587,_0x3d399a){return tilde[_0xbe8a('0x72')](_0x585329,_0x2cecb5,_0x464587,_0x3d399a)[_0xbe8a('0x2b')](function(_0x34de98){try{fs[_0xbe8a('0x1e')](_0x585329);}catch(_0x338658){logger['error'](_0x338658);}logger[_0xbe8a('0x25')]('Tilde\x20ASR\x20transcription',_0x34de98[_0xbe8a('0x4f')]);logger[_0xbe8a('0x25')](_0xbe8a('0x73'),_0x34de98[_0xbe8a('0x51')]);return _0x34de98;});};exports[_0xbe8a('0x74')]=function(_0x40fb30,_0x1f548c,_0x56a657,_0x28cf15,_0x37518a,_0x83ea16){var _0x47b3d6=path[_0xbe8a('0x28')](__dirname,'tmp',rs[_0xbe8a('0x29')](0x4)+_0xbe8a('0x39'));var _0x44674b;return aws[_0xbe8a('0x75')](_0x40fb30,_0x1f548c,_0x56a657,_0x28cf15,_0x37518a,_0x83ea16,_0x47b3d6)['then'](function(){_0x44674b=path[_0xbe8a('0x28')](__dirname,_0xbe8a('0x38'),rs[_0xbe8a('0x29')](0x4)+'.wav');return convertFile(_0x47b3d6,_0x44674b);})['then'](function(){try{fs[_0xbe8a('0x1e')](_0x47b3d6);fs[_0xbe8a('0x2c')](_0x44674b,_0xbe8a('0x2d'));}catch(_0x1f8ad1){logger[_0xbe8a('0x17')](_0x1f8ad1);}return _0x44674b[_0xbe8a('0x3f')]('.')[0x0];});};exports[_0xbe8a('0x76')]=function(_0x4f41f6,_0x473afa,_0x1cffda,_0x18067e,_0xaa1b18,_0xfaf6a6){return aws[_0xbe8a('0x77')](_0x4f41f6,_0x473afa,_0x1cffda,_0x18067e,_0xaa1b18,_0xfaf6a6)[_0xbe8a('0x2b')](function(_0x4c6638){logger[_0xbe8a('0x25')](JSON[_0xbe8a('0x44')](_0x4c6638));return _0x4c6638;});};exports[_0xbe8a('0x78')]=function(_0x3fbc28,_0x59f0c2,_0x542beb,_0x249459){var _0x5edbe2=util[_0xbe8a('0x79')](_0xbe8a('0x7a'),ISPEECH_API,_0x3fbc28,encodeURIComponent(_0x59f0c2),_0x542beb,_0x249459);var _0x46010e=path[_0xbe8a('0x28')](__dirname,_0xbe8a('0x38'),rs['generate'](0x4)+_0xbe8a('0x39'));var _0x3d3152;return downloadFile(_0x5edbe2,_0x46010e)[_0xbe8a('0x2b')](function(){_0x3d3152=path[_0xbe8a('0x28')](__dirname,_0xbe8a('0x38'),rs[_0xbe8a('0x29')](0x4)+_0xbe8a('0x3d'));return convertFile(_0x46010e,_0x3d3152);})[_0xbe8a('0x2b')](function(){try{fs[_0xbe8a('0x1e')](_0x46010e);fs['chmodSync'](_0x3d3152,_0xbe8a('0x2d'));}catch(_0x452fb3){logger[_0xbe8a('0x17')](_0x452fb3);}return _0x3d3152[_0xbe8a('0x3f')]('.')[0x0];});};exports[_0xbe8a('0x7b')]=function(_0x2f0dec,_0x12958b,_0x1b0cfe,_0x4562e0){var _0x4e65fc=util['format'](_0xbe8a('0x7c'),ISPEECH_API,_0x12958b,_0x1b0cfe,base64Encode(_0x2f0dec),_0x4562e0?util[_0xbe8a('0x79')](_0xbe8a('0x7d'),encodeURIComponent(_0x4562e0)):_0xbe8a('0x7e'));return uploadFile(_0x4e65fc)[_0xbe8a('0x2b')](function(_0x4d5ee6){return querystring['parse'](_0x4d5ee6);});};exports[_0xbe8a('0x7f')]=function(_0x3cf7a0,_0x15b85d){return sestek[_0xbe8a('0x80')](_0x3cf7a0,_0x15b85d)[_0xbe8a('0x2b')](function(_0x4bb31f){logger[_0xbe8a('0x25')](JSON[_0xbe8a('0x44')](_0x4bb31f));var _0x14c8a8={'speech':_0x4bb31f[_0xbe8a('0x81')],'action':_0x4bb31f['channelData']?_0x4bb31f['channelData'][_0xbe8a('0x82')]:undefined,'actiondata':_0x4bb31f['channelData']?_0x4bb31f[_0xbe8a('0x83')]['CustomActionData']:undefined};if(_0x4bb31f['channelData']&&_0x4bb31f['channelData'][_0xbe8a('0x84')]){return base64Decode(_0x4bb31f[_0xbe8a('0x83')]['AudioFromTts']['Data'],path[_0xbe8a('0x28')](__dirname,'tmp',rs[_0xbe8a('0x29')](0x4)+_0xbe8a('0x3d')))[_0xbe8a('0x2b')](function(_0x171d47){_0x14c8a8[_0xbe8a('0x85')]=_0x171d47;return _0x14c8a8;});}return _0x14c8a8;});};exports[_0xbe8a('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0xd115=['https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','status','code','endConversation','metadata','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','pipe','end','https:','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','POST','then','generate','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','googleTTS'];(function(_0x12864b,_0x4ddfee){var _0x44ee99=function(_0xe90ce9){while(--_0xe90ce9){_0x12864b['push'](_0x12864b['shift']());}};_0x44ee99(++_0x4ddfee);}(_0xd115,0x165));var _0x5d11=function(_0x1d979a,_0x3f06db){_0x1d979a=_0x1d979a-0x0;var _0x4bd2e7=_0xd115[_0x1d979a];return _0x4bd2e7;};'use strict';var apiai=require(_0x5d11('0x0'));var BPromise=require(_0x5d11('0x1'));var dialogflow=require(_0x5d11('0x2'));var fs=require('fs');var http=require(_0x5d11('0x3'));var https=require(_0x5d11('0x4'));var md5=require(_0x5d11('0x5'));var path=require(_0x5d11('0x6'));var querystring=require(_0x5d11('0x7'));var rp=require(_0x5d11('0x8'));var rs=require(_0x5d11('0x9'));var sox=require(_0x5d11('0xa'));var tts=require(_0x5d11('0xb'));var urlParse=require(_0x5d11('0xc'))[_0x5d11('0xd')];var util=require(_0x5d11('0xe'));var aws=require(_0x5d11('0xf'));var google=require(_0x5d11('0x10'));var sestek=require(_0x5d11('0x11'));var tilde=require(_0x5d11('0x12'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x5d11('0x13');function downloadFile(_0x1c1472,_0x1ff014){return new BPromise(function(_0x5760a4,_0x25dda5){var _0x44cff0=urlParse(_0x1c1472);var _0x1fa27e=_0x44cff0[_0x5d11('0x14')]==='https:'?https:http;var _0x27bec4={'host':_0x44cff0[_0x5d11('0x15')],'path':_0x44cff0['path'],'headers':{'user-agent':_0x5d11('0x16')}};_0x1fa27e[_0x5d11('0x17')](_0x27bec4,function(_0x2d91cd){if(_0x2d91cd[_0x5d11('0x18')]!==0xc8){logger[_0x5d11('0x19')](_0x5d11('0x1a')+_0x1c1472+_0x5d11('0x1b')+_0x2d91cd[_0x5d11('0x18')]+'\x20('+_0x2d91cd[_0x5d11('0x1c')]+')');_0x25dda5(new Error(_0x5d11('0x1a')+_0x1c1472+_0x5d11('0x1b')+_0x2d91cd[_0x5d11('0x18')]+'\x20('+_0x2d91cd['statusMessage']+')'));return;}var _0x30afbb=fs[_0x5d11('0x1d')](_0x1ff014);_0x30afbb['on']('finish',function(){logger[_0x5d11('0x1e')](_0x5d11('0x1f'));_0x30afbb[_0x5d11('0x20')](_0x5760a4);});_0x30afbb['on'](_0x5d11('0x19'),function(_0x417404){fs[_0x5d11('0x21')](_0x1ff014);logger[_0x5d11('0x19')]('download\x20error',_0x417404);_0x25dda5(_0x417404);});_0x2d91cd[_0x5d11('0x22')](_0x30afbb);})['on'](_0x5d11('0x19'),function(_0x1fa8f4){logger[_0x5d11('0x19')](_0x1fa8f4);_0x25dda5(_0x1fa8f4);})[_0x5d11('0x23')]();});}function uploadFile(_0x472c75){return new BPromise(function(_0x29d8ed,_0x2af65c){var _0x19f070=urlParse(_0x472c75);var _0x3b3a7e=_0x19f070[_0x5d11('0x14')]===_0x5d11('0x24')?https:http;var _0x3af115={'host':_0x19f070[_0x5d11('0x15')],'path':_0x19f070[_0x5d11('0x6')],'headers':{'user-agent':_0x5d11('0x16')}};_0x3b3a7e[_0x5d11('0x17')](_0x3af115,function(_0x2d3042){if(_0x2d3042[_0x5d11('0x18')]!==0xc8){_0x2af65c(new Error(_0x5d11('0x1a')+_0x472c75+'\x20failed,\x20status\x20code\x20=\x20'+_0x2d3042['statusCode']+'\x20('+_0x2d3042[_0x5d11('0x1c')]+')'));return;}var _0x1f7005='';_0x2d3042['on'](_0x5d11('0x25'),function(_0x2d8a6b){_0x1f7005+=_0x2d8a6b;});_0x2d3042['on'](_0x5d11('0x23'),function(){_0x29d8ed(_0x1f7005);});})['on'](_0x5d11('0x19'),function(_0x2f121f){_0x2af65c(_0x2f121f);})[_0x5d11('0x23')]();});}function convertFile(_0x238a74,_0x7e77d5){return new BPromise(function(_0x14a259,_0x609016){var _0x385493=sox[_0x5d11('0x26')](_0x238a74,_0x7e77d5,{'sampleRate':0x1f40,'format':_0x5d11('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x385493['on'](_0x5d11('0x19'),function(_0x304816){logger[_0x5d11('0x19')](_0x5d11('0x28'),_0x304816);_0x609016(_0x304816);});_0x385493['on']('end',function(){logger[_0x5d11('0x1e')](_0x5d11('0x29'));_0x14a259();});_0x385493['start']();});}function base64Decode(_0x16f726,_0x55be44){var _0x58d1f2=path[_0x5d11('0x2a')](__dirname,_0x5d11('0x2b'),rs['generate'](0x4)+'.wav');fs[_0x5d11('0x2c')](_0x58d1f2,_0x16f726,_0x5d11('0x2d'));return convertFile(_0x58d1f2,_0x55be44)['then'](function(){try{fs[_0x5d11('0x21')](_0x58d1f2);fs[_0x5d11('0x2e')](_0x55be44,_0x5d11('0x2f'));}catch(_0x112966){logger[_0x5d11('0x19')](_0x112966);}return _0x55be44[_0x5d11('0x30')]('.')[0x0];});}function base64Encode(_0x262e02){var _0x49845f=fs[_0x5d11('0x31')](_0x262e02);return new Buffer(_0x49845f)[_0x5d11('0x32')]('base64');}exports['googleCloudTTS']=function(_0x2ea7d1,_0x5e4bed,_0x15271e,_0x23fa97,_0x5b0e82,_0xd770f6){var _0x504255,_0x1c0c27;var _0x272d6b=_0x5d11('0x33');var _0x54736c=_0x5d11('0x34')+_0x2ea7d1;var _0x4f50ae={};if(_0x5e4bed==='ssml'){_0x4f50ae[_0x5d11('0x35')]={'ssml':_0x15271e};}else{_0x4f50ae[_0x5d11('0x35')]={'text':_0x15271e};};_0x4f50ae['voice']={'languageCode':_0x23fa97,'ssmlGender':_0x5b0e82};_0x4f50ae[_0x5d11('0x36')]={'audioEncoding':_0x5d11('0x37'),'sampleRateHertz':0x1f40};var _0x1c3feb={'url':_0x272d6b+'text:synthesize'+_0x54736c,'method':_0x5d11('0x38'),'json':!![],'body':_0x4f50ae};return rp(_0x1c3feb)[_0x5d11('0x39')](function(_0x5f068c){return new BPromise(function(_0x145f16,_0x54ebd6){_0x504255=path[_0x5d11('0x2a')](__dirname,'tmp',rs[_0x5d11('0x3a')](0x4)+_0x5d11('0x3b'));var _0x1fbd1e=Buffer[_0x5d11('0x3c')](_0x5f068c[_0x5d11('0x3d')],_0x5d11('0x2d'));return fs[_0x5d11('0x3e')](_0x504255,_0x1fbd1e,function(_0x43415a){_0x54ebd6(_0x43415a);},function(_0x29fa3e){fs[_0x5d11('0x2e')](_0x504255,_0x5d11('0x2f'));_0x145f16(_0x29fa3e);});});})['then'](function(_0x478f48){_0x1c0c27=path[_0x5d11('0x2a')](__dirname,_0x5d11('0x2b'),rs[_0x5d11('0x3a')](0x4)+_0x5d11('0x3f'));return convertFile(_0x504255,_0x1c0c27);})[_0x5d11('0x39')](function(){try{fs[_0x5d11('0x21')](_0x504255);fs[_0x5d11('0x2e')](_0x1c0c27,_0x5d11('0x2f'));}catch(_0xab4495){logger['error'](_0xab4495);}logger[_0x5d11('0x1e')](_0x5d11('0x40'),_0x1c0c27[_0x5d11('0x30')]('.')[0x0]);return _0x1c0c27['split']('.')[0x0];});};exports[_0x5d11('0x41')]=function(_0x59c941,_0x4c11e6){var _0x56a288=_0x5d11('0x42');var _0x3b9fe9,_0x6c07b2;var _0x216014;var _0x148cdc={'encoding':_0x5d11('0x43'),'method':_0x5d11('0x38'),'timeout':0x2710,'url':_0x56a288,'headers':{'Content-Type':_0x5d11('0x44')},'body':_0x5d11('0x45')+encodeURIComponent(JSON[_0x5d11('0x46')]([[[_0x5d11('0x47'),JSON[_0x5d11('0x46')]([_0x59c941,_0x4c11e6||'en',![],'null']),null,'generic']]]))};return rp(_0x148cdc)[_0x5d11('0x39')](function(_0x24af58){try{_0x216014=eval(_0x24af58[_0x5d11('0x48')](0x5))[0x0][0x2];}catch(_0xd78058){throw new Error(_0x5d11('0x49')+_0x24af58[_0x5d11('0x25')]);}if(!_0x216014){if(_0x59c941[_0x5d11('0x4a')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x5d11('0x4b')+_0x4c11e6+_0x5d11('0x4c'));}}try{_0x216014=eval(_0x216014)[0x0];}catch(_0x3b888b){throw new Error(_0x5d11('0x49')+res[_0x5d11('0x25')]);}const _0x36df14=_0x216014;_0x3b9fe9=path[_0x5d11('0x2a')](__dirname,_0x5d11('0x2b'),rs[_0x5d11('0x3a')](0x4)+_0x5d11('0x3b'));fs[_0x5d11('0x2c')](_0x3b9fe9,_0x216014,{'encoding':_0x5d11('0x2d')});_0x6c07b2=path[_0x5d11('0x2a')](__dirname,_0x5d11('0x2b'),rs[_0x5d11('0x3a')](0x4)+_0x5d11('0x3f'));return convertFile(_0x3b9fe9,_0x6c07b2);})[_0x5d11('0x39')](function(){try{fs[_0x5d11('0x21')](_0x3b9fe9);fs[_0x5d11('0x2e')](_0x6c07b2,'777');}catch(_0x50d8ab){logger[_0x5d11('0x19')](_0x50d8ab);}logger[_0x5d11('0x1e')](_0x5d11('0x4d'),_0x6c07b2[_0x5d11('0x30')]('.')[0x0]);return _0x6c07b2[_0x5d11('0x30')]('.')[0x0];});};exports['googleASR']=function(_0x4d251b,_0x3db448,_0x578c6b){return google[_0x5d11('0x4e')](_0x4d251b,_0x3db448,_0x578c6b)[_0x5d11('0x39')](function(_0x58fd5d){logger[_0x5d11('0x1e')](_0x58fd5d[_0x5d11('0x4f')]);return rp(_0x58fd5d);})[_0x5d11('0x39')](function(_0x938f71){var _0x6d056c='';var _0x25c1e5=0x0;try{fs[_0x5d11('0x21')](_0x4d251b);}catch(_0x125bd3){logger['error'](_0x125bd3);}if(_0x938f71&&_0x938f71[_0x5d11('0x50')]){_0x6d056c=_0x938f71[_0x5d11('0x50')][_0x5d11('0x51')](function(_0x31389d){return _0x31389d&&_0x31389d[_0x5d11('0x52')][0x0]&&_0x31389d['alternatives'][0x0][_0x5d11('0x53')]?_0x31389d[_0x5d11('0x52')][0x0][_0x5d11('0x53')]:'';})[_0x5d11('0x54')]('\x0a');_0x25c1e5=_0x938f71[_0x5d11('0x50')]['map'](function(_0x154e65){return _0x154e65&&_0x154e65[_0x5d11('0x52')][0x0]&&_0x154e65['alternatives'][0x0][_0x5d11('0x55')]?_0x154e65[_0x5d11('0x52')][0x0][_0x5d11('0x55')]:0x0;})[_0x5d11('0x54')]('\x0a');}logger[_0x5d11('0x1e')](_0x5d11('0x56'),_0x6d056c);logger[_0x5d11('0x1e')]('googleASR\x20confidence',_0x25c1e5);return{'transcript':_0x6d056c,'confidence':_0x25c1e5};})['catch'](function(_0x5bd514){logger['error'](_0x5d11('0x57'),_0x5bd514[_0x5d11('0x18')],_0x5bd514[_0x5d11('0x58')],_0x5bd514[_0x5d11('0x59')]);});};exports[_0x5d11('0x5a')]=function(_0xc45bd4,_0x2d52ad,_0x10eabc,_0x4b93d8){var _0x22a2da=apiai(_0x2d52ad,{'language':_0x4b93d8||'en'});return _0x22a2da[_0x5d11('0x5b')](_0x10eabc,{'sessionId':md5(_0xc45bd4)})[_0x5d11('0x39')](function(_0x2eb096){logger['info'](JSON[_0x5d11('0x46')](_0x2eb096));return{'source':_0x2eb096[_0x5d11('0x5c')][_0x5d11('0x5d')],'resolvedQuery':_0x2eb096['result'][_0x5d11('0x5e')],'action':_0x2eb096[_0x5d11('0x5c')]['action'],'actionIncomplete':_0x2eb096['result'][_0x5d11('0x5f')],'speech':_0x2eb096[_0x5d11('0x5c')][_0x5d11('0x60')][_0x5d11('0x61')],'score':_0x2eb096[_0x5d11('0x5c')]['score'],'statusCode':_0x2eb096[_0x5d11('0x62')][_0x5d11('0x63')],'endConversation':_0x2eb096['result']['metadata'][_0x5d11('0x64')]||![],'isFallbackIntent':_0x2eb096[_0x5d11('0x5c')][_0x5d11('0x65')]['isFallbackIntent']};});};exports[_0x5d11('0x66')]=function(_0x312270,_0x31af63,_0x1c7c5e,_0x39fdcf,_0x5dd102,_0x4f4a75){var _0x205fe4=_0x39fdcf[_0x5d11('0x67')](/\\n/g,'\x0a');var _0x454882={'credentials':{'private_key':_0x205fe4,'client_email':_0x1c7c5e}};var _0x5c478d=new dialogflow[(_0x5d11('0x68'))](_0x454882);var _0x3cdb44=_0x5c478d[_0x5d11('0x69')](_0x31af63,md5(_0x312270));var _0x3e75fb={'session':_0x3cdb44,'queryInput':{'text':{'text':_0x5dd102,'languageCode':_0x4f4a75}}};return _0x5c478d['detectIntent'](_0x3e75fb)[_0x5d11('0x39')](function(_0xa8dd7e){if(_0xa8dd7e&&_0xa8dd7e[_0x5d11('0x4a')]){logger[_0x5d11('0x1e')](_0x5d11('0x6a'),JSON[_0x5d11('0x46')](_0xa8dd7e));var _0xc2865e=_0xa8dd7e[0x0];if(_0xc2865e){var _0x3f04d5={'action':_0xc2865e[_0x5d11('0x6b')][_0x5d11('0x6c')],'allRequiredParamsPresent':_0xc2865e[_0x5d11('0x6b')][_0x5d11('0x6d')],'endConversation':_0xc2865e[_0x5d11('0x6b')][_0x5d11('0x6e')]&&_0xc2865e['queryResult'][_0x5d11('0x6e')][_0x5d11('0x6f')]?_0xc2865e[_0x5d11('0x6b')][_0x5d11('0x6e')][_0x5d11('0x6f')][_0x5d11('0x70')][_0x5d11('0x71')]:![],'fulfillmentText':_0xc2865e[_0x5d11('0x6b')][_0x5d11('0x72')],'intentName':_0xc2865e[_0x5d11('0x6b')][_0x5d11('0x73')]['name'],'intentDisplayName':_0xc2865e[_0x5d11('0x6b')][_0x5d11('0x73')][_0x5d11('0x74')],'isFallbackIntent':_0xc2865e['queryResult'][_0x5d11('0x73')]['isFallback'],'languageCode':_0xc2865e[_0x5d11('0x6b')][_0x5d11('0x75')],'queryText':_0xc2865e[_0x5d11('0x6b')]['queryText'],'responseId':_0xc2865e[_0x5d11('0x76')],'score':_0xc2865e[_0x5d11('0x6b')][_0x5d11('0x77')],'speech':_0xc2865e[_0x5d11('0x6b')][_0x5d11('0x72')],'providerResponse':JSON[_0x5d11('0x46')](_0xa8dd7e)};return _0x3f04d5;}}});};exports[_0x5d11('0x78')]=function(_0x2cd1ee,_0x3fdf51,_0x40e4d4,_0xcdc138){return tilde['asr'](_0x2cd1ee,_0x3fdf51,_0x40e4d4,_0xcdc138)[_0x5d11('0x39')](function(_0x357df6){try{fs['unlink'](_0x2cd1ee);}catch(_0x332ad1){logger[_0x5d11('0x19')](_0x332ad1);}logger['info'](_0x5d11('0x79'),_0x357df6[_0x5d11('0x53')]);logger[_0x5d11('0x1e')](_0x5d11('0x7a'),_0x357df6[_0x5d11('0x55')]);return _0x357df6;});};exports[_0x5d11('0x7b')]=function(_0x338489,_0xedb8e4,_0x22b08b,_0x25e67a,_0x1d7f22,_0x202451){var _0x5a0da1=path['resolve'](__dirname,'tmp',rs[_0x5d11('0x3a')](0x4)+_0x5d11('0x3b'));var _0xc714d0;return aws[_0x5d11('0x7c')](_0x338489,_0xedb8e4,_0x22b08b,_0x25e67a,_0x1d7f22,_0x202451,_0x5a0da1)['then'](function(){_0xc714d0=path[_0x5d11('0x2a')](__dirname,'tmp',rs[_0x5d11('0x3a')](0x4)+_0x5d11('0x3f'));return convertFile(_0x5a0da1,_0xc714d0);})['then'](function(){try{fs['unlink'](_0x5a0da1);fs[_0x5d11('0x2e')](_0xc714d0,_0x5d11('0x2f'));}catch(_0x18c4dd){logger[_0x5d11('0x19')](_0x18c4dd);}return _0xc714d0[_0x5d11('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x2ceb5b,_0x522798,_0x9cd342,_0xfd442f,_0x49f386,_0x3dd54a){return aws[_0x5d11('0x7d')](_0x2ceb5b,_0x522798,_0x9cd342,_0xfd442f,_0x49f386,_0x3dd54a)[_0x5d11('0x39')](function(_0x33e23a){logger[_0x5d11('0x1e')](JSON[_0x5d11('0x46')](_0x33e23a));return _0x33e23a;});};exports[_0x5d11('0x7e')]=function(_0x5b20e6,_0x3578f1,_0x117c76,_0x17e753){var _0x59598c=util['format'](_0x5d11('0x7f'),ISPEECH_API,_0x5b20e6,encodeURIComponent(_0x3578f1),_0x117c76,_0x17e753);var _0x2aed3b=path[_0x5d11('0x2a')](__dirname,_0x5d11('0x2b'),rs[_0x5d11('0x3a')](0x4)+_0x5d11('0x3b'));var _0x5979f5;return downloadFile(_0x59598c,_0x2aed3b)[_0x5d11('0x39')](function(){_0x5979f5=path[_0x5d11('0x2a')](__dirname,_0x5d11('0x2b'),rs[_0x5d11('0x3a')](0x4)+_0x5d11('0x3f'));return convertFile(_0x2aed3b,_0x5979f5);})[_0x5d11('0x39')](function(){try{fs[_0x5d11('0x21')](_0x2aed3b);fs['chmodSync'](_0x5979f5,_0x5d11('0x2f'));}catch(_0x26622e){logger[_0x5d11('0x19')](_0x26622e);}return _0x5979f5[_0x5d11('0x30')]('.')[0x0];});};exports[_0x5d11('0x80')]=function(_0x185609,_0x5081c2,_0x4e1f76,_0x29380c){var _0x4d2c64=util[_0x5d11('0x81')](_0x5d11('0x82'),ISPEECH_API,_0x5081c2,_0x4e1f76,base64Encode(_0x185609),_0x29380c?util['format'](_0x5d11('0x83'),encodeURIComponent(_0x29380c)):_0x5d11('0x84'));return uploadFile(_0x4d2c64)[_0x5d11('0x39')](function(_0x66addf){return querystring['parse'](_0x66addf);});};exports['sestekNDA']=function(_0x297d85,_0x543aea){return sestek[_0x5d11('0x85')](_0x297d85,_0x543aea)['then'](function(_0x4623d4){logger['info'](JSON[_0x5d11('0x46')](_0x4623d4));var _0x16f1ba={'speech':_0x4623d4[_0x5d11('0x86')],'action':_0x4623d4[_0x5d11('0x87')]?_0x4623d4[_0x5d11('0x87')][_0x5d11('0x88')]:undefined,'actiondata':_0x4623d4[_0x5d11('0x87')]?_0x4623d4[_0x5d11('0x87')][_0x5d11('0x89')]:undefined};if(_0x4623d4[_0x5d11('0x87')]&&_0x4623d4[_0x5d11('0x87')][_0x5d11('0x8a')]){return base64Decode(_0x4623d4[_0x5d11('0x87')][_0x5d11('0x8a')][_0x5d11('0x8b')],path[_0x5d11('0x2a')](__dirname,_0x5d11('0x2b'),rs[_0x5d11('0x3a')](0x4)+'.wav'))[_0x5d11('0x39')](function(_0x11c92b){_0x16f1ba[_0x5d11('0x8c')]=_0x11c92b;return _0x16f1ba;});}return _0x16f1ba;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index b8b47c6..47233a4 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 _0x8a8a=['exports'];(function(_0x2c6fb9,_0xc7d7c0){var _0x49fd5e=function(_0x3dcbaf){while(--_0x3dcbaf){_0x2c6fb9['push'](_0x2c6fb9['shift']());}};_0x49fd5e(++_0xc7d7c0);}(_0x8a8a,0xae));var _0xa8a8=function(_0x23fd08,_0x5c2e77){_0x23fd08=_0x23fd08-0x0;var _0x4362f6=_0x8a8a[_0x23fd08];return _0x4362f6;};var nda=require('./nda');module[_0xa8a8('0x0')]={'nda':nda}; \ No newline at end of file +var _0xd371=['exports'];(function(_0x480614,_0xbf7759){var _0x3dbf2a=function(_0x2f29c4){while(--_0x2f29c4){_0x480614['push'](_0x480614['shift']());}};_0x3dbf2a(++_0xbf7759);}(_0xd371,0xdb));var _0x1d37=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xd371[_0x184759];return _0xf26d5f;};var nda=require('./nda');module[_0x1d37('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 1f92bf8..f901ca0 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 _0xfd3a=['dnid','extension','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','username','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfd3a,0x179));var _0xafd3=function(_0x27af80,_0x396b70){_0x27af80=_0x27af80-0x0;var _0x855bc7=_0xfd3a[_0x27af80];return _0x855bc7;};'use strict';var rp=require(_0xafd3('0x0'));var url=require(_0xafd3('0x1'));var logger=require(_0xafd3('0x2'))(_0xafd3('0x3'));module['exports']=function(_0x488608,_0x160b0d){var _0x26bd6c={'method':_0xafd3('0x4'),'uri':url[_0xafd3('0x5')](_0x160b0d[_0xafd3('0x6')],'/token'),'form':{'grant_type':_0xafd3('0x7'),'username':_0x160b0d[_0xafd3('0x8')],'password':_0x160b0d[_0xafd3('0x7')]},'json':!![]};return rp(_0x26bd6c)[_0xafd3('0x9')](function(_0xd2d780){var _0x4c4dcd={'method':'POST','uri':url[_0xafd3('0x5')](_0x160b0d[_0xafd3('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x160b0d[_0xafd3('0xb')]||_0xafd3('0xc'),'channelId':_0xafd3('0xd'),'conversation':{'id':_0x488608[_0xafd3('0xe')]},'from':{'id':_0x488608['callerid'],'name':_0x488608['calleridname']},'recipient':{'id':_0x488608[_0xafd3('0xf')],'name':_0x488608[_0xafd3('0x10')]},'text':_0x160b0d['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0xd2d780[_0xafd3('0x11')]},'json':!![]};if(_0x160b0d['project']){_0x4c4dcd[_0xafd3('0x12')][_0xafd3('0x13')][_0xafd3('0x14')]=_0x160b0d['project'];}if(_0x160b0d[_0xafd3('0x15')]=='1'){_0x4c4dcd[_0xafd3('0x12')][_0xafd3('0x13')][_0xafd3('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xafd3('0x17')};}if(_0x160b0d[_0xafd3('0x18')]){_0x4c4dcd['body']['channelData']['CustomAction']=_0x160b0d[_0xafd3('0x18')];if(_0x160b0d[_0xafd3('0x19')]){_0x4c4dcd[_0xafd3('0x12')][_0xafd3('0x13')][_0xafd3('0x1a')]=_0x160b0d[_0xafd3('0x19')];}}logger[_0xafd3('0x1b')](JSON['stringify'](_0x4c4dcd));return rp(_0x4c4dcd);});}; \ No newline at end of file +var _0x1a9e=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','exports','POST','ndauth_url','/token','password','username','then','resolve'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x1a9e,0x122));var _0xe1a9=function(_0x47ab87,_0xc07a8){_0x47ab87=_0x47ab87-0x0;var _0x55e040=_0x1a9e[_0x47ab87];return _0x55e040;};'use strict';var rp=require(_0xe1a9('0x0'));var url=require('url');var logger=require(_0xe1a9('0x1'))('agi');module[_0xe1a9('0x2')]=function(_0x33969,_0x1f9a25){var _0x1a374c={'method':_0xe1a9('0x3'),'uri':url['resolve'](_0x1f9a25[_0xe1a9('0x4')],_0xe1a9('0x5')),'form':{'grant_type':_0xe1a9('0x6'),'username':_0x1f9a25[_0xe1a9('0x7')],'password':_0x1f9a25[_0xe1a9('0x6')]},'json':!![]};return rp(_0x1a374c)[_0xe1a9('0x8')](function(_0x56f64c){var _0x1337f8={'method':_0xe1a9('0x3'),'uri':url[_0xe1a9('0x9')](_0x1f9a25[_0xe1a9('0xa')],_0xe1a9('0xb')),'body':{'type':_0x1f9a25[_0xe1a9('0xc')]||'message','channelId':'Nda','conversation':{'id':_0x33969['uniqueid']},'from':{'id':_0x33969['callerid'],'name':_0x33969[_0xe1a9('0xd')]},'recipient':{'id':_0x33969[_0xe1a9('0xe')],'name':_0x33969[_0xe1a9('0xf')]},'text':_0x1f9a25[_0xe1a9('0x10')],'channelData':{}},'headers':{'Authorization':_0xe1a9('0x11')+_0x56f64c[_0xe1a9('0x12')]},'json':!![]};if(_0x1f9a25[_0xe1a9('0x13')]){_0x1337f8[_0xe1a9('0x14')][_0xe1a9('0x15')]['ProjectName']=_0x1f9a25[_0xe1a9('0x13')];}if(_0x1f9a25[_0xe1a9('0x16')]=='1'){_0x1337f8[_0xe1a9('0x14')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe1a9('0x17')};}if(_0x1f9a25['custom_action']){_0x1337f8['body']['channelData'][_0xe1a9('0x18')]=_0x1f9a25[_0xe1a9('0x19')];if(_0x1f9a25[_0xe1a9('0x1a')]){_0x1337f8[_0xe1a9('0x14')][_0xe1a9('0x15')][_0xe1a9('0x1b')]=_0x1f9a25['custom_action_data'];}}logger[_0xe1a9('0x1c')](JSON[_0xe1a9('0x1d')](_0x1337f8));return rp(_0x1337f8);});}; \ 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 66f8f4f..bc844d8 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x1b7292,_0x5a0db,_0x1b7ada,_0x3ba76a){return asr(_0x1b7292,_0x5a0db,_0x1b7ada,_0x3ba76a);}; \ No newline at end of file +var _0xc134=['exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc134,0xaa));var _0x4c13=function(_0xfc89c1,_0xfe280d){_0xfc89c1=_0xfc89c1-0x0;var _0x976055=_0xc134[_0xfc89c1];return _0x976055;};'use strict';var asr=require('./lib/api');module[_0x4c13('0x0')]=function(_0x5cb4fc,_0xc43c20,_0x240fbf,_0x5ec771){return asr(_0x5cb4fc,_0xc43c20,_0x240fbf,_0x5ec771);}; \ 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 5cc79de..3d5916d 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 _0xba0b=['sha1','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','data','close','EOS','error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xba0b,0x17f));var _0xbba0=function(_0x1b815a,_0x2521e2){_0x1b815a=_0x1b815a-0x0;var _0x3c3dd4=_0xba0b[_0x1b815a];return _0x3c3dd4;};'use strict';var BPromise=require(_0xbba0('0x0'));var _=require(_0xbba0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbba0('0x2'));var crypto=require(_0xbba0('0x3'));var logger=require(_0xbba0('0x4'))('agi');module['exports']=function(_0xb56a41,_0x1f92c4,_0x3fd18b,_0x46ac09){return new BPromise(function(_0x2d301d,_0x2a9ede){logger['info']('Tilde\x20URI',_0x46ac09||_0xbba0('0x5'));var _0xe46e8f=new WebSocket(_0x46ac09||_0xbba0('0x5'),{'perMessageDeflate':![]});var _0x1c7dc6='';var _0xb3bce5='0';var _0x223034='1';var _0x4c7c3d='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xbd7b74(_0x33a890){var _0x1ffa02=crypto[_0xbba0('0x6')](_0xbba0('0x7'));_0x1ffa02[_0xbba0('0x8')](_0x33a890);return _0x1ffa02['digest'](_0xbba0('0x9'));}function _0x2216db(){try{logger[_0xbba0('0xa')](_0xbba0('0xb'));var _0x309258=moment()[_0xbba0('0xc')]();var _0xb5f723=_0xbd7b74(_0x309258+_0x1f92c4+_0x3fd18b);_0xe46e8f[_0xbba0('0xd')](JSON['stringify']({'appID':_0x1f92c4,'timestamp':_0x309258,'appKey':_0xb5f723}));var _0x395441=fs['createReadStream'](_0xb56a41);_0x395441['on'](_0xbba0('0xe'),function(_0x21ed31){_0xe46e8f['send'](_0x21ed31);});_0x395441['on'](_0xbba0('0xf'),function(){_0xe46e8f['send'](_0xbba0('0x10'));});}catch(_0x5909cb){logger[_0xbba0('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0xbba0('0x12')](_0x5909cb));_0xe46e8f[_0xbba0('0x13')]();}}function _0x43ae85(_0x20b829){try{if(_0x20b829){var _0xd7d793=JSON[_0xbba0('0x14')](_0x20b829);switch(_0xd7d793[_0xbba0('0x15')]){case 0x0:if(_0xd7d793[_0xbba0('0x16')]){if(_0xd7d793['result'][_0xbba0('0x17')]){logger[_0xbba0('0xa')](_0xbba0('0x18'),JSON[_0xbba0('0x12')](_0xd7d793[_0xbba0('0x16')][_0xbba0('0x19')]));_0x1c7dc6=_0xd7d793[_0xbba0('0x16')][_0xbba0('0x19')][0x0]['transcript'];_0xb3bce5=_0xd7d793[_0xbba0('0x16')][_0xbba0('0x19')][0x0][_0xbba0('0x1a')];_0x223034='0';_0x4c7c3d=_0xbba0('0x1b');_0xe46e8f[_0xbba0('0x13')]();}}break;case 0x1:logger[_0xbba0('0xa')](_0xbba0('0x1c'));_0x223034='1';_0x4c7c3d=_0xbba0('0x1c');break;case 0x2:logger['info'](_0xbba0('0x1d'));_0x223034='2';_0x4c7c3d=_0xbba0('0x1d');break;case 0x9:logger['info'](_0xbba0('0x1e'));_0x223034='9';_0x4c7c3d='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xbba0('0xa')](_0xbba0('0x1f'));_0x223034='10';_0x4c7c3d='Authentication\x20failed.';break;case 0xb:logger[_0xbba0('0xa')](_0xbba0('0x20'));_0x223034='11';_0x4c7c3d=_0xbba0('0x20');}}}catch(_0x2358fd){logger[_0xbba0('0x11')](_0xbba0('0x21'),JSON[_0xbba0('0x12')](_0x2358fd));_0xe46e8f[_0xbba0('0x13')]();}}function _0x1a4959(){logger[_0xbba0('0xa')]('Close\x20Tilde\x20ASR\x20socket');_0x2d301d({'transcript':_0x1c7dc6,'confidence':_0xb3bce5,'status':_0x223034,'status_message':_0x4c7c3d});}function _0x179d3e(_0x2a3f6f){logger[_0xbba0('0x11')](_0xbba0('0x22'));if(!_[_0xbba0('0x23')](_0x2a3f6f)){logger['error'](_[_0xbba0('0x24')](_0x2a3f6f)?JSON[_0xbba0('0x12')](_0x2a3f6f):_0x2a3f6f);}}_0xe46e8f['on'](_0xbba0('0x25'),_0x2216db);_0xe46e8f['on'](_0xbba0('0x26'),_0x43ae85);_0xe46e8f['on'](_0xbba0('0xf'),_0x1a4959);_0xe46e8f['on'](_0xbba0('0x11'),_0x179d3e);});}; \ No newline at end of file +var _0x0c94=['Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','Open\x20Tilde\x20ASR\x20socket','stringify','data','close','send','EOS','terminate','status','result','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.'];(function(_0x2d2824,_0xdaffc9){var _0x218bab=function(_0x22b126){while(--_0x22b126){_0x2d2824['push'](_0x2d2824['shift']());}};_0x218bab(++_0xdaffc9);}(_0x0c94,0xc8));var _0x40c9=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x0c94[_0x1a36a5];return _0x746243;};'use strict';var BPromise=require('bluebird');var _=require(_0x40c9('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x40c9('0x1'));var crypto=require(_0x40c9('0x2'));var logger=require(_0x40c9('0x3'))(_0x40c9('0x4'));module[_0x40c9('0x5')]=function(_0x3e347f,_0x47e62b,_0x719b32,_0x20637a){return new BPromise(function(_0x22dd1e,_0x5bd7a9){logger[_0x40c9('0x6')](_0x40c9('0x7'),_0x20637a||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x5313ec=new WebSocket(_0x20637a||_0x40c9('0x8'),{'perMessageDeflate':![]});var _0x597809='';var _0x376686='0';var _0x376e01='1';var _0x2a004f='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x56655f(_0x341adb){var _0xfa56a0=crypto[_0x40c9('0x9')](_0x40c9('0xa'));_0xfa56a0['update'](_0x341adb);return _0xfa56a0[_0x40c9('0xb')]('hex');}function _0x3ff00c(){try{logger['info'](_0x40c9('0xc'));var _0x368032=moment()['unix']();var _0x2bce8d=_0x56655f(_0x368032+_0x47e62b+_0x719b32);_0x5313ec['send'](JSON[_0x40c9('0xd')]({'appID':_0x47e62b,'timestamp':_0x368032,'appKey':_0x2bce8d}));var _0x1daf09=fs['createReadStream'](_0x3e347f);_0x1daf09['on'](_0x40c9('0xe'),function(_0x5bd039){_0x5313ec['send'](_0x5bd039);});_0x1daf09['on'](_0x40c9('0xf'),function(){_0x5313ec[_0x40c9('0x10')](_0x40c9('0x11'));});}catch(_0x45942c){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0x40c9('0xd')](_0x45942c));_0x5313ec[_0x40c9('0x12')]();}}function _0x362ed0(_0x3253c1){try{if(_0x3253c1){var _0x14059a=JSON['parse'](_0x3253c1);switch(_0x14059a[_0x40c9('0x13')]){case 0x0:if(_0x14059a[_0x40c9('0x14')]){if(_0x14059a['result']['final']){logger[_0x40c9('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0x40c9('0xd')](_0x14059a[_0x40c9('0x14')][_0x40c9('0x15')]));_0x597809=_0x14059a[_0x40c9('0x14')]['hypotheses'][0x0][_0x40c9('0x16')];_0x376686=_0x14059a['result'][_0x40c9('0x15')][0x0][_0x40c9('0x17')];_0x376e01='0';_0x2a004f=_0x40c9('0x18');_0x5313ec['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x376e01='1';_0x2a004f=_0x40c9('0x19');break;case 0x2:logger['info'](_0x40c9('0x1a'));_0x376e01='2';_0x2a004f=_0x40c9('0x1a');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x376e01='9';_0x2a004f=_0x40c9('0x1b');break;case 0xa:logger[_0x40c9('0x6')](_0x40c9('0x1c'));_0x376e01='10';_0x2a004f=_0x40c9('0x1c');break;case 0xb:logger[_0x40c9('0x6')](_0x40c9('0x1d'));_0x376e01='11';_0x2a004f='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x544689){logger[_0x40c9('0x1e')](_0x40c9('0x1f'),JSON[_0x40c9('0xd')](_0x544689));_0x5313ec[_0x40c9('0x12')]();}}function _0x1c9885(){logger[_0x40c9('0x6')](_0x40c9('0x20'));_0x22dd1e({'transcript':_0x597809,'confidence':_0x376686,'status':_0x376e01,'status_message':_0x2a004f});}function _0xfa28af(_0x5c15e9){logger[_0x40c9('0x1e')](_0x40c9('0x21'));if(!_[_0x40c9('0x22')](_0x5c15e9)){logger['error'](_[_0x40c9('0x23')](_0x5c15e9)?JSON[_0x40c9('0xd')](_0x5c15e9):_0x5c15e9);}}_0x5313ec['on'](_0x40c9('0x24'),_0x3ff00c);_0x5313ec['on'](_0x40c9('0x25'),_0x362ed0);_0x5313ec['on'](_0x40c9('0xf'),_0x1c9885);_0x5313ec['on']('error',_0xfa28af);});}; \ 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 26cbe29..9664982 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 _0x3c0a=['./asr'];(function(_0x5c4f6c,_0x2bf7bd){var _0x2014b2=function(_0x482d2f){while(--_0x482d2f){_0x5c4f6c['push'](_0x5c4f6c['shift']());}};_0x2014b2(++_0x2bf7bd);}(_0x3c0a,0x1ae));var _0xa3c0=function(_0x698173,_0x32fca1){_0x698173=_0x698173-0x0;var _0x18898e=_0x3c0a[_0x698173];return _0x18898e;};var asr=require(_0xa3c0('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xfbd8=['exports','./asr'];(function(_0x3e5e2a,_0x12a568){var _0x39e3ba=function(_0x165576){while(--_0x165576){_0x3e5e2a['push'](_0x3e5e2a['shift']());}};_0x39e3ba(++_0x12a568);}(_0xfbd8,0x10b));var _0x8fbd=function(_0x5c6783,_0x5ee78a){_0x5c6783=_0x5c6783-0x0;var _0x34a61f=_0xfbd8[_0x5c6783];return _0x34a61f;};var asr=require(_0x8fbd('0x0'));module[_0x8fbd('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index ac64e5b..ac5c945 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x109e39,_0x27f91c){var _0x3b142f=function(_0xec4d82){while(--_0xec4d82){_0x109e39['push'](_0x109e39['shift']());}};_0x3b142f(++_0x27f91c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3be61d5..b13415c 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 _0xce50=['agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','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','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','lodash','shelljs','odbc','randomstring','moment','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','then','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','name','getSquareOdbcById','getUser','getUserById','getTrunk','getSound','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','error','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_bot_name','googleASR','appid','clone','hasOwnProperty','isString','isPlainObject','recursiveNodeIndex','length','replaceAllVariables','saveRestApiResult','isArray','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','createSquareDetailsReport','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','DIAL','dialogflow','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','substr','generate','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','getIntervals','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','recordFile','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeech\x20%s\x20file\x20created','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','smtpOptions','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\x20configured','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI'];(function(_0x10f70d,_0x3c4f1f){var _0x4b62ea=function(_0x39a779){while(--_0x39a779){_0x10f70d['push'](_0x10f70d['shift']());}};_0x4b62ea(++_0x3c4f1f);}(_0xce50,0x1d8));var _0x0ce5=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xce50[_0x36eaaa];return _0x461349;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x0ce5('0x0'));var sh=require(_0x0ce5('0x1'));var odbc=require(_0x0ce5('0x2'))();var rs=require(_0x0ce5('0x3'));var moment=require(_0x0ce5('0x4'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x0ce5('0x5'))('agi');var config=require('../../config/environment');var scripts=require(_0x0ce5('0x6'));var FILES_PATH=_0x0ce5('0x7');var recursiveMapAttributes=[_0x0ce5('0x8'),_0x0ce5('0x9')];var verticesWithRetry=['menu',_0x0ce5('0xa'),_0x0ce5('0xb')];var AGIVertices=function(_0x4d9a49,_0x1cdb92,_0x55639f){this[_0x0ce5('0xc')]=_0x4d9a49;this[_0x0ce5('0xd')]=_0x1cdb92;this[_0x0ce5('0xe')]=_0x55639f;};AGIVertices[_0x0ce5('0xf')]['getVariable']=function(_0x29abcd,_0x2b5559){this[_0x0ce5('0xd')][_0x0ce5('0x10')](_0x29abcd)[_0x0ce5('0x11')](function(_0x5dc9fa){_0x2b5559(null,_0x5dc9fa?_0x5dc9fa['name']:![]);})['catch'](function(_0x59c22e){_0x2b5559(_0x59c22e);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x12')]=function(_0x282453,_0x4f4a14){this[_0x0ce5('0xd')][_0x0ce5('0x13')](_0x282453)['then'](function(_0x45dacd){_0x4f4a14(null,_0x45dacd?_0x45dacd['name']:![]);})[_0x0ce5('0x14')](function(_0x1dd856){_0x4f4a14(_0x1dd856);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x15')]=function(_0x470087,_0x20452f){this[_0x0ce5('0xd')][_0x0ce5('0x16')](_0x470087)['then'](function(_0xfd429a){_0x20452f(null,_0xfd429a?_0xfd429a[_0x0ce5('0x17')]:![]);})['catch'](function(_0x4f5e0b){_0x20452f(_0x4f5e0b);});};AGIVertices[_0x0ce5('0xf')]['getSquareOdbc']=function(_0x2602ca,_0x477451){this[_0x0ce5('0xd')][_0x0ce5('0x18')](_0x2602ca)[_0x0ce5('0x11')](function(_0x22bf81){_0x477451(null,_0x22bf81?_0x22bf81['dsn']:![]);})[_0x0ce5('0x14')](function(_0xff25d){_0x477451(_0xff25d);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x19')]=function(_0x5a12e6,_0x20f520){this['rpc'][_0x0ce5('0x1a')](_0x5a12e6)[_0x0ce5('0x11')](function(_0x3be760){_0x20f520(null,_0x3be760?_0x3be760[_0x0ce5('0x17')]:![]);})[_0x0ce5('0x14')](function(_0xbb1a2c){_0x20f520(_0xbb1a2c);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x1b')]=function(_0x133d41,_0xb4678b){this['rpc']['getTrunkById'](_0x133d41)[_0x0ce5('0x11')](function(_0x56ef06){_0xb4678b(null,_0x56ef06?_0x56ef06['name']:![]);})[_0x0ce5('0x14')](function(_0x564276){_0xb4678b(_0x564276);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x1c')]=function(_0x5bdf41,_0x52b64d){var _0x33d945=this;this[_0x0ce5('0xd')]['getSoundById'](_0x5bdf41)[_0x0ce5('0x11')](function(_0x470fb6){_0x52b64d(null,_0x470fb6?_0x33d945[_0x0ce5('0x1d')](_0x470fb6['save_name']):![]);})['catch'](function(_0x343137){_0x52b64d(_0x343137);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x1e')]=function(_0x3ea1bd,_0x460ccf){this[_0x0ce5('0xd')][_0x0ce5('0x1f')](_0x3ea1bd)[_0x0ce5('0x11')](function(_0x34612a){_0x460ccf(null,_0x34612a?_0x34612a:![]);})[_0x0ce5('0x14')](function(_0x2f392c){_0x460ccf(_0x2f392c);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x20')]=function(_0xfef4a3,_0x733d8a,_0x143960){this[_0x0ce5('0xe')][_0x0ce5('0x20')](_0xfef4a3,_0x733d8a)[_0x0ce5('0x11')](function(){_0x143960(null);})[_0x0ce5('0x14')](function(_0x1d7351){_0x143960(_0x1d7351);});};AGIVertices[_0x0ce5('0xf')]['getIntervals']=function(_0x168e40,_0x2ab6a8){this[_0x0ce5('0xd')]['getIntervalById'](_0x168e40)[_0x0ce5('0x11')](function(_0x14cceb){if(_0x14cceb){if(_0x14cceb[_0x0ce5('0x21')]){_0x2ab6a8(null,[_0x14cceb[_0x0ce5('0x22')]]);}else{_0x2ab6a8(null,_['map'](_0x14cceb[_0x0ce5('0x23')],_0x0ce5('0x22')));}}else{_0x2ab6a8(null,![]);}})[_0x0ce5('0x14')](function(_0x2a3ed6){_0x2ab6a8(_0x2a3ed6);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x1d')]=function(_0x1fe492){return util[_0x0ce5('0x24')](_0x0ce5('0x25'),FILES_PATH,_0x1fe492);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x26')]=function(_0x453ee4,_0x4d5a1d,_0x13d73e){odbc[_0x0ce5('0x27')](_0x453ee4,function(_0x3b22b3){if(_0x3b22b3){logger['error'](_0x0ce5('0x28'),_0x3b22b3);_0x13d73e(_0x3b22b3);}else{logger[_0x0ce5('0x29')](_0x0ce5('0x2a'));odbc[_0x0ce5('0x2b')](_0x4d5a1d,function(_0x48a052,_0x222362){if(_0x48a052){logger['info'](_0x0ce5('0x2c'),_0x4d5a1d);_0x13d73e(_0x48a052);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x4d5a1d);odbc[_0x0ce5('0x2d')](function(_0x415523){if(_0x415523){logger[_0x0ce5('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x415523);}_0x13d73e(null,_0x222362);});}});}});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x2f')]=function(_0x245ac6,_0x1c2fd0){this['rpc'][_0x0ce5('0x30')](_0x245ac6)[_0x0ce5('0x11')](function(_0x238f52){_0x1c2fd0(null,_0x238f52?_0x238f52:![]);})[_0x0ce5('0x14')](function(_0x3952c6){_0x1c2fd0(_0x3952c6);});};AGIVertices[_0x0ce5('0xf')]['createSmsMessage']=function(_0x29f290,_0x1eb781){this[_0x0ce5('0xd')][_0x0ce5('0x31')](_0x29f290)[_0x0ce5('0x11')](function(_0x1e75c5){_0x1eb781(null,_0x1e75c5);})[_0x0ce5('0x14')](function(_0x2be933){_0x1eb781(_0x2be933);});};AGIVertices[_0x0ce5('0xf')]['createSquareDetailsReport']=function(_0x5e280c,_0x1a16b7,_0x320639){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x0ce5('0xc')][_0x0ce5('0x32')],'node':_0x5e280c[_0x0ce5('0x33')],'application':_0x5e280c[_0x0ce5('0x34')],'data':_0x1a16b7||null,'project_name':this[_0x0ce5('0xc')][_0x0ce5('0x35')],'callerid':this[_0x0ce5('0xc')][_0x0ce5('0x36')]})[_0x0ce5('0x11')](function(_0x3ce14a){if(_0x320639){_0x320639(null,_0x3ce14a);}})['catch'](function(_0x511825){if(_0x320639){_0x320639(_0x511825);}});};AGIVertices['prototype'][_0x0ce5('0x37')]=function(_0x29cf23,_0x40e217,_0xecab39,_0x6e2f61){this[_0x0ce5('0xd')]['createSquareRecording']({'uniqueid':this[_0x0ce5('0xc')][_0x0ce5('0x32')],'callerid':this[_0x0ce5('0xc')][_0x0ce5('0x36')],'calleridname':this['channel'][_0x0ce5('0x38')],'context':this['channel']['context'],'extension':this[_0x0ce5('0xc')][_0x0ce5('0x39')],'priority':this[_0x0ce5('0xc')][_0x0ce5('0x3a')],'accountcode':this[_0x0ce5('0xc')][_0x0ce5('0x3b')],'dnid':this[_0x0ce5('0xc')][_0x0ce5('0x3c')],'projectName':this[_0x0ce5('0xc')][_0x0ce5('0x35')],'saveName':_0x40e217,'filename':_0x29cf23[_0x0ce5('0x3d')]||_0x40e217,'savePath':_0xecab39})[_0x0ce5('0x11')](function(_0x5629f4){_0x6e2f61(null,_0x5629f4);})[_0x0ce5('0x14')](function(_0x57a64a){_0x6e2f61(_0x57a64a);});};AGIVertices[_0x0ce5('0xf')]['createSquareMessage']=function(_0x4bca60,_0x5809a8,_0xc66bc3,_0x5bded9,_0x4eeaa6){this['rpc'][_0x0ce5('0x3e')]({'uniqueid':this[_0x0ce5('0xc')][_0x0ce5('0x32')],'body':_0x4bca60,'direction':_0x5809a8,'providerName':_0xc66bc3,'providerResponse':_0x5bded9})[_0x0ce5('0x11')](function(_0x536582){if(_0x4eeaa6){_0x4eeaa6(null,_0x536582);}})['catch'](function(_0xb6734e){if(_0x4eeaa6){_0x4eeaa6(_0xb6734e);}});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x3f')]=function(_0x248553,_0x4256e3){this[_0x0ce5('0xd')][_0x0ce5('0x3f')]({'firstName':_[_0x0ce5('0x40')](_0x248553[_0x0ce5('0x17')])||_[_0x0ce5('0x41')](_0x248553[_0x0ce5('0x17')])?_0x0ce5('0x42')+Math[_0x0ce5('0x43')]():_0x248553[_0x0ce5('0x17')],'lastName':_[_0x0ce5('0x40')](_0x248553[_0x0ce5('0x44')])||_[_0x0ce5('0x41')](_0x248553[_0x0ce5('0x44')])?null:_0x248553[_0x0ce5('0x44')],'phone':_0x248553['phone'],'ListId':_0x248553[_0x0ce5('0x45')],'scheduledat':_0x248553['scheduledAt'],'callbackUniqueid':this[_0x0ce5('0xc')][_0x0ce5('0x32')],'tags':_0x0ce5('0x46'),'description':_0x0ce5('0x47')+_0x248553[_0x0ce5('0x48')][_0x0ce5('0x49')](),'priority':_0x248553[_0x0ce5('0x4a')]})[_0x0ce5('0x11')](function(_0x4476ce){_0x4256e3(null,_0x4476ce);})[_0x0ce5('0x14')](function(_0x847e99){_0x4256e3(_0x847e99);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x4b')]=function(_0x122ca3,_0x29cca6){this[_0x0ce5('0xd')][_0x0ce5('0x4c')](_0x122ca3)[_0x0ce5('0x11')](function(_0x1f0a7f){_0x29cca6(null,_0x1f0a7f?_0x1f0a7f[_0x0ce5('0x17')]:![]);})[_0x0ce5('0x14')](function(_0xc7ba0a){_0x29cca6(_0xc7ba0a);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x4d')]=function(_0x394875,_0x1975ca,_0x40a1f0){var _0x261355={'role':_0x0ce5('0x4e')};_0x261355[_0x394875]=this[_0x0ce5('0xc')][_0x0ce5('0x36')];this[_0x0ce5('0xd')][_0x0ce5('0x4d')](_0x261355,_0x1975ca,this[_0x0ce5('0xc')][_0x0ce5('0x32')])[_0x0ce5('0x11')](function(_0x501f6){_0x40a1f0(null,_['isNil'](_0x501f6)?![]:!![]);})['catch'](function(_0x5931fe){logger['error'](_0x5931fe);_0x40a1f0(null,![]);});};AGIVertices['prototype'][_0x0ce5('0x4f')]=function(_0x25bef0,_0x4768d8){var _0x394d41={'role':_0x0ce5('0x4e')};_0x394d41[_0x25bef0]=this[_0x0ce5('0xc')][_0x0ce5('0x36')];this[_0x0ce5('0xd')][_0x0ce5('0x4f')](_0x394d41)[_0x0ce5('0x11')](function(_0x3f6301){_0x4768d8(null,_[_0x0ce5('0x41')](_0x3f6301)?![]:!![]);})['catch'](function(_0x26e324){logger[_0x0ce5('0x2e')](_0x26e324);_0x4768d8(null,![]);});};AGIVertices['prototype'][_0x0ce5('0x50')]=function(_0x2e7d65,_0x10e4b5){var _0x374740={'role':_0x0ce5('0x4e')};_0x374740[_0x2e7d65]=this[_0x0ce5('0xc')][_0x0ce5('0x36')];this[_0x0ce5('0xd')][_0x0ce5('0x50')](_0x374740)[_0x0ce5('0x11')](function(_0x562092){_0x10e4b5(null,_[_0x0ce5('0x41')](_0x562092)?![]:!![]);})[_0x0ce5('0x14')](function(_0x43a734){logger[_0x0ce5('0x2e')](_0x43a734);_0x10e4b5(null,![]);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x51')]=function(_0x5da67b,_0x60b857){var _0x104eaf={'role':_0x0ce5('0x4e')};_0x104eaf[_0x5da67b]=this[_0x0ce5('0xc')][_0x0ce5('0x36')];var _0x429410=_0x5da67b!='internal'?util[_0x0ce5('0x24')](_0x0ce5('0x52'),_0x0ce5('0x53'),this['channel'][_0x0ce5('0x36')]):undefined;this[_0x0ce5('0xd')]['agentLogin'](_0x104eaf,_0x429410)[_0x0ce5('0x11')](function(_0x53e7e5){_0x60b857(null,_['isNil'](_0x53e7e5)?![]:!![]);})[_0x0ce5('0x14')](function(_0x2a0ecd){logger[_0x0ce5('0x2e')](_0x2a0ecd);_0x60b857(null,![]);});};AGIVertices[_0x0ce5('0xf')]['shellCommand']=function(_0x3485b7,_0x253a15){sh['exec'](_[_0x0ce5('0x54')](_0x3485b7),function(_0x2f297b,_0x4903c7){var _0x5eaa68=_0x4903c7[_0x0ce5('0x55')](/(\r\n|\n|\r)/gm,'');_0x253a15(null,_0x5eaa68);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x56')]=function(_0x5c2f23,_0xa1c6ae){scripts[_0x0ce5('0x56')](_0x5c2f23[_0x0ce5('0x57')],_0x5c2f23['google_cloud_tts_text_type']||_0x0ce5('0x58'),_0x5c2f23[_0x0ce5('0x58')],_0x5c2f23['languageCode']||_0x0ce5('0x59'),_0x5c2f23[_0x0ce5('0x5a')]||'MALE',_0x5c2f23[_0x0ce5('0x5b')]||_0x0ce5('0x5c'))[_0x0ce5('0x11')](function(_0x2f0afc){_0xa1c6ae(null,_0x2f0afc);})['catch'](function(_0xed6e2){_0xa1c6ae(_0xed6e2);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x5d')]=function(_0x2c8448,_0x58738a){scripts[_0x0ce5('0x5d')](_0x2c8448[_0x0ce5('0x58')],_0x2c8448[_0x0ce5('0x5e')]||'en',0x1)[_0x0ce5('0x11')](function(_0x2bfb07){_0x58738a(null,_0x2bfb07);})['catch'](function(_0x5f23dc){_0x58738a(_0x5f23dc);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x5f')]=function(_0x8e976f,_0x5763c6){var _0x29298d={'uri':_0x8e976f[_0x0ce5('0x60')],'method':_0x8e976f[_0x0ce5('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x8e976f[_0x0ce5('0x62')])===_0x0ce5('0x63')&&parseInt(_0x8e976f[_0x0ce5('0x62')])>=0x1?parseInt(_0x8e976f[_0x0ce5('0x62')])*0x3e8:0x5*0x3e8};if(_[_0x0ce5('0x64')](['POST',_0x0ce5('0x65')],_0x29298d[_0x0ce5('0x61')][_0x0ce5('0x66')]())){try{_0x29298d[_0x0ce5('0x67')]=_0x8e976f[_0x0ce5('0x9')]?JSON[_0x0ce5('0x68')](_0x8e976f[_0x0ce5('0x9')]):{};}catch(_0x5f14e2){logger[_0x0ce5('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5f14e2);}}try{_0x29298d['headers']=_0x8e976f[_0x0ce5('0x8')]?JSON[_0x0ce5('0x68')](_0x8e976f[_0x0ce5('0x8')]):{};}catch(_0x598b1c){logger[_0x0ce5('0x2e')](_0x0ce5('0x69'),_0x598b1c);}if(_0x8e976f[_0x0ce5('0x6a')]){try{var _0xe8a509=require(_0x8e976f[_0x0ce5('0x6a')])[_0x0ce5('0x6b')](this,_0x29298d);_0x29298d[_0x0ce5('0x6c')]=Mustache[_0x0ce5('0x6d')](_0x8e976f[_0x0ce5('0x60')],_0xe8a509,{},['$$','$$']);if(_0x29298d[_0x0ce5('0x6e')]){_0x29298d[_0x0ce5('0x6e')]=JSON[_0x0ce5('0x68')](Mustache[_0x0ce5('0x6d')](JSON[_0x0ce5('0x6f')](_0x29298d[_0x0ce5('0x6e')]),_0xe8a509,{},['$$','$$']));}if(_0x29298d['body']){_0x29298d[_0x0ce5('0x67')]=JSON['parse'](Mustache[_0x0ce5('0x6d')](JSON[_0x0ce5('0x6f')](_0x29298d[_0x0ce5('0x67')]),_0xe8a509,{},['$$','$$']));}}catch(_0x507bba){logger[_0x0ce5('0x2e')](_0x0ce5('0x70'),_0x507bba);}}rp(_0x29298d)['then'](function(_0x4ba926){var _0x4659fb={'statusCode':_0x4ba926[_0x0ce5('0x71')]||0xc8,'statusMessage':_0x4ba926['statusMessage']||'OK','headers':_0x4ba926['headers']||{},'body':_0x4ba926[_0x0ce5('0x67')]||{}};_0x5763c6(null,_0x4659fb);})['catch'](function(_0x45b0ca){var _0x38ddc1={'statusCode':_0x45b0ca['statusCode']||0x1f4,'statusMessage':_0x45b0ca[_0x0ce5('0x72')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x45b0ca[_0x0ce5('0x73')][_0x0ce5('0x6e')]||{},'body':_0x45b0ca[_0x0ce5('0x73')][_0x0ce5('0x67')]||{}};_0x5763c6(null,_0x38ddc1);});};AGIVertices[_0x0ce5('0xf')]['googleDialogflow']=function(_0x1bad83,_0x4d5bf6){scripts[_0x0ce5('0x74')](this[_0x0ce5('0xc')]['uniqueid'],_0x1bad83[_0x0ce5('0x75')],_0x1bad83['text'],_0x1bad83['dialogflow_language']||'en')[_0x0ce5('0x11')](function(_0x2e636a){_0x4d5bf6(null,_0x2e636a);})[_0x0ce5('0x14')](function(_0x40c866){_0x4d5bf6(_0x40c866);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x76')]=function(_0x316d4d,_0xd9726e){scripts[_0x0ce5('0x76')](this[_0x0ce5('0xc')][_0x0ce5('0x32')],_0x316d4d[_0x0ce5('0x77')],_0x316d4d[_0x0ce5('0x78')],_0x316d4d[_0x0ce5('0x79')],_0x316d4d[_0x0ce5('0x58')],_0x316d4d[_0x0ce5('0x7a')]||'en')[_0x0ce5('0x11')](function(_0x93a098){_0xd9726e(null,_0x93a098);})[_0x0ce5('0x14')](function(_0x312c06){_0xd9726e(_0x312c06);});};AGIVertices['prototype'][_0x0ce5('0x7b')]=function(_0x478e85,_0x443d0c){scripts[_0x0ce5('0x7b')](this[_0x0ce5('0xc')],_0x478e85)[_0x0ce5('0x11')](function(_0x5481ab){_0x443d0c(null,_0x5481ab);})[_0x0ce5('0x14')](function(_0x1921d0){_0x443d0c(_0x1921d0);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x7c')]=function(_0x22e286,_0x518b07){scripts[_0x0ce5('0x7c')](_0x22e286[_0x0ce5('0x75')],_0x22e286[_0x0ce5('0x58')],_0x22e286['ispeech_tts_language']||_0x0ce5('0x59'),_0x22e286['speed'])[_0x0ce5('0x11')](function(_0x326a71){_0x518b07(null,_0x326a71);})[_0x0ce5('0x14')](function(_0x4727df){_0x518b07(_0x4727df);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x7d')]=function(_0x51338d,_0x4808d8,_0x1e5be8){scripts[_0x0ce5('0x7d')](_0x4808d8,_0x51338d[_0x0ce5('0x75')],_0x51338d[_0x0ce5('0x7e')]||_0x0ce5('0x59'),this[_0x0ce5('0x7f')](_0x51338d[_0x0ce5('0x80')])?_0x51338d[_0x0ce5('0x80')]:undefined)['then'](function(_0x37dc41){_0x1e5be8(null,_0x37dc41);})['catch'](function(_0x1c2a92){_0x1e5be8(_0x1c2a92);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x81')]=function(_0x3b1e80,_0x401000){scripts[_0x0ce5('0x81')](_0x3b1e80[_0x0ce5('0x82')],_0x3b1e80[_0x0ce5('0x83')],_0x3b1e80[_0x0ce5('0x84')],_0x3b1e80[_0x0ce5('0x85')]||'Amy',_0x3b1e80[_0x0ce5('0x58')],_0x3b1e80['aws_text_type']||'text')[_0x0ce5('0x11')](function(_0x3ca695){_0x401000(null,_0x3ca695);})[_0x0ce5('0x14')](function(_0x5063d8){_0x401000(_0x5063d8);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x86')]=function(_0x1c0367,_0x1d515e){scripts['awsLex'](this[_0x0ce5('0xc')]['uniqueid'],_0x1c0367[_0x0ce5('0x82')],_0x1c0367[_0x0ce5('0x83')],_0x1c0367['aws_lex_region'],_0x1c0367['text'],_0x1c0367[_0x0ce5('0x87')])[_0x0ce5('0x11')](function(_0x4abfb5){_0x1d515e(null,_0x4abfb5);})[_0x0ce5('0x14')](function(_0x2a6350){_0x1d515e(_0x2a6350);});};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x88')]=function(_0xb1cf15,_0xdd90d1,_0x473e1d){scripts[_0x0ce5('0x88')](_0xdd90d1,_0xb1cf15[_0x0ce5('0x75')],_0xb1cf15['google_asr_language']||_0x0ce5('0x59'))[_0x0ce5('0x11')](function(_0x455ea0){_0x473e1d(null,_0x455ea0);})[_0x0ce5('0x14')](function(_0x1f57dc){_0x473e1d(_0x1f57dc);});};AGIVertices[_0x0ce5('0xf')]['tildeASR']=function(_0x2b4dfc,_0x17ba87,_0x1447aa){scripts['tildeASR'](_0x17ba87,_0x2b4dfc[_0x0ce5('0x89')],_0x2b4dfc['appsecret'],_0x2b4dfc[_0x0ce5('0x6c')])[_0x0ce5('0x11')](function(_0x209771){_0x1447aa(null,_0x209771);})[_0x0ce5('0x14')](function(_0xc62690){_0x1447aa(_0xc62690);});};AGIVertices[_0x0ce5('0xf')]['clear']=function(_0x333d54){var _0x2cc226=_[_0x0ce5('0x64')](verticesWithRetry,_0x333d54[_0x0ce5('0x34')])?_0x333d54:_[_0x0ce5('0x8a')](_0x333d54);for(var _0x22bf95 in _0x2cc226){if(_0x2cc226[_0x0ce5('0x8b')](_0x22bf95)){if(_0x2cc226[_0x22bf95]&&_[_0x0ce5('0x8c')](_0x2cc226[_0x22bf95])){if(_['includes'](recursiveMapAttributes,_0x22bf95)){_0x2cc226[_0x22bf95]=this['replaceObjectAllVariables'](_0x2cc226[_0x22bf95]);}else{_0x2cc226[_0x22bf95]=this['replaceAllVariables'](_0x2cc226[_0x22bf95]);}}}}return _0x2cc226;};AGIVertices[_0x0ce5('0xf')]['recursiveNodeIndex']=function(_0x44ec28){for(var _0x5a23b3 in _0x44ec28){if(_0x44ec28[_0x0ce5('0x8b')](_0x5a23b3)){if(_[_0x0ce5('0x8d')](_0x44ec28[_0x5a23b3])){this[_0x0ce5('0x8e')](_0x44ec28[_0x5a23b3]);}else if(_['isArray'](_0x44ec28[_0x5a23b3])){for(var _0xdbbf50=0x0;_0xdbbf50<_0x44ec28[_0x5a23b3][_0x0ce5('0x8f')];_0xdbbf50++){this[_0x0ce5('0x8e')](_0x44ec28[_0x5a23b3][_0xdbbf50]);}}else if(_[_0x0ce5('0x8c')](_0x44ec28[_0x5a23b3])){_0x44ec28[_0x5a23b3]=this[_0x0ce5('0x90')](_0x44ec28[_0x5a23b3]);}}}};AGIVertices['prototype'][_0x0ce5('0x91')]=function(_0x27696f,_0x576ff2){for(var _0x496501 in _0x27696f){if(_0x27696f[_0x0ce5('0x8b')](_0x496501)){if(_[_0x0ce5('0x8d')](_0x27696f[_0x496501])){if(!_['isEmpty'](_0x27696f[_0x496501])){this[_0x0ce5('0x91')](_0x27696f[_0x496501],util[_0x0ce5('0x24')]('%s.%s',_0x576ff2,_0x496501));}}else if(_[_0x0ce5('0x92')](_0x27696f[_0x496501])){for(var _0x1c7384=0x0;_0x1c7384<_0x27696f[_0x496501][_0x0ce5('0x8f')];_0x1c7384++){this['saveRestApiResult'](_0x27696f[_0x496501][_0x1c7384],util['format'](_0x0ce5('0x93'),_0x576ff2,_0x496501+'['+_0x1c7384+']'));}}else{if(!_[_0x0ce5('0x41')](_0x27696f[_0x496501])){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util['format'](_0x0ce5('0x93'),_0x576ff2,_0x496501),_0x27696f[_0x496501]);}}}}};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x95')]=function(_0x116b3c){try{var _0x5690a9=JSON['parse'](_0x116b3c);this[_0x0ce5('0x8e')](_0x5690a9);return JSON['stringify'](_0x5690a9);}catch(_0x2fa3f6){return this[_0x0ce5('0x90')](_0x116b3c);}};AGIVertices[_0x0ce5('0xf')]['replaceAllVariables']=function(_0xfc96f0){var _0x48302b=_0xfc96f0[_0x0ce5('0x96')]('{');for(var _0x3edd27=0x1;_0x3edd27<_0x48302b[_0x0ce5('0x8f')];_0x3edd27+=0x1){var _0x555b61=_0x48302b[_0x3edd27][_0x0ce5('0x96')]('}');if(_0x555b61[_0x0ce5('0x8f')]>0x1){_0xfc96f0=_0xfc96f0[_0x0ce5('0x97')]('{'+_0x555b61[0x0]+'}',this[_0x0ce5('0xc')][_0x0ce5('0x98')](_0x555b61[0x0])[_0x0ce5('0x99')]||_0x555b61[0x0]);}}if(_0x48302b[_0x0ce5('0x8f')]===0x1){return _0xfc96f0['toString']();}return this[_0x0ce5('0x90')](_0xfc96f0);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x9a')]=function(_0x30bdc4,_0x39b669){var _0x194b41=this[_0x0ce5('0xc')][_0x0ce5('0x98')](_0x30bdc4);if(_0x194b41['result']===-0x1){return _0x194b41;}logger['info'](util['format'](_0x0ce5('0x9b'),_0x39b669,_0x194b41[_0x0ce5('0x99')]));return this['channel']['setVariable'](_0x39b669,_0x194b41[_0x0ce5('0x99')]);};AGIVertices['prototype'][_0x0ce5('0x7f')]=function(_0x3b33c9){return _0x3b33c9&&_0x3b33c9!=='0'&&_0x3b33c9!=='-1'&&_0x3b33c9!=='';};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x9c')]=function(_0x464fac){this[_0x0ce5('0x9d')]['sync'](this,_0x464fac,'-');_0x464fac['retry']=_0x464fac['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0ce5('0xf')]['mrcpsynth']=function(_0x19a4c2){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x9e'),_0x19a4c2[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x19a4c2[_0x0ce5('0x58')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}var _0x267ee0='\x22'+_0x19a4c2[_0x0ce5('0x58')]+'\x22';if(this[_0x0ce5('0x7f')](_0x19a4c2[_0x0ce5('0x73')])){_0x267ee0+=','+_0x19a4c2[_0x0ce5('0x73')];}var _0x1021e8=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0xa2'),_0x267ee0);if(_0x1021e8[_0x0ce5('0xa3')]===-0x1){return _0x1021e8;}return this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xa4'),_0x267ee0));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xa5')]=function(_0x225219){logger['info'](util[_0x0ce5('0x24')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x225219[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x225219['grammar'])){return this[_0x0ce5('0xc')]['noop'](_0x0ce5('0xa6'));}var _0x3a4260=_0x225219[_0x0ce5('0xa7')];if(this['isConfigured'](_0x225219['options'])){_0x3a4260+=','+_0x225219[_0x0ce5('0x73')];}var _0x99d56c=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0xa8'),_0x3a4260);if(_0x99d56c[_0x0ce5('0xa3')]===-0x1){return _0x99d56c;}var _0x9893e0=this['getAndSetVariable'](_0x0ce5('0xa9'),'MRCP_RECOG_CONFIDENCE');if(_0x9893e0['result']===-0x1){return _0x9893e0;}var _0x12d9ed=this[_0x0ce5('0x9a')](_0x0ce5('0xaa'),_0x0ce5('0xab'));if(_0x12d9ed['result']===-0x1){return _0x12d9ed;}var _0x4b16c4=this['getAndSetVariable'](_0x0ce5('0xac'),_0x0ce5('0xad'));if(_0x4b16c4[_0x0ce5('0xa3')]===-0x1){return _0x4b16c4;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3a4260));};AGIVertices['prototype'][_0x0ce5('0xae')]=function(_0xfb086f){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xaf'),_0xfb086f[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')][_0x0ce5('0xae')]([_0xfb086f['command'],_0xfb086f[_0x0ce5('0xb0')]]);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xb1')]=function(_0x5d099f){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0xb2'),_0x5d099f[_0x0ce5('0x33')]));if(this['isConfigured'](_0x5d099f[_0x0ce5('0x62')])){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0xb3'),_0x5d099f['timeout']));var _0x349c79=this[_0x0ce5('0xc')][_0x0ce5('0xb4')](_0x5d099f[_0x0ce5('0x62')]);if(_0x349c79['result']===-0x1){return _0x349c79;}}return this['channel'][_0x0ce5('0xb1')]();};AGIVertices[_0x0ce5('0xf')]['callback']=function(_0x5864a1){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5864a1[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x5864a1[_0x0ce5('0x45')])){return this['channel'][_0x0ce5('0x2e')](_0x5864a1,'no\x20list\x20selected');}_0x5864a1[_0x0ce5('0x48')]=moment();if(this[_0x0ce5('0x7f')](_0x5864a1[_0x0ce5('0xb5')])){_0x5864a1[_0x0ce5('0x48')]=moment()['add'](_0x5864a1[_0x0ce5('0xb5')],_0x0ce5('0xb6'));}if(!this['isConfigured'](_0x5864a1[_0x0ce5('0x4a')])){_0x5864a1[_0x0ce5('0x4a')]=0x2;}this[_0x0ce5('0x3f')][_0x0ce5('0x6b')](this,_0x5864a1);return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xb7'),_0x5864a1[_0x0ce5('0xb8')],_0x5864a1[_0x0ce5('0x45')],_0x5864a1['scheduledAt']));};AGIVertices[_0x0ce5('0xf')]['custom_app']=function(_0x529801){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x529801['label']));var _0x507972=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x529801[_0x0ce5('0xb9')],_0x529801[_0x0ce5('0x73')]);if(_0x507972[_0x0ce5('0xa3')]===-0x1){return _0x507972;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xba'),_0x529801[_0x0ce5('0xb9')],_0x529801[_0x0ce5('0x73')]));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xbb')]=function(_0x2a7ccc){logger['info'](util[_0x0ce5('0x24')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2a7ccc[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x2a7ccc[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}var _0x995794='\x22'+_0x2a7ccc[_0x0ce5('0x58')]+'\x22';if(this[_0x0ce5('0x7f')](_0x2a7ccc[_0x0ce5('0x73')])){_0x995794+=','+_0x2a7ccc[_0x0ce5('0x73')];}var _0x98c7fc=this['channel']['exec'](_0x0ce5('0xa2'),_0x995794);if(_0x98c7fc[_0x0ce5('0xa3')]===-0x1){return _0x98c7fc;}return this[_0x0ce5('0xc')]['noop'](util['format'](_0x0ce5('0xa4'),_0x995794));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xbc')]=function(_0x185a34){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0xbd'),_0x185a34[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x185a34[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}var _0x47508e='\x22'+_0x185a34[_0x0ce5('0x58')]+'\x22';if(this['isConfigured'](_0x185a34[_0x0ce5('0x73')])){_0x47508e+=','+_0x185a34['options'];}var _0x3bdf50=this['channel'][_0x0ce5('0xa1')](_0x0ce5('0xa2'),_0x47508e);if(_0x3bdf50[_0x0ce5('0xa3')]===-0x1){return _0x3bdf50;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xa4'),_0x47508e));};AGIVertices['prototype'][_0x0ce5('0xbe')]=function(_0x278606){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xbf'),_0x278606['label']));if(!this[_0x0ce5('0x7f')](_0x278606['grammar'])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa6'));}var _0x4920e3=_0x278606[_0x0ce5('0xa7')];if(this[_0x0ce5('0x7f')](_0x278606[_0x0ce5('0x73')])){_0x4920e3+=','+_0x278606['options'];}var _0x5a3886=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0xa8'),_0x4920e3);if(_0x5a3886['result']===-0x1){return _0x5a3886;}var _0x1d1654=this[_0x0ce5('0x9a')](_0x0ce5('0xa9'),_0x0ce5('0xc0'));if(_0x1d1654[_0x0ce5('0xa3')]===-0x1){return _0x1d1654;}var _0x145b66=this[_0x0ce5('0x9a')]('RECOG_INPUT()',_0x0ce5('0xc1'));if(_0x145b66[_0x0ce5('0xa3')]===-0x1){return _0x145b66;}var _0x3bb994=this[_0x0ce5('0x9a')]('RECOG_INSTANCE()',_0x0ce5('0xc2'));if(_0x3bb994[_0x0ce5('0xa3')]===-0x1){return _0x3bb994;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xc3'),_0x4920e3));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xc4')]=function(_0x1960c5){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xc5'),_0x1960c5[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x1960c5[_0x0ce5('0xa7')])){return this[_0x0ce5('0xc')]['noop'](_0x0ce5('0xa6'));}var _0x2200ed=_0x1960c5[_0x0ce5('0xa7')];if(this[_0x0ce5('0x7f')](_0x1960c5['options'])){_0x2200ed+=','+_0x1960c5[_0x0ce5('0x73')];}var _0x53122f=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0xa8'),_0x2200ed);if(_0x53122f[_0x0ce5('0xa3')]===-0x1){return _0x53122f;}var _0x2d0da1=this[_0x0ce5('0x9a')](_0x0ce5('0xa9'),_0x0ce5('0xc6'));if(_0x2d0da1[_0x0ce5('0xa3')]===-0x1){return _0x2d0da1;}var _0xea6f7a=this[_0x0ce5('0x9a')](_0x0ce5('0xaa'),_0x0ce5('0xc7'));if(_0xea6f7a[_0x0ce5('0xa3')]===-0x1){return _0xea6f7a;}var _0x5b5118=this['getAndSetVariable']('RECOG_INSTANCE()',_0x0ce5('0xc8'));if(_0x5b5118[_0x0ce5('0xa3')]===-0x1){return _0x5b5118;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xc3'),_0x2200ed));};AGIVertices[_0x0ce5('0xf')]['database']=function(_0x1e79c9){logger['info'](util['format'](_0x0ce5('0xc9'),_0x1e79c9[_0x0ce5('0x33')]));if(!this['isConfigured'](_0x1e79c9['odbc_id'])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1e79c9,_0x0ce5('0xca'));}var _0x439f75=this['getSquareOdbc'][_0x0ce5('0x6b')](this,_0x1e79c9[_0x0ce5('0xcb')]);if(!_0x439f75){return this['channel'][_0x0ce5('0x2e')](_0x1e79c9,_0x0ce5('0xcc'));}if(!this['isConfigured'](_0x1e79c9[_0x0ce5('0x2b')])){return this['channel'][_0x0ce5('0x2e')](_0x1e79c9,_0x0ce5('0xcd'));}var _0x1dff31=_0x1e79c9['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xce'),_0x1dff31));var _0xaf7964=this[_0x0ce5('0x26')][_0x0ce5('0x6b')](this,_0x439f75,_0x1dff31);this['createSquareDetailsReport']['sync'](this,_0x1e79c9,_0x1dff31);if(!this[_0x0ce5('0x7f')](_0x1e79c9['variable_id'])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xcf'));}var _0x200b67=this['getVariable'][_0x0ce5('0x6b')](this,_0x1e79c9[_0x0ce5('0xd0')]);if(!_0x200b67){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1e79c9,'no\x20variable\x20found');}var _0x14a153=this;_0xaf7964['forEach'](function(_0x30f772,_0x283832){Object[_0x0ce5('0xd1')](_0x30f772)[_0x0ce5('0xd2')](function(_0x24570c){_0x14a153[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0xd3'),_0x200b67,_0x283832,_0x24570c),_0x30f772[_0x24570c]);});});this['channel']['setVariable'](util[_0x0ce5('0x24')](_0x0ce5('0xd4'),_0x200b67),_0xaf7964[_0x0ce5('0x8f')]);return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format']('variable\x20%s\x20set',_0x200b67));};AGIVertices[_0x0ce5('0xf')]['dial']=function(_0x27632f){logger[_0x0ce5('0xd5')](util[_0x0ce5('0x24')](_0x0ce5('0xd6'),_0x27632f[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x27632f[_0x0ce5('0xd7')])){return this[_0x0ce5('0xc')]['error'](_0x27632f,'no\x20user\x20selected');}var _0x3ea2a7=this[_0x0ce5('0x19')][_0x0ce5('0x6b')](this,_0x27632f[_0x0ce5('0xd7')]);if(!_0x3ea2a7){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x27632f,_0x0ce5('0xd8'));}var _0x47c770=this[_0x0ce5('0xc')][_0x0ce5('0xa1')]('DIAL',[util['format'](_0x0ce5('0xd9'),_0x3ea2a7),_0x27632f[_0x0ce5('0x62')],_0x27632f['opts'],_0x27632f[_0x0ce5('0x60')]]);if(_0x47c770[_0x0ce5('0xa3')]===-0x1){return _0x47c770;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format']('Executed\x20command\x20%s',_0x0ce5('0xda')));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xdb')]=function(_0x509f0f){logger[_0x0ce5('0x29')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x509f0f[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x509f0f[_0x0ce5('0x75')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xdc'));}if(!this[_0x0ce5('0x7f')](_0x509f0f[_0x0ce5('0x58')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}this['channel'][_0x0ce5('0xdd')]=!![];this['createSquareDetailsReport'](_0x509f0f);this[_0x0ce5('0x3e')](_0x509f0f[_0x0ce5('0x58')],'in','','');this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format']('Trying\x20Dialogflow:\x20%s',_0x509f0f[_0x0ce5('0x58')]));var _0x34cb4f=this['googleDialogflow'][_0x0ce5('0x6b')](this,_0x509f0f);if(_0x34cb4f){for(var _0x516850 in _0x34cb4f){if(_0x34cb4f[_0x0ce5('0x8b')](_0x516850)){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0xde'),_0x516850[_0x0ce5('0x66')]()),_0x34cb4f[_0x516850]);}}this[_0x0ce5('0x3e')](_0x34cb4f[_0x0ce5('0xdf')],'out','dialogflow','');return this[_0x0ce5('0xc')]['noop'](util[_0x0ce5('0x24')]('Dialogflow\x20Result\x20%s',_0x34cb4f[_0x0ce5('0xdf')]));}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x509f0f,_0x0ce5('0xe0'));};AGIVertices['prototype'][_0x0ce5('0xe1')]=function(_0x4c713f){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xe2'),_0x4c713f[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x4c713f['dialogflowV2_project_id'])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xe3'));}if(!this['isConfigured'](_0x4c713f['client_email'])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xe4'));}if(!this[_0x0ce5('0x7f')](_0x4c713f[_0x0ce5('0x79')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xe5'));}if(!this['isConfigured'](_0x4c713f[_0x0ce5('0x7a')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xe6'));}if(!this[_0x0ce5('0x7f')](_0x4c713f[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20text\x20configured');}this['channel'][_0x0ce5('0xdd')]=!![];this[_0x0ce5('0x9d')](_0x4c713f);this[_0x0ce5('0x3e')](_0x4c713f[_0x0ce5('0x58')],'in','','');this[_0x0ce5('0xc')]['noop'](util[_0x0ce5('0x24')]('Trying\x20DialogflowV2:\x20%s',_0x4c713f[_0x0ce5('0x58')]));var _0x137452=this[_0x0ce5('0x76')][_0x0ce5('0x6b')](this,_0x4c713f);if(_0x137452){for(var _0x4725e1 in _0x137452){if(_0x137452[_0x0ce5('0x8b')](_0x4725e1)){if(_0x4725e1!=='providerResponse'){this[_0x0ce5('0xc')]['setVariable'](util[_0x0ce5('0x24')](_0x0ce5('0xde'),_0x4725e1[_0x0ce5('0x66')]()),_0x137452[_0x4725e1]);}}}this[_0x0ce5('0x3e')](_0x137452['speech'],'out',_0x0ce5('0xe1'),_0x137452[_0x0ce5('0xe7')]);return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('DialogflowV2\x20Result\x20%s',_0x137452[_0x0ce5('0xdf')]));}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x4c713f,_0x0ce5('0xe8'));};AGIVertices['prototype'][_0x0ce5('0xe9')]=function(_0x82577f){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xea'),_0x82577f['label']));if(!this[_0x0ce5('0x7f')](_0x82577f[_0x0ce5('0xeb')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xec'));}if(!this[_0x0ce5('0x7f')](_0x82577f[_0x0ce5('0xed')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20username\x20configured');}if(!this[_0x0ce5('0x7f')](_0x82577f['password'])){return this[_0x0ce5('0xc')]['noop']('no\x20password\x20configured');}if(!this[_0x0ce5('0x7f')](_0x82577f['ndassistant_url'])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20text\x20configured');}this[_0x0ce5('0xc')]['bot']=!![];this['createSquareDetailsReport'](_0x82577f);this[_0x0ce5('0x3e')](_0x82577f[_0x0ce5('0x58')],'in','','');this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Trying\x20SestekNDA:\x20%s',_0x82577f[_0x0ce5('0x58')]));var _0x16284d=this[_0x0ce5('0x7b')][_0x0ce5('0x6b')](this,_0x82577f);if(_0x16284d){for(var _0x4c8a40 in _0x16284d){if(_0x16284d['hasOwnProperty'](_0x4c8a40)){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')]('SESTEK_NDA_%s',_0x4c8a40[_0x0ce5('0x66')]()),_0x16284d[_0x4c8a40]);}}this[_0x0ce5('0x3e')](_0x16284d[_0x0ce5('0xdf')],_0x0ce5('0xee'),_0x0ce5('0xe9'),'');if(_0x16284d[_0x0ce5('0xef')]){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xf0'),_0x16284d[_0x0ce5('0xef')]));var _0x42c144=this[_0x0ce5('0xc')][_0x0ce5('0xf1')](_0x16284d[_0x0ce5('0xef')]);try{fs[_0x0ce5('0xf2')](_0x16284d[_0x0ce5('0xef')]+_0x0ce5('0xf3'));}catch(_0x12f6e8){logger[_0x0ce5('0x2e')](_0x12f6e8);}return _0x42c144;}else{return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xf4'),_0x16284d[_0x0ce5('0xdf')]));}}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x82577f,_0x0ce5('0xf5'));};AGIVertices[_0x0ce5('0xf')]['end']=function(_0xdb43b2){logger[_0x0ce5('0x29')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0xdb43b2['label']));return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('end');};AGIVertices[_0x0ce5('0xf')]['ext_dial']=function(_0x1802f9){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xf6'),_0x1802f9[_0x0ce5('0x33')]));var _0x37c1b3='';if(_0x1802f9[_0x0ce5('0xf7')]){if(!this['isConfigured'](_0x1802f9[_0x0ce5('0xf7')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1802f9,_0x0ce5('0xf8'));}else{var _0x30def9=parseInt(_0x1802f9[_0x0ce5('0xf7')],0xa);if(isNaN(_0x30def9)){_0x37c1b3=_0x1802f9[_0x0ce5('0xf7')];}else{_0x37c1b3=this[_0x0ce5('0x1b')][_0x0ce5('0x6b')](this,_0x1802f9[_0x0ce5('0xf7')]);if(!_0x37c1b3){return this[_0x0ce5('0xc')]['error'](_0x1802f9,_0x0ce5('0xf9'));}}}}else if(_0x1802f9['trunk_name']){_0x37c1b3=_0x1802f9[_0x0ce5('0xfa')];}else{return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1802f9,_0x0ce5('0xf8'));}var _0x544726=this['channel']['exec'](_0x0ce5('0xda'),[util[_0x0ce5('0x24')](_0x0ce5('0xfb'),_0x37c1b3,_0x1802f9[_0x0ce5('0xb8')]),_0x1802f9[_0x0ce5('0x62')],_0x1802f9[_0x0ce5('0xfc')],_0x1802f9['url']]);if(_0x544726[_0x0ce5('0xa3')]===-0x1){return _0x544726;}return this[_0x0ce5('0xc')]['noop'](util['format'](_0x0ce5('0xfd'),_0x0ce5('0xda')));};AGIVertices[_0x0ce5('0xf')]['finally']=function(_0x49e293){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0xfe'),_0x49e293[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xff'));};AGIVertices['prototype'][_0x0ce5('0xa')]=function(_0x3d5e73){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x100'),_0x3d5e73[_0x0ce5('0x33')]));if(_0x3d5e73[_0x0ce5('0x101')]===0x0){return this[_0x0ce5('0x9c')](_0x3d5e73);}_0x3d5e73[_0x0ce5('0x101')]-=0x1;if(!this['isConfigured'](_0x3d5e73[_0x0ce5('0x102')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x3d5e73,_0x0ce5('0x103'));}var _0x421848=this[_0x0ce5('0x1c')][_0x0ce5('0x6b')](this,_0x3d5e73[_0x0ce5('0x102')]);if(!_0x421848){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x3d5e73,_0x0ce5('0x104'));}if(!this[_0x0ce5('0x7f')](_0x3d5e73[_0x0ce5('0xd0')])){return this[_0x0ce5('0xc')]['error'](_0x0ce5('0xcf'));}var _0x23824b=this[_0x0ce5('0xc')][_0x0ce5('0x105')](_0x421848,_0x3d5e73['response'],_0x3d5e73[_0x0ce5('0x106')]);var _0x311458=_0x23824b[_0x0ce5('0xa3')]?_0x23824b[_0x0ce5('0xa3')][_0x0ce5('0x49')]():'';logger[_0x0ce5('0x29')]('test',JSON['stringify'](_0x23824b));if(_0x23824b[_0x0ce5('0xa3')]===-0x1){this['createSquareDetailsReport'][_0x0ce5('0x6b')](this,_0x3d5e73,_0x311458);return _0x23824b;}else if(_0x23824b['extra']===_0x0ce5('0x62')){_0x23824b['result']=_0x311458['length']>=parseInt(_0x3d5e73[_0x0ce5('0x107')])?'x':'i';}else{_0x23824b[_0x0ce5('0xa3')]=_0x311458[_0x0ce5('0x8f')]>=parseInt(_0x3d5e73[_0x0ce5('0x107')])&&_0x311458[_0x0ce5('0x8f')]<=parseInt(_0x3d5e73[_0x0ce5('0x106')])?'x':'i';}var _0x3be551=this['getVariable']['sync'](this,_0x3d5e73['variable_id']);if(!_0x3be551){return this[_0x0ce5('0xc')]['error'](_0x3d5e73,_0x0ce5('0x108'));}this[_0x0ce5('0xc')][_0x0ce5('0x94')](_0x3be551,_0x311458);if(this[_0x0ce5('0x7f')](_0x3d5e73[_0x0ce5('0x109')])){var _0x31605f=parseInt(_0x3d5e73['hiddendigitsnum'],0xa);var _0x5557bc=rs['generate']({'charset':'*','length':_0x31605f});var _0xae0233=_0x311458[_0x0ce5('0x8f')];if(_0xae0233>0x0){if(_0xae0233>_0x31605f){this[_0x0ce5('0x9d')][_0x0ce5('0x6b')](this,_0x3d5e73,_0x3d5e73[_0x0ce5('0x10a')]==='first'?_0x5557bc+_0x311458['substr'](_0x31605f):_0x311458[_0x0ce5('0x10b')](0x0,_0xae0233-_0x31605f)+_0x5557bc);}else{this['createSquareDetailsReport']['sync'](this,_0x3d5e73,rs[_0x0ce5('0x10c')]({'charset':'*','length':_0xae0233}));}}else{this['createSquareDetailsReport'][_0x0ce5('0x6b')](this,_0x3d5e73,'');}}else{this[_0x0ce5('0x9d')][_0x0ce5('0x6b')](this,_0x3d5e73,_0x311458);}return _0x23824b;};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0xb')]=function(_0x277281){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x277281[_0x0ce5('0x33')]));return this[_0x0ce5('0xa')](_0x277281);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x10d')]=function(_0x31f547){logger[_0x0ce5('0x29')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x31f547[_0x0ce5('0x33')]));this[_0x0ce5('0x9d')][_0x0ce5('0x6b')](this,_0x31f547,_0x31f547[_0x0ce5('0x10e')]);return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x10f'),_0x31f547[_0x0ce5('0x10e')]));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x110')]=function(_0x5f04cd){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x111'),_0x5f04cd['label']));if(!this['isConfigured'](_0x5f04cd[_0x0ce5('0x82')])||!this['isConfigured'](_0x5f04cd[_0x0ce5('0x83')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x0ce5('0x7f')](_0x5f04cd[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x112'),_0x5f04cd[_0x0ce5('0x58')]));var _0x57a7cd=this[_0x0ce5('0x81')][_0x0ce5('0x6b')](this,_0x5f04cd);if(_0x57a7cd){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x113'),_0x57a7cd));var _0x38c7db=this[_0x0ce5('0xc')]['streamFile'](_0x57a7cd);try{fs[_0x0ce5('0xf2')](_0x57a7cd+'.wav');}catch(_0xd96521){logger[_0x0ce5('0x2e')](_0xd96521);}return _0x38c7db;}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x5f04cd,_0x0ce5('0x114'));};AGIVertices['prototype'][_0x0ce5('0x115')]=function(_0x15b2c7){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x116'),_0x15b2c7[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x15b2c7[_0x0ce5('0x82')])||!this[_0x0ce5('0x7f')](_0x15b2c7['aws_secret_access_key'])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x117'));}if(!this[_0x0ce5('0x7f')](_0x15b2c7[_0x0ce5('0x87')])){return this[_0x0ce5('0xc')]['noop'](_0x0ce5('0x118'));}if(!this[_0x0ce5('0x7f')](_0x15b2c7[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20text\x20configured');}this['channel'][_0x0ce5('0xdd')]=!![];this[_0x0ce5('0x9d')](_0x15b2c7);this[_0x0ce5('0x3e')](_0x15b2c7[_0x0ce5('0x58')],'in','','');this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format'](_0x0ce5('0x119'),_0x15b2c7[_0x0ce5('0x58')]));var _0x16feb3=this[_0x0ce5('0x86')][_0x0ce5('0x6b')](this,_0x15b2c7);if(_0x16feb3){for(var _0x23929e in _0x16feb3){if(_0x16feb3[_0x0ce5('0x8b')](_0x23929e)&&_[_0x0ce5('0x8c')](_0x16feb3[_0x23929e])){this['channel'][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0x11a'),_0x23929e[_0x0ce5('0x66')]()),_0x16feb3[_0x23929e]);}}if(_[_0x0ce5('0x41')](_0x16feb3[_0x0ce5('0x72')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x11b'));}else{this[_0x0ce5('0x3e')](_0x16feb3[_0x0ce5('0x72')],_0x0ce5('0xee'),'amazonlex','');return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x11c'),_0x16feb3[_0x0ce5('0x72')]));}}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x15b2c7,_0x0ce5('0x11d'));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x11e')]=function(_0x775277){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x11f'),_0x775277['label'],_0x775277[_0x0ce5('0x62')]));if(!this[_0x0ce5('0x7f')](_0x775277[_0x0ce5('0x75')])){return this['channel']['noop'](_0x0ce5('0xdc'));}var _0x260bb4=_0x0ce5('0x120');var _0x4a9fdd=util[_0x0ce5('0x24')](_0x0ce5('0x121'),FILES_PATH,rs['generate'](0x4));var _0x4dceb7=util[_0x0ce5('0x24')](_0x0ce5('0x93'),_0x4a9fdd,_0x260bb4);var _0x578e27=!![];if(_0x775277[_0x0ce5('0x122')]===_0x0ce5('0x123')){_0x578e27=![];}var _0x33c031=this['channel']['recordFile'](_0x4a9fdd,_0x260bb4,_0x775277[_0x0ce5('0x124')],_0x775277['timeout'],undefined,_0x578e27);if(_0x33c031[_0x0ce5('0xa3')]!==-0x1){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x125'),_0x4dceb7));var _0x141d13=this['googleASR'][_0x0ce5('0x6b')](this,_0x775277,_0x4dceb7);if(_0x141d13){for(var _0x20c7f8 in _0x141d13){if(_0x141d13[_0x0ce5('0x8b')](_0x20c7f8)){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')]('GOOGLE_ASR_%s',_0x20c7f8['toUpperCase']()),_0x141d13[_0x20c7f8]);}}return this[_0x0ce5('0xc')]['noop'](util[_0x0ce5('0x24')](_0x0ce5('0x126'),JSON[_0x0ce5('0x6f')](_0x141d13)));}}return _0x33c031;};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x127')]=function(_0x2e13a3){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x128'),_0x2e13a3[_0x0ce5('0x33')]));if(!this['isConfigured'](_0x2e13a3[_0x0ce5('0x89')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0x129'));}if(!this['isConfigured'](_0x2e13a3[_0x0ce5('0x12a')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20appsecret\x20configured');}var _0x4db3a2='wav';var _0x558d90=util['format'](_0x0ce5('0x121'),FILES_PATH,rs[_0x0ce5('0x10c')](0x4));var _0x53459e=util['format'](_0x0ce5('0x93'),_0x558d90,_0x4db3a2);var _0xcf5aad=!![];if(_0x2e13a3[_0x0ce5('0x122')]===_0x0ce5('0x123')){_0xcf5aad=![];}var _0x53a1be=this[_0x0ce5('0xc')]['recordFile'](_0x558d90,_0x4db3a2,_0x2e13a3[_0x0ce5('0x124')],_0x2e13a3[_0x0ce5('0x62')],undefined,_0xcf5aad);if(_0x53a1be['result']!==-0x1){this['channel']['noop'](util[_0x0ce5('0x24')](_0x0ce5('0x12b'),_0x53459e));var _0x54f9b3=this[_0x0ce5('0x12c')][_0x0ce5('0x6b')](this,_0x2e13a3,_0x53459e);if(_0x54f9b3){for(var _0x2f03da in _0x54f9b3){if(_0x54f9b3[_0x0ce5('0x8b')](_0x2f03da)){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util['format'](_0x0ce5('0x12d'),_0x2f03da[_0x0ce5('0x66')]()),_0x54f9b3[_0x2f03da]);}}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format'](_0x0ce5('0x12e'),JSON[_0x0ce5('0x6f')](_0x54f9b3)));}}return _0x53a1be;};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x12f')]=function(_0x219ae0){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x130'),_0x219ae0[_0x0ce5('0x33')]));return this['channel'][_0x0ce5('0x131')](_0x219ae0[_0x0ce5('0x132')],_0x219ae0['extension'],_0x219ae0[_0x0ce5('0x3a')]);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x133')]=function(_0x21b66f){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x134'),_0x21b66f[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x21b66f[_0x0ce5('0x135')])){return this['channel'][_0x0ce5('0x2e')](_0x21b66f,_0x0ce5('0x136'));}try{var _0x39998a=eval(_0x21b66f[_0x0ce5('0x135')])?'true':_0x0ce5('0x137');this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format'](_0x0ce5('0x138'),_0x21b66f[_0x0ce5('0x135')],_0x39998a));return{'code':0xc8,'result':_0x39998a};}catch(_0x6b7c2b){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x139')]=function(_0x49393c){logger['info'](util['format'](_0x0ce5('0x13a'),_0x49393c['label']));if(!this[_0x0ce5('0x7f')](_0x49393c['interval_id'])){return this['channel']['error'](_0x49393c,_0x0ce5('0x13b'));}var _0x3f1d50=this[_0x0ce5('0x13c')][_0x0ce5('0x6b')](this,_0x49393c[_0x0ce5('0x13d')]);if(!_0x3f1d50){return this[_0x0ce5('0xc')]['error'](_0x49393c,_0x0ce5('0x13e'));}for(var _0xe144f3=0x0;_0xe144f3<_0x3f1d50[_0x0ce5('0x8f')];_0xe144f3+=0x1){var _0x49ee3a=this[_0x0ce5('0xc')]['getVariable'](util[_0x0ce5('0x24')](_0x0ce5('0x13f'),_0x3f1d50[_0xe144f3]));if(_0x49ee3a[_0x0ce5('0xa3')]===-0x1){return _0x49ee3a;}logger['info'](util['format'](_0x0ce5('0x140'),_0x3f1d50[_0xe144f3],_0x49ee3a[_0x0ce5('0x99')]));if(_0x49ee3a['extra']===_0x0ce5('0x141')){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x140'),_0x3f1d50[_0xe144f3],_0x0ce5('0x141')));this[_0x0ce5('0xc')]['noop'](util['format'](_0x0ce5('0x140'),_0x3f1d50[_0xe144f3],_0x0ce5('0x141')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x140'),_0x3f1d50[_0xe144f3],'false'));this['channel'][_0x0ce5('0x9f')](util['format']('IFTIME\x20%s\x20%s',_0x3f1d50[_0xe144f3],_0x0ce5('0x137')));}}return{'code':0xc8,'result':_0x0ce5('0x137')};};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x142')]=function(_0x3c64f4){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3c64f4[_0x0ce5('0x33')]));return this['channel'][_0x0ce5('0x142')]();};AGIVertices['prototype'][_0x0ce5('0x143')]=function(_0x27df07){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x27df07['label']));if(!this[_0x0ce5('0x7f')](_0x27df07[_0x0ce5('0x75')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xdc'));}var _0x48b95f='wav';var _0x134948=util[_0x0ce5('0x24')](_0x0ce5('0x121'),FILES_PATH,rs['generate'](0x4));var _0x59b819=util[_0x0ce5('0x24')](_0x0ce5('0x93'),_0x134948,_0x48b95f);var _0x22bdc4=!![];if(_0x27df07[_0x0ce5('0x122')]===_0x0ce5('0x123')){_0x22bdc4=![];}var _0x30b4ec=this['channel'][_0x0ce5('0x144')](_0x134948,_0x48b95f,_0x27df07[_0x0ce5('0x124')],_0x27df07['timeout'],undefined,_0x22bdc4);if(_0x30b4ec['result']!==-0x1){this['channel']['noop'](util[_0x0ce5('0x24')]('ispeech\x20%s\x20file\x20created',_0x59b819));var _0x37757d=this[_0x0ce5('0x7d')]['sync'](this,_0x27df07,_0x59b819);if(_0x37757d){for(var _0x4746a4 in _0x37757d){if(_0x37757d[_0x0ce5('0x8b')](_0x4746a4)){this[_0x0ce5('0xc')][_0x0ce5('0x94')](util['format'](_0x0ce5('0x145'),_0x4746a4[_0x0ce5('0x66')]()),_0x37757d[_0x4746a4]);}}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x146'),JSON['stringify'](_0x37757d)));}}return _0x30b4ec;};AGIVertices[_0x0ce5('0xf')]['ispeechtts']=function(_0xb3a608){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xb3a608[_0x0ce5('0x33')]));if(!this['isConfigured'](_0xb3a608[_0x0ce5('0x75')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20key\x20configured');}if(!this[_0x0ce5('0x7f')](_0xb3a608[_0x0ce5('0x58')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Trying\x20ispeech\x20TTS\x20%s',_0xb3a608[_0x0ce5('0x58')]));var _0x4bd044=this[_0x0ce5('0x7c')][_0x0ce5('0x6b')](this,_0xb3a608);if(_0x4bd044){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x147'),_0x4bd044));var _0x4f0f8f=this['channel'][_0x0ce5('0xf1')](_0x4bd044,_0xb3a608[_0x0ce5('0x124')]);try{fs[_0x0ce5('0xf2')](_0x4bd044+_0x0ce5('0xf3'));}catch(_0x1829d9){logger[_0x0ce5('0x2e')](_0x1829d9);}return _0x4f0f8f;}return this['channel'][_0x0ce5('0x2e')](_0xb3a608,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['login']=function(_0x419786){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x148'),_0x419786['label']));if(!this[_0x0ce5('0x7f')](_0x419786[_0x0ce5('0x149')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x419786,_0x0ce5('0x14a'));}logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x14b'),this['channel'][_0x0ce5('0x36')],_0x419786[_0x0ce5('0x149')]));var _0x2575df=this[_0x0ce5('0x51')][_0x0ce5('0x6b')](this,_0x419786['findBy']);if(_0x2575df){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x14c'),this['channel'][_0x0ce5('0x36')],_0x419786[_0x0ce5('0x149')]));this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x14c'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x419786[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14d')};}else{logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x419786[_0x0ce5('0x149')]));this[_0x0ce5('0xc')]['noop'](util[_0x0ce5('0x24')](_0x0ce5('0x14e'),this[_0x0ce5('0xc')]['callerid'],_0x419786[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14f')};}};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x150')]=function(_0x19de7a){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x151'),_0x19de7a['label']));if(!this['isConfigured'](_0x19de7a[_0x0ce5('0x149')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x19de7a,_0x0ce5('0x14a'));}logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x14b'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x19de7a['findBy']));var _0xd203b2=this[_0x0ce5('0x50')][_0x0ce5('0x6b')](this,_0x19de7a[_0x0ce5('0x149')]);if(_0xd203b2){logger['info'](util['format'](_0x0ce5('0x14c'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x19de7a[_0x0ce5('0x149')]));this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x14c'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x19de7a[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14d')};}else{logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x0ce5('0x36')],_0x19de7a['findBy']));this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x19de7a[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14f')};}};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x152')]=function(_0x563a96){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x153'),_0x563a96[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x563a96[_0x0ce5('0x154')])){return this['channel']['error'](_0x563a96,_0x0ce5('0x155'));}this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x156'),_0x563a96[_0x0ce5('0x154')]));var _0x10569f=eval(_0x563a96[_0x0ce5('0x154')]);if(!this[_0x0ce5('0x7f')](_0x563a96[_0x0ce5('0xd0')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xcf'));}var _0x2a2f2d=this[_0x0ce5('0x98')][_0x0ce5('0x6b')](this,_0x563a96[_0x0ce5('0xd0')]);if(!_0x2a2f2d){return this[_0x0ce5('0xc')]['error'](_0x563a96,_0x0ce5('0x108'));}if(_[_0x0ce5('0x92')](_0x10569f)){var _0x59e312=this;_0x10569f[_0x0ce5('0xd2')](function(_0x4fc10b,_0xe176bf){_0x59e312['channel'][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0x157'),_0x2a2f2d,_0xe176bf),_0x4fc10b);});return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x158'),_0x2a2f2d));}else{return this[_0x0ce5('0xc')][_0x0ce5('0x94')](_0x2a2f2d,_0x10569f);}};AGIVertices[_0x0ce5('0xf')]['menu']=function(_0x1ea651){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x159'),_0x1ea651[_0x0ce5('0x33')]));if(_0x1ea651[_0x0ce5('0x101')]===0x0){return this[_0x0ce5('0x9c')](_0x1ea651);}_0x1ea651[_0x0ce5('0x101')]-=0x1;if(!this[_0x0ce5('0x7f')](_0x1ea651[_0x0ce5('0x102')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1ea651,'no\x20file\x20audio\x20selected');}var _0xda174c=this['getSound'][_0x0ce5('0x6b')](this,_0x1ea651[_0x0ce5('0x102')]);if(!_0xda174c){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1ea651,_0x0ce5('0x104'));}var _0xde6f02=this[_0x0ce5('0xc')][_0x0ce5('0x105')](_0xda174c,_0x1ea651['response'],_0x1ea651[_0x0ce5('0x15a')]);var _0x8677f2=_0xde6f02[_0x0ce5('0xa3')];if(_0xde6f02['result']===-0x1){this['createSquareDetailsReport'][_0x0ce5('0x6b')](this,_0x1ea651,'-1');return _0xde6f02;}else if(_0xde6f02[_0x0ce5('0x99')]==='timeout'){_0xde6f02[_0x0ce5('0xa3')]=_0xde6f02['result'][_0x0ce5('0x8f')]>0x0?_0xde6f02[_0x0ce5('0xa3')]:'t';}else if(_[_0x0ce5('0x40')](_0xde6f02[_0x0ce5('0xa3')])){_0xde6f02['result']='#';_0x8677f2='#';}if(!this['isConfigured'](_0x1ea651[_0x0ce5('0xd0')])){this[_0x0ce5('0xc')][_0x0ce5('0x9f')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5edde5=this[_0x0ce5('0x98')][_0x0ce5('0x6b')](this,_0x1ea651[_0x0ce5('0xd0')]);if(!_0x5edde5){return this[_0x0ce5('0xc')]['error'](_0x1ea651,'no\x20variable\x20found');}this[_0x0ce5('0xc')][_0x0ce5('0x94')](_0x5edde5,_0x8677f2);}this[_0x0ce5('0x9d')][_0x0ce5('0x6b')](this,_0x1ea651,_0x8677f2);return _0xde6f02;};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x9f')]=function(_0x3959a4){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x15b'),_0x3959a4[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x3959a4[_0x0ce5('0x15c')]||_0x3959a4[_0x0ce5('0x33')]);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x15d')]=function(_0x1948d0){logger[_0x0ce5('0x29')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x1948d0[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x1948d0[_0x0ce5('0x149')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1948d0,_0x0ce5('0x14a'));}logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x14b'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x1948d0['findBy']));var _0x4a939b=this[_0x0ce5('0x4b')]['sync'](this,_0x1948d0['pause_id']);var _0x2fd9f3=this[_0x0ce5('0x4d')][_0x0ce5('0x6b')](this,_0x1948d0[_0x0ce5('0x149')],_0x4a939b);if(_0x2fd9f3){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x14c'),this[_0x0ce5('0xc')]['callerid'],_0x1948d0['findBy']));this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x14c'),this['channel']['callerid'],_0x1948d0[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14d')};}else{logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x14e'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x1948d0[_0x0ce5('0x149')]));this['channel'][_0x0ce5('0x9f')](util['format'](_0x0ce5('0x14c'),this[_0x0ce5('0xc')]['callerid'],_0x1948d0['findBy']));return{'code':0xc8,'result':_0x0ce5('0x14f')};}};AGIVertices['prototype'][_0x0ce5('0x15e')]=function(_0x56c551){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x15f'),_0x56c551['label']));if(!this[_0x0ce5('0x7f')](_0x56c551['file_id'])){return this[_0x0ce5('0xc')]['error'](_0x56c551,_0x0ce5('0x103'));}var _0x1fe94=this['getSound'][_0x0ce5('0x6b')](this,_0x56c551[_0x0ce5('0x102')]);if(!_0x1fe94){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x56c551,_0x0ce5('0x104'));}var _0x496d5f=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0x160'),[_0x1fe94,_0x56c551[_0x0ce5('0xfc')]]);if(_0x496d5f[_0x0ce5('0xa3')]===-0x1){return _0x496d5f;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Executed\x20command\x20%s\x20%s',_0x0ce5('0x160'),_0x1fe94));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x161')]=function(_0x4c98ec){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x162'),_0x4c98ec[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x4c98ec[_0x0ce5('0x163')])){return this[_0x0ce5('0xc')]['error'](_0x4c98ec,_0x0ce5('0x164'));}var _0x530e4d='';var _0x1d3c89=parseInt(_0x4c98ec[_0x0ce5('0x163')],0xa);if(isNaN(_0x1d3c89)){_0x530e4d=_0x4c98ec['queue_id'];}else{_0x530e4d=this['getVoiceQueue'][_0x0ce5('0x6b')](this,_0x4c98ec[_0x0ce5('0x163')]);if(!_0x530e4d){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x4c98ec,'no\x20queue\x20found');}}var _0x48c568='';if(this[_0x0ce5('0x7f')](_0x4c98ec[_0x0ce5('0x102')])){var _0x221285=this[_0x0ce5('0x1c')][_0x0ce5('0x6b')](this,_0x4c98ec[_0x0ce5('0x102')]);if(_0x221285){_0x48c568=_0x221285;}}this['createSquareDetailsReport'][_0x0ce5('0x6b')](this,_0x4c98ec,_0x530e4d);if(_0x4c98ec[_0x0ce5('0xfc')][_0x0ce5('0x165')]('x')<0x0){_0x4c98ec[_0x0ce5('0xfc')]+='x';}if(_0x4c98ec[_0x0ce5('0xfc')][_0x0ce5('0x165')]('X')<0x0){_0x4c98ec[_0x0ce5('0xfc')]+='X';}this['channel'][_0x0ce5('0x94')]('XMCS-QUEUE',_0x530e4d?_0x530e4d['toLowerCase']():'');var _0x46faca=this[_0x0ce5('0xc')][_0x0ce5('0xa1')](_0x0ce5('0x166'),[_0x530e4d,_0x4c98ec['opts'],_0x4c98ec['url'],_0x48c568,_0x4c98ec[_0x0ce5('0x62')],_0x4c98ec[_0x0ce5('0xae')],_0x4c98ec[_0x0ce5('0x167')],_0x4c98ec[_0x0ce5('0x168')],'',_0x4c98ec[_0x0ce5('0x169')]]);if(_0x46faca['result']===-0x1){return _0x46faca;}return this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0xba'),_0x0ce5('0x166'),_0x530e4d));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x16a')]=function(_0x20495c){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x16b'),_0x20495c['label']));var _0x19b3d3=_0x20495c[_0x0ce5('0x16c')]||_0x0ce5('0x120');var _0x52c540=util[_0x0ce5('0x24')](_0x0ce5('0x16d'),this[_0x0ce5('0xc')][_0x0ce5('0x32')],rs['generate'](0x5));var _0xe9c56e=util[_0x0ce5('0x24')](_0x0ce5('0x16e'),FILES_PATH,_0x52c540,_0x19b3d3);var _0x5b82da=util[_0x0ce5('0x24')](_0x0ce5('0x121'),FILES_PATH,_0x52c540);this[_0x0ce5('0x37')][_0x0ce5('0x6b')](this,_0x20495c,_0x52c540,_0xe9c56e);this[_0x0ce5('0xc')][_0x0ce5('0x94')](_0x0ce5('0x16f'),_0x52c540);logger[_0x0ce5('0x29')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5b82da,_0x19b3d3,_0x20495c[_0x0ce5('0x170')],_0x20495c[_0x0ce5('0x62')]);return this[_0x0ce5('0xc')][_0x0ce5('0x144')](_0x5b82da,_0x19b3d3,_0x20495c[_0x0ce5('0x170')],_0x20495c['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x0ce5('0x171')]=function(_0x1357b0){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x172'),_0x1357b0[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x1357b0[_0x0ce5('0x60')])){return this['channel'][_0x0ce5('0x9f')](_0x0ce5('0x173'));}var _0x40906d=this[_0x0ce5('0x5f')][_0x0ce5('0x6b')](this,_0x1357b0);logger['info'](util['format'](_0x0ce5('0x174'),util['inspect'](_0x40906d,{'showHidden':![],'depth':null})));if(!this[_0x0ce5('0x7f')](_0x1357b0[_0x0ce5('0xd0')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x175'));}var _0x17c195=this[_0x0ce5('0x98')]['sync'](this,_0x1357b0[_0x0ce5('0xd0')]);if(!_0x17c195){return this['channel'][_0x0ce5('0x2e')](_0x1357b0,'no\x20variable\x20found');}this[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0x176'),_0x17c195),_0x40906d[_0x0ce5('0x71')]?_0x40906d[_0x0ce5('0x71')]:_0x0ce5('0x177'));this[_0x0ce5('0xc')][_0x0ce5('0x94')](util[_0x0ce5('0x24')](_0x0ce5('0x178'),_0x17c195),_0x40906d[_0x0ce5('0x179')]?_0x40906d[_0x0ce5('0x179')]:'OK');if(_0x40906d[_0x0ce5('0x67')]){try{this['saveRestApiResult'](_0x40906d['body'],_0x17c195);}catch(_0x3a0745){logger['error'](util[_0x0ce5('0x24')](_0x0ce5('0x17a'),_0x17c195));}}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x17b'),_0x17c195));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x17c')]=function(_0x374ebe){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x17d'),_0x374ebe[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')][_0x0ce5('0x17e')](_0x374ebe[_0x0ce5('0x17f')][_0x0ce5('0x55')](/\s+/g,''),_0x374ebe[_0x0ce5('0x170')]);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x180')]=function(_0x5147e3){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x181'),_0x5147e3[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')][_0x0ce5('0x182')](_0x5147e3[_0x0ce5('0x63')][_0x0ce5('0x55')](/\s+/g,''),_0x5147e3[_0x0ce5('0x170')]);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x183')]=function(_0x1791dc){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x184'),_0x1791dc[_0x0ce5('0x33')]));return this[_0x0ce5('0xc')]['sayPhonetic'](_0x1791dc[_0x0ce5('0x58')],_0x1791dc['escape_digits']);};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x185')]=function(_0x229232){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x186'),_0x229232[_0x0ce5('0x33')]));if(!this['isConfigured'](_0x229232[_0x0ce5('0x187')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x188'));}var _0x3a2809=this['getMailAccount']['sync'](this,_0x229232[_0x0ce5('0x187')]);if(!_0x3a2809||!_0x3a2809[_0x0ce5('0x189')]){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x229232,_0x0ce5('0x18a'));}var _0xcf2dde={'from':util[_0x0ce5('0x24')](_0x0ce5('0x18b'),_0x3a2809[_0x0ce5('0x17')],_0x3a2809[_0x0ce5('0x18c')]||_0x3a2809[_0x0ce5('0x189')][_0x0ce5('0x18d')]),'to':_0x229232['to']||'','cc':_0x229232['cc']||'','bcc':_0x229232[_0x0ce5('0x18e')]||'','subject':_0x229232[_0x0ce5('0x18f')],'html':_0x229232[_0x0ce5('0x58')],'text':_0x229232[_0x0ce5('0x58')]};if(this[_0x0ce5('0x7f')](_0x229232[_0x0ce5('0x190')])){}logger[_0x0ce5('0xd5')](_0x0ce5('0x191'),JSON[_0x0ce5('0x6f')](_0xcf2dde));this[_0x0ce5('0x9d')]['sync'](this,_0x229232,_0x229232[_0x0ce5('0x187')]);this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x3a2809[_0x0ce5('0x17')]));this['sendMailMessage'][_0x0ce5('0x6b')](this,_0x3a2809[_0x0ce5('0x192')],_0xcf2dde);return this[_0x0ce5('0xc')]['noop'](_0x0ce5('0x193'));};AGIVertices['prototype'][_0x0ce5('0x194')]=function(_0x4c3c8b){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x195'),_0x4c3c8b['label']));return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x196'));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x197')]=function(_0x55e3e3){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x198'),_0x55e3e3[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x55e3e3[_0x0ce5('0x199')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x19a'));}var _0x4b8ed8=this[_0x0ce5('0x2f')][_0x0ce5('0x6b')](this,_0x55e3e3[_0x0ce5('0x199')]);if(!_0x4b8ed8){return this[_0x0ce5('0xc')]['error'](_0x55e3e3,'no\x20sms\x20account\x20found');}var _0x344537={'body':_0x55e3e3['sms_text'],'phone':_0x55e3e3['to']||'','SmsAccountId':_0x4b8ed8['id']};logger['debug']('sendSMS\x20message',JSON[_0x0ce5('0x6f')](_0x344537));this[_0x0ce5('0x9d')][_0x0ce5('0x6b')](this,_0x55e3e3,_0x55e3e3['sms_account_id']);this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4b8ed8['name']));this[_0x0ce5('0x31')][_0x0ce5('0x6b')](this,_0x344537);return this['channel']['noop'](_0x0ce5('0x19b'));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x19c')]=function(_0x1486bd){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x19d'),_0x1486bd[_0x0ce5('0x33')]));if(!this['isConfigured'](_0x1486bd['variable_id'])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1486bd,_0x0ce5('0x19e'));}var _0x2fbe6f=this['getVariable'][_0x0ce5('0x6b')](this,_0x1486bd[_0x0ce5('0xd0')]);if(!_0x2fbe6f){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x1486bd,_0x0ce5('0x108'));}return this[_0x0ce5('0xc')]['setVariable'](_0x2fbe6f,_0x1486bd[_0x0ce5('0x19f')]);};AGIVertices[_0x0ce5('0xf')]['start']=function(_0x47009d){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x1a0'),_0x47009d[_0x0ce5('0x33')]));this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x1a1'));var _0x83f9fa=this[_0x0ce5('0xc')]['getVariable']('XMCS-UNIQUEID');if(!_[_0x0ce5('0x40')](_0x83f9fa['extra'])){this[_0x0ce5('0xc')][_0x0ce5('0x32')]=_0x83f9fa[_0x0ce5('0x99')];}if(_0x47009d['answer']===_0x0ce5('0x1a2')){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x1a3'));return this[_0x0ce5('0xc')][_0x0ce5('0xb1')]();}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0x1a4'));};AGIVertices['prototype'][_0x0ce5('0x1a5')]=function(_0x2513ca){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x1a6'),_0x2513ca[_0x0ce5('0x33')]));if(!this['isConfigured'](_0x2513ca[_0x0ce5('0x1a7')])){return this[_0x0ce5('0xc')]['error'](_0x2513ca,_0x0ce5('0x1a8'));}var _0x31748a=this['getSquareProject'][_0x0ce5('0x6b')](this,_0x2513ca[_0x0ce5('0x1a7')]);if(!this[_0x0ce5('0x7f')](_0x31748a)){return this['channel'][_0x0ce5('0x2e')](_0x2513ca,util['format'](_0x0ce5('0x1a9'),_0x2513ca[_0x0ce5('0x1a7')]));}if(_0x31748a===this[_0x0ce5('0xc')][_0x0ce5('0x35')]){return this[_0x0ce5('0xc')]['error'](_0x2513ca,_0x0ce5('0x1aa'));}this['createSquareDetailsReport'][_0x0ce5('0x6b')](this,_0x2513ca,_0x31748a);var _0x5c2d91=this['channel'][_0x0ce5('0xa1')](_0x0ce5('0x1ab'),util['format'](_0x0ce5('0x1ac'),config[_0x0ce5('0xae')][_0x0ce5('0x1ad')]||_0x0ce5('0x1ae'),_0x31748a,this[_0x0ce5('0xc')][_0x0ce5('0x35')]));if(_0x5c2d91['result']===-0x1){return _0x5c2d91;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Executed\x20command\x20%s\x20%s',_0x0ce5('0x1ab'),_0x31748a));};AGIVertices[_0x0ce5('0xf')]['system']=function(_0x52ef76){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x1af'),_0x52ef76['label']));var _0x1f4847=this[_0x0ce5('0x1b0')][_0x0ce5('0x6b')](this,_0x52ef76[_0x0ce5('0x1b1')]);this['createSquareDetailsReport']['sync'](this,_0x52ef76,_0x52ef76[_0x0ce5('0x1b1')]);if(this[_0x0ce5('0x7f')](_0x52ef76[_0x0ce5('0xd0')])){var _0x110389=this[_0x0ce5('0x98')][_0x0ce5('0x6b')](this,_0x52ef76['variable_id']);if(_0x110389){this[_0x0ce5('0xc')][_0x0ce5('0x94')](_0x110389,_0x1f4847);return this['channel'][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x1b2'),_0x52ef76[_0x0ce5('0x1b1')],_0x110389));}}return this[_0x0ce5('0xc')]['noop'](util['format'](_0x0ce5('0x1b3'),_0x52ef76[_0x0ce5('0x1b1')]));};AGIVertices[_0x0ce5('0xf')][_0x0ce5('0x1b4')]=function(_0x50e804){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x1b5'),_0x50e804[_0x0ce5('0x33')]));_0x50e804[_0x0ce5('0x58')]=_0x50e804[_0x0ce5('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0ce5('0x7f')](_0x50e804[_0x0ce5('0x57')])){return this[_0x0ce5('0xc')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x0ce5('0x7f')](_0x50e804[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x1b6'),_0x50e804[_0x0ce5('0x58')]));var _0x3d7277=this[_0x0ce5('0x56')][_0x0ce5('0x6b')](this,_0x50e804);if(_0x3d7277){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3d7277));var _0x104797=this[_0x0ce5('0xc')][_0x0ce5('0xf1')](_0x3d7277);try{fs['unlink'](_0x3d7277+_0x0ce5('0xf3'));}catch(_0x3d6758){logger[_0x0ce5('0x2e')](_0x3d6758);}return _0x104797;}return this['channel'][_0x0ce5('0x2e')](_0x50e804,_0x0ce5('0x1b7'));};AGIVertices[_0x0ce5('0xf')]['tts']=function(_0x2e989d){logger[_0x0ce5('0x29')](util[_0x0ce5('0x24')](_0x0ce5('0x1b8'),_0x2e989d[_0x0ce5('0x33')]));_0x2e989d[_0x0ce5('0x58')]=_0x2e989d[_0x0ce5('0x58')][_0x0ce5('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0ce5('0x7f')](_0x2e989d[_0x0ce5('0x58')])){return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](_0x0ce5('0xa0'));}this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util['format'](_0x0ce5('0x1b9'),_0x2e989d[_0x0ce5('0x58')]));var _0x2cb07d=this[_0x0ce5('0x5d')][_0x0ce5('0x6b')](this,_0x2e989d);if(_0x2cb07d){this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x1ba'),_0x2cb07d));var _0x230bd4=this[_0x0ce5('0xc')][_0x0ce5('0xf1')](_0x2cb07d);try{fs[_0x0ce5('0xf2')](_0x2cb07d+_0x0ce5('0xf3'));}catch(_0x4902b5){logger[_0x0ce5('0x2e')](_0x4902b5);}return _0x230bd4;}return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x2e989d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x0ce5('0x1bb')]=function(_0x35a4c7){logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x1bc'),_0x35a4c7['label']));if(!this[_0x0ce5('0x7f')](_0x35a4c7[_0x0ce5('0x149')])){return this[_0x0ce5('0xc')]['error'](_0x35a4c7,'no\x20find\x20by\x20configured');}logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x14b'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x35a4c7[_0x0ce5('0x149')]));var _0x1ae785=this[_0x0ce5('0x4f')]['sync'](this,_0x35a4c7[_0x0ce5('0x149')]);if(_0x1ae785){logger[_0x0ce5('0x29')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x35a4c7['findBy']));this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')](_0x0ce5('0x14c'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x35a4c7[_0x0ce5('0x149')]));return{'code':0xc8,'result':_0x0ce5('0x14d')};}else{logger['info'](util[_0x0ce5('0x24')](_0x0ce5('0x14e'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x35a4c7['findBy']));this[_0x0ce5('0xc')]['noop'](util[_0x0ce5('0x24')](_0x0ce5('0x14e'),this[_0x0ce5('0xc')][_0x0ce5('0x36')],_0x35a4c7[_0x0ce5('0x149')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0ce5('0xf')]['voicemail']=function(_0x496111){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x1bd'),_0x496111[_0x0ce5('0x33')]));var _0x3cbe27=this[_0x0ce5('0xc')]['exec'](_0x0ce5('0x1be'),[_0x496111[_0x0ce5('0x1bf')],_0x496111[_0x0ce5('0x73')]]);if(_0x3cbe27[_0x0ce5('0xa3')]===-0x1){return _0x3cbe27;}return this[_0x0ce5('0xc')][_0x0ce5('0x9f')](util[_0x0ce5('0x24')]('Executed\x20command\x20%s\x20%s',_0x0ce5('0x1be'),_0x496111[_0x0ce5('0x1bf')]));};AGIVertices[_0x0ce5('0xf')]['vswitch']=function(_0x12e37){logger[_0x0ce5('0x29')](util['format'](_0x0ce5('0x1c0'),_0x12e37[_0x0ce5('0x33')]));if(!this[_0x0ce5('0x7f')](_0x12e37[_0x0ce5('0xd0')])){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x12e37,_0x0ce5('0x19e'));}var _0x581b21=this[_0x0ce5('0x98')][_0x0ce5('0x6b')](this,_0x12e37[_0x0ce5('0xd0')]);if(!_0x581b21){return this[_0x0ce5('0xc')][_0x0ce5('0x2e')](_0x12e37,_0x0ce5('0x108'));}var _0x41dd65=this[_0x0ce5('0xc')][_0x0ce5('0x98')](_0x581b21);return{'code':0xc8,'result':_0x41dd65[_0x0ce5('0x99')]?_0x41dd65['extra']:'-'};};String[_0x0ce5('0xf')][_0x0ce5('0x97')]=function(_0x37f4ad,_0x448cbe){return this[_0x0ce5('0x96')](_0x37f4ad)['join'](_0x448cbe);};module[_0x0ce5('0x1c1')]=AGIVertices; \ No newline at end of file +var _0xac95=['Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','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','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','menu','no\x20file\x20audio\x20found','digit','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','bcc','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','mailbox','vswitch','util','lodash','shelljs','odbc','mustache','request-promise','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','then','dsn','getUser','getUserById','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','method','timeout','number','includes','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','length','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','hasOwnProperty','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%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','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal'];(function(_0x557eb0,_0x3f9f30){var _0x129850=function(_0x48cbfe){while(--_0x48cbfe){_0x557eb0['push'](_0x557eb0['shift']());}};_0x129850(++_0x3f9f30);}(_0xac95,0xa8));var _0x5ac9=function(_0x494b1a,_0x1b7232){_0x494b1a=_0x494b1a-0x0;var _0x25cc64=_0xac95[_0x494b1a];return _0x25cc64;};'use strict';var fs=require('fs');var util=require(_0x5ac9('0x0'));var _=require(_0x5ac9('0x1'));var sh=require(_0x5ac9('0x2'));var odbc=require(_0x5ac9('0x3'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x5ac9('0x4'));var rp=require(_0x5ac9('0x5'));var logger=require('../../config/logger')(_0x5ac9('0x6'));var config=require(_0x5ac9('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x5ac9('0x8');var recursiveMapAttributes=[_0x5ac9('0x9'),_0x5ac9('0xa')];var verticesWithRetry=['menu','getdigits',_0x5ac9('0xb')];var AGIVertices=function(_0x2ab11c,_0x28bc1f,_0x11660c){this[_0x5ac9('0xc')]=_0x2ab11c;this[_0x5ac9('0xd')]=_0x28bc1f;this['mailRpc']=_0x11660c;};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xf')]=function(_0x538efe,_0x28b5b9){this['rpc'][_0x5ac9('0x10')](_0x538efe)['then'](function(_0xc9dbbe){_0x28b5b9(null,_0xc9dbbe?_0xc9dbbe[_0x5ac9('0x11')]:![]);})[_0x5ac9('0x12')](function(_0x40eb62){_0x28b5b9(_0x40eb62);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x43b80d,_0x5f2d30){this[_0x5ac9('0xd')][_0x5ac9('0x13')](_0x43b80d)['then'](function(_0x3dcc9e){_0x5f2d30(null,_0x3dcc9e?_0x3dcc9e[_0x5ac9('0x11')]:![]);})[_0x5ac9('0x12')](function(_0x122590){_0x5f2d30(_0x122590);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x14')]=function(_0x44a5b1,_0x19b3a4){this[_0x5ac9('0xd')]['getSquareProjectById'](_0x44a5b1)['then'](function(_0x352874){_0x19b3a4(null,_0x352874?_0x352874[_0x5ac9('0x11')]:![]);})[_0x5ac9('0x12')](function(_0x4463ff){_0x19b3a4(_0x4463ff);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x15')]=function(_0x986be7,_0x429bf3){this[_0x5ac9('0xd')][_0x5ac9('0x16')](_0x986be7)[_0x5ac9('0x17')](function(_0x2b144e){_0x429bf3(null,_0x2b144e?_0x2b144e[_0x5ac9('0x18')]:![]);})['catch'](function(_0xdf630){_0x429bf3(_0xdf630);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x19')]=function(_0x32e65c,_0x2d2ba5){this['rpc'][_0x5ac9('0x1a')](_0x32e65c)[_0x5ac9('0x17')](function(_0x480c7e){_0x2d2ba5(null,_0x480c7e?_0x480c7e['name']:![]);})['catch'](function(_0xc36d2){_0x2d2ba5(_0xc36d2);});};AGIVertices[_0x5ac9('0xe')]['getTrunk']=function(_0x5ce83a,_0x1a6372){this['rpc']['getTrunkById'](_0x5ce83a)[_0x5ac9('0x17')](function(_0x505acc){_0x1a6372(null,_0x505acc?_0x505acc[_0x5ac9('0x11')]:![]);})[_0x5ac9('0x12')](function(_0x770c48){_0x1a6372(_0x770c48);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1b')]=function(_0x174cfe,_0x13aaa7){var _0x2dc7fa=this;this[_0x5ac9('0xd')]['getSoundById'](_0x174cfe)[_0x5ac9('0x17')](function(_0x14a7fe){_0x13aaa7(null,_0x14a7fe?_0x2dc7fa[_0x5ac9('0x1c')](_0x14a7fe[_0x5ac9('0x1d')]):![]);})[_0x5ac9('0x12')](function(_0x58c9be){_0x13aaa7(_0x58c9be);});};AGIVertices['prototype'][_0x5ac9('0x1e')]=function(_0xbf3f0,_0x4a784e){this[_0x5ac9('0xd')]['getMailAccountById'](_0xbf3f0)[_0x5ac9('0x17')](function(_0x2c85dc){_0x4a784e(null,_0x2c85dc?_0x2c85dc:![]);})[_0x5ac9('0x12')](function(_0x49901d){_0x4a784e(_0x49901d);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1f')]=function(_0x446050,_0x30fb2b,_0x5ce12f){this[_0x5ac9('0x20')]['sendMailMessage'](_0x446050,_0x30fb2b)['then'](function(){_0x5ce12f(null);})[_0x5ac9('0x12')](function(_0x53ef31){_0x5ce12f(_0x53ef31);});};AGIVertices['prototype'][_0x5ac9('0x21')]=function(_0x148d0b,_0x3e12be){this[_0x5ac9('0xd')][_0x5ac9('0x22')](_0x148d0b)[_0x5ac9('0x17')](function(_0x6225c5){if(_0x6225c5){if(_0x6225c5[_0x5ac9('0x23')]){_0x3e12be(null,[_0x6225c5[_0x5ac9('0x24')]]);}else{_0x3e12be(null,_['map'](_0x6225c5[_0x5ac9('0x25')],_0x5ac9('0x24')));}}else{_0x3e12be(null,![]);}})['catch'](function(_0x598093){_0x3e12be(_0x598093);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1c')]=function(_0x386fc3){return util[_0x5ac9('0x26')]('%s/sounds/converted/%s',FILES_PATH,_0x386fc3);};AGIVertices[_0x5ac9('0xe')]['getQueryOdbc']=function(_0x3c540f,_0x4600d8,_0x2cb1d5){odbc[_0x5ac9('0x27')](_0x3c540f,function(_0x2b9a01){if(_0x2b9a01){logger[_0x5ac9('0x28')](_0x5ac9('0x29'),_0x2b9a01);_0x2cb1d5(_0x2b9a01);}else{logger[_0x5ac9('0x2a')](_0x5ac9('0x2b'));odbc[_0x5ac9('0x2c')](_0x4600d8,function(_0x8049d0,_0x1c11eb){if(_0x8049d0){logger['info']('Error\x20executing\x20query\x20%s',_0x4600d8);_0x2cb1d5(_0x8049d0);}else{logger[_0x5ac9('0x2a')](_0x5ac9('0x2d'),_0x4600d8);odbc[_0x5ac9('0x2e')](function(_0x1adf44){if(_0x1adf44){logger[_0x5ac9('0x28')](_0x5ac9('0x2f'),_0x1adf44);}_0x2cb1d5(null,_0x1c11eb);});}});}});};AGIVertices['prototype'][_0x5ac9('0x30')]=function(_0x16b74e,_0x5640c4){this['rpc']['getSmsAccountById'](_0x16b74e)[_0x5ac9('0x17')](function(_0xc6be86){_0x5640c4(null,_0xc6be86?_0xc6be86:![]);})[_0x5ac9('0x12')](function(_0x1b4a1d){_0x5640c4(_0x1b4a1d);});};AGIVertices['prototype'][_0x5ac9('0x31')]=function(_0x494871,_0x4b407d){this[_0x5ac9('0xd')][_0x5ac9('0x31')](_0x494871)['then'](function(_0x37bad1){_0x4b407d(null,_0x37bad1);})[_0x5ac9('0x12')](function(_0x4acca3){_0x4b407d(_0x4acca3);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x32')]=function(_0x433634,_0x1caf84,_0x230daa){this[_0x5ac9('0xd')][_0x5ac9('0x32')]({'uniqueid':this[_0x5ac9('0xc')][_0x5ac9('0x33')],'node':_0x433634[_0x5ac9('0x34')],'application':_0x433634[_0x5ac9('0x35')],'data':_0x1caf84||null,'project_name':this[_0x5ac9('0xc')]['arg_1'],'callerid':this[_0x5ac9('0xc')][_0x5ac9('0x36')]})[_0x5ac9('0x17')](function(_0x554bfa){if(_0x230daa){_0x230daa(null,_0x554bfa);}})[_0x5ac9('0x12')](function(_0x28edf5){if(_0x230daa){_0x230daa(_0x28edf5);}});};AGIVertices[_0x5ac9('0xe')]['createSquareRecording']=function(_0x21f75a,_0x3044a9,_0x3bf4ba,_0x34b3c2){this[_0x5ac9('0xd')][_0x5ac9('0x37')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x5ac9('0xc')]['callerid'],'calleridname':this[_0x5ac9('0xc')]['calleridname'],'context':this[_0x5ac9('0xc')][_0x5ac9('0x38')],'extension':this[_0x5ac9('0xc')][_0x5ac9('0x39')],'priority':this[_0x5ac9('0xc')][_0x5ac9('0x3a')],'accountcode':this[_0x5ac9('0xc')][_0x5ac9('0x3b')],'dnid':this[_0x5ac9('0xc')][_0x5ac9('0x3c')],'projectName':this[_0x5ac9('0xc')]['arg_1'],'saveName':_0x3044a9,'filename':_0x21f75a[_0x5ac9('0x3d')]||_0x3044a9,'savePath':_0x3bf4ba})[_0x5ac9('0x17')](function(_0x482df4){_0x34b3c2(null,_0x482df4);})['catch'](function(_0x14a81f){_0x34b3c2(_0x14a81f);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x3e')]=function(_0x48a81e,_0x33446e,_0x281fa5,_0x1b092f,_0x831fe7){this[_0x5ac9('0xd')][_0x5ac9('0x3e')]({'uniqueid':this['channel']['uniqueid'],'body':_0x48a81e,'direction':_0x33446e,'providerName':_0x281fa5,'providerResponse':_0x1b092f})[_0x5ac9('0x17')](function(_0x1191ff){if(_0x831fe7){_0x831fe7(null,_0x1191ff);}})['catch'](function(_0x81caad){if(_0x831fe7){_0x831fe7(_0x81caad);}});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x3f')]=function(_0x1da1c8,_0x6b3995){this['rpc'][_0x5ac9('0x3f')]({'firstName':_[_0x5ac9('0x40')](_0x1da1c8[_0x5ac9('0x11')])||_['isNil'](_0x1da1c8[_0x5ac9('0x11')])?_0x5ac9('0x41')+Math[_0x5ac9('0x42')]():_0x1da1c8[_0x5ac9('0x11')],'lastName':_[_0x5ac9('0x40')](_0x1da1c8['lastName'])||_['isNil'](_0x1da1c8[_0x5ac9('0x43')])?null:_0x1da1c8['lastName'],'phone':_0x1da1c8[_0x5ac9('0x44')],'ListId':_0x1da1c8['list_id'],'scheduledat':_0x1da1c8[_0x5ac9('0x45')],'callbackUniqueid':this['channel'][_0x5ac9('0x33')],'tags':_0x5ac9('0x46'),'description':'Callback\x20scheduled\x20at\x20'+_0x1da1c8['scheduledAt'][_0x5ac9('0x47')](),'priority':_0x1da1c8[_0x5ac9('0x48')]})[_0x5ac9('0x17')](function(_0x3197aa){_0x6b3995(null,_0x3197aa);})[_0x5ac9('0x12')](function(_0x3b90d9){_0x6b3995(_0x3b90d9);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x49')]=function(_0x569b22,_0x9bb588){this['rpc'][_0x5ac9('0x4a')](_0x569b22)[_0x5ac9('0x17')](function(_0x4aee72){_0x9bb588(null,_0x4aee72?_0x4aee72[_0x5ac9('0x11')]:![]);})['catch'](function(_0x2e20d9){_0x9bb588(_0x2e20d9);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x4b')]=function(_0x388011,_0x43b245,_0x53023a){var _0x1cc0b4={'role':_0x5ac9('0x4c')};_0x1cc0b4[_0x388011]=this[_0x5ac9('0xc')]['callerid'];this[_0x5ac9('0xd')][_0x5ac9('0x4b')](_0x1cc0b4,_0x43b245,this[_0x5ac9('0xc')]['uniqueid'])[_0x5ac9('0x17')](function(_0x577f83){_0x53023a(null,_[_0x5ac9('0x4d')](_0x577f83)?![]:!![]);})[_0x5ac9('0x12')](function(_0x567fb1){logger['error'](_0x567fb1);_0x53023a(null,![]);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x4e')]=function(_0x3a0cc4,_0x2a4db2){var _0xc04894={'role':_0x5ac9('0x4c')};_0xc04894[_0x3a0cc4]=this[_0x5ac9('0xc')][_0x5ac9('0x36')];this['rpc'][_0x5ac9('0x4e')](_0xc04894)[_0x5ac9('0x17')](function(_0x51e985){_0x2a4db2(null,_['isNil'](_0x51e985)?![]:!![]);})[_0x5ac9('0x12')](function(_0x42ef92){logger['error'](_0x42ef92);_0x2a4db2(null,![]);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x4f')]=function(_0x3164ab,_0x1a22d4){var _0x3da33b={'role':_0x5ac9('0x4c')};_0x3da33b[_0x3164ab]=this[_0x5ac9('0xc')][_0x5ac9('0x36')];this[_0x5ac9('0xd')][_0x5ac9('0x4f')](_0x3da33b)[_0x5ac9('0x17')](function(_0x95bcd7){_0x1a22d4(null,_[_0x5ac9('0x4d')](_0x95bcd7)?![]:!![]);})[_0x5ac9('0x12')](function(_0x3b5233){logger['error'](_0x3b5233);_0x1a22d4(null,![]);});};AGIVertices[_0x5ac9('0xe')]['agentLogin']=function(_0x1a14d4,_0x2a490e){var _0x63df8a={'role':'agent'};_0x63df8a[_0x1a14d4]=this['channel'][_0x5ac9('0x36')];var _0x44c40c=_0x1a14d4!=_0x5ac9('0x50')?util['format'](_0x5ac9('0x51'),_0x5ac9('0x52'),this['channel']['callerid']):undefined;this[_0x5ac9('0xd')]['agentLogin'](_0x63df8a,_0x44c40c)[_0x5ac9('0x17')](function(_0x11c829){_0x2a490e(null,_[_0x5ac9('0x4d')](_0x11c829)?![]:!![]);})['catch'](function(_0x7874b4){logger[_0x5ac9('0x28')](_0x7874b4);_0x2a490e(null,![]);});};AGIVertices['prototype'][_0x5ac9('0x53')]=function(_0x3af258,_0x598aff){sh[_0x5ac9('0x54')](_[_0x5ac9('0x55')](_0x3af258),function(_0x5655bd,_0x2d1757){var _0x240de3=_0x2d1757['replace'](/(\r\n|\n|\r)/gm,'');_0x598aff(null,_0x240de3);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x56')]=function(_0x200faa,_0x49d450){scripts[_0x5ac9('0x56')](_0x200faa[_0x5ac9('0x57')],_0x200faa[_0x5ac9('0x58')]||_0x5ac9('0x59'),_0x200faa[_0x5ac9('0x59')],_0x200faa[_0x5ac9('0x5a')]||_0x5ac9('0x5b'),_0x200faa[_0x5ac9('0x5c')]||'MALE',_0x200faa[_0x5ac9('0x5d')]||_0x5ac9('0x5e'))[_0x5ac9('0x17')](function(_0x2bcf94){_0x49d450(null,_0x2bcf94);})['catch'](function(_0x3f9a78){_0x49d450(_0x3f9a78);});};AGIVertices['prototype'][_0x5ac9('0x5f')]=function(_0x416d67,_0x24153f){scripts[_0x5ac9('0x5f')](_0x416d67[_0x5ac9('0x59')],_0x416d67['google_tts_language']||'en',0x1)['then'](function(_0x4701cf){_0x24153f(null,_0x4701cf);})['catch'](function(_0x196092){_0x24153f(_0x196092);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x60')]=function(_0x23ac5d,_0x47dc0f){var _0x171afb={'uri':_0x23ac5d['url'],'method':_0x23ac5d[_0x5ac9('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x23ac5d[_0x5ac9('0x62')])===_0x5ac9('0x63')&&parseInt(_0x23ac5d[_0x5ac9('0x62')])>=0x1?parseInt(_0x23ac5d[_0x5ac9('0x62')])*0x3e8:0x5*0x3e8};if(_[_0x5ac9('0x64')]([_0x5ac9('0x65'),'PUT'],_0x171afb[_0x5ac9('0x61')]['toUpperCase']())){try{_0x171afb[_0x5ac9('0x66')]=_0x23ac5d[_0x5ac9('0xa')]?JSON[_0x5ac9('0x67')](_0x23ac5d[_0x5ac9('0xa')]):{};}catch(_0x30b66b){logger['error'](_0x5ac9('0x68'),_0x30b66b);}}try{_0x171afb[_0x5ac9('0x69')]=_0x23ac5d[_0x5ac9('0x9')]?JSON['parse'](_0x23ac5d[_0x5ac9('0x9')]):{};}catch(_0x5f47d7){logger['error'](_0x5ac9('0x6a'),_0x5f47d7);}if(_0x23ac5d[_0x5ac9('0x6b')]){try{var _0x435acb=require(_0x23ac5d[_0x5ac9('0x6b')])['sync'](this,_0x171afb);_0x171afb[_0x5ac9('0x6c')]=Mustache[_0x5ac9('0x6d')](_0x23ac5d[_0x5ac9('0x6e')],_0x435acb,{},['$$','$$']);if(_0x171afb[_0x5ac9('0x69')]){_0x171afb[_0x5ac9('0x69')]=JSON['parse'](Mustache['render'](JSON[_0x5ac9('0x6f')](_0x171afb[_0x5ac9('0x69')]),_0x435acb,{},['$$','$$']));}if(_0x171afb[_0x5ac9('0x66')]){_0x171afb['body']=JSON[_0x5ac9('0x67')](Mustache['render'](JSON[_0x5ac9('0x6f')](_0x171afb[_0x5ac9('0x66')]),_0x435acb,{},['$$','$$']));}}catch(_0x5d61d6){logger[_0x5ac9('0x28')](_0x5ac9('0x70'),_0x5d61d6);}}rp(_0x171afb)['then'](function(_0x2b5d7d){var _0x38fb29={'statusCode':_0x2b5d7d[_0x5ac9('0x71')]||0xc8,'statusMessage':_0x2b5d7d['statusMessage']||'OK','headers':_0x2b5d7d[_0x5ac9('0x69')]||{},'body':_0x2b5d7d[_0x5ac9('0x66')]||{}};_0x47dc0f(null,_0x38fb29);})[_0x5ac9('0x12')](function(_0x1856a1){var _0x234979={'statusCode':_0x1856a1[_0x5ac9('0x71')]||0x1f4,'statusMessage':_0x1856a1[_0x5ac9('0x72')]||_0x5ac9('0x73'),'headers':_0x1856a1[_0x5ac9('0x74')]['headers']||{},'body':_0x1856a1[_0x5ac9('0x74')][_0x5ac9('0x66')]||{}};_0x47dc0f(null,_0x234979);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x75')]=function(_0x5ca243,_0x4497d9){scripts[_0x5ac9('0x75')](this[_0x5ac9('0xc')][_0x5ac9('0x33')],_0x5ca243[_0x5ac9('0x76')],_0x5ca243[_0x5ac9('0x59')],_0x5ca243[_0x5ac9('0x77')]||'en')[_0x5ac9('0x17')](function(_0x1a817e){_0x4497d9(null,_0x1a817e);})[_0x5ac9('0x12')](function(_0x411327){_0x4497d9(_0x411327);});};AGIVertices['prototype'][_0x5ac9('0x78')]=function(_0x443cc8,_0x375d38){scripts[_0x5ac9('0x78')](this[_0x5ac9('0xc')][_0x5ac9('0x33')],_0x443cc8['dialogflowV2_project_id'],_0x443cc8[_0x5ac9('0x79')],_0x443cc8[_0x5ac9('0x7a')],_0x443cc8[_0x5ac9('0x59')],_0x443cc8[_0x5ac9('0x7b')]||'en')['then'](function(_0x14ae1b){_0x375d38(null,_0x14ae1b);})[_0x5ac9('0x12')](function(_0x23c3fb){_0x375d38(_0x23c3fb);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x7c')]=function(_0x36f2d0,_0x161ad6){scripts[_0x5ac9('0x7c')](this[_0x5ac9('0xc')],_0x36f2d0)[_0x5ac9('0x17')](function(_0x4cac57){_0x161ad6(null,_0x4cac57);})['catch'](function(_0x59d9f9){_0x161ad6(_0x59d9f9);});};AGIVertices[_0x5ac9('0xe')]['ispeechTTS']=function(_0x566a34,_0x28829b){scripts[_0x5ac9('0x7d')](_0x566a34[_0x5ac9('0x76')],_0x566a34[_0x5ac9('0x59')],_0x566a34[_0x5ac9('0x7e')]||_0x5ac9('0x5b'),_0x566a34[_0x5ac9('0x7f')])[_0x5ac9('0x17')](function(_0x4ca2e4){_0x28829b(null,_0x4ca2e4);})[_0x5ac9('0x12')](function(_0x5c3739){_0x28829b(_0x5c3739);});};AGIVertices[_0x5ac9('0xe')]['ispeechASR']=function(_0x5e3a20,_0x372ea4,_0x31ad83){scripts['ispeechASR'](_0x372ea4,_0x5e3a20[_0x5ac9('0x76')],_0x5e3a20[_0x5ac9('0x80')]||_0x5ac9('0x5b'),this[_0x5ac9('0x81')](_0x5e3a20[_0x5ac9('0x82')])?_0x5e3a20[_0x5ac9('0x82')]:undefined)[_0x5ac9('0x17')](function(_0x374e1e){_0x31ad83(null,_0x374e1e);})[_0x5ac9('0x12')](function(_0x1eca24){_0x31ad83(_0x1eca24);});};AGIVertices['prototype'][_0x5ac9('0x83')]=function(_0x298417,_0x2e85d5){scripts[_0x5ac9('0x83')](_0x298417[_0x5ac9('0x84')],_0x298417[_0x5ac9('0x85')],_0x298417[_0x5ac9('0x86')],_0x298417['aws_polly_voice']||_0x5ac9('0x87'),_0x298417[_0x5ac9('0x59')],_0x298417[_0x5ac9('0x88')]||'text')[_0x5ac9('0x17')](function(_0x118a83){_0x2e85d5(null,_0x118a83);})[_0x5ac9('0x12')](function(_0x1e9370){_0x2e85d5(_0x1e9370);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x89')]=function(_0xdabe32,_0x124c7e){scripts[_0x5ac9('0x89')](this[_0x5ac9('0xc')]['uniqueid'],_0xdabe32['aws_access_key_id'],_0xdabe32[_0x5ac9('0x85')],_0xdabe32['aws_lex_region'],_0xdabe32[_0x5ac9('0x59')],_0xdabe32[_0x5ac9('0x8a')])[_0x5ac9('0x17')](function(_0x5732ef){_0x124c7e(null,_0x5732ef);})['catch'](function(_0x458075){_0x124c7e(_0x458075);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x8b')]=function(_0x283f2b,_0x106b38,_0x28211c){scripts[_0x5ac9('0x8b')](_0x106b38,_0x283f2b[_0x5ac9('0x76')],_0x283f2b[_0x5ac9('0x8c')]||'en-US')[_0x5ac9('0x17')](function(_0x19d14f){_0x28211c(null,_0x19d14f);})[_0x5ac9('0x12')](function(_0x152d60){_0x28211c(_0x152d60);});};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x8d')]=function(_0x97e3dc,_0x31cf8e,_0x1e0802){scripts[_0x5ac9('0x8d')](_0x31cf8e,_0x97e3dc[_0x5ac9('0x8e')],_0x97e3dc[_0x5ac9('0x8f')],_0x97e3dc[_0x5ac9('0x6c')])[_0x5ac9('0x17')](function(_0x531f07){_0x1e0802(null,_0x531f07);})[_0x5ac9('0x12')](function(_0x250ed7){_0x1e0802(_0x250ed7);});};AGIVertices['prototype']['clear']=function(_0x500079){var _0x1bfdbc=_['includes'](verticesWithRetry,_0x500079[_0x5ac9('0x35')])?_0x500079:_[_0x5ac9('0x90')](_0x500079);for(var _0x2c9365 in _0x1bfdbc){if(_0x1bfdbc['hasOwnProperty'](_0x2c9365)){if(_0x1bfdbc[_0x2c9365]&&_[_0x5ac9('0x91')](_0x1bfdbc[_0x2c9365])){if(_[_0x5ac9('0x64')](recursiveMapAttributes,_0x2c9365)){_0x1bfdbc[_0x2c9365]=this[_0x5ac9('0x92')](_0x1bfdbc[_0x2c9365]);}else{_0x1bfdbc[_0x2c9365]=this[_0x5ac9('0x93')](_0x1bfdbc[_0x2c9365]);}}}}return _0x1bfdbc;};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x94')]=function(_0x2f21ff){for(var _0x1c7a92 in _0x2f21ff){if(_0x2f21ff['hasOwnProperty'](_0x1c7a92)){if(_[_0x5ac9('0x95')](_0x2f21ff[_0x1c7a92])){this[_0x5ac9('0x94')](_0x2f21ff[_0x1c7a92]);}else if(_[_0x5ac9('0x96')](_0x2f21ff[_0x1c7a92])){for(var _0x13808f=0x0;_0x13808f<_0x2f21ff[_0x1c7a92]['length'];_0x13808f++){this[_0x5ac9('0x94')](_0x2f21ff[_0x1c7a92][_0x13808f]);}}else if(_[_0x5ac9('0x91')](_0x2f21ff[_0x1c7a92])){_0x2f21ff[_0x1c7a92]=this[_0x5ac9('0x93')](_0x2f21ff[_0x1c7a92]);}}}};AGIVertices['prototype'][_0x5ac9('0x97')]=function(_0x5854d6,_0x53d6c6){for(var _0x272a7b in _0x5854d6){if(_0x5854d6['hasOwnProperty'](_0x272a7b)){if(_[_0x5ac9('0x95')](_0x5854d6[_0x272a7b])){if(!_[_0x5ac9('0x40')](_0x5854d6[_0x272a7b])){this[_0x5ac9('0x97')](_0x5854d6[_0x272a7b],util['format']('%s.%s',_0x53d6c6,_0x272a7b));}}else if(_[_0x5ac9('0x96')](_0x5854d6[_0x272a7b])){for(var _0x44db4e=0x0;_0x44db4e<_0x5854d6[_0x272a7b][_0x5ac9('0x98')];_0x44db4e++){this[_0x5ac9('0x97')](_0x5854d6[_0x272a7b][_0x44db4e],util[_0x5ac9('0x26')](_0x5ac9('0x99'),_0x53d6c6,_0x272a7b+'['+_0x44db4e+']'));}}else{if(!_[_0x5ac9('0x4d')](_0x5854d6[_0x272a7b])){this[_0x5ac9('0xc')][_0x5ac9('0x9a')](util[_0x5ac9('0x26')](_0x5ac9('0x99'),_0x53d6c6,_0x272a7b),_0x5854d6[_0x272a7b]);}}}}};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x92')]=function(_0x48dd13){try{var _0xa7bcec=JSON[_0x5ac9('0x67')](_0x48dd13);this[_0x5ac9('0x94')](_0xa7bcec);return JSON[_0x5ac9('0x6f')](_0xa7bcec);}catch(_0x48cf20){return this['replaceAllVariables'](_0x48dd13);}};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x93')]=function(_0x299c40){var _0x48b0e2=_0x299c40[_0x5ac9('0x9b')]('{');for(var _0x450f14=0x1;_0x450f14<_0x48b0e2[_0x5ac9('0x98')];_0x450f14+=0x1){var _0x426929=_0x48b0e2[_0x450f14]['split']('}');if(_0x426929[_0x5ac9('0x98')]>0x1){_0x299c40=_0x299c40[_0x5ac9('0x9c')]('{'+_0x426929[0x0]+'}',this[_0x5ac9('0xc')][_0x5ac9('0xf')](_0x426929[0x0])[_0x5ac9('0x9d')]||_0x426929[0x0]);}}if(_0x48b0e2[_0x5ac9('0x98')]===0x1){return _0x299c40[_0x5ac9('0x47')]();}return this[_0x5ac9('0x93')](_0x299c40);};AGIVertices[_0x5ac9('0xe')]['getAndSetVariable']=function(_0xf6e216,_0x57bd0d){var _0x48845a=this[_0x5ac9('0xc')][_0x5ac9('0xf')](_0xf6e216);if(_0x48845a[_0x5ac9('0x9e')]===-0x1){return _0x48845a;}logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x9f'),_0x57bd0d,_0x48845a[_0x5ac9('0x9d')]));return this[_0x5ac9('0xc')][_0x5ac9('0x9a')](_0x57bd0d,_0x48845a['extra']);};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x81')]=function(_0x3e65b0){return _0x3e65b0&&_0x3e65b0!=='0'&&_0x3e65b0!=='-1'&&_0x3e65b0!=='';};AGIVertices['prototype']['maxRetry']=function(_0x301cc4){this[_0x5ac9('0x32')][_0x5ac9('0xa0')](this,_0x301cc4,'-');_0x301cc4['retry']=_0x301cc4[_0x5ac9('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5ac9('0xe')]['mrcpsynth']=function(_0x184b98){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0xa2'),_0x184b98[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x184b98[_0x5ac9('0x59')])){return this['channel']['noop'](_0x5ac9('0xa3'));}var _0x16ac5a='\x22'+_0x184b98['text']+'\x22';if(this['isConfigured'](_0x184b98[_0x5ac9('0x74')])){_0x16ac5a+=','+_0x184b98['options'];}var _0x3b8db1=this[_0x5ac9('0xc')][_0x5ac9('0x54')](_0x5ac9('0xa4'),_0x16ac5a);if(_0x3b8db1[_0x5ac9('0x9e')]===-0x1){return _0x3b8db1;}return this['channel'][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0xa6'),_0x16ac5a));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xa7')]=function(_0x104e97){logger['info'](util[_0x5ac9('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x104e97['label']));if(!this[_0x5ac9('0x81')](_0x104e97['grammar'])){return this['channel'][_0x5ac9('0xa5')]('no\x20grammar\x20configured');}var _0x12243d=_0x104e97[_0x5ac9('0xa8')];if(this['isConfigured'](_0x104e97[_0x5ac9('0x74')])){_0x12243d+=','+_0x104e97['options'];}var _0x53a337=this[_0x5ac9('0xc')][_0x5ac9('0x54')](_0x5ac9('0xa9'),_0x12243d);if(_0x53a337['result']===-0x1){return _0x53a337;}var _0x60770b=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x5ac9('0xaa'));if(_0x60770b[_0x5ac9('0x9e')]===-0x1){return _0x60770b;}var _0x2aa4e2=this['getAndSetVariable']('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x2aa4e2['result']===-0x1){return _0x2aa4e2;}var _0x2ae023=this[_0x5ac9('0xab')](_0x5ac9('0xac'),_0x5ac9('0xad'));if(_0x2ae023[_0x5ac9('0x9e')]===-0x1){return _0x2ae023;}return this[_0x5ac9('0xc')]['noop'](util[_0x5ac9('0x26')](_0x5ac9('0xae'),_0x12243d));};AGIVertices['prototype']['agi']=function(_0x48f80a){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0xaf'),_0x48f80a[_0x5ac9('0x34')]));return this[_0x5ac9('0xc')][_0x5ac9('0x6')]([_0x48f80a[_0x5ac9('0xb0')],_0x48f80a['args']]);};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xb1')]=function(_0x10d34b){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0xb2'),_0x10d34b['label']));if(this[_0x5ac9('0x81')](_0x10d34b['timeout'])){logger[_0x5ac9('0x2a')](util['format'](_0x5ac9('0xb3'),_0x10d34b[_0x5ac9('0x62')]));var _0x2f2d32=this['channel'][_0x5ac9('0xb4')](_0x10d34b[_0x5ac9('0x62')]);if(_0x2f2d32[_0x5ac9('0x9e')]===-0x1){return _0x2f2d32;}}return this[_0x5ac9('0xc')]['answer']();};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x46')]=function(_0x4f269e){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0xb5'),_0x4f269e[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x4f269e[_0x5ac9('0xb6')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x4f269e,_0x5ac9('0xb7'));}_0x4f269e[_0x5ac9('0x45')]=moment();if(this[_0x5ac9('0x81')](_0x4f269e[_0x5ac9('0xb8')])){_0x4f269e[_0x5ac9('0x45')]=moment()[_0x5ac9('0xb9')](_0x4f269e[_0x5ac9('0xb8')],'minutes');}if(!this[_0x5ac9('0x81')](_0x4f269e[_0x5ac9('0x48')])){_0x4f269e['callback_priority']=0x2;}this[_0x5ac9('0x3f')][_0x5ac9('0xa0')](this,_0x4f269e);return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0xba'),_0x4f269e[_0x5ac9('0x44')],_0x4f269e[_0x5ac9('0xb6')],_0x4f269e[_0x5ac9('0x45')]));};AGIVertices['prototype'][_0x5ac9('0xbb')]=function(_0x55a3d0){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0xbc'),_0x55a3d0[_0x5ac9('0x34')]));var _0x2765b1=this[_0x5ac9('0xc')][_0x5ac9('0x54')](_0x55a3d0[_0x5ac9('0xbd')],_0x55a3d0['options']);if(_0x2765b1[_0x5ac9('0x9e')]===-0x1){return _0x2765b1;}return this['channel'][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0xbe'),_0x55a3d0[_0x5ac9('0xbd')],_0x55a3d0[_0x5ac9('0x74')]));};AGIVertices[_0x5ac9('0xe')]['lumenvoxtts']=function(_0x53043a){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0xbf'),_0x53043a[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x53043a[_0x5ac9('0x59')])){return this[_0x5ac9('0xc')]['noop'](_0x5ac9('0xa3'));}var _0x1d9edf='\x22'+_0x53043a[_0x5ac9('0x59')]+'\x22';if(this['isConfigured'](_0x53043a[_0x5ac9('0x74')])){_0x1d9edf+=','+_0x53043a[_0x5ac9('0x74')];}var _0x515b90=this[_0x5ac9('0xc')][_0x5ac9('0x54')](_0x5ac9('0xa4'),_0x1d9edf);if(_0x515b90['result']===-0x1){return _0x515b90;}return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x1d9edf));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xc0')]=function(_0x2de671){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2de671[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x2de671['text'])){return this['channel'][_0x5ac9('0xa5')](_0x5ac9('0xa3'));}var _0x3dbb45='\x22'+_0x2de671['text']+'\x22';if(this['isConfigured'](_0x2de671[_0x5ac9('0x74')])){_0x3dbb45+=','+_0x2de671[_0x5ac9('0x74')];}var _0xc07d46=this[_0x5ac9('0xc')][_0x5ac9('0x54')](_0x5ac9('0xa4'),_0x3dbb45);if(_0xc07d46[_0x5ac9('0x9e')]===-0x1){return _0xc07d46;}return this['channel'][_0x5ac9('0xa5')](util['format'](_0x5ac9('0xa6'),_0x3dbb45));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xc1')]=function(_0x5362bd){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0xc2'),_0x5362bd['label']));if(!this[_0x5ac9('0x81')](_0x5362bd['grammar'])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')]('no\x20grammar\x20configured');}var _0x4eaf55=_0x5362bd[_0x5ac9('0xa8')];if(this[_0x5ac9('0x81')](_0x5362bd[_0x5ac9('0x74')])){_0x4eaf55+=','+_0x5362bd['options'];}var _0xf99267=this[_0x5ac9('0xc')][_0x5ac9('0x54')]('MRCPRecog',_0x4eaf55);if(_0xf99267[_0x5ac9('0x9e')]===-0x1){return _0xf99267;}var _0x3a23f1=this[_0x5ac9('0xab')](_0x5ac9('0xc3'),_0x5ac9('0xc4'));if(_0x3a23f1[_0x5ac9('0x9e')]===-0x1){return _0x3a23f1;}var _0x37060f=this[_0x5ac9('0xab')](_0x5ac9('0xc5'),_0x5ac9('0xc6'));if(_0x37060f[_0x5ac9('0x9e')]===-0x1){return _0x37060f;}var _0x56f2a7=this[_0x5ac9('0xab')](_0x5ac9('0xac'),_0x5ac9('0xc7'));if(_0x56f2a7[_0x5ac9('0x9e')]===-0x1){return _0x56f2a7;}return this['channel'][_0x5ac9('0xa5')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x4eaf55));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xc8')]=function(_0x494e11){logger['info'](util[_0x5ac9('0x26')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x494e11[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x494e11['grammar'])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')]('no\x20grammar\x20configured');}var _0x57713d=_0x494e11[_0x5ac9('0xa8')];if(this[_0x5ac9('0x81')](_0x494e11[_0x5ac9('0x74')])){_0x57713d+=','+_0x494e11['options'];}var _0x419526=this[_0x5ac9('0xc')][_0x5ac9('0x54')](_0x5ac9('0xa9'),_0x57713d);if(_0x419526[_0x5ac9('0x9e')]===-0x1){return _0x419526;}var _0x27d204=this[_0x5ac9('0xab')]('RECOG_CONFIDENCE()',_0x5ac9('0xc9'));if(_0x27d204[_0x5ac9('0x9e')]===-0x1){return _0x27d204;}var _0x4ce381=this[_0x5ac9('0xab')]('RECOG_INPUT()',_0x5ac9('0xca'));if(_0x4ce381[_0x5ac9('0x9e')]===-0x1){return _0x4ce381;}var _0x1ba7f7=this['getAndSetVariable'](_0x5ac9('0xac'),_0x5ac9('0xcb'));if(_0x1ba7f7['result']===-0x1){return _0x1ba7f7;}return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0xae'),_0x57713d));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xcc')]=function(_0xdcc296){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0xcd'),_0xdcc296[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0xdcc296[_0x5ac9('0xce')])){return this['channel'][_0x5ac9('0x28')](_0xdcc296,_0x5ac9('0xcf'));}var _0x2b8155=this[_0x5ac9('0x15')][_0x5ac9('0xa0')](this,_0xdcc296[_0x5ac9('0xce')]);if(!_0x2b8155){return this['channel']['error'](_0xdcc296,'no\x20odbc\x20database\x20found');}if(!this[_0x5ac9('0x81')](_0xdcc296[_0x5ac9('0x2c')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0xdcc296,'no\x20query\x20configured');}var _0x5404d6=_0xdcc296['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x5ac9('0xc')]['noop'](util[_0x5ac9('0x26')](_0x5ac9('0xd0'),_0x5404d6));var _0x392bfa=this[_0x5ac9('0xd1')][_0x5ac9('0xa0')](this,_0x2b8155,_0x5404d6);this[_0x5ac9('0x32')][_0x5ac9('0xa0')](this,_0xdcc296,_0x5404d6);if(!this['isConfigured'](_0xdcc296[_0x5ac9('0xd2')])){return this[_0x5ac9('0xc')]['noop'](_0x5ac9('0xd3'));}var _0x2bbe72=this[_0x5ac9('0xf')][_0x5ac9('0xa0')](this,_0xdcc296[_0x5ac9('0xd2')]);if(!_0x2bbe72){return this['channel'][_0x5ac9('0x28')](_0xdcc296,_0x5ac9('0xd4'));}var _0x429f32=this;_0x392bfa['forEach'](function(_0x309fe8,_0x278d31){Object[_0x5ac9('0xd5')](_0x309fe8)[_0x5ac9('0xd6')](function(_0x2c5601){_0x429f32[_0x5ac9('0xc')][_0x5ac9('0x9a')](util[_0x5ac9('0x26')](_0x5ac9('0xd7'),_0x2bbe72,_0x278d31,_0x2c5601),_0x309fe8[_0x2c5601]);});});this['channel']['setVariable'](util[_0x5ac9('0x26')](_0x5ac9('0xd8'),_0x2bbe72),_0x392bfa[_0x5ac9('0x98')]);return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0xd9'),_0x2bbe72));};AGIVertices[_0x5ac9('0xe')]['dial']=function(_0x44e099){logger['debug'](util[_0x5ac9('0x26')](_0x5ac9('0xda'),_0x44e099[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x44e099['sip_id'])){return this[_0x5ac9('0xc')]['error'](_0x44e099,_0x5ac9('0xdb'));}var _0x2c4952=this['getUser'][_0x5ac9('0xa0')](this,_0x44e099[_0x5ac9('0xdc')]);if(!_0x2c4952){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x44e099,_0x5ac9('0xdd'));}var _0x36fad4=this[_0x5ac9('0xc')][_0x5ac9('0x54')](_0x5ac9('0xde'),[util[_0x5ac9('0x26')]('SIP/%s',_0x2c4952),_0x44e099[_0x5ac9('0x62')],_0x44e099[_0x5ac9('0xdf')],_0x44e099[_0x5ac9('0x6e')]]);if(_0x36fad4['result']===-0x1){return _0x36fad4;}return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util['format'](_0x5ac9('0xe0'),_0x5ac9('0xde')));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xe1')]=function(_0xf2e606){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0xe2'),_0xf2e606['label']));if(!this[_0x5ac9('0x81')](_0xf2e606['key'])){return this['channel']['noop'](_0x5ac9('0xe3'));}if(!this[_0x5ac9('0x81')](_0xf2e606[_0x5ac9('0x59')])){return this[_0x5ac9('0xc')]['noop']('no\x20text\x20configured');}this[_0x5ac9('0xc')][_0x5ac9('0xe4')]=!![];this['createSquareDetailsReport'](_0xf2e606);this[_0x5ac9('0x3e')](_0xf2e606[_0x5ac9('0x59')],'in','','');this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0xe5'),_0xf2e606[_0x5ac9('0x59')]));var _0xcf906e=this[_0x5ac9('0x75')]['sync'](this,_0xf2e606);if(_0xcf906e){for(var _0x28d836 in _0xcf906e){if(_0xcf906e[_0x5ac9('0xe6')](_0x28d836)){this[_0x5ac9('0xc')]['setVariable'](util[_0x5ac9('0x26')](_0x5ac9('0xe7'),_0x28d836[_0x5ac9('0xe8')]()),_0xcf906e[_0x28d836]);}}this[_0x5ac9('0x3e')](_0xcf906e[_0x5ac9('0xe9')],_0x5ac9('0xea'),_0x5ac9('0xe1'),'');return this[_0x5ac9('0xc')]['noop'](util['format'](_0x5ac9('0xeb'),_0xcf906e['speech']));}return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0xf2e606,_0x5ac9('0xec'));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xed')]=function(_0x108615){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x108615['label']));if(!this['isConfigured'](_0x108615[_0x5ac9('0xee')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')]('no\x20project_id\x20configured');}if(!this[_0x5ac9('0x81')](_0x108615[_0x5ac9('0x79')])){return this['channel'][_0x5ac9('0xa5')](_0x5ac9('0xef'));}if(!this[_0x5ac9('0x81')](_0x108615['private_key'])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0xf0'));}if(!this['isConfigured'](_0x108615[_0x5ac9('0x7b')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0xf1'));}if(!this[_0x5ac9('0x81')](_0x108615[_0x5ac9('0x59')])){return this['channel'][_0x5ac9('0xa5')](_0x5ac9('0xa3'));}this[_0x5ac9('0xc')]['bot']=!![];this[_0x5ac9('0x32')](_0x108615);this[_0x5ac9('0x3e')](_0x108615[_0x5ac9('0x59')],'in','','');this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util['format'](_0x5ac9('0xf2'),_0x108615['text']));var _0x57a7b5=this[_0x5ac9('0x78')]['sync'](this,_0x108615);if(_0x57a7b5){for(var _0x3858e7 in _0x57a7b5){if(_0x57a7b5[_0x5ac9('0xe6')](_0x3858e7)){if(_0x3858e7!==_0x5ac9('0xf3')){this[_0x5ac9('0xc')]['setVariable'](util[_0x5ac9('0x26')]('DIALOGFLOW_%s',_0x3858e7['toUpperCase']()),_0x57a7b5[_0x3858e7]);}}}this['createSquareMessage'](_0x57a7b5['speech'],'out','dialogflowV2',_0x57a7b5[_0x5ac9('0xf3')]);return this['channel'][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0xf4'),_0x57a7b5['speech']));}return this[_0x5ac9('0xc')]['error'](_0x108615,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xf5')]=function(_0x1e0761){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0xf6'),_0x1e0761['label']));if(!this[_0x5ac9('0x81')](_0x1e0761[_0x5ac9('0xf7')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0xf8'));}if(!this[_0x5ac9('0x81')](_0x1e0761[_0x5ac9('0xf9')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0xfa'));}if(!this[_0x5ac9('0x81')](_0x1e0761[_0x5ac9('0xfb')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0xfc'));}if(!this[_0x5ac9('0x81')](_0x1e0761[_0x5ac9('0xfd')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')]('no\x20text\x20configured');}this[_0x5ac9('0xc')]['bot']=!![];this[_0x5ac9('0x32')](_0x1e0761);this[_0x5ac9('0x3e')](_0x1e0761['text'],'in','','');this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0xfe'),_0x1e0761[_0x5ac9('0x59')]));var _0x59762b=this['sestekNDA']['sync'](this,_0x1e0761);if(_0x59762b){for(var _0x3bac02 in _0x59762b){if(_0x59762b[_0x5ac9('0xe6')](_0x3bac02)){this[_0x5ac9('0xc')][_0x5ac9('0x9a')](util[_0x5ac9('0x26')]('SESTEK_NDA_%s',_0x3bac02[_0x5ac9('0xe8')]()),_0x59762b[_0x3bac02]);}}this[_0x5ac9('0x3e')](_0x59762b[_0x5ac9('0xe9')],_0x5ac9('0xea'),_0x5ac9('0xf5'),'');if(_0x59762b[_0x5ac9('0xff')]){this['channel'][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x100'),_0x59762b['audiofile']));var _0x2f0f82=this[_0x5ac9('0xc')][_0x5ac9('0x101')](_0x59762b[_0x5ac9('0xff')]);try{fs[_0x5ac9('0x102')](_0x59762b['audiofile']+_0x5ac9('0x103'));}catch(_0x3b20f6){logger['error'](_0x3b20f6);}return _0x2f0f82;}else{return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')]('SestekNDA\x20Result\x20%s',_0x59762b[_0x5ac9('0xe9')]));}}return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x1e0761,_0x5ac9('0x104'));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x105')]=function(_0x160b5f){logger[_0x5ac9('0x2a')](util['format'](_0x5ac9('0x106'),_0x160b5f[_0x5ac9('0x34')]));return this['channel']['noop']('end');};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x107')]=function(_0x18364e){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x108'),_0x18364e[_0x5ac9('0x34')]));var _0x28d99f='';if(_0x18364e['trunk_id']){if(!this[_0x5ac9('0x81')](_0x18364e[_0x5ac9('0x109')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x18364e,'no\x20trunk\x20selected');}else{var _0x367ad6=parseInt(_0x18364e[_0x5ac9('0x109')],0xa);if(isNaN(_0x367ad6)){_0x28d99f=_0x18364e[_0x5ac9('0x109')];}else{_0x28d99f=this[_0x5ac9('0x10a')][_0x5ac9('0xa0')](this,_0x18364e[_0x5ac9('0x109')]);if(!_0x28d99f){return this[_0x5ac9('0xc')]['error'](_0x18364e,_0x5ac9('0x10b'));}}}}else if(_0x18364e[_0x5ac9('0x10c')]){_0x28d99f=_0x18364e[_0x5ac9('0x10c')];}else{return this['channel'][_0x5ac9('0x28')](_0x18364e,_0x5ac9('0x10d'));}var _0x3ecbc3=this[_0x5ac9('0xc')]['exec'](_0x5ac9('0xde'),[util[_0x5ac9('0x26')](_0x5ac9('0x10e'),_0x28d99f,_0x18364e[_0x5ac9('0x44')]),_0x18364e[_0x5ac9('0x62')],_0x18364e[_0x5ac9('0xdf')],_0x18364e[_0x5ac9('0x6e')]]);if(_0x3ecbc3[_0x5ac9('0x9e')]===-0x1){return _0x3ecbc3;}return this[_0x5ac9('0xc')]['noop'](util[_0x5ac9('0x26')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x5ac9('0xe')]['finally']=function(_0x387400){logger[_0x5ac9('0x2a')](util['format'](_0x5ac9('0x10f'),_0x387400[_0x5ac9('0x34')]));return this['channel'][_0x5ac9('0xa5')](_0x5ac9('0x110'));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x111')]=function(_0x3fbb67){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x112'),_0x3fbb67[_0x5ac9('0x34')]));if(_0x3fbb67[_0x5ac9('0x113')]===0x0){return this[_0x5ac9('0xa1')](_0x3fbb67);}_0x3fbb67['retry']-=0x1;if(!this[_0x5ac9('0x81')](_0x3fbb67['file_id'])){return this['channel'][_0x5ac9('0x28')](_0x3fbb67,_0x5ac9('0x114'));}var _0x290768=this[_0x5ac9('0x1b')][_0x5ac9('0xa0')](this,_0x3fbb67[_0x5ac9('0x115')]);if(!_0x290768){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x3fbb67,'no\x20file\x20audio\x20found');}if(!this[_0x5ac9('0x81')](_0x3fbb67[_0x5ac9('0xd2')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x5ac9('0xd3'));}var _0x263a77=this[_0x5ac9('0xc')][_0x5ac9('0x116')](_0x290768,_0x3fbb67[_0x5ac9('0x117')],_0x3fbb67[_0x5ac9('0x118')]);var _0x30f0e5=_0x263a77[_0x5ac9('0x9e')]?_0x263a77[_0x5ac9('0x9e')][_0x5ac9('0x47')]():'';logger[_0x5ac9('0x2a')](_0x5ac9('0x119'),JSON['stringify'](_0x263a77));if(_0x263a77[_0x5ac9('0x9e')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x3fbb67,_0x30f0e5);return _0x263a77;}else if(_0x263a77[_0x5ac9('0x9d')]===_0x5ac9('0x62')){_0x263a77[_0x5ac9('0x9e')]=_0x30f0e5[_0x5ac9('0x98')]>=parseInt(_0x3fbb67['mindigit'])?'x':'i';}else{_0x263a77[_0x5ac9('0x9e')]=_0x30f0e5[_0x5ac9('0x98')]>=parseInt(_0x3fbb67[_0x5ac9('0x11a')])&&_0x30f0e5[_0x5ac9('0x98')]<=parseInt(_0x3fbb67[_0x5ac9('0x118')])?'x':'i';}var _0x38cd17=this[_0x5ac9('0xf')][_0x5ac9('0xa0')](this,_0x3fbb67[_0x5ac9('0xd2')]);if(!_0x38cd17){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x3fbb67,'no\x20variable\x20found');}this[_0x5ac9('0xc')][_0x5ac9('0x9a')](_0x38cd17,_0x30f0e5);if(this[_0x5ac9('0x81')](_0x3fbb67[_0x5ac9('0x11b')])){var _0x1f7210=parseInt(_0x3fbb67[_0x5ac9('0x11b')],0xa);var _0x1a391d=rs[_0x5ac9('0x11c')]({'charset':'*','length':_0x1f7210});var _0x44d90e=_0x30f0e5[_0x5ac9('0x98')];if(_0x44d90e>0x0){if(_0x44d90e>_0x1f7210){this[_0x5ac9('0x32')][_0x5ac9('0xa0')](this,_0x3fbb67,_0x3fbb67['hiddendigitspos']===_0x5ac9('0x11d')?_0x1a391d+_0x30f0e5[_0x5ac9('0x11e')](_0x1f7210):_0x30f0e5['substr'](0x0,_0x44d90e-_0x1f7210)+_0x1a391d);}else{this['createSquareDetailsReport']['sync'](this,_0x3fbb67,rs[_0x5ac9('0x11c')]({'charset':'*','length':_0x44d90e}));}}else{this[_0x5ac9('0x32')][_0x5ac9('0xa0')](this,_0x3fbb67,'');}}else{this['createSquareDetailsReport'][_0x5ac9('0xa0')](this,_0x3fbb67,_0x30f0e5);}return _0x263a77;};AGIVertices['prototype'][_0x5ac9('0xb')]=function(_0x17021b){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x11f'),_0x17021b['label']));return this[_0x5ac9('0x111')](_0x17021b);};AGIVertices['prototype'][_0x5ac9('0x120')]=function(_0x54f555){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x121'),_0x54f555[_0x5ac9('0x34')]));this[_0x5ac9('0x32')]['sync'](this,_0x54f555,_0x54f555['goalname']);return this['channel']['noop'](util[_0x5ac9('0x26')](_0x5ac9('0x122'),_0x54f555[_0x5ac9('0x123')]));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x124')]=function(_0x2f1bc4){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x125'),_0x2f1bc4[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x2f1bc4['aws_access_key_id'])||!this['isConfigured'](_0x2f1bc4[_0x5ac9('0x85')])){return this['channel'][_0x5ac9('0xa5')](_0x5ac9('0x126'));}if(!this['isConfigured'](_0x2f1bc4['text'])){return this[_0x5ac9('0xc')]['noop']('no\x20text\x20configured');}this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x127'),_0x2f1bc4['text']));var _0x38fa7c=this['awsPolly'][_0x5ac9('0xa0')](this,_0x2f1bc4);if(_0x38fa7c){this['channel']['noop'](util[_0x5ac9('0x26')](_0x5ac9('0x128'),_0x38fa7c));var _0x5dd71a=this[_0x5ac9('0xc')]['streamFile'](_0x38fa7c);try{fs[_0x5ac9('0x102')](_0x38fa7c+_0x5ac9('0x103'));}catch(_0x5beac1){logger[_0x5ac9('0x28')](_0x5beac1);}return _0x5dd71a;}return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x2f1bc4,_0x5ac9('0x129'));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x12a')]=function(_0x24d915){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x12b'),_0x24d915[_0x5ac9('0x34')]));if(!this['isConfigured'](_0x24d915[_0x5ac9('0x84')])||!this[_0x5ac9('0x81')](_0x24d915[_0x5ac9('0x85')])){return this[_0x5ac9('0xc')]['noop'](_0x5ac9('0x126'));}if(!this[_0x5ac9('0x81')](_0x24d915[_0x5ac9('0x8a')])){return this['channel'][_0x5ac9('0xa5')](_0x5ac9('0x12c'));}if(!this[_0x5ac9('0x81')](_0x24d915[_0x5ac9('0x59')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0xa3'));}this[_0x5ac9('0xc')][_0x5ac9('0xe4')]=!![];this[_0x5ac9('0x32')](_0x24d915);this[_0x5ac9('0x3e')](_0x24d915['text'],'in','','');this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x12d'),_0x24d915[_0x5ac9('0x59')]));var _0x1cb66a=this[_0x5ac9('0x89')][_0x5ac9('0xa0')](this,_0x24d915);if(_0x1cb66a){for(var _0x3c585f in _0x1cb66a){if(_0x1cb66a[_0x5ac9('0xe6')](_0x3c585f)&&_[_0x5ac9('0x91')](_0x1cb66a[_0x3c585f])){this[_0x5ac9('0xc')]['setVariable'](util[_0x5ac9('0x26')](_0x5ac9('0x12e'),_0x3c585f[_0x5ac9('0xe8')]()),_0x1cb66a[_0x3c585f]);}}if(_[_0x5ac9('0x4d')](_0x1cb66a['message'])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x5ac9('0x3e')](_0x1cb66a[_0x5ac9('0x72')],_0x5ac9('0xea'),_0x5ac9('0x12f'),'');return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x130'),_0x1cb66a['message']));}}return this[_0x5ac9('0xc')]['error'](_0x24d915,_0x5ac9('0x131'));};AGIVertices['prototype']['googleasr']=function(_0x538bc1){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x132'),_0x538bc1[_0x5ac9('0x34')],_0x538bc1[_0x5ac9('0x62')]));if(!this[_0x5ac9('0x81')](_0x538bc1[_0x5ac9('0x76')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0xe3'));}var _0x912f76=_0x5ac9('0x133');var _0x1d65ac=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x5ac9('0x11c')](0x4));var _0x313d62=util[_0x5ac9('0x26')]('%s.%s',_0x1d65ac,_0x912f76);var _0x555fa7=!![];if(_0x538bc1[_0x5ac9('0x134')]===_0x5ac9('0x135')){_0x555fa7=![];}var _0x90b00c=this[_0x5ac9('0xc')][_0x5ac9('0x136')](_0x1d65ac,_0x912f76,_0x538bc1[_0x5ac9('0x137')],_0x538bc1['timeout'],undefined,_0x555fa7);if(_0x90b00c[_0x5ac9('0x9e')]!==-0x1){this[_0x5ac9('0xc')]['noop'](util[_0x5ac9('0x26')](_0x5ac9('0x138'),_0x313d62));var _0x277a71=this[_0x5ac9('0x8b')]['sync'](this,_0x538bc1,_0x313d62);if(_0x277a71){for(var _0x17543e in _0x277a71){if(_0x277a71[_0x5ac9('0xe6')](_0x17543e)){this['channel'][_0x5ac9('0x9a')](util[_0x5ac9('0x26')](_0x5ac9('0x139'),_0x17543e[_0x5ac9('0xe8')]()),_0x277a71[_0x17543e]);}}return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')]('GoogleASR\x20Result\x20%s',JSON[_0x5ac9('0x6f')](_0x277a71)));}}return _0x90b00c;};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x13a')]=function(_0x131488){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x131488[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x131488['appid'])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0x13b'));}if(!this['isConfigured'](_0x131488[_0x5ac9('0x8f')])){return this['channel'][_0x5ac9('0xa5')](_0x5ac9('0x13c'));}var _0x173aba='wav';var _0x3637b4=util[_0x5ac9('0x26')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4ca245=util[_0x5ac9('0x26')](_0x5ac9('0x99'),_0x3637b4,_0x173aba);var _0x131d7=!![];if(_0x131488[_0x5ac9('0x134')]===_0x5ac9('0x135')){_0x131d7=![];}var _0x145091=this[_0x5ac9('0xc')][_0x5ac9('0x136')](_0x3637b4,_0x173aba,_0x131488[_0x5ac9('0x137')],_0x131488[_0x5ac9('0x62')],undefined,_0x131d7);if(_0x145091['result']!==-0x1){this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x13d'),_0x4ca245));var _0x25b4a7=this[_0x5ac9('0x8d')][_0x5ac9('0xa0')](this,_0x131488,_0x4ca245);if(_0x25b4a7){for(var _0x65744f in _0x25b4a7){if(_0x25b4a7[_0x5ac9('0xe6')](_0x65744f)){this[_0x5ac9('0xc')][_0x5ac9('0x9a')](util[_0x5ac9('0x26')](_0x5ac9('0x13e'),_0x65744f[_0x5ac9('0xe8')]()),_0x25b4a7[_0x65744f]);}}return this['channel'][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x13f'),JSON[_0x5ac9('0x6f')](_0x25b4a7)));}}return _0x145091;};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x140')]=function(_0x3d153f){logger['info'](util[_0x5ac9('0x26')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3d153f[_0x5ac9('0x34')]));return this[_0x5ac9('0xc')][_0x5ac9('0x141')](_0x3d153f[_0x5ac9('0x38')],_0x3d153f[_0x5ac9('0x39')],_0x3d153f[_0x5ac9('0x3a')]);};AGIVertices['prototype'][_0x5ac9('0x142')]=function(_0x405e65){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x143'),_0x405e65['label']));if(!this[_0x5ac9('0x81')](_0x405e65[_0x5ac9('0x144')])){return this['channel'][_0x5ac9('0x28')](_0x405e65,_0x5ac9('0x145'));}try{var _0x44f16a=eval(_0x405e65[_0x5ac9('0x144')])?_0x5ac9('0x146'):'false';this[_0x5ac9('0xc')]['noop'](util[_0x5ac9('0x26')](_0x5ac9('0x147'),_0x405e65[_0x5ac9('0x144')],_0x44f16a));return{'code':0xc8,'result':_0x44f16a};}catch(_0x36652f){return{'code':0xc8,'result':_0x5ac9('0x148')};}};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x149')]=function(_0x99a0a4){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x14a'),_0x99a0a4[_0x5ac9('0x34')]));if(!this['isConfigured'](_0x99a0a4[_0x5ac9('0x14b')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x99a0a4,'no\x20interval\x20configured');}var _0x26a4ef=this[_0x5ac9('0x21')][_0x5ac9('0xa0')](this,_0x99a0a4[_0x5ac9('0x14b')]);if(!_0x26a4ef){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x99a0a4,_0x5ac9('0x14c'));}for(var _0x5b117d=0x0;_0x5b117d<_0x26a4ef['length'];_0x5b117d+=0x1){var _0x4226a9=this[_0x5ac9('0xc')][_0x5ac9('0xf')](util[_0x5ac9('0x26')](_0x5ac9('0x14d'),_0x26a4ef[_0x5b117d]));if(_0x4226a9[_0x5ac9('0x9e')]===-0x1){return _0x4226a9;}logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('IFTIME\x20%s\x20%s',_0x26a4ef[_0x5b117d],_0x4226a9[_0x5ac9('0x9d')]));if(_0x4226a9[_0x5ac9('0x9d')]===_0x5ac9('0x146')){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x14e'),_0x26a4ef[_0x5b117d],_0x5ac9('0x146')));this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x14e'),_0x26a4ef[_0x5b117d],_0x5ac9('0x146')));return{'code':0xc8,'result':'true'};}else{logger[_0x5ac9('0x2a')](util['format'](_0x5ac9('0x14e'),_0x26a4ef[_0x5b117d],'false'));this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x14e'),_0x26a4ef[_0x5b117d],_0x5ac9('0x148')));}}return{'code':0xc8,'result':_0x5ac9('0x148')};};AGIVertices[_0x5ac9('0xe')]['hangup']=function(_0x364f0c){logger['info'](util['format'](_0x5ac9('0x14f'),_0x364f0c[_0x5ac9('0x34')]));return this[_0x5ac9('0xc')][_0x5ac9('0x150')]();};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x151')]=function(_0x2d9bd6){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x152'),_0x2d9bd6['label']));if(!this['isConfigured'](_0x2d9bd6[_0x5ac9('0x76')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0xe3'));}var _0x190682='wav';var _0x32f86e=util[_0x5ac9('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0x5ac9('0x11c')](0x4));var _0x5efeee=util[_0x5ac9('0x26')](_0x5ac9('0x99'),_0x32f86e,_0x190682);var _0x57b5ff=!![];if(_0x2d9bd6[_0x5ac9('0x134')]===_0x5ac9('0x135')){_0x57b5ff=![];}var _0x5c7408=this[_0x5ac9('0xc')][_0x5ac9('0x136')](_0x32f86e,_0x190682,_0x2d9bd6[_0x5ac9('0x137')],_0x2d9bd6['timeout'],undefined,_0x57b5ff);if(_0x5c7408[_0x5ac9('0x9e')]!==-0x1){this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')]('ispeech\x20%s\x20file\x20created',_0x5efeee));var _0x444622=this[_0x5ac9('0x153')]['sync'](this,_0x2d9bd6,_0x5efeee);if(_0x444622){for(var _0x4d2d83 in _0x444622){if(_0x444622[_0x5ac9('0xe6')](_0x4d2d83)){this[_0x5ac9('0xc')][_0x5ac9('0x9a')](util['format'](_0x5ac9('0x154'),_0x4d2d83[_0x5ac9('0xe8')]()),_0x444622[_0x4d2d83]);}}return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x155'),JSON[_0x5ac9('0x6f')](_0x444622)));}}return _0x5c7408;};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x156')]=function(_0x389bff){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x157'),_0x389bff[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x389bff[_0x5ac9('0x76')])){return this[_0x5ac9('0xc')]['noop']('no\x20key\x20configured');}if(!this['isConfigured'](_0x389bff['text'])){return this['channel'][_0x5ac9('0xa5')](_0x5ac9('0xa3'));}this[_0x5ac9('0xc')]['noop'](util['format'](_0x5ac9('0x158'),_0x389bff[_0x5ac9('0x59')]));var _0x3448a7=this[_0x5ac9('0x7d')][_0x5ac9('0xa0')](this,_0x389bff);if(_0x3448a7){this['channel']['noop'](util[_0x5ac9('0x26')]('ispeech\x20%s\x20file\x20created',_0x3448a7));var _0x4b5ce9=this['channel'][_0x5ac9('0x101')](_0x3448a7,_0x389bff[_0x5ac9('0x137')]);try{fs[_0x5ac9('0x102')](_0x3448a7+_0x5ac9('0x103'));}catch(_0x595dc1){logger[_0x5ac9('0x28')](_0x595dc1);}return _0x4b5ce9;}return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x389bff,_0x5ac9('0x159'));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x15a')]=function(_0x2eb11d){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x15b'),_0x2eb11d['label']));if(!this[_0x5ac9('0x81')](_0x2eb11d['findBy'])){return this[_0x5ac9('0xc')]['error'](_0x2eb11d,'no\x20find\x20by\x20configured');}logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x15c'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0x2eb11d[_0x5ac9('0x15d')]));var _0x2d9abb=this[_0x5ac9('0x15e')][_0x5ac9('0xa0')](this,_0x2eb11d['findBy']);if(_0x2d9abb){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x15f'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0x2eb11d[_0x5ac9('0x15d')]));this[_0x5ac9('0xc')]['noop'](util[_0x5ac9('0x26')](_0x5ac9('0x15f'),this[_0x5ac9('0xc')]['callerid'],_0x2eb11d[_0x5ac9('0x15d')]));return{'code':0xc8,'result':_0x5ac9('0x160')};}else{logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5ac9('0xc')]['callerid'],_0x2eb11d[_0x5ac9('0x15d')]));this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util['format'](_0x5ac9('0x161'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0x2eb11d[_0x5ac9('0x15d')]));return{'code':0xc8,'result':_0x5ac9('0x162')};}};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x163')]=function(_0x21fdb2){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x164'),_0x21fdb2[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x21fdb2[_0x5ac9('0x15d')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x21fdb2,_0x5ac9('0x165'));}logger['info'](util['format'](_0x5ac9('0x15c'),this['channel'][_0x5ac9('0x36')],_0x21fdb2[_0x5ac9('0x15d')]));var _0x445563=this[_0x5ac9('0x4f')][_0x5ac9('0xa0')](this,_0x21fdb2[_0x5ac9('0x15d')]);if(_0x445563){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x15f'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0x21fdb2['findBy']));this['channel'][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x15f'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0x21fdb2[_0x5ac9('0x15d')]));return{'code':0xc8,'result':_0x5ac9('0x160')};}else{logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x161'),this['channel'][_0x5ac9('0x36')],_0x21fdb2[_0x5ac9('0x15d')]));this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x161'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0x21fdb2[_0x5ac9('0x15d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x5ac9('0x166')]=function(_0x1b63b5){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x167'),_0x1b63b5['label']));if(!this['isConfigured'](_0x1b63b5[_0x5ac9('0x168')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x1b63b5,_0x5ac9('0x169'));}this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x16a'),_0x1b63b5[_0x5ac9('0x168')]));var _0xcfaa83=eval(_0x1b63b5[_0x5ac9('0x168')]);if(!this[_0x5ac9('0x81')](_0x1b63b5['variable_id'])){return this[_0x5ac9('0xc')]['noop'](_0x5ac9('0xd3'));}var _0x2b30d4=this['getVariable'][_0x5ac9('0xa0')](this,_0x1b63b5['variable_id']);if(!_0x2b30d4){return this['channel'][_0x5ac9('0x28')](_0x1b63b5,_0x5ac9('0xd4'));}if(_[_0x5ac9('0x96')](_0xcfaa83)){var _0x2de6f5=this;_0xcfaa83[_0x5ac9('0xd6')](function(_0x39c7a5,_0x9b9bfa){_0x2de6f5[_0x5ac9('0xc')][_0x5ac9('0x9a')](util[_0x5ac9('0x26')]('%s[%s]',_0x2b30d4,_0x9b9bfa),_0x39c7a5);});return this[_0x5ac9('0xc')]['noop'](util[_0x5ac9('0x26')]('variable\x20%s[key]\x20set',_0x2b30d4));}else{return this['channel'][_0x5ac9('0x9a')](_0x2b30d4,_0xcfaa83);}};AGIVertices['prototype'][_0x5ac9('0x16b')]=function(_0xe167f0){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0xe167f0[_0x5ac9('0x34')]));if(_0xe167f0[_0x5ac9('0x113')]===0x0){return this[_0x5ac9('0xa1')](_0xe167f0);}_0xe167f0[_0x5ac9('0x113')]-=0x1;if(!this[_0x5ac9('0x81')](_0xe167f0[_0x5ac9('0x115')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0xe167f0,_0x5ac9('0x114'));}var _0x19e134=this[_0x5ac9('0x1b')][_0x5ac9('0xa0')](this,_0xe167f0['file_id']);if(!_0x19e134){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0xe167f0,_0x5ac9('0x16c'));}var _0x2268aa=this['channel'][_0x5ac9('0x116')](_0x19e134,_0xe167f0[_0x5ac9('0x117')],_0xe167f0[_0x5ac9('0x16d')]);var _0x45c4c4=_0x2268aa['result'];if(_0x2268aa[_0x5ac9('0x9e')]===-0x1){this[_0x5ac9('0x32')]['sync'](this,_0xe167f0,'-1');return _0x2268aa;}else if(_0x2268aa['extra']===_0x5ac9('0x62')){_0x2268aa[_0x5ac9('0x9e')]=_0x2268aa[_0x5ac9('0x9e')]['length']>0x0?_0x2268aa[_0x5ac9('0x9e')]:'t';}else if(_[_0x5ac9('0x40')](_0x2268aa['result'])){_0x2268aa[_0x5ac9('0x9e')]='#';_0x45c4c4='#';}if(!this[_0x5ac9('0x81')](_0xe167f0['variable_id'])){this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0xd3'));}else{var _0x37d4cd=this[_0x5ac9('0xf')]['sync'](this,_0xe167f0[_0x5ac9('0xd2')]);if(!_0x37d4cd){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0xe167f0,_0x5ac9('0xd4'));}this[_0x5ac9('0xc')][_0x5ac9('0x9a')](_0x37d4cd,_0x45c4c4);}this[_0x5ac9('0x32')]['sync'](this,_0xe167f0,_0x45c4c4);return _0x2268aa;};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0xa5')]=function(_0x1dea5d){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x1dea5d[_0x5ac9('0x34')]));return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x1dea5d[_0x5ac9('0x16e')]||_0x1dea5d['label']);};AGIVertices[_0x5ac9('0xe')]['pause']=function(_0x70a203){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x16f'),_0x70a203['label']));if(!this['isConfigured'](_0x70a203[_0x5ac9('0x15d')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x70a203,_0x5ac9('0x165'));}logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x15c'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0x70a203[_0x5ac9('0x15d')]));var _0x25d7b1=this['getPause'][_0x5ac9('0xa0')](this,_0x70a203[_0x5ac9('0x170')]);var _0x20550a=this['agentPause']['sync'](this,_0x70a203[_0x5ac9('0x15d')],_0x25d7b1);if(_0x20550a){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x15f'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0x70a203[_0x5ac9('0x15d')]));this['channel'][_0x5ac9('0xa5')](util[_0x5ac9('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x5ac9('0x36')],_0x70a203[_0x5ac9('0x15d')]));return{'code':0xc8,'result':_0x5ac9('0x160')};}else{logger[_0x5ac9('0x2a')](util['format'](_0x5ac9('0x161'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0x70a203[_0x5ac9('0x15d')]));this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x15f'),this['channel'][_0x5ac9('0x36')],_0x70a203[_0x5ac9('0x15d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5ac9('0xe')]['playback']=function(_0x5c1f54){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x171'),_0x5c1f54[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x5c1f54[_0x5ac9('0x115')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x5c1f54,'no\x20file\x20audio\x20selected');}var _0x4662bf=this[_0x5ac9('0x1b')][_0x5ac9('0xa0')](this,_0x5c1f54[_0x5ac9('0x115')]);if(!_0x4662bf){return this[_0x5ac9('0xc')]['error'](_0x5c1f54,_0x5ac9('0x16c'));}var _0x4c6b0f=this[_0x5ac9('0xc')][_0x5ac9('0x54')]('PLAYBACK',[_0x4662bf,_0x5c1f54[_0x5ac9('0xdf')]]);if(_0x4c6b0f[_0x5ac9('0x9e')]===-0x1){return _0x4c6b0f;}return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util['format'](_0x5ac9('0xbe'),_0x5ac9('0x172'),_0x4662bf));};AGIVertices[_0x5ac9('0xe')]['queue']=function(_0x54ae77){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x173'),_0x54ae77['label']));if(!this[_0x5ac9('0x81')](_0x54ae77[_0x5ac9('0x174')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x54ae77,_0x5ac9('0x175'));}var _0x1c0ef1='';var _0x5cf148=parseInt(_0x54ae77[_0x5ac9('0x174')],0xa);if(isNaN(_0x5cf148)){_0x1c0ef1=_0x54ae77[_0x5ac9('0x174')];}else{_0x1c0ef1=this[_0x5ac9('0x176')][_0x5ac9('0xa0')](this,_0x54ae77[_0x5ac9('0x174')]);if(!_0x1c0ef1){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x54ae77,_0x5ac9('0x177'));}}var _0x3cc16c='';if(this[_0x5ac9('0x81')](_0x54ae77[_0x5ac9('0x115')])){var _0x53ffda=this[_0x5ac9('0x1b')]['sync'](this,_0x54ae77['file_id']);if(_0x53ffda){_0x3cc16c=_0x53ffda;}}this[_0x5ac9('0x32')][_0x5ac9('0xa0')](this,_0x54ae77,_0x1c0ef1);if(_0x54ae77['opts'][_0x5ac9('0x178')]('x')<0x0){_0x54ae77[_0x5ac9('0xdf')]+='x';}if(_0x54ae77[_0x5ac9('0xdf')]['indexOf']('X')<0x0){_0x54ae77[_0x5ac9('0xdf')]+='X';}this[_0x5ac9('0xc')]['setVariable'](_0x5ac9('0x179'),_0x1c0ef1?_0x1c0ef1['toLowerCase']():'');var _0x5b496f=this[_0x5ac9('0xc')][_0x5ac9('0x54')](_0x5ac9('0x17a'),[_0x1c0ef1,_0x54ae77[_0x5ac9('0xdf')],_0x54ae77['url'],_0x3cc16c,_0x54ae77[_0x5ac9('0x62')],_0x54ae77[_0x5ac9('0x6')],_0x54ae77['macro'],_0x54ae77['gosub'],'',_0x54ae77['position']]);if(_0x5b496f[_0x5ac9('0x9e')]===-0x1){return _0x5b496f;}return this[_0x5ac9('0xc')]['noop'](util[_0x5ac9('0x26')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x1c0ef1));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x17b')]=function(_0x25b2f5){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x17c'),_0x25b2f5[_0x5ac9('0x34')]));var _0x7d2a7c=_0x25b2f5[_0x5ac9('0x17d')]||_0x5ac9('0x133');var _0x5158e2=util[_0x5ac9('0x26')](_0x5ac9('0x17e'),this[_0x5ac9('0xc')][_0x5ac9('0x33')],rs['generate'](0x5));var _0x4ffe96=util[_0x5ac9('0x26')]('%s/recordings/%s.%s',FILES_PATH,_0x5158e2,_0x7d2a7c);var _0x82b62a=util[_0x5ac9('0x26')]('%s/recordings/%s',FILES_PATH,_0x5158e2);this[_0x5ac9('0x37')]['sync'](this,_0x25b2f5,_0x5158e2,_0x4ffe96);this[_0x5ac9('0xc')][_0x5ac9('0x9a')]('RECORDING_SAVENAME',_0x5158e2);logger[_0x5ac9('0x2a')](_0x5ac9('0x17f'),_0x82b62a,_0x7d2a7c,_0x25b2f5[_0x5ac9('0x180')],_0x25b2f5[_0x5ac9('0x62')]);return this[_0x5ac9('0xc')][_0x5ac9('0x136')](_0x82b62a,_0x7d2a7c,_0x25b2f5['escape_digits'],_0x25b2f5[_0x5ac9('0x62')],undefined,!![]);};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x181')]=function(_0x1e432a){logger[_0x5ac9('0x2a')](util['format'](_0x5ac9('0x182'),_0x1e432a['label']));if(!this[_0x5ac9('0x81')](_0x1e432a[_0x5ac9('0x6e')])){return this[_0x5ac9('0xc')]['noop'](_0x5ac9('0x183'));}var _0xbcf767=this[_0x5ac9('0x60')][_0x5ac9('0xa0')](this,_0x1e432a);logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x184'),util[_0x5ac9('0x185')](_0xbcf767,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1e432a[_0x5ac9('0xd2')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0x186'));}var _0x1fc516=this[_0x5ac9('0xf')]['sync'](this,_0x1e432a[_0x5ac9('0xd2')]);if(!_0x1fc516){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x1e432a,_0x5ac9('0xd4'));}this[_0x5ac9('0xc')]['setVariable'](util[_0x5ac9('0x26')](_0x5ac9('0x187'),_0x1fc516),_0xbcf767[_0x5ac9('0x71')]?_0xbcf767['statusCode']:_0x5ac9('0x188'));this[_0x5ac9('0xc')][_0x5ac9('0x9a')](util[_0x5ac9('0x26')](_0x5ac9('0x189'),_0x1fc516),_0xbcf767[_0x5ac9('0x18a')]?_0xbcf767[_0x5ac9('0x18a')]:'OK');if(_0xbcf767[_0x5ac9('0x66')]){try{this[_0x5ac9('0x97')](_0xbcf767[_0x5ac9('0x66')],_0x1fc516);}catch(_0x1836ce){logger['error'](util['format'](_0x5ac9('0x18b'),_0x1fc516));}}return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0xd9'),_0x1fc516));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x18c')]=function(_0x5cfb61){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x18d'),_0x5cfb61['label']));return this[_0x5ac9('0xc')][_0x5ac9('0x18e')](_0x5cfb61[_0x5ac9('0x18f')][_0x5ac9('0x190')](/\s+/g,''),_0x5cfb61['escape_digits']);};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x191')]=function(_0x38d15c){logger['info'](util['format'](_0x5ac9('0x192'),_0x38d15c[_0x5ac9('0x34')]));return this[_0x5ac9('0xc')][_0x5ac9('0x193')](_0x38d15c['number']['replace'](/\s+/g,''),_0x38d15c[_0x5ac9('0x180')]);};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x194')]=function(_0x15a192){logger[_0x5ac9('0x2a')](util['format'](_0x5ac9('0x195'),_0x15a192[_0x5ac9('0x34')]));return this['channel'][_0x5ac9('0x196')](_0x15a192[_0x5ac9('0x59')],_0x15a192[_0x5ac9('0x180')]);};AGIVertices[_0x5ac9('0xe')]['sendMail']=function(_0x357fb5){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x357fb5[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x357fb5[_0x5ac9('0x197')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0x198'));}var _0x2d6d20=this['getMailAccount'][_0x5ac9('0xa0')](this,_0x357fb5['account_id']);if(!_0x2d6d20||!_0x2d6d20[_0x5ac9('0x199')]){return this[_0x5ac9('0xc')]['error'](_0x357fb5,_0x5ac9('0x19a'));}var _0x3bc581={'from':util[_0x5ac9('0x26')]('\x22%s\x22\x20<%s>',_0x2d6d20['name'],_0x2d6d20[_0x5ac9('0x19b')]||_0x2d6d20[_0x5ac9('0x199')]['user']),'to':_0x357fb5['to']||'','cc':_0x357fb5['cc']||'','bcc':_0x357fb5[_0x5ac9('0x19c')]||'','subject':_0x357fb5['subject'],'html':_0x357fb5[_0x5ac9('0x59')],'text':_0x357fb5['text']};if(this[_0x5ac9('0x81')](_0x357fb5[_0x5ac9('0x19d')])){}logger[_0x5ac9('0x19e')](_0x5ac9('0x19f'),JSON[_0x5ac9('0x6f')](_0x3bc581));this[_0x5ac9('0x32')][_0x5ac9('0xa0')](this,_0x357fb5,_0x357fb5[_0x5ac9('0x197')]);this['channel'][_0x5ac9('0xa5')](util['format'](_0x5ac9('0x1a0'),_0x2d6d20[_0x5ac9('0x11')]));this[_0x5ac9('0x1f')][_0x5ac9('0xa0')](this,_0x2d6d20[_0x5ac9('0x1a1')],_0x3bc581);return this['channel'][_0x5ac9('0xa5')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1a2')]=function(_0x193168){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x1a3'),_0x193168[_0x5ac9('0x34')]));return this[_0x5ac9('0xc')]['noop'](_0x5ac9('0x1a4'));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1a5')]=function(_0x4c4c2f){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x1a6'),_0x4c4c2f[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x4c4c2f['sms_account_id'])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')]('no\x20sms\x20account\x20configured');}var _0x308893=this[_0x5ac9('0x30')][_0x5ac9('0xa0')](this,_0x4c4c2f[_0x5ac9('0x1a7')]);if(!_0x308893){return this[_0x5ac9('0xc')]['error'](_0x4c4c2f,_0x5ac9('0x1a8'));}var _0x5838b4={'body':_0x4c4c2f[_0x5ac9('0x1a9')],'phone':_0x4c4c2f['to']||'','SmsAccountId':_0x308893['id']};logger[_0x5ac9('0x19e')](_0x5ac9('0x1aa'),JSON[_0x5ac9('0x6f')](_0x5838b4));this[_0x5ac9('0x32')][_0x5ac9('0xa0')](this,_0x4c4c2f,_0x4c4c2f[_0x5ac9('0x1a7')]);this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util['format'](_0x5ac9('0x1ab'),_0x308893[_0x5ac9('0x11')]));this[_0x5ac9('0x31')][_0x5ac9('0xa0')](this,_0x5838b4);return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](_0x5ac9('0x1ac'));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1ad')]=function(_0x3fb1d6){logger['info'](util[_0x5ac9('0x26')](_0x5ac9('0x1ae'),_0x3fb1d6[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0x3fb1d6['variable_id'])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x3fb1d6,_0x5ac9('0x1af'));}var _0x8d54c7=this[_0x5ac9('0xf')][_0x5ac9('0xa0')](this,_0x3fb1d6[_0x5ac9('0xd2')]);if(!_0x8d54c7){return this[_0x5ac9('0xc')]['error'](_0x3fb1d6,_0x5ac9('0xd4'));}return this[_0x5ac9('0xc')][_0x5ac9('0x9a')](_0x8d54c7,_0x3fb1d6['variable_value']);};AGIVertices[_0x5ac9('0xe')]['start']=function(_0x3acba8){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x1b0'),_0x3acba8['label']));this['channel'][_0x5ac9('0xa5')](_0x5ac9('0x1b1'));var _0x5c8eae=this[_0x5ac9('0xc')][_0x5ac9('0xf')](_0x5ac9('0x1b2'));if(!_['isEmpty'](_0x5c8eae[_0x5ac9('0x9d')])){this[_0x5ac9('0xc')][_0x5ac9('0x33')]=_0x5c8eae['extra'];}if(_0x3acba8[_0x5ac9('0xb1')]===_0x5ac9('0x1b3')){this[_0x5ac9('0xc')]['noop'](_0x5ac9('0x1b4'));return this[_0x5ac9('0xc')][_0x5ac9('0xb1')]();}return this[_0x5ac9('0xc')]['noop']('Skipped\x20Answer');};AGIVertices[_0x5ac9('0xe')]['subproject']=function(_0x257786){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x257786[_0x5ac9('0x34')]));if(!this['isConfigured'](_0x257786[_0x5ac9('0x1b5')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x257786,_0x5ac9('0x1b6'));}var _0x53b5a1=this[_0x5ac9('0x14')][_0x5ac9('0xa0')](this,_0x257786[_0x5ac9('0x1b5')]);if(!this['isConfigured'](_0x53b5a1)){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x257786,util['format'](_0x5ac9('0x1b7'),_0x257786[_0x5ac9('0x1b5')]));}if(_0x53b5a1===this[_0x5ac9('0xc')][_0x5ac9('0x1b8')]){return this[_0x5ac9('0xc')]['error'](_0x257786,_0x5ac9('0x1b9'));}this[_0x5ac9('0x32')][_0x5ac9('0xa0')](this,_0x257786,_0x53b5a1);var _0x28771c=this[_0x5ac9('0xc')][_0x5ac9('0x54')](_0x5ac9('0x1ba'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x5ac9('0x6')][_0x5ac9('0x1bb')]||_0x5ac9('0x1bc'),_0x53b5a1,this[_0x5ac9('0xc')][_0x5ac9('0x1b8')]));if(_0x28771c[_0x5ac9('0x9e')]===-0x1){return _0x28771c;}return this['channel'][_0x5ac9('0xa5')](util[_0x5ac9('0x26')]('Executed\x20command\x20%s\x20%s','AGI',_0x53b5a1));};AGIVertices[_0x5ac9('0xe')]['system']=function(_0x314b05){logger['info'](util['format'](_0x5ac9('0x1bd'),_0x314b05[_0x5ac9('0x34')]));var _0x3f4cb2=this[_0x5ac9('0x53')]['sync'](this,_0x314b05['command']);this[_0x5ac9('0x32')][_0x5ac9('0xa0')](this,_0x314b05,_0x314b05[_0x5ac9('0xb0')]);if(this[_0x5ac9('0x81')](_0x314b05[_0x5ac9('0xd2')])){var _0x2a799c=this[_0x5ac9('0xf')]['sync'](this,_0x314b05[_0x5ac9('0xd2')]);if(_0x2a799c){this[_0x5ac9('0xc')][_0x5ac9('0x9a')](_0x2a799c,_0x3f4cb2);return this['channel'][_0x5ac9('0xa5')](util[_0x5ac9('0x26')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x314b05[_0x5ac9('0xb0')],_0x2a799c));}}return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x314b05[_0x5ac9('0xb0')]));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1be')]=function(_0x1e4d26){logger[_0x5ac9('0x2a')](util['format'](_0x5ac9('0x1bf'),_0x1e4d26[_0x5ac9('0x34')]));_0x1e4d26[_0x5ac9('0x59')]=_0x1e4d26[_0x5ac9('0x59')][_0x5ac9('0x190')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5ac9('0x81')](_0x1e4d26[_0x5ac9('0x57')])){return this[_0x5ac9('0xc')][_0x5ac9('0xa5')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x1e4d26[_0x5ac9('0x59')])){return this['channel'][_0x5ac9('0xa5')]('no\x20text\x20configured');}this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x1c0'),_0x1e4d26[_0x5ac9('0x59')]));var _0x2ab231=this[_0x5ac9('0x56')][_0x5ac9('0xa0')](this,_0x1e4d26);if(_0x2ab231){this['channel'][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x1c1'),_0x2ab231));var _0x10a5bf=this['channel']['streamFile'](_0x2ab231);try{fs['unlink'](_0x2ab231+_0x5ac9('0x103'));}catch(_0x3f9e26){logger[_0x5ac9('0x28')](_0x3f9e26);}return _0x10a5bf;}return this['channel']['error'](_0x1e4d26,_0x5ac9('0x1c2'));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1c3')]=function(_0x363851){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x363851[_0x5ac9('0x34')]));_0x363851['text']=_0x363851[_0x5ac9('0x59')][_0x5ac9('0x190')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x363851[_0x5ac9('0x59')])){return this['channel']['noop'](_0x5ac9('0xa3'));}this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')]('Trying\x20Google\x20TTS\x20%s',_0x363851['text']));var _0x9855=this[_0x5ac9('0x5f')][_0x5ac9('0xa0')](this,_0x363851);if(_0x9855){this[_0x5ac9('0xc')]['noop'](util['format'](_0x5ac9('0x1c4'),_0x9855));var _0x1a62b3=this[_0x5ac9('0xc')][_0x5ac9('0x101')](_0x9855);try{fs[_0x5ac9('0x102')](_0x9855+'.wav');}catch(_0x49a5b8){logger[_0x5ac9('0x28')](_0x49a5b8);}return _0x1a62b3;}return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x363851,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1c5')]=function(_0xfc750e){logger[_0x5ac9('0x2a')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0xfc750e[_0x5ac9('0x34')]));if(!this[_0x5ac9('0x81')](_0xfc750e[_0x5ac9('0x15d')])){return this['channel'][_0x5ac9('0x28')](_0xfc750e,'no\x20find\x20by\x20configured');}logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')](_0x5ac9('0x15c'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0xfc750e[_0x5ac9('0x15d')]));var _0x49a80a=this['agentUnpause'][_0x5ac9('0xa0')](this,_0xfc750e[_0x5ac9('0x15d')]);if(_0x49a80a){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5ac9('0xc')]['callerid'],_0xfc750e[_0x5ac9('0x15d')]));this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x15f'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0xfc750e['findBy']));return{'code':0xc8,'result':_0x5ac9('0x160')};}else{logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5ac9('0xc')]['callerid'],_0xfc750e[_0x5ac9('0x15d')]));this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0x161'),this[_0x5ac9('0xc')][_0x5ac9('0x36')],_0xfc750e['findBy']));return{'code':0xc8,'result':_0x5ac9('0x162')};}};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1c6')]=function(_0x39c945){logger['info'](util[_0x5ac9('0x26')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x39c945[_0x5ac9('0x34')]));var _0x32250e=this[_0x5ac9('0xc')][_0x5ac9('0x54')]('VOICEMAIL',[_0x39c945[_0x5ac9('0x1c7')],_0x39c945[_0x5ac9('0x74')]]);if(_0x32250e['result']===-0x1){return _0x32250e;}return this[_0x5ac9('0xc')][_0x5ac9('0xa5')](util[_0x5ac9('0x26')](_0x5ac9('0xbe'),'VOICEMAIL',_0x39c945[_0x5ac9('0x1c7')]));};AGIVertices[_0x5ac9('0xe')][_0x5ac9('0x1c8')]=function(_0x486335){logger[_0x5ac9('0x2a')](util[_0x5ac9('0x26')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x486335['label']));if(!this[_0x5ac9('0x81')](_0x486335[_0x5ac9('0xd2')])){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x486335,_0x5ac9('0x1af'));}var _0x53a9e0=this[_0x5ac9('0xf')]['sync'](this,_0x486335[_0x5ac9('0xd2')]);if(!_0x53a9e0){return this[_0x5ac9('0xc')][_0x5ac9('0x28')](_0x486335,_0x5ac9('0xd4'));}var _0x5ec2cc=this[_0x5ac9('0xc')]['getVariable'](_0x53a9e0);return{'code':0xc8,'result':_0x5ec2cc[_0x5ac9('0x9d')]?_0x5ec2cc[_0x5ac9('0x9d')]:'-'};};String[_0x5ac9('0xe')][_0x5ac9('0x9c')]=function(_0x8f1946,_0x44f6d1){return this['split'](_0x8f1946)['join'](_0x44f6d1);};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 dceb2b0..8eea1a3 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 _0x1191=['[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','message','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','startAcw','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','deleteChannelAfterTimeout','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','channels','agentconnect','syncHangupRequest','hangup','syncHangup','bind','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','timers','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','error','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','acwTimeout','updateAcw','catch','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify'];(function(_0x338d8d,_0x1f0622){var _0x5e662d=function(_0x30a06a){while(--_0x30a06a){_0x338d8d['push'](_0x338d8d['shift']());}};_0x5e662d(++_0x1f0622);}(_0x1191,0x12a));var _0x1119=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1191[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x1119('0x0'));var moment=require(_0x1119('0x1'));var ami=require(_0x1119('0x2'));var logger=require(_0x1119('0x3'))(_0x1119('0x4'));var RpcUser=require(_0x1119('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x44cfb6){this[_0x1119('0x6')]=_0x44cfb6[_0x1119('0x6')];this[_0x1119('0x7')]=_0x44cfb6['agents'];this['timers']=_0x44cfb6['timers'];this[_0x1119('0x8')]={};ami['on'](_0x1119('0x9'),this['syncAgentConnect']['bind'](this));ami['on']('hanguprequest',this[_0x1119('0xa')]['bind'](this));ami['on'](_0x1119('0xb'),this[_0x1119('0xc')][_0x1119('0xd')](this));ami['on'](_0x1119('0xe'),this[_0x1119('0xf')][_0x1119('0xd')](this));ami['on'](_0x1119('0x10'),this[_0x1119('0x11')][_0x1119('0xd')](this));ami['on'](_0x1119('0x12'),this['syncBlindTransfer'][_0x1119('0xd')](this));ami['on'](_0x1119('0x13'),this[_0x1119('0x14')][_0x1119('0xd')](this));}function getDiff(_0x373f39){var _0x5470ef=moment()[_0x1119('0x15')](0x0);var _0x52f249=moment(_0x373f39)[_0x1119('0x15')](0x0);return _0x5470ef[_0x1119('0x16')](_0x52f249,'seconds');}Acw[_0x1119('0x17')]['updateAcw']=function(_0x2c049a,_0xb7b843){var _0x572c25=this;var _0x324cb2=getDiff(_0x572c25[_0x1119('0x18')][_0x2c049a][_0x1119('0x19')]);clearTimeout(_0x572c25[_0x1119('0x18')][_0x2c049a][_0x1119('0x1a')]);_0x572c25[_0x1119('0x18')][_0x2c049a]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0x324cb2},_0x572c25['timers'][_0x2c049a][_0x1119('0x1b')],_0x2c049a)[_0x1119('0x1c')](function(_0x4147d7){logger[_0x1119('0x1d')](_0x1119('0x1e'),_0xb7b843,_0x324cb2,_0x4147d7);})['catch'](function(_0x252406){logger[_0x1119('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0xb7b843,_0x252406);})['finally'](function(){delete _0x572c25[_0x1119('0x18')][_0x2c049a];});};Acw[_0x1119('0x17')]['startAcw']=function(_0x50da87){try{var _0xdfefff=this;var _0xecfeb6=this['channels'][_0x50da87][_0x1119('0x20')];var _0x1b5aad=this[_0x1119('0x8')][_0x50da87][_0x1119('0x21')];var _0x11fe7f=this[_0x1119('0x6')][_0x1b5aad];var _0x2e67e9=![];var _0x9386a5=_0x1119('0x22');if(_0x11fe7f[_0x1119('0x23')]&&_0x11fe7f[_0x1119('0x24')][_0x1119('0x25')]){_0x2e67e9=!![];_0x9386a5=_0x11fe7f['mandatoryDispositionPause'][_0x1119('0x25')];}return ami[_0x1119('0x26')]({'action':_0x1119('0x27'),'interface':_0xecfeb6,'paused':!![],'reason':_0x9386a5})['then'](function(){if(_0xdfefff['agents'][_0xecfeb6]){return RpcUser[_0x1119('0x28')](_0xdfefff[_0x1119('0x7')][_0xecfeb6]['id'])[_0x1119('0x1c')](function(_0x577c12){if(!_0x577c12||_0x577c12['voicePause']){logger[_0x1119('0x1d')](_0x1119('0x29'),_0x50da87,_0xecfeb6,_0x1b5aad);return;}logger[_0x1119('0x1d')](_0x1119('0x2a'),_0x50da87,_0xecfeb6,_0x1b5aad);var _0x1e9ab4=_0xdfefff[_0x1119('0x8')][_0x50da87][_0x1119('0x2b')]&&_0xdfefff[_0x1119('0x8')][_0x50da87][_0x1119('0x2c')]?_0xdfefff['channels'][_0x50da87]['destlinkedid']:_0x50da87;return RpcUser[_0x1119('0x2d')](_0xdfefff[_0x1119('0x7')][_0xecfeb6],_0x9386a5,_0x1e9ab4)['then'](function(_0x767419){_0xdfefff['voiceQueues'][_0x1b5aad][_0x1119('0x2e')]-=0x1;_0xdfefff['voiceQueues'][_0x1b5aad][_0x1119('0x2f')]+=0x1;return _0x767419;});})['then'](function(_0x5da472){if(_0x2e67e9||!_0x5da472){return;}_0xdfefff[_0x1119('0x18')][_0xecfeb6]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x50da87,_0xdfefff[_0x1119('0x6')][_0x1b5aad][_0x1119('0x30')],_0xecfeb6,_0x1b5aad);_0xdfefff[_0x1119('0x18')][_0xecfeb6][_0x1119('0x1a')]=setTimeout(_0xdfefff['stopAcw'][_0x1119('0xd')](_0xdfefff,_0xecfeb6),_0xdfefff['voiceQueues'][_0x1b5aad]['acwTimeout']*0x3e8);_0xdfefff[_0x1119('0x18')][_0xecfeb6][_0x1119('0x19')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xdfefff[_0x1119('0x18')][_0xecfeb6][_0x1119('0x1b')]=_0x50da87;_0xdfefff[_0x1119('0x18')][_0xecfeb6]['queue']=_0x1b5aad;_0xdfefff[_0x1119('0x18')][_0xecfeb6][_0x1119('0x31')]=_0xdfefff[_0x1119('0x31')]['bind'](_0xdfefff,_0xecfeb6,_0x50da87);});}})[_0x1119('0x32')](function(){logger[_0x1119('0x1f')](_0x1119('0x33'),_0x50da87,_0xdfefff[_0x1119('0x6')][_0x1b5aad][_0x1119('0x30')],_0xecfeb6,_0x1b5aad);})[_0x1119('0x34')](function(){delete _0xdfefff[_0x1119('0x8')][_0x50da87];});}catch(_0x399495){logger[_0x1119('0x1f')](_0x1119('0x35'),_0x399495['message']);}};Acw['prototype']['stopAcw']=function(_0x2c50c3){try{var _0x1e7b73=this;if(_0x1e7b73['timers'][_0x2c50c3]){_0x1e7b73[_0x1119('0x18')][_0x2c50c3]['timer']=![];var _0x5b3e2f=_0x1e7b73['timers'][_0x2c50c3][_0x1119('0x1b')];var _0x1a0e41=_0x1e7b73[_0x1119('0x18')][_0x2c50c3][_0x1119('0x21')];var _0x1a4b2a=_0x1e7b73[_0x1119('0x6')][_0x1a0e41]['acwTimeout'];logger[_0x1119('0x1d')](_0x1119('0x36'),_0x5b3e2f,_0x2c50c3);RpcUser[_0x1119('0x28')](this['agents'][_0x2c50c3]['id'])['then'](function(_0x4a4fb0){if(_0x4a4fb0[_0x1119('0x37')]==='ACW'){return RpcUser[_0x1119('0x38')](_0x1e7b73[_0x1119('0x7')][_0x2c50c3]);}});RpcVoiceAgentReport[_0x1119('0x39')]({'acwtime':_0x1a4b2a,'agentacw':!![]},_0x5b3e2f,_0x2c50c3)[_0x1119('0x1c')](function(_0x1cd015){logger['info'](_0x1119('0x1e'),_0x5b3e2f,_0x1a4b2a,_0x1cd015);})[_0x1119('0x32')](function(_0x3c90ec){logger[_0x1119('0x1f')](_0x1119('0x3a'),_0x5b3e2f,_0x3c90ec);});}else{logger[_0x1119('0x1f')](_0x1119('0x3b'),_0x2c50c3);if(_0x1e7b73['timers']){logger[_0x1119('0x1d')](_0x1119('0x3c'),JSON[_0x1119('0x3d')](_0x1e7b73['timers']));}}}catch(_0x4d2b6e){logger[_0x1119('0x1f')](_0x1119('0x3e'),_0x4d2b6e['message']);}};Acw[_0x1119('0x17')][_0x1119('0x3f')]=function(_0x30870f){try{if(this[_0x1119('0x6')][_0x30870f[_0x1119('0x21')]]&&(this[_0x1119('0x6')][_0x30870f['queue']][_0x1119('0x4')]||this[_0x1119('0x6')][_0x30870f[_0x1119('0x21')]][_0x1119('0x23')])){if(this[_0x1119('0x7')][_0x30870f[_0x1119('0x20')]]){this['channels'][_0x30870f['uniqueid']]={'queue':_0x30870f[_0x1119('0x21')],'interface':_0x30870f['interface'],'destlinkedid':_0x30870f[_0x1119('0x2c')]};}}}catch(_0x5320f6){logger['error'](_0x1119('0x40'),_0x5320f6[_0x1119('0x41')]);}};Acw[_0x1119('0x17')]['syncAgentConnectPreview']=function(_0x57d483){try{if(this[_0x1119('0x6')][_0x57d483['queue']]&&(this['voiceQueues'][_0x57d483['queue']][_0x1119('0x4')]||this['voiceQueues'][_0x57d483[_0x1119('0x21')]][_0x1119('0x23')])){if(this[_0x1119('0x7')][_0x57d483[_0x1119('0x20')]]){this[_0x1119('0x8')][_0x57d483[_0x1119('0x1b')]]={'queue':_0x57d483[_0x1119('0x21')],'interface':_0x57d483[_0x1119('0x20')]};}}}catch(_0x1abe9f){logger[_0x1119('0x1f')](_0x1119('0x42'),_0x1abe9f['message']);}};Acw['prototype'][_0x1119('0xa')]=function(_0x4fd3c8){try{if(this[_0x1119('0x8')][_0x4fd3c8[_0x1119('0x1b')]]&&_['isUndefined'](this[_0x1119('0x8')][_0x4fd3c8['uniqueid']][_0x1119('0x2b')])){logger[_0x1119('0x1d')](_0x1119('0x43'),_0x4fd3c8[_0x1119('0x1b')]);this[_0x1119('0x44')](_0x4fd3c8[_0x1119('0x1b')]);}else if(this['channels'][_0x4fd3c8['linkedid']]&&_[_0x1119('0x45')](this[_0x1119('0x8')][_0x4fd3c8[_0x1119('0x46')]][_0x1119('0x2b')])){logger[_0x1119('0x1d')]('[%s][HANGUP:LINKEDID]',_0x4fd3c8[_0x1119('0x46')]);this[_0x1119('0x44')](_0x4fd3c8[_0x1119('0x46')]);}}catch(_0x19e38a){logger[_0x1119('0x1f')](_0x1119('0x47'),_0x19e38a[_0x1119('0x41')]);}};Acw[_0x1119('0x17')][_0x1119('0xc')]=function(_0x454493){try{if(this['channels'][_0x454493[_0x1119('0x1b')]]&&this[_0x1119('0x8')][_0x454493[_0x1119('0x1b')]][_0x1119('0x2b')]){logger[_0x1119('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x454493[_0x1119('0x1b')]);this['startAcw'](_0x454493[_0x1119('0x1b')]);}else if(this[_0x1119('0x8')][_0x454493['linkedid']]&&this[_0x1119('0x8')][_0x454493[_0x1119('0x46')]][_0x1119('0x2b')]){logger[_0x1119('0x1d')](_0x1119('0x48'),_0x454493[_0x1119('0x46')]);this[_0x1119('0x44')](_0x454493['linkedid']);}}catch(_0x4e144a){logger[_0x1119('0x1f')](_0x1119('0x49'),_0x4e144a[_0x1119('0x41')]);}};Acw[_0x1119('0x17')][_0x1119('0x11')]=function(_0x2a885d){try{if(!_['isNil'](this[_0x1119('0x8')][_0x2a885d[_0x1119('0x4a')]])){this['startAcw'](_0x2a885d[_0x1119('0x4a')]);if(this[_0x1119('0x8')][_0x2a885d['secondtransfereruniqueid']]){this[_0x1119('0x8')][_0x2a885d[_0x1119('0x4b')]][_0x1119('0x2b')]=!![];this['channels'][_0x2a885d[_0x1119('0x4c')]]=this[_0x1119('0x8')][_0x2a885d['secondtransfereruniqueid']];this['deleteChannelAfterTimeout'](_0x2a885d[_0x1119('0x4b')]);}}else if(!_[_0x1119('0x4d')](this['channels'][_0x2a885d[_0x1119('0x4c')]])){this[_0x1119('0x44')](_0x2a885d[_0x1119('0x4c')]);if(this[_0x1119('0x8')][_0x2a885d[_0x1119('0x4e')]]){this[_0x1119('0x8')][_0x2a885d['origtransfereruniqueid']][_0x1119('0x2b')]=!![];this[_0x1119('0x8')][_0x2a885d[_0x1119('0x4a')]]=this[_0x1119('0x8')][_0x2a885d[_0x1119('0x4e')]];this[_0x1119('0x4f')](_0x2a885d[_0x1119('0x4e')]);}}}catch(_0x49ff2b){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x49ff2b['message']);}};Acw['prototype'][_0x1119('0x50')]=function(_0x4fc585){try{if(this[_0x1119('0x8')][_0x4fc585['transfereruniqueid']]){logger[_0x1119('0x1d')](_0x1119('0x51'),JSON[_0x1119('0x3d')](_0x4fc585[_0x1119('0x52')]));this[_0x1119('0x44')](_0x4fc585[_0x1119('0x52')]);}else if(this[_0x1119('0x8')][_0x4fc585[_0x1119('0x53')]]){logger[_0x1119('0x1d')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x1119('0x3d')](_0x4fc585[_0x1119('0x53')]));this[_0x1119('0x44')](_0x4fc585[_0x1119('0x53')]);}}catch(_0x577b61){logger[_0x1119('0x1f')](_0x1119('0x54'),_0x577b61[_0x1119('0x41')]);}};Acw['prototype'][_0x1119('0xf')]=function(_0x1ed07c){try{if(this[_0x1119('0x6')][_0x1ed07c['queue']]&&this[_0x1119('0x6')][_0x1ed07c[_0x1119('0x21')]][_0x1119('0x55')]===_0x1119('0x56')){if(this[_0x1119('0x7')][_0x1ed07c[_0x1119('0x20')]]){logger[_0x1119('0x1d')](_0x1119('0x57'),_0x1ed07c[_0x1119('0x1b')],_0x1ed07c[_0x1119('0x20')],_0x1ed07c[_0x1119('0x21')]);return RpcUser[_0x1119('0x2d')](this[_0x1119('0x7')][_0x1ed07c[_0x1119('0x20')]],_0x1119('0x58'),_0x1ed07c[_0x1119('0x1b')]);}}}catch(_0x4640c7){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4640c7[_0x1119('0x41')]);}};Acw[_0x1119('0x17')][_0x1119('0x4f')]=function(_0x1b50c9,_0x4feb9f=0x2710){if(this[_0x1119('0x8')][_0x1b50c9]){setTimeout(()=>{delete this['channels'][_0x1b50c9];},_0x4feb9f);}};module[_0x1119('0x59')]=Acw; \ No newline at end of file +var _0x5080=['Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','lastPauseAt','timer','update','uniqueid','then','info','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','ACW','mandatoryDisposition','Action','QueuePause','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','finally','[ACW][START]\x20%s','pauseType','saveUnpause','[%s][UPDATE][ACWTIME:%s]','catch','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all'];(function(_0x5165a7,_0x5d2161){var _0x3fa052=function(_0x546ad8){while(--_0x546ad8){_0x5165a7['push'](_0x5165a7['shift']());}};_0x3fa052(++_0x5d2161);}(_0x5080,0x15b));var _0x0508=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5080[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x0508('0x0'));var moment=require(_0x0508('0x1'));var ami=require('../ami');var logger=require(_0x0508('0x2'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x0508('0x3'));function Acw(_0x4a50c3){this[_0x0508('0x4')]=_0x4a50c3[_0x0508('0x4')];this[_0x0508('0x5')]=_0x4a50c3['agents'];this[_0x0508('0x6')]=_0x4a50c3[_0x0508('0x6')];this[_0x0508('0x7')]={};ami['on'](_0x0508('0x8'),this[_0x0508('0x9')][_0x0508('0xa')](this));ami['on'](_0x0508('0xb'),this[_0x0508('0xc')]['bind'](this));ami['on']('hangup',this[_0x0508('0xd')]['bind'](this));ami['on'](_0x0508('0xe'),this[_0x0508('0xf')][_0x0508('0xa')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x0508('0xa')](this));ami['on'](_0x0508('0x10'),this[_0x0508('0x11')][_0x0508('0xa')](this));ami['on'](_0x0508('0x12'),this[_0x0508('0x13')][_0x0508('0xa')](this));}function getDiff(_0x215711){var _0x38d100=moment()[_0x0508('0x14')](0x0);var _0x4c8b6e=moment(_0x215711)['milliseconds'](0x0);return _0x38d100['diff'](_0x4c8b6e,_0x0508('0x15'));}Acw[_0x0508('0x16')]['updateAcw']=function(_0x2a78f9,_0x3f542b){var _0x1a2d12=this;var _0x46117b=getDiff(_0x1a2d12['timers'][_0x2a78f9][_0x0508('0x17')]);clearTimeout(_0x1a2d12[_0x0508('0x6')][_0x2a78f9][_0x0508('0x18')]);_0x1a2d12[_0x0508('0x6')][_0x2a78f9]['timer']=![];return RpcVoiceAgentReport[_0x0508('0x19')]({'acwtime':_0x46117b},_0x1a2d12['timers'][_0x2a78f9][_0x0508('0x1a')],_0x2a78f9)[_0x0508('0x1b')](function(_0x4d2f2d){logger[_0x0508('0x1c')]('[%s][UPDATE][ACWTIME:%s]',_0x3f542b,_0x46117b,_0x4d2f2d);})['catch'](function(_0x1850f2){logger[_0x0508('0x1d')](_0x0508('0x1e'),_0x3f542b,_0x1850f2);})['finally'](function(){delete _0x1a2d12[_0x0508('0x6')][_0x2a78f9];});};Acw[_0x0508('0x16')][_0x0508('0x1f')]=function(_0x10172e){try{var _0x29b1e8=this;var _0x365b7d=this[_0x0508('0x7')][_0x10172e][_0x0508('0x20')];var _0x3352f0=this[_0x0508('0x7')][_0x10172e][_0x0508('0x21')];var _0x524794=this[_0x0508('0x4')][_0x3352f0];var _0x3ddfc3=![];var _0x51a6b8=_0x0508('0x22');if(_0x524794[_0x0508('0x23')]&&_0x524794['mandatoryDispositionPause']['name']){_0x3ddfc3=!![];_0x51a6b8=_0x524794['mandatoryDispositionPause']['name'];}return ami[_0x0508('0x24')]({'action':_0x0508('0x25'),'interface':_0x365b7d,'paused':!![],'reason':_0x51a6b8})[_0x0508('0x1b')](function(){if(_0x29b1e8[_0x0508('0x5')][_0x365b7d]){return RpcUser[_0x0508('0x26')](_0x29b1e8[_0x0508('0x5')][_0x365b7d]['id'])[_0x0508('0x1b')](function(_0x238a90){if(!_0x238a90||_0x238a90[_0x0508('0x27')]){logger[_0x0508('0x1c')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x10172e,_0x365b7d,_0x3352f0);return;}logger[_0x0508('0x1c')](_0x0508('0x28'),_0x10172e,_0x365b7d,_0x3352f0);var _0x2ff04a=_0x29b1e8[_0x0508('0x7')][_0x10172e][_0x0508('0x29')]&&_0x29b1e8[_0x0508('0x7')][_0x10172e]['destlinkedid']?_0x29b1e8[_0x0508('0x7')][_0x10172e][_0x0508('0x2a')]:_0x10172e;return RpcUser['savePause'](_0x29b1e8['agents'][_0x365b7d],_0x51a6b8,_0x2ff04a)[_0x0508('0x1b')](function(_0x74fc){_0x29b1e8['voiceQueues'][_0x3352f0][_0x0508('0x2b')]-=0x1;_0x29b1e8[_0x0508('0x4')][_0x3352f0][_0x0508('0x2c')]+=0x1;return _0x74fc;});})['then'](function(_0xfce377){if(_0x3ddfc3||!_0xfce377){return;}_0x29b1e8[_0x0508('0x6')][_0x365b7d]={};logger['info'](_0x0508('0x2d'),_0x10172e,_0x29b1e8[_0x0508('0x4')][_0x3352f0][_0x0508('0x2e')],_0x365b7d,_0x3352f0);_0x29b1e8[_0x0508('0x6')][_0x365b7d][_0x0508('0x18')]=setTimeout(_0x29b1e8[_0x0508('0x2f')][_0x0508('0xa')](_0x29b1e8,_0x365b7d),_0x29b1e8['voiceQueues'][_0x3352f0][_0x0508('0x2e')]*0x3e8);_0x29b1e8['timers'][_0x365b7d]['lastPauseAt']=moment()[_0x0508('0x30')](_0x0508('0x31'));_0x29b1e8[_0x0508('0x6')][_0x365b7d]['uniqueid']=_0x10172e;_0x29b1e8[_0x0508('0x6')][_0x365b7d][_0x0508('0x21')]=_0x3352f0;_0x29b1e8['timers'][_0x365b7d][_0x0508('0x32')]=_0x29b1e8[_0x0508('0x32')][_0x0508('0xa')](_0x29b1e8,_0x365b7d,_0x10172e);});}})['catch'](function(){logger[_0x0508('0x1d')](_0x0508('0x2d'),_0x10172e,_0x29b1e8['voiceQueues'][_0x3352f0][_0x0508('0x2e')],_0x365b7d,_0x3352f0);})[_0x0508('0x33')](function(){delete _0x29b1e8[_0x0508('0x7')][_0x10172e];});}catch(_0x399a86){logger[_0x0508('0x1d')](_0x0508('0x34'),_0x399a86['message']);}};Acw['prototype'][_0x0508('0x2f')]=function(_0x20d7de){try{var _0x1a7a32=this;if(_0x1a7a32[_0x0508('0x6')][_0x20d7de]){_0x1a7a32[_0x0508('0x6')][_0x20d7de][_0x0508('0x18')]=![];var _0x524568=_0x1a7a32[_0x0508('0x6')][_0x20d7de]['uniqueid'];var _0x34e5fd=_0x1a7a32[_0x0508('0x6')][_0x20d7de][_0x0508('0x21')];var _0x4774d9=_0x1a7a32[_0x0508('0x4')][_0x34e5fd][_0x0508('0x2e')];logger[_0x0508('0x1c')]('[%s][TIMER][STOP][AGENT:%s]',_0x524568,_0x20d7de);RpcUser[_0x0508('0x26')](this[_0x0508('0x5')][_0x20d7de]['id'])[_0x0508('0x1b')](function(_0x438123){if(_0x438123[_0x0508('0x35')]===_0x0508('0x22')){return RpcUser[_0x0508('0x36')](_0x1a7a32[_0x0508('0x5')][_0x20d7de]);}});RpcVoiceAgentReport[_0x0508('0x19')]({'acwtime':_0x4774d9,'agentacw':!![]},_0x524568,_0x20d7de)['then'](function(_0x15e568){logger[_0x0508('0x1c')](_0x0508('0x37'),_0x524568,_0x4774d9,_0x15e568);})[_0x0508('0x38')](function(_0x2dc0cb){logger[_0x0508('0x1d')]('[%s][UPDATE][ERRORS:%s]',_0x524568,_0x2dc0cb);});}else{logger[_0x0508('0x1d')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x20d7de);if(_0x1a7a32[_0x0508('0x6')]){logger[_0x0508('0x1c')](_0x0508('0x39'),JSON[_0x0508('0x3a')](_0x1a7a32['timers']));}}}catch(_0x3a8dc6){logger['error'](_0x0508('0x3b'),_0x3a8dc6[_0x0508('0x3c')]);}};Acw[_0x0508('0x16')]['syncAgentConnect']=function(_0x86a002){try{if(this[_0x0508('0x4')][_0x86a002[_0x0508('0x21')]]&&(this[_0x0508('0x4')][_0x86a002[_0x0508('0x21')]][_0x0508('0x3d')]||this[_0x0508('0x4')][_0x86a002['queue']][_0x0508('0x23')])){if(this[_0x0508('0x5')][_0x86a002[_0x0508('0x20')]]){this['channels'][_0x86a002[_0x0508('0x1a')]]={'queue':_0x86a002[_0x0508('0x21')],'interface':_0x86a002[_0x0508('0x20')],'destlinkedid':_0x86a002[_0x0508('0x2a')]};}}}catch(_0x3c8137){logger[_0x0508('0x1d')](_0x0508('0x3e'),_0x3c8137[_0x0508('0x3c')]);}};Acw[_0x0508('0x16')][_0x0508('0x13')]=function(_0x4b0340){try{if(this[_0x0508('0x4')][_0x4b0340[_0x0508('0x21')]]&&(this[_0x0508('0x4')][_0x4b0340['queue']][_0x0508('0x3d')]||this[_0x0508('0x4')][_0x4b0340[_0x0508('0x21')]][_0x0508('0x23')])){if(this[_0x0508('0x5')][_0x4b0340['interface']]){this[_0x0508('0x7')][_0x4b0340[_0x0508('0x1a')]]={'queue':_0x4b0340[_0x0508('0x21')],'interface':_0x4b0340[_0x0508('0x20')]};}}}catch(_0x2fbcc6){logger[_0x0508('0x1d')](_0x0508('0x3f'),_0x2fbcc6['message']);}};Acw[_0x0508('0x16')][_0x0508('0xc')]=function(_0xf79b55){try{if(this['channels'][_0xf79b55['uniqueid']]&&_['isUndefined'](this[_0x0508('0x7')][_0xf79b55[_0x0508('0x1a')]]['attended'])){logger[_0x0508('0x1c')](_0x0508('0x40'),_0xf79b55['uniqueid']);this[_0x0508('0x1f')](_0xf79b55[_0x0508('0x1a')]);}else if(this[_0x0508('0x7')][_0xf79b55[_0x0508('0x41')]]&&_[_0x0508('0x42')](this[_0x0508('0x7')][_0xf79b55[_0x0508('0x41')]]['attended'])){logger[_0x0508('0x1c')](_0x0508('0x43'),_0xf79b55['linkedid']);this['startAcw'](_0xf79b55[_0x0508('0x41')]);}}catch(_0x27148b){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x27148b[_0x0508('0x3c')]);}};Acw[_0x0508('0x16')]['syncHangup']=function(_0x4a5495){try{if(this[_0x0508('0x7')][_0x4a5495[_0x0508('0x1a')]]&&this[_0x0508('0x7')][_0x4a5495[_0x0508('0x1a')]]['attended']){logger[_0x0508('0x1c')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x4a5495[_0x0508('0x1a')]);this[_0x0508('0x1f')](_0x4a5495[_0x0508('0x1a')]);}else if(this[_0x0508('0x7')][_0x4a5495[_0x0508('0x41')]]&&this[_0x0508('0x7')][_0x4a5495[_0x0508('0x41')]][_0x0508('0x29')]){logger[_0x0508('0x1c')](_0x0508('0x44'),_0x4a5495[_0x0508('0x41')]);this[_0x0508('0x1f')](_0x4a5495[_0x0508('0x41')]);}}catch(_0x532bd6){logger[_0x0508('0x1d')](_0x0508('0x45'),_0x532bd6[_0x0508('0x3c')]);}};Acw[_0x0508('0x16')][_0x0508('0x46')]=function(_0x22e4e6){try{if(!_[_0x0508('0x47')](this[_0x0508('0x7')][_0x22e4e6['transfereeuniqueid']])){this[_0x0508('0x1f')](_0x22e4e6[_0x0508('0x48')]);if(this[_0x0508('0x7')][_0x22e4e6[_0x0508('0x49')]]){this[_0x0508('0x7')][_0x22e4e6['secondtransfereruniqueid']][_0x0508('0x29')]=!![];this[_0x0508('0x7')][_0x22e4e6[_0x0508('0x4a')]]=this['channels'][_0x22e4e6[_0x0508('0x49')]];this[_0x0508('0x4b')](_0x22e4e6[_0x0508('0x49')]);}}else if(!_[_0x0508('0x47')](this['channels'][_0x22e4e6[_0x0508('0x4a')]])){this[_0x0508('0x1f')](_0x22e4e6['transfertargetuniqueid']);if(this[_0x0508('0x7')][_0x22e4e6[_0x0508('0x4c')]]){this[_0x0508('0x7')][_0x22e4e6[_0x0508('0x4c')]]['attended']=!![];this[_0x0508('0x7')][_0x22e4e6['transfereeuniqueid']]=this[_0x0508('0x7')][_0x22e4e6['origtransfereruniqueid']];this[_0x0508('0x4b')](_0x22e4e6[_0x0508('0x4c')]);}}}catch(_0x263217){logger[_0x0508('0x1d')](_0x0508('0x4d'),_0x263217['message']);}};Acw[_0x0508('0x16')][_0x0508('0x11')]=function(_0x5b14c7){try{if(this[_0x0508('0x7')][_0x5b14c7[_0x0508('0x4e')]]){logger[_0x0508('0x1c')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x5b14c7[_0x0508('0x4e')]));this['startAcw'](_0x5b14c7[_0x0508('0x4e')]);}else if(this['channels'][_0x5b14c7[_0x0508('0x4f')]]){logger[_0x0508('0x1c')](_0x0508('0x50'),JSON['stringify'](_0x5b14c7[_0x0508('0x4f')]));this[_0x0508('0x1f')](_0x5b14c7[_0x0508('0x4f')]);}}catch(_0x1e7829){logger[_0x0508('0x1d')](_0x0508('0x51'),_0x1e7829[_0x0508('0x3c')]);}};Acw[_0x0508('0x16')][_0x0508('0xf')]=function(_0x5e9a1d){try{if(this['voiceQueues'][_0x5e9a1d[_0x0508('0x21')]]&&this[_0x0508('0x4')][_0x5e9a1d[_0x0508('0x21')]]['autopause']===_0x0508('0x52')){if(this[_0x0508('0x5')][_0x5e9a1d['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5e9a1d['uniqueid'],_0x5e9a1d[_0x0508('0x20')],_0x5e9a1d[_0x0508('0x21')]);return RpcUser['savePause'](this['agents'][_0x5e9a1d['interface']],_0x0508('0x53'),_0x5e9a1d[_0x0508('0x1a')]);}}}catch(_0x306a9e){logger[_0x0508('0x1d')](_0x0508('0x54'),_0x306a9e[_0x0508('0x3c')]);}};Acw['prototype'][_0x0508('0x4b')]=function(_0x38aef2,_0x17ff73=0x2710){if(this[_0x0508('0x7')][_0x38aef2]){setTimeout(()=>{delete this[_0x0508('0x7')][_0x38aef2];},_0x17ff73);}};module[_0x0508('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f7188e7..2137381 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 _0x9db6=['format','port','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','queuesummary','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','actionSipShowRegistry','actionQueueSummary','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','action','error'];(function(_0xb946cb,_0x163b4a){var _0x53fb3b=function(_0x32ab48){while(--_0x32ab48){_0xb946cb['push'](_0xb946cb['shift']());}};_0x53fb3b(++_0x163b4a);}(_0x9db6,0x1b0));var _0x69db=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x9db6[_0x16e0c8];return _0xe4b5af;};'use strict';var Manager=require(_0x69db('0x0'));var BPromise=require(_0x69db('0x1'));var util=require(_0x69db('0x2'));var logger=require(_0x69db('0x3'))(_0x69db('0x4'));var config=require(_0x69db('0x5'));var ami=new Manager(config['asterisk']['port'],config[_0x69db('0x6')]['ip'],config[_0x69db('0x6')][_0x69db('0x7')],config['asterisk'][_0x69db('0x8')],!![]);ami[_0x69db('0x9')]();ami['Action']=BPromise['promisify'](ami[_0x69db('0xa')]);function error(_0x459964){logger[_0x69db('0xb')](util[_0x69db('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x69db('0x6')][_0x69db('0x7')],config[_0x69db('0x6')]['ip'],config['asterisk'][_0x69db('0xd')],util['inspect'](_0x459964,![],null)));}function close(){logger[_0x69db('0xb')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x69db('0x6')]['username'],config[_0x69db('0x6')]['ip'],config['asterisk'][_0x69db('0xd')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x69db('0xe')]({'action':_0x69db('0xf')});};};ami[_0x69db('0x10')]=function(){return function(){return ami[_0x69db('0xe')]({'action':_0x69db('0x11')});};};ami[_0x69db('0x12')]=function(){return function(){return ami[_0x69db('0xe')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x69db('0xe')]({'action':_0x69db('0x13')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x69db('0xe')]({'action':_0x69db('0x14')});};};function connect(){logger[_0x69db('0x15')](util['format'](_0x69db('0x16'),config['asterisk'][_0x69db('0x7')],config[_0x69db('0x6')]['ip'],config[_0x69db('0x6')][_0x69db('0xd')]));ami[_0x69db('0x17')](_0x69db('0xb'),error);ami[_0x69db('0x17')](_0x69db('0x18'),close);}ami['on'](_0x69db('0x19'),connect);ami['on'](_0x69db('0x1a'),function(_0x4a9df1){logger[_0x69db('0x15')](util['format'](_0x69db('0x1b'),config[_0x69db('0x6')][_0x69db('0x7')],config[_0x69db('0x6')]['ip'],config[_0x69db('0x6')]['port'],util[_0x69db('0x1c')](_0x4a9df1,![],null)));});ami['on']('fullybooted',function(){logger[_0x69db('0x15')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x69db('0x6')][_0x69db('0x7')],config['asterisk']['ip'],config[_0x69db('0x6')][_0x69db('0xd')]));return Promise[_0x69db('0x1d')]()[_0x69db('0x1e')](ami[_0x69db('0x1f')]())[_0x69db('0x1e')](ami[_0x69db('0x10')]())[_0x69db('0x1e')](ami['actionSipPeerStatus']())[_0x69db('0x1e')](ami[_0x69db('0x20')]())[_0x69db('0x1e')](ami[_0x69db('0x21')]())[_0x69db('0x22')](function(_0x3bdf2c){logger[_0x69db('0xb')](_0x69db('0x23'),util[_0x69db('0x1c')](_0x3bdf2c,{'showHidden':![],'depth':null}));});});ami[_0x69db('0x17')](_0x69db('0xb'),error);ami[_0x69db('0x17')](_0x69db('0x18'),close);module[_0x69db('0x24')]=ami; \ No newline at end of file +var _0x6e03=['actionSipShowRegistry','Action','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','catch','util','../../config/logger','ami','../../config/environment','port','asterisk','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x5377ff,_0x18a515){var _0x1758aa=function(_0xc7e1c0){while(--_0xc7e1c0){_0x5377ff['push'](_0x5377ff['shift']());}};_0x1758aa(++_0x18a515);}(_0x6e03,0xcf));var _0x36e0=function(_0x5f47e2,_0x2b1928){_0x5f47e2=_0x5f47e2-0x0;var _0x70aaa9=_0x6e03[_0x5f47e2];return _0x70aaa9;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0x36e0('0x0'));var logger=require(_0x36e0('0x1'))(_0x36e0('0x2'));var config=require(_0x36e0('0x3'));var ami=new Manager(config['asterisk'][_0x36e0('0x4')],config['asterisk']['ip'],config[_0x36e0('0x5')][_0x36e0('0x6')],config[_0x36e0('0x5')][_0x36e0('0x7')],!![]);ami[_0x36e0('0x8')]();ami['Action']=BPromise[_0x36e0('0x9')](ami[_0x36e0('0xa')]);function error(_0x376cc2){logger[_0x36e0('0xb')](util[_0x36e0('0xc')](_0x36e0('0xd'),config[_0x36e0('0x5')][_0x36e0('0x6')],config['asterisk']['ip'],config['asterisk'][_0x36e0('0x4')],util['inspect'](_0x376cc2,![],null)));}function close(){logger[_0x36e0('0xb')](util[_0x36e0('0xc')](_0x36e0('0xe'),config[_0x36e0('0x5')][_0x36e0('0x6')],config[_0x36e0('0x5')]['ip'],config[_0x36e0('0x5')][_0x36e0('0x4')]));}ami[_0x36e0('0xf')]=function(){return function(){return ami[_0x36e0('0x10')]({'action':_0x36e0('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x36e0('0x12')});};};ami[_0x36e0('0x13')]=function(){return function(){return ami[_0x36e0('0x10')]({'action':_0x36e0('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x36e0('0x10')]({'action':_0x36e0('0x15')});};};ami[_0x36e0('0x16')]=function(){return function(){return ami[_0x36e0('0x10')]({'action':_0x36e0('0x17')});};};function connect(){logger[_0x36e0('0x18')](util[_0x36e0('0xc')](_0x36e0('0x19'),config[_0x36e0('0x5')][_0x36e0('0x6')],config[_0x36e0('0x5')]['ip'],config['asterisk']['port']));ami[_0x36e0('0x1a')](_0x36e0('0xb'),error);ami[_0x36e0('0x1a')](_0x36e0('0x1b'),close);}ami['on']('connect',connect);ami['on'](_0x36e0('0x1c'),function(_0x57b8d4){logger[_0x36e0('0x18')](util['format'](_0x36e0('0x1d'),config[_0x36e0('0x5')][_0x36e0('0x6')],config[_0x36e0('0x5')]['ip'],config[_0x36e0('0x5')][_0x36e0('0x4')],util[_0x36e0('0x1e')](_0x57b8d4,![],null)));});ami['on']('fullybooted',function(){logger['info'](util['format'](_0x36e0('0x1f'),config[_0x36e0('0x5')][_0x36e0('0x6')],config[_0x36e0('0x5')]['ip'],config[_0x36e0('0x5')]['port']));return Promise[_0x36e0('0x20')]()['then'](ami[_0x36e0('0xf')]())[_0x36e0('0x21')](ami[_0x36e0('0x22')]())[_0x36e0('0x21')](ami[_0x36e0('0x13')]())['then'](ami[_0x36e0('0x23')]())['then'](ami[_0x36e0('0x16')]())[_0x36e0('0x24')](function(_0x19cb00){logger[_0x36e0('0xb')]('[ami.js][fullybooted]',util[_0x36e0('0x1e')](_0x19cb00,{'showHidden':![],'depth':null}));});});ami['once'](_0x36e0('0xb'),error);ami[_0x36e0('0x1a')]('close',close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 8f9749d..44a64a7 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 _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x5ec30e,_0x3f8557){var _0x40627a=function(_0x49ec95){while(--_0x49ec95){_0x5ec30e['push'](_0x5ec30e['shift']());}};_0x40627a(++_0x3f8557);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file +var _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x3b7f8f,_0x4be761){var _0x240250=function(_0xaf4e56){while(--_0xaf4e56){_0x3b7f8f['push'](_0x3b7f8f['shift']());}};_0x240250(++_0x4be761);}(_0xf4eb,0xec));var _0xbf4e=function(_0x56e71e,_0x5f258d){_0x56e71e=_0x56e71e-0x0;var _0x40ba9d=_0xf4eb[_0x56e71e];return _0x40ba9d;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 54e4d86..ab2d4a6 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 _0x9279=['busy','[syncAgentComplete][createHistory][5]','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','avgHandleTime','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','loggedIn','outboundQueuePauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','unlockContact','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','originated','temp','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','[actionOriginate]','[handlePower]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','-----\x20Stats\x20Predictive\x20---','info','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','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','getSeconds','startProgressive','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','contactsRescheduled','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','message','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','isIVRCampaignActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20deactivated','stringify','active','SIP/%s','reachable','status','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','timezones','content','indexOf','true','catch','iftime\x20%s,%s','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','sendMessageOneNotActive','resolve','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','Timezone:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','agiafterat','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','additional','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','countabandonedretry','dialAbandonedMaxRetry','rescheduleContact','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','idHopper','run','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','Success','[callProgressDetecting]\x20','variable','dialAMDActive','value','HANGUP','[syncVarSet]','HangupInAMD','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','custom:amd','[syncHangupInAMDIvr]','outboundAnswerAgiCallsDay','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','reason19\x20machine....','dialMachineMaxRetry','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncHangupIvr]','dialQueueProject','[syncHangupIvr][createHistory]','[syncHangup2]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','INACTIVE','statusMessage','getQueueCampaignStatusMessage','available','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','[emptyContact]','merge','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','launchHandleIvr','handleIvr','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','NONE','XMD-AMDINITIALSILENCE','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','xcally-motion-dialer','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','dialGlobalMaxRetry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','object','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','stateGlobal','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy'];(function(_0x58aa81,_0x565835){var _0x1a6990=function(_0x2f1ffa){while(--_0x2f1ffa){_0x58aa81['push'](_0x58aa81['shift']());}};_0x1a6990(++_0x565835);}(_0x9279,0x78));var _0x9927=function(_0x51d71a,_0x596fda){_0x51d71a=_0x51d71a-0x0;var _0xff01f1=_0x9279[_0x51d71a];return _0xff01f1;};'use strict';var util=require(_0x9927('0x0'));var _=require(_0x9927('0x1'));var uuid=require(_0x9927('0x2'));var moment=require(_0x9927('0x3'));var rr=require('rr');var Redis=require(_0x9927('0x4'));var utils=require('./utils');var hopperUtils=require(_0x9927('0x5'));var ut=require(_0x9927('0x6'));var config=require(_0x9927('0x7'));var logger=require(_0x9927('0x8'))(_0x9927('0x9'));var loggerBooked=require(_0x9927('0x8'))(_0x9927('0xa'));var loggerPredictive=require(_0x9927('0x8'))(_0x9927('0xb'));var loggerPredictiveCalls=require(_0x9927('0x8'))(_0x9927('0xc'));var loggerSyncQueueSummary=require(_0x9927('0x8'))(_0x9927('0xd'));var ami=require(_0x9927('0xe'));config[_0x9927('0xf')]=_[_0x9927('0x10')](config[_0x9927('0xf')],{'host':_0x9927('0x11'),'port':0x18eb});var io=require(_0x9927('0x12'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x9927('0x13'));var RpcSetting=require(_0x9927('0x14'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0x9927('0x15'));var Final=require(_0x9927('0x16'));var AgentComplete=require(_0x9927('0x17'));var QueueCallerAbandon=require(_0x9927('0x18'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x9927('0x19')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x9927('0x1a')][_0x9927('0x1b')]=function(_0x466920){this[_0x9927('0x1c')]=this[_0x9927('0x1c')]?this['tail'][_0x9927('0x1d')](_0x466920):_0x466920();};function Dialer(_0x4db77f,_0x451857){this[_0x9927('0x1e')]=new Sequence();this[_0x9927('0x1f')]=_0x451857;this[_0x9927('0x20')]=_0x4db77f[_0x9927('0x20')];this[_0x9927('0x21')]=_0x4db77f[_0x9927('0x21')];this[_0x9927('0x22')]=_0x4db77f[_0x9927('0x22')];this['trunks']=_0x4db77f[_0x9927('0x23')];this['maxNumberOriginate']=config[_0x9927('0x24')]||0x2;this[_0x9927('0x25')]={};this['actions']={};this[_0x9927('0x26')]={};this[_0x9927('0x27')]={};this[_0x9927('0x28')]={};this[_0x9927('0x29')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x9927('0x2a')]={};this['queueBookedRR']={};this[_0x9927('0x2b')]={};ami['on']('agentconnect',this[_0x9927('0x2c')][_0x9927('0x2d')](this));ami['on'](_0x9927('0x2e'),this[_0x9927('0x2f')]['bind'](this));ami['on'](_0x9927('0x30'),this[_0x9927('0x31')][_0x9927('0x2d')](this));ami['on'](_0x9927('0x32'),this[_0x9927('0x33')][_0x9927('0x2d')](this));ami['on'](_0x9927('0x34'),this[_0x9927('0xd')][_0x9927('0x2d')](this));ami['on'](_0x9927('0x35'),this[_0x9927('0x36')][_0x9927('0x2d')](this));ami['on'](_0x9927('0x37'),this[_0x9927('0x38')][_0x9927('0x2d')](this));ami['on']('newexten',this[_0x9927('0x39')][_0x9927('0x2d')](this));ami['on']('varset',this[_0x9927('0x3a')][_0x9927('0x2d')](this));ami['on'](_0x9927('0x3b'),this['syncQueueMember'][_0x9927('0x2d')](this));ami['on']('queuestatuscomplete',this[_0x9927('0x3c')][_0x9927('0x2d')](this));this[_0x9927('0x3d')]();this[_0x9927('0x3e')]();RpcSetting[_0x9927('0x3f')]()[_0x9927('0x40')](function(_0x4cc4ef){previewRecallmeReminderInterval=_0x4cc4ef['previewRecallmeReminderInterval'];});}function isNotNull(_0x3c5b9c){return _0x3c5b9c!==null&&!_[_0x9927('0x41')](_0x3c5b9c);}function msgResponse(_0x4ba2a4,_0x364446,_0x41c534){return{'action':_0x4ba2a4,'response':_0x364446,'message':_0x41c534,'stack':_0x41c534};}function emit(_0x2dd50c,_0x10566a,_0x2b1639){io['to'](_0x2dd50c)[_0x9927('0x42')](_0x10566a,_0x2b1639);}function emitOutboundVoiceQueueSummary(_0xe209f9){if(_0xe209f9[_0x9927('0x43')]===_0x9927('0x44')){logger[_0x9927('0x45')](_0x9927('0x46'),util[_0x9927('0x47')](_0xe209f9,{'showHidden':![],'depth':null}));emit(util[_0x9927('0x48')](_0x9927('0x49'),_0xe209f9['name']),'voice_queue:save',_0xe209f9);}}function checkGetDataPredictive(_0xb6318e){if(isNotNull(_0xb6318e)&&!_['isEmpty'](_0xb6318e)){loggerPredictive['info'](_0x9927('0x4a'));loggerPredictive[_0x9927('0x4b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb6318e['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x9927('0x4c'),_0xb6318e['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x9927('0x4b')](_0x9927('0x4d'),_0xb6318e[_0x9927('0x4e')]);loggerPredictive[_0x9927('0x4b')](_0x9927('0x4f'),_0xb6318e[_0x9927('0x50')]);loggerPredictive[_0x9927('0x4b')](_0x9927('0x51'),_0xb6318e[_0x9927('0x52')]);loggerPredictive[_0x9927('0x4b')](_0x9927('0x53'),_0xb6318e['predictiveIntervalAvgTalktime']);loggerPredictive[_0x9927('0x4b')]('---------------------------');if(_0xb6318e[_0x9927('0x54')]>0x0){if(!_[_0x9927('0x41')](_0xb6318e[_0x9927('0x55')])&&_0xb6318e[_0x9927('0x55')]>0x0){return!![];}loggerPredictive['info'](_0x9927('0x56'));if(!_[_0x9927('0x41')](_0xb6318e[_0x9927('0x52')])&&_0xb6318e[_0x9927('0x52')]>0x0){return!![];}loggerPredictive[_0x9927('0x4b')](_0x9927('0x57'));}else{loggerPredictive[_0x9927('0x4b')](_0x9927('0x58'));}}else{loggerPredictive[_0x9927('0x4b')](_0x9927('0x59'));}return![];}function mergeDataErlangB(_0x4f2109){return function(_0x3aa1f7){loggerPredictive[_0x9927('0x4b')](_0x9927('0x5a'));loggerPredictive[_0x9927('0x4b')](_0x9927('0x5b'),_0x3aa1f7['erlangCalls']);loggerPredictive['info'](_0x9927('0x5c'),_0x3aa1f7['erlangCallToSecond']);loggerPredictive['info'](_0x9927('0x5d'),_0x3aa1f7[_0x9927('0x5e')]);loggerPredictive[_0x9927('0x4b')](_0x9927('0x5f'),_0x3aa1f7[_0x9927('0x60')]);loggerPredictive['info'](_0x9927('0x5d'),_0x3aa1f7['erlangAbandonmentRate']);loggerPredictive['info']('---------------------------');_['merge'](_0x4f2109,_0x3aa1f7);};}function ifInterval(_0x1e7b85,_0x213836){if(_[_0x9927('0x41')](_0x213836)){return![];}return utils[_0x9927('0x61')](undefined,_0x213836)<_0x1e7b85*0x3c;}function clearPredictiveAttributes(_0x5cbc4f){if(_0x5cbc4f[_0x9927('0x62')]){_0x5cbc4f[_0x9927('0x62')]=undefined;loggerPredictive[_0x9927('0x45')](_0x5cbc4f[_0x9927('0x63')],_0x9927('0x64'));}if(_0x5cbc4f[_0x9927('0x29')]){_0x5cbc4f['startPredictive']=undefined;loggerPredictive[_0x9927('0x45')](_0x5cbc4f[_0x9927('0x63')],_0x9927('0x65'));}if(_0x5cbc4f[_0x9927('0x66')]){clearInterval(_0x5cbc4f[_0x9927('0x66')]);_0x5cbc4f[_0x9927('0x66')]=undefined;loggerPredictive[_0x9927('0x45')](_0x5cbc4f[_0x9927('0x63')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x4854aa,_0x2c5744){return function(_0x492e3f){loggerPredictive[_0x9927('0x67')](_0x2c5744[_0x9927('0x63')],_0x4854aa);loggerPredictive['error'](_0x492e3f[_0x9927('0x68')]);clearPredictiveAttributes(_0x2c5744);};}function loggerCatch(_0x43c1c4){return function(_0x39bfae){logger[_0x9927('0x67')](_0x43c1c4,util[_0x9927('0x47')](_0x39bfae,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x211635){return function(_0x591459){if(isNotNull(_0x591459)&&isNotNull(_0x591459[0x0])){if(_0x591459[0x0][_0x9927('0x69')]>0x0){_0x211635['message']=utils[_0x9927('0x6a')]['CONTACTS_RESCHEDULED'];logger[_0x9927('0x4b')](_0x9927('0x6b')+_0x211635['name'],_0x591459[0x0]['contactsRescheduled'],_0x9927('0x6c'));}else{_0x211635['message']=utils[_0x9927('0x6a')]['NO_AVAILABLE_CONTACTS'];logger[_0x9927('0x4b')](_0x9927('0x6d')+_0x211635['name']);}}};}function createObjHistory(_0x4ab92d,_0x5e76c7,_0x12c08e,_0x36e3c6,_0x4554ed){_0x4ab92d[_0x9927('0x6e')]=_0x12c08e;var _0x1c6568=new Action(_0x4ab92d,_0x5e76c7);var _0x25fe73=new History(_0x1c6568);_0x25fe73[_0x9927('0x6f')]=_0x36e3c6;_0x25fe73[_0x9927('0x70')]=_0x4554ed;_0x25fe73[_0x9927('0x71')]=_0x1c6568[_0x9927('0x72')];return _0x25fe73;}function unlockQueueStatus(_0x40b915,_0x4af301){setTimeout(function(){if(_[_0x9927('0x41')](_0x40b915['queueStatusComplete'])){loggerBooked['error'](_0x9927('0x73'),_0x4af301);}_0x40b915[_0x9927('0x74')]=!![];loggerBooked[_0x9927('0x4b')](_0x9927('0x75'),_0x4af301,JSON['stringify'](_[_0x9927('0x76')](_0x40b915,['name',_0x9927('0x74')])));},0x1f3);}function checkInterval(_0x20e24b){return function(){if(!isNotNull(_0x20e24b[_0x9927('0x77')])){_0x20e24b[_0x9927('0x6e')]=utils[_0x9927('0x6a')][_0x9927('0x78')];throw _0x20e24b['name']+_0x9927('0x79');}if(!isNotNull(_0x20e24b[_0x9927('0x77')][_0x9927('0x7a')])){_0x20e24b[_0x9927('0x6e')]=utils['CAMPAIGN_STATUS'][_0x9927('0x78')];throw _0x20e24b[_0x9927('0x63')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x9927('0x7b')](_0x20e24b[_0x9927('0x77')][_0x9927('0x7a')]))){_0x20e24b[_0x9927('0x6e')]=utils[_0x9927('0x6a')][_0x9927('0x78')];throw _0x20e24b[_0x9927('0x63')]+_0x9927('0x79');}};}function checkIsIVRCampaignActive(_0xb1d8aa){return function(){if(!utils[_0x9927('0x7c')](_0xb1d8aa)){_0xb1d8aa[_0x9927('0x6e')]=utils[_0x9927('0x6a')]['INACTIVE'];throw _0xb1d8aa[_0x9927('0x63')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x1c3bb4){if(utils['isIVRCampaign'](_0x1c3bb4)){emit(util[_0x9927('0x48')]('campaign:ivr:%s',_0x1c3bb4[_0x9927('0x63')]),'campaign:save',_0x1c3bb4);}}function loggerCatchQueueSummary(_0x436197,_0x549c88){return function(_0x49caa1){clearPredictiveAttributes(_0x549c88);emitCampaignSummary(_0x549c88);loggerSyncQueueSummary[_0x9927('0x45')](_0x436197,util[_0x9927('0x47')](_0x49caa1,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2fe61e){if(_0x2fe61e['sendMessageOneNotActive']){if(_0x2fe61e['originated']===0x0){_0x2fe61e['sendMessageOneNotActive']=![];_0x2fe61e[_0x9927('0x6e')]=utils[_0x9927('0x6a')]['INACTIVE'];loggerSyncQueueSummary[_0x9927('0x45')](_0x9927('0x7d'),_0x2fe61e[_0x9927('0x63')],_0x9927('0x7e'));}else{_0x2fe61e[_0x9927('0x6e')]=utils[_0x9927('0x6a')][_0x9927('0x7f')];loggerSyncQueueSummary[_0x9927('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2fe61e[_0x9927('0x63')],_0x9927('0x80'));}emitCampaignSummary(_0x2fe61e);}}function myreject(_0x19150a){return function(_0x1c1e25){return _0x19150a(msgResponse('[ifTime][Action]','Error',JSON[_0x9927('0x81')](_0x1c1e25)));};}Dialer[_0x9927('0x1a')]['isTrunkReachable']=function(_0x91b53e){return!_[_0x9927('0x41')](_0x91b53e)&&_0x91b53e&&!_['isUndefined'](_0x91b53e[_0x9927('0x63')])&&!_[_0x9927('0x41')](_0x91b53e[_0x9927('0x82')])&&_0x91b53e['active']&&(this[_0x9927('0x23')][util[_0x9927('0x48')](_0x9927('0x83'),_0x91b53e[_0x9927('0x63')])]['status']===_0x9927('0x84')||this[_0x9927('0x23')][util['format'](_0x9927('0x83'),_0x91b53e[_0x9927('0x63')])][_0x9927('0x85')]==='unmonitored');};Dialer[_0x9927('0x1a')][_0x9927('0x86')]=function(_0x1024cc){var _0x45385c=this;return function(){if(!_0x45385c[_0x9927('0x87')](_0x1024cc['Trunk'])){if(!_0x45385c[_0x9927('0x87')](_0x1024cc[_0x9927('0x88')])){_0x1024cc[_0x9927('0x6e')]=utils[_0x9927('0x6a')]['TRUNK_NOT_REACHABLE'];throw _0x1024cc[_0x9927('0x63')]+_0x9927('0x89');}}};};Dialer[_0x9927('0x1a')][_0x9927('0x8a')]=function(_0x33947e,_0x3b49d9,_0x224f6d,_0x58fb1c){var _0x212627=this;return function(){var _0x50451e=!![];return _0x212627[_0x9927('0x8b')](_0x33947e,_0x3b49d9,_0x224f6d,_0x58fb1c,_0x50451e);};};Dialer[_0x9927('0x1a')][_0x9927('0x8c')]=function(_0x3f7059,_0x3189b4,_0x3867d0,_0x504432){var _0x1ce0f5=this;return function(){var _0x1e8518=![];return _0x1ce0f5['ifTimeIvr'](_0x3f7059[_0x9927('0x7a')],_0x3189b4,_0x3867d0,_0x504432,_0x1e8518);};};Dialer['prototype'][_0x9927('0x8b')]=function(_0x159e59,_0x17973e,_0x10d5ca,_0x9eca7f,_0x46ea95){var _0x429aed=[];return new Promise(function(_0x467e23,_0x4ba473){if(!isNotNull(_0x159e59)){_0x9eca7f[_0x9927('0x6e')]=utils[_0x9927('0x6a')][_0x9927('0x78')];return _0x4ba473(msgResponse(_0x9927('0x8d'),_0x9927('0x8e'),_0x10d5ca+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x9927('0x7b')](_0x159e59)){_0x9eca7f[_0x9927('0x6e')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x4ba473(msgResponse(_0x9927('0x8d'),'Failure',_0x10d5ca+'\x20Intervals\x20is\x20empty\x20'));}if(_0x17973e&&_[_0x9927('0x41')](config['timezones'][_0x17973e])){_0x9eca7f[_0x9927('0x6e')]=utils[_0x9927('0x6a')][_0x9927('0x8f')];return _0x4ba473(msgResponse(_0x9927('0x8d'),_0x9927('0x8e'),_0x10d5ca+_0x9927('0x90')+_0x17973e));}if(_[_0x9927('0x91')](_0x159e59)){for(var _0x24243f=0x0;_0x24243f<_0x159e59[_0x9927('0x92')];_0x24243f+=0x1){_0x429aed[_0x9927('0x93')](ami[_0x9927('0x94')]({'action':_0x9927('0x95'),'command':util[_0x9927('0x48')]('iftime\x20%s,%s',_0x159e59[_0x24243f][_0x9927('0x96')],!_[_0x9927('0x41')](config[_0x9927('0x97')][_0x17973e])?_0x17973e:'')})[_0x9927('0x40')](function(_0x23b65d){return _0x23b65d[_0x9927('0x98')][_0x9927('0x99')](_0x9927('0x9a'))>=0x0;})[_0x9927('0x9b')](myreject(_0x4ba473)));}}else{_0x429aed['push'](ami[_0x9927('0x94')]({'action':_0x9927('0x95'),'command':util[_0x9927('0x48')](_0x9927('0x9c'),_0x159e59,!_['isUndefined'](config[_0x9927('0x97')][_0x17973e])?_0x17973e:'')})[_0x9927('0x40')](function(_0xaae9a7){return _0xaae9a7[_0x9927('0x98')]['indexOf'](_0x9927('0x9a'))>=0x0;})[_0x9927('0x9b')](myreject(_0x4ba473)));}Promise[_0x9927('0x9d')](_0x429aed)['then'](function(_0x23b9a0){var _0x45f2d1=_[_0x9927('0x9e')](_0x23b9a0);if(_0x45f2d1){return _0x467e23(_0x45f2d1);}else{_0x9eca7f[_0x9927('0x6e')]=_0x46ea95?utils[_0x9927('0x6a')][_0x9927('0x9f')]:utils[_0x9927('0x6a')][_0x9927('0xa0')];return _0x4ba473(msgResponse(_0x9927('0xa1'),_0x9927('0x8e'),_0x9927('0xa2')+_0x46ea95+'\x20'+_0x10d5ca+_0x9927('0xa3')+util[_0x9927('0x47')](_0x159e59,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x17973e));}})[_0x9927('0x9b')](function(_0x2456c4){return _0x4ba473(msgResponse('ifTime',_0x9927('0x8e'),JSON[_0x9927('0x81')](_0x2456c4)));});});};Dialer[_0x9927('0x1a')]['loopCampaigns']=function(){var _0x12cb0b=this;return cmHopper[_0x9927('0xa4')]({'active':![]},{'where':{'active':!![]}})[_0x9927('0x40')](function(){setInterval(function(){_0x12cb0b[_0x9927('0xa5')]();},0x3e8);});};Dialer[_0x9927('0x1a')][_0x9927('0xa5')]=function(){var _0x1bb955=this;var _0x17bd4d;for(var _0x2432d1 in this[_0x9927('0x21')]){if(typeof this[_0x9927('0x21')][_0x2432d1]!==_0x9927('0xa6')){_0x17bd4d=this[_0x9927('0x21')][_0x2432d1];if(utils['isIVRCampaign'](_0x17bd4d)&&utils[_0x9927('0x7c')](_0x17bd4d)){_0x17bd4d[_0x9927('0xa7')]=!![];Promise[_0x9927('0xa8')]()[_0x9927('0x40')](checkIsIVRCampaignActive(_0x17bd4d))[_0x9927('0x40')](checkInterval(_0x17bd4d))[_0x9927('0x40')](_0x1bb955[_0x9927('0x86')](_0x17bd4d))[_0x9927('0x40')](_0x1bb955[_0x9927('0x8a')](_0x17bd4d['dialGlobalInterval'],_0x17bd4d[_0x9927('0xa9')],_0x17bd4d[_0x9927('0x63')],_0x17bd4d))['then'](_0x1bb955[_0x9927('0x8c')](_0x17bd4d[_0x9927('0x77')],_0x17bd4d[_0x9927('0xa9')],_0x17bd4d['name'],_0x17bd4d))[_0x9927('0x40')](_0x1bb955['launchHandleIvr'](_0x17bd4d))[_0x9927('0x9b')](loggerCatchQueueSummary(_0x9927('0xaa'),_0x17bd4d));}else{notSendMessagesCampaign(_0x17bd4d);}}}};Dialer[_0x9927('0x1a')][_0x9927('0xab')]=function(_0x4cd896){if(_0x4cd896[_0x9927('0xac')]!==_0x9927('0xb')){clearPredictiveAttributes(_0x4cd896);}switch(_0x4cd896[_0x9927('0xac')]){case'progressive':this[_0x9927('0xad')](_0x4cd896,0x1);break;case _0x9927('0xae'):this[_0x9927('0xad')](_0x4cd896,_0x4cd896[_0x9927('0xaf')]);break;case _0x9927('0xb'):this['predictive'](_0x4cd896);break;case _0x9927('0xa'):this['handlePower'](_0x4cd896,0x1);break;default:logger[_0x9927('0x67')](_0x9927('0xb0'),_0x4cd896['name'],_0x9927('0xb1'));}};Dialer[_0x9927('0x1a')]['ifTime']=function(_0x273cc9,_0x3131ee){var _0x411e7b=_0x273cc9[_0x9927('0xa9')];var _0x2cc1cd=_0x3131ee?_0x273cc9[_0x9927('0xb2')]:_0x273cc9['Interval']['Intervals'];logger['silly'](_0x9927('0xb3'),_0x2cc1cd,_0x411e7b,_0x273cc9['name'],util[_0x9927('0x48')](_0x9927('0xb4'),_0x273cc9[_0x9927('0x63')],_0x273cc9['id']));var _0xc88e57=null;return Interval['intervalIftime'](_0x2cc1cd,_0x411e7b)[_0x9927('0x40')](function(_0x37e9f4){if(_0x37e9f4===!![]){return _0x37e9f4;}else{_0x273cc9[_0x9927('0x6e')]=_0x3131ee?utils[_0x9927('0x6a')][_0x9927('0x9f')]:utils['CAMPAIGN_STATUS'][_0x9927('0xa0')];_0xc88e57=msgResponse(_0x9927('0xa1'),'Failure',_0x9927('0xa2')+_0x3131ee+'\x20'+_0x273cc9[_0x9927('0x63')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x2cc1cd,{'showHidden':![],'depth':null})+_0x9927('0xb5')+_0x411e7b);}if(_0xc88e57!==null){logger[_0x9927('0xb6')](_0x9927('0xb7'),_0xc88e57);_0xc88e57['isGlobal']=_0x3131ee;throw _0xc88e57;}})[_0x9927('0x9b')](function(_0x107d04){logger['error'](_0x9927('0xb8'),_0x107d04);throw msgResponse(_0x9927('0xb9'),'Error',util[_0x9927('0x47')](_0x107d04,{'showHidden':![],'depth':null}));});};Dialer[_0x9927('0x1a')][_0x9927('0x2c')]=function(_0x2991f2){if(this[_0x9927('0x20')][_0x2991f2[_0x9927('0xba')]]){if(this['uniqueId'][_0x2991f2[_0x9927('0xbb')]]&&this[_0x9927('0x27')][_0x2991f2[_0x9927('0xbb')]][_0x9927('0x43')]!==_0x9927('0xbc')){utils[_0x9927('0xbd')](this[_0x9927('0x20')][_0x2991f2['queue']],_0x9927('0xbe'));this['uniqueId'][_0x2991f2[_0x9927('0xbb')]]['answertime']=moment()[_0x9927('0x48')](_0x9927('0xbf'));}}};Dialer[_0x9927('0x1a')][_0x9927('0x33')]=function(_0x12af82){var _0x198b42=this[_0x9927('0x27')][_0x12af82[_0x9927('0xbb')]];if(this['voiceQueues'][_0x12af82['queue']]){if(_0x198b42&&_0x198b42['type']!==_0x9927('0xbc')){delete this[_0x9927('0x27')][_0x12af82[_0x9927('0xbb')]];this[_0x9927('0x20')][_0x12af82['queue']][_0x9927('0xc0')]+=0x1;var _0x28b346=new AgentComplete(_0x198b42,_0x12af82);if(_0x12af82[_0x9927('0xc1')]===_0x9927('0xc2')){_0x28b346['agiafterat']=this['voiceQueues'][_0x12af82['queue']][_0x9927('0xc3')]&&this['voiceQueues'][_0x12af82['queue']][_0x9927('0xc4')]?moment()[_0x9927('0x48')](_0x9927('0xbf')):undefined;}hopperUtils[_0x9927('0xc5')](_0x28b346)['catch'](loggerCatch(_0x9927('0xc6')));hopperUtils[_0x9927('0xc7')](_0x28b346)['catch'](loggerCatch(_0x9927('0xc8')));}}};Dialer[_0x9927('0x1a')]['syncQueueCallerAbandon']=function(_0x2714ac){var _0x26e4da=this[_0x9927('0x27')][_0x2714ac[_0x9927('0xbb')]];var _0x1149fa=this;var _0x591204=![];var _0x279e63;var _0x53dbef;if(this[_0x9927('0x20')][_0x2714ac[_0x9927('0xba')]]){if(_0x26e4da&&_0x26e4da[_0x9927('0x43')]!==_0x9927('0xbc')){delete this['uniqueId'][_0x2714ac['uniqueid']];utils[_0x9927('0xbd')](this[_0x9927('0x20')][_0x2714ac['queue']],_0x9927('0xc9'));_0x26e4da[_0x9927('0xca')]=moment()['format'](_0x9927('0xbf'));var _0x13c3ee=new QueueCallerAbandon(_0x26e4da,_0x2714ac);if(utils[_0x9927('0x61')](_0x26e4da[_0x9927('0xca')],_0x26e4da[_0x9927('0xcb')])>=_0x26e4da[_0x9927('0xcc')]){this[_0x9927('0x20')][_0x2714ac[_0x9927('0xba')]][_0x9927('0x4e')]+=0x1;this['voiceQueues'][_0x2714ac[_0x9927('0xba')]][_0x9927('0xcd')]+=0x1;this[_0x9927('0x20')][_0x2714ac[_0x9927('0xba')]][_0x9927('0xce')]+=0x1;_0x13c3ee[_0x9927('0x6f')]=0xa;_0x13c3ee[_0x9927('0x70')]='Drop';_0x13c3ee[_0x9927('0xcf')]=_0x9927('0xd0');_0x13c3ee[_0x9927('0xd1')]=this['voiceQueues'][_0x2714ac[_0x9927('0xba')]][_0x9927('0xc3')]?moment()[_0x9927('0x48')](_0x9927('0xbf')):undefined;_0x13c3ee[_0x9927('0xd2')]+=0x1;_0x13c3ee[_0x9927('0xd3')]+=0x1;_0x279e63=this['voiceQueues'][_0x2714ac['queue']]['dialDropRetryFrequency'];_0x53dbef=this[_0x9927('0x20')][_0x2714ac[_0x9927('0xba')]][_0x9927('0xd4')];hopperUtils[_0x9927('0xd5')](_0x13c3ee,_0x13c3ee['state'],_0x26e4da[_0x9927('0xd6')])[_0x9927('0x40')](function(_0x2fa7d5){_0x591204=_0x2fa7d5['additional']==0x1;if(_0x13c3ee[_0x9927('0xd2')]>=_0x1149fa['voiceQueues'][_0x2714ac['queue']][_0x9927('0xd7')]){_0x1149fa[_0x9927('0xd8')](_0x13c3ee,_0x2fa7d5[_0x9927('0xd9')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x13c3ee[_0x9927('0xd2')],'scheduledat':moment()[_0x9927('0xda')](_0x1149fa[_0x9927('0x20')][_0x2714ac[_0x9927('0xba')]]['dialDropRetryFrequency'],_0x9927('0xdb'))[_0x9927('0x48')](_0x9927('0xbf')),'ContactId':_0x26e4da[_0x9927('0xdc')],'ListId':_0x26e4da[_0x9927('0xdd')],'VoiceQueueId':_0x26e4da[_0x9927('0xde')]||undefined,'CampaignId':_0x26e4da[_0x9927('0xdf')]||undefined})['catch'](loggerCatch(_0x9927('0xe0')));var _0x7e2026=new History(_0x13c3ee);_0x7e2026[_0x9927('0x6f')]=0xa;_0x7e2026[_0x9927('0x70')]=_0x9927('0xe1');_0x7e2026[_0x9927('0x72')]=moment()[_0x9927('0x48')](_0x9927('0xbf'));_0x7e2026[_0x9927('0x71')]=_0x7e2026['starttime'];_0x7e2026[_0x9927('0xe2')]=_0x13c3ee['calleridname'];_0x7e2026[_0x9927('0xe3')]=_0x13c3ee[_0x9927('0xe3')];hopperUtils['createHistory'](_0x7e2026)[_0x9927('0x9b')](loggerCatch(_0x9927('0xe4')));}})[_0x9927('0x40')](function(){if(_0x591204)hopperUtils[_0x9927('0xe5')](_0x13c3ee,_0x279e63,_0x53dbef)[_0x9927('0x40')](function(){return 0x1;});});}else{this['voiceQueues'][_0x2714ac['queue']][_0x9927('0x50')]+=0x1;this['voiceQueues'][_0x2714ac[_0x9927('0xba')]]['outboundDropCallsDayCallersExit']+=0x1;_0x13c3ee[_0x9927('0x6f')]=0xb;_0x13c3ee[_0x9927('0x70')]=_0x9927('0xe6');_0x13c3ee[_0x9927('0xcf')]='CALLEREXIT';_0x13c3ee[_0x9927('0xe7')]+=0x1;_0x13c3ee['countglobal']+=0x1;_0x279e63=this[_0x9927('0x20')][_0x2714ac[_0x9927('0xba')]]['dialAbandonedRetryFrequency'];_0x53dbef=this['voiceQueues'][_0x2714ac[_0x9927('0xba')]][_0x9927('0xd4')];hopperUtils[_0x9927('0xd5')](_0x13c3ee,_0x13c3ee[_0x9927('0x6f')],_0x26e4da[_0x9927('0xd6')])[_0x9927('0x40')](function(_0x53939c){if(_0x13c3ee[_0x9927('0xe7')]>=_0x1149fa['voiceQueues'][_0x2714ac[_0x9927('0xba')]][_0x9927('0xe8')]){_0x1149fa[_0x9927('0xd8')](_0x13c3ee,_0x53939c['additional']);}else{hopperUtils[_0x9927('0xe9')]({'active':![],'countabandonedretry':_0x13c3ee[_0x9927('0xe7')],'scheduledat':moment()['add'](_0x1149fa[_0x9927('0x20')][_0x2714ac['queue']]['dialAbandonedRetryFrequency'],_0x9927('0xdb'))[_0x9927('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x26e4da['ContactId'],'ListId':_0x26e4da['ListId'],'VoiceQueueId':_0x26e4da['VoiceQueueId']||undefined,'CampaignId':_0x26e4da[_0x9927('0xdf')]||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0xea')));var _0x29c743=new History(_0x13c3ee);_0x29c743['state']=0xb;_0x29c743['statedesc']='Abandoned';_0x29c743[_0x9927('0x72')]=moment()['format'](_0x9927('0xbf'));_0x29c743['endtime']=_0x29c743[_0x9927('0x72')];_0x29c743[_0x9927('0xe2')]=_0x13c3ee[_0x9927('0xe2')];_0x29c743[_0x9927('0xe3')]=_0x13c3ee['calleridnum'];hopperUtils[_0x9927('0xc5')](_0x29c743)[_0x9927('0x9b')](loggerCatch(_0x9927('0xeb')));}})[_0x9927('0x40')](function(){if(_0x591204)hopperUtils[_0x9927('0xe5')](_0x13c3ee,_0x279e63,_0x53dbef)[_0x9927('0x40')](function(){return 0x1;});});}}}};Dialer[_0x9927('0x1a')][_0x9927('0x39')]=function(_0xb672f2){if(this[_0x9927('0xec')][_0xb672f2['uniqueid']]){this[_0x9927('0xec')][_0xb672f2[_0x9927('0xbb')]]['channel']=_0xb672f2[_0x9927('0xed')];}if(this[_0x9927('0x27')][_0xb672f2[_0x9927('0xbb')]]){this[_0x9927('0x27')][_0xb672f2[_0x9927('0xbb')]][_0x9927('0xed')]=_0xb672f2[_0x9927('0xed')];}};Dialer[_0x9927('0x1a')][_0x9927('0xee')]=function(_0x225218){if(!this['actions'][_0x225218['actionid']]){return;}var _0xa761ad=this[_0x9927('0x20')][this[_0x9927('0xec')][_0x225218[_0x9927('0xef')]][_0x9927('0xba')]][_0x9927('0xf0')]||_0x9927('0xf1');if(_0xa761ad===_0x9927('0xf2')){if(this[_0x9927('0xec')][_0x225218[_0x9927('0xef')]]&&_[_0x9927('0xf3')](this[_0x9927('0xec')][_0x225218['actionid']]['locked'])&&_0x225218[_0x9927('0x85')]==='1'&&_0x225218[_0x9927('0xf4')]==='0'){if(this[_0x9927('0x22')][_0x225218[_0x9927('0xf5')]]){if(!this['agents'][_0x225218[_0x9927('0xf5')]][_0x9927('0xf6')]){this[_0x9927('0x22')][_0x225218[_0x9927('0xf5')]]['locked']=!![];this[_0x9927('0xec')][_0x225218[_0x9927('0xef')]][_0x9927('0xf6')]=!![];this[_0x9927('0xec')][_0x225218[_0x9927('0xef')]][_0x9927('0xf5')]=_0x225218[_0x9927('0xf5')];}}}}else if(_0xa761ad===_0x9927('0xf1')){if(this[_0x9927('0xec')][_0x225218[_0x9927('0xef')]]){if(this[_0x9927('0x22')][_0x225218[_0x9927('0xf5')]]){this['actions'][_0x225218['actionid']][_0x9927('0xf5')]=_0x225218['stateinterface'];if(_[_0x9927('0xf3')](this[_0x9927('0x2a')][this['actions'][_0x225218[_0x9927('0xef')]][_0x9927('0xba')]])){this['queueBooked'][this[_0x9927('0xec')][_0x225218[_0x9927('0xef')]][_0x9927('0xba')]]=[];}this[_0x9927('0x2a')][this[_0x9927('0xec')][_0x225218[_0x9927('0xef')]]['queue']][_0x9927('0x93')](_['merge'](_[_0x9927('0x76')](this[_0x9927('0xec')][_0x225218['actionid']],[_0x9927('0xf7'),_0x9927('0xf5')]),{'status':_0x225218[_0x9927('0x85')],'paused':_0x225218[_0x9927('0xf4')]}));}}}};Dialer[_0x9927('0x1a')][_0x9927('0x3c')]=function(_0x3a0c87){if(!this['actions'][_0x3a0c87[_0x9927('0xef')]]){return;}var _0x3730ad=this;var _0xe83222=this['voiceQueues'][this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]]['queue']];var _0x23bb81=_0xe83222[_0x9927('0xf0')]||_0x9927('0xf1');if(_0x23bb81===_0x9927('0xf2')){if(this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]]&&this['actions'][_0x3a0c87['actionid']][_0x9927('0xf5')]){this[_0x9927('0x1f')][_0x9927('0xf8')](this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xf7')],this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]]['stateinterface'])[_0x9927('0x9b')](function(_0x2bb8c3){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x9927('0x47')](_0x2bb8c3,{'showHidden':![],'depth':null}));})['finally'](function(){utils[_0x9927('0xbd')](_0x3730ad[_0x9927('0x20')][_0x3730ad[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xba')]],_0x9927('0xf9'));_0x3730ad[_0x9927('0x22')][_0x3730ad['actions'][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xf5')]]['locked']=![];delete _0x3730ad[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]];unlockQueueStatus(_0xe83222);});}else{utils[_0x9927('0xbd')](this[_0x9927('0x20')][this['actions'][_0x3a0c87[_0x9927('0xef')]]['queue']],'[syncQueueStatusComplete]');hopperUtils[_0x9927('0xe9')]({'active':![],'ContactId':this[_0x9927('0xec')][_0x3a0c87['actionid']][_0x9927('0xdc')],'ListId':this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xdd')],'VoiceQueueId':this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]]['CampaignId']||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0xfa')));delete this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]];unlockQueueStatus(_0xe83222);}}else if(_0x23bb81==='rrmemory'){var _0x54f735;if(this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]]&&!_[_0x9927('0x7b')](this[_0x9927('0x2a')][this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xba')]])){if(this[_0x9927('0xfb')][_0x3730ad[_0x9927('0xec')][_0x3a0c87['actionid']]['queue']]){this[_0x9927('0xfb')][_0x3730ad[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xba')]]=this[_0x9927('0xfb')][this['actions'][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xba')]]?this[_0x9927('0xfb')][this['actions'][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xba')]]:this['queueBooked'][this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xba')]]?this[_0x9927('0x2a')][this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xba')]][_0x9927('0xfc')]||0x0:0x0;}this[_0x9927('0x2a')][this[_0x9927('0xec')][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xba')]]['_rr']=this[_0x9927('0xfb')][this['actions'][_0x3a0c87[_0x9927('0xef')]][_0x9927('0xba')]];for(var _0x51199a=0x0;_0x51199a=_0x1bcc60['dialGlobalMaxRetry']){_0x136b35['stateGlobal'](_0x1755bc,_0x182a14,_0x101f52,'reason19\x20machine....');}else{if(_0x1755bc[_0x9927('0x117')]>=_0x1bcc60['dialMachineMaxRetry']){_0x136b35[_0x9927('0x11c')](_0x1755bc,_0x182a14,_0x101f52,_0x9927('0x11d'));}else{hopperUtils[_0x9927('0xe9')]({'active':![],'countmachineretry':_0x1755bc[_0x9927('0x117')],'scheduledat':moment()['add'](_0x1bcc60[_0x9927('0x11e')],_0x9927('0xdb'))[_0x9927('0x48')](_0x9927('0xbf')),'ContactId':_0x1755bc[_0x9927('0xdc')],'ListId':_0x1755bc['ListId'],'VoiceQueueId':_0x1755bc[_0x9927('0xde')]||undefined,'CampaignId':_0x1755bc['CampaignId']||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0x11f')));_0x182a14({'reschedule':0x1});}}});}if(_0x28481b[_0x9927('0x43')]===_0x9927('0xbc')&&this['campaigns'][_0x28481b[_0x9927('0xba')]][_0x9927('0x109')]&&_0x382882['value']==='HANGUP'){delete this[_0x9927('0x27')][_0x382882[_0x9927('0xbb')]];utils[_0x9927('0xbd')](this[_0x9927('0x21')][_0x28481b[_0x9927('0xba')]],_0x9927('0x10c'));_0x388793=new Hangup(_0x28481b,_0x382882);_0x388793[_0x9927('0x6f')]=0x12;_0x388793['statedesc']=_0x9927('0x10d');_0x388793[_0x9927('0x10e')]=_0x9927('0x10f');ami[_0x9927('0x42')](_0x9927('0x120'),ut[_0x9927('0x110')](_0x388793,_0x9927('0x111')));this['saveInDb'](_0x388793,'[syncHangupInAMDIvr][createHistory]',_0x9927('0x121'));}if(_0x28481b[_0x9927('0x43')]===_0x9927('0xbc')&&this['campaigns'][_0x28481b['queue']][_0x9927('0x109')]&&_0x382882[_0x9927('0x10a')]==='MACHINE'){return new Promise(function(_0x5b2eaf,_0x4b689d){delete _0x136b35[_0x9927('0x27')][_0x382882[_0x9927('0xbb')]];utils['decrementOriginate'](_0x136b35['campaigns'][_0x28481b[_0x9927('0xba')]],'[syncVarSet]');_0x136b35[_0x9927('0x21')][_0x28481b[_0x9927('0xba')]][_0x9927('0xc0')]+=0x1;_0x136b35['campaigns'][_0x28481b[_0x9927('0xba')]][_0x9927('0x122')]+=0x1;var _0x4d442c=_0x136b35[_0x9927('0x21')][_0x28481b[_0x9927('0xba')]];var _0x3b3949=new Hangup(_0x28481b,_0x382882);_0x3b3949['state']=0x13;_0x3b3949[_0x9927('0x70')]=_0x9927('0x116');_0x3b3949[_0x9927('0x10e')]=_0x9927('0x10f');_0x3b3949[_0x9927('0x117')]+=0x1;_0x3b3949[_0x9927('0xd3')]+=0x1;_0x3b3949['amd']=!![];ami[_0x9927('0x42')](_0x9927('0x120'),ut[_0x9927('0x110')](_0x3b3949,_0x9927('0x111')));hopperUtils['createHistory'](_0x3b3949)[_0x9927('0x9b')](loggerCatch(_0x9927('0x123')));if(_0x3b3949[_0x9927('0x118')]+_0x3b3949[_0x9927('0x119')]+_0x3b3949['countnoanswerretry']+_0x3b3949[_0x9927('0x124')]+_0x3b3949[_0x9927('0xd2')]+_0x3b3949['countabandonedretry']+_0x3b3949[_0x9927('0x117')]+_0x3b3949[_0x9927('0x11b')]>=_0x4d442c['dialGlobalMaxRetry']){_0x136b35['stateGlobal'](_0x3b3949,_0x5b2eaf,_0x4b689d,_0x9927('0x125'));}else{if(_0x3b3949[_0x9927('0x117')]>=_0x4d442c[_0x9927('0x126')]){_0x136b35['createStateFinal'](_0x3b3949,_0x5b2eaf,_0x4b689d,_0x9927('0x11d'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3b3949[_0x9927('0x117')],'scheduledat':moment()['add'](_0x4d442c['dialMachineRetryFrequency'],_0x9927('0xdb'))[_0x9927('0x48')](_0x9927('0xbf')),'ContactId':_0x3b3949[_0x9927('0xdc')],'ListId':_0x3b3949[_0x9927('0xdd')],'VoiceQueueId':_0x3b3949[_0x9927('0xde')]||undefined,'CampaignId':_0x3b3949[_0x9927('0xdf')]||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0x11f')));_0x5b2eaf({'reschedule':0x1});}}});}}};Dialer[_0x9927('0x1a')][_0x9927('0x38')]=function(_0x14c4fa){var _0x5c9f5c=this[_0x9927('0x27')][_0x14c4fa[_0x9927('0xbb')]];var _0x4f4001;if(!_0x5c9f5c){return;}if(_0x5c9f5c[_0x9927('0x43')]===_0x9927('0xbc')){delete this['uniqueId'][_0x14c4fa[_0x9927('0xbb')]];utils[_0x9927('0xbd')](this['campaigns'][_0x5c9f5c[_0x9927('0xba')]],_0x9927('0x127'));this[_0x9927('0x21')][_0x5c9f5c['queue']][_0x9927('0x128')]+=0x1;if(_0x14c4fa[_0x9927('0x129')]===_0x9927('0x12a')){const _0x20e22c=new AgentComplete(_0x5c9f5c,_0x14c4fa);_0x20e22c[_0x9927('0xdf')]=this[_0x9927('0x21')][_0x5c9f5c[_0x9927('0xba')]]['id'];hopperUtils[_0x9927('0xc5')](_0x20e22c)[_0x9927('0x9b')](loggerCatch(_0x9927('0x12b')));hopperUtils['moveContactManagedDialer'](_0x20e22c)[_0x9927('0x9b')](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x4f4001=new Hangup(_0x5c9f5c,_0x14c4fa);hopperUtils[_0x9927('0xc5')](_0x4f4001)[_0x9927('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x9927('0xc7')](_0x4f4001)['catch'](loggerCatch(_0x9927('0x12c')));}}else{if(isNotNull(this['voiceQueues'][_0x5c9f5c[_0x9927('0xba')]][_0x9927('0x12d')])){delete this['uniqueId'][_0x14c4fa[_0x9927('0xbb')]];utils[_0x9927('0xbd')](this['voiceQueues'][_0x5c9f5c['queue']],'[syncHangup]');this[_0x9927('0x20')][_0x5c9f5c[_0x9927('0xba')]]['outboundAnswerCallsDay']+=0x1;this[_0x9927('0x20')][_0x5c9f5c[_0x9927('0xba')]][_0x9927('0x122')]+=0x1;_0x4f4001=new Hangup(_0x5c9f5c,_0x14c4fa);_0x4f4001[_0x9927('0x6f')]=0x10;_0x4f4001[_0x9927('0x70')]='AnswerAGI';_0x4f4001['membername']='AGI';hopperUtils[_0x9927('0xc5')](_0x4f4001)[_0x9927('0x9b')](loggerCatch(_0x9927('0x12e')));hopperUtils[_0x9927('0xc7')](_0x4f4001)['catch'](loggerCatch('[syncHangupIvr]'));}else{delete this[_0x9927('0x27')][_0x14c4fa[_0x9927('0xbb')]];utils[_0x9927('0xbd')](this[_0x9927('0x20')][_0x5c9f5c[_0x9927('0xba')]],_0x9927('0x12f'));if(_0x14c4fa['cause-txt']===_0x9927('0x12a')){this[_0x9927('0x20')][_0x5c9f5c[_0x9927('0xba')]][_0x9927('0xc0')]+=0x1;const _0x435daf=new AgentComplete(_0x5c9f5c,_0x14c4fa);_0x435daf[_0x9927('0xde')]=this[_0x9927('0x20')][_0x5c9f5c[_0x9927('0xba')]]['id'];hopperUtils[_0x9927('0xc5')](_0x435daf)[_0x9927('0x9b')](loggerCatch(_0x9927('0xc6')));hopperUtils[_0x9927('0xc7')](_0x435daf)[_0x9927('0x9b')](loggerCatch('[syncAgentComplete]'));}else{this['voiceQueues'][_0x5c9f5c['queue']][_0x9927('0x130')]+=0x1;_0x4f4001=new Hangup(_0x5c9f5c,_0x14c4fa);_0x4f4001[_0x9927('0x6f')]=0xc;_0x4f4001['statedesc']=_0x14c4fa['cause-txt'];_0x4f4001[_0x9927('0x10e')]=_0x9927('0x131');hopperUtils[_0x9927('0xc5')](_0x4f4001)['catch'](loggerCatch(_0x9927('0x132')));hopperUtils['moveContactManagedDialer'](_0x4f4001)[_0x9927('0x9b')](loggerCatch(_0x9927('0x127')));}}}};Dialer[_0x9927('0x1a')]['syncQueueSummary']=function(_0x3cc54e){var _0x5162af=this;if(!_0x5162af[_0x9927('0x2b')][_0x3cc54e[_0x9927('0x63')]]){_0x5162af[_0x9927('0x2b')][_0x3cc54e['name']]={'running':![]};}else if(_0x5162af[_0x9927('0x2b')][_0x3cc54e['name']][_0x9927('0x133')]===!![]){return;}else if(_0x5162af['queuesSummary'][_0x3cc54e[_0x9927('0x63')]]['running']===![]){_0x5162af[_0x9927('0x2b')][_0x3cc54e[_0x9927('0x63')]]['running']=!![];}var _0x55ba03=_0x5162af['voiceQueues'][_0x3cc54e[_0x9927('0x63')]];var _0x15b4e3=_0x55ba03[_0x9927('0x6e')]!==utils[_0x9927('0x6a')][_0x9927('0x134')];var _0x4f8eaf=utils['isPreviewCampaign'](_0x55ba03);_0x55ba03[_0x9927('0x135')]=utils[_0x9927('0x136')](_0x55ba03,_0x5162af[_0x9927('0x23')]);Promise['resolve']()[_0x9927('0x40')](function(){if(_0x55ba03[_0x9927('0x135')]===utils[_0x9927('0x6a')][_0x9927('0x134')]){if(_0x15b4e3){clearPredictiveAttributes(_0x55ba03);_0x3cc54e[_0x9927('0x29')]=undefined;_0x3cc54e['startProgressive']=undefined;}if(_0x55ba03[_0x9927('0x135')]===utils[_0x9927('0x6a')][_0x9927('0x134')]){_0x3cc54e[_0x9927('0x137')]=0x0;_0x3cc54e[_0x9927('0xf4')]=0x0;_0x3cc54e['inUse']=0x0;_0x3cc54e[_0x9927('0x138')]=0x0;_0x3cc54e[_0x9927('0x139')]=0x0;}}else if(_0x55ba03['statusMessage']===utils[_0x9927('0x6a')][_0x9927('0x13a')]&&!_0x4f8eaf){return _0x5162af[_0x9927('0x8d')](_0x55ba03,!![])[_0x9927('0x40')](function(){return _0x5162af[_0x9927('0x8d')](_0x55ba03,![]);})[_0x9927('0x40')](function(){return _0x5162af[_0x9927('0xab')](_0x55ba03);})['catch'](function(_0x17179e){loggerSyncQueueSummary[_0x9927('0x45')]('[syncQueueSummary]',util[_0x9927('0x47')](_0x17179e,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x55ba03);});}else{clearPredictiveAttributes(_0x55ba03);}})[_0x9927('0x40')](function(){var _0x38f86f=_0x3cc54e[_0x9927('0x13b')](_0x55ba03);if(_0x38f86f||_0x55ba03[_0x9927('0x13c')]){_0x55ba03[_0x9927('0x13c')]=![];_0x3cc54e[_0x9927('0x13d')](_0x55ba03);Object[_0x9927('0x13e')](_0x55ba03,_0x3cc54e);emitOutboundVoiceQueueSummary(_0x3cc54e);}_0x5162af[_0x9927('0x2b')][_0x55ba03[_0x9927('0x63')]][_0x9927('0x133')]=![];})[_0x9927('0x9b')](function(_0xbdaa0a){logger[_0x9927('0x67')](_0x9927('0x13f'),util[_0x9927('0x47')](_0xbdaa0a,{'showHidden':![],'depth':null}));_0x5162af[_0x9927('0x2b')][_0x55ba03[_0x9927('0x63')]][_0x9927('0x133')]=![];});};Dialer[_0x9927('0x1a')]['syncQueueSummaryComplete']=_[_0x9927('0x140')](function(){var _0x5a087b=_[_0x9927('0x141')](this['voiceQueues'],function(_0x819b3e){return _0x819b3e[_0x9927('0x142')];});var _0x29daec=_[_0x9927('0x141')](this['agents'],function(_0x3e7b6d){return _0x3e7b6d[_0x9927('0x143')]&&_0x3e7b6d[_0x9927('0x85')]==='reachable';});if(_0x5a087b[_0x9927('0x92')]>0x0&&_0x29daec['length']>0x0){return Promise['resolve']()['then'](cmHopper[_0x9927('0x144')](_[_0x9927('0x145')](_0x5a087b,'id'),previewRecallmeReminderInterval,_[_0x9927('0x145')](_0x29daec,'id')))[_0x9927('0x40')](function(_0x1a6c6f){for(var _0x33f55f=0x0;_0x33f55f<_0x1a6c6f['length'];_0x33f55f++){var _0x11cbdb=_0x1a6c6f[_0x33f55f][_0x9927('0x146')][_0x9927('0x63')];if(_0x11cbdb)io['to'](util[_0x9927('0x48')]('user:%s',_0x11cbdb))[_0x9927('0x42')](_0x9927('0x147'),{'hopper':_0x1a6c6f[_0x33f55f]});}})[_0x9927('0x9b')](function(_0x3b03a4){logger[_0x9927('0x67')]('checkPreviewRecallReminder',_0x3b03a4);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x9927('0x1a')][_0x9927('0x3e')]=function(){var _0x1b5d7d=this;setInterval(function(){_0x1b5d7d[_0x9927('0x148')](_0x1b5d7d[_0x9927('0x27')],_0x9927('0x149'));_0x1b5d7d['clearZombieChannels'](_0x1b5d7d[_0x9927('0xec')],'[actions]');},0x32c8);};Dialer[_0x9927('0x1a')]['clearZombieChannels']=function(_0x2b128d,_0x1b2633){var _0x4e488c=this;for(var _0x1121dc in _0x2b128d){if(typeof _0x2b128d[_0x1121dc]!==_0x9927('0xa6')){this[_0x9927('0x1e')][_0x9927('0x1b')](function(){if(!_[_0x9927('0xf3')](_0x2b128d[_0x1121dc])){return ami[_0x9927('0x94')]({'action':_0x9927('0x85'),'channel':_0x2b128d[_0x1121dc]['channel']})[_0x9927('0x9b')](function(_0x12f60f){if(_0x12f60f[_0x9927('0x6e')]===_0x9927('0x14a')){setTimeout(function(){if(_0x2b128d[_0x1121dc]&&_0x2b128d[_0x1121dc][_0x9927('0x43')]!==_0x9927('0xbc')){utils[_0x9927('0xbd')](_0x4e488c[_0x9927('0x20')][_0x2b128d[_0x1121dc][_0x9927('0xba')]],_0x9927('0x14b'));logger[_0x9927('0x67')](_0x9927('0x14c'),_0x1b2633,_0x1121dc,_0x2b128d[_0x1121dc][_0x9927('0xba')]);delete _0x2b128d[_0x1121dc];}if(_0x2b128d[_0x1121dc]&&_0x2b128d[_0x1121dc][_0x9927('0x43')]==='ivr'){utils[_0x9927('0xbd')](_0x4e488c[_0x9927('0x21')][_0x2b128d[_0x1121dc][_0x9927('0xba')]],_0x9927('0x14b'));logger[_0x9927('0x67')](_0x9927('0x14d'),_0x1b2633,_0x1121dc,_0x2b128d[_0x1121dc][_0x9927('0xba')]);delete _0x2b128d[_0x1121dc];}},0x2328);}});}});}}};Dialer[_0x9927('0x1a')][_0x9927('0x14e')]=function(_0x44fbfe){return Promise[_0x9927('0xa8')]()[_0x9927('0x40')](voiceQueueRt[_0x9927('0x14e')](_0x44fbfe))[_0x9927('0x9b')](loggerCatch(_0x9927('0x14f')));};Dialer[_0x9927('0x1a')][_0x9927('0x150')]=function(_0x279dfd,_0x4e6818,_0x483f2d){var _0xa9c842={'state':0x19,'statedesc':'notFound'};utils[_0x9927('0xbd')](_0x4e6818,_0x9927('0x151')+_0x279dfd);this[_0x9927('0x112')](_[_0x9927('0x152')](_0xa9c842,_[_0x9927('0x76')](_0x483f2d,[_0x9927('0xdc'),_0x9927('0xdd'),'UserId',_0x9927('0xde'),_0x9927('0xdf')])),_0x9927('0x153'),_0x9927('0x151'));logger['error'](_0x279dfd);};Dialer[_0x9927('0x1a')]['saveInDb']=function(_0x1a71f0,_0x349c5f,_0x209c9c){hopperUtils[_0x9927('0xc5')](_0x1a71f0)[_0x9927('0x9b')](loggerCatch(_0x349c5f));hopperUtils[_0x9927('0xc7')](_0x1a71f0)[_0x9927('0x9b')](loggerCatch(_0x209c9c));};Dialer[_0x9927('0x1a')]['queueCallerAbandonCreateState']=function(_0x363c1c,_0x86cc9c){hopperUtils['createHistory'](_0x363c1c)[_0x9927('0x9b')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x86cc9c==0x0){hopperUtils[_0x9927('0xc7')](_0x363c1c)[_0x9927('0x9b')](loggerCatch(_0x9927('0x154')));}};Dialer[_0x9927('0x1a')][_0x9927('0x155')]=function(_0x12b5fc){return Promise[_0x9927('0xa8')]()[_0x9927('0x40')](cmHopper[_0x9927('0x144')](_0x12b5fc['id'],previewRecallmeReminderInterval))[_0x9927('0x40')](function(_0xa9c088){for(var _0x1f0f1e=0x0;_0x1f0f1e<_0xa9c088['length'];_0x1f0f1e++){var _0x3ef9c1=_0xa9c088[_0x1f0f1e]['Agent'][_0x9927('0x63')];if(_0x3ef9c1)io['to'](util['format']('user:%s',_0x3ef9c1))[_0x9927('0x42')](_0x9927('0x147'),{'hopper':_0xa9c088[_0x1f0f1e]});}})['catch'](function(){});};Dialer[_0x9927('0x1a')][_0x9927('0x156')]=function(_0xb23213){var _0x555643=this;return function(){_0x555643[_0x9927('0x157')](_0xb23213);};};Dialer[_0x9927('0x1a')]['actionOriginate']=function(_0x382ee6,_0x2037fa){var _0x361125=this;var _0x3c8a30=uuid['v4']();this[_0x9927('0xec')][_0x3c8a30]=new Action(_0x382ee6,_0x2037fa,_0x3c8a30);return new Promise(function(_0x321842,_0xa7dd8c){if(_['isUndefined'](_0x382ee6)&&typeof _0x382ee6!=='object'){return _0xa7dd8c(msgResponse(_0x9927('0x158'),_0x9927('0x8e'),_0x9927('0x159')));}if(_[_0x9927('0x41')](_0x2037fa[_0x9927('0x15a')])||_0x2037fa[_0x9927('0x15a')]===null){return _0xa7dd8c(msgResponse('originate',_0x9927('0x8e'),_0x9927('0x15b')));}var _0x336346={'XMD-CALLERID':_0x361125['actions'][_0x3c8a30][_0x9927('0x15c')](),'XMD-AGI':_0x382ee6[_0x9927('0x12d')]?util[_0x9927('0x48')](_0x9927('0x15d'),ipAgi,_0x382ee6[_0x9927('0x12d')]):'NONE','XMD-AGIAFTER':_0x382ee6[_0x9927('0xc3')]?util[_0x9927('0x48')]('\x22agi://%s/square,%s\x22',ipAgi,_0x382ee6[_0x9927('0xc3')]):'NONE','XMD-QUEUE':utils[_0x9927('0x15e')](_0x382ee6)?util[_0x9927('0x48')](_0x9927('0x15f'),_0x382ee6['name'],_0x382ee6[_0x9927('0x160')]||'',_0x382ee6[_0x9927('0xc4')]?'c':'',_0x382ee6[_0x9927('0xcc')]||0x3):'NONE','XMD-CONTACTID':_0x2037fa['ContactId'],'XMD-CDRTYPE':_0x9927('0x9'),'CALLERID(all)':_0x361125['actions'][_0x3c8a30]['getCaller'](),'XMD-AMD':_0x382ee6[_0x9927('0x109')]?_0x9927('0x13a'):_0x9927('0x161'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x382ee6[_0x9927('0x109')]){_0x336346[_0x9927('0x162')]=_0x382ee6['dialAMDInitialSilence']||0x9c4;_0x336346['XMD-AMDGREETING']=_0x382ee6['dialAMDGreeting']||0x5dc;_0x336346[_0x9927('0x163')]=_0x382ee6[_0x9927('0x164')]||0x320;_0x336346['XMD-AMDTOTALANALYSISTIME']=_0x382ee6[_0x9927('0x165')]||0x1388;_0x336346[_0x9927('0x166')]=_0x382ee6[_0x9927('0x167')]||0x64;_0x336346[_0x9927('0x168')]=_0x382ee6[_0x9927('0x169')]||0x32;_0x336346['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x382ee6[_0x9927('0x16a')]||0x3;_0x336346[_0x9927('0x16b')]=_0x382ee6['dialAMDSilenceThreshold']||0x100;_0x336346[_0x9927('0x16c')]=_0x382ee6[_0x9927('0x16d')]||0x1388;}if(utils[_0x9927('0x15e')](_0x382ee6)){_0x336346[_0x9927('0x16e')]=_0x2037fa[_0x9927('0xde')];}else{_0x336346[_0x9927('0x16f')]=_0x2037fa['CampaignId'];}var _0x1f76ff=utils[_0x9927('0x170')](_0x2037fa[_0x9927('0x171')]);Object['assign'](_0x336346,_0x1f76ff);var _0x123335=_0x361125[_0x9927('0x87')](_0x382ee6[_0x9927('0x172')])?utils[_0x9927('0x173')](_0x382ee6[_0x9927('0x172')][_0x9927('0x174')],_0x382ee6[_0x9927('0x175')],_0x382ee6[_0x9927('0x176')]>0x0?utils[_0x9927('0x177')](_0x382ee6['dialOriginateCallerIdNumber'],_0x382ee6['dialRandomLastDigitCallerIdNumber']):_0x382ee6[_0x9927('0x178')]):utils[_0x9927('0x173')](_[_0x9927('0xf3')](_0x382ee6[_0x9927('0x88')])?_0x382ee6[_0x9927('0x172')]['callerid']:_0x382ee6['TrunkBackup'][_0x9927('0x174')],_0x382ee6[_0x9927('0x175')],_0x382ee6[_0x9927('0x176')]>0x0?utils[_0x9927('0x177')](_0x382ee6[_0x9927('0x178')],_0x382ee6[_0x9927('0x176')]):_0x382ee6[_0x9927('0x178')]);if(_0x123335){_0x336346['XMD-ORIGINATECALLERIDNAME']=_0x361125[_0x9927('0xec')][_0x3c8a30][_0x9927('0x179')]=utils['extractCalleridName'](_0x123335);_0x336346[_0x9927('0x17a')]=_0x2037fa[_0x9927('0x15a')];}_0x382ee6[_0x9927('0x17b')]=_0x336346;return ami[_0x9927('0x94')]({'actionid':_0x3c8a30,'action':_0x9927('0x158'),'channel':_0x361125[_0x9927('0x87')](_0x382ee6['Trunk'])?util[_0x9927('0x48')](_0x9927('0x17c'),_0x382ee6[_0x9927('0x172')]['name'],isNotNull(_0x382ee6[_0x9927('0x17d')])?_0x382ee6[_0x9927('0x17d')][_0x9927('0x17e')]()||'':'',_0x382ee6[_0x9927('0x17f')]>0x0?_0x2037fa[_0x9927('0x15a')][_0x9927('0x180')](_0x382ee6[_0x9927('0x17f')]):_0x2037fa[_0x9927('0x15a')]):util[_0x9927('0x48')](_0x9927('0x17c'),_['isNil'](_0x382ee6[_0x9927('0x88')])?_0x382ee6['Trunk'][_0x9927('0x63')]:_0x382ee6[_0x9927('0x88')][_0x9927('0x63')],isNotNull(_0x382ee6['dialPrefix'])?_0x382ee6[_0x9927('0x17d')]['trim']()||'':'',_0x382ee6['dialCutDigit']>0x0?_0x2037fa[_0x9927('0x15a')][_0x9927('0x180')](_0x382ee6[_0x9927('0x17f')]):_0x2037fa[_0x9927('0x15a')]),'callerid':_0x123335,'Exten':_0x9927('0x181'),'Context':_0x9927('0x182'),'Priority':'1','variable':_0x336346,'timeout':(_0x382ee6[_0x9927('0x183')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3c8a30})[_0x9927('0x40')](function(_0x2cf89e){return _0x321842(_0x2cf89e);})[_0x9927('0x9b')](function(_0x1550cf){_0x382ee6[_0x9927('0x184')]+=0x1;var _0x15c156=new History(_0x361125[_0x9927('0xec')][_0x3c8a30]);logger[_0x9927('0x67')](util[_0x9927('0x48')](_0x9927('0x185'),JSON['stringify'](_0x1550cf)));_0x15c156[_0x9927('0x6f')]=0xe;_0x15c156[_0x9927('0x70')]=_0x9927('0x186');_0x15c156[_0x9927('0x72')]=moment()[_0x9927('0x48')](_0x9927('0xbf'));_0x15c156[_0x9927('0x71')]=_0x15c156[_0x9927('0x72')];hopperUtils['createHistory'](_0x15c156)[_0x9927('0x9b')](loggerCatch('[originate][error]'));_0x361125[_0x9927('0xc7')](_0x15c156)[_0x9927('0x9b')](loggerCatch(_0x9927('0x187')))['finally'](function(){delete _0x361125[_0x9927('0xec')][_0x3c8a30];return _0xa7dd8c(msgResponse(_0x9927('0x158'),_0x9927('0x188'),_0x9927('0x189')));});});});};Dialer[_0x9927('0x1a')]['checkRetriveMax']=function(_0x57ef22,_0x5e34e8,_0x31e652){var _0x2a6ace=new History(_0x5e34e8);if(_0x2a6ace[_0x9927('0x118')]+_0x2a6ace['countcongestionretry']+_0x2a6ace['countnoanswerretry']+_0x2a6ace['countnosuchnumberretry']+_0x2a6ace[_0x9927('0xd2')]+_0x2a6ace[_0x9927('0xe7')]+_0x2a6ace[_0x9927('0x117')]+_0x2a6ace['countagentrejectretry']>=_0x31e652[_0x9927('0x18a')]-0x1){return!![];}switch(_0x57ef22){case 0x3:if(_0x2a6ace[_0x9927('0x11a')]>=_0x31e652[_0x9927('0x18b')]-0x1){return!![];}hopperUtils[_0x9927('0xe9')]({'active':![],'countnoanswerretry':_0x2a6ace[_0x9927('0x11a')]+=0x1,'scheduledat':moment()[_0x9927('0xda')](_0x31e652['dialNoAnswerRetryFrequency'],_0x9927('0xdb'))['format'](_0x9927('0xbf')),'ContactId':_0x2a6ace[_0x9927('0xdc')],'ListId':_0x2a6ace[_0x9927('0xdd')],'VoiceQueueId':_0x2a6ace[_0x9927('0xde')]||undefined,'CampaignId':_0x2a6ace['CampaignId']||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0x18c')));break;case 0x5:if(_0x2a6ace[_0x9927('0x118')]>=_0x31e652[_0x9927('0x18d')]-0x1){return!![];}hopperUtils[_0x9927('0xe9')]({'active':![],'countbusyretry':_0x2a6ace[_0x9927('0x118')]+=0x1,'scheduledat':moment()[_0x9927('0xda')](_0x31e652[_0x9927('0x18e')],_0x9927('0xdb'))[_0x9927('0x48')](_0x9927('0xbf')),'ContactId':_0x2a6ace['ContactId'],'ListId':_0x2a6ace[_0x9927('0xdd')],'VoiceQueueId':_0x2a6ace[_0x9927('0xde')]||undefined,'CampaignId':_0x2a6ace['CampaignId']||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0x18f')));break;case 0x8:if(_0x2a6ace[_0x9927('0x119')]>=_0x31e652[_0x9927('0x190')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x2a6ace[_0x9927('0x119')]+=0x1,'scheduledat':moment()[_0x9927('0xda')](_0x31e652['dialCongestionRetryFrequency'],_0x9927('0xdb'))[_0x9927('0x48')](_0x9927('0xbf')),'ContactId':_0x2a6ace[_0x9927('0xdc')],'ListId':_0x2a6ace['ListId'],'VoiceQueueId':_0x2a6ace[_0x9927('0xde')]||undefined,'CampaignId':_0x2a6ace[_0x9927('0xdf')]||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0x191')));break;case 0x0:if(_0x2a6ace[_0x9927('0x124')]>=_0x31e652['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x9927('0xe9')]({'active':![],'countnosuchnumberretry':_0x2a6ace[_0x9927('0x124')]+=0x1,'scheduledat':moment()[_0x9927('0xda')](_0x31e652[_0x9927('0x192')],_0x9927('0xdb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a6ace[_0x9927('0xdc')],'ListId':_0x2a6ace['ListId'],'VoiceQueueId':_0x2a6ace[_0x9927('0xde')]||undefined,'CampaignId':_0x2a6ace[_0x9927('0xdf')]||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0x193')));}break;case 0xa:if(_0x2a6ace[_0x9927('0xd2')]>=_0x31e652[_0x9927('0xd7')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2a6ace['countdropretry']+=0x1,'scheduledat':moment()[_0x9927('0xda')](_0x31e652[_0x9927('0x194')],_0x9927('0xdb'))[_0x9927('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a6ace['ContactId'],'ListId':_0x2a6ace[_0x9927('0xdd')],'VoiceQueueId':_0x2a6ace[_0x9927('0xde')]||undefined,'CampaignId':_0x2a6ace['CampaignId']||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0xe0')));break;case 0xb:if(_0x2a6ace[_0x9927('0xe7')]>=_0x31e652[_0x9927('0xe8')]-0x1){return!![];}hopperUtils[_0x9927('0xe9')]({'active':![],'countabandonedretry':_0x2a6ace[_0x9927('0xe7')]+=0x1,'scheduledat':moment()[_0x9927('0xda')](_0x31e652[_0x9927('0x195')],_0x9927('0xdb'))[_0x9927('0x48')](_0x9927('0xbf')),'ContactId':_0x2a6ace[_0x9927('0xdc')],'ListId':_0x2a6ace['ListId'],'VoiceQueueId':_0x2a6ace[_0x9927('0xde')]||undefined,'CampaignId':_0x2a6ace[_0x9927('0xdf')]||undefined})['catch'](loggerCatch(_0x9927('0xea')));break;case 0x13:if(_0x2a6ace['countmachineretry']>=_0x31e652['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x9927('0xe9')]({'active':![],'countmachineretry':_0x2a6ace[_0x9927('0x117')]+=0x1,'scheduledat':moment()[_0x9927('0xda')](_0x31e652['dialMachineRetryFrequency'],_0x9927('0xdb'))[_0x9927('0x48')](_0x9927('0xbf')),'ContactId':_0x2a6ace[_0x9927('0xdc')],'ListId':_0x2a6ace[_0x9927('0xdd')],'VoiceQueueId':_0x2a6ace['VoiceQueueId']||undefined,'CampaignId':_0x2a6ace[_0x9927('0xdf')]||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0x11f')));break;case 0x14:if(_0x2a6ace[_0x9927('0x11b')]>=_0x31e652[_0x9927('0x196')]-0x1){return!![];}hopperUtils[_0x9927('0xe9')]({'active':![],'countagentrejectretry':_0x2a6ace[_0x9927('0x11b')]+=0x1,'scheduledat':moment()[_0x9927('0xda')](_0x31e652[_0x9927('0x197')],_0x9927('0xdb'))['format'](_0x9927('0xbf')),'ContactId':_0x2a6ace[_0x9927('0xdc')],'ListId':_0x2a6ace[_0x9927('0xdd')],'VoiceQueueId':_0x2a6ace[_0x9927('0xde')]||undefined,'CampaignId':_0x2a6ace['CampaignId']||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0x198')));break;default:return!![];}};Dialer[_0x9927('0x1a')][_0x9927('0x199')]=function(_0x3f9336,_0x1cac19,_0x2a1bda){var _0x25b2cc=this;var _0x5b55b7=new History(_0x3f9336);var _0xd00e85=![];var _0x2bf3bc;var _0x47faac;return new Promise(function(_0x188d2e,_0x1f015d){if(_[_0x9927('0x41')](_0x1cac19)&&typeof _0x1cac19!==_0x9927('0x19a')){return _0x1f015d(msgResponse(_0x9927('0x19b'),_0x9927('0x8e'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x2a1bda)&&typeof _0x2a1bda!==_0x9927('0x19a')){return _0x1f015d(msgResponse(_0x9927('0x19b'),_0x9927('0x8e'),_0x9927('0x19c')));}hopperUtils['verifyAdditionalPhones'](_0x5b55b7,_0x2a1bda[_0x9927('0xc1')],_0x1cac19)[_0x9927('0x40')](function(_0x243a5d){if(_0x243a5d[_0x9927('0xd9')]==0x1)_0xd00e85=!![];switch(_0x2a1bda['reason']){case'0':_0x1cac19[_0x9927('0x19d')]+=0x1;_0x5b55b7['state']=0x0;_0x5b55b7['statedesc']=_0x9927('0x19e');_0x5b55b7[_0x9927('0x124')]+=0x1;_0x5b55b7[_0x9927('0xd3')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x3f9336,_0x9927('0x19f')));_0x2bf3bc=_0x1cac19[_0x9927('0x192')];_0x47faac=_0x1cac19[_0x9927('0xd4')];hopperUtils[_0x9927('0xc5')](_0x5b55b7)[_0x9927('0x9b')](loggerCatch(_0x9927('0x123')));if(_0x25b2cc[_0x9927('0x1a0')](0x0,_0x3f9336,_0x1cac19)&&!_0xd00e85){if(_0x5b55b7[_0x9927('0x124')]>=_0x1cac19[_0x9927('0x1a1')]){_0x25b2cc[_0x9927('0x11c')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x9927('0x1a2'));}else{_0x25b2cc[_0x9927('0x1a3')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x9927('0x1a2'));}}break;case'3':_0x1cac19[_0x9927('0x1a4')]+=0x1;_0x5b55b7['state']=0x3;_0x5b55b7[_0x9927('0x70')]='NoAnswer';_0x5b55b7[_0x9927('0x11a')]+=0x1;_0x5b55b7[_0x9927('0xd3')]+=0x1;var _0x18bc0c=ut[_0x9927('0x1a5')](_0x3f9336,_0x1cac19);ami[_0x9927('0x42')](_0x9927('0x1a6'),_0x18bc0c);_0x2bf3bc=_0x1cac19[_0x9927('0x1a7')];_0x47faac=_0x1cac19[_0x9927('0xd4')];hopperUtils[_0x9927('0xc5')](_0x5b55b7)['catch'](loggerCatch(_0x9927('0x1a8')));if(_0x25b2cc['checkRetriveMax'](0x3,_0x3f9336,_0x1cac19)&&!_0xd00e85){if(_0x5b55b7[_0x9927('0x11a')]>=_0x1cac19['dialNoAnswerMaxRetry']){_0x25b2cc[_0x9927('0x11c')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x9927('0x1a9'));}else{_0x25b2cc[_0x9927('0x1a3')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x9927('0x1a9'));}}break;case'5':_0x1cac19[_0x9927('0x1aa')]+=0x1;_0x5b55b7['state']=0x5;_0x5b55b7['statedesc']=_0x9927('0x1ab');_0x5b55b7[_0x9927('0x118')]+=0x1;_0x5b55b7[_0x9927('0xd3')]+=0x1;ami[_0x9927('0x42')](_0x9927('0x1ac'),ut['buildObj'](_0x3f9336,_0x9927('0x1ad')));_0x2bf3bc=_0x1cac19[_0x9927('0x18e')];_0x47faac=_0x1cac19[_0x9927('0xd4')];hopperUtils[_0x9927('0xc5')](_0x5b55b7)[_0x9927('0x9b')](loggerCatch(_0x9927('0x1ae')));if(_0x25b2cc[_0x9927('0x1a0')](0x5,_0x3f9336,_0x1cac19)&&!_0xd00e85){if(_0x5b55b7[_0x9927('0x118')]>=_0x1cac19['dialBusyMaxRetry']){_0x25b2cc[_0x9927('0x11c')](_0x5b55b7,_0x188d2e,_0x1f015d,'reason\x205\x20busy');}else{_0x25b2cc['stateGlobal'](_0x5b55b7,_0x188d2e,_0x1f015d,'reason\x205\x20busy');}}break;case'8':_0x1cac19['outboundCongestionCallsDay']+=0x1;_0x5b55b7[_0x9927('0x6f')]=0x8;_0x5b55b7[_0x9927('0x70')]=_0x9927('0x1af');_0x5b55b7[_0x9927('0x119')]+=0x1;_0x5b55b7[_0x9927('0xd3')]+=0x1;_0x2bf3bc=_0x1cac19['dialCongestionRetryFrequency'];_0x47faac=_0x1cac19[_0x9927('0xd4')];ami['emit'](_0x9927('0x1b0'),ut['buildObj'](_0x3f9336,'congestion'));hopperUtils[_0x9927('0xc5')](_0x5b55b7)['catch'](loggerCatch(_0x9927('0x1b1')));if(_0x25b2cc['checkRetriveMax'](0x8,_0x3f9336,_0x1cac19)&&!_0xd00e85){if(_0x5b55b7[_0x9927('0x119')]>=_0x1cac19[_0x9927('0x190')]){_0x25b2cc[_0x9927('0x11c')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x9927('0x1b2'));}else{_0x25b2cc[_0x9927('0x1a3')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x9927('0x1b2'));}}break;case'11':_0x1cac19['outboundAbandonedCallsDay']+=0x1;_0x5b55b7['state']=0xb;_0x5b55b7[_0x9927('0x70')]=_0x9927('0xe6');_0x5b55b7[_0x9927('0xe7')]+=0x1;_0x5b55b7['countglobal']+=0x1;_0x2bf3bc=_0x1cac19[_0x9927('0x195')];_0x47faac=_0x1cac19[_0x9927('0xd4')];hopperUtils[_0x9927('0xc5')](_0x5b55b7)[_0x9927('0x9b')](loggerCatch(_0x9927('0xeb')));if(_0x25b2cc[_0x9927('0x1a0')](0xb,_0x3f9336,_0x1cac19)&&!_0xd00e85){if(_0x5b55b7[_0x9927('0xe7')]>=_0x1cac19['dialAbandonedMaxRetry']){_0x25b2cc[_0x9927('0x11c')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x9927('0x1b3'));}else{_0x25b2cc[_0x9927('0x1a3')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x9927('0x1b3'));}}break;case'20':_0x1cac19['outboundRejectCallsDay']+=0x1;_0x5b55b7[_0x9927('0x6f')]=0x14;_0x5b55b7[_0x9927('0x70')]=_0x9927('0x1b4');_0x5b55b7[_0x9927('0x11b')]+=0x1;_0x5b55b7['countglobal']+=0x1;_0x2bf3bc=_0x1cac19['dialAgentRejectRetryFrequency'];_0x47faac=_0x1cac19[_0x9927('0xd4')];ami[_0x9927('0x42')](_0x9927('0x1b5'),ut['buildObj'](_0x3f9336,_0x9927('0x1b6')));hopperUtils[_0x9927('0xc5')](_0x5b55b7)[_0x9927('0x9b')](loggerCatch(_0x9927('0x1b7')));if(_0x25b2cc[_0x9927('0x1a0')](0x14,_0x3f9336,_0x1cac19)&&!_0xd00e85){if(_0x5b55b7[_0x9927('0x11b')]>=_0x1cac19[_0x9927('0x196')]){_0x25b2cc['createStateFinal'](_0x5b55b7,_0x188d2e,_0x1f015d,'reason\x2020\x20agentreject');}else{_0x25b2cc[_0x9927('0x1a3')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x9927('0x1b8'));}}break;default:_0x1cac19[_0x9927('0x130')]+=0x1;_0x5b55b7[_0x9927('0x6f')]=0xc;_0x5b55b7[_0x9927('0x70')]=_0x2a1bda[_0x9927('0xc1')];_0x2bf3bc=_0x1cac19['dialAgentRejectRetryFrequency'];_0x47faac=_0x1cac19[_0x9927('0xd4')];hopperUtils['createHistory'](_0x5b55b7)[_0x9927('0x9b')](loggerCatch(_0x9927('0x1b9')));if(_0x25b2cc[_0x9927('0x1a0')](_0x2a1bda[_0x9927('0xc1')],_0x3f9336,_0x1cac19)&&!_0xd00e85){if(_0x5b55b7['countbusyretry']+_0x5b55b7[_0x9927('0x119')]+_0x5b55b7[_0x9927('0x11a')]+_0x5b55b7[_0x9927('0x124')]+_0x5b55b7[_0x9927('0xd2')]+_0x5b55b7[_0x9927('0xe7')]+_0x5b55b7['countmachineretry']+_0x5b55b7[_0x9927('0x11b')]>=_0x1cac19[_0x9927('0x18a')]){_0x25b2cc[_0x9927('0x1a3')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x2a1bda[_0x9927('0xc1')]);}else{_0x25b2cc[_0x9927('0x11c')](_0x5b55b7,_0x188d2e,_0x1f015d,_0x2a1bda[_0x9927('0xc1')]);}}}})[_0x9927('0x40')](function(){if(_0xd00e85){hopperUtils[_0x9927('0xe5')](_0x5b55b7,_0x2bf3bc,_0x47faac)[_0x9927('0x40')](function(){return _0x188d2e(0x1);});}});});};Dialer[_0x9927('0x1a')][_0x9927('0x1a3')]=function(_0x58446e,_0x5ed1ba,_0x3f3c5c,_0x2e2ae5){var _0x4c4854=new Final(_0x58446e);_0x4c4854[_0x9927('0x6f')]=0xf;_0x4c4854['statedesc']=_0x9927('0x1ba');this[_0x9927('0x11c')](_0x4c4854,_0x5ed1ba,_0x3f3c5c,_0x2e2ae5);};Dialer[_0x9927('0x1a')]['createStateFinal']=function(_0x209525,_0x305fb9,_0x2c6c2b,_0x49f668){hopperUtils[_0x9927('0xc7')](_0x209525)[_0x9927('0x40')](function(){return _0x305fb9(msgResponse(_0x9927('0x19b'),'Success',_0x49f668));})[_0x9927('0x9b')](function(){return _0x2c6c2b(msgResponse('[moveContactManagedDialer][0]','Failure',_0x9927('0x1bb')));});};Dialer[_0x9927('0x1a')][_0x9927('0xb')]=function(_0x107890){var _0x111219=_0x107890[_0x9927('0x1bc')]/0x64;var _0x53a004=_0x107890[_0x9927('0xcd')]/(_0x107890['outboundDropCallsDayTimeout']+_0x107890[_0x9927('0xc0')]);var _0x358c3c=Math[_0x9927('0x1bd')](_0x107890[_0x9927('0x1be')]*(_0x107890['predictiveIntervalMaxThreshold']/0x64));var _0x1e897d=Math['round'](_0x107890[_0x9927('0x1be')]*(_0x107890[_0x9927('0x1bf')]/0x64));var _0x2486d3=_0x107890[_0x9927('0x137')]+_0x107890[_0x9927('0x138')];var _0x317685=Math[_0x9927('0x1c0')](_0x107890[_0x9927('0x1c1')]*_0x107890[_0x9927('0x5e')]*_0x107890[_0x9927('0x1c2')]*_0x107890[_0x9927('0x1c3')]);if(_['isUndefined'](_0x107890['startProgressive'])){if(!_[_0x9927('0x41')](_0x107890[_0x9927('0x29')])){_0x107890[_0x9927('0x29')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x9927('0x1c4'));}if(!_[_0x9927('0x41')](_0x107890[_0x9927('0x66')])){loggerPredictive['error'](_0x9927('0x1c5'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x107890[_0x9927('0x66')]);_0x107890[_0x9927('0x66')]=undefined;}_0x107890['startProgressive']=moment()[_0x9927('0x48')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x107890[_0x9927('0x63')],_0x9927('0x1c6'),_0x107890['startProgressive']);this[_0x9927('0xad')](_0x107890,0x1);}else if(ifInterval(_0x107890['dialPredictiveInterval'],_0x107890[_0x9927('0x62')])){this['handlePower'](_0x107890,0x1);loggerPredictiveCalls['info'](_0x9927('0x1c7'),_0x107890[_0x9927('0x62')],_0x107890[_0x9927('0x63')]);_0x107890[_0x9927('0x1c1')]=0x0;_0x107890[_0x9927('0xce')]=0x0;}else if(_0x111219<_0x53a004&&_0x107890[_0x9927('0x1c8')]==='dropRate'){clearPredictiveAttributes(_0x107890);loggerPredictive[_0x9927('0x4b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x9927('0x1c9'),_0x53a004,_0x9927('0x62'),_0x107890[_0x9927('0x63')]);}else if(_0x317685<_0x107890[_0x9927('0xce')]&&_0x107890[_0x9927('0x1c8')]===_0x9927('0x1ca')){clearPredictiveAttributes(_0x107890);loggerPredictive[_0x9927('0x4b')](_0x9927('0x1cb'),'Max\x20Drop\x20',_0x317685,'Drop\x20in\x20this\x20interval',_0x107890[_0x9927('0xce')],_0x9927('0x62'),_0x107890[_0x9927('0x63')]);}else if(!ifInterval(_0x107890['dialPredictiveInterval'],_0x107890[_0x9927('0x62')])&&_[_0x9927('0x41')](_0x107890[_0x9927('0x29')])&&!_[_0x9927('0x41')](_0x107890[_0x9927('0x62')])){_0x107890[_0x9927('0x29')]=moment()[_0x9927('0x48')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x9927('0x4b')](_0x107890['name'],'started\x20in\x20predictive\x20at',_0x107890[_0x9927('0x29')]);hopperUtils[_0x9927('0x1cc')](_0x107890[_0x9927('0x1cd')])[_0x9927('0x40')](this[_0x9927('0x1ce')](_0x107890))[_0x9927('0x40')](mergeDataErlangB(_0x107890))[_0x9927('0x40')](this[_0x9927('0x1cf')](_0x107890))[_0x9927('0x9b')](loggerCatchPredictive(_0x9927('0x1d0'),_0x107890));}else if(!ifInterval(_0x107890['dialPredictiveInterval'],_0x107890['startPredictive'])){_0x107890[_0x9927('0xce')]=0x0;_0x107890[_0x9927('0x29')]=moment()[_0x9927('0x48')](_0x9927('0xbf'));loggerPredictive[_0x9927('0x4b')](_0x107890[_0x9927('0x63')],_0x9927('0x1d1'),_0x107890[_0x9927('0x29')]);clearInterval(_0x107890[_0x9927('0x66')]);_0x107890['handlePredictive']=undefined;hopperUtils[_0x9927('0x1cc')](_0x107890[_0x9927('0x1cd')])['then'](this[_0x9927('0x1ce')](_0x107890))[_0x9927('0x40')](mergeDataErlangB(_0x107890))[_0x9927('0x40')](this[_0x9927('0x1cf')](_0x107890))[_0x9927('0x9b')](loggerCatchPredictive(_0x9927('0x1d2'),_0x107890));}else if(_0x107890[_0x9927('0x1be')]&&_0x2486d3<_0x107890[_0x9927('0x1be')]-_0x1e897d){clearPredictiveAttributes(_0x107890);loggerPredictive[_0x9927('0x4b')](_0x107890[_0x9927('0x63')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2486d3,_0x9927('0x1d3'),_0x107890['predictiveIntervalAvailable'],'-',_0x1e897d,'=',_0x107890[_0x9927('0x1be')]-_0x1e897d,')');}else if(_0x107890['predictiveIntervalAvailable']&&_0x2486d3>_0x107890[_0x9927('0x1be')]+_0x358c3c){clearPredictiveAttributes(_0x107890);loggerPredictive[_0x9927('0x4b')](_0x107890['name'],_0x9927('0x1d4'),_0x2486d3,_0x9927('0x1d5'),_0x107890[_0x9927('0x1be')],'+',_0x358c3c,'=',_0x107890[_0x9927('0x1be')]+_0x358c3c,')');}};Dialer['prototype'][_0x9927('0x1ce')]=function(_0x24e989){var _0x4acf66=this;return function(_0x1b75fc){return new Promise(function(_0x1af791,_0x5ca290){_[_0x9927('0x152')](_0x24e989,_0x1b75fc[0x0]);if(checkGetDataPredictive(_0x1b75fc[0x0])){var _0x1ce89f=_0x24e989[_0x9927('0x1be')]=_0x24e989[_0x9927('0x138')]+_0x24e989[_0x9927('0x137')];var _0x1838aa=_0x24e989[_0x9927('0x1cd')]*0x3c;var _0x1ce6d9=_0x1b75fc[0x0]['predictiveIntervalAvgTalktime']+_0x1b75fc[0x0][_0x9927('0x52')];var _0x2272f1=(_0x1b75fc[0x0][_0x9927('0x1d6')]+_0x1b75fc[0x0][_0x9927('0x4e')]+_0x1b75fc[0x0][_0x9927('0x50')])/_0x1b75fc[0x0][_0x9927('0x54')];_0x24e989['predictiveIntervalHitRate']=_0x2272f1>0x0?_0x2272f1:0x1;switch(_0x24e989[_0x9927('0x1c8')]){case _0x9927('0x1ca'):var _0xae3115=_0x24e989[_0x9927('0x1bc')]/0x64;return _0x4acf66[_0x9927('0x1d7')](_0x1ce89f,_0x1838aa,_0x1ce6d9,_0x2272f1,_0xae3115)[_0x9927('0x40')](function(_0x191ed8){return _0x1af791(_0x191ed8);});case _0x9927('0x1d8'):var _0x11cccf=_0x24e989[_0x9927('0x1bc')]/0x64;return _0x4acf66['busyFactor'](_0x1ce89f,_0x1838aa,_0x1ce6d9,_0x2272f1,_0x11cccf)[_0x9927('0x40')](function(_0x3492a5){return _0x1af791(_0x3492a5);});default:return _0x5ca290(msgResponse('[getDataPredictive]',_0x9927('0x8e'),_0x9927('0x1d9')));}}else{return _0x5ca290(msgResponse(_0x9927('0x1da'),_0x9927('0x8e'),'check\x20failure'));}});};};Dialer[_0x9927('0x1a')]['getDataPredictiveOld']=function(_0x4bb573){var _0x37322b=this;return function(_0x6041f3){return new Promise(function(_0x51fe11,_0x8c9ac){_['merge'](_0x4bb573,_0x6041f3[0x0]);if(checkGetDataPredictive(_0x6041f3[0x0])){loggerPredictive[_0x9927('0x4b')](JSON['stringify'](_0x6041f3[0x0]));if(_0x4bb573[_0x9927('0x1c8')]===_0x9927('0x1ca')){return _0x37322b[_0x9927('0x14e')](_0x4bb573['id'])[_0x9927('0x40')](function(_0x51db34){var _0x5a4cfc=_0x4bb573[_0x9927('0x1db')]-_0x51db34[0x0][_0x9927('0x1dc')];var _0x4602fb=_0x4bb573[_0x9927('0x1cd')]*0x3c;var _0x4ad51b=_0x6041f3[0x0][_0x9927('0x55')]+_0x6041f3[0x0][_0x9927('0x52')];var _0x1e457b=(_0x6041f3[0x0][_0x9927('0x1d6')]+_0x6041f3[0x0][_0x9927('0x4e')]+_0x6041f3[0x0][_0x9927('0x50')])/_0x6041f3[0x0][_0x9927('0x54')];var _0x5a70db=_0x4bb573[_0x9927('0x1bc')]/0x64;_0x4bb573['predictiveIntervalPauses']=_0x51db34[0x0]['outboundQueuePauses']||0x0;_0x4bb573[_0x9927('0x1c2')]=_0x1e457b>0x0?_0x1e457b:0x1;return _0x37322b[_0x9927('0x1d7')](_0x5a4cfc,_0x4602fb,_0x4ad51b,_0x1e457b,_0x5a70db);})[_0x9927('0x40')](function(_0x222787){return _0x51fe11(_0x222787);})[_0x9927('0x9b')](function(_0x548906){return _0x8c9ac(msgResponse('[CatchErlangB]',_0x9927('0x8e'),JSON[_0x9927('0x81')](_0x548906)));});}if(_0x4bb573['dialPredictiveOptimization']===_0x9927('0x1d8')){return _0x37322b[_0x9927('0x14e')](_0x4bb573['id'])['then'](function(_0x413c72){var _0x327d40=_0x4bb573[_0x9927('0x1db')]-_0x413c72[0x0]['outboundQueuePauses'];var _0x518f65=_0x4bb573[_0x9927('0x1cd')]*0x3c;var _0x1e61e7=_0x6041f3[0x0][_0x9927('0x55')]+_0x6041f3[0x0][_0x9927('0x52')];var _0x52c2ae=(_0x6041f3[0x0][_0x9927('0x1d6')]+_0x6041f3[0x0][_0x9927('0x4e')]+_0x6041f3[0x0][_0x9927('0x50')])/_0x6041f3[0x0][_0x9927('0x54')];var _0x5c6107=_0x4bb573['dialPredictiveOptimizationPercentage']/0x64;_0x4bb573['predictiveIntervalPauses']=_0x413c72[0x0][_0x9927('0x1dc')]||0x0;_0x4bb573['predictiveIntervalHitRate']=_0x52c2ae>0x0?_0x52c2ae:0x1;return _0x37322b['busyFactor'](_0x327d40,_0x518f65,_0x1e61e7,_0x52c2ae,_0x5c6107);})['then'](function(_0x25fa3c){return _0x51fe11(_0x25fa3c);})[_0x9927('0x9b')](function(_0x5a8873){return _0x8c9ac(msgResponse(_0x9927('0x1dd'),_0x9927('0x8e'),JSON[_0x9927('0x81')](_0x5a8873)));});}}else{return _0x8c9ac(msgResponse(_0x9927('0x1da'),'Failure','check\x20failure'));}});};};Dialer['prototype'][_0x9927('0x1cf')]=function(_0x114a99){var _0x1f837a=this;return function(){var _0x34a16=0x0;var _0x3ff731=Math['floor'](_0x114a99[_0x9927('0x1de')]*0x3e8);if(_0x3ff731>0x0){_0x3ff731=_0x3ff731<0x64?0x64:_0x3ff731;loggerPredictive['info'](_0x114a99[_0x9927('0x63')],_0x9927('0x1df'),_0x3ff731,_0x9927('0x1e0'));_0x114a99[_0x9927('0x66')]=setInterval(function(){_0x1f837a[_0x9927('0x66')](_0x114a99);loggerPredictiveCalls[_0x9927('0x4b')]('[handlePredictive]',_0x34a16+=0x1);},_0x3ff731);}else{loggerPredictive[_0x9927('0x4b')](_0x114a99[_0x9927('0x63')],_0x9927('0x1e1'));}};};Dialer[_0x9927('0x1a')]['checkContactBlack']=function(_0xedc773,_0x4e862c){var _0x532678=this;return function(_0x38cb77){if(_['isEmpty'](_0x38cb77)){if(_[_0x9927('0xf3')](_0x4e862c[_0x9927('0x1e2')])||!_0x4e862c[_0x9927('0x1e3')]){if(_0xedc773[_0x9927('0xac')]==='booked'){_0xedc773[_0x9927('0x74')]=_[_0x9927('0x41')](_0xedc773[_0x9927('0x74')])?!![]:_0xedc773['queueStatusComplete'];var _0x3946d3=uuid['v4']();_0x532678['actions'][_0x3946d3]=new Action(_0xedc773,_0x4e862c,_0x3946d3);loggerBooked[_0x9927('0x4b')](_0x9927('0x1e4'),_0x3946d3,_0x9927('0x1e5'),JSON[_0x9927('0x81')](_0xedc773['queueStatusComplete']),_0x9927('0x1e6'),_0xedc773[_0x9927('0x63')]);if(_0xedc773[_0x9927('0x74')]){_0xedc773[_0x9927('0x74')]=![];_0x532678[_0x9927('0x2a')][_0x532678[_0x9927('0xec')][_0x3946d3]['queue']]=[];ami[_0x9927('0x94')]({'actionid':_0x3946d3,'action':'queuestatus','queue':_0xedc773[_0x9927('0x63')]})[_0x9927('0x9b')](function(){utils['decrementOriginate'](_0xedc773,_0x9927('0x1e7'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x532678[_0x9927('0xec')][_0x3946d3][_0x9927('0xdc')],'ListId':_0x532678[_0x9927('0xec')][_0x3946d3]['ListId'],'VoiceQueueId':_0x532678['actions'][_0x3946d3][_0x9927('0xde')]||undefined,'CampaignId':_0x532678[_0x9927('0xec')][_0x3946d3][_0x9927('0xdf')]||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0x1e8')));delete _0x532678[_0x9927('0xec')][_0x3946d3];});}else{loggerBooked[_0x9927('0x4b')]('[booked][checkContactBlack][else]',JSON[_0x9927('0x81')](_0xedc773['queueStatusComplete']),_0x9927('0x1e6'),_0xedc773[_0x9927('0x63')]);utils['decrementOriginate'](_0xedc773,'[checkContactBlack]');hopperUtils[_0x9927('0xe9')]({'active':![],'ContactId':_0x532678[_0x9927('0xec')][_0x3946d3][_0x9927('0xdc')],'ListId':_0x532678[_0x9927('0xec')][_0x3946d3]['ListId'],'VoiceQueueId':_0x532678[_0x9927('0xec')][_0x3946d3][_0x9927('0xde')]||undefined,'CampaignId':_0x532678[_0x9927('0xec')][_0x3946d3]['CampaignId']||undefined})[_0x9927('0x9b')](loggerCatch(_0x9927('0x1e8')));delete _0x532678[_0x9927('0xec')][_0x3946d3];}}else{return _0x532678[_0x9927('0x1e9')](_0xedc773,_0x4e862c);}}else{if(utils[_0x9927('0x61')](undefined,_0x4e862c[_0x9927('0x1ea')])<_0xedc773[_0x9927('0x1eb')]*0x3c){if(_0x4e862c['Agent']&&!_0x4e862c[_0x9927('0x146')]['voicePause']){_0x532678[_0x9927('0x1f')][_0x9927('0xf8')](_0x4e862c['id'])[_0x9927('0x1d')](function(){utils['decrementOriginate'](_0xedc773,_0x9927('0x1e7'));});}else{hopperUtils[_0x9927('0x1ec')]({'active':![]},_0x4e862c['id'],0x1)[_0x9927('0x1d')](function(){utils[_0x9927('0xbd')](_0xedc773,'[checkContactBlack]');});}}else{_0xedc773['outboundReCallsDay']+=0x1;utils[_0x9927('0xbd')](_0xedc773,'[checkContactBlack]');if(_0xedc773['dialRecallInQueue']){hopperUtils[_0x9927('0xe9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e862c[_0x9927('0xdc')],'ListId':_0x4e862c[_0x9927('0xdd')],'VoiceQueueId':_0x4e862c[_0x9927('0xde')]||undefined,'CampaignId':_0x4e862c[_0x9927('0xdf')]||undefined})['catch'](loggerCatch(_0x9927('0x1ed')));hopperUtils['createHistory'](createObjHistory(_0xedc773,_0x4e862c,utils['CAMPAIGN_STATUS'][_0x9927('0x1ee')],0x17,_0x9927('0x1ef')))['catch'](loggerCatch(_0x9927('0x1f0')));}else{_0x532678['saveInDb'](createObjHistory(_0xedc773,_0x4e862c,utils[_0x9927('0x6a')][_0x9927('0x1f1')],0x16,'RecallFailedTimeout'),_0x9927('0x1f2'),_0x9927('0x1f3'));}}}}else{_0xedc773[_0x9927('0x1f4')]+=0x1;_0x532678[_0x9927('0x112')](createObjHistory(_0xedc773,_0x4e862c,utils[_0x9927('0x6a')][_0x9927('0x1f5')],0xd,'Blacklist'),_0x9927('0x1f6'),_0x9927('0x1f7'));throw _0x9927('0x1f8');}};};Dialer[_0x9927('0x1a')][_0x9927('0x157')]=function(_0x39bb71){var _0x5801d8=this;var _0x8ee7f6=_0x39bb71['limitCalls']-_0x39bb71[_0x9927('0x1f9')];emitCampaignSummary(_0x39bb71);if(_0x8ee7f6>0x0&&_0x39bb71['temp']==0x0){if(_0x8ee7f6>this[_0x9927('0x24')]){_0x8ee7f6=this[_0x9927('0x24')];}_0x39bb71[_0x9927('0x1fa')]=0x1;hopperUtils['getContactDialerIvr'](_0x39bb71,_0x8ee7f6)['then'](function(_0x1c4e18){_0x39bb71['temp']=0x0;if(_0x1c4e18){if(!utils[_0x9927('0x1fb')](_0x1c4e18)){_0x39bb71['message']=utils[_0x9927('0x6a')][_0x9927('0x1fc')];logger[_0x9927('0x4b')](_0x9927('0x1fd')+_0x39bb71['name']);}else{_0x39bb71[_0x9927('0x1f9')]+=_0x1c4e18[_0x9927('0x92')];_0x39bb71['message']=utils[_0x9927('0x6a')]['RUNNING'];for(var _0x27c366=0x0;_0x27c366<_0x1c4e18[_0x9927('0x92')];_0x27c366+=0x1){_0x39bb71['ivrTotalCallsDays']+=0x1;if(_[_0x9927('0xf3')](_0x1c4e18[_0x27c366])||_[_0x9927('0xf3')](_0x1c4e18[_0x27c366][_0x9927('0x171')])||_[_0x9927('0xf3')](_0x1c4e18[_0x27c366][_0x9927('0x15a')])){_0x5801d8[_0x9927('0x150')](_0x9927('0x1fe'),_0x39bb71,_0x1c4e18[_0x27c366]);}else{hopperUtils[_0x9927('0x1ff')](_[_0x9927('0x76')](_0x1c4e18[_0x27c366],[_0x9927('0xdf'),_0x9927('0x15a')]))[_0x9927('0x40')](_0x5801d8[_0x9927('0x200')](_0x39bb71,_0x1c4e18[_0x27c366]))['catch'](function(_0x2c0984){logger[_0x9927('0x67')](_0x9927('0x201'),_0x2c0984);utils['decrementOriginate'](_0x39bb71,_0x9927('0x202'));});}}}}})[_0x9927('0x9b')](function(_0x4f4a73){_0x39bb71[_0x9927('0x1fa')]=0x0;logger[_0x9927('0x67')](_0x9927('0x203'),_0x4f4a73);});}};Dialer[_0x9927('0x1a')][_0x9927('0xad')]=function(_0x1f421f,_0x7f5541){var _0x5b293d=this;var _0x352077=[];if(_0x7f5541<0x1||_0x1f421f[_0x9927('0xac')]===_0x9927('0xa')){_0x7f5541=0x1;}var _0xe1e87c=Math[_0x9927('0x1c0')](_0x1f421f[_0x9927('0x137')]*_0x7f5541)-_0x1f421f[_0x9927('0x1f9')];if(_0x1f421f['dialLimitQueue']>0x0){var _0x44eea=_0x1f421f[_0x9927('0x204')]-_0x1f421f['originated']-_0x1f421f[_0x9927('0x138')]-_0x1f421f[_0x9927('0x139')];if(_0xe1e87c>_0x44eea){_0xe1e87c=_0x44eea;}}if(_0xe1e87c>0x0&&_0x1f421f[_0x9927('0x1fa')]==0x0){if(_0x1f421f[_0x9927('0xac')]==='booked'){_0xe1e87c=0x1;}if(_0xe1e87c>this[_0x9927('0x24')]){_0xe1e87c=this[_0x9927('0x24')];}for(var _0x3b4a70 in this[_0x9927('0x22')]){if(typeof this[_0x9927('0x22')][_0x3b4a70]!==_0x9927('0xa6')){if(this['agents'][_0x3b4a70]['state']===_0x9927('0x205')&&this[_0x9927('0x22')][_0x3b4a70]['status']==='reachable'){_0x352077[_0x9927('0x93')](this[_0x9927('0x22')][_0x3b4a70]['id']);}}}_0x1f421f['temp']=0x1;hopperUtils[_0x9927('0x206')](_0x1f421f,_0x352077,_0xe1e87c)[_0x9927('0x40')](function(_0x353b45){_0x1f421f[_0x9927('0x1fa')]=0x0;if(_0x353b45){if(!utils[_0x9927('0x1fb')](_0x353b45)){hopperUtils[_0x9927('0x207')](_0x1f421f)['then'](sendMessageReschedule(_0x1f421f))[_0x9927('0x9b')](loggerCatch(_0x9927('0x208')));}else{_0x1f421f['originated']+=_0x353b45[_0x9927('0x92')];_0x1f421f[_0x9927('0x6e')]=_0x1f421f[_0x9927('0xac')]===_0x9927('0xa')?utils[_0x9927('0x6a')][_0x9927('0x13a')]:utils['CAMPAIGN_STATUS'][_0x9927('0x209')];for(var _0x5bb519=0x0;_0x5bb519<_0x353b45[_0x9927('0x92')];_0x5bb519+=0x1){if(_['isNil'](_0x353b45[_0x5bb519])||_[_0x9927('0xf3')](_0x353b45[_0x5bb519][_0x9927('0x171')])||_[_0x9927('0xf3')](_0x353b45[_0x5bb519]['phone'])){_0x5b293d['emptyContact'](_0x9927('0x1fe'),_0x1f421f,_0x353b45[_0x5bb519]);}else{hopperUtils[_0x9927('0x20a')](_[_0x9927('0x76')](_0x353b45[_0x5bb519],[_0x9927('0xde'),_0x9927('0x15a')]))['then'](_0x5b293d[_0x9927('0x200')](_0x1f421f,_0x353b45[_0x5bb519]))[_0x9927('0x9b')](function(_0x47bf02){logger['error'](_0x9927('0x20b'),_0x47bf02);utils[_0x9927('0xbd')](_0x1f421f,_0x9927('0x20c'));});}}}}})['catch'](function(_0x1ea189){_0x1f421f[_0x9927('0x1fa')]=0x0;logger['error']('[getContactCampaign2]',_0x1ea189);});}};Dialer[_0x9927('0x1a')][_0x9927('0x66')]=function(_0x523d1){if(_0x523d1['dialLimitQueue']>0x0){var _0x41f058=_0x523d1[_0x9927('0x204')]-_0x523d1['originated']-_0x523d1[_0x9927('0x138')];if(_0x41f058>0x0&&_0x523d1['temp']==0x0){this['tryOriginatePredictive'](_0x523d1);}else{loggerPredictiveCalls[_0x9927('0x4b')](_0x9927('0x20d'));}}else{this[_0x9927('0x20e')](_0x523d1);}};Dialer[_0x9927('0x1a')][_0x9927('0x20e')]=function(_0x333139){var _0x11fd59=this;var _0x23d7ee=[];_0x333139['originated']+=0x1;for(var _0x3a0062 in this['agents']){if(typeof this['agents'][_0x3a0062]!==_0x9927('0xa6')){if(this[_0x9927('0x22')][_0x3a0062][_0x9927('0x6f')]===_0x9927('0x205')&&this['agents'][_0x3a0062][_0x9927('0x85')]==='reachable'){_0x23d7ee[_0x9927('0x93')](this[_0x9927('0x22')][_0x3a0062]['id']);}}}_0x333139[_0x9927('0x1fa')]=0x1;return this['getContactDialer'](_0x333139['id'],_0x23d7ee,0x1,_0x333139[_0x9927('0x20f')],_0x333139)[_0x9927('0x40')](function(_0x4b2402){_0x333139[_0x9927('0x1fa')]=0x1;if(_0x4b2402){if(!utils[_0x9927('0x1fb')](_0x4b2402)){utils[_0x9927('0x210')](_0x333139,0x1,0x0);return hopperUtils[_0x9927('0x207')](_0x333139)[_0x9927('0x40')](sendMessageReschedule(_0x333139))[_0x9927('0x9b')](loggerCatch(_0x9927('0x208')));}else{_0x333139[_0x9927('0x6e')]=utils[_0x9927('0x6a')][_0x9927('0x209')];if(_[_0x9927('0xf3')](_0x4b2402[0x0])||_[_0x9927('0xf3')](_0x4b2402[0x0][_0x9927('0x171')])||_[_0x9927('0xf3')](_0x4b2402[0x0][_0x9927('0x15a')])){_0x11fd59[_0x9927('0x150')](_0x9927('0x1fe'),_0x333139,_0x4b2402[0x0]);}else{return hopperUtils[_0x9927('0x20a')](_[_0x9927('0x76')](_0x4b2402[0x0],[_0x9927('0xde'),_0x9927('0x15a')]))[_0x9927('0x40')](_0x11fd59[_0x9927('0x200')](_0x333139,_0x4b2402[0x0]))[_0x9927('0x9b')](function(_0x2f2b00){logger['error'](_0x9927('0x211'),_0x2f2b00);utils[_0x9927('0xbd')](_0x333139,_0x9927('0x211'));});}}}})[_0x9927('0x9b')](function(_0xc4e42f){_0x333139[_0x9927('0x1fa')]=0x0;logger[_0x9927('0x67')](_0x9927('0x203'),_0xc4e42f);});};Dialer[_0x9927('0x1a')][_0x9927('0x1d7')]=function(_0x517c2b,_0x30387e,_0xf51230,_0x599448,_0x59cdcd,_0x296678){loggerPredictive['info'](_0x9927('0x212'));loggerPredictive['info'](_0x9927('0x213'),_0x517c2b);loggerPredictive[_0x9927('0x4b')](_0x9927('0x214'),_0x30387e);loggerPredictive[_0x9927('0x4b')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf51230);loggerPredictive[_0x9927('0x4b')]('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',_0x599448);loggerPredictive['info'](_0x9927('0x215'),_0x59cdcd);loggerPredictive[_0x9927('0x4b')](_0x9927('0x216'));return new Promise(function(_0x2dec5f,_0x514402){if(_0x517c2b<=0x0||isNaN(_0x517c2b)){return _0x514402(msgResponse('[abandonmentRate]',_0x9927('0x188'),_0x9927('0x217')+_0x517c2b));}if(_0xf51230<=0x0||isNaN(_0xf51230)){return _0x514402(msgResponse(_0x9927('0x218'),_0x9927('0x188'),_0x9927('0x219')+_0xf51230));}if(_0x599448<=0x0||isNaN(_0x599448)){return _0x514402(msgResponse(_0x9927('0x218'),_0x9927('0x188'),_0x9927('0x21a')+_0x599448));}if(_0x30387e<=0x0||isNaN(_0x30387e)){return _0x514402(msgResponse(_0x9927('0x218'),_0x9927('0x188'),_0x9927('0x21b')+_0x30387e));}if(_0x59cdcd<=0x0||isNaN(_0x59cdcd)){return _0x514402(msgResponse(_0x9927('0x218'),_0x9927('0x188'),_0x9927('0x21c')+_0x59cdcd));}_0x296678=_0x296678||0x0;var _0x53a6cd=0x1/_0xf51230;var _0x18f486=0x0;var _0x53ad31=0x0;var _0x2b99a9=0x0;var _0x338154=0x0;for(var _0x41df5d=0x0;_0x2b99a9<_0x59cdcd;_0x41df5d+=0x1){_0x53ad31=_0x41df5d/_0x30387e;_0x18f486=(_0x599448*_0x53ad31+_0x296678)/_0x53a6cd;_0x2b99a9=utils[_0x9927('0x21d')](_0x18f486,_0x517c2b);_0x338154=_0x18f486/_0x517c2b*(0x1-utils[_0x9927('0x21d')](_0x18f486,_0x517c2b));}return _0x2dec5f({'erlangCalls':_0x41df5d,'erlangCallToSecond':_0x30387e/_0x41df5d,'erlangAbandonmentRate':_0x2b99a9,'erlangBusyFactor':_0x338154});});};Dialer['prototype'][_0x9927('0x21e')]=function(_0x5cdbb0,_0x42fc6a,_0x2f67f6,_0xb6b16,_0xae38ae,_0x2e7a5a){loggerPredictive[_0x9927('0x4b')](_0x9927('0x21f'));loggerPredictive[_0x9927('0x4b')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5cdbb0);loggerPredictive[_0x9927('0x4b')](_0x9927('0x214'),_0x42fc6a);loggerPredictive[_0x9927('0x4b')](_0x9927('0x220'),_0x2f67f6);loggerPredictive[_0x9927('0x4b')](_0x9927('0x221'),_0xb6b16);loggerPredictive['info'](_0x9927('0x222'),_0xae38ae);loggerPredictive[_0x9927('0x4b')](_0x9927('0x216'));return new Promise(function(_0x400508,_0x382601){if(_0x5cdbb0<=0x0||isNaN(_0x5cdbb0)){return _0x382601(msgResponse(_0x9927('0x223'),'Error','m\x20=\x20'+_0x5cdbb0));}if(_0x2f67f6<=0x0||isNaN(_0x2f67f6)){return _0x382601(msgResponse('[busyFactor]','Error',_0x9927('0x219')+_0x2f67f6));}if(_0xb6b16<=0x0||isNaN(_0xb6b16)){return _0x382601(msgResponse('[busyFactor]',_0x9927('0x188'),_0x9927('0x21a')+_0xb6b16));}if(_0x42fc6a<=0x0||isNaN(_0x42fc6a)){return _0x382601(msgResponse(_0x9927('0x223'),_0x9927('0x188'),'interval\x20=\x20'+_0x42fc6a));}if(_0xae38ae<=0x0||isNaN(_0xae38ae)){return _0x382601(msgResponse('[busyFactor]','Error',_0x9927('0x224')+_0xae38ae));}_0x2e7a5a=_0x2e7a5a||0x0;var _0x3069ec=0x1/_0x2f67f6;var _0x334475=0x0;var _0x2632f7=0x0;var _0x4d75d8=0x0;var _0x3ce819=0x0;for(var _0x5c8eaf=0x0;_0x3ce819<_0xae38ae;_0x5c8eaf+=0x1){_0x2632f7=_0x5c8eaf/_0x42fc6a;_0x334475=(_0xb6b16*_0x2632f7+_0x2e7a5a)/_0x3069ec;_0x4d75d8=utils[_0x9927('0x21d')](_0x334475,_0x5cdbb0);_0x3ce819=_0x334475/_0x5cdbb0*(0x1-utils[_0x9927('0x21d')](_0x334475,_0x5cdbb0));}return _0x400508({'erlangCalls':_0x5c8eaf,'erlangCallToSecond':_0x42fc6a/_0x5c8eaf,'erlangAbandonmentRate':_0x4d75d8,'erlangBusyFactor':_0x3ce819});});};module['exports']=Dialer; \ No newline at end of file +var _0x71a1=['[syncAgentCompleteIvr]','[syncHangupIvr]','AnswerAGI','AGI','[syncHangup2]','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','INACTIVE','startPredictive','available','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','Agent','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','trim','dialCutDigit','substring','dialPrefix','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','nosuchnumber','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','busyFactor','[CatchErlangB]','check\x20failure','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','[countReScheduled]\x20','checkIsBlackList','[actionOriginate]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkContactLowerLimitOriginate','countReScheduled','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','p\x20=\x20','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','dialer','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','---------------------------','predictiveIntervalTotalCalls','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive','debug','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','isIVRCampaign','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20deactivated','[ifTime][Action]','Error','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','Action','iftime\x20%s,%s','interval','content','indexOf','true','catch','push','command','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','uniqueId','answertime','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete]','syncQueueCallerAbandon','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countdropretry','countglobal','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','dialDropRetryFrequency','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','rescheduleContact','ContactId','calleridnum','channel','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','run','idHopper','finally','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','response','Success','[syncOriginateResponse]','[callProgressDetecting]\x20','variable','amdstatus','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','custom:amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','stateGlobal','[rescheduleContact][Machine]','syncHangup','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer'];(function(_0x28fd0a,_0x3014c0){var _0x2f9ff6=function(_0xbe8e72){while(--_0xbe8e72){_0x28fd0a['push'](_0x28fd0a['shift']());}};_0x2f9ff6(++_0x3014c0);}(_0x71a1,0xfa));var _0x171a=function(_0x3cf49a,_0x54f14b){_0x3cf49a=_0x3cf49a-0x0;var _0x355fdd=_0x71a1[_0x3cf49a];return _0x355fdd;};'use strict';var util=require(_0x171a('0x0'));var _=require(_0x171a('0x1'));var uuid=require(_0x171a('0x2'));var moment=require(_0x171a('0x3'));var rr=require('rr');var Redis=require(_0x171a('0x4'));var utils=require(_0x171a('0x5'));var hopperUtils=require(_0x171a('0x6'));var ut=require(_0x171a('0x7'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x171a('0x8'));var loggerBooked=require(_0x171a('0x9'))(_0x171a('0xa'));var loggerPredictive=require(_0x171a('0x9'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0x171a('0xb'));var loggerSyncQueueSummary=require(_0x171a('0x9'))(_0x171a('0xc'));var ami=require(_0x171a('0xd'));config[_0x171a('0xe')]=_['defaults'](config['redis'],{'host':_0x171a('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x171a('0x10'));var voiceQueueRt=require(_0x171a('0x11'));var RpcSetting=require(_0x171a('0x12'));var Interval=require(_0x171a('0x13'));var Action=require(_0x171a('0x14'));var History=require(_0x171a('0x15'));var Final=require(_0x171a('0x16'));var AgentComplete=require(_0x171a('0x17'));var QueueCallerAbandon=require(_0x171a('0x18'));var Hangup=require('./models/hangup');var ipAgi=process[_0x171a('0x19')][_0x171a('0x1a')]||_0x171a('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x171a('0x1c')][_0x171a('0x1d')]=function(_0xa589f5){this[_0x171a('0x1e')]=this['tail']?this['tail']['finally'](_0xa589f5):_0xa589f5();};function Dialer(_0x5784ee,_0x4b269f){this['sequence']=new Sequence();this[_0x171a('0x1f')]=_0x4b269f;this['voiceQueues']=_0x5784ee[_0x171a('0x20')];this[_0x171a('0x21')]=_0x5784ee[_0x171a('0x21')];this[_0x171a('0x22')]=_0x5784ee[_0x171a('0x22')];this[_0x171a('0x23')]=_0x5784ee[_0x171a('0x23')];this[_0x171a('0x24')]=config[_0x171a('0x24')]||0x2;this[_0x171a('0x25')]={};this[_0x171a('0x26')]={};this[_0x171a('0x27')]={};this['uniqueId']={};this[_0x171a('0x28')]={};this['startPredictive']={};this['startProgressive']={};this[_0x171a('0x29')]={};this[_0x171a('0x2a')]={};this[_0x171a('0x2b')]={};this[_0x171a('0x2c')]={};ami['on'](_0x171a('0x2d'),this[_0x171a('0x2e')]['bind'](this));ami['on'](_0x171a('0x2f'),this['syncQueueCallerAbandon'][_0x171a('0x30')](this));ami['on'](_0x171a('0x31'),this[_0x171a('0x32')][_0x171a('0x30')](this));ami['on'](_0x171a('0x33'),this[_0x171a('0x34')]['bind'](this));ami['on'](_0x171a('0x35'),this['syncQueueSummary'][_0x171a('0x30')](this));ami['on']('custom:queuesummarycomplete',this[_0x171a('0x36')][_0x171a('0x30')](this));ami['on'](_0x171a('0x37'),this['syncHangup']['bind'](this));ami['on'](_0x171a('0x38'),this['syncNewExten'][_0x171a('0x30')](this));ami['on'](_0x171a('0x39'),this[_0x171a('0x3a')]['bind'](this));ami['on'](_0x171a('0x3b'),this[_0x171a('0x3c')]['bind'](this));ami['on'](_0x171a('0x3d'),this[_0x171a('0x3e')]['bind'](this));this[_0x171a('0x3f')]();this[_0x171a('0x40')]();RpcSetting[_0x171a('0x41')]()[_0x171a('0x42')](function(_0x3226fd){previewRecallmeReminderInterval=_0x3226fd['previewRecallmeReminderInterval'];});}function isNotNull(_0x22deca){return _0x22deca!==null&&!_['isUndefined'](_0x22deca);}function msgResponse(_0x285964,_0x3c05d5,_0x4ec492){return{'action':_0x285964,'response':_0x3c05d5,'message':_0x4ec492,'stack':_0x4ec492};}function emit(_0x441522,_0x2f50bf,_0x4fd6ed){io['to'](_0x441522)['emit'](_0x2f50bf,_0x4fd6ed);}function emitOutboundVoiceQueueSummary(_0x937b45){if(_0x937b45[_0x171a('0x43')]===_0x171a('0x44')){logger['debug'](_0x171a('0x45'),util[_0x171a('0x46')](_0x937b45,{'showHidden':![],'depth':null}));emit(util[_0x171a('0x47')](_0x171a('0x48'),_0x937b45[_0x171a('0x49')]),_0x171a('0x4a'),_0x937b45);}}function checkGetDataPredictive(_0x3666c4){if(isNotNull(_0x3666c4)&&!_[_0x171a('0x4b')](_0x3666c4)){loggerPredictive[_0x171a('0x4c')](_0x171a('0x4d'));loggerPredictive[_0x171a('0x4c')](_0x171a('0x4e'),_0x3666c4['predictiveIntervalTotalCalls']);loggerPredictive[_0x171a('0x4c')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3666c4[_0x171a('0x4f')]);loggerPredictive[_0x171a('0x4c')](_0x171a('0x50'),_0x3666c4[_0x171a('0x51')]);loggerPredictive[_0x171a('0x4c')](_0x171a('0x52'),_0x3666c4['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x171a('0x4c')](_0x171a('0x53'),_0x3666c4[_0x171a('0x54')]);loggerPredictive[_0x171a('0x4c')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3666c4['predictiveIntervalAvgTalktime']);loggerPredictive[_0x171a('0x4c')](_0x171a('0x55'));if(_0x3666c4[_0x171a('0x56')]>0x0){if(!_[_0x171a('0x57')](_0x3666c4['predictiveIntervalAvgTalktime'])&&_0x3666c4[_0x171a('0x58')]>0x0){return!![];}loggerPredictive[_0x171a('0x4c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x3666c4['predictiveIntervalAvgHoldtime'])&&_0x3666c4[_0x171a('0x54')]>0x0){return!![];}loggerPredictive[_0x171a('0x4c')](_0x171a('0x59'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x171a('0x4c')](_0x171a('0x5a'));}return![];}function mergeDataErlangB(_0x2ffbe1){return function(_0x557924){loggerPredictive['info'](_0x171a('0x5b'));loggerPredictive[_0x171a('0x4c')](_0x171a('0x5c'),_0x557924[_0x171a('0x5d')]);loggerPredictive['info'](_0x171a('0x5e'),_0x557924[_0x171a('0x5f')]);loggerPredictive[_0x171a('0x4c')](_0x171a('0x60'),_0x557924['erlangAbandonmentRate']);loggerPredictive[_0x171a('0x4c')](_0x171a('0x61'),_0x557924[_0x171a('0x62')]);loggerPredictive[_0x171a('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x557924['erlangAbandonmentRate']);loggerPredictive['info'](_0x171a('0x55'));_[_0x171a('0x63')](_0x2ffbe1,_0x557924);};}function ifInterval(_0x8e421d,_0x414f50){if(_[_0x171a('0x57')](_0x414f50)){return![];}return utils[_0x171a('0x64')](undefined,_0x414f50)<_0x8e421d*0x3c;}function clearPredictiveAttributes(_0xc070f4){if(_0xc070f4['startProgressive']){_0xc070f4[_0x171a('0x65')]=undefined;loggerPredictive[_0x171a('0x66')](_0xc070f4['name'],'startProgressive\x20value\x20cleared');}if(_0xc070f4['startPredictive']){_0xc070f4['startPredictive']=undefined;loggerPredictive['debug'](_0xc070f4[_0x171a('0x49')],'startPredictive\x20value\x20cleared');}if(_0xc070f4[_0x171a('0x67')]){clearInterval(_0xc070f4[_0x171a('0x67')]);_0xc070f4[_0x171a('0x67')]=undefined;loggerPredictive[_0x171a('0x66')](_0xc070f4[_0x171a('0x49')],_0x171a('0x68'));}}function loggerCatchPredictive(_0x512844,_0x298f5b){return function(_0x58737b){loggerPredictive[_0x171a('0x69')](_0x298f5b[_0x171a('0x49')],_0x512844);loggerPredictive[_0x171a('0x69')](_0x58737b[_0x171a('0x6a')]);clearPredictiveAttributes(_0x298f5b);};}function loggerCatch(_0x59df8e){return function(_0x5176a5){logger['error'](_0x59df8e,util[_0x171a('0x46')](_0x5176a5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xaa0ef7){return function(_0x397aab){if(isNotNull(_0x397aab)&&isNotNull(_0x397aab[0x0])){if(_0x397aab[0x0][_0x171a('0x6b')]>0x0){_0xaa0ef7[_0x171a('0x6c')]=utils['CAMPAIGN_STATUS'][_0x171a('0x6d')];logger[_0x171a('0x4c')](_0x171a('0x6e')+_0xaa0ef7[_0x171a('0x49')],_0x397aab[0x0][_0x171a('0x6b')],'contacts');}else{_0xaa0ef7['message']=utils[_0x171a('0x6f')][_0x171a('0x70')];logger['info'](_0x171a('0x71')+_0xaa0ef7['name']);}}};}function createObjHistory(_0x1133ab,_0x503ce7,_0x4cfd82,_0x887316,_0x5445e9){_0x1133ab['message']=_0x4cfd82;var _0x1ff1b4=new Action(_0x1133ab,_0x503ce7);var _0x5d16a8=new History(_0x1ff1b4);_0x5d16a8[_0x171a('0x72')]=_0x887316;_0x5d16a8[_0x171a('0x73')]=_0x5445e9;_0x5d16a8[_0x171a('0x74')]=_0x1ff1b4[_0x171a('0x75')];return _0x5d16a8;}function unlockQueueStatus(_0x470105,_0x5e99d4){setTimeout(function(){if(_['isUndefined'](_0x470105[_0x171a('0x76')])){loggerBooked[_0x171a('0x69')](_0x171a('0x77'),_0x5e99d4);}_0x470105[_0x171a('0x76')]=!![];loggerBooked[_0x171a('0x4c')](_0x171a('0x78'),_0x5e99d4,JSON[_0x171a('0x79')](_[_0x171a('0x7a')](_0x470105,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0x1d588e){return function(){if(!isNotNull(_0x1d588e[_0x171a('0x7b')])){_0x1d588e[_0x171a('0x6c')]=utils[_0x171a('0x6f')][_0x171a('0x7c')];throw _0x1d588e[_0x171a('0x49')]+_0x171a('0x7d');}if(!isNotNull(_0x1d588e[_0x171a('0x7b')]['Intervals'])){_0x1d588e[_0x171a('0x6c')]=utils[_0x171a('0x6f')][_0x171a('0x7c')];throw _0x1d588e[_0x171a('0x49')]+_0x171a('0x7d');}if(!isNotNull(_[_0x171a('0x4b')](_0x1d588e[_0x171a('0x7b')][_0x171a('0x7e')]))){_0x1d588e[_0x171a('0x6c')]=utils[_0x171a('0x6f')]['NULL_INTERVAL'];throw _0x1d588e['name']+_0x171a('0x7d');}};}function checkIsIVRCampaignActive(_0x575f4c){return function(){if(!utils[_0x171a('0x7f')](_0x575f4c)){_0x575f4c[_0x171a('0x6c')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x575f4c['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x52e74e){if(utils[_0x171a('0x80')](_0x52e74e)){emit(util[_0x171a('0x47')]('campaign:ivr:%s',_0x52e74e[_0x171a('0x49')]),'campaign:save',_0x52e74e);}}function loggerCatchQueueSummary(_0x219edf,_0x3b0c32){return function(_0x623c1){clearPredictiveAttributes(_0x3b0c32);emitCampaignSummary(_0x3b0c32);loggerSyncQueueSummary['debug'](_0x219edf,util[_0x171a('0x46')](_0x623c1,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x27e76e){if(_0x27e76e['sendMessageOneNotActive']){if(_0x27e76e[_0x171a('0x81')]===0x0){_0x27e76e[_0x171a('0x82')]=![];_0x27e76e[_0x171a('0x6c')]=utils[_0x171a('0x6f')]['INACTIVE'];loggerSyncQueueSummary[_0x171a('0x66')](_0x171a('0x83'),_0x27e76e[_0x171a('0x49')],'is\x20not\x20active');}else{_0x27e76e[_0x171a('0x6c')]=utils[_0x171a('0x6f')][_0x171a('0x84')];loggerSyncQueueSummary[_0x171a('0x66')](_0x171a('0x83'),_0x27e76e[_0x171a('0x49')],_0x171a('0x85'));}emitCampaignSummary(_0x27e76e);}}function myreject(_0x218954){return function(_0x439912){return _0x218954(msgResponse(_0x171a('0x86'),_0x171a('0x87'),JSON[_0x171a('0x79')](_0x439912)));};}Dialer['prototype']['isTrunkReachable']=function(_0x5a1969){return!_[_0x171a('0x57')](_0x5a1969)&&_0x5a1969&&!_[_0x171a('0x57')](_0x5a1969['name'])&&!_[_0x171a('0x57')](_0x5a1969[_0x171a('0x88')])&&_0x5a1969['active']&&(this[_0x171a('0x23')][util[_0x171a('0x47')](_0x171a('0x89'),_0x5a1969[_0x171a('0x49')])][_0x171a('0x8a')]===_0x171a('0x8b')||this['trunks'][util[_0x171a('0x47')](_0x171a('0x89'),_0x5a1969[_0x171a('0x49')])][_0x171a('0x8a')]===_0x171a('0x8c'));};Dialer[_0x171a('0x1c')][_0x171a('0x8d')]=function(_0x31a888){var _0x22f70e=this;return function(){if(!_0x22f70e[_0x171a('0x8e')](_0x31a888[_0x171a('0x8f')])){if(!_0x22f70e['isTrunkReachable'](_0x31a888[_0x171a('0x90')])){_0x31a888[_0x171a('0x6c')]=utils[_0x171a('0x6f')]['TRUNK_NOT_REACHABLE'];throw _0x31a888[_0x171a('0x49')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype']['checkIfTime']=function(_0x2aeb9c,_0x59193c,_0x2212fe,_0x47d6a0){var _0xea1737=this;return function(){var _0x20bb1f=!![];return _0xea1737[_0x171a('0x91')](_0x2aeb9c,_0x59193c,_0x2212fe,_0x47d6a0,_0x20bb1f);};};Dialer[_0x171a('0x1c')][_0x171a('0x92')]=function(_0x3744af,_0x878834,_0x8f745f,_0x22fb0b){var _0x10c780=this;return function(){var _0x68ba5e=![];return _0x10c780[_0x171a('0x91')](_0x3744af['Intervals'],_0x878834,_0x8f745f,_0x22fb0b,_0x68ba5e);};};Dialer['prototype'][_0x171a('0x91')]=function(_0x5d8003,_0x3001f0,_0x1ea4f7,_0x4e6c89,_0xdc883a){var _0x2804d3=[];return new Promise(function(_0x1db486,_0x421ef4){if(!isNotNull(_0x5d8003)){_0x4e6c89[_0x171a('0x6c')]=utils[_0x171a('0x6f')]['NULL_INTERVAL'];return _0x421ef4(msgResponse(_0x171a('0x93'),_0x171a('0x94'),_0x1ea4f7+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x171a('0x4b')](_0x5d8003)){_0x4e6c89['message']=utils['CAMPAIGN_STATUS'][_0x171a('0x95')];return _0x421ef4(msgResponse(_0x171a('0x93'),_0x171a('0x94'),_0x1ea4f7+_0x171a('0x96')));}if(_0x3001f0&&_[_0x171a('0x57')](config[_0x171a('0x97')][_0x3001f0])){_0x4e6c89['message']=utils[_0x171a('0x6f')][_0x171a('0x98')];return _0x421ef4(msgResponse(_0x171a('0x93'),_0x171a('0x94'),_0x1ea4f7+_0x171a('0x99')+_0x3001f0));}if(_[_0x171a('0x9a')](_0x5d8003)){for(var _0x193dab=0x0;_0x193dab<_0x5d8003[_0x171a('0x9b')];_0x193dab+=0x1){_0x2804d3['push'](ami[_0x171a('0x9c')]({'action':'command','command':util[_0x171a('0x47')](_0x171a('0x9d'),_0x5d8003[_0x193dab][_0x171a('0x9e')],!_['isUndefined'](config['timezones'][_0x3001f0])?_0x3001f0:'')})[_0x171a('0x42')](function(_0x1a8594){return _0x1a8594[_0x171a('0x9f')][_0x171a('0xa0')](_0x171a('0xa1'))>=0x0;})[_0x171a('0xa2')](myreject(_0x421ef4)));}}else{_0x2804d3[_0x171a('0xa3')](ami['Action']({'action':_0x171a('0xa4'),'command':util[_0x171a('0x47')](_0x171a('0x9d'),_0x5d8003,!_['isUndefined'](config['timezones'][_0x3001f0])?_0x3001f0:'')})[_0x171a('0x42')](function(_0x4a0055){return _0x4a0055[_0x171a('0x9f')][_0x171a('0xa0')](_0x171a('0xa1'))>=0x0;})[_0x171a('0xa2')](myreject(_0x421ef4)));}Promise[_0x171a('0xa5')](_0x2804d3)[_0x171a('0x42')](function(_0x303859){var _0x2c865b=_[_0x171a('0xa6')](_0x303859);if(_0x2c865b){return _0x1db486(_0x2c865b);}else{_0x4e6c89['message']=_0xdc883a?utils[_0x171a('0x6f')][_0x171a('0xa7')]:utils[_0x171a('0x6f')][_0x171a('0xa8')];return _0x421ef4(msgResponse('[ifTime][promiseAll]',_0x171a('0x94'),_0x171a('0xa9')+_0xdc883a+'\x20'+_0x1ea4f7+_0x171a('0xaa')+util[_0x171a('0x46')](_0x5d8003,{'showHidden':![],'depth':null})+_0x171a('0xab')+_0x3001f0));}})[_0x171a('0xa2')](function(_0x39017f){return _0x421ef4(msgResponse(_0x171a('0x93'),_0x171a('0x94'),JSON[_0x171a('0x79')](_0x39017f)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x599d56=this;return cmHopper[_0x171a('0xac')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x599d56[_0x171a('0xad')]();},0x3e8);});};Dialer[_0x171a('0x1c')][_0x171a('0xad')]=function(){var _0x2a2757=this;var _0x6662ba;for(var _0x2300d5 in this[_0x171a('0x21')]){if(typeof this[_0x171a('0x21')][_0x2300d5]!==_0x171a('0xae')){_0x6662ba=this[_0x171a('0x21')][_0x2300d5];if(utils[_0x171a('0x80')](_0x6662ba)&&utils[_0x171a('0x7f')](_0x6662ba)){_0x6662ba[_0x171a('0x82')]=!![];Promise['resolve']()['then'](checkIsIVRCampaignActive(_0x6662ba))['then'](checkInterval(_0x6662ba))[_0x171a('0x42')](_0x2a2757[_0x171a('0x8d')](_0x6662ba))['then'](_0x2a2757[_0x171a('0xaf')](_0x6662ba[_0x171a('0xb0')],_0x6662ba[_0x171a('0xb1')],_0x6662ba[_0x171a('0x49')],_0x6662ba))['then'](_0x2a2757[_0x171a('0x92')](_0x6662ba['Interval'],_0x6662ba[_0x171a('0xb1')],_0x6662ba[_0x171a('0x49')],_0x6662ba))[_0x171a('0x42')](_0x2a2757[_0x171a('0xb2')](_0x6662ba))[_0x171a('0xa2')](loggerCatchQueueSummary(_0x171a('0xb3'),_0x6662ba));}else{notSendMessagesCampaign(_0x6662ba);}}}};Dialer['prototype'][_0x171a('0xb4')]=function(_0x506b33){if(_0x506b33[_0x171a('0xb5')]!==_0x171a('0xb6')){clearPredictiveAttributes(_0x506b33);}switch(_0x506b33[_0x171a('0xb5')]){case _0x171a('0xb7'):this[_0x171a('0xb8')](_0x506b33,0x1);break;case _0x171a('0xb9'):this['handlePower'](_0x506b33,_0x506b33[_0x171a('0xba')]);break;case _0x171a('0xb6'):this[_0x171a('0xb6')](_0x506b33);break;case _0x171a('0xa'):this[_0x171a('0xb8')](_0x506b33,0x1);break;default:logger[_0x171a('0x69')](_0x171a('0xbb'),_0x506b33[_0x171a('0x49')],_0x171a('0xbc'));}};Dialer[_0x171a('0x1c')][_0x171a('0x93')]=function(_0x46d05b,_0x1b4bef){var _0x29c503=_0x46d05b['dialTimezone'];var _0x1c8f50=_0x1b4bef?_0x46d05b[_0x171a('0xb0')]:_0x46d05b[_0x171a('0x7b')][_0x171a('0x7e')];logger[_0x171a('0xbd')]('Dialer::ifTime()',_0x1c8f50,_0x29c503,_0x46d05b['name'],util[_0x171a('0x47')](_0x171a('0xbe'),_0x46d05b[_0x171a('0x49')],_0x46d05b['id']));var _0xbec132=null;return Interval[_0x171a('0xbf')](_0x1c8f50,_0x29c503)[_0x171a('0x42')](function(_0x536c2d){if(_0x536c2d===!![]){return _0x536c2d;}else{_0x46d05b[_0x171a('0x6c')]=_0x1b4bef?utils[_0x171a('0x6f')][_0x171a('0xa7')]:utils[_0x171a('0x6f')][_0x171a('0xa8')];_0xbec132=msgResponse('[ifTime][promiseAll]',_0x171a('0x94'),'Global:\x20'+_0x1b4bef+'\x20'+_0x46d05b[_0x171a('0x49')]+_0x171a('0xaa')+util[_0x171a('0x46')](_0x1c8f50,{'showHidden':![],'depth':null})+_0x171a('0xab')+_0x29c503);}if(_0xbec132!==null){logger[_0x171a('0xbd')](_0x171a('0xc0'),_0xbec132);_0xbec132[_0x171a('0xc1')]=_0x1b4bef;throw _0xbec132;}})[_0x171a('0xa2')](function(_0x4fc68e){logger['error'](_0x171a('0xc2'),_0x4fc68e);throw msgResponse(_0x171a('0x86'),_0x171a('0x87'),util[_0x171a('0x46')](_0x4fc68e,{'showHidden':![],'depth':null}));});};Dialer[_0x171a('0x1c')][_0x171a('0x2e')]=function(_0x1283e8){if(this[_0x171a('0x20')][_0x1283e8[_0x171a('0xc3')]]){if(this['uniqueId'][_0x1283e8[_0x171a('0xc4')]]&&this['uniqueId'][_0x1283e8[_0x171a('0xc4')]][_0x171a('0x43')]!==_0x171a('0xc5')){utils[_0x171a('0xc6')](this['voiceQueues'][_0x1283e8[_0x171a('0xc3')]],_0x171a('0xc7'));this[_0x171a('0xc8')][_0x1283e8[_0x171a('0xc4')]][_0x171a('0xc9')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x171a('0x1c')]['syncAgentComplete']=function(_0x23b798){var _0x38739b=this[_0x171a('0xc8')][_0x23b798['uniqueid']];if(this[_0x171a('0x20')][_0x23b798[_0x171a('0xc3')]]){if(_0x38739b&&_0x38739b[_0x171a('0x43')]!==_0x171a('0xc5')){delete this[_0x171a('0xc8')][_0x23b798[_0x171a('0xc4')]];this[_0x171a('0x20')][_0x23b798[_0x171a('0xc3')]][_0x171a('0xca')]+=0x1;var _0x35d30a=new AgentComplete(_0x38739b,_0x23b798);if(_0x23b798[_0x171a('0xcb')]==='agent'){_0x35d30a[_0x171a('0xcc')]=this[_0x171a('0x20')][_0x23b798[_0x171a('0xc3')]][_0x171a('0xcd')]&&this[_0x171a('0x20')][_0x23b798['queue']][_0x171a('0xce')]?moment()[_0x171a('0x47')](_0x171a('0xcf')):undefined;}hopperUtils[_0x171a('0xd0')](_0x35d30a)[_0x171a('0xa2')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x35d30a)[_0x171a('0xa2')](loggerCatch(_0x171a('0xd1')));}}};Dialer[_0x171a('0x1c')][_0x171a('0xd2')]=function(_0x406e01){var _0x552275=this[_0x171a('0xc8')][_0x406e01[_0x171a('0xc4')]];var _0xdf8089=this;var _0x52b1eb=![];var _0x8d0a2f;var _0x5b36eb;if(this[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]]){if(_0x552275&&_0x552275['type']!==_0x171a('0xc5')){delete this['uniqueId'][_0x406e01['uniqueid']];utils[_0x171a('0xc6')](this[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]],_0x171a('0xd3'));_0x552275[_0x171a('0xd4')]=moment()[_0x171a('0x47')](_0x171a('0xcf'));var _0x4e9e97=new QueueCallerAbandon(_0x552275,_0x406e01);if(utils[_0x171a('0x64')](_0x552275[_0x171a('0xd4')],_0x552275[_0x171a('0xd5')])>=_0x552275[_0x171a('0xd6')]){this['voiceQueues'][_0x406e01[_0x171a('0xc3')]][_0x171a('0x51')]+=0x1;this[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]][_0x171a('0xd7')]+=0x1;this['voiceQueues'][_0x406e01['queue']][_0x171a('0xd8')]+=0x1;_0x4e9e97[_0x171a('0x72')]=0xa;_0x4e9e97['statedesc']=_0x171a('0xd9');_0x4e9e97['dropreason']=_0x171a('0xda');_0x4e9e97[_0x171a('0xcc')]=this[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]][_0x171a('0xcd')]?moment()['format'](_0x171a('0xcf')):undefined;_0x4e9e97[_0x171a('0xdb')]+=0x1;_0x4e9e97[_0x171a('0xdc')]+=0x1;_0x8d0a2f=this[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]]['dialDropRetryFrequency'];_0x5b36eb=this[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x171a('0xdd')](_0x4e9e97,_0x4e9e97[_0x171a('0x72')],_0x552275[_0x171a('0xde')])['then'](function(_0x1b8c8c){_0x52b1eb=_0x1b8c8c[_0x171a('0xdf')]==0x1;if(_0x4e9e97['countdropretry']>=_0xdf8089['voiceQueues'][_0x406e01['queue']][_0x171a('0xe0')]){_0xdf8089[_0x171a('0xe1')](_0x4e9e97,_0x1b8c8c['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4e9e97[_0x171a('0xdb')],'scheduledat':moment()[_0x171a('0xe2')](_0xdf8089[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]][_0x171a('0xe3')],_0x171a('0xe4'))[_0x171a('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x552275['ContactId'],'ListId':_0x552275[_0x171a('0xe5')],'VoiceQueueId':_0x552275[_0x171a('0xe6')]||undefined,'CampaignId':_0x552275[_0x171a('0xe7')]||undefined})[_0x171a('0xa2')](loggerCatch(_0x171a('0xe8')));var _0x2ef5ce=new History(_0x4e9e97);_0x2ef5ce[_0x171a('0x72')]=0xa;_0x2ef5ce['statedesc']='Drop';_0x2ef5ce[_0x171a('0x75')]=moment()[_0x171a('0x47')](_0x171a('0xcf'));_0x2ef5ce[_0x171a('0x74')]=_0x2ef5ce[_0x171a('0x75')];_0x2ef5ce[_0x171a('0xe9')]=_0x4e9e97[_0x171a('0xe9')];_0x2ef5ce['calleridnum']=_0x4e9e97['calleridnum'];hopperUtils[_0x171a('0xd0')](_0x2ef5ce)['catch'](loggerCatch(_0x171a('0xea')));}})[_0x171a('0x42')](function(){if(_0x52b1eb)hopperUtils[_0x171a('0xeb')](_0x4e9e97,_0x8d0a2f,_0x5b36eb)[_0x171a('0x42')](function(){return 0x1;});});}else{this[_0x171a('0x20')][_0x406e01['queue']][_0x171a('0xec')]+=0x1;this[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]][_0x171a('0xed')]+=0x1;_0x4e9e97[_0x171a('0x72')]=0xb;_0x4e9e97['statedesc']=_0x171a('0xee');_0x4e9e97['dropreason']=_0x171a('0xef');_0x4e9e97[_0x171a('0xf0')]+=0x1;_0x4e9e97[_0x171a('0xdc')]+=0x1;_0x8d0a2f=this[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]][_0x171a('0xf1')];_0x5b36eb=this[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x171a('0xdd')](_0x4e9e97,_0x4e9e97[_0x171a('0x72')],_0x552275[_0x171a('0xde')])[_0x171a('0x42')](function(_0x301840){if(_0x4e9e97[_0x171a('0xf0')]>=_0xdf8089[_0x171a('0x20')][_0x406e01['queue']][_0x171a('0xf2')]){_0xdf8089[_0x171a('0xe1')](_0x4e9e97,_0x301840[_0x171a('0xdf')]);}else{hopperUtils[_0x171a('0xf3')]({'active':![],'countabandonedretry':_0x4e9e97['countabandonedretry'],'scheduledat':moment()[_0x171a('0xe2')](_0xdf8089[_0x171a('0x20')][_0x406e01[_0x171a('0xc3')]][_0x171a('0xf1')],_0x171a('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x552275[_0x171a('0xf4')],'ListId':_0x552275[_0x171a('0xe5')],'VoiceQueueId':_0x552275['VoiceQueueId']||undefined,'CampaignId':_0x552275[_0x171a('0xe7')]||undefined})[_0x171a('0xa2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x383222=new History(_0x4e9e97);_0x383222['state']=0xb;_0x383222[_0x171a('0x73')]='Abandoned';_0x383222[_0x171a('0x75')]=moment()[_0x171a('0x47')](_0x171a('0xcf'));_0x383222[_0x171a('0x74')]=_0x383222[_0x171a('0x75')];_0x383222['calleridname']=_0x4e9e97[_0x171a('0xe9')];_0x383222[_0x171a('0xf5')]=_0x4e9e97[_0x171a('0xf5')];hopperUtils['createHistory'](_0x383222)[_0x171a('0xa2')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x171a('0x42')](function(){if(_0x52b1eb)hopperUtils[_0x171a('0xeb')](_0x4e9e97,_0x8d0a2f,_0x5b36eb)['then'](function(){return 0x1;});});}}}};Dialer[_0x171a('0x1c')]['syncNewExten']=function(_0x57c820){if(this['actions'][_0x57c820[_0x171a('0xc4')]]){this[_0x171a('0x26')][_0x57c820[_0x171a('0xc4')]][_0x171a('0xf6')]=_0x57c820[_0x171a('0xf6')];}if(this[_0x171a('0xc8')][_0x57c820['uniqueid']]){this[_0x171a('0xc8')][_0x57c820[_0x171a('0xc4')]][_0x171a('0xf6')]=_0x57c820[_0x171a('0xf6')];}};Dialer['prototype'][_0x171a('0x3c')]=function(_0x2f5a92){if(!this[_0x171a('0x26')][_0x2f5a92['actionid']]){return;}var _0x186e32=this[_0x171a('0x20')][this['actions'][_0x2f5a92[_0x171a('0xf7')]][_0x171a('0xc3')]][_0x171a('0xf8')]||_0x171a('0xf9');if(_0x186e32===_0x171a('0xfa')){if(this[_0x171a('0x26')][_0x2f5a92[_0x171a('0xf7')]]&&_[_0x171a('0xfb')](this[_0x171a('0x26')][_0x2f5a92['actionid']]['locked'])&&_0x2f5a92['status']==='1'&&_0x2f5a92[_0x171a('0xfc')]==='0'){if(this[_0x171a('0x22')][_0x2f5a92[_0x171a('0xfd')]]){if(!this[_0x171a('0x22')][_0x2f5a92[_0x171a('0xfd')]]['locked']){this[_0x171a('0x22')][_0x2f5a92[_0x171a('0xfd')]]['locked']=!![];this[_0x171a('0x26')][_0x2f5a92['actionid']][_0x171a('0xfe')]=!![];this[_0x171a('0x26')][_0x2f5a92['actionid']][_0x171a('0xfd')]=_0x2f5a92['stateinterface'];}}}}else if(_0x186e32===_0x171a('0xf9')){if(this[_0x171a('0x26')][_0x2f5a92['actionid']]){if(this[_0x171a('0x22')][_0x2f5a92[_0x171a('0xfd')]]){this[_0x171a('0x26')][_0x2f5a92[_0x171a('0xf7')]][_0x171a('0xfd')]=_0x2f5a92[_0x171a('0xfd')];if(_[_0x171a('0xfb')](this['queueBooked'][this[_0x171a('0x26')][_0x2f5a92[_0x171a('0xf7')]][_0x171a('0xc3')]])){this['queueBooked'][this[_0x171a('0x26')][_0x2f5a92[_0x171a('0xf7')]][_0x171a('0xc3')]]=[];}this[_0x171a('0x2a')][this['actions'][_0x2f5a92[_0x171a('0xf7')]][_0x171a('0xc3')]][_0x171a('0xa3')](_[_0x171a('0x63')](_[_0x171a('0x7a')](this[_0x171a('0x26')][_0x2f5a92[_0x171a('0xf7')]],['idHopper',_0x171a('0xfd')]),{'status':_0x2f5a92[_0x171a('0x8a')],'paused':_0x2f5a92[_0x171a('0xfc')]}));}}}};Dialer[_0x171a('0x1c')][_0x171a('0x3e')]=function(_0x1a24fe){if(!this[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]]){return;}var _0x10a80f=this;var _0xeeec37=this['voiceQueues'][this[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]][_0x171a('0xc3')]];var _0x570839=_0xeeec37['strategy']||'rrmemory';if(_0x570839==='roundrobin'){if(this[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]]&&this[_0x171a('0x26')][_0x1a24fe['actionid']][_0x171a('0xfd')]){this['preview'][_0x171a('0xff')](this[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]][_0x171a('0x100')],this[_0x171a('0x26')][_0x1a24fe['actionid']][_0x171a('0xfd')])['catch'](function(_0x295e07){logger[_0x171a('0x69')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x171a('0x46')](_0x295e07,{'showHidden':![],'depth':null}));})[_0x171a('0x101')](function(){utils[_0x171a('0xc6')](_0x10a80f[_0x171a('0x20')][_0x10a80f[_0x171a('0x26')][_0x1a24fe['actionid']][_0x171a('0xc3')]],_0x171a('0x102'));_0x10a80f[_0x171a('0x22')][_0x10a80f['actions'][_0x1a24fe[_0x171a('0xf7')]][_0x171a('0xfd')]]['locked']=![];delete _0x10a80f['actions'][_0x1a24fe[_0x171a('0xf7')]];unlockQueueStatus(_0xeeec37);});}else{utils[_0x171a('0xc6')](this[_0x171a('0x20')][this[_0x171a('0x26')][_0x1a24fe['actionid']][_0x171a('0xc3')]],_0x171a('0x102'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]]['ContactId'],'ListId':this['actions'][_0x1a24fe[_0x171a('0xf7')]][_0x171a('0xe5')],'VoiceQueueId':this['actions'][_0x1a24fe['actionid']][_0x171a('0xe6')]||undefined,'CampaignId':this['actions'][_0x1a24fe['actionid']]['CampaignId']||undefined})[_0x171a('0xa2')](loggerCatch(_0x171a('0x103')));delete this[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]];unlockQueueStatus(_0xeeec37);}}else if(_0x570839===_0x171a('0xf9')){var _0x40c576;if(this[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]]&&!_[_0x171a('0x4b')](this[_0x171a('0x2a')][this[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]][_0x171a('0xc3')]])){if(this['queueBookedRR'][_0x10a80f[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]][_0x171a('0xc3')]]){this[_0x171a('0x2b')][_0x10a80f[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]][_0x171a('0xc3')]]=this[_0x171a('0x2b')][this[_0x171a('0x26')][_0x1a24fe[_0x171a('0xf7')]]['queue']]?this[_0x171a('0x2b')][this['actions'][_0x1a24fe[_0x171a('0xf7')]]['queue']]:this['queueBooked'][this[_0x171a('0x26')][_0x1a24fe['actionid']][_0x171a('0xc3')]]?this[_0x171a('0x2a')][this['actions'][_0x1a24fe[_0x171a('0xf7')]][_0x171a('0xc3')]][_0x171a('0x104')]||0x0:0x0;}this[_0x171a('0x2a')][this['actions'][_0x1a24fe[_0x171a('0xf7')]][_0x171a('0xc3')]][_0x171a('0x104')]=this['queueBookedRR'][this[_0x171a('0x26')][_0x1a24fe['actionid']][_0x171a('0xc3')]];for(var _0x5d47f4=0x0;_0x5d47f4=_0x3e5f1a[_0x171a('0x12a')]){_0x317fee['stateGlobal'](_0x31a2e,_0xec9194,_0x535554,_0x171a('0x12b'));}else{if(_0x31a2e[_0x171a('0x123')]>=_0x3e5f1a[_0x171a('0x12c')]){_0x317fee[_0x171a('0x12d')](_0x31a2e,_0xec9194,_0x535554,_0x171a('0x12e'));}else{hopperUtils[_0x171a('0xf3')]({'active':![],'countmachineretry':_0x31a2e[_0x171a('0x123')],'scheduledat':moment()[_0x171a('0xe2')](_0x3e5f1a[_0x171a('0x12f')],_0x171a('0xe4'))[_0x171a('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x31a2e[_0x171a('0xf4')],'ListId':_0x31a2e[_0x171a('0xe5')],'VoiceQueueId':_0x31a2e[_0x171a('0xe6')]||undefined,'CampaignId':_0x31a2e[_0x171a('0xe7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0xec9194({'reschedule':0x1});}}});}if(_0x118112['type']==='ivr'&&this['campaigns'][_0x118112[_0x171a('0xc3')]][_0x171a('0x115')]&&_0x17624c[_0x171a('0x116')]===_0x171a('0x117')){delete this[_0x171a('0xc8')][_0x17624c[_0x171a('0xc4')]];utils['decrementOriginate'](this[_0x171a('0x21')][_0x118112[_0x171a('0xc3')]],'[syncVarSet]');_0x387a64=new Hangup(_0x118112,_0x17624c);_0x387a64[_0x171a('0x72')]=0x12;_0x387a64[_0x171a('0x73')]=_0x171a('0x119');_0x387a64[_0x171a('0x11a')]=_0x171a('0x11b');ami['emit'](_0x171a('0x130'),ut[_0x171a('0x11d')](_0x387a64,_0x171a('0x11e')));this[_0x171a('0x11f')](_0x387a64,_0x171a('0x131'),_0x171a('0x132'));}if(_0x118112[_0x171a('0x43')]===_0x171a('0xc5')&&this['campaigns'][_0x118112[_0x171a('0xc3')]][_0x171a('0x115')]&&_0x17624c['value']===_0x171a('0x133')){return new Promise(function(_0x22704e,_0x3ea510){delete _0x317fee[_0x171a('0xc8')][_0x17624c[_0x171a('0xc4')]];utils[_0x171a('0xc6')](_0x317fee['campaigns'][_0x118112[_0x171a('0xc3')]],'[syncVarSet]');_0x317fee[_0x171a('0x21')][_0x118112[_0x171a('0xc3')]][_0x171a('0xca')]+=0x1;_0x317fee[_0x171a('0x21')][_0x118112[_0x171a('0xc3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3d1e86=_0x317fee[_0x171a('0x21')][_0x118112[_0x171a('0xc3')]];var _0x1e482d=new Hangup(_0x118112,_0x17624c);_0x1e482d[_0x171a('0x72')]=0x13;_0x1e482d[_0x171a('0x73')]=_0x171a('0x122');_0x1e482d[_0x171a('0x11a')]=_0x171a('0x11b');_0x1e482d[_0x171a('0x123')]+=0x1;_0x1e482d[_0x171a('0xdc')]+=0x1;_0x1e482d[_0x171a('0x11e')]=!![];ami[_0x171a('0x11c')](_0x171a('0x130'),ut[_0x171a('0x11d')](_0x1e482d,_0x171a('0x11e')));hopperUtils[_0x171a('0xd0')](_0x1e482d)[_0x171a('0xa2')](loggerCatch(_0x171a('0x124')));if(_0x1e482d[_0x171a('0x125')]+_0x1e482d['countcongestionretry']+_0x1e482d[_0x171a('0x127')]+_0x1e482d['countnosuchnumberretry']+_0x1e482d['countdropretry']+_0x1e482d[_0x171a('0xf0')]+_0x1e482d[_0x171a('0x123')]+_0x1e482d[_0x171a('0x129')]>=_0x3d1e86[_0x171a('0x12a')]){_0x317fee[_0x171a('0x134')](_0x1e482d,_0x22704e,_0x3ea510,_0x171a('0x12b'));}else{if(_0x1e482d[_0x171a('0x123')]>=_0x3d1e86[_0x171a('0x12c')]){_0x317fee['createStateFinal'](_0x1e482d,_0x22704e,_0x3ea510,_0x171a('0x12e'));}else{hopperUtils[_0x171a('0xf3')]({'active':![],'countmachineretry':_0x1e482d[_0x171a('0x123')],'scheduledat':moment()['add'](_0x3d1e86[_0x171a('0x12f')],_0x171a('0xe4'))['format'](_0x171a('0xcf')),'ContactId':_0x1e482d['ContactId'],'ListId':_0x1e482d['ListId'],'VoiceQueueId':_0x1e482d['VoiceQueueId']||undefined,'CampaignId':_0x1e482d[_0x171a('0xe7')]||undefined})[_0x171a('0xa2')](loggerCatch(_0x171a('0x135')));_0x22704e({'reschedule':0x1});}}});}}};Dialer[_0x171a('0x1c')][_0x171a('0x136')]=function(_0x46fa19){var _0xe3fc29=this[_0x171a('0xc8')][_0x46fa19[_0x171a('0xc4')]];var _0x52b8b6;if(!_0xe3fc29){return;}if(_0xe3fc29[_0x171a('0x43')]===_0x171a('0xc5')){delete this['uniqueId'][_0x46fa19['uniqueid']];utils[_0x171a('0xc6')](this['campaigns'][_0xe3fc29['queue']],_0x171a('0x137'));this[_0x171a('0x21')][_0xe3fc29['queue']][_0x171a('0x138')]+=0x1;if(_0x46fa19[_0x171a('0x139')]===_0x171a('0x13a')){const _0xaad4ee=new AgentComplete(_0xe3fc29,_0x46fa19);_0xaad4ee[_0x171a('0xe7')]=this[_0x171a('0x21')][_0xe3fc29['queue']]['id'];hopperUtils['createHistory'](_0xaad4ee)[_0x171a('0xa2')](loggerCatch(_0x171a('0x13b')));hopperUtils[_0x171a('0x13c')](_0xaad4ee)[_0x171a('0xa2')](loggerCatch(_0x171a('0x13d')));}else{_0x52b8b6=new Hangup(_0xe3fc29,_0x46fa19);hopperUtils[_0x171a('0xd0')](_0x52b8b6)[_0x171a('0xa2')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x171a('0x13c')](_0x52b8b6)[_0x171a('0xa2')](loggerCatch(_0x171a('0x13e')));}}else{if(isNotNull(this['voiceQueues'][_0xe3fc29['queue']]['dialQueueProject'])){delete this[_0x171a('0xc8')][_0x46fa19['uniqueid']];utils['decrementOriginate'](this[_0x171a('0x20')][_0xe3fc29[_0x171a('0xc3')]],_0x171a('0x137'));this[_0x171a('0x20')][_0xe3fc29[_0x171a('0xc3')]][_0x171a('0xca')]+=0x1;this[_0x171a('0x20')][_0xe3fc29['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x52b8b6=new Hangup(_0xe3fc29,_0x46fa19);_0x52b8b6[_0x171a('0x72')]=0x10;_0x52b8b6[_0x171a('0x73')]=_0x171a('0x13f');_0x52b8b6['membername']=_0x171a('0x140');hopperUtils[_0x171a('0xd0')](_0x52b8b6)[_0x171a('0xa2')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x52b8b6)[_0x171a('0xa2')](loggerCatch(_0x171a('0x13e')));}else{delete this['uniqueId'][_0x46fa19['uniqueid']];utils[_0x171a('0xc6')](this[_0x171a('0x20')][_0xe3fc29[_0x171a('0xc3')]],_0x171a('0x141'));if(_0x46fa19[_0x171a('0x139')]===_0x171a('0x13a')){this[_0x171a('0x20')][_0xe3fc29[_0x171a('0xc3')]][_0x171a('0xca')]+=0x1;const _0x22ce3a=new AgentComplete(_0xe3fc29,_0x46fa19);_0x22ce3a['VoiceQueueId']=this['voiceQueues'][_0xe3fc29[_0x171a('0xc3')]]['id'];hopperUtils[_0x171a('0xd0')](_0x22ce3a)[_0x171a('0xa2')](loggerCatch(_0x171a('0x142')));hopperUtils['moveContactManagedDialer'](_0x22ce3a)[_0x171a('0xa2')](loggerCatch(_0x171a('0xd1')));}else{this[_0x171a('0x20')][_0xe3fc29[_0x171a('0xc3')]][_0x171a('0x143')]+=0x1;_0x52b8b6=new Hangup(_0xe3fc29,_0x46fa19);_0x52b8b6[_0x171a('0x72')]=0xc;_0x52b8b6[_0x171a('0x73')]=_0x46fa19[_0x171a('0x139')];_0x52b8b6[_0x171a('0x11a')]=_0x171a('0x144');hopperUtils[_0x171a('0xd0')](_0x52b8b6)[_0x171a('0xa2')](loggerCatch(_0x171a('0x145')));hopperUtils['moveContactManagedDialer'](_0x52b8b6)['catch'](loggerCatch(_0x171a('0x137')));}}}};Dialer['prototype'][_0x171a('0xc')]=function(_0x48ca10){var _0x160555=this;if(!_0x160555['queuesSummary'][_0x48ca10[_0x171a('0x49')]]){_0x160555[_0x171a('0x2c')][_0x48ca10['name']]={'running':![]};}else if(_0x160555[_0x171a('0x2c')][_0x48ca10[_0x171a('0x49')]][_0x171a('0x146')]===!![]){return;}else if(_0x160555[_0x171a('0x2c')][_0x48ca10['name']]['running']===![]){_0x160555[_0x171a('0x2c')][_0x48ca10[_0x171a('0x49')]][_0x171a('0x146')]=!![];}var _0x2d0d07=_0x160555[_0x171a('0x20')][_0x48ca10[_0x171a('0x49')]];var _0x9b52df=_0x2d0d07[_0x171a('0x6c')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x2bbadb=utils[_0x171a('0x147')](_0x2d0d07);_0x2d0d07[_0x171a('0x148')]=utils[_0x171a('0x149')](_0x2d0d07,_0x160555[_0x171a('0x23')]);Promise[_0x171a('0x14a')]()['then'](function(){if(_0x2d0d07[_0x171a('0x148')]===utils[_0x171a('0x6f')][_0x171a('0x14b')]){if(_0x9b52df){clearPredictiveAttributes(_0x2d0d07);_0x48ca10[_0x171a('0x14c')]=undefined;_0x48ca10[_0x171a('0x65')]=undefined;}if(_0x2d0d07['statusMessage']===utils[_0x171a('0x6f')]['INACTIVE']){_0x48ca10[_0x171a('0x14d')]=0x0;_0x48ca10[_0x171a('0xfc')]=0x0;_0x48ca10['inUse']=0x0;_0x48ca10[_0x171a('0x14e')]=0x0;_0x48ca10[_0x171a('0x14f')]=0x0;}}else if(_0x2d0d07[_0x171a('0x148')]===utils[_0x171a('0x6f')][_0x171a('0x150')]&&!_0x2bbadb){return _0x160555[_0x171a('0x93')](_0x2d0d07,!![])[_0x171a('0x42')](function(){return _0x160555[_0x171a('0x93')](_0x2d0d07,![]);})['then'](function(){return _0x160555[_0x171a('0xb4')](_0x2d0d07);})[_0x171a('0xa2')](function(_0x522705){loggerSyncQueueSummary[_0x171a('0x66')](_0x171a('0x151'),util[_0x171a('0x46')](_0x522705,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2d0d07);});}else{clearPredictiveAttributes(_0x2d0d07);}})[_0x171a('0x42')](function(){var _0x3e3217=_0x48ca10[_0x171a('0x152')](_0x2d0d07);if(_0x3e3217||_0x2d0d07[_0x171a('0x153')]){_0x2d0d07[_0x171a('0x153')]=![];_0x48ca10[_0x171a('0x154')](_0x2d0d07);Object[_0x171a('0x155')](_0x2d0d07,_0x48ca10);emitOutboundVoiceQueueSummary(_0x48ca10);}_0x160555[_0x171a('0x2c')][_0x2d0d07['name']][_0x171a('0x146')]=![];})[_0x171a('0xa2')](function(_0x49e574){logger[_0x171a('0x69')]('[syncQueueSummary]',util[_0x171a('0x46')](_0x49e574,{'showHidden':![],'depth':null}));_0x160555[_0x171a('0x2c')][_0x2d0d07[_0x171a('0x49')]][_0x171a('0x146')]=![];});};Dialer[_0x171a('0x1c')]['syncQueueSummaryComplete']=_[_0x171a('0x156')](function(){var _0x4befed=_[_0x171a('0x157')](this[_0x171a('0x20')],function(_0x10e973){return _0x10e973['dialPreviewRecallmeReminder'];});var _0x62c658=_[_0x171a('0x157')](this[_0x171a('0x22')],function(_0x17c122){return _0x17c122[_0x171a('0x158')]&&_0x17c122[_0x171a('0x8a')]===_0x171a('0x8b');});if(_0x4befed[_0x171a('0x9b')]>0x0&&_0x62c658['length']>0x0){return Promise[_0x171a('0x14a')]()[_0x171a('0x42')](cmHopper[_0x171a('0x159')](_[_0x171a('0x15a')](_0x4befed,'id'),previewRecallmeReminderInterval,_[_0x171a('0x15a')](_0x62c658,'id')))[_0x171a('0x42')](function(_0x5cd387){for(var _0x23dbe0=0x0;_0x23dbe0<_0x5cd387['length'];_0x23dbe0++){var _0x264352=_0x5cd387[_0x23dbe0]['Agent']['name'];if(_0x264352)io['to'](util[_0x171a('0x47')](_0x171a('0x15b'),_0x264352))[_0x171a('0x11c')](_0x171a('0x15c'),{'hopper':_0x5cd387[_0x23dbe0]});}})['catch'](function(_0x4553ea){logger[_0x171a('0x69')](_0x171a('0x15d'),_0x4553ea);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x171a('0x1c')][_0x171a('0x40')]=function(){var _0x4fbe88=this;setInterval(function(){_0x4fbe88[_0x171a('0x15e')](_0x4fbe88['uniqueId'],_0x171a('0x15f'));_0x4fbe88[_0x171a('0x15e')](_0x4fbe88['actions'],_0x171a('0x160'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x31ca4e,_0x3dc431){var _0x41ed28=this;for(var _0x7c82fa in _0x31ca4e){if(typeof _0x31ca4e[_0x7c82fa]!==_0x171a('0xae')){this['sequence']['enqueue'](function(){if(!_[_0x171a('0xfb')](_0x31ca4e[_0x7c82fa])){return ami[_0x171a('0x9c')]({'action':_0x171a('0x8a'),'channel':_0x31ca4e[_0x7c82fa]['channel']})['catch'](function(_0xa890fc){if(_0xa890fc[_0x171a('0x6c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x31ca4e[_0x7c82fa]&&_0x31ca4e[_0x7c82fa][_0x171a('0x43')]!==_0x171a('0xc5')){utils[_0x171a('0xc6')](_0x41ed28[_0x171a('0x20')][_0x31ca4e[_0x7c82fa][_0x171a('0xc3')]],_0x171a('0x161'));logger[_0x171a('0x69')]('[Dialer][checkChannel]',_0x3dc431,_0x7c82fa,_0x31ca4e[_0x7c82fa]['queue']);delete _0x31ca4e[_0x7c82fa];}if(_0x31ca4e[_0x7c82fa]&&_0x31ca4e[_0x7c82fa][_0x171a('0x43')]===_0x171a('0xc5')){utils['decrementOriginate'](_0x41ed28[_0x171a('0x21')][_0x31ca4e[_0x7c82fa][_0x171a('0xc3')]],'[clearZombieChannels]');logger[_0x171a('0x69')](_0x171a('0x162'),_0x3dc431,_0x7c82fa,_0x31ca4e[_0x7c82fa][_0x171a('0xc3')]);delete _0x31ca4e[_0x7c82fa];}},0x2328);}});}});}}};Dialer['prototype'][_0x171a('0x163')]=function(_0x3b870e){return Promise[_0x171a('0x14a')]()[_0x171a('0x42')](voiceQueueRt[_0x171a('0x163')](_0x3b870e))[_0x171a('0xa2')](loggerCatch(_0x171a('0x164')));};Dialer[_0x171a('0x1c')][_0x171a('0x165')]=function(_0x4cd9d5,_0x4356c3,_0x2e7168){var _0x2721e4={'state':0x19,'statedesc':_0x171a('0x166')};utils[_0x171a('0xc6')](_0x4356c3,_0x171a('0x167')+_0x4cd9d5);this[_0x171a('0x11f')](_[_0x171a('0x63')](_0x2721e4,_[_0x171a('0x7a')](_0x2e7168,[_0x171a('0xf4'),'ListId',_0x171a('0x168'),_0x171a('0xe6'),_0x171a('0xe7')])),_0x171a('0x169'),_0x171a('0x167'));logger[_0x171a('0x69')](_0x4cd9d5);};Dialer[_0x171a('0x1c')][_0x171a('0x11f')]=function(_0x4ec2c0,_0x379886,_0x38edc7){hopperUtils[_0x171a('0xd0')](_0x4ec2c0)['catch'](loggerCatch(_0x379886));hopperUtils[_0x171a('0x13c')](_0x4ec2c0)[_0x171a('0xa2')](loggerCatch(_0x38edc7));};Dialer[_0x171a('0x1c')][_0x171a('0xe1')]=function(_0x4a30f3,_0x4a872d){hopperUtils['createHistory'](_0x4a30f3)['catch'](loggerCatch(_0x171a('0x142')));if(_0x4a872d==0x0){hopperUtils[_0x171a('0x13c')](_0x4a30f3)[_0x171a('0xa2')](loggerCatch(_0x171a('0x16a')));}};Dialer[_0x171a('0x1c')][_0x171a('0x15d')]=function(_0x531495){return Promise[_0x171a('0x14a')]()[_0x171a('0x42')](cmHopper['handlePreviewRecallNotifications'](_0x531495['id'],previewRecallmeReminderInterval))[_0x171a('0x42')](function(_0x195dc2){for(var _0x1fda31=0x0;_0x1fda31<_0x195dc2[_0x171a('0x9b')];_0x1fda31++){var _0x36966c=_0x195dc2[_0x1fda31][_0x171a('0x16b')][_0x171a('0x49')];if(_0x36966c)io['to'](util[_0x171a('0x47')](_0x171a('0x15b'),_0x36966c))[_0x171a('0x11c')](_0x171a('0x15c'),{'hopper':_0x195dc2[_0x1fda31]});}})[_0x171a('0xa2')](function(){});};Dialer[_0x171a('0x1c')][_0x171a('0xb2')]=function(_0x1c54a0){var _0x2f42fe=this;return function(){_0x2f42fe[_0x171a('0x16c')](_0x1c54a0);};};Dialer[_0x171a('0x1c')][_0x171a('0x16d')]=function(_0x69e2ce,_0x14655a){var _0x59fe50=this;var _0x1499e4=uuid['v4']();this[_0x171a('0x26')][_0x1499e4]=new Action(_0x69e2ce,_0x14655a,_0x1499e4);return new Promise(function(_0x70f34,_0x29678d){if(_[_0x171a('0x57')](_0x69e2ce)&&typeof _0x69e2ce!==_0x171a('0x16e')){return _0x29678d(msgResponse(_0x171a('0x16f'),'Failure',_0x171a('0x170')));}if(_[_0x171a('0x57')](_0x14655a[_0x171a('0x171')])||_0x14655a[_0x171a('0x171')]===null){return _0x29678d(msgResponse(_0x171a('0x16f'),_0x171a('0x94'),_0x171a('0x172')));}var _0x120bc4={'XMD-CALLERID':_0x59fe50[_0x171a('0x26')][_0x1499e4]['getCaller'](),'XMD-AGI':_0x69e2ce[_0x171a('0x173')]?util[_0x171a('0x47')]('\x22agi://%s/square,%s\x22',ipAgi,_0x69e2ce[_0x171a('0x173')]):_0x171a('0x174'),'XMD-AGIAFTER':_0x69e2ce[_0x171a('0xcd')]?util[_0x171a('0x47')](_0x171a('0x175'),ipAgi,_0x69e2ce['dialQueueProject2']):'NONE','XMD-QUEUE':utils[_0x171a('0x176')](_0x69e2ce)?util[_0x171a('0x47')](_0x171a('0x177'),_0x69e2ce[_0x171a('0x49')],_0x69e2ce[_0x171a('0x178')]||'',_0x69e2ce[_0x171a('0xce')]?'c':'',_0x69e2ce[_0x171a('0xd6')]||0x3):'NONE','XMD-CONTACTID':_0x14655a[_0x171a('0xf4')],'XMD-CDRTYPE':_0x171a('0x8'),'CALLERID(all)':_0x59fe50[_0x171a('0x26')][_0x1499e4][_0x171a('0x179')](),'XMD-AMD':_0x69e2ce[_0x171a('0x115')]?'ACTIVE':_0x171a('0x174'),'XMD-DESTINATION':_0x171a('0x17a')};if(_0x69e2ce[_0x171a('0x115')]){_0x120bc4[_0x171a('0x17b')]=_0x69e2ce[_0x171a('0x17c')]||0x9c4;_0x120bc4[_0x171a('0x17d')]=_0x69e2ce[_0x171a('0x17e')]||0x5dc;_0x120bc4[_0x171a('0x17f')]=_0x69e2ce['dialAMDAfterGreetingSilence']||0x320;_0x120bc4[_0x171a('0x180')]=_0x69e2ce[_0x171a('0x181')]||0x1388;_0x120bc4[_0x171a('0x182')]=_0x69e2ce['dialAMDMinWordLength']||0x64;_0x120bc4[_0x171a('0x183')]=_0x69e2ce['dialAMDBetweenWordsSilence']||0x32;_0x120bc4[_0x171a('0x184')]=_0x69e2ce[_0x171a('0x185')]||0x3;_0x120bc4[_0x171a('0x186')]=_0x69e2ce[_0x171a('0x187')]||0x100;_0x120bc4[_0x171a('0x188')]=_0x69e2ce[_0x171a('0x189')]||0x1388;}if(utils[_0x171a('0x176')](_0x69e2ce)){_0x120bc4[_0x171a('0x18a')]=_0x14655a[_0x171a('0xe6')];}else{_0x120bc4[_0x171a('0x18b')]=_0x14655a['CampaignId'];}var _0xf0ef9e=utils['setXMDContactVariables'](_0x14655a[_0x171a('0x18c')]);Object[_0x171a('0x155')](_0x120bc4,_0xf0ef9e);var _0x61e42=_0x59fe50[_0x171a('0x8e')](_0x69e2ce[_0x171a('0x8f')])?utils[_0x171a('0x18d')](_0x69e2ce['Trunk'][_0x171a('0x18e')],_0x69e2ce['dialOriginateCallerIdName'],_0x69e2ce[_0x171a('0x18f')]>0x0?utils[_0x171a('0x190')](_0x69e2ce['dialOriginateCallerIdNumber'],_0x69e2ce[_0x171a('0x18f')]):_0x69e2ce[_0x171a('0x191')]):utils[_0x171a('0x18d')](_[_0x171a('0xfb')](_0x69e2ce[_0x171a('0x90')])?_0x69e2ce[_0x171a('0x8f')]['callerid']:_0x69e2ce[_0x171a('0x90')]['callerid'],_0x69e2ce[_0x171a('0x192')],_0x69e2ce[_0x171a('0x18f')]>0x0?utils[_0x171a('0x190')](_0x69e2ce[_0x171a('0x191')],_0x69e2ce[_0x171a('0x18f')]):_0x69e2ce[_0x171a('0x191')]);if(_0x61e42){_0x120bc4['XMD-ORIGINATECALLERIDNAME']=_0x59fe50['actions'][_0x1499e4][_0x171a('0x193')]=utils[_0x171a('0x194')](_0x61e42);_0x120bc4[_0x171a('0x195')]=_0x14655a['phone'];}_0x69e2ce[_0x171a('0x196')]=_0x120bc4;return ami['Action']({'actionid':_0x1499e4,'action':_0x171a('0x16f'),'channel':_0x59fe50[_0x171a('0x8e')](_0x69e2ce[_0x171a('0x8f')])?util[_0x171a('0x47')](_0x171a('0x197'),_0x69e2ce[_0x171a('0x8f')]['name'],isNotNull(_0x69e2ce['dialPrefix'])?_0x69e2ce['dialPrefix'][_0x171a('0x198')]()||'':'',_0x69e2ce[_0x171a('0x199')]>0x0?_0x14655a[_0x171a('0x171')][_0x171a('0x19a')](_0x69e2ce['dialCutDigit']):_0x14655a[_0x171a('0x171')]):util[_0x171a('0x47')](_0x171a('0x197'),_[_0x171a('0xfb')](_0x69e2ce[_0x171a('0x90')])?_0x69e2ce[_0x171a('0x8f')][_0x171a('0x49')]:_0x69e2ce[_0x171a('0x90')][_0x171a('0x49')],isNotNull(_0x69e2ce[_0x171a('0x19b')])?_0x69e2ce[_0x171a('0x19b')]['trim']()||'':'',_0x69e2ce[_0x171a('0x199')]>0x0?_0x14655a[_0x171a('0x171')][_0x171a('0x19a')](_0x69e2ce[_0x171a('0x199')]):_0x14655a[_0x171a('0x171')]),'callerid':_0x61e42,'Exten':'xcally-motion-dialer','Context':_0x171a('0x19c'),'Priority':'1','variable':_0x120bc4,'timeout':(_0x69e2ce[_0x171a('0x19d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1499e4})[_0x171a('0x42')](function(_0x377d4b){return _0x70f34(_0x377d4b);})[_0x171a('0xa2')](function(_0x4e1ccf){_0x69e2ce[_0x171a('0x19e')]+=0x1;var _0x6ffef5=new History(_0x59fe50['actions'][_0x1499e4]);logger[_0x171a('0x69')](util['format'](_0x171a('0x19f'),JSON[_0x171a('0x79')](_0x4e1ccf)));_0x6ffef5[_0x171a('0x72')]=0xe;_0x6ffef5['statedesc']=_0x171a('0x1a0');_0x6ffef5[_0x171a('0x75')]=moment()[_0x171a('0x47')](_0x171a('0xcf'));_0x6ffef5[_0x171a('0x74')]=_0x6ffef5[_0x171a('0x75')];hopperUtils['createHistory'](_0x6ffef5)['catch'](loggerCatch(_0x171a('0x1a1')));_0x59fe50[_0x171a('0x13c')](_0x6ffef5)[_0x171a('0xa2')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x59fe50['actions'][_0x1499e4];return _0x29678d(msgResponse(_0x171a('0x16f'),_0x171a('0x87'),_0x171a('0x1a2')));});});});};Dialer['prototype'][_0x171a('0x1a3')]=function(_0x56adc1,_0x755f1c,_0x2189f5){var _0x2596a2=new History(_0x755f1c);if(_0x2596a2['countbusyretry']+_0x2596a2[_0x171a('0x126')]+_0x2596a2[_0x171a('0x127')]+_0x2596a2[_0x171a('0x128')]+_0x2596a2[_0x171a('0xdb')]+_0x2596a2[_0x171a('0xf0')]+_0x2596a2[_0x171a('0x123')]+_0x2596a2['countagentrejectretry']>=_0x2189f5[_0x171a('0x12a')]-0x1){return!![];}switch(_0x56adc1){case 0x3:if(_0x2596a2[_0x171a('0x127')]>=_0x2189f5['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2596a2[_0x171a('0x127')]+=0x1,'scheduledat':moment()['add'](_0x2189f5[_0x171a('0x1a4')],_0x171a('0xe4'))['format'](_0x171a('0xcf')),'ContactId':_0x2596a2['ContactId'],'ListId':_0x2596a2['ListId'],'VoiceQueueId':_0x2596a2[_0x171a('0xe6')]||undefined,'CampaignId':_0x2596a2[_0x171a('0xe7')]||undefined})[_0x171a('0xa2')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2596a2[_0x171a('0x125')]>=_0x2189f5[_0x171a('0x1a5')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x2596a2[_0x171a('0x125')]+=0x1,'scheduledat':moment()['add'](_0x2189f5['dialBusyRetryFrequency'],'minutes')[_0x171a('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2596a2[_0x171a('0xf4')],'ListId':_0x2596a2[_0x171a('0xe5')],'VoiceQueueId':_0x2596a2[_0x171a('0xe6')]||undefined,'CampaignId':_0x2596a2[_0x171a('0xe7')]||undefined})[_0x171a('0xa2')](loggerCatch(_0x171a('0x1a6')));break;case 0x8:if(_0x2596a2[_0x171a('0x126')]>=_0x2189f5[_0x171a('0x1a7')]-0x1){return!![];}hopperUtils[_0x171a('0xf3')]({'active':![],'countcongestionretry':_0x2596a2[_0x171a('0x126')]+=0x1,'scheduledat':moment()['add'](_0x2189f5[_0x171a('0x1a8')],_0x171a('0xe4'))[_0x171a('0x47')](_0x171a('0xcf')),'ContactId':_0x2596a2[_0x171a('0xf4')],'ListId':_0x2596a2[_0x171a('0xe5')],'VoiceQueueId':_0x2596a2[_0x171a('0xe6')]||undefined,'CampaignId':_0x2596a2[_0x171a('0xe7')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2596a2[_0x171a('0x128')]>=_0x2189f5[_0x171a('0x1a9')]-0x1){return!![];}else{hopperUtils[_0x171a('0xf3')]({'active':![],'countnosuchnumberretry':_0x2596a2['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x171a('0xe2')](_0x2189f5['dialNoSuchNumberRetryFrequency'],_0x171a('0xe4'))[_0x171a('0x47')](_0x171a('0xcf')),'ContactId':_0x2596a2[_0x171a('0xf4')],'ListId':_0x2596a2[_0x171a('0xe5')],'VoiceQueueId':_0x2596a2[_0x171a('0xe6')]||undefined,'CampaignId':_0x2596a2[_0x171a('0xe7')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2596a2[_0x171a('0xdb')]>=_0x2189f5[_0x171a('0xe0')]-0x1){return!![];}hopperUtils[_0x171a('0xf3')]({'active':![],'countdropretry':_0x2596a2['countdropretry']+=0x1,'scheduledat':moment()[_0x171a('0xe2')](_0x2189f5[_0x171a('0xe3')],_0x171a('0xe4'))[_0x171a('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2596a2[_0x171a('0xf4')],'ListId':_0x2596a2[_0x171a('0xe5')],'VoiceQueueId':_0x2596a2['VoiceQueueId']||undefined,'CampaignId':_0x2596a2[_0x171a('0xe7')]||undefined})[_0x171a('0xa2')](loggerCatch(_0x171a('0xe8')));break;case 0xb:if(_0x2596a2[_0x171a('0xf0')]>=_0x2189f5[_0x171a('0xf2')]-0x1){return!![];}hopperUtils[_0x171a('0xf3')]({'active':![],'countabandonedretry':_0x2596a2[_0x171a('0xf0')]+=0x1,'scheduledat':moment()[_0x171a('0xe2')](_0x2189f5[_0x171a('0xf1')],_0x171a('0xe4'))[_0x171a('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2596a2['ContactId'],'ListId':_0x2596a2[_0x171a('0xe5')],'VoiceQueueId':_0x2596a2['VoiceQueueId']||undefined,'CampaignId':_0x2596a2[_0x171a('0xe7')]||undefined})[_0x171a('0xa2')](loggerCatch(_0x171a('0x1aa')));break;case 0x13:if(_0x2596a2[_0x171a('0x123')]>=_0x2189f5[_0x171a('0x12c')]-0x1){return!![];}hopperUtils[_0x171a('0xf3')]({'active':![],'countmachineretry':_0x2596a2['countmachineretry']+=0x1,'scheduledat':moment()[_0x171a('0xe2')](_0x2189f5[_0x171a('0x12f')],_0x171a('0xe4'))[_0x171a('0x47')](_0x171a('0xcf')),'ContactId':_0x2596a2[_0x171a('0xf4')],'ListId':_0x2596a2[_0x171a('0xe5')],'VoiceQueueId':_0x2596a2[_0x171a('0xe6')]||undefined,'CampaignId':_0x2596a2['CampaignId']||undefined})[_0x171a('0xa2')](loggerCatch(_0x171a('0x135')));break;case 0x14:if(_0x2596a2[_0x171a('0x129')]>=_0x2189f5[_0x171a('0x1ab')]-0x1){return!![];}hopperUtils[_0x171a('0xf3')]({'active':![],'countagentrejectretry':_0x2596a2['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x171a('0xe2')](_0x2189f5[_0x171a('0x1ac')],_0x171a('0xe4'))[_0x171a('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2596a2[_0x171a('0xf4')],'ListId':_0x2596a2[_0x171a('0xe5')],'VoiceQueueId':_0x2596a2[_0x171a('0xe6')]||undefined,'CampaignId':_0x2596a2[_0x171a('0xe7')]||undefined})[_0x171a('0xa2')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x171a('0x1c')][_0x171a('0x1ad')]=function(_0x3fe572,_0x304b0c,_0x37b11e){var _0x5a46ee=this;var _0x47426f=new History(_0x3fe572);var _0x4102b8=![];var _0x45ff5d;var _0x2ea709;return new Promise(function(_0x3e499d,_0x8d513d){if(_['isUndefined'](_0x304b0c)&&typeof _0x304b0c!=='object'){return _0x8d513d(msgResponse(_0x171a('0x1ae'),_0x171a('0x94'),_0x171a('0x1af')));}if(_[_0x171a('0x57')](_0x37b11e)&&typeof _0x37b11e!=='object'){return _0x8d513d(msgResponse(_0x171a('0x1ae'),_0x171a('0x94'),_0x171a('0x1b0')));}hopperUtils['verifyAdditionalPhones'](_0x47426f,_0x37b11e['reason'],_0x304b0c)[_0x171a('0x42')](function(_0x26988c){if(_0x26988c[_0x171a('0xdf')]==0x1)_0x4102b8=!![];switch(_0x37b11e[_0x171a('0xcb')]){case'0':_0x304b0c[_0x171a('0x1b1')]+=0x1;_0x47426f[_0x171a('0x72')]=0x0;_0x47426f[_0x171a('0x73')]='NoSuchNumber';_0x47426f[_0x171a('0x128')]+=0x1;_0x47426f[_0x171a('0xdc')]+=0x1;ami[_0x171a('0x11c')]('custom:agentnosuchnumber',ut['buildObj'](_0x3fe572,_0x171a('0x1b2')));_0x45ff5d=_0x304b0c[_0x171a('0x1b3')];_0x2ea709=_0x304b0c[_0x171a('0x1b4')];hopperUtils['createHistory'](_0x47426f)[_0x171a('0xa2')](loggerCatch(_0x171a('0x124')));if(_0x5a46ee[_0x171a('0x1a3')](0x0,_0x3fe572,_0x304b0c)&&!_0x4102b8){if(_0x47426f[_0x171a('0x128')]>=_0x304b0c[_0x171a('0x1a9')]){_0x5a46ee[_0x171a('0x12d')](_0x47426f,_0x3e499d,_0x8d513d,_0x171a('0x1b5'));}else{_0x5a46ee[_0x171a('0x134')](_0x47426f,_0x3e499d,_0x8d513d,_0x171a('0x1b5'));}}break;case'3':_0x304b0c[_0x171a('0x1b6')]+=0x1;_0x47426f['state']=0x3;_0x47426f['statedesc']=_0x171a('0x1b7');_0x47426f[_0x171a('0x127')]+=0x1;_0x47426f[_0x171a('0xdc')]+=0x1;var _0x3bca81=ut[_0x171a('0x1b8')](_0x3fe572,_0x304b0c);ami['emit'](_0x171a('0x1b9'),_0x3bca81);_0x45ff5d=_0x304b0c[_0x171a('0x1a4')];_0x2ea709=_0x304b0c[_0x171a('0x1b4')];hopperUtils[_0x171a('0xd0')](_0x47426f)[_0x171a('0xa2')](loggerCatch(_0x171a('0x1ba')));if(_0x5a46ee[_0x171a('0x1a3')](0x3,_0x3fe572,_0x304b0c)&&!_0x4102b8){if(_0x47426f[_0x171a('0x127')]>=_0x304b0c['dialNoAnswerMaxRetry']){_0x5a46ee[_0x171a('0x12d')](_0x47426f,_0x3e499d,_0x8d513d,_0x171a('0x1bb'));}else{_0x5a46ee['stateGlobal'](_0x47426f,_0x3e499d,_0x8d513d,_0x171a('0x1bb'));}}break;case'5':_0x304b0c[_0x171a('0x1bc')]+=0x1;_0x47426f['state']=0x5;_0x47426f[_0x171a('0x73')]=_0x171a('0x1bd');_0x47426f[_0x171a('0x125')]+=0x1;_0x47426f['countglobal']+=0x1;ami['emit']('custom:agentbusy',ut[_0x171a('0x11d')](_0x3fe572,_0x171a('0x1be')));_0x45ff5d=_0x304b0c[_0x171a('0x1bf')];_0x2ea709=_0x304b0c[_0x171a('0x1b4')];hopperUtils[_0x171a('0xd0')](_0x47426f)[_0x171a('0xa2')](loggerCatch(_0x171a('0x1c0')));if(_0x5a46ee[_0x171a('0x1a3')](0x5,_0x3fe572,_0x304b0c)&&!_0x4102b8){if(_0x47426f[_0x171a('0x125')]>=_0x304b0c[_0x171a('0x1a5')]){_0x5a46ee['createStateFinal'](_0x47426f,_0x3e499d,_0x8d513d,_0x171a('0x1c1'));}else{_0x5a46ee[_0x171a('0x134')](_0x47426f,_0x3e499d,_0x8d513d,'reason\x205\x20busy');}}break;case'8':_0x304b0c[_0x171a('0x1c2')]+=0x1;_0x47426f['state']=0x8;_0x47426f[_0x171a('0x73')]=_0x171a('0x1c3');_0x47426f[_0x171a('0x126')]+=0x1;_0x47426f['countglobal']+=0x1;_0x45ff5d=_0x304b0c[_0x171a('0x1a8')];_0x2ea709=_0x304b0c['callAdditionalPhoneAfterMin'];ami[_0x171a('0x11c')]('custom:agentcongestion',ut[_0x171a('0x11d')](_0x3fe572,_0x171a('0x1c4')));hopperUtils['createHistory'](_0x47426f)[_0x171a('0xa2')](loggerCatch(_0x171a('0x1c5')));if(_0x5a46ee[_0x171a('0x1a3')](0x8,_0x3fe572,_0x304b0c)&&!_0x4102b8){if(_0x47426f[_0x171a('0x126')]>=_0x304b0c['dialCongestionMaxRetry']){_0x5a46ee[_0x171a('0x12d')](_0x47426f,_0x3e499d,_0x8d513d,'reason\x208\x20congestion');}else{_0x5a46ee[_0x171a('0x134')](_0x47426f,_0x3e499d,_0x8d513d,'reason\x208\x20congestion');}}break;case'11':_0x304b0c[_0x171a('0x1c6')]+=0x1;_0x47426f[_0x171a('0x72')]=0xb;_0x47426f[_0x171a('0x73')]=_0x171a('0xee');_0x47426f['countabandonedretry']+=0x1;_0x47426f[_0x171a('0xdc')]+=0x1;_0x45ff5d=_0x304b0c[_0x171a('0xf1')];_0x2ea709=_0x304b0c['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x47426f)[_0x171a('0xa2')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x5a46ee[_0x171a('0x1a3')](0xb,_0x3fe572,_0x304b0c)&&!_0x4102b8){if(_0x47426f[_0x171a('0xf0')]>=_0x304b0c[_0x171a('0xf2')]){_0x5a46ee[_0x171a('0x12d')](_0x47426f,_0x3e499d,_0x8d513d,'reason\x2011\x20abandoned');}else{_0x5a46ee[_0x171a('0x134')](_0x47426f,_0x3e499d,_0x8d513d,_0x171a('0x1c7'));}}break;case'20':_0x304b0c[_0x171a('0x1c8')]+=0x1;_0x47426f[_0x171a('0x72')]=0x14;_0x47426f[_0x171a('0x73')]=_0x171a('0x1c9');_0x47426f[_0x171a('0x129')]+=0x1;_0x47426f[_0x171a('0xdc')]+=0x1;_0x45ff5d=_0x304b0c[_0x171a('0x1ac')];_0x2ea709=_0x304b0c[_0x171a('0x1b4')];ami[_0x171a('0x11c')](_0x171a('0x1ca'),ut['buildObj'](_0x3fe572,_0x171a('0x1cb')));hopperUtils[_0x171a('0xd0')](_0x47426f)[_0x171a('0xa2')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5a46ee[_0x171a('0x1a3')](0x14,_0x3fe572,_0x304b0c)&&!_0x4102b8){if(_0x47426f[_0x171a('0x129')]>=_0x304b0c['dialAgentRejectMaxRetry']){_0x5a46ee['createStateFinal'](_0x47426f,_0x3e499d,_0x8d513d,_0x171a('0x1cc'));}else{_0x5a46ee['stateGlobal'](_0x47426f,_0x3e499d,_0x8d513d,_0x171a('0x1cc'));}}break;default:_0x304b0c['outboundUnknownCallsDay']+=0x1;_0x47426f[_0x171a('0x72')]=0xc;_0x47426f[_0x171a('0x73')]=_0x37b11e['reason'];_0x45ff5d=_0x304b0c[_0x171a('0x1ac')];_0x2ea709=_0x304b0c[_0x171a('0x1b4')];hopperUtils[_0x171a('0xd0')](_0x47426f)[_0x171a('0xa2')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x5a46ee[_0x171a('0x1a3')](_0x37b11e[_0x171a('0xcb')],_0x3fe572,_0x304b0c)&&!_0x4102b8){if(_0x47426f[_0x171a('0x125')]+_0x47426f[_0x171a('0x126')]+_0x47426f[_0x171a('0x127')]+_0x47426f[_0x171a('0x128')]+_0x47426f[_0x171a('0xdb')]+_0x47426f[_0x171a('0xf0')]+_0x47426f[_0x171a('0x123')]+_0x47426f[_0x171a('0x129')]>=_0x304b0c[_0x171a('0x12a')]){_0x5a46ee[_0x171a('0x134')](_0x47426f,_0x3e499d,_0x8d513d,_0x37b11e[_0x171a('0xcb')]);}else{_0x5a46ee[_0x171a('0x12d')](_0x47426f,_0x3e499d,_0x8d513d,_0x37b11e[_0x171a('0xcb')]);}}}})[_0x171a('0x42')](function(){if(_0x4102b8){hopperUtils[_0x171a('0xeb')](_0x47426f,_0x45ff5d,_0x2ea709)[_0x171a('0x42')](function(){return _0x3e499d(0x1);});}});});};Dialer[_0x171a('0x1c')][_0x171a('0x134')]=function(_0x5a5b0c,_0x2b268c,_0xb3180c,_0x23a362){var _0x539f00=new Final(_0x5a5b0c);_0x539f00[_0x171a('0x72')]=0xf;_0x539f00[_0x171a('0x73')]=_0x171a('0x1cd');this[_0x171a('0x12d')](_0x539f00,_0x2b268c,_0xb3180c,_0x23a362);};Dialer[_0x171a('0x1c')][_0x171a('0x12d')]=function(_0x58d735,_0x445719,_0x138ee0,_0x35dc0a){hopperUtils['moveContactManagedDialer'](_0x58d735)[_0x171a('0x42')](function(){return _0x445719(msgResponse(_0x171a('0x1ae'),_0x171a('0x110'),_0x35dc0a));})[_0x171a('0xa2')](function(){return _0x138ee0(msgResponse(_0x171a('0x1ce'),'Failure',_0x171a('0x1cf')));});};Dialer['prototype'][_0x171a('0xb6')]=function(_0x35dd90){var _0x1a844b=_0x35dd90[_0x171a('0x1d0')]/0x64;var _0x26cf5f=_0x35dd90[_0x171a('0xd7')]/(_0x35dd90[_0x171a('0xd7')]+_0x35dd90[_0x171a('0xca')]);var _0x98b199=Math['round'](_0x35dd90[_0x171a('0x1d1')]*(_0x35dd90[_0x171a('0x1d2')]/0x64));var _0x550938=Math[_0x171a('0x1d3')](_0x35dd90[_0x171a('0x1d1')]*(_0x35dd90[_0x171a('0x1d4')]/0x64));var _0x4f4434=_0x35dd90[_0x171a('0x14d')]+_0x35dd90['talking'];var _0xfaf901=Math[_0x171a('0x1d5')](_0x35dd90[_0x171a('0x5d')]*_0x35dd90[_0x171a('0x1d6')]*_0x35dd90[_0x171a('0x1d7')]*_0x35dd90[_0x171a('0x1d8')]);if(_[_0x171a('0x57')](_0x35dd90[_0x171a('0x65')])){if(!_[_0x171a('0x57')](_0x35dd90[_0x171a('0x14c')])){_0x35dd90[_0x171a('0x14c')]=undefined;loggerPredictive[_0x171a('0x69')](_0x171a('0x1d9'),_0x171a('0x1da'));}if(!_['isUndefined'](_0x35dd90[_0x171a('0x67')])){loggerPredictive[_0x171a('0x69')](_0x171a('0x1d9'),_0x171a('0x1db'));clearInterval(_0x35dd90[_0x171a('0x67')]);_0x35dd90['handlePredictive']=undefined;}_0x35dd90['startProgressive']=moment()[_0x171a('0x47')](_0x171a('0xcf'));loggerPredictive['info'](_0x35dd90[_0x171a('0x49')],_0x171a('0x1dc'),_0x35dd90[_0x171a('0x65')]);this[_0x171a('0xb8')](_0x35dd90,0x1);}else if(ifInterval(_0x35dd90['dialPredictiveInterval'],_0x35dd90[_0x171a('0x65')])){this[_0x171a('0xb8')](_0x35dd90,0x1);loggerPredictiveCalls[_0x171a('0x4c')](_0x171a('0x1dd'),_0x35dd90[_0x171a('0x65')],_0x35dd90[_0x171a('0x49')]);_0x35dd90[_0x171a('0x5d')]=0x0;_0x35dd90[_0x171a('0xd8')]=0x0;}else if(_0x1a844b<_0x26cf5f&&_0x35dd90[_0x171a('0x1de')]===_0x171a('0x1df')){clearPredictiveAttributes(_0x35dd90);loggerPredictive[_0x171a('0x4c')](_0x171a('0x1e0'),_0x171a('0x1e1'),_0x26cf5f,'startProgressive',_0x35dd90[_0x171a('0x49')]);}else if(_0xfaf901<_0x35dd90[_0x171a('0xd8')]&&_0x35dd90['dialPredictiveOptimization']===_0x171a('0x1df')){clearPredictiveAttributes(_0x35dd90);loggerPredictive['info'](_0x171a('0x1e2'),_0x171a('0x1e3'),_0xfaf901,_0x171a('0x1e4'),_0x35dd90['predictiveIntervalErlangCallsDroppedCalls'],_0x171a('0x65'),_0x35dd90[_0x171a('0x49')]);}else if(!ifInterval(_0x35dd90[_0x171a('0x1e5')],_0x35dd90[_0x171a('0x65')])&&_[_0x171a('0x57')](_0x35dd90[_0x171a('0x14c')])&&!_[_0x171a('0x57')](_0x35dd90[_0x171a('0x65')])){_0x35dd90[_0x171a('0x14c')]=moment()[_0x171a('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x171a('0x4c')](_0x35dd90[_0x171a('0x49')],_0x171a('0x1e6'),_0x35dd90[_0x171a('0x14c')]);hopperUtils['avgHandleTime'](_0x35dd90[_0x171a('0x1e5')])['then'](this[_0x171a('0x1e7')](_0x35dd90))[_0x171a('0x42')](mergeDataErlangB(_0x35dd90))[_0x171a('0x42')](this[_0x171a('0x1e8')](_0x35dd90))['catch'](loggerCatchPredictive(_0x171a('0x1e9'),_0x35dd90));}else if(!ifInterval(_0x35dd90[_0x171a('0x1e5')],_0x35dd90[_0x171a('0x14c')])){_0x35dd90[_0x171a('0xd8')]=0x0;_0x35dd90[_0x171a('0x14c')]=moment()[_0x171a('0x47')](_0x171a('0xcf'));loggerPredictive[_0x171a('0x4c')](_0x35dd90['name'],_0x171a('0x1ea'),_0x35dd90[_0x171a('0x14c')]);clearInterval(_0x35dd90[_0x171a('0x67')]);_0x35dd90[_0x171a('0x67')]=undefined;hopperUtils[_0x171a('0x1eb')](_0x35dd90[_0x171a('0x1e5')])[_0x171a('0x42')](this[_0x171a('0x1e7')](_0x35dd90))[_0x171a('0x42')](mergeDataErlangB(_0x35dd90))['then'](this[_0x171a('0x1e8')](_0x35dd90))[_0x171a('0xa2')](loggerCatchPredictive(_0x171a('0x1ec'),_0x35dd90));}else if(_0x35dd90[_0x171a('0x1d1')]&&_0x4f4434<_0x35dd90['predictiveIntervalAvailable']-_0x550938){clearPredictiveAttributes(_0x35dd90);loggerPredictive['info'](_0x35dd90[_0x171a('0x49')],_0x171a('0x1ed'),_0x4f4434,')\x20are\x20less\x20than\x20threshold\x20(',_0x35dd90[_0x171a('0x1d1')],'-',_0x550938,'=',_0x35dd90['predictiveIntervalAvailable']-_0x550938,')');}else if(_0x35dd90[_0x171a('0x1d1')]&&_0x4f4434>_0x35dd90[_0x171a('0x1d1')]+_0x98b199){clearPredictiveAttributes(_0x35dd90);loggerPredictive[_0x171a('0x4c')](_0x35dd90[_0x171a('0x49')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4f4434,')\x20are\x20more\x20than\x20threshold\x20(',_0x35dd90[_0x171a('0x1d1')],'+',_0x98b199,'=',_0x35dd90[_0x171a('0x1d1')]+_0x98b199,')');}};Dialer[_0x171a('0x1c')][_0x171a('0x1e7')]=function(_0x5d3785){var _0x427c4d=this;return function(_0xec9a20){return new Promise(function(_0x559481,_0x3ee409){_[_0x171a('0x63')](_0x5d3785,_0xec9a20[0x0]);if(checkGetDataPredictive(_0xec9a20[0x0])){var _0x3eec2b=_0x5d3785[_0x171a('0x1d1')]=_0x5d3785[_0x171a('0x14e')]+_0x5d3785[_0x171a('0x14d')];var _0x13e819=_0x5d3785[_0x171a('0x1e5')]*0x3c;var _0x41569b=_0xec9a20[0x0][_0x171a('0x58')]+_0xec9a20[0x0][_0x171a('0x54')];var _0x16f33b=(_0xec9a20[0x0][_0x171a('0x4f')]+_0xec9a20[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xec9a20[0x0][_0x171a('0xec')])/_0xec9a20[0x0][_0x171a('0x56')];_0x5d3785['predictiveIntervalHitRate']=_0x16f33b>0x0?_0x16f33b:0x1;switch(_0x5d3785[_0x171a('0x1de')]){case'dropRate':var _0x916cc5=_0x5d3785[_0x171a('0x1d0')]/0x64;return _0x427c4d[_0x171a('0x1ee')](_0x3eec2b,_0x13e819,_0x41569b,_0x16f33b,_0x916cc5)[_0x171a('0x42')](function(_0x3299fc){return _0x559481(_0x3299fc);});case _0x171a('0x1ef'):var _0x52b035=_0x5d3785[_0x171a('0x1d0')]/0x64;return _0x427c4d['busyFactor'](_0x3eec2b,_0x13e819,_0x41569b,_0x16f33b,_0x52b035)[_0x171a('0x42')](function(_0x3d5dc2){return _0x559481(_0x3d5dc2);});default:return _0x3ee409(msgResponse(_0x171a('0x1f0'),'Failure',_0x171a('0x1f1')));}}else{return _0x3ee409(msgResponse('[getDataPredictive]',_0x171a('0x94'),'check\x20failure'));}});};};Dialer[_0x171a('0x1c')][_0x171a('0x1f2')]=function(_0x1df1de){var _0x4f8a14=this;return function(_0x48ce28){return new Promise(function(_0x20963e,_0x9656e9){_[_0x171a('0x63')](_0x1df1de,_0x48ce28[0x0]);if(checkGetDataPredictive(_0x48ce28[0x0])){loggerPredictive['info'](JSON['stringify'](_0x48ce28[0x0]));if(_0x1df1de[_0x171a('0x1de')]===_0x171a('0x1df')){return _0x4f8a14[_0x171a('0x163')](_0x1df1de['id'])[_0x171a('0x42')](function(_0x189bcd){var _0x2edca2=_0x1df1de[_0x171a('0x1f3')]-_0x189bcd[0x0][_0x171a('0x1f4')];var _0x2b156a=_0x1df1de[_0x171a('0x1e5')]*0x3c;var _0x16c84f=_0x48ce28[0x0][_0x171a('0x58')]+_0x48ce28[0x0]['predictiveIntervalAvgHoldtime'];var _0x5cc0d4=(_0x48ce28[0x0][_0x171a('0x4f')]+_0x48ce28[0x0][_0x171a('0x51')]+_0x48ce28[0x0][_0x171a('0xec')])/_0x48ce28[0x0][_0x171a('0x56')];var _0x2cf02f=_0x1df1de[_0x171a('0x1d0')]/0x64;_0x1df1de[_0x171a('0x1f5')]=_0x189bcd[0x0][_0x171a('0x1f4')]||0x0;_0x1df1de[_0x171a('0x1d7')]=_0x5cc0d4>0x0?_0x5cc0d4:0x1;return _0x4f8a14[_0x171a('0x1ee')](_0x2edca2,_0x2b156a,_0x16c84f,_0x5cc0d4,_0x2cf02f);})[_0x171a('0x42')](function(_0x3c0772){return _0x20963e(_0x3c0772);})[_0x171a('0xa2')](function(_0x39ee1a){return _0x9656e9(msgResponse('[CatchErlangB]',_0x171a('0x94'),JSON[_0x171a('0x79')](_0x39ee1a)));});}if(_0x1df1de[_0x171a('0x1de')]==='agentBusyFactor'){return _0x4f8a14[_0x171a('0x163')](_0x1df1de['id'])[_0x171a('0x42')](function(_0x156045){var _0x28c1f8=_0x1df1de[_0x171a('0x1f3')]-_0x156045[0x0][_0x171a('0x1f4')];var _0x321103=_0x1df1de[_0x171a('0x1e5')]*0x3c;var _0x4a1b51=_0x48ce28[0x0][_0x171a('0x58')]+_0x48ce28[0x0][_0x171a('0x54')];var _0x9b038b=(_0x48ce28[0x0][_0x171a('0x4f')]+_0x48ce28[0x0][_0x171a('0x51')]+_0x48ce28[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x48ce28[0x0][_0x171a('0x56')];var _0x50b67e=_0x1df1de[_0x171a('0x1d0')]/0x64;_0x1df1de[_0x171a('0x1f5')]=_0x156045[0x0]['outboundQueuePauses']||0x0;_0x1df1de[_0x171a('0x1d7')]=_0x9b038b>0x0?_0x9b038b:0x1;return _0x4f8a14[_0x171a('0x1f6')](_0x28c1f8,_0x321103,_0x4a1b51,_0x9b038b,_0x50b67e);})['then'](function(_0x30ecbb){return _0x20963e(_0x30ecbb);})[_0x171a('0xa2')](function(_0x4154f){return _0x9656e9(msgResponse(_0x171a('0x1f7'),_0x171a('0x94'),JSON['stringify'](_0x4154f)));});}}else{return _0x9656e9(msgResponse(_0x171a('0x1f0'),_0x171a('0x94'),_0x171a('0x1f8')));}});};};Dialer[_0x171a('0x1c')][_0x171a('0x1e8')]=function(_0x3fddd4){var _0x2b9c4d=this;return function(){var _0x4c1617=0x0;var _0x2be29a=Math[_0x171a('0x1d5')](_0x3fddd4['erlangCallToSecond']*0x3e8);if(_0x2be29a>0x0){_0x2be29a=_0x2be29a<0x64?0x64:_0x2be29a;loggerPredictive['info'](_0x3fddd4[_0x171a('0x49')],'one\x20call\x20every:',_0x2be29a,'milliseconds');_0x3fddd4[_0x171a('0x67')]=setInterval(function(){_0x2b9c4d[_0x171a('0x67')](_0x3fddd4);loggerPredictiveCalls[_0x171a('0x4c')](_0x171a('0x1f9'),_0x4c1617+=0x1);},_0x2be29a);}else{loggerPredictive['info'](_0x3fddd4[_0x171a('0x49')],_0x171a('0x1fa'));}};};Dialer['prototype']['checkContactBlack']=function(_0xeb846d,_0x4a7ec4){var _0x4a3e64=this;return function(_0x4d0d85){if(_['isEmpty'](_0x4d0d85)){if(_[_0x171a('0xfb')](_0x4a7ec4[_0x171a('0x168')])||!_0x4a7ec4[_0x171a('0x1fb')]){if(_0xeb846d[_0x171a('0xb5')]===_0x171a('0xa')){_0xeb846d[_0x171a('0x76')]=_[_0x171a('0x57')](_0xeb846d[_0x171a('0x76')])?!![]:_0xeb846d[_0x171a('0x76')];var _0x411c65=uuid['v4']();_0x4a3e64[_0x171a('0x26')][_0x411c65]=new Action(_0xeb846d,_0x4a7ec4,_0x411c65);loggerBooked[_0x171a('0x4c')](_0x171a('0x1fc'),_0x411c65,_0x171a('0x1fd'),JSON[_0x171a('0x79')](_0xeb846d[_0x171a('0x76')]),_0x171a('0x1fe'),_0xeb846d[_0x171a('0x49')]);if(_0xeb846d[_0x171a('0x76')]){_0xeb846d[_0x171a('0x76')]=![];_0x4a3e64[_0x171a('0x2a')][_0x4a3e64[_0x171a('0x26')][_0x411c65][_0x171a('0xc3')]]=[];ami[_0x171a('0x9c')]({'actionid':_0x411c65,'action':'queuestatus','queue':_0xeb846d[_0x171a('0x49')]})[_0x171a('0xa2')](function(){utils['decrementOriginate'](_0xeb846d,_0x171a('0x1ff'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4a3e64[_0x171a('0x26')][_0x411c65][_0x171a('0xf4')],'ListId':_0x4a3e64[_0x171a('0x26')][_0x411c65][_0x171a('0xe5')],'VoiceQueueId':_0x4a3e64[_0x171a('0x26')][_0x411c65][_0x171a('0xe6')]||undefined,'CampaignId':_0x4a3e64[_0x171a('0x26')][_0x411c65][_0x171a('0xe7')]||undefined})[_0x171a('0xa2')](loggerCatch(_0x171a('0x200')));delete _0x4a3e64[_0x171a('0x26')][_0x411c65];});}else{loggerBooked[_0x171a('0x4c')](_0x171a('0x201'),JSON[_0x171a('0x79')](_0xeb846d['queueStatusComplete']),_0x171a('0x1fe'),_0xeb846d[_0x171a('0x49')]);utils[_0x171a('0xc6')](_0xeb846d,_0x171a('0x1ff'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4a3e64['actions'][_0x411c65][_0x171a('0xf4')],'ListId':_0x4a3e64[_0x171a('0x26')][_0x411c65][_0x171a('0xe5')],'VoiceQueueId':_0x4a3e64['actions'][_0x411c65][_0x171a('0xe6')]||undefined,'CampaignId':_0x4a3e64[_0x171a('0x26')][_0x411c65]['CampaignId']||undefined})['catch'](loggerCatch(_0x171a('0x200')));delete _0x4a3e64[_0x171a('0x26')][_0x411c65];}}else{return _0x4a3e64[_0x171a('0x16d')](_0xeb846d,_0x4a7ec4);}}else{if(utils[_0x171a('0x64')](undefined,_0x4a7ec4[_0x171a('0x202')])<_0xeb846d[_0x171a('0x203')]*0x3c){if(_0x4a7ec4['Agent']&&!_0x4a7ec4[_0x171a('0x16b')]['voicePause']){_0x4a3e64[_0x171a('0x1f')]['run'](_0x4a7ec4['id'])['finally'](function(){utils['decrementOriginate'](_0xeb846d,'[checkContactBlack]');});}else{hopperUtils[_0x171a('0x204')]({'active':![]},_0x4a7ec4['id'],0x1)[_0x171a('0x101')](function(){utils[_0x171a('0xc6')](_0xeb846d,'[checkContactBlack]');});}}else{_0xeb846d['outboundReCallsDay']+=0x1;utils['decrementOriginate'](_0xeb846d,_0x171a('0x1ff'));if(_0xeb846d['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4a7ec4[_0x171a('0xf4')],'ListId':_0x4a7ec4[_0x171a('0xe5')],'VoiceQueueId':_0x4a7ec4[_0x171a('0xe6')]||undefined,'CampaignId':_0x4a7ec4['CampaignId']||undefined})[_0x171a('0xa2')](loggerCatch(_0x171a('0x205')));hopperUtils[_0x171a('0xd0')](createObjHistory(_0xeb846d,_0x4a7ec4,utils[_0x171a('0x6f')][_0x171a('0x206')],0x17,_0x171a('0x207')))[_0x171a('0xa2')](loggerCatch(_0x171a('0x208')));}else{_0x4a3e64[_0x171a('0x11f')](createObjHistory(_0xeb846d,_0x4a7ec4,utils['CAMPAIGN_STATUS'][_0x171a('0x209')],0x16,_0x171a('0x20a')),'[Originate][HistoryRecallClose][historyCatch]',_0x171a('0x20b'));}}}}else{_0xeb846d[_0x171a('0x20c')]+=0x1;_0x4a3e64[_0x171a('0x11f')](createObjHistory(_0xeb846d,_0x4a7ec4,utils[_0x171a('0x6f')][_0x171a('0x20d')],0xd,_0x171a('0x20e')),_0x171a('0x20f'),_0x171a('0x210'));throw _0x171a('0x211');}};};Dialer[_0x171a('0x1c')][_0x171a('0x16c')]=function(_0xa4d0d7){var _0x5aa462=this;var _0x3fed25=_0xa4d0d7['limitCalls']-_0xa4d0d7['originated'];emitCampaignSummary(_0xa4d0d7);if(_0x3fed25>0x0&&_0xa4d0d7[_0x171a('0x212')]==0x0){if(_0x3fed25>this['maxNumberOriginate']){_0x3fed25=this[_0x171a('0x24')];}_0xa4d0d7[_0x171a('0x212')]=0x1;hopperUtils[_0x171a('0x213')](_0xa4d0d7,_0x3fed25)['then'](function(_0x18e110){_0xa4d0d7[_0x171a('0x212')]=0x0;if(_0x18e110){if(!utils[_0x171a('0x214')](_0x18e110)){_0xa4d0d7[_0x171a('0x6c')]=utils[_0x171a('0x6f')][_0x171a('0x70')];logger[_0x171a('0x4c')](_0x171a('0x215')+_0xa4d0d7[_0x171a('0x49')]);}else{_0xa4d0d7[_0x171a('0x81')]+=_0x18e110[_0x171a('0x9b')];_0xa4d0d7[_0x171a('0x6c')]=utils[_0x171a('0x6f')][_0x171a('0x216')];for(var _0x12e616=0x0;_0x12e616<_0x18e110[_0x171a('0x9b')];_0x12e616+=0x1){_0xa4d0d7[_0x171a('0x217')]+=0x1;if(_[_0x171a('0xfb')](_0x18e110[_0x12e616])||_[_0x171a('0xfb')](_0x18e110[_0x12e616][_0x171a('0x18c')])||_[_0x171a('0xfb')](_0x18e110[_0x12e616][_0x171a('0x171')])){_0x5aa462[_0x171a('0x165')]('[actionOriginate]\x20',_0xa4d0d7,_0x18e110[_0x12e616]);}else{hopperUtils[_0x171a('0x218')](_[_0x171a('0x7a')](_0x18e110[_0x12e616],[_0x171a('0xe7'),_0x171a('0x171')]))[_0x171a('0x42')](_0x5aa462[_0x171a('0x219')](_0xa4d0d7,_0x18e110[_0x12e616]))[_0x171a('0xa2')](function(_0x5ef1f4){logger[_0x171a('0x69')](_0x171a('0x21a'),_0x5ef1f4);utils['decrementOriginate'](_0xa4d0d7,_0x171a('0x21b'));});}}}}})['catch'](function(_0x448cbb){_0xa4d0d7[_0x171a('0x212')]=0x0;logger['error'](_0x171a('0x21c'),_0x448cbb);});}};Dialer[_0x171a('0x1c')][_0x171a('0xb8')]=function(_0x305a44,_0x445529){var _0x3f525f=this;var _0x215eda=[];if(_0x445529<0x1||_0x305a44[_0x171a('0xb5')]==='booked'){_0x445529=0x1;}var _0x54bd0c=Math[_0x171a('0x1d5')](_0x305a44[_0x171a('0x14d')]*_0x445529)-_0x305a44[_0x171a('0x81')];if(_0x305a44[_0x171a('0x21d')]>0x0){var _0x59df91=_0x305a44[_0x171a('0x21d')]-_0x305a44[_0x171a('0x81')]-_0x305a44[_0x171a('0x14e')]-_0x305a44[_0x171a('0x14f')];if(_0x54bd0c>_0x59df91){_0x54bd0c=_0x59df91;}}if(_0x54bd0c>0x0&&_0x305a44[_0x171a('0x212')]==0x0){if(_0x305a44['dialMethod']===_0x171a('0xa')){_0x54bd0c=0x1;}if(_0x54bd0c>this[_0x171a('0x24')]){_0x54bd0c=this['maxNumberOriginate'];}for(var _0x56424d in this[_0x171a('0x22')]){if(typeof this[_0x171a('0x22')][_0x56424d]!==_0x171a('0xae')){if(this[_0x171a('0x22')][_0x56424d]['state']===_0x171a('0x21e')&&this[_0x171a('0x22')][_0x56424d]['status']===_0x171a('0x8b')){_0x215eda['push'](this['agents'][_0x56424d]['id']);}}}_0x305a44[_0x171a('0x212')]=0x1;hopperUtils[_0x171a('0x21f')](_0x305a44,_0x215eda,_0x54bd0c)[_0x171a('0x42')](function(_0x38474d){_0x305a44['temp']=0x0;if(_0x38474d){if(!utils[_0x171a('0x214')](_0x38474d)){hopperUtils['countReScheduled'](_0x305a44)[_0x171a('0x42')](sendMessageReschedule(_0x305a44))['catch'](loggerCatch(_0x171a('0x220')));}else{_0x305a44[_0x171a('0x81')]+=_0x38474d[_0x171a('0x9b')];_0x305a44['message']=_0x305a44['dialMethod']===_0x171a('0xa')?utils['CAMPAIGN_STATUS'][_0x171a('0x150')]:utils[_0x171a('0x6f')][_0x171a('0x216')];for(var _0x4dfb01=0x0;_0x4dfb01<_0x38474d['length'];_0x4dfb01+=0x1){if(_[_0x171a('0xfb')](_0x38474d[_0x4dfb01])||_['isNil'](_0x38474d[_0x4dfb01]['Contact'])||_[_0x171a('0xfb')](_0x38474d[_0x4dfb01][_0x171a('0x171')])){_0x3f525f[_0x171a('0x165')]('[actionOriginate]\x20',_0x305a44,_0x38474d[_0x4dfb01]);}else{hopperUtils[_0x171a('0x221')](_['pick'](_0x38474d[_0x4dfb01],[_0x171a('0xe6'),_0x171a('0x171')]))[_0x171a('0x42')](_0x3f525f[_0x171a('0x219')](_0x305a44,_0x38474d[_0x4dfb01]))['catch'](function(_0x1a168c){logger['error'](_0x171a('0x222'),_0x1a168c);utils[_0x171a('0xc6')](_0x305a44,'[handlePower]');});}}}}})[_0x171a('0xa2')](function(_0x216608){_0x305a44['temp']=0x0;logger['error'](_0x171a('0x21c'),_0x216608);});}};Dialer[_0x171a('0x1c')]['handlePredictive']=function(_0x3fd0e4){if(_0x3fd0e4[_0x171a('0x21d')]>0x0){var _0x2363b5=_0x3fd0e4[_0x171a('0x21d')]-_0x3fd0e4['originated']-_0x3fd0e4[_0x171a('0x14e')];if(_0x2363b5>0x0&&_0x3fd0e4['temp']==0x0){this[_0x171a('0x223')](_0x3fd0e4);}else{loggerPredictiveCalls[_0x171a('0x4c')](_0x171a('0x224'));}}else{this['tryOriginatePredictive'](_0x3fd0e4);}};Dialer[_0x171a('0x1c')][_0x171a('0x223')]=function(_0x582ea2){var _0x8543c6=this;var _0x5771a3=[];_0x582ea2[_0x171a('0x81')]+=0x1;for(var _0x1a75e1 in this['agents']){if(typeof this[_0x171a('0x22')][_0x1a75e1]!=='undefined'){if(this[_0x171a('0x22')][_0x1a75e1][_0x171a('0x72')]===_0x171a('0x21e')&&this[_0x171a('0x22')][_0x1a75e1][_0x171a('0x8a')]===_0x171a('0x8b')){_0x5771a3['push'](this[_0x171a('0x22')][_0x1a75e1]['id']);}}}_0x582ea2[_0x171a('0x212')]=0x1;return this['getContactDialer'](_0x582ea2['id'],_0x5771a3,0x1,_0x582ea2[_0x171a('0x225')],_0x582ea2)[_0x171a('0x42')](function(_0x3a037b){_0x582ea2['temp']=0x1;if(_0x3a037b){if(!utils[_0x171a('0x214')](_0x3a037b)){utils[_0x171a('0x226')](_0x582ea2,0x1,0x0);return hopperUtils[_0x171a('0x227')](_0x582ea2)[_0x171a('0x42')](sendMessageReschedule(_0x582ea2))[_0x171a('0xa2')](loggerCatch(_0x171a('0x220')));}else{_0x582ea2['message']=utils[_0x171a('0x6f')][_0x171a('0x216')];if(_['isNil'](_0x3a037b[0x0])||_[_0x171a('0xfb')](_0x3a037b[0x0][_0x171a('0x18c')])||_['isNil'](_0x3a037b[0x0]['phone'])){_0x8543c6[_0x171a('0x165')]('[actionOriginate]\x20',_0x582ea2,_0x3a037b[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x3a037b[0x0],[_0x171a('0xe6'),_0x171a('0x171')]))[_0x171a('0x42')](_0x8543c6[_0x171a('0x219')](_0x582ea2,_0x3a037b[0x0]))['catch'](function(_0x41add8){logger[_0x171a('0x69')](_0x171a('0x228'),_0x41add8);utils[_0x171a('0xc6')](_0x582ea2,'[actionOriginatePredictive]');});}}}})[_0x171a('0xa2')](function(_0x131fac){_0x582ea2[_0x171a('0x212')]=0x0;logger['error']('[getContactCampaign2]',_0x131fac);});};Dialer[_0x171a('0x1c')][_0x171a('0x1ee')]=function(_0x3e06c7,_0x2ec1ce,_0x198d0a,_0x16e3c2,_0x26ce33,_0x9359b7){loggerPredictive['info'](_0x171a('0x229'));loggerPredictive['info'](_0x171a('0x22a'),_0x3e06c7);loggerPredictive[_0x171a('0x4c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ec1ce);loggerPredictive[_0x171a('0x4c')](_0x171a('0x22b'),_0x198d0a);loggerPredictive[_0x171a('0x4c')]('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',_0x16e3c2);loggerPredictive[_0x171a('0x4c')](_0x171a('0x22c'),_0x26ce33);loggerPredictive[_0x171a('0x4c')](_0x171a('0x55'));return new Promise(function(_0x3b662d,_0x5ee466){if(_0x3e06c7<=0x0||isNaN(_0x3e06c7)){return _0x5ee466(msgResponse(_0x171a('0x22d'),_0x171a('0x87'),_0x171a('0x22e')+_0x3e06c7));}if(_0x198d0a<=0x0||isNaN(_0x198d0a)){return _0x5ee466(msgResponse(_0x171a('0x22d'),'Error','Ts\x20=\x20'+_0x198d0a));}if(_0x16e3c2<=0x0||isNaN(_0x16e3c2)){return _0x5ee466(msgResponse(_0x171a('0x22d'),_0x171a('0x87'),_0x171a('0x22f')+_0x16e3c2));}if(_0x2ec1ce<=0x0||isNaN(_0x2ec1ce)){return _0x5ee466(msgResponse(_0x171a('0x22d'),'Error',_0x171a('0x230')+_0x2ec1ce));}if(_0x26ce33<=0x0||isNaN(_0x26ce33)){return _0x5ee466(msgResponse(_0x171a('0x22d'),_0x171a('0x87'),'Amax\x20=\x20'+_0x26ce33));}_0x9359b7=_0x9359b7||0x0;var _0x55fd58=0x1/_0x198d0a;var _0x2f0595=0x0;var _0x53306c=0x0;var _0x43bc94=0x0;var _0x2b3ca6=0x0;for(var _0x550fcc=0x0;_0x43bc94<_0x26ce33;_0x550fcc+=0x1){_0x53306c=_0x550fcc/_0x2ec1ce;_0x2f0595=(_0x16e3c2*_0x53306c+_0x9359b7)/_0x55fd58;_0x43bc94=utils[_0x171a('0x231')](_0x2f0595,_0x3e06c7);_0x2b3ca6=_0x2f0595/_0x3e06c7*(0x1-utils[_0x171a('0x231')](_0x2f0595,_0x3e06c7));}return _0x3b662d({'erlangCalls':_0x550fcc,'erlangCallToSecond':_0x2ec1ce/_0x550fcc,'erlangAbandonmentRate':_0x43bc94,'erlangBusyFactor':_0x2b3ca6});});};Dialer[_0x171a('0x1c')][_0x171a('0x1f6')]=function(_0x598dc8,_0x5b5a40,_0x11e1b5,_0x384eb2,_0x454794,_0x469ced){loggerPredictive['info'](_0x171a('0x232'));loggerPredictive[_0x171a('0x4c')](_0x171a('0x22a'),_0x598dc8);loggerPredictive[_0x171a('0x4c')](_0x171a('0x233'),_0x5b5a40);loggerPredictive[_0x171a('0x4c')](_0x171a('0x22b'),_0x11e1b5);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x384eb2);loggerPredictive[_0x171a('0x4c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x454794);loggerPredictive[_0x171a('0x4c')](_0x171a('0x55'));return new Promise(function(_0xfb9c9b,_0x3b1614){if(_0x598dc8<=0x0||isNaN(_0x598dc8)){return _0x3b1614(msgResponse(_0x171a('0x234'),'Error',_0x171a('0x22e')+_0x598dc8));}if(_0x11e1b5<=0x0||isNaN(_0x11e1b5)){return _0x3b1614(msgResponse('[busyFactor]',_0x171a('0x87'),_0x171a('0x235')+_0x11e1b5));}if(_0x384eb2<=0x0||isNaN(_0x384eb2)){return _0x3b1614(msgResponse(_0x171a('0x234'),_0x171a('0x87'),'p\x20=\x20'+_0x384eb2));}if(_0x5b5a40<=0x0||isNaN(_0x5b5a40)){return _0x3b1614(msgResponse(_0x171a('0x234'),'Error','interval\x20=\x20'+_0x5b5a40));}if(_0x454794<=0x0||isNaN(_0x454794)){return _0x3b1614(msgResponse(_0x171a('0x234'),'Error',_0x171a('0x236')+_0x454794));}_0x469ced=_0x469ced||0x0;var _0x4dc4f9=0x1/_0x11e1b5;var _0x50b159=0x0;var _0x502cbf=0x0;var _0x4118eb=0x0;var _0x194a15=0x0;for(var _0x2a6029=0x0;_0x194a15<_0x454794;_0x2a6029+=0x1){_0x502cbf=_0x2a6029/_0x5b5a40;_0x50b159=(_0x384eb2*_0x502cbf+_0x469ced)/_0x4dc4f9;_0x4118eb=utils['erlangb'](_0x50b159,_0x598dc8);_0x194a15=_0x50b159/_0x598dc8*(0x1-utils[_0x171a('0x231')](_0x50b159,_0x598dc8));}return _0xfb9c9b({'erlangCalls':_0x2a6029,'erlangCallToSecond':_0x5b5a40/_0x2a6029,'erlangAbandonmentRate':_0x4118eb,'erlangBusyFactor':_0x194a15});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index c0815e1..b3446df 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe603=['getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','getQueue','exports','util','lodash','moment','string','isNil','uniqueid','name','Contact','lastName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridname','prototype'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe603,0x1b4));var _0x3e60=function(_0x4394ff,_0x2848a4){_0x4394ff=_0x4394ff-0x0;var _0x3b1ae0=_0xe603[_0x4394ff];return _0x3b1ae0;};'use strict';var util=require(_0x3e60('0x0'));var _=require(_0x3e60('0x1'));var moment=require(_0x3e60('0x2'));function checkNameSurname(_0x2cd599,_0x3c4f1b,_0x2e0546){var _0x1b0c69='';if(!_['isNil'](_0x3c4f1b)&&_0x3e60('0x3')===typeof _0x3c4f1b){_0x1b0c69+=_0x3c4f1b;}if(!_[_0x3e60('0x4')](_0x2e0546)&&'string'===typeof _0x2e0546){_0x1b0c69+='\x20'+_0x2e0546;}if(_0x1b0c69!==''){return _0x1b0c69;}return _0x2cd599;}function Action(_0x71997e,_0x2846f9,_0xe45ecc){this['voiceQueue']=_0x71997e;this[_0x3e60('0x5')]=_0xe45ecc||undefined;this[_0x3e60('0x6')]=checkNameSurname(_0x2846f9['Contact']['phone'],_0x2846f9[_0x3e60('0x7')]['firstName'],_0x2846f9[_0x3e60('0x7')][_0x3e60('0x8')]);this[_0x3e60('0x9')]=_0x2846f9[_0x3e60('0xa')];this['queue']=_0x71997e[_0x3e60('0x6')];this[_0x3e60('0xb')]=_0x2846f9[_0x3e60('0xb')]||![];this['type']=_0x71997e[_0x3e60('0xc')];this[_0x3e60('0xd')]=_0x71997e[_0x3e60('0xd')]||0x3;this[_0x3e60('0xe')]=_0x2846f9['scheduledat'];this[_0x3e60('0xf')]=_0x2846f9[_0x3e60('0xf')];this[_0x3e60('0x10')]=_0x2846f9['countcongestionretry'];this[_0x3e60('0x11')]=_0x2846f9[_0x3e60('0x11')];this[_0x3e60('0x12')]=_0x2846f9[_0x3e60('0x12')];this[_0x3e60('0x13')]=_0x2846f9[_0x3e60('0x13')];this[_0x3e60('0x14')]=_0x2846f9['countabandonedretry'];this[_0x3e60('0x15')]=_0x2846f9[_0x3e60('0x15')];this['countagentrejectretry']=_0x2846f9['countagentrejectretry'];this['ContactId']=_0x2846f9[_0x3e60('0x16')];this[_0x3e60('0x17')]=_0x2846f9['ListId'];this[_0x3e60('0x18')]=_0x2846f9['UserId'];this[_0x3e60('0x19')]=_0x2846f9['VoiceQueueId'];this[_0x3e60('0x1a')]=_0x2846f9[_0x3e60('0x1a')];this[_0x3e60('0x1b')]=_0x2846f9['id'];this['ContactFirstName']=_0x2846f9[_0x3e60('0x7')][_0x3e60('0x1c')]||'';this[_0x3e60('0x1d')]=moment()[_0x3e60('0x1e')](_0x3e60('0x1f'));this['callback']=_0x2846f9[_0x3e60('0x20')];this['callbackuniqueid']=_0x2846f9['callbackuniqueid'];this[_0x3e60('0x21')]=_0x2846f9[_0x3e60('0x21')];this[_0x3e60('0x22')]=_0x2846f9['recallme'];this['originatecalleridnum']='';this[_0x3e60('0x23')]='';}Action[_0x3e60('0x24')][_0x3e60('0x25')]=function(){return util['format'](_0x3e60('0x26'),this['name'],this['voiceQueue']['dialCutDigit']>0x0?this[_0x3e60('0x9')]['substring'](this[_0x3e60('0x27')][_0x3e60('0x28')]):this['number']);};Action['prototype'][_0x3e60('0x29')]=function(){return this['queue'];};module[_0x3e60('0x2a')]=Action; \ No newline at end of file +var _0x581a=['originatecalleridname','getCaller','format','substring','dialCutDigit','number','util','lodash','moment','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum'];(function(_0x594576,_0x1844f0){var _0xfdbabb=function(_0x1afe6d){while(--_0x1afe6d){_0x594576['push'](_0x594576['shift']());}};_0xfdbabb(++_0x1844f0);}(_0x581a,0x180));var _0xa581=function(_0x3c2f6f,_0x5acf4d){_0x3c2f6f=_0x3c2f6f-0x0;var _0xf18f48=_0x581a[_0x3c2f6f];return _0xf18f48;};'use strict';var util=require(_0xa581('0x0'));var _=require(_0xa581('0x1'));var moment=require(_0xa581('0x2'));function checkNameSurname(_0x1e6e13,_0xf5fce5,_0x572aa0){var _0x5241a9='';if(!_[_0xa581('0x3')](_0xf5fce5)&&'string'===typeof _0xf5fce5){_0x5241a9+=_0xf5fce5;}if(!_[_0xa581('0x3')](_0x572aa0)&&'string'===typeof _0x572aa0){_0x5241a9+='\x20'+_0x572aa0;}if(_0x5241a9!==''){return _0x5241a9;}return _0x1e6e13;}function Action(_0x2581bc,_0x4598bf,_0x2f6afa){this[_0xa581('0x4')]=_0x2581bc;this[_0xa581('0x5')]=_0x2f6afa||undefined;this[_0xa581('0x6')]=checkNameSurname(_0x4598bf[_0xa581('0x7')][_0xa581('0x8')],_0x4598bf[_0xa581('0x7')][_0xa581('0x9')],_0x4598bf[_0xa581('0x7')][_0xa581('0xa')]);this['number']=_0x4598bf['phone'];this[_0xa581('0xb')]=_0x2581bc[_0xa581('0x6')];this[_0xa581('0xc')]=_0x4598bf['active']||![];this[_0xa581('0xd')]=_0x2581bc[_0xa581('0xd')];this[_0xa581('0xe')]=_0x2581bc['dialQueueTimeout']||0x3;this[_0xa581('0xf')]=_0x4598bf[_0xa581('0xf')];this['countbusyretry']=_0x4598bf[_0xa581('0x10')];this[_0xa581('0x11')]=_0x4598bf[_0xa581('0x11')];this['countnoanswerretry']=_0x4598bf[_0xa581('0x12')];this[_0xa581('0x13')]=_0x4598bf[_0xa581('0x13')];this[_0xa581('0x14')]=_0x4598bf[_0xa581('0x14')];this[_0xa581('0x15')]=_0x4598bf['countabandonedretry'];this[_0xa581('0x16')]=_0x4598bf[_0xa581('0x16')];this[_0xa581('0x17')]=_0x4598bf[_0xa581('0x17')];this[_0xa581('0x18')]=_0x4598bf[_0xa581('0x18')];this[_0xa581('0x19')]=_0x4598bf[_0xa581('0x19')];this[_0xa581('0x1a')]=_0x4598bf[_0xa581('0x1a')];this[_0xa581('0x1b')]=_0x4598bf['VoiceQueueId'];this[_0xa581('0x1c')]=_0x4598bf[_0xa581('0x1c')];this[_0xa581('0x1d')]=_0x4598bf['id'];this['ContactFirstName']=_0x4598bf['Contact'][_0xa581('0x9')]||'';this[_0xa581('0x1e')]=moment()['format'](_0xa581('0x1f'));this[_0xa581('0x20')]=_0x4598bf['callback'];this[_0xa581('0x21')]=_0x4598bf['callbackuniqueid'];this['callbackat']=_0x4598bf['callbackat'];this[_0xa581('0x22')]=_0x4598bf['recallme'];this[_0xa581('0x23')]='';this[_0xa581('0x24')]='';}Action['prototype'][_0xa581('0x25')]=function(){return util[_0xa581('0x26')]('\x22%s\x22\x20<%s>',this[_0xa581('0x6')],this['voiceQueue']['dialCutDigit']>0x0?this['number'][_0xa581('0x27')](this[_0xa581('0x4')][_0xa581('0x28')]):this[_0xa581('0x29')]);};Action['prototype']['getQueue']=function(){return this[_0xa581('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 7ec8cdd..4d91d74 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11cd=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x11cd,0xb1));var _0xd11c=function(_0x1327a7,_0xfa7bfd){_0x1327a7=_0x1327a7-0x0;var _0x3f696c=_0x11cd[_0x1327a7];return _0x3f696c;};'use strict';var moment=require(_0xd11c('0x0'));var utils=require(_0xd11c('0x1'));function AgentComplete(_0x40874d,_0x38cbce){this[_0xd11c('0x2')]=0x4;this[_0xd11c('0x3')]=_0xd11c('0x4');this[_0xd11c('0x5')]=_0x40874d['scheduledat'];this['type']=_0x40874d[_0xd11c('0x6')];this[_0xd11c('0x7')]=_0x40874d[_0xd11c('0x6')]===_0xd11c('0x8')?_0xd11c('0x9'):_0x40874d['type'];this[_0xd11c('0xa')]=_0x40874d[_0xd11c('0xa')];this[_0xd11c('0xb')]=_0x40874d[_0xd11c('0xb')];this[_0xd11c('0xc')]=_0x40874d[_0xd11c('0xc')];this[_0xd11c('0xd')]=_0x40874d[_0xd11c('0xa')]+_0x40874d[_0xd11c('0xb')]+_0x40874d[_0xd11c('0xc')]+_0x40874d[_0xd11c('0xe')]+_0x40874d[_0xd11c('0xf')]+_0x40874d[_0xd11c('0x10')]+_0x40874d['countmachineretry']+_0x40874d[_0xd11c('0x11')];this[_0xd11c('0xe')]=_0x40874d[_0xd11c('0xe')];this[_0xd11c('0xf')]=_0x40874d[_0xd11c('0xf')];this[_0xd11c('0x10')]=_0x40874d[_0xd11c('0x10')];this['countmachineretry']=_0x40874d[_0xd11c('0x12')];this[_0xd11c('0x11')]=_0x40874d['countagentrejectretry'];this[_0xd11c('0x13')]=_0x38cbce['uniqueid'];this['calleridname']=_0x40874d['name'];this[_0xd11c('0x14')]=_0x40874d[_0xd11c('0x15')];this['starttime']=_0x40874d[_0xd11c('0x16')];this[_0xd11c('0x17')]=_0x40874d[_0xd11c('0x17')];this[_0xd11c('0x18')]=_0x40874d['answertime'];this['endtime']=moment()[_0xd11c('0x19')](_0xd11c('0x1a'));this[_0xd11c('0x1b')]=utils[_0xd11c('0x1c')](_0x40874d[_0xd11c('0x17')],_0x40874d[_0xd11c('0x16')]);this[_0xd11c('0x1d')]=utils[_0xd11c('0x1c')](_0x40874d[_0xd11c('0x18')],_0x40874d[_0xd11c('0x17')]);this[_0xd11c('0x1e')]=utils[_0xd11c('0x1c')](this[_0xd11c('0x1f')],_0x40874d[_0xd11c('0x18')]);this['queue']=_0x38cbce[_0xd11c('0x9')];this[_0xd11c('0x20')]=_0x38cbce['membername'];this[_0xd11c('0x21')]=_0x38cbce[_0xd11c('0x21')];this[_0xd11c('0x22')]=_0x40874d['callback'];this[_0xd11c('0x23')]=_0x40874d[_0xd11c('0x23')];this[_0xd11c('0x24')]=_0x40874d[_0xd11c('0x24')];this['recallme']=_0x40874d['recallme'];this['ContactId']=_0x40874d[_0xd11c('0x25')];this[_0xd11c('0x26')]=_0x40874d[_0xd11c('0x26')];this[_0xd11c('0x27')]=_0x40874d[_0xd11c('0x27')];this[_0xd11c('0x28')]=_0x40874d[_0xd11c('0x28')];this[_0xd11c('0x29')]=_0x40874d[_0xd11c('0x29')];this[_0xd11c('0x2a')]=_0x40874d[_0xd11c('0x2a')]||'';this[_0xd11c('0x2b')]=_0x40874d[_0xd11c('0x2b')]||'';this[_0xd11c('0x2c')]=_0x40874d[_0xd11c('0x2c')];}module[_0xd11c('0x2d')]=AgentComplete; \ No newline at end of file +var _0x87e8=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','membername','callback','callbackuniqueid','callbackat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87e8,0x123));var _0x887e=function(_0x444a59,_0x21f0c3){_0x444a59=_0x444a59-0x0;var _0x569e99=_0x87e8[_0x444a59];return _0x569e99;};'use strict';var moment=require(_0x887e('0x0'));var utils=require(_0x887e('0x1'));function AgentComplete(_0x181d4d,_0xc82e7b){this[_0x887e('0x2')]=0x4;this[_0x887e('0x3')]=_0x887e('0x4');this[_0x887e('0x5')]=_0x181d4d[_0x887e('0x5')];this[_0x887e('0x6')]=_0x181d4d['type'];this[_0x887e('0x7')]=_0x181d4d['type']===_0x887e('0x8')?_0x887e('0x9'):_0x181d4d['type'];this[_0x887e('0xa')]=_0x181d4d['countbusyretry'];this[_0x887e('0xb')]=_0x181d4d[_0x887e('0xb')];this[_0x887e('0xc')]=_0x181d4d[_0x887e('0xc')];this[_0x887e('0xd')]=_0x181d4d[_0x887e('0xa')]+_0x181d4d[_0x887e('0xb')]+_0x181d4d[_0x887e('0xc')]+_0x181d4d[_0x887e('0xe')]+_0x181d4d[_0x887e('0xf')]+_0x181d4d[_0x887e('0x10')]+_0x181d4d[_0x887e('0x11')]+_0x181d4d[_0x887e('0x12')];this[_0x887e('0xe')]=_0x181d4d[_0x887e('0xe')];this[_0x887e('0xf')]=_0x181d4d[_0x887e('0xf')];this[_0x887e('0x10')]=_0x181d4d[_0x887e('0x10')];this[_0x887e('0x11')]=_0x181d4d['countmachineretry'];this[_0x887e('0x12')]=_0x181d4d[_0x887e('0x12')];this['uniqueid']=_0xc82e7b[_0x887e('0x13')];this[_0x887e('0x14')]=_0x181d4d[_0x887e('0x15')];this[_0x887e('0x16')]=_0x181d4d[_0x887e('0x17')];this[_0x887e('0x18')]=_0x181d4d[_0x887e('0x18')];this[_0x887e('0x19')]=_0x181d4d[_0x887e('0x19')];this['answertime']=_0x181d4d[_0x887e('0x1a')];this[_0x887e('0x1b')]=moment()[_0x887e('0x1c')](_0x887e('0x1d'));this[_0x887e('0x1e')]=utils['getSeconds'](_0x181d4d[_0x887e('0x19')],_0x181d4d[_0x887e('0x18')]);this[_0x887e('0x1f')]=utils[_0x887e('0x20')](_0x181d4d[_0x887e('0x1a')],_0x181d4d['responsetime']);this[_0x887e('0x21')]=utils[_0x887e('0x20')](this[_0x887e('0x1b')],_0x181d4d[_0x887e('0x1a')]);this['queue']=_0xc82e7b['queue'];this[_0x887e('0x22')]=_0xc82e7b[_0x887e('0x22')];this['reason']=_0xc82e7b['reason'];this[_0x887e('0x23')]=_0x181d4d[_0x887e('0x23')];this[_0x887e('0x24')]=_0x181d4d[_0x887e('0x24')];this[_0x887e('0x25')]=_0x181d4d[_0x887e('0x25')];this[_0x887e('0x26')]=_0x181d4d['recallme'];this[_0x887e('0x27')]=_0x181d4d['ContactId'];this[_0x887e('0x28')]=_0x181d4d[_0x887e('0x28')];this[_0x887e('0x29')]=_0x181d4d['UserId'];this['VoiceQueueId']=_0x181d4d[_0x887e('0x2a')];this[_0x887e('0x2b')]=_0x181d4d[_0x887e('0x2b')];this[_0x887e('0x2c')]=_0x181d4d[_0x887e('0x2c')]||'';this['originatecalleridname']=_0x181d4d['originatecalleridname']||'';this[_0x887e('0x2d')]=_0x181d4d[_0x887e('0x2d')];}module[_0x887e('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 2f466c2..b0ff256 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c8d=['originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId'];(function(_0x14b57e,_0x4af54e){var _0xd75477=function(_0x16a0fe){while(--_0x16a0fe){_0x14b57e['push'](_0x14b57e['shift']());}};_0xd75477(++_0x4af54e);}(_0x1c8d,0x115));var _0xd1c8=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1c8d[_0x6c993a];return _0x27f547;};'use strict';function Final(_0x20e711){this[_0xd1c8('0x0')]=_0x20e711[_0xd1c8('0x0')];this[_0xd1c8('0x1')]=_0x20e711['scheduledat'];this[_0xd1c8('0x2')]=_0x20e711[_0xd1c8('0x2')];this['campaigntype']=_0x20e711[_0xd1c8('0x2')]===_0xd1c8('0x3')?_0xd1c8('0x4'):_0x20e711[_0xd1c8('0x2')];this[_0xd1c8('0x5')]=_0x20e711['countbusyretry'];this[_0xd1c8('0x6')]=_0x20e711['countcongestionretry'];this[_0xd1c8('0x7')]=_0x20e711[_0xd1c8('0x7')];this['countglobal']=_0x20e711[_0xd1c8('0x5')]+_0x20e711[_0xd1c8('0x6')]+_0x20e711[_0xd1c8('0x7')]+_0x20e711[_0xd1c8('0x8')]+_0x20e711[_0xd1c8('0x9')]+_0x20e711[_0xd1c8('0xa')]+_0x20e711[_0xd1c8('0xb')]+_0x20e711[_0xd1c8('0xc')];this[_0xd1c8('0x8')]=_0x20e711[_0xd1c8('0x8')];this[_0xd1c8('0x9')]=_0x20e711[_0xd1c8('0x9')];this[_0xd1c8('0xa')]=_0x20e711[_0xd1c8('0xa')];this['countmachineretry']=_0x20e711['countmachineretry'];this['countagentrejectretry']=_0x20e711[_0xd1c8('0xc')];this[_0xd1c8('0x4')]=_0x20e711['queue'];this[_0xd1c8('0xd')]=_0x20e711[_0xd1c8('0xd')];this[_0xd1c8('0xe')]=_0x20e711[_0xd1c8('0xe')];this[_0xd1c8('0xf')]=_0x20e711[_0xd1c8('0xf')];this[_0xd1c8('0x10')]=_0x20e711[_0xd1c8('0x10')];this[_0xd1c8('0x11')]=_0x20e711[_0xd1c8('0x10')];this[_0xd1c8('0x12')]=_0x20e711[_0xd1c8('0x12')]||0x0;this[_0xd1c8('0x13')]=_0x20e711['holdtime']||0x0;this['talktime']=_0x20e711[_0xd1c8('0x14')]||0x0;this[_0xd1c8('0x15')]=_0x20e711['callback'];this[_0xd1c8('0x16')]=_0x20e711[_0xd1c8('0x16')];this[_0xd1c8('0x17')]=_0x20e711[_0xd1c8('0x17')];this[_0xd1c8('0x18')]=_0x20e711['recallme'];this[_0xd1c8('0x19')]=_0x20e711[_0xd1c8('0x19')];this[_0xd1c8('0x1a')]=_0x20e711[_0xd1c8('0x1a')];this[_0xd1c8('0x1b')]=_0x20e711[_0xd1c8('0x1b')];this['VoiceQueueId']=_0x20e711['VoiceQueueId'];this['CampaignId']=_0x20e711[_0xd1c8('0x1c')];this['originatecalleridnum']=_0x20e711[_0xd1c8('0x1d')]||'';this[_0xd1c8('0x1e')]=_0x20e711[_0xd1c8('0x1e')]||'';this[_0xd1c8('0x1f')]=_0x20e711[_0xd1c8('0x1f')];this['statedesc']=_0x20e711[_0xd1c8('0x20')];}module[_0xd1c8('0x21')]=Final; \ No newline at end of file +var _0xe542=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','ringtime','holdtime','talktime','callback'];(function(_0x372c30,_0x5ba108){var _0x42791f=function(_0x5cbcec){while(--_0x5cbcec){_0x372c30['push'](_0x372c30['shift']());}};_0x42791f(++_0x5ba108);}(_0xe542,0x10c));var _0x2e54=function(_0x584bcd,_0x59c4b7){_0x584bcd=_0x584bcd-0x0;var _0x146bc7=_0xe542[_0x584bcd];return _0x146bc7;};'use strict';function Final(_0x8461e7){this[_0x2e54('0x0')]=_0x8461e7['uniqueid'];this[_0x2e54('0x1')]=_0x8461e7['scheduledat'];this[_0x2e54('0x2')]=_0x8461e7[_0x2e54('0x2')];this[_0x2e54('0x3')]=_0x8461e7[_0x2e54('0x2')]==='outbound'?_0x2e54('0x4'):_0x8461e7['type'];this[_0x2e54('0x5')]=_0x8461e7['countbusyretry'];this['countcongestionretry']=_0x8461e7[_0x2e54('0x6')];this[_0x2e54('0x7')]=_0x8461e7[_0x2e54('0x7')];this['countglobal']=_0x8461e7[_0x2e54('0x5')]+_0x8461e7[_0x2e54('0x6')]+_0x8461e7[_0x2e54('0x7')]+_0x8461e7[_0x2e54('0x8')]+_0x8461e7['countdropretry']+_0x8461e7[_0x2e54('0x9')]+_0x8461e7[_0x2e54('0xa')]+_0x8461e7[_0x2e54('0xb')];this[_0x2e54('0x8')]=_0x8461e7[_0x2e54('0x8')];this[_0x2e54('0xc')]=_0x8461e7[_0x2e54('0xc')];this[_0x2e54('0x9')]=_0x8461e7['countabandonedretry'];this[_0x2e54('0xa')]=_0x8461e7[_0x2e54('0xa')];this[_0x2e54('0xb')]=_0x8461e7[_0x2e54('0xb')];this[_0x2e54('0x4')]=_0x8461e7['queue'];this[_0x2e54('0xd')]=_0x8461e7[_0x2e54('0xd')];this[_0x2e54('0xe')]=_0x8461e7[_0x2e54('0xe')];this[_0x2e54('0xf')]=_0x8461e7[_0x2e54('0xf')];this['responsetime']=_0x8461e7['responsetime'];this['endtime']=_0x8461e7['responsetime'];this['ringtime']=_0x8461e7[_0x2e54('0x10')]||0x0;this[_0x2e54('0x11')]=_0x8461e7[_0x2e54('0x11')]||0x0;this[_0x2e54('0x12')]=_0x8461e7[_0x2e54('0x12')]||0x0;this['callback']=_0x8461e7[_0x2e54('0x13')];this[_0x2e54('0x14')]=_0x8461e7[_0x2e54('0x14')];this[_0x2e54('0x15')]=_0x8461e7[_0x2e54('0x15')];this[_0x2e54('0x16')]=_0x8461e7[_0x2e54('0x16')];this[_0x2e54('0x17')]=_0x8461e7[_0x2e54('0x17')];this[_0x2e54('0x18')]=_0x8461e7[_0x2e54('0x18')];this['UserId']=_0x8461e7[_0x2e54('0x19')];this[_0x2e54('0x1a')]=_0x8461e7[_0x2e54('0x1a')];this[_0x2e54('0x1b')]=_0x8461e7['CampaignId'];this[_0x2e54('0x1c')]=_0x8461e7[_0x2e54('0x1c')]||'';this['originatecalleridname']=_0x8461e7['originatecalleridname']||'';this[_0x2e54('0x1d')]=_0x8461e7[_0x2e54('0x1d')];this['statedesc']=_0x8461e7[_0x2e54('0x1e')];}module[_0x2e54('0x1f')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 8d46e40..e13ff59 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd91a=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','calleridnum','starttime','responsetime','endtime','format','ringtime','getSeconds','talktime','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','Answer','scheduledat','type','queue','amd'];(function(_0x53374a,_0x2e18cf){var _0x1a86c1=function(_0x4fc2b3){while(--_0x4fc2b3){_0x53374a['push'](_0x53374a['shift']());}};_0x1a86c1(++_0x2e18cf);}(_0xd91a,0x8d));var _0xad91=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd91a[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var utils=require(_0xad91('0x0'));function Hangup(_0x719644,_0x4341ba){this[_0xad91('0x1')]=0x4;this['statedesc']=_0xad91('0x2');this[_0xad91('0x3')]=_0x719644['scheduledat'];this[_0xad91('0x4')]=_0x719644[_0xad91('0x4')];this['campaigntype']=_0x719644[_0xad91('0x4')]==='outbound'?_0xad91('0x5'):_0x719644[_0xad91('0x4')];this[_0xad91('0x6')]=_0x719644['amd']||![];this[_0xad91('0x7')]=_0x719644[_0xad91('0x7')];this[_0xad91('0x8')]=_0x719644[_0xad91('0x8')];this[_0xad91('0x9')]=_0x719644[_0xad91('0x9')];this['countglobal']=_0x719644[_0xad91('0x7')]+_0x719644['countcongestionretry']+_0x719644[_0xad91('0x9')]+_0x719644[_0xad91('0xa')]+_0x719644['countdropretry']+_0x719644[_0xad91('0xb')]+_0x719644['countmachineretry']+_0x719644[_0xad91('0xc')];this['countnosuchnumberretry']=_0x719644[_0xad91('0xa')];this[_0xad91('0xd')]=_0x719644[_0xad91('0xd')];this[_0xad91('0xb')]=_0x719644[_0xad91('0xb')];this[_0xad91('0xe')]=_0x719644[_0xad91('0xe')];this['countagentrejectretry']=_0x719644[_0xad91('0xc')];this[_0xad91('0xf')]=_0x4341ba[_0xad91('0xf')];this[_0xad91('0x10')]=_0x719644['name'];this[_0xad91('0x11')]=_0x719644['number'];this[_0xad91('0x12')]=_0x719644[_0xad91('0x12')];this['responsetime']=_0x719644[_0xad91('0x13')];this[_0xad91('0x14')]=moment()[_0xad91('0x15')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xad91('0x16')]=utils[_0xad91('0x17')](_0x719644[_0xad91('0x13')],_0x719644[_0xad91('0x12')]);this['holdtime']=0x0;this[_0xad91('0x18')]=utils[_0xad91('0x17')](this[_0xad91('0x14')],_0x719644[_0xad91('0x13')]);this[_0xad91('0x5')]=_0x719644[_0xad91('0x5')];this['membername']=_0xad91('0x19');this[_0xad91('0x1a')]=_0x4341ba['cause-txt'];this[_0xad91('0x1b')]=_0x719644[_0xad91('0x1b')];this[_0xad91('0x1c')]=_0x719644[_0xad91('0x1c')];this[_0xad91('0x1d')]=_0x719644[_0xad91('0x1d')];this[_0xad91('0x1e')]=_0x719644[_0xad91('0x1e')];this[_0xad91('0x1f')]=_0x719644[_0xad91('0x1f')];this[_0xad91('0x20')]=_0x719644[_0xad91('0x20')];this[_0xad91('0x21')]=_0x719644[_0xad91('0x21')];this[_0xad91('0x22')]=_0x719644['VoiceQueueId'];this[_0xad91('0x23')]=_0x719644[_0xad91('0x23')];}module[_0xad91('0x24')]=Hangup; \ No newline at end of file +var _0x3714=['countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','state','statedesc','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x373393,_0x2fad3d){var _0x22eeba=function(_0x50b47a){while(--_0x50b47a){_0x373393['push'](_0x373393['shift']());}};_0x22eeba(++_0x2fad3d);}(_0x3714,0x96));var _0x4371=function(_0x3d5a36,_0x506b27){_0x3d5a36=_0x3d5a36-0x0;var _0x14a792=_0x3714[_0x3d5a36];return _0x14a792;};'use strict';var moment=require('moment');var utils=require('../utils');function Hangup(_0x4f5ece,_0x2eceeb){this[_0x4371('0x0')]=0x4;this[_0x4371('0x1')]='Answer';this['scheduledat']=_0x4f5ece[_0x4371('0x2')];this[_0x4371('0x3')]=_0x4f5ece[_0x4371('0x3')];this[_0x4371('0x4')]=_0x4f5ece[_0x4371('0x3')]===_0x4371('0x5')?_0x4371('0x6'):_0x4f5ece[_0x4371('0x3')];this[_0x4371('0x7')]=_0x4f5ece[_0x4371('0x7')]||![];this[_0x4371('0x8')]=_0x4f5ece[_0x4371('0x8')];this['countcongestionretry']=_0x4f5ece[_0x4371('0x9')];this[_0x4371('0xa')]=_0x4f5ece[_0x4371('0xa')];this[_0x4371('0xb')]=_0x4f5ece[_0x4371('0x8')]+_0x4f5ece[_0x4371('0x9')]+_0x4f5ece[_0x4371('0xa')]+_0x4f5ece[_0x4371('0xc')]+_0x4f5ece[_0x4371('0xd')]+_0x4f5ece['countabandonedretry']+_0x4f5ece[_0x4371('0xe')]+_0x4f5ece[_0x4371('0xf')];this['countnosuchnumberretry']=_0x4f5ece[_0x4371('0xc')];this['countdropretry']=_0x4f5ece[_0x4371('0xd')];this[_0x4371('0x10')]=_0x4f5ece[_0x4371('0x10')];this[_0x4371('0xe')]=_0x4f5ece[_0x4371('0xe')];this[_0x4371('0xf')]=_0x4f5ece['countagentrejectretry'];this[_0x4371('0x11')]=_0x2eceeb[_0x4371('0x11')];this[_0x4371('0x12')]=_0x4f5ece[_0x4371('0x13')];this['calleridnum']=_0x4f5ece[_0x4371('0x14')];this[_0x4371('0x15')]=_0x4f5ece[_0x4371('0x15')];this['responsetime']=_0x4f5ece[_0x4371('0x16')];this[_0x4371('0x17')]=moment()[_0x4371('0x18')](_0x4371('0x19'));this[_0x4371('0x1a')]=utils[_0x4371('0x1b')](_0x4f5ece[_0x4371('0x16')],_0x4f5ece[_0x4371('0x15')]);this['holdtime']=0x0;this[_0x4371('0x1c')]=utils[_0x4371('0x1b')](this['endtime'],_0x4f5ece[_0x4371('0x16')]);this[_0x4371('0x6')]=_0x4f5ece['queue'];this['membername']='IVR';this[_0x4371('0x1d')]=_0x2eceeb[_0x4371('0x1e')];this[_0x4371('0x1f')]=_0x4f5ece[_0x4371('0x1f')];this[_0x4371('0x20')]=_0x4f5ece[_0x4371('0x20')];this[_0x4371('0x21')]=_0x4f5ece['callbackat'];this[_0x4371('0x22')]=_0x4f5ece[_0x4371('0x22')];this[_0x4371('0x23')]=_0x4f5ece[_0x4371('0x23')];this[_0x4371('0x24')]=_0x4f5ece[_0x4371('0x24')];this[_0x4371('0x25')]=_0x4f5ece[_0x4371('0x25')];this['VoiceQueueId']=_0x4f5ece[_0x4371('0x26')];this[_0x4371('0x27')]=_0x4f5ece['CampaignId'];}module[_0x4371('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index f7de138..645d4bb 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x347b=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','campaigntype','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds'];(function(_0x4eb0cb,_0x3b00ad){var _0xf38fd3=function(_0x2be515){while(--_0x2be515){_0x4eb0cb['push'](_0x4eb0cb['shift']());}};_0xf38fd3(++_0x3b00ad);}(_0x347b,0x112));var _0xb347=function(_0x46e68b,_0x48e7aa){_0x46e68b=_0x46e68b-0x0;var _0x44cdae=_0x347b[_0x46e68b];return _0x44cdae;};'use strict';var utils=require(_0xb347('0x0'));function History(_0x2b0cb1){this['uniqueid']=_0x2b0cb1['uniqueid'];this['scheduledat']=_0x2b0cb1[_0xb347('0x1')]||undefined;this[_0xb347('0x2')]=_0x2b0cb1[_0xb347('0x2')];this[_0xb347('0x3')]=_0x2b0cb1[_0xb347('0x2')]==='outbound'?'queue':_0x2b0cb1[_0xb347('0x2')];this['countbusyretry']=_0x2b0cb1['countbusyretry'];this[_0xb347('0x4')]=_0x2b0cb1[_0xb347('0x4')];this['countnoanswerretry']=_0x2b0cb1[_0xb347('0x5')];this['countglobal']=_0x2b0cb1[_0xb347('0x6')]+_0x2b0cb1['countcongestionretry']+_0x2b0cb1['countnoanswerretry']+_0x2b0cb1[_0xb347('0x7')]+_0x2b0cb1[_0xb347('0x8')]+_0x2b0cb1[_0xb347('0x9')]+_0x2b0cb1[_0xb347('0xa')]+_0x2b0cb1[_0xb347('0xb')];this[_0xb347('0x7')]=_0x2b0cb1[_0xb347('0x7')];this[_0xb347('0x8')]=_0x2b0cb1['countdropretry'];this['countabandonedretry']=_0x2b0cb1['countabandonedretry'];this[_0xb347('0xa')]=_0x2b0cb1[_0xb347('0xa')];this['countagentrejectretry']=_0x2b0cb1[_0xb347('0xb')];this[_0xb347('0xc')]=_0x2b0cb1['queue'];this[_0xb347('0xd')]=_0x2b0cb1[_0xb347('0xe')];this[_0xb347('0xf')]=_0x2b0cb1[_0xb347('0x10')];this['starttime']=_0x2b0cb1[_0xb347('0x11')];this[_0xb347('0x12')]=_0x2b0cb1[_0xb347('0x12')];this[_0xb347('0x13')]=_0x2b0cb1[_0xb347('0x12')];this[_0xb347('0x14')]=utils[_0xb347('0x15')](_0x2b0cb1['responsetime'],_0x2b0cb1[_0xb347('0x11')]);this[_0xb347('0x16')]=0x0;this[_0xb347('0x17')]=0x0;this[_0xb347('0x18')]=_0x2b0cb1['callback'];this[_0xb347('0x19')]=_0x2b0cb1['callbackuniqueid'];this[_0xb347('0x1a')]=_0x2b0cb1[_0xb347('0x1a')];this[_0xb347('0x1b')]=_0x2b0cb1[_0xb347('0x1b')];this[_0xb347('0x1c')]=_0x2b0cb1[_0xb347('0x1c')];this[_0xb347('0x1d')]=_0x2b0cb1[_0xb347('0x1d')];this[_0xb347('0x1e')]=_0x2b0cb1[_0xb347('0x1e')];this['VoiceQueueId']=_0x2b0cb1[_0xb347('0x1f')];this[_0xb347('0x20')]=_0x2b0cb1[_0xb347('0x20')];this['originatecalleridnum']=_0x2b0cb1['originatecalleridnum']||'';this[_0xb347('0x21')]=_0x2b0cb1['originatecalleridname']||'';this['state']=_0x2b0cb1[_0xb347('0x22')];this[_0xb347('0x23')]=_0x2b0cb1[_0xb347('0x23')];}module[_0xb347('0x24')]=History; \ No newline at end of file +var _0x42ce=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds'];(function(_0x10b2be,_0x21fb1d){var _0x686daf=function(_0xa40d9b){while(--_0xa40d9b){_0x10b2be['push'](_0x10b2be['shift']());}};_0x686daf(++_0x21fb1d);}(_0x42ce,0x1bd));var _0xe42c=function(_0x41b934,_0x23518a){_0x41b934=_0x41b934-0x0;var _0x10c248=_0x42ce[_0x41b934];return _0x10c248;};'use strict';var utils=require(_0xe42c('0x0'));function History(_0x34ab98){this['uniqueid']=_0x34ab98[_0xe42c('0x1')];this[_0xe42c('0x2')]=_0x34ab98[_0xe42c('0x2')]||undefined;this[_0xe42c('0x3')]=_0x34ab98[_0xe42c('0x3')];this['campaigntype']=_0x34ab98['type']==='outbound'?_0xe42c('0x4'):_0x34ab98[_0xe42c('0x3')];this[_0xe42c('0x5')]=_0x34ab98[_0xe42c('0x5')];this['countcongestionretry']=_0x34ab98[_0xe42c('0x6')];this[_0xe42c('0x7')]=_0x34ab98[_0xe42c('0x7')];this[_0xe42c('0x8')]=_0x34ab98[_0xe42c('0x5')]+_0x34ab98[_0xe42c('0x6')]+_0x34ab98[_0xe42c('0x7')]+_0x34ab98[_0xe42c('0x9')]+_0x34ab98[_0xe42c('0xa')]+_0x34ab98[_0xe42c('0xb')]+_0x34ab98['countmachineretry']+_0x34ab98[_0xe42c('0xc')];this[_0xe42c('0x9')]=_0x34ab98[_0xe42c('0x9')];this[_0xe42c('0xa')]=_0x34ab98[_0xe42c('0xa')];this[_0xe42c('0xb')]=_0x34ab98['countabandonedretry'];this[_0xe42c('0xd')]=_0x34ab98[_0xe42c('0xd')];this[_0xe42c('0xc')]=_0x34ab98[_0xe42c('0xc')];this[_0xe42c('0x4')]=_0x34ab98[_0xe42c('0x4')];this[_0xe42c('0xe')]=_0x34ab98[_0xe42c('0xf')];this[_0xe42c('0x10')]=_0x34ab98[_0xe42c('0x11')];this[_0xe42c('0x12')]=_0x34ab98[_0xe42c('0x12')];this[_0xe42c('0x13')]=_0x34ab98[_0xe42c('0x13')];this[_0xe42c('0x14')]=_0x34ab98[_0xe42c('0x13')];this[_0xe42c('0x15')]=utils[_0xe42c('0x16')](_0x34ab98[_0xe42c('0x13')],_0x34ab98[_0xe42c('0x12')]);this[_0xe42c('0x17')]=0x0;this[_0xe42c('0x18')]=0x0;this[_0xe42c('0x19')]=_0x34ab98[_0xe42c('0x19')];this['callbackuniqueid']=_0x34ab98[_0xe42c('0x1a')];this[_0xe42c('0x1b')]=_0x34ab98[_0xe42c('0x1b')];this[_0xe42c('0x1c')]=_0x34ab98['recallme'];this[_0xe42c('0x1d')]=_0x34ab98['ContactId'];this[_0xe42c('0x1e')]=_0x34ab98[_0xe42c('0x1e')];this[_0xe42c('0x1f')]=_0x34ab98['UserId'];this[_0xe42c('0x20')]=_0x34ab98['VoiceQueueId'];this['CampaignId']=_0x34ab98[_0xe42c('0x21')];this[_0xe42c('0x22')]=_0x34ab98[_0xe42c('0x22')]||'';this[_0xe42c('0x23')]=_0x34ab98[_0xe42c('0x23')]||'';this[_0xe42c('0x24')]=_0x34ab98['state'];this[_0xe42c('0x25')]=_0x34ab98[_0xe42c('0x25')];}module[_0xe42c('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 154d26a..c17a29b 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf429=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','droptime','dropreason','getSeconds','holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xf429,0x1bf));var _0x9f42=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0xf429[_0x303064];return _0x5a1d3d;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x19ab7e,_0x54d352){this['scheduledat']=_0x19ab7e[_0x9f42('0x0')];this['type']=_0x19ab7e[_0x9f42('0x1')];this[_0x9f42('0x2')]=_0x19ab7e[_0x9f42('0x1')]===_0x9f42('0x3')?'queue':_0x19ab7e['type'];this['countbusyretry']=_0x19ab7e[_0x9f42('0x4')];this['countcongestionretry']=_0x19ab7e['countcongestionretry'];this[_0x9f42('0x5')]=_0x19ab7e[_0x9f42('0x5')];this[_0x9f42('0x6')]=_0x19ab7e['countbusyretry']+_0x19ab7e[_0x9f42('0x7')]+_0x19ab7e[_0x9f42('0x5')]+_0x19ab7e[_0x9f42('0x8')]+_0x19ab7e[_0x9f42('0x9')]+_0x19ab7e[_0x9f42('0xa')]+_0x19ab7e[_0x9f42('0xb')]+_0x19ab7e[_0x9f42('0xc')];this[_0x9f42('0x8')]=_0x19ab7e[_0x9f42('0x8')];this[_0x9f42('0x9')]=_0x19ab7e[_0x9f42('0x9')];this['countabandonedretry']=_0x19ab7e[_0x9f42('0xa')];this[_0x9f42('0xb')]=_0x19ab7e['countmachineretry'];this[_0x9f42('0xc')]=_0x19ab7e['countagentrejectretry'];this[_0x9f42('0xd')]=_0x54d352[_0x9f42('0xd')];this['calleridname']=_0x19ab7e[_0x9f42('0xe')];this['calleridnum']=_0x19ab7e[_0x9f42('0xf')];this[_0x9f42('0x10')]=_0x19ab7e[_0x9f42('0x10')];this['responsetime']=_0x19ab7e[_0x9f42('0x11')];this[_0x9f42('0x12')]=_0x19ab7e['droptime'];this[_0x9f42('0x13')]=_0x19ab7e[_0x9f42('0x13')];this['endtime']=this[_0x9f42('0x12')];this['ringtime']=utils[_0x9f42('0x14')](_0x19ab7e[_0x9f42('0x11')],_0x19ab7e[_0x9f42('0x10')]);this[_0x9f42('0x15')]=utils['getSeconds'](this['droptime'],_0x19ab7e['responsetime']);this['talktime']=0x0;this['queue']=_0x54d352[_0x9f42('0x16')];this[_0x9f42('0x17')]=_0x54d352['connectedlinename'];this['reason']=_0x54d352[_0x9f42('0x18')];this[_0x9f42('0x19')]=_0x19ab7e[_0x9f42('0x19')];this[_0x9f42('0x1a')]=_0x19ab7e[_0x9f42('0x1a')];this[_0x9f42('0x1b')]=_0x19ab7e['callbackat'];this[_0x9f42('0x1c')]=_0x19ab7e[_0x9f42('0x1c')];this['ContactId']=_0x19ab7e[_0x9f42('0x1d')];this['ListId']=_0x19ab7e[_0x9f42('0x1e')];this['UserId']=_0x19ab7e[_0x9f42('0x1f')];this['VoiceQueueId']=_0x19ab7e[_0x9f42('0x20')];this[_0x9f42('0x21')]=_0x19ab7e[_0x9f42('0x21')];this[_0x9f42('0x22')]=_0x19ab7e[_0x9f42('0x22')]||'';this[_0x9f42('0x23')]=_0x19ab7e['originatecalleridname']||'';this[_0x9f42('0x24')]=_0x19ab7e[_0x9f42('0x24')];this['state']=_0x19ab7e[_0x9f42('0x25')];this[_0x9f42('0x26')]=_0x19ab7e[_0x9f42('0x26')];}module[_0x9f42('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0xd9a7=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','scheduledat','type','outbound','countbusyretry'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd9a7,0x74));var _0x7d9a=function(_0x34afee,_0x2bb703){_0x34afee=_0x34afee-0x0;var _0x3c6041=_0xd9a7[_0x34afee];return _0x3c6041;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x53b2b8,_0x45cdf5){this[_0x7d9a('0x0')]=_0x53b2b8[_0x7d9a('0x0')];this[_0x7d9a('0x1')]=_0x53b2b8[_0x7d9a('0x1')];this['campaigntype']=_0x53b2b8[_0x7d9a('0x1')]===_0x7d9a('0x2')?'queue':_0x53b2b8[_0x7d9a('0x1')];this['countbusyretry']=_0x53b2b8[_0x7d9a('0x3')];this['countcongestionretry']=_0x53b2b8[_0x7d9a('0x4')];this[_0x7d9a('0x5')]=_0x53b2b8[_0x7d9a('0x5')];this[_0x7d9a('0x6')]=_0x53b2b8[_0x7d9a('0x3')]+_0x53b2b8[_0x7d9a('0x4')]+_0x53b2b8[_0x7d9a('0x5')]+_0x53b2b8[_0x7d9a('0x7')]+_0x53b2b8[_0x7d9a('0x8')]+_0x53b2b8[_0x7d9a('0x9')]+_0x53b2b8[_0x7d9a('0xa')]+_0x53b2b8[_0x7d9a('0xb')];this[_0x7d9a('0x7')]=_0x53b2b8[_0x7d9a('0x7')];this['countdropretry']=_0x53b2b8[_0x7d9a('0x8')];this['countabandonedretry']=_0x53b2b8[_0x7d9a('0x9')];this[_0x7d9a('0xa')]=_0x53b2b8[_0x7d9a('0xa')];this[_0x7d9a('0xb')]=_0x53b2b8[_0x7d9a('0xb')];this[_0x7d9a('0xc')]=_0x45cdf5[_0x7d9a('0xc')];this[_0x7d9a('0xd')]=_0x53b2b8[_0x7d9a('0xe')];this[_0x7d9a('0xf')]=_0x53b2b8['number'];this[_0x7d9a('0x10')]=_0x53b2b8[_0x7d9a('0x10')];this[_0x7d9a('0x11')]=_0x53b2b8[_0x7d9a('0x11')];this[_0x7d9a('0x12')]=_0x53b2b8[_0x7d9a('0x12')];this['dropreason']=_0x53b2b8[_0x7d9a('0x13')];this[_0x7d9a('0x14')]=this[_0x7d9a('0x12')];this[_0x7d9a('0x15')]=utils[_0x7d9a('0x16')](_0x53b2b8[_0x7d9a('0x11')],_0x53b2b8[_0x7d9a('0x10')]);this['holdtime']=utils[_0x7d9a('0x16')](this[_0x7d9a('0x12')],_0x53b2b8[_0x7d9a('0x11')]);this['talktime']=0x0;this[_0x7d9a('0x17')]=_0x45cdf5['queue'];this[_0x7d9a('0x18')]=_0x45cdf5[_0x7d9a('0x19')];this['reason']=_0x45cdf5[_0x7d9a('0x1a')];this[_0x7d9a('0x1b')]=_0x53b2b8['callback'];this[_0x7d9a('0x1c')]=_0x53b2b8[_0x7d9a('0x1c')];this[_0x7d9a('0x1d')]=_0x53b2b8[_0x7d9a('0x1d')];this[_0x7d9a('0x1e')]=_0x53b2b8[_0x7d9a('0x1e')];this['ContactId']=_0x53b2b8['ContactId'];this[_0x7d9a('0x1f')]=_0x53b2b8[_0x7d9a('0x1f')];this[_0x7d9a('0x20')]=_0x53b2b8['UserId'];this[_0x7d9a('0x21')]=_0x53b2b8[_0x7d9a('0x21')];this[_0x7d9a('0x22')]=_0x53b2b8[_0x7d9a('0x22')];this[_0x7d9a('0x23')]=_0x53b2b8[_0x7d9a('0x23')]||'';this[_0x7d9a('0x24')]=_0x53b2b8['originatecalleridname']||'';this[_0x7d9a('0x25')]=_0x53b2b8[_0x7d9a('0x25')];this[_0x7d9a('0x26')]=_0x53b2b8[_0x7d9a('0x26')];this[_0x7d9a('0x27')]=_0x53b2b8[_0x7d9a('0x27')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index b596cff..ebb0691 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','error','[getContactDialer]','dialOrderByScheduledAt','catch','[getContactDialerIvr]','countReScheduled','rescheduleContact','[rescheduleContact]','[unlockContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xdb28,0x106));var _0x8db2=function(_0x248a9f,_0x67ddc8){_0x248a9f=_0x248a9f-0x0;var _0x1e1f91=_0xdb28[_0x248a9f];return _0x1e1f91;};'use strict';var util=require(_0x8db2('0x0'));var logger=require(_0x8db2('0x1'))(_0x8db2('0x2'));var cmHopper=require(_0x8db2('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x8db2('0x4'));var cmHopperHistory=require(_0x8db2('0x5'));function inspectError(_0xfcf49f){return util[_0x8db2('0x6')](_0xfcf49f,{'showHidden':![],'depth':null});}function getContactDialer(_0x11109e,_0x52bf99,_0x21a03e){return cmHopper[_0x8db2('0x7')](_0x11109e['id'],_0x52bf99,_0x21a03e,_0x11109e['dialOrderByScheduledAt'])['catch'](function(_0x477f50){_0x11109e[_0x8db2('0x8')]=0x0;logger[_0x8db2('0x9')](_0x8db2('0xa'),inspectError(_0x477f50));});}exports[_0x8db2('0x7')]=getContactDialer;function getContactDialerIvr(_0x1ff362,_0x126c78){return cmHopper['getContactDialerIvr'](_0x1ff362['id'],_0x126c78,_0x1ff362[_0x8db2('0xb')])[_0x8db2('0xc')](function(_0x1f62af){_0x1ff362['temp']=0x0;logger[_0x8db2('0x9')](_0x8db2('0xd'),inspectError(_0x1f62af));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x41beda){return cmHopper[_0x8db2('0xe')](_0x41beda)[_0x8db2('0xc')](function(_0x204f49){logger[_0x8db2('0x9')]('[countReScheduled]',inspectError(_0x204f49));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x15070d){return cmHopper[_0x8db2('0xf')](_0x15070d)[_0x8db2('0xc')](function(_0x1d6a15){logger[_0x8db2('0x9')](_0x8db2('0x10'),inspectError(_0x1d6a15));});}exports[_0x8db2('0xf')]=rescheduleContact;function unlockContact(_0x3c96a7,_0x131252,_0x16c8c2){return cmHopper['unlockContact'](_0x3c96a7,_0x131252,_0x16c8c2)[_0x8db2('0xc')](function(_0x24da1b){logger['error'](_0x8db2('0x11'),inspectError(_0x24da1b));});}exports[_0x8db2('0x12')]=unlockContact;function moveContactManagedDialer(_0x21db8c){return cmHopper[_0x8db2('0x13')](_0x21db8c)[_0x8db2('0xc')](function(_0x46ce14){logger['error']('[moveContactManagedDialer]',inspectError(_0x46ce14));});}exports[_0x8db2('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x104e33){return cmHopperBlack[_0x8db2('0x14')](_0x104e33)[_0x8db2('0xc')](function(_0x58562e){logger[_0x8db2('0x9')](_0x8db2('0x15'),inspectError(_0x58562e));});}exports[_0x8db2('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x297ba3){return cmHopperBlack[_0x8db2('0x16')](_0x297ba3)['catch'](function(_0x124467){logger[_0x8db2('0x9')](_0x8db2('0x17'),inspectError(_0x124467));});}exports[_0x8db2('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2260d8,_0x21704c,_0x796ec1){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2260d8,_0x21704c,_0x796ec1)[_0x8db2('0xc')](function(_0x4f6516){logger['error']('[verifyAdditionalPhone]',inspectError(_0x4f6516));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xec8cd2,_0x29b5cd,_0x3be281){return cmHopperAdditionalPhone[_0x8db2('0x18')](_0xec8cd2,_0x29b5cd,_0x3be281)[_0x8db2('0xc')](function(_0x8d4f54){logger['error'](_0x8db2('0x19'),inspectError(_0x8d4f54));});}exports[_0x8db2('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x430dd5){return cmHopperHistory[_0x8db2('0x1a')](_0x430dd5)['catch'](function(_0x2e0691){logger[_0x8db2('0x9')](_0x8db2('0x1b'),inspectError(_0x2e0691));});}exports[_0x8db2('0x1a')]=avgHandleTime;function createHistory(_0xbe5ece){return cmHopperHistory[_0x8db2('0x1c')](_0xbe5ece)[_0x8db2('0xc')](function(_0x3124d5){logger[_0x8db2('0x9')]('[createHistory]',inspectError(_0x3124d5));});}exports[_0x8db2('0x1c')]=createHistory; \ No newline at end of file +var _0xd101=['createHistory','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[createHistory]'];(function(_0x5dceb0,_0x204cd1){var _0x74ff42=function(_0x13bfed){while(--_0x13bfed){_0x5dceb0['push'](_0x5dceb0['shift']());}};_0x74ff42(++_0x204cd1);}(_0xd101,0xc1));var _0x1d10=function(_0x356515,_0x573a0c){_0x356515=_0x356515-0x0;var _0x20c5b6=_0xd101[_0x356515];return _0x20c5b6;};'use strict';var util=require(_0x1d10('0x0'));var logger=require('../../../../config/logger')(_0x1d10('0x1'));var cmHopper=require(_0x1d10('0x2'));var cmHopperAdditionalPhone=require(_0x1d10('0x3'));var cmHopperBlack=require(_0x1d10('0x4'));var cmHopperHistory=require(_0x1d10('0x5'));function inspectError(_0x25b425){return util[_0x1d10('0x6')](_0x25b425,{'showHidden':![],'depth':null});}function getContactDialer(_0x1e83e0,_0x5c5c42,_0x42b6d2){return cmHopper[_0x1d10('0x7')](_0x1e83e0['id'],_0x5c5c42,_0x42b6d2,_0x1e83e0[_0x1d10('0x8')])[_0x1d10('0x9')](function(_0xb9e08){_0x1e83e0[_0x1d10('0xa')]=0x0;logger[_0x1d10('0xb')](_0x1d10('0xc'),inspectError(_0xb9e08));});}exports[_0x1d10('0x7')]=getContactDialer;function getContactDialerIvr(_0x182c87,_0xf7926b){return cmHopper[_0x1d10('0xd')](_0x182c87['id'],_0xf7926b,_0x182c87[_0x1d10('0x8')])[_0x1d10('0x9')](function(_0x42efad){_0x182c87[_0x1d10('0xa')]=0x0;logger[_0x1d10('0xb')]('[getContactDialerIvr]',inspectError(_0x42efad));});}exports[_0x1d10('0xd')]=getContactDialerIvr;function countReScheduled(_0x93cb59){return cmHopper[_0x1d10('0xe')](_0x93cb59)[_0x1d10('0x9')](function(_0x268506){logger['error'](_0x1d10('0xf'),inspectError(_0x268506));});}exports[_0x1d10('0xe')]=countReScheduled;function rescheduleContact(_0x1a6586){return cmHopper[_0x1d10('0x10')](_0x1a6586)[_0x1d10('0x9')](function(_0x183bc4){logger['error'](_0x1d10('0x11'),inspectError(_0x183bc4));});}exports[_0x1d10('0x10')]=rescheduleContact;function unlockContact(_0x306953,_0x2ad3c0,_0x4f014a){return cmHopper[_0x1d10('0x12')](_0x306953,_0x2ad3c0,_0x4f014a)[_0x1d10('0x9')](function(_0x41152c){logger[_0x1d10('0xb')](_0x1d10('0x13'),inspectError(_0x41152c));});}exports[_0x1d10('0x12')]=unlockContact;function moveContactManagedDialer(_0x4528a6){return cmHopper['moveContactManagedDialer'](_0x4528a6)[_0x1d10('0x9')](function(_0x1163dd){logger[_0x1d10('0xb')](_0x1d10('0x14'),inspectError(_0x1163dd));});}exports[_0x1d10('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x5e61f8){return cmHopperBlack['checkIsBlackList'](_0x5e61f8)[_0x1d10('0x9')](function(_0x57ec1c){logger['error']('[checkIsBlackList]',inspectError(_0x57ec1c));});}exports[_0x1d10('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x2496bc){return cmHopperBlack[_0x1d10('0x17')](_0x2496bc)[_0x1d10('0x9')](function(_0x4ce84a){logger['error'](_0x1d10('0x18'),inspectError(_0x4ce84a));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x68b09,_0x474321,_0x160802){return cmHopperAdditionalPhone[_0x1d10('0x19')](_0x68b09,_0x474321,_0x160802)[_0x1d10('0x9')](function(_0x3601ba){logger[_0x1d10('0xb')](_0x1d10('0x1a'),inspectError(_0x3601ba));});}exports[_0x1d10('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x84055f,_0xf1e4c8,_0x5abc58){return cmHopperAdditionalPhone[_0x1d10('0x1b')](_0x84055f,_0xf1e4c8,_0x5abc58)[_0x1d10('0x9')](function(_0x475934){logger[_0x1d10('0xb')](_0x1d10('0x1c'),inspectError(_0x475934));});}exports[_0x1d10('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x38f583){return cmHopperHistory[_0x1d10('0x1d')](_0x38f583)['catch'](function(_0x355e10){logger[_0x1d10('0xb')]('[avgHandleTime]',inspectError(_0x355e10));});}exports[_0x1d10('0x1d')]=avgHandleTime;function createHistory(_0x52d514){return cmHopperHistory['createHistory'](_0x52d514)[_0x1d10('0x9')](function(_0x597aea){logger[_0x1d10('0xb')](_0x1d10('0x1e'),inspectError(_0x597aea));});}exports[_0x1d10('0x1f')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index f669efd..5f0c200 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e9e=['getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','undefined','length','XMD-','toString','toUpperCase','setXMDContactVariables','util','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','dialMethod','preview','type','ivr','isIVRCampaign','isOutboundQueue','isQueueCampaignActive','active','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','reachable','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK'];(function(_0x3fe080,_0x52e584){var _0x3721cf=function(_0x1a39b9){while(--_0x1a39b9){_0x3fe080['push'](_0x3fe080['shift']());}};_0x3721cf(++_0x52e584);}(_0x0e9e,0xc4));var _0xe0e9=function(_0x5a48d6,_0x622339){_0x5a48d6=_0x5a48d6-0x0;var _0x4347df=_0x0e9e[_0x5a48d6];return _0x4347df;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xe0e9('0x0'));var logger=require('../../../../config/logger')(_0xe0e9('0x1'));var timezones=require(_0xe0e9('0x2'))[_0xe0e9('0x3')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xe0e9('0x4'),'CONTACTS_RESCHEDULED':_0xe0e9('0x5'),'DEACTIVATED':_0xe0e9('0x6'),'DISACTIVED':_0xe0e9('0x7'),'EMPTY_INTERVAL':_0xe0e9('0x8'),'INACTIVE':_0xe0e9('0x9'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xe0e9('0xa'),'NULL_INTERVAL':_0xe0e9('0xb'),'OVERTIME_INTERVAL':_0xe0e9('0xc'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xe0e9('0xd'),'RECALL_TIMEOUT':_0xe0e9('0xe'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xe0e9('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x30dafb){return _0x30dafb[_0xe0e9('0x10')]===_0xe0e9('0x11');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x1ec7bc){return _0x1ec7bc[_0xe0e9('0x12')]===_0xe0e9('0x13');}exports[_0xe0e9('0x14')]=isIVRCampaign;function isOutboundQueue(_0x10c6c6){return _0x10c6c6[_0xe0e9('0x12')]==='outbound';}exports[_0xe0e9('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x3a7f95){return _0x3a7f95['dialActive'];}exports[_0xe0e9('0x16')]=isQueueCampaignActive;function isIVRCampaignActive(_0x488fa4){return _0x488fa4[_0xe0e9('0x17')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x15f174,_0x2f9d77){var _0x503c96=moment(_0x15f174)['milliseconds'](0x0);var _0xce578d=moment(_0x2f9d77)['milliseconds'](0x0);return _0x503c96[_0xe0e9('0x18')](_0xce578d,'seconds');}exports[_0xe0e9('0x19')]=getSeconds;function hasQueueCampaignDataChanged(_0x1a3139,_0x49a053){var _0x24aa45=![];var _0x505e44=_0x1a3139[_0xe0e9('0x10')]!==_0x49a053[_0xe0e9('0x10')]||_0x1a3139['dialActive']!==_0x49a053['dialActive']||_0x1a3139['message']!==_0x49a053[_0xe0e9('0x1a')];var _0x803ea9=_0x1a3139['available']!==_0x49a053[_0xe0e9('0x1b')]||_0x1a3139[_0xe0e9('0x1c')]!==_0x49a053[_0xe0e9('0x1c')]||_0x1a3139[_0xe0e9('0x1d')]!==_0x49a053['loggedInDb']||_0x1a3139[_0xe0e9('0x1e')]!==_0x49a053['paused']||_0x1a3139['talking']!==_0x49a053[_0xe0e9('0x1f')]||_0x1a3139['pTalking']!==_0x49a053[_0xe0e9('0x20')]||_0x1a3139[_0xe0e9('0x21')]!==_0x49a053['waiting']||_0x1a3139[_0xe0e9('0x22')]!==_0x49a053[_0xe0e9('0x22')]||_0x1a3139[_0xe0e9('0x23')]!==_0x49a053[_0xe0e9('0x23')];if(_0x1a3139[_0xe0e9('0x24')]&&_0x49a053[_0xe0e9('0x24')]){_0x24aa45=_0x1a3139['Trunk']['name']!==_0x49a053[_0xe0e9('0x24')][_0xe0e9('0x25')]||_0x1a3139[_0xe0e9('0x24')][_0xe0e9('0x17')]!==_0x49a053[_0xe0e9('0x24')][_0xe0e9('0x17')];}return _0x505e44||_0x803ea9||_0x24aa45;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2bcb89){var _0x327e19=null;var _0x14a6b0=_0x2bcb89[_0xe0e9('0x26')];if(_[_0xe0e9('0x27')](_0x2bcb89[_0xe0e9('0x28')])||_['isNil'](_0x2bcb89[_0xe0e9('0x29')])||_[_0xe0e9('0x27')](_0x2bcb89[_0xe0e9('0x29')][_0xe0e9('0x2a')])){_0x327e19=CAMPAIGN_STATUS[_0xe0e9('0x2b')];}else if(_[_0xe0e9('0x2c')](_0x2bcb89[_0xe0e9('0x28')])||_['isEmpty'](_0x2bcb89[_0xe0e9('0x29')][_0xe0e9('0x2a')])){_0x327e19=CAMPAIGN_STATUS[_0xe0e9('0x2d')];}else if(_0x14a6b0&&!timezones[_0x14a6b0]){_0x327e19=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x327e19;}function checkAnyValidTrunk(_0x5a8fec,_0x168605){var _0x3c8996=null;var _0x20478b=_0xe0e9('0x2e');var _0x4a3a4e=[_0xe0e9('0x2f'),'unmonitored'];var _0x22cef4=!![];if(_0x5a8fec['Trunk']&&_0x5a8fec[_0xe0e9('0x24')][_0xe0e9('0x17')]){_0x20478b+=_0x5a8fec['Trunk'][_0xe0e9('0x25')];_0x3c8996=_0x168605[_0x20478b];_0x22cef4=_0x4a3a4e[_0xe0e9('0x30')](_0x3c8996[_0xe0e9('0x31')]);}else if(_0x5a8fec[_0xe0e9('0x32')]&&_0x5a8fec[_0xe0e9('0x32')][_0xe0e9('0x17')]){_0x20478b+=_0x5a8fec[_0xe0e9('0x32')][_0xe0e9('0x25')];_0x3c8996=_0x168605[_0x20478b];_0x22cef4=_0x4a3a4e[_0xe0e9('0x30')](_0x3c8996[_0xe0e9('0x31')]);}return _0x22cef4;}function getQueueCampaignStatusMessage(_0x147058,_0x588536){var _0x43a5dc=CAMPAIGN_STATUS[_0xe0e9('0x33')];var _0x142636=isPreviewCampaign(_0x147058);if(!isQueueCampaignActive(_0x147058)){if(_0x142636){_0x43a5dc=CAMPAIGN_STATUS[_0xe0e9('0x34')];}else{if(_0x147058[_0xe0e9('0x23')]===0x0&&_0x147058['talking']===0x0&&_0x147058[_0xe0e9('0x21')]===0x0&&(_0x147058[_0xe0e9('0x20')]||0x0)===0x0){_0x43a5dc=CAMPAIGN_STATUS[_0xe0e9('0x34')];}else{_0x43a5dc=CAMPAIGN_STATUS[_0xe0e9('0x35')];}}}else if(_0x147058['loggedIn']===0x0){_0x43a5dc=CAMPAIGN_STATUS[_0xe0e9('0x36')];}else if(!checkAnyValidTrunk(_0x147058,_0x588536)){_0x43a5dc=CAMPAIGN_STATUS[_0xe0e9('0x37')];}else if(!isPreviewCampaign(_0x147058)){var _0xd2a047=checkAnyValidQueueCampaignInterval(_0x147058);if(_0xd2a047){_0x43a5dc=_0xd2a047;}}return _0x43a5dc;}exports[_0xe0e9('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x249dec){var _0x536544=CAMPAIGN_STATUS[_0xe0e9('0x35')];if(_0x249dec['originated']===0x0&&_0x249dec[_0xe0e9('0x1f')]===0x0&&_0x249dec[_0xe0e9('0x21')]===0x0&&(_0x249dec['pTalking']||0x0)===0x0){_0x536544=CAMPAIGN_STATUS[_0xe0e9('0x34')];}return _0x536544;}exports[_0xe0e9('0x39')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x397a0d){var _0x2cf73e=_0x397a0d[_0xe0e9('0x3a')](/"(.*?)"/);return _0x2cf73e?_0x2cf73e[0x1]:_0x397a0d;}exports[_0xe0e9('0x3b')]=extractCalleridName;function getCallerId(_0x2c3e19,_0x464bdc,_0x4a76d2){if(!_[_0xe0e9('0x3c')](_0x4a76d2)&&typeof _0x4a76d2===_0xe0e9('0x3d')&&!_[_0xe0e9('0x2c')](_0x4a76d2)){if(!_[_0xe0e9('0x3c')](_0x464bdc)&&typeof _0x464bdc==='string'&&!_[_0xe0e9('0x2c')](_0x464bdc)){return util[_0xe0e9('0x3e')](_0xe0e9('0x3f'),_0x464bdc,_0x4a76d2);}return util['format'](_0xe0e9('0x3f'),_0x4a76d2,_0x4a76d2);}if(!_[_0xe0e9('0x3c')](_0x2c3e19)&&typeof _0x2c3e19===_0xe0e9('0x3d')&&!_[_0xe0e9('0x2c')](_0x2c3e19)){return _0x2c3e19;}return'\x22\x22\x20<>';}exports[_0xe0e9('0x40')]=getCallerId;function getCallerIdRandom(_0x4cf944,_0x19e9da){var _0x5c95d1;var _0x508a1b;var _0x205df3;if(_0x19e9da<=0x0){_0x19e9da=0x1;}_0x5c95d1=new RegExp(_0xe0e9('0x41')+_0x19e9da+'}$');_0x508a1b=Math[_0xe0e9('0x42')](0xa,_0x19e9da-0x1);_0x205df3=Math[_0xe0e9('0x42')](0xa,_0x19e9da)-0x1;return util['format']('%s',_[_0xe0e9('0x43')](_0x4cf944,_0x5c95d1,_[_0xe0e9('0x44')](_0x508a1b,_0x205df3)['toString']()));}exports[_0xe0e9('0x45')]=getCallerIdRandom;function decrementOriginate(_0x4308e8,_0x10475c){if(_0x4308e8[_0xe0e9('0x23')]&&_0x4308e8[_0xe0e9('0x23')]>0x0){_0x4308e8['originated']-=0x1;}else{logger[_0xe0e9('0x46')](_0xe0e9('0x47'),_0x10475c);}}exports[_0xe0e9('0x48')]=decrementOriginate;function checkContactEmpty(_0x557c0b){return _0x557c0b&&_0x557c0b['length']>0x0;}exports[_0xe0e9('0x49')]=checkContactEmpty;function erlangb(_0x34c372,_0x339cd8){if(_0x339cd8===0x0){return 0x0;}var _0x37e434=0x1;for(var _0x532cba=0x1;_0x532cba<=_0x339cd8;_0x532cba+=0x1){_0x37e434=0x1+_0x37e434*_0x532cba/_0x34c372;}return 0x1/_0x37e434;}exports[_0xe0e9('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x38ae20,_0x33c43a,_0x482d23){if(_0x33c43a>_0x482d23){for(var _0x4cf6a5=0x0;_0x4cf6a5<_0x33c43a-_0x482d23;_0x4cf6a5+=0x1){decrementOriginate(_0x38ae20,'[checkContactLowerLimitOriginate]\x20');}}}exports[_0xe0e9('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4e0013){var _0x37b502={};var _0x419361=['id',_0xe0e9('0x4c'),_0xe0e9('0x4d'),'updatedAt'];const _0x110cd9=0xfa;if(_0x4e0013){for(var _0x56d663 in _0x4e0013){if(typeof _0x4e0013[_0x56d663]!==_0xe0e9('0x4e')){if(!_[_0xe0e9('0x27')](_0x4e0013[_0x56d663])&&!_0x419361['includes'](_0x56d663)){if(_0x56d663==='description'&&_0x4e0013[_0x56d663][_0xe0e9('0x4f')]>_0x110cd9){_0x37b502[_0xe0e9('0x50')+_0x56d663['toUpperCase']()]=_0x4e0013[_0x56d663][_0xe0e9('0x51')]()['substring'](0x0,_0x110cd9);}else{_0x37b502[_0xe0e9('0x50')+_0x56d663[_0xe0e9('0x52')]()]=_0x4e0013[_0x56d663];}}}}}return _0x37b502;}exports[_0xe0e9('0x53')]=setXMDContactVariables; \ No newline at end of file +var _0x6580=['SIP/','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','getQueueCampaignStatusMessage','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','erlangb','[checkContactLowerLimitOriginate]\x20','createdAt','tags','updatedAt','undefined','XMD-','toUpperCase','toString','substring','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','TRUNK_IS_NOT_REACHABLE','preview','isPreviewCampaign','type','outbound','isOutboundQueue','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE'];(function(_0x528372,_0x1bc4c8){var _0x2e2c58=function(_0x188584){while(--_0x188584){_0x528372['push'](_0x528372['shift']());}};_0x2e2c58(++_0x1bc4c8);}(_0x6580,0x117));var _0x0658=function(_0x19145f,_0x28ef7e){_0x19145f=_0x19145f-0x0;var _0x10ebfb=_0x6580[_0x19145f];return _0x10ebfb;};'use strict';var _=require(_0x0658('0x0'));var moment=require(_0x0658('0x1'));var util=require(_0x0658('0x2'));var logger=require('../../../../config/logger')(_0x0658('0x3'));var timezones=require(_0x0658('0x4'))[_0x0658('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x0658('0x6'),'BLACKLIST':_0x0658('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x0658('0x8'),'DISACTIVED':_0x0658('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x0658('0xa'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x0658('0xb'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x0658('0xc'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x0658('0xd')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x16fed9){return _0x16fed9['dialMethod']===_0x0658('0xe');}exports[_0x0658('0xf')]=isPreviewCampaign;function isIVRCampaign(_0x2d9a4e){return _0x2d9a4e[_0x0658('0x10')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x51bb91){return _0x51bb91[_0x0658('0x10')]===_0x0658('0x11');}exports[_0x0658('0x12')]=isOutboundQueue;function isQueueCampaignActive(_0x2331e9){return _0x2331e9['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x2bd46c){return _0x2bd46c[_0x0658('0x13')];}exports[_0x0658('0x14')]=isIVRCampaignActive;function getSeconds(_0x42c78c,_0x52425e){var _0x31c6ed=moment(_0x42c78c)['milliseconds'](0x0);var _0x45c09b=moment(_0x52425e)[_0x0658('0x15')](0x0);return _0x31c6ed[_0x0658('0x16')](_0x45c09b,_0x0658('0x17'));}exports[_0x0658('0x18')]=getSeconds;function hasQueueCampaignDataChanged(_0x326083,_0x329116){var _0xbe6235=![];var _0x232a55=_0x326083['dialMethod']!==_0x329116[_0x0658('0x19')]||_0x326083[_0x0658('0x1a')]!==_0x329116[_0x0658('0x1a')]||_0x326083[_0x0658('0x1b')]!==_0x329116[_0x0658('0x1b')];var _0x42d7e2=_0x326083[_0x0658('0x1c')]!==_0x329116[_0x0658('0x1c')]||_0x326083[_0x0658('0x1d')]!==_0x329116['loggedIn']||_0x326083[_0x0658('0x1e')]!==_0x329116['loggedInDb']||_0x326083['paused']!==_0x329116[_0x0658('0x1f')]||_0x326083[_0x0658('0x20')]!==_0x329116['talking']||_0x326083[_0x0658('0x21')]!==_0x329116[_0x0658('0x21')]||_0x326083[_0x0658('0x22')]!==_0x329116[_0x0658('0x22')]||_0x326083['inUse']!==_0x329116[_0x0658('0x23')]||_0x326083[_0x0658('0x24')]!==_0x329116[_0x0658('0x24')];if(_0x326083[_0x0658('0x25')]&&_0x329116[_0x0658('0x25')]){_0xbe6235=_0x326083[_0x0658('0x25')]['name']!==_0x329116[_0x0658('0x25')][_0x0658('0x26')]||_0x326083[_0x0658('0x25')][_0x0658('0x13')]!==_0x329116[_0x0658('0x25')]['active'];}return _0x232a55||_0x42d7e2||_0xbe6235;}exports[_0x0658('0x27')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x37e339){var _0x479431=null;var _0x58f3a1=_0x37e339[_0x0658('0x28')];if(_[_0x0658('0x29')](_0x37e339[_0x0658('0x2a')])||_[_0x0658('0x29')](_0x37e339[_0x0658('0x2b')])||_['isNil'](_0x37e339[_0x0658('0x2b')][_0x0658('0x2c')])){_0x479431=CAMPAIGN_STATUS[_0x0658('0x2d')];}else if(_[_0x0658('0x2e')](_0x37e339['dialGlobalInterval'])||_[_0x0658('0x2e')](_0x37e339[_0x0658('0x2b')][_0x0658('0x2c')])){_0x479431=CAMPAIGN_STATUS[_0x0658('0x2f')];}else if(_0x58f3a1&&!timezones[_0x58f3a1]){_0x479431=CAMPAIGN_STATUS[_0x0658('0x30')];}return _0x479431;}function checkAnyValidTrunk(_0x5b881c,_0x25f83c){var _0x5754c9=null;var _0x177517=_0x0658('0x31');var _0x310d4d=['reachable',_0x0658('0x32')];var _0x1c7b93=!![];if(_0x5b881c['Trunk']&&_0x5b881c[_0x0658('0x25')][_0x0658('0x13')]){_0x177517+=_0x5b881c['Trunk'][_0x0658('0x26')];_0x5754c9=_0x25f83c[_0x177517];_0x1c7b93=_0x310d4d[_0x0658('0x33')](_0x5754c9[_0x0658('0x34')]);}else if(_0x5b881c['TrunkBackup']&&_0x5b881c[_0x0658('0x35')][_0x0658('0x13')]){_0x177517+=_0x5b881c['TrunkBackup']['name'];_0x5754c9=_0x25f83c[_0x177517];_0x1c7b93=_0x310d4d[_0x0658('0x33')](_0x5754c9[_0x0658('0x34')]);}return _0x1c7b93;}function getQueueCampaignStatusMessage(_0x30fffa,_0x4ebd5c){var _0x13fd32=CAMPAIGN_STATUS['ACTIVE'];var _0x33db40=isPreviewCampaign(_0x30fffa);if(!isQueueCampaignActive(_0x30fffa)){if(_0x33db40){_0x13fd32=CAMPAIGN_STATUS[_0x0658('0x36')];}else{if(_0x30fffa[_0x0658('0x24')]===0x0&&_0x30fffa['talking']===0x0&&_0x30fffa[_0x0658('0x22')]===0x0&&(_0x30fffa[_0x0658('0x21')]||0x0)===0x0){_0x13fd32=CAMPAIGN_STATUS['INACTIVE'];}else{_0x13fd32=CAMPAIGN_STATUS[_0x0658('0x37')];}}}else if(_0x30fffa[_0x0658('0x1d')]===0x0){_0x13fd32=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x30fffa,_0x4ebd5c)){_0x13fd32=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x30fffa)){var _0x1d16f5=checkAnyValidQueueCampaignInterval(_0x30fffa);if(_0x1d16f5){_0x13fd32=_0x1d16f5;}}return _0x13fd32;}exports[_0x0658('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3fa01c){var _0x30ee72=CAMPAIGN_STATUS[_0x0658('0x37')];if(_0x3fa01c[_0x0658('0x24')]===0x0&&_0x3fa01c[_0x0658('0x20')]===0x0&&_0x3fa01c[_0x0658('0x22')]===0x0&&(_0x3fa01c[_0x0658('0x21')]||0x0)===0x0){_0x30ee72=CAMPAIGN_STATUS[_0x0658('0x36')];}return _0x30ee72;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x89cce1){var _0x5626bb=_0x89cce1['match'](/"(.*?)"/);return _0x5626bb?_0x5626bb[0x1]:_0x89cce1;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x1d7f6b,_0x10bfda,_0x1f421c){if(!_[_0x0658('0x39')](_0x1f421c)&&typeof _0x1f421c===_0x0658('0x3a')&&!_[_0x0658('0x2e')](_0x1f421c)){if(!_['isUndefined'](_0x10bfda)&&typeof _0x10bfda===_0x0658('0x3a')&&!_[_0x0658('0x2e')](_0x10bfda)){return util[_0x0658('0x3b')](_0x0658('0x3c'),_0x10bfda,_0x1f421c);}return util['format'](_0x0658('0x3c'),_0x1f421c,_0x1f421c);}if(!_[_0x0658('0x39')](_0x1d7f6b)&&typeof _0x1d7f6b===_0x0658('0x3a')&&!_[_0x0658('0x2e')](_0x1d7f6b)){return _0x1d7f6b;}return _0x0658('0x3d');}exports[_0x0658('0x3e')]=getCallerId;function getCallerIdRandom(_0x20dfb6,_0x700d8c){var _0x1885a7;var _0x2ce3f4;var _0x1adc2f;if(_0x700d8c<=0x0){_0x700d8c=0x1;}_0x1885a7=new RegExp(_0x0658('0x3f')+_0x700d8c+'}$');_0x2ce3f4=Math[_0x0658('0x40')](0xa,_0x700d8c-0x1);_0x1adc2f=Math[_0x0658('0x40')](0xa,_0x700d8c)-0x1;return util[_0x0658('0x3b')]('%s',_[_0x0658('0x41')](_0x20dfb6,_0x1885a7,_[_0x0658('0x42')](_0x2ce3f4,_0x1adc2f)['toString']()));}exports[_0x0658('0x43')]=getCallerIdRandom;function decrementOriginate(_0x224f5c,_0x58b76d){if(_0x224f5c[_0x0658('0x24')]&&_0x224f5c[_0x0658('0x24')]>0x0){_0x224f5c[_0x0658('0x24')]-=0x1;}else{logger[_0x0658('0x44')](_0x0658('0x45'),_0x58b76d);}}exports[_0x0658('0x46')]=decrementOriginate;function checkContactEmpty(_0x577aa3){return _0x577aa3&&_0x577aa3[_0x0658('0x47')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x5bd71b,_0x25e075){if(_0x25e075===0x0){return 0x0;}var _0x1f0b69=0x1;for(var _0x4dca65=0x1;_0x4dca65<=_0x25e075;_0x4dca65+=0x1){_0x1f0b69=0x1+_0x1f0b69*_0x4dca65/_0x5bd71b;}return 0x1/_0x1f0b69;}exports[_0x0658('0x48')]=erlangb;function checkContactLowerLimitOriginate(_0x3cca45,_0x31006a,_0x44cdcb){if(_0x31006a>_0x44cdcb){for(var _0x1f0a1c=0x0;_0x1f0a1c<_0x31006a-_0x44cdcb;_0x1f0a1c+=0x1){decrementOriginate(_0x3cca45,_0x0658('0x49'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x17e15e){var _0x52e29c={};var _0x21da72=['id',_0x0658('0x4a'),_0x0658('0x4b'),_0x0658('0x4c')];const _0x534482=0xfa;if(_0x17e15e){for(var _0x27a579 in _0x17e15e){if(typeof _0x17e15e[_0x27a579]!==_0x0658('0x4d')){if(!_['isNil'](_0x17e15e[_0x27a579])&&!_0x21da72[_0x0658('0x33')](_0x27a579)){if(_0x27a579==='description'&&_0x17e15e[_0x27a579][_0x0658('0x47')]>_0x534482){_0x52e29c[_0x0658('0x4e')+_0x27a579[_0x0658('0x4f')]()]=_0x17e15e[_0x27a579][_0x0658('0x50')]()[_0x0658('0x51')](0x0,_0x534482);}else{_0x52e29c[_0x0658('0x4e')+_0x27a579['toUpperCase']()]=_0x17e15e[_0x27a579];}}}}}return _0x52e29c;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 7128a4d..d47f1b4 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(_0x2d8b49,_0x267614){var _0xf4cb7=function(_0x2990b2){while(--_0x2990b2){_0x2d8b49['push'](_0x2d8b49['shift']());}};_0xf4cb7(++_0x267614);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0xf0b229,_0x22c8fb){var _0x30482c=function(_0x5942c4){while(--_0x5942c4){_0xf0b229['push'](_0xf0b229['shift']());}};_0x30482c(++_0x22c8fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 9002ed1..d11720f 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 _0x08a2=['receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','\x20syncNewchannel\x20','info','syncVarSet','variable','value','channelstate','syncNewExten','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','name','application/pdf','notify','.pdf','\x20notify\x20','stringify','catch','error','\x20receiveFax\x20','actions','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','message','execute','format','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','bind','newstate','syncNewState','faxstatus','syncFaxStatus'];(function(_0x409c34,_0x34691c){var _0x3f1fc8=function(_0x5dd21a){while(--_0x5dd21a){_0x409c34['push'](_0x409c34['shift']());}};_0x3f1fc8(++_0x34691c);}(_0x08a2,0x1c8));var _0x208a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08a2[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x208a('0x0'));var _=require(_0x208a('0x1'));var BPromise=require(_0x208a('0x2'));var uuid=require(_0x208a('0x3'));var moment=require(_0x208a('0x4'));var path=require(_0x208a('0x5'));var tiff2pdf=require(_0x208a('0x6'));var gs=require(_0x208a('0x7'));var logger=require(_0x208a('0x8'))(_0x208a('0x9'));var ami=require(_0x208a('0xa'));var rpcDb=require(_0x208a('0xb'));var Channel=require(_0x208a('0xc'));var ut=require(_0x208a('0xd'));var Action=require(_0x208a('0xe'));var faxAccount=require(_0x208a('0xf'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x208a('0x10'));function Fax(_0x1ee73f){this[_0x208a('0x11')]={};this[_0x208a('0x12')]=_0x1ee73f[_0x208a('0x12')];this[_0x208a('0x13')]=_0x1ee73f[_0x208a('0x13')];this['actions']={};ami['on'](_0x208a('0x14'),this[_0x208a('0x15')]['bind'](this));ami['on'](_0x208a('0x16'),this['syncVarSet'][_0x208a('0x17')](this));ami['on'](_0x208a('0x18'),this[_0x208a('0x19')][_0x208a('0x17')](this));ami['on']('newexten',this['syncNewExten'][_0x208a('0x17')](this));ami['on'](_0x208a('0x1a'),this[_0x208a('0x1b')][_0x208a('0x17')](this));ami['on'](_0x208a('0x1c'),this[_0x208a('0x1d')][_0x208a('0x17')](this));ami['on']('hangup',this[_0x208a('0x1e')]['bind'](this));ami['on'](_0x208a('0x1f'),this[_0x208a('0x20')][_0x208a('0x17')](this));}Fax[_0x208a('0x21')][_0x208a('0x15')]=function(_0x3ab054){if(_0x3ab054[_0x208a('0x22')]===_0x208a('0x23')){for(var _0x3d947a in this[_0x208a('0x12')]){if(this[_0x208a('0x12')][_0x208a('0x24')](_0x3d947a)){if(_0x3ab054[_0x208a('0x25')]===this['faxAccounts'][_0x3d947a][_0x208a('0x26')]){this[_0x208a('0x11')][_0x3ab054[_0x208a('0x27')]]={};this[_0x208a('0x11')][_0x3ab054[_0x208a('0x27')]][_0x208a('0x28')]=_0x3ab054[_0x208a('0x28')];this['channels'][_0x3ab054[_0x208a('0x27')]]['id']=this[_0x208a('0x12')][_0x3d947a]['id'];this[_0x208a('0x11')][_0x3ab054[_0x208a('0x27')]]['name']=this['faxAccounts'][_0x3d947a]['name'];logger['info'](_0x3ab054[_0x208a('0x27')],_0x208a('0x29'));}}}}if(this['actions'][_0x3ab054['uniqueid']]){this[_0x208a('0x11')][_0x3ab054['uniqueid']]={};this[_0x208a('0x11')][_0x3ab054[_0x208a('0x27')]]['channel']=_0x3ab054['channel'];logger[_0x208a('0x2a')](_0x3ab054[_0x208a('0x27')],_0x208a('0x29'));}};Fax['prototype'][_0x208a('0x2b')]=function(_0x1aede3){if(this[_0x208a('0x11')][_0x1aede3['uniqueid']]){for(var _0x5bbab1 in _0x1aede3[_0x208a('0x2c')]){if(_0x1aede3[_0x208a('0x2c')]['hasOwnProperty'](_0x5bbab1)){this['channels'][_0x1aede3[_0x208a('0x27')]][_0x5bbab1]=_0x1aede3[_0x208a('0x2d')];}}}};Fax[_0x208a('0x21')][_0x208a('0x19')]=function(_0x5dbe1c){if(this[_0x208a('0x11')][_0x5dbe1c['uniqueid']]){this[_0x208a('0x11')][_0x5dbe1c[_0x208a('0x27')]][_0x208a('0x2e')]=_0x5dbe1c[_0x208a('0x2e')];this[_0x208a('0x11')][_0x5dbe1c[_0x208a('0x27')]]['channelstatedesc']=_0x5dbe1c['channelstatedesc'];}};Fax['prototype'][_0x208a('0x2f')]=function(_0x4e56e4){if(this[_0x208a('0x11')][_0x4e56e4['uniqueid']]){for(var _0x59b164 in _0x4e56e4[_0x208a('0x2c')]){if(_0x4e56e4[_0x208a('0x2c')][_0x208a('0x24')](_0x59b164)){this[_0x208a('0x11')][_0x4e56e4[_0x208a('0x27')]][_0x59b164]=_0x4e56e4[_0x208a('0x2d')];}}}};Fax[_0x208a('0x21')]['syncFaxStatus']=function(_0x2d8120){if(this[_0x208a('0x11')][_0x2d8120[_0x208a('0x27')]]){this[_0x208a('0x11')][_0x2d8120['uniqueid']]['operation']=_0x2d8120['operation'];this[_0x208a('0x11')][_0x2d8120['uniqueid']][_0x208a('0x30')]=_0x2d8120[_0x208a('0x30')];this[_0x208a('0x11')][_0x2d8120[_0x208a('0x27')]][_0x208a('0x26')]=_0x2d8120[_0x208a('0x26')];this[_0x208a('0x11')][_0x2d8120[_0x208a('0x27')]]['filename']=_0x2d8120[_0x208a('0x31')];logger['info'](_0x2d8120[_0x208a('0x27')],'\x20syncFaxStatus\x20');}};Fax[_0x208a('0x21')][_0x208a('0x1d')]=function(_0xbb959e){var _0x2cfcea=this;if(this[_0x208a('0x11')][_0xbb959e['uniqueid']]){var _0xeb756f=this[_0x208a('0x11')][_0xbb959e[_0x208a('0x27')]]['id'];this[_0x208a('0x11')][_0xbb959e[_0x208a('0x27')]]['remotestationid']=_0xbb959e[_0x208a('0x32')];this['channels'][_0xbb959e[_0x208a('0x27')]][_0x208a('0x33')]=_0xbb959e['pagestransferred'];this[_0x208a('0x11')][_0xbb959e[_0x208a('0x27')]][_0x208a('0x26')]=_0xbb959e[_0x208a('0x26')];this[_0x208a('0x11')][_0xbb959e[_0x208a('0x27')]][_0x208a('0x34')]=_0xbb959e[_0x208a('0x34')];this[_0x208a('0x11')][_0xbb959e['uniqueid']][_0x208a('0x35')]=_0xbb959e[_0x208a('0x35')];this[_0x208a('0x11')][_0xbb959e['uniqueid']][_0x208a('0x31')]=_0xbb959e[_0x208a('0x31')];this[_0x208a('0x11')][_0xbb959e[_0x208a('0x27')]][_0x208a('0x36')]=_0xbb959e[_0x208a('0x36')];if(this[_0x208a('0x11')][_0xbb959e[_0x208a('0x27')]][_0x208a('0x33')]>0x0){tiff2pdf(_0xbb959e[_0x208a('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x16858f){logger[_0x208a('0x2a')](_0xbb959e[_0x208a('0x27')],_0x208a('0x37'),_0x16858f['message']);attachment[_0x208a('0x38')]({'name':path[_0x208a('0x39')](_0xbb959e[_0x208a('0x31')])[_0x208a('0x3a')],'basename':path[_0x208a('0x39')](_0xbb959e[_0x208a('0x31')])[_0x208a('0x3a')]+'.pdf','type':_0x208a('0x3b')})['then'](function(_0x449fbb){faxAccount[_0x208a('0x3c')](_0xeb756f,{'from':_0xbb959e[_0x208a('0x36')],'mapKey':'fax','body':path[_0x208a('0x39')](_0xbb959e[_0x208a('0x31')])['name']+_0x208a('0x3d'),'AttachmentId':_0x449fbb['id']})['catch'](function(_0x55f039){logger['error'](_0xbb959e[_0x208a('0x27')],_0x208a('0x3e'),JSON[_0x208a('0x3f')](_0x55f039));});})[_0x208a('0x40')](function(_0x5af187){logger[_0x208a('0x41')](_0xbb959e['uniqueid'],_0x208a('0x42'),JSON[_0x208a('0x3f')](_0x5af187));});});}logger[_0x208a('0x2a')](_0xbb959e[_0x208a('0x27')],_0x208a('0x42'));}};Fax[_0x208a('0x21')][_0x208a('0x20')]=function(_0x58b330){if(this[_0x208a('0x43')][_0x58b330['uniqueid']]){_[_0x208a('0x44')](this[_0x208a('0x11')][_0x58b330['uniqueid']],_[_0x208a('0x45')](_0x58b330,[_0x208a('0x46'),_0x208a('0x47')]));}};function updateStatus(_0x5a0afd){if(_0x5a0afd[_0x208a('0x48')]){faxMessage[_0x208a('0x49')](_0x5a0afd[_0x208a('0x48')],{'failMessage':_0x208a('0x4a')})[_0x208a('0x4b')](function(_0x4521e2){ut[_0x208a('0x4c')](_0x208a('0x4d'),_0x4521e2);})['catch'](function(_0x27f8d5){ut[_0x208a('0x4c')](_0x208a('0x4e'),_0x27f8d5);});}else{ut['logger'](_0x208a('0x4f'));}}Fax[_0x208a('0x21')][_0x208a('0x50')]=function(_0x16eebc,_0x59bd1c,_0xdc746){var _0x3f7a8b=this;var _0x338b92={};if(_0x59bd1c){_0x338b92={'read':_0x59bd1c};}else{_0x338b92={'failMessage':_0xdc746};}if(this[_0x208a('0x43')][_0x16eebc]['AttachmentId']){faxMessage[_0x208a('0x49')](this['actions'][_0x16eebc]['AttachmentId'],_0x338b92)['then'](function(_0x51b218){ut[_0x208a('0x4c')]('[Fax][Message][Updated]',_0x51b218);})['catch'](function(_0x3e68d4){ut[_0x208a('0x4c')](_0x208a('0x51'),_0x3e68d4);})[_0x208a('0x52')](function(){delete _0x3f7a8b['channels'][_0x16eebc];delete _0x3f7a8b['actions'][_0x16eebc];});}else{ut[_0x208a('0x4c')](_0x208a('0x53'));this[_0x208a('0x54')](_0x16eebc);delete this[_0x208a('0x43')][_0x16eebc];}};Fax[_0x208a('0x21')][_0x208a('0x1e')]=function(_0x6caa7d){var _0x389cf5=this;if(this[_0x208a('0x11')][_0x6caa7d['uniqueid']]){if(this['actions'][_0x6caa7d[_0x208a('0x27')]]){this[_0x208a('0x11')][_0x6caa7d[_0x208a('0x27')]]['id']=this[_0x208a('0x43')][_0x6caa7d[_0x208a('0x27')]]['id'];this[_0x208a('0x11')][_0x6caa7d[_0x208a('0x27')]]['name']=this['actions'][_0x6caa7d[_0x208a('0x27')]][_0x208a('0x3a')];}logger['info'](_0x6caa7d[_0x208a('0x27')],this[_0x208a('0x43')][_0x6caa7d['uniqueid']]?_0x208a('0x55'):'\x20hangup\x20faxRiceive\x20',JSON[_0x208a('0x3f')](this[_0x208a('0x11')][_0x6caa7d[_0x208a('0x27')]]));if(this['actions'][_0x6caa7d[_0x208a('0x27')]]){if(this[_0x208a('0x11')][_0x6caa7d[_0x208a('0x27')]][_0x208a('0x56')]>0x0&&this[_0x208a('0x11')][_0x6caa7d[_0x208a('0x27')]][_0x208a('0x1a')]===_0x208a('0x57')){this['updateStatus'](_0x6caa7d[_0x208a('0x27')],!![]);}else{this[_0x208a('0x50')](_0x6caa7d[_0x208a('0x27')],![],this[_0x208a('0x11')][_0x6caa7d['uniqueid']][_0x208a('0x58')]?_0x208a('0x59')+this[_0x208a('0x11')][_0x6caa7d[_0x208a('0x27')]][_0x208a('0x58')]:'SENDING\x20FAILED');}}}};Fax[_0x208a('0x21')][_0x208a('0x5a')]=function(_0x5dcfe7){var _0xcf0944=this;return new BPromise(function(_0xfe6ac5,_0x4dea61){_0xcf0944[_0x208a('0x5b')](_0x5dcfe7,_0xcf0944['faxAccounts'][_0x5dcfe7['FaxAccountId']])[_0x208a('0x4b')](function(_0x53c4a9){ut[_0x208a('0x4c')](_0x208a('0x5c'),_0x53c4a9);_0xfe6ac5(ut['message'](_0x208a('0x5d')));})[_0x208a('0x40')](function(_0x3739b5){ut[_0x208a('0x4c')](_0x208a('0x5e'),_0x3739b5);updateStatus(_0x5dcfe7);_0x4dea61(ut['message'](_0x208a('0x5f')));});});};Fax[_0x208a('0x21')][_0x208a('0x60')]=function(_0x576cc2){var _0x32ad25=this;return new BPromise(function(_0x1749f2,_0xabca21){var _0x31e5d4=_0x32ad25[_0x208a('0x61')](_0x32ad25['faxAccounts'][_0x576cc2[_0x208a('0x62')]][_0x208a('0x63')],_0x576cc2);if(_0x31e5d4[_0x208a('0x64')]){_0x1749f2(ut['message']('Trunk\x20Reachable'));}else{_0xabca21(ut['message'](_0x31e5d4[_0x208a('0x65')]));}});};function originate(_0x2ccdbb,_0x47bcde,_0x2146db){return new BPromise(function(_0x569ce1,_0x78dad4){if(_0x2146db){var _0x2274e7=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x208a('0x39')](_0x2ccdbb[_0x208a('0x5')])[_0x208a('0x3a')],_0x2ccdbb[_0x208a('0x5')]);gs[_0x208a('0x66')](_0x2274e7)[_0x208a('0x4b')](function(){_0x2ccdbb[_0x208a('0x5')]=util[_0x208a('0x67')](_0x208a('0x68'),path[_0x208a('0x39')](_0x2ccdbb[_0x208a('0x5')])['dir'],path[_0x208a('0x39')](_0x2ccdbb[_0x208a('0x5')])[_0x208a('0x3a')]);_0x47bcde['XMF-PATH']=_0x2ccdbb[_0x208a('0x5')];ut[_0x208a('0x4c')](_0x208a('0x69'),'');ami[_0x208a('0x6a')](ut[_0x208a('0x6b')](_0x2ccdbb,_0x47bcde))[_0x208a('0x4b')](function(_0x17e1f9){_0x569ce1(_0x17e1f9);})['catch'](function(_0x55a895){_0x78dad4(_0x55a895);});})[_0x208a('0x40')](function(_0x5cda8c){_0x78dad4(_0x5cda8c);});}else{ami[_0x208a('0x6a')](ut[_0x208a('0x6b')](_0x2ccdbb,_0x47bcde))[_0x208a('0x4b')](function(_0x4baa8f){_0x569ce1(_0x4baa8f);})[_0x208a('0x40')](function(_0x332046){_0x78dad4(_0x332046);});}});}Fax[_0x208a('0x21')]['execOriginate']=function(_0x5d828c,_0x2264c9){var _0x24de40=this;return new BPromise(function(_0xedd798,_0x4767ba){var _0x58d928=uuid['v4']();var _0x1fddac=ut[_0x208a('0x6c')](_0x5d828c,_0x2264c9);_0x24de40[_0x208a('0x43')][_0x58d928]=new Action(_0x58d928,_0x2264c9,_0x5d828c);var _0x25dde3=_0x24de40[_0x208a('0x43')][_0x58d928];if(path[_0x208a('0x39')](_0x5d828c[_0x208a('0x5')])[_0x208a('0x6d')]==='.pdf'){originate(_0x25dde3,_0x1fddac,!![])[_0x208a('0x4b')](function(_0x5081f9){_0xedd798(_0x5081f9);})['catch'](function(_0x1b085c){_0x4767ba(_0x1b085c);});}else{originate(_0x25dde3,_0x1fddac,![])[_0x208a('0x4b')](function(_0x38cfd8){_0xedd798(_0x38cfd8);})['catch'](function(_0x11afef){_0x4767ba(_0x11afef);});}});};Fax['prototype']['isTrunkReachable']=function(_0x2345d3){return!_[_0x208a('0x6e')](_0x2345d3)&&!_[_0x208a('0x6e')](_0x2345d3[_0x208a('0x3a')])&&!_[_0x208a('0x6e')](_0x2345d3[_0x208a('0x6f')])&&_0x2345d3[_0x208a('0x6f')]&&!_[_0x208a('0x6e')](this['trunks'][util['format'](_0x208a('0x70'),_0x2345d3[_0x208a('0x3a')])])&&!_[_0x208a('0x6e')](this[_0x208a('0x13')][util[_0x208a('0x67')]('SIP/%s',_0x2345d3['name'])]['status'])&&(this[_0x208a('0x13')][util['format'](_0x208a('0x70'),_0x2345d3['name'])][_0x208a('0x30')]==='reachable'||this[_0x208a('0x13')][util[_0x208a('0x67')](_0x208a('0x70'),_0x2345d3[_0x208a('0x3a')])][_0x208a('0x30')]===_0x208a('0x71'));};Fax[_0x208a('0x21')][_0x208a('0x61')]=function(_0x29367f,_0x54589f){if(!this['isTrunkReachable'](_0x29367f)){ut['logger'](_0x208a('0x72'),_[_0x208a('0x6e')](_0x29367f)?'':_0x29367f[_0x208a('0x3a')]+_0x208a('0x73'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x208a('0x6e')](_0x54589f[_0x208a('0x9')])){ut[_0x208a('0x4c')](_0x208a('0x74'),JSON[_0x208a('0x3f')](_0x54589f));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x54589f['path'])){ut['logger'](_0x208a('0x75'),JSON[_0x208a('0x3f')](_0x54589f));return{'isValid':![],'message':_0x208a('0x76')};}return{'isValid':!![],'message':_0x208a('0x77')};};Fax[_0x208a('0x21')][_0x208a('0x54')]=function(_0x27cda6,_0x471337=0x2710){if(this['channels'][_0x27cda6]){setTimeout(()=>{delete this[_0x208a('0x11')][_0x27cda6];},_0x471337);}};module[_0x208a('0x78')]=Fax; \ No newline at end of file +var _0x7272=['send','FaxAccountId','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','deleteChannelAfterTimeout','exports','util','bluebird','uuid','moment','path','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','syncNewState','channelstate','channelstatedesc','prototype','value','operation','status','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED'];(function(_0xcf22a8,_0x35d51c){var _0x1137eb=function(_0x22bdf6){while(--_0x22bdf6){_0xcf22a8['push'](_0xcf22a8['shift']());}};_0x1137eb(++_0x35d51c);}(_0x7272,0x96));var _0x2727=function(_0x59f55b,_0x438555){_0x59f55b=_0x59f55b-0x0;var _0x2421b3=_0x7272[_0x59f55b];return _0x2421b3;};'use strict';var util=require(_0x2727('0x0'));var _=require('lodash');var BPromise=require(_0x2727('0x1'));var uuid=require(_0x2727('0x2'));var moment=require(_0x2727('0x3'));var path=require(_0x2727('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x2727('0x5'));var ami=require(_0x2727('0x6'));var rpcDb=require(_0x2727('0x7'));var Channel=require('./channel');var ut=require(_0x2727('0x8'));var Action=require(_0x2727('0x9'));var faxAccount=require(_0x2727('0xa'));var attachment=require(_0x2727('0xb'));var faxMessage=require(_0x2727('0xc'));function Fax(_0x2b5472){this[_0x2727('0xd')]={};this[_0x2727('0xe')]=_0x2b5472[_0x2727('0xe')];this[_0x2727('0xf')]=_0x2b5472[_0x2727('0xf')];this[_0x2727('0x10')]={};ami['on'](_0x2727('0x11'),this[_0x2727('0x12')][_0x2727('0x13')](this));ami['on'](_0x2727('0x14'),this[_0x2727('0x15')][_0x2727('0x13')](this));ami['on'](_0x2727('0x16'),this['syncNewState'][_0x2727('0x13')](this));ami['on'](_0x2727('0x17'),this[_0x2727('0x18')]['bind'](this));ami['on'](_0x2727('0x19'),this[_0x2727('0x1a')][_0x2727('0x13')](this));ami['on'](_0x2727('0x1b'),this[_0x2727('0x1c')][_0x2727('0x13')](this));ami['on']('hangup',this[_0x2727('0x1d')][_0x2727('0x13')](this));ami['on'](_0x2727('0x1e'),this[_0x2727('0x1f')][_0x2727('0x13')](this));}Fax['prototype'][_0x2727('0x12')]=function(_0x5caa4a){if(_0x5caa4a['context']===_0x2727('0x20')){for(var _0x348f00 in this[_0x2727('0xe')]){if(this[_0x2727('0xe')]['hasOwnProperty'](_0x348f00)){if(_0x5caa4a[_0x2727('0x21')]===this[_0x2727('0xe')][_0x348f00][_0x2727('0x22')]){this[_0x2727('0xd')][_0x5caa4a[_0x2727('0x23')]]={};this[_0x2727('0xd')][_0x5caa4a[_0x2727('0x23')]][_0x2727('0x24')]=_0x5caa4a[_0x2727('0x24')];this[_0x2727('0xd')][_0x5caa4a['uniqueid']]['id']=this['faxAccounts'][_0x348f00]['id'];this[_0x2727('0xd')][_0x5caa4a[_0x2727('0x23')]][_0x2727('0x25')]=this[_0x2727('0xe')][_0x348f00]['name'];logger[_0x2727('0x26')](_0x5caa4a[_0x2727('0x23')],_0x2727('0x27'));}}}}if(this[_0x2727('0x10')][_0x5caa4a[_0x2727('0x23')]]){this[_0x2727('0xd')][_0x5caa4a[_0x2727('0x23')]]={};this[_0x2727('0xd')][_0x5caa4a[_0x2727('0x23')]]['channel']=_0x5caa4a[_0x2727('0x24')];logger[_0x2727('0x26')](_0x5caa4a[_0x2727('0x23')],'\x20syncNewchannel\x20');}};Fax['prototype']['syncVarSet']=function(_0x49184c){if(this[_0x2727('0xd')][_0x49184c[_0x2727('0x23')]]){for(var _0x4568f0 in _0x49184c[_0x2727('0x28')]){if(_0x49184c[_0x2727('0x28')][_0x2727('0x29')](_0x4568f0)){this[_0x2727('0xd')][_0x49184c[_0x2727('0x23')]][_0x4568f0]=_0x49184c['value'];}}}};Fax['prototype'][_0x2727('0x2a')]=function(_0x4791ee){if(this[_0x2727('0xd')][_0x4791ee['uniqueid']]){this[_0x2727('0xd')][_0x4791ee['uniqueid']][_0x2727('0x2b')]=_0x4791ee[_0x2727('0x2b')];this[_0x2727('0xd')][_0x4791ee[_0x2727('0x23')]][_0x2727('0x2c')]=_0x4791ee['channelstatedesc'];}};Fax[_0x2727('0x2d')][_0x2727('0x18')]=function(_0x48eaa2){if(this['channels'][_0x48eaa2[_0x2727('0x23')]]){for(var _0x9db77f in _0x48eaa2[_0x2727('0x28')]){if(_0x48eaa2['variable'][_0x2727('0x29')](_0x9db77f)){this[_0x2727('0xd')][_0x48eaa2['uniqueid']][_0x9db77f]=_0x48eaa2[_0x2727('0x2e')];}}}};Fax[_0x2727('0x2d')][_0x2727('0x1a')]=function(_0x5c2da5){if(this[_0x2727('0xd')][_0x5c2da5['uniqueid']]){this['channels'][_0x5c2da5[_0x2727('0x23')]][_0x2727('0x2f')]=_0x5c2da5[_0x2727('0x2f')];this[_0x2727('0xd')][_0x5c2da5['uniqueid']]['status']=_0x5c2da5[_0x2727('0x30')];this[_0x2727('0xd')][_0x5c2da5['uniqueid']][_0x2727('0x22')]=_0x5c2da5[_0x2727('0x22')];this[_0x2727('0xd')][_0x5c2da5[_0x2727('0x23')]]['filename']=_0x5c2da5['filename'];logger['info'](_0x5c2da5[_0x2727('0x23')],_0x2727('0x31'));}};Fax[_0x2727('0x2d')][_0x2727('0x1c')]=function(_0x3fad81){var _0x14f780=this;if(this[_0x2727('0xd')][_0x3fad81[_0x2727('0x23')]]){var _0x4d7e35=this[_0x2727('0xd')][_0x3fad81['uniqueid']]['id'];this['channels'][_0x3fad81['uniqueid']]['remotestationid']=_0x3fad81[_0x2727('0x32')];this[_0x2727('0xd')][_0x3fad81[_0x2727('0x23')]][_0x2727('0x33')]=_0x3fad81[_0x2727('0x33')];this['channels'][_0x3fad81['uniqueid']]['localstationid']=_0x3fad81[_0x2727('0x22')];this['channels'][_0x3fad81['uniqueid']][_0x2727('0x34')]=_0x3fad81[_0x2727('0x34')];this['channels'][_0x3fad81[_0x2727('0x23')]][_0x2727('0x35')]=_0x3fad81[_0x2727('0x35')];this[_0x2727('0xd')][_0x3fad81['uniqueid']][_0x2727('0x36')]=_0x3fad81['filename'];this[_0x2727('0xd')][_0x3fad81[_0x2727('0x23')]]['calleridnum']=_0x3fad81[_0x2727('0x37')];if(this['channels'][_0x3fad81['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x3fad81[_0x2727('0x36')],_0x2727('0x38'),function(_0x37bb4e){logger[_0x2727('0x26')](_0x3fad81[_0x2727('0x23')],_0x2727('0x39'),_0x37bb4e[_0x2727('0x3a')]);attachment['create']({'name':path['parse'](_0x3fad81[_0x2727('0x36')])[_0x2727('0x25')],'basename':path[_0x2727('0x3b')](_0x3fad81[_0x2727('0x36')])[_0x2727('0x25')]+_0x2727('0x3c'),'type':'application/pdf'})[_0x2727('0x3d')](function(_0x2f4c77){faxAccount[_0x2727('0x3e')](_0x4d7e35,{'from':_0x3fad81['calleridnum'],'mapKey':_0x2727('0x5'),'body':path[_0x2727('0x3b')](_0x3fad81[_0x2727('0x36')])[_0x2727('0x25')]+_0x2727('0x3c'),'AttachmentId':_0x2f4c77['id']})[_0x2727('0x3f')](function(_0x125ee0){logger[_0x2727('0x40')](_0x3fad81[_0x2727('0x23')],_0x2727('0x41'),JSON[_0x2727('0x42')](_0x125ee0));});})[_0x2727('0x3f')](function(_0x2a3d8f){logger[_0x2727('0x40')](_0x3fad81[_0x2727('0x23')],_0x2727('0x43'),JSON[_0x2727('0x42')](_0x2a3d8f));});});}logger[_0x2727('0x26')](_0x3fad81[_0x2727('0x23')],_0x2727('0x43'));}};Fax[_0x2727('0x2d')]['syncOriginateResponse']=function(_0xc52879){if(this[_0x2727('0x10')][_0xc52879[_0x2727('0x23')]]){_['merge'](this['channels'][_0xc52879[_0x2727('0x23')]],_[_0x2727('0x44')](_0xc52879,['response',_0x2727('0x45')]));}};function updateStatus(_0x3b8d2c){if(_0x3b8d2c[_0x2727('0x46')]){faxMessage['update'](_0x3b8d2c[_0x2727('0x46')],{'failMessage':_0x2727('0x47')})[_0x2727('0x3d')](function(_0x4626fb){ut[_0x2727('0x48')](_0x2727('0x49'),_0x4626fb);})[_0x2727('0x3f')](function(_0x5e6028){ut[_0x2727('0x48')](_0x2727('0x4a'),_0x5e6028);});}else{ut[_0x2727('0x48')](_0x2727('0x4b'));}}Fax['prototype'][_0x2727('0x4c')]=function(_0x4828a2,_0x3fd14b,_0x3595fa){var _0x357aee=this;var _0x333f07={};if(_0x3fd14b){_0x333f07={'read':_0x3fd14b};}else{_0x333f07={'failMessage':_0x3595fa};}if(this[_0x2727('0x10')][_0x4828a2][_0x2727('0x46')]){faxMessage[_0x2727('0x4d')](this[_0x2727('0x10')][_0x4828a2][_0x2727('0x46')],_0x333f07)[_0x2727('0x3d')](function(_0x62282d){ut[_0x2727('0x48')](_0x2727('0x4e'),_0x62282d);})[_0x2727('0x3f')](function(_0x1b8868){ut['logger'](_0x2727('0x4f'),_0x1b8868);})[_0x2727('0x50')](function(){delete _0x357aee[_0x2727('0xd')][_0x4828a2];delete _0x357aee['actions'][_0x4828a2];});}else{ut[_0x2727('0x48')]('[Fax][Message][NoUpdate2]');this['deleteChannelAfterTimeout'](_0x4828a2);delete this[_0x2727('0x10')][_0x4828a2];}};Fax[_0x2727('0x2d')][_0x2727('0x1d')]=function(_0x1aec2c){var _0x451b6f=this;if(this[_0x2727('0xd')][_0x1aec2c[_0x2727('0x23')]]){if(this['actions'][_0x1aec2c[_0x2727('0x23')]]){this[_0x2727('0xd')][_0x1aec2c['uniqueid']]['id']=this[_0x2727('0x10')][_0x1aec2c[_0x2727('0x23')]]['id'];this[_0x2727('0xd')][_0x1aec2c[_0x2727('0x23')]]['name']=this[_0x2727('0x10')][_0x1aec2c['uniqueid']]['name'];}logger['info'](_0x1aec2c[_0x2727('0x23')],this['actions'][_0x1aec2c[_0x2727('0x23')]]?_0x2727('0x51'):_0x2727('0x52'),JSON[_0x2727('0x42')](this[_0x2727('0xd')][_0x1aec2c['uniqueid']]));if(this[_0x2727('0x10')][_0x1aec2c[_0x2727('0x23')]]){if(this[_0x2727('0xd')][_0x1aec2c[_0x2727('0x23')]][_0x2727('0x53')]>0x0&&this['channels'][_0x1aec2c[_0x2727('0x23')]][_0x2727('0x19')]===_0x2727('0x54')){this[_0x2727('0x4c')](_0x1aec2c['uniqueid'],!![]);}else{this['updateStatus'](_0x1aec2c[_0x2727('0x23')],![],this['channels'][_0x1aec2c[_0x2727('0x23')]]['faxstatusstring']?_0x2727('0x55')+this[_0x2727('0xd')][_0x1aec2c[_0x2727('0x23')]][_0x2727('0x56')]:_0x2727('0x57'));}}}};Fax[_0x2727('0x2d')][_0x2727('0x58')]=function(_0x54a056){var _0x187803=this;return new BPromise(function(_0x5bce2e,_0x361609){_0x187803['execOriginate'](_0x54a056,_0x187803['faxAccounts'][_0x54a056[_0x2727('0x59')]])['then'](function(_0x9bf076){ut['logger']('[Fax][execOriginate][success]',_0x9bf076);_0x5bce2e(ut[_0x2727('0x3a')]('Fax\x20received'));})[_0x2727('0x3f')](function(_0x4f3352){ut[_0x2727('0x48')](_0x2727('0x5a'),_0x4f3352);updateStatus(_0x54a056);_0x361609(ut[_0x2727('0x3a')]('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x186441){var _0x32e9f8=this;return new BPromise(function(_0x1debb6,_0x2d704b){var _0x32e0e0=_0x32e9f8[_0x2727('0x5b')](_0x32e9f8[_0x2727('0xe')][_0x186441[_0x2727('0x59')]][_0x2727('0x5c')],_0x186441);if(_0x32e0e0[_0x2727('0x5d')]){_0x1debb6(ut['message'](_0x2727('0x5e')));}else{_0x2d704b(ut[_0x2727('0x3a')](_0x32e0e0[_0x2727('0x3a')]));}});};function originate(_0x19120f,_0x1576cc,_0xa434d9){return new BPromise(function(_0xf720d,_0x31f846){if(_0xa434d9){var _0x35d7c6=util[_0x2727('0x5f')](_0x2727('0x60'),path[_0x2727('0x3b')](_0x19120f[_0x2727('0x4')])[_0x2727('0x25')],_0x19120f['path']);gs[_0x2727('0x61')](_0x35d7c6)[_0x2727('0x3d')](function(){_0x19120f['path']=util[_0x2727('0x5f')](_0x2727('0x62'),path[_0x2727('0x3b')](_0x19120f['path'])['dir'],path['parse'](_0x19120f[_0x2727('0x4')])[_0x2727('0x25')]);_0x1576cc['XMF-PATH']=_0x19120f[_0x2727('0x4')];ut[_0x2727('0x48')](_0x2727('0x63'),'');ami[_0x2727('0x64')](ut[_0x2727('0x65')](_0x19120f,_0x1576cc))['then'](function(_0x378957){_0xf720d(_0x378957);})[_0x2727('0x3f')](function(_0x1ef063){_0x31f846(_0x1ef063);});})[_0x2727('0x3f')](function(_0x58f849){_0x31f846(_0x58f849);});}else{ami[_0x2727('0x64')](ut['variablesAction'](_0x19120f,_0x1576cc))['then'](function(_0x31535d){_0xf720d(_0x31535d);})[_0x2727('0x3f')](function(_0x1bf1c4){_0x31f846(_0x1bf1c4);});}});}Fax['prototype'][_0x2727('0x66')]=function(_0x36fe97,_0x3adb1d){var _0x382e94=this;return new BPromise(function(_0x2049e7,_0x113e9d){var _0x28833e=uuid['v4']();var _0x23c94b=ut[_0x2727('0x67')](_0x36fe97,_0x3adb1d);_0x382e94[_0x2727('0x10')][_0x28833e]=new Action(_0x28833e,_0x3adb1d,_0x36fe97);var _0x4cd092=_0x382e94[_0x2727('0x10')][_0x28833e];if(path['parse'](_0x36fe97[_0x2727('0x4')])[_0x2727('0x68')]===_0x2727('0x3c')){originate(_0x4cd092,_0x23c94b,!![])[_0x2727('0x3d')](function(_0x4ad6ce){_0x2049e7(_0x4ad6ce);})['catch'](function(_0x2f4635){_0x113e9d(_0x2f4635);});}else{originate(_0x4cd092,_0x23c94b,![])[_0x2727('0x3d')](function(_0x235fdc){_0x2049e7(_0x235fdc);})[_0x2727('0x3f')](function(_0x523308){_0x113e9d(_0x523308);});}});};Fax[_0x2727('0x2d')][_0x2727('0x69')]=function(_0x42f983){return!_[_0x2727('0x6a')](_0x42f983)&&!_[_0x2727('0x6a')](_0x42f983[_0x2727('0x25')])&&!_['isNil'](_0x42f983[_0x2727('0x6b')])&&_0x42f983[_0x2727('0x6b')]&&!_['isNil'](this[_0x2727('0xf')][util[_0x2727('0x5f')](_0x2727('0x6c'),_0x42f983[_0x2727('0x25')])])&&!_[_0x2727('0x6a')](this['trunks'][util[_0x2727('0x5f')]('SIP/%s',_0x42f983['name'])][_0x2727('0x30')])&&(this[_0x2727('0xf')][util['format'](_0x2727('0x6c'),_0x42f983[_0x2727('0x25')])]['status']===_0x2727('0x6d')||this[_0x2727('0xf')][util['format']('SIP/%s',_0x42f983[_0x2727('0x25')])][_0x2727('0x30')]===_0x2727('0x6e'));};Fax['prototype'][_0x2727('0x5b')]=function(_0x48cb5e,_0x122f7){if(!this[_0x2727('0x69')](_0x48cb5e)){ut[_0x2727('0x48')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x2727('0x6a')](_0x48cb5e)?'':_0x48cb5e[_0x2727('0x25')]+_0x2727('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x2727('0x6a')](_0x122f7['fax'])){ut[_0x2727('0x48')](_0x2727('0x70'),JSON[_0x2727('0x42')](_0x122f7));return{'isValid':![],'message':_0x2727('0x71')};}if(_['isNil'](_0x122f7[_0x2727('0x4')])){ut[_0x2727('0x48')](_0x2727('0x72'),JSON[_0x2727('0x42')](_0x122f7));return{'isValid':![],'message':_0x2727('0x73')};}return{'isValid':!![],'message':_0x2727('0x74')};};Fax['prototype'][_0x2727('0x75')]=function(_0x3773f6,_0x12a02b=0x2710){if(this[_0x2727('0xd')][_0x3773f6]){setTimeout(()=>{delete this['channels'][_0x3773f6];},_0x12a02b);}};module[_0x2727('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index cc67a8e..6b69acc 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 _0xe0be=['bluebird','../../../config/logger','lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x144f90,_0x564002){var _0xbb4bc8=function(_0x40e137){while(--_0x40e137){_0x144f90['push'](_0x144f90['shift']());}};_0xbb4bc8(++_0x564002);}(_0xe0be,0x180));var _0xee0b=function(_0x5d274c,_0x452902){_0x5d274c=_0x5d274c-0x0;var _0x2922e3=_0xe0be[_0x5d274c];return _0x2922e3;};'use strict';var util=require(_0xee0b('0x0'));var BPromise=require(_0xee0b('0x1'));var logger=require(_0xee0b('0x2'))('preview');var _=require(_0xee0b('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x14c3b5){return function(_0x28978a){logger[_0xee0b('0x4')](_0x14c3b5,util[_0xee0b('0x5')](_0x28978a,{'showHidden':![],'depth':null}));};}exports[_0xee0b('0x6')]=function(_0x2b2f7f,_0x4819e1){return BPromise[_0xee0b('0x7')]()[_0xee0b('0x8')](faxAccount[_0xee0b('0x6')](_0x2b2f7f,_0x4819e1))[_0xee0b('0x9')](loggerCatch(_0xee0b('0xa')));}; \ No newline at end of file +var _0x6189=['inspect','notify','resolve','then','catch','[Notify]\x20','bluebird','preview','lodash','../rpc/faxAccount'];(function(_0x5b12cc,_0x20fcef){var _0xc4067=function(_0x4ae535){while(--_0x4ae535){_0x5b12cc['push'](_0x5b12cc['shift']());}};_0xc4067(++_0x20fcef);}(_0x6189,0x178));var _0x9618=function(_0x3fb822,_0x1c048b){_0x3fb822=_0x3fb822-0x0;var _0x5da1c7=_0x6189[_0x3fb822];return _0x5da1c7;};'use strict';var util=require('util');var BPromise=require(_0x9618('0x0'));var logger=require('../../../config/logger')(_0x9618('0x1'));var _=require(_0x9618('0x2'));var faxAccount=require(_0x9618('0x3'));function loggerCatch(_0x33ae8f){return function(_0x2e0843){logger['error'](_0x33ae8f,util[_0x9618('0x4')](_0x2e0843,{'showHidden':![],'depth':null}));};}exports[_0x9618('0x5')]=function(_0x562672,_0x2ea614){return BPromise[_0x9618('0x6')]()[_0x9618('0x7')](faxAccount[_0x9618('0x5')](_0x562672,_0x2ea614))[_0x9618('0x8')](loggerCatch(_0x9618('0x9')));}; \ 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 39bae10..4814a43 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 _0x6dbe=['child_process','execute','info','Exec\x20gs','../../../../config/logger','fax','bluebird'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x6dbe,0x131));var _0xe6db=function(_0x43dae0,_0x456edc){_0x43dae0=_0x43dae0-0x0;var _0x153078=_0x6dbe[_0x43dae0];return _0x153078;};'use strict';var util=require('util');var logger=require(_0xe6db('0x0'))(_0xe6db('0x1'));var BPromise=require(_0xe6db('0x2'));var exec=require(_0xe6db('0x3'))['exec'];exports[_0xe6db('0x4')]=function(_0x381bc9){return new BPromise(function(_0x35016b,_0x515214){exec(_0x381bc9,function(_0x4440e8,_0x4f7405,_0x55af6c){logger[_0xe6db('0x5')](_0xe6db('0x6'),_0x4f7405);if(_0x4440e8){logger[_0xe6db('0x5')](_0xe6db('0x6'),'\x20Error\x20:',util['inspect'](_0x4440e8,{'showHidden':![],'depth':null}),_0x4f7405,_0x55af6c);_0x515214(_0x4440e8);}_0x35016b(_0x4f7405);});});}; \ No newline at end of file +var _0x84cd=['\x20Error\x20:','inspect','util','child_process','exec','execute','info','Exec\x20gs'];(function(_0x43e504,_0x10ba5f){var _0x42f5ae=function(_0x5f02e7){while(--_0x5f02e7){_0x43e504['push'](_0x43e504['shift']());}};_0x42f5ae(++_0x10ba5f);}(_0x84cd,0xb2));var _0xd84c=function(_0x177678,_0x35dc49){_0x177678=_0x177678-0x0;var _0x517078=_0x84cd[_0x177678];return _0x517078;};'use strict';var util=require(_0xd84c('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require('bluebird');var exec=require(_0xd84c('0x1'))[_0xd84c('0x2')];exports[_0xd84c('0x3')]=function(_0x4bd80b){return new BPromise(function(_0x32e9c7,_0x49f2ef){exec(_0x4bd80b,function(_0x5760ad,_0x152ff9,_0x421b38){logger[_0xd84c('0x4')](_0xd84c('0x5'),_0x152ff9);if(_0x5760ad){logger[_0xd84c('0x4')](_0xd84c('0x5'),_0xd84c('0x6'),util[_0xd84c('0x7')](_0x5760ad,{'showHidden':![],'depth':null}),_0x152ff9,_0x421b38);_0x49f2ef(_0x5760ad);}_0x32e9c7(_0x152ff9);});});}; \ 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 d014d4b..e1431ba 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 _0x2029=['uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','fax','message','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','faxdetect','t38timeout','localstationid','path'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2029,0xb5));var _0x9202=function(_0x511a93,_0x2bb98b){_0x511a93=_0x511a93-0x0;var _0x359b58=_0x2029[_0x511a93];return _0x359b58;};'use strict';var util=require('util');var _=require(_0x9202('0x0'));var moment=require('moment');var logger=require(_0x9202('0x1'))(_0x9202('0x2'));exports[_0x9202('0x3')]=function(_0x249104){return{'message':_0x249104};};exports[_0x9202('0x4')]=function(_0x3bb87b,_0x4ccb2d){logger[_0x9202('0x5')](_0x3bb87b,util[_0x9202('0x6')](_0x4ccb2d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4f232f,_0x2cdd97){var _0x45f923={'XMF-ECM':_0x2cdd97[_0x9202('0x7')],'XMF-HEADERINFO':_0x2cdd97[_0x9202('0x8')],'XMF-MINRATE':_0x2cdd97[_0x9202('0x9')],'XMF-MAXRATE':_0x2cdd97[_0x9202('0xa')],'XMF-MODEM':util[_0x9202('0xb')](_0x9202('0xc'),_0x2cdd97['modem']),'XMF-GATEWAY':_0x2cdd97['gateway'],'XMF-FAXDETECT':_0x2cdd97[_0x9202('0xd')],'XMF-T38TIMEOUT':_0x2cdd97[_0x9202('0xe')],'XMF-LOCALSTATIONID':_0x2cdd97[_0x9202('0xf')],'XMF-PATH':_0x4f232f[_0x9202('0x10')]};return _0x45f923;};exports['variablesAction']=function(_0x3968ed,_0x16f375){return{'actionid':_0x3968ed[_0x9202('0x11')],'action':_0x9202('0x12'),'channel':_0x3968ed[_0x9202('0x13')],'Exten':'xcally-motion-fax','Context':_0x9202('0x14'),'Priority':'1','callerid':util[_0x9202('0xb')](_0x9202('0x15'),_0x3968ed[_0x9202('0x8')]?_0x3968ed['headerinfo']:'',_0x3968ed[_0x9202('0xf')]),'variable':_0x16f375,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3968ed[_0x9202('0x11')]};}; \ No newline at end of file +var _0x23b7=['../../../../config/logger','fax','message','logger','inspect','addVariables','minrate','maxrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','format','headerinfo','util','lodash','moment'];(function(_0x374428,_0x1e9d4b){var _0x4ec1f5=function(_0x18a3ba){while(--_0x18a3ba){_0x374428['push'](_0x374428['shift']());}};_0x4ec1f5(++_0x1e9d4b);}(_0x23b7,0x17d));var _0x723b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x23b7[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x723b('0x0'));var _=require(_0x723b('0x1'));var moment=require(_0x723b('0x2'));var logger=require(_0x723b('0x3'))(_0x723b('0x4'));exports[_0x723b('0x5')]=function(_0x416896){return{'message':_0x416896};};exports[_0x723b('0x6')]=function(_0x383cce,_0x45dbe1){logger['info'](_0x383cce,util[_0x723b('0x7')](_0x45dbe1,{'showHidden':![],'depth':null}));};exports[_0x723b('0x8')]=function(_0x3d1f9e,_0xd8201e){var _0x4eae5d={'XMF-ECM':_0xd8201e['ecm'],'XMF-HEADERINFO':_0xd8201e['headerinfo'],'XMF-MINRATE':_0xd8201e[_0x723b('0x9')],'XMF-MAXRATE':_0xd8201e[_0x723b('0xa')],'XMF-MODEM':util['format'](_0x723b('0xb'),_0xd8201e['modem']),'XMF-GATEWAY':_0xd8201e[_0x723b('0xc')],'XMF-FAXDETECT':_0xd8201e[_0x723b('0xd')],'XMF-T38TIMEOUT':_0xd8201e[_0x723b('0xe')],'XMF-LOCALSTATIONID':_0xd8201e[_0x723b('0xf')],'XMF-PATH':_0x3d1f9e[_0x723b('0x10')]};return _0x4eae5d;};exports[_0x723b('0x11')]=function(_0xe6a800,_0x365426){return{'actionid':_0xe6a800[_0x723b('0x12')],'action':_0x723b('0x13'),'channel':_0xe6a800[_0x723b('0x14')],'Exten':_0x723b('0x15'),'Context':'from-sip','Priority':'1','callerid':util[_0x723b('0x16')]('\x22%s\x22\x20<%s>',_0xe6a800['headerinfo']?_0xe6a800[_0x723b('0x17')]:'',_0xe6a800[_0x723b('0xf')]),'variable':_0x365426,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xe6a800[_0x723b('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 0041ad6..071811f 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 _0x8866=['initAgents','getTelephones','initTelephones','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','catch','[index.js][main]','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then'];(function(_0x4e7af4,_0x758572){var _0x2548f1=function(_0xa849c){while(--_0xa849c){_0x4e7af4['push'](_0x4e7af4['shift']());}};_0x2548f1(++_0x758572);}(_0x8866,0x1e5));var _0x6886=function(_0x4ba9ce,_0x2d01e2){_0x4ba9ce=_0x4ba9ce-0x0;var _0x39824d=_0x8866[_0x4ba9ce];return _0x39824d;};'use strict';var util=require(_0x6886('0x0'));var moment=require(_0x6886('0x1'));var server=require(_0x6886('0x2'));var Realtime=require(_0x6886('0x3'));var Report=require(_0x6886('0x4'));var Acw=require('./acw');var Trigger=require(_0x6886('0x5'));var Dialer=require(_0x6886('0x6'));var Preview=require(_0x6886('0x7'));var Fax=require(_0x6886('0x8'));var user=require(_0x6886('0x9'));var voiceQueue=require(_0x6886('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x6886('0xb'));var trunk=require(_0x6886('0xc'));var trigger=require(_0x6886('0xd'));var template=require(_0x6886('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x6886('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x6886('0x10'));var sugarcrm=require(_0x6886('0x11'));var freshdesk=require(_0x6886('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x6886('0x13'));var vtiger=require(_0x6886('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x6886('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x6886('0x16'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6886('0x17')](_0x6886('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6886('0x17')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x6886('0x19')]()[_0x6886('0x1a')](user['getAgents']())[_0x6886('0x1a')](realtime[_0x6886('0x1b')]())[_0x6886('0x1a')](user[_0x6886('0x1c')]())[_0x6886('0x1a')](realtime[_0x6886('0x1d')]())[_0x6886('0x1a')](trunk['getTrunks']())[_0x6886('0x1a')](realtime['initTrunks']())[_0x6886('0x1a')](voiceQueue['getVoiceQueues']())[_0x6886('0x1a')](realtime[_0x6886('0x1e')]())[_0x6886('0x1a')](trigger[_0x6886('0x1f')]())[_0x6886('0x1a')](realtime[_0x6886('0x20')]())[_0x6886('0x1a')](template[_0x6886('0x21')]())[_0x6886('0x1a')](realtime[_0x6886('0x22')]())['then'](zendesk[_0x6886('0x23')]())[_0x6886('0x1a')](realtime['initZendeskAccounts']())[_0x6886('0x1a')](salesforce['getSalesforceAccounts']())[_0x6886('0x1a')](realtime['initSalesforceAccounts']())[_0x6886('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x6886('0x1a')](realtime['initSugarcrmAccounts']())[_0x6886('0x1a')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x6886('0x24')]())['then'](desk[_0x6886('0x25')]())['then'](realtime[_0x6886('0x26')]())[_0x6886('0x1a')](zoho[_0x6886('0x27')]())[_0x6886('0x1a')](realtime[_0x6886('0x28')]())[_0x6886('0x1a')](vtiger[_0x6886('0x29')]())[_0x6886('0x1a')](realtime[_0x6886('0x2a')]())[_0x6886('0x1a')](freshsales[_0x6886('0x2b')]())[_0x6886('0x1a')](realtime[_0x6886('0x2c')]())['then'](servicenow['getServicenowAccounts']())[_0x6886('0x1a')](realtime[_0x6886('0x2d')]())[_0x6886('0x1a')](dynamics365[_0x6886('0x2e')]())[_0x6886('0x1a')](realtime['initDynamics365Accounts']())[_0x6886('0x1a')](campaign[_0x6886('0x2f')]())[_0x6886('0x1a')](realtime[_0x6886('0x30')]())['then'](voiceExtension['getVoiceExtensions']())[_0x6886('0x1a')](realtime[_0x6886('0x31')]())['then'](faxAccount[_0x6886('0x32')]())[_0x6886('0x1a')](realtime[_0x6886('0x33')]())[_0x6886('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x6886('0x19')]()['then'](voiceQueueReport[_0x6886('0x34')]())[_0x6886('0x1a')](realtime[_0x6886('0x35')]())[_0x6886('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x6886('0x1a')](realtime[_0x6886('0x36')]())[_0x6886('0x1a')](cmHopperHistory[_0x6886('0x37')]())[_0x6886('0x1a')](realtime[_0x6886('0x38')]())[_0x6886('0x1a')](voiceCallReport[_0x6886('0x39')]())[_0x6886('0x1a')](realtime[_0x6886('0x3a')]())['catch'](function(_0x856a93){logger[_0x6886('0x3b')](_0x6886('0x3c'),util[_0x6886('0x3d')](_0x856a93,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x6886('0x1a')](function(){return initParams();})[_0x6886('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x6886('0x3e')](function(_0x86f832){logger[_0x6886('0x3b')](_0x6886('0x3f'),util['inspect'](_0x86f832,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x2e64=['initVoiceExtensions','getFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','inspect','listen','[index.js][main]','util','moment','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions'];(function(_0x4478eb,_0x34481b){var _0x2b9d20=function(_0x2e8d44){while(--_0x2e8d44){_0x4478eb['push'](_0x4478eb['shift']());}};_0x2b9d20(++_0x34481b);}(_0x2e64,0x167));var _0x42e6=function(_0x2551f1,_0x107fbd){_0x2551f1=_0x2551f1-0x0;var _0x5c56ff=_0x2e64[_0x2551f1];return _0x5c56ff;};'use strict';var util=require(_0x42e6('0x0'));var moment=require(_0x42e6('0x1'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x42e6('0x2'));var Acw=require(_0x42e6('0x3'));var Trigger=require(_0x42e6('0x4'));var Dialer=require(_0x42e6('0x5'));var Preview=require(_0x42e6('0x6'));var Fax=require('./fax');var user=require(_0x42e6('0x7'));var voiceQueue=require(_0x42e6('0x8'));var voiceQueueReport=require(_0x42e6('0x9'));var voiceCallReport=require(_0x42e6('0xa'));var trunk=require(_0x42e6('0xb'));var trigger=require(_0x42e6('0xc'));var template=require(_0x42e6('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x42e6('0xe'));var salesforce=require(_0x42e6('0xf'));var sugarcrm=require(_0x42e6('0x10'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x42e6('0x11'));var zoho=require(_0x42e6('0x12'));var vtiger=require(_0x42e6('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x42e6('0x14'));var dynamics365=require(_0x42e6('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x42e6('0x16'))(_0x42e6('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x42e6('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x42e6('0x18')](_0x42e6('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x42e6('0x1a')]()[_0x42e6('0x1b')](user['getAgents']())[_0x42e6('0x1b')](realtime[_0x42e6('0x1c')]())['then'](user[_0x42e6('0x1d')]())[_0x42e6('0x1b')](realtime['initTelephones']())[_0x42e6('0x1b')](trunk['getTrunks']())[_0x42e6('0x1b')](realtime['initTrunks']())['then'](voiceQueue['getVoiceQueues']())[_0x42e6('0x1b')](realtime[_0x42e6('0x1e')]())[_0x42e6('0x1b')](trigger[_0x42e6('0x1f')]())['then'](realtime[_0x42e6('0x20')]())[_0x42e6('0x1b')](template[_0x42e6('0x21')]())['then'](realtime[_0x42e6('0x22')]())[_0x42e6('0x1b')](zendesk[_0x42e6('0x23')]())[_0x42e6('0x1b')](realtime['initZendeskAccounts']())[_0x42e6('0x1b')](salesforce['getSalesforceAccounts']())['then'](realtime['initSalesforceAccounts']())[_0x42e6('0x1b')](sugarcrm['getSugarcrmAccounts']())[_0x42e6('0x1b')](realtime[_0x42e6('0x24')]())[_0x42e6('0x1b')](freshdesk['getFreshdeskAccounts']())[_0x42e6('0x1b')](realtime[_0x42e6('0x25')]())[_0x42e6('0x1b')](desk['getDeskAccounts']())[_0x42e6('0x1b')](realtime[_0x42e6('0x26')]())[_0x42e6('0x1b')](zoho[_0x42e6('0x27')]())['then'](realtime['initZohoAccounts']())[_0x42e6('0x1b')](vtiger['getVtigerAccounts']())[_0x42e6('0x1b')](realtime['initVtigerAccounts']())['then'](freshsales['getFreshsalesAccounts']())[_0x42e6('0x1b')](realtime[_0x42e6('0x28')]())[_0x42e6('0x1b')](servicenow['getServicenowAccounts']())[_0x42e6('0x1b')](realtime[_0x42e6('0x29')]())['then'](dynamics365[_0x42e6('0x2a')]())[_0x42e6('0x1b')](realtime[_0x42e6('0x2b')]())['then'](campaign[_0x42e6('0x2c')]())[_0x42e6('0x1b')](realtime[_0x42e6('0x2d')]())['then'](voiceExtension[_0x42e6('0x2e')]())['then'](realtime[_0x42e6('0x2f')]())[_0x42e6('0x1b')](faxAccount[_0x42e6('0x30')]())[_0x42e6('0x1b')](realtime['initFaxAccounts']())[_0x42e6('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x42e6('0x1a')]()[_0x42e6('0x1b')](voiceQueueReport['getVoiceQueueReports']())[_0x42e6('0x1b')](realtime[_0x42e6('0x31')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x42e6('0x32')]())[_0x42e6('0x1b')](cmHopperHistory['getCampaignHopperHistory']())[_0x42e6('0x1b')](realtime[_0x42e6('0x33')]())['then'](voiceCallReport[_0x42e6('0x34')]())['then'](realtime[_0x42e6('0x35')]())[_0x42e6('0x36')](function(_0x4de102){logger['error']('[index.js][initParams]',util[_0x42e6('0x37')](_0x4de102,{'showHidden':![],'depth':null}));});}function main(){return server[_0x42e6('0x38')](realtime,preview,fax)[_0x42e6('0x1b')](function(){return initRealtime();})[_0x42e6('0x1b')](function(){return initParams();})[_0x42e6('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x42e6('0x36')](function(_0x2f8886){logger['error'](_0x42e6('0x39'),util[_0x42e6('0x37')](_0x2f8886,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 57602d0..f0812e3 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 _0x0397=['email','accountcode','fullname','state','stateTime','unknown','address','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','local','prototype','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','status','voiceStatusCallerIdNumber','onhold','stringify','user:%s','emit','user:ami:update','omit','user:presence','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x6eb833,_0x2bb5e5){var _0xdfc38c=function(_0x13c4a4){while(--_0x13c4a4){_0x6eb833['push'](_0x6eb833['shift']());}};_0xdfc38c(++_0x2bb5e5);}(_0x0397,0x13f));var _0x7039=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x0397[_0x287a47];return _0x3fb726;};'use strict';var _=require('lodash');var util=require(_0x7039('0x0'));var moment=require(_0x7039('0x1'));var md5=require(_0x7039('0x2'));var Redis=require('ioredis');var config=require(_0x7039('0x3'));config[_0x7039('0x4')]=_[_0x7039('0x5')](config[_0x7039('0x4')],{'host':_0x7039('0x6'),'port':0x18eb});var io=require(_0x7039('0x7'))(new Redis(config[_0x7039('0x4')]));function Agent(_0x58b31e){this['id']=_0x58b31e['id']||0x0;this[_0x7039('0x8')]=_0x58b31e['name']||'';this[_0x7039('0x9')]=_0x58b31e[_0x7039('0x9')]||'';this[_0x7039('0xa')]=_0x58b31e[_0x7039('0xa')]||'';this[_0x7039('0xb')]=_0x58b31e[_0x7039('0xb')]||'';this[_0x7039('0xc')]='unknown';this[_0x7039('0xd')]=0x0;this['status']=_0x7039('0xe');this[_0x7039('0xf')]='';this[_0x7039('0x10')]='';this['mobile']='';this[_0x7039('0x11')]='';this[_0x7039('0x12')]=_0x58b31e['online']||![];this[_0x7039('0x13')]='unknown';this[_0x7039('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x7039('0x15')]='';this['onhold']=![];this[_0x7039('0x16')]=![];this[_0x7039('0x2')]='';}Agent[_0x7039('0x17')]['updateStatusRealtime']=function(_0x29c700){var _0x3359ed;if(_0x29c700&&_0x29c700['state']){_0x3359ed=_0x29c700[_0x7039('0xc')][_0x7039('0x18')]();switch(_0x3359ed){case _0x7039('0x19'):_0x3359ed=_0x7039('0x1a');break;case _0x7039('0x1b'):_0x3359ed=_0x7039('0x1c');break;}}if(_0x3359ed&&this[_0x7039('0x13')]!==_0x3359ed||_0x29c700[_0x7039('0x1d')]){this[_0x7039('0x14')]=_[_0x7039('0x1e')](moment()[_0x7039('0x1f')]('x'));}if(_0x3359ed){this[_0x7039('0x13')]=_0x3359ed;}var _0x3a97e5={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x7039('0xb')],'state':this[_0x7039('0xc')],'stateTime':this[_0x7039('0xd')],'status':this[_0x7039('0x20')],'address':this['address'],'online':this[_0x7039('0x12')],'voiceStatus':this[_0x7039('0x13')],'voiceStatusTime':this[_0x7039('0x14')],'voiceStatusCallerIdNumber':this[_0x7039('0x21')],'voiceStatusQueue':this[_0x7039('0x15')],'interface':this[_0x7039('0x11')],'onhold':this[_0x7039('0x22')]};var _0x3db92c=md5(JSON[_0x7039('0x23')](_0x3a97e5));if(this['md5']!==_0x3db92c){this['md5']=_0x3db92c;io['to'](util[_0x7039('0x1f')](_0x7039('0x24'),_0x3a97e5['name']))[_0x7039('0x25')](_0x7039('0x26'),_[_0x7039('0x27')](_0x3a97e5,[_0x7039('0x12')]));io[_0x7039('0x25')](_0x7039('0x28'),_0x3a97e5);}};module['exports']=Agent; \ No newline at end of file +var _0x526d=['moment','md5','redis','defaults','localhost','socket.io-emitter','name','email','fullname','state','unknown','stateTime','status','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusQueue','prototype','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','accountcode','voiceStatusCallerIdNumber','stringify','user:%s','user:ami:update','omit','emit','exports','lodash','util'];(function(_0x54c8e6,_0x139f67){var _0x220e0a=function(_0x7e64aa){while(--_0x7e64aa){_0x54c8e6['push'](_0x54c8e6['shift']());}};_0x220e0a(++_0x139f67);}(_0x526d,0xe2));var _0xd526=function(_0xb2e18d,_0x5571de){_0xb2e18d=_0xb2e18d-0x0;var _0x4c1c3e=_0x526d[_0xb2e18d];return _0x4c1c3e;};'use strict';var _=require(_0xd526('0x0'));var util=require(_0xd526('0x1'));var moment=require(_0xd526('0x2'));var md5=require(_0xd526('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xd526('0x4')]=_[_0xd526('0x5')](config['redis'],{'host':_0xd526('0x6'),'port':0x18eb});var io=require(_0xd526('0x7'))(new Redis(config[_0xd526('0x4')]));function Agent(_0x62e04b){this['id']=_0x62e04b['id']||0x0;this[_0xd526('0x8')]=_0x62e04b[_0xd526('0x8')]||'';this[_0xd526('0x9')]=_0x62e04b[_0xd526('0x9')]||'';this['accountcode']=_0x62e04b['accountcode']||'';this[_0xd526('0xa')]=_0x62e04b[_0xd526('0xa')]||'';this[_0xd526('0xb')]=_0xd526('0xc');this[_0xd526('0xd')]=0x0;this[_0xd526('0xe')]=_0xd526('0xc');this[_0xd526('0xf')]='';this['phone']='';this[_0xd526('0x10')]='';this['interface']='';this[_0xd526('0x11')]=_0x62e04b[_0xd526('0x11')]||![];this[_0xd526('0x12')]=_0xd526('0xc');this[_0xd526('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xd526('0x14')]='';this['onhold']=![];this['local']=![];this[_0xd526('0x3')]='';}Agent[_0xd526('0x15')]['updateStatusRealtime']=function(_0x4aeb76){var _0x3eaaaa;if(_0x4aeb76&&_0x4aeb76[_0xd526('0xb')]){_0x3eaaaa=_0x4aeb76['state'][_0xd526('0x16')]();switch(_0x3eaaaa){case _0xd526('0x17'):_0x3eaaaa=_0xd526('0x18');break;case _0xd526('0x19'):_0x3eaaaa=_0xd526('0x1a');break;}}if(_0x3eaaaa&&this[_0xd526('0x12')]!==_0x3eaaaa||_0x4aeb76[_0xd526('0x1b')]){this[_0xd526('0x13')]=_[_0xd526('0x1c')](moment()[_0xd526('0x1d')]('x'));}if(_0x3eaaaa){this[_0xd526('0x12')]=_0x3eaaaa;}var _0x25a4e6={'id':this['id'],'name':this[_0xd526('0x8')],'email':this[_0xd526('0x9')],'accountcode':this[_0xd526('0x1e')],'fullname':this[_0xd526('0xa')],'state':this[_0xd526('0xb')],'stateTime':this['stateTime'],'status':this[_0xd526('0xe')],'address':this[_0xd526('0xf')],'online':this[_0xd526('0x11')],'voiceStatus':this[_0xd526('0x12')],'voiceStatusTime':this[_0xd526('0x13')],'voiceStatusCallerIdNumber':this[_0xd526('0x1f')],'voiceStatusQueue':this[_0xd526('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3e6f4b=md5(JSON[_0xd526('0x20')](_0x25a4e6));if(this[_0xd526('0x3')]!==_0x3e6f4b){this['md5']=_0x3e6f4b;io['to'](util[_0xd526('0x1d')](_0xd526('0x21'),_0x25a4e6[_0xd526('0x8')]))['emit'](_0xd526('0x22'),_[_0xd526('0x23')](_0x25a4e6,[_0xd526('0x11')]));io[_0xd526('0x24')]('user:presence',_0x25a4e6);}};module[_0xd526('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 34f969d..3d09204 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 _0x8912=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0xfca0bf,_0x8ac9f9){var _0xc72568=function(_0x4b4a90){while(--_0x4b4a90){_0xfca0bf['push'](_0xfca0bf['shift']());}};_0xc72568(++_0x8ac9f9);}(_0x8912,0x154));var _0x2891=function(_0x52bc78,_0xcf2799){_0x52bc78=_0x52bc78-0x0;var _0x403bd4=_0x8912[_0x52bc78];return _0x403bd4;};'use strict';function Campaign(_0x553f43){this['id']=_0x553f43['id']||0x0;this[_0x2891('0x0')]=_0x553f43[_0x2891('0x0')]||'';this[_0x2891('0x1')]=_0x553f43['type']||'campaign';this[_0x2891('0x2')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x2891('0x3')]=0x0;this[_0x2891('0x4')]='';this[_0x2891('0x5')]=!![];this[_0x2891('0x6')]=_0x553f43[_0x2891('0x6')];this[_0x2891('0x7')]=_0x553f43[_0x2891('0x7')];this[_0x2891('0x8')]=_0x553f43['dialTimezone']||null;this[_0x2891('0x9')]=_0x553f43[_0x2891('0x9')]?_0x553f43['dialGlobalInterval']:null;this[_0x2891('0xa')]=_0x553f43[_0x2891('0xa')];this['dialOriginateCallerIdNumber']=_0x553f43[_0x2891('0xb')];this[_0x2891('0xc')]=_0x553f43[_0x2891('0xc')]||0x1e;this[_0x2891('0xd')]=_0x553f43['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x553f43[_0x2891('0xe')];this[_0x2891('0xf')]=_0x553f43[_0x2891('0xf')];this[_0x2891('0x10')]=_0x553f43[_0x2891('0x10')];this[_0x2891('0x11')]=_0x553f43['dialNoAnswerMaxRetry'];this[_0x2891('0x12')]=_0x553f43[_0x2891('0x12')];this[_0x2891('0x13')]=_0x553f43[_0x2891('0x13')];this[_0x2891('0x14')]=_0x553f43[_0x2891('0x14')]||0x3;this[_0x2891('0x15')]=_0x553f43[_0x2891('0x15')]||0x96;this['dialDropMaxRetry']=_0x553f43[_0x2891('0x16')]||0x3;this[_0x2891('0x17')]=_0x553f43['dialDropRetryFrequency']||0x96;this[_0x2891('0x18')]=_0x553f43[_0x2891('0x18')]||0x3;this[_0x2891('0x19')]=_0x553f43[_0x2891('0x19')]||0x96;this['dialMachineMaxRetry']=_0x553f43[_0x2891('0x1a')]||0x3;this[_0x2891('0x1b')]=_0x553f43['dialMachineRetryFrequency']||0x96;this[_0x2891('0x1c')]=_0x553f43[_0x2891('0x1c')]||0x3;this[_0x2891('0x1d')]=_0x553f43[_0x2891('0x1d')]||0x96;this[_0x2891('0x1e')]=_0x553f43[_0x2891('0x1e')]||'DESC';this[_0x2891('0x1f')]=_0x553f43[_0x2891('0x1f')]||undefined;this[_0x2891('0x20')]=_0x553f43['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2891('0x21')]=_0x553f43[_0x2891('0x21')]||undefined;this['TrunkBackup']=_0x553f43['TrunkBackup']?_0x553f43[_0x2891('0x22')]:undefined;this[_0x2891('0x23')]=_0x553f43[_0x2891('0x23')]?_0x553f43[_0x2891('0x23')]:undefined;this['Interval']=_0x553f43[_0x2891('0x24')]?_0x553f43['Interval']:undefined;this['SquareProject']=_0x553f43[_0x2891('0x25')]?_0x553f43[_0x2891('0x25')]:undefined;this['dialQueueProject']=_0x553f43[_0x2891('0x25')]?_0x553f43[_0x2891('0x25')][_0x2891('0x0')]:undefined;this[_0x2891('0x26')]=_0x553f43['dialAMDActive']||![];this[_0x2891('0x27')]=_0x553f43['dialAMDInitialSilence'];this[_0x2891('0x28')]=_0x553f43['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x553f43['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x553f43[_0x2891('0x29')];this[_0x2891('0x2a')]=_0x553f43[_0x2891('0x2a')];this[_0x2891('0x2b')]=_0x553f43[_0x2891('0x2b')];this[_0x2891('0x2c')]=_0x553f43[_0x2891('0x2c')];this[_0x2891('0x2d')]=_0x553f43['dialAMDSilenceThreshold'];this[_0x2891('0x2e')]=_0x553f43[_0x2891('0x2e')];}module[_0x2891('0x2f')]=Campaign; \ No newline at end of file +var _0x9ff6=['Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','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'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9ff6,0xde));var _0x69ff=function(_0x2b7810,_0xb69116){_0x2b7810=_0x2b7810-0x0;var _0x86d8ee=_0x9ff6[_0x2b7810];return _0x86d8ee;};'use strict';function Campaign(_0x1ca345){this['id']=_0x1ca345['id']||0x0;this[_0x69ff('0x0')]=_0x1ca345['name']||'';this[_0x69ff('0x1')]=_0x1ca345['type']||_0x69ff('0x2');this[_0x69ff('0x3')]=0x0;this[_0x69ff('0x4')]=0x0;this[_0x69ff('0x5')]=0x0;this[_0x69ff('0x6')]=0x0;this[_0x69ff('0x7')]='';this[_0x69ff('0x8')]=!![];this[_0x69ff('0x9')]=_0x1ca345[_0x69ff('0x9')];this[_0x69ff('0xa')]=_0x1ca345['limitCalls'];this[_0x69ff('0xb')]=_0x1ca345[_0x69ff('0xb')]||null;this[_0x69ff('0xc')]=_0x1ca345[_0x69ff('0xc')]?_0x1ca345[_0x69ff('0xc')]:null;this[_0x69ff('0xd')]=_0x1ca345[_0x69ff('0xd')];this[_0x69ff('0xe')]=_0x1ca345[_0x69ff('0xe')];this[_0x69ff('0xf')]=_0x1ca345['dialOriginateTimeout']||0x1e;this[_0x69ff('0x10')]=_0x1ca345[_0x69ff('0x10')];this[_0x69ff('0x11')]=_0x1ca345['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x1ca345['dialBusyMaxRetry'];this[_0x69ff('0x12')]=_0x1ca345['dialBusyRetryFrequency'];this[_0x69ff('0x13')]=_0x1ca345[_0x69ff('0x13')];this[_0x69ff('0x14')]=_0x1ca345[_0x69ff('0x14')];this['dialGlobalMaxRetry']=_0x1ca345[_0x69ff('0x15')];this['dialNoSuchNumberMaxRetry']=_0x1ca345[_0x69ff('0x16')]||0x3;this[_0x69ff('0x17')]=_0x1ca345[_0x69ff('0x17')]||0x96;this[_0x69ff('0x18')]=_0x1ca345['dialDropMaxRetry']||0x3;this[_0x69ff('0x19')]=_0x1ca345[_0x69ff('0x19')]||0x96;this[_0x69ff('0x1a')]=_0x1ca345['dialAbandonedMaxRetry']||0x3;this[_0x69ff('0x1b')]=_0x1ca345['dialAbandonedRetryFrequency']||0x96;this[_0x69ff('0x1c')]=_0x1ca345[_0x69ff('0x1c')]||0x3;this[_0x69ff('0x1d')]=_0x1ca345[_0x69ff('0x1d')]||0x96;this[_0x69ff('0x1e')]=_0x1ca345['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x1ca345[_0x69ff('0x1f')]||0x96;this['dialOrderByScheduledAt']=_0x1ca345[_0x69ff('0x20')]||_0x69ff('0x21');this['dialPrefix']=_0x1ca345[_0x69ff('0x22')]||undefined;this[_0x69ff('0x23')]=_0x1ca345[_0x69ff('0x23')]||undefined;this[_0x69ff('0x24')]=_0x1ca345['dialCutDigit']||undefined;this['TrunkBackup']=_0x1ca345[_0x69ff('0x25')]?_0x1ca345[_0x69ff('0x25')]:undefined;this[_0x69ff('0x26')]=_0x1ca345['Trunk']?_0x1ca345[_0x69ff('0x26')]:undefined;this[_0x69ff('0x27')]=_0x1ca345[_0x69ff('0x27')]?_0x1ca345[_0x69ff('0x27')]:undefined;this[_0x69ff('0x28')]=_0x1ca345[_0x69ff('0x28')]?_0x1ca345[_0x69ff('0x28')]:undefined;this[_0x69ff('0x29')]=_0x1ca345[_0x69ff('0x28')]?_0x1ca345['SquareProject'][_0x69ff('0x0')]:undefined;this[_0x69ff('0x2a')]=_0x1ca345[_0x69ff('0x2a')]||![];this[_0x69ff('0x2b')]=_0x1ca345[_0x69ff('0x2b')];this[_0x69ff('0x2c')]=_0x1ca345[_0x69ff('0x2c')];this[_0x69ff('0x2d')]=_0x1ca345[_0x69ff('0x2d')];this[_0x69ff('0x2e')]=_0x1ca345[_0x69ff('0x2e')];this['dialAMDMinWordLength']=_0x1ca345[_0x69ff('0x2f')];this[_0x69ff('0x30')]=_0x1ca345[_0x69ff('0x30')];this['dialAMDMaximumNumberOfWords']=_0x1ca345['dialAMDMaximumNumberOfWords'];this[_0x69ff('0x31')]=_0x1ca345[_0x69ff('0x31')];this[_0x69ff('0x32')]=_0x1ca345[_0x69ff('0x32')];}module[_0x69ff('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 682b087..d92a127 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 _0x5464=['channel','destinationchannel','calleridname','connectedlinename','context','uniqueid','linkedid','exten','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime'];(function(_0x229594,_0x210f9c){var _0x103b39=function(_0x210c04){while(--_0x210c04){_0x229594['push'](_0x229594['shift']());}};_0x103b39(++_0x210f9c);}(_0x5464,0x15d));var _0x4546=function(_0x223138,_0x95dc52){_0x223138=_0x223138-0x0;var _0x5bfff0=_0x5464[_0x223138];return _0x5bfff0;};'use strict';function Channel(){this[_0x4546('0x0')]=null;this[_0x4546('0x1')]='';this[_0x4546('0x2')]='';this['calleridnum']=0x0;this[_0x4546('0x3')]='';this['connectedlinenum']=undefined;this[_0x4546('0x4')]=undefined;this['accountcode']=0x0;this[_0x4546('0x5')]='';this[_0x4546('0x6')]=0x0;this[_0x4546('0x7')]=0x0;this[_0x4546('0x8')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0x4546('0x9')]=![];this[_0x4546('0xa')]=![];this[_0x4546('0xb')]='';this[_0x4546('0xc')]='';this[_0x4546('0xd')]=0x0;this[_0x4546('0xe')]=0x0;this[_0x4546('0xf')]=0x0;this[_0x4546('0x10')]=null;this[_0x4546('0x11')]=null;this['disposition']=null;this[_0x4546('0x12')]=![];this[_0x4546('0x13')]=null;this[_0x4546('0x14')]=null;this['monitors']=[];this[_0x4546('0x15')]=undefined;this[_0x4546('0x16')]=undefined;this[_0x4546('0x17')]=undefined;this[_0x4546('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xd945=['linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context'];(function(_0x1ca59f,_0x1a5cd7){var _0x2f3153=function(_0xcd56ca){while(--_0xcd56ca){_0x1ca59f['push'](_0x1ca59f['shift']());}};_0x2f3153(++_0x1a5cd7);}(_0xd945,0x84));var _0x5d94=function(_0x161ab1,_0x1ad292){_0x161ab1=_0x161ab1-0x0;var _0x2645ef=_0xd945[_0x161ab1];return _0x2645ef;};'use strict';function Channel(){this[_0x5d94('0x0')]=null;this[_0x5d94('0x1')]='';this[_0x5d94('0x2')]='';this['calleridnum']=0x0;this[_0x5d94('0x3')]='';this[_0x5d94('0x4')]=undefined;this[_0x5d94('0x5')]=undefined;this[_0x5d94('0x6')]=0x0;this[_0x5d94('0x7')]='';this['uniqueid']=0x0;this[_0x5d94('0x8')]=0x0;this[_0x5d94('0x9')]=0x0;this[_0x5d94('0xa')]=![];this[_0x5d94('0xb')]=null;this[_0x5d94('0xc')]=null;this['unmanaged']=![];this[_0x5d94('0xd')]=![];this[_0x5d94('0xe')]='';this[_0x5d94('0xf')]='';this['duration']=0x0;this[_0x5d94('0x10')]=0x0;this[_0x5d94('0x11')]=0x0;this[_0x5d94('0x12')]=null;this[_0x5d94('0x13')]=null;this['disposition']=null;this[_0x5d94('0x14')]=![];this['monitorFilename']=null;this[_0x5d94('0x15')]=null;this[_0x5d94('0x16')]=[];this[_0x5d94('0x17')]=undefined;this[_0x5d94('0x18')]=undefined;this[_0x5d94('0x19')]=undefined;this[_0x5d94('0x1a')]=0x0;}module[_0x5d94('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ea8fd2f..f3b7219 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 _0x1962=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','type','serverUrl'];(function(_0x594ba0,_0x37b988){var _0x3d19d8=function(_0xf470bf){while(--_0xf470bf){_0x594ba0['push'](_0x594ba0['shift']());}};_0x3d19d8(++_0x37b988);}(_0x1962,0xce));var _0x2196=function(_0x514867,_0xbc5f43){_0x514867=_0x514867-0x0;var _0x3a1b64=_0x1962[_0x514867];return _0x3a1b64;};'use strict';function DeskAccount(_0x37bb73){this['id']=_0x37bb73['id']||0x0;this[_0x2196('0x0')]=_0x37bb73[_0x2196('0x0')]||'';this[_0x2196('0x1')]=_0x37bb73[_0x2196('0x1')]||'';this[_0x2196('0x2')]=_0x37bb73['remoteUri']||'';this['authType']=_0x37bb73[_0x2196('0x3')]||'';this['password']=_0x37bb73[_0x2196('0x4')]||'';this['consumerKey']=_0x37bb73[_0x2196('0x5')]||'';this[_0x2196('0x6')]=_0x37bb73['consumerSecret']||'';this['token']=_0x37bb73[_0x2196('0x7')]||'';this['tokenSecret']=_0x37bb73['tokenSecret']||'';this[_0x2196('0x8')]=_0x37bb73[_0x2196('0x8')]||'';this['serverUrl']=_0x37bb73[_0x2196('0x9')]||'';this['Configurations']=_0x37bb73[_0x2196('0xa')]||{};}module[_0x2196('0xb')]=DeskAccount; \ No newline at end of file +var _0xaf3b=['remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x2dc407,_0x15502c){var _0x1d5f41=function(_0x31aa86){while(--_0x31aa86){_0x2dc407['push'](_0x2dc407['shift']());}};_0x1d5f41(++_0x15502c);}(_0xaf3b,0x148));var _0xbaf3=function(_0x42a31b,_0xdacb59){_0x42a31b=_0x42a31b-0x0;var _0xc52f0=_0xaf3b[_0x42a31b];return _0xc52f0;};'use strict';function DeskAccount(_0x4d156d){this['id']=_0x4d156d['id']||0x0;this[_0xbaf3('0x0')]=_0x4d156d[_0xbaf3('0x0')]||'';this[_0xbaf3('0x1')]=_0x4d156d[_0xbaf3('0x1')]||'';this[_0xbaf3('0x2')]=_0x4d156d[_0xbaf3('0x2')]||'';this[_0xbaf3('0x3')]=_0x4d156d[_0xbaf3('0x3')]||'';this[_0xbaf3('0x4')]=_0x4d156d[_0xbaf3('0x4')]||'';this['consumerKey']=_0x4d156d['consumerKey']||'';this[_0xbaf3('0x5')]=_0x4d156d[_0xbaf3('0x5')]||'';this['token']=_0x4d156d[_0xbaf3('0x6')]||'';this[_0xbaf3('0x7')]=_0x4d156d[_0xbaf3('0x7')]||'';this[_0xbaf3('0x8')]=_0x4d156d[_0xbaf3('0x8')]||'';this[_0xbaf3('0x9')]=_0x4d156d[_0xbaf3('0x9')]||'';this[_0xbaf3('0xa')]=_0x4d156d[_0xbaf3('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 0c4e6bb..9ef5d90 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 _0x8331=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name'];(function(_0x5247bd,_0x476a08){var _0x3703ec=function(_0x674bc9){while(--_0x674bc9){_0x5247bd['push'](_0x5247bd['shift']());}};_0x3703ec(++_0x476a08);}(_0x8331,0xfc));var _0x1833=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x8331[_0x2272b5];return _0x110156;};'use strict';function Dynamics365Account(_0x4a791e){this['id']=_0x4a791e['id']||0x0;this[_0x1833('0x0')]=_0x4a791e[_0x1833('0x0')]||'';this[_0x1833('0x1')]=_0x4a791e[_0x1833('0x1')]||'';this[_0x1833('0x2')]=_0x4a791e[_0x1833('0x2')]||'';this[_0x1833('0x3')]=_0x4a791e['remoteUri']||'';this[_0x1833('0x4')]=_0x4a791e[_0x1833('0x4')]||'';this[_0x1833('0x5')]=_0x4a791e[_0x1833('0x5')]||'';this['clientSecret']=_0x4a791e[_0x1833('0x6')]||{};this[_0x1833('0x7')]=_0x4a791e[_0x1833('0x7')]||'';this[_0x1833('0x8')]=_0x4a791e[_0x1833('0x8')]||![];this[_0x1833('0x9')]=_0x4a791e[_0x1833('0x9')]||{};this[_0x1833('0xa')]=_0x4a791e['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x1097=['name','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0xbd1338,_0x520f26){var _0x4ad405=function(_0x3cf64b){while(--_0x3cf64b){_0xbd1338['push'](_0xbd1338['shift']());}};_0x4ad405(++_0x520f26);}(_0x1097,0x12c));var _0x7109=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x1097[_0x29d94e];return _0x106237;};'use strict';function Dynamics365Account(_0x4f17b4){this['id']=_0x4f17b4['id']||0x0;this[_0x7109('0x0')]=_0x4f17b4[_0x7109('0x0')]||'';this['username']=_0x4f17b4['username']||'';this['password']=_0x4f17b4[_0x7109('0x1')]||'';this[_0x7109('0x2')]=_0x4f17b4[_0x7109('0x2')]||'';this['tenantId']=_0x4f17b4[_0x7109('0x3')]||'';this[_0x7109('0x4')]=_0x4f17b4[_0x7109('0x4')]||'';this[_0x7109('0x5')]=_0x4f17b4[_0x7109('0x5')]||{};this['serverUrl']=_0x4f17b4[_0x7109('0x6')]||'';this['modernAuthentication']=_0x4f17b4[_0x7109('0x7')]||![];this['Configurations']=_0x4f17b4[_0x7109('0x8')]||{};this[_0x7109('0x9')]=_0x4f17b4[_0x7109('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 0ec5a07..359f708 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 _0x2559=['name','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','exports'];(function(_0xbe67ff,_0x21bd36){var _0x49ce8a=function(_0x4fe4b3){while(--_0x4fe4b3){_0xbe67ff['push'](_0xbe67ff['shift']());}};_0x49ce8a(++_0x21bd36);}(_0x2559,0x1ea));var _0x9255=function(_0x4d3212,_0x3907e6){_0x4d3212=_0x4d3212-0x0;var _0x361a10=_0x2559[_0x4d3212];return _0x361a10;};'use strict';function FaxAccount(_0x2608f6){this['id']=_0x2608f6['id']||0x0;this['name']=_0x2608f6[_0x9255('0x0')]||'';this['description']=_0x2608f6['description'];this[_0x9255('0x1')]=_0x2608f6['ecm'];this[_0x9255('0x2')]=_0x2608f6['headerinfo'];this['localstationid']=_0x2608f6['localstationid'];this[_0x9255('0x3')]=_0x2608f6[_0x9255('0x3')]||0x960;this[_0x9255('0x4')]=_0x2608f6[_0x9255('0x4')]||0x3840;this[_0x9255('0x5')]=_0x2608f6[_0x9255('0x5')]||'v17,v27,v29';this[_0x9255('0x6')]=_0x2608f6[_0x9255('0x6')]||'no';this[_0x9255('0x7')]=_0x2608f6[_0x9255('0x7')]||'no';this[_0x9255('0x8')]=_0x2608f6['t38timeout']||0x1388;this[_0x9255('0x9')]=_0x2608f6[_0x9255('0x9')]||_0x9255('0xa');this[_0x9255('0xb')]=_0x2608f6['Trunk']?_0x2608f6['Trunk']:undefined;this['ListId']=_0x2608f6['ListId'];this[_0x9255('0xc')]=_0x2608f6['key'];}module[_0x9255('0xd')]=FaxAccount; \ No newline at end of file +var _0x8b6b=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x8b6b,0xb8));var _0xb8b6=function(_0x1a9c7a,_0x3b96da){_0x1a9c7a=_0x1a9c7a-0x0;var _0x5ac305=_0x8b6b[_0x1a9c7a];return _0x5ac305;};'use strict';function FaxAccount(_0x558ab2){this['id']=_0x558ab2['id']||0x0;this[_0xb8b6('0x0')]=_0x558ab2['name']||'';this[_0xb8b6('0x1')]=_0x558ab2[_0xb8b6('0x1')];this[_0xb8b6('0x2')]=_0x558ab2[_0xb8b6('0x2')];this[_0xb8b6('0x3')]=_0x558ab2['headerinfo'];this[_0xb8b6('0x4')]=_0x558ab2['localstationid'];this['minrate']=_0x558ab2[_0xb8b6('0x5')]||0x960;this[_0xb8b6('0x6')]=_0x558ab2['maxrate']||0x3840;this['modem']=_0x558ab2[_0xb8b6('0x7')]||_0xb8b6('0x8');this[_0xb8b6('0x9')]=_0x558ab2['gateway']||'no';this[_0xb8b6('0xa')]=_0x558ab2[_0xb8b6('0xa')]||'no';this['t38timeout']=_0x558ab2['t38timeout']||0x1388;this[_0xb8b6('0xb')]=_0x558ab2[_0xb8b6('0xb')]||_0xb8b6('0xc');this[_0xb8b6('0xd')]=_0x558ab2[_0xb8b6('0xd')]?_0x558ab2['Trunk']:undefined;this[_0xb8b6('0xe')]=_0x558ab2['ListId'];this['key']=_0x558ab2[_0xb8b6('0xf')];}module[_0xb8b6('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 52b8b4a..a325c4d 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 _0xca24=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3a4349,_0x1cc5a6){var _0x2ca9aa=function(_0x1f5071){while(--_0x1f5071){_0x3a4349['push'](_0x3a4349['shift']());}};_0x2ca9aa(++_0x1cc5a6);}(_0xca24,0x141));var _0x4ca2=function(_0x3cfc80,_0x44c7a1){_0x3cfc80=_0x3cfc80-0x0;var _0xf78636=_0xca24[_0x3cfc80];return _0xf78636;};'use strict';function FreshdeskAccount(_0x3ab7e8){this['id']=_0x3ab7e8['id']||0x0;this[_0x4ca2('0x0')]=_0x3ab7e8['name']||'';this['username']=_0x3ab7e8['username']||'';this[_0x4ca2('0x1')]=_0x3ab7e8[_0x4ca2('0x2')]||'';this['remoteUri']=_0x3ab7e8[_0x4ca2('0x3')]||'';this[_0x4ca2('0x4')]=_0x3ab7e8[_0x4ca2('0x4')]||'';this[_0x4ca2('0x5')]=_0x3ab7e8[_0x4ca2('0x5')]||{};}module[_0x4ca2('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x69a0=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x69a0,0x1af));var _0x069a=function(_0x4f2622,_0x21681e){_0x4f2622=_0x4f2622-0x0;var _0x29e458=_0x69a0[_0x4f2622];return _0x29e458;};'use strict';function FreshdeskAccount(_0x1af5a4){this['id']=_0x1af5a4['id']||0x0;this['name']=_0x1af5a4[_0x069a('0x0')]||'';this[_0x069a('0x1')]=_0x1af5a4[_0x069a('0x1')]||'';this['apiKey']=_0x1af5a4[_0x069a('0x2')]||'';this['remoteUri']=_0x1af5a4[_0x069a('0x3')]||'';this[_0x069a('0x4')]=_0x1af5a4[_0x069a('0x4')]||'';this['Configurations']=_0x1af5a4[_0x069a('0x5')]||{};}module[_0x069a('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index c8a84f1..a7091b8 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 _0x2428=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0xfe7d5e,_0x5cbb39){var _0x104661=function(_0x1bf5a4){while(--_0x1bf5a4){_0xfe7d5e['push'](_0xfe7d5e['shift']());}};_0x104661(++_0x5cbb39);}(_0x2428,0xd3));var _0x8242=function(_0x31aa8a,_0x22e9dd){_0x31aa8a=_0x31aa8a-0x0;var _0x26f39a=_0x2428[_0x31aa8a];return _0x26f39a;};'use strict';function FreshsalesAccount(_0x4630f5){this['id']=_0x4630f5['id']||0x0;this[_0x8242('0x0')]=_0x4630f5[_0x8242('0x0')]||'';this[_0x8242('0x1')]=_0x4630f5[_0x8242('0x1')]||'';this[_0x8242('0x2')]=_0x4630f5[_0x8242('0x3')]||'';this[_0x8242('0x4')]=_0x4630f5[_0x8242('0x4')]||'';this[_0x8242('0x5')]=_0x4630f5[_0x8242('0x5')]||'';this[_0x8242('0x6')]=_0x4630f5['Configurations']||{};}module[_0x8242('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xff16=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xff16,0x7f));var _0x6ff1=function(_0x41adb9,_0x14093b){_0x41adb9=_0x41adb9-0x0;var _0xc09757=_0xff16[_0x41adb9];return _0xc09757;};'use strict';function FreshsalesAccount(_0x393ef9){this['id']=_0x393ef9['id']||0x0;this[_0x6ff1('0x0')]=_0x393ef9['name']||'';this[_0x6ff1('0x1')]=_0x393ef9[_0x6ff1('0x1')]||'';this[_0x6ff1('0x2')]=_0x393ef9[_0x6ff1('0x3')]||'';this[_0x6ff1('0x4')]=_0x393ef9[_0x6ff1('0x4')]||'';this[_0x6ff1('0x5')]=_0x393ef9[_0x6ff1('0x5')]||'';this['Configurations']=_0x393ef9[_0x6ff1('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 82b52d9..c6e0be7 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 _0xa4ad=['originalposition','channel','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt'];(function(_0x540600,_0x53d2da){var _0x5eae09=function(_0x505ff5){while(--_0x505ff5){_0x540600['push'](_0x540600['shift']());}};_0x5eae09(++_0x53d2da);}(_0xa4ad,0x1ad));var _0xda4a=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0xa4ad[_0x11a962];return _0x55d423;};'use strict';function QueueReport(){this[_0xda4a('0x0')]=_0xda4a('0x1');this[_0xda4a('0x2')]='';this[_0xda4a('0x3')]='';this[_0xda4a('0x4')]='';this[_0xda4a('0x5')]='';this[_0xda4a('0x6')]=null;this[_0xda4a('0x7')]=null;this[_0xda4a('0x8')]=0x1;this['count']=0x1;this[_0xda4a('0x9')]=![];this['queuecallerabandonAt']=null;this[_0xda4a('0xa')]=![];this[_0xda4a('0xb')]=null;this['queuecallerexit']=![];this[_0xda4a('0xc')]=null;this[_0xda4a('0xd')]=0x1;this[_0xda4a('0xe')]='';this['connectedlinenum']='';this[_0xda4a('0xf')]='';this[_0xda4a('0x10')]='';this[_0xda4a('0x11')]='';this[_0xda4a('0x12')]='';this[_0xda4a('0x13')]='';this[_0xda4a('0x14')]=0x0;this[_0xda4a('0x15')]=![];this[_0xda4a('0x16')]='';this['motionChannel']=_0xda4a('0x17');this[_0xda4a('0x18')]=0x0;this[_0xda4a('0x19')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x2872=['count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','holdtime','lastAssignedTo','motionChannel','voice','type','inbound','uniqueid','calleridname','queuecallerjoinAt','position'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2872,0x1c8));var _0x2287=function(_0x8b12c2,_0x32db7a){_0x8b12c2=_0x8b12c2-0x0;var _0x1d5664=_0x2872[_0x8b12c2];return _0x1d5664;};'use strict';function QueueReport(){this[_0x2287('0x0')]=_0x2287('0x1');this[_0x2287('0x2')]='';this['calleridnum']='';this[_0x2287('0x3')]='';this['queue']='';this[_0x2287('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x2287('0x5')]=0x1;this[_0x2287('0x6')]=0x1;this[_0x2287('0x7')]=![];this[_0x2287('0x8')]=null;this[_0x2287('0x9')]=![];this[_0x2287('0xa')]=null;this[_0x2287('0xb')]=![];this[_0x2287('0xc')]=null;this[_0x2287('0xd')]=0x1;this[_0x2287('0xe')]='';this['connectedlinenum']='';this[_0x2287('0xf')]='';this[_0x2287('0x10')]='';this[_0x2287('0x11')]='';this['exten']='';this['priority']='';this[_0x2287('0x12')]=0x0;this['assigned']=![];this[_0x2287('0x13')]='';this[_0x2287('0x14')]=_0x2287('0x15');this['mohtime']=0x0;this['variables']={};}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 6c4c56a..bfb67f4 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 _0xa2cb=['username','remoteUri','password','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0xa2cb,0x7d));var _0xba2c=function(_0x1b14e8,_0x5c512d){_0x1b14e8=_0x1b14e8-0x0;var _0x410504=_0xa2cb[_0x1b14e8];return _0x410504;};'use strict';function SalesforceAccount(_0x4dc80e){this['id']=_0x4dc80e['id']||0x0;this[_0xba2c('0x0')]=_0x4dc80e['name']||'';this[_0xba2c('0x1')]=_0x4dc80e[_0xba2c('0x1')]||'';this[_0xba2c('0x2')]=_0x4dc80e[_0xba2c('0x2')]||'';this[_0xba2c('0x3')]=_0x4dc80e['password']||'';this['clientId']=_0x4dc80e['clientId']||'';this['clientSecret']=_0x4dc80e['clientSecret']||'';this[_0xba2c('0x4')]=_0x4dc80e['securityToken']||'';this[_0xba2c('0x5')]=_0x4dc80e['type']||_0xba2c('0x6');this[_0xba2c('0x7')]=_0x4dc80e['serverUrl']||'';this[_0xba2c('0x8')]=_0x4dc80e[_0xba2c('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x2837=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x13040a,_0x4bbfb0){var _0x9b69c9=function(_0x4e9742){while(--_0x4e9742){_0x13040a['push'](_0x13040a['shift']());}};_0x9b69c9(++_0x4bbfb0);}(_0x2837,0x12b));var _0x7283=function(_0x5f2736,_0x5e9aff){_0x5f2736=_0x5f2736-0x0;var _0x11116c=_0x2837[_0x5f2736];return _0x11116c;};'use strict';function SalesforceAccount(_0x1c0fc4){this['id']=_0x1c0fc4['id']||0x0;this[_0x7283('0x0')]=_0x1c0fc4[_0x7283('0x0')]||'';this['username']=_0x1c0fc4[_0x7283('0x1')]||'';this[_0x7283('0x2')]=_0x1c0fc4['remoteUri']||'';this['password']=_0x1c0fc4[_0x7283('0x3')]||'';this[_0x7283('0x4')]=_0x1c0fc4[_0x7283('0x4')]||'';this['clientSecret']=_0x1c0fc4[_0x7283('0x5')]||'';this['securityToken']=_0x1c0fc4[_0x7283('0x6')]||'';this[_0x7283('0x7')]=_0x1c0fc4[_0x7283('0x7')]||_0x7283('0x8');this[_0x7283('0x9')]=_0x1c0fc4[_0x7283('0x9')]||'';this[_0x7283('0xa')]=_0x1c0fc4[_0x7283('0xa')]||{};}module[_0x7283('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ababa95..4a7f8eb 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 _0x5c10=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x35e0d4,_0x4cc3b2){var _0x481513=function(_0x1b9d9d){while(--_0x1b9d9d){_0x35e0d4['push'](_0x35e0d4['shift']());}};_0x481513(++_0x4cc3b2);}(_0x5c10,0x71));var _0x05c1=function(_0x2785c4,_0x5c6990){_0x2785c4=_0x2785c4-0x0;var _0x3c667f=_0x5c10[_0x2785c4];return _0x3c667f;};'use strict';function ServicenowAccount(_0x3d7ea8){this['id']=_0x3d7ea8['id']||0x0;this[_0x05c1('0x0')]=_0x3d7ea8[_0x05c1('0x0')]||'';this[_0x05c1('0x1')]=_0x3d7ea8['username']||'';this[_0x05c1('0x2')]=_0x3d7ea8[_0x05c1('0x2')]||'';this[_0x05c1('0x3')]=_0x3d7ea8[_0x05c1('0x3')]||'';this[_0x05c1('0x4')]=_0x3d7ea8[_0x05c1('0x4')]||'';this[_0x05c1('0x5')]=_0x3d7ea8[_0x05c1('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xc22d=['Configurations','exports','name','username','password','remoteUri'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc22d,0xe0));var _0xdc22=function(_0x58a4cd,_0x39b244){_0x58a4cd=_0x58a4cd-0x0;var _0x338317=_0xc22d[_0x58a4cd];return _0x338317;};'use strict';function ServicenowAccount(_0x508710){this['id']=_0x508710['id']||0x0;this[_0xdc22('0x0')]=_0x508710[_0xdc22('0x0')]||'';this['username']=_0x508710[_0xdc22('0x1')]||'';this[_0xdc22('0x2')]=_0x508710['password']||'';this['remoteUri']=_0x508710[_0xdc22('0x3')]||'';this['serverUrl']=_0x508710['serverUrl']||'';this[_0xdc22('0x4')]=_0x508710[_0xdc22('0x4')]||{};}module[_0xdc22('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d09954a..1a77953 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 _0x7eac=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2c4260,_0x19882c){var _0x13972e=function(_0x3e7fe6){while(--_0x3e7fe6){_0x2c4260['push'](_0x2c4260['shift']());}};_0x13972e(++_0x19882c);}(_0x7eac,0x19b));var _0xc7ea=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x7eac[_0x2ec461];return _0x28603d;};'use strict';function SugarcrmAccount(_0x1ca463){this['id']=_0x1ca463['id']||0x0;this[_0xc7ea('0x0')]=_0x1ca463[_0xc7ea('0x0')]||'';this[_0xc7ea('0x1')]=_0x1ca463[_0xc7ea('0x1')]||'';this[_0xc7ea('0x2')]=_0x1ca463[_0xc7ea('0x2')]||'';this[_0xc7ea('0x3')]=_0x1ca463[_0xc7ea('0x3')]||'';this[_0xc7ea('0x4')]=_0x1ca463[_0xc7ea('0x4')]||'';this[_0xc7ea('0x5')]=_0x1ca463['Configurations']||{};}module[_0xc7ea('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xa87e=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x23e9e1,_0x42fc20){var _0x12458e=function(_0xd9d89b){while(--_0xd9d89b){_0x23e9e1['push'](_0x23e9e1['shift']());}};_0x12458e(++_0x42fc20);}(_0xa87e,0x1bf));var _0xea87=function(_0x5cac3b,_0x11ddc6){_0x5cac3b=_0x5cac3b-0x0;var _0x1c385e=_0xa87e[_0x5cac3b];return _0x1c385e;};'use strict';function SugarcrmAccount(_0x259957){this['id']=_0x259957['id']||0x0;this['name']=_0x259957[_0xea87('0x0')]||'';this[_0xea87('0x1')]=_0x259957[_0xea87('0x1')]||'';this[_0xea87('0x2')]=_0x259957[_0xea87('0x2')]||'';this[_0xea87('0x3')]=_0x259957[_0xea87('0x3')]||'';this['serverUrl']=_0x259957[_0xea87('0x4')]||'';this[_0xea87('0x5')]=_0x259957[_0xea87('0x5')]||{};}module[_0xea87('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 5188fc8..c4b2599 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 _0xaeaa=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0xaeaa,0xf3));var _0xaaea=function(_0x199971,_0x4670a0){_0x199971=_0x199971-0x0;var _0x230387=_0xaeaa[_0x199971];return _0x230387;};'use strict';function Telephone(_0x9401a9){this['id']=_0x9401a9['id']||0x0;this[_0xaaea('0x0')]=_0x9401a9[_0xaaea('0x0')]||'';this[_0xaaea('0x1')]=_0x9401a9[_0xaaea('0x1')]||'';this[_0xaaea('0x2')]=_0xaaea('0x3');this[_0xaaea('0x4')]=0x0;this[_0xaaea('0x5')]=_0xaaea('0x3');this[_0xaaea('0x6')]='';}module[_0xaaea('0x7')]=Telephone; \ No newline at end of file +var _0xee5b=['stateTime','status','exports','name','accountcode','state','unknown'];(function(_0x3a85ab,_0x1f3525){var _0x32d91a=function(_0x216ab1){while(--_0x216ab1){_0x3a85ab['push'](_0x3a85ab['shift']());}};_0x32d91a(++_0x1f3525);}(_0xee5b,0x1f4));var _0xbee5=function(_0x5918f3,_0x15ee57){_0x5918f3=_0x5918f3-0x0;var _0x7807f6=_0xee5b[_0x5918f3];return _0x7807f6;};'use strict';function Telephone(_0x5384bd){this['id']=_0x5384bd['id']||0x0;this['name']=_0x5384bd[_0xbee5('0x0')]||'';this[_0xbee5('0x1')]=_0x5384bd['accountcode']||'';this[_0xbee5('0x2')]=_0xbee5('0x3');this[_0xbee5('0x4')]=0x0;this[_0xbee5('0x5')]='unknown';this['address']='';}module[_0xbee5('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 af2c93a..7c25951 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(_0x3af16f,_0x5e9a9e){var _0x49bafb=function(_0x2f4b62){while(--_0x2f4b62){_0x3af16f['push'](_0x3af16f['shift']());}};_0x49bafb(++_0x5e9a9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x5701c4,_0x2bebc8){var _0x93787a=function(_0xafad0a){while(--_0xafad0a){_0x5701c4['push'](_0x5701c4['shift']());}};_0x93787a(++_0x2bebc8);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e5d32,_0x19ce13){_0x3e5d32=_0x3e5d32-0x0;var _0x3e7822=_0xb10b[_0x3e5d32];return _0x3e7822;};'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 3df70e7..7a04534 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 7a30f49..336333e 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 _0x6132=['indexOf','split','host','domain','domainport','stateRegistry','defaultuser','exports','active','unknown','stateTime','status','registry'];(function(_0x43e494,_0x200f30){var _0x580e28=function(_0x26b676){while(--_0x26b676){_0x43e494['push'](_0x43e494['shift']());}};_0x580e28(++_0x200f30);}(_0x6132,0x1c2));var _0x2613=function(_0x2892be,_0xc0238b){_0x2892be=_0x2892be-0x0;var _0x1374d7=_0x6132[_0x2892be];return _0x1374d7;};'use strict';function Trunk(_0x1cbea8){this['id']=_0x1cbea8['id']||0x0;this[_0x2613('0x0')]=_0x1cbea8[_0x2613('0x0')]||![];this['name']=_0x1cbea8['name']||'';this['state']=_0x2613('0x1');this[_0x2613('0x2')]=0x0;this[_0x2613('0x3')]='unknown';this[_0x2613('0x4')]=_0x1cbea8[_0x2613('0x4')]&&_0x1cbea8[_0x2613('0x4')][_0x2613('0x5')](':')?_0x1cbea8['registry'][_0x2613('0x6')](':')[0x0]:'';this[_0x2613('0x7')]='';this['port']='';this[_0x2613('0x8')]='';this[_0x2613('0x9')]='';this['refresh']='';this[_0x2613('0xa')]=_0x2613('0x1');this['registrationtime']='';this['address']='';this[_0x2613('0xb')]=_0x1cbea8[_0x2613('0xb')]||'';}module[_0x2613('0xc')]=Trunk; \ No newline at end of file +var _0xb810=['host','port','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','unknown','stateTime','status','registry','indexOf','split'];(function(_0x1b8a37,_0x358990){var _0x1fa6ba=function(_0x3a1623){while(--_0x3a1623){_0x1b8a37['push'](_0x1b8a37['shift']());}};_0x1fa6ba(++_0x358990);}(_0xb810,0x188));var _0x0b81=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb810[_0xc4001c];return _0x49f7bc;};'use strict';function Trunk(_0x6880f2){this['id']=_0x6880f2['id']||0x0;this['active']=_0x6880f2[_0x0b81('0x0')]||![];this[_0x0b81('0x1')]=_0x6880f2[_0x0b81('0x1')]||'';this['state']=_0x0b81('0x2');this[_0x0b81('0x3')]=0x0;this[_0x0b81('0x4')]=_0x0b81('0x2');this[_0x0b81('0x5')]=_0x6880f2[_0x0b81('0x5')]&&_0x6880f2[_0x0b81('0x5')][_0x0b81('0x6')](':')?_0x6880f2[_0x0b81('0x5')][_0x0b81('0x7')](':')[0x0]:'';this[_0x0b81('0x8')]='';this[_0x0b81('0x9')]='';this['domain']='';this[_0x0b81('0xa')]='';this[_0x0b81('0xb')]='';this[_0x0b81('0xc')]=_0x0b81('0x2');this[_0x0b81('0xd')]='';this[_0x0b81('0xe')]='';this['defaultuser']=_0x6880f2[_0x0b81('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 5edf2ac..0f70ae4 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 _0x1446=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x1446,0x66));var _0x6144=function(_0x58eaf3,_0x3cbdc1){_0x58eaf3=_0x58eaf3-0x0;var _0xa79055=_0x1446[_0x58eaf3];return _0xa79055;};'use strict';function voiceExtension(_0x1efa7e){this['id']=_0x1efa7e['id']||0x0;this['exten']=_0x1efa7e[_0x6144('0x0')]||'';this['recordingFormat']=_0x1efa7e[_0x6144('0x1')]||'none';this[_0x6144('0x2')]=_0x1efa7e['mandatoryDisposition']||![];}module[_0x6144('0x3')]=voiceExtension; \ No newline at end of file +var _0xf14d=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x494f6e,_0x39e456){var _0x345231=function(_0x5cfbb8){while(--_0x5cfbb8){_0x494f6e['push'](_0x494f6e['shift']());}};_0x345231(++_0x39e456);}(_0xf14d,0x162));var _0xdf14=function(_0x27f90a,_0x4204d2){_0x27f90a=_0x27f90a-0x0;var _0x4719c6=_0xf14d[_0x27f90a];return _0x4719c6;};'use strict';function voiceExtension(_0x6dc43){this['id']=_0x6dc43['id']||0x0;this[_0xdf14('0x0')]=_0x6dc43[_0xdf14('0x0')]||'';this[_0xdf14('0x1')]=_0x6dc43['recordingFormat']||_0xdf14('0x2');this[_0xdf14('0x3')]=_0x6dc43[_0xdf14('0x3')]||![];}module[_0xdf14('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 a97722c..e2dd6cf 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 _0xdbf5=['outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','wav49','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','answered','sumDuration','sumBillable','available','invalid','notInUse','onHold','paused','ringing','ringInUse','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundUnknownCallsDay'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x224860,_0x3dc2b3){_0x224860=_0x224860-0x0;var _0x36c3cc=_0xdbf5[_0x224860];return _0x36c3cc;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x5dbf('0x0'),'gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x5dbf('0x1'),'linear':_0x5dbf('0x2'),'random':_0x5dbf('0x3'),'ringall':_0x5dbf('0x4'),'rr':_0x5dbf('0x5'),'rrmemory':_0x5dbf('0x6'),'rrordered':_0x5dbf('0x7'),'wrandom':_0x5dbf('0x8')};function VoiceQueue(_0x3f8628){this['id']=_0x3f8628['id']||0x0;this[_0x5dbf('0x9')]=_0x3f8628[_0x5dbf('0x9')]||'';this[_0x5dbf('0xa')]=_0x3f8628[_0x5dbf('0xa')]||'';this['type']=_0x3f8628[_0x5dbf('0xb')]||'inbound';this[_0x5dbf('0xc')]=0x0;this[_0x5dbf('0xd')]=0x0;this[_0x5dbf('0xe')]=0x0;this[_0x5dbf('0xf')]=0x0;this['sumHoldTime']=0x0;this[_0x5dbf('0x10')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x5dbf('0x11')]=0x0;this['busy']=0x0;this['inUse']=0x0;this[_0x5dbf('0x12')]=0x0;this['loggedIn']=0x0;this[_0x5dbf('0x13')]=0x0;this[_0x5dbf('0x14')]=0x0;this[_0x5dbf('0x15')]=0x0;this[_0x5dbf('0x16')]=0x0;this[_0x5dbf('0x17')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this[_0x5dbf('0x18')]=0x0;this[_0x5dbf('0x19')]=_0x3f8628['acw']||![];this[_0x5dbf('0x1a')]=_0x3f8628[_0x5dbf('0x1a')]||0xa;this[_0x5dbf('0x1b')]=_0x3f8628[_0x5dbf('0x1b')]||'no';this[_0x5dbf('0x1c')]=!![];this[_0x5dbf('0x1d')]='';this[_0x5dbf('0x1e')]='';this['originated']=0x0;this['temp']=0x0;this[_0x5dbf('0x1f')]=_0x3f8628[_0x5dbf('0x1f')]||null;this[_0x5dbf('0x20')]=_0x3f8628[_0x5dbf('0x20')]?_0x3f8628[_0x5dbf('0x20')]:null;this['dialActive']=_0x3f8628[_0x5dbf('0x21')];this['dialMethod']=_0x3f8628['dialMethod']||'progressive';this[_0x5dbf('0x22')]=_0x3f8628[_0x5dbf('0x22')]||0x0;this[_0x5dbf('0x23')]=_0x3f8628[_0x5dbf('0x23')]||0x0;this[_0x5dbf('0x24')]=_0x3f8628['dialPowerLevel']||0x1;this[_0x5dbf('0x25')]=_0x3f8628['dialPredictiveOptimization']||_0x5dbf('0x26');this[_0x5dbf('0x27')]=_0x3f8628[_0x5dbf('0x27')]||0.03;this[_0x5dbf('0x28')]=_0x3f8628[_0x5dbf('0x28')]||0x258;this[_0x5dbf('0x29')]=_0x3f8628['dialOriginateCallerIdName']||_0x5dbf('0x2a');this[_0x5dbf('0x2b')]=_0x3f8628[_0x5dbf('0x2b')]||_0x5dbf('0x2a');this[_0x5dbf('0x2c')]=_0x3f8628[_0x5dbf('0x2c')]||0x1e;this[_0x5dbf('0x2d')]=_0x3f8628[_0x5dbf('0x2d')]||_0x5dbf('0x2e');this[_0x5dbf('0x2f')]=_0x3f8628[_0x5dbf('0x2f')]||0x3;this[_0x5dbf('0x30')]=_0x3f8628[_0x5dbf('0x30')]||undefined;this[_0x5dbf('0x31')]=_0x3f8628[_0x5dbf('0x31')]||0x3;this[_0x5dbf('0x32')]=_0x3f8628[_0x5dbf('0x32')]||0x96;this[_0x5dbf('0x33')]=_0x3f8628[_0x5dbf('0x33')]||0x3;this[_0x5dbf('0x34')]=_0x3f8628[_0x5dbf('0x34')]||0x96;this[_0x5dbf('0x35')]=_0x3f8628[_0x5dbf('0x35')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3f8628[_0x5dbf('0x36')]||0x96;this[_0x5dbf('0x37')]=_0x3f8628[_0x5dbf('0x37')]||0x3;this[_0x5dbf('0x38')]=_0x3f8628[_0x5dbf('0x38')]||0x96;this[_0x5dbf('0x39')]=_0x3f8628[_0x5dbf('0x39')]||0x3;this[_0x5dbf('0x3a')]=_0x3f8628[_0x5dbf('0x3a')]||0x96;this[_0x5dbf('0x3b')]=_0x3f8628[_0x5dbf('0x3b')]||0x3;this['dialAbandonedRetryFrequency']=_0x3f8628['dialAbandonedRetryFrequency']||0x96;this[_0x5dbf('0x3c')]=_0x3f8628[_0x5dbf('0x3c')]||0x3;this[_0x5dbf('0x3d')]=_0x3f8628[_0x5dbf('0x3d')]||0x96;this[_0x5dbf('0x3e')]=_0x3f8628['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x3f8628[_0x5dbf('0x3f')]||0x96;this[_0x5dbf('0x40')]=_0x3f8628['callAdditionalPhoneAfterMin']||0x3;this[_0x5dbf('0x41')]=_0x3f8628[_0x5dbf('0x41')]||0x4;this[_0x5dbf('0x42')]=_0x3f8628[_0x5dbf('0x42')]?_0x3f8628[_0x5dbf('0x42')]:undefined;this['TrunkBackup']=_0x3f8628[_0x5dbf('0x43')]?_0x3f8628[_0x5dbf('0x43')]:undefined;this[_0x5dbf('0x44')]=_0x3f8628[_0x5dbf('0x44')]||undefined;this[_0x5dbf('0x45')]=_0x3f8628['Interval']?_0x3f8628[_0x5dbf('0x45')]:undefined;this[_0x5dbf('0x46')]=_0x3f8628[_0x5dbf('0x46')]||_0x5dbf('0x47');this['dialRandomLastDigitCallerIdNumber']=_0x3f8628[_0x5dbf('0x48')]||undefined;this[_0x5dbf('0x49')]=_0x3f8628[_0x5dbf('0x49')]||undefined;this[_0x5dbf('0x4a')]=strategy[_0x3f8628[_0x5dbf('0x4a')]];this[_0x5dbf('0x4b')]=!![];this[_0x5dbf('0x4c')]=_0x3f8628[_0x5dbf('0x4c')]||![];this[_0x5dbf('0x4d')]=_0x3f8628[_0x5dbf('0x4d')];this[_0x5dbf('0x4e')]=_0x3f8628['dialAMDGreeting'];this[_0x5dbf('0x4f')]=_0x3f8628[_0x5dbf('0x4f')];this[_0x5dbf('0x50')]=_0x3f8628['dialAMDTotalAnalysisTime'];this[_0x5dbf('0x51')]=_0x3f8628[_0x5dbf('0x51')];this[_0x5dbf('0x52')]=_0x3f8628['dialAMDBetweenWordsSilence'];this[_0x5dbf('0x53')]=_0x3f8628[_0x5dbf('0x53')];this[_0x5dbf('0x54')]=_0x3f8628['dialAMDSilenceThreshold'];this[_0x5dbf('0x55')]=_0x3f8628[_0x5dbf('0x55')];this[_0x5dbf('0x56')]=0x0;this[_0x5dbf('0x57')]=0x0;this[_0x5dbf('0x58')]=_0x3f8628[_0x5dbf('0x58')];this[_0x5dbf('0x59')]=0x0;this[_0x5dbf('0x5a')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x5dbf('0x5b')]=0x0;this[_0x5dbf('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x5dbf('0x5d')]=0x0;this[_0x5dbf('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x5dbf('0x5f')]=0x0;this[_0x5dbf('0x60')]=0x0;this[_0x5dbf('0x61')]=undefined;this[_0x5dbf('0x62')]=undefined;this[_0x5dbf('0x63')]=undefined;this[_0x5dbf('0x64')]=1.05;this[_0x5dbf('0x65')]=0x0;this[_0x5dbf('0x66')]=0x0;this[_0x5dbf('0x67')]=0x0;this[_0x5dbf('0x68')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x5dbf('0x69')]=0x0;this[_0x5dbf('0x6a')]=0x0;this[_0x5dbf('0x6b')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3f8628[_0x5dbf('0x6c')]||0x14;this[_0x5dbf('0x6d')]=_0x3f8628[_0x5dbf('0x6c')]||0xa;this[_0x5dbf('0x6e')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x5dbf('0x6f')]=0x1;this['erlangCalls']=0x0;this[_0x5dbf('0x70')]=0x0;this[_0x5dbf('0x71')]=0x0;this[_0x5dbf('0x72')]=0x0;this[_0x5dbf('0x73')]=_0x3f8628['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x3f8628[_0x5dbf('0x74')]||![];this[_0x5dbf('0x75')]=!!_0x3f8628[_0x5dbf('0x75')]||![];this['dialPreviewRecallmeReminder']=!!_0x3f8628[_0x5dbf('0x76')]||![];this['dialQueueProject2']=_0x3f8628['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x3f8628['dialAgiAfterHangupClient']||![];this[_0x5dbf('0x77')]=_0x3f8628[_0x5dbf('0x77')]||![];this['monitor_format']=monitorFormat[_0x3f8628[_0x5dbf('0xa')]]?monitorFormat[_0x3f8628[_0x5dbf('0xa')]]:undefined;this['mandatoryDisposition']=_0x3f8628[_0x5dbf('0x78')]||![];this[_0x5dbf('0x79')]=_0x3f8628['mandatoryDispositionPause']?_0x3f8628[_0x5dbf('0x79')]:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0xc4ea=['unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav49','gsm','fewestcalls','random','ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable'];(function(_0x19d570,_0x253572){var _0x31c8a8=function(_0x316457){while(--_0x316457){_0x19d570['push'](_0x19d570['shift']());}};_0x31c8a8(++_0x253572);}(_0xc4ea,0x1ef));var _0xac4e=function(_0x1a06aa,_0x1fc2b9){_0x1a06aa=_0x1a06aa-0x0;var _0x41d283=_0xc4ea[_0x1a06aa];return _0x41d283;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xac4e('0x0'),'gsm':_0xac4e('0x1')};var strategy={'fewestcalls':_0xac4e('0x2'),'leastrecent':'leastrecent','linear':'linear','random':_0xac4e('0x3'),'ringall':_0xac4e('0x4'),'rr':_0xac4e('0x5'),'rrmemory':_0xac4e('0x6'),'rrordered':_0xac4e('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x31a07e){this['id']=_0x31a07e['id']||0x0;this[_0xac4e('0x8')]=_0x31a07e[_0xac4e('0x8')]||'';this[_0xac4e('0x9')]=_0x31a07e[_0xac4e('0x9')]||'';this[_0xac4e('0xa')]=_0x31a07e[_0xac4e('0xa')]||_0xac4e('0xb');this[_0xac4e('0xc')]=0x0;this[_0xac4e('0xd')]=0x0;this[_0xac4e('0xe')]=0x0;this['sumDuration']=0x0;this[_0xac4e('0xf')]=0x0;this[_0xac4e('0x10')]=0x0;this[_0xac4e('0x11')]=0x0;this[_0xac4e('0x12')]=0x0;this[_0xac4e('0x13')]=0x0;this[_0xac4e('0x14')]=0x0;this[_0xac4e('0x15')]=0x0;this[_0xac4e('0x16')]=0x0;this[_0xac4e('0x17')]=0x0;this[_0xac4e('0x18')]=0x0;this[_0xac4e('0x19')]=0x0;this[_0xac4e('0x1a')]=0x0;this[_0xac4e('0x1b')]=0x0;this[_0xac4e('0x1c')]=0x0;this['talking']=0x0;this[_0xac4e('0x1d')]=0x0;this['unknown']=0x0;this[_0xac4e('0x1e')]=_0x31a07e[_0xac4e('0x1e')]||![];this['acwTimeout']=_0x31a07e[_0xac4e('0x1f')]||0xa;this[_0xac4e('0x20')]=_0x31a07e[_0xac4e('0x20')]||'no';this[_0xac4e('0x21')]=!![];this['message']='';this[_0xac4e('0x22')]='';this[_0xac4e('0x23')]=0x0;this[_0xac4e('0x24')]=0x0;this[_0xac4e('0x25')]=_0x31a07e['dialTimezone']||null;this['dialGlobalInterval']=_0x31a07e[_0xac4e('0x26')]?_0x31a07e[_0xac4e('0x26')]:null;this[_0xac4e('0x27')]=_0x31a07e[_0xac4e('0x27')];this[_0xac4e('0x28')]=_0x31a07e[_0xac4e('0x28')]||'progressive';this[_0xac4e('0x29')]=_0x31a07e[_0xac4e('0x29')]||0x0;this['dialLimitQueue']=_0x31a07e[_0xac4e('0x2a')]||0x0;this[_0xac4e('0x2b')]=_0x31a07e[_0xac4e('0x2b')]||0x1;this[_0xac4e('0x2c')]=_0x31a07e[_0xac4e('0x2c')]||'dropRate';this[_0xac4e('0x2d')]=_0x31a07e[_0xac4e('0x2d')]||0.03;this['dialPredictiveInterval']=_0x31a07e['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x31a07e[_0xac4e('0x2e')]||_0xac4e('0x2f');this[_0xac4e('0x30')]=_0x31a07e[_0xac4e('0x30')]||_0xac4e('0x2f');this['dialOriginateTimeout']=_0x31a07e[_0xac4e('0x31')]||0x1e;this['dialQueueOptions']=_0x31a07e[_0xac4e('0x32')]||_0xac4e('0x33');this[_0xac4e('0x34')]=_0x31a07e[_0xac4e('0x34')]||0x3;this[_0xac4e('0x35')]=_0x31a07e[_0xac4e('0x35')]||undefined;this[_0xac4e('0x36')]=_0x31a07e[_0xac4e('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x31a07e['dialCongestionRetryFrequency']||0x96;this[_0xac4e('0x37')]=_0x31a07e[_0xac4e('0x37')]||0x3;this['dialBusyRetryFrequency']=_0x31a07e[_0xac4e('0x38')]||0x96;this['dialNoAnswerMaxRetry']=_0x31a07e[_0xac4e('0x39')]||0x3;this[_0xac4e('0x3a')]=_0x31a07e[_0xac4e('0x3a')]||0x96;this[_0xac4e('0x3b')]=_0x31a07e['dialNoSuchNumberMaxRetry']||0x3;this[_0xac4e('0x3c')]=_0x31a07e[_0xac4e('0x3c')]||0x96;this[_0xac4e('0x3d')]=_0x31a07e['dialDropMaxRetry']||0x3;this[_0xac4e('0x3e')]=_0x31a07e[_0xac4e('0x3e')]||0x96;this[_0xac4e('0x3f')]=_0x31a07e[_0xac4e('0x3f')]||0x3;this['dialAbandonedRetryFrequency']=_0x31a07e[_0xac4e('0x40')]||0x96;this[_0xac4e('0x41')]=_0x31a07e[_0xac4e('0x41')]||0x3;this[_0xac4e('0x42')]=_0x31a07e['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x31a07e['dialAgentRejectMaxRetry']||0x3;this[_0xac4e('0x43')]=_0x31a07e['dialAgentRejectRetryFrequency']||0x96;this[_0xac4e('0x44')]=_0x31a07e['callAdditionalPhoneAfterMin']||0x3;this[_0xac4e('0x45')]=_0x31a07e[_0xac4e('0x45')]||0x4;this[_0xac4e('0x46')]=_0x31a07e[_0xac4e('0x46')]?_0x31a07e['Trunk']:undefined;this[_0xac4e('0x47')]=_0x31a07e[_0xac4e('0x47')]?_0x31a07e[_0xac4e('0x47')]:undefined;this[_0xac4e('0x48')]=_0x31a07e[_0xac4e('0x48')]||undefined;this[_0xac4e('0x49')]=_0x31a07e[_0xac4e('0x49')]?_0x31a07e['Interval']:undefined;this[_0xac4e('0x4a')]=_0x31a07e['dialOrderByScheduledAt']||'DESC';this[_0xac4e('0x4b')]=_0x31a07e['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xac4e('0x4c')]=_0x31a07e[_0xac4e('0x4c')]||undefined;this[_0xac4e('0x4d')]=strategy[_0x31a07e['strategy']];this['queueStatusComplete']=!![];this[_0xac4e('0x4e')]=_0x31a07e[_0xac4e('0x4e')]||![];this[_0xac4e('0x4f')]=_0x31a07e[_0xac4e('0x4f')];this['dialAMDGreeting']=_0x31a07e[_0xac4e('0x50')];this[_0xac4e('0x51')]=_0x31a07e[_0xac4e('0x51')];this[_0xac4e('0x52')]=_0x31a07e['dialAMDTotalAnalysisTime'];this[_0xac4e('0x53')]=_0x31a07e[_0xac4e('0x53')];this[_0xac4e('0x54')]=_0x31a07e[_0xac4e('0x54')];this['dialAMDMaximumNumberOfWords']=_0x31a07e['dialAMDMaximumNumberOfWords'];this[_0xac4e('0x55')]=_0x31a07e[_0xac4e('0x55')];this[_0xac4e('0x56')]=_0x31a07e['dialAMDMaximumWordLength'];this[_0xac4e('0x57')]=0x0;this[_0xac4e('0x58')]=0x0;this[_0xac4e('0x59')]=_0x31a07e[_0xac4e('0x59')];this[_0xac4e('0x5a')]=0x0;this[_0xac4e('0x5b')]=0x0;this[_0xac4e('0x5c')]=0x0;this[_0xac4e('0x5d')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xac4e('0x5e')]=0x0;this[_0xac4e('0x5f')]=0x0;this[_0xac4e('0x60')]=0x0;this[_0xac4e('0x61')]=0x0;this[_0xac4e('0x62')]=0x0;this[_0xac4e('0x63')]=0x0;this[_0xac4e('0x64')]=0x0;this[_0xac4e('0x65')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xac4e('0x66')]=undefined;this['startPredictive']=undefined;this[_0xac4e('0x67')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xac4e('0x68')]=0x0;this[_0xac4e('0x69')]=0x0;this[_0xac4e('0x6a')]=0x0;this[_0xac4e('0x6b')]=0x0;this[_0xac4e('0x6c')]=0x0;this[_0xac4e('0x6d')]=0x0;this[_0xac4e('0x6e')]=0x0;this[_0xac4e('0x6f')]=0x0;this[_0xac4e('0x70')]=_0x31a07e[_0xac4e('0x71')]||0x14;this['predictiveIntervalMinThreshold']=_0x31a07e[_0xac4e('0x71')]||0xa;this[_0xac4e('0x72')]=0x0;this[_0xac4e('0x73')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0xac4e('0x74')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xac4e('0x75')]=0x0;this[_0xac4e('0x76')]=_0x31a07e[_0xac4e('0x76')]||0x1e;this[_0xac4e('0x77')]=_0x31a07e[_0xac4e('0x77')]||![];this[_0xac4e('0x78')]=!!_0x31a07e[_0xac4e('0x78')]||![];this[_0xac4e('0x79')]=!!_0x31a07e['dialPreviewRecallmeReminder']||![];this[_0xac4e('0x7a')]=_0x31a07e['dialQueueProject2']||undefined;this[_0xac4e('0x7b')]=_0x31a07e[_0xac4e('0x7b')]||![];this['dialAgiAfterHangupAgent']=_0x31a07e[_0xac4e('0x7c')]||![];this[_0xac4e('0x9')]=monitorFormat[_0x31a07e[_0xac4e('0x9')]]?monitorFormat[_0x31a07e[_0xac4e('0x9')]]:undefined;this[_0xac4e('0x7d')]=_0x31a07e[_0xac4e('0x7d')]||![];this[_0xac4e('0x7e')]=_0x31a07e['mandatoryDispositionPause']?_0x31a07e[_0xac4e('0x7e')]:undefined;this[_0xac4e('0x7f')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index e3111c7..537dc12 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb66=['strategy','abandoned','busy','onHold','notInUse','sumDuration','sumHoldTime','total','type','unavailable','unknown','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','invalid','ringInUse','loggedin','callers','SIP/','incall','includes','status','booked','length','dialer','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','loggedIn','loggedInDb','paused','ringing','talking','available','answered','inUse','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','name'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xcb66,0x19f));var _0x6cb6=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0xcb66[_0x30182f];return _0x5207db;};'use strict';var INBOUND_COUNTERS=['available',_0x6cb6('0x0'),_0x6cb6('0x1'),_0x6cb6('0x2'),_0x6cb6('0x3'),_0x6cb6('0x4'),'waiting'];var OUTBOUND_COUNTERS=[_0x6cb6('0x5'),_0x6cb6('0x6'),_0x6cb6('0x7'),_0x6cb6('0x0'),_0x6cb6('0x1'),'originated','outboundAbandonedCallsDay',_0x6cb6('0x8'),_0x6cb6('0x9'),_0x6cb6('0xa'),_0x6cb6('0xb'),_0x6cb6('0xc'),_0x6cb6('0xd'),_0x6cb6('0xe'),_0x6cb6('0xf'),_0x6cb6('0x10'),_0x6cb6('0x2'),_0x6cb6('0x11'),_0x6cb6('0x4'),_0x6cb6('0x12'),'sumDuration','total','waiting'];function VoiceQueueSummary(_0x54b466){this['id']=_0x54b466['id'];this[_0x6cb6('0x13')]=_0x54b466[_0x6cb6('0x13')];this[_0x6cb6('0x14')]=_0x54b466[_0x6cb6('0x14')];this['abandoned']=_0x54b466[_0x6cb6('0x15')]||0x0;this[_0x6cb6('0x6')]=_0x54b466['answered']||0x0;this[_0x6cb6('0x5')]=_0x54b466[_0x6cb6('0x5')]||0x0;this['busy']=_0x54b466[_0x6cb6('0x16')]||0x0;this[_0x6cb6('0x7')]=_0x54b466['inUse']||0x0;this['invalid']=_0x54b466['invalid']||0x0;this['loggedIn']=_0x54b466[_0x6cb6('0x0')]||0x0;this[_0x6cb6('0x1')]=_0x54b466[_0x6cb6('0x1')]||0x0;this[_0x6cb6('0x17')]=_0x54b466[_0x6cb6('0x17')]||0x0;this[_0x6cb6('0x18')]=_0x54b466['notInUse']||0x0;this[_0x6cb6('0x2')]=_0x54b466[_0x6cb6('0x2')]||0x0;this['ringing']=_0x54b466['ringing']||0x0;this['ringInUse']=_0x54b466['ringInUse'];this['sumBillable']=_0x54b466['sumBillable'];this[_0x6cb6('0x19')]=_0x54b466[_0x6cb6('0x19')];this[_0x6cb6('0x1a')]=_0x54b466[_0x6cb6('0x1a')]||0x0;this[_0x6cb6('0x4')]=_0x54b466['talking']||0x0;this['total']=_0x54b466[_0x6cb6('0x1b')]||0x0;this[_0x6cb6('0x1c')]=_0x54b466[_0x6cb6('0x1c')];this[_0x6cb6('0x1d')]=_0x54b466['unavailable']||0x0;this[_0x6cb6('0x1e')]=_0x54b466[_0x6cb6('0x1e')]||0x0;this['unmanaged']=_0x54b466['unmanaged']||0x0;this[_0x6cb6('0x1f')]=_0x54b466['waiting']||0x0;if(_0x54b466[_0x6cb6('0x1c')]===_0x6cb6('0x20')){this[_0x6cb6('0x11')]=_0x54b466[_0x6cb6('0x11')]||0x0;this[_0x6cb6('0x21')]=_0x54b466[_0x6cb6('0x21')];this[_0x6cb6('0x22')]=_0x54b466[_0x6cb6('0x22')];this[_0x6cb6('0x23')]=_0x54b466[_0x6cb6('0x23')];this['dialOriginateCallerIdNumber']=_0x54b466['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x54b466[_0x6cb6('0x24')];this[_0x6cb6('0x25')]=_0x54b466[_0x6cb6('0x25')];this[_0x6cb6('0x26')]=_0x54b466[_0x6cb6('0x26')];this[_0x6cb6('0x27')]=_0x54b466['outboundAnswerAgiCallsDay'];this[_0x6cb6('0x8')]=_0x54b466['outboundAnswerCallsDay'];this[_0x6cb6('0x9')]=_0x54b466['outboundBlacklistCallsDay'];this[_0x6cb6('0xa')]=_0x54b466[_0x6cb6('0xa')];this[_0x6cb6('0xb')]=_0x54b466['outboundCongestionCallsDay'];this[_0x6cb6('0x28')]=_0x54b466[_0x6cb6('0x28')];this[_0x6cb6('0x29')]=_0x54b466['outboundDropCallsDayCallersExit'];this[_0x6cb6('0x2a')]=_0x54b466[_0x6cb6('0x2a')];this[_0x6cb6('0xc')]=_0x54b466['outboundNoAnswerCallsDay'];this[_0x6cb6('0xd')]=_0x54b466[_0x6cb6('0xd')];this['outboundOriginateFailureCallsDay']=_0x54b466[_0x6cb6('0x2b')];this[_0x6cb6('0xe')]=_0x54b466[_0x6cb6('0xe')];this[_0x6cb6('0xf')]=_0x54b466[_0x6cb6('0xf')];this[_0x6cb6('0x10')]=_0x54b466[_0x6cb6('0x10')];this[_0x6cb6('0x2c')]=_0x54b466[_0x6cb6('0x2c')];this[_0x6cb6('0x2d')]=_0x54b466['predictiveIntervalAvgHoldtime'];this[_0x6cb6('0x2e')]=_0x54b466[_0x6cb6('0x2e')];this[_0x6cb6('0x2f')]=_0x54b466[_0x6cb6('0x2f')];this['predictiveIntervalDroppedCallsTimeout']=_0x54b466['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x54b466[_0x6cb6('0x30')];this[_0x6cb6('0x31')]=_0x54b466[_0x6cb6('0x31')];this[_0x6cb6('0x32')]=_0x54b466[_0x6cb6('0x32')];this[_0x6cb6('0x33')]=_0x54b466[_0x6cb6('0x33')];this[_0x6cb6('0x34')]=_0x54b466['predictiveIntervalPauses'];this[_0x6cb6('0x35')]=_0x54b466['predictiveIntervalAvailable'];this[_0x6cb6('0x36')]=_0x54b466[_0x6cb6('0x36')];this[_0x6cb6('0x37')]=_0x54b466[_0x6cb6('0x37')];this[_0x6cb6('0x38')]=_0x54b466[_0x6cb6('0x38')];this[_0x6cb6('0x39')]=_0x54b466['erlangCallToSecond'];this[_0x6cb6('0x3a')]=_0x54b466['erlangAbandonmentRate'];this[_0x6cb6('0x3b')]=_0x54b466[_0x6cb6('0x3b')];this[_0x6cb6('0x3c')]=_0x54b466['startPredictive'];this['startProgressive']=_0x54b466[_0x6cb6('0x3d')];this['message']=_0x54b466[_0x6cb6('0x3e')];this[_0x6cb6('0x3f')]=_0x54b466[_0x6cb6('0x3f')];}if(_0x54b466[_0x6cb6('0x40')]){this[_0x6cb6('0x40')]={'id':_0x54b466[_0x6cb6('0x40')]['id'],'name':_0x54b466[_0x6cb6('0x40')]['name'],'active':_0x54b466[_0x6cb6('0x40')][_0x6cb6('0x41')],'callerid':_0x54b466['Trunk'][_0x6cb6('0x42')]};}}VoiceQueueSummary[_0x6cb6('0x43')][_0x6cb6('0x44')]=function(_0x31a391,_0x15a0a8,_0x3b435e,_0x571cba){this['loggedInDb']=0x0;this[_0x6cb6('0x4')]=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0x6cb6('0x18')]=0x0;this['inUse']=0x0;this[_0x6cb6('0x16')]=0x0;this[_0x6cb6('0x45')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0x6cb6('0x46')]=0x0;this['onHold']=0x0;if(_0x3b435e){if(_0x3b435e[_0x6cb6('0x5')]){this[_0x6cb6('0x5')]=Number(_0x3b435e['available']);}if(_0x3b435e[_0x6cb6('0x47')]){this[_0x6cb6('0x0')]=Number(_0x3b435e['loggedin']);}if(_0x3b435e[_0x6cb6('0x48')]){this['waiting']=Number(_0x3b435e[_0x6cb6('0x48')]);}}for(var _0x12adad=0x0;_0x12adad<_0x31a391['length'];_0x12adad++){var _0x33a337=_0x15a0a8[_0x6cb6('0x49')+_0x31a391[_0x12adad]['name']];if(_0x33a337&&_0x33a337['online']){this[_0x6cb6('0x1')]+=0x1;}if(_0x31a391[_0x12adad][_0x6cb6('0x4a')]==='1'){this[_0x6cb6('0x4')]+=0x1;}if(_0x31a391[_0x12adad]['paused']==='1'&&!['2','7','8'][_0x6cb6('0x4b')](_0x31a391[_0x12adad][_0x6cb6('0x4c')])){this['paused']+=0x1;}switch(_0x31a391[_0x12adad][_0x6cb6('0x4c')]){case'0':this[_0x6cb6('0x1e')]+=0x1;break;case'1':this[_0x6cb6('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x6cb6('0x16')]+=0x1;break;case'4':this[_0x6cb6('0x45')]+=0x1;break;case'5':this[_0x6cb6('0x1d')]+=0x1;break;case'6':this[_0x6cb6('0x3')]+=0x1;break;case'7':this[_0x6cb6('0x46')]+=0x1;break;case'8':this[_0x6cb6('0x17')]+=0x1;break;}}if(this['dialMethod']===_0x6cb6('0x4d')){var _0x5c20d1=Object['keys'](_0x571cba);for(var _0x29cb39=0x0;_0x29cb39<_0x5c20d1[_0x6cb6('0x4e')];_0x29cb39++){var _0x4b4137=_0x5c20d1[_0x29cb39];var _0x46aa10=_0x571cba[_0x4b4137];if(_0x46aa10['queue']===this[_0x6cb6('0x13')]&&_0x46aa10[_0x6cb6('0x1c')]===_0x6cb6('0x4f')&&_0x46aa10['exten']===_0x6cb6('0x50')){this[_0x6cb6('0x4')]+=0x1;}}if(this[_0x6cb6('0x4')]>this['inUse']){this[_0x6cb6('0x4')]=this['inUse'];}this[_0x6cb6('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x6cb6('0x43')][_0x6cb6('0x51')]=function(_0x5da497){var _0x5e795c=![];if(_0x5da497){_0x5e795c=INBOUND_COUNTERS[_0x6cb6('0x52')](function(_0x3dca6c){return this[_0x3dca6c]!==_0x5da497[_0x3dca6c];},this);}return _0x5e795c;};VoiceQueueSummary[_0x6cb6('0x43')]['compareToOutboundQueue']=function(_0x1888f9){var _0x67013b=![];var _0x4567ae=![];var _0x486b3e=![];if(_0x1888f9){_0x67013b=this[_0x6cb6('0x22')]!==_0x1888f9[_0x6cb6('0x22')]||this[_0x6cb6('0x21')]!==_0x1888f9['dialActive']||this[_0x6cb6('0x3e')]!==_0x1888f9[_0x6cb6('0x3e')]||this[_0x6cb6('0x3f')]!==_0x1888f9[_0x6cb6('0x3f')];_0x4567ae=OUTBOUND_COUNTERS[_0x6cb6('0x52')](function(_0x2a157e){return this[_0x2a157e]!==_0x1888f9[_0x2a157e];},this);if(this[_0x6cb6('0x40')]&&_0x1888f9[_0x6cb6('0x40')]){_0x486b3e=this[_0x6cb6('0x40')][_0x6cb6('0x13')]!==_0x1888f9[_0x6cb6('0x40')][_0x6cb6('0x13')]||this['Trunk'][_0x6cb6('0x41')]!==_0x1888f9[_0x6cb6('0x40')]['active'];}}return _0x67013b||_0x4567ae||_0x486b3e;};VoiceQueueSummary[_0x6cb6('0x43')][_0x6cb6('0x53')]=function(_0x5929e7){this[_0x6cb6('0x6')]=_0x5929e7[_0x6cb6('0x6')];this[_0x6cb6('0x3e')]=_0x5929e7['message'];this[_0x6cb6('0x3f')]=_0x5929e7[_0x6cb6('0x3f')];this[_0x6cb6('0x37')]=_0x5929e7[_0x6cb6('0x37')];this[_0x6cb6('0x54')]=_0x5929e7[_0x6cb6('0x54')];this[_0x6cb6('0x8')]=_0x5929e7[_0x6cb6('0x8')];this[_0x6cb6('0x9')]=_0x5929e7[_0x6cb6('0x9')];this['outboundBusyCallsDay']=_0x5929e7[_0x6cb6('0xa')];this[_0x6cb6('0xb')]=_0x5929e7['outboundCongestionCallsDay'];this[_0x6cb6('0xc')]=_0x5929e7['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x5929e7[_0x6cb6('0xd')];this[_0x6cb6('0xe')]=_0x5929e7[_0x6cb6('0xe')];this[_0x6cb6('0xf')]=_0x5929e7[_0x6cb6('0xf')];this['outboundUnknownCallsDay']=_0x5929e7[_0x6cb6('0x10')];this[_0x6cb6('0x12')]=_0x5929e7['sumBillable'];this[_0x6cb6('0x19')]=_0x5929e7[_0x6cb6('0x19')];this[_0x6cb6('0x1b')]=_0x5929e7['total'];if(this[_0x6cb6('0x22')]===_0x6cb6('0x55')){this[_0x6cb6('0x11')]=_0x5929e7[_0x6cb6('0x11')];}};module[_0x6cb6('0x56')]=VoiceQueueSummary; \ No newline at end of file +var _0xbcc7=['ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','talking','loggedin','callers','length','online','incall','status','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','dialActive','updateReportFromOutboundQueue','preview','available','loggedIn','paused','waiting','answered','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing'];(function(_0x19b052,_0x377aaf){var _0x47e39f=function(_0x221b30){while(--_0x221b30){_0x19b052['push'](_0x19b052['shift']());}};_0x47e39f(++_0x377aaf);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x46ab39,_0x231cb6){_0x46ab39=_0x46ab39-0x0;var _0x459b2e=_0xbcc7[_0x46ab39];return _0x459b2e;};'use strict';var INBOUND_COUNTERS=[_0x7bcc('0x0'),_0x7bcc('0x1'),'loggedInDb',_0x7bcc('0x2'),'ringing','talking',_0x7bcc('0x3')];var OUTBOUND_COUNTERS=['available',_0x7bcc('0x4'),_0x7bcc('0x5'),'loggedIn',_0x7bcc('0x6'),_0x7bcc('0x7'),_0x7bcc('0x8'),_0x7bcc('0x9'),_0x7bcc('0xa'),_0x7bcc('0xb'),'outboundCongestionCallsDay',_0x7bcc('0xc'),'outboundNoSuchCallsDay',_0x7bcc('0xd'),_0x7bcc('0xe'),'outboundUnknownCallsDay',_0x7bcc('0x2'),'pTalking','talking','sumBillable',_0x7bcc('0xf'),_0x7bcc('0x10'),_0x7bcc('0x3')];function VoiceQueueSummary(_0x1121d1){this['id']=_0x1121d1['id'];this[_0x7bcc('0x11')]=_0x1121d1[_0x7bcc('0x11')];this[_0x7bcc('0x12')]=_0x1121d1['strategy'];this[_0x7bcc('0x13')]=_0x1121d1[_0x7bcc('0x13')]||0x0;this[_0x7bcc('0x4')]=_0x1121d1[_0x7bcc('0x4')]||0x0;this[_0x7bcc('0x0')]=_0x1121d1[_0x7bcc('0x0')]||0x0;this['busy']=_0x1121d1[_0x7bcc('0x14')]||0x0;this[_0x7bcc('0x5')]=_0x1121d1[_0x7bcc('0x5')]||0x0;this[_0x7bcc('0x15')]=_0x1121d1[_0x7bcc('0x15')]||0x0;this[_0x7bcc('0x1')]=_0x1121d1[_0x7bcc('0x1')]||0x0;this['loggedInDb']=_0x1121d1[_0x7bcc('0x6')]||0x0;this['onHold']=_0x1121d1[_0x7bcc('0x16')]||0x0;this[_0x7bcc('0x17')]=_0x1121d1[_0x7bcc('0x17')]||0x0;this[_0x7bcc('0x2')]=_0x1121d1['paused']||0x0;this['ringing']=_0x1121d1[_0x7bcc('0x18')]||0x0;this[_0x7bcc('0x19')]=_0x1121d1[_0x7bcc('0x19')];this[_0x7bcc('0x1a')]=_0x1121d1[_0x7bcc('0x1a')];this[_0x7bcc('0xf')]=_0x1121d1[_0x7bcc('0xf')];this[_0x7bcc('0x1b')]=_0x1121d1[_0x7bcc('0x1b')]||0x0;this['talking']=_0x1121d1['talking']||0x0;this[_0x7bcc('0x10')]=_0x1121d1[_0x7bcc('0x10')]||0x0;this[_0x7bcc('0x1c')]=_0x1121d1[_0x7bcc('0x1c')];this[_0x7bcc('0x1d')]=_0x1121d1[_0x7bcc('0x1d')]||0x0;this[_0x7bcc('0x1e')]=_0x1121d1[_0x7bcc('0x1e')]||0x0;this[_0x7bcc('0x1f')]=_0x1121d1['unmanaged']||0x0;this[_0x7bcc('0x3')]=_0x1121d1[_0x7bcc('0x3')]||0x0;if(_0x1121d1[_0x7bcc('0x1c')]===_0x7bcc('0x20')){this[_0x7bcc('0x21')]=_0x1121d1[_0x7bcc('0x21')]||0x0;this['dialActive']=_0x1121d1['dialActive'];this[_0x7bcc('0x22')]=_0x1121d1['dialMethod'];this['dialOriginateCallerIdName']=_0x1121d1[_0x7bcc('0x23')];this['dialOriginateCallerIdNumber']=_0x1121d1[_0x7bcc('0x24')];this[_0x7bcc('0x25')]=_0x1121d1[_0x7bcc('0x25')];this['dialPrefix']=_0x1121d1[_0x7bcc('0x26')];this[_0x7bcc('0x27')]=_0x1121d1[_0x7bcc('0x27')];this[_0x7bcc('0x28')]=_0x1121d1[_0x7bcc('0x28')];this[_0x7bcc('0x9')]=_0x1121d1[_0x7bcc('0x9')];this['outboundBlacklistCallsDay']=_0x1121d1[_0x7bcc('0xa')];this[_0x7bcc('0xb')]=_0x1121d1['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x1121d1[_0x7bcc('0x29')];this['outboundDropCallsDayACS']=_0x1121d1[_0x7bcc('0x2a')];this[_0x7bcc('0x2b')]=_0x1121d1[_0x7bcc('0x2b')];this[_0x7bcc('0x2c')]=_0x1121d1['outboundDropCallsDayTimeout'];this[_0x7bcc('0xc')]=_0x1121d1[_0x7bcc('0xc')];this[_0x7bcc('0x2d')]=_0x1121d1['outboundNoSuchCallsDay'];this[_0x7bcc('0x2e')]=_0x1121d1[_0x7bcc('0x2e')];this[_0x7bcc('0xd')]=_0x1121d1[_0x7bcc('0xd')];this[_0x7bcc('0xe')]=_0x1121d1[_0x7bcc('0xe')];this[_0x7bcc('0x2f')]=_0x1121d1[_0x7bcc('0x2f')];this[_0x7bcc('0x30')]=_0x1121d1[_0x7bcc('0x30')];this[_0x7bcc('0x31')]=_0x1121d1['predictiveIntervalAvgHoldtime'];this[_0x7bcc('0x32')]=_0x1121d1[_0x7bcc('0x32')];this[_0x7bcc('0x33')]=_0x1121d1['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x1121d1[_0x7bcc('0x34')];this[_0x7bcc('0x35')]=_0x1121d1[_0x7bcc('0x35')];this[_0x7bcc('0x36')]=_0x1121d1[_0x7bcc('0x36')];this[_0x7bcc('0x37')]=_0x1121d1[_0x7bcc('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x1121d1['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x1121d1['predictiveIntervalPauses'];this[_0x7bcc('0x38')]=_0x1121d1[_0x7bcc('0x38')];this[_0x7bcc('0x39')]=_0x1121d1['predictiveIntervalTotalCalls'];this[_0x7bcc('0x7')]=_0x1121d1[_0x7bcc('0x7')];this[_0x7bcc('0x3a')]=_0x1121d1['erlangCalls'];this['erlangCallToSecond']=_0x1121d1[_0x7bcc('0x3b')];this[_0x7bcc('0x3c')]=_0x1121d1[_0x7bcc('0x3c')];this['erlangBusyFactor']=_0x1121d1['erlangBusyFactor'];this[_0x7bcc('0x3d')]=_0x1121d1[_0x7bcc('0x3d')];this[_0x7bcc('0x3e')]=_0x1121d1['startProgressive'];this[_0x7bcc('0x3f')]=_0x1121d1[_0x7bcc('0x3f')];this[_0x7bcc('0x40')]=_0x1121d1[_0x7bcc('0x40')];}if(_0x1121d1[_0x7bcc('0x41')]){this[_0x7bcc('0x41')]={'id':_0x1121d1['Trunk']['id'],'name':_0x1121d1[_0x7bcc('0x41')][_0x7bcc('0x11')],'active':_0x1121d1['Trunk'][_0x7bcc('0x42')],'callerid':_0x1121d1[_0x7bcc('0x41')][_0x7bcc('0x43')]};}}VoiceQueueSummary[_0x7bcc('0x44')][_0x7bcc('0x45')]=function(_0x1b4d75,_0x632cff,_0xeaeac5,_0x5d67a0){this[_0x7bcc('0x6')]=0x0;this[_0x7bcc('0x46')]=0x0;this[_0x7bcc('0x2')]=0x0;this[_0x7bcc('0x1e')]=0x0;this[_0x7bcc('0x17')]=0x0;this[_0x7bcc('0x5')]=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x7bcc('0x1d')]=0x0;this[_0x7bcc('0x18')]=0x0;this['ringInUse']=0x0;this[_0x7bcc('0x16')]=0x0;if(_0xeaeac5){if(_0xeaeac5[_0x7bcc('0x0')]){this[_0x7bcc('0x0')]=Number(_0xeaeac5[_0x7bcc('0x0')]);}if(_0xeaeac5[_0x7bcc('0x47')]){this[_0x7bcc('0x1')]=Number(_0xeaeac5[_0x7bcc('0x47')]);}if(_0xeaeac5['callers']){this[_0x7bcc('0x3')]=Number(_0xeaeac5[_0x7bcc('0x48')]);}}for(var _0x2a490d=0x0;_0x2a490d<_0x1b4d75[_0x7bcc('0x49')];_0x2a490d++){var _0x144510=_0x632cff['SIP/'+_0x1b4d75[_0x2a490d][_0x7bcc('0x11')]];if(_0x144510&&_0x144510[_0x7bcc('0x4a')]){this['loggedInDb']+=0x1;}if(_0x1b4d75[_0x2a490d][_0x7bcc('0x4b')]==='1'){this[_0x7bcc('0x46')]+=0x1;}if(_0x1b4d75[_0x2a490d][_0x7bcc('0x2')]==='1'&&!['2','7','8']['includes'](_0x1b4d75[_0x2a490d][_0x7bcc('0x4c')])){this[_0x7bcc('0x2')]+=0x1;}switch(_0x1b4d75[_0x2a490d]['status']){case'0':this[_0x7bcc('0x1e')]+=0x1;break;case'1':this[_0x7bcc('0x17')]+=0x1;break;case'2':this[_0x7bcc('0x5')]+=0x1;break;case'3':this[_0x7bcc('0x14')]+=0x1;break;case'4':this[_0x7bcc('0x15')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x7bcc('0x18')]+=0x1;break;case'7':this[_0x7bcc('0x19')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x7bcc('0x22')]==='booked'){var _0x415de9=Object['keys'](_0x5d67a0);for(var _0x29cb88=0x0;_0x29cb88<_0x415de9['length'];_0x29cb88++){var _0x5748ca=_0x415de9[_0x29cb88];var _0x11dec2=_0x5d67a0[_0x5748ca];if(_0x11dec2[_0x7bcc('0x4d')]===this[_0x7bcc('0x11')]&&_0x11dec2[_0x7bcc('0x1c')]===_0x7bcc('0x4e')&&_0x11dec2[_0x7bcc('0x4f')]===_0x7bcc('0x50')){this[_0x7bcc('0x46')]+=0x1;}}if(this[_0x7bcc('0x46')]>this[_0x7bcc('0x5')]){this[_0x7bcc('0x46')]=this[_0x7bcc('0x5')];}this[_0x7bcc('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x7bcc('0x44')][_0x7bcc('0x51')]=function(_0x4c12f2){var _0x281c21=![];if(_0x4c12f2){_0x281c21=INBOUND_COUNTERS[_0x7bcc('0x52')](function(_0x54bb61){return this[_0x54bb61]!==_0x4c12f2[_0x54bb61];},this);}return _0x281c21;};VoiceQueueSummary['prototype'][_0x7bcc('0x53')]=function(_0x38240d){var _0x55deaf=![];var _0x5cf572=![];var _0x5268f2=![];if(_0x38240d){_0x55deaf=this['dialMethod']!==_0x38240d['dialMethod']||this[_0x7bcc('0x54')]!==_0x38240d[_0x7bcc('0x54')]||this['message']!==_0x38240d['message']||this[_0x7bcc('0x40')]!==_0x38240d[_0x7bcc('0x40')];_0x5cf572=OUTBOUND_COUNTERS[_0x7bcc('0x52')](function(_0x33c052){return this[_0x33c052]!==_0x38240d[_0x33c052];},this);if(this[_0x7bcc('0x41')]&&_0x38240d[_0x7bcc('0x41')]){_0x5268f2=this['Trunk']['name']!==_0x38240d[_0x7bcc('0x41')][_0x7bcc('0x11')]||this[_0x7bcc('0x41')][_0x7bcc('0x42')]!==_0x38240d['Trunk']['active'];}}return _0x55deaf||_0x5cf572||_0x5268f2;};VoiceQueueSummary['prototype'][_0x7bcc('0x55')]=function(_0x583592){this[_0x7bcc('0x4')]=_0x583592[_0x7bcc('0x4')];this[_0x7bcc('0x3f')]=_0x583592['message'];this[_0x7bcc('0x40')]=_0x583592['statusMessage'];this['originated']=_0x583592[_0x7bcc('0x7')];this[_0x7bcc('0x8')]=_0x583592[_0x7bcc('0x8')];this[_0x7bcc('0x9')]=_0x583592[_0x7bcc('0x9')];this[_0x7bcc('0xa')]=_0x583592[_0x7bcc('0xa')];this[_0x7bcc('0xb')]=_0x583592[_0x7bcc('0xb')];this['outboundCongestionCallsDay']=_0x583592[_0x7bcc('0x29')];this[_0x7bcc('0xc')]=_0x583592[_0x7bcc('0xc')];this['outboundNoSuchCallsDay']=_0x583592[_0x7bcc('0x2d')];this[_0x7bcc('0xd')]=_0x583592[_0x7bcc('0xd')];this[_0x7bcc('0xe')]=_0x583592[_0x7bcc('0xe')];this[_0x7bcc('0x2f')]=_0x583592[_0x7bcc('0x2f')];this[_0x7bcc('0x1a')]=_0x583592[_0x7bcc('0x1a')];this[_0x7bcc('0xf')]=_0x583592['sumDuration'];this[_0x7bcc('0x10')]=_0x583592[_0x7bcc('0x10')];if(this['dialMethod']===_0x7bcc('0x56')){this[_0x7bcc('0x21')]=_0x583592[_0x7bcc('0x21')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 2b99467..a120ecf 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 _0x2cb1=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x2cb1,0x137));var _0x12cb=function(_0x4e89c7,_0x3e64b6){_0x4e89c7=_0x4e89c7-0x0;var _0x15a2d9=_0x2cb1[_0x4e89c7];return _0x15a2d9;};'use strict';function VtigerAccount(_0x150b2e){this['id']=_0x150b2e['id']||0x0;this[_0x12cb('0x0')]=_0x150b2e[_0x12cb('0x0')]||'';this[_0x12cb('0x1')]=_0x150b2e[_0x12cb('0x1')]||'';this[_0x12cb('0x2')]=_0x150b2e[_0x12cb('0x2')]||'';this[_0x12cb('0x3')]=_0x150b2e[_0x12cb('0x3')]||'';this[_0x12cb('0x4')]=_0x150b2e['serverUrl']||'';this[_0x12cb('0x5')]=_0x150b2e[_0x12cb('0x5')]||{};}module[_0x12cb('0x6')]=VtigerAccount; \ No newline at end of file +var _0xe7b4=['Configurations','username','accessKey','remoteUri','serverUrl'];(function(_0x1dbacd,_0x5b8a5a){var _0xbd3bf0=function(_0x49f961){while(--_0x49f961){_0x1dbacd['push'](_0x1dbacd['shift']());}};_0xbd3bf0(++_0x5b8a5a);}(_0xe7b4,0x105));var _0x4e7b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe7b4[_0x59ee6f];return _0x4c0979;};'use strict';function VtigerAccount(_0x2a6ea7){this['id']=_0x2a6ea7['id']||0x0;this['name']=_0x2a6ea7['name']||'';this[_0x4e7b('0x0')]=_0x2a6ea7[_0x4e7b('0x0')]||'';this[_0x4e7b('0x1')]=_0x2a6ea7['accessKey']||'';this['remoteUri']=_0x2a6ea7[_0x4e7b('0x2')]||'';this[_0x4e7b('0x3')]=_0x2a6ea7[_0x4e7b('0x3')]||'';this[_0x4e7b('0x4')]=_0x2a6ea7[_0x4e7b('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 7710297..234892f 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 _0x2a08=['name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x1d83bf,_0x203f1d){var _0x4cd824=function(_0x33d116){while(--_0x33d116){_0x1d83bf['push'](_0x1d83bf['shift']());}};_0x4cd824(++_0x203f1d);}(_0x2a08,0xcf));var _0x82a0=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2a08[_0x465028];return _0xb783d4;};'use strict';function ZendeskAccount(_0x3254fb){this['id']=_0x3254fb['id']||0x0;this['name']=_0x3254fb[_0x82a0('0x0')]||'';this[_0x82a0('0x1')]=_0x3254fb[_0x82a0('0x1')]||'';this[_0x82a0('0x2')]=_0x3254fb[_0x82a0('0x2')]||'';this[_0x82a0('0x3')]=_0x3254fb[_0x82a0('0x3')]||'';this['remoteUri']=_0x3254fb[_0x82a0('0x4')]||'';this['authType']=_0x3254fb[_0x82a0('0x5')]||'';this[_0x82a0('0x6')]=_0x3254fb[_0x82a0('0x6')]||'integrationTab';this[_0x82a0('0x7')]=_0x3254fb['serverUrl']||'';this[_0x82a0('0x8')]=_0x3254fb['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x57f9=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','username'];(function(_0x1f2aa6,_0x1dfb79){var _0x4d25f6=function(_0x435282){while(--_0x435282){_0x1f2aa6['push'](_0x1f2aa6['shift']());}};_0x4d25f6(++_0x1dfb79);}(_0x57f9,0x1e9));var _0x957f=function(_0x524ef8,_0x4956b3){_0x524ef8=_0x524ef8-0x0;var _0x39470e=_0x57f9[_0x524ef8];return _0x39470e;};'use strict';function ZendeskAccount(_0x3d377e){this['id']=_0x3d377e['id']||0x0;this['name']=_0x3d377e['name']||'';this['username']=_0x3d377e[_0x957f('0x0')]||'';this[_0x957f('0x1')]=_0x3d377e[_0x957f('0x1')]||'';this['token']=_0x3d377e[_0x957f('0x2')]||'';this[_0x957f('0x3')]=_0x3d377e['remoteUri']||'';this[_0x957f('0x4')]=_0x3d377e[_0x957f('0x4')]||'';this[_0x957f('0x5')]=_0x3d377e[_0x957f('0x5')]||_0x957f('0x6');this[_0x957f('0x7')]=_0x3d377e['serverUrl']||'';this['Configurations']=_0x3d377e[_0x957f('0x8')]||{};}module[_0x957f('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index b72c83b..fe308fb 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 _0x0b6f=['Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x22d42c,_0x511bb5){var _0x3e4a4e=function(_0x4de9c9){while(--_0x4de9c9){_0x22d42c['push'](_0x22d42c['shift']());}};_0x3e4a4e(++_0x511bb5);}(_0x0b6f,0x1e1));var _0xf0b6=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x0b6f[_0x5c2c7c];return _0xea7ffe;};'use strict';function ZohoAccount(_0x315011){this['id']=_0x315011['id']||0x0;this['name']=_0x315011[_0xf0b6('0x0')]||'';this[_0xf0b6('0x1')]=_0x315011['description']||'';this[_0xf0b6('0x2')]=_0x315011[_0xf0b6('0x2')]||'';this[_0xf0b6('0x3')]=_0x315011['zone']||'';this['clientId']=_0x315011[_0xf0b6('0x4')]||'';this[_0xf0b6('0x5')]=_0x315011['clientSecret']||'';this[_0xf0b6('0x6')]=_0x315011[_0xf0b6('0x6')]||'';this[_0xf0b6('0x7')]=_0x315011['code']||'';this['refreshToken']=_0x315011[_0xf0b6('0x8')]||'';this['Configurations']=_0x315011[_0xf0b6('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x8d78=['description','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0x8d78,0xa9));var _0x88d7=function(_0x4cb545,_0x1aab6e){_0x4cb545=_0x4cb545-0x0;var _0x198a99=_0x8d78[_0x4cb545];return _0x198a99;};'use strict';function ZohoAccount(_0x2e1f82){this['id']=_0x2e1f82['id']||0x0;this[_0x88d7('0x0')]=_0x2e1f82['name']||'';this[_0x88d7('0x1')]=_0x2e1f82[_0x88d7('0x1')]||'';this['host']=_0x2e1f82['host']||'';this['zone']=_0x2e1f82[_0x88d7('0x2')]||'';this['clientId']=_0x2e1f82[_0x88d7('0x3')]||'';this[_0x88d7('0x4')]=_0x2e1f82[_0x88d7('0x4')]||'';this[_0x88d7('0x5')]=_0x2e1f82[_0x88d7('0x5')]||'';this[_0x88d7('0x6')]=_0x2e1f82[_0x88d7('0x6')]||'';this[_0x88d7('0x7')]=_0x2e1f82[_0x88d7('0x7')]||'';this[_0x88d7('0x8')]=_0x2e1f82[_0x88d7('0x8')]||{};}module[_0x88d7('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ba94d78..e0c8075 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 _0x1893=['type','queue','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string','uniqueid','idContact','name'];(function(_0x58a03e,_0x315a47){var _0x6d1eb=function(_0x4fbbd2){while(--_0x4fbbd2){_0x58a03e['push'](_0x58a03e['shift']());}};_0x6d1eb(++_0x315a47);}(_0x1893,0xa2));var _0x3189=function(_0x2d120a,_0x5e4d33){_0x2d120a=_0x2d120a-0x0;var _0x205747=_0x1893[_0x2d120a];return _0x205747;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3189('0x0'));function checkNameSurname(_0x3aec2b,_0x1b12ad,_0x106df4){var _0x10c189='';if(!_[_0x3189('0x1')](_0x1b12ad)&&_0x3189('0x2')===typeof _0x1b12ad){_0x10c189+=_0x1b12ad;}if(!_['isNil'](_0x106df4)&&_0x3189('0x2')===typeof _0x106df4){_0x10c189+='\x20'+_0x106df4;}if(_0x10c189!==''){return _0x10c189;}return _0x3aec2b;}function Action(_0x4faebf,_0x2333e6,_0x4080a9,_0x77c566,_0x118970){this[_0x3189('0x3')]=_0x4080a9||undefined;this[_0x3189('0x4')]=_0x4faebf['id'];this['queue']=_0x2333e6[_0x3189('0x5')];this['type']=_0x2333e6[_0x3189('0x6')];this['campaigntype']=_0x3189('0x7');this[_0x3189('0x8')]=![];this[_0x3189('0x9')]=_[_0x3189('0x1')](_0x4faebf['Agent'])?undefined:_0x4faebf[_0x3189('0xa')][_0x3189('0x5')];this[_0x3189('0xb')]=this[_0x3189('0x9')]?util[_0x3189('0xc')]('SIP/%s',this[_0x3189('0x9')]):_0x77c566||undefined;this[_0x3189('0xd')]=checkNameSurname(_0x4faebf[_0x3189('0xe')][_0x3189('0xf')],_0x4faebf[_0x3189('0xe')][_0x3189('0x10')],_0x4faebf[_0x3189('0xe')][_0x3189('0x11')]);this['active']=_0x4faebf[_0x3189('0x12')]||![];this[_0x3189('0x13')]=_0x4faebf[_0x3189('0xf')];this[_0x3189('0x14')]=_0x4faebf['scheduledat'];this[_0x3189('0x15')]=_0x4faebf['countbusyretry']||0x0;this['countcongestionretry']=_0x4faebf[_0x3189('0x16')]||0x0;this['countnoanswerretry']=_0x4faebf[_0x3189('0x17')]||0x0;this[_0x3189('0x18')]=(_0x4faebf[_0x3189('0x15')]||0x0)+(_0x4faebf[_0x3189('0x16')]||0x0)+(_0x4faebf['countnoanswerretry']||0x0)+(_0x4faebf[_0x3189('0x19')]||0x0)+(_0x4faebf[_0x3189('0x1a')]||0x0)+(_0x4faebf[_0x3189('0x1b')]||0x0)+(_0x4faebf['countmachineretry']||0x0)+(_0x4faebf[_0x3189('0x1c')]||0x0);this[_0x3189('0x19')]=_0x4faebf[_0x3189('0x19')]||0x0;this[_0x3189('0x1a')]=_0x4faebf[_0x3189('0x1a')]||0x0;this['countabandonedretry']=_0x4faebf[_0x3189('0x1b')]||0x0;this[_0x3189('0x1d')]=_0x4faebf[_0x3189('0x1d')]||0x0;this['countagentrejectretry']=_0x4faebf[_0x3189('0x1c')]||0x0;this['callback']=_0x4faebf[_0x3189('0x1e')];this[_0x3189('0x1f')]=_0x4faebf[_0x3189('0x1f')];this[_0x3189('0x20')]=_0x4faebf[_0x3189('0x20')];this[_0x3189('0x21')]=_0x4faebf['recallme'];this['ContactId']=_0x4faebf[_0x3189('0x22')];this[_0x3189('0x23')]=_0x4faebf[_0x3189('0x23')];this[_0x3189('0x24')]=_[_0x3189('0x1')](_0x4faebf[_0x3189('0xa')])?_0x4faebf[_0x3189('0x24')]:_0x4faebf[_0x3189('0xa')]['id'];this[_0x3189('0x25')]=_0x4faebf[_0x3189('0x25')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0x3189('0x26')]=function(){return util[_0x3189('0xc')](_0x3189('0x27'),this[_0x3189('0xd')],this[_0x3189('0x28')]);};module[_0x3189('0x29')]=Action; \ No newline at end of file +var _0x5f66=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','lodash','isNil','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var util=require('util');var _=require(_0x65f6('0x0'));var moment=require('moment');function checkNameSurname(_0x2d5fd9,_0x2f06ae,_0x3461cd){var _0xbce843='';if(!_[_0x65f6('0x1')](_0x2f06ae)&&'string'===typeof _0x2f06ae){_0xbce843+=_0x2f06ae;}if(!_[_0x65f6('0x1')](_0x3461cd)&&'string'===typeof _0x3461cd){_0xbce843+='\x20'+_0x3461cd;}if(_0xbce843!==''){return _0xbce843;}return _0x2d5fd9;}function Action(_0x1c9f5b,_0x22b017,_0x4ec221,_0x4ed98f,_0x1c0e12){this[_0x65f6('0x2')]=_0x4ec221||undefined;this[_0x65f6('0x3')]=_0x1c9f5b['id'];this[_0x65f6('0x4')]=_0x22b017[_0x65f6('0x5')];this[_0x65f6('0x6')]=_0x22b017['type'];this['campaigntype']=_0x65f6('0x4');this[_0x65f6('0x7')]=![];this[_0x65f6('0x8')]=_[_0x65f6('0x1')](_0x1c9f5b['Agent'])?undefined:_0x1c9f5b[_0x65f6('0x9')]['name'];this['channelAgent']=this[_0x65f6('0x8')]?util['format'](_0x65f6('0xa'),this['membername']):_0x4ed98f||undefined;this[_0x65f6('0xb')]=checkNameSurname(_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xd')],_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xe')],_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xf')]);this[_0x65f6('0x10')]=_0x1c9f5b[_0x65f6('0x10')]||![];this[_0x65f6('0x11')]=_0x1c9f5b['phone'];this[_0x65f6('0x12')]=_0x1c9f5b['scheduledat'];this['countbusyretry']=_0x1c9f5b[_0x65f6('0x13')]||0x0;this[_0x65f6('0x14')]=_0x1c9f5b[_0x65f6('0x14')]||0x0;this[_0x65f6('0x15')]=_0x1c9f5b[_0x65f6('0x15')]||0x0;this[_0x65f6('0x16')]=(_0x1c9f5b[_0x65f6('0x13')]||0x0)+(_0x1c9f5b[_0x65f6('0x14')]||0x0)+(_0x1c9f5b['countnoanswerretry']||0x0)+(_0x1c9f5b['countnosuchnumberretry']||0x0)+(_0x1c9f5b[_0x65f6('0x17')]||0x0)+(_0x1c9f5b['countabandonedretry']||0x0)+(_0x1c9f5b['countmachineretry']||0x0)+(_0x1c9f5b['countagentrejectretry']||0x0);this[_0x65f6('0x18')]=_0x1c9f5b[_0x65f6('0x18')]||0x0;this['countdropretry']=_0x1c9f5b[_0x65f6('0x17')]||0x0;this[_0x65f6('0x19')]=_0x1c9f5b[_0x65f6('0x19')]||0x0;this[_0x65f6('0x1a')]=_0x1c9f5b[_0x65f6('0x1a')]||0x0;this[_0x65f6('0x1b')]=_0x1c9f5b['countagentrejectretry']||0x0;this[_0x65f6('0x1c')]=_0x1c9f5b['callback'];this['callbackuniqueid']=_0x1c9f5b[_0x65f6('0x1d')];this[_0x65f6('0x1e')]=_0x1c9f5b['callbackat'];this[_0x65f6('0x1f')]=_0x1c9f5b[_0x65f6('0x1f')];this[_0x65f6('0x20')]=_0x1c9f5b[_0x65f6('0x20')];this['ListId']=_0x1c9f5b[_0x65f6('0x21')];this[_0x65f6('0x22')]=_[_0x65f6('0x1')](_0x1c9f5b['Agent'])?_0x1c9f5b['UserId']:_0x1c9f5b['Agent']['id'];this[_0x65f6('0x23')]=_0x1c9f5b[_0x65f6('0x23')];this['originatecalleridnum']='';this[_0x65f6('0x24')]='';}Action[_0x65f6('0x25')]['getCaller']=function(){return util[_0x65f6('0x26')](_0x65f6('0x27'),this[_0x65f6('0xb')],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 7d7fb2d..02704ef 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 _0x40ff=['IsNotLoggedIn','isActive','dialActive','Trunk','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','scheduledAt','CONGESTION','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countcongestionretry','CANCEL','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','lookAgent','isEmpty','execCall','Queue:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','trunks','SIP/%s','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','VoiceQueueId','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','campaign\x20Name:\x20','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','merge','toLowerVariables','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','keys','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','ioredis','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','actions','agents','clockClearZombieChannels','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','stringify','format','voice:queue:%s','name','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','dialMethod','booked','clearZombieChannels','preview','type','outbound','setMessage','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','dialAnswer','contactId','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]'];(function(_0x25e2c9,_0x503114){var _0x1e5b99=function(_0xb9a1fb){while(--_0xb9a1fb){_0x25e2c9['push'](_0x25e2c9['shift']());}};_0x1e5b99(++_0x503114);}(_0x40ff,0xd0));var _0xf40f=function(_0x207a27,_0x4dc9fc){_0x207a27=_0x207a27-0x0;var _0x41de7f=_0x40ff[_0x207a27];return _0x41de7f;};'use strict';var util=require('util');var _=require(_0xf40f('0x0'));var uuid=require(_0xf40f('0x1'));var moment=require('moment');var Redis=require(_0xf40f('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('preview');var loggerAction=require(_0xf40f('0x3'))(_0xf40f('0x4'));var ami=require(_0xf40f('0x5'));var rpcDb=require(_0xf40f('0x6'));var cmHopperAdditionalPhone=require(_0xf40f('0x7'));var Action=require(_0xf40f('0x8'));var ut=require(_0xf40f('0x9'));var utils=require('../dialer/utils');config[_0xf40f('0xa')]=_['defaults'](config[_0xf40f('0xa')],{'host':_0xf40f('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf40f('0xa')]));var Sequence=function(){};Sequence[_0xf40f('0xc')][_0xf40f('0xd')]=function(_0x4f1ecd){this['tail']=this['tail']?this[_0xf40f('0xe')][_0xf40f('0xf')](_0x4f1ecd):_0x4f1ecd();};function Preview(_0x440a63){this[_0xf40f('0x10')]=new Sequence();this[_0xf40f('0x11')]=_0x440a63[_0xf40f('0x12')];this['trunks']=_0x440a63['trunks'];this[_0xf40f('0x13')]={};this[_0xf40f('0x14')]=_0x440a63[_0xf40f('0x14')];this[_0xf40f('0x15')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x17'),this[_0xf40f('0x18')][_0xf40f('0x16')](this));ami['on']('hanguprequest',this[_0xf40f('0x19')][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x1a'),this[_0xf40f('0x1b')][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x1c'),this[_0xf40f('0x1d')][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x1e'),this[_0xf40f('0x1f')][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x20'),this[_0xf40f('0x21')][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x22'),this['syncBlindTransfer'][_0xf40f('0x16')](this));this[_0xf40f('0x23')](this['campaignsPreview']);}function emit(_0x3201fa,_0x31aebd,_0x5874a4){io['to'](_0x3201fa)[_0xf40f('0x24')](_0x31aebd,_0x5874a4);}function emitVoiceQueueChannelRemove(_0x59833f){logger[_0xf40f('0x25')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xf40f('0x26')](_0x59833f));emit(util[_0xf40f('0x27')](_0xf40f('0x28'),_0x59833f[_0xf40f('0x29')]),'voice_queue_channel:remove',_0x59833f);io[_0xf40f('0x24')](_0xf40f('0x2a'),_0x59833f);}function notSendMessagesQueue(_0x52318d){if(_0x52318d[_0xf40f('0x2b')]){if(_0x52318d[_0xf40f('0x2c')]===0x0&&_0x52318d[_0xf40f('0x2d')]===0x0){_0x52318d[_0xf40f('0x2b')]=![];_0x52318d['available']=0x0;_0x52318d[_0xf40f('0x2e')]=0x0;_0x52318d['message']=utils[_0xf40f('0x2f')][_0xf40f('0x30')];ut[_0xf40f('0x31')](_0xf40f('0x32'),_0x52318d[_0xf40f('0x29')]+_0xf40f('0x33'));}else{_0x52318d[_0xf40f('0x34')]=utils[_0xf40f('0x2f')][_0xf40f('0x35')];ut[_0xf40f('0x31')](_0xf40f('0x32'),_0x52318d[_0xf40f('0x29')]+_0xf40f('0x36'));}}}Preview[_0xf40f('0xc')][_0xf40f('0x23')]=function(){var _0x52d67a=this;setInterval(function(){_0x52d67a['syncCampaigns']();},0x7cf);};Preview['prototype'][_0xf40f('0x37')]=function(){var _0x7f816e=this[_0xf40f('0x11')];this[_0xf40f('0x15')]+=0x1;for(var _0x95ce3 in _0x7f816e){if(_0x7f816e['hasOwnProperty'](_0x95ce3)&&(_0x7f816e[_0x95ce3][_0xf40f('0x38')]==='preview'||_0x7f816e[_0x95ce3][_0xf40f('0x38')]===_0xf40f('0x39'))&&_0x7f816e[_0x95ce3]['type']==='outbound'){if(this[_0xf40f('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xf40f('0x3a')]();}}if(_0x7f816e['hasOwnProperty'](_0x95ce3)&&_0x7f816e[_0x95ce3]['dialMethod']===_0xf40f('0x3b')&&_0x7f816e[_0x95ce3][_0xf40f('0x3c')]===_0xf40f('0x3d')){if(_0x7f816e[_0x95ce3]['dialActive']){this[_0xf40f('0x3e')](_0x7f816e[_0x95ce3]);if(_0x7f816e[_0x95ce3]['dialPreviewAutoRecallMe'])this[_0xf40f('0x3f')](_0x7f816e[_0x95ce3]);}else{notSendMessagesQueue(_0x7f816e[_0x95ce3]);}}}};Preview[_0xf40f('0xc')][_0xf40f('0x40')]=function(_0x2bca5d){var _0x4e543b=this;this[_0xf40f('0x10')]['enqueue'](function(){if(!_[_0xf40f('0x41')](_0x4e543b[_0xf40f('0x13')][_0x2bca5d])){loggerAction[_0xf40f('0x25')]('[clearZombieChannels][talking]',_0x2bca5d,_0xf40f('0x42'),_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x43')],_0xf40f('0x44'),JSON['stringify'](_0x4e543b[_0xf40f('0x11')][_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x43')]][_0xf40f('0x2c')]),'pTalking:\x20',JSON[_0xf40f('0x26')](_0x4e543b[_0xf40f('0x11')][_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x43')]][_0xf40f('0x2d')]),JSON[_0xf40f('0x26')](_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x45')]),JSON[_0xf40f('0x26')](_['pick'](_0x4e543b[_0xf40f('0x13')][_0x2bca5d],[_0xf40f('0x46'),_0xf40f('0x47'),'VoiceQueueId',_0xf40f('0x48')])));return ami[_0xf40f('0x49')]({'action':_0xf40f('0x4a'),'channel':_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x4b')]})[_0xf40f('0x4c')](function(_0x503af1){if(_0x503af1[_0xf40f('0x34')]===_0xf40f('0x4d')){setTimeout(function(){if(_0x4e543b[_0xf40f('0x13')][_0x2bca5d]){utils[_0xf40f('0x4e')](_0x4e543b[_0xf40f('0x11')][_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x43')]],_0xf40f('0x4f'));if(_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x45')]===!![]){ut[_0xf40f('0x50')](_0x4e543b[_0xf40f('0x11')][_0x4e543b[_0xf40f('0x13')][_0x2bca5d]['queue']],_0xf40f('0x4f'));ut[_0xf40f('0x51')](_0xf40f('0x52')+_0x2bca5d,_0x4e543b[_0xf40f('0x13')][_0x2bca5d]['queue']);}ut[_0xf40f('0x51')](_0xf40f('0x53')+_0x2bca5d,_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x43')]);delete _0x4e543b['actions'][_0x2bca5d];}},0x2328);}});}});};Preview['prototype'][_0xf40f('0x3a')]=function(){var _0x3eea0f=this;loggerAction['info'](_0xf40f('0x54'),_[_0xf40f('0x55')](this[_0xf40f('0x13')]));for(var _0x359398 in this[_0xf40f('0x13')]){if(_0x3eea0f[_0xf40f('0x13')][_0xf40f('0x56')](_0x359398)){_0x3eea0f[_0xf40f('0x40')](_0x359398);}}};Preview[_0xf40f('0xc')][_0xf40f('0x3f')]=function(_0x58972d){var _0x27de23=this;rpcDb[_0xf40f('0x57')](_0x58972d['id'],ut[_0xf40f('0x58')](this[_0xf40f('0x14')]))[_0xf40f('0x59')](function(_0x508402){if(!_[_0xf40f('0x41')](_0x508402)){for(var _0x3b80f4=0x0;_0x3b80f4<_0x508402['length'];_0x3b80f4+=0x1){if(ut[_0xf40f('0x5a')](_0x508402[_0x3b80f4][_0xf40f('0x5b')])<_0x58972d[_0xf40f('0x5c')]*0x3c){if(_0x508402[_0x3b80f4]['Agent']&&!_0x508402[_0x3b80f4][_0xf40f('0x5d')][_0xf40f('0x5e')]){_0x27de23['run'](_0x508402[_0x3b80f4]['id'])[_0xf40f('0x59')](ut[_0xf40f('0x5f')](_0xf40f('0x60')))['catch'](ut[_0xf40f('0x5f')](_0xf40f('0x60')));}else{rpcDb[_0xf40f('0x61')](_0x508402[_0x3b80f4]['id']);}}else{var _0x563df3=new Action(_0x508402[_0x3b80f4],_0x58972d);_0x563df3[_0xf40f('0x62')]=moment()[_0xf40f('0x27')](_0xf40f('0x63'));_0x58972d[_0xf40f('0x64')]+=0x1;ut['logCustomer'](_0x563df3,0x17,_0xf40f('0x65'));if(_0x58972d['dialRecallInQueue']){rpcDb[_0xf40f('0x66')](ut[_0xf40f('0x67')](_0x508402[_0x3b80f4]));rpcDb[_0xf40f('0x68')](_0x563df3,_0xf40f('0x69'));}else{ut[_0xf40f('0x6a')](_0x563df3,0x16,_0xf40f('0x6b'));rpcDb[_0xf40f('0x68')](_0x563df3,_0xf40f('0x6c'));rpcDb[_0xf40f('0x6d')](_0x563df3,'[HistoryRecallClose]');}}}}})[_0xf40f('0x4c')](ut[_0xf40f('0x5f')](_0xf40f('0x6e')));};Preview[_0xf40f('0xc')][_0xf40f('0x3e')]=function(_0x39e29b){_0x39e29b[_0xf40f('0x2b')]=!![];if(ut[_0xf40f('0x6f')](_0x39e29b['loggedIn'])){_0x39e29b[_0xf40f('0x34')]=utils[_0xf40f('0x2f')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xf40f('0x70')](_0x39e29b[_0xf40f('0x71')])){_0x39e29b[_0xf40f('0x34')]=utils[_0xf40f('0x2f')]['INACTIVE'];}else if(!this['isTrunkReachable'](_0x39e29b[_0xf40f('0x72')])){if(!this[_0xf40f('0x73')](_0x39e29b[_0xf40f('0x74')])){_0x39e29b[_0xf40f('0x34')]=utils[_0xf40f('0x2f')]['UNREACHABLE_TRUNK'];}else{_0x39e29b['message']=utils[_0xf40f('0x2f')]['ACTIVE'];}}else{_0x39e29b[_0xf40f('0x34')]=utils[_0xf40f('0x2f')][_0xf40f('0x75')];}};Preview[_0xf40f('0xc')][_0xf40f('0x76')]=function(_0x54f780,_0x6b9bb7,_0x3dcd34){var _0x414165=this;var _0x3bf62f=this[_0xf40f('0x13')][_0x6b9bb7];var _0xc089c4=this[_0xf40f('0x11')][_0x3bf62f[_0xf40f('0x43')]];var _0x5aa502;var _0x1dd912=![];var _0x31dbd4=0x2;var _0x3b83e9=0x3;if(_0xc089c4){switch(_0x3dcd34){case'1':_0xc089c4['outboundNoSuchCallsDay']+=0x1;_0x3bf62f[_0xf40f('0x77')]+=0x1;_0x3bf62f['countglobal']=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x0,_0xf40f('0x79'));ami[_0xf40f('0x24')](_0xf40f('0x7a'),ut['buildObj'](_0x3bf62f,_0xf40f('0x7b')));rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0x7c'));_0x414165[_0xf40f('0x7d')](_0x3bf62f,'0',_0xc089c4)[_0xf40f('0x59')](function(_0xa3a813){_0x1dd912=_0xa3a813[_0xf40f('0x7e')]==0x1;_0x31dbd4=_0xc089c4[_0xf40f('0x7f')];_0x3b83e9=_0xc089c4['callAdditionalPhoneAfterMin'];if(!_0x1dd912){if(ut[_0xf40f('0x78')](_0x3bf62f)>=_0xc089c4[_0xf40f('0x80')]){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,_0xf40f('0x83'));}else{if(_0x3bf62f[_0xf40f('0x77')]>=_0xc089c4[_0xf40f('0x84')]){rpcDb['createCustomerFinal'](_0x3bf62f,_0xf40f('0x83'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3bf62f,'countnosuchnumberretry',_0xc089c4[_0xf40f('0x7f')]),_0x3bf62f[_0xf40f('0x85')],_0x3bf62f[_0xf40f('0x86')]);}}delete this[_0xf40f('0x13')][_0x54f780[_0xf40f('0x87')]];}else{_0x3bf62f[_0xf40f('0x77')]++;logger[_0xf40f('0x25')](_0xf40f('0x88'),_0x3bf62f[_0xf40f('0x77')]);logger[_0xf40f('0x25')]('id',_0x3bf62f[_0xf40f('0x89')]);_0x414165['incrementPreviewCounters']({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnosuchnumberretry':_0x3bf62f['countnosuchnumberretry']}})[_0xf40f('0x59')](function(){_0x414165[_0xf40f('0x8a')](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});});}});break;case _0xf40f('0x8b'):var _0x17c9a7=moment()['format'](_0xf40f('0x63'));_0x3bf62f[_0xf40f('0x8c')]=_0x17c9a7;_0x3bf62f[_0xf40f('0x8d')]=_0x17c9a7;_0x3bf62f[_0xf40f('0x45')]=!![];_0xc089c4['pTalking']+=0x1;logger[_0xf40f('0x25')]('[syncHangup][talking][increment]',_0x3bf62f[_0xf40f('0x8e')],_0xf40f('0x8f'),_0xc089c4[_0xf40f('0x29')],_0xf40f('0x90'),_0xc089c4['pTalking']);ami['emit'](_0xf40f('0x91'),ut[_0xf40f('0x92')](_0x3bf62f,'connect',this['campaignsPreview'][_0x3bf62f[_0xf40f('0x43')]]));if(_0xc089c4['acw']||_0xc089c4[_0xf40f('0x93')]){ami[_0xf40f('0x24')](_0xf40f('0x94'),{'queue':_0x3bf62f[_0xf40f('0x43')],'interface':_0x3bf62f[_0xf40f('0x95')],'uniqueid':_0x3bf62f[_0xf40f('0x8e')]});}break;case'16':ami[_0xf40f('0x24')](_0xf40f('0x96'),ut[_0xf40f('0x92')](_0x3bf62f,_0xf40f('0x97'),this[_0xf40f('0x11')][_0x3bf62f[_0xf40f('0x43')]]));emitVoiceQueueChannelRemove(ut[_0xf40f('0x92')](_0x3bf62f,'complete'));_0xc089c4[_0xf40f('0x98')]+=0x1;_0xc089c4['total']+=0x1;_0xc089c4[_0xf40f('0x99')]+=0x1;ut[_0xf40f('0x50')](_0xc089c4,_0xf40f('0x9a'));_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x4,_0xf40f('0x9c'));rpcDb['createCustomerHistory'](_0x3bf62f,_0xf40f('0x9d'));rpcDb['createCustomerFinal'](_0x3bf62f,_0xf40f('0x9e'));rpcDb['crateCustomerReportQueue'](_0x3bf62f);_0xc089c4[_0xf40f('0x9f')]+=_0x3bf62f['talktime'];_0xc089c4['sumBillable']+=_0x3bf62f[_0xf40f('0xa0')];logger['info'](_0xf40f('0xa1'),_0x3bf62f[_0xf40f('0x8e')],'\x20Queue',_0xc089c4[_0xf40f('0x29')],_0xf40f('0x90'),_0xc089c4[_0xf40f('0x2d')]);delete this[_0xf40f('0x13')][_0x54f780['linkedid']];break;case _0xf40f('0xa2'):_0xc089c4[_0xf40f('0xa3')]+=0x1;_0x3bf62f['countbusyretry']+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut['totalGlobal'](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x5,_0xf40f('0xa4'));_0x31dbd4=_0xc089c4[_0xf40f('0xa5')];_0x3b83e9=_0xc089c4[_0xf40f('0xa6')];ami['emit'](_0xf40f('0xa7'),ut['buildObj'](_0x3bf62f,'busy'));rpcDb[_0xf40f('0x68')](_0x3bf62f,'[callProgressDetectingCustomer][logBusy]');_0x414165[_0xf40f('0x7d')](_0x3bf62f,'5',_0xc089c4)[_0xf40f('0x59')](function(_0x4d31c9){_0x1dd912=_0x4d31c9[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut[_0xf40f('0x78')](_0x3bf62f)>=_0xc089c4['dialGlobalMaxRetry']){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,_0xf40f('0xa8'));}else{if(_0x3bf62f[_0xf40f('0xa9')]>=_0xc089c4['dialBusyMaxRetry']){rpcDb[_0xf40f('0x6d')](_0x3bf62f,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3bf62f,_0xf40f('0xa9'),_0xc089c4[_0xf40f('0xa5')]),_0x3bf62f[_0xf40f('0x85')],_0x3bf62f[_0xf40f('0x86')]);}}}else{_0x3bf62f['countbusyretry']++;_0x414165[_0xf40f('0xaa')]({'id':_0x3bf62f['idContact'],'field':{'countbusyretry':_0x3bf62f[_0xf40f('0xa9')]}})['then'](function(){_0x414165['swapAdditionalPhones'](_0x3bf62f,_0x31dbd4,_0x3b83e9)['then'](function(){});});}});break;case _0xf40f('0xab'):_0xc089c4[_0xf40f('0xac')]+=0x1;_0x3bf62f[_0xf40f('0xad')]+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x3,_0xf40f('0xae'));_0x31dbd4=_0xc089c4[_0xf40f('0xaf')];_0x3b83e9=_0xc089c4['callAdditionalPhoneAfterMin'];var _0x38b79a=ut['buildNoAnswerEventPayload'](_0x3bf62f,_0xc089c4);ami[_0xf40f('0x24')]('custom:agentnoanswer',_0x38b79a);rpcDb[_0xf40f('0x68')](_0x3bf62f,'[callProgressDetectingCustomer][logNoAnswer]');_0x414165['verifyAdditionalPhones'](_0x3bf62f,'3',_0xc089c4)[_0xf40f('0x59')](function(_0x24f1b3){_0x1dd912=_0x24f1b3['additional']==0x1;if(!_0x1dd912){if(ut['totalGlobal'](_0x3bf62f)>=_0xc089c4['dialGlobalMaxRetry']){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,_0xf40f('0xb0'));}else{if(_0x3bf62f[_0xf40f('0xad')]>=_0xc089c4[_0xf40f('0xb1')]){rpcDb[_0xf40f('0x6d')](_0x3bf62f,_0xf40f('0xb2'));}else{rpcDb[_0xf40f('0xb3')](ut[_0xf40f('0xb4')](_0x3bf62f,'countnoanswerretry',_0xc089c4[_0xf40f('0xaf')]),_0x3bf62f[_0xf40f('0x85')],_0x3bf62f[_0xf40f('0x86')]);}}}else{_0x3bf62f[_0xf40f('0xad')]++;_0x414165[_0xf40f('0xaa')]({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnoanswerretry':_0x3bf62f[_0xf40f('0xad')]}})[_0xf40f('0x59')](function(){_0x414165[_0xf40f('0x8a')](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});});}});break;case _0xf40f('0xb5'):_0xc089c4['outboundCongestionCallsDay']+=0x1;_0x3bf62f['countcongestionretry']+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x8,_0xf40f('0xb6'));_0x31dbd4=_0xc089c4[_0xf40f('0xb7')];_0x3b83e9=_0xc089c4[_0xf40f('0xa6')];ami[_0xf40f('0x24')](_0xf40f('0xb8'),ut[_0xf40f('0x92')](_0x3bf62f,'congestion'));rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0xb9'));_0x414165[_0xf40f('0x7d')](_0x3bf62f,'8',_0xc089c4)[_0xf40f('0x59')](function(_0x267ff7){_0x1dd912=_0x267ff7[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut['totalGlobal'](_0x3bf62f)>=_0xc089c4['dialGlobalMaxRetry']){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x3bf62f['countcongestionretry']>=_0xc089c4[_0xf40f('0xba')]){rpcDb[_0xf40f('0x6d')](_0x3bf62f,_0xf40f('0xb9'));}else{rpcDb['rescheduleContact'](ut[_0xf40f('0xb4')](_0x3bf62f,_0xf40f('0xbb'),_0xc089c4[_0xf40f('0xa5')]),_0x3bf62f[_0xf40f('0x85')],_0x3bf62f[_0xf40f('0x86')]);}}}else{_0x3bf62f[_0xf40f('0xbb')]++;_0x414165['incrementPreviewCounters']({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countcongestionretry':_0x3bf62f[_0xf40f('0xbb')]}})[_0xf40f('0x59')](function(){_0x414165['swapAdditionalPhones'](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});});}});break;case _0xf40f('0xbc'):_0xc089c4['outboundRejectCallsDay']+=0x1;_0x3bf62f['countagentrejectretry']+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x14,'AgentReject');_0x31dbd4=_0xc089c4[_0xf40f('0xbd')];_0x3b83e9=_0xc089c4[_0xf40f('0xa6')];ami[_0xf40f('0x24')](_0xf40f('0xbe'),ut[_0xf40f('0x92')](_0x3bf62f,'agentreject'));rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0xbf'));_0x414165[_0xf40f('0x7d')](_0x3bf62f,'20',_0xc089c4)[_0xf40f('0x59')](function(_0x291e52){_0x1dd912=_0x291e52[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut[_0xf40f('0x78')](_0x3bf62f)>=_0xc089c4['dialGlobalMaxRetry']){_0x5aa502=ut['cloneAction'](_0x3bf62f,0x14,_0xf40f('0xc0'));rpcDb['createCustomerFinal'](_0x5aa502,_0xf40f('0xc1'));}else{if(_0x3bf62f[_0xf40f('0xc2')]>=_0xc089c4[_0xf40f('0xc3')]){rpcDb['createCustomerFinal'](_0x3bf62f,_0xf40f('0xc1'));}else{rpcDb[_0xf40f('0xb3')](ut[_0xf40f('0xb4')](_0x3bf62f,_0xf40f('0xc2'),_0xc089c4['dialAgentRejectRetryFrequency']),_0x3bf62f[_0xf40f('0x85')],_0x3bf62f[_0xf40f('0x86')]);}}}else{_0x3bf62f[_0xf40f('0xad')]++;_0x414165[_0xf40f('0xaa')]({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnoanswerretry':_0x3bf62f[_0xf40f('0xad')]}})[_0xf40f('0x59')](function(){_0x414165['swapAdditionalPhones'](_0x3bf62f,_0x31dbd4,_0x3b83e9)['then'](function(){});});}});break;case _0xf40f('0xc4'):_0xc089c4[_0xf40f('0xc5')]+=0x1;_0x3bf62f[_0xf40f('0xc6')]+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0xb,_0xf40f('0xc7'));rpcDb['createCustomerHistory'](_0x3bf62f,_0xf40f('0xc8'));_0x414165[_0xf40f('0x7d')](_0x3bf62f,'11',_0xc089c4)[_0xf40f('0x59')](function(_0x2a87c1){_0x1dd912=_0x2a87c1[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut['totalGlobal'](_0x3bf62f)>=_0xc089c4['dialGlobalMaxRetry']){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,'Global');rpcDb['createCustomerFinal'](_0x5aa502,_0xf40f('0xc8'));}else{if(_0x3bf62f[_0xf40f('0xc9')]>=_0xc089c4['dialAbandonedMaxRety']){rpcDb[_0xf40f('0x6d')](_0x3bf62f,_0xf40f('0xc8'));}else{rpcDb[_0xf40f('0xb3')](ut[_0xf40f('0xb4')](_0x3bf62f,'countabandonedretry',_0xc089c4['dialAbandonedRetryFrequency']),_0x3bf62f['unlockAgent'],_0x3bf62f['activeContact']);}}}else{_0x3bf62f[_0xf40f('0xad')]++;_0x414165[_0xf40f('0xaa')]({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnoanswerretry':_0x3bf62f[_0xf40f('0xad')]}})['then'](function(){_0x414165[_0xf40f('0x8a')](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});});}});break;case'18':_0xc089c4[_0xf40f('0xca')]+=0x1;_0x3bf62f[_0xf40f('0xcb')]+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut['totalGlobal'](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x12,_0x54f780[_0xf40f('0xcc')]||_0x54f780[_0xf40f('0xcd')]);ami['emit'](_0xf40f('0xce'),ut['buildObj'](_0x3bf62f,'amd'));rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0xcf'));_0x414165[_0xf40f('0x7d')](_0x3bf62f,'18',_0xc089c4)['then'](function(_0x5169c5){_0x1dd912=_0x5169c5[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut[_0xf40f('0x78')](_0x3bf62f)>=_0xc089c4[_0xf40f('0x80')]){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0x12,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,_0xf40f('0xcf'));}else{rpcDb['createCustomerFinal'](_0x3bf62f,_0xf40f('0xcf'));}}else{_0x3bf62f[_0xf40f('0xad')]++;_0x414165['incrementPreviewCounters']({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnoanswerretry':_0x3bf62f[_0xf40f('0xad')]}})[_0xf40f('0x59')](function(){_0x414165[_0xf40f('0x8a')](_0x3bf62f,_0x31dbd4,_0x3b83e9)['then'](function(){});});}});delete this['actions'][_0x54f780[_0xf40f('0x87')]];break;case'19':_0xc089c4[_0xf40f('0xca')]+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x13,_0x54f780[_0xf40f('0xcc')]||_0x54f780[_0xf40f('0xcd')]);ami[_0xf40f('0x24')]('custom:amd',ut[_0xf40f('0x92')](_0x3bf62f,_0xf40f('0xd0')));rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0xd1'));_0x414165['verifyAdditionalPhones'](_0x3bf62f,'18',_0xc089c4)[_0xf40f('0x59')](function(_0xa350fd){_0x1dd912=_0xa350fd['additional']==0x1;if(!_0x1dd912){if(ut[_0xf40f('0x78')](_0x3bf62f)>=_0xc089c4[_0xf40f('0x80')]){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,'Global');rpcDb[_0xf40f('0x6d')](_0x5aa502,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x3bf62f,_0xf40f('0xd1'));}}else{_0x3bf62f[_0xf40f('0xad')]++;_0x414165[_0xf40f('0xaa')]({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnoanswerretry':_0x3bf62f[_0xf40f('0xad')]}})['then'](function(){_0x414165[_0xf40f('0x8a')](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});});}});delete this[_0xf40f('0x13')][_0x54f780['linkedid']];break;default:if(_0x3bf62f[_0xf40f('0x45')]){ut[_0xf40f('0x50')](_0xc089c4,_0xf40f('0xd2'));ut[_0xf40f('0x51')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0xc089c4['name'],_0x54f780);}_0xc089c4[_0xf40f('0xca')]+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut['totalGlobal'](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0xc,_0x54f780[_0xf40f('0xcc')]||_0x54f780[_0xf40f('0xcd')]);_0x31dbd4=_0xc089c4[_0xf40f('0xbd')];_0x3b83e9=_0xc089c4[_0xf40f('0xa6')];rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0xd3'));_0x414165['verifyAdditionalPhones'](_0x3bf62f,'20',_0xc089c4)[_0xf40f('0x59')](function(_0x35c42c){_0x1dd912=_0x35c42c[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut['totalGlobal'](_0x3bf62f)>=_0xc089c4[_0xf40f('0x80')]){_0x5aa502=ut['cloneAction'](_0x3bf62f,0xf,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,_0xf40f('0xd4'));}else{rpcDb[_0xf40f('0x6d')](_0x3bf62f,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xf40f('0x13')][_0x54f780[_0xf40f('0x87')]];}else{_0x414165['swapAdditionalPhones'](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});}});}if(!(_0x3bf62f['dialAnswer']&&_0x3dcd34==='16')){utils[_0xf40f('0x4e')](_0xc089c4,_0xf40f('0xd5'));logger['info'](_0xf40f('0xd6'),_0x3bf62f[_0xf40f('0x8e')],'\x20Queue',_0xc089c4[_0xf40f('0x29')],'originated:\x20',_0xc089c4[_0xf40f('0x2c')]);}if(_0x3dcd34!==_0xf40f('0x8b')){delete this[_0xf40f('0x13')][_0x54f780[_0xf40f('0x87')]];delete this[_0xf40f('0x13')][_0x54f780[_0xf40f('0xd7')]];}_0xc089c4[_0xf40f('0xd8')]=!![];}};Preview['prototype'][_0xf40f('0xd9')]=function(_0xc5b1cb,_0xea5eb1,_0x2e429d){if(_[_0xf40f('0xda')](_0xea5eb1)&&_0xf40f('0xdb')!==typeof _0xea5eb1){return;}if(_[_0xf40f('0xda')](_0x2e429d)&&_0xf40f('0xdb')!==typeof _0x2e429d){return;}switch(_0x2e429d['reason']){case'0':ut[_0xf40f('0xdc')](_0xc5b1cb,0x0,_0xf40f('0x79'));rpcDb[_0xf40f('0xdd')](_0xc5b1cb,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xf40f('0xdc')](_0xc5b1cb,0x3,_0xf40f('0xae'));rpcDb[_0xf40f('0xdd')](_0xc5b1cb,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xf40f('0xdc')](_0xc5b1cb,0x5,'Busy');rpcDb[_0xf40f('0xdd')](_0xc5b1cb,_0xf40f('0xde'));break;case'8':ut[_0xf40f('0xdc')](_0xc5b1cb,0x8,'Congestion');rpcDb[_0xf40f('0xdd')](_0xc5b1cb,_0xf40f('0xdf'));break;case'22':ut[_0xf40f('0xdc')](_0xc5b1cb,0x16,'AnswerAGI');rpcDb[_0xf40f('0xdd')](_0xc5b1cb,_0xf40f('0xe0'));break;default:ut[_0xf40f('0xdc')](_0xc5b1cb,0xc,_0x2e429d[_0xf40f('0xe1')]);rpcDb['createAgentHistory'](_0xc5b1cb,_0xf40f('0xdf'));}utils[_0xf40f('0x4e')](_0xea5eb1,'[callProgressDetectingAgent]');logger[_0xf40f('0x25')](_0xf40f('0xe2'),_0xc5b1cb['uniqueid'],_0xf40f('0x8f'),_0xea5eb1[_0xf40f('0x29')],_0xf40f('0x44'),_0xea5eb1[_0xf40f('0x2c')]);delete this[_0xf40f('0x13')][_0xc5b1cb['uniqueid']];};Preview['prototype']['verifyAdditionalPhones']=function(_0xbcd73b,_0x327fd1,_0x12ff27){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0xbcd73b,_0x327fd1,_0x12ff27)['catch'](logger[_0xf40f('0x25')](_0xf40f('0xe3')));};Preview[_0xf40f('0xc')]['swapAdditionalPhones']=function(_0x410b5d,_0x2c6bc8,_0x2dc1e0){return cmHopperAdditionalPhone[_0xf40f('0x8a')](_0x410b5d,_0x2c6bc8,_0x2dc1e0)['catch'](logger[_0xf40f('0x25')](_0xf40f('0xe4')));};Preview['prototype'][_0xf40f('0xaa')]=function(_0x56ec97){return Promise[_0xf40f('0xe5')]()[_0xf40f('0x59')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x56ec97))[_0xf40f('0x4c')](logger[_0xf40f('0x25')](_0xf40f('0xe6')));};Preview[_0xf40f('0xc')][_0xf40f('0xe7')]=function(_0x3b29dc,_0x1314f5,_0x267d57,_0x380209,_0x34244c){var _0x41c2d9=this;return new Promise(function(_0x35f205,_0x224b20){if(_[_0xf40f('0x41')](_0x1314f5)||_[_0xf40f('0x41')](_0x1314f5['Contact'])||_['isNil'](_0x1314f5['phone'])||_[_0xf40f('0x41')](_0x1314f5['VoiceQueueId'])){_0x224b20(ut[_0xf40f('0x34')]('Contact\x20is\x20undefined',_0x380209,_0x34244c));return;}var _0x632003=uuid['v4']();var _0xa02459=_0x41c2d9[_0xf40f('0x11')][_0x1314f5['Queue']['name']];var _0x22521=_0x267d57?_0x41c2d9[_0xf40f('0x14')][_0x267d57]['id']:undefined;_0x41c2d9[_0xf40f('0x13')][_0x632003]=new Action(_0x1314f5,_0xa02459,_0x632003,_0x267d57,_0x22521);var _0x4e994a=_0x41c2d9['actions'][_0x632003];_0x4e994a['unlockAgent']=_0x380209;_0x4e994a['activeContact']=_0x34244c;_0x4e994a[_0xf40f('0xe8')]=_0x267d57;if(_[_0xf40f('0xe9')](_0x3b29dc)){_0x41c2d9[_0xf40f('0xea')](_0x4e994a,_0xa02459,_0x1314f5,_0x267d57)[_0xf40f('0x59')](function(_0x58c679){logger[_0xf40f('0x25')]('[Preview][execCall][success]',_0xf40f('0xeb')+_0x4e994a[_0xf40f('0x43')]+'\x20IdHopper:\x20'+_0x4e994a[_0xf40f('0x89')],JSON[_0xf40f('0x26')](_0x58c679));ami[_0xf40f('0x24')]('custom:agentcalled',ut[_0xf40f('0x92')](_0x4e994a,_0xf40f('0xec'),_0x41c2d9[_0xf40f('0x11')][_0x4e994a['queue']]));_0x35f205(ut[_0xf40f('0x34')](_0xf40f('0xed')));})[_0xf40f('0x4c')](function(_0x583d28){ut[_0xf40f('0x31')](_0xf40f('0xee'),_0x583d28);_0x224b20(ut[_0xf40f('0x34')](_0xf40f('0xef'),_0x380209,_0x34244c));});}else{_0xa02459[_0xf40f('0xf0')]+=0x1;ut[_0xf40f('0xf1')](_0x4e994a);rpcDb[_0xf40f('0xf2')](_0x4e994a,_0xf40f('0xf3'));delete _0x41c2d9[_0xf40f('0x13')][_0x632003];_0x224b20(ut[_0xf40f('0x34')]('Contact\x20in\x20black\x20List',_0x380209,_0x34244c));}});};Preview[_0xf40f('0xc')][_0xf40f('0x73')]=function(_0x546fba){return!_[_0xf40f('0x41')](_0x546fba)&&!_['isNil'](_0x546fba[_0xf40f('0x29')])&&!_[_0xf40f('0x41')](_0x546fba[_0xf40f('0xf4')])&&_0x546fba[_0xf40f('0xf4')]&&!_['isNil'](this[_0xf40f('0xf5')][util['format'](_0xf40f('0xf6'),_0x546fba[_0xf40f('0x29')])])&&!_['isNil'](this[_0xf40f('0xf5')][util[_0xf40f('0x27')]('SIP/%s',_0x546fba[_0xf40f('0x29')])][_0xf40f('0x4a')])&&(this[_0xf40f('0xf5')][util[_0xf40f('0x27')]('SIP/%s',_0x546fba[_0xf40f('0x29')])][_0xf40f('0x4a')]===_0xf40f('0xf7')||this['trunks'][util[_0xf40f('0x27')]('SIP/%s',_0x546fba['name'])][_0xf40f('0x4a')]===_0xf40f('0xf8'));};Preview[_0xf40f('0xc')][_0xf40f('0xf9')]=function(_0x4dc76b,_0x9896cb){return this[_0xf40f('0xfa')](_0x4dc76b,_0x9896cb)[_0xf40f('0x59')](function(_0x515c4d){return _[_0xf40f('0xfb')](_0x515c4d,[_0xf40f('0x34')]);})[_0xf40f('0x4c')](function(_0x397077){if(_0x397077[_0xf40f('0xfc')]){rpcDb[_0xf40f('0xfd')](_0x4dc76b);}if(_0x397077['active']){rpcDb[_0xf40f('0x61')](_0x4dc76b);}throw _[_0xf40f('0xfb')](_0x397077,[_0xf40f('0x34')]);});};Preview[_0xf40f('0xc')][_0xf40f('0xfa')]=function(_0x72f9ec,_0xff3d4b){var _0x149ed9=this;var _0x20fae9,_0x272e27;return rpcDb[_0xf40f('0xfe')](_0x72f9ec)['then'](function(_0x11a9bc){if(!_[_0xf40f('0x41')](_0x11a9bc[0x0])){_0x272e27=_0x11a9bc[0x0][_0xf40f('0xff')]?![]:!![];_0x20fae9=_0x11a9bc[0x0][_0xf40f('0xff')]?!![]:![];_0x20fae9=_0xff3d4b?!![]:_0x20fae9;}var _0x361821=_0x149ed9[_0xf40f('0x100')](_0x11a9bc);if(_0x361821['isValid']){rpcDb[_0xf40f('0x101')](_[_0xf40f('0xfb')](_0x11a9bc[0x0],[_0xf40f('0x102'),_0xf40f('0x103')]))['then'](function(_0x555ed6){_0x149ed9[_0xf40f('0xe7')](_0x555ed6,_0x11a9bc[0x0],_0xff3d4b,_0x272e27,_0x20fae9)['then'](function(_0x52db5d){return _0x52db5d;})['catch'](function(_0x47421d){throw _0x47421d;});})['catch'](function(_0x5805dc){ut[_0xf40f('0x31')](_0xf40f('0x104'),_0x5805dc);throw ut[_0xf40f('0x34')](_0xf40f('0x105'),_0x272e27,_0x20fae9);});}else{throw ut[_0xf40f('0x34')](_0x361821[_0xf40f('0x34')],_0x272e27,_0x20fae9);}})[_0xf40f('0x4c')](function(_0x3884b1){ut['logger'](_0xf40f('0x106'),_0x3884b1);throw ut['message'](_0xf40f('0x105'),![],!![]);});};Preview[_0xf40f('0xc')][_0xf40f('0x100')]=function(_0x352941){if(_[_0xf40f('0x41')](_0x352941)||_['isEmpty'](_0x352941)||!_['isNil'](_0x352941[0x0][_0xf40f('0x5d')])&&_['isNil'](_0x352941[0x0][_0xf40f('0x5d')]['name'])){ut[_0xf40f('0x31')](_0xf40f('0x107'),_0x352941);return{'isValid':![],'message':_0xf40f('0x108')};}var _0x7f01e3=this[_0xf40f('0x11')][_0x352941[0x0][_0xf40f('0x42')][_0xf40f('0x29')]];_0x7f01e3[_0xf40f('0x34')]=utils[_0xf40f('0x2f')][_0xf40f('0x75')];if(_['isNil'](_0x7f01e3)){ut['logger'](_0xf40f('0x109'),_0x7f01e3);return{'isValid':![],'message':_0xf40f('0x10a')};}if(!this[_0xf40f('0x73')](_0x7f01e3[_0xf40f('0x72')])){ut[_0xf40f('0x31')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x7f01e3[_0xf40f('0x29')]+_0xf40f('0x10b'));if(!this[_0xf40f('0x73')](_0x7f01e3[_0xf40f('0x74')])){ut[_0xf40f('0x31')](_0xf40f('0x10c'),_0x7f01e3[_0xf40f('0x29')]+_0xf40f('0x10d'));return{'isValid':![],'message':_0xf40f('0x10e')};}}if(!ut[_0xf40f('0x70')](_0x7f01e3[_0xf40f('0x71')])){ut[_0xf40f('0x31')]('[Preview][validateContact][Campaign\x20Active]',_0x7f01e3[_0xf40f('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xf40f('0x10f')+_0x7f01e3[_0xf40f('0x29')]+_0xf40f('0x110')};}return{'isValid':!![],'message':_0xf40f('0x111')};};Preview[_0xf40f('0xc')]['execCall']=function(_0x5eeae3,_0xcf3b8e,_0x20c99e,_0x44d99a){var _0x314dd2=this;return new Promise(function(_0x1b0843,_0x59d225){var _0x5560e0=_0x5eeae3['uniqueid'];var _0x56f68b=_0x314dd2[_0xf40f('0x73')](_0xcf3b8e[_0xf40f('0x72')])?util[_0xf40f('0x27')](_0xf40f('0x112'),_0xcf3b8e[_0xf40f('0x72')][_0xf40f('0x29')],_[_0xf40f('0x41')](_0xcf3b8e[_0xf40f('0x113')])?'':_0xcf3b8e['dialPrefix'][_0xf40f('0x114')]()||'',_0xcf3b8e[_0xf40f('0x115')]>0x0?_0x20c99e['phone']['substring'](_0xcf3b8e['dialCutDigit']):_0x20c99e[_0xf40f('0x103')]):util[_0xf40f('0x27')](_0xf40f('0x112'),_[_0xf40f('0x41')](_0xcf3b8e[_0xf40f('0x74')])?_0xcf3b8e[_0xf40f('0x72')]['name']:_0xcf3b8e['TrunkBackup'][_0xf40f('0x29')],_[_0xf40f('0x41')](_0xcf3b8e['dialPrefix'])?'':_0xcf3b8e[_0xf40f('0x113')][_0xf40f('0x114')]()||'',_0xcf3b8e['dialCutDigit']>0x0?_0x20c99e['phone']['substring'](_0xcf3b8e[_0xf40f('0x115')]):_0x20c99e[_0xf40f('0x103')]);var _0x4b93f5=_0x314dd2['isTrunkReachable'](_0xcf3b8e[_0xf40f('0x72')])?ut['getCallerId'](_0xcf3b8e[_0xf40f('0x72')][_0xf40f('0x116')],_0xcf3b8e[_0xf40f('0x117')],_0xcf3b8e[_0xf40f('0x118')]>0x0?ut['getCallerIdRandom'](_0xcf3b8e[_0xf40f('0x119')],_0xcf3b8e[_0xf40f('0x118')]):_0xcf3b8e['dialOriginateCallerIdNumber']):ut[_0xf40f('0x11a')](_[_0xf40f('0x41')](_0xcf3b8e[_0xf40f('0x74')])?_0xcf3b8e[_0xf40f('0x72')][_0xf40f('0x116')]:_0xcf3b8e[_0xf40f('0x74')][_0xf40f('0x116')],_0xcf3b8e['dialOriginateCallerIdName'],_0xcf3b8e[_0xf40f('0x118')]>0x0?ut[_0xf40f('0x11b')](_0xcf3b8e['dialOriginateCallerIdNumber'],_0xcf3b8e[_0xf40f('0x118')]):_0xcf3b8e[_0xf40f('0x119')]);if(_0x4b93f5){_0x5eeae3[_0xf40f('0x11c')]=ut[_0xf40f('0x11d')](_0x4b93f5);_0x5eeae3['originatecalleridnum']=ut[_0xf40f('0x11e')](_0x4b93f5);}var _0x196b56=ut[_0xf40f('0x11f')](_0xcf3b8e,_0x20c99e,_0x56f68b,_0x4b93f5,_0x5560e0,_0x5eeae3);var _0x44f6c4=utils[_0xf40f('0x120')](_0x20c99e['Contact']);Object['assign'](_0x196b56,_0x44f6c4);_[_0xf40f('0x121')](_0x5eeae3,ut[_0xf40f('0x122')](_0x196b56));_0x5eeae3['starttime']=moment()[_0xf40f('0x27')](_0xf40f('0x63'));_0xcf3b8e[_0xf40f('0x123')]=_0x196b56;var _0x18f13f=ut['variablesAction'](_0x5eeae3,_0xcf3b8e,_0x196b56,_0x5eeae3[_0xf40f('0x86')],_0x44d99a);return ami['Action'](_0x18f13f)[_0xf40f('0x59')](function(_0x28f62d){_0xcf3b8e['originated']+=0x1;logger[_0xf40f('0x25')](_0xf40f('0x124'),_0x5560e0,'\x20Queue',_0xcf3b8e[_0xf40f('0x29')],_0xf40f('0x44'),_0xcf3b8e[_0xf40f('0x2c')]);_0x1b0843(_0x28f62d);})[_0xf40f('0x4c')](function(_0x1f3528){ut['logAgent'](_0x5eeae3,0xe,_0xf40f('0x125'));rpcDb[_0xf40f('0xdd')](_0x5eeae3,_0xf40f('0x126'));_0x59d225(_0x1f3528);});});};Preview['prototype']['syncNewExten']=function(_0x147478){if(this[_0xf40f('0x13')][_0x147478[_0xf40f('0x87')]]){this[_0xf40f('0x13')][_0x147478[_0xf40f('0x87')]][_0xf40f('0x4b')]=_0x147478[_0xf40f('0x4b')];}};Preview[_0xf40f('0xc')][_0xf40f('0x127')]=function(_0xccce21){var _0x25fdcb=this;var _0x5a6636=this[_0xf40f('0x13')][_0xccce21[_0xf40f('0x128')]];if(_0x5a6636){if(_0x5a6636[_0xf40f('0xe8')]&&this[_0xf40f('0x14')][_0x5a6636[_0xf40f('0xe8')]]){ut[_0xf40f('0x129')](_0x5a6636,this[_0xf40f('0x14')][_0x5a6636[_0xf40f('0xe8')]][_0xf40f('0x29')],this['agents'][_0x5a6636[_0xf40f('0xe8')]]['id']);}var _0x18a714=_[_0xf40f('0x12a')](_0x5a6636);_0x18a714['responsetime']=moment()[_0xf40f('0x27')](_0xf40f('0x63'));var _0x4af3ea=_0x25fdcb[_0xf40f('0x11')][_0x5a6636['queue']];if(ut['isFailure'](_0xccce21['response'])){if(_0x5a6636[_0xf40f('0x85')]){rpcDb[_0xf40f('0xfd')](_0x5a6636[_0xf40f('0x89')]);}if(_0x5a6636['activeContact']){rpcDb[_0xf40f('0x61')](_0x5a6636[_0xf40f('0x89')]);}ami[_0xf40f('0x24')]('custom:agentringnoanswer',ut['buildObj'](_0x5a6636,_0xf40f('0x12b'),this[_0xf40f('0x11')][_0x5a6636[_0xf40f('0x43')]]));this[_0xf40f('0xd9')](_0x18a714,_0x4af3ea,_0xccce21);}else{_0x5a6636[_0xf40f('0x62')]=moment()['format'](_0xf40f('0x63'));ut['logAgent'](_0x18a714,0x4,_0xf40f('0x9c'));rpcDb[_0xf40f('0xdd')](_0x18a714,_0xf40f('0x12c'));}}};Preview['prototype'][_0xf40f('0x18')]=function(_0x63d344){var _0x4f114e=this[_0xf40f('0x13')][_0x63d344[_0xf40f('0x87')]];var _0xab2c0a;if(_0x4f114e){_0xab2c0a=this[_0xf40f('0x11')][_0x4f114e['queue']];logger[_0xf40f('0x25')](_0xf40f('0x12d'),_0x63d344['linkedid'],_0xf40f('0x8f'),_0xab2c0a[_0xf40f('0x29')],'pTalking:\x20',_0xab2c0a[_0xf40f('0x2d')]);}if(this[_0xf40f('0x13')][_0x63d344['linkedid']]&&_0x63d344['linkedid']!==_0x63d344[_0xf40f('0x8e')]){if(_0x63d344[_0xf40f('0x12e')]==='16'&&this['actions'][_0x63d344[_0xf40f('0x87')]][_0xf40f('0x45')]){this[_0xf40f('0x76')](_0x63d344,_0x63d344[_0xf40f('0x87')],_0x63d344[_0xf40f('0x12e')]);}else if(this[_0xf40f('0x13')][_0x63d344[_0xf40f('0x87')]][_0xf40f('0x45')]){logger[_0xf40f('0x25')](_0xf40f('0x12f'),_0x63d344['linkedid'],_0x63d344[_0xf40f('0x12e')],'\x20Queue',_0xab2c0a['name'],_0xf40f('0x90'),_0xab2c0a[_0xf40f('0x2d')]);this[_0xf40f('0x76')](_0x63d344,_0x63d344[_0xf40f('0x87')],_0x63d344['cause']);}}else if(_0x4f114e&&_[_0xf40f('0x41')](_0x4f114e[_0xf40f('0x130')])&&_0xab2c0a[_0xf40f('0x131')]&&_0x63d344[_0xf40f('0x87')]===_0x63d344[_0xf40f('0x8e')]&&_[_0xf40f('0x41')](_0x63d344[_0xf40f('0xe1')])&&_0x63d344[_0xf40f('0x12e')]==='16'&&_0x63d344[_0xf40f('0x132')]==='6'&&_[_0xf40f('0xda')](_0x4f114e[_0xf40f('0x133')])){if(_0x4f114e[_0xf40f('0x85')]){rpcDb[_0xf40f('0xfd')](_0x4f114e['idContact']);}if(_0x4f114e['activeContact']){rpcDb[_0xf40f('0x61')](_0x4f114e['idContact']);}_0x63d344[_0xf40f('0xe1')]='22';this[_0xf40f('0xd9')](_0x4f114e,_0xab2c0a,_0x63d344);}else if(_0x4f114e&&_0x4f114e['transfer']){if(_0x63d344[_0xf40f('0x12e')]==='16'&&this['actions'][_0x63d344['linkedid']][_0xf40f('0x45')]){logger[_0xf40f('0x25')](_0xf40f('0x134'),_0x63d344[_0xf40f('0x87')],_0x63d344[_0xf40f('0x12e')],_0xf40f('0x8f'),_0xab2c0a[_0xf40f('0x29')],_0xf40f('0x90'),_0xab2c0a[_0xf40f('0x2d')]);this[_0xf40f('0x76')](_0x63d344,_0x63d344[_0xf40f('0x87')],_0x63d344['cause']);}else if(this['actions'][_0x63d344['linkedid']][_0xf40f('0x45')]){logger[_0xf40f('0x25')]('[syncHangup][talking][cause]',_0x63d344['linkedid'],_0x63d344[_0xf40f('0x12e')],_0xf40f('0x8f'),_0xab2c0a[_0xf40f('0x29')],_0xf40f('0x90'),_0xab2c0a['pTalking']);this[_0xf40f('0x76')](_0x63d344,_0x63d344[_0xf40f('0x87')],_0x63d344['cause']);}}};Preview[_0xf40f('0xc')][_0xf40f('0x1b')]=function(_0x22f48e){if(this[_0xf40f('0x13')][_0x22f48e[_0xf40f('0xd7')]]&&_0x22f48e[_0xf40f('0xd7')]!==_0x22f48e[_0xf40f('0x135')]){this[_0xf40f('0x76')](_0x22f48e,_0x22f48e['destlinkedid'],_0x22f48e[_0xf40f('0xcd')]);}};Preview[_0xf40f('0xc')]['syncHangupRequest']=function(_0x33255f){if(this['actions'][_0x33255f['linkedid']]&&_0x33255f[_0xf40f('0x87')]!==_0x33255f[_0xf40f('0x8e')]&&!this[_0xf40f('0x13')][_0x33255f[_0xf40f('0x87')]][_0xf40f('0x45')]){if(_0x33255f['cause']==='1'){this[_0xf40f('0x76')](_0x33255f,_0x33255f[_0xf40f('0x87')],_0x33255f[_0xf40f('0x12e')]);}}};Preview['prototype'][_0xf40f('0x136')]=function(_0x5c7e1d,_0x5df1e2,_0x44da08){if(this['actions'][_0x5c7e1d]){if(_[_0xf40f('0x41')](this[_0xf40f('0x13')][_0x5c7e1d][_0xf40f('0x123')])){this[_0xf40f('0x13')][_0x5c7e1d][_0xf40f('0x123')]={};}this[_0xf40f('0x13')][_0x5c7e1d]['variables'][_0x5df1e2]=_0x44da08;}};Preview['prototype'][_0xf40f('0x1f')]=function(_0x51c03f){try{if(!_[_0xf40f('0x41')](_0x51c03f)){if(ut[_0xf40f('0x137')](_[_0xf40f('0x138')](_0x51c03f[_0xf40f('0x139')])[0x0])){this[_0xf40f('0x136')](_0x51c03f[_0xf40f('0x8e')],_[_0xf40f('0x138')](_0x51c03f['variable'])[0x0],_0x51c03f['value']);}}}catch(_0x1c9ab2){logger['error'](_0xf40f('0x13a'),util[_0xf40f('0x13b')](_0x1c9ab2,{'showHidden':![],'depth':null}));}};Preview[_0xf40f('0xc')][_0xf40f('0x21')]=function(_0x222a45){if(_0x222a45){if(this[_0xf40f('0x13')][_0x222a45[_0xf40f('0x13c')]]){this[_0xf40f('0x13')][_0x222a45[_0xf40f('0x13c')]][_0xf40f('0x133')]=!![];}}};Preview[_0xf40f('0xc')]['syncBlindTransfer']=function(_0x282196){if(_0x282196){if(this[_0xf40f('0x13')][_0x282196[_0xf40f('0x13d')]]){this[_0xf40f('0x13')][_0x282196[_0xf40f('0x13d')]][_0xf40f('0x133')]=!![];}}};module[_0xf40f('0x13e')]=Preview; \ No newline at end of file +var _0xc35e=['custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','busy','verifyAdditionalPhones','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','incrementPreviewCounters','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','outboundRejectCallsDay','countagentrejectretry','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','decrementOriginate','[callProgressDetectingCustomer]','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','run','execRun','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','toLowerVariables','starttime','variablesAction','Action','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','dialQueueProject','channelstate','transfer','unlockContact','callProgressDetectingAgent','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','prototype','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','clearZombieChannels','type','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','decrementTalking','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','isActive','Trunk','isTrunkReachable','TrunkBackup','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','[syncHangup][talking][increment]','uniqueid','connect','acw'];(function(_0x31216b,_0x4ccdaf){var _0x24a7b3=function(_0x5977db){while(--_0x5977db){_0x31216b['push'](_0x31216b['shift']());}};_0x24a7b3(++_0x4ccdaf);}(_0xc35e,0x1e9));var _0xec35=function(_0x130375,_0x4cee28){_0x130375=_0x130375-0x0;var _0x457d9e=_0xc35e[_0x130375];return _0x457d9e;};'use strict';var util=require(_0xec35('0x0'));var _=require(_0xec35('0x1'));var uuid=require(_0xec35('0x2'));var moment=require(_0xec35('0x3'));var Redis=require(_0xec35('0x4'));var config=require(_0xec35('0x5'));var logger=require('../../../config/logger')(_0xec35('0x6'));var loggerAction=require(_0xec35('0x7'))(_0xec35('0x8'));var ami=require(_0xec35('0x9'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xec35('0xa'));var Action=require('./action');var ut=require(_0xec35('0xb'));var utils=require(_0xec35('0xc'));config[_0xec35('0xd')]=_[_0xec35('0xe')](config[_0xec35('0xd')],{'host':_0xec35('0xf'),'port':0x18eb});var io=require(_0xec35('0x10'))(new Redis(config[_0xec35('0xd')]));var Sequence=function(){};Sequence['prototype'][_0xec35('0x11')]=function(_0x4acd5d){this[_0xec35('0x12')]=this[_0xec35('0x12')]?this[_0xec35('0x12')][_0xec35('0x13')](_0x4acd5d):_0x4acd5d();};function Preview(_0x4f2510){this[_0xec35('0x14')]=new Sequence();this[_0xec35('0x15')]=_0x4f2510['voiceQueues'];this[_0xec35('0x16')]=_0x4f2510['trunks'];this[_0xec35('0x17')]={};this['agents']=_0x4f2510[_0xec35('0x18')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xec35('0x19')][_0xec35('0x1a')](this));ami['on']('hangup',this[_0xec35('0x1b')][_0xec35('0x1a')](this));ami['on'](_0xec35('0x1c'),this[_0xec35('0x1d')][_0xec35('0x1a')](this));ami['on'](_0xec35('0x1e'),this[_0xec35('0x1f')][_0xec35('0x1a')](this));ami['on'](_0xec35('0x20'),this[_0xec35('0x21')][_0xec35('0x1a')](this));ami['on'](_0xec35('0x22'),this[_0xec35('0x23')]['bind'](this));ami['on'](_0xec35('0x24'),this[_0xec35('0x25')][_0xec35('0x1a')](this));ami['on'](_0xec35('0x26'),this[_0xec35('0x27')]['bind'](this));this['loopCampaigns'](this[_0xec35('0x15')]);}function emit(_0x51f949,_0x434dce,_0x19512a){io['to'](_0x51f949)[_0xec35('0x28')](_0x434dce,_0x19512a);}function emitVoiceQueueChannelRemove(_0x33b180){logger[_0xec35('0x29')](_0xec35('0x2a'),JSON[_0xec35('0x2b')](_0x33b180));emit(util[_0xec35('0x2c')](_0xec35('0x2d'),_0x33b180[_0xec35('0x2e')]),'voice_queue_channel:remove',_0x33b180);io[_0xec35('0x28')]('voice_queue_presence:remove',_0x33b180);}function notSendMessagesQueue(_0x148553){if(_0x148553[_0xec35('0x2f')]){if(_0x148553[_0xec35('0x30')]===0x0&&_0x148553[_0xec35('0x31')]===0x0){_0x148553[_0xec35('0x2f')]=![];_0x148553[_0xec35('0x32')]=0x0;_0x148553[_0xec35('0x33')]=0x0;_0x148553[_0xec35('0x34')]=utils[_0xec35('0x35')][_0xec35('0x36')];ut[_0xec35('0x37')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x148553[_0xec35('0x2e')]+_0xec35('0x38'));}else{_0x148553['message']=utils[_0xec35('0x35')][_0xec35('0x39')];ut[_0xec35('0x37')](_0xec35('0x3a'),_0x148553[_0xec35('0x2e')]+'\x20is\x20deactivated');}}}Preview[_0xec35('0x3b')][_0xec35('0x3c')]=function(){var _0x2528d7=this;setInterval(function(){_0x2528d7[_0xec35('0x3d')]();},0x7cf);};Preview[_0xec35('0x3b')][_0xec35('0x3d')]=function(){var _0xb23958=this[_0xec35('0x15')];this[_0xec35('0x3e')]+=0x1;for(var _0x130d2d in _0xb23958){if(_0xb23958[_0xec35('0x3f')](_0x130d2d)&&(_0xb23958[_0x130d2d][_0xec35('0x40')]===_0xec35('0x6')||_0xb23958[_0x130d2d][_0xec35('0x40')]===_0xec35('0x41'))&&_0xb23958[_0x130d2d]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xec35('0x3e')]=0x0;this[_0xec35('0x42')]();}}if(_0xb23958['hasOwnProperty'](_0x130d2d)&&_0xb23958[_0x130d2d][_0xec35('0x40')]==='preview'&&_0xb23958[_0x130d2d][_0xec35('0x43')]===_0xec35('0x44')){if(_0xb23958[_0x130d2d][_0xec35('0x45')]){this[_0xec35('0x46')](_0xb23958[_0x130d2d]);if(_0xb23958[_0x130d2d][_0xec35('0x47')])this[_0xec35('0x48')](_0xb23958[_0x130d2d]);}else{notSendMessagesQueue(_0xb23958[_0x130d2d]);}}}};Preview[_0xec35('0x3b')][_0xec35('0x49')]=function(_0xb46ca5){var _0x93529=this;this['sequence'][_0xec35('0x11')](function(){if(!_[_0xec35('0x4a')](_0x93529[_0xec35('0x17')][_0xb46ca5])){loggerAction[_0xec35('0x29')](_0xec35('0x4b'),_0xb46ca5,_0xec35('0x4c'),_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x4d')],_0xec35('0x4e'),JSON[_0xec35('0x2b')](_0x93529['campaignsPreview'][_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x4d')]][_0xec35('0x30')]),_0xec35('0x4f'),JSON[_0xec35('0x2b')](_0x93529[_0xec35('0x15')][_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x4d')]]['pTalking']),JSON[_0xec35('0x2b')](_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x50')]),JSON[_0xec35('0x2b')](_[_0xec35('0x51')](_0x93529[_0xec35('0x17')][_0xb46ca5],['contactId',_0xec35('0x52'),_0xec35('0x53'),'ListId'])));return ami['Action']({'action':_0xec35('0x54'),'channel':_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x55')]})[_0xec35('0x56')](function(_0x28238e){if(_0x28238e['message']===_0xec35('0x57')){setTimeout(function(){if(_0x93529[_0xec35('0x17')][_0xb46ca5]){utils['decrementOriginate'](_0x93529['campaignsPreview'][_0x93529['actions'][_0xb46ca5][_0xec35('0x4d')]],'[clearZombieChannel]');if(_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x50')]===!![]){ut[_0xec35('0x58')](_0x93529[_0xec35('0x15')][_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x4d')]],_0xec35('0x59'));ut[_0xec35('0x5a')](_0xec35('0x5b')+_0xb46ca5,_0x93529[_0xec35('0x17')][_0xb46ca5]['queue']);}ut[_0xec35('0x5a')](_0xec35('0x5c')+_0xb46ca5,_0x93529[_0xec35('0x17')][_0xb46ca5]['queue']);delete _0x93529[_0xec35('0x17')][_0xb46ca5];}},0x2328);}});}});};Preview[_0xec35('0x3b')][_0xec35('0x42')]=function(){var _0x4dac1b=this;loggerAction['info']('[action]',_[_0xec35('0x5d')](this[_0xec35('0x17')]));for(var _0x2f1d3e in this[_0xec35('0x17')]){if(_0x4dac1b[_0xec35('0x17')][_0xec35('0x3f')](_0x2f1d3e)){_0x4dac1b['clearZombieChannel'](_0x2f1d3e);}}};Preview[_0xec35('0x3b')][_0xec35('0x48')]=function(_0x935ada){var _0x292a25=this;rpcDb[_0xec35('0x5e')](_0x935ada['id'],ut[_0xec35('0x5f')](this[_0xec35('0x18')]))[_0xec35('0x60')](function(_0x32c41c){if(!_[_0xec35('0x4a')](_0x32c41c)){for(var _0x59ddf1=0x0;_0x59ddf1<_0x32c41c[_0xec35('0x61')];_0x59ddf1+=0x1){if(ut[_0xec35('0x62')](_0x32c41c[_0x59ddf1][_0xec35('0x63')])<_0x935ada[_0xec35('0x64')]*0x3c){if(_0x32c41c[_0x59ddf1]['Agent']&&!_0x32c41c[_0x59ddf1][_0xec35('0x65')]['voicePause']){_0x292a25['run'](_0x32c41c[_0x59ddf1]['id'])[_0xec35('0x60')](ut[_0xec35('0x66')](_0xec35('0x67')))['catch'](ut['logger2']('[RecallMe]'));}else{rpcDb[_0xec35('0x68')](_0x32c41c[_0x59ddf1]['id']);}}else{var _0x512dae=new Action(_0x32c41c[_0x59ddf1],_0x935ada);_0x512dae['starttime']=moment()['format'](_0xec35('0x69'));_0x935ada[_0xec35('0x6a')]+=0x1;ut[_0xec35('0x6b')](_0x512dae,0x17,_0xec35('0x6c'));if(_0x935ada[_0xec35('0x6d')]){rpcDb[_0xec35('0x6e')](ut[_0xec35('0x6f')](_0x32c41c[_0x59ddf1]));rpcDb[_0xec35('0x70')](_0x512dae,_0xec35('0x71'));}else{ut['logCustomer'](_0x512dae,0x16,_0xec35('0x72'));rpcDb[_0xec35('0x70')](_0x512dae,_0xec35('0x73'));rpcDb[_0xec35('0x74')](_0x512dae,_0xec35('0x73'));}}}}})[_0xec35('0x56')](ut[_0xec35('0x66')](_0xec35('0x75')));};Preview['prototype'][_0xec35('0x46')]=function(_0x38f550){_0x38f550[_0xec35('0x2f')]=!![];if(ut['IsNotLoggedIn'](_0x38f550[_0xec35('0x76')])){_0x38f550[_0xec35('0x34')]=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut[_0xec35('0x77')](_0x38f550[_0xec35('0x45')])){_0x38f550['message']=utils[_0xec35('0x35')][_0xec35('0x36')];}else if(!this['isTrunkReachable'](_0x38f550[_0xec35('0x78')])){if(!this[_0xec35('0x79')](_0x38f550[_0xec35('0x7a')])){_0x38f550[_0xec35('0x34')]=utils[_0xec35('0x35')]['UNREACHABLE_TRUNK'];}else{_0x38f550[_0xec35('0x34')]=utils[_0xec35('0x35')]['ACTIVE'];}}else{_0x38f550[_0xec35('0x34')]=utils[_0xec35('0x35')]['ACTIVE'];}};Preview[_0xec35('0x3b')][_0xec35('0x7b')]=function(_0x5f2026,_0x240369,_0x15876b){var _0x17a81f=this;var _0x3a739a=this[_0xec35('0x17')][_0x240369];var _0x5decba=this[_0xec35('0x15')][_0x3a739a[_0xec35('0x4d')]];var _0x252fc8;var _0x1b7c31=![];var _0xfd3f41=0x2;var _0x6605ea=0x3;if(_0x5decba){switch(_0x15876b){case'1':_0x5decba['outboundNoSuchCallsDay']+=0x1;_0x3a739a[_0xec35('0x7c')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0x0,_0xec35('0x7f'));ami[_0xec35('0x28')]('custom:agentnosuchnumber',ut[_0xec35('0x80')](_0x3a739a,'nosuchnumber'));rpcDb[_0xec35('0x70')](_0x3a739a,_0xec35('0x81'));_0x17a81f['verifyAdditionalPhones'](_0x3a739a,'0',_0x5decba)[_0xec35('0x60')](function(_0x53658b){_0x1b7c31=_0x53658b[_0xec35('0x82')]==0x1;_0xfd3f41=_0x5decba[_0xec35('0x83')];_0x6605ea=_0x5decba[_0xec35('0x84')];if(!_0x1b7c31){if(ut['totalGlobal'](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0xf,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0x88'));}else{if(_0x3a739a['countnosuchnumberretry']>=_0x5decba['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x3a739a,_0xec35('0x88'));}else{rpcDb[_0xec35('0x89')](ut[_0xec35('0x8a')](_0x3a739a,_0xec35('0x7c'),_0x5decba[_0xec35('0x83')]),_0x3a739a['unlockAgent'],_0x3a739a[_0xec35('0x8b')]);}}delete this[_0xec35('0x17')][_0x5f2026[_0xec35('0x8c')]];}else{_0x3a739a[_0xec35('0x7c')]++;logger['info'](_0xec35('0x8d'),_0x3a739a[_0xec35('0x7c')]);logger[_0xec35('0x29')]('id',_0x3a739a[_0xec35('0x8e')]);_0x17a81f['incrementPreviewCounters']({'id':_0x3a739a['idContact'],'field':{'countnosuchnumberretry':_0x3a739a['countnosuchnumberretry']}})[_0xec35('0x60')](function(){_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)['then'](function(){});});}});break;case _0xec35('0x90'):var _0x42e4ea=moment()['format'](_0xec35('0x69'));_0x3a739a['responsetime']=_0x42e4ea;_0x3a739a['answertime']=_0x42e4ea;_0x3a739a[_0xec35('0x50')]=!![];_0x5decba[_0xec35('0x31')]+=0x1;logger['info'](_0xec35('0x91'),_0x3a739a[_0xec35('0x92')],'\x20Queue',_0x5decba[_0xec35('0x2e')],_0xec35('0x4f'),_0x5decba[_0xec35('0x31')]);ami[_0xec35('0x28')]('custom:agentconnect',ut['buildObj'](_0x3a739a,_0xec35('0x93'),this[_0xec35('0x15')][_0x3a739a[_0xec35('0x4d')]]));if(_0x5decba[_0xec35('0x94')]||_0x5decba['mandatoryDisposition']){ami[_0xec35('0x28')](_0xec35('0x95'),{'queue':_0x3a739a['queue'],'interface':_0x3a739a[_0xec35('0x96')],'uniqueid':_0x3a739a[_0xec35('0x92')]});}break;case'16':ami[_0xec35('0x28')](_0xec35('0x97'),ut[_0xec35('0x80')](_0x3a739a,_0xec35('0x98'),this[_0xec35('0x15')][_0x3a739a[_0xec35('0x4d')]]));emitVoiceQueueChannelRemove(ut[_0xec35('0x80')](_0x3a739a,_0xec35('0x98')));_0x5decba[_0xec35('0x99')]+=0x1;_0x5decba['total']+=0x1;_0x5decba[_0xec35('0x9a')]+=0x1;ut[_0xec35('0x58')](_0x5decba,_0xec35('0x9b'));_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0x4,_0xec35('0x9c'));rpcDb[_0xec35('0x70')](_0x3a739a,_0xec35('0x9d'));rpcDb[_0xec35('0x74')](_0x3a739a,_0xec35('0x9e'));rpcDb[_0xec35('0x9f')](_0x3a739a);_0x5decba['sumDuration']+=_0x3a739a[_0xec35('0xa0')];_0x5decba[_0xec35('0xa1')]+=_0x3a739a[_0xec35('0xa0')];logger[_0xec35('0x29')](_0xec35('0xa2'),_0x3a739a[_0xec35('0x92')],_0xec35('0xa3'),_0x5decba[_0xec35('0x2e')],'pTalking:\x20',_0x5decba[_0xec35('0x31')]);delete this[_0xec35('0x17')][_0x5f2026[_0xec35('0x8c')]];break;case'BUSY':_0x5decba[_0xec35('0xa4')]+=0x1;_0x3a739a[_0xec35('0xa5')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0x5,_0xec35('0xa6'));_0xfd3f41=_0x5decba[_0xec35('0xa7')];_0x6605ea=_0x5decba['callAdditionalPhoneAfterMin'];ami[_0xec35('0x28')]('custom:agentbusy',ut[_0xec35('0x80')](_0x3a739a,_0xec35('0xa8')));rpcDb['createCustomerHistory'](_0x3a739a,'[callProgressDetectingCustomer][logBusy]');_0x17a81f[_0xec35('0xa9')](_0x3a739a,'5',_0x5decba)[_0xec35('0x60')](function(_0x33e883){_0x1b7c31=_0x33e883[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0xf,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0xaa'));}else{if(_0x3a739a[_0xec35('0xa5')]>=_0x5decba[_0xec35('0xab')]){rpcDb[_0xec35('0x74')](_0x3a739a,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xec35('0x89')](ut[_0xec35('0x8a')](_0x3a739a,_0xec35('0xa5'),_0x5decba[_0xec35('0xa7')]),_0x3a739a[_0xec35('0xac')],_0x3a739a[_0xec35('0x8b')]);}}}else{_0x3a739a[_0xec35('0xa5')]++;_0x17a81f['incrementPreviewCounters']({'id':_0x3a739a[_0xec35('0x8e')],'field':{'countbusyretry':_0x3a739a[_0xec35('0xa5')]}})['then'](function(){_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});});}});break;case _0xec35('0xad'):_0x5decba[_0xec35('0xae')]+=0x1;_0x3a739a[_0xec35('0xaf')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut['totalGlobal'](_0x3a739a);ut['logCustomer'](_0x3a739a,0x3,_0xec35('0xb0'));_0xfd3f41=_0x5decba['dialNoAnswerRetryFrequency'];_0x6605ea=_0x5decba[_0xec35('0x84')];var _0xae9f24=ut[_0xec35('0xb1')](_0x3a739a,_0x5decba);ami['emit']('custom:agentnoanswer',_0xae9f24);rpcDb[_0xec35('0x70')](_0x3a739a,_0xec35('0xb2'));_0x17a81f[_0xec35('0xa9')](_0x3a739a,'3',_0x5decba)[_0xec35('0x60')](function(_0x3a4c8d){_0x1b7c31=_0x3a4c8d[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0xf,'Global');rpcDb['createCustomerFinal'](_0x252fc8,_0xec35('0xb3'));}else{if(_0x3a739a[_0xec35('0xaf')]>=_0x5decba[_0xec35('0xb4')]){rpcDb['createCustomerFinal'](_0x3a739a,_0xec35('0xb2'));}else{rpcDb['rescheduleContact'](ut[_0xec35('0x8a')](_0x3a739a,_0xec35('0xaf'),_0x5decba['dialNoAnswerRetryFrequency']),_0x3a739a[_0xec35('0xac')],_0x3a739a['activeContact']);}}}else{_0x3a739a[_0xec35('0xaf')]++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a[_0xec35('0x8e')],'field':{'countnoanswerretry':_0x3a739a['countnoanswerretry']}})[_0xec35('0x60')](function(){_0x17a81f['swapAdditionalPhones'](_0x3a739a,_0xfd3f41,_0x6605ea)['then'](function(){});});}});break;case _0xec35('0xb6'):_0x5decba[_0xec35('0xb7')]+=0x1;_0x3a739a[_0xec35('0xb8')]+=0x1;_0x3a739a['countglobal']=ut[_0xec35('0x7e')](_0x3a739a);ut['logCustomer'](_0x3a739a,0x8,_0xec35('0xb9'));_0xfd3f41=_0x5decba[_0xec35('0xba')];_0x6605ea=_0x5decba['callAdditionalPhoneAfterMin'];ami[_0xec35('0x28')]('custom:agentcongestion',ut[_0xec35('0x80')](_0x3a739a,_0xec35('0xbb')));rpcDb[_0xec35('0x70')](_0x3a739a,'[callProgressDetectingCustomer][logCongestion]');_0x17a81f['verifyAdditionalPhones'](_0x3a739a,'8',_0x5decba)['then'](function(_0x393551){_0x1b7c31=_0x393551[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut['cloneAction'](_0x3a739a,0xf,'Global');rpcDb['createCustomerFinal'](_0x252fc8,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x3a739a['countcongestionretry']>=_0x5decba[_0xec35('0xbc')]){rpcDb[_0xec35('0x74')](_0x3a739a,_0xec35('0xbd'));}else{rpcDb[_0xec35('0x89')](ut[_0xec35('0x8a')](_0x3a739a,_0xec35('0xb8'),_0x5decba[_0xec35('0xa7')]),_0x3a739a['unlockAgent'],_0x3a739a[_0xec35('0x8b')]);}}}else{_0x3a739a[_0xec35('0xb8')]++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a[_0xec35('0x8e')],'field':{'countcongestionretry':_0x3a739a[_0xec35('0xb8')]}})['then'](function(){_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});});}});break;case'CANCEL':_0x5decba[_0xec35('0xbe')]+=0x1;_0x3a739a[_0xec35('0xbf')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0x14,'AgentReject');_0xfd3f41=_0x5decba['dialAgentRejectRetryFrequency'];_0x6605ea=_0x5decba['callAdditionalPhoneAfterMin'];ami[_0xec35('0x28')]('custom:agentreject',ut[_0xec35('0x80')](_0x3a739a,_0xec35('0xc0')));rpcDb[_0xec35('0x70')](_0x3a739a,'[syncHangupRequest][logAgentReject]');_0x17a81f[_0xec35('0xa9')](_0x3a739a,'20',_0x5decba)['then'](function(_0x181966){_0x1b7c31=_0x181966[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0x14,_0xec35('0xc1'));rpcDb['createCustomerFinal'](_0x252fc8,_0xec35('0xc2'));}else{if(_0x3a739a[_0xec35('0xbf')]>=_0x5decba[_0xec35('0xc3')]){rpcDb[_0xec35('0x74')](_0x3a739a,_0xec35('0xc2'));}else{rpcDb[_0xec35('0x89')](ut[_0xec35('0x8a')](_0x3a739a,'countagentrejectretry',_0x5decba[_0xec35('0xc4')]),_0x3a739a[_0xec35('0xac')],_0x3a739a['activeContact']);}}}else{_0x3a739a[_0xec35('0xaf')]++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a[_0xec35('0x8e')],'field':{'countnoanswerretry':_0x3a739a[_0xec35('0xaf')]}})[_0xec35('0x60')](function(){_0x17a81f['swapAdditionalPhones'](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});});}});break;case _0xec35('0xc5'):_0x5decba['outboundAbandonedCallsDay']+=0x1;_0x3a739a[_0xec35('0xc6')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut['logCustomer'](_0x3a739a,0xb,_0xec35('0xc7'));rpcDb[_0xec35('0x70')](_0x3a739a,_0xec35('0xc8'));_0x17a81f[_0xec35('0xa9')](_0x3a739a,'11',_0x5decba)[_0xec35('0x60')](function(_0xb3c8d){_0x1b7c31=_0xb3c8d[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba['dialGlobalMaxRetry']){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0xf,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0xc8'));}else{if(_0x3a739a['countabandonedetry']>=_0x5decba[_0xec35('0xc9')]){rpcDb['createCustomerFinal'](_0x3a739a,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3a739a,'countabandonedretry',_0x5decba[_0xec35('0xca')]),_0x3a739a[_0xec35('0xac')],_0x3a739a[_0xec35('0x8b')]);}}}else{_0x3a739a['countnoanswerretry']++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a['idContact'],'field':{'countnoanswerretry':_0x3a739a[_0xec35('0xaf')]}})[_0xec35('0x60')](function(){_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});});}});break;case'18':_0x5decba['outboundUnknownCallsDay']+=0x1;_0x3a739a[_0xec35('0xcb')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut['logCustomer'](_0x3a739a,0x12,_0x5f2026[_0xec35('0xcc')]||_0x5f2026[_0xec35('0xcd')]);ami[_0xec35('0x28')](_0xec35('0xce'),ut['buildObj'](_0x3a739a,'amd'));rpcDb[_0xec35('0x70')](_0x3a739a,'[callProgressDetectingCustomer][hangupInAMD]');_0x17a81f[_0xec35('0xa9')](_0x3a739a,'18',_0x5decba)[_0xec35('0x60')](function(_0x4e7cda){_0x1b7c31=_0x4e7cda['additional']==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut['cloneAction'](_0x3a739a,0x12,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0xcf'));}else{rpcDb[_0xec35('0x74')](_0x3a739a,_0xec35('0xcf'));}}else{_0x3a739a[_0xec35('0xaf')]++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a[_0xec35('0x8e')],'field':{'countnoanswerretry':_0x3a739a['countnoanswerretry']}})[_0xec35('0x60')](function(){_0x17a81f['swapAdditionalPhones'](_0x3a739a,_0xfd3f41,_0x6605ea)['then'](function(){});});}});delete this['actions'][_0x5f2026[_0xec35('0x8c')]];break;case'19':_0x5decba[_0xec35('0xd0')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0x13,_0x5f2026[_0xec35('0xcc')]||_0x5f2026[_0xec35('0xcd')]);ami[_0xec35('0x28')](_0xec35('0xce'),ut[_0xec35('0x80')](_0x3a739a,_0xec35('0xd1')));rpcDb['createCustomerHistory'](_0x3a739a,_0xec35('0xd2'));_0x17a81f[_0xec35('0xa9')](_0x3a739a,'18',_0x5decba)[_0xec35('0x60')](function(_0x277b62){_0x1b7c31=_0x277b62[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut['cloneAction'](_0x3a739a,0xf,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0xd2'));}else{rpcDb[_0xec35('0x74')](_0x3a739a,'[callProgressDetectingCustomer][machine]');}}else{_0x3a739a[_0xec35('0xaf')]++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a['idContact'],'field':{'countnoanswerretry':_0x3a739a[_0xec35('0xaf')]}})['then'](function(){_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});});}});delete this[_0xec35('0x17')][_0x5f2026['linkedid']];break;default:if(_0x3a739a[_0xec35('0x50')]){ut[_0xec35('0x58')](_0x5decba,_0xec35('0xd3'));ut['loggerError'](_0xec35('0xd4')+_0x5decba[_0xec35('0x2e')],_0x5f2026);}_0x5decba[_0xec35('0xd0')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0xc,_0x5f2026['cause-txt']||_0x5f2026['dialstatus']);_0xfd3f41=_0x5decba[_0xec35('0xc4')];_0x6605ea=_0x5decba[_0xec35('0x84')];rpcDb[_0xec35('0x70')](_0x3a739a,'[callProgressDetectingCustomer][logUnknown]');_0x17a81f[_0xec35('0xa9')](_0x3a739a,'20',_0x5decba)['then'](function(_0x52dc36){_0x1b7c31=_0x52dc36['additional']==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba['dialGlobalMaxRetry']){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0xf,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0xd5'));}else{rpcDb[_0xec35('0x74')](_0x3a739a,_0xec35('0xd5'));}delete this[_0xec35('0x17')][_0x5f2026['linkedid']];}else{_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});}});}if(!(_0x3a739a[_0xec35('0x50')]&&_0x15876b==='16')){utils[_0xec35('0xd6')](_0x5decba,_0xec35('0xd7'));logger[_0xec35('0x29')]('[originated][decrement][callProgressDetectingCustomer]',_0x3a739a[_0xec35('0x92')],_0xec35('0xa3'),_0x5decba[_0xec35('0x2e')],_0xec35('0x4e'),_0x5decba[_0xec35('0x30')]);}if(_0x15876b!==_0xec35('0x90')){delete this[_0xec35('0x17')][_0x5f2026[_0xec35('0x8c')]];delete this[_0xec35('0x17')][_0x5f2026['destlinkedid']];}_0x5decba['queueSummaryCountersUpdated']=!![];}};Preview[_0xec35('0x3b')]['callProgressDetectingAgent']=function(_0x27ac84,_0x11c684,_0x3d1dff){if(_[_0xec35('0xd8')](_0x11c684)&&_0xec35('0xd9')!==typeof _0x11c684){return;}if(_[_0xec35('0xd8')](_0x3d1dff)&&_0xec35('0xd9')!==typeof _0x3d1dff){return;}switch(_0x3d1dff[_0xec35('0xda')]){case'0':ut[_0xec35('0xdb')](_0x27ac84,0x0,_0xec35('0x7f'));rpcDb[_0xec35('0xdc')](_0x27ac84,_0xec35('0xdd'));break;case'3':ut[_0xec35('0xdb')](_0x27ac84,0x3,'NoAnswer');rpcDb[_0xec35('0xdc')](_0x27ac84,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xec35('0xdb')](_0x27ac84,0x5,_0xec35('0xa6'));rpcDb['createAgentHistory'](_0x27ac84,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xec35('0xdb')](_0x27ac84,0x8,_0xec35('0xb9'));rpcDb[_0xec35('0xdc')](_0x27ac84,_0xec35('0xde'));break;case'22':ut['logAgent'](_0x27ac84,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x27ac84,_0xec35('0xdf'));break;default:ut[_0xec35('0xdb')](_0x27ac84,0xc,_0x3d1dff[_0xec35('0xda')]);rpcDb[_0xec35('0xdc')](_0x27ac84,_0xec35('0xde'));}utils[_0xec35('0xd6')](_0x11c684,_0xec35('0xe0'));logger[_0xec35('0x29')](_0xec35('0xe1'),_0x27ac84['uniqueid'],'\x20Queue',_0x11c684[_0xec35('0x2e')],'originated:\x20',_0x11c684['originated']);delete this[_0xec35('0x17')][_0x27ac84[_0xec35('0x92')]];};Preview['prototype'][_0xec35('0xa9')]=function(_0x100c17,_0x29645a,_0x2e51d9){return cmHopperAdditionalPhone[_0xec35('0xa9')](_0x100c17,_0x29645a,_0x2e51d9)[_0xec35('0x56')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0xec35('0x3b')][_0xec35('0x8f')]=function(_0x260e96,_0x1d7013,_0x3b1356){return cmHopperAdditionalPhone[_0xec35('0x8f')](_0x260e96,_0x1d7013,_0x3b1356)[_0xec35('0x56')](logger[_0xec35('0x29')](_0xec35('0xe2')));};Preview[_0xec35('0x3b')][_0xec35('0xb5')]=function(_0x421517){return Promise['resolve']()[_0xec35('0x60')](cmHopperAdditionalPhone[_0xec35('0xb5')](_0x421517))[_0xec35('0x56')](logger[_0xec35('0x29')](_0xec35('0xe3')));};Preview[_0xec35('0x3b')][_0xec35('0xe4')]=function(_0x518bd3,_0x3c9996,_0x397646,_0x539d80,_0x6e3697){var _0xad725f=this;return new Promise(function(_0x58f0b4,_0x28bf7d){if(_[_0xec35('0x4a')](_0x3c9996)||_['isNil'](_0x3c9996[_0xec35('0xe5')])||_[_0xec35('0x4a')](_0x3c9996[_0xec35('0xe6')])||_[_0xec35('0x4a')](_0x3c9996[_0xec35('0x53')])){_0x28bf7d(ut[_0xec35('0x34')]('Contact\x20is\x20undefined',_0x539d80,_0x6e3697));return;}var _0x1d4b98=uuid['v4']();var _0x5a4d73=_0xad725f[_0xec35('0x15')][_0x3c9996[_0xec35('0x4c')][_0xec35('0x2e')]];var _0x2d10ab=_0x397646?_0xad725f[_0xec35('0x18')][_0x397646]['id']:undefined;_0xad725f['actions'][_0x1d4b98]=new Action(_0x3c9996,_0x5a4d73,_0x1d4b98,_0x397646,_0x2d10ab);var _0x1e3940=_0xad725f[_0xec35('0x17')][_0x1d4b98];_0x1e3940[_0xec35('0xac')]=_0x539d80;_0x1e3940[_0xec35('0x8b')]=_0x6e3697;_0x1e3940[_0xec35('0xe7')]=_0x397646;if(_[_0xec35('0xe8')](_0x518bd3)){_0xad725f[_0xec35('0xe9')](_0x1e3940,_0x5a4d73,_0x3c9996,_0x397646)['then'](function(_0x45eac4){logger[_0xec35('0x29')](_0xec35('0xea'),_0xec35('0xeb')+_0x1e3940[_0xec35('0x4d')]+_0xec35('0xec')+_0x1e3940[_0xec35('0x8e')],JSON[_0xec35('0x2b')](_0x45eac4));ami[_0xec35('0x28')](_0xec35('0xed'),ut[_0xec35('0x80')](_0x1e3940,_0xec35('0xee'),_0xad725f[_0xec35('0x15')][_0x1e3940['queue']]));_0x58f0b4(ut['message'](_0xec35('0xef')));})['catch'](function(_0x415e0b){ut[_0xec35('0x37')](_0xec35('0xf0'),_0x415e0b);_0x28bf7d(ut[_0xec35('0x34')](_0xec35('0xf1'),_0x539d80,_0x6e3697));});}else{_0x5a4d73[_0xec35('0xf2')]+=0x1;ut['logBlacklist'](_0x1e3940);rpcDb[_0xec35('0xf3')](_0x1e3940,_0xec35('0xf4'));delete _0xad725f[_0xec35('0x17')][_0x1d4b98];_0x28bf7d(ut[_0xec35('0x34')]('Contact\x20in\x20black\x20List',_0x539d80,_0x6e3697));}});};Preview['prototype'][_0xec35('0x79')]=function(_0x4496a4){return!_[_0xec35('0x4a')](_0x4496a4)&&!_[_0xec35('0x4a')](_0x4496a4['name'])&&!_[_0xec35('0x4a')](_0x4496a4[_0xec35('0xf5')])&&_0x4496a4[_0xec35('0xf5')]&&!_[_0xec35('0x4a')](this[_0xec35('0x16')][util['format'](_0xec35('0xf6'),_0x4496a4['name'])])&&!_[_0xec35('0x4a')](this[_0xec35('0x16')][util[_0xec35('0x2c')](_0xec35('0xf6'),_0x4496a4[_0xec35('0x2e')])]['status'])&&(this[_0xec35('0x16')][util[_0xec35('0x2c')](_0xec35('0xf6'),_0x4496a4[_0xec35('0x2e')])][_0xec35('0x54')]===_0xec35('0xf7')||this['trunks'][util['format'](_0xec35('0xf6'),_0x4496a4['name'])][_0xec35('0x54')]===_0xec35('0xf8'));};Preview[_0xec35('0x3b')][_0xec35('0xf9')]=function(_0x54585d,_0x39fe47){return this[_0xec35('0xfa')](_0x54585d,_0x39fe47)['then'](function(_0x41616e){return _[_0xec35('0x51')](_0x41616e,[_0xec35('0x34')]);})[_0xec35('0x56')](function(_0x3524ec){if(_0x3524ec['unlock']){rpcDb['unlockContact'](_0x54585d);}if(_0x3524ec[_0xec35('0xf5')]){rpcDb['disableContact'](_0x54585d);}throw _['pick'](_0x3524ec,[_0xec35('0x34')]);});};Preview['prototype'][_0xec35('0xfa')]=function(_0x2cbffa,_0x39a1c7){var _0x1c11b7=this;var _0x3978e8,_0x377d9c;return rpcDb[_0xec35('0xfb')](_0x2cbffa)[_0xec35('0x60')](function(_0x1ae16d){if(!_[_0xec35('0x4a')](_0x1ae16d[0x0])){_0x377d9c=_0x1ae16d[0x0][_0xec35('0xfc')]?![]:!![];_0x3978e8=_0x1ae16d[0x0][_0xec35('0xfc')]?!![]:![];_0x3978e8=_0x39a1c7?!![]:_0x3978e8;}var _0x46a597=_0x1c11b7['validateContact'](_0x1ae16d);if(_0x46a597[_0xec35('0xfd')]){rpcDb[_0xec35('0xfe')](_[_0xec35('0x51')](_0x1ae16d[0x0],[_0xec35('0x53'),_0xec35('0xe6')]))[_0xec35('0x60')](function(_0x1022be){_0x1c11b7['checkInBlack'](_0x1022be,_0x1ae16d[0x0],_0x39a1c7,_0x377d9c,_0x3978e8)[_0xec35('0x60')](function(_0x30838a){return _0x30838a;})[_0xec35('0x56')](function(_0x20ef14){throw _0x20ef14;});})[_0xec35('0x56')](function(_0x2a7ead){ut['logger'](_0xec35('0xff'),_0x2a7ead);throw ut[_0xec35('0x34')](_0xec35('0x100'),_0x377d9c,_0x3978e8);});}else{throw ut['message'](_0x46a597[_0xec35('0x34')],_0x377d9c,_0x3978e8);}})[_0xec35('0x56')](function(_0x41da60){ut[_0xec35('0x37')](_0xec35('0x101'),_0x41da60);throw ut[_0xec35('0x34')](_0xec35('0x100'),![],!![]);});};Preview[_0xec35('0x3b')][_0xec35('0x102')]=function(_0x414aaf){if(_[_0xec35('0x4a')](_0x414aaf)||_[_0xec35('0xe8')](_0x414aaf)||!_['isNil'](_0x414aaf[0x0][_0xec35('0x65')])&&_[_0xec35('0x4a')](_0x414aaf[0x0][_0xec35('0x65')]['name'])){ut[_0xec35('0x37')](_0xec35('0x103'),_0x414aaf);return{'isValid':![],'message':_0xec35('0x104')};}var _0x5a278f=this['campaignsPreview'][_0x414aaf[0x0]['Queue'][_0xec35('0x2e')]];_0x5a278f[_0xec35('0x34')]=utils[_0xec35('0x35')][_0xec35('0x105')];if(_['isNil'](_0x5a278f)){ut['logger'](_0xec35('0x106'),_0x5a278f);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xec35('0x79')](_0x5a278f[_0xec35('0x78')])){ut[_0xec35('0x37')](_0xec35('0x107'),_0xec35('0x108')+_0x5a278f[_0xec35('0x2e')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x5a278f[_0xec35('0x7a')])){ut['logger'](_0xec35('0x107'),_0x5a278f[_0xec35('0x2e')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xec35('0x109')};}}if(!ut[_0xec35('0x77')](_0x5a278f[_0xec35('0x45')])){ut[_0xec35('0x37')]('[Preview][validateContact][Campaign\x20Active]',_0x5a278f[_0xec35('0x2e')]+_0xec35('0x10a'));return{'isValid':![],'message':_0xec35('0x108')+_0x5a278f['name']+_0xec35('0x10a')};}return{'isValid':!![],'message':_0xec35('0x10b')};};Preview[_0xec35('0x3b')][_0xec35('0xe9')]=function(_0x2a8c5c,_0x1eb89a,_0x336a4,_0x289d33){var _0x2a4af6=this;return new Promise(function(_0x3e52e7,_0x4cdf8e){var _0xcb5f33=_0x2a8c5c[_0xec35('0x92')];var _0x205ff4=_0x2a4af6[_0xec35('0x79')](_0x1eb89a['Trunk'])?util['format'](_0xec35('0x10c'),_0x1eb89a[_0xec35('0x78')][_0xec35('0x2e')],_[_0xec35('0x4a')](_0x1eb89a['dialPrefix'])?'':_0x1eb89a['dialPrefix'][_0xec35('0x10d')]()||'',_0x1eb89a['dialCutDigit']>0x0?_0x336a4[_0xec35('0xe6')]['substring'](_0x1eb89a[_0xec35('0x10e')]):_0x336a4[_0xec35('0xe6')]):util['format'](_0xec35('0x10c'),_[_0xec35('0x4a')](_0x1eb89a['TrunkBackup'])?_0x1eb89a[_0xec35('0x78')][_0xec35('0x2e')]:_0x1eb89a[_0xec35('0x7a')][_0xec35('0x2e')],_[_0xec35('0x4a')](_0x1eb89a[_0xec35('0x10f')])?'':_0x1eb89a['dialPrefix']['trim']()||'',_0x1eb89a[_0xec35('0x10e')]>0x0?_0x336a4['phone'][_0xec35('0x110')](_0x1eb89a[_0xec35('0x10e')]):_0x336a4[_0xec35('0xe6')]);var _0x38632c=_0x2a4af6[_0xec35('0x79')](_0x1eb89a[_0xec35('0x78')])?ut[_0xec35('0x111')](_0x1eb89a[_0xec35('0x78')][_0xec35('0x112')],_0x1eb89a['dialOriginateCallerIdName'],_0x1eb89a[_0xec35('0x113')]>0x0?ut[_0xec35('0x114')](_0x1eb89a[_0xec35('0x115')],_0x1eb89a[_0xec35('0x113')]):_0x1eb89a[_0xec35('0x115')]):ut[_0xec35('0x111')](_[_0xec35('0x4a')](_0x1eb89a[_0xec35('0x7a')])?_0x1eb89a[_0xec35('0x78')][_0xec35('0x112')]:_0x1eb89a['TrunkBackup'][_0xec35('0x112')],_0x1eb89a[_0xec35('0x116')],_0x1eb89a['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x1eb89a[_0xec35('0x115')],_0x1eb89a[_0xec35('0x113')]):_0x1eb89a[_0xec35('0x115')]);if(_0x38632c){_0x2a8c5c[_0xec35('0x117')]=ut[_0xec35('0x118')](_0x38632c);_0x2a8c5c['originatecalleridnum']=ut[_0xec35('0x119')](_0x38632c);}var _0x48de6c=ut[_0xec35('0x11a')](_0x1eb89a,_0x336a4,_0x205ff4,_0x38632c,_0xcb5f33,_0x2a8c5c);var _0x397a3b=utils[_0xec35('0x11b')](_0x336a4[_0xec35('0xe5')]);Object[_0xec35('0x11c')](_0x48de6c,_0x397a3b);_['merge'](_0x2a8c5c,ut[_0xec35('0x11d')](_0x48de6c));_0x2a8c5c[_0xec35('0x11e')]=moment()[_0xec35('0x2c')](_0xec35('0x69'));_0x1eb89a['variables']=_0x48de6c;var _0x11ce32=ut[_0xec35('0x11f')](_0x2a8c5c,_0x1eb89a,_0x48de6c,_0x2a8c5c[_0xec35('0x8b')],_0x289d33);return ami[_0xec35('0x120')](_0x11ce32)[_0xec35('0x60')](function(_0x52a8ad){_0x1eb89a[_0xec35('0x30')]+=0x1;logger[_0xec35('0x29')](_0xec35('0x121'),_0xcb5f33,_0xec35('0xa3'),_0x1eb89a['name'],_0xec35('0x4e'),_0x1eb89a['originated']);_0x3e52e7(_0x52a8ad);})[_0xec35('0x56')](function(_0x4722c8){ut['logAgent'](_0x2a8c5c,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x2a8c5c,_0xec35('0x122'));_0x4cdf8e(_0x4722c8);});});};Preview['prototype'][_0xec35('0x21')]=function(_0x48e77a){if(this['actions'][_0x48e77a[_0xec35('0x8c')]]){this[_0xec35('0x17')][_0x48e77a[_0xec35('0x8c')]][_0xec35('0x55')]=_0x48e77a[_0xec35('0x55')];}};Preview[_0xec35('0x3b')][_0xec35('0x19')]=function(_0x894377){var _0x19db6d=this;var _0x44e809=this['actions'][_0x894377[_0xec35('0x123')]];if(_0x44e809){if(_0x44e809[_0xec35('0xe7')]&&this[_0xec35('0x18')][_0x44e809[_0xec35('0xe7')]]){ut['logLookAgent'](_0x44e809,this[_0xec35('0x18')][_0x44e809[_0xec35('0xe7')]][_0xec35('0x2e')],this[_0xec35('0x18')][_0x44e809[_0xec35('0xe7')]]['id']);}var _0x41570e=_[_0xec35('0x124')](_0x44e809);_0x41570e['responsetime']=moment()[_0xec35('0x2c')](_0xec35('0x69'));var _0x4a6cfb=_0x19db6d[_0xec35('0x15')][_0x44e809['queue']];if(ut[_0xec35('0x125')](_0x894377[_0xec35('0x126')])){if(_0x44e809['unlockAgent']){rpcDb['unlockContact'](_0x44e809[_0xec35('0x8e')]);}if(_0x44e809['activeContact']){rpcDb[_0xec35('0x68')](_0x44e809[_0xec35('0x8e')]);}ami['emit'](_0xec35('0x127'),ut[_0xec35('0x80')](_0x44e809,_0xec35('0x128'),this[_0xec35('0x15')][_0x44e809[_0xec35('0x4d')]]));this['callProgressDetectingAgent'](_0x41570e,_0x4a6cfb,_0x894377);}else{_0x44e809[_0xec35('0x11e')]=moment()[_0xec35('0x2c')](_0xec35('0x69'));ut['logAgent'](_0x41570e,0x4,'Answer');rpcDb[_0xec35('0xdc')](_0x41570e,_0xec35('0x129'));}}};Preview[_0xec35('0x3b')][_0xec35('0x1b')]=function(_0x90e5c7){var _0x1fa86a=this['actions'][_0x90e5c7[_0xec35('0x8c')]];var _0x576538;if(_0x1fa86a){_0x576538=this[_0xec35('0x15')][_0x1fa86a[_0xec35('0x4d')]];logger[_0xec35('0x29')](_0xec35('0x12a'),_0x90e5c7['linkedid'],_0xec35('0xa3'),_0x576538[_0xec35('0x2e')],_0xec35('0x4f'),_0x576538[_0xec35('0x31')]);}if(this['actions'][_0x90e5c7['linkedid']]&&_0x90e5c7[_0xec35('0x8c')]!==_0x90e5c7[_0xec35('0x92')]){if(_0x90e5c7['cause']==='16'&&this[_0xec35('0x17')][_0x90e5c7['linkedid']][_0xec35('0x50')]){this[_0xec35('0x7b')](_0x90e5c7,_0x90e5c7['linkedid'],_0x90e5c7['cause']);}else if(this[_0xec35('0x17')][_0x90e5c7[_0xec35('0x8c')]][_0xec35('0x50')]){logger[_0xec35('0x29')]('[syncHangup][talking][cause]',_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')],'\x20Queue',_0x576538['name'],_0xec35('0x4f'),_0x576538[_0xec35('0x31')]);this[_0xec35('0x7b')](_0x90e5c7,_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')]);}}else if(_0x1fa86a&&_[_0xec35('0x4a')](_0x1fa86a['statedesc'])&&_0x576538[_0xec35('0x12c')]&&_0x90e5c7['linkedid']===_0x90e5c7[_0xec35('0x92')]&&_[_0xec35('0x4a')](_0x90e5c7[_0xec35('0xda')])&&_0x90e5c7[_0xec35('0x12b')]==='16'&&_0x90e5c7[_0xec35('0x12d')]==='6'&&_[_0xec35('0xd8')](_0x1fa86a[_0xec35('0x12e')])){if(_0x1fa86a['unlockAgent']){rpcDb[_0xec35('0x12f')](_0x1fa86a[_0xec35('0x8e')]);}if(_0x1fa86a['activeContact']){rpcDb['disableContact'](_0x1fa86a[_0xec35('0x8e')]);}_0x90e5c7[_0xec35('0xda')]='22';this[_0xec35('0x130')](_0x1fa86a,_0x576538,_0x90e5c7);}else if(_0x1fa86a&&_0x1fa86a[_0xec35('0x12e')]){if(_0x90e5c7[_0xec35('0x12b')]==='16'&&this[_0xec35('0x17')][_0x90e5c7[_0xec35('0x8c')]][_0xec35('0x50')]){logger[_0xec35('0x29')](_0xec35('0x131'),_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')],_0xec35('0xa3'),_0x576538[_0xec35('0x2e')],_0xec35('0x4f'),_0x576538[_0xec35('0x31')]);this[_0xec35('0x7b')](_0x90e5c7,_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')]);}else if(this[_0xec35('0x17')][_0x90e5c7[_0xec35('0x8c')]][_0xec35('0x50')]){logger[_0xec35('0x29')](_0xec35('0x132'),_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')],_0xec35('0xa3'),_0x576538[_0xec35('0x2e')],_0xec35('0x4f'),_0x576538[_0xec35('0x31')]);this[_0xec35('0x7b')](_0x90e5c7,_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')]);}}};Preview['prototype']['syncDialEnd']=function(_0x43a5d1){if(this[_0xec35('0x17')][_0x43a5d1[_0xec35('0x133')]]&&_0x43a5d1['destlinkedid']!==_0x43a5d1[_0xec35('0x134')]){this[_0xec35('0x7b')](_0x43a5d1,_0x43a5d1[_0xec35('0x133')],_0x43a5d1[_0xec35('0xcd')]);}};Preview[_0xec35('0x3b')][_0xec35('0x1d')]=function(_0x42dc68){if(this[_0xec35('0x17')][_0x42dc68[_0xec35('0x8c')]]&&_0x42dc68[_0xec35('0x8c')]!==_0x42dc68[_0xec35('0x92')]&&!this['actions'][_0x42dc68[_0xec35('0x8c')]]['dialAnswer']){if(_0x42dc68['cause']==='1'){this[_0xec35('0x7b')](_0x42dc68,_0x42dc68[_0xec35('0x8c')],_0x42dc68[_0xec35('0x12b')]);}}};Preview[_0xec35('0x3b')][_0xec35('0x135')]=function(_0x23f6aa,_0x3c9a70,_0x46e897){if(this[_0xec35('0x17')][_0x23f6aa]){if(_[_0xec35('0x4a')](this[_0xec35('0x17')][_0x23f6aa][_0xec35('0x136')])){this[_0xec35('0x17')][_0x23f6aa]['variables']={};}this['actions'][_0x23f6aa][_0xec35('0x136')][_0x3c9a70]=_0x46e897;}};Preview[_0xec35('0x3b')][_0xec35('0x23')]=function(_0x113621){try{if(!_[_0xec35('0x4a')](_0x113621)){if(ut['filterKey'](_[_0xec35('0x137')](_0x113621[_0xec35('0x138')])[0x0])){this[_0xec35('0x135')](_0x113621['uniqueid'],_[_0xec35('0x137')](_0x113621[_0xec35('0x138')])[0x0],_0x113621[_0xec35('0x139')]);}}}catch(_0x2fb55b){logger[_0xec35('0x13a')](_0xec35('0x13b'),util[_0xec35('0x13c')](_0x2fb55b,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xec35('0x25')]=function(_0x3652fb){if(_0x3652fb){if(this[_0xec35('0x17')][_0x3652fb['transfertargetlinkedid']]){this[_0xec35('0x17')][_0x3652fb[_0xec35('0x13d')]][_0xec35('0x12e')]=!![];}}};Preview[_0xec35('0x3b')][_0xec35('0x27')]=function(_0x1d89e5){if(_0x1d89e5){if(this[_0xec35('0x17')][_0x1d89e5[_0xec35('0x13e')]]){this[_0xec35('0x17')][_0x1d89e5[_0xec35('0x13e')]][_0xec35('0x12e')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 8edce51..29e1c70 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 _0x677e=['uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','resolve','then','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','UserId','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x677e,0x13d));var _0xe677=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x677e[_0x4704dc];return _0x254d81;};'use strict';var util=require('util');var BPromise=require(_0xe677('0x0'));var logger=require(_0xe677('0x1'))(_0xe677('0x2'));var cmHopper=require(_0xe677('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xe677('0x4'));var voiceQueueReport=require(_0xe677('0x5'));function loggerCatch(_0x49b165){return function(_0x3e6ffa){logger[_0xe677('0x6')](_0x49b165,util['inspect'](_0x3e6ffa,{'showHidden':![],'depth':null}));};}function create(_0x4cc73d){return cmHopperHistory[_0xe677('0x7')](_0x4cc73d)[_0xe677('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x2d6f3f){return BPromise[_0xe677('0x9')]()[_0xe677('0xa')](agentReportPreview[_0xe677('0x7')](_0x2d6f3f))[_0xe677('0x8')](loggerCatch(_0xe677('0xb')));}function moveContact(_0xb13a7f){return cmHopper[_0xe677('0xc')](_0xb13a7f,!![])[_0xe677('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xe677('0xd')]=function(_0x402283){return cmHopperBlack[_0xe677('0xd')](_0x402283)[_0xe677('0x8')](loggerCatch(_0xe677('0xe')));};exports[_0xe677('0xf')]=function(_0x201bdb){return BPromise[_0xe677('0x9')]()['then'](cmHopper['getContactPreview'](_0x201bdb))[_0xe677('0x8')](loggerCatch(_0xe677('0x10')));};exports[_0xe677('0x7')]=function(_0x4c2d6f,_0x4fc6f9){create(_0x4c2d6f)['catch'](loggerCatch(_0x4fc6f9));moveContact(_0x4c2d6f)['catch'](loggerCatch(_0x4fc6f9));};exports[_0xe677('0x11')]=function(_0x102584,_0x2a592c){createAgent(_0x102584)[_0xe677('0x8')](loggerCatch(_0x2a592c));};exports['createCustomerHistory']=function(_0x425153,_0x49b8d9){create(_0x425153)[_0xe677('0x8')](loggerCatch(_0x49b8d9));};exports['createCustomerFinal']=function(_0x525351,_0x42062e){moveContact(_0x525351)[_0xe677('0x8')](loggerCatch(_0x42062e));};exports['rescheduleContact']=function(_0x5ab843,_0x1138c2,_0x123448){if(_0x1138c2){_0x5ab843[_0xe677('0x12')]=null;}if(_0x123448){_0x5ab843['active']=![];}return cmHopper[_0xe677('0x13')](_0x5ab843)[_0xe677('0x8')](loggerCatch(_0xe677('0x14')));};exports[_0xe677('0x15')]=function(_0x49dc68){return cmHopper[_0xe677('0x15')](_0x49dc68)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xe677('0x16')]=function(_0x8af390){return cmHopper['unlockContact']({'UserId':null},_0x8af390,0x1)['catch'](loggerCatch(_0xe677('0x17')));};exports['disableContact']=function(_0x361f48){return cmHopper[_0xe677('0x16')]({'active':![]},_0x361f48,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xe677('0x18')]=function(_0x45836f){var _0x2a629b={};_0x2a629b['type']=_0x45836f[_0xe677('0x19')];_0x2a629b['uniqueid']=_0x45836f[_0xe677('0x1a')];_0x2a629b['calleridnum']=_0x45836f[_0xe677('0x1b')];_0x2a629b['calleridname']=_0x45836f[_0xe677('0x1c')];_0x2a629b[_0xe677('0x1d')]=_0x45836f[_0xe677('0x1d')];_0x2a629b['queuecallerjoinAt']=_0x45836f[_0xe677('0x1e')];_0x2a629b[_0xe677('0x1f')]=_0x45836f[_0xe677('0x1e')];_0x2a629b[_0xe677('0x20')]=0x1;_0x2a629b[_0xe677('0x21')]=_0x45836f[_0xe677('0x22')];_0x2a629b[_0xe677('0x23')]=_0x45836f[_0xe677('0x24')];_0x2a629b[_0xe677('0x25')]=_0xe677('0x26');_0x2a629b[_0xe677('0x27')]='xcally-motion-preview';_0x2a629b[_0xe677('0x28')]=0x0;_0x2a629b['assigned']=0x1;_0x2a629b[_0xe677('0x29')]=_0x45836f[_0xe677('0x24')];_0x2a629b[_0xe677('0x2a')]=_0xe677('0x2b');return BPromise['resolve']()[_0xe677('0xa')](voiceQueueReport[_0xe677('0x2c')](_0x2a629b))[_0xe677('0x8')](loggerCatch(_0xe677('0x2d')));};exports[_0xe677('0x2e')]=function(_0x3a5c3d,_0xd1a77c){return BPromise[_0xe677('0x9')]()[_0xe677('0xa')](cmHopper[_0xe677('0x2e')](_0x3a5c3d,_0xd1a77c))[_0xe677('0x8')](loggerCatch(_0xe677('0x2f')));};exports[_0xe677('0x30')]=function(_0x4fff5c){return cmHopper[_0xe677('0x13')](_0x4fff5c,!![],!![])[_0xe677('0x8')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x1adb=['rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x407da1,_0x4e44d3){var _0x448f97=function(_0x375739){while(--_0x375739){_0x407da1['push'](_0x407da1['shift']());}};_0x448f97(++_0x4e44d3);}(_0x1adb,0xca));var _0xb1ad=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1adb[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0xb1ad('0x0'));var BPromise=require(_0xb1ad('0x1'));var logger=require(_0xb1ad('0x2'))(_0xb1ad('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xb1ad('0x4'));var cmHopperBlack=require(_0xb1ad('0x5'));var agentReportPreview=require(_0xb1ad('0x6'));var voiceQueueReport=require(_0xb1ad('0x7'));function loggerCatch(_0x2b5305){return function(_0x4d8533){logger['error'](_0x2b5305,util[_0xb1ad('0x8')](_0x4d8533,{'showHidden':![],'depth':null}));};}function create(_0x36675a){return cmHopperHistory[_0xb1ad('0x9')](_0x36675a)[_0xb1ad('0xa')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x572e65){return BPromise[_0xb1ad('0xb')]()['then'](agentReportPreview['createHistory'](_0x572e65))[_0xb1ad('0xa')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x222be1){return cmHopper['moveContactManagedDialer'](_0x222be1,!![])[_0xb1ad('0xa')](loggerCatch(_0xb1ad('0xc')));}exports[_0xb1ad('0xd')]=function(_0xe09e7b){return cmHopperBlack[_0xb1ad('0xd')](_0xe09e7b)[_0xb1ad('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xb1ad('0xe')]=function(_0x6f4ac5){return BPromise[_0xb1ad('0xb')]()[_0xb1ad('0xf')](cmHopper[_0xb1ad('0xe')](_0x6f4ac5))[_0xb1ad('0xa')](loggerCatch(_0xb1ad('0x10')));};exports['createHistory']=function(_0x2f084e,_0x25080a){create(_0x2f084e)[_0xb1ad('0xa')](loggerCatch(_0x25080a));moveContact(_0x2f084e)[_0xb1ad('0xa')](loggerCatch(_0x25080a));};exports[_0xb1ad('0x11')]=function(_0x5ad7e7,_0x3f7653){createAgent(_0x5ad7e7)['catch'](loggerCatch(_0x3f7653));};exports[_0xb1ad('0x12')]=function(_0x37e9f3,_0x1d1c00){create(_0x37e9f3)['catch'](loggerCatch(_0x1d1c00));};exports[_0xb1ad('0x13')]=function(_0x3d4868,_0x19b8aa){moveContact(_0x3d4868)[_0xb1ad('0xa')](loggerCatch(_0x19b8aa));};exports['rescheduleContact']=function(_0x386196,_0x4464de,_0x21b115){if(_0x4464de){_0x386196[_0xb1ad('0x14')]=null;}if(_0x21b115){_0x386196['active']=![];}return cmHopper['rescheduleContact'](_0x386196)['catch'](loggerCatch(_0xb1ad('0x15')));};exports[_0xb1ad('0x16')]=function(_0x35ddd7){return cmHopper[_0xb1ad('0x16')](_0x35ddd7)[_0xb1ad('0xa')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x3d64db){return cmHopper[_0xb1ad('0x17')]({'UserId':null},_0x3d64db,0x1)[_0xb1ad('0xa')](loggerCatch(_0xb1ad('0x18')));};exports[_0xb1ad('0x19')]=function(_0x304598){return cmHopper[_0xb1ad('0x17')]({'active':![]},_0x304598,0x1)[_0xb1ad('0xa')](loggerCatch(_0xb1ad('0x1a')));};exports[_0xb1ad('0x1b')]=function(_0x140dd3){var _0x4e5134={};_0x4e5134[_0xb1ad('0x1c')]=_0x140dd3['type'];_0x4e5134[_0xb1ad('0x1d')]=_0x140dd3[_0xb1ad('0x1d')];_0x4e5134[_0xb1ad('0x1e')]=_0x140dd3[_0xb1ad('0x1e')];_0x4e5134[_0xb1ad('0x1f')]=_0x140dd3['calleridname'];_0x4e5134['queue']=_0x140dd3[_0xb1ad('0x20')];_0x4e5134[_0xb1ad('0x21')]=_0x140dd3[_0xb1ad('0x22')];_0x4e5134['queuecallerleaveAt']=_0x140dd3['answertime'];_0x4e5134['queuecallercomplete']=0x1;_0x4e5134[_0xb1ad('0x23')]=_0x140dd3[_0xb1ad('0x24')];_0x4e5134['connectedlinename']=_0x140dd3[_0xb1ad('0x25')];_0x4e5134[_0xb1ad('0x26')]=_0xb1ad('0x27');_0x4e5134[_0xb1ad('0x28')]=_0xb1ad('0x29');_0x4e5134['holdtime']=0x0;_0x4e5134['assigned']=0x1;_0x4e5134[_0xb1ad('0x2a')]=_0x140dd3['membername'];_0x4e5134[_0xb1ad('0x2b')]='COMPLETED';return BPromise[_0xb1ad('0xb')]()[_0xb1ad('0xf')](voiceQueueReport[_0xb1ad('0x2c')](_0x4e5134))[_0xb1ad('0xa')](loggerCatch(_0xb1ad('0x2d')));};exports[_0xb1ad('0x2e')]=function(_0x335dda,_0x58b160){return BPromise[_0xb1ad('0xb')]()[_0xb1ad('0xf')](cmHopper['getContactRecallMe'](_0x335dda,_0x58b160))[_0xb1ad('0xa')](loggerCatch(_0xb1ad('0x2f')));};exports['rescheduleContactInQueue']=function(_0x4b5ce9){return cmHopper[_0xb1ad('0x30')](_0x4b5ce9,!![],!![])['catch'](loggerCatch(_0xb1ad('0x31')));}; \ 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 a4c5794..acdaa2f 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 _0x4ec4=['\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','getSeconds','logLookAgent','membername','UserId','logCustomer','ringtime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','calleridnum','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','push','getDiff','milliseconds','CampaignId','filterKey','idContact','type','dialAnswer','channelAgent','countnoanswerretry','callback','callbackuniqueid','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','pow','replace','random','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','moment','preview','env','XCALLY_IP_AGI','../../dialer/utils','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','ContactId','dialer','VoiceQueueId'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x4ec4,0xf5));var _0x44ec=function(_0x236f98,_0x20aa59){_0x236f98=_0x236f98-0x0;var _0xff6ca6=_0x4ec4[_0x236f98];return _0xff6ca6;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x44ec('0x0'));var logger=require('../../../../config/logger')(_0x44ec('0x1'));var ipAgi=process[_0x44ec('0x2')][_0x44ec('0x3')]||'127.0.0.1';var utils=require(_0x44ec('0x4'));exports['loggerCatch']=function(_0x40f26c){return function(_0x209d31){logger[_0x44ec('0x5')](_0x40f26c,util[_0x44ec('0x6')](_0x209d31,{'showHidden':![],'depth':null}));};};exports[_0x44ec('0x7')]=function(_0x54136b,_0x11795c){logger[_0x44ec('0x8')](_0x54136b,util[_0x44ec('0x6')](_0x11795c,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5d5e5c,_0x452be1){logger[_0x44ec('0x5')](_0x5d5e5c,util['inspect'](_0x452be1,{'showHidden':![],'depth':null}));};exports[_0x44ec('0x9')]=function(_0x3e726f){return function(_0x4c97fd){logger[_0x44ec('0x8')](_0x3e726f,util[_0x44ec('0x6')](_0x4c97fd,{'showHidden':![],'depth':null}));};};exports[_0x44ec('0xa')]=function(_0x3c1be0,_0x33f96f,_0xd7740a){return{'message':_0x3c1be0,'unlock':_0x33f96f,'active':_0xd7740a};};exports[_0x44ec('0xb')]=function(_0x6c94f7,_0x8646e4,_0x412aad){if(!_[_0x44ec('0xc')](_0x412aad)&&_0x44ec('0xd')===typeof _0x412aad&&!_[_0x44ec('0xe')](_0x412aad)){if(!_[_0x44ec('0xc')](_0x8646e4)&&_0x44ec('0xd')===typeof _0x8646e4&&!_[_0x44ec('0xe')](_0x8646e4)){return util['format'](_0x44ec('0xf'),_0x8646e4,_0x412aad);}return util[_0x44ec('0x10')](_0x44ec('0xf'),_0x412aad,_0x412aad);}if(!_[_0x44ec('0xc')](_0x6c94f7)&&'string'===typeof _0x6c94f7&&!_['isEmpty'](_0x6c94f7)){return _0x6c94f7;}return _0x44ec('0x11');};exports[_0x44ec('0x12')]=function(_0x30f8e1){if(_[_0x44ec('0x13')](_0x30f8e1)){return![];}return _0x30f8e1;};exports[_0x44ec('0x14')]=function(_0x476f70,_0x25a11f,_0x3483b5,_0x59ff2d,_0x6666f5,_0x5cc9d1){var _0x4f9d9a={'XMD-QUEUE':_0x25a11f[_0x44ec('0x15')]?_0x25a11f[_0x44ec('0x15')]['name']:'','XMD-CALLERID':_0x59ff2d,'XMD-CALLERID-PREVIEW':_0x5cc9d1?util['format'](_0x44ec('0xf'),_0x5cc9d1['calleridname'],_0x5cc9d1['calleridnum']):_0x59ff2d,'XMD-DIALID':_0x6666f5,'XMD-CONTACTID':_0x25a11f[_0x44ec('0x16')],'XMD-CDRTYPE':_0x44ec('0x17'),'CALLERID(all)':_0x59ff2d,'XMD-VOICEQUEUEID':_0x25a11f[_0x44ec('0x18')],'XMD-DIALCHANNEL':_0x3483b5,'XMD-DIALTIMEOUT':_0x476f70['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x44ec('0x10')](_0x44ec('0x19'),_0x476f70[_0x44ec('0x1a')]?'g':'',_[_0x44ec('0xe')](_0x476f70['monitor_format'])?'':_0x44ec('0x1b')),'XMD-DIALURL':_0x476f70['dialPreviewUrl']||'','XMD-AGI':_0x476f70[_0x44ec('0x1c')]?util[_0x44ec('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x476f70['dialQueueProject']):_0x44ec('0x1d'),'XMD-AGIAFTER':_0x476f70[_0x44ec('0x1a')]?util['format'](_0x44ec('0x1e'),ipAgi,_0x476f70[_0x44ec('0x1a')]):_0x44ec('0x1d'),'XMD-ORIGINATECALLERIDNUM':_0x5cc9d1?_0x5cc9d1[_0x44ec('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x5cc9d1?_0x5cc9d1[_0x44ec('0x20')]:'','XMD-DESTINATION':_0x44ec('0x21'),'SIPADDHEADER':_0x44ec('0x22')};if(!_[_0x44ec('0xe')](_0x476f70[_0x44ec('0x23')])){_0x4f9d9a[util['format']('%s',_0x44ec('0x24'))]=_0x476f70[_0x44ec('0x23')];_0x4f9d9a[util[_0x44ec('0x10')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x6666f5;}return _0x4f9d9a;};exports[_0x44ec('0x25')]=function(_0x4d790d){var _0x262f0b={};for(var _0x20f359 in _0x4d790d){if(_0x4d790d[_0x44ec('0x26')](_0x20f359)){_0x262f0b[util[_0x44ec('0x10')]('%s',_[_0x44ec('0x27')](_0x20f359))]=_0x4d790d[_0x20f359];}}return{'variables':_0x262f0b};};exports[_0x44ec('0x28')]=function(_0x5dbb19){var _0x38cf3c=moment()['format'](_0x44ec('0x29'));_0x5dbb19[_0x44ec('0x2a')]=0xd;_0x5dbb19[_0x44ec('0x2b')]=_0x44ec('0x2c');_0x5dbb19[_0x44ec('0x2d')]=_0x38cf3c;_0x5dbb19[_0x44ec('0x2e')]=_0x38cf3c;_0x5dbb19[_0x44ec('0x2f')]=_0x38cf3c;};exports[_0x44ec('0x30')]=function(_0x5288be,_0x45680b,_0x2b16c0){var _0x3bd82f=moment()[_0x44ec('0x10')](_0x44ec('0x29'));_0x5288be[_0x44ec('0x2a')]=_0x45680b;_0x5288be[_0x44ec('0x2b')]=_0x2b16c0;_0x5288be[_0x44ec('0x2e')]=_0x3bd82f;_0x5288be['ringtime']=utils[_0x44ec('0x31')](_0x5288be[_0x44ec('0x2e')],_0x5288be[_0x44ec('0x2d')]);};exports[_0x44ec('0x32')]=function(_0x63d336,_0x3247cd,_0x70a278){_0x63d336[_0x44ec('0x33')]=_0x3247cd;_0x63d336[_0x44ec('0x34')]=_0x70a278;};exports[_0x44ec('0x35')]=function(_0x406f6e,_0x1adebd,_0x2f717c){var _0x43bbea=moment()[_0x44ec('0x10')](_0x44ec('0x29'));_0x406f6e[_0x44ec('0x2a')]=_0x1adebd;_0x406f6e[_0x44ec('0x2b')]=_0x2f717c;_0x406f6e['responsetime']=_0x406f6e[_0x44ec('0x2e')]?_0x406f6e[_0x44ec('0x2e')]:_0x43bbea;_0x406f6e['endtime']=_0x406f6e['endtime']?_0x406f6e['endtime']:_0x43bbea;_0x406f6e[_0x44ec('0x36')]=utils['getSeconds'](_0x406f6e[_0x44ec('0x2e')]||0x0,_0x406f6e[_0x44ec('0x2d')]||0x0);_0x406f6e['talktime']=_0x406f6e['answertime']?utils[_0x44ec('0x31')](_0x406f6e[_0x44ec('0x2f')],_0x406f6e[_0x44ec('0x37')]):0x0;};exports[_0x44ec('0x38')]=function(_0x1889fb){return _0x1889fb===_0x44ec('0x39');};exports[_0x44ec('0x3a')]=function(_0x3bd07f,_0x5c69b5,_0x3a4955,_0x5c9817,_0x1910f6){var _0x21d7df=_0x5c9817?_0x44ec('0x3b'):_0x3bd07f[_0x44ec('0x3c')];_0x21d7df=_0x1910f6?_0x44ec('0x3d'):_0x21d7df;return{'actionid':_0x3bd07f[_0x44ec('0x3e')],'action':_0x44ec('0x3f'),'channel':_0x3bd07f['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x21d7df,_0x3bd07f[_0x44ec('0x40')]),'Exten':_0x44ec('0x21'),'Context':'from-sip','Priority':'1','variable':_0x3a4955,'timeout':(_0x5c69b5['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3bd07f['uniqueid']};};exports[_0x44ec('0x41')]=function(_0x5731c3){return _0x5731c3[_0x44ec('0x42')]+_0x5731c3[_0x44ec('0x43')]+_0x5731c3['countnoanswerretry']+_0x5731c3['countagentrejectretry']+_0x5731c3[_0x44ec('0x44')];};exports[_0x44ec('0x45')]=function(_0x127c5a){var _0x2d3386=_[_0x44ec('0x46')](_0x127c5a);_0x2d3386[_0x44ec('0x2a')]=0xf;_0x2d3386['statedesc']=_0x44ec('0x47');return _0x2d3386;};exports[_0x44ec('0x48')]=function(_0xfcb9c5,_0x4c421c,_0x447ff5){var _0x82ab1f={};_0x82ab1f[_0x4c421c]=_0xfcb9c5[_0x4c421c];_0x82ab1f[_0x44ec('0x49')]=![];_0x82ab1f[_0x44ec('0x4a')]=moment()[_0x44ec('0x4b')](_0x447ff5,'minutes')[_0x44ec('0x10')](_0x44ec('0x29'));_0x82ab1f['ContactId']=_0xfcb9c5[_0x44ec('0x16')];_0x82ab1f[_0x44ec('0x4c')]=_0xfcb9c5[_0x44ec('0x4c')];_0x82ab1f['VoiceQueueId']=_0xfcb9c5[_0x44ec('0x18')]||undefined;return _0x82ab1f;};exports[_0x44ec('0x4d')]=function(_0x33e075,_0x8b7832){if(!_[_0x44ec('0x13')](_0x33e075)){if(_0x33e075['pTalking']>0x0){_0x33e075[_0x44ec('0x4e')]-=0x1;}else{logger[_0x44ec('0x8')](_0x8b7832,_0x44ec('0x4f'));}}else{logger[_0x44ec('0x5')](_0x8b7832,_0x44ec('0x50'));}};exports[_0x44ec('0x51')]=function(_0x14369b){if(_0x14369b<=0x0){return!![];}return![];};function buildObj(_0x2f31f1,_0xb718a3,_0xa5f427){_0x2f31f1[_0x44ec('0x52')]=_0xb718a3;_0x2f31f1[_0x44ec('0x53')]=_0x2f31f1[_0x44ec('0x54')];_0x2f31f1['interface']=_0x2f31f1['channelAgent'];_0x2f31f1['motionChannel']=_0x44ec('0x55');if(_0xa5f427){_0x2f31f1['mandatoryDisposition']=_0xa5f427[_0x44ec('0x56')];}return _0x2f31f1;}exports[_0x44ec('0x57')]=buildObj;exports[_0x44ec('0x58')]=function(_0x477cb1){var _0x203150=[];for(var _0x10deca in _0x477cb1){if(_0x477cb1[_0x44ec('0x26')](_0x10deca)){if(!_[_0x44ec('0x13')](_0x477cb1[_0x10deca])&&_0x477cb1[_0x10deca][_0x44ec('0x2a')]===_0x44ec('0x59')&&_0x477cb1[_0x10deca][_0x44ec('0x5a')]==='reachable'){_0x203150[_0x44ec('0x5b')](_0x477cb1[_0x10deca]['id']);}}}return _0x203150;};exports[_0x44ec('0x5c')]=function(_0x5399d3){var _0x218e36=moment()[_0x44ec('0x5d')](0x0);var _0x35357a=moment(_0x5399d3)[_0x44ec('0x5d')](0x0);return _0x218e36['diff'](_0x35357a,'seconds');};exports['createBody']=function(_0x212088){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x212088[_0x44ec('0x16')],'ListId':_0x212088[_0x44ec('0x4c')],'VoiceQueueId':_0x212088[_0x44ec('0x18')]||undefined,'CampaignId':_0x212088[_0x44ec('0x5e')]||undefined};};exports[_0x44ec('0x5f')]=function(_0x569b81){if(_0x569b81==='uniqueid'||_0x569b81===_0x44ec('0x60')||_0x569b81===_0x44ec('0x54')||_0x569b81===_0x44ec('0x61')||_0x569b81==='campaigntype'||_0x569b81===_0x44ec('0x62')||_0x569b81===_0x44ec('0x33')||_0x569b81===_0x44ec('0x63')||_0x569b81===_0x44ec('0x3c')||_0x569b81==='active'||_0x569b81===_0x44ec('0x40')||_0x569b81==='scheduledat'||_0x569b81===_0x44ec('0x42')||_0x569b81===_0x44ec('0x43')||_0x569b81===_0x44ec('0x64')||_0x569b81==='countglobal'||_0x569b81===_0x44ec('0x65')||_0x569b81===_0x44ec('0x66')||_0x569b81==='callbackat'||_0x569b81===_0x44ec('0x67')||_0x569b81===_0x44ec('0x16')||_0x569b81==='ListId'||_0x569b81===_0x44ec('0x34')||_0x569b81===_0x44ec('0x18')||_0x569b81===_0x44ec('0x68')||_0x569b81==='xmd-voicequeueid'||_0x569b81===_0x44ec('0x69')||_0x569b81===_0x44ec('0x6a')||_0x569b81===_0x44ec('0x6b')||_0x569b81==='xmd-dialurl'||_0x569b81==='xmd-dialtimeout'||_0x569b81===_0x44ec('0x6c')||_0x569b81===_0x44ec('0x6d')||_0x569b81===_0x44ec('0x6e')||_0x569b81===_0x44ec('0x6f')||_0x569b81===_0x44ec('0x70')||_0x569b81===_0x44ec('0x71')||_0x569b81===_0x44ec('0x72')||_0x569b81===_0x44ec('0x73')||_0x569b81===_0x44ec('0x74')||_0x569b81===_0x44ec('0x75')||_0x569b81===_0x44ec('0x76')||_0x569b81===_0x44ec('0x77')||_0x569b81===_0x44ec('0x78')||_0x569b81===_0x44ec('0x79')||_0x569b81==='rtpaudioqosrtt'||_0x569b81==='rtpaudioqosrttbridged'||_0x569b81==='rtpaudioqos'||_0x569b81===_0x44ec('0x75')||_0x569b81===_0x44ec('0x76')||_0x569b81===_0x44ec('0x77')||_0x569b81===_0x44ec('0x78')||_0x569b81===_0x44ec('0x79')||_0x569b81===_0x44ec('0x7a')||_0x569b81===_0x44ec('0x7b')||_0x569b81===_0x44ec('0x7c')||_0x569b81===_0x44ec('0x7d')||_0x569b81===_0x44ec('0x2a')||_0x569b81==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x345f41,_0x93665d){var _0x237e17,_0x4698fa,_0x20b33e;if(_0x93665d<=0x0){_0x93665d=0x1;}_0x237e17=new RegExp('\x5cw{0,'+_0x93665d+'}$');_0x4698fa=Math[_0x44ec('0x7e')](0xa,_0x93665d-0x1);_0x20b33e=Math['pow'](0xa,_0x93665d)-0x1;return util['format']('%s',_[_0x44ec('0x7f')](_0x345f41,_0x237e17,_[_0x44ec('0x80')](_0x4698fa,_0x20b33e)));};exports['extractCalleridName']=function(_0x24562a){var _0x164d21=_0x24562a[_0x44ec('0x81')](/"(.*?)"/);return _0x164d21?_0x164d21[0x1]:_0x24562a;};exports[_0x44ec('0x82')]=function(_0x62c8bb){var _0x40e218=_0x62c8bb[_0x44ec('0x81')](/<(.*?)>/);return _0x40e218?_0x40e218[0x1]:_0x62c8bb;};function buildNoAnswerEventPayload(_0x3c67d5,_0x1316c8){var _0x401f7b=buildObj(_0x3c67d5,'noanswer');if(!_[_0x44ec('0xe')](_0x1316c8[_0x44ec('0x83')])){Object[_0x44ec('0x84')](_0x1316c8[_0x44ec('0x83')])[_0x44ec('0x85')](function(_0x290ba3){_0x401f7b[_0x290ba3[_0x44ec('0x86')]()]=_0x1316c8['variables'][_0x290ba3];});}return _0x401f7b;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x5c75=['countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','[decrementTalking]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','name','queue','interface','voice','agentReadyId','hasOwnProperty','not_inuse','status','milliseconds','diff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','logger','inspect','info','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','format','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','logBlacklist','statedesc','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','ringtime','getSeconds','starttime','UserId','logCustomer','endtime','talktime','answertime','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal'];(function(_0x103a69,_0x501d27){var _0x226215=function(_0x121b67){while(--_0x121b67){_0x103a69['push'](_0x103a69['shift']());}};_0x226215(++_0x501d27);}(_0x5c75,0xca));var _0x55c7=function(_0x221d0f,_0x37c51d){_0x221d0f=_0x221d0f-0x0;var _0x178f23=_0x5c75[_0x221d0f];return _0x178f23;};'use strict';var util=require(_0x55c7('0x0'));var _=require(_0x55c7('0x1'));var moment=require(_0x55c7('0x2'));var logger=require('../../../../config/logger')(_0x55c7('0x3'));var ipAgi=process[_0x55c7('0x4')][_0x55c7('0x5')]||_0x55c7('0x6');var utils=require(_0x55c7('0x7'));exports['loggerCatch']=function(_0x4e9c63){return function(_0xac4bb3){logger[_0x55c7('0x8')](_0x4e9c63,util['inspect'](_0xac4bb3,{'showHidden':![],'depth':null}));};};exports[_0x55c7('0x9')]=function(_0x33bed7,_0x477df4){logger['info'](_0x33bed7,util[_0x55c7('0xa')](_0x477df4,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3d8d08,_0x34100f){logger[_0x55c7('0x8')](_0x3d8d08,util['inspect'](_0x34100f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x11530d){return function(_0x43ec9e){logger[_0x55c7('0xb')](_0x11530d,util['inspect'](_0x43ec9e,{'showHidden':![],'depth':null}));};};exports[_0x55c7('0xc')]=function(_0x4b83bb,_0x335cad,_0x48ff04){return{'message':_0x4b83bb,'unlock':_0x335cad,'active':_0x48ff04};};exports[_0x55c7('0xd')]=function(_0x1711c2,_0x5f56fe,_0x491eb5){if(!_[_0x55c7('0xe')](_0x491eb5)&&_0x55c7('0xf')===typeof _0x491eb5&&!_[_0x55c7('0x10')](_0x491eb5)){if(!_[_0x55c7('0xe')](_0x5f56fe)&&'string'===typeof _0x5f56fe&&!_['isEmpty'](_0x5f56fe)){return util['format']('\x22%s\x22\x20<%s>',_0x5f56fe,_0x491eb5);}return util['format'](_0x55c7('0x11'),_0x491eb5,_0x491eb5);}if(!_['isUndefined'](_0x1711c2)&&_0x55c7('0xf')===typeof _0x1711c2&&!_[_0x55c7('0x10')](_0x1711c2)){return _0x1711c2;}return'\x22\x22\x20<>';};exports[_0x55c7('0x12')]=function(_0x37d9f8){if(_[_0x55c7('0x13')](_0x37d9f8)){return![];}return _0x37d9f8;};exports[_0x55c7('0x14')]=function(_0x49a844,_0x427c86,_0x280f52,_0x42ee3d,_0x2abb73,_0x16068a){var _0x226f5b={'XMD-QUEUE':_0x427c86[_0x55c7('0x15')]?_0x427c86['Queue']['name']:'','XMD-CALLERID':_0x42ee3d,'XMD-CALLERID-PREVIEW':_0x16068a?util[_0x55c7('0x16')](_0x55c7('0x11'),_0x16068a[_0x55c7('0x17')],_0x16068a[_0x55c7('0x18')]):_0x42ee3d,'XMD-DIALID':_0x2abb73,'XMD-CONTACTID':_0x427c86[_0x55c7('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x42ee3d,'XMD-VOICEQUEUEID':_0x427c86[_0x55c7('0x1a')],'XMD-DIALCHANNEL':_0x280f52,'XMD-DIALTIMEOUT':_0x49a844[_0x55c7('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x55c7('0x16')](_0x55c7('0x1c'),_0x49a844[_0x55c7('0x1d')]?'g':'',_[_0x55c7('0x10')](_0x49a844[_0x55c7('0x1e')])?'':_0x55c7('0x1f')),'XMD-DIALURL':_0x49a844[_0x55c7('0x20')]||'','XMD-AGI':_0x49a844[_0x55c7('0x21')]?util[_0x55c7('0x16')]('\x22agi://%s/square,%s\x22',ipAgi,_0x49a844[_0x55c7('0x21')]):_0x55c7('0x22'),'XMD-AGIAFTER':_0x49a844[_0x55c7('0x1d')]?util['format'](_0x55c7('0x23'),ipAgi,_0x49a844[_0x55c7('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x16068a?_0x16068a[_0x55c7('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x16068a?_0x16068a[_0x55c7('0x25')]:'','XMD-DESTINATION':_0x55c7('0x26'),'SIPADDHEADER':_0x55c7('0x27')};if(!_[_0x55c7('0x10')](_0x49a844[_0x55c7('0x1e')])){_0x226f5b[util[_0x55c7('0x16')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x49a844['monitor_format'];_0x226f5b[util[_0x55c7('0x16')]('%s',_0x55c7('0x28'))]=_0x2abb73;}return _0x226f5b;};exports[_0x55c7('0x29')]=function(_0x406a1b){var _0x30ed5c={};for(var _0x2c2404 in _0x406a1b){if(_0x406a1b['hasOwnProperty'](_0x2c2404)){_0x30ed5c[util[_0x55c7('0x16')]('%s',_[_0x55c7('0x2a')](_0x2c2404))]=_0x406a1b[_0x2c2404];}}return{'variables':_0x30ed5c};};exports[_0x55c7('0x2b')]=function(_0x21b5f1){var _0x32f14a=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x21b5f1['state']=0xd;_0x21b5f1[_0x55c7('0x2c')]='Blacklist';_0x21b5f1['starttime']=_0x32f14a;_0x21b5f1[_0x55c7('0x2d')]=_0x32f14a;_0x21b5f1['endtime']=_0x32f14a;};exports[_0x55c7('0x2e')]=function(_0x2d1e26,_0x2f7ce6,_0x27189e){var _0x186d0c=moment()['format'](_0x55c7('0x2f'));_0x2d1e26[_0x55c7('0x30')]=_0x2f7ce6;_0x2d1e26[_0x55c7('0x2c')]=_0x27189e;_0x2d1e26[_0x55c7('0x2d')]=_0x186d0c;_0x2d1e26[_0x55c7('0x31')]=utils[_0x55c7('0x32')](_0x2d1e26[_0x55c7('0x2d')],_0x2d1e26[_0x55c7('0x33')]);};exports['logLookAgent']=function(_0x4f3502,_0x1af083,_0x46539b){_0x4f3502['membername']=_0x1af083;_0x4f3502[_0x55c7('0x34')]=_0x46539b;};exports[_0x55c7('0x35')]=function(_0x31db03,_0x3f593b,_0x126aab){var _0x3d2f9d=moment()['format'](_0x55c7('0x2f'));_0x31db03[_0x55c7('0x30')]=_0x3f593b;_0x31db03[_0x55c7('0x2c')]=_0x126aab;_0x31db03[_0x55c7('0x2d')]=_0x31db03[_0x55c7('0x2d')]?_0x31db03[_0x55c7('0x2d')]:_0x3d2f9d;_0x31db03['endtime']=_0x31db03['endtime']?_0x31db03[_0x55c7('0x36')]:_0x3d2f9d;_0x31db03[_0x55c7('0x31')]=utils[_0x55c7('0x32')](_0x31db03['responsetime']||0x0,_0x31db03[_0x55c7('0x33')]||0x0);_0x31db03[_0x55c7('0x37')]=_0x31db03[_0x55c7('0x38')]?utils['getSeconds'](_0x31db03[_0x55c7('0x36')],_0x31db03['answertime']):0x0;};exports['isFailure']=function(_0x269654){return _0x269654==='Failure';};exports[_0x55c7('0x39')]=function(_0x4a4f34,_0x5674fd,_0x1383d4,_0x28bb90,_0x406d72){var _0x14b8ad=_0x28bb90?_0x55c7('0x3a'):_0x4a4f34['calleridname'];_0x14b8ad=_0x406d72?_0x55c7('0x3b'):_0x14b8ad;return{'actionid':_0x4a4f34[_0x55c7('0x3c')],'action':_0x55c7('0x3d'),'channel':_0x4a4f34[_0x55c7('0x3e')],'callerid':util[_0x55c7('0x16')](_0x55c7('0x11'),_0x14b8ad,_0x4a4f34[_0x55c7('0x18')]),'Exten':'xcally-motion-preview','Context':_0x55c7('0x3f'),'Priority':'1','variable':_0x1383d4,'timeout':(_0x5674fd[_0x55c7('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4a4f34[_0x55c7('0x3c')]};};exports[_0x55c7('0x41')]=function(_0x23e7c5){return _0x23e7c5[_0x55c7('0x42')]+_0x23e7c5[_0x55c7('0x43')]+_0x23e7c5[_0x55c7('0x44')]+_0x23e7c5[_0x55c7('0x45')]+_0x23e7c5[_0x55c7('0x46')];};exports[_0x55c7('0x47')]=function(_0x31d0b7){var _0x56f474=_[_0x55c7('0x48')](_0x31d0b7);_0x56f474['state']=0xf;_0x56f474[_0x55c7('0x2c')]=_0x55c7('0x49');return _0x56f474;};exports[_0x55c7('0x4a')]=function(_0x3e4cc5,_0x68d1f7,_0x5bb6e2){var _0x40f3f7={};_0x40f3f7[_0x68d1f7]=_0x3e4cc5[_0x68d1f7];_0x40f3f7[_0x55c7('0x4b')]=![];_0x40f3f7[_0x55c7('0x4c')]=moment()['add'](_0x5bb6e2,_0x55c7('0x4d'))[_0x55c7('0x16')](_0x55c7('0x2f'));_0x40f3f7[_0x55c7('0x19')]=_0x3e4cc5[_0x55c7('0x19')];_0x40f3f7[_0x55c7('0x4e')]=_0x3e4cc5[_0x55c7('0x4e')];_0x40f3f7[_0x55c7('0x1a')]=_0x3e4cc5[_0x55c7('0x1a')]||undefined;return _0x40f3f7;};exports['decrementTalking']=function(_0x54f14e,_0x135900){if(!_[_0x55c7('0x13')](_0x54f14e)){if(_0x54f14e['pTalking']>0x0){_0x54f14e['pTalking']-=0x1;}else{logger[_0x55c7('0xb')](_0x135900,_0x55c7('0x4f'));}}else{logger[_0x55c7('0x8')](_0x135900,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports[_0x55c7('0x50')]=function(_0x348a0c){if(_0x348a0c<=0x0){return!![];}return![];};function buildObj(_0x4e92d6,_0x453f21,_0x243dd2){_0x4e92d6['lastevent']=_0x453f21;_0x4e92d6[_0x55c7('0x51')]=_0x4e92d6[_0x55c7('0x52')];_0x4e92d6[_0x55c7('0x53')]=_0x4e92d6[_0x55c7('0x3e')];_0x4e92d6['motionChannel']=_0x55c7('0x54');if(_0x243dd2){_0x4e92d6['mandatoryDisposition']=_0x243dd2['mandatoryDisposition'];}return _0x4e92d6;}exports['buildObj']=buildObj;exports[_0x55c7('0x55')]=function(_0x1f5d7c){var _0x4deab2=[];for(var _0x19388b in _0x1f5d7c){if(_0x1f5d7c[_0x55c7('0x56')](_0x19388b)){if(!_[_0x55c7('0x13')](_0x1f5d7c[_0x19388b])&&_0x1f5d7c[_0x19388b][_0x55c7('0x30')]===_0x55c7('0x57')&&_0x1f5d7c[_0x19388b][_0x55c7('0x58')]==='reachable'){_0x4deab2['push'](_0x1f5d7c[_0x19388b]['id']);}}}return _0x4deab2;};exports['getDiff']=function(_0x56b14e){var _0x547095=moment()[_0x55c7('0x59')](0x0);var _0x2121d0=moment(_0x56b14e)[_0x55c7('0x59')](0x0);return _0x547095[_0x55c7('0x5a')](_0x2121d0,'seconds');};exports[_0x55c7('0x5b')]=function(_0x353ef8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x353ef8[_0x55c7('0x19')],'ListId':_0x353ef8['ListId'],'VoiceQueueId':_0x353ef8[_0x55c7('0x1a')]||undefined,'CampaignId':_0x353ef8[_0x55c7('0x5c')]||undefined};};exports[_0x55c7('0x5d')]=function(_0x4a48f4){if(_0x4a48f4===_0x55c7('0x3c')||_0x4a48f4===_0x55c7('0x5e')||_0x4a48f4===_0x55c7('0x52')||_0x4a48f4==='type'||_0x4a48f4===_0x55c7('0x5f')||_0x4a48f4===_0x55c7('0x60')||_0x4a48f4===_0x55c7('0x61')||_0x4a48f4===_0x55c7('0x3e')||_0x4a48f4===_0x55c7('0x17')||_0x4a48f4===_0x55c7('0x4b')||_0x4a48f4===_0x55c7('0x18')||_0x4a48f4===_0x55c7('0x4c')||_0x4a48f4===_0x55c7('0x42')||_0x4a48f4===_0x55c7('0x43')||_0x4a48f4===_0x55c7('0x44')||_0x4a48f4===_0x55c7('0x62')||_0x4a48f4===_0x55c7('0x63')||_0x4a48f4===_0x55c7('0x64')||_0x4a48f4===_0x55c7('0x65')||_0x4a48f4===_0x55c7('0x66')||_0x4a48f4===_0x55c7('0x19')||_0x4a48f4===_0x55c7('0x4e')||_0x4a48f4===_0x55c7('0x34')||_0x4a48f4===_0x55c7('0x1a')||_0x4a48f4===_0x55c7('0x67')||_0x4a48f4===_0x55c7('0x68')||_0x4a48f4===_0x55c7('0x69')||_0x4a48f4===_0x55c7('0x6a')||_0x4a48f4==='xmd-listid'||_0x4a48f4==='xmd-dialurl'||_0x4a48f4===_0x55c7('0x6b')||_0x4a48f4==='xmd-dialoptions'||_0x4a48f4===_0x55c7('0x6c')||_0x4a48f4===_0x55c7('0x6d')||_0x4a48f4===_0x55c7('0x6e')||_0x4a48f4==='xmd-cdrtype'||_0x4a48f4===_0x55c7('0x6f')||_0x4a48f4===_0x55c7('0x70')||_0x4a48f4===_0x55c7('0x71')||_0x4a48f4===_0x55c7('0x72')||_0x4a48f4==='rtpaudioqosbridged'||_0x4a48f4===_0x55c7('0x73')||_0x4a48f4===_0x55c7('0x74')||_0x4a48f4==='rtpaudioqosloss'||_0x4a48f4===_0x55c7('0x75')||_0x4a48f4==='rtpaudioqosrtt'||_0x4a48f4===_0x55c7('0x76')||_0x4a48f4===_0x55c7('0x72')||_0x4a48f4===_0x55c7('0x77')||_0x4a48f4===_0x55c7('0x73')||_0x4a48f4==='rtpaudioqosjitterbridged'||_0x4a48f4===_0x55c7('0x78')||_0x4a48f4===_0x55c7('0x75')||_0x4a48f4===_0x55c7('0x79')||_0x4a48f4===_0x55c7('0x76')||_0x4a48f4===_0x55c7('0x7a')||_0x4a48f4===_0x55c7('0x7b')||_0x4a48f4===_0x55c7('0x30')||_0x4a48f4===_0x55c7('0x2c')){return![];}return!![];};exports[_0x55c7('0x7c')]=function(_0x18be43,_0x57bd98){var _0x4d7d9e,_0x51eb8f,_0x1e4fba;if(_0x57bd98<=0x0){_0x57bd98=0x1;}_0x4d7d9e=new RegExp('\x5cw{0,'+_0x57bd98+'}$');_0x51eb8f=Math[_0x55c7('0x7d')](0xa,_0x57bd98-0x1);_0x1e4fba=Math['pow'](0xa,_0x57bd98)-0x1;return util[_0x55c7('0x16')]('%s',_[_0x55c7('0x7e')](_0x18be43,_0x4d7d9e,_[_0x55c7('0x7f')](_0x51eb8f,_0x1e4fba)));};exports[_0x55c7('0x80')]=function(_0x69ea01){var _0x3a1c79=_0x69ea01[_0x55c7('0x81')](/"(.*?)"/);return _0x3a1c79?_0x3a1c79[0x1]:_0x69ea01;};exports[_0x55c7('0x82')]=function(_0x5be467){var _0x9b83e7=_0x5be467[_0x55c7('0x81')](/<(.*?)>/);return _0x9b83e7?_0x9b83e7[0x1]:_0x5be467;};function buildNoAnswerEventPayload(_0x3d255f,_0xc0ec1c){var _0x32c38e=buildObj(_0x3d255f,'noanswer');if(!_[_0x55c7('0x10')](_0xc0ec1c[_0x55c7('0x83')])){Object[_0x55c7('0x84')](_0xc0ec1c['variables'])[_0x55c7('0x85')](function(_0x34ac50){_0x32c38e[_0x34ac50['toLowerCase']()]=_0xc0ec1c['variables'][_0x34ac50];});}return _0x32c38e;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2a27274..a0b2281 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 _0x85bc=['voicequeuechannelredirect','queueadd','string','boolean','queuepause','voicequeuechannelhangup'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85bc,0x1cf));var _0xc85b=function(_0x686b80,_0x409cf7){_0x686b80=_0x686b80-0x0;var _0x2f4f5a=_0x85bc[_0x686b80];return _0x2f4f5a;};'use strict';exports[_0xc85b('0x0')]={'queue':{'type':_0xc85b('0x1'),'required':!![]},'interface':{'type':_0xc85b('0x1'),'required':!![]},'membername':{'type':_0xc85b('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xc85b('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0xc85b('0x1'),'required':!![]},'interface':{'type':_0xc85b('0x1'),'required':!![]}};exports[_0xc85b('0x3')]={'interface':{'type':_0xc85b('0x1'),'required':!![]},'paused':{'type':_0xc85b('0x2')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0xc85b('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xc85b('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0xc85b('0x1')},'mixmonitorid':{'type':_0xc85b('0x1')}};exports[_0xc85b('0x4')]={'uniqueid':{'type':_0xc85b('0x1'),'required':!![]}};exports[_0xc85b('0x5')]={'uniqueid':{'type':_0xc85b('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xc85b('0x1')}}; \ No newline at end of file +var _0xd660=['voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','reload','voicequeuechannelhangup'];(function(_0x2d9070,_0x4f5203){var _0x128fd8=function(_0x5ad94a){while(--_0x5ad94a){_0x2d9070['push'](_0x2d9070['shift']());}};_0x128fd8(++_0x4f5203);}(_0xd660,0x1a1));var _0x0d66=function(_0x21f9fc,_0x33b8f2){_0x21f9fc=_0x21f9fc-0x0;var _0x1b5af9=_0xd660[_0x21f9fc];return _0x1b5af9;};'use strict';exports[_0x0d66('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0d66('0x1'),'required':!![]},'membername':{'type':_0x0d66('0x1'),'required':!![]},'penalty':{'type':_0x0d66('0x2'),'required':![]},'paused':{'type':_0x0d66('0x3'),'required':![]}};exports[_0x0d66('0x4')]={'queue':{'type':_0x0d66('0x1'),'required':!![]},'interface':{'type':_0x0d66('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x0d66('0x1'),'required':!![]},'paused':{'type':_0x0d66('0x3')},'reason':{'type':_0x0d66('0x1'),'required':![]}};exports[_0x0d66('0x5')]={'module':{'type':_0x0d66('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x0d66('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x0d66('0x1')},'format':{'type':_0x0d66('0x1')},'mixmonitorid':{'type':_0x0d66('0x1')}};exports[_0x0d66('0x6')]={'uniqueid':{'type':_0x0d66('0x1'),'required':!![]}};exports[_0x0d66('0x7')]={'uniqueid':{'type':_0x0d66('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x0d66('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index c87c5e7..279af7f 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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x3a5a1b,_0x10bdb4){var _0x2dc088=function(_0x3d4fae){while(--_0x3d4fae){_0x3a5a1b['push'](_0x3a5a1b['shift']());}};_0x2dc088(++_0x10bdb4);}(_0xadb5,0xad));var _0x5adb=function(_0x2425d0,_0x3ab608){_0x2425d0=_0x2425d0-0x0;var _0x78e494=_0xadb5[_0x2425d0];return _0x78e494;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0xe6654c,_0x224e7f){var _0x5a7a6d=function(_0x5a8884){while(--_0x5a8884){_0xe6654c['push'](_0xe6654c['shift']());}};_0x5a7a6d(++_0x224e7f);}(_0x757a,0xde));var _0xa757=function(_0x1a0e94,_0x5b8aea){_0x1a0e94=_0x1a0e94-0x0;var _0x4fc072=_0x757a[_0x1a0e94];return _0x4fc072;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 6937a39..6724a71 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45e4=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x17b7b7,_0x357eab){var _0x1451b0=function(_0x26a29a){while(--_0x26a29a){_0x17b7b7['push'](_0x17b7b7['shift']());}};_0x1451b0(++_0x357eab);}(_0x45e4,0x157));var _0x445e=function(_0x273efe,_0x1af253){_0x273efe=_0x273efe-0x0;var _0x163b9e=_0x45e4[_0x273efe];return _0x163b9e;};'use strict';function mergeDBDataToRealtime(_0x65bf69,_0x2dd214){var _0x23050f=Object[_0x445e('0x0')]({},_0x65bf69);for(var _0x21a930 in _0x2dd214){if(_0x23050f[_0x445e('0x1')](_0x21a930)){_0x23050f[_0x21a930]=_0x2dd214[_0x21a930];}}return _0x23050f;}exports[_0x445e('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x609c=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x2a6b55,_0x572485){var _0x3dd7fd=function(_0x52837f){while(--_0x52837f){_0x2a6b55['push'](_0x2a6b55['shift']());}};_0x3dd7fd(++_0x572485);}(_0x609c,0x151));var _0xc609=function(_0x2863d9,_0x333a1e){_0x2863d9=_0x2863d9-0x0;var _0x5055f0=_0x609c[_0x2863d9];return _0x5055f0;};'use strict';function mergeDBDataToRealtime(_0x435a7b,_0xe062d2){var _0x46077c=Object[_0xc609('0x0')]({},_0x435a7b);for(var _0x1a16d1 in _0xe062d2){if(_0x46077c[_0xc609('0x1')](_0x1a16d1)){_0x46077c[_0x1a16d1]=_0xe062d2[_0x1a16d1];}}return _0x46077c;}exports[_0xc609('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 57eea9d..8578e1e 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 _0x7d71=['monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','voiceQueueReport','custom:voiceCallReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','accountcode','name','isNil','find','interface','format','SIP/%s','findAgent','connectedlinenum','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','keys','length','getCallType','channel','split','getAgentByInternal','calleridnum','voiceCallReport','destination','exten','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','calleridname','transfers','linkedid','type','UserId','membername','monitor','monitors'];(function(_0x11dd5a,_0x3e56c0){var _0x27e002=function(_0x46e90f){while(--_0x46e90f){_0x11dd5a['push'](_0x11dd5a['shift']());}};_0x27e002(++_0x3e56c0);}(_0x7d71,0x17f));var _0x17d7=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7d71[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x17d7('0x0'));var moment=require(_0x17d7('0x1'));var util=require(_0x17d7('0x2'));var config=require(_0x17d7('0x3'));var ami=require(_0x17d7('0x4'));var RpcVoiceAgentReport=require(_0x17d7('0x5'));var RpcVoiceCallReport=require(_0x17d7('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x17d7('0x7'));var RpcVoiceQueueReport=require(_0x17d7('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x17d7('0x9'));var VoiceQueueReport=require(_0x17d7('0xa'));var VoiceCallReport=require(_0x17d7('0xb'));var VoiceAgentReport=require(_0x17d7('0xc'));var VoiceDialReport=require(_0x17d7('0xd'));var UserReport=require(_0x17d7('0xe'));function Report(_0x14d139){this['realtime']=_0x14d139;this[_0x17d7('0xf')]=_0x14d139[_0x17d7('0xf')];this[_0x17d7('0x10')]=_0x14d139[_0x17d7('0x10')];}Report[_0x17d7('0x11')][_0x17d7('0x12')]=function(_0x3e1af4){var _0x5de626=new VoiceQueueReport(this[_0x17d7('0x13')]);var _0x2e2a80=new VoiceAgentReport(this[_0x17d7('0x13')]);var _0x49d6ed=new VoiceDialReport(this[_0x17d7('0x13')]);var _0x1cb77c=new VoiceCallReport(this[_0x17d7('0x13')]);var _0x1f03ff=new UserReport(this['realtime']);if(config[_0x17d7('0x14')]&&config['xdr']['disabled']){ami['on']('custom:voiceQueueReport',this[_0x17d7('0x15')]['bind'](this));ami['on'](_0x17d7('0x16'),this['voiceCallReport']['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x17d7('0x17')][_0x17d7('0x18')](this));ami['on'](_0x17d7('0x19'),this[_0x17d7('0x1a')][_0x17d7('0x18')](this));ami['on'](_0x17d7('0x1b'),this[_0x17d7('0x1c')]['bind'](this));ami['on']('attendedtransfer',this[_0x17d7('0x1d')][_0x17d7('0x18')](this));}};Report[_0x17d7('0x11')]['findAgent']=function(_0xa3baa7){var _0x554638;_0x554638=_['find'](this[_0x17d7('0xf')],function(_0x59b71c){return _0x59b71c[_0x17d7('0x1e')]==_0xa3baa7||_0x59b71c[_0x17d7('0x1f')]==_0xa3baa7;});if(_[_0x17d7('0x20')](_0x554638)){var _0x509c1e=_[_0x17d7('0x21')](this[_0x17d7('0x10')],function(_0x11d8ec){return _0x11d8ec[_0x17d7('0x1e')]==_0xa3baa7||_0x11d8ec['name']==_0xa3baa7;});if(_0x509c1e){_0x554638=_[_0x17d7('0x21')](this[_0x17d7('0xf')],function(_0x17da1f){return _0x17da1f[_0x17d7('0x22')]==util[_0x17d7('0x23')](_0x17d7('0x24'),_0x509c1e['name']);});}}return _0x554638;};Report[_0x17d7('0x11')]['voiceQueueReport']=function(_0x3cd16c){for(var _0x36fc76=0x0;_0x36fc76<_0x3cd16c['length'];_0x36fc76+=0x1){var _0x59cafa=this[_0x17d7('0x25')](_0x3cd16c[_0x36fc76][_0x17d7('0x26')]);if(_0x59cafa){_0x3cd16c[_0x36fc76][_0x17d7('0x1e')]=_0x59cafa[_0x17d7('0x1e')];_0x3cd16c[_0x36fc76]['assigned']=!![];_0x3cd16c[_0x36fc76]['lastAssignedTo']=_0x59cafa[_0x17d7('0x1f')];_0x3cd16c[_0x36fc76][_0x17d7('0x22')]=_[_0x17d7('0x20')](_0x59cafa['interface'])?util[_0x17d7('0x23')]('SIP/%s',_0x59cafa[_0x17d7('0x1f')]):_0x59cafa[_0x17d7('0x22')];if(_0x3cd16c[_0x36fc76][_0x17d7('0x27')]){_0x3cd16c[_0x36fc76][_0x17d7('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3cd16c[_0x36fc76][_0x17d7('0x29')]){_0x3cd16c[_0x36fc76][_0x17d7('0x2a')]=moment()['format'](_0x17d7('0x2b'));}RpcMemberReport[_0x17d7('0x15')](_0x3cd16c[_0x36fc76]);}RpcVoiceQueueReport[_0x17d7('0x2c')](_0x3cd16c[_0x36fc76]);}};function extractCalleridNumber(_0x58455b){var _0x5422f0=_0x58455b[_0x17d7('0x2d')](/<(.*?)>/);return _0x5422f0?_0x5422f0[0x1]:_0x58455b;}Report['prototype']['getAgentByInternal']=function(_0x2e6e8c){for(var _0x2142dd=0x0;_0x2142dd',_0x172dfe[_0x17d7('0x45')],_0x172dfe[_0x17d7('0x34')]);}if(RpcVoiceTransferReport[_0x17d7('0x46')][_0x172dfe['linkedid']]){var _0x8fddd=RpcVoiceTransferReport[_0x17d7('0x46')][_0x172dfe[_0x17d7('0x47')]];_0x8fddd['transfereelinkedid']=_0x172dfe['uniqueid'];RpcVoiceTransferReport[_0x17d7('0x1c')](_0x8fddd);delete RpcVoiceTransferReport[_0x17d7('0x46')][_0x172dfe[_0x17d7('0x47')]];}if(_['isNil'](_0x172dfe['type'])){_0x172dfe[_0x17d7('0x48')]=this[_0x17d7('0x30')](_0x172dfe);}if(_[_0x17d7('0x20')](_0x172dfe[_0x17d7('0x49')])){var _0x56953c=_0x172dfe[_0x17d7('0x31')][_0x17d7('0x32')]('-')[0x0];var _0x1d38aa=this[_0x17d7('0xf')][_0x56953c];if(!_0x1d38aa)_0x1d38aa=this[_0x17d7('0x33')](_0x172dfe[_0x17d7('0x1e')]);if(_0x1d38aa){_0x172dfe['UserId']=_0x1d38aa['id'];_0x172dfe[_0x17d7('0x4a')]=_0x1d38aa[_0x17d7('0x1f')];}}RpcVoiceCallReport[_0x17d7('0x2c')](_0x172dfe);if(_0x172dfe[_0x17d7('0x4b')]){for(var _0x4f1ead=0x0;_0x4f1ead<_0x172dfe[_0x17d7('0x4c')][_0x17d7('0x2f')];_0x4f1ead+=0x1){_0x172dfe[_0x17d7('0x4d')]=_0x172dfe[_0x17d7('0x4c')][_0x4f1ead][_0x17d7('0x4e')];_0x172dfe[_0x17d7('0x4f')]=_0x172dfe[_0x17d7('0x4c')][_0x4f1ead][_0x17d7('0x4f')];if(_0x172dfe['exten']==_0x17d7('0x3f')){_0x172dfe[_0x17d7('0x34')]=_0x172dfe[_0x17d7('0x26')];_0x172dfe['calleridname']=_0x172dfe['connectedlinename'];_0x172dfe[_0x17d7('0x26')]=_0x172dfe[_0x17d7('0x1e')];_0x172dfe[_0x17d7('0x50')]=_0x172dfe[_0x17d7('0x4a')];_0x172dfe[_0x17d7('0x37')]=_0x172dfe[_0x17d7('0x40')];}else if(_0x172dfe['exten']==_0x17d7('0x51')){_0x172dfe[_0x17d7('0x34')]=_0x172dfe[_0x17d7('0x36')];_0x172dfe['exten']=_0x172dfe[_0x17d7('0x40')];}RpcVoiceRecording[_0x17d7('0x2c')](_0x172dfe);}}};Report[_0x17d7('0x11')]['voiceAgentReport']=function(_0x223f0f){if(_[_0x17d7('0x52')](_0x223f0f)){_0x223f0f[_0x17d7('0x53')](function(_0x131421){RpcVoiceAgentReport[_0x17d7('0x2c')](_0x131421);});}else{RpcVoiceAgentReport['create'](_0x223f0f);}};Report[_0x17d7('0x11')][_0x17d7('0x1a')]=function(_0x3c0f47){RpcVoiceDialReport[_0x17d7('0x2c')](_0x3c0f47);var _0x20b3e9;var _0x136e2b;var _0xf7c3be=_0x3c0f47[_0x17d7('0x31')];if(_[_0x17d7('0x54')](_0xf7c3be,_0x17d7('0x55'))){_0x136e2b=_0xf7c3be[_0x17d7('0x56')](_0xf7c3be['indexOf']('/')+0x1,_0xf7c3be[_0x17d7('0x57')]('@'));_0x20b3e9=_['find'](this['agents'],function(_0x460747){return _0x460747[_0x17d7('0x58')]==_0x136e2b||_0x460747[_0x17d7('0x59')]==_0x136e2b||_0x460747['accountcode']==_0x136e2b;});}else{_0x136e2b=_0xf7c3be[_0x17d7('0x56')](_0xf7c3be[_0x17d7('0x57')]('/')+0x1,_0xf7c3be['lastIndexOf']('-'));_0x20b3e9=this[_0x17d7('0x25')](_0x136e2b);}if(_0x20b3e9){_0x3c0f47['interface']=_[_0x17d7('0x20')](_0x20b3e9[_0x17d7('0x22')])?util[_0x17d7('0x23')]('SIP/%s',_0x20b3e9['name']):_0x20b3e9[_0x17d7('0x22')];_0x3c0f47[_0x17d7('0x4a')]=_0x20b3e9[_0x17d7('0x1f')];_0x3c0f47[_0x17d7('0x1e')]=_0x20b3e9[_0x17d7('0x1e')];RpcMemberReport['voiceDialReport'](_0x3c0f47);}};Report[_0x17d7('0x11')][_0x17d7('0x1c')]=function(_0x25b616){RpcVoiceTransferReport[_0x17d7('0x46')][_0x25b616[_0x17d7('0x5a')]]=_0x25b616;};Report[_0x17d7('0x11')][_0x17d7('0x1d')]=function(_0x18b704){RpcVoiceTransferReport[_0x17d7('0x1d')](_0x18b704);};module[_0x17d7('0x5b')]=Report; \ No newline at end of file +var _0x44fd=['xcally-motion-dialer','forEach','voiceDialReport','Local','substring','indexOf','mobile','lastIndexOf','exports','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','isNil','find','accountcode','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','name','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','voiceCallReport','destination','exten','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','destinationchannel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','blindTransfer','UserId','membername','monitor','monitors','filename','createdAt','calleridname','connectedlinename'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0x44fd,0x123));var _0xd44f=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x44fd[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xd44f('0x0'));var config=require(_0xd44f('0x1'));var ami=require(_0xd44f('0x2'));var RpcVoiceAgentReport=require(_0xd44f('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xd44f('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xd44f('0x5'));var RpcVoiceRecording=require(_0xd44f('0x6'));var RpcVoiceTransferReport=require(_0xd44f('0x7'));var VoiceQueueReport=require(_0xd44f('0x8'));var VoiceCallReport=require(_0xd44f('0x9'));var VoiceAgentReport=require(_0xd44f('0xa'));var VoiceDialReport=require(_0xd44f('0xb'));var UserReport=require(_0xd44f('0xc'));function Report(_0x4e5e68){this[_0xd44f('0xd')]=_0x4e5e68;this[_0xd44f('0xe')]=_0x4e5e68[_0xd44f('0xe')];this['telephones']=_0x4e5e68[_0xd44f('0xf')];}Report[_0xd44f('0x10')]['sync']=function(_0x3a2e7b){var _0x1f6d10=new VoiceQueueReport(this[_0xd44f('0xd')]);var _0x315699=new VoiceAgentReport(this[_0xd44f('0xd')]);var _0x4c2c9f=new VoiceDialReport(this[_0xd44f('0xd')]);var _0x410ceb=new VoiceCallReport(this[_0xd44f('0xd')]);var _0x580196=new UserReport(this[_0xd44f('0xd')]);if(config[_0xd44f('0x11')]&&config[_0xd44f('0x11')][_0xd44f('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xd44f('0x13')][_0xd44f('0x14')](this));ami['on'](_0xd44f('0x15'),this['voiceCallReport']['bind'](this));ami['on'](_0xd44f('0x16'),this[_0xd44f('0x17')][_0xd44f('0x14')](this));ami['on'](_0xd44f('0x18'),this['voiceDialReport'][_0xd44f('0x14')](this));ami['on'](_0xd44f('0x19'),this['blindTransfer']['bind'](this));ami['on'](_0xd44f('0x1a'),this[_0xd44f('0x1b')][_0xd44f('0x14')](this));}};Report[_0xd44f('0x10')][_0xd44f('0x1c')]=function(_0x1ef863){var _0x122c2d;_0x122c2d=_['find'](this['agents'],function(_0x412da9){return _0x412da9['accountcode']==_0x1ef863||_0x412da9['name']==_0x1ef863;});if(_[_0xd44f('0x1d')](_0x122c2d)){var _0x174e55=_[_0xd44f('0x1e')](this[_0xd44f('0xf')],function(_0x28f530){return _0x28f530[_0xd44f('0x1f')]==_0x1ef863||_0x28f530['name']==_0x1ef863;});if(_0x174e55){_0x122c2d=_[_0xd44f('0x1e')](this[_0xd44f('0xe')],function(_0x2f322a){return _0x2f322a['interface']==util[_0xd44f('0x20')](_0xd44f('0x21'),_0x174e55['name']);});}}return _0x122c2d;};Report[_0xd44f('0x10')]['voiceQueueReport']=function(_0x1c7651){for(var _0x204710=0x0;_0x204710<_0x1c7651[_0xd44f('0x22')];_0x204710+=0x1){var _0x43c29c=this['findAgent'](_0x1c7651[_0x204710][_0xd44f('0x23')]);if(_0x43c29c){_0x1c7651[_0x204710]['accountcode']=_0x43c29c[_0xd44f('0x1f')];_0x1c7651[_0x204710][_0xd44f('0x24')]=!![];_0x1c7651[_0x204710][_0xd44f('0x25')]=_0x43c29c['name'];_0x1c7651[_0x204710][_0xd44f('0x26')]=_[_0xd44f('0x1d')](_0x43c29c[_0xd44f('0x26')])?util['format'](_0xd44f('0x21'),_0x43c29c[_0xd44f('0x27')]):_0x43c29c[_0xd44f('0x26')];if(_0x1c7651[_0x204710][_0xd44f('0x28')]){_0x1c7651[_0x204710][_0xd44f('0x29')]=moment()[_0xd44f('0x20')](_0xd44f('0x2a'));}if(_0x1c7651[_0x204710][_0xd44f('0x2b')]){_0x1c7651[_0x204710][_0xd44f('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xd44f('0x13')](_0x1c7651[_0x204710]);}RpcVoiceQueueReport[_0xd44f('0x2d')](_0x1c7651[_0x204710]);}};function extractCalleridNumber(_0x1d6ea2){var _0x551ee8=_0x1d6ea2[_0xd44f('0x2e')](/<(.*?)>/);return _0x551ee8?_0x551ee8[0x1]:_0x1d6ea2;}Report['prototype'][_0xd44f('0x2f')]=function(_0x1047fc){for(var _0x40cb3a=0x0;_0x40cb3a{delete this[_0xf2c8('0x8')][_0x2669b4];},_0x305ef9);}};module[_0xf2c8('0x9a')]=VoiceAgentReport; \ No newline at end of file +var _0x2958=['agentringnoanswerAt','YYYY-MM-DD\x20HH:mm:ss','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','error','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','assign','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','value','variable','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberrealtime','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','channel','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','prototype','emit','isUndefined','isNotNull','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','queue','format','called','mandatoryDisposition','type','event','debug','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','connect','merge','pick','destconnectedlinenum','name','accountcode','custom:agentconnect'];(function(_0x504961,_0x35862a){var _0xdb50bf=function(_0x1e5b06){while(--_0x1e5b06){_0x504961['push'](_0x504961['shift']());}};_0xdb50bf(++_0x35862a);}(_0x2958,0x18c));var _0x8295=function(_0x1847f9,_0x48ea5a){_0x1847f9=_0x1847f9-0x0;var _0x42e560=_0x2958[_0x1847f9];return _0x42e560;};'use strict';var _=require(_0x8295('0x0'));var moment=require(_0x8295('0x1'));var util=require(_0x8295('0x2'));var Redis=require(_0x8295('0x3'));var config=require(_0x8295('0x4'));var logger=require(_0x8295('0x5'))('ami');var ami=require(_0x8295('0x6'));config[_0x8295('0x7')]=_[_0x8295('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0xac45bd){this[_0x8295('0x9')]={};this[_0x8295('0xa')]=_0xac45bd['channels'];this[_0x8295('0xb')]=_0xac45bd[_0x8295('0xb')];this[_0x8295('0xc')]=_0xac45bd['agents'];this[_0x8295('0xd')]={};ami['on'](_0x8295('0xe'),this[_0x8295('0xf')][_0x8295('0x10')](this));ami['on'](_0x8295('0x11'),this[_0x8295('0x12')][_0x8295('0x10')](this));ami['on'](_0x8295('0x13'),this['syncAgentRingNoAnswer'][_0x8295('0x10')](this));ami['on'](_0x8295('0x14'),this[_0x8295('0x15')][_0x8295('0x10')](this));ami['on'](_0x8295('0x16'),this[_0x8295('0x17')]['bind'](this));ami['on']('varset',this[_0x8295('0x18')][_0x8295('0x10')](this));ami['on'](_0x8295('0x19'),this['syncHangup'][_0x8295('0x10')](this));ami['on'](_0x8295('0x1a'),this[_0x8295('0x1b')][_0x8295('0x10')](this));ami['on'](_0x8295('0x1c'),this[_0x8295('0x1d')][_0x8295('0x10')](this));ami['on']('attendedtransfer',this[_0x8295('0x1e')][_0x8295('0x10')](this));ami['on'](_0x8295('0x1f'),this['syncBlindTransfer'][_0x8295('0x10')](this));}VoiceAgentReport[_0x8295('0x20')][_0x8295('0x21')]=function(_0x4854ef,_0x42eedc,_0x5182df){io['to'](_0x4854ef)[_0x8295('0x21')](_0x42eedc,_0x5182df);};VoiceAgentReport[_0x8295('0x20')]['isNotNull']=function(_0x41cd31){return _0x41cd31!==null&&!_[_0x8295('0x22')](_0x41cd31);};VoiceAgentReport[_0x8295('0x20')][_0x8295('0xf')]=function(_0xa34580){try{if(this[_0x8295('0x23')](_0xa34580)){logger['info']('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa34580[_0x8295('0x24')],_0xa34580[_0x8295('0x25')],_0xa34580[_0x8295('0x26')]);logger['debug'](_0x8295('0x27'),_0xa34580['uniqueid'],util[_0x8295('0x28')](_0xa34580,{'showHidden':![],'depth':null}));if(_[_0x8295('0x22')](this[_0x8295('0x9')][_0xa34580['uniqueid']])){this['channels'][_0xa34580[_0x8295('0x24')]]={};}var _0x2b9178=this[_0x8295('0xc')][_0xa34580[_0x8295('0x29')]];var _0x27b4f8=this[_0x8295('0x9')][_0xa34580[_0x8295('0x24')]][_0xa34580['destuniqueid']];var _0x17b2f9=this[_0x8295('0xb')][_0xa34580[_0x8295('0x2a')]];var _0x4ca6fd=this[_0x8295('0xd')][_0xa34580['uniqueid']];if(_['isUndefined'](_0x27b4f8)){_0x27b4f8={'agentcalledAt':moment()[_0x8295('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x8295('0x2c'),'mandatoryDisposition':_0x17b2f9&&_0x17b2f9[_0x8295('0x2d')]?_0x17b2f9[_0x8295('0x2d')]:![],'type':_0x17b2f9&&_0x17b2f9[_0x8295('0x2e')]?_0x17b2f9['type']:'inbound','variables':_0x4ca6fd,'motionChannel':'voice'};}Object['assign'](_0x27b4f8,_['omit'](_0xa34580,[_0x8295('0x2f'),'privilege']));this['channels'][_0xa34580[_0x8295('0x24')]][_0xa34580[_0x8295('0x26')]]=_0x27b4f8;logger[_0x8295('0x30')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0xa34580['uniqueid'],util[_0x8295('0x28')](_0x27b4f8,{'showHidden':![],'depth':null}));ami[_0x8295('0x21')]('custom:agentcalled',_0x27b4f8);var _0x1b66d5={'id':_0x2b9178['id'],'calleridnum':_0x27b4f8[_0x8295('0x31')],'queue':_0x27b4f8['queue'],'variables':_0x27b4f8[_0x8295('0xd')],'uniqueid':_0xa34580[_0x8295('0x24')]};logger[_0x8295('0x30')](_0x8295('0x32'),_0xa34580['uniqueid'],util['inspect'](_0x1b66d5,{'showHidden':![],'depth':null}));this[_0x8295('0x21')](util['format'](_0x8295('0x33'),_0xa34580[_0x8295('0x25')]),_0x8295('0x34'),_0x1b66d5);}}catch(_0x478f48){logger['error'](_0x8295('0x35'),_0xa34580['uniqueid'],util[_0x8295('0x28')](_0x478f48,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8295('0x20')][_0x8295('0x12')]=function(_0x2e3b93){try{if(this[_0x8295('0x23')](_0x2e3b93)){if(this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]]){for(var _0x28c4d4 in this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]]){if(this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x8295('0x36')](_0x28c4d4)){if(_0x2e3b93['destuniqueid']===_0x28c4d4){logger[_0x8295('0x37')](_0x8295('0x38'),_0x2e3b93[_0x8295('0x24')],_0x2e3b93[_0x8295('0x25')],_0x2e3b93[_0x8295('0x26')]);this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4][_0x8295('0x39')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4][_0x8295('0x3a')]=_0x2e3b93[_0x8295('0x3a')];this[_0x8295('0x9')][_0x2e3b93['uniqueid']][_0x28c4d4][_0x8295('0x3b')]=_0x2e3b93[_0x8295('0x3b')];this['channels'][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4][_0x8295('0x3c')]=_0x2e3b93[_0x8295('0x3c')];this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4][_0x8295('0x3d')]=_0x2e3b93[_0x8295('0x3d')];this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4]['holdtime']=_0x2e3b93['holdtime'];this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4]['lastevent']=_0x8295('0x3e');_[_0x8295('0x3f')](this['agents'][_0x2e3b93[_0x8295('0x29')]],_[_0x8295('0x40')](_0x2e3b93,['queue',_0x8295('0x41')]));var _0x331b25=this['agents'][_0x2e3b93[_0x8295('0x29')]];var _0x23d9e2={'id':_0x331b25['id'],'name':_0x331b25[_0x8295('0x42')],'agentconnected':!![],'destaccountcode':_0x331b25[_0x8295('0x43')],'destconnectedlinenum':this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x2e3b93[_0x8295('0x26')]]['exten'],'queue':this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x2e3b93[_0x8295('0x26')]][_0x8295('0x2a')],'uniqueid':this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x2e3b93[_0x8295('0x26')]]['uniqueid']};ami[_0x8295('0x21')](_0x8295('0x44'),this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x2e3b93[_0x8295('0x26')]]);this[_0x8295('0x21')](util[_0x8295('0x2b')](_0x8295('0x33'),_0x2e3b93['membername']),'user:agentconnect',_0x23d9e2);}else if(!this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4][_0x8295('0x13')]&&!this['channels'][_0x2e3b93['uniqueid']][_0x28c4d4][_0x8295('0x16')]){logger[_0x8295('0x37')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x2e3b93[_0x8295('0x24')],this[_0x8295('0x9')][_0x2e3b93['uniqueid']][_0x28c4d4][_0x8295('0x25')],_0x28c4d4);this[_0x8295('0x9')][_0x2e3b93['uniqueid']][_0x28c4d4][_0x8295('0x13')]=!![];this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4][_0x8295('0x45')]=moment()['format'](_0x8295('0x46'));this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4][_0x8295('0x47')]=_0x2e3b93['destuniqueid'];this['channels'][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4][_0x8295('0x48')]=_0x2e3b93[_0x8295('0x25')];this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4][_0x8295('0x49')]=_0x8295('0x4a');this['channels'][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4][_0x8295('0x4b')]=_0x8295('0x4a');logger[_0x8295('0x30')](_0x8295('0x4c'),_0x2e3b93[_0x8295('0x24')],util[_0x8295('0x28')](this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4],{'showHidden':![],'depth':null}));ami[_0x8295('0x21')](_0x8295('0x4d'),this[_0x8295('0x9')][_0x2e3b93[_0x8295('0x24')]][_0x28c4d4]);}else{logger['debug'](_0x8295('0x4e'),_0x2e3b93[_0x8295('0x24')]);}}}}}}catch(_0xb64b9c){logger[_0x8295('0x4f')](_0x8295('0x50'),_0x2e3b93['uniqueid'],util[_0x8295('0x28')](_0xb64b9c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8295('0x51')]=function(_0x1b8a8f){try{if(this[_0x8295('0x23')](_0x1b8a8f)){logger[_0x8295('0x30')](_0x8295('0x52'),_0x1b8a8f[_0x8295('0x24')],util[_0x8295('0x28')](_0x1b8a8f,{'showHidden':![],'depth':null}));if(this[_0x8295('0x9')][_0x1b8a8f[_0x8295('0x24')]]&&this['channels'][_0x1b8a8f[_0x8295('0x24')]][_0x1b8a8f[_0x8295('0x26')]]){logger[_0x8295('0x37')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x1b8a8f[_0x8295('0x24')],_0x1b8a8f[_0x8295('0x25')],_0x1b8a8f[_0x8295('0x26')]);var _0x362e95=this[_0x8295('0xc')][_0x1b8a8f[_0x8295('0x29')]];var _0x524c5b=this['channels'][_0x1b8a8f[_0x8295('0x24')]][_0x1b8a8f[_0x8295('0x26')]];_0x524c5b[_0x8295('0x13')]=!![];_0x524c5b['agentringnoanswerAt']=moment()[_0x8295('0x2b')](_0x8295('0x46'));_0x524c5b['lastevent']=_0x8295('0x53');_0x524c5b['reason']=_0x8295('0x53');var _0x4a21d9={'id':_0x362e95['id'],'name':_0x362e95[_0x8295('0x42')],'queue':_0x524c5b[_0x8295('0x2a')],'uniqueid':_0x524c5b['uniqueid']};logger[_0x8295('0x30')](_0x8295('0x54'),_0x1b8a8f[_0x8295('0x24')],util['inspect'](_0x4a21d9,{'showHidden':![],'depth':null}));this[_0x8295('0x21')](util[_0x8295('0x2b')]('user:%s',_0x362e95[_0x8295('0x42')]),_0x8295('0x55'),_0x4a21d9);ami['emit'](_0x8295('0x56'),_0x524c5b);this[_0x8295('0x9')][_0x1b8a8f[_0x8295('0x24')]][_0x1b8a8f[_0x8295('0x26')]]=Object[_0x8295('0x57')]({},_0x524c5b);}}}catch(_0x43870e){logger[_0x8295('0x4f')](_0x8295('0x58'),_0x1b8a8f[_0x8295('0x24')],util[_0x8295('0x28')](_0x43870e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8295('0x20')][_0x8295('0x15')]=function(_0x12cacb){try{if(this[_0x8295('0x23')](_0x12cacb)){logger[_0x8295('0x30')](_0x8295('0x59'),_0x12cacb['uniqueid'],util['inspect'](_0x12cacb,{'showHidden':![],'depth':null}));if(this[_0x8295('0x9')][_0x12cacb['uniqueid']]){for(var _0x161fdc in this[_0x8295('0x9')][_0x12cacb[_0x8295('0x24')]]){if(this[_0x8295('0x9')][_0x12cacb[_0x8295('0x24')]][_0x8295('0x36')](_0x161fdc)&&!this['channels'][_0x12cacb[_0x8295('0x24')]][_0x161fdc][_0x8295('0x13')]&&!this[_0x8295('0x9')][_0x12cacb[_0x8295('0x24')]][_0x161fdc][_0x8295('0x16')]){logger[_0x8295('0x37')](_0x8295('0x5a'),_0x12cacb[_0x8295('0x24')],this[_0x8295('0x9')][_0x12cacb['uniqueid']][_0x161fdc][_0x8295('0x25')],_0x161fdc);this[_0x8295('0x9')][_0x12cacb[_0x8295('0x24')]][_0x161fdc][_0x8295('0x13')]=!![];this[_0x8295('0x9')][_0x12cacb[_0x8295('0x24')]][_0x161fdc][_0x8295('0x45')]=moment()[_0x8295('0x2b')](_0x8295('0x46'));this[_0x8295('0x9')][_0x12cacb[_0x8295('0x24')]][_0x161fdc]['lastevent']=_0x8295('0x5b');this[_0x8295('0x9')][_0x12cacb[_0x8295('0x24')]][_0x161fdc][_0x8295('0x4b')]=_0x8295('0x5b');logger[_0x8295('0x30')](_0x8295('0x5c'),_0x12cacb[_0x8295('0x24')],util['inspect'](this[_0x8295('0x9')][_0x12cacb[_0x8295('0x24')]][_0x161fdc],{'showHidden':![],'depth':null}));ami[_0x8295('0x21')](_0x8295('0x5d'),this[_0x8295('0x9')][_0x12cacb[_0x8295('0x24')]][_0x161fdc]);}}}}}catch(_0x417ade){logger['error']('[%s][voiceAgentReport][queuecallerabandon]',_0x12cacb[_0x8295('0x24')],util[_0x8295('0x28')](_0x417ade,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8295('0x20')]['syncAgentComplete']=function(_0x6de013){try{if(this['isNotNull'](_0x6de013)){logger['debug'](_0x8295('0x5e'),_0x6de013['uniqueid'],util[_0x8295('0x28')](_0x6de013,{'showHidden':![],'depth':null}));if(this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]]){for(var _0x52ad37 in this['channels'][_0x6de013[_0x8295('0x24')]]){if(this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x8295('0x36')](_0x52ad37)){if(this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x52ad37]['agentconnectAt']&&!this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x52ad37][_0x8295('0x16')]){logger[_0x8295('0x37')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x6de013['uniqueid'],this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x52ad37][_0x8295('0x25')],_0x52ad37);this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x52ad37][_0x8295('0x16')]=!![];this['channels'][_0x6de013[_0x8295('0x24')]][_0x52ad37][_0x8295('0x5f')]=moment()['format'](_0x8295('0x46'));this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x52ad37][_0x8295('0x49')]=_0x8295('0x60');this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x52ad37]['reason']=_0x6de013[_0x8295('0x4b')]=='transfer'?_0x8295('0x61'):_0x6de013[_0x8295('0x4b')];this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x52ad37][_0x8295('0x62')]=_0x6de013[_0x8295('0x62')];if(this[_0x8295('0xb')][_0x6de013[_0x8295('0x2a')]]&&this[_0x8295('0xb')][_0x6de013[_0x8295('0x2a')]][_0x8295('0x63')]){this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x52ad37]['acwtime']=this[_0x8295('0xb')][_0x6de013[_0x8295('0x2a')]]['acwTimeout'];this['channels'][_0x6de013['uniqueid']][_0x52ad37]['agentacw']=!![];}this[_0x8295('0xc')][_0x6de013[_0x8295('0x29')]]=_['omit'](this[_0x8295('0xc')][_0x6de013[_0x8295('0x29')]],[_0x8295('0x2a'),_0x8295('0x41')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x6de013['uniqueid'],util[_0x8295('0x28')](this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x52ad37],{'showHidden':![],'depth':null}));ami[_0x8295('0x21')](_0x8295('0x64'),this[_0x8295('0x9')][_0x6de013[_0x8295('0x24')]][_0x52ad37]);logger['debug'](_0x8295('0x65'),_0x6de013[_0x8295('0x24')],util['inspect']({'id':this['agents'][_0x6de013[_0x8295('0x29')]]['id'],'destaccountcode':_0x6de013[_0x8295('0x66')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x8295('0x2b')](_0x8295('0x33'),_0x6de013[_0x8295('0x25')]),_0x8295('0x67'),{'id':this[_0x8295('0xc')][_0x6de013[_0x8295('0x29')]]['id'],'destaccountcode':Number(_0x6de013['destaccountcode'])});}}}}}}catch(_0x4b2008){logger[_0x8295('0x4f')](_0x8295('0x68'),_0x6de013[_0x8295('0x24')],util['inspect'](_0x4b2008,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8295('0x20')][_0x8295('0x18')]=function(_0xaa7fe7){try{if(this[_0x8295('0x23')](_0xaa7fe7)){logger['debug'](_0x8295('0x69'),_0xaa7fe7[_0x8295('0x24')],util[_0x8295('0x28')](_0xaa7fe7,{'showHidden':![],'depth':null}));this['addVariable'](_0xaa7fe7[_0x8295('0x24')],_[_0x8295('0x6a')](_0xaa7fe7['variable'])[0x0],_0xaa7fe7[_0x8295('0x6b')]);if(this[_0x8295('0x9')][_0xaa7fe7[_0x8295('0x24')]]){for(var _0x3d43aa in this[_0x8295('0x9')][_0xaa7fe7[_0x8295('0x24')]]){if(this[_0x8295('0x9')][_0xaa7fe7[_0x8295('0x24')]][_0x8295('0x36')](_0x3d43aa)){logger['info']('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0xaa7fe7[_0x8295('0x24')],_0x3d43aa,_['keys'](_0xaa7fe7[_0x8295('0x6c')])[0x0],_0xaa7fe7[_0x8295('0x6b')]);if(_[_0x8295('0x22')](this[_0x8295('0x9')][_0xaa7fe7[_0x8295('0x24')]][_0x3d43aa][_0x8295('0xd')])){this[_0x8295('0x9')][_0xaa7fe7[_0x8295('0x24')]][_0x3d43aa][_0x8295('0xd')]={};}this[_0x8295('0x9')][_0xaa7fe7[_0x8295('0x24')]][_0x3d43aa]['variables']=this['variables'][_0xaa7fe7[_0x8295('0x24')]];}}}}}catch(_0x2ab566){logger[_0x8295('0x4f')](_0x8295('0x6d'),_0xaa7fe7['uniqueid'],util[_0x8295('0x28')](_0x2ab566,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8295('0x20')][_0x8295('0x6e')]=function(_0x81507,_0x374085,_0x8be789){var _0x53c21b=['rtpaudioqos',_0x8295('0x6f'),_0x8295('0x70'),_0x8295('0x71'),_0x8295('0x72'),_0x8295('0x73'),_0x8295('0x74'),'rtpaudioqosrttbridged',_0x8295('0x75'),_0x8295('0x76'),_0x8295('0x77'),_0x8295('0x78'),'membercalls',_0x8295('0x79'),_0x8295('0x7a'),'memberlastcall',_0x8295('0x25'),'memberpenalty',_0x8295('0x7b')];if(!_[_0x8295('0x7c')](_0x374085)&&!_[_0x8295('0x7d')](_0x53c21b,_0x374085)){if(_[_0x8295('0x22')](this[_0x8295('0xd')][_0x81507])){this['variables'][_0x81507]={};}this['variables'][_0x81507][_0x374085]=_0x8be789;}};VoiceAgentReport[_0x8295('0x20')][_0x8295('0x7e')]=function(_0x5597ba){try{if(this['isNotNull'](_0x5597ba)){logger[_0x8295('0x30')](_0x8295('0x7f'),_0x5597ba['uniqueid'],util[_0x8295('0x28')](_0x5597ba,{'showHidden':![],'depth':null}));if(this['channels'][_0x5597ba['uniqueid']]){for(var _0x210bac in this[_0x8295('0x9')][_0x5597ba[_0x8295('0x24')]]){if(this[_0x8295('0x9')][_0x5597ba[_0x8295('0x24')]][_0x8295('0x36')](_0x210bac)){if(this[_0x8295('0x9')][_0x5597ba[_0x8295('0x24')]][_0x210bac]['reason']==_0x8295('0x80')&&this[_0x8295('0x9')][_0x5597ba[_0x8295('0x24')]][_0x210bac][_0x8295('0x16')]){logger['info'](_0x8295('0x81'),_0x5597ba[_0x8295('0x24')],_0x210bac);this[_0x8295('0x9')][_0x5597ba[_0x8295('0x24')]][_0x210bac][_0x8295('0x5f')]=moment()[_0x8295('0x2b')](_0x8295('0x46'));}}}logger[_0x8295('0x30')](_0x8295('0x82'),_0x5597ba['uniqueid'],util['inspect'](_[_0x8295('0x83')](this[_0x8295('0x9')][_0x5597ba[_0x8295('0x24')]]),{'showHidden':![],'depth':null}));ami[_0x8295('0x21')]('custom:voiceAgentReport',_['values'](this[_0x8295('0x9')][_0x5597ba[_0x8295('0x24')]]));this[_0x8295('0x84')](_0x5597ba[_0x8295('0x24')]);}if(this[_0x8295('0xd')][_0x5597ba[_0x8295('0x24')]]){delete this[_0x8295('0xd')][_0x5597ba[_0x8295('0x24')]];}}}catch(_0x114eb7){logger[_0x8295('0x4f')](_0x8295('0x85'),_0x5597ba[_0x8295('0x24')],util[_0x8295('0x28')](_0x114eb7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8295('0x20')][_0x8295('0x1e')]=function(_0x75964c){try{if(this[_0x8295('0x23')](_0x75964c)){logger[_0x8295('0x30')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x75964c[_0x8295('0x24')],util[_0x8295('0x28')](_0x75964c,{'showHidden':![],'depth':null}));if(this['channels'][_0x75964c[_0x8295('0x86')]]){for(var _0x58da26 in this[_0x8295('0x9')][_0x75964c[_0x8295('0x86')]]){if(this[_0x8295('0x9')][_0x75964c[_0x8295('0x86')]][_0x8295('0x36')](_0x58da26)){if(_0x75964c[_0x8295('0x87')]===_0x58da26){logger[_0x8295('0x37')](_0x8295('0x88'),_0x75964c[_0x8295('0x24')],this[_0x8295('0x9')][_0x75964c['transfereeuniqueid']][_0x58da26]['membername'],_0x58da26);var _0x62feb6=moment();this[_0x8295('0x9')][_0x75964c['transfereeuniqueid']][_0x58da26][_0x8295('0x16')]=!![];this[_0x8295('0x9')][_0x75964c['transfereeuniqueid']][_0x58da26][_0x8295('0x5f')]=moment()[_0x8295('0x2b')](_0x8295('0x46'));this[_0x8295('0x9')][_0x75964c[_0x8295('0x86')]][_0x58da26][_0x8295('0x49')]=_0x8295('0x60');this[_0x8295('0x9')][_0x75964c['transfereeuniqueid']][_0x58da26][_0x8295('0x4b')]='transfer';this[_0x8295('0x9')][_0x75964c['transfereeuniqueid']][_0x58da26][_0x8295('0x62')]=_0x62feb6[_0x8295('0x89')](this[_0x8295('0x9')][_0x75964c[_0x8295('0x86')]][_0x58da26]['agentconnectAt'],_0x8295('0x8a'));}}}}if(this[_0x8295('0x9')][_0x75964c[_0x8295('0x8b')]]){var _0x5b98f6=this[_0x8295('0x9')][_0x75964c[_0x8295('0x8b')]];this[_0x8295('0x9')][_0x75964c[_0x8295('0x8b')]]=this[_0x8295('0x9')][_0x75964c[_0x8295('0x86')]];this['channels'][_0x75964c[_0x8295('0x86')]]=_0x5b98f6;}}}catch(_0x8ba6c3){logger['error'](_0x8295('0x8c'),_0x75964c[_0x8295('0x24')],util[_0x8295('0x28')](_0x8ba6c3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8295('0x20')]['syncBlindTransfer']=function(_0x2912d9){try{if(this[_0x8295('0x23')](_0x2912d9)){logger[_0x8295('0x30')](_0x8295('0x8d'),_0x2912d9[_0x8295('0x24')],util[_0x8295('0x28')](_0x2912d9,{'showHidden':![],'depth':null}));if(this['channels'][_0x2912d9[_0x8295('0x86')]]){for(var _0x389dc3 in this['channels'][_0x2912d9['transfereeuniqueid']]){if(this[_0x8295('0x9')][_0x2912d9[_0x8295('0x86')]][_0x8295('0x36')](_0x389dc3)){if(_0x2912d9[_0x8295('0x8e')]===_0x389dc3){logger[_0x8295('0x37')](_0x8295('0x8f'),_0x2912d9[_0x8295('0x24')],this[_0x8295('0x9')][_0x2912d9[_0x8295('0x86')]][_0x389dc3][_0x8295('0x25')],_0x389dc3);var _0xd05553=moment();this[_0x8295('0x9')][_0x2912d9[_0x8295('0x86')]][_0x389dc3]['agentcomplete']=!![];this['channels'][_0x2912d9[_0x8295('0x86')]][_0x389dc3][_0x8295('0x5f')]=_0xd05553;this[_0x8295('0x9')][_0x2912d9[_0x8295('0x86')]][_0x389dc3][_0x8295('0x49')]=_0x8295('0x60');this['channels'][_0x2912d9[_0x8295('0x86')]][_0x389dc3]['reason']=_0x8295('0x80');this[_0x8295('0x9')][_0x2912d9[_0x8295('0x86')]][_0x389dc3]['talktime']=_0xd05553[_0x8295('0x89')](this[_0x8295('0x9')][_0x2912d9[_0x8295('0x86')]][_0x389dc3][_0x8295('0x39')],'seconds');}}}}}}catch(_0x3257e1){logger['error'](_0x8295('0x90'),_0x2912d9[_0x8295('0x24')],util[_0x8295('0x28')](_0x3257e1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8295('0x20')][_0x8295('0x1b')]=function(_0x443dad){var _0x3b76b5='';try{if(this[_0x8295('0x23')](_0x443dad)){logger[_0x8295('0x30')](_0x8295('0x91'),_0x443dad['uniqueid'],util['inspect'](_0x443dad,{'showHidden':![],'depth':null}));if(_0x443dad['channel']){_0x3b76b5=_0x443dad['channel'][_0x8295('0x92')](0x0,_0x443dad['channel'][_0x8295('0x93')]('-'));if(this[_0x8295('0xc')][_0x3b76b5]){logger[_0x8295('0x37')](_0x8295('0x94'),_0x443dad['uniqueid'],_0x3b76b5);this[_0x8295('0xc')][_0x3b76b5]['onhold']=!![];}}}}catch(_0x292153){logger['error'](_0x8295('0x95'),_0x443dad[_0x8295('0x24')],util[_0x8295('0x28')](_0x292153,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8295('0x20')][_0x8295('0x1d')]=function(_0x3ec781){var _0x1777cc='';try{if(this[_0x8295('0x23')](_0x3ec781)){logger[_0x8295('0x30')](_0x8295('0x96'),_0x3ec781['uniqueid'],util[_0x8295('0x28')](_0x3ec781,{'showHidden':![],'depth':null}));if(_0x3ec781[_0x8295('0x97')]){_0x1777cc=_0x3ec781[_0x8295('0x97')][_0x8295('0x92')](0x0,_0x3ec781[_0x8295('0x97')]['lastIndexOf']('-'));if(this[_0x8295('0xc')][_0x1777cc]){logger[_0x8295('0x37')](_0x8295('0x98'),_0x3ec781['uniqueid'],_0x1777cc);this[_0x8295('0xc')][_0x1777cc][_0x8295('0x99')]=![];}}}}catch(_0x37cccb){logger[_0x8295('0x4f')]('[%s][voiceAgentReport][musiconholdstop]',_0x3ec781[_0x8295('0x24')],util[_0x8295('0x28')](_0x37cccb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['deleteChannelAfterTimeout']=function(_0x290aeb,_0x2c378a=0x2710){if(this['channels'][_0x290aeb]){setTimeout(()=>{delete this[_0x8295('0x9')][_0x290aeb];},_0x2c378a);}};module[_0x8295('0x9a')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 5737a0b..6daba94 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 _0x0112=['user:agentcomplete','length','transferType','transferToInternal','isEmpty','monitors','getSettings','resolve','Action','StopMixMonitor','then','catch','finally','webbar:stopmonitors','event','BlindTransfer','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','some','outbound','routeid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newchannel','newstate','syncNewState','varset','hangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','inspect','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','keys','context','from-sip','channel','split','xcally-motion-preview','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','channelstate','undefined','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','disposition','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','calleridname','answered','answertime','holdtime','connectedlinename','destinationchannel','toNumber','UserId','membername','diff','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','push','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncHangup','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:'];(function(_0x211c0,_0x315fe4){var _0x3432b7=function(_0x1d01dc){while(--_0x1d01dc){_0x211c0['push'](_0x211c0['shift']());}};_0x3432b7(++_0x315fe4);}(_0x0112,0x1c0));var _0x2011=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x0112[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x2011('0x0'));var moment=require(_0x2011('0x1'));var util=require(_0x2011('0x2'));var path=require(_0x2011('0x3'));var Redis=require(_0x2011('0x4'));var config=require(_0x2011('0x5'));var logger=require(_0x2011('0x6'))(_0x2011('0x7'));var ami=require(_0x2011('0x8'));var Channel=require(_0x2011('0x9'));var RpcSetting=require(_0x2011('0xa'));var applications=[_0x2011('0xb'),_0x2011('0xc'),'agi',_0x2011('0xd'),_0x2011('0xe'),_0x2011('0xf')];var dispositions=[_0x2011('0x10'),_0x2011('0x11'),'FAILED',_0x2011('0x10'),'NO\x20ANSWER',_0x2011('0x10'),_0x2011('0x12'),_0x2011('0x13'),'FAILED',_0x2011('0x11'),_0x2011('0x11')];config[_0x2011('0x14')]=_[_0x2011('0x15')](config[_0x2011('0x14')],{'host':_0x2011('0x16'),'port':0x18eb});var io=require(_0x2011('0x17'))(new Redis(config[_0x2011('0x14')]));function VoiceCallReport(_0x292cab){this['channels']=_0x292cab[_0x2011('0x18')];this[_0x2011('0x19')]=_0x292cab[_0x2011('0x19')];this[_0x2011('0x1a')]={};ami['on'](_0x2011('0x1b'),this[_0x2011('0x1c')]['bind'](this));ami['on'](_0x2011('0x1d'),this[_0x2011('0x1c')][_0x2011('0x1e')](this));ami['on'](_0x2011('0x1f'),this['syncNewChannel'][_0x2011('0x1e')](this));ami['on'](_0x2011('0x20'),this[_0x2011('0x21')][_0x2011('0x1e')](this));ami['on'](_0x2011('0x22'),this['syncVarSet'][_0x2011('0x1e')](this));ami['on'](_0x2011('0x23'),this['syncHangup'][_0x2011('0x1e')](this));ami['on'](_0x2011('0x24'),this[_0x2011('0x25')][_0x2011('0x1e')](this));ami['on'](_0x2011('0x26'),this['syncAttendedTransfer'][_0x2011('0x1e')](this));ami['on'](_0x2011('0x27'),this[_0x2011('0x28')][_0x2011('0x1e')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x2011('0x1e')](this));ami['on'](_0x2011('0x29'),this[_0x2011('0x2a')]['bind'](this));try{logger[_0x2011('0x2b')](_0x2011('0x2c'));ami[_0x2011('0x2d')]();}catch(_0x382a99){logger['error']('[voiceCallReport][coreshowchannels]',util[_0x2011('0x2e')](_0x382a99,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x2011('0x2f')]=function(_0x188a51){return _0x188a51!==null&&!_[_0x2011('0x30')](_0x188a51);};VoiceCallReport[_0x2011('0x31')][_0x2011('0x32')]=function(_0x227523,_0x63122f,_0x4c58a3){io['to'](_0x227523)[_0x2011('0x32')](_0x63122f,_0x4c58a3);};VoiceCallReport[_0x2011('0x31')][_0x2011('0x25')]=function(_0x4674f5){try{if(this[_0x2011('0x2f')](_0x4674f5)){logger['info'](_0x2011('0x33'),_0x4674f5['uniqueid'],_0x4674f5['calleridname'],_0x4674f5[_0x2011('0x34')]);logger[_0x2011('0x35')](_0x2011('0x36'),_0x4674f5[_0x2011('0x37')],util[_0x2011('0x2e')](_0x4674f5,{'showHidden':![],'depth':null}));if(_0x4674f5[_0x2011('0x37')]===_0x4674f5[_0x2011('0x38')]){if(!_[_0x2011('0x30')](this[_0x2011('0x18')][_0x4674f5[_0x2011('0x37')]])){_[_0x2011('0x39')](this[_0x2011('0x18')][_0x4674f5[_0x2011('0x37')]],_[_0x2011('0x3a')](_0x4674f5,_[_0x2011('0x3b')](this[_0x2011('0x18')][_0x4674f5[_0x2011('0x37')]])));}}if(_0x4674f5[_0x2011('0x3c')]===_0x2011('0x3d')){var _0x58a6ec=this[_0x2011('0x19')][_0x4674f5[_0x2011('0x3e')][_0x2011('0x3f')]('-')[0x0]];if(_0x58a6ec){if(_0x4674f5['exten']==_0x2011('0x40')){_0x58a6ec['destconnectedlinenum']=_0x4674f5[_0x2011('0x41')];this[_0x2011('0x32')](util[_0x2011('0x42')](_0x2011('0x43'),_0x58a6ec[_0x2011('0x44')]),_0x2011('0x45'),{'id':_0x58a6ec['id'],'destaccountcode':_0x58a6ec[_0x2011('0x46')],'destconnectedlinenum':_0x4674f5[_0x2011('0x41')]});}}}}}catch(_0x1fb19e){logger[_0x2011('0x47')](_0x2011('0x48'),_0x4674f5['uniqueid'],util[_0x2011('0x2e')](_0x1fb19e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x5342e2){try{if(this[_0x2011('0x2f')](_0x5342e2)){logger[_0x2011('0x35')]('[%s][voiceCallReport][newchannel]\x20event:',_0x5342e2[_0x2011('0x37')],util[_0x2011('0x2e')](_0x5342e2,{'showHidden':![],'depth':null}));if(this[_0x2011('0x18')][_0x5342e2[_0x2011('0x37')]]){return;}if(_0x5342e2[_0x2011('0x3e')]===_0x2011('0x49')){return;}if(_0x5342e2[_0x2011('0x37')]!==_0x5342e2['linkedid']&&!this[_0x2011('0x1a')][_0x5342e2[_0x2011('0x38')]]){return;}logger['info'](_0x2011('0x4a'),_0x5342e2[_0x2011('0x37')],_0x5342e2[_0x2011('0x3c')],_0x5342e2[_0x2011('0x4b')]);this[_0x2011('0x18')][_0x5342e2[_0x2011('0x37')]]=new Channel();this[_0x2011('0x18')][_0x5342e2[_0x2011('0x37')]][_0x2011('0x4c')]=moment()['format'](_0x2011('0x4d'));this[_0x2011('0x18')][_0x5342e2[_0x2011('0x37')]]['disposition']=dispositions[_['toNumber'](_0x5342e2[_0x2011('0x4e')])];_[_0x2011('0x39')](this[_0x2011('0x18')][_0x5342e2[_0x2011('0x37')]],_[_0x2011('0x3a')](_0x5342e2,_[_0x2011('0x3b')](this[_0x2011('0x18')][_0x5342e2[_0x2011('0x37')]])));if(_0x5342e2[_0x2011('0x3c')]==='from-sip'){var _0x1f87c8=this[_0x2011('0x19')][_0x5342e2[_0x2011('0x3e')][_0x2011('0x3f')]('-')[0x0]];if(_0x1f87c8&&typeof _0x1f87c8['destconnectedlinenum']===_0x2011('0x4f')){_0x1f87c8[_0x2011('0x50')]=_0x5342e2[_0x2011('0x4b')];logger['debug'](_0x2011('0x51'),_0x5342e2[_0x2011('0x37')],util['inspect']({'id':_0x1f87c8['id'],'destaccountcode':_0x1f87c8['accountcode'],'destconnectedlinenum':_0x5342e2[_0x2011('0x4b')]},{'showHidden':![],'depth':null}));this[_0x2011('0x32')](util[_0x2011('0x42')]('user:%s',_0x1f87c8[_0x2011('0x44')]),_0x2011('0x45'),{'id':_0x1f87c8['id'],'destaccountcode':_0x1f87c8[_0x2011('0x46')],'destconnectedlinenum':_0x5342e2[_0x2011('0x4b')]});}}}}catch(_0x13e4ed){logger[_0x2011('0x47')](_0x2011('0x52'),_0x5342e2[_0x2011('0x37')],util[_0x2011('0x2e')](_0x13e4ed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2011('0x31')][_0x2011('0x1c')]=function(_0x58a387){try{if(this[_0x2011('0x2f')](_0x58a387)){logger[_0x2011('0x35')](_0x2011('0x53'),_0x58a387[_0x2011('0x37')],util[_0x2011('0x2e')](_0x58a387,{'showHidden':![],'depth':null}));if(_0x58a387[_0x2011('0x3e')]===_0x2011('0x49')||_0x58a387[_0x2011('0x4b')]==='h')return;if(_0x58a387[_0x2011('0x37')]===_0x58a387[_0x2011('0x38')]||this['blindTransfers'][_0x58a387[_0x2011('0x38')]]){_0x58a387[_0x2011('0x54')]=_0x58a387[_0x2011('0x54')]?_0x58a387[_0x2011('0x54')]['toLowerCase']():undefined;_0x58a387[_0x2011('0x55')]=_0x58a387['appdata']||_0x58a387[_0x2011('0x55')];if(_0x58a387[_0x2011('0x56')]&&_0x58a387[_0x2011('0x54')]!==_0x2011('0xc')){_0x58a387[_0x2011('0x55')]=_0x58a387[_0x2011('0x55')][_0x2011('0x57')]();}logger[_0x2011('0x2b')](_0x2011('0x58'),_0x58a387['uniqueid'],_0x58a387['application'],_0x58a387[_0x2011('0x55')]);if(_['isUndefined'](this['channels'][_0x58a387['uniqueid']])){this[_0x2011('0x18')][_0x58a387[_0x2011('0x37')]]=new Channel();this[_0x2011('0x18')][_0x58a387[_0x2011('0x37')]][_0x2011('0x4c')]=_0x58a387[_0x2011('0x59')]?moment()[_0x2011('0x5a')](moment[_0x2011('0x59')](_0x58a387['duration'])['seconds'](),_0x2011('0x5b'))[_0x2011('0x42')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x2011('0x42')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x58a387[_0x2011('0x37')]][_0x2011('0x5c')]=_0x2011('0x10');}_[_0x2011('0x39')](this[_0x2011('0x18')][_0x58a387[_0x2011('0x37')]],_[_0x2011('0x3a')](_0x58a387,_[_0x2011('0x3b')](this['channels'][_0x58a387[_0x2011('0x37')]])));if(_['includes'](applications,_0x58a387[_0x2011('0x54')])){this['channels'][_0x58a387[_0x2011('0x37')]][_0x2011('0x5d')]=_0x58a387['application'];this[_0x2011('0x18')][_0x58a387[_0x2011('0x37')]][_0x2011('0x5e')]=_0x58a387[_0x2011('0x55')];if(_0x58a387[_0x2011('0x54')]===_0x2011('0xb')&&_[_0x2011('0x5f')](_0x58a387[_0x2011('0x55')]['toLowerCase'](),_0x2011('0x60'))){var _0x10420c=_0x58a387['applicationdata'][_0x2011('0x3f')]('=');var _0x1accde=_0x10420c[0x0][_0x2011('0x57')]()[_0x2011('0x61')](/cdr\((.*)\)/);if(_0x1accde){if(_0x1accde[0x1]===_0x2011('0x62')&&!_[_0x2011('0x63')](this[_0x2011('0x18')][_0x58a387[_0x2011('0x37')]][_0x1accde[0x1]]))return;this[_0x2011('0x18')][_0x58a387[_0x2011('0x37')]][_0x1accde[0x1]]=_0x10420c[0x1];}}else if(_0x58a387[_0x2011('0x54')]===_0x2011('0xc')){this[_0x2011('0x18')][_0x58a387[_0x2011('0x37')]][_0x2011('0xc')]=_0x58a387['applicationdata']['split'](',')[0x0];}}}}}catch(_0x409a9b){logger[_0x2011('0x47')](_0x2011('0x64'),_0x58a387[_0x2011('0x37')],util[_0x2011('0x2e')](_0x409a9b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2011('0x31')]['syncNewState']=function(_0x2dc4c4){try{if(this[_0x2011('0x2f')](_0x2dc4c4)){logger[_0x2011('0x2b')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x2dc4c4[_0x2011('0x37')],_0x2dc4c4['linkedid'],_0x2dc4c4[_0x2011('0x65')],_0x2dc4c4[_0x2011('0x34')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x2dc4c4['uniqueid'],util[_0x2011('0x2e')](_0x2dc4c4,{'showHidden':![],'depth':null}));if(_0x2dc4c4[_0x2011('0x4e')]!=='6')return;var _0x59b0a3=this[_0x2011('0x19')][_0x2dc4c4[_0x2011('0x3e')][_0x2011('0x3f')]('-')[0x0]];if(_0x2dc4c4['uniqueid']!==_0x2dc4c4[_0x2011('0x38')]){var _0x1a1dcf=moment();if(this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x38')]]){if(!this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x38')]][_0x2011('0x66')]){this['channels'][_0x2dc4c4['linkedid']][_0x2011('0x66')]=!![];this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x38')]][_0x2011('0x67')]=_0x1a1dcf['format'](_0x2011('0x4d'));if(this[_0x2011('0x18')][_0x2dc4c4['linkedid']][_0x2011('0x4c')]){this[_0x2011('0x18')][_0x2dc4c4['linkedid']][_0x2011('0x68')]=_0x1a1dcf['diff'](this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x38')]]['starttime'],_0x2011('0x5b'));}}this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x38')]][_0x2011('0x38')]=_0x2dc4c4[_0x2011('0x37')];if(_0x2dc4c4[_0x2011('0x34')]!=='xcally-motion-preview'){this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x38')]][_0x2011('0x41')]=_0x2dc4c4[_0x2011('0x34')];}this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x38')]][_0x2011('0x69')]=_0x2dc4c4[_0x2011('0x65')];this['channels'][_0x2dc4c4[_0x2011('0x38')]][_0x2011('0x6a')]=_0x2dc4c4[_0x2011('0x3e')];this['channels'][_0x2dc4c4[_0x2011('0x38')]]['disposition']=dispositions[_[_0x2011('0x6b')](_0x2dc4c4['channelstate'])];if(_0x59b0a3){this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x38')]][_0x2011('0x6c')]=_0x59b0a3['id'];this['channels'][_0x2dc4c4[_0x2011('0x38')]][_0x2011('0x6d')]=_0x59b0a3[_0x2011('0x44')];}}if(this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x37')]]){if(!this[_0x2011('0x18')][_0x2dc4c4['uniqueid']][_0x2011('0x66')]){this['channels'][_0x2dc4c4[_0x2011('0x37')]][_0x2011('0x66')]=!![];this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x37')]][_0x2011('0x67')]=_0x1a1dcf[_0x2011('0x42')](_0x2011('0x4d'));if(this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x37')]][_0x2011('0x4c')]){this['channels'][_0x2dc4c4[_0x2011('0x37')]]['holdtime']=_0x1a1dcf[_0x2011('0x6e')](this['channels'][_0x2dc4c4['uniqueid']][_0x2011('0x4c')],'seconds');}}if(_0x2dc4c4[_0x2011('0x34')]!=='xcally-motion-preview'){this[_0x2011('0x18')][_0x2dc4c4['uniqueid']][_0x2011('0x41')]=_0x2dc4c4[_0x2011('0x34')];}this[_0x2011('0x18')][_0x2dc4c4['uniqueid']][_0x2011('0x69')]=_0x2dc4c4[_0x2011('0x65')];this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x37')]][_0x2011('0x6a')]=_0x2dc4c4[_0x2011('0x3e')];this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x37')]]['disposition']=dispositions[_[_0x2011('0x6b')](_0x2dc4c4[_0x2011('0x4e')])];}}else{if(this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x37')]]){if(_0x59b0a3){this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x37')]][_0x2011('0x6c')]=_0x59b0a3['id'];this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x37')]]['membername']=_0x59b0a3[_0x2011('0x44')];}}}if(_0x2dc4c4[_0x2011('0x3c')]===_0x2011('0x3d')){if(_0x59b0a3){_0x59b0a3[_0x2011('0x50')]=_0x2dc4c4['exten'];var _0x5561b8;if(this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x37')]]){_0x5561b8=this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x37')]][_0x2011('0xc')];}else if(this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x38')]]){_0x5561b8=this[_0x2011('0x18')][_0x2dc4c4[_0x2011('0x38')]][_0x2011('0xc')];}_0x59b0a3[_0x2011('0xc')]=_0x5561b8;var _0x1b7c68={'id':_0x59b0a3['id'],'name':_0x59b0a3[_0x2011('0x44')],'agentconnected':!![],'destaccountcode':_0x59b0a3[_0x2011('0x46')],'destconnectedlinenum':_0x2dc4c4[_0x2011('0x4b')],'queue':_0x5561b8||undefined,'uniqueid':_0x2dc4c4[_0x2011('0x38')]};logger[_0x2011('0x35')](_0x2011('0x6f'),_0x2dc4c4[_0x2011('0x37')],util[_0x2011('0x2e')](_0x1b7c68,{'showHidden':![],'depth':null}));this[_0x2011('0x32')](util[_0x2011('0x42')](_0x2011('0x43'),_0x59b0a3['name']),_0x2011('0x45'),_0x1b7c68);}}}}catch(_0x38b53d){logger[_0x2011('0x47')]('[%s][voiceCallReport][newstate]',_0x2dc4c4[_0x2011('0x37')],util['inspect'](_0x38b53d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2011('0x31')]['syncMixMonitorFilename']=function(_0x48f674,_0x2bf7dc){try{if(this['channels'][_0x48f674]){logger[_0x2011('0x2b')](_0x2011('0x70'),_0x48f674,_0x2bf7dc);this[_0x2011('0x18')][_0x48f674][_0x2011('0x71')]=!![];if(_[_0x2011('0x72')](_0x2bf7dc,_0x2011('0x73'))){_0x2bf7dc=_0x2bf7dc[_0x2011('0x74')](_0x2011('0x73'),_0x2011('0x75'));}this[_0x2011('0x18')][_0x48f674][_0x2011('0x76')]=_0x2bf7dc;var _0x2f09b8=_[_0x2011('0x77')](this[_0x2011('0x18')][_0x48f674]['monitors'],{'filename':_0x2bf7dc});if(_[_0x2011('0x63')](_0x2f09b8)){this[_0x2011('0x18')][_0x48f674]['monitors'][_0x2011('0x78')]({'filename':_0x2bf7dc,'createdAt':moment()[_0x2011('0x42')](_0x2011('0x4d')),'mixmonitorid':'','status':'rec'});}}}catch(_0x110374){logger[_0x2011('0x47')](_0x2011('0x79'),_0x48f674,util[_0x2011('0x2e')](_0x110374,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2011('0x31')][_0x2011('0x7a')]=function(_0x5dd881){try{if(this[_0x2011('0x2f')](_0x5dd881)){logger[_0x2011('0x35')](_0x2011('0x7b'),_0x5dd881[_0x2011('0x37')],util['inspect'](_0x5dd881,{'showHidden':![],'depth':null}));if(this[_0x2011('0x18')][_0x5dd881['uniqueid']]&&_0x5dd881[_0x2011('0x3e')]!=_0x2011('0x49')){if(this['isNotNull'](_0x5dd881[_0x2011('0x7c')])){if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')]['mixmonitor_filename'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5dd881[_0x2011('0x37')],_0x5dd881[_0x2011('0x7d')]);this['syncMixMonitorFilename'](_0x5dd881[_0x2011('0x37')],_0x5dd881[_0x2011('0x7d')]);}else if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')][_0x2011('0x7e')])){logger[_0x2011('0x2b')](_0x2011('0x7f'),_0x5dd881[_0x2011('0x37')],_0x5dd881['value']);this[_0x2011('0x18')][_0x5dd881[_0x2011('0x37')]]['calleridnum']=_0x5dd881[_0x2011('0x7d')];}else if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')][_0x2011('0x80')])){logger[_0x2011('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x5dd881[_0x2011('0x37')],_0x5dd881[_0x2011('0x7d')]);this[_0x2011('0x18')][_0x5dd881['uniqueid']]['callerid']=_0x5dd881[_0x2011('0x7d')];}else if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')]['xmd-cdrtype'])){logger['info'](_0x2011('0x81'),_0x5dd881[_0x2011('0x37')],_0x5dd881[_0x2011('0x7d')]);this[_0x2011('0x18')][_0x5dd881['uniqueid']][_0x2011('0x62')]=_0x5dd881[_0x2011('0x7d')];}else if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')][_0x2011('0x82')])){logger[_0x2011('0x2b')](_0x2011('0x83'),_0x5dd881[_0x2011('0x37')],_0x5dd881[_0x2011('0x7d')][_0x2011('0x3f')](',')[0x0]);this[_0x2011('0x18')][_0x5dd881[_0x2011('0x37')]]['queue']=_0x5dd881[_0x2011('0x7d')][_0x2011('0x3f')](',')[0x0];}else if(this[_0x2011('0x2f')](_0x5dd881['variable']['xmd-originatecalleridnum'])){logger[_0x2011('0x2b')](_0x2011('0x84'),_0x5dd881[_0x2011('0x37')],_0x5dd881[_0x2011('0x7d')]);this[_0x2011('0x18')][_0x5dd881[_0x2011('0x37')]]['originatecalleridnum']=_0x5dd881['value'];}else if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')][_0x2011('0x85')])){logger['info'](_0x2011('0x86'),_0x5dd881[_0x2011('0x37')],_0x5dd881[_0x2011('0x7d')]);this[_0x2011('0x18')][_0x5dd881[_0x2011('0x37')]]['destination']=_0x5dd881['value'];}else if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')][_0x2011('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x5dd881['uniqueid'],_0x5dd881[_0x2011('0x7d')]);this[_0x2011('0x18')][_0x5dd881['uniqueid']][_0x2011('0x88')]=_0x5dd881[_0x2011('0x7d')];}else if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')][_0x2011('0x89')])){logger[_0x2011('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x5dd881[_0x2011('0x37')],_0x5dd881[_0x2011('0x7d')]);this[_0x2011('0x18')][_0x5dd881[_0x2011('0x37')]][_0x2011('0xc')]=_0x5dd881[_0x2011('0x7d')];}else if(this['isNotNull'](_0x5dd881[_0x2011('0x7c')][_0x2011('0x8a')])){logger['info'](_0x2011('0x8b'),_0x5dd881['uniqueid'],_0x5dd881[_0x2011('0x7d')]);this[_0x2011('0x18')][_0x5dd881[_0x2011('0x37')]][_0x2011('0x8c')]=_0x5dd881['value'];}}}else if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')][_0x2011('0x8d')])){if(_0x5dd881[_0x2011('0x7d')]){var _0x26dd1b=path[_0x2011('0x8e')](_0x5dd881[_0x2011('0x7d')])['name'];logger['info'](_0x2011('0x8f'),_0x26dd1b,_0x5dd881['value']);this['syncMixMonitorFilename'](_0x26dd1b,_0x5dd881[_0x2011('0x7d')]);}}else if(this[_0x2011('0x18')][_0x5dd881[_0x2011('0x38')]]){if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')])){if(this[_0x2011('0x2f')](_0x5dd881[_0x2011('0x7c')][_0x2011('0x8a')])){logger[_0x2011('0x2b')](_0x2011('0x8b'),_0x5dd881['linkedid'],_0x5dd881[_0x2011('0x7d')]);this[_0x2011('0x18')][_0x5dd881[_0x2011('0x38')]]['sipcalllinkedid']=_0x5dd881[_0x2011('0x7d')];}}}}}catch(_0x42c489){logger[_0x2011('0x47')]('[%s][voiceCallReport][varset]',_0x5dd881[_0x2011('0x37')],util[_0x2011('0x2e')](_0x42c489,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2011('0x90')]=function(_0x3ff16f){try{if(this['isNotNull'](_0x3ff16f)){logger['debug'](_0x2011('0x91'),_0x3ff16f['uniqueid'],util['inspect'](_0x3ff16f,{'showHidden':![],'depth':null}));if(this[_0x2011('0x1a')][_0x3ff16f['linkedid']]){if(this['channels'][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x38')]]){this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f['linkedid']][_0x2011('0x38')]]['uniqueid']=_0x3ff16f[_0x2011('0x37')];this[_0x2011('0x18')][this['blindTransfers'][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x38')]][_0x2011('0x66')]=this['channels'][_0x3ff16f['uniqueid']][_0x2011('0x66')];this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x38')]][_0x2011('0x67')]=this[_0x2011('0x18')][_0x3ff16f['uniqueid']][_0x2011('0x67')];this['channels'][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x38')]][_0x2011('0x6a')]=this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]]['linkedid']]['channel'];this['channels'][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x38')]][_0x2011('0x5c')]=this['channels'][_0x3ff16f['uniqueid']][_0x2011('0x5c')];this[_0x2011('0x18')][_0x3ff16f[_0x2011('0x37')]]=this['channels'][this[_0x2011('0x1a')][_0x3ff16f['linkedid']][_0x2011('0x38')]];this[_0x2011('0x92')](this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x38')]);}else if(this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x37')]]){this['channels'][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x37')]][_0x2011('0x37')]=[this['channels'][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x37')]][_0x2011('0x38')],this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f['linkedid']][_0x2011('0x37')]][_0x2011('0x38')]=this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f['linkedid']]['uniqueid']][_0x2011('0x37')]][0x0];this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]]['uniqueid']][_0x2011('0x66')]=this['channels'][_0x3ff16f[_0x2011('0x37')]]['answered'];this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f['linkedid']][_0x2011('0x37')]][_0x2011('0x67')]=this[_0x2011('0x18')][_0x3ff16f[_0x2011('0x37')]][_0x2011('0x67')];this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x37')]][_0x2011('0x6a')]=this['channels'][this[_0x2011('0x1a')][_0x3ff16f['linkedid']][_0x2011('0x37')]][_0x2011('0x3e')];this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f['linkedid']]['uniqueid']][_0x2011('0x5c')]=this[_0x2011('0x18')][_0x3ff16f[_0x2011('0x37')]][_0x2011('0x5c')];this[_0x2011('0x18')][_0x3ff16f[_0x2011('0x37')]]=this[_0x2011('0x18')][this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]]['uniqueid']];this[_0x2011('0x92')](this[_0x2011('0x1a')][_0x3ff16f[_0x2011('0x38')]][_0x2011('0x37')]);}}if(this[_0x2011('0x18')][_0x3ff16f[_0x2011('0x37')]]){logger[_0x2011('0x2b')](_0x2011('0x93'),_0x3ff16f[_0x2011('0x37')],_0x3ff16f['cause-txt']);var _0x45cf9b=moment();this[_0x2011('0x18')][_0x3ff16f[_0x2011('0x37')]][_0x2011('0x94')]=_0x45cf9b[_0x2011('0x42')](_0x2011('0x4d'));this[_0x2011('0x18')][_0x3ff16f['uniqueid']]['duration']=_0x45cf9b['diff'](this[_0x2011('0x18')][_0x3ff16f[_0x2011('0x37')]][_0x2011('0x4c')],_0x2011('0x5b'));if(this[_0x2011('0x18')][_0x3ff16f['uniqueid']][_0x2011('0x66')]){this['channels'][_0x3ff16f[_0x2011('0x37')]][_0x2011('0x95')]=_0x45cf9b[_0x2011('0x6e')](this[_0x2011('0x18')][_0x3ff16f[_0x2011('0x37')]][_0x2011('0x67')],_0x2011('0x5b'));this[_0x2011('0x18')][_0x3ff16f[_0x2011('0x37')]][_0x2011('0x68')]=this[_0x2011('0x18')][_0x3ff16f[_0x2011('0x37')]][_0x2011('0x59')]-this[_0x2011('0x18')][_0x3ff16f['uniqueid']][_0x2011('0x95')];}if(_0x3ff16f[_0x2011('0x3c')]===_0x2011('0x3d')){if(this[_0x2011('0x19')][_0x3ff16f[_0x2011('0x3e')][_0x2011('0x3f')]('-')[0x0]]){this['agents'][_0x3ff16f[_0x2011('0x3e')]['split']('-')[0x0]]=_[_0x2011('0x96')](this[_0x2011('0x19')][_0x3ff16f[_0x2011('0x3e')][_0x2011('0x3f')]('-')[0x0]],[_0x2011('0x50')]);logger[_0x2011('0x35')](_0x2011('0x97'),_0x3ff16f['uniqueid'],util[_0x2011('0x2e')]({'id':this[_0x2011('0x19')][_0x3ff16f[_0x2011('0x3e')][_0x2011('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0x2011('0x19')][_0x3ff16f[_0x2011('0x3e')][_0x2011('0x3f')]('-')[0x0]][_0x2011('0x46')]},{'showHidden':![],'depth':null}));this[_0x2011('0x32')](util[_0x2011('0x42')](_0x2011('0x43'),this[_0x2011('0x19')][_0x3ff16f[_0x2011('0x3e')][_0x2011('0x3f')]('-')[0x0]][_0x2011('0x44')]),_0x2011('0x98'),{'id':this[_0x2011('0x19')][_0x3ff16f[_0x2011('0x3e')][_0x2011('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0x2011('0x19')][_0x3ff16f[_0x2011('0x3e')][_0x2011('0x3f')]('-')[0x0]][_0x2011('0x46')]});for(var _0x203b57=0x0;_0x203b57{delete this['channels'][_0x297cfa];},_0x54194b);}};module[_0x2011('0xc7')]=VoiceCallReport; \ No newline at end of file +var _0xd6e0=['transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','../../../config/environment','../../../config/logger','../ami','../model/channel','../rpc/setting','set','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','inspect','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','split','match','type','isNil','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','connectedlinename','toNumber','UserId','membername','destinationchannel','from-sip','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','cause-txt','endtime','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','then','transferType','undefined','transferToInternal','stopRecordingOnTransfer','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND'];(function(_0x139dc1,_0x53c217){var _0x14926f=function(_0x59f507){while(--_0x59f507){_0x139dc1['push'](_0x139dc1['shift']());}};_0x14926f(++_0x53c217);}(_0xd6e0,0xda));var _0x0d6e=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0xd6e0[_0x4404ff];return _0x5e7b19;};'use strict';var _=require(_0x0d6e('0x0'));var moment=require(_0x0d6e('0x1'));var util=require(_0x0d6e('0x2'));var path=require(_0x0d6e('0x3'));var Redis=require('ioredis');var config=require(_0x0d6e('0x4'));var logger=require(_0x0d6e('0x5'))('ami');var ami=require(_0x0d6e('0x6'));var Channel=require(_0x0d6e('0x7'));var RpcSetting=require(_0x0d6e('0x8'));var applications=[_0x0d6e('0x9'),'queue','agi',_0x0d6e('0xa'),_0x0d6e('0xb'),_0x0d6e('0xc')];var dispositions=[_0x0d6e('0xd'),'FAILED',_0x0d6e('0xe'),_0x0d6e('0xd'),'NO\x20ANSWER',_0x0d6e('0xd'),_0x0d6e('0xf'),'BUSY','FAILED','FAILED',_0x0d6e('0xe')];config['redis']=_[_0x0d6e('0x10')](config[_0x0d6e('0x11')],{'host':_0x0d6e('0x12'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0d6e('0x11')]));function VoiceCallReport(_0x5bc55d){this[_0x0d6e('0x13')]=_0x5bc55d['channels'];this[_0x0d6e('0x14')]=_0x5bc55d['agents'];this[_0x0d6e('0x15')]={};ami['on'](_0x0d6e('0x16'),this[_0x0d6e('0x17')][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x19'),this[_0x0d6e('0x17')][_0x0d6e('0x18')](this));ami['on']('newchannel',this[_0x0d6e('0x1a')][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x1b'),this[_0x0d6e('0x1c')][_0x0d6e('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x1d'),this[_0x0d6e('0x1e')][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x1f'),this[_0x0d6e('0x20')][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x21'),this[_0x0d6e('0x22')][_0x0d6e('0x18')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x0d6e('0x18')](this));ami['on'](_0x0d6e('0x23'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x0d6e('0x24'),this['syncMusicOnHoldStop'][_0x0d6e('0x18')](this));try{logger[_0x0d6e('0x25')](_0x0d6e('0x26'));ami['actionCoreShowChannels']();}catch(_0x21b160){logger[_0x0d6e('0x27')](_0x0d6e('0x28'),util['inspect'](_0x21b160,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x2a')]=function(_0x2b7e6b){return _0x2b7e6b!==null&&!_[_0x0d6e('0x2b')](_0x2b7e6b);};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x2c')]=function(_0x3fa265,_0x4f12d1,_0x5595b5){io['to'](_0x3fa265)[_0x0d6e('0x2c')](_0x4f12d1,_0x5595b5);};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x20')]=function(_0x1125c0){try{if(this['isNotNull'](_0x1125c0)){logger[_0x0d6e('0x25')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x1125c0[_0x0d6e('0x2d')],_0x1125c0[_0x0d6e('0x2e')],_0x1125c0[_0x0d6e('0x2f')]);logger[_0x0d6e('0x30')](_0x0d6e('0x31'),_0x1125c0[_0x0d6e('0x2d')],util['inspect'](_0x1125c0,{'showHidden':![],'depth':null}));if(_0x1125c0[_0x0d6e('0x2d')]===_0x1125c0[_0x0d6e('0x32')]){if(!_[_0x0d6e('0x2b')](this[_0x0d6e('0x13')][_0x1125c0['uniqueid']])){_[_0x0d6e('0x33')](this[_0x0d6e('0x13')][_0x1125c0['uniqueid']],_[_0x0d6e('0x34')](_0x1125c0,_[_0x0d6e('0x35')](this['channels'][_0x1125c0[_0x0d6e('0x2d')]])));}}if(_0x1125c0[_0x0d6e('0x36')]==='from-sip'){var _0x148801=this['agents'][_0x1125c0['channel']['split']('-')[0x0]];if(_0x148801){if(_0x1125c0[_0x0d6e('0x37')]==_0x0d6e('0x38')){_0x148801[_0x0d6e('0x39')]=_0x1125c0[_0x0d6e('0x3a')];this['emit'](util[_0x0d6e('0x3b')](_0x0d6e('0x3c'),_0x148801[_0x0d6e('0x3d')]),_0x0d6e('0x3e'),{'id':_0x148801['id'],'destaccountcode':_0x148801[_0x0d6e('0x3f')],'destconnectedlinenum':_0x1125c0[_0x0d6e('0x3a')]});}}}}}catch(_0x11e701){logger[_0x0d6e('0x27')](_0x0d6e('0x40'),_0x1125c0[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x11e701,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x1a')]=function(_0x1d5b3e){try{if(this[_0x0d6e('0x2a')](_0x1d5b3e)){logger['debug'](_0x0d6e('0x42'),_0x1d5b3e['uniqueid'],util[_0x0d6e('0x41')](_0x1d5b3e,{'showHidden':![],'depth':null}));if(this['channels'][_0x1d5b3e[_0x0d6e('0x2d')]]){return;}if(_0x1d5b3e[_0x0d6e('0x43')]===_0x0d6e('0x44')){return;}if(_0x1d5b3e[_0x0d6e('0x2d')]!==_0x1d5b3e[_0x0d6e('0x32')]&&!this[_0x0d6e('0x15')][_0x1d5b3e['linkedid']]){return;}logger[_0x0d6e('0x25')](_0x0d6e('0x45'),_0x1d5b3e[_0x0d6e('0x2d')],_0x1d5b3e[_0x0d6e('0x36')],_0x1d5b3e['exten']);this['channels'][_0x1d5b3e[_0x0d6e('0x2d')]]=new Channel();this[_0x0d6e('0x13')][_0x1d5b3e[_0x0d6e('0x2d')]][_0x0d6e('0x46')]=moment()['format'](_0x0d6e('0x47'));this[_0x0d6e('0x13')][_0x1d5b3e[_0x0d6e('0x2d')]][_0x0d6e('0x48')]=dispositions[_['toNumber'](_0x1d5b3e[_0x0d6e('0x49')])];_[_0x0d6e('0x33')](this[_0x0d6e('0x13')][_0x1d5b3e[_0x0d6e('0x2d')]],_[_0x0d6e('0x34')](_0x1d5b3e,_[_0x0d6e('0x35')](this[_0x0d6e('0x13')][_0x1d5b3e['uniqueid']])));if(_0x1d5b3e[_0x0d6e('0x36')]==='from-sip'){var _0x55658b=this[_0x0d6e('0x14')][_0x1d5b3e['channel']['split']('-')[0x0]];if(_0x55658b&&typeof _0x55658b[_0x0d6e('0x39')]==='undefined'){_0x55658b[_0x0d6e('0x39')]=_0x1d5b3e[_0x0d6e('0x37')];logger[_0x0d6e('0x30')](_0x0d6e('0x4a'),_0x1d5b3e[_0x0d6e('0x2d')],util[_0x0d6e('0x41')]({'id':_0x55658b['id'],'destaccountcode':_0x55658b[_0x0d6e('0x3f')],'destconnectedlinenum':_0x1d5b3e[_0x0d6e('0x37')]},{'showHidden':![],'depth':null}));this[_0x0d6e('0x2c')](util['format'](_0x0d6e('0x3c'),_0x55658b[_0x0d6e('0x3d')]),_0x0d6e('0x3e'),{'id':_0x55658b['id'],'destaccountcode':_0x55658b[_0x0d6e('0x3f')],'destconnectedlinenum':_0x1d5b3e['exten']});}}}}catch(_0x1fa4e6){logger[_0x0d6e('0x27')]('[%s][voiceCallReport][newchannel]',_0x1d5b3e[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x1fa4e6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')]['syncNewExten']=function(_0x2f3982){try{if(this['isNotNull'](_0x2f3982)){logger[_0x0d6e('0x30')](_0x0d6e('0x4b'),_0x2f3982[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x2f3982,{'showHidden':![],'depth':null}));if(_0x2f3982[_0x0d6e('0x43')]==='OutgoingSpoolFailed'||_0x2f3982[_0x0d6e('0x37')]==='h')return;if(_0x2f3982[_0x0d6e('0x2d')]===_0x2f3982[_0x0d6e('0x32')]||this[_0x0d6e('0x15')][_0x2f3982[_0x0d6e('0x32')]]){_0x2f3982[_0x0d6e('0x4c')]=_0x2f3982['application']?_0x2f3982['application'][_0x0d6e('0x4d')]():undefined;_0x2f3982[_0x0d6e('0x4e')]=_0x2f3982[_0x0d6e('0x4f')]||_0x2f3982[_0x0d6e('0x4e')];if(_0x2f3982[_0x0d6e('0x4f')]&&_0x2f3982[_0x0d6e('0x4c')]!==_0x0d6e('0x50')){_0x2f3982[_0x0d6e('0x4e')]=_0x2f3982['applicationdata'][_0x0d6e('0x4d')]();}logger[_0x0d6e('0x25')](_0x0d6e('0x51'),_0x2f3982[_0x0d6e('0x2d')],_0x2f3982[_0x0d6e('0x4c')],_0x2f3982['applicationdata']);if(_['isUndefined'](this['channels'][_0x2f3982[_0x0d6e('0x2d')]])){this[_0x0d6e('0x13')][_0x2f3982['uniqueid']]=new Channel();this[_0x0d6e('0x13')][_0x2f3982[_0x0d6e('0x2d')]]['starttime']=_0x2f3982['duration']?moment()[_0x0d6e('0x52')](moment['duration'](_0x2f3982[_0x0d6e('0x53')])['seconds'](),_0x0d6e('0x54'))[_0x0d6e('0x3b')](_0x0d6e('0x47')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0d6e('0x13')][_0x2f3982[_0x0d6e('0x2d')]][_0x0d6e('0x48')]=_0x0d6e('0xd');}_[_0x0d6e('0x33')](this['channels'][_0x2f3982['uniqueid']],_['pick'](_0x2f3982,_[_0x0d6e('0x35')](this[_0x0d6e('0x13')][_0x2f3982['uniqueid']])));if(_[_0x0d6e('0x55')](applications,_0x2f3982[_0x0d6e('0x4c')])){this[_0x0d6e('0x13')][_0x2f3982['uniqueid']][_0x0d6e('0x56')]=_0x2f3982['application'];this[_0x0d6e('0x13')][_0x2f3982['uniqueid']][_0x0d6e('0x57')]=_0x2f3982['applicationdata'];if(_0x2f3982[_0x0d6e('0x4c')]===_0x0d6e('0x9')&&_[_0x0d6e('0x58')](_0x2f3982[_0x0d6e('0x4e')][_0x0d6e('0x4d')](),_0x0d6e('0x59'))){var _0x1c3866=_0x2f3982[_0x0d6e('0x4e')][_0x0d6e('0x5a')]('=');var _0x5922dd=_0x1c3866[0x0][_0x0d6e('0x4d')]()[_0x0d6e('0x5b')](/cdr\((.*)\)/);if(_0x5922dd){if(_0x5922dd[0x1]===_0x0d6e('0x5c')&&!_[_0x0d6e('0x5d')](this['channels'][_0x2f3982[_0x0d6e('0x2d')]][_0x5922dd[0x1]]))return;this[_0x0d6e('0x13')][_0x2f3982[_0x0d6e('0x2d')]][_0x5922dd[0x1]]=_0x1c3866[0x1];}}else if(_0x2f3982['application']===_0x0d6e('0x50')){this[_0x0d6e('0x13')][_0x2f3982[_0x0d6e('0x2d')]]['queue']=_0x2f3982['applicationdata'][_0x0d6e('0x5a')](',')[0x0];}}}}}catch(_0x360c98){logger['error']('[%s][voiceCallReport][newexten]',_0x2f3982['uniqueid'],util[_0x0d6e('0x41')](_0x360c98,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x1143c9){try{if(this[_0x0d6e('0x2a')](_0x1143c9)){logger[_0x0d6e('0x25')](_0x0d6e('0x5e'),_0x1143c9['uniqueid'],_0x1143c9['linkedid'],_0x1143c9['calleridname'],_0x1143c9[_0x0d6e('0x2f')]);logger[_0x0d6e('0x30')](_0x0d6e('0x5f'),_0x1143c9['uniqueid'],util[_0x0d6e('0x41')](_0x1143c9,{'showHidden':![],'depth':null}));if(_0x1143c9[_0x0d6e('0x49')]!=='6')return;var _0x504b2a=this[_0x0d6e('0x14')][_0x1143c9[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]];if(_0x1143c9[_0x0d6e('0x2d')]!==_0x1143c9[_0x0d6e('0x32')]){var _0x58a48c=moment();if(this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]]){if(!this['channels'][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x60')]){this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]]['answered']=!![];this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x61')]=_0x58a48c['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]]['starttime']){this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]]['holdtime']=_0x58a48c[_0x0d6e('0x62')](this[_0x0d6e('0x13')][_0x1143c9['linkedid']][_0x0d6e('0x46')],_0x0d6e('0x54'));}}this['channels'][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x32')]=_0x1143c9[_0x0d6e('0x2d')];if(_0x1143c9['calleridnum']!==_0x0d6e('0x38')){this[_0x0d6e('0x13')][_0x1143c9['linkedid']][_0x0d6e('0x3a')]=_0x1143c9[_0x0d6e('0x2f')];}this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x63')]=_0x1143c9[_0x0d6e('0x2e')];this[_0x0d6e('0x13')][_0x1143c9['linkedid']]['destinationchannel']=_0x1143c9['channel'];this[_0x0d6e('0x13')][_0x1143c9['linkedid']]['disposition']=dispositions[_[_0x0d6e('0x64')](_0x1143c9[_0x0d6e('0x49')])];if(_0x504b2a){this['channels'][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x65')]=_0x504b2a['id'];this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]][_0x0d6e('0x66')]=_0x504b2a[_0x0d6e('0x3d')];}}if(this['channels'][_0x1143c9['uniqueid']]){if(!this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x60')]){this[_0x0d6e('0x13')][_0x1143c9['uniqueid']][_0x0d6e('0x60')]=!![];this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]]['answertime']=_0x58a48c['format'](_0x0d6e('0x47'));if(this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x46')]){this['channels'][_0x1143c9[_0x0d6e('0x2d')]]['holdtime']=_0x58a48c[_0x0d6e('0x62')](this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x46')],'seconds');}}if(_0x1143c9['calleridnum']!==_0x0d6e('0x38')){this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x3a')]=_0x1143c9[_0x0d6e('0x2f')];}this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x63')]=_0x1143c9[_0x0d6e('0x2e')];this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x67')]=_0x1143c9[_0x0d6e('0x43')];this[_0x0d6e('0x13')][_0x1143c9['uniqueid']][_0x0d6e('0x48')]=dispositions[_['toNumber'](_0x1143c9['channelstate'])];}}else{if(this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]]){if(_0x504b2a){this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x65')]=_0x504b2a['id'];this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x2d')]]['membername']=_0x504b2a[_0x0d6e('0x3d')];}}}if(_0x1143c9['context']===_0x0d6e('0x68')){if(_0x504b2a){_0x504b2a[_0x0d6e('0x39')]=_0x1143c9[_0x0d6e('0x37')];var _0x5e0cc3;if(this['channels'][_0x1143c9[_0x0d6e('0x2d')]]){_0x5e0cc3=this['channels'][_0x1143c9[_0x0d6e('0x2d')]][_0x0d6e('0x50')];}else if(this[_0x0d6e('0x13')][_0x1143c9[_0x0d6e('0x32')]]){_0x5e0cc3=this[_0x0d6e('0x13')][_0x1143c9['linkedid']][_0x0d6e('0x50')];}_0x504b2a[_0x0d6e('0x50')]=_0x5e0cc3;var _0x13aaf9={'id':_0x504b2a['id'],'name':_0x504b2a[_0x0d6e('0x3d')],'agentconnected':!![],'destaccountcode':_0x504b2a['accountcode'],'destconnectedlinenum':_0x1143c9[_0x0d6e('0x37')],'queue':_0x5e0cc3||undefined,'uniqueid':_0x1143c9[_0x0d6e('0x32')]};logger[_0x0d6e('0x30')](_0x0d6e('0x69'),_0x1143c9[_0x0d6e('0x2d')],util['inspect'](_0x13aaf9,{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x504b2a['name']),_0x0d6e('0x3e'),_0x13aaf9);}}}}catch(_0x5cdfd7){logger[_0x0d6e('0x27')](_0x0d6e('0x6a'),_0x1143c9[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x5cdfd7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x6b')]=function(_0x51166b,_0x591ac4){try{if(this[_0x0d6e('0x13')][_0x51166b]){logger[_0x0d6e('0x25')](_0x0d6e('0x6c'),_0x51166b,_0x591ac4);this[_0x0d6e('0x13')][_0x51166b][_0x0d6e('0x6d')]=!![];if(_[_0x0d6e('0x6e')](_0x591ac4,_0x0d6e('0x6f'))){_0x591ac4=_0x591ac4[_0x0d6e('0x70')](_0x0d6e('0x6f'),_0x0d6e('0x71'));}this['channels'][_0x51166b]['monitorFilename']=_0x591ac4;var _0x24bf8c=_[_0x0d6e('0x72')](this[_0x0d6e('0x13')][_0x51166b]['monitors'],{'filename':_0x591ac4});if(_[_0x0d6e('0x5d')](_0x24bf8c)){this['channels'][_0x51166b][_0x0d6e('0x73')]['push']({'filename':_0x591ac4,'createdAt':moment()[_0x0d6e('0x3b')](_0x0d6e('0x47')),'mixmonitorid':'','status':_0x0d6e('0x74')});}}}catch(_0x4f051e){logger['error'](_0x0d6e('0x75'),_0x51166b,util['inspect'](_0x4f051e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')]['syncVarSet']=function(_0xea1254){try{if(this[_0x0d6e('0x2a')](_0xea1254)){logger['debug'](_0x0d6e('0x76'),_0xea1254[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0xea1254,{'showHidden':![],'depth':null}));if(this['channels'][_0xea1254[_0x0d6e('0x2d')]]&&_0xea1254[_0x0d6e('0x43')]!=_0x0d6e('0x44')){if(this['isNotNull'](_0xea1254['variable'])){if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x78')])){logger[_0x0d6e('0x25')](_0x0d6e('0x79'),_0xea1254['uniqueid'],_0xea1254['value']);this[_0x0d6e('0x6b')](_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')]);}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')]['xmd-phone'])){logger[_0x0d6e('0x25')](_0x0d6e('0x7b'),_0xea1254['uniqueid'],_0xea1254[_0x0d6e('0x7a')]);this[_0x0d6e('0x13')][_0xea1254['uniqueid']][_0x0d6e('0x2f')]=_0xea1254[_0x0d6e('0x7a')];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x7c')])){logger['info'](_0x0d6e('0x7d'),_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')]);this['channels'][_0xea1254[_0x0d6e('0x2d')]]['callerid']=_0xea1254['value'];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x7e')])){logger[_0x0d6e('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')]);this['channels'][_0xea1254[_0x0d6e('0x2d')]][_0x0d6e('0x5c')]=_0xea1254[_0x0d6e('0x7a')];}else if(this['isNotNull'](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x7f')])){logger[_0x0d6e('0x25')](_0x0d6e('0x80'),_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')][_0x0d6e('0x5a')](',')[0x0]);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x2d')]]['queue']=_0xea1254['value'][_0x0d6e('0x5a')](',')[0x0];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x81')])){logger[_0x0d6e('0x25')](_0x0d6e('0x82'),_0xea1254[_0x0d6e('0x2d')],_0xea1254['value']);this[_0x0d6e('0x13')][_0xea1254['uniqueid']]['originatecalleridnum']=_0xea1254['value'];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x83')])){logger[_0x0d6e('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')]);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x2d')]][_0x0d6e('0x84')]=_0xea1254[_0x0d6e('0x7a')];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x85')])){logger[_0x0d6e('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0xea1254['uniqueid'],_0xea1254[_0x0d6e('0x7a')]);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x2d')]][_0x0d6e('0x86')]=_0xea1254['value'];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x87')])){logger['info'](_0x0d6e('0x88'),_0xea1254['uniqueid'],_0xea1254['value']);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x2d')]][_0x0d6e('0x50')]=_0xea1254[_0x0d6e('0x7a')];}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x89')])){logger[_0x0d6e('0x25')](_0x0d6e('0x8a'),_0xea1254[_0x0d6e('0x2d')],_0xea1254[_0x0d6e('0x7a')]);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x2d')]][_0x0d6e('0x8b')]=_0xea1254[_0x0d6e('0x7a')];}}}else if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')]['mixmonitor_filename'])){if(_0xea1254['value']){var _0xbd602a=path[_0x0d6e('0x8c')](_0xea1254[_0x0d6e('0x7a')])[_0x0d6e('0x3d')];logger[_0x0d6e('0x25')](_0x0d6e('0x79'),_0xbd602a,_0xea1254['value']);this[_0x0d6e('0x6b')](_0xbd602a,_0xea1254[_0x0d6e('0x7a')]);}}else if(this[_0x0d6e('0x13')][_0xea1254['linkedid']]){if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')])){if(this[_0x0d6e('0x2a')](_0xea1254[_0x0d6e('0x77')][_0x0d6e('0x89')])){logger[_0x0d6e('0x25')](_0x0d6e('0x8a'),_0xea1254['linkedid'],_0xea1254[_0x0d6e('0x7a')]);this[_0x0d6e('0x13')][_0xea1254[_0x0d6e('0x32')]][_0x0d6e('0x8d')]=_0xea1254[_0x0d6e('0x7a')];}}}}}catch(_0x4450ba){logger[_0x0d6e('0x27')](_0x0d6e('0x8e'),_0xea1254[_0x0d6e('0x2d')],util[_0x0d6e('0x41')](_0x4450ba,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d6e('0x29')][_0x0d6e('0x1e')]=function(_0x41b7bb){try{if(this[_0x0d6e('0x2a')](_0x41b7bb)){logger[_0x0d6e('0x30')](_0x0d6e('0x8f'),_0x41b7bb[_0x0d6e('0x2d')],util['inspect'](_0x41b7bb,{'showHidden':![],'depth':null}));if(this[_0x0d6e('0x15')][_0x41b7bb['linkedid']]){if(this[_0x0d6e('0x13')][this['blindTransfers'][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x32')]]){this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb['linkedid']]['linkedid']][_0x0d6e('0x2d')]=_0x41b7bb[_0x0d6e('0x2d')];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb['linkedid']]['linkedid']][_0x0d6e('0x60')]=this[_0x0d6e('0x13')][_0x41b7bb['uniqueid']][_0x0d6e('0x60')];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x32')]]['answertime']=this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x61')];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb['linkedid']][_0x0d6e('0x32')]][_0x0d6e('0x67')]=this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x32')]][_0x0d6e('0x43')];this['channels'][this['blindTransfers'][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x32')]][_0x0d6e('0x48')]=this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x48')];this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]=this[_0x0d6e('0x13')][this['blindTransfers'][_0x41b7bb['linkedid']][_0x0d6e('0x32')]];this[_0x0d6e('0x90')](this[_0x0d6e('0x15')][_0x41b7bb['linkedid']][_0x0d6e('0x32')]);}else if(this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]]['uniqueid']]){this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x2d')]=[this['channels'][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x32')],this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x32')]=this[_0x0d6e('0x13')][this['blindTransfers'][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x2d')]][0x0];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]]['uniqueid']]['answered']=this[_0x0d6e('0x13')][_0x41b7bb['uniqueid']]['answered'];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x61')]=this[_0x0d6e('0x13')][_0x41b7bb['uniqueid']][_0x0d6e('0x61')];this[_0x0d6e('0x13')][this['blindTransfers'][_0x41b7bb[_0x0d6e('0x32')]]['uniqueid']][_0x0d6e('0x67')]=this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]][_0x0d6e('0x43')];this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb['linkedid']][_0x0d6e('0x2d')]]['disposition']=this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x48')];this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]=this[_0x0d6e('0x13')][this[_0x0d6e('0x15')][_0x41b7bb['linkedid']][_0x0d6e('0x2d')]];this[_0x0d6e('0x90')](this['blindTransfers'][_0x41b7bb[_0x0d6e('0x32')]][_0x0d6e('0x2d')]);}}if(this['channels'][_0x41b7bb[_0x0d6e('0x2d')]]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x41b7bb[_0x0d6e('0x2d')],_0x41b7bb[_0x0d6e('0x91')]);var _0x59bd04=moment();this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x92')]=_0x59bd04[_0x0d6e('0x3b')](_0x0d6e('0x47'));this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]['duration']=_0x59bd04['diff'](this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]['starttime'],'seconds');if(this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x60')]){this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x93')]=_0x59bd04[_0x0d6e('0x62')](this[_0x0d6e('0x13')][_0x41b7bb['uniqueid']][_0x0d6e('0x61')],_0x0d6e('0x54'));this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x94')]=this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]]['duration']-this[_0x0d6e('0x13')][_0x41b7bb[_0x0d6e('0x2d')]][_0x0d6e('0x93')];}if(_0x41b7bb[_0x0d6e('0x36')]===_0x0d6e('0x68')){if(this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')]['split']('-')[0x0]]){this[_0x0d6e('0x14')][_0x41b7bb['channel'][_0x0d6e('0x5a')]('-')[0x0]]=_[_0x0d6e('0x95')](this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]],[_0x0d6e('0x39')]);logger['debug'](_0x0d6e('0x96'),_0x41b7bb[_0x0d6e('0x2d')],util['inspect']({'id':this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]]['id'],'destaccountcode':this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]][_0x0d6e('0x3f')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x0d6e('0x3b')](_0x0d6e('0x3c'),this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]][_0x0d6e('0x3d')]),_0x0d6e('0x97'),{'id':this[_0x0d6e('0x14')][_0x41b7bb[_0x0d6e('0x43')][_0x0d6e('0x5a')]('-')[0x0]]['id'],'destaccountcode':this[_0x0d6e('0x14')][_0x41b7bb['channel']['split']('-')[0x0]][_0x0d6e('0x3f')]});for(var _0x33ceb0=0x0;_0x33ceb0{delete this[_0x0d6e('0x13')][_0x57577a];},_0x2a34da);}};module[_0x0d6e('0xcb')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 70e8758..3aa2a69 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f1b=['interface','applications','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','inspect','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','format','endtime','diff','starttime','seconds','complete','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','application','set','appdata','applicationdata','toLowerCase','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','variables','bind','dialend','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','substring','channel','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername'];(function(_0x4bd254,_0x347d7a){var _0x3dcead=function(_0x4b5594){while(--_0x4b5594){_0x4bd254['push'](_0x4bd254['shift']());}};_0x3dcead(++_0x347d7a);}(_0x2f1b,0xd2));var _0xb2f1=function(_0x421184,_0x2a0388){_0x421184=_0x421184-0x0;var _0x3623b1=_0x2f1b[_0x421184];return _0x3623b1;};'use strict';var _=require(_0xb2f1('0x0'));var moment=require(_0xb2f1('0x1'));var util=require(_0xb2f1('0x2'));var Redis=require(_0xb2f1('0x3'));var config=require(_0xb2f1('0x4'));var logger=require(_0xb2f1('0x5'))('ami');var ami=require(_0xb2f1('0x6'));config[_0xb2f1('0x7')]=_[_0xb2f1('0x8')](config['redis'],{'host':_0xb2f1('0x9'),'port':0x18eb});var io=require(_0xb2f1('0xa'))(new Redis(config[_0xb2f1('0x7')]));function VoiceDialReport(_0x51acca){this[_0xb2f1('0xb')]=_0x51acca['outboundChannels'];this['outbound']=_0x51acca[_0xb2f1('0xc')];this['applications']={};this[_0xb2f1('0xd')]={};ami['on']('dialbegin',this['syncDialBegin'][_0xb2f1('0xe')](this));ami['on'](_0xb2f1('0xf'),this['syncDialEnd'][_0xb2f1('0xe')](this));ami['on'](_0xb2f1('0x10'),this[_0xb2f1('0x11')][_0xb2f1('0xe')](this));ami['on'](_0xb2f1('0x12'),this[_0xb2f1('0x13')][_0xb2f1('0xe')](this));}VoiceDialReport[_0xb2f1('0x14')]['isNotNull']=function(_0x20ec3e){return _0x20ec3e!==null&&!_[_0xb2f1('0x15')](_0x20ec3e);};VoiceDialReport['prototype'][_0xb2f1('0x16')]=function(_0x5cff89,_0x108f6b,_0x444323){io['to'](_0x5cff89)[_0xb2f1('0x16')](_0x108f6b,_0x444323);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x330288){try{if(this[_0xb2f1('0x17')](_0x330288)){logger[_0xb2f1('0x18')](_0xb2f1('0x19'),_0x330288[_0xb2f1('0x1a')],util['inspect'](_0x330288,{'showHidden':![],'depth':null}));if(this[_0xb2f1('0xb')][_0x330288[_0xb2f1('0x1a')]]){_[_0xb2f1('0x1b')](this['channels'][_0x330288['uniqueid']],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x330288['channel'][_0xb2f1('0x1c')](0x0,_0x330288[_0xb2f1('0x1d')][_0xb2f1('0x1e')]('-')),'membername':_0x330288[_0xb2f1('0x1d')]['substring'](_0x330288[_0xb2f1('0x1d')][_0xb2f1('0x1e')]('/')+0x1,_0x330288['channel']['lastIndexOf']('-'))},_[_0xb2f1('0x1f')](_0x330288,[_0xb2f1('0x20'),_0xb2f1('0x21')]));logger['info'](_0xb2f1('0x22'),_0x330288[_0xb2f1('0x1a')],this['channels'][_0x330288[_0xb2f1('0x1a')]][_0xb2f1('0x23')],this['channels'][_0x330288[_0xb2f1('0x1a')]][_0xb2f1('0x24')]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x330288[_0xb2f1('0x1a')],util['inspect'](this[_0xb2f1('0xb')][_0x330288[_0xb2f1('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0xb2f1('0x25')][_0x330288['uniqueid']])_[_0xb2f1('0x1b')](this[_0xb2f1('0xb')][_0x330288[_0xb2f1('0x1a')]],this[_0xb2f1('0x25')][_0x330288[_0xb2f1('0x1a')]]);this['emit'](_0xb2f1('0x26'),_0xb2f1('0x27'),this['channels'][_0x330288[_0xb2f1('0x1a')]]);logger[_0xb2f1('0x18')](_0xb2f1('0x28'),_0x330288[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](this[_0xb2f1('0xb')][_0x330288[_0xb2f1('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xb2f1('0x16')](_0xb2f1('0x2a'),this[_0xb2f1('0xb')][_0x330288[_0xb2f1('0x1a')]]);}}}catch(_0x402f96){logger[_0xb2f1('0x2b')](_0xb2f1('0x2c'),_0x330288['uniqueid'],util[_0xb2f1('0x29')](_0x402f96,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb2f1('0x14')][_0xb2f1('0x2d')]=function(_0x52596e){try{if(this[_0xb2f1('0x17')](_0x52596e)){logger['debug']('[%s][voiceDialReport][dialend]\x20event:',_0x52596e[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](_0x52596e,{'showHidden':![],'depth':null}));if(this[_0xb2f1('0xb')][_0x52596e['uniqueid']]){this[_0xb2f1('0xb')][_0x52596e[_0xb2f1('0x1a')]]['dialstatus']=_0x52596e[_0xb2f1('0x2e')];if(_0x52596e[_0xb2f1('0x2e')]===_0xb2f1('0x2f')){this['channels'][_0x52596e[_0xb2f1('0x1a')]][_0xb2f1('0x30')]=_0x52596e[_0xb2f1('0x30')];this['channels'][_0x52596e[_0xb2f1('0x1a')]][_0xb2f1('0x31')]=_0x52596e[_0xb2f1('0x31')];this[_0xb2f1('0xb')][_0x52596e[_0xb2f1('0x1a')]][_0xb2f1('0x32')]=moment()['format'](_0xb2f1('0x33'));this[_0xb2f1('0xb')][_0x52596e[_0xb2f1('0x1a')]][_0xb2f1('0x34')]=_0xb2f1('0x35');logger[_0xb2f1('0x36')](_0xb2f1('0x37'),_0x52596e['uniqueid'],_0x52596e[_0xb2f1('0x1d')][_0xb2f1('0x1c')](_0x52596e['channel'][_0xb2f1('0x1e')]('/')+0x1,_0x52596e[_0xb2f1('0x1d')][_0xb2f1('0x1e')]('-')));logger[_0xb2f1('0x18')](_0xb2f1('0x38'),_0x52596e[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](this[_0xb2f1('0xb')][_0x52596e[_0xb2f1('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xb2f1('0x16')](_0xb2f1('0x39'),this['channels'][_0x52596e['uniqueid']]);}logger[_0xb2f1('0x18')](_0xb2f1('0x3a'),_0x52596e[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](this['channels'][_0x52596e[_0xb2f1('0x1a')]],{'showHidden':![],'depth':null}));this[_0xb2f1('0x16')](_0xb2f1('0x26'),_0xb2f1('0x27'),this['channels'][_0x52596e[_0xb2f1('0x1a')]]);}}}catch(_0x5cf1aa){logger[_0xb2f1('0x2b')](_0xb2f1('0x3b'),_0x52596e[_0xb2f1('0x1a')],util['inspect'](_0x5cf1aa,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb2f1('0x14')][_0xb2f1('0x11')]=function(_0x49ecc2){try{if(this[_0xb2f1('0x17')](_0x49ecc2)){logger[_0xb2f1('0x18')]('[%s][voiceDialReport][varset]\x20event:',_0x49ecc2[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](_0x49ecc2,{'showHidden':![],'depth':null}));this[_0xb2f1('0x3c')](_0x49ecc2['uniqueid'],_[_0xb2f1('0x3d')](_0x49ecc2[_0xb2f1('0x3e')])[0x0],_0x49ecc2[_0xb2f1('0x3f')]);if(this[_0xb2f1('0x17')](_0x49ecc2[_0xb2f1('0x3e')])&&this['isNotNull'](_0x49ecc2[_0xb2f1('0x3e')][_0xb2f1('0x40')])){if(_[_0xb2f1('0x15')](this['channels'][_0x49ecc2[_0xb2f1('0x1a')]])){this[_0xb2f1('0xb')][_0x49ecc2[_0xb2f1('0x1a')]]={'routeId':_0x49ecc2[_0xb2f1('0x3f')],'variables':this['variables'][_0x49ecc2[_0xb2f1('0x1a')]],'motionChannel':'voice'};logger[_0xb2f1('0x36')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x49ecc2[_0xb2f1('0x1a')],_0x49ecc2['variable']['outboundrouteid'],_['keys'](_0x49ecc2['variable'])[0x0],_0x49ecc2['value']);logger[_0xb2f1('0x18')](_0xb2f1('0x41'),_0x49ecc2[_0xb2f1('0x1a')],util['inspect'](this['channels'][_0x49ecc2[_0xb2f1('0x1a')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0xb2f1('0x27'),this[_0xb2f1('0xb')][_0x49ecc2[_0xb2f1('0x1a')]]);}}}}catch(_0x3a4414){logger[_0xb2f1('0x2b')](_0xb2f1('0x42'),_0x49ecc2[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](_0x3a4414,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb2f1('0x14')][_0xb2f1('0x3c')]=function(_0x3acb0f,_0x1f8cf8,_0x1ccc4b){var _0x53d52a=['rtpaudioqos','rtpaudioqosbridged',_0xb2f1('0x43'),_0xb2f1('0x44'),_0xb2f1('0x45'),_0xb2f1('0x46'),'rtpaudioqosrtt',_0xb2f1('0x47'),_0xb2f1('0x48'),_0xb2f1('0x49'),_0xb2f1('0x4a'),_0xb2f1('0x4b'),_0xb2f1('0x4c'),_0xb2f1('0x4d'),_0xb2f1('0x4e'),'memberlastcall','membername',_0xb2f1('0x4f'),_0xb2f1('0x50')];if(!_[_0xb2f1('0x51')](_0x1f8cf8)&&!_[_0xb2f1('0x52')](_0x53d52a,_0x1f8cf8)){if(_[_0xb2f1('0x15')](this['variables'][_0x3acb0f])){this[_0xb2f1('0xd')][_0x3acb0f]={};}this[_0xb2f1('0xd')][_0x3acb0f][_0x1f8cf8]=_0x1ccc4b;}};VoiceDialReport[_0xb2f1('0x14')][_0xb2f1('0x13')]=function(_0x38c0a3){try{if(this[_0xb2f1('0x17')](_0x38c0a3)){logger[_0xb2f1('0x18')](_0xb2f1('0x53'),_0x38c0a3[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](_0x38c0a3,{'showHidden':![],'depth':null}));if(this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]]){logger['info'](_0xb2f1('0x54'),_0x38c0a3[_0xb2f1('0x1a')],_0x38c0a3[_0xb2f1('0x55')]);this['channels'][_0x38c0a3[_0xb2f1('0x1a')]]['endtime']=moment()[_0xb2f1('0x56')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]]['duration']=moment(this[_0xb2f1('0xb')][_0x38c0a3['uniqueid']][_0xb2f1('0x57')])[_0xb2f1('0x58')](this['channels'][_0x38c0a3[_0xb2f1('0x1a')]][_0xb2f1('0x59')],_0xb2f1('0x5a'));this[_0xb2f1('0xb')][_0x38c0a3['uniqueid']][_0xb2f1('0x34')]=_0xb2f1('0x5b');this[_0xb2f1('0xc')]['total']+=0x1;if(this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]]['answertime']){this[_0xb2f1('0xc')][_0xb2f1('0x5c')]+=0x1;this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]][_0xb2f1('0x5d')]=moment(this['channels'][_0x38c0a3[_0xb2f1('0x1a')]]['answertime'])[_0xb2f1('0x58')](this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]][_0xb2f1('0x59')],_0xb2f1('0x5a'));this[_0xb2f1('0xb')][_0x38c0a3['uniqueid']][_0xb2f1('0x5e')]=moment(this['channels'][_0x38c0a3[_0xb2f1('0x1a')]]['endtime'])[_0xb2f1('0x58')](this['channels'][_0x38c0a3[_0xb2f1('0x1a')]]['answertime'],_0xb2f1('0x5a'));this[_0xb2f1('0xc')][_0xb2f1('0x5f')]+=this['channels'][_0x38c0a3[_0xb2f1('0x1a')]][_0xb2f1('0x5d')]||0x0;this[_0xb2f1('0xc')][_0xb2f1('0x60')]+=this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]][_0xb2f1('0x5e')];}this[_0xb2f1('0xc')][_0xb2f1('0x61')]+=this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]][_0xb2f1('0x62')];logger[_0xb2f1('0x18')](_0xb2f1('0x63'),_0x38c0a3['uniqueid'],util[_0xb2f1('0x29')](this[_0xb2f1('0xb')][_0x38c0a3['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xb2f1('0x64'),this['channels'][_0x38c0a3[_0xb2f1('0x1a')]]);logger[_0xb2f1('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x38c0a3[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xb2f1('0x16')](_0xb2f1('0x65'),this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]]);logger[_0xb2f1('0x18')](_0xb2f1('0x66'),_0x38c0a3[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]],{'showHidden':![],'depth':null}));this[_0xb2f1('0x16')]('voice:outbound',_0xb2f1('0x67'),this['outbound']);logger[_0xb2f1('0x36')](_0xb2f1('0x68'),JSON[_0xb2f1('0x69')](this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x1a')]]));logger[_0xb2f1('0x18')](_0xb2f1('0x6a'),_0x38c0a3[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](this['channels'][_0x38c0a3[_0xb2f1('0x1a')]],{'showHidden':![],'depth':null}));this[_0xb2f1('0x16')](_0xb2f1('0x26'),_0xb2f1('0x6b'),this['channels'][_0x38c0a3[_0xb2f1('0x1a')]]);this['deleteChannelAfterTimeout'](_0x38c0a3[_0xb2f1('0x1a')]);}else if(this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x6c')]]){this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x6c')]][_0xb2f1('0x1a')]=this[_0xb2f1('0xb')][_0x38c0a3[_0xb2f1('0x6c')]][_0xb2f1('0x6d')];}if(this[_0xb2f1('0xd')][_0x38c0a3[_0xb2f1('0x1a')]]){delete this[_0xb2f1('0xd')][_0x38c0a3[_0xb2f1('0x1a')]];}}}catch(_0x309e69){logger['error'](_0xb2f1('0x6e'),_0x38c0a3[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](_0x309e69,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb2f1('0x14')][_0xb2f1('0x6f')]=function(_0x537129){try{if(this['isNotNull'](_0x537129)){logger[_0xb2f1('0x18')]('[%s][voiceDialReport][newexten]\x20event:',_0x537129['uniqueid'],util[_0xb2f1('0x29')](_0x537129,{'showHidden':![],'depth':null}));if(_0x537129[_0xb2f1('0x70')]['toLowerCase']()===_0xb2f1('0x71')){_0x537129['applicationdata']=(_0x537129[_0xb2f1('0x72')]||_0x537129[_0xb2f1('0x73')])[_0xb2f1('0x74')]();if(_[_0xb2f1('0x75')](_0x537129[_0xb2f1('0x73')],_0xb2f1('0x76'))){if(_[_0xb2f1('0x15')](this[_0xb2f1('0x25')][_0x537129[_0xb2f1('0x1a')]]))this['applications'][_0x537129[_0xb2f1('0x1a')]]={};logger['info']('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x537129[_0xb2f1('0x1a')],_0x537129[_0xb2f1('0x70')],_0x537129['applicationdata']);var _0x4ff9d1=_0x537129['applicationdata'][_0xb2f1('0x77')]('=');var _0x4ce68a=_0x4ff9d1[0x0][_0xb2f1('0x78')](/cdr\((.*)\)/);if(_0x4ce68a)this[_0xb2f1('0x25')][_0x537129[_0xb2f1('0x1a')]][_0x4ce68a[0x1]]=_0x4ff9d1[0x1];}}}}catch(_0x3b9b7b){logger[_0xb2f1('0x2b')](_0xb2f1('0x79'),_0x537129[_0xb2f1('0x1a')],util[_0xb2f1('0x29')](_0x3b9b7b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb2f1('0x14')]['deleteChannelAfterTimeout']=function(_0x138bb3,_0x41ae2d=0x2710){if(this[_0xb2f1('0xb')][_0x138bb3]){setTimeout(()=>{delete this[_0xb2f1('0xb')][_0x138bb3];},_0x41ae2d);}};module[_0xb2f1('0x7a')]=VoiceDialReport; \ No newline at end of file +var _0x8054=['[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','duration','starttime','seconds','complete','total','answered','holdtime','diff','billableseconds','endtime','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','exports','lodash','moment','../../../config/environment','../../../config/logger','ami','defaults','localhost','redis','channels','outboundChannels','outbound','applications','variables','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','debug','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect'];(function(_0x330f55,_0x529d82){var _0x5ddf3c=function(_0x9e1745){while(--_0x9e1745){_0x330f55['push'](_0x330f55['shift']());}};_0x5ddf3c(++_0x529d82);}(_0x8054,0xb6));var _0x4805=function(_0x37025e,_0x47f3e5){_0x37025e=_0x37025e-0x0;var _0x3239d7=_0x8054[_0x37025e];return _0x3239d7;};'use strict';var _=require(_0x4805('0x0'));var moment=require(_0x4805('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x4805('0x2'));var logger=require(_0x4805('0x3'))(_0x4805('0x4'));var ami=require('../ami');config['redis']=_[_0x4805('0x5')](config['redis'],{'host':_0x4805('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4805('0x7')]));function VoiceDialReport(_0x1c82b4){this[_0x4805('0x8')]=_0x1c82b4[_0x4805('0x9')];this['outbound']=_0x1c82b4[_0x4805('0xa')];this[_0x4805('0xb')]={};this[_0x4805('0xc')]={};ami['on']('dialbegin',this[_0x4805('0xd')][_0x4805('0xe')](this));ami['on'](_0x4805('0xf'),this[_0x4805('0x10')]['bind'](this));ami['on'](_0x4805('0x11'),this[_0x4805('0x12')][_0x4805('0xe')](this));ami['on'](_0x4805('0x13'),this[_0x4805('0x14')]['bind'](this));}VoiceDialReport[_0x4805('0x15')]['isNotNull']=function(_0x5d4a79){return _0x5d4a79!==null&&!_[_0x4805('0x16')](_0x5d4a79);};VoiceDialReport[_0x4805('0x15')][_0x4805('0x17')]=function(_0x573454,_0x489e3b,_0x18c753){io['to'](_0x573454)['emit'](_0x489e3b,_0x18c753);};VoiceDialReport[_0x4805('0x15')]['syncDialBegin']=function(_0x1cd20a){try{if(this[_0x4805('0x18')](_0x1cd20a)){logger[_0x4805('0x19')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x1cd20a[_0x4805('0x1a')],util[_0x4805('0x1b')](_0x1cd20a,{'showHidden':![],'depth':null}));if(this[_0x4805('0x8')][_0x1cd20a[_0x4805('0x1a')]]){_[_0x4805('0x1c')](this[_0x4805('0x8')][_0x1cd20a[_0x4805('0x1a')]],{'starttime':moment()[_0x4805('0x1d')](_0x4805('0x1e')),'lastevent':_0x4805('0x1f'),'interface':_0x1cd20a[_0x4805('0x20')]['substring'](0x0,_0x1cd20a[_0x4805('0x20')][_0x4805('0x21')]('-')),'membername':_0x1cd20a[_0x4805('0x20')][_0x4805('0x22')](_0x1cd20a[_0x4805('0x20')]['lastIndexOf']('/')+0x1,_0x1cd20a['channel'][_0x4805('0x21')]('-'))},_[_0x4805('0x23')](_0x1cd20a,[_0x4805('0x24'),_0x4805('0x25')]));logger['info'](_0x4805('0x26'),_0x1cd20a[_0x4805('0x1a')],this[_0x4805('0x8')][_0x1cd20a[_0x4805('0x1a')]][_0x4805('0x27')],this[_0x4805('0x8')][_0x1cd20a[_0x4805('0x1a')]][_0x4805('0x28')]);logger[_0x4805('0x19')](_0x4805('0x29'),_0x1cd20a['uniqueid'],util[_0x4805('0x1b')](this[_0x4805('0x8')][_0x1cd20a[_0x4805('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0x4805('0xb')][_0x1cd20a[_0x4805('0x1a')]])_[_0x4805('0x1c')](this[_0x4805('0x8')][_0x1cd20a[_0x4805('0x1a')]],this['applications'][_0x1cd20a['uniqueid']]);this[_0x4805('0x17')](_0x4805('0x2a'),_0x4805('0x2b'),this[_0x4805('0x8')][_0x1cd20a[_0x4805('0x1a')]]);logger['debug'](_0x4805('0x2c'),_0x1cd20a[_0x4805('0x1a')],util[_0x4805('0x1b')](this[_0x4805('0x8')][_0x1cd20a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x4805('0x17')](_0x4805('0x2d'),this[_0x4805('0x8')][_0x1cd20a[_0x4805('0x1a')]]);}}}catch(_0x45f3cb){logger[_0x4805('0x2e')]('[%s][voiceDialReport][dialbegin]',_0x1cd20a['uniqueid'],util[_0x4805('0x1b')](_0x45f3cb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4805('0x15')][_0x4805('0x10')]=function(_0x310191){try{if(this[_0x4805('0x18')](_0x310191)){logger['debug'](_0x4805('0x2f'),_0x310191['uniqueid'],util[_0x4805('0x1b')](_0x310191,{'showHidden':![],'depth':null}));if(this[_0x4805('0x8')][_0x310191[_0x4805('0x1a')]]){this['channels'][_0x310191['uniqueid']][_0x4805('0x30')]=_0x310191[_0x4805('0x30')];if(_0x310191[_0x4805('0x30')]==='ANSWER'){this['channels'][_0x310191[_0x4805('0x1a')]][_0x4805('0x31')]=_0x310191[_0x4805('0x31')];this[_0x4805('0x8')][_0x310191[_0x4805('0x1a')]][_0x4805('0x32')]=_0x310191[_0x4805('0x32')];this['channels'][_0x310191['uniqueid']][_0x4805('0x33')]=moment()[_0x4805('0x1d')](_0x4805('0x1e'));this['channels'][_0x310191[_0x4805('0x1a')]][_0x4805('0x34')]=_0x4805('0x35');logger[_0x4805('0x36')](_0x4805('0x37'),_0x310191['uniqueid'],_0x310191[_0x4805('0x20')][_0x4805('0x22')](_0x310191['channel'][_0x4805('0x21')]('/')+0x1,_0x310191['channel'][_0x4805('0x21')]('-')));logger['debug'](_0x4805('0x38'),_0x310191[_0x4805('0x1a')],util[_0x4805('0x1b')](this['channels'][_0x310191[_0x4805('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x4805('0x17')](_0x4805('0x39'),this[_0x4805('0x8')][_0x310191['uniqueid']]);}logger['debug'](_0x4805('0x3a'),_0x310191['uniqueid'],util[_0x4805('0x1b')](this[_0x4805('0x8')][_0x310191[_0x4805('0x1a')]],{'showHidden':![],'depth':null}));this[_0x4805('0x17')]('voice:outbound',_0x4805('0x2b'),this[_0x4805('0x8')][_0x310191[_0x4805('0x1a')]]);}}}catch(_0x338e1d){logger[_0x4805('0x2e')](_0x4805('0x3b'),_0x310191['uniqueid'],util[_0x4805('0x1b')](_0x338e1d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4805('0x15')]['syncVarSet']=function(_0x9f6cce){try{if(this[_0x4805('0x18')](_0x9f6cce)){logger[_0x4805('0x19')](_0x4805('0x3c'),_0x9f6cce['uniqueid'],util[_0x4805('0x1b')](_0x9f6cce,{'showHidden':![],'depth':null}));this['addVariable'](_0x9f6cce[_0x4805('0x1a')],_[_0x4805('0x3d')](_0x9f6cce[_0x4805('0x3e')])[0x0],_0x9f6cce[_0x4805('0x3f')]);if(this[_0x4805('0x18')](_0x9f6cce[_0x4805('0x3e')])&&this[_0x4805('0x18')](_0x9f6cce[_0x4805('0x3e')]['outboundrouteid'])){if(_[_0x4805('0x16')](this[_0x4805('0x8')][_0x9f6cce['uniqueid']])){this[_0x4805('0x8')][_0x9f6cce['uniqueid']]={'routeId':_0x9f6cce['value'],'variables':this[_0x4805('0xc')][_0x9f6cce[_0x4805('0x1a')]],'motionChannel':_0x4805('0x40')};logger['info'](_0x4805('0x41'),_0x9f6cce[_0x4805('0x1a')],_0x9f6cce[_0x4805('0x3e')][_0x4805('0x42')],_[_0x4805('0x3d')](_0x9f6cce['variable'])[0x0],_0x9f6cce['value']);logger[_0x4805('0x19')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x9f6cce['uniqueid'],util[_0x4805('0x1b')](this['channels'][_0x9f6cce[_0x4805('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x4805('0x2a'),_0x4805('0x2b'),this[_0x4805('0x8')][_0x9f6cce[_0x4805('0x1a')]]);}}}}catch(_0x21d7dc){logger[_0x4805('0x2e')](_0x4805('0x43'),_0x9f6cce['uniqueid'],util['inspect'](_0x21d7dc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4805('0x15')]['addVariable']=function(_0x1e3888,_0x5403ed,_0x3305f0){var _0x5f599f=[_0x4805('0x44'),_0x4805('0x45'),_0x4805('0x46'),_0x4805('0x47'),_0x4805('0x48'),'rtpaudioqoslossbridged',_0x4805('0x49'),_0x4805('0x4a'),_0x4805('0x4b'),'sipuri',_0x4805('0x4c'),_0x4805('0x4d'),'membercalls',_0x4805('0x4e'),_0x4805('0x4f'),_0x4805('0x50'),_0x4805('0x27'),_0x4805('0x51'),_0x4805('0x52')];if(!_['isNil'](_0x5403ed)&&!_[_0x4805('0x53')](_0x5f599f,_0x5403ed)){if(_[_0x4805('0x16')](this['variables'][_0x1e3888])){this[_0x4805('0xc')][_0x1e3888]={};}this[_0x4805('0xc')][_0x1e3888][_0x5403ed]=_0x3305f0;}};VoiceDialReport[_0x4805('0x15')][_0x4805('0x14')]=function(_0x1e7477){try{if(this[_0x4805('0x18')](_0x1e7477)){logger[_0x4805('0x19')](_0x4805('0x54'),_0x1e7477[_0x4805('0x1a')],util[_0x4805('0x1b')](_0x1e7477,{'showHidden':![],'depth':null}));if(this[_0x4805('0x8')][_0x1e7477[_0x4805('0x1a')]]){logger[_0x4805('0x36')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x1e7477[_0x4805('0x1a')],_0x1e7477[_0x4805('0x55')]);this['channels'][_0x1e7477[_0x4805('0x1a')]]['endtime']=moment()[_0x4805('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1e7477[_0x4805('0x1a')]][_0x4805('0x56')]=moment(this[_0x4805('0x8')][_0x1e7477[_0x4805('0x1a')]]['endtime'])['diff'](this[_0x4805('0x8')][_0x1e7477[_0x4805('0x1a')]][_0x4805('0x57')],_0x4805('0x58'));this['channels'][_0x1e7477[_0x4805('0x1a')]][_0x4805('0x34')]=_0x4805('0x59');this[_0x4805('0xa')][_0x4805('0x5a')]+=0x1;if(this[_0x4805('0x8')][_0x1e7477[_0x4805('0x1a')]][_0x4805('0x33')]){this[_0x4805('0xa')][_0x4805('0x5b')]+=0x1;this['channels'][_0x1e7477['uniqueid']][_0x4805('0x5c')]=moment(this[_0x4805('0x8')][_0x1e7477[_0x4805('0x1a')]]['answertime'])[_0x4805('0x5d')](this[_0x4805('0x8')][_0x1e7477[_0x4805('0x1a')]][_0x4805('0x57')],_0x4805('0x58'));this[_0x4805('0x8')][_0x1e7477['uniqueid']][_0x4805('0x5e')]=moment(this['channels'][_0x1e7477[_0x4805('0x1a')]][_0x4805('0x5f')])[_0x4805('0x5d')](this[_0x4805('0x8')][_0x1e7477[_0x4805('0x1a')]][_0x4805('0x33')],'seconds');this['outbound'][_0x4805('0x60')]+=this['channels'][_0x1e7477[_0x4805('0x1a')]][_0x4805('0x5c')]||0x0;this[_0x4805('0xa')][_0x4805('0x61')]+=this[_0x4805('0x8')][_0x1e7477[_0x4805('0x1a')]]['billableseconds'];}this[_0x4805('0xa')][_0x4805('0x62')]+=this[_0x4805('0x8')][_0x1e7477[_0x4805('0x1a')]]['duration'];logger[_0x4805('0x19')](_0x4805('0x63'),_0x1e7477['uniqueid'],util[_0x4805('0x1b')](this['channels'][_0x1e7477[_0x4805('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x4805('0x17')](_0x4805('0x64'),this['channels'][_0x1e7477['uniqueid']]);logger['debug'](_0x4805('0x65'),_0x1e7477['uniqueid'],util[_0x4805('0x1b')](this[_0x4805('0x8')][_0x1e7477['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x4805('0x66'),this[_0x4805('0x8')][_0x1e7477['uniqueid']]);logger['debug'](_0x4805('0x67'),_0x1e7477['uniqueid'],util['inspect'](this[_0x4805('0x8')][_0x1e7477['uniqueid']],{'showHidden':![],'depth':null}));this[_0x4805('0x17')]('voice:outbound',_0x4805('0x68'),this[_0x4805('0xa')]);logger['info'](_0x4805('0x69'),JSON['stringify'](this[_0x4805('0x8')][_0x1e7477[_0x4805('0x1a')]]));logger[_0x4805('0x19')](_0x4805('0x6a'),_0x1e7477[_0x4805('0x1a')],util[_0x4805('0x1b')](this['channels'][_0x1e7477[_0x4805('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x4805('0x2a'),'voice_outbound_channel:remove',this[_0x4805('0x8')][_0x1e7477['uniqueid']]);this[_0x4805('0x6b')](_0x1e7477[_0x4805('0x1a')]);}else if(this['channels'][_0x1e7477[_0x4805('0x6c')]]){this[_0x4805('0x8')][_0x1e7477[_0x4805('0x6c')]][_0x4805('0x1a')]=this[_0x4805('0x8')][_0x1e7477[_0x4805('0x6c')]]['destuniqueid'];}if(this[_0x4805('0xc')][_0x1e7477['uniqueid']]){delete this[_0x4805('0xc')][_0x1e7477['uniqueid']];}}}catch(_0x583222){logger[_0x4805('0x2e')]('[%s][voiceDialReport][hangup]',_0x1e7477['uniqueid'],util[_0x4805('0x1b')](_0x583222,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x449b82){try{if(this[_0x4805('0x18')](_0x449b82)){logger[_0x4805('0x19')](_0x4805('0x6d'),_0x449b82[_0x4805('0x1a')],util[_0x4805('0x1b')](_0x449b82,{'showHidden':![],'depth':null}));if(_0x449b82['application'][_0x4805('0x6e')]()==='set'){_0x449b82[_0x4805('0x6f')]=(_0x449b82[_0x4805('0x70')]||_0x449b82[_0x4805('0x6f')])['toLowerCase']();if(_[_0x4805('0x71')](_0x449b82[_0x4805('0x6f')],'cdr(')){if(_[_0x4805('0x16')](this[_0x4805('0xb')][_0x449b82[_0x4805('0x1a')]]))this[_0x4805('0xb')][_0x449b82[_0x4805('0x1a')]]={};logger[_0x4805('0x36')](_0x4805('0x72'),_0x449b82[_0x4805('0x1a')],_0x449b82[_0x4805('0x73')],_0x449b82[_0x4805('0x6f')]);var _0x492b84=_0x449b82['applicationdata'][_0x4805('0x74')]('=');var _0x58fafe=_0x492b84[0x0][_0x4805('0x75')](/cdr\((.*)\)/);if(_0x58fafe)this['applications'][_0x449b82[_0x4805('0x1a')]][_0x58fafe[0x1]]=_0x492b84[0x1];}}}}catch(_0x5ad346){logger[_0x4805('0x2e')]('[%s][voiceDialReport][newexten]',_0x449b82[_0x4805('0x1a')],util[_0x4805('0x1b')](_0x5ad346,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4805('0x15')]['deleteChannelAfterTimeout']=function(_0x748e6a,_0x539f98=0x2710){if(this[_0x4805('0x8')][_0x748e6a]){setTimeout(()=>{delete this[_0x4805('0x8')][_0x748e6a];},_0x539f98);}};module[_0x4805('0x76')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 62e470a..f433616 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacc5=['[%s][voiceQueueReport][musiconholdstop]','mohtime','milliseconds','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','toLowerCase','appdata','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','ioredis','../../../config/environment','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','prototype','enqueue','tail','sequence','queueReports','realtime','agents','channels','queueChannels','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','queuemember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerLeave','syncAgentComplete','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','queuecallerexit','clearZombieChannels','switch','Action','status','channel','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','error','[FullyBooted]\x20clear\x20realtime','clearQueueReport','voiceQueues','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save','queuecallerexitreason','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isNotNull','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','queues','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','custom:queuesummary','statusRequests','syncQueueSummaryComplete','completeEvent','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','push','emitVoiceQueueChannelSave','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','linkedid','queuecallerexitAt','add','transfertype','FORWARD','destexten','transferuniqueid','COMPLETEDBY','[%s][voiceQueueReport][varset]','keys','value','variable','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','membername','memberpenalty','memberrealtime','isNil','includes','handleHangup','diff','seconds','length','sumDuration','ATTENDEDTRANSFER','answered','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','sumHoldTime','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','syncHangup','[%s][voiceQueueReport][hangup]','cause-txt','cause','transfereeuniqueid','transferexten','secondtransfererexten','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transferid','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstart]'];(function(_0x42d89f,_0xa38921){var _0x3c4038=function(_0x317bb6){while(--_0x317bb6){_0x42d89f['push'](_0x42d89f['shift']());}};_0x3c4038(++_0xa38921);}(_0xacc5,0xfd));var _0x5acc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xacc5[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x5acc('0x0'));var moment=require(_0x5acc('0x1'));var util=require('util');var Redis=require(_0x5acc('0x2'));var config=require(_0x5acc('0x3'));var logger=require('../../../config/logger')(_0x5acc('0x4'));var ami=require(_0x5acc('0x5'));var QueueReport=require(_0x5acc('0x6'));var VoiceQueueSummary=require(_0x5acc('0x7'));config[_0x5acc('0x8')]=_[_0x5acc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x5acc('0xa')][_0x5acc('0xb')]=function(_0x45e8a7){this[_0x5acc('0xc')]=this[_0x5acc('0xc')]?this[_0x5acc('0xc')]['finally'](_0x45e8a7):_0x45e8a7();};function VoiceQueueReport(_0x1e8d70){this[_0x5acc('0xd')]=new Sequence();this[_0x5acc('0xe')]={};this[_0x5acc('0xf')]=_0x1e8d70;this[_0x5acc('0x10')]=_0x1e8d70[_0x5acc('0x10')];this[_0x5acc('0x11')]=_0x1e8d70[_0x5acc('0x12')];this['voiceQueues']=_0x1e8d70['voiceQueues'];this[_0x5acc('0x13')]=_0x1e8d70[_0x5acc('0x13')];this[_0x5acc('0x14')]=initializeSummary();this[_0x5acc('0x15')]={};ami['on'](_0x5acc('0x16'),this[_0x5acc('0x17')][_0x5acc('0x18')](this));ami['on'](_0x5acc('0x19'),this['syncQueueSummaryComplete'][_0x5acc('0x18')](this));ami['on'](_0x5acc('0x1a'),this['syncQueueMember'][_0x5acc('0x18')](this));ami['on'](_0x5acc('0x1b'),this['syncQueueStatusComplete'][_0x5acc('0x18')](this));ami['on'](_0x5acc('0x1c'),this[_0x5acc('0x1d')][_0x5acc('0x18')](this));ami['on'](_0x5acc('0x1e'),this['syncQueueCallerAbandon'][_0x5acc('0x18')](this));ami['on']('queuecallerleave',this[_0x5acc('0x1f')][_0x5acc('0x18')](this));ami['on']('agentcomplete',this[_0x5acc('0x20')][_0x5acc('0x18')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x5acc('0x18')](this));ami['on'](_0x5acc('0x21'),this[_0x5acc('0x22')][_0x5acc('0x18')](this));ami['on'](_0x5acc('0x23'),this['syncHangup'][_0x5acc('0x18')](this));ami['on'](_0x5acc('0x24'),this[_0x5acc('0x25')][_0x5acc('0x18')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x5acc('0x18')](this));ami['on'](_0x5acc('0x26'),this[_0x5acc('0x27')][_0x5acc('0x18')](this));ami['on'](_0x5acc('0x28'),this[_0x5acc('0x29')]['bind'](this));ami['on'](_0x5acc('0x2a'),this[_0x5acc('0x2b')]['bind'](this));this[_0x5acc('0x2c')]();this[_0x5acc('0x2d')]();}function clearChannels(_0xda3f6){if(!_['isEmpty'](_0xda3f6)){for(var _0x303e28 in _0xda3f6){if(_0xda3f6['hasOwnProperty'](_0x303e28)){delete _0xda3f6[_0x303e28];}}}}function clearCampaigns(_0x49add1){if(!_[_0x5acc('0x2e')](_0x49add1)){for(var _0x549fb9 in _0x49add1){if(_0x49add1[_0x5acc('0x2f')](_0x549fb9)){_0x49add1[_0x549fb9][_0x5acc('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4efded){if(!_[_0x5acc('0x2e')](_0x4efded)){for(var _0x112994 in _0x4efded){if(_0x4efded[_0x5acc('0x2f')](_0x112994)){_0x4efded[_0x112994][_0x5acc('0x30')]=0x0;_0x4efded[_0x112994][_0x5acc('0x31')]=0x0;_0x4efded[_0x112994][_0x5acc('0x32')]=0x0;_0x4efded[_0x112994][_0x5acc('0x33')]=0x0;_0x4efded[_0x112994]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x16cc56){if(!_['isEmpty'](_0x16cc56)){for(var _0x291351 in _0x16cc56){if(_0x16cc56[_0x5acc('0x2f')](_0x291351)){_0x16cc56[_0x291351][_0x5acc('0x34')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x5a737a){return _0x5a737a[_0x5acc('0x35')]||_0x5a737a[_0x5acc('0x1e')]||_0x5a737a['queuecallercomplete'];}VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x36')]=function(){var _0x286c42=this;for(var _0x3f2708 in this[_0x5acc('0x11')]){if(this[_0x5acc('0x11')]['hasOwnProperty'](_0x3f2708)&&!this[_0x5acc('0x11')][_0x3f2708][_0x5acc('0x37')]){this[_0x5acc('0xd')][_0x5acc('0xb')](function(){if(!_['isNil'](_0x286c42[_0x5acc('0x11')][_0x3f2708])){return ami[_0x5acc('0x38')]({'action':_0x5acc('0x39'),'channel':_0x286c42[_0x5acc('0x11')][_0x3f2708][_0x5acc('0x3a')]})[_0x5acc('0x3b')](function(_0x3e9fef){if(_0x3e9fef[_0x5acc('0x3c')]===_0x5acc('0x3d')){setTimeout(function(){if(_0x286c42[_0x5acc('0x11')][_0x3f2708]){delete _0x286c42[_0x5acc('0x11')][_0x3f2708];logger['error'](_0x5acc('0x3e'),_0x3f2708,util[_0x5acc('0x3f')](_0x3e9fef,{'showHidden':![],'depth':null}));}if(_0x286c42[_0x5acc('0xe')][_0x3f2708]){delete _0x286c42[_0x5acc('0xe')][_0x3f2708];logger['error'](_0x5acc('0x40'),_0x3f2708,util[_0x5acc('0x3f')](_0x3e9fef,{'showHidden':![],'depth':null}));}if(_0x286c42[_0x5acc('0x15')][_0x3f2708]){delete _0x286c42[_0x5acc('0x15')][_0x3f2708];logger['error'](_0x5acc('0x41'),_0x3f2708,util[_0x5acc('0x3f')](_0x3e9fef,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x25')]=function(){logger[_0x5acc('0x42')](_0x5acc('0x43'));clearChannels(this[_0x5acc('0x11')]);this[_0x5acc('0x44')](this[_0x5acc('0xe')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x5acc('0x45')]);clearCampaigns(this[_0x5acc('0x13')]);this[_0x5acc('0x14')]=initializeSummary();};VoiceQueueReport[_0x5acc('0xa')]['clearQueueReport']=function(_0x2d367b){var _0x4a554a=this;if(!_[_0x5acc('0x2e')](_0x2d367b)){for(var _0xf81e06 in _0x2d367b){if(_0x2d367b[_0x5acc('0x2f')](_0xf81e06)){_0x4a554a[_0x5acc('0x46')](_0x2d367b[_0xf81e06],_0x5acc('0x47'));delete _0x2d367b[_0xf81e06];}}}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x48')]=function(_0x9b19e9,_0x3961c7,_0x2454bb){io['to'](_0x9b19e9)[_0x5acc('0x48')](_0x3961c7,_0x2454bb);};VoiceQueueReport[_0x5acc('0xa')]['emitVoiceQueueChannelSave']=function(_0x1346d2,_0x1151bc){logger[_0x5acc('0x49')](_0x5acc('0x4a')+_0x1151bc+_0x5acc('0x4b'),_0x1346d2[_0x5acc('0x4c')],util[_0x5acc('0x3f')](_0x1346d2,{'showHidden':![],'depth':null}));this[_0x5acc('0x48')](util[_0x5acc('0x4d')](_0x5acc('0x4e'),_0x1346d2[_0x5acc('0x4f')]),_0x5acc('0x50'),_0x1346d2);io[_0x5acc('0x48')]('voice_queue_presence:save',_0x1346d2);};VoiceQueueReport[_0x5acc('0xa')]['emitVoiceQueueChannelRemove']=function(_0x4e02ca,_0x555800){logger[_0x5acc('0x49')]('[%s][voiceQueueReport]['+_0x555800+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x4e02ca[_0x5acc('0x4c')],util[_0x5acc('0x3f')](_0x4e02ca,{'showHidden':![],'depth':null}));if(_0x4e02ca[_0x5acc('0x51')]==='ATTENDEDTRANSFER'){return;}this[_0x5acc('0x48')](util[_0x5acc('0x4d')](_0x5acc('0x4e'),_0x4e02ca['queue']),_0x5acc('0x52'),_0x4e02ca);io[_0x5acc('0x48')](_0x5acc('0x53'),_0x4e02ca);};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x54')]=function(_0x50b839){if(_0x50b839[_0x5acc('0x55')]==='inbound'){logger[_0x5acc('0x49')](_0x5acc('0x56'),util[_0x5acc('0x3f')](_0x50b839,{'showHidden':![],'depth':null}));this[_0x5acc('0x48')](util[_0x5acc('0x4d')](_0x5acc('0x4e'),_0x50b839[_0x5acc('0x57')]),'voice_queue:save',_0x50b839);}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x58')]=function(_0x108508){return _0x108508!==null&&!_['isUndefined'](_0x108508);};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x2d')]=function(){var _0x357cf4=this;setInterval(function(){_0x357cf4[_0x5acc('0x36')]();ami[_0x5acc('0x38')]({'action':'queues'})['catch'](function(_0x17d919){logger[_0x5acc('0x42')](_0x5acc('0x59'),util[_0x5acc('0x3f')](_0x17d919,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x2c')]=function(){var _0x31adc0=this;setInterval(function(){if(!_0x31adc0[_0x5acc('0x14')][_0x5acc('0x5a')]){return ami[_0x5acc('0x38')]({'action':_0x5acc('0x16')})[_0x5acc('0x5b')](function(_0x46d09a){_0x31adc0[_0x5acc('0x14')]['id']=_0x46d09a[_0x5acc('0x5c')];_0x31adc0[_0x5acc('0x14')][_0x5acc('0x5a')]=!![];_0x31adc0[_0x5acc('0x14')][_0x5acc('0x5d')][_0x46d09a['actionid']]={};})[_0x5acc('0x3b')](function(_0x429915){logger[_0x5acc('0x42')](_0x5acc('0x5e'),util[_0x5acc('0x3f')](_0x429915,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x5f')]=function(_0x878e70,_0xb543f1){var _0x372ff9;if(this[_0x5acc('0x14')]&&this[_0x5acc('0x14')]['queues']&&this[_0x5acc('0x14')][_0x5acc('0x60')][_0x878e70[_0x5acc('0x57')]]){_0x372ff9=this['summary']['queues'][_0x878e70[_0x5acc('0x57')]]['summaryEvent'];}var _0xc905e3=new VoiceQueueSummary(_0x878e70);return _0xc905e3[_0x5acc('0x61')](_0xb543f1[_0x5acc('0x10')],this[_0x5acc('0x10')],_0x372ff9,this[_0x5acc('0xf')]['channels']);};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x62')]=function(_0x298fc6,_0xa23b1a){var _0x3dec21=this[_0x5acc('0x5f')](_0x298fc6,_0xa23b1a);var _0xcd15d0=![];_0xcd15d0=_0x3dec21[_0x5acc('0x63')](_0x298fc6);if(_0xcd15d0){Object[_0x5acc('0x64')](_0x298fc6,_0x3dec21);this[_0x5acc('0xf')]['voiceQueues'][_0x298fc6['name']]=_0x298fc6;this[_0x5acc('0x54')](_0x3dec21);}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x65')]=function(_0x92f1d7){var _0x54b61d=null;var _0x2ebfe3=this[_0x5acc('0x14')]['id'];if(this[_0x5acc('0x14')][_0x5acc('0x5d')][_0x2ebfe3]){_0x54b61d=this['summary'][_0x5acc('0x5d')][_0x2ebfe3][_0x92f1d7[_0x5acc('0x5c')]];}if(!_0x54b61d){this[_0x5acc('0x14')]=initializeSummary();return;}var _0xbb6169=this[_0x5acc('0x45')][_0x54b61d[_0x5acc('0x4f')]];if(_0xbb6169['type']==='inbound'){this[_0x5acc('0x62')](_0xbb6169,_0x54b61d);}else if(_0xbb6169[_0x5acc('0x55')]==='outbound'){var _0x4e64bd=this[_0x5acc('0x5f')](_0xbb6169,_0x54b61d);ami[_0x5acc('0x48')](_0x5acc('0x66'),_0x4e64bd);}this['summary']['statusRequests']-=0x1;var _0x517cd6=this[_0x5acc('0x14')][_0x5acc('0x67')]>0x0?!![]:![];if(!_0x517cd6){return this[_0x5acc('0x68')](this[_0x5acc('0x14')][_0x5acc('0x69')]);}};VoiceQueueReport[_0x5acc('0xa')]['syncQueueMember']=function(_0x49572a){var _0x1a5e3b=this['summary']['id'];if(this[_0x5acc('0x14')]['queuestatus'][_0x1a5e3b]&&this['summary'][_0x5acc('0x5d')][_0x1a5e3b][_0x49572a[_0x5acc('0x5c')]]){this[_0x5acc('0x14')][_0x5acc('0x5d')][_0x1a5e3b][_0x49572a[_0x5acc('0x5c')]][_0x5acc('0x10')]['push'](_0x49572a);}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x17')]=function(_0x1fa138){var _0x53c87e=this;try{if(this[_0x5acc('0x58')](_0x1fa138)&&this[_0x5acc('0x58')](_0x1fa138[_0x5acc('0x4f')])){logger[_0x5acc('0x49')](_0x5acc('0x6a'),util[_0x5acc('0x3f')](_0x1fa138,{'showHidden':![],'depth':null}));var _0x5308bf=this['voiceQueues'][_0x1fa138[_0x5acc('0x4f')]];if(_0x5308bf){logger['debug'](_0x5acc('0x6b'),_0x5308bf[_0x5acc('0x57')]);this['summary'][_0x5acc('0x60')][_0x5308bf[_0x5acc('0x57')]]={'summaryEvent':_0x1fa138};this[_0x5acc('0x14')][_0x5acc('0x67')]+=0x1;return ami['Action']({'action':_0x5acc('0x5d'),'queue':_0x5308bf[_0x5acc('0x57')]})[_0x5acc('0x5b')](function(_0x3004cc){if(!_0x53c87e[_0x5acc('0x14')][_0x5acc('0x5d')][_0x1fa138[_0x5acc('0x5c')]]){_0x53c87e[_0x5acc('0x14')][_0x5acc('0x5d')][_0x1fa138[_0x5acc('0x5c')]]={};}_0x53c87e[_0x5acc('0x14')]['queuestatus'][_0x1fa138[_0x5acc('0x5c')]][_0x3004cc[_0x5acc('0x5c')]]={'queue':_0x5308bf[_0x5acc('0x57')],'agents':[]};})[_0x5acc('0x3b')](function(_0x98c7d2){throw _0x98c7d2;});}}}catch(_0x5e4329){logger[_0x5acc('0x42')]('[voiceQueueReport][queuesummary]',util[_0x5acc('0x3f')](_0x5e4329,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x68')]=function(_0x1b0785){if(this[_0x5acc('0x14')][_0x5acc('0x67')]>0x0){this[_0x5acc('0x14')][_0x5acc('0x69')]=_0x1b0785;return;}logger['debug'](_0x5acc('0x6c'),util[_0x5acc('0x3f')](_0x1b0785,{'showHidden':![],'depth':null}));this[_0x5acc('0x14')]=initializeSummary();ami['emit'](_0x5acc('0x6d'),{});};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x1d')]=function(_0x1adab0){try{if(this[_0x5acc('0x58')](_0x1adab0)){logger[_0x5acc('0x49')](_0x5acc('0x6e'),_0x1adab0[_0x5acc('0x4c')],util[_0x5acc('0x3f')](_0x1adab0,{'showHidden':![],'depth':null}));if(_[_0x5acc('0x6f')](this[_0x5acc('0xe')][_0x1adab0[_0x5acc('0x4c')]])){this[_0x5acc('0xe')][_0x1adab0[_0x5acc('0x4c')]]=[];}if(_[_0x5acc('0x6f')](this[_0x5acc('0x11')][_0x1adab0[_0x5acc('0x4c')]])){this['channels'][_0x1adab0[_0x5acc('0x4c')]]={};}var _0x4c9631=new QueueReport();_0x4c9631['queue']=_0x1adab0[_0x5acc('0x4f')];_0x4c9631[_0x5acc('0x55')]=this[_0x5acc('0x45')][_0x4c9631[_0x5acc('0x4f')]]&&this['voiceQueues'][_0x4c9631['queue']][_0x5acc('0x55')]?this[_0x5acc('0x45')][_0x4c9631[_0x5acc('0x4f')]][_0x5acc('0x55')]||_0x5acc('0x70'):_0x5acc('0x70');_0x4c9631[_0x5acc('0x71')]=moment()['format'](_0x5acc('0x72'));_0x4c9631[_0x5acc('0x73')]=_0x1adab0['position'];_0x4c9631[_0x5acc('0x74')]=_0x1adab0['count'];_0x4c9631[_0x5acc('0x4c')]=_0x1adab0[_0x5acc('0x4c')];logger[_0x5acc('0x75')](_0x5acc('0x76'),_0x4c9631['queue'],_0x4c9631[_0x5acc('0x55')]);Object['assign'](_0x4c9631,_[_0x5acc('0x77')](_0x1adab0,_['keys'](_0x4c9631)));this[_0x5acc('0xe')][_0x1adab0['uniqueid']][_0x5acc('0x78')](_0x4c9631);this['channels'][_0x1adab0[_0x5acc('0x4c')]]=_0x4c9631;this[_0x5acc('0x79')](_0x4c9631,_0x5acc('0x1c'));}}catch(_0x2213a7){logger[_0x5acc('0x42')](_0x5acc('0x6e'),_0x1adab0['uniqueid'],util['inspect'](_0x2213a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x7a')]=function(_0x221579){try{if(this[_0x5acc('0x58')](_0x221579)){logger[_0x5acc('0x49')](_0x5acc('0x7b'),_0x221579[_0x5acc('0x4c')],util[_0x5acc('0x3f')](_0x221579,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x221579[_0x5acc('0x4c')]]){var _0x3787b5=_[_0x5acc('0x7c')](this[_0x5acc('0xe')][_0x221579['uniqueid']]);_0x3787b5[_0x5acc('0x7d')]=![];_0x3787b5[_0x5acc('0x7e')]=null;_0x3787b5['holdtime']=_0x221579[_0x5acc('0x7f')];_0x3787b5[_0x5acc('0x80')]=_0x221579['originalposition'];_0x3787b5['queuecallerabandon']=!![];_0x3787b5[_0x5acc('0x81')]=moment()[_0x5acc('0x4d')](_0x5acc('0x72'));_0x3787b5[_0x5acc('0x51')]=_0x5acc('0x82');_0x3787b5[_0x5acc('0x83')]=null;logger[_0x5acc('0x75')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x3787b5[_0x5acc('0x4f')],_0x3787b5['type']);this[_0x5acc('0x11')][_0x221579['uniqueid']]=_0x3787b5;this[_0x5acc('0x46')](_0x3787b5,'queuecallerabandon');}}}catch(_0x10b557){logger[_0x5acc('0x42')]('[%s][voiceQueueReport][queuecallerabandon]',_0x221579['uniqueid'],util[_0x5acc('0x3f')](_0x10b557,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x1f')]=function(_0x69ce1a){try{if(this[_0x5acc('0x58')](_0x69ce1a)){logger['debug'](_0x5acc('0x84'),_0x69ce1a['uniqueid'],util[_0x5acc('0x3f')](_0x69ce1a,{'showHidden':![],'depth':null}));if(this[_0x5acc('0xe')][_0x69ce1a[_0x5acc('0x4c')]]){var _0xce8fe9=_[_0x5acc('0x7c')](this['queueReports'][_0x69ce1a[_0x5acc('0x4c')]]);_0xce8fe9[_0x5acc('0x85')]=moment()[_0x5acc('0x4d')](_0x5acc('0x72'));_0xce8fe9['connectedlinenum']=_0x69ce1a['connectedlinenum'];_0xce8fe9['connectedlinename']=_0x69ce1a[_0x5acc('0x86')];logger['info'](_0x5acc('0x87'),_0xce8fe9[_0x5acc('0x4f')],_0xce8fe9['type'],_0x69ce1a[_0x5acc('0x88')],_0x69ce1a['connectedlinename']);this[_0x5acc('0x11')][_0x69ce1a[_0x5acc('0x4c')]]=_0xce8fe9;this[_0x5acc('0x79')](_0xce8fe9,_0x5acc('0x89'));}}}catch(_0x25580a){logger['error'](_0x5acc('0x84'),_0x69ce1a[_0x5acc('0x4c')],util[_0x5acc('0x3f')](_0x25580a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5acc('0xa')]['syncAgentConnect']=function(_0x2a257f){try{if(this[_0x5acc('0x58')](_0x2a257f)){logger['debug'](_0x5acc('0x8a'),_0x2a257f[_0x5acc('0x4c')],util[_0x5acc('0x3f')](_0x2a257f,{'showHidden':![],'depth':null}));if(this[_0x5acc('0xe')][_0x2a257f['uniqueid']]){var _0x51b17b=_[_0x5acc('0x7c')](this[_0x5acc('0xe')][_0x2a257f[_0x5acc('0x4c')]]);_0x51b17b[_0x5acc('0x7d')]=!![];_0x51b17b[_0x5acc('0x51')]=_0x5acc('0x8b');logger[_0x5acc('0x75')](_0x5acc('0x8c'),_0x51b17b['queue'],_0x51b17b[_0x5acc('0x55')]);}}}catch(_0x3a8f83){logger[_0x5acc('0x42')](_0x5acc('0x8a'),_0x2a257f[_0x5acc('0x4c')],util[_0x5acc('0x3f')](_0x3a8f83,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x20')]=function(_0x38007a){try{if(this['isNotNull'](_0x38007a)){logger[_0x5acc('0x49')](_0x5acc('0x8d'),_0x38007a[_0x5acc('0x4c')],util[_0x5acc('0x3f')](_0x38007a,{'showHidden':![],'depth':null}));if(this[_0x5acc('0xe')][_0x38007a[_0x5acc('0x4c')]]){var _0x5ecdb8=_['last'](this[_0x5acc('0xe')][_0x38007a['uniqueid']]);_0x5ecdb8['queuecallerabandon']=![];_0x5ecdb8[_0x5acc('0x81')]=null;_0x5ecdb8[_0x5acc('0x8e')]=!![];_0x5ecdb8[_0x5acc('0x83')]=_0x38007a['membername'];_0x5ecdb8['holdtime']=_0x38007a[_0x5acc('0x7f')];_0x5ecdb8[_0x5acc('0x7d')]=!![];_0x5ecdb8[_0x5acc('0x35')]=![];_0x5ecdb8['queuecallerexitAt']=null;if(!_0x5ecdb8[_0x5acc('0x8f')]){if(_0x38007a[_0x5acc('0x90')]==_0x5acc('0x8f')){_0x5ecdb8[_0x5acc('0x51')]=_0x5acc('0x91');logger[_0x5acc('0x75')](_0x5acc('0x92'),_0x5ecdb8['queue'],_0x5ecdb8[_0x5acc('0x55')]);}else{if(_[_0x5acc('0x93')](_0x38007a['channel']['toLowerCase'](),_0x5acc('0x94'))){if(this[_0x5acc('0xe')][_0x38007a[_0x5acc('0x95')]]){var _0x4c0297=_[_0x5acc('0x7c')](this[_0x5acc('0xe')][_0x38007a[_0x5acc('0x95')]]);_0x4c0297[_0x5acc('0x7d')]=![];_0x4c0297['queuecallerexit']=!![];_0x4c0297[_0x5acc('0x96')]=moment(_0x5ecdb8['queuecallerjoinAt'])[_0x5acc('0x97')](_0x38007a[_0x5acc('0x7f')],'seconds')[_0x5acc('0x4d')](_0x5acc('0x72'));_0x4c0297[_0x5acc('0x51')]='FORWARDTRANSFER';_0x4c0297[_0x5acc('0x8f')]=!![];_0x4c0297[_0x5acc('0x98')]=_0x5acc('0x99');_0x4c0297['transferexten']=_0x38007a[_0x5acc('0x9a')];_0x4c0297[_0x5acc('0x9b')]=_0x38007a[_0x5acc('0x4c')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4c0297[_0x5acc('0x4f')],_0x4c0297[_0x5acc('0x55')]);var _0x1757da=this[_0x5acc('0xe')][_0x38007a[_0x5acc('0x95')]];this[_0x5acc('0xe')][_0x38007a['linkedid']]=this[_0x5acc('0xe')][_0x38007a['uniqueid']];this[_0x5acc('0xe')][_0x38007a[_0x5acc('0x4c')]]=_0x1757da;}}else{_0x5ecdb8[_0x5acc('0x51')]=_0x5acc('0x9c')+_0x38007a[_0x5acc('0x90')]['toUpperCase']();logger[_0x5acc('0x75')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x5ecdb8[_0x5acc('0x4f')],_0x5ecdb8[_0x5acc('0x55')],_0x5ecdb8['queuecallerexitreason']);}}}this[_0x5acc('0x11')][_0x38007a['uniqueid']]=_0x5ecdb8;}}}catch(_0x49dfbb){logger[_0x5acc('0x42')]('[%s][voiceQueueReport][agentcomplete]',_0x38007a['uniqueid'],util[_0x5acc('0x3f')](_0x49dfbb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0x22')]=function(_0x3247b4){try{if(this[_0x5acc('0x58')](_0x3247b4)){logger[_0x5acc('0x49')](_0x5acc('0x9d'),_0x3247b4[_0x5acc('0x4c')],util['inspect'](_0x3247b4,{'showHidden':![],'depth':null}));this['addVariable'](_0x3247b4[_0x5acc('0x4c')],_[_0x5acc('0x9e')](_0x3247b4['variable'])[0x0],_0x3247b4[_0x5acc('0x9f')]);if(this[_0x5acc('0xe')][_0x3247b4[_0x5acc('0x4c')]]){var _0x16a8f1=_['last'](this[_0x5acc('0xe')][_0x3247b4[_0x5acc('0x4c')]]);if(_0x16a8f1){if(this[_0x5acc('0x58')](_0x3247b4[_0x5acc('0xa0')])&&this[_0x5acc('0x58')](_0x3247b4[_0x5acc('0xa0')][_0x5acc('0x5d')])){switch(_0x3247b4[_0x5acc('0x9f')]){case'CONTINUE':_0x16a8f1['queuecallerexit']=![];_0x16a8f1[_0x5acc('0x96')]=null;break;case'TIMEOUT':_0x16a8f1[_0x5acc('0xa1')]=_0x5acc('0xa2');_0x16a8f1[_0x5acc('0x35')]=!![];_0x16a8f1[_0x5acc('0x96')]=moment()[_0x5acc('0x4d')](_0x5acc('0x72'));_0x16a8f1[_0x5acc('0x85')]=moment()[_0x5acc('0x4d')](_0x5acc('0x72'));logger[_0x5acc('0x49')](_0x5acc('0xa3'),_0x3247b4['uniqueid'],util['inspect'](_0x16a8f1,{'showHidden':![],'depth':null}));ami[_0x5acc('0x48')]('custom:timeout',_0x16a8f1);break;default:_0x16a8f1[_0x5acc('0x35')]=!![];_0x16a8f1[_0x5acc('0x96')]=moment()[_0x5acc('0x4d')](_0x5acc('0x72'));_0x16a8f1['queuecallerleaveAt']=moment()[_0x5acc('0x4d')](_0x5acc('0x72'));}_0x16a8f1[_0x5acc('0x1e')]=![];_0x16a8f1[_0x5acc('0x81')]=null;_0x16a8f1[_0x5acc('0x51')]=_0x3247b4[_0x5acc('0x9f')];this['channels'][_0x3247b4[_0x5acc('0x4c')]]=_0x16a8f1;this[_0x5acc('0x46')](_0x16a8f1,_0x5acc('0x21'));}else if(this[_0x5acc('0x58')](_0x3247b4['variable'])&&this[_0x5acc('0x58')](_0x3247b4[_0x5acc('0xa0')]['queueposition'])){if(!_0x16a8f1['queuecallerabandon']){_0x16a8f1[_0x5acc('0x35')]=!![];_0x16a8f1['queuecallerexitAt']=moment()[_0x5acc('0x4d')](_0x5acc('0x72'));_0x16a8f1[_0x5acc('0x51')]=_0x5acc('0xa4');_0x16a8f1[_0x5acc('0x85')]=moment()[_0x5acc('0x4d')](_0x5acc('0x72'));this[_0x5acc('0x11')][_0x3247b4[_0x5acc('0x4c')]]=_0x16a8f1;}}logger[_0x5acc('0x75')](_0x5acc('0xa5'),_0x3247b4[_0x5acc('0x4c')],_0x16a8f1['queue'],_0x16a8f1['type'],_[_0x5acc('0x9e')](_0x3247b4[_0x5acc('0xa0')])[0x0],_0x3247b4[_0x5acc('0x9f')]);_0x16a8f1[_0x5acc('0x15')]=this[_0x5acc('0x15')][_0x3247b4[_0x5acc('0x4c')]];}}}}catch(_0x4f3618){logger[_0x5acc('0x42')](_0x5acc('0x9d'),_0x3247b4[_0x5acc('0x4c')],util[_0x5acc('0x3f')](_0x4f3618,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0xa6')]=function(_0x171513,_0x510264,_0x3c2f66){var _0x1fa66f=[_0x5acc('0xa7'),_0x5acc('0xa8'),_0x5acc('0xa9'),_0x5acc('0xaa'),_0x5acc('0xab'),_0x5acc('0xac'),_0x5acc('0xad'),'rtpaudioqosrttbridged',_0x5acc('0xae'),_0x5acc('0xaf'),_0x5acc('0xb0'),_0x5acc('0xb1'),'membercalls','memberdynamic',_0x5acc('0xb2'),'memberlastcall',_0x5acc('0xb3'),_0x5acc('0xb4'),_0x5acc('0xb5')];if(!_[_0x5acc('0xb6')](_0x510264)&&!_[_0x5acc('0xb7')](_0x1fa66f,_0x510264)){if(_[_0x5acc('0x6f')](this['variables'][_0x171513])){this[_0x5acc('0x15')][_0x171513]={};}this['variables'][_0x171513][_0x510264]=_0x3c2f66;}};VoiceQueueReport[_0x5acc('0xa')][_0x5acc('0xb8')]=function(_0x355ded,_0x23cebe,_0x4f2cd0){try{var _0x53eaca={};if(this[_0x5acc('0xe')][_0x355ded]){for(var _0x43556b=0x0;_0x43556b{delete this['channels'][_0xe4c666];},_0x29a4c4);}};module[_0x5acc('0xed')]=VoiceQueueReport; \ No newline at end of file +var _0x9a73=['queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','varset','hangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','unlockRR','queuecallerexit','queuecallercomplete','prototype','clearZombieChannels','switch','status','channel','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','queue','voice_queue_channel:save','voice_queue_presence:save','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','type','inbound','name','voice_queue:save','isNotNull','isUndefined','Action','queues','catch','[voiceQueueReport][queues]','isRunning','queuesummary','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','handleInboundQueueSummaryReport','assign','emitInboundVoiceQueueSummary','syncQueueStatusComplete','outbound','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','info','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallerleave','COMPLETEDBYAGENT','assigned','membername','queuecallerexitAt','transfer','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','linkedid','queuecallerjoinAt','add','holdtime','seconds','FORWARDTRANSFER','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberrealtime','isNil','includes','handleHangup','length','sumHoldTime','diff','sumDuration','ATTENDEDTRANSFER','total','answered','sumBillable','milliseconds','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','syncHangup','cause-txt','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','origtransfererexten','origtransfereruniqueid','transfertargetuniqueid','transferid','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','toLowerCase','cdr(','split','match','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','syncQueueSummary','bind'];(function(_0x54a5bb,_0x45c3b7){var _0x1810bb=function(_0x66ffcb){while(--_0x66ffcb){_0x54a5bb['push'](_0x54a5bb['shift']());}};_0x1810bb(++_0x45c3b7);}(_0x9a73,0xd4));var _0x39a7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9a73[_0x432682];return _0x463d05;};'use strict';var _=require(_0x39a7('0x0'));var moment=require(_0x39a7('0x1'));var util=require(_0x39a7('0x2'));var Redis=require(_0x39a7('0x3'));var config=require(_0x39a7('0x4'));var logger=require(_0x39a7('0x5'))(_0x39a7('0x6'));var ami=require('../ami');var QueueReport=require(_0x39a7('0x7'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0x39a7('0x8')]=_[_0x39a7('0x9')](config[_0x39a7('0x8')],{'host':_0x39a7('0xa'),'port':0x18eb});var io=require(_0x39a7('0xb'))(new Redis(config[_0x39a7('0x8')]));var Sequence=function(){};Sequence['prototype'][_0x39a7('0xc')]=function(_0x33b67c){this[_0x39a7('0xd')]=this[_0x39a7('0xd')]?this[_0x39a7('0xd')][_0x39a7('0xe')](_0x33b67c):_0x33b67c();};function VoiceQueueReport(_0x13704e){this[_0x39a7('0xf')]=new Sequence();this[_0x39a7('0x10')]={};this[_0x39a7('0x11')]=_0x13704e;this[_0x39a7('0x12')]=_0x13704e[_0x39a7('0x12')];this[_0x39a7('0x13')]=_0x13704e[_0x39a7('0x14')];this[_0x39a7('0x15')]=_0x13704e[_0x39a7('0x15')];this[_0x39a7('0x16')]=_0x13704e['campaigns'];this[_0x39a7('0x17')]=initializeSummary();this[_0x39a7('0x18')]={};ami['on']('queuesummary',this[_0x39a7('0x19')][_0x39a7('0x1a')](this));ami['on'](_0x39a7('0x1b'),this[_0x39a7('0x1c')]['bind'](this));ami['on'](_0x39a7('0x1d'),this[_0x39a7('0x1e')][_0x39a7('0x1a')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x39a7('0x1a')](this));ami['on'](_0x39a7('0x1f'),this[_0x39a7('0x20')]['bind'](this));ami['on'](_0x39a7('0x21'),this['syncQueueCallerAbandon'][_0x39a7('0x1a')](this));ami['on']('queuecallerleave',this[_0x39a7('0x22')][_0x39a7('0x1a')](this));ami['on'](_0x39a7('0x23'),this[_0x39a7('0x24')][_0x39a7('0x1a')](this));ami['on']('agentconnect',this[_0x39a7('0x25')][_0x39a7('0x1a')](this));ami['on'](_0x39a7('0x26'),this['syncVarSet'][_0x39a7('0x1a')](this));ami['on'](_0x39a7('0x27'),this['syncHangup'][_0x39a7('0x1a')](this));ami['on'](_0x39a7('0x28'),this[_0x39a7('0x29')][_0x39a7('0x1a')](this));ami['on']('musiconholdstart',this[_0x39a7('0x2a')]['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x39a7('0x1a')](this));ami['on']('attendedtransfer',this[_0x39a7('0x2b')][_0x39a7('0x1a')](this));ami['on']('blindtransfer',this[_0x39a7('0x2c')][_0x39a7('0x1a')](this));this[_0x39a7('0x2d')]();this[_0x39a7('0x2e')]();}function clearChannels(_0x373d52){if(!_[_0x39a7('0x2f')](_0x373d52)){for(var _0x2274aa in _0x373d52){if(_0x373d52[_0x39a7('0x30')](_0x2274aa)){delete _0x373d52[_0x2274aa];}}}}function clearCampaigns(_0xe2a6c9){if(!_['isEmpty'](_0xe2a6c9)){for(var _0x52e72b in _0xe2a6c9){if(_0xe2a6c9['hasOwnProperty'](_0x52e72b)){_0xe2a6c9[_0x52e72b][_0x39a7('0x31')]=0x0;}}}}function clearVoiceQueues(_0xb6681c){if(!_[_0x39a7('0x2f')](_0xb6681c)){for(var _0x5aa1b3 in _0xb6681c){if(_0xb6681c[_0x39a7('0x30')](_0x5aa1b3)){_0xb6681c[_0x5aa1b3][_0x39a7('0x31')]=0x0;_0xb6681c[_0x5aa1b3][_0x39a7('0x32')]=0x0;_0xb6681c[_0x5aa1b3]['pTalking']=0x0;_0xb6681c[_0x5aa1b3][_0x39a7('0x33')]=0x0;_0xb6681c[_0x5aa1b3]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x542c68){if(!_['isEmpty'](_0x542c68)){for(var _0x24e0e6 in _0x542c68){if(_0x542c68[_0x39a7('0x30')](_0x24e0e6)){_0x542c68[_0x24e0e6][_0x39a7('0x34')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x48d1a6){return _0x48d1a6[_0x39a7('0x35')]||_0x48d1a6[_0x39a7('0x21')]||_0x48d1a6[_0x39a7('0x36')];}VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x38')]=function(){var _0x5a2608=this;for(var _0x4d9af9 in this[_0x39a7('0x13')]){if(this[_0x39a7('0x13')][_0x39a7('0x30')](_0x4d9af9)&&!this['channels'][_0x4d9af9][_0x39a7('0x39')]){this[_0x39a7('0xf')][_0x39a7('0xc')](function(){if(!_['isNil'](_0x5a2608[_0x39a7('0x13')][_0x4d9af9])){return ami['Action']({'action':_0x39a7('0x3a'),'channel':_0x5a2608[_0x39a7('0x13')][_0x4d9af9][_0x39a7('0x3b')]})['catch'](function(_0x4e2c5b){if(_0x4e2c5b[_0x39a7('0x3c')]===_0x39a7('0x3d')){setTimeout(function(){if(_0x5a2608[_0x39a7('0x13')][_0x4d9af9]){delete _0x5a2608[_0x39a7('0x13')][_0x4d9af9];logger[_0x39a7('0x3e')](_0x39a7('0x3f'),_0x4d9af9,util[_0x39a7('0x40')](_0x4e2c5b,{'showHidden':![],'depth':null}));}if(_0x5a2608[_0x39a7('0x10')][_0x4d9af9]){delete _0x5a2608[_0x39a7('0x10')][_0x4d9af9];logger[_0x39a7('0x3e')]('[%s][voiceQueueReport][checkQueueReport]',_0x4d9af9,util[_0x39a7('0x40')](_0x4e2c5b,{'showHidden':![],'depth':null}));}if(_0x5a2608[_0x39a7('0x18')][_0x4d9af9]){delete _0x5a2608[_0x39a7('0x18')][_0x4d9af9];logger['error'](_0x39a7('0x41'),_0x4d9af9,util[_0x39a7('0x40')](_0x4e2c5b,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x29')]=function(){logger['error'](_0x39a7('0x42'));clearChannels(this[_0x39a7('0x13')]);this['clearQueueReport'](this[_0x39a7('0x10')]);clearAgentBooked(this[_0x39a7('0x12')]);clearVoiceQueues(this[_0x39a7('0x15')]);clearCampaigns(this[_0x39a7('0x16')]);this[_0x39a7('0x17')]=initializeSummary();};VoiceQueueReport[_0x39a7('0x37')]['clearQueueReport']=function(_0x2c78fd){var _0x30b6df=this;if(!_[_0x39a7('0x2f')](_0x2c78fd)){for(var _0xf5ff5e in _0x2c78fd){if(_0x2c78fd[_0x39a7('0x30')](_0xf5ff5e)){_0x30b6df[_0x39a7('0x43')](_0x2c78fd[_0xf5ff5e],_0x39a7('0x44'));delete _0x2c78fd[_0xf5ff5e];}}}};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x45')]=function(_0x2aede5,_0x29d45b,_0x1df1de){io['to'](_0x2aede5)['emit'](_0x29d45b,_0x1df1de);};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x46')]=function(_0x12dc49,_0x11a5d6){logger[_0x39a7('0x47')](_0x39a7('0x48')+_0x11a5d6+_0x39a7('0x49'),_0x12dc49[_0x39a7('0x4a')],util[_0x39a7('0x40')](_0x12dc49,{'showHidden':![],'depth':null}));this[_0x39a7('0x45')](util[_0x39a7('0x4b')]('voice:queue:%s',_0x12dc49[_0x39a7('0x4c')]),_0x39a7('0x4d'),_0x12dc49);io[_0x39a7('0x45')](_0x39a7('0x4e'),_0x12dc49);};VoiceQueueReport['prototype'][_0x39a7('0x43')]=function(_0x4b81b6,_0x1bf0a2){logger['debug'](_0x39a7('0x48')+_0x1bf0a2+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x4b81b6[_0x39a7('0x4a')],util[_0x39a7('0x40')](_0x4b81b6,{'showHidden':![],'depth':null}));if(_0x4b81b6['queuecallerexitreason']==='ATTENDEDTRANSFER'){return;}this[_0x39a7('0x45')](util[_0x39a7('0x4b')](_0x39a7('0x4f'),_0x4b81b6[_0x39a7('0x4c')]),_0x39a7('0x50'),_0x4b81b6);io['emit'](_0x39a7('0x51'),_0x4b81b6);};VoiceQueueReport[_0x39a7('0x37')]['emitInboundVoiceQueueSummary']=function(_0x29233b){if(_0x29233b[_0x39a7('0x52')]===_0x39a7('0x53')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x39a7('0x40')](_0x29233b,{'showHidden':![],'depth':null}));this['emit'](util[_0x39a7('0x4b')](_0x39a7('0x4f'),_0x29233b[_0x39a7('0x54')]),_0x39a7('0x55'),_0x29233b);}};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x56')]=function(_0x27bcad){return _0x27bcad!==null&&!_[_0x39a7('0x57')](_0x27bcad);};VoiceQueueReport[_0x39a7('0x37')]['loopQueueShow']=function(){var _0x1f4414=this;setInterval(function(){_0x1f4414['clearZombieChannels']();ami[_0x39a7('0x58')]({'action':_0x39a7('0x59')})[_0x39a7('0x5a')](function(_0x42bd81){logger[_0x39a7('0x3e')](_0x39a7('0x5b'),util[_0x39a7('0x40')](_0x42bd81,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x2d')]=function(){var _0x4af492=this;setInterval(function(){if(!_0x4af492['summary'][_0x39a7('0x5c')]){return ami['Action']({'action':_0x39a7('0x5d')})[_0x39a7('0x5e')](function(_0x2087e3){_0x4af492['summary']['id']=_0x2087e3[_0x39a7('0x5f')];_0x4af492[_0x39a7('0x17')][_0x39a7('0x5c')]=!![];_0x4af492[_0x39a7('0x17')][_0x39a7('0x60')][_0x2087e3[_0x39a7('0x5f')]]={};})[_0x39a7('0x5a')](function(_0x3511c2){logger[_0x39a7('0x3e')](_0x39a7('0x61'),util[_0x39a7('0x40')](_0x3511c2,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x39a7('0x62')]=function(_0x2b7c5f,_0x376240){var _0x4a613a;if(this['summary']&&this[_0x39a7('0x17')][_0x39a7('0x59')]&&this['summary'][_0x39a7('0x59')][_0x2b7c5f[_0x39a7('0x54')]]){_0x4a613a=this[_0x39a7('0x17')][_0x39a7('0x59')][_0x2b7c5f[_0x39a7('0x54')]][_0x39a7('0x63')];}var _0x5ba31b=new VoiceQueueSummary(_0x2b7c5f);return _0x5ba31b[_0x39a7('0x64')](_0x376240[_0x39a7('0x12')],this[_0x39a7('0x12')],_0x4a613a,this[_0x39a7('0x11')]['channels']);};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x65')]=function(_0x205dd5,_0xd47c9a){var _0x46a284=this['createQueueSummaryReport'](_0x205dd5,_0xd47c9a);var _0x2a347c=![];_0x2a347c=_0x46a284['compareToInboundQueue'](_0x205dd5);if(_0x2a347c){Object[_0x39a7('0x66')](_0x205dd5,_0x46a284);this[_0x39a7('0x11')]['voiceQueues'][_0x205dd5['name']]=_0x205dd5;this[_0x39a7('0x67')](_0x46a284);}};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x68')]=function(_0x1c6fd7){var _0x1b8c70=null;var _0x2b66ff=this[_0x39a7('0x17')]['id'];if(this['summary']['queuestatus'][_0x2b66ff]){_0x1b8c70=this[_0x39a7('0x17')][_0x39a7('0x60')][_0x2b66ff][_0x1c6fd7[_0x39a7('0x5f')]];}if(!_0x1b8c70){this[_0x39a7('0x17')]=initializeSummary();return;}var _0x130795=this[_0x39a7('0x15')][_0x1b8c70[_0x39a7('0x4c')]];if(_0x130795[_0x39a7('0x52')]===_0x39a7('0x53')){this[_0x39a7('0x65')](_0x130795,_0x1b8c70);}else if(_0x130795[_0x39a7('0x52')]===_0x39a7('0x69')){var _0x133252=this[_0x39a7('0x62')](_0x130795,_0x1b8c70);ami[_0x39a7('0x45')]('custom:queuesummary',_0x133252);}this[_0x39a7('0x17')][_0x39a7('0x6a')]-=0x1;var _0x45499b=this[_0x39a7('0x17')][_0x39a7('0x6a')]>0x0?!![]:![];if(!_0x45499b){return this[_0x39a7('0x1c')](this[_0x39a7('0x17')][_0x39a7('0x6b')]);}};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x1e')]=function(_0x540a31){var _0x2c7ced=this[_0x39a7('0x17')]['id'];if(this[_0x39a7('0x17')][_0x39a7('0x60')][_0x2c7ced]&&this[_0x39a7('0x17')]['queuestatus'][_0x2c7ced][_0x540a31[_0x39a7('0x5f')]]){this[_0x39a7('0x17')]['queuestatus'][_0x2c7ced][_0x540a31[_0x39a7('0x5f')]]['agents'][_0x39a7('0x6c')](_0x540a31);}};VoiceQueueReport[_0x39a7('0x37')]['syncQueueSummary']=function(_0x37fe7c){var _0x4f85c9=this;try{if(this[_0x39a7('0x56')](_0x37fe7c)&&this['isNotNull'](_0x37fe7c['queue'])){logger[_0x39a7('0x47')](_0x39a7('0x6d'),util[_0x39a7('0x40')](_0x37fe7c,{'showHidden':![],'depth':null}));var _0x94bb53=this[_0x39a7('0x15')][_0x37fe7c['queue']];if(_0x94bb53){logger[_0x39a7('0x47')](_0x39a7('0x6e'),_0x94bb53['name']);this[_0x39a7('0x17')][_0x39a7('0x59')][_0x94bb53[_0x39a7('0x54')]]={'summaryEvent':_0x37fe7c};this['summary'][_0x39a7('0x6a')]+=0x1;return ami[_0x39a7('0x58')]({'action':_0x39a7('0x60'),'queue':_0x94bb53[_0x39a7('0x54')]})[_0x39a7('0x5e')](function(_0x2fade8){if(!_0x4f85c9['summary']['queuestatus'][_0x37fe7c['actionid']]){_0x4f85c9[_0x39a7('0x17')][_0x39a7('0x60')][_0x37fe7c[_0x39a7('0x5f')]]={};}_0x4f85c9[_0x39a7('0x17')]['queuestatus'][_0x37fe7c['actionid']][_0x2fade8[_0x39a7('0x5f')]]={'queue':_0x94bb53['name'],'agents':[]};})[_0x39a7('0x5a')](function(_0x281a3c){throw _0x281a3c;});}}}catch(_0x167d06){logger[_0x39a7('0x3e')](_0x39a7('0x61'),util[_0x39a7('0x40')](_0x167d06,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x1c')]=function(_0x9df22b){if(this['summary'][_0x39a7('0x6a')]>0x0){this[_0x39a7('0x17')][_0x39a7('0x6b')]=_0x9df22b;return;}logger[_0x39a7('0x47')](_0x39a7('0x6f'),util[_0x39a7('0x40')](_0x9df22b,{'showHidden':![],'depth':null}));this[_0x39a7('0x17')]=initializeSummary();ami[_0x39a7('0x45')](_0x39a7('0x70'),{});};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x4011c5){try{if(this['isNotNull'](_0x4011c5)){logger[_0x39a7('0x47')](_0x39a7('0x71'),_0x4011c5[_0x39a7('0x4a')],util[_0x39a7('0x40')](_0x4011c5,{'showHidden':![],'depth':null}));if(_[_0x39a7('0x57')](this[_0x39a7('0x10')][_0x4011c5[_0x39a7('0x4a')]])){this[_0x39a7('0x10')][_0x4011c5[_0x39a7('0x4a')]]=[];}if(_[_0x39a7('0x57')](this[_0x39a7('0x13')][_0x4011c5[_0x39a7('0x4a')]])){this[_0x39a7('0x13')][_0x4011c5[_0x39a7('0x4a')]]={};}var _0x4bef72=new QueueReport();_0x4bef72[_0x39a7('0x4c')]=_0x4011c5['queue'];_0x4bef72[_0x39a7('0x52')]=this[_0x39a7('0x15')][_0x4bef72[_0x39a7('0x4c')]]&&this[_0x39a7('0x15')][_0x4bef72[_0x39a7('0x4c')]][_0x39a7('0x52')]?this[_0x39a7('0x15')][_0x4bef72[_0x39a7('0x4c')]][_0x39a7('0x52')]||_0x39a7('0x53'):_0x39a7('0x53');_0x4bef72['queuecallerjoinAt']=moment()[_0x39a7('0x4b')](_0x39a7('0x72'));_0x4bef72[_0x39a7('0x73')]=_0x4011c5[_0x39a7('0x73')];_0x4bef72[_0x39a7('0x74')]=_0x4011c5[_0x39a7('0x74')];_0x4bef72[_0x39a7('0x4a')]=_0x4011c5['uniqueid'];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4bef72[_0x39a7('0x4c')],_0x4bef72[_0x39a7('0x52')]);Object[_0x39a7('0x66')](_0x4bef72,_[_0x39a7('0x75')](_0x4011c5,_[_0x39a7('0x76')](_0x4bef72)));this[_0x39a7('0x10')][_0x4011c5['uniqueid']][_0x39a7('0x6c')](_0x4bef72);this[_0x39a7('0x13')][_0x4011c5[_0x39a7('0x4a')]]=_0x4bef72;this[_0x39a7('0x46')](_0x4bef72,_0x39a7('0x1f'));}}catch(_0x288c7a){logger[_0x39a7('0x3e')](_0x39a7('0x71'),_0x4011c5['uniqueid'],util[_0x39a7('0x40')](_0x288c7a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x39a7('0x37')]['syncQueueCallerAbandon']=function(_0x569cd0){try{if(this[_0x39a7('0x56')](_0x569cd0)){logger[_0x39a7('0x47')](_0x39a7('0x77'),_0x569cd0[_0x39a7('0x4a')],util[_0x39a7('0x40')](_0x569cd0,{'showHidden':![],'depth':null}));if(this[_0x39a7('0x10')][_0x569cd0[_0x39a7('0x4a')]]){var _0x74b523=_[_0x39a7('0x78')](this[_0x39a7('0x10')][_0x569cd0['uniqueid']]);_0x74b523[_0x39a7('0x36')]=![];_0x74b523[_0x39a7('0x79')]=null;_0x74b523['holdtime']=_0x569cd0['holdtime'];_0x74b523[_0x39a7('0x7a')]=_0x569cd0[_0x39a7('0x7a')];_0x74b523[_0x39a7('0x21')]=!![];_0x74b523[_0x39a7('0x7b')]=moment()[_0x39a7('0x4b')](_0x39a7('0x72'));_0x74b523[_0x39a7('0x7c')]=_0x39a7('0x7d');_0x74b523[_0x39a7('0x7e')]=null;logger[_0x39a7('0x7f')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x74b523[_0x39a7('0x4c')],_0x74b523[_0x39a7('0x52')]);this['channels'][_0x569cd0[_0x39a7('0x4a')]]=_0x74b523;this[_0x39a7('0x43')](_0x74b523,_0x39a7('0x21'));}}}catch(_0x13daef){logger[_0x39a7('0x3e')](_0x39a7('0x77'),_0x569cd0[_0x39a7('0x4a')],util['inspect'](_0x13daef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x39a7('0x37')]['syncQueueCallerLeave']=function(_0xb198d2){try{if(this[_0x39a7('0x56')](_0xb198d2)){logger[_0x39a7('0x47')](_0x39a7('0x80'),_0xb198d2[_0x39a7('0x4a')],util['inspect'](_0xb198d2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xb198d2[_0x39a7('0x4a')]]){var _0x11a938=_[_0x39a7('0x78')](this[_0x39a7('0x10')][_0xb198d2[_0x39a7('0x4a')]]);_0x11a938[_0x39a7('0x81')]=moment()[_0x39a7('0x4b')](_0x39a7('0x72'));_0x11a938[_0x39a7('0x82')]=_0xb198d2[_0x39a7('0x82')];_0x11a938[_0x39a7('0x83')]=_0xb198d2[_0x39a7('0x83')];logger[_0x39a7('0x7f')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x11a938[_0x39a7('0x4c')],_0x11a938['type'],_0xb198d2['connectedlinenum'],_0xb198d2[_0x39a7('0x83')]);this[_0x39a7('0x13')][_0xb198d2[_0x39a7('0x4a')]]=_0x11a938;this[_0x39a7('0x46')](_0x11a938,_0x39a7('0x84'));}}}catch(_0x3e6943){logger[_0x39a7('0x3e')](_0x39a7('0x80'),_0xb198d2[_0x39a7('0x4a')],util['inspect'](_0x3e6943,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x25')]=function(_0x24db75){try{if(this[_0x39a7('0x56')](_0x24db75)){logger[_0x39a7('0x47')]('[%s][voiceQueueReport][agentconnect]',_0x24db75[_0x39a7('0x4a')],util[_0x39a7('0x40')](_0x24db75,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x24db75[_0x39a7('0x4a')]]){var _0x2cc5bf=_[_0x39a7('0x78')](this[_0x39a7('0x10')][_0x24db75[_0x39a7('0x4a')]]);_0x2cc5bf[_0x39a7('0x36')]=!![];_0x2cc5bf[_0x39a7('0x7c')]=_0x39a7('0x85');logger[_0x39a7('0x7f')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x2cc5bf[_0x39a7('0x4c')],_0x2cc5bf[_0x39a7('0x52')]);}}}catch(_0x36989d){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x24db75[_0x39a7('0x4a')],util[_0x39a7('0x40')](_0x36989d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x24')]=function(_0xbe2b0){try{if(this[_0x39a7('0x56')](_0xbe2b0)){logger[_0x39a7('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0xbe2b0[_0x39a7('0x4a')],util[_0x39a7('0x40')](_0xbe2b0,{'showHidden':![],'depth':null}));if(this[_0x39a7('0x10')][_0xbe2b0[_0x39a7('0x4a')]]){var _0x4f1528=_[_0x39a7('0x78')](this[_0x39a7('0x10')][_0xbe2b0['uniqueid']]);_0x4f1528[_0x39a7('0x21')]=![];_0x4f1528[_0x39a7('0x7b')]=null;_0x4f1528[_0x39a7('0x86')]=!![];_0x4f1528[_0x39a7('0x7e')]=_0xbe2b0[_0x39a7('0x87')];_0x4f1528['holdtime']=_0xbe2b0['holdtime'];_0x4f1528[_0x39a7('0x36')]=!![];_0x4f1528[_0x39a7('0x35')]=![];_0x4f1528[_0x39a7('0x88')]=null;if(!_0x4f1528[_0x39a7('0x89')]){if(_0xbe2b0['reason']==_0x39a7('0x89')){_0x4f1528[_0x39a7('0x7c')]='COMPLETED';logger[_0x39a7('0x7f')](_0x39a7('0x8a'),_0x4f1528['queue'],_0x4f1528['type']);}else{if(_[_0x39a7('0x8b')](_0xbe2b0['channel']['toLowerCase'](),'local/')){if(this[_0x39a7('0x10')][_0xbe2b0[_0x39a7('0x8c')]]){var _0x4ff1aa=_['last'](this[_0x39a7('0x10')][_0xbe2b0[_0x39a7('0x8c')]]);_0x4ff1aa[_0x39a7('0x36')]=![];_0x4ff1aa['queuecallerexit']=!![];_0x4ff1aa[_0x39a7('0x88')]=moment(_0x4f1528[_0x39a7('0x8d')])[_0x39a7('0x8e')](_0xbe2b0[_0x39a7('0x8f')],_0x39a7('0x90'))[_0x39a7('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ff1aa['queuecallerexitreason']=_0x39a7('0x91');_0x4ff1aa[_0x39a7('0x89')]=!![];_0x4ff1aa['transfertype']='FORWARD';_0x4ff1aa[_0x39a7('0x92')]=_0xbe2b0[_0x39a7('0x93')];_0x4ff1aa[_0x39a7('0x94')]=_0xbe2b0[_0x39a7('0x4a')];logger[_0x39a7('0x7f')](_0x39a7('0x95'),_0x4ff1aa[_0x39a7('0x4c')],_0x4ff1aa[_0x39a7('0x52')]);var _0x280387=this[_0x39a7('0x10')][_0xbe2b0[_0x39a7('0x8c')]];this['queueReports'][_0xbe2b0[_0x39a7('0x8c')]]=this[_0x39a7('0x10')][_0xbe2b0[_0x39a7('0x4a')]];this[_0x39a7('0x10')][_0xbe2b0['uniqueid']]=_0x280387;}}else{_0x4f1528[_0x39a7('0x7c')]='COMPLETEDBY'+_0xbe2b0[_0x39a7('0x96')]['toUpperCase']();logger[_0x39a7('0x7f')](_0x39a7('0x97'),_0x4f1528[_0x39a7('0x4c')],_0x4f1528[_0x39a7('0x52')],_0x4f1528['queuecallerexitreason']);}}}this['channels'][_0xbe2b0[_0x39a7('0x4a')]]=_0x4f1528;}}}catch(_0x21631e){logger[_0x39a7('0x3e')](_0x39a7('0x98'),_0xbe2b0[_0x39a7('0x4a')],util[_0x39a7('0x40')](_0x21631e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x99')]=function(_0x4177fa){try{if(this['isNotNull'](_0x4177fa)){logger['debug'](_0x39a7('0x9a'),_0x4177fa['uniqueid'],util['inspect'](_0x4177fa,{'showHidden':![],'depth':null}));this[_0x39a7('0x9b')](_0x4177fa[_0x39a7('0x4a')],_[_0x39a7('0x76')](_0x4177fa[_0x39a7('0x9c')])[0x0],_0x4177fa[_0x39a7('0x9d')]);if(this[_0x39a7('0x10')][_0x4177fa[_0x39a7('0x4a')]]){var _0x3dd50f=_[_0x39a7('0x78')](this['queueReports'][_0x4177fa[_0x39a7('0x4a')]]);if(_0x3dd50f){if(this[_0x39a7('0x56')](_0x4177fa[_0x39a7('0x9c')])&&this[_0x39a7('0x56')](_0x4177fa['variable'][_0x39a7('0x60')])){switch(_0x4177fa[_0x39a7('0x9d')]){case _0x39a7('0x9e'):_0x3dd50f['queuecallerexit']=![];_0x3dd50f[_0x39a7('0x88')]=null;break;case _0x39a7('0x9f'):_0x3dd50f[_0x39a7('0xa0')]=_0x39a7('0xa1');_0x3dd50f['queuecallerexit']=!![];_0x3dd50f[_0x39a7('0x88')]=moment()[_0x39a7('0x4b')](_0x39a7('0x72'));_0x3dd50f[_0x39a7('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x39a7('0x47')](_0x39a7('0xa2'),_0x4177fa[_0x39a7('0x4a')],util['inspect'](_0x3dd50f,{'showHidden':![],'depth':null}));ami[_0x39a7('0x45')](_0x39a7('0xa3'),_0x3dd50f);break;default:_0x3dd50f[_0x39a7('0x35')]=!![];_0x3dd50f[_0x39a7('0x88')]=moment()['format'](_0x39a7('0x72'));_0x3dd50f[_0x39a7('0x81')]=moment()[_0x39a7('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3dd50f[_0x39a7('0x21')]=![];_0x3dd50f[_0x39a7('0x7b')]=null;_0x3dd50f[_0x39a7('0x7c')]=_0x4177fa[_0x39a7('0x9d')];this[_0x39a7('0x13')][_0x4177fa[_0x39a7('0x4a')]]=_0x3dd50f;this[_0x39a7('0x43')](_0x3dd50f,_0x39a7('0x26'));}else if(this['isNotNull'](_0x4177fa[_0x39a7('0x9c')])&&this['isNotNull'](_0x4177fa[_0x39a7('0x9c')][_0x39a7('0xa4')])){if(!_0x3dd50f[_0x39a7('0x21')]){_0x3dd50f['queuecallerexit']=!![];_0x3dd50f['queuecallerexitAt']=moment()['format'](_0x39a7('0x72'));_0x3dd50f[_0x39a7('0x7c')]=_0x39a7('0xa5');_0x3dd50f['queuecallerleaveAt']=moment()['format'](_0x39a7('0x72'));this[_0x39a7('0x13')][_0x4177fa[_0x39a7('0x4a')]]=_0x3dd50f;}}logger[_0x39a7('0x7f')](_0x39a7('0xa6'),_0x4177fa[_0x39a7('0x4a')],_0x3dd50f[_0x39a7('0x4c')],_0x3dd50f['type'],_[_0x39a7('0x76')](_0x4177fa['variable'])[0x0],_0x4177fa['value']);_0x3dd50f[_0x39a7('0x18')]=this[_0x39a7('0x18')][_0x4177fa['uniqueid']];}}}}catch(_0x5b1cf4){logger[_0x39a7('0x3e')](_0x39a7('0x9a'),_0x4177fa[_0x39a7('0x4a')],util['inspect'](_0x5b1cf4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x39a7('0x37')][_0x39a7('0x9b')]=function(_0x4c2722,_0x583183,_0x1de548){var _0x51137e=[_0x39a7('0xa7'),_0x39a7('0xa8'),_0x39a7('0xa9'),_0x39a7('0xaa'),_0x39a7('0xab'),_0x39a7('0xac'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0x39a7('0xad'),_0x39a7('0xae'),_0x39a7('0xaf'),_0x39a7('0xb0'),_0x39a7('0xb1'),'memberinterface','memberlastcall',_0x39a7('0x87'),'memberpenalty',_0x39a7('0xb2')];if(!_[_0x39a7('0xb3')](_0x583183)&&!_[_0x39a7('0xb4')](_0x51137e,_0x583183)){if(_[_0x39a7('0x57')](this[_0x39a7('0x18')][_0x4c2722])){this[_0x39a7('0x18')][_0x4c2722]={};}this[_0x39a7('0x18')][_0x4c2722][_0x583183]=_0x1de548;}};VoiceQueueReport['prototype'][_0x39a7('0xb5')]=function(_0x570903,_0x3af647,_0x89928b){try{var _0xc00818={};if(this[_0x39a7('0x10')][_0x570903]){for(var _0x4e8aa2=0x0;_0x4e8aa2{delete this['channels'][_0x59056d];},_0x33c99b);}};module[_0x39a7('0xee')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 2cfa53c..6e6cf0b 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d18=['Request','CreateReportAgentPreview','../client','createHistory','campaign','queue'];(function(_0x1f95f7,_0x361b99){var _0x1a0a51=function(_0x49275e){while(--_0x49275e){_0x1f95f7['push'](_0x1f95f7['shift']());}};_0x1a0a51(++_0x361b99);}(_0x8d18,0x15e));var _0x88d1=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0x8d18[_0x4e6eb2];return _0x4e0c1c;};'use strict';var client=require(_0x88d1('0x0'));exports[_0x88d1('0x1')]=function(_0x395bff){return function(){_0x395bff[_0x88d1('0x2')]=_0x395bff[_0x88d1('0x3')];return client[_0x88d1('0x4')]('CreateReportAgentPreview',{'body':_0x395bff,'log':_0x88d1('0x5')});};}; \ No newline at end of file +var _0xec5c=['queue','Request','CreateReportAgentPreview','createHistory','campaign'];(function(_0x10f48a,_0x5f3083){var _0x56e363=function(_0x5114b2){while(--_0x5114b2){_0x10f48a['push'](_0x10f48a['shift']());}};_0x56e363(++_0x5f3083);}(_0xec5c,0x1c5));var _0xcec5=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0xec5c[_0x47568e];return _0x33815b;};'use strict';var client=require('../client');exports[_0xcec5('0x0')]=function(_0x28d0ab){return function(){_0x28d0ab[_0xcec5('0x1')]=_0x28d0ab[_0xcec5('0x2')];return client[_0xcec5('0x3')](_0xcec5('0x4'),{'body':_0x28d0ab,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 51bfc83..09ca8ae 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c87=['CreateAttachment','../client','create','Request'];(function(_0x150caa,_0x1dfe18){var _0x2af033=function(_0x4a1132){while(--_0x4a1132){_0x150caa['push'](_0x150caa['shift']());}};_0x2af033(++_0x1dfe18);}(_0x7c87,0x1a1));var _0x77c8=function(_0x2a95ae,_0x530c52){_0x2a95ae=_0x2a95ae-0x0;var _0x18cc5b=_0x7c87[_0x2a95ae];return _0x18cc5b;};'use strict';var client=require(_0x77c8('0x0'));exports[_0x77c8('0x1')]=function(_0x35987b){return client[_0x77c8('0x2')](_0x77c8('0x3'),{'body':_0x35987b,'log':'CreateAttachment'});}; \ No newline at end of file +var _0xe08e=['../client','create','CreateAttachment'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0xe08e,0x7b));var _0xee08=function(_0x4cbdca,_0x2ffe6e){_0x4cbdca=_0x4cbdca-0x0;var _0x5bca91=_0xe08e[_0x4cbdca];return _0x5bca91;};'use strict';var client=require(_0xee08('0x0'));exports[_0xee08('0x1')]=function(_0x1a77ee){return client['Request'](_0xee08('0x2'),{'body':_0x1a77ee,'log':_0xee08('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index bc026f9..cf4d015 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','name','callerid','Interval','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt'];(function(_0x3387d3,_0x43d8c1){var _0x295a73=function(_0x54a87c){while(--_0x54a87c){_0x3387d3['push'](_0x3387d3['shift']());}};_0x295a73(++_0x43d8c1);}(_0xdb28,0x106));var _0x8db2=function(_0x30931c,_0xaed450){_0x30931c=_0x30931c-0x0;var _0x393dfb=_0xdb28[_0x30931c];return _0x393dfb;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(){return client[_0x8db2('0x2')](_0x8db2('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'dialOriginateTimeout',_0x8db2('0x9'),_0x8db2('0xa'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'dialAbandonedMaxRetry',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'dialAgentRejectMaxRetry',_0x8db2('0x15'),_0x8db2('0x16'),'dialGlobalInterval',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21'),_0x8db2('0x22')],'include':[{'model':_0x8db2('0x23'),'as':_0x8db2('0x23'),'attributes':['id',_0x8db2('0x24'),'callerid',_0x8db2('0x5')]},{'model':_0x8db2('0x23'),'as':'TrunkBackup','attributes':['id',_0x8db2('0x24'),_0x8db2('0x25'),_0x8db2('0x5')]},{'model':_0x8db2('0x26'),'as':_0x8db2('0x26'),'attributes':['id',_0x8db2('0x24')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x8db2('0x24'),_0x8db2('0x27')]}]},{'model':_0x8db2('0x28'),'as':_0x8db2('0x28'),'attributes':['id','name']}]},'log':_0x8db2('0x29')});};}; \ No newline at end of file +var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x208f80,_0x2522c6){var _0x71c40c=function(_0x555c9a){while(--_0x555c9a){_0x208f80['push'](_0x208f80['shift']());}};_0x71c40c(++_0x2522c6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 21c1f18..e8bc3ef 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1dbf=['CreateCmContact','getContacts','GetCmContact','../client','Request'];(function(_0x1dfec0,_0x3fc8f){var _0x56eb82=function(_0x458b09){while(--_0x458b09){_0x1dfec0['push'](_0x1dfec0['shift']());}};_0x56eb82(++_0x3fc8f);}(_0x1dbf,0x99));var _0xf1db=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x1dbf[_0x280f4a];return _0x1bb157;};'use strict';var client=require(_0xf1db('0x0'));exports['createContact']=function(_0x824ad5){return function(){return client[_0xf1db('0x1')](_0xf1db('0x2'),{'body':_0x824ad5,'log':_0xf1db('0x2')});};};exports[_0xf1db('0x3')]=function(_0x1faafc){return function(){return client[_0xf1db('0x1')](_0xf1db('0x4'),{'options':_0x1faafc,'log':'GetCmContact'});};}; \ No newline at end of file +var _0xc24f=['Request','CreateCmContact','../client','createContact'];(function(_0x24baa4,_0x9e7bfd){var _0x210622=function(_0xdfaf23){while(--_0xdfaf23){_0x24baa4['push'](_0x24baa4['shift']());}};_0x210622(++_0x9e7bfd);}(_0xc24f,0x15a));var _0xfc24=function(_0x4d155a,_0x1a0a89){_0x4d155a=_0x4d155a-0x0;var _0xef1d51=_0xc24f[_0x4d155a];return _0xef1d51;};'use strict';var client=require(_0xfc24('0x0'));exports[_0xfc24('0x1')]=function(_0xd38a53){return function(){return client[_0xfc24('0x2')](_0xfc24('0x3'),{'body':_0xd38a53,'log':_0xfc24('0x3')});};};exports['getContacts']=function(_0x1a2eec){return function(){return client['Request']('GetCmContact',{'options':_0x1a2eec,'log':'GetCmContact'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 79b95a1..0245f27 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x539d=['handlePreviewRecallNotifications','../client','getContacts','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','Request','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','ContactId','ListId','countReScheduled','CountReScheduled','GetCmHopperPreview','Agent','VoiceQueue','Queue','name','getContactRecallMe','User','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls'];(function(_0x3ab05d,_0x378119){var _0x125014=function(_0x21239a){while(--_0x21239a){_0x3ab05d['push'](_0x3ab05d['shift']());}};_0x125014(++_0x378119);}(_0x539d,0x17b));var _0xd539=function(_0x4aa662,_0x1cc90c){_0x4aa662=_0x4aa662-0x0;var _0x336478=_0x539d[_0x4aa662];return _0x336478;};'use strict';var client=require(_0xd539('0x0'));var moment=require('moment');exports[_0xd539('0x1')]=function(_0x1c859a,_0x4f0303){return function(){return client['Request'](_0xd539('0x2'),{'options':{'where':{'VoiceQueueId':_0x1c859a},'include':[{'model':_0xd539('0x3'),'as':_0xd539('0x4')}],'limit':_0x4f0303,'raw':![]},'log':_0xd539('0x5')});};};exports[_0xd539('0x6')]=function(_0x4c9697,_0x341dd4,_0x158719){return function(){return client[_0xd539('0x7')](_0xd539('0x8'),{'body':_0x4c9697,'options':{'where':{'VoiceQueueId':_0x341dd4,'scheduledat':{'$lte':moment()[_0xd539('0x9')](_0xd539('0xa'))}},'limit':_0x158719},'log':'UpdateCmHopper'});};};exports[_0xd539('0xb')]=function(_0x2015a5){return client[_0xd539('0x7')](_0xd539('0x8'),{'body':_0x2015a5,'options':{'where':{'ContactId':_0x2015a5['ContactId'],'ListId':_0x2015a5['ListId'],'VoiceQueueId':_0x2015a5[_0xd539('0xc')],'CampaignId':_0x2015a5[_0xd539('0xd')]}},'log':_0xd539('0xb')});};exports[_0xd539('0xe')]=function(_0x424b1a,_0x3c59d1,_0x2367f1){return function(){return client[_0xd539('0x7')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x424b1a,'ListId':_0x3c59d1,'ContactId':_0x2367f1}},'log':_0xd539('0xf')});};};exports[_0xd539('0x10')]=function(_0x191f6e,_0x4b3461,_0x1391f8,_0xac445e){return client['Request'](_0xd539('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x191f6e,'active':![],'scheduledat':{'$lte':moment()[_0xd539('0x9')](_0xd539('0xa'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4b3461}}]},'order':[[_0xd539('0x12'),_0xd539('0x13')],[_0xd539('0x14'),_0xac445e],['id',_0xd539('0x15')]],'raw':!![],'limit':_0x1391f8},'log':_0xd539('0x11')});};exports[_0xd539('0x16')]=function(_0x17f7bf,_0x460f3c,_0x54d8ff){return client[_0xd539('0x7')](_0xd539('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x17f7bf,'active':![],'scheduledat':{'$lte':moment()[_0xd539('0x9')](_0xd539('0xa'))}},'include':[{'model':_0xd539('0x3'),'as':_0xd539('0x4')}],'order':[[_0xd539('0x12'),_0xd539('0x13')],['scheduledat',_0x54d8ff],['id','ASC']],'raw':!![],'limit':_0x460f3c},'log':_0xd539('0x17')});};exports[_0xd539('0x18')]=function(_0x3edf97,_0xad186e){_0x3edf97['campaign']=_0x3edf97[_0xd539('0x19')];return client[_0xd539('0x7')](_0xd539('0x1a'),{'body':_0x3edf97,'options':{'where':{'ContactId':_0x3edf97[_0xd539('0x1b')],'ListId':_0x3edf97[_0xd539('0x1c')],'VoiceQueueId':_0x3edf97[_0xd539('0xc')],'CampaignId':_0x3edf97[_0xd539('0xd')],'active':_0xad186e?undefined:!![]}},'log':_0xd539('0x1a')});};exports[_0xd539('0x1d')]=function(_0x56c100){return client[_0xd539('0x7')](_0xd539('0x1e'),{'options':{'where':{'VoiceQueueId':_0x56c100['id']?_0x56c100['id']||null:null}},'log':_0xd539('0x1d')});};exports['getContactPreview']=function(_0x564cf2){return function(){return client[_0xd539('0x7')](_0xd539('0x1f'),{'options':{'where':{'id':_0x564cf2},'include':[{'model':_0xd539('0x3'),'as':_0xd539('0x4')},{'model':'User','as':_0xd539('0x20'),'attributes':['id','name']},{'model':_0xd539('0x21'),'as':_0xd539('0x22'),'attributes':['id',_0xd539('0x23')]}],'raw':!![]},'log':_0xd539('0x5')});};};exports['unlockContact']=function(_0x4c836d,_0x24f94c,_0x40720f){return client['Request']('UpdateCmHopper',{'body':_0x4c836d,'options':{'where':{'id':_0x24f94c},'limit':_0x40720f},'log':'UpdateCmHopper'});};exports[_0xd539('0x24')]=function(_0x406710,_0x66b2ab){return function(){return client[_0xd539('0x7')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x406710,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xd539('0x9')](_0xd539('0xa'))},'UserId':{'$in':_0x66b2ab}},'order':[['priority',_0xd539('0x13')],[_0xd539('0x14'),_0xd539('0x13')],['id',_0xd539('0x15')]],'include':[{'model':_0xd539('0x3'),'as':'Contact'},{'model':_0xd539('0x25'),'as':'Agent','attributes':['id',_0xd539('0x23'),'voicePause']}],'group':_0xd539('0x26'),'raw':!![]},'log':'GetContactDialer'});};};exports[_0xd539('0x27')]=function(_0x3edee2,_0xca69e5){return client[_0xd539('0x7')](_0xd539('0x28'),{'body':_0x3edee2,'options':_0xca69e5||{},'log':_0xd539('0x28')});};exports[_0xd539('0x29')]=function(_0xcc2339,_0x3a6647,_0x400a07){return function(){return client[_0xd539('0x7')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0xcc2339,'interval':_0x3a6647,'availableAgentsIds':_0x400a07}},'log':_0xd539('0x29')});};}; \ No newline at end of file +var _0xc99e=['GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','GetContactDialerIvr','moveContactManagedDialer','MoveContactManagedDialer','CampaignId','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue','unlockContact','UpdateCmHopper','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','CmContact','Contact','getCmHopper','updateContacts','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','destroyContact','DestroyCmHopper'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xc99e,0x6e));var _0xec99=function(_0x163163,_0x467df1){_0x163163=_0x163163-0x0;var _0x4be8c=_0xc99e[_0x163163];return _0x4be8c;};'use strict';var client=require(_0xec99('0x0'));var moment=require(_0xec99('0x1'));exports[_0xec99('0x2')]=function(_0x1d5800,_0x22b65c){return function(){return client[_0xec99('0x3')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x1d5800},'include':[{'model':_0xec99('0x4'),'as':_0xec99('0x5')}],'limit':_0x22b65c,'raw':![]},'log':_0xec99('0x6')});};};exports[_0xec99('0x7')]=function(_0x1b5c37,_0x39821d,_0x451dd4){return function(){return client[_0xec99('0x3')]('UpdateCmHopper',{'body':_0x1b5c37,'options':{'where':{'VoiceQueueId':_0x39821d,'scheduledat':{'$lte':moment()[_0xec99('0x8')](_0xec99('0x9'))}},'limit':_0x451dd4},'log':'UpdateCmHopper'});};};exports[_0xec99('0xa')]=function(_0xc0a747){return client['Request']('UpdateCmHopper',{'body':_0xc0a747,'options':{'where':{'ContactId':_0xc0a747[_0xec99('0xb')],'ListId':_0xc0a747[_0xec99('0xc')],'VoiceQueueId':_0xc0a747[_0xec99('0xd')],'CampaignId':_0xc0a747['CampaignId']}},'log':_0xec99('0xa')});};exports[_0xec99('0xe')]=function(_0x1853d7,_0x33e223,_0x45947c){return function(){return client[_0xec99('0x3')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x1853d7,'ListId':_0x33e223,'ContactId':_0x45947c}},'log':_0xec99('0xf')});};};exports['getContactDialer']=function(_0xe1a114,_0x53d44e,_0x2c7cc9,_0x57bf4c){return client['Request'](_0xec99('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xe1a114,'active':![],'scheduledat':{'$lte':moment()['format'](_0xec99('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x53d44e}}]},'order':[[_0xec99('0x11'),_0xec99('0x12')],[_0xec99('0x13'),_0x57bf4c],['id',_0xec99('0x14')]],'raw':!![],'limit':_0x2c7cc9},'log':_0xec99('0x10')});};exports[_0xec99('0x15')]=function(_0x4e03db,_0x304db7,_0x52d9a7){return client[_0xec99('0x3')](_0xec99('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x4e03db,'active':![],'scheduledat':{'$lte':moment()[_0xec99('0x8')](_0xec99('0x9'))}},'include':[{'model':'CmContact','as':'Contact'}],'order':[['priority',_0xec99('0x12')],[_0xec99('0x13'),_0x52d9a7],['id',_0xec99('0x14')]],'raw':!![],'limit':_0x304db7},'log':_0xec99('0x16')});};exports[_0xec99('0x17')]=function(_0x1edaf9,_0x1644a8){_0x1edaf9['campaign']=_0x1edaf9['queue'];return client[_0xec99('0x3')](_0xec99('0x18'),{'body':_0x1edaf9,'options':{'where':{'ContactId':_0x1edaf9['ContactId'],'ListId':_0x1edaf9[_0xec99('0xc')],'VoiceQueueId':_0x1edaf9[_0xec99('0xd')],'CampaignId':_0x1edaf9[_0xec99('0x19')],'active':_0x1644a8?undefined:!![]}},'log':_0xec99('0x18')});};exports[_0xec99('0x1a')]=function(_0x3c2e16){return client[_0xec99('0x3')](_0xec99('0x1b'),{'options':{'where':{'VoiceQueueId':_0x3c2e16['id']?_0x3c2e16['id']||null:null}},'log':_0xec99('0x1a')});};exports[_0xec99('0x1c')]=function(_0x5c374e){return function(){return client[_0xec99('0x3')]('GetCmHopperPreview',{'options':{'where':{'id':_0x5c374e},'include':[{'model':'CmContact','as':'Contact'},{'model':_0xec99('0x1d'),'as':_0xec99('0x1e'),'attributes':['id',_0xec99('0x1f')]},{'model':_0xec99('0x20'),'as':'Queue','attributes':['id',_0xec99('0x1f')]}],'raw':!![]},'log':_0xec99('0x6')});};};exports[_0xec99('0x21')]=function(_0x40bdcc,_0x3c62eb,_0x8b0181){return client[_0xec99('0x3')](_0xec99('0x22'),{'body':_0x40bdcc,'options':{'where':{'id':_0x3c62eb},'limit':_0x8b0181},'log':_0xec99('0x22')});};exports[_0xec99('0x23')]=function(_0x153bde,_0x575ab4){return function(){return client[_0xec99('0x3')](_0xec99('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x153bde,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0xec99('0x9'))},'UserId':{'$in':_0x575ab4}},'order':[[_0xec99('0x11'),_0xec99('0x12')],['scheduledat',_0xec99('0x12')],['id',_0xec99('0x14')]],'include':[{'model':_0xec99('0x4'),'as':_0xec99('0x5')},{'model':_0xec99('0x1d'),'as':_0xec99('0x1e'),'attributes':['id','name',_0xec99('0x25')]}],'group':_0xec99('0x26'),'raw':!![]},'log':_0xec99('0x10')});};};exports['resetActiveCalls']=function(_0x49acae,_0x545450){return client[_0xec99('0x3')]('ResetActiveCalls',{'body':_0x49acae,'options':_0x545450||{},'log':_0xec99('0x27')});};exports[_0xec99('0x28')]=function(_0x65e062,_0x15ccf3,_0x3b350d){return function(){return client['Request'](_0xec99('0x29'),{'body':{'where':{'voiceQueueIds':_0x65e062,'interval':_0x15ccf3,'availableAgentsIds':_0x3b350d}},'log':_0xec99('0x28')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 953e5e8..17249d1 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb9c=['verifyAdditionalPhones','Request','VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client'];(function(_0x1bbdce,_0x4f0859){var _0x471822=function(_0x13efac){while(--_0x13efac){_0x1bbdce['push'](_0x1bbdce['shift']());}};_0x471822(++_0x4f0859);}(_0xcb9c,0x110));var _0xccb9=function(_0x4e81e,_0x15ada2){_0x4e81e=_0x4e81e-0x0;var _0x30d82d=_0xcb9c[_0x4e81e];return _0x30d82d;};'use strict';var client=require(_0xccb9('0x0'));exports[_0xccb9('0x1')]=function(_0x1c6257,_0x11b2fa,_0x1647b1){return client[_0xccb9('0x2')](_0xccb9('0x3'),{'body':_0x1c6257,'reason':_0x11b2fa,'entity':_0x1647b1,'log':_0xccb9('0x3')});};exports['swapAdditionalPhones']=function(_0x125125,_0x409f42,_0x25107c){return client['Request'](_0xccb9('0x4'),{'body':_0x125125,'duration':_0x409f42,'waitTime':_0x25107c,'log':_0xccb9('0x4')});};exports[_0xccb9('0x5')]=function(_0x54e899){return function(){return client[_0xccb9('0x2')](_0xccb9('0x6'),{'body':_0x54e899,'log':_0xccb9('0x6')});};}; \ No newline at end of file +var _0xa411=['Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','IncrementPreviewCounters','../client','verifyAdditionalPhones'];(function(_0x5be1de,_0x35745e){var _0x2238c1=function(_0x3dcae4){while(--_0x3dcae4){_0x5be1de['push'](_0x5be1de['shift']());}};_0x2238c1(++_0x35745e);}(_0xa411,0xb4));var _0x1a41=function(_0x2d310a,_0x489040){_0x2d310a=_0x2d310a-0x0;var _0x2f9a4a=_0xa411[_0x2d310a];return _0x2f9a4a;};'use strict';var client=require(_0x1a41('0x0'));exports[_0x1a41('0x1')]=function(_0x13f3ac,_0x463aa1,_0xb734bb){return client[_0x1a41('0x2')](_0x1a41('0x3'),{'body':_0x13f3ac,'reason':_0x463aa1,'entity':_0xb734bb,'log':_0x1a41('0x3')});};exports[_0x1a41('0x4')]=function(_0x5a51ae,_0xd86b58,_0x5a7d11){return client[_0x1a41('0x2')](_0x1a41('0x5'),{'body':_0x5a51ae,'duration':_0xd86b58,'waitTime':_0x5a7d11,'log':_0x1a41('0x5')});};exports['incrementPreviewCounters']=function(_0x2fd3f1){return function(){return client[_0x1a41('0x2')](_0x1a41('0x6'),{'body':_0x2fd3f1,'log':_0x1a41('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 6f91fc0..a6980ff 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6fb=['checkIsBlackListIvr','CampaignId','../client','checkIsBlackList','GetCmHopperBlack','phone'];(function(_0x319c7e,_0x312b62){var _0x59e511=function(_0xb109d0){while(--_0xb109d0){_0x319c7e['push'](_0x319c7e['shift']());}};_0x59e511(++_0x312b62);}(_0xb6fb,0xf2));var _0xbb6f=function(_0x45d318,_0x2b3ad9){_0x45d318=_0x45d318-0x0;var _0x195ff4=_0xb6fb[_0x45d318];return _0x195ff4;};'use strict';var client=require(_0xbb6f('0x0'));exports[_0xbb6f('0x1')]=function(_0x4a5254){return client['Request'](_0xbb6f('0x2'),{'options':{'where':{'VoiceQueueId':_0x4a5254['VoiceQueueId'],'phone':_0x4a5254[_0xbb6f('0x3')]},'raw':![]},'log':_0xbb6f('0x2')});};exports[_0xbb6f('0x4')]=function(_0x22ead1){return client['Request'](_0xbb6f('0x2'),{'options':{'where':{'CampaignId':_0x22ead1[_0xbb6f('0x5')],'phone':_0x22ead1[_0xbb6f('0x3')]},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file +var _0x5807=['GetCmHopperBlack','CampaignId','checkIsBlackList','Request','VoiceQueueId','phone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5807,0x80));var _0x7580=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x5807[_0x26fc81];return _0x9feece;};'use strict';var client=require('../client');exports[_0x7580('0x0')]=function(_0x4e2654){return client[_0x7580('0x1')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x4e2654[_0x7580('0x2')],'phone':_0x4e2654[_0x7580('0x3')]},'raw':![]},'log':_0x7580('0x4')});};exports['checkIsBlackListIvr']=function(_0x50af79){return client[_0x7580('0x1')](_0x7580('0x4'),{'options':{'where':{'CampaignId':_0x50af79[_0x7580('0x5')],'phone':_0x50af79[_0x7580('0x3')]},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 9802bce..9fe7068 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc8a=['campaign','queue','CreateCmHopperFinal','../client','createContact'];(function(_0x2cc437,_0x1b4c3f){var _0x2e163a=function(_0x2db7dc){while(--_0x2db7dc){_0x2cc437['push'](_0x2cc437['shift']());}};_0x2e163a(++_0x1b4c3f);}(_0xfc8a,0xc6));var _0xafc8=function(_0x15dafa,_0x3bd9b2){_0x15dafa=_0x15dafa-0x0;var _0x390812=_0xfc8a[_0x15dafa];return _0x390812;};'use strict';var client=require(_0xafc8('0x0'));exports[_0xafc8('0x1')]=function(_0x253c64){return function(){_0x253c64[_0xafc8('0x2')]=_0x253c64[_0xafc8('0x3')];return client['Request'](_0xafc8('0x4'),{'body':_0x253c64,'log':_0xafc8('0x4')});};}; \ No newline at end of file +var _0x17f1=['createContact','queue','../client'];(function(_0x64b31d,_0x393b36){var _0x42c45b=function(_0x2d2323){while(--_0x2d2323){_0x64b31d['push'](_0x64b31d['shift']());}};_0x42c45b(++_0x393b36);}(_0x17f1,0x16a));var _0x117f=function(_0x1a23ef,_0x47a8d7){_0x1a23ef=_0x1a23ef-0x0;var _0x6e4891=_0x17f1[_0x1a23ef];return _0x6e4891;};'use strict';var client=require(_0x117f('0x0'));exports[_0x117f('0x1')]=function(_0x198da4){return function(){_0x198da4['campaign']=_0x198da4[_0x117f('0x2')];return client['Request']('CreateCmHopperFinal',{'body':_0x198da4,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 0fd6b98..29270f5 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2001=['avgHandleTime','Request','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','startOf','ivr','../client','campaign','queue','CreateCmHopperHistory'];(function(_0x4369ba,_0x58cdfd){var _0x4c88a3=function(_0x4c4b32){while(--_0x4c4b32){_0x4369ba['push'](_0x4369ba['shift']());}};_0x4c88a3(++_0x58cdfd);}(_0x2001,0xf3));var _0x1200=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x2001[_0x5c2e3e];return _0x53f64a;};'use strict';var client=require(_0x1200('0x0'));var moment=require('moment');exports['createHistory']=function(_0x428991){_0x428991[_0x1200('0x1')]=_0x428991[_0x1200('0x2')];return client['Request'](_0x1200('0x3'),{'body':_0x428991,'log':_0x1200('0x3')});};exports[_0x1200('0x4')]=function(_0x2a8214){return client[_0x1200('0x5')](_0x1200('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0x1200('0x7')](_0x2a8214,_0x1200('0x8'))[_0x1200('0x9')](_0x1200('0xa')),moment()['format'](_0x1200('0xa'))]}},'raw':![]},'log':_0x1200('0xb')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client['Request'](_0x1200('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x1200('0xd'))[_0x1200('0x9')](_0x1200('0xa')),moment()[_0x1200('0xe')](_0x1200('0xd'))[_0x1200('0x9')](_0x1200('0xa'))]},'campaigntype':_0x1200('0x2')},'raw':![]},'log':_0x1200('0xc')});};};exports[_0x1200('0xf')]=function(){return function(){return client['Request'](_0x1200('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x1200('0x11')]('day')[_0x1200('0x9')](_0x1200('0xa')),moment()[_0x1200('0xe')](_0x1200('0xd'))[_0x1200('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x1200('0x12')},'raw':![]},'log':_0x1200('0x10')});};}; \ No newline at end of file +var _0xfe42=['YYYY-MM-DD\x20HH:mm:ss','format','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','endOf','queue','getCampaignHopperHistory','GetCampaignHopperHistory','../client','moment','createHistory','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xfe42,0x101));var _0x2fe4=function(_0x419779,_0x2a3ecc){_0x419779=_0x419779-0x0;var _0x15f3ed=_0xfe42[_0x419779];return _0x15f3ed;};'use strict';var client=require(_0x2fe4('0x0'));var moment=require(_0x2fe4('0x1'));exports[_0x2fe4('0x2')]=function(_0x57ada9){_0x57ada9['campaign']=_0x57ada9['queue'];return client[_0x2fe4('0x3')](_0x2fe4('0x4'),{'body':_0x57ada9,'log':_0x2fe4('0x4')});};exports[_0x2fe4('0x5')]=function(_0x29c866){return client['Request'](_0x2fe4('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0x2fe4('0x7')](_0x29c866,_0x2fe4('0x8'))['format'](_0x2fe4('0x9')),moment()[_0x2fe4('0xa')](_0x2fe4('0x9'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0x2fe4('0xb')]=function(){return function(){return client[_0x2fe4('0x3')](_0x2fe4('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x2fe4('0xd')](_0x2fe4('0xe'))[_0x2fe4('0xa')](_0x2fe4('0x9')),moment()[_0x2fe4('0xf')](_0x2fe4('0xe'))[_0x2fe4('0xa')](_0x2fe4('0x9'))]},'campaigntype':_0x2fe4('0x10')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x2fe4('0x11')]=function(){return function(){return client[_0x2fe4('0x3')](_0x2fe4('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x2fe4('0xd')](_0x2fe4('0xe'))[_0x2fe4('0xa')](_0x2fe4('0x9')),moment()[_0x2fe4('0xf')](_0x2fe4('0xe'))[_0x2fe4('0xa')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':'ivr'},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 88a863e..f5f0a7d 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x639a=['ListId','key','Trunk','callerid','getFaxAccount','notify','Request','NotifyFaxAccount','../client','getFaxAccounts','name','description','headerinfo','localstationid','minrate','maxrate','gateway','t38timeout','tech','TrunkId'];(function(_0x2d91e0,_0x24831a){var _0x5651f1=function(_0x4248d8){while(--_0x4248d8){_0x2d91e0['push'](_0x2d91e0['shift']());}};_0x5651f1(++_0x24831a);}(_0x639a,0x1e8));var _0xa639=function(_0x2bb366,_0x367d73){_0x2bb366=_0x2bb366-0x0;var _0x43d384=_0x639a[_0x2bb366];return _0x43d384;};'use strict';var client=require(_0xa639('0x0'));exports[_0xa639('0x1')]=function(){return function(){return client['Request']('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0xa639('0x2'),_0xa639('0x3'),'ecm',_0xa639('0x4'),_0xa639('0x5'),_0xa639('0x6'),_0xa639('0x7'),'modem',_0xa639('0x8'),'faxdetect',_0xa639('0x9'),_0xa639('0xa'),_0xa639('0xb'),_0xa639('0xc'),_0xa639('0xd')],'include':[{'model':'Trunk','as':_0xa639('0xe'),'attributes':['id',_0xa639('0x2'),_0xa639('0xf'),'active']}]},'log':_0xa639('0x10')});};};exports[_0xa639('0x11')]=function(_0x5a96fb,_0x34a5b1){return client[_0xa639('0x12')]('NotifyFaxAccount',{'account':{'id':_0x5a96fb},'body':_0x34a5b1,'log':_0xa639('0x13')});}; \ No newline at end of file +var _0x8a21=['tech','ListId','key','Trunk','callerid','active','getFaxAccount','notify','Request','NotifyFaxAccount','../client','GetFaxAccount','name','description','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8a21,0x1d8));var _0x18a2=function(_0x5b406e,_0xcd06bc){_0x5b406e=_0x5b406e-0x0;var _0xe7d242=_0x8a21[_0x5b406e];return _0xe7d242;};'use strict';var client=require(_0x18a2('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request'](_0x18a2('0x1'),{'options':{'raw':![],'attributes':['id',_0x18a2('0x2'),_0x18a2('0x3'),'ecm','headerinfo',_0x18a2('0x4'),_0x18a2('0x5'),_0x18a2('0x6'),_0x18a2('0x7'),_0x18a2('0x8'),_0x18a2('0x9'),_0x18a2('0xa'),_0x18a2('0xb'),'TrunkId',_0x18a2('0xc'),_0x18a2('0xd')],'include':[{'model':_0x18a2('0xe'),'as':'Trunk','attributes':['id',_0x18a2('0x2'),_0x18a2('0xf'),_0x18a2('0x10')]}]},'log':_0x18a2('0x11')});};};exports[_0x18a2('0x12')]=function(_0x54ce08,_0x44c60c){return client[_0x18a2('0x13')]('NotifyFaxAccount',{'account':{'id':_0x54ce08},'body':_0x44c60c,'log':_0x18a2('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index cb81894..9927b66 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a8b=['update','UpdateFaxMessage','../client'];(function(_0x16104b,_0x4ce612){var _0x1e126d=function(_0x57d510){while(--_0x57d510){_0x16104b['push'](_0x16104b['shift']());}};_0x1e126d(++_0x4ce612);}(_0x5a8b,0x197));var _0xb5a8=function(_0x1ae5f5,_0x58ffd8){_0x1ae5f5=_0x1ae5f5-0x0;var _0x550b3d=_0x5a8b[_0x1ae5f5];return _0x550b3d;};'use strict';var client=require(_0xb5a8('0x0'));exports[_0xb5a8('0x1')]=function(_0x1392ef,_0x1c9ce6){return client['Request'](_0xb5a8('0x2'),{'body':_0x1c9ce6,'options':{'where':{'AttachmentId':_0x1392ef}},'log':_0xb5a8('0x2')});}; \ No newline at end of file +var _0x45eb=['Request','UpdateFaxMessage','update'];(function(_0x84af12,_0x51d11c){var _0x4511bd=function(_0x4b05c2){while(--_0x4b05c2){_0x84af12['push'](_0x84af12['shift']());}};_0x4511bd(++_0x51d11c);}(_0x45eb,0x11c));var _0xb45e=function(_0x1cc49d,_0x259c6b){_0x1cc49d=_0x1cc49d-0x0;var _0x32a8d0=_0x45eb[_0x1cc49d];return _0x32a8d0;};'use strict';var client=require('../client');exports[_0xb45e('0x0')]=function(_0x4ae512,_0xd00c2a){return client[_0xb45e('0x1')](_0xb45e('0x2'),{'body':_0xd00c2a,'options':{'where':{'AttachmentId':_0x4ae512}},'log':'UpdateFaxMessage'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index ffe5c97..97a3b8b 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bab=['keyType','keyContent','Fields','idField','nameField','customField','Tags','../../client','getDeskAccounts','name','description','remoteUri','type','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','variableName','Variable','Descriptions','content','key'];(function(_0x4c7145,_0x42f7e2){var _0x17403d=function(_0x117fd8){while(--_0x117fd8){_0x4c7145['push'](_0x4c7145['shift']());}};_0x17403d(++_0x42f7e2);}(_0x5bab,0xd6));var _0xb5ba=function(_0x1b811b,_0x372fa8){_0x1b811b=_0x1b811b-0x0;var _0x27b0af=_0x5bab[_0x1b811b];return _0x27b0af;};'use strict';var client=require(_0xb5ba('0x0'));exports[_0xb5ba('0x1')]=function(){return function(_0x133721){return client['Request']('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0xb5ba('0x2'),_0xb5ba('0x3'),'username','password',_0xb5ba('0x4'),'authType',_0xb5ba('0x5'),_0xb5ba('0x6')],'include':[{'model':_0xb5ba('0x7'),'as':_0xb5ba('0x8'),'attributes':['id',_0xb5ba('0x2')],'include':[{'model':_0xb5ba('0x9'),'as':_0xb5ba('0xa'),'attributes':['id',_0xb5ba('0x5'),'content',_0xb5ba('0xb')],'include':[{'model':_0xb5ba('0xc'),'as':_0xb5ba('0xc'),'attributes':['id',_0xb5ba('0x2')]}]},{'model':'DeskField','as':_0xb5ba('0xd'),'attributes':['id',_0xb5ba('0x5'),_0xb5ba('0xe'),_0xb5ba('0xf'),_0xb5ba('0x10'),_0xb5ba('0x11'),_0xb5ba('0xb')],'include':[{'model':_0xb5ba('0xc'),'as':_0xb5ba('0xc'),'attributes':['id',_0xb5ba('0x2')]}]},{'model':_0xb5ba('0x9'),'as':_0xb5ba('0x12'),'attributes':['id',_0xb5ba('0x5'),_0xb5ba('0xe'),_0xb5ba('0x13'),_0xb5ba('0x14'),_0xb5ba('0x15'),'variableName'],'include':[{'model':'Variable','as':_0xb5ba('0xc'),'attributes':['id','name']}]},{'model':'Tag','as':_0xb5ba('0x16'),'attributes':['id',_0xb5ba('0x2')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0xfbd6=['variableName','Fields','idField','nameField','customField','Tag','Tags','../../client','getDeskAccounts','GetDeskAccount','name','description','username','password','authType','serverUrl','DeskConfiguration','Configurations','DeskField','type','content','Variable','Descriptions','key'];(function(_0x14a0c8,_0x23c2bc){var _0x27adec=function(_0x3c2bdc){while(--_0x3c2bdc){_0x14a0c8['push'](_0x14a0c8['shift']());}};_0x27adec(++_0x23c2bc);}(_0xfbd6,0xf7));var _0x6fbd=function(_0x64ac19,_0x2398c8){_0x64ac19=_0x64ac19-0x0;var _0xf83c91=_0xfbd6[_0x64ac19];return _0xf83c91;};'use strict';var client=require(_0x6fbd('0x0'));exports[_0x6fbd('0x1')]=function(){return function(_0x9e23fc){return client['Request'](_0x6fbd('0x2'),{'options':{'raw':![],'attributes':['id',_0x6fbd('0x3'),_0x6fbd('0x4'),_0x6fbd('0x5'),_0x6fbd('0x6'),'remoteUri',_0x6fbd('0x7'),'type',_0x6fbd('0x8')],'include':[{'model':_0x6fbd('0x9'),'as':_0x6fbd('0xa'),'attributes':['id','name'],'include':[{'model':_0x6fbd('0xb'),'as':'Subjects','attributes':['id',_0x6fbd('0xc'),_0x6fbd('0xd'),'variableName'],'include':[{'model':_0x6fbd('0xe'),'as':_0x6fbd('0xe'),'attributes':['id',_0x6fbd('0x3')]}]},{'model':'DeskField','as':_0x6fbd('0xf'),'attributes':['id',_0x6fbd('0xc'),_0x6fbd('0xd'),_0x6fbd('0x10'),'keyType','keyContent',_0x6fbd('0x11')],'include':[{'model':_0x6fbd('0xe'),'as':'Variable','attributes':['id',_0x6fbd('0x3')]}]},{'model':_0x6fbd('0xb'),'as':_0x6fbd('0x12'),'attributes':['id',_0x6fbd('0xc'),_0x6fbd('0xd'),_0x6fbd('0x13'),_0x6fbd('0x14'),_0x6fbd('0x15'),'variableName'],'include':[{'model':_0x6fbd('0xe'),'as':_0x6fbd('0xe'),'attributes':['id',_0x6fbd('0x3')]}]},{'model':_0x6fbd('0x16'),'as':_0x6fbd('0x17'),'attributes':['id',_0x6fbd('0x3')]}]}]},'log':_0x6fbd('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index a795e4d..93eb32b 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb74=['data2','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','additionalSearchContact','openNewTab','Subjects','content','variableName','Variable','Dynamics365Field','Descriptions','type','key','keyType','Fields','idField','nameField','customField','CloudProvider'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb74,0xe3));var _0x4eb7=function(_0xdcc483,_0x119abe){_0xdcc483=_0xdcc483-0x0;var _0x555f7d=_0xeb74[_0xdcc483];return _0x555f7d;};'use strict';var client=require(_0x4eb7('0x0'));exports[_0x4eb7('0x1')]=function(){return function(_0x1dd325){return client[_0x4eb7('0x2')](_0x4eb7('0x3'),{'options':{'raw':![],'attributes':['id',_0x4eb7('0x4'),_0x4eb7('0x5'),'password',_0x4eb7('0x6'),_0x4eb7('0x7'),_0x4eb7('0x8'),_0x4eb7('0x9'),_0x4eb7('0xa'),'description',_0x4eb7('0xb')],'include':[{'model':'Dynamics365Configuration','as':_0x4eb7('0xc'),'attributes':['id',_0x4eb7('0x4'),'ticketType','moduleCreate',_0x4eb7('0xd'),_0x4eb7('0xe')],'include':[{'model':'Dynamics365Field','as':_0x4eb7('0xf'),'attributes':['id','type',_0x4eb7('0x10'),_0x4eb7('0x11')],'include':[{'model':_0x4eb7('0x12'),'as':'Variable','attributes':['id',_0x4eb7('0x4')]}]},{'model':_0x4eb7('0x13'),'as':_0x4eb7('0x14'),'attributes':['id',_0x4eb7('0x15'),_0x4eb7('0x10'),_0x4eb7('0x16'),_0x4eb7('0x17'),'keyContent','variableName'],'include':[{'model':'Variable','as':_0x4eb7('0x12'),'attributes':['id','name']}]},{'model':_0x4eb7('0x13'),'as':_0x4eb7('0x18'),'attributes':['id',_0x4eb7('0x15'),_0x4eb7('0x10'),_0x4eb7('0x19'),_0x4eb7('0x1a'),_0x4eb7('0x1b'),_0x4eb7('0x11')],'include':[{'model':_0x4eb7('0x12'),'as':_0x4eb7('0x12'),'attributes':['id','name']}]}]},{'model':_0x4eb7('0x1c'),'as':_0x4eb7('0x1c'),'attributes':['id',_0x4eb7('0x1d'),_0x4eb7('0x1e'),_0x4eb7('0x1f')]}]},'log':_0x4eb7('0x3')});};}; \ No newline at end of file +var _0x94d4=['clientSecret','serverUrl','description','ticketType','openNewTab','Dynamics365Field','type','content','variableName','Variable','key','keyType','keyContent','Fields','nameField','customField','CloudProvider','data2','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','password','remoteUri','tenantId','clientId'];(function(_0x1a71ef,_0x31ed01){var _0x1899f7=function(_0x466507){while(--_0x466507){_0x1a71ef['push'](_0x1a71ef['shift']());}};_0x1899f7(++_0x31ed01);}(_0x94d4,0xa5));var _0x494d=function(_0x1489ef,_0x275d93){_0x1489ef=_0x1489ef-0x0;var _0x20e0e6=_0x94d4[_0x1489ef];return _0x20e0e6;};'use strict';var client=require(_0x494d('0x0'));exports[_0x494d('0x1')]=function(){return function(_0x55900d){return client[_0x494d('0x2')](_0x494d('0x3'),{'options':{'raw':![],'attributes':['id',_0x494d('0x4'),'username',_0x494d('0x5'),_0x494d('0x6'),_0x494d('0x7'),_0x494d('0x8'),_0x494d('0x9'),_0x494d('0xa'),_0x494d('0xb'),'modernAuthentication'],'include':[{'model':'Dynamics365Configuration','as':'Configurations','attributes':['id',_0x494d('0x4'),_0x494d('0xc'),'moduleCreate','additionalSearchContact',_0x494d('0xd')],'include':[{'model':_0x494d('0xe'),'as':'Subjects','attributes':['id',_0x494d('0xf'),_0x494d('0x10'),_0x494d('0x11')],'include':[{'model':_0x494d('0x12'),'as':'Variable','attributes':['id',_0x494d('0x4')]}]},{'model':_0x494d('0xe'),'as':'Descriptions','attributes':['id','type','content',_0x494d('0x13'),_0x494d('0x14'),_0x494d('0x15'),_0x494d('0x11')],'include':[{'model':_0x494d('0x12'),'as':_0x494d('0x12'),'attributes':['id',_0x494d('0x4')]}]},{'model':_0x494d('0xe'),'as':_0x494d('0x16'),'attributes':['id',_0x494d('0xf'),_0x494d('0x10'),'idField',_0x494d('0x17'),_0x494d('0x18'),_0x494d('0x11')],'include':[{'model':_0x494d('0x12'),'as':_0x494d('0x12'),'attributes':['id',_0x494d('0x4')]}]}]},{'model':_0x494d('0x19'),'as':_0x494d('0x19'),'attributes':['id',_0x494d('0x1a'),_0x494d('0x1b'),_0x494d('0x1c')]}]},'log':_0x494d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 69c472f..a6e91bb 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x928c=['idField','customField','GetFreshdeskAccount','Request','name','username','apiKey','remoteUri','serverUrl','Configurations','Tag','type','content','variableName','Variable','FreshdeskField','Descriptions','key','Fields'];(function(_0x4c9730,_0x412b10){var _0x16a1ef=function(_0x3deef2){while(--_0x3deef2){_0x4c9730['push'](_0x4c9730['shift']());}};_0x16a1ef(++_0x412b10);}(_0x928c,0x17f));var _0xc928=function(_0x443a13,_0x3ec5d9){_0x443a13=_0x443a13-0x0;var _0x18c355=_0x928c[_0x443a13];return _0x18c355;};'use strict';var client=require('../../client');exports['getFreshdeskAccounts']=function(){return function(_0x261249){return client[_0xc928('0x0')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0xc928('0x1'),_0xc928('0x2'),_0xc928('0x3'),_0xc928('0x4'),_0xc928('0x5')],'include':[{'model':'FreshdeskConfiguration','as':_0xc928('0x6'),'attributes':['id',_0xc928('0x1')],'include':[{'model':_0xc928('0x7'),'attributes':['id','name']},{'model':'FreshdeskField','as':'Subjects','attributes':['id',_0xc928('0x8'),_0xc928('0x9'),_0xc928('0xa')],'include':[{'model':_0xc928('0xb'),'as':_0xc928('0xb'),'attributes':['id',_0xc928('0x1')]}]},{'model':_0xc928('0xc'),'as':_0xc928('0xd'),'attributes':['id','type',_0xc928('0x9'),_0xc928('0xe'),'keyType','keyContent',_0xc928('0xa')],'include':[{'model':'Variable','as':_0xc928('0xb'),'attributes':['id','name']}]},{'model':_0xc928('0xc'),'as':_0xc928('0xf'),'attributes':['id','type',_0xc928('0x9'),_0xc928('0x10'),'nameField',_0xc928('0x11'),_0xc928('0xa')],'include':[{'model':_0xc928('0xb'),'as':_0xc928('0xb'),'attributes':['id',_0xc928('0x1')]}]}]}]},'log':_0xc928('0x12')});};}; \ No newline at end of file +var _0xe2cf=['FreshdeskField','content','variableName','Variable','Descriptions','key','keyType','keyContent','customField','getFreshdeskAccounts','Request','name','username','apiKey','remoteUri','FreshdeskConfiguration','Configurations'];(function(_0x56b05b,_0x203cc7){var _0x446110=function(_0x591d6e){while(--_0x591d6e){_0x56b05b['push'](_0x56b05b['shift']());}};_0x446110(++_0x203cc7);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0xe2cf[_0x359bbe];return _0x1b3353;};'use strict';var client=require('../../client');exports[_0xfe2c('0x0')]=function(){return function(_0x546786){return client[_0xfe2c('0x1')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0xfe2c('0x2'),_0xfe2c('0x3'),_0xfe2c('0x4'),_0xfe2c('0x5'),'serverUrl'],'include':[{'model':_0xfe2c('0x6'),'as':_0xfe2c('0x7'),'attributes':['id','name'],'include':[{'model':'Tag','attributes':['id',_0xfe2c('0x2')]},{'model':_0xfe2c('0x8'),'as':'Subjects','attributes':['id','type',_0xfe2c('0x9'),_0xfe2c('0xa')],'include':[{'model':_0xfe2c('0xb'),'as':'Variable','attributes':['id','name']}]},{'model':_0xfe2c('0x8'),'as':_0xfe2c('0xc'),'attributes':['id','type',_0xfe2c('0x9'),_0xfe2c('0xd'),_0xfe2c('0xe'),_0xfe2c('0xf'),_0xfe2c('0xa')],'include':[{'model':_0xfe2c('0xb'),'as':_0xfe2c('0xb'),'attributes':['id','name']}]},{'model':'FreshdeskField','as':'Fields','attributes':['id','type',_0xfe2c('0x9'),'idField','nameField',_0xfe2c('0x10'),_0xfe2c('0xa')],'include':[{'model':_0xfe2c('0xb'),'as':_0xfe2c('0xb'),'attributes':['id','name']}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 94be354..9026891 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f6f=['getFreshsalesAccounts','Request','GetFreshsalesAccount','username','apiKey','remoteUri','FreshsalesConfiguration','Configurations','name','FreshsalesField','content','variableName','Variable','key','keyContent','../../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x8cbd17,_0x3913d4){_0x8cbd17=_0x8cbd17-0x0;var _0x35840a=_0x5f6f[_0x8cbd17];return _0x35840a;};'use strict';var client=require(_0xf5f6('0x0'));exports[_0xf5f6('0x1')]=function(){return function(_0x32a985){return client[_0xf5f6('0x2')](_0xf5f6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xf5f6('0x4'),_0xf5f6('0x5'),_0xf5f6('0x6'),'serverUrl'],'include':[{'model':_0xf5f6('0x7'),'as':_0xf5f6('0x8'),'attributes':['id',_0xf5f6('0x9')],'include':[{'model':_0xf5f6('0xa'),'as':'Subjects','attributes':['id','type',_0xf5f6('0xb'),_0xf5f6('0xc')],'include':[{'model':_0xf5f6('0xd'),'as':_0xf5f6('0xd'),'attributes':['id',_0xf5f6('0x9')]}]},{'model':_0xf5f6('0xa'),'as':'Descriptions','attributes':['id','type',_0xf5f6('0xb'),_0xf5f6('0xe'),'keyType',_0xf5f6('0xf'),_0xf5f6('0xc')],'include':[{'model':_0xf5f6('0xd'),'as':_0xf5f6('0xd'),'attributes':['id',_0xf5f6('0x9')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0x49c1=['GetFreshsalesccount','../../client','Request','GetFreshsalesAccount','username','apiKey','serverUrl','FreshsalesConfiguration','name','Subjects','type','variableName','Variable','FreshsalesField','content','key','keyType'];(function(_0x44f37c,_0x37909a){var _0x58213e=function(_0x45bdc8){while(--_0x45bdc8){_0x44f37c['push'](_0x44f37c['shift']());}};_0x58213e(++_0x37909a);}(_0x49c1,0xef));var _0x149c=function(_0x3d1496,_0x1a6e76){_0x3d1496=_0x3d1496-0x0;var _0x360082=_0x49c1[_0x3d1496];return _0x360082;};'use strict';var client=require(_0x149c('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x466227){return client[_0x149c('0x1')](_0x149c('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x149c('0x3'),_0x149c('0x4'),'remoteUri',_0x149c('0x5')],'include':[{'model':_0x149c('0x6'),'as':'Configurations','attributes':['id',_0x149c('0x7')],'include':[{'model':'FreshsalesField','as':_0x149c('0x8'),'attributes':['id',_0x149c('0x9'),'content',_0x149c('0xa')],'include':[{'model':_0x149c('0xb'),'as':'Variable','attributes':['id',_0x149c('0x7')]}]},{'model':_0x149c('0xc'),'as':'Descriptions','attributes':['id',_0x149c('0x9'),_0x149c('0xd'),_0x149c('0xe'),_0x149c('0xf'),'keyContent',_0x149c('0xa')],'include':[{'model':_0x149c('0xb'),'as':_0x149c('0xb'),'attributes':['id',_0x149c('0x7')]}]}]}]},'log':_0x149c('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index b125332..cae388d 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3f9=['SalesforceField','Descriptions','Fields','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','serverUrl','SalesforceConfiguration','moduleSearch','moduleCreate','leadId','Subjects','Variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x4e6343,_0xddf8de){_0x4e6343=_0x4e6343-0x0;var _0x2d6fe7=_0xf3f9[_0x4e6343];return _0x2d6fe7;};'use strict';var client=require(_0x9f3f('0x0'));exports[_0x9f3f('0x1')]=function(){return function(_0x5f2920){return client[_0x9f3f('0x2')](_0x9f3f('0x3'),{'options':{'raw':![],'attributes':['id',_0x9f3f('0x4'),_0x9f3f('0x5'),_0x9f3f('0x6'),_0x9f3f('0x7'),_0x9f3f('0x8'),'clientSecret','securityToken',_0x9f3f('0x9'),'type'],'include':[{'model':_0x9f3f('0xa'),'as':'Configurations','attributes':['id',_0x9f3f('0x4'),_0x9f3f('0xb'),_0x9f3f('0xc'),'ticketType',_0x9f3f('0xd'),'additionalSearchAccount','additionalSearchContact','additionalSearchLead'],'include':[{'model':'SalesforceField','as':_0x9f3f('0xe'),'include':[{'model':_0x9f3f('0xf'),'as':_0x9f3f('0xf'),'attributes':['id',_0x9f3f('0x4')]}]},{'model':_0x9f3f('0x10'),'as':_0x9f3f('0x11'),'include':[{'model':_0x9f3f('0xf'),'as':_0x9f3f('0xf'),'attributes':['id',_0x9f3f('0x4')]}]},{'model':_0x9f3f('0x10'),'as':_0x9f3f('0x12'),'include':[{'model':_0x9f3f('0xf'),'as':'Variable','attributes':['id',_0x9f3f('0x4')]}]}]}]},'log':_0x9f3f('0x3')});};}; \ No newline at end of file +var _0x2fc9=['additionalSearchLead','SalesforceField','Subjects','Variable','Fields','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret','securityToken','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount'];(function(_0x3946c7,_0x4bd8dd){var _0x5b8dbf=function(_0x260fa3){while(--_0x260fa3){_0x3946c7['push'](_0x3946c7['shift']());}};_0x5b8dbf(++_0x4bd8dd);}(_0x2fc9,0xc2));var _0x92fc=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0x2fc9[_0x21cb7f];return _0x5a079a;};'use strict';var client=require('../../client');exports[_0x92fc('0x0')]=function(){return function(_0x24a8f8){return client[_0x92fc('0x1')](_0x92fc('0x2'),{'options':{'raw':![],'attributes':['id',_0x92fc('0x3'),_0x92fc('0x4'),_0x92fc('0x5'),_0x92fc('0x6'),_0x92fc('0x7'),_0x92fc('0x8'),_0x92fc('0x9'),'serverUrl','type'],'include':[{'model':'SalesforceConfiguration','as':_0x92fc('0xa'),'attributes':['id',_0x92fc('0x3'),_0x92fc('0xb'),_0x92fc('0xc'),_0x92fc('0xd'),_0x92fc('0xe'),_0x92fc('0xf'),'additionalSearchContact',_0x92fc('0x10')],'include':[{'model':_0x92fc('0x11'),'as':_0x92fc('0x12'),'include':[{'model':'Variable','as':_0x92fc('0x13'),'attributes':['id',_0x92fc('0x3')]}]},{'model':_0x92fc('0x11'),'as':'Descriptions','include':[{'model':'Variable','as':_0x92fc('0x13'),'attributes':['id',_0x92fc('0x3')]}]},{'model':'SalesforceField','as':_0x92fc('0x14'),'include':[{'model':_0x92fc('0x13'),'as':_0x92fc('0x13'),'attributes':['id',_0x92fc('0x3')]}]}]}]},'log':_0x92fc('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index fbd95df..f6f543c 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['GetServicenowAccount','name','description','username','password','email','remoteUri','ServicenowConfiguration','ServicenowField','Subjects','type','content','variableName','Variable','key','keyType','keyContent','idField','nameField','customField','GetServicenowkAccount','getServicenowAccounts','Request'];(function(_0x269c42,_0xeed101){var _0x4dad76=function(_0x167b87){while(--_0x167b87){_0x269c42['push'](_0x269c42['shift']());}};_0x4dad76(++_0xeed101);}(_0x4819,0xcd));var _0x9481=function(_0x5b685e,_0x3e69ad){_0x5b685e=_0x5b685e-0x0;var _0x9a0173=_0x4819[_0x5b685e];return _0x9a0173;};'use strict';var client=require('../../client');exports[_0x9481('0x0')]=function(){return function(_0x3307b0){return client[_0x9481('0x1')](_0x9481('0x2'),{'options':{'raw':![],'attributes':['id',_0x9481('0x3'),_0x9481('0x4'),_0x9481('0x5'),_0x9481('0x6'),_0x9481('0x7'),_0x9481('0x8'),'serverUrl'],'include':[{'model':_0x9481('0x9'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x9481('0xa'),'as':_0x9481('0xb'),'attributes':['id',_0x9481('0xc'),_0x9481('0xd'),_0x9481('0xe')],'include':[{'model':'Variable','as':_0x9481('0xf'),'attributes':['id','name']}]},{'model':_0x9481('0xa'),'as':'Descriptions','attributes':['id',_0x9481('0xc'),_0x9481('0xd'),_0x9481('0x10'),_0x9481('0x11'),_0x9481('0x12'),_0x9481('0xe')],'include':[{'model':_0x9481('0xf'),'as':_0x9481('0xf'),'attributes':['id',_0x9481('0x3')]}]},{'model':'ServicenowField','as':'Fields','attributes':['id',_0x9481('0xc'),_0x9481('0xd'),_0x9481('0x13'),_0x9481('0x14'),_0x9481('0x15'),_0x9481('0xe')],'include':[{'model':_0x9481('0xf'),'as':'Variable','attributes':['id',_0x9481('0x3')]}]}]}]},'log':_0x9481('0x16')});};}; \ No newline at end of file +var _0xba34=['keyContent','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','GetServicenowAccount','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','name','Subjects','type','content','variableName','Variable','ServicenowField','Descriptions','keyType'];(function(_0x5e44b6,_0x4b6a03){var _0x58a543=function(_0x3c138f){while(--_0x3c138f){_0x5e44b6['push'](_0x5e44b6['shift']());}};_0x58a543(++_0x4b6a03);}(_0xba34,0x119));var _0x4ba3=function(_0x3bb29e,_0x1f2f6c){_0x3bb29e=_0x3bb29e-0x0;var _0x26506f=_0xba34[_0x3bb29e];return _0x26506f;};'use strict';var client=require(_0x4ba3('0x0'));exports[_0x4ba3('0x1')]=function(){return function(_0xb04f7b){return client[_0x4ba3('0x2')](_0x4ba3('0x3'),{'options':{'raw':![],'attributes':['id','name','description','username',_0x4ba3('0x4'),_0x4ba3('0x5'),_0x4ba3('0x6'),_0x4ba3('0x7')],'include':[{'model':_0x4ba3('0x8'),'as':_0x4ba3('0x9'),'attributes':['id',_0x4ba3('0xa')],'include':[{'model':'ServicenowField','as':_0x4ba3('0xb'),'attributes':['id',_0x4ba3('0xc'),_0x4ba3('0xd'),_0x4ba3('0xe')],'include':[{'model':_0x4ba3('0xf'),'as':_0x4ba3('0xf'),'attributes':['id',_0x4ba3('0xa')]}]},{'model':_0x4ba3('0x10'),'as':_0x4ba3('0x11'),'attributes':['id',_0x4ba3('0xc'),_0x4ba3('0xd'),'key',_0x4ba3('0x12'),_0x4ba3('0x13'),'variableName'],'include':[{'model':_0x4ba3('0xf'),'as':'Variable','attributes':['id',_0x4ba3('0xa')]}]},{'model':'ServicenowField','as':_0x4ba3('0x14'),'attributes':['id',_0x4ba3('0xc'),_0x4ba3('0xd'),_0x4ba3('0x15'),_0x4ba3('0x16'),_0x4ba3('0x17'),_0x4ba3('0xe')],'include':[{'model':_0x4ba3('0xf'),'as':_0x4ba3('0xf'),'attributes':['id',_0x4ba3('0xa')]}]}]}]},'log':_0x4ba3('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index fc96785..b570698 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['serverUrl','SugarcrmConfiguration','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','idField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','remoteUri'];(function(_0x72500d,_0x2781d4){var _0x4188de=function(_0x582e90){while(--_0x582e90){_0x72500d['push'](_0x72500d['shift']());}};_0x4188de(++_0x2781d4);}(_0x1967,0x173));var _0x7196=function(_0x201219,_0x4e8110){_0x201219=_0x201219-0x0;var _0x5f01b2=_0x1967[_0x201219];return _0x5f01b2;};'use strict';var client=require('../../client');exports[_0x7196('0x0')]=function(){return function(_0xdb72bb){return client[_0x7196('0x1')](_0x7196('0x2'),{'options':{'raw':![],'attributes':['id',_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7')],'include':[{'model':_0x7196('0x8'),'as':'Configurations','attributes':['id',_0x7196('0x3')],'include':[{'model':_0x7196('0x9'),'as':_0x7196('0xa'),'attributes':['id',_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd')],'include':[{'model':'Variable','as':_0x7196('0xe'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0x9'),'as':_0x7196('0xf'),'attributes':['id',_0x7196('0xb'),'content','key',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0xd')],'include':[{'model':_0x7196('0xe'),'as':_0x7196('0xe'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0x9'),'as':_0x7196('0x12'),'attributes':['id',_0x7196('0xb'),_0x7196('0xc'),_0x7196('0x13'),'nameField',_0x7196('0x14'),_0x7196('0xd')],'include':[{'model':_0x7196('0xe'),'as':_0x7196('0xe'),'attributes':['id','name']}]}]}]},'log':_0x7196('0x2')});};}; \ No newline at end of file +var _0xda2d=['Subjects','type','content','variableName','Variable','key','keyType','keyContent','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0xda2d,0x102));var _0xdda2=function(_0x724beb,_0x32db67){_0x724beb=_0x724beb-0x0;var _0x31c19d=_0xda2d[_0x724beb];return _0x31c19d;};'use strict';var client=require('../../client');exports[_0xdda2('0x0')]=function(){return function(_0x35f029){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'options':{'raw':![],'attributes':['id',_0xdda2('0x3'),'username','password','remoteUri',_0xdda2('0x4')],'include':[{'model':_0xdda2('0x5'),'as':_0xdda2('0x6'),'attributes':['id',_0xdda2('0x3')],'include':[{'model':_0xdda2('0x7'),'as':_0xdda2('0x8'),'attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]},{'model':_0xdda2('0x7'),'as':'Descriptions','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xd'),_0xdda2('0xe'),_0xdda2('0xf'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':_0xdda2('0xc'),'attributes':['id','name']}]},{'model':'SugarcrmField','as':'Fields','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0x10'),_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 50851d5..7b8376e 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x343e=['Fields','idField','nameField','customField','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey','serverUrl','VtigerConfiguration','Configurations','type','content','variableName','Variable','Descriptions','key','keyType','keyContent'];(function(_0x228337,_0x596632){var _0x2289b8=function(_0x32b6e2){while(--_0x32b6e2){_0x228337['push'](_0x228337['shift']());}};_0x2289b8(++_0x596632);}(_0x343e,0x9e));var _0xe343=function(_0x1bf522,_0x20e1f7){_0x1bf522=_0x1bf522-0x0;var _0x289813=_0x343e[_0x1bf522];return _0x289813;};'use strict';var client=require('../../client');exports[_0xe343('0x0')]=function(){return function(_0x1d905a){return client[_0xe343('0x1')](_0xe343('0x2'),{'options':{'raw':![],'attributes':['id',_0xe343('0x3'),_0xe343('0x4'),_0xe343('0x5'),_0xe343('0x6'),'remoteUri',_0xe343('0x7')],'include':[{'model':_0xe343('0x8'),'as':_0xe343('0x9'),'attributes':['id','name'],'include':[{'model':'VtigerField','as':'Subjects','attributes':['id',_0xe343('0xa'),_0xe343('0xb'),_0xe343('0xc')],'include':[{'model':_0xe343('0xd'),'as':_0xe343('0xd'),'attributes':['id','name']}]},{'model':'VtigerField','as':_0xe343('0xe'),'attributes':['id',_0xe343('0xa'),'content',_0xe343('0xf'),_0xe343('0x10'),_0xe343('0x11'),_0xe343('0xc')],'include':[{'model':_0xe343('0xd'),'as':_0xe343('0xd'),'attributes':['id',_0xe343('0x3')]}]},{'model':'VtigerField','as':_0xe343('0x12'),'attributes':['id',_0xe343('0xa'),'content',_0xe343('0x13'),_0xe343('0x14'),_0xe343('0x15'),_0xe343('0xc')],'include':[{'model':_0xe343('0xd'),'as':_0xe343('0xd'),'attributes':['id',_0xe343('0x3')]}]}]}]},'log':_0xe343('0x2')});};}; \ No newline at end of file +var _0xbd9f=['Request','GetVtigerAccount','name','description','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','variableName','Variable','type','content','key','keyType','Fields','idField','customField','../../client'];(function(_0x13b8a5,_0x16d823){var _0x26c18c=function(_0x21d322){while(--_0x21d322){_0x13b8a5['push'](_0x13b8a5['shift']());}};_0x26c18c(++_0x16d823);}(_0xbd9f,0x6d));var _0xfbd9=function(_0x4b0342,_0x5b071c){_0x4b0342=_0x4b0342-0x0;var _0xc62aa3=_0xbd9f[_0x4b0342];return _0xc62aa3;};'use strict';var client=require(_0xfbd9('0x0'));exports['getVtigerAccounts']=function(){return function(_0x42ea2a){return client[_0xfbd9('0x1')](_0xfbd9('0x2'),{'options':{'raw':![],'attributes':['id',_0xfbd9('0x3'),_0xfbd9('0x4'),_0xfbd9('0x5'),_0xfbd9('0x6'),_0xfbd9('0x7'),_0xfbd9('0x8')],'include':[{'model':_0xfbd9('0x9'),'as':_0xfbd9('0xa'),'attributes':['id',_0xfbd9('0x3')],'include':[{'model':_0xfbd9('0xb'),'as':_0xfbd9('0xc'),'attributes':['id','type','content',_0xfbd9('0xd')],'include':[{'model':_0xfbd9('0xe'),'as':_0xfbd9('0xe'),'attributes':['id',_0xfbd9('0x3')]}]},{'model':_0xfbd9('0xb'),'as':'Descriptions','attributes':['id',_0xfbd9('0xf'),_0xfbd9('0x10'),_0xfbd9('0x11'),_0xfbd9('0x12'),'keyContent',_0xfbd9('0xd')],'include':[{'model':_0xfbd9('0xe'),'as':'Variable','attributes':['id',_0xfbd9('0x3')]}]},{'model':_0xfbd9('0xb'),'as':_0xfbd9('0x13'),'attributes':['id','type',_0xfbd9('0x10'),_0xfbd9('0x14'),'nameField',_0xfbd9('0x15'),'variableName'],'include':[{'model':'Variable','as':_0xfbd9('0xe'),'attributes':['id',_0xfbd9('0x3')]}]}]}]},'log':_0xfbd9('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 5865219..a452551 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0e7=['Request','GetZendeskAccount','name','username','token','remoteUri','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','variableName','Variable','Descriptions','content','key','keyType','keyContent','idField','customField','../../client'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0xd0e7,0x1cd));var _0x7d0e=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xd0e7[_0x346737];return _0x1ade2e;};'use strict';var client=require(_0x7d0e('0x0'));exports['getZendeskAccounts']=function(){return function(_0x544826){return client[_0x7d0e('0x1')](_0x7d0e('0x2'),{'options':{'raw':![],'attributes':['id',_0x7d0e('0x3'),_0x7d0e('0x4'),'password',_0x7d0e('0x5'),_0x7d0e('0x6'),'authType','serverUrl',_0x7d0e('0x7')],'include':[{'model':_0x7d0e('0x8'),'as':_0x7d0e('0x9'),'attributes':['id',_0x7d0e('0x3')],'include':[{'model':_0x7d0e('0xa'),'attributes':['id',_0x7d0e('0x3')]},{'model':_0x7d0e('0xb'),'as':'Subjects','attributes':['id',_0x7d0e('0x7'),'content',_0x7d0e('0xc')],'include':[{'model':_0x7d0e('0xd'),'as':'Variable','attributes':['id',_0x7d0e('0x3')]}]},{'model':'ZendeskField','as':_0x7d0e('0xe'),'attributes':['id',_0x7d0e('0x7'),_0x7d0e('0xf'),_0x7d0e('0x10'),_0x7d0e('0x11'),_0x7d0e('0x12'),'variableName'],'include':[{'model':_0x7d0e('0xd'),'as':_0x7d0e('0xd'),'attributes':['id',_0x7d0e('0x3')]}]},{'model':_0x7d0e('0xb'),'as':'Fields','attributes':['id',_0x7d0e('0x7'),'content',_0x7d0e('0x13'),'nameField',_0x7d0e('0x14'),_0x7d0e('0xc')],'include':[{'model':_0x7d0e('0xd'),'as':'Variable','attributes':['id',_0x7d0e('0x3')]}]}]}]},'log':_0x7d0e('0x2')});};}; \ No newline at end of file +var _0xe518=['ZendeskConfiguration','Configurations','name','ZendeskField','Subjects','content','variableName','Variable','keyContent','customField','getZendeskAccounts','Request','GetZendeskAccount','remoteUri','authType','serverUrl','type'];(function(_0x17bbe6,_0x17cea8){var _0x2b95c2=function(_0x3042c6){while(--_0x3042c6){_0x17bbe6['push'](_0x17bbe6['shift']());}};_0x2b95c2(++_0x17cea8);}(_0xe518,0x1e6));var _0x8e51=function(_0x59de22,_0x57015f){_0x59de22=_0x59de22-0x0;var _0x1d4157=_0xe518[_0x59de22];return _0x1d4157;};'use strict';var client=require('../../client');exports[_0x8e51('0x0')]=function(){return function(_0x42b3ca){return client[_0x8e51('0x1')](_0x8e51('0x2'),{'options':{'raw':![],'attributes':['id','name','username','password','token',_0x8e51('0x3'),_0x8e51('0x4'),_0x8e51('0x5'),_0x8e51('0x6')],'include':[{'model':_0x8e51('0x7'),'as':_0x8e51('0x8'),'attributes':['id',_0x8e51('0x9')],'include':[{'model':'Tag','attributes':['id',_0x8e51('0x9')]},{'model':_0x8e51('0xa'),'as':_0x8e51('0xb'),'attributes':['id','type',_0x8e51('0xc'),_0x8e51('0xd')],'include':[{'model':_0x8e51('0xe'),'as':_0x8e51('0xe'),'attributes':['id',_0x8e51('0x9')]}]},{'model':'ZendeskField','as':'Descriptions','attributes':['id',_0x8e51('0x6'),'content','key','keyType',_0x8e51('0xf'),'variableName'],'include':[{'model':_0x8e51('0xe'),'as':'Variable','attributes':['id',_0x8e51('0x9')]}]},{'model':_0x8e51('0xa'),'as':'Fields','attributes':['id',_0x8e51('0x6'),'content','idField','nameField',_0x8e51('0x10'),_0x8e51('0xd')],'include':[{'model':'Variable','as':_0x8e51('0xe'),'attributes':['id',_0x8e51('0x9')]}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index f2840e9..3c88675 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa027=['keyContent','variableName','ZohoField','Fields','idField','customField','GetZohoAccount','../../client','Request','description','host','zone','clientId','clientSecret','serverUrl','code','Configurations','name','moduleCreate','moduleSearch','type','content','Variable','Descriptions','key'];(function(_0x14f748,_0x196b37){var _0x2f4711=function(_0x19834d){while(--_0x19834d){_0x14f748['push'](_0x14f748['shift']());}};_0x2f4711(++_0x196b37);}(_0xa027,0x6b));var _0x7a02=function(_0x449512,_0x262351){_0x449512=_0x449512-0x0;var _0x110ff3=_0xa027[_0x449512];return _0x110ff3;};'use strict';var client=require(_0x7a02('0x0'));exports['getZohoAccounts']=function(){return function(_0x41b357){return client[_0x7a02('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id','name',_0x7a02('0x2'),_0x7a02('0x3'),_0x7a02('0x4'),_0x7a02('0x5'),_0x7a02('0x6'),_0x7a02('0x7'),_0x7a02('0x8'),'refreshToken'],'include':[{'model':'ZohoConfiguration','as':_0x7a02('0x9'),'attributes':['id',_0x7a02('0xa'),_0x7a02('0xb'),_0x7a02('0xc'),_0x7a02('0x2')],'include':[{'model':'ZohoField','as':'Subjects','attributes':['id',_0x7a02('0xd'),_0x7a02('0xe'),'variableName'],'include':[{'model':_0x7a02('0xf'),'as':_0x7a02('0xf'),'attributes':['id',_0x7a02('0xa')]}]},{'model':'ZohoField','as':_0x7a02('0x10'),'attributes':['id',_0x7a02('0xd'),'content',_0x7a02('0x11'),'keyType',_0x7a02('0x12'),_0x7a02('0x13')],'include':[{'model':'Variable','as':_0x7a02('0xf'),'attributes':['id',_0x7a02('0xa')]}]},{'model':_0x7a02('0x14'),'as':_0x7a02('0x15'),'attributes':['id',_0x7a02('0xd'),_0x7a02('0xe'),_0x7a02('0x16'),'nameField',_0x7a02('0x17'),_0x7a02('0x13')],'include':[{'model':_0x7a02('0xf'),'as':'Variable','attributes':['id',_0x7a02('0xa')]}]}]}]},'log':_0x7a02('0x18')});};}; \ No newline at end of file +var _0x37b4=['Configurations','moduleCreate','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','name','host','zone','clientId','clientSecret','serverUrl'];(function(_0x4333be,_0x5276a7){var _0x2489a0=function(_0x1736fb){while(--_0x1736fb){_0x4333be['push'](_0x4333be['shift']());}};_0x2489a0(++_0x5276a7);}(_0x37b4,0x1b8));var _0x437b=function(_0x536bc2,_0x35c4bf){_0x536bc2=_0x536bc2-0x0;var _0x551b56=_0x37b4[_0x536bc2];return _0x551b56;};'use strict';var client=require(_0x437b('0x0'));exports[_0x437b('0x1')]=function(){return function(_0x3bdf49){return client[_0x437b('0x2')](_0x437b('0x3'),{'options':{'raw':![],'attributes':['id',_0x437b('0x4'),'description',_0x437b('0x5'),_0x437b('0x6'),_0x437b('0x7'),_0x437b('0x8'),_0x437b('0x9'),'code','refreshToken'],'include':[{'model':'ZohoConfiguration','as':_0x437b('0xa'),'attributes':['id',_0x437b('0x4'),_0x437b('0xb'),'moduleSearch','description'],'include':[{'model':_0x437b('0xc'),'as':_0x437b('0xd'),'attributes':['id',_0x437b('0xe'),_0x437b('0xf'),_0x437b('0x10')],'include':[{'model':_0x437b('0x11'),'as':_0x437b('0x11'),'attributes':['id',_0x437b('0x4')]}]},{'model':_0x437b('0xc'),'as':_0x437b('0x12'),'attributes':['id',_0x437b('0xe'),_0x437b('0xf'),_0x437b('0x13'),'keyType',_0x437b('0x14'),_0x437b('0x10')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x437b('0xc'),'as':_0x437b('0x15'),'attributes':['id',_0x437b('0xe'),_0x437b('0xf'),_0x437b('0x16'),_0x437b('0x17'),_0x437b('0x18'),_0x437b('0x10')],'include':[{'model':'Variable','as':_0x437b('0x11'),'attributes':['id',_0x437b('0x4')]}]}]}]},'log':_0x437b('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 6247c44..551cf13 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa913=['map','length','interval','concat','Request','IntervalIftime','intervalIftime','stack','trim','silly','intervalIftime\x20called\x20with','isArray','every','number'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa913,0xa1));var _0x3a91=function(_0x151e76,_0xdda49d){_0x151e76=_0x151e76-0x0;var _0x2588bd=_0xa913[_0x151e76];return _0x2588bd;};var logger=require('../../../config/logger')('dialer');var client=require('../client');function intervalIftime(_0x409e8b,_0x3285b3){const _0x54a8cf=new Error()[_0x3a91('0x0')]['replace'](/^Error/,'')[_0x3a91('0x1')]();logger[_0x3a91('0x2')](_0x3a91('0x3'),_0x409e8b,_0x3285b3,_0x54a8cf);const _0x4e5d93=Array[_0x3a91('0x4')](_0x409e8b);if(!_0x409e8b||_0x4e5d93&&_0x409e8b['length']===0x0){return Promise['resolve'](![]);}else{var _0xfeaaf2=[];var _0x41fd80=[];var _0x52c87a=_0x4e5d93?_0x409e8b:[_0x409e8b];var _0x431ecb=_0x52c87a[_0x3a91('0x5')](function(_0x1b2207){return typeof _0x1b2207===_0x3a91('0x6');});var _0x4b81f6=_0x52c87a['every'](function(_0x3c93ba){return typeof _0x3c93ba==='string';});if(!_0x431ecb&&!_0x4b81f6){_0xfeaaf2=_0x52c87a[_0x3a91('0x7')](function(_0x38fc1d){return _0x38fc1d['id'];});if(_0xfeaaf2[_0x3a91('0x8')]===0x0){_0x41fd80=_0x52c87a[_0x3a91('0x7')](function(_0x5ec6e4){return _0x5ec6e4[_0x3a91('0x9')];});}}else{if(_0x431ecb){_0xfeaaf2=_0xfeaaf2[_0x3a91('0xa')](_0x52c87a);}if(_0x4b81f6){_0x41fd80=_0x41fd80['concat'](_0x52c87a);}}return client[_0x3a91('0xb')](_0x3a91('0xc'),{'intervalIds':_0xfeaaf2,'intervals':_0x41fd80,'timezone':_0x3285b3,'log':_0x3a91('0xc')});}}exports[_0x3a91('0xd')]=intervalIftime; \ No newline at end of file +var _0x8bc5=['interval','Request','IntervalIftime','../../../config/logger','dialer','replace','trim','silly','isArray','length','resolve','every','number','string','map'];(function(_0x693015,_0x410df9){var _0xa42838=function(_0x561d6f){while(--_0x561d6f){_0x693015['push'](_0x693015['shift']());}};_0xa42838(++_0x410df9);}(_0x8bc5,0xa8));var _0x58bc=function(_0x409f2f,_0x2db552){_0x409f2f=_0x409f2f-0x0;var _0x46ba7a=_0x8bc5[_0x409f2f];return _0x46ba7a;};var logger=require(_0x58bc('0x0'))(_0x58bc('0x1'));var client=require('../client');function intervalIftime(_0x265833,_0x1eb370){const _0x4f9688=new Error()['stack'][_0x58bc('0x2')](/^Error/,'')[_0x58bc('0x3')]();logger[_0x58bc('0x4')]('intervalIftime\x20called\x20with',_0x265833,_0x1eb370,_0x4f9688);const _0x31e76b=Array[_0x58bc('0x5')](_0x265833);if(!_0x265833||_0x31e76b&&_0x265833[_0x58bc('0x6')]===0x0){return Promise[_0x58bc('0x7')](![]);}else{var _0x4eb582=[];var _0x292e23=[];var _0x4f4718=_0x31e76b?_0x265833:[_0x265833];var _0x336a41=_0x4f4718[_0x58bc('0x8')](function(_0x2b1747){return typeof _0x2b1747===_0x58bc('0x9');});var _0x4ebe97=_0x4f4718[_0x58bc('0x8')](function(_0x161b51){return typeof _0x161b51===_0x58bc('0xa');});if(!_0x336a41&&!_0x4ebe97){_0x4eb582=_0x4f4718['map'](function(_0x42e4eb){return _0x42e4eb['id'];});if(_0x4eb582[_0x58bc('0x6')]===0x0){_0x292e23=_0x4f4718[_0x58bc('0xb')](function(_0x5d1274){return _0x5d1274[_0x58bc('0xc')];});}}else{if(_0x336a41){_0x4eb582=_0x4eb582['concat'](_0x4f4718);}if(_0x4ebe97){_0x292e23=_0x292e23['concat'](_0x4f4718);}}return client[_0x58bc('0xd')](_0x58bc('0xe'),{'intervalIds':_0x4eb582,'intervals':_0x292e23,'timezone':_0x1eb370,'log':_0x58bc('0xe')});}}exports['intervalIftime']=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index ed7f2a2..1b5d4d3 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35ab=['agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','moment','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','interface','format','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','calleridnum','exten','queue'];(function(_0x336973,_0x45ab12){var _0x4f8c23=function(_0x4c2089){while(--_0x4c2089){_0x336973['push'](_0x336973['shift']());}};_0x4f8c23(++_0x45ab12);}(_0x35ab,0x10c));var _0xb35a=function(_0x3f78f0,_0x501872){_0x3f78f0=_0x3f78f0-0x0;var _0x53f3ca=_0x35ab[_0x3f78f0];return _0x53f3ca;};'use strict';var moment=require(_0xb35a('0x0'));var _=require('lodash');var util=require(_0xb35a('0x1'));var client=require(_0xb35a('0x2'));exports['voiceQueueReport']=function(_0x363cd5){var _0x1e1bf4=_0x363cd5[_0xb35a('0x3')]||_0x363cd5[_0xb35a('0x4')];return client[_0xb35a('0x5')](_0xb35a('0x6'),{'body':{'channel':'voice','membername':_0x363cd5[_0xb35a('0x7')],'interface':_['isNil'](_0x363cd5[_0xb35a('0x8')])?util[_0xb35a('0x9')](_0xb35a('0xa'),_0x363cd5[_0xb35a('0x7')]):_0x363cd5[_0xb35a('0x8')],'type':_0xb35a('0xb'),'enterAt':_0x363cd5['queuecallerleaveAt'],'exitAt':_0x1e1bf4,'duration':moment(_0x1e1bf4)[_0xb35a('0xc')](_0x363cd5[_0xb35a('0xd')],_0xb35a('0xe')),'data1':'inbound','data2':_0x363cd5[_0xb35a('0xf')],'data3':_0x363cd5[_0xb35a('0x10')],'data4':null,'data5':_0x363cd5[_0xb35a('0x11')],'role':_0xb35a('0x12'),'internal':_0x363cd5[_0xb35a('0x13')]?_[_0xb35a('0x14')](_0x363cd5[_0xb35a('0x13')]):undefined,'uniqueid':_0x363cd5[_0xb35a('0x15')]},'log':'CreateMemberReport'});};exports[_0xb35a('0x16')]=function(_0x1ebbd4){return client['Request'](_0xb35a('0x6'),{'body':{'channel':'voice','membername':_0x1ebbd4[_0xb35a('0x17')],'interface':_0x1ebbd4[_0xb35a('0x8')],'type':_0xb35a('0xb'),'enterAt':_0x1ebbd4[_0xb35a('0x18')],'exitAt':_0x1ebbd4['endtime'],'duration':moment(_0x1ebbd4['endtime'])['diff'](_0x1ebbd4[_0xb35a('0x18')],_0xb35a('0xe'))>=0x0?moment(_0x1ebbd4[_0xb35a('0x19')])[_0xb35a('0xc')](_0x1ebbd4[_0xb35a('0x18')],'seconds'):null,'data1':'outbound','data2':_0x1ebbd4[_0xb35a('0x13')],'data3':_0x1ebbd4[_0xb35a('0x10')],'data4':_0x1ebbd4['dialstring']||null,'role':'agent','internal':_0x1ebbd4[_0xb35a('0x13')]?_[_0xb35a('0x14')](_0x1ebbd4[_0xb35a('0x13')]):undefined,'uniqueid':_0x1ebbd4[_0xb35a('0x15')]},'log':_0xb35a('0x6')});}; \ No newline at end of file +var _0xf760=['outbound','agent','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','seconds','inbound','exten','queue','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','starttime','endtime','diff'];(function(_0x363349,_0x3cd05e){var _0x54a9b2=function(_0x4cabd1){while(--_0x4cabd1){_0x363349['push'](_0x363349['shift']());}};_0x54a9b2(++_0x3cd05e);}(_0xf760,0x1ef));var _0x0f76=function(_0x2b091c,_0xd0e130){_0x2b091c=_0x2b091c-0x0;var _0x54a3ab=_0xf760[_0x2b091c];return _0x54a3ab;};'use strict';var moment=require('moment');var _=require(_0x0f76('0x0'));var util=require(_0x0f76('0x1'));var client=require(_0x0f76('0x2'));exports[_0x0f76('0x3')]=function(_0x5028bc){var _0x1ab3e2=_0x5028bc[_0x0f76('0x4')]||_0x5028bc[_0x0f76('0x5')];return client[_0x0f76('0x6')]('CreateMemberReport',{'body':{'channel':_0x0f76('0x7'),'membername':_0x5028bc[_0x0f76('0x8')],'interface':_[_0x0f76('0x9')](_0x5028bc[_0x0f76('0xa')])?util[_0x0f76('0xb')](_0x0f76('0xc'),_0x5028bc['lastAssignedTo']):_0x5028bc[_0x0f76('0xa')],'type':_0x0f76('0xd'),'enterAt':_0x5028bc[_0x0f76('0xe')],'exitAt':_0x1ab3e2,'duration':moment(_0x1ab3e2)['diff'](_0x5028bc[_0x0f76('0xe')],_0x0f76('0xf')),'data1':_0x0f76('0x10'),'data2':_0x5028bc['calleridnum'],'data3':_0x5028bc[_0x0f76('0x11')],'data4':null,'data5':_0x5028bc[_0x0f76('0x12')],'role':'agent','internal':_0x5028bc[_0x0f76('0x13')]?_[_0x0f76('0x14')](_0x5028bc[_0x0f76('0x13')]):undefined,'uniqueid':_0x5028bc[_0x0f76('0x15')]},'log':_0x0f76('0x16')});};exports[_0x0f76('0x17')]=function(_0xc6ef7c){return client[_0x0f76('0x6')](_0x0f76('0x16'),{'body':{'channel':_0x0f76('0x7'),'membername':_0xc6ef7c['membername'],'interface':_0xc6ef7c['interface'],'type':_0x0f76('0xd'),'enterAt':_0xc6ef7c[_0x0f76('0x18')],'exitAt':_0xc6ef7c[_0x0f76('0x19')],'duration':moment(_0xc6ef7c['endtime'])[_0x0f76('0x1a')](_0xc6ef7c['starttime'],_0x0f76('0xf'))>=0x0?moment(_0xc6ef7c[_0x0f76('0x19')])[_0x0f76('0x1a')](_0xc6ef7c[_0x0f76('0x18')],_0x0f76('0xf')):null,'data1':_0x0f76('0x1b'),'data2':_0xc6ef7c[_0x0f76('0x13')],'data3':_0xc6ef7c['exten'],'data4':_0xc6ef7c['dialstring']||null,'role':_0x0f76('0x1c'),'internal':_0xc6ef7c['accountcode']?_[_0x0f76('0x14')](_0xc6ef7c[_0x0f76('0x13')]):undefined,'uniqueid':_0xc6ef7c['uniqueid']},'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 7261c1e..6316eac 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 _0x3f9b=['previewRecallmeReminderInterval','Request','stopRecordingOnTransfer'];(function(_0x52167d,_0x588a54){var _0x5e2356=function(_0x2fcdf6){while(--_0x2fcdf6){_0x52167d['push'](_0x52167d['shift']());}};_0x5e2356(++_0x588a54);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x2b13e2,_0x24638f){_0x2b13e2=_0x2b13e2-0x0;var _0x25a88b=_0x3f9b[_0x2b13e2];return _0x25a88b;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xb3f9('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb3f9('0x1'),_0xb3f9('0x2')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xfd07=['getSettings','GetSettings','../client'];(function(_0x336b5c,_0x1f82e6){var _0x4cd1d9=function(_0x5f02d6){while(--_0x5f02d6){_0x336b5c['push'](_0x336b5c['shift']());}};_0x4cd1d9(++_0x1f82e6);}(_0xfd07,0x104));var _0x7fd0=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0xfd07[_0x151334];return _0x3d03da;};'use strict';var client=require(_0x7fd0('0x0'));exports[_0x7fd0('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':_0x7fd0('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d1d4a2d..527a645 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 _0xb923=['GetTemplate','html'];(function(_0xf2acc0,_0x33a85a){var _0x383a9f=function(_0x1651dd){while(--_0x1651dd){_0xf2acc0['push'](_0xf2acc0['shift']());}};_0x383a9f(++_0x33a85a);}(_0xb923,0x80));var _0x3b92=function(_0x384a81,_0x398f10){_0x384a81=_0x384a81-0x0;var _0x3948ac=_0xb923[_0x384a81];return _0x3948ac;};'use strict';var client=require('../client');exports['getTemplates']=function(_0xd9365c){return function(_0x6d20ae){return client['Request'](_0x3b92('0x0'),{'options':{'raw':!![],'attributes':['id','name',_0x3b92('0x1')]},'log':_0x3b92('0x0')});};}; \ No newline at end of file +var _0x1ab1=['html','getTemplates','Request','GetTemplate','name'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1ab1,0x83));var _0x11ab=function(_0x363543,_0x5d3aeb){_0x363543=_0x363543-0x0;var _0x2c3154=_0x1ab1[_0x363543];return _0x2c3154;};'use strict';var client=require('../client');exports[_0x11ab('0x0')]=function(_0x10661f){return function(_0x3056ac){return client[_0x11ab('0x1')](_0x11ab('0x2'),{'options':{'raw':!![],'attributes':['id',_0x11ab('0x3'),_0x11ab('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 0bd0646..aa1c520 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 _0xa18f=['data3','data4','data6','data7','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data2'];(function(_0x2229f6,_0x2c5734){var _0x52ee74=function(_0x4252f6){while(--_0x4252f6){_0x2229f6['push'](_0x2229f6['shift']());}};_0x52ee74(++_0x2c5734);}(_0xa18f,0xe0));var _0xfa18=function(_0x15bbee,_0x129cd3){_0x15bbee=_0x15bbee-0x0;var _0x20dd1d=_0xa18f[_0x15bbee];return _0x20dd1d;};'use strict';var client=require(_0xfa18('0x0'));exports[_0xfa18('0x1')]=function(_0x410281){return function(_0x5d3b7c){return client['Request'](_0xfa18('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xfa18('0x3'),_0xfa18('0x4')],'include':[{'model':_0xfa18('0x5'),'as':_0xfa18('0x6'),'attributes':['id','field',_0xfa18('0x7'),_0xfa18('0x8')]},{'model':_0xfa18('0x5'),'as':_0xfa18('0x9'),'attributes':['id',_0xfa18('0xa'),_0xfa18('0x7'),_0xfa18('0x8')]},{'model':_0xfa18('0xb'),'as':_0xfa18('0xc'),'attributes':['id',_0xfa18('0xd'),_0xfa18('0xe'),_0xfa18('0xf'),_0xfa18('0x10'),_0xfa18('0x11'),'data5',_0xfa18('0x12'),_0xfa18('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xbaf9=['data4','data7','../client','getTriggers','Request','GetTrigger','name','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2'];(function(_0x1beb1c,_0x4e7387){var _0x435daf=function(_0x4eefff){while(--_0x4eefff){_0x1beb1c['push'](_0x1beb1c['shift']());}};_0x435daf(++_0x4e7387);}(_0xbaf9,0x132));var _0x9baf=function(_0x5c26fe,_0x112d7c){_0x5c26fe=_0x5c26fe-0x0;var _0x5a6e53=_0xbaf9[_0x5c26fe];return _0x5a6e53;};'use strict';var client=require(_0x9baf('0x0'));exports[_0x9baf('0x1')]=function(_0x3e85c6){return function(_0x429f2f){return client[_0x9baf('0x2')](_0x9baf('0x3'),{'options':{'raw':![],'attributes':['id',_0x9baf('0x4'),'channel',_0x9baf('0x5')],'include':[{'model':_0x9baf('0x6'),'as':_0x9baf('0x7'),'attributes':['id',_0x9baf('0x8'),_0x9baf('0x9'),_0x9baf('0xa')]},{'model':_0x9baf('0x6'),'as':_0x9baf('0xb'),'attributes':['id',_0x9baf('0x8'),_0x9baf('0x9'),_0x9baf('0xa')]},{'model':_0x9baf('0xc'),'as':_0x9baf('0xd'),'attributes':['id',_0x9baf('0xe'),_0x9baf('0xf'),_0x9baf('0x10'),'data3',_0x9baf('0x11'),'data5','data6',_0x9baf('0x12')]}]},'log':_0x9baf('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ae89912..6241d81 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 _0xebcc=['defaultuser','getTrunks','Request','GetTrunk','name','registry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebcc,0x109));var _0xcebc=function(_0x131bb1,_0x5c91cc){_0x131bb1=_0x131bb1-0x0;var _0x4b006b=_0xebcc[_0x131bb1];return _0x4b006b;};'use strict';var client=require('../client');exports[_0xcebc('0x0')]=function(_0x58b6f7){return function(_0x58f9af){return client[_0xcebc('0x1')](_0xcebc('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xcebc('0x3'),_0xcebc('0x4'),_0xcebc('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x6da5=['registry','defaultuser','getTrunks','Request','GetTrunk','name'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x6da5,0x104));var _0x56da=function(_0xaef77d,_0x411ccf){_0xaef77d=_0xaef77d-0x0;var _0x450a10=_0x6da5[_0xaef77d];return _0x450a10;};'use strict';var client=require('../client');exports[_0x56da('0x0')]=function(_0xa4f21a){return function(_0x2d2ffd){return client[_0x56da('0x1')](_0x56da('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x56da('0x3'),_0x56da('0x4'),_0x56da('0x5')]},'log':_0x56da('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 40f82d0..027f7c9 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x510a14,_0x5ed818){var _0x46f8c3=function(_0x339305){while(--_0x339305){_0x510a14['push'](_0x510a14['shift']());}};_0x46f8c3(++_0x5ed818);}(_0x70e0,0x17b));var _0x070e=function(_0x1fbdef,_0x3c4b25){_0x1fbdef=_0x1fbdef-0x0;var _0x26af32=_0x70e0[_0x1fbdef];return _0x26af32;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 04fe183..15f2d9e 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 _0x4de9=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x157db8,_0x44f84a){var _0x15d5ed=function(_0x562f1f){while(--_0x562f1f){_0x157db8['push'](_0x157db8['shift']());}};_0x15d5ed(++_0x44f84a);}(_0x4de9,0xbe));var _0x94de=function(_0x4b9dc9,_0x14b3a2){_0x4b9dc9=_0x4b9dc9-0x0;var _0x57b302=_0x4de9[_0x4b9dc9];return _0x57b302;};'use strict';var client=require(_0x94de('0x0'));exports['create']=function(_0x458254){return client[_0x94de('0x1')](_0x94de('0x2'),{'body':_0x458254,'log':_0x94de('0x2')});};exports[_0x94de('0x3')]=function(_0x4051cf,_0x66c90e,_0x25f382){return client[_0x94de('0x1')](_0x94de('0x4'),{'body':_0x4051cf,'options':{'where':{'uniqueid':_0x66c90e,'interface':_0x25f382,'agentcomplete':!![]}},'log':_0x94de('0x4')});}; \ No newline at end of file +var _0xc2b8=['../client','create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc2b8,0x8a));var _0x8c2b=function(_0x4f3242,_0x391954){_0x4f3242=_0x4f3242-0x0;var _0x49844f=_0xc2b8[_0x4f3242];return _0x49844f;};'use strict';var client=require(_0x8c2b('0x0'));exports[_0x8c2b('0x1')]=function(_0x3de7f7){return client['Request'](_0x8c2b('0x2'),{'body':_0x3de7f7,'log':_0x8c2b('0x2')});};exports[_0x8c2b('0x3')]=function(_0x241a8f,_0xa90062,_0x193918){return client[_0x8c2b('0x4')](_0x8c2b('0x5'),{'body':_0x241a8f,'options':{'where':{'uniqueid':_0xa90062,'interface':_0x193918,'agentcomplete':!![]}},'log':_0x8c2b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 20626a4..e0389c2 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 _0x4f06=['endOf','format','duration','GetVoiceCallReports','moment','util','lodash','../client','create','Request','calleridnum','context','callerid','CreateVoiceCallReport','getVoiceCallReports','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1ead3e,_0x188ac7){var _0x502a9d=function(_0x1bea4a){while(--_0x1bea4a){_0x1ead3e['push'](_0x1ead3e['shift']());}};_0x502a9d(++_0x188ac7);}(_0x4f06,0x1f2));var _0x64f0=function(_0x5d13f3,_0x2dd840){_0x5d13f3=_0x5d13f3-0x0;var _0x56a338=_0x4f06[_0x5d13f3];return _0x56a338;};'use strict';var moment=require(_0x64f0('0x0'));var util=require(_0x64f0('0x1'));var _=require(_0x64f0('0x2'));var client=require(_0x64f0('0x3'));exports[_0x64f0('0x4')]=function(_0x5d0843){return client[_0x64f0('0x5')]('CreateVoiceCallReport',{'body':_['merge'](_0x5d0843,{'source':_0x5d0843[_0x64f0('0x6')],'destinationcontext':_0x5d0843[_0x64f0('0x7')],'callerid':_0x5d0843[_0x64f0('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x64f0('0x9')});};exports[_0x64f0('0xa')]=function(){return function(){return client[_0x64f0('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x64f0('0xb')],'createdAt':{'$between':[moment()[_0x64f0('0xc')](_0x64f0('0xd'))['format'](_0x64f0('0xe')),moment()[_0x64f0('0xf')](_0x64f0('0xd'))[_0x64f0('0x10')](_0x64f0('0xe'))]}},'attributes':['type','disposition',_0x64f0('0x11'),'billableseconds']},'log':_0x64f0('0x12')});};}; \ No newline at end of file +var _0xa8b8=['day','format','YYYY-MM-DD\x20HH:mm:ss','disposition','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xa8b8,0xaf));var _0x8a8b=function(_0x319209,_0x5913f0){_0x319209=_0x319209-0x0;var _0x2c1e3a=_0xa8b8[_0x319209];return _0x2c1e3a;};'use strict';var moment=require(_0x8a8b('0x0'));var util=require(_0x8a8b('0x1'));var _=require('lodash');var client=require(_0x8a8b('0x2'));exports[_0x8a8b('0x3')]=function(_0x2260d0){return client[_0x8a8b('0x4')](_0x8a8b('0x5'),{'body':_['merge'](_0x2260d0,{'source':_0x2260d0[_0x8a8b('0x6')],'destinationcontext':_0x2260d0[_0x8a8b('0x7')],'callerid':_0x2260d0[_0x8a8b('0x8')],'amaflags':_0x8a8b('0x9')}),'log':_0x8a8b('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x8a8b('0xa'),{'options':{'where':{'type':[_0x8a8b('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x8a8b('0xc'))[_0x8a8b('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x8a8b('0xd')](_0x8a8b('0xe'))]}},'attributes':['type',_0x8a8b('0xf'),'duration','billableseconds']},'log':_0x8a8b('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index aea861d..6a349d4 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 _0xd3f6=['../client','create','Request','CreateVoiceDialReport'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0xd3f6,0x194));var _0x6d3f=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0xd3f6[_0x216d45];return _0xbaac0b;};'use strict';var client=require(_0x6d3f('0x0'));exports[_0x6d3f('0x1')]=function(_0x3b6dae){return client[_0x6d3f('0x2')](_0x6d3f('0x3'),{'body':_0x3b6dae,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x6c1b=['create','Request','CreateVoiceDialReport','../client'];(function(_0x398f7b,_0x29030b){var _0x1202c5=function(_0x16fd3e){while(--_0x16fd3e){_0x398f7b['push'](_0x398f7b['shift']());}};_0x1202c5(++_0x29030b);}(_0x6c1b,0x1eb));var _0xb6c1=function(_0x27c96e,_0x2074ef){_0x27c96e=_0x27c96e-0x0;var _0x1dea73=_0x6c1b[_0x27c96e];return _0x1dea73;};'use strict';var client=require(_0xb6c1('0x0'));exports[_0xb6c1('0x1')]=function(_0xc12680){return client[_0xb6c1('0x2')](_0xb6c1('0x3'),{'body':_0xc12680,'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 a5cd7f9..74ba6f6 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 _0x263f=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x263f,0x182));var _0xf263=function(_0x342a78,_0x334e9f){_0x342a78=_0x342a78-0x0;var _0x209352=_0x263f[_0x342a78];return _0x209352;};'use strict';var client=require(_0xf263('0x0'));exports[_0xf263('0x1')]=function(){return function(){return client[_0xf263('0x2')](_0xf263('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf263('0x4'),_0xf263('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x559a=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x7f98f0,_0x23a231){var _0x3c49f9=function(_0xce14c6){while(--_0xce14c6){_0x7f98f0['push'](_0x7f98f0['shift']());}};_0x3c49f9(++_0x23a231);}(_0x559a,0xb3));var _0xa559=function(_0xc5a26f,_0x387a32){_0xc5a26f=_0xc5a26f-0x0;var _0x1740cc=_0x559a[_0xc5a26f];return _0x1740cc;};'use strict';var client=require(_0xa559('0x0'));exports[_0xa559('0x1')]=function(){return function(){return client['Request'](_0xa559('0x2'),{'options':{'raw':!![],'attributes':['id',_0xa559('0x3'),_0xa559('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xa559('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index aac3eca..781e24d 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 _0xdcb3=['mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x1863be,_0x3fb18f){var _0x5835e1=function(_0xaa0e92){while(--_0xaa0e92){_0x1863be['push'](_0x1863be['shift']());}};_0x5835e1(++_0x3fb18f);}(_0xdcb3,0xbc));var _0x3dcb=function(_0xee3338,_0x49aa57){_0xee3338=_0xee3338-0x0;var _0x4479ce=_0xdcb3[_0xee3338];return _0x4479ce;};'use strict';var client=require(_0x3dcb('0x0'));exports[_0x3dcb('0x1')]=function(){return function(){return client[_0x3dcb('0x2')](_0x3dcb('0x3'),{'options':{'raw':![],'attributes':['id',_0x3dcb('0x4'),_0x3dcb('0x5'),_0x3dcb('0x6'),_0x3dcb('0x7'),_0x3dcb('0x8'),_0x3dcb('0x9'),_0x3dcb('0xa'),_0x3dcb('0xb'),_0x3dcb('0xc'),_0x3dcb('0xd'),_0x3dcb('0xe'),_0x3dcb('0xf'),_0x3dcb('0x10'),'dialPredictiveInterval',_0x3dcb('0x11'),_0x3dcb('0x12'),'dialOriginateTimeout',_0x3dcb('0x13'),'dialQueueTimeout',_0x3dcb('0x14'),'dialCongestionMaxRetry',_0x3dcb('0x15'),_0x3dcb('0x16'),_0x3dcb('0x17'),'dialNoAnswerMaxRetry',_0x3dcb('0x18'),'dialGlobalMaxRetry','dialTimezone',_0x3dcb('0x19'),_0x3dcb('0x1a'),_0x3dcb('0x1b'),'dialAMDActive','dialAMDInitialSilence',_0x3dcb('0x1c'),_0x3dcb('0x1d'),_0x3dcb('0x1e'),_0x3dcb('0x1f'),_0x3dcb('0x20'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x3dcb('0x21'),_0x3dcb('0x22'),_0x3dcb('0x23'),_0x3dcb('0x24'),_0x3dcb('0x25'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x3dcb('0x26'),_0x3dcb('0x8'),_0x3dcb('0x27'),_0x3dcb('0x28'),'dialCutDigit',_0x3dcb('0x29'),_0x3dcb('0x2a'),_0x3dcb('0x2b'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x3dcb('0x2c'),_0x3dcb('0x2d'),_0x3dcb('0x2e'),_0x3dcb('0x2f'),'dialAgentRejectRetryFrequency',_0x3dcb('0x30'),'dialPredictiveIntervalMaxThreshold',_0x3dcb('0x31'),_0x3dcb('0x32'),_0x3dcb('0x33')],'include':[{'model':_0x3dcb('0x34'),'as':_0x3dcb('0x34'),'attributes':['id',_0x3dcb('0x4'),_0x3dcb('0x35'),_0x3dcb('0x36')]},{'model':_0x3dcb('0x37'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':'Trunk','as':_0x3dcb('0x38'),'attributes':['id',_0x3dcb('0x4'),_0x3dcb('0x35'),_0x3dcb('0x36')]},{'model':_0x3dcb('0x39'),'as':_0x3dcb('0x39'),'attributes':['id',_0x3dcb('0x4')],'include':[{'model':_0x3dcb('0x39'),'as':_0x3dcb('0x3a'),'attributes':['id',_0x3dcb('0x4'),'interval']}]}]},'log':_0x3dcb('0x1')});};}; \ No newline at end of file +var _0xe058=['interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe058,0x109));var _0x8e05=function(_0x3bae26,_0x125d0d){_0x3bae26=_0x3bae26-0x0;var _0x205b18=_0xe058[_0x3bae26];return _0x205b18;};'use strict';var client=require('../client');exports[_0x8e05('0x0')]=function(){return function(){return client[_0x8e05('0x1')](_0x8e05('0x2'),{'options':{'raw':![],'attributes':['id',_0x8e05('0x3'),_0x8e05('0x4'),_0x8e05('0x5'),_0x8e05('0x6'),_0x8e05('0x7'),_0x8e05('0x8'),_0x8e05('0x9'),_0x8e05('0xa'),_0x8e05('0xb'),_0x8e05('0xc'),_0x8e05('0xd'),_0x8e05('0xe'),_0x8e05('0xf'),_0x8e05('0x10'),_0x8e05('0x11'),_0x8e05('0x12'),_0x8e05('0x13'),_0x8e05('0x14'),'dialQueueTimeout',_0x8e05('0x15'),_0x8e05('0x16'),_0x8e05('0x17'),_0x8e05('0x18'),_0x8e05('0x19'),_0x8e05('0x1a'),_0x8e05('0x1b'),_0x8e05('0x1c'),_0x8e05('0x1d'),_0x8e05('0x1e'),_0x8e05('0x1f'),_0x8e05('0x20'),_0x8e05('0x21'),_0x8e05('0x22'),'dialAMDGreeting',_0x8e05('0x23'),_0x8e05('0x24'),_0x8e05('0x25'),_0x8e05('0x26'),'dialAMDMaximumNumberOfWords',_0x8e05('0x27'),_0x8e05('0x28'),_0x8e05('0x29'),_0x8e05('0x2a'),_0x8e05('0x2b'),_0x8e05('0x2c'),'dialAgiAfterHangupAgent',_0x8e05('0x2d'),'dialQueueProject2',_0x8e05('0x7'),_0x8e05('0x2e'),'dialRandomLastDigitCallerIdNumber',_0x8e05('0x2f'),'dialNoSuchNumberMaxRetry',_0x8e05('0x30'),_0x8e05('0x31'),'dialDropRetryFrequency',_0x8e05('0x32'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0x8e05('0x33'),_0x8e05('0x34'),_0x8e05('0x35'),_0x8e05('0x36'),_0x8e05('0x37'),'dialPredictiveIntervalMinThreshold',_0x8e05('0x38'),_0x8e05('0x39')],'include':[{'model':'Trunk','as':_0x8e05('0x3a'),'attributes':['id',_0x8e05('0x3'),'callerid',_0x8e05('0x3b')]},{'model':_0x8e05('0x3c'),'as':_0x8e05('0x3d'),'attributes':['id',_0x8e05('0x3')]},{'model':_0x8e05('0x3a'),'as':_0x8e05('0x3e'),'attributes':['id',_0x8e05('0x3'),_0x8e05('0x3f'),_0x8e05('0x3b')]},{'model':_0x8e05('0x40'),'as':_0x8e05('0x40'),'attributes':['id',_0x8e05('0x3')],'include':[{'model':_0x8e05('0x40'),'as':'Intervals','attributes':['id',_0x8e05('0x3'),_0x8e05('0x41')]}]}]},'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 09a469d..ef1afb0 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(_0x5da9e1,_0xc580f8){var _0x21a139=function(_0x35b0cd){while(--_0x35b0cd){_0x5da9e1['push'](_0x5da9e1['shift']());}};_0x21a139(++_0xc580f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x2ed78a,_0xc140f4){var _0x5d1017=function(_0x18e976){while(--_0x18e976){_0x2ed78a['push'](_0x2ed78a['shift']());}};_0x5d1017(++_0xc140f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 970fc2b..b0226cf 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 _0xe4e1=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4e1,0xa6));var _0x1e4e=function(_0x3f52f0,_0x39e5c0){_0x3f52f0=_0x3f52f0-0x0;var _0x268177=_0xe4e1[_0x3f52f0];return _0x268177;};'use strict';var client=require('../client');exports[_0x1e4e('0x0')]=function(_0x499e6d){return function(){return client[_0x1e4e('0x1')](_0x1e4e('0x2'),{'options':{'where':{'VoiceQueueId':_0x499e6d,'paused':!![]},'raw':!![]},'log':_0x1e4e('0x0')});};}; \ No newline at end of file +var _0x91d1=['Request','../client'];(function(_0x270352,_0x51c819){var _0x4f97d3=function(_0x45ee21){while(--_0x45ee21){_0x270352['push'](_0x270352['shift']());}};_0x4f97d3(++_0x51c819);}(_0x91d1,0x1ab));var _0x191d=function(_0x1551c7,_0xe236c1){_0x1551c7=_0x1551c7-0x0;var _0x1c0a95=_0x91d1[_0x1551c7];return _0x1c0a95;};'use strict';var client=require(_0x191d('0x0'));exports['getVoiceQueueRtPauses']=function(_0x109f2f){return function(){return client[_0x191d('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x109f2f,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 5ee0a22..259ad7e 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x36c053,_0x1a5301){var _0x51d657=function(_0x2e4806){while(--_0x2e4806){_0x36c053['push'](_0x36c053['shift']());}};_0x51d657(++_0x1a5301);}(_0x7a54,0x106));var _0x47a5=function(_0x4f3a73,_0x11ce46){_0x4f3a73=_0x4f3a73-0x0;var _0x5930f2=_0x7a54[_0x4f3a73];return _0x5930f2;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4fa488,_0x296536){var _0xdd0ed2=function(_0x138be0){while(--_0x138be0){_0x4fa488['push'](_0x4fa488['shift']());}};_0xdd0ed2(++_0x296536);}(_0x7a54,0x106));var _0x47a5=function(_0x8c8648,_0x132984){_0x8c8648=_0x8c8648-0x0;var _0xbfa26f=_0x7a54[_0x8c8648];return _0xbfa26f;};'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 e88138d..64c43a1 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 _0x69d4=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum'];(function(_0x5be7ff,_0x1c701b){var _0x5e851d=function(_0x145717){while(--_0x145717){_0x5be7ff['push'](_0x5be7ff['shift']());}};_0x5e851d(++_0x1c701b);}(_0x69d4,0x1d6));var _0x469d=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0x69d4[_0x138d06];return _0x1a01eb;};'use strict';var client=require(_0x469d('0x0'));exports[_0x469d('0x1')]={};exports[_0x469d('0x2')]=function(_0x52ceeb){return client[_0x469d('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x52ceeb[_0x469d('0x4')],'transfererchannel':_0x52ceeb['transfererchannel'],'transferercalleridnum':_0x52ceeb[_0x469d('0x5')],'transferercalleridname':_0x52ceeb[_0x469d('0x6')],'transfererconnectedlinenum':_0x52ceeb['transfererconnectedlinenum'],'transfererconnectedlinename':_0x52ceeb[_0x469d('0x7')],'transfereraccountcode':_0x52ceeb[_0x469d('0x8')],'transferercontext':_0x52ceeb[_0x469d('0x9')],'transfererexten':_0x52ceeb[_0x469d('0xa')],'transfererlinkedid':_0x52ceeb[_0x469d('0xb')],'transfereechannel':_0x52ceeb['transfereechannel'],'transfereecalleridnum':_0x52ceeb[_0x469d('0xc')],'transfereecalleridname':_0x52ceeb['transfereecalleridname'],'transfereeconnectedlinenum':_0x52ceeb[_0x469d('0xd')],'transfereeconnectedlinename':_0x52ceeb[_0x469d('0xe')],'transfereeaccountcode':_0x52ceeb[_0x469d('0xf')],'transfereecontext':_0x52ceeb[_0x469d('0x10')],'transfereeexten':_0x52ceeb[_0x469d('0x11')],'transfereelinkedid':_0x52ceeb[_0x469d('0x12')],'isexternal':_0x52ceeb[_0x469d('0x13')],'context':_0x52ceeb[_0x469d('0x14')],'extension':_0x52ceeb[_0x469d('0x15')],'type':_0x469d('0x16')},'log':'CreateVoiceTransferReport'});};exports[_0x469d('0x17')]=function(_0x53e6f3){return client[_0x469d('0x3')](_0x469d('0x18'),{'body':{'result':_0x53e6f3['result'],'transfererchannel':_0x53e6f3[_0x469d('0x19')],'transferercalleridnum':_0x53e6f3['origtransferercalleridnum'],'transferercalleridname':_0x53e6f3['origtransferercalleridname'],'transfererconnectedlinenum':_0x53e6f3[_0x469d('0x1a')],'transfererconnectedlinename':_0x53e6f3[_0x469d('0x1b')],'transfereraccountcode':_0x53e6f3['origtransfereraccountcode'],'transferercontext':_0x53e6f3[_0x469d('0x1c')],'transfererexten':_0x53e6f3[_0x469d('0x1d')],'transfererlinkedid':_0x53e6f3['origtransfererlinkedid'],'transfereechannel':_0x53e6f3[_0x469d('0x1e')],'transfereecalleridnum':_0x53e6f3[_0x469d('0x1f')],'transfereecalleridname':_0x53e6f3[_0x469d('0x20')],'transfereeconnectedlinenum':_0x53e6f3[_0x469d('0x21')],'transfereeconnectedlinename':_0x53e6f3[_0x469d('0x22')],'transfereeaccountcode':_0x53e6f3[_0x469d('0x23')],'transfereecontext':_0x53e6f3[_0x469d('0x24')],'transfereeexten':_0x53e6f3[_0x469d('0x25')],'transfereelinkedid':_0x53e6f3[_0x469d('0x26')],'isexternal':_0x53e6f3['isexternal'],'context':_0x53e6f3[_0x469d('0x27')],'extension':_0x53e6f3[_0x469d('0x28')],'type':_0x469d('0x29')},'log':_0x469d('0x18')});}; \ No newline at end of file +var _0xbaee=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridname','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname'];(function(_0x579ce8,_0x332296){var _0xd16451=function(_0x23fced){while(--_0x23fced){_0x579ce8['push'](_0x579ce8['shift']());}};_0xd16451(++_0x332296);}(_0xbaee,0x133));var _0xebae=function(_0x40e6b,_0x2b10a7){_0x40e6b=_0x40e6b-0x0;var _0x142a0f=_0xbaee[_0x40e6b];return _0x142a0f;};'use strict';var client=require(_0xebae('0x0'));exports[_0xebae('0x1')]={};exports[_0xebae('0x2')]=function(_0x5b7466){return client[_0xebae('0x3')](_0xebae('0x4'),{'body':{'result':_0x5b7466[_0xebae('0x5')],'transfererchannel':_0x5b7466[_0xebae('0x6')],'transferercalleridnum':_0x5b7466['transferercalleridnum'],'transferercalleridname':_0x5b7466[_0xebae('0x7')],'transfererconnectedlinenum':_0x5b7466[_0xebae('0x8')],'transfererconnectedlinename':_0x5b7466['transfererconnectedlinename'],'transfereraccountcode':_0x5b7466[_0xebae('0x9')],'transferercontext':_0x5b7466[_0xebae('0xa')],'transfererexten':_0x5b7466[_0xebae('0xb')],'transfererlinkedid':_0x5b7466[_0xebae('0xc')],'transfereechannel':_0x5b7466[_0xebae('0xd')],'transfereecalleridnum':_0x5b7466[_0xebae('0xe')],'transfereecalleridname':_0x5b7466['transfereecalleridname'],'transfereeconnectedlinenum':_0x5b7466['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5b7466['transfereeconnectedlinename'],'transfereeaccountcode':_0x5b7466[_0xebae('0xf')],'transfereecontext':_0x5b7466[_0xebae('0x10')],'transfereeexten':_0x5b7466[_0xebae('0x11')],'transfereelinkedid':_0x5b7466[_0xebae('0x12')],'isexternal':_0x5b7466[_0xebae('0x13')],'context':_0x5b7466[_0xebae('0x14')],'extension':_0x5b7466[_0xebae('0x15')],'type':_0xebae('0x16')},'log':_0xebae('0x4')});};exports[_0xebae('0x17')]=function(_0x7a4362){return client[_0xebae('0x3')](_0xebae('0x4'),{'body':{'result':_0x7a4362[_0xebae('0x5')],'transfererchannel':_0x7a4362[_0xebae('0x18')],'transferercalleridnum':_0x7a4362['origtransferercalleridnum'],'transferercalleridname':_0x7a4362[_0xebae('0x19')],'transfererconnectedlinenum':_0x7a4362['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x7a4362[_0xebae('0x1a')],'transfereraccountcode':_0x7a4362[_0xebae('0x1b')],'transferercontext':_0x7a4362[_0xebae('0x1c')],'transfererexten':_0x7a4362['secondtransfererexten'],'transfererlinkedid':_0x7a4362['origtransfererlinkedid'],'transfereechannel':_0x7a4362[_0xebae('0x1d')],'transfereecalleridnum':_0x7a4362['transfertargetcalleridnum'],'transfereecalleridname':_0x7a4362[_0xebae('0x1e')],'transfereeconnectedlinenum':_0x7a4362['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x7a4362['transfertargetconnectedlinename'],'transfereeaccountcode':_0x7a4362['transfertargetaccountcode'],'transfereecontext':_0x7a4362[_0xebae('0x1f')],'transfereeexten':_0x7a4362[_0xebae('0x20')],'transfereelinkedid':_0x7a4362[_0xebae('0x21')],'isexternal':_0x7a4362[_0xebae('0x13')],'context':_0x7a4362[_0xebae('0x22')],'extension':_0x7a4362[_0xebae('0x23')],'type':_0xebae('0x24')},'log':_0xebae('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5e1ed3a..dd9ef5c 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x4f7681,_0x4458ba){var _0x361b9a=function(_0x59c936){while(--_0x59c936){_0x4f7681['push'](_0x4f7681['shift']());}};_0x361b9a(++_0x4458ba);}(_0x7a54,0x106));var _0x47a5=function(_0xf1dc09,_0x35f4cb){_0xf1dc09=_0xf1dc09-0x0;var _0x420867=_0x7a54[_0xf1dc09];return _0x420867;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x43ce5f,_0x30cebb){var _0x32ec8a=function(_0x15f135){while(--_0x15f135){_0x43ce5f['push'](_0x43ce5f['shift']());}};_0x32ec8a(++_0x30cebb);}(_0xb10b,0x12a));var _0xbb10=function(_0x569998,_0x361b8d){_0x569998=_0x569998-0x0;var _0x2f8256=_0xb10b[_0x569998];return _0x2f8256;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 1920d58..e1b9726 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 _0x3b48=['join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','union','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]'];(function(_0x1cca1b,_0x143f37){var _0x246bb2=function(_0x11cab0){while(--_0x11cab0){_0x1cca1b['push'](_0x1cca1b['shift']());}};_0x246bb2(++_0x143f37);}(_0x3b48,0x1b1));var _0x83b4=function(_0x2effe3,_0x564748){_0x2effe3=_0x2effe3-0x0;var _0x25e799=_0x3b48[_0x2effe3];return _0x25e799;};'use strict';var _=require(_0x83b4('0x0'));var BPromise=require(_0x83b4('0x1'));var Redis=require(_0x83b4('0x2'));var util=require(_0x83b4('0x3'));var config=require(_0x83b4('0x4'));var logger=require(_0x83b4('0x5'))(_0x83b4('0x6'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_['defaults'](config[_0x83b4('0x7')],{'host':_0x83b4('0x8'),'port':0x18eb});var io=require(_0x83b4('0x9'))(new Redis(config[_0x83b4('0x7')]));function emit(_0x1e9cc6,_0x3a722c,_0x11e7d6,_0x29592d,_0x252fde){logger[_0x83b4('0xa')](_0x83b4('0xb'),_0x1e9cc6,_0x3a722c['id'],_0x11e7d6,_0x29592d,JSON['stringify'](_0x252fde));io['to'](_0x11e7d6)[_0x83b4('0xc')](_0x29592d,_0x252fde);}exports[_0x83b4('0xd')]=function(_0x497495,_0x206795,_0x37cf50,_0x56ca33){var _0x1dba25,_0x42ceb0;var _0x5ba70a={};var _0x311acd;var _0x21cfd5=Number(_0x37cf50['data1']);var _0x39ae2d=_0x37cf50['data2']?Boolean(Number(_0x37cf50[_0x83b4('0xe')])):![];var _0x62b2c2;var _0x486a0a=![];if(!_[_0x83b4('0xf')](_0x37cf50['data5'])){if(_0x37cf50[_0x83b4('0x10')]=='1')_0x486a0a=!![];}if(!_0x486a0a){if(_0x56ca33[_0x83b4('0x11')]){_0x5ba70a['id']=_0x56ca33['xmd-contactid'];}}if(!_0x5ba70a['id']){_0x5ba70a[_0x83b4('0x12')]=_0x21cfd5;_0x62b2c2=_0x37cf50[_0x83b4('0x13')]&&_0x37cf50['data3']!=='0'?_0x37cf50[_0x83b4('0x13')][_0x83b4('0x14')](','):['phone'];_0x5ba70a[_0x83b4('0x15')]=_[_0x83b4('0x16')](_0x62b2c2,function(_0x3350f2){var _0x294fd5={};_0x294fd5[_0x3350f2]=_0x56ca33[_0x83b4('0x17')]?_0x56ca33[_0x83b4('0x18')]:_0x56ca33[_0x83b4('0x19')];return _0x294fd5;});_0x311acd=_0x56ca33[_0x83b4('0x17')]?_0x56ca33[_0x83b4('0x18')]:_0x56ca33[_0x83b4('0x19')];}var _0x243b9a=['id',_0x83b4('0x1a'),'lastName','phone',_0x83b4('0x1b'),_0x83b4('0x1c'),_0x83b4('0x12'),_0x83b4('0x1d'),_0x83b4('0x1e'),_0x83b4('0x1f')];var _0x55a4bd=_[_0x83b4('0x20')](_0x243b9a,_0x62b2c2);BPromise['resolve']()[_0x83b4('0x21')](cmContactRpc['getContacts']({'attributes':_0x55a4bd,'where':_0x5ba70a,'phone':_0x311acd}))['then'](function(_0xea8e58){_0x42ceb0=_0xea8e58;if(!_[_0x83b4('0x22')](_0x42ceb0)){if(_0x42ceb0[_0x83b4('0x23')]===0x1){_0x1dba25=_0x42ceb0[0x0];logger[_0x83b4('0xa')](_0x83b4('0x24'),_0x56ca33[_0x83b4('0x25')],_0x206795['id'],_0x1dba25['id']);}else{logger[_0x83b4('0xa')](_0x83b4('0x26'),_0x56ca33[_0x83b4('0x25')],_0x206795['id'],_[_0x83b4('0x16')](_0x42ceb0,'id')[_0x83b4('0x27')](','));}return;}else{logger[_0x83b4('0xa')](_0x83b4('0x28'),_0x56ca33[_0x83b4('0x25')],_0x206795['id']);var _0xbfde6c={'ListId':_0x21cfd5};var _0x53cdd8=_0x37cf50[_0x83b4('0x29')]&&_0x37cf50['data4']!=='0'?_0x37cf50[_0x83b4('0x29')]:'phone';if(_0x39ae2d){logger[_0x83b4('0xa')](_0x83b4('0x2a'),_0x56ca33[_0x83b4('0x25')],_0x206795['id']);_0xbfde6c[_0x53cdd8]=_[_0x83b4('0xf')](_0x56ca33[_0x83b4('0x17')])?_0x56ca33[_0x83b4('0x19')]:_0x56ca33[_0x83b4('0x18')];if(_[_0x83b4('0xf')](_0x56ca33['routeId'])){_0xbfde6c[_0x83b4('0x1a')]=_0x56ca33[_0x83b4('0x2b')]&&_0x56ca33[_0x83b4('0x2b')]!==_0x83b4('0x2c')?_0x56ca33[_0x83b4('0x2b')]:_0x83b4('0x2d');}else{_0xbfde6c[_0x83b4('0x1a')]=_0x56ca33[_0x83b4('0x2e')]&&_0x56ca33['destcalleridname']!==_0x83b4('0x2c')?_0x56ca33[_0x83b4('0x2e')]:_0x83b4('0x2d');}return BPromise[_0x83b4('0x2f')]()[_0x83b4('0x21')](cmContactRpc[_0x83b4('0x30')](_0xbfde6c))[_0x83b4('0x21')](function(_0x2386f0){_0x1dba25=_0x2386f0;_0x42ceb0[_0x83b4('0x31')](_0x2386f0);if(_0x1dba25){logger[_0x83b4('0xa')](_0x83b4('0x32'),_0x56ca33[_0x83b4('0x25')],_0x206795['id'],_0x1dba25['id']);}return;});}else{logger[_0x83b4('0xa')](_0x83b4('0x33'),_0x56ca33[_0x83b4('0x25')],_0x206795['id']);_0xbfde6c[_0x53cdd8]=_[_0x83b4('0xf')](_0x56ca33[_0x83b4('0x17')])?_0x56ca33[_0x83b4('0x19')]:_0x56ca33[_0x83b4('0x18')];if(_[_0x83b4('0xf')](_0x56ca33[_0x83b4('0x17')])){_0xbfde6c['firstName']=_0x56ca33[_0x83b4('0x2b')]&&_0x56ca33[_0x83b4('0x2b')]!==''?_0x56ca33[_0x83b4('0x2b')]:_0x83b4('0x2d');}else{_0xbfde6c[_0x83b4('0x1a')]=_0x56ca33[_0x83b4('0x2e')]&&_0x56ca33[_0x83b4('0x2e')]!==''?_0x56ca33[_0x83b4('0x2e')]:_0x83b4('0x2d');}_0x1dba25=_0xbfde6c;_0x42ceb0[_0x83b4('0x31')](_0xbfde6c);return;}}})['then'](function(){if(_0x497495){emit(_0x56ca33[_0x83b4('0x25')],_0x206795,util[_0x83b4('0x34')](_0x83b4('0x35'),_0x497495[_0x83b4('0x36')]),util['format'](_0x83b4('0x37'),_0x37cf50[_0x83b4('0x38')][_0x83b4('0x39')]()),{'evt':_[_0x83b4('0x3a')](_0x56ca33,{'autoCreate':_0x39ae2d}),'contact':_0x1dba25===undefined?{}:_0x1dba25,'contacts':_0x42ceb0[_0x83b4('0x23')]===0x0?undefined:_0x42ceb0});}});}; \ No newline at end of file +var _0x7fe2=['xmd-contactid','ListId','data3','split','phone','$or','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','isEmpty','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','firstName','calleridname','Unknown','destcalleridname','','then','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','util','trigger','../../rpc/cmContact','redis','[CM][%s][%s]','stringify','exec','data2','isNil','data5'];(function(_0x3f657e,_0xef58b1){var _0x36b9be=function(_0x384907){while(--_0x384907){_0x3f657e['push'](_0x3f657e['shift']());}};_0x36b9be(++_0xef58b1);}(_0x7fe2,0x96));var _0x27fe=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x7fe2[_0x146a85];return _0x1b59bf;};'use strict';var _=require(_0x27fe('0x0'));var BPromise=require(_0x27fe('0x1'));var Redis=require('ioredis');var util=require(_0x27fe('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x27fe('0x3'));var cmContactRpc=require(_0x27fe('0x4'));config[_0x27fe('0x5')]=_['defaults'](config[_0x27fe('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x27fe('0x5')]));function emit(_0xc91e9d,_0x5ac6c2,_0x1ecaa4,_0x3f8411,_0x4b9a90){logger['info'](_0x27fe('0x6'),_0xc91e9d,_0x5ac6c2['id'],_0x1ecaa4,_0x3f8411,JSON[_0x27fe('0x7')](_0x4b9a90));io['to'](_0x1ecaa4)['emit'](_0x3f8411,_0x4b9a90);}exports[_0x27fe('0x8')]=function(_0xd991e9,_0x5ef130,_0x1f0956,_0x51d5c8){var _0x3ce7d0,_0x48bf1e;var _0x49bbde={};var _0x52f6a5;var _0x5cdc58=Number(_0x1f0956['data1']);var _0x23cd2f=_0x1f0956[_0x27fe('0x9')]?Boolean(Number(_0x1f0956['data2'])):![];var _0x1de7dd;var _0x25e75f=![];if(!_[_0x27fe('0xa')](_0x1f0956[_0x27fe('0xb')])){if(_0x1f0956[_0x27fe('0xb')]=='1')_0x25e75f=!![];}if(!_0x25e75f){if(_0x51d5c8[_0x27fe('0xc')]){_0x49bbde['id']=_0x51d5c8[_0x27fe('0xc')];}}if(!_0x49bbde['id']){_0x49bbde[_0x27fe('0xd')]=_0x5cdc58;_0x1de7dd=_0x1f0956[_0x27fe('0xe')]&&_0x1f0956[_0x27fe('0xe')]!=='0'?_0x1f0956[_0x27fe('0xe')][_0x27fe('0xf')](','):[_0x27fe('0x10')];_0x49bbde[_0x27fe('0x11')]=_['map'](_0x1de7dd,function(_0x31e71c){var _0x54fcf5={};_0x54fcf5[_0x31e71c]=_0x51d5c8['routeId']?_0x51d5c8[_0x27fe('0x12')]:_0x51d5c8['calleridnum'];return _0x54fcf5;});_0x52f6a5=_0x51d5c8['routeId']?_0x51d5c8[_0x27fe('0x12')]:_0x51d5c8[_0x27fe('0x13')];}var _0x134c82=['id','firstName',_0x27fe('0x14'),_0x27fe('0x10'),_0x27fe('0x15'),_0x27fe('0x16'),_0x27fe('0xd'),_0x27fe('0x17'),_0x27fe('0x18'),_0x27fe('0x19')];var _0x1f249f=_['union'](_0x134c82,_0x1de7dd);BPromise[_0x27fe('0x1a')]()['then'](cmContactRpc['getContacts']({'attributes':_0x1f249f,'where':_0x49bbde,'phone':_0x52f6a5}))['then'](function(_0x2d161b){_0x48bf1e=_0x2d161b;if(!_[_0x27fe('0x1b')](_0x48bf1e)){if(_0x48bf1e['length']===0x1){_0x3ce7d0=_0x48bf1e[0x0];logger[_0x27fe('0x1c')](_0x27fe('0x1d'),_0x51d5c8[_0x27fe('0x1e')],_0x5ef130['id'],_0x3ce7d0['id']);}else{logger['info'](_0x27fe('0x1f'),_0x51d5c8[_0x27fe('0x1e')],_0x5ef130['id'],_[_0x27fe('0x20')](_0x48bf1e,'id')['join'](','));}return;}else{logger[_0x27fe('0x1c')](_0x27fe('0x21'),_0x51d5c8[_0x27fe('0x1e')],_0x5ef130['id']);var _0x35b8e7={'ListId':_0x5cdc58};var _0x59d10b=_0x1f0956[_0x27fe('0x22')]&&_0x1f0956[_0x27fe('0x22')]!=='0'?_0x1f0956[_0x27fe('0x22')]:_0x27fe('0x10');if(_0x23cd2f){logger[_0x27fe('0x1c')](_0x27fe('0x23'),_0x51d5c8[_0x27fe('0x1e')],_0x5ef130['id']);_0x35b8e7[_0x59d10b]=_['isNil'](_0x51d5c8[_0x27fe('0x24')])?_0x51d5c8[_0x27fe('0x13')]:_0x51d5c8[_0x27fe('0x12')];if(_[_0x27fe('0xa')](_0x51d5c8[_0x27fe('0x24')])){_0x35b8e7[_0x27fe('0x25')]=_0x51d5c8[_0x27fe('0x26')]&&_0x51d5c8[_0x27fe('0x26')]!==''?_0x51d5c8['calleridname']:_0x27fe('0x27');}else{_0x35b8e7[_0x27fe('0x25')]=_0x51d5c8['destcalleridname']&&_0x51d5c8[_0x27fe('0x28')]!==_0x27fe('0x29')?_0x51d5c8[_0x27fe('0x28')]:'Unknown';}return BPromise[_0x27fe('0x1a')]()[_0x27fe('0x2a')](cmContactRpc[_0x27fe('0x2b')](_0x35b8e7))[_0x27fe('0x2a')](function(_0xea86fb){_0x3ce7d0=_0xea86fb;_0x48bf1e[_0x27fe('0x2c')](_0xea86fb);if(_0x3ce7d0){logger[_0x27fe('0x1c')](_0x27fe('0x2d'),_0x51d5c8[_0x27fe('0x1e')],_0x5ef130['id'],_0x3ce7d0['id']);}return;});}else{logger[_0x27fe('0x1c')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x51d5c8[_0x27fe('0x1e')],_0x5ef130['id']);_0x35b8e7[_0x59d10b]=_[_0x27fe('0xa')](_0x51d5c8[_0x27fe('0x24')])?_0x51d5c8[_0x27fe('0x13')]:_0x51d5c8[_0x27fe('0x12')];if(_[_0x27fe('0xa')](_0x51d5c8[_0x27fe('0x24')])){_0x35b8e7[_0x27fe('0x25')]=_0x51d5c8['calleridname']&&_0x51d5c8[_0x27fe('0x26')]!==_0x27fe('0x29')?_0x51d5c8[_0x27fe('0x26')]:_0x27fe('0x27');}else{_0x35b8e7['firstName']=_0x51d5c8[_0x27fe('0x28')]&&_0x51d5c8[_0x27fe('0x28')]!==_0x27fe('0x29')?_0x51d5c8[_0x27fe('0x28')]:_0x27fe('0x27');}_0x3ce7d0=_0x35b8e7;_0x48bf1e[_0x27fe('0x2c')](_0x35b8e7);return;}}})['then'](function(){if(_0xd991e9){emit(_0x51d5c8[_0x27fe('0x1e')],_0x5ef130,util[_0x27fe('0x2e')](_0x27fe('0x2f'),_0xd991e9[_0x27fe('0x30')]),util[_0x27fe('0x2e')](_0x27fe('0x31'),_0x1f0956[_0x27fe('0x32')][_0x27fe('0x33')]()),{'evt':_[_0x27fe('0x34')](_0x51d5c8,{'autoCreate':_0x23cd2f}),'contact':_0x3ce7d0===undefined?{}:_0x3ce7d0,'contacts':_0x48bf1e[_0x27fe('0x35')]===0x0?undefined:_0x48bf1e});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index a2bcd1d..26110a2 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 _0xd61b=['data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','user:%s','name','format','trigger:%s:%s','jscripty','trigger:%s','exec','integration','accounts','queue','voiceExtensions','routeId','urlforward','script','buildUri','parse','query','search','replace','every','AllConditions','checkConditions','AnyConditions','channel','checkTrigger:\x20trigger','field','chat','ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','message','event','agent','membername','lastevent','substatus','offlineMessage','created','equals','util','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','popup','url','winapp','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','vtigerAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','emit','undefined','motionChannel','debug','inspect','checkTriggers','hasOwnProperty','checkTrigger','merge','variables','length','Actions','interface','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','html','data2','render','template\x20not\x20found','isNil','data3'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xd61b,0xbd));var _0xbd61=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xd61b[_0x39caaa];return _0x9b9c7d;};'use strict';var util=require(_0xbd61('0x0'));var _=require(_0xbd61('0x1'));var url=require('url');var Mustache=require(_0xbd61('0x2'));var Redis=require(_0xbd61('0x3'));var urlforward=require(_0xbd61('0x4'));var integration=require(_0xbd61('0x5'));var cmContact=require(_0xbd61('0x6'));var script=require(_0xbd61('0x7'));var config=require(_0xbd61('0x8'));var logger=require(_0xbd61('0x9'))(_0xbd61('0xa'));var ami=require(_0xbd61('0xb'));config[_0xbd61('0xc')]=_['defaults'](config[_0xbd61('0xc')],{'host':_0xbd61('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd61('0xc')]));var operators={'equals':function(_0x59becb,_0x21b8a9){return _0x59becb==_0x21b8a9;},'not_equals':function(_0xa9e53c,_0x52aaa1){return _0xa9e53c!=_0x52aaa1;}};var barAndWebActions=[_0xbd61('0xe'),_0xbd61('0xf'),_0xbd61('0x10')];function Trigger(_0x1a4256){this[_0xbd61('0x11')]=_0x1a4256[_0xbd61('0x11')];this[_0xbd61('0x12')]=_0x1a4256[_0xbd61('0x12')];this[_0xbd61('0x13')]=_0x1a4256[_0xbd61('0x13')];this[_0xbd61('0x14')]=_0x1a4256['templates'];this['voiceExtensions']=_0x1a4256['voiceExtensions'];this[_0xbd61('0x15')]=_0x1a4256[_0xbd61('0x15')];this['freshdeskAccounts']=_0x1a4256[_0xbd61('0x16')];this[_0xbd61('0x17')]=_0x1a4256[_0xbd61('0x17')];this['sugarcrmAccounts']=_0x1a4256[_0xbd61('0x18')];this[_0xbd61('0x19')]=_0x1a4256[_0xbd61('0x19')];this[_0xbd61('0x1a')]=_0x1a4256[_0xbd61('0x1a')];this['vtigerAccounts']=_0x1a4256['vtigerAccounts'];this[_0xbd61('0x1b')]=_0x1a4256[_0xbd61('0x1b')];this[_0xbd61('0x1c')]=_0x1a4256['dynamics365Accounts'];this[_0xbd61('0x1d')]=_0x1a4256[_0xbd61('0x1d')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xbd61('0x17')],'freshdesk':this[_0xbd61('0x16')],'sugarcrm':this[_0xbd61('0x18')],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this[_0xbd61('0x1e')],'dynamics365':this[_0xbd61('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xbd61('0x1b')]};ami['on'](_0xbd61('0x1f'),this[_0xbd61('0x20')]['bind'](this));ami['on'](_0xbd61('0x21'),this[_0xbd61('0x20')][_0xbd61('0x22')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x23'),this['syncCustomEvent'][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x24'),this[_0xbd61('0x20')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x25'),this[_0xbd61('0x20')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x26'),this[_0xbd61('0x20')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x27'),this[_0xbd61('0x20')]['bind'](this));ami['on'](_0xbd61('0x28'),this['syncCustomEvent'][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x29'),this['syncCustomEvent'][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x2a'),this['syncCustomEvent'][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x2b'),this['syncCustomEvent']['bind'](this));ami['on']('custom:dialbegin',this[_0xbd61('0x2c')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x2d'),this[_0xbd61('0x2c')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x2e'),this[_0xbd61('0x2c')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x2f'),this[_0xbd61('0x20')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x30'),this['syncCustomEvent'][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x31'),this[_0xbd61('0x20')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x32'),this[_0xbd61('0x20')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x33'),this[_0xbd61('0x20')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x34'),this['syncCustomEvent'][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x35'),this[_0xbd61('0x20')][_0xbd61('0x22')](this));ami['on'](_0xbd61('0x36'),this[_0xbd61('0x20')][_0xbd61('0x22')](this));}Trigger[_0xbd61('0x37')]['emit']=function(_0x1c4ceb,_0x416c81,_0x4c46e8){logger[_0xbd61('0x38')](_0x1c4ceb,_0x416c81,JSON[_0xbd61('0x39')](_0x4c46e8));io['to'](_0x1c4ceb)[_0xbd61('0x3a')](_0x416c81,_0x4c46e8);};Trigger[_0xbd61('0x37')][_0xbd61('0x20')]=function(_0x4f59c1){var _0x5a57c9=_['clone'](_0x4f59c1);if(typeof _0x5a57c9['motionChannel']===_0xbd61('0x3b')){_0x5a57c9[_0xbd61('0x3c')]='voice';}logger[_0xbd61('0x3d')](_0xbd61('0x20'),util[_0xbd61('0x3e')](_0x5a57c9,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x5a57c9);};Trigger['prototype'][_0xbd61('0x2c')]=function(_0x1c316f){if(this['agents'][_0x1c316f['interface']]){this[_0xbd61('0x20')](_0x1c316f);}};Trigger[_0xbd61('0x37')][_0xbd61('0x3f')]=function(_0x374737){var _0x195531;for(var _0x28cc58 in this[_0xbd61('0x11')]){if(this[_0xbd61('0x11')][_0xbd61('0x40')](_0x28cc58)){if(this[_0xbd61('0x11')][_0x28cc58]['status']){_0x195531=this[_0xbd61('0x41')](this['triggers'][_0x28cc58],_0x374737);if(_0x195531){_[_0xbd61('0x42')](_0x374737,_0x374737[_0xbd61('0x43')]);for(var _0x4f0f51=0x0,_0xc9591c,_0x59be76,_0x217235;_0x4f0f510x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x1195e7,_0x33e65c){var _0x5990e4=function(_0x3fc061){while(--_0x3fc061){_0x1195e7['push'](_0x1195e7['shift']());}};_0x5990e4(++_0x33e65c);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index a83c271..805ff1d 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 _0xc6bf=['ticketId','catch',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','message','toLowerCase','destcalleridnum','contacts','/systemusers(','body','headers','odata-entityid','lastIndexOf','enduserId','outbound','calleridnum','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','idField','substring','indexOf','ticketType','incident','incidents','assign','getString','Subjects','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','Descriptions','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','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name'];(function(_0x1ade17,_0x58809c){var _0x1f0acf=function(_0x5c25b3){while(--_0x5c25b3){_0x1ade17['push'](_0x1ade17['shift']());}};_0x1f0acf(++_0x58809c);}(_0xc6bf,0x77));var _0xfc6b=function(_0x924c29,_0x309120){_0x924c29=_0x924c29-0x0;var _0x24ddd6=_0xc6bf[_0x924c29];return _0x24ddd6;};'use strict';var _=require(_0xfc6b('0x0'));var rp=require(_0xfc6b('0x1'));var util=require(_0xfc6b('0x2'));var intUtil=require('./util');var md5=require(_0xfc6b('0x3'));var Redis=require(_0xfc6b('0x4'));var logger=require(_0xfc6b('0x5'))(_0xfc6b('0x6'));var config=require(_0xfc6b('0x7'));config[_0xfc6b('0x8')]=_['defaults'](config[_0xfc6b('0x8')],{'host':_0xfc6b('0x9'),'port':0x18eb});var io=require(_0xfc6b('0xa'))(new Redis(config[_0xfc6b('0x8')]));function getAuthToken(_0x456260,_0x4983de,_0x450654){if(_0x456260[_0xfc6b('0xb')]){_0x456260['remoteUri']=_0x456260[_0xfc6b('0xc')][_0xfc6b('0xd')];_0x456260[_0xfc6b('0xe')]=_0x456260['CloudProvider']['data2'];return Promise[_0xfc6b('0xf')](_0x456260['CloudProvider'][_0xfc6b('0x10')]);}var _0x2c61ed={'method':_0xfc6b('0x11'),'uri':_0x4983de,'form':{'client_id':_0x456260[_0xfc6b('0x12')],'resource':_0x456260[_0xfc6b('0x13')],'username':_0x456260[_0xfc6b('0x14')],'password':_0x456260[_0xfc6b('0x15')],'grant_type':_0xfc6b('0x15'),'client_secret':_0x456260[_0xfc6b('0x16')]},'json':!![]};return rp(_0x2c61ed)[_0xfc6b('0x17')](function(_0x36be02){return _0x36be02[_0xfc6b('0x18')];})['catch'](function(_0x3f6fe2){logger[_0xfc6b('0x19')]('['+[_0x450654['toUpperCase']()]+_0xfc6b('0x1a'));return _0x3f6fe2['message'];});}function getUser(_0x100e25,_0x4d8e5b,_0x249e37,_0x2d23fd,_0xab891d,_0x2150b5){return new Promise(function(_0x1c6363,_0x4ca435){return getAuthToken(_0x4d8e5b,_0x2d23fd,_0x2150b5)['then'](function(_0x1c95c3){var _0x37db58={'method':_0xfc6b('0x1b'),'uri':_0xab891d+_0xfc6b('0x1c'),'headers':{'Authorization':_0xfc6b('0x1d')+_0x1c95c3,'OData-Version':_0xfc6b('0x1e')},'json':!![]};return rp(_0x37db58);})[_0xfc6b('0x17')](function(_0xf1a131){var _0x336d4a=_0xf1a131['value'];var _0x5bc366=![];var _0x4571e5=null;if(!_[_0xfc6b('0x1f')](_0x249e37)){if(intUtil[_0xfc6b('0x20')](_0x249e37['email'])){_0x100e25['userEmail']=_0x249e37[_0xfc6b('0x21')];for(_0x4571e5=0x0;_0x4571e5<_0x336d4a[_0xfc6b('0x22')];_0x4571e5++){if(_0x336d4a[_0x4571e5][_0xfc6b('0x23')]===_0x249e37[_0xfc6b('0x21')]&&!_0x336d4a[_0x4571e5][_0xfc6b('0x24')]){_0x5bc366=!![];logger[_0xfc6b('0x25')]('['+[_0x2150b5[_0xfc6b('0x26')]()]+']\x20Agent\x20found\x20'+_0x336d4a[_0x4571e5][_0xfc6b('0x27')]+'!');_0x100e25[_0xfc6b('0x28')]=_0x336d4a[_0x4571e5][_0xfc6b('0x27')];}}}}if(!_0x5bc366){logger['info']('['+[_0x2150b5[_0xfc6b('0x26')]()]+_0xfc6b('0x29'));_0x100e25[_0xfc6b('0x2a')]=_0x4d8e5b['username'];for(_0x4571e5=0x0;_0x4571e5<_0x336d4a[_0xfc6b('0x22')];_0x4571e5++){if(_0x336d4a[_0x4571e5][_0xfc6b('0x23')]===_0x4d8e5b[_0xfc6b('0x14')]){_0x100e25[_0xfc6b('0x28')]=_0x336d4a[_0x4571e5][_0xfc6b('0x27')];}}}_0x1c6363(_0x100e25);})['catch'](function(_0x27489d){_0x4ca435(_0x27489d[_0xfc6b('0x2b')]);});});}function createEndUser(_0x232c7e,_0x24f5dd,_0x258fb2,_0xe809f3,_0x540bea,_0x4b898d,_0x2c9112){return new Promise(function(_0x1ea59f,_0x4fa4b6){return getAuthToken(_0x24f5dd,_0x258fb2,_0x4b898d)['then'](function(_0x586f9d){var _0xc275b3=_0x4b898d[_0xfc6b('0x2c')]()==='outbound'?_0x540bea[_0xfc6b('0x2d')]:_0x540bea['calleridnum'];var _0x58f49b={'method':_0xfc6b('0x11'),'uri':_0xe809f3+_0xfc6b('0x2e'),'body':{'fullname':_0xc275b3,'firstname':_0xc275b3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xfc6b('0x2f')+_0x232c7e[_0xfc6b('0x28')]+')'},'headers':{'Authorization':_0xfc6b('0x1d')+_0x586f9d,'OData-Version':_0xfc6b('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x58f49b[_0xfc6b('0x30')][_0x2c9112]=_0xc275b3;return rp(_0x58f49b);})[_0xfc6b('0x17')](function(_0xc5964b){var _0x302c51=_0xc5964b[_0xfc6b('0x31')][_0xfc6b('0x32')];var _0x2e3542=_0x302c51['substring'](_0x302c51[_0xfc6b('0x33')]('(')+0x1,_0x302c51[_0xfc6b('0x33')](')'));_0x232c7e[_0xfc6b('0x34')]=_0x2e3542;_0x1ea59f(_0x232c7e);})['catch'](function(_0x56ba32){_0x4fa4b6(_0x56ba32[_0xfc6b('0x2b')]);});});}function getEndUser(_0x99d1d2,_0x533632,_0xb81449,_0x3de632,_0x542dae,_0x1c7fe0,_0x5d2501,_0xa1c3c5){var _0x1e242d=_0x1c7fe0[_0xfc6b('0x2c')]()===_0xfc6b('0x35')?_0x542dae[_0xfc6b('0x2d')]:_0x542dae[_0xfc6b('0x36')];return getAuthToken(_0x533632,_0xb81449,_0x1c7fe0)['then'](function(_0x331c44){_0xa1c3c5=_0xa1c3c5?_0xa1c3c5:'telephone1';var _0xf6cf76={'method':_0xfc6b('0x1b'),'uri':_0x3de632+_0xfc6b('0x37')+_0xa1c3c5+_0xfc6b('0x38')+_0xa1c3c5+_0xfc6b('0x39')+_0x1e242d[_0xfc6b('0x3a')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x331c44,'If-None-Match':null,'OData-Version':_0xfc6b('0x1e')},'json':!![]};return rp(_0xf6cf76);})[_0xfc6b('0x17')](function(_0x17d452){var _0x410097=![];if(!_0x17d452)return _0x410097;var _0x3750c3=_0x17d452['value'];for(var _0x34302e=0x0;_0x34302e<_0x3750c3['length'];_0x34302e++){if(_0x3750c3[_0x34302e][_0xa1c3c5]===_0x1e242d){_0x410097=!![];_0x99d1d2['enduserId']=_0x3750c3[_0x34302e][_0xfc6b('0x3b')];}}return _0x410097;})[_0xfc6b('0x17')](function(_0x4f2a15){if(_0x4f2a15)return _0x99d1d2;if(_0x5d2501==='nothing'){logger[_0xfc6b('0x25')]('['+[_0x1c7fe0[_0xfc6b('0x26')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x99d1d2;}return createEndUser(_0x99d1d2,_0x533632,_0xb81449,_0x3de632,_0x542dae,_0x1c7fe0,_0xa1c3c5)[_0xfc6b('0x17')](function(_0x33dc37){logger[_0xfc6b('0x25')]('['+[_0x1c7fe0[_0xfc6b('0x26')]()]+_0xfc6b('0x3c'),_0x33dc37[_0xfc6b('0x34')]);return _0x33dc37;});});}function getCustomFields(_0x575713,_0xb5ab18,_0x3dd7f3){var _0x503455={};if(_0x575713[_0xfc6b('0x22')]>0x0){_[_0xfc6b('0x3d')](_0x575713,function(_0x49c687){if(_[_0xfc6b('0x3e')]([_0xfc6b('0x3f'),_0xfc6b('0x40')],_0x49c687[_0xfc6b('0x41')])&&_0x49c687['nameField']&&!_0x49c687['customField']){var _0x51dc4e=_0x49c687[_0xfc6b('0x42')][_0xfc6b('0x2c')]();var _0x4686e0=_0x51dc4e[_0xfc6b('0x43')](0x0,_0x51dc4e[_0xfc6b('0x44')]('_'));var _0x48d1c7=_0x51dc4e[_0xfc6b('0x43')](_0x51dc4e[_0xfc6b('0x44')]('_')+0x1);if(_0x4686e0===_0x3dd7f3){_0x503455[_0x48d1c7]=_0x49c687['content'];}}});}return _0x503455;}function getTicket(_0x527314,_0x2601a5,_0x453edb,_0x598fb,_0x3b2621,_0x3f0f3c,_0x393edb){return new Promise(function(_0x230ffb,_0x3f88d9){var _0x1ce7cb;return getAuthToken(_0x2601a5,_0x453edb,_0x393edb)[_0xfc6b('0x17')](function(_0x2c8e17){if(_0x3f0f3c[_0xfc6b('0x45')]===_0xfc6b('0x46')){_0x1ce7cb={'method':_0xfc6b('0x11'),'uri':_0x598fb+_0xfc6b('0x47'),'body':Object[_0xfc6b('0x48')]({},{'title':intUtil[_0xfc6b('0x49')](_0x3f0f3c[_0xfc6b('0x4a')],_0x3b2621,'\x20'),'description':intUtil[_0xfc6b('0x49')](_0x3f0f3c['Descriptions'],_0x3b2621,'\x0a'),'customerid_contact@odata.bind':_0x527314[_0xfc6b('0x34')]?_0xfc6b('0x4b')+_0x527314[_0xfc6b('0x34')]+')':undefined,'ownerid@odata.bind':_0xfc6b('0x2f')+_0x527314[_0xfc6b('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x3f0f3c[_0xfc6b('0x4c')],_0x3b2621,_0x3f0f3c[_0xfc6b('0x45')])),'headers':{'Authorization':_0xfc6b('0x1d')+_0x2c8e17,'OData-Version':_0xfc6b('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3f0f3c[_0xfc6b('0x45')]===_0xfc6b('0x4d')){var _0x1ac2e7=_0x527314[_0xfc6b('0x34')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x527314[_0xfc6b('0x28')]+')','participationtypemask':_0x527314['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xfc6b('0x4b')+_0x527314[_0xfc6b('0x34')]+')','participationtypemask':_0x527314[_0xfc6b('0x4e')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x527314['userId']+')','participationtypemask':_0x527314['callDirection']===_0xfc6b('0x4f')?0x2:0x1}];_0x1ce7cb={'method':_0xfc6b('0x11'),'uri':_0x598fb+_0xfc6b('0x50'),'body':Object[_0xfc6b('0x48')]({},{'subject':intUtil[_0xfc6b('0x49')](_0x3f0f3c['Subjects'],_0x3b2621,'\x20'),'phonenumber':String(_0x3b2621[_0xfc6b('0x36')]),'description':intUtil[_0xfc6b('0x49')](_0x3f0f3c[_0xfc6b('0x51')],_0x3b2621,'\x0a'),'regardingobjectid_contact@odata.bind':_0x527314[_0xfc6b('0x34')]?_0xfc6b('0x4b')+_0x527314['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x527314[_0xfc6b('0x28')]+')','directioncode':_0x527314[_0xfc6b('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x1ac2e7},getCustomFields(_0x3f0f3c[_0xfc6b('0x4c')],_0x3b2621,_0x3f0f3c[_0xfc6b('0x45')])),'headers':{'Authorization':_0xfc6b('0x1d')+_0x2c8e17,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1ce7cb);})['then'](function(_0x367bea){var _0x3f752f=_0x367bea[_0xfc6b('0x31')]['odata-entityid'];var _0x4a207d=_0x3f752f[_0xfc6b('0x43')](_0x3f752f[_0xfc6b('0x33')]('(')+0x1,_0x3f752f[_0xfc6b('0x33')](')'));_0x527314['ticketId']=_0x4a207d;_0x230ffb(_0x527314);})['catch'](function(_0x39de62){_0x3f88d9(_0x39de62[_0xfc6b('0x2b')]);});});}function emit(_0x23ff5b,_0x183550,_0x464f67,_0x150567){var _0xc8c5ac={'uri':util[_0xfc6b('0x52')](_0xfc6b('0x53'),_0x23ff5b,_0x464f67,_0x150567)};io['to'](util[_0xfc6b('0x52')](_0xfc6b('0x54'),_0x183550))[_0xfc6b('0x55')](_0xfc6b('0x56'),_0xc8c5ac);}exports['cs']=function(_0x36e662,_0x4abb8d,_0x1cde5e,_0x2df074,_0x5ea4cb,_0x3f227f,_0x217b72,_0x28a35a){var _0x239ca7={};_0x3f227f[_0xfc6b('0x13')]=_0x3f227f[_0xfc6b('0xb')]?intUtil[_0xfc6b('0x57')](_0x3f227f[_0xfc6b('0xc')][_0xfc6b('0xd')]):intUtil[_0xfc6b('0x57')](_0x3f227f[_0xfc6b('0x13')]);_0x3f227f[_0xfc6b('0x58')]=intUtil[_0xfc6b('0x57')](_0x3f227f[_0xfc6b('0x58')]);_0x239ca7[_0xfc6b('0x4e')]=_0x28a35a===_0xfc6b('0x4f')||_0x28a35a===_0xfc6b('0x59')?_0xfc6b('0x4f'):_0xfc6b('0x35');var _0x12e915=_0x3f227f[_0xfc6b('0xb')]?util[_0xfc6b('0x52')](_0xfc6b('0x5a'),_0x3f227f[_0xfc6b('0xc')]['data7']):util[_0xfc6b('0x52')]('%s/api/data/v9.0/',_0x3f227f['remoteUri']);var _0xee33dc=util[_0xfc6b('0x52')](_0xfc6b('0x5b'),_0x3f227f[_0xfc6b('0xe')]);var _0x4de6c7=util['format'](_0xfc6b('0x5c'),_0x3f227f[_0xfc6b('0x58')],_0x4abb8d[_0xfc6b('0x5d')],md5(_0x4abb8d[_0xfc6b('0x5d')]));if(_0x5ea4cb&&_0x5ea4cb[_0xfc6b('0x5e')]){logger[_0xfc6b('0x25')](_0xfc6b('0x5f'),_0xfc6b('0x60'));_0x4abb8d[_0xfc6b('0x61')]=_0x4de6c7;}else if(_0x217b72&&_0x217b72[_0xfc6b('0x62')]&&_0x217b72[_0xfc6b('0x62')]!==_0xfc6b('0x63')){logger['info'](_0xfc6b('0x64'),'Recording\x20is\x20enabled!');_0x4abb8d[_0xfc6b('0x61')]=_0x4de6c7;}else{_0x4abb8d[_0xfc6b('0x61')]='';}return getUser(_0x239ca7,_0x3f227f,_0x2df074,_0xee33dc,_0x12e915,_0x28a35a)[_0xfc6b('0x17')](function(_0x1a07d2){logger[_0xfc6b('0x25')]('['+_0x28a35a[_0xfc6b('0x26')]()+_0xfc6b('0x65'),_0x1a07d2[_0xfc6b('0x28')]);logger['info']('['+_0x28a35a[_0xfc6b('0x26')]()+_0xfc6b('0x66'),_0x1a07d2[_0xfc6b('0x2a')]);return getEndUser(_0x1a07d2,_0x3f227f,_0xee33dc,_0x12e915,_0x4abb8d,_0x28a35a,_0x1cde5e[_0xfc6b('0x67')],_0x1cde5e[_0xfc6b('0x68')]);})[_0xfc6b('0x17')](function(_0x11736d){logger['info']('['+_0x28a35a[_0xfc6b('0x26')]()+_0xfc6b('0x69'),_0x11736d[_0xfc6b('0x34')]);logger['info']('['+_0x28a35a[_0xfc6b('0x26')]()+_0xfc6b('0x6a'),_0x4abb8d['calleridnum']);return getTicket(_0x11736d,_0x3f227f,_0xee33dc,_0x12e915,_0x4abb8d,_0x1cde5e,_0x28a35a);})['then'](function(_0x53e7c1){logger[_0xfc6b('0x25')](util[_0xfc6b('0x52')]('['+_0x28a35a[_0xfc6b('0x26')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x1cde5e['ticketType'],_0x53e7c1['ticketId']));logger[_0xfc6b('0x25')](util['format']('['+_0x28a35a[_0xfc6b('0x26')]()+_0xfc6b('0x6b'),_0x28a35a));if(_0x28a35a!==_0xfc6b('0x59')&&_0x1cde5e[_0xfc6b('0x6c')]){logger[_0xfc6b('0x25')]('['+_0x28a35a[_0xfc6b('0x26')]()+']',_0xfc6b('0x6d'));emit(_0x3f227f[_0xfc6b('0x13')],_0x2df074[_0xfc6b('0x6e')],_0x1cde5e['ticketType'],_0x53e7c1[_0xfc6b('0x6f')]);}})[_0xfc6b('0x70')](function(_0x16404b){logger['error']('['+_0x28a35a[_0xfc6b('0x26')]()+_0xfc6b('0x71'),_0x16404b[_0xfc6b('0x2b')]);console['error'](_0xfc6b('0x72'),_0x16404b);});}; \ No newline at end of file +var _0xe93d=['lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','indexOf','ticketType','incident','incidents','assign','getString','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','Subjects','Descriptions','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','data5','clientId','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','userId','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','body','substring'];(function(_0x3d4c3f,_0x258527){var _0x54ab5f=function(_0x5e330c){while(--_0x5e330c){_0x3d4c3f['push'](_0x3d4c3f['shift']());}};_0x54ab5f(++_0x258527);}(_0xe93d,0xa5));var _0xde93=function(_0x1977b6,_0x4ff10d){_0x1977b6=_0x1977b6-0x0;var _0x5f5466=_0xe93d[_0x1977b6];return _0x5f5466;};'use strict';var _=require(_0xde93('0x0'));var rp=require(_0xde93('0x1'));var util=require(_0xde93('0x2'));var intUtil=require('./util');var md5=require(_0xde93('0x3'));var Redis=require('ioredis');var logger=require(_0xde93('0x4'))(_0xde93('0x5'));var config=require(_0xde93('0x6'));config['redis']=_['defaults'](config[_0xde93('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xde93('0x8'))(new Redis(config[_0xde93('0x7')]));function getAuthToken(_0x29b0b1,_0x2ab050,_0x4d99c9){if(_0x29b0b1[_0xde93('0x9')]){_0x29b0b1[_0xde93('0xa')]=_0x29b0b1[_0xde93('0xb')][_0xde93('0xc')];_0x29b0b1[_0xde93('0xd')]=_0x29b0b1['CloudProvider'][_0xde93('0xe')];return Promise['resolve'](_0x29b0b1['CloudProvider'][_0xde93('0xf')]);}var _0xaa63ed={'method':'POST','uri':_0x2ab050,'form':{'client_id':_0x29b0b1[_0xde93('0x10')],'resource':_0x29b0b1['remoteUri'],'username':_0x29b0b1[_0xde93('0x11')],'password':_0x29b0b1[_0xde93('0x12')],'grant_type':'password','client_secret':_0x29b0b1[_0xde93('0x13')]},'json':!![]};return rp(_0xaa63ed)[_0xde93('0x14')](function(_0x13689b){return _0x13689b[_0xde93('0x15')];})[_0xde93('0x16')](function(_0x1e8558){logger[_0xde93('0x17')]('['+[_0x4d99c9['toUpperCase']()]+_0xde93('0x18'));return _0x1e8558[_0xde93('0x19')];});}function getUser(_0xe46c57,_0x3361e3,_0x383642,_0x48cb9d,_0x1838ff,_0x589250){return new Promise(function(_0x4b8824,_0x21d1e0){return getAuthToken(_0x3361e3,_0x48cb9d,_0x589250)['then'](function(_0x1b24f4){var _0x54cf58={'method':_0xde93('0x1a'),'uri':_0x1838ff+_0xde93('0x1b'),'headers':{'Authorization':_0xde93('0x1c')+_0x1b24f4,'OData-Version':_0xde93('0x1d')},'json':!![]};return rp(_0x54cf58);})['then'](function(_0x1c5554){var _0x2f4e4f=_0x1c5554[_0xde93('0x1e')];var _0x4eb978=![];var _0x2e5609=null;if(!_[_0xde93('0x1f')](_0x383642)){if(intUtil[_0xde93('0x20')](_0x383642[_0xde93('0x21')])){_0xe46c57['userEmail']=_0x383642[_0xde93('0x21')];for(_0x2e5609=0x0;_0x2e5609<_0x2f4e4f[_0xde93('0x22')];_0x2e5609++){if(_0x2f4e4f[_0x2e5609][_0xde93('0x23')]===_0x383642['email']&&!_0x2f4e4f[_0x2e5609][_0xde93('0x24')]){_0x4eb978=!![];logger[_0xde93('0x25')]('['+[_0x589250[_0xde93('0x26')]()]+_0xde93('0x27')+_0x2f4e4f[_0x2e5609][_0xde93('0x28')]+'!');_0xe46c57['userId']=_0x2f4e4f[_0x2e5609][_0xde93('0x28')];}}}}if(!_0x4eb978){logger[_0xde93('0x25')]('['+[_0x589250[_0xde93('0x26')]()]+_0xde93('0x29'));_0xe46c57[_0xde93('0x2a')]=_0x3361e3[_0xde93('0x11')];for(_0x2e5609=0x0;_0x2e5609<_0x2f4e4f[_0xde93('0x22')];_0x2e5609++){if(_0x2f4e4f[_0x2e5609][_0xde93('0x23')]===_0x3361e3[_0xde93('0x11')]){_0xe46c57[_0xde93('0x2b')]=_0x2f4e4f[_0x2e5609][_0xde93('0x28')];}}}_0x4b8824(_0xe46c57);})[_0xde93('0x16')](function(_0x2911d3){_0x21d1e0(_0x2911d3[_0xde93('0x19')]);});});}function createEndUser(_0x4334c8,_0xade3bb,_0x5d27e9,_0x1a6e98,_0x13b45d,_0x4e0e9a,_0xbf54e4){return new Promise(function(_0x57697e,_0x3aa3cc){return getAuthToken(_0xade3bb,_0x5d27e9,_0x4e0e9a)['then'](function(_0x4003cf){var _0x2e0f6a=_0x4e0e9a[_0xde93('0x2c')]()===_0xde93('0x2d')?_0x13b45d[_0xde93('0x2e')]:_0x13b45d[_0xde93('0x2f')];var _0x4a4ef1={'method':_0xde93('0x30'),'uri':_0x1a6e98+_0xde93('0x31'),'body':{'fullname':_0x2e0f6a,'firstname':_0x2e0f6a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xde93('0x32')+_0x4334c8[_0xde93('0x2b')]+')'},'headers':{'Authorization':_0xde93('0x1c')+_0x4003cf,'OData-Version':_0xde93('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x4a4ef1[_0xde93('0x33')][_0xbf54e4]=_0x2e0f6a;return rp(_0x4a4ef1);})[_0xde93('0x14')](function(_0x1647a4){var _0x895132=_0x1647a4['headers']['odata-entityid'];var _0x56ca2b=_0x895132[_0xde93('0x34')](_0x895132[_0xde93('0x35')]('(')+0x1,_0x895132[_0xde93('0x35')](')'));_0x4334c8[_0xde93('0x36')]=_0x56ca2b;_0x57697e(_0x4334c8);})['catch'](function(_0x492f82){_0x3aa3cc(_0x492f82[_0xde93('0x19')]);});});}function getEndUser(_0x43e97d,_0x27b8ea,_0x40a07d,_0x25ab06,_0x305f9a,_0x3ae719,_0x33753b,_0x13c9b4){var _0x10b344=_0x3ae719[_0xde93('0x2c')]()===_0xde93('0x2d')?_0x305f9a[_0xde93('0x2e')]:_0x305f9a[_0xde93('0x2f')];return getAuthToken(_0x27b8ea,_0x40a07d,_0x3ae719)['then'](function(_0x20d216){_0x13c9b4=_0x13c9b4?_0x13c9b4:_0xde93('0x37');var _0xf55152={'method':_0xde93('0x1a'),'uri':_0x25ab06+_0xde93('0x38')+_0x13c9b4+_0xde93('0x39')+_0x13c9b4+_0xde93('0x3a')+_0x10b344['replace']('+','%2b')+'\x27','headers':{'Authorization':_0xde93('0x1c')+_0x20d216,'If-None-Match':null,'OData-Version':_0xde93('0x1d')},'json':!![]};return rp(_0xf55152);})[_0xde93('0x14')](function(_0x1e7ce0){var _0x952ff8=![];if(!_0x1e7ce0)return _0x952ff8;var _0x42e348=_0x1e7ce0[_0xde93('0x1e')];for(var _0x3f4a3e=0x0;_0x3f4a3e<_0x42e348[_0xde93('0x22')];_0x3f4a3e++){if(_0x42e348[_0x3f4a3e][_0x13c9b4]===_0x10b344){_0x952ff8=!![];_0x43e97d[_0xde93('0x36')]=_0x42e348[_0x3f4a3e][_0xde93('0x3b')];}}return _0x952ff8;})[_0xde93('0x14')](function(_0x515050){if(_0x515050)return _0x43e97d;if(_0x33753b===_0xde93('0x3c')){logger[_0xde93('0x25')]('['+[_0x3ae719[_0xde93('0x26')]()]+_0xde93('0x3d'));return _0x43e97d;}return createEndUser(_0x43e97d,_0x27b8ea,_0x40a07d,_0x25ab06,_0x305f9a,_0x3ae719,_0x13c9b4)['then'](function(_0x2c9fc6){logger[_0xde93('0x25')]('['+[_0x3ae719[_0xde93('0x26')]()]+_0xde93('0x3e'),_0x2c9fc6[_0xde93('0x36')]);return _0x2c9fc6;});});}function getCustomFields(_0x4bc99c,_0x245ba7,_0x19de0a){var _0x33f67d={};if(_0x4bc99c[_0xde93('0x22')]>0x0){_[_0xde93('0x3f')](_0x4bc99c,function(_0x311d4a){if(_[_0xde93('0x40')]([_0xde93('0x41'),'picklist'],_0x311d4a[_0xde93('0x42')])&&_0x311d4a[_0xde93('0x43')]&&!_0x311d4a[_0xde93('0x44')]){var _0x435299=_0x311d4a[_0xde93('0x45')][_0xde93('0x2c')]();var _0xe78577=_0x435299[_0xde93('0x34')](0x0,_0x435299[_0xde93('0x46')]('_'));var _0xaca024=_0x435299['substring'](_0x435299[_0xde93('0x46')]('_')+0x1);if(_0xe78577===_0x19de0a){_0x33f67d[_0xaca024]=_0x311d4a['content'];}}});}return _0x33f67d;}function getTicket(_0x1caca0,_0x43a073,_0x1afd11,_0x441907,_0x1d24b4,_0x1002ba,_0x391f41){return new Promise(function(_0x3ba072,_0x5bf1cf){var _0x52108c;return getAuthToken(_0x43a073,_0x1afd11,_0x391f41)[_0xde93('0x14')](function(_0x4cb63d){if(_0x1002ba[_0xde93('0x47')]===_0xde93('0x48')){_0x52108c={'method':'POST','uri':_0x441907+_0xde93('0x49'),'body':Object[_0xde93('0x4a')]({},{'title':intUtil[_0xde93('0x4b')](_0x1002ba['Subjects'],_0x1d24b4,'\x20'),'description':intUtil[_0xde93('0x4b')](_0x1002ba['Descriptions'],_0x1d24b4,'\x0a'),'customerid_contact@odata.bind':_0x1caca0[_0xde93('0x36')]?_0xde93('0x4c')+_0x1caca0[_0xde93('0x36')]+')':undefined,'ownerid@odata.bind':_0xde93('0x32')+_0x1caca0[_0xde93('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0x1002ba[_0xde93('0x4d')],_0x1d24b4,_0x1002ba[_0xde93('0x47')])),'headers':{'Authorization':'Bearer\x20'+_0x4cb63d,'OData-Version':_0xde93('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1002ba[_0xde93('0x47')]===_0xde93('0x4e')){var _0x34f7e4=_0x1caca0[_0xde93('0x36')]?[{'partyid_systemuser@odata.bind':_0xde93('0x32')+_0x1caca0[_0xde93('0x2b')]+')','participationtypemask':_0x1caca0[_0xde93('0x4f')]===_0xde93('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0xde93('0x4c')+_0x1caca0[_0xde93('0x36')]+')','participationtypemask':_0x1caca0['callDirection']===_0xde93('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1caca0[_0xde93('0x2b')]+')','participationtypemask':_0x1caca0[_0xde93('0x4f')]===_0xde93('0x50')?0x2:0x1}];_0x52108c={'method':_0xde93('0x30'),'uri':_0x441907+_0xde93('0x51'),'body':Object[_0xde93('0x4a')]({},{'subject':intUtil[_0xde93('0x4b')](_0x1002ba[_0xde93('0x52')],_0x1d24b4,'\x20'),'phonenumber':String(_0x1d24b4[_0xde93('0x2f')]),'description':intUtil[_0xde93('0x4b')](_0x1002ba[_0xde93('0x53')],_0x1d24b4,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1caca0['enduserId']?_0xde93('0x4c')+_0x1caca0[_0xde93('0x36')]+')':undefined,'ownerid@odata.bind':_0xde93('0x32')+_0x1caca0[_0xde93('0x2b')]+')','directioncode':_0x1caca0[_0xde93('0x4f')]===_0xde93('0x50')?![]:!![],'phonecall_activity_parties':_0x34f7e4},getCustomFields(_0x1002ba[_0xde93('0x4d')],_0x1d24b4,_0x1002ba['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x4cb63d,'OData-Version':_0xde93('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x52108c);})['then'](function(_0x591e80){var _0x3de8fa=_0x591e80['headers']['odata-entityid'];var _0x5457c5=_0x3de8fa[_0xde93('0x34')](_0x3de8fa['lastIndexOf']('(')+0x1,_0x3de8fa['lastIndexOf'](')'));_0x1caca0[_0xde93('0x54')]=_0x5457c5;_0x3ba072(_0x1caca0);})[_0xde93('0x16')](function(_0x42fb11){_0x5bf1cf(_0x42fb11[_0xde93('0x19')]);});});}function emit(_0x1749c3,_0xafe891,_0x5a07c4,_0x7c5084){var _0x49a613={'uri':util[_0xde93('0x55')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1749c3,_0x5a07c4,_0x7c5084)};io['to'](util[_0xde93('0x55')](_0xde93('0x56'),_0xafe891))[_0xde93('0x57')](_0xde93('0x58'),_0x49a613);}exports['cs']=function(_0x46a2e8,_0x37807f,_0x284caa,_0x2762d4,_0x4f4459,_0x34fba5,_0x585002,_0x3f3706){var _0x18c497={};_0x34fba5['remoteUri']=_0x34fba5[_0xde93('0x9')]?intUtil[_0xde93('0x59')](_0x34fba5[_0xde93('0xb')]['data7']):intUtil[_0xde93('0x59')](_0x34fba5['remoteUri']);_0x34fba5['serverUrl']=intUtil[_0xde93('0x59')](_0x34fba5[_0xde93('0x5a')]);_0x18c497[_0xde93('0x4f')]=_0x3f3706===_0xde93('0x50')||_0x3f3706===_0xde93('0x5b')?_0xde93('0x50'):'outbound';var _0xd0e43c=_0x34fba5[_0xde93('0x9')]?util[_0xde93('0x55')](_0xde93('0x5c'),_0x34fba5[_0xde93('0xb')][_0xde93('0xc')]):util[_0xde93('0x55')](_0xde93('0x5c'),_0x34fba5['remoteUri']);var _0x5dc5d4=util[_0xde93('0x55')]('https://login.microsoftonline.com/%s/oauth2/token',_0x34fba5[_0xde93('0xd')]);var _0x1f665d=util[_0xde93('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34fba5[_0xde93('0x5a')],_0x37807f[_0xde93('0x5d')],md5(_0x37807f[_0xde93('0x5d')]));if(_0x4f4459&&_0x4f4459[_0xde93('0x5e')]){logger[_0xde93('0x25')]('[QUEUE]','Recording\x20is\x20enabled!');_0x37807f[_0xde93('0x5f')]=_0x1f665d;}else if(_0x585002&&_0x585002[_0xde93('0x60')]&&_0x585002[_0xde93('0x60')]!==_0xde93('0x61')){logger[_0xde93('0x25')](_0xde93('0x62'),_0xde93('0x63'));_0x37807f[_0xde93('0x5f')]=_0x1f665d;}else{_0x37807f[_0xde93('0x5f')]='';}return getUser(_0x18c497,_0x34fba5,_0x2762d4,_0x5dc5d4,_0xd0e43c,_0x3f3706)[_0xde93('0x14')](function(_0x36fdd0){logger[_0xde93('0x25')]('['+_0x3f3706[_0xde93('0x26')]()+']\x20The\x20User\x20ID\x20is:',_0x36fdd0[_0xde93('0x2b')]);logger[_0xde93('0x25')]('['+_0x3f3706[_0xde93('0x26')]()+_0xde93('0x64'),_0x36fdd0['userEmail']);return getEndUser(_0x36fdd0,_0x34fba5,_0x5dc5d4,_0xd0e43c,_0x37807f,_0x3f3706,_0x284caa['moduleCreate'],_0x284caa[_0xde93('0x65')]);})['then'](function(_0x327ab6){logger['info']('['+_0x3f3706[_0xde93('0x26')]()+_0xde93('0x66'),_0x327ab6['enduserId']);logger[_0xde93('0x25')]('['+_0x3f3706[_0xde93('0x26')]()+_0xde93('0x67'),_0x37807f[_0xde93('0x2f')]);return getTicket(_0x327ab6,_0x34fba5,_0x5dc5d4,_0xd0e43c,_0x37807f,_0x284caa,_0x3f3706);})[_0xde93('0x14')](function(_0x20e287){logger[_0xde93('0x25')](util[_0xde93('0x55')]('['+_0x3f3706[_0xde93('0x26')]()+_0xde93('0x68'),_0x284caa['ticketType'],_0x20e287[_0xde93('0x54')]));logger[_0xde93('0x25')](util[_0xde93('0x55')]('['+_0x3f3706[_0xde93('0x26')]()+_0xde93('0x69'),_0x3f3706));if(_0x3f3706!==_0xde93('0x5b')&&_0x284caa[_0xde93('0x6a')]){logger['info']('['+_0x3f3706['toUpperCase']()+']',_0xde93('0x6b'));emit(_0x34fba5[_0xde93('0xa')],_0x2762d4[_0xde93('0x6c')],_0x284caa[_0xde93('0x47')],_0x20e287[_0xde93('0x54')]);}})[_0xde93('0x16')](function(_0x5476b6){logger[_0xde93('0x17')]('['+_0x3f3706[_0xde93('0x26')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x5476b6[_0xde93('0x19')]);console[_0xde93('0x17')]('Error\x20running\x20Dynamics365\x20integration',_0x5476b6);});}; \ 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 ad4aa49..7e99328 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 _0x34ff=['push','toString','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','The\x20Ticket\x20ID\x20is:','unmanaged','monitor_format','lastevent','error','toUpperCase','lodash','request-promise','util','./util','freshdesk','defaults','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Basic\x20%s','apiKey','debug','stringify','GET','forEach','string','picklist','nameField','customField','toLowerCase','content','includes','type','idField'];(function(_0x1ad30b,_0x34fcee){var _0x54e155=function(_0x5b3074){while(--_0x5b3074){_0x1ad30b['push'](_0x1ad30b['shift']());}};_0x54e155(++_0x34fcee);}(_0x34ff,0x1e9));var _0xf34f=function(_0x2daa75,_0x13b3ca){_0x2daa75=_0x2daa75-0x0;var _0x18fad1=_0x34ff[_0x2daa75];return _0x18fad1;};'use strict';var _=require(_0xf34f('0x0'));var rp=require(_0xf34f('0x1'));var md5=require('md5');var util=require(_0xf34f('0x2'));var Redis=require('ioredis');var intUtil=require(_0xf34f('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xf34f('0x4'));config['redis']=_[_0xf34f('0x5')](config[_0xf34f('0x6')],{'host':_0xf34f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0xf34f('0x8'),'Accept':_0xf34f('0x8')};function emit(_0xcc40a4,_0x4daefe,_0x366972){io['to'](_0xcc40a4)[_0xf34f('0x9')](_0x4daefe,_0x366972);}function getTicket(_0x17c0fc,_0x2dc0c4,_0x1f5c46,_0x1f7004,_0x34d390){logger[_0xf34f('0xa')](_0xf34f('0xb'));var _0x3b02fa=_['merge']({'responder_id':_0x2dc0c4['id'],'requester_id':_0x1f5c46['id'],'name':util[_0xf34f('0xc')](_0xf34f('0xd'),_0x34d390[_0xf34f('0xe')]),'phone':_0x34d390['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf34f('0xf')](_0x1f7004['Subjects'],_0x34d390,'\x20'),'description':intUtil[_0xf34f('0xf')](_0x1f7004[_0xf34f('0x10')],_0x34d390,_0xf34f('0x11')),'tags':getTags(_0x1f7004[_0xf34f('0x12')],_0xf34f('0x13'))},getCustomFields(_0x1f7004[_0xf34f('0x14')],_0x34d390));_0x3b02fa[_0xf34f('0x15')]=_['mapValues'](_[_0xf34f('0x16')](_0x3b02fa[_0xf34f('0x15')],'id'),_0xf34f('0x17'));return request({'uri':util['format'](_0xf34f('0x18'),_0x17c0fc[_0xf34f('0x19')]),'method':'POST','body':_0x3b02fa})[_0xf34f('0x1a')](function(_0x5502d1){logger[_0xf34f('0xa')](_0xf34f('0x1b'));return _0x5502d1;});}function getUser(_0x35ad7e,_0x5d90bc){if(intUtil['validateEmail'](_0x5d90bc)){return request({'uri':util['format'](_0xf34f('0x1c'),_0x35ad7e[_0xf34f('0x19')]),'qs':{'email':_0x5d90bc}})[_0xf34f('0x1a')](function(_0x17e1f6){if(_0x17e1f6[_0xf34f('0x1d')]){logger[_0xf34f('0xa')](_0xf34f('0x1e'));return _[_0xf34f('0x1f')](_0x17e1f6,function(_0x251353){return _0x251353[_0xf34f('0x20')][_0xf34f('0x21')]===_0x5d90bc;});}else{logger[_0xf34f('0xa')](_0xf34f('0x22'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x35ad7e[_0xf34f('0x19')])})[_0xf34f('0x1a')](function(_0x2f1d8a){logger[_0xf34f('0xa')](_0xf34f('0x23'));return _0x2f1d8a;});}});}else{logger[_0xf34f('0xa')](_0xf34f('0x24'));return request({'uri':util[_0xf34f('0xc')](_0xf34f('0x25'),_0x35ad7e[_0xf34f('0x19')])})['then'](function(_0x160a87){logger[_0xf34f('0xa')](_0xf34f('0x23'));return _0x160a87;});}}function getEndUser(_0x17e744,_0x2bf8d7,_0x265247){logger[_0xf34f('0xa')](_0xf34f('0x26'),_0x265247);return request({'uri':util[_0xf34f('0xc')](_0xf34f('0x27'),_0x17e744['remoteUri']),'qs':{'phone':_0x265247}})['then'](function(_0x576de3){if(_0x576de3[_0xf34f('0x1d')]){logger['info']('Enduser\x20found!');return _['find'](_0x576de3,{'phone':_0x265247});}else{logger['info'](_0xf34f('0x28'));return request({'uri':util[_0xf34f('0xc')](_0xf34f('0x27'),_0x17e744[_0xf34f('0x19')]),'method':_0xf34f('0x29'),'body':{'name':_0x2bf8d7,'phone':_0x265247}})[_0xf34f('0x1a')](function(_0x3faea7){logger[_0xf34f('0xa')]('Enduser\x20created.');return _0x3faea7;});}});}function getAuth(_0x1ce547){return util[_0xf34f('0xc')](_0xf34f('0x2a'),new Buffer(_0x1ce547[_0xf34f('0x2b')]+':X')['toString']('base64'));}function request(_0x457426){logger[_0xf34f('0x2c')]('[HTTP]',JSON[_0xf34f('0x2d')](_0x457426));return rp(_[_0xf34f('0x5')](_0x457426,{'method':_0xf34f('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0xec8cb8,_0x909cbe){var _0xd4df92=[];if(_0xec8cb8&&_0xec8cb8[_0xf34f('0x1d')]>0x0){_0xd4df92=_['map'](_0xec8cb8,_0x909cbe);}return _0xd4df92;}function getCustomFields(_0x536ab9,_0x4d3fbd){var _0x47c4f4=[];var _0x32047d={'custom_fields':[]};if(_0x536ab9['length']>0x0){_[_0xf34f('0x2f')](_0x536ab9,function(_0x1dc475){if(_['includes']([_0xf34f('0x30'),_0xf34f('0x31')],_0x1dc475['type'])&&_0x1dc475[_0xf34f('0x32')]&&!_0x1dc475[_0xf34f('0x33')]){_0x32047d[_0x1dc475[_0xf34f('0x32')][_0xf34f('0x34')]()]=_0x1dc475[_0xf34f('0x35')]['toString']();}else if(_[_0xf34f('0x36')]([_0xf34f('0x30'),_0xf34f('0x31')],_0x1dc475[_0xf34f('0x37')])&&_0x1dc475[_0xf34f('0x38')]&&_0x1dc475[_0xf34f('0x33')]){_0x32047d['custom_fields'][_0xf34f('0x39')]({'id':_0x1dc475[_0xf34f('0x38')],'value':_0x1dc475[_0xf34f('0x35')][_0xf34f('0x3a')]()});}else if(_0x1dc475[_0xf34f('0x37')]===_0xf34f('0x3b')&&_0x1dc475[_0xf34f('0x3c')]&&_0x1dc475['idField']&&_0x1dc475[_0xf34f('0x33')]){_0x4d3fbd[_0x1dc475[_0xf34f('0x3c')]]&&_0x32047d['custom_fields']['push']({'id':_0x1dc475[_0xf34f('0x38')],'value':_0x4d3fbd[_0x1dc475[_0xf34f('0x3c')]][_0xf34f('0x3a')]()});}else if(_0x1dc475[_0xf34f('0x37')]===_0xf34f('0x3d')&&_0x1dc475[_0xf34f('0x3e')]&&_0x1dc475['Variable'][_0xf34f('0x13')]&&_0x1dc475[_0xf34f('0x38')]&&_0x1dc475['customField']){_0x4d3fbd[_0x1dc475[_0xf34f('0x3e')][_0xf34f('0x13')]['toLowerCase']()]&&_0x32047d[_0xf34f('0x15')][_0xf34f('0x39')]({'id':_0x1dc475[_0xf34f('0x38')],'value':_0x4d3fbd[_0x1dc475[_0xf34f('0x3e')][_0xf34f('0x13')]['toLowerCase']()][_0xf34f('0x3a')]()});}});}return _0x32047d;}exports[_0xf34f('0x3f')]=function(_0x2091f9,_0x3b7683,_0x40d0f1,_0x2bca06,_0x45d0d1,_0x3e179c){var _0x1503d3,_0x508a71;_0x3e179c[_0xf34f('0x19')]=intUtil[_0xf34f('0x40')](_0x3e179c[_0xf34f('0x19')]);_0x3e179c[_0xf34f('0x41')]=intUtil[_0xf34f('0x40')](_0x3e179c['serverUrl']);if(_0x45d0d1&&_0x45d0d1['monitor_format']){logger[_0xf34f('0xa')](_0xf34f('0x42'),_0xf34f('0x43'));_0x3b7683[_0xf34f('0x44')]=util[_0xf34f('0xc')](_0xf34f('0x45'),_0x3e179c[_0xf34f('0x41')],_0x3b7683[_0xf34f('0x46')],md5(_0x3b7683[_0xf34f('0x46')]));}else{_0x3b7683[_0xf34f('0x44')]='';}headers['Authorization']=getAuth(_0x3e179c);return getUser(_0x3e179c,_0x2bca06[_0xf34f('0x21')])[_0xf34f('0x1a')](function(_0x14ba12){_0x1503d3=_0x14ba12;logger[_0xf34f('0xa')](_0xf34f('0x47'),_0x1503d3['id']);return getEndUser(_0x3e179c,_0x3b7683['calleridname'],_0x3b7683[_0xf34f('0x48')]);})[_0xf34f('0x1a')](function(_0x11b2d3){_0x508a71=_0x11b2d3;logger[_0xf34f('0xa')](_0xf34f('0x49'),_0x508a71['id']);return getTicket(_0x3e179c,_0x1503d3,_0x508a71,_0x40d0f1,_0x3b7683);})[_0xf34f('0x1a')](function(_0x18a21d){if(_0x18a21d&&_0x18a21d['id']){logger[_0xf34f('0xa')](_0xf34f('0x1b'));logger[_0xf34f('0xa')]('The\x20Ticket\x20ID\x20is:',_0x18a21d['id']);logger[_0xf34f('0xa')](_0xf34f('0x42'),_0xf34f('0x4a'));emit(util[_0xf34f('0xc')](_0xf34f('0x4b'),_0x2bca06[_0xf34f('0x13')]),_0xf34f('0x4c'),{'uri':util[_0xf34f('0xc')](_0xf34f('0x4d'),_0x3e179c[_0xf34f('0x19')],_0x18a21d['id'])});}})[_0xf34f('0x4e')](function(_0x8f43a6){logger['error'](_0xf34f('0x42'),JSON[_0xf34f('0x2d')](_0x8f43a6));});};exports[_0xf34f('0x4f')]=function(_0x437162,_0x206e9e,_0x3ed716,_0x4d22c3,_0x54744c,_0x5e81f0,_0x80efbd){var _0x4538b0,_0x3072a6;_0x5e81f0[_0xf34f('0x19')]=intUtil[_0xf34f('0x40')](_0x5e81f0[_0xf34f('0x19')]);_0x5e81f0['serverUrl']=intUtil[_0xf34f('0x40')](_0x5e81f0[_0xf34f('0x41')]);if(_0x80efbd&&_0x80efbd[_0xf34f('0x50')]&&_0x80efbd['recordingFormat']!==_0xf34f('0x51')){logger['info'](_0xf34f('0x52'),_0xf34f('0x43'));_0x206e9e[_0xf34f('0x44')]=util[_0xf34f('0xc')](_0xf34f('0x45'),_0x5e81f0[_0xf34f('0x41')],_0x206e9e[_0xf34f('0x46')],md5(_0x206e9e[_0xf34f('0x46')]));}headers[_0xf34f('0x53')]=getAuth(_0x5e81f0);return getUser(_0x5e81f0,_0x4d22c3[_0xf34f('0x21')])[_0xf34f('0x1a')](function(_0x4eebf3){_0x4538b0=_0x4eebf3;logger[_0xf34f('0xa')](_0xf34f('0x47'),_0x4538b0['id']);return getEndUser(_0x5e81f0,_0x206e9e[_0xf34f('0x54')],_0x206e9e['destcalleridnum']);})[_0xf34f('0x1a')](function(_0x55c5fd){_0x3072a6=_0x55c5fd;logger[_0xf34f('0xa')](_0xf34f('0x49'),_0x3072a6['id']);return getTicket(_0x5e81f0,_0x4538b0,_0x3072a6,_0x3ed716,_0x206e9e);})[_0xf34f('0x1a')](function(_0x3871db){if(_0x3871db&&_0x3871db['id']){logger[_0xf34f('0xa')](_0xf34f('0x1b'));logger[_0xf34f('0xa')](_0xf34f('0x55'),_0x3871db['id']);logger[_0xf34f('0xa')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf34f('0xc')](_0xf34f('0x4b'),_0x4d22c3['name']),'trigger:browser:url',{'uri':util[_0xf34f('0xc')](_0xf34f('0x4d'),_0x5e81f0[_0xf34f('0x19')],_0x3871db['id'])});}})['catch'](function(_0x1762f1){logger['error'](_0xf34f('0x52'),JSON[_0xf34f('0x2d')](_0x1762f1));});};exports[_0xf34f('0x56')]=function(_0x150e11,_0x2781b9,_0x35381e,_0x3a6872,_0x4aebbd,_0xea6de){var _0x49478f,_0x2cb124;_0xea6de['remoteUri']=intUtil['stripTrailingSlash'](_0xea6de[_0xf34f('0x19')]);_0xea6de[_0xf34f('0x41')]=intUtil[_0xf34f('0x40')](_0xea6de[_0xf34f('0x41')]);if(_0x4aebbd&&_0x4aebbd[_0xf34f('0x57')]){logger[_0xf34f('0xa')]('['+_0x2781b9[_0xf34f('0x58')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x2781b9[_0xf34f('0x44')]=util[_0xf34f('0xc')](_0xf34f('0x45'),_0xea6de[_0xf34f('0x41')],_0x2781b9[_0xf34f('0x46')],md5(_0x2781b9['uniqueid']));}else{_0x2781b9[_0xf34f('0x44')]='';}headers[_0xf34f('0x53')]=getAuth(_0xea6de);return getUser(_0xea6de,'')['then'](function(_0xbd6f1c){_0x49478f=_0xbd6f1c;logger[_0xf34f('0xa')](_0xf34f('0x47'),_0x49478f['id']);return getEndUser(_0xea6de,_0x2781b9[_0xf34f('0xe')],_0x2781b9['calleridnum']);})[_0xf34f('0x1a')](function(_0x487ad0){_0x2cb124=_0x487ad0;logger[_0xf34f('0xa')](_0xf34f('0x49'),_0x2cb124['id']);return getTicket(_0xea6de,_0x49478f,_0x2cb124,_0x35381e,_0x2781b9);})[_0xf34f('0x1a')](function(_0x166bb4){if(_0x166bb4){logger[_0xf34f('0xa')](_0xf34f('0x1b'));logger[_0xf34f('0xa')](_0xf34f('0x55'),_0x166bb4['id']);}})[_0xf34f('0x4e')](function(_0xcfd711){logger[_0xf34f('0x59')]('['+_0x2781b9[_0xf34f('0x58')][_0xf34f('0x5a')]()+']',JSON['stringify'](_0xcfd711));});}; \ No newline at end of file +var _0xf527=['custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','toString','base64','[HTTP]','stringify','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','variable','variableName','push','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','user:%s','toUpperCase','lastevent','lodash','md5','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','
','Tags','name','Fields'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0xf527,0x9b));var _0x7f52=function(_0x52e9e3,_0xe465a7){_0x52e9e3=_0x52e9e3-0x0;var _0x960a8d=_0xf527[_0x52e9e3];return _0x960a8d;};'use strict';var _=require(_0x7f52('0x0'));var rp=require('request-promise');var md5=require(_0x7f52('0x1'));var util=require('util');var Redis=require(_0x7f52('0x2'));var intUtil=require(_0x7f52('0x3'));var config=require('../../../../config/environment');var logger=require(_0x7f52('0x4'))(_0x7f52('0x5'));config[_0x7f52('0x6')]=_[_0x7f52('0x7')](config['redis'],{'host':_0x7f52('0x8'),'port':0x18eb});var io=require(_0x7f52('0x9'))(new Redis(config[_0x7f52('0x6')]));var headers={'Content-Type':_0x7f52('0xa'),'Accept':_0x7f52('0xa')};function emit(_0x1f62c3,_0x37b3eb,_0x36b72f){io['to'](_0x1f62c3)[_0x7f52('0xb')](_0x37b3eb,_0x36b72f);}function getTicket(_0x1f203f,_0x4a3a46,_0x374172,_0x320783,_0x7d2896){logger[_0x7f52('0xc')](_0x7f52('0xd'));var _0x264bd2=_['merge']({'responder_id':_0x4a3a46['id'],'requester_id':_0x374172['id'],'name':util[_0x7f52('0xe')](_0x7f52('0xf'),_0x7d2896['calleridname']),'phone':_0x7d2896[_0x7f52('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7f52('0x11')](_0x320783[_0x7f52('0x12')],_0x7d2896,'\x20'),'description':intUtil[_0x7f52('0x11')](_0x320783['Descriptions'],_0x7d2896,_0x7f52('0x13')),'tags':getTags(_0x320783[_0x7f52('0x14')],_0x7f52('0x15'))},getCustomFields(_0x320783[_0x7f52('0x16')],_0x7d2896));_0x264bd2[_0x7f52('0x17')]=_[_0x7f52('0x18')](_[_0x7f52('0x19')](_0x264bd2['custom_fields'],'id'),'value');return request({'uri':util[_0x7f52('0xe')](_0x7f52('0x1a'),_0x1f203f[_0x7f52('0x1b')]),'method':'POST','body':_0x264bd2})['then'](function(_0x480a20){logger[_0x7f52('0xc')](_0x7f52('0x1c'));return _0x480a20;});}function getUser(_0x3349f1,_0x550b72){if(intUtil[_0x7f52('0x1d')](_0x550b72)){return request({'uri':util[_0x7f52('0xe')](_0x7f52('0x1e'),_0x3349f1[_0x7f52('0x1b')]),'qs':{'email':_0x550b72}})[_0x7f52('0x1f')](function(_0x3f5521){if(_0x3f5521[_0x7f52('0x20')]){logger[_0x7f52('0xc')](_0x7f52('0x21'));return _[_0x7f52('0x22')](_0x3f5521,function(_0x2d248a){return _0x2d248a[_0x7f52('0x23')][_0x7f52('0x24')]===_0x550b72;});}else{logger['info'](_0x7f52('0x25'));return request({'uri':util[_0x7f52('0xe')]('%s/api/v2/agents/me',_0x3349f1[_0x7f52('0x1b')])})[_0x7f52('0x1f')](function(_0x3950d8){logger['info'](_0x7f52('0x26'));return _0x3950d8;});}});}else{logger[_0x7f52('0xc')](_0x7f52('0x27'));return request({'uri':util[_0x7f52('0xe')]('%s/api/v2/agents/me',_0x3349f1[_0x7f52('0x1b')])})[_0x7f52('0x1f')](function(_0x2892b3){logger[_0x7f52('0xc')](_0x7f52('0x26'));return _0x2892b3;});}}function getEndUser(_0x2c2dbd,_0x474f1a,_0x340952){logger[_0x7f52('0xc')](_0x7f52('0x28'),_0x340952);return request({'uri':util[_0x7f52('0xe')]('%s/api/v2/contacts',_0x2c2dbd[_0x7f52('0x1b')]),'qs':{'phone':_0x340952}})[_0x7f52('0x1f')](function(_0x26553a){if(_0x26553a[_0x7f52('0x20')]){logger[_0x7f52('0xc')](_0x7f52('0x29'));return _[_0x7f52('0x22')](_0x26553a,{'phone':_0x340952});}else{logger[_0x7f52('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7f52('0xe')](_0x7f52('0x2a'),_0x2c2dbd['remoteUri']),'method':'POST','body':{'name':_0x474f1a,'phone':_0x340952}})[_0x7f52('0x1f')](function(_0x8bce5d){logger['info'](_0x7f52('0x2b'));return _0x8bce5d;});}});}function getAuth(_0x5c6f74){return util[_0x7f52('0xe')](_0x7f52('0x2c'),new Buffer(_0x5c6f74['apiKey']+':X')[_0x7f52('0x2d')](_0x7f52('0x2e')));}function request(_0x42bb6c){logger['debug'](_0x7f52('0x2f'),JSON[_0x7f52('0x30')](_0x42bb6c));return rp(_[_0x7f52('0x7')](_0x42bb6c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1a403a,_0x490d8a){var _0x92ba53=[];if(_0x1a403a&&_0x1a403a[_0x7f52('0x20')]>0x0){_0x92ba53=_['map'](_0x1a403a,_0x490d8a);}return _0x92ba53;}function getCustomFields(_0x6d883f,_0x43ff5a){var _0x3da9fa=[];var _0x2196e6={'custom_fields':[]};if(_0x6d883f[_0x7f52('0x20')]>0x0){_['forEach'](_0x6d883f,function(_0x36fb29){if(_[_0x7f52('0x31')]([_0x7f52('0x32'),_0x7f52('0x33')],_0x36fb29[_0x7f52('0x34')])&&_0x36fb29[_0x7f52('0x35')]&&!_0x36fb29['customField']){_0x2196e6[_0x36fb29[_0x7f52('0x35')][_0x7f52('0x36')]()]=_0x36fb29[_0x7f52('0x37')][_0x7f52('0x2d')]();}else if(_[_0x7f52('0x31')]([_0x7f52('0x32'),'picklist'],_0x36fb29[_0x7f52('0x34')])&&_0x36fb29[_0x7f52('0x38')]&&_0x36fb29[_0x7f52('0x39')]){_0x2196e6[_0x7f52('0x17')]['push']({'id':_0x36fb29['idField'],'value':_0x36fb29[_0x7f52('0x37')]['toString']()});}else if(_0x36fb29[_0x7f52('0x34')]===_0x7f52('0x3a')&&_0x36fb29[_0x7f52('0x3b')]&&_0x36fb29[_0x7f52('0x38')]&&_0x36fb29['customField']){_0x43ff5a[_0x36fb29['variableName']]&&_0x2196e6[_0x7f52('0x17')][_0x7f52('0x3c')]({'id':_0x36fb29['idField'],'value':_0x43ff5a[_0x36fb29['variableName']][_0x7f52('0x2d')]()});}else if(_0x36fb29[_0x7f52('0x34')]==='customVariable'&&_0x36fb29[_0x7f52('0x3d')]&&_0x36fb29[_0x7f52('0x3d')][_0x7f52('0x15')]&&_0x36fb29[_0x7f52('0x38')]&&_0x36fb29[_0x7f52('0x39')]){_0x43ff5a[_0x36fb29[_0x7f52('0x3d')][_0x7f52('0x15')][_0x7f52('0x36')]()]&&_0x2196e6[_0x7f52('0x17')][_0x7f52('0x3c')]({'id':_0x36fb29['idField'],'value':_0x43ff5a[_0x36fb29[_0x7f52('0x3d')][_0x7f52('0x15')]['toLowerCase']()]['toString']()});}});}return _0x2196e6;}exports[_0x7f52('0x3e')]=function(_0x25bc69,_0x343325,_0x4f8541,_0x348610,_0x5eb762,_0x1b59d0){var _0x579a7c,_0x550788;_0x1b59d0[_0x7f52('0x1b')]=intUtil[_0x7f52('0x3f')](_0x1b59d0[_0x7f52('0x1b')]);_0x1b59d0[_0x7f52('0x40')]=intUtil[_0x7f52('0x3f')](_0x1b59d0[_0x7f52('0x40')]);if(_0x5eb762&&_0x5eb762[_0x7f52('0x41')]){logger[_0x7f52('0xc')](_0x7f52('0x42'),_0x7f52('0x43'));_0x343325[_0x7f52('0x44')]=util[_0x7f52('0xe')](_0x7f52('0x45'),_0x1b59d0['serverUrl'],_0x343325[_0x7f52('0x46')],md5(_0x343325[_0x7f52('0x46')]));}else{_0x343325['recordingURL']='';}headers[_0x7f52('0x47')]=getAuth(_0x1b59d0);return getUser(_0x1b59d0,_0x348610[_0x7f52('0x24')])[_0x7f52('0x1f')](function(_0x53af0a){_0x579a7c=_0x53af0a;logger[_0x7f52('0xc')](_0x7f52('0x48'),_0x579a7c['id']);return getEndUser(_0x1b59d0,_0x343325[_0x7f52('0x49')],_0x343325[_0x7f52('0x10')]);})[_0x7f52('0x1f')](function(_0xa1b9bd){_0x550788=_0xa1b9bd;logger['info'](_0x7f52('0x4a'),_0x550788['id']);return getTicket(_0x1b59d0,_0x579a7c,_0x550788,_0x4f8541,_0x343325);})['then'](function(_0x5afaad){if(_0x5afaad&&_0x5afaad['id']){logger[_0x7f52('0xc')](_0x7f52('0x1c'));logger[_0x7f52('0xc')](_0x7f52('0x4b'),_0x5afaad['id']);logger[_0x7f52('0xc')](_0x7f52('0x42'),_0x7f52('0x4c'));emit(util[_0x7f52('0xe')]('user:%s',_0x348610['name']),_0x7f52('0x4d'),{'uri':util[_0x7f52('0xe')](_0x7f52('0x4e'),_0x1b59d0['remoteUri'],_0x5afaad['id'])});}})[_0x7f52('0x4f')](function(_0x5ee835){logger[_0x7f52('0x50')](_0x7f52('0x42'),JSON[_0x7f52('0x30')](_0x5ee835));});};exports[_0x7f52('0x51')]=function(_0x95ad76,_0x39dc76,_0x1eb784,_0x5068dc,_0x11bdd2,_0x3c6593,_0x25105d){var _0x4b6d04,_0x19c741;_0x3c6593[_0x7f52('0x1b')]=intUtil['stripTrailingSlash'](_0x3c6593[_0x7f52('0x1b')]);_0x3c6593[_0x7f52('0x40')]=intUtil[_0x7f52('0x3f')](_0x3c6593['serverUrl']);if(_0x25105d&&_0x25105d['recordingFormat']&&_0x25105d[_0x7f52('0x52')]!==_0x7f52('0x53')){logger[_0x7f52('0xc')](_0x7f52('0x54'),'Recording\x20is\x20enabled!');_0x39dc76[_0x7f52('0x44')]=util[_0x7f52('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c6593[_0x7f52('0x40')],_0x39dc76['uniqueid'],md5(_0x39dc76['uniqueid']));}headers[_0x7f52('0x47')]=getAuth(_0x3c6593);return getUser(_0x3c6593,_0x5068dc[_0x7f52('0x24')])['then'](function(_0x582f99){_0x4b6d04=_0x582f99;logger[_0x7f52('0xc')](_0x7f52('0x48'),_0x4b6d04['id']);return getEndUser(_0x3c6593,_0x39dc76[_0x7f52('0x55')],_0x39dc76['destcalleridnum']);})[_0x7f52('0x1f')](function(_0x2f13ef){_0x19c741=_0x2f13ef;logger[_0x7f52('0xc')](_0x7f52('0x4a'),_0x19c741['id']);return getTicket(_0x3c6593,_0x4b6d04,_0x19c741,_0x1eb784,_0x39dc76);})['then'](function(_0x2a0014){if(_0x2a0014&&_0x2a0014['id']){logger['info'](_0x7f52('0x1c'));logger['info'](_0x7f52('0x4b'),_0x2a0014['id']);logger['info']('[OUTBOUND]',_0x7f52('0x4c'));emit(util[_0x7f52('0xe')](_0x7f52('0x56'),_0x5068dc[_0x7f52('0x15')]),_0x7f52('0x4d'),{'uri':util[_0x7f52('0xe')](_0x7f52('0x4e'),_0x3c6593[_0x7f52('0x1b')],_0x2a0014['id'])});}})[_0x7f52('0x4f')](function(_0x44562f){logger[_0x7f52('0x50')](_0x7f52('0x54'),JSON[_0x7f52('0x30')](_0x44562f));});};exports['unmanaged']=function(_0x5f17c2,_0x39e9e7,_0x22f274,_0x5664ed,_0xeaf317,_0x246419){var _0xac860c,_0x27ba26;_0x246419[_0x7f52('0x1b')]=intUtil[_0x7f52('0x3f')](_0x246419[_0x7f52('0x1b')]);_0x246419[_0x7f52('0x40')]=intUtil['stripTrailingSlash'](_0x246419[_0x7f52('0x40')]);if(_0xeaf317&&_0xeaf317[_0x7f52('0x41')]){logger['info']('['+_0x39e9e7['lastevent'][_0x7f52('0x57')]()+']',_0x7f52('0x43'));_0x39e9e7['recordingURL']=util['format'](_0x7f52('0x45'),_0x246419['serverUrl'],_0x39e9e7['uniqueid'],md5(_0x39e9e7['uniqueid']));}else{_0x39e9e7[_0x7f52('0x44')]='';}headers[_0x7f52('0x47')]=getAuth(_0x246419);return getUser(_0x246419,'')['then'](function(_0x3226df){_0xac860c=_0x3226df;logger[_0x7f52('0xc')](_0x7f52('0x48'),_0xac860c['id']);return getEndUser(_0x246419,_0x39e9e7['calleridname'],_0x39e9e7[_0x7f52('0x10')]);})[_0x7f52('0x1f')](function(_0x511e90){_0x27ba26=_0x511e90;logger[_0x7f52('0xc')](_0x7f52('0x4a'),_0x27ba26['id']);return getTicket(_0x246419,_0xac860c,_0x27ba26,_0x22f274,_0x39e9e7);})[_0x7f52('0x1f')](function(_0x1415cc){if(_0x1415cc){logger[_0x7f52('0xc')]('Ticket\x20created!');logger[_0x7f52('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1415cc['id']);}})[_0x7f52('0x4f')](function(_0x116fb9){logger[_0x7f52('0x50')]('['+_0x39e9e7[_0x7f52('0x58')][_0x7f52('0x57')]()+']',JSON[_0x7f52('0x30')](_0x116fb9));});}; \ 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 cffba32..06f4709 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 _0x53ec=['getString','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','username','outbound','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','message','headers','info','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','Admin\x20selected','toUpperCase','/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','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','error'];(function(_0x338338,_0x782573){var _0x3cf852=function(_0x3016d8){while(--_0x3016d8){_0x338338['push'](_0x338338['shift']());}};_0x3cf852(++_0x782573);}(_0x53ec,0x114));var _0xc53e=function(_0x4f345d,_0x22f2ea){_0x4f345d=_0x4f345d-0x0;var _0x4e75d5=_0x53ec[_0x4f345d];return _0x4e75d5;};'use strict';var _=require(_0xc53e('0x0'));var rp=require(_0xc53e('0x1'));var md5=require(_0xc53e('0x2'));var util=require(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var Promise=require(_0xc53e('0x5'));var Redis=require(_0xc53e('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xc53e('0x7'))('freshsales');config['redis']=_['defaults'](config[_0xc53e('0x8')],{'host':_0xc53e('0x9'),'port':0x18eb});var io=require(_0xc53e('0xa'))(new Redis(config['redis']));function getAdminId(_0x41e48d,_0x3d6478,_0x4ca215,_0x2f8cce){return new Promise(function(_0x52789c,_0x1a5c46){var _0x54ccf7=![];var _0x5f301d={'method':_0xc53e('0xb'),'uri':_0x2f8cce+_0xc53e('0xc'),'json':!![]};_0x5f301d['headers']=_0x4ca215;logger['info'](_0xc53e('0xd'));return rp(_0x5f301d)[_0xc53e('0xe')](function(_0xc2f096){if(_0xc2f096){var _0x4481a9=_0xc2f096[_0xc53e('0xf')];var _0x20cc21=null;for(_0x20cc21=0x0;_0x20cc21<_0x4481a9[_0xc53e('0x10')];_0x20cc21++){if(_0x4481a9[_0x20cc21][_0xc53e('0x11')]===_0x41e48d[_0xc53e('0x12')]){_0x41e48d[_0xc53e('0x13')]=_0x4481a9[_0x20cc21]['id'];_0x54ccf7=!![];}}if(_0x54ccf7){logger['info'](_0xc53e('0x14'),_0x41e48d[_0xc53e('0x13')]);_0x52789c(_0x41e48d);}else{_0x1a5c46({'statusCode':0x194,'message':_0xc53e('0x15')});}}else{_0x1a5c46({'statusCode':0x194,'message':_0xc53e('0x15')});}})[_0xc53e('0x16')](function(_0x4ad757){logger['error']('['+[_0x3d6478['toUpperCase']()]+']',_0x4ad757[_0xc53e('0x17')]);_0x1a5c46(_0x4ad757);});});}function getUser(_0x34f0de,_0x2df579,_0x14831b){return function(_0x3bc033){return new Promise(function(_0x2a82c4,_0x5b68d5){var _0x15797a={'method':_0xc53e('0xb'),'uri':_0x14831b+_0xc53e('0xc'),'json':!![]};_0x15797a[_0xc53e('0x18')]=_0x2df579;logger[_0xc53e('0x19')](_0xc53e('0x1a'));return rp(_0x15797a)['then'](function(_0x24b93b){if(_0x24b93b){var _0x269825=_0x24b93b[_0xc53e('0xf')];var _0x29a7a6=![];var _0x13dac1=null;if(_0x3bc033['agentEmail']!==null){logger[_0xc53e('0x19')](_0xc53e('0x1b'),_0x3bc033[_0xc53e('0x1c')]);_0x3bc033[_0xc53e('0x1d')]=_0x3bc033['agentEmail'];for(_0x13dac1=0x0;_0x13dac1<_0x269825['length'];_0x13dac1++){if(_0x269825[_0x13dac1][_0xc53e('0x11')]===_0x3bc033[_0xc53e('0x1c')]){_0x29a7a6=!![];_0x3bc033[_0xc53e('0x1e')]=_0x269825[_0x13dac1]['id'];logger[_0xc53e('0x19')]('User\x20found:',_0x3bc033[_0xc53e('0x1e')]);}}}if(!_0x29a7a6){logger[_0xc53e('0x19')](_0xc53e('0x1f'));_0x3bc033[_0xc53e('0x1d')]=_0x3bc033['adminEmail'];_0x3bc033[_0xc53e('0x1e')]=_0x3bc033[_0xc53e('0x13')];_0x29a7a6=!![];}if(_0x29a7a6){_0x2a82c4(_0x3bc033);}else{_0x5b68d5({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5b68d5({'statusCode':0x194,'message':_0xc53e('0x15')});}})[_0xc53e('0x16')](function(_0x28ca1b){logger['error']('['+[_0x34f0de[_0xc53e('0x20')]()]+']',_0x28ca1b['message']);_0x5b68d5(_0x28ca1b);});});};}function searchContact(_0x8f5f20,_0x5e3dff,_0x32ab96,_0x419e5d){return new Promise(function(_0x1fac42,_0x580ad1){var _0x320b46={'method':'GET','headers':_0x5e3dff,'uri':_0x8f5f20+_0xc53e('0x21')+_0x419e5d+_0xc53e('0x22')+_0x32ab96+_0xc53e('0x23'),'json':!![]};rp(_0x320b46)[_0xc53e('0xe')](function(_0x12acec){var _0x59ae9e=_[_0xc53e('0x24')](_0x12acec[_0xc53e('0x25')][_0xc53e('0x25')],[_0x32ab96,_0x419e5d]);_0x1fac42(_0x59ae9e);})[_0xc53e('0x16')](function(_0x45d631){_0x580ad1(_0x45d631);});});}function getEndUser(_0x2a9d44,_0x125e08,_0x557d20){return function(_0x30967b){return new Promise(function(_0x5b3c84,_0x49226c){logger[_0xc53e('0x19')](util[_0xc53e('0x26')](_0xc53e('0x27'),_0x30967b['contactNumber']));searchContact(_0x557d20,_0x125e08,_0xc53e('0x28'),_0x30967b[_0xc53e('0x29')])['then'](function(_0x4d1483){if(_0x4d1483){_0x30967b['endUserId']=_0x4d1483['id'];logger['info'](_0xc53e('0x2a'),_0x30967b[_0xc53e('0x2b')]);return _0x5b3c84(_0x30967b);}searchContact(_0x557d20,_0x125e08,_0xc53e('0x2c'),_0x30967b[_0xc53e('0x29')])[_0xc53e('0xe')](function(_0x5c25ff){if(_0x5c25ff){_0x30967b[_0xc53e('0x2b')]=_0x5c25ff['id'];logger['info'](_0xc53e('0x2d'),_0x30967b['endUserId']);return _0x5b3c84(_0x30967b);}createEndUser(_0x30967b,_0x2a9d44,_0x125e08,_0x557d20)[_0xc53e('0xe')](function(_0x356a5d){logger[_0xc53e('0x19')](_0xc53e('0x2e'),_0x356a5d[_0xc53e('0x2b')]);return _0x5b3c84(_0x356a5d);});});})['catch'](function(_0x5f55e2){_0x49226c(_0x5f55e2);});});};}function createEndUser(_0x57e8a3,_0x4668b3,_0x386591,_0x2e7969){return new Promise(function(_0x5f3155,_0x46c17b){var _0x54a9c9=moment();var _0x302e6a={'method':_0xc53e('0x2f'),'uri':_0x2e7969+_0xc53e('0x30'),'body':{'contact':{'last_name':_0x57e8a3['contactNumber'],'work_number':_0x57e8a3['contactNumber'],'mobile_number':_0x57e8a3[_0xc53e('0x29')],'owner_id':_0x57e8a3['userId'],'created_at':_0x54a9c9['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x302e6a[_0xc53e('0x18')]=_0x386591;logger[_0xc53e('0x19')](_0xc53e('0x31'));return rp(_0x302e6a)['then'](function(_0x1ada4a){_0x57e8a3[_0xc53e('0x2b')]=_0x1ada4a[_0xc53e('0x32')]['id'];_0x5f3155(_0x57e8a3);})[_0xc53e('0x16')](function(_0x1d018b){logger[_0xc53e('0x33')]('['+[_0x4668b3[_0xc53e('0x20')]()]+']',_0x1d018b[_0xc53e('0x17')]);_0x46c17b(_0x1d018b[_0xc53e('0x17')]);});});}function getTicket(_0x143493,_0x464894,_0x513518,_0x153a65,_0x4f4466){return function(_0x42d13f){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x529c82,_0x1d5943){var _0x190649=moment();var _0x129f56={'method':_0xc53e('0x2f'),'uri':_0x513518+'/api/tasks','body':{'title':intUtil[_0xc53e('0x34')](_0x153a65['Subjects'],_0x4f4466,'\x20'),'description':intUtil['getString'](_0x153a65['Descriptions'],_0x4f4466,'\x0a'),'owner_id':_0x42d13f[_0xc53e('0x1e')],'creater_id':_0x42d13f[_0xc53e('0x13')],'targetable_id':_0x42d13f[_0xc53e('0x2b')],'targetable_type':'Contact','created_at':_0x190649[_0xc53e('0x26')](_0xc53e('0x35')),'due_date':_0x190649[_0xc53e('0x36')](0x1e,'m')['format'](_0xc53e('0x35'))},'json':!![]};_0x129f56[_0xc53e('0x18')]=_0x464894;return rp(_0x129f56)[_0xc53e('0xe')](function(_0xbad3db){_0x42d13f[_0xc53e('0x37')]=_0xbad3db['task']['id'];logger[_0xc53e('0x19')](_0xc53e('0x38'),_0x42d13f[_0xc53e('0x37')]);_0x529c82(_0x42d13f);})['catch'](function(_0x1e58a8){logger[_0xc53e('0x33')]('['+[_0x143493['toUpperCase']()]+']',_0x1e58a8[_0xc53e('0x17')]);_0x1d5943(_0x1e58a8[_0xc53e('0x17')]);});});};}function emit(_0x59813,_0x5d5c3e,_0x435660){var _0x390b96={'uri':_0x59813+_0xc53e('0x39')+_0x435660};io['to'](util[_0xc53e('0x26')](_0xc53e('0x3a'),_0x5d5c3e))[_0xc53e('0x3b')](_0xc53e('0x3c'),_0x390b96);}exports['cs']=function(_0x311e7d,_0x208d18,_0x195e11,_0x24b155,_0x44ead,_0xa469d6,_0x53178d,_0x5207c0){var _0x4f6123={};var _0x1b953e={'Authorization':_0xc53e('0x3d')+_0xa469d6['apiKey']};_0xa469d6['remoteUri']=intUtil[_0xc53e('0x3e')](_0xa469d6[_0xc53e('0x3f')]);_0xa469d6[_0xc53e('0x40')]=intUtil['stripTrailingSlash'](_0xa469d6[_0xc53e('0x40')]);var _0x4c778e=_0xa469d6[_0xc53e('0x3f')];_0x4f6123[_0xc53e('0x12')]=_0xa469d6[_0xc53e('0x41')];_0x4f6123[_0xc53e('0x29')]=_0x5207c0['toLowerCase']()===_0xc53e('0x42')?_0x208d18['destcalleridnum']:_0x208d18[_0xc53e('0x43')];_0x4f6123['callDirection']=_0x5207c0==='queue'||_0x5207c0==='unmanaged'?_0xc53e('0x44'):_0xc53e('0x42');if(_0x24b155){_0x4f6123['agentEmail']=_0x24b155[_0xc53e('0x11')];}var _0x456493=util[_0xc53e('0x26')](_0xc53e('0x45'),_0xa469d6['serverUrl'],_0x208d18['uniqueid'],md5(_0x208d18[_0xc53e('0x46')]));if(_0x44ead&&_0x44ead[_0xc53e('0x47')]){logger[_0xc53e('0x19')]('[QUEUE]',_0xc53e('0x48'));_0x208d18[_0xc53e('0x49')]=_0x456493;}else if(_0x53178d&&_0x53178d[_0xc53e('0x4a')]&&_0x53178d[_0xc53e('0x4a')]!=='none'){logger[_0xc53e('0x19')](_0xc53e('0x4b'),_0xc53e('0x48'));_0x208d18[_0xc53e('0x49')]=_0x456493;}else{_0x208d18[_0xc53e('0x49')]='';}return getAdminId(_0x4f6123,_0x5207c0,_0x1b953e,_0x4c778e)[_0xc53e('0xe')](getUser(_0x5207c0,_0x1b953e,_0x4c778e))[_0xc53e('0xe')](getEndUser(_0x5207c0,_0x1b953e,_0x4c778e))[_0xc53e('0xe')](getTicket(_0x5207c0,_0x1b953e,_0x4c778e,_0x195e11,_0x208d18))[_0xc53e('0xe')](function(_0x2c335d){logger[_0xc53e('0x19')](util[_0xc53e('0x26')](_0xc53e('0x4c'),_0x2c335d['ticketId']));if(_0x5207c0!==_0xc53e('0x4d')){logger['info']('['+[_0x5207c0[_0xc53e('0x20')]()]+']',_0xc53e('0x4e'));emit(_0x4c778e,_0x24b155[_0xc53e('0x4f')],_0x2c335d['endUserId']);}})['catch'](function(_0x424041){logger[_0xc53e('0x33')]('['+[_0x5207c0[_0xc53e('0x20')]()]+_0xc53e('0x50'),util[_0xc53e('0x51')](_0x424041,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0660=['catch','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','User\x20found:','userId','Admin\x20selected','Requested\x20Resource\x20not\x20Found','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','error','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','outbound','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','redis','defaults','socket.io-emitter','GET','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:'];(function(_0x4f362c,_0x53c4b2){var _0x578f7f=function(_0x3ab23c){while(--_0x3ab23c){_0x4f362c['push'](_0x4f362c['shift']());}};_0x578f7f(++_0x53c4b2);}(_0x0660,0x148));var _0x0066=function(_0x372eab,_0x391b7f){_0x372eab=_0x372eab-0x0;var _0x52c69b=_0x0660[_0x372eab];return _0x52c69b;};'use strict';var _=require('lodash');var rp=require(_0x0066('0x0'));var md5=require(_0x0066('0x1'));var util=require(_0x0066('0x2'));var moment=require(_0x0066('0x3'));var Promise=require(_0x0066('0x4'));var Redis=require(_0x0066('0x5'));var intUtil=require(_0x0066('0x6'));var config=require(_0x0066('0x7'));var logger=require('../../../../config/logger')('freshsales');config[_0x0066('0x8')]=_[_0x0066('0x9')](config[_0x0066('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x0066('0xa'))(new Redis(config['redis']));function getAdminId(_0x441fed,_0x5bd58f,_0x3e7721,_0x16c5c6){return new Promise(function(_0x4dfbe1,_0x9d9681){var _0x1aa2f8=![];var _0x3399c8={'method':_0x0066('0xb'),'uri':_0x16c5c6+'/api/selector/owners','json':!![]};_0x3399c8['headers']=_0x3e7721;logger[_0x0066('0xc')](_0x0066('0xd'));return rp(_0x3399c8)[_0x0066('0xe')](function(_0x97511e){if(_0x97511e){var _0xa9b7df=_0x97511e[_0x0066('0xf')];var _0x24efd9=null;for(_0x24efd9=0x0;_0x24efd9<_0xa9b7df['length'];_0x24efd9++){if(_0xa9b7df[_0x24efd9][_0x0066('0x10')]===_0x441fed[_0x0066('0x11')]){_0x441fed[_0x0066('0x12')]=_0xa9b7df[_0x24efd9]['id'];_0x1aa2f8=!![];}}if(_0x1aa2f8){logger[_0x0066('0xc')](_0x0066('0x13'),_0x441fed[_0x0066('0x12')]);_0x4dfbe1(_0x441fed);}else{_0x9d9681({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x9d9681({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x0066('0x14')](function(_0x4b116d){logger['error']('['+[_0x5bd58f[_0x0066('0x15')]()]+']',_0x4b116d[_0x0066('0x16')]);_0x9d9681(_0x4b116d);});});}function getUser(_0x5a2f65,_0x36e703,_0x2add5c){return function(_0x5ef5de){return new Promise(function(_0x5d4dce,_0x29acb5){var _0x8a0b51={'method':_0x0066('0xb'),'uri':_0x2add5c+_0x0066('0x17'),'json':!![]};_0x8a0b51['headers']=_0x36e703;logger[_0x0066('0xc')](_0x0066('0x18'));return rp(_0x8a0b51)['then'](function(_0x344b2d){if(_0x344b2d){var _0x274229=_0x344b2d[_0x0066('0xf')];var _0x26f2a7=![];var _0x519d03=null;if(_0x5ef5de[_0x0066('0x19')]!==null){logger['info'](_0x0066('0x1a'),_0x5ef5de[_0x0066('0x19')]);_0x5ef5de[_0x0066('0x1b')]=_0x5ef5de['agentEmail'];for(_0x519d03=0x0;_0x519d03<_0x274229[_0x0066('0x1c')];_0x519d03++){if(_0x274229[_0x519d03]['email']===_0x5ef5de[_0x0066('0x19')]){_0x26f2a7=!![];_0x5ef5de['userId']=_0x274229[_0x519d03]['id'];logger[_0x0066('0xc')](_0x0066('0x1d'),_0x5ef5de[_0x0066('0x1e')]);}}}if(!_0x26f2a7){logger[_0x0066('0xc')](_0x0066('0x1f'));_0x5ef5de[_0x0066('0x1b')]=_0x5ef5de[_0x0066('0x11')];_0x5ef5de['userId']=_0x5ef5de[_0x0066('0x12')];_0x26f2a7=!![];}if(_0x26f2a7){_0x5d4dce(_0x5ef5de);}else{_0x29acb5({'statusCode':0x194,'message':_0x0066('0x20')});}}else{_0x29acb5({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x0066('0x14')](function(_0x1421e4){logger['error']('['+[_0x5a2f65[_0x0066('0x15')]()]+']',_0x1421e4[_0x0066('0x16')]);_0x29acb5(_0x1421e4);});});};}function searchContact(_0x2cec34,_0x5bdb77,_0xb87608,_0x5e0311){return new Promise(function(_0x33e32d,_0x1f38a2){var _0x2dd9a7={'method':_0x0066('0xb'),'headers':_0x5bdb77,'uri':_0x2cec34+_0x0066('0x21')+_0x5e0311+_0x0066('0x22')+_0xb87608+_0x0066('0x23'),'json':!![]};rp(_0x2dd9a7)[_0x0066('0xe')](function(_0x1431f0){var _0x2cdee0=_[_0x0066('0x24')](_0x1431f0['contacts'][_0x0066('0x25')],[_0xb87608,_0x5e0311]);_0x33e32d(_0x2cdee0);})[_0x0066('0x14')](function(_0xdf317f){_0x1f38a2(_0xdf317f);});});}function getEndUser(_0x4c91e8,_0x403810,_0x40fa86){return function(_0x5c8006){return new Promise(function(_0x40a766,_0x50d623){logger[_0x0066('0xc')](util[_0x0066('0x26')](_0x0066('0x27'),_0x5c8006[_0x0066('0x28')]));searchContact(_0x40fa86,_0x403810,_0x0066('0x29'),_0x5c8006[_0x0066('0x28')])[_0x0066('0xe')](function(_0x44017f){if(_0x44017f){_0x5c8006[_0x0066('0x2a')]=_0x44017f['id'];logger[_0x0066('0xc')](_0x0066('0x2b'),_0x5c8006[_0x0066('0x2a')]);return _0x40a766(_0x5c8006);}searchContact(_0x40fa86,_0x403810,_0x0066('0x2c'),_0x5c8006['contactNumber'])[_0x0066('0xe')](function(_0x3c5223){if(_0x3c5223){_0x5c8006['endUserId']=_0x3c5223['id'];logger[_0x0066('0xc')](_0x0066('0x2d'),_0x5c8006[_0x0066('0x2a')]);return _0x40a766(_0x5c8006);}createEndUser(_0x5c8006,_0x4c91e8,_0x403810,_0x40fa86)[_0x0066('0xe')](function(_0x198812){logger[_0x0066('0xc')](_0x0066('0x2e'),_0x198812[_0x0066('0x2a')]);return _0x40a766(_0x198812);});});})[_0x0066('0x14')](function(_0x5d05a2){_0x50d623(_0x5d05a2);});});};}function createEndUser(_0x1c5360,_0x41358d,_0x41000e,_0x35ce4a){return new Promise(function(_0x9f9631,_0x216d11){var _0x60d851=moment();var _0x401117={'method':_0x0066('0x2f'),'uri':_0x35ce4a+_0x0066('0x30'),'body':{'contact':{'last_name':_0x1c5360[_0x0066('0x28')],'work_number':_0x1c5360[_0x0066('0x28')],'mobile_number':_0x1c5360[_0x0066('0x28')],'owner_id':_0x1c5360[_0x0066('0x1e')],'created_at':_0x60d851[_0x0066('0x26')](_0x0066('0x31'))}},'json':!![]};_0x401117[_0x0066('0x32')]=_0x41000e;logger[_0x0066('0xc')](_0x0066('0x33'));return rp(_0x401117)[_0x0066('0xe')](function(_0x3238db){_0x1c5360[_0x0066('0x2a')]=_0x3238db[_0x0066('0x34')]['id'];_0x9f9631(_0x1c5360);})['catch'](function(_0x5bed2b){logger['error']('['+[_0x41358d['toUpperCase']()]+']',_0x5bed2b[_0x0066('0x16')]);_0x216d11(_0x5bed2b[_0x0066('0x16')]);});});}function getTicket(_0x1a813e,_0x47c07f,_0x52deff,_0xe0413b,_0x3fd095){return function(_0x38bf6e){logger['info'](_0x0066('0x35'));return new Promise(function(_0x5a9719,_0x5abcae){var _0x3c1618=moment();var _0x21fa49={'method':'POST','uri':_0x52deff+_0x0066('0x36'),'body':{'title':intUtil[_0x0066('0x37')](_0xe0413b[_0x0066('0x38')],_0x3fd095,'\x20'),'description':intUtil[_0x0066('0x37')](_0xe0413b[_0x0066('0x39')],_0x3fd095,'\x0a'),'owner_id':_0x38bf6e[_0x0066('0x1e')],'creater_id':_0x38bf6e[_0x0066('0x12')],'targetable_id':_0x38bf6e[_0x0066('0x2a')],'targetable_type':'Contact','created_at':_0x3c1618[_0x0066('0x26')](_0x0066('0x31')),'due_date':_0x3c1618[_0x0066('0x3a')](0x1e,'m')['format'](_0x0066('0x31'))},'json':!![]};_0x21fa49[_0x0066('0x32')]=_0x47c07f;return rp(_0x21fa49)[_0x0066('0xe')](function(_0x2c77ab){_0x38bf6e[_0x0066('0x3b')]=_0x2c77ab[_0x0066('0x3c')]['id'];logger[_0x0066('0xc')](_0x0066('0x3d'),_0x38bf6e[_0x0066('0x3b')]);_0x5a9719(_0x38bf6e);})[_0x0066('0x14')](function(_0x3aed7f){logger[_0x0066('0x3e')]('['+[_0x1a813e[_0x0066('0x15')]()]+']',_0x3aed7f[_0x0066('0x16')]);_0x5abcae(_0x3aed7f[_0x0066('0x16')]);});});};}function emit(_0x589ca5,_0x2795c8,_0x432624){var _0x44a322={'uri':_0x589ca5+_0x0066('0x3f')+_0x432624};io['to'](util['format'](_0x0066('0x40'),_0x2795c8))['emit'](_0x0066('0x41'),_0x44a322);}exports['cs']=function(_0x5709a0,_0x5e7a37,_0x5deda5,_0x5371fc,_0x47d672,_0x48742c,_0x2456cd,_0x389637){var _0x27a9c0={};var _0x55d8dc={'Authorization':_0x0066('0x42')+_0x48742c[_0x0066('0x43')]};_0x48742c['remoteUri']=intUtil[_0x0066('0x44')](_0x48742c[_0x0066('0x45')]);_0x48742c[_0x0066('0x46')]=intUtil['stripTrailingSlash'](_0x48742c[_0x0066('0x46')]);var _0x4908d4=_0x48742c[_0x0066('0x45')];_0x27a9c0[_0x0066('0x11')]=_0x48742c[_0x0066('0x47')];_0x27a9c0['contactNumber']=_0x389637['toLowerCase']()===_0x0066('0x48')?_0x5e7a37['destcalleridnum']:_0x5e7a37['calleridnum'];_0x27a9c0['callDirection']=_0x389637===_0x0066('0x49')||_0x389637==='unmanaged'?'queue':'outbound';if(_0x5371fc){_0x27a9c0[_0x0066('0x19')]=_0x5371fc[_0x0066('0x10')];}var _0x50e609=util[_0x0066('0x26')](_0x0066('0x4a'),_0x48742c[_0x0066('0x46')],_0x5e7a37['uniqueid'],md5(_0x5e7a37['uniqueid']));if(_0x47d672&&_0x47d672[_0x0066('0x4b')]){logger[_0x0066('0xc')](_0x0066('0x4c'),_0x0066('0x4d'));_0x5e7a37[_0x0066('0x4e')]=_0x50e609;}else if(_0x2456cd&&_0x2456cd[_0x0066('0x4f')]&&_0x2456cd[_0x0066('0x4f')]!==_0x0066('0x50')){logger[_0x0066('0xc')](_0x0066('0x51'),_0x0066('0x4d'));_0x5e7a37[_0x0066('0x4e')]=_0x50e609;}else{_0x5e7a37[_0x0066('0x4e')]='';}return getAdminId(_0x27a9c0,_0x389637,_0x55d8dc,_0x4908d4)[_0x0066('0xe')](getUser(_0x389637,_0x55d8dc,_0x4908d4))[_0x0066('0xe')](getEndUser(_0x389637,_0x55d8dc,_0x4908d4))['then'](getTicket(_0x389637,_0x55d8dc,_0x4908d4,_0x5deda5,_0x5e7a37))[_0x0066('0xe')](function(_0x5d8d49){logger[_0x0066('0xc')](util[_0x0066('0x26')](_0x0066('0x52'),_0x5d8d49['ticketId']));if(_0x389637!==_0x0066('0x53')){logger[_0x0066('0xc')]('['+[_0x389637[_0x0066('0x15')]()]+']',_0x0066('0x54'));emit(_0x4908d4,_0x5371fc[_0x0066('0x55')],_0x5d8d49[_0x0066('0x2a')]);}})[_0x0066('0x14')](function(_0xfad4f0){logger[_0x0066('0x3e')]('['+[_0x389637['toUpperCase']()]+_0x0066('0x56'),util['inspect'](_0xfad4f0,{'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 0c72b90..5997e47 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 _0xfbc3=['./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','salesforce','sugarcrm','zoho','vtiger','exec','data1','toLowerCase','data2','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','util'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xfbc3,0xed));var _0x3fbc=function(_0x3cd4e6,_0x4e3ba8){_0x3cd4e6=_0x3cd4e6-0x0;var _0x2a0f16=_0xfbc3[_0x3cd4e6];return _0x2a0f16;};'use strict';var _=require('lodash');var util=require(_0x3fbc('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x3fbc('0x1'));var sugarcrm=require(_0x3fbc('0x2'));var freshdesk=require(_0x3fbc('0x3'));var zoho=require(_0x3fbc('0x4'));var desk=require(_0x3fbc('0x5'));var vtiger=require(_0x3fbc('0x6'));var servicenow=require(_0x3fbc('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x3fbc('0x8'));var integrations=['zendesk',_0x3fbc('0x9'),_0x3fbc('0xa'),'freshdesk',_0x3fbc('0xb'),'desk',_0x3fbc('0xc'),'dynamics365','freshsales','servicenow'];exports[_0x3fbc('0xd')]=function(_0xf95591,_0x2d744a,_0x4bcdbf,_0x370bc6,_0x3fc55f,_0x208237){if(_0x4bcdbf){if(_['includes'](integrations,_0xf95591[_0x3fbc('0xe')][_0x3fbc('0xf')]())){try{var _0xa9b96c=null;var _0x5f4d4b='';var _0xc64b4c=_0x4bcdbf[_0xf95591['data1']['toLowerCase']()];if(_0xc64b4c){var _0x35a8d9=_0xc64b4c[_0xf95591[_0x3fbc('0x10')]];if(_0x35a8d9){var _0x1a28e9=_['find'](_0x35a8d9[_0x3fbc('0x11')],{'id':parseInt(_0xf95591[_0x3fbc('0x12')],0xa)});if(_0x1a28e9){if(_0x370bc6){if(_0x3fc55f&&_0x2d744a[_0x3fbc('0x13')]){_0x5f4d4b='queue';}else if(_0x2d744a[_0x3fbc('0x14')]){_0x5f4d4b='outbound';}else{console[_0x3fbc('0x15')](_0x3fbc('0x16'),_0x2d744a);}}else{_0x5f4d4b=_0x3fbc('0x17');}switch(_0xf95591[_0x3fbc('0xe')]['toLowerCase']()){case _0x3fbc('0x18'):zendesk[_0x5f4d4b](_0xf95591,_0x2d744a,_0x1a28e9,_0x370bc6,_0x3fc55f,_0x35a8d9,_0x208237);break;case _0x3fbc('0x9'):salesforce[_0x5f4d4b](_0xf95591,_0x2d744a,_0x1a28e9,_0x370bc6,_0x3fc55f,_0x35a8d9,_0x208237);break;case _0x3fbc('0xa'):sugarcrm[_0x5f4d4b](_0xf95591,_0x2d744a,_0x1a28e9,_0x370bc6,_0x3fc55f,_0x35a8d9,_0x208237);break;case'freshdesk':freshdesk[_0x5f4d4b](_0xf95591,_0x2d744a,_0x1a28e9,_0x370bc6,_0x3fc55f,_0x35a8d9,_0x208237);break;case'zoho':zoho[_0x5f4d4b](_0xf95591,_0x2d744a,_0x1a28e9,_0x370bc6,_0x3fc55f,_0x35a8d9,_0x208237);break;case _0x3fbc('0x19'):desk[_0x5f4d4b](_0xf95591,_0x2d744a,_0x1a28e9,_0x370bc6,_0x3fc55f,_0x35a8d9,_0x208237);break;case'vtiger':vtiger[_0x5f4d4b](_0xf95591,_0x2d744a,_0x1a28e9,_0x370bc6,_0x3fc55f,_0x35a8d9,_0x208237);break;case _0x3fbc('0x1a'):freshsales['cs'](_0xf95591,_0x2d744a,_0x1a28e9,_0x370bc6,_0x3fc55f,_0x35a8d9,_0x208237,_0x5f4d4b);break;case'servicenow':servicenow['cs'](_0xf95591,_0x2d744a,_0x1a28e9,_0x370bc6,_0x3fc55f,_0x35a8d9,_0x208237,_0x5f4d4b);break;case _0x3fbc('0x1b'):dynamics365['cs'](_0xf95591,_0x2d744a,_0x1a28e9,_0x370bc6,_0x3fc55f,_0x35a8d9,_0x208237,_0x5f4d4b);break;default:console['log'](_0x3fbc('0x1c'));}}else{_0xa9b96c=require(_0x3fbc('0x1d'))(_0xf95591[_0x3fbc('0xe')][_0x3fbc('0xf')]());_0xa9b96c[_0x3fbc('0x1e')](_0x3fbc('0x1f'),util[_0x3fbc('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0xf95591[_0x3fbc('0xe')][_0x3fbc('0xf')](),_0xf95591['data3']));}}else{_0xa9b96c=require('../../../../config/logger')(_0xf95591[_0x3fbc('0xe')]['toLowerCase']());_0xa9b96c[_0x3fbc('0x1e')](_0x3fbc('0x1f'),util[_0x3fbc('0x20')](_0x3fbc('0x21'),_0xf95591['data1'][_0x3fbc('0xf')](),_0xf95591['data2']));}}else{}}catch(_0x46bf42){console[_0x3fbc('0x1e')](_0x46bf42);}}}}; \ No newline at end of file +var _0xa6ed=['[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','freshdesk','zoho','desk','dynamics365','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','sugarcrm','vtiger','unknown\x20integration','../../../../config/logger','error','format'];(function(_0x3c0519,_0x5e6b98){var _0x573358=function(_0x189700){while(--_0x189700){_0x3c0519['push'](_0x3c0519['shift']());}};_0x573358(++_0x5e6b98);}(_0xa6ed,0x17e));var _0xda6e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa6ed[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xda6e('0x0'));var util=require(_0xda6e('0x1'));var zendesk=require(_0xda6e('0x2'));var salesforce=require(_0xda6e('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xda6e('0x4'));var zoho=require(_0xda6e('0x5'));var desk=require(_0xda6e('0x6'));var vtiger=require(_0xda6e('0x7'));var servicenow=require(_0xda6e('0x8'));var dynamics365=require(_0xda6e('0x9'));var freshsales=require(_0xda6e('0xa'));var integrations=['zendesk',_0xda6e('0xb'),'sugarcrm',_0xda6e('0xc'),_0xda6e('0xd'),_0xda6e('0xe'),'vtiger',_0xda6e('0xf'),'freshsales',_0xda6e('0x10')];exports[_0xda6e('0x11')]=function(_0x2aedf7,_0x5a7b76,_0xebb0f7,_0x358f37,_0x2a84d3,_0x35097e){if(_0xebb0f7){if(_[_0xda6e('0x12')](integrations,_0x2aedf7[_0xda6e('0x13')][_0xda6e('0x14')]())){try{var _0x20227a=null;var _0x1b6d1e='';var _0x55f2ba=_0xebb0f7[_0x2aedf7[_0xda6e('0x13')][_0xda6e('0x14')]()];if(_0x55f2ba){var _0x1c02b0=_0x55f2ba[_0x2aedf7['data2']];if(_0x1c02b0){var _0x4b0e3d=_[_0xda6e('0x15')](_0x1c02b0[_0xda6e('0x16')],{'id':parseInt(_0x2aedf7[_0xda6e('0x17')],0xa)});if(_0x4b0e3d){if(_0x358f37){if(_0x2a84d3&&_0x5a7b76[_0xda6e('0x18')]){_0x1b6d1e=_0xda6e('0x18');}else if(_0x5a7b76[_0xda6e('0x19')]){_0x1b6d1e=_0xda6e('0x1a');}else{console['log'](_0xda6e('0x1b'),_0x5a7b76);}}else{_0x1b6d1e=_0xda6e('0x1c');}switch(_0x2aedf7[_0xda6e('0x13')][_0xda6e('0x14')]()){case _0xda6e('0x1d'):zendesk[_0x1b6d1e](_0x2aedf7,_0x5a7b76,_0x4b0e3d,_0x358f37,_0x2a84d3,_0x1c02b0,_0x35097e);break;case _0xda6e('0xb'):salesforce[_0x1b6d1e](_0x2aedf7,_0x5a7b76,_0x4b0e3d,_0x358f37,_0x2a84d3,_0x1c02b0,_0x35097e);break;case _0xda6e('0x1e'):sugarcrm[_0x1b6d1e](_0x2aedf7,_0x5a7b76,_0x4b0e3d,_0x358f37,_0x2a84d3,_0x1c02b0,_0x35097e);break;case'freshdesk':freshdesk[_0x1b6d1e](_0x2aedf7,_0x5a7b76,_0x4b0e3d,_0x358f37,_0x2a84d3,_0x1c02b0,_0x35097e);break;case _0xda6e('0xd'):zoho[_0x1b6d1e](_0x2aedf7,_0x5a7b76,_0x4b0e3d,_0x358f37,_0x2a84d3,_0x1c02b0,_0x35097e);break;case _0xda6e('0xe'):desk[_0x1b6d1e](_0x2aedf7,_0x5a7b76,_0x4b0e3d,_0x358f37,_0x2a84d3,_0x1c02b0,_0x35097e);break;case _0xda6e('0x1f'):vtiger[_0x1b6d1e](_0x2aedf7,_0x5a7b76,_0x4b0e3d,_0x358f37,_0x2a84d3,_0x1c02b0,_0x35097e);break;case'freshsales':freshsales['cs'](_0x2aedf7,_0x5a7b76,_0x4b0e3d,_0x358f37,_0x2a84d3,_0x1c02b0,_0x35097e,_0x1b6d1e);break;case _0xda6e('0x10'):servicenow['cs'](_0x2aedf7,_0x5a7b76,_0x4b0e3d,_0x358f37,_0x2a84d3,_0x1c02b0,_0x35097e,_0x1b6d1e);break;case _0xda6e('0xf'):dynamics365['cs'](_0x2aedf7,_0x5a7b76,_0x4b0e3d,_0x358f37,_0x2a84d3,_0x1c02b0,_0x35097e,_0x1b6d1e);break;default:console['log'](_0xda6e('0x20'));}}else{_0x20227a=require(_0xda6e('0x21'))(_0x2aedf7['data1']['toLowerCase']());_0x20227a[_0xda6e('0x22')]('[EXEC]',util[_0xda6e('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x2aedf7[_0xda6e('0x13')]['toLowerCase'](),_0x2aedf7[_0xda6e('0x17')]));}}else{_0x20227a=require(_0xda6e('0x21'))(_0x2aedf7[_0xda6e('0x13')][_0xda6e('0x14')]());_0x20227a['error'](_0xda6e('0x24'),util[_0xda6e('0x23')](_0xda6e('0x25'),_0x2aedf7[_0xda6e('0x13')][_0xda6e('0x14')](),_0x2aedf7['data2']));}}else{}}catch(_0x44a052){console[_0xda6e('0x22')](_0x44a052);}}}}; \ 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 6d753d9..962841e 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 _0xc712=['ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','account','ContactId','lead','Association\x20between\x20Case\x20and\x20Lead\x20skipped','validateEmail','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','sobject','Contact','additionalSearchLead','$or','account_contact_lead','additionalSearchAccount','Account','Lead','first','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','toString','variableName','customVariable','Variable','name','password','concat','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','emit','assign','getString','Descriptions','ticketType','Task'];(function(_0x57ab85,_0x184389){var _0x2c07cc=function(_0x1caf5e){while(--_0x1caf5e){_0x57ab85['push'](_0x57ab85['shift']());}};_0x2c07cc(++_0x184389);}(_0xc712,0xe9));var _0x2c71=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0xc712[_0x61b3ab];return _0x57097f;};'use strict';var _=require(_0x2c71('0x0'));var rp=require(_0x2c71('0x1'));var moment=require(_0x2c71('0x2'));var BPromise=require(_0x2c71('0x3'));var md5=require(_0x2c71('0x4'));var jsforce=require(_0x2c71('0x5'));var util=require(_0x2c71('0x6'));var Redis=require(_0x2c71('0x7'));var intUtil=require(_0x2c71('0x8'));var config=require(_0x2c71('0x9'));var logger=require(_0x2c71('0xa'))(_0x2c71('0xb'));config['redis']=_[_0x2c71('0xc')](config[_0x2c71('0xd')],{'host':_0x2c71('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x1f502b,_0x408608,_0x341d54){io['to'](_0x1f502b)[_0x2c71('0xf')](_0x408608,_0x341d54);}function getTicket(_0x395baa,_0xe206e8,_0x54e6c0,_0x2b74de,_0x574b71,_0x423a59,_0x10e2cf,_0xc0b7ec){var _0x5d4bfb=Object[_0x2c71('0x10')]({},{'OwnerId':_0xe206e8['id'],'Subject':intUtil['getString'](_0x2b74de['Subjects'],_0x574b71,'\x20'),'Description':intUtil[_0x2c71('0x11')](_0x2b74de[_0x2c71('0x12')],_0x574b71,'\x0a')},getCustomFields(_0x423a59,_0x574b71));if(_0x54e6c0){if(_0x2b74de[_0x2c71('0x13')]===_0x2c71('0x14')){_0x5d4bfb[_0x2c71('0x15')]=moment[_0x2c71('0x16')]();_0x5d4bfb[_0x2c71('0x17')]=![];_0x5d4bfb[_0x2c71('0x18')]=![];if(_0x54e6c0[_0x2c71('0x19')]===_0x2c71('0x1a')||_0x54e6c0[_0x2c71('0x19')]==='lead'){_0x5d4bfb['WhoId']=_0x54e6c0['id'];}else if(_0x54e6c0[_0x2c71('0x19')]===_0x2c71('0x1b')){_0x5d4bfb['WhatId']=_0x54e6c0['id'];}}else if(_0x2b74de['ticketType']==='Case'){if(_0x54e6c0[_0x2c71('0x19')]==='contact'){_0x5d4bfb[_0x2c71('0x1c')]=_0x54e6c0['id'];}else if(_0x54e6c0[_0x2c71('0x19')]===_0x2c71('0x1b')){_0x5d4bfb['AccountId']=_0x54e6c0['id'];}else if(_0x54e6c0[_0x2c71('0x19')]===_0x2c71('0x1d')&&_0x2b74de['leadId']){_0x5d4bfb[_0x2b74de['leadId']]=_0x54e6c0['id'];}else{logger['info'](_0x2c71('0x1e'));}}}return _0x10e2cf['sobject'](_0x2b74de['ticketType'])['create'](_0x5d4bfb);}function getUser(_0x18e82f,_0x32a9ce,_0x5a5c0f){if(!_['isNil'](_0x32a9ce)&&intUtil[_0x2c71('0x1f')](_0x32a9ce)){var _0x11a784={'Email':_0x32a9ce};var _0x22a833={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5a5c0f['sobject']('User')[_0x2c71('0x20')](_0x11a784,_0x22a833)[_0x2c71('0x21')]()[_0x2c71('0x22')](function(_0xa25cb6){if(_0xa25cb6[_0x2c71('0x23')]){var _0x48d06d=_[_0x2c71('0x20')](_0xa25cb6,function(_0x2ad05d){return _0x2ad05d[_0x2c71('0x24')]===_0x32a9ce;});if(_0x48d06d){logger[_0x2c71('0x25')](_0x2c71('0x26'),_0x32a9ce);return BPromise[_0x2c71('0x27')]({'id':_0x48d06d['Id'],'name':_0x48d06d[_0x2c71('0x28')]});}}else{logger[_0x2c71('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x32a9ce);return _0x5a5c0f[_0x2c71('0x29')]()[_0x2c71('0x22')](function(_0x26bbbd){return BPromise[_0x2c71('0x27')]({'id':_0x26bbbd['user_id'],'name':_0x26bbbd['display_name']});});}});}else{logger[_0x2c71('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x32a9ce);return _0x5a5c0f[_0x2c71('0x29')]()['then'](function(_0x5e79d9){return BPromise['resolve']({'id':_0x5e79d9['user_id'],'name':_0x5e79d9[_0x2c71('0x2a')]});});}}function getEndUser(_0x5ef393,_0x3874fe,_0x5b928c,_0x8e7f75,_0x1da123){var _0x27ebe7={'$or':{'Phone':_0x8e7f75}};var _0x4b5d29={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2c71('0x27')]()[_0x2c71('0x22')](function(){logger[_0x2c71('0x25')](_0x2c71('0x2b'),_0x8e7f75,_0x3874fe[_0x2c71('0x2c')]);switch(_0x3874fe[_0x2c71('0x2c')]){case _0x2c71('0x2d'):var _0xa02604=_[_0x2c71('0x2e')](_0x27ebe7);if(_0x3874fe[_0x2c71('0x2f')]){var _0x592ad6={};_0x592ad6[_0x3874fe[_0x2c71('0x2f')]]=_0x8e7f75;_[_0x2c71('0x30')](_0xa02604['$or'],_0x592ad6);}return _0x1da123[_0x2c71('0x31')](_0x2c71('0x32'))[_0x2c71('0x20')](_0xa02604,_0x4b5d29)[_0x2c71('0x21')]()['then'](function(_0x2c5e2a){if(_0x2c5e2a&&_0x2c5e2a[_0x2c71('0x23')]){return _0x2c5e2a;}else{var _0x4fc1c1=_[_0x2c71('0x2e')](_0x27ebe7);if(_0x3874fe[_0x2c71('0x33')]){var _0x28f1d7={};_0x28f1d7[_0x3874fe[_0x2c71('0x33')]]=_0x8e7f75;_['merge'](_0x4fc1c1[_0x2c71('0x34')],_0x28f1d7);}return _0x1da123[_0x2c71('0x31')]('Lead')['find'](_0x4fc1c1,_0x4b5d29);}});case _0x2c71('0x35'):var _0x3e2eb8=_['cloneDeep'](_0x27ebe7);if(_0x3874fe[_0x2c71('0x36')]){var _0x592ad6={};_0x592ad6[_0x3874fe[_0x2c71('0x36')]]=_0x8e7f75;_['merge'](_0x3e2eb8[_0x2c71('0x34')],_0x592ad6);}return _0x1da123[_0x2c71('0x31')](_0x2c71('0x37'))[_0x2c71('0x20')](_0x3e2eb8,_0x4b5d29)['execute']()[_0x2c71('0x22')](function(_0x13bae4){if(_0x13bae4&&_0x13bae4[_0x2c71('0x23')]){return _0x13bae4;}else{var _0x5c8695=_['cloneDeep'](_0x27ebe7);if(_0x3874fe[_0x2c71('0x2f')]){var _0x538b77={};_0x538b77[_0x3874fe[_0x2c71('0x2f')]]=_0x8e7f75;_['merge'](_0x5c8695[_0x2c71('0x34')],_0x538b77);}return _0x1da123[_0x2c71('0x31')](_0x2c71('0x32'))['find'](_0x5c8695,_0x4b5d29)['then'](function(_0x10412c){if(_0x10412c&&_0x10412c[_0x2c71('0x23')]){return _0x10412c;}else{var _0x5b7db0=_[_0x2c71('0x2e')](_0x27ebe7);if(_0x3874fe['additionalSearchLead']){var _0x15e316={};_0x15e316[_0x3874fe['additionalSearchLead']]=_0x8e7f75;_[_0x2c71('0x30')](_0x5b7db0[_0x2c71('0x34')],_0x15e316);}return _0x1da123[_0x2c71('0x31')](_0x2c71('0x38'))[_0x2c71('0x20')](_0x5b7db0,_0x4b5d29);}});}});case _0x2c71('0x1a'):var _0xa02604=_[_0x2c71('0x2e')](_0x27ebe7);if(_0x3874fe['additionalSearchContact']){var _0x592ad6={};_0x592ad6[_0x3874fe[_0x2c71('0x2f')]]=_0x8e7f75;_[_0x2c71('0x30')](_0xa02604[_0x2c71('0x34')],_0x592ad6);}return _0x1da123[_0x2c71('0x31')](_0x2c71('0x32'))[_0x2c71('0x20')](_0xa02604,_0x4b5d29)[_0x2c71('0x21')]();case _0x2c71('0x1d'):var _0x4cfedd=_[_0x2c71('0x2e')](_0x27ebe7);if(_0x3874fe[_0x2c71('0x33')]){var _0x592ad6={};_0x592ad6[_0x3874fe[_0x2c71('0x33')]]=_0x8e7f75;_[_0x2c71('0x30')](_0x4cfedd[_0x2c71('0x34')],_0x592ad6);}return _0x1da123['sobject'](_0x2c71('0x38'))['find'](_0x4cfedd,_0x4b5d29);case _0x2c71('0x1b'):var _0x3e2eb8=_[_0x2c71('0x2e')](_0x27ebe7);if(_0x3874fe['additionalSearchAccount']){var _0x592ad6={};_0x592ad6[_0x3874fe[_0x2c71('0x36')]]=_0x8e7f75;_['merge'](_0x3e2eb8[_0x2c71('0x34')],_0x592ad6);}return _0x1da123[_0x2c71('0x31')](_0x2c71('0x37'))['find'](_0x3e2eb8,_0x4b5d29);default:return null;}})['then'](function(_0x4cdf4e){if(_0x4cdf4e&&_0x4cdf4e[_0x2c71('0x23')]){var _0x5586d2=_[_0x2c71('0x39')](_0x4cdf4e);if(_0x5586d2){return BPromise[_0x2c71('0x27')]({'id':_0x5586d2['Id'],'name':_0x5586d2[_0x2c71('0x28')],'phone':_0x5586d2['Phone'],'endUserType':_0x5586d2['attributes'][_0x2c71('0x3a')][_0x2c71('0x3b')]()});}}})['then'](function(_0x3526b8){if(_0x3526b8){logger[_0x2c71('0x25')](_0x2c71('0x3c'),_0x3526b8['endUserType'],_0x8e7f75);return BPromise[_0x2c71('0x27')](_0x3526b8);}else{logger['info'](_0x2c71('0x3d'),_0x8e7f75);var _0x62006b={'Phone':_0x8e7f75};if(_0x3874fe[_0x2c71('0x3e')]){if(_0x3874fe[_0x2c71('0x3e')]===_0x2c71('0x1a')){logger[_0x2c71('0x25')](_0x2c71('0x3f'),_0x8e7f75,_0x3874fe[_0x2c71('0x3e')]);_0x62006b['LastName']=_0x5b928c!==_0x2c71('0x40')?_0x5b928c:util[_0x2c71('0x41')](_0x2c71('0x42'),_0x8e7f75);}else if(_0x3874fe['moduleCreate']===_0x2c71('0x1d')){logger[_0x2c71('0x25')](_0x2c71('0x3f'),_0x8e7f75,_0x3874fe[_0x2c71('0x3e')]);_0x62006b[_0x2c71('0x43')]=_0x5b928c!==''?_0x5b928c:util[_0x2c71('0x41')](_0x2c71('0x42'),_0x8e7f75);_0x62006b['Company']=_0x2c71('0x44');}else if(_0x3874fe['moduleCreate']===_0x2c71('0x1b')){logger[_0x2c71('0x25')](_0x2c71('0x3f'),_0x8e7f75,_0x3874fe['moduleCreate']);_0x62006b[_0x2c71('0x28')]=_0x5b928c!==_0x2c71('0x40')?_0x5b928c:util[_0x2c71('0x41')]('Caller\x20-\x20%s',_0x8e7f75);}else{return null;}}return _0x1da123['sobject'](_[_0x2c71('0x45')](_0x3874fe[_0x2c71('0x3e')]))['create'](_0x62006b)[_0x2c71('0x22')](function(_0x3d3431){return BPromise[_0x2c71('0x27')]({'id':_0x3d3431['id'],'endUserType':_0x3874fe[_0x2c71('0x3e')]});});}});}function getCustomFields(_0x1a888b,_0x15c811){var _0x27d313={};if(_0x1a888b[_0x2c71('0x23')]>0x0){_[_0x2c71('0x46')](_0x1a888b,function(_0x20b7ed){if(_[_0x2c71('0x47')]([_0x2c71('0x48'),_0x2c71('0x49')],_0x20b7ed['type'])&&_0x20b7ed[_0x2c71('0x4a')]){_0x27d313[_0x20b7ed[_0x2c71('0x4a')]]=_0x20b7ed['content'][_0x2c71('0x4b')]();}else if(_0x20b7ed[_0x2c71('0x3a')]==='variable'&&_0x20b7ed[_0x2c71('0x4c')]&&_0x20b7ed[_0x2c71('0x4a')]){_0x15c811[_0x20b7ed[_0x2c71('0x4c')]]&&(_0x27d313[_0x20b7ed[_0x2c71('0x4a')]]=_0x15c811[_0x20b7ed[_0x2c71('0x4c')]][_0x2c71('0x4b')]());}else if(_0x20b7ed[_0x2c71('0x3a')]===_0x2c71('0x4d')&&_0x20b7ed[_0x2c71('0x4e')]&&_0x20b7ed['Variable'][_0x2c71('0x4f')]&&_0x20b7ed['idField']){_0x15c811[_0x20b7ed['Variable']['name']['toLowerCase']()]&&(_0x27d313[_0x20b7ed['idField']]=_0x15c811[_0x20b7ed[_0x2c71('0x4e')][_0x2c71('0x4f')]['toLowerCase']()][_0x2c71('0x4b')]());}});}return _0x27d313;}function getConnection(_0x557a22){var _0x2aa4c9=_0x557a22[_0x2c71('0x50')][_0x2c71('0x51')](_0x557a22['securityToken']);var _0x4c0ab1=new jsforce[(_0x2c71('0x52'))]({'oauth2':{'loginUrl':_0x557a22['remoteUri']||_0x2c71('0x53'),'clientId':_0x557a22[_0x2c71('0x54')],'clientSecret':_0x557a22[_0x2c71('0x55')]}});return _0x4c0ab1[_0x2c71('0x56')](_0x557a22[_0x2c71('0x57')],_0x2aa4c9)[_0x2c71('0x22')](function(){logger[_0x2c71('0x25')](_0x2c71('0x58'));return _0x4c0ab1;});}exports[_0x2c71('0x59')]=function(_0x6e41aa,_0x3bef3d,_0xfca1fe,_0x42183a,_0x84b70e,_0x203f2d){var _0x2d0216,_0x1965c4,_0x48132f,_0x231a1b;_0x203f2d['serverUrl']=intUtil[_0x2c71('0x5a')](_0x203f2d[_0x2c71('0x5b')]);_0x203f2d['remoteUri']=intUtil[_0x2c71('0x5a')](_0x203f2d[_0x2c71('0x5c')]);if(_0x84b70e&&_0x84b70e[_0x2c71('0x5d')]){logger[_0x2c71('0x25')]('[QUEUE]',_0x2c71('0x5e'));_0x3bef3d['recordingURL']=util[_0x2c71('0x41')](_0x2c71('0x5f'),_0x203f2d[_0x2c71('0x5b')],_0x3bef3d[_0x2c71('0x60')],md5(_0x3bef3d[_0x2c71('0x60')]));}else{_0x3bef3d['recordingURL']='';}return getConnection(_0x203f2d)[_0x2c71('0x22')](function(_0x2362ed){_0x231a1b=_0x2362ed;return getUser(_0x203f2d,_0x42183a['email'],_0x231a1b);})[_0x2c71('0x22')](function(_0x2e4434){_0x2d0216=_0x2e4434;return getEndUser(_0x203f2d,_0xfca1fe,_0x3bef3d[_0x2c71('0x61')],_0x3bef3d[_0x2c71('0x62')],_0x231a1b);})[_0x2c71('0x22')](function(_0x12563d){_0x1965c4=_0x12563d;return getTicket(_0x203f2d,_0x2d0216,_0x1965c4,_0xfca1fe,_0x3bef3d,_0xfca1fe['Fields'],_0x231a1b,_0x2c71('0x59'));})[_0x2c71('0x22')](function(_0x16110e){_0x48132f=_0x16110e;logger[_0x2c71('0x25')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x48132f['id']);logger[_0x2c71('0x25')](_0x2c71('0x63'),_0x48132f['id'],_0x42183a['name'],_0x203f2d[_0x2c71('0x3a')]);switch(_0x203f2d[_0x2c71('0x3a')]){case'integrationTab':emit(util[_0x2c71('0x41')](_0x2c71('0x64'),_0x42183a['name']),_0x2c71('0x65'),{'recordId':_0x48132f['id']});break;case _0x2c71('0x66'):emit(util[_0x2c71('0x41')](_0x2c71('0x64'),_0x42183a['name']),_0x2c71('0x67'),{'uri':util['format']('%s/%s/e',_0x231a1b[_0x2c71('0x68')],_0x48132f['id'])});break;default:logger[_0x2c71('0x69')](_0x2c71('0x6a'));}})[_0x2c71('0x6b')](function(_0x272581){logger['error'](_0x2c71('0x6c'),_0x272581);});};exports[_0x2c71('0x6d')]=function(_0x38c063,_0x387f25,_0x5bd14a,_0x5ecd89,_0x445a9d,_0xed629,_0x239544){var _0x48125c,_0x595f4d,_0xc27006,_0x59c6ca;_0xed629[_0x2c71('0x5b')]=intUtil['stripTrailingSlash'](_0xed629[_0x2c71('0x5b')]);_0xed629['remoteUri']=intUtil[_0x2c71('0x5a')](_0xed629['remoteUri']);if(_0x239544&&_0x239544[_0x2c71('0x6e')]&&_0x239544['recordingFormat']!==_0x2c71('0x6f')){logger['info'](_0x2c71('0x70'),_0x2c71('0x5e'));_0x387f25['recordingURL']=util[_0x2c71('0x41')](_0x2c71('0x5f'),_0xed629[_0x2c71('0x5b')],_0x387f25['uniqueid'],md5(_0x387f25[_0x2c71('0x60')]));}return getConnection(_0xed629)[_0x2c71('0x22')](function(_0x2e5f0f){_0x59c6ca=_0x2e5f0f;return getUser(_0xed629,_0x5ecd89[_0x2c71('0x71')],_0x59c6ca);})['then'](function(_0x511b41){_0x48125c=_0x511b41;return getEndUser(_0xed629,_0x5bd14a,_0x387f25[_0x2c71('0x72')],_0x387f25[_0x2c71('0x73')],_0x59c6ca);})[_0x2c71('0x22')](function(_0x5618f9){_0x595f4d=_0x5618f9;return getTicket(_0xed629,_0x48125c,_0x595f4d,_0x5bd14a,_0x387f25,_0x5bd14a[_0x2c71('0x74')],_0x59c6ca,_0x2c71('0x6d'));})['then'](function(_0x278ed3){_0xc27006=_0x278ed3;logger[_0x2c71('0x25')](_0x2c71('0x75'),_0xc27006['id']);logger[_0x2c71('0x25')](_0x2c71('0x76'),_0xc27006['id'],_0x5ecd89[_0x2c71('0x4f')],_0xed629['type']);switch(_0xed629[_0x2c71('0x3a')]){case _0x2c71('0x77'):emit(util['format'](_0x2c71('0x64'),_0x5ecd89['name']),_0x2c71('0x65'),{'recordId':_0xc27006['id']});break;case _0x2c71('0x66'):emit(util[_0x2c71('0x41')](_0x2c71('0x64'),_0x5ecd89[_0x2c71('0x4f')]),_0x2c71('0x67'),{'uri':util[_0x2c71('0x41')](_0x2c71('0x78'),_0x59c6ca[_0x2c71('0x68')],_0xc27006['id'])});break;default:logger[_0x2c71('0x69')]('[OUTBOUND]',_0x2c71('0x79'));}})[_0x2c71('0x6b')](function(_0x32fd54){logger['error']('[OUTBOUND]',_0x32fd54);});};exports[_0x2c71('0x7a')]=function(_0x6a7ddb,_0x5c7cd6,_0xcb8383,_0x27d19e,_0x5b1465,_0x24e332){var _0x31b082,_0x35ed81,_0x4f732e,_0x282df6;_0x24e332[_0x2c71('0x5b')]=intUtil[_0x2c71('0x5a')](_0x24e332[_0x2c71('0x5b')]);_0x24e332['remoteUri']=intUtil[_0x2c71('0x5a')](_0x24e332[_0x2c71('0x5c')]);if(_0x5b1465&&_0x5b1465[_0x2c71('0x5d')]){logger[_0x2c71('0x25')]('['+_0x5c7cd6[_0x2c71('0x7b')][_0x2c71('0x7c')]()+']',_0x2c71('0x5e'));_0x5c7cd6['recordingURL']=util[_0x2c71('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x24e332['serverUrl'],_0x5c7cd6['uniqueid'],md5(_0x5c7cd6[_0x2c71('0x60')]));}else{_0x5c7cd6['recordingURL']='';}return getConnection(_0x24e332)[_0x2c71('0x22')](function(_0x4c7b1c){_0x282df6=_0x4c7b1c;if(!_[_0x2c71('0x7d')](_0x27d19e)){return getUser(_0x24e332,_0x27d19e[_0x2c71('0x4f')],_0x282df6);}else{return getUser(_0x24e332,null,_0x282df6);}})[_0x2c71('0x22')](function(_0x186b97){_0x31b082=_0x186b97;return getEndUser(_0x24e332,_0xcb8383,_0x5c7cd6['calleridname'],_0x5c7cd6[_0x2c71('0x62')],_0x282df6);})[_0x2c71('0x22')](function(_0x30b709){_0x35ed81=_0x30b709;return getTicket(_0x24e332,_0x31b082,_0x35ed81,_0xcb8383,_0x5c7cd6,_0xcb8383[_0x2c71('0x74')],_0x282df6);})[_0x2c71('0x22')](function(_0xa03454){_0x4f732e=_0xa03454;logger[_0x2c71('0x25')]('['+_0x5c7cd6[_0x2c71('0x7b')][_0x2c71('0x7c')]()+_0x2c71('0x7e'),_0x4f732e['id']);logger[_0x2c71('0x25')]('['+_0x5c7cd6['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x24e332[_0x2c71('0x3a')]);})[_0x2c71('0x6b')](function(_0x135a8d){logger[_0x2c71('0x69')]('['+_0x5c7cd6[_0x2c71('0x7b')][_0x2c71('0x7c')]()+']',_0x135a8d);});}; \ No newline at end of file +var _0x0529=['Name','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Company','No\x20Company','Caller\x20-\x20%s','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','endUserType','lead','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','sobject','create','User','find','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','execute','length','Contact','first'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x0529,0x1c3));var _0x9052=function(_0x2f5d76,_0x20063c){_0x2f5d76=_0x2f5d76-0x0;var _0x3ae9aa=_0x0529[_0x2f5d76];return _0x3ae9aa;};'use strict';var _=require(_0x9052('0x0'));var rp=require(_0x9052('0x1'));var moment=require(_0x9052('0x2'));var BPromise=require('bluebird');var md5=require(_0x9052('0x3'));var jsforce=require(_0x9052('0x4'));var util=require(_0x9052('0x5'));var Redis=require(_0x9052('0x6'));var intUtil=require(_0x9052('0x7'));var config=require(_0x9052('0x8'));var logger=require(_0x9052('0x9'))(_0x9052('0xa'));config[_0x9052('0xb')]=_[_0x9052('0xc')](config[_0x9052('0xb')],{'host':_0x9052('0xd'),'port':0x18eb});var io=require(_0x9052('0xe'))(new Redis(config['redis']));function emit(_0x4ebf09,_0x249e59,_0x150ce3){io['to'](_0x4ebf09)[_0x9052('0xf')](_0x249e59,_0x150ce3);}function getTicket(_0x30416e,_0x555b72,_0x16d559,_0x4b68ad,_0xeaa128,_0x1dcc7a,_0x4dfdc7,_0x47f397){var _0xff5fb6=Object['assign']({},{'OwnerId':_0x555b72['id'],'Subject':intUtil[_0x9052('0x10')](_0x4b68ad[_0x9052('0x11')],_0xeaa128,'\x20'),'Description':intUtil['getString'](_0x4b68ad[_0x9052('0x12')],_0xeaa128,'\x0a')},getCustomFields(_0x1dcc7a,_0xeaa128));if(_0x16d559){if(_0x4b68ad[_0x9052('0x13')]===_0x9052('0x14')){_0xff5fb6[_0x9052('0x15')]=moment[_0x9052('0x16')]();_0xff5fb6['IsReminderSet']=![];_0xff5fb6['IsRecurrence']=![];if(_0x16d559[_0x9052('0x17')]==='contact'||_0x16d559[_0x9052('0x17')]===_0x9052('0x18')){_0xff5fb6['WhoId']=_0x16d559['id'];}else if(_0x16d559['endUserType']===_0x9052('0x19')){_0xff5fb6[_0x9052('0x1a')]=_0x16d559['id'];}}else if(_0x4b68ad[_0x9052('0x13')]===_0x9052('0x1b')){if(_0x16d559['endUserType']===_0x9052('0x1c')){_0xff5fb6[_0x9052('0x1d')]=_0x16d559['id'];}else if(_0x16d559[_0x9052('0x17')]===_0x9052('0x19')){_0xff5fb6[_0x9052('0x1e')]=_0x16d559['id'];}else if(_0x16d559[_0x9052('0x17')]===_0x9052('0x18')&&_0x4b68ad[_0x9052('0x1f')]){_0xff5fb6[_0x4b68ad[_0x9052('0x1f')]]=_0x16d559['id'];}else{logger[_0x9052('0x20')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4dfdc7[_0x9052('0x21')](_0x4b68ad[_0x9052('0x13')])[_0x9052('0x22')](_0xff5fb6);}function getUser(_0x41d99c,_0x51341d,_0x398012){if(!_['isNil'](_0x51341d)&&intUtil['validateEmail'](_0x51341d)){var _0x25f125={'Email':_0x51341d};var _0x3d70f7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x398012[_0x9052('0x21')](_0x9052('0x23'))[_0x9052('0x24')](_0x25f125,_0x3d70f7)['execute']()['then'](function(_0x55ef8e){if(_0x55ef8e['length']){var _0x1660ef=_[_0x9052('0x24')](_0x55ef8e,function(_0x9cf771){return _0x9cf771['Email']===_0x51341d;});if(_0x1660ef){logger[_0x9052('0x20')](_0x9052('0x25'),_0x51341d);return BPromise[_0x9052('0x26')]({'id':_0x1660ef['Id'],'name':_0x1660ef['Name']});}}else{logger[_0x9052('0x20')](_0x9052('0x27'),_0x51341d);return _0x398012['identity']()[_0x9052('0x28')](function(_0xc4e552){return BPromise[_0x9052('0x26')]({'id':_0xc4e552[_0x9052('0x29')],'name':_0xc4e552['display_name']});});}});}else{logger[_0x9052('0x20')](_0x9052('0x27'),_0x51341d);return _0x398012['identity']()[_0x9052('0x28')](function(_0xe15246){return BPromise[_0x9052('0x26')]({'id':_0xe15246['user_id'],'name':_0xe15246[_0x9052('0x2a')]});});}}function getEndUser(_0x2b6cce,_0x2f8ebf,_0x21b32f,_0x3315fd,_0x4e1920){var _0x22c785={'$or':{'Phone':_0x3315fd}};var _0x3832fa={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9052('0x26')]()[_0x9052('0x28')](function(){logger['info'](_0x9052('0x2b'),_0x3315fd,_0x2f8ebf['moduleSearch']);switch(_0x2f8ebf['moduleSearch']){case'contact_lead':var _0x2768e4=_[_0x9052('0x2c')](_0x22c785);if(_0x2f8ebf[_0x9052('0x2d')]){var _0x21ae73={};_0x21ae73[_0x2f8ebf[_0x9052('0x2d')]]=_0x3315fd;_[_0x9052('0x2e')](_0x2768e4[_0x9052('0x2f')],_0x21ae73);}return _0x4e1920['sobject']('Contact')[_0x9052('0x24')](_0x2768e4,_0x3832fa)['execute']()['then'](function(_0x5e0e29){if(_0x5e0e29&&_0x5e0e29['length']){return _0x5e0e29;}else{var _0x12d2f0=_[_0x9052('0x2c')](_0x22c785);if(_0x2f8ebf[_0x9052('0x30')]){var _0x37e9a4={};_0x37e9a4[_0x2f8ebf[_0x9052('0x30')]]=_0x3315fd;_[_0x9052('0x2e')](_0x12d2f0['$or'],_0x37e9a4);}return _0x4e1920[_0x9052('0x21')](_0x9052('0x31'))[_0x9052('0x24')](_0x12d2f0,_0x3832fa);}});case _0x9052('0x32'):var _0x93be0d=_[_0x9052('0x2c')](_0x22c785);if(_0x2f8ebf['additionalSearchAccount']){var _0x21ae73={};_0x21ae73[_0x2f8ebf[_0x9052('0x33')]]=_0x3315fd;_['merge'](_0x93be0d[_0x9052('0x2f')],_0x21ae73);}return _0x4e1920[_0x9052('0x21')](_0x9052('0x34'))[_0x9052('0x24')](_0x93be0d,_0x3832fa)[_0x9052('0x35')]()[_0x9052('0x28')](function(_0x5a0bee){if(_0x5a0bee&&_0x5a0bee[_0x9052('0x36')]){return _0x5a0bee;}else{var _0x370327=_[_0x9052('0x2c')](_0x22c785);if(_0x2f8ebf[_0x9052('0x2d')]){var _0x4b069d={};_0x4b069d[_0x2f8ebf[_0x9052('0x2d')]]=_0x3315fd;_[_0x9052('0x2e')](_0x370327[_0x9052('0x2f')],_0x4b069d);}return _0x4e1920[_0x9052('0x21')](_0x9052('0x37'))[_0x9052('0x24')](_0x370327,_0x3832fa)[_0x9052('0x28')](function(_0x357156){if(_0x357156&&_0x357156['length']){return _0x357156;}else{var _0x3aa977=_[_0x9052('0x2c')](_0x22c785);if(_0x2f8ebf[_0x9052('0x30')]){var _0x49059c={};_0x49059c[_0x2f8ebf['additionalSearchLead']]=_0x3315fd;_['merge'](_0x3aa977['$or'],_0x49059c);}return _0x4e1920[_0x9052('0x21')](_0x9052('0x31'))[_0x9052('0x24')](_0x3aa977,_0x3832fa);}});}});case _0x9052('0x1c'):var _0x2768e4=_[_0x9052('0x2c')](_0x22c785);if(_0x2f8ebf[_0x9052('0x2d')]){var _0x21ae73={};_0x21ae73[_0x2f8ebf['additionalSearchContact']]=_0x3315fd;_[_0x9052('0x2e')](_0x2768e4[_0x9052('0x2f')],_0x21ae73);}return _0x4e1920['sobject'](_0x9052('0x37'))[_0x9052('0x24')](_0x2768e4,_0x3832fa)[_0x9052('0x35')]();case _0x9052('0x18'):var _0x4c750b=_[_0x9052('0x2c')](_0x22c785);if(_0x2f8ebf['additionalSearchLead']){var _0x21ae73={};_0x21ae73[_0x2f8ebf[_0x9052('0x30')]]=_0x3315fd;_[_0x9052('0x2e')](_0x4c750b[_0x9052('0x2f')],_0x21ae73);}return _0x4e1920[_0x9052('0x21')](_0x9052('0x31'))[_0x9052('0x24')](_0x4c750b,_0x3832fa);case'account':var _0x93be0d=_[_0x9052('0x2c')](_0x22c785);if(_0x2f8ebf['additionalSearchAccount']){var _0x21ae73={};_0x21ae73[_0x2f8ebf['additionalSearchAccount']]=_0x3315fd;_[_0x9052('0x2e')](_0x93be0d[_0x9052('0x2f')],_0x21ae73);}return _0x4e1920[_0x9052('0x21')]('Account')[_0x9052('0x24')](_0x93be0d,_0x3832fa);default:return null;}})[_0x9052('0x28')](function(_0x5c38f6){if(_0x5c38f6&&_0x5c38f6[_0x9052('0x36')]){var _0x5c19c2=_[_0x9052('0x38')](_0x5c38f6);if(_0x5c19c2){return BPromise[_0x9052('0x26')]({'id':_0x5c19c2['Id'],'name':_0x5c19c2[_0x9052('0x39')],'phone':_0x5c19c2[_0x9052('0x3a')],'endUserType':_0x5c19c2[_0x9052('0x3b')]['type'][_0x9052('0x3c')]()});}}})['then'](function(_0x2e3bb4){if(_0x2e3bb4){logger['info'](_0x9052('0x3d'),_0x2e3bb4[_0x9052('0x17')],_0x3315fd);return BPromise[_0x9052('0x26')](_0x2e3bb4);}else{logger[_0x9052('0x20')](_0x9052('0x3e'),_0x3315fd);var _0x760046={'Phone':_0x3315fd};if(_0x2f8ebf[_0x9052('0x3f')]){if(_0x2f8ebf[_0x9052('0x3f')]==='contact'){logger[_0x9052('0x20')](_0x9052('0x40'),_0x3315fd,_0x2f8ebf[_0x9052('0x3f')]);_0x760046[_0x9052('0x41')]=_0x21b32f!==_0x9052('0x42')?_0x21b32f:util[_0x9052('0x43')]('Caller\x20-\x20%s',_0x3315fd);}else if(_0x2f8ebf[_0x9052('0x3f')]===_0x9052('0x18')){logger[_0x9052('0x20')](_0x9052('0x40'),_0x3315fd,_0x2f8ebf[_0x9052('0x3f')]);_0x760046[_0x9052('0x41')]=_0x21b32f!==_0x9052('0x42')?_0x21b32f:util[_0x9052('0x43')]('Caller\x20-\x20%s',_0x3315fd);_0x760046[_0x9052('0x44')]=_0x9052('0x45');}else if(_0x2f8ebf[_0x9052('0x3f')]===_0x9052('0x19')){logger['info'](_0x9052('0x40'),_0x3315fd,_0x2f8ebf[_0x9052('0x3f')]);_0x760046[_0x9052('0x39')]=_0x21b32f!==_0x9052('0x42')?_0x21b32f:util[_0x9052('0x43')](_0x9052('0x46'),_0x3315fd);}else{return null;}}return _0x4e1920['sobject'](_['upperFirst'](_0x2f8ebf[_0x9052('0x3f')]))[_0x9052('0x22')](_0x760046)['then'](function(_0x4ec6ce){return BPromise[_0x9052('0x26')]({'id':_0x4ec6ce['id'],'endUserType':_0x2f8ebf[_0x9052('0x3f')]});});}});}function getCustomFields(_0x21c9ab,_0x42639e){var _0x2b291e={};if(_0x21c9ab[_0x9052('0x36')]>0x0){_[_0x9052('0x47')](_0x21c9ab,function(_0x109f0d){if(_[_0x9052('0x48')]([_0x9052('0x49'),_0x9052('0x4a')],_0x109f0d[_0x9052('0x4b')])&&_0x109f0d[_0x9052('0x4c')]){_0x2b291e[_0x109f0d[_0x9052('0x4c')]]=_0x109f0d['content'][_0x9052('0x4d')]();}else if(_0x109f0d[_0x9052('0x4b')]==='variable'&&_0x109f0d[_0x9052('0x4e')]&&_0x109f0d[_0x9052('0x4c')]){_0x42639e[_0x109f0d['variableName']]&&(_0x2b291e[_0x109f0d[_0x9052('0x4c')]]=_0x42639e[_0x109f0d[_0x9052('0x4e')]][_0x9052('0x4d')]());}else if(_0x109f0d['type']==='customVariable'&&_0x109f0d[_0x9052('0x4f')]&&_0x109f0d[_0x9052('0x4f')][_0x9052('0x50')]&&_0x109f0d[_0x9052('0x4c')]){_0x42639e[_0x109f0d['Variable'][_0x9052('0x50')]['toLowerCase']()]&&(_0x2b291e[_0x109f0d['idField']]=_0x42639e[_0x109f0d[_0x9052('0x4f')][_0x9052('0x50')][_0x9052('0x3c')]()][_0x9052('0x4d')]());}});}return _0x2b291e;}function getConnection(_0x385d02){var _0x236f4f=_0x385d02[_0x9052('0x51')][_0x9052('0x52')](_0x385d02[_0x9052('0x53')]);var _0x506610=new jsforce['Connection']({'oauth2':{'loginUrl':_0x385d02[_0x9052('0x54')]||_0x9052('0x55'),'clientId':_0x385d02[_0x9052('0x56')],'clientSecret':_0x385d02['clientSecret']}});return _0x506610[_0x9052('0x57')](_0x385d02[_0x9052('0x58')],_0x236f4f)[_0x9052('0x28')](function(){logger[_0x9052('0x20')](_0x9052('0x59'));return _0x506610;});}exports[_0x9052('0x5a')]=function(_0x4bc126,_0xe9b256,_0x168e5e,_0x39c4c1,_0x593b3c,_0x1f58f6){var _0xf2d6b5,_0x154685,_0x570539,_0x3de9b8;_0x1f58f6[_0x9052('0x5b')]=intUtil[_0x9052('0x5c')](_0x1f58f6[_0x9052('0x5b')]);_0x1f58f6[_0x9052('0x54')]=intUtil['stripTrailingSlash'](_0x1f58f6['remoteUri']);if(_0x593b3c&&_0x593b3c['monitor_format']){logger[_0x9052('0x20')](_0x9052('0x5d'),'Recording\x20is\x20enabled!');_0xe9b256[_0x9052('0x5e')]=util[_0x9052('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f58f6[_0x9052('0x5b')],_0xe9b256[_0x9052('0x5f')],md5(_0xe9b256[_0x9052('0x5f')]));}else{_0xe9b256[_0x9052('0x5e')]='';}return getConnection(_0x1f58f6)['then'](function(_0x1abf74){_0x3de9b8=_0x1abf74;return getUser(_0x1f58f6,_0x39c4c1[_0x9052('0x60')],_0x3de9b8);})['then'](function(_0x33d3b2){_0xf2d6b5=_0x33d3b2;return getEndUser(_0x1f58f6,_0x168e5e,_0xe9b256[_0x9052('0x61')],_0xe9b256[_0x9052('0x62')],_0x3de9b8);})['then'](function(_0x260f69){_0x154685=_0x260f69;return getTicket(_0x1f58f6,_0xf2d6b5,_0x154685,_0x168e5e,_0xe9b256,_0x168e5e[_0x9052('0x63')],_0x3de9b8,_0x9052('0x5a'));})['then'](function(_0x2a2e6f){_0x570539=_0x2a2e6f;logger[_0x9052('0x20')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x570539['id']);logger[_0x9052('0x20')](_0x9052('0x64'),_0x570539['id'],_0x39c4c1[_0x9052('0x50')],_0x1f58f6['type']);switch(_0x1f58f6['type']){case _0x9052('0x65'):emit(util['format'](_0x9052('0x66'),_0x39c4c1[_0x9052('0x50')]),'trigger:salesforce:display',{'recordId':_0x570539['id']});break;case _0x9052('0x67'):emit(util[_0x9052('0x43')](_0x9052('0x66'),_0x39c4c1[_0x9052('0x50')]),_0x9052('0x68'),{'uri':util['format']('%s/%s/e',_0x3de9b8[_0x9052('0x69')],_0x570539['id'])});break;default:logger[_0x9052('0x6a')](_0x9052('0x6b'));}})[_0x9052('0x6c')](function(_0x48dc6c){logger[_0x9052('0x6a')](_0x9052('0x5d'),_0x48dc6c);});};exports['outbound']=function(_0x4fe24e,_0xd13120,_0x11e182,_0x3dcde3,_0x264f07,_0x2f980d,_0x59b4fa){var _0x58c061,_0x3dbc8d,_0xafae34,_0x5899be;_0x2f980d[_0x9052('0x5b')]=intUtil['stripTrailingSlash'](_0x2f980d['serverUrl']);_0x2f980d[_0x9052('0x54')]=intUtil['stripTrailingSlash'](_0x2f980d[_0x9052('0x54')]);if(_0x59b4fa&&_0x59b4fa['recordingFormat']&&_0x59b4fa[_0x9052('0x6d')]!==_0x9052('0x6e')){logger[_0x9052('0x20')](_0x9052('0x6f'),_0x9052('0x70'));_0xd13120[_0x9052('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f980d[_0x9052('0x5b')],_0xd13120[_0x9052('0x5f')],md5(_0xd13120[_0x9052('0x5f')]));}return getConnection(_0x2f980d)[_0x9052('0x28')](function(_0xaf3af9){_0x5899be=_0xaf3af9;return getUser(_0x2f980d,_0x3dcde3['email'],_0x5899be);})['then'](function(_0x57b5c5){_0x58c061=_0x57b5c5;return getEndUser(_0x2f980d,_0x11e182,_0xd13120[_0x9052('0x71')],_0xd13120[_0x9052('0x72')],_0x5899be);})['then'](function(_0x2a2fef){_0x3dbc8d=_0x2a2fef;return getTicket(_0x2f980d,_0x58c061,_0x3dbc8d,_0x11e182,_0xd13120,_0x11e182[_0x9052('0x63')],_0x5899be,_0x9052('0x73'));})[_0x9052('0x28')](function(_0xd54c2){_0xafae34=_0xd54c2;logger[_0x9052('0x20')](_0x9052('0x74'),_0xafae34['id']);logger['info'](_0x9052('0x75'),_0xafae34['id'],_0x3dcde3[_0x9052('0x50')],_0x2f980d[_0x9052('0x4b')]);switch(_0x2f980d[_0x9052('0x4b')]){case _0x9052('0x65'):emit(util[_0x9052('0x43')](_0x9052('0x66'),_0x3dcde3[_0x9052('0x50')]),_0x9052('0x76'),{'recordId':_0xafae34['id']});break;case _0x9052('0x67'):emit(util[_0x9052('0x43')]('user:%s',_0x3dcde3['name']),_0x9052('0x68'),{'uri':util['format'](_0x9052('0x77'),_0x5899be[_0x9052('0x69')],_0xafae34['id'])});break;default:logger['error'](_0x9052('0x6f'),_0x9052('0x78'));}})[_0x9052('0x6c')](function(_0x1fabeb){logger[_0x9052('0x6a')](_0x9052('0x6f'),_0x1fabeb);});};exports[_0x9052('0x79')]=function(_0x1e8bb4,_0x4c8ec4,_0x6e28c4,_0x59059b,_0x1ce613,_0xf6484d){var _0x161a98,_0xc6d17f,_0x5c29cd,_0x53a71a;_0xf6484d[_0x9052('0x5b')]=intUtil[_0x9052('0x5c')](_0xf6484d[_0x9052('0x5b')]);_0xf6484d[_0x9052('0x54')]=intUtil[_0x9052('0x5c')](_0xf6484d['remoteUri']);if(_0x1ce613&&_0x1ce613[_0x9052('0x7a')]){logger[_0x9052('0x20')]('['+_0x4c8ec4[_0x9052('0x7b')][_0x9052('0x7c')]()+']','Recording\x20is\x20enabled!');_0x4c8ec4[_0x9052('0x5e')]=util[_0x9052('0x43')](_0x9052('0x7d'),_0xf6484d['serverUrl'],_0x4c8ec4[_0x9052('0x5f')],md5(_0x4c8ec4[_0x9052('0x5f')]));}else{_0x4c8ec4[_0x9052('0x5e')]='';}return getConnection(_0xf6484d)[_0x9052('0x28')](function(_0x58ddbf){_0x53a71a=_0x58ddbf;if(!_['isNil'](_0x59059b)){return getUser(_0xf6484d,_0x59059b[_0x9052('0x50')],_0x53a71a);}else{return getUser(_0xf6484d,null,_0x53a71a);}})[_0x9052('0x28')](function(_0x95e34b){_0x161a98=_0x95e34b;return getEndUser(_0xf6484d,_0x6e28c4,_0x4c8ec4[_0x9052('0x61')],_0x4c8ec4[_0x9052('0x62')],_0x53a71a);})['then'](function(_0x1dc322){_0xc6d17f=_0x1dc322;return getTicket(_0xf6484d,_0x161a98,_0xc6d17f,_0x6e28c4,_0x4c8ec4,_0x6e28c4[_0x9052('0x63')],_0x53a71a);})[_0x9052('0x28')](function(_0x266698){_0x5c29cd=_0x266698;logger[_0x9052('0x20')]('['+_0x4c8ec4['lastevent'][_0x9052('0x7c')]()+']\x20Ticket\x20%s\x20created.',_0x5c29cd['id']);logger[_0x9052('0x20')]('['+_0x4c8ec4[_0x9052('0x7b')][_0x9052('0x7c')]()+_0x9052('0x7e'),_0xf6484d[_0x9052('0x4b')]);})['catch'](function(_0x323a13){logger['error']('['+_0x4c8ec4[_0x9052('0x7b')][_0x9052('0x7c')]()+']',_0x323a13);});}; \ 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 76bb07f..f993947 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 _0x4bff=['email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','serverUrl','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','adminId','result','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','length','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','nameField','customField','content','toString','includes','picklist','type','idField','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','Subjects','Descriptions','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','isNil'];(function(_0x5afcfe,_0x535b97){var _0x186f74=function(_0x14fd87){while(--_0x14fd87){_0x5afcfe['push'](_0x5afcfe['shift']());}};_0x186f74(++_0x535b97);}(_0x4bff,0x7f));var _0xf4bf=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x4bff[_0x48b810];return _0x23c17d;};'use strict';var _=require(_0xf4bf('0x0'));var Promise=require(_0xf4bf('0x1'));var rp=require(_0xf4bf('0x2'));var util=require(_0xf4bf('0x3'));var md5=require(_0xf4bf('0x4'));var Redis=require('ioredis');var intUtil=require(_0xf4bf('0x5'));var config=require(_0xf4bf('0x6'));var logger=require(_0xf4bf('0x7'))(_0xf4bf('0x8'));config[_0xf4bf('0x9')]=_[_0xf4bf('0xa')](config['redis'],{'host':_0xf4bf('0xb'),'port':0x18eb});var io=require(_0xf4bf('0xc'))(new Redis(config['redis']));function getAdminUser(_0x40584e,_0x4a120c,_0x496359,_0x55627b,_0x5b8061,_0x546134){return new Promise(function(_0x2ff067,_0x561a94){var _0x314469={'method':_0xf4bf('0xd'),'uri':_0x55627b+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5b8061+'&'+_0x546134,'auth':_0x4a120c,'json':!![]};return rp(_0x314469)[_0xf4bf('0xe')](function(_0x3e7277){if(_0x3e7277['result']['length']>0x0){_0x496359[_0xf4bf('0xf')]=_0x3e7277[_0xf4bf('0x10')][0x0][_0xf4bf('0x11')];}logger[_0xf4bf('0x12')]('['+[_0x40584e['toUpperCase']()]+_0xf4bf('0x13'),_0x496359);_0x2ff067(_0x496359);})[_0xf4bf('0x14')](function(_0x1cafc7){logger[_0xf4bf('0x15')]('['+[_0x40584e[_0xf4bf('0x16')]()]+']',_0x1cafc7[_0xf4bf('0x17')]);_0x561a94(_0x1cafc7['message']);});});}function getUser(_0x4d2449,_0x5d5c93,_0xd5b3af,_0x3a39c4,_0x4969eb){return function(_0x5e09ba){logger[_0xf4bf('0x12')]('['+[_0x4d2449[_0xf4bf('0x16')]()]+_0xf4bf('0x18'),_0x5e09ba);return new Promise(function(_0x53d7b0,_0x223def){if(intUtil[_0xf4bf('0x19')](_0x5e09ba[_0xf4bf('0x1a')])){var _0x5e83a9={'method':'GET','uri':_0xd5b3af+_0xf4bf('0x1b')+_0x5e09ba[_0xf4bf('0x1a')]+'&'+_0x3a39c4+'&'+_0x4969eb,'auth':_0x5d5c93,'json':!![]};logger[_0xf4bf('0x12')]('['+[_0x4d2449[_0xf4bf('0x16')]()]+'],\x20getUser\x20rp\x20obj',_0x5e83a9);return rp(_0x5e83a9)[_0xf4bf('0xe')](function(_0x5d14ed){logger['info']('['+[_0x4d2449[_0xf4bf('0x16')]()]+'],\x20getUser\x20entity',_0x5d14ed);if(_0x5d14ed['result'][_0xf4bf('0x1c')]>0x0&&String(_0x5d14ed[_0xf4bf('0x10')][0x0]['active'])==='true'){_0x5e09ba['userId']=_0x5d14ed['result'][0x0][_0xf4bf('0x11')];}else{_0x5e09ba[_0xf4bf('0x1d')]=_0x5e09ba[_0xf4bf('0xf')];_0x5e09ba['userEmail']=_0x5e09ba['adminEmail'];}logger[_0xf4bf('0x12')]('['+[_0x4d2449[_0xf4bf('0x16')]()]+_0xf4bf('0x1e'),_0x5e09ba);_0x53d7b0(_0x5e09ba);})[_0xf4bf('0x14')](function(_0x2260b2){logger['error']('['+[_0x4d2449[_0xf4bf('0x16')]()]+']',_0x2260b2[_0xf4bf('0x17')]);_0x223def(_0x2260b2[_0xf4bf('0x17')]);});}else{logger[_0xf4bf('0x12')]('['+[_0x4d2449[_0xf4bf('0x16')]()]+_0xf4bf('0x1f'));_0x5e09ba['userId']=_0x5e09ba['adminId'];_0x5e09ba['userEmail']=_0x5e09ba[_0xf4bf('0x20')];_0x53d7b0(_0x5e09ba);}});};}function createEndUser(_0x47acc6,_0x41e2c9,_0xe0f478,_0x2c8749,_0x24d4a3){logger[_0xf4bf('0x12')]('['+[_0x47acc6[_0xf4bf('0x16')]()]+_0xf4bf('0x21'),_0xe0f478);return new Promise(function(_0x10bee8,_0x1836ca){var _0x3825b5={'method':_0xf4bf('0x22'),'uri':_0x2c8749+_0xf4bf('0x23')+_0x24d4a3,'body':{'user_name':_0xe0f478[_0xf4bf('0x24')],'roles':'user','first_name':_0xe0f478[_0xf4bf('0x24')],'active':_0xf4bf('0x25'),'date_format':_0xf4bf('0x26'),'phone':_0xe0f478[_0xf4bf('0x24')]},'auth':_0x41e2c9,'json':!![]};return rp(_0x3825b5)[_0xf4bf('0xe')](function(_0xae9134){logger[_0xf4bf('0x12')]('['+[_0x47acc6[_0xf4bf('0x16')]()]+_0xf4bf('0x27'),_0xae9134['result']);_0xe0f478[_0xf4bf('0x28')]=_0xae9134[_0xf4bf('0x10')][_0xf4bf('0x11')];_0x10bee8(_0xe0f478);})[_0xf4bf('0x14')](function(_0x57ad80){logger[_0xf4bf('0x15')]('['+[_0x47acc6[_0xf4bf('0x16')]()]+']',_0x57ad80[_0xf4bf('0x17')]);_0x1836ca(_0x57ad80[_0xf4bf('0x17')]);});});}function getEndUser(_0x5e7742,_0x58b303,_0x5cfd38,_0x1b4974,_0x235b0f){return function(_0x51cd0c){logger[_0xf4bf('0x12')]('['+[_0x5e7742['toUpperCase']()]+_0xf4bf('0x29'),_0x51cd0c);return new Promise(function(_0x7d359a,_0x24fd73){var _0x1092ae={'method':_0xf4bf('0xd'),'uri':_0x5cfd38+_0xf4bf('0x2a')+_0x51cd0c['endUserNumber']+'&'+_0x1b4974+'&'+_0x235b0f,'auth':_0x58b303,'json':!![]};return rp(_0x1092ae)['then'](function(_0x1d1ea3){if(_0x1d1ea3[_0xf4bf('0x10')][_0xf4bf('0x1c')]>0x0){_0x51cd0c['endUserId']=_0x1d1ea3[_0xf4bf('0x10')][0x0][_0xf4bf('0x11')];logger['info']('['+[_0x5e7742[_0xf4bf('0x16')]()]+_0xf4bf('0x2b'),_0x51cd0c);_0x7d359a(_0x51cd0c);}else{return createEndUser(_0x5e7742,_0x58b303,_0x51cd0c,_0x5cfd38,_0x1b4974)[_0xf4bf('0xe')](function(_0x4a2ec5){logger[_0xf4bf('0x12')]('['+[_0x5e7742[_0xf4bf('0x16')]()]+_0xf4bf('0x2c'),_0x4a2ec5);_0x7d359a(_0x4a2ec5);});}})[_0xf4bf('0x14')](function(_0x486218){logger[_0xf4bf('0x15')]('['+[_0x5e7742[_0xf4bf('0x16')]()]+']',_0x486218[_0xf4bf('0x17')]);_0x24fd73(_0x486218[_0xf4bf('0x17')]);});});};}function getCustomFields(_0x1a0303,_0x32bf84){var _0x28ae06={};if(_0x1a0303[_0xf4bf('0x1c')]>0x0){_[_0xf4bf('0x2d')](_0x1a0303,function(_0x4518f6){if(_['includes']([_0xf4bf('0x2e'),'picklist'],_0x4518f6['type'])&&_0x4518f6[_0xf4bf('0x2f')]&&!_0x4518f6[_0xf4bf('0x30')]){_0x28ae06[_0x4518f6['nameField']['toLowerCase']()]=_0x4518f6[_0xf4bf('0x31')][_0xf4bf('0x32')]();}else if(_[_0xf4bf('0x33')]([_0xf4bf('0x2e'),_0xf4bf('0x34')],_0x4518f6[_0xf4bf('0x35')])&&_0x4518f6[_0xf4bf('0x36')]&&_0x4518f6[_0xf4bf('0x30')]){_0x28ae06[_0x4518f6['idField'][_0xf4bf('0x37')]()]=_0x4518f6[_0xf4bf('0x31')][_0xf4bf('0x32')]();}else if(_0x4518f6[_0xf4bf('0x35')]===_0xf4bf('0x38')&&_0x4518f6[_0xf4bf('0x39')]&&_0x4518f6[_0xf4bf('0x36')]&&_0x4518f6['customField']){_0x28ae06[_0x4518f6[_0xf4bf('0x36')]['toLowerCase']()]=_0x32bf84[_0x4518f6[_0xf4bf('0x39')]][_0xf4bf('0x32')]();}else if(_0x4518f6[_0xf4bf('0x35')]==='customVariable'&&_0x4518f6[_0xf4bf('0x3a')]&&_0x4518f6[_0xf4bf('0x3a')][_0xf4bf('0x3b')]&&_0x4518f6[_0xf4bf('0x36')]&&_0x4518f6[_0xf4bf('0x30')]){_0x28ae06[_0x4518f6[_0xf4bf('0x36')]['toLowerCase']()]=_0x32bf84[_0x4518f6[_0xf4bf('0x3a')]['name'][_0xf4bf('0x37')]()][_0xf4bf('0x32')]();}});}return _0x28ae06;}function getTicket(_0x27e36f,_0x25c5bd,_0x537004,_0x3771a5,_0xf055a6,_0x46f0ce){return function(_0x1f3cec){logger[_0xf4bf('0x12')]('['+[_0x27e36f[_0xf4bf('0x16')]()]+_0xf4bf('0x3c'),_0x1f3cec);return new Promise(function(_0x1f59eb,_0x6d7899){var _0x50709f=_0x27e36f[_0xf4bf('0x37')]()===_0xf4bf('0x3d')?_0x1f3cec['userId']:_0x1f3cec[_0xf4bf('0x28')];var _0x416dff={'method':_0xf4bf('0x22'),'uri':_0x537004+'incident'+'?'+_0x46f0ce,'body':Object[_0xf4bf('0x3e')]({},{'active':_0xf4bf('0x25'),'caller_id':_0x50709f,'assigned_to':_0x1f3cec[_0xf4bf('0x1d')],'short_description':intUtil['getString'](_0x3771a5[_0xf4bf('0x3f')],_0xf055a6,'\x20'),'description':intUtil['getString'](_0x3771a5[_0xf4bf('0x40')],_0xf055a6,'\x0a')},getCustomFields(_0x3771a5['Fields'],_0xf055a6)),'auth':_0x25c5bd,'json':!![]};return rp(_0x416dff)[_0xf4bf('0xe')](function(_0x1c3f26){logger[_0xf4bf('0x12')]('['+[_0x27e36f[_0xf4bf('0x16')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x1c3f26[_0xf4bf('0x10')]);_0x1f3cec[_0xf4bf('0x41')]=_0x1c3f26['result'][_0xf4bf('0x11')];_0x1f3cec['ticketNumber']=_0x1c3f26[_0xf4bf('0x10')][_0xf4bf('0x42')];logger[_0xf4bf('0x12')]('['+[_0x27e36f[_0xf4bf('0x16')]()]+_0xf4bf('0x43'),_0x1f3cec);_0x1f59eb(_0x1f3cec);})[_0xf4bf('0x14')](function(_0x354b0b){logger[_0xf4bf('0x15')]('['+[_0x27e36f[_0xf4bf('0x16')]()]+']',_0x354b0b[_0xf4bf('0x17')]);_0x6d7899(_0x354b0b['message']);});});};}function createRemoteTag(_0x56b719,_0x468df7,_0x39f45e,_0x5b8f60){return new Promise(function(_0x30eb5,_0x3aebc4){var _0x3aa6dc={'method':_0xf4bf('0x22'),'uri':_0x39f45e+'label'+'?'+_0x5b8f60,'body':{'short_description':_0x56b719,'global':!![],'active':!![],'name':_0x56b719},'auth':_0x468df7,'json':!![]};return rp(_0x3aa6dc)['then'](function(_0x5e4856){var _0xc0fb1f=_0x5e4856['result'][_0xf4bf('0x11')];_0x30eb5(_0xc0fb1f);});});}function getRemoteTag(_0x83a43f,_0x2eaca3,_0x5a9172,_0x152dce,_0x4e238d){return new Promise(function(_0x511675,_0x1b536d){var _0x31291b={'method':_0xf4bf('0xd'),'uri':_0x5a9172+_0xf4bf('0x44')+_0xf4bf('0x45')+_0x83a43f+'&'+_0x152dce,'auth':_0x2eaca3,'json':!![]};return rp(_0x31291b)[_0xf4bf('0xe')](function(_0x4811a4){if(_0x4811a4[_0xf4bf('0x10')][_0xf4bf('0x1c')]>0x0){var _0x3d652d=_0x4811a4[_0xf4bf('0x10')][0x0][_0xf4bf('0x11')];_0x511675(_0x3d652d);}else{return createRemoteTag(_0x83a43f,_0x2eaca3,_0x5a9172,_0x152dce)[_0xf4bf('0xe')](function(_0x1383c3){_0x511675(_0x1383c3);});}});});}function assignTagToIncident(_0x1a5431,_0x130442,_0x2e9669,_0x513c35,_0x58c851){return new Promise(function(_0x9a629a,_0x486e85){var _0x3563a9={'method':'POST','uri':_0x2e9669+_0xf4bf('0x46')+'?'+_0x58c851,'body':{'label':_0x1a5431,'table':_0xf4bf('0x47'),'id_type':_0xf4bf('0x48'),'table_key':_0x513c35[_0xf4bf('0x41')],'title':'Incident\x20-\x20'+_0x513c35[_0xf4bf('0x49')],'id_display':_0x513c35[_0xf4bf('0x49')]},'auth':_0x130442,'json':!![]};return rp(_0x3563a9)[_0xf4bf('0xe')](function(_0x21dfcc){_0x9a629a();})[_0xf4bf('0x14')](function(){_0x9a629a();});});}function manageTags(_0x537948,_0x2b65af,_0x327b2c,_0x5e4b02,_0x3695cb,_0x2d59dc,_0x2247dd){return new Promise(function(_0x287aab,_0x550433){var _0x5ab4c4=[];_0x2b65af[_0xf4bf('0x2d')](function(_0x46ab5e){_0x5ab4c4['push'](getRemoteTag(_0x46ab5e,_0x327b2c,_0x5e4b02,_0x2d59dc,_0x2247dd));});return Promise[_0xf4bf('0x4a')](_0x5ab4c4)[_0xf4bf('0xe')](function(_0x3057ca){if(_0x3057ca[_0xf4bf('0x1c')]){logger[_0xf4bf('0x12')]('['+[_0x537948[_0xf4bf('0x16')]()]+_0xf4bf('0x4b'),_0x3057ca);var _0x498410=[];_0x3057ca[_0xf4bf('0x2d')](function(_0x420d38){_0x498410[_0xf4bf('0x4c')](assignTagToIncident(_0x420d38,_0x327b2c,_0x5e4b02,_0x3695cb,_0x2d59dc));});return Promise[_0xf4bf('0x4a')](_0x498410)[_0xf4bf('0xe')](function(){_0x287aab();})[_0xf4bf('0x14')](function(){_0x287aab();});}else{_0x287aab();}});});}function getTags(_0x2b49f2,_0x4fca8d,_0x2526fe,_0x2042a4,_0x18ee24,_0x45875c){return function(_0x590ffb){return new Promise(function(_0x47fb7d,_0x54e84a){var _0x52fa6f=[];var _0x4b09d9=_0x2042a4[_0xf4bf('0x4d')];if(_0x4b09d9&&_0x4b09d9[_0xf4bf('0x1c')]>0x0){_0x52fa6f=_[_0xf4bf('0x4e')](_0x4b09d9,_0xf4bf('0x3b'));}if(_0x52fa6f['length']>0x0){return manageTags(_0x2b49f2,_0x52fa6f,_0x4fca8d,_0x2526fe,_0x590ffb,_0x18ee24,_0x45875c)[_0xf4bf('0xe')](function(){_0x47fb7d(_0x590ffb);});}else{_0x47fb7d(_0x590ffb);}});};}function emit(_0xecb150,_0x353422,_0x5dcad2){var _0x149a68=_0xf4bf('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xf4bf('0x50')+_0xf4bf('0x51');var _0x361622={'uri':_0xecb150+_0xf4bf('0x52')+_0x5dcad2+_0x149a68};io['to'](util[_0xf4bf('0x53')]('user:%s',_0x353422))[_0xf4bf('0x54')](_0xf4bf('0x55'),_0x361622);}exports['cs']=function(_0x212d91,_0x1410f8,_0x4138b3,_0x414fa1,_0x21051a,_0x319892,_0x56f1e1,_0x27d26f){var _0x466d94={};var _0x5a5ba3={'user':_0x319892[_0xf4bf('0x56')],'pass':_0x319892[_0xf4bf('0x57')]};var _0x4581c3=_0xf4bf('0x58');var _0x35ef8b=_0xf4bf('0x59');_0x319892[_0xf4bf('0x5a')]=intUtil['stripTrailingSlash'](_0x319892['remoteUri']);_0x319892['serverUrl']=intUtil[_0xf4bf('0x5b')](_0x319892['serverUrl']);var _0x498696=util[_0xf4bf('0x53')]('%s/api/now/table/',_0x319892[_0xf4bf('0x5a')]);_0x466d94[_0xf4bf('0x1a')]=!_[_0xf4bf('0x5c')](_0x414fa1)?_0x414fa1[_0xf4bf('0x5d')]:null;_0x466d94[_0xf4bf('0x20')]=_0x319892[_0xf4bf('0x5d')];_0x466d94[_0xf4bf('0x24')]=_0x27d26f[_0xf4bf('0x37')]()===_0xf4bf('0x3d')?_0x1410f8[_0xf4bf('0x5e')]:_0x1410f8[_0xf4bf('0x5f')];_0x466d94[_0xf4bf('0x60')]=_0x27d26f===_0xf4bf('0x61')||_0x27d26f===_0xf4bf('0x62')?'queue':_0xf4bf('0x3d');var _0x369fec=util[_0xf4bf('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x319892[_0xf4bf('0x63')],_0x1410f8[_0xf4bf('0x64')],md5(_0x1410f8['uniqueid']));if(_0x21051a&&_0x21051a['monitor_format']){logger[_0xf4bf('0x12')](_0xf4bf('0x65'),_0xf4bf('0x66'));_0x1410f8[_0xf4bf('0x67')]=_0x369fec;}else if(_0x56f1e1&&_0x56f1e1[_0xf4bf('0x68')]&&_0x56f1e1[_0xf4bf('0x68')]!==_0xf4bf('0x69')){logger[_0xf4bf('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1410f8[_0xf4bf('0x67')]=_0x369fec;}else{_0x1410f8[_0xf4bf('0x67')]='';}return getAdminUser(_0x27d26f,_0x5a5ba3,_0x466d94,_0x498696,_0x35ef8b,_0x4581c3)[_0xf4bf('0xe')](getUser(_0x27d26f,_0x5a5ba3,_0x498696,_0x35ef8b,_0x4581c3))['then'](getEndUser(_0x27d26f,_0x5a5ba3,_0x498696,_0x35ef8b,_0x4581c3))[_0xf4bf('0xe')](getTicket(_0x27d26f,_0x5a5ba3,_0x498696,_0x4138b3,_0x1410f8,_0x35ef8b))[_0xf4bf('0xe')](function(_0x23bff4){logger[_0xf4bf('0x12')](util['format'](_0xf4bf('0x6a'),_0x23bff4[_0xf4bf('0x41')]));logger[_0xf4bf('0x12')](util['format'](_0xf4bf('0x6b'),_0x27d26f));if(_0x27d26f!==_0xf4bf('0x62')){logger[_0xf4bf('0x12')]('['+[_0x27d26f[_0xf4bf('0x16')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x319892[_0xf4bf('0x5a')],_0x414fa1[_0xf4bf('0x3b')],_0x23bff4[_0xf4bf('0x41')]);}})[_0xf4bf('0x14')](function(_0x28caf8){logger[_0xf4bf('0x15')]('['+[_0x27d26f[_0xf4bf('0x16')]()]+_0xf4bf('0x6c'),util[_0xf4bf('0x6d')](_0x28caf8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe347=['picklist','type','content','toString','string','variable','variableName','idField','toLowerCase','customVariable','Variable','name','customField','incident','Subjects','getString','Descriptions','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','./util','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','then','],\x20EndUser\x20schema','endUserId','error','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe347,0x185));var _0x7e34=function(_0x4da356,_0x5235e1){_0x4da356=_0x4da356-0x0;var _0x321b07=_0xe347[_0x4da356];return _0x321b07;};'use strict';var _=require(_0x7e34('0x0'));var Promise=require(_0x7e34('0x1'));var rp=require('request-promise');var util=require(_0x7e34('0x2'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x7e34('0x3'));var config=require('../../../../config/environment');var logger=require(_0x7e34('0x4'))(_0x7e34('0x5'));config[_0x7e34('0x6')]=_[_0x7e34('0x7')](config['redis'],{'host':_0x7e34('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7e34('0x6')]));function getAdminUser(_0x213ad5,_0x12c5e3,_0x5ca518,_0xa79816,_0x20153a,_0x4bcc3d){return new Promise(function(_0x1ffb36,_0x297364){var _0x2c4039={'method':_0x7e34('0x9'),'uri':_0xa79816+_0x7e34('0xa')+'&'+_0x20153a+'&'+_0x4bcc3d,'auth':_0x12c5e3,'json':!![]};return rp(_0x2c4039)['then'](function(_0x569412){if(_0x569412[_0x7e34('0xb')][_0x7e34('0xc')]>0x0){_0x5ca518[_0x7e34('0xd')]=_0x569412['result'][0x0][_0x7e34('0xe')];}logger['info']('['+[_0x213ad5[_0x7e34('0xf')]()]+_0x7e34('0x10'),_0x5ca518);_0x1ffb36(_0x5ca518);})[_0x7e34('0x11')](function(_0x11d13f){logger['error']('['+[_0x213ad5['toUpperCase']()]+']',_0x11d13f[_0x7e34('0x12')]);_0x297364(_0x11d13f['message']);});});}function getUser(_0x37c718,_0x1573d4,_0x44aced,_0x183938,_0x468fb2){return function(_0x3eca28){logger[_0x7e34('0x13')]('['+[_0x37c718[_0x7e34('0xf')]()]+_0x7e34('0x14'),_0x3eca28);return new Promise(function(_0x1470f5,_0x33f3e7){if(intUtil[_0x7e34('0x15')](_0x3eca28['userEmail'])){var _0x46db40={'method':'GET','uri':_0x44aced+_0x7e34('0x16')+_0x3eca28['userEmail']+'&'+_0x183938+'&'+_0x468fb2,'auth':_0x1573d4,'json':!![]};logger[_0x7e34('0x13')]('['+[_0x37c718[_0x7e34('0xf')]()]+_0x7e34('0x17'),_0x46db40);return rp(_0x46db40)['then'](function(_0x21a541){logger['info']('['+[_0x37c718[_0x7e34('0xf')]()]+_0x7e34('0x18'),_0x21a541);if(_0x21a541['result'][_0x7e34('0xc')]>0x0&&String(_0x21a541[_0x7e34('0xb')][0x0]['active'])===_0x7e34('0x19')){_0x3eca28[_0x7e34('0x1a')]=_0x21a541['result'][0x0][_0x7e34('0xe')];}else{_0x3eca28[_0x7e34('0x1a')]=_0x3eca28[_0x7e34('0xd')];_0x3eca28['userEmail']=_0x3eca28[_0x7e34('0x1b')];}logger[_0x7e34('0x13')]('['+[_0x37c718['toUpperCase']()]+'],\x20getUser\x20crm',_0x3eca28);_0x1470f5(_0x3eca28);})[_0x7e34('0x11')](function(_0x52136c){logger['error']('['+[_0x37c718['toUpperCase']()]+']',_0x52136c[_0x7e34('0x12')]);_0x33f3e7(_0x52136c[_0x7e34('0x12')]);});}else{logger[_0x7e34('0x13')]('['+[_0x37c718[_0x7e34('0xf')]()]+_0x7e34('0x1c'));_0x3eca28[_0x7e34('0x1a')]=_0x3eca28['adminId'];_0x3eca28['userEmail']=_0x3eca28['adminEmail'];_0x1470f5(_0x3eca28);}});};}function createEndUser(_0x26d3ab,_0x5bf44e,_0x49f209,_0x27df0d,_0x4b3ee0){logger[_0x7e34('0x13')]('['+[_0x26d3ab[_0x7e34('0xf')]()]+_0x7e34('0x1d'),_0x49f209);return new Promise(function(_0x3a15b7,_0x32398d){var _0x5eabbc={'method':'POST','uri':_0x27df0d+_0x7e34('0x1e')+_0x4b3ee0,'body':{'user_name':_0x49f209[_0x7e34('0x1f')],'roles':_0x7e34('0x20'),'first_name':_0x49f209[_0x7e34('0x1f')],'active':'true','date_format':_0x7e34('0x21'),'phone':_0x49f209['endUserNumber']},'auth':_0x5bf44e,'json':!![]};return rp(_0x5eabbc)[_0x7e34('0x22')](function(_0x4d036e){logger['info']('['+[_0x26d3ab[_0x7e34('0xf')]()]+_0x7e34('0x23'),_0x4d036e[_0x7e34('0xb')]);_0x49f209[_0x7e34('0x24')]=_0x4d036e['result']['sys_id'];_0x3a15b7(_0x49f209);})[_0x7e34('0x11')](function(_0x231e52){logger[_0x7e34('0x25')]('['+[_0x26d3ab['toUpperCase']()]+']',_0x231e52['message']);_0x32398d(_0x231e52['message']);});});}function getEndUser(_0xa52673,_0x1055d6,_0x136323,_0x4a34e2,_0x3bc8e2){return function(_0x5a8e7a){logger[_0x7e34('0x13')]('['+[_0xa52673['toUpperCase']()]+_0x7e34('0x26'),_0x5a8e7a);return new Promise(function(_0x428809,_0x19f7ff){var _0x57debc={'method':'GET','uri':_0x136323+_0x7e34('0x27')+_0x5a8e7a[_0x7e34('0x1f')]+'&'+_0x4a34e2+'&'+_0x3bc8e2,'auth':_0x1055d6,'json':!![]};return rp(_0x57debc)[_0x7e34('0x22')](function(_0x4033d5){if(_0x4033d5[_0x7e34('0xb')]['length']>0x0){_0x5a8e7a[_0x7e34('0x24')]=_0x4033d5['result'][0x0]['sys_id'];logger[_0x7e34('0x13')]('['+[_0xa52673['toUpperCase']()]+_0x7e34('0x28'),_0x5a8e7a);_0x428809(_0x5a8e7a);}else{return createEndUser(_0xa52673,_0x1055d6,_0x5a8e7a,_0x136323,_0x4a34e2)['then'](function(_0x403808){logger[_0x7e34('0x13')]('['+[_0xa52673[_0x7e34('0xf')]()]+_0x7e34('0x29'),_0x403808);_0x428809(_0x403808);});}})[_0x7e34('0x11')](function(_0x5f37cf){logger[_0x7e34('0x25')]('['+[_0xa52673['toUpperCase']()]+']',_0x5f37cf[_0x7e34('0x12')]);_0x19f7ff(_0x5f37cf['message']);});});};}function getCustomFields(_0x522b13,_0x2e11d7){var _0x161bba={};if(_0x522b13[_0x7e34('0xc')]>0x0){_['forEach'](_0x522b13,function(_0x4ff7d3){if(_[_0x7e34('0x2a')](['string',_0x7e34('0x2b')],_0x4ff7d3[_0x7e34('0x2c')])&&_0x4ff7d3['nameField']&&!_0x4ff7d3['customField']){_0x161bba[_0x4ff7d3['nameField']['toLowerCase']()]=_0x4ff7d3[_0x7e34('0x2d')][_0x7e34('0x2e')]();}else if(_[_0x7e34('0x2a')]([_0x7e34('0x2f'),_0x7e34('0x2b')],_0x4ff7d3[_0x7e34('0x2c')])&&_0x4ff7d3['idField']&&_0x4ff7d3['customField']){_0x161bba[_0x4ff7d3['idField']['toLowerCase']()]=_0x4ff7d3[_0x7e34('0x2d')][_0x7e34('0x2e')]();}else if(_0x4ff7d3['type']===_0x7e34('0x30')&&_0x4ff7d3[_0x7e34('0x31')]&&_0x4ff7d3[_0x7e34('0x32')]&&_0x4ff7d3['customField']){_0x161bba[_0x4ff7d3[_0x7e34('0x32')][_0x7e34('0x33')]()]=_0x2e11d7[_0x4ff7d3[_0x7e34('0x31')]][_0x7e34('0x2e')]();}else if(_0x4ff7d3[_0x7e34('0x2c')]===_0x7e34('0x34')&&_0x4ff7d3[_0x7e34('0x35')]&&_0x4ff7d3['Variable'][_0x7e34('0x36')]&&_0x4ff7d3[_0x7e34('0x32')]&&_0x4ff7d3[_0x7e34('0x37')]){_0x161bba[_0x4ff7d3['idField'][_0x7e34('0x33')]()]=_0x2e11d7[_0x4ff7d3[_0x7e34('0x35')]['name']['toLowerCase']()][_0x7e34('0x2e')]();}});}return _0x161bba;}function getTicket(_0x47905d,_0xc5ce2c,_0x3985f3,_0x2d7e0c,_0x4abf52,_0x535f11){return function(_0x56b06a){logger['info']('['+[_0x47905d['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x56b06a);return new Promise(function(_0x2b30e5,_0x2ed445){var _0x5d9ea2=_0x47905d[_0x7e34('0x33')]()==='outbound'?_0x56b06a['userId']:_0x56b06a['endUserId'];var _0x4facc8={'method':'POST','uri':_0x3985f3+_0x7e34('0x38')+'?'+_0x535f11,'body':Object['assign']({},{'active':_0x7e34('0x19'),'caller_id':_0x5d9ea2,'assigned_to':_0x56b06a[_0x7e34('0x1a')],'short_description':intUtil['getString'](_0x2d7e0c[_0x7e34('0x39')],_0x4abf52,'\x20'),'description':intUtil[_0x7e34('0x3a')](_0x2d7e0c[_0x7e34('0x3b')],_0x4abf52,'\x0a')},getCustomFields(_0x2d7e0c['Fields'],_0x4abf52)),'auth':_0xc5ce2c,'json':!![]};return rp(_0x4facc8)[_0x7e34('0x22')](function(_0x58b3ac){logger[_0x7e34('0x13')]('['+[_0x47905d[_0x7e34('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x58b3ac[_0x7e34('0xb')]);_0x56b06a[_0x7e34('0x3c')]=_0x58b3ac['result'][_0x7e34('0xe')];_0x56b06a[_0x7e34('0x3d')]=_0x58b3ac['result'][_0x7e34('0x3e')];logger[_0x7e34('0x13')]('['+[_0x47905d['toUpperCase']()]+_0x7e34('0x3f'),_0x56b06a);_0x2b30e5(_0x56b06a);})[_0x7e34('0x11')](function(_0xc60c35){logger[_0x7e34('0x25')]('['+[_0x47905d[_0x7e34('0xf')]()]+']',_0xc60c35['message']);_0x2ed445(_0xc60c35[_0x7e34('0x12')]);});});};}function createRemoteTag(_0x52426b,_0x1362af,_0xcae7fc,_0xe6f218){return new Promise(function(_0x38a06f,_0x51e066){var _0x46abb4={'method':_0x7e34('0x40'),'uri':_0xcae7fc+_0x7e34('0x41')+'?'+_0xe6f218,'body':{'short_description':_0x52426b,'global':!![],'active':!![],'name':_0x52426b},'auth':_0x1362af,'json':!![]};return rp(_0x46abb4)[_0x7e34('0x22')](function(_0x5257ae){var _0x124199=_0x5257ae[_0x7e34('0xb')][_0x7e34('0xe')];_0x38a06f(_0x124199);});});}function getRemoteTag(_0x100220,_0x42b96,_0x35d7c5,_0x8339d7,_0x104440){return new Promise(function(_0x4f4960,_0x48b103){var _0x1724a2={'method':_0x7e34('0x9'),'uri':_0x35d7c5+_0x7e34('0x41')+_0x7e34('0x42')+_0x100220+'&'+_0x8339d7,'auth':_0x42b96,'json':!![]};return rp(_0x1724a2)[_0x7e34('0x22')](function(_0x58fb2c){if(_0x58fb2c[_0x7e34('0xb')][_0x7e34('0xc')]>0x0){var _0x1f4daa=_0x58fb2c[_0x7e34('0xb')][0x0][_0x7e34('0xe')];_0x4f4960(_0x1f4daa);}else{return createRemoteTag(_0x100220,_0x42b96,_0x35d7c5,_0x8339d7)['then'](function(_0x2408c4){_0x4f4960(_0x2408c4);});}});});}function assignTagToIncident(_0x504165,_0x1d4e58,_0x4e8443,_0x32553a,_0x5bc5f6){return new Promise(function(_0x4fca33,_0x3f0b0d){var _0x42f037={'method':'POST','uri':_0x4e8443+_0x7e34('0x43')+'?'+_0x5bc5f6,'body':{'label':_0x504165,'table':_0x7e34('0x38'),'id_type':_0x7e34('0x44'),'table_key':_0x32553a[_0x7e34('0x3c')],'title':_0x7e34('0x45')+_0x32553a[_0x7e34('0x3d')],'id_display':_0x32553a[_0x7e34('0x3d')]},'auth':_0x1d4e58,'json':!![]};return rp(_0x42f037)[_0x7e34('0x22')](function(_0x13a2d3){_0x4fca33();})[_0x7e34('0x11')](function(){_0x4fca33();});});}function manageTags(_0x240830,_0x503aa6,_0x4a91be,_0x3ebc36,_0x358add,_0xcd0cf6,_0x8178d5){return new Promise(function(_0x5947fc,_0x579d36){var _0xc8d7b1=[];_0x503aa6[_0x7e34('0x46')](function(_0x193ed1){_0xc8d7b1[_0x7e34('0x47')](getRemoteTag(_0x193ed1,_0x4a91be,_0x3ebc36,_0xcd0cf6,_0x8178d5));});return Promise[_0x7e34('0x48')](_0xc8d7b1)[_0x7e34('0x22')](function(_0x58a96a){if(_0x58a96a[_0x7e34('0xc')]){logger[_0x7e34('0x13')]('['+[_0x240830[_0x7e34('0xf')]()]+_0x7e34('0x49'),_0x58a96a);var _0x4d815f=[];_0x58a96a[_0x7e34('0x46')](function(_0x5971f5){_0x4d815f[_0x7e34('0x47')](assignTagToIncident(_0x5971f5,_0x4a91be,_0x3ebc36,_0x358add,_0xcd0cf6));});return Promise['all'](_0x4d815f)[_0x7e34('0x22')](function(){_0x5947fc();})[_0x7e34('0x11')](function(){_0x5947fc();});}else{_0x5947fc();}});});}function getTags(_0xeb3e19,_0x38ec14,_0x1902a3,_0x4bd38d,_0xf5a194,_0xa97a64){return function(_0x49ef8d){return new Promise(function(_0x5efa82,_0x561241){var _0x291967=[];var _0x59a438=_0x4bd38d['Tags'];if(_0x59a438&&_0x59a438[_0x7e34('0xc')]>0x0){_0x291967=_[_0x7e34('0x4a')](_0x59a438,_0x7e34('0x36'));}if(_0x291967[_0x7e34('0xc')]>0x0){return manageTags(_0xeb3e19,_0x291967,_0x38ec14,_0x1902a3,_0x49ef8d,_0xf5a194,_0xa97a64)[_0x7e34('0x22')](function(){_0x5efa82(_0x49ef8d);});}else{_0x5efa82(_0x49ef8d);}});};}function emit(_0x1691f8,_0x4bebfc,_0xa698b8){var _0x1d1012=_0x7e34('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x7e34('0x4c')+_0x7e34('0x4d');var _0x3fb4fb={'uri':_0x1691f8+_0x7e34('0x4e')+_0xa698b8+_0x1d1012};io['to'](util[_0x7e34('0x4f')]('user:%s',_0x4bebfc))[_0x7e34('0x50')](_0x7e34('0x51'),_0x3fb4fb);}exports['cs']=function(_0x46d25e,_0x61873c,_0x28c2a7,_0x13d592,_0x3a3702,_0x5b4ff1,_0x141e47,_0xfbbdb8){var _0x249045={};var _0x8fb1cb={'user':_0x5b4ff1[_0x7e34('0x52')],'pass':_0x5b4ff1[_0x7e34('0x53')]};var _0x4a9f1d='sysparm_limit=1';var _0x1a18af='sysparm_display_value=true';_0x5b4ff1[_0x7e34('0x54')]=intUtil['stripTrailingSlash'](_0x5b4ff1[_0x7e34('0x54')]);_0x5b4ff1['serverUrl']=intUtil[_0x7e34('0x55')](_0x5b4ff1[_0x7e34('0x56')]);var _0x202d51=util[_0x7e34('0x4f')](_0x7e34('0x57'),_0x5b4ff1[_0x7e34('0x54')]);_0x249045[_0x7e34('0x58')]=!_[_0x7e34('0x59')](_0x13d592)?_0x13d592[_0x7e34('0x5a')]:null;_0x249045[_0x7e34('0x1b')]=_0x5b4ff1[_0x7e34('0x5a')];_0x249045[_0x7e34('0x1f')]=_0xfbbdb8[_0x7e34('0x33')]()===_0x7e34('0x5b')?_0x61873c[_0x7e34('0x5c')]:_0x61873c[_0x7e34('0x5d')];_0x249045[_0x7e34('0x5e')]=_0xfbbdb8===_0x7e34('0x5f')||_0xfbbdb8==='unmanaged'?_0x7e34('0x5f'):_0x7e34('0x5b');var _0x408afe=util['format'](_0x7e34('0x60'),_0x5b4ff1['serverUrl'],_0x61873c[_0x7e34('0x61')],md5(_0x61873c[_0x7e34('0x61')]));if(_0x3a3702&&_0x3a3702[_0x7e34('0x62')]){logger['info'](_0x7e34('0x63'),'Recording\x20is\x20enabled!');_0x61873c[_0x7e34('0x64')]=_0x408afe;}else if(_0x141e47&&_0x141e47[_0x7e34('0x65')]&&_0x141e47[_0x7e34('0x65')]!==_0x7e34('0x66')){logger['info']('[OUTBOUND]',_0x7e34('0x67'));_0x61873c[_0x7e34('0x64')]=_0x408afe;}else{_0x61873c[_0x7e34('0x64')]='';}return getAdminUser(_0xfbbdb8,_0x8fb1cb,_0x249045,_0x202d51,_0x1a18af,_0x4a9f1d)[_0x7e34('0x22')](getUser(_0xfbbdb8,_0x8fb1cb,_0x202d51,_0x1a18af,_0x4a9f1d))[_0x7e34('0x22')](getEndUser(_0xfbbdb8,_0x8fb1cb,_0x202d51,_0x1a18af,_0x4a9f1d))['then'](getTicket(_0xfbbdb8,_0x8fb1cb,_0x202d51,_0x28c2a7,_0x61873c,_0x1a18af))[_0x7e34('0x22')](function(_0x7f509a){logger['info'](util[_0x7e34('0x4f')]('The\x20ticket\x20ID\x20is:\x20%s',_0x7f509a[_0x7e34('0x3c')]));logger[_0x7e34('0x13')](util[_0x7e34('0x4f')](_0x7e34('0x68'),_0xfbbdb8));if(_0xfbbdb8!==_0x7e34('0x69')){logger['info']('['+[_0xfbbdb8['toUpperCase']()]+']',_0x7e34('0x6a'));emit(_0x5b4ff1['remoteUri'],_0x13d592[_0x7e34('0x36')],_0x7f509a[_0x7e34('0x3c')]);}})[_0x7e34('0x11')](function(_0x2882eb){logger[_0x7e34('0x25')]('['+[_0xfbbdb8['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x7e34('0x6b')](_0x2882eb,{'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 d941d90..84164ad 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 _0x3625=['[HTTP]','map','forEach','type','string','nameField','customField','content','idField','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','catch','error','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridnum','charAt','user:%s','trigger:browser:url','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','defaults','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','replace','parent_id','Contacts','parent_name','direction','length','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','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!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug'];(function(_0x31aa62,_0x1476f5){var _0x6bbfe8=function(_0xb1027a){while(--_0xb1027a){_0x31aa62['push'](_0x31aa62['shift']());}};_0x6bbfe8(++_0x1476f5);}(_0x3625,0xa9));var _0x5362=function(_0x2fad91,_0x25b0ec){_0x2fad91=_0x2fad91-0x0;var _0x58598f=_0x3625[_0x2fad91];return _0x58598f;};'use strict';var _=require(_0x5362('0x0'));var rp=require(_0x5362('0x1'));var BPromise=require('bluebird');var md5=require(_0x5362('0x2'));var util=require('util');var Redis=require(_0x5362('0x3'));var intUtil=require('./util');var config=require(_0x5362('0x4'));var logger=require(_0x5362('0x5'))('sugarcrm');config['redis']=_[_0x5362('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5362('0x7'))(new Redis(config['redis']));var def={'method':_0x5362('0x8'),'json':!![]};function emit(_0x169ab5,_0x28ee8c,_0x52f839){io['to'](_0x169ab5)['emit'](_0x28ee8c,_0x52f839);}function getTicket(_0x377e9f,_0x4bae5a,_0x5a3cff,_0x3cb381,_0x2c6270,_0x86efe7,_0x177375,_0x1f5313){logger[_0x5362('0x9')](_0x5362('0xa'));var _0x54b80c=new Date();var _0x4714a3=[{'name':_0x5362('0xb'),'value':intUtil['getString'](_0x3cb381[_0x5362('0xc')],_0x2c6270,'\x20')},{'name':_0x5362('0xd'),'value':_0x4bae5a['id']},{'name':_0x5362('0xe'),'value':_0x4bae5a['id']},{'name':_0x5362('0xf'),'value':intUtil[_0x5362('0x10')](_0x3cb381[_0x5362('0x11')],_0x2c6270,'\x0a')},{'name':_0x5362('0x12'),'value':_0x54b80c['toISOString']()['slice'](0x0,0x13)[_0x5362('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x5362('0x14'),'value':_0x5a3cff['id']},{'name':'parent_type','value':_0x5362('0x15')},{'name':_0x5362('0x16'),'value':_0x5a3cff[_0x5362('0xb')]},{'name':_0x5362('0x17'),'value':_0x1f5313}];if(_0x86efe7[_0x5362('0x18')]){_['forEach'](_0x86efe7,function(_0x407832){if(_0x2c6270[_0x407832[_0x5362('0x19')]]){_0x4714a3[_0x5362('0x1a')]({'name':_0x407832['idField'],'value':_0x2c6270[_0x407832[_0x5362('0x19')]]});}});}return request({'form':{'method':_0x5362('0x1b'),'input_type':_0x5362('0x1c'),'response_type':'JSON','rest_data':JSON[_0x5362('0x1d')]({'session':_0x177375['id'],'module_name':_0x5362('0x1e'),'name_value_list':_0x4714a3})}});}function getAuth(_0x601021){return util[_0x5362('0x1f')](_0x5362('0x20'),new Buffer(_0x601021[_0x5362('0x21')]+':X')[_0x5362('0x22')](_0x5362('0x23')));}function getServerInfo(_0x20491e){return request({'form':{'method':_0x5362('0x24'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x20491e['id']})}});}function getUser(_0x5f1996,_0x24c84f,_0x59cbe6){if(!_[_0x5362('0x25')](_0x24c84f)){logger['info'](_0x5362('0x26'),_0x24c84f);return request({'form':{'method':_0x5362('0x27'),'input_type':_0x5362('0x1c'),'response_type':'JSON','rest_data':JSON[_0x5362('0x1d')]({'session':_0x59cbe6['id'],'module_name':'Employees','query':util[_0x5362('0x1f')](_0x5362('0x28'),_0x24c84f),'order_by':'','offset':'0','select_fields':['id',_0x5362('0xb'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5362('0x29')](function(_0x3c7da5){if(_0x3c7da5[_0x5362('0x2a')][_0x5362('0x18')]){var _0x23957e=_[_0x5362('0x2b')](_0x3c7da5[_0x5362('0x2a')],function(_0x1143b1){return _0x1143b1[_0x5362('0x2c')][_0x5362('0x2d')][_0x5362('0x2e')]===_0x24c84f;});if(_0x23957e){logger['info'](_0x5362('0x2f'));return BPromise['resolve']({'id':_0x23957e['name_value_list']['id'][_0x5362('0x2e')],'name':_0x23957e[_0x5362('0x2c')][_0x5362('0xb')][_0x5362('0x2e')]});}}logger['info'](_0x5362('0x30'));return BPromise['resolve']({'id':_0x59cbe6['name_value_list'][_0x5362('0x31')][_0x5362('0x2e')],'name':_0x59cbe6[_0x5362('0x2c')]['user_name'][_0x5362('0x2e')]});});}else{logger['info'](_0x5362('0x32'));return BPromise['resolve']({'id':_0x59cbe6[_0x5362('0x2c')][_0x5362('0x31')][_0x5362('0x2e')],'name':_0x59cbe6[_0x5362('0x2c')][_0x5362('0x2d')][_0x5362('0x2e')]});}}function getEndUser(_0x2781ea,_0xccce0e,_0x1ef531,_0x3b1310){logger['info'](_0x5362('0x33'),_0x1ef531);return request({'form':{'method':_0x5362('0x27'),'input_type':_0x5362('0x1c'),'response_type':_0x5362('0x1c'),'rest_data':JSON[_0x5362('0x1d')]({'session':_0x3b1310['id'],'module_name':_0x5362('0x15'),'query':util[_0x5362('0x1f')](_0x5362('0x34'),_0x1ef531),'order_by':'','offset':'0','select_fields':['id',_0x5362('0xb'),_0x5362('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5362('0x29')](function(_0x3872d2){if(_0x3872d2[_0x5362('0x2a')][_0x5362('0x18')]){var _0x5f2555=_[_0x5362('0x2b')](_0x3872d2[_0x5362('0x2a')],function(_0x1b1d57){return _0x1b1d57['name_value_list']['phone_home'][_0x5362('0x2e')]===_0x1ef531;});if(_0x5f2555){logger[_0x5362('0x9')](_0x5362('0x36'));return BPromise['resolve']({'id':_0x5f2555[_0x5362('0x2c')]['id'][_0x5362('0x2e')],'name':_0x5f2555[_0x5362('0x2c')][_0x5362('0xb')][_0x5362('0x2e')],'phone':_0x5f2555[_0x5362('0x2c')]['phone_home'][_0x5362('0x2e')]});}}else{logger[_0x5362('0x9')](_0x5362('0x37'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x5362('0x1c'),'rest_data':JSON[_0x5362('0x1d')]({'session':_0x3b1310['id'],'module_name':'Contacts','name_value_list':[{'name':_0x5362('0x38'),'value':_0xccce0e!==_0x5362('0x39')?_0xccce0e:util[_0x5362('0x1f')](_0x5362('0x3a'),_0x1ef531)},{'name':_0x5362('0x35'),'value':_0x1ef531}]})}})[_0x5362('0x29')](function(_0x7fe528){logger['info'](_0x5362('0x3b'));return BPromise['resolve']({'id':_0x7fe528['id'],'name':_0x7fe528[_0x5362('0x2a')]['first_name'][_0x5362('0x2e')],'phone':_0x7fe528[_0x5362('0x2a')]['phone_home']['value']});});}});}function request(_0xc9c14c){logger[_0x5362('0x3c')](_0x5362('0x3d'),JSON[_0x5362('0x1d')](_0xc9c14c));return rp(_['merge'](def,_0xc9c14c));}function getTags(_0x5cf7ce,_0x4a84c2){var _0x23d106=[];if(_0x5cf7ce&&_0x5cf7ce[_0x5362('0x18')]>0x0){_0x23d106=_[_0x5362('0x3e')](_0x5cf7ce,_0x4a84c2);}return _0x23d106;}function getCustomFields(_0x18ad95,_0x3ca815){var _0x5e9eae=[];var _0x3bdfb={'custom_fields':[]};if(_0x18ad95[_0x5362('0x18')]>0x0){_[_0x5362('0x3f')](_0x18ad95,function(_0x5db1e1){if(_0x5db1e1[_0x5362('0x40')]===_0x5362('0x41')&&_0x5db1e1[_0x5362('0x42')]&&!_0x5db1e1[_0x5362('0x43')]){_0x3bdfb[_0x5db1e1['nameField']['toLowerCase']()]=_0x5db1e1[_0x5362('0x44')]['toString']();}else if(_0x5db1e1[_0x5362('0x40')]===_0x5362('0x41')&&_0x5db1e1[_0x5362('0x45')]&&_0x5db1e1[_0x5362('0x43')]){_0x3bdfb[_0x5362('0x46')][_0x5362('0x1a')]({'id':_0x5db1e1[_0x5362('0x45')],'value':_0x5db1e1[_0x5362('0x44')]['toString']()});}else if(_0x5db1e1['type']===_0x5362('0x47')&&_0x5db1e1[_0x5362('0x19')]&&_0x5db1e1['idField']&&_0x5db1e1[_0x5362('0x43')]){_0x3ca815[_0x5db1e1[_0x5362('0x19')]]&&_0x3bdfb['custom_fields']['push']({'id':_0x5db1e1[_0x5362('0x45')],'value':_0x3ca815[_0x5db1e1['variableName']][_0x5362('0x22')]()});}else if(_0x5db1e1[_0x5362('0x40')]===_0x5362('0x48')&&_0x5db1e1[_0x5362('0x49')]&&_0x5db1e1[_0x5362('0x49')][_0x5362('0xb')]&&_0x5db1e1[_0x5362('0x45')]&&_0x5db1e1[_0x5362('0x43')]){_0x3ca815[_0x5db1e1[_0x5362('0x49')][_0x5362('0xb')]['toLowerCase']()]&&_0x3bdfb[_0x5362('0x46')][_0x5362('0x1a')]({'id':_0x5db1e1[_0x5362('0x45')],'value':_0x3ca815[_0x5db1e1[_0x5362('0x49')][_0x5362('0xb')][_0x5362('0x4a')]()][_0x5362('0x22')]()});}});}return _0x3bdfb;}function getConnection(_0x372f52){return request({'method':_0x5362('0x8'),'form':{'method':_0x5362('0x4b'),'input_type':'JSON','response_type':_0x5362('0x1c'),'rest_data':JSON[_0x5362('0x1d')]({'user_auth':{'user_name':_0x372f52[_0x5362('0x4c')],'password':_0x372f52[_0x5362('0x4d')],'encryption':_0x5362('0x4e')},'application':_0x5362('0x4f')})}})[_0x5362('0x29')](function(_0x358077){var _0x429a08=_0x358077;if(_0x429a08['id']){def[_0x5362('0x50')]=_0x429a08['id'];return BPromise['resolve'](_0x429a08);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x372f52['id']));}});}function setRelationship(_0x1e2f64,_0x4b183c,_0x1d04f5,_0x2c2295){return request({'form':{'method':'set_relationship','input_type':_0x5362('0x1c'),'response_type':_0x5362('0x1c'),'rest_data':JSON[_0x5362('0x1d')]({'session':_0x1e2f64['id'],'module_name':_0x5362('0x1e'),'module_id':_0x1d04f5['id'],'link_field_name':_0x2c2295,'related_ids':[_0x4b183c['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x5d6f58,_0x425846,_0x353731,_0x1fdf55,_0x527f04,_0x492b78){var _0x420877,_0x3013d9,_0x369ecb,_0x6b8341;_0x492b78[_0x5362('0x51')]=intUtil[_0x5362('0x52')](_0x492b78[_0x5362('0x51')]);_0x492b78[_0x5362('0x53')]=intUtil['stripTrailingSlash'](_0x492b78[_0x5362('0x53')]);def[_0x5362('0x54')]=util['format']('%s/service/v4_1/rest.php',_0x492b78[_0x5362('0x51')]);if(_0x527f04&&_0x527f04[_0x5362('0x55')]){logger['info']('[QUEUE]',_0x5362('0x56'));_0x425846['recordingURL']=util[_0x5362('0x1f')](_0x5362('0x57'),_0x492b78[_0x5362('0x53')],_0x425846[_0x5362('0x58')],md5(_0x425846[_0x5362('0x58')]));}else{_0x425846[_0x5362('0x59')]='';}return getConnection(_0x492b78)['then'](function(_0x1d8314){_0x6b8341=_0x1d8314;return getUser(_0x492b78,_0x1fdf55['name'],_0x6b8341);})['then'](function(_0x2608ef){_0x420877=_0x2608ef;logger[_0x5362('0x9')](_0x5362('0x5a'),_0x420877['id']);return getEndUser(_0x492b78,_0x425846['calleridname'],_0x425846[_0x5362('0x5b')],_0x6b8341);})[_0x5362('0x29')](function(_0x20fdbb){_0x3013d9=_0x20fdbb;logger[_0x5362('0x9')](_0x5362('0x5c'),_0x3013d9['id']);return getTicket(_0x492b78,_0x420877,_0x3013d9,_0x353731,_0x425846,_0x353731[_0x5362('0x5d')],_0x6b8341,_0x5362('0x5e'));})['then'](function(_0x38f8c0){_0x369ecb=_0x38f8c0;logger[_0x5362('0x9')](_0x5362('0x5f'));logger[_0x5362('0x9')](_0x5362('0x60'),_0x369ecb['id']);return setRelationship(_0x6b8341,_0x420877,_0x369ecb,_0x5362('0x61'));})[_0x5362('0x29')](function(){return setRelationship(_0x6b8341,_0x3013d9,_0x369ecb,_0x5362('0x62'));})[_0x5362('0x29')](function(){return getServerInfo(_0x6b8341);})[_0x5362('0x29')](function(_0xacfd84){var _0x1dd0f2=parseInt(_0xacfd84[_0x5362('0x63')]['charAt'](0x0));var _0xb9f986=util[_0x5362('0x1f')](_0x5362('0x64'),_0x492b78['remoteUri'],_0x369ecb['id']);if(_0x1dd0f2>0x6){_0xb9f986=util[_0x5362('0x1f')](_0x5362('0x65'),_0x492b78[_0x5362('0x51')],_0x369ecb['id']);}logger['info'](_0x5362('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5362('0x1f')]('user:%s',_0x1fdf55[_0x5362('0xb')]),'trigger:browser:url',{'uri':_0xb9f986});})[_0x5362('0x67')](function(_0x9a2182){logger[_0x5362('0x68')]('[QUEUE]',JSON[_0x5362('0x1d')](_0x9a2182));});};exports['outbound']=function(_0x526731,_0x2a07ad,_0x3b8d3f,_0x5ddfdf,_0x46e4a6,_0x269506,_0x19ccfb){var _0x3205a9,_0x1aa66c,_0x56167c,_0x12d36b;_0x269506[_0x5362('0x51')]=intUtil[_0x5362('0x52')](_0x269506['remoteUri']);_0x269506['serverUrl']=intUtil[_0x5362('0x52')](_0x269506['serverUrl']);def[_0x5362('0x54')]=util['format'](_0x5362('0x69'),_0x269506[_0x5362('0x51')]);if(_0x19ccfb&&_0x19ccfb[_0x5362('0x6a')]&&_0x19ccfb[_0x5362('0x6a')]!==_0x5362('0x6b')){logger[_0x5362('0x9')](_0x5362('0x6c'),'Recording\x20is\x20enabled!');_0x2a07ad[_0x5362('0x59')]=util[_0x5362('0x1f')](_0x5362('0x57'),_0x269506[_0x5362('0x53')],_0x2a07ad[_0x5362('0x58')],md5(_0x2a07ad['uniqueid']));}return getConnection(_0x269506)[_0x5362('0x29')](function(_0x4de646){_0x12d36b=_0x4de646;return getUser(_0x269506,_0x5ddfdf[_0x5362('0xb')],_0x12d36b);})[_0x5362('0x29')](function(_0x3150ba){_0x3205a9=_0x3150ba;logger[_0x5362('0x9')](_0x5362('0x5a'),_0x3205a9['id']);return getEndUser(_0x269506,_0x2a07ad['destcalleridname'],_0x2a07ad[_0x5362('0x6d')],_0x12d36b);})[_0x5362('0x29')](function(_0x334fa5){_0x1aa66c=_0x334fa5;logger[_0x5362('0x9')]('The\x20Enduser\x20ID\x20is:',_0x1aa66c['id']);return getTicket(_0x269506,_0x3205a9,_0x1aa66c,_0x3b8d3f,_0x2a07ad,_0x3b8d3f['Fields'],_0x12d36b,'Outbound');})[_0x5362('0x29')](function(_0x208643){_0x56167c=_0x208643;logger[_0x5362('0x9')](_0x5362('0x5f'));logger[_0x5362('0x9')](_0x5362('0x60'),_0x56167c['id']);return setRelationship(_0x12d36b,_0x3205a9,_0x56167c,_0x5362('0x61'));})[_0x5362('0x29')](function(){return setRelationship(_0x12d36b,_0x1aa66c,_0x56167c,_0x5362('0x62'));})['then'](function(){return getServerInfo(_0x12d36b);})['then'](function(_0x56f89f){var _0x37fb1d=parseInt(_0x56f89f[_0x5362('0x63')][_0x5362('0x6e')](0x0));var _0x5aebcd=util[_0x5362('0x1f')](_0x5362('0x64'),_0x269506[_0x5362('0x51')],_0x56167c['id']);if(_0x37fb1d>0x6){_0x5aebcd=util[_0x5362('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x269506[_0x5362('0x51')],_0x56167c['id']);}logger[_0x5362('0x9')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5362('0x6f'),_0x5ddfdf[_0x5362('0xb')]),_0x5362('0x70'),{'uri':_0x5aebcd});})[_0x5362('0x67')](function(_0x32f88e){logger[_0x5362('0x68')](_0x5362('0x6c'),JSON[_0x5362('0x1d')](_0x32f88e));});};exports['unmanaged']=function(_0xc1a1fb,_0x3a043c,_0x2686f4,_0x29c809,_0x13df6f,_0x371f7a){var _0x4fabd6,_0x3bb492,_0x173bcc,_0x468234;_0x371f7a[_0x5362('0x51')]=intUtil[_0x5362('0x52')](_0x371f7a[_0x5362('0x51')]);_0x371f7a[_0x5362('0x53')]=intUtil[_0x5362('0x52')](_0x371f7a['serverUrl']);def[_0x5362('0x54')]=util[_0x5362('0x1f')]('%s/service/v4_1/rest.php',_0x371f7a[_0x5362('0x51')]);if(_0x13df6f&&_0x13df6f[_0x5362('0x55')]){logger[_0x5362('0x9')]('['+_0x3a043c[_0x5362('0x71')][_0x5362('0x72')]()+']',_0x5362('0x56'));_0x3a043c['recordingURL']=util[_0x5362('0x1f')](_0x5362('0x57'),_0x371f7a[_0x5362('0x53')],_0x3a043c[_0x5362('0x58')],md5(_0x3a043c[_0x5362('0x58')]));}else{_0x3a043c[_0x5362('0x59')]='';}return getConnection(_0x371f7a)[_0x5362('0x29')](function(_0x73d278){_0x468234=_0x73d278;if(!_[_0x5362('0x25')](_0x29c809)){return getUser(_0x371f7a,_0x29c809[_0x5362('0xb')],_0x468234);}else{return getUser(_0x371f7a,null,_0x468234);}})['then'](function(_0x576564){_0x4fabd6=_0x576564;logger[_0x5362('0x9')](_0x5362('0x5a'),_0x4fabd6['id']);return getEndUser(_0x371f7a,_0x3a043c['calleridname'],_0x3a043c['calleridnum'],_0x468234);})[_0x5362('0x29')](function(_0x3817d9){_0x3bb492=_0x3817d9;logger[_0x5362('0x9')](_0x5362('0x5c'),_0x3bb492['id']);return getTicket(_0x371f7a,_0x4fabd6,_0x3bb492,_0x2686f4,_0x3a043c,_0x2686f4[_0x5362('0x5d')],_0x468234,'Inbound');})[_0x5362('0x29')](function(_0xa3f9e0){_0x173bcc=_0xa3f9e0;logger[_0x5362('0x9')](_0x5362('0x5f'));logger[_0x5362('0x9')](_0x5362('0x60'),_0x173bcc['id']);return setRelationship(_0x468234,_0x4fabd6,_0x173bcc,_0x5362('0x61'));})['then'](function(){return setRelationship(_0x468234,_0x3bb492,_0x173bcc,_0x5362('0x62'));})[_0x5362('0x29')](function(){return getServerInfo(_0x468234);})[_0x5362('0x67')](function(_0x5b483e){logger[_0x5362('0x68')]('['+_0x3a043c[_0x5362('0x71')][_0x5362('0x72')]()+']',JSON[_0x5362('0x1d')](_0x5b483e));});}; \ No newline at end of file +var _0x5069=['serverUrl','uri','%s/service/v4_1/rest.php','[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','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...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','monitor_format','lastevent','toUpperCase','request-promise','bluebird','util','ioredis','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','description','getString','Descriptions','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','format','apiKey','base64','get_server_info','stringify','isNil','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','content','custom_fields','push','toString','variable','customVariable','Variable','username','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','Calls','remoteUri'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5069,0x184));var _0x9506=function(_0x3d88f1,_0x4afece){_0x3d88f1=_0x3d88f1-0x0;var _0x4a4fea=_0x5069[_0x3d88f1];return _0x4a4fea;};'use strict';var _=require('lodash');var rp=require(_0x9506('0x0'));var BPromise=require(_0x9506('0x1'));var md5=require('md5');var util=require(_0x9506('0x2'));var Redis=require(_0x9506('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x9506('0x4'))('sugarcrm');config['redis']=_[_0x9506('0x5')](config[_0x9506('0x6')],{'host':_0x9506('0x7'),'port':0x18eb});var io=require(_0x9506('0x8'))(new Redis(config[_0x9506('0x6')]));var def={'method':_0x9506('0x9'),'json':!![]};function emit(_0x4269a4,_0x22b703,_0x3c2a41){io['to'](_0x4269a4)[_0x9506('0xa')](_0x22b703,_0x3c2a41);}function getTicket(_0x9a6eed,_0x476152,_0x385b65,_0x28673c,_0x3461e1,_0x5d41f5,_0x111601,_0x239288){logger[_0x9506('0xb')](_0x9506('0xc'));var _0x409e2d=new Date();var _0x2c4993=[{'name':_0x9506('0xd'),'value':intUtil['getString'](_0x28673c['Subjects'],_0x3461e1,'\x20')},{'name':'assigned_user_id','value':_0x476152['id']},{'name':'created_by','value':_0x476152['id']},{'name':_0x9506('0xe'),'value':intUtil[_0x9506('0xf')](_0x28673c[_0x9506('0x10')],_0x3461e1,'\x0a')},{'name':'date_start','value':_0x409e2d[_0x9506('0x11')]()['slice'](0x0,0x13)[_0x9506('0x12')]('T','\x20')},{'name':_0x9506('0x13'),'value':'0'},{'name':_0x9506('0x14'),'value':'15'},{'name':_0x9506('0x15'),'value':_0x385b65['id']},{'name':_0x9506('0x16'),'value':'Contacts'},{'name':_0x9506('0x17'),'value':_0x385b65['name']},{'name':_0x9506('0x18'),'value':_0x239288}];if(_0x5d41f5[_0x9506('0x19')]){_[_0x9506('0x1a')](_0x5d41f5,function(_0x4cd0fc){if(_0x3461e1[_0x4cd0fc[_0x9506('0x1b')]]){_0x2c4993['push']({'name':_0x4cd0fc[_0x9506('0x1c')],'value':_0x3461e1[_0x4cd0fc[_0x9506('0x1b')]]});}});}return request({'form':{'method':_0x9506('0x1d'),'input_type':_0x9506('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x111601['id'],'module_name':'Calls','name_value_list':_0x2c4993})}});}function getAuth(_0x45f0eb){return util[_0x9506('0x1f')]('Basic\x20%s',new Buffer(_0x45f0eb[_0x9506('0x20')]+':X')['toString'](_0x9506('0x21')));}function getServerInfo(_0x15fe44){return request({'form':{'method':_0x9506('0x22'),'input_type':_0x9506('0x1e'),'response_type':_0x9506('0x1e'),'rest_data':JSON[_0x9506('0x23')]({'session':_0x15fe44['id']})}});}function getUser(_0x3da1b5,_0x584edf,_0x49830d){if(!_[_0x9506('0x24')](_0x584edf)){logger[_0x9506('0xb')]('Getting\x20agent\x20with\x20name',_0x584edf);return request({'form':{'method':_0x9506('0x25'),'input_type':_0x9506('0x1e'),'response_type':_0x9506('0x1e'),'rest_data':JSON[_0x9506('0x23')]({'session':_0x49830d['id'],'module_name':'Employees','query':util['format'](_0x9506('0x26'),_0x584edf),'order_by':'','offset':'0','select_fields':['id','name',_0x9506('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9506('0x28')](function(_0x34d193){if(_0x34d193[_0x9506('0x29')][_0x9506('0x19')]){var _0x572721=_[_0x9506('0x2a')](_0x34d193[_0x9506('0x29')],function(_0x2dd5f3){return _0x2dd5f3[_0x9506('0x2b')]['user_name'][_0x9506('0x2c')]===_0x584edf;});if(_0x572721){logger[_0x9506('0xb')](_0x9506('0x2d'));return BPromise[_0x9506('0x2e')]({'id':_0x572721[_0x9506('0x2b')]['id'][_0x9506('0x2c')],'name':_0x572721[_0x9506('0x2b')]['name']['value']});}}logger['info'](_0x9506('0x2f'));return BPromise[_0x9506('0x2e')]({'id':_0x49830d[_0x9506('0x2b')]['user_id'][_0x9506('0x2c')],'name':_0x49830d['name_value_list'][_0x9506('0x27')][_0x9506('0x2c')]});});}else{logger['info'](_0x9506('0x30'));return BPromise[_0x9506('0x2e')]({'id':_0x49830d['name_value_list'][_0x9506('0x31')][_0x9506('0x2c')],'name':_0x49830d[_0x9506('0x2b')][_0x9506('0x27')][_0x9506('0x2c')]});}}function getEndUser(_0x1c7c87,_0x4c9eb7,_0x5923f1,_0x109fc2){logger[_0x9506('0xb')](_0x9506('0x32'),_0x5923f1);return request({'form':{'method':_0x9506('0x25'),'input_type':_0x9506('0x1e'),'response_type':_0x9506('0x1e'),'rest_data':JSON[_0x9506('0x23')]({'session':_0x109fc2['id'],'module_name':_0x9506('0x33'),'query':util[_0x9506('0x1f')](_0x9506('0x34'),_0x5923f1),'order_by':'','offset':'0','select_fields':['id','name',_0x9506('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x44d532){if(_0x44d532['entry_list'][_0x9506('0x19')]){var _0x5a1ebe=_[_0x9506('0x2a')](_0x44d532[_0x9506('0x29')],function(_0x30c51f){return _0x30c51f[_0x9506('0x2b')]['phone_home'][_0x9506('0x2c')]===_0x5923f1;});if(_0x5a1ebe){logger[_0x9506('0xb')]('Enduser\x20found!');return BPromise[_0x9506('0x2e')]({'id':_0x5a1ebe[_0x9506('0x2b')]['id'][_0x9506('0x2c')],'name':_0x5a1ebe['name_value_list']['name']['value'],'phone':_0x5a1ebe['name_value_list']['phone_home'][_0x9506('0x2c')]});}}else{logger[_0x9506('0xb')](_0x9506('0x36'));return request({'form':{'method':_0x9506('0x1d'),'input_type':_0x9506('0x1e'),'response_type':'JSON','rest_data':JSON[_0x9506('0x23')]({'session':_0x109fc2['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9506('0x37'),'value':_0x4c9eb7!==_0x9506('0x38')?_0x4c9eb7:util['format'](_0x9506('0x39'),_0x5923f1)},{'name':'phone_home','value':_0x5923f1}]})}})[_0x9506('0x28')](function(_0x6c66c7){logger[_0x9506('0xb')](_0x9506('0x3a'));return BPromise[_0x9506('0x2e')]({'id':_0x6c66c7['id'],'name':_0x6c66c7[_0x9506('0x29')][_0x9506('0x37')][_0x9506('0x2c')],'phone':_0x6c66c7[_0x9506('0x29')][_0x9506('0x35')][_0x9506('0x2c')]});});}});}function request(_0x78585f){logger[_0x9506('0x3b')](_0x9506('0x3c'),JSON[_0x9506('0x23')](_0x78585f));return rp(_[_0x9506('0x3d')](def,_0x78585f));}function getTags(_0x1c3bbd,_0x36d7db){var _0x93f0ef=[];if(_0x1c3bbd&&_0x1c3bbd[_0x9506('0x19')]>0x0){_0x93f0ef=_[_0x9506('0x3e')](_0x1c3bbd,_0x36d7db);}return _0x93f0ef;}function getCustomFields(_0x4d3cf6,_0x375217){var _0x1e5b10=[];var _0x1d4ce7={'custom_fields':[]};if(_0x4d3cf6['length']>0x0){_['forEach'](_0x4d3cf6,function(_0x5b94d5){if(_0x5b94d5[_0x9506('0x3f')]==='string'&&_0x5b94d5[_0x9506('0x40')]&&!_0x5b94d5[_0x9506('0x41')]){_0x1d4ce7[_0x5b94d5[_0x9506('0x40')][_0x9506('0x42')]()]=_0x5b94d5[_0x9506('0x43')]['toString']();}else if(_0x5b94d5[_0x9506('0x3f')]==='string'&&_0x5b94d5[_0x9506('0x1c')]&&_0x5b94d5[_0x9506('0x41')]){_0x1d4ce7[_0x9506('0x44')][_0x9506('0x45')]({'id':_0x5b94d5[_0x9506('0x1c')],'value':_0x5b94d5[_0x9506('0x43')][_0x9506('0x46')]()});}else if(_0x5b94d5[_0x9506('0x3f')]===_0x9506('0x47')&&_0x5b94d5[_0x9506('0x1b')]&&_0x5b94d5[_0x9506('0x1c')]&&_0x5b94d5['customField']){_0x375217[_0x5b94d5[_0x9506('0x1b')]]&&_0x1d4ce7[_0x9506('0x44')][_0x9506('0x45')]({'id':_0x5b94d5[_0x9506('0x1c')],'value':_0x375217[_0x5b94d5[_0x9506('0x1b')]][_0x9506('0x46')]()});}else if(_0x5b94d5[_0x9506('0x3f')]===_0x9506('0x48')&&_0x5b94d5[_0x9506('0x49')]&&_0x5b94d5[_0x9506('0x49')]['name']&&_0x5b94d5[_0x9506('0x1c')]&&_0x5b94d5[_0x9506('0x41')]){_0x375217[_0x5b94d5['Variable'][_0x9506('0xd')][_0x9506('0x42')]()]&&_0x1d4ce7[_0x9506('0x44')]['push']({'id':_0x5b94d5[_0x9506('0x1c')],'value':_0x375217[_0x5b94d5['Variable'][_0x9506('0xd')][_0x9506('0x42')]()][_0x9506('0x46')]()});}});}return _0x1d4ce7;}function getConnection(_0x2f9a16){return request({'method':_0x9506('0x9'),'form':{'method':'login','input_type':_0x9506('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2f9a16[_0x9506('0x4a')],'password':_0x2f9a16['password'],'encryption':_0x9506('0x4b')},'application':_0x9506('0x4c')})}})[_0x9506('0x28')](function(_0x591891){var _0x38f6e1=_0x591891;if(_0x38f6e1['id']){def['sessionID']=_0x38f6e1['id'];return BPromise[_0x9506('0x2e')](_0x38f6e1);}else{throw new Error(util['format'](_0x9506('0x4d'),_0x2f9a16['id']));}});}function setRelationship(_0x2a33fd,_0x23927f,_0x3ae5cc,_0x3b25e8){return request({'form':{'method':'set_relationship','input_type':_0x9506('0x1e'),'response_type':_0x9506('0x1e'),'rest_data':JSON['stringify']({'session':_0x2a33fd['id'],'module_name':_0x9506('0x4e'),'module_id':_0x3ae5cc['id'],'link_field_name':_0x3b25e8,'related_ids':[_0x23927f['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3b9bf0,_0x2c4002,_0x2c2f68,_0x4aaa18,_0x79a4db,_0x29591a){var _0x2867e6,_0x4c6a69,_0x8f5fa5,_0xe76f4b;_0x29591a[_0x9506('0x4f')]=intUtil['stripTrailingSlash'](_0x29591a['remoteUri']);_0x29591a[_0x9506('0x50')]=intUtil['stripTrailingSlash'](_0x29591a[_0x9506('0x50')]);def[_0x9506('0x51')]=util[_0x9506('0x1f')](_0x9506('0x52'),_0x29591a['remoteUri']);if(_0x79a4db&&_0x79a4db['monitor_format']){logger['info'](_0x9506('0x53'),_0x9506('0x54'));_0x2c4002[_0x9506('0x55')]=util['format'](_0x9506('0x56'),_0x29591a[_0x9506('0x50')],_0x2c4002['uniqueid'],md5(_0x2c4002[_0x9506('0x57')]));}else{_0x2c4002[_0x9506('0x55')]='';}return getConnection(_0x29591a)['then'](function(_0x1758b7){_0xe76f4b=_0x1758b7;return getUser(_0x29591a,_0x4aaa18[_0x9506('0xd')],_0xe76f4b);})[_0x9506('0x28')](function(_0x4a1d60){_0x2867e6=_0x4a1d60;logger['info'](_0x9506('0x58'),_0x2867e6['id']);return getEndUser(_0x29591a,_0x2c4002[_0x9506('0x59')],_0x2c4002[_0x9506('0x5a')],_0xe76f4b);})['then'](function(_0x3779b1){_0x4c6a69=_0x3779b1;logger[_0x9506('0xb')](_0x9506('0x5b'),_0x4c6a69['id']);return getTicket(_0x29591a,_0x2867e6,_0x4c6a69,_0x2c2f68,_0x2c4002,_0x2c2f68[_0x9506('0x5c')],_0xe76f4b,_0x9506('0x5d'));})[_0x9506('0x28')](function(_0x115913){_0x8f5fa5=_0x115913;logger[_0x9506('0xb')](_0x9506('0x5e'));logger['info'](_0x9506('0x5f'),_0x8f5fa5['id']);return setRelationship(_0xe76f4b,_0x2867e6,_0x8f5fa5,_0x9506('0x60'));})[_0x9506('0x28')](function(){return setRelationship(_0xe76f4b,_0x4c6a69,_0x8f5fa5,_0x9506('0x61'));})['then'](function(){return getServerInfo(_0xe76f4b);})['then'](function(_0x54a034){var _0x579919=parseInt(_0x54a034[_0x9506('0x62')][_0x9506('0x63')](0x0));var _0x2ee2d2=util[_0x9506('0x1f')](_0x9506('0x64'),_0x29591a[_0x9506('0x4f')],_0x8f5fa5['id']);if(_0x579919>0x6){_0x2ee2d2=util[_0x9506('0x1f')](_0x9506('0x65'),_0x29591a[_0x9506('0x4f')],_0x8f5fa5['id']);}logger[_0x9506('0xb')](_0x9506('0x53'),_0x9506('0x66'));emit(util[_0x9506('0x1f')](_0x9506('0x67'),_0x4aaa18[_0x9506('0xd')]),_0x9506('0x68'),{'uri':_0x2ee2d2});})[_0x9506('0x69')](function(_0xdadb4c){logger[_0x9506('0x6a')]('[QUEUE]',JSON[_0x9506('0x23')](_0xdadb4c));});};exports[_0x9506('0x6b')]=function(_0x97725c,_0x3ebfaa,_0x126142,_0x42d816,_0x37d35e,_0x17b4fe,_0x5bbc65){var _0x1db837,_0x2161da,_0x4d40e4,_0x21fb0f;_0x17b4fe[_0x9506('0x4f')]=intUtil[_0x9506('0x6c')](_0x17b4fe[_0x9506('0x4f')]);_0x17b4fe[_0x9506('0x50')]=intUtil[_0x9506('0x6c')](_0x17b4fe[_0x9506('0x50')]);def['uri']=util[_0x9506('0x1f')](_0x9506('0x52'),_0x17b4fe[_0x9506('0x4f')]);if(_0x5bbc65&&_0x5bbc65[_0x9506('0x6d')]&&_0x5bbc65['recordingFormat']!=='none'){logger[_0x9506('0xb')](_0x9506('0x6e'),_0x9506('0x54'));_0x3ebfaa[_0x9506('0x55')]=util[_0x9506('0x1f')](_0x9506('0x56'),_0x17b4fe['serverUrl'],_0x3ebfaa['uniqueid'],md5(_0x3ebfaa[_0x9506('0x57')]));}return getConnection(_0x17b4fe)[_0x9506('0x28')](function(_0x1e6c28){_0x21fb0f=_0x1e6c28;return getUser(_0x17b4fe,_0x42d816[_0x9506('0xd')],_0x21fb0f);})[_0x9506('0x28')](function(_0x1d6e61){_0x1db837=_0x1d6e61;logger['info']('The\x20User\x20ID\x20is:',_0x1db837['id']);return getEndUser(_0x17b4fe,_0x3ebfaa[_0x9506('0x6f')],_0x3ebfaa[_0x9506('0x70')],_0x21fb0f);})['then'](function(_0x392449){_0x2161da=_0x392449;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2161da['id']);return getTicket(_0x17b4fe,_0x1db837,_0x2161da,_0x126142,_0x3ebfaa,_0x126142[_0x9506('0x5c')],_0x21fb0f,_0x9506('0x71'));})['then'](function(_0x57562d){_0x4d40e4=_0x57562d;logger[_0x9506('0xb')](_0x9506('0x5e'));logger[_0x9506('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4d40e4['id']);return setRelationship(_0x21fb0f,_0x1db837,_0x4d40e4,_0x9506('0x60'));})[_0x9506('0x28')](function(){return setRelationship(_0x21fb0f,_0x2161da,_0x4d40e4,_0x9506('0x61'));})['then'](function(){return getServerInfo(_0x21fb0f);})[_0x9506('0x28')](function(_0x134e22){var _0x19bbea=parseInt(_0x134e22[_0x9506('0x62')][_0x9506('0x63')](0x0));var _0x3a31cb=util['format'](_0x9506('0x64'),_0x17b4fe[_0x9506('0x4f')],_0x4d40e4['id']);if(_0x19bbea>0x6){_0x3a31cb=util[_0x9506('0x1f')](_0x9506('0x65'),_0x17b4fe[_0x9506('0x4f')],_0x4d40e4['id']);}logger[_0x9506('0xb')](_0x9506('0x6e'),_0x9506('0x66'));emit(util[_0x9506('0x1f')]('user:%s',_0x42d816[_0x9506('0xd')]),_0x9506('0x68'),{'uri':_0x3a31cb});})[_0x9506('0x69')](function(_0x278bff){logger[_0x9506('0x6a')](_0x9506('0x6e'),JSON[_0x9506('0x23')](_0x278bff));});};exports['unmanaged']=function(_0x1d793e,_0x2e35b8,_0x367e69,_0x30b036,_0x59b722,_0xd8dd06){var _0x2dc5ac,_0x179c0b,_0x1dedd8,_0x291629;_0xd8dd06['remoteUri']=intUtil[_0x9506('0x6c')](_0xd8dd06[_0x9506('0x4f')]);_0xd8dd06[_0x9506('0x50')]=intUtil[_0x9506('0x6c')](_0xd8dd06[_0x9506('0x50')]);def[_0x9506('0x51')]=util[_0x9506('0x1f')](_0x9506('0x52'),_0xd8dd06[_0x9506('0x4f')]);if(_0x59b722&&_0x59b722[_0x9506('0x72')]){logger['info']('['+_0x2e35b8[_0x9506('0x73')][_0x9506('0x74')]()+']',_0x9506('0x54'));_0x2e35b8['recordingURL']=util[_0x9506('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd8dd06[_0x9506('0x50')],_0x2e35b8['uniqueid'],md5(_0x2e35b8[_0x9506('0x57')]));}else{_0x2e35b8[_0x9506('0x55')]='';}return getConnection(_0xd8dd06)[_0x9506('0x28')](function(_0x45052d){_0x291629=_0x45052d;if(!_['isNil'](_0x30b036)){return getUser(_0xd8dd06,_0x30b036[_0x9506('0xd')],_0x291629);}else{return getUser(_0xd8dd06,null,_0x291629);}})[_0x9506('0x28')](function(_0x343c73){_0x2dc5ac=_0x343c73;logger[_0x9506('0xb')](_0x9506('0x58'),_0x2dc5ac['id']);return getEndUser(_0xd8dd06,_0x2e35b8[_0x9506('0x59')],_0x2e35b8[_0x9506('0x5a')],_0x291629);})[_0x9506('0x28')](function(_0x203d82){_0x179c0b=_0x203d82;logger[_0x9506('0xb')](_0x9506('0x5b'),_0x179c0b['id']);return getTicket(_0xd8dd06,_0x2dc5ac,_0x179c0b,_0x367e69,_0x2e35b8,_0x367e69[_0x9506('0x5c')],_0x291629,_0x9506('0x5d'));})['then'](function(_0x1548a2){_0x1dedd8=_0x1548a2;logger['info'](_0x9506('0x5e'));logger[_0x9506('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1dedd8['id']);return setRelationship(_0x291629,_0x2dc5ac,_0x1dedd8,_0x9506('0x60'));})[_0x9506('0x28')](function(){return setRelationship(_0x291629,_0x179c0b,_0x1dedd8,_0x9506('0x61'));})['then'](function(){return getServerInfo(_0x291629);})['catch'](function(_0x4b7f5c){logger[_0x9506('0x6a')]('['+_0x2e35b8[_0x9506('0x73')][_0x9506('0x74')]()+']',JSON[_0x9506('0x23')](_0x4b7f5c));});}; \ 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 8347f83..816377a 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 _0xc8da=['toString','keyValue','keyType','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','length','type','string','content','variable','variableName','customVariable','Variable','name','push','toLowerCase'];(function(_0x3cfcc3,_0x1b3823){var _0x4e19a7=function(_0x192a14){while(--_0x192a14){_0x3cfcc3['push'](_0x3cfcc3['shift']());}};_0x4e19a7(++_0x1b3823);}(_0xc8da,0x11c));var _0xac8d=function(_0x17d7f3,_0x1c7267){_0x17d7f3=_0x17d7f3-0x0;var _0x1c3777=_0xc8da[_0x17d7f3];return _0x1c3777;};'use strict';var _=require(_0xac8d('0x0'));var util=require(_0xac8d('0x1'));exports['getString']=function(_0x38194a,_0x52c9b9,_0x542c87){var _0x765ca7=[];if(_0x38194a[_0xac8d('0x2')]>0x0){var _0x94e08b=_['sortBy'](_0x38194a,['id']);for(var _0x43834f=0x0;_0x43834f<_0x94e08b['length'];_0x43834f++){var _0x27d64e=_0x94e08b[_0x43834f];if(_0x27d64e[_0xac8d('0x3')]===_0xac8d('0x4')){_0x765ca7['push'](_0x27d64e[_0xac8d('0x5')]);}else if(_0x27d64e[_0xac8d('0x3')]===_0xac8d('0x6')&&_0x27d64e[_0xac8d('0x7')]){_0x52c9b9[_0x27d64e['variableName']]&&_0x765ca7['push'](_0x52c9b9[_0x27d64e['variableName']]['toString']());}else if(_0x27d64e[_0xac8d('0x3')]===_0xac8d('0x8')&&_0x27d64e['Variable']&&_0x27d64e[_0xac8d('0x9')][_0xac8d('0xa')]){_0x52c9b9[_0x27d64e['Variable'][_0xac8d('0xa')]['toLowerCase']()]&&_0x765ca7[_0xac8d('0xb')](_0x52c9b9[_0x27d64e[_0xac8d('0x9')][_0xac8d('0xa')][_0xac8d('0xc')]()][_0xac8d('0xd')]());}else if(_0x27d64e[_0xac8d('0x3')]===_0xac8d('0xe')){if(_0x27d64e[_0xac8d('0xf')]===_0xac8d('0x4')&&_0x27d64e['key']){_0x765ca7[_0xac8d('0xb')](util[_0xac8d('0x10')](_0xac8d('0x11'),_0x27d64e[_0xac8d('0x12')],_0x27d64e[_0xac8d('0x13')]));}else if(_0x27d64e['keyType']===_0xac8d('0x6')&&_0x27d64e[_0xac8d('0x7')]&&_0x27d64e['key']){_0x52c9b9[_0x27d64e[_0xac8d('0x7')]]&&_0x765ca7[_0xac8d('0xb')](util['format'](_0xac8d('0x11'),_0x27d64e[_0xac8d('0x12')],_0x52c9b9[_0x27d64e[_0xac8d('0x7')]]));}else if(_0x27d64e[_0xac8d('0xf')]===_0xac8d('0x8')&&_0x27d64e[_0xac8d('0x9')]&&_0x27d64e[_0xac8d('0x9')][_0xac8d('0xa')]&&_0x27d64e[_0xac8d('0x12')]){_0x52c9b9[_0x27d64e['Variable'][_0xac8d('0xa')][_0xac8d('0xc')]()]&&_0x765ca7[_0xac8d('0xb')](util[_0xac8d('0x10')](_0xac8d('0x11'),_0x27d64e[_0xac8d('0x12')],_0x52c9b9[_0x27d64e['Variable'][_0xac8d('0xa')]['toLowerCase']()]));}}}}return _0x765ca7[_0xac8d('0x14')](_0x542c87);};exports[_0xac8d('0x15')]=function(_0x12f5ba){var _0x2d92a7=_0x12f5ba['slice'](-0x1);if(_0x2d92a7==='/'){_0x12f5ba=_0x12f5ba[_0xac8d('0x16')](0x0,_0x12f5ba[_0xac8d('0x17')](_0x2d92a7));}return _0x12f5ba;};exports[_0xac8d('0x18')]=function(_0x60f33d){if(!_[_0xac8d('0x19')](_0x60f33d)&&_0x60f33d!==''){var _0x35044d=/^(([^<>()\[\]\\.,;:\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 _0x35044d[_0xac8d('0x1a')](String(_0x60f33d)[_0xac8d('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x01e2=['variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','variable','join','isNil','test','lodash','getString','length','sortBy','type','string','push','content'];(function(_0xd35dc6,_0x57a383){var _0x1bf881=function(_0x3216cd){while(--_0x3216cd){_0xd35dc6['push'](_0xd35dc6['shift']());}};_0x1bf881(++_0x57a383);}(_0x01e2,0xf5));var _0x201e=function(_0x4c1afb,_0xdc886b){_0x4c1afb=_0x4c1afb-0x0;var _0x5b8928=_0x01e2[_0x4c1afb];return _0x5b8928;};'use strict';var _=require(_0x201e('0x0'));var util=require('util');exports[_0x201e('0x1')]=function(_0x256962,_0x3243a7,_0x18becd){var _0x276eb4=[];if(_0x256962[_0x201e('0x2')]>0x0){var _0x3c2546=_[_0x201e('0x3')](_0x256962,['id']);for(var _0x4fddaa=0x0;_0x4fddaa<_0x3c2546[_0x201e('0x2')];_0x4fddaa++){var _0x2b5a6b=_0x3c2546[_0x4fddaa];if(_0x2b5a6b[_0x201e('0x4')]===_0x201e('0x5')){_0x276eb4[_0x201e('0x6')](_0x2b5a6b[_0x201e('0x7')]);}else if(_0x2b5a6b['type']==='variable'&&_0x2b5a6b[_0x201e('0x8')]){_0x3243a7[_0x2b5a6b[_0x201e('0x8')]]&&_0x276eb4['push'](_0x3243a7[_0x2b5a6b['variableName']][_0x201e('0x9')]());}else if(_0x2b5a6b[_0x201e('0x4')]===_0x201e('0xa')&&_0x2b5a6b[_0x201e('0xb')]&&_0x2b5a6b[_0x201e('0xb')][_0x201e('0xc')]){_0x3243a7[_0x2b5a6b[_0x201e('0xb')][_0x201e('0xc')][_0x201e('0xd')]()]&&_0x276eb4[_0x201e('0x6')](_0x3243a7[_0x2b5a6b[_0x201e('0xb')][_0x201e('0xc')][_0x201e('0xd')]()][_0x201e('0x9')]());}else if(_0x2b5a6b[_0x201e('0x4')]===_0x201e('0xe')){if(_0x2b5a6b[_0x201e('0xf')]==='string'&&_0x2b5a6b[_0x201e('0x10')]){_0x276eb4[_0x201e('0x6')](util[_0x201e('0x11')](_0x201e('0x12'),_0x2b5a6b['key'],_0x2b5a6b['keyContent']));}else if(_0x2b5a6b[_0x201e('0xf')]===_0x201e('0x13')&&_0x2b5a6b['variableName']&&_0x2b5a6b[_0x201e('0x10')]){_0x3243a7[_0x2b5a6b['variableName']]&&_0x276eb4['push'](util[_0x201e('0x11')](_0x201e('0x12'),_0x2b5a6b[_0x201e('0x10')],_0x3243a7[_0x2b5a6b[_0x201e('0x8')]]));}else if(_0x2b5a6b[_0x201e('0xf')]==='customVariable'&&_0x2b5a6b[_0x201e('0xb')]&&_0x2b5a6b['Variable']['name']&&_0x2b5a6b[_0x201e('0x10')]){_0x3243a7[_0x2b5a6b[_0x201e('0xb')][_0x201e('0xc')][_0x201e('0xd')]()]&&_0x276eb4[_0x201e('0x6')](util[_0x201e('0x11')](_0x201e('0x12'),_0x2b5a6b['key'],_0x3243a7[_0x2b5a6b[_0x201e('0xb')][_0x201e('0xc')]['toLowerCase']()]));}}}}return _0x276eb4[_0x201e('0x14')](_0x18becd);};exports['stripTrailingSlash']=function(_0x22a0a4){var _0x2aff80=_0x22a0a4['slice'](-0x1);if(_0x2aff80==='/'){_0x22a0a4=_0x22a0a4['substring'](0x0,_0x22a0a4['lastIndexOf'](_0x2aff80));}return _0x22a0a4;};exports['validateEmail']=function(_0x5bba87){if(!_[_0x201e('0x15')](_0x5bba87)&&_0x5bba87!==''){var _0x5b691f=/^(([^<>()\[\]\\.,;:\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 _0x5b691f[_0x201e('0x16')](String(_0x5bba87)[_0x201e('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 344c55b..ba6a6c5 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x510842,_0x1ad497){var _0x4d450b=function(_0x1d0c08){while(--_0x1d0c08){_0x510842['push'](_0x510842['shift']());}};_0x4d450b(++_0x1ad497);}(_0x34e8,0x12c));var _0x834e=function(_0x2599ac,_0x132a8e){_0x2599ac=_0x2599ac-0x0;var _0x198318=_0x34e8[_0x2599ac];return _0x198318;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index f5fec7a..4086f08 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 _0x9e87=['inspect','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Enduser\x20created.','user','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','type','nameField','customField','toLowerCase','content','includes','picklist','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration'];(function(_0x567fff,_0xd8acd8){var _0x465a37=function(_0x9d7bf7){while(--_0x9d7bf7){_0x567fff['push'](_0x567fff['shift']());}};_0x465a37(++_0xd8acd8);}(_0x9e87,0xe0));var _0x79e8=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0x9e87[_0x33155c];return _0x5becf7;};'use strict';var _=require(_0x79e8('0x0'));var rp=require(_0x79e8('0x1'));var md5=require(_0x79e8('0x2'));var util=require(_0x79e8('0x3'));var Redis=require('ioredis');var intUtil=require(_0x79e8('0x4'));var config=require(_0x79e8('0x5'));var logger=require(_0x79e8('0x6'))(_0x79e8('0x7'));config[_0x79e8('0x8')]=_[_0x79e8('0x9')](config[_0x79e8('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x79e8('0x8')]));function emit(_0x5ab3b1,_0x3ce358,_0x135da0){io['to'](_0x5ab3b1)['emit'](_0x3ce358,_0x135da0);}var headers={'Content-Type':_0x79e8('0xa'),'Accept':_0x79e8('0xa')};function getTicket(_0x44ac65,_0x369c0c,_0x2c20dc,_0x16a487,_0xfc3686){logger[_0x79e8('0xb')](_0x79e8('0xc'));return request({'uri':util[_0x79e8('0xd')](_0x79e8('0xe'),_0x44ac65[_0x79e8('0xf')]),'method':_0x79e8('0x10'),'body':{'ticket':_[_0x79e8('0x11')]({'requester_id':_0x2c20dc['id'],'submitter_id':_0x369c0c?_0x369c0c['id']:undefined,'assignee_id':_0x369c0c?_0x369c0c['id']:undefined,'tags':getTags(_0x16a487['Tags'],'name'),'subject':intUtil[_0x79e8('0x12')](_0x16a487[_0x79e8('0x13')],_0xfc3686,'\x20'),'description':intUtil[_0x79e8('0x12')](_0x16a487[_0x79e8('0x14')],_0xfc3686,'\x0a'),'comment':{'public':![],'body':intUtil[_0x79e8('0x12')](_0x16a487['Descriptions'],_0xfc3686,'\x0a')}},getCustomFields(_0x16a487[_0x79e8('0x15')],_0xfc3686))}})[_0x79e8('0x16')](function(_0x1fa83a){logger[_0x79e8('0xb')](_0x79e8('0x17'));return _0x1fa83a['ticket'];});}function getUser(_0x1b6385,_0x333c7e){if(intUtil[_0x79e8('0x18')](_0x333c7e)){logger['info'](_0x79e8('0x19'),_0x333c7e);return request({'uri':util['format'](_0x79e8('0x1a'),_0x1b6385[_0x79e8('0xf')]),'qs':{'query':util[_0x79e8('0xd')](_0x79e8('0x1b'),_0x333c7e)}})[_0x79e8('0x16')](function(_0x91524b){if(_0x91524b['count']){logger['info']('Agent\x20found!');return _['find'](_0x91524b[_0x79e8('0x1c')],{'email':_0x333c7e,'role':_0x79e8('0x1d')});}else{logger[_0x79e8('0xb')](_0x79e8('0x1e'));return request({'uri':util[_0x79e8('0xd')]('%s/users/me.json',_0x1b6385[_0x79e8('0xf')])})['then'](function(_0x58bdcc){logger[_0x79e8('0xb')](_0x79e8('0x1f'));return _0x58bdcc['user'];});}});}else{logger[_0x79e8('0xb')](_0x79e8('0x1e'));return request({'uri':util[_0x79e8('0xd')](_0x79e8('0x20'),_0x1b6385[_0x79e8('0xf')])})[_0x79e8('0x16')](function(_0xd74765){logger[_0x79e8('0xb')](_0x79e8('0x1f'));return _0xd74765['user'];});}}function getEndUser(_0x58434d,_0xe6dfce,_0x1081d0){logger[_0x79e8('0xb')](_0x79e8('0x21'),_0x1081d0);return request({'uri':util[_0x79e8('0xd')](_0x79e8('0x1a'),_0x58434d[_0x79e8('0xf')]),'qs':{'query':util[_0x79e8('0xd')](_0x79e8('0x22'),_0x1081d0)}})[_0x79e8('0x16')](function(_0x1c483a){var _0x4f96e0;if(_0x1c483a[_0x79e8('0x1c')][_0x79e8('0x23')]){_0x1c483a[_0x79e8('0x1c')]=_[_0x79e8('0x24')](_0x1c483a[_0x79e8('0x1c')],{'suspended':![],'role':_0x79e8('0x25')});if(_0x1c483a[_0x79e8('0x1c')]['length']){_0x4f96e0=_[_0x79e8('0x26')](_0x1c483a[_0x79e8('0x1c')]);}}if(_0x4f96e0){logger[_0x79e8('0xb')](_0x79e8('0x27'));return _0x4f96e0;}else{logger[_0x79e8('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x79e8('0xd')](_0x79e8('0x28'),_0x58434d[_0x79e8('0xf')]),'method':_0x79e8('0x10'),'body':{'user':{'role':_0x79e8('0x25'),'name':util[_0x79e8('0xd')]('Caller\x20-\x20%s',_0xe6dfce||_0x1081d0),'phone':_0x1081d0}}})[_0x79e8('0x16')](function(_0x56f3b4){logger[_0x79e8('0xb')](_0x79e8('0x29'));return _0x56f3b4[_0x79e8('0x2a')];});}});}function getAuth(_0x58ae9c){var _0x38e1b8;if(_0x58ae9c[_0x79e8('0x2b')]===_0x79e8('0x2c')){_0x38e1b8=util[_0x79e8('0xd')](_0x79e8('0x2d'),_0x58ae9c[_0x79e8('0x2e')],_0x58ae9c[_0x79e8('0x2c')]);}else if(_0x58ae9c[_0x79e8('0x2b')]===_0x79e8('0x2f')){_0x38e1b8=util[_0x79e8('0xd')]('%s/token:%s',_0x58ae9c[_0x79e8('0x2e')],_0x58ae9c[_0x79e8('0x2f')]);}return util[_0x79e8('0xd')](_0x79e8('0x30'),new Buffer(_0x38e1b8)[_0x79e8('0x31')](_0x79e8('0x32')));}function request(_0x84c307){logger['debug'](_0x79e8('0x33'),JSON[_0x79e8('0x34')](_0x84c307));return rp(_[_0x79e8('0x9')](_0x84c307,{'method':_0x79e8('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x591260,_0x2c424e){var _0x2405c5=[];if(_0x591260&&_0x591260[_0x79e8('0x23')]>0x0){_0x2405c5=_[_0x79e8('0x36')](_0x591260,_0x2c424e);}return _0x2405c5;}function getCustomFields(_0xd47f36,_0x3996b7){var _0x438cac=[];var _0x159567={'custom_fields':[]};if(_0xd47f36[_0x79e8('0x23')]>0x0){_[_0x79e8('0x37')](_0xd47f36,function(_0x437f44){if(_['includes'](['string','picklist'],_0x437f44[_0x79e8('0x38')])&&_0x437f44[_0x79e8('0x39')]&&!_0x437f44[_0x79e8('0x3a')]){_0x159567[_0x437f44[_0x79e8('0x39')][_0x79e8('0x3b')]()]=_0x437f44[_0x79e8('0x3c')]['toString']();}else if(_[_0x79e8('0x3d')](['string',_0x79e8('0x3e')],_0x437f44[_0x79e8('0x38')])&&_0x437f44[_0x79e8('0x3f')]&&_0x437f44[_0x79e8('0x3a')]){_0x159567[_0x79e8('0x40')][_0x79e8('0x41')]({'id':_0x437f44[_0x79e8('0x3f')],'value':_0x437f44[_0x79e8('0x3c')][_0x79e8('0x31')]()});}else if(_0x437f44[_0x79e8('0x38')]===_0x79e8('0x42')&&_0x437f44[_0x79e8('0x43')]&&_0x437f44[_0x79e8('0x3f')]&&_0x437f44['customField']){_0x3996b7[_0x437f44[_0x79e8('0x43')]]&&_0x159567[_0x79e8('0x40')][_0x79e8('0x41')]({'id':_0x437f44[_0x79e8('0x3f')],'value':_0x3996b7[_0x437f44[_0x79e8('0x43')]][_0x79e8('0x31')]()});}else if(_0x437f44[_0x79e8('0x38')]===_0x79e8('0x44')&&_0x437f44['Variable']&&_0x437f44[_0x79e8('0x45')][_0x79e8('0x46')]&&_0x437f44['idField']&&_0x437f44[_0x79e8('0x3a')]){_0x3996b7[_0x437f44[_0x79e8('0x45')][_0x79e8('0x46')]['toLowerCase']()]&&_0x159567[_0x79e8('0x40')][_0x79e8('0x41')]({'id':_0x437f44['idField'],'value':_0x3996b7[_0x437f44['Variable'][_0x79e8('0x46')]['toLowerCase']()][_0x79e8('0x31')]()});}});}return _0x159567;}exports[_0x79e8('0x47')]=function(_0x55b5e7,_0x276a9a,_0x5da294,_0x571f21,_0x461c44,_0x382bfc){var _0x4af772,_0x301984;_0x382bfc[_0x79e8('0xf')]=intUtil['stripTrailingSlash'](_0x382bfc[_0x79e8('0xf')]);_0x382bfc[_0x79e8('0x48')]=intUtil[_0x79e8('0x49')](_0x382bfc[_0x79e8('0x48')]);if(_0x461c44&&_0x461c44[_0x79e8('0x4a')]){logger['info'](_0x79e8('0x4b'),_0x79e8('0x4c'));_0x276a9a[_0x79e8('0x4d')]=util[_0x79e8('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x382bfc[_0x79e8('0x48')],_0x276a9a[_0x79e8('0x4e')],md5(_0x276a9a[_0x79e8('0x4e')]));}else{_0x276a9a[_0x79e8('0x4d')]='';}headers[_0x79e8('0x4f')]=getAuth(_0x382bfc);return getUser(_0x382bfc,_0x571f21['email'])['then'](function(_0x2da2af){_0x4af772=_0x2da2af;logger['info'](_0x79e8('0x50'),_0x4af772['id']);return getEndUser(_0x382bfc,_0x276a9a['calleridname'],_0x276a9a[_0x79e8('0x51')]);})[_0x79e8('0x16')](function(_0x112c23){_0x301984=_0x112c23;logger[_0x79e8('0xb')](_0x79e8('0x52'),_0x301984['id']);return getTicket(_0x382bfc,_0x4af772,_0x301984,_0x5da294,_0x276a9a);})[_0x79e8('0x16')](function(_0x673ecb){if(_0x673ecb){logger[_0x79e8('0xb')](_0x79e8('0x53'),_0x673ecb['id']);switch(_0x382bfc[_0x79e8('0x38')]){case _0x79e8('0x54'):logger[_0x79e8('0xb')](_0x79e8('0x4b'),_0x79e8('0x55'));return request({'uri':util[_0x79e8('0xd')](_0x79e8('0x56'),_0x382bfc[_0x79e8('0xf')],_0x4af772['id'],_0x673ecb['id']),'method':_0x79e8('0x10')});case _0x79e8('0x57'):logger[_0x79e8('0xb')](_0x79e8('0x4b'),_0x79e8('0x58'));emit(util[_0x79e8('0xd')](_0x79e8('0x59'),_0x571f21['name']),_0x79e8('0x5a'),{'uri':util[_0x79e8('0xd')]('%s/agent/tickets/%s',_0x382bfc[_0x79e8('0xf')][_0x79e8('0x5b')](_0x79e8('0x5c'),''),_0x673ecb['id'])});break;default:logger[_0x79e8('0x5d')](_0x79e8('0x4b'),_0x79e8('0x5e'));}}})[_0x79e8('0x5f')](function(_0x3dfe7c){logger[_0x79e8('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x3dfe7c,{'showHidden':!![],'depth':null}));});};exports[_0x79e8('0x60')]=function(_0x3cf0b1,_0x3185dc,_0x3998ee,_0x178d7e,_0xd32116,_0x2c32ed,_0x5ecdd8){var _0x5d9632,_0x913ed9;_0x2c32ed[_0x79e8('0xf')]=intUtil[_0x79e8('0x49')](_0x2c32ed[_0x79e8('0xf')]);_0x2c32ed[_0x79e8('0x48')]=intUtil['stripTrailingSlash'](_0x2c32ed['serverUrl']);if(_0x5ecdd8&&_0x5ecdd8[_0x79e8('0x61')]&&_0x5ecdd8['recordingFormat']!==_0x79e8('0x62')){logger[_0x79e8('0xb')](_0x79e8('0x63'),_0x79e8('0x4c'));_0x3185dc['recordingURL']=util[_0x79e8('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c32ed[_0x79e8('0x48')],_0x3185dc[_0x79e8('0x4e')],md5(_0x3185dc[_0x79e8('0x4e')]));}headers[_0x79e8('0x4f')]=getAuth(_0x2c32ed);return getUser(_0x2c32ed,_0x178d7e[_0x79e8('0x64')])['then'](function(_0x88dc22){_0x5d9632=_0x88dc22;logger['info'](_0x79e8('0x50'),_0x5d9632['id']);return getEndUser(_0x2c32ed,_0x3185dc[_0x79e8('0x65')],_0x3185dc['destcalleridnum']);})[_0x79e8('0x16')](function(_0x3b03a7){_0x913ed9=_0x3b03a7;logger[_0x79e8('0xb')](_0x79e8('0x52'),_0x913ed9['id']);return getTicket(_0x2c32ed,_0x5d9632,_0x913ed9,_0x3998ee,_0x3185dc);})[_0x79e8('0x16')](function(_0x2a6639){if(_0x2a6639){logger[_0x79e8('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2a6639['id']);switch(_0x2c32ed[_0x79e8('0x38')]){case _0x79e8('0x54'):logger[_0x79e8('0xb')](_0x79e8('0x63'),_0x79e8('0x55'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2c32ed[_0x79e8('0xf')],_0x5d9632['id'],_0x2a6639['id']),'method':_0x79e8('0x10')});case'newTab':logger[_0x79e8('0xb')]('[OUTBOUND]',_0x79e8('0x58'));emit(util[_0x79e8('0xd')](_0x79e8('0x59'),_0x178d7e[_0x79e8('0x46')]),_0x79e8('0x5a'),{'uri':util[_0x79e8('0xd')]('%s/agent/tickets/%s',_0x2c32ed['remoteUri'][_0x79e8('0x5b')]('/api/v2',''),_0x2a6639['id'])});break;default:logger['error'](_0x79e8('0x63'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x79e8('0x5f')](function(_0x38ce71){logger[_0x79e8('0x5d')](_0x79e8('0x66'),util[_0x79e8('0x67')](_0x38ce71,{'showHidden':!![],'depth':null}));});};exports[_0x79e8('0x68')]=function(_0x530c42,_0x43ec6d,_0x1d3505,_0x21d4af,_0x5c772e,_0x3460ae){var _0x6059da,_0x3d51ea;_0x3460ae['remoteUri']=intUtil['stripTrailingSlash'](_0x3460ae[_0x79e8('0xf')]);_0x3460ae['serverUrl']=intUtil['stripTrailingSlash'](_0x3460ae[_0x79e8('0x48')]);if(_0x5c772e&&_0x5c772e[_0x79e8('0x4a')]){logger[_0x79e8('0xb')]('['+_0x43ec6d[_0x79e8('0x69')][_0x79e8('0x6a')]()+']',_0x79e8('0x4c'));_0x43ec6d[_0x79e8('0x4d')]=util[_0x79e8('0xd')](_0x79e8('0x6b'),_0x3460ae[_0x79e8('0x48')],_0x43ec6d['uniqueid'],md5(_0x43ec6d[_0x79e8('0x4e')]));}else{_0x43ec6d[_0x79e8('0x4d')]='';}headers[_0x79e8('0x4f')]=getAuth(_0x3460ae);return getUser(_0x3460ae)['then'](function(_0x3c1994){_0x6059da=_0x3c1994;logger['info'](_0x79e8('0x50'),_0x6059da['id']);return getEndUser(_0x3460ae,_0x43ec6d['calleridname'],_0x43ec6d[_0x79e8('0x51')]);})['then'](function(_0x24a771){_0x3d51ea=_0x24a771;logger[_0x79e8('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3d51ea['id']);return getTicket(_0x3460ae,_0x6059da,_0x3d51ea,_0x1d3505,_0x43ec6d);})[_0x79e8('0x16')](function(_0x7873bb){if(_0x7873bb){logger[_0x79e8('0xb')](_0x79e8('0x53'),_0x7873bb['id']);}})[_0x79e8('0x5f')](function(_0x5360d5){logger[_0x79e8('0x5d')]('['+_0x43ec6d[_0x79e8('0x69')]['toUpperCase']()+']'+_0x79e8('0x6c'),util[_0x79e8('0x67')](_0x5360d5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9567=['getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','info','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','filter','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','password','%s:%s','username','authType','token','toString','base64','debug','[HTTP]','stringify','GET','forEach','string','type','nameField','customField','toLowerCase','content','includes','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','%s/agent/tickets/%s','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Authorization','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','name'];(function(_0x2cdff1,_0x1b246a){var _0x56f3b4=function(_0x428fb9){while(--_0x428fb9){_0x2cdff1['push'](_0x2cdff1['shift']());}};_0x56f3b4(++_0x1b246a);}(_0x9567,0xca));var _0x7956=function(_0x27f103,_0x1bb035){_0x27f103=_0x27f103-0x0;var _0x28c084=_0x9567[_0x27f103];return _0x28c084;};'use strict';var _=require(_0x7956('0x0'));var rp=require(_0x7956('0x1'));var md5=require(_0x7956('0x2'));var util=require(_0x7956('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7956('0x4'));var config=require(_0x7956('0x5'));var logger=require('../../../../config/logger')(_0x7956('0x6'));config[_0x7956('0x7')]=_[_0x7956('0x8')](config[_0x7956('0x7')],{'host':_0x7956('0x9'),'port':0x18eb});var io=require(_0x7956('0xa'))(new Redis(config[_0x7956('0x7')]));function emit(_0x5cc6a6,_0x55bb99,_0xc70588){io['to'](_0x5cc6a6)['emit'](_0x55bb99,_0xc70588);}var headers={'Content-Type':_0x7956('0xb'),'Accept':_0x7956('0xb')};function getTicket(_0x4ec2c0,_0x4c6690,_0x1d51d4,_0x15f310,_0x59a97e){logger['info'](_0x7956('0xc'));return request({'uri':util[_0x7956('0xd')]('%s/tickets.json',_0x4ec2c0[_0x7956('0xe')]),'method':_0x7956('0xf'),'body':{'ticket':_[_0x7956('0x10')]({'requester_id':_0x1d51d4['id'],'submitter_id':_0x4c6690?_0x4c6690['id']:undefined,'assignee_id':_0x4c6690?_0x4c6690['id']:undefined,'tags':getTags(_0x15f310['Tags'],_0x7956('0x11')),'subject':intUtil[_0x7956('0x12')](_0x15f310[_0x7956('0x13')],_0x59a97e,'\x20'),'description':intUtil[_0x7956('0x12')](_0x15f310['Descriptions'],_0x59a97e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7956('0x12')](_0x15f310[_0x7956('0x14')],_0x59a97e,'\x0a')}},getCustomFields(_0x15f310[_0x7956('0x15')],_0x59a97e))}})['then'](function(_0x35ece7){logger['info'](_0x7956('0x16'));return _0x35ece7[_0x7956('0x17')];});}function getUser(_0x2f62ee,_0x37bd40){if(intUtil[_0x7956('0x18')](_0x37bd40)){logger[_0x7956('0x19')](_0x7956('0x1a'),_0x37bd40);return request({'uri':util[_0x7956('0xd')](_0x7956('0x1b'),_0x2f62ee['remoteUri']),'qs':{'query':util[_0x7956('0xd')](_0x7956('0x1c'),_0x37bd40)}})[_0x7956('0x1d')](function(_0x3c88f2){if(_0x3c88f2[_0x7956('0x1e')]){logger[_0x7956('0x19')](_0x7956('0x1f'));return _[_0x7956('0x20')](_0x3c88f2[_0x7956('0x21')],{'email':_0x37bd40,'role':'agent'});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7956('0xd')](_0x7956('0x22'),_0x2f62ee[_0x7956('0xe')])})[_0x7956('0x1d')](function(_0x490ecf){logger['info'](_0x7956('0x23'));return _0x490ecf[_0x7956('0x24')];});}});}else{logger[_0x7956('0x19')](_0x7956('0x25'));return request({'uri':util[_0x7956('0xd')](_0x7956('0x22'),_0x2f62ee[_0x7956('0xe')])})['then'](function(_0x5bac57){logger[_0x7956('0x19')](_0x7956('0x23'));return _0x5bac57[_0x7956('0x24')];});}}function getEndUser(_0x527df9,_0xfa25b7,_0x3866a7){logger['info'](_0x7956('0x26'),_0x3866a7);return request({'uri':util[_0x7956('0xd')]('%s/search.json',_0x527df9['remoteUri']),'qs':{'query':util[_0x7956('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x3866a7)}})['then'](function(_0x524b08){var _0xe9ad53;if(_0x524b08[_0x7956('0x21')]['length']){_0x524b08[_0x7956('0x21')]=_[_0x7956('0x27')](_0x524b08[_0x7956('0x21')],{'suspended':![],'role':'end-user'});if(_0x524b08[_0x7956('0x21')][_0x7956('0x28')]){_0xe9ad53=_['first'](_0x524b08[_0x7956('0x21')]);}}if(_0xe9ad53){logger[_0x7956('0x19')](_0x7956('0x29'));return _0xe9ad53;}else{logger[_0x7956('0x19')](_0x7956('0x2a'));return request({'uri':util[_0x7956('0xd')](_0x7956('0x2b'),_0x527df9['remoteUri']),'method':'POST','body':{'user':{'role':_0x7956('0x2c'),'name':util['format'](_0x7956('0x2d'),_0xfa25b7||_0x3866a7),'phone':_0x3866a7}}})['then'](function(_0x113949){logger['info']('Enduser\x20created.');return _0x113949[_0x7956('0x24')];});}});}function getAuth(_0x2e728e){var _0x5aa604;if(_0x2e728e['authType']===_0x7956('0x2e')){_0x5aa604=util[_0x7956('0xd')](_0x7956('0x2f'),_0x2e728e[_0x7956('0x30')],_0x2e728e[_0x7956('0x2e')]);}else if(_0x2e728e[_0x7956('0x31')]===_0x7956('0x32')){_0x5aa604=util[_0x7956('0xd')]('%s/token:%s',_0x2e728e['username'],_0x2e728e[_0x7956('0x32')]);}return util[_0x7956('0xd')]('Basic\x20%s',new Buffer(_0x5aa604)[_0x7956('0x33')](_0x7956('0x34')));}function request(_0x174981){logger[_0x7956('0x35')](_0x7956('0x36'),JSON[_0x7956('0x37')](_0x174981));return rp(_[_0x7956('0x8')](_0x174981,{'method':_0x7956('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x86966c,_0x2b8c94){var _0xb3a4=[];if(_0x86966c&&_0x86966c[_0x7956('0x28')]>0x0){_0xb3a4=_['map'](_0x86966c,_0x2b8c94);}return _0xb3a4;}function getCustomFields(_0x4be86d,_0x2b364b){var _0x2eaa4f=[];var _0x4ce65b={'custom_fields':[]};if(_0x4be86d[_0x7956('0x28')]>0x0){_[_0x7956('0x39')](_0x4be86d,function(_0x4a2324){if(_['includes']([_0x7956('0x3a'),'picklist'],_0x4a2324[_0x7956('0x3b')])&&_0x4a2324[_0x7956('0x3c')]&&!_0x4a2324[_0x7956('0x3d')]){_0x4ce65b[_0x4a2324['nameField'][_0x7956('0x3e')]()]=_0x4a2324[_0x7956('0x3f')][_0x7956('0x33')]();}else if(_[_0x7956('0x40')]([_0x7956('0x3a'),'picklist'],_0x4a2324['type'])&&_0x4a2324[_0x7956('0x41')]&&_0x4a2324[_0x7956('0x3d')]){_0x4ce65b[_0x7956('0x42')][_0x7956('0x43')]({'id':_0x4a2324[_0x7956('0x41')],'value':_0x4a2324[_0x7956('0x3f')]['toString']()});}else if(_0x4a2324['type']===_0x7956('0x44')&&_0x4a2324[_0x7956('0x45')]&&_0x4a2324[_0x7956('0x41')]&&_0x4a2324[_0x7956('0x3d')]){_0x2b364b[_0x4a2324['variableName']]&&_0x4ce65b[_0x7956('0x42')][_0x7956('0x43')]({'id':_0x4a2324[_0x7956('0x41')],'value':_0x2b364b[_0x4a2324[_0x7956('0x45')]]['toString']()});}else if(_0x4a2324['type']===_0x7956('0x46')&&_0x4a2324[_0x7956('0x47')]&&_0x4a2324[_0x7956('0x47')][_0x7956('0x11')]&&_0x4a2324[_0x7956('0x41')]&&_0x4a2324[_0x7956('0x3d')]){_0x2b364b[_0x4a2324[_0x7956('0x47')][_0x7956('0x11')][_0x7956('0x3e')]()]&&_0x4ce65b[_0x7956('0x42')][_0x7956('0x43')]({'id':_0x4a2324[_0x7956('0x41')],'value':_0x2b364b[_0x4a2324['Variable'][_0x7956('0x11')][_0x7956('0x3e')]()][_0x7956('0x33')]()});}});}return _0x4ce65b;}exports[_0x7956('0x48')]=function(_0x34e4bf,_0x405ef3,_0x4f1af3,_0x6835ae,_0x178c2f,_0x5a1aba){var _0xe7f8e,_0x7f954b;_0x5a1aba[_0x7956('0xe')]=intUtil[_0x7956('0x49')](_0x5a1aba[_0x7956('0xe')]);_0x5a1aba['serverUrl']=intUtil[_0x7956('0x49')](_0x5a1aba[_0x7956('0x4a')]);if(_0x178c2f&&_0x178c2f[_0x7956('0x4b')]){logger[_0x7956('0x19')](_0x7956('0x4c'),_0x7956('0x4d'));_0x405ef3[_0x7956('0x4e')]=util[_0x7956('0xd')](_0x7956('0x4f'),_0x5a1aba[_0x7956('0x4a')],_0x405ef3['uniqueid'],md5(_0x405ef3[_0x7956('0x50')]));}else{_0x405ef3[_0x7956('0x4e')]='';}headers['Authorization']=getAuth(_0x5a1aba);return getUser(_0x5a1aba,_0x6835ae['email'])[_0x7956('0x1d')](function(_0x435292){_0xe7f8e=_0x435292;logger[_0x7956('0x19')]('The\x20User\x20ID\x20is:',_0xe7f8e['id']);return getEndUser(_0x5a1aba,_0x405ef3['calleridname'],_0x405ef3[_0x7956('0x51')]);})['then'](function(_0x10b92f){_0x7f954b=_0x10b92f;logger[_0x7956('0x19')](_0x7956('0x52'),_0x7f954b['id']);return getTicket(_0x5a1aba,_0xe7f8e,_0x7f954b,_0x4f1af3,_0x405ef3);})[_0x7956('0x1d')](function(_0x5306a1){if(_0x5306a1){logger[_0x7956('0x19')](_0x7956('0x53'),_0x5306a1['id']);switch(_0x5a1aba[_0x7956('0x3b')]){case _0x7956('0x54'):logger[_0x7956('0x19')](_0x7956('0x4c'),_0x7956('0x55'));return request({'uri':util['format'](_0x7956('0x56'),_0x5a1aba['remoteUri'],_0xe7f8e['id'],_0x5306a1['id']),'method':_0x7956('0xf')});case _0x7956('0x57'):logger[_0x7956('0x19')](_0x7956('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7956('0x58'),_0x6835ae['name']),'trigger:browser:url',{'uri':util[_0x7956('0xd')](_0x7956('0x59'),_0x5a1aba['remoteUri']['replace']('/api/v2',''),_0x5306a1['id'])});break;default:logger['error'](_0x7956('0x4c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7956('0x5a')](function(_0x145d07){logger[_0x7956('0x5b')](_0x7956('0x5c'),util[_0x7956('0x5d')](_0x145d07,{'showHidden':!![],'depth':null}));});};exports[_0x7956('0x5e')]=function(_0x3876cd,_0x1d0773,_0x23af38,_0x4e2bb4,_0x5c6831,_0x118643,_0x299269){var _0x278880,_0x38c714;_0x118643[_0x7956('0xe')]=intUtil[_0x7956('0x49')](_0x118643['remoteUri']);_0x118643[_0x7956('0x4a')]=intUtil['stripTrailingSlash'](_0x118643[_0x7956('0x4a')]);if(_0x299269&&_0x299269[_0x7956('0x5f')]&&_0x299269[_0x7956('0x5f')]!=='none'){logger[_0x7956('0x19')](_0x7956('0x60'),_0x7956('0x4d'));_0x1d0773[_0x7956('0x4e')]=util[_0x7956('0xd')](_0x7956('0x4f'),_0x118643[_0x7956('0x4a')],_0x1d0773[_0x7956('0x50')],md5(_0x1d0773[_0x7956('0x50')]));}headers[_0x7956('0x61')]=getAuth(_0x118643);return getUser(_0x118643,_0x4e2bb4[_0x7956('0x62')])[_0x7956('0x1d')](function(_0x260d66){_0x278880=_0x260d66;logger['info'](_0x7956('0x63'),_0x278880['id']);return getEndUser(_0x118643,_0x1d0773[_0x7956('0x64')],_0x1d0773[_0x7956('0x65')]);})['then'](function(_0x579d37){_0x38c714=_0x579d37;logger[_0x7956('0x19')]('The\x20Enduser\x20ID\x20is:',_0x38c714['id']);return getTicket(_0x118643,_0x278880,_0x38c714,_0x23af38,_0x1d0773);})[_0x7956('0x1d')](function(_0x2e4eac){if(_0x2e4eac){logger['info']('The\x20Ticket\x20ID\x20is:',_0x2e4eac['id']);switch(_0x118643[_0x7956('0x3b')]){case _0x7956('0x54'):logger['info']('[OUTBOUND]',_0x7956('0x55'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x118643['remoteUri'],_0x278880['id'],_0x2e4eac['id']),'method':'POST'});case _0x7956('0x57'):logger[_0x7956('0x19')](_0x7956('0x60'),_0x7956('0x66'));emit(util['format'](_0x7956('0x58'),_0x4e2bb4[_0x7956('0x11')]),_0x7956('0x67'),{'uri':util['format'](_0x7956('0x59'),_0x118643[_0x7956('0xe')][_0x7956('0x68')]('/api/v2',''),_0x2e4eac['id'])});break;default:logger[_0x7956('0x5b')](_0x7956('0x60'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7956('0x5a')](function(_0x212177){logger['error'](_0x7956('0x69'),util['inspect'](_0x212177,{'showHidden':!![],'depth':null}));});};exports[_0x7956('0x6a')]=function(_0x5d78bd,_0x5d107c,_0x45521c,_0x4b2a80,_0x3eecb1,_0x466f84){var _0x42d7cb,_0x1bee5d;_0x466f84[_0x7956('0xe')]=intUtil['stripTrailingSlash'](_0x466f84[_0x7956('0xe')]);_0x466f84['serverUrl']=intUtil[_0x7956('0x49')](_0x466f84['serverUrl']);if(_0x3eecb1&&_0x3eecb1['monitor_format']){logger[_0x7956('0x19')]('['+_0x5d107c[_0x7956('0x6b')]['toUpperCase']()+']',_0x7956('0x4d'));_0x5d107c[_0x7956('0x4e')]=util[_0x7956('0xd')](_0x7956('0x4f'),_0x466f84['serverUrl'],_0x5d107c['uniqueid'],md5(_0x5d107c['uniqueid']));}else{_0x5d107c[_0x7956('0x4e')]='';}headers[_0x7956('0x61')]=getAuth(_0x466f84);return getUser(_0x466f84)[_0x7956('0x1d')](function(_0x45880d){_0x42d7cb=_0x45880d;logger[_0x7956('0x19')]('The\x20User\x20ID\x20is:',_0x42d7cb['id']);return getEndUser(_0x466f84,_0x5d107c['calleridname'],_0x5d107c[_0x7956('0x51')]);})['then'](function(_0x5988a3){_0x1bee5d=_0x5988a3;logger[_0x7956('0x19')]('The\x20Enduser\x20ID\x20is:',_0x1bee5d['id']);return getTicket(_0x466f84,_0x42d7cb,_0x1bee5d,_0x45521c,_0x5d107c);})[_0x7956('0x1d')](function(_0x82a51b){if(_0x82a51b){logger['info'](_0x7956('0x53'),_0x82a51b['id']);}})[_0x7956('0x5a')](function(_0x1ebff8){logger['error']('['+_0x5d107c[_0x7956('0x6b')][_0x7956('0x6c')]()+']'+_0x7956('0x6d'),util[_0x7956('0x5d')](_0x1ebff8,{'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 53df464..c1eee24 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 _0x1e32=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','serverUrl','recordingFormat','[OUTBOUND]','/api/voice/recordings/','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','toUpperCase','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','then','catch','stack','info','Search\x20user','GET','ActiveUsers','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','moduleCreate','role','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent','called','connect','Call_Result','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','queue','host','stripTrailingSlash'];(function(_0x624727,_0x42f874){var _0x5ac512=function(_0x2a45b3){while(--_0x2a45b3){_0x624727['push'](_0x624727['shift']());}};_0x5ac512(++_0x42f874);}(_0x1e32,0xac));var _0x21e3=function(_0x8dd127,_0x4c7dd0){_0x8dd127=_0x8dd127-0x0;var _0x107505=_0x1e32[_0x8dd127];return _0x107505;};'use strict';var _=require(_0x21e3('0x0'));var rp=require(_0x21e3('0x1'));var md5=require(_0x21e3('0x2'));var util=require(_0x21e3('0x3'));var intUtil=require(_0x21e3('0x4'));var moment=require('moment');var Redis=require(_0x21e3('0x5'));var BPromise=require(_0x21e3('0x6'));var config=require(_0x21e3('0x7'));var logger=require(_0x21e3('0x8'))('zoho');config[_0x21e3('0x9')]=_[_0x21e3('0xa')](config[_0x21e3('0x9')],{'host':_0x21e3('0xb'),'port':0x18eb});var io=require(_0x21e3('0xc'))(new Redis(config[_0x21e3('0x9')]));function emit(_0x3a346f,_0x4db89c,_0x2a701f){io['to'](_0x3a346f)[_0x21e3('0xd')](_0x4db89c,_0x2a701f);}function request(_0x44b775){logger['debug'](_0x21e3('0xe'),JSON[_0x21e3('0xf')](_0x44b775));return rp(_0x44b775);}function getCustomFields(_0x4badd0,_0x5c78d8){var _0x34a9af={};if(_0x4badd0[_0x21e3('0x10')]>0x0){_[_0x21e3('0x11')](_0x4badd0,function(_0x589d93){if(_[_0x21e3('0x12')](['string',_0x21e3('0x13')],_0x589d93[_0x21e3('0x14')])&&_0x589d93[_0x21e3('0x15')]){_0x34a9af[_0x589d93[_0x21e3('0x15')]]=_0x589d93['content'][_0x21e3('0x16')]();}else if(_0x589d93[_0x21e3('0x14')]===_0x21e3('0x17')&&_0x589d93[_0x21e3('0x18')]&&_0x589d93[_0x21e3('0x15')]&&_0x5c78d8[_0x589d93[_0x21e3('0x18')]]){_0x34a9af[_0x589d93['idField']]=_0x5c78d8[_0x589d93[_0x21e3('0x18')]][_0x21e3('0x16')]();}else if(_0x589d93[_0x21e3('0x14')]===_0x21e3('0x19')&&_0x589d93['Variable']&&_0x589d93[_0x21e3('0x1a')][_0x21e3('0x1b')]&&_0x589d93['idField']&&_0x5c78d8[_0x589d93[_0x21e3('0x1a')][_0x21e3('0x1b')]['toLowerCase']()]){_0x34a9af[_0x589d93[_0x21e3('0x15')]]=_0x5c78d8[_0x589d93['Variable'][_0x21e3('0x1b')][_0x21e3('0x1c')]()][_0x21e3('0x16')]();}});}return _0x34a9af;}function getName(_0x50b5ea){if(_0x50b5ea['indexOf']('\x20')>0x0){var _0x5d7dfc=_0x50b5ea[_0x21e3('0x1d')](/ (.+)/);if(_0x5d7dfc[0x1]){return _0x5d7dfc;}}return[_0x50b5ea,_0x50b5ea];}var accountsTokens={};function getAccessToken(_0x2ddf9f){return new Promise(function(_0x42b795,_0x2f5f15){if(!_[_0x21e3('0x1e')](accountsTokens[_0x2ddf9f['id']])&&!_['isNil'](accountsTokens[_0x2ddf9f['id']][_0x21e3('0x1f')])){if(moment()[_0x21e3('0x20')](accountsTokens[_0x2ddf9f['id']][_0x21e3('0x21')])){_0x42b795(accountsTokens[_0x2ddf9f['id']][_0x21e3('0x1f')]);}}var _0x3ae9fc;switch(_0x2ddf9f['zone']){case'US':_0x3ae9fc='https://accounts.zoho.com';break;case'AU':_0x3ae9fc=_0x21e3('0x22');break;case'EU':_0x3ae9fc=_0x21e3('0x23');break;case'IN':_0x3ae9fc='https://accounts.zoho.in';break;case'CN':_0x3ae9fc=_0x21e3('0x24');break;default:_0x3ae9fc=_0x21e3('0x23');break;}var _0xb501d2={'method':_0x21e3('0x25'),'uri':_0x3ae9fc+_0x21e3('0x26'),'qs':{'refresh_token':_0x2ddf9f['refreshToken'],'client_id':_0x2ddf9f[_0x21e3('0x27')],'client_secret':_0x2ddf9f['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0xb501d2)[_0x21e3('0x28')](function(_0x2a76f3){accountsTokens[_0x2ddf9f['id']]={'access_token':_0x2a76f3[_0x21e3('0x1f')],'expires_in':moment()['add'](_0x2a76f3[_0x21e3('0x21')],'seconds')};_0x42b795(_0x2a76f3[_0x21e3('0x1f')]);})[_0x21e3('0x29')](function(_0x4b7986){logger['error']('Failing\x20creating\x20the\x20access_token',_0x4b7986[_0x21e3('0x2a')]);_0x2f5f15(_0x4b7986);});});}function getUser(_0x2e4e8c,_0x57c8fc,_0x2d5e93,_0x18510f){logger[_0x21e3('0x2b')](_0x21e3('0x2c'));return request({'method':_0x21e3('0x2d'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x57c8fc),'qs':{'type':_0x21e3('0x2e')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2e4e8c},'json':!![]})[_0x21e3('0x28')](function(_0x114a88){if(_0x114a88[_0x21e3('0x2f')]){var _0x512f7a=-0x1;if(_['isArrayLikeObject'](_0x114a88['users'])){if(!_['isNil'](_0x18510f)){_0x512f7a=_[_0x21e3('0x30')](_0x114a88['users'],function(_0x5ea10b){return _0x5ea10b[_0x21e3('0x31')]===_0x18510f;});}if(_0x512f7a>=0x0){logger[_0x21e3('0x2b')](_0x21e3('0x32'));}else{logger[_0x21e3('0x2b')](_0x21e3('0x33'));_0x512f7a=_[_0x21e3('0x30')](_0x114a88[_0x21e3('0x2f')],function(_0x173ca3){return _0x173ca3[_0x21e3('0x34')][_0x21e3('0x1b')]===_0x21e3('0x35');});}return _0x114a88['users'][_0x512f7a];}else{if(_0x114a88[_0x21e3('0x36')][_0x21e3('0x34')][_0x21e3('0x1b')]===_0x21e3('0x35')){logger[_0x21e3('0x2b')](_0x21e3('0x33'));user=_0x114a88[_0x21e3('0x36')];return user;}else{logger[_0x21e3('0x37')](_0x21e3('0x38'),JSON[_0x21e3('0xf')](_0x114a88));throw new Error(_0x21e3('0x39')+JSON[_0x21e3('0xf')](_0x114a88));}}}else{logger['error'](_0x21e3('0x38'),JSON[_0x21e3('0xf')](_0x114a88));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x21e3('0xf')](_0x114a88));}})[_0x21e3('0x29')](function(_0x2d64ed){console['error'](_0x2d64ed);});}function getZohoUser(_0x59f811,_0x2743e6){return new BPromise(function(_0xc1f601,_0x60feff){request(_0x59f811)[_0x21e3('0x28')](function(_0x4c9e5a){var _0x373608=null;if(_0x4c9e5a){_0x373608=_0x4c9e5a[_0x21e3('0x3a')][0x0];_0x373608[_0x21e3('0x3b')]=_0x2743e6;}_0xc1f601(_0x373608);})[_0x21e3('0x29')](function(_0x2d3dd6){_0x60feff(_0x2d3dd6);});});}function createEndUser(_0x485c55,_0x4e00e4,_0x1058d9,_0x509fa0,_0x395cf9,_0x3afff8){var _0x1058d9=getName(_0x1058d9);return request({'method':_0x21e3('0x25'),'uri':_0x21e3('0x3c')+_0x4e00e4+'/crm/v2/'+_['startCase'](_0x3afff8[_0x21e3('0x3d')])+'s','body':{'data':[{'Last_Name':_0x1058d9[0x1],'First_Name':_0x1058d9[0x0],'Phone':_0x509fa0,'Owner':{'name':!_[_0x21e3('0x1e')](_0x395cf9[_0x21e3('0x3e')]['name'])?_0x395cf9[_0x21e3('0x3e')][_0x21e3('0x1b')]:!_[_0x21e3('0x1e')](_0x395cf9['first_name'])?_0x395cf9['first_name']+'\x20'+_0x395cf9[_0x21e3('0x3f')]:_0x395cf9['last_name'],'id':_0x395cf9['id']}}]},'headers':{'Authorization':_0x21e3('0x40')+_0x485c55},'json':!![]})[_0x21e3('0x28')](function(_0x3cc1e8){if(_0x3cc1e8&&_0x3cc1e8[_0x21e3('0x3a')][0x0][_0x21e3('0x41')]===_0x21e3('0x42')){var _0x2bd3e2=_0x3cc1e8[_0x21e3('0x3a')][0x0][_0x21e3('0x43')];_0x2bd3e2[_0x21e3('0x3b')]=_[_0x21e3('0x44')](_0x3afff8[_0x21e3('0x3d')])+'s';return _0x2bd3e2;}logger[_0x21e3('0x37')](_0x21e3('0x38'),JSON[_0x21e3('0xf')](data));throw new Error(_0x21e3('0x45')+JSON[_0x21e3('0xf')](data));})['catch'](function(_0x57794d){console[_0x21e3('0x46')](_0x21e3('0x47'),_0x57794d);});}function getEndUser(_0x315e5f,_0x33c7c1,_0xaaac59,_0x5671f1,_0x2da66b,_0x557c6a,_0x555933){var _0x755811={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x315e5f},'json':!![]};switch(_0x555933[_0x21e3('0x48')]){case _0x21e3('0x49'):_0x755811['uri']='https://www.zohoapis.'+_0x33c7c1+_0x21e3('0x4a')+_0x2da66b+'))';return getZohoUser(_0x755811,_0x21e3('0x4b'))[_0x21e3('0x28')](function(_0x5b2568){if(_0x5b2568)return _0x5b2568;_0x755811[_0x21e3('0x4c')]=_0x21e3('0x3c')+_0x33c7c1+_0x21e3('0x4d')+_0x2da66b+'))';return getZohoUser(_0x755811,_0x21e3('0x4e'))[_0x21e3('0x28')](function(_0x8113ee){if(_0x8113ee)return _0x8113ee;if(_0x555933[_0x21e3('0x3d')]!=_0x21e3('0x4f')){return createEndUser(_0x315e5f,_0x33c7c1,_0x5671f1,_0x2da66b,_0x557c6a,_0x555933);}else{return{};}});});break;case _0x21e3('0x50'):_0x755811['uri']=_0x21e3('0x3c')+_0x33c7c1+_0x21e3('0x4a')+_0x2da66b+'))';return getZohoUser(_0x755811,_0x21e3('0x4b'))[_0x21e3('0x28')](function(_0x27250c){if(_0x27250c)return _0x27250c;if(_0x555933[_0x21e3('0x3d')]!=_0x21e3('0x4f')){return createEndUser(_0x315e5f,_0x33c7c1,_0x5671f1,_0x2da66b,_0x557c6a,_0x555933);}else{return{};}});break;case _0x21e3('0x51'):_0x755811[_0x21e3('0x4c')]=_0x21e3('0x3c')+_0x33c7c1+_0x21e3('0x4d')+_0x2da66b+'))';return getZohoUser(_0x755811,'Leads')[_0x21e3('0x28')](function(_0x244a32){if(_0x244a32)return _0x244a32;if(_0x555933[_0x21e3('0x3d')]!=_0x21e3('0x4f')){return createEndUser(_0x315e5f,_0x33c7c1,_0x5671f1,_0x2da66b,_0x557c6a,_0x555933);}else{return{};}});break;}}function getCall(_0x12036d,_0x279656,_0x2563c1,_0x2bf788,_0x2e1453,_0x184a17,_0x4825f0,_0x666957){logger['info'](_0x21e3('0x52'));var _0x5095d7={};_0x5095d7[_0x21e3('0x53')]={'name':!_[_0x21e3('0x1e')](_0x2bf788['role'][_0x21e3('0x1b')])&&!_[_0x21e3('0x1e')](_0x2bf788[_0x21e3('0x34')][_0x21e3('0x1b')])&&_0x2bf788['profile'][_0x21e3('0x1b')]===_0x21e3('0x54')?_0x2bf788['role'][_0x21e3('0x1b')]:!_['isNil'](_0x2bf788['first_name'])?_0x2bf788[_0x21e3('0x55')]+'\x20'+_0x2bf788[_0x21e3('0x3f')]:_0x2bf788[_0x21e3('0x3f')],'id':_0x2bf788['id']};_0x5095d7[_0x21e3('0x56')]=intUtil[_0x21e3('0x57')](_0x184a17['Subjects'],_0x4825f0,'\x20');_0x5095d7['Description']=intUtil[_0x21e3('0x57')](_0x184a17[_0x21e3('0x58')],_0x4825f0,'\x0a');if(_0x2e1453['enduserType']==='Contacts'){_0x5095d7[_0x21e3('0x59')]={'name':!_['isNil'](_0x2e1453[_0x21e3('0x5a')])?_0x2e1453[_0x21e3('0x5a')]:!_[_0x21e3('0x1e')](_0x2e1453[_0x21e3('0x5b')])?_0x2e1453['First_Name']+'\x20'+_0x2e1453[_0x21e3('0x5c')]:_0x2e1453['Last_Name'],'id':_0x2e1453['id']};}if(_0x2e1453[_0x21e3('0x3b')]===_0x21e3('0x4e')){_0x5095d7[_0x21e3('0x5d')]={'name':!_[_0x21e3('0x1e')](_0x2e1453[_0x21e3('0x5a')])?_0x2e1453[_0x21e3('0x5a')]:!_[_0x21e3('0x1e')](_0x2e1453[_0x21e3('0x5b')])?_0x2e1453[_0x21e3('0x5b')]+'\x20'+_0x2e1453['Last_Name']:_0x2e1453[_0x21e3('0x5c')],'id':_0x2e1453['id']};_0x5095d7[_0x21e3('0x5e')]=_[_0x21e3('0x44')](_0x2e1453[_0x21e3('0x3b')]);}if(_0x4825f0[_0x21e3('0x5f')]){_0x5095d7[_0x21e3('0x60')]=moment[_0x21e3('0x61')](parseInt(_0x4825f0[_0x21e3('0x5f')])*0x3e8)['format']('mm:ss');}else if(_0x4825f0['answertime']&&_0x4825f0['endtime']){_0x5095d7[_0x21e3('0x60')]=moment[_0x21e3('0x61')](moment(_0x4825f0[_0x21e3('0x62')],_0x21e3('0x63'))[_0x21e3('0x64')](moment(_0x4825f0[_0x21e3('0x65')],_0x21e3('0x63'))))[_0x21e3('0x66')]('mm:ss');}switch(_0x4825f0[_0x21e3('0x67')]){case _0x21e3('0x68'):_0x5095d7['Call_Result']='Called';break;case'complete':case _0x21e3('0x69'):_0x5095d7[_0x21e3('0x6a')]='Answered';break;case _0x21e3('0x6b'):_0x5095d7[_0x21e3('0x6a')]=_0x21e3('0x6c');break;case _0x21e3('0x6d'):_0x5095d7[_0x21e3('0x6a')]=_0x21e3('0x6e');break;case _0x21e3('0x6f'):_0x5095d7['Call_Result']=_0x21e3('0x70');default:}_0x5095d7['Call_Start_Time']=(_0x666957===_0x21e3('0x71')?moment(_0x4825f0[_0x21e3('0x65')])[_0x21e3('0x66')](_0x21e3('0x63')):moment(_0x4825f0['agentcalledAt'])[_0x21e3('0x66')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x21e3('0x66')](_0x21e3('0x63'));_0x5095d7[_0x21e3('0x72')]=_0x666957||_0x21e3('0x73');_0x5095d7=_[_0x21e3('0x74')](_0x5095d7,getCustomFields(_0x184a17[_0x21e3('0x75')],_0x4825f0));return request({'method':_0x21e3('0x25'),'uri':_0x21e3('0x3c')+_0x279656+_0x21e3('0x76'),'headers':{'Authorization':_0x21e3('0x40')+_0x12036d},'body':{'data':[_0x5095d7]},'json':!![]})[_0x21e3('0x28')](function(_0x445cb1){if(_0x445cb1&&_0x445cb1['data'][0x0][_0x21e3('0x41')]==='SUCCESS'){logger[_0x21e3('0x2b')]('Call\x20created!');return{'id':_0x445cb1[_0x21e3('0x3a')][0x0][_0x21e3('0x43')]['id']};}})[_0x21e3('0x29')](function(_0xe40b25){logger['info']('err',_0xe40b25[_0x21e3('0x2a')]);console[_0x21e3('0x46')]('err',_0xe40b25);});}exports[_0x21e3('0x77')]=function(_0x50ae96,_0x106196,_0xa0092d,_0x38e165,_0xfccc4c,_0x556e25){var _0x3233e2,_0x52c466,_0xb2c00d;_0x556e25[_0x21e3('0x78')]=intUtil[_0x21e3('0x79')](_0x556e25[_0x21e3('0x78')]);_0x556e25['serverUrl']=intUtil[_0x21e3('0x79')](_0x556e25['serverUrl']);if(_0xfccc4c&&_0xfccc4c[_0x21e3('0x7a')]){logger[_0x21e3('0x2b')](_0x21e3('0x7b'),_0x21e3('0x7c'));_0x106196[_0x21e3('0x7d')]=_0x556e25['serverUrl']+'/api/voice/recordings/'+_0x106196[_0x21e3('0x7e')]+_0x21e3('0x7f')+md5(_0x106196[_0x21e3('0x7e')]);}else{_0x106196[_0x21e3('0x7d')]='';}var _0xeae2a0=_0x556e25[_0x21e3('0x78')]===_0x21e3('0x80')?'eu':_0x21e3('0x81');return getAccessToken(_0x556e25)[_0x21e3('0x28')](function(_0xad3e50){_0xb2c00d=_0xad3e50;return getUser(_0xb2c00d,_0xeae2a0,_0x556e25,_0x38e165[_0x21e3('0x31')]);})['then'](function(_0x3aa5fa){_0x3233e2=_0x3aa5fa;logger[_0x21e3('0x2b')](_0x21e3('0x82'),_0x3233e2['id']);return getEndUser(_0xb2c00d,_0xeae2a0,_0x556e25,_0x106196[_0x21e3('0x83')],_0x106196[_0x21e3('0x84')],_0x3233e2,_0xa0092d);})[_0x21e3('0x28')](function(_0x3d5385){_0x52c466=_0x3d5385;return getCall(_0xb2c00d,_0xeae2a0,_0x556e25,_0x3233e2,_0x52c466,_0xa0092d,_0x106196,_0x21e3('0x73'));})[_0x21e3('0x28')](function(_0x317eb3){if(_0x317eb3){logger[_0x21e3('0x2b')](_0x21e3('0x85'),_0x317eb3['id']);logger[_0x21e3('0x2b')]('[QUEUE]',_0x21e3('0x86'));emit(util['format'](_0x21e3('0x87'),_0x38e165[_0x21e3('0x1b')]),'trigger:browser:url',{'uri':_0x21e3('0x88')+_0x556e25[_0x21e3('0x78')]+_0x21e3('0x89')+_0x317eb3['id']});}})[_0x21e3('0x29')](function(_0x249746){logger[_0x21e3('0x37')](_0x21e3('0x7b'),JSON[_0x21e3('0xf')](_0x249746));});};exports['outbound']=function(_0x5b0ac6,_0x314dbc,_0x4918fb,_0x11f6a2,_0xf284d9,_0x3c680a,_0x387390){var _0x1a2de7,_0x25e50b,_0x246c02;_0x3c680a[_0x21e3('0x78')]=intUtil['stripTrailingSlash'](_0x3c680a[_0x21e3('0x78')]);_0x3c680a['serverUrl']=intUtil['stripTrailingSlash'](_0x3c680a[_0x21e3('0x8a')]);if(_0x387390&&_0x387390[_0x21e3('0x8b')]&&_0x387390[_0x21e3('0x8b')]!=='none'){logger[_0x21e3('0x2b')](_0x21e3('0x8c'),_0x21e3('0x7c'));_0x314dbc['recordingURL']=_0x3c680a[_0x21e3('0x8a')]+_0x21e3('0x8d')+_0x314dbc[_0x21e3('0x7e')]+_0x21e3('0x7f')+md5(_0x314dbc['uniqueid']);}var _0x4df4e3=_0x3c680a['host']===_0x21e3('0x80')?'eu':'com';return getAccessToken(_0x3c680a)[_0x21e3('0x28')](function(_0x3212){_0x246c02=_0x3212;return getUser(_0x246c02,_0x4df4e3,_0x3c680a,_0x11f6a2['email']);})['then'](function(_0x496c55){_0x1a2de7=_0x496c55;logger['info'](_0x21e3('0x82'),_0x1a2de7['id']);return getEndUser(_0x246c02,_0x4df4e3,_0x3c680a,_0x314dbc[_0x21e3('0x8e')],_0x314dbc[_0x21e3('0x8f')],_0x1a2de7,_0x4918fb);})[_0x21e3('0x28')](function(_0x2336dc){_0x25e50b=_0x2336dc;return getCall(_0x246c02,_0x4df4e3,_0x3c680a,_0x1a2de7,_0x25e50b,_0x4918fb,_0x314dbc,_0x21e3('0x90'));})[_0x21e3('0x28')](function(_0x2b3018){if(_0x2b3018){logger['info']('The\x20Call\x20ID\x20is:',_0x2b3018['id']);logger[_0x21e3('0x2b')](_0x21e3('0x8c'),_0x21e3('0x86'));emit(util[_0x21e3('0x66')]('user:%s',_0x11f6a2[_0x21e3('0x1b')]),_0x21e3('0x91'),{'uri':_0x21e3('0x88')+_0x3c680a[_0x21e3('0x78')]+_0x21e3('0x89')+_0x2b3018['id']});}})['catch'](function(_0x5c9042){logger[_0x21e3('0x37')]('[OUTBOUND]',JSON[_0x21e3('0xf')](_0x5c9042));});};exports['unmanaged']=function(_0x596925,_0x3bd69a,_0xd80b60,_0x4e318a,_0x12bdee,_0x2a7379){var _0x330da3,_0x101fc8,_0x18cc23;_0x2a7379[_0x21e3('0x78')]=intUtil['stripTrailingSlash'](_0x2a7379[_0x21e3('0x78')]);_0x2a7379[_0x21e3('0x8a')]=intUtil[_0x21e3('0x79')](_0x2a7379[_0x21e3('0x8a')]);if(_0x12bdee&&_0x12bdee[_0x21e3('0x7a')]){logger['info']('['+_0x3bd69a[_0x21e3('0x67')][_0x21e3('0x92')]()+']','Recording\x20is\x20enabled!');_0x3bd69a['recordingURL']=_0x2a7379[_0x21e3('0x8a')]+'/api/voice/recordings/'+_0x3bd69a[_0x21e3('0x7e')]+_0x21e3('0x7f')+md5(_0x3bd69a[_0x21e3('0x7e')]);}else{_0x3bd69a[_0x21e3('0x7d')]='';}var _0x298feb=_0x2a7379[_0x21e3('0x78')]===_0x21e3('0x80')?'eu':_0x21e3('0x81');return getAccessToken(_0x2a7379)[_0x21e3('0x28')](function(_0x262540){_0x18cc23=_0x262540;return getUser(_0x18cc23,_0x298feb,_0x2a7379);})[_0x21e3('0x28')](function(_0x5dd45b){_0x330da3=_0x5dd45b;logger[_0x21e3('0x2b')](_0x21e3('0x82'),_0x330da3['id']);return getEndUser(_0x18cc23,_0x298feb,_0x2a7379,_0x3bd69a[_0x21e3('0x83')],_0x3bd69a[_0x21e3('0x84')],_0x330da3,_0xd80b60);})[_0x21e3('0x28')](function(_0x244be7){_0x101fc8=_0x244be7;return getCall(_0x18cc23,_0x298feb,_0x2a7379,_0x330da3,_0x101fc8,_0xd80b60,_0x3bd69a,'Inbound');})[_0x21e3('0x28')](function(_0x535bdf){if(_0x535bdf){logger['info'](_0x21e3('0x85'),_0x535bdf['id']);}})[_0x21e3('0x29')](function(_0x5029ba){logger[_0x21e3('0x37')]('['+_0x3bd69a[_0x21e3('0x67')]['toUpperCase']()+']',JSON[_0x21e3('0xf')](_0x5029ba));});}; \ No newline at end of file +var _0xcb4f=['isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','Error:\x20','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','contact','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Abandoned','Timeout','Call_Start_Time','format','agentcalledAt','merge','Fields','/crm/v2/Calls','err','log','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','https://crm.','unmanaged','toUpperCase','request-promise','util','moment','ioredis','bluebird','../../../../config/logger','defaults','localhost','emit','debug','[HTTP]','stringify','length','forEach','string','picklist','type','idField','content','variable','variableName','toString','customVariable','name','Variable','split'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0xcb4f,0x1b1));var _0xfcb4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xcb4f[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var rp=require(_0xfcb4('0x0'));var md5=require('md5');var util=require(_0xfcb4('0x1'));var intUtil=require('./util');var moment=require(_0xfcb4('0x2'));var Redis=require(_0xfcb4('0x3'));var BPromise=require(_0xfcb4('0x4'));var config=require('../../../../config/environment');var logger=require(_0xfcb4('0x5'))('zoho');config['redis']=_[_0xfcb4('0x6')](config['redis'],{'host':_0xfcb4('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5d9069,_0x565b1c,_0x145a53){io['to'](_0x5d9069)[_0xfcb4('0x8')](_0x565b1c,_0x145a53);}function request(_0x68e07f){logger[_0xfcb4('0x9')](_0xfcb4('0xa'),JSON[_0xfcb4('0xb')](_0x68e07f));return rp(_0x68e07f);}function getCustomFields(_0x1fb27a,_0x58bc41){var _0x48b677={};if(_0x1fb27a[_0xfcb4('0xc')]>0x0){_[_0xfcb4('0xd')](_0x1fb27a,function(_0x18ff02){if(_['includes']([_0xfcb4('0xe'),_0xfcb4('0xf')],_0x18ff02[_0xfcb4('0x10')])&&_0x18ff02[_0xfcb4('0x11')]){_0x48b677[_0x18ff02['idField']]=_0x18ff02[_0xfcb4('0x12')]['toString']();}else if(_0x18ff02[_0xfcb4('0x10')]===_0xfcb4('0x13')&&_0x18ff02[_0xfcb4('0x14')]&&_0x18ff02[_0xfcb4('0x11')]&&_0x58bc41[_0x18ff02[_0xfcb4('0x14')]]){_0x48b677[_0x18ff02['idField']]=_0x58bc41[_0x18ff02['variableName']][_0xfcb4('0x15')]();}else if(_0x18ff02[_0xfcb4('0x10')]===_0xfcb4('0x16')&&_0x18ff02['Variable']&&_0x18ff02['Variable'][_0xfcb4('0x17')]&&_0x18ff02[_0xfcb4('0x11')]&&_0x58bc41[_0x18ff02['Variable'][_0xfcb4('0x17')]['toLowerCase']()]){_0x48b677[_0x18ff02[_0xfcb4('0x11')]]=_0x58bc41[_0x18ff02[_0xfcb4('0x18')][_0xfcb4('0x17')]['toLowerCase']()][_0xfcb4('0x15')]();}});}return _0x48b677;}function getName(_0x572b45){if(_0x572b45['indexOf']('\x20')>0x0){var _0x3867ad=_0x572b45[_0xfcb4('0x19')](/ (.+)/);if(_0x3867ad[0x1]){return _0x3867ad;}}return[_0x572b45,_0x572b45];}var accountsTokens={};function getAccessToken(_0x3f9103){return new Promise(function(_0x5b8ba7,_0x20d54d){if(!_[_0xfcb4('0x1a')](accountsTokens[_0x3f9103['id']])&&!_['isNil'](accountsTokens[_0x3f9103['id']][_0xfcb4('0x1b')])){if(moment()[_0xfcb4('0x1c')](accountsTokens[_0x3f9103['id']]['expires_in'])){_0x5b8ba7(accountsTokens[_0x3f9103['id']][_0xfcb4('0x1b')]);}}var _0x2f0752;switch(_0x3f9103[_0xfcb4('0x1d')]){case'US':_0x2f0752=_0xfcb4('0x1e');break;case'AU':_0x2f0752=_0xfcb4('0x1f');break;case'EU':_0x2f0752=_0xfcb4('0x20');break;case'IN':_0x2f0752=_0xfcb4('0x21');break;case'CN':_0x2f0752=_0xfcb4('0x22');break;default:_0x2f0752=_0xfcb4('0x20');break;}var _0x280662={'method':_0xfcb4('0x23'),'uri':_0x2f0752+_0xfcb4('0x24'),'qs':{'refresh_token':_0x3f9103[_0xfcb4('0x25')],'client_id':_0x3f9103['clientId'],'client_secret':_0x3f9103['clientSecret'],'grant_type':_0xfcb4('0x26')},'json':!![]};return rp(_0x280662)[_0xfcb4('0x27')](function(_0x5f12df){accountsTokens[_0x3f9103['id']]={'access_token':_0x5f12df[_0xfcb4('0x1b')],'expires_in':moment()[_0xfcb4('0x28')](_0x5f12df[_0xfcb4('0x29')],_0xfcb4('0x2a'))};_0x5b8ba7(_0x5f12df[_0xfcb4('0x1b')]);})[_0xfcb4('0x2b')](function(_0x377041){logger[_0xfcb4('0x2c')](_0xfcb4('0x2d'),_0x377041[_0xfcb4('0x2e')]);_0x20d54d(_0x377041);});});}function getUser(_0x5b52e5,_0x124658,_0x41e403,_0x3a060e){logger[_0xfcb4('0x2f')]('Search\x20user');return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x124658),'qs':{'type':_0xfcb4('0x30')},'headers':{'Authorization':_0xfcb4('0x31')+_0x5b52e5},'json':!![]})[_0xfcb4('0x27')](function(_0x23c7ea){if(_0x23c7ea[_0xfcb4('0x32')]){var _0x29b162=-0x1;if(_[_0xfcb4('0x33')](_0x23c7ea[_0xfcb4('0x32')])){if(!_[_0xfcb4('0x1a')](_0x3a060e)){_0x29b162=_[_0xfcb4('0x34')](_0x23c7ea[_0xfcb4('0x32')],function(_0x531e94){return _0x531e94[_0xfcb4('0x35')]===_0x3a060e;});}if(_0x29b162>=0x0){logger[_0xfcb4('0x2f')](_0xfcb4('0x36'));}else{logger[_0xfcb4('0x2f')](_0xfcb4('0x37'));_0x29b162=_[_0xfcb4('0x34')](_0x23c7ea[_0xfcb4('0x32')],function(_0x2483b9){return _0x2483b9[_0xfcb4('0x38')]['name']===_0xfcb4('0x39');});}return _0x23c7ea['users'][_0x29b162];}else{if(_0x23c7ea[_0xfcb4('0x3a')][_0xfcb4('0x38')][_0xfcb4('0x17')]==='Administrator'){logger[_0xfcb4('0x2f')]('Using\x20the\x20admin\x20account!');user=_0x23c7ea[_0xfcb4('0x3a')];return user;}else{logger['error'](_0xfcb4('0x3b'),JSON[_0xfcb4('0xb')](_0x23c7ea));throw new Error(_0xfcb4('0x3c')+JSON['stringify'](_0x23c7ea));}}}else{logger[_0xfcb4('0x2c')](_0xfcb4('0x3b'),JSON[_0xfcb4('0xb')](_0x23c7ea));throw new Error(_0xfcb4('0x3c')+JSON[_0xfcb4('0xb')](_0x23c7ea));}})[_0xfcb4('0x2b')](function(_0x45ae41){console[_0xfcb4('0x2c')](_0x45ae41);});}function getZohoUser(_0x277ff0,_0x1a95f1){return new BPromise(function(_0x405c2f,_0x206787){request(_0x277ff0)['then'](function(_0x3c575a){var _0x1b422a=null;if(_0x3c575a){_0x1b422a=_0x3c575a[_0xfcb4('0x3d')][0x0];_0x1b422a[_0xfcb4('0x3e')]=_0x1a95f1;}_0x405c2f(_0x1b422a);})[_0xfcb4('0x2b')](function(_0x492979){_0x206787(_0x492979);});});}function createEndUser(_0x52de53,_0x50b43b,_0x35589e,_0x12c682,_0xf7f29c,_0x311bed){var _0x35589e=getName(_0x35589e);return request({'method':_0xfcb4('0x23'),'uri':'https://www.zohoapis.'+_0x50b43b+_0xfcb4('0x3f')+_[_0xfcb4('0x40')](_0x311bed['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x35589e[0x1],'First_Name':_0x35589e[0x0],'Phone':_0x12c682,'Owner':{'name':!_['isNil'](_0xf7f29c['role']['name'])?_0xf7f29c[_0xfcb4('0x41')]['name']:!_[_0xfcb4('0x1a')](_0xf7f29c[_0xfcb4('0x42')])?_0xf7f29c['first_name']+'\x20'+_0xf7f29c[_0xfcb4('0x43')]:_0xf7f29c[_0xfcb4('0x43')],'id':_0xf7f29c['id']}}]},'headers':{'Authorization':_0xfcb4('0x31')+_0x52de53},'json':!![]})[_0xfcb4('0x27')](function(_0x2a8ff6){if(_0x2a8ff6&&_0x2a8ff6[_0xfcb4('0x3d')][0x0][_0xfcb4('0x44')]===_0xfcb4('0x45')){var _0x3371f8=_0x2a8ff6[_0xfcb4('0x3d')][0x0]['details'];_0x3371f8[_0xfcb4('0x3e')]=_[_0xfcb4('0x40')](_0x311bed['moduleCreate'])+'s';return _0x3371f8;}logger[_0xfcb4('0x2c')](_0xfcb4('0x3b'),JSON[_0xfcb4('0xb')](data));throw new Error(_0xfcb4('0x46')+JSON[_0xfcb4('0xb')](data));})[_0xfcb4('0x2b')](function(_0x1305ed){console['log'](_0xfcb4('0x47'),_0x1305ed);});}function getEndUser(_0x2bc970,_0x46ace5,_0x16c057,_0xeb0288,_0xedd6b1,_0x4493f1,_0x15e041){var _0x59a954={'method':_0xfcb4('0x48'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2bc970},'json':!![]};switch(_0x15e041[_0xfcb4('0x49')]){case _0xfcb4('0x4a'):_0x59a954[_0xfcb4('0x4b')]=_0xfcb4('0x4c')+_0x46ace5+_0xfcb4('0x4d')+_0xedd6b1+'))';return getZohoUser(_0x59a954,_0xfcb4('0x4e'))[_0xfcb4('0x27')](function(_0x537159){if(_0x537159)return _0x537159;_0x59a954[_0xfcb4('0x4b')]=_0xfcb4('0x4c')+_0x46ace5+_0xfcb4('0x4f')+_0xedd6b1+'))';return getZohoUser(_0x59a954,_0xfcb4('0x50'))[_0xfcb4('0x27')](function(_0x266f21){if(_0x266f21)return _0x266f21;if(_0x15e041[_0xfcb4('0x51')]!=_0xfcb4('0x52')){return createEndUser(_0x2bc970,_0x46ace5,_0xeb0288,_0xedd6b1,_0x4493f1,_0x15e041);}else{return{};}});});break;case _0xfcb4('0x53'):_0x59a954['uri']=_0xfcb4('0x4c')+_0x46ace5+_0xfcb4('0x4d')+_0xedd6b1+'))';return getZohoUser(_0x59a954,_0xfcb4('0x4e'))[_0xfcb4('0x27')](function(_0x47e38b){if(_0x47e38b)return _0x47e38b;if(_0x15e041[_0xfcb4('0x51')]!=_0xfcb4('0x52')){return createEndUser(_0x2bc970,_0x46ace5,_0xeb0288,_0xedd6b1,_0x4493f1,_0x15e041);}else{return{};}});break;case'lead':_0x59a954[_0xfcb4('0x4b')]=_0xfcb4('0x4c')+_0x46ace5+_0xfcb4('0x4f')+_0xedd6b1+'))';return getZohoUser(_0x59a954,_0xfcb4('0x50'))[_0xfcb4('0x27')](function(_0x46a98d){if(_0x46a98d)return _0x46a98d;if(_0x15e041['moduleCreate']!=_0xfcb4('0x52')){return createEndUser(_0x2bc970,_0x46ace5,_0xeb0288,_0xedd6b1,_0x4493f1,_0x15e041);}else{return{};}});break;}}function getCall(_0x5405e4,_0x4a5f20,_0x4d9ed3,_0x5b5ef0,_0x53d2d5,_0x3fcbbf,_0x3580e3,_0x97c78a){logger['info'](_0xfcb4('0x54'));var _0x1ee719={};_0x1ee719[_0xfcb4('0x55')]={'name':!_['isNil'](_0x5b5ef0[_0xfcb4('0x41')][_0xfcb4('0x17')])&&!_[_0xfcb4('0x1a')](_0x5b5ef0[_0xfcb4('0x38')][_0xfcb4('0x17')])&&_0x5b5ef0[_0xfcb4('0x38')][_0xfcb4('0x17')]===_0xfcb4('0x56')?_0x5b5ef0['role'][_0xfcb4('0x17')]:!_[_0xfcb4('0x1a')](_0x5b5ef0[_0xfcb4('0x42')])?_0x5b5ef0[_0xfcb4('0x42')]+'\x20'+_0x5b5ef0[_0xfcb4('0x43')]:_0x5b5ef0['last_name'],'id':_0x5b5ef0['id']};_0x1ee719['Subject']=intUtil[_0xfcb4('0x57')](_0x3fcbbf[_0xfcb4('0x58')],_0x3580e3,'\x20');_0x1ee719[_0xfcb4('0x59')]=intUtil[_0xfcb4('0x57')](_0x3fcbbf[_0xfcb4('0x5a')],_0x3580e3,'\x0a');if(_0x53d2d5[_0xfcb4('0x3e')]===_0xfcb4('0x4e')){_0x1ee719[_0xfcb4('0x5b')]={'name':!_['isNil'](_0x53d2d5[_0xfcb4('0x5c')])?_0x53d2d5[_0xfcb4('0x5c')]:!_[_0xfcb4('0x1a')](_0x53d2d5[_0xfcb4('0x5d')])?_0x53d2d5['First_Name']+'\x20'+_0x53d2d5[_0xfcb4('0x5e')]:_0x53d2d5[_0xfcb4('0x5e')],'id':_0x53d2d5['id']};}if(_0x53d2d5[_0xfcb4('0x3e')]===_0xfcb4('0x50')){_0x1ee719[_0xfcb4('0x5f')]={'name':!_[_0xfcb4('0x1a')](_0x53d2d5[_0xfcb4('0x5c')])?_0x53d2d5[_0xfcb4('0x5c')]:!_[_0xfcb4('0x1a')](_0x53d2d5[_0xfcb4('0x5d')])?_0x53d2d5['First_Name']+'\x20'+_0x53d2d5[_0xfcb4('0x5e')]:_0x53d2d5[_0xfcb4('0x5e')],'id':_0x53d2d5['id']};_0x1ee719['$se_module']=_[_0xfcb4('0x40')](_0x53d2d5[_0xfcb4('0x3e')]);}if(_0x3580e3[_0xfcb4('0x60')]){_0x1ee719[_0xfcb4('0x61')]=moment[_0xfcb4('0x62')](parseInt(_0x3580e3[_0xfcb4('0x60')])*0x3e8)['format']('mm:ss');}else if(_0x3580e3[_0xfcb4('0x63')]&&_0x3580e3['endtime']){_0x1ee719[_0xfcb4('0x61')]=moment[_0xfcb4('0x62')](moment(_0x3580e3[_0xfcb4('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xfcb4('0x65')](moment(_0x3580e3[_0xfcb4('0x66')],_0xfcb4('0x67'))))['format']('mm:ss');}switch(_0x3580e3[_0xfcb4('0x68')]){case _0xfcb4('0x69'):_0x1ee719['Call_Result']=_0xfcb4('0x6a');break;case _0xfcb4('0x6b'):case _0xfcb4('0x6c'):_0x1ee719[_0xfcb4('0x6d')]=_0xfcb4('0x6e');break;case _0xfcb4('0x6f'):_0x1ee719[_0xfcb4('0x6d')]='Rejected';break;case'abandoned':_0x1ee719[_0xfcb4('0x6d')]=_0xfcb4('0x70');break;case'timeout':_0x1ee719[_0xfcb4('0x6d')]=_0xfcb4('0x71');default:}_0x1ee719[_0xfcb4('0x72')]=(_0x97c78a==='outbound'?moment(_0x3580e3[_0xfcb4('0x66')])[_0xfcb4('0x73')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3580e3[_0xfcb4('0x74')])[_0xfcb4('0x73')](_0xfcb4('0x67')))||moment()[_0xfcb4('0x73')](_0xfcb4('0x67'));_0x1ee719['Call_Type']=_0x97c78a||'Inbound';_0x1ee719=_[_0xfcb4('0x75')](_0x1ee719,getCustomFields(_0x3fcbbf[_0xfcb4('0x76')],_0x3580e3));return request({'method':_0xfcb4('0x23'),'uri':_0xfcb4('0x4c')+_0x4a5f20+_0xfcb4('0x77'),'headers':{'Authorization':_0xfcb4('0x31')+_0x5405e4},'body':{'data':[_0x1ee719]},'json':!![]})['then'](function(_0x1cb8f6){if(_0x1cb8f6&&_0x1cb8f6['data'][0x0]['code']===_0xfcb4('0x45')){logger[_0xfcb4('0x2f')]('Call\x20created!');return{'id':_0x1cb8f6['data'][0x0]['details']['id']};}})[_0xfcb4('0x2b')](function(_0x4201e1){logger[_0xfcb4('0x2f')](_0xfcb4('0x78'),_0x4201e1[_0xfcb4('0x2e')]);console[_0xfcb4('0x79')](_0xfcb4('0x78'),_0x4201e1);});}exports['queue']=function(_0x1bb80e,_0x1d54ff,_0x4e862e,_0x106408,_0x18b189,_0x5b02c1){var _0x2b8edf,_0x2d893b,_0xd15851;_0x5b02c1['host']=intUtil[_0xfcb4('0x7a')](_0x5b02c1[_0xfcb4('0x7b')]);_0x5b02c1['serverUrl']=intUtil['stripTrailingSlash'](_0x5b02c1[_0xfcb4('0x7c')]);if(_0x18b189&&_0x18b189[_0xfcb4('0x7d')]){logger[_0xfcb4('0x2f')](_0xfcb4('0x7e'),_0xfcb4('0x7f'));_0x1d54ff['recordingURL']=_0x5b02c1[_0xfcb4('0x7c')]+_0xfcb4('0x80')+_0x1d54ff[_0xfcb4('0x81')]+_0xfcb4('0x82')+md5(_0x1d54ff[_0xfcb4('0x81')]);}else{_0x1d54ff[_0xfcb4('0x83')]='';}var _0x727f52=_0x5b02c1[_0xfcb4('0x7b')]===_0xfcb4('0x84')?'eu':_0xfcb4('0x85');return getAccessToken(_0x5b02c1)[_0xfcb4('0x27')](function(_0xfe6c33){_0xd15851=_0xfe6c33;return getUser(_0xd15851,_0x727f52,_0x5b02c1,_0x106408[_0xfcb4('0x35')]);})[_0xfcb4('0x27')](function(_0x3d6a7){_0x2b8edf=_0x3d6a7;logger[_0xfcb4('0x2f')](_0xfcb4('0x86'),_0x2b8edf['id']);return getEndUser(_0xd15851,_0x727f52,_0x5b02c1,_0x1d54ff[_0xfcb4('0x87')],_0x1d54ff[_0xfcb4('0x88')],_0x2b8edf,_0x4e862e);})['then'](function(_0x38a163){_0x2d893b=_0x38a163;return getCall(_0xd15851,_0x727f52,_0x5b02c1,_0x2b8edf,_0x2d893b,_0x4e862e,_0x1d54ff,_0xfcb4('0x89'));})[_0xfcb4('0x27')](function(_0x2d67a7){if(_0x2d67a7){logger[_0xfcb4('0x2f')](_0xfcb4('0x8a'),_0x2d67a7['id']);logger[_0xfcb4('0x2f')](_0xfcb4('0x7e'),_0xfcb4('0x8b'));emit(util[_0xfcb4('0x73')](_0xfcb4('0x8c'),_0x106408[_0xfcb4('0x17')]),_0xfcb4('0x8d'),{'uri':'https://crm.'+_0x5b02c1['host']+_0xfcb4('0x8e')+_0x2d67a7['id']});}})[_0xfcb4('0x2b')](function(_0x2b2b01){logger['error']('[QUEUE]',JSON[_0xfcb4('0xb')](_0x2b2b01));});};exports[_0xfcb4('0x8f')]=function(_0xff6031,_0x33fe76,_0x1cc896,_0x31a77a,_0x4015ff,_0x3efc76,_0x2de64e){var _0x4a573b,_0x8282c9,_0x11e03e;_0x3efc76['host']=intUtil[_0xfcb4('0x7a')](_0x3efc76['host']);_0x3efc76[_0xfcb4('0x7c')]=intUtil[_0xfcb4('0x7a')](_0x3efc76[_0xfcb4('0x7c')]);if(_0x2de64e&&_0x2de64e['recordingFormat']&&_0x2de64e[_0xfcb4('0x90')]!==_0xfcb4('0x91')){logger['info'](_0xfcb4('0x92'),_0xfcb4('0x7f'));_0x33fe76[_0xfcb4('0x83')]=_0x3efc76[_0xfcb4('0x7c')]+_0xfcb4('0x80')+_0x33fe76['uniqueid']+_0xfcb4('0x82')+md5(_0x33fe76[_0xfcb4('0x81')]);}var _0x6d031c=_0x3efc76[_0xfcb4('0x7b')]===_0xfcb4('0x84')?'eu':'com';return getAccessToken(_0x3efc76)[_0xfcb4('0x27')](function(_0x9d7731){_0x11e03e=_0x9d7731;return getUser(_0x11e03e,_0x6d031c,_0x3efc76,_0x31a77a[_0xfcb4('0x35')]);})['then'](function(_0x445fe9){_0x4a573b=_0x445fe9;logger['info'](_0xfcb4('0x86'),_0x4a573b['id']);return getEndUser(_0x11e03e,_0x6d031c,_0x3efc76,_0x33fe76[_0xfcb4('0x93')],_0x33fe76[_0xfcb4('0x94')],_0x4a573b,_0x1cc896);})[_0xfcb4('0x27')](function(_0x564a20){_0x8282c9=_0x564a20;return getCall(_0x11e03e,_0x6d031c,_0x3efc76,_0x4a573b,_0x8282c9,_0x1cc896,_0x33fe76,_0xfcb4('0x95'));})[_0xfcb4('0x27')](function(_0x3ae89b){if(_0x3ae89b){logger[_0xfcb4('0x2f')](_0xfcb4('0x8a'),_0x3ae89b['id']);logger['info'](_0xfcb4('0x92'),_0xfcb4('0x8b'));emit(util[_0xfcb4('0x73')](_0xfcb4('0x8c'),_0x31a77a[_0xfcb4('0x17')]),_0xfcb4('0x8d'),{'uri':_0xfcb4('0x96')+_0x3efc76[_0xfcb4('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3ae89b['id']});}})[_0xfcb4('0x2b')](function(_0x2fb576){logger[_0xfcb4('0x2c')](_0xfcb4('0x92'),JSON[_0xfcb4('0xb')](_0x2fb576));});};exports[_0xfcb4('0x97')]=function(_0x980ccf,_0x401950,_0x5266b9,_0x634784,_0xae865d,_0xad37){var _0xce01b8,_0x1bf82d,_0x59095d;_0xad37['host']=intUtil[_0xfcb4('0x7a')](_0xad37[_0xfcb4('0x7b')]);_0xad37[_0xfcb4('0x7c')]=intUtil[_0xfcb4('0x7a')](_0xad37['serverUrl']);if(_0xae865d&&_0xae865d[_0xfcb4('0x7d')]){logger[_0xfcb4('0x2f')]('['+_0x401950[_0xfcb4('0x68')][_0xfcb4('0x98')]()+']',_0xfcb4('0x7f'));_0x401950['recordingURL']=_0xad37['serverUrl']+_0xfcb4('0x80')+_0x401950[_0xfcb4('0x81')]+_0xfcb4('0x82')+md5(_0x401950[_0xfcb4('0x81')]);}else{_0x401950['recordingURL']='';}var _0x5ee5d8=_0xad37[_0xfcb4('0x7b')]===_0xfcb4('0x84')?'eu':_0xfcb4('0x85');return getAccessToken(_0xad37)[_0xfcb4('0x27')](function(_0x54bd0e){_0x59095d=_0x54bd0e;return getUser(_0x59095d,_0x5ee5d8,_0xad37);})[_0xfcb4('0x27')](function(_0x2cb813){_0xce01b8=_0x2cb813;logger[_0xfcb4('0x2f')](_0xfcb4('0x86'),_0xce01b8['id']);return getEndUser(_0x59095d,_0x5ee5d8,_0xad37,_0x401950[_0xfcb4('0x87')],_0x401950[_0xfcb4('0x88')],_0xce01b8,_0x5266b9);})[_0xfcb4('0x27')](function(_0xf97078){_0x1bf82d=_0xf97078;return getCall(_0x59095d,_0x5ee5d8,_0xad37,_0xce01b8,_0x1bf82d,_0x5266b9,_0x401950,'Inbound');})[_0xfcb4('0x27')](function(_0x19731a){if(_0x19731a){logger[_0xfcb4('0x2f')]('The\x20Call\x20ID\x20is:',_0x19731a['id']);}})['catch'](function(_0xe3d092){logger[_0xfcb4('0x2c')]('['+_0x401950[_0xfcb4('0x68')][_0xfcb4('0x98')]()+']',JSON[_0xfcb4('0xb')](_0xe3d092));});}; \ 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 e9d8430..f7b404c 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 _0x46eb=['info','util','shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3','render','exec','error','format'];(function(_0x5c3347,_0x1a7bbf){var _0x4dc774=function(_0x3cd66d){while(--_0x3cd66d){_0x5c3347['push'](_0x5c3347['shift']());}};_0x4dc774(++_0x1a7bbf);}(_0x46eb,0x83));var _0xb46e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x46eb[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require(_0xb46e('0x0'));var sh=require(_0xb46e('0x1'));var Mustache=require(_0xb46e('0x2'));var logger=require(_0xb46e('0x3'))(_0xb46e('0x4'));exports['exec']=function(_0x383c96,_0x457b7a){var _0x2f472c=_0x383c96[_0xb46e('0x5')]?_0x383c96[_0xb46e('0x5')]:_0xb46e('0x6');var _0x1029e1=_0x383c96[_0xb46e('0x7')]?Mustache[_0xb46e('0x8')](_0x383c96[_0xb46e('0x7')],_0x457b7a):_0x457b7a;sh[_0xb46e('0x9')](_0x1029e1,function(_0x3c4ad5,_0x26a48e,_0x4c03ee){if(_0x3c4ad5!==0x0){logger[_0xb46e('0xa')](util[_0xb46e('0xb')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x2f472c,_0x1029e1,_0x3c4ad5,_0x4c03ee));}else{logger[_0xb46e('0xc')](util[_0xb46e('0xb')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x2f472c,_0x1029e1,_0x26a48e));}});}; \ No newline at end of file +var _0x2286=['trigger','exec','data2','Script','data3','render','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','../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2286,0x99));var _0x6228=function(_0x2b9618,_0x4b37b1){_0x2b9618=_0x2b9618-0x0;var _0x1e7ab4=_0x2286[_0x2b9618];return _0x1e7ab4;};'use strict';var util=require(_0x6228('0x0'));var sh=require(_0x6228('0x1'));var Mustache=require('mustache');var logger=require(_0x6228('0x2'))(_0x6228('0x3'));exports[_0x6228('0x4')]=function(_0x427554,_0xe08833){var _0xe3b81e=_0x427554['data2']?_0x427554[_0x6228('0x5')]:_0x6228('0x6');var _0x4051a0=_0x427554[_0x6228('0x7')]?Mustache[_0x6228('0x8')](_0x427554['data3'],_0xe08833):_0xe08833;sh[_0x6228('0x4')](_0x4051a0,function(_0x6623f,_0x5a0b2a,_0x16790e){if(_0x6623f!==0x0){logger[_0x6228('0x9')](util[_0x6228('0xa')](_0x6228('0xb'),_0xe3b81e,_0x4051a0,_0x6623f,_0x16790e));}else{logger['info'](util[_0x6228('0xa')](_0x6228('0xc'),_0xe3b81e,_0x4051a0,_0x5a0b2a));}});}; \ 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 e0ab40b..29d451a 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 _0xb1b7=['parse','data6','error','GET','POST','data7','body','stack','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','util','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5','headers'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb1b7,0x135));var _0x7b1b=function(_0x11c820,_0x4f36bf){_0x11c820=_0x11c820-0x0;var _0xd21f79=_0xb1b7[_0x11c820];return _0xd21f79;};'use strict';var rp=require(_0x7b1b('0x0'));var util=require(_0x7b1b('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x7b1b('0x2'))('trigger');exports[_0x7b1b('0x3')]=function(_0x347535,_0x5f3ba4){var _0x2cfdf1,_0x37a1b5;var _0x332913={'method':_0x347535[_0x7b1b('0x4')][_0x7b1b('0x5')](),'uri':Mustache[_0x7b1b('0x6')](_0x347535[_0x7b1b('0x7')],_0x5f3ba4),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x347535[_0x7b1b('0x8')])==='number'&&parseInt(_0x347535[_0x7b1b('0x8')])>=0x1&&parseInt(_0x347535[_0x7b1b('0x8')])<=0xa?parseInt(_0x347535[_0x7b1b('0x8')])*0x3e8:0x5*0x3e8};try{_0x332913[_0x7b1b('0x9')]=_0x347535['data6']?JSON[_0x7b1b('0xa')](Mustache['render'](_0x347535[_0x7b1b('0xb')],_0x5f3ba4)):{};}catch(_0x4b9d4e){logger[_0x7b1b('0xc')](_0x4b9d4e['stack']);}switch(_0x347535['data1'][_0x7b1b('0x5')]()){case _0x7b1b('0xd'):case'DELETE':_0x2cfdf1=null;_0x332913['qs']=_0x5f3ba4;break;case _0x7b1b('0xe'):case'PUT':if(_0x347535[_0x7b1b('0xf')]){try{_0x2cfdf1=JSON['parse'](Mustache[_0x7b1b('0x6')](_0x347535['data7'],_0x5f3ba4));_0x332913[_0x7b1b('0x10')]=_0x2cfdf1;}catch(_0x41c505){logger['error'](_0x41c505[_0x7b1b('0x11')]);logger[_0x7b1b('0xc')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2cfdf1=_0x5f3ba4;_0x332913[_0x7b1b('0x10')]=_0x2cfdf1;}break;}logger[_0x7b1b('0x12')](util[_0x7b1b('0x13')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x347535[_0x7b1b('0x4')],_0x347535[_0x7b1b('0x7')],JSON[_0x7b1b('0x14')](_0x332913)));rp(_0x332913)[_0x7b1b('0x15')](function(_0x1d8e75){_0x2cfdf1=!_[_0x7b1b('0x16')](_0x2cfdf1)?_0x7b1b('0x17')+_0x2cfdf1:'';_0x37a1b5=typeof _0x1d8e75[_0x7b1b('0x10')]===_0x7b1b('0x18')?JSON[_0x7b1b('0x14')](_0x1d8e75[_0x7b1b('0x10')]):_0x1d8e75[_0x7b1b('0x10')];logger['info'](util['format'](_0x7b1b('0x19'),_0x347535[_0x7b1b('0x4')],_0x347535[_0x7b1b('0x7')],_0x1d8e75[_0x7b1b('0x1a')],_0x37a1b5));})[_0x7b1b('0x1b')](function(_0x1aece1){logger[_0x7b1b('0xc')](util[_0x7b1b('0x13')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x347535[_0x7b1b('0x4')],_0x347535[_0x7b1b('0x7')],_0x1aece1[_0x7b1b('0x1a')],_0x1aece1[_0x7b1b('0x1c')],_0x1aece1['message']));});}; \ No newline at end of file +var _0x51ae=['PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','format','%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','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','headers','data6','parse','error','stack','GET','POST'];(function(_0x14bd60,_0x73b2f9){var _0x4b0a31=function(_0xa3044d){while(--_0xa3044d){_0x14bd60['push'](_0x14bd60['shift']());}};_0x4b0a31(++_0x73b2f9);}(_0x51ae,0x7d));var _0xe51a=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x51ae[_0x2a6809];return _0x11c371;};'use strict';var rp=require(_0xe51a('0x0'));var util=require(_0xe51a('0x1'));var _=require(_0xe51a('0x2'));var Mustache=require(_0xe51a('0x3'));var logger=require(_0xe51a('0x4'))(_0xe51a('0x5'));exports[_0xe51a('0x6')]=function(_0x33abcc,_0x5c1230){var _0x521691,_0x974dc1;var _0x550bbb={'method':_0x33abcc[_0xe51a('0x7')][_0xe51a('0x8')](),'uri':Mustache[_0xe51a('0x9')](_0x33abcc[_0xe51a('0xa')],_0x5c1230),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x33abcc[_0xe51a('0xb')])==='number'&&parseInt(_0x33abcc[_0xe51a('0xb')])>=0x1&&parseInt(_0x33abcc[_0xe51a('0xb')])<=0xa?parseInt(_0x33abcc[_0xe51a('0xb')])*0x3e8:0x5*0x3e8};try{_0x550bbb[_0xe51a('0xc')]=_0x33abcc[_0xe51a('0xd')]?JSON[_0xe51a('0xe')](Mustache[_0xe51a('0x9')](_0x33abcc[_0xe51a('0xd')],_0x5c1230)):{};}catch(_0x33b038){logger[_0xe51a('0xf')](_0x33b038[_0xe51a('0x10')]);}switch(_0x33abcc['data1'][_0xe51a('0x8')]()){case _0xe51a('0x11'):case'DELETE':_0x521691=null;_0x550bbb['qs']=_0x5c1230;break;case _0xe51a('0x12'):case _0xe51a('0x13'):if(_0x33abcc[_0xe51a('0x14')]){try{_0x521691=JSON[_0xe51a('0xe')](Mustache[_0xe51a('0x9')](_0x33abcc['data7'],_0x5c1230));_0x550bbb[_0xe51a('0x15')]=_0x521691;}catch(_0x239383){logger['error'](_0x239383['stack']);logger[_0xe51a('0xf')](_0xe51a('0x16'));}}else{_0x521691=_0x5c1230;_0x550bbb[_0xe51a('0x15')]=_0x521691;}break;}logger[_0xe51a('0x17')](util['format'](_0xe51a('0x18'),_0x33abcc['data1'],_0x33abcc[_0xe51a('0xa')],JSON[_0xe51a('0x19')](_0x550bbb)));rp(_0x550bbb)['then'](function(_0x4e5715){_0x521691=!_[_0xe51a('0x1a')](_0x521691)?_0xe51a('0x1b')+_0x521691:'';_0x974dc1=typeof _0x4e5715[_0xe51a('0x15')]===_0xe51a('0x1c')?JSON['stringify'](_0x4e5715[_0xe51a('0x15')]):_0x4e5715[_0xe51a('0x15')];logger['info'](util[_0xe51a('0x1d')](_0xe51a('0x1e'),_0x33abcc[_0xe51a('0x7')],_0x33abcc[_0xe51a('0xa')],_0x4e5715[_0xe51a('0x1f')],_0x974dc1));})[_0xe51a('0x20')](function(_0x4d4962){logger['error'](util[_0xe51a('0x1d')](_0xe51a('0x21'),_0x33abcc[_0xe51a('0x7')],_0x33abcc[_0xe51a('0xa')],_0x4d4962['statusCode'],_0x4d4962[_0xe51a('0x22')],_0x4d4962[_0xe51a('0x23')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b10c70c..76798a4 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 _0xf48e=['message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error'];(function(_0xd203bf,_0x52e6d4){var _0x420ffc=function(_0x2c6d9c){while(--_0x2c6d9c){_0xd203bf['push'](_0xd203bf['shift']());}};_0x420ffc(++_0x52e6d4);}(_0xf48e,0x1b4));var _0xef48=function(_0x3994eb,_0x17c5d1){_0x3994eb=_0x3994eb-0x0;var _0x4effec=_0xf48e[_0x3994eb];return _0x4effec;};'use strict';var jayson=require(_0xef48('0x0'));var BPromise=require(_0xef48('0x1'));var logger=require(_0xef48('0x2'))(_0xef48('0x3'));var client=jayson[_0xef48('0x4')][_0xef48('0x5')]({'port':0x2329});client[_0xef48('0x6')]=function(_0x47e1fc,_0x1231c6){return new BPromise(function(_0x9d3cb3,_0x32857a){return client[_0xef48('0x7')](_0x47e1fc,_0x1231c6)[_0xef48('0x8')](function(_0x41c638){logger[_0xef48('0x9')](_0xef48('0xa'),_0xef48('0x3'),_0x47e1fc,_0x1231c6,_0x41c638);if(_0x41c638['error']){logger[_0xef48('0xb')](_0xef48('0xa'),_0xef48('0x3'),_0x47e1fc,_0x41c638[_0xef48('0xb')][_0xef48('0xc')],_0x1231c6);return _0x32857a(_0x41c638[_0xef48('0xb')][_0xef48('0xc')]);}else{return _0x9d3cb3(_0x41c638[_0xef48('0xd')]);}})[_0xef48('0xe')](function(_0xfdb4e3){logger[_0xef48('0xb')](_0xef48('0xa'),_0xef48('0x3'),_0x47e1fc,_0xfdb4e3,_0x1231c6);return _0x32857a(_0xfdb4e3);});});};module[_0xef48('0xf')]=client; \ No newline at end of file +var _0xb844=['http','Request','request','then','rpc','error','message','result','catch','exports','bluebird','routing','client'];(function(_0x539e88,_0x2492b9){var _0x781603=function(_0x4488de){while(--_0x4488de){_0x539e88['push'](_0x539e88['shift']());}};_0x781603(++_0x2492b9);}(_0xb844,0x1c4));var _0x4b84=function(_0x5280b5,_0x3fef4d){_0x5280b5=_0x5280b5-0x0;var _0x16ebd1=_0xb844[_0x5280b5];return _0x16ebd1;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x4b84('0x0'));var logger=require('../../config/logger')(_0x4b84('0x1'));var client=jayson[_0x4b84('0x2')][_0x4b84('0x3')]({'port':0x2329});client[_0x4b84('0x4')]=function(_0xe5b323,_0x304c49){return new BPromise(function(_0xb58b13,_0x339a3a){return client[_0x4b84('0x5')](_0xe5b323,_0x304c49)[_0x4b84('0x6')](function(_0x6338a0){logger['debug'](_0x4b84('0x7'),_0x4b84('0x1'),_0xe5b323,_0x304c49,_0x6338a0);if(_0x6338a0[_0x4b84('0x8')]){logger['error'](_0x4b84('0x7'),_0x4b84('0x1'),_0xe5b323,_0x6338a0[_0x4b84('0x8')]['message'],_0x304c49);return _0x339a3a(_0x6338a0[_0x4b84('0x8')][_0x4b84('0x9')]);}else{return _0xb58b13(_0x6338a0[_0x4b84('0xa')]);}})[_0x4b84('0xb')](function(_0xc59988){logger[_0x4b84('0x8')](_0x4b84('0x7'),_0x4b84('0x1'),_0xe5b323,_0xc59988,_0x304c49);return _0x339a3a(_0xc59988);});});};module[_0x4b84('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8603c21..2dafa15 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 _0x1a78=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./rpc/mailAccount','./rpc/setting','resolve'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x1a78,0x1be));var _0x81a7=function(_0x1b57cf,_0x171d33){_0x1b57cf=_0x1b57cf-0x0;var _0x3ec15a=_0x1a78[_0x1b57cf];return _0x3ec15a;};'use strict';var server=require('./server');var Realtime=require(_0x81a7('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x81a7('0x1'));var setting=require(_0x81a7('0x2'));var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x81a7('0x3')]()[_0x81a7('0x4')](mailAccount[_0x81a7('0x5')]())['then'](realtime[_0x81a7('0x6')]())[_0x81a7('0x4')](function(){email[_0x81a7('0x7')](realtime[_0x81a7('0x8')]);return realtime;});}function main(){return server[_0x81a7('0x9')](realtime,email)[_0x81a7('0x4')](function(){return initRealtime();})[_0x81a7('0x4')](function(){return setting[_0x81a7('0xa')]();})['then'](function(_0x2f811f){return setInterval(initRealtime,_0x2f811f[_0x81a7('0xb')]*0x3e8);})[_0x81a7('0xc')](function(_0x17ac87){logger[_0x81a7('0xd')](_0x81a7('0xe'),_0x17ac87);});}main(); \ No newline at end of file +var _0x8b2a=['mailAccounts','listen','loginMailFrequency','catch','error','./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','refresh'];(function(_0x3b24a0,_0x2cd391){var _0x2b311d=function(_0x2206ad){while(--_0x2206ad){_0x3b24a0['push'](_0x3b24a0['shift']());}};_0x2b311d(++_0x2cd391);}(_0x8b2a,0x198));var _0xa8b2=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0x8b2a[_0x10c51f];return _0x56a0cd;};'use strict';var server=require(_0xa8b2('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xa8b2('0x1'));var mailAccount=require(_0xa8b2('0x2'));var setting=require(_0xa8b2('0x3'));var logger=require(_0xa8b2('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa8b2('0x5')]()[_0xa8b2('0x6')](mailAccount['getMailAccounts']())[_0xa8b2('0x6')](realtime['initMailAccounts']())[_0xa8b2('0x6')](function(){email[_0xa8b2('0x7')](realtime[_0xa8b2('0x8')]);return realtime;});}function main(){return server[_0xa8b2('0x9')](realtime,email)['then'](function(){return initRealtime();})[_0xa8b2('0x6')](function(){return setting['getSettings']();})[_0xa8b2('0x6')](function(_0x2aa6e6){return setInterval(initRealtime,_0x2aa6e6[_0xa8b2('0xa')]*0x3e8);})[_0xa8b2('0xb')](function(_0x40b5d1){logger[_0xa8b2('0xc')]('Email\x20service\x20initialization',_0x40b5d1);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e47a5e9..beababe 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 _0xf6e3=['./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','service','provider','custom','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','connected','messages','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','smtp','Smtp','verify','verified','catch','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xf6e3,0x10c));var _0x3f6e=function(_0x19d003,_0x20cfe6){_0x19d003=_0x19d003-0x0;var _0xcba0bd=_0xf6e3[_0x19d003];return _0xcba0bd;};'use strict';var _=require(_0x3f6e('0x0'));var moment=require(_0x3f6e('0x1'));var BPromise=require('bluebird');var md5=require(_0x3f6e('0x2'));var Redis=require(_0x3f6e('0x3'));var config=require(_0x3f6e('0x4'));var logger=require(_0x3f6e('0x5'))(_0x3f6e('0x6'));config[_0x3f6e('0x7')]=_[_0x3f6e('0x8')](config[_0x3f6e('0x7')],{'host':_0x3f6e('0x9'),'port':0x18eb});var io=require(_0x3f6e('0xa'))(new Redis(config[_0x3f6e('0x7')]));var EmailImap=require(_0x3f6e('0xb'));var EmailSmtp=require(_0x3f6e('0xc'));var mailAccount=require(_0x3f6e('0xd'));var md5Accounts={};function EmailChannel(_0x3c407a){logger[_0x3f6e('0xe')](_0x3f6e('0xf'));this[_0x3f6e('0x10')]=_0x3c407a['mailAccounts'];this[_0x3f6e('0x11')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x3f6e('0x12')]=function(_0x5120c7){var _0x1d6448=this[_0x3f6e('0x10')][_0x5120c7];var _0x52d3ab={'id':_0x1d6448['id'],'name':_0x1d6448[_0x3f6e('0x13')],'key':_0x1d6448['key'],'active':_0x1d6448[_0x3f6e('0x14')],'Imap':{'status':_0x1d6448[_0x3f6e('0x15')][_0x3f6e('0x16')],'messageStatus':_0x1d6448['Imap'][_0x3f6e('0x17')],'total':_0x1d6448[_0x3f6e('0x15')][_0x3f6e('0x18')]}};if(_[_0x3f6e('0x19')](md5Accounts[_0x5120c7])){md5Accounts[_0x5120c7]={};}var _0x54949e=md5(JSON[_0x3f6e('0x1a')](_0x52d3ab));if(md5Accounts[_0x5120c7]['md5']!==_0x54949e){md5Accounts[_0x5120c7][_0x3f6e('0x2')]=_0x54949e;io['emit'](_0x3f6e('0x1b'),_0x52d3ab);}};EmailChannel[_0x3f6e('0x1c')][_0x3f6e('0x1d')]=function(_0x3e1590){for(var _0x3aa643 in _0x3e1590){if(_0x3e1590[_0x3f6e('0x1e')](_0x3aa643)){if(_0x3e1590[_0x3aa643][_0x3f6e('0x15')]&&_0x3e1590[_0x3aa643]['active']){var _0x4cb2a4=_0x3e1590[_0x3aa643][_0x3f6e('0x15')];if(!_0x4cb2a4[_0x3f6e('0x1f')]&&_0x3e1590[_0x3aa643][_0x3f6e('0x20')]!==_0x3f6e('0x21'))_0x4cb2a4[_0x3f6e('0x1f')]=_0x3e1590[_0x3aa643][_0x3f6e('0x20')];if(!this[_0x3f6e('0x11')][_0x3f6e('0x1e')](_0x4cb2a4['id'])){this[_0x3f6e('0x11')][_0x4cb2a4['id']]=new EmailImap(_0x4cb2a4,_0x3e1590[_0x3aa643][_0x3f6e('0x6')]);this[_0x3f6e('0x11')][_0x4cb2a4['id']]['on']('box',this[_0x3f6e('0x22')]['bind'](this,_0x3aa643));this[_0x3f6e('0x11')][_0x4cb2a4['id']]['on'](_0x3f6e('0x6'),this[_0x3f6e('0x23')][_0x3f6e('0x24')](this,_0x3aa643));this[_0x3f6e('0x11')][_0x4cb2a4['id']]['on'](_0x3f6e('0x25'),this[_0x3f6e('0x26')]['bind'](this,_0x3aa643));this[_0x3f6e('0x11')][_0x4cb2a4['id']]['on'](_0x3f6e('0x27'),this[_0x3f6e('0x28')][_0x3f6e('0x24')](this,_0x3aa643));}}else{if(_[_0x3f6e('0x19')](this[_0x3f6e('0x10')][_0x3aa643][_0x3f6e('0x15')])){this[_0x3f6e('0x10')][_0x3aa643]['Imap']={};}this[_0x3f6e('0x10')][_0x3aa643][_0x3f6e('0x15')][_0x3f6e('0x16')]=_0x3f6e('0x29');this[_0x3f6e('0x10')][_0x3aa643][_0x3f6e('0x15')][_0x3f6e('0x17')]='';this['emit'](_0x3aa643);}}}};EmailChannel[_0x3f6e('0x1c')][_0x3f6e('0x22')]=function(_0x4d82a9,_0x1f2edc){if(this['mailAccounts'][_0x4d82a9]){this[_0x3f6e('0x10')][_0x4d82a9][_0x3f6e('0x15')][_0x3f6e('0x16')]=_0x3f6e('0x2a');this[_0x3f6e('0x10')][_0x4d82a9][_0x3f6e('0x15')][_0x3f6e('0x17')]=_0x1f2edc['name'];if(_0x1f2edc[_0x3f6e('0x2b')]){this[_0x3f6e('0x10')][_0x4d82a9][_0x3f6e('0x15')][_0x3f6e('0x18')]=_0x1f2edc[_0x3f6e('0x2b')][_0x3f6e('0x18')];}return this[_0x3f6e('0x12')](_0x4d82a9);}};EmailChannel['prototype'][_0x3f6e('0x23')]=function(_0x3259f7,_0x29e9f7){logger[_0x3f6e('0xe')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x29e9f7['firstName'],_0x29e9f7[_0x3f6e('0x2c')],_0x29e9f7[_0x3f6e('0x2d')],_0x3259f7);if(this[_0x3f6e('0x10')][_0x3259f7]){return mailAccount[_0x3f6e('0x2e')](_0x3259f7,_0x29e9f7)[_0x3f6e('0x2f')](function(_0x2734e9){if(_0x2734e9){logger[_0x3f6e('0xe')](_0x3f6e('0x30'));}})['catch'](function(_0x2f3912){logger['error'](_0x3f6e('0x31'),JSON[_0x3f6e('0x1a')](_0x2f3912));});}};EmailChannel['prototype'][_0x3f6e('0x26')]=function(_0x43ab2d){if(this[_0x3f6e('0x10')][_0x43ab2d]&&this[_0x3f6e('0x10')][_0x43ab2d]['Imap']){if(this[_0x3f6e('0x11')][this[_0x3f6e('0x10')][_0x43ab2d]['Imap']['id']]){delete this[_0x3f6e('0x11')][this[_0x3f6e('0x10')][_0x43ab2d][_0x3f6e('0x15')]['id']];}this['mailAccounts'][_0x43ab2d][_0x3f6e('0x15')][_0x3f6e('0x32')]=moment();this[_0x3f6e('0x12')](_0x43ab2d);}};EmailChannel[_0x3f6e('0x1c')][_0x3f6e('0x28')]=function(_0x7ea829,_0x1d612d){if(this[_0x3f6e('0x10')][_0x7ea829]){this[_0x3f6e('0x10')][_0x7ea829][_0x3f6e('0x15')]['status']='error';this[_0x3f6e('0x10')][_0x7ea829][_0x3f6e('0x15')][_0x3f6e('0x17')]=_0x1d612d;return this[_0x3f6e('0x12')](_0x7ea829);}};EmailChannel[_0x3f6e('0x1c')]['sendMail']=function(_0x84a95a,_0x2ed4a6){return this[_0x3f6e('0x33')]['send'](_0x84a95a,_0x2ed4a6);};EmailChannel['prototype']['verifySmtp']=function(_0x3f9cca){var _0x541891=this;if(this['mailAccounts'][_0x3f9cca['id']]){if(_[_0x3f6e('0x19')](this[_0x3f6e('0x10')][_0x3f9cca['id']][_0x3f6e('0x34')])){this[_0x3f6e('0x10')][_0x3f9cca['id']]['Smtp']={};}this['mailAccounts'][_0x3f9cca['id']][_0x3f6e('0x34')][_0x3f6e('0x32')]=moment();return new BPromise(function(_0x50d384,_0x6474e5){return _0x541891['smtp'][_0x3f6e('0x35')](_0x3f9cca)['then'](function(_0x56280c){_0x541891['mailAccounts'][_0x3f9cca['id']][_0x3f6e('0x34')][_0x3f6e('0x16')]=_0x3f6e('0x36');_0x541891['mailAccounts'][_0x3f9cca['id']]['Smtp']['messageStatus']='';_0x541891[_0x3f6e('0x12')](_0x3f9cca['id']);_0x50d384(_0x56280c);})[_0x3f6e('0x37')](function(_0x453da9){_0x541891[_0x3f6e('0x10')][_0x3f9cca['id']][_0x3f6e('0x34')][_0x3f6e('0x16')]='error';_0x541891[_0x3f6e('0x10')][_0x3f9cca['id']]['Smtp'][_0x3f6e('0x17')]=_0x453da9;_0x541891[_0x3f6e('0x12')](_0x3f9cca['id']);_0x6474e5(_0x453da9);});});}return this[_0x3f6e('0x33')][_0x3f6e('0x35')](_0x3f9cca);};module['exports']=EmailChannel; \ No newline at end of file +var _0x1333=['defaults','redis','socket.io-emitter','./imap','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','name','key','active','Imap','status','messageStatus','stringify','emit','mailAccount:update','refresh','hasOwnProperty','service','provider','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','isNil','disabled','connected','messages','total','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','prototype','sendMail','smtp','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email'];(function(_0xa65aed,_0x923c61){var _0x19044f=function(_0x384b4b){while(--_0x384b4b){_0xa65aed['push'](_0xa65aed['shift']());}};_0x19044f(++_0x923c61);}(_0x1333,0x6b));var _0x3133=function(_0x16ef89,_0x24662c){_0x16ef89=_0x16ef89-0x0;var _0x15a0c2=_0x1333[_0x16ef89];return _0x15a0c2;};'use strict';var _=require(_0x3133('0x0'));var moment=require('moment');var BPromise=require(_0x3133('0x1'));var md5=require(_0x3133('0x2'));var Redis=require(_0x3133('0x3'));var config=require(_0x3133('0x4'));var logger=require(_0x3133('0x5'))(_0x3133('0x6'));config['redis']=_[_0x3133('0x7')](config[_0x3133('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x3133('0x9'))(new Redis(config[_0x3133('0x8')]));var EmailImap=require(_0x3133('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x3133('0xb'));var md5Accounts={};function EmailChannel(_0x13274d){logger['info'](_0x3133('0xc'));this['mailAccounts']=_0x13274d[_0x3133('0xd')];this[_0x3133('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x1bd183){var _0x482923=this[_0x3133('0xd')][_0x1bd183];var _0xb5b732={'id':_0x482923['id'],'name':_0x482923[_0x3133('0xf')],'key':_0x482923[_0x3133('0x10')],'active':_0x482923[_0x3133('0x11')],'Imap':{'status':_0x482923[_0x3133('0x12')][_0x3133('0x13')],'messageStatus':_0x482923['Imap'][_0x3133('0x14')],'total':_0x482923[_0x3133('0x12')]['total']}};if(_['isNil'](md5Accounts[_0x1bd183])){md5Accounts[_0x1bd183]={};}var _0xf3dd63=md5(JSON[_0x3133('0x15')](_0xb5b732));if(md5Accounts[_0x1bd183][_0x3133('0x2')]!==_0xf3dd63){md5Accounts[_0x1bd183][_0x3133('0x2')]=_0xf3dd63;io[_0x3133('0x16')](_0x3133('0x17'),_0xb5b732);}};EmailChannel['prototype'][_0x3133('0x18')]=function(_0x406632){for(var _0x3175cc in _0x406632){if(_0x406632[_0x3133('0x19')](_0x3175cc)){if(_0x406632[_0x3175cc][_0x3133('0x12')]&&_0x406632[_0x3175cc][_0x3133('0x11')]){var _0x5ef179=_0x406632[_0x3175cc][_0x3133('0x12')];if(!_0x5ef179[_0x3133('0x1a')]&&_0x406632[_0x3175cc][_0x3133('0x1b')]!=='custom')_0x5ef179[_0x3133('0x1a')]=_0x406632[_0x3175cc]['provider'];if(!this['imapAccounts'][_0x3133('0x19')](_0x5ef179['id'])){this[_0x3133('0xe')][_0x5ef179['id']]=new EmailImap(_0x5ef179,_0x406632[_0x3175cc][_0x3133('0x6')]);this[_0x3133('0xe')][_0x5ef179['id']]['on']('box',this[_0x3133('0x1c')][_0x3133('0x1d')](this,_0x3175cc));this[_0x3133('0xe')][_0x5ef179['id']]['on'](_0x3133('0x6'),this[_0x3133('0x1e')][_0x3133('0x1d')](this,_0x3175cc));this[_0x3133('0xe')][_0x5ef179['id']]['on']('end',this[_0x3133('0x1f')][_0x3133('0x1d')](this,_0x3175cc));this[_0x3133('0xe')][_0x5ef179['id']]['on'](_0x3133('0x20'),this[_0x3133('0x21')]['bind'](this,_0x3175cc));}}else{if(_[_0x3133('0x22')](this[_0x3133('0xd')][_0x3175cc]['Imap'])){this['mailAccounts'][_0x3175cc]['Imap']={};}this[_0x3133('0xd')][_0x3175cc][_0x3133('0x12')][_0x3133('0x13')]=_0x3133('0x23');this[_0x3133('0xd')][_0x3175cc]['Imap']['messageStatus']='';this['emit'](_0x3175cc);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x34bf08,_0x1be2fa){if(this[_0x3133('0xd')][_0x34bf08]){this['mailAccounts'][_0x34bf08][_0x3133('0x12')]['status']=_0x3133('0x24');this[_0x3133('0xd')][_0x34bf08][_0x3133('0x12')]['messageStatus']=_0x1be2fa[_0x3133('0xf')];if(_0x1be2fa[_0x3133('0x25')]){this['mailAccounts'][_0x34bf08][_0x3133('0x12')][_0x3133('0x26')]=_0x1be2fa[_0x3133('0x25')][_0x3133('0x26')];}return this[_0x3133('0x16')](_0x34bf08);}};EmailChannel['prototype'][_0x3133('0x1e')]=function(_0x23fcf3,_0xfa9052){logger[_0x3133('0x27')](_0x3133('0x28'),_0xfa9052[_0x3133('0x29')],_0xfa9052[_0x3133('0x2a')],_0xfa9052['from'],_0x23fcf3);if(this['mailAccounts'][_0x23fcf3]){return mailAccount[_0x3133('0x2b')](_0x23fcf3,_0xfa9052)[_0x3133('0x2c')](function(_0x2cb083){if(_0x2cb083){logger['info'](_0x3133('0x2d'));}})[_0x3133('0x2e')](function(_0x4d04ab){logger[_0x3133('0x20')](_0x3133('0x2f'),JSON[_0x3133('0x15')](_0x4d04ab));});}};EmailChannel[_0x3133('0x30')][_0x3133('0x1f')]=function(_0x8ebef9){if(this[_0x3133('0xd')][_0x8ebef9]&&this[_0x3133('0xd')][_0x8ebef9][_0x3133('0x12')]){if(this['imapAccounts'][this['mailAccounts'][_0x8ebef9]['Imap']['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x8ebef9][_0x3133('0x12')]['id']];}this[_0x3133('0xd')][_0x8ebef9][_0x3133('0x12')]['lastSync']=moment();this[_0x3133('0x16')](_0x8ebef9);}};EmailChannel[_0x3133('0x30')]['handleImapError']=function(_0x209a84,_0x5f21a5){if(this[_0x3133('0xd')][_0x209a84]){this[_0x3133('0xd')][_0x209a84][_0x3133('0x12')][_0x3133('0x13')]=_0x3133('0x20');this[_0x3133('0xd')][_0x209a84][_0x3133('0x12')][_0x3133('0x14')]=_0x5f21a5;return this['emit'](_0x209a84);}};EmailChannel['prototype'][_0x3133('0x31')]=function(_0x4b0ecf,_0x547b32){return this[_0x3133('0x32')]['send'](_0x4b0ecf,_0x547b32);};EmailChannel['prototype'][_0x3133('0x33')]=function(_0xf9c886){var _0x144685=this;if(this[_0x3133('0xd')][_0xf9c886['id']]){if(_[_0x3133('0x22')](this[_0x3133('0xd')][_0xf9c886['id']][_0x3133('0x34')])){this['mailAccounts'][_0xf9c886['id']][_0x3133('0x34')]={};}this['mailAccounts'][_0xf9c886['id']][_0x3133('0x34')][_0x3133('0x35')]=moment();return new BPromise(function(_0x31d96d,_0x5f4800){return _0x144685['smtp'][_0x3133('0x36')](_0xf9c886)[_0x3133('0x2c')](function(_0x41051c){_0x144685[_0x3133('0xd')][_0xf9c886['id']]['Smtp'][_0x3133('0x13')]=_0x3133('0x37');_0x144685['mailAccounts'][_0xf9c886['id']][_0x3133('0x34')][_0x3133('0x14')]='';_0x144685[_0x3133('0x16')](_0xf9c886['id']);_0x31d96d(_0x41051c);})[_0x3133('0x2e')](function(_0x1254ac){_0x144685['mailAccounts'][_0xf9c886['id']][_0x3133('0x34')][_0x3133('0x13')]=_0x3133('0x20');_0x144685['mailAccounts'][_0xf9c886['id']][_0x3133('0x34')][_0x3133('0x14')]=_0x1254ac;_0x144685[_0x3133('0x16')](_0xf9c886['id']);_0x5f4800(_0x1254ac);});});}return this[_0x3133('0x32')][_0x3133('0x36')](_0xf9c886);};module[_0x3133('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 88957f4..43a8684 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 _0x1e8d=['account','getAccount','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','email','anonymous@xcally.com','host','port','tls','autotls','required','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','slice','message','handleFetchMessage','handleFetchError','closeBox','handleMessageBody','handleMessageEnd','handleSimpleParser','handleMessageAttributes','handleFetchEnd','stringify','textCode','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','mailbox'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1e8d,0x6f));var _0xd1e8=function(_0x260b23,_0x2d6117){_0x260b23=_0x260b23-0x0;var _0x9526b8=_0x1e8d[_0x260b23];return _0x9526b8;};'use strict';var _=require(_0xd1e8('0x0'));var util=require(_0xd1e8('0x1'));var Imap=require(_0xd1e8('0x2'));var simpleParser=require(_0xd1e8('0x3'))[_0xd1e8('0x4')];var Iconv=require(_0xd1e8('0x5'))[_0xd1e8('0x6')];var EventEmitter=require(_0xd1e8('0x7'))[_0xd1e8('0x8')];var utils=require(_0xd1e8('0x9'));var logger=require('../../../config/logger')('email');function EmailImap(_0x1daa61,_0x1fd059){this[_0xd1e8('0xa')]=_0x1daa61['mailbox'];this[_0xd1e8('0xb')]=this[_0xd1e8('0xc')](_0x1daa61,_0x1fd059);this['imap']=new Imap(this[_0xd1e8('0xb')]);this[_0xd1e8('0x2')][_0xd1e8('0xd')](_0xd1e8('0xe'),this[_0xd1e8('0xf')]['bind'](this));this[_0xd1e8('0x2')][_0xd1e8('0xd')](_0xd1e8('0x10'),this[_0xd1e8('0x11')][_0xd1e8('0x12')](this));this['imap']['on'](_0xd1e8('0x13'),this[_0xd1e8('0x14')][_0xd1e8('0x12')](this));this[_0xd1e8('0x2')][_0xd1e8('0x15')]();}util[_0xd1e8('0x16')](EmailImap,EventEmitter);EmailImap[_0xd1e8('0x17')]['getAccount']=function(_0x411248,_0x105ef4){var _0xd1c35c={'connTimeout':_0x411248['connTimeout']?_0x411248[_0xd1e8('0x18')]*0x3e8:0x2710,'authTimeout':_0x411248[_0xd1e8('0x19')]?_0x411248[_0xd1e8('0x19')]*0x3e8:0x1388};if(_0x411248[_0xd1e8('0x1a')]){_0xd1c35c['user']=_0x411248[_0xd1e8('0x1b')];if(_0x411248[_0xd1e8('0x1c')]){_0xd1c35c[_0xd1e8('0x1d')]=utils[_0xd1e8('0x1e')](_0x411248['CloudProvider'][_0xd1e8('0x1f')],_0x411248[_0xd1e8('0x1b')]);}else{_0xd1c35c['password']=_0x411248[_0xd1e8('0x20')];}}else{if(_0x411248['authentication']){_0xd1c35c[_0xd1e8('0x1b')]=_0x411248['user'];_0xd1c35c[_0xd1e8('0x20')]=_0x411248[_0xd1e8('0x20')];}}_0xd1c35c[_0xd1e8('0x21')]=_0x105ef4||_0x411248['user']||_0xd1e8('0x22');_0xd1c35c[_0xd1e8('0x23')]=_0x411248[_0xd1e8('0x23')];_0xd1c35c['port']=_0x411248[_0xd1e8('0x24')]||0x3e1;if(_0x411248[_0xd1e8('0x25')]){_0xd1c35c['tls']=!![];}else{_0xd1c35c[_0xd1e8('0x25')]=![];_0xd1c35c[_0xd1e8('0x26')]=_0xd1e8('0x27');}return _0xd1c35c;};EmailImap[_0xd1e8('0x17')]['handleReady']=function(){this[_0xd1e8('0x2')]['openBox'](this['mailbox'],![],this[_0xd1e8('0x28')]['bind'](this));};EmailImap[_0xd1e8('0x17')][_0xd1e8('0x28')]=function(_0x69a542,_0x28635a){if(_0x69a542){this['handleError'](_0x69a542,!![]);}else{this[_0xd1e8('0x29')](_0xd1e8('0x2a'),_0x28635a);this[_0xd1e8('0x2b')]();}};EmailImap[_0xd1e8('0x17')][_0xd1e8('0x2c')]=function(_0x4351a0){if(_0x4351a0){this['handleError'](_0x4351a0,!![]);}else{this[_0xd1e8('0x2')][_0xd1e8('0x10')]();}};EmailImap[_0xd1e8('0x17')][_0xd1e8('0x2b')]=function(){this['imap'][_0xd1e8('0x2d')]([_0xd1e8('0x2e')],this[_0xd1e8('0x2f')][_0xd1e8('0x12')](this));};EmailImap[_0xd1e8('0x17')][_0xd1e8('0x2f')]=function(_0xcd8347,_0x52f351){if(_0xcd8347){this[_0xd1e8('0x14')](_0xcd8347,!![]);}else{if(_0x52f351['length']){try{var _0x2fef33=this[_0xd1e8('0x2')]['fetch'](_0x52f351[_0xd1e8('0x30')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x2fef33['on'](_0xd1e8('0x31'),this[_0xd1e8('0x32')][_0xd1e8('0x12')](this));_0x2fef33[_0xd1e8('0xd')]('error',this[_0xd1e8('0x33')][_0xd1e8('0x12')](this));_0x2fef33[_0xd1e8('0xd')](_0xd1e8('0x10'),this['handleFetchEnd'][_0xd1e8('0x12')](this));}catch(_0x4ed319){logger[_0xd1e8('0x13')](_0x4ed319);}}else{this[_0xd1e8('0x2')][_0xd1e8('0x34')](!![],this[_0xd1e8('0x2c')]['bind'](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x4cec0e){_0x4cec0e['on']('body',this[_0xd1e8('0x35')][_0xd1e8('0x12')](this));_0x4cec0e['once']('attributes',this['handleMessageAttributes'][_0xd1e8('0x12')](this));_0x4cec0e['once'](_0xd1e8('0x10'),this[_0xd1e8('0x36')][_0xd1e8('0x12')](this));};EmailImap[_0xd1e8('0x17')][_0xd1e8('0x35')]=function(_0x38c0ba){simpleParser(_0x38c0ba,{'Iconv':Iconv},this[_0xd1e8('0x37')][_0xd1e8('0x12')](this));};EmailImap[_0xd1e8('0x17')][_0xd1e8('0x38')]=function(){};EmailImap[_0xd1e8('0x17')][_0xd1e8('0x36')]=function(){};EmailImap[_0xd1e8('0x17')][_0xd1e8('0x37')]=function(_0x13d296,_0x30f603){if(_0x13d296){logger[_0xd1e8('0x13')](_0x13d296);}else{var _0x146fec=this;utils['parser'](this[_0xd1e8('0xb')],_0x30f603,function(_0x23c05d){_0x146fec[_0xd1e8('0x29')](_0xd1e8('0x21'),_0x23c05d);});}};EmailImap['prototype'][_0xd1e8('0x39')]=function(){this[_0xd1e8('0x2')][_0xd1e8('0x34')](!![],this['handleCloseBox'][_0xd1e8('0x12')](this));};EmailImap[_0xd1e8('0x17')]['handleFetchError']=function(_0x4e385e){this[_0xd1e8('0x14')](_0x4e385e);this[_0xd1e8('0x2')][_0xd1e8('0x34')](!![],this[_0xd1e8('0x2c')][_0xd1e8('0x12')](this));};EmailImap['prototype'][_0xd1e8('0x11')]=function(){this[_0xd1e8('0x29')]('end');};EmailImap[_0xd1e8('0x17')][_0xd1e8('0x14')]=function(_0x30b06c,_0x32ec8e){logger['error'](_0xd1e8('0x14'),this['account'][_0xd1e8('0x21')],JSON[_0xd1e8('0x3a')](_0x30b06c));var _0x150221='';if(_0x30b06c){if(_0x30b06c['textCode']){_0x150221=_0x30b06c[_0xd1e8('0x3b')];}else{for(var _0x43d7ca in _0x30b06c){if(_0x30b06c['hasOwnProperty'](_0x43d7ca)){_0x150221+=_['upperFirst'](_0x43d7ca)+':\x20'+_0x30b06c[_0x43d7ca]+'\x0a';}}}}if(_0x32ec8e){this[_0xd1e8('0x2')]['end']();}else{this[_0xd1e8('0x29')](_0xd1e8('0x13'),_0x150221);this[_0xd1e8('0x29')](_0xd1e8('0x10'));}};module[_0xd1e8('0x3c')]=EmailImap; \ No newline at end of file +var _0x8195=['exports','lodash','util','imap','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','../../../config/environment','emailMaxHTMLbytesLimit','mailbox','account','getAccount','once','ready','handleReady','handleEnd','bind','error','connect','inherits','prototype','connTimeout','authTimeout','service','modernAuthentication','data5','user','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','handleError','emit','box','end','search','UNSEEN','handleReadUnseen','length','fetch','slice','message','handleFetchError','handleCloseBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','html','parser','\x20bytes,\x20email\x20size:\x20','\x20bytes','\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','\x20bytes]','text','substring','handleFetchEnd','closeBox','stringify','textCode','upperFirst'];(function(_0x5ac16f,_0x3ce9cf){var _0x1e2da5=function(_0x5e629f){while(--_0x5e629f){_0x5ac16f['push'](_0x5ac16f['shift']());}};_0x1e2da5(++_0x3ce9cf);}(_0x8195,0xdf));var _0x5819=function(_0x3e41f1,_0xa99ef1){_0x3e41f1=_0x3e41f1-0x0;var _0x41ebb0=_0x8195[_0x3e41f1];return _0x41ebb0;};'use strict';var _=require(_0x5819('0x0'));var util=require(_0x5819('0x1'));var Imap=require(_0x5819('0x2'));var simpleParser=require('mailparser')[_0x5819('0x3')];var Iconv=require('iconv')[_0x5819('0x4')];var EventEmitter=require(_0x5819('0x5'))[_0x5819('0x6')];var utils=require(_0x5819('0x7'));var logger=require(_0x5819('0x8'))(_0x5819('0x9'));var config=require(_0x5819('0xa'));const MAX_HTML_BYTES_SIZE=config[_0x5819('0xb')]||0xee6b2800;function EmailImap(_0x4c8d7b,_0x48f8d1){this[_0x5819('0xc')]=_0x4c8d7b[_0x5819('0xc')];this[_0x5819('0xd')]=this[_0x5819('0xe')](_0x4c8d7b,_0x48f8d1);this[_0x5819('0x2')]=new Imap(this[_0x5819('0xd')]);this['imap'][_0x5819('0xf')](_0x5819('0x10'),this[_0x5819('0x11')]['bind'](this));this[_0x5819('0x2')][_0x5819('0xf')]('end',this[_0x5819('0x12')][_0x5819('0x13')](this));this[_0x5819('0x2')]['on'](_0x5819('0x14'),this['handleError']['bind'](this));this[_0x5819('0x2')][_0x5819('0x15')]();}util[_0x5819('0x16')](EmailImap,EventEmitter);EmailImap[_0x5819('0x17')][_0x5819('0xe')]=function(_0x2d5a24,_0x530b9f){var _0x11030d={'connTimeout':_0x2d5a24[_0x5819('0x18')]?_0x2d5a24[_0x5819('0x18')]*0x3e8:0x2710,'authTimeout':_0x2d5a24[_0x5819('0x19')]?_0x2d5a24[_0x5819('0x19')]*0x3e8:0x1388};if(_0x2d5a24[_0x5819('0x1a')]){_0x11030d['user']=_0x2d5a24['user'];if(_0x2d5a24[_0x5819('0x1b')]){_0x11030d['xoauth2']=utils['generateXOAuth2Token'](_0x2d5a24['CloudProvider'][_0x5819('0x1c')],_0x2d5a24[_0x5819('0x1d')]);}else{_0x11030d[_0x5819('0x1e')]=_0x2d5a24['password'];}}else{if(_0x2d5a24[_0x5819('0x1f')]){_0x11030d[_0x5819('0x1d')]=_0x2d5a24[_0x5819('0x1d')];_0x11030d[_0x5819('0x1e')]=_0x2d5a24[_0x5819('0x1e')];}}_0x11030d[_0x5819('0x9')]=_0x530b9f||_0x2d5a24[_0x5819('0x1d')]||_0x5819('0x20');_0x11030d[_0x5819('0x21')]=_0x2d5a24[_0x5819('0x21')];_0x11030d[_0x5819('0x22')]=_0x2d5a24[_0x5819('0x22')]||0x3e1;if(_0x2d5a24[_0x5819('0x23')]){_0x11030d['tls']=!![];}else{_0x11030d[_0x5819('0x23')]=![];_0x11030d[_0x5819('0x24')]=_0x5819('0x25');}return _0x11030d;};EmailImap[_0x5819('0x17')]['handleReady']=function(){this[_0x5819('0x2')][_0x5819('0x26')](this['mailbox'],![],this[_0x5819('0x27')][_0x5819('0x13')](this));};EmailImap[_0x5819('0x17')][_0x5819('0x27')]=function(_0x474420,_0x204081){if(_0x474420){this[_0x5819('0x28')](_0x474420,!![]);}else{this[_0x5819('0x29')](_0x5819('0x2a'),_0x204081);this['readUnseen']();}};EmailImap[_0x5819('0x17')]['handleCloseBox']=function(_0x26e657){if(_0x26e657){this[_0x5819('0x28')](_0x26e657,!![]);}else{this[_0x5819('0x2')][_0x5819('0x2b')]();}};EmailImap[_0x5819('0x17')]['readUnseen']=function(){this[_0x5819('0x2')][_0x5819('0x2c')]([_0x5819('0x2d')],this[_0x5819('0x2e')][_0x5819('0x13')](this));};EmailImap[_0x5819('0x17')][_0x5819('0x2e')]=function(_0x2c8335,_0x47414a){if(_0x2c8335){this[_0x5819('0x28')](_0x2c8335,!![]);}else{if(_0x47414a[_0x5819('0x2f')]){try{var _0x7fb164=this['imap'][_0x5819('0x30')](_0x47414a[_0x5819('0x31')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x7fb164['on'](_0x5819('0x32'),this['handleFetchMessage']['bind'](this));_0x7fb164[_0x5819('0xf')]('error',this[_0x5819('0x33')][_0x5819('0x13')](this));_0x7fb164[_0x5819('0xf')](_0x5819('0x2b'),this['handleFetchEnd'][_0x5819('0x13')](this));}catch(_0x5b9b1f){logger[_0x5819('0x14')](_0x5b9b1f);}}else{this[_0x5819('0x2')]['closeBox'](!![],this[_0x5819('0x34')][_0x5819('0x13')](this));}}};EmailImap[_0x5819('0x17')][_0x5819('0x35')]=function(_0x262e93){_0x262e93['on'](_0x5819('0x36'),this[_0x5819('0x37')][_0x5819('0x13')](this));_0x262e93['once'](_0x5819('0x38'),this[_0x5819('0x39')][_0x5819('0x13')](this));_0x262e93[_0x5819('0xf')]('end',this[_0x5819('0x3a')][_0x5819('0x13')](this));};EmailImap[_0x5819('0x17')][_0x5819('0x37')]=function(_0x5cc084){simpleParser(_0x5cc084,{'Iconv':Iconv},this[_0x5819('0x3b')][_0x5819('0x13')](this));};EmailImap[_0x5819('0x17')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x5819('0x3a')]=function(){};EmailImap[_0x5819('0x17')][_0x5819('0x3b')]=function(_0x25b939,_0x199a16){if(_0x25b939){logger[_0x5819('0x14')](_0x25b939);}else{var _0x2da9ce=this;const _0x275c94=_0x199a16[_0x5819('0x3c')][_0x5819('0x2f')];if(_0x275c94\x20[Attachment:\x20','body','textAsHtml','message','originTo','originCc','bcc','attach','type','attachment','attachment-','%s-%s','now','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','parser','from','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','indexOf','split'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0x7858,0x117));var _0x8785=function(_0x259520,_0x1f876c){_0x259520=_0x259520-0x0;var _0x4dbe8e=_0x7858[_0x259520];return _0x4dbe8e;};'use strict';var _=require(_0x8785('0x0'));var moment=require(_0x8785('0x1'));var random=require(_0x8785('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x8785('0x3'));var tnef=require(_0x8785('0x4'));var logger=require(_0x8785('0x5'))(_0x8785('0x6'));var config=require(_0x8785('0x7'));function getAddress(_0x802e54){var _0x5419b0=_[_0x8785('0x8')](_0x802e54[_0x8785('0x9')]);return _0x5419b0&&_0x5419b0[_0x8785('0xa')]?_0x5419b0[_0x8785('0xa')]:'anonymous'+random[_0x8785('0xb')](0x6)+_0x8785('0xc');}function getFirstName(_0x117969){var _0x1cd451=_[_0x8785('0x8')](_0x117969[_0x8785('0x9')]);if(_0x1cd451&&_0x1cd451[_0x8785('0xd')]){if(_0x1cd451[_0x8785('0xd')]==_0x1cd451[_0x8785('0xa')]){return _0x1cd451[_0x8785('0xd')][_0x8785('0xe')](0x0,_0x1cd451[_0x8785('0xd')][_0x8785('0xf')]('@'));}var _0x17509d=_0x1cd451['name'][_0x8785('0x10')](/\s+/);return _0x17509d[_0x8785('0x11')]>0x1?_0x17509d[_0x8785('0x12')](0x0,-0x1)[_0x8785('0x13')]('\x20'):_0x1cd451[_0x8785('0xd')];}return _0x8785('0x14');}function getLastName(_0x5aa488){var _0x1c9b23=_[_0x8785('0x8')](_0x5aa488['value']);if(_0x1c9b23&&_0x1c9b23[_0x8785('0xd')]){var _0x123ff7=_0x1c9b23[_0x8785('0xd')]['split'](/\s+/);return _0x123ff7[_0x8785('0x11')]>0x1?_0x123ff7[_0x8785('0x15')]():'';}return'';}function getMails(_0x442777,_0x48ecb4){var _0x356972='';for(var _0x510b2f=0x0;_0x510b2f<_0x48ecb4[_0x8785('0x9')][_0x8785('0x11')];_0x510b2f+=0x1){if(_0x48ecb4[_0x8785('0x9')][_0x510b2f][_0x8785('0xa')]!==_0x442777){if(!_[_0x8785('0x16')](_0x356972)){_0x356972+=',';}_0x356972+=_0x48ecb4[_0x8785('0x9')][_0x510b2f][_0x8785('0xd')]||_0x48ecb4[_0x8785('0x9')][_0x510b2f][_0x8785('0xa')]||'';_0x356972+='\x20<';_0x356972+=_0x48ecb4[_0x8785('0x9')][_0x510b2f][_0x8785('0xa')]?_0x48ecb4[_0x8785('0x9')][_0x510b2f]['address']:_0x8785('0x17')+random[_0x8785('0xb')](0x6)+_0x8785('0xc');_0x356972+='>';}}return _0x356972;}function parseEmail(_0x25d94b,_0x403e8f,_0x3ead17){if(_0x403e8f[_0x8785('0x18')]){var _0x1e1190=/)<[^<]*)*<\/script>/gi;while(_0x1e1190['test'](_0x403e8f[_0x8785('0x18')])){_0x403e8f[_0x8785('0x18')]=_0x403e8f[_0x8785('0x18')][_0x8785('0x19')](_0x1e1190,'');}if(_0x403e8f['html'][_0x8785('0x1a')](_0x8785('0x1b'))){var _0x39770e=[];_0x403e8f[_0x8785('0x1c')][_0x8785('0x1d')](_0xd9a23a=>{_0x39770e[_0x8785('0x1e')](_0xd9a23a['filename']);});var _0x48706f=/]+>/g;var _0x131c27=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5df682=_0x403e8f[_0x8785('0x18')][_0x8785('0x19')](_0x131c27,_0x8785('0x1f'));var _0x5b5da8=_0x5df682[_0x8785('0x19')](_0x48706f,_0x8785('0x20'));for(let _0x18ef13=0x0;_0x18ef13<_0x39770e[_0x8785('0x11')];_0x18ef13++){var _0x38f4a7=_0x5b5da8[_0x8785('0x19')](_0x8785('0x20'),_0x8785('0x21')+_0x39770e[_0x18ef13]+'\x20]');_0x5b5da8=_0x38f4a7;}_0x403e8f[_0x8785('0x18')]=_0x5b5da8;}_0x3ead17[_0x8785('0x22')]=_0x403e8f[_0x8785('0x18')];}else{_0x3ead17[_0x8785('0x22')]=_0x403e8f[_0x8785('0x23')];}if(_0x3ead17['body']){_0x3ead17[_0x8785('0x22')]=_0x3ead17[_0x8785('0x22')][_0x8785('0x19')](/0x0){var _0x324c97=[_0x8785('0x33'),_0x8785('0x34'),_0x8785('0x35')];for(var _0x277777=0x0;_0x277777<_0x403e8f[_0x8785('0x32')][_0x8785('0x11')];_0x277777++){var _0x312694=_[_0x8785('0xf')](_0x324c97,_0x403e8f[_0x8785('0x32')][_0x277777]['line']);if(_0x312694>=0x0){_0x3ead17['isAutoreply']=!![];}}}return _0x3ead17;}exports[_0x8785('0x36')]=function(_0x217072,_0x27522d,_0x1ec0e8){var _0x5bc744={'from':getAddress(_0x27522d['from']),'firstName':getFirstName(_0x27522d[_0x8785('0x37')]),'lastName':getLastName(_0x27522d[_0x8785('0x37')]),'mapKey':_0x8785('0x6'),'message':{'from':getMails(_0x217072['email'],_0x27522d[_0x8785('0x37')]),'to':_0x217072[_0x8785('0x6')],'cc':'','subject':_0x27522d[_0x8785('0x38')]||'','messageId':_0x27522d[_0x8785('0x39')],'inReplyTo':_0x27522d[_0x8785('0x3a')],'sentAt':moment(_0x27522d[_0x8785('0x3b')])[_0x8785('0x3c')](_0x8785('0x3d')),'attach':![],'attachments':[]}};if(!_0x27522d[_0x8785('0x18')]&&!_0x27522d[_0x8785('0x23')]){var _0xa4b7f0=_[_0x8785('0x3e')](_0x27522d[_0x8785('0x1c')],{'contentType':'application/ms-tnef'});if(_0xa4b7f0['length']){logger[_0x8785('0x3f')](util[_0x8785('0x3c')](_0x8785('0x40'),_0x27522d[_0x8785('0x39')]));tnef['parseBuffer'](_['first'](_0xa4b7f0)['content'],function(_0x33c62f,_0x57580e){if(_0x57580e){_0x27522d[_0x8785('0x18')]=_0x57580e[_0x8785('0x41')]||_0x8785('0x42');if(_0x57580e[_0x8785('0x43')]){for(var _0x1f72db=0x0;_0x1f72db<_0x57580e[_0x8785('0x43')][_0x8785('0x11')];_0x1f72db++){var _0x3c1dd3=_0x57580e[_0x8785('0x43')][_0x1f72db];_0x5bc744[_0x8785('0x24')]['attachments']['push']({'filename':_0x3c1dd3[_0x8785('0x44')],'content':Buffer[_0x8785('0x37')](_0x3c1dd3[_0x8785('0x45')])});}}}_0x1ec0e8(parseEmail(_0x217072,_0x27522d,_0x5bc744));});}else{_0x27522d[_0x8785('0x18')]=_0x8785('0x42');_0x1ec0e8(parseEmail(_0x217072,_0x27522d,_0x5bc744));}}else{_0x1ec0e8(parseEmail(_0x217072,_0x27522d,_0x5bc744));}};exports[_0x8785('0x46')]=function(_0x43be81,_0x446dff){var _0x1b04c8=['user='+(_0x446dff||''),_0x8785('0x47')+_0x43be81,'',''];return Buffer[_0x8785('0x37')](_0x1b04c8[_0x8785('0x13')](''),_0x8785('0x48'))['toString'](_0x8785('0x49'));}; \ No newline at end of file +var _0xd773=['slice','join','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','lodash','moment','randomstring','util','node-tnef','email','head','value','address','anonymous','generate','@xcally.com','name','substring','length'];(function(_0x17e57e,_0x3ffddb){var _0x41cbd7=function(_0x8f9f5d){while(--_0x8f9f5d){_0x17e57e['push'](_0x17e57e['shift']());}};_0x41cbd7(++_0x3ffddb);}(_0xd773,0x1ad));var _0x3d77=function(_0x14b8bc,_0x3d3d0b){_0x14b8bc=_0x14b8bc-0x0;var _0x50a454=_0xd773[_0x14b8bc];return _0x50a454;};'use strict';var _=require(_0x3d77('0x0'));var moment=require(_0x3d77('0x1'));var random=require(_0x3d77('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x3d77('0x3'));var tnef=require(_0x3d77('0x4'));var logger=require('../../../config/logger')(_0x3d77('0x5'));var config=require('../../../config/environment');function getAddress(_0x238369){var _0x53a335=_[_0x3d77('0x6')](_0x238369[_0x3d77('0x7')]);return _0x53a335&&_0x53a335[_0x3d77('0x8')]?_0x53a335['address']:_0x3d77('0x9')+random[_0x3d77('0xa')](0x6)+_0x3d77('0xb');}function getFirstName(_0x2b3687){var _0x304c34=_['head'](_0x2b3687['value']);if(_0x304c34&&_0x304c34[_0x3d77('0xc')]){if(_0x304c34['name']==_0x304c34[_0x3d77('0x8')]){return _0x304c34[_0x3d77('0xc')][_0x3d77('0xd')](0x0,_0x304c34[_0x3d77('0xc')]['indexOf']('@'));}var _0x3d4d8e=_0x304c34['name']['split'](/\s+/);return _0x3d4d8e[_0x3d77('0xe')]>0x1?_0x3d4d8e[_0x3d77('0xf')](0x0,-0x1)[_0x3d77('0x10')]('\x20'):_0x304c34[_0x3d77('0xc')];}return _0x3d77('0x11');}function getLastName(_0x27eecd){var _0x58ae74=_[_0x3d77('0x6')](_0x27eecd['value']);if(_0x58ae74&&_0x58ae74[_0x3d77('0xc')]){var _0x5e74e6=_0x58ae74[_0x3d77('0xc')]['split'](/\s+/);return _0x5e74e6[_0x3d77('0xe')]>0x1?_0x5e74e6[_0x3d77('0x12')]():'';}return'';}function getMails(_0x1137bd,_0x5a69af){var _0x5d7899='';for(var _0x3c22fb=0x0;_0x3c22fb<_0x5a69af[_0x3d77('0x7')][_0x3d77('0xe')];_0x3c22fb+=0x1){if(_0x5a69af[_0x3d77('0x7')][_0x3c22fb][_0x3d77('0x8')]!==_0x1137bd){if(!_[_0x3d77('0x13')](_0x5d7899)){_0x5d7899+=',';}_0x5d7899+=_0x5a69af[_0x3d77('0x7')][_0x3c22fb][_0x3d77('0xc')]||_0x5a69af[_0x3d77('0x7')][_0x3c22fb][_0x3d77('0x8')]||'';_0x5d7899+='\x20<';_0x5d7899+=_0x5a69af[_0x3d77('0x7')][_0x3c22fb][_0x3d77('0x8')]?_0x5a69af[_0x3d77('0x7')][_0x3c22fb][_0x3d77('0x8')]:_0x3d77('0x9')+random[_0x3d77('0xa')](0x6)+_0x3d77('0xb');_0x5d7899+='>';}}return _0x5d7899;}function parseEmail(_0x3be5c0,_0x593d48,_0x3ec435){if(_0x593d48[_0x3d77('0x14')]){var _0x477a49=/)<[^<]*)*<\/script>/gi;while(_0x477a49[_0x3d77('0x15')](_0x593d48[_0x3d77('0x14')])){_0x593d48['html']=_0x593d48[_0x3d77('0x14')][_0x3d77('0x16')](_0x477a49,'');}if(_0x593d48['html'][_0x3d77('0x17')](_0x3d77('0x18'))){var _0x1cc564=[];_0x593d48[_0x3d77('0x19')][_0x3d77('0x1a')](_0x27497b=>{_0x1cc564[_0x3d77('0x1b')](_0x27497b[_0x3d77('0x1c')]);});var _0x1d31ad=/]+>/g;var _0x4d4b44=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x325275=_0x593d48[_0x3d77('0x14')]['replace'](_0x4d4b44,_0x3d77('0x1d'));var _0x314145=_0x325275['replace'](_0x1d31ad,'_IMG');for(let _0x359e4f=0x0;_0x359e4f<_0x1cc564[_0x3d77('0xe')];_0x359e4f++){var _0x2511b8=_0x314145[_0x3d77('0x16')](_0x3d77('0x1e'),_0x3d77('0x1f')+_0x1cc564[_0x359e4f]+_0x3d77('0x20'));_0x314145=_0x2511b8;}_0x593d48[_0x3d77('0x14')]=_0x314145;}_0x3ec435[_0x3d77('0x21')]=_0x593d48[_0x3d77('0x14')];}else{_0x3ec435[_0x3d77('0x21')]=_0x593d48[_0x3d77('0x22')];}if(_0x3ec435[_0x3d77('0x21')]){_0x3ec435[_0x3d77('0x21')]=_0x3ec435[_0x3d77('0x21')]['replace'](/0x0){var _0x19368d=['Auto-Submitted:\x20auto-replied',_0x3d77('0x34'),'Precedence:\x20auto_reply'];for(var _0xda447a=0x0;_0xda447a<_0x593d48[_0x3d77('0x33')][_0x3d77('0xe')];_0xda447a++){var _0x276b13=_[_0x3d77('0x35')](_0x19368d,_0x593d48[_0x3d77('0x33')][_0xda447a][_0x3d77('0x36')]);if(_0x276b13>=0x0){_0x3ec435[_0x3d77('0x37')]=!![];}}}return _0x3ec435;}exports[_0x3d77('0x38')]=function(_0x3268a1,_0x53bee3,_0x4d59f7){var _0x24bcfd={'from':getAddress(_0x53bee3[_0x3d77('0x39')]),'firstName':getFirstName(_0x53bee3[_0x3d77('0x39')]),'lastName':getLastName(_0x53bee3[_0x3d77('0x39')]),'mapKey':_0x3d77('0x5'),'message':{'from':getMails(_0x3268a1['email'],_0x53bee3[_0x3d77('0x39')]),'to':_0x3268a1[_0x3d77('0x5')],'cc':'','subject':_0x53bee3['subject']||'','messageId':_0x53bee3[_0x3d77('0x3a')],'inReplyTo':_0x53bee3[_0x3d77('0x3b')],'sentAt':moment(_0x53bee3[_0x3d77('0x3c')])['format'](_0x3d77('0x3d')),'attach':![],'attachments':[]}};if(!_0x53bee3[_0x3d77('0x14')]&&!_0x53bee3[_0x3d77('0x22')]){var _0x5c9816=_[_0x3d77('0x3e')](_0x53bee3[_0x3d77('0x19')],{'contentType':_0x3d77('0x3f')});if(_0x5c9816[_0x3d77('0xe')]){logger[_0x3d77('0x40')](util[_0x3d77('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x53bee3[_0x3d77('0x3a')]));tnef['parseBuffer'](_[_0x3d77('0x41')](_0x5c9816)[_0x3d77('0x31')],function(_0xbcc862,_0x7c089e){if(_0x7c089e){_0x53bee3[_0x3d77('0x14')]=_0x7c089e[_0x3d77('0x42')]||_0x3d77('0x43');if(_0x7c089e[_0x3d77('0x44')]){for(var _0x3ef848=0x0;_0x3ef848<_0x7c089e[_0x3d77('0x44')][_0x3d77('0xe')];_0x3ef848++){var _0x43bbcc=_0x7c089e[_0x3d77('0x44')][_0x3ef848];_0x24bcfd[_0x3d77('0x25')][_0x3d77('0x19')][_0x3d77('0x1b')]({'filename':_0x43bbcc['Title'],'content':Buffer[_0x3d77('0x39')](_0x43bbcc[_0x3d77('0x45')])});}}}_0x4d59f7(parseEmail(_0x3268a1,_0x53bee3,_0x24bcfd));});}else{_0x53bee3[_0x3d77('0x14')]=_0x3d77('0x43');_0x4d59f7(parseEmail(_0x3268a1,_0x53bee3,_0x24bcfd));}}else{_0x4d59f7(parseEmail(_0x3268a1,_0x53bee3,_0x24bcfd));}};exports[_0x3d77('0x46')]=function(_0x2c5881,_0x4d294a){var _0x5ec7f4=[_0x3d77('0x47')+(_0x4d294a||''),_0x3d77('0x48')+_0x2c5881,'',''];return Buffer[_0x3d77('0x39')](_0x5ec7f4[_0x3d77('0x10')](''),'utf-8')[_0x3d77('0x49')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 81a249c..6d194cd 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 _0x8649=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x8649,0x100));var _0x9864=function(_0x1ea51c,_0x5752a8){_0x1ea51c=_0x1ea51c-0x0;var _0x82b3f2=_0x8649[_0x1ea51c];return _0x82b3f2;};'use strict';var _=require(_0x9864('0x0'));function MailAccount(_0x41959d){this['id']=_0x41959d['id']||0x0;this[_0x9864('0x1')]=_0x41959d['name']||_0x9864('0x2');this[_0x9864('0x3')]=_0x41959d[_0x9864('0x3')]||_0x9864('0x4');this[_0x9864('0x5')]=_0x41959d[_0x9864('0x5')]||![];this[_0x9864('0x6')]=_0x41959d[_0x9864('0x6')]||[];this['Smtp']=_0x41959d[_0x9864('0x7')]||[];}module[_0x9864('0x8')]=MailAccount; \ No newline at end of file +var _0x8e94=['exports','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x3cf518,_0x2cd587){var _0x187969=function(_0x20885d){while(--_0x20885d){_0x3cf518['push'](_0x3cf518['shift']());}};_0x187969(++_0x2cd587);}(_0x8e94,0x1c9));var _0x48e9=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0x8e94[_0xb6e2ea];return _0x2a57bb;};'use strict';var _=require('lodash');function MailAccount(_0x5e66b8){this['id']=_0x5e66b8['id']||0x0;this[_0x48e9('0x0')]=_0x5e66b8[_0x48e9('0x0')]||_0x48e9('0x1');this[_0x48e9('0x2')]=_0x5e66b8[_0x48e9('0x2')]||_0x48e9('0x3');this[_0x48e9('0x4')]=_0x5e66b8[_0x48e9('0x4')]||![];this[_0x48e9('0x5')]=_0x5e66b8['Imap']||[];this[_0x48e9('0x6')]=_0x5e66b8[_0x48e9('0x6')]||[];}module[_0x48e9('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 3509a6a..7221204 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 _0x39d2=['mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','merge','exports'];(function(_0x1e75b1,_0x448017){var _0x2d1d0b=function(_0x31c812){while(--_0x31c812){_0x1e75b1['push'](_0x1e75b1['shift']());}};_0x2d1d0b(++_0x448017);}(_0x39d2,0x186));var _0x239d=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x39d2[_0x602ca8];return _0x26e8ab;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x239d('0x0')]={};};function freeIsNotKey(_0x1473d3,_0x445b46,_0x68158a){var _0x549c1d=_[_0x239d('0x1')](_0x1473d3,function(_0x1f47a4,_0xf6808c){return _0x1f47a4[_0x68158a];});for(var _0x47746e in _0x445b46){if(_0x445b46['hasOwnProperty'](_0x47746e)){if(!_0x549c1d[_0x47746e]){delete _0x445b46[_0x47746e];}}}}Realtime[_0x239d('0x2')][_0x239d('0x3')]=function(_0x31434b,_0x44ead8){for(var _0x5c3807 in _0x44ead8){if(_0x31434b[_0x239d('0x4')](_0x5c3807)){_0x31434b[_0x5c3807]=_0x44ead8[_0x5c3807];}}};Realtime['prototype'][_0x239d('0x5')]=function(){var _0x51456a=this;return function(_0x4c503){if(_0x4c503){freeIsNotKey(_0x4c503,_0x51456a[_0x239d('0x0')],'id');for(var _0x112bd1=0x0,_0x5379df={},_0x5a4b05={};_0x112bd1<_0x4c503[_0x239d('0x6')];_0x112bd1+=0x1){_0x5379df=_0x4c503[_0x112bd1];if(_[_0x239d('0x7')](_0x51456a[_0x239d('0x0')][_0x5379df['id']])){_0x51456a[_0x239d('0x0')][_0x5379df['id']]=new MailAccount(_0x5379df);}else{_[_0x239d('0x8')](_0x51456a[_0x239d('0x0')][_0x5379df['id']],_0x5379df);}}}return _0x51456a[_0x239d('0x0')];};};module[_0x239d('0x9')]=Realtime; \ No newline at end of file +var _0x65de=['prototype','mergeFromDatabase','initMailAccounts','length','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x5e9c00,_0x32bf2d){var _0x193f17=function(_0x3723e2){while(--_0x3723e2){_0x5e9c00['push'](_0x5e9c00['shift']());}};_0x193f17(++_0x32bf2d);}(_0x65de,0x13b));var _0xe65d=function(_0x59767a,_0x3f659f){_0x59767a=_0x59767a-0x0;var _0x21d0ab=_0x65de[_0x59767a];return _0x21d0ab;};'use strict';var _=require(_0xe65d('0x0'));var MailAccount=require(_0xe65d('0x1'));var Realtime=function(){this[_0xe65d('0x2')]={};};function freeIsNotKey(_0x4e1999,_0xea38e9,_0x41a88f){var _0x480915=_[_0xe65d('0x3')](_0x4e1999,function(_0x428c3d,_0x5a14d8){return _0x428c3d[_0x41a88f];});for(var _0x3b7cbf in _0xea38e9){if(_0xea38e9[_0xe65d('0x4')](_0x3b7cbf)){if(!_0x480915[_0x3b7cbf]){delete _0xea38e9[_0x3b7cbf];}}}}Realtime[_0xe65d('0x5')][_0xe65d('0x6')]=function(_0x28dbff,_0x414b69){for(var _0x20b151 in _0x414b69){if(_0x28dbff[_0xe65d('0x4')](_0x20b151)){_0x28dbff[_0x20b151]=_0x414b69[_0x20b151];}}};Realtime[_0xe65d('0x5')][_0xe65d('0x7')]=function(){var _0x1bb31a=this;return function(_0x1b8345){if(_0x1b8345){freeIsNotKey(_0x1b8345,_0x1bb31a[_0xe65d('0x2')],'id');for(var _0x1d8d76=0x0,_0x5157e5={},_0x2a900a={};_0x1d8d76<_0x1b8345[_0xe65d('0x8')];_0x1d8d76+=0x1){_0x5157e5=_0x1b8345[_0x1d8d76];if(_['isUndefined'](_0x1bb31a[_0xe65d('0x2')][_0x5157e5['id']])){_0x1bb31a[_0xe65d('0x2')][_0x5157e5['id']]=new MailAccount(_0x5157e5);}else{_[_0xe65d('0x9')](_0x1bb31a[_0xe65d('0x2')][_0x5157e5['id']],_0x5157e5);}}}return _0x1bb31a[_0xe65d('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index b0fa010..0190cbd 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 _0x51a8=['TemplateId','MailServerIn','type','CloudProvider','MailServerOut','data5','getMailAccount','notify','Request','NotifyMailAccount','../client','GetMailAccount','name','provider','service','email','active','key','ListId'];(function(_0x1aad64,_0x56fec3){var _0x41d94c=function(_0x5a5842){while(--_0x5a5842){_0x1aad64['push'](_0x1aad64['shift']());}};_0x41d94c(++_0x56fec3);}(_0x51a8,0x186));var _0x851a=function(_0x3e4490,_0x2d52fe){_0x3e4490=_0x3e4490-0x0;var _0x579424=_0x51a8[_0x3e4490];return _0x579424;};'use strict';var client=require(_0x851a('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0x851a('0x1'),{'options':{'attributes':['id',_0x851a('0x2'),_0x851a('0x3'),_0x851a('0x4'),_0x851a('0x5'),_0x851a('0x6'),_0x851a('0x7'),_0x851a('0x8'),_0x851a('0x9')],'raw':![],'include':[{'model':_0x851a('0xa'),'as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0x851a('0x2'),_0x851a('0x4'),_0x851a('0xb'),'data5'],'as':_0x851a('0xc')}]},{'model':_0x851a('0xd'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x851a('0x2'),_0x851a('0x4'),_0x851a('0xb'),_0x851a('0xe')],'as':_0x851a('0xc')}]}]},'log':_0x851a('0xf')});};};exports[_0x851a('0x10')]=function(_0x42ed66,_0x1d233f){return client[_0x851a('0x11')](_0x851a('0x12'),{'account':{'id':_0x42ed66},'body':_0x1d233f,'log':_0x851a('0x12')});}; \ No newline at end of file +var _0xac6a=['Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0xac6a,0xc2));var _0xaac6=function(_0x51ea27,_0xd44107){_0x51ea27=_0x51ea27-0x0;var _0x5da7bd=_0xac6a[_0x51ea27];return _0x5da7bd;};'use strict';var client=require(_0xaac6('0x0'));exports[_0xaac6('0x1')]=function(){return function(){return client[_0xaac6('0x2')](_0xaac6('0x3'),{'options':{'attributes':['id',_0xaac6('0x4'),'provider',_0xaac6('0x5'),'email',_0xaac6('0x6'),_0xaac6('0x7'),_0xaac6('0x8'),_0xaac6('0x9')],'raw':![],'include':[{'model':_0xaac6('0xa'),'as':_0xaac6('0xb'),'include':[{'model':_0xaac6('0xc'),'attributes':['id',_0xaac6('0x4'),_0xaac6('0x5'),_0xaac6('0xd'),_0xaac6('0xe')],'as':_0xaac6('0xc')}]},{'model':'MailServerOut','as':_0xaac6('0xf'),'include':[{'model':_0xaac6('0xc'),'attributes':['id',_0xaac6('0x4'),_0xaac6('0x5'),_0xaac6('0xd'),_0xaac6('0xe')],'as':'CloudProvider'}]}]},'log':_0xaac6('0x10')});};};exports[_0xaac6('0x11')]=function(_0x4705dc,_0x1156d7){return client[_0xaac6('0x2')]('NotifyMailAccount',{'account':{'id':_0x4705dc},'body':_0x1156d7,'log':_0xaac6('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 4881058..592299a 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 _0x1b40=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x42e457,_0x460a58){var _0x443e30=function(_0x5a1b6b){while(--_0x5a1b6b){_0x42e457['push'](_0x42e457['shift']());}};_0x443e30(++_0x460a58);}(_0x1b40,0xba));var _0x01b4=function(_0x452985,_0x1ca4af){_0x452985=_0x452985-0x0;var _0x115294=_0x1b40[_0x452985];return _0x115294;};'use strict';var client=require(_0x01b4('0x0'));exports[_0x01b4('0x1')]=function(){return client[_0x01b4('0x2')](_0x01b4('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x01b4('0x4')]},'log':_0x01b4('0x5')});}; \ No newline at end of file +var _0xef08=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x3a9cdf,_0x4371a6){var _0x4b4ee4=function(_0x5b298e){while(--_0x5b298e){_0x3a9cdf['push'](_0x3a9cdf['shift']());}};_0x4b4ee4(++_0x4371a6);}(_0xef08,0x1ac));var _0x8ef0=function(_0x2130e2,_0x4f8a27){_0x2130e2=_0x2130e2-0x0;var _0x5777fb=_0xef08[_0x2130e2];return _0x5777fb;};'use strict';var client=require(_0x8ef0('0x0'));exports[_0x8ef0('0x1')]=function(){return client[_0x8ef0('0x2')](_0x8ef0('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8ef0('0x4')]},'log':_0x8ef0('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d1c55ac..be0239a 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 0e07bc2..c50987f 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 _0x3dde=['localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','polling','redis','defaults'];(function(_0x19d75c,_0x440d34){var _0x8365b6=function(_0x243380){while(--_0x243380){_0x19d75c['push'](_0x19d75c['shift']());}};_0x8365b6(++_0x440d34);}(_0x3dde,0x6d));var _0xe3dd=function(_0x20e6c4,_0x573880){_0x20e6c4=_0x20e6c4-0x0;var _0x61fc99=_0x3dde[_0x20e6c4];return _0x61fc99;};'use strict';var _=require(_0xe3dd('0x0'));var http=require(_0xe3dd('0x1'));var express=require('express');var sticky=require(_0xe3dd('0x2'));var Redis=require(_0xe3dd('0x3'));var config=require(_0xe3dd('0x4'));var app=express();var server=http[_0xe3dd('0x5')](app);server[_0xe3dd('0x6')]=0xdbba0;if(sticky[_0xe3dd('0x7')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':['websocket',_0xe3dd('0x8')]});config[_0xe3dd('0x9')]=_[_0xe3dd('0xa')](config[_0xe3dd('0x9')],{'host':_0xe3dd('0xb'),'port':0x18eb});socketio[_0xe3dd('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0xe3dd('0x9')]),'subClient':new Redis(config['redis'])}));require(_0xe3dd('0xd'))[_0xe3dd('0xe')]();require(_0xe3dd('0xf'))['default'](socketio);require(_0xe3dd('0x10'))[_0xe3dd('0xe')](app);require(_0xe3dd('0x11'))[_0xe3dd('0xe')](app);}else{server[_0xe3dd('0x12')](_0xe3dd('0x13'),function(){console[_0xe3dd('0x14')](_0xe3dd('0x15'),config[_0xe3dd('0x16')]);});}exports=module[_0xe3dd('0x17')]=app; \ No newline at end of file +var _0x5d6d=['lodash','../../config/environment','createServer','listen','port','socket.io','polling','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d6d,0xb4));var _0xd5d6=function(_0x266778,_0x3c3931){_0x266778=_0x266778-0x0;var _0x58a3a3=_0x5d6d[_0x266778];return _0x58a3a3;};'use strict';var _=require(_0xd5d6('0x0'));var http=require('http');var express=require('express');var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0xd5d6('0x1'));var app=express();var server=http[_0xd5d6('0x2')](app);server['timeout']=0xdbba0;if(sticky[_0xd5d6('0x3')](server,config[_0xd5d6('0x4')])){var socketio=require(_0xd5d6('0x5'))(server,{'transports':['websocket',_0xd5d6('0x6')]});config['redis']=_[_0xd5d6('0x7')](config[_0xd5d6('0x8')],{'host':_0xd5d6('0x9'),'port':0x18eb});socketio[_0xd5d6('0xa')](require(_0xd5d6('0xb'))({'pubClient':new Redis(config[_0xd5d6('0x8')]),'subClient':new Redis(config[_0xd5d6('0x8')])}));require(_0xd5d6('0xc'))[_0xd5d6('0xd')]();require(_0xd5d6('0xe'))[_0xd5d6('0xd')](socketio);require(_0xd5d6('0xf'))[_0xd5d6('0xd')](app);require(_0xd5d6('0x10'))[_0xd5d6('0xd')](app);}else{server[_0xd5d6('0x11')](_0xd5d6('0x12'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xd5d6('0x4')]);});}exports=module[_0xd5d6('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index b2aa8df..4a377a3 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 _0x55e7=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x55e7,0x1e7));var _0x755e=function(_0x3816d0,_0x521e30){_0x3816d0=_0x3816d0-0x0;var _0x199b29=_0x55e7[_0x3816d0];return _0x199b29;};'use strict';var jayson=require(_0x755e('0x0'));var BPromise=require(_0x755e('0x1'));var logger=require(_0x755e('0x2'))(_0x755e('0x3'));var client=jayson[_0x755e('0x4')][_0x755e('0x5')]({'port':0x2329});client[_0x755e('0x6')]=function(_0x584fdd,_0x108660){return new BPromise(function(_0x348181,_0x5802f7){return client[_0x755e('0x7')](_0x584fdd,_0x108660)['then'](function(_0x4772e5){logger[_0x755e('0x8')](_0x755e('0x9'),'routing',_0x584fdd,_0x108660,_0x4772e5);if(_0x4772e5['error']){logger[_0x755e('0xa')](_0x755e('0x9'),'routing',_0x584fdd,_0x4772e5[_0x755e('0xa')][_0x755e('0xb')],_0x108660);return _0x5802f7(_0x4772e5['error'][_0x755e('0xb')]);}else{return _0x348181(_0x4772e5[_0x755e('0xc')]);}})[_0x755e('0xd')](function(_0x629587){logger[_0x755e('0xa')](_0x755e('0x9'),'routing',_0x584fdd,_0x629587,_0x108660);return _0x5802f7(_0x629587);});});};module[_0x755e('0xe')]=client; \ No newline at end of file +var _0xb759=['exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','rpc','error','message','catch'];(function(_0x317d31,_0x1a4ef1){var _0x1b0e72=function(_0x22a303){while(--_0x22a303){_0x317d31['push'](_0x317d31['shift']());}};_0x1b0e72(++_0x1a4ef1);}(_0xb759,0x1cf));var _0x9b75=function(_0xf0abc0,_0x3d3cdc){_0xf0abc0=_0xf0abc0-0x0;var _0x29fd55=_0xb759[_0xf0abc0];return _0x29fd55;};'use strict';var jayson=require(_0x9b75('0x0'));var BPromise=require(_0x9b75('0x1'));var logger=require('../../config/logger')(_0x9b75('0x2'));var client=jayson[_0x9b75('0x3')][_0x9b75('0x4')]({'port':0x2329});client[_0x9b75('0x5')]=function(_0x30d536,_0x5dbca2){return new BPromise(function(_0x4faaab,_0x35c3fd){return client[_0x9b75('0x6')](_0x30d536,_0x5dbca2)[_0x9b75('0x7')](function(_0xe248d5){logger[_0x9b75('0x8')](_0x9b75('0x9'),'routing',_0x30d536,_0x5dbca2,_0xe248d5);if(_0xe248d5[_0x9b75('0xa')]){logger[_0x9b75('0xa')](_0x9b75('0x9'),_0x9b75('0x2'),_0x30d536,_0xe248d5[_0x9b75('0xa')][_0x9b75('0xb')],_0x5dbca2);return _0x35c3fd(_0xe248d5[_0x9b75('0xa')][_0x9b75('0xb')]);}else{return _0x4faaab(_0xe248d5['result']);}})[_0x9b75('0xc')](function(_0x5525c1){logger[_0x9b75('0xa')](_0x9b75('0x9'),_0x9b75('0x2'),_0x30d536,_0x5525c1,_0x5dbca2);return _0x35c3fd(_0x5525c1);});});};module[_0x9b75('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 4d4766a..d47d156 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 _0x6389=['initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x6389,0xc1));var _0x9638=function(_0x885284,_0x2ed6bc){_0x885284=_0x885284-0x0;var _0xda3421=_0x6389[_0x885284];return _0xda3421;};'use strict';var BPromise=require(_0x9638('0x0'));var server=require(_0x9638('0x1'));var Realtime=require(_0x9638('0x2'));var user=require(_0x9638('0x3'));var interval=require(_0x9638('0x4'));var openchannelQueue=require(_0x9638('0x5'));var chatQueue=require(_0x9638('0x6'));var smsQueue=require(_0x9638('0x7'));var mailQueue=require(_0x9638('0x8'));var faxQueue=require(_0x9638('0x9'));var whatsappQueue=require(_0x9638('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x9638('0xb')]()[_0x9638('0xc')](user[_0x9638('0xd')]())['then'](realtime[_0x9638('0xe')]())[_0x9638('0xc')](interval[_0x9638('0xf')]())['then'](realtime['initIntervals']())[_0x9638('0xc')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x9638('0x10')]())[_0x9638('0xc')](chatQueue[_0x9638('0x11')]())[_0x9638('0xc')](realtime[_0x9638('0x12')]())[_0x9638('0xc')](smsQueue[_0x9638('0x13')]())[_0x9638('0xc')](realtime['initSmsQueues']())[_0x9638('0xc')](mailQueue['getMailQueues']())[_0x9638('0xc')](realtime['initMailQueues']())[_0x9638('0xc')](faxQueue[_0x9638('0x14')]())[_0x9638('0xc')](realtime[_0x9638('0x15')]())[_0x9638('0xc')](whatsappQueue[_0x9638('0x16')]())['then'](realtime[_0x9638('0x17')]())[_0x9638('0xc')](function(){return realtime;});}function main(){return server[_0x9638('0x18')](realtime)[_0x9638('0xc')](function(_0x4bfe26){return initRealtime();})['then'](function(_0x2a7918){return setInterval(initRealtime,0x1388);})[_0x9638('0x19')](function(_0x1ebba1){console[_0x9638('0x1a')](_0x1ebba1);});}main(); \ No newline at end of file +var _0x2ebb=['catch','log','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','initWhatsappQueues'];(function(_0xede441,_0x285c54){var _0x51c99f=function(_0x56cfc2){while(--_0x56cfc2){_0xede441['push'](_0xede441['shift']());}};_0x51c99f(++_0x285c54);}(_0x2ebb,0x1bb));var _0xb2eb=function(_0x5a5f6d,_0x2b614b){_0x5a5f6d=_0x5a5f6d-0x0;var _0x14edb7=_0x2ebb[_0x5a5f6d];return _0x14edb7;};'use strict';var BPromise=require('bluebird');var server=require(_0xb2eb('0x0'));var Realtime=require(_0xb2eb('0x1'));var user=require(_0xb2eb('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xb2eb('0x3'));var chatQueue=require(_0xb2eb('0x4'));var smsQueue=require(_0xb2eb('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xb2eb('0x6'));var whatsappQueue=require(_0xb2eb('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xb2eb('0x8')](user['getAgents']())[_0xb2eb('0x8')](realtime[_0xb2eb('0x9')]())['then'](interval[_0xb2eb('0xa')]())[_0xb2eb('0x8')](realtime[_0xb2eb('0xb')]())[_0xb2eb('0x8')](openchannelQueue[_0xb2eb('0xc')]())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue[_0xb2eb('0xd')]())['then'](realtime[_0xb2eb('0xe')]())[_0xb2eb('0x8')](smsQueue[_0xb2eb('0xf')]())[_0xb2eb('0x8')](realtime[_0xb2eb('0x10')]())[_0xb2eb('0x8')](mailQueue['getMailQueues']())[_0xb2eb('0x8')](realtime['initMailQueues']())[_0xb2eb('0x8')](faxQueue[_0xb2eb('0x11')]())[_0xb2eb('0x8')](realtime['initFaxQueues']())[_0xb2eb('0x8')](whatsappQueue['getWhatsappQueues']())[_0xb2eb('0x8')](realtime[_0xb2eb('0x12')]())[_0xb2eb('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xb2eb('0x8')](function(_0x509121){return initRealtime();})['then'](function(_0x35a17b){return setInterval(initRealtime,0x1388);})[_0xb2eb('0x13')](function(_0x2c206b){console[_0xb2eb('0x14')](_0x2c206b);});}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 b14a9c6..b12a326 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 _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x41977b,_0x338c63){var _0x38376d=function(_0x15ee4d){while(--_0x15ee4d){_0x41977b['push'](_0x41977b['shift']());}};_0x38376d(++_0x338c63);}(_0xe14b,0x93));var _0xbe14=function(_0x3a4992,_0x4e170a){_0x3a4992=_0x3a4992-0x0;var _0x275a3c=_0xe14b[_0x3a4992];return _0x275a3c;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x24a478,_0x512c3c){var _0x35120e=function(_0x4b739f){while(--_0x4b739f){_0x24a478['push'](_0x24a478['shift']());}};_0x35120e(++_0x512c3c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0x5fc3[_0x16539a];return _0x200796;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index e40f7e0..20ea0f4 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 _0x002d=['client','http','request','then','error','message','result','sendMailMessage','SendMail','jayson/promise'];(function(_0x3ef0d8,_0x522412){var _0x390017=function(_0x37445c){while(--_0x37445c){_0x3ef0d8['push'](_0x3ef0d8['shift']());}};_0x390017(++_0x522412);}(_0x002d,0x15d));var _0xd002=function(_0x330b78,_0xa98d8a){_0x330b78=_0x330b78-0x0;var _0x1e5219=_0x002d[_0x330b78];return _0x1e5219;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xd002('0x0'));var client=jayson[_0xd002('0x1')][_0xd002('0x2')]({'port':0x232b});function request(_0x3f79f1,_0x3cf2a3){return new BPromise(function(_0x49aacf,_0x3943d6){return client[_0xd002('0x3')](_0x3f79f1,_0x3cf2a3)[_0xd002('0x4')](function(_0x3b21fb){if(_0x3b21fb['error']){return _0x3943d6(_0x3b21fb[_0xd002('0x5')][_0xd002('0x6')]);}else{return _0x49aacf(_0x3b21fb[_0xd002('0x7')]);}})['catch'](function(_0x6e6b35){return _0x3943d6(_0x6e6b35);});});}exports[_0xd002('0x8')]=function(_0x5d5b54,_0x15b5c7){return request(_0xd002('0x9'),{'account':_0x5d5b54,'message':_0x15b5c7});}; \ No newline at end of file +var _0xf066=['client','http','error','result','SendMail','bluebird','jayson/promise'];(function(_0x349941,_0x449cd8){var _0x248bdb=function(_0x1643d8){while(--_0x1643d8){_0x349941['push'](_0x349941['shift']());}};_0x248bdb(++_0x449cd8);}(_0xf066,0x19b));var _0x6f06=function(_0x388da2,_0x571cad){_0x388da2=_0x388da2-0x0;var _0x2b1a45=_0xf066[_0x388da2];return _0x2b1a45;};'use strict';var BPromise=require(_0x6f06('0x0'));var jayson=require(_0x6f06('0x1'));var client=jayson[_0x6f06('0x2')][_0x6f06('0x3')]({'port':0x232b});function request(_0x3088d9,_0x98b0df){return new BPromise(function(_0x24cc54,_0x4eb5e3){return client['request'](_0x3088d9,_0x98b0df)['then'](function(_0x4b7851){if(_0x4b7851[_0x6f06('0x4')]){return _0x4eb5e3(_0x4b7851[_0x6f06('0x4')]['message']);}else{return _0x24cc54(_0x4b7851[_0x6f06('0x5')]);}})['catch'](function(_0x15f6be){return _0x4eb5e3(_0x15f6be);});});}exports['sendMailMessage']=function(_0x795335,_0x3c76b8){return request(_0x6f06('0x6'),{'account':_0x795335,'message':_0x3c76b8});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 67871cc..46693a4 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0598=['Status','StatusTime','toNumber','format','openchannelPause','chatStatusTime','chatCapacity','faxStatus','faxStatusTime','smsStatus','smsStatusTime','whatsappStatusTime','openchannelWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','ioredis','defaults','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','sms','whatsapp'];(function(_0x68ba80,_0x36cdba){var _0x28b5bd=function(_0x252116){while(--_0x252116){_0x68ba80['push'](_0x68ba80['shift']());}};_0x28b5bd(++_0x36cdba);}(_0x0598,0x92));var _0x8059=function(_0x4b0fc1,_0xc8cc8c){_0x4b0fc1=_0x4b0fc1-0x0;var _0x29b0c0=_0x0598[_0x4b0fc1];return _0x29b0c0;};'use strict';var _=require(_0x8059('0x0'));var md5=require(_0x8059('0x1'));var moment=require('moment');var Redis=require(_0x8059('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x8059('0x3')](config[_0x8059('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x467206){this['id']=_0x467206['id']||0x0;this[_0x8059('0x5')]=_0x467206['name']||'';this['online']=_0x467206[_0x8059('0x6')]||!![];this[_0x8059('0x7')]=_0x467206[_0x8059('0x7')]||![];this[_0x8059('0x8')]=_0x467206['chatPause']||![];this['mailPause']=_0x467206[_0x8059('0x9')]||![];this[_0x8059('0xa')]=_0x467206[_0x8059('0xa')]||![];this[_0x8059('0xb')]=_0x467206[_0x8059('0xb')]||![];this['openchannelPause']=_0x467206['openchannelPause']||![];this[_0x8059('0xc')]=_0x8059('0xd');this['chatStatusTime']=0x0;this['chatCapacity']=_0x467206['chatCapacity']||0x0;this[_0x8059('0xe')]=0x0;this[_0x8059('0xf')]=_0x8059('0xd');this[_0x8059('0x10')]=0x0;this[_0x8059('0x11')]=_0x467206['mailCapacity']||0x0;this[_0x8059('0x12')]=0x0;this['faxStatus']=_0x8059('0xd');this['faxStatusTime']=0x0;this[_0x8059('0x13')]=_0x467206[_0x8059('0x13')]||0x0;this[_0x8059('0x14')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0x8059('0x15')]=_0x467206[_0x8059('0x15')]||0x0;this[_0x8059('0x16')]=0x0;this[_0x8059('0x17')]=_0x8059('0xd');this['whatsappStatusTime']=0x0;this[_0x8059('0x18')]=_0x467206[_0x8059('0x18')]||0x0;this[_0x8059('0x19')]=0x0;this[_0x8059('0x1a')]='unknown';this[_0x8059('0x1b')]=0x0;this['openchannelCapacity']=_0x467206[_0x8059('0x1c')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8059('0x1d')]=![];this['busyQueue']=undefined;this[_0x8059('0x1')]='';this[_0x8059('0x1e')]={};this[_0x8059('0x1f')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x8059('0x20')]={};this[_0x8059('0x21')]={};this[_0x8059('0x22')]();}Agent[_0x8059('0x23')]['getChannelStatus']=function(_0x3bc226){if(this[_0x3bc226+_0x8059('0x24')]>0x0){if(this[_0x3bc226+_0x8059('0x25')]>0x0&&this[_0x3bc226+'CurrentCapacity']>=this[_0x3bc226+_0x8059('0x25')]){return _0x8059('0x26');}else{return _0x8059('0x27');}}else{return _0x8059('0x28');}};Agent['prototype'][_0x8059('0x22')]=function(){var _0x2cd179=[_0x8059('0x29'),_0x8059('0x2a'),_0x8059('0x2b'),'fax',_0x8059('0x2c'),_0x8059('0x2d')];for(var _0xd1fa7e=0x0;_0xd1fa7e<_0x2cd179['length'];_0xd1fa7e+=0x1){var _0x582321=this['getChannelStatus'](_0x2cd179[_0xd1fa7e]);if(this[_0x2cd179[_0xd1fa7e]+_0x8059('0x2e')]!==_0x582321){this[_0x2cd179[_0xd1fa7e]+_0x8059('0x2f')]=_[_0x8059('0x30')](moment()[_0x8059('0x31')]('x'));}this[_0x2cd179[_0xd1fa7e]+'Status']=_0x582321;}var _0x1eb71b={'id':this['id'],'name':this['name'],'online':this[_0x8059('0x6')],'voicePause':this[_0x8059('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0x8059('0x9')],'smsPause':this[_0x8059('0xb')],'faxPause':this[_0x8059('0xa')],'openchannelPause':this[_0x8059('0x32')],'chatStatus':this[_0x8059('0xc')],'chatStatusTime':this[_0x8059('0x33')],'chatCapacity':this[_0x8059('0x34')],'chatCurrentCapacity':this[_0x8059('0xe')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x8059('0x10')],'mailCapacity':this[_0x8059('0x11')],'mailCurrentCapacity':this[_0x8059('0x12')],'faxStatus':this[_0x8059('0x35')],'faxStatusTime':this[_0x8059('0x36')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x8059('0x14')],'smsStatus':this[_0x8059('0x37')],'smsStatusTime':this[_0x8059('0x38')],'smsCapacity':this[_0x8059('0x15')],'smsCurrentCapacity':this[_0x8059('0x16')],'whatsappStatus':this[_0x8059('0x17')],'whatsappStatusTime':this[_0x8059('0x39')],'whatsappCapacity':this[_0x8059('0x18')],'whatsappCurrentCapacity':this[_0x8059('0x19')],'openchannelStatus':this[_0x8059('0x1a')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x8059('0x1c')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x8059('0x1d')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x8059('0x1f')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x8059('0x3a')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x8059('0x21')]};var _0x55ddda=md5(JSON[_0x8059('0x3b')](_0x1eb71b));if(this[_0x8059('0x1')]!==_0x55ddda){this['md5']=_0x55ddda;io[_0x8059('0x3c')](_0x8059('0x3d'),_[_0x8059('0x3e')](_0x1eb71b,['online']));}};module[_0x8059('0x3f')]=Agent; \ No newline at end of file +var _0x3a6d=['faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','CurrentCapacity','Capacity','maxcapacity','idle','prototype','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','chatCapacity','chatCurrentCapacity','faxCurrentCapacity','smsCurrentCapacity','whatsappStatus','openchannelStatusTime','mailWaitingInteractions','stringify','omit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause'];(function(_0x31b8ed,_0x52220a){var _0x5c0579=function(_0x510ab7){while(--_0x510ab7){_0x31b8ed['push'](_0x31b8ed['shift']());}};_0x5c0579(++_0x52220a);}(_0x3a6d,0x143));var _0xd3a6=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3a6d[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xd3a6('0x0'));var md5=require(_0xd3a6('0x1'));var moment=require('moment');var Redis=require(_0xd3a6('0x2'));var config=require(_0xd3a6('0x3'));config[_0xd3a6('0x4')]=_[_0xd3a6('0x5')](config[_0xd3a6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd3a6('0x6'))(new Redis(config[_0xd3a6('0x4')]));function Agent(_0x1e44bd){this['id']=_0x1e44bd['id']||0x0;this[_0xd3a6('0x7')]=_0x1e44bd[_0xd3a6('0x7')]||'';this[_0xd3a6('0x8')]=_0x1e44bd['online']||!![];this[_0xd3a6('0x9')]=_0x1e44bd[_0xd3a6('0x9')]||![];this[_0xd3a6('0xa')]=_0x1e44bd[_0xd3a6('0xa')]||![];this[_0xd3a6('0xb')]=_0x1e44bd[_0xd3a6('0xb')]||![];this[_0xd3a6('0xc')]=_0x1e44bd[_0xd3a6('0xc')]||![];this[_0xd3a6('0xd')]=_0x1e44bd['smsPause']||![];this[_0xd3a6('0xe')]=_0x1e44bd[_0xd3a6('0xe')]||![];this[_0xd3a6('0xf')]=_0xd3a6('0x10');this[_0xd3a6('0x11')]=0x0;this['chatCapacity']=_0x1e44bd['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xd3a6('0x12')]=_0xd3a6('0x10');this[_0xd3a6('0x13')]=0x0;this[_0xd3a6('0x14')]=_0x1e44bd[_0xd3a6('0x14')]||0x0;this[_0xd3a6('0x15')]=0x0;this[_0xd3a6('0x16')]='unknown';this[_0xd3a6('0x17')]=0x0;this[_0xd3a6('0x18')]=_0x1e44bd[_0xd3a6('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xd3a6('0x19')]=_0xd3a6('0x10');this[_0xd3a6('0x1a')]=0x0;this['smsCapacity']=_0x1e44bd[_0xd3a6('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0xd3a6('0x10');this[_0xd3a6('0x1c')]=0x0;this[_0xd3a6('0x1d')]=_0x1e44bd[_0xd3a6('0x1d')]||0x0;this[_0xd3a6('0x1e')]=0x0;this[_0xd3a6('0x1f')]=_0xd3a6('0x10');this['openchannelStatusTime']=0x0;this[_0xd3a6('0x20')]=_0x1e44bd['openchannelCapacity']||0x0;this[_0xd3a6('0x21')]=0x0;this[_0xd3a6('0x22')]=![];this[_0xd3a6('0x23')]=undefined;this[_0xd3a6('0x1')]='';this[_0xd3a6('0x24')]={};this[_0xd3a6('0x25')]={};this['mailWaitingInteractions']={};this[_0xd3a6('0x26')]={};this[_0xd3a6('0x27')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent['prototype']['getChannelStatus']=function(_0x5c9075){if(this[_0x5c9075+_0xd3a6('0x28')]>0x0){if(this[_0x5c9075+_0xd3a6('0x29')]>0x0&&this[_0x5c9075+_0xd3a6('0x28')]>=this[_0x5c9075+'Capacity']){return _0xd3a6('0x2a');}else{return'working';}}else{return _0xd3a6('0x2b');}};Agent[_0xd3a6('0x2c')][_0xd3a6('0x2d')]=function(){var _0x4f6130=[_0xd3a6('0x2e'),_0xd3a6('0x2f'),_0xd3a6('0x30'),_0xd3a6('0x31'),_0xd3a6('0x32'),_0xd3a6('0x33')];for(var _0x5650d1=0x0;_0x5650d1<_0x4f6130[_0xd3a6('0x34')];_0x5650d1+=0x1){var _0x2b5448=this[_0xd3a6('0x35')](_0x4f6130[_0x5650d1]);if(this[_0x4f6130[_0x5650d1]+_0xd3a6('0x36')]!==_0x2b5448){this[_0x4f6130[_0x5650d1]+_0xd3a6('0x37')]=_[_0xd3a6('0x38')](moment()['format']('x'));}this[_0x4f6130[_0x5650d1]+'Status']=_0x2b5448;}var _0x1f4859={'id':this['id'],'name':this[_0xd3a6('0x7')],'online':this[_0xd3a6('0x8')],'voicePause':this[_0xd3a6('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xd3a6('0xb')],'smsPause':this[_0xd3a6('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xd3a6('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xd3a6('0x11')],'chatCapacity':this[_0xd3a6('0x39')],'chatCurrentCapacity':this[_0xd3a6('0x3a')],'mailStatus':this[_0xd3a6('0x12')],'mailStatusTime':this[_0xd3a6('0x13')],'mailCapacity':this[_0xd3a6('0x14')],'mailCurrentCapacity':this[_0xd3a6('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xd3a6('0x18')],'faxCurrentCapacity':this[_0xd3a6('0x3b')],'smsStatus':this[_0xd3a6('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd3a6('0x1b')],'smsCurrentCapacity':this[_0xd3a6('0x3c')],'whatsappStatus':this[_0xd3a6('0x3d')],'whatsappStatusTime':this[_0xd3a6('0x1c')],'whatsappCapacity':this[_0xd3a6('0x1d')],'whatsappCurrentCapacity':this[_0xd3a6('0x1e')],'openchannelStatus':this[_0xd3a6('0x1f')],'openchannelStatusTime':this[_0xd3a6('0x3e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd3a6('0x21')],'busy':this[_0xd3a6('0x22')],'busyQueue':this[_0xd3a6('0x23')],'chatWaitingInteractions':this[_0xd3a6('0x24')],'faxWaitingInteractions':this[_0xd3a6('0x25')],'mailWaitingInteractions':this[_0xd3a6('0x3f')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xd3a6('0x27')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x263615=md5(JSON[_0xd3a6('0x40')](_0x1f4859));if(this[_0xd3a6('0x1')]!==_0x263615){this[_0xd3a6('0x1')]=_0x263615;io['emit']('user:routing:update',_[_0xd3a6('0x41')](_0x1f4859,[_0xd3a6('0x8')]));}};module[_0xd3a6('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 74d9c7b..2fb90c2 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 _0xddc0=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','_rr','mapAgentsId','map','loggedIn','length','online','paused','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xddc0,0x9d));var _0x0ddc=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xddc0[_0x42020e];return _0x561551;};'use strict';var _=require(_0x0ddc('0x0'));var md5=require(_0x0ddc('0x1'));var util=require('util');var Redis=require(_0x0ddc('0x2'));var config=require(_0x0ddc('0x3'));config['redis']=_['defaults'](config[_0x0ddc('0x4')],{'host':_0x0ddc('0x5'),'port':0x18eb});var io=require(_0x0ddc('0x6'))(new Redis(config[_0x0ddc('0x4')]));function ChatQueue(_0x51c6c3){this['id']=_0x51c6c3['id']||0x0;this[_0x0ddc('0x7')]=_0x51c6c3[_0x0ddc('0x7')]||'';this[_0x0ddc('0x8')]=_0x51c6c3[_0x0ddc('0x8')]||0xa;this[_0x0ddc('0x9')]=_0x51c6c3[_0x0ddc('0x9')]||_0x0ddc('0xa');this['Agents']=_0x51c6c3[_0x0ddc('0xb')];this['mapAgentsId']={};this[_0x0ddc('0xc')]=0x0;this[_0x0ddc('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x0ddc('0xd')]['updateRouting']=function(){var _0x54f465=this['mapAgentsId'][_0x0ddc('0xe')];this[_0x0ddc('0xf')]=_[_0x0ddc('0x10')](this[_0x0ddc('0xb')],'id');this[_0x0ddc('0xf')][_0x0ddc('0xe')]=_0x54f465;};ChatQueue[_0x0ddc('0xd')]['updateRealtime']=function(){this[_0x0ddc('0x11')]=0x0;this['paused']=0x0;for(var _0x5a5c05=0x0;_0x5a5c05=0x0?this[_0x0ddc('0x15')]:0x0;var _0x18589e={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0ddc('0x11')],'name':this['name'],'paused':this[_0x0ddc('0x14')],'waiting':this[_0x0ddc('0xc')]};var _0x78da82=md5(JSON[_0x0ddc('0x16')](_0x18589e));if(this['md5']!==_0x78da82){this[_0x0ddc('0x1')]=_0x78da82;io['to'](util[_0x0ddc('0x17')](_0x0ddc('0x18'),_0x18589e['name']))[_0x0ddc('0x19')]('chat_queue:save',_0x18589e);}};module[_0x0ddc('0x1a')]=ChatQueue; \ No newline at end of file +var _0x5e95=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','loggedIn','paused','length','chatPause','available','stringify','chat:queue:%s','emit','exports','lodash','util','../../../config/environment','redis','defaults','localhost'];(function(_0x22339d,_0x1a2192){var _0x4d60b9=function(_0xd9d961){while(--_0xd9d961){_0x22339d['push'](_0x22339d['shift']());}};_0x4d60b9(++_0x1a2192);}(_0x5e95,0x7c));var _0x55e9=function(_0x14ae74,_0x4bdee5){_0x14ae74=_0x14ae74-0x0;var _0x1116f3=_0x5e95[_0x14ae74];return _0x1116f3;};'use strict';var _=require(_0x55e9('0x0'));var md5=require('md5');var util=require(_0x55e9('0x1'));var Redis=require('ioredis');var config=require(_0x55e9('0x2'));config[_0x55e9('0x3')]=_[_0x55e9('0x4')](config[_0x55e9('0x3')],{'host':_0x55e9('0x5'),'port':0x18eb});var io=require(_0x55e9('0x6'))(new Redis(config[_0x55e9('0x3')]));function ChatQueue(_0x5f37cf){this['id']=_0x5f37cf['id']||0x0;this['name']=_0x5f37cf[_0x55e9('0x7')]||'';this['timeout']=_0x5f37cf[_0x55e9('0x8')]||0xa;this['strategy']=_0x5f37cf[_0x55e9('0x9')]||'beepall';this['Agents']=_0x5f37cf[_0x55e9('0xa')];this[_0x55e9('0xb')]={};this[_0x55e9('0xc')]=0x0;this[_0x55e9('0xd')]='';this['updateRouting']();this[_0x55e9('0xe')]();}ChatQueue[_0x55e9('0xf')]['updateRouting']=function(){var _0x53908c=this[_0x55e9('0xb')][_0x55e9('0x10')];this[_0x55e9('0xb')]=_['map'](this[_0x55e9('0xa')],'id');this[_0x55e9('0xb')][_0x55e9('0x10')]=_0x53908c;};ChatQueue[_0x55e9('0xf')][_0x55e9('0xe')]=function(){this[_0x55e9('0x11')]=0x0;this[_0x55e9('0x12')]=0x0;for(var _0xf43c6b=0x0;_0xf43c6b=0x0?this[_0x55e9('0x15')]:0x0;var _0x560510={'id':this['id'],'available':this[_0x55e9('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x55e9('0x12')],'waiting':this[_0x55e9('0xc')]};var _0x1925fb=md5(JSON[_0x55e9('0x16')](_0x560510));if(this[_0x55e9('0xd')]!==_0x1925fb){this['md5']=_0x1925fb;io['to'](util['format'](_0x55e9('0x17'),_0x560510[_0x55e9('0x7')]))[_0x55e9('0x18')]('chat_queue:save',_0x560510);}};module[_0x55e9('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 170678b..9e51cf5 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 _0xff5b=['Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x3cfe15,_0x4d7512){var _0x6f5e06=function(_0x27c5f0){while(--_0x27c5f0){_0x3cfe15['push'](_0x3cfe15['shift']());}};_0x6f5e06(++_0x4d7512);}(_0xff5b,0x120));var _0xbff5=function(_0x2e8606,_0x143242){_0x2e8606=_0x2e8606-0x0;var _0x20c962=_0xff5b[_0x2e8606];return _0x20c962;};'use strict';var _=require(_0xbff5('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xbff5('0x1'));var config=require('../../../config/environment');config[_0xbff5('0x2')]=_['defaults'](config[_0xbff5('0x2')],{'host':_0xbff5('0x3'),'port':0x18eb});var io=require(_0xbff5('0x4'))(new Redis(config[_0xbff5('0x2')]));function FaxQueue(_0x1ce88e){this['id']=_0x1ce88e['id']||0x0;this[_0xbff5('0x5')]=_0x1ce88e[_0xbff5('0x5')]||'';this[_0xbff5('0x6')]=_0x1ce88e[_0xbff5('0x6')]||0xa;this['strategy']=_0x1ce88e[_0xbff5('0x7')]||_0xbff5('0x8');this[_0xbff5('0x9')]=_0x1ce88e[_0xbff5('0x9')];this[_0xbff5('0xa')]={};this[_0xbff5('0xb')]=0x0;this[_0xbff5('0xc')]='';this[_0xbff5('0xd')]();this['updateRealtime']();}FaxQueue[_0xbff5('0xe')][_0xbff5('0xd')]=function(){var _0x47f236=this['mapAgentsId'][_0xbff5('0xf')];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId'][_0xbff5('0xf')]=_0x47f236;};FaxQueue[_0xbff5('0xe')][_0xbff5('0x10')]=function(){this[_0xbff5('0x11')]=0x0;this[_0xbff5('0x12')]=0x0;for(var _0x1689d0=0x0;_0x1689d0=0x0?this['available']:0x0;var _0x5d2fdd={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbff5('0x11')],'name':this['name'],'paused':this[_0xbff5('0x12')],'waiting':this[_0xbff5('0xb')]};var _0x5c955f=md5(JSON[_0xbff5('0x16')](_0x5d2fdd));if(this[_0xbff5('0xc')]!==_0x5c955f){this['md5']=_0x5c955f;io['to'](util[_0xbff5('0x17')](_0xbff5('0x18'),_0x5d2fdd['name']))[_0xbff5('0x19')](_0xbff5('0x1a'),_0x5d2fdd);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xdf21=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','faxPause','available','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x40be91,_0x563f1c){var _0x5ef92d=function(_0x78cad5){while(--_0x78cad5){_0x40be91['push'](_0x40be91['shift']());}};_0x5ef92d(++_0x563f1c);}(_0xdf21,0x1ed));var _0x1df2=function(_0x3c325c,_0x263dc4){_0x3c325c=_0x3c325c-0x0;var _0x1d7378=_0xdf21[_0x3c325c];return _0x1d7378;};'use strict';var _=require(_0x1df2('0x0'));var md5=require(_0x1df2('0x1'));var util=require(_0x1df2('0x2'));var Redis=require(_0x1df2('0x3'));var config=require(_0x1df2('0x4'));config['redis']=_[_0x1df2('0x5')](config[_0x1df2('0x6')],{'host':_0x1df2('0x7'),'port':0x18eb});var io=require(_0x1df2('0x8'))(new Redis(config['redis']));function FaxQueue(_0x20d83a){this['id']=_0x20d83a['id']||0x0;this[_0x1df2('0x9')]=_0x20d83a[_0x1df2('0x9')]||'';this[_0x1df2('0xa')]=_0x20d83a[_0x1df2('0xa')]||0xa;this[_0x1df2('0xb')]=_0x20d83a[_0x1df2('0xb')]||_0x1df2('0xc');this[_0x1df2('0xd')]=_0x20d83a[_0x1df2('0xd')];this[_0x1df2('0xe')]={};this[_0x1df2('0xf')]=0x0;this[_0x1df2('0x1')]='';this[_0x1df2('0x10')]();this[_0x1df2('0x11')]();}FaxQueue[_0x1df2('0x12')][_0x1df2('0x10')]=function(){var _0xb9d223=this[_0x1df2('0xe')][_0x1df2('0x13')];this[_0x1df2('0xe')]=_['map'](this['Agents'],'id');this[_0x1df2('0xe')]['_rr']=_0xb9d223;};FaxQueue[_0x1df2('0x12')][_0x1df2('0x11')]=function(){this[_0x1df2('0x14')]=0x0;this[_0x1df2('0x15')]=0x0;for(var _0x556cb7=0x0;_0x556cb7=0x0?this[_0x1df2('0x17')]:0x0;var _0x2ce3ff={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1df2('0x14')],'name':this[_0x1df2('0x9')],'paused':this[_0x1df2('0x15')],'waiting':this[_0x1df2('0xf')]};var _0x163448=md5(JSON['stringify'](_0x2ce3ff));if(this[_0x1df2('0x1')]!==_0x163448){this[_0x1df2('0x1')]=_0x163448;io['to'](util['format'](_0x1df2('0x18'),_0x2ce3ff[_0x1df2('0x9')]))[_0x1df2('0x19')](_0x1df2('0x1a'),_0x2ce3ff);}};module[_0x1df2('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 2656a7a..36d4157 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 _0x7d14=['name','Intervals','exports'];(function(_0x4cf194,_0x464750){var _0x441659=function(_0x21a719){while(--_0x21a719){_0x4cf194['push'](_0x4cf194['shift']());}};_0x441659(++_0x464750);}(_0x7d14,0xc6));var _0x47d1=function(_0x32eec0,_0x109f7a){_0x32eec0=_0x32eec0-0x0;var _0x425fa1=_0x7d14[_0x32eec0];return _0x425fa1;};'use strict';function Interval(_0x21e8a7){this['id']=_0x21e8a7['id']||0x0;this[_0x47d1('0x0')]=_0x21e8a7['name']||'';this[_0x47d1('0x1')]=_0x21e8a7['Intervals']||{};}module[_0x47d1('0x2')]=Interval; \ No newline at end of file +var _0x302e=['exports','name','Intervals'];(function(_0xd397cd,_0x34455f){var _0x59366a=function(_0x52a4ff){while(--_0x52a4ff){_0xd397cd['push'](_0xd397cd['shift']());}};_0x59366a(++_0x34455f);}(_0x302e,0x19c));var _0xe302=function(_0x5a0cd0,_0x2a3523){_0x5a0cd0=_0x5a0cd0-0x0;var _0x2ac102=_0x302e[_0x5a0cd0];return _0x2ac102;};'use strict';function Interval(_0x2c4d5b){this['id']=_0x2c4d5b['id']||0x0;this[_0xe302('0x0')]=_0x2c4d5b['name']||'';this[_0xe302('0x1')]=_0x2c4d5b[_0xe302('0x1')]||{};}module[_0xe302('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 d6e4d01..9536d04 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 _0x1903=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','paused','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x36b2d2,_0x2f78dc){var _0x3385f8=function(_0x315422){while(--_0x315422){_0x36b2d2['push'](_0x36b2d2['shift']());}};_0x3385f8(++_0x2f78dc);}(_0x1903,0x19d));var _0x3190=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1903[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3190('0x0'));var md5=require(_0x3190('0x1'));var util=require(_0x3190('0x2'));var Redis=require(_0x3190('0x3'));var config=require(_0x3190('0x4'));config[_0x3190('0x5')]=_[_0x3190('0x6')](config[_0x3190('0x5')],{'host':_0x3190('0x7'),'port':0x18eb});var io=require(_0x3190('0x8'))(new Redis(config[_0x3190('0x5')]));function MailQueue(_0x3ad7b3){this['id']=_0x3ad7b3['id']||0x0;this[_0x3190('0x9')]=_0x3ad7b3[_0x3190('0x9')]||'';this[_0x3190('0xa')]=_0x3ad7b3[_0x3190('0xa')]||0xa;this[_0x3190('0xb')]=_0x3ad7b3['strategy']||_0x3190('0xc');this[_0x3190('0xd')]=_0x3ad7b3[_0x3190('0xd')];this['mapAgentsId']={};this[_0x3190('0xe')]=0x0;this['md5']='';this[_0x3190('0xf')]();this[_0x3190('0x10')]();}MailQueue[_0x3190('0x11')][_0x3190('0xf')]=function(){var _0xc257d6=this[_0x3190('0x12')][_0x3190('0x13')];this[_0x3190('0x12')]=_[_0x3190('0x14')](this[_0x3190('0xd')],'id');this[_0x3190('0x12')]['_rr']=_0xc257d6;};MailQueue['prototype'][_0x3190('0x10')]=function(){this[_0x3190('0x15')]=0x0;this['paused']=0x0;for(var _0x26ca6f=0x0;_0x26ca6f=0x0?this['available']:0x0;var _0x262812={'id':this['id'],'available':this[_0x3190('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x3190('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x36fbfd=md5(JSON['stringify'](_0x262812));if(this[_0x3190('0x1')]!==_0x36fbfd){this[_0x3190('0x1')]=_0x36fbfd;io['to'](util[_0x3190('0x19')](_0x3190('0x1a'),_0x262812[_0x3190('0x9')]))[_0x3190('0x1b')](_0x3190('0x1c'),_0x262812);}};module[_0x3190('0x1d')]=MailQueue; \ No newline at end of file +var _0x07c7=['name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','paused','available','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter'];(function(_0x2c0408,_0x3510a3){var _0x420977=function(_0x479d27){while(--_0x479d27){_0x2c0408['push'](_0x2c0408['shift']());}};_0x420977(++_0x3510a3);}(_0x07c7,0x68));var _0x707c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x07c7[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x707c('0x0'));var md5=require(_0x707c('0x1'));var util=require(_0x707c('0x2'));var Redis=require(_0x707c('0x3'));var config=require(_0x707c('0x4'));config[_0x707c('0x5')]=_[_0x707c('0x6')](config[_0x707c('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x707c('0x7'))(new Redis(config[_0x707c('0x5')]));function MailQueue(_0x323ed9){this['id']=_0x323ed9['id']||0x0;this[_0x707c('0x8')]=_0x323ed9[_0x707c('0x8')]||'';this[_0x707c('0x9')]=_0x323ed9[_0x707c('0x9')]||0xa;this[_0x707c('0xa')]=_0x323ed9[_0x707c('0xa')]||_0x707c('0xb');this[_0x707c('0xc')]=_0x323ed9[_0x707c('0xc')];this['mapAgentsId']={};this[_0x707c('0xd')]=0x0;this[_0x707c('0x1')]='';this[_0x707c('0xe')]();this[_0x707c('0xf')]();}MailQueue[_0x707c('0x10')][_0x707c('0xe')]=function(){var _0x9e44d3=this[_0x707c('0x11')][_0x707c('0x12')];this[_0x707c('0x11')]=_[_0x707c('0x13')](this['Agents'],'id');this[_0x707c('0x11')][_0x707c('0x12')]=_0x9e44d3;};MailQueue['prototype'][_0x707c('0xf')]=function(){this[_0x707c('0x14')]=0x0;this['paused']=0x0;for(var _0x435ad1=0x0;_0x435ad1=0x0?this[_0x707c('0x17')]:0x0;var _0x2ff1c1={'id':this['id'],'available':this[_0x707c('0x17')],'loggedIn':this[_0x707c('0x14')],'name':this['name'],'paused':this[_0x707c('0x16')],'waiting':this['waiting']};var _0x58c90d=md5(JSON['stringify'](_0x2ff1c1));if(this[_0x707c('0x1')]!==_0x58c90d){this['md5']=_0x58c90d;io['to'](util[_0x707c('0x18')](_0x707c('0x19'),_0x2ff1c1[_0x707c('0x8')]))['emit'](_0x707c('0x1a'),_0x2ff1c1);}};module[_0x707c('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 832af3c..11eacac 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(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7a54,0x106));var _0x47a5=function(_0x590efe,_0x134a7f){_0x590efe=_0x590efe-0x0;var _0x4df7a7=_0x7a54[_0x590efe];return _0x4df7a7;};'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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x326f,0xd1));var _0xf326=function(_0x1698d9,_0x12d9d4){_0x1698d9=_0x1698d9-0x0;var _0x1e11f0=_0x326f[_0x1698d9];return _0x1e11f0;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 359a053..4ffb33c 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 _0x5645=['loggedIn','length','online','smsPause','paused','available','waiting','stringify','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime'];(function(_0x134d30,_0x3671db){var _0x1ae1ba=function(_0x333d3e){while(--_0x333d3e){_0x134d30['push'](_0x134d30['shift']());}};_0x1ae1ba(++_0x3671db);}(_0x5645,0x19e));var _0x5564=function(_0x5e0f7b,_0x4ea2b6){_0x5e0f7b=_0x5e0f7b-0x0;var _0x409287=_0x5645[_0x5e0f7b];return _0x409287;};'use strict';var _=require(_0x5564('0x0'));var md5=require(_0x5564('0x1'));var util=require(_0x5564('0x2'));var Redis=require(_0x5564('0x3'));var config=require(_0x5564('0x4'));config['redis']=_[_0x5564('0x5')](config[_0x5564('0x6')],{'host':_0x5564('0x7'),'port':0x18eb});var io=require(_0x5564('0x8'))(new Redis(config[_0x5564('0x6')]));function SmsQueue(_0x1ee755){this['id']=_0x1ee755['id']||0x0;this[_0x5564('0x9')]=_0x1ee755[_0x5564('0x9')]||'';this[_0x5564('0xa')]=_0x1ee755['timeout']||0xa;this['strategy']=_0x1ee755[_0x5564('0xb')]||_0x5564('0xc');this[_0x5564('0xd')]=_0x1ee755[_0x5564('0xd')];this[_0x5564('0xe')]={};this['waiting']=0x0;this[_0x5564('0x1')]='';this[_0x5564('0xf')]();this['updateRealtime']();}SmsQueue[_0x5564('0x10')][_0x5564('0xf')]=function(){var _0x1c124a=this[_0x5564('0xe')][_0x5564('0x11')];this[_0x5564('0xe')]=_[_0x5564('0x12')](this[_0x5564('0xd')],'id');this['mapAgentsId'][_0x5564('0x11')]=_0x1c124a;};SmsQueue['prototype'][_0x5564('0x13')]=function(){this[_0x5564('0x14')]=0x0;this['paused']=0x0;for(var _0xe7cd0c=0x0;_0xe7cd0c=0x0?this[_0x5564('0x19')]:0x0;var _0x2a4d8f={'id':this['id'],'available':this[_0x5564('0x19')],'loggedIn':this[_0x5564('0x14')],'name':this[_0x5564('0x9')],'paused':this[_0x5564('0x18')],'waiting':this[_0x5564('0x1a')]};var _0x29ec28=md5(JSON[_0x5564('0x1b')](_0x2a4d8f));if(this[_0x5564('0x1')]!==_0x29ec28){this[_0x5564('0x1')]=_0x29ec28;io['to'](util['format'](_0x5564('0x1c'),_0x2a4d8f[_0x5564('0x9')]))['emit'](_0x5564('0x1d'),_0x2a4d8f);}};module[_0x5564('0x1e')]=SmsQueue; \ No newline at end of file +var _0x6737=['Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','beepall'];(function(_0x2fc0f4,_0x5713f9){var _0x196627=function(_0x30121c){while(--_0x30121c){_0x2fc0f4['push'](_0x2fc0f4['shift']());}};_0x196627(++_0x5713f9);}(_0x6737,0xe2));var _0x7673=function(_0x41199b,_0x276cde){_0x41199b=_0x41199b-0x0;var _0x2f3d86=_0x6737[_0x41199b];return _0x2f3d86;};'use strict';var _=require('lodash');var md5=require(_0x7673('0x0'));var util=require(_0x7673('0x1'));var Redis=require('ioredis');var config=require(_0x7673('0x2'));config[_0x7673('0x3')]=_[_0x7673('0x4')](config[_0x7673('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x7673('0x5'))(new Redis(config[_0x7673('0x3')]));function SmsQueue(_0x543b61){this['id']=_0x543b61['id']||0x0;this[_0x7673('0x6')]=_0x543b61[_0x7673('0x6')]||'';this['timeout']=_0x543b61['timeout']||0xa;this['strategy']=_0x543b61['strategy']||_0x7673('0x7');this['Agents']=_0x543b61[_0x7673('0x8')];this[_0x7673('0x9')]={};this['waiting']=0x0;this[_0x7673('0x0')]='';this[_0x7673('0xa')]();this[_0x7673('0xb')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x3ca258=this['mapAgentsId'][_0x7673('0xc')];this[_0x7673('0x9')]=_[_0x7673('0xd')](this[_0x7673('0x8')],'id');this[_0x7673('0x9')][_0x7673('0xc')]=_0x3ca258;};SmsQueue[_0x7673('0xe')][_0x7673('0xb')]=function(){this[_0x7673('0xf')]=0x0;this[_0x7673('0x10')]=0x0;for(var _0x5c8626=0x0;_0x5c8626=0x0?this[_0x7673('0x14')]:0x0;var _0x58a821={'id':this['id'],'available':this[_0x7673('0x14')],'loggedIn':this[_0x7673('0xf')],'name':this[_0x7673('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x249fe3=md5(JSON[_0x7673('0x15')](_0x58a821));if(this['md5']!==_0x249fe3){this[_0x7673('0x0')]=_0x249fe3;io['to'](util[_0x7673('0x16')](_0x7673('0x17'),_0x58a821[_0x7673('0x6')]))[_0x7673('0x18')](_0x7673('0x19'),_0x58a821);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 528a4c6..aab189e 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 _0x4bda=['updateRealtime','prototype','_rr','map','loggedIn','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x478e6a,_0x5d511d){var _0x4195d0=function(_0x337deb){while(--_0x337deb){_0x478e6a['push'](_0x478e6a['shift']());}};_0x4195d0(++_0x5d511d);}(_0x4bda,0x194));var _0xa4bd=function(_0x31716e,_0x57a4a3){_0x31716e=_0x31716e-0x0;var _0x176177=_0x4bda[_0x31716e];return _0x176177;};'use strict';var _=require(_0xa4bd('0x0'));var md5=require(_0xa4bd('0x1'));var util=require(_0xa4bd('0x2'));var Redis=require(_0xa4bd('0x3'));var config=require(_0xa4bd('0x4'));config['redis']=_[_0xa4bd('0x5')](config[_0xa4bd('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xa4bd('0x7'))(new Redis(config[_0xa4bd('0x6')]));function WhatsappQueue(_0x5a4296){this['id']=_0x5a4296['id']||0x0;this[_0xa4bd('0x8')]=_0x5a4296['name']||'';this['timeout']=_0x5a4296[_0xa4bd('0x9')]||0xa;this[_0xa4bd('0xa')]=_0x5a4296[_0xa4bd('0xa')]||_0xa4bd('0xb');this[_0xa4bd('0xc')]=_0x5a4296[_0xa4bd('0xc')];this[_0xa4bd('0xd')]={};this[_0xa4bd('0xe')]=0x0;this[_0xa4bd('0x1')]='';this[_0xa4bd('0xf')]();this[_0xa4bd('0x10')]();}WhatsappQueue[_0xa4bd('0x11')]['updateRouting']=function(){var _0x5a8916=this['mapAgentsId'][_0xa4bd('0x12')];this[_0xa4bd('0xd')]=_[_0xa4bd('0x13')](this[_0xa4bd('0xc')],'id');this['mapAgentsId']['_rr']=_0x5a8916;};WhatsappQueue[_0xa4bd('0x11')]['updateRealtime']=function(){this[_0xa4bd('0x14')]=0x0;this['paused']=0x0;for(var _0x118194=0x0;_0x118194=0x0?this['available']:0x0;var _0x360ed7={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa4bd('0x14')],'name':this[_0xa4bd('0x8')],'paused':this[_0xa4bd('0x17')],'waiting':this[_0xa4bd('0xe')]};var _0x2eee20=md5(JSON[_0xa4bd('0x19')](_0x360ed7));if(this[_0xa4bd('0x1')]!==_0x2eee20){this['md5']=_0x2eee20;io['to'](util[_0xa4bd('0x1a')](_0xa4bd('0x1b'),_0x360ed7['name']))[_0xa4bd('0x1c')](_0xa4bd('0x1d'),_0x360ed7);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x5de8=['name','waiting','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','length','online','whatsappPause','available'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5de8,0x114));var _0x85de=function(_0x41089f,_0x5d1190){_0x41089f=_0x41089f-0x0;var _0x207cbd=_0x5de8[_0x41089f];return _0x207cbd;};'use strict';var _=require(_0x85de('0x0'));var md5=require(_0x85de('0x1'));var util=require('util');var Redis=require(_0x85de('0x2'));var config=require(_0x85de('0x3'));config[_0x85de('0x4')]=_[_0x85de('0x5')](config[_0x85de('0x4')],{'host':_0x85de('0x6'),'port':0x18eb});var io=require(_0x85de('0x7'))(new Redis(config[_0x85de('0x4')]));function WhatsappQueue(_0x224575){this['id']=_0x224575['id']||0x0;this['name']=_0x224575['name']||'';this['timeout']=_0x224575[_0x85de('0x8')]||0xa;this[_0x85de('0x9')]=_0x224575[_0x85de('0x9')]||_0x85de('0xa');this[_0x85de('0xb')]=_0x224575['Agents'];this[_0x85de('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x85de('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x85de('0xe')]['updateRouting']=function(){var _0xe2d22a=this[_0x85de('0xc')]['_rr'];this['mapAgentsId']=_[_0x85de('0xf')](this[_0x85de('0xb')],'id');this[_0x85de('0xc')][_0x85de('0x10')]=_0xe2d22a;};WhatsappQueue[_0x85de('0xe')][_0x85de('0x11')]=function(){this[_0x85de('0x12')]=0x0;this[_0x85de('0x13')]=0x0;for(var _0xc52a69=0x0;_0xc52a69=0x0?this[_0x85de('0x17')]:0x0;var _0x2b3956={'id':this['id'],'available':this[_0x85de('0x17')],'loggedIn':this[_0x85de('0x12')],'name':this[_0x85de('0x18')],'paused':this[_0x85de('0x13')],'waiting':this[_0x85de('0x19')]};var _0x1856f6=md5(JSON['stringify'](_0x2b3956));if(this[_0x85de('0x1')]!==_0x1856f6){this[_0x85de('0x1')]=_0x1856f6;io['to'](util['format'](_0x85de('0x1a'),_0x2b3956['name']))[_0x85de('0x1b')](_0x85de('0x1c'),_0x2b3956);}};module[_0x85de('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 64fd1a0..7447a72 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(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 e1a2675..ac44e15 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 _0x60de=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client','update'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x60de,0x10f));var _0xe60d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x60de[_0xfae23b];return _0x200640;};'use strict';var client=require(_0xe60d('0x0'));exports[_0xe60d('0x1')]=function(_0x81420d,_0x4dc469){return client[_0xe60d('0x2')](_0xe60d('0x3'),{'body':_0x4dc469,'options':{'where':{'id':_0x81420d}},'log':_0xe60d('0x4')});};exports[_0xe60d('0x5')]=function(_0x4a82db,_0x1cb9f2){return client[_0xe60d('0x2')](_0xe60d('0x6'),{'body':_0x1cb9f2,'options':{'where':{'id':_0x4a82db}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x8c6d=['addTagsToChatInteraction','update','UpdateChatInteraction','addTags','Request','AddTagsToChatInteraction'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0x8c6d,0x121));var _0xd8c6=function(_0x20f00e,_0x3826a9){_0x20f00e=_0x20f00e-0x0;var _0xe43544=_0x8c6d[_0x20f00e];return _0xe43544;};'use strict';var client=require('../client');exports[_0xd8c6('0x0')]=function(_0xbaae42,_0x114446){return client['Request'](_0xd8c6('0x1'),{'body':_0x114446,'options':{'where':{'id':_0xbaae42}},'log':'updateChatInteraction'});};exports[_0xd8c6('0x2')]=function(_0x42f0c4,_0x3eec50){return client[_0xd8c6('0x3')](_0xd8c6('0x4'),{'body':_0x3eec50,'options':{'where':{'id':_0x42f0c4}},'log':_0xd8c6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 4cb7e0e..47359d6 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 _0x5164=['createChatMessage','../client','CreateChatMessage'];(function(_0x527645,_0xd674c){var _0x218dd5=function(_0x598288){while(--_0x598288){_0x527645['push'](_0x527645['shift']());}};_0x218dd5(++_0xd674c);}(_0x5164,0x88));var _0x4516=function(_0xd5d92d,_0x6b09d5){_0xd5d92d=_0xd5d92d-0x0;var _0x388681=_0x5164[_0xd5d92d];return _0x388681;};'use strict';var client=require(_0x4516('0x0'));exports['create']=function(_0x5badaf){return client['Request'](_0x4516('0x1'),{'body':_0x5badaf,'log':_0x4516('0x2')});}; \ No newline at end of file +var _0xfdd6=['createChatMessage','../client','Request'];(function(_0x191fa1,_0x48def1){var _0x599fe2=function(_0x2fd64f){while(--_0x2fd64f){_0x191fa1['push'](_0x191fa1['shift']());}};_0x599fe2(++_0x48def1);}(_0xfdd6,0x1ae));var _0x6fdd=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0xfdd6[_0x42bb6d];return _0x1db89b;};'use strict';var client=require(_0x6fdd('0x0'));exports['create']=function(_0x405968){return client[_0x6fdd('0x1')]('CreateChatMessage',{'body':_0x405968,'log':_0x6fdd('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 11147eb..b3e3b84 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 _0x50a6=['User','Agents','online','../client','getChatQueues','name','strategy'];(function(_0x13b820,_0x1f5f77){var _0x27b744=function(_0x2c01eb){while(--_0x2c01eb){_0x13b820['push'](_0x13b820['shift']());}};_0x27b744(++_0x1f5f77);}(_0x50a6,0xa4));var _0x650a=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x50a6[_0x13f980];return _0x27153c;};'use strict';var client=require(_0x650a('0x0'));exports[_0x650a('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x650a('0x2'),'timeout',_0x650a('0x3')],'include':[{'model':_0x650a('0x4'),'as':_0x650a('0x5'),'attributes':['id','name',_0x650a('0x6'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xe5e0=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents'];(function(_0x384ae6,_0x2fc972){var _0x547569=function(_0x24e191){while(--_0x24e191){_0x384ae6['push'](_0x384ae6['shift']());}};_0x547569(++_0x2fc972);}(_0xe5e0,0x123));var _0x0e5e=function(_0x1ffb17,_0x35b457){_0x1ffb17=_0x1ffb17-0x0;var _0x254dd0=_0xe5e0[_0x1ffb17];return _0x254dd0;};'use strict';var client=require(_0x0e5e('0x0'));exports[_0x0e5e('0x1')]=function(){return function(){return client[_0x0e5e('0x2')](_0x0e5e('0x3'),{'options':{'raw':![],'attributes':['id',_0x0e5e('0x4'),_0x0e5e('0x5'),_0x0e5e('0x6')],'include':[{'model':_0x0e5e('0x7'),'as':_0x0e5e('0x8'),'attributes':['id',_0x0e5e('0x4'),'online',_0x0e5e('0x9')]}]},'log':_0x0e5e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0144cdb..4f09e0b 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 _0x3074=['update','DESC','UpdateChatQueueReport','../client','Request','CreateChatQueueReport'];(function(_0x305728,_0x56c7bf){var _0x1f18c9=function(_0x4bcc55){while(--_0x4bcc55){_0x305728['push'](_0x305728['shift']());}};_0x1f18c9(++_0x56c7bf);}(_0x3074,0x1dd));var _0x4307=function(_0x40a458,_0x3fd1c5){_0x40a458=_0x40a458-0x0;var _0x5109e7=_0x3074[_0x40a458];return _0x5109e7;};'use strict';var client=require(_0x4307('0x0'));exports['create']=function(_0x24f815){return client[_0x4307('0x1')](_0x4307('0x2'),{'body':_0x24f815,'log':'CreateChatQueueReport'});};exports[_0x4307('0x3')]=function(_0x5c5161,_0x256692){return client[_0x4307('0x1')]('UpdateChatQueueReport',{'body':_0x256692,'options':{'where':{'uniqueid':_0x5c5161},'order':[['id',_0x4307('0x4')]],'limit':0x1},'log':_0x4307('0x5')});}; \ No newline at end of file +var _0x167e=['DESC','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x15f6a0,_0x5b34fc){var _0x10f8c7=function(_0x5b7d95){while(--_0x5b7d95){_0x15f6a0['push'](_0x15f6a0['shift']());}};_0x10f8c7(++_0x5b34fc);}(_0x167e,0xa3));var _0xe167=function(_0x83b8c6,_0x5c9f7e){_0x83b8c6=_0x83b8c6-0x0;var _0x243236=_0x167e[_0x83b8c6];return _0x243236;};'use strict';var client=require(_0xe167('0x0'));exports[_0xe167('0x1')]=function(_0x2a44c5){return client[_0xe167('0x2')](_0xe167('0x3'),{'body':_0x2a44c5,'log':_0xe167('0x3')});};exports[_0xe167('0x4')]=function(_0x62d76c,_0x5e4863){return client[_0xe167('0x2')]('UpdateChatQueueReport',{'body':_0x5e4863,'options':{'where':{'uniqueid':_0x62d76c},'order':[['id',_0xe167('0x5')]],'limit':0x1},'log':_0xe167('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9d9368b..32537f4 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(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0x7a54,0x106));var _0x47a5=function(_0x433f69,_0x30a874){_0x433f69=_0x433f69-0x0;var _0x58dc27=_0x7a54[_0x433f69];return _0x58dc27;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x335fc1,_0x4fbf78){var _0xfbca12=function(_0x5edc5d){while(--_0x5edc5d){_0x335fc1['push'](_0x335fc1['shift']());}};_0xfbca12(++_0x4fbf78);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 465a44b..c87b1de 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 _0xe385=['createFaxMessage','CreateFaxMessage'];(function(_0x3ad9e6,_0x34d1d3){var _0x3dccef=function(_0x3ca918){while(--_0x3ca918){_0x3ad9e6['push'](_0x3ad9e6['shift']());}};_0x3dccef(++_0x34d1d3);}(_0xe385,0x15f));var _0x5e38=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe385[_0x397e5f];return _0x5302b8;};'use strict';var client=require('../client');exports['create']=function(_0x26a842){return client['Request'](_0x5e38('0x0'),{'body':_0x26a842,'log':_0x5e38('0x1')});}; \ No newline at end of file +var _0xf9c1=['CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x10051c,_0x223bf9){var _0x173a8e=function(_0x4ae838){while(--_0x4ae838){_0x10051c['push'](_0x10051c['shift']());}};_0x173a8e(++_0x223bf9);}(_0xf9c1,0xee));var _0x1f9c=function(_0x331539,_0x469602){_0x331539=_0x331539-0x0;var _0x3234bf=_0xf9c1[_0x331539];return _0x3234bf;};'use strict';var client=require(_0x1f9c('0x0'));exports[_0x1f9c('0x1')]=function(_0x246516){return client['Request'](_0x1f9c('0x2'),{'body':_0x246516,'log':_0x1f9c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 62eb712..14df74a 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 _0x68bf=['../client','getFaxQueues','Request','GetFaxQueue','name','strategy','User','Agents'];(function(_0x20dcac,_0x523815){var _0x3f9853=function(_0x1ea2c2){while(--_0x1ea2c2){_0x20dcac['push'](_0x20dcac['shift']());}};_0x3f9853(++_0x523815);}(_0x68bf,0xc0));var _0xf68b=function(_0x36eb60,_0x49e382){_0x36eb60=_0x36eb60-0x0;var _0x3747d8=_0x68bf[_0x36eb60];return _0x3747d8;};'use strict';var client=require(_0xf68b('0x0'));exports[_0xf68b('0x1')]=function(){return function(){return client[_0xf68b('0x2')](_0xf68b('0x3'),{'options':{'raw':![],'attributes':['id',_0xf68b('0x4'),'timeout',_0xf68b('0x5')],'include':[{'model':_0xf68b('0x6'),'as':_0xf68b('0x7'),'attributes':['id',_0xf68b('0x4'),'online','faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x1609=['Request','GetFaxQueue','strategy','User','Agents','online','getFaxQueues','../client'];(function(_0x5ac4d8,_0x205e8a){var _0x4cb4c3=function(_0x3d28fe){while(--_0x3d28fe){_0x5ac4d8['push'](_0x5ac4d8['shift']());}};_0x4cb4c3(++_0x205e8a);}(_0x1609,0xb7));var _0x9160=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1609[_0x580576];return _0x3f55a0;};'use strict';var client=require(_0x9160('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x9160('0x1')](_0x9160('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x9160('0x3')],'include':[{'model':_0x9160('0x4'),'as':_0x9160('0x5'),'attributes':['id','name',_0x9160('0x6'),'faxPause']}]},'log':_0x9160('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d889449..e281bf0 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 _0x685b=['update','UpdateFaxQueueReport','DESC','create','Request','CreateFaxQueueReport'];(function(_0x98da59,_0x136c48){var _0x3c2944=function(_0x1cc994){while(--_0x1cc994){_0x98da59['push'](_0x98da59['shift']());}};_0x3c2944(++_0x136c48);}(_0x685b,0x8d));var _0xb685=function(_0x40b66c,_0x578758){_0x40b66c=_0x40b66c-0x0;var _0x2fd22b=_0x685b[_0x40b66c];return _0x2fd22b;};'use strict';var client=require('../client');exports[_0xb685('0x0')]=function(_0x1eddde){return client[_0xb685('0x1')](_0xb685('0x2'),{'body':_0x1eddde,'log':_0xb685('0x2')});};exports[_0xb685('0x3')]=function(_0x4177e2,_0x26bf81){return client[_0xb685('0x1')](_0xb685('0x4'),{'body':_0x26bf81,'options':{'where':{'uniqueid':_0x4177e2},'order':[['id',_0xb685('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xe965=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe965,0x1be));var _0x5e96=function(_0x5a87e2,_0x597ffd){_0x5a87e2=_0x5a87e2-0x0;var _0x479e9b=_0xe965[_0x5a87e2];return _0x479e9b;};'use strict';var client=require(_0x5e96('0x0'));exports[_0x5e96('0x1')]=function(_0x45c83e){return client[_0x5e96('0x2')](_0x5e96('0x3'),{'body':_0x45c83e,'log':_0x5e96('0x3')});};exports[_0x5e96('0x4')]=function(_0x31e60f,_0x48eb9f){return client[_0x5e96('0x2')](_0x5e96('0x5'),{'body':_0x48eb9f,'options':{'where':{'uniqueid':_0x31e60f},'order':[['id',_0x5e96('0x6')]],'limit':0x1},'log':_0x5e96('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index df424a4..4aadcb4 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 _0x88a3=['getIntervals','../client','Request','GetInterval','Interval','Intervals','name'];(function(_0x2be018,_0x4c6f4c){var _0x6e130b=function(_0x298894){while(--_0x298894){_0x2be018['push'](_0x2be018['shift']());}};_0x6e130b(++_0x4c6f4c);}(_0x88a3,0xe8));var _0x388a=function(_0x514816,_0x57c091){_0x514816=_0x514816-0x0;var _0x5c3a43=_0x88a3[_0x514816];return _0x5c3a43;};'use strict';var client=require(_0x388a('0x0'));exports['getIntervals']=function(){return function(){return client[_0x388a('0x1')](_0x388a('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x388a('0x3'),'as':_0x388a('0x4'),'attributes':['id',_0x388a('0x5'),'interval']}]},'log':_0x388a('0x6')});};}; \ No newline at end of file +var _0xc1b1=['getIntervals','../client','Request','name','Interval','Intervals','interval'];(function(_0x3898a6,_0x4ec115){var _0x499cff=function(_0x38d9de){while(--_0x38d9de){_0x3898a6['push'](_0x3898a6['shift']());}};_0x499cff(++_0x4ec115);}(_0xc1b1,0xef));var _0x1c1b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc1b1[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x1c1b('0x0'));exports['getIntervals']=function(){return function(){return client[_0x1c1b('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1c1b('0x2')],'include':[{'model':_0x1c1b('0x3'),'as':_0x1c1b('0x4'),'attributes':['id',_0x1c1b('0x2'),_0x1c1b('0x5')]}]},'log':_0x1c1b('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 68bfe15..9f3926b 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 _0x6a95=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x6a95,0x1db));var _0x56a9=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6a95[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x56a9('0x0'));exports[_0x56a9('0x1')]=function(_0x15574a,_0xce37aa){return client[_0x56a9('0x2')](_0x56a9('0x3'),{'body':_0xce37aa,'options':{'where':{'id':_0x15574a}},'log':_0x56a9('0x4')});};exports['addTags']=function(_0x512f52,_0x12cd60){return client[_0x56a9('0x2')](_0x56a9('0x5'),{'body':_0x12cd60,'options':{'where':{'id':_0x512f52}},'log':_0x56a9('0x6')});}; \ No newline at end of file +var _0x5c3c=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x5b0b9f,_0x429737){var _0xb1804=function(_0x217180){while(--_0x217180){_0x5b0b9f['push'](_0x5b0b9f['shift']());}};_0xb1804(++_0x429737);}(_0x5c3c,0x132));var _0xc5c3=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x5c3c[_0x34bc30];return _0x5706de;};'use strict';var client=require(_0xc5c3('0x0'));exports[_0xc5c3('0x1')]=function(_0x11705d,_0x32103c){return client['Request'](_0xc5c3('0x2'),{'body':_0x32103c,'options':{'where':{'id':_0x11705d}},'log':_0xc5c3('0x3')});};exports[_0xc5c3('0x4')]=function(_0x2a3649,_0x2535e0){return client[_0xc5c3('0x5')](_0xc5c3('0x6'),{'body':_0x2535e0,'options':{'where':{'id':_0x2a3649}},'log':_0xc5c3('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 10bb1ef..480a1b7 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 _0x0472=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x25e380,_0x4eda8c){var _0x3afc16=function(_0x415e0e){while(--_0x415e0e){_0x25e380['push'](_0x25e380['shift']());}};_0x3afc16(++_0x4eda8c);}(_0x0472,0x88));var _0x2047=function(_0x5abc1b,_0x4d2801){_0x5abc1b=_0x5abc1b-0x0;var _0x3284fa=_0x0472[_0x5abc1b];return _0x3284fa;};'use strict';var client=require(_0x2047('0x0'));exports[_0x2047('0x1')]=function(_0x31cb95){return client['Request'](_0x2047('0x2'),{'body':_0x31cb95,'log':_0x2047('0x3')});}; \ No newline at end of file +var _0x4535=['createMailMessage','../client','create','Request'];(function(_0x18f985,_0x40a3ee){var _0x30ef74=function(_0x241c1d){while(--_0x241c1d){_0x18f985['push'](_0x18f985['shift']());}};_0x30ef74(++_0x40a3ee);}(_0x4535,0x185));var _0x5453=function(_0x4da174,_0x4bc515){_0x4da174=_0x4da174-0x0;var _0x4a9d8d=_0x4535[_0x4da174];return _0x4a9d8d;};'use strict';var client=require(_0x5453('0x0'));exports[_0x5453('0x1')]=function(_0x3f5eed){return client[_0x5453('0x2')]('CreateMailMessage',{'body':_0x3f5eed,'log':_0x5453('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index f55255f..8814641 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 _0x98e8=['online','getMailQueues','Request','GetMailQueue','name'];(function(_0x2e1cd7,_0x293ea1){var _0x515226=function(_0x816b94){while(--_0x816b94){_0x2e1cd7['push'](_0x2e1cd7['shift']());}};_0x515226(++_0x293ea1);}(_0x98e8,0xba));var _0x898e=function(_0x989d75,_0x15ffef){_0x989d75=_0x989d75-0x0;var _0x2d0b2f=_0x98e8[_0x989d75];return _0x2d0b2f;};'use strict';var client=require('../client');exports[_0x898e('0x0')]=function(){return function(){return client[_0x898e('0x1')](_0x898e('0x2'),{'options':{'raw':![],'attributes':['id',_0x898e('0x3'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x898e('0x3'),_0x898e('0x4'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x012a=['GetMailQueue','name','strategy','User','Agents','online','mailPause','../client','getMailQueues','Request'];(function(_0x5480c8,_0x45c0fd){var _0x5c26bd=function(_0x4308df){while(--_0x4308df){_0x5480c8['push'](_0x5480c8['shift']());}};_0x5c26bd(++_0x45c0fd);}(_0x012a,0x89));var _0xa012=function(_0x281d51,_0x200860){_0x281d51=_0x281d51-0x0;var _0x1e272d=_0x012a[_0x281d51];return _0x1e272d;};'use strict';var client=require(_0xa012('0x0'));exports[_0xa012('0x1')]=function(){return function(){return client[_0xa012('0x2')](_0xa012('0x3'),{'options':{'raw':![],'attributes':['id',_0xa012('0x4'),'timeout',_0xa012('0x5')],'include':[{'model':_0xa012('0x6'),'as':_0xa012('0x7'),'attributes':['id','name',_0xa012('0x8'),_0xa012('0x9')]}]},'log':_0xa012('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e427f40..6fdce95 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 _0x85bc=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create','Request'];(function(_0x293e9d,_0x4eede5){var _0x36a9a1=function(_0x4fbe14){while(--_0x4fbe14){_0x293e9d['push'](_0x293e9d['shift']());}};_0x36a9a1(++_0x4eede5);}(_0x85bc,0x8e));var _0xc85b=function(_0x535b24,_0x5cb818){_0x535b24=_0x535b24-0x0;var _0x52f7e6=_0x85bc[_0x535b24];return _0x52f7e6;};'use strict';var client=require('../client');exports[_0xc85b('0x0')]=function(_0x2ba6a9){return client[_0xc85b('0x1')](_0xc85b('0x2'),{'body':_0x2ba6a9,'log':'CreateMailQueueReport'});};exports[_0xc85b('0x3')]=function(_0x2d66b9,_0x388dba){return client['Request'](_0xc85b('0x4'),{'body':_0x388dba,'options':{'where':{'uniqueid':_0x2d66b9},'order':[['id',_0xc85b('0x5')]],'limit':0x1},'log':_0xc85b('0x4')});}; \ No newline at end of file +var _0x3d10=['UpdateMailQueueReport','Request','CreateMailQueueReport','update'];(function(_0x505b6c,_0x5831c8){var _0x4e06a7=function(_0x35f74){while(--_0x35f74){_0x505b6c['push'](_0x505b6c['shift']());}};_0x4e06a7(++_0x5831c8);}(_0x3d10,0x1b9));var _0x03d1=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0x3d10[_0x3b3f4f];return _0x174dbe;};'use strict';var client=require('../client');exports['create']=function(_0x3b902b){return client[_0x03d1('0x0')](_0x03d1('0x1'),{'body':_0x3b902b,'log':_0x03d1('0x1')});};exports[_0x03d1('0x2')]=function(_0xac7be3,_0x107d29){return client[_0x03d1('0x0')](_0x03d1('0x3'),{'body':_0x107d29,'options':{'where':{'uniqueid':_0xac7be3},'order':[['id','DESC']],'limit':0x1},'log':_0x03d1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 86aab7f..a7e76d4 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 _0xba78=['../client','update','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x555d10,_0x1acb29){var _0x45cb8b=function(_0x208c9e){while(--_0x208c9e){_0x555d10['push'](_0x555d10['shift']());}};_0x45cb8b(++_0x1acb29);}(_0xba78,0x16d));var _0x8ba7=function(_0x24adb5,_0x3c1e77){_0x24adb5=_0x24adb5-0x0;var _0x48dfbf=_0xba78[_0x24adb5];return _0x48dfbf;};'use strict';var client=require(_0x8ba7('0x0'));exports[_0x8ba7('0x1')]=function(_0x1861e5,_0x404a89){return client[_0x8ba7('0x2')]('UpdateOpenchannelInteraction',{'body':_0x404a89,'options':{'where':{'id':_0x1861e5}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x100318,_0x36d99e){return client['Request'](_0x8ba7('0x3'),{'body':_0x36d99e,'options':{'where':{'id':_0x100318}},'log':_0x8ba7('0x4')});}; \ No newline at end of file +var _0xc1dc=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x4322c6,_0x28f126){var _0x4e7537=function(_0x3cf272){while(--_0x3cf272){_0x4322c6['push'](_0x4322c6['shift']());}};_0x4e7537(++_0x28f126);}(_0xc1dc,0xfb));var _0xcc1d=function(_0x35826f,_0x505dfa){_0x35826f=_0x35826f-0x0;var _0x318c63=_0xc1dc[_0x35826f];return _0x318c63;};'use strict';var client=require(_0xcc1d('0x0'));exports['update']=function(_0x4bb8d3,_0x42ef46){return client[_0xcc1d('0x1')](_0xcc1d('0x2'),{'body':_0x42ef46,'options':{'where':{'id':_0x4bb8d3}},'log':_0xcc1d('0x3')});};exports[_0xcc1d('0x4')]=function(_0x3ebce9,_0x2fa11a){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x2fa11a,'options':{'where':{'id':_0x3ebce9}},'log':_0xcc1d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 922ba20..ea2b60e 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 _0xe0a4=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x24f99a,_0x5106e3){var _0x3cb037=function(_0xb913f0){while(--_0xb913f0){_0x24f99a['push'](_0x24f99a['shift']());}};_0x3cb037(++_0x5106e3);}(_0xe0a4,0x8a));var _0x4e0a=function(_0x2823ac,_0x561f25){_0x2823ac=_0x2823ac-0x0;var _0x5cbab5=_0xe0a4[_0x2823ac];return _0x5cbab5;};'use strict';var client=require(_0x4e0a('0x0'));exports[_0x4e0a('0x1')]=function(_0x288965){return client[_0x4e0a('0x2')](_0x4e0a('0x3'),{'body':_0x288965,'log':_0x4e0a('0x4')});}; \ No newline at end of file +var _0xf05b=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x84c526,_0x399932){var _0x383caf=function(_0x19dd0d){while(--_0x19dd0d){_0x84c526['push'](_0x84c526['shift']());}};_0x383caf(++_0x399932);}(_0xf05b,0x1d3));var _0xbf05=function(_0x264c7b,_0x2f30a0){_0x264c7b=_0x264c7b-0x0;var _0xc6d544=_0xf05b[_0x264c7b];return _0xc6d544;};'use strict';var client=require('../client');exports[_0xbf05('0x0')]=function(_0x238f8b){return client[_0xbf05('0x1')](_0xbf05('0x2'),{'body':_0x238f8b,'log':_0xbf05('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index fe5caf5..00e8237 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 _0x5609=['strategy','Agents','online','getOpenchannelQueues','GetOpenchannelQueue','name','timeout'];(function(_0x3d84be,_0x34edd8){var _0x279c53=function(_0x1194cc){while(--_0x1194cc){_0x3d84be['push'](_0x3d84be['shift']());}};_0x279c53(++_0x34edd8);}(_0x5609,0x137));var _0x9560=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5609[_0x46e363];return _0x3fb059;};'use strict';var client=require('../client');exports[_0x9560('0x0')]=function(){return function(){return client['Request'](_0x9560('0x1'),{'options':{'raw':![],'attributes':['id',_0x9560('0x2'),_0x9560('0x3'),_0x9560('0x4')],'include':[{'model':'User','as':_0x9560('0x5'),'attributes':['id','name',_0x9560('0x6'),'openchannelPause']}]},'log':_0x9560('0x0')});};}; \ No newline at end of file +var _0x9daf=['name','timeout','User','online','openchannelPause','../client','Request','GetOpenchannelQueue'];(function(_0x3b3fb2,_0x21a7a7){var _0x2c998a=function(_0x9ad1df){while(--_0x9ad1df){_0x3b3fb2['push'](_0x3b3fb2['shift']());}};_0x2c998a(++_0x21a7a7);}(_0x9daf,0xd5));var _0xf9da=function(_0x2fab67,_0x510e24){_0x2fab67=_0x2fab67-0x0;var _0x3b0237=_0x9daf[_0x2fab67];return _0x3b0237;};'use strict';var client=require(_0xf9da('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xf9da('0x1')](_0xf9da('0x2'),{'options':{'raw':![],'attributes':['id',_0xf9da('0x3'),_0xf9da('0x4'),'strategy'],'include':[{'model':_0xf9da('0x5'),'as':'Agents','attributes':['id','name',_0xf9da('0x6'),_0xf9da('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index b61a57a..e07ca5d 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 _0xaf9c=['../client','create','Request','CreateOpenchannelQueueReport','DESC','UpdateOpenchannelQueueReport'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xaf9c,0xe4));var _0xcaf9=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xaf9c[_0x47a349];return _0x18ab75;};'use strict';var client=require(_0xcaf9('0x0'));exports[_0xcaf9('0x1')]=function(_0x411bd6){return client[_0xcaf9('0x2')](_0xcaf9('0x3'),{'body':_0x411bd6,'log':_0xcaf9('0x3')});};exports['update']=function(_0x145f3e,_0x34cc1d){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x34cc1d,'options':{'where':{'uniqueid':_0x145f3e},'order':[['id',_0xcaf9('0x4')]],'limit':0x1},'log':_0xcaf9('0x5')});}; \ No newline at end of file +var _0xd873=['../client','create','Request','UpdateOpenchannelQueueReport','DESC'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xd873,0xe6));var _0x3d87=function(_0xa46aca,_0x10c140){_0xa46aca=_0xa46aca-0x0;var _0x4c21ea=_0xd873[_0xa46aca];return _0x4c21ea;};'use strict';var client=require(_0x3d87('0x0'));exports[_0x3d87('0x1')]=function(_0x51c76f){return client[_0x3d87('0x2')]('CreateOpenchannelQueueReport',{'body':_0x51c76f,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x1d2ca7,_0x405a5b){return client[_0x3d87('0x2')](_0x3d87('0x3'),{'body':_0x405a5b,'options':{'where':{'uniqueid':_0x1d2ca7},'order':[['id',_0x3d87('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 896b65a..1071753 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 _0xdefc=['addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','addTags','Request','AddTagsToSmsInteraction'];(function(_0x567857,_0x1856e2){var _0x121c49=function(_0x59ba86){while(--_0x59ba86){_0x567857['push'](_0x567857['shift']());}};_0x121c49(++_0x1856e2);}(_0xdefc,0x1b3));var _0xcdef=function(_0xd4e399,_0x4a8481){_0xd4e399=_0xd4e399-0x0;var _0x1186c9=_0xdefc[_0xd4e399];return _0x1186c9;};'use strict';var client=require(_0xcdef('0x0'));exports[_0xcdef('0x1')]=function(_0x37a8fb,_0x4cd30f){return client['Request'](_0xcdef('0x2'),{'body':_0x4cd30f,'options':{'where':{'id':_0x37a8fb}},'log':'updateSmsInteraction'});};exports[_0xcdef('0x3')]=function(_0x2418f0,_0xfc14aa){return client[_0xcdef('0x4')](_0xcdef('0x5'),{'body':_0xfc14aa,'options':{'where':{'id':_0x2418f0}},'log':_0xcdef('0x6')});}; \ No newline at end of file +var _0x35aa=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0x5c758d,_0x3bbadb){var _0x516580=function(_0x114392){while(--_0x114392){_0x5c758d['push'](_0x5c758d['shift']());}};_0x516580(++_0x3bbadb);}(_0x35aa,0xbe));var _0xa35a=function(_0x1e13cf,_0x295396){_0x1e13cf=_0x1e13cf-0x0;var _0x385598=_0x35aa[_0x1e13cf];return _0x385598;};'use strict';var client=require('../client');exports[_0xa35a('0x0')]=function(_0x2d2970,_0x9a3c63){return client[_0xa35a('0x1')]('UpdateSmsInteraction',{'body':_0x9a3c63,'options':{'where':{'id':_0x2d2970}},'log':_0xa35a('0x2')});};exports[_0xa35a('0x3')]=function(_0x24cc2,_0x11f841){return client[_0xa35a('0x1')](_0xa35a('0x4'),{'body':_0x11f841,'options':{'where':{'id':_0x24cc2}},'log':_0xa35a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 91ba46e..78af021 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 _0x1e9c=['createSmsMessage','../client','Request'];(function(_0x112d46,_0x5cefbb){var _0x222f83=function(_0x3ac4e6){while(--_0x3ac4e6){_0x112d46['push'](_0x112d46['shift']());}};_0x222f83(++_0x5cefbb);}(_0x1e9c,0x142));var _0xc1e9=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x1e9c[_0x4a53d];return _0x27410e;};'use strict';var client=require(_0xc1e9('0x0'));exports['create']=function(_0x56f011){return client[_0xc1e9('0x1')]('CreateSmsMessage',{'body':_0x56f011,'log':_0xc1e9('0x2')});}; \ No newline at end of file +var _0x4493=['../client','create','CreateSmsMessage'];(function(_0x6b83b1,_0x4b3392){var _0x30cb37=function(_0x550817){while(--_0x550817){_0x6b83b1['push'](_0x6b83b1['shift']());}};_0x30cb37(++_0x4b3392);}(_0x4493,0x1ce));var _0x3449=function(_0x449508,_0x2576c7){_0x449508=_0x449508-0x0;var _0x34afca=_0x4493[_0x449508];return _0x34afca;};'use strict';var client=require(_0x3449('0x0'));exports[_0x3449('0x1')]=function(_0x230691){return client['Request'](_0x3449('0x2'),{'body':_0x230691,'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 e19f54f..52e0635 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x2219ed,_0x2c19dd){var _0x4fb35b=function(_0x11fb28){while(--_0x11fb28){_0x2219ed['push'](_0x2219ed['shift']());}};_0x4fb35b(++_0x2c19dd);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x594769,_0x2b3db4){var _0x35fb32=function(_0x907371){while(--_0x907371){_0x594769['push'](_0x594769['shift']());}};_0x35fb32(++_0x2b3db4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 7072ce7..0e8611a 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x23fe8c,_0x2a290e){var _0x223e82=function(_0x7d8d76){while(--_0x7d8d76){_0x23fe8c['push'](_0x23fe8c['shift']());}};_0x223e82(++_0x2a290e);}(_0x3e74,0x175));var _0x43e7=function(_0x56dd96,_0x1a7282){_0x56dd96=_0x56dd96-0x0;var _0x211251=_0x3e74[_0x56dd96];return _0x211251;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x34ab57,_0x271484){var _0x2db892=function(_0x1d2ac9){while(--_0x1d2ac9){_0x34ab57['push'](_0x34ab57['shift']());}};_0x2db892(++_0x271484);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b38f992..8f13618 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(_0x28158f,_0x51146d){var _0x274ae4=function(_0x223e1b){while(--_0x223e1b){_0x28158f['push'](_0x28158f['shift']());}};_0x274ae4(++_0x51146d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x2b56f7,_0x1f2d73){var _0x211c68=function(_0xcd961a){while(--_0xcd961a){_0x2b56f7['push'](_0x2b56f7['shift']());}};_0x211c68(++_0x1f2d73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 bbb4f16..816324a 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 _0x5334=['../client','update','Request','updateWhatsappInteraction'];(function(_0xe920f1,_0x32d8a0){var _0x47c3e7=function(_0x3a1a23){while(--_0x3a1a23){_0xe920f1['push'](_0xe920f1['shift']());}};_0x47c3e7(++_0x32d8a0);}(_0x5334,0x84));var _0x4533=function(_0x5788b1,_0x2d9dae){_0x5788b1=_0x5788b1-0x0;var _0x20ede4=_0x5334[_0x5788b1];return _0x20ede4;};'use strict';var client=require(_0x4533('0x0'));exports[_0x4533('0x1')]=function(_0x6499ca,_0x35fb80){return client[_0x4533('0x2')]('UpdateWhatsappInteraction',{'body':_0x35fb80,'options':{'where':{'id':_0x6499ca}},'log':_0x4533('0x3')});};exports['addTags']=function(_0x42184d,_0x11ce61){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x11ce61,'options':{'where':{'id':_0x42184d}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x363e=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x685289,_0x371776){var _0x1760e3=function(_0x4b9bde){while(--_0x4b9bde){_0x685289['push'](_0x685289['shift']());}};_0x1760e3(++_0x371776);}(_0x363e,0x179));var _0xe363=function(_0x36c4dd,_0x14299e){_0x36c4dd=_0x36c4dd-0x0;var _0x57f0c7=_0x363e[_0x36c4dd];return _0x57f0c7;};'use strict';var client=require(_0xe363('0x0'));exports[_0xe363('0x1')]=function(_0x4c123d,_0x413c54){return client[_0xe363('0x2')](_0xe363('0x3'),{'body':_0x413c54,'options':{'where':{'id':_0x4c123d}},'log':_0xe363('0x4')});};exports[_0xe363('0x5')]=function(_0x3809ea,_0x6e174a){return client[_0xe363('0x2')](_0xe363('0x6'),{'body':_0x6e174a,'options':{'where':{'id':_0x3809ea}},'log':_0xe363('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index ecb4109..3f22711 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 _0xb00e=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x21de2e,_0xb59a6){var _0x396564=function(_0x1a18bd){while(--_0x1a18bd){_0x21de2e['push'](_0x21de2e['shift']());}};_0x396564(++_0xb59a6);}(_0xb00e,0xc9));var _0xeb00=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xb00e[_0x40a825];return _0x273a54;};'use strict';var client=require(_0xeb00('0x0'));exports[_0xeb00('0x1')]=function(_0x1dc6a8){return client[_0xeb00('0x2')](_0xeb00('0x3'),{'body':_0x1dc6a8,'log':_0xeb00('0x4')});}; \ No newline at end of file +var _0xb922=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x364d1c,_0x472c04){var _0x424e48=function(_0x115c36){while(--_0x115c36){_0x364d1c['push'](_0x364d1c['shift']());}};_0x424e48(++_0x472c04);}(_0xb922,0xd9));var _0x2b92=function(_0x5161fc,_0x37c5f6){_0x5161fc=_0x5161fc-0x0;var _0x38490b=_0xb922[_0x5161fc];return _0x38490b;};'use strict';var client=require(_0x2b92('0x0'));exports[_0x2b92('0x1')]=function(_0x39dcf8){return client[_0x2b92('0x2')](_0x2b92('0x3'),{'body':_0x39dcf8,'log':_0x2b92('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index dadb6c4..b3e9d09 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 _0x2fd6=['strategy','User','getWhatsappQueues','../client','GetWhatsappQueue','name','timeout'];(function(_0x14bbdc,_0x1525d5){var _0x329516=function(_0x1fb632){while(--_0x1fb632){_0x14bbdc['push'](_0x14bbdc['shift']());}};_0x329516(++_0x1525d5);}(_0x2fd6,0xab));var _0x62fd=function(_0x1827fd,_0x22367a){_0x1827fd=_0x1827fd-0x0;var _0x3b0fb3=_0x2fd6[_0x1827fd];return _0x3b0fb3;};'use strict';var client=require(_0x62fd('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x62fd('0x1'),{'options':{'raw':![],'attributes':['id',_0x62fd('0x2'),_0x62fd('0x3'),_0x62fd('0x4')],'include':[{'model':_0x62fd('0x5'),'as':'Agents','attributes':['id',_0x62fd('0x2'),'online','whatsappPause']}]},'log':_0x62fd('0x6')});};}; \ No newline at end of file +var _0xa83a=['getWhatsappQueues','Request','name','timeout','strategy','Agents','../client'];(function(_0x566cc5,_0x113c0f){var _0x2fb28c=function(_0x55fad9){while(--_0x55fad9){_0x566cc5['push'](_0x566cc5['shift']());}};_0x2fb28c(++_0x113c0f);}(_0xa83a,0x141));var _0xaa83=function(_0x1578a2,_0x56dfcb){_0x1578a2=_0x1578a2-0x0;var _0x520228=_0xa83a[_0x1578a2];return _0x520228;};'use strict';var client=require(_0xaa83('0x0'));exports[_0xaa83('0x1')]=function(){return function(){return client[_0xaa83('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xaa83('0x3'),_0xaa83('0x4'),_0xaa83('0x5')],'include':[{'model':'User','as':_0xaa83('0x6'),'attributes':['id',_0xaa83('0x3'),'online','whatsappPause']}]},'log':_0xaa83('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1b7fad3..f2cfda1 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 _0x70e2=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x2383bc,_0x2d5ec9){var _0x283573=function(_0x157171){while(--_0x157171){_0x2383bc['push'](_0x2383bc['shift']());}};_0x283573(++_0x2d5ec9);}(_0x70e2,0x122));var _0x270e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x70e2[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x270e('0x0'));exports[_0x270e('0x1')]=function(_0x5c8f31){return client[_0x270e('0x2')](_0x270e('0x3'),{'body':_0x5c8f31,'log':_0x270e('0x3')});};exports[_0x270e('0x4')]=function(_0x46e64a,_0x1c6b02){return client[_0x270e('0x2')](_0x270e('0x5'),{'body':_0x1c6b02,'options':{'where':{'uniqueid':_0x46e64a},'order':[['id',_0x270e('0x6')]],'limit':0x1},'log':_0x270e('0x5')});}; \ No newline at end of file +var _0x8e28=['UpdateWhatsappQueueReport','CreateWhatsappQueueReport','update','Request'];(function(_0x204bf3,_0x10d0f2){var _0x5d8cc8=function(_0x5107ea){while(--_0x5107ea){_0x204bf3['push'](_0x204bf3['shift']());}};_0x5d8cc8(++_0x10d0f2);}(_0x8e28,0x1e9));var _0x88e2=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x8e28[_0x1d24eb];return _0x1dc576;};'use strict';var client=require('../client');exports['create']=function(_0x2ed92b){return client['Request']('CreateWhatsappQueueReport',{'body':_0x2ed92b,'log':_0x88e2('0x0')});};exports[_0x88e2('0x1')]=function(_0x1c6624,_0x39e2ff){return client[_0x88e2('0x2')](_0x88e2('0x3'),{'body':_0x39e2ff,'options':{'where':{'uniqueid':_0x1c6624},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index b6cef2a..2c7c914 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 _0x350f=['seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','map','message','join','stop','find','agents','timeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][QUEUE]\x20%s','stack','validate','lodash','util'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x350f,0x69));var _0xf350=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x350f[_0xce93c];return _0x230720;};'use strict';var schema=require(_0xf350('0x0'));var _=require(_0xf350('0x1'));var util=require(_0xf350('0x2'));var seqqueue=require(_0xf350('0x3'));var logger=require(_0xf350('0x4'))(_0xf350('0x5'));var strategy=require(_0xf350('0x6'));var queue=schema({'name':{'type':_0xf350('0x7'),'required':!![],'message':_0xf350('0x8')},'timeout':{'type':_0xf350('0x9'),'message':_0xf350('0xa')}});function writeLog(_0x2d7f29,_0x1ddc81,_0x14e628){return logger[_0xf350('0xb')](util[_0xf350('0xc')](_0xf350('0xd'),_0x2d7f29,_0x1ddc81[_0xf350('0xe')],_0x14e628));}function handleFindAgent(_0x2d93e8){return function(_0x2fd0d8){return _0x2fd0d8['name'][_0xf350('0xf')]()===_0x2d93e8[_0xf350('0xf')]();};}exports[_0xf350('0x10')]=function(_0x9ccc51,_0x29fb41,_0x27878e,_0x222117){return function(_0x586c6b){try{var _0x3335e3={'name':_0x29fb41[0x0],'timeout':_0x29fb41[0x1]};var _0x3dc46a=queue[_0xf350('0x0')](_0x3335e3,{'typecast':!![]});if(_0x3dc46a['length']){logger['error']('[%s][AGENT]\x20%s',_0x9ccc51,_[_0xf350('0x11')](_0x3dc46a,_0xf350('0x12'))[_0xf350('0x13')](',\x20'));_0x586c6b[_0xf350('0x14')]();}else{var _0x1f9726=_[_0xf350('0x15')](_0x27878e[_0xf350('0x16')],handleFindAgent(_0x3335e3['name']));if(_0x1f9726){var _0x1eaed2=(_0x3335e3[_0xf350('0x17')]||0xa)*0x3e8;var _0x4c1517,_0x13d3e3;var _0x6b2c7=seqqueue['createQueue'](_0x1eaed2);_0x6b2c7['id']=_0x9ccc51;_0x6b2c7['atimeout']=_0x1eaed2;_0x6b2c7[_0xf350('0x18')]=_0x222117[_0xf350('0x18')];writeLog(_0x9ccc51,_0x1f9726,util[_0xf350('0xc')](_0xf350('0x19'),_0x1eaed2));_0x27878e[_0xf350('0x1a')][_0x9ccc51]['on']('end',function(){logger['info'](_0xf350('0x1b'),_0x9ccc51);clearTimeout(_0x13d3e3);_0x13d3e3=undefined;_0x6b2c7[_0xf350('0x1c')]();if(_0x27878e[_0xf350('0x1a')][_0x9ccc51]){delete _0x27878e[_0xf350('0x1a')][_0x9ccc51];}_0x586c6b[_0xf350('0x14')]();});_0x27878e[_0xf350('0x1a')][_0x9ccc51]['on'](_0xf350('0x1d'),function(){if(_0x27878e[_0xf350('0x1a')][_0x9ccc51]){delete _0x27878e[_0xf350('0x1a')][_0x9ccc51];}});_0x13d3e3=setTimeout(function(){logger[_0xf350('0xb')](_0xf350('0x1e'),_0x9ccc51);clearTimeout(_0x13d3e3);_0x6b2c7['close']();_0x586c6b[_0xf350('0x1f')]();},_0x1eaed2);strategy[_0xf350('0x20')](_0x6b2c7,_0x1f9726,_0x27878e,_0x222117);}else{logger[_0xf350('0x21')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x9ccc51,_0x3335e3[_0xf350('0xe')]);_0x586c6b[_0xf350('0x14')]();}}}catch(_0xfb56cf){console['log'](_0xfb56cf);logger[_0xf350('0x21')](_0xf350('0x22'),_0x9ccc51,_0xfb56cf[_0xf350('0x23')]);_0x586c6b['stop']();}};}; \ No newline at end of file +var _0x15fd=['toLowerCase','consequence','validate','length','error','map','message','stop','agents','createQueue','atimeout','channel','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x11fc8b,_0x4ee51d){var _0x4ea86e=function(_0x50e5bf){while(--_0x50e5bf){_0x11fc8b['push'](_0x11fc8b['shift']());}};_0x4ea86e(++_0x4ee51d);}(_0x15fd,0x95));var _0xd15f=function(_0x3e2b6f,_0x86352e){_0x3e2b6f=_0x3e2b6f-0x0;var _0xcfb042=_0x15fd[_0x3e2b6f];return _0xcfb042;};'use strict';var schema=require('validate');var _=require(_0xd15f('0x0'));var util=require('util');var seqqueue=require(_0xd15f('0x1'));var logger=require(_0xd15f('0x2'))(_0xd15f('0x3'));var strategy=require(_0xd15f('0x4'));var queue=schema({'name':{'type':_0xd15f('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xd15f('0x6'),'message':_0xd15f('0x7')}});function writeLog(_0x35df34,_0x477f0f,_0x8ca739){return logger[_0xd15f('0x8')](util['format'](_0xd15f('0x9'),_0x35df34,_0x477f0f[_0xd15f('0xa')],_0x8ca739));}function handleFindAgent(_0x1ba55e){return function(_0x44b7c0){return _0x44b7c0[_0xd15f('0xa')][_0xd15f('0xb')]()===_0x1ba55e[_0xd15f('0xb')]();};}exports[_0xd15f('0xc')]=function(_0x231041,_0x30af0b,_0x25176c,_0x3fc6fe){return function(_0x4328d1){try{var _0x3f94bb={'name':_0x30af0b[0x0],'timeout':_0x30af0b[0x1]};var _0x1e143e=queue[_0xd15f('0xd')](_0x3f94bb,{'typecast':!![]});if(_0x1e143e[_0xd15f('0xe')]){logger[_0xd15f('0xf')]('[%s][AGENT]\x20%s',_0x231041,_[_0xd15f('0x10')](_0x1e143e,_0xd15f('0x11'))['join'](',\x20'));_0x4328d1[_0xd15f('0x12')]();}else{var _0xfd3ae1=_['find'](_0x25176c[_0xd15f('0x13')],handleFindAgent(_0x3f94bb[_0xd15f('0xa')]));if(_0xfd3ae1){var _0x49e6ed=(_0x3f94bb['timeout']||0xa)*0x3e8;var _0x398044,_0x29056c;var _0x57a168=seqqueue[_0xd15f('0x14')](_0x49e6ed);_0x57a168['id']=_0x231041;_0x57a168[_0xd15f('0x15')]=_0x49e6ed;_0x57a168[_0xd15f('0x16')]=_0x3fc6fe[_0xd15f('0x16')];writeLog(_0x231041,_0xfd3ae1,util['format']('START:%s',_0x49e6ed));_0x25176c['rules'][_0x231041]['on'](_0xd15f('0x17'),function(){logger['info'](_0xd15f('0x18'),_0x231041);clearTimeout(_0x29056c);_0x29056c=undefined;_0x57a168['close']();if(_0x25176c[_0xd15f('0x19')][_0x231041]){delete _0x25176c[_0xd15f('0x19')][_0x231041];}_0x4328d1[_0xd15f('0x12')]();});_0x25176c[_0xd15f('0x19')][_0x231041]['on']('complete',function(){if(_0x25176c[_0xd15f('0x19')][_0x231041]){delete _0x25176c[_0xd15f('0x19')][_0x231041];}});_0x29056c=setTimeout(function(){logger[_0xd15f('0x8')](_0xd15f('0x1a'),_0x231041);clearTimeout(_0x29056c);_0x57a168[_0xd15f('0x1b')]();_0x4328d1[_0xd15f('0x1c')]();},_0x49e6ed);strategy[_0xd15f('0x1d')](_0x57a168,_0xfd3ae1,_0x25176c,_0x3fc6fe);}else{logger[_0xd15f('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x231041,_0x3f94bb[_0xd15f('0xa')]);_0x4328d1[_0xd15f('0x12')]();}}}catch(_0x5bd988){console['log'](_0x5bd988);logger[_0xd15f('0xf')](_0xd15f('0x1e'),_0x231041,_0x5bd988[_0xd15f('0x1f')]);_0x4328d1['stop']();}};}; \ 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 5905de9..0efc21e 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 _0xc0b0=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','postText','message','providerResponse','dialogState','stop','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','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','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','Message','then','body','error','stringify','finally'];(function(_0x147a24,_0x1f7400){var _0x14506b=function(_0x421767){while(--_0x421767){_0x147a24['push'](_0x147a24['shift']());}};_0x14506b(++_0x1f7400);}(_0xc0b0,0xf5));var _0x0c0b=function(_0x469dd8,_0x5a948e){_0x469dd8=_0x469dd8-0x0;var _0x3aed1f=_0xc0b0[_0x469dd8];return _0x3aed1f;};'use strict';var _=require(_0x0c0b('0x0'));var moment=require(_0x0c0b('0x1'));var AWS=require(_0x0c0b('0x2'));var utils=require(_0x0c0b('0x3'));var logger=require(_0x0c0b('0x4'))(_0x0c0b('0x5'));var rpc={'chatMessage':require(_0x0c0b('0x6')),'openchannelMessage':require(_0x0c0b('0x7')),'mailMessage':require(_0x0c0b('0x8')),'smsMessage':require(_0x0c0b('0x9')),'faxMessage':require(_0x0c0b('0xa')),'whatsappMessage':require(_0x0c0b('0xb'))};exports['consequence']=function(_0x43abef,_0x5b3254){return function(_0x3b48ef){try{if(!_['isNil'](this[_0x0c0b('0xc')][_0x0c0b('0xd')])){logger[_0x0c0b('0xe')](_0x0c0b('0xf'),_0x43abef,_0x0c0b('0x10'));return _0x3b48ef[_0x0c0b('0x11')]();}var _0x3d56b0={'ContactId':this[_0x0c0b('0x12')]['id'],'sentAt':moment()[_0x0c0b('0x13')](_0x0c0b('0x14')),'direction':'out'};if(this[_0x0c0b('0x15')]===_0x0c0b('0x16')||this[_0x0c0b('0x15')]==='whatsapp'){_0x3d56b0['phone']=this[_0x0c0b('0xc')][_0x0c0b('0x17')];}var _0x1ba3f4=this[_0x0c0b('0x15')];if(_0x1ba3f4==='chat'){_0x3d56b0[_0x0c0b('0x18')]=this[_0x0c0b('0x19')]['id'];}else{_0x3d56b0[_[_0x0c0b('0x1a')](_0x1ba3f4)+_0x0c0b('0x1b')]=this['account']['id'];}_0x3d56b0[_[_0x0c0b('0x1a')](_0x1ba3f4)+_0x0c0b('0x1c')]=this[_0x0c0b('0xc')]['id'];if(this['interaction'][_0x0c0b('0x1d')]){var _0x185327=_0x5b3254[0x4];if(!_[_0x0c0b('0x1e')](_0x185327)){_0x3d56b0['body']=utils['getMustacheRender'](_0x185327,this);return rpc[_0x1ba3f4+_0x0c0b('0x1f')]['create'](_0x3d56b0)[_0x0c0b('0x20')](function(_0xd995ed){logger[_0x0c0b('0xe')](_0x0c0b('0xf'),_0x43abef,_0x3d56b0[_0x0c0b('0x21')]);})['catch'](function(_0xf4a157){logger[_0x0c0b('0x22')](_0x0c0b('0xf'),_0x43abef,JSON[_0x0c0b('0x23')](_0xf4a157));})[_0x0c0b('0x24')](function(){logger['info'](_0x0c0b('0x25'),_0x43abef);_0x3b48ef['stop']();});}else{logger[_0x0c0b('0xe')](_0x0c0b('0x26'),_0x43abef);_0x3b48ef['stop']();}}else{var _0x4cf2a1=this;var _0x41f432=new AWS[(_0x0c0b('0x27'))]({'accessKeyId':_0x5b3254[0x0],'secretAccessKey':_0x5b3254[0x1],'region':_0x5b3254[0x2]});var _0x11ebbb={'botAlias':'$LATEST','botName':_0x5b3254[0x3],'inputText':this['message'][_0x0c0b('0x21')],'userId':this[_0x0c0b('0x15')]+':'+this[_0x0c0b('0xc')]['id'][_0x0c0b('0x28')]()};_0x41f432[_0x0c0b('0x29')](_0x11ebbb,function(_0x11b8e6,_0x214c67){if(_0x11b8e6){logger['error'](_0x0c0b('0xf'),_0x43abef,_0x11b8e6[_0x0c0b('0x2a')]);_0x3b48ef[_0x0c0b('0x11')]();}else if(_0x214c67&&_0x214c67[_0x0c0b('0x2a')]){_0x4cf2a1[_0x0c0b('0x21')]['amazonlex']=_0x214c67;_0x3d56b0[_0x0c0b('0x21')]=_0x214c67[_0x0c0b('0x2a')];_0x3d56b0['providerName']='amazonlex';_0x3d56b0[_0x0c0b('0x2b')]=JSON[_0x0c0b('0x23')](_0x214c67);return rpc[_0x1ba3f4+_0x0c0b('0x1f')]['create'](_0x3d56b0)[_0x0c0b('0x20')](function(_0x37f7a8){logger[_0x0c0b('0xe')](_0x0c0b('0xf'),_0x43abef,_0x3d56b0['body']);if(_0x214c67[_0x0c0b('0x2c')]=='Failed'){_0x3b48ef[_0x0c0b('0x11')]();}else{_0x3b48ef[_0x0c0b('0x2d')]();}})[_0x0c0b('0x2e')](function(_0x96f540){logger['error'](_0x0c0b('0xf'),_0x43abef,JSON[_0x0c0b('0x23')](_0x96f540));_0x3b48ef[_0x0c0b('0x11')]();});}else{_0x3b48ef[_0x0c0b('0x11')]();}});}}catch(_0x34e568){logger[_0x0c0b('0x22')](_0x0c0b('0xf'),_0x43abef,JSON[_0x0c0b('0x23')](_0x34e568));_0x3b48ef['stop']();}};}; \ No newline at end of file +var _0x6ff0=['then','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','error','next','providerName','amazonlex','providerResponse','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create'];(function(_0x25c03e,_0xc6224d){var _0x1b121b=function(_0x5061c4){while(--_0x5061c4){_0x25c03e['push'](_0x25c03e['shift']());}};_0x1b121b(++_0xc6224d);}(_0x6ff0,0x9a));var _0x06ff=function(_0x3d7fb5,_0x16eb5c){_0x3d7fb5=_0x3d7fb5-0x0;var _0x3a9642=_0x6ff0[_0x3d7fb5];return _0x3a9642;};'use strict';var _=require(_0x06ff('0x0'));var moment=require(_0x06ff('0x1'));var AWS=require(_0x06ff('0x2'));var utils=require(_0x06ff('0x3'));var logger=require(_0x06ff('0x4'))(_0x06ff('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x06ff('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x06ff('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x06ff('0x8'))};exports['consequence']=function(_0x22fd3,_0x58fa7f){return function(_0x4ad272){try{if(!_[_0x06ff('0x9')](this[_0x06ff('0xa')]['UserId'])){logger[_0x06ff('0xb')](_0x06ff('0xc'),_0x22fd3,_0x06ff('0xd'));return _0x4ad272['next']();}var _0x1f3a82={'ContactId':this[_0x06ff('0xe')]['id'],'sentAt':moment()['format'](_0x06ff('0xf')),'direction':'out'};if(this[_0x06ff('0x10')]===_0x06ff('0x11')||this['channel']==='whatsapp'){_0x1f3a82[_0x06ff('0x12')]=this[_0x06ff('0xa')][_0x06ff('0x12')];}var _0x503536=this[_0x06ff('0x10')];if(_0x503536===_0x06ff('0x13')){_0x1f3a82[_0x06ff('0x14')]=this[_0x06ff('0x15')]['id'];}else{_0x1f3a82[_[_0x06ff('0x16')](_0x503536)+_0x06ff('0x17')]=this['account']['id'];}_0x1f3a82[_[_0x06ff('0x16')](_0x503536)+_0x06ff('0x18')]=this[_0x06ff('0xa')]['id'];if(this[_0x06ff('0xa')][_0x06ff('0x19')]){var _0x639b61=_0x58fa7f[0x4];if(!_[_0x06ff('0x1a')](_0x639b61)){_0x1f3a82[_0x06ff('0x1b')]=utils['getMustacheRender'](_0x639b61,this);return rpc[_0x503536+_0x06ff('0x1c')][_0x06ff('0x1d')](_0x1f3a82)[_0x06ff('0x1e')](function(_0x30a570){logger[_0x06ff('0xb')]('[%s][AMAZONLEX]\x20%s',_0x22fd3,_0x1f3a82[_0x06ff('0x1b')]);})[_0x06ff('0x1f')](function(_0x3becd7){logger['error']('[%s][AMAZONLEX]\x20%s',_0x22fd3,JSON[_0x06ff('0x20')](_0x3becd7));})[_0x06ff('0x21')](function(){logger[_0x06ff('0xb')](_0x06ff('0x22'),_0x22fd3);_0x4ad272[_0x06ff('0x23')]();});}else{logger[_0x06ff('0xb')](_0x06ff('0x24'),_0x22fd3);_0x4ad272[_0x06ff('0x23')]();}}else{var _0x25e784=this;var _0x37802b=new AWS['LexRuntime']({'accessKeyId':_0x58fa7f[0x0],'secretAccessKey':_0x58fa7f[0x1],'region':_0x58fa7f[0x2]});var _0x259f80={'botAlias':_0x06ff('0x25'),'botName':_0x58fa7f[0x3],'inputText':this[_0x06ff('0x26')][_0x06ff('0x1b')],'userId':this[_0x06ff('0x10')]+':'+this[_0x06ff('0xa')]['id']['toString']()};_0x37802b[_0x06ff('0x27')](_0x259f80,function(_0x3b3109,_0x4d4552){if(_0x3b3109){logger[_0x06ff('0x28')]('[%s][AMAZONLEX]\x20%s',_0x22fd3,_0x3b3109[_0x06ff('0x26')]);_0x4ad272[_0x06ff('0x29')]();}else if(_0x4d4552&&_0x4d4552[_0x06ff('0x26')]){_0x25e784[_0x06ff('0x1b')]['amazonlex']=_0x4d4552;_0x1f3a82['body']=_0x4d4552[_0x06ff('0x26')];_0x1f3a82[_0x06ff('0x2a')]=_0x06ff('0x2b');_0x1f3a82[_0x06ff('0x2c')]=JSON['stringify'](_0x4d4552);return rpc[_0x503536+'Message'][_0x06ff('0x1d')](_0x1f3a82)[_0x06ff('0x1e')](function(_0x5d20fe){logger[_0x06ff('0xb')](_0x06ff('0xc'),_0x22fd3,_0x1f3a82[_0x06ff('0x1b')]);if(_0x4d4552['dialogState']==_0x06ff('0x2d')){_0x4ad272['next']();}else{_0x4ad272['stop']();}})[_0x06ff('0x1f')](function(_0x512eb3){logger[_0x06ff('0x28')](_0x06ff('0xc'),_0x22fd3,JSON['stringify'](_0x512eb3));_0x4ad272[_0x06ff('0x29')]();});}else{_0x4ad272[_0x06ff('0x29')]();}});}}catch(_0x5e0a07){logger[_0x06ff('0x28')](_0x06ff('0xc'),_0x22fd3,JSON['stringify'](_0x5e0a07));_0x4ad272[_0x06ff('0x23')]();}};}; \ 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 f6ff84e..3b5cd59 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 _0xcf94=['headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','update','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','out','getMustacheRender','message','from','mail','phone','read','subject','startsWith','Re:','chat','account','upperFirst','InteractionId','messageId','html','','replace',''];(function(_0x29548c,_0x21279f){var _0x3f6b63=function(_0xaf6c20){while(--_0xaf6c20){_0x29548c['push'](_0x29548c['shift']());}};_0x3f6b63(++_0x21279f);}(_0xcf94,0x153));var _0x4cf9=function(_0x397505,_0xbc7afa){_0x397505=_0x397505-0x0;var _0x5e525e=_0xcf94[_0x397505];return _0x5e525e;};'use strict';var _=require(_0x4cf9('0x0'));var moment=require(_0x4cf9('0x1'));var utils=require(_0x4cf9('0x2'));var logger=require(_0x4cf9('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4cf9('0x4')),'smsMessage':require(_0x4cf9('0x5')),'faxMessage':require(_0x4cf9('0x6')),'whatsappMessage':require(_0x4cf9('0x7')),'chatInteraction':require(_0x4cf9('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x4cf9('0x9')),'smsInteraction':require(_0x4cf9('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4cf9('0xb'))};var mailRpc=require(_0x4cf9('0xc'));exports['consequence']=function(_0xde1cff,_0x1decff,_0x2902bb,_0x186b7a){return function(_0x33b25b){try{var _0x55fa32=this[_0x4cf9('0xd')];if(_0x55fa32==='mail'&&_0x186b7a[_0x4cf9('0xe')][_0x4cf9('0xf')]){logger[_0x4cf9('0x10')](_0x4cf9('0x11'),_0xde1cff,_0x4cf9('0x12'));return _0x33b25b[_0x4cf9('0x13')]();}if(_0x1decff[0x0]==='1'&&(_['isNil'](this[_0x4cf9('0x14')][_0x4cf9('0x15')])||!this[_0x4cf9('0x14')][_0x4cf9('0x15')])){logger['info'](_0x4cf9('0x11'),_0xde1cff,_0x4cf9('0x16'));return _0x33b25b[_0x4cf9('0x13')]();}if(_0x1decff[0x0]==='2'&&this[_0x4cf9('0x14')][_0x4cf9('0x17')]){logger[_0x4cf9('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xde1cff,'One\x20Time\x20already\x20sent');return _0x33b25b[_0x4cf9('0x13')]();}var _0x1fdb57={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4cf9('0x18')};if(this['channel']==='mail'){_0x1fdb57['body']=utils[_0x4cf9('0x19')](_0x1decff[0x2],this);}else{_0x1fdb57[_0x4cf9('0xe')]=utils[_0x4cf9('0x19')](_0x1decff[0x1],this);}if(this['message']){_0x1fdb57['to']=this[_0x4cf9('0x1a')][_0x4cf9('0x1b')]||'';if(this['channel']===_0x4cf9('0x1c')&&_0x1decff[0x1]==='1'){_0x1fdb57['cc']=this[_0x4cf9('0x1a')]['cc']||'';}_0x1fdb57['from']=this['message']['to']||'';_0x1fdb57[_0x4cf9('0x1d')]=this[_0x4cf9('0x1a')][_0x4cf9('0x1d')]||'';_0x1fdb57[_0x4cf9('0x1e')]=!![];if(this[_0x4cf9('0x1a')][_0x4cf9('0x1f')]){_0x1fdb57[_0x4cf9('0x1f')]='';_0x1fdb57[_0x4cf9('0x1f')]+=_[_0x4cf9('0x20')](this['message'][_0x4cf9('0x1f')],_0x4cf9('0x21'))?'':'Re:\x20';_0x1fdb57[_0x4cf9('0x1f')]+=this[_0x4cf9('0x1a')][_0x4cf9('0x1f')];}}if(this[_0x4cf9('0xd')]===_0x4cf9('0x22')){_0x1fdb57['ChatWebsiteId']=this[_0x4cf9('0x23')]['id'];}else{_0x1fdb57[_[_0x4cf9('0x24')](this['channel'])+'AccountId']=this[_0x4cf9('0x23')]['id'];}_0x1fdb57[_[_0x4cf9('0x24')](this[_0x4cf9('0xd')])+_0x4cf9('0x25')]=this['interaction']['id'];var _0xb069f=this[_0x4cf9('0x14')];if(rpc[this[_0x4cf9('0xd')]+'Message']){if(this['channel']===_0x4cf9('0x1c')){_0x1fdb57['inReplyTo']=this[_0x4cf9('0x1a')][_0x4cf9('0x26')];_0x1fdb57[_0x4cf9('0x27')]=_0x4cf9('0x28')+_[_0x4cf9('0x29')](_0x1fdb57[_0x4cf9('0xe')],_0x4cf9('0x2a'),_0x4cf9('0x2b'))+_0x4cf9('0x2c');_0x1fdb57[_0x4cf9('0x2d')]={'Auto-Submitted':_0x4cf9('0x2e'),'X-Auto-Response-Suppress':_0x4cf9('0x2f'),'Precedence':_0x4cf9('0x30')};return mailRpc[_0x4cf9('0x31')](this[_0x4cf9('0x23')]['smtpOptions'],_0x1fdb57)[_0x4cf9('0x32')](function(_0x301388){logger[_0x4cf9('0x10')](_0x4cf9('0x33'),_0xde1cff);_0x1fdb57[_0x4cf9('0x26')]=_0x301388[_0x4cf9('0x1a')][_0x4cf9('0x26')];return rpc[_0x55fa32+_0x4cf9('0x34')][_0x4cf9('0x35')](_0x1fdb57);})[_0x4cf9('0x32')](function(_0x4cf9a5){logger['info'](_0x4cf9('0x11'),_0xde1cff,JSON[_0x4cf9('0x36')](_0x4cf9a5));})[_0x4cf9('0x37')](function(_0x60a48b){logger[_0x4cf9('0x38')](_0x4cf9('0x39'),_0xde1cff,JSON['stringify'](_0x60a48b));})['finally'](function(){Promise[_0x4cf9('0x3a')]()['then'](function(){if(_0x1decff[0x0]!=='2'||_0xb069f[_0x4cf9('0x17')])return;return rpc[_0x55fa32+'Interaction']['update'](_0xb069f['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4c5c82){logger[_0x4cf9('0x10')](_0x4cf9('0x3b'),_0xde1cff,JSON[_0x4cf9('0x36')](_0x4c5c82));})[_0x4cf9('0x37')](function(_0x3c2bbc){logger[_0x4cf9('0x38')](_0x4cf9('0x3c'),_0xde1cff,JSON[_0x4cf9('0x36')](_0x3c2bbc));});})['then'](function(){_0x33b25b[_0x4cf9('0x13')]();});});}else{return rpc[this['channel']+_0x4cf9('0x34')][_0x4cf9('0x35')](_0x1fdb57)[_0x4cf9('0x32')](function(){logger[_0x4cf9('0x10')]('[%s][AUTOREPLY]\x20%s',_0xde1cff,_0x1fdb57[_0x4cf9('0xe')]);})[_0x4cf9('0x37')](function(_0x57fc2a){logger[_0x4cf9('0x38')](_0x4cf9('0x11'),_0xde1cff,JSON[_0x4cf9('0x36')](_0x57fc2a));})[_0x4cf9('0x3d')](function(){Promise[_0x4cf9('0x3a')]()[_0x4cf9('0x32')](function(){if(_0x1decff[0x0]!=='2'||_0xb069f[_0x4cf9('0x17')])return;return rpc[_0x55fa32+'Interaction'][_0x4cf9('0x3e')](_0xb069f['id'],{'autoreplyExecuted':!![]})[_0x4cf9('0x32')](function(_0x2c9cb3){logger[_0x4cf9('0x10')](_0x4cf9('0x3b'),_0xde1cff,JSON[_0x4cf9('0x36')](_0x2c9cb3));})[_0x4cf9('0x37')](function(_0x17c9b9){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xde1cff,JSON[_0x4cf9('0x36')](_0x17c9b9));});})[_0x4cf9('0x32')](function(){_0x33b25b[_0x4cf9('0x13')]();});});}}}catch(_0x452475){logger[_0x4cf9('0x38')]('[%s][AUTOREPLY]\x20%s',_0xde1cff,JSON[_0x4cf9('0x36')](_0x452475));_0x33b25b[_0x4cf9('0x3f')]();}};}; \ No newline at end of file +var _0xb54f=['','auto-replied','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','stop','lodash','moment','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','InteractionId','messageId','html'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0xb54f,0x15d));var _0xfb54=function(_0x5c3aef,_0x49c416){_0x5c3aef=_0x5c3aef-0x0;var _0x31c40f=_0xb54f[_0x5c3aef];return _0x31c40f;};'use strict';var _=require(_0xfb54('0x0'));var moment=require(_0xfb54('0x1'));var utils=require('./utils');var logger=require(_0xfb54('0x2'))(_0xfb54('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xfb54('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfb54('0x5')),'chatInteraction':require(_0xfb54('0x6')),'openchannelInteraction':require(_0xfb54('0x7')),'mailInteraction':require(_0xfb54('0x8')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xfb54('0x9')),'whatsappInteraction':require(_0xfb54('0xa'))};var mailRpc=require(_0xfb54('0xb'));exports[_0xfb54('0xc')]=function(_0x4a5184,_0x43f64b,_0x3d14eb,_0x27e0e1){return function(_0x416eba){try{var _0x13e2a7=this[_0xfb54('0xd')];if(_0x13e2a7===_0xfb54('0xe')&&_0x27e0e1[_0xfb54('0xf')][_0xfb54('0x10')]){logger['info'](_0xfb54('0x11'),_0x4a5184,_0xfb54('0x12'));return _0x416eba['next']();}if(_0x43f64b[0x0]==='1'&&(_[_0xfb54('0x13')](this[_0xfb54('0x14')][_0xfb54('0x15')])||!this[_0xfb54('0x14')][_0xfb54('0x15')])){logger[_0xfb54('0x16')](_0xfb54('0x11'),_0x4a5184,_0xfb54('0x17'));return _0x416eba[_0xfb54('0x18')]();}if(_0x43f64b[0x0]==='2'&&this['interaction'][_0xfb54('0x19')]){logger[_0xfb54('0x16')](_0xfb54('0x1a'),_0x4a5184,_0xfb54('0x1b'));return _0x416eba['next']();}var _0xacd9f1={'ContactId':this[_0xfb54('0x1c')]['id'],'sentAt':moment()[_0xfb54('0x1d')](_0xfb54('0x1e')),'direction':_0xfb54('0x1f')};if(this[_0xfb54('0xd')]===_0xfb54('0xe')){_0xacd9f1['body']=utils[_0xfb54('0x20')](_0x43f64b[0x2],this);}else{_0xacd9f1[_0xfb54('0xf')]=utils[_0xfb54('0x20')](_0x43f64b[0x1],this);}if(this[_0xfb54('0x21')]){_0xacd9f1['to']=this[_0xfb54('0x21')]['from']||'';if(this['channel']===_0xfb54('0xe')&&_0x43f64b[0x1]==='1'){_0xacd9f1['cc']=this[_0xfb54('0x21')]['cc']||'';}_0xacd9f1[_0xfb54('0x22')]=this[_0xfb54('0x21')]['to']||'';_0xacd9f1[_0xfb54('0x23')]=this[_0xfb54('0x21')][_0xfb54('0x23')]||'';_0xacd9f1[_0xfb54('0x24')]=!![];if(this['message'][_0xfb54('0x25')]){_0xacd9f1[_0xfb54('0x25')]='';_0xacd9f1[_0xfb54('0x25')]+=_[_0xfb54('0x26')](this[_0xfb54('0x21')][_0xfb54('0x25')],_0xfb54('0x27'))?'':_0xfb54('0x28');_0xacd9f1[_0xfb54('0x25')]+=this[_0xfb54('0x21')]['subject'];}}if(this[_0xfb54('0xd')]==='chat'){_0xacd9f1['ChatWebsiteId']=this[_0xfb54('0x29')]['id'];}else{_0xacd9f1[_[_0xfb54('0x2a')](this['channel'])+_0xfb54('0x2b')]=this[_0xfb54('0x29')]['id'];}_0xacd9f1[_[_0xfb54('0x2a')](this[_0xfb54('0xd')])+_0xfb54('0x2c')]=this[_0xfb54('0x14')]['id'];var _0xae7bb1=this['interaction'];if(rpc[this[_0xfb54('0xd')]+'Message']){if(this['channel']==='mail'){_0xacd9f1['inReplyTo']=this[_0xfb54('0x21')][_0xfb54('0x2d')];_0xacd9f1[_0xfb54('0x2e')]=''+_['replace'](_0xacd9f1[_0xfb54('0xf')],']+(>|$)/g,''),'priorityTrue':_0x432237[0x1],'priorityFalse':_0x432237[0x2]};var _0xa87734=gotoif[_0x9ddc('0x9')](_0x337e4c,{'typecast':!![]});if(_0xa87734[_0x9ddc('0xa')]){logger[_0x9ddc('0xb')]('[%s][GOTOIF]\x20%s',_0x390a2c,_[_0x9ddc('0xc')](_0xa87734,'message')[_0x9ddc('0xd')](',\x20'));_0x3b857a[_0x9ddc('0xe')]();}else{try{var _0x333eeb=eval('('+_0x337e4c[_0x9ddc('0xf')]+')');var _0x2ac7a4=_0x333eeb?_0x337e4c[_0x9ddc('0x10')]:_0x337e4c[_0x9ddc('0x11')];logger[_0x9ddc('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x390a2c,_0x337e4c[_0x9ddc('0xf')],_0x333eeb,_0x2ac7a4||'next');if(_0x2ac7a4){var _0x1b8ec0=_['findIndex'](_0x3b857a[_0x9ddc('0x13')](),{'p':_0x2ac7a4});if(_0x1b8ec0>=0x0){logger[_0x9ddc('0x12')](_0x9ddc('0x14'),_0x390a2c,_0x2ac7a4||'next',_0x1b8ec0);_0x3b857a['next'](_0x1b8ec0);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x390a2c,_0x2ac7a4||_0x9ddc('0x15'));_0x3b857a[_0x9ddc('0xe')]();}}else{_0x3b857a[_0x9ddc('0x15')]();}}catch(_0x5bddd3){logger[_0x9ddc('0xb')](_0x9ddc('0x16'),_0x390a2c,_0x5bddd3[_0x9ddc('0x17')]);_0x3b857a[_0x9ddc('0xe')]();}}}catch(_0x31bb1a){logger['error'](_0x9ddc('0x18'),_0x390a2c,JSON['stringify'](_0x31bb1a));_0x3b857a['stop']();}};}; \ No newline at end of file +var _0x22a6=['[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x3b31b4,_0x3c8483){var _0x117f7f=function(_0xe98958){while(--_0xe98958){_0x3b31b4['push'](_0x3b31b4['shift']());}};_0x117f7f(++_0x3c8483);}(_0x22a6,0x1f0));var _0x622a=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x22a6[_0x31b5a5];return _0x364cc9;};'use strict';var schema=require(_0x622a('0x0'));var _=require(_0x622a('0x1'));var htmlToText=require(_0x622a('0x2'));var utils=require(_0x622a('0x3'));var logger=require(_0x622a('0x4'))('routing');var gotoif=schema({'condition':{'type':_0x622a('0x5'),'required':!![],'message':_0x622a('0x6')},'priorityTrue':{'type':_0x622a('0x7'),'message':_0x622a('0x8')},'priorityFalse':{'type':_0x622a('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x622a('0x9')]=function(_0x449455,_0xae810a){return function(_0x5352de){try{var _0x286e60={'condition':htmlToText['fromString'](utils[_0x622a('0xa')](_0xae810a[0x0],this),{'wordwrap':![]})[_0x622a('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xae810a[0x1],'priorityFalse':_0xae810a[0x2]};var _0x258a74=gotoif[_0x622a('0x0')](_0x286e60,{'typecast':!![]});if(_0x258a74[_0x622a('0xc')]){logger['error'](_0x622a('0xd'),_0x449455,_['map'](_0x258a74,_0x622a('0xe'))[_0x622a('0xf')](',\x20'));_0x5352de[_0x622a('0x10')]();}else{try{var _0x528981=eval('('+_0x286e60[_0x622a('0x11')]+')');var _0x5d8073=_0x528981?_0x286e60['priorityTrue']:_0x286e60[_0x622a('0x12')];logger[_0x622a('0x13')](_0x622a('0x14'),_0x449455,_0x286e60['condition'],_0x528981,_0x5d8073||_0x622a('0x15'));if(_0x5d8073){var _0x47f29d=_[_0x622a('0x16')](_0x5352de['rules'](),{'p':_0x5d8073});if(_0x47f29d>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x449455,_0x5d8073||_0x622a('0x15'),_0x47f29d);_0x5352de[_0x622a('0x15')](_0x47f29d);}else{logger[_0x622a('0x13')](_0x622a('0x17'),_0x449455,_0x5d8073||_0x622a('0x15'));_0x5352de[_0x622a('0x10')]();}}else{_0x5352de['next']();}}catch(_0x34c7c1){logger['error'](_0x622a('0x18'),_0x449455,_0x34c7c1['message']);_0x5352de[_0x622a('0x10')]();}}}catch(_0x3bcd70){logger['error']('[%s][GOTOIF]\x20%s',_0x449455,JSON[_0x622a('0x19')](_0x3bcd70));_0x5352de[_0x622a('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index c830d46..095e5bd 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 _0xbde8=['info','priority','findIndex','next','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','message','join','stop'];(function(_0x24cc72,_0x4dc73a){var _0xd49f1e=function(_0x39f581){while(--_0x39f581){_0x24cc72['push'](_0x24cc72['shift']());}};_0xd49f1e(++_0x4dc73a);}(_0xbde8,0x155));var _0x8bde=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0xbde8[_0x154cb5];return _0x3f574f;};'use strict';var schema=require(_0x8bde('0x0'));var _=require(_0x8bde('0x1'));var logger=require('../../../../config/logger')(_0x8bde('0x2'));var gotop=schema({'priority':{'type':_0x8bde('0x3'),'required':!![],'message':_0x8bde('0x4')}});exports['consequence']=function(_0x34bdad,_0x235330){return function(_0x1e3137){try{var _0x44dca8={'priority':_0x235330[0x0]};var _0xf08804=gotop[_0x8bde('0x0')](_0x44dca8,{'typecast':!![]});if(_0xf08804[_0x8bde('0x5')]){logger[_0x8bde('0x6')](_0x8bde('0x7'),_0x34bdad,_['map'](_0xf08804,_0x8bde('0x8'))[_0x8bde('0x9')](',\x20'));_0x1e3137[_0x8bde('0xa')]();}else{logger[_0x8bde('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x34bdad,_0x44dca8[_0x8bde('0xc')]);if(_0x44dca8[_0x8bde('0xc')]){var _0x8a02d9=_[_0x8bde('0xd')](_0x1e3137['rules'](),{'p':_0x44dca8[_0x8bde('0xc')]});if(_0x8a02d9>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x34bdad,_0x44dca8[_0x8bde('0xc')]||'next',_0x8a02d9);_0x1e3137['next'](_0x8a02d9);}else{logger[_0x8bde('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x34bdad,_0x44dca8[_0x8bde('0xc')]||_0x8bde('0xe'));_0x1e3137[_0x8bde('0xa')]();}}else{_0x1e3137[_0x8bde('0xe')]();}}}catch(_0x536df9){logger[_0x8bde('0x6')](_0x8bde('0x7'),_0x34bdad,JSON[_0x8bde('0xf')](_0x536df9));_0x1e3137[_0x8bde('0xa')]();}};}; \ No newline at end of file +var _0x9d62=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x1366dc,_0x2b388a){var _0x456536=function(_0x28608d){while(--_0x28608d){_0x1366dc['push'](_0x1366dc['shift']());}};_0x456536(++_0x2b388a);}(_0x9d62,0xaa));var _0x29d6=function(_0x27db25,_0x227097){_0x27db25=_0x27db25-0x0;var _0x1aa43f=_0x9d62[_0x27db25];return _0x1aa43f;};'use strict';var schema=require(_0x29d6('0x0'));var _=require('lodash');var logger=require(_0x29d6('0x1'))(_0x29d6('0x2'));var gotop=schema({'priority':{'type':_0x29d6('0x3'),'required':!![],'message':_0x29d6('0x4')}});exports[_0x29d6('0x5')]=function(_0x1c1810,_0x3fdd30){return function(_0x73aff){try{var _0x3856a3={'priority':_0x3fdd30[0x0]};var _0x2d33ca=gotop[_0x29d6('0x0')](_0x3856a3,{'typecast':!![]});if(_0x2d33ca[_0x29d6('0x6')]){logger[_0x29d6('0x7')](_0x29d6('0x8'),_0x1c1810,_[_0x29d6('0x9')](_0x2d33ca,_0x29d6('0xa'))[_0x29d6('0xb')](',\x20'));_0x73aff[_0x29d6('0xc')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x1c1810,_0x3856a3['priority']);if(_0x3856a3[_0x29d6('0xd')]){var _0x38c239=_[_0x29d6('0xe')](_0x73aff[_0x29d6('0xf')](),{'p':_0x3856a3['priority']});if(_0x38c239>=0x0){logger[_0x29d6('0x10')](_0x29d6('0x11'),_0x1c1810,_0x3856a3[_0x29d6('0xd')]||'next',_0x38c239);_0x73aff[_0x29d6('0x12')](_0x38c239);}else{logger[_0x29d6('0x10')](_0x29d6('0x13'),_0x1c1810,_0x3856a3[_0x29d6('0xd')]||_0x29d6('0x12'));_0x73aff[_0x29d6('0xc')]();}}else{_0x73aff[_0x29d6('0x12')]();}}}catch(_0x139a7e){logger['error'](_0x29d6('0x8'),_0x1c1810,JSON[_0x29d6('0x14')](_0x139a7e));_0x73aff['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 326d320..81a1fc3 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 _0x6e6c=['InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stop','stringify','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','account','AccountId','upperFirst'];(function(_0x4c01da,_0x55cd29){var _0x5ca793=function(_0x181778){while(--_0x181778){_0x4c01da['push'](_0x4c01da['shift']());}};_0x5ca793(++_0x55cd29);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e6('0x0'));var utils=require(_0xc6e6('0x1'));var logger=require('../../../../config/logger')(_0xc6e6('0x2'));var rpc={'chatMessage':require(_0xc6e6('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc6e6('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc6e6('0x5'))};exports['consequence']=function(_0xe59212,_0x1182c7){return function(_0x4bf906){try{var _0x301f55={'body':utils[_0xc6e6('0x6')](_0x1182c7[0x0],this),'ContactId':this['contact']['id']};if(this[_0xc6e6('0x7')]===_0xc6e6('0x8')){_0x301f55['ChatWebsiteId']=this[_0xc6e6('0x9')]['id'];}else{_0x301f55[_['upperFirst'](this[_0xc6e6('0x7')])+_0xc6e6('0xa')]=this[_0xc6e6('0x9')]['id'];}_0x301f55[_[_0xc6e6('0xb')](this[_0xc6e6('0x7')])+_0xc6e6('0xc')]=this[_0xc6e6('0xd')]['id'];if(rpc[this[_0xc6e6('0x7')]+_0xc6e6('0xe')]){return rpc[this['channel']+_0xc6e6('0xe')]['create'](_0x301f55)[_0xc6e6('0xf')](function(_0x314d0f){logger[_0xc6e6('0x10')](_0xc6e6('0x11'),_0xe59212,_0x301f55['body']);_0x4bf906[_0xc6e6('0x12')]();})[_0xc6e6('0x13')](function(_0x13be73){logger[_0xc6e6('0x14')](_0xc6e6('0x11'),_0xe59212,JSON['stringify'](_0x13be73));_0x4bf906[_0xc6e6('0x15')]();});}}catch(_0x178b34){logger['error'](_0xc6e6('0x11'),_0xe59212,JSON[_0xc6e6('0x16')](_0x178b34));_0x4bf906[_0xc6e6('0x15')]();}};}; \ No newline at end of file +var _0xaac7=['lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','body','next','catch','error','stringify','stop','[%s][MESSAGE]\x20%s'];(function(_0x2c6193,_0xad44ae){var _0x423ca0=function(_0x22b6b7){while(--_0x22b6b7){_0x2c6193['push'](_0x2c6193['shift']());}};_0x423ca0(++_0xad44ae);}(_0xaac7,0x122));var _0x7aac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaac7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7aac('0x0'));var utils=require(_0x7aac('0x1'));var logger=require(_0x7aac('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7aac('0x3')),'mailMessage':require(_0x7aac('0x4')),'smsMessage':require(_0x7aac('0x5')),'faxMessage':require(_0x7aac('0x6')),'whatsappMessage':require(_0x7aac('0x7'))};exports[_0x7aac('0x8')]=function(_0x3ce43e,_0x3604ed){return function(_0x2ad8c3){try{var _0xdbaf31={'body':utils[_0x7aac('0x9')](_0x3604ed[0x0],this),'ContactId':this[_0x7aac('0xa')]['id']};if(this[_0x7aac('0xb')]==='chat'){_0xdbaf31[_0x7aac('0xc')]=this[_0x7aac('0xd')]['id'];}else{_0xdbaf31[_[_0x7aac('0xe')](this[_0x7aac('0xb')])+_0x7aac('0xf')]=this[_0x7aac('0xd')]['id'];}_0xdbaf31[_[_0x7aac('0xe')](this['channel'])+_0x7aac('0x10')]=this[_0x7aac('0x11')]['id'];if(rpc[this[_0x7aac('0xb')]+_0x7aac('0x12')]){return rpc[this[_0x7aac('0xb')]+'Message'][_0x7aac('0x13')](_0xdbaf31)[_0x7aac('0x14')](function(_0x3bb359){logger[_0x7aac('0x15')]('[%s][MESSAGE]\x20%s',_0x3ce43e,_0xdbaf31[_0x7aac('0x16')]);_0x2ad8c3[_0x7aac('0x17')]();})[_0x7aac('0x18')](function(_0x28b111){logger[_0x7aac('0x19')]('[%s][MESSAGE]\x20%s',_0x3ce43e,JSON[_0x7aac('0x1a')](_0x28b111));_0x2ad8c3[_0x7aac('0x1b')]();});}}catch(_0x1b85ea){logger[_0x7aac('0x19')](_0x7aac('0x1c'),_0x3ce43e,JSON[_0x7aac('0x1a')](_0x1b85ea));_0x2ad8c3[_0x7aac('0x1b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 486f0a2..e2be50e 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 _0x9fc3=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x9fc3,0xcb));var _0x39fc=function(_0x53f038,_0x1cc775){_0x53f038=_0x53f038-0x0;var _0x68d94e=_0x9fc3[_0x53f038];return _0x68d94e;};'use strict';var utils=require(_0x39fc('0x0'));var logger=require(_0x39fc('0x1'))(_0x39fc('0x2'));exports[_0x39fc('0x3')]=function(_0x293689,_0x5c6007){return function(_0x504c52){try{logger[_0x39fc('0x4')](_0x39fc('0x5'),_0x293689,utils['getMustacheRender'](_0x5c6007[0x0],this));_0x504c52[_0x39fc('0x6')]();}catch(_0xfae6ca){logger[_0x39fc('0x7')](_0x39fc('0x5'),_0x293689,JSON[_0x39fc('0x8')](_0xfae6ca));_0x504c52[_0x39fc('0x9')]();}};}; \ No newline at end of file +var _0x457e=['routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','../../../../config/logger'];(function(_0x5b2414,_0x16d22f){var _0x30a395=function(_0x450826){while(--_0x450826){_0x5b2414['push'](_0x5b2414['shift']());}};_0x30a395(++_0x16d22f);}(_0x457e,0x117));var _0xe457=function(_0x2420b3,_0x10a4ff){_0x2420b3=_0x2420b3-0x0;var _0x4b5f5a=_0x457e[_0x2420b3];return _0x4b5f5a;};'use strict';var utils=require('./utils');var logger=require(_0xe457('0x0'))(_0xe457('0x1'));exports[_0xe457('0x2')]=function(_0x30ae72,_0x2fec98){return function(_0x305adc){try{logger[_0xe457('0x3')](_0xe457('0x4'),_0x30ae72,utils[_0xe457('0x5')](_0x2fec98[0x0],this));_0x305adc[_0xe457('0x6')]();}catch(_0x584f3f){logger[_0xe457('0x7')]('[%s][NOOP]\x20%s',_0x30ae72,JSON[_0xe457('0x8')](_0x584f3f));_0x305adc[_0xe457('0x9')]();}};}; \ 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 59a42c1..29cfa7b 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 _0x6368=['body','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','join','stop','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting'];(function(_0x585221,_0xb7e318){var _0x17111b=function(_0x5c9de0){while(--_0x5c9de0){_0x585221['push'](_0x585221['shift']());}};_0x17111b(++_0xb7e318);}(_0x6368,0x187));var _0x8636=function(_0x44b43f,_0x45c0c2){_0x44b43f=_0x44b43f-0x0;var _0xb95bf1=_0x6368[_0x44b43f];return _0xb95bf1;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x8636('0x0'));var seqqueue=require(_0x8636('0x1'));var moment=require(_0x8636('0x2'));var Redis=require(_0x8636('0x3'));var config=require(_0x8636('0x4'));var logger=require(_0x8636('0x5'))(_0x8636('0x6'));var strategy=require(_0x8636('0x7'));config[_0x8636('0x8')]=_[_0x8636('0x9')](config['redis'],{'host':_0x8636('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8636('0x8')]));var attributes=['id',_0x8636('0xb'),_0x8636('0xc'),_0x8636('0xd'),_0x8636('0xe'),'joinAt'];function emit(_0x3c0cf4,_0x3902a3,_0x59c89c){io['to'](_0x3c0cf4)['emit'](_0x3902a3,_0x59c89c);}function emitChannelQueueInteraction(_0x14ee0e,_0x34fdd4,_0xf19e76,_0x52f21d,_0x513b61,_0x8a5c08,_0x50d991,_0x414c6c){var _0x538b5b=_[_0x8636('0xf')](_0xf19e76);_0x538b5b[_0x8636('0xb')]=_0x414c6c;_0x538b5b[_0x8636('0xd')]=_0x34fdd4;_0x538b5b[_0x8636('0xc')]=_0x52f21d;_0x538b5b['id']=_0x513b61;if(_0x8a5c08){attributes[_0x8636('0x10')](_[_0x8636('0x11')](_0x14ee0e)+_0x8636('0x12'));_0x50d991[util['format'](_0x8636('0x13'),_0x14ee0e)][_0x513b61]=_[_0x8636('0x14')](_0x538b5b,attributes);}else{delete _0x50d991[util[_0x8636('0x15')](_0x8636('0x13'),_0x14ee0e)][_0x513b61];}emit(util[_0x8636('0x15')](_0x8636('0x16'),_0x14ee0e,_0x34fdd4),util['format'](_0x8636('0x17'),_0x14ee0e,_0x8a5c08?_0x8636('0x18'):_0x8636('0x19')),_['pick'](_0x538b5b,attributes));}var rpc={'openchannelQueueReport':require(_0x8636('0x1a')),'mailQueueReport':require(_0x8636('0x1b')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x8636('0x1c')),'faxQueueReport':require(_0x8636('0x1d')),'whatsappQueueReport':require(_0x8636('0x1e')),'chatInteraction':require(_0x8636('0x1f')),'faxInteraction':require(_0x8636('0x20')),'mailInteraction':require(_0x8636('0x21')),'openchannelInteraction':require(_0x8636('0x22')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x8636('0x23'),'required':!![],'message':_0x8636('0x24')},'timeout':{'type':_0x8636('0x25'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x454c58,_0x8ba13,_0x1d7d40,_0x256d79){if(_0x454c58&&_0x8ba13&&_0x1d7d40){_0x8ba13[_0x8636('0x26')]+=0x1;var _0x4e48e5={'uniqueid':_0x454c58,'from':_0x1d7d40[_0x8636('0x27')]?_0x1d7d40[_0x8636('0x27')]['from']:'','joinAt':moment()[_0x8636('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d7d40['contact']?_0x1d7d40[_0x8636('0x28')]['id']:null,'ListId':_0x1d7d40[_0x8636('0x29')]?_0x1d7d40[_0x8636('0x29')]['id']:null};_0x4e48e5[_[_0x8636('0x2a')](_0x1d7d40['channel'])+_0x8636('0x2b')]=_0x8ba13['id']||null;_0x4e48e5[_[_0x8636('0x2a')](_0x1d7d40[_0x8636('0x2c')])+_0x8636('0x12')]=_0x1d7d40[_0x8636('0x2d')]?_0x1d7d40[_0x8636('0x2d')]['id']:null;_0x4e48e5[_[_0x8636('0x2a')](_0x1d7d40[_0x8636('0x2c')])+_0x8636('0x2e')]=_0x1d7d40[_0x8636('0x2f')]?_0x1d7d40['message']['id']:null;_0x4e48e5[_[_0x8636('0x2a')](_0x1d7d40[_0x8636('0x2c')])+(_0x1d7d40[_0x8636('0x2c')]!=='chat'?_0x8636('0x30'):'WebsiteId')]=_0x1d7d40[_0x8636('0xc')]?_0x1d7d40[_0x8636('0xc')]['id']:null;logger[_0x8636('0x31')](util[_0x8636('0x15')](_0x8636('0x32'),_0x454c58,_0x8ba13[_0x8636('0x33')]));emitChannelQueueInteraction(_0x1d7d40[_0x8636('0x2c')],_0x8ba13[_0x8636('0x33')],_0x4e48e5,_0x1d7d40[_0x8636('0xc')][_0x8636('0x33')],_0x1d7d40['message']['id'],!![],_0x256d79,_0x8ba13['id']);if(rpc[_0x1d7d40[_0x8636('0x2c')]+_0x8636('0x34')]){return rpc[_0x1d7d40[_0x8636('0x2c')]+'QueueReport'][_0x8636('0x35')](_0x4e48e5)[_0x8636('0x36')](function(_0x22b202){logger['error'](_0x8636('0x37'),_0x22b202);});}}}function stopRouting(_0x1c2f3d,_0x4c2103,_0x5a1f4a,_0x11f35e){if(_0x1c2f3d&&_0x4c2103){_0x4c2103[_0x8636('0x26')]-=0x1;var _0x277270={'leaveAt':moment()[_0x8636('0x15')](_0x8636('0x38')),'acceptAt':moment()[_0x8636('0x15')](_0x8636('0x38')),'reason':_0x8636('0x39')};logger[_0x8636('0x31')](util[_0x8636('0x15')](_0x8636('0x3a'),_0x1c2f3d,_0x4c2103[_0x8636('0x33')]));emitChannelQueueInteraction(_0x5a1f4a['channel'],_0x4c2103['name'],_0x5a1f4a['body'],_0x5a1f4a[_0x8636('0xc')][_0x8636('0x33')],_0x5a1f4a['message']['id'],![],_0x11f35e,_0x4c2103['id']);return rpc[_0x5a1f4a[_0x8636('0x2c')]+_0x8636('0x3b')][_0x8636('0x3c')](_0x5a1f4a['interaction']['id'],{'queueId':_0x4c2103['id']})[_0x8636('0x3d')](function(){if(rpc[_0x5a1f4a[_0x8636('0x2c')]+_0x8636('0x34')]){return rpc[_0x5a1f4a['channel']+_0x8636('0x34')][_0x8636('0x3c')](_0x1c2f3d,_0x277270)[_0x8636('0x36')](function(_0x5a04fd){logger[_0x8636('0x3e')](_0x8636('0x3f'),_0x5a04fd);});}});}}function endRouting(_0x7d7e57,_0x808c03,_0x539053,_0x2ee3b3){if(_0x7d7e57&&_0x808c03){_0x808c03[_0x8636('0x26')]-=0x1;var _0x52551f={'leaveAt':moment()[_0x8636('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x8636('0x15')](_0x8636('0x38')),'reason':_0x8636('0x40')};logger['info'](util[_0x8636('0x15')](_0x8636('0x41'),_0x7d7e57,_0x808c03[_0x8636('0x33')]));emitChannelQueueInteraction(_0x539053[_0x8636('0x2c')],_0x808c03[_0x8636('0x33')],_0x539053[_0x8636('0x27')],_0x539053['account'][_0x8636('0x33')],_0x539053[_0x8636('0x2f')]['id'],![],_0x2ee3b3);if(rpc[_0x539053['channel']+_0x8636('0x34')]){return rpc[_0x539053[_0x8636('0x2c')]+_0x8636('0x34')][_0x8636('0x3c')](_0x7d7e57,_0x52551f)[_0x8636('0x36')](function(_0x520c91){logger[_0x8636('0x3e')](_0x8636('0x3f'),_0x520c91);});}}}function handleFindQueue(_0x53bdd4){return function(_0x2ba24e){return _0x2ba24e[_0x8636('0x33')][_0x8636('0x42')]()===_0x53bdd4[_0x8636('0x42')]();};}exports[_0x8636('0x43')]=function(_0x268559,_0x3b2c3d,_0x41d378,_0xbbb9ad){return function(_0x58f917){try{var _0x13d42b={'name':_0x3b2c3d[0x0],'timeout':_0x3b2c3d[0x1]};var _0x49bc6b=queue[_0x8636('0x44')](_0x13d42b,{'typecast':!![]});if(_0x49bc6b['length']){logger['error'](_0x8636('0x45'),_0x268559,_['map'](_0x49bc6b,_0x8636('0x2f'))[_0x8636('0x46')](',\x20'));_0x58f917[_0x8636('0x47')]();}else{var _0x3a7ce5=_['find'](_0x41d378[_0xbbb9ad[_0x8636('0x2c')]+_0x8636('0x48')],handleFindQueue(_0x13d42b[_0x8636('0x33')]));if(_0x3a7ce5){startRouting(_0x268559,_0x3a7ce5,_0xbbb9ad,_0x41d378);var _0x347841=(_0x3a7ce5[_0x8636('0x40')]||0xa)*0x3e8;var _0x34cec2=(_0x13d42b[_0x8636('0x40')]||0x14)*0x3e8;var _0x10d992;if(_0x347841>_0x34cec2){_0x34cec2=_0x347841;}var _0x367830=seqqueue[_0x8636('0x49')](_0x347841);_0x367830['id']=_0x268559;_0x367830[_0x8636('0x4a')]=_0x347841;_0x367830[_0x8636('0x4b')]=_0x34cec2;_0x367830[_0x8636('0x2c')]=_0xbbb9ad[_0x8636('0x2c')];_0x41d378[_0x8636('0x4c')][_0x268559]['on'](_0x8636('0x4d'),function(){logger[_0x8636('0x31')](_0x8636('0x4e'),_0x268559);stopRouting(_0x268559,_0x3a7ce5,_0xbbb9ad,_0x41d378);clearTimeout(_0x10d992);_0x10d992=undefined;_0x367830[_0x8636('0x4f')](!![]);if(_0x41d378[_0x8636('0x4c')][_0x268559]){delete _0x41d378[_0x8636('0x4c')][_0x268559];}_0x58f917['stop']();});_0x41d378['rules'][_0x268559]['on'](_0x8636('0x50'),function(){if(_0x41d378[_0x8636('0x4c')][_0x268559]){delete _0x41d378['rules'][_0x268559];}});_0x10d992=setTimeout(function(){logger[_0x8636('0x31')](_0x8636('0x51'),_0x268559);endRouting(_0x268559,_0x3a7ce5,_0xbbb9ad,_0x41d378);clearTimeout(_0x10d992);_0x367830[_0x8636('0x4f')](!![]);_0x58f917[_0x8636('0x52')]();},_0x34cec2);switch(_0x3a7ce5[_0x8636('0x53')]){case _0x8636('0x54'):strategy[_0x8636('0x54')](_0x367830,_0x3a7ce5,_0x41d378,_0xbbb9ad);break;default:strategy[_0x8636('0x55')](_0x367830,_0x3a7ce5,_0x41d378,_0xbbb9ad);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x268559,_0x13d42b[_0x8636('0x33')]);_0x58f917[_0x8636('0x47')]();}}}catch(_0x4ba745){logger[_0x8636('0x3e')](_0x8636('0x45'),_0x268559,_0x4ba745['stack']);_0x58f917[_0x8636('0x47')]();}};}; \ No newline at end of file +var _0xfe3a=['number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','QueueReport','create','error','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','name','Interaction','then','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','join','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','account','queue','from','joinAt','emit','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0xfe3a,0x7e));var _0xafe3=function(_0x3ad113,_0xb05731){_0x3ad113=_0x3ad113-0x0;var _0x19010d=_0xfe3a[_0x3ad113];return _0x19010d;};'use strict';var schema=require(_0xafe3('0x0'));var _=require(_0xafe3('0x1'));var util=require(_0xafe3('0x2'));var seqqueue=require(_0xafe3('0x3'));var moment=require('moment');var Redis=require(_0xafe3('0x4'));var config=require(_0xafe3('0x5'));var logger=require(_0xafe3('0x6'))(_0xafe3('0x7'));var strategy=require(_0xafe3('0x8'));config['redis']=_[_0xafe3('0x9')](config[_0xafe3('0xa')],{'host':_0xafe3('0xb'),'port':0x18eb});var io=require(_0xafe3('0xc'))(new Redis(config['redis']));var attributes=['id','queue_id',_0xafe3('0xd'),_0xafe3('0xe'),_0xafe3('0xf'),_0xafe3('0x10')];function emit(_0x47d601,_0x31e339,_0x53db9c){io['to'](_0x47d601)[_0xafe3('0x11')](_0x31e339,_0x53db9c);}function emitChannelQueueInteraction(_0x51a3f8,_0x484983,_0x6274c3,_0x55f4d1,_0x448415,_0x3006d7,_0x32a5d6,_0x374f6b){var _0x209fd3=_['clone'](_0x6274c3);_0x209fd3['queue_id']=_0x374f6b;_0x209fd3['queue']=_0x484983;_0x209fd3[_0xafe3('0xd')]=_0x55f4d1;_0x209fd3['id']=_0x448415;if(_0x3006d7){attributes['push'](_[_0xafe3('0x12')](_0x51a3f8)+_0xafe3('0x13'));_0x32a5d6[util[_0xafe3('0x14')](_0xafe3('0x15'),_0x51a3f8)][_0x448415]=_[_0xafe3('0x16')](_0x209fd3,attributes);}else{delete _0x32a5d6[util[_0xafe3('0x14')](_0xafe3('0x15'),_0x51a3f8)][_0x448415];}emit(util[_0xafe3('0x14')](_0xafe3('0x17'),_0x51a3f8,_0x484983),util[_0xafe3('0x14')](_0xafe3('0x18'),_0x51a3f8,_0x3006d7?'save':_0xafe3('0x19')),_['pick'](_0x209fd3,attributes));}var rpc={'openchannelQueueReport':require(_0xafe3('0x1a')),'mailQueueReport':require(_0xafe3('0x1b')),'chatQueueReport':require(_0xafe3('0x1c')),'smsQueueReport':require(_0xafe3('0x1d')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xafe3('0x1e')),'chatInteraction':require(_0xafe3('0x1f')),'faxInteraction':require(_0xafe3('0x20')),'mailInteraction':require(_0xafe3('0x21')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xafe3('0x22')),'whatsappInteraction':require(_0xafe3('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xafe3('0x24'),'message':_0xafe3('0x25')}});function startRouting(_0x15543c,_0x2fe80d,_0xff5750,_0x306cd3){if(_0x15543c&&_0x2fe80d&&_0xff5750){_0x2fe80d['waiting']+=0x1;var _0x5a6cc7={'uniqueid':_0x15543c,'from':_0xff5750[_0xafe3('0x26')]?_0xff5750[_0xafe3('0x26')]['from']:'','joinAt':moment()[_0xafe3('0x14')](_0xafe3('0x27')),'ContactId':_0xff5750['contact']?_0xff5750[_0xafe3('0x28')]['id']:null,'ListId':_0xff5750[_0xafe3('0x29')]?_0xff5750[_0xafe3('0x29')]['id']:null};_0x5a6cc7[_[_0xafe3('0x2a')](_0xff5750['channel'])+_0xafe3('0x2b')]=_0x2fe80d['id']||null;_0x5a6cc7[_[_0xafe3('0x2a')](_0xff5750['channel'])+_0xafe3('0x13')]=_0xff5750[_0xafe3('0x2c')]?_0xff5750['interaction']['id']:null;_0x5a6cc7[_[_0xafe3('0x2a')](_0xff5750[_0xafe3('0x2d')])+_0xafe3('0x2e')]=_0xff5750[_0xafe3('0x2f')]?_0xff5750[_0xafe3('0x2f')]['id']:null;_0x5a6cc7[_[_0xafe3('0x2a')](_0xff5750[_0xafe3('0x2d')])+(_0xff5750[_0xafe3('0x2d')]!=='chat'?_0xafe3('0x30'):_0xafe3('0x31'))]=_0xff5750['account']?_0xff5750['account']['id']:null;logger[_0xafe3('0x32')](util[_0xafe3('0x14')](_0xafe3('0x33'),_0x15543c,_0x2fe80d['name']));emitChannelQueueInteraction(_0xff5750[_0xafe3('0x2d')],_0x2fe80d['name'],_0x5a6cc7,_0xff5750[_0xafe3('0xd')]['name'],_0xff5750['message']['id'],!![],_0x306cd3,_0x2fe80d['id']);if(rpc[_0xff5750['channel']+_0xafe3('0x34')]){return rpc[_0xff5750['channel']+_0xafe3('0x34')][_0xafe3('0x35')](_0x5a6cc7)['catch'](function(_0x590ad4){logger[_0xafe3('0x36')]('create\x20queue\x20report',_0x590ad4);});}}}function stopRouting(_0x50e9e3,_0x16534a,_0x44876f,_0xe76d82){if(_0x50e9e3&&_0x16534a){_0x16534a[_0xafe3('0x37')]-=0x1;var _0x5594c4={'leaveAt':moment()['format'](_0xafe3('0x27')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xafe3('0x38')};logger[_0xafe3('0x32')](util['format'](_0xafe3('0x39'),_0x50e9e3,_0x16534a[_0xafe3('0x3a')]));emitChannelQueueInteraction(_0x44876f[_0xafe3('0x2d')],_0x16534a['name'],_0x44876f['body'],_0x44876f[_0xafe3('0xd')]['name'],_0x44876f[_0xafe3('0x2f')]['id'],![],_0xe76d82,_0x16534a['id']);return rpc[_0x44876f[_0xafe3('0x2d')]+_0xafe3('0x3b')]['update'](_0x44876f[_0xafe3('0x2c')]['id'],{'queueId':_0x16534a['id']})[_0xafe3('0x3c')](function(){if(rpc[_0x44876f['channel']+_0xafe3('0x34')]){return rpc[_0x44876f[_0xafe3('0x2d')]+_0xafe3('0x34')]['update'](_0x50e9e3,_0x5594c4)['catch'](function(_0x57663f){logger['error'](_0xafe3('0x3d'),_0x57663f);});}});}}function endRouting(_0x50fc29,_0x2cd0c4,_0x2df343,_0x224c3f){if(_0x50fc29&&_0x2cd0c4){_0x2cd0c4[_0xafe3('0x37')]-=0x1;var _0x4fbaac={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xafe3('0x14')](_0xafe3('0x27')),'reason':'timeout'};logger[_0xafe3('0x32')](util[_0xafe3('0x14')](_0xafe3('0x3e'),_0x50fc29,_0x2cd0c4[_0xafe3('0x3a')]));emitChannelQueueInteraction(_0x2df343['channel'],_0x2cd0c4[_0xafe3('0x3a')],_0x2df343[_0xafe3('0x26')],_0x2df343[_0xafe3('0xd')][_0xafe3('0x3a')],_0x2df343[_0xafe3('0x2f')]['id'],![],_0x224c3f);if(rpc[_0x2df343[_0xafe3('0x2d')]+'QueueReport']){return rpc[_0x2df343[_0xafe3('0x2d')]+_0xafe3('0x34')]['update'](_0x50fc29,_0x4fbaac)['catch'](function(_0x4d423){logger[_0xafe3('0x36')](_0xafe3('0x3d'),_0x4d423);});}}}function handleFindQueue(_0x2027a2){return function(_0xa852ec){return _0xa852ec[_0xafe3('0x3a')]['toLowerCase']()===_0x2027a2[_0xafe3('0x3f')]();};}exports[_0xafe3('0x40')]=function(_0x33e124,_0x2486f1,_0x4c3391,_0x53856c){return function(_0x28df66){try{var _0x273a09={'name':_0x2486f1[0x0],'timeout':_0x2486f1[0x1]};var _0x564b26=queue['validate'](_0x273a09,{'typecast':!![]});if(_0x564b26['length']){logger['error'](_0xafe3('0x41'),_0x33e124,_['map'](_0x564b26,'message')[_0xafe3('0x42')](',\x20'));_0x28df66['stop']();}else{var _0x481d07=_['find'](_0x4c3391[_0x53856c[_0xafe3('0x2d')]+_0xafe3('0x43')],handleFindQueue(_0x273a09[_0xafe3('0x3a')]));if(_0x481d07){startRouting(_0x33e124,_0x481d07,_0x53856c,_0x4c3391);var _0x2dc858=(_0x481d07[_0xafe3('0x44')]||0xa)*0x3e8;var _0x5d2a6c=(_0x273a09['timeout']||0x14)*0x3e8;var _0x21147b;if(_0x2dc858>_0x5d2a6c){_0x5d2a6c=_0x2dc858;}var _0x197fbd=seqqueue[_0xafe3('0x45')](_0x2dc858);_0x197fbd['id']=_0x33e124;_0x197fbd[_0xafe3('0x46')]=_0x2dc858;_0x197fbd[_0xafe3('0x47')]=_0x5d2a6c;_0x197fbd[_0xafe3('0x2d')]=_0x53856c['channel'];_0x4c3391[_0xafe3('0x48')][_0x33e124]['on'](_0xafe3('0x49'),function(){logger[_0xafe3('0x32')](_0xafe3('0x4a'),_0x33e124);stopRouting(_0x33e124,_0x481d07,_0x53856c,_0x4c3391);clearTimeout(_0x21147b);_0x21147b=undefined;_0x197fbd[_0xafe3('0x4b')](!![]);if(_0x4c3391[_0xafe3('0x48')][_0x33e124]){delete _0x4c3391[_0xafe3('0x48')][_0x33e124];}_0x28df66[_0xafe3('0x4c')]();});_0x4c3391[_0xafe3('0x48')][_0x33e124]['on']('complete',function(){if(_0x4c3391[_0xafe3('0x48')][_0x33e124]){delete _0x4c3391[_0xafe3('0x48')][_0x33e124];}});_0x21147b=setTimeout(function(){logger[_0xafe3('0x32')](_0xafe3('0x4d'),_0x33e124);endRouting(_0x33e124,_0x481d07,_0x53856c,_0x4c3391);clearTimeout(_0x21147b);_0x197fbd[_0xafe3('0x4b')](!![]);_0x28df66[_0xafe3('0x4e')]();},_0x5d2a6c);switch(_0x481d07['strategy']){case'rrmemory':strategy[_0xafe3('0x4f')](_0x197fbd,_0x481d07,_0x4c3391,_0x53856c);break;default:strategy['beepall'](_0x197fbd,_0x481d07,_0x4c3391,_0x53856c);}}else{logger[_0xafe3('0x36')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x33e124,_0x273a09[_0xafe3('0x3a')]);_0x28df66[_0xafe3('0x4c')]();}}}catch(_0x47eb04){logger[_0xafe3('0x36')](_0xafe3('0x41'),_0x33e124,_0x47eb04[_0xafe3('0x50')]);_0x28df66[_0xafe3('0x4c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index fd2ccda..4403fdf 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 _0xbd50=['isNil','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','saveWaitingNotification','notificationId','RINGING',':FORCED','debug','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','realtime','squeue','push','handleRun','bind','timeout','handleDrained','handleTimeout','prototype','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x42cb30,_0x30ac13){var _0x2d886b=function(_0x42d9d4){while(--_0x42d9d4){_0x42cb30['push'](_0x42cb30['shift']());}};_0x2d886b(++_0x30ac13);}(_0xbd50,0x196));var _0x0bd5=function(_0x40df07,_0x2392d2){_0x40df07=_0x40df07-0x0;var _0x2050fe=_0xbd50[_0x40df07];return _0x2050fe;};'use strict';var _=require(_0x0bd5('0x0'));var uuid=require(_0x0bd5('0x1'));var util=require(_0x0bd5('0x2'));var logger=require('../../../../../config/logger')(_0x0bd5('0x3'));var Agent=function(_0x167372,_0x37acba,_0x1e9877,_0x15620d){this['notificationId']=uuid['v4']();this['squeue']=_0x167372;this['agent']=_0x37acba;this[_0x0bd5('0x4')]=_0x1e9877;this[_0x0bd5('0x3')]=_0x15620d;this[_0x0bd5('0x5')][_0x0bd5('0x6')](this[_0x0bd5('0x7')]['bind'](this),this['handleTimeout'][_0x0bd5('0x8')](this));this[_0x0bd5('0x5')]['on'](_0x0bd5('0x9'),this['handleTimeout'][_0x0bd5('0x8')](this));this[_0x0bd5('0x5')]['on']('drained',this[_0x0bd5('0xa')][_0x0bd5('0x8')](this));};Agent['prototype'][_0x0bd5('0x6')]=function(){this[_0x0bd5('0x5')][_0x0bd5('0x6')](this['handleRun'][_0x0bd5('0x8')](this),this[_0x0bd5('0xb')][_0x0bd5('0x8')](this));};Agent[_0x0bd5('0xc')][_0x0bd5('0xa')]=function(){this[_0x0bd5('0xb')](!![]);};Agent[_0x0bd5('0xc')][_0x0bd5('0x7')]=function(){logger['debug'](_0x0bd5('0xd'),this[_0x0bd5('0x5')]['id'],this['agent']['id']);if(_[_0x0bd5('0xe')](this[_0x0bd5('0x4')][_0x0bd5('0xf')][this[_0x0bd5('0x10')]['id']])){logger['debug'](_0x0bd5('0x11'),this[_0x0bd5('0x5')]['id'],this[_0x0bd5('0x10')]['id']);setTimeout(this[_0x0bd5('0x6')][_0x0bd5('0x8')](this),0x3e8);}else{if(this[_0x0bd5('0x3')][_0x0bd5('0x12')]||util[_0x0bd5('0x13')](this[_0x0bd5('0x5')]['id'],this[_0x0bd5('0x4')][_0x0bd5('0xf')][this[_0x0bd5('0x10')]['id']],this[_0x0bd5('0x5')][_0x0bd5('0x14')],![])){this['realtime']['agents'][this['agent']['id']]['busy']=!![];this['realtime'][_0x0bd5('0xf')][this[_0x0bd5('0x10')]['id']][_0x0bd5('0x15')]=undefined;util[_0x0bd5('0x16')](this[_0x0bd5('0x4')],this['routing'],this[_0x0bd5('0x10')],this[_0x0bd5('0x5')][_0x0bd5('0x14')]);util['showNotification'](this[_0x0bd5('0x17')],this['squeue']['id'],this['realtime'][_0x0bd5('0xf')][this[_0x0bd5('0x10')]['id']],null,this[_0x0bd5('0x3')]);util['writeLog'](this[_0x0bd5('0x5')]['id'],this['realtime'][_0x0bd5('0xf')][this[_0x0bd5('0x10')]['id']],_0x0bd5('0x18')+(this[_0x0bd5('0x3')][_0x0bd5('0x12')]?_0x0bd5('0x19'):''));}else{logger[_0x0bd5('0x1a')](_0x0bd5('0x1b'),this[_0x0bd5('0x5')]['id'],this[_0x0bd5('0x10')]['id']);setTimeout(this[_0x0bd5('0x6')][_0x0bd5('0x8')](this),0x3e8);}}};Agent[_0x0bd5('0xc')][_0x0bd5('0xb')]=function(_0x5e5a33){if(_[_0x0bd5('0xe')](this[_0x0bd5('0x4')]['agents'][this[_0x0bd5('0x10')]['id']])){return logger[_0x0bd5('0x1a')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x0bd5('0x5')]['id'],this[_0x0bd5('0x10')]['id']);}else{logger[_0x0bd5('0x1a')](_0x0bd5('0x1c'),this['squeue']['id'],this[_0x0bd5('0x10')]['id']);util[_0x0bd5('0x1d')](this[_0x0bd5('0x17')],this[_0x0bd5('0x5')]['id'],this[_0x0bd5('0x4')][_0x0bd5('0xf')][this['agent']['id']],null,this[_0x0bd5('0x3')]);this['realtime'][_0x0bd5('0xf')][this[_0x0bd5('0x10')]['id']][_0x0bd5('0x1e')]=![];this[_0x0bd5('0x4')][_0x0bd5('0xf')][this[_0x0bd5('0x10')]['id']][_0x0bd5('0x15')]=undefined;util[_0x0bd5('0x1f')](this[_0x0bd5('0x4')],this[_0x0bd5('0x3')],this[_0x0bd5('0x10')],this[_0x0bd5('0x5')][_0x0bd5('0x14')]);util['writeLog'](this[_0x0bd5('0x5')]['id'],this[_0x0bd5('0x4')]['agents'][this['agent']['id']],_0x5e5a33?_0x0bd5('0x20'):_0x0bd5('0x21'));}if(!_0x5e5a33){setTimeout(this[_0x0bd5('0x6')][_0x0bd5('0x8')](this),0x3e8);}};function agent(_0x1dd2e1,_0x387e24,_0x22c10c,_0x1a0c0c){return new Agent(_0x1dd2e1,_0x387e24,_0x22c10c,_0x1a0c0c);}module[_0x0bd5('0x22')]=agent; \ No newline at end of file +var _0x1cc7=['forcedOwnership','channel','busy','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','prototype','handleDrained','debug','agent','isNil','agents','routing'];(function(_0x4a893c,_0x4f05ea){var _0x3a6668=function(_0x48e7e7){while(--_0x48e7e7){_0x4a893c['push'](_0x4a893c['shift']());}};_0x3a6668(++_0x4f05ea);}(_0x1cc7,0x15a));var _0x71cc=function(_0x11ae0b,_0x18a441){_0x11ae0b=_0x11ae0b-0x0;var _0x3e53b9=_0x1cc7[_0x11ae0b];return _0x3e53b9;};'use strict';var _=require(_0x71cc('0x0'));var uuid=require(_0x71cc('0x1'));var util=require(_0x71cc('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x547fe6,_0xe5d54e,_0x1fac93,_0x402191){this['notificationId']=uuid['v4']();this['squeue']=_0x547fe6;this['agent']=_0xe5d54e;this[_0x71cc('0x3')]=_0x1fac93;this['routing']=_0x402191;this[_0x71cc('0x4')][_0x71cc('0x5')](this[_0x71cc('0x6')][_0x71cc('0x7')](this),this[_0x71cc('0x8')]['bind'](this));this[_0x71cc('0x4')]['on'](_0x71cc('0x9'),this[_0x71cc('0x8')]['bind'](this));this['squeue']['on']('drained',this['handleDrained'][_0x71cc('0x7')](this));};Agent[_0x71cc('0xa')][_0x71cc('0x5')]=function(){this['squeue'][_0x71cc('0x5')](this['handleRun'][_0x71cc('0x7')](this),this['handleTimeout'][_0x71cc('0x7')](this));};Agent['prototype'][_0x71cc('0xb')]=function(){this[_0x71cc('0x8')](!![]);};Agent[_0x71cc('0xa')][_0x71cc('0x6')]=function(){logger[_0x71cc('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);if(_[_0x71cc('0xe')](this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']])){logger[_0x71cc('0xc')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);setTimeout(this[_0x71cc('0x5')][_0x71cc('0x7')](this),0x3e8);}else{if(this[_0x71cc('0x10')][_0x71cc('0x11')]||util['isAgentAvailable'](this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')]['agents'][this['agent']['id']],this[_0x71cc('0x4')][_0x71cc('0x12')],![])){this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']][_0x71cc('0x13')]=!![];this[_0x71cc('0x3')][_0x71cc('0xf')][this['agent']['id']][_0x71cc('0x14')]=undefined;util[_0x71cc('0x15')](this['realtime'],this[_0x71cc('0x10')],this[_0x71cc('0xd')],this[_0x71cc('0x4')][_0x71cc('0x12')]);util[_0x71cc('0x16')](this[_0x71cc('0x17')],this['squeue']['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],null,this[_0x71cc('0x10')]);util[_0x71cc('0x18')](this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],'RINGING'+(this[_0x71cc('0x10')][_0x71cc('0x11')]?_0x71cc('0x19'):''));}else{logger[_0x71cc('0xc')](_0x71cc('0x1a'),this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);setTimeout(this[_0x71cc('0x5')][_0x71cc('0x7')](this),0x3e8);}}};Agent[_0x71cc('0xa')][_0x71cc('0x8')]=function(_0x35f723){if(_[_0x71cc('0xe')](this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']])){return logger['debug'](_0x71cc('0x1b'),this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);}else{logger[_0x71cc('0xc')](_0x71cc('0x1c'),this[_0x71cc('0x4')]['id'],this['agent']['id']);util[_0x71cc('0x1d')](this[_0x71cc('0x17')],this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],null,this[_0x71cc('0x10')]);this['realtime'][_0x71cc('0xf')][this['agent']['id']]['busy']=![];this[_0x71cc('0x3')]['agents'][this['agent']['id']][_0x71cc('0x14')]=undefined;util['removeWaitingNotification'](this[_0x71cc('0x3')],this['routing'],this[_0x71cc('0xd')],this[_0x71cc('0x4')]['channel']);util[_0x71cc('0x18')](this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],_0x35f723?_0x71cc('0x1e'):_0x71cc('0x1f'));}if(!_0x35f723){setTimeout(this[_0x71cc('0x5')][_0x71cc('0x7')](this),0x3e8);}};function agent(_0x2f8a72,_0x4b7bc6,_0x4330f0,_0x54d16a){return new Agent(_0x2f8a72,_0x4b7bc6,_0x4330f0,_0x54d16a);}module[_0x71cc('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 7e3a986..317e44d 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 _0xbdf1=['agents','debug','channel','RINGING','busy','name','saveWaitingNotification','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','writeLog','STOP','TIMEOUT','busyQueue','lodash','../../../../../config/logger','routing','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length'];(function(_0x23a29d,_0x25f5a3){var _0x5230ea=function(_0xa508d3){while(--_0xa508d3){_0x23a29d['push'](_0x23a29d['shift']());}};_0x5230ea(++_0x25f5a3);}(_0xbdf1,0x143));var _0x1bdf=function(_0x2269a5,_0x4b7ef6){_0x2269a5=_0x2269a5-0x0;var _0x105d3d=_0xbdf1[_0x2269a5];return _0x105d3d;};'use strict';var _=require(_0x1bdf('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x1bdf('0x1'))(_0x1bdf('0x2'));var Beepall=function(_0x5c48dc,_0x34b064,_0x36f00a,_0x116bfd){this['notificationId']=uuid['v4']();this[_0x1bdf('0x3')]=_0x5c48dc;this[_0x1bdf('0x4')]=_0x34b064;this[_0x1bdf('0x5')]=_0x36f00a;this['routing']=_0x116bfd;this[_0x1bdf('0x3')][_0x1bdf('0x6')](this[_0x1bdf('0x7')][_0x1bdf('0x8')](this),this[_0x1bdf('0x9')][_0x1bdf('0x8')](this));this[_0x1bdf('0x3')]['on'](_0x1bdf('0xa'),this[_0x1bdf('0x9')]['bind'](this));this[_0x1bdf('0x3')]['on'](_0x1bdf('0xb'),this[_0x1bdf('0xc')]['bind'](this));};Beepall[_0x1bdf('0xd')][_0x1bdf('0x6')]=function(){this['squeue']['push'](this[_0x1bdf('0x7')][_0x1bdf('0x8')](this),this[_0x1bdf('0x9')][_0x1bdf('0x8')](this));};Beepall[_0x1bdf('0xd')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall[_0x1bdf('0xd')][_0x1bdf('0x7')]=function(){var _0x1d6fc6=!![];if(!_[_0x1bdf('0xe')](this['queue'])&&!_[_0x1bdf('0xe')](this[_0x1bdf('0x4')]['Agents'])&&this[_0x1bdf('0x4')][_0x1bdf('0xf')]['length']>0x0){for(var _0x38fb30=0x0,_0x4aefbe;_0x38fb300x0){for(var _0x3bd056=0x0,_0x64e364;_0x3bd0560x0&&_0x2951b8[_0x6af753+_0x7ba9('0x23')]>=_0x2951b8[_0x6af753+_0x7ba9('0x22')]){writeLog(_0x2c0b81,_0x2951b8,_0x6af753['toUpperCase']()+_0x7ba9('0x24'));return![];}}return!![];};exports[_0x7ba9('0x25')]=function(_0x925e2e,_0x485d03,_0xef6452,_0x4c5c66,_0x5a8ef8){return sendNotification(!![],_0x925e2e,_0x485d03,_0xef6452,_0x4c5c66,_0x5a8ef8);};exports[_0x7ba9('0x26')]=function(_0x28813d,_0x53e0f5,_0x49df85,_0x202c36,_0x38e21b){return sendNotification(![],_0x28813d,_0x53e0f5,_0x49df85,_0x202c36,_0x38e21b);};exports[_0x7ba9('0x27')]=function(_0x5254f8,_0x596872,_0x28f9ed){var _0x13efb4=_0x596872['interaction'][_0x7ba9('0x28')];if(!_0x13efb4&&_0x28f9ed){_0x13efb4=_0x28f9ed['id'];}var _0x304dc7=_[_0x7ba9('0x29')](_0x5254f8[_0x596872[_0x7ba9('0x2a')]+_0x7ba9('0x2b')],function(_0x5396e9){var _0x1c42bc=_[_0x7ba9('0x2c')](_0x596872[_0x7ba9('0x2a')])+_0x7ba9('0x2d');return _0x5396e9[_0x1c42bc]===_0x596872[_0x7ba9('0x2e')]['id'];});if(!_0x304dc7&&_0x13efb4&&_0x5254f8['agents'][_0x13efb4]){_0x304dc7=_[_0x7ba9('0x29')](_0x5254f8['agents'][_0x13efb4][_0x596872['channel']+'WaitingInteractions'],function(_0xd7db93){return _0xd7db93['id']===_0x596872[_0x7ba9('0x2e')]['id'];});}return _0x304dc7;};exports[_0x7ba9('0x2f')]=function(_0x457f96,_0x5a6c22,_0x3bd438,_0x2a7299){if(_0x3bd438&&_0x3bd438['id']&&_0x457f96[_0x7ba9('0x30')]&&_0x457f96[_0x7ba9('0x30')][_0x3bd438['id']]){_0x457f96[_0x7ba9('0x30')][_0x3bd438['id']][_0x2a7299+_0x7ba9('0x31')][_0x5a6c22['message']['id']]={'id':_0x5a6c22[_0x7ba9('0x2e')]['id']};}};exports[_0x7ba9('0x32')]=function(_0x530cd1,_0x339d4e,_0x5ebfa2,_0x531436){if(_0x5ebfa2&&_0x5ebfa2['id']&&_0x530cd1[_0x7ba9('0x30')]&&_0x530cd1[_0x7ba9('0x30')][_0x5ebfa2['id']]){delete _0x530cd1[_0x7ba9('0x30')][_0x5ebfa2['id']][_0x531436+'WaitingInteractions'][_0x339d4e['message']['id']];}};exports[_0x7ba9('0x33')]=writeLog; \ No newline at end of file +var _0x5ab9=['message','emit','notification:%s','save','remove','debug','isAgentAvailable','BUSY','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','channel','QueuesWaitingInteractions','capitalize','agents','some','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','util','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','error','format','[%s][QUEUE]\x20%s'];(function(_0x3a37af,_0x511881){var _0x13a26a=function(_0x4ef778){while(--_0x4ef778){_0x3a37af['push'](_0x3a37af['shift']());}};_0x13a26a(++_0x511881);}(_0x5ab9,0x117));var _0x95ab=function(_0x32bdd4,_0x143a69){_0x32bdd4=_0x32bdd4-0x0;var _0x4b54d3=_0x5ab9[_0x32bdd4];return _0x4b54d3;};'use strict';var _=require('lodash');var util=require(_0x95ab('0x0'));var utils=require('../utils');var Redis=require(_0x95ab('0x1'));var config=require(_0x95ab('0x2'));var logger=require(_0x95ab('0x3'))('routing');config[_0x95ab('0x4')]=_[_0x95ab('0x5')](config['redis'],{'host':_0x95ab('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x95ab('0x4')]));function sendNotification(_0x23b91d,_0x546d8b,_0x56b5cb,_0x4ac348,_0x195203,_0x3431c5){var _0x1f32c8=_0x3431c5||{};var _0x2e2696=_0x56b5cb[_0x95ab('0x7')]('.');var _0x36712d={'uniqueid':_0x546d8b,'channel':_0x2e2696[0x0],'id':_0x2e2696[0x1],'title':_0x2e2696[0x0]+_0x95ab('0x8'),'interactionId':_0x2e2696[0x2],'queue':_0x195203?_0x195203[_0x95ab('0x9')]:null,'sound':_0x1f32c8[_0x95ab('0xa')][_0x95ab('0xb')],'shake':_0x1f32c8[_0x95ab('0xa')][_0x95ab('0xc')]};try{if(!_0x1f32c8['body']){_0x1f32c8['body']={};}if(_0x195203){_0x1f32c8[_0x95ab('0xd')]['queue']=_0x195203;}else if(_0x1f32c8[_0x95ab('0xd')][_0x95ab('0xe')]){delete _0x1f32c8[_0x95ab('0xd')]['queue'];}_0x36712d['msg']=utils[_0x95ab('0xf')](_0x1f32c8[_0x95ab('0xa')][_0x95ab('0x10')],_0x1f32c8);}catch(_0x2b1d19){_0x36712d[_0x95ab('0x11')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x95ab('0x12')](util[_0x95ab('0x13')](_0x95ab('0x14'),_0x546d8b,_0x2b1d19[_0x95ab('0x15')]));}io['to'](util[_0x95ab('0x13')]('user:%s',_0x4ac348[_0x95ab('0x9')]))[_0x95ab('0x16')](util['format'](_0x95ab('0x17'),_0x23b91d?_0x95ab('0x18'):_0x95ab('0x19')),_0x36712d);}function writeLog(_0x137646,_0x22a8d1,_0x3c4275){return logger[_0x95ab('0x1a')](util[_0x95ab('0x13')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x137646,_0x22a8d1['name'],_0x3c4275));}exports[_0x95ab('0x1b')]=function(_0x1f0c7a,_0x3446b4,_0xb1885e,_0x4845bf){if(_0x3446b4['busy']){writeLog(_0x1f0c7a,_0x3446b4,_0x95ab('0x1c'));return![];}if(!_0x3446b4['online']){writeLog(_0x1f0c7a,_0x3446b4,'OFFLINE');return![];}if(_0x3446b4[_0xb1885e+_0x95ab('0x1d')]){writeLog(_0x1f0c7a,_0x3446b4,_0x95ab('0x1e'));return![];}if(_0x4845bf&&_0x3446b4[_0x95ab('0x1f')](_0xb1885e+'Capacity')&&_0x3446b4['hasOwnProperty'](_0xb1885e+_0x95ab('0x20'))){if(_0x3446b4[_0xb1885e+_0x95ab('0x21')]>0x0&&_0x3446b4[_0xb1885e+_0x95ab('0x20')]>=_0x3446b4[_0xb1885e+_0x95ab('0x21')]){writeLog(_0x1f0c7a,_0x3446b4,_0xb1885e[_0x95ab('0x22')]()+_0x95ab('0x23'));return![];}}return!![];};exports[_0x95ab('0x24')]=function(_0x46309d,_0x31f4c1,_0x5cb9be,_0x5f4ced,_0xd28b4f){return sendNotification(!![],_0x46309d,_0x31f4c1,_0x5cb9be,_0x5f4ced,_0xd28b4f);};exports[_0x95ab('0x25')]=function(_0x58231c,_0x48233c,_0x4f17d1,_0xc7d396,_0x408c47){return sendNotification(![],_0x58231c,_0x48233c,_0x4f17d1,_0xc7d396,_0x408c47);};exports[_0x95ab('0x26')]=function(_0x4f46a7,_0xd73a14,_0x395516){var _0x1fcd49=_0xd73a14[_0x95ab('0x27')][_0x95ab('0x28')];if(!_0x1fcd49&&_0x395516){_0x1fcd49=_0x395516['id'];}var _0xd0bc7=_['some'](_0x4f46a7[_0xd73a14[_0x95ab('0x29')]+_0x95ab('0x2a')],function(_0x58522a){var _0x9965d3=_[_0x95ab('0x2b')](_0xd73a14[_0x95ab('0x29')])+'InteractionId';return _0x58522a[_0x9965d3]===_0xd73a14[_0x95ab('0x27')]['id'];});if(!_0xd0bc7&&_0x1fcd49&&_0x4f46a7[_0x95ab('0x2c')][_0x1fcd49]){_0xd0bc7=_[_0x95ab('0x2d')](_0x4f46a7[_0x95ab('0x2c')][_0x1fcd49][_0xd73a14[_0x95ab('0x29')]+_0x95ab('0x2e')],function(_0x5700a0){return _0x5700a0['id']===_0xd73a14[_0x95ab('0x27')]['id'];});}return _0xd0bc7;};exports[_0x95ab('0x2f')]=function(_0x271661,_0x36b640,_0x3a842e,_0x19ea96){if(_0x3a842e&&_0x3a842e['id']&&_0x271661[_0x95ab('0x2c')]&&_0x271661[_0x95ab('0x2c')][_0x3a842e['id']]){_0x271661[_0x95ab('0x2c')][_0x3a842e['id']][_0x19ea96+_0x95ab('0x2e')][_0x36b640[_0x95ab('0x15')]['id']]={'id':_0x36b640[_0x95ab('0x27')]['id']};}};exports[_0x95ab('0x30')]=function(_0x456cf9,_0x3372ab,_0x27a0f4,_0x1aad1d){if(_0x27a0f4&&_0x27a0f4['id']&&_0x456cf9[_0x95ab('0x2c')]&&_0x456cf9[_0x95ab('0x2c')][_0x27a0f4['id']]){delete _0x456cf9['agents'][_0x27a0f4['id']][_0x1aad1d+_0x95ab('0x2e')][_0x3372ab[_0x95ab('0x15')]['id']];}};exports[_0x95ab('0x31')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 622d4a2..8e42ad8 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 _0x7eea=['shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7eea,0x9b));var _0xa7ee=function(_0x20d164,_0x23b40b){_0x20d164=_0x20d164-0x0;var _0x42a90f=_0x7eea[_0x20d164];return _0x42a90f;};'use strict';var schema=require(_0xa7ee('0x0'));var sh=require(_0xa7ee('0x1'));var _=require(_0xa7ee('0x2'));var utils=require(_0xa7ee('0x3'));var logger=require(_0xa7ee('0x4'))(_0xa7ee('0x5'));var system=schema({'command':{'type':_0xa7ee('0x6'),'required':!![],'message':_0xa7ee('0x7')}});exports['consequence']=function(_0x267626,_0x3896fb){return function(_0x4d1b03){try{var _0x8a02ac={'command':_0x3896fb[0x0]};var _0x1c041d=system[_0xa7ee('0x0')](_0x8a02ac,{'typecast':!![]});if(_0x1c041d[_0xa7ee('0x8')]){logger[_0xa7ee('0x9')](_0xa7ee('0xa'),_0x267626,_[_0xa7ee('0xb')](_0x1c041d,_0xa7ee('0xc'))[_0xa7ee('0xd')](',\x20'));logger[_0xa7ee('0xe')](_0xa7ee('0xf'),_0x267626);_0x4d1b03[_0xa7ee('0x10')]();}else{var _0x3727cd=this;var _0x366e8c=utils[_0xa7ee('0x11')](_0x3896fb[0x0],this);logger[_0xa7ee('0xe')](_0xa7ee('0x12'),_0x267626,_0x366e8c);sh['exec'](_['trim'](_0x366e8c),function(_0x4c19f7,_0x1bb3df){logger['info'](_0xa7ee('0x13'),_0x267626,_0x4c19f7);if(_0x4c19f7==0x0){var _0x62fe10=_0x1bb3df['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xa7ee('0x14')](_0x3896fb[0x1])||_[_0xa7ee('0x15')](_0x3896fb[0x1])){logger[_0xa7ee('0xe')](_0xa7ee('0x16'),_0x267626);_0x3727cd[_0xa7ee('0x17')][_0x3896fb[0x1]]=_0x62fe10;}else{logger[_0xa7ee('0xe')](_0xa7ee('0x18'),_0x267626,_0x3896fb[0x1],_0x62fe10);_0x3727cd[_0xa7ee('0x17')][_0x3896fb[0x1]]=_0x62fe10;}}_0x4d1b03[_0xa7ee('0x10')]();});}}catch(_0x4732da){logger['error']('[%s][SYSTEM]\x20%s',_0x267626,_['isObject'](_0x4732da)?JSON[_0xa7ee('0x19')](_0x4732da):_0x4732da);logger[_0xa7ee('0xe')](_0xa7ee('0xf'),_0x267626);_0x4d1b03['next']();}};}; \ No newline at end of file +var _0xbd35=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','validate','shelljs','../../../../config/logger','string','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isEmpty'];(function(_0x2bc1d7,_0x451296){var _0x572c98=function(_0x37d364){while(--_0x37d364){_0x2bc1d7['push'](_0x2bc1d7['shift']());}};_0x572c98(++_0x451296);}(_0xbd35,0x153));var _0x5bd3=function(_0x14007f,_0x470758){_0x14007f=_0x14007f-0x0;var _0x2fae39=_0xbd35[_0x14007f];return _0x2fae39;};'use strict';var schema=require(_0x5bd3('0x0'));var sh=require(_0x5bd3('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0x5bd3('0x2'))('routing');var system=schema({'command':{'type':_0x5bd3('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x5bd3('0x4')]=function(_0x256c56,_0x2ca3bd){return function(_0x49ba24){try{var _0x2fd32f={'command':_0x2ca3bd[0x0]};var _0x216d59=system[_0x5bd3('0x0')](_0x2fd32f,{'typecast':!![]});if(_0x216d59['length']){logger[_0x5bd3('0x5')](_0x5bd3('0x6'),_0x256c56,_[_0x5bd3('0x7')](_0x216d59,_0x5bd3('0x8'))[_0x5bd3('0x9')](',\x20'));logger[_0x5bd3('0xa')](_0x5bd3('0xb'),_0x256c56);_0x49ba24[_0x5bd3('0xc')]();}else{var _0x1f39a8=this;var _0x55072a=utils[_0x5bd3('0xd')](_0x2ca3bd[0x0],this);logger['info'](_0x5bd3('0xe'),_0x256c56,_0x55072a);sh[_0x5bd3('0xf')](_[_0x5bd3('0x10')](_0x55072a),function(_0x2b3547,_0x19ab3c){logger[_0x5bd3('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x256c56,_0x2b3547);if(_0x2b3547==0x0){var _0x3c6910=_0x19ab3c['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x2ca3bd[0x1])||_[_0x5bd3('0x11')](_0x2ca3bd[0x1])){logger[_0x5bd3('0xa')](_0x5bd3('0x12'),_0x256c56);_0x1f39a8[_0x5bd3('0x13')][_0x2ca3bd[0x1]]=_0x3c6910;}else{logger['info'](_0x5bd3('0x14'),_0x256c56,_0x2ca3bd[0x1],_0x3c6910);_0x1f39a8[_0x5bd3('0x13')][_0x2ca3bd[0x1]]=_0x3c6910;}}_0x49ba24[_0x5bd3('0xc')]();});}}catch(_0x3a7629){logger['error'](_0x5bd3('0x6'),_0x256c56,_['isObject'](_0x3a7629)?JSON['stringify'](_0x3a7629):_0x3a7629);logger[_0x5bd3('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x256c56);_0x49ba24[_0x5bd3('0xc')]();}};}; \ 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 89b1429..acbada4 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 _0xeccb=['channel','catch','error','[%s][TAG]\x20%s','stringify','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','interaction','then'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0xeccb,0x16e));var _0xbecc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xeccb[_0x2bf141];return _0x48277b;};'use strict';var schema=require(_0xbecc('0x0'));var _=require(_0xbecc('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xbecc('0x2')),'smsInteraction':require(_0xbecc('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xbecc('0x4')),'whatsappInteraction':require(_0xbecc('0x5'))};var logger=require(_0xbecc('0x6'))(_0xbecc('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xbecc('0x8')}});exports['consequence']=function(_0x466671,_0x12abd8,_0xbde2c2,_0x3930ba){return function(_0x1f4208){try{var _0x2941ba={'tag':_0x12abd8[0x0]};var _0x5bb723=tag[_0xbecc('0x0')](_0x2941ba,{'typecast':!![]});if(_0x5bb723[_0xbecc('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x466671,_[_0xbecc('0xa')](_0x5bb723,'message')[_0xbecc('0xb')](',\x20'));logger[_0xbecc('0xc')](_0xbecc('0xd'),_0x466671);_0x1f4208[_0xbecc('0xe')]();}else{var _0x325d56={'ids':[_0x12abd8[0x0]]};if(rpc[_0x3930ba['channel']+_0xbecc('0xf')]){rpc[_0x3930ba['channel']+_0xbecc('0xf')]['addTags'](_0x3930ba[_0xbecc('0x10')]['id'],_0x325d56)[_0xbecc('0x11')](function(_0x7b20bd){logger[_0xbecc('0xc')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x466671,_0x12abd8[0x1],_0x3930ba[_0xbecc('0x12')],_0x3930ba[_0xbecc('0x10')]['id']);})[_0xbecc('0x13')](function(_0x5c3a55){logger[_0xbecc('0x14')](_0xbecc('0x15'),_0x466671,JSON[_0xbecc('0x16')](_0x5c3a55));logger['info'](_0xbecc('0xd'),_0x466671);})['finally'](function(){_0x1f4208[_0xbecc('0xe')]();});}}}catch(_0x2ca0fd){logger[_0xbecc('0x14')](_0xbecc('0x15'),_0x466671,_[_0xbecc('0x17')](_0x2ca0fd)?JSON[_0xbecc('0x16')](_0x2ca0fd):_0x2ca0fd);logger[_0xbecc('0xc')](_0xbecc('0xd'),_0x466671);_0x1f4208[_0xbecc('0xe')]();}};}; \ No newline at end of file +var _0x45ee=['../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','stringify','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0x45ee,0x14c));var _0xe45e=function(_0x2a3688,_0x3923aa){_0x2a3688=_0x2a3688-0x0;var _0x255227=_0x45ee[_0x2a3688];return _0x255227;};'use strict';var schema=require(_0xe45e('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xe45e('0x1')),'openchannelInteraction':require(_0xe45e('0x2')),'smsInteraction':require(_0xe45e('0x3')),'mailInteraction':require(_0xe45e('0x4')),'faxInteraction':require(_0xe45e('0x5')),'whatsappInteraction':require(_0xe45e('0x6'))};var logger=require(_0xe45e('0x7'))(_0xe45e('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xe45e('0x9')}});exports['consequence']=function(_0x23c03f,_0xe75245,_0x2f33ac,_0xbb2c8c){return function(_0x417461){try{var _0x135b22={'tag':_0xe75245[0x0]};var _0x1d68bc=tag[_0xe45e('0x0')](_0x135b22,{'typecast':!![]});if(_0x1d68bc['length']){logger['error'](_0xe45e('0xa'),_0x23c03f,_[_0xe45e('0xb')](_0x1d68bc,_0xe45e('0xc'))['join'](',\x20'));logger[_0xe45e('0xd')](_0xe45e('0xe'),_0x23c03f);_0x417461[_0xe45e('0xf')]();}else{var _0x1982fe={'ids':[_0xe75245[0x0]]};if(rpc[_0xbb2c8c[_0xe45e('0x10')]+_0xe45e('0x11')]){rpc[_0xbb2c8c[_0xe45e('0x10')]+_0xe45e('0x11')][_0xe45e('0x12')](_0xbb2c8c[_0xe45e('0x13')]['id'],_0x1982fe)[_0xe45e('0x14')](function(_0x4e6d27){logger['info'](_0xe45e('0x15'),_0x23c03f,_0xe75245[0x1],_0xbb2c8c['channel'],_0xbb2c8c[_0xe45e('0x13')]['id']);})['catch'](function(_0x343c7b){logger[_0xe45e('0x16')](_0xe45e('0xa'),_0x23c03f,JSON[_0xe45e('0x17')](_0x343c7b));logger[_0xe45e('0xd')](_0xe45e('0xe'),_0x23c03f);})[_0xe45e('0x18')](function(){_0x417461[_0xe45e('0xf')]();});}}}catch(_0x210b14){logger['error']('[%s][TAG]\x20%s',_0x23c03f,_[_0xe45e('0x19')](_0x210b14)?JSON[_0xe45e('0x17')](_0x210b14):_0x210b14);logger[_0xe45e('0xd')](_0xe45e('0xe'),_0x23c03f);_0x417461[_0xe45e('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 8fe1dd0..fa0b5c7 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6533=['title','jsonrpc','2.0','login','push','params','stringify','utf8','application/json-rpc','then','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','urlOnRing'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6533,0x172));var _0x3653=function(_0x1122b7,_0x9aa0b1){_0x1122b7=_0x1122b7-0x0;var _0x231192=_0x6533[_0x1122b7];return _0x231192;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')('routing');var _=require(_0x3653('0x0'));var arr=[];exports[_0x3653('0x1')]=function(_0x1eec3a,_0x56a885){return function(_0x34cd26){var _0x39eb1e=_0x56a885[0xa];var _0x5d8782=_0x56a885[0xb];var _0x57e266=_0x56a885[0xc];var _0x525c68=_0x56a885[0xd];var _0x5d48ac=_0x56a885[0xe];var _0x5233f5=_0x56a885[0xf][_0x3653('0x2')](/\n/g,_0x3653('0x3'));var _0x3891bd=_0x56a885[0x10][_0x3653('0x2')](/\n/g,'\x20');if(!arr[_0x3653('0x4')](_0x5d8782)){arr['push'](_0x5d8782);var _0x36cbdc=_0x56a885[0x3];var _0x243d02=_0x56a885[0x4];var _0x18b877=_0x56a885[0x1];var _0xc0ff62=_0x56a885[0x0];var _0x14e2cd={};_0x14e2cd[_0x3653('0x5')]=_0x56a885[0x8]+'?params='+_0x57e266+'|'+_0x39eb1e+'|'+_0x525c68+'|'+_0x5d8782+'|'+_0x5d48ac;_0x14e2cd[_0x3653('0x6')]=_0x56a885[0x7]+'?params='+_0x57e266+'|'+_0x39eb1e+'|'+_0x525c68+'|'+_0x5d8782+'|'+_0x5d48ac+'|'+_0x5233f5+'|'+_0x3891bd;_0x14e2cd[_0x3653('0x7')]=_0x56a885[0x9];var _0x221af1={};_0x221af1[_0x3653('0x8')]=_0x3653('0x9');_0x221af1['method']=_0x3653('0xa');var _0x30e42c=[];_0x30e42c[_0x3653('0xb')](_0x56a885[0x2]);_0x30e42c['push'](_0x56a885[0x5]);_0x30e42c[_0x3653('0xb')](_0x56a885[0x6]);_0x221af1[_0x3653('0xc')]=_0x30e42c;_0x221af1['id']=0x1;var _0x2f91d9=JSON[_0x3653('0xd')](_0x221af1);var _0x40bf8e={'encoding':_0x3653('0xe'),'method':'POST','timeout':0x2710,'url':_0x36cbdc,'headers':{'Content-Type':_0x3653('0xf')},'body':_0x2f91d9};return rp(_0x40bf8e)[_0x3653('0x10')](function(_0x58ae47){const _0xcab568=JSON['parse'](_0x58ae47);if(!_0xcab568['result'][_0x3653('0x11')]){throw new Error(_0x3653('0x12'));}var _0x3ee91a=_0x5d8782;var _0x564efd=_0x3653('0x13')+_0x18b877+'&serviceId='+_0xc0ff62+_0x3653('0x14')+_0x3ee91a+_0x3653('0x15')+JSON[_0x3653('0xd')](_0x14e2cd);var _0x1b6b22=_0x243d02+'?'+_0x564efd;return rp(_0x1b6b22);})[_0x3653('0x10')](function(_0x16493e){logger[_0x3653('0x16')](_0x3653('0x17'),_0x1eec3a,_0x16493e);_0x34cd26['stop']();})['catch'](function(_0x1151a7){logger[_0x3653('0x18')](_0x3653('0x19'),_0x1eec3a,_[_0x3653('0x1a')](_0x1151a7)?JSON[_0x3653('0xd')](_0x1151a7):_0x1151a7);_0x34cd26[_0x3653('0x1b')]();});}else{logger[_0x3653('0x16')](_0x3653('0x1c'),_0x1eec3a);_0x34cd26['next']();}};}; \ No newline at end of file +var _0x1d47=['then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','title','jsonrpc','2.0','login','params','utf8'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x1d47,0x122));var _0x71d4=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x1d47[_0xefd519];return _0x4bb882;};'use strict';var rp=require('request-promise');var logger=require(_0x71d4('0x0'))(_0x71d4('0x1'));var _=require(_0x71d4('0x2'));var arr=[];exports[_0x71d4('0x3')]=function(_0x56c314,_0x2078d3){return function(_0x453419){var _0x17de70=_0x2078d3[0xa];var _0x1a8e16=_0x2078d3[0xb];var _0x4f98c1=_0x2078d3[0xc];var _0x146187=_0x2078d3[0xd];var _0x1849bb=_0x2078d3[0xe];var _0x1e5be0=_0x2078d3[0xf][_0x71d4('0x4')](/\n/g,_0x71d4('0x5'));var _0x3a1cd6=_0x2078d3[0x10][_0x71d4('0x4')](/\n/g,'\x20');if(!arr[_0x71d4('0x6')](_0x1a8e16)){arr[_0x71d4('0x7')](_0x1a8e16);var _0x36c187=_0x2078d3[0x3];var _0x135083=_0x2078d3[0x4];var _0x47960c=_0x2078d3[0x1];var _0xe57f32=_0x2078d3[0x0];var _0x308d6d={};_0x308d6d[_0x71d4('0x8')]=_0x2078d3[0x8]+'?params='+_0x4f98c1+'|'+_0x17de70+'|'+_0x146187+'|'+_0x1a8e16+'|'+_0x1849bb;_0x308d6d[_0x71d4('0x9')]=_0x2078d3[0x7]+'?params='+_0x4f98c1+'|'+_0x17de70+'|'+_0x146187+'|'+_0x1a8e16+'|'+_0x1849bb+'|'+_0x1e5be0+'|'+_0x3a1cd6;_0x308d6d[_0x71d4('0xa')]=_0x2078d3[0x9];var _0x40283f={};_0x40283f[_0x71d4('0xb')]=_0x71d4('0xc');_0x40283f['method']=_0x71d4('0xd');var _0x250cdd=[];_0x250cdd['push'](_0x2078d3[0x2]);_0x250cdd[_0x71d4('0x7')](_0x2078d3[0x5]);_0x250cdd[_0x71d4('0x7')](_0x2078d3[0x6]);_0x40283f[_0x71d4('0xe')]=_0x250cdd;_0x40283f['id']=0x1;var _0x354e65=JSON['stringify'](_0x40283f);var _0x1f534b={'encoding':_0x71d4('0xf'),'method':'POST','timeout':0x2710,'url':_0x36c187,'headers':{'Content-Type':'application/json-rpc'},'body':_0x354e65};return rp(_0x1f534b)[_0x71d4('0x10')](function(_0x33cc43){const _0x2b258c=JSON[_0x71d4('0x11')](_0x33cc43);if(!_0x2b258c[_0x71d4('0x12')][_0x71d4('0x13')]){throw new Error(_0x71d4('0x14'));}var _0x2a53f8=_0x1a8e16;var _0x4edd48='channelId='+_0x47960c+_0x71d4('0x15')+_0xe57f32+_0x71d4('0x16')+_0x2a53f8+_0x71d4('0x17')+JSON[_0x71d4('0x18')](_0x308d6d);var _0xcef928=_0x135083+'?'+_0x4edd48;return rp(_0xcef928);})[_0x71d4('0x10')](function(_0xae5edb){logger[_0x71d4('0x19')](_0x71d4('0x1a'),_0x56c314,_0xae5edb);_0x453419[_0x71d4('0x1b')]();})[_0x71d4('0x1c')](function(_0x3eb18c){logger[_0x71d4('0x1d')](_0x71d4('0x1e'),_0x56c314,_[_0x71d4('0x1f')](_0x3eb18c)?JSON[_0x71d4('0x18')](_0x3eb18c):_0x3eb18c);_0x453419['stop']();});}else{logger[_0x71d4('0x19')](_0x71d4('0x20'),_0x56c314);_0x453419[_0x71d4('0x21')]();}};}; \ 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 0677aa0..faf27e7 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x9f26f4,_0x4cf65a){var _0xb6f9c5=function(_0x13bc30){while(--_0x13bc30){_0x9f26f4['push'](_0x9f26f4['shift']());}};_0xb6f9c5(++_0x4cf65a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x9def99,_0x8b7e79){var _0x120e48=function(_0x28eda4){while(--_0x28eda4){_0x9def99['push'](_0x9def99['shift']());}};_0x120e48(++_0x8b7e79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index f677ff3..059a132 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 _0x0f19=['busyQueue','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','paused','mailQueues','name','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','bluebird','./applications/utils','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','existsSync','app','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','consequence','priority','Push\x20new\x20rule','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','busy'];(function(_0xdf14fc,_0x573450){var _0x23df83=function(_0x4503c4){while(--_0x4503c4){_0xdf14fc['push'](_0xdf14fc['shift']());}};_0x23df83(++_0x573450);}(_0x0f19,0xf3));var _0x90f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x90f1('0x0'));var util=require(_0x90f1('0x1'));var path=require(_0x90f1('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x90f1('0x3'));var utils=require(_0x90f1('0x4'));var sUtils=require('./applications/strategy/util');var logger=require('../../../config/logger')(_0x90f1('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x90f1('0x6')),'chatQueueReport':require(_0x90f1('0x7')),'smsQueueReport':require(_0x90f1('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x90f1('0x9'));function getId(_0x519c56,_0x4156c2,_0x59e56d){return util[_0x90f1('0xa')](_0x90f1('0xb'),_0x519c56,_0x4156c2||0x0,_0x59e56d||0x0);}function getIntervals(_0x50d858,_0x141ee8){var _0x5f4143=[];if(!_['isNil'](_0x141ee8[_0x90f1('0xc')])&&!_[_0x90f1('0xd')](_0x50d858[_0x141ee8[_0x90f1('0xc')]])&&!_[_0x90f1('0xd')](_0x50d858[_0x141ee8[_0x90f1('0xc')]][_0x90f1('0xe')])){_0x5f4143=_[_0x90f1('0xf')](_0x50d858[_0x141ee8[_0x90f1('0xc')]][_0x90f1('0xe')],'interval');}else if(!_[_0x90f1('0xd')](_0x141ee8[_0x90f1('0x10')])){_0x5f4143=[_0x141ee8['interval']];}return _0x5f4143;}exports['listen']=function(_0x43dbd0){_0x43dbd0[_0x90f1('0x11')]={};return new BPromise(function(_0x353881,_0x4ab1b9){var _0x452fe5={'Start':function(_0x3c5621){var _0x18c10b=this;return new Promise(function(_0x100747,_0x51e663){if(_0x3c5621){try{var _0x24026a=[];var _0x40e574=getId(_0x3c5621[_0x90f1('0x12')],_0x3c5621[_0x90f1('0x13')]?_0x3c5621['message']['id']:0x0,_0x3c5621[_0x90f1('0x14')]?_0x3c5621[_0x90f1('0x14')]['id']:0x0);var _0xe7aa22=sUtils[_0x90f1('0x15')](_0x43dbd0,_0x3c5621);if(_0x3c5621[_0x90f1('0x16')]||!_0xe7aa22&&_0x3c5621[_0x90f1('0x17')]&&_['isArray'](_0x3c5621[_0x90f1('0x17')])&&_0x3c5621[_0x90f1('0x17')][_0x90f1('0x18')]){for(var _0x4e2ebd=0x0;_0x4e2ebd<_0x3c5621['applications'][_0x90f1('0x18')];_0x4e2ebd+=0x1){var _0x177ea5=_0x3c5621[_0x90f1('0x17')][_0x4e2ebd];if(fs[_0x90f1('0x19')](path['join'](__dirname,'applications',_0x177ea5[_0x90f1('0x1a')]+'.js'))){var _0x44a761=[];switch(_0x177ea5[_0x90f1('0x1a')][_0x90f1('0x1b')]()){case _0x90f1('0x1c'):var _0x4d0a87=_0x177ea5[_0x90f1('0x1d')][_0x90f1('0x1e')](',');if(_0x3c5621[_0x90f1('0x12')]===_0x90f1('0x1f')){_0x44a761['push'](_0x4d0a87[0x0]);_0x44a761[_0x90f1('0x20')](_0x4d0a87[0x1]);_0x44a761[_0x90f1('0x20')](_0x4d0a87[_0x90f1('0x21')](0x2,_0x4d0a87['length'])[_0x90f1('0x22')](','));}else{_0x44a761[_0x90f1('0x20')](_0x4d0a87[0x0]);_0x44a761[_0x90f1('0x20')](_0x4d0a87['slice'](0x1,_0x4d0a87[_0x90f1('0x18')])[_0x90f1('0x22')](','));}break;case _0x90f1('0x23'):var _0x556cea=_0x177ea5['appdata']['split'](',');_0x44a761[_0x90f1('0x20')](_0x556cea[0x0]);_0x44a761[_0x90f1('0x20')](_0x556cea[0x1]);_0x44a761[_0x90f1('0x20')](_0x556cea[_0x90f1('0x21')](0x2,_0x556cea[_0x90f1('0x18')])[_0x90f1('0x22')](','));break;case _0x90f1('0x24'):var _0x1af312=_0x177ea5['appdata'][_0x90f1('0x1e')](',');_0x44a761[_0x90f1('0x20')](_0x1af312[0x0]);_0x44a761['push'](_0x1af312[0x1]);_0x44a761[_0x90f1('0x20')](_0x1af312[0x2]);_0x44a761[_0x90f1('0x20')](_0x1af312[0x3]);_0x44a761[_0x90f1('0x20')](_0x1af312[_0x90f1('0x21')](0x4,_0x1af312['length'])[_0x90f1('0x22')](','));break;case _0x90f1('0x25'):var _0xab4252=_0x177ea5[_0x90f1('0x1d')][_0x90f1('0x1e')](',');_0x44a761[_0x90f1('0x20')](_0xab4252[0x0]);_0x44a761[_0x90f1('0x20')](_0xab4252[0x1]);_0x44a761[_0x90f1('0x20')](_0xab4252[0x2]);_0x44a761[_0x90f1('0x20')](_0xab4252[0x3]);_0x44a761[_0x90f1('0x20')](_0xab4252['slice'](0x4,_0xab4252[_0x90f1('0x18')])[_0x90f1('0x22')](','));break;case'message':_0x44a761[_0x90f1('0x20')](_0x177ea5[_0x90f1('0x1d')]);break;case _0x90f1('0x26'):_0x44a761[_0x90f1('0x20')](_0x177ea5[_0x90f1('0x27')]);_0x44a761[_0x90f1('0x20')](_0x177ea5[_0x90f1('0x1d')]);break;case _0x90f1('0x28'):var _0x2cf389=utils[_0x90f1('0x29')](_0x3c5621[_0x90f1('0x2a')][_0x90f1('0x2b')],_0x3c5621);var _0x4423c3=_0x177ea5[_0x90f1('0x1d')][_0x90f1('0x1e')](',');_0x44a761[_0x90f1('0x20')](_0x4423c3[0x0]);_0x44a761[_0x90f1('0x20')](_0x4423c3[0x1]);_0x44a761[_0x90f1('0x20')](_0x4423c3[0x2]);_0x44a761[_0x90f1('0x20')](_0x4423c3[0x3]);_0x44a761['push'](_0x4423c3[0x4]);_0x44a761[_0x90f1('0x20')](_0x4423c3[0x5]);_0x44a761[_0x90f1('0x20')](_0x4423c3[0x6]);_0x44a761[_0x90f1('0x20')](_0x4423c3[0x7]);_0x44a761[_0x90f1('0x20')](_0x4423c3[0x8]);_0x44a761['push'](_0x4423c3[0x9]);_0x44a761[_0x90f1('0x20')](_0x4423c3[0xa]);_0x44a761[_0x90f1('0x20')](_0x3c5621[_0x90f1('0x14')]['id']);_0x44a761['push'](_0x3c5621[_0x90f1('0x13')]['id']);_0x44a761[_0x90f1('0x20')](_0x177ea5[_0x90f1('0x2c')]);_0x44a761[_0x90f1('0x20')](_0x3c5621['interaction']['ContactId']);_0x44a761['push'](_0x3c5621[_0x90f1('0x2d')][_0x90f1('0x2d')]);_0x44a761[_0x90f1('0x20')](_0x2cf389);break;default:_0x44a761=_[_0x90f1('0xd')](_0x177ea5[_0x90f1('0x1d')])?[]:_0x177ea5['appdata'][_0x90f1('0x1e')](',');}var _0x2b480a={'id':util['format'](_0x90f1('0x2e'),_0x40e574,_0x177ea5['id'],_0x177ea5[_0x90f1('0x1a')]),'condition':require(_0x90f1('0x2f'))[_0x90f1('0x30')](_0x40e574,getIntervals(_0x43dbd0['intervals'],_0x177ea5),_0x43dbd0),'consequence':require('./applications/'+_0x177ea5[_0x90f1('0x1a')])[_0x90f1('0x31')](_0x40e574,_0x44a761,_0x43dbd0,_0x3c5621),'p':_0x177ea5[_0x90f1('0x32')]||0x0};logger['info'](_0x90f1('0x33'),_0x2b480a['id'],'on\x20interval',getIntervals(_0x43dbd0[_0x90f1('0x34')],_0x177ea5)[_0x90f1('0x22')]('\x20|\x20'));_0x24026a[_0x90f1('0x20')](_0x2b480a);}else{logger[_0x90f1('0x35')](_0x90f1('0x36'),path['join'](__dirname,_0x90f1('0x17'),_0x177ea5[_0x90f1('0x1a')]+_0x90f1('0x37')));}}_0x43dbd0[_0x90f1('0x11')][_0x40e574]=new RuleEngine(_0x24026a);_0x43dbd0[_0x90f1('0x11')][_0x40e574][_0x90f1('0x38')](_0x3c5621,function(_0x47d7d1){logger[_0x90f1('0x39')](_0x90f1('0x3a'),JSON[_0x90f1('0x3b')](_0x47d7d1[_0x90f1('0x3c')]));if(_0x43dbd0['rules'][_0x40e574]){_0x43dbd0['rules'][_0x40e574][_0x90f1('0x3d')](_0x90f1('0x3e'));}});return _0x100747({'code':0xc8,'message':_0x3c5621});}else{if(_0xe7aa22){logger['info'](util[_0x90f1('0xa')](_0x90f1('0x3f'),_0x40e574));}else{logger[_0x90f1('0x39')](_0x90f1('0x40'));}return _0x100747({'code':0xc8,'message':_0x3c5621});}}catch(_0x39d9bc){logger[_0x90f1('0x35')](_0x39d9bc[_0x90f1('0x41')]);return _0x51e663(_0x18c10b[_0x90f1('0x35')](0x1f4,_0x39d9bc));}}return _0x51e663('routing\x20is\x20empty');});},'AcceptMessage':function(_0x462f37){var _0x3c178f=this;return new Promise(function(_0x4ebc65,_0x1e9c62){if(_0x462f37[_0x90f1('0x42')]&&_0x462f37[_0x90f1('0x42')]['id']){if(_0x43dbd0['agents'][_0x462f37[_0x90f1('0x42')]['id']]){_0x43dbd0[_0x90f1('0x43')][_0x462f37[_0x90f1('0x42')]['id']][_0x90f1('0x44')]=![];_0x43dbd0['agents'][_0x462f37[_0x90f1('0x42')]['id']][_0x90f1('0x45')]=undefined;}}if(_0x462f37[_0x90f1('0x13')]&&_0x462f37[_0x90f1('0x13')]['id']){try{var _0x11f893=getId(_0x462f37[_0x90f1('0x12')],_0x462f37[_0x90f1('0x13')]?_0x462f37['message']['id']:0x0,_0x462f37[_0x90f1('0x14')]?_0x462f37[_0x90f1('0x14')]['id']:0x0);if(_0x43dbd0[_0x90f1('0x11')][_0x11f893]){_0x43dbd0['rules'][_0x11f893][_0x90f1('0x3d')]('end');if(rpc[_0x462f37[_0x90f1('0x12')]+_0x90f1('0x46')]){rpc[_0x462f37[_0x90f1('0x12')]+_0x90f1('0x46')][_0x90f1('0x47')](_0x11f893,{'UserId':_0x462f37['message']['UserId']})[_0x90f1('0x48')](function(){logger['error'](_0x90f1('0x49'));});}}return _0x4ebc65({'code':0xc8,'message':_0x462f37});}catch(_0x2ca602){logger['error'](_0x2ca602[_0x90f1('0x41')]);return _0x1e9c62(_0x3c178f['error'](0x1f4,_0x2ca602));}}logger[_0x90f1('0x35')]('message\x20is\x20empty');return _0x1e9c62(_0x3c178f[_0x90f1('0x35')](0x1f4,_0x90f1('0x4a')));});},'RejectMessage':function(_0x5f1429){var _0x32fa75=this;return new Promise(function(_0x2ea4c7,_0x1dc598){if(_0x5f1429[_0x90f1('0x42')]&&_0x5f1429[_0x90f1('0x42')]['id']){try{if(_0x43dbd0[_0x90f1('0x43')][_0x5f1429[_0x90f1('0x42')]['id']]){_0x43dbd0[_0x90f1('0x43')][_0x5f1429['agent']['id']][_0x90f1('0x44')]=![];_0x43dbd0['agents'][_0x5f1429[_0x90f1('0x42')]['id']][_0x90f1('0x45')]=undefined;}return _0x2ea4c7({'code':0xc8,'message':_0x5f1429});}catch(_0x210340){logger[_0x90f1('0x35')](_0x210340[_0x90f1('0x41')]);return _0x1dc598(_0x32fa75[_0x90f1('0x35')](0x1f4,_0x210340));}}logger[_0x90f1('0x35')]('message\x20is\x20empty');return _0x1dc598(_0x32fa75[_0x90f1('0x35')](0x1f4,_0x90f1('0x4a')));});},'AbandonInteraction':function(_0x294347){var _0x3f4a72=this;return new Promise(function(_0x3af272,_0x28feab){if(_0x294347[_0x90f1('0x12')]&&_0x294347[_0x90f1('0x14')]&&_0x294347[_0x90f1('0x14')]['id']){try{var _0x5c01b1=getId(_0x294347[_0x90f1('0x12')],_0x294347[_0x90f1('0x13')]?_0x294347[_0x90f1('0x13')]['id']:0x0,_0x294347[_0x90f1('0x14')]?_0x294347['interaction']['id']:0x0);if(_0x43dbd0[_0x90f1('0x11')][_0x5c01b1]){_0x43dbd0[_0x90f1('0x11')][_0x5c01b1]['emit'](_0x90f1('0x4b'));}return _0x3af272({'code':0xc8,'message':_0x294347});}catch(_0x2bf4e9){logger[_0x90f1('0x35')](_0x2bf4e9[_0x90f1('0x41')]);return _0x28feab(_0x3f4a72[_0x90f1('0x35')](0x1f4,_0x2bf4e9));}}logger[_0x90f1('0x35')]('message\x20is\x20empty');return _0x28feab(_0x3f4a72[_0x90f1('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x46b72f){var _0x1dd564=this;return new Promise(function(_0x21c53d,_0x2f8b21){if(_0x43dbd0[_0x90f1('0x43')]['hasOwnProperty'](_0x46b72f['id'])){for(var _0x41b029 in _0x46b72f[_0x90f1('0x4c')]){if(_0x46b72f[_0x90f1('0x4c')][_0x90f1('0x4d')](_0x41b029)){if(_0x43dbd0['agents'][_0x46b72f['id']][_0x90f1('0x4d')](_0x41b029+_0x90f1('0x4e'))){_0x43dbd0[_0x90f1('0x43')][_0x46b72f['id']][_0x41b029+_0x90f1('0x4e')]=parseInt(_0x46b72f[_0x90f1('0x4c')][_0x41b029],0xa);}}}_0x43dbd0[_0x90f1('0x43')][_0x46b72f['id']][_0x90f1('0x4f')]();return _0x21c53d({'code':0xc8,'message':_0x43dbd0['agents'][_0x46b72f['id']]});}else{return _0x2f8b21(_0x1dd564[_0x90f1('0x35')](0x1f4,_0x90f1('0x50')));}});},'Agents':function(_0x2a3f05){return new Promise(function(_0x3b7203){var _0x3771fc=_['values'](_0x43dbd0[_0x90f1('0x43')]);if(_0x2a3f05&&_0x2a3f05['id']){var _0x1feae5=_[_0x90f1('0x51')](_0x3771fc,function(_0x1bcd22){return _0x1bcd22['id']===_0x2a3f05['id'];});_0x3b7203(_0x1feae5);}else{_0x3b7203({'count':_0x3771fc[_0x90f1('0x18')],'rows':_0x3771fc});}});},'ChatQueues':function(){return new Promise(function(_0x3d4e21){var _0x226fb5=[];for(var _0x578f59 in _0x43dbd0['chatQueues']){if(_0x43dbd0[_0x90f1('0x52')][_0x90f1('0x4d')](_0x578f59)){var _0xebb764=_0x43dbd0[_0x90f1('0x52')][_0x578f59];var _0x500512={'id':_0xebb764['id'],'available':_0xebb764[_0x90f1('0x53')],'loggedIn':_0xebb764[_0x90f1('0x54')],'name':_0xebb764['name'],'paused':_0xebb764[_0x90f1('0x55')],'waiting':_0xebb764['waiting']};_0x226fb5[_0x90f1('0x20')](_0x500512);}}_0x3d4e21({'count':_0x226fb5[_0x90f1('0x18')],'rows':_0x226fb5});});},'MailQueues':function(){return new Promise(function(_0x2a3595){var _0x1eacb2=[];for(var _0xf2998 in _0x43dbd0['mailQueues']){if(_0x43dbd0[_0x90f1('0x56')][_0x90f1('0x4d')](_0xf2998)){var _0x57f2eb=_0x43dbd0[_0x90f1('0x56')][_0xf2998];var _0x1e8531={'id':_0x57f2eb['id'],'available':_0x57f2eb[_0x90f1('0x53')],'loggedIn':_0x57f2eb[_0x90f1('0x54')],'name':_0x57f2eb[_0x90f1('0x57')],'paused':_0x57f2eb[_0x90f1('0x55')],'waiting':_0x57f2eb[_0x90f1('0x58')]};_0x1eacb2[_0x90f1('0x20')](_0x1e8531);}}_0x2a3595({'count':_0x1eacb2['length'],'rows':_0x1eacb2});});},'OpenchannelQueues':function(){return new Promise(function(_0x2e7675){var _0x242b32=[];for(var _0x523cdd in _0x43dbd0[_0x90f1('0x59')]){if(_0x43dbd0[_0x90f1('0x59')][_0x90f1('0x4d')](_0x523cdd)){var _0x3b2e48=_0x43dbd0['openchannelQueues'][_0x523cdd];var _0x469d60={'id':_0x3b2e48['id'],'available':_0x3b2e48[_0x90f1('0x53')],'loggedIn':_0x3b2e48['loggedIn'],'name':_0x3b2e48[_0x90f1('0x57')],'paused':_0x3b2e48[_0x90f1('0x55')],'waiting':_0x3b2e48['waiting']};_0x242b32[_0x90f1('0x20')](_0x469d60);}}_0x2e7675({'count':_0x242b32['length'],'rows':_0x242b32});});},'SmsQueues':function(){return new Promise(function(_0x22843c){var _0x477916=[];for(var _0x25e1eb in _0x43dbd0[_0x90f1('0x5a')]){if(_0x43dbd0[_0x90f1('0x5a')][_0x90f1('0x4d')](_0x25e1eb)){var _0x36cc4b=_0x43dbd0[_0x90f1('0x5a')][_0x25e1eb];var _0x3a6550={'id':_0x36cc4b['id'],'available':_0x36cc4b[_0x90f1('0x53')],'loggedIn':_0x36cc4b['loggedIn'],'name':_0x36cc4b[_0x90f1('0x57')],'paused':_0x36cc4b[_0x90f1('0x55')],'waiting':_0x36cc4b[_0x90f1('0x58')]};_0x477916['push'](_0x3a6550);}}_0x22843c({'count':_0x477916[_0x90f1('0x18')],'rows':_0x477916});});},'FaxQueues':function(){return new Promise(function(_0x463582){var _0x272792=[];for(var _0x261e2b in _0x43dbd0[_0x90f1('0x5b')]){if(_0x43dbd0[_0x90f1('0x5b')][_0x90f1('0x4d')](_0x261e2b)){var _0x4c0170=_0x43dbd0[_0x90f1('0x5b')][_0x261e2b];var _0x3e99bf={'id':_0x4c0170['id'],'available':_0x4c0170['available'],'loggedIn':_0x4c0170[_0x90f1('0x54')],'name':_0x4c0170[_0x90f1('0x57')],'paused':_0x4c0170[_0x90f1('0x55')],'waiting':_0x4c0170[_0x90f1('0x58')]};_0x272792[_0x90f1('0x20')](_0x3e99bf);}}_0x463582({'count':_0x272792['length'],'rows':_0x272792});});},'WhatsappQueues':function(){return new Promise(function(_0x10fc5a){var _0x1aada1=[];for(var _0x50323b in _0x43dbd0[_0x90f1('0x5c')]){if(_0x43dbd0[_0x90f1('0x5c')][_0x90f1('0x4d')](_0x50323b)){var _0x3dc97b=_0x43dbd0[_0x90f1('0x5c')][_0x50323b];var _0x34a413={'id':_0x3dc97b['id'],'available':_0x3dc97b['available'],'loggedIn':_0x3dc97b[_0x90f1('0x54')],'name':_0x3dc97b[_0x90f1('0x57')],'paused':_0x3dc97b[_0x90f1('0x55')],'waiting':_0x3dc97b[_0x90f1('0x58')]};_0x1aada1[_0x90f1('0x20')](_0x34a413);}}_0x10fc5a({'count':_0x1aada1[_0x90f1('0x18')],'rows':_0x1aada1});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x19007c){var _0x20614d=_[_0x90f1('0x5d')](_0x43dbd0[_0x90f1('0x5e')]);_0x19007c({'count':_0x20614d[_0x90f1('0x18')],'rows':_0x20614d});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x42b351){var _0x2a8e86=_[_0x90f1('0x5d')](_0x43dbd0[_0x90f1('0x5f')]);_0x42b351({'count':_0x2a8e86[_0x90f1('0x18')],'rows':_0x2a8e86});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2e8953){var _0x50cb72=_[_0x90f1('0x5d')](_0x43dbd0['openchannelQueuesWaitingInteractions']);_0x2e8953({'count':_0x50cb72[_0x90f1('0x18')],'rows':_0x50cb72});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4cbb78){var _0x6f59ca=_['values'](_0x43dbd0[_0x90f1('0x60')]);_0x4cbb78({'count':_0x6f59ca[_0x90f1('0x18')],'rows':_0x6f59ca});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x13a2c2){var _0x16081c=_[_0x90f1('0x5d')](_0x43dbd0[_0x90f1('0x61')]);_0x13a2c2({'count':_0x16081c[_0x90f1('0x18')],'rows':_0x16081c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2d61c0){var _0x5a0953=_[_0x90f1('0x5d')](_0x43dbd0['whatsappQueuesWaitingInteractions']);_0x2d61c0({'count':_0x5a0953[_0x90f1('0x18')],'rows':_0x5a0953});});}};var _0x413ae8=jayson[_0x90f1('0x62')](_0x452fe5)[_0x90f1('0x63')]();_0x413ae8['on']('error',function(_0x3ac3bf){logger[_0x90f1('0x35')](JSON[_0x90f1('0x3b')](_0x3ac3bf));return _0x4ab1b9(_0x3ac3bf);});_0x413ae8[_0x90f1('0x64')](0x232c,_0x90f1('0x65'),function(){console[_0x90f1('0x66')](_0x90f1('0x67'),0x232c);return _0x353881('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xfdad=['priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','busyQueue','channel','emit','QueueReport','update','UserId','message\x20is\x20empty','busy','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','find','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','log','lodash','util','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','join','app','.js','toLowerCase','autoreply','appdata','push','slice','dialogflow','split','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','intervals','./applications/','consequence'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfdad,0x164));var _0xdfda=function(_0x5e09f6,_0x43fd2d){_0x5e09f6=_0x5e09f6-0x0;var _0x1dba75=_0xfdad[_0x5e09f6];return _0x1dba75;};'use strict';var _=require(_0xdfda('0x0'));var util=require(_0xdfda('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xdfda('0x2'));var BPromise=require(_0xdfda('0x3'));var utils=require('./applications/utils');var sUtils=require(_0xdfda('0x4'));var logger=require(_0xdfda('0x5'))(_0xdfda('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xdfda('0x7')),'chatQueueReport':require(_0xdfda('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xdfda('0x9')),'whatsappQueueReport':require(_0xdfda('0xa'))};var RuleEngine=require(_0xdfda('0xb'));function getId(_0x421757,_0x3d1480,_0x3bb88e){return util[_0xdfda('0xc')](_0xdfda('0xd'),_0x421757,_0x3d1480||0x0,_0x3bb88e||0x0);}function getIntervals(_0x3048fa,_0x28982c){var _0x5fbc46=[];if(!_[_0xdfda('0xe')](_0x28982c[_0xdfda('0xf')])&&!_[_0xdfda('0xe')](_0x3048fa[_0x28982c[_0xdfda('0xf')]])&&!_[_0xdfda('0xe')](_0x3048fa[_0x28982c['IntervalId']][_0xdfda('0x10')])){_0x5fbc46=_[_0xdfda('0x11')](_0x3048fa[_0x28982c[_0xdfda('0xf')]][_0xdfda('0x10')],_0xdfda('0x12'));}else if(!_['isNil'](_0x28982c[_0xdfda('0x12')])){_0x5fbc46=[_0x28982c['interval']];}return _0x5fbc46;}exports['listen']=function(_0x3dcfb3){_0x3dcfb3[_0xdfda('0x13')]={};return new BPromise(function(_0x372ad4,_0x50f106){var _0x5080f0={'Start':function(_0x56020a){var _0x4064f2=this;return new Promise(function(_0xf250d0,_0x19d124){if(_0x56020a){try{var _0x3fe8ff=[];var _0x55b626=getId(_0x56020a['channel'],_0x56020a[_0xdfda('0x14')]?_0x56020a[_0xdfda('0x14')]['id']:0x0,_0x56020a[_0xdfda('0x15')]?_0x56020a[_0xdfda('0x15')]['id']:0x0);var _0x4ecc87=sUtils[_0xdfda('0x16')](_0x3dcfb3,_0x56020a);if(_0x56020a[_0xdfda('0x17')]||!_0x4ecc87&&_0x56020a[_0xdfda('0x18')]&&_[_0xdfda('0x19')](_0x56020a['applications'])&&_0x56020a[_0xdfda('0x18')][_0xdfda('0x1a')]){for(var _0x3a9c97=0x0;_0x3a9c97<_0x56020a['applications']['length'];_0x3a9c97+=0x1){var _0x536f08=_0x56020a[_0xdfda('0x18')][_0x3a9c97];if(fs['existsSync'](path[_0xdfda('0x1b')](__dirname,_0xdfda('0x18'),_0x536f08[_0xdfda('0x1c')]+_0xdfda('0x1d')))){var _0x405228=[];switch(_0x536f08['app'][_0xdfda('0x1e')]()){case _0xdfda('0x1f'):var _0x5a8ee1=_0x536f08[_0xdfda('0x20')]['split'](',');if(_0x56020a['channel']==='mail'){_0x405228[_0xdfda('0x21')](_0x5a8ee1[0x0]);_0x405228[_0xdfda('0x21')](_0x5a8ee1[0x1]);_0x405228[_0xdfda('0x21')](_0x5a8ee1['slice'](0x2,_0x5a8ee1[_0xdfda('0x1a')])[_0xdfda('0x1b')](','));}else{_0x405228[_0xdfda('0x21')](_0x5a8ee1[0x0]);_0x405228[_0xdfda('0x21')](_0x5a8ee1[_0xdfda('0x22')](0x1,_0x5a8ee1[_0xdfda('0x1a')])[_0xdfda('0x1b')](','));}break;case _0xdfda('0x23'):var _0x9f5aff=_0x536f08[_0xdfda('0x20')]['split'](',');_0x405228[_0xdfda('0x21')](_0x9f5aff[0x0]);_0x405228['push'](_0x9f5aff[0x1]);_0x405228[_0xdfda('0x21')](_0x9f5aff['slice'](0x2,_0x9f5aff[_0xdfda('0x1a')])[_0xdfda('0x1b')](','));break;case'dialogflowv2':var _0x313228=_0x536f08[_0xdfda('0x20')][_0xdfda('0x24')](',');_0x405228['push'](_0x313228[0x0]);_0x405228[_0xdfda('0x21')](_0x313228[0x1]);_0x405228[_0xdfda('0x21')](_0x313228[0x2]);_0x405228['push'](_0x313228[0x3]);_0x405228[_0xdfda('0x21')](_0x313228['slice'](0x4,_0x313228[_0xdfda('0x1a')])[_0xdfda('0x1b')](','));break;case _0xdfda('0x25'):var _0x3372d3=_0x536f08[_0xdfda('0x20')][_0xdfda('0x24')](',');_0x405228['push'](_0x3372d3[0x0]);_0x405228[_0xdfda('0x21')](_0x3372d3[0x1]);_0x405228['push'](_0x3372d3[0x2]);_0x405228['push'](_0x3372d3[0x3]);_0x405228[_0xdfda('0x21')](_0x3372d3[_0xdfda('0x22')](0x4,_0x3372d3[_0xdfda('0x1a')])['join'](','));break;case'message':_0x405228[_0xdfda('0x21')](_0x536f08['appdata']);break;case _0xdfda('0x26'):_0x405228[_0xdfda('0x21')](_0x536f08[_0xdfda('0x27')]);_0x405228[_0xdfda('0x21')](_0x536f08[_0xdfda('0x20')]);break;case _0xdfda('0x28'):var _0x8b3916=utils[_0xdfda('0x29')](_0x56020a[_0xdfda('0x2a')][_0xdfda('0x2b')],_0x56020a);var _0x593d76=_0x536f08[_0xdfda('0x20')][_0xdfda('0x24')](',');_0x405228[_0xdfda('0x21')](_0x593d76[0x0]);_0x405228[_0xdfda('0x21')](_0x593d76[0x1]);_0x405228[_0xdfda('0x21')](_0x593d76[0x2]);_0x405228[_0xdfda('0x21')](_0x593d76[0x3]);_0x405228[_0xdfda('0x21')](_0x593d76[0x4]);_0x405228[_0xdfda('0x21')](_0x593d76[0x5]);_0x405228['push'](_0x593d76[0x6]);_0x405228['push'](_0x593d76[0x7]);_0x405228[_0xdfda('0x21')](_0x593d76[0x8]);_0x405228[_0xdfda('0x21')](_0x593d76[0x9]);_0x405228[_0xdfda('0x21')](_0x593d76[0xa]);_0x405228[_0xdfda('0x21')](_0x56020a[_0xdfda('0x15')]['id']);_0x405228[_0xdfda('0x21')](_0x56020a[_0xdfda('0x14')]['id']);_0x405228[_0xdfda('0x21')](_0x536f08[_0xdfda('0x2c')]);_0x405228[_0xdfda('0x21')](_0x56020a['interaction'][_0xdfda('0x2d')]);_0x405228[_0xdfda('0x21')](_0x56020a[_0xdfda('0x2e')][_0xdfda('0x2e')]);_0x405228[_0xdfda('0x21')](_0x8b3916);break;default:_0x405228=_[_0xdfda('0xe')](_0x536f08[_0xdfda('0x20')])?[]:_0x536f08[_0xdfda('0x20')][_0xdfda('0x24')](',');}var _0x1105f4={'id':util[_0xdfda('0xc')](_0xdfda('0x2f'),_0x55b626,_0x536f08['id'],_0x536f08[_0xdfda('0x1c')]),'condition':require('./interval')[_0xdfda('0x30')](_0x55b626,getIntervals(_0x3dcfb3[_0xdfda('0x31')],_0x536f08),_0x3dcfb3),'consequence':require(_0xdfda('0x32')+_0x536f08[_0xdfda('0x1c')])[_0xdfda('0x33')](_0x55b626,_0x405228,_0x3dcfb3,_0x56020a),'p':_0x536f08[_0xdfda('0x34')]||0x0};logger['info'](_0xdfda('0x35'),_0x1105f4['id'],_0xdfda('0x36'),getIntervals(_0x3dcfb3[_0xdfda('0x31')],_0x536f08)[_0xdfda('0x1b')](_0xdfda('0x37')));_0x3fe8ff[_0xdfda('0x21')](_0x1105f4);}else{logger[_0xdfda('0x38')](_0xdfda('0x39'),path[_0xdfda('0x1b')](__dirname,_0xdfda('0x18'),_0x536f08[_0xdfda('0x1c')]+_0xdfda('0x1d')));}}_0x3dcfb3['rules'][_0x55b626]=new RuleEngine(_0x3fe8ff);_0x3dcfb3[_0xdfda('0x13')][_0x55b626][_0xdfda('0x3a')](_0x56020a,function(_0x5baf99){logger[_0xdfda('0x3b')](_0xdfda('0x3c'),JSON['stringify'](_0x5baf99['matchPath']));if(_0x3dcfb3[_0xdfda('0x13')][_0x55b626]){_0x3dcfb3[_0xdfda('0x13')][_0x55b626]['emit']('complete');}});return _0xf250d0({'code':0xc8,'message':_0x56020a});}else{if(_0x4ecc87){logger[_0xdfda('0x3b')](util[_0xdfda('0xc')](_0xdfda('0x3d'),_0x55b626));}else{logger['info'](_0xdfda('0x3e'));}return _0xf250d0({'code':0xc8,'message':_0x56020a});}}catch(_0x44c46e){logger[_0xdfda('0x38')](_0x44c46e[_0xdfda('0x3f')]);return _0x19d124(_0x4064f2[_0xdfda('0x38')](0x1f4,_0x44c46e));}}return _0x19d124('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4cecfc){var _0x2357a3=this;return new Promise(function(_0x1da1e5,_0x26bb51){if(_0x4cecfc[_0xdfda('0x40')]&&_0x4cecfc[_0xdfda('0x40')]['id']){if(_0x3dcfb3[_0xdfda('0x41')][_0x4cecfc[_0xdfda('0x40')]['id']]){_0x3dcfb3['agents'][_0x4cecfc[_0xdfda('0x40')]['id']]['busy']=![];_0x3dcfb3[_0xdfda('0x41')][_0x4cecfc[_0xdfda('0x40')]['id']][_0xdfda('0x42')]=undefined;}}if(_0x4cecfc[_0xdfda('0x14')]&&_0x4cecfc[_0xdfda('0x14')]['id']){try{var _0x51ca54=getId(_0x4cecfc[_0xdfda('0x43')],_0x4cecfc[_0xdfda('0x14')]?_0x4cecfc[_0xdfda('0x14')]['id']:0x0,_0x4cecfc[_0xdfda('0x15')]?_0x4cecfc['interaction']['id']:0x0);if(_0x3dcfb3[_0xdfda('0x13')][_0x51ca54]){_0x3dcfb3[_0xdfda('0x13')][_0x51ca54][_0xdfda('0x44')]('end');if(rpc[_0x4cecfc[_0xdfda('0x43')]+_0xdfda('0x45')]){rpc[_0x4cecfc['channel']+_0xdfda('0x45')][_0xdfda('0x46')](_0x51ca54,{'UserId':_0x4cecfc[_0xdfda('0x14')][_0xdfda('0x47')]})['catch'](function(){logger[_0xdfda('0x38')]('error\x20update\x20queue\x20report');});}}return _0x1da1e5({'code':0xc8,'message':_0x4cecfc});}catch(_0x4ac56b){logger[_0xdfda('0x38')](_0x4ac56b[_0xdfda('0x3f')]);return _0x26bb51(_0x2357a3[_0xdfda('0x38')](0x1f4,_0x4ac56b));}}logger[_0xdfda('0x38')](_0xdfda('0x48'));return _0x26bb51(_0x2357a3[_0xdfda('0x38')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x52a8b4){var _0x443ad0=this;return new Promise(function(_0x5cb803,_0x1f93b2){if(_0x52a8b4['agent']&&_0x52a8b4[_0xdfda('0x40')]['id']){try{if(_0x3dcfb3[_0xdfda('0x41')][_0x52a8b4[_0xdfda('0x40')]['id']]){_0x3dcfb3[_0xdfda('0x41')][_0x52a8b4['agent']['id']][_0xdfda('0x49')]=![];_0x3dcfb3[_0xdfda('0x41')][_0x52a8b4[_0xdfda('0x40')]['id']][_0xdfda('0x42')]=undefined;}return _0x5cb803({'code':0xc8,'message':_0x52a8b4});}catch(_0x3f1bcb){logger['error'](_0x3f1bcb[_0xdfda('0x3f')]);return _0x1f93b2(_0x443ad0[_0xdfda('0x38')](0x1f4,_0x3f1bcb));}}logger['error'](_0xdfda('0x48'));return _0x1f93b2(_0x443ad0['error'](0x1f4,_0xdfda('0x48')));});},'AbandonInteraction':function(_0x5856df){var _0x1c1caa=this;return new Promise(function(_0xf19b5e,_0x467e50){if(_0x5856df[_0xdfda('0x43')]&&_0x5856df[_0xdfda('0x15')]&&_0x5856df[_0xdfda('0x15')]['id']){try{var _0x4a0755=getId(_0x5856df[_0xdfda('0x43')],_0x5856df[_0xdfda('0x14')]?_0x5856df[_0xdfda('0x14')]['id']:0x0,_0x5856df['interaction']?_0x5856df[_0xdfda('0x15')]['id']:0x0);if(_0x3dcfb3[_0xdfda('0x13')][_0x4a0755]){_0x3dcfb3[_0xdfda('0x13')][_0x4a0755]['emit'](_0xdfda('0x4a'));}return _0xf19b5e({'code':0xc8,'message':_0x5856df});}catch(_0x37bbf3){logger[_0xdfda('0x38')](_0x37bbf3[_0xdfda('0x3f')]);return _0x467e50(_0x1c1caa[_0xdfda('0x38')](0x1f4,_0x37bbf3));}}logger[_0xdfda('0x38')]('message\x20is\x20empty');return _0x467e50(_0x1c1caa['error'](0x1f4,_0xdfda('0x48')));});},'AgentCapacity':function(_0x59d895){var _0x3b0413=this;return new Promise(function(_0x53e4db,_0x492601){if(_0x3dcfb3['agents']['hasOwnProperty'](_0x59d895['id'])){for(var _0x5f729b in _0x59d895[_0xdfda('0x4b')]){if(_0x59d895['capacity'][_0xdfda('0x4c')](_0x5f729b)){if(_0x3dcfb3['agents'][_0x59d895['id']]['hasOwnProperty'](_0x5f729b+_0xdfda('0x4d'))){_0x3dcfb3[_0xdfda('0x41')][_0x59d895['id']][_0x5f729b+_0xdfda('0x4d')]=parseInt(_0x59d895[_0xdfda('0x4b')][_0x5f729b],0xa);}}}_0x3dcfb3[_0xdfda('0x41')][_0x59d895['id']][_0xdfda('0x4e')]();return _0x53e4db({'code':0xc8,'message':_0x3dcfb3[_0xdfda('0x41')][_0x59d895['id']]});}else{return _0x492601(_0x3b0413[_0xdfda('0x38')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x159a1b){return new Promise(function(_0x1e2eb9){var _0x5b7356=_['values'](_0x3dcfb3[_0xdfda('0x41')]);if(_0x159a1b&&_0x159a1b['id']){var _0x24412d=_[_0xdfda('0x4f')](_0x5b7356,function(_0x4a14bc){return _0x4a14bc['id']===_0x159a1b['id'];});_0x1e2eb9(_0x24412d);}else{_0x1e2eb9({'count':_0x5b7356[_0xdfda('0x1a')],'rows':_0x5b7356});}});},'ChatQueues':function(){return new Promise(function(_0x141688){var _0x28b330=[];for(var _0x44ef74 in _0x3dcfb3[_0xdfda('0x50')]){if(_0x3dcfb3['chatQueues'][_0xdfda('0x4c')](_0x44ef74)){var _0x59c2a8=_0x3dcfb3[_0xdfda('0x50')][_0x44ef74];var _0x299bb9={'id':_0x59c2a8['id'],'available':_0x59c2a8[_0xdfda('0x51')],'loggedIn':_0x59c2a8['loggedIn'],'name':_0x59c2a8[_0xdfda('0x52')],'paused':_0x59c2a8[_0xdfda('0x53')],'waiting':_0x59c2a8[_0xdfda('0x54')]};_0x28b330[_0xdfda('0x21')](_0x299bb9);}}_0x141688({'count':_0x28b330['length'],'rows':_0x28b330});});},'MailQueues':function(){return new Promise(function(_0x23cc70){var _0xbe00b1=[];for(var _0x19902d in _0x3dcfb3[_0xdfda('0x55')]){if(_0x3dcfb3['mailQueues'][_0xdfda('0x4c')](_0x19902d)){var _0xd57673=_0x3dcfb3['mailQueues'][_0x19902d];var _0x2d4c60={'id':_0xd57673['id'],'available':_0xd57673[_0xdfda('0x51')],'loggedIn':_0xd57673[_0xdfda('0x56')],'name':_0xd57673[_0xdfda('0x52')],'paused':_0xd57673[_0xdfda('0x53')],'waiting':_0xd57673[_0xdfda('0x54')]};_0xbe00b1[_0xdfda('0x21')](_0x2d4c60);}}_0x23cc70({'count':_0xbe00b1[_0xdfda('0x1a')],'rows':_0xbe00b1});});},'OpenchannelQueues':function(){return new Promise(function(_0x44a539){var _0x53594a=[];for(var _0xfca797 in _0x3dcfb3['openchannelQueues']){if(_0x3dcfb3[_0xdfda('0x57')][_0xdfda('0x4c')](_0xfca797)){var _0x5a63f5=_0x3dcfb3[_0xdfda('0x57')][_0xfca797];var _0x8b2c3c={'id':_0x5a63f5['id'],'available':_0x5a63f5[_0xdfda('0x51')],'loggedIn':_0x5a63f5[_0xdfda('0x56')],'name':_0x5a63f5[_0xdfda('0x52')],'paused':_0x5a63f5['paused'],'waiting':_0x5a63f5[_0xdfda('0x54')]};_0x53594a[_0xdfda('0x21')](_0x8b2c3c);}}_0x44a539({'count':_0x53594a[_0xdfda('0x1a')],'rows':_0x53594a});});},'SmsQueues':function(){return new Promise(function(_0x3f745d){var _0x532a94=[];for(var _0x30d52d in _0x3dcfb3['smsQueues']){if(_0x3dcfb3[_0xdfda('0x58')][_0xdfda('0x4c')](_0x30d52d)){var _0x954753=_0x3dcfb3[_0xdfda('0x58')][_0x30d52d];var _0x589702={'id':_0x954753['id'],'available':_0x954753['available'],'loggedIn':_0x954753['loggedIn'],'name':_0x954753[_0xdfda('0x52')],'paused':_0x954753[_0xdfda('0x53')],'waiting':_0x954753['waiting']};_0x532a94[_0xdfda('0x21')](_0x589702);}}_0x3f745d({'count':_0x532a94['length'],'rows':_0x532a94});});},'FaxQueues':function(){return new Promise(function(_0x3a2d4b){var _0x49d0b3=[];for(var _0x228a22 in _0x3dcfb3[_0xdfda('0x59')]){if(_0x3dcfb3['faxQueues'][_0xdfda('0x4c')](_0x228a22)){var _0x34df26=_0x3dcfb3[_0xdfda('0x59')][_0x228a22];var _0x5d8289={'id':_0x34df26['id'],'available':_0x34df26[_0xdfda('0x51')],'loggedIn':_0x34df26[_0xdfda('0x56')],'name':_0x34df26[_0xdfda('0x52')],'paused':_0x34df26[_0xdfda('0x53')],'waiting':_0x34df26[_0xdfda('0x54')]};_0x49d0b3[_0xdfda('0x21')](_0x5d8289);}}_0x3a2d4b({'count':_0x49d0b3[_0xdfda('0x1a')],'rows':_0x49d0b3});});},'WhatsappQueues':function(){return new Promise(function(_0x2875fb){var _0x563ef9=[];for(var _0x1afa02 in _0x3dcfb3[_0xdfda('0x5a')]){if(_0x3dcfb3[_0xdfda('0x5a')][_0xdfda('0x4c')](_0x1afa02)){var _0x1d3736=_0x3dcfb3[_0xdfda('0x5a')][_0x1afa02];var _0x8c526b={'id':_0x1d3736['id'],'available':_0x1d3736[_0xdfda('0x51')],'loggedIn':_0x1d3736[_0xdfda('0x56')],'name':_0x1d3736[_0xdfda('0x52')],'paused':_0x1d3736['paused'],'waiting':_0x1d3736[_0xdfda('0x54')]};_0x563ef9[_0xdfda('0x21')](_0x8c526b);}}_0x2875fb({'count':_0x563ef9[_0xdfda('0x1a')],'rows':_0x563ef9});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3f52cb){var _0x3c075b=_[_0xdfda('0x5b')](_0x3dcfb3[_0xdfda('0x5c')]);_0x3f52cb({'count':_0x3c075b[_0xdfda('0x1a')],'rows':_0x3c075b});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x827989){var _0x4894e1=_[_0xdfda('0x5b')](_0x3dcfb3[_0xdfda('0x5d')]);_0x827989({'count':_0x4894e1[_0xdfda('0x1a')],'rows':_0x4894e1});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x46e8d8){var _0x2b7139=_['values'](_0x3dcfb3[_0xdfda('0x5e')]);_0x46e8d8({'count':_0x2b7139[_0xdfda('0x1a')],'rows':_0x2b7139});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1f73e1){var _0x54181c=_[_0xdfda('0x5b')](_0x3dcfb3[_0xdfda('0x5f')]);_0x1f73e1({'count':_0x54181c[_0xdfda('0x1a')],'rows':_0x54181c});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x29d3e4){var _0x4f0c3a=_[_0xdfda('0x5b')](_0x3dcfb3[_0xdfda('0x60')]);_0x29d3e4({'count':_0x4f0c3a[_0xdfda('0x1a')],'rows':_0x4f0c3a});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x318b13){var _0x31c727=_[_0xdfda('0x5b')](_0x3dcfb3[_0xdfda('0x61')]);_0x318b13({'count':_0x31c727[_0xdfda('0x1a')],'rows':_0x31c727});});}};var _0x2de1c4=jayson[_0xdfda('0x62')](_0x5080f0)[_0xdfda('0x63')]();_0x2de1c4['on'](_0xdfda('0x38'),function(_0x425a6e){logger['error'](JSON[_0xdfda('0x64')](_0x425a6e));return _0x50f106(_0x425a6e);});_0x2de1c4['listen'](0x232c,'127.0.0.1',function(){console[_0xdfda('0x65')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x372ad4('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 4d3e6d4..f06d3d6 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 _0xcb90=['message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','error','all','join','\x20|\x20','stack','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then'];(function(_0x211311,_0x5e08e9){var _0x12d89b=function(_0x19390f){while(--_0x19390f){_0x211311['push'](_0x211311['shift']());}};_0x12d89b(++_0x5e08e9);}(_0xcb90,0x1cc));var _0x0cb9=function(_0x1b0d70,_0x468caa){_0x1b0d70=_0x1b0d70-0x0;var _0xba5867=_0xcb90[_0x1b0d70];return _0xba5867;};'use strict';var util=require('util');var BPromise=require(_0x0cb9('0x0'));var jayson=require(_0x0cb9('0x1'));var _=require('lodash');var logger=require(_0x0cb9('0x2'))(_0x0cb9('0x3'));var client=jayson[_0x0cb9('0x4')][_0x0cb9('0x5')]({'port':0x232a});function request(_0x1612ab,_0x53509b){return new BPromise(function(_0xa9b833,_0xcf34bc){return client[_0x0cb9('0x6')](_0x1612ab,_0x53509b)[_0x0cb9('0x7')](function(_0x15c02a){if(_0x15c02a['error']){return _0xcf34bc(_0x15c02a['error'][_0x0cb9('0x8')]);}else{return _0xa9b833(_0x15c02a[_0x0cb9('0x9')]);}})[_0x0cb9('0xa')](function(_0x5b295e){return _0xcf34bc(_0x5b295e);});});}exports['condition']=function(_0x20d831,_0x491c9f,_0x48c017){return function(_0x273cc0){if(_0x48c017['rules']&&!_0x48c017[_0x0cb9('0xb')][_0x20d831]){logger[_0x0cb9('0xc')](_0x0cb9('0xd'),_0x20d831);return _0x273cc0[_0x0cb9('0xe')]();}var _0x27c1c7=[];for(var _0x591fa4=0x0;_0x591fa4<_0x491c9f[_0x0cb9('0xf')];_0x591fa4+=0x1){_0x27c1c7[_0x0cb9('0x10')](request(_0x0cb9('0x11'),{'command':util[_0x0cb9('0x12')](_0x0cb9('0x13'),_0x491c9f[_0x591fa4])})[_0x0cb9('0x7')](function(_0x39e98f){return _0x39e98f&&_0x39e98f['message']&&_0x39e98f[_0x0cb9('0x8')][_0x0cb9('0x14')]('true')>=0x0?!![]:![];})[_0x0cb9('0xa')](function(){logger[_0x0cb9('0x15')]('[%s][INTERVAL]\x20%s',_0x20d831,_0x491c9f[_0x591fa4]);}));}BPromise[_0x0cb9('0x16')](_0x27c1c7)[_0x0cb9('0x7')](function(_0x23a272){var _0x305cb4=_['some'](_0x23a272);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x20d831,_0x491c9f[_0x0cb9('0x17')]('\x20|\x20'),_0x305cb4);_0x273cc0['when'](_0x305cb4);})[_0x0cb9('0xa')](function(_0x129867){logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x20d831,_0x491c9f[_0x0cb9('0x17')](_0x0cb9('0x18')),_0x129867[_0x0cb9('0x19')]);_0x273cc0[_0x0cb9('0xe')]();});};}; \ No newline at end of file +var _0x52ef=['\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','then','error','message','catch','condition','rules','stop','length','push','Command','format','indexOf','true','[%s][INTERVAL]\x20%s','some','info','[%s][INTERVAL]\x20%s\x20%s','join'];(function(_0x342d31,_0x225162){var _0x159adc=function(_0x5ea44b){while(--_0x5ea44b){_0x342d31['push'](_0x342d31['shift']());}};_0x159adc(++_0x225162);}(_0x52ef,0xe3));var _0xf52e=function(_0x39fc84,_0x3a0de1){_0x39fc84=_0x39fc84-0x0;var _0x1f63c1=_0x52ef[_0x39fc84];return _0x1f63c1;};'use strict';var util=require(_0xf52e('0x0'));var BPromise=require(_0xf52e('0x1'));var jayson=require(_0xf52e('0x2'));var _=require(_0xf52e('0x3'));var logger=require(_0xf52e('0x4'))('routing');var client=jayson[_0xf52e('0x5')][_0xf52e('0x6')]({'port':0x232a});function request(_0x474f4d,_0x46511e){return new BPromise(function(_0x3138c1,_0x560f38){return client['request'](_0x474f4d,_0x46511e)[_0xf52e('0x7')](function(_0x118ad7){if(_0x118ad7[_0xf52e('0x8')]){return _0x560f38(_0x118ad7[_0xf52e('0x8')][_0xf52e('0x9')]);}else{return _0x3138c1(_0x118ad7['result']);}})[_0xf52e('0xa')](function(_0x3e923e){return _0x560f38(_0x3e923e);});});}exports[_0xf52e('0xb')]=function(_0x167e23,_0x4cf42c,_0x4a40e7){return function(_0x1de9bb){if(_0x4a40e7[_0xf52e('0xc')]&&!_0x4a40e7[_0xf52e('0xc')][_0x167e23]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x167e23);return _0x1de9bb[_0xf52e('0xd')]();}var _0x69693d=[];for(var _0x59092f=0x0;_0x59092f<_0x4cf42c[_0xf52e('0xe')];_0x59092f+=0x1){_0x69693d[_0xf52e('0xf')](request(_0xf52e('0x10'),{'command':util[_0xf52e('0x11')]('iftime\x20%s',_0x4cf42c[_0x59092f])})[_0xf52e('0x7')](function(_0x305f86){return _0x305f86&&_0x305f86[_0xf52e('0x9')]&&_0x305f86['message'][_0xf52e('0x12')](_0xf52e('0x13'))>=0x0?!![]:![];})['catch'](function(){logger[_0xf52e('0x8')](_0xf52e('0x14'),_0x167e23,_0x4cf42c[_0x59092f]);}));}BPromise['all'](_0x69693d)[_0xf52e('0x7')](function(_0x80fb16){var _0x22bb04=_[_0xf52e('0x15')](_0x80fb16);logger[_0xf52e('0x16')](_0xf52e('0x17'),_0x167e23,_0x4cf42c[_0xf52e('0x18')](_0xf52e('0x19')),_0x22bb04);_0x1de9bb[_0xf52e('0x1a')](_0x22bb04);})[_0xf52e('0xa')](function(_0x34f297){logger[_0xf52e('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x167e23,_0x4cf42c[_0xf52e('0x18')](_0xf52e('0x19')),_0x34f297[_0xf52e('0x1b')]);_0x1de9bb[_0xf52e('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e884d28..81b28e7 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 _0x41bb=['transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','clone','hangup','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','complete','[%s][agents][hangup]','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','destuniqueid','lastevent','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','ringtime','talktime','push','error','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','forIn','answered_elsewhere','reason','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind'];(function(_0x529209,_0x353858){var _0x9a363b=function(_0x4ace2b){while(--_0x4ace2b){_0x529209['push'](_0x529209['shift']());}};_0x9a363b(++_0x353858);}(_0x41bb,0xc5));var _0xb41b=function(_0x1b5314,_0x552185){_0x1b5314=_0x1b5314-0x0;var _0x33ef8e=_0x41bb[_0x1b5314];return _0x33ef8e;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x428431,_0x4d5578){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x4'),_0x428431[_0xb41b('0x5')],_0x428431['channel'],_0x428431[_0xb41b('0x6')],_0x428431[_0xb41b('0x7')],_0x428431[_0xb41b('0x8')],_0x428431['calleridnum'],_0x428431['connectedlinenum'],_0x428431['lastevent']));if(_0x428431[_0xb41b('0x6')]){utils[_0xb41b('0x9')](_0x428431['queue'])[_0xb41b('0xa')](function(_0x2c1a53){if(_0x2c1a53){_0x428431[_0xb41b('0xb')]=_0x2c1a53[_0xb41b('0xb')];_0x428431[_0xb41b('0xc')]=_0x428431[_0xb41b('0xd')]?_0x2c1a53[_0xb41b('0xe')]:![];_0x428431['acwtime']=_0x428431[_0xb41b('0xc')]?_0x2c1a53['acwTimeout']:0x0;}utils[_0xb41b('0xf')](_0xb41b('0x10'),_0x428431);});}else{utils[_0xb41b('0xf')](_0xb41b('0x10'),_0x428431);}if(_0x4d5578){delete transfers[_0x428431[_0xb41b('0x5')]];}else{delete agents[_0x428431['destuniqueid']];}}exports[_0xb41b('0x11')]=function(_0x2d947a){try{utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x13'),_0x2d947a['uniqueid']),_0x2d947a);agents[_0x2d947a['destuniqueid']]=_0x2d947a;agents[_0x2d947a['destuniqueid']][_0xb41b('0x14')]=utils[_0xb41b('0x15')]();agents[_0x2d947a[_0xb41b('0x16')]][_0xb41b('0x17')]=_0xb41b('0x18');agents[_0x2d947a['destuniqueid']][_0xb41b('0x19')]=null;agents[_0x2d947a[_0xb41b('0x16')]][_0xb41b('0x1a')]=null;utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x1b'),_0x2d947a[_0xb41b('0x5')],agents[_0x2d947a['destuniqueid']]['membername'],_0x2d947a['destuniqueid']));}catch(_0xf109f8){utils['error'](util[_0xb41b('0x3')](_0xb41b('0x13'),_0x2d947a[_0xb41b('0x5')]),_0xf109f8);}};exports['agentringnoanswer']=function(_0x53bc44){try{if(!_[_0xb41b('0x1c')](agents[_0x53bc44[_0xb41b('0x16')]])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x1d'),_0x53bc44[_0xb41b('0x5')]),_0x53bc44);utils['info'](util['format'](_0xb41b('0x1e'),_0x53bc44[_0xb41b('0x5')],agents[_0x53bc44[_0xb41b('0x16')]]['membername'],_0x53bc44[_0xb41b('0x16')]));agents[_0x53bc44[_0xb41b('0x16')]]['agentringnoanswer']=!![];agents[_0x53bc44[_0xb41b('0x16')]][_0xb41b('0x1f')]=utils['now']();agents[_0x53bc44[_0xb41b('0x16')]]['lastevent']=_0xb41b('0x20');agents[_0x53bc44[_0xb41b('0x16')]]['reason']=_0xb41b('0x20');agents[_0x53bc44[_0xb41b('0x16')]]['holdtime']=_0x53bc44['ringtime']?parseInt(_0x53bc44[_0xb41b('0x21')])/0x3e8:0x0;agents[_0x53bc44[_0xb41b('0x16')]][_0xb41b('0x22')]=0x0;unanswered[_0xb41b('0x23')](_0x53bc44[_0xb41b('0x16')]);}}catch(_0x181cbd){utils[_0xb41b('0x24')](util['format'](_0xb41b('0x1d'),_0x53bc44[_0xb41b('0x5')]),_0x181cbd);}};exports['queuecallerabandon']=function(_0xe64568){try{_['forIn'](agents,function(_0x38277f,_0x31d4cd){if(_0x38277f['uniqueid']==_0xe64568[_0xb41b('0x5')]&&!_['includes'](unanswered,_0x38277f[_0xb41b('0x16')])){utils[_0xb41b('0x12')](util['format'](_0xb41b('0x25'),_0xe64568[_0xb41b('0x5')]),_0xe64568);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x26'),_0xe64568[_0xb41b('0x5')],_0x38277f[_0xb41b('0x7')],_0x38277f[_0xb41b('0x16')]));_0x38277f[_0xb41b('0x27')]=!![];_0x38277f[_0xb41b('0x1f')]=utils['now']();_0x38277f[_0xb41b('0x17')]='abandoned';_0x38277f['reason']=_0xb41b('0x28');_0x38277f[_0xb41b('0x29')]=_0xe64568[_0xb41b('0x29')];_0x38277f[_0xb41b('0x22')]=0x0;writeDB(_0x38277f);}});}catch(_0x1b8681){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x25'),_0xe64568[_0xb41b('0x5')]),_0x1b8681);}};exports[_0xb41b('0x2a')]=function(_0x3a06a0){try{if(agents[_0x3a06a0['destuniqueid']]){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x2b'),_0x3a06a0[_0xb41b('0x5')]),_0x3a06a0);utils[_0xb41b('0x2')](util[_0xb41b('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x3a06a0['uniqueid'],agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x7')],_0x3a06a0['destuniqueid']));agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x2c')]=utils[_0xb41b('0x15')]();agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x19')]=_0x3a06a0['connectedlinenum'];agents[_0x3a06a0[_0xb41b('0x16')]]['connectedlinename']=_0x3a06a0[_0xb41b('0x1a')];agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x29')]=_0x3a06a0[_0xb41b('0x21')];agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x17')]=_0xb41b('0x2d');_[_0xb41b('0x2e')](agents,function(_0x2b0721,_0x578b67){if(_0x2b0721['destuniqueid']!=_0x3a06a0['destuniqueid']&&_0x2b0721[_0xb41b('0x5')]==_0x3a06a0['uniqueid']){_0x2b0721['talktime']=0x0;_0x2b0721[_0xb41b('0x29')]=_0x3a06a0['ringtime'];_0x2b0721[_0xb41b('0x27')]=!![];_0x2b0721[_0xb41b('0x1f')]=utils[_0xb41b('0x15')]();_0x2b0721[_0xb41b('0x17')]=_0xb41b('0x2f');_0x2b0721[_0xb41b('0x30')]=_0xb41b('0x2f');_0x2b0721['answeredelsewheredestinationuniqueid']=_0x3a06a0[_0xb41b('0x16')];_0x2b0721[_0xb41b('0x31')]=_0x3a06a0[_0xb41b('0x7')];writeDB(_0x2b0721);}});}}catch(_0x174d6c){utils['error'](util[_0xb41b('0x3')]('[%s][agents][agentconnect]',_0x3a06a0[_0xb41b('0x5')]),_0x174d6c);}};exports[_0xb41b('0xd')]=function(_0x46dbbf){try{if(!_['isNil'](agents[_0x46dbbf['destuniqueid']])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x32'),_0x46dbbf[_0xb41b('0x5')]),_0x46dbbf);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x33'),_0x46dbbf['uniqueid'],agents[_0x46dbbf['destuniqueid']][_0xb41b('0x7')],_0x46dbbf['destuniqueid']));agents[_0x46dbbf[_0xb41b('0x16')]]['agentcomplete']=!![];agents[_0x46dbbf[_0xb41b('0x16')]]['agentcompleteAt']=utils[_0xb41b('0x15')]();agents[_0x46dbbf['destuniqueid']][_0xb41b('0x22')]=utils[_0xb41b('0x34')](agents[_0x46dbbf[_0xb41b('0x16')]][_0xb41b('0x35')],agents[_0x46dbbf['destuniqueid']][_0xb41b('0x2c')]);agents[_0x46dbbf[_0xb41b('0x16')]]['reason']=_0x46dbbf[_0xb41b('0x30')];agents[_0x46dbbf['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x46dbbf['destuniqueid']]);}}catch(_0x263d8d){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x32'),_0x46dbbf[_0xb41b('0x5')]),_0x263d8d);}};exports[_0xb41b('0x36')]=function(_0x34d076){try{if(!_[_0xb41b('0x1c')](agents[_0x34d076[_0xb41b('0x37')]])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x38'),_0x34d076[_0xb41b('0x5')]),_0x34d076);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x39'),_0x34d076['uniqueid'],agents[_0x34d076[_0xb41b('0x37')]]['membername'],agents[_0x34d076['transfereruniqueid']][_0xb41b('0x5')]));agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3a')]=!![];agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3b')]=_0xb41b('0x3c');agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3d')]=_0x34d076[_0xb41b('0x3e')];agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3f')]=agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x5')];}}catch(_0x3ce89e){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x38'),_0x34d076[_0xb41b('0x5')]),_0x3ce89e);}};exports[_0xb41b('0x40')]=function(_0x247ca0){try{utils[_0xb41b('0x12')](util['format'](_0xb41b('0x41'),_0x247ca0['origtransfereruniqueid']),_0x247ca0);if(_0x247ca0[_0xb41b('0x42')]==_0x247ca0[_0xb41b('0x43')]){if(!_[_0xb41b('0x1c')](agents[_0x247ca0[_0xb41b('0x44')]])){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x45'),_0x247ca0['origtransfereruniqueid'],agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x7')]));agents[_0x247ca0[_0xb41b('0x44')]]['transfer']=!![];agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x3b')]=_0xb41b('0x46');agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x3d')]=_0x247ca0[_0xb41b('0x47')];agents[_0x247ca0[_0xb41b('0x44')]]['transferuniqueid']=_0x247ca0['origtransfereruniqueid'];}if(_0x247ca0[_0xb41b('0x48')]&&agents[_0x247ca0[_0xb41b('0x48')]]){agents[_0x247ca0['transfereeuniqueid']][_0xb41b('0x49')]=0x1;transfers[_0x247ca0[_0xb41b('0x48')]]=_['clone'](agents[_0x247ca0[_0xb41b('0x48')]]);transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x4a')]=agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x4a')];transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x4b')]=agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x4b')];transfers[_0x247ca0[_0xb41b('0x48')]]['agentcalledAt']=utils[_0xb41b('0x15')]();transfers[_0x247ca0[_0xb41b('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x29')]=0x0;transfers[_0x247ca0[_0xb41b('0x48')]]['agententerreason']=0x2;}}else if(_0x247ca0[_0xb41b('0x44')]==_0x247ca0[_0xb41b('0x4c')]){if(!_[_0xb41b('0x1c')](agents[_0x247ca0[_0xb41b('0x42')]])){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x45'),_0x247ca0[_0xb41b('0x42')],agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x7')]));agents[_0x247ca0['origtransfereruniqueid']][_0xb41b('0x3a')]=!![];agents[_0x247ca0[_0xb41b('0x42')]]['transfertype']=_0xb41b('0x46');agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x3d')]=_0x247ca0['secondtransfererexten'];agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x3f')]=_0x247ca0[_0xb41b('0x44')];}if(_0x247ca0[_0xb41b('0x4d')]&&agents[_0x247ca0[_0xb41b('0x4d')]]){agents[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x49')]=0x1;transfers[_0x247ca0[_0xb41b('0x4d')]]=_[_0xb41b('0x4e')](agents[_0x247ca0[_0xb41b('0x4d')]]);transfers[_0x247ca0['transfertargetuniqueid']]['calleridnum']=agents[_0x247ca0['origtransfereruniqueid']]['calleridnum'];transfers[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x4b')]=agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x4b')];transfers[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x14')]=utils['now']();transfers[_0x247ca0[_0xb41b('0x4d')]]['agentconnectAt']=utils[_0xb41b('0x15')]();transfers[_0x247ca0['transfertargetuniqueid']][_0xb41b('0x29')]=0x0;transfers[_0x247ca0['transfertargetuniqueid']][_0xb41b('0x49')]=0x2;}}}catch(_0xc2afd1){utils['error'](util[_0xb41b('0x3')](_0xb41b('0x41'),_0x247ca0[_0xb41b('0x42')]),_0xc2afd1);}};exports[_0xb41b('0x4f')]=function(_0x39f6ad){try{utils[_0xb41b('0x12')](util[_0xb41b('0x3')]('[%s][agents][hangup]',_0x39f6ad[_0xb41b('0x5')]),_0x39f6ad);if(agents[_0x39f6ad['uniqueid']]&&agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]===_0xb41b('0x20')){if(_0x39f6ad['cause']==='21'){agents[_0x39f6ad['uniqueid']]['reason']='rejected';agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]=_0xb41b('0x50');}utils['info'](util['format'](_0xb41b('0x51'),_0x39f6ad[_0xb41b('0x5')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x7')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')],agents[_0x39f6ad[_0xb41b('0x5')]]['lastevent']));writeDB(agents[_0x39f6ad['uniqueid']]);var _0x303ca3=unanswered[_0xb41b('0x52')](_0x39f6ad['uniqueid']);if(_0x303ca3>-0x1){unanswered[_0xb41b('0x53')](_0x303ca3,0x1);}}if(transfers[_0x39f6ad['uniqueid']]){transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0xd')]=!![];transfers[_0x39f6ad['uniqueid']][_0xb41b('0x35')]=utils[_0xb41b('0x15')]();transfers[_0x39f6ad['uniqueid']]['talktime']=utils[_0xb41b('0x34')](transfers[_0x39f6ad[_0xb41b('0x5')]]['agentcompleteAt'],transfers[_0x39f6ad[_0xb41b('0x5')]]['agentconnectAt']);transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]='agent';transfers[_0x39f6ad['uniqueid']][_0xb41b('0x17')]=_0xb41b('0x54');utils['info'](util[_0xb41b('0x3')](_0xb41b('0x51'),_0x39f6ad[_0xb41b('0x5')],transfers[_0x39f6ad['uniqueid']][_0xb41b('0x7')],transfers[_0x39f6ad['uniqueid']]['reason'],transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]));writeDB(transfers[_0x39f6ad[_0xb41b('0x5')]],!![]);}if(agents[_0x39f6ad[_0xb41b('0x5')]]&&agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x2c')]){agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0xd')]=!![];agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x35')]=utils[_0xb41b('0x15')]();agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x22')]=utils['diffTime'](agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x35')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x2c')]);agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]=agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x3a')]?'transfer':'agent';agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]=_0xb41b('0x54');utils['info'](util[_0xb41b('0x3')](_0xb41b('0x51'),_0x39f6ad['uniqueid'],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x7')],agents[_0x39f6ad['uniqueid']][_0xb41b('0x30')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]));writeDB(agents[_0x39f6ad[_0xb41b('0x5')]]);}}catch(_0x31c5c1){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x55'),_0x39f6ad[_0xb41b('0x5')]),_0x31c5c1);}}; \ No newline at end of file +var _0xaa88=['push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','ATTENDED','transferuniqueid','transfertargetuniqueid','agententerreason','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','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','queue','calleridnum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwtime','agentacw','request','CreateVoiceAgentReport','destuniqueid','debug','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','ringtime','talktime'];(function(_0x4f60de,_0x208abb){var _0x3aa115=function(_0x41e396){while(--_0x41e396){_0x4f60de['push'](_0x4f60de['shift']());}};_0x3aa115(++_0x208abb);}(_0xaa88,0x137));var _0x8aa8=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0xaa88[_0x2e76a7];return _0x454cde;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var utils=require(_0x8aa8('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x51c79b,_0x4aee38){utils[_0x8aa8('0x3')](util[_0x8aa8('0x4')](_0x8aa8('0x5'),_0x51c79b[_0x8aa8('0x6')],_0x51c79b[_0x8aa8('0x7')],_0x51c79b[_0x8aa8('0x8')],_0x51c79b['membername'],_0x51c79b['interface'],_0x51c79b[_0x8aa8('0x9')],_0x51c79b['connectedlinenum'],_0x51c79b[_0x8aa8('0xa')]));if(_0x51c79b[_0x8aa8('0x8')]){utils[_0x8aa8('0xb')](_0x51c79b[_0x8aa8('0x8')])['then'](function(_0x123b7f){if(_0x123b7f){_0x51c79b[_0x8aa8('0xc')]=_0x123b7f[_0x8aa8('0xc')];_0x51c79b['agentacw']=_0x51c79b[_0x8aa8('0xd')]?_0x123b7f[_0x8aa8('0xe')]:![];_0x51c79b[_0x8aa8('0xf')]=_0x51c79b[_0x8aa8('0x10')]?_0x123b7f['acwTimeout']:0x0;}utils[_0x8aa8('0x11')](_0x8aa8('0x12'),_0x51c79b);});}else{utils['request'](_0x8aa8('0x12'),_0x51c79b);}if(_0x4aee38){delete transfers[_0x51c79b[_0x8aa8('0x6')]];}else{delete agents[_0x51c79b[_0x8aa8('0x13')]];}}exports['agentcalled']=function(_0x3b9f74){try{utils[_0x8aa8('0x14')](util[_0x8aa8('0x4')]('[%s][agents][agentcalled]',_0x3b9f74[_0x8aa8('0x6')]),_0x3b9f74);agents[_0x3b9f74['destuniqueid']]=_0x3b9f74;agents[_0x3b9f74['destuniqueid']][_0x8aa8('0x15')]=utils[_0x8aa8('0x16')]();agents[_0x3b9f74[_0x8aa8('0x13')]][_0x8aa8('0xa')]=_0x8aa8('0x17');agents[_0x3b9f74[_0x8aa8('0x13')]][_0x8aa8('0x18')]=null;agents[_0x3b9f74[_0x8aa8('0x13')]][_0x8aa8('0x19')]=null;utils['info'](util['format'](_0x8aa8('0x1a'),_0x3b9f74['uniqueid'],agents[_0x3b9f74['destuniqueid']][_0x8aa8('0x1b')],_0x3b9f74['destuniqueid']));}catch(_0x438198){utils[_0x8aa8('0x1c')](util[_0x8aa8('0x4')](_0x8aa8('0x1d'),_0x3b9f74['uniqueid']),_0x438198);}};exports[_0x8aa8('0x1e')]=function(_0x36c445){try{if(!_[_0x8aa8('0x1f')](agents[_0x36c445[_0x8aa8('0x13')]])){utils[_0x8aa8('0x14')](util[_0x8aa8('0x4')]('[%s][agents][agentringnoanswer]',_0x36c445[_0x8aa8('0x6')]),_0x36c445);utils['info'](util[_0x8aa8('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x36c445[_0x8aa8('0x6')],agents[_0x36c445['destuniqueid']][_0x8aa8('0x1b')],_0x36c445[_0x8aa8('0x13')]));agents[_0x36c445[_0x8aa8('0x13')]]['agentringnoanswer']=!![];agents[_0x36c445[_0x8aa8('0x13')]][_0x8aa8('0x20')]=utils[_0x8aa8('0x16')]();agents[_0x36c445['destuniqueid']]['lastevent']=_0x8aa8('0x21');agents[_0x36c445[_0x8aa8('0x13')]][_0x8aa8('0x22')]=_0x8aa8('0x21');agents[_0x36c445[_0x8aa8('0x13')]]['holdtime']=_0x36c445[_0x8aa8('0x23')]?parseInt(_0x36c445['ringtime'])/0x3e8:0x0;agents[_0x36c445[_0x8aa8('0x13')]][_0x8aa8('0x24')]=0x0;unanswered[_0x8aa8('0x25')](_0x36c445['destuniqueid']);}}catch(_0x4c5c5c){utils[_0x8aa8('0x1c')](util['format'](_0x8aa8('0x26'),_0x36c445[_0x8aa8('0x6')]),_0x4c5c5c);}};exports[_0x8aa8('0x27')]=function(_0x240203){try{_[_0x8aa8('0x28')](agents,function(_0x4d5c2e,_0x267f4c){if(_0x4d5c2e[_0x8aa8('0x6')]==_0x240203['uniqueid']&&!_[_0x8aa8('0x29')](unanswered,_0x4d5c2e[_0x8aa8('0x13')])){utils[_0x8aa8('0x14')](util['format'](_0x8aa8('0x2a'),_0x240203[_0x8aa8('0x6')]),_0x240203);utils[_0x8aa8('0x3')](util[_0x8aa8('0x4')](_0x8aa8('0x2b'),_0x240203[_0x8aa8('0x6')],_0x4d5c2e[_0x8aa8('0x1b')],_0x4d5c2e[_0x8aa8('0x13')]));_0x4d5c2e[_0x8aa8('0x1e')]=!![];_0x4d5c2e[_0x8aa8('0x20')]=utils[_0x8aa8('0x16')]();_0x4d5c2e['lastevent']='abandoned';_0x4d5c2e[_0x8aa8('0x22')]=_0x8aa8('0x2c');_0x4d5c2e[_0x8aa8('0x2d')]=_0x240203[_0x8aa8('0x2d')];_0x4d5c2e[_0x8aa8('0x24')]=0x0;writeDB(_0x4d5c2e);}});}catch(_0x2f27cd){utils['error'](util['format'](_0x8aa8('0x2a'),_0x240203['uniqueid']),_0x2f27cd);}};exports[_0x8aa8('0x2e')]=function(_0x2c5c84){try{if(agents[_0x2c5c84[_0x8aa8('0x13')]]){utils['debug'](util[_0x8aa8('0x4')](_0x8aa8('0x2f'),_0x2c5c84[_0x8aa8('0x6')]),_0x2c5c84);utils['info'](util['format'](_0x8aa8('0x30'),_0x2c5c84[_0x8aa8('0x6')],agents[_0x2c5c84['destuniqueid']][_0x8aa8('0x1b')],_0x2c5c84[_0x8aa8('0x13')]));agents[_0x2c5c84['destuniqueid']][_0x8aa8('0x31')]=utils['now']();agents[_0x2c5c84['destuniqueid']][_0x8aa8('0x18')]=_0x2c5c84['connectedlinenum'];agents[_0x2c5c84[_0x8aa8('0x13')]][_0x8aa8('0x19')]=_0x2c5c84[_0x8aa8('0x19')];agents[_0x2c5c84[_0x8aa8('0x13')]]['holdtime']=_0x2c5c84[_0x8aa8('0x23')];agents[_0x2c5c84[_0x8aa8('0x13')]]['lastevent']=_0x8aa8('0x32');_[_0x8aa8('0x28')](agents,function(_0x5ea57a,_0x351ddc){if(_0x5ea57a[_0x8aa8('0x13')]!=_0x2c5c84[_0x8aa8('0x13')]&&_0x5ea57a[_0x8aa8('0x6')]==_0x2c5c84[_0x8aa8('0x6')]){_0x5ea57a[_0x8aa8('0x24')]=0x0;_0x5ea57a[_0x8aa8('0x2d')]=_0x2c5c84[_0x8aa8('0x23')];_0x5ea57a[_0x8aa8('0x1e')]=!![];_0x5ea57a[_0x8aa8('0x20')]=utils[_0x8aa8('0x16')]();_0x5ea57a[_0x8aa8('0xa')]=_0x8aa8('0x33');_0x5ea57a[_0x8aa8('0x22')]=_0x8aa8('0x33');_0x5ea57a[_0x8aa8('0x34')]=_0x2c5c84['destuniqueid'];_0x5ea57a[_0x8aa8('0x35')]=_0x2c5c84['membername'];writeDB(_0x5ea57a);}});}}catch(_0x4833c0){utils['error'](util[_0x8aa8('0x4')]('[%s][agents][agentconnect]',_0x2c5c84['uniqueid']),_0x4833c0);}};exports[_0x8aa8('0xd')]=function(_0x4da4d8){try{if(!_[_0x8aa8('0x1f')](agents[_0x4da4d8['destuniqueid']])){utils['debug'](util[_0x8aa8('0x4')](_0x8aa8('0x36'),_0x4da4d8[_0x8aa8('0x6')]),_0x4da4d8);utils[_0x8aa8('0x3')](util[_0x8aa8('0x4')](_0x8aa8('0x37'),_0x4da4d8[_0x8aa8('0x6')],agents[_0x4da4d8['destuniqueid']][_0x8aa8('0x1b')],_0x4da4d8['destuniqueid']));agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0xd')]=!![];agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0x38')]=utils[_0x8aa8('0x16')]();agents[_0x4da4d8[_0x8aa8('0x13')]]['talktime']=utils['diffTime'](agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0x38')],agents[_0x4da4d8['destuniqueid']][_0x8aa8('0x31')]);agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0x22')]=_0x4da4d8['reason'];agents[_0x4da4d8['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x4da4d8[_0x8aa8('0x13')]]);}}catch(_0x43bdb4){utils['error'](util[_0x8aa8('0x4')](_0x8aa8('0x36'),_0x4da4d8[_0x8aa8('0x6')]),_0x43bdb4);}};exports[_0x8aa8('0x39')]=function(_0x20384a){try{if(!_[_0x8aa8('0x1f')](agents[_0x20384a['transfereruniqueid']])){utils['debug'](util[_0x8aa8('0x4')]('[%s][agents][blindtransfer]',_0x20384a[_0x8aa8('0x6')]),_0x20384a);utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x3a'),_0x20384a[_0x8aa8('0x6')],agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x1b')],agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x6')]));agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x3c')]=!![];agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x3d')]=_0x8aa8('0x3e');agents[_0x20384a['transfereruniqueid']][_0x8aa8('0x3f')]=_0x20384a['extension'];agents[_0x20384a['transfereruniqueid']]['transferuniqueid']=agents[_0x20384a[_0x8aa8('0x3b')]]['uniqueid'];}}catch(_0x1de402){utils[_0x8aa8('0x1c')](util[_0x8aa8('0x4')]('[%s][agents][blindtransfer]',_0x20384a[_0x8aa8('0x6')]),_0x1de402);}};exports[_0x8aa8('0x40')]=function(_0x23612a){try{utils[_0x8aa8('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x23612a[_0x8aa8('0x41')]),_0x23612a);if(_0x23612a[_0x8aa8('0x41')]==_0x23612a[_0x8aa8('0x42')]){if(!_[_0x8aa8('0x1f')](agents[_0x23612a['secondtransfereruniqueid']])){utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x43'),_0x23612a[_0x8aa8('0x41')],agents[_0x23612a['secondtransfereruniqueid']][_0x8aa8('0x1b')]));agents[_0x23612a[_0x8aa8('0x44')]]['transfer']=!![];agents[_0x23612a['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x23612a[_0x8aa8('0x44')]]['transferexten']=_0x23612a[_0x8aa8('0x45')];agents[_0x23612a[_0x8aa8('0x44')]]['transferuniqueid']=_0x23612a['origtransfereruniqueid'];}if(_0x23612a[_0x8aa8('0x46')]&&agents[_0x23612a[_0x8aa8('0x46')]]){agents[_0x23612a['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x23612a['transfereeuniqueid']]=_[_0x8aa8('0x47')](agents[_0x23612a[_0x8aa8('0x46')]]);transfers[_0x23612a['transfereeuniqueid']]['calleridnum']=agents[_0x23612a[_0x8aa8('0x44')]][_0x8aa8('0x9')];transfers[_0x23612a['transfereeuniqueid']][_0x8aa8('0x48')]=agents[_0x23612a[_0x8aa8('0x44')]]['calleridname'];transfers[_0x23612a[_0x8aa8('0x46')]]['agentcalledAt']=utils[_0x8aa8('0x16')]();transfers[_0x23612a['transfereeuniqueid']][_0x8aa8('0x31')]=utils[_0x8aa8('0x16')]();transfers[_0x23612a[_0x8aa8('0x46')]][_0x8aa8('0x2d')]=0x0;transfers[_0x23612a[_0x8aa8('0x46')]]['agententerreason']=0x2;}}else if(_0x23612a[_0x8aa8('0x44')]==_0x23612a[_0x8aa8('0x49')]){if(!_[_0x8aa8('0x1f')](agents[_0x23612a[_0x8aa8('0x41')]])){utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x43'),_0x23612a['origtransfereruniqueid'],agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x1b')]));agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x3c')]=!![];agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x3d')]=_0x8aa8('0x4a');agents[_0x23612a['origtransfereruniqueid']]['transferexten']=_0x23612a['secondtransfererexten'];agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x4b')]=_0x23612a[_0x8aa8('0x44')];}if(_0x23612a[_0x8aa8('0x4c')]&&agents[_0x23612a[_0x8aa8('0x4c')]]){agents[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x4d')]=0x1;transfers[_0x23612a[_0x8aa8('0x4c')]]=_[_0x8aa8('0x47')](agents[_0x23612a[_0x8aa8('0x4c')]]);transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x9')]=agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x9')];transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x48')]=agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x48')];transfers[_0x23612a[_0x8aa8('0x4c')]]['agentcalledAt']=utils[_0x8aa8('0x16')]();transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x31')]=utils[_0x8aa8('0x16')]();transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x2d')]=0x0;transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x4d')]=0x2;}}}catch(_0x37520b){utils['error'](util[_0x8aa8('0x4')](_0x8aa8('0x4e'),_0x23612a['origtransfereruniqueid']),_0x37520b);}};exports[_0x8aa8('0x4f')]=function(_0x5d72d0){try{utils[_0x8aa8('0x14')](util[_0x8aa8('0x4')]('[%s][agents][hangup]',_0x5d72d0[_0x8aa8('0x6')]),_0x5d72d0);if(agents[_0x5d72d0[_0x8aa8('0x6')]]&&agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x22')]===_0x8aa8('0x21')){if(_0x5d72d0[_0x8aa8('0x50')]==='21'){agents[_0x5d72d0[_0x8aa8('0x6')]]['reason']=_0x8aa8('0x51');agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xa')]=_0x8aa8('0x51');}utils['info'](util['format'](_0x8aa8('0x52'),_0x5d72d0[_0x8aa8('0x6')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x1b')],agents[_0x5d72d0['uniqueid']]['reason'],agents[_0x5d72d0['uniqueid']][_0x8aa8('0xa')]));writeDB(agents[_0x5d72d0[_0x8aa8('0x6')]]);var _0x1b7baa=unanswered[_0x8aa8('0x53')](_0x5d72d0[_0x8aa8('0x6')]);if(_0x1b7baa>-0x1){unanswered[_0x8aa8('0x54')](_0x1b7baa,0x1);}}if(transfers[_0x5d72d0[_0x8aa8('0x6')]]){transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xd')]=!![];transfers[_0x5d72d0['uniqueid']][_0x8aa8('0x38')]=utils['now']();transfers[_0x5d72d0['uniqueid']][_0x8aa8('0x24')]=utils[_0x8aa8('0x55')](transfers[_0x5d72d0[_0x8aa8('0x6')]]['agentcompleteAt'],transfers[_0x5d72d0[_0x8aa8('0x6')]]['agentconnectAt']);transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x22')]=_0x8aa8('0x56');transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xa')]='complete';utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x52'),_0x5d72d0[_0x8aa8('0x6')],transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x1b')],transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x22')],transfers[_0x5d72d0[_0x8aa8('0x6')]]['lastevent']));writeDB(transfers[_0x5d72d0[_0x8aa8('0x6')]],!![]);}if(agents[_0x5d72d0[_0x8aa8('0x6')]]&&agents[_0x5d72d0['uniqueid']]['agentconnectAt']){agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xd')]=!![];agents[_0x5d72d0['uniqueid']][_0x8aa8('0x38')]=utils[_0x8aa8('0x16')]();agents[_0x5d72d0[_0x8aa8('0x6')]]['talktime']=utils['diffTime'](agents[_0x5d72d0['uniqueid']][_0x8aa8('0x38')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x31')]);agents[_0x5d72d0[_0x8aa8('0x6')]]['reason']=agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x3c')]?_0x8aa8('0x3c'):_0x8aa8('0x56');agents[_0x5d72d0['uniqueid']][_0x8aa8('0xa')]='complete';utils['info'](util[_0x8aa8('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5d72d0[_0x8aa8('0x6')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x1b')],agents[_0x5d72d0['uniqueid']][_0x8aa8('0x22')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xa')]));writeDB(agents[_0x5d72d0[_0x8aa8('0x6')]]);}}catch(_0x20260e){utils[_0x8aa8('0x1c')](util['format']('[%s][agents][hangup]',_0x5d72d0[_0x8aa8('0x6')]),_0x20260e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4052497..3c8f3c2 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 _0x47a6=['request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','now','disposition','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','cause-txt','duration','diffTime','endtime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','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]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','set','startsWith','appdata','cdr','split','substring','lastIndexOf','hangup','execif','gotoif','application','lodash','util','FAILED','NO\x20ANSWER','ANSWERED','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','lastevent','accountcode','then','UserId'];(function(_0x36e52b,_0x3a87a0){var _0x160101=function(_0xf6a18c){while(--_0xf6a18c){_0x36e52b['push'](_0x36e52b['shift']());}};_0x160101(++_0x3a87a0);}(_0x47a6,0x19a));var _0x647a=function(_0x30c066,_0x24c3ce){_0x30c066=_0x30c066-0x0;var _0x3035fc=_0x47a6[_0x30c066];return _0x3035fc;};'use strict';var _=require(_0x647a('0x0'));var util=require(_0x647a('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0x647a('0x2'),_0x647a('0x2'),'NO\x20ANSWER',_0x647a('0x3'),_0x647a('0x3'),_0x647a('0x4'),'BUSY',_0x647a('0x2'),_0x647a('0x2'),'FAILED'];var channels={};function writeDB(_0x34cb95){utils[_0x647a('0x5')](util[_0x647a('0x6')](_0x647a('0x7'),_0x34cb95[_0x647a('0x8')],_0x34cb95[_0x647a('0x9')],_0x34cb95[_0x647a('0xa')],_0x34cb95[_0x647a('0xb')],_0x34cb95[_0x647a('0xc')],_0x34cb95[_0x647a('0xd')],_0x34cb95['connectedlinenum'],_0x34cb95[_0x647a('0xe')]));if(_0x34cb95[_0x647a('0xf')]){utils['getUserByInternal'](_0x34cb95[_0x647a('0xf')])[_0x647a('0x10')](function(_0x281d22){if(_0x281d22){_0x34cb95[_0x647a('0x11')]=_0x281d22['id'];}utils[_0x647a('0x12')](_0x647a('0x13'),_0x34cb95);});}else{utils[_0x647a('0x12')](_0x647a('0x13'),_0x34cb95);}if(channels[_0x34cb95[_0x647a('0x8')]]){delete channels[_0x34cb95[_0x647a('0x8')]];}}exports[_0x647a('0x14')]=function(_0x17eb19){try{utils[_0x647a('0x15')](util[_0x647a('0x6')](_0x647a('0x16'),_0x17eb19[_0x647a('0x8')]),_0x17eb19);if(_0x17eb19[_0x647a('0x8')]==_0x17eb19[_0x647a('0x17')]&&_0x17eb19[_0x647a('0x9')]!=_0x647a('0x18')){utils[_0x647a('0x5')](util[_0x647a('0x6')](_0x647a('0x19'),_0x17eb19[_0x647a('0x8')],_0x17eb19[_0x647a('0x1a')],_0x17eb19[_0x647a('0x1b')]));channels[_0x17eb19[_0x647a('0x8')]]={'uniqueid':_0x17eb19[_0x647a('0x8')],'accountcode':_0x17eb19[_0x647a('0xf')],'source':_0x17eb19['calleridnum'],'destination':_0x17eb19['exten'],'destinationcontext':_0x17eb19['context'],'channel':_0x17eb19[_0x647a('0x9')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x647a('0x3'),'amaflags':_0x647a('0x1c')};}}catch(_0x1330f5){utils[_0x647a('0x1d')](util[_0x647a('0x6')](_0x647a('0x16'),_0x17eb19[_0x647a('0x8')]),_0x1330f5);}};exports[_0x647a('0x1e')]=function(_0x23ef53){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x23ef53[_0x647a('0x8')]),_0x23ef53);if(!_[_0x647a('0x1f')](channels[_0x23ef53[_0x647a('0x8')]])&&_0x23ef53[_0x647a('0x20')]==0x6){utils[_0x647a('0x5')](util[_0x647a('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x23ef53[_0x647a('0x8')],_0x23ef53[_0x647a('0x1a')],_0x23ef53[_0x647a('0x9')]));if(_['isNil'](channels[_0x23ef53['uniqueid']][_0x647a('0x21')])){channels[_0x23ef53['uniqueid']][_0x647a('0x21')]=utils['now']();}}else if(!_[_0x647a('0x1f')](channels[_0x23ef53[_0x647a('0x17')]])&&_0x23ef53[_0x647a('0x20')]==0x6&&_0x23ef53[_0x647a('0x1a')]!=_0x647a('0x22')){utils[_0x647a('0x5')](util['format'](_0x647a('0x23'),_0x23ef53[_0x647a('0x8')],_0x23ef53[_0x647a('0x17')],_0x23ef53[_0x647a('0x1a')],_0x23ef53['channel']));channels[_0x23ef53[_0x647a('0x17')]]['accountcode']=_0x23ef53[_0x647a('0xf')];channels[_0x23ef53[_0x647a('0x17')]][_0x647a('0x24')]=_0x23ef53['channel'];if(_[_0x647a('0x1f')](channels[_0x23ef53['linkedid']][_0x647a('0x25')])){channels[_0x23ef53['linkedid']][_0x647a('0x25')]=utils[_0x647a('0x26')]();}channels[_0x23ef53[_0x647a('0x17')]][_0x647a('0x27')]=dispositions[_[_0x647a('0x28')](_0x23ef53['channelstate'])]||_0x647a('0x4');}}catch(_0x595047){utils[_0x647a('0x1d')](util[_0x647a('0x6')](_0x647a('0x29'),_0x23ef53[_0x647a('0x8')]),_0x595047);}};exports['hangup']=function(_0x25eae7){try{if(!_['isNil'](channels[_0x25eae7[_0x647a('0x8')]])){utils[_0x647a('0x15')](util[_0x647a('0x6')](_0x647a('0x2a'),_0x25eae7[_0x647a('0x8')]),_0x25eae7);if(_[_0x647a('0x1f')](channels[_0x25eae7[_0x647a('0x8')]][_0x647a('0x2b')])){channels[_0x25eae7['uniqueid']][_0x647a('0x2b')]=_0x25eae7[_0x647a('0x2c')]+'\x20<'+_0x25eae7[_0x647a('0xd')]+'>';}utils[_0x647a('0x5')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x25eae7[_0x647a('0x8')],channels[_0x25eae7[_0x647a('0x8')]][_0x647a('0x2b')],_0x25eae7[_0x647a('0x2d')]));channels[_0x25eae7[_0x647a('0x8')]]['endtime']=utils[_0x647a('0x26')]();channels[_0x25eae7[_0x647a('0x8')]][_0x647a('0x2e')]=utils[_0x647a('0x2f')](channels[_0x25eae7['uniqueid']][_0x647a('0x30')],channels[_0x25eae7['uniqueid']]['starttime']);channels[_0x25eae7['uniqueid']][_0x647a('0x31')]=channels[_0x25eae7[_0x647a('0x8')]][_0x647a('0x25')]?utils['diffTime'](channels[_0x25eae7[_0x647a('0x8')]][_0x647a('0x30')],channels[_0x25eae7['uniqueid']]['answertime']):0x0;writeDB(channels[_0x25eae7[_0x647a('0x8')]]);}}catch(_0x37593f){utils[_0x647a('0x1d')](util[_0x647a('0x6')](_0x647a('0x2a'),_0x25eae7[_0x647a('0x8')]),_0x37593f);}};exports[_0x647a('0x32')]=function(_0x3276a3){try{if(!_[_0x647a('0x1f')](channels[_0x3276a3['localtwolinkedid']])){utils[_0x647a('0x15')](util['format'](_0x647a('0x33'),_0x3276a3[_0x647a('0x34')]),_0x3276a3);if(channels[_0x3276a3[_0x647a('0x35')]][_0x647a('0x9')]==_0x3276a3[_0x647a('0x36')]){utils[_0x647a('0x5')](util['format'](_0x647a('0x37'),_0x3276a3['origtransfereruniqueid'],_0x3276a3[_0x647a('0x35')],_0x3276a3[_0x647a('0x38')]));channels[_0x3276a3[_0x647a('0x35')]][_0x647a('0x24')]=_0x3276a3['secondtransfererchannel'];channels[_0x3276a3[_0x647a('0x35')]][_0x647a('0x39')]=_0x647a('0x3a');}else if(channels[_0x3276a3[_0x647a('0x35')]][_0x647a('0x9')]=_0x3276a3[_0x647a('0x3b')]){utils['info'](util['format'](_0x647a('0x37'),_0x3276a3[_0x647a('0x34')],_0x3276a3[_0x647a('0x35')],_0x3276a3[_0x647a('0x3c')]));channels[_0x3276a3[_0x647a('0x35')]][_0x647a('0x24')]=_0x3276a3[_0x647a('0x3c')];channels[_0x3276a3[_0x647a('0x35')]]['userfield']=_0x647a('0x3a');}}}catch(_0x1e667c){utils[_0x647a('0x1d')](util[_0x647a('0x6')](_0x647a('0x33'),_0x3276a3[_0x647a('0x34')]),_0x1e667c);}};exports[_0x647a('0x3d')]=function(_0x898b7a){try{if(!_[_0x647a('0x1f')](channels[_0x898b7a[_0x647a('0x8')]])){utils['debug'](util[_0x647a('0x6')](_0x647a('0x3e'),_0x898b7a['uniqueid']),_0x898b7a);channels[_0x898b7a[_0x647a('0x8')]]['musiconholdstartAt']=utils[_0x647a('0x26')]();utils[_0x647a('0x5')](util[_0x647a('0x6')](_0x647a('0x3f'),_0x898b7a['uniqueid'],channels[_0x898b7a['uniqueid']]['musiconholdstartAt']));}}catch(_0x3de2a1){utils[_0x647a('0x1d')](util[_0x647a('0x6')]('[%s][calls][musiconholdstart]',_0x898b7a[_0x647a('0x8')]),_0x3de2a1);}};exports['musiconholdstop']=function(_0x368cb6){try{if(!_['isNil'](channels[_0x368cb6[_0x647a('0x8')]])){utils[_0x647a('0x15')](util['format'](_0x647a('0x40'),_0x368cb6[_0x647a('0x8')]),_0x368cb6);if(!_[_0x647a('0x1f')](channels[_0x368cb6[_0x647a('0x8')]][_0x647a('0x41')])){channels[_0x368cb6[_0x647a('0x8')]][_0x647a('0x42')]+=utils['diffTime'](utils['now'](),channels[_0x368cb6['uniqueid']]['musiconholdstartAt']);utils[_0x647a('0x5')](util[_0x647a('0x6')](_0x647a('0x43'),_0x368cb6[_0x647a('0x8')],channels[_0x368cb6[_0x647a('0x8')]][_0x647a('0x42')]));delete channels[_0x368cb6[_0x647a('0x8')]]['musiconholdstartAt'];}}}catch(_0x322c83){utils[_0x647a('0x1d')](util[_0x647a('0x6')](_0x647a('0x40'),_0x368cb6[_0x647a('0x8')]),_0x322c83);}};exports[_0x647a('0x44')]=function(_0x10bc00){try{if(!_['isNil'](channels[_0x10bc00[_0x647a('0x8')]])){utils[_0x647a('0x15')](util[_0x647a('0x6')](_0x647a('0x45'),_0x10bc00[_0x647a('0x8')]),_0x10bc00);if(!_['isNil'](_0x10bc00[_0x647a('0x46')]['xmd-originatecalleridnum'])){utils[_0x647a('0x5')](util[_0x647a('0x6')](_0x647a('0x47'),_0x10bc00[_0x647a('0x8')],_0x10bc00['value']));channels[_0x10bc00['uniqueid']]['source']=_0x10bc00[_0x647a('0x48')];}if(!_[_0x647a('0x1f')](_0x10bc00[_0x647a('0x46')][_0x647a('0x49')])){utils[_0x647a('0x5')](util[_0x647a('0x6')](_0x647a('0x4a'),_0x10bc00['uniqueid'],_0x10bc00[_0x647a('0x48')]));channels[_0x10bc00['uniqueid']][_0x647a('0x4b')]=_0x10bc00[_0x647a('0x48')];channels[_0x10bc00[_0x647a('0x8')]][_0x647a('0x2b')]='\x22'+_0x10bc00[_0x647a('0x48')]+'\x22\x20<'+_0x10bc00[_0x647a('0x48')]+'>';}if(!_['isNil'](_0x10bc00['variable'][_0x647a('0x4c')])||!_[_0x647a('0x1f')](_0x10bc00[_0x647a('0x46')]['xmd-callerid'])){utils[_0x647a('0x5')](util[_0x647a('0x6')](_0x647a('0x4d'),_0x10bc00[_0x647a('0x8')],!_[_0x647a('0x1f')](_0x10bc00['variable'][_0x647a('0x4c')])?_0x647a('0x4c'):_0x647a('0x4e'),_0x10bc00[_0x647a('0x48')]));channels[_0x10bc00[_0x647a('0x8')]][_0x647a('0x2b')]=_0x10bc00[_0x647a('0x48')];}if(!_[_0x647a('0x1f')](_0x10bc00[_0x647a('0x46')]['xmd-queue'])||!_[_0x647a('0x1f')](_0x10bc00[_0x647a('0x46')][_0x647a('0x4f')])){utils[_0x647a('0x5')](util[_0x647a('0x6')](_0x647a('0x4d'),_0x10bc00[_0x647a('0x8')],!_[_0x647a('0x1f')](_0x10bc00[_0x647a('0x46')][_0x647a('0x50')])?_0x647a('0x50'):_0x647a('0x4f'),_0x10bc00['value']));channels[_0x10bc00[_0x647a('0x8')]][_0x647a('0x51')]=_0x647a('0x52');channels[_0x10bc00[_0x647a('0x8')]][_0x647a('0x53')]=_0x10bc00[_0x647a('0x48')];channels[_0x10bc00[_0x647a('0x8')]]['queue']=!![];}if(!_['isNil'](_0x10bc00['variable']['xmd-contactid'])){utils[_0x647a('0x5')](util[_0x647a('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x10bc00[_0x647a('0x8')],_0x10bc00['value']));channels[_0x10bc00[_0x647a('0x8')]][_0x647a('0x54')]=_0x10bc00[_0x647a('0x48')];}if(!_[_0x647a('0x1f')](_0x10bc00['variable'][_0x647a('0x55')])){utils['info'](util[_0x647a('0x6')](_0x647a('0x56'),_0x10bc00['uniqueid'],_0x10bc00['value']));channels[_0x10bc00['uniqueid']][_0x647a('0x57')]=_0x10bc00[_0x647a('0x48')];}if(!_['isNil'](_0x10bc00[_0x647a('0x46')][_0x647a('0x58')])){utils[_0x647a('0x5')](util[_0x647a('0x6')](_0x647a('0x59'),_0x10bc00[_0x647a('0x8')],_0x10bc00[_0x647a('0x48')]));channels[_0x10bc00[_0x647a('0x8')]][_0x647a('0x5a')]=_0x10bc00[_0x647a('0x48')];}if(!_[_0x647a('0x1f')](_0x10bc00[_0x647a('0x46')][_0x647a('0x5b')])){utils[_0x647a('0x5')](util[_0x647a('0x6')](_0x647a('0x5c'),_0x10bc00[_0x647a('0x8')],_0x10bc00[_0x647a('0x48')]));channels[_0x10bc00[_0x647a('0x8')]][_0x647a('0x5b')]=_0x10bc00[_0x647a('0x48')];}}}catch(_0x535003){utils[_0x647a('0x1d')](util[_0x647a('0x6')](_0x647a('0x45'),_0x10bc00[_0x647a('0x8')]),_0x535003);}};exports[_0x647a('0x5d')]=function(_0x375cb7){try{if(!_['isNil'](channels[_0x375cb7[_0x647a('0x8')]])){utils[_0x647a('0x15')](util[_0x647a('0x6')](_0x647a('0x5e'),_0x375cb7['uniqueid']),_0x375cb7);utils['info'](util[_0x647a('0x6')](_0x647a('0x5f'),_0x375cb7[_0x647a('0x8')],_0x375cb7['application'],_0x375cb7['appdata']));if(_0x375cb7['application']['toLowerCase']()==_0x647a('0x60')&&_[_0x647a('0x61')](_0x375cb7[_0x647a('0x62')]['toLowerCase'](),_0x647a('0x63'))){var _0x1861ad=_0x375cb7['appdata'][_0x647a('0x64')]('=');var _0xf34c38=_0x1861ad[0x0][_0x647a('0x65')](_0x1861ad[0x0][_0x647a('0x66')]('(')+0x1,_0x1861ad[0x0][_0x647a('0x66')](')'));var _0x211cf0=_0x1861ad[0x1];channels[_0x375cb7['uniqueid']][_0xf34c38]=_0x211cf0;}if(!_['includes']([_0x647a('0x67'),'noop',_0x647a('0x68'),_0x647a('0x60'),_0x647a('0x69')],_0x375cb7[_0x647a('0x6a')]['toLowerCase']())){channels[_0x375cb7['uniqueid']]['lastapplication']=_0x375cb7[_0x647a('0x6a')];channels[_0x375cb7['uniqueid']][_0x647a('0x53')]=_0x375cb7[_0x647a('0x62')];}}}catch(_0x298451){utils[_0x647a('0x1d')](util['format'](_0x647a('0x5e'),_0x375cb7[_0x647a('0x8')]),_0x298451);}}; \ No newline at end of file +var _0x7ce6=['disposition','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','hangup','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','isNil','answertime'];(function(_0x4fc425,_0x5cfc14){var _0x4a50a9=function(_0x3875a1){while(--_0x3875a1){_0x4fc425['push'](_0x4fc425['shift']());}};_0x4a50a9(++_0x5cfc14);}(_0x7ce6,0x17b));var _0x67ce=function(_0x939db2,_0x58e90c){_0x939db2=_0x939db2-0x0;var _0x5f18a4=_0x7ce6[_0x939db2];return _0x5f18a4;};'use strict';var _=require(_0x67ce('0x0'));var util=require(_0x67ce('0x1'));var utils=require(_0x67ce('0x2'));var dispositions=[_0x67ce('0x3'),_0x67ce('0x4'),'FAILED',_0x67ce('0x3'),_0x67ce('0x3'),_0x67ce('0x3'),'ANSWERED','BUSY',_0x67ce('0x4'),'FAILED',_0x67ce('0x4')];var channels={};function writeDB(_0x50ab0b){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x7'),_0x50ab0b[_0x67ce('0x8')],_0x50ab0b[_0x67ce('0x9')],_0x50ab0b['queue'],_0x50ab0b[_0x67ce('0xa')],_0x50ab0b['interface'],_0x50ab0b['calleridnum'],_0x50ab0b[_0x67ce('0xb')],_0x50ab0b[_0x67ce('0xc')]));if(_0x50ab0b[_0x67ce('0xd')]){utils[_0x67ce('0xe')](_0x50ab0b[_0x67ce('0xd')])[_0x67ce('0xf')](function(_0x1da455){if(_0x1da455){_0x50ab0b['UserId']=_0x1da455['id'];}utils[_0x67ce('0x10')](_0x67ce('0x11'),_0x50ab0b);});}else{utils[_0x67ce('0x10')](_0x67ce('0x11'),_0x50ab0b);}if(channels[_0x50ab0b[_0x67ce('0x8')]]){delete channels[_0x50ab0b[_0x67ce('0x8')]];}}exports[_0x67ce('0x12')]=function(_0x94c21){try{utils[_0x67ce('0x13')](util[_0x67ce('0x6')]('[%s][calls][newchannel]',_0x94c21[_0x67ce('0x8')]),_0x94c21);if(_0x94c21[_0x67ce('0x8')]==_0x94c21[_0x67ce('0x14')]&&_0x94c21[_0x67ce('0x9')]!=_0x67ce('0x15')){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x16'),_0x94c21['uniqueid'],_0x94c21[_0x67ce('0x17')],_0x94c21[_0x67ce('0x18')]));channels[_0x94c21['uniqueid']]={'uniqueid':_0x94c21[_0x67ce('0x8')],'accountcode':_0x94c21[_0x67ce('0xd')],'source':_0x94c21[_0x67ce('0x19')],'destination':_0x94c21['exten'],'destinationcontext':_0x94c21[_0x67ce('0x17')],'channel':_0x94c21[_0x67ce('0x9')],'starttime':utils[_0x67ce('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x67ce('0x3'),'amaflags':_0x67ce('0x1b')};}}catch(_0x225ce2){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')](_0x67ce('0x1d'),_0x94c21['uniqueid']),_0x225ce2);}};exports[_0x67ce('0x1e')]=function(_0x384d35){try{utils['debug'](util[_0x67ce('0x6')]('[%s][calls][newstate]',_0x384d35['uniqueid']),_0x384d35);if(!_['isNil'](channels[_0x384d35[_0x67ce('0x8')]])&&_0x384d35['channelstate']==0x6){utils[_0x67ce('0x5')](util[_0x67ce('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x384d35[_0x67ce('0x8')],_0x384d35['context'],_0x384d35[_0x67ce('0x9')]));if(_['isNil'](channels[_0x384d35[_0x67ce('0x8')]]['systemanswertime'])){channels[_0x384d35[_0x67ce('0x8')]][_0x67ce('0x1f')]=utils['now']();}}else if(!_['isNil'](channels[_0x384d35[_0x67ce('0x14')]])&&_0x384d35[_0x67ce('0x20')]==0x6&&_0x384d35[_0x67ce('0x17')]!=_0x67ce('0x21')){utils['info'](util['format'](_0x67ce('0x22'),_0x384d35[_0x67ce('0x8')],_0x384d35[_0x67ce('0x14')],_0x384d35['context'],_0x384d35['channel']));channels[_0x384d35['linkedid']][_0x67ce('0xd')]=_0x384d35[_0x67ce('0xd')];channels[_0x384d35['linkedid']]['destinationchannel']=_0x384d35[_0x67ce('0x9')];if(_[_0x67ce('0x23')](channels[_0x384d35['linkedid']][_0x67ce('0x24')])){channels[_0x384d35['linkedid']][_0x67ce('0x24')]=utils[_0x67ce('0x1a')]();}channels[_0x384d35['linkedid']][_0x67ce('0x25')]=dispositions[_[_0x67ce('0x26')](_0x384d35['channelstate'])]||'ANSWERED';}}catch(_0x1c22c5){utils[_0x67ce('0x1c')](util['format'](_0x67ce('0x27'),_0x384d35['uniqueid']),_0x1c22c5);}};exports['hangup']=function(_0x27f4a1){try{if(!_[_0x67ce('0x23')](channels[_0x27f4a1[_0x67ce('0x8')]])){utils[_0x67ce('0x13')](util[_0x67ce('0x6')](_0x67ce('0x28'),_0x27f4a1[_0x67ce('0x8')]),_0x27f4a1);if(_[_0x67ce('0x23')](channels[_0x27f4a1['uniqueid']][_0x67ce('0x29')])){channels[_0x27f4a1['uniqueid']]['callerid']=_0x27f4a1[_0x67ce('0x2a')]+'\x20<'+_0x27f4a1[_0x67ce('0x19')]+'>';}utils[_0x67ce('0x5')](util['format'](_0x67ce('0x2b'),_0x27f4a1[_0x67ce('0x8')],channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x29')],_0x27f4a1[_0x67ce('0x2c')]));channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x2d')]=utils['now']();channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x2e')]=utils['diffTime'](channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x2d')],channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x2f')]);channels[_0x27f4a1[_0x67ce('0x8')]][_0x67ce('0x30')]=channels[_0x27f4a1[_0x67ce('0x8')]]['answertime']?utils[_0x67ce('0x31')](channels[_0x27f4a1['uniqueid']][_0x67ce('0x2d')],channels[_0x27f4a1[_0x67ce('0x8')]]['answertime']):0x0;writeDB(channels[_0x27f4a1[_0x67ce('0x8')]]);}}catch(_0x516af0){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')](_0x67ce('0x28'),_0x27f4a1[_0x67ce('0x8')]),_0x516af0);}};exports['attendedtransfer']=function(_0x512bbf){try{if(!_[_0x67ce('0x23')](channels[_0x512bbf[_0x67ce('0x32')]])){utils[_0x67ce('0x13')](util[_0x67ce('0x6')](_0x67ce('0x33'),_0x512bbf[_0x67ce('0x34')]),_0x512bbf);if(channels[_0x512bbf[_0x67ce('0x32')]][_0x67ce('0x9')]==_0x512bbf[_0x67ce('0x35')]){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x36'),_0x512bbf[_0x67ce('0x34')],_0x512bbf['localtwolinkedid'],_0x512bbf[_0x67ce('0x37')]));channels[_0x512bbf['localtwolinkedid']][_0x67ce('0x38')]=_0x512bbf[_0x67ce('0x37')];channels[_0x512bbf[_0x67ce('0x32')]][_0x67ce('0x39')]=_0x67ce('0x3a');}else if(channels[_0x512bbf['localtwolinkedid']][_0x67ce('0x9')]=_0x512bbf[_0x67ce('0x3b')]){utils['info'](util[_0x67ce('0x6')](_0x67ce('0x36'),_0x512bbf[_0x67ce('0x34')],_0x512bbf['localtwolinkedid'],_0x512bbf[_0x67ce('0x3c')]));channels[_0x512bbf['localtwolinkedid']][_0x67ce('0x38')]=_0x512bbf['origtransfererchannel'];channels[_0x512bbf[_0x67ce('0x32')]]['userfield']=_0x67ce('0x3a');}}}catch(_0x53240e){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')](_0x67ce('0x33'),_0x512bbf[_0x67ce('0x34')]),_0x53240e);}};exports[_0x67ce('0x3d')]=function(_0x5de4e2){try{if(!_[_0x67ce('0x23')](channels[_0x5de4e2[_0x67ce('0x8')]])){utils[_0x67ce('0x13')](util['format']('[%s][calls][musiconholdstart]',_0x5de4e2[_0x67ce('0x8')]),_0x5de4e2);channels[_0x5de4e2[_0x67ce('0x8')]][_0x67ce('0x3e')]=utils[_0x67ce('0x1a')]();utils[_0x67ce('0x5')](util[_0x67ce('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5de4e2['uniqueid'],channels[_0x5de4e2['uniqueid']]['musiconholdstartAt']));}}catch(_0x4d850b){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')]('[%s][calls][musiconholdstart]',_0x5de4e2[_0x67ce('0x8')]),_0x4d850b);}};exports[_0x67ce('0x3f')]=function(_0x15ed3b){try{if(!_[_0x67ce('0x23')](channels[_0x15ed3b[_0x67ce('0x8')]])){utils[_0x67ce('0x13')](util[_0x67ce('0x6')]('[%s][calls][musiconholdstop]',_0x15ed3b[_0x67ce('0x8')]),_0x15ed3b);if(!_[_0x67ce('0x23')](channels[_0x15ed3b['uniqueid']][_0x67ce('0x3e')])){channels[_0x15ed3b[_0x67ce('0x8')]][_0x67ce('0x40')]+=utils[_0x67ce('0x31')](utils[_0x67ce('0x1a')](),channels[_0x15ed3b['uniqueid']][_0x67ce('0x3e')]);utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x41'),_0x15ed3b[_0x67ce('0x8')],channels[_0x15ed3b[_0x67ce('0x8')]][_0x67ce('0x40')]));delete channels[_0x15ed3b[_0x67ce('0x8')]][_0x67ce('0x3e')];}}}catch(_0x19b1da){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')]('[%s][calls][musiconholdstop]',_0x15ed3b['uniqueid']),_0x19b1da);}};exports[_0x67ce('0x42')]=function(_0xaddb32){try{if(!_['isNil'](channels[_0xaddb32[_0x67ce('0x8')]])){utils[_0x67ce('0x13')](util[_0x67ce('0x6')]('[%s][calls][varset]',_0xaddb32['uniqueid']),_0xaddb32);if(!_['isNil'](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x44')])){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x45'),_0xaddb32['uniqueid'],_0xaddb32[_0x67ce('0x46')]));channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x47')]=_0xaddb32[_0x67ce('0x46')];}if(!_[_0x67ce('0x23')](_0xaddb32['variable'][_0x67ce('0x48')])){utils[_0x67ce('0x5')](util['format'](_0x67ce('0x49'),_0xaddb32['uniqueid'],_0xaddb32['value']));channels[_0xaddb32['uniqueid']][_0x67ce('0x4a')]=_0xaddb32[_0x67ce('0x46')];channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x29')]='\x22'+_0xaddb32[_0x67ce('0x46')]+_0x67ce('0x4b')+_0xaddb32[_0x67ce('0x46')]+'>';}if(!_['isNil'](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x4c')])||!_['isNil'](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x4d')])){utils[_0x67ce('0x5')](util['format'](_0x67ce('0x4e'),_0xaddb32[_0x67ce('0x8')],!_[_0x67ce('0x23')](_0xaddb32['variable'][_0x67ce('0x4c')])?_0x67ce('0x4c'):'xmd-callerid',_0xaddb32[_0x67ce('0x46')]));channels[_0xaddb32[_0x67ce('0x8')]]['callerid']=_0xaddb32[_0x67ce('0x46')];}if(!_[_0x67ce('0x23')](_0xaddb32['variable'][_0x67ce('0x4f')])||!_[_0x67ce('0x23')](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x50')])){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x4e'),_0xaddb32['uniqueid'],!_[_0x67ce('0x23')](_0xaddb32['variable'][_0x67ce('0x4f')])?_0x67ce('0x4f'):_0x67ce('0x50'),_0xaddb32[_0x67ce('0x46')]));channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x51')]=_0x67ce('0x52');channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x53')]=_0xaddb32[_0x67ce('0x46')];channels[_0xaddb32['uniqueid']]['queue']=!![];}if(!_[_0x67ce('0x23')](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x54')])){utils['info'](util['format'](_0x67ce('0x55'),_0xaddb32[_0x67ce('0x8')],_0xaddb32[_0x67ce('0x46')]));channels[_0xaddb32['uniqueid']][_0x67ce('0x56')]=_0xaddb32['value'];}if(!_[_0x67ce('0x23')](_0xaddb32[_0x67ce('0x43')]['xmd-cdrtype'])){utils[_0x67ce('0x5')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xaddb32['uniqueid'],_0xaddb32['value']));channels[_0xaddb32['uniqueid']][_0x67ce('0x57')]=_0xaddb32[_0x67ce('0x46')];}if(!_[_0x67ce('0x23')](_0xaddb32['variable'][_0x67ce('0x58')])){utils[_0x67ce('0x5')](util[_0x67ce('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0xaddb32[_0x67ce('0x8')],_0xaddb32['value']));channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x59')]=_0xaddb32['value'];}if(!_[_0x67ce('0x23')](_0xaddb32[_0x67ce('0x43')][_0x67ce('0x5a')])){utils[_0x67ce('0x5')](util[_0x67ce('0x6')](_0x67ce('0x5b'),_0xaddb32[_0x67ce('0x8')],_0xaddb32[_0x67ce('0x46')]));channels[_0xaddb32[_0x67ce('0x8')]][_0x67ce('0x5a')]=_0xaddb32[_0x67ce('0x46')];}}}catch(_0x1dacc8){utils[_0x67ce('0x1c')](util[_0x67ce('0x6')]('[%s][calls][varset]',_0xaddb32['uniqueid']),_0x1dacc8);}};exports[_0x67ce('0x5c')]=function(_0x3048e3){try{if(!_[_0x67ce('0x23')](channels[_0x3048e3['uniqueid']])){utils[_0x67ce('0x13')](util[_0x67ce('0x6')](_0x67ce('0x5d'),_0x3048e3[_0x67ce('0x8')]),_0x3048e3);utils[_0x67ce('0x5')](util['format'](_0x67ce('0x5e'),_0x3048e3['uniqueid'],_0x3048e3[_0x67ce('0x5f')],_0x3048e3[_0x67ce('0x60')]));if(_0x3048e3['application']['toLowerCase']()=='set'&&_['startsWith'](_0x3048e3[_0x67ce('0x60')][_0x67ce('0x61')](),_0x67ce('0x62'))){var _0x383edc=_0x3048e3[_0x67ce('0x60')][_0x67ce('0x63')]('=');var _0x291c74=_0x383edc[0x0][_0x67ce('0x64')](_0x383edc[0x0][_0x67ce('0x65')]('(')+0x1,_0x383edc[0x0][_0x67ce('0x65')](')'));var _0x83809e=_0x383edc[0x1];channels[_0x3048e3['uniqueid']][_0x291c74]=_0x83809e;}if(!_['includes']([_0x67ce('0x66'),'noop','execif','set',_0x67ce('0x67')],_0x3048e3[_0x67ce('0x5f')]['toLowerCase']())){channels[_0x3048e3['uniqueid']]['lastapplication']=_0x3048e3[_0x67ce('0x5f')];channels[_0x3048e3[_0x67ce('0x8')]][_0x67ce('0x53')]=_0x3048e3[_0x67ce('0x60')];}}}catch(_0x269edd){utils[_0x67ce('0x1c')](util['format']('[%s][calls][newexten]',_0x3048e3[_0x67ce('0x8')]),_0x269edd);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 9f8c8f2..a2c6816 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 _0x9dc6=['connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20close','./utils'];(function(_0x13211b,_0x3050c2){var _0x4adb44=function(_0x3885c6){while(--_0x3885c6){_0x13211b['push'](_0x13211b['shift']());}};_0x4adb44(++_0x3050c2);}(_0x9dc6,0xe0));var _0x69dc=function(_0x171d69,_0x30a06f){_0x171d69=_0x171d69-0x0;var _0x227201=_0x9dc6[_0x171d69];return _0x227201;};'use strict';var utils=require(_0x69dc('0x0'));exports[_0x69dc('0x1')]=function(){utils[_0x69dc('0x2')](_0x69dc('0x3'));};exports[_0x69dc('0x4')]=function(){utils[_0x69dc('0x2')]('[core]\x20shutdown');};exports[_0x69dc('0x5')]=function(){utils['info'](_0x69dc('0x6'));};exports[_0x69dc('0x7')]=function(_0x4f78c8){utils[_0x69dc('0x7')]('[core]\x20error',_0x4f78c8);};exports['close']=function(){utils['info'](_0x69dc('0x8'));};exports['managerevent']=function(_0x213304){}; \ No newline at end of file +var _0x99c5=['fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x34b951,_0x554a89){var _0x2b259f=function(_0x39bf00){while(--_0x39bf00){_0x34b951['push'](_0x34b951['shift']());}};_0x2b259f(++_0x554a89);}(_0x99c5,0xe2));var _0x599c=function(_0x420d5b,_0x20cefc){_0x420d5b=_0x420d5b-0x0;var _0x24bb19=_0x99c5[_0x420d5b];return _0x24bb19;};'use strict';var utils=require(_0x599c('0x0'));exports[_0x599c('0x1')]=function(){utils[_0x599c('0x2')](_0x599c('0x3'));};exports[_0x599c('0x4')]=function(){utils[_0x599c('0x2')]('[core]\x20shutdown');};exports[_0x599c('0x5')]=function(){utils[_0x599c('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0x27cf4a){utils[_0x599c('0x6')](_0x599c('0x7'),_0x27cf4a);};exports[_0x599c('0x8')]=function(){utils[_0x599c('0x2')](_0x599c('0x9'));};exports[_0x599c('0xa')]=function(_0x592191){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e355926..efd4c61 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 _0xb129=['[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','assign','answertime','lastevent','connect','[%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','complete','duration','endtime','starttime','holdtime','diffTime','billableseconds','lodash','util','info'];(function(_0x1a609e,_0x557698){var _0x20b986=function(_0x496414){while(--_0x496414){_0x1a609e['push'](_0x1a609e['shift']());}};_0x20b986(++_0x557698);}(_0xb129,0x8d));var _0x9b12=function(_0x5ed7a0,_0x552559){_0x5ed7a0=_0x5ed7a0-0x0;var _0x4d69e6=_0xb129[_0x5ed7a0];return _0x4d69e6;};'use strict';var _=require(_0x9b12('0x0'));var util=require(_0x9b12('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x3da6a9){utils[_0x9b12('0x2')](util['format'](_0x9b12('0x3'),_0x3da6a9[_0x9b12('0x4')],_0x3da6a9[_0x9b12('0x5')],_0x3da6a9[_0x9b12('0x6')],_0x3da6a9[_0x9b12('0x7')],_0x3da6a9[_0x9b12('0x8')],_0x3da6a9[_0x9b12('0x9')]));utils['request'](_0x9b12('0xa'),_0x3da6a9);delete dials[_0x3da6a9['uniqueid']];}exports['newexten']=function(_0x3b02c3){try{utils[_0x9b12('0xb')](util[_0x9b12('0xc')](_0x9b12('0xd'),_0x3b02c3['uniqueid']),_0x3b02c3);utils['info'](util['format'](_0x9b12('0xe'),_0x3b02c3[_0x9b12('0x4')],_0x3b02c3['application'],_0x3b02c3[_0x9b12('0xf')]));if(_0x3b02c3[_0x9b12('0x10')][_0x9b12('0x11')]()=='set'&&_[_0x9b12('0x12')](_0x3b02c3['appdata']['toLowerCase'](),_0x9b12('0x13'))){var _0x1f89d8=_0x3b02c3['appdata']['split']('=');dials[_0x3b02c3[_0x9b12('0x4')]]={'routeId':_0x1f89d8[0x1]};}}catch(_0xeaf816){utils[_0x9b12('0x14')](util[_0x9b12('0xc')](_0x9b12('0xd'),_0x3b02c3['uniqueid']),_0xeaf816);}};exports[_0x9b12('0x15')]=function(_0x4c96f8){try{utils[_0x9b12('0xb')](util['format'](_0x9b12('0x16'),_0x4c96f8[_0x9b12('0x4')]),_0x4c96f8);if(!_[_0x9b12('0x17')](_0x4c96f8[_0x9b12('0x18')][_0x9b12('0x19')])){utils[_0x9b12('0x2')](util[_0x9b12('0xc')](_0x9b12('0x1a'),_0x4c96f8[_0x9b12('0x4')],_0x4c96f8[_0x9b12('0x1b')]));dials[_0x4c96f8[_0x9b12('0x4')]]={'routeId':_0x4c96f8[_0x9b12('0x1b')]};}}catch(_0x1b968e){utils[_0x9b12('0x14')](util[_0x9b12('0xc')]('[%s][dials][varset]',_0x4c96f8[_0x9b12('0x4')]),_0x1b968e);}};exports['dialbegin']=function(_0x28d846){try{if(!_[_0x9b12('0x17')](dials[_0x28d846['uniqueid']])){utils[_0x9b12('0xb')](util[_0x9b12('0xc')](_0x9b12('0x1c'),_0x28d846[_0x9b12('0x4')]),_0x28d846);dials[_0x28d846[_0x9b12('0x4')]]=_['assign'](dials[_0x28d846[_0x9b12('0x4')]],_0x28d846);dials[_0x28d846[_0x9b12('0x4')]]['starttime']=utils[_0x9b12('0x1d')]();dials[_0x28d846[_0x9b12('0x4')]]['lastevent']='called';utils['info'](util[_0x9b12('0xc')](_0x9b12('0x1e'),_0x28d846[_0x9b12('0x4')],dials[_0x28d846['uniqueid']]['starttime']));}}catch(_0x285fd7){utils[_0x9b12('0x14')](util[_0x9b12('0xc')](_0x9b12('0x1c'),_0x28d846[_0x9b12('0x4')]),_0x285fd7);}};exports['dialend']=function(_0x4209b6){try{if(!_['isNil'](dials[_0x4209b6['uniqueid']])){utils[_0x9b12('0xb')](util[_0x9b12('0xc')](_0x9b12('0x1f'),_0x4209b6[_0x9b12('0x4')]),_0x4209b6);dials[_0x4209b6[_0x9b12('0x4')]][_0x9b12('0x9')]=_0x4209b6[_0x9b12('0x9')];if(_0x4209b6[_0x9b12('0x9')]==_0x9b12('0x20')){dials[_0x4209b6[_0x9b12('0x4')]]=_[_0x9b12('0x21')](dials[_0x4209b6[_0x9b12('0x4')]],_0x4209b6);dials[_0x4209b6['uniqueid']][_0x9b12('0x22')]=utils['now']();dials[_0x4209b6[_0x9b12('0x4')]][_0x9b12('0x23')]=_0x9b12('0x24');utils[_0x9b12('0x2')](util['format'](_0x9b12('0x25'),_0x4209b6[_0x9b12('0x4')],_0x4209b6['dialstatus'],dials[_0x4209b6[_0x9b12('0x4')]][_0x9b12('0x22')]));}else{utils[_0x9b12('0x2')](util[_0x9b12('0xc')](_0x9b12('0x26'),_0x4209b6[_0x9b12('0x4')],_0x4209b6[_0x9b12('0x9')]));}}}catch(_0x57edf3){utils[_0x9b12('0x14')](util[_0x9b12('0xc')]('[%s][dials][dialend]',_0x4209b6['uniqueid']),_0x57edf3);}};exports['hangup']=function(_0x849e62){try{if(!_[_0x9b12('0x17')](dials[_0x849e62['uniqueid']])){utils[_0x9b12('0xb')](util[_0x9b12('0xc')](_0x9b12('0x27'),_0x849e62[_0x9b12('0x4')]),_0x849e62);utils[_0x9b12('0x2')](util[_0x9b12('0xc')](_0x9b12('0x28'),_0x849e62[_0x9b12('0x4')],_0x849e62['calleridnum'],_0x849e62['calleridname'],_0x849e62['cause-txt']));dials[_0x849e62[_0x9b12('0x4')]]=_['assign'](dials[_0x849e62[_0x9b12('0x4')]],{'endtime':utils[_0x9b12('0x1d')](),'lastevent':_0x9b12('0x29')});dials[_0x849e62['uniqueid']][_0x9b12('0x2a')]=utils['diffTime'](dials[_0x849e62[_0x9b12('0x4')]][_0x9b12('0x2b')],dials[_0x849e62['uniqueid']][_0x9b12('0x2c')]);dials[_0x849e62[_0x9b12('0x4')]][_0x9b12('0x2d')]=utils[_0x9b12('0x2e')](dials[_0x849e62[_0x9b12('0x4')]]['answertime']||dials[_0x849e62[_0x9b12('0x4')]][_0x9b12('0x2b')],dials[_0x849e62[_0x9b12('0x4')]][_0x9b12('0x2c')]);dials[_0x849e62[_0x9b12('0x4')]][_0x9b12('0x2f')]=dials[_0x849e62['uniqueid']]['answertime']?utils['diffTime'](dials[_0x849e62['uniqueid']][_0x9b12('0x2b')],dials[_0x849e62['uniqueid']][_0x9b12('0x22')]):0x0;writeDB(dials[_0x849e62[_0x9b12('0x4')]]);}}catch(_0x40d63b){utils[_0x9b12('0x14')](util[_0x9b12('0xc')]('[%s][dials][hangup]',_0x849e62[_0x9b12('0x4')]),_0x40d63b);}}; \ No newline at end of file +var _0x66f9=['set','startsWith','appdata','cdr(routeid)','split','error','varset','debug','isNil','variable','outboundrouteid','value','[%s][dials][varset]','dialbegin','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','[%s][dials][dialend]','dialstatus','ANSWER','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','diffTime','endtime','billableseconds','[%s][dials][hangup]','lodash','util','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x45ac0c,_0x2f8a58){var _0x4b4074=function(_0x1ddc53){while(--_0x1ddc53){_0x45ac0c['push'](_0x45ac0c['shift']());}};_0x4b4074(++_0x2f8a58);}(_0x66f9,0x181));var _0x966f=function(_0x2b8c3a,_0x34f3fe){_0x2b8c3a=_0x2b8c3a-0x0;var _0x255fcf=_0x66f9[_0x2b8c3a];return _0x255fcf;};'use strict';var _=require(_0x966f('0x0'));var util=require(_0x966f('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x151737){utils[_0x966f('0x2')](util[_0x966f('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x151737[_0x966f('0x4')],_0x151737[_0x966f('0x5')],_0x151737[_0x966f('0x6')],_0x151737[_0x966f('0x7')],_0x151737[_0x966f('0x8')],_0x151737['dialstatus']));utils[_0x966f('0x9')](_0x966f('0xa'),_0x151737);delete dials[_0x151737[_0x966f('0x4')]];}exports[_0x966f('0xb')]=function(_0x35796b){try{utils['debug'](util[_0x966f('0x3')](_0x966f('0xc'),_0x35796b['uniqueid']),_0x35796b);utils[_0x966f('0x2')](util[_0x966f('0x3')](_0x966f('0xd'),_0x35796b['uniqueid'],_0x35796b[_0x966f('0xe')],_0x35796b['appdata']));if(_0x35796b[_0x966f('0xe')]['toLowerCase']()==_0x966f('0xf')&&_[_0x966f('0x10')](_0x35796b[_0x966f('0x11')]['toLowerCase'](),_0x966f('0x12'))){var _0x503bce=_0x35796b['appdata'][_0x966f('0x13')]('=');dials[_0x35796b[_0x966f('0x4')]]={'routeId':_0x503bce[0x1]};}}catch(_0xbed2af){utils[_0x966f('0x14')](util[_0x966f('0x3')](_0x966f('0xc'),_0x35796b[_0x966f('0x4')]),_0xbed2af);}};exports[_0x966f('0x15')]=function(_0x389a73){try{utils[_0x966f('0x16')](util[_0x966f('0x3')]('[%s][dials][varset]',_0x389a73[_0x966f('0x4')]),_0x389a73);if(!_[_0x966f('0x17')](_0x389a73[_0x966f('0x18')][_0x966f('0x19')])){utils[_0x966f('0x2')](util[_0x966f('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x389a73[_0x966f('0x4')],_0x389a73[_0x966f('0x1a')]));dials[_0x389a73[_0x966f('0x4')]]={'routeId':_0x389a73[_0x966f('0x1a')]};}}catch(_0x462570){utils[_0x966f('0x14')](util[_0x966f('0x3')](_0x966f('0x1b'),_0x389a73[_0x966f('0x4')]),_0x462570);}};exports[_0x966f('0x1c')]=function(_0x33772c){try{if(!_['isNil'](dials[_0x33772c[_0x966f('0x4')]])){utils['debug'](util[_0x966f('0x3')]('[%s][dials][dialbegin]',_0x33772c[_0x966f('0x4')]),_0x33772c);dials[_0x33772c[_0x966f('0x4')]]=_[_0x966f('0x1d')](dials[_0x33772c['uniqueid']],_0x33772c);dials[_0x33772c[_0x966f('0x4')]][_0x966f('0x1e')]=utils[_0x966f('0x1f')]();dials[_0x33772c[_0x966f('0x4')]]['lastevent']=_0x966f('0x20');utils[_0x966f('0x2')](util[_0x966f('0x3')](_0x966f('0x21'),_0x33772c[_0x966f('0x4')],dials[_0x33772c['uniqueid']][_0x966f('0x1e')]));}}catch(_0x3e5e6c){utils[_0x966f('0x14')](util[_0x966f('0x3')](_0x966f('0x22'),_0x33772c[_0x966f('0x4')]),_0x3e5e6c);}};exports['dialend']=function(_0x33a6ea){try{if(!_[_0x966f('0x17')](dials[_0x33a6ea[_0x966f('0x4')]])){utils[_0x966f('0x16')](util['format'](_0x966f('0x23'),_0x33a6ea[_0x966f('0x4')]),_0x33a6ea);dials[_0x33a6ea['uniqueid']][_0x966f('0x24')]=_0x33a6ea['dialstatus'];if(_0x33a6ea['dialstatus']==_0x966f('0x25')){dials[_0x33a6ea[_0x966f('0x4')]]=_['assign'](dials[_0x33a6ea[_0x966f('0x4')]],_0x33a6ea);dials[_0x33a6ea[_0x966f('0x4')]]['answertime']=utils[_0x966f('0x1f')]();dials[_0x33a6ea[_0x966f('0x4')]][_0x966f('0x26')]=_0x966f('0x27');utils[_0x966f('0x2')](util[_0x966f('0x3')](_0x966f('0x28'),_0x33a6ea[_0x966f('0x4')],_0x33a6ea['dialstatus'],dials[_0x33a6ea[_0x966f('0x4')]][_0x966f('0x29')]));}else{utils[_0x966f('0x2')](util[_0x966f('0x3')](_0x966f('0x2a'),_0x33a6ea['uniqueid'],_0x33a6ea[_0x966f('0x24')]));}}}catch(_0x5de054){utils[_0x966f('0x14')](util['format'](_0x966f('0x23'),_0x33a6ea[_0x966f('0x4')]),_0x5de054);}};exports[_0x966f('0x2b')]=function(_0x4ef3cb){try{if(!_['isNil'](dials[_0x4ef3cb[_0x966f('0x4')]])){utils['debug'](util[_0x966f('0x3')]('[%s][dials][hangup]',_0x4ef3cb[_0x966f('0x4')]),_0x4ef3cb);utils[_0x966f('0x2')](util['format'](_0x966f('0x2c'),_0x4ef3cb[_0x966f('0x4')],_0x4ef3cb['calleridnum'],_0x4ef3cb[_0x966f('0x2d')],_0x4ef3cb['cause-txt']));dials[_0x4ef3cb[_0x966f('0x4')]]=_['assign'](dials[_0x4ef3cb['uniqueid']],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x4ef3cb[_0x966f('0x4')]]['duration']=utils[_0x966f('0x2e')](dials[_0x4ef3cb[_0x966f('0x4')]][_0x966f('0x2f')],dials[_0x4ef3cb[_0x966f('0x4')]]['starttime']);dials[_0x4ef3cb[_0x966f('0x4')]]['holdtime']=utils[_0x966f('0x2e')](dials[_0x4ef3cb[_0x966f('0x4')]]['answertime']||dials[_0x4ef3cb[_0x966f('0x4')]][_0x966f('0x2f')],dials[_0x4ef3cb[_0x966f('0x4')]][_0x966f('0x1e')]);dials[_0x4ef3cb[_0x966f('0x4')]][_0x966f('0x30')]=dials[_0x4ef3cb[_0x966f('0x4')]][_0x966f('0x29')]?utils[_0x966f('0x2e')](dials[_0x4ef3cb[_0x966f('0x4')]]['endtime'],dials[_0x4ef3cb[_0x966f('0x4')]][_0x966f('0x29')]):0x0;writeDB(dials[_0x4ef3cb['uniqueid']]);}}catch(_0x170d12){utils[_0x966f('0x14')](util['format'](_0x966f('0x31'),_0x4ef3cb[_0x966f('0x4')]),_0x170d12);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 0e026c9..0013762 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 _0xcf55=['asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%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','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local'];(function(_0x11a9bf,_0x3f52a5){var _0x47d225=function(_0x370de5){while(--_0x370de5){_0x11a9bf['push'](_0x11a9bf['shift']());}};_0x47d225(++_0x3f52a5);}(_0xcf55,0x14b));var _0x5cf5=function(_0x529849,_0x21de02){_0x529849=_0x529849-0x0;var _0x45dc2c=_0xcf55[_0x529849];return _0x45dc2c;};var AsteriskManager=require(_0x5cf5('0x0'));var config=require(_0x5cf5('0x1'));var utils=require(_0x5cf5('0x2'));var util=require(_0x5cf5('0x3'));var isXDREnabled=config[_0x5cf5('0x4')]&&config[_0x5cf5('0x4')][_0x5cf5('0x5')]?!config['xdr'][_0x5cf5('0x5')]:!![];var isProduction=config[_0x5cf5('0x6')]===_0x5cf5('0x7')||![];var isLocalAsterisk=config['xdr']&&config[_0x5cf5('0x4')][_0x5cf5('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x5cf5('0x9')]['port'],config[_0x5cf5('0x9')]['ip'],config['asterisk']['username'],config['asterisk'][_0x5cf5('0xa')],!![]);ami[_0x5cf5('0xb')]();if(!isXDREnabled){utils[_0x5cf5('0xc')](_0x5cf5('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x5cf5('0xc')](_0x5cf5('0xe'));}else{var agents=require(_0x5cf5('0xf'));var calls=require(_0x5cf5('0x10'));var queues=require(_0x5cf5('0x11'));var recordings=require('./recordings.controller');var members=require(_0x5cf5('0x12'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x5cf5('0x13'));ami['on']('connect',core[_0x5cf5('0x14')]);ami['on'](_0x5cf5('0x15'),core[_0x5cf5('0x15')]);ami['on'](_0x5cf5('0x16'),core[_0x5cf5('0x16')]);ami['on']('error',core[_0x5cf5('0x17')]);ami['on']('close',core['close']);ami['on'](_0x5cf5('0x18'),core[_0x5cf5('0x18')]);ami['on']('devicestatechange',function(_0x450344){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')](_0x5cf5('0x1b'),_0x450344[_0x5cf5('0x1c')]),_0x450344);members['devicestatechange'](_0x450344);}catch(_0x3acfc7){utils[_0x5cf5('0x17')](util[_0x5cf5('0x1a')](_0x5cf5('0x1b'),_0x450344[_0x5cf5('0x1c')]),_0x3acfc7);}});ami['on'](_0x5cf5('0x1d'),function(_0x473b1d){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')](_0x5cf5('0x1e'),_0x473b1d['uniqueid']),_0x473b1d);agents['agentcalled'](_0x473b1d);}catch(_0x21a995){utils[_0x5cf5('0x17')](util['format'](_0x5cf5('0x1e'),_0x473b1d[_0x5cf5('0x1f')]),_0x21a995);}});ami['on']('agentringnoanswer',function(_0x47acfa){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')](_0x5cf5('0x20'),_0x47acfa[_0x5cf5('0x1f')]),_0x47acfa);agents[_0x5cf5('0x21')](_0x47acfa);}catch(_0x3ba218){utils[_0x5cf5('0x17')](util[_0x5cf5('0x1a')](_0x5cf5('0x20'),_0x47acfa[_0x5cf5('0x1f')]),_0x3ba218);}});ami['on'](_0x5cf5('0x22'),function(_0x240cc2){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')]('[%s][index][agentconnect]',_0x240cc2['uniqueid']),_0x240cc2);agents['agentconnect'](_0x240cc2);queues[_0x5cf5('0x22')](_0x240cc2);}catch(_0x3220f4){utils['error'](util[_0x5cf5('0x1a')](_0x5cf5('0x23'),_0x240cc2[_0x5cf5('0x1f')]),_0x3220f4);}});ami['on'](_0x5cf5('0x24'),function(_0xc37815){try{utils['debug'](util[_0x5cf5('0x1a')]('[%s][index][agentcomplete]',_0xc37815['uniqueid']),_0xc37815);agents['agentcomplete'](_0xc37815);queues[_0x5cf5('0x24')](_0xc37815);members[_0x5cf5('0x24')](_0xc37815);}catch(_0x276fdd){utils[_0x5cf5('0x17')](util[_0x5cf5('0x1a')](_0x5cf5('0x25'),_0xc37815['uniqueid']),_0x276fdd);}});ami['on'](_0x5cf5('0x26'),function(_0xd6e27b){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')](_0x5cf5('0x27'),_0xd6e27b['uniqueid']),_0xd6e27b);agents[_0x5cf5('0x26')](_0xd6e27b);queues[_0x5cf5('0x26')](_0xd6e27b);}catch(_0x504715){utils[_0x5cf5('0x17')](util[_0x5cf5('0x1a')]('[%s][index][queuecallerabandon]',_0xd6e27b[_0x5cf5('0x1f')]),_0x504715);}});ami['on'](_0x5cf5('0x28'),function(_0x2c6a13){try{utils[_0x5cf5('0x19')](util['format'](_0x5cf5('0x29'),_0x2c6a13[_0x5cf5('0x1f')]),_0x2c6a13);queues[_0x5cf5('0x28')](_0x2c6a13);recordings['queuecallerjoin'](_0x2c6a13);}catch(_0x2b068d){utils[_0x5cf5('0x17')](util['format']('[%s][index][queuecallerjoin]',_0x2c6a13[_0x5cf5('0x1f')]),_0x2b068d);}});ami['on']('queuecallerleave',function(_0x264c21){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')](_0x5cf5('0x2a'),_0x264c21[_0x5cf5('0x1f')]),_0x264c21);queues['queuecallerleave'](_0x264c21);}catch(_0x402baa){utils['error'](util['format'](_0x5cf5('0x2a'),_0x264c21[_0x5cf5('0x1f')]),_0x402baa);}});ami['on'](_0x5cf5('0x2b'),function(_0x54fe93){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')](_0x5cf5('0x2c'),_0x54fe93[_0x5cf5('0x1f')]),_0x54fe93);queues[_0x5cf5('0x2b')](_0x54fe93);calls[_0x5cf5('0x2b')](_0x54fe93);}catch(_0x4aa810){utils[_0x5cf5('0x17')](util[_0x5cf5('0x1a')]('[%s][index][musiconholdstart]',_0x54fe93['uniqueid']),_0x4aa810);}});ami['on'](_0x5cf5('0x2d'),function(_0x5aa70e){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')]('[%s][index][musiconholdstop]',_0x5aa70e[_0x5cf5('0x1f')]),_0x5aa70e);queues['musiconholdstop'](_0x5aa70e);calls[_0x5cf5('0x2d')](_0x5aa70e);}catch(_0x6e691){utils[_0x5cf5('0x17')](util['format'](_0x5cf5('0x2e'),_0x5aa70e['uniqueid']),_0x6e691);}});ami['on']('newstate',function(_0x2195ea){try{utils['debug'](util[_0x5cf5('0x1a')](_0x5cf5('0x2f'),_0x2195ea[_0x5cf5('0x1f')]),_0x2195ea);calls[_0x5cf5('0x30')](_0x2195ea);recordings[_0x5cf5('0x30')](_0x2195ea);}catch(_0x305d6a){utils['error'](util['format'](_0x5cf5('0x2f'),_0x2195ea[_0x5cf5('0x1f')]),_0x305d6a);}});ami['on'](_0x5cf5('0x31'),function(_0x284d8d){try{utils['debug'](util[_0x5cf5('0x1a')]('[%s][index][hangup]',_0x284d8d['uniqueid']),_0x284d8d);calls['hangup'](_0x284d8d);recordings[_0x5cf5('0x31')](_0x284d8d);dials[_0x5cf5('0x31')](_0x284d8d);agents[_0x5cf5('0x31')](_0x284d8d);queues['hangup'](_0x284d8d);}catch(_0x59e418){utils[_0x5cf5('0x17')](util['format'](_0x5cf5('0x32'),_0x284d8d[_0x5cf5('0x1f')]),_0x59e418);}});ami['on'](_0x5cf5('0x33'),function(_0x74db0c){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')]('[%s][index][cdr]',_0x74db0c[_0x5cf5('0x1f')]),_0x74db0c);members[_0x5cf5('0x33')](_0x74db0c);}catch(_0x46cac6){utils[_0x5cf5('0x17')](util[_0x5cf5('0x1a')](_0x5cf5('0x34'),_0x74db0c[_0x5cf5('0x1f')]),_0x46cac6);}});ami['on'](_0x5cf5('0x35'),function(_0x2ce309){try{utils['debug'](util[_0x5cf5('0x1a')](_0x5cf5('0x36'),_0x2ce309[_0x5cf5('0x1f')]),_0x2ce309);queues[_0x5cf5('0x35')](_0x2ce309);agents['blindtransfer'](_0x2ce309);transfers[_0x5cf5('0x35')](_0x2ce309);}catch(_0x409061){utils[_0x5cf5('0x17')](util['format'](_0x5cf5('0x36'),_0x2ce309[_0x5cf5('0x1f')]),_0x409061);}});ami['on'](_0x5cf5('0x37'),function(_0x41a86c){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')]('[%s][index][attendedtransfer]',_0x41a86c[_0x5cf5('0x38')]),_0x41a86c);queues[_0x5cf5('0x37')](_0x41a86c);transfers[_0x5cf5('0x37')](_0x41a86c);agents[_0x5cf5('0x37')](_0x41a86c);calls[_0x5cf5('0x37')](_0x41a86c);}catch(_0x325d6d){utils[_0x5cf5('0x17')](util[_0x5cf5('0x1a')](_0x5cf5('0x39'),_0x41a86c[_0x5cf5('0x38')]),_0x325d6d);}});ami['on'](_0x5cf5('0x3a'),function(_0x2134a5){try{utils['debug'](util[_0x5cf5('0x1a')](_0x5cf5('0x3b'),_0x2134a5[_0x5cf5('0x1f')]),_0x2134a5);queues['varset'](_0x2134a5);recordings[_0x5cf5('0x3a')](_0x2134a5);calls[_0x5cf5('0x3a')](_0x2134a5);dials[_0x5cf5('0x3a')](_0x2134a5);}catch(_0x23d146){utils[_0x5cf5('0x17')](util[_0x5cf5('0x1a')](_0x5cf5('0x3b'),_0x2134a5[_0x5cf5('0x1f')]),_0x23d146);}});ami['on'](_0x5cf5('0x3c'),function(_0x12e6c2){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')]('[%s][index][newexten]',_0x12e6c2[_0x5cf5('0x1f')]),_0x12e6c2);calls[_0x5cf5('0x3c')](_0x12e6c2);recordings[_0x5cf5('0x3c')](_0x12e6c2);dials[_0x5cf5('0x3c')](_0x12e6c2);}catch(_0x65992d){utils['error'](util[_0x5cf5('0x1a')](_0x5cf5('0x3d'),_0x12e6c2[_0x5cf5('0x1f')]),_0x65992d);}});ami['on']('newchannel',function(_0x58d1d9){try{utils['debug'](util['format'](_0x5cf5('0x3e'),_0x58d1d9[_0x5cf5('0x1f')]),_0x58d1d9);calls[_0x5cf5('0x3f')](_0x58d1d9);recordings[_0x5cf5('0x3f')](_0x58d1d9);}catch(_0x3e7ec6){utils[_0x5cf5('0x17')](util['format']('[%s][index][newchannel]',_0x58d1d9['uniqueid']),_0x3e7ec6);}});ami['on'](_0x5cf5('0x40'),function(_0x22b710){try{utils[_0x5cf5('0x19')](util[_0x5cf5('0x1a')]('[%s][index][dialbegin]',_0x22b710['uniqueid']),_0x22b710);dials[_0x5cf5('0x40')](_0x22b710);}catch(_0x41cc39){utils[_0x5cf5('0x17')](util['format'](_0x5cf5('0x41'),_0x22b710['uniqueid']),_0x41cc39);}});ami['on']('dialend',function(_0x2c3d73){try{utils['debug'](util[_0x5cf5('0x1a')](_0x5cf5('0x42'),_0x2c3d73[_0x5cf5('0x1f')]),_0x2c3d73);dials[_0x5cf5('0x43')](_0x2c3d73);}catch(_0x26e305){utils[_0x5cf5('0x17')](util[_0x5cf5('0x1a')](_0x5cf5('0x42'),_0x2c3d73[_0x5cf5('0x1f')]),_0x26e305);}});} \ No newline at end of file +var _0xa8c8=['musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','../../config/environment','./utils','util','xdr','disabled','env','production','asterisk','port','password','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]'];(function(_0x8cdd2d,_0x2cc412){var _0x92d90b=function(_0x24cf70){while(--_0x24cf70){_0x8cdd2d['push'](_0x8cdd2d['shift']());}};_0x92d90b(++_0x2cc412);}(_0xa8c8,0xa3));var _0x8a8c=function(_0xbf1a81,_0x286d08){_0xbf1a81=_0xbf1a81-0x0;var _0x2b42f=_0xa8c8[_0xbf1a81];return _0x2b42f;};var AsteriskManager=require('asterisk-manager');var config=require(_0x8a8c('0x0'));var utils=require(_0x8a8c('0x1'));var util=require(_0x8a8c('0x2'));var isXDREnabled=config[_0x8a8c('0x3')]&&config['xdr'][_0x8a8c('0x4')]?!config[_0x8a8c('0x3')][_0x8a8c('0x4')]:!![];var isProduction=config[_0x8a8c('0x5')]===_0x8a8c('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0x8a8c('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x8a8c('0x7')][_0x8a8c('0x8')],config['asterisk']['ip'],config['asterisk']['username'],config[_0x8a8c('0x7')][_0x8a8c('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x8a8c('0xa')](_0x8a8c('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x8a8c('0xc'));var calls=require(_0x8a8c('0xd'));var queues=require('./queues.controller');var recordings=require(_0x8a8c('0xe'));var members=require(_0x8a8c('0xf'));var dials=require(_0x8a8c('0x10'));var transfers=require(_0x8a8c('0x11'));var core=require('./core.controller');ami['on'](_0x8a8c('0x12'),core[_0x8a8c('0x12')]);ami['on']('shutdown',core[_0x8a8c('0x13')]);ami['on'](_0x8a8c('0x14'),core['fullybooted']);ami['on'](_0x8a8c('0x15'),core[_0x8a8c('0x15')]);ami['on'](_0x8a8c('0x16'),core[_0x8a8c('0x16')]);ami['on'](_0x8a8c('0x17'),core[_0x8a8c('0x17')]);ami['on'](_0x8a8c('0x18'),function(_0x1d8dc2){try{utils[_0x8a8c('0x19')](util[_0x8a8c('0x1a')]('[%s][index][devicestatechange]',_0x1d8dc2[_0x8a8c('0x1b')]),_0x1d8dc2);members[_0x8a8c('0x18')](_0x1d8dc2);}catch(_0xca686a){utils[_0x8a8c('0x15')](util[_0x8a8c('0x1a')](_0x8a8c('0x1c'),_0x1d8dc2['device']),_0xca686a);}});ami['on'](_0x8a8c('0x1d'),function(_0x8d6a7f){try{utils[_0x8a8c('0x19')](util['format']('[%s][index][agentcalled]',_0x8d6a7f['uniqueid']),_0x8d6a7f);agents[_0x8a8c('0x1d')](_0x8d6a7f);}catch(_0xb29da){utils[_0x8a8c('0x15')](util[_0x8a8c('0x1a')](_0x8a8c('0x1e'),_0x8d6a7f[_0x8a8c('0x1f')]),_0xb29da);}});ami['on'](_0x8a8c('0x20'),function(_0x2dd677){try{utils[_0x8a8c('0x19')](util[_0x8a8c('0x1a')]('[%s][index][agentringnoanswer]',_0x2dd677[_0x8a8c('0x1f')]),_0x2dd677);agents[_0x8a8c('0x20')](_0x2dd677);}catch(_0x107361){utils[_0x8a8c('0x15')](util[_0x8a8c('0x1a')](_0x8a8c('0x21'),_0x2dd677[_0x8a8c('0x1f')]),_0x107361);}});ami['on'](_0x8a8c('0x22'),function(_0xdffa09){try{utils[_0x8a8c('0x19')](util['format']('[%s][index][agentconnect]',_0xdffa09[_0x8a8c('0x1f')]),_0xdffa09);agents[_0x8a8c('0x22')](_0xdffa09);queues['agentconnect'](_0xdffa09);}catch(_0x523b74){utils[_0x8a8c('0x15')](util[_0x8a8c('0x1a')](_0x8a8c('0x23'),_0xdffa09[_0x8a8c('0x1f')]),_0x523b74);}});ami['on'](_0x8a8c('0x24'),function(_0x52d308){try{utils[_0x8a8c('0x19')](util[_0x8a8c('0x1a')](_0x8a8c('0x25'),_0x52d308['uniqueid']),_0x52d308);agents[_0x8a8c('0x24')](_0x52d308);queues[_0x8a8c('0x24')](_0x52d308);members[_0x8a8c('0x24')](_0x52d308);}catch(_0x4dc9f3){utils[_0x8a8c('0x15')](util['format'](_0x8a8c('0x25'),_0x52d308[_0x8a8c('0x1f')]),_0x4dc9f3);}});ami['on'](_0x8a8c('0x26'),function(_0x5e3e5e){try{utils[_0x8a8c('0x19')](util['format'](_0x8a8c('0x27'),_0x5e3e5e[_0x8a8c('0x1f')]),_0x5e3e5e);agents[_0x8a8c('0x26')](_0x5e3e5e);queues['queuecallerabandon'](_0x5e3e5e);}catch(_0x27d8f1){utils[_0x8a8c('0x15')](util[_0x8a8c('0x1a')](_0x8a8c('0x27'),_0x5e3e5e[_0x8a8c('0x1f')]),_0x27d8f1);}});ami['on'](_0x8a8c('0x28'),function(_0x55bed2){try{utils[_0x8a8c('0x19')](util['format']('[%s][index][queuecallerjoin]',_0x55bed2[_0x8a8c('0x1f')]),_0x55bed2);queues[_0x8a8c('0x28')](_0x55bed2);recordings[_0x8a8c('0x28')](_0x55bed2);}catch(_0xcfa518){utils['error'](util[_0x8a8c('0x1a')](_0x8a8c('0x29'),_0x55bed2['uniqueid']),_0xcfa518);}});ami['on'](_0x8a8c('0x2a'),function(_0x551555){try{utils['debug'](util[_0x8a8c('0x1a')](_0x8a8c('0x2b'),_0x551555[_0x8a8c('0x1f')]),_0x551555);queues['queuecallerleave'](_0x551555);}catch(_0x33384f){utils[_0x8a8c('0x15')](util[_0x8a8c('0x1a')](_0x8a8c('0x2b'),_0x551555[_0x8a8c('0x1f')]),_0x33384f);}});ami['on'](_0x8a8c('0x2c'),function(_0x5cc43f){try{utils['debug'](util[_0x8a8c('0x1a')](_0x8a8c('0x2d'),_0x5cc43f[_0x8a8c('0x1f')]),_0x5cc43f);queues[_0x8a8c('0x2c')](_0x5cc43f);calls['musiconholdstart'](_0x5cc43f);}catch(_0xdf3772){utils[_0x8a8c('0x15')](util['format'](_0x8a8c('0x2d'),_0x5cc43f['uniqueid']),_0xdf3772);}});ami['on'](_0x8a8c('0x2e'),function(_0x410d0d){try{utils[_0x8a8c('0x19')](util[_0x8a8c('0x1a')](_0x8a8c('0x2f'),_0x410d0d[_0x8a8c('0x1f')]),_0x410d0d);queues[_0x8a8c('0x2e')](_0x410d0d);calls[_0x8a8c('0x2e')](_0x410d0d);}catch(_0x447243){utils[_0x8a8c('0x15')](util[_0x8a8c('0x1a')](_0x8a8c('0x2f'),_0x410d0d[_0x8a8c('0x1f')]),_0x447243);}});ami['on'](_0x8a8c('0x30'),function(_0x540d76){try{utils['debug'](util[_0x8a8c('0x1a')](_0x8a8c('0x31'),_0x540d76[_0x8a8c('0x1f')]),_0x540d76);calls[_0x8a8c('0x30')](_0x540d76);recordings['newstate'](_0x540d76);}catch(_0x5b0f56){utils['error'](util['format'](_0x8a8c('0x31'),_0x540d76[_0x8a8c('0x1f')]),_0x5b0f56);}});ami['on'](_0x8a8c('0x32'),function(_0x4ee57a){try{utils[_0x8a8c('0x19')](util[_0x8a8c('0x1a')](_0x8a8c('0x33'),_0x4ee57a['uniqueid']),_0x4ee57a);calls['hangup'](_0x4ee57a);recordings['hangup'](_0x4ee57a);dials[_0x8a8c('0x32')](_0x4ee57a);agents[_0x8a8c('0x32')](_0x4ee57a);queues[_0x8a8c('0x32')](_0x4ee57a);}catch(_0x379766){utils[_0x8a8c('0x15')](util[_0x8a8c('0x1a')](_0x8a8c('0x33'),_0x4ee57a['uniqueid']),_0x379766);}});ami['on'](_0x8a8c('0x34'),function(_0x91dbcc){try{utils[_0x8a8c('0x19')](util['format'](_0x8a8c('0x35'),_0x91dbcc[_0x8a8c('0x1f')]),_0x91dbcc);members[_0x8a8c('0x34')](_0x91dbcc);}catch(_0x4bb153){utils['error'](util[_0x8a8c('0x1a')](_0x8a8c('0x35'),_0x91dbcc['uniqueid']),_0x4bb153);}});ami['on'](_0x8a8c('0x36'),function(_0x481114){try{utils[_0x8a8c('0x19')](util[_0x8a8c('0x1a')]('[%s][index][blindtransfer]',_0x481114[_0x8a8c('0x1f')]),_0x481114);queues['blindtransfer'](_0x481114);agents[_0x8a8c('0x36')](_0x481114);transfers[_0x8a8c('0x36')](_0x481114);}catch(_0x5dae3b){utils['error'](util['format'](_0x8a8c('0x37'),_0x481114[_0x8a8c('0x1f')]),_0x5dae3b);}});ami['on'](_0x8a8c('0x38'),function(_0x370ef3){try{utils['debug'](util[_0x8a8c('0x1a')](_0x8a8c('0x39'),_0x370ef3[_0x8a8c('0x3a')]),_0x370ef3);queues[_0x8a8c('0x38')](_0x370ef3);transfers['attendedtransfer'](_0x370ef3);agents[_0x8a8c('0x38')](_0x370ef3);calls['attendedtransfer'](_0x370ef3);}catch(_0x163fce){utils[_0x8a8c('0x15')](util['format'](_0x8a8c('0x39'),_0x370ef3['origtransfereruniqueid']),_0x163fce);}});ami['on'](_0x8a8c('0x3b'),function(_0x5a0a47){try{utils['debug'](util[_0x8a8c('0x1a')](_0x8a8c('0x3c'),_0x5a0a47[_0x8a8c('0x1f')]),_0x5a0a47);queues[_0x8a8c('0x3b')](_0x5a0a47);recordings[_0x8a8c('0x3b')](_0x5a0a47);calls[_0x8a8c('0x3b')](_0x5a0a47);dials[_0x8a8c('0x3b')](_0x5a0a47);}catch(_0x5ee2ec){utils[_0x8a8c('0x15')](util['format']('[%s][index][varset]',_0x5a0a47[_0x8a8c('0x1f')]),_0x5ee2ec);}});ami['on']('newexten',function(_0x57204a){try{utils[_0x8a8c('0x19')](util[_0x8a8c('0x1a')](_0x8a8c('0x3d'),_0x57204a['uniqueid']),_0x57204a);calls[_0x8a8c('0x3e')](_0x57204a);recordings[_0x8a8c('0x3e')](_0x57204a);dials[_0x8a8c('0x3e')](_0x57204a);}catch(_0x51efda){utils[_0x8a8c('0x15')](util['format'](_0x8a8c('0x3d'),_0x57204a[_0x8a8c('0x1f')]),_0x51efda);}});ami['on'](_0x8a8c('0x3f'),function(_0x5c1b79){try{utils[_0x8a8c('0x19')](util[_0x8a8c('0x1a')]('[%s][index][newchannel]',_0x5c1b79[_0x8a8c('0x1f')]),_0x5c1b79);calls[_0x8a8c('0x3f')](_0x5c1b79);recordings[_0x8a8c('0x3f')](_0x5c1b79);}catch(_0xbcad2c){utils[_0x8a8c('0x15')](util['format'](_0x8a8c('0x40'),_0x5c1b79['uniqueid']),_0xbcad2c);}});ami['on']('dialbegin',function(_0x38c0a){try{utils[_0x8a8c('0x19')](util[_0x8a8c('0x1a')](_0x8a8c('0x41'),_0x38c0a[_0x8a8c('0x1f')]),_0x38c0a);dials[_0x8a8c('0x42')](_0x38c0a);}catch(_0x2c9b30){utils['error'](util[_0x8a8c('0x1a')](_0x8a8c('0x43'),_0x38c0a[_0x8a8c('0x1f')]),_0x2c9b30);}});ami['on']('dialend',function(_0x303212){try{utils[_0x8a8c('0x19')](util[_0x8a8c('0x1a')]('[%s][index][dialend]',_0x303212['uniqueid']),_0x303212);dials[_0x8a8c('0x44')](_0x303212);}catch(_0xa926a8){utils[_0x8a8c('0x15')](util[_0x8a8c('0x1a')]('[%s][index][dialend]',_0x303212[_0x8a8c('0x1f')]),_0xa926a8);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b4e422d..9a6b8fb 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 _0x3fa7=['NOT_INUSE','isNil','now','diffTime','enterAt','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','exitAt','destinationchannel','destination','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','split','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice'];(function(_0x24b2e5,_0x357215){var _0x266d7e=function(_0x3bedd){while(--_0x3bedd){_0x24b2e5['push'](_0x24b2e5['shift']());}};_0x266d7e(++_0x357215);}(_0x3fa7,0x1b8));var _0x73fa=function(_0x5ad599,_0x514bfb){_0x5ad599=_0x5ad599-0x0;var _0x5b2de1=_0x3fa7[_0x5ad599];return _0x5b2de1;};'use strict';var _=require('lodash');var util=require(_0x73fa('0x0'));var utils=require(_0x73fa('0x1'));var members={};var exclude=[_0x73fa('0x2'),'Queue:'];function writeDB(_0x241348){utils[_0x73fa('0x3')](util[_0x73fa('0x4')](_0x73fa('0x5'),_0x241348[_0x73fa('0x6')],_0x241348[_0x73fa('0x7')],_0x241348[_0x73fa('0x8')],_0x241348[_0x73fa('0x9')],_0x241348[_0x73fa('0xa')],_0x241348[_0x73fa('0xb')]));if(_0x241348[_0x73fa('0x7')]){utils[_0x73fa('0xc')](_0x241348[_0x73fa('0x7')])[_0x73fa('0xd')](function(_0x45689a){if(_0x45689a){_0x241348[_0x73fa('0xa')]=_0x45689a[_0x73fa('0xe')];_0x241348['internal']=_0x45689a[_0x73fa('0xf')];utils[_0x73fa('0x10')](_0x73fa('0x11'),_0x241348);}else{utils['getUserByName'](_0x241348[_0x73fa('0x7')][_0x73fa('0x12')]('/')[0x1])[_0x73fa('0xd')](function(_0x12daf7){if(_0x12daf7){_0x241348[_0x73fa('0xa')]=_0x12daf7['name'];_0x241348[_0x73fa('0xf')]=_0x12daf7[_0x73fa('0xf')];utils[_0x73fa('0x10')](_0x73fa('0x11'),_0x241348);}});}})['catch'](function(_0x4cb61e){utils[_0x73fa('0x13')](util['format']('[%s][members][writeDB]',_0x241348[_0x73fa('0x6')]),_0x4cb61e);});}delete members[_0x241348['interface']];}function startsWith(_0x5b29cf,_0x3e41d2){return _[_0x73fa('0x14')](_0x5b29cf,function(_0x4fde8a){return _[_0x73fa('0x15')](_0x3e41d2,_0x4fde8a);});}exports[_0x73fa('0x16')]=function(_0x214298){try{utils[_0x73fa('0x17')](util[_0x73fa('0x4')](_0x73fa('0x18'),members[_0x214298[_0x73fa('0x19')]]?members[_0x214298[_0x73fa('0x19')]]['uniqueid']:_0x214298[_0x73fa('0x19')]),_0x214298);utils[_0x73fa('0x3')](util[_0x73fa('0x4')](_0x73fa('0x1a'),members[_0x214298[_0x73fa('0x19')]]?members[_0x214298[_0x73fa('0x19')]][_0x73fa('0x6')]:_0x214298[_0x73fa('0x19')],_0x214298[_0x73fa('0x1b')],_0x214298[_0x73fa('0x19')]));switch(_0x214298[_0x73fa('0x1b')]){case _0x73fa('0x1c'):case'BUSY':if(!startsWith(exclude,_0x214298['device'])){members[_0x214298[_0x73fa('0x19')]]={'channel':_0x73fa('0x1d'),'interface':_0x214298['device'],'type':'TALKING','enterAt':utils['now'](),'role':'agent'};}break;case _0x73fa('0x1e'):if(!_[_0x73fa('0x1f')](members[_0x214298[_0x73fa('0x19')]])){members[_0x214298[_0x73fa('0x19')]]['exitAt']=utils[_0x73fa('0x20')]();members[_0x214298[_0x73fa('0x19')]]['duration']=utils[_0x73fa('0x21')](members[_0x214298[_0x73fa('0x19')]]['exitAt'],members[_0x214298[_0x73fa('0x19')]][_0x73fa('0x22')]);if(members[_0x214298[_0x73fa('0x19')]][_0x73fa('0x6')]){writeDB(members[_0x214298[_0x73fa('0x19')]]);}}break;default:break;}}catch(_0x1470da){utils[_0x73fa('0x13')](util['format'](_0x73fa('0x18'),members[_0x214298[_0x73fa('0x19')]]?members[_0x214298[_0x73fa('0x19')]][_0x73fa('0x6')]:_0x214298[_0x73fa('0x19')]),_0x1470da);}};exports['agentcomplete']=function(_0xc8b89f){try{if(!_[_0x73fa('0x1f')](members[_0xc8b89f['interface']])){utils[_0x73fa('0x17')](util[_0x73fa('0x4')]('[%s][members][agentcomplete]',_0xc8b89f['uniqueid']),_0xc8b89f);utils[_0x73fa('0x3')](util[_0x73fa('0x4')](_0x73fa('0x23'),_0xc8b89f[_0x73fa('0x6')],_0xc8b89f[_0x73fa('0x7')],_0xc8b89f[_0x73fa('0x24')]));members[_0xc8b89f[_0x73fa('0x7')]]=_[_0x73fa('0x25')](members[_0xc8b89f[_0x73fa('0x7')]],{'data4':_0xc8b89f[_0x73fa('0x24')],'uniqueid':_0xc8b89f[_0x73fa('0x6')]});}}catch(_0x35477d){utils[_0x73fa('0x13')](util[_0x73fa('0x4')]('[%s][members][agentcomplete]',_0xc8b89f[_0x73fa('0x6')]),_0x35477d);}};exports[_0x73fa('0x26')]=function(_0x35c7fc){try{utils['debug'](util[_0x73fa('0x4')](_0x73fa('0x27'),_0x35c7fc[_0x73fa('0x6')]),_0x35c7fc);if(_0x35c7fc[_0x73fa('0x8')]){var _0x3228ff=_0x35c7fc[_0x73fa('0x8')][_0x73fa('0x12')]('-')[0x0];if(!_[_0x73fa('0x1f')](members[_0x3228ff])){members[_0x3228ff]=_[_0x73fa('0x25')](members[_0x3228ff],{'data1':members[_0x3228ff]['data1']||_0x35c7fc[_0x73fa('0xb')],'data2':members[_0x3228ff][_0x73fa('0x9')]||_0x35c7fc[_0x73fa('0x28')],'data3':members[_0x3228ff][_0x73fa('0x29')]||_0x35c7fc['destination'],'uniqueid':members[_0x3228ff]['uniqueid']||_0x35c7fc[_0x73fa('0x6')]});utils[_0x73fa('0x3')](util[_0x73fa('0x4')](_0x73fa('0x2a'),_0x35c7fc[_0x73fa('0x6')],members[_0x3228ff][_0x73fa('0x2b')],members[_0x3228ff]['data2'],members[_0x3228ff][_0x73fa('0x29')]));if(members[_0x3228ff][_0x73fa('0x2c')]){writeDB(members[_0x3228ff]);}}}if(_0x35c7fc[_0x73fa('0x2d')]){var _0x576036=_0x35c7fc[_0x73fa('0x2d')][_0x73fa('0x12')]('-')[0x0];if(!_[_0x73fa('0x1f')](members[_0x576036])){members[_0x576036]=_[_0x73fa('0x25')](members[_0x576036],{'data1':members[_0x576036][_0x73fa('0x2b')]||_0x35c7fc[_0x73fa('0xb')],'data2':members[_0x576036][_0x73fa('0x9')]||_0x35c7fc[_0x73fa('0x28')],'data3':members[_0x576036][_0x73fa('0x29')]||_0x35c7fc[_0x73fa('0x2e')],'uniqueid':members[_0x576036][_0x73fa('0x6')]||_0x35c7fc[_0x73fa('0x6')]});utils[_0x73fa('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x35c7fc[_0x73fa('0x6')],members[_0x576036][_0x73fa('0x2b')],members[_0x576036][_0x73fa('0x9')],members[_0x576036]['data3']));if(members[_0x576036][_0x73fa('0x2c')]){writeDB(members[_0x576036]);}}}}catch(_0x2b146c){utils[_0x73fa('0x13')](util[_0x73fa('0x4')]('[%s][members][cdr]',_0x35c7fc[_0x73fa('0x6')]),_0x2b146c);}}; \ No newline at end of file +var _0x3383=['some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','[%s][members][writeDB]'];(function(_0x3b4967,_0x267d42){var _0x47fc11=function(_0x5b6c4b){while(--_0x5b6c4b){_0x3b4967['push'](_0x3b4967['shift']());}};_0x47fc11(++_0x267d42);}(_0x3383,0x1b5));var _0x3338=function(_0x4eace3,_0x3f4f13){_0x4eace3=_0x4eace3-0x0;var _0x3600a6=_0x3383[_0x4eace3];return _0x3600a6;};'use strict';var _=require(_0x3338('0x0'));var util=require('util');var utils=require(_0x3338('0x1'));var members={};var exclude=[_0x3338('0x2'),_0x3338('0x3')];function writeDB(_0x16696f){utils[_0x3338('0x4')](util[_0x3338('0x5')](_0x3338('0x6'),_0x16696f[_0x3338('0x7')],_0x16696f[_0x3338('0x8')],_0x16696f[_0x3338('0x9')],_0x16696f['data2'],_0x16696f[_0x3338('0xa')],_0x16696f[_0x3338('0xb')]));if(_0x16696f[_0x3338('0x8')]){utils[_0x3338('0xc')](_0x16696f[_0x3338('0x8')])['then'](function(_0x1d8594){if(_0x1d8594){_0x16696f[_0x3338('0xa')]=_0x1d8594['name'];_0x16696f['internal']=_0x1d8594[_0x3338('0xd')];utils[_0x3338('0xe')](_0x3338('0xf'),_0x16696f);}else{utils[_0x3338('0x10')](_0x16696f[_0x3338('0x8')][_0x3338('0x11')]('/')[0x1])[_0x3338('0x12')](function(_0x35403a){if(_0x35403a){_0x16696f[_0x3338('0xa')]=_0x35403a['name'];_0x16696f['internal']=_0x35403a[_0x3338('0xd')];utils['request'](_0x3338('0xf'),_0x16696f);}});}})[_0x3338('0x13')](function(_0x5a0ae0){utils[_0x3338('0x14')](util['format'](_0x3338('0x15'),_0x16696f['uniqueid']),_0x5a0ae0);});}delete members[_0x16696f[_0x3338('0x8')]];}function startsWith(_0x8b37f5,_0x60e1de){return _[_0x3338('0x16')](_0x8b37f5,function(_0x37972e){return _['startsWith'](_0x60e1de,_0x37972e);});}exports[_0x3338('0x17')]=function(_0xa729eb){try{utils[_0x3338('0x18')](util['format'](_0x3338('0x19'),members[_0xa729eb[_0x3338('0x1a')]]?members[_0xa729eb[_0x3338('0x1a')]][_0x3338('0x7')]:_0xa729eb[_0x3338('0x1a')]),_0xa729eb);utils[_0x3338('0x4')](util[_0x3338('0x5')](_0x3338('0x1b'),members[_0xa729eb[_0x3338('0x1a')]]?members[_0xa729eb[_0x3338('0x1a')]]['uniqueid']:_0xa729eb[_0x3338('0x1a')],_0xa729eb[_0x3338('0x1c')],_0xa729eb['device']));switch(_0xa729eb[_0x3338('0x1c')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0xa729eb[_0x3338('0x1a')])){members[_0xa729eb[_0x3338('0x1a')]]={'channel':_0x3338('0x1d'),'interface':_0xa729eb[_0x3338('0x1a')],'type':_0x3338('0x1e'),'enterAt':utils[_0x3338('0x1f')](),'role':_0x3338('0x20')};}break;case _0x3338('0x21'):if(!_[_0x3338('0x22')](members[_0xa729eb[_0x3338('0x1a')]])){members[_0xa729eb['device']][_0x3338('0x23')]=utils[_0x3338('0x1f')]();members[_0xa729eb['device']]['duration']=utils[_0x3338('0x24')](members[_0xa729eb[_0x3338('0x1a')]][_0x3338('0x23')],members[_0xa729eb['device']][_0x3338('0x25')]);if(members[_0xa729eb[_0x3338('0x1a')]][_0x3338('0x7')]){writeDB(members[_0xa729eb['device']]);}}break;default:break;}}catch(_0x4eb58e){utils[_0x3338('0x14')](util['format']('[%s][members][devicestatechange]',members[_0xa729eb[_0x3338('0x1a')]]?members[_0xa729eb['device']][_0x3338('0x7')]:_0xa729eb['device']),_0x4eb58e);}};exports[_0x3338('0x26')]=function(_0x3659b3){try{if(!_['isNil'](members[_0x3659b3['interface']])){utils['debug'](util['format'](_0x3338('0x27'),_0x3659b3[_0x3338('0x7')]),_0x3659b3);utils['info'](util['format'](_0x3338('0x28'),_0x3659b3['uniqueid'],_0x3659b3[_0x3338('0x8')],_0x3659b3['queue']));members[_0x3659b3[_0x3338('0x8')]]=_[_0x3338('0x29')](members[_0x3659b3['interface']],{'data4':_0x3659b3[_0x3338('0x2a')],'uniqueid':_0x3659b3[_0x3338('0x7')]});}}catch(_0x5348d3){utils[_0x3338('0x14')](util[_0x3338('0x5')](_0x3338('0x27'),_0x3659b3[_0x3338('0x7')]),_0x5348d3);}};exports[_0x3338('0x2b')]=function(_0x4ae709){try{utils['debug'](util['format'](_0x3338('0x2c'),_0x4ae709[_0x3338('0x7')]),_0x4ae709);if(_0x4ae709[_0x3338('0x9')]){var _0x19955b=_0x4ae709[_0x3338('0x9')][_0x3338('0x11')]('-')[0x0];if(!_[_0x3338('0x22')](members[_0x19955b])){members[_0x19955b]=_[_0x3338('0x29')](members[_0x19955b],{'data1':members[_0x19955b][_0x3338('0x2d')]||_0x4ae709['type'],'data2':members[_0x19955b][_0x3338('0x2e')]||_0x4ae709[_0x3338('0x2f')],'data3':members[_0x19955b][_0x3338('0x30')]||_0x4ae709[_0x3338('0x31')],'uniqueid':members[_0x19955b]['uniqueid']||_0x4ae709[_0x3338('0x7')]});utils[_0x3338('0x4')](util[_0x3338('0x5')](_0x3338('0x32'),_0x4ae709['uniqueid'],members[_0x19955b]['data1'],members[_0x19955b][_0x3338('0x2e')],members[_0x19955b][_0x3338('0x30')]));if(members[_0x19955b][_0x3338('0x23')]){writeDB(members[_0x19955b]);}}}if(_0x4ae709['destinationchannel']){var _0x2457d3=_0x4ae709['destinationchannel']['split']('-')[0x0];if(!_[_0x3338('0x22')](members[_0x2457d3])){members[_0x2457d3]=_[_0x3338('0x29')](members[_0x2457d3],{'data1':members[_0x2457d3]['data1']||_0x4ae709[_0x3338('0xb')],'data2':members[_0x2457d3][_0x3338('0x2e')]||_0x4ae709[_0x3338('0x2f')],'data3':members[_0x2457d3][_0x3338('0x30')]||_0x4ae709['destination'],'uniqueid':members[_0x2457d3]['uniqueid']||_0x4ae709[_0x3338('0x7')]});utils[_0x3338('0x4')](util[_0x3338('0x5')](_0x3338('0x32'),_0x4ae709[_0x3338('0x7')],members[_0x2457d3][_0x3338('0x2d')],members[_0x2457d3][_0x3338('0x2e')],members[_0x2457d3][_0x3338('0x30')]));if(members[_0x2457d3][_0x3338('0x23')]){writeDB(members[_0x2457d3]);}}}}catch(_0x289974){utils[_0x3338('0x14')](util[_0x3338('0x5')]('[%s][members][cdr]',_0x4ae709[_0x3338('0x7')]),_0x289974);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index d97ed63..46c31af 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 _0x8890=['[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','isNil','queueposition','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','transfertype','ATTENDED','transferuniqueid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','channel','queue','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','hangup'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8890,0xbe));var _0x0889=function(_0x566f02,_0xd24c72){_0x566f02=_0x566f02-0x0;var _0x236770=_0x8890[_0x566f02];return _0x236770;};'use strict';var _=require(_0x0889('0x0'));var util=require(_0x0889('0x1'));var utils=require(_0x0889('0x2'));var queues={};function writeDB(_0x49e852){utils[_0x0889('0x3')](util[_0x0889('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x49e852['uniqueid'],_0x49e852[_0x0889('0x5')],_0x49e852[_0x0889('0x6')],_0x49e852['lastAssignedTo'],_0x49e852[_0x0889('0x7')],_0x49e852[_0x0889('0x8')],_0x49e852['queuecallerexitreason']));if(_0x49e852[_0x0889('0x6')]){utils[_0x0889('0x9')](_0x49e852['queue'])[_0x0889('0xa')](function(_0x38fda6){if(_0x38fda6){_0x49e852[_0x0889('0xb')]=_0x38fda6[_0x0889('0xb')];}utils[_0x0889('0xc')](_0x0889('0xd'),_0x49e852);});}else{utils[_0x0889('0xc')]('CreateVoiceQueueReport',_0x49e852);}if(_0x49e852[_0x0889('0xe')]){delete queues[_0x49e852[_0x0889('0xe')]];}else{delete queues[_0x49e852[_0x0889('0xf')]];}}exports[_0x0889('0x10')]=function(_0x2402bd){try{utils[_0x0889('0x11')](util[_0x0889('0x4')]('[%s][queues][queuecallerjoin]',_0x2402bd['uniqueid']),_0x2402bd);utils[_0x0889('0x3')](util[_0x0889('0x4')](_0x0889('0x12'),_0x2402bd[_0x0889('0xf')],_0x2402bd[_0x0889('0x6')],_0x2402bd['position']));queues[_0x2402bd[_0x0889('0xf')]]=_[_0x0889('0x13')](_0x2402bd,{'originalposition':_0x2402bd[_0x0889('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4cc806){utils['error'](util[_0x0889('0x4')]('[%s][queues][queuecallerjoin]',_0x2402bd[_0x0889('0xf')]),_0x4cc806);}};exports[_0x0889('0x15')]=function(_0x4264ad){try{if(!_['isNil'](queues[_0x4264ad[_0x0889('0xf')]])){utils[_0x0889('0x11')](util['format'](_0x0889('0x16'),_0x4264ad[_0x0889('0xf')]),_0x4264ad);if(queues[_0x4264ad['uniqueid']][_0x0889('0x17')]){if(!queues[_0x4264ad[_0x0889('0xf')]][_0x0889('0x18')]&&!queues[_0x4264ad[_0x0889('0xf')]][_0x0889('0x19')]){queues[_0x4264ad['uniqueid']][_0x0889('0x1a')]=!![];queues[_0x4264ad[_0x0889('0xf')]][_0x0889('0x1b')]=utils[_0x0889('0x1c')]();queues[_0x4264ad[_0x0889('0xf')]][_0x0889('0x1d')]=_0x0889('0x1e');}utils[_0x0889('0x3')](util[_0x0889('0x4')](_0x0889('0x1f'),_0x4264ad[_0x0889('0xf')],queues[_0x4264ad[_0x0889('0xf')]][_0x0889('0x20')],queues[_0x4264ad['uniqueid']][_0x0889('0x1d')]));writeDB(queues[_0x4264ad['uniqueid']]);}else if(queues[_0x4264ad[_0x0889('0xf')]][_0x0889('0xe')]){utils[_0x0889('0x3')](util[_0x0889('0x4')](_0x0889('0x21'),_0x4264ad[_0x0889('0xf')],queues[_0x4264ad[_0x0889('0xf')]][_0x0889('0x20')],queues[_0x4264ad[_0x0889('0xf')]][_0x0889('0xe')]));queues[queues[_0x4264ad['uniqueid']][_0x0889('0xe')]]=queues[_0x4264ad[_0x0889('0xf')]];queues[queues[_0x4264ad[_0x0889('0xf')]]['transfereduniqueid']][_0x0889('0x22')]=0x2;delete queues[_0x4264ad[_0x0889('0xf')]];}}}catch(_0x3f11e0){utils[_0x0889('0x23')](util[_0x0889('0x4')](_0x0889('0x16'),_0x4264ad['uniqueid']),_0x3f11e0);}};exports[_0x0889('0x24')]=function(_0x1fd3a2){try{utils[_0x0889('0x11')](util['format'](_0x0889('0x25'),_0x1fd3a2['uniqueid']),_0x1fd3a2);if(!_['isNil'](_0x1fd3a2[_0x0889('0x26')][_0x0889('0x27')])&&_0x1fd3a2[_0x0889('0x28')]['toUpperCase']()!==_0x0889('0x29')){if(!_['isNil'](queues[_0x1fd3a2['uniqueid']])){queues[_0x1fd3a2[_0x0889('0xf')]][_0x0889('0x18')]=![];queues[_0x1fd3a2[_0x0889('0xf')]]['queuecallerabandonAt']=null;queues[_0x1fd3a2[_0x0889('0xf')]][_0x0889('0x19')]=!![];queues[_0x1fd3a2[_0x0889('0xf')]]['queuecallerexitAt']=utils[_0x0889('0x1c')]();queues[_0x1fd3a2[_0x0889('0xf')]][_0x0889('0x1d')]=_0x1fd3a2['value'][_0x0889('0x2a')]();utils[_0x0889('0x3')](util[_0x0889('0x4')](_0x0889('0x2b'),_0x1fd3a2[_0x0889('0xf')],queues[_0x1fd3a2[_0x0889('0xf')]][_0x0889('0x20')],_0x1fd3a2['value'],queues[_0x1fd3a2['uniqueid']][_0x0889('0x1d')]));writeDB(queues[_0x1fd3a2[_0x0889('0xf')]]);}}else if(!_[_0x0889('0x2c')](_0x1fd3a2[_0x0889('0x26')][_0x0889('0x2d')])){if(!_[_0x0889('0x2c')](queues[_0x1fd3a2[_0x0889('0xf')]])&&!queues[_0x1fd3a2[_0x0889('0xf')]][_0x0889('0x18')]){queues[_0x1fd3a2[_0x0889('0xf')]][_0x0889('0x18')]=![];queues[_0x1fd3a2[_0x0889('0xf')]][_0x0889('0x2e')]=null;queues[_0x1fd3a2['uniqueid']][_0x0889('0x19')]=!![];queues[_0x1fd3a2[_0x0889('0xf')]][_0x0889('0x2f')]=utils[_0x0889('0x1c')]();queues[_0x1fd3a2['uniqueid']][_0x0889('0x1d')]=_0x0889('0x30');utils['info'](util[_0x0889('0x4')](_0x0889('0x31'),_0x1fd3a2[_0x0889('0xf')],queues[_0x1fd3a2[_0x0889('0xf')]][_0x0889('0x20')],_0x1fd3a2['value'],queues[_0x1fd3a2[_0x0889('0xf')]][_0x0889('0x1d')]));}}}catch(_0x29962d){utils[_0x0889('0x23')](util[_0x0889('0x4')]('[%s][queues][varset]',_0x1fd3a2[_0x0889('0xf')]),_0x29962d);}};exports[_0x0889('0x18')]=function(_0x4ff48b){try{if(!_[_0x0889('0x2c')](queues[_0x4ff48b[_0x0889('0xf')]])){utils[_0x0889('0x11')](util[_0x0889('0x4')]('[%s][queues][queuecallerabandon]',_0x4ff48b[_0x0889('0xf')]),_0x4ff48b);queues[_0x4ff48b[_0x0889('0xf')]][_0x0889('0x19')]=![];queues[_0x4ff48b[_0x0889('0xf')]][_0x0889('0x2f')]=null;queues[_0x4ff48b[_0x0889('0xf')]][_0x0889('0x18')]=!![];queues[_0x4ff48b[_0x0889('0xf')]]['queuecallerabandonAt']=utils['now']();queues[_0x4ff48b[_0x0889('0xf')]][_0x0889('0x1d')]=_0x0889('0x32');utils[_0x0889('0x3')](util[_0x0889('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x4ff48b['uniqueid'],queues[_0x4ff48b[_0x0889('0xf')]]['name'],queues[_0x4ff48b[_0x0889('0xf')]][_0x0889('0x1d')]));}}catch(_0x237c62){utils[_0x0889('0x23')](util[_0x0889('0x4')]('[%s][queues][queuecallerabandon]',_0x4ff48b[_0x0889('0xf')]),_0x237c62);}};exports[_0x0889('0x33')]=function(_0x2a2aef){try{if(!_[_0x0889('0x2c')](queues[_0x2a2aef[_0x0889('0xf')]])){utils[_0x0889('0x11')](util[_0x0889('0x4')](_0x0889('0x34'),_0x2a2aef[_0x0889('0xf')]),_0x2a2aef);utils[_0x0889('0x3')](util[_0x0889('0x4')](_0x0889('0x35'),_0x2a2aef[_0x0889('0xf')],queues[_0x2a2aef[_0x0889('0xf')]][_0x0889('0x20')],_0x2a2aef[_0x0889('0x36')],_0x2a2aef['connectedlinename']));queues[_0x2a2aef['uniqueid']][_0x0889('0x33')]=!![];queues[_0x2a2aef['uniqueid']]['queuecallerleaveAt']=utils[_0x0889('0x1c')]();queues[_0x2a2aef['uniqueid']][_0x0889('0x37')]=utils[_0x0889('0x38')](queues[_0x2a2aef[_0x0889('0xf')]][_0x0889('0x17')],queues[_0x2a2aef[_0x0889('0xf')]][_0x0889('0x39')]);queues[_0x2a2aef['uniqueid']][_0x0889('0x14')]=_0x2a2aef[_0x0889('0x14')];queues[_0x2a2aef[_0x0889('0xf')]][_0x0889('0x3a')]=_0x2a2aef[_0x0889('0x3a')];queues[_0x2a2aef['uniqueid']][_0x0889('0x36')]=_0x2a2aef[_0x0889('0x36')];queues[_0x2a2aef[_0x0889('0xf')]]['connectedlinename']=_0x2a2aef[_0x0889('0x3b')];}}catch(_0xd1d2ca){utils[_0x0889('0x23')](util['format'](_0x0889('0x34'),_0x2a2aef['uniqueid']),_0xd1d2ca);}};exports[_0x0889('0x3c')]=function(_0x12e4cf){try{if(!_[_0x0889('0x2c')](queues[_0x12e4cf[_0x0889('0xf')]])){utils[_0x0889('0x11')](util['format'](_0x0889('0x3d'),_0x12e4cf[_0x0889('0xf')]),_0x12e4cf);utils[_0x0889('0x3')](util['format'](_0x0889('0x3e'),_0x12e4cf['uniqueid'],queues[_0x12e4cf[_0x0889('0xf')]][_0x0889('0x20')],_0x12e4cf[_0x0889('0x3f')],_0x12e4cf[_0x0889('0x40')]));queues[_0x12e4cf[_0x0889('0xf')]]['queuecallerabandon']=![];queues[_0x12e4cf['uniqueid']][_0x0889('0x18')]=![];queues[_0x12e4cf[_0x0889('0xf')]][_0x0889('0x2e')]=null;queues[_0x12e4cf['uniqueid']]['queuecallerexit']=![];queues[_0x12e4cf[_0x0889('0xf')]][_0x0889('0x1d')]=null;queues[_0x12e4cf[_0x0889('0xf')]][_0x0889('0x2f')]=null;queues[_0x12e4cf['uniqueid']]['assigned']=!![];queues[_0x12e4cf[_0x0889('0xf')]][_0x0889('0x8')]=_0x12e4cf[_0x0889('0x40')];queues[_0x12e4cf[_0x0889('0xf')]][_0x0889('0x41')]=_0x12e4cf[_0x0889('0x3f')];}}catch(_0x3ffa5a){utils[_0x0889('0x23')](util[_0x0889('0x4')]('[%s][queues][agentconnect]',_0x12e4cf['uniqueid']),_0x3ffa5a);}};exports[_0x0889('0x42')]=function(_0x3b4603){try{if(!_[_0x0889('0x2c')](queues[_0x3b4603[_0x0889('0xf')]])){if(queues[_0x3b4603[_0x0889('0xf')]]['queuecallerleaveAt']){utils[_0x0889('0x11')](util[_0x0889('0x4')](_0x0889('0x43'),_0x3b4603[_0x0889('0xf')]),_0x3b4603);queues[_0x3b4603['uniqueid']]['queuecallerabandon']=![];queues[_0x3b4603[_0x0889('0xf')]][_0x0889('0x18')]=![];queues[_0x3b4603['uniqueid']][_0x0889('0x2e')]=null;queues[_0x3b4603[_0x0889('0xf')]]['queuecallerexit']=![];queues[_0x3b4603[_0x0889('0xf')]][_0x0889('0x2f')]=null;queues[_0x3b4603[_0x0889('0xf')]]['assigned']=!![];queues[_0x3b4603[_0x0889('0xf')]][_0x0889('0x41')]=_0x3b4603[_0x0889('0x3f')];queues[_0x3b4603[_0x0889('0xf')]][_0x0889('0x1a')]=!![];queues[_0x3b4603[_0x0889('0xf')]]['queuecallercompleteAt']=utils[_0x0889('0x1c')]();if(_0x3b4603[_0x0889('0x44')]==_0x0889('0x45')){if(!queues[_0x3b4603['uniqueid']][_0x0889('0x45')]){queues[_0x3b4603[_0x0889('0xf')]]['queuecallerexitreason']=_0x0889('0x46');}}else{queues[_0x3b4603[_0x0889('0xf')]][_0x0889('0x1d')]=_0x0889('0x47')+_0x3b4603[_0x0889('0x44')][_0x0889('0x2a')]();}utils['info'](util[_0x0889('0x4')](_0x0889('0x48'),_0x3b4603['uniqueid'],queues[_0x3b4603['uniqueid']]['name'],_0x3b4603['membername'],queues[_0x3b4603['uniqueid']][_0x0889('0x1d')]));writeDB(queues[_0x3b4603[_0x0889('0xf')]]);}}}catch(_0x28afb6){utils[_0x0889('0x23')](util[_0x0889('0x4')](_0x0889('0x43'),_0x3b4603[_0x0889('0xf')]),_0x28afb6);}};exports[_0x0889('0x49')]=function(_0xf445dc){try{if(!_[_0x0889('0x2c')](queues[_0xf445dc[_0x0889('0x4a')]])){utils['debug'](util[_0x0889('0x4')](_0x0889('0x4b'),_0xf445dc['uniqueid']),_0xf445dc);queues[_0xf445dc['transfereeuniqueid']][_0x0889('0x45')]=!![];queues[_0xf445dc[_0x0889('0x4a')]]['transfertype']=_0x0889('0x4c');queues[_0xf445dc[_0x0889('0x4a')]][_0x0889('0x4d')]=_0xf445dc[_0x0889('0x4e')];queues[_0xf445dc[_0x0889('0x4a')]]['transferuniqueid']=_0xf445dc[_0x0889('0x4a')];queues[_0xf445dc[_0x0889('0x4a')]][_0x0889('0x1d')]='BLINDTRANSFER';utils['info'](util[_0x0889('0x4')](_0x0889('0x4f'),_0xf445dc['uniqueid'],queues[_0xf445dc[_0x0889('0x4a')]][_0x0889('0x20')],_0xf445dc[_0x0889('0x4a')],_0xf445dc[_0x0889('0x4e')]));}}catch(_0x587ec6){utils['error'](util['format'](_0x0889('0x4b'),_0xf445dc[_0x0889('0xf')]),_0x587ec6);}};exports['attendedtransfer']=function(_0x3c02f7){try{utils[_0x0889('0x11')](util['format'](_0x0889('0x50'),_0x3c02f7['origtransfereruniqueid']),_0x3c02f7);if(_0x3c02f7['origtransfereruniqueid']==_0x3c02f7[_0x0889('0x51')]){if(!_['isNil'](queues[_0x3c02f7[_0x0889('0x52')]])){utils[_0x0889('0x3')](util[_0x0889('0x4')](_0x0889('0x53'),_0x3c02f7[_0x0889('0x54')],queues[_0x3c02f7[_0x0889('0x52')]][_0x0889('0x20')],_0x3c02f7[_0x0889('0x55')]));queues[_0x3c02f7['secondtransfererlinkedid']]['transfer']=!![];queues[_0x3c02f7['secondtransfererlinkedid']][_0x0889('0x56')]=_0x0889('0x57');queues[_0x3c02f7[_0x0889('0x52')]][_0x0889('0x4d')]=_0x3c02f7[_0x0889('0x55')];queues[_0x3c02f7[_0x0889('0x52')]][_0x0889('0x58')]=_0x3c02f7[_0x0889('0x54')];queues[_0x3c02f7[_0x0889('0x52')]][_0x0889('0x1d')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x3c02f7[_0x0889('0x51')]])){if(_0x3c02f7[_0x0889('0x59')]&&queues[_0x3c02f7['transfereelinkedid']]){queues[_0x3c02f7['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x3c02f7['transfereeuniqueid']]=_['clone'](queues[_0x3c02f7[_0x0889('0x59')]]);queues[_0x3c02f7['transfereeuniqueid']][_0x0889('0xe')]=_0x3c02f7[_0x0889('0x5a')];queues[_0x3c02f7[_0x0889('0x4a')]][_0x0889('0x22')]=0x2;queues[_0x3c02f7[_0x0889('0x4a')]][_0x0889('0x7')]=queues[_0x3c02f7[_0x0889('0x52')]][_0x0889('0x7')];queues[_0x3c02f7['transfereeuniqueid']]['calleridname']=queues[_0x3c02f7[_0x0889('0x52')]][_0x0889('0x5b')];queues[_0x3c02f7[_0x0889('0x4a')]][_0x0889('0x39')]=utils[_0x0889('0x1c')]();queues[_0x3c02f7[_0x0889('0x4a')]][_0x0889('0x17')]=utils['now']();queues[_0x3c02f7[_0x0889('0x4a')]][_0x0889('0x37')]=0x0;queues[_0x3c02f7['transfereeuniqueid']][_0x0889('0x5c')]=0x0;utils[_0x0889('0x3')](util[_0x0889('0x4')](_0x0889('0x5d'),_0x3c02f7[_0x0889('0x54')],queues[_0x3c02f7[_0x0889('0x4a')]][_0x0889('0x20')],queues[_0x3c02f7[_0x0889('0x4a')]]['calleridnum'],queues[_0x3c02f7[_0x0889('0x4a')]]['calleridname']));}else{utils[_0x0889('0x3')](util[_0x0889('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3c02f7[_0x0889('0x54')],queues[_0x3c02f7[_0x0889('0x51')]][_0x0889('0x20')],_0x3c02f7[_0x0889('0x52')]));queues[_0x3c02f7[_0x0889('0x51')]][_0x0889('0xe')]=_0x3c02f7['secondtransfererlinkedid'];}}}else if(_0x3c02f7[_0x0889('0x5e')]==_0x3c02f7[_0x0889('0x52')]){if(!_[_0x0889('0x2c')](queues[_0x3c02f7[_0x0889('0x51')]])){utils['info'](util[_0x0889('0x4')](_0x0889('0x5f'),_0x3c02f7[_0x0889('0x54')],queues[_0x3c02f7[_0x0889('0x51')]][_0x0889('0x20')],_0x3c02f7[_0x0889('0x5e')],_0x3c02f7[_0x0889('0x60')]));queues[_0x3c02f7[_0x0889('0x51')]][_0x0889('0x45')]=!![];queues[_0x3c02f7['origtransfererlinkedid']][_0x0889('0x56')]=_0x0889('0x57');queues[_0x3c02f7[_0x0889('0x51')]][_0x0889('0x4d')]=_0x3c02f7[_0x0889('0x60')];queues[_0x3c02f7['origtransfererlinkedid']]['transferuniqueid']=_0x3c02f7[_0x0889('0x5e')];queues[_0x3c02f7[_0x0889('0x51')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x3c02f7['secondtransfererlinkedid']])){if(_0x3c02f7[_0x0889('0x61')]&&queues[_0x3c02f7[_0x0889('0x61')]]){queues[_0x3c02f7[_0x0889('0x61')]]['queuecallerenterreason']=0x1;queues[_0x3c02f7[_0x0889('0x5a')]]=_['clone'](queues[_0x3c02f7[_0x0889('0x61')]]);queues[_0x3c02f7[_0x0889('0x5a')]]['transfereduniqueid']=_0x3c02f7['transfertargetuniqueid'];queues[_0x3c02f7['transfertargetuniqueid']][_0x0889('0x22')]=0x2;queues[_0x3c02f7['transfertargetuniqueid']][_0x0889('0x7')]=queues[_0x3c02f7[_0x0889('0x51')]]['calleridnum'];queues[_0x3c02f7[_0x0889('0x5a')]][_0x0889('0x5b')]=queues[_0x3c02f7[_0x0889('0x51')]][_0x0889('0x5b')];queues[_0x3c02f7[_0x0889('0x5a')]][_0x0889('0x39')]=utils[_0x0889('0x1c')]();queues[_0x3c02f7[_0x0889('0x5a')]][_0x0889('0x17')]=utils[_0x0889('0x1c')]();queues[_0x3c02f7[_0x0889('0x5a')]]['holdtime']=0x0;queues[_0x3c02f7[_0x0889('0x5a')]][_0x0889('0x5c')]=0x0;utils['info'](util[_0x0889('0x4')](_0x0889('0x62'),_0x3c02f7[_0x0889('0x54')],queues[_0x3c02f7[_0x0889('0x5a')]][_0x0889('0x20')],queues[_0x3c02f7[_0x0889('0x5a')]]['transfereduniqueid'],queues[_0x3c02f7[_0x0889('0x5a')]][_0x0889('0x7')],queues[_0x3c02f7[_0x0889('0x5a')]][_0x0889('0x5b')]));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3c02f7[_0x0889('0x54')],queues[_0x3c02f7[_0x0889('0x52')]][_0x0889('0x20')],_0x3c02f7[_0x0889('0x51')]));queues[_0x3c02f7[_0x0889('0x52')]][_0x0889('0xe')]=_0x3c02f7['origtransfererlinkedid'];}}}}catch(_0x19ca05){utils[_0x0889('0x23')](util[_0x0889('0x4')]('[%s][queues][attendedtransfer]',_0x3c02f7[_0x0889('0x54')]),_0x19ca05);}};exports[_0x0889('0x63')]=function(_0x18cf7e){try{if(!_['isNil'](queues[_0x18cf7e['uniqueid']])){utils[_0x0889('0x11')](util[_0x0889('0x4')](_0x0889('0x64'),_0x18cf7e[_0x0889('0xf')]),_0x18cf7e);queues[_0x18cf7e[_0x0889('0xf')]]['musiconholdstartAt']=utils[_0x0889('0x1c')]();utils[_0x0889('0x3')](util[_0x0889('0x4')](_0x0889('0x65'),_0x18cf7e[_0x0889('0xf')],queues[_0x18cf7e[_0x0889('0xf')]]['name'],queues[_0x18cf7e[_0x0889('0xf')]][_0x0889('0x66')]));}}catch(_0x58d71a){utils[_0x0889('0x23')](util['format'](_0x0889('0x64'),_0x18cf7e[_0x0889('0xf')]),_0x58d71a);}};exports[_0x0889('0x67')]=function(_0x39f7fb){try{if(!_['isNil'](queues[_0x39f7fb[_0x0889('0xf')]])){if(!_['isNil'](queues[_0x39f7fb[_0x0889('0xf')]]['musiconholdstartAt'])){utils[_0x0889('0x11')](util[_0x0889('0x4')](_0x0889('0x68'),_0x39f7fb[_0x0889('0xf')]),_0x39f7fb);queues[_0x39f7fb['uniqueid']][_0x0889('0x5c')]+=utils[_0x0889('0x38')](utils['now'](),queues[_0x39f7fb[_0x0889('0xf')]][_0x0889('0x66')]);utils[_0x0889('0x3')](util['format'](_0x0889('0x69'),_0x39f7fb[_0x0889('0xf')],queues[_0x39f7fb[_0x0889('0xf')]]['name'],queues[_0x39f7fb[_0x0889('0xf')]]['mohtime']));delete queues[_0x39f7fb[_0x0889('0xf')]][_0x0889('0x66')];}}}catch(_0x4ce818){utils[_0x0889('0x23')](util[_0x0889('0x4')](_0x0889('0x68'),_0x39f7fb[_0x0889('0xf')]),_0x4ce818);}}; \ No newline at end of file +var _0x0b18=['[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','[%s][queues][blindtransfer]','transfereeuniqueid','transfer','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','transfereelinkedid','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','queuecallerenterreason','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','info','varset','[%s][queues][varset]','variable','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','name','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','queuecallercomplete','reason','TRANSFER','COMPLETEDBY'];(function(_0x35ad9f,_0xddd3dc){var _0x197dea=function(_0x4b0b1b){while(--_0x4b0b1b){_0x35ad9f['push'](_0x35ad9f['shift']());}};_0x197dea(++_0xddd3dc);}(_0x0b18,0x1b7));var _0x80b1=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x0b18[_0x3c04ef];return _0x6a3a69;};'use strict';var _=require('lodash');var util=require(_0x80b1('0x0'));var utils=require(_0x80b1('0x1'));var queues={};function writeDB(_0x174e43){utils['info'](util[_0x80b1('0x2')](_0x80b1('0x3'),_0x174e43[_0x80b1('0x4')],_0x174e43[_0x80b1('0x5')],_0x174e43[_0x80b1('0x6')],_0x174e43['lastAssignedTo'],_0x174e43[_0x80b1('0x7')],_0x174e43[_0x80b1('0x8')],_0x174e43['queuecallerexitreason']));if(_0x174e43[_0x80b1('0x6')]){utils[_0x80b1('0x9')](_0x174e43[_0x80b1('0x6')])[_0x80b1('0xa')](function(_0x1a7a78){if(_0x1a7a78){_0x174e43[_0x80b1('0xb')]=_0x1a7a78[_0x80b1('0xb')];}utils[_0x80b1('0xc')](_0x80b1('0xd'),_0x174e43);});}else{utils[_0x80b1('0xc')](_0x80b1('0xd'),_0x174e43);}if(_0x174e43[_0x80b1('0xe')]){delete queues[_0x174e43[_0x80b1('0xe')]];}else{delete queues[_0x174e43[_0x80b1('0x4')]];}}exports[_0x80b1('0xf')]=function(_0x253f1e){try{utils[_0x80b1('0x10')](util['format'](_0x80b1('0x11'),_0x253f1e[_0x80b1('0x4')]),_0x253f1e);utils['info'](util[_0x80b1('0x2')](_0x80b1('0x12'),_0x253f1e['uniqueid'],_0x253f1e[_0x80b1('0x6')],_0x253f1e[_0x80b1('0x13')]));queues[_0x253f1e[_0x80b1('0x4')]]=_['assign'](_0x253f1e,{'originalposition':_0x253f1e[_0x80b1('0x13')],'queuecallerjoinAt':utils[_0x80b1('0x14')](),'mohtime':0x0});}catch(_0x45b3eb){utils['error'](util[_0x80b1('0x2')](_0x80b1('0x11'),_0x253f1e['uniqueid']),_0x45b3eb);}};exports[_0x80b1('0x15')]=function(_0x17f78a){try{if(!_[_0x80b1('0x16')](queues[_0x17f78a[_0x80b1('0x4')]])){utils[_0x80b1('0x10')](util[_0x80b1('0x2')](_0x80b1('0x17'),_0x17f78a[_0x80b1('0x4')]),_0x17f78a);if(queues[_0x17f78a['uniqueid']][_0x80b1('0x18')]){if(!queues[_0x17f78a[_0x80b1('0x4')]][_0x80b1('0x19')]&&!queues[_0x17f78a[_0x80b1('0x4')]][_0x80b1('0x1a')]){queues[_0x17f78a[_0x80b1('0x4')]]['queuecallercomplete']=!![];queues[_0x17f78a[_0x80b1('0x4')]][_0x80b1('0x1b')]=utils['now']();queues[_0x17f78a['uniqueid']][_0x80b1('0x1c')]='COMPLETEDBYAGENT';}utils[_0x80b1('0x1d')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x17f78a[_0x80b1('0x4')],queues[_0x17f78a[_0x80b1('0x4')]]['name'],queues[_0x17f78a[_0x80b1('0x4')]][_0x80b1('0x1c')]));writeDB(queues[_0x17f78a[_0x80b1('0x4')]]);}else if(queues[_0x17f78a[_0x80b1('0x4')]][_0x80b1('0xe')]){utils[_0x80b1('0x1d')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x17f78a[_0x80b1('0x4')],queues[_0x17f78a['uniqueid']]['name'],queues[_0x17f78a[_0x80b1('0x4')]][_0x80b1('0xe')]));queues[queues[_0x17f78a[_0x80b1('0x4')]][_0x80b1('0xe')]]=queues[_0x17f78a[_0x80b1('0x4')]];queues[queues[_0x17f78a[_0x80b1('0x4')]][_0x80b1('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x17f78a[_0x80b1('0x4')]];}}}catch(_0x4558f8){utils['error'](util['format'](_0x80b1('0x17'),_0x17f78a['uniqueid']),_0x4558f8);}};exports[_0x80b1('0x1e')]=function(_0x86483a){try{utils[_0x80b1('0x10')](util[_0x80b1('0x2')](_0x80b1('0x1f'),_0x86483a[_0x80b1('0x4')]),_0x86483a);if(!_['isNil'](_0x86483a[_0x80b1('0x20')]['queuestatus'])&&_0x86483a[_0x80b1('0x21')][_0x80b1('0x22')]()!=='CONTINUE'){if(!_[_0x80b1('0x16')](queues[_0x86483a[_0x80b1('0x4')]])){queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x19')]=![];queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x23')]=null;queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x1a')]=!![];queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x24')]=utils[_0x80b1('0x14')]();queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x1c')]=_0x86483a[_0x80b1('0x21')]['toUpperCase']();utils[_0x80b1('0x1d')](util[_0x80b1('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x86483a[_0x80b1('0x4')],queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x25')],_0x86483a['value'],queues[_0x86483a['uniqueid']][_0x80b1('0x1c')]));writeDB(queues[_0x86483a[_0x80b1('0x4')]]);}}else if(!_[_0x80b1('0x16')](_0x86483a[_0x80b1('0x20')][_0x80b1('0x26')])){if(!_['isNil'](queues[_0x86483a[_0x80b1('0x4')]])&&!queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x19')]){queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x19')]=![];queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x23')]=null;queues[_0x86483a['uniqueid']]['queuecallerexit']=!![];queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x24')]=utils[_0x80b1('0x14')]();queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x1c')]=_0x80b1('0x27');utils[_0x80b1('0x1d')](util[_0x80b1('0x2')](_0x80b1('0x28'),_0x86483a[_0x80b1('0x4')],queues[_0x86483a['uniqueid']][_0x80b1('0x25')],_0x86483a['value'],queues[_0x86483a[_0x80b1('0x4')]][_0x80b1('0x1c')]));}}}catch(_0x2244a7){utils[_0x80b1('0x29')](util[_0x80b1('0x2')](_0x80b1('0x1f'),_0x86483a['uniqueid']),_0x2244a7);}};exports['queuecallerabandon']=function(_0x1d4cb8){try{if(!_['isNil'](queues[_0x1d4cb8[_0x80b1('0x4')]])){utils[_0x80b1('0x10')](util[_0x80b1('0x2')](_0x80b1('0x2a'),_0x1d4cb8[_0x80b1('0x4')]),_0x1d4cb8);queues[_0x1d4cb8[_0x80b1('0x4')]]['queuecallerexit']=![];queues[_0x1d4cb8[_0x80b1('0x4')]][_0x80b1('0x24')]=null;queues[_0x1d4cb8[_0x80b1('0x4')]][_0x80b1('0x19')]=!![];queues[_0x1d4cb8[_0x80b1('0x4')]]['queuecallerabandonAt']=utils[_0x80b1('0x14')]();queues[_0x1d4cb8['uniqueid']][_0x80b1('0x1c')]='ABANDONED';utils[_0x80b1('0x1d')](util[_0x80b1('0x2')](_0x80b1('0x2b'),_0x1d4cb8[_0x80b1('0x4')],queues[_0x1d4cb8[_0x80b1('0x4')]][_0x80b1('0x25')],queues[_0x1d4cb8['uniqueid']][_0x80b1('0x1c')]));}}catch(_0x2f04c8){utils[_0x80b1('0x29')](util['format'](_0x80b1('0x2a'),_0x1d4cb8[_0x80b1('0x4')]),_0x2f04c8);}};exports['queuecallerleave']=function(_0x2e658d){try{if(!_[_0x80b1('0x16')](queues[_0x2e658d['uniqueid']])){utils['debug'](util[_0x80b1('0x2')](_0x80b1('0x2c'),_0x2e658d[_0x80b1('0x4')]),_0x2e658d);utils[_0x80b1('0x1d')](util['format'](_0x80b1('0x2d'),_0x2e658d[_0x80b1('0x4')],queues[_0x2e658d[_0x80b1('0x4')]][_0x80b1('0x25')],_0x2e658d['connectedlinenum'],_0x2e658d[_0x80b1('0x2e')]));queues[_0x2e658d[_0x80b1('0x4')]]['queuecallerleave']=!![];queues[_0x2e658d[_0x80b1('0x4')]][_0x80b1('0x18')]=utils[_0x80b1('0x14')]();queues[_0x2e658d['uniqueid']]['holdtime']=utils[_0x80b1('0x2f')](queues[_0x2e658d[_0x80b1('0x4')]][_0x80b1('0x18')],queues[_0x2e658d[_0x80b1('0x4')]][_0x80b1('0x30')]);queues[_0x2e658d['uniqueid']][_0x80b1('0x13')]=_0x2e658d[_0x80b1('0x13')];queues[_0x2e658d['uniqueid']][_0x80b1('0x31')]=_0x2e658d[_0x80b1('0x31')];queues[_0x2e658d['uniqueid']]['connectedlinenum']=_0x2e658d[_0x80b1('0x32')];queues[_0x2e658d[_0x80b1('0x4')]][_0x80b1('0x2e')]=_0x2e658d[_0x80b1('0x2e')];}}catch(_0x15664f){utils['error'](util[_0x80b1('0x2')](_0x80b1('0x2c'),_0x2e658d[_0x80b1('0x4')]),_0x15664f);}};exports[_0x80b1('0x33')]=function(_0x48aa46){try{if(!_[_0x80b1('0x16')](queues[_0x48aa46['uniqueid']])){utils[_0x80b1('0x10')](util[_0x80b1('0x2')]('[%s][queues][agentconnect]',_0x48aa46[_0x80b1('0x4')]),_0x48aa46);utils[_0x80b1('0x1d')](util['format'](_0x80b1('0x34'),_0x48aa46['uniqueid'],queues[_0x48aa46[_0x80b1('0x4')]][_0x80b1('0x25')],_0x48aa46['membername'],_0x48aa46[_0x80b1('0x35')]));queues[_0x48aa46[_0x80b1('0x4')]][_0x80b1('0x19')]=![];queues[_0x48aa46[_0x80b1('0x4')]]['queuecallerabandon']=![];queues[_0x48aa46[_0x80b1('0x4')]][_0x80b1('0x23')]=null;queues[_0x48aa46[_0x80b1('0x4')]][_0x80b1('0x1a')]=![];queues[_0x48aa46[_0x80b1('0x4')]]['queuecallerexitreason']=null;queues[_0x48aa46[_0x80b1('0x4')]]['queuecallerexitAt']=null;queues[_0x48aa46['uniqueid']][_0x80b1('0x36')]=!![];queues[_0x48aa46[_0x80b1('0x4')]][_0x80b1('0x8')]=_0x48aa46['destaccountcode'];queues[_0x48aa46[_0x80b1('0x4')]]['lastAssignedTo']=_0x48aa46[_0x80b1('0x37')];}}catch(_0x3ef4fa){utils[_0x80b1('0x29')](util[_0x80b1('0x2')]('[%s][queues][agentconnect]',_0x48aa46[_0x80b1('0x4')]),_0x3ef4fa);}};exports[_0x80b1('0x38')]=function(_0x50af63){try{if(!_['isNil'](queues[_0x50af63[_0x80b1('0x4')]])){if(queues[_0x50af63[_0x80b1('0x4')]][_0x80b1('0x18')]){utils[_0x80b1('0x10')](util['format']('[%s][queues][agentcomplete]',_0x50af63[_0x80b1('0x4')]),_0x50af63);queues[_0x50af63[_0x80b1('0x4')]]['queuecallerabandon']=![];queues[_0x50af63[_0x80b1('0x4')]][_0x80b1('0x19')]=![];queues[_0x50af63['uniqueid']][_0x80b1('0x23')]=null;queues[_0x50af63[_0x80b1('0x4')]][_0x80b1('0x1a')]=![];queues[_0x50af63['uniqueid']][_0x80b1('0x24')]=null;queues[_0x50af63[_0x80b1('0x4')]][_0x80b1('0x36')]=!![];queues[_0x50af63[_0x80b1('0x4')]]['lastAssignedTo']=_0x50af63[_0x80b1('0x37')];queues[_0x50af63[_0x80b1('0x4')]][_0x80b1('0x39')]=!![];queues[_0x50af63[_0x80b1('0x4')]][_0x80b1('0x1b')]=utils['now']();if(_0x50af63[_0x80b1('0x3a')]=='transfer'){if(!queues[_0x50af63['uniqueid']]['transfer']){queues[_0x50af63[_0x80b1('0x4')]][_0x80b1('0x1c')]=_0x80b1('0x3b');}}else{queues[_0x50af63['uniqueid']][_0x80b1('0x1c')]=_0x80b1('0x3c')+_0x50af63['reason']['toUpperCase']();}utils['info'](util[_0x80b1('0x2')](_0x80b1('0x3d'),_0x50af63[_0x80b1('0x4')],queues[_0x50af63['uniqueid']][_0x80b1('0x25')],_0x50af63['membername'],queues[_0x50af63[_0x80b1('0x4')]][_0x80b1('0x1c')]));writeDB(queues[_0x50af63[_0x80b1('0x4')]]);}}}catch(_0x4d564c){utils['error'](util[_0x80b1('0x2')](_0x80b1('0x3e'),_0x50af63[_0x80b1('0x4')]),_0x4d564c);}};exports['blindtransfer']=function(_0x243e25){try{if(!_['isNil'](queues[_0x243e25['transfereeuniqueid']])){utils[_0x80b1('0x10')](util['format'](_0x80b1('0x3f'),_0x243e25[_0x80b1('0x4')]),_0x243e25);queues[_0x243e25[_0x80b1('0x40')]][_0x80b1('0x41')]=!![];queues[_0x243e25[_0x80b1('0x40')]]['transfertype']='BLIND';queues[_0x243e25[_0x80b1('0x40')]][_0x80b1('0x42')]=_0x243e25[_0x80b1('0x43')];queues[_0x243e25[_0x80b1('0x40')]]['transferuniqueid']=_0x243e25[_0x80b1('0x40')];queues[_0x243e25[_0x80b1('0x40')]][_0x80b1('0x1c')]=_0x80b1('0x44');utils[_0x80b1('0x1d')](util['format'](_0x80b1('0x45'),_0x243e25[_0x80b1('0x4')],queues[_0x243e25[_0x80b1('0x40')]][_0x80b1('0x25')],_0x243e25[_0x80b1('0x40')],_0x243e25[_0x80b1('0x43')]));}}catch(_0x14dc5b){utils[_0x80b1('0x29')](util[_0x80b1('0x2')](_0x80b1('0x3f'),_0x243e25['uniqueid']),_0x14dc5b);}};exports[_0x80b1('0x46')]=function(_0x2620ed){try{utils[_0x80b1('0x10')](util[_0x80b1('0x2')](_0x80b1('0x47'),_0x2620ed[_0x80b1('0x48')]),_0x2620ed);if(_0x2620ed[_0x80b1('0x48')]==_0x2620ed[_0x80b1('0x49')]){if(!_[_0x80b1('0x16')](queues[_0x2620ed['secondtransfererlinkedid']])){utils[_0x80b1('0x1d')](util[_0x80b1('0x2')](_0x80b1('0x4a'),_0x2620ed['origtransfereruniqueid'],queues[_0x2620ed[_0x80b1('0x4b')]][_0x80b1('0x25')],_0x2620ed[_0x80b1('0x4c')]));queues[_0x2620ed[_0x80b1('0x4b')]][_0x80b1('0x41')]=!![];queues[_0x2620ed[_0x80b1('0x4b')]]['transfertype']=_0x80b1('0x4d');queues[_0x2620ed['secondtransfererlinkedid']][_0x80b1('0x42')]=_0x2620ed[_0x80b1('0x4c')];queues[_0x2620ed[_0x80b1('0x4b')]][_0x80b1('0x4e')]=_0x2620ed['origtransfereruniqueid'];queues[_0x2620ed[_0x80b1('0x4b')]][_0x80b1('0x1c')]='ATTENDEDTRANSFER';}if(!_[_0x80b1('0x16')](queues[_0x2620ed['origtransfererlinkedid']])){if(_0x2620ed['transfereelinkedid']&&queues[_0x2620ed[_0x80b1('0x4f')]]){queues[_0x2620ed[_0x80b1('0x4f')]]['queuecallerenterreason']=0x1;queues[_0x2620ed[_0x80b1('0x40')]]=_[_0x80b1('0x50')](queues[_0x2620ed[_0x80b1('0x4f')]]);queues[_0x2620ed[_0x80b1('0x40')]]['transfereduniqueid']=_0x2620ed['transfertargetuniqueid'];queues[_0x2620ed[_0x80b1('0x40')]]['queuecallerenterreason']=0x2;queues[_0x2620ed[_0x80b1('0x40')]][_0x80b1('0x7')]=queues[_0x2620ed[_0x80b1('0x4b')]][_0x80b1('0x7')];queues[_0x2620ed['transfereeuniqueid']][_0x80b1('0x51')]=queues[_0x2620ed[_0x80b1('0x4b')]][_0x80b1('0x51')];queues[_0x2620ed['transfereeuniqueid']][_0x80b1('0x30')]=utils[_0x80b1('0x14')]();queues[_0x2620ed[_0x80b1('0x40')]]['queuecallerleaveAt']=utils[_0x80b1('0x14')]();queues[_0x2620ed['transfereeuniqueid']][_0x80b1('0x52')]=0x0;queues[_0x2620ed[_0x80b1('0x40')]][_0x80b1('0x53')]=0x0;utils['info'](util['format'](_0x80b1('0x54'),_0x2620ed[_0x80b1('0x48')],queues[_0x2620ed['transfereeuniqueid']][_0x80b1('0x25')],queues[_0x2620ed[_0x80b1('0x40')]][_0x80b1('0x7')],queues[_0x2620ed[_0x80b1('0x40')]][_0x80b1('0x51')]));}else{utils[_0x80b1('0x1d')](util[_0x80b1('0x2')](_0x80b1('0x55'),_0x2620ed[_0x80b1('0x48')],queues[_0x2620ed[_0x80b1('0x49')]]['name'],_0x2620ed['secondtransfererlinkedid']));queues[_0x2620ed[_0x80b1('0x49')]]['transfereduniqueid']=_0x2620ed[_0x80b1('0x4b')];}}}else if(_0x2620ed[_0x80b1('0x56')]==_0x2620ed['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x2620ed[_0x80b1('0x49')]])){utils[_0x80b1('0x1d')](util[_0x80b1('0x2')](_0x80b1('0x57'),_0x2620ed[_0x80b1('0x48')],queues[_0x2620ed['origtransfererlinkedid']]['name'],_0x2620ed[_0x80b1('0x56')],_0x2620ed[_0x80b1('0x58')]));queues[_0x2620ed[_0x80b1('0x49')]][_0x80b1('0x41')]=!![];queues[_0x2620ed['origtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x2620ed[_0x80b1('0x49')]]['transferexten']=_0x2620ed[_0x80b1('0x58')];queues[_0x2620ed['origtransfererlinkedid']]['transferuniqueid']=_0x2620ed[_0x80b1('0x56')];queues[_0x2620ed[_0x80b1('0x49')]][_0x80b1('0x1c')]=_0x80b1('0x59');}if(!_['isNil'](queues[_0x2620ed[_0x80b1('0x4b')]])){if(_0x2620ed[_0x80b1('0x5a')]&&queues[_0x2620ed[_0x80b1('0x5a')]]){queues[_0x2620ed['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x2620ed[_0x80b1('0x5b')]]=_[_0x80b1('0x50')](queues[_0x2620ed[_0x80b1('0x5a')]]);queues[_0x2620ed[_0x80b1('0x5b')]][_0x80b1('0xe')]=_0x2620ed[_0x80b1('0x5b')];queues[_0x2620ed['transfertargetuniqueid']][_0x80b1('0x5c')]=0x2;queues[_0x2620ed[_0x80b1('0x5b')]][_0x80b1('0x7')]=queues[_0x2620ed['origtransfererlinkedid']]['calleridnum'];queues[_0x2620ed[_0x80b1('0x5b')]][_0x80b1('0x51')]=queues[_0x2620ed[_0x80b1('0x49')]][_0x80b1('0x51')];queues[_0x2620ed[_0x80b1('0x5b')]][_0x80b1('0x30')]=utils['now']();queues[_0x2620ed[_0x80b1('0x5b')]][_0x80b1('0x18')]=utils[_0x80b1('0x14')]();queues[_0x2620ed['transfertargetuniqueid']][_0x80b1('0x52')]=0x0;queues[_0x2620ed['transfertargetuniqueid']][_0x80b1('0x53')]=0x0;utils[_0x80b1('0x1d')](util[_0x80b1('0x2')](_0x80b1('0x5d'),_0x2620ed['origtransfereruniqueid'],queues[_0x2620ed[_0x80b1('0x5b')]]['name'],queues[_0x2620ed[_0x80b1('0x5b')]][_0x80b1('0xe')],queues[_0x2620ed[_0x80b1('0x5b')]][_0x80b1('0x7')],queues[_0x2620ed[_0x80b1('0x5b')]]['calleridname']));}else{utils[_0x80b1('0x1d')](util[_0x80b1('0x2')](_0x80b1('0x55'),_0x2620ed['origtransfereruniqueid'],queues[_0x2620ed['secondtransfererlinkedid']][_0x80b1('0x25')],_0x2620ed[_0x80b1('0x49')]));queues[_0x2620ed[_0x80b1('0x4b')]]['transfereduniqueid']=_0x2620ed[_0x80b1('0x49')];}}}}catch(_0x45faf5){utils[_0x80b1('0x29')](util[_0x80b1('0x2')](_0x80b1('0x47'),_0x2620ed[_0x80b1('0x48')]),_0x45faf5);}};exports[_0x80b1('0x5e')]=function(_0x42c015){try{if(!_[_0x80b1('0x16')](queues[_0x42c015['uniqueid']])){utils['debug'](util['format'](_0x80b1('0x5f'),_0x42c015[_0x80b1('0x4')]),_0x42c015);queues[_0x42c015[_0x80b1('0x4')]][_0x80b1('0x60')]=utils['now']();utils[_0x80b1('0x1d')](util['format'](_0x80b1('0x61'),_0x42c015[_0x80b1('0x4')],queues[_0x42c015['uniqueid']][_0x80b1('0x25')],queues[_0x42c015[_0x80b1('0x4')]][_0x80b1('0x60')]));}}catch(_0x92b5ee){utils['error'](util[_0x80b1('0x2')](_0x80b1('0x5f'),_0x42c015[_0x80b1('0x4')]),_0x92b5ee);}};exports['musiconholdstop']=function(_0x2a6933){try{if(!_[_0x80b1('0x16')](queues[_0x2a6933['uniqueid']])){if(!_[_0x80b1('0x16')](queues[_0x2a6933[_0x80b1('0x4')]]['musiconholdstartAt'])){utils[_0x80b1('0x10')](util[_0x80b1('0x2')](_0x80b1('0x62'),_0x2a6933[_0x80b1('0x4')]),_0x2a6933);queues[_0x2a6933[_0x80b1('0x4')]][_0x80b1('0x53')]+=utils[_0x80b1('0x2f')](utils[_0x80b1('0x14')](),queues[_0x2a6933[_0x80b1('0x4')]]['musiconholdstartAt']);utils['info'](util['format'](_0x80b1('0x63'),_0x2a6933[_0x80b1('0x4')],queues[_0x2a6933[_0x80b1('0x4')]][_0x80b1('0x25')],queues[_0x2a6933[_0x80b1('0x4')]][_0x80b1('0x53')]));delete queues[_0x2a6933[_0x80b1('0x4')]][_0x80b1('0x60')];}}}catch(_0x4c21c2){utils[_0x80b1('0x29')](util['format'](_0x80b1('0x62'),_0x2a6933[_0x80b1('0x4')]),_0x4c21c2);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 0d6ab1c..2662ba3 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 _0x8d9d=['[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','membername','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8d9d,0x18e));var _0xd8d9=function(_0x457bde,_0xd26a0b){_0x457bde=_0x457bde-0x0;var _0x1a7690=_0x8d9d[_0x457bde];return _0x1a7690;};'use strict';var _=require(_0xd8d9('0x0'));var util=require(_0xd8d9('0x1'));var utils=require(_0xd8d9('0x2'));var recordings={};function writeDB(_0x487af8){utils[_0xd8d9('0x3')](util[_0xd8d9('0x4')]('[%s][recordings][writeDB]',_0x487af8[_0xd8d9('0x5')]));if(_0x487af8[_0xd8d9('0x6')]){utils[_0xd8d9('0x7')](_0x487af8[_0xd8d9('0x6')])['then'](function(_0x4d6fc4){if(_0x4d6fc4){_0x487af8[_0xd8d9('0x8')]=_0x4d6fc4['name'];_0x487af8['UserId']=_0x4d6fc4['id'];}utils[_0xd8d9('0x9')](_0xd8d9('0xa'),_0x487af8);});}else{utils[_0xd8d9('0x9')]('CreateVoiceRecording',_0x487af8);}}exports[_0xd8d9('0xb')]=function(_0x386a8b){try{utils[_0xd8d9('0xc')](util[_0xd8d9('0x4')](_0xd8d9('0xd'),_0x386a8b[_0xd8d9('0x5')]),_0x386a8b);if(_0x386a8b[_0xd8d9('0x5')]==_0x386a8b['linkedid']){utils['info'](util[_0xd8d9('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x386a8b[_0xd8d9('0x5')],_0x386a8b['context'],_0x386a8b['exten']));recordings[_0x386a8b['uniqueid']]={'uniqueid':_0x386a8b[_0xd8d9('0x5')],'accountcode':_0x386a8b[_0xd8d9('0x6')],'exten':_0x386a8b[_0xd8d9('0xe')],'context':_0x386a8b['context'],'channel':_0x386a8b[_0xd8d9('0xf')],'monitors':[]};}}catch(_0x24383a){utils[_0xd8d9('0x10')](util['format'](_0xd8d9('0xd'),_0x386a8b[_0xd8d9('0x5')]),_0x24383a);}};exports[_0xd8d9('0x11')]=function(_0x27f84b){try{utils['debug'](util['format'](_0xd8d9('0x12'),_0x27f84b[_0xd8d9('0x5')]),_0x27f84b);if(!_[_0xd8d9('0x13')](recordings[_0x27f84b[_0xd8d9('0x5')]])&&_0x27f84b['channelstate']==0x6){utils[_0xd8d9('0x3')](util[_0xd8d9('0x4')](_0xd8d9('0x14'),_0x27f84b[_0xd8d9('0x5')],_0x27f84b[_0xd8d9('0x15')],_0x27f84b[_0xd8d9('0xf')]));}else if(!_['isNil'](recordings[_0x27f84b[_0xd8d9('0x16')]])&&_0x27f84b[_0xd8d9('0x17')]==0x6&&_0x27f84b[_0xd8d9('0x15')]!=_0xd8d9('0x18')){utils[_0xd8d9('0x3')](util[_0xd8d9('0x4')](_0xd8d9('0x19'),_0x27f84b[_0xd8d9('0x5')],_0x27f84b['linkedid'],_0x27f84b[_0xd8d9('0x15')],_0x27f84b[_0xd8d9('0xf')]));recordings[_0x27f84b[_0xd8d9('0x16')]]['accountcode']=_0x27f84b[_0xd8d9('0x6')];}}catch(_0x3e6e7a){utils['error'](util[_0xd8d9('0x4')](_0xd8d9('0x12'),_0x27f84b['uniqueid']),_0x3e6e7a);}};exports['varset']=function(_0x19b994){try{if(!_[_0xd8d9('0x13')](_0x19b994[_0xd8d9('0x1a')])&&!_[_0xd8d9('0x13')](_0x19b994[_0xd8d9('0x1a')][_0xd8d9('0x1b')])){utils[_0xd8d9('0xc')](util['format'](_0xd8d9('0x1c'),_0x19b994[_0xd8d9('0x5')]),_0x19b994);utils['info'](util[_0xd8d9('0x4')](_0xd8d9('0x1d'),_0x19b994[_0xd8d9('0x5')],_0x19b994[_0xd8d9('0x1a')],_0x19b994[_0xd8d9('0x1e')]));if(_[_0xd8d9('0x1f')](_0x19b994[_0xd8d9('0x1e')],_0xd8d9('0x20'))){_0x19b994[_0xd8d9('0x1e')]=_0x19b994['value'][_0xd8d9('0x21')]('.wav49','.WAV');}if(recordings[_0x19b994[_0xd8d9('0x16')]]){var _0x181c5d=_['find'](recordings[_0x19b994[_0xd8d9('0x16')]][_0xd8d9('0x22')],{'value':_0x19b994[_0xd8d9('0x1e')]});if(_[_0xd8d9('0x13')](_0x181c5d)){recordings[_0x19b994[_0xd8d9('0x16')]][_0xd8d9('0x22')][_0xd8d9('0x23')]({'value':_0x19b994['value']});}}}}catch(_0x47ef59){utils['error'](util[_0xd8d9('0x4')](_0xd8d9('0x1c'),_0x19b994['uniqueid']),_0x47ef59);}};exports[_0xd8d9('0x24')]=function(_0x1438db){try{if(!_[_0xd8d9('0x13')](recordings[_0x1438db['uniqueid']])){utils['debug'](util['format']('[%s][recordings][hangup]',_0x1438db[_0xd8d9('0x5')]),_0x1438db);utils[_0xd8d9('0x3')](util['format'](_0xd8d9('0x25'),_0x1438db[_0xd8d9('0x5')],_0x1438db[_0xd8d9('0x26')],_0x1438db[_0xd8d9('0x27')],_0x1438db['cause-txt']));recordings[_0x1438db['uniqueid']]['calleridnum']=_0x1438db[_0xd8d9('0x26')];recordings[_0x1438db[_0xd8d9('0x5')]][_0xd8d9('0x27')]=_0x1438db[_0xd8d9('0x27')];recordings[_0x1438db[_0xd8d9('0x5')]]['connectedlinenum']=_0x1438db[_0xd8d9('0x28')];recordings[_0x1438db['uniqueid']][_0xd8d9('0x29')]=_0x1438db['connectedlinename'];if(recordings[_0x1438db[_0xd8d9('0x5')]][_0xd8d9('0x2a')]==_0xd8d9('0x2b')&&recordings[_0x1438db[_0xd8d9('0x5')]][_0xd8d9('0x6')]){recordings[_0x1438db[_0xd8d9('0x5')]][_0xd8d9('0x28')]=recordings[_0x1438db[_0xd8d9('0x5')]][_0xd8d9('0x6')];recordings[_0x1438db[_0xd8d9('0x5')]]['connectedlinename']='';}recordings[_0x1438db[_0xd8d9('0x5')]][_0xd8d9('0x22')][_0xd8d9('0x2c')](function(_0x704137){var _0xcdf341=_[_0xd8d9('0x2d')](recordings[_0x1438db['uniqueid']]);_0xcdf341[_0xd8d9('0x1e')]=_0x704137[_0xd8d9('0x1e')];writeDB(_0xcdf341);});delete recordings[_0x1438db[_0xd8d9('0x5')]];}}catch(_0x240a87){utils[_0xd8d9('0x10')](util[_0xd8d9('0x4')](_0xd8d9('0x2e'),_0x1438db[_0xd8d9('0x5')]),_0x240a87);}};exports['newexten']=function(_0xc512c1){try{if(!_[_0xd8d9('0x13')](recordings[_0xc512c1[_0xd8d9('0x5')]])){utils[_0xd8d9('0xc')](util['format'](_0xd8d9('0x2f'),_0xc512c1[_0xd8d9('0x5')]),_0xc512c1);utils[_0xd8d9('0x3')](util['format'](_0xd8d9('0x30'),_0xc512c1[_0xd8d9('0x5')],_0xc512c1[_0xd8d9('0x31')],_0xc512c1['appdata']));if(_0xc512c1['application'][_0xd8d9('0x32')]()==_0xd8d9('0x33')&&_[_0xd8d9('0x34')](_0xc512c1['appdata']['toLowerCase'](),_0xd8d9('0x35'))){var _0x1dc51d=_0xc512c1[_0xd8d9('0x36')][_0xd8d9('0x37')]('=');var _0x909a15=_0x1dc51d[0x0]['substring'](_0x1dc51d[0x0][_0xd8d9('0x38')]('(')+0x1,_0x1dc51d[0x0][_0xd8d9('0x38')](')'));var _0x53769e=_0x1dc51d[0x1];recordings[_0xc512c1[_0xd8d9('0x5')]][_0x909a15]=_0x53769e;}}}catch(_0x2eda2c){utils[_0xd8d9('0x10')](util[_0xd8d9('0x4')](_0xd8d9('0x2f'),_0xc512c1[_0xd8d9('0x5')]),_0x2eda2c);}};exports[_0xd8d9('0x39')]=function(_0x53d6c5){try{if(!_['isNil'](recordings[_0x53d6c5[_0xd8d9('0x5')]])){utils[_0xd8d9('0xc')](util[_0xd8d9('0x4')](_0xd8d9('0x3a'),_0x53d6c5['uniqueid']),_0x53d6c5);utils[_0xd8d9('0x3')](util[_0xd8d9('0x4')](_0xd8d9('0x3b'),_0x53d6c5['uniqueid'],_0x53d6c5[_0xd8d9('0x3c')]));recordings[_0x53d6c5['uniqueid']][_0xd8d9('0x3c')]=_0x53d6c5[_0xd8d9('0x3c')];}}catch(_0x1546fd){utils[_0xd8d9('0x10')](util[_0xd8d9('0x4')](_0xd8d9('0x3a'),_0x53d6c5['uniqueid']),_0x1546fd);}}; \ No newline at end of file +var _0x25e7=['outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','UserId','request','CreateVoiceRecording','newchannel','debug','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','[%s][recordings][newchannel]','newstate','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','error','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0x25e7,0x1bc));var _0x725e=function(_0x434f2e,_0x68493e){_0x434f2e=_0x434f2e-0x0;var _0x76c0b9=_0x25e7[_0x434f2e];return _0x76c0b9;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x725e('0x0'));var recordings={};function writeDB(_0x4fee66){utils[_0x725e('0x1')](util[_0x725e('0x2')](_0x725e('0x3'),_0x4fee66['uniqueid']));if(_0x4fee66[_0x725e('0x4')]){utils[_0x725e('0x5')](_0x4fee66[_0x725e('0x4')])[_0x725e('0x6')](function(_0x3e5116){if(_0x3e5116){_0x4fee66['membername']=_0x3e5116['name'];_0x4fee66[_0x725e('0x7')]=_0x3e5116['id'];}utils[_0x725e('0x8')]('CreateVoiceRecording',_0x4fee66);});}else{utils[_0x725e('0x8')](_0x725e('0x9'),_0x4fee66);}}exports[_0x725e('0xa')]=function(_0x419ad6){try{utils[_0x725e('0xb')](util[_0x725e('0x2')]('[%s][recordings][newchannel]',_0x419ad6[_0x725e('0xc')]),_0x419ad6);if(_0x419ad6[_0x725e('0xc')]==_0x419ad6[_0x725e('0xd')]){utils[_0x725e('0x1')](util[_0x725e('0x2')](_0x725e('0xe'),_0x419ad6[_0x725e('0xc')],_0x419ad6['context'],_0x419ad6[_0x725e('0xf')]));recordings[_0x419ad6[_0x725e('0xc')]]={'uniqueid':_0x419ad6[_0x725e('0xc')],'accountcode':_0x419ad6[_0x725e('0x4')],'exten':_0x419ad6[_0x725e('0xf')],'context':_0x419ad6[_0x725e('0x10')],'channel':_0x419ad6[_0x725e('0x11')],'monitors':[]};}}catch(_0x5ccbe7){utils['error'](util[_0x725e('0x2')](_0x725e('0x12'),_0x419ad6[_0x725e('0xc')]),_0x5ccbe7);}};exports[_0x725e('0x13')]=function(_0x3b4d4b){try{utils[_0x725e('0xb')](util['format']('[%s][recordings][newstate]',_0x3b4d4b[_0x725e('0xc')]),_0x3b4d4b);if(!_['isNil'](recordings[_0x3b4d4b[_0x725e('0xc')]])&&_0x3b4d4b[_0x725e('0x14')]==0x6){utils[_0x725e('0x1')](util['format'](_0x725e('0x15'),_0x3b4d4b[_0x725e('0xc')],_0x3b4d4b[_0x725e('0x10')],_0x3b4d4b[_0x725e('0x11')]));}else if(!_['isNil'](recordings[_0x3b4d4b[_0x725e('0xd')]])&&_0x3b4d4b['channelstate']==0x6&&_0x3b4d4b[_0x725e('0x10')]!=_0x725e('0x16')){utils[_0x725e('0x1')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3b4d4b[_0x725e('0xc')],_0x3b4d4b['linkedid'],_0x3b4d4b['context'],_0x3b4d4b['channel']));recordings[_0x3b4d4b[_0x725e('0xd')]][_0x725e('0x4')]=_0x3b4d4b[_0x725e('0x4')];}}catch(_0x32088a){utils[_0x725e('0x17')](util['format']('[%s][recordings][newstate]',_0x3b4d4b[_0x725e('0xc')]),_0x32088a);}};exports[_0x725e('0x18')]=function(_0x2b3d1d){try{if(!_[_0x725e('0x19')](_0x2b3d1d[_0x725e('0x1a')])&&!_[_0x725e('0x19')](_0x2b3d1d[_0x725e('0x1a')][_0x725e('0x1b')])){utils[_0x725e('0xb')](util['format'](_0x725e('0x1c'),_0x2b3d1d['uniqueid']),_0x2b3d1d);utils['info'](util['format'](_0x725e('0x1d'),_0x2b3d1d[_0x725e('0xc')],_0x2b3d1d[_0x725e('0x1a')],_0x2b3d1d[_0x725e('0x1e')]));if(_[_0x725e('0x1f')](_0x2b3d1d[_0x725e('0x1e')],'.wav49')){_0x2b3d1d[_0x725e('0x1e')]=_0x2b3d1d[_0x725e('0x1e')][_0x725e('0x20')]('.wav49','.WAV');}if(recordings[_0x2b3d1d['linkedid']]){var _0x4e8d9f=_[_0x725e('0x21')](recordings[_0x2b3d1d[_0x725e('0xd')]][_0x725e('0x22')],{'value':_0x2b3d1d[_0x725e('0x1e')]});if(_['isNil'](_0x4e8d9f)){recordings[_0x2b3d1d[_0x725e('0xd')]][_0x725e('0x22')][_0x725e('0x23')]({'value':_0x2b3d1d['value']});}}}}catch(_0x21cf4e){utils[_0x725e('0x17')](util['format'](_0x725e('0x1c'),_0x2b3d1d['uniqueid']),_0x21cf4e);}};exports[_0x725e('0x24')]=function(_0x34e652){try{if(!_[_0x725e('0x19')](recordings[_0x34e652[_0x725e('0xc')]])){utils[_0x725e('0xb')](util[_0x725e('0x2')](_0x725e('0x25'),_0x34e652['uniqueid']),_0x34e652);utils[_0x725e('0x1')](util[_0x725e('0x2')](_0x725e('0x26'),_0x34e652[_0x725e('0xc')],_0x34e652[_0x725e('0x27')],_0x34e652[_0x725e('0x28')],_0x34e652['cause-txt']));recordings[_0x34e652[_0x725e('0xc')]][_0x725e('0x27')]=_0x34e652['calleridnum'];recordings[_0x34e652[_0x725e('0xc')]][_0x725e('0x28')]=_0x34e652['calleridname'];recordings[_0x34e652[_0x725e('0xc')]][_0x725e('0x29')]=_0x34e652[_0x725e('0x29')];recordings[_0x34e652['uniqueid']][_0x725e('0x2a')]=_0x34e652[_0x725e('0x2a')];if(recordings[_0x34e652[_0x725e('0xc')]][_0x725e('0x2b')]==_0x725e('0x2c')&&recordings[_0x34e652[_0x725e('0xc')]][_0x725e('0x4')]){recordings[_0x34e652[_0x725e('0xc')]][_0x725e('0x29')]=recordings[_0x34e652['uniqueid']][_0x725e('0x4')];recordings[_0x34e652[_0x725e('0xc')]][_0x725e('0x2a')]='';}recordings[_0x34e652[_0x725e('0xc')]]['monitors'][_0x725e('0x2d')](function(_0x183153){var _0x490e60=_[_0x725e('0x2e')](recordings[_0x34e652[_0x725e('0xc')]]);_0x490e60[_0x725e('0x1e')]=_0x183153[_0x725e('0x1e')];writeDB(_0x490e60);});delete recordings[_0x34e652['uniqueid']];}}catch(_0x539f54){utils['error'](util['format'](_0x725e('0x25'),_0x34e652['uniqueid']),_0x539f54);}};exports[_0x725e('0x2f')]=function(_0x18b58d){try{if(!_[_0x725e('0x19')](recordings[_0x18b58d[_0x725e('0xc')]])){utils[_0x725e('0xb')](util['format'](_0x725e('0x30'),_0x18b58d[_0x725e('0xc')]),_0x18b58d);utils[_0x725e('0x1')](util[_0x725e('0x2')](_0x725e('0x31'),_0x18b58d[_0x725e('0xc')],_0x18b58d['application'],_0x18b58d[_0x725e('0x32')]));if(_0x18b58d[_0x725e('0x33')][_0x725e('0x34')]()==_0x725e('0x35')&&_[_0x725e('0x36')](_0x18b58d[_0x725e('0x32')]['toLowerCase'](),_0x725e('0x37'))){var _0x3b4a44=_0x18b58d[_0x725e('0x32')]['split']('=');var _0x5528b1=_0x3b4a44[0x0][_0x725e('0x38')](_0x3b4a44[0x0][_0x725e('0x39')]('(')+0x1,_0x3b4a44[0x0][_0x725e('0x39')](')'));var _0xbcd63b=_0x3b4a44[0x1];recordings[_0x18b58d[_0x725e('0xc')]][_0x5528b1]=_0xbcd63b;}}}catch(_0x3c651d){utils['error'](util[_0x725e('0x2')]('[%s][recordings][newexten]',_0x18b58d[_0x725e('0xc')]),_0x3c651d);}};exports['queuecallerjoin']=function(_0x346417){try{if(!_[_0x725e('0x19')](recordings[_0x346417[_0x725e('0xc')]])){utils[_0x725e('0xb')](util[_0x725e('0x2')](_0x725e('0x3a'),_0x346417[_0x725e('0xc')]),_0x346417);utils['info'](util[_0x725e('0x2')](_0x725e('0x3b'),_0x346417['uniqueid'],_0x346417[_0x725e('0x3c')]));recordings[_0x346417[_0x725e('0xc')]]['queue']=_0x346417[_0x725e('0x3c')];}}catch(_0x2abd51){utils[_0x725e('0x17')](util[_0x725e('0x2')](_0x725e('0x3a'),_0x346417[_0x725e('0xc')]),_0x2abd51);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b2f80ac..e72cd55 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 _0x1b5c=['lodash','util','./utils','info','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid'];(function(_0x3c7841,_0x432a20){var _0xfa39b6=function(_0x1fbd6c){while(--_0x1fbd6c){_0x3c7841['push'](_0x3c7841['shift']());}};_0xfa39b6(++_0x432a20);}(_0x1b5c,0x12d));var _0xc1b5=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0x1b5c[_0x34e752];return _0x7c6347;};'use strict';var _=require(_0xc1b5('0x0'));var util=require(_0xc1b5('0x1'));var utils=require(_0xc1b5('0x2'));function writeDB(_0x372f1c){utils[_0xc1b5('0x3')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x372f1c[_0xc1b5('0x4')]===_0xc1b5('0x5')?_0x372f1c[_0xc1b5('0x6')]:_0x372f1c[_0xc1b5('0x7')],_0x372f1c[_0xc1b5('0x4')]));utils[_0xc1b5('0x8')](_0xc1b5('0x9'),_0x372f1c);}exports[_0xc1b5('0xa')]=function(_0x20d110){try{utils[_0xc1b5('0xb')](util['format'](_0xc1b5('0xc'),_0x20d110[_0xc1b5('0x7')]),_0x20d110);utils[_0xc1b5('0x3')](util[_0xc1b5('0xd')](_0xc1b5('0xe'),_0x20d110[_0xc1b5('0x7')],_0x20d110['transferercalleridnum'],_0x20d110[_0xc1b5('0xf')],_0x20d110[_0xc1b5('0x10')],_0x20d110[_0xc1b5('0x11')]));_0x20d110['type']=_0xc1b5('0x12');writeDB(_0x20d110);}catch(_0x256aae){utils[_0xc1b5('0x13')](util[_0xc1b5('0xd')](_0xc1b5('0xc'),_0x20d110[_0xc1b5('0x7')]),_0x256aae);}};exports[_0xc1b5('0x14')]=function(_0x9e1a1a){try{utils[_0xc1b5('0xb')](util[_0xc1b5('0xd')](_0xc1b5('0x15'),_0x9e1a1a[_0xc1b5('0x6')]),_0x9e1a1a);utils[_0xc1b5('0x3')](util[_0xc1b5('0xd')](_0xc1b5('0x16'),_0x9e1a1a[_0xc1b5('0x6')],_0x9e1a1a[_0xc1b5('0x17')],_0x9e1a1a['origtransferercalleridname'],_0x9e1a1a[_0xc1b5('0x18')],_0x9e1a1a[_0xc1b5('0x19')]));_0x9e1a1a=_['assign'](_0x9e1a1a,{'transfererchannel':_0x9e1a1a[_0xc1b5('0x1a')],'transferercalleridnum':_0x9e1a1a[_0xc1b5('0x17')],'transferercalleridname':_0x9e1a1a[_0xc1b5('0x1b')],'transfererconnectedlinenum':_0x9e1a1a[_0xc1b5('0x1c')],'transfererconnectedlinename':_0x9e1a1a['secondtransfererconnectedlinename'],'transfereraccountcode':_0x9e1a1a[_0xc1b5('0x1d')],'transferercontext':_0x9e1a1a['secondtransferercontext'],'transfererexten':_0x9e1a1a[_0xc1b5('0x1e')],'transfererlinkedid':_0x9e1a1a[_0xc1b5('0x1f')],'context':_0x9e1a1a[_0xc1b5('0x20')],'extension':_0x9e1a1a[_0xc1b5('0x21')],'type':_0xc1b5('0x5')});if(_[_0xc1b5('0x22')](_0x9e1a1a[_0xc1b5('0x23')])){_0x9e1a1a=_[_0xc1b5('0x24')](_0x9e1a1a,{'transfereechannel':_0x9e1a1a[_0xc1b5('0x25')],'transfereecalleridnum':_0x9e1a1a[_0xc1b5('0x18')],'transfereecalleridname':_0x9e1a1a[_0xc1b5('0x19')],'transfereeconnectedlinenum':_0x9e1a1a[_0xc1b5('0x26')],'transfereeconnectedlinename':_0x9e1a1a[_0xc1b5('0x27')],'transfereeaccountcode':_0x9e1a1a[_0xc1b5('0x28')],'transfereecontext':_0x9e1a1a[_0xc1b5('0x29')],'transfereeexten':_0x9e1a1a['transfertargetexten'],'transfereelinkedid':_0x9e1a1a[_0xc1b5('0x2a')]});}writeDB(_0x9e1a1a);}catch(_0x46f5e5){utils[_0xc1b5('0x13')](util['format'](_0xc1b5('0x15'),_0x9e1a1a['origtransfereruniqueid']),_0x46f5e5);}}; \ No newline at end of file +var _0x065b=['lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererexten','isNil','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','error'];(function(_0x3dad7d,_0x5ea81f){var _0x4abfb1=function(_0x2ebdc0){while(--_0x2ebdc0){_0x3dad7d['push'](_0x3dad7d['shift']());}};_0x4abfb1(++_0x5ea81f);}(_0x065b,0x150));var _0xb065=function(_0xc18ce1,_0x329f9b){_0xc18ce1=_0xc18ce1-0x0;var _0x12ea8b=_0x065b[_0xc18ce1];return _0x12ea8b;};'use strict';var _=require(_0xb065('0x0'));var util=require('util');var utils=require(_0xb065('0x1'));function writeDB(_0x558450){utils[_0xb065('0x2')](util[_0xb065('0x3')](_0xb065('0x4'),_0x558450['type']===_0xb065('0x5')?_0x558450[_0xb065('0x6')]:_0x558450[_0xb065('0x7')],_0x558450[_0xb065('0x8')]));utils[_0xb065('0x9')](_0xb065('0xa'),_0x558450);}exports[_0xb065('0xb')]=function(_0x4f7070){try{utils[_0xb065('0xc')](util['format'](_0xb065('0xd'),_0x4f7070[_0xb065('0x7')]),_0x4f7070);utils[_0xb065('0x2')](util['format'](_0xb065('0xe'),_0x4f7070[_0xb065('0x7')],_0x4f7070['transferercalleridnum'],_0x4f7070[_0xb065('0xf')],_0x4f7070[_0xb065('0x10')],_0x4f7070[_0xb065('0x11')]));_0x4f7070[_0xb065('0x8')]=_0xb065('0x12');writeDB(_0x4f7070);}catch(_0x4206dd){utils['error'](util[_0xb065('0x3')]('[%s][transfers][blindtransfer]',_0x4f7070[_0xb065('0x7')]),_0x4206dd);}};exports[_0xb065('0x13')]=function(_0x599397){try{utils[_0xb065('0xc')](util[_0xb065('0x3')](_0xb065('0x14'),_0x599397[_0xb065('0x6')]),_0x599397);utils[_0xb065('0x2')](util[_0xb065('0x3')](_0xb065('0x15'),_0x599397[_0xb065('0x6')],_0x599397[_0xb065('0x16')],_0x599397[_0xb065('0x17')],_0x599397['transfertargetcalleridnum'],_0x599397[_0xb065('0x18')]));_0x599397=_[_0xb065('0x19')](_0x599397,{'transfererchannel':_0x599397[_0xb065('0x1a')],'transferercalleridnum':_0x599397['origtransferercalleridnum'],'transferercalleridname':_0x599397[_0xb065('0x17')],'transfererconnectedlinenum':_0x599397[_0xb065('0x1b')],'transfererconnectedlinename':_0x599397[_0xb065('0x1c')],'transfereraccountcode':_0x599397[_0xb065('0x1d')],'transferercontext':_0x599397[_0xb065('0x1e')],'transfererexten':_0x599397[_0xb065('0x1f')],'transfererlinkedid':_0x599397['origtransfererlinkedid'],'context':_0x599397['origtransferercontext'],'extension':_0x599397[_0xb065('0x20')],'type':_0xb065('0x5')});if(_[_0xb065('0x21')](_0x599397[_0xb065('0x22')])){_0x599397=_['assign'](_0x599397,{'transfereechannel':_0x599397['transfertargetchannel'],'transfereecalleridnum':_0x599397[_0xb065('0x23')],'transfereecalleridname':_0x599397[_0xb065('0x18')],'transfereeconnectedlinenum':_0x599397[_0xb065('0x24')],'transfereeconnectedlinename':_0x599397[_0xb065('0x25')],'transfereeaccountcode':_0x599397[_0xb065('0x26')],'transfereecontext':_0x599397[_0xb065('0x27')],'transfereeexten':_0x599397['transfertargetexten'],'transfereelinkedid':_0x599397[_0xb065('0x28')]});}writeDB(_0x599397);}catch(_0x4a1918){utils[_0xb065('0x29')](util[_0xb065('0x3')](_0xb065('0x14'),_0x599397[_0xb065('0x6')]),_0x4a1918);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b349a1d..a4a8402 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 _0xe84a=['[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','format','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe84a,0x113));var _0xae84=function(_0xb808cd,_0x279de7){_0xb808cd=_0xb808cd-0x0;var _0x5117a1=_0xe84a[_0xb808cd];return _0x5117a1;};'use strict';var BPromise=require(_0xae84('0x0'));var jayson=require(_0xae84('0x1'));var moment=require(_0xae84('0x2'));var util=require(_0xae84('0x3'));var client=jayson[_0xae84('0x4')][_0xae84('0x5')]({'port':0x2329});var logger=require(_0xae84('0x6'))(_0xae84('0x7'));exports[_0xae84('0x8')]=function(_0x29c522,_0x5e9a10){logger[_0xae84('0x8')](_0x29c522,_0x5e9a10?util['inspect'](_0x5e9a10,{'showHidden':![],'depth':null}):'');};exports[_0xae84('0x9')]=function(_0x22930e,_0x53b9da){logger[_0xae84('0x9')](_0x22930e,_0x53b9da?util[_0xae84('0xa')](_0x53b9da,{'showHidden':![],'depth':null}):'');};exports[_0xae84('0xb')]=function(_0x5d93c8,_0x14928c){logger['error'](_0x5d93c8,_0x14928c?util[_0xae84('0xa')](_0x14928c,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2090e8,_0x5f1451){return client[_0xae84('0xc')](_0x2090e8,{'body':_0x5f1451})[_0xae84('0xd')](function(_0x32373d){logger[_0xae84('0x9')](_0xae84('0xe'),_0x2090e8,_0x32373d?util[_0xae84('0xa')](_0x32373d,{'showHidden':![],'depth':null}):'');})[_0xae84('0xf')](function(_0x9abc70){logger[_0xae84('0xb')]('[utils][request]\x20name:%s',_0x2090e8,_0x9abc70?util['inspect'](_0x9abc70,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4a221c){return client[_0xae84('0xc')](_0xae84('0x10'),{'options':{'raw':!![],'attributes':['id',_0xae84('0x11'),'name',_0xae84('0x12')],'where':_0x4a221c,'limit':0x1}})[_0xae84('0xd')](function(_0x547e46){logger[_0xae84('0x9')](_0xae84('0x13'),JSON['stringify'](_0x4a221c),_0x547e46?util[_0xae84('0xa')](_0x547e46,{'showHidden':![],'depth':null}):'');return _0x547e46[_0xae84('0x14')][_0xae84('0x15')]?_0x547e46[_0xae84('0x14')][0x0]:null;});}exports[_0xae84('0x16')]=function(_0x4da8f3){return new BPromise(function(_0xa4ed8d,_0x78d8c4){if(_0x4da8f3){return getUser({'internal':_0x4da8f3})[_0xae84('0xd')](function(_0x47d0a7){logger['info'](_0xae84('0x17'),_0x4da8f3,_0x47d0a7?_0xae84('0x18'):'notfound');return _0xa4ed8d(_0x47d0a7);})['catch'](function(_0x599d16){logger[_0xae84('0xb')](_0xae84('0x19'),_0x599d16?util[_0xae84('0xa')](_0x599d16,{'showHidden':![],'depth':null}):'');return _0xa4ed8d(null);});}return _0xa4ed8d(null);});};exports[_0xae84('0x1a')]=function(_0x5eb7fa){return new BPromise(function(_0x46c8f3,_0x59360f){if(_0x5eb7fa){return getUser({'interface':_0x5eb7fa})[_0xae84('0xd')](function(_0x39b0cc){logger[_0xae84('0x8')](_0xae84('0x1b'),_0x5eb7fa,_0x39b0cc?_0xae84('0x18'):_0xae84('0x1c'));return _0x46c8f3(_0x39b0cc);})['catch'](function(_0x4e52be){logger['error'](_0xae84('0x1d'),_0x4e52be?util[_0xae84('0xa')](_0x4e52be,{'showHidden':![],'depth':null}):'');return _0x46c8f3(null);});}return _0x46c8f3(null);});};exports[_0xae84('0x1e')]=function(_0x57551d){return new BPromise(function(_0x861fc1,_0x43096f){if(_0x57551d){return getUser({'name':_0x57551d})[_0xae84('0xd')](function(_0x1e0965){logger[_0xae84('0x8')](_0xae84('0x1f'),_0x57551d,_0x1e0965?_0xae84('0x18'):_0xae84('0x1c'));return _0x861fc1(_0x1e0965);})[_0xae84('0xf')](function(_0x6dd090){logger[_0xae84('0xb')]('[utils][getUserByName]',_0x6dd090?util['inspect'](_0x6dd090,{'showHidden':![],'depth':null}):'');return _0x861fc1(null);});}return _0x861fc1(null);});};exports[_0xae84('0x20')]=function(_0x4cc7db){return new BPromise(function(_0x5b5491,_0x180d8d){if(_0x4cc7db){return client[_0xae84('0xc')](_0xae84('0x21'),{'options':{'raw':!![],'attributes':['id',_0xae84('0x22'),'type',_0xae84('0x23'),_0xae84('0x24')],'where':{'name':_0x4cc7db},'limit':0x1}})[_0xae84('0xd')](function(_0x3b399e){logger['debug'](_0xae84('0x25'),_0x4cc7db,_0x3b399e?util[_0xae84('0xa')](_0x3b399e,{'showHidden':![],'depth':null}):'');logger[_0xae84('0x8')](_0xae84('0x26'),_0x4cc7db,_0x3b399e?_0xae84('0x18'):_0xae84('0x1c'));return _0x5b5491(_0x3b399e[_0xae84('0x14')]['length']?_0x3b399e[_0xae84('0x14')][0x0]:null);})[_0xae84('0xf')](function(_0xeb6d20){logger['error']('[utils][getVoiceQueueByName]',_0xeb6d20?util[_0xae84('0xa')](_0xeb6d20,{'showHidden':![],'depth':null}):'');return _0x5b5491(null);});}return _0x5b5491(null);});};exports[_0xae84('0x27')]=function(_0x1553c9,_0xeba4f7){return moment(_0x1553c9)[_0xae84('0x28')](_0xeba4f7,'seconds')['format'](_0xae84('0x29'));};exports[_0xae84('0x2a')]=function(_0x33f7d0,_0x16e15e){return moment(_0x33f7d0)['subtract'](_0x16e15e,_0xae84('0x2b'))[_0xae84('0x2c')](_0xae84('0x29'));};exports[_0xae84('0x2d')]=function(_0x515e33,_0x2d6ba4){return moment(_0x515e33)[_0xae84('0x2e')](moment(_0x2d6ba4),_0xae84('0x2b'));};exports[_0xae84('0x2f')]=function(_0x3fc7ac,_0x1766b4){return parseInt(_0x3fc7ac,0xa)+parseInt(_0x1766b4,0xa);};exports[_0xae84('0x30')]=function(){return moment()[_0xae84('0x2c')](_0xae84('0x29'));};exports['isAfter']=function(_0x51ca35,_0x558a63){if(_0x558a63){return moment(_0x51ca35)[_0xae84('0x31')](_0x558a63);}return!![];};exports[_0xae84('0x32')]=function(_0x4f9fc3,_0x3a4c0f){if(_0x3a4c0f){return moment(_0x4f9fc3)[_0xae84('0x32')](_0x3a4c0f);}else if(_0x4f9fc3){return!![];}return![];}; \ No newline at end of file +var _0xdfdd=['isAfter','isBefore','bluebird','jayson/promise','moment','util','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','found','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime'];(function(_0x10da92,_0x299d4e){var _0x54a927=function(_0x323d3d){while(--_0x323d3d){_0x10da92['push'](_0x10da92['shift']());}};_0x54a927(++_0x299d4e);}(_0xdfdd,0x104));var _0xddfd=function(_0x5aacfc,_0x4b3b65){_0x5aacfc=_0x5aacfc-0x0;var _0x50a13f=_0xdfdd[_0x5aacfc];return _0x50a13f;};'use strict';var BPromise=require(_0xddfd('0x0'));var jayson=require(_0xddfd('0x1'));var moment=require(_0xddfd('0x2'));var util=require(_0xddfd('0x3'));var client=jayson['client'][_0xddfd('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0xddfd('0x5'));exports['info']=function(_0x320e7c,_0x359539){logger[_0xddfd('0x6')](_0x320e7c,_0x359539?util[_0xddfd('0x7')](_0x359539,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x25fcbc,_0x485ede){logger[_0xddfd('0x8')](_0x25fcbc,_0x485ede?util[_0xddfd('0x7')](_0x485ede,{'showHidden':![],'depth':null}):'');};exports[_0xddfd('0x9')]=function(_0xc03e9,_0x335e27){logger[_0xddfd('0x9')](_0xc03e9,_0x335e27?util['inspect'](_0x335e27,{'showHidden':![],'depth':null}):'');};exports[_0xddfd('0xa')]=function(_0x20d8ff,_0x57a270){return client[_0xddfd('0xa')](_0x20d8ff,{'body':_0x57a270})[_0xddfd('0xb')](function(_0x261f25){logger[_0xddfd('0x8')](_0xddfd('0xc'),_0x20d8ff,_0x261f25?util['inspect'](_0x261f25,{'showHidden':![],'depth':null}):'');})[_0xddfd('0xd')](function(_0x4973a8){logger[_0xddfd('0x9')]('[utils][request]\x20name:%s',_0x20d8ff,_0x4973a8?util[_0xddfd('0x7')](_0x4973a8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4d3674){return client[_0xddfd('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xddfd('0xe'),_0xddfd('0xf'),_0xddfd('0x10')],'where':_0x4d3674,'limit':0x1}})[_0xddfd('0xb')](function(_0x1ff64e){logger['debug'](_0xddfd('0x11'),JSON[_0xddfd('0x12')](_0x4d3674),_0x1ff64e?util[_0xddfd('0x7')](_0x1ff64e,{'showHidden':![],'depth':null}):'');return _0x1ff64e[_0xddfd('0x13')][_0xddfd('0x14')]?_0x1ff64e[_0xddfd('0x13')][0x0]:null;});}exports[_0xddfd('0x15')]=function(_0x587e61){return new BPromise(function(_0x578f43,_0x33c48e){if(_0x587e61){return getUser({'internal':_0x587e61})[_0xddfd('0xb')](function(_0x2bc921){logger[_0xddfd('0x6')](_0xddfd('0x16'),_0x587e61,_0x2bc921?'found':_0xddfd('0x17'));return _0x578f43(_0x2bc921);})[_0xddfd('0xd')](function(_0x468e44){logger[_0xddfd('0x9')](_0xddfd('0x18'),_0x468e44?util[_0xddfd('0x7')](_0x468e44,{'showHidden':![],'depth':null}):'');return _0x578f43(null);});}return _0x578f43(null);});};exports['getUserByInterface']=function(_0x57b589){return new BPromise(function(_0x571e93,_0x34d7ac){if(_0x57b589){return getUser({'interface':_0x57b589})[_0xddfd('0xb')](function(_0x2441f2){logger[_0xddfd('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x57b589,_0x2441f2?_0xddfd('0x19'):_0xddfd('0x17'));return _0x571e93(_0x2441f2);})[_0xddfd('0xd')](function(_0x68caf6){logger[_0xddfd('0x9')]('[utils][getUserByInterface]',_0x68caf6?util[_0xddfd('0x7')](_0x68caf6,{'showHidden':![],'depth':null}):'');return _0x571e93(null);});}return _0x571e93(null);});};exports[_0xddfd('0x1a')]=function(_0x3be2ae){return new BPromise(function(_0x1dd7f3,_0x5446f9){if(_0x3be2ae){return getUser({'name':_0x3be2ae})['then'](function(_0x4b8a02){logger[_0xddfd('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x3be2ae,_0x4b8a02?_0xddfd('0x19'):_0xddfd('0x17'));return _0x1dd7f3(_0x4b8a02);})[_0xddfd('0xd')](function(_0x1035e6){logger[_0xddfd('0x9')]('[utils][getUserByName]',_0x1035e6?util[_0xddfd('0x7')](_0x1035e6,{'showHidden':![],'depth':null}):'');return _0x1dd7f3(null);});}return _0x1dd7f3(null);});};exports[_0xddfd('0x1b')]=function(_0x339607){return new BPromise(function(_0x185844,_0x3ba266){if(_0x339607){return client[_0xddfd('0xa')](_0xddfd('0x1c'),{'options':{'raw':!![],'attributes':['id',_0xddfd('0xf'),_0xddfd('0x1d'),'acw',_0xddfd('0x1e')],'where':{'name':_0x339607},'limit':0x1}})[_0xddfd('0xb')](function(_0x4dcf94){logger[_0xddfd('0x8')](_0xddfd('0x1f'),_0x339607,_0x4dcf94?util[_0xddfd('0x7')](_0x4dcf94,{'showHidden':![],'depth':null}):'');logger['info'](_0xddfd('0x20'),_0x339607,_0x4dcf94?'found':_0xddfd('0x17'));return _0x185844(_0x4dcf94[_0xddfd('0x13')][_0xddfd('0x14')]?_0x4dcf94[_0xddfd('0x13')][0x0]:null);})[_0xddfd('0xd')](function(_0x4ea022){logger[_0xddfd('0x9')]('[utils][getVoiceQueueByName]',_0x4ea022?util['inspect'](_0x4ea022,{'showHidden':![],'depth':null}):'');return _0x185844(null);});}return _0x185844(null);});};exports[_0xddfd('0x21')]=function(_0x534970,_0x454403){return moment(_0x534970)[_0xddfd('0x22')](_0x454403,_0xddfd('0x23'))[_0xddfd('0x24')](_0xddfd('0x25'));};exports[_0xddfd('0x26')]=function(_0x466c3b,_0x5802cb){return moment(_0x466c3b)[_0xddfd('0x27')](_0x5802cb,_0xddfd('0x23'))[_0xddfd('0x24')](_0xddfd('0x25'));};exports[_0xddfd('0x28')]=function(_0x585b3b,_0x59ac86){return moment(_0x585b3b)['diff'](moment(_0x59ac86),_0xddfd('0x23'));};exports['sumTime']=function(_0x46d262,_0x3700b8){return parseInt(_0x46d262,0xa)+parseInt(_0x3700b8,0xa);};exports['now']=function(){return moment()[_0xddfd('0x24')](_0xddfd('0x25'));};exports[_0xddfd('0x29')]=function(_0x365e38,_0x421910){if(_0x421910){return moment(_0x365e38)[_0xddfd('0x29')](_0x421910);}return!![];};exports[_0xddfd('0x2a')]=function(_0x5e284c,_0x16aef4){if(_0x16aef4){return moment(_0x5e284c)[_0xddfd('0x2a')](_0x16aef4);}else if(_0x5e284c){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 87cd8ab..70c7e89 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe39c=['body','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','client','name','then','catch','user','no-user','data','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe39c,0x12d));var _0xce39=function(_0x24bf70,_0x3cd6d2){_0x24bf70=_0x24bf70-0x0;var _0xa8c175=_0xe39c[_0x24bf70];return _0xa8c175;};var fs=require(_0xce39('0x0'));var _=require(_0xce39('0x1'));var ewinston=require(_0xce39('0x2'));var path=require(_0xce39('0x3'));var util=require(_0xce39('0x4'));var fileLogger=require('./loggers')[_0xce39('0x5')];var safeTemplate=require(_0xce39('0x6'))[_0xce39('0x7')];var maskSensitiveData=require(_0xce39('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x31b4ee(_0x551d33){var _0x5983b7=path[_0xce39('0x9')](_0xce39('0xa'),_0xce39('0xb'),_0xce39('0xc'));var _0x1f173c=path['join'](_0xce39('0xd'),_0x551d33['role']+'-'+_0x551d33[_0xce39('0xe')]);return fs['ensureDir'](path[_0xce39('0x9')](_0x5983b7,_0x1f173c))[_0xce39('0xf')](function(){var _0x5257e9=fileLogger(_0xce39('0xd'),path[_0xce39('0x9')](_0x5983b7,_0x1f173c));return _0x5257e9;})[_0xce39('0x10')](function(_0x122373){throw _0x122373;});}this[_0xce39('0xb')]=function(_0x11e209,_0x4d746,_0x7f820b,_0x50d614){return _0x31b4ee(_0x11e209[_0xce39('0x11')])[_0xce39('0xf')](function(_0x237d1c){var _0x4c01fb=_0x237d1c[_0x4d746];return _0x4c01fb;})[_0xce39('0xf')](function(_0x21b9de){var _0x17a7dc=_0x11e209[_0xce39('0x11')]?_0x11e209['user']['id']:_0xce39('0x12');var _0x2e3895=_0x50d614[_0xce39('0x13')];var _0x5b8857=_0x50d614['timestamp'];var _0x394677=new Date(Number(_0x5b8857));return _0x21b9de(_0x17a7dc,_0x394677,_0x7f820b,_0x2e3895);})[_0xce39('0x10')](function(_0xe7645a){fileLogger('client')['error'](_0xe7645a);});};}function setupLoggers(_0x354735){return new Promise(function(_0x570c59){var _0x3e7aba=new ClientSideLogger();var _0x4a0ac1=fileLogger(_0xce39('0x14'));var _0x2d35db=fileLogger(_0xce39('0x15'));_0x354735[_0xce39('0x16')](_0xce39('0x17'),_0x3e7aba);_0x354735[_0xce39('0x18')](ewinston[_0xce39('0x19')]({'winstonInstance':_0x4a0ac1,'meta':![],'statusLevels':!![],'msg':function(_0x110ad1,_0x5143ca){var _0x2c2cfc=_0xce39('0x1a');if(!_[_0xce39('0x1b')](_0x110ad1['body'])){_0x2c2cfc+='\x20body=%s';var _0x34c650=_0x110ad1[_0xce39('0x1c')];maskSensitiveData(_0x34c650);}return safeTemplate(util[_0xce39('0x1d')](_0x2c2cfc,_0x110ad1[_0xce39('0x1e')],_0x110ad1[_0xce39('0x1f')][_0xce39('0x20')]?_0x110ad1[_0xce39('0x1f')][_0xce39('0x20')]:_0x110ad1[_0xce39('0x21')]['remoteAddress']||_0x110ad1['ip'],_0x110ad1[_0xce39('0x22')],_0x5143ca[_0xce39('0x23')],_0x5143ca[_0xce39('0x24')],_0x110ad1[_0xce39('0x11')]?_0x110ad1[_0xce39('0x11')]['id']:null,_0x110ad1['user']?_0x110ad1[_0xce39('0x11')][_0xce39('0xe')]:null,_0x110ad1['user']?_0x110ad1[_0xce39('0x11')][_0xce39('0x25')]:null,_0x34c650?util['inspect'](_0x34c650,![],null):''));}}));_0x354735[_0xce39('0x18')](ewinston[_0xce39('0x19')]({'winstonInstance':_0x2d35db,'meta':![],'statusLevels':!![],'msg':function(_0x48697a,_0x5353be){var _0x526eac=_0xce39('0x26');if(_0x48697a[_0xce39('0x1c')]&&_0x48697a[_0xce39('0x1c')][_0xce39('0x27')]&&_0x48697a['body'][_0xce39('0x28')]){_0x526eac=_0xce39('0x29');}return util[_0xce39('0x1d')](_0x526eac,_0x48697a[_0xce39('0x1e')],_0x48697a['headers'][_0xce39('0x20')]?_0x48697a[_0xce39('0x1f')][_0xce39('0x20')]:_0x48697a['connection'][_0xce39('0x2a')]||_0x48697a['ip'],_0x48697a[_0xce39('0x22')],_0x5353be['statusCode'],_0x5353be[_0xce39('0x24')],_0x48697a[_0xce39('0x11')]?_0x48697a['user']['id']:null,_0x48697a[_0xce39('0x11')]?_0x48697a['user'][_0xce39('0xe')]:null,_0x48697a[_0xce39('0x11')]?_0x48697a[_0xce39('0x11')][_0xce39('0x25')]:null,_0x48697a[_0xce39('0x1c')]&&_0x48697a[_0xce39('0x1c')]['device']?_0x48697a[_0xce39('0x1c')][_0xce39('0x27')]:_0xce39('0x2b'),_0x48697a['body']&&_0x48697a[_0xce39('0x1c')]['agent_id']?_0x48697a[_0xce39('0x1c')][_0xce39('0x28')]:'',_0x48697a[_0xce39('0x1c')]&&_0x48697a[_0xce39('0x1c')][_0xce39('0x2c')]?_0x48697a['body'][_0xce39('0x2c')]:'');},'ignoreRoute':function(_0x56dbc5){var _0x120a4c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x120a4c[_0xce39('0x2d')](_0x56dbc5['url']);}}));return _0x570c59();});}exports[_0xce39('0x2e')]=setupLoggers; \ No newline at end of file +var _0x0977=['format','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','setupLoggers','fs-extra','util','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','client','role','name','then','catch','user','timestamp','api','auth','set','use','logger','isEmpty','\x20body=%s'];(function(_0x2c254b,_0xa6e203){var _0x131d22=function(_0x38ff62){while(--_0x38ff62){_0x2c254b['push'](_0x2c254b['shift']());}};_0x131d22(++_0xa6e203);}(_0x0977,0x88));var _0x7097=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0977[_0x3ab51d];return _0x29a04e;};var fs=require(_0x7097('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require(_0x7097('0x1'));var fileLogger=require(_0x7097('0x2'))[_0x7097('0x3')];var safeTemplate=require(_0x7097('0x4'))[_0x7097('0x5')];var maskSensitiveData=require('./mask-sensitive-data')[_0x7097('0x6')];function ClientSideLogger(){function _0x297dfd(_0x13445f){var _0x114f8e=path[_0x7097('0x7')](_0x7097('0x8'),_0x7097('0x9'),'xcally');var _0x80dbb2=path['join'](_0x7097('0xa'),_0x13445f[_0x7097('0xb')]+'-'+_0x13445f[_0x7097('0xc')]);return fs['ensureDir'](path[_0x7097('0x7')](_0x114f8e,_0x80dbb2))[_0x7097('0xd')](function(){var _0x212e47=fileLogger(_0x7097('0xa'),path[_0x7097('0x7')](_0x114f8e,_0x80dbb2));return _0x212e47;})[_0x7097('0xe')](function(_0x5b02c4){throw _0x5b02c4;});}this[_0x7097('0x9')]=function(_0x5edd4e,_0x2c4e6f,_0x4ea8f4,_0x35c82f){return _0x297dfd(_0x5edd4e[_0x7097('0xf')])[_0x7097('0xd')](function(_0x5cf7b7){var _0x2040aa=_0x5cf7b7[_0x2c4e6f];return _0x2040aa;})['then'](function(_0x26c1f9){var _0x29c6f4=_0x5edd4e[_0x7097('0xf')]?_0x5edd4e[_0x7097('0xf')]['id']:'no-user';var _0x22856d=_0x35c82f['data'];var _0x2397ec=_0x35c82f[_0x7097('0x10')];var _0x417fc4=new Date(Number(_0x2397ec));return _0x26c1f9(_0x29c6f4,_0x417fc4,_0x4ea8f4,_0x22856d);})[_0x7097('0xe')](function(_0xcc3f3){fileLogger(_0x7097('0xa'))['error'](_0xcc3f3);});};}function setupLoggers(_0x43d8ca){return new Promise(function(_0x4b385b){var _0x1c4d9e=new ClientSideLogger();var _0x485432=fileLogger(_0x7097('0x11'));var _0x4749b2=fileLogger(_0x7097('0x12'));_0x43d8ca[_0x7097('0x13')]('client-side-logger',_0x1c4d9e);_0x43d8ca[_0x7097('0x14')](ewinston[_0x7097('0x15')]({'winstonInstance':_0x485432,'meta':![],'statusLevels':!![],'msg':function(_0x436e7f,_0x1376e2){var _0x18656f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x7097('0x16')](_0x436e7f['body'])){_0x18656f+=_0x7097('0x17');var _0x53e2cf=_0x436e7f['body'];maskSensitiveData(_0x53e2cf);}return safeTemplate(util[_0x7097('0x18')](_0x18656f,_0x436e7f['method'],_0x436e7f[_0x7097('0x19')][_0x7097('0x1a')]?_0x436e7f[_0x7097('0x19')][_0x7097('0x1a')]:_0x436e7f[_0x7097('0x1b')][_0x7097('0x1c')]||_0x436e7f['ip'],_0x436e7f[_0x7097('0x1d')],_0x1376e2['statusCode'],_0x1376e2[_0x7097('0x1e')],_0x436e7f[_0x7097('0xf')]?_0x436e7f[_0x7097('0xf')]['id']:null,_0x436e7f[_0x7097('0xf')]?_0x436e7f[_0x7097('0xf')][_0x7097('0xc')]:null,_0x436e7f[_0x7097('0xf')]?_0x436e7f[_0x7097('0xf')][_0x7097('0xb')]:null,_0x53e2cf?util['inspect'](_0x53e2cf,![],null):''));}}));_0x43d8ca[_0x7097('0x14')](ewinston[_0x7097('0x15')]({'winstonInstance':_0x4749b2,'meta':![],'statusLevels':!![],'msg':function(_0x4838cd,_0x4d7f74){var _0x36137b=_0x7097('0x1f');if(_0x4838cd[_0x7097('0x20')]&&_0x4838cd['body'][_0x7097('0x21')]&&_0x4838cd['body'][_0x7097('0x22')]){_0x36137b=_0x7097('0x23');}return util[_0x7097('0x18')](_0x36137b,_0x4838cd['method'],_0x4838cd[_0x7097('0x19')][_0x7097('0x1a')]?_0x4838cd[_0x7097('0x19')]['x-forwarded-for']:_0x4838cd[_0x7097('0x1b')][_0x7097('0x1c')]||_0x4838cd['ip'],_0x4838cd[_0x7097('0x1d')],_0x4d7f74['statusCode'],_0x4d7f74[_0x7097('0x1e')],_0x4838cd['user']?_0x4838cd[_0x7097('0xf')]['id']:null,_0x4838cd[_0x7097('0xf')]?_0x4838cd['user']['name']:null,_0x4838cd[_0x7097('0xf')]?_0x4838cd[_0x7097('0xf')][_0x7097('0xb')]:null,_0x4838cd['body']&&_0x4838cd[_0x7097('0x20')]['device']?_0x4838cd['body'][_0x7097('0x21')]:_0x7097('0x24'),_0x4838cd[_0x7097('0x20')]&&_0x4838cd[_0x7097('0x20')][_0x7097('0x22')]?_0x4838cd[_0x7097('0x20')][_0x7097('0x22')]:'',_0x4838cd[_0x7097('0x20')]&&_0x4838cd[_0x7097('0x20')][_0x7097('0x25')]?_0x4838cd[_0x7097('0x20')][_0x7097('0x25')]:'');},'ignoreRoute':function(_0x1cfa33){var _0x22fd06=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x22fd06[_0x7097('0x26')](_0x1cfa33['url']);}}));return _0x4b385b();});}exports[_0x7097('0x27')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 05c384f..f9aab82 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0176=['endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','max','min','MMM','monthCompare','guess','isMoment','padStart','length','iftime','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','map','toLowerCase','indexOf','slice','monthsShort','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day'];(function(_0x3b18e6,_0x35e310){var _0xaf05b7=function(_0x5f0cc8){while(--_0x5f0cc8){_0x3b18e6['push'](_0x3b18e6['shift']());}};_0xaf05b7(++_0x35e310);}(_0x0176,0x167));var _0x6017=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0176[_0x122ef9];return _0x42fba0;};var _=require('lodash');var moment=require(_0x6017('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x40e470){return _0x40e470[_0x6017('0x1')];})[_0x6017('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x6017('0x3');var EINVALID_DATE=_0x6017('0x4');function throwIfDateNotValid(_0x12bbd2){if(!_0x12bbd2['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2938bf){var _0x14c166=_0x2938bf[_0x6017('0x5')](':')['map'](function(_0x415754){return parseInt(_0x415754,0xa);});var _0x1ef71f=_0x14c166[0x0];var _0xf6b7b7=_0x14c166[0x1];if(_0x1ef71f<0x0||_0x1ef71f>0x17||_0xf6b7b7<0x0||_0xf6b7b7>0x3b){throw new Error(EINVALID_DATE);}return[_0x1ef71f,_0xf6b7b7];}function circularDoWInterval(_0x3362c0,_0x5ce14f){if(_0x3362c0===_0x5ce14f){return[_0x3362c0];}else{var _0x3ad622=moment['locale']();moment[_0x6017('0x6')]('en');var _0x4ecbfa=moment[_0x6017('0x7')]()[_0x6017('0x8')](function(_0x5738ee){return _0x5738ee[_0x6017('0x9')]();});moment[_0x6017('0x6')](_0x3ad622);var _0x3a1c82=_0x4ecbfa[_0x6017('0xa')](_0x3362c0);var _0x3f0c42=_0x4ecbfa[_0x6017('0xa')](_0x5ce14f);if(_0x3f0c42>_0x3a1c82){return _0x4ecbfa['slice'](_0x3a1c82,_0x3f0c42+0x1);}else{var _0x7eb0fb=_0x4ecbfa[_0x6017('0xb')](0x0,_0x3f0c42+0x1);var _0x3ccee4=_0x4ecbfa[_0x6017('0xb')](_0x3a1c82);return _0x3ccee4['concat'](_0x7eb0fb);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x2f5e89,_0x30622b){if(_0x2f5e89===_0x30622b){return[_0x2f5e89];}else{var _0x3b5ceb=moment[_0x6017('0x6')]();moment['locale']('en');var _0x274a3b=moment[_0x6017('0xc')]()[_0x6017('0x8')](function(_0x2d84a2){return _0x2d84a2['toLowerCase']();});moment[_0x6017('0x6')](_0x3b5ceb);var _0x2b66be=_0x274a3b['indexOf'](_0x2f5e89);var _0x42f43d=_0x274a3b[_0x6017('0xa')](_0x30622b);if(_0x42f43d>_0x2b66be){return _0x274a3b[_0x6017('0xb')](_0x2b66be,_0x42f43d+0x1);}else{var _0x276c02=_0x274a3b[_0x6017('0xb')](0x0,_0x42f43d+0x1);var _0x3c8756=_0x274a3b['slice'](_0x2b66be);return _0x3c8756['concat'](_0x276c02);}}}module[_0x6017('0xd')][_0x6017('0xe')]=circularMonthInterval;function parseDom(_0x4ad7d4){var _0x478fad=parseInt(_0x4ad7d4,0xa);if(_0x478fad<0x1||_0x478fad>0x1f){throw new Error(EINVALID_DATE);}return _0x478fad;}function timeCompare(_0x489c7a,_0x4eab1e,_0x579d51){var _0x24b856=_0x489c7a[_0x6017('0xf')]();var _0x3c5a81=extractTime(_0x4eab1e);var _0xb9c895=_0x3c5a81[0x0];var _0x373c1c=_0x3c5a81[0x1];var _0x456c52=_0x489c7a[_0x6017('0xf')]()[_0x6017('0x10')](_0xb9c895)[_0x6017('0x11')](_0x373c1c);throwIfDateNotValid(_0x456c52);var _0x34edf8=extractTime(_0x579d51);var _0x46b256=_0x34edf8[0x0];var _0x48c562=_0x34edf8[0x1];var _0x2378d1=_0x489c7a[_0x6017('0xf')]()['hours'](_0x46b256)[_0x6017('0x11')](_0x48c562);throwIfDateNotValid(_0x2378d1);if(_0x2378d1[_0x6017('0x12')](_0x456c52)){var _0x587eae=_0x24b856['clone']()[_0x6017('0x13')](_0x6017('0x14'));var _0x360232=_0x24b856[_0x6017('0xf')]()[_0x6017('0x15')]('day');return _0x24b856[_0x6017('0x16')](_0x456c52,_0x360232,undefined,'[]')||_0x24b856['isBetween'](_0x587eae,_0x2378d1,undefined,'[]');}else{return _0x24b856[_0x6017('0x16')](_0x456c52,_0x2378d1,undefined,'[]');}}module[_0x6017('0xd')][_0x6017('0x17')]=timeCompare;function dowCompare(_0x380735,_0x254800,_0x1bdc3b){var _0x247c88=_0x380735[_0x6017('0x6')]('en')[_0x6017('0x18')](_0x6017('0x19'))[_0x6017('0x9')]();return circularDoWInterval(_0x254800,_0x1bdc3b)[_0x6017('0x1a')](_0x247c88);}module[_0x6017('0xd')][_0x6017('0x1b')]=dowCompare;function domCompare(_0x34cbdb,_0x42863b,_0x1a5d29){var _0x5c87d1=_0x34cbdb[_0x6017('0x1c')]();if(_0x42863b===_0x1a5d29){return _0x5c87d1===_0x42863b;}else{var _0x546f7e=_0x34cbdb['daysInMonth']();var _0x4f4acc=_0x42863b<_0x1a5d29;let _0x2d9ada=![];var _0x4f8e4f=0x0;var _0x42e520=0x0;if(_0x4f4acc){_0x4f8e4f=Math[_0x6017('0x1d')](0x1,_0x42863b);_0x42e520=Math[_0x6017('0x1e')](_0x1a5d29,_0x546f7e);_0x2d9ada=_0x5c87d1>=_0x4f8e4f&&_0x5c87d1<=_0x42e520;}else{_0x4f8e4f=Math[_0x6017('0x1e')](_0x42863b,_0x546f7e);_0x42e520=Math[_0x6017('0x1d')](0x1,_0x1a5d29);_0x2d9ada=_0x5c87d1>=_0x4f8e4f||_0x5c87d1<=_0x42e520;}return _0x2d9ada;}}module[_0x6017('0xd')]['domCompare']=domCompare;function monthCompare(_0x1c9ebc,_0x2c5ca3,_0x1c3c47){var _0x4f9de6=_0x1c9ebc[_0x6017('0x6')]('en')[_0x6017('0x18')](_0x6017('0x1f'))[_0x6017('0x9')]();return circularMonthInterval(_0x2c5ca3,_0x1c3c47)[_0x6017('0x1a')](_0x4f9de6);}module[_0x6017('0xd')][_0x6017('0x20')]=monthCompare;function iftime(_0x44afde,_0x1515ae=moment['tz'][_0x6017('0x21')](),_0x291267=moment()){if(!validateRx['test'](_0x44afde)){throw new Error(EINVALID_STRING);}else{var _0xf90cd8=(moment[_0x6017('0x22')](_0x291267)?_0x291267['clone']():moment(_0x291267))['tz'](_0x1515ae)[_0x6017('0x6')]('en');throwIfDateNotValid(_0xf90cd8);var _0x126e9b=_0x44afde[_0x6017('0x5')](',');var _0x3fb4a6=_0x126e9b[0x0];var _0x4cf3d1=_0x126e9b[0x1];var _0x1dd443=_0x126e9b[0x2];var _0x4e0ea0=_0x126e9b[0x3];let _0x3f3ad6=!![];if(_0x3fb4a6!=='*'){var _0x3cce2f=_0x3fb4a6['split']('-');var _0x2cec9=_[_0x6017('0x23')](_0x3cce2f[0x0],0x5,'0');var _0x53dc1d=_0x3cce2f[_0x6017('0x24')]===0x2?_[_0x6017('0x23')](_0x3cce2f[0x1],0x5,'0'):_0x2cec9;_0x3f3ad6=timeCompare(_0xf90cd8,_0x2cec9,_0x53dc1d);}let _0xb72ee9=!![];if(_0x4cf3d1!=='*'){var _0x45552d=_0x4cf3d1[_0x6017('0x5')]('-');var _0x478c21=_0x45552d[0x0];var _0x148816=_0x45552d[_0x6017('0x24')]===0x2?_0x45552d[0x1]:_0x478c21;_0xb72ee9=dowCompare(_0xf90cd8,_0x478c21,_0x148816);}let _0x52bbf3=!![];if(_0x1dd443!=='*'){var _0x5ab992=_0x1dd443[_0x6017('0x5')]('-');var _0x35de13=parseDom(_0x5ab992[0x0]);var _0x1c6715=_0x5ab992[_0x6017('0x24')]===0x2?parseDom(_0x5ab992[0x1]):_0x35de13;_0x52bbf3=domCompare(_0xf90cd8,_0x35de13,_0x1c6715);}let _0x2abe16=!![];if(_0x4e0ea0!=='*'){var _0x1a7ef1=_0x4e0ea0['split']('-');var _0x1b0121=_0x1a7ef1[0x0];var _0x457362=_0x1a7ef1['length']===0x2?_0x1a7ef1[0x1]:_0x1a7ef1[0x0];_0x2abe16=monthCompare(_0xf90cd8,_0x1b0121,_0x457362);}return _0x3f3ad6&&_0xb72ee9&&_0x52bbf3&&_0x2abe16;}}module[_0x6017('0xd')][_0x6017('0x25')]=iftime; \ No newline at end of file +var _0xe7a5=['dowCompare','date','daysInMonth','max','min','domCompare','MMM','includes','monthCompare','test','isMoment','padStart','length','iftime','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','toLowerCase','indexOf','slice','circularDoWInterval','monthsShort','concat','exports','circularMonthInterval','clone','hours','minutes','startOf','endOf','day','isBetween','timeCompare','format','ddd'];(function(_0x23a6ef,_0x50761d){var _0x57228e=function(_0x31aa97){while(--_0x31aa97){_0x23a6ef['push'](_0x23a6ef['shift']());}};_0x57228e(++_0x50761d);}(_0xe7a5,0x1dc));var _0x5e7a=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0xe7a5[_0x35d4e9];return _0x5c2770;};var _=require('lodash');var moment=require(_0x5e7a('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x464adf){return _0x464adf[_0x5e7a('0x1')];})[_0x5e7a('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x5e7a('0x3');var EINVALID_DATE=_0x5e7a('0x4');function throwIfDateNotValid(_0x2eee27){if(!_0x2eee27[_0x5e7a('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2b9f9d){var _0x103cc4=_0x2b9f9d[_0x5e7a('0x6')](':')[_0x5e7a('0x7')](function(_0x502725){return parseInt(_0x502725,0xa);});var _0x68db54=_0x103cc4[0x0];var _0x317ea9=_0x103cc4[0x1];if(_0x68db54<0x0||_0x68db54>0x17||_0x317ea9<0x0||_0x317ea9>0x3b){throw new Error(EINVALID_DATE);}return[_0x68db54,_0x317ea9];}function circularDoWInterval(_0x44e753,_0x3e9aab){if(_0x44e753===_0x3e9aab){return[_0x44e753];}else{var _0x5541e5=moment[_0x5e7a('0x8')]();moment['locale']('en');var _0xd87128=moment[_0x5e7a('0x9')]()['map'](function(_0x21bfbb){return _0x21bfbb[_0x5e7a('0xa')]();});moment[_0x5e7a('0x8')](_0x5541e5);var _0x45bcbe=_0xd87128[_0x5e7a('0xb')](_0x44e753);var _0x5b8fe9=_0xd87128[_0x5e7a('0xb')](_0x3e9aab);if(_0x5b8fe9>_0x45bcbe){return _0xd87128[_0x5e7a('0xc')](_0x45bcbe,_0x5b8fe9+0x1);}else{var _0x634d49=_0xd87128[_0x5e7a('0xc')](0x0,_0x5b8fe9+0x1);var _0x1cd006=_0xd87128['slice'](_0x45bcbe);return _0x1cd006['concat'](_0x634d49);}}}module['exports'][_0x5e7a('0xd')]=circularDoWInterval;function circularMonthInterval(_0x2b1a07,_0x173218){if(_0x2b1a07===_0x173218){return[_0x2b1a07];}else{var _0x4e8066=moment[_0x5e7a('0x8')]();moment[_0x5e7a('0x8')]('en');var _0x324c21=moment[_0x5e7a('0xe')]()['map'](function(_0x415948){return _0x415948['toLowerCase']();});moment[_0x5e7a('0x8')](_0x4e8066);var _0x4383f2=_0x324c21['indexOf'](_0x2b1a07);var _0x50987c=_0x324c21[_0x5e7a('0xb')](_0x173218);if(_0x50987c>_0x4383f2){return _0x324c21[_0x5e7a('0xc')](_0x4383f2,_0x50987c+0x1);}else{var _0x4c2b3c=_0x324c21['slice'](0x0,_0x50987c+0x1);var _0x49bc33=_0x324c21[_0x5e7a('0xc')](_0x4383f2);return _0x49bc33[_0x5e7a('0xf')](_0x4c2b3c);}}}module[_0x5e7a('0x10')][_0x5e7a('0x11')]=circularMonthInterval;function parseDom(_0x23cd8d){var _0x16b93e=parseInt(_0x23cd8d,0xa);if(_0x16b93e<0x1||_0x16b93e>0x1f){throw new Error(EINVALID_DATE);}return _0x16b93e;}function timeCompare(_0x211953,_0xc12439,_0x3948fc){var _0x47517e=_0x211953[_0x5e7a('0x12')]();var _0x3ae7b3=extractTime(_0xc12439);var _0x9d0aaa=_0x3ae7b3[0x0];var _0x479e49=_0x3ae7b3[0x1];var _0x4d227c=_0x211953[_0x5e7a('0x12')]()[_0x5e7a('0x13')](_0x9d0aaa)[_0x5e7a('0x14')](_0x479e49);throwIfDateNotValid(_0x4d227c);var _0x57085b=extractTime(_0x3948fc);var _0x238cf1=_0x57085b[0x0];var _0x704b82=_0x57085b[0x1];var _0x5d1c90=_0x211953[_0x5e7a('0x12')]()['hours'](_0x238cf1)['minutes'](_0x704b82);throwIfDateNotValid(_0x5d1c90);if(_0x5d1c90['isBefore'](_0x4d227c)){var _0x30f2e7=_0x47517e[_0x5e7a('0x12')]()[_0x5e7a('0x15')]('day');var _0x2e5a53=_0x47517e[_0x5e7a('0x12')]()[_0x5e7a('0x16')](_0x5e7a('0x17'));return _0x47517e['isBetween'](_0x4d227c,_0x2e5a53,undefined,'[]')||_0x47517e[_0x5e7a('0x18')](_0x30f2e7,_0x5d1c90,undefined,'[]');}else{return _0x47517e['isBetween'](_0x4d227c,_0x5d1c90,undefined,'[]');}}module[_0x5e7a('0x10')][_0x5e7a('0x19')]=timeCompare;function dowCompare(_0x475b2e,_0x509da4,_0x522c82){var _0x4bb76b=_0x475b2e[_0x5e7a('0x8')]('en')[_0x5e7a('0x1a')](_0x5e7a('0x1b'))[_0x5e7a('0xa')]();return circularDoWInterval(_0x509da4,_0x522c82)['includes'](_0x4bb76b);}module[_0x5e7a('0x10')][_0x5e7a('0x1c')]=dowCompare;function domCompare(_0x4f7782,_0x2394c2,_0x291b4f){var _0x466524=_0x4f7782[_0x5e7a('0x1d')]();if(_0x2394c2===_0x291b4f){return _0x466524===_0x2394c2;}else{var _0x4ea32c=_0x4f7782[_0x5e7a('0x1e')]();var _0x8cb732=_0x2394c2<_0x291b4f;let _0x1df046=![];var _0x48a72a=0x0;var _0x2ab1ca=0x0;if(_0x8cb732){_0x48a72a=Math[_0x5e7a('0x1f')](0x1,_0x2394c2);_0x2ab1ca=Math[_0x5e7a('0x20')](_0x291b4f,_0x4ea32c);_0x1df046=_0x466524>=_0x48a72a&&_0x466524<=_0x2ab1ca;}else{_0x48a72a=Math[_0x5e7a('0x20')](_0x2394c2,_0x4ea32c);_0x2ab1ca=Math[_0x5e7a('0x1f')](0x1,_0x291b4f);_0x1df046=_0x466524>=_0x48a72a||_0x466524<=_0x2ab1ca;}return _0x1df046;}}module[_0x5e7a('0x10')][_0x5e7a('0x21')]=domCompare;function monthCompare(_0x13c44f,_0x5d3d68,_0x58b1ff){var _0xe45636=_0x13c44f[_0x5e7a('0x8')]('en')[_0x5e7a('0x1a')](_0x5e7a('0x22'))[_0x5e7a('0xa')]();return circularMonthInterval(_0x5d3d68,_0x58b1ff)[_0x5e7a('0x23')](_0xe45636);}module[_0x5e7a('0x10')][_0x5e7a('0x24')]=monthCompare;function iftime(_0x3d8e6b,_0x1c97ca=moment['tz']['guess'](),_0x5a1f9e=moment()){if(!validateRx[_0x5e7a('0x25')](_0x3d8e6b)){throw new Error(EINVALID_STRING);}else{var _0x5c9740=(moment[_0x5e7a('0x26')](_0x5a1f9e)?_0x5a1f9e[_0x5e7a('0x12')]():moment(_0x5a1f9e))['tz'](_0x1c97ca)[_0x5e7a('0x8')]('en');throwIfDateNotValid(_0x5c9740);var _0x2062fe=_0x3d8e6b['split'](',');var _0x187f72=_0x2062fe[0x0];var _0x4baf92=_0x2062fe[0x1];var _0x526fcb=_0x2062fe[0x2];var _0x437148=_0x2062fe[0x3];let _0x2fadc2=!![];if(_0x187f72!=='*'){var _0x23e9c1=_0x187f72[_0x5e7a('0x6')]('-');var _0x5a1fa7=_[_0x5e7a('0x27')](_0x23e9c1[0x0],0x5,'0');var _0x96846e=_0x23e9c1[_0x5e7a('0x28')]===0x2?_[_0x5e7a('0x27')](_0x23e9c1[0x1],0x5,'0'):_0x5a1fa7;_0x2fadc2=timeCompare(_0x5c9740,_0x5a1fa7,_0x96846e);}let _0x55397d=!![];if(_0x4baf92!=='*'){var _0x4e8135=_0x4baf92['split']('-');var _0x3abd80=_0x4e8135[0x0];var _0x4734f8=_0x4e8135['length']===0x2?_0x4e8135[0x1]:_0x3abd80;_0x55397d=dowCompare(_0x5c9740,_0x3abd80,_0x4734f8);}let _0x451827=!![];if(_0x526fcb!=='*'){var _0x12f811=_0x526fcb[_0x5e7a('0x6')]('-');var _0x13484d=parseDom(_0x12f811[0x0]);var _0x26871e=_0x12f811[_0x5e7a('0x28')]===0x2?parseDom(_0x12f811[0x1]):_0x13484d;_0x451827=domCompare(_0x5c9740,_0x13484d,_0x26871e);}let _0x596554=!![];if(_0x437148!=='*'){var _0x3fcee3=_0x437148[_0x5e7a('0x6')]('-');var _0x3957aa=_0x3fcee3[0x0];var _0x1f3bfd=_0x3fcee3[_0x5e7a('0x28')]===0x2?_0x3fcee3[0x1]:_0x3fcee3[0x0];_0x596554=monthCompare(_0x5c9740,_0x3957aa,_0x1f3bfd);}return _0x2fadc2&&_0x55397d&&_0x451827&&_0x596554;}}module[_0x5e7a('0x10')][_0x5e7a('0x29')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index fb392b6..12aa9ed 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e9d=['fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','File','%s-%s','error','consoleLogger'];(function(_0x367496,_0x25ef9e){var _0x23ec29=function(_0x2162b9){while(--_0x2162b9){_0x367496['push'](_0x367496['shift']());}};_0x23ec29(++_0x25ef9e);}(_0x5e9d,0x120));var _0xd5e9=function(_0x293cda,_0x464976){_0x293cda=_0x293cda-0x0;var _0x53ce3a=_0x5e9d[_0x293cda];return _0x53ce3a;};'use strict';var path=require(_0xd5e9('0x0'));var util=require(_0xd5e9('0x1'));var moment=require(_0xd5e9('0x2'));var winston=require(_0xd5e9('0x3'));var config=require(_0xd5e9('0x4'));var debugLevel=config[_0xd5e9('0x5')]?config[_0xd5e9('0x5')][_0xd5e9('0x6')]():_0xd5e9('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xd5e9('0x8'),'warn':_0xd5e9('0x9'),'info':_0xd5e9('0xa'),'print':_0xd5e9('0xb'),'success':_0xd5e9('0xc'),'http':'gray','verbose':_0xd5e9('0xd'),'debug':'bold\x20blue','silly':_0xd5e9('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0xe70985,_0x13454c,_0x3efe43){var _0x261deb=_0xe70985||_0xd5e9('0xf');return path[_0xd5e9('0x10')](_0x261deb,util[_0xd5e9('0x11')](_0xd5e9('0x12'),_0x13454c,_0x3efe43));}function formatter(_0x24fc21,_0xbaa8e7){_0xbaa8e7[_0xd5e9('0x13')]=_0xbaa8e7[_0xd5e9('0x13')]['replace'](/@@{/g,_0xd5e9('0x14'))[_0xd5e9('0x15')](/}@@/g,_0xd5e9('0x16'))[_0xd5e9('0x15')](/@{/g,'{{')[_0xd5e9('0x15')](/}@/g,'}}');return util[_0xd5e9('0x11')](_0xd5e9('0x17'),moment()[_0xd5e9('0x11')](_0xd5e9('0x18')),_0xbaa8e7[_0xd5e9('0x19')][_0xd5e9('0x1a')](),_0x24fc21,_0xbaa8e7['message']);}function fileFormat(_0xdd2d1f,_0x59efaf){_0x59efaf['message']=_0x59efaf[_0xd5e9('0x13')][_0xd5e9('0x15')](/@@{/g,_0xd5e9('0x14'))['replace'](/}@@/g,_0xd5e9('0x16'))[_0xd5e9('0x15')](/@{/g,'{{')[_0xd5e9('0x15')](/}@/g,'}}');var _0x37a161=_0x59efaf['meta']&&Object[_0xd5e9('0x1b')](_0x59efaf[_0xd5e9('0x1c')])[_0xd5e9('0x1d')]?'\x0a\x09'+JSON[_0xd5e9('0x1e')](_0x59efaf[_0xd5e9('0x1c')]):'';return util[_0xd5e9('0x11')](_0xd5e9('0x1f'),moment()[_0xd5e9('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x59efaf[_0xd5e9('0x19')][_0xd5e9('0x1a')](),_0xdd2d1f,_0x59efaf['message'],_0x37a161);}function consoleLogger(){var _0x1623cb=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd5e9('0x20'))][(_0xd5e9('0x21'))]({'level':_0xd5e9('0x22'),'json':![],'formatter':function(_0x56e17e){return formatter('',_0x56e17e);}})]});return _0x1623cb;}function fileLogger(_0x30d3d8,_0x305f32){var _0x14e976=new winston[(_0xd5e9('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd5e9('0x20'))][(_0xd5e9('0x24'))]({'name':util[_0xd5e9('0x11')](_0xd5e9('0x25'),_0x30d3d8,_0xd5e9('0x26')),'filename':getLogFileName(_0x305f32,_0x30d3d8,'error'),'level':_0xd5e9('0x26'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x524728){return fileFormat(_0x30d3d8,_0x524728);}}),new winston[(_0xd5e9('0x20'))][(_0xd5e9('0x24'))]({'name':util[_0xd5e9('0x11')](_0xd5e9('0x25'),_0x30d3d8,debugLevel),'filename':getLogFileName(_0x305f32,_0x30d3d8,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x6e71d0){return fileFormat(_0x30d3d8,_0x6e71d0);}}),new winston[(_0xd5e9('0x20'))][(_0xd5e9('0x21'))]({'level':'warn','json':![],'formatter':function(_0x5dbe3b){return fileFormat(_0x30d3d8,_0x5dbe3b);}})]});return _0x14e976;}exports[_0xd5e9('0x27')]=consoleLogger;exports[_0xd5e9('0x28')]=fileLogger; \ No newline at end of file +var _0x0e40=['%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join'];(function(_0x13c2fb,_0xa899f){var _0xd98dfc=function(_0x3079fa){while(--_0x3079fa){_0x13c2fb['push'](_0x13c2fb['shift']());}};_0xd98dfc(++_0xa899f);}(_0x0e40,0x10d));var _0x00e4=function(_0x4ff74a,_0x1d6810){_0x4ff74a=_0x4ff74a-0x0;var _0x5229f6=_0x0e40[_0x4ff74a];return _0x5229f6;};'use strict';var path=require(_0x00e4('0x0'));var util=require(_0x00e4('0x1'));var moment=require(_0x00e4('0x2'));var winston=require(_0x00e4('0x3'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x00e4('0x4')]['toLowerCase']():_0x00e4('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x00e4('0x6'),'error':'red','warn':_0x00e4('0x7'),'info':_0x00e4('0x8'),'print':_0x00e4('0x9'),'success':_0x00e4('0xa'),'http':_0x00e4('0xb'),'verbose':_0x00e4('0xc'),'debug':_0x00e4('0xd'),'silly':_0x00e4('0xe')};winston[_0x00e4('0xf')](XC_LOG_COLORS);function getLogFileName(_0x1d97d5,_0x27b7fa,_0x184cea){var _0x57f77b=_0x1d97d5||_0x00e4('0x10');return path[_0x00e4('0x11')](_0x57f77b,util['format'](_0x00e4('0x12'),_0x27b7fa,_0x184cea));}function formatter(_0x2506ca,_0x3e0593){_0x3e0593[_0x00e4('0x13')]=_0x3e0593[_0x00e4('0x13')][_0x00e4('0x14')](/@@{/g,_0x00e4('0x15'))[_0x00e4('0x14')](/}@@/g,_0x00e4('0x16'))[_0x00e4('0x14')](/@{/g,'{{')[_0x00e4('0x14')](/}@/g,'}}');return util['format'](_0x00e4('0x17'),moment()[_0x00e4('0x18')](_0x00e4('0x19')),_0x3e0593['level'][_0x00e4('0x1a')](),_0x2506ca,_0x3e0593[_0x00e4('0x13')]);}function fileFormat(_0x5c4265,_0x334d34){_0x334d34[_0x00e4('0x13')]=_0x334d34[_0x00e4('0x13')][_0x00e4('0x14')](/@@{/g,_0x00e4('0x15'))['replace'](/}@@/g,_0x00e4('0x16'))['replace'](/@{/g,'{{')[_0x00e4('0x14')](/}@/g,'}}');var _0x3ea43f=_0x334d34[_0x00e4('0x1b')]&&Object[_0x00e4('0x1c')](_0x334d34[_0x00e4('0x1b')])[_0x00e4('0x1d')]?'\x0a\x09'+JSON[_0x00e4('0x1e')](_0x334d34[_0x00e4('0x1b')]):'';return util[_0x00e4('0x18')](_0x00e4('0x1f'),moment()[_0x00e4('0x18')](_0x00e4('0x19')),_0x334d34['level']['toUpperCase'](),_0x5c4265,_0x334d34[_0x00e4('0x13')],_0x3ea43f);}function consoleLogger(){var _0x57795b=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x00e4('0x20'))][(_0x00e4('0x21'))]({'level':_0x00e4('0x22'),'json':![],'formatter':function(_0x23668a){return formatter('',_0x23668a);}})]});return _0x57795b;}function fileLogger(_0x261868,_0x5c8058){var _0x2c3cb9=new winston[(_0x00e4('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x00e4('0x24'))]({'name':util['format'](_0x00e4('0x25'),_0x261868,_0x00e4('0x26')),'filename':getLogFileName(_0x5c8058,_0x261868,_0x00e4('0x26')),'level':_0x00e4('0x26'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x389c22){return fileFormat(_0x261868,_0x389c22);}}),new winston[(_0x00e4('0x20'))][(_0x00e4('0x24'))]({'name':util['format'](_0x00e4('0x25'),_0x261868,debugLevel),'filename':getLogFileName(_0x5c8058,_0x261868,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xe3250e){return fileFormat(_0x261868,_0xe3250e);}}),new winston[(_0x00e4('0x20'))]['Console']({'level':_0x00e4('0x22'),'json':![],'formatter':function(_0x437430){return fileFormat(_0x261868,_0x437430);}})]});return _0x2c3cb9;}exports[_0x00e4('0x27')]=consoleLogger;exports[_0x00e4('0x28')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 7499930..7b65060 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x2e5418,_0xda2248){var _0x4ad45a=function(_0x18ebaa){while(--_0x18ebaa){_0x2e5418['push'](_0x2e5418['shift']());}};_0x4ad45a(++_0xda2248);}(_0x0b0e,0x187));var _0xe0b0=function(_0x25c988,_0xce8221){_0x25c988=_0x25c988-0x0;var _0x45fcc2=_0x0b0e[_0x25c988];return _0x45fcc2;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xdb28,0x106));var _0x8db2=function(_0x19a19d,_0x3990e0){_0x19a19d=_0x19a19d-0x0;var _0x28cf47=_0xdb28[_0x19a19d];return _0x28cf47;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index d000f10..d8376fb 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['replace','\x5c$&','exports'];(function(_0xe21c91,_0x236900){var _0x4bd4c7=function(_0xfc6caa){while(--_0xfc6caa){_0xe21c91['push'](_0xe21c91['shift']());}};_0x4bd4c7(++_0x236900);}(_0x326f,0xd1));var _0xf326=function(_0x5a1b8d,_0x2fdbd7){_0x5a1b8d=_0x5a1b8d-0x0;var _0x1b219a=_0x326f[_0x5a1b8d];return _0x1b219a;};module[_0xf326('0x0')]={'escapeRegExp'(_0x55c50e,_0x5452cc=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x55c50e[_0xf326('0x1')](_0x5452cc,_0xf326('0x2'));}}; \ No newline at end of file +var _0xdb28=['exports','replace'];(function(_0x23cbba,_0x2b1d24){var _0x70bff5=function(_0x4eb31f){while(--_0x4eb31f){_0x23cbba['push'](_0x23cbba['shift']());}};_0x70bff5(++_0x2b1d24);}(_0xdb28,0x106));var _0x8db2=function(_0x5c8ced,_0x2ef186){_0x5c8ced=_0x5c8ced-0x0;var _0x285702=_0xdb28[_0x5c8ced];return _0x285702;};module[_0x8db2('0x0')]={'escapeRegExp'(_0x4221b3,_0x1dc797=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4221b3[_0x8db2('0x1')](_0x1dc797,'\x5c$&');}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 11bb545..8f6dda8 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x896e=['map','isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x518578,_0xb8124c){var _0x30b746=function(_0x23dce6){while(--_0x23dce6){_0x518578['push'](_0x518578['shift']());}};_0x30b746(++_0xb8124c);}(_0x896e,0x1e9));var _0xe896=function(_0x3f366f,_0x5626df){_0x3f366f=_0x3f366f-0x0;var _0x57a5df=_0x896e[_0x3f366f];return _0x57a5df;};var _=require(_0xe896('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1bab19){return _0x1bab19==='{{'?_0xe896('0x1'):_0xe896('0x2');}function safeTemplate(_0x36085e){var _0x26d296=_0x36085e;if(typeof _0x36085e===_0xe896('0x3')){_0x26d296=_0x36085e[_0xe896('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe896('0x5')](_0x36085e)){_0x26d296=_0x36085e[_0xe896('0x6')](function(_0x244f68){return safeTemplate(_0x244f68);});}else if(_[_0xe896('0x7')](_0x36085e)){_0x26d296=Object['keys'](_0x36085e)[_0xe896('0x8')](function(_0x7a0721,_0x3b902c){_0x7a0721[_0x3b902c]=safeTemplate(_0x36085e[_0x3b902c]);return _0x7a0721;},{});}return _0x26d296;}module[_0xe896('0x9')][_0xe896('0xa')]=safeTemplate; \ No newline at end of file +var _0x955f=['map','isPlainObject','keys','reduce','exports','lodash','{\x20{\x20','\x20}\x20}','string'];(function(_0xbd1d4f,_0x40ea7d){var _0x3a5f0f=function(_0x255405){while(--_0x255405){_0xbd1d4f['push'](_0xbd1d4f['shift']());}};_0x3a5f0f(++_0x40ea7d);}(_0x955f,0x1eb));var _0xf955=function(_0x96a4ff,_0x3bbffb){_0x96a4ff=_0x96a4ff-0x0;var _0x256650=_0x955f[_0x96a4ff];return _0x256650;};var _=require(_0xf955('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x471baa){return _0x471baa==='{{'?_0xf955('0x1'):_0xf955('0x2');}function safeTemplate(_0x2834f7){var _0x585f6e=_0x2834f7;if(typeof _0x2834f7===_0xf955('0x3')){_0x585f6e=_0x2834f7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x2834f7)){_0x585f6e=_0x2834f7[_0xf955('0x4')](function(_0x5a20bc){return safeTemplate(_0x5a20bc);});}else if(_[_0xf955('0x5')](_0x2834f7)){_0x585f6e=Object[_0xf955('0x6')](_0x2834f7)[_0xf955('0x7')](function(_0x59d5b3,_0x18432f){_0x59d5b3[_0x18432f]=safeTemplate(_0x2834f7[_0x18432f]);return _0x59d5b3;},{});}return _0x585f6e;}module[_0xf955('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index ce6407a..2d653d4 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9d5=['writeJSON','exports','fs-extra','path','../config/environment','resolve','server/app.json','isArray','apps','findIndex','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','Updating\x20app.json'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xd9d5,0x1dd));var _0x5d9d=function(_0x1c7020,_0x17085a){_0x1c7020=_0x1c7020-0x0;var _0x38363d=_0xd9d5[_0x1c7020];return _0x38363d;};var fs=require(_0x5d9d('0x0'));var path=require(_0x5d9d('0x1'));var config=require(_0x5d9d('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x5d9d('0x3')](root,_0x5d9d('0x4'));var NODEPATH=path[_0x5d9d('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0xbb05bf){let _0x2741ff=![];if(Array[_0x5d9d('0x5')](_0xbb05bf[_0x5d9d('0x6')])){var _0x3a77bd=_0xbb05bf[_0x5d9d('0x6')][_0x5d9d('0x7')](function(_0x31285e){return _0x31285e['name']===_0x5d9d('0x8');});if(_0x3a77bd>-0x1){var _0x45f536=_0xbb05bf[_0x5d9d('0x6')][_0x3a77bd];if(typeof _0x45f536[_0x5d9d('0x9')][_0x5d9d('0xa')]!==_0x5d9d('0xb')){_0x45f536[_0x5d9d('0x9')]['NODE_PATH']=NODEPATH;_0x2741ff=!![];}}return{'appConfig':_0xbb05bf,'updated':_0x2741ff};}}function updateAppConfig(_0x5b3f0e){return fs[_0x5d9d('0xc')](APP_JSON_PATH)[_0x5d9d('0xd')](function(_0x4fdd2c){if(_0x4fdd2c){return fs[_0x5d9d('0xe')](APP_JSON_PATH)[_0x5d9d('0xd')](function(_0x40c166){var _0x3e21ee=setLegacyLibsNodeEnvPath(_0x40c166);if(_0x3e21ee[_0x5d9d('0xf')]){_0x5b3f0e['info'](_0x5d9d('0x10'));return fs[_0x5d9d('0x11')](APP_JSON_PATH,_0x40c166,{'spaces':0x2});}else{return Promise[_0x5d9d('0x3')]();}});}else{return Promise[_0x5d9d('0x3')]();}});}module[_0x5d9d('0x12')]=updateAppConfig; \ No newline at end of file +var _0x313e=['isArray','apps','findIndex','motion2','env','NODE_PATH','pathExists','readJSON','updated','info','writeJSON','exports','fs-extra','path','../config/environment','resolve','legacy-libs'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x313e,0x11c));var _0xe313=function(_0x4cc280,_0x3b77f3){_0x4cc280=_0x4cc280-0x0;var _0x16ed24=_0x313e[_0x4cc280];return _0x16ed24;};var fs=require(_0xe313('0x0'));var path=require(_0xe313('0x1'));var config=require(_0xe313('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0xe313('0x3')](root,'server/app.json');var NODEPATH=path[_0xe313('0x3')](root,_0xe313('0x4'));function setLegacyLibsNodeEnvPath(_0x15d72c){let _0x837b3=![];if(Array[_0xe313('0x5')](_0x15d72c[_0xe313('0x6')])){var _0x372e5a=_0x15d72c[_0xe313('0x6')][_0xe313('0x7')](function(_0x3ab5d7){return _0x3ab5d7['name']===_0xe313('0x8');});if(_0x372e5a>-0x1){var _0x50f0a9=_0x15d72c[_0xe313('0x6')][_0x372e5a];if(typeof _0x50f0a9[_0xe313('0x9')]['NODE_PATH']!=='string'){_0x50f0a9[_0xe313('0x9')][_0xe313('0xa')]=NODEPATH;_0x837b3=!![];}}return{'appConfig':_0x15d72c,'updated':_0x837b3};}}function updateAppConfig(_0x15b6fc){return fs[_0xe313('0xb')](APP_JSON_PATH)['then'](function(_0x1dedbf){if(_0x1dedbf){return fs[_0xe313('0xc')](APP_JSON_PATH)['then'](function(_0x377fa1){var _0x9818d1=setLegacyLibsNodeEnvPath(_0x377fa1);if(_0x9818d1[_0xe313('0xd')]){_0x15b6fc[_0xe313('0xe')]('Updating\x20app.json');return fs[_0xe313('0xf')](APP_JSON_PATH,_0x377fa1,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xe313('0x3')]();}});}module[_0xe313('0x10')]=updateAppConfig; \ No newline at end of file